| Previous | 15994 Revisions | Next |
| r2376 Saturday 12th April, 2008 at 16:45:56 UTC by Nathan Woods |
|---|
| Updated to MAME 0.124u2 core |
| [docs] | messnew.txt |
| [src/emu] | cpuexec.h cpuintrf.c emupal.c info.c inptport.c inptport.h input.c mame.c mconfig.h memory.c memory.h state.c state.h streams.c tilemap.c tilemap.h timer.c video.c video.h |
| [src/emu/cpu] | cpu.mak |
| [src/emu/cpu/alph8201] | alph8201.h |
| [src/emu/cpu/apexc] | apexc.c |
| [src/emu/cpu/ccpu] | ccpu.c |
| [src/emu/cpu/cop400] | 410ops.c |
| [src/emu/cpu/e132xs] | e132xs.c |
| [src/emu/cpu/f8] | f8.c |
| [src/emu/cpu/g65816] | g65816.h |
| [src/emu/cpu/h6280] | h6280ops.h |
| [src/emu/cpu/h83002] | h83002.c h8periph.c |
| [src/emu/cpu/hd6309] | hd6309.c hd6309.h |
| [src/emu/cpu/i386] | i386.c |
| [src/emu/cpu/i8039] | i8039.h |
| [src/emu/cpu/i8051] | i8051.c |
| [src/emu/cpu/i8085] | i8085.c i8085cpu.h |
| [src/emu/cpu/i86] | i286.h i86mem.c |
| [src/emu/cpu/i8x41] | i8x41.c |
| [src/emu/cpu/jaguar] | jaguar.c |
| [src/emu/cpu/konami] | konami.h |
| [src/emu/cpu/m37710] | m37710.c |
| [src/emu/cpu/m6502] | m4510.c m6502.c m6509.c m65ce02.c minc4510.h mincce02.h ops02.h ops09.h tdeco16.c |
| [src/emu/cpu/m6800] | m6800.c m6800.h |
| [src/emu/cpu/m68000] | m68kcpu.c m68kmame.c |
| [src/emu/cpu/m6805] | m6805.h |
| [src/emu/cpu/m6809] | m6809.h |
| [src/emu/cpu/mb88xx] | mb88xx.c |
| [src/emu/cpu/minx] | minx.c |
| [src/emu/cpu/mips] | dismips.c dismips.mak mips3com.c mips3com.h mips3fe.c mipsdasm.c psx.c psx.h |
| [src/emu/cpu/nec] | nec.c necdasm.c |
| [src/emu/cpu/pic16c5x] | pic16c5x.h |
| [src/emu/cpu/s2650] | s2650.c |
| [src/emu/cpu/sm8500] | sm8500.c |
| [src/emu/cpu/spc700] | spc700.h |
| [src/emu/cpu/tlcs90] | tlcs90.c |
| [src/emu/cpu/tms34010] | tms34010.c |
| [src/emu/cpu/tms7000] | tms7000.c |
| [src/emu/cpu/tms9900] | 99xxcore.h |
| [src/emu/cpu/upd7810] | upd7810.c |
| [src/emu/cpu/v30mz] | v30mz.h |
| [src/emu/cpu/z180] | z180.c z180ops.h |
| [src/emu/cpu/z80] | z80.c |
| [src/emu/cpu/z8000] | z8000.c |
| [src/emu/cpu/z80gb] | z80gb.c |
| [src/emu/drivers] | xtal.h |
| [src/emu/machine] | generic.c pit8253.c pit8253.h scsicd.c scsicd.h |
| [src/emu/sound] | 2151intf.c 2203intf.c 2608intf.c 2610intf.c 2612intf.c disc_inp.c fmopl.c k054539.c multipcm.c samples.c upd7759.c vlm5030.c ym2151.c ym2151.h ymz280b.c |
| [src/emu/video] | cdp1869.c mc6845.c poly.c |
| [src/lib/util] | xmlfile.c |
| [src/mame] | mame.mak mamedriv.c |
| [src/mame/audio] | 8080bw.c atarijsa.c cyberbal.c harddriv.c mcr.c mw8080bw.c |
| [src/mame/drivers] | 8080bw.c 88games.c acefruit.c actfancr.c aerofgt.c aladbl.c aleck64.c alg.c alpha68k.c amspdwy.c angelkds.c aquarium.c arabian.c arcadia.c armedf.c artmagic.c astinvad.c astrocde.c astrof.c atarig1.c atarig42.c atarigt.c atarigx2.c atarisy1.c atarisy2.c atetris.c attckufo.c backfire.c badlands.c baraduke.c batman.c battlera.c bbusters.c beaminv.c beathead.c berzerk.c bfcobra.c bfm_sc2.c bigevglf.c bionicc.c bishi.c bishjan.c bladestl.c blktiger.c blmbycar.c blockade.c blstroid.c bmcbowl.c bnstars.c boxer.c btoads.c bwidow.c bwing.c bzone.c cabal.c calomega.c canyon.c capbowl.c cave.c cbasebal.c cbuster.c ccastles.c centiped.c cham24.c champbwl.c changela.c chinsan.c chqflag.c cidelsa.c cinemat.c cischeat.c citycon.c clayshoo.c cliffhgr.c cloud9.c clshroad.c cninja.c cojag.c combatsc.c coolpool.c cop01.c copsnrob.c cosmic.c cps1.c cps2.c cps3.c crbaloon.c crgolf.c crshrace.c crystal.c cshooter.c csk.c cubocd32.c cyberbal.c cybertnk.c darius.c darkhors.c darkseal.c dassault.c dbz.c dcheese.c ddayjlc.c ddenlovr.c deadang.c dec8.c deco156.c deco32.c deco_mlc.c decocass.c destroyr.c djboy.c djmain.c dkong.c dlair.c docastle.c dragrace.c dreamwld.c dribling.c dunhuang.c dynax.c embargo.c enigma2.c eolith.c eolith16.c eprom.c equites.c ertictac.c ettrivia.c exidy.c exidy440.c exprraid.c exterm.c fantland.c fcrash.c fgoal.c filetto.c firebeat.c firetrap.c firetrk.c flkatck.c flstory.c flyball.c foodf.c freekick.c fromanc2.c fromance.c fuukifg3.c gaelco2.c gaelco3d.c galaga.c galaxian.c galaxold.c galpani3.c gamecstl.c gameplan.c gaplus.c gauntlet.c genesis.c gladiatr.c goal92.c gomoku.c goodejan.c gottlieb.c grchamp.c gridlee.c gsword.c gticlub.c guab.c gundealr.c hal21.c halleys.c hanaawas.c hitme.c hnayayoi.c hng64.c homedata.c homerun.c hornet.c hyperspt.c igs_blit.c imolagp.c inufuku.c itech32.c itech8.c jack.c jackal.c jalmah.c jchan.c jcross.c jedi.c jongkyo.c jpmimpct.c kaneko16.c karnov.c kinst.c kinstb.c klax.c koikoi.c konamigq.c konamigv.c konamigx.c kopunch.c ksys573.c ladybug.c laserbat.c lastfght.c lazercmd.c legionna.c lemmings.c lethal.c lethalj.c liberate.c liberatr.c limenko.c lockon.c lordgun.c lvcards.c m10.c m62.c m72.c m79amb.c m90.c m92.c macrossp.c macs.c magicfly.c malzak.c mappy.c marineb.c marinedt.c marvins.c matmania.c maxaflex.c mayumi.c mazerbla.c mcatadv.c mcr.c mcr3.c mcr68.c mediagx.c megadriv.c megaplay.c megasys1.c megatech.c megazone.c meijinsn.c meritm.c metlclsh.c metro.c mgolf.c micro3d.c midas.c midvunit.c midzeus.c mirage.c missile.c mitchell.c mjkjidai.c mjsister.c model1.c model2.c model3.c moo.c mpu4.c mquake.c mrflea.c ms32.c msisaac.c mugsmash.c multigam.c mw8080bw.c mystwarr.c namcoic.c namcona1.c namconb1.c namcos1.c namcos10.c namcos11.c namcos12.c namcos22.c namcos86.c naughtyb.c nbmj9195.c nemesis.c neodrvr.c neogeo.c ninjakd2.c ninjaw.c niyanpai.c nova2001.c nwk-tr.c nycaptor.c offtwall.c ojankohs.c omegrace.c oneshot.c opwolf.c othunder.c pacland.c pacman.c peplus.c pgm.c phoenix.c playmark.c plygonet.c pmpoker.c pntnpuzl.c polepos.c policetr.c polyplay.c poolshrk.c popper.c powerbal.c progolf.c psikyo.c psikyo4.c psikyosh.c quantum.c rabbit.c raiden2.c rcasino.c realbrk.c redalert.c redclash.c relief.c renegade.c rmhaihai.c rockola.c rohga.c route16.c royalmah.c rpunch.c runaway.c rungun.c sbowling.c sbrkout.c sderby.c seattle.c segac2.c segae.c segag80r.c segag80v.c segahang.c segaorun.c segas16a.c segas16b.c segas18.c segas24.c segas32.c segaxbd.c segaybd.c seibuspi.c seicross.c sengokmj.c seta.c seta2.c sf.c sgladiat.c shadfrce.c shootout.c shuuz.c sidearms.c silkroad.c simpl156.c skullxbo.c skyfox.c skykid.c skyraid.c slapshot.c snk.c snk68.c sonson.c spdodgeb.c speedatk.c sprint2.c sprint4.c sprint8.c srmp2.c srmp6.c ssf2md.c ssfindo.c sshangha.c ssingles.c ssozumo.c ssrj.c ssv.c st0016.c stactics.c stadhero.c starfire.c starshp1.c stlforce.c stv.c suna8.c supbtime.c superqix.c suprnova.c suprridr.c system16.c system18.c tagteam.c taito_f2.c taito_f3.c taito_h.c taito_l.c taito_x.c taito_z.c taitoair.c taitojc.c taitosj.c taitowlf.c tankbatt.c tatsumi.c taxidrvr.c tceptor.c tehkanwc.c tempest.c terracre.c tetrisp2.c thedeep.c thief.c thunderj.c tickee.c tmaster.c tmnt.c tnzs.c toaplan1.c toaplan2.c toobin.c topspeed.c toratora.c tourtabl.c toypop.c triplhnt.c truco.c tryout.c tugboat.c tumbleb.c tumblep.c tunhunt.c turbo.c twin16.c twincobr.c tx1.c uapce.c ultraman.c ultratnk.c ultrsprt.c unico.c upscope.c usgames.c vamphalf.c vaportra.c vastar.c vegaeo.c vegas.c vendetta.c vicdual.c videopin.c vindictr.c vmetal.c wardner.c warpwarp.c warriorb.c wc90b.c wecleman.c welltris.c wgp.c wheelfir.c wilytowr.c wink.c wiping.c witch.c wolfpack.c wwfsstar.c wwfwfest.c xain.c xexex.c xmen.c xorworld.c xtheball.c xxmissio.c xybots.c xyonix.c yumefuda.c zaccaria.c zaxxon.c zerozone.c zn.c zr107.c |
| [src/mame/includes] | 8080bw.h amiga.h atari.h cps1.h mw8080bw.h neogeo.h phoenix.h psx.h snk.h st0016.h toaplan1.h twincobr.h vicdual.h |
| [src/mame/machine] | ajax.c amiga.c asteroid.c atari.c atarifb.c atarigen.c atarigen.h balsente.c beezer.c bonzeadv.c bublbobl.c carpolo.c cchip.c copsnrob.c daikaiju.c dc.c dec0.c decocass.c decocass.h decoprot.c gaelco2.c galaxold.c gaplus.c harddriv.c irem_cpu.c irobot.c kaneko16.c leland.c lsasquad.c mcr.c mexico86.c mhavoc.c midtunit.c midwayic.c midwunit.c midyunit.c n64.c namcoio.c namcos1.c namcos2.c nb1413m3.c nitedrvr.c opwolf.c pcecommn.c pckeybrd.c pgmprot.c playch10.c psx.c qix.c rainbow.c s16fd.c s24fd.c scramble.c seicop.c* simpsons.c slikshot.c snes.c starwars.c stfight.c strtheat.c subs.c tait8741.c tatsumi.c tnzs.c toaplan1.c twincobr.c vertigo.c volfied.c vsnes.c williams.c xevious.c |
| [src/mame/video] | 8080bw.c aeroboto.c aerofgt.c amiga.c asterix.c astrocde.c asuka.c atari.c bionicc.c bking.c blockade.c btime.c bwing.c canyon.c centiped.c chaknpop.c cinemat.c cischeat.c cloak.c combatsc.c cps1.c darius.c dbz.c dcheese.c dkong.c exidy.c exidy440.c fgoal.c gijoe.c gtia.c gtia.h itech8.c jaguar.c konamiic.c konamiic.h lazercmd.c lethal.c lethalj.c lordgun.c m52.c m57.c m58.c m62.c m72.c m92.c madalien.c mario.c momoko.c moo.c mystston.c n8080.c namcofl.c namcona1.c namconb1.c naughtyb.c neogeo.c ninjaw.c nmk16.c oneshot.c orbit.c othunder.c overdriv.c parodius.c phoenix.c polepos.c policetr.c ppu2c0x.c prehisle.c psikyo.c psx.c psychic5.c rastan.c renegade.c segaic24.c simpsons.c snes.c snk.c sonson.c st0016.c stvvdp1.c stvvdp2.c superqix.c surpratk.c system1.c taito_f2.c taito_z.c taitoic.c taitoic.h taitosj.c tceptor.c tmnt.c toaplan1.c topspeed.c travrusa.c turbo.c twincobr.c vendetta.c vicdual.c warpwarp.c warriorb.c wgp.c xexex.c xmen.c ygv608.c zac2650.c |
| [src/mess] | inputx.c inputx.h mess.mak |
| [src/mess/devices] | coco_fdc.c thomflop.c |
| [src/mess/drivers] | a2600.c apexc.c bw2.c coupe.c cpschngr.c psx.c |
| [src/mess/machine] | 6883sam.c apple2.c c64.c coco.c cpm_bios.c lynx.c mac.c nascom1.c nes_mmc.c pdp1.c pokemini.c spectrum.c thomson.c trs80.c tx0.c vtech1.c wswan.c |
| [src/mess/video] | coco3.c gb.c m6847.c oric.c pc_video.c |
| [src/osd/windows] | input.c |
| [src/osd/winui] | winui.c |
| r2375 | r2376 | |
|---|---|---|
| 41 | 41 | |
| 42 | 42 | READ8_HANDLER( cyberbal_special_port3_r ) |
| 43 | 43 | { |
| 44 | int temp = readinputport(3); | |
| 45 | if (!(readinputport(0) & 0x8000)) temp ^= 0x80; | |
| 44 | int temp = input_port_read_indexed(machine, 3); | |
| 45 | if (!(input_port_read_indexed(machine, 0) & 0x8000)) temp ^= 0x80; | |
| 46 | 46 | if (atarigen_cpu_to_sound_ready) temp ^= 0x40; |
| 47 | 47 | if (atarigen_sound_to_cpu_ready) temp ^= 0x20; |
| 48 | 48 | return temp; |
| r2375 | r2376 | |
|---|---|---|
| 221 | 221 | 0x02 = coin 2 |
| 222 | 222 | 0x01 = coin 1 |
| 223 | 223 | */ |
| 224 | result = readinputportbytag("JSAI"); | |
| 225 | if (!(readinputport(test_port) & test_mask)) result ^= 0x80; | |
| 224 | result = input_port_read(machine, "JSAI"); | |
| 225 | if (!(input_port_read_indexed(machine, test_port) & test_mask)) result ^= 0x80; | |
| 226 | 226 | if (atarigen_cpu_to_sound_ready) result ^= 0x40; |
| 227 | 227 | if (atarigen_sound_to_cpu_ready) result ^= 0x20; |
| 228 | 228 | if (!has_tms5220 || tms5220_ready_r()) result ^= 0x10; |
| r2375 | r2376 | |
| 348 | 348 | 0x02 = coin 2 |
| 349 | 349 | 0x01 = coin 1 |
| 350 | 350 | */ |
| 351 | result = readinputportbytag("JSAII"); | |
| 352 | if (!(readinputport(test_port) & test_mask)) result ^= 0x80; | |
| 351 | result = input_port_read(machine, "JSAII"); | |
| 352 | if (!(input_port_read_indexed(machine, test_port) & test_mask)) result ^= 0x80; | |
| 353 | 353 | if (atarigen_cpu_to_sound_ready) result ^= 0x40; |
| 354 | 354 | if (atarigen_sound_to_cpu_ready) result ^= 0x20; |
| 355 | 355 | break; |
| r2375 | r2376 | |
| 467 | 467 | 0x02 = coin L (active high) |
| 468 | 468 | 0x01 = coin R (active high) |
| 469 | 469 | */ |
| 470 | result = readinputportbytag("JSAIII"); | |
| 471 | if (!(readinputport(test_port) & test_mask)) result ^= 0x90; | |
| 470 | result = input_port_read(machine, "JSAIII"); | |
| 471 | if (!(input_port_read_indexed(machine, test_port) & test_mask)) result ^= 0x90; | |
| 472 | 472 | if (atarigen_cpu_to_sound_ready) result ^= 0x40; |
| 473 | 473 | if (atarigen_sound_to_cpu_ready) result ^= 0x20; |
| 474 | 474 | break; |
| r2375 | r2376 | |
| 604 | 604 | 0x02 = coin L (active high) |
| 605 | 605 | 0x01 = coin R (active high) |
| 606 | 606 | */ |
| 607 | result = readinputportbytag("JSAIII"); | |
| 608 | if (!(readinputport(test_port) & test_mask)) result ^= 0x90; | |
| 607 | result = input_port_read(machine, "JSAIII"); | |
| 608 | if (!(input_port_read_indexed(machine, test_port) & test_mask)) result ^= 0x90; | |
| 609 | 609 | if (atarigen_cpu_to_sound_ready) result ^= 0x40; |
| 610 | 610 | if (atarigen_sound_to_cpu_ready) result ^= 0x20; |
| 611 | 611 | break; |
| r2375 | r2376 | |
|---|---|---|
| 414 | 414 | READ8_HANDLER( ssio_input_port_r ) |
| 415 | 415 | { |
| 416 | 416 | static const char *const port[] = { "SSIO.IP0", "SSIO.IP1", "SSIO.IP2", "SSIO.IP3", "SSIO.IP4" }; |
| 417 | UINT8 result = | |
| 417 | UINT8 result = | |
| 418 | 418 | if (ssio_custom_input[offset]) |
| 419 | 419 | result = (result & ~ssio_custom_input_mask[offset]) | |
| 420 | 420 | ((*ssio_custom_input[offset])(machine, offset) & ssio_custom_input_mask[offset]); |
| r2375 | r2376 | |
|---|---|---|
| 179 | 179 | // D13 = Test Switch |
| 180 | 180 | // D12 = 5220 Ready Flag (0=Ready) |
| 181 | 181 | logerror("%06X:hdsnd68k_status_r(%04X)\n", activecpu_get_previouspc(), offset); |
| 182 | return (mainflag << 15) | (soundflag << 14) | 0x2000 | 0;//(( | |
| 182 | return (mainflag << 15) | (soundflag << 14) | 0x2000 | 0;//(( | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 |
| r2375 | r2376 | |
|---|---|---|
| 60 | 60 | if (rising_bits & 0x08) sample_start_n(0, 4, 6, 0); /* FLEET */ |
| 61 | 61 | if (rising_bits & 0x10) sample_start_n(0, 3, 7, 0); /* SAUCER HIT */ |
| 62 | 62 | |
| 63 | c8080bw_flip_screen_w(data & 0x20); | |
| 63 | c8080bw_flip_screen_w(machine, data & 0x20); | |
| 64 | 64 | |
| 65 | 65 | port_2_last = data; |
| 66 | 66 | } |
| r2375 | r2376 | |
| 145 | 145 | if (rising_bits & 0x10) sample_start(3, 6, 0); /* Shooting Star and Rescue Ship sounds */ |
| 146 | 146 | if (~data & 0x10 && port_2_last & 0x10) sample_stop (3); /* This makes the rescue ship sound beep on and off */ |
| 147 | 147 | |
| 148 | c8080bw_flip_screen_w(data & 0x20); | |
| 148 | c8080bw_flip_screen_w(machine, data & 0x20); | |
| 149 | 149 | |
| 150 | 150 | port_2_last = data; |
| 151 | 151 | } |
| r2375 | r2376 | |
| 196 | 196 | if (data & 0x04) sample_start(0, 4, 0); /* Plane is dropping new balloons at start of level */ |
| 197 | 197 | if (rising_bits & 0x10) sample_start(2, 2, 0); /* Balloon hit and bomb drops */ |
| 198 | 198 | |
| 199 | c8080bw_flip_screen_w(data & 0x20); | |
| 199 | c8080bw_flip_screen_w(machine, data & 0x20); | |
| 200 | 200 | |
| 201 | 201 | port_2_last = data; |
| 202 | 202 | } |
| r2375 | r2376 | |
| 623 | 623 | |
| 624 | 624 | coin_lockout_global_w(data & 0x04); /* SX8 */ |
| 625 | 625 | |
| 626 | c8080bw_flip_screen_w(data & 0x20); /* SX11 */ | |
| 626 | c8080bw_flip_screen_w(machine, data & 0x20); /* SX11 */ | |
| 627 | 627 | |
| 628 | 628 | /* 0x01 - SX6 - Plane Down */ |
| 629 | 629 | discrete_sound_w(machine, POLARIS_SX6_EN, data & 0x01); |
| r2375 | r2376 | |
| 854 | 854 | |
| 855 | 855 | schaser_background_control_w(data & 0x18); |
| 856 | 856 | |
| 857 | c8080bw_flip_screen_w(data & 0x20); | |
| 857 | c8080bw_flip_screen_w(machine, data & 0x20); | |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | |
| r2375 | r2376 | |
| 998 | 998 | if (rising_bits & 0x08) sample_start(3, 0, 0); /* start intermission, end game */ |
| 999 | 999 | //if (rising_bits & 0x10) sample_start(3, 9, 0); /* Dog barking */ |
| 1000 | 1000 | |
| 1001 | c8080bw_flip_screen_w(data & 0x20); | |
| 1001 | c8080bw_flip_screen_w(machine, data & 0x20); | |
| 1002 | 1002 | |
| 1003 | 1003 | port_2_last = data; |
| 1004 | 1004 | } |
| r2375 | r2376 | |
| 1030 | 1030 | |
| 1031 | 1031 | sound_global_enable(data & 0x10); |
| 1032 | 1032 | |
| 1033 | c8080bw_flip_screen_w(data & 0x20); | |
| 1033 | c8080bw_flip_screen_w(machine, data & 0x20); | |
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | 1036 | |
| r2375 | r2376 | |
| 1065 | 1065 | |
| 1066 | 1066 | if (rising_bits & 0x10) sample_start(2, 7, 0); /* Game Over */ |
| 1067 | 1067 | |
| 1068 | c8080bw_flip_screen_w(data & 0x20); | |
| 1068 | c8080bw_flip_screen_w(machine, data & 0x20); | |
| 1069 | 1069 | |
| 1070 | 1070 | port_2_last = data; |
| 1071 | 1071 | } |
| r2375 | r2376 | |
|---|---|---|
| 321 | 321 | |
| 322 | 322 | /* if (data & 0x10) enable CHEER sound */ |
| 323 | 323 | |
| 324 | if (tornbase_get_cabinet_type() == TORNBASE_CAB_TYPE_UPRIGHT_OLD) | |
| 324 | if (tornbase_get_cabinet_type(machine) == TORNBASE_CAB_TYPE_UPRIGHT_OLD) | |
| 325 | 325 | { |
| 326 | 326 | /* if (data & 0x20) enable WHISTLE sound */ |
| 327 | 327 | |
| r2375 | r2376 | |
| 570 | 570 | void maze_write_discrete(running_machine *machine, UINT8 maze_tone_timing_state) |
| 571 | 571 | { |
| 572 | 572 | /* controls need to be active low */ |
| 573 | int controls = ~ | |
| 573 | int controls = ~ | |
| 574 | 574 | |
| 575 | 575 | discrete_sound_w(machine, MAZE_TONE_TIMING, maze_tone_timing_state); |
| 576 | 576 | discrete_sound_w(machine, MAZE_P1_DATA, controls & 0x0f); |
| r2375 | r2376 | |
| 582 | 582 | /* A better option might be to update it at vblank or set a timer to do it. */ |
| 583 | 583 | /* The only noticeable difference doing it here, is that the controls don't */ |
| 584 | 584 | /* imediately start making tones if pressed right after the coin is inserted. */ |
| 585 | discrete_sound_w(machine, MAZE_COIN, (~ | |
| 585 | discrete_sound_w(machine, MAZE_COIN, (~ | |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | |
| r2375 | r2376 | |
| 3659 | 3659 | discrete_sound_w(machine, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 1), data & 0x10); |
| 3660 | 3660 | |
| 3661 | 3661 | /* the flip screen line is only connected on the cocktail PCB */ |
| 3662 | if (invaders_is_cabinet_cocktail()) | |
| 3662 | if (invaders_is_cabinet_cocktail(machine)) | |
| 3663 | 3663 | { |
| 3664 | 3664 | invaders_set_flip_screen((data >> 5) & 0x01); |
| 3665 | 3665 | } |
| r2375 | r2376 | |
|---|---|---|
| 760 | 760 | coin_counter_w(1, CRAM[0][8] & 0x20); |
| 761 | 761 | coin_counter_w(0, CRAM[0][8] & 0x10); |
| 762 | 762 | |
| 763 | CRAM[0][3] = readinputportbytag("800007"); /* STARTn + SERVICE1 */ | |
| 764 | CRAM[0][4] = readinputportbytag("800009"); /* COINn */ | |
| 765 | CRAM[0][5] = readinputportbytag("80000B"); /* Player controls + TILT */ | |
| 766 | CRAM[0][6] = readinputportbytag("80000D"); /* Player controls (cocktail) */ | |
| 763 | CRAM[0][3] = input_port_read(machine, "800007"); /* STARTn + SERVICE1 */ | |
| 764 | CRAM[0][4] = input_port_read(machine, "800009"); /* COINn */ | |
| 765 | CRAM[0][5] = input_port_read(machine, "80000B"); /* Player controls + TILT */ | |
| 766 | CRAM[0][6] = input_port_read(machine, "80000D"); /* Player controls (cocktail) */ | |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | /************************************* |
| r2375 | r2376 | |
|---|---|---|
| 170 | 170 | switch ( offset ) |
| 171 | 171 | { |
| 172 | 172 | default: |
| 173 | case 0: return ~BITSWAP8(readinputport(0),6,7,5,4,3,2,1,0) >> 4; | |
| 174 | case 1: return ~readinputport(1) & 0x0f; | |
| 175 | case 2: return ~readinputport(1) >> 4; | |
| 176 | case 3: return ~readinputport(0) & 0x0f; | |
| 173 | case 0: return ~BITSWAP8(input_port_read_indexed(machine, 0),6,7,5,4,3,2,1,0) >> 4; | |
| 174 | case 1: return ~input_port_read_indexed(machine, 1) & 0x0f; | |
| 175 | case 2: return ~input_port_read_indexed(machine, 1) >> 4; | |
| 176 | case 3: return ~input_port_read_indexed(machine, 0) & 0x0f; | |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 |
| r2375 | r2376 | |
|---|---|---|
| 109 | 109 | |
| 110 | 110 | const UINT8 lethalth_decryption_table[256] = { |
| 111 | 111 | 0x7f,0x26,0x5d,xxxx,0xba,xxxx,0x1e,0x5e, 0xb8,xxxx,0xbc,0xe8,0x01,xxxx,0x4a,0x25, /* 00 */ |
| 112 | // !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! | |
| 112 | 113 | xxxx,0xbd,xxxx,0x22,0x10,xxxx,0x02,0x57, 0x70,xxxx,0x7c,xxxx,0xe7,0x52,xxxx,0xa9, /* 10 */ |
| 113 | // | |
| 114 | // !!!! | |
| 114 | 115 | xxxx,xxxx,0xc6,0x06,0xa0,0xfe,0xcf,0x8e, 0x43,0x8f,0x2d,xxxx,0xd4,0x85,0x75,0xa2, /* 20 */ |
| 115 | // | |
| 116 | // !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! | |
| 116 | 117 | 0x3d,xxxx,xxxx,0x38,0x7c,0x89,0xd1,0x80, 0x3b,0x72,0x07,xxxx,0x42,0x37,0x0a,0x18, /* 30 */ |
| 117 | // | |
| 118 | // !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! | |
| 118 | 119 | 0x88,0xb4,0x98,0x8b,0xb9,0x9c,0xad,0x0e, 0x2b,xxxx,0xbf,xxxx,0x55,xxxx,0x56,0xb0, /* 40 */ |
| 119 | // | |
| 120 | // !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! | |
| 120 | 121 | 0x93,0x91,xxxx,0xeb,xxxx,0x50,0x41,0x29, 0x47,xxxx,xxxx,0x60,xxxx,0xab,xxxx,xxxx, /* 50 */ |
| 122 | // !!!! !!!! !!!! !!!! !!!! !!!! !!!! | |
| 121 | 123 | 0xc3,0xe2,0xd0,0xb2,0x11,0x79,xxxx,0x08, xxxx,0xfb,xxxx,0x2c,0x23,xxxx,0x28,0x0d, /* 60 */ |
| 124 | // !!!! !!!! !!!! !!!! !!!! !!!! | |
| 122 | 125 | xxxx,xxxx,xxxx,0x83,0x3c,xxxx,0x1b,0x34, 0x5b,xxxx,0x40,xxxx,xxxx,0x04,0xfc,0x09, /* 70 */ |
| 123 | // | |
| 126 | // !!!! !!!! !!!! !!!! !!!! | |
| 124 | 127 | 0xb1,0xf3,0x8a,xxxx,xxxx,0x87,xxxx,xxxx, xxxx,xxxx,xxxx,xxxx,0xbe,0x84,0x1f,0xe6, /* 80 */ |
| 128 | // !!!! !!!! !!!! !!!! | |
| 125 | 129 | 0xff,xxxx,0x12,xxxx,0xb5,0x36,xxxx,0xb3, xxxx,xxxx,xxxx,0xd2,0x4e,xxxx,xxxx,xxxx, /* 90 */ |
| 130 | // !!!! !!!! !!!! | |
| 126 | 131 | 0xa5,xxxx,xxxx,0xc7,xxxx,0x27,0x0b,xxxx, 0x20,xxxx,xxxx,xxxx,xxxx,xxxx,0x61,0x7f, /* A0 */ |
| 127 | xxxx,xxxx,0x86,0x0f,xxxx,0xb7,xxxx,0x4f, xxxx,xxxx,0xc0,0xfd,xxxx,0x39,xxxx,0x7d, /* B0 */ | |
| 132 | // !!!! !!!! !!!! !!!! | |
| 133 | xxxx,xxxx,0x86,0x0f,xxxx,0xb7,xxxx,0x4f, xxxx,xxxx,0xc0,0xfd,xxxx,0x39,xxxx,0x77, /* B0 */ | |
| 134 | // !!!! !!!! !!!! !!!! !!!! | |
| 128 | 135 | 0x05,0x3a,xxxx,0x48,0x92,0x7a,0x3e,0x03, xxxx,0xf8,xxxx,0x59,0xa8,0x5f,0xf9,0xbb, /* C0 */ |
| 136 | // !!!! !!!! !!!! !!!! !!!! !!!! !!!! | |
| 129 | 137 | 0x81,0xfa,0x9d,0xe9,0x2e,0xa1,0xc1,0x33, xxxx,0x78,xxxx,0x0c,xxxx,0x24,0xaa,0xac, /* D0 */ |
| 138 | // !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! | |
| 130 | 139 | xxxx,0xb6,xxxx,0xea,xxxx,0x73,0xe5,0x58, 0x00,0xf7,xxxx,0x74,xxxx,0x7e,xxxx,0xa3, /* E0 */ |
| 140 | // !!!! !!!! !!!! !!!! !!!! !!!! | |
| 131 | 141 | xxxx,0x5a,0xf6,0x32,0x46,0x2a,xxxx,xxxx, 0x53,0x4b,0x90,xxxx,0x51,0x68,0x99,0x13, /* F0 */ |
| 132 | // | |
| 142 | // !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! | |
| 133 | 143 | }; |
| 144 | /* | |
| 145 | missing opcode: | |
| 146 | ||
| 147 | "!!!!" -> checked against gussun | |
| 148 | "gggg" -> very probably | |
| 149 | "pppp" -> probably | |
| 150 | "????" -> missing | |
| 151 | ||
| 152 | RZ notes: | |
| 153 | 0xbf (0x77) risky challenge use same code | |
| 154 | ||
| 155 | */ | |
| 156 | ||
| 134 | 157 | // 0x2c (0xd4) complete guess |
| 135 | 158 | // 0x2d (0x85) complete guess |
| 136 | 159 | // 0xc4 (0x92) guess |
| 137 | 160 | // 0xbb (0xfd) guess |
| 138 | // 0x46 (0xad) guess | |
| 161 | // 0x46 (0xad) guess - risky challenge use same code | |
| 139 | 162 | // 0x6e (0x28) guess |
| 140 | 163 | // 0x76 (0x1b) guess |
| 141 | 164 | // 0x8d (0x84) guess |
| 142 | // 0xa6 (0x0b) guess | |
| 165 | // 0xa6 (0x0b) guess - risky challenge use same code | |
| 143 | 166 | // 0xa8 (0x20) guess |
| 144 | // 0xbd (0x39) guess | |
| 167 | // 0xbd (0x39) guess - risky challenge use same code | |
| 145 | 168 | // 0xc3 (0x48) guess |
| 146 | 169 | // and our collection of conditional branches: |
| 147 | 170 | // 0xbf (0x7d) >= (monitor test) |
| r2375 | r2376 | |
| 304 | 327 | 0x63,xxxx,xxxx,0x36,xxxx,0x52,0xb1,0x5b, 0x68,0xcd,xxxx,xxxx,xxxx,0xa8,xxxx,xxxx, /* 00 */ |
| 305 | 328 | // gggg gggg gggg gggg |
| 306 | 329 | xxxx,xxxx,0x75,0x24,0x08,0x83,0x32,0xe9, xxxx,0x79,xxxx,0x8f,0x22,xxxx,0xac,xxxx, /* 10 */ |
| 307 | // | |
| 330 | // pppp pppp gggg | |
| 308 | 331 | 0x5d,0xa5,0x11,0x51,0x0a,0x29,xxxx,xxxx ,0xf8,0x98,0x91,0x40,0x28,0x00,0x03,0x5f, /* 20 */ |
| 309 | 332 | // gggg gggg gggg gggg gggg gggg pppp |
| 310 | 333 | 0x26,xxxx,xxxx,0x8b,0x2f,0x02,xxxx,xxxx, 0x8e,0xab,xxxx,xxxx,0xbc,0x90,0xb3,xxxx, /* 30 */ |
| r2375 | r2376 | |
| 322 | 345 | xxxx,xxxx,0x9d,xxxx,0xbb,xxxx,xxxx,0xcb, 0xa9,0xcf,xxxx,0x60,0x43,0x56,xxxx,xxxx, /* 90 */ |
| 323 | 346 | // gggg gggg |
| 324 | 347 | xxxx,0xa3,xxxx,xxxx,0x12,xxxx,0xfa,0xb4, xxxx,0x81,0xe6,0x48,0x80,0x8c,0xd4,xxxx, /* a0 */ |
| 325 | // gggg gggg ???? gggg gggg | |
| 326 | 0x42,xxxx,0x84,0xb6,0x77,0x3d,0x3e,xxxx, xxxx,0xb7,0x4b,xxxx,0xa4,xxxx,xxxx,xxxx, /* b0 */ | |
| 327 | // gggg gggg ???? gggg gggg ???? pppp gggg | |
| 348 | // gggg gggg pppp gggg gggg | |
| 349 | 0x42,xxxx,0x84,0xb6,0x77,0x3d,0x3e,xxxx, xxxx,0x0c,0x4b,xxxx,0xa4,xxxx,xxxx,xxxx, /* b0 */ | |
| 350 | // gggg gggg pppp gggg gggg pppp pppp gggg | |
| 328 | 351 | xxxx,0xff,0x47,xxxx,0x55,0x1e,xxxx,0x59, 0x93,xxxx,xxxx,xxxx,0x88,0xc1,0x01,0xb2, /* c0 */ |
| 329 | // gggg | |
| 352 | // gggg | |
| 330 | 353 | 0x85,0x2e,0x06,0xc7,0x05,xxxx,0x8a,0x5a, 0x58,0xbe,xxxx,0x4e,xxxx,0x1f,0x23,xxxx, /* d0 */ |
| 331 | 354 | // gggg gggg |
| 332 | 355 | 0xe8,xxxx,0x89,0xa1,0xd0,xxxx,xxxx,0xe2, 0x38,0xfe,0x50,0x9c,xxxx,xxxx,xxxx,0x49, /* e0 */ |
| r2375 | r2376 | |
| 343 | 366 | "gggg" -> very probably |
| 344 | 367 | "pppp" -> probably |
| 345 | 368 | "????" -> missing |
| 346 | "0xHH" -> right code (not supported) | |
| 347 | 369 | |
| 348 | 14 -> 08 (2097b 20980 - routine from 2097a) (08 30) to handle the player number -> probably 08 | |
| 349 | ab -> 4f?(19570 - routine from 194e1 to 19619) (when the water go up) | |
| 350 | b3 -> 19 (216b6 - 216cf - 16663 (when you rotate a piece) - 175f1 - 17d2a - 17d36 | |
| 351 | b9 -> b7 (21210 - routine from 2117e to ) 2 bytes - | |
| 352 | ||
| 353 | 370 | rz probably: |
| 371 | 14 -> 08 (2097b 20980 - routine from 2097a) (08 30) to handle the player number -> 08 | |
| 354 | 372 | 19 -> 79 (1df45 routine from 1df27 / 2282f - routine from 2281f to 22871) no 70,78,7a,7b,7c,7e,7f(ok) ok 79,7d |
| 355 | 373 | 5a -> 7c (195eb - (222fc - routine from 222ed to ) (7x j...) no 70,71,79,7a,7b ok (78,7c) -> 7c |
| 356 | 374 | 63 -> 7d (1df7f, 1df8c, 1df95, 21f08 - routine from 1df27 to ) no 70,78,7a,7b,7c,7e,7f(ok) ok 79,7d |
| 357 | 375 | 7b -> 0d |
| 358 | 376 | 82 -> 78 (78,7c) -> 78 |
| 359 | 377 | 86 -> 2d |
| 378 | ab -> 48 (1956f - routine from 194e1 to 19619 - bp 19567) (when the water go up) -> 48 | |
| 379 | b3 -> b6 (216b6 - 216cf - 16663 (when you rotate a piece) - 175f1 - 17d2a - 17d36) -> b6 | |
| 380 | b9 -> 0c (21210 - routine from 2117e to ) 2 bytes -> to handle messages in level 0 (learning level) | |
| 360 | 381 | ba -> 4b (1094d, 10b28 - routine from 10948 to 10b73) one byte -> probably 4b |
| 361 | ce -> 01 (10236 - routine from 1017e to 10254) (01, 09, 19, 21, 29, 31) -> probably 01 | |
| 362 | 382 | f1 -> 20 to handle the player number |
| 363 | 383 | |
| 364 | 384 | rz guess: |
| r2375 | r2376 | |
|---|---|---|
| 61 | 61 | *************************************/ |
| 62 | 62 | READ8_HANDLER( pc10_port_0_r ) |
| 63 | 63 | { |
| 64 | return | |
| 64 | return | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | WRITE8_HANDLER( pc10_SDCS_w ) |
| r2375 | r2376 | |
| 183 | 183 | return; |
| 184 | 184 | |
| 185 | 185 | /* load up the latches */ |
| 186 | input_latch[0] = readinputport( 3 ); | |
| 187 | input_latch[1] = readinputport( 4 ); | |
| 186 | input_latch[0] = input_port_read_indexed(machine, 3 ); | |
| 187 | input_latch[1] = input_port_read_indexed(machine, 4 ); | |
| 188 | 188 | |
| 189 | 189 | /* apply any masking from the BIOS */ |
| 190 | 190 | if ( cntrl_mask ) |
| r2375 | r2376 | |
| 218 | 218 | /* do the gun thing */ |
| 219 | 219 | if ( pc10_gun_controller ) |
| 220 | 220 | { |
| 221 | int trigger = readinputport( 3 ); | |
| 222 | int x = readinputport( 5 ); | |
| 223 | int y = readinputport( 6 ); | |
| 221 | int trigger = input_port_read_indexed(machine, 3 ); | |
| 222 | int x = input_port_read_indexed(machine, 5 ); | |
| 223 | int y = input_port_read_indexed(machine, 6 ); | |
| 224 | 224 | UINT32 pix, color_base; |
| 225 | 225 | |
| 226 | 226 | /* no sprite hit (yet) */ |
| r2375 | r2376 | |
|---|---|---|
| 181 | 181 | READ8_HANDLER( bublbobl_mcu_port1_r ) |
| 182 | 182 | { |
| 183 | 183 | //logerror("%04x: 6801U4 port 1 read\n",activecpu_get_pc()); |
| 184 | port1_in = | |
| 184 | port1_in = | |
| 185 | 185 | return (port1_out & ddr1) | (port1_in & ~ddr1); |
| 186 | 186 | } |
| 187 | 187 | |
| r2375 | r2376 | |
| 230 | 230 | { |
| 231 | 231 | // read |
| 232 | 232 | if ((address & 0x0800) == 0x0000) |
| 233 | port3_in = | |
| 233 | port3_in = | |
| 234 | 234 | else if ((address & 0x0c00) == 0x0c00) |
| 235 | 235 | port3_in = bublbobl_mcu_sharedram[address & 0x03ff]; |
| 236 | 236 | // logerror("reading %02x from shared RAM %04x\n",port3_in,address); |
| r2375 | r2376 | |
| 451 | 451 | if ((address & 0x0800) == 0x0000) |
| 452 | 452 | { |
| 453 | 453 | //logerror("%04x: 68705 read input port %02x\n",activecpu_get_pc(),address); |
| 454 | latch = | |
| 454 | latch = | |
| 455 | 455 | } |
| 456 | 456 | else if ((address & 0x0c00) == 0x0c00) |
| 457 | 457 | { |
| r2375 | r2376 | |
|---|---|---|
| 26 | 26 | static int fd1094_cached_states[CACHE_ENTRIES]; // array of cached state numbers |
| 27 | 27 | static int fd1094_current_cacheposition; // current position in cache array |
| 28 | 28 | |
| 29 | static int fd1094_state; | |
| 30 | static int fd1094_selected_state; | |
| 31 | ||
| 29 | 32 | static void (*fd1094_set_decrypted)(UINT8 *); |
| 30 | 33 | |
| 31 | 34 | void *fd1094_get_decrypted_base(void) |
| r2375 | r2376 | |
| 52 | 55 | int i; |
| 53 | 56 | UINT32 addr; |
| 54 | 57 | |
| 58 | switch (state & 0x300) | |
| 59 | { | |
| 60 | case 0x000: | |
| 61 | case FD1094_STATE_RESET: | |
| 62 | fd1094_selected_state = state & 0xff; | |
| 63 | break; | |
| 64 | } | |
| 65 | ||
| 66 | fd1094_state = state; | |
| 67 | ||
| 55 | 68 | cpunum_set_info_int(0, CPUINFO_INT_REGISTER + M68K_PREF_ADDR, 0x0010); // force a flush of the prefetch cache |
| 56 | 69 | |
| 57 | 70 | /* set the FD1094 state ready to decrypt.. */ |
| r2375 | r2376 | |
| 142 | 155 | cpunum_set_irq_callback(0, fd1094_int_callback); |
| 143 | 156 | } |
| 144 | 157 | |
| 158 | static STATE_POSTLOAD( fd1094_postload ) | |
| 159 | { | |
| 160 | if (fd1094_state != -1) | |
| 161 | { | |
| 162 | int selected_state = fd1094_selected_state; | |
| 163 | int state = fd1094_state; | |
| 145 | 164 | |
| 165 | fd1094_machine_init(); | |
| 166 | ||
| 167 | fd1094_setstate_and_decrypt(selected_state); | |
| 168 | fd1094_setstate_and_decrypt(state); | |
| 169 | } | |
| 170 | } | |
| 171 | ||
| 172 | ||
| 146 | 173 | #ifdef ENABLE_DEBUGGER |
| 147 | 174 | static void key_changed(void) |
| 148 | 175 | { |
| r2375 | r2376 | |
| 186 | 213 | fd1094_cacheregion[i] = auto_malloc(fd1094_cpuregionsize); |
| 187 | 214 | fd1094_cached_states[i] = -1; |
| 188 | 215 | } |
| 189 | fd1094_current_cacheposition = 0; | |
| 216 | fd1094_current_cacheposition = 0; | |
| 217 | fd1094_state = -1; | |
| 190 | 218 | |
| 191 | 219 | #ifdef ENABLE_DEBUGGER |
| 192 | 220 | /* key debugging */ |
| r2375 | r2376 | |
| 196 | 224 | fd1094_init_debugging(REGION_CPU1, REGION_USER1, REGION_USER2, key_changed); |
| 197 | 225 | } |
| 198 | 226 | #endif |
| 227 | ||
| 228 | state_save_register_global(fd1094_selected_state); | |
| 229 | state_save_register_global(fd1094_state); | |
| 230 | state_save_register_postload(Machine, fd1094_postload, NULL); | |
| 199 | 231 | } |
| r2375 | r2376 | |
|---|---|---|
| 77 | 77 | |
| 78 | 78 | switch (tnzs_input_select & 0x0f) |
| 79 | 79 | { |
| 80 | case 0x0a: data = input_port_4_r(machine,0); break; | |
| 81 | case 0x0c: data = input_port_2_r(machine,0); break; | |
| 82 | case 0x0d: data = input_port_3_r(machine,0); break; | |
| 80 | case 0x0a: data = input_port_read_indexed(machine, 4); break; | |
| 81 | case 0x0c: data = input_port_read_indexed(machine, 2); break; | |
| 82 | case 0x0d: data = input_port_read_indexed(machine, 3); break; | |
| 83 | 83 | default: data = 0xff; break; |
| 84 | 84 | } |
| 85 | 85 | |
| r2375 | r2376 | |
| 90 | 90 | |
| 91 | 91 | READ8_HANDLER( tnzs_port2_r ) |
| 92 | 92 | { |
| 93 | int data = input_port_ | |
| 93 | int data = input_port_ | |
| 94 | 94 | |
| 95 | 95 | // logerror("I8742:%04x Read %02x from port 2\n", activecpu_get_previouspc(), data); |
| 96 | 96 | |
| r2375 | r2376 | |
| 117 | 117 | |
| 118 | 118 | // logerror("PC %04x: read input %04x\n", activecpu_get_pc(), 0xf000 + offset); |
| 119 | 119 | |
| 120 | val = | |
| 120 | val = | |
| 121 | 121 | if (offset & 1) |
| 122 | 122 | { |
| 123 | 123 | return ((val >> 8) & 0xff); |
| r2375 | r2376 | |
| 247 | 247 | } |
| 248 | 248 | else return mcu_credits; |
| 249 | 249 | } |
| 250 | else return | |
| 250 | else return | |
| 251 | 251 | |
| 252 | 252 | default: |
| 253 | 253 | logerror("error, unknown mcu command\n"); |
| r2375 | r2376 | |
| 338 | 338 | switch (mcu_command) |
| 339 | 339 | { |
| 340 | 340 | case 0x01: |
| 341 | return | |
| 341 | return | |
| 342 | 342 | |
| 343 | 343 | case 0x02: |
| 344 | return | |
| 344 | return | |
| 345 | 345 | |
| 346 | 346 | case 0x1a: |
| 347 | return ( | |
| 347 | return ( | |
| 348 | 348 | |
| 349 | 349 | case 0x21: |
| 350 | return | |
| 350 | return | |
| 351 | 351 | |
| 352 | 352 | case 0x41: |
| 353 | 353 | return mcu_credits; |
| r2375 | r2376 | |
| 375 | 375 | else return mcu_credits; |
| 376 | 376 | } |
| 377 | 377 | /* buttons */ |
| 378 | else return (( | |
| 378 | else return (( | |
| 379 | 379 | |
| 380 | 380 | default: |
| 381 | 381 | logerror("error, unknown mcu command\n"); |
| r2375 | r2376 | |
| 660 | 660 | case MCU_DRTOPPEL: |
| 661 | 661 | case MCU_PLUMPOP: |
| 662 | 662 | coin = 0; |
| 663 | coin |= ((readinputport(5) & 1) << 0); | |
| 664 | coin |= ((readinputport(6) & 1) << 1); | |
| 665 | coin |= ((readinputport(4) & 3) << 2); | |
| 663 | coin |= ((input_port_read_indexed(machine, 5) & 1) << 0); | |
| 664 | coin |= ((input_port_read_indexed(machine, 6) & 1) << 1); | |
| 665 | coin |= ((input_port_read_indexed(machine, 4) & 3) << 2); | |
| 666 | 666 | coin ^= 0x0c; |
| 667 | 667 | mcu_handle_coins(coin); |
| 668 | 668 | break; |
| r2375 | r2376 | |
|---|---|---|
| 80 | 80 | |
| 81 | 81 | static READ8_HANDLER(atari_pia_pa_r) |
| 82 | 82 | { |
| 83 | return atari_input_disabled() ? 0xFF : | |
| 83 | return atari_input_disabled() ? 0xFF : | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | static READ8_HANDLER(atari_pia_pb_r) |
| 87 | 87 | { |
| 88 | return atari_input_disabled() ? 0xFF : | |
| 88 | return atari_input_disabled() ? 0xFF : | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | static WRITE8_HANDLER(a600xl_pia_pb_w) { a600xl_mmu(data); } |
| r2375 | r2376 | |
| 521 | 521 | }; |
| 522 | 522 | |
| 523 | 523 | |
| 524 | void a800_handle_keyboard( | |
| 524 | void a800_handle_keyboard(running_machine *machine) | |
| 525 | 525 | { |
| 526 | 526 | static int atari_last = 0xff; |
| 527 | 527 | int i, modifiers, atari_code; |
| r2375 | r2376 | |
| 540 | 540 | for( i = 0; i < 64; i++ ) |
| 541 | 541 | { |
| 542 | 542 | sprintf(tag, "keyboard_%d", i / 16); |
| 543 | if( | |
| 543 | if( | |
| 544 | 544 | { |
| 545 | 545 | atari_code = keys[i][modifiers]; |
| 546 | 546 | if( atari_code != AKEY_NONE ) |
| r2375 | r2376 | |
| 566 | 566 | #define VKEY_BREAK 0x10 |
| 567 | 567 | |
| 568 | 568 | /* absolutely no clue what to do here :((( */ |
| 569 | void a5200_handle_keypads( | |
| 569 | void a5200_handle_keypads(running_machine *machine) | |
| 570 | 570 | { |
| 571 | 571 | int i, modifiers; |
| 572 | 572 | static int atari_last = 0xff; |
| r2375 | r2376 | |
| 584 | 584 | /* check keypad */ |
| 585 | 585 | for (i = 0; i < 16; i++) |
| 586 | 586 | { |
| 587 | if( | |
| 587 | if( | |
| 588 | 588 | { |
| 589 | 589 | if( i == atari_last ) |
| 590 | 590 | return; |
| r2375 | r2376 | |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | /* check top button */ |
| 603 | if (( | |
| 603 | if (( | |
| 604 | 604 | { |
| 605 | 605 | if (atari_last == 0xFE) |
| 606 | 606 | return; |
| r2375 | r2376 | |
| 714 | 714 | |
| 715 | 715 | static UINT8 console_read(void) |
| 716 | 716 | { |
| 717 | return | |
| 717 | return | |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | |
| r2375 | r2376 | |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | |
| 742 | static void atari_machine_start(int type, const pia6821_interface *pia_intf, int has_cart) | |
| 742 | static void atari_machine_start(running_machine *machine, int type, const pia6821_interface *pia_intf, int has_cart) | |
| 743 | 743 | { |
| 744 | 744 | gtia_interface gtia_intf; |
| 745 | 745 | |
| r2375 | r2376 | |
| 751 | 751 | gtia_intf.console_read = console_read; |
| 752 | 752 | if (sndti_exists(SOUND_DAC, 0)) |
| 753 | 753 | gtia_intf.console_write = console_write; |
| 754 | gtia_init(>ia_intf); | |
| 754 | gtia_init(machine, >ia_intf); | |
| 755 | 755 | |
| 756 | 756 | /* pokey */ |
| 757 | 757 | add_reset_callback(Machine, pokey_reset); |
| r2375 | r2376 | |
| 814 | 814 | |
| 815 | 815 | MACHINE_START( a400 ) |
| 816 | 816 | { |
| 817 | atari_machine_start(ATARI_400, &atari_pia_interface, TRUE); | |
| 817 | atari_machine_start(machine, ATARI_400, &atari_pia_interface, TRUE); | |
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | MACHINE_START( a600xl ) |
| 821 | 821 | { |
| 822 | atari_machine_start(ATARI_600XL, &a600xl_pia_interface, TRUE); | |
| 822 | atari_machine_start(machine, ATARI_600XL, &a600xl_pia_interface, TRUE); | |
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | |
| r2375 | r2376 | |
| 832 | 832 | |
| 833 | 833 | MACHINE_START( a800 ) |
| 834 | 834 | { |
| 835 | atari_machine_start(ATARI_800, &atari_pia_interface, TRUE); | |
| 835 | atari_machine_start(machine, ATARI_800, &atari_pia_interface, TRUE); | |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | |
| r2375 | r2376 | |
| 886 | 886 | |
| 887 | 887 | MACHINE_START( a800xl ) |
| 888 | 888 | { |
| 889 | atari_machine_start(ATARI_800XL, &a800xl_pia_interface, TRUE); | |
| 889 | atari_machine_start(machine, ATARI_800XL, &a800xl_pia_interface, TRUE); | |
| 890 | 890 | } |
| 891 | 891 | |
| 892 | 892 | |
| r2375 | r2376 | |
| 943 | 943 | |
| 944 | 944 | MACHINE_START( a5200 ) |
| 945 | 945 | { |
| 946 | atari_machine_start(ATARI_800XL, NULL, FALSE); | |
| 946 | atari_machine_start(machine, ATARI_800XL, NULL, FALSE); | |
| 947 | 947 | } |
| 948 | 948 | |
| 949 | 949 |
| r2375 | r2376 | |
|---|---|---|
| 142 | 142 | |
| 143 | 143 | READ16_HANDLER( midyunit_input_r ) |
| 144 | 144 | { |
| 145 | return | |
| 145 | return | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
| r2375 | r2376 | |
| 156 | 156 | static READ16_HANDLER( term2_input_r ) |
| 157 | 157 | { |
| 158 | 158 | if (offset != 2) |
| 159 | return | |
| 159 | return | |
| 160 | 160 | |
| 161 | 161 | switch (term2_analog_select) |
| 162 | 162 | { |
| 163 | 163 | default: |
| 164 | case 0: return readinputport(2); break; | |
| 165 | case 1: return readinputport(6); break; | |
| 166 | case 2: return readinputport(7); break; | |
| 167 | case 3: return readinputport(8); break; | |
| 164 | case 0: return input_port_read_indexed(machine, 2); break; | |
| 165 | case 1: return input_port_read_indexed(machine, 6); break; | |
| 166 | case 2: return input_port_read_indexed(machine, 7); break; | |
| 167 | case 3: return input_port_read_indexed(machine, 8); break; | |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 |
| r2375 | r2376 | |
|---|---|---|
| 17 | 17 | INTERRUPT_GEN( asteroid_interrupt ) |
| 18 | 18 | { |
| 19 | 19 | /* Turn off interrupts if self-test is enabled */ |
| 20 | if (!( | |
| 20 | if (!( | |
| 21 | 21 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | INTERRUPT_GEN( asterock_interrupt ) |
| 25 | 25 | { |
| 26 | 26 | /* Turn off interrupts if self-test is enabled */ |
| 27 | if (( | |
| 27 | if (( | |
| 28 | 28 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | INTERRUPT_GEN( llander_interrupt ) |
| 32 | 32 | { |
| 33 | 33 | /* Turn off interrupts if self-test is enabled */ |
| 34 | if ( | |
| 34 | if ( | |
| 35 | 35 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 36 | 36 | } |
| 37 | 37 | |
| r2375 | r2376 | |
| 42 | 42 | int res; |
| 43 | 43 | int bitmask; |
| 44 | 44 | |
| 45 | res= | |
| 45 | res= | |
| 46 | 46 | |
| 47 | 47 | bitmask = (1 << offset); |
| 48 | 48 | |
| r2375 | r2376 | |
| 64 | 64 | { |
| 65 | 65 | int res; |
| 66 | 66 | |
| 67 | res= | |
| 67 | res= | |
| 68 | 68 | |
| 69 | 69 | // if (activecpu_gettotalcycles() & 0x100) |
| 70 | 70 | // res |= 0x02; |
| r2375 | r2376 | |
| 79 | 79 | int res; |
| 80 | 80 | int bitmask; |
| 81 | 81 | |
| 82 | res= | |
| 82 | res= | |
| 83 | 83 | |
| 84 | 84 | bitmask = (1 << offset); |
| 85 | 85 | |
| r2375 | r2376 | |
| 106 | 106 | int res; |
| 107 | 107 | int bitmask; |
| 108 | 108 | |
| 109 | res= | |
| 109 | res= | |
| 110 | 110 | bitmask = (1 << (offset & 0x7)); |
| 111 | 111 | |
| 112 | 112 | if (res & bitmask) |
| r2375 | r2376 | |
| 122 | 122 | int res; |
| 123 | 123 | int res1; |
| 124 | 124 | |
| 125 | res1 = | |
| 125 | res1 = | |
| 126 | 126 | |
| 127 | 127 | res = 0xfc | ((res1 >> (2 * (3 - (offset & 0x3)))) & 0x3); |
| 128 | 128 | return res; |
| r2375 | r2376 | |
| 182 | 182 | { |
| 183 | 183 | int res; |
| 184 | 184 | |
| 185 | res = | |
| 185 | res = | |
| 186 | 186 | |
| 187 | 187 | if (avgdvg_done()) |
| 188 | 188 | res |= 0x01; |
| r2375 | r2376 | |
|---|---|---|
| 225 | 225 | /* Bits 7-6 = selected based on Player 1 */ |
| 226 | 226 | /* Bits 5-4 = common */ |
| 227 | 227 | if (player_1) |
| 228 | res = ( | |
| 228 | res = ( | |
| 229 | 229 | else |
| 230 | res = | |
| 230 | res = | |
| 231 | 231 | |
| 232 | 232 | /* Bit 3 = Gamma rcvd flag */ |
| 233 | 233 | if (gamma_rcvd) |
| r2375 | r2376 | |
| 252 | 252 | READ8_HANDLER( alphaone_port_0_r ) |
| 253 | 253 | { |
| 254 | 254 | /* Bits 7-2 = common */ |
| 255 | UINT8 res = | |
| 255 | UINT8 res = | |
| 256 | 256 | |
| 257 | 257 | /* Bit 1 = 2.4kHz (divide 2.5MHz by 1024) */ |
| 258 | 258 | if (!(activecpu_gettotalcycles() & 0x400)) |
| r2375 | r2376 | |
| 269 | 269 | READ8_HANDLER( mhavoc_port_1_r ) |
| 270 | 270 | { |
| 271 | 271 | /* Bits 7-2 = input switches */ |
| 272 | UINT8 res = | |
| 272 | UINT8 res = | |
| 273 | 273 | |
| 274 | 274 | /* Bit 1 = Alpha rcvd flag */ |
| 275 | 275 | if (has_gamma_cpu && alpha_rcvd) |
| r2375 | r2376 | |
| 285 | 285 | READ8_HANDLER( mhavoc_port_1_sp_r ) |
| 286 | 286 | { |
| 287 | 287 | /* Bits 7-3 = input switches */ |
| 288 | UINT8 res = | |
| 288 | UINT8 res = | |
| 289 | 289 | |
| 290 | 290 | /* Bit 2 = TMS5220 ready flag */ |
| 291 | 291 | if (!tms5220_ready_r()) |
| r2375 | r2376 | |
|---|---|---|
| 208 | 208 | switch (offset & 7) |
| 209 | 209 | { |
| 210 | 210 | case 0: case 1: case 2: |
| 211 | data = | |
| 211 | data = | |
| 212 | 212 | break; |
| 213 | 213 | case 3: case 4: case 5: case 6: |
| 214 | 214 | data = decocass_quadrature_decoder[(offset & 7) - 3]; |
| r2375 | r2376 | |
| 1589 | 1589 | * state save setup |
| 1590 | 1590 | * |
| 1591 | 1591 | ***************************************************************************/ |
| 1592 | static | |
| 1592 | static STATE_POSTLOAD( decocass_state_save_postload | |
| 1593 | 1593 | { |
| 1594 | 1594 | #if 0 |
| 1595 | 1595 | /* fix me - this won't work anymore */ |
| r2375 | r2376 | |
| 1608 | 1608 | } |
| 1609 | 1609 | |
| 1610 | 1610 | /* To be called once from driver_init, i.e. decocass_init */ |
| 1611 | void decocass_machine_state_save_init( | |
| 1611 | void decocass_machine_state_save_init(running_machine *machine) | |
| 1612 | 1612 | { |
| 1613 | state_save_register_ | |
| 1613 | state_save_register_ | |
| 1614 | 1614 | state_save_register_global(tape_dir); |
| 1615 | 1615 | state_save_register_global(tape_speed); |
| 1616 | 1616 | state_save_register_global(tape_time0.seconds); |
| r2375 | r2376 | |
|---|---|---|
| 25 | 25 | default: |
| 26 | 26 | case 0x00: |
| 27 | 27 | current_car_image = copsnrob_carimage[0]; |
| 28 | keys = input_port_ | |
| 28 | keys = input_port_ | |
| 29 | 29 | break; |
| 30 | 30 | case 0x04: |
| 31 | 31 | current_car_image = copsnrob_carimage[1]; |
| 32 | keys = input_port_ | |
| 32 | keys = input_port_ | |
| 33 | 33 | break; |
| 34 | 34 | case 0x08: |
| 35 | 35 | current_car_image = copsnrob_carimage[2]; |
| 36 | keys = input_port_ | |
| 36 | keys = input_port_ | |
| 37 | 37 | break; |
| 38 | 38 | case 0x0c: |
| 39 | 39 | current_car_image = copsnrob_carimage[3]; |
| 40 | keys = input_port_ | |
| 40 | keys = input_port_ | |
| 41 | 41 | break; |
| 42 | 42 | } |
| 43 | 43 |
| r2375 | r2376 | |
|---|---|---|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | static | |
| 210 | static STATE_POSTLOAD( twincobr_restore_dsp | |
| 211 | 211 | { |
| 212 | 212 | twincobr_dsp(twincobr_dsp_on); |
| 213 | 213 | } |
| r2375 | r2376 | |
| 325 | 325 | fsharkbt_8741 = -1; /* Reset the Flying Shark Bootleg MCU */ |
| 326 | 326 | twincobr_dsp_BIO = CLEAR_LINE; |
| 327 | 327 | } |
| 328 | void twincobr_driver_savestate( | |
| 328 | void twincobr_driver_savestate(running_machine *machine) | |
| 329 | 329 | { |
| 330 | 330 | state_save_register_global(toaplan_main_cpu); |
| 331 | 331 | state_save_register_global(twincobr_intenable); |
| r2375 | r2376 | |
| 335 | 335 | state_save_register_global(twincobr_dsp_BIO); |
| 336 | 336 | state_save_register_global(dsp_execute); |
| 337 | 337 | state_save_register_global(fsharkbt_8741); |
| 338 | state_save_register_ | |
| 338 | state_save_register_ | |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | MACHINE_RESET( wardner ) |
| r2375 | r2376 | |
| 349 | 349 | twincobr_dsp_BIO = CLEAR_LINE; |
| 350 | 350 | wardner_membank = 0; |
| 351 | 351 | } |
| 352 | void wardner_driver_savestate( | |
| 352 | void wardner_driver_savestate(running_machine *machine) | |
| 353 | 353 | { |
| 354 | 354 | state_save_register_global(toaplan_main_cpu); |
| 355 | 355 | state_save_register_global(twincobr_intenable); |
| r2375 | r2376 | |
| 359 | 359 | state_save_register_global(twincobr_dsp_BIO); |
| 360 | 360 | state_save_register_global(dsp_execute); |
| 361 | 361 | state_save_register_global(wardner_membank); |
| 362 | state_save_register_func_postload(wardner_restore_bank); /* Restore the Main CPU bank */ | |
| 363 | state_save_register_func_postload(twincobr_restore_dsp); | |
| 362 | state_save_register_postload(machine, wardner_restore_bank, NULL); /* Restore the Main CPU bank */ | |
| 363 | state_save_register_postload(machine, twincobr_restore_dsp, NULL); | |
| 364 | 364 | } |
| r2375 | r2376 | |
|---|---|---|
| 71 | 71 | extern WRITE8_HANDLER( i8041_p2_w ); |
| 72 | 72 | extern READ8_HANDLER( i8041_p2_r ); |
| 73 | 73 | |
| 74 | void decocass_machine_state_save_init( | |
| 74 | void decocass_machine_state_save_init(running_machine *machine); | |
| 75 | 75 | |
| 76 | 76 | /*----------- defined in video/decocass.c -----------*/ |
| 77 | 77 | extern WRITE8_HANDLER( decocass_paletteram_w ); |
| r2375 | r2376 | |
|---|---|---|
| 226 | 226 | { |
| 227 | 227 | |
| 228 | 228 | if (irobot_control_num == 0) |
| 229 | return | |
| 229 | return | |
| 230 | 230 | else if (irobot_control_num == 1) |
| 231 | return | |
| 231 | return | |
| 232 | 232 | return 0; |
| 233 | 233 | |
| 234 | 234 | } |
| r2375 | r2376 | |
|---|---|---|
| 129 | 129 | |
| 130 | 130 | READ8_HANDLER( cerberus_dial_1_r ) |
| 131 | 131 | { |
| 132 | int original = readinputport(0); | |
| 133 | int modified = dial_compute_value(readinputport(4), 0); | |
| 132 | int original = input_port_read_indexed(machine, 0); | |
| 133 | int modified = dial_compute_value(input_port_read_indexed(machine, 4), 0); | |
| 134 | 134 | return (original & 0xc0) | ((modified & 0x80) >> 2) | (modified & 0x1f); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
| 138 | 138 | READ8_HANDLER( cerberus_dial_2_r ) |
| 139 | 139 | { |
| 140 | int original = readinputport(2); | |
| 141 | int modified = dial_compute_value(readinputport(5), 1); | |
| 140 | int original = input_port_read_indexed(machine, 2); | |
| 141 | int modified = dial_compute_value(input_port_read_indexed(machine, 5), 1); | |
| 142 | 142 | return (original & 0xc0) | ((modified & 0x80) >> 2) | (modified & 0x1f); |
| 143 | 143 | } |
| 144 | 144 | |
| r2375 | r2376 | |
| 180 | 180 | * |
| 181 | 181 | *************************************/ |
| 182 | 182 | |
| 183 | static void update_dangerz_xy( | |
| 183 | static void update_dangerz_xy(running_machine *machine) | |
| 184 | 184 | { |
| 185 | UINT8 newy = readinputport(4); | |
| 186 | UINT8 newx = readinputport(5); | |
| 185 | UINT8 newy = input_port_read_indexed(machine, 4); | |
| 186 | UINT8 newx = input_port_read_indexed(machine, 5); | |
| 187 | 187 | int deltay = newy - dial_last_input[0]; |
| 188 | 188 | int deltax = newx - dial_last_input[1]; |
| 189 | 189 | |
| r2375 | r2376 | |
| 206 | 206 | |
| 207 | 207 | READ8_HANDLER( dangerz_input_y_r ) |
| 208 | 208 | { |
| 209 | update_dangerz_xy(); | |
| 209 | update_dangerz_xy(machine); | |
| 210 | 210 | return dangerz_y & 0xff; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | READ8_HANDLER( dangerz_input_x_r ) |
| 215 | 215 | { |
| 216 | update_dangerz_xy(); | |
| 216 | update_dangerz_xy(machine); | |
| 217 | 217 | return dangerz_x & 0xff; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | |
| 221 | 221 | READ8_HANDLER( dangerz_input_upper_r ) |
| 222 | 222 | { |
| 223 | update_dangerz_xy(); | |
| 223 | update_dangerz_xy(machine); | |
| 224 | 224 | return ((dangerz_y >> 2) & 0xc0) | ((dangerz_x >> 8) & 0x03); |
| 225 | 225 | } |
| 226 | 226 | |
| r2375 | r2376 | |
| 236 | 236 | |
| 237 | 237 | READ8_HANDLER( redline_pedal_1_r ) |
| 238 | 238 | { |
| 239 | int pedal = | |
| 239 | int pedal = | |
| 240 | 240 | return redline_pedal_value[pedal >> 5] | 0x0f; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | |
| 244 | 244 | READ8_HANDLER( redline_pedal_2_r ) |
| 245 | 245 | { |
| 246 | int pedal = | |
| 246 | int pedal = | |
| 247 | 247 | return redline_pedal_value[pedal >> 5] | 0x0f; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
| 251 | 251 | READ8_HANDLER( redline_wheel_1_r ) |
| 252 | 252 | { |
| 253 | return dial_compute_value( | |
| 253 | return dial_compute_value( | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | |
| 257 | 257 | READ8_HANDLER( redline_wheel_2_r ) |
| 258 | 258 | { |
| 259 | return dial_compute_value( | |
| 259 | return dial_compute_value( | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | |
| r2375 | r2376 | |
| 269 | 269 | |
| 270 | 270 | READ8_HANDLER( offroad_wheel_1_r ) |
| 271 | 271 | { |
| 272 | return dial_compute_value( | |
| 272 | return dial_compute_value( | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | |
| 276 | 276 | READ8_HANDLER( offroad_wheel_2_r ) |
| 277 | 277 | { |
| 278 | return dial_compute_value( | |
| 278 | return dial_compute_value( | |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | |
| 282 | 282 | READ8_HANDLER( offroad_wheel_3_r ) |
| 283 | 283 | { |
| 284 | return dial_compute_value( | |
| 284 | return dial_compute_value( | |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | |
| r2375 | r2376 | |
| 294 | 294 | |
| 295 | 295 | READ8_HANDLER( ataxx_trackball_r ) |
| 296 | 296 | { |
| 297 | return dial_compute_value( | |
| 297 | return dial_compute_value( | |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | |
| r2375 | r2376 | |
| 307 | 307 | |
| 308 | 308 | READ8_HANDLER( indyheat_wheel_r ) |
| 309 | 309 | { |
| 310 | return dial_compute_value( | |
| 310 | return dial_compute_value( | |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | |
| r2375 | r2376 | |
| 337 | 337 | switch (offset) |
| 338 | 338 | { |
| 339 | 339 | case 3: |
| 340 | analog_result = | |
| 340 | analog_result = | |
| 341 | 341 | break; |
| 342 | 342 | |
| 343 | 343 | case 0: |
| r2375 | r2376 | |
| 493 | 493 | INTERRUPT_GEN( leland_master_interrupt ) |
| 494 | 494 | { |
| 495 | 495 | /* check for coins here */ |
| 496 | if (( | |
| 496 | if (( | |
| 497 | 497 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE); |
| 498 | 498 | } |
| 499 | 499 | |
| r2375 | r2376 | |
| 844 | 844 | |
| 845 | 845 | READ8_HANDLER( ataxx_eeprom_r ) |
| 846 | 846 | { |
| 847 | int port = | |
| 847 | int port = | |
| 848 | 848 | if (LOG_EEPROM) logerror("%04X:EE read\n", safe_activecpu_get_pc()); |
| 849 | 849 | return (port & ~0x01) | EEPROM_read_bit(); |
| 850 | 850 | } |
| r2375 | r2376 | |
| 1114 | 1114 | break; |
| 1115 | 1115 | |
| 1116 | 1116 | case 0x01: /* FE = analog port select/bankswitch */ |
| 1117 | analog_result = | |
| 1117 | analog_result = | |
| 1118 | 1118 | |
| 1119 | 1119 | /* update top board banking for some games */ |
| 1120 | 1120 | if (LOG_BANKSWITCHING_M) |
| r2375 | r2376 | |
| 1145 | 1145 | switch (offset) |
| 1146 | 1146 | { |
| 1147 | 1147 | case 0x00: /* /GIN0 */ |
| 1148 | result = | |
| 1148 | result = | |
| 1149 | 1149 | break; |
| 1150 | 1150 | |
| 1151 | 1151 | case 0x01: /* /GIN1 */ |
| 1152 | result = | |
| 1152 | result = | |
| 1153 | 1153 | if (cpunum_get_reg(1, Z80_HALT)) |
| 1154 | 1154 | result ^= 0x01; |
| 1155 | 1155 | break; |
| r2375 | r2376 | |
| 1165 | 1165 | break; |
| 1166 | 1166 | |
| 1167 | 1167 | case 0x10: /* /GIN0 */ |
| 1168 | result = | |
| 1168 | result = | |
| 1169 | 1169 | break; |
| 1170 | 1170 | |
| 1171 | 1171 | case 0x11: /* /GIN1 */ |
| 1172 | result = | |
| 1172 | result = | |
| 1173 | 1173 | if (LOG_EEPROM) logerror("%04X:EE read\n", safe_activecpu_get_pc()); |
| 1174 | 1174 | result = (result & ~0x01) | EEPROM_read_bit(); |
| 1175 | 1175 | break; |
| r2375 | r2376 | |
| 1228 | 1228 | switch (offset) |
| 1229 | 1229 | { |
| 1230 | 1230 | case 0x06: /* /GIN0 */ |
| 1231 | result = | |
| 1231 | result = | |
| 1232 | 1232 | break; |
| 1233 | 1233 | |
| 1234 | 1234 | case 0x07: /* /SLVBLK */ |
| 1235 | result = | |
| 1235 | result = | |
| 1236 | 1236 | if (cpunum_get_reg(1, Z80_HALT)) |
| 1237 | 1237 | result ^= 0x01; |
| 1238 | 1238 | break; |
| r2375 | r2376 | |
|---|---|---|
| 870 | 870 | switch (offset) |
| 871 | 871 | { |
| 872 | 872 | case IOASIC_PORT0: |
| 873 | result = | |
| 873 | result = | |
| 874 | 874 | /* bit 0 seems to be a ready flag before shuffling happens */ |
| 875 | 875 | if (!ioasic.shuffle_active) |
| 876 | 876 | { |
| r2375 | r2376 | |
| 882 | 882 | break; |
| 883 | 883 | |
| 884 | 884 | case IOASIC_PORT1: |
| 885 | result = | |
| 885 | result = | |
| 886 | 886 | break; |
| 887 | 887 | |
| 888 | 888 | case IOASIC_PORT2: |
| 889 | result = | |
| 889 | result = | |
| 890 | 890 | break; |
| 891 | 891 | |
| 892 | 892 | case IOASIC_PORT3: |
| 893 | result = | |
| 893 | result = | |
| 894 | 894 | break; |
| 895 | 895 | |
| 896 | 896 | case IOASIC_UARTIN: |
| r2375 | r2376 | |
|---|---|---|
| 445 | 445 | { |
| 446 | 446 | switch (offset) |
| 447 | 447 | { |
| 448 | case 0x03: return readinputportbytag("800007"); /* STARTn + SERVICE1 */ | |
| 449 | case 0x04: return readinputportbytag("800009"); /* COINn */ | |
| 450 | case 0x05: return readinputportbytag("80000B"); /* Player controls + TILT */ | |
| 451 | case 0x06: return readinputportbytag("80000D"); /* Player controls (cocktail) */ | |
| 448 | case 0x03: return input_port_read(machine, "800007"); /* STARTn + SERVICE1 */ | |
| 449 | case 0x04: return input_port_read(machine, "800009"); /* COINn */ | |
| 450 | case 0x05: return input_port_read(machine, "80000B"); /* Player controls + TILT */ | |
| 451 | case 0x06: return input_port_read(machine, "80000D"); /* Player controls (cocktail) */ | |
| 452 | 452 | case 0x08: return cc_port; |
| 453 | 453 | } |
| 454 | 454 |
| r2375 | r2376 | |
|---|---|---|
| 129 | 129 | cpunum_set_input_line(Machine, 2, INPUT_LINE_HALT, ASSERT_LINE); |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | static | |
| 132 | static STATE_POSTLOAD( demonwld_restore_dsp | |
| 133 | 133 | { |
| 134 | 134 | demonwld_dsp(demonwld_dsp_on); |
| 135 | 135 | } |
| r2375 | r2376 | |
| 299 | 299 | toaplan1_unk_reset_port = 0; |
| 300 | 300 | coin_lockout_global_w(0); |
| 301 | 301 | } |
| 302 | void toaplan1_driver_savestate( | |
| 302 | void toaplan1_driver_savestate(running_machine *machine) | |
| 303 | 303 | { |
| 304 | 304 | state_save_register_global(toaplan1_intenable); |
| 305 | 305 | state_save_register_global(toaplan1_coin_count); |
| r2375 | r2376 | |
| 319 | 319 | main_ram_seg = 0; |
| 320 | 320 | dsp_execute = 0; |
| 321 | 321 | } |
| 322 | void demonwld_driver_savestate( | |
| 322 | void demonwld_driver_savestate(running_machine *machine) | |
| 323 | 323 | { |
| 324 | 324 | state_save_register_global(demonwld_dsp_on); |
| 325 | 325 | state_save_register_global(dsp_addr_w); |
| 326 | 326 | state_save_register_global(main_ram_seg); |
| 327 | 327 | state_save_register_global(demonwld_dsp_BIO); |
| 328 | 328 | state_save_register_global(dsp_execute); |
| 329 | state_save_register_ | |
| 329 | state_save_register_ | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | MACHINE_RESET( vimana ) |
| r2375 | r2376 | |
| 335 | 335 | vimana_credits = 0; |
| 336 | 336 | vimana_latch = 0; |
| 337 | 337 | } |
| 338 | void vimana_driver_savestate( | |
| 338 | void vimana_driver_savestate(running_machine *machine) | |
| 339 | 339 | { |
| 340 | 340 | state_save_register_global(vimana_credits); |
| 341 | 341 | state_save_register_global(vimana_latch); |
| r2375 | r2376 | |
|---|---|---|
| 339 | 339 | |
| 340 | 340 | READ8_HANDLER( daikaiju_mcu_status_r ) |
| 341 | 341 | { |
| 342 | int res = input_port_ | |
| 342 | int res = input_port_ | |
| 343 | 343 | |
| 344 | 344 | res^=mame_rand(Machine)&3; |
| 345 | 345 | res |=((lsasquad_sound_pending & 0x02)^2)<<3; //inverted flag |
| r2375 | r2376 | |
|---|---|---|
| 382 | 382 | } |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | if (~ | |
| 385 | if (~ | |
| 386 | 386 | return 0xbb; |
| 387 | 387 | |
| 388 | 388 | return (io[chip].credits / 10) * 16 + io[chip].credits % 10; |
| r2375 | r2376 | |
|---|---|---|
| 446 | 446 | maple0x86data2[3] = maple0x86data2[3] | 0x0c; |
| 447 | 447 | maple0x86data2[6] = maple0x86data2[6] & 0xcf; |
| 448 | 448 | |
| 449 | a = | |
| 449 | a = | |
| 450 | 450 | maple0x86data2[6] = maple0x86data2[6] | (a << 4); |
| 451 | 451 | pos = 0x11; |
| 452 | 452 | tocopy = 17; |
| r2375 | r2376 | |
| 524 | 524 | // first function |
| 525 | 525 | maple0x86data2[pos+ 9]=1; // report |
| 526 | 526 | maple0x86data2[pos+10]=0; // bits TEST TILT1 TILT2 TILT3 ? ? ? ? |
| 527 | maple0x86data2[pos+11]=readinputportbytag("IN1"); // bits 1Pstart 1Pservice 1Pup 1Pdown 1Pleft 1Pright 1Ppush1 1Ppush2 | |
| 528 | maple0x86data2[pos+12]=readinputportbytag("IN2"); // bits 1Ppush3 1Ppush4 1Ppush5 1Ppush6 1Ppush7 1Ppush8 ... | |
| 529 | maple0x86data2[pos+13]=readinputportbytag("IN3"); // bits 2Pstart 2Pservice 2Pup 2Pdown 2Pleft 2Pright 2Ppush1 2Ppush2 | |
| 530 | maple0x86data2[pos+14]=readinputportbytag("IN4"); // bits 2Ppush3 2Ppush4 2Ppush5 2Ppush6 2Ppush7 2Ppush8 ... | |
| 527 | maple0x86data2[pos+11]=input_port_read(machine, "IN1"); // bits 1Pstart 1Pservice 1Pup 1Pdown 1Pleft 1Pright 1Ppush1 1Ppush2 | |
| 528 | maple0x86data2[pos+12]=input_port_read(machine, "IN2"); // bits 1Ppush3 1Ppush4 1Ppush5 1Ppush6 1Ppush7 1Ppush8 ... | |
| 529 | maple0x86data2[pos+13]=input_port_read(machine, "IN3"); // bits 2Pstart 2Pservice 2Pup 2Pdown 2Pleft 2Pright 2Ppush1 2Ppush2 | |
| 530 | maple0x86data2[pos+14]=input_port_read(machine, "IN4"); // bits 2Ppush3 2Ppush4 2Ppush5 2Ppush6 2Ppush7 2Ppush8 ... | |
| 531 | 531 | // second function |
| 532 | 532 | maple0x86data2[pos+15]=1; // report |
| 533 | 533 | maple0x86data2[pos+16]=(dc_coin_counts[0] >> 8) & 0xff; // 1CONDITION, 1SLOT COIN(bit13-8) |
| r2375 | r2376 | |
|---|---|---|
| 70 | 70 | |
| 71 | 71 | UINT8 res; |
| 72 | 72 | |
| 73 | res = | |
| 73 | res = | |
| 74 | 74 | |
| 75 | 75 | /*logerror("%04x: read IN2\n",activecpu_get_pc());*/ |
| 76 | 76 | |
| r2375 | r2376 | |
| 99 | 99 | |
| 100 | 100 | static READ8_HANDLER( ckongs_input_port_1_r ) |
| 101 | 101 | { |
| 102 | return ( | |
| 102 | return ( | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | static READ8_HANDLER( ckongs_input_port_2_r ) |
| 106 | 106 | { |
| 107 | return ( | |
| 107 | return ( | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| r2375 | r2376 | |
| 118 | 118 | UINT8 sign; |
| 119 | 119 | UINT8 delta; |
| 120 | 120 | |
| 121 | delta = (moonwar_port_select ? | |
| 121 | delta = (moonwar_port_select ? | |
| 122 | 122 | |
| 123 | 123 | sign = (delta & 0x80) >> 3; |
| 124 | 124 | delta &= 0x0f; |
| 125 | 125 | |
| 126 | return (( | |
| 126 | return (( | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
| 130 | 130 | /* the coinage DIPs are spread accross two input ports */ |
| 131 | 131 | static READ8_HANDLER( stratgyx_input_port_2_r ) |
| 132 | 132 | { |
| 133 | return ( | |
| 133 | return ( | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | static READ8_HANDLER( stratgyx_input_port_3_r ) |
| 137 | 137 | { |
| 138 | return ( | |
| 138 | return ( | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | |
| r2375 | r2376 | |
| 151 | 151 | 0x27, 0x26, 0x24, 0x25, 0x05, 0x04, 0x06, 0x07 }; |
| 152 | 152 | UINT8 val; |
| 153 | 153 | |
| 154 | val = | |
| 154 | val = | |
| 155 | 155 | |
| 156 | 156 | return ((val & 0x03) | (remap[val >> 2] << 2)); |
| 157 | 157 | } |
| r2375 | r2376 | |
|---|---|---|
| 37 | 37 | switch (offset) |
| 38 | 38 | { |
| 39 | 39 | case 0: |
| 40 | return | |
| 40 | return | |
| 41 | 41 | break; |
| 42 | 42 | case 2: |
| 43 | 43 | return 0x0f; |
| r2375 | r2376 | |
| 51 | 51 | switch (offset) |
| 52 | 52 | { |
| 53 | 53 | case 0: |
| 54 | return | |
| 54 | return | |
| 55 | 55 | break; |
| 56 | 56 | case 1: |
| 57 | 57 | return 0x0f; |
| r2375 | r2376 | |
|---|---|---|
| 105 | 105 | |
| 106 | 106 | READ16_HANDLER( midtunit_input_r ) |
| 107 | 107 | { |
| 108 | return | |
| 108 | return | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 |
| r2375 | r2376 | |
|---|---|---|
| 241 | 241 | |
| 242 | 242 | |
| 243 | 243 | /* check the coins here as well - they drive the clock of the flip-flops */ |
| 244 | port_value = | |
| 244 | port_value = | |
| 245 | 245 | |
| 246 | 246 | TTL7474_clock_w(TTL7474_2S_1, port_value & 0x01); |
| 247 | 247 | TTL7474_clock_w(TTL7474_2S_2, port_value & 0x02); |
| r2375 | r2376 | |
| 261 | 261 | int dir_flip_flop = movement_flip_flop + 1; |
| 262 | 262 | |
| 263 | 263 | |
| 264 | port_value = | |
| 264 | port_value = | |
| 265 | 265 | |
| 266 | 266 | if (port_value != last_wheel_value[player]) |
| 267 | 267 | { |
| r2375 | r2376 | |
| 282 | 282 | |
| 283 | 283 | |
| 284 | 284 | /* finally read the accelerator pedals */ |
| 285 | port_value = | |
| 285 | port_value = | |
| 286 | 286 | |
| 287 | 287 | for (player = 0; player < 4; player++) |
| 288 | 288 | { |
| r2375 | r2376 | |
| 446 | 446 | (TTL7474_output_r(TTL7474_1C_2) ? 0x02 : 0x00) | |
| 447 | 447 | (TTL7474_output_r(TTL7474_1D_2) ? 0x04 : 0x00) | |
| 448 | 448 | (TTL7474_output_r(TTL7474_1F_2) ? 0x08 : 0x00) | |
| 449 | ( | |
| 449 | ( | |
| 450 | 450 | |
| 451 | 451 | return ret; |
| 452 | 452 | } |
| r2375 | r2376 | |
|---|---|---|
| 1257 | 1257 | int ret; |
| 1258 | 1258 | |
| 1259 | 1259 | if (!qnum) |
| 1260 | ret = ( | |
| 1260 | ret = ( | |
| 1261 | 1261 | else |
| 1262 | ret = ( | |
| 1262 | ret = ( | |
| 1263 | 1263 | |
| 1264 | 1264 | qstrobe ^= 0x40; |
| 1265 | 1265 | |
| r2375 | r2376 | |
| 1270 | 1270 | int ret; |
| 1271 | 1271 | |
| 1272 | 1272 | if (!qnum) |
| 1273 | ret = ( | |
| 1273 | ret = ( | |
| 1274 | 1274 | else |
| 1275 | ret = ( | |
| 1275 | ret = ( | |
| 1276 | 1276 | |
| 1277 | 1277 | if (!qstrobe) qnum ^= 0x20; |
| 1278 | 1278 | |
| r2375 | r2376 | |
| 1302 | 1302 | { |
| 1303 | 1303 | int inp = input_count; |
| 1304 | 1304 | |
| 1305 | if (inp == 4) res = | |
| 1305 | if (inp == 4) res = | |
| 1306 | 1306 | else |
| 1307 | 1307 | { |
| 1308 | 1308 | char portname[4]; |
| r2375 | r2376 | |
| 1311 | 1311 | static int counter[4]; |
| 1312 | 1312 | |
| 1313 | 1313 | sprintf(portname,"IN%d",inp); /* IN0-IN3 */ |
| 1314 | res = | |
| 1314 | res = | |
| 1315 | 1315 | if (res & 0x80) |
| 1316 | 1316 | { |
| 1317 | 1317 | if (counter[inp] >= 0) |
| r2375 | r2376 | |
| 1335 | 1335 | counter[inp] = -1; |
| 1336 | 1336 | #else |
| 1337 | 1337 | sprintf(portname,"IN%d",inp); /* IN0-IN3 */ |
| 1338 | res = | |
| 1338 | res = | |
| 1339 | 1339 | if (res & 1) res = 0x7f; /* weak */ |
| 1340 | 1340 | else if (res & 2) res = 0x48; /* medium */ |
| 1341 | 1341 | else if (res & 4) res = 0x40; /* strong */ |
| r2375 | r2376 | |
| 1346 | 1346 | } |
| 1347 | 1347 | else |
| 1348 | 1348 | { |
| 1349 | res = | |
| 1349 | res = | |
| 1350 | 1350 | |
| 1351 | 1351 | /* the strobe cannot happen too often, otherwise the MCU will waste too |
| 1352 | 1352 | much time reading the inputs and won't have enough cycles to play two |
| r2375 | r2376 | |
| 1388 | 1388 | |
| 1389 | 1389 | if (offset == 0) |
| 1390 | 1390 | { |
| 1391 | res = ( | |
| 1391 | res = ( | |
| 1392 | 1392 | |
| 1393 | 1393 | return res; |
| 1394 | 1394 | } |
| 1395 | 1395 | else |
| 1396 | 1396 | { |
| 1397 | res = | |
| 1397 | res = | |
| 1398 | 1398 | |
| 1399 | 1399 | /* the strobe cannot happen too often, otherwise the MCU will waste too |
| 1400 | 1400 | much time reading the inputs and won't have enough cycles to play two |
| r2375 | r2376 | |
| 1409 | 1409 | switch (input_count) |
| 1410 | 1410 | { |
| 1411 | 1411 | case 0: |
| 1412 | stored_input[0] = readinputportbytag("IN0") & 0x1f; | |
| 1413 | stored_input[1] = (readinputportbytag("IN3") & 0x07) << 3; | |
| 1412 | stored_input[0] = input_port_read(machine, "IN0") & 0x1f; | |
| 1413 | stored_input[1] = (input_port_read(machine, "IN3") & 0x07) << 3; | |
| 1414 | 1414 | |
| 1415 | 1415 | case 3: |
| 1416 | stored_input[0] = | |
| 1416 | stored_input[0] = | |
| 1417 | 1417 | |
| 1418 | 1418 | case 4: |
| 1419 | stored_input[0] = readinputportbytag("IN1") & 0x1f; | |
| 1420 | stored_input[1] = readinputportbytag("IN3") & 0x18; | |
| 1419 | stored_input[0] = input_port_read(machine, "IN1") & 0x1f; | |
| 1420 | stored_input[1] = input_port_read(machine, "IN3") & 0x18; | |
| 1421 | 1421 | } |
| 1422 | 1422 | |
| 1423 | 1423 | input_count = (input_count + 1) & 7; |
| r2375 | r2376 | |
|---|---|---|
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | #include "driver.h" |
| 20 | #include "deprecat.h" | |
| 20 | 21 | #include "machine/pckeybrd.h" |
| 21 | 22 | |
| 22 | 23 | #ifdef MESS |
| r2375 | r2376 | |
| 508 | 509 | { |
| 509 | 510 | UINT32 result = 0; |
| 510 | 511 | if (keyboard.ports[port] >= 0) |
| 511 | result = | |
| 512 | result = | |
| 512 | 513 | return result; |
| 513 | 514 | } |
| 514 | 515 |
| r2375 | r2376 | |
|---|---|---|
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | ||
| 212 | ||
| 213 | ||
| 214 | 211 | static void sp_set_status(UINT32 status) |
| 215 | 212 | { |
| 216 | 213 | if (status & 0x1) |
| r2375 | r2376 | |
| 566 | 563 | |
| 567 | 564 | |
| 568 | 565 | // Video Interface |
| 569 | ||
| 566 | ||
| 570 | 567 | UINT32 n64_vi_origin; |
| 571 | 568 | UINT32 n64_vi_control; |
| 572 | 569 | static UINT32 n64_vi_burst, n64_vi_vsync, n64_vi_hsync, n64_vi_leap, n64_vi_hstart, n64_vi_vstart; |
| r2375 | r2376 | |
| 703 | 700 | |
| 704 | 701 | /* |
| 705 | 702 | Uncomment this for convenient homebrew debugging |
| 703 | */ | |
| 706 | 704 | case 0x44/4: // TEMP DEBUG |
| 707 | 705 | printf( "E Ping: %08x\n", data ); |
| 708 | 706 | break; |
| 709 | */ | |
| 710 | 707 | |
| 711 | 708 | default: |
| 712 | 709 | logerror("vi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, activecpu_get_pc()); |
| r2375 | r2376 | |
| 725 | 722 | |
| 726 | 723 | static emu_timer *audio_timer; |
| 727 | 724 | |
| 728 | #define SOUNDBUFFER_LENGTH 0x20000 | |
| 729 | #define AUDIO_DMA_DEPTH 2 | |
| 725 | #define AUDIO_DMA_DEPTH 2 | |
| 730 | 726 | |
| 727 | static void start_audio_dma(void); | |
| 728 | ||
| 731 | 729 | typedef struct |
| 732 | 730 | { |
| 733 | UINT32 address; | |
| 734 | UINT32 length; | |
| 731 | UINT32 address; | |
| 732 | UINT32 length; | |
| 735 | 733 | } AUDIO_DMA; |
| 736 | 734 | |
| 737 | 735 | static AUDIO_DMA audio_fifo[AUDIO_DMA_DEPTH]; |
| r2375 | r2376 | |
| 741 | 739 | |
| 742 | 740 | static void audio_fifo_push(UINT32 address, UINT32 length) |
| 743 | 741 | { |
| 744 | AUDIO_DMA *current; | |
| 745 | attotime period; | |
| 742 | AUDIO_DMA *current; | |
| 746 | 743 | |
| 747 | if (audio_fifo_num == AUDIO_DMA_DEPTH) | |
| 748 | { | |
| 749 | mame_printf_debug("audio_fifo_push: tried to push to full DMA FIFO!!!\n"); | |
| 750 | } | |
| 744 | if (audio_fifo_num == AUDIO_DMA_DEPTH) | |
| 745 | { | |
| 746 | mame_printf_debug("audio_fifo_push: tried to push to full DMA FIFO!!!\n"); | |
| 747 | } | |
| 751 | 748 | |
| 752 | 749 | // mame_printf_debug("fifo_push: adr %08x len %08x\n", address, length); |
| 753 | 750 | |
| 754 | audio_fifo[audio_fifo_wpos].address = address; | |
| 755 | audio_fifo[audio_fifo_wpos].length = length; | |
| 756 | current = &audio_fifo[audio_fifo_wpos]; | |
| 751 | audio_fifo[audio_fifo_wpos].address = address; | |
| 752 | audio_fifo[audio_fifo_wpos].length = length; | |
| 753 | current = &audio_fifo[audio_fifo_wpos]; | |
| 757 | 754 | |
| 758 | audio_fifo_wpos++; | |
| 759 | audio_fifo_num++; | |
| 755 | audio_fifo_wpos++; | |
| 756 | audio_fifo_num++; | |
| 760 | 757 | |
| 761 | if (audio_fifo_wpos >= AUDIO_DMA_DEPTH) | |
| 762 | { | |
| 763 | audio_fifo_wpos = 0; | |
| 764 | } | |
| 758 | if (audio_fifo_wpos >= AUDIO_DMA_DEPTH) | |
| 759 | { | |
| 760 | audio_fifo_wpos = 0; | |
| 761 | } | |
| 765 | 762 | |
| 766 | if (audio_fifo_num >= AUDIO_DMA_DEPTH) | |
| 767 | { | |
| 768 | ai_status |= 0x80000001; // FIFO full | |
| 769 | } | |
| 763 | if (audio_fifo_num >= AUDIO_DMA_DEPTH) | |
| 764 | { | |
| 765 | ai_status |= 0x80000001; // FIFO full | |
| 766 | } | |
| 770 | 767 | |
| 771 | // adjust the timer | |
| 772 | period = attotime_mul(ATTOTIME_IN_HZ(DACRATE_NTSC), (ai_dacrate + 1) * (current->length / 4)); | |
| 773 | timer_adjust_oneshot(audio_timer, period, 0); | |
| 768 | if (! (ai_status & 0x40000000)) | |
| 769 | { | |
| 770 | signal_rcp_interrupt(AI_INTERRUPT); | |
| 771 | start_audio_dma(); | |
| 772 | } | |
| 774 | 773 | } |
| 775 | 774 | |
| 776 | 775 | static void audio_fifo_pop(void) |
| 777 | 776 | { |
| 778 | audio_fifo_rpos++; | |
| 779 | audio_fifo_num--; | |
| 777 | audio_fifo_rpos++; | |
| 778 | audio_fifo_num--; | |
| 780 | 779 | |
| 781 | if (audio_fifo_num < 0) | |
| 782 | { | |
| 783 | fatalerror("audio_fifo_pop: FIFO underflow!\n"); | |
| 784 | } | |
| 780 | if (audio_fifo_num < 0) | |
| 781 | { | |
| 782 | fatalerror("audio_fifo_pop: FIFO underflow!\n"); | |
| 783 | } | |
| 785 | 784 | |
| 786 | if (audio_fifo_rpos >= AUDIO_DMA_DEPTH) | |
| 787 | { | |
| 788 | audio_fifo_rpos = 0; | |
| 789 | } | |
| 785 | if (audio_fifo_rpos >= AUDIO_DMA_DEPTH) | |
| 786 | { | |
| 787 | audio_fifo_rpos = 0; | |
| 788 | } | |
| 790 | 789 | |
| 791 | if (audio_fifo_num < AUDIO_DMA_DEPTH) | |
| 792 | { | |
| 793 | ai_status &= ~0x80000001; // FIFO not full | |
| 794 | } | |
| 795 | ||
| 796 | ai_len = 0; | |
| 790 | if (audio_fifo_num < AUDIO_DMA_DEPTH) | |
| 791 | { | |
| 792 | ai_status &= ~0x80000001; // FIFO not full | |
| 793 | signal_rcp_interrupt(AI_INTERRUPT); | |
| 794 | } | |
| 797 | 795 | } |
| 798 | 796 | |
| 799 | 797 | static AUDIO_DMA *audio_fifo_get_top(void) |
| 800 | 798 | { |
| 801 | if (audio_fifo_num > 0) | |
| 802 | { | |
| 803 | return &audio_fifo[audio_fifo_rpos]; | |
| 804 | } | |
| 805 | else | |
| 806 | { | |
| 807 | return NULL; | |
| 808 | } | |
| 799 | if (audio_fifo_num > 0) | |
| 800 | { | |
| 801 | return &audio_fifo[audio_fifo_rpos]; | |
| 802 | } | |
| 803 | else | |
| 804 | { | |
| 805 | return NULL; | |
| 806 | } | |
| 809 | 807 | } |
| 810 | 808 | |
| 811 | 809 | static void start_audio_dma(void) |
| 812 | 810 | { |
| 813 | INT16 *ram = (INT16*)rdram; | |
| 814 | AUDIO_DMA *current = audio_fifo_get_top(); | |
| 811 | INT16 *ram = (INT16*)rdram; | |
| 812 | AUDIO_DMA *current = audio_fifo_get_top(); | |
| 813 | attotime period; | |
| 815 | 814 | |
| 816 | ram = &ram[current->address/2]; | |
| 815 | //static FILE * audio_dump = NULL; | |
| 816 | // | |
| 817 | //if (audio_dump == NULL) | |
| 818 | // audio_dump = fopen("audio_dump.raw","wb"); | |
| 819 | // | |
| 820 | //fwrite(&ram[current->address/2],current->length,1,audio_dump); | |
| 817 | 821 | |
| 822 | ram = &ram[current->address/2]; | |
| 823 | ||
| 818 | 824 | // mame_printf_debug("DACDMA: %x for %x bytes\n", current->address, current->length); |
| 819 | 825 | |
| 820 | dmadac_transfer(0, 2, 2, 2, current->length/4, ram); | |
| 826 | dmadac_transfer(0, 2, 2, 2, current->length/4, ram); | |
| 827 | ||
| 828 | ai_status |= 0x40000000; | |
| 829 | ||
| 830 | // adjust the timer | |
| 831 | period = attotime_mul(ATTOTIME_IN_HZ(DACRATE_NTSC), (ai_dacrate + 1) * (current->length / 4)); | |
| 832 | timer_adjust_oneshot(audio_timer, period, 0); | |
| 821 | 833 | } |
| 822 | 834 | |
| 823 | 835 | static TIMER_CALLBACK( audio_timer_callback ) |
| 824 | 836 | { |
| 825 | ||
| 837 | audio_fifo_pop(); | |
| 826 | 838 | |
| 827 | // keep playing if there's another DMA queued | |
| 828 | if (audio_fifo_get_top() != NULL) | |
| 829 | { | |
| 830 | start_audio_dma(); | |
| 831 | signal_rcp_interrupt(AI_INTERRUPT); | |
| 832 | } | |
| 839 | // keep playing if there's another DMA queued | |
| 840 | if (audio_fifo_get_top() != NULL) | |
| 841 | { | |
| 842 | start_audio_dma(); | |
| 843 | signal_rcp_interrupt(AI_INTERRUPT); | |
| 844 | } | |
| 845 | else | |
| 846 | { | |
| 847 | ai_status &= ~0x40000000; | |
| 848 | } | |
| 833 | 849 | } |
| 834 | 850 | |
| 835 | 851 | READ32_HANDLER( n64_ai_reg_r ) |
| 836 | 852 | { |
| 837 | switch (offset) | |
| 838 | { | |
| 839 | case 0x04/4: // AI_LEN_REG | |
| 840 | { | |
| 841 | return ai_len; | |
| 842 | } | |
| 853 | switch (offset) | |
| 854 | { | |
| 855 | case 0x04/4: // AI_LEN_REG | |
| 856 | { | |
| 857 | if (ai_status & 0x80000001) | |
| 858 | { | |
| 859 | return ai_len; | |
| 860 | } | |
| 861 | else if (ai_status & 0x40000000) | |
| 862 | { | |
| 863 | double secs_left = attotime_to_double(attotime_sub(timer_firetime(audio_timer),timer_get_time())); | |
| 864 | unsigned int samples_left = secs_left * DACRATE_NTSC / (ai_dacrate + 1); | |
| 865 | return samples_left * 4; | |
| 866 | } | |
| 867 | else return 0; | |
| 868 | } | |
| 843 | 869 | |
| 844 | case 0x0c/4: // AI_STATUS_REG | |
| 845 | return ai_status; | |
| 870 | case 0x0c/4: // AI_STATUS_REG | |
| 871 | return ai_status; | |
| 846 | 872 | |
| 847 | default: | |
| 848 | logerror("ai_reg_r: %08X, %08X at %08X\n", offset, mem_mask, activecpu_get_pc()); | |
| 849 | break; | |
| 850 | } | |
| 873 | default: | |
| 874 | logerror("ai_reg_r: %08X, %08X at %08X\n", offset, mem_mask, activecpu_get_pc()); | |
| 875 | break; | |
| 876 | } | |
| 851 | 877 | |
| 852 | ||
| 878 | return 0; | |
| 853 | 879 | } |
| 854 | 880 | |
| 855 | 881 | WRITE32_HANDLER( n64_ai_reg_w ) |
| 856 | 882 | { |
| 857 | 883 | // UINT16 *ram = (UINT16*)rdram; |
| 858 | 884 | |
| 859 | switch (offset) | |
| 860 | { | |
| 861 | case 0x00/4: // AI_DRAM_ADDR_REG | |
| 885 | switch (offset) | |
| 886 | { | |
| 887 | case 0x00/4: // AI_DRAM_ADDR_REG | |
| 862 | 888 | // mame_printf_debug("ai_dram_addr = %08X at %08X\n", data, activecpu_get_pc()); |
| 863 | ai_dram_addr = data & 0xffffff; | |
| 864 | break; | |
| 889 | ai_dram_addr = data & 0xffffff; | |
| 890 | break; | |
| 865 | 891 | |
| 866 | ||
| 892 | case 0x04/4: // AI_LEN_REG | |
| 867 | 893 | // mame_printf_debug("ai_len = %08X at %08X\n", data, activecpu_get_pc()); |
| 868 | ai_len = data & 0x3ffff; // Hardware v2.0 has 18 bits, v1.0 has 15 bits | |
| 869 | audio_fifo_push(ai_dram_addr, ai_len); | |
| 870 | break; | |
| 894 | ai_len = data & 0x3ffff; // Hardware v2.0 has 18 bits, v1.0 has 15 bits | |
| 895 | audio_fifo_push(ai_dram_addr, ai_len); | |
| 896 | break; | |
| 871 | 897 | |
| 872 | ||
| 898 | case 0x08/4: // AI_CONTROL_REG | |
| 873 | 899 | // mame_printf_debug("ai_control = %08X at %08X\n", data, activecpu_get_pc()); |
| 874 | ai_control = data; | |
| 875 | break; | |
| 900 | ai_control = data; | |
| 901 | break; | |
| 876 | 902 | |
| 877 | case 0x0c/4: | |
| 878 | clear_rcp_interrupt(AI_INTERRUPT); | |
| 879 | break; | |
| 903 | case 0x0c/4: | |
| 904 | clear_rcp_interrupt(AI_INTERRUPT); | |
| 905 | break; | |
| 880 | 906 | |
| 881 | case 0x10/4: // AI_DACRATE_REG | |
| 882 | ai_dacrate = data & 0x3fff; | |
| 883 | dmadac_set_frequency(0, 2, (double)DACRATE_NTSC / (double)(ai_dacrate+1)); | |
| 884 | dmadac_enable(0, 2, 1); | |
| 885 | break; | |
| 907 | case 0x10/4: // AI_DACRATE_REG | |
| 908 | ai_dacrate = data & 0x3fff; | |
| 909 | dmadac_set_frequency(0, 2, (double)DACRATE_NTSC / (double)(ai_dacrate+1)); | |
| 910 | printf( "frequency: %f\n", (double)DACRATE_NTSC / (double)(ai_dacrate+1) ); | |
| 911 | dmadac_enable(0, 2, 1); | |
| 912 | break; | |
| 886 | 913 | |
| 887 | ||
| 914 | case 0x14/4: // AI_BITRATE_REG | |
| 888 | 915 | // mame_printf_debug("ai_bitrate = %08X\n", data); |
| 889 | ai_bitrate = data & 0xf; | |
| 890 | break; | |
| 916 | ai_bitrate = data & 0xf; | |
| 917 | break; | |
| 891 | 918 | |
| 892 | default: | |
| 893 | logerror("ai_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, activecpu_get_pc()); | |
| 894 | break; | |
| 895 | } | |
| 919 | default: | |
| 920 | logerror("ai_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, activecpu_get_pc()); | |
| 921 | break; | |
| 922 | } | |
| 896 | 923 | } |
| 897 | 924 | |
| 898 | 925 | |
| r2375 | r2376 | |
| 1092 | 1119 | return crc; |
| 1093 | 1120 | } |
| 1094 | 1121 | |
| 1095 | static int pif_channel_handle_command(int channel, int slength, UINT8 *sdata, int rlength, UINT8 *rdata) | |
| 1122 | static int pif_channel_handle_command(running_machine *machine, int channel, int slength, UINT8 *sdata, int rlength, UINT8 *rdata) | |
| 1096 | 1123 | { |
| 1097 | 1124 | int i; |
| 1098 | 1125 | UINT8 command = sdata[0]; |
| r2375 | r2376 | |
| 1156 | 1183 | { |
| 1157 | 1184 | case 0: |
| 1158 | 1185 | { |
| 1159 | buttons = readinputport((channel*3) + 0); | |
| 1160 | x = readinputport((channel*3) + 1) - 128; | |
| 1161 | y = readinputport((channel*3) + 2) - 128; | |
| 1186 | buttons = input_port_read_indexed(machine, (channel*3) + 0); | |
| 1187 | x = input_port_read_indexed(machine, (channel*3) + 1) - 128; | |
| 1188 | y = input_port_read_indexed(machine, (channel*3) + 2) - 128; | |
| 1162 | 1189 | |
| 1163 | 1190 | rdata[0] = (buttons >> 8) & 0xff; |
| 1164 | 1191 | rdata[1] = (buttons >> 0) & 0xff; |
| r2375 | r2376 | |
| 1319 | 1346 | return 0; |
| 1320 | 1347 | } |
| 1321 | 1348 | |
| 1322 | static void handle_pif( | |
| 1349 | static void handle_pif(running_machine *machine) | |
| 1323 | 1350 | { |
| 1324 | 1351 | int j; |
| 1325 | 1352 | |
| r2375 | r2376 | |
| 1371 | 1398 | send_buffer[j] = pif_cmd[cmd_ptr++]; |
| 1372 | 1399 | } |
| 1373 | 1400 | |
| 1374 | ||
| 1401 | res = pif_channel_handle_command(machine, channel, bytes_to_send, send_buffer, bytes_to_recv, recv_buffer); | |
| 1375 | 1402 | |
| 1376 | 1403 | if (res == 0) |
| 1377 | 1404 | { |
| r2375 | r2376 | |
| 1411 | 1438 | */ |
| 1412 | 1439 | } |
| 1413 | 1440 | |
| 1414 | static void pif_dma(int direction) | |
| 1441 | static void pif_dma(running_machine *machine, int direction) | |
| 1415 | 1442 | { |
| 1416 | 1443 | int i; |
| 1417 | 1444 | UINT32 *src, *dst; |
| r2375 | r2376 | |
| 1438 | 1465 | } |
| 1439 | 1466 | else // PIF RAM -> RDRAM |
| 1440 | 1467 | { |
| 1441 | handle_pif(); | |
| 1468 | handle_pif(machine); | |
| 1442 | 1469 | |
| 1443 | 1470 | dst = (UINT32*)&rdram[(si_dram_addr & 0x1fffffff) / 4]; |
| 1444 | 1471 | |
| r2375 | r2376 | |
| 1483 | 1510 | case 0x04/4: // SI_PIF_ADDR_RD64B_REG |
| 1484 | 1511 | // PIF RAM -> RDRAM |
| 1485 | 1512 | si_pif_addr = data; |
| 1486 | ||
| 1513 | pif_dma(machine, 0); | |
| 1487 | 1514 | break; |
| 1488 | 1515 | |
| 1489 | 1516 | case 0x10/4: // SI_PIF_ADDR_WR64B_REG |
| 1490 | 1517 | // RDRAM -> PIF RAM |
| 1491 | 1518 | si_pif_addr = data; |
| 1492 | ||
| 1519 | pif_dma(machine, 1); | |
| 1493 | 1520 | break; |
| 1494 | 1521 | |
| 1495 | 1522 | case 0x18/4: // SI_STATUS_REG |
| r2375 | r2376 | |
|---|---|---|
| 118 | 118 | // Perhaps define dipswitches as active low? |
| 119 | 119 | READ8_HANDLER( stfight_dsw_r ) |
| 120 | 120 | { |
| 121 | return( ~ | |
| 121 | return( ~ | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | static int stfight_coin_mech_query_active = 0; |
| r2375 | r2376 | |
| 145 | 145 | * since it's read by the 30Hz interrupt ISR |
| 146 | 146 | */ |
| 147 | 147 | |
| 148 | coin_mech_data = | |
| 148 | coin_mech_data = | |
| 149 | 149 | |
| 150 | 150 | for( i=0; i<2; i++ ) |
| 151 | 151 | { |
| r2375 | r2376 | |
|---|---|---|
| 470 | 470 | break; |
| 471 | 471 | case 2: |
| 472 | 472 | #if 1 |
| 473 | mcu->rxd = input_port_ | |
| 473 | mcu->rxd = input_port_ | |
| 474 | 474 | mcu->sts |= 0x01; /* RD ready */ |
| 475 | 475 | #endif |
| 476 | 476 | break; |
| r2375 | r2376 | |
|---|---|---|
| 437 | 437 | { |
| 438 | 438 | switch (offset) |
| 439 | 439 | { |
| 440 | case 0x03: return readinputportbytag("F00007"); /* STARTn + SERVICE1 */ | |
| 441 | case 0x04: return readinputportbytag("F00009"); /* COINn */ | |
| 442 | case 0x05: return readinputportbytag("F0000B"); /* Player controls + TILT */ | |
| 443 | case 0x06: return readinputportbytag("F0000D"); /* Player controls (cocktail) */ | |
| 440 | case 0x03: return input_port_read(machine, "F00007"); /* STARTn + SERVICE1 */ | |
| 441 | case 0x04: return input_port_read(machine, "F00009"); /* COINn */ | |
| 442 | case 0x05: return input_port_read(machine, "F0000B"); /* Player controls + TILT */ | |
| 443 | case 0x06: return input_port_read(machine, "F0000D"); /* Player controls (cocktail) */ | |
| 444 | 444 | case 0x08: return cc_port; |
| 445 | 445 | } |
| 446 | 446 | } |
| r2375 | r2376 | |
|---|---|---|
| 21 | 21 | static void counter_set_out(int which, int gate); |
| 22 | 22 | static TIMER_CALLBACK( counter_callback ); |
| 23 | 23 | static TIMER_CALLBACK( clock_counter_0_ff ); |
| 24 | static void update_grudge_steering( | |
| 24 | static void update_grudge_steering(running_machine *machine); | |
| 25 | 25 | |
| 26 | 26 | /* global data */ |
| 27 | 27 | UINT8 balsente_shooter; |
| r2375 | r2376 | |
| 123 | 123 | |
| 124 | 124 | /* if this is Grudge Match, update the steering */ |
| 125 | 125 | if (grudge_steering_result & 0x80) |
| 126 | update_grudge_steering(); | |
| 126 | update_grudge_steering(machine); | |
| 127 | 127 | |
| 128 | 128 | /* if we're a shooter, we do a little more work */ |
| 129 | 129 | if (balsente_shooter) |
| r2375 | r2376 | |
| 133 | 133 | /* we latch the beam values on the first interrupt after VBLANK */ |
| 134 | 134 | if (param == 64 && balsente_shooter) |
| 135 | 135 | { |
| 136 | balsente_shooter_x = readinputport(8); | |
| 137 | balsente_shooter_y = readinputport(9); | |
| 136 | balsente_shooter_x = input_port_read_indexed(machine, 8); | |
| 137 | balsente_shooter_y = input_port_read_indexed(machine, 9); | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /* which bits get returned depends on which scanline we're at */ |
| r2375 | r2376 | |
| 611 | 611 | /* ports are read once a frame, just at varying intervals. To get around this, we */ |
| 612 | 612 | /* read all the analog inputs at VBLANK time and just return the cached values. */ |
| 613 | 613 | for (i = 0; i < 4; i++) |
| 614 | analog_input_data[i] = | |
| 614 | analog_input_data[i] = | |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | |
| r2375 | r2376 | |
| 1122 | 1122 | |
| 1123 | 1123 | READ8_HANDLER( nstocker_port2_r ) |
| 1124 | 1124 | { |
| 1125 | return ( | |
| 1125 | return ( | |
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | 1128 | |
| r2375 | r2376 | |
| 1161 | 1161 | } |
| 1162 | 1162 | |
| 1163 | 1163 | |
| 1164 | static void update_grudge_steering( | |
| 1164 | static void update_grudge_steering(running_machine *machine) | |
| 1165 | 1165 | { |
| 1166 | 1166 | UINT8 wheel[3]; |
| 1167 | 1167 | INT8 diff[3]; |
| 1168 | 1168 | |
| 1169 | 1169 | /* read the current steering values */ |
| 1170 | wheel[0] = readinputport(4); | |
| 1171 | wheel[1] = readinputport(5); | |
| 1172 | wheel[2] = readinputport(6); | |
| 1170 | wheel[0] = input_port_read_indexed(machine, 4); | |
| 1171 | wheel[1] = input_port_read_indexed(machine, 5); | |
| 1172 | wheel[2] = input_port_read_indexed(machine, 6); | |
| 1173 | 1173 | |
| 1174 | 1174 | /* diff the values */ |
| 1175 | 1175 | diff[0] = wheel[0] - grudge_last_steering[0]; |
| r2375 | r2376 | |
|---|---|---|
| 117 | 117 | if ( data & 1 ) |
| 118 | 118 | { |
| 119 | 119 | /* load up the latches */ |
| 120 | input_latch[0] = readinputport( 0 ); | |
| 121 | input_latch[1] = readinputport( 1 ); | |
| 120 | input_latch[0] = input_port_read_indexed(machine, 0 ); | |
| 121 | input_latch[1] = input_port_read_indexed(machine, 1 ); | |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| r2375 | r2376 | |
| 129 | 129 | /* shift */ |
| 130 | 130 | input_latch[0] >>= 1; |
| 131 | 131 | |
| 132 | ret |= readinputport( 2 ); /* merge coins, etc */ | |
| 133 | ret |= ( readinputport( 3 ) & 3 ) << 3; /* merge 2 dipswitches */ | |
| 132 | ret |= input_port_read_indexed(machine, 2 ); /* merge coins, etc */ | |
| 133 | ret |= ( input_port_read_indexed(machine, 3 ) & 3 ) << 3; /* merge 2 dipswitches */ | |
| 134 | 134 | |
| 135 | 135 | /* The gun games expect a 1 returned on every 5th read after sound_fix is reset*/ |
| 136 | 136 | /* Info Supplied by Ben Parnell <xodnizel@home.com> of FCE Ultra fame */ |
| r2375 | r2376 | |
| 155 | 155 | /* shift */ |
| 156 | 156 | input_latch[0] >>= 1; |
| 157 | 157 | |
| 158 | ret |= readinputport( 2 ); /* merge coins, etc */ | |
| 159 | ret |= ( readinputport( 3 ) & 3 ) << 3; /* merge 2 dipswitches */ | |
| 158 | ret |= input_port_read_indexed(machine, 2 ); /* merge coins, etc */ | |
| 159 | ret |= ( input_port_read_indexed(machine, 3 ) & 3 ) << 3; /* merge 2 dipswitches */ | |
| 160 | 160 | |
| 161 | 161 | return ret; |
| 162 | 162 | |
| r2375 | r2376 | |
| 167 | 167 | { |
| 168 | 168 | int ret = ( input_latch[1] ) & 1; |
| 169 | 169 | |
| 170 | ret |= | |
| 170 | ret |= | |
| 171 | 171 | |
| 172 | 172 | /* shift */ |
| 173 | 173 | input_latch[1] >>= 1; |
| r2375 | r2376 | |
| 181 | 181 | if ( data & 1 ) |
| 182 | 182 | { |
| 183 | 183 | /* load up the latches */ |
| 184 | input_latch[2] = readinputport( 4 ); | |
| 185 | input_latch[3] = readinputport( 5 ); | |
| 184 | input_latch[2] = input_port_read_indexed(machine, 4 ); | |
| 185 | input_latch[3] = input_port_read_indexed(machine, 5 ); | |
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| r2375 | r2376 | |
| 193 | 193 | /* shift */ |
| 194 | 194 | input_latch[2] >>= 1; |
| 195 | 195 | |
| 196 | ret |= readinputport( 6 ); /* merge coins, etc */ | |
| 197 | ret |= ( readinputport( 7 ) & 3 ) << 3; /* merge 2 dipswitches */ | |
| 196 | ret |= input_port_read_indexed(machine, 6 ); /* merge coins, etc */ | |
| 197 | ret |= ( input_port_read_indexed(machine, 7 ) & 3 ) << 3; /* merge 2 dipswitches */ | |
| 198 | 198 | return ret; |
| 199 | 199 | } |
| 200 | 200 | |
| r2375 | r2376 | |
| 202 | 202 | { |
| 203 | 203 | int ret = ( input_latch[3] ) & 1; |
| 204 | 204 | |
| 205 | ret |= | |
| 205 | ret |= | |
| 206 | 206 | |
| 207 | 207 | /* shift */ |
| 208 | 208 | input_latch[3] >>= 1; |
| r2375 | r2376 | |
| 345 | 345 | { |
| 346 | 346 | |
| 347 | 347 | /* load up the latches */ |
| 348 | input_latch[0] = | |
| 348 | input_latch[0] = | |
| 349 | 349 | |
| 350 | 350 | /* do the gun thing */ |
| 351 | 351 | if ( vsnes_gun_controller ) |
| 352 | 352 | { |
| 353 | int x = readinputport( 4 ); | |
| 354 | int y = readinputport( 5 ); | |
| 353 | int x = input_port_read_indexed(machine, 4 ); | |
| 354 | int y = input_port_read_indexed(machine, 5 ); | |
| 355 | 355 | UINT32 pix, color_base; |
| 356 | 356 | |
| 357 | 357 | /* get the pixel at the gun position */ |
| r2375 | r2376 | |
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | input_latch[1] = | |
| 371 | input_latch[1] = | |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | if ( ( zapstore & 1 ) && ( !( data & 1 ) ) ) |
| r2375 | r2376 | |
|---|---|---|
| 466 | 466 | |
| 467 | 467 | UINT8 ddr = state->_68705_ddr[1]; |
| 468 | 468 | UINT8 out = state->_68705_port_out[1]; |
| 469 | UINT8 in = ( | |
| 469 | UINT8 in = ( | |
| 470 | 470 | return (out & ddr) | (in & ~ddr); |
| 471 | 471 | } |
| 472 | 472 | |
| r2375 | r2376 | |
| 477 | 477 | |
| 478 | 478 | UINT8 ddr = state->_68705_ddr[2]; |
| 479 | 479 | UINT8 out = state->_68705_port_out[2]; |
| 480 | UINT8 in = (state->coinctrl & 0x08) | (( | |
| 480 | UINT8 in = (state->coinctrl & 0x08) | (( | |
| 481 | 481 | return (out & ddr) | (in & ~ddr); |
| 482 | 482 | } |
| 483 | 483 | |
| r2375 | r2376 | |
| 598 | 598 | { |
| 599 | 599 | qix_state *state = machine->driver_data; |
| 600 | 600 | |
| 601 | return | |
| 601 | return | |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | |
| r2375 | r2376 | |
| 606 | 606 | { |
| 607 | 607 | qix_state *state = machine->driver_data; |
| 608 | 608 | |
| 609 | return | |
| 609 | return | |
| 610 | 610 | } |
| r2375 | r2376 | |
|---|---|---|
| 57 | 57 | } |
| 58 | 58 | else |
| 59 | 59 | { |
| 60 | data = | |
| 60 | data = | |
| 61 | 61 | } |
| 62 | 62 | if(joystick_data_select) data >>= 4; |
| 63 | 63 | ret = (data & 0x0F) | pce.io_port_options; |
| r2375 | r2376 | |
|---|---|---|
| 46 | 46 | |
| 47 | 47 | ***************************************************************************/ |
| 48 | 48 | |
| 49 | static void mcu_simulate( | |
| 49 | static void mcu_simulate(running_machine *machine) | |
| 50 | 50 | { |
| 51 | 51 | if (!kikikai_mcu_initialised) |
| 52 | 52 | { |
| r2375 | r2376 | |
| 71 | 71 | int coin_curr; |
| 72 | 72 | |
| 73 | 73 | |
| 74 | coin_curr = ~ | |
| 74 | coin_curr = ~ | |
| 75 | 75 | if (coin_curr && !coin_last && mexico86_protection_ram[0x01] < 9) |
| 76 | 76 | { |
| 77 | 77 | mexico86_protection_ram[0x01]++; // increase credits counter |
| r2375 | r2376 | |
| 81 | 81 | |
| 82 | 82 | mexico86_protection_ram[0x04] = 0x3c; // coin inputs |
| 83 | 83 | |
| 84 | mexico86_protection_ram[0x02] = BITSWAP8(readinputport(1), 7,6,5,4,2,3,1,0); // player 1 | |
| 85 | mexico86_protection_ram[0x03] = BITSWAP8(readinputport(2), 7,6,5,4,2,3,1,0); // player 2 | |
| 84 | mexico86_protection_ram[0x02] = BITSWAP8(input_port_read_indexed(machine, 1), 7,6,5,4,2,3,1,0); // player 1 | |
| 85 | mexico86_protection_ram[0x03] = BITSWAP8(input_port_read_indexed(machine, 2), 7,6,5,4,2,3,1,0); // player 2 | |
| 86 | 86 | |
| 87 | 87 | if (mexico86_protection_ram[0x19] == 0xaa) // player 2 active |
| 88 | 88 | mexico86_protection_ram[0x1b] = mexico86_protection_ram[0x03]; |
| r2375 | r2376 | |
| 154 | 154 | INTERRUPT_GEN( kikikai_interrupt ) |
| 155 | 155 | { |
| 156 | 156 | if (kikikai_mcu_running) |
| 157 | mcu_simulate(); | |
| 157 | mcu_simulate(machine); | |
| 158 | 158 | |
| 159 | 159 | cpunum_set_input_line_vector(0,0,mexico86_protection_ram[0]); |
| 160 | 160 | cpunum_set_input_line(machine, 0,0,HOLD_LINE); |
| r2375 | r2376 | |
| 302 | 302 | else |
| 303 | 303 | { |
| 304 | 304 | //logerror("%04x: 68705 read input port %04x\n",activecpu_get_pc(),address); |
| 305 | latch = | |
| 305 | latch = | |
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | else /* write */ |
| r2375 | r2376 | |
|---|---|---|
| 176 | 176 | { |
| 177 | 177 | int i; |
| 178 | 178 | |
| 179 | joypad[0].low = readinputport( 0 ); | |
| 180 | joypad[0].high = readinputport( 1 ); | |
| 181 | joypad[1].low = readinputport( 2 ); | |
| 182 | joypad[1].high = readinputport( 3 ); | |
| 183 | joypad[2].low = readinputport( 4 ); | |
| 184 | joypad[2].high = readinputport( 5 ); | |
| 185 | joypad[3].low = readinputport( 6 ); | |
| 186 | joypad[3].high = readinputport( 7 ); | |
| 179 | joypad[0].low = input_port_read_indexed(machine, 0 ); | |
| 180 | joypad[0].high = input_port_read_indexed(machine, 1 ); | |
| 181 | joypad[1].low = input_port_read_indexed(machine, 2 ); | |
| 182 | joypad[1].high = input_port_read_indexed(machine, 3 ); | |
| 183 | joypad[2].low = input_port_read_indexed(machine, 4 ); | |
| 184 | joypad[2].high = input_port_read_indexed(machine, 5 ); | |
| 185 | joypad[3].low = input_port_read_indexed(machine, 6 ); | |
| 186 | joypad[3].high = input_port_read_indexed(machine, 7 ); | |
| 187 | 187 | |
| 188 | 188 | // avoid sending signals that could crash games |
| 189 | 189 | for (i = 0; i < 4; i++) |
| r2375 | r2376 | |
| 953 | 953 | #ifndef MESS |
| 954 | 954 | case 0x4100: /* NSS Dip-Switches */ |
| 955 | 955 | #ifdef MAME_DEBUG |
| 956 | return | |
| 956 | return | |
| 957 | 957 | #else |
| 958 | return | |
| 958 | return | |
| 959 | 959 | #endif /* MAME_DEBUG */ |
| 960 | 960 | // case 0x4101: //PC: a104 - a10e - a12a //only nss_actr |
| 961 | 961 | // case 0x420c: //PC: 9c7d - 8fab //only nss_ssoc |
| r2375 | r2376 | |
|---|---|---|
| 462 | 462 | |
| 463 | 463 | CUSTOM_INPUT( amiga_joystick_convert ) |
| 464 | 464 | { |
| 465 | UINT8 bits = | |
| 465 | UINT8 bits = | |
| 466 | 466 | int up = (bits >> 0) & 1; |
| 467 | 467 | int down = (bits >> 1) & 1; |
| 468 | 468 | int left = (bits >> 2) & 1; |
| r2375 | r2376 | |
| 1204 | 1204 | |
| 1205 | 1205 | case REG_VPOSR: |
| 1206 | 1206 | CUSTOM_REG(REG_VPOSR) &= 0xff00; |
| 1207 | CUSTOM_REG(REG_VPOSR) |= amiga_gethvpos() >> 16; | |
| 1207 | CUSTOM_REG(REG_VPOSR) |= amiga_gethvpos(machine->primary_screen) >> 16; | |
| 1208 | 1208 | return CUSTOM_REG(REG_VPOSR); |
| 1209 | 1209 | |
| 1210 | 1210 | case REG_VHPOSR: |
| 1211 | return amiga_gethvpos() & 0xffff; | |
| 1211 | return amiga_gethvpos(machine->primary_screen) & 0xffff; | |
| 1212 | 1212 | |
| 1213 | 1213 | case REG_SERDATR: |
| 1214 | 1214 | CUSTOM_REG(REG_SERDATR) &= ~0x4000; |
| r2375 | r2376 | |
| 1218 | 1218 | case REG_JOY0DAT: |
| 1219 | 1219 | if (amiga_intf->joy0dat_r != NULL) |
| 1220 | 1220 | return (*amiga_intf->joy0dat_r)(); |
| 1221 | return | |
| 1221 | return | |
| 1222 | 1222 | |
| 1223 | 1223 | case REG_JOY1DAT: |
| 1224 | 1224 | if (amiga_intf->joy1dat_r != NULL) |
| 1225 | 1225 | return (*amiga_intf->joy1dat_r)(); |
| 1226 | return | |
| 1226 | return | |
| 1227 | 1227 | |
| 1228 | 1228 | case REG_ADKCONR: |
| 1229 | 1229 | return CUSTOM_REG(REG_ADKCON); |
| 1230 | 1230 | |
| 1231 | 1231 | case REG_POTGOR: |
| 1232 | return | |
| 1232 | return | |
| 1233 | 1233 | |
| 1234 | 1234 | case REG_POT0DAT: |
| 1235 | return | |
| 1235 | return | |
| 1236 | 1236 | |
| 1237 | 1237 | case REG_POT1DAT: |
| 1238 | return | |
| 1238 | return | |
| 1239 | 1239 | |
| 1240 | 1240 | case REG_DSKBYTR: |
| 1241 | 1241 | if (amiga_intf->dskbytr_r != NULL) |
| r2375 | r2376 | |
|---|---|---|
| 126 | 126 | if (offset > 2) |
| 127 | 127 | adc_result = 0; |
| 128 | 128 | else |
| 129 | adc_result = | |
| 129 | adc_result = | |
| 130 | 130 | |
| 131 | 131 | update_irq_encoder(INPUT_LINE_IRQ2, ASSERT_LINE); |
| 132 | 132 | return 0; |
| r2375 | r2376 | |
| 143 | 143 | READ16_HANDLER( vertigo_coin_r ) |
| 144 | 144 | { |
| 145 | 145 | update_irq_encoder(INPUT_LINE_IRQ6, CLEAR_LINE); |
| 146 | return ( | |
| 146 | return ( | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
| 150 | 150 | INTERRUPT_GEN( vertigo_interrupt ) |
| 151 | 151 | { |
| 152 | 152 | /* Coin inputs cause IRQ6 */ |
| 153 | if (( | |
| 153 | if (( | |
| 154 | 154 | update_irq_encoder(INPUT_LINE_IRQ6, ASSERT_LINE); |
| 155 | 155 | } |
| 156 | 156 |
| r2375 | r2376 | |
|---|---|---|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | |
| 505 | static | |
| 505 | static STATE_POSTLOAD( slapstic_postload | |
| 506 | 506 | { |
| 507 | 507 | update_bank(slapstic_bank()); |
| 508 | 508 | } |
| r2375 | r2376 | |
| 1639 | 1639 | SAVE STATE |
| 1640 | 1640 | ***************************************************************************/ |
| 1641 | 1641 | |
| 1642 | void atarigen_init_save_state( | |
| 1642 | void atarigen_init_save_state(running_machine *machine) | |
| 1643 | 1643 | { |
| 1644 | 1644 | state_save_register_global(atarigen_scanline_int_state); |
| 1645 | 1645 | state_save_register_global(atarigen_sound_int_state); |
| r2375 | r2376 | |
| 1683 | 1683 | state_save_register_global(playfield2_latch); |
| 1684 | 1684 | |
| 1685 | 1685 | /* need a postload to reset the state */ |
| 1686 | state_save_register_ | |
| 1686 | state_save_register_ | |
| 1687 | 1687 | } |
| r2375 | r2376 | |
|---|---|---|
| 238 | 238 | STATE SAVE |
| 239 | 239 | ---------------------------------------------------------------*/ |
| 240 | 240 | |
| 241 | void atarigen_init_save_state( | |
| 241 | void atarigen_init_save_state(running_machine *machine); | |
| 242 | 242 | |
| 243 | 243 | /*************************************************************************** |
| 244 | 244 | GENERAL ATARI NOTES |
| r2375 | r2376 | |
|---|---|---|
| 188 | 188 | case 1: |
| 189 | 189 | case 2: |
| 190 | 190 | case 3: |
| 191 | return | |
| 191 | return | |
| 192 | 192 | |
| 193 | 193 | case 4: |
| 194 | 194 | return (midway_serial_pic_status_r() << 12) | midwunit_sound_state_r(machine,0,0); |
| r2375 | r2376 | |
| 211 | 211 | case 1: |
| 212 | 212 | case 2: |
| 213 | 213 | case 3: |
| 214 | return | |
| 214 | return | |
| 215 | 215 | |
| 216 | 216 | default: |
| 217 | 217 | logerror("%08X:Unknown I/O read from %d\n", activecpu_get_pc(), offset); |
| r2375 | r2376 | |
| 223 | 223 | |
| 224 | 224 | READ16_HANDLER( midxunit_analog_r ) |
| 225 | 225 | { |
| 226 | return | |
| 226 | return | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 |
| r2375 | r2376 | |
|---|---|---|
| 743 | 743 | switch((data>>2)&0x07) |
| 744 | 744 | { |
| 745 | 745 | case 0: |
| 746 | namcos2_mcu_analog_data=input_port_ | |
| 746 | namcos2_mcu_analog_data=input_port_ | |
| 747 | 747 | break; |
| 748 | 748 | case 1: |
| 749 | namcos2_mcu_analog_data=input_port_ | |
| 749 | namcos2_mcu_analog_data=input_port_ | |
| 750 | 750 | break; |
| 751 | 751 | case 2: |
| 752 | namcos2_mcu_analog_data=input_port_ | |
| 752 | namcos2_mcu_analog_data=input_port_ | |
| 753 | 753 | break; |
| 754 | 754 | case 3: |
| 755 | namcos2_mcu_analog_data=input_port_ | |
| 755 | namcos2_mcu_analog_data=input_port_ | |
| 756 | 756 | break; |
| 757 | 757 | case 4: |
| 758 | namcos2_mcu_analog_data=input_port_ | |
| 758 | namcos2_mcu_analog_data=input_port_ | |
| 759 | 759 | break; |
| 760 | 760 | case 5: |
| 761 | namcos2_mcu_analog_data=input_port_ | |
| 761 | namcos2_mcu_analog_data=input_port_ | |
| 762 | 762 | break; |
| 763 | 763 | case 6: |
| 764 | namcos2_mcu_analog_data=input_port_ | |
| 764 | namcos2_mcu_analog_data=input_port_ | |
| 765 | 765 | break; |
| 766 | 766 | case 7: |
| 767 | namcos2_mcu_analog_data=input_port_ | |
| 767 | namcos2_mcu_analog_data=input_port_ | |
| 768 | 768 | break; |
| 769 | 769 | } |
| 770 | 770 | #if 0 |
| r2375 | r2376 | |
| 820 | 820 | int data=0; |
| 821 | 821 | |
| 822 | 822 | /* Read/convert the bits one at a time */ |
| 823 | if(input_port_2_r(machine,0)>threshold) data|=0x01; | |
| 824 | if(input_port_3_r(machine,0)>threshold) data|=0x02; | |
| 825 | if(input_port_4_r(machine,0)>threshold) data|=0x04; | |
| 826 | if(input_port_5_r(machine,0)>threshold) data|=0x08; | |
| 827 | if(input_port_6_r(machine,0)>threshold) data|=0x10; | |
| 828 | if(input_port_7_r(machine,0)>threshold) data|=0x20; | |
| 829 | if(input_port_8_r(machine,0)>threshold) data|=0x40; | |
| 830 | if(input_port_9_r(machine,0)>threshold) data|=0x80; | |
| 823 | if(input_port_read_indexed(machine, 2)>threshold) data|=0x01; | |
| 824 | if(input_port_read_indexed(machine, 3)>threshold) data|=0x02; | |
| 825 | if(input_port_read_indexed(machine, 4)>threshold) data|=0x04; | |
| 826 | if(input_port_read_indexed(machine, 5)>threshold) data|=0x08; | |
| 827 | if(input_port_read_indexed(machine, 6)>threshold) data|=0x10; | |
| 828 | if(input_port_read_indexed(machine, 7)>threshold) data|=0x20; | |
| 829 | if(input_port_read_indexed(machine, 8)>threshold) data|=0x40; | |
| 830 | if(input_port_read_indexed(machine, 9)>threshold) data|=0x80; | |
| 831 | 831 | |
| 832 | 832 | /* Return the result */ |
| 833 | 833 | return data; |
| r2375 | r2376 | |
| 835 | 835 | |
| 836 | 836 | READ8_HANDLER( namcos2_input_port_0_r ) |
| 837 | 837 | { |
| 838 | int data= | |
| 838 | int data= | |
| 839 | 839 | return data; |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | READ8_HANDLER( namcos2_input_port_10_r ) |
| 843 | 843 | { |
| 844 | int data= | |
| 844 | int data= | |
| 845 | 845 | return data; |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | READ8_HANDLER( namcos2_input_port_12_r ) |
| 849 | 849 | { |
| 850 | int data= | |
| 850 | int data= | |
| 851 | 851 | return data; |
| 852 | 852 | } |
| r2375 | r2376 | |
|---|---|---|
| 193 | 193 | /* bit 6 is EEPROM data (DOUT) */ |
| 194 | 194 | /* bit 7 is EEPROM ready */ |
| 195 | 195 | /* bits 0-5, COINSW, STARTSW & Service */ |
| 196 | return (1 << 7) | (EEPROM_read_bit() << 6) | ( | |
| 196 | return (1 << 7) | (EEPROM_read_bit() << 6) | ( | |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | WRITE16_HANDLER( gaelco2_eeprom_cs_w ) |
| r2375 | r2376 | |
|---|---|---|
| 129 | 129 | { |
| 130 | 130 | switch (offset<<1) { |
| 131 | 131 | case 0x110: /* Player input */ |
| 132 | return | |
| 132 | return | |
| 133 | 133 | |
| 134 | 134 | case 0x36c: /* Coins */ |
| 135 | 135 | case 0x334: /* Probably also, c6, 2c0, 2e0, 4b2, 46a, 4da, rohga is 44c */ |
| 136 | return | |
| 136 | return | |
| 137 | 137 | case 0x0dc: |
| 138 | return | |
| 138 | return | |
| 139 | 139 | |
| 140 | 140 | case 0x494: /* Dips */ |
| 141 | return | |
| 141 | return | |
| 142 | 142 | |
| 143 | 143 | case 0x244: |
| 144 | 144 | return deco16_prot_ram[0]; |
| r2375 | r2376 | |
| 361 | 361 | |
| 362 | 362 | /* Player 1 & 2 controls, read in IRQ then written *back* to protection device */ |
| 363 | 363 | case 0x50: /* written to 9e byte */ |
| 364 | return | |
| 364 | return | |
| 365 | 365 | case 0x6f8: /* written to 76 byte */ |
| 366 | return ( | |
| 366 | return ( | |
| 367 | 367 | |
| 368 | 368 | case 0x5c: /* After coin insert, high 0x8000 bit set starts game */ |
| 369 | 369 | return deco16_prot_ram[0x3b]; |
| r2375 | r2376 | |
| 373 | 373 | return ((deco16_prot_ram[0x9e/2]&0xff00)>>8) | ((deco16_prot_ram[0x9e/2]&0x00ff)<<8); |
| 374 | 374 | |
| 375 | 375 | case 0xac: /* Dip switches */ |
| 376 | return | |
| 376 | return | |
| 377 | 377 | case 0xc2: |
| 378 | return | |
| 378 | return | |
| 379 | 379 | |
| 380 | 380 | case 0x5d4: /* The state of the dips last frame */ |
| 381 | 381 | return deco16_prot_ram[0x34/2]; |
| r2375 | r2376 | |
| 387 | 387 | return (((deco16_prot_ram[0]&0xfff0)>>0) | ((deco16_prot_ram[0]&0x000c)>>2) | ((deco16_prot_ram[0]&0x0003)<<2)) & (~deco16_prot_ram[0x36/2]); |
| 388 | 388 | |
| 389 | 389 | case 0x76a: /* Coins */ |
| 390 | return | |
| 390 | return | |
| 391 | 391 | |
| 392 | 392 | case 0x284: /* Bit shifting with inverted mask register */ |
| 393 | 393 | return (((deco16_prot_ram[0x40/2]&0xfff0)>>0) | ((deco16_prot_ram[0x40/2]&0x0007)<<1) | ((deco16_prot_ram[0x40/2]&0x0008)>>3)) & (~deco16_prot_ram[0x36/2]); |
| r2375 | r2376 | |
| 401 | 401 | return (((deco16_prot_ram[0x6a/2]&0x00f0)<<4) | ((deco16_prot_ram[0x6a/2]&0x0f00)<<4) | ((deco16_prot_ram[0x6a/2]&0x0007)<<5) | ((deco16_prot_ram[0x6a/2]&0x0008)<<1)) & (~deco16_prot_ram[0x36/2]); |
| 402 | 402 | |
| 403 | 403 | case 0x7d6: /* XOR IN0 */ |
| 404 | return | |
| 404 | return | |
| 405 | 405 | case 0x4b4: |
| 406 | 406 | return ((deco16_prot_ram[0x32/2]&0x00f0)<<8) | ((deco16_prot_ram[0x32/2]&0x000e)<<7) | ((deco16_prot_ram[0x32/2]&0x0001)<<11); |
| 407 | 407 | } |
| r2375 | r2376 | |
| 462 | 462 | |
| 463 | 463 | switch (offset*2) { |
| 464 | 464 | case 0xac: /* Dip switches */ |
| 465 | return | |
| 465 | return | |
| 466 | 466 | case 0xc2: /* Dip switches */ |
| 467 | return | |
| 467 | return | |
| 468 | 468 | case 0x46: /* Coins */ |
| 469 | return | |
| 469 | return | |
| 470 | 470 | case 0x50: /* Player 1 & 2 input ports */ |
| 471 | return | |
| 471 | return | |
| 472 | 472 | case 0x63c: /* Player 1 & 2 input ports */ |
| 473 | return | |
| 473 | return | |
| 474 | 474 | |
| 475 | 475 | case 0x5f4: |
| 476 | 476 | return deco16_prot_ram[0x18/2]; |
| r2375 | r2376 | |
| 645 | 645 | return deco16_prot_ram[15]; |
| 646 | 646 | |
| 647 | 647 | case 0x36: /* Dip switches */ |
| 648 | return | |
| 648 | return | |
| 649 | 649 | |
| 650 | 650 | case 0x1c8: /* Coins */ |
| 651 | return | |
| 651 | return | |
| 652 | 652 | |
| 653 | 653 | case 0x22c: /* Player 1 & 2 input ports */ |
| 654 | return | |
| 654 | return | |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",activecpu_get_pc(),offset); |
| r2375 | r2376 | |
| 741 | 741 | return ((deco16_prot_ram[0x78e>>1]>>4)&0xff00) | (deco16_prot_ram[0x78e>>1]&0x000f) | ((deco16_prot_ram[0x78e>>1]<<8)&0xf000); |
| 742 | 742 | |
| 743 | 743 | case 0x00c >> 1: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 744 | return ( | |
| 744 | return ( | |
| 745 | 745 | case 0x778 >> 1: /* Credits */ |
| 746 | return | |
| 746 | return | |
| 747 | 747 | case 0x382 >> 1: /* DIPS */ |
| 748 | return ( | |
| 748 | return ( | |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | if (activecpu_get_pc()!=0xc0ea) |
| 752 | logerror("CPU #0 PC %06x: warning - read unmapped control address %06x (ctrl %04x)\n",activecpu_get_pc(),offset<<1, | |
| 752 | logerror("CPU #0 PC %06x: warning - read unmapped control address %06x (ctrl %04x)\n",activecpu_get_pc(),offset<<1, | |
| 753 | 753 | |
| 754 | 754 | return 0; |
| 755 | 755 | } |
| r2375 | r2376 | |
| 858 | 858 | |
| 859 | 859 | switch (offset) { |
| 860 | 860 | case 0x88/2: /* Player 1 & 2 input ports */ |
| 861 | return | |
| 861 | return | |
| 862 | 862 | case 0x36c/2: |
| 863 | return | |
| 863 | return | |
| 864 | 864 | case 0x44c/2: |
| 865 | 865 | |
| 866 | return (( | |
| 866 | return (( | |
| 867 | 867 | case 0x292/2: /* Dips */ |
| 868 | return | |
| 868 | return | |
| 869 | 869 | |
| 870 | 870 | case 0x44/2: |
| 871 | 871 | return ((((DECO_PORT(0x2c)&0x000f)<<12)) ^ deco16_xor) & (~deco16_mask); |
| r2375 | r2376 | |
| 1242 | 1242 | switch (offset) |
| 1243 | 1243 | { |
| 1244 | 1244 | case 0x582: /* Player 1 & Player 2 */ |
| 1245 | return | |
| 1245 | return | |
| 1246 | 1246 | case 0x04c: /* Coins/VBL */ |
| 1247 | return | |
| 1247 | return | |
| 1248 | 1248 | case 0x672: /* Dip switches */ |
| 1249 | return | |
| 1249 | return | |
| 1250 | 1250 | |
| 1251 | 1251 | case 0x13a: |
| 1252 | 1252 | return ((DECO_PORT(0x190)&0x00f0)<<8) | ((DECO_PORT(0x190)&0x0003)<<10) | ((DECO_PORT(0x190)&0x000c)<<6); |
| r2375 | r2376 | |
| 1304 | 1304 | |
| 1305 | 1305 | /*********************************************************************************/ |
| 1306 | 1306 | |
| 1307 | // case 0x582: return readinputport(0); /* IN0 */ | |
| 1308 | // case 0x672: return readinputport(1); /* IN1 */ | |
| 1307 | // case 0x582: return input_port_read_indexed(machine, 0); /* IN0 */ | |
| 1308 | // case 0x672: return input_port_read_indexed(machine, 1); /* IN1 */ | |
| 1309 | 1309 | // case 0x04c: return EEPROM_read_bit(); |
| 1310 | 1310 | |
| 1311 | 1311 | case 0x468: |
| r2375 | r2376 | |
| 1653 | 1653 | /* Special case inputs, because this is the only game with an eprom */ |
| 1654 | 1654 | switch (addr) |
| 1655 | 1655 | { |
| 1656 | case 0x582: return (readinputport(0)<<16) | 0xffff; /* IN0 */ | |
| 1657 | case 0x672: return (readinputport(1)<<16) | 0xffff; /* IN1 */ | |
| 1656 | case 0x582: return (input_port_read_indexed(machine, 0)<<16) | 0xffff; /* IN0 */ | |
| 1657 | case 0x672: return (input_port_read_indexed(machine, 1)<<16) | 0xffff; /* IN1 */ | |
| 1658 | 1658 | case 0x04c: return (EEPROM_read_bit()<<16) | 0xffff; |
| 1659 | 1659 | } |
| 1660 | 1660 |
| r2375 | r2376 | |
|---|---|---|
| 141 | 141 | |
| 142 | 142 | static READ8_HANDLER( zwackery_port_1_r ) |
| 143 | 143 | { |
| 144 | UINT8 ret = | |
| 144 | UINT8 ret = | |
| 145 | 145 | |
| 146 | 146 | pia_set_port_a_z_mask(3, ret); |
| 147 | 147 | |
| r2375 | r2376 | |
| 151 | 151 | |
| 152 | 152 | static READ8_HANDLER( zwackery_port_3_r ) |
| 153 | 153 | { |
| 154 | UINT8 ret = | |
| 154 | UINT8 ret = | |
| 155 | 155 | |
| 156 | 156 | pia_set_port_a_z_mask(4, ret); |
| 157 | 157 |
| r2375 | r2376 | |
|---|---|---|
| 22 | 22 | static int fd1094_cached_states[S16_NUMCACHE]; // array of cached state numbers |
| 23 | 23 | static int fd1094_current_cacheposition; // current position in cache array |
| 24 | 24 | |
| 25 | static int fd1094_state; | |
| 26 | static int fd1094_selected_state; | |
| 27 | ||
| 25 | 28 | /* this function checks the cache to see if the current state is cached, |
| 26 | 29 | if it is then it copies the cached data to the user region where code is |
| 27 | 30 | executed from, if its not cached then it gets decrypted to the current |
| r2375 | r2376 | |
| 31 | 34 | int i; |
| 32 | 35 | UINT32 addr; |
| 33 | 36 | |
| 37 | switch (state & 0x300) | |
| 38 | { | |
| 39 | case 0x000: | |
| 40 | case FD1094_STATE_RESET: | |
| 41 | fd1094_selected_state = state & 0xff; | |
| 42 | break; | |
| 43 | } | |
| 44 | ||
| 45 | fd1094_state = state; | |
| 46 | ||
| 34 | 47 | cpunum_set_info_int(1, CPUINFO_INT_REGISTER + M68K_PREF_ADDR, 0x0010); // force a flush of the prefetch cache |
| 35 | 48 | |
| 36 | 49 | /* set the s24_fd1094 state ready to decrypt.. */ |
| r2375 | r2376 | |
| 123 | 136 | cpunum_set_irq_callback(1, s24_fd1094_int_callback); |
| 124 | 137 | } |
| 125 | 138 | |
| 139 | static STATE_POSTLOAD( s24_fd1094_postload ) | |
| 140 | { | |
| 141 | if (fd1094_state != -1) | |
| 142 | { | |
| 143 | int selected_state = fd1094_selected_state; | |
| 144 | int state = fd1094_state; | |
| 145 | ||
| 146 | s24_fd1094_machine_init(); | |
| 147 | ||
| 148 | s24_fd1094_setstate_and_decrypt(selected_state); | |
| 149 | s24_fd1094_setstate_and_decrypt(state); | |
| 150 | } | |
| 151 | } | |
| 152 | ||
| 126 | 153 | /* startup function, to be called from DRIVER_INIT (once on startup) */ |
| 127 | 154 | void s24_fd1094_driver_init(void) |
| 128 | 155 | { |
| r2375 | r2376 | |
| 146 | 173 | fd1094_cached_states[i] = -1; |
| 147 | 174 | |
| 148 | 175 | fd1094_current_cacheposition = 0; |
| 176 | ||
| 177 | fd1094_state = -1; | |
| 178 | ||
| 179 | state_save_register_global(fd1094_selected_state); | |
| 180 | state_save_register_global(fd1094_state); | |
| 181 | state_save_register_postload(Machine, s24_fd1094_postload, NULL); | |
| 149 | 182 | } |
| r2375 | r2376 | |
|---|---|---|
| 132 | 132 | READ8_HANDLER( apache3_adc_r ) |
| 133 | 133 | { |
| 134 | 134 | if (apache3_adc==0) |
| 135 | return readinputport(1); | |
| 136 | return readinputport(2); | |
| 135 | return input_port_read_indexed(machine, 1); | |
| 136 | return input_port_read_indexed(machine, 2); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | WRITE8_HANDLER( apache3_adc_w ) |
| r2375 | r2376 | |
|---|---|---|
| 225 | 225 | static READ8_HANDLER( kingball_IN0_r ) |
| 226 | 226 | { |
| 227 | 227 | if (kingball_speech_dip) |
| 228 | return ( | |
| 228 | return ( | |
| 229 | 229 | else |
| 230 | return | |
| 230 | return | |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | static READ8_HANDLER( kingball_IN1_r ) |
| r2375 | r2376 | |
| 236 | 236 | that it's working, doesn't actually use return value, so we can just use |
| 237 | 237 | rand() */ |
| 238 | 238 | |
| 239 | return ( | |
| 239 | return ( | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | WRITE8_HANDLER( kingball_speech_dip_w ) |
| r2375 | r2376 | |
| 282 | 282 | |
| 283 | 283 | static READ8_HANDLER( azurian_IN1_r ) |
| 284 | 284 | { |
| 285 | return ( | |
| 285 | return ( | |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | static READ8_HANDLER( azurian_IN2_r ) |
| 289 | 289 | { |
| 290 | return ( | |
| 290 | return ( | |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
| r2375 | r2376 | |
| 300 | 300 | |
| 301 | 301 | READ8_HANDLER( _4in1_input_port_1_r ) |
| 302 | 302 | { |
| 303 | return ( | |
| 303 | return ( | |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | READ8_HANDLER( _4in1_input_port_2_r ) |
| 307 | 307 | { |
| 308 | return ( | |
| 308 | return ( | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | |
| r2375 | r2376 | |
| 320 | 320 | |
| 321 | 321 | READ8_HANDLER( gmgalax_input_port_0_r ) |
| 322 | 322 | { |
| 323 | return | |
| 323 | return | |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | READ8_HANDLER( gmgalax_input_port_1_r ) |
| 327 | 327 | { |
| 328 | return | |
| 328 | return | |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | READ8_HANDLER( gmgalax_input_port_2_r ) |
| 332 | 332 | { |
| 333 | return | |
| 333 | return | |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 |
| r2375 | r2376 | |
|---|---|---|
| 152 | 152 | |
| 153 | 153 | static READ8_HANDLER( strtheat_inputport_0_r ) |
| 154 | 154 | { |
| 155 | if( | |
| 155 | if( | |
| 156 | 156 | { |
| 157 | 157 | /* Joystick inputs */ |
| 158 | return | |
| 158 | return | |
| 159 | 159 | } |
| 160 | 160 | else |
| 161 | 161 | { |
| 162 | 162 | /* Steering Wheel inputs */ |
| 163 | return ( | |
| 163 | return ( | |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | static READ8_HANDLER( strtheat_inputport_1_r ) |
| 168 | 168 | { |
| 169 | if( | |
| 169 | if( | |
| 170 | 170 | { |
| 171 | 171 | /* Joystick inputs */ |
| 172 | return | |
| 172 | return | |
| 173 | 173 | } |
| 174 | 174 | else |
| 175 | 175 | { |
| 176 | 176 | /* Steering Wheel inputs */ |
| 177 | return ( | |
| 177 | return ( | |
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 |
| r2375 | r2376 | |
|---|---|---|
| 545 | 545 | VIDEO_UPDATE_CALL(itech8_2page); |
| 546 | 546 | |
| 547 | 547 | /* add the current X,Y positions to the list */ |
| 548 | xbuffer[ybuffer_next % YBUFFER_COUNT] = readinputportbytag_safe("FAKEX", 0); | |
| 549 | ybuffer[ybuffer_next % YBUFFER_COUNT] = readinputportbytag_safe("FAKEY", 0); | |
| 548 | xbuffer[ybuffer_next % YBUFFER_COUNT] = input_port_read_safe(screen->machine, "FAKEX", 0); | |
| 549 | ybuffer[ybuffer_next % YBUFFER_COUNT] = input_port_read_safe(screen->machine, "FAKEY", 0); | |
| 550 | 550 | ybuffer_next++; |
| 551 | 551 | |
| 552 | 552 | /* determine where to draw the starting point */ |
| r2375 | r2376 | |
|---|---|---|
| 350 | 350 | ..... |
| 351 | 351 | 0x8000 = SW1 #1 |
| 352 | 352 | */ |
| 353 | int temp = | |
| 353 | int temp = | |
| 354 | 354 | if (atarigen_get_hblank(machine->primary_screen)) temp ^= 0x0002; |
| 355 | 355 | temp ^= 0x0018; /* both EOCs always high for now */ |
| 356 | 356 | return temp; |
| r2375 | r2376 | |
| 359 | 359 | |
| 360 | 360 | READ16_HANDLER( hdc68k_port1_r ) |
| 361 | 361 | { |
| 362 | UINT16 result = | |
| 362 | UINT16 result = | |
| 363 | 363 | UINT16 diff = result ^ hdc68k_last_port1; |
| 364 | 364 | |
| 365 | 365 | /* if a new shifter position is selected, use it */ |
| r2375 | r2376 | |
| 387 | 387 | |
| 388 | 388 | READ16_HANDLER( hda68k_port1_r ) |
| 389 | 389 | { |
| 390 | UINT16 result = | |
| 390 | UINT16 result = | |
| 391 | 391 | |
| 392 | 392 | /* merge in the wheel edge latch bit */ |
| 393 | 393 | if (hdc68k_wheel_edge) |
| r2375 | r2376 | |
| 400 | 400 | READ16_HANDLER( hdc68k_wheel_r ) |
| 401 | 401 | { |
| 402 | 402 | /* grab the new wheel value and upconvert to 12 bits */ |
| 403 | UINT16 new_wheel = | |
| 403 | UINT16 new_wheel = | |
| 404 | 404 | |
| 405 | 405 | /* hack to display the wheel position */ |
| 406 | 406 | if (input_code_pressed(KEYCODE_LSHIFT)) |
| r2375 | r2376 | |
| 451 | 451 | if (adc_control & 0x08) |
| 452 | 452 | { |
| 453 | 453 | adc8_select = adc_control & 0x07; |
| 454 | adc8_data = | |
| 454 | adc8_data = | |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /* handle a write to the 12-bit ADC address select */ |
| 458 | 458 | if (adc_control & 0x40) |
| 459 | 459 | { |
| 460 | 460 | adc12_select = (adc_control >> 4) & 0x03; |
| 461 | adc12_data = | |
| 461 | adc12_data = | |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | /* bit 7 selects which byte of the 12 bit data to read */ |
| r2375 | r2376 | |
|---|---|---|
| 1535 | 1535 | psx_gpu_reset(); |
| 1536 | 1536 | } |
| 1537 | 1537 | |
| 1538 | static | |
| 1538 | static STATE_POSTLOAD( psx_postloa | |
| 1539 | 1539 | { |
| 1540 | 1540 | int n; |
| 1541 | 1541 | |
| r2375 | r2376 | |
| 1559 | 1559 | mdec_cos_precalc(); |
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | void psx_driver_init( | |
| 1562 | void psx_driver_init( running_machine *machine ) | |
| 1563 | 1563 | { |
| 1564 | 1564 | int n; |
| 1565 | 1565 | |
| r2375 | r2376 | |
| 1648 | 1648 | state_save_register_global_array( m_p_n_mdec_quantize_uv ); |
| 1649 | 1649 | state_save_register_global_array( m_p_n_mdec_cos ); |
| 1650 | 1650 | |
| 1651 | state_save_register_ | |
| 1651 | state_save_register_ | |
| 1652 | 1652 | } |
| r2375 | r2376 | |
|---|---|---|
| 20 | 20 | switch (offset<<1) |
| 21 | 21 | { |
| 22 | 22 | case 0: /* Player 1 & 2 joystick & buttons */ |
| 23 | return ( | |
| 23 | return ( | |
| 24 | 24 | |
| 25 | 25 | case 2: /* Credits, start buttons */ |
| 26 | return | |
| 26 | return | |
| 27 | 27 | |
| 28 | 28 | case 4: /* Byte 4: Dipswitch bank 2, Byte 5: Dipswitch Bank 1 */ |
| 29 | return ( | |
| 29 | return ( | |
| 30 | 30 | |
| 31 | 31 | case 8: /* Intel 8751 mc, Bad Dudes & Heavy Barrel only */ |
| 32 | 32 | //logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",activecpu_get_pc(),0x30c000+offset); |
| r2375 | r2376 | |
| 44 | 44 | switch (offset<<1) |
| 45 | 45 | { |
| 46 | 46 | case 0: /* Player 1 rotary */ |
| 47 | return ~(1 << ( | |
| 47 | return ~(1 << ( | |
| 48 | 48 | |
| 49 | 49 | case 8: /* Player 2 rotary */ |
| 50 | return ~(1 << ( | |
| 50 | return ~(1 << ( | |
| 51 | 51 | |
| 52 | 52 | default: |
| 53 | 53 | logerror("Unknown rotary read at 300000 %02x\n",offset); |
| r2375 | r2376 | |
| 63 | 63 | switch (offset<<1) |
| 64 | 64 | { |
| 65 | 65 | case 0: /* Player 1 Joystick + start, Player 2 Joystick + start */ |
| 66 | return ( | |
| 66 | return ( | |
| 67 | 67 | |
| 68 | 68 | case 2: /* Dipswitches */ |
| 69 | return ( | |
| 69 | return ( | |
| 70 | 70 | |
| 71 | 71 | case 4: /* Player 1 rotary */ |
| 72 | return ~(1 << ( | |
| 72 | return ~(1 << ( | |
| 73 | 73 | |
| 74 | 74 | case 6: /* Player 2 rotary */ |
| 75 | return ~(1 << ( | |
| 75 | return ~(1 << ( | |
| 76 | 76 | |
| 77 | 77 | case 8: /* Credits, start buttons */ |
| 78 | return | |
| 78 | return | |
| 79 | 79 | |
| 80 | 80 | case 12: |
| 81 | 81 | return 0; /* ?? watchdog ?? */ |
| r2375 | r2376 | |
| 92 | 92 | switch (offset<<1) |
| 93 | 93 | { |
| 94 | 94 | case 0: /* Dip Switches */ |
| 95 | return ( | |
| 95 | return ( | |
| 96 | 96 | |
| 97 | 97 | case 2: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 98 | return ( | |
| 98 | return ( | |
| 99 | 99 | |
| 100 | 100 | case 4: /* Credits */ |
| 101 | return | |
| 101 | return | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | logerror("Unknown control read at 30c000 %d\n",offset); |
| r2375 | r2376 | |
|---|---|---|
| 70 | 70 | switch (data & 0x03) |
| 71 | 71 | { |
| 72 | 72 | case 0: |
| 73 | pbus = input_port_ | |
| 73 | pbus = input_port_ | |
| 74 | 74 | break; |
| 75 | 75 | case 1: |
| 76 | pbus = input_port_ | |
| 76 | pbus = input_port_ | |
| 77 | 77 | break; |
| 78 | 78 | case 2: |
| 79 | pbus = input_port_ | |
| 79 | pbus = input_port_ | |
| 80 | 80 | break; |
| 81 | 81 | case 3: |
| 82 | 82 | pbus = 0xff; |
| r2375 | r2376 | |
|---|---|---|
| 181 | 181 | |
| 182 | 182 | READ8_HANDLER( lsasquad_mcu_status_r ) |
| 183 | 183 | { |
| 184 | int res = input_port_ | |
| 184 | int res = input_port_ | |
| 185 | 185 | |
| 186 | 186 | /* bit 0 = when 1, mcu is ready to receive data from main cpu */ |
| 187 | 187 | /* bit 1 = when 0, mcu has sent data to the main cpu */ |
| r2375 | r2376 | |
|---|---|---|
| 270 | 270 | 00207FE0 : may serves for relocating code (written as .l) |
| 271 | 271 | */ |
| 272 | 272 | |
| 273 | static void calc3_mcu_run( | |
| 273 | static void calc3_mcu_run(running_machine *machine); | |
| 274 | 274 | |
| 275 | 275 | static int calc3_mcu_status, calc3_mcu_command_offset; |
| 276 | 276 | |
| r2375 | r2376 | |
| 284 | 284 | WRITE16_HANDLER( calc3_mcu_ram_w ) |
| 285 | 285 | { |
| 286 | 286 | COMBINE_DATA(&kaneko16_mcu_ram[offset]); |
| 287 | calc3_mcu_run(); | |
| 287 | calc3_mcu_run(machine); | |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | #define CALC3_MCU_COM_W(_n_) \ |
| 291 | 291 | WRITE16_HANDLER( calc3_mcu_com##_n_##_w ) \ |
| 292 | 292 | { \ |
| 293 | 293 | calc3_mcu_status |= (1 << _n_); \ |
| 294 | calc3_mcu_run(); | |
| 294 | calc3_mcu_run(machine); | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | CALC3_MCU_COM_W(0) |
| r2375 | r2376 | |
| 312 | 312 | - Supply code snippets to the 68000 |
| 313 | 313 | */ |
| 314 | 314 | |
| 315 | static void calc3_mcu_run( | |
| 315 | static void calc3_mcu_run(running_machine *machine) | |
| 316 | 316 | { |
| 317 | 317 | UINT16 mcu_command; |
| 318 | 318 | |
| r2375 | r2376 | |
| 343 | 343 | |
| 344 | 344 | // execute the command: |
| 345 | 345 | |
| 346 | kaneko16_mcu_ram[param1 / 2] = ~ | |
| 346 | kaneko16_mcu_ram[param1 / 2] = ~ | |
| 347 | 347 | kaneko16_mcu_ram[param2 / 2] = 0xffff; // ? -1 / anything else |
| 348 | 348 | |
| 349 | 349 | calc3_mcu_command_offset = param3 / 2; // where next command will be written? |
| r2375 | r2376 | |
| 542 | 542 | TODO: look at this one since this remark is only driver-based. |
| 543 | 543 | */ |
| 544 | 544 | |
| 545 | void (*toybox_mcu_run)(void); /* One of the following */ | |
| 546 | void bloodwar_mcu_run(void); | |
| 547 | void bonkadv_mcu_run(void); | |
| 548 | void gtmr_mcu_run(void); | |
| 545 | void (*toybox_mcu_run)(running_machine *machine); /* One of the following */ | |
| 546 | void bloodwar_mcu_run(running_machine *machine); | |
| 547 | void bonkadv_mcu_run(running_machine *machine); | |
| 548 | void gtmr_mcu_run(running_machine *machine); | |
| 549 | 549 | |
| 550 | 550 | static UINT16 toybox_mcu_com[4]; |
| 551 | 551 | |
| r2375 | r2376 | |
| 564 | 564 | if (toybox_mcu_com[3] != 0xFFFF) return; \ |
| 565 | 565 | \ |
| 566 | 566 | memset(toybox_mcu_com, 0, 4 * sizeof( UINT16 ) ); \ |
| 567 | toybox_mcu_run(); | |
| 567 | toybox_mcu_run(machine); | |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | TOYBOX_MCU_COM_W(0) |
| r2375 | r2376 | |
| 586 | 586 | Blood Warrior |
| 587 | 587 | ***************************************************************************/ |
| 588 | 588 | |
| 589 | void bloodwar_mcu_run( | |
| 589 | void bloodwar_mcu_run(running_machine *machine) | |
| 590 | 590 | { |
| 591 | 591 | UINT16 mcu_command = kaneko16_mcu_ram[0x0010/2]; |
| 592 | 592 | UINT16 mcu_offset = kaneko16_mcu_ram[0x0012/2] / 2; |
| r2375 | r2376 | |
| 620 | 620 | |
| 621 | 621 | case 0x03: // DSW |
| 622 | 622 | { |
| 623 | kaneko16_mcu_ram[mcu_offset] = | |
| 623 | kaneko16_mcu_ram[mcu_offset] = | |
| 624 | 624 | logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n", activecpu_get_pc(), mcu_command, mcu_offset*2); |
| 625 | 625 | } |
| 626 | 626 | break; |
| r2375 | r2376 | |
| 700 | 700 | Bonk's Adventure |
| 701 | 701 | ***************************************************************************/ |
| 702 | 702 | |
| 703 | void bonkadv_mcu_run( | |
| 703 | void bonkadv_mcu_run(running_machine *machine) | |
| 704 | 704 | { |
| 705 | 705 | UINT16 mcu_command = kaneko16_mcu_ram[0x0010/2]; |
| 706 | 706 | UINT16 mcu_offset = kaneko16_mcu_ram[0x0012/2] / 2; |
| r2375 | r2376 | |
| 747 | 747 | |
| 748 | 748 | case 0x03: // DSW |
| 749 | 749 | { |
| 750 | kaneko16_mcu_ram[mcu_offset] = | |
| 750 | kaneko16_mcu_ram[mcu_offset] = | |
| 751 | 751 | logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n", activecpu_get_pc(), mcu_command, mcu_offset*2); |
| 752 | 752 | } |
| 753 | 753 | break; |
| r2375 | r2376 | |
| 820 | 820 | - Read the DSWs |
| 821 | 821 | */ |
| 822 | 822 | |
| 823 | void gtmr_mcu_run( | |
| 823 | void gtmr_mcu_run(running_machine *machine) | |
| 824 | 824 | { |
| 825 | 825 | UINT16 mcu_command = kaneko16_mcu_ram[0x0010/2]; |
| 826 | 826 | UINT16 mcu_offset = kaneko16_mcu_ram[0x0012/2] / 2; |
| r2375 | r2376 | |
| 855 | 855 | |
| 856 | 856 | case 0x03: // DSW |
| 857 | 857 | { |
| 858 | kaneko16_mcu_ram[mcu_offset] = | |
| 858 | kaneko16_mcu_ram[mcu_offset] = | |
| 859 | 859 | } |
| 860 | 860 | break; |
| 861 | 861 |
| r2375 | r2376 | |
|---|---|---|
| 433 | 433 | * |
| 434 | 434 | *************************************/ |
| 435 | 435 | |
| 436 | static | |
| 436 | static STATE_POSTLOAD( williams2_postload | |
| 437 | 437 | { |
| 438 | williams2_bank_select_w( | |
| 438 | williams2_bank_select_w(machine, 0, vram_bank); | |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | |
| r2375 | r2376 | |
| 460 | 460 | timer_adjust_oneshot(scan254_timer, video_screen_get_time_until_pos(machine->primary_screen, 254, 0), 0); |
| 461 | 461 | |
| 462 | 462 | state_save_register_global(vram_bank); |
| 463 | state_save_register_ | |
| 463 | state_save_register_ | |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | |
| r2375 | r2376 | |
| 568 | 568 | |
| 569 | 569 | READ8_HANDLER( williams_input_port_0_3_r ) |
| 570 | 570 | { |
| 571 | return | |
| 571 | return | |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | |
| 575 | 575 | READ8_HANDLER( williams_input_port_1_4_r ) |
| 576 | 576 | { |
| 577 | return | |
| 577 | return | |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | |
| r2375 | r2376 | |
| 606 | 606 | READ8_HANDLER( williams_49way_port_0_r ) |
| 607 | 607 | { |
| 608 | 608 | static const UINT8 translate49[7] = { 0x0, 0x4, 0x6, 0x7, 0xb, 0x9, 0x8 }; |
| 609 | return (translate49[ | |
| 609 | return (translate49[ | |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | |
| r2375 | r2376 | |
| 615 | 615 | if (port_select) |
| 616 | 616 | return williams_49way_port_0_r(machine,0); |
| 617 | 617 | else |
| 618 | return | |
| 618 | return | |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | |
| r2375 | r2376 | |
| 711 | 711 | * |
| 712 | 712 | *************************************/ |
| 713 | 713 | |
| 714 | static | |
| 714 | static STATE_POSTLOAD( defender_postload | |
| 715 | 715 | { |
| 716 | defender_bank_select_w( | |
| 716 | defender_bank_select_w(machine, 0, vram_bank); | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | |
| r2375 | r2376 | |
| 725 | 725 | memory_configure_bank(1, 0, 9, &memory_region(REGION_CPU1)[0x10000], 0x1000); |
| 726 | 726 | defender_bank_select_w(machine, 0, 0); |
| 727 | 727 | |
| 728 | state_save_register_ | |
| 728 | state_save_register_ | |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 |
| r2375 | r2376 | |
|---|---|---|
| 125 | 125 | { |
| 126 | 126 | switch (offset) |
| 127 | 127 | { |
| 128 | case 0x00: return readinputportbytag("IN0"); /* Player 1 controls + START1 */ | |
| 129 | case 0x01: return readinputportbytag("IN1"); /* Player 2 controls + START2 */ | |
| 130 | case 0x02: return readinputportbytag("IN2"); /* COINn + SERVICE1 + TILT */ | |
| 128 | case 0x00: return input_port_read(machine, "IN0"); /* Player 1 controls + START1 */ | |
| 129 | case 0x01: return input_port_read(machine, "IN1"); /* Player 2 controls + START2 */ | |
| 130 | case 0x02: return input_port_read(machine, "IN2"); /* COINn + SERVICE1 + TILT */ | |
| 131 | 131 | case 0x03: return cc_port; |
| 132 | 132 | } |
| 133 | 133 | } |
| r2375 | r2376 | |
|---|---|---|
| 117 | 117 | READ16_HANDLER (PSTARS_protram_r) |
| 118 | 118 | { |
| 119 | 119 | if (offset == 4) //region |
| 120 | return | |
| 120 | return | |
| 121 | 121 | else if (offset >= 0x10) //timer |
| 122 | 122 | { |
| 123 | 123 | logerror("PSTARS ACCESS COUNTER %6X\n",pstar_ram[offset-0x10]); |
| r2375 | r2376 | |
| 314 | 314 | return (v & (1<<bit)) != 0; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | static void asic3_compute_hold( | |
| 317 | static void asic3_compute_hold(running_machine *machine) | |
| 318 | 318 | { |
| 319 | 319 | // The mode is dependant on the region |
| 320 | 320 | static const int modes[4] = { 1, 1, 3, 2 }; |
| 321 | int mode = modes[ | |
| 321 | int mode = modes[ | |
| 322 | 322 | |
| 323 | 323 | switch(mode) { |
| 324 | 324 | case 1: |
| r2375 | r2376 | |
| 354 | 354 | /* region is supplied by the protection device */ |
| 355 | 355 | |
| 356 | 356 | switch(asic3_reg) { |
| 357 | case 0x00: res = (asic3_latch[0] & 0xf7) | (( | |
| 357 | case 0x00: res = (asic3_latch[0] & 0xf7) | (( | |
| 358 | 358 | case 0x01: res = asic3_latch[1]; break; |
| 359 | case 0x02: res = (asic3_latch[2] & 0x7f) | (( | |
| 359 | case 0x02: res = (asic3_latch[2] & 0x7f) | (( | |
| 360 | 360 | case 0x03: |
| 361 | 361 | res = (bt(asic3_hold, 15) << 0) |
| 362 | 362 | | (bt(asic3_hold, 12) << 1) |
| r2375 | r2376 | |
| 414 | 414 | } else if(asic3_reg >= 0x80 && asic3_reg <= 0x87) { |
| 415 | 415 | asic3_y = asic3_reg & 7; |
| 416 | 416 | asic3_z = data; |
| 417 | asic3_compute_hold(); | |
| 417 | asic3_compute_hold(machine); | |
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | } |
| r2375 | r2376 | |
| 462 | 462 | // 4 = hong kong |
| 463 | 463 | // 5 = world |
| 464 | 464 | |
| 465 | if (offset == 4) return | |
| 465 | if (offset == 4) return | |
| 466 | 466 | |
| 467 | 467 | // otherwise it doesn't seem to use the ram for anything important, we return 0 to avoid test mode corruption |
| 468 | 468 | // kovplus reads from offset 000e a lot ... why? |
| r2375 | r2376 | |
|---|---|---|
| 532 | 532 | static TIMER_CALLBACK( cchip_timer ) |
| 533 | 533 | { |
| 534 | 534 | // Update input ports, these are used by both the 68k directly and by the c-chip |
| 535 | cchip_ram[0x4]=readinputportbytag("IN0"); | |
| 536 | cchip_ram[0x5]=readinputportbytag("IN1"); | |
| 535 | cchip_ram[0x4]=input_port_read(machine, "IN0"); | |
| 536 | cchip_ram[0x5]=input_port_read(machine, "IN1"); | |
| 537 | 537 | |
| 538 | 538 | // Coin slots |
| 539 | 539 | if (cchip_ram[0x4]!=cchip_last_04) |
| r2375 | r2376 | |
|---|---|---|
| 129 | 129 | |
| 130 | 130 | READ8_HANDLER( starwars_input_1_r ) |
| 131 | 131 | { |
| 132 | int x = | |
| 132 | int x = | |
| 133 | 133 | |
| 134 | 134 | /* set the matrix processor flag */ |
| 135 | 135 | if (math_run) |
| r2375 | r2376 | |
| 158 | 158 | { |
| 159 | 159 | /* pitch */ |
| 160 | 160 | if (control_num == kPitch) |
| 161 | return | |
| 161 | return | |
| 162 | 162 | |
| 163 | 163 | /* yaw */ |
| 164 | 164 | else if (control_num == kYaw) |
| 165 | return | |
| 165 | return | |
| 166 | 166 | |
| 167 | 167 | /* default to unused thrust */ |
| 168 | 168 | else |
| r2375 | r2376 | |
|---|---|---|
| 381 | 381 | switch (nb1413m3_type) |
| 382 | 382 | { |
| 383 | 383 | case NB1413M3_PASTELG: |
| 384 | return ((input_port_ | |
| 384 | return ((input_port_ | |
| 385 | 385 | case NB1413M3_TAIWANMB: |
| 386 | return ((input_port_ | |
| 386 | return ((input_port_ | |
| 387 | 387 | case NB1413M3_HYHOO: |
| 388 | 388 | case NB1413M3_HYHOO2: |
| 389 | return ((input_port_ | |
| 389 | return ((input_port_ | |
| 390 | 390 | default: |
| 391 | return ((input_port_ | |
| 391 | return ((input_port_ | |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | |
| r2375 | r2376 | |
| 401 | 401 | case NB1413M3_TAIWANMB: |
| 402 | 402 | switch ((nb1413m3_inputport ^ 0xff) & 0x1f) |
| 403 | 403 | { |
| 404 | case 0x01: return readinputport(4); | |
| 405 | case 0x02: return readinputport(5); | |
| 406 | case 0x04: return readinputport(6); | |
| 407 | case 0x08: return readinputport(7); | |
| 408 | case 0x10: return readinputport(8); | |
| 409 | default: return (readinputport(4) & readinputport(5) & readinputport(6) & readinputport(7) & readinputport(8)); | |
| 404 | case 0x01: return input_port_read_indexed(machine, 4); | |
| 405 | case 0x02: return input_port_read_indexed(machine, 5); | |
| 406 | case 0x04: return input_port_read_indexed(machine, 6); | |
| 407 | case 0x08: return input_port_read_indexed(machine, 7); | |
| 408 | case 0x10: return input_port_read_indexed(machine, 8); | |
| 409 | default: return (input_port_read_indexed(machine, 4) & input_port_read_indexed(machine, 5) & input_port_read_indexed(machine, 6) & input_port_read_indexed(machine, 7) & input_port_read_indexed(machine, 8)); | |
| 410 | 410 | } |
| 411 | 411 | break; |
| 412 | 412 | case NB1413M3_HYHOO: |
| 413 | 413 | case NB1413M3_HYHOO2: |
| 414 | 414 | switch ((nb1413m3_inputport ^ 0xff) & 0x07) |
| 415 | 415 | { |
| 416 | case 0x01: return readinputport(3); | |
| 417 | case 0x02: return readinputport(4); | |
| 416 | case 0x01: return input_port_read_indexed(machine, 3); | |
| 417 | case 0x02: return input_port_read_indexed(machine, 4); | |
| 418 | 418 | case 0x04: return 0xff; |
| 419 | 419 | default: return 0xff; |
| 420 | 420 | } |
| 421 | 421 | break; |
| 422 | 422 | case NB1413M3_MSJIKEN: |
| 423 | 423 | case NB1413M3_TELMAHJN: |
| 424 | if ( | |
| 424 | if ( | |
| 425 | 425 | { |
| 426 | 426 | switch ((nb1413m3_inputport ^ 0xff) & 0x1f) |
| 427 | 427 | { |
| 428 | case 0x01: return readinputport(3); | |
| 429 | case 0x02: return readinputport(4); | |
| 430 | case 0x04: return readinputport(5); | |
| 431 | case 0x08: return readinputport(6); | |
| 432 | case 0x10: return readinputport(7); | |
| 433 | default: return (readinputport(3) & readinputport(4) & readinputport(5) & readinputport(6) & readinputport(7)); | |
| 428 | case 0x01: return input_port_read_indexed(machine, 3); | |
| 429 | case 0x02: return input_port_read_indexed(machine, 4); | |
| 430 | case 0x04: return input_port_read_indexed(machine, 5); | |
| 431 | case 0x08: return input_port_read_indexed(machine, 6); | |
| 432 | case 0x10: return input_port_read_indexed(machine, 7); | |
| 433 | default: return (input_port_read_indexed(machine, 3) & input_port_read_indexed(machine, 4) & input_port_read_indexed(machine, 5) & input_port_read_indexed(machine, 6) & input_port_read_indexed(machine, 7)); | |
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | else return | |
| 436 | else return | |
| 437 | 437 | break; |
| 438 | 438 | case NB1413M3_PAIRSNB: |
| 439 | 439 | case NB1413M3_PAIRSTEN: |
| 440 | return | |
| 440 | return | |
| 441 | 441 | break; |
| 442 | 442 | default: |
| 443 | 443 | switch ((nb1413m3_inputport ^ 0xff) & 0x1f) |
| 444 | 444 | { |
| 445 | case 0x01: return readinputport(3); | |
| 446 | case 0x02: return readinputport(4); | |
| 447 | case 0x04: return readinputport(5); | |
| 448 | case 0x08: return readinputport(6); | |
| 449 | case 0x10: return readinputport(7); | |
| 450 | default: return (readinputport(3) & readinputport(4) & readinputport(5) & readinputport(6) & readinputport(7)); | |
| 445 | case 0x01: return input_port_read_indexed(machine, 3); | |
| 446 | case 0x02: return input_port_read_indexed(machine, 4); | |
| 447 | case 0x04: return input_port_read_indexed(machine, 5); | |
| 448 | case 0x08: return input_port_read_indexed(machine, 6); | |
| 449 | case 0x10: return input_port_read_indexed(machine, 7); | |
| 450 | default: return (input_port_read_indexed(machine, 3) & input_port_read_indexed(machine, 4) & input_port_read_indexed(machine, 5) & input_port_read_indexed(machine, 6) & input_port_read_indexed(machine, 7)); | |
| 451 | 451 | } |
| 452 | 452 | break; |
| 453 | 453 | } |
| r2375 | r2376 | |
| 462 | 462 | case NB1413M3_TAIWANMB: |
| 463 | 463 | switch ((nb1413m3_inputport ^ 0xff) & 0x1f) |
| 464 | 464 | { |
| 465 | case 0x01: return readinputport(9); | |
| 466 | case 0x02: return readinputport(10); | |
| 467 | case 0x04: return readinputport(11); | |
| 468 | case 0x08: return readinputport(12); | |
| 469 | case 0x10: return readinputport(13); | |
| 470 | default: return (readinputport(9) & readinputport(10) & readinputport(11) & readinputport(12) & readinputport(13)); | |
| 465 | case 0x01: return input_port_read_indexed(machine, 9); | |
| 466 | case 0x02: return input_port_read_indexed(machine, 10); | |
| 467 | case 0x04: return input_port_read_indexed(machine, 11); | |
| 468 | case 0x08: return input_port_read_indexed(machine, 12); | |
| 469 | case 0x10: return input_port_read_indexed(machine, 13); | |
| 470 | default: return (input_port_read_indexed(machine, 9) & input_port_read_indexed(machine, 10) & input_port_read_indexed(machine, 11) & input_port_read_indexed(machine, 12) & input_port_read_indexed(machine, 13)); | |
| 471 | 471 | } |
| 472 | 472 | break; |
| 473 | 473 | case NB1413M3_HYHOO: |
| r2375 | r2376 | |
| 476 | 476 | { |
| 477 | 477 | case 0x01: return 0xff; |
| 478 | 478 | case 0x02: return 0xff; |
| 479 | case 0x04: return | |
| 479 | case 0x04: return | |
| 480 | 480 | default: return 0xff; |
| 481 | 481 | } |
| 482 | 482 | break; |
| 483 | 483 | case NB1413M3_MSJIKEN: |
| 484 | 484 | case NB1413M3_TELMAHJN: |
| 485 | if ( | |
| 485 | if ( | |
| 486 | 486 | { |
| 487 | 487 | switch ((nb1413m3_inputport ^ 0xff) & 0x1f) |
| 488 | 488 | { |
| 489 | case 0x01: return readinputport(8); | |
| 490 | case 0x02: return readinputport(9); | |
| 491 | case 0x04: return readinputport(10); | |
| 492 | case 0x08: return readinputport(11); | |
| 493 | case 0x10: return readinputport(12); | |
| 494 | default: return (readinputport(8) & readinputport(9) & readinputport(10) & readinputport(11) & readinputport(12)); | |
| 489 | case 0x01: return input_port_read_indexed(machine, 8); | |
| 490 | case 0x02: return input_port_read_indexed(machine, 9); | |
| 491 | case 0x04: return input_port_read_indexed(machine, 10); | |
| 492 | case 0x08: return input_port_read_indexed(machine, 11); | |
| 493 | case 0x10: return input_port_read_indexed(machine, 12); | |
| 494 | default: return (input_port_read_indexed(machine, 8) & input_port_read_indexed(machine, 9) & input_port_read_indexed(machine, 10) & input_port_read_indexed(machine, 11) & input_port_read_indexed(machine, 12)); | |
| 495 | 495 | } |
| 496 | 496 | } |
| 497 | else return | |
| 497 | else return | |
| 498 | 498 | break; |
| 499 | 499 | case NB1413M3_PAIRSNB: |
| 500 | 500 | case NB1413M3_PAIRSTEN: |
| 501 | return | |
| 501 | return | |
| 502 | 502 | break; |
| 503 | 503 | default: |
| 504 | 504 | switch ((nb1413m3_inputport ^ 0xff) & 0x1f) |
| 505 | 505 | { |
| 506 | case 0x01: return readinputport(8); | |
| 507 | case 0x02: return readinputport(9); | |
| 508 | case 0x04: return readinputport(10); | |
| 509 | case 0x08: return readinputport(11); | |
| 510 | case 0x10: return readinputport(12); | |
| 511 | default: return (readinputport(8) & readinputport(9) & readinputport(10) & readinputport(11) & readinputport(12)); | |
| 506 | case 0x01: return input_port_read_indexed(machine, 8); | |
| 507 | case 0x02: return input_port_read_indexed(machine, 9); | |
| 508 | case 0x04: return input_port_read_indexed(machine, 10); | |
| 509 | case 0x08: return input_port_read_indexed(machine, 11); | |
| 510 | case 0x10: return input_port_read_indexed(machine, 12); | |
| 511 | default: return (input_port_read_indexed(machine, 8) & input_port_read_indexed(machine, 9) & input_port_read_indexed(machine, 10) & input_port_read_indexed(machine, 11) & input_port_read_indexed(machine, 12)); | |
| 512 | 512 | } |
| 513 | 513 | break; |
| 514 | 514 | } |
| r2375 | r2376 | |
| 537 | 537 | case NB1413M3_MAIKO: |
| 538 | 538 | case NB1413M3_MMAIKO: |
| 539 | 539 | case NB1413M3_HANAOJI: |
| 540 | return ((input_port_ | |
| 540 | return ((input_port_ | |
| 541 | 541 | break; |
| 542 | 542 | default: |
| 543 | 543 | return 0xff; |
| r2375 | r2376 | |
| 551 | 551 | { |
| 552 | 552 | case NB1413M3_KANATUEN: |
| 553 | 553 | case NB1413M3_KYUHITO: |
| 554 | return | |
| 554 | return | |
| 555 | 555 | break; |
| 556 | 556 | case NB1413M3_TAIWANMB: |
| 557 | return (( | |
| 557 | return (( | |
| 558 | 558 | break; |
| 559 | 559 | case NB1413M3_OTONANO: |
| 560 | 560 | case NB1413M3_MJCAMERA: |
| 561 | 561 | case NB1413M3_IDHIMITU: |
| 562 | 562 | case NB1413M3_KAGUYA2: |
| 563 | return ((( | |
| 563 | return ((( | |
| 564 | 564 | break; |
| 565 | 565 | case NB1413M3_SCANDAL: |
| 566 | 566 | case NB1413M3_SCANDALM: |
| r2375 | r2376 | |
| 572 | 572 | case NB1413M3_UCHUUAI: |
| 573 | 573 | case NB1413M3_TOKIMBSJ: |
| 574 | 574 | case NB1413M3_TOKYOGAL: |
| 575 | return (( | |
| 575 | return (( | |
| 576 | 576 | break; |
| 577 | 577 | case NB1413M3_TRIPLEW1: |
| 578 | 578 | case NB1413M3_NTOPSTAR: |
| r2375 | r2376 | |
| 583 | 583 | case NB1413M3_MJLSTORY: |
| 584 | 584 | case NB1413M3_QMHAYAKU: |
| 585 | 585 | case NB1413M3_MJGOTTUB: |
| 586 | return (((readinputport(1) & 0x01) >> 0) | ((readinputport(1) & 0x04) >> 1) | | |
| 587 | ((readinputport(1) & 0x10) >> 2) | ((readinputport(1) & 0x40) >> 3) | | |
| 588 | ((readinputport(0) & 0x01) << 4) | ((readinputport(0) & 0x04) << 3) | | |
| 589 | ((readinputport(0) & 0x10) << 2) | ((readinputport(0) & 0x40) << 1)); | |
| 586 | return (((input_port_read_indexed(machine, 1) & 0x01) >> 0) | ((input_port_read_indexed(machine, 1) & 0x04) >> 1) | | |
| 587 | ((input_port_read_indexed(machine, 1) & 0x10) >> 2) | ((input_port_read_indexed(machine, 1) & 0x40) >> 3) | | |
| 588 | ((input_port_read_indexed(machine, 0) & 0x01) << 4) | ((input_port_read_indexed(machine, 0) & 0x04) << 3) | | |
| 589 | ((input_port_read_indexed(machine, 0) & 0x10) << 2) | ((input_port_read_indexed(machine, 0) & 0x40) << 1)); | |
| 590 | 590 | break; |
| 591 | 591 | default: |
| 592 | return | |
| 592 | return | |
| 593 | 593 | break; |
| 594 | 594 | } |
| 595 | 595 | } |
| r2375 | r2376 | |
| 600 | 600 | { |
| 601 | 601 | case NB1413M3_KANATUEN: |
| 602 | 602 | case NB1413M3_KYUHITO: |
| 603 | return | |
| 603 | return | |
| 604 | 604 | break; |
| 605 | 605 | case NB1413M3_TAIWANMB: |
| 606 | return ((( | |
| 606 | return ((( | |
| 607 | 607 | break; |
| 608 | 608 | case NB1413M3_OTONANO: |
| 609 | 609 | case NB1413M3_MJCAMERA: |
| 610 | 610 | case NB1413M3_IDHIMITU: |
| 611 | 611 | case NB1413M3_KAGUYA2: |
| 612 | return (( | |
| 612 | return (( | |
| 613 | 613 | break; |
| 614 | 614 | case NB1413M3_SCANDAL: |
| 615 | 615 | case NB1413M3_SCANDALM: |
| r2375 | r2376 | |
| 621 | 621 | case NB1413M3_UCHUUAI: |
| 622 | 622 | case NB1413M3_TOKIMBSJ: |
| 623 | 623 | case NB1413M3_TOKYOGAL: |
| 624 | return ((( | |
| 624 | return ((( | |
| 625 | 625 | break; |
| 626 | 626 | case NB1413M3_TRIPLEW1: |
| 627 | 627 | case NB1413M3_NTOPSTAR: |
| r2375 | r2376 | |
| 632 | 632 | case NB1413M3_MJLSTORY: |
| 633 | 633 | case NB1413M3_QMHAYAKU: |
| 634 | 634 | case NB1413M3_MJGOTTUB: |
| 635 | return (((readinputport(1) & 0x02) >> 1) | ((readinputport(1) & 0x08) >> 2) | | |
| 636 | ((readinputport(1) & 0x20) >> 3) | ((readinputport(1) & 0x80) >> 4) | | |
| 637 | ((readinputport(0) & 0x02) << 3) | ((readinputport(0) & 0x08) << 2) | | |
| 638 | ((readinputport(0) & 0x20) << 1) | ((readinputport(0) & 0x80) << 0)); | |
| 635 | return (((input_port_read_indexed(machine, 1) & 0x02) >> 1) | ((input_port_read_indexed(machine, 1) & 0x08) >> 2) | | |
| 636 | ((input_port_read_indexed(machine, 1) & 0x20) >> 3) | ((input_port_read_indexed(machine, 1) & 0x80) >> 4) | | |
| 637 | ((input_port_read_indexed(machine, 0) & 0x02) << 3) | ((input_port_read_indexed(machine, 0) & 0x08) << 2) | | |
| 638 | ((input_port_read_indexed(machine, 0) & 0x20) << 1) | ((input_port_read_indexed(machine, 0) & 0x80) << 0)); | |
| 639 | 639 | break; |
| 640 | 640 | default: |
| 641 | return | |
| 641 | return | |
| 642 | 642 | break; |
| 643 | 643 | } |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | READ8_HANDLER( nb1413m3_dipsw3_l_r ) |
| 647 | 647 | { |
| 648 | return (( | |
| 648 | return (( | |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | READ8_HANDLER( nb1413m3_dipsw3_h_r ) |
| 652 | 652 | { |
| 653 | return (( | |
| 653 | return (( | |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | WRITE8_HANDLER( nb1413m3_outcoin_w ) |
| r2375 | r2376 | |
|---|---|---|
| 161 | 161 | int new_x,new_y; |
| 162 | 162 | |
| 163 | 163 | /* Read player 1 trackball */ |
| 164 | new_x = | |
| 164 | new_x = | |
| 165 | 165 | if (new_x != counter_x) |
| 166 | 166 | { |
| 167 | 167 | sign_x_1 = (new_x - counter_x) & 0x80; |
| 168 | 168 | counter_x = new_x; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | new_y = | |
| 171 | new_y = | |
| 172 | 172 | if (new_y != counter_y) |
| 173 | 173 | { |
| 174 | 174 | sign_y_1 = (new_y - counter_y) & 0x80; |
| r2375 | r2376 | |
| 192 | 192 | int new_x,new_y; |
| 193 | 193 | |
| 194 | 194 | /* Read player 2 trackball */ |
| 195 | new_x = | |
| 195 | new_x = | |
| 196 | 196 | if (new_x != counter_x) |
| 197 | 197 | { |
| 198 | 198 | sign_x_2 = (new_x - counter_x) & 0x80; |
| 199 | 199 | counter_x = new_x; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | new_y = | |
| 202 | new_y = | |
| 203 | 203 | if (new_y != counter_y) |
| 204 | 204 | { |
| 205 | 205 | sign_y_2 = (new_y - counter_y) & 0x80; |
| r2375 | r2376 | |
| 234 | 234 | int new_x,new_y; |
| 235 | 235 | |
| 236 | 236 | /* Read player 1 trackball */ |
| 237 | new_x = | |
| 237 | new_x = | |
| 238 | 238 | if (new_x != counter_x) |
| 239 | 239 | { |
| 240 | 240 | sign_x_1 = (new_x - counter_x) & 0x80; |
| 241 | 241 | counter_x = new_x; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | new_y = | |
| 244 | new_y = | |
| 245 | 245 | if (new_y != counter_y) |
| 246 | 246 | { |
| 247 | 247 | sign_y_1 = (new_y - counter_y) & 0x80; |
| r2375 | r2376 | |
| 257 | 257 | int new_x,new_y; |
| 258 | 258 | |
| 259 | 259 | /* Read player 2 trackball */ |
| 260 | new_x = | |
| 260 | new_x = | |
| 261 | 261 | if (new_x != counter_x) |
| 262 | 262 | { |
| 263 | 263 | sign_x_2 = (new_x - counter_x) & 0x80; |
| 264 | 264 | counter_x = new_x; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | new_y = | |
| 267 | new_y = | |
| 268 | 268 | if (new_y != counter_y) |
| 269 | 269 | { |
| 270 | 270 | sign_y_2 = (new_y - counter_y) & 0x80; |
| r2375 | r2376 | |
| 291 | 291 | int new_x,new_y; |
| 292 | 292 | |
| 293 | 293 | /* Read player 3 trackball */ |
| 294 | new_x = | |
| 294 | new_x = | |
| 295 | 295 | if (new_x != counter_x) |
| 296 | 296 | { |
| 297 | 297 | sign_x_3 = (new_x - counter_x) & 0x80; |
| 298 | 298 | counter_x = new_x; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | new_y = | |
| 301 | new_y = | |
| 302 | 302 | if (new_y != counter_y) |
| 303 | 303 | { |
| 304 | 304 | sign_y_3 = (new_y - counter_y) & 0x80; |
| r2375 | r2376 | |
| 314 | 314 | int new_x,new_y; |
| 315 | 315 | |
| 316 | 316 | /* Read player 4 trackball */ |
| 317 | new_x = | |
| 317 | new_x = | |
| 318 | 318 | if (new_x != counter_x) |
| 319 | 319 | { |
| 320 | 320 | sign_x_4 = (new_x - counter_x) & 0x80; |
| 321 | 321 | counter_x = new_x; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | new_y = | |
| 324 | new_y = | |
| 325 | 325 | if (new_y != counter_y) |
| 326 | 326 | { |
| 327 | 327 | sign_y_4 = (new_y - counter_y) & 0x80; |
| r2375 | r2376 | |
|---|---|---|
| 57 | 57 | |
| 58 | 58 | res |= 0x20;//konami_eeprom_ack() << 5; /* add the ack */ |
| 59 | 59 | |
| 60 | res |= | |
| 60 | res |= | |
| 61 | 61 | |
| 62 | 62 | if (init_eeprom_count) |
| 63 | 63 | { |
| r2375 | r2376 | |
|---|---|---|
| 75 | 75 | int this_val; |
| 76 | 76 | int delta; |
| 77 | 77 | |
| 78 | this_val=input_port_ | |
| 78 | this_val=input_port_ | |
| 79 | 79 | |
| 80 | 80 | delta=this_val-last_val; |
| 81 | 81 | last_val=this_val; |
| r0 | r2376 | |
|---|---|---|
| 1 | ||
| 2 | /* Seibu 'COP' (co-processor) protection | |
| 3 | ||
| 4 | there appear to be 3 revisions of this protection (based on the external rom) | |
| 5 | ||
| 6 | COPX-D1 - Seibu Cup Soccer / Olympic Soccer '92 | |
| 7 | - Legionnaire | |
| 8 | COPX-D2 - Heated Barrel | |
| 9 | - Godzilla | |
| 10 | - SD Gundam Sangokushi Rainbow Tairiku Senki | |
| 11 | - Denjin Makai | |
| 12 | - Raiden 2 | |
| 13 | - Raiden DX | |
| 14 | - Zero Team | |
| 15 | COPX-D3 - Raiden 2/DX New (V33 PCB version) | |
| 16 | - New Zero Team | |
| 17 | ||
| 18 | COPX / COPX-D2 based games appear to function in a similar way to each other | |
| 19 | while the games using COPX-D3 appears to access the protection device very | |
| 20 | differently to the others. | |
| 21 | ||
| 22 | As this is only the external rom it isn't confirmed that the actual protection | |
| 23 | devices are identical even where the external rom matches. | |
| 24 | ||
| 25 | Protection features include BCD math protection, 'command sequences', DMA. | |
| 26 | memory clearing etc. | |
| 27 | ||
| 28 | it is not confirmed which custom Seibu chip contains the actual co-processor, | |
| 29 | nor if the co-processor is a real MCU with internal code, or a custom designed | |
| 30 | 'blitter' like device. | |
| 31 | ||
| 32 | I suspect that for the earlier games it's part of the COP300 or COP1000 chips, | |
| 33 | for the COPX-D3 based games it's probably inside the system controller SEI333 | |
| 34 | ||
| 35 | the external COP rom is probably used as a lookup for maths operations. | |
| 36 | ||
| 37 | there should probably only be a single cop2_r / cop2_w function, the chip | |
| 38 | looks to be configurable via the table uploaded to | |
| 39 | 0x432 / 0x434 / 0x438 / 0x43a / 0x43c, with 'macro' commands triggered via | |
| 40 | writes to 0x500. | |
| 41 | ||
| 42 | this simulation is incomplete | |
| 43 | ||
| 44 | to do: | |
| 45 | clean it up, consolidate code, make it work! | |
| 46 | ||
| 47 | */ | |
| 48 | ||
| 49 | #include "driver.h" | |
| 50 | #include "audio/seibu.h" | |
| 51 | ||
| 52 | UINT16 *cop_mcu_ram; | |
| 53 | ||
| 54 | static UINT16 copd2_table[0x100]; | |
| 55 | static UINT16 copd2_table_2[0x100/8]; | |
| 56 | static UINT16 copd2_table_3[0x100/8]; | |
| 57 | static UINT16 copd2_table_4[0x100/8]; | |
| 58 | ||
| 59 | static UINT16 cop_438; | |
| 60 | static UINT16 cop_43a; | |
| 61 | static UINT16 cop_43c; | |
| 62 | ||
| 63 | ||
| 64 | static UINT16 copd2_offs = 0; | |
| 65 | ||
| 66 | extern UINT16* legionna_scrollram16; | |
| 67 | extern UINT8 sdgndmrb_pri_n; | |
| 68 | extern void heatbrl_setgfxbank(UINT16 data); | |
| 69 | extern void denjinmk_setgfxbank(UINT16 data); | |
| 70 | ||
| 71 | void copd2_set_tableoffset(UINT16 data, running_machine *machine) | |
| 72 | { | |
| 73 | logerror("mcu_offs %04x\n", data); | |
| 74 | copd2_offs = data; | |
| 75 | if (copd2_offs>0xff) | |
| 76 | { | |
| 77 | logerror("copd2 offs > 0x100\n"); | |
| 78 | } | |
| 79 | ||
| 80 | copd2_table_2[copd2_offs/8] = cop_438; | |
| 81 | copd2_table_3[copd2_offs/8] = cop_43a; | |
| 82 | copd2_table_4[copd2_offs/8] = cop_43c; | |
| 83 | ||
| 84 | { | |
| 85 | FILE *fp; | |
| 86 | char filename[256]; | |
| 87 | sprintf(filename,"copdat_%s.table2", machine->gamedrv->name); | |
| 88 | fp=fopen(filename, "w+b"); | |
| 89 | if (fp) | |
| 90 | { | |
| 91 | fwrite(copd2_table_2, 0x200/8, 1, fp); | |
| 92 | fclose(fp); | |
| 93 | } | |
| 94 | } | |
| 95 | { | |
| 96 | FILE *fp; | |
| 97 | char filename[256]; | |
| 98 | sprintf(filename,"copdat_%s.table3", machine->gamedrv->name); | |
| 99 | fp=fopen(filename, "w+b"); | |
| 100 | if (fp) | |
| 101 | { | |
| 102 | fwrite(copd2_table_3, 0x200/8, 1, fp); | |
| 103 | fclose(fp); | |
| 104 | } | |
| 105 | } | |
| 106 | { | |
| 107 | FILE *fp; | |
| 108 | char filename[256]; | |
| 109 | sprintf(filename,"copdat_%s.table4", machine->gamedrv->name); | |
| 110 | fp=fopen(filename, "w+b"); | |
| 111 | if (fp) | |
| 112 | { | |
| 113 | fwrite(copd2_table_4, 0x200/8, 1, fp); | |
| 114 | fclose(fp); | |
| 115 | } | |
| 116 | } | |
| 117 | ||
| 118 | } | |
| 119 | ||
| 120 | void copd2_set_tabledata(UINT16 data, running_machine *machine) | |
| 121 | { | |
| 122 | copd2_table[copd2_offs] = data; | |
| 123 | logerror("mcu_data %04x\n", data); | |
| 124 | ||
| 125 | { | |
| 126 | FILE *fp; | |
| 127 | char filename[256]; | |
| 128 | sprintf(filename,"copdat_%s.data", machine->gamedrv->name); | |
| 129 | fp=fopen(filename, "w+b"); | |
| 130 | if (fp) | |
| 131 | { | |
| 132 | fwrite(copd2_table, 0x200, 1, fp); | |
| 133 | fclose(fp); | |
| 134 | } | |
| 135 | } | |
| 136 | } | |
| 137 | ||
| 138 | /* Mcu reads in attract in Legionnaire game demo | |
| 139 | ||
| 140 | Guess the 0x400-0x5ff area of the COP is protection related. | |
| 141 | ||
| 142 | CPU0 PC 0032a2 unknown MCU write offset: 0260 data: 9c6c | |
| 143 | CPU0 PC 0032a8 unknown MCU write offset: 0250 data: 0010 | |
| 144 | CPU0 PC 0032c8 unknown MCU write offset: 0261 data: 987c | |
| 145 | CPU0 PC 0032ce unknown MCU write offset: 0251 data: 0010 | |
| 146 | CPU0 PC 003546 unknown MCU write offset: 0262 data: 02c4 | |
| 147 | CPU0 PC 00354a unknown MCU write offset: 0252 data: 0004 | |
| 148 | CPU0 PC 00355c unknown MCU write offset: 0263 data: 0000 | |
| 149 | CPU0 PC 003560 unknown MCU write offset: 0253 data: 0004 | |
| 150 | CPU0 PC 003568 unknown MCU write offset: 0280 data: a180 | |
| 151 | CPU0 PC 00356e unknown MCU write offset: 0280 data: a980 | |
| 152 | CPU0 PC 003574 unknown MCU write offset: 0280 data: b100 | |
| 153 | CPU0 PC 00357a unknown MCU write offset: 0280 data: b900 | |
| 154 | CPU0 PC 003580 unknown MCU read offset: 02c4 | |
| 155 | CPU0 PC 003588 unknown MCU read offset: 02c2 | |
| 156 | CPU0 PC 003594 unknown MCU read offset: 02c1 | |
| 157 | CPU0 PC 0035a0 unknown MCU read offset: 02c3 | |
| 158 | CPU0 PC 0032a2 unknown MCU write offset: 0260 data: 9c6c | |
| 159 | CPU0 PC 0032a8 unknown MCU write offset: 0250 data: 0010 | |
| 160 | CPU0 PC 0032c8 unknown MCU write offset: 0261 data: 987c | |
| 161 | CPU0 PC 0032ce unknown MCU write offset: 0251 data: 0010 | |
| 162 | CPU0 PC 003422 unknown MCU write offset: 0280 data: 138e | |
| 163 | CPU0 PC 003428 unknown MCU read offset: 02da | |
| 164 | CPU0 PC 00342e unknown MCU read offset: 02d8 | |
| 165 | CPU0 PC 00346c unknown MCU write offset: 0280 data: 3bb0 | |
| 166 | CPU0 PC 0032a2 unknown MCU write offset: 0260 data: 987c | |
| 167 | CPU0 PC 0032a8 unknown MCU write offset: 0250 data: 0010 | |
| 168 | CPU0 PC 003306 unknown MCU write offset: 0280 data: 8100 | |
| 169 | CPU0 PC 00330c unknown MCU write offset: 0280 data: 8900 | |
| 170 | ||
| 171 | ||
| 172 | Mcu reads in attract in Heated Barrel game demo (note | |
| 173 | partial similarity) | |
| 174 | ||
| 175 | (i) This sequence repeats a number of times early on: | |
| 176 | ||
| 177 | CPU0 PC 0085b4 unknown MCU write offset: 0210 data: 0064 | |
| 178 | CPU0 PC 0085ba unknown MCU write offset: 0211 data: 0000 | |
| 179 | CPU0 PC 0085be unknown MCU read offset: 02ca | |
| 180 | CPU0 PC 0085ee unknown MCU read offset: 02c9 | |
| 181 | CPU0 PC 008622 unknown MCU read offset: 02c8 | |
| 182 | [Protection BCD,see protection_bcd_jsr()] | |
| 183 | ||
| 184 | (ii) This happens a few times: | |
| 185 | ||
| 186 | CPU0 PC 0017ac unknown MCU write offset: 0260 data: b6cc | |
| 187 | CPU0 PC 0017b2 unknown MCU write offset: 0250 data: 0010 | |
| 188 | CPU0 PC 0017d2 unknown MCU write offset: 0261 data: babc | |
| 189 | CPU0 PC 0017d8 unknown MCU write offset: 0251 data: 0010 | |
| 190 | CPU0 PC 00192c unknown MCU write offset: 0280 data: 138e | |
| 191 | CPU0 PC 001932 unknown MCU read offset: 02da | |
| 192 | CPU0 PC 001938 unknown MCU read offset: 02d8 | |
| 193 | CPU0 PC 001976 unknown MCU write offset: 0280 data: 3bb0 | |
| 194 | CPU0 PC 0017ac unknown MCU write offset: 0260 data: b6cc | |
| 195 | CPU0 PC 0017b2 unknown MCU write offset: 0250 data: 0010 | |
| 196 | CPU0 PC 0017d2 unknown MCU write offset: 0261 data: bb9c | |
| 197 | CPU0 PC 0017d8 unknown MCU write offset: 0251 data: 0010 | |
| 198 | CPU0 PC 00192c unknown MCU write offset: 0280 data: 138e | |
| 199 | CPU0 PC 001932 unknown MCU read offset: 02da | |
| 200 | CPU0 PC 001938 unknown MCU read offset: 02d8 | |
| 201 | CPU0 PC 001976 unknown MCU write offset: 0280 data: 3bb0 | |
| 202 | ||
| 203 | ||
| 204 | ||
| 205 | (iii) Later on this happens a lot: | |
| 206 | ||
| 207 | CPU0 PC 0017ac unknown MCU write offset: 0260 data: c61c | |
| 208 | CPU0 PC 0017b2 unknown MCU write offset: 0250 data: 0010 | |
| 209 | CPU0 PC 0017d2 unknown MCU write offset: 0261 data: bb9c | |
| 210 | CPU0 PC 0017d8 unknown MCU write offset: 0251 data: 0010 | |
| 211 | CPU0 PC 001a5c unknown MCU write offset: 0262 data: aa48 | |
| 212 | CPU0 PC 001a62 unknown MCU write offset: 0252 data: 0003 | |
| 213 | CPU0 PC 001a7c unknown MCU write offset: 0263 data: a0c8 | |
| 214 | CPU0 PC 001a82 unknown MCU write offset: 0253 data: 0003 | |
| 215 | CPU0 PC 001a86 unknown MCU write offset: 0280 data: a100 | |
| 216 | CPU0 PC 001a8c unknown MCU write offset: 0280 data: b080 | |
| 217 | CPU0 PC 001a92 unknown MCU write offset: 0280 data: a900 | |
| 218 | CPU0 PC 001a98 unknown MCU write offset: 0280 data: b880 | |
| 219 | CPU0 PC 001a9e unknown MCU read offset: 02c0 | |
| 220 | CPU0 PC 001aa6 unknown MCU read offset: 02c2 | |
| 221 | CPU0 PC 001ab2 unknown MCU read offset: 02c1 | |
| 222 | ||
| 223 | write to $500 these values to determine the kind of sub-routine to do | |
| 224 | hit_check | |
| 225 | a180 | |
| 226 | a980 | |
| 227 | b100 | |
| 228 | b900 | |
| 229 | || b880 (heatbrl) | |
| 230 | ||
| 231 | movement protection | |
| 232 | 8100 | |
| 233 | 8900 | |
| 234 | ||
| 235 | 00DB2A: D6A8 0048 add.l ($48,A0), D3 | |
| 236 | 00DB2E: D8A8 0044 add.l ($44,A0), D4 | |
| 237 | 00DB32: 0C83 FFF0 0000 cmpi.l #-$100000, D3 | |
| 238 | 00DB38: 6D2E blt $db68 | |
| 239 | 00DB3A: 0C83 0100 0000 cmpi.l #$1000000, D3 | |
| 240 | 00DB40: 6C26 bge $db68 | |
| 241 | 00DB42: 2143 003C move.l D3, ($3c,A0) | |
| 242 | 00DB46: 0C84 FFF0 0000 cmpi.l #-$100000, D4 | |
| 243 | 00DB4C: 6D1A blt $db68 | |
| 244 | 00DB4E: 0C84 0100 0000 cmpi.l #$1000000, D4 | |
| 245 | 00DB54: 6E12 bgt $db68 | |
| 246 | 00DB56: 2144 0038 move.l D4, ($38,A0) | |
| 247 | 00DB5A: 3168 003C 0022 move.w ($3c,A0), ($22,A0) | |
| 248 | 00DB60: 3168 0038 0024 move.w ($38,A0), ($24,A0) | |
| 249 | 00DB66: 4E75 rts | |
| 250 | ||
| 251 | ||
| 252 | sprite DMA | |
| 253 | ||
| 254 | */ | |
| 255 | /*Movement protection*//*Legionnaire,Heated Barrel*/ | |
| 256 | static UINT32 ram_addr[2],rom_addr[2]; | |
| 257 | /*Sprite DMA protection*//*SD Gundam*/ | |
| 258 | static UINT8 dma_status; | |
| 259 | static UINT32 dma_src,dma_dst; | |
| 260 | static UINT16 prot_data[2],dma_size; | |
| 261 | /*Number protection*//*Heated Barrel,SD Gundam,Godzilla,Denjin Makai*/ | |
| 262 | static UINT32 prot_bcd[4]; | |
| 263 | /*Hit check protection*//*Legionnaire,Heated Barrel,SD Gundam*/ | |
| 264 | static UINT8 xy_check; | |
| 265 | static UINT32 hit_check_x,hit_check_y; | |
| 266 | ||
| 267 | ||
| 268 | ||
| 269 | #define CRT_MODE(_x_,_y_,_flip_) \ | |
| 270 | { \ | |
| 271 | rectangle visarea = *video_screen_get_visible_area(machine->primary_screen); \ | |
| 272 | visarea.min_x = 0; \ | |
| 273 | visarea.max_x = _x_-1; \ | |
| 274 | visarea.min_y = 0; \ | |
| 275 | visarea.max_y = _y_-1; \ | |
| 276 | video_screen_configure(machine->primary_screen, _x_, _y_, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds ); \ | |
| 277 | flip_screen_set(_flip_); \ | |
| 278 | } \ | |
| 279 | ||
| 280 | /*TODO: numbers over 65535?*/ | |
| 281 | static UINT32 protection_bcd_jsr(UINT16 prot_data) | |
| 282 | { | |
| 283 | UINT32 res,bcd_data; | |
| 284 | ||
| 285 | res = 0; | |
| 286 | bcd_data = prot_data; | |
| 287 | while(bcd_data > 0) | |
| 288 | { | |
| 289 | if(bcd_data > 999) | |
| 290 | { | |
| 291 | res+=0x01000000; | |
| 292 | bcd_data-=1000; | |
| 293 | } | |
| 294 | else if(bcd_data > 99) | |
| 295 | { | |
| 296 | res+=0x00010000; | |
| 297 | bcd_data-=100; | |
| 298 | } | |
| 299 | else if(bcd_data > 9) | |
| 300 | { | |
| 301 | res+=0x00000100; | |
| 302 | bcd_data-=10; | |
| 303 | } | |
| 304 | else | |
| 305 | { | |
| 306 | res++; | |
| 307 | bcd_data--; | |
| 308 | } | |
| 309 | } | |
| 310 | ||
| 311 | return res & 0x0f0f0f0f; | |
| 312 | } | |
| 313 | ||
| 314 | /*TODO: -move x-axis limits,to calculate basing on the screen xy-axis values*/ | |
| 315 | /* -the second value should be end of calculation (in other words,check everything between the two values) */ | |
| 316 | #define PLAYER 0 | |
| 317 | #define ENEMY 1 | |
| 318 | static void protection_move_jsr(UINT32 work_ram,UINT8 k) | |
| 319 | { | |
| 320 | static UINT32 move_data,x_data,y_data; | |
| 321 | /*Read the movement data to execute*/ | |
| 322 | move_data = ((program_read_word(work_ram+0x34)<<16) & 0xffff0000) | | |
| 323 | (program_read_word(work_ram+0x36) & 0xffff); | |
| 324 | ||
| 325 | /*Read the x/y axis of the sprite to change*/ | |
| 326 | x_data = (program_read_word(work_ram+0x8)); | |
| 327 | y_data = (program_read_word(work_ram+0x4)); | |
| 328 | /*it's bit sensitive AFAIK*/ | |
| 329 | /*move_data hi-word on player | |
| 330 | $17 = walk floor | |
| 331 | $1b = jump | |
| 332 | $30 = ? | |
| 333 | */ | |
| 334 | /*Check the kind of movement that we need to execute*/ | |
| 335 | switch(k & 1) | |
| 336 | { | |
| 337 | case PLAYER: | |
| 338 | switch(move_data & 0xffff) | |
| 339 | { | |
| 340 | case 0x0000: x_data++; break; //right | |
| 341 | case 0x0040: y_data++; break; //down | |
| 342 | case 0x00c0: y_data--; break; //up | |
| 343 | case 0x0080: x_data--; break; //left | |
| 344 | case 0x00a0: y_data--; x_data--; break; //up-left | |
| 345 | case 0x0060: y_data++; x_data--; break; //down-left | |
| 346 | case 0x0020: y_data++; x_data++; break; //down-right | |
| 347 | case 0x00e0: y_data--; x_data++; break; //up-right | |
| 348 | } | |
| 349 | break; | |
| 350 | /*wrong...*/ | |
| 351 | case ENEMY: | |
| 352 | switch(move_data & 0xffff) | |
| 353 | { | |
| 354 | case 0x0000: x_data++; break; //right | |
| 355 | case 0x0040: y_data++; break; //down | |
| 356 | case 0x00c0: y_data--; break; //up | |
| 357 | case 0x0080: x_data--; break; //left | |
| 358 | case 0x00a0: y_data--; x_data--; break; //up-left | |
| 359 | case 0x0060: y_data++; x_data--; break; //down-left | |
| 360 | case 0x0020: y_data++; x_data++; break; //down-right | |
| 361 | case 0x00e0: y_data--; x_data++; break; //up-right | |
| 362 | default: | |
| 363 | popmessage("%08x",move_data); | |
| 364 | break; | |
| 365 | } | |
| 366 | break; | |
| 367 | } | |
| 368 | /*Write the new values to the sprite x/y data*/ | |
| 369 | program_write_word(work_ram+0x8,x_data); | |
| 370 | program_write_word(work_ram+0x4,y_data); | |
| 371 | } | |
| 372 | ||
| 373 | #ifdef UNUSED_FUNCTION | |
| 374 | static void protection_move2_jsr(void) | |
| 375 | { | |
| 376 | // static UINT32 move_data; | |
| 377 | // popmessage("%08x %08x %08x %08x",ram_addr[0],ram_addr[1],rom_addr[0],rom_addr[1]); | |
| 378 | } | |
| 379 | #endif | |
| 380 | ||
| 381 | static UINT16 hit_check; | |
| 382 | ||
| 383 | static void protection_hit_jsr(UINT32 work_ram1,UINT32 work_ram2) | |
| 384 | { | |
| 385 | int x1,y1,x2,y2/*,hit1,hit2*/; | |
| 386 | x1 = (program_read_word(work_ram1+0x8)); | |
| 387 | y1 = (program_read_word(work_ram1+0x4)); | |
| 388 | //hit1 = (program_read_word(work_ram1-));//this sprite is attacking | |
| 389 | x2 = (program_read_word(work_ram2+0x8)); | |
| 390 | y2 = (program_read_word(work_ram2+0x4)); | |
| 391 | //hit2 = (program_read_word()); | |
| 392 | ||
| 393 | popmessage("%08x:x=%04x y=%04x %08x:x=%04x y=%04x",work_ram1,x1,y1,work_ram2,x2,y2); | |
| 394 | ||
| 395 | if((x1 >= (x2-0x80)) && | |
| 396 | (x1 <= (x2+0x80)) && | |
| 397 | (y1 >= (y2-3)) && | |
| 398 | (y1 <= (y2+3))) | |
| 399 | hit_check = 0; | |
| 400 | else | |
| 401 | hit_check = 0xffff; | |
| 402 | } | |
| 403 | ||
| 404 | /*directional movement protection*/ | |
| 405 | static void moveprot_jsr(void) | |
| 406 | { | |
| 407 | static INT16 x_axis,y_axis; | |
| 408 | static UINT16 move_data,distance,move_type; | |
| 409 | move_data = program_read_word(ram_addr[0]+0x36); | |
| 410 | x_axis = program_read_word(ram_addr[0]+0x08); | |
| 411 | y_axis = program_read_word(ram_addr[0]+0x04); | |
| 412 | ||
| 413 | distance = (move_data & 0xf); | |
| 414 | move_type = (move_data & 0xf0)>>4; | |
| 415 | switch(move_type) | |
| 416 | { | |
| 417 | case 0x0f://right | |
| 418 | program_write_word(ram_addr[0]+0x08,x_axis+distance); | |
| 419 | //program_write_word(0x110004,); | |
| 420 | break; | |
| 421 | case 0x0b://up | |
| 422 | program_write_word(ram_addr[0]+0x04,y_axis-distance); | |
| 423 | break; | |
| 424 | case 0x07://left | |
| 425 | program_write_word(ram_addr[0]+0x08,x_axis-distance); | |
| 426 | break; | |
| 427 | case 0x03://down | |
| 428 | program_write_word(ram_addr[0]+0x04,y_axis+distance); | |
| 429 | break; | |
| 430 | case 0x0d://up-right | |
| 431 | program_write_word(ram_addr[0]+0x08,x_axis+distance); | |
| 432 | program_write_word(ram_addr[0]+0x04,y_axis-distance); | |
| 433 | break; | |
| 434 | case 0x09://up-left | |
| 435 | program_write_word(ram_addr[0]+0x04,y_axis-distance); | |
| 436 | program_write_word(ram_addr[0]+0x08,x_axis-distance); | |
| 437 | break; | |
| 438 | case 0x01://down-right | |
| 439 | program_write_word(ram_addr[0]+0x04,y_axis+distance); | |
| 440 | program_write_word(ram_addr[0]+0x08,x_axis+distance); | |
| 441 | break; | |
| 442 | case 0x05://down-left | |
| 443 | program_write_word(ram_addr[0]+0x04,y_axis+distance); | |
| 444 | program_write_word(ram_addr[0]+0x08,x_axis-distance); | |
| 445 | break; | |
| 446 | default: | |
| 447 | logerror("Warning: \"0x205\" command called with move_type parameter = %02x\n",move_type); | |
| 448 | ||
| 449 | //down-right | |
| 450 | //down-left | |
| 451 | } | |
| 452 | //program_write_word(0x110008,x_axis+tmp); | |
| 453 | //program_write_word(0x110004,y_axis+tmp); | |
| 454 | ||
| 455 | //program_write_word(0x110008,x_axis); | |
| 456 | //program_write_word(0x110004,y_axis); | |
| 457 | } | |
| 458 | ||
| 459 | /* | |
| 460 | 00454E: 3028 0008 move.w ($8,A0), D0 ;player | |
| 461 | 004552: 3228 000C move.w ($c,A0), D1 | |
| 462 | 004556: 342B 0008 move.w ($8,A3), D2 ;enemy | |
| 463 | 00455A: 362B 000C move.w ($c,A3), D3 | |
| 464 | 00455E: 33C0 0011 0048 move.w D0, $110048.l ;player x | |
| 465 | 004564: 33C1 0011 0044 move.w D1, $110044.l ;player y | |
| 466 | 00456A: 33C2 0011 0008 move.w D2, $110008.l ;enemy x | |
| 467 | 004570: 33C3 0011 0004 move.w D3, $110004.l ;enemy y | |
| 468 | ||
| 469 | */ | |
| 470 | /*sprite "look" protection*/ | |
| 471 | static void move2prot_jsr(void) | |
| 472 | { | |
| 473 | static INT16 x_pl,y_pl,x_en,y_en,res; | |
| 474 | x_pl = program_read_word(ram_addr[1]+0x8); | |
| 475 | y_pl = program_read_word(ram_addr[1]+0x4); | |
| 476 | x_en = program_read_word(ram_addr[0]+0x8); | |
| 477 | y_en = program_read_word(ram_addr[0]+0x4); | |
| 478 | ||
| 479 | res = 0; | |
| 480 | if(x_en > x_pl) | |
| 481 | res|=0x80; | |
| 482 | ||
| 483 | if((x_en > x_pl-0x20) && (x_en < x_pl+0x20)) | |
| 484 | res|=0x40; | |
| 485 | //... | |
| 486 | //if(y_en > y_pl) | |
| 487 | // res|=0x40; | |
| 488 | ||
| 489 | program_write_word(ram_addr[0]+0x36,res); | |
| 490 | } | |
| 491 | ||
| 492 | #ifdef UNUSED_FUNCTION | |
| 493 | /*"To point" movement protection*/ | |
| 494 | static void move3x_prot_jsr(void) | |
| 495 | { | |
| 496 | static INT16 x_pl,x_en,x_dis; | |
| 497 | x_pl = program_read_word(ram_addr[1]+0x8); | |
| 498 | x_en = program_read_word(ram_addr[0]+0x8); | |
| 499 | x_dis = ((program_read_word(ram_addr[0]+0x34) & 0xf0) >> 4); | |
| 500 | ||
| 501 | if(x_en > x_pl) | |
| 502 | x_dis^=0xffff; | |
| 503 | ||
| 504 | program_write_word(ram_addr[0]+0x36,-0x40);/*enable command*/ | |
| 505 | program_write_word(ram_addr[0]+0x14,x_dis); | |
| 506 | } | |
| 507 | ||
| 508 | static void move3y_prot_jsr(void) | |
| 509 | { | |
| 510 | static INT16 y_pl,y_en,y_dis; | |
| 511 | y_pl = program_read_word(ram_addr[1]+0x4); | |
| 512 | y_en = program_read_word(ram_addr[0]+0x4); | |
| 513 | y_dis = (program_read_word(ram_addr[0]+0x34) & 0xf); | |
| 514 | ||
| 515 | if(y_en > y_pl) | |
| 516 | y_dis^=0xffff; | |
| 517 | ||
| 518 | program_write_word(ram_addr[0]+0x36,-0x80);/*enable command*/ | |
| 519 | program_write_word(ram_addr[0]+0x10,y_dis); | |
| 520 | } | |
| 521 | #endif | |
| 522 | ||
| 523 | ||
| 524 | READ16_HANDLER( legionna_mcu_r ) | |
| 525 | { | |
| 526 | UINT16 retvalue = cop_mcu_ram[offset]; | |
| 527 | ||
| 528 | switch (offset) | |
| 529 | { | |
| 530 | default: | |
| 531 | { | |
| 532 | logerror("%06x: COPX unhandled read returning %04x from offset %04x\n", activecpu_get_pc(), retvalue, offset*2); | |
| 533 | return retvalue; | |
| 534 | } | |
| 535 | ||
| 536 | /********************************************************************* | |
| 537 | 400-5ff - Protection reads | |
| 538 | *********************************************************************/ | |
| 539 | ||
| 540 | case (0x470/2): return (mame_rand(machine) &0xffff); /* read PC $110a, could be some sort of control word: sometimes a bit is changed then it's poked back in... */ | |
| 541 | case (0x582/2): return (0); /* read PC $3594 */ | |
| 542 | case (0x584/2): return (0); /* read PC $3588 */ | |
| 543 | case (0x586/2): return (0); /* read PC $35a0 */ | |
| 544 | case (0x588/2): return hit_check; /* read PC $3580 */ | |
| 545 | case (0x5b0/2): return (0); /* bit 15 is branched on a few times in the $3300 area */ | |
| 546 | case (0x5b4/2): return (0); /* read and stored in ram before +0x5b0 bit 15 tested */ | |
| 547 | ||
| 548 | ||
| 549 | /********************************************************************* | |
| 550 | 700-7ff - Non-protection reads | |
| 551 | *********************************************************************/ | |
| 552 | ||
| 553 | /* Seibu Sound System */ | |
| 554 | case (0x708/2): return seibu_main_word_r(machine,2,0); | |
| 555 | case (0x70c/2): return seibu_main_word_r(machine,3,0); | |
| 556 | case (0x714/2): return seibu_main_word_r(machine,5,0); | |
| 557 | ||
| 558 | /* Inputs */ | |
| 559 | case (0x740/2): return input_port_1_word_r(machine,0,0); | |
| 560 | case (0x744/2): return input_port_2_word_r(machine,0,0); | |
| 561 | case (0x748/2): return input_port_0_word_r(machine,0,0); | |
| 562 | case (0x74c/2): return input_port_3_word_r(machine,0,0); | |
| 563 | ||
| 564 | } | |
| 565 | } | |
| 566 | ||
| 567 | ||
| 568 | WRITE16_HANDLER( legionna_mcu_w ) | |
| 569 | { | |
| 570 | COMBINE_DATA(&cop_mcu_ram[offset]); | |
| 571 | ||
| 572 | switch (offset) | |
| 573 | { | |
| 574 | default: | |
| 575 | { | |
| 576 | logerror("%06x: COPX unhandled write data %04x at offset %04x\n", activecpu_get_pc(), data, offset*2); | |
| 577 | break; | |
| 578 | } | |
| 579 | ||
| 580 | /********************************************************************* | |
| 581 | 400-5ff - Protection writes | |
| 582 | *********************************************************************/ | |
| 583 | ||
| 584 | /* Trigger Table upload */ | |
| 585 | case (0x432/2): { copd2_set_tabledata(data, machine); break; } | |
| 586 | case (0x434/2): { copd2_set_tableoffset(data, machine); break; } | |
| 587 | case (0x438/2): { cop_438 = data; break; } | |
| 588 | case (0x43a/2): { cop_43a = data; break; } | |
| 589 | case (0x43c/2): { cop_43c = data; break; } | |
| 590 | ||
| 591 | /* Registers */ | |
| 592 | case (0x4c0/2): { prot_data[0] = cop_mcu_ram[offset]; ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 593 | case (0x4a0/2): { prot_data[1] = cop_mcu_ram[offset]; ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 594 | case (0x4c2/2): { prot_data[0] = cop_mcu_ram[offset]; ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 595 | case (0x4a2/2): { prot_data[1] = cop_mcu_ram[offset]; ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 596 | case (0x4c4/2): { prot_data[0] = cop_mcu_ram[offset]; rom_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 597 | case (0x4a4/2): { prot_data[1] = cop_mcu_ram[offset]; rom_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 598 | case (0x4c6/2): { prot_data[0] = cop_mcu_ram[offset]; rom_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 599 | case (0x4a6/2): { prot_data[1] = cop_mcu_ram[offset]; rom_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 600 | ||
| 601 | /* Execute Macro command from table */ | |
| 602 | case (0x500/2): | |
| 603 | { | |
| 604 | /*Movement protection*/ | |
| 605 | if(cop_mcu_ram[0x500/2] == 0x8900 || cop_mcu_ram[0x500/2] == 0x0205) | |
| 606 | { | |
| 607 | static UINT16 xy_data[2]; | |
| 608 | static UINT8 k; | |
| 609 | xy_data[0] = program_read_word(rom_addr[0]); | |
| 610 | xy_data[1] = program_read_word(rom_addr[1]); | |
| 611 | k = (cop_mcu_ram[0x500/2] == 0x0205) ? ENEMY : PLAYER; | |
| 612 | protection_move_jsr(ram_addr[0],k); | |
| 613 | //protection_move_jsr(ram_addr[1]); //??? | |
| 614 | //popmessage("%08x %08x %04x %04x",ram_addr[0],ram_addr[1],xy_data[0],xy_data[1]); | |
| 615 | } | |
| 616 | else if(cop_mcu_ram[0x500/2] == 0x3bb0 || cop_mcu_ram[0x500/2] == 0x138e) | |
| 617 | { | |
| 618 | protection_hit_jsr(ram_addr[0],ram_addr[1]); | |
| 619 | } | |
| 620 | break; | |
| 621 | } | |
| 622 | ||
| 623 | /********************************************************************* | |
| 624 | 600-6ff - Video Registers | |
| 625 | *********************************************************************/ | |
| 626 | ||
| 627 | // 61a bit 0 is flipscreen | |
| 628 | // 61c probably layer disables, like Dcon | |
| 629 | ||
| 630 | case (0x620/2): { legionna_scrollram16[0] = cop_mcu_ram[offset]; break; } | |
| 631 | case (0x622/2): { legionna_scrollram16[1] = cop_mcu_ram[offset]; break; } | |
| 632 | case (0x624/2): { legionna_scrollram16[2] = cop_mcu_ram[offset]; break; } | |
| 633 | case (0x626/2): { legionna_scrollram16[3] = cop_mcu_ram[offset]; break; } | |
| 634 | case (0x628/2): { legionna_scrollram16[4] = cop_mcu_ram[offset]; break; } | |
| 635 | case (0x62a/2): { legionna_scrollram16[5] = cop_mcu_ram[offset]; break; } | |
| 636 | ||
| 637 | /********************************************************************* | |
| 638 | 700-7ff - Output (Seibu Sound System) | |
| 639 | *********************************************************************/ | |
| 640 | ||
| 641 | case (0x700/2): { seibu_main_word_w(machine,0,cop_mcu_ram[offset],0xff00); break; } | |
| 642 | case (0x704/2): { seibu_main_word_w(machine,1,cop_mcu_ram[offset],0xff00); break; } | |
| 643 | case (0x710/2): { seibu_main_word_w(machine,4,cop_mcu_ram[offset],0xff00); break; } | |
| 644 | case (0x718/2): { seibu_main_word_w(machine,6,cop_mcu_ram[offset],0xff00); break; } | |
| 645 | } | |
| 646 | } | |
| 647 | ||
| 648 | ||
| 649 | ||
| 650 | /* | |
| 651 | player-1 priorities list: | |
| 652 | 1086d8: show this sprite (bit 15) | |
| 653 | 1086dc: lives (BCD,bits 3,2,1,0) | |
| 654 | 1086de: energy bar (upper byte) | |
| 655 | 1086e0: walk animation (lower byte) | |
| 656 | 1086ec: "death" status (bit 15) | |
| 657 | 1086f4: sprite y axis | |
| 658 | 1086f0: sprite x axis | |
| 659 | ||
| 660 | Sprite DMA TODO: | |
| 661 | -sprite priorities,likely to be a protection issue because in-game sprites MUST | |
| 662 | be behind the foreground layer but the attract mode logos (the ones used when | |
| 663 | the story is explained) should be above it.They both use 0 as priority number. | |
| 664 | -sprites at the very left border disappears. | |
| 665 | -some bullets STILL remains on screen? | |
| 666 | -3rd mid-boss disappears (0x1f0),2nd boss lasers wrong positioning | |
| 667 | ||
| 668 | spriteram DMA [1] | |
| 669 | 001DE4: 3086 move.w D6, (A0) ;$100400,color + other stuff | |
| 670 | 001DE6: 2440 movea.l D0, A2 | |
| 671 | 001DE8: 0269 0004 0002 andi.w #$4, ($2,A1) | |
| 672 | 001DEE: 3152 000C move.w (A2), ($c,A0) ;DMA size | |
| 673 | 001DF2: 3145 0002 move.w D5, ($2,A0) | |
| 674 | 001DF6: 0245 0040 andi.w #$40, D5 | |
| 675 | 001DFA: 2009 move.l A1, D0 | |
| 676 | 001DFC: 3140 00C0 move.w D0, ($c0,A0) ;RAM -> $1004c0 (work ram index?) | |
| 677 | 001E00: 4840 swap D0 | |
| 678 | 001E02: 3140 00A0 move.w D0, ($a0,A0) ;RAM -> $1004a0 | |
| 679 | 001E06: 200A move.l A2, D0 | |
| 680 | 001E08: 3140 0014 move.w D0, ($14,A0) ;$ROM lo -> $100414 src | |
| 681 | 001E0C: 4840 swap D0 | |
| 682 | 001E0E: 3140 0012 move.w D0, ($12,A0) ;$ROM hi -> $100412 | |
| 683 | 001E12: 2679 0010 8116 movea.l $108116.l, A3 ;points to dst spriteram | |
| 684 | 001E18: 3839 0010 810A move.w $10810a.l, D4 ;spriteram index | |
| 685 | 001E1E: 260B move.l A3, D3 | |
| 686 | 001E20: 3143 00C8 move.w D3, ($c8,A0) ;sets the dst spriteram | |
| 687 | 001E24: 4843 swap D3 | |
| 688 | 001E26: 3143 00A8 move.w D3, ($a8,A0) | |
| 689 | 001E2A: 45EA 0004 lea ($4,A2), A2 | |
| 690 | //at this point we're ready for DMAing | |
| 691 | 001E2E: 317C A180 0100 move.w #$a180, ($100,A0) ;<-DMA parameters!? | |
| 692 | 001E34: 317C 6980 0102 move.w #$6980, ($102,A0) ;<-"" | |
| 693 | 001E3A: 317C C480 0102 move.w #$c480, ($102,A0) ;<-"" | |
| 694 | 001E40: 317C 0000 0010 move.w #$0, ($10,A0) ;<-"" | |
| 695 | 001E46: 302A 0002 move.w ($2,A2), D0 | |
| 696 | 001E4A: 816B 0006 or.w D0, ($6,A3) | |
| 697 | 001E4E: 45EA 0006 lea ($6,A2), A2 | |
| 698 | 001E52: 302B 0008 move.w ($8,A3), D0 | |
| 699 | 001E56: B079 0010 8112 cmp.w $108112.l, D0 | |
| 700 | 001E5C: 6E00 0054 bgt $1eb2 | |
| 701 | 001E60: B079 0010 8110 cmp.w $108110.l, D0 | |
| 702 | 001E66: 6D00 004A blt $1eb2 | |
| 703 | 001E6A: 026B 7FFF 000A andi.w #$7fff, ($a,A3) | |
| 704 | 001E70: 8B6B 0004 or.w D5, ($4,A3) | |
| 705 | 001E74: 47EB 0008 lea ($8,A3), A3 | |
| 706 | 001E78: 260B move.l A3, D3 | |
| 707 | 001E7A: 3143 00C8 move.w D3, ($c8,A0) | |
| 708 | 001E7E: 4843 swap D3 | |
| 709 | 001E80: 3143 00A8 move.w D3, ($a8,A0) | |
| 710 | 001E84: 5244 addq.w #1, D4 | |
| 711 | 001E86: B879 0010 8114 cmp.w $108114.l, D4 | |
| 712 | 001E8C: 6500 000C bcs $1e9a | |
| 713 | 001E90: 0069 0002 0002 ori.w #$2, ($2,A1) | |
| 714 | 001E96: 6000 000C bra $1ea4 | |
| 715 | //Note: I believe the above program is there just for protection copy | |
| 716 | 001E9A: 3028 01B0 move.w ($1b0,A0), D0 ;bit 1 = DMA job finished | |
| 717 | 001E9E: 0240 0002 andi.w #$2, D0 | |
| 718 | 001EA2: 6790 beq $1e34 | |
| 719 | 001EA4: 33C4 0010 810A move.w D4, $10810a.l | |
| 720 | 001EAA: 23CB 0010 8116 move.l A3, $108116.l | |
| 721 | 001EB0: 4E75 rts | |
| 722 | ||
| 723 | x/y check [2] | |
| 724 | 002030: E58D lsl.l #2, D5 | |
| 725 | 002032: 0685 0003 0000 addi.l #$30000, D5 | |
| 726 | 002038: 33C5 0010 04C4 move.w D5, $1004c4.l | |
| 727 | 00203E: 4845 swap D5 | |
| 728 | 002040: 33C5 0010 04A4 move.w D5, $1004a4.l | |
| 729 | 002046: E58E lsl.l #2, D6 | |
| 730 | 002048: 0686 0003 0000 addi.l #$30000, D6 | |
| 731 | 00204E: 33C6 0010 04C6 move.w D6, $1004c6.l | |
| 732 | 002054: 4846 swap D6 | |
| 733 | 002056: 33C6 0010 04A6 move.w D6, $1004a6.l | |
| 734 | 00205C: 33FC A180 0010 0500 move.w #$a180, $100500.l | |
| 735 | 002064: 33FC B100 0010 0500 move.w #$b100, $100500.l | |
| 736 | 00206C: 33FC A980 0010 0500 move.w #$a980, $100500.l | |
| 737 | 002074: 33FC B900 0010 0500 move.w #$b900, $100500.l | |
| 738 | 00207C: 4E75 rts | |
| 739 | [...] | |
| 740 | //then reads at $580 | |
| 741 | ||
| 742 | */ | |
| 743 | ||
| 744 | static UINT16 s_i; | |
| 745 | ||
| 746 | static void dma_transfer(void) | |
| 747 | { | |
| 748 | static UINT16 rel_xy; | |
| 749 | static UINT16 abs_x,abs_y; | |
| 750 | static UINT16 param; | |
| 751 | ||
| 752 | //for(s_i = dma_size;s_i > 0;s_i--) | |
| 753 | { | |
| 754 | /*Sprite Color*/ | |
| 755 | param = program_read_word(0x100400) & 0x3f; | |
| 756 | /*Write the entire parameters [offs+0]*/ | |
| 757 | program_write_word(dma_dst,program_read_word(dma_src) + param); | |
| 758 | /*Sprite Priority (guess)*/ | |
| 759 | //param = ((program_read_word(0x100400) & 0x40) ? 0x4000 : 0); | |
| 760 | /*Write the sprite number [offs+1]*/ | |
| 761 | program_write_word(dma_dst+2,program_read_word(dma_src+2)); | |
| 762 | /*Sprite Relative x/y coords*/ | |
| 763 | rel_xy = program_read_word(dma_src+4); /*???*/ | |
| 764 | /*temporary hardwired,it should point to 0x4c0/0x4a0*/ | |
| 765 | abs_x = (program_read_word(0x110008) - program_read_word(0x10048e)); | |
| 766 | abs_y = (program_read_word(0x110004) - program_read_word(0x10048c)); | |
| 767 | program_write_word(dma_dst+4,((rel_xy & 0x7f) + (abs_x) - ((rel_xy & 0x80) ? 0x80 : 0)) & 0x1ff); | |
| 768 | program_write_word(dma_dst+6,(((rel_xy & 0x7f00) >> 8) + (abs_y) + (0x10) - ((rel_xy & 0x8000) ? 0x80 : 0)) & 0x1ff); | |
| 769 | dma_dst+=8; | |
| 770 | dma_src+=6; | |
| 771 | } | |
| 772 | } | |
| 773 | ||
| 774 | ||
| 775 | /* | |
| 776 | switch(program_read_word(hit_check_x)) | |
| 777 | { | |
| 778 | case 0xb4: xparam = 0x0c/2; break; | |
| 779 | case 0xb8: xparam = 0x10/2; break; | |
| 780 | case 0xbc: xparam = 0x14/2; break; | |
| 781 | case 0xc0: xparam = 0x18/2; break; | |
| 782 | case 0xc4: xparam = 0x1c/2; break; | |
| 783 | case 0xd4: xparam = 0x20/2; break; | |
| 784 | ... | |
| 785 | case 0xb0: xparam = 0x08/2; | |
| 786 | case 0xac: xparam = 0x04/2; | |
| 787 | } | |
| 788 | */ | |
| 789 | static UINT16 check_calc(UINT16 param) | |
| 790 | { | |
| 791 | UINT16 num,i; | |
| 792 | ||
| 793 | i = param; | |
| 794 | i-=0xac; | |
| 795 | i/=4; | |
| 796 | num = (0x4/2); | |
| 797 | for(;i>0;i--) | |
| 798 | num+=(0x4/2); | |
| 799 | ||
| 800 | return num; | |
| 801 | } | |
| 802 | ||
| 803 | static UINT16 hit_check_jsr(void) | |
| 804 | { | |
| 805 | static INT16 xsrc,xdst,ysrc,ydst,xparam,yparam; | |
| 806 | xsrc = (program_read_word(0x110008)); | |
| 807 | ysrc = (program_read_word(0x110004)); | |
| 808 | xdst = (program_read_word(0x110048)); | |
| 809 | ydst = (program_read_word(0x110044)); | |
| 810 | ||
| 811 | /*Here we check the destination sprite width*/ | |
| 812 | /*0x4a4/0x4c4*/ | |
| 813 | xparam = check_calc(program_read_word(hit_check_x)); | |
| 814 | /*Here we check the destination sprite height*/ | |
| 815 | /*0x4a6/0x4c6*/ | |
| 816 | yparam = check_calc(program_read_word(hit_check_y)); | |
| 817 | ||
| 818 | if(!xparam || !yparam) | |
| 819 | popmessage("SRC:%04x %04x DST:%04x %04x V:%08x %08x",xsrc,ysrc,xdst,ydst,program_read_word(hit_check_x),program_read_word(hit_check_y)); | |
| 820 | if(xdst >= (xsrc-xparam) && ydst >= (ysrc-yparam) && | |
| 821 | xdst <= (xsrc+xparam) && ydst <= (ysrc+yparam)) | |
| 822 | return 0;//sprites collide | |
| 823 | else | |
| 824 | return 3;//sprites do not collide | |
| 825 | } | |
| 826 | ||
| 827 | #define UP 0xc0 | |
| 828 | #define UP_RIGHT 0xe0 | |
| 829 | #define RIGHT 0x00 | |
| 830 | #define DOWN_RIGHT 0x20 | |
| 831 | #define DOWN 0x40 | |
| 832 | #define DOWN_LEFT 0x60 | |
| 833 | #define LEFT 0x80 | |
| 834 | #define UP_LEFT 0xa0 | |
| 835 | ||
| 836 | /*Heated Barrel*/ | |
| 837 | /*command 0x8100 will check for the direction of the sprite*/ | |
| 838 | /*command 0x8900 will check the "point" movement*/ | |
| 839 | static void cop2_move3_prot(void) | |
| 840 | { | |
| 841 | static INT16 x_pl,x_en; | |
| 842 | static INT16 y_pl,y_en; | |
| 843 | static INT16 x_dis,y_dis; | |
| 844 | static INT16 dir,dis; | |
| 845 | x_pl = program_read_word(ram_addr[1]+0x8); | |
| 846 | x_en = program_read_word(ram_addr[0]+0x8); | |
| 847 | dis = ((program_read_word(ram_addr[0]+0x34) & 0xf0) >> 4); | |
| 848 | y_pl = program_read_word(ram_addr[1]+0x4); | |
| 849 | y_en = program_read_word(ram_addr[0]+0x4); | |
| 850 | ||
| 851 | /* | |
| 852 | xxxx ---- select the direction of the enemy sprite | |
| 853 | ||
| 854 | 0xc0 up | |
| 855 | up-left 0xa0 | 0xe0 up-right | |
| 856 | left 0x80 <-o-> 0x00 right | |
| 857 | down-left 0x60 | 0x20 down-right | |
| 858 | 0x40 down | |
| 859 | */ | |
| 860 | ||
| 861 | if(x_en >= x_pl) | |
| 862 | { | |
| 863 | if((y_en >= (y_pl-0x10)) && (y_en <= (y_pl+0x10))) | |
| 864 | dir = LEFT; | |
| 865 | else if(y_en < (y_pl-0x10)) | |
| 866 | dir = DOWN_LEFT; | |
| 867 | else if(y_en > (y_pl+0x10)) | |
| 868 | dir = UP_LEFT; | |
| 869 | } | |
| 870 | else if(x_en < x_pl) | |
| 871 | { | |
| 872 | if((y_en >= (y_pl-0x10)) && (y_en <= (y_pl+0x10))) | |
| 873 | dir = RIGHT; | |
| 874 | else if(y_en < (y_pl-0x10)) | |
| 875 | dir = DOWN_RIGHT; | |
| 876 | else if(y_en > (y_pl+0x10)) | |
| 877 | dir = UP_RIGHT; | |
| 878 | } | |
| 879 | /*UP DOWN cases*/ | |
| 880 | if((x_en >= (x_pl-0x10)) && (x_en <= (x_pl+0x10))) | |
| 881 | { | |
| 882 | if(y_en >= y_pl) | |
| 883 | dir = UP; | |
| 884 | else if(y_en < y_pl) | |
| 885 | dir = DOWN; | |
| 886 | } | |
| 887 | ||
| 888 | program_write_word(ram_addr[0]+0x36,dir); | |
| 889 | ||
| 890 | /*TODO*/ | |
| 891 | x_dis = (x_pl-x_en); | |
| 892 | y_dis = (y_pl-y_en); | |
| 893 | ||
| 894 | if(x_dis > 4) | |
| 895 | x_dis = 4; | |
| 896 | ||
| 897 | if(x_dis < -4) | |
| 898 | x_dis = -4; | |
| 899 | ||
| 900 | if(y_dis > 4) | |
| 901 | y_dis = 4; | |
| 902 | ||
| 903 | if(y_dis < -4) | |
| 904 | y_dis = -4; | |
| 905 | ||
| 906 | //if(y_en > y_pl) | |
| 907 | // y_dis^=0xffff; | |
| 908 | ||
| 909 | //if(x_en > x_pl) | |
| 910 | // x_dis^=0xffff; | |
| 911 | ||
| 912 | program_write_word(ram_addr[0]+0x10,y_dis); | |
| 913 | program_write_word(ram_addr[0]+0x14,x_dis); | |
| 914 | } | |
| 915 | ||
| 916 | /**/ | |
| 917 | static UINT16 cop2_hit_prot(void) | |
| 918 | { | |
| 919 | static INT16 xsrc,xdst; | |
| 920 | static INT16 ysrc,ydst; | |
| 921 | static INT16 xp,yp; | |
| 922 | static INT16 param1,param2; | |
| 923 | static INT16 val; | |
| 924 | ||
| 925 | param1 = program_read_word(rom_addr[0]); | |
| 926 | param2 = program_read_word(rom_addr[1]); | |
| 927 | ||
| 928 | xsrc = program_read_word(ram_addr[0]+0x8) + program_read_word(ram_addr[0]+0x14); | |
| 929 | ysrc = program_read_word(ram_addr[0]+0x4) + program_read_word(ram_addr[0]+0x10); | |
| 930 | xdst = program_read_word(ram_addr[1]+0x8) + program_read_word(ram_addr[1]+0x14); | |
| 931 | ydst = program_read_word(ram_addr[1]+0x4) + program_read_word(ram_addr[1]+0x10); | |
| 932 | ||
| 933 | // xp = (param1 & 0x00f0) >> 4; | |
| 934 | // yp = (param1 & 0x0f00) >> 8; | |
| 935 | ||
| 936 | // popmessage("%04x %04x",param1,param2); | |
| 937 | ||
| 938 | xp = 0; | |
| 939 | yp = 0; | |
| 940 | for(val = ((param1 & 0xff0) >> 4); val > 0; val-=5) | |
| 941 | xp++; | |
| 942 | ||
| 943 | for(val = ((param1 & 0xff0) >> 4); val > 0; val-=3) | |
| 944 | yp++; | |
| 945 | ||
| 946 | /*TODO*/ | |
| 947 | // xp+=4; | |
| 948 | // yp+=4; | |
| 949 | ||
| 950 | if(xsrc >= xdst && xsrc <= xdst+xp && ysrc >= xdst && ysrc <= ydst+yp) | |
| 951 | return 0; | |
| 952 | else | |
| 953 | return 3; | |
| 954 | } | |
| 955 | ||
| 956 | static void cop2_move2_prot(void) | |
| 957 | { | |
| 958 | static INT16 xsrc,ysrc; | |
| 959 | static INT16 param2; | |
| 960 | ||
| 961 | xsrc = program_read_word(ram_addr[0]+0x14); | |
| 962 | ysrc = program_read_word(ram_addr[0]+0x10); | |
| 963 | param2 = program_read_word(rom_addr[1]); | |
| 964 | ||
| 965 | switch(param2) | |
| 966 | { | |
| 967 | case 0x10: xsrc++; break; //right | |
| 968 | case 0x30: xsrc--; break; //left | |
| 969 | case 0x40: ysrc--; break; //up | |
| 970 | case 0x60: ysrc++; break; //down | |
| 971 | case 0x08: ysrc--; xsrc++; break; //up-right | |
| 972 | case 0x38: ysrc--; xsrc--; break; //up-left | |
| 973 | case 0x28: ysrc++; xsrc--; break; //down-left | |
| 974 | case 0x18: ysrc++; xsrc++; break; //down-right | |
| 975 | } | |
| 976 | ||
| 977 | program_write_word(ram_addr[0]+0x14,xsrc); | |
| 978 | program_write_word(ram_addr[0]+0x10,ysrc); | |
| 979 | } | |
| 980 | ||
| 981 | /****************************************************************************************** | |
| 982 | Heated Barrel Specific | |
| 983 | ******************************************************************************************/ | |
| 984 | ||
| 985 | READ16_HANDLER( heatbrl_mcu_r ) | |
| 986 | { | |
| 987 | UINT16 retvalue = cop_mcu_ram[offset]; | |
| 988 | ||
| 989 | switch (offset) | |
| 990 | { | |
| 991 | default: | |
| 992 | { | |
| 993 | logerror("%06x: COPX unhandled read returning %04x from offset %04x\n", activecpu_get_pc(), retvalue, offset*2); | |
| 994 | return retvalue; | |
| 995 | } | |
| 996 | ||
| 997 | /********************************************************************* | |
| 998 | 400-5ff - Protection reads | |
| 999 | *********************************************************************/ | |
| 1000 | ||
| 1001 | case (0x580/2): { return xy_check; } /*hit protection*/ | |
| 1002 | case (0x582/2): { if(input_code_pressed(KEYCODE_X)) { return 0; } else { return 3; } } /*---- ---- ---- --xx used bits*/ | |
| 1003 | case (0x584/2): { if(input_code_pressed(KEYCODE_C)) { return 0; } else { return 3; } } /*---- ---- ---- --xx used bits*/ | |
| 1004 | ||
| 1005 | case (0x590/2): { return ((prot_bcd[0] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1006 | case (0x592/2): { return ((prot_bcd[0] & 0xffff0000) >> 16) + 0x3030; } | |
| 1007 | case (0x594/2): { return ((prot_bcd[1] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1008 | case (0x596/2): { return ((prot_bcd[1] & 0xffff0000) >> 16) + 0x3030; } | |
| 1009 | case (0x598/2): { return ((prot_bcd[2] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1010 | case (0x59a/2): { return ((prot_bcd[2] & 0xffff0000) >> 16) + 0x3030; } | |
| 1011 | case (0x59c/2): { return 0x3030; } | |
| 1012 | ||
| 1013 | //case (0x5b0/2): return (cop_mcu_ram[offset]); /* bit 15 is branched on a few times in the $1938 area */ | |
| 1014 | case (0x5b4/2): return (0); /* read at $1932 and stored in ram before +0x5b0 bit 15 tested */ | |
| 1015 | ||
| 1016 | /********************************************************************* | |
| 1017 | 700-7ff - Non-protection reads | |
| 1018 | *********************************************************************/ | |
| 1019 | ||
| 1020 | /* Seibu Sound System */ | |
| 1021 | case (0x7c8/2): return seibu_main_word_r(machine,2,0); | |
| 1022 | case (0x7cc/2): return seibu_main_word_r(machine,3,0); | |
| 1023 | case (0x7d4/2): return seibu_main_word_r(machine,5,0); | |
| 1024 | ||
| 1025 | /* Inputs */ | |
| 1026 | case (0x740/2): return input_port_1_word_r(machine,0,0); | |
| 1027 | case (0x744/2): return input_port_2_word_r(machine,0,0); | |
| 1028 | case (0x748/2): return input_port_4_word_r(machine,0,0); | |
| 1029 | case (0x74c/2): return input_port_3_word_r(machine,0,0); | |
| 1030 | ||
| 1031 | } | |
| 1032 | } | |
| 1033 | ||
| 1034 | WRITE16_HANDLER( heatbrl_mcu_w ) | |
| 1035 | { | |
| 1036 | COMBINE_DATA(&cop_mcu_ram[offset]); | |
| 1037 | ||
| 1038 | switch (offset) | |
| 1039 | { | |
| 1040 | default: | |
| 1041 | { | |
| 1042 | logerror("%06x: COPX unhandled write data %04x at offset %04x\n", activecpu_get_pc(), data, offset*2); | |
| 1043 | break; | |
| 1044 | } | |
| 1045 | ||
| 1046 | /********************************************************************* | |
| 1047 | 400-5ff - Protection writes | |
| 1048 | *********************************************************************/ | |
| 1049 | ||
| 1050 | case (0x420/2): { prot_bcd[0] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1051 | case (0x422/2): { prot_bcd[1] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1052 | case (0x424/2): { prot_bcd[2] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1053 | ||
| 1054 | ||
| 1055 | case (0x432/2): { copd2_set_tabledata(data, machine); break; } | |
| 1056 | case (0x434/2): { copd2_set_tableoffset(data, machine); break; } | |
| 1057 | case (0x438/2): {cop_438 = data; break; } | |
| 1058 | case (0x43a/2): {cop_43a = data; break; } | |
| 1059 | case (0x43c/2): {cop_43c = data; break; } | |
| 1060 | ||
| 1061 | ||
| 1062 | /* Odd, this is a video register */ | |
| 1063 | case (0x470/2): { heatbrl_setgfxbank( cop_mcu_ram[offset] ); break; } | |
| 1064 | ||
| 1065 | /* Layer Clearing */ | |
| 1066 | case (0x478/2): | |
| 1067 | { | |
| 1068 | static UINT16 i; | |
| 1069 | /* | |
| 1070 | AM_RANGE(0x100800, 0x100fff) AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 1071 | AM_RANGE(0x101000, 0x1017ff) AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 1072 | AM_RANGE(0x101800, 0x101fff) AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 1073 | AM_RANGE(0x102000, 0x102fff) AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 1074 | */ | |
| 1075 | switch(cop_mcu_ram[offset]) | |
| 1076 | { | |
| 1077 | /*layer clearance*/ | |
| 1078 | case 0x4080: | |
| 1079 | /*text layer*/ | |
| 1080 | for(i=0;i<0x1000;i+=2) | |
| 1081 | program_write_word(i+0x102000,0x0000); | |
| 1082 | /*background layer*/ | |
| 1083 | for(i=0;i<0x800;i+=2) | |
| 1084 | program_write_word(i+0x100800,0x0000); | |
| 1085 | break; | |
| 1086 | case 0x4100: break; | |
| 1087 | case 0x41c0: break; | |
| 1088 | //default: popmessage("%04x",cop_mcu_ram[offset]); | |
| 1089 | } | |
| 1090 | break; | |
| 1091 | } | |
| 1092 | ||
| 1093 | /*sprite ram clear(Guess)*/ | |
| 1094 | case (0x47e/2): | |
| 1095 | { | |
| 1096 | static UINT16 i; | |
| 1097 | if(cop_mcu_ram[0x47e/2] == 0x118) | |
| 1098 | { | |
| 1099 | for(i=0;i<0x800;i+=2) | |
| 1100 | program_write_word((0x103000 | i),0x0000); | |
| 1101 | } | |
| 1102 | break; | |
| 1103 | } | |
| 1104 | ||
| 1105 | ||
| 1106 | /* Registers */ | |
| 1107 | case (0x4c0/2): { prot_data[0] = cop_mcu_ram[offset]; ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1108 | case (0x4a0/2): { prot_data[1] = cop_mcu_ram[offset]; ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1109 | case (0x4c2/2): { prot_data[0] = cop_mcu_ram[offset]; ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1110 | case (0x4a2/2): { prot_data[1] = cop_mcu_ram[offset]; ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1111 | case (0x4c4/2): { prot_data[0] = cop_mcu_ram[offset]; rom_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1112 | case (0x4a4/2): { prot_data[1] = cop_mcu_ram[offset]; rom_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1113 | case (0x4c6/2): { prot_data[0] = cop_mcu_ram[offset]; rom_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1114 | case (0x4a6/2): { prot_data[1] = cop_mcu_ram[offset]; rom_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1115 | ||
| 1116 | ||
| 1117 | /* Macros Command Trigger */ | |
| 1118 | case (0x500/2): | |
| 1119 | { | |
| 1120 | switch(cop_mcu_ram[0x500/2]) | |
| 1121 | { | |
| 1122 | case 0x8100: | |
| 1123 | break; | |
| 1124 | case 0x8900: | |
| 1125 | { | |
| 1126 | cop2_move3_prot(); | |
| 1127 | break; | |
| 1128 | } | |
| 1129 | case 0x205: | |
| 1130 | { | |
| 1131 | cop2_move2_prot(); | |
| 1132 | break; | |
| 1133 | } | |
| 1134 | case 0xa100: | |
| 1135 | break; | |
| 1136 | case 0xb080: | |
| 1137 | break; | |
| 1138 | case 0xa900: | |
| 1139 | break; | |
| 1140 | case 0xb880: | |
| 1141 | { | |
| 1142 | xy_check = cop2_hit_prot(); | |
| 1143 | break; | |
| 1144 | } | |
| 1145 | default: | |
| 1146 | logerror("DMA CMD 0x500 with parameter = %04x PC = %08x\n",cop_mcu_ram[offset],activecpu_get_previouspc()); | |
| 1147 | } | |
| 1148 | break; | |
| 1149 | } | |
| 1150 | ||
| 1151 | ||
| 1152 | /********************************************************************* | |
| 1153 | 600-6ff - Video Registers | |
| 1154 | *********************************************************************/ | |
| 1155 | ||
| 1156 | // 65a bit 0 is flipscreen | |
| 1157 | // 65c probably layer disables, like Dcon? Used on screen when you press P1-4 start (values 13, 11, 0 seen) | |
| 1158 | // 660 - 66a scroll control; is there a layer priority switch...? | |
| 1159 | case (0x660/2): { legionna_scrollram16[0] = cop_mcu_ram[offset]; break; } | |
| 1160 | case (0x662/2): { legionna_scrollram16[1] = cop_mcu_ram[offset]; break; } | |
| 1161 | case (0x664/2): { legionna_scrollram16[2] = cop_mcu_ram[offset]; break; } | |
| 1162 | case (0x666/2): { legionna_scrollram16[3] = cop_mcu_ram[offset]; break; } | |
| 1163 | case (0x668/2): { legionna_scrollram16[4] = cop_mcu_ram[offset]; break; } | |
| 1164 | case (0x66a/2): { legionna_scrollram16[5] = cop_mcu_ram[offset]; break; } | |
| 1165 | ||
| 1166 | /********************************************************************* | |
| 1167 | 700-7ff - Output (Seibu Sound System) | |
| 1168 | *********************************************************************/ | |
| 1169 | ||
| 1170 | case (0x7c0/2): { seibu_main_word_w(machine,0,cop_mcu_ram[offset],0xff00); break; } | |
| 1171 | case (0x7c4/2): { seibu_main_word_w(machine,1,cop_mcu_ram[offset],0xff00); break; } | |
| 1172 | case (0x7d0/2): { seibu_main_word_w(machine,4,cop_mcu_ram[offset],0xff00); break; } | |
| 1173 | case (0x7d8/2): { seibu_main_word_w(machine,6,cop_mcu_ram[offset],0xff00); break; } | |
| 1174 | } | |
| 1175 | } | |
| 1176 | ||
| 1177 | ||
| 1178 | READ16_HANDLER( sdgndmrb_cop_mcu_r ) | |
| 1179 | { | |
| 1180 | UINT16 retvalue = cop_mcu_ram[offset]; | |
| 1181 | ||
| 1182 | switch (offset) | |
| 1183 | { | |
| 1184 | default: | |
| 1185 | { | |
| 1186 | logerror("%06x: COPX unhandled read returning %04x from offset %04x\n", activecpu_get_pc(), retvalue, offset*2); | |
| 1187 | return retvalue; | |
| 1188 | } | |
| 1189 | ||
| 1190 | /*hit protection*/ | |
| 1191 | case (0x580/2): { return xy_check; } | |
| 1192 | ||
| 1193 | /* BCD protection */ | |
| 1194 | case (0x590/2): { return ((prot_bcd[0] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1195 | case (0x592/2): { return ((prot_bcd[0] & 0xffff0000) >> 16) + 0x3030; } | |
| 1196 | case (0x594/2): { return ((prot_bcd[1] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1197 | case (0x596/2): { return ((prot_bcd[1] & 0xffff0000) >> 16) + 0x3030; } | |
| 1198 | case (0x598/2): { return ((prot_bcd[2] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1199 | case (0x59a/2): { return ((prot_bcd[2] & 0xffff0000) >> 16) + 0x3030; } | |
| 1200 | case (0x59c/2): { return 0x3030; } | |
| 1201 | ||
| 1202 | case (0x5b0/2): | |
| 1203 | /*check if the DMA has been finished*/ | |
| 1204 | if(dma_status == 1) | |
| 1205 | { | |
| 1206 | dma_status = 0; | |
| 1207 | return 2; | |
| 1208 | } | |
| 1209 | return cop_mcu_ram[offset]; | |
| 1210 | ||
| 1211 | /* Non-protection reads */ | |
| 1212 | case (0x708/2): return seibu_main_word_r(machine,2,0); | |
| 1213 | case (0x70c/2): return seibu_main_word_r(machine,3,0); | |
| 1214 | case (0x714/2): return seibu_main_word_r(machine,5,0); | |
| 1215 | ||
| 1216 | /* Inputs */ | |
| 1217 | case (0x740/2): return input_port_1_word_r(machine,0,0); | |
| 1218 | case (0x744/2): return input_port_2_word_r(machine,0,0); | |
| 1219 | case (0x748/2): return input_port_4_word_r(machine,0,0); | |
| 1220 | case (0x74c/2): return input_port_3_word_r(machine,0,0); | |
| 1221 | case (0x75c/2): return input_port_5_word_r(machine,0,0); | |
| 1222 | } | |
| 1223 | } | |
| 1224 | ||
| 1225 | WRITE16_HANDLER( sdgndmrb_cop_mcu_w ) | |
| 1226 | { | |
| 1227 | COMBINE_DATA(&cop_mcu_ram[offset]); | |
| 1228 | ||
| 1229 | ||
| 1230 | switch (offset) | |
| 1231 | { | |
| 1232 | default: | |
| 1233 | { | |
| 1234 | logerror("%06x: COPX unhandled write data %04x at offset %04x\n", activecpu_get_pc(), data, offset*2); | |
| 1235 | break; | |
| 1236 | } | |
| 1237 | ||
| 1238 | /********************************************************************* | |
| 1239 | 400-5ff - Protection writes | |
| 1240 | *********************************************************************/ | |
| 1241 | ||
| 1242 | case (0x40c/2): { dma_size = cop_mcu_ram[offset]; break; } | |
| 1243 | ||
| 1244 | /*DMA source address*/ | |
| 1245 | case (0x412/2): { prot_data[1] = cop_mcu_ram[offset]; dma_src = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1246 | case (0x414/2): { prot_data[0] = cop_mcu_ram[offset]; dma_src = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1247 | ||
| 1248 | case (0x420/2): { prot_bcd[0] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1249 | case (0x422/2): { prot_bcd[1] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1250 | case (0x424/2): { prot_bcd[2] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1251 | ||
| 1252 | case (0x432/2): { copd2_set_tabledata(data, machine); break; } | |
| 1253 | case (0x434/2): { copd2_set_tableoffset(data, machine); break; } | |
| 1254 | case (0x438/2): {cop_438 = data; break; } | |
| 1255 | case (0x43a/2): {cop_43a = data; break; } | |
| 1256 | case (0x43c/2): {cop_43c = data; break; } | |
| 1257 | ||
| 1258 | case (0x478/2): | |
| 1259 | { | |
| 1260 | static UINT16 i; | |
| 1261 | /* | |
| 1262 | AM_RANGE(0x100800, 0x100fff) AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 1263 | AM_RANGE(0x101000, 0x1017ff) AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 1264 | AM_RANGE(0x101800, 0x101fff) AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 1265 | AM_RANGE(0x102000, 0x102fff) AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 1266 | */ | |
| 1267 | switch(cop_mcu_ram[offset]) | |
| 1268 | { | |
| 1269 | /*txt layer clearance*/ | |
| 1270 | case 0x4080: | |
| 1271 | for(i=0;i<0x1000;i+=2) | |
| 1272 | program_write_word(i+0x102000,0x0000); | |
| 1273 | break; | |
| 1274 | case 0x4100: break; | |
| 1275 | case 0x41c0: break; | |
| 1276 | //default: popmessage("%04x",cop_mcu_ram[offset]); | |
| 1277 | } | |
| 1278 | break; | |
| 1279 | } | |
| 1280 | ||
| 1281 | /*sprite ram clear(Guess)*/ | |
| 1282 | case (0x47e/2): | |
| 1283 | { | |
| 1284 | static UINT16 i; | |
| 1285 | if(cop_mcu_ram[0x47e/2] == 0x118) | |
| 1286 | { | |
| 1287 | for(i=0;i<0x800;i+=2) | |
| 1288 | program_write_word((0x107000 | i),0x0000); | |
| 1289 | } | |
| 1290 | break; | |
| 1291 | } | |
| 1292 | ||
| 1293 | /* MCU registers */ | |
| 1294 | case (0x4c0/2): { prot_data[0] = cop_mcu_ram[offset]; ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1295 | case (0x4a0/2): { prot_data[1] = cop_mcu_ram[offset]; ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1296 | case (0x4c2/2): { prot_data[0] = cop_mcu_ram[offset]; ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1297 | case (0x4a2/2): { prot_data[1] = cop_mcu_ram[offset]; ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1298 | case (0x4c4/2): { prot_data[0] = cop_mcu_ram[offset]; hit_check_x = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1299 | case (0x4a4/2): { prot_data[1] = cop_mcu_ram[offset]; hit_check_x = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1300 | case (0x4c6/2): { prot_data[0] = cop_mcu_ram[offset]; hit_check_y = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1301 | case (0x4a6/2): { prot_data[1] = cop_mcu_ram[offset]; hit_check_y = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); break; } | |
| 1302 | case (0x4c8/2): { prot_data[0] = cop_mcu_ram[offset]; dma_dst = ((prot_data[0]&0xffff)+4)|((prot_data[1]&0xffff)<<16); break; } | |
| 1303 | case (0x4a8/2): { prot_data[1] = cop_mcu_ram[offset]; dma_dst = ((prot_data[0]&0xffff)+4)|((prot_data[1]&0xffff)<<16); break; } | |
| 1304 | ||
| 1305 | /* Execute Macro Command */ | |
| 1306 | case (0x500/2): | |
| 1307 | { | |
| 1308 | switch(cop_mcu_ram[0x500/2]) | |
| 1309 | { | |
| 1310 | case 0xa180:/*do the job [1]*/ | |
| 1311 | { | |
| 1312 | //popmessage("%08x %08x %04x",dma_src,dma_dst,dma_size); | |
| 1313 | /*fix the offset for easier reading*/ | |
| 1314 | dma_src+=4; | |
| 1315 | //dma_dst+=4; | |
| 1316 | s_i = dma_size; | |
| 1317 | //dma_dst+=((program_read_word(0x110000) & 0x000f) * 8); | |
| 1318 | //program_write_word(0x1004c8,dma_dst & 0xffff); | |
| 1319 | //dma_status = 1; | |
| 1320 | break; | |
| 1321 | } | |
| 1322 | case 0xb100: | |
| 1323 | break; | |
| 1324 | case 0xa980: | |
| 1325 | break; | |
| 1326 | case 0xb900: | |
| 1327 | { | |
| 1328 | xy_check = hit_check_jsr(); | |
| 1329 | break; | |
| 1330 | } | |
| 1331 | /*bullet movement protection,conflicts with [3],will be worked out*/ | |
| 1332 | case 0x8100: | |
| 1333 | { | |
| 1334 | //move3x_prot_jsr(); | |
| 1335 | break; | |
| 1336 | } | |
| 1337 | case 0x8900: | |
| 1338 | { | |
| 1339 | //move3y_prot_jsr(); | |
| 1340 | break; | |
| 1341 | } | |
| 1342 | case 0x0205:/*do the job [3]*/ | |
| 1343 | { | |
| 1344 | moveprot_jsr(); | |
| 1345 | break; | |
| 1346 | } | |
| 1347 | case 0x138e:/*do the job [4]*/ | |
| 1348 | break; | |
| 1349 | case 0x3bb0: | |
| 1350 | { | |
| 1351 | move2prot_jsr(); | |
| 1352 | break; | |
| 1353 | } | |
| 1354 | default: | |
| 1355 | logerror("DMA CMD 0x500 with parameter = %04x PC = %08x\n",cop_mcu_ram[offset],activecpu_get_previouspc()); | |
| 1356 | } | |
| 1357 | break; | |
| 1358 | } | |
| 1359 | ||
| 1360 | case (0x502/2): | |
| 1361 | { | |
| 1362 | if(cop_mcu_ram[0x502/2] == 0xc480) | |
| 1363 | { | |
| 1364 | dma_transfer(); | |
| 1365 | s_i--; | |
| 1366 | if(s_i == 0) | |
| 1367 | dma_status = 1; | |
| 1368 | } | |
| 1369 | break; | |
| 1370 | } | |
| 1371 | ||
| 1372 | /*Layer Enable,bit wise active low*/ | |
| 1373 | case (0x61c/2): | |
| 1374 | { | |
| 1375 | /* | |
| 1376 | ---x ---- (used in test mode) | |
| 1377 | ---- x--- Text Layer | |
| 1378 | ---- -x-- Foreground Layer | |
| 1379 | ---- --x- Midground Layer | |
| 1380 | ---- ---x Background Layer | |
| 1381 | */ | |
| 1382 | sdgndmrb_pri_n = cop_mcu_ram[offset] & 0xf; | |
| 1383 | break; | |
| 1384 | } | |
| 1385 | ||
| 1386 | /* TODO: tilemaps x-axis are offset,we use a temporary kludge for now */ | |
| 1387 | case (0x620/2): { legionna_scrollram16[0] = 0x10 + cop_mcu_ram[offset]; break; } | |
| 1388 | case (0x622/2): { legionna_scrollram16[1] = cop_mcu_ram[offset]; break; } | |
| 1389 | case (0x624/2): { legionna_scrollram16[2] = 0x10 + cop_mcu_ram[offset]; break; } | |
| 1390 | case (0x626/2): { legionna_scrollram16[3] = cop_mcu_ram[offset]; break; } | |
| 1391 | case (0x628/2): { legionna_scrollram16[4] = 0x10 + cop_mcu_ram[offset]; break; } | |
| 1392 | case (0x62a/2): { legionna_scrollram16[5] = cop_mcu_ram[offset]; break; } | |
| 1393 | ||
| 1394 | /* scroll mirrors? */ | |
| 1395 | case (0x62c/2): | |
| 1396 | case (0x62e/2): | |
| 1397 | case (0x630/2): | |
| 1398 | case (0x632/2): | |
| 1399 | case (0x634/2): | |
| 1400 | case (0x636/2): | |
| 1401 | break; | |
| 1402 | ||
| 1403 | ||
| 1404 | /* Text Layer scroll registers */ | |
| 1405 | case (0x638/2): { legionna_scrollram16[6] = 0x38 + cop_mcu_ram[offset]; break; } | |
| 1406 | case (0x63a/2): { legionna_scrollram16[7] = cop_mcu_ram[offset]; break; } | |
| 1407 | /*C.R.T. Controller (note:game calls it OBJ register)*/ | |
| 1408 | case (0x644/2): | |
| 1409 | { | |
| 1410 | /* | |
| 1411 | data = setting | |
| 1412 | 0x01e = 320x256 | |
| 1413 | 0x0e1 = 320x256 REVERSE | |
| 1414 | 0x016 = 320x240 | |
| 1415 | 0x0e9 = 320x240 REVERSE | |
| 1416 | 0x004 = 320x224 | |
| 1417 | 0x10b = 320x224 REVERSE | |
| 1418 | It is like to be per cases and not per bits. | |
| 1419 | */ | |
| 1420 | switch(data) | |
| 1421 | { | |
| 1422 | case 0x0000: | |
| 1423 | case 0x0003: | |
| 1424 | case 0x001e: CRT_MODE(320,224,0); break; | |
| 1425 | case 0x00e1: CRT_MODE(320,224,1); break; | |
| 1426 | case 0x0016: CRT_MODE(320,256,0); break; | |
| 1427 | case 0x00e9: CRT_MODE(320,256,1); break; | |
| 1428 | case 0x0004: CRT_MODE(320,240,0); break; | |
| 1429 | case 0x00fb: CRT_MODE(320,240,1); break; | |
| 1430 | default: | |
| 1431 | #ifdef MAME_DEBUG | |
| 1432 | popmessage("Warning: Undefined CRT Mode %04x",data); | |
| 1433 | #endif | |
| 1434 | CRT_MODE(320,256,0); | |
| 1435 | } | |
| 1436 | } | |
| 1437 | break; | |
| 1438 | ||
| 1439 | /* Seems a mirror for the choices in the test menu... */ | |
| 1440 | case (0x67c/2): break; | |
| 1441 | case (0x680/2): break; | |
| 1442 | case (0x6fc/2): break; | |
| 1443 | ||
| 1444 | case (0x700/2): { seibu_main_word_w(machine,0,cop_mcu_ram[offset],0xff00); break; } | |
| 1445 | case (0x704/2): { seibu_main_word_w(machine,1,cop_mcu_ram[offset],0xff00); break; } | |
| 1446 | case (0x710/2): { seibu_main_word_w(machine,4,cop_mcu_ram[offset],0xff00); break; } | |
| 1447 | case (0x718/2): { seibu_main_word_w(machine,6,cop_mcu_ram[offset],0xff00); break; } | |
| 1448 | } | |
| 1449 | } | |
| 1450 | ||
| 1451 | READ16_HANDLER( denjinmk_cop_mcu_r ) | |
| 1452 | { | |
| 1453 | UINT16 retvalue = cop_mcu_ram[offset]; | |
| 1454 | ||
| 1455 | switch (offset) | |
| 1456 | { | |
| 1457 | default: | |
| 1458 | { | |
| 1459 | logerror("%06x: COPX unhandled read returning %04x from offset %04x\n", activecpu_get_pc(), retvalue, offset*2); | |
| 1460 | return retvalue; | |
| 1461 | } | |
| 1462 | ||
| 1463 | /* BCD protection */ | |
| 1464 | case (0x590/2): { return ((prot_bcd[0] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1465 | case (0x592/2): { return ((prot_bcd[0] & 0xffff0000) >> 16) + 0x3030; } | |
| 1466 | case (0x594/2): { return ((prot_bcd[1] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1467 | case (0x596/2): { return ((prot_bcd[1] & 0xffff0000) >> 16) + 0x3030; } | |
| 1468 | case (0x598/2): { return ((prot_bcd[2] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1469 | case (0x59a/2): { return ((prot_bcd[2] & 0xffff0000) >> 16) + 0x3030; } | |
| 1470 | case (0x59c/2): { return 0x3030; } | |
| 1471 | ||
| 1472 | /* Non-protection reads */ | |
| 1473 | ||
| 1474 | case (0x708/2): return seibu_main_word_r(machine,2,0); | |
| 1475 | case (0x70c/2): return seibu_main_word_r(machine,3,0); | |
| 1476 | case (0x714/2): return seibu_main_word_r(machine,5,0); | |
| 1477 | ||
| 1478 | /* Inputs */ | |
| 1479 | case (0x740/2): return input_port_1_word_r(machine,0,0); | |
| 1480 | case (0x744/2): return input_port_2_word_r(machine,0,0); | |
| 1481 | case (0x748/2): return input_port_4_word_r(machine,0,0); | |
| 1482 | case (0x74c/2): return input_port_3_word_r(machine,0,0); | |
| 1483 | case (0x75c/2): return input_port_5_word_r(machine,0,0); | |
| 1484 | ||
| 1485 | } | |
| 1486 | } | |
| 1487 | ||
| 1488 | WRITE16_HANDLER( denjinmk_cop_mcu_w ) | |
| 1489 | { | |
| 1490 | COMBINE_DATA(&cop_mcu_ram[offset]); | |
| 1491 | ||
| 1492 | switch (offset) | |
| 1493 | { | |
| 1494 | default: | |
| 1495 | { | |
| 1496 | logerror("%06x: COPX unhandled write data %04x at offset %04x\n", activecpu_get_pc(), data, offset*2); | |
| 1497 | break; | |
| 1498 | } | |
| 1499 | ||
| 1500 | /********************************************************************* | |
| 1501 | 400-5ff - Protection writes | |
| 1502 | *********************************************************************/ | |
| 1503 | ||
| 1504 | case (0x420/2): { prot_bcd[0] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1505 | case (0x422/2): { prot_bcd[1] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1506 | case (0x424/2): { prot_bcd[2] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1507 | ||
| 1508 | case (0x432/2): { copd2_set_tabledata(data, machine); break; } | |
| 1509 | case (0x434/2): { copd2_set_tableoffset(data, machine); break; } | |
| 1510 | case (0x438/2): {cop_438 = data; break; } | |
| 1511 | case (0x43a/2): {cop_43a = data; break; } | |
| 1512 | case (0x43c/2): {cop_43c = data; break; } | |
| 1513 | ||
| 1514 | ||
| 1515 | /* again, strange, this is a video register */ | |
| 1516 | case (0x470/2): { denjinmk_setgfxbank( cop_mcu_ram[offset] ); break; } | |
| 1517 | ||
| 1518 | case (0x620/2): { legionna_scrollram16[0] = cop_mcu_ram[offset]; break; } | |
| 1519 | case (0x622/2): { legionna_scrollram16[1] = cop_mcu_ram[offset]; break; } | |
| 1520 | case (0x624/2): { legionna_scrollram16[2] = cop_mcu_ram[offset]; break; } | |
| 1521 | case (0x626/2): { legionna_scrollram16[3] = cop_mcu_ram[offset]; break; } | |
| 1522 | case (0x628/2): { legionna_scrollram16[4] = cop_mcu_ram[offset]; break; } | |
| 1523 | case (0x62a/2): { legionna_scrollram16[5] = cop_mcu_ram[offset]; break; } | |
| 1524 | ||
| 1525 | case (0x700/2): { seibu_main_word_w(machine,0,cop_mcu_ram[offset],0xff00); break; } | |
| 1526 | case (0x704/2): { seibu_main_word_w(machine,1,cop_mcu_ram[offset],0xff00); break; } | |
| 1527 | case (0x710/2): { seibu_main_word_w(machine,4,cop_mcu_ram[offset],0xff00); break; } | |
| 1528 | case (0x718/2): { seibu_main_word_w(machine,6,cop_mcu_ram[offset],0xff00); break; } | |
| 1529 | } | |
| 1530 | } | |
| 1531 | ||
| 1532 | READ16_HANDLER( godzilla_cop_mcu_r ) | |
| 1533 | { | |
| 1534 | UINT16 retvalue = cop_mcu_ram[offset]; | |
| 1535 | ||
| 1536 | switch (offset) | |
| 1537 | { | |
| 1538 | default: | |
| 1539 | { | |
| 1540 | logerror("%06x: COPX unhandled read returning %04x from offset %04x\n", activecpu_get_pc(), retvalue, offset*2); | |
| 1541 | return retvalue; | |
| 1542 | } | |
| 1543 | ||
| 1544 | /* BCD protection */ | |
| 1545 | case (0x590/2): { return ((prot_bcd[0] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1546 | case (0x592/2): { return ((prot_bcd[0] & 0xffff0000) >> 16) + 0x3030; } | |
| 1547 | case (0x594/2): { return ((prot_bcd[1] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1548 | case (0x596/2): { return ((prot_bcd[1] & 0xffff0000) >> 16) + 0x3030; } | |
| 1549 | case (0x598/2): { return ((prot_bcd[2] & 0x0000ffff) >> 0 ) + 0x3030; } | |
| 1550 | case (0x59a/2): { return ((prot_bcd[2] & 0xffff0000) >> 16) + 0x3030; } | |
| 1551 | case (0x59c/2): { return 0x3030; } | |
| 1552 | ||
| 1553 | /* Non-protection reads */ | |
| 1554 | case (0x7c8/2): return seibu_main_word_r(machine,2,0); | |
| 1555 | case (0x7cc/2): return seibu_main_word_r(machine,3,0); | |
| 1556 | case (0x7d4/2): return seibu_main_word_r(machine,5,0); | |
| 1557 | ||
| 1558 | /* Inputs */ | |
| 1559 | case (0x740/2): return input_port_1_word_r(machine,0,0); | |
| 1560 | case (0x744/2): return input_port_2_word_r(machine,0,0); | |
| 1561 | case (0x748/2): return input_port_4_word_r(machine,0,0); | |
| 1562 | case (0x74c/2): return input_port_3_word_r(machine,0,0); | |
| 1563 | } | |
| 1564 | } | |
| 1565 | ||
| 1566 | WRITE16_HANDLER( godzilla_cop_mcu_w ) | |
| 1567 | { | |
| 1568 | COMBINE_DATA(&cop_mcu_ram[offset]); | |
| 1569 | ||
| 1570 | switch (offset) | |
| 1571 | { | |
| 1572 | default: | |
| 1573 | { | |
| 1574 | logerror("%06x: COPX unhandled write data %04x at offset %04x\n", activecpu_get_pc(), data, offset*2); | |
| 1575 | break; | |
| 1576 | } | |
| 1577 | ||
| 1578 | /********************************************************************* | |
| 1579 | 400-5ff - Protection writes | |
| 1580 | *********************************************************************/ | |
| 1581 | ||
| 1582 | case (0x420/2): { prot_bcd[0] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1583 | case (0x422/2): { prot_bcd[1] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1584 | case (0x424/2): { prot_bcd[2] = protection_bcd_jsr(cop_mcu_ram[offset]); break; } | |
| 1585 | ||
| 1586 | case (0x432/2): { copd2_set_tabledata(data, machine); break; } | |
| 1587 | case (0x434/2): { copd2_set_tableoffset(data, machine); break; } | |
| 1588 | case (0x438/2): {cop_438 = data; break; } | |
| 1589 | case (0x43a/2): {cop_43a = data; break; } | |
| 1590 | case (0x43c/2): {cop_43c = data; break; } | |
| 1591 | ||
| 1592 | /* Layer Clear */ | |
| 1593 | case (0x478/2): | |
| 1594 | { | |
| 1595 | static UINT16 i; | |
| 1596 | /* | |
| 1597 | */ | |
| 1598 | switch(cop_mcu_ram[offset]) | |
| 1599 | { | |
| 1600 | /*txt layer clearance*/ | |
| 1601 | case 0x40a0: | |
| 1602 | for(i=0;i<0x1000;i+=2) | |
| 1603 | program_write_word(i+0x102800,0x0000); | |
| 1604 | break; | |
| 1605 | case 0x4040: break; | |
| 1606 | case 0x4140: break; | |
| 1607 | case 0x4180: break; | |
| 1608 | case 0x4100: break; | |
| 1609 | case 0x41c0: break; | |
| 1610 | //default: popmessage("%04x",cop_mcu_ram[offset]); | |
| 1611 | } | |
| 1612 | break; | |
| 1613 | } | |
| 1614 | ||
| 1615 | case (0x620/2): { legionna_scrollram16[0] = cop_mcu_ram[offset]; break; } | |
| 1616 | case (0x622/2): { legionna_scrollram16[1] = cop_mcu_ram[offset]; break; } | |
| 1617 | case (0x624/2): { legionna_scrollram16[2] = cop_mcu_ram[offset]; break; } | |
| 1618 | case (0x626/2): { legionna_scrollram16[3] = cop_mcu_ram[offset]; break; } | |
| 1619 | case (0x628/2): { legionna_scrollram16[4] = cop_mcu_ram[offset]; break; } | |
| 1620 | case (0x62a/2): { legionna_scrollram16[5] = cop_mcu_ram[offset]; break; } | |
| 1621 | ||
| 1622 | case (0x7c0/2): { seibu_main_word_w(machine,0,cop_mcu_ram[offset],0xff00); break; } | |
| 1623 | case (0x7c4/2): { seibu_main_word_w(machine,1,cop_mcu_ram[offset],0xff00); break; } | |
| 1624 | case (0x7d0/2): { seibu_main_word_w(machine,4,cop_mcu_ram[offset],0xff00); break; } | |
| 1625 | case (0x7d8/2): { seibu_main_word_w(machine,6,cop_mcu_ram[offset],0xff00); break; } | |
| 1626 | } | |
| 1627 | } | |
| 1628 | ||
| 1629 | /******************************************************************************************** | |
| 1630 | ||
| 1631 | COPX simulation | |
| 1632 | - Seibu Cup Soccer | |
| 1633 | ||
| 1634 | *******************************************************************************************/ | |
| 1635 | ||
| 1636 | ||
| 1637 | READ16_HANDLER( copdx_0_r ) | |
| 1638 | { | |
| 1639 | UINT16 retvalue = cop_mcu_ram[offset]; | |
| 1640 | ||
| 1641 | switch(offset) | |
| 1642 | { | |
| 1643 | default: | |
| 1644 | { | |
| 1645 | logerror("%06x: COPX unhandled read returning %04x from offset %04x\n", activecpu_get_pc(), retvalue, offset*2); | |
| 1646 | return retvalue; | |
| 1647 | } | |
| 1648 | ||
| 1649 | //case (0x47e/2): | |
| 1650 | //case (0x5b0/2): | |
| 1651 | //case (0x5b4/2): | |
| 1652 | // return cop_mcu_ram[offset]; | |
| 1653 | ||
| 1654 | case (0x700/2): return input_port_1_word_r(machine,0,0); | |
| 1655 | case (0x704/2): return input_port_2_word_r(machine,0,0); | |
| 1656 | case (0x708/2): return input_port_4_word_r(machine,0,0); | |
| 1657 | case (0x70c/2): return input_port_3_word_r(machine,0,0); | |
| 1658 | ||
| 1659 | case (0x71c/2): return input_port_5_word_r(machine,0,0); | |
| 1660 | case (0x748/2): return seibu_main_word_r(machine,2,0); | |
| 1661 | case (0x74c/2): return seibu_main_word_r(machine,3,0); | |
| 1662 | case (0x754/2): return seibu_main_word_r(machine,5,0); | |
| 1663 | } | |
| 1664 | } | |
| 1665 | ||
| 1666 | static UINT16 cop_fct; | |
| 1667 | static UINT32 cop_reg[8]; | |
| 1668 | ||
| 1669 | /*This is version 1,so some stuff is different (less complex)*/ | |
| 1670 | static void cop_run(void) | |
| 1671 | { | |
| 1672 | switch(cop_fct) | |
| 1673 | { | |
| 1674 | /*???*/ | |
| 1675 | case 0x8100: | |
| 1676 | { | |
| 1677 | UINT32 src = cop_reg[0]; | |
| 1678 | program_write_word(src+0x36,0xffc0); | |
| 1679 | break; | |
| 1680 | } | |
| 1681 | case 0x8900: | |
| 1682 | { | |
| 1683 | UINT32 src = cop_reg[0]; | |
| 1684 | program_write_word(src+0x36,0xff80); | |
| 1685 | break; | |
| 1686 | } | |
| 1687 | /*Right*/ | |
| 1688 | case 0x0205: | |
| 1689 | { | |
| 1690 | UINT32 src = cop_reg[0]; | |
| 1691 | INT16 y = program_read_word(src+0x4); | |
| 1692 | INT16 x = program_read_word(src+0x8); | |
| 1693 | INT16 y_rel = program_read_word(src+0x10); | |
| 1694 | INT16 x_rel = program_read_word(src+0x14); | |
| 1695 | program_write_word(src+0x4,(y+y_rel)); | |
| 1696 | program_write_word(src+0x8,(x+x_rel)); | |
| 1697 | /*logerror("%08x %08x %08x %08x %08x\n",cop_reg[0], | |
| 1698 | program_read_word(cop_reg[0]+0x4), | |
| 1699 | program_read_word(cop_reg[0]+0x8), | |
| 1700 | program_read_word(cop_reg[0]+0x10), | |
| 1701 | program_read_word(cop_reg[0]+0x14));*/ | |
| 1702 | break; | |
| 1703 | } | |
| 1704 | /*???*/ | |
| 1705 | case 0x3bb0: | |
| 1706 | { | |
| 1707 | //UINT32 dst = cop_reg[0]; | |
| 1708 | //UINT32 dst = cop_reg[1]; | |
| 1709 | //program_write_word(dst, mame_rand(Machine)/*program_read_word(src)*/); | |
| 1710 | //program_write_word(dst+2,mame_rand(Machine)/*program_read_word(src+2)*/); | |
| 1711 | //program_write_word(dst+4,mame_rand(Machine)/*program_read_word(src+4)*/); | |
| 1712 | //program_write_word(dst+6,mame_rand(Machine)/*program_read_word(src+6)*/); | |
| 1713 | //logerror("%04x\n",cop_reg[0]); | |
| 1714 | break; | |
| 1715 | } | |
| 1716 | default: | |
| 1717 | //logerror("%04x\n",cop_fct); | |
| 1718 | break; | |
| 1719 | } | |
| 1720 | } | |
| 1721 | //tmp_data[1] = cop_mcu_ram[offset]; | |
| 1722 | //cop_reg[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1723 | ||
| 1724 | static void cop_reg_w(UINT16 data,UINT8 offset,UINT8 mask) | |
| 1725 | { | |
| 1726 | if(mask) | |
| 1727 | cop_reg[offset] = ((data&0xffff)<<16) | (cop_reg[offset]&0xffff); | |
| 1728 | else | |
| 1729 | cop_reg[offset] = (cop_reg[offset]&0xffff0000) | (data&0xffff); | |
| 1730 | ||
| 1731 | //popmessage("%08x",cop_reg[offset]); | |
| 1732 | } | |
| 1733 | ||
| 1734 | WRITE16_HANDLER( copdx_0_w ) | |
| 1735 | { | |
| 1736 | ||
| 1737 | COMBINE_DATA(&cop_mcu_ram[offset]); | |
| 1738 | ||
| 1739 | switch(offset) | |
| 1740 | { | |
| 1741 | default: | |
| 1742 | { | |
| 1743 | logerror("%06x: COPX unhandled write data %04x at offset %04x\n", activecpu_get_pc(), data, offset*2); | |
| 1744 | break; | |
| 1745 | } | |
| 1746 | ||
| 1747 | /********************************************************************* | |
| 1748 | 400-5ff - Protection writes | |
| 1749 | *********************************************************************/ | |
| 1750 | ||
| 1751 | case (0x432/2): { copd2_set_tabledata(data, machine); break; } | |
| 1752 | case (0x434/2): { copd2_set_tableoffset(data, machine); break; } | |
| 1753 | case (0x438/2): {cop_438 = data; break; } | |
| 1754 | case (0x43a/2): {cop_43a = data; break; } | |
| 1755 | case (0x43c/2): {cop_43c = data; break; } | |
| 1756 | ||
| 1757 | case (0x4a0/2): | |
| 1758 | case (0x4a2/2): | |
| 1759 | case (0x4a4/2): | |
| 1760 | case (0x4a6/2): | |
| 1761 | case (0x4a8/2): | |
| 1762 | case (0x4aa/2): | |
| 1763 | case (0x4ac/2): | |
| 1764 | case (0x4ae/2): | |
| 1765 | case (0x4c0/2): | |
| 1766 | case (0x4c2/2): | |
| 1767 | case (0x4c4/2): | |
| 1768 | case (0x4c6/2): | |
| 1769 | case (0x4c8/2): | |
| 1770 | case (0x4ca/2): | |
| 1771 | case (0x4cc/2): | |
| 1772 | case (0x4ce/2): | |
| 1773 | cop_reg_w(cop_mcu_ram[offset],offset & 0x000f, (offset < (0x4b0/2)) ? 1 : 0); | |
| 1774 | break; | |
| 1775 | /*layer clearance,but the bootleg doesn't send values,so this function is an | |
| 1776 | original left-over.*/ | |
| 1777 | case (0x478/2): | |
| 1778 | { | |
| 1779 | /* | |
| 1780 | AM_RANGE(0x100800, 0x100fff) AM_READWRITE(SMH_RAM,legionna_background_w) AM_BASE(&legionna_back_data) | |
| 1781 | AM_RANGE(0x101000, 0x1017ff) AM_READWRITE(SMH_RAM,legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 1782 | AM_RANGE(0x101800, 0x101fff) AM_READWRITE(SMH_RAM,legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 1783 | AM_RANGE(0x102000, 0x102fff) AM_READWRITE(SMH_RAM,legionna_text_w) AM_BASE(&legionna_textram) | |
| 1784 | */ | |
| 1785 | break; | |
| 1786 | } | |
| 1787 | ||
| 1788 | /* Trigger Macro Command */ | |
| 1789 | case (0x500/2): | |
| 1790 | { | |
| 1791 | cop_fct = cop_mcu_ram[offset]; | |
| 1792 | cop_run(); | |
| 1793 | break; | |
| 1794 | } | |
| 1795 | ||
| 1796 | /* Video Regs */ | |
| 1797 | case (0x604/2): | |
| 1798 | { | |
| 1799 | //C.R.T. Controller | |
| 1800 | /* | |
| 1801 | data = setting | |
| 1802 | 0x01e = 320x256 ---- ---x xxx- | |
| 1803 | 0x0e1 = 320x256 REVERSE ---- xxx- ---x | |
| 1804 | 0x016 = 320x240 ---- ---x -xx- | |
| 1805 | 0x0e9 = 320x240 REVERSE ---- xxx- x--x | |
| 1806 | 0x004 = 320x224 ---- ---- -x-- | |
| 1807 | 0x10b = 320x224 REVERSE ---x ---- x-xx | |
| 1808 | For now we use this by cases and not per bits. | |
| 1809 | */ | |
| 1810 | ||
| 1811 | switch(data) | |
| 1812 | { | |
| 1813 | case 0x0000: | |
| 1814 | case 0x001e: CRT_MODE(320,256,0); break; | |
| 1815 | case 0x00e1: CRT_MODE(320,256,1); break; | |
| 1816 | case 0x0016: CRT_MODE(320,240,0); break; | |
| 1817 | case 0x00e9: CRT_MODE(320,240,1); break; | |
| 1818 | case 0x0004: CRT_MODE(320,224,0); break; | |
| 1819 | case 0x010b: CRT_MODE(320,224,1); break; | |
| 1820 | default: | |
| 1821 | #ifdef MAME_DEBUG | |
| 1822 | popmessage("Warning: Undefined CRT Mode %04x",data); | |
| 1823 | #endif | |
| 1824 | CRT_MODE(320,256,0); | |
| 1825 | } | |
| 1826 | break; | |
| 1827 | } | |
| 1828 | /*TODO: what's going on here,some scroll values aren't sent in these locations | |
| 1829 | but somewhere else?*/ | |
| 1830 | case (0x62c/2): { legionna_scrollram16[0] = cop_mcu_ram[offset]; break; } | |
| 1831 | case (0x62e/2): { legionna_scrollram16[1] = cop_mcu_ram[offset]; break; } | |
| 1832 | case (0x630/2): { legionna_scrollram16[2] = cop_mcu_ram[offset]; break; } | |
| 1833 | case (0x632/2): { legionna_scrollram16[3] = cop_mcu_ram[offset]; break; } | |
| 1834 | case (0x634/2): { legionna_scrollram16[4] = cop_mcu_ram[offset]; break; } | |
| 1835 | case (0x636/2): { legionna_scrollram16[5] = cop_mcu_ram[offset]; break; } | |
| 1836 | case (0x638/2): { legionna_scrollram16[6] = cop_mcu_ram[offset]; break; } | |
| 1837 | case (0x63a/2): { legionna_scrollram16[7] = cop_mcu_ram[offset]; break; } | |
| 1838 | /*video regs (not scrollram,something else)*/ | |
| 1839 | //case (0x660/2): | |
| 1840 | //case (0x662/2): | |
| 1841 | //case (0x664/2): | |
| 1842 | //case (0x666/2): | |
| 1843 | //case (0x668/2): | |
| 1844 | //case (0x66a/2): | |
| 1845 | //case (0x66c/2): | |
| 1846 | //case (0x66e/2): | |
| 1847 | // break; | |
| 1848 | ||
| 1849 | case (0x740/2): { seibu_main_word_w(machine,0,cop_mcu_ram[offset],0xff00); break; } | |
| 1850 | case (0x744/2): { seibu_main_word_w(machine,1,cop_mcu_ram[offset],0xff00); break; } | |
| 1851 | case (0x750/2): { seibu_main_word_w(machine,4,cop_mcu_ram[offset],0xff00); break; } | |
| 1852 | case (0x758/2): { seibu_main_word_w(machine,6,cop_mcu_ram[offset],0xff00); break; } | |
| 1853 | } | |
| 1854 | } | |
| 1855 | ||
| 1856 | /******************************************************************************************** | |
| 1857 | ||
| 1858 | COPX bootleg simulation | |
| 1859 | - Seibu Cup Soccer (bootleg) | |
| 1860 | ||
| 1861 | *******************************************************************************************/ | |
| 1862 | ||
| 1863 | READ16_HANDLER( copdxbl_0_r ) | |
| 1864 | { | |
| 1865 | UINT16 retvalue = cop_mcu_ram[offset]; | |
| 1866 | ||
| 1867 | switch(offset) | |
| 1868 | { | |
| 1869 | default: | |
| 1870 | { | |
| 1871 | logerror("%06x: COPX unhandled read returning %04x from offset %04x\n", activecpu_get_pc(), retvalue, offset*2); | |
| 1872 | return retvalue; | |
| 1873 | } | |
| 1874 | ||
| 1875 | //case (0x47e/2): | |
| 1876 | //case (0x5b0/2): | |
| 1877 | //case (0x5b4/2): | |
| 1878 | // return cop_mcu_ram[offset]; | |
| 1879 | ||
| 1880 | case (0x700/2): return input_port_1_word_r(machine,0,0); | |
| 1881 | case (0x704/2): return input_port_2_word_r(machine,0,0); | |
| 1882 | case (0x708/2): return input_port_4_word_r(machine,0,0); | |
| 1883 | case (0x70c/2): return input_port_3_word_r(machine,0,0); | |
| 1884 | case (0x71c/2): return input_port_5_word_r(machine,0,0); | |
| 1885 | } | |
| 1886 | } | |
| 1887 | ||
| 1888 | WRITE16_HANDLER( copdxbl_0_w ) | |
| 1889 | { | |
| 1890 | COMBINE_DATA(&cop_mcu_ram[offset]); | |
| 1891 | ||
| 1892 | switch(offset) | |
| 1893 | { | |
| 1894 | ||
| 1895 | default: | |
| 1896 | { | |
| 1897 | logerror("%06x: COPX unhandled write data %04x at offset %04x\n", activecpu_get_pc(), data, offset*2); | |
| 1898 | break; | |
| 1899 | } | |
| 1900 | ||
| 1901 | /********************************************************************* | |
| 1902 | 400-5ff - Protection writes | |
| 1903 | *********************************************************************/ | |
| 1904 | ||
| 1905 | ||
| 1906 | case (0x4a0/2): | |
| 1907 | case (0x4a2/2): | |
| 1908 | case (0x4a4/2): | |
| 1909 | case (0x4a6/2): | |
| 1910 | case (0x4a8/2): | |
| 1911 | case (0x4aa/2): | |
| 1912 | case (0x4ac/2): | |
| 1913 | case (0x4ae/2): | |
| 1914 | case (0x4c0/2): | |
| 1915 | case (0x4c2/2): | |
| 1916 | case (0x4c4/2): | |
| 1917 | case (0x4c6/2): | |
| 1918 | case (0x4c8/2): | |
| 1919 | case (0x4ca/2): | |
| 1920 | case (0x4cc/2): | |
| 1921 | case (0x4ce/2): | |
| 1922 | cop_reg_w(cop_mcu_ram[offset],offset & 0x000f, (offset < (0x4b0/2)) ? 1 : 0); | |
| 1923 | break; | |
| 1924 | /*layer clearance,but the bootleg doesn't send values,so this function | |
| 1925 | is an original left-over.*/ | |
| 1926 | case (0x478/2): | |
| 1927 | { | |
| 1928 | /* | |
| 1929 | AM_RANGE(0x100800, 0x100fff) AM_READWRITE(SMH_RAM,legionna_background_w) AM_BASE(&legionna_back_data) | |
| 1930 | AM_RANGE(0x101000, 0x1017ff) AM_READWRITE(SMH_RAM,legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 1931 | AM_RANGE(0x101800, 0x101fff) AM_READWRITE(SMH_RAM,legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 1932 | AM_RANGE(0x102000, 0x102fff) AM_READWRITE(SMH_RAM,legionna_text_w) AM_BASE(&legionna_textram) | |
| 1933 | */ | |
| 1934 | break; | |
| 1935 | } | |
| 1936 | case (0x500/2): | |
| 1937 | { | |
| 1938 | cop_fct = cop_mcu_ram[offset]; | |
| 1939 | cop_run(); | |
| 1940 | break; | |
| 1941 | } | |
| 1942 | case (0x604/2): | |
| 1943 | { | |
| 1944 | //C.R.T. Controller | |
| 1945 | /* | |
| 1946 | data = setting | |
| 1947 | 0x01e = 320x256 ---- ---x xxx- | |
| 1948 | 0x0e1 = 320x256 REVERSE ---- xxx- ---x | |
| 1949 | 0x016 = 320x240 ---- ---x -xx- | |
| 1950 | 0x0e9 = 320x240 REVERSE ---- xxx- x--x | |
| 1951 | 0x004 = 320x224 ---- ---- -x-- | |
| 1952 | 0x10b = 320x224 REVERSE ---x ---- x-xx | |
| 1953 | For now we use this by cases and not per bits. | |
| 1954 | */ | |
| 1955 | ||
| 1956 | switch(data) | |
| 1957 | { | |
| 1958 | case 0x0000: | |
| 1959 | case 0x001e: CRT_MODE(320,256,0); break; | |
| 1960 | case 0x00e1: CRT_MODE(320,256,1); break; | |
| 1961 | case 0x0016: CRT_MODE(320,240,0); break; | |
| 1962 | case 0x00e9: CRT_MODE(320,240,1); break; | |
| 1963 | case 0x0004: CRT_MODE(320,224,0); break; | |
| 1964 | case 0x010b: CRT_MODE(320,224,1); break; | |
| 1965 | default: | |
| 1966 | #ifdef MAME_DEBUG | |
| 1967 | popmessage("Warning: Undefined CRT Mode %04x",data); | |
| 1968 | #endif | |
| 1969 | CRT_MODE(320,256,0); | |
| 1970 | } | |
| 1971 | break; | |
| 1972 | } | |
| 1973 | /*TODO: kludge on x-axis.*/ | |
| 1974 | case (0x660/2): { legionna_scrollram16[0] = cop_mcu_ram[offset] - 0x1f0; break; } | |
| 1975 | case (0x662/2): { legionna_scrollram16[1] = cop_mcu_ram[offset]; break; } | |
| 1976 | case (0x664/2): { legionna_scrollram16[2] = cop_mcu_ram[offset] - 0x1f0; break; } | |
| 1977 | case (0x666/2): { legionna_scrollram16[3] = cop_mcu_ram[offset]; break; } | |
| 1978 | case (0x668/2): { legionna_scrollram16[4] = cop_mcu_ram[offset] - 0x1f0; break; } | |
| 1979 | case (0x66a/2): { legionna_scrollram16[5] = cop_mcu_ram[offset]; break; } | |
| 1980 | case (0x66c/2): { legionna_scrollram16[6] = cop_mcu_ram[offset] - 0x1f0; break; } | |
| 1981 | case (0x66e/2): { legionna_scrollram16[7] = cop_mcu_ram[offset]; break; } | |
| 1982 | ||
| 1983 | /*WRONG*/ | |
| 1984 | case (0x65c/2): | |
| 1985 | { | |
| 1986 | soundlatch_w(machine,1,data&0xff); | |
| 1987 | cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE ); | |
| 1988 | break; | |
| 1989 | } | |
| 1990 | /*video regs (not scrollram,something else)*/ | |
| 1991 | //case (0x660/2): | |
| 1992 | //case (0x662/2): | |
| 1993 | //case (0x664/2): | |
| 1994 | //case (0x666/2): | |
| 1995 | //case (0x668/2): | |
| 1996 | //case (0x66a/2): | |
| 1997 | //case (0x66c/2): | |
| 1998 | //case (0x66e/2): | |
| 1999 | // break; | |
| 2000 | /*bootleg sound HW*/ | |
| 2001 | /*case (0x740/2): | |
| 2002 | { | |
| 2003 | soundlatch_w(1,data&0x00ff); | |
| 2004 | cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE ); | |
| 2005 | break; | |
| 2006 | }*/ | |
| 2007 | } | |
| 2008 | } | |
| 2009 | ||
| 2010 | /******************************************************************************************** | |
| 2011 | ||
| 2012 | COPX-D2 simulation | |
| 2013 | - Raiden 2 | |
| 2014 | - Zero Team | |
| 2015 | ||
| 2016 | *******************************************************************************************/ | |
| 2017 | ||
| 2018 | ||
| 2019 | /* Raiden 2 COP2 handling. Note, some important details about table upload in here that the | |
| 2020 | other simulations are missing */ | |
| 2021 | ||
| 2022 | // COPX functions, terribly incomplete | |
| 2023 | ||
| 2024 | typedef struct _cop_state cop_state; | |
| 2025 | struct _cop_state | |
| 2026 | { | |
| 2027 | UINT16 offset; /* last write offset */ | |
| 2028 | UINT16 ram[0x200/2]; /* RAM from 0x400-0x5ff */ | |
| 2029 | ||
| 2030 | UINT32 reg[4]; /* registers */ | |
| 2031 | ||
| 2032 | UINT16 func_trigger[0x100/8]; /* function trigger */ | |
| 2033 | UINT16 func_value[0x100/8]; /* function value (?) */ | |
| 2034 | UINT16 func_mask[0x100/8]; /* function mask (?) */ | |
| 2035 | UINT16 program[0x100]; /* program "code" */ | |
| 2036 | }; | |
| 2037 | ||
| 2038 | static cop_state cop_data; | |
| 2039 | ||
| 2040 | ||
| 2041 | #define VERBOSE 1 | |
| 2042 | #define COP_LOG(x) do { if (VERBOSE) logerror x; } while (0) | |
| 2043 | ||
| 2044 | ||
| 2045 | ||
| 2046 | INLINE UINT16 cop_ram_r(cop_state *cop, UINT16 offset) | |
| 2047 | { | |
| 2048 | return cop->ram[(offset - 0x400) / 2]; | |
| 2049 | } | |
| 2050 | ||
| 2051 | INLINE void cop_ram_w(cop_state *cop, UINT16 offset, UINT16 data) | |
| 2052 | { | |
| 2053 | cop->ram[(offset - 0x400) / 2] = data; | |
| 2054 | } | |
| 2055 | ||
| 2056 | INLINE UINT32 r32(offs_t address) | |
| 2057 | { | |
| 2058 | return (program_read_word(address + 0) << 0) | | |
| 2059 | (program_read_word(address + 2) << 16); | |
| 2060 | } | |
| 2061 | ||
| 2062 | INLINE void w32(offs_t address, UINT32 data) | |
| 2063 | { | |
| 2064 | program_write_word(address + 0, data >> 0); | |
| 2065 | program_write_word(address + 2, data >> 16); | |
| 2066 | } | |
| 2067 | ||
| 2068 | ||
| 2069 | void cop_init(void) | |
| 2070 | { | |
| 2071 | memset(&cop_data, 0, sizeof(cop_data)); | |
| 2072 | } | |
| 2073 | ||
| 2074 | void raiden2_save_cop_table( running_machine* machine ) | |
| 2075 | { | |
| 2076 | cop_state *cop = &cop_data; | |
| 2077 | ||
| 2078 | { | |
| 2079 | FILE *fp; | |
| 2080 | char filename[256]; | |
| 2081 | sprintf(filename,"r2_cop_%s_program", machine->gamedrv->name); | |
| 2082 | fp=fopen(filename, "w+b"); | |
| 2083 | if (fp) | |
| 2084 | { | |
| 2085 | fwrite(cop->program, 0x200, 1, fp); | |
| 2086 | fclose(fp); | |
| 2087 | } | |
| 2088 | } | |
| 2089 | ||
| 2090 | { | |
| 2091 | FILE *fp; | |
| 2092 | char filename[256]; | |
| 2093 | sprintf(filename,"r2_cop_%s_value", machine->gamedrv->name); | |
| 2094 | fp=fopen(filename, "w+b"); | |
| 2095 | if (fp) | |
| 2096 | { | |
| 2097 | fwrite(cop->func_value, 0x200/8, 1, fp); | |
| 2098 | fclose(fp); | |
| 2099 | } | |
| 2100 | } | |
| 2101 | ||
| 2102 | { | |
| 2103 | FILE *fp; | |
| 2104 | char filename[256]; | |
| 2105 | sprintf(filename,"r2_cop_%s_mask", machine->gamedrv->name); | |
| 2106 | fp=fopen(filename, "w+b"); | |
| 2107 | if (fp) | |
| 2108 | { | |
| 2109 | fwrite(cop->func_mask, 0x200/8, 1, fp); | |
| 2110 | fclose(fp); | |
| 2111 | } | |
| 2112 | } | |
| 2113 | ||
| 2114 | { | |
| 2115 | FILE *fp; | |
| 2116 | char filename[256]; | |
| 2117 | sprintf(filename,"r2_cop_%s_trigger", machine->gamedrv->name); | |
| 2118 | fp=fopen(filename, "w+b"); | |
| 2119 | if (fp) | |
| 2120 | { | |
| 2121 | fwrite(cop->func_trigger, 0x200/8, 1, fp); | |
| 2122 | fclose(fp); | |
| 2123 | } | |
| 2124 | } | |
| 2125 | } | |
| 2126 | ||
| 2127 | WRITE16_HANDLER( raiden2_cop2_w ) | |
| 2128 | { | |
| 2129 | cop_state *cop = &cop_data; | |
| 2130 | UINT32 temp32; | |
| 2131 | UINT8 regnum; | |
| 2132 | int func; | |
| 2133 | ||
| 2134 | /* all COP data writes are word-length (?) */ | |
| 2135 | data = COMBINE_DATA(&cop->ram[offset]); | |
| 2136 | ||
| 2137 | /* handle writes */ | |
| 2138 | switch (offset + (0x400/2)) | |
| 2139 | { | |
| 2140 | /* ----- BCD conversion ----- */ | |
| 2141 | ||
| 2142 | case 0x420/2: /* LSW of number */ | |
| 2143 | case 0x422/2: /* MSW of number */ | |
| 2144 | temp32 = cop_ram_r(cop, 0x420) | (cop_ram_r(cop, 0x422) << 16); | |
| 2145 | cop_ram_w(cop, 0x590, ((temp32 / 1) % 10) + (((temp32 / 10) % 10) << 8) + 0x3030); | |
| 2146 | cop_ram_w(cop, 0x592, ((temp32 / 100) % 10) + (((temp32 / 1000) % 10) << 8) + 0x3030); | |
| 2147 | cop_ram_w(cop, 0x594, ((temp32 / 10000) % 10) + (((temp32 / 100000) % 10) << 8) + 0x3030); | |
| 2148 | cop_ram_w(cop, 0x596, ((temp32 / 1000000) % 10) + (((temp32 / 10000000) % 10) << 8) + 0x3030); | |
| 2149 | cop_ram_w(cop, 0x598, ((temp32 / 100000000) % 10) + (((temp32 / 1000000000) % 10) << 8) + 0x3030); | |
| 2150 | break; | |
| 2151 | ||
| 2152 | /* ----- program upload registers ----- */ | |
| 2153 | ||
| 2154 | case 0x432/2: /* COP program data */ | |
| 2155 | COP_LOG(("%05X:COP Prog Data = %04X\n", activecpu_get_pc(), data)); | |
| 2156 | cop->program[cop_ram_r(cop, 0x434)] = data; | |
| 2157 | break; | |
| 2158 | ||
| 2159 | case 0x434/2: /* COP program address */ | |
| 2160 | COP_LOG(("%05X:COP Prog Addr = %04X\n", activecpu_get_pc(), data)); | |
| 2161 | assert((data & ~0xff) == 0); | |
| 2162 | temp32 = (data & 0xff) / 8; | |
| 2163 | cop->func_value[temp32] = cop_ram_r(cop, 0x438); | |
| 2164 | cop->func_mask[temp32] = cop_ram_r(cop, 0x43a); | |
| 2165 | cop->func_trigger[temp32] = cop_ram_r(cop, 0x43c); | |
| 2166 | ||
| 2167 | raiden2_save_cop_table(machine); | |
| 2168 | ||
| 2169 | break; | |
| 2170 | ||
| 2171 | case 0x438/2: /* COP program entry value (0,4,5,6,7,8,9,F) */ | |
| 2172 | COP_LOG(("%05X:COP Prog Val = %04X\n", activecpu_get_pc(), data)); | |
| 2173 | break; | |
| 2174 | ||
| 2175 | case 0x43a/2: /* COP program entry mask */ | |
| 2176 | COP_LOG(("%05X:COP Prog Mask = %04X\n", activecpu_get_pc(), data)); | |
| 2177 | break; | |
| 2178 | ||
| 2179 | case 0x43c/2: /* COP program trigger value */ | |
| 2180 | COP_LOG(("%05X:COP Prog Trig = %04X\n", activecpu_get_pc(), data)); | |
| 2181 | break; | |
| 2182 | ||
| 2183 | /* ----- ???? ----- */ | |
| 2184 | ||
| 2185 | case 0x47a/2: /* clear RAM */ | |
| 2186 | if (cop_ram_r(cop, 0x47e) == 0x118) | |
| 2187 | { | |
| 2188 | UINT32 addr = cop_ram_r(cop, 0x478) << 6; | |
| 2189 | int count = (cop_ram_r(cop, 0x47a) + 1) << 5; | |
| 2190 | COP_LOG(("%05X:COP RAM clear from %05X to %05X\n", activecpu_get_pc(), addr, addr + count)); | |
| 2191 | while (count--) | |
| 2192 | program_write_byte(addr++, 0); | |
| 2193 | } | |
| 2194 | else | |
| 2195 | { | |
| 2196 | COP_LOG(("%05X:COP Unknown RAM clear(%04X) = %04X\n", activecpu_get_pc(), cop_ram_r(cop, 0x47e), data)); | |
| 2197 | } | |
| 2198 | break; | |
| 2199 | ||
| 2200 | /* ----- program data registers ----- */ | |
| 2201 | ||
| 2202 | case 0x4a0/2: /* COP register high word */ | |
| 2203 | case 0x4a2/2: /* COP register high word */ | |
| 2204 | case 0x4a4/2: /* COP register high word */ | |
| 2205 | case 0x4a6/2: /* COP register high word */ | |
| 2206 | regnum = (offset) % 4; | |
| 2207 | COP_LOG(("%05X:COP RegHi(%d) = %04X\n", activecpu_get_pc(), regnum, data)); | |
| 2208 | cop->reg[regnum] = (cop->reg[regnum] & 0x0000ffff) | (data << 16); | |
| 2209 | break; | |
| 2210 | ||
| 2211 | case 0x4c0/2: /* COP register low word */ | |
| 2212 | case 0x4c2/2: /* COP register low word */ | |
| 2213 | case 0x4c4/2: /* COP register low word */ | |
| 2214 | case 0x4c6/2: /* COP register low word */ | |
| 2215 | regnum = (offset) % 4; | |
| 2216 | COP_LOG(("%05X:COP RegLo(%d) = %04X\n", activecpu_get_pc(), regnum, data)); | |
| 2217 | cop->reg[regnum] = (cop->reg[regnum] & 0xffff0000) | data; | |
| 2218 | break; | |
| 2219 | ||
| 2220 | /* ----- program trigger register ----- */ | |
| 2221 | ||
| 2222 | case 0x500/2: /* COP trigger */ | |
| 2223 | COP_LOG(("%05X:COP Trigger = %04X\n", activecpu_get_pc(), data)); | |
| 2224 | for (func = 0; func < ARRAY_LENGTH(cop->func_trigger); func++) | |
| 2225 | if (cop->func_trigger[func] == data) | |
| 2226 | { | |
| 2227 | int offs; | |
| 2228 | ||
| 2229 | COP_LOG((" Execute:")); | |
| 2230 | for (offs = 0; offs < 8; offs++) | |
| 2231 | { | |
| 2232 | if (cop->program[func * 8 + offs] == 0) | |
| 2233 | break; | |
| 2234 | COP_LOG((" %04X", cop->program[func * 8 + offs])); | |
| 2235 | } | |
| 2236 | COP_LOG(("\n")); | |
| 2237 | ||
| 2238 | /* special cases for now */ | |
| 2239 | if (data == 0x5205 || data == 0x5a05) | |
| 2240 | { | |
| 2241 | COP_LOG((" Copy 32 bits from %05X to %05X\n", cop->reg[0], cop->reg[1])); | |
| 2242 | w32(cop->reg[1], r32(cop->reg[0])); | |
| 2243 | } | |
| 2244 | else if (data == 0xf205) | |
| 2245 | { | |
| 2246 | COP_LOG((" Copy 32 bits from %05X to %05X\n", cop->reg[0] + 4, cop->reg[1])); | |
| 2247 | w32(cop->reg[2], r32(cop->reg[0] + 4)); | |
| 2248 | } | |
| 2249 | break; | |
| 2250 | } | |
| 2251 | logerror("%05X:COP Warning - can't find command - func != ARRAY_LENGTH(cop->func_trigger)\n", activecpu_get_pc()); | |
| 2252 | break; | |
| 2253 | ||
| 2254 | /* ----- other stuff ----- */ | |
| 2255 | ||
| 2256 | default: /* unknown */ | |
| 2257 | COP_LOG(("%05X:COP Unknown(%04X) = %04X\n", activecpu_get_pc(), offset*2 + 0x400, data)); | |
| 2258 | break; | |
| 2259 | } | |
| 2260 | } | |
| 2261 | ||
| 2262 | ||
| 2263 | READ16_HANDLER( raiden2_cop2_r ) | |
| 2264 | { | |
| 2265 | cop_state *cop = &cop_data; | |
| 2266 | COP_LOG(("%05X:COP Read(%04X) = %04X\n", activecpu_get_pc(), offset*2 + 0x400, cop->ram[offset])); | |
| 2267 | return cop->ram[offset]; | |
| 2268 | } | |
| 2269 |
| r2375 | r2376 | |
|---|---|---|
| 116 | 116 | data = mame_rand(Machine); |
| 117 | 117 | break; |
| 118 | 118 | case 0x04: /* 2P inputs */ |
| 119 | data = | |
| 119 | data = | |
| 120 | 120 | break; |
| 121 | 121 | case 0x06: /* 1P inputs + DIPSW #1 & #2 */ |
| 122 | 122 | if (offset & 0x02) |
| 123 | data = | |
| 123 | data = | |
| 124 | 124 | else |
| 125 | data = | |
| 125 | data = | |
| 126 | 126 | break; |
| 127 | 127 | case 0x07: /* DIPSW #3 */ |
| 128 | data = | |
| 128 | data = | |
| 129 | 129 | break; |
| 130 | 130 | |
| 131 | 131 | default: |
| r2375 | r2376 | |
|---|---|---|
| 28 | 28 | because D6 and D7 are apparently checked at different times, and a |
| 29 | 29 | change in-between can affect the direction you move. |
| 30 | 30 | ***************************************************************************/ |
| 31 | static int nitedrvr_steering( | |
| 31 | static int nitedrvr_steering(running_machine *machine) | |
| 32 | 32 | { |
| 33 | 33 | int this_val; |
| 34 | 34 | int delta; |
| 35 | 35 | |
| 36 | this_val = | |
| 36 | this_val = | |
| 37 | 37 | |
| 38 | 38 | delta=this_val-last_steering_val; |
| 39 | 39 | last_steering_val=this_val; |
| r2375 | r2376 | |
| 107 | 107 | { |
| 108 | 108 | int gear; |
| 109 | 109 | |
| 110 | gear = | |
| 110 | gear = | |
| 111 | 111 | if (gear & 0x10) nitedrvr_gear=1; |
| 112 | 112 | else if (gear & 0x20) nitedrvr_gear=2; |
| 113 | 113 | else if (gear & 0x40) nitedrvr_gear=3; |
| r2375 | r2376 | |
| 116 | 116 | switch (offset & 0x03) |
| 117 | 117 | { |
| 118 | 118 | case 0x00: /* No remapping necessary */ |
| 119 | return | |
| 119 | return | |
| 120 | 120 | case 0x01: /* No remapping necessary */ |
| 121 | return | |
| 121 | return | |
| 122 | 122 | case 0x02: /* Remap our gear shift */ |
| 123 | 123 | if (nitedrvr_gear==1) return 0xE0; |
| 124 | 124 | else if (nitedrvr_gear==2) return 0xD0; |
| 125 | 125 | else if (nitedrvr_gear==3) return 0xB0; |
| 126 | 126 | else return 0x70; |
| 127 | 127 | case 0x03: /* Remap our steering */ |
| 128 | return ( | |
| 128 | return ( | |
| 129 | 129 | default: |
| 130 | 130 | return 0xFF; |
| 131 | 131 | } |
| r2375 | r2376 | |
| 169 | 169 | |
| 170 | 170 | ac_line=(ac_line+1) % 3; |
| 171 | 171 | |
| 172 | port = | |
| 172 | port = | |
| 173 | 173 | if (port & 0x10) nitedrvr_track=0; |
| 174 | 174 | else if (port & 0x20) nitedrvr_track=1; |
| 175 | 175 | else if (port & 0x40) nitedrvr_track=2; |
| r2375 | r2376 | |
|---|---|---|
| 548 | 548 | DRIVER( fenix ) /* bootleg */ |
| 549 | 549 | DRIVER( falcon ) /* bootleg */ |
| 550 | 550 | DRIVER( vautour ) /* bootleg (Jeutel) */ |
| 551 | DRIVER( vautour2 ) /* bootleg */ | |
| 551 | DRIVER( falconz ) /* bootleg */ | |
| 552 | DRIVER( vautourz ) /* bootleg */ | |
| 552 | 553 | DRIVER( griffon ) /* bootleg (Videotron) */ |
| 553 | DRIVER( falcona ) /* bootleg */ | |
| 554 | 554 | DRIVER( nextfase ) /* bootleg */ |
| 555 | 555 | DRIVER( pleiads ) /* (c) 1981 Tehkan */ |
| 556 | 556 | DRIVER( pleiadbl ) /* bootleg */ |
| r2375 | r2376 | |
| 2007 | 2007 | DRIVER( dendeg2x ) /* E52 (c) 1998 Taito Corporation */ |
| 2008 | 2008 | DRIVER( sidebs ) /* E23 (c) 1996 Taito Corporation */ |
| 2009 | 2009 | DRIVER( sidebs2 ) /* E38 (c) 1997 Taito Corporation */ |
| 2010 | DRIVER( sidebs2j ) /* E38 (c) 1997 Taito Corporation */ | |
| 2010 | 2011 | DRIVER( dangcurv ) /* E09 (c) 1995 Taito Corporation */ |
| 2011 | 2012 | |
| 2012 | 2013 | /* Taito "Wolf" System */ |
| r2375 | r2376 | |
| 3561 | 3562 | DRIVER( smgpu2 ) /* (c) 1989 (FD1094, decrypted) */ |
| 3562 | 3563 | DRIVER( smgpu1 ) /* (c) 1989 (FD1094, decrypted) */ |
| 3563 | 3564 | DRIVER( smgpj ) /* (c) 1989 (FD1094, decrypted) */ |
| 3565 | DRIVER( smgpja ) /* (c) 1989 (FD1094, decrypted) */ | |
| 3564 | 3566 | |
| 3565 | 3567 | /* Y-Board */ |
| 3566 | 3568 | DRIVER( gforce2 ) /* (c) 1988 */ |
| r2375 | r2376 | |
| 6089 | 6091 | |
| 6090 | 6092 | /* Midway Touchmaster / Galaxy Games */ |
| 6091 | 6093 | DRIVER( tm ) /* (c) 1996 Midway Games */ |
| 6092 | DRIVER( tm3k ) /* (c) 1996 Midway Games */ | |
| 6093 | DRIVER( tm4k ) /* (c) 1996 Midway Games */ | |
| 6094 | DRIVER( tm3k ) /* (c) 1997 Midway Games */ | |
| 6095 | DRIVER( tm4k ) /* (c) 1998 Midway Games */ | |
| 6096 | DRIVER( tm5k ) /* (c) 1998 Midway Games */ | |
| 6097 | DRIVER( tm7k ) /* (c) 1999 Midway Games */ | |
| 6094 | 6098 | DRIVER( galgbios ) /* (c) 1998 Creative Electonics & Software (CES) */ |
| 6095 | 6099 | |
| 6096 | 6100 | /* Cinematronics raster games */ |
| r2375 | r2376 | |
| 6296 | 6300 | DRIVER( denjinmk ) /* (c) 199? Banpresto */ |
| 6297 | 6301 | DRIVER( sdgndmrb ) /* (c) 1993 Banpresto */ |
| 6298 | 6302 | DRIVER( cupsoc ) /* (c) 1992 Seibu */ |
| 6299 | DRIVER( cupsoc2 ) /* (c) 1992 Seibu */ | |
| 6303 | DRIVER( cupsocs ) /* (c) 1992 Seibu */ | |
| 6304 | DRIVER( cupsocs2 ) /* (c) 1992 Seibu */ | |
| 6305 | DRIVER( cupsocsb ) /* bootleg */ | |
| 6300 | 6306 | DRIVER( olysoc92 ) /* (c) 1992 Seibu */ |
| 6301 | DRIVER( cupsocbl ) /* bootleg */ | |
| 6302 | 6307 | DRIVER( goal92 ) /* bootleg */ |
| 6303 | 6308 | |
| 6304 | 6309 | /* Jaleco games */ |
| r2375 | r2376 | |
| 6431 | 6436 | DRIVER( pspikesk ) /* (c) 1991 Video System Co. (Korea) */ |
| 6432 | 6437 | DRIVER( svolly91 ) /* (c) 1991 Video System Co. (Japan) */ |
| 6433 | 6438 | DRIVER( pspikesb ) /* bootleg */ |
| 6434 | DRIVER( p | |
| 6439 | DRIVER( spikes91 | |
| 6435 | 6440 | DRIVER( pspikesc ) /* bootleg */ |
| 6436 | 6441 | DRIVER( karatblz ) /* (c) 1991 Video System Co. */ |
| 6437 | 6442 | DRIVER( karatblu ) /* (c) 1991 Video System Co. (US) */ |
| r2375 | r2376 | |
|---|---|---|
| 40 | 40 | #define TORNBASE_CAB_TYPE_UPRIGHT_OLD (0) |
| 41 | 41 | #define TORNBASE_CAB_TYPE_UPRIGHT_NEW (1) |
| 42 | 42 | #define TORNBASE_CAB_TYPE_COCKTAIL (2) |
| 43 | UINT8 tornbase_get_cabinet_type( | |
| 43 | UINT8 tornbase_get_cabinet_type(running_machine *machine); | |
| 44 | 44 | |
| 45 | 45 | #define DESERTGU_GUN_X_PORT_TAG ("GUNX") |
| 46 | 46 | #define DESERTGU_GUN_Y_PORT_TAG ("GUNY") |
| r2375 | r2376 | |
| 63 | 63 | CUSTOM_INPUT( invaders_in2_control_r ); |
| 64 | 64 | UINT8 invaders_is_flip_screen(void); |
| 65 | 65 | void invaders_set_flip_screen(UINT8 data); |
| 66 | int invaders_is_cabinet_cocktail( | |
| 66 | int invaders_is_cabinet_cocktail(running_machine *machine); | |
| 67 | 67 | |
| 68 | 68 | #define BLUESHRK_SPEAR_PORT_TAG ("SPEAR") |
| 69 | 69 |
| r2375 | r2376 | |
|---|---|---|
| 74 | 74 | |
| 75 | 75 | VIDEO_START( cps1 ); |
| 76 | 76 | VIDEO_START( cps2 ); |
| 77 | void cps1_build_palette(running_machine *machine); | |
| 78 | 77 | |
| 79 | 78 | WRITE16_HANDLER( cps2_objram_bank_w ); |
| 80 | 79 | READ16_HANDLER( cps2_objram1_r ); |
| r2375 | r2376 | |
|---|---|---|
| 63 | 63 | WRITE8_HANDLER( pleiads_videoreg_w ); |
| 64 | 64 | WRITE8_HANDLER( phoenix_scroll_w ); |
| 65 | 65 | |
| 66 | READ8_HANDLER( phoenix_input_port_0_r ); | |
| 67 | READ8_HANDLER( pleiads_input_port_0_r ); | |
| 66 | CUSTOM_INPUT( player_input_r ); | |
| 67 | CUSTOM_INPUT( pleiads_protection_r ); | |
| 68 | 68 | READ8_HANDLER( survival_input_port_0_r ); |
| 69 | 69 | READ8_HANDLER( survival_protection_r ); |
| 70 | 70 |
| r2375 | r2376 | |
|---|---|---|
| 31 | 31 | extern VIDEO_START( sgladiat ); |
| 32 | 32 | |
| 33 | 33 | extern VIDEO_UPDATE( tnk3 ); |
| 34 | extern VIDEO_UPDATE( athena ); | |
| 34 | 35 | extern VIDEO_UPDATE( ikari ); |
| 35 | 36 | extern VIDEO_UPDATE( tdfever ); |
| 36 | 37 | extern VIDEO_UPDATE( gwar ); |
| r2375 | r2376 | |
|---|---|---|
| 52 | 52 | WRITE8_HANDLER ( atari_serout_w ); |
| 53 | 53 | void atari_interrupt_cb(int mask); |
| 54 | 54 | |
| 55 | void a800_handle_keyboard(void); | |
| 56 | void a5200_handle_keypads(void); | |
| 55 | void a800_handle_keyboard(running_machine *machine); | |
| 56 | void a5200_handle_keypads(running_machine *machine); | |
| 57 | 57 | |
| 58 | 58 | /* video */ |
| 59 | 59 |
| r2375 | r2376 | |
|---|---|---|
| 7 | 7 | |
| 8 | 8 | /*----------- defined in drivers/wardner.c -----------*/ |
| 9 | 9 | |
| 10 | extern | |
| 10 | extern STATE_POSTLOAD( wardner_restore_bank | |
| 11 | 11 | |
| 12 | 12 | /*----------- defined in machine/twincobr.c -----------*/ |
| 13 | 13 | |
| r2375 | r2376 | |
| 35 | 35 | MACHINE_RESET( twincobr ); |
| 36 | 36 | MACHINE_RESET( wardner ); |
| 37 | 37 | |
| 38 | extern void twincobr_driver_savestate(void); | |
| 39 | extern void wardner_driver_savestate(void); | |
| 38 | extern void twincobr_driver_savestate(running_machine *machine); | |
| 39 | extern void wardner_driver_savestate(running_machine *machine); | |
| 40 | 40 | |
| 41 | 41 | extern int toaplan_main_cpu; /* Main CPU type. 0 = 68000, 1 = Z80 */ |
| 42 | 42 | extern int twincobr_intenable; |
| r2375 | r2376 | |
|---|---|---|
| 141 | 141 | READ16_HANDLER( neogeo_video_register_r ); |
| 142 | 142 | WRITE16_HANDLER( neogeo_video_register_w ); |
| 143 | 143 | |
| 144 | void neogeo_set_palette_bank(UINT8 data); | |
| 145 | void neogeo_set_screen_dark(UINT8 data); | |
| 144 | void neogeo_set_palette_bank(running_machine *machine, UINT8 data); | |
| 145 | void neogeo_set_screen_dark(running_machine *machine, UINT8 data); | |
| 146 | 146 | READ16_HANDLER( neogeo_paletteram_r ); |
| 147 | 147 | WRITE16_HANDLER( neogeo_paletteram_w ); |
| 148 | 148 |
| r2375 | r2376 | |
|---|---|---|
| 31 | 31 | MACHINE_RESET( vimana ); |
| 32 | 32 | MACHINE_RESET( zerozone ); /* hack for ZeroWing/OutZone. See video */ |
| 33 | 33 | |
| 34 | extern void toaplan1_driver_savestate(void); | |
| 35 | extern void demonwld_driver_savestate(void); | |
| 36 | extern void vimana_driver_savestate(void); | |
| 34 | extern void toaplan1_driver_savestate(running_machine *machine); | |
| 35 | extern void demonwld_driver_savestate(running_machine *machine); | |
| 36 | extern void vimana_driver_savestate(running_machine *machine); | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | extern int toaplan1_unk_reset_port; |
| r2375 | r2376 | |
|---|---|---|
| 69 | 69 | |
| 70 | 70 | extern UINT8 *c8080bw_colorram; |
| 71 | 71 | |
| 72 | void c8080bw_flip_screen_w(int data); | |
| 72 | void c8080bw_flip_screen_w(running_machine *machine, int data); | |
| 73 | 73 | void c8080bw_screen_red_w(int data); |
| 74 | 74 | void schaser_background_control_w(int data); |
| 75 | 75 |
| r2375 | r2376 | |
|---|---|---|
| 50 | 50 | |
| 51 | 51 | extern UINT32 st0016_game; |
| 52 | 52 | |
| 53 | void st0016_save_init( | |
| 53 | void st0016_save_init(running_machine *machine); | |
| 54 | 54 | |
| 55 | 55 |
| r2375 | r2376 | |
|---|---|---|
| 409 | 409 | VIDEO_START( amiga ); |
| 410 | 410 | VIDEO_UPDATE( amiga ); |
| 411 | 411 | |
| 412 | UINT32 amiga_gethvpos(voi | |
| 412 | UINT32 amiga_gethvpos(const device_config *screen); | |
| 413 | 413 | void copper_setpc(UINT32 pc); |
| 414 | 414 | void amiga_set_genlock_color(UINT16 color); |
| 415 | 415 | void amiga_render_scanline(running_machine *machine, bitmap_t *bitmap, int scanline); |
| r2375 | r2376 | |
|---|---|---|
| 27 | 27 | UINT8 vicdual_videoram_r(offs_t offset); |
| 28 | 28 | UINT8 vicdual_characterram_r(offs_t offset); |
| 29 | 29 | |
| 30 | int vicdual_is_cabinet_color( | |
| 30 | int vicdual_is_cabinet_color(running_machine *machine); | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | /*----------- defined in video/vicdual.c -----------*/ |
| r2375 | r2376 | |
|---|---|---|
| 54 | 54 | WRITE32_HANDLER( psx_mdec_w ); |
| 55 | 55 | READ32_HANDLER( psx_mdec_r ); |
| 56 | 56 | extern void psx_machine_init( void ); |
| 57 | extern void psx_driver_init( | |
| 57 | extern void psx_driver_init( running_machine *machine ); | |
| 58 | 58 | |
| 59 | 59 | #define PSX_H ( 1 ) |
| 60 | 60 | #endif |
| r2375 | r2376 | |
|---|---|---|
| 203 | 203 | CPUS += TMS7000_EXL |
| 204 | 204 | CPUS += SM8500 |
| 205 | 205 | CPUS += V30MZ |
| 206 | CPUS += CXD8661R | |
| 206 | 207 | |
| 207 | 208 | |
| 208 | 209 | |
| r2375 | r2376 | |
| 383 | 384 | $(MAMEOBJ)/subsino.a \ |
| 384 | 385 | $(MAMEOBJ)/sun.a \ |
| 385 | 386 | $(MAMEOBJ)/suna.a \ |
| 386 | $(MAMEOBJ)/tad.a \ | |
| 387 | 387 | $(MAMEOBJ)/taito.a \ |
| 388 | 388 | $(MAMEOBJ)/tatsumi.a \ |
| 389 | 389 | $(MAMEOBJ)/tch.a \ |
| r2375 | r2376 | |
| 1216 | 1216 | $(DRIVERS)/wiz.o $(VIDEO)/wiz.o \ |
| 1217 | 1217 | $(MACHINE)/spisprit.o \ |
| 1218 | 1218 | $(AUDIO)/seibu.o \ |
| 1219 | $(DRIVERS)/bloodbro.o $(VIDEO)/bloodbro.o \ | |
| 1220 | $(DRIVERS)/cabal.o $(VIDEO)/cabal.o \ | |
| 1221 | $(DRIVERS)/goal92.o $(VIDEO)/goal92.o \ | |
| 1222 | $(DRIVERS)/legionna.o $(VIDEO)/legionna.o \ | |
| 1223 | $(MACHINE)/seicop.o \ | |
| 1224 | $(DRIVERS)/toki.o $(VIDEO)/toki.o \ | |
| 1219 | 1225 | |
| 1220 | 1226 | $(MAMEOBJ)/seta.a: \ |
| 1221 | 1227 | $(DRIVERS)/aleck64.o $(MACHINE)/n64.o $(VIDEO)/n64.o \ |
| r2375 | r2376 | |
| 1279 | 1285 | $(DRIVERS)/suna8.o $(AUDIO)/suna8.o $(VIDEO)/suna8.o \ |
| 1280 | 1286 | $(DRIVERS)/suna16.o $(VIDEO)/suna16.o \ |
| 1281 | 1287 | |
| 1282 | $(MAMEOBJ)/tad.a: \ | |
| 1283 | $(DRIVERS)/bloodbro.o $(VIDEO)/bloodbro.o \ | |
| 1284 | $(DRIVERS)/cabal.o $(VIDEO)/cabal.o \ | |
| 1285 | $(DRIVERS)/goal92.o $(VIDEO)/goal92.o \ | |
| 1286 | $(DRIVERS)/legionna.o $(VIDEO)/legionna.o \ | |
| 1287 | $(DRIVERS)/toki.o $(VIDEO)/toki.o \ | |
| 1288 | ||
| 1289 | 1288 | $(MAMEOBJ)/taito.a: \ |
| 1290 | 1289 | $(DRIVERS)/40love.o $(VIDEO)/40love.o \ |
| 1291 | 1290 | $(DRIVERS)/arkanoid.o $(MACHINE)/arkanoid.o $(VIDEO)/arkanoid.o \ |
| r2375 | r2376 | |
|---|---|---|
| 476 | 476 | } |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | static void spikes91_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) | |
| 480 | { | |
| 481 | int i; | |
| 482 | UINT8 *lookup; | |
| 483 | lookup = memory_region(REGION_USER1); | |
| 484 | spritepalettebank = 1; | |
| 485 | ||
| 486 | for (i = aerofgt_spriteram3_size/2 - 4 ; i >= 4 ; i -= 4) | |
| 487 | { | |
| 488 | int xpos,ypos,color,flipx,flipy,code,realcode; | |
| 489 | ||
| 490 | code = aerofgt_spriteram3[i + 0] & 0x1fff; | |
| 491 | ||
| 492 | if (!code) continue; | |
| 493 | ||
| 494 | xpos = (aerofgt_spriteram3[i + 2] & 0x01ff) - 16; | |
| 495 | ypos = 256 - (aerofgt_spriteram3[i + 1] & 0x00ff) - 26; | |
| 496 | flipy = 0; | |
| 497 | flipx = aerofgt_spriteram3[i + 3] & 0x8000; | |
| 498 | color = ((aerofgt_spriteram3[i + 3] & 0x00f0) >> 4); | |
| 499 | ||
| 500 | // look-up table | |
| 501 | // RZ notes: | |
| 502 | // in game it's necessary an or with 0x2000; | |
| 503 | // probably a bit switch the table | |
| 504 | // almost sure no line swap in the look-up table | |
| 505 | ||
| 506 | code |= 0x2000; | |
| 507 | realcode = (lookup[code] << 8) + lookup[0x10000 + code]; | |
| 508 | ||
| 509 | drawgfx(bitmap,machine->gfx[sprite_gfx], | |
| 510 | realcode, | |
| 511 | color, | |
| 512 | flipx,flipy, | |
| 513 | xpos,ypos, | |
| 514 | cliprect,TRANSPARENCY_PEN,15); | |
| 515 | ||
| 516 | /* wrap around y */ | |
| 517 | drawgfx(bitmap,machine->gfx[sprite_gfx], | |
| 518 | realcode, | |
| 519 | color, | |
| 520 | flipx,flipy, | |
| 521 | xpos,ypos + 512, | |
| 522 | cliprect,TRANSPARENCY_PEN,15); | |
| 523 | } | |
| 524 | } | |
| 525 | ||
| 479 | 526 | static void aerfboot_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) |
| 480 | 527 | { |
| 481 | int attr_start;//,base,first; | |
| 482 | // int notdraw = 0; | |
| 528 | int attr_start,last; | |
| 483 | 529 | |
| 484 | // base = chip * 0x0200; | |
| 485 | // first = 4 * aerofgt_spriteram3[0x1fe + base]; | |
| 530 | last = ((aerofgt_rasterram[0x404/2] << 5) - 0x8000) / 2; | |
| 486 | 531 | |
| 487 | for (attr_start = aerofgt_spriteram3_size/2 - 4 | |
| 532 | for (attr_start = aerofgt_spriteram3_size / 2 - 4 | |
| 488 | 533 | { |
| 489 | 534 | int code; |
| 490 | 535 | int ox,oy,sx,sy,zoomx,zoomy,flipx,flipy,color,pri; |
| 491 | // some other drivers still use this wrong table, they have to be upgraded | |
| 492 | // int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; | |
| 493 | 536 | |
| 494 | 537 | ox = aerofgt_spriteram3[attr_start + 1] & 0x01ff; |
| 495 | 538 | oy = aerofgt_spriteram3[attr_start + 0] & 0x01ff; |
| r2375 | r2376 | |
| 500 | 543 | zoomx = (aerofgt_spriteram3[attr_start + 1] & 0xf000) >> 12; |
| 501 | 544 | zoomy = (aerofgt_spriteram3[attr_start + 0] & 0xf000) >> 12; |
| 502 | 545 | pri = aerofgt_spriteram3[attr_start + 2] & 0x0010; |
| 503 | // code = aerofgt_spriteram3[attr_start + 3] & 0x3fff; | |
| 504 | 546 | code = aerofgt_spriteram3[attr_start + 3] & 0x1fff; |
| 505 | 547 | |
| 506 | // if ((!(aerofgt_spriteram3[attr_start + 0])) & (!(aerofgt_spriteram3[attr_start + 1])) & | |
| 507 | // (!(aerofgt_spriteram3[attr_start + 2])) & (!(aerofgt_spriteram3[attr_start + 3]))) notdraw = 1; | |
| 548 | if (!(aerofgt_spriteram3[attr_start + 2] & 0x0040)) code |= 0x2000; | |
| 508 | 549 | |
| 509 | // if (notdraw) continue; | |
| 550 | zoomx = 32 + zoomx; | |
| 551 | zoomy = 32 + zoomy; | |
| 510 | 552 | |
| 553 | sy = ((oy + 16 - 1) & 0x1ff) - 16; | |
| 554 | ||
| 555 | sx = ((ox + 16 + 3) & 0x1ff) - 16; | |
| 556 | ||
| 557 | pdrawgfxzoom(bitmap,machine->gfx[sprite_gfx + (code >= 0x1000 ? 0 : 1)], | |
| 558 | code, | |
| 559 | color, | |
| 560 | flipx,flipy, | |
| 561 | sx,sy, | |
| 562 | cliprect,TRANSPARENCY_PEN,15, | |
| 563 | zoomx << 11,zoomy << 11, | |
| 564 | pri ? 0 : 0x2); | |
| 565 | ||
| 566 | } | |
| 567 | ||
| 568 | last = ((aerofgt_rasterram[0x402/2] << 5) - 0x8000) / 2; | |
| 569 | ||
| 570 | for (attr_start = ((aerofgt_spriteram3_size / 2) / 2) - 4 ; attr_start >= last ; attr_start -= 4) | |
| 571 | { | |
| 572 | int code; | |
| 573 | int ox,oy,sx,sy,zoomx,zoomy,flipx,flipy,color,pri; | |
| 574 | ||
| 575 | ox = aerofgt_spriteram3[attr_start + 1] & 0x01ff; | |
| 576 | oy = aerofgt_spriteram3[attr_start + 0] & 0x01ff; | |
| 577 | flipx = aerofgt_spriteram3[attr_start + 2] & 0x0800; | |
| 578 | flipy = aerofgt_spriteram3[attr_start + 2] & 0x8000; | |
| 579 | color = aerofgt_spriteram3[attr_start + 2] & 0x000f; | |
| 580 | ||
| 581 | zoomx = (aerofgt_spriteram3[attr_start + 1] & 0xf000) >> 12; | |
| 582 | zoomy = (aerofgt_spriteram3[attr_start + 0] & 0xf000) >> 12; | |
| 583 | pri = aerofgt_spriteram3[attr_start + 2] & 0x0010; | |
| 584 | code = aerofgt_spriteram3[attr_start + 3] & 0x1fff; | |
| 585 | ||
| 511 | 586 | if (!(aerofgt_spriteram3[attr_start + 2] & 0x0040)) code |= 0x2000; |
| 512 | 587 | |
| 513 | 588 | zoomx = 32 + zoomx; |
| 514 | 589 | zoomy = 32 + zoomy; |
| 515 | 590 | |
| 516 | sy = ((oy + 16) & 0x1ff) - 16; | |
| 591 | sy = ((oy + 16 - 1) & 0x1ff) - 16; | |
| 517 | 592 | |
| 518 | sx = ((ox + 16) & 0x1ff) - 16; | |
| 593 | sx = ((ox + 16 + 3) & 0x1ff) - 16; | |
| 519 | 594 | |
| 520 | 595 | pdrawgfxzoom(bitmap,machine->gfx[sprite_gfx + (code >= 0x1000 ? 0 : 1)], |
| 521 | 596 | code, |
| r2375 | r2376 | |
| 582 | 657 | return 0; |
| 583 | 658 | } |
| 584 | 659 | |
| 660 | VIDEO_UPDATE( spikes91 ) | |
| 661 | { | |
| 662 | int i,scrolly; | |
| 663 | ||
| 664 | tilemap_set_scroll_rows(bg1_tilemap,256); | |
| 665 | scrolly = bg1scrolly; | |
| 666 | ||
| 667 | for (i = 0;i < 256;i++) | |
| 668 | tilemap_set_scrollx(bg1_tilemap,(i + scrolly) & 0xff,aerofgt_rasterram[i+0x01f0/2]+0x96+0x16); | |
| 669 | tilemap_set_scrolly(bg1_tilemap,0,scrolly); | |
| 670 | ||
| 671 | tilemap_draw(bitmap,cliprect,bg1_tilemap,0,0); | |
| 672 | spikes91_draw_sprites(screen->machine,bitmap,cliprect); | |
| 673 | return 0; | |
| 674 | } | |
| 675 | ||
| 585 | 676 | VIDEO_UPDATE( karatblz ) |
| 586 | 677 | { |
| 587 | 678 | tilemap_set_scrollx(bg1_tilemap,0,bg1scrollx-8); |
| r2375 | r2376 | |
|---|---|---|
| 51 | 51 | |
| 52 | 52 | /* draw color overlay foreground and background */ |
| 53 | 53 | |
| 54 | if (fgoal_player == 1 && ( | |
| 54 | if (fgoal_player == 1 && ( | |
| 55 | 55 | { |
| 56 | 56 | drawgfxzoom(fgbitmap, screen->machine->gfx[0], |
| 57 | 57 | 0, (fgoal_player << 2) | current_color, |
| r2375 | r2376 | |
|---|---|---|
| 257 | 257 | { |
| 258 | 258 | mystston_state *state = screen->machine->driver_data; |
| 259 | 259 | |
| 260 | int flip = (*state->video_control & 0x80) ^ (( | |
| 260 | int flip = (*state->video_control & 0x80) ^ (( | |
| 261 | 261 | |
| 262 | 262 | set_palette(screen->machine, state); |
| 263 | 263 |
| r2375 | r2376 | |
|---|---|---|
| 474 | 474 | } |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | static | |
| 477 | static STATE_POSTLOAD( ygv608_postload | |
| 478 | 478 | { |
| 479 | 479 | int i; |
| 480 | 480 | |
| r2375 | r2376 | |
| 485 | 485 | SetPostShortcuts(i); |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | static void ygv608_register_state_save( | |
| 488 | static void ygv608_register_state_save(running_machine *machine) | |
| 489 | 489 | { |
| 490 | 490 | state_save_register_item_array("ygv608", 0, ygv608.ports.b); |
| 491 | 491 | state_save_register_item_array("ygv608", 0, ygv608.regs.b); |
| r2375 | r2376 | |
| 494 | 494 | state_save_register_item_2d_array("ygv608", 0, ygv608.scroll_data_table); |
| 495 | 495 | state_save_register_item_2d_array("ygv608", 0, ygv608.colour_palette); |
| 496 | 496 | |
| 497 | state_save_register_ | |
| 497 | state_save_register_ | |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | static void ygv608_exit(running_machine *machine) |
| r2375 | r2376 | |
| 534 | 534 | tilemap_A = NULL; |
| 535 | 535 | tilemap_B = NULL; |
| 536 | 536 | |
| 537 | ygv608_register_state_save(); | |
| 537 | ygv608_register_state_save(machine); | |
| 538 | 538 | add_exit_callback(machine, ygv608_exit); |
| 539 | 539 | } |
| 540 | 540 |
| r2375 | r2376 | |
|---|---|---|
| 2081 | 2081 | //popmessage("%04x %04x",STV_VDP1_EWRR_X3,STV_VDP1_EWRR_Y3); |
| 2082 | 2082 | } |
| 2083 | 2083 | |
| 2084 | static | |
| 2084 | static STATE_POSTLOAD( stv_vdp1_state_save_postload | |
| 2085 | 2085 | { |
| 2086 | 2086 | UINT8 *vdp1 = stv_vdp1_gfx_decode; |
| 2087 | 2087 | int offset; |
| r2375 | r2376 | |
| 2103 | 2103 | } |
| 2104 | 2104 | } |
| 2105 | 2105 | |
| 2106 | int stv_vdp1_start ( | |
| 2106 | int stv_vdp1_start ( running_machine *machine ) | |
| 2107 | 2107 | { |
| 2108 | 2108 | stv_vdp1_regs = auto_malloc ( 0x040000 ); |
| 2109 | 2109 | stv_vdp1_vram = auto_malloc ( 0x100000 ); |
| r2375 | r2376 | |
| 2143 | 2143 | state_save_register_global(stv_vdp1_clear_framebuffer_on_next_frame); |
| 2144 | 2144 | state_save_register_global(stvvdp1_local_x); |
| 2145 | 2145 | state_save_register_global(stvvdp1_local_y); |
| 2146 | state_save_register_ | |
| 2146 | state_save_register_ | |
| 2147 | 2147 | return 0; |
| 2148 | 2148 | } |
| r2375 | r2376 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | |
| 11 | UINT8 *sonson_scroll; | |
| 12 | 11 | static tilemap *bg_tilemap; |
| 13 | 12 | |
| 14 | 13 | /*************************************************************************** |
| r2375 | r2376 | |
| 107 | 106 | tilemap_mark_tile_dirty(bg_tilemap, offset); |
| 108 | 107 | } |
| 109 | 108 | |
| 109 | WRITE8_HANDLER( sonson_scrollx_w ) | |
| 110 | { | |
| 111 | int row; | |
| 112 | ||
| 113 | for (row = 5; row < 32; row++) | |
| 114 | tilemap_set_scrollx(bg_tilemap, row, data); | |
| 115 | } | |
| 116 | ||
| 110 | 117 | WRITE8_HANDLER( sonson_flipscreen_w ) |
| 111 | 118 | { |
| 112 | if (flip_screen_get() != (~data & 0x01)) | |
| 113 | { | |
| 114 | flip_screen_set(~data & 0x01); | |
| 115 | tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); | |
| 116 | } | |
| 119 | flip_screen_set(~data & 0x01); | |
| 117 | 120 | } |
| 118 | 121 | |
| 119 | 122 | static TILE_GET_INFO( get_bg_tile_info ) |
| r2375 | r2376 | |
| 164 | 167 | |
| 165 | 168 | VIDEO_UPDATE( sonson ) |
| 166 | 169 | { |
| 167 | int row; | |
| 168 | ||
| 169 | for (row = 5; row < 32; row++) | |
| 170 | tilemap_set_scrollx(bg_tilemap, row, *sonson_scroll); | |
| 171 | ||
| 172 | 170 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); |
| 173 | 171 | draw_sprites(screen->machine, bitmap, cliprect); |
| 174 | 172 | return 0; |
| r2375 | r2376 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | void twincobr_flipscreen(int flip); |
| 21 | 21 | void twincobr_display(int enable); |
| 22 | static | |
| 22 | static STATE_POSTLOAD( twincobr_restore_screen | |
| 23 | 23 | |
| 24 | 24 | INT32 twincobr_fg_rom_bank; |
| 25 | 25 | INT32 twincobr_bg_ram_bank; |
| r2375 | r2376 | |
| 151 | 151 | state_save_register_global(twincobr_bg_ram_bank); |
| 152 | 152 | state_save_register_global(twincobr_flip_screen); |
| 153 | 153 | state_save_register_global(wardner_sprite_hack); |
| 154 | state_save_register_ | |
| 154 | state_save_register_ | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | static | |
| 157 | static STATE_POSTLOAD( twincobr_restore_screen | |
| 158 | 158 | { |
| 159 | 159 | twincobr_display(twincobr_display_on); |
| 160 | 160 | twincobr_flipscreen(twincobr_flip_screen); |
| r2375 | r2376 | |
|---|---|---|
| 216 | 216 | |
| 217 | 217 | READ8_HANDLER( bking_input_port_5_r ) |
| 218 | 218 | { |
| 219 | return | |
| 219 | return | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | READ8_HANDLER( bking_input_port_6_r ) |
| 223 | 223 | { |
| 224 | return | |
| 224 | return | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | READ8_HANDLER( bking_pos_r ) |
| r2375 | r2376 | |
|---|---|---|
| 86 | 86 | |
| 87 | 87 | VIDEO_UPDATE( orbit ) |
| 88 | 88 | { |
| 89 | orbit_flip_screen = | |
| 89 | orbit_flip_screen = | |
| 90 | 90 | |
| 91 | 91 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); |
| 92 | 92 |
| r2375 | r2376 | |
|---|---|---|
| 283 | 283 | { |
| 284 | 284 | /* latch 0x00 is player 1's gun X coordinate */ |
| 285 | 285 | case 0x00: |
| 286 | inputval = (( | |
| 286 | inputval = (( | |
| 287 | 287 | inputval += 0x50; |
| 288 | 288 | return (inputval << 20) | 0x20000000; |
| 289 | 289 | |
| 290 | 290 | /* latch 0x01 is player 1's gun Y coordinate */ |
| 291 | 291 | case 0x01: |
| 292 | inputval = (( | |
| 292 | inputval = (( | |
| 293 | 293 | inputval += 0x17; |
| 294 | 294 | return (inputval << 20); |
| 295 | 295 | |
| 296 | 296 | /* latch 0x02 is player 2's gun X coordinate */ |
| 297 | 297 | case 0x02: |
| 298 | inputval = (( | |
| 298 | inputval = (( | |
| 299 | 299 | inputval += 0x50; |
| 300 | 300 | return (inputval << 20) | 0x20000000; |
| 301 | 301 | |
| 302 | 302 | /* latch 0x03 is player 2's gun Y coordinate */ |
| 303 | 303 | case 0x03: |
| 304 | inputval = (( | |
| 304 | inputval = (( | |
| 305 | 305 | inputval += 0x17; |
| 306 | 306 | return (inputval << 20); |
| 307 | 307 |
| r2375 | r2376 | |
|---|---|---|
| 108 | 108 | palette_set_color(Machine,offset,MAKE_RGB(r,g,b)); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | static | |
| 111 | static STATE_POSTLOAD( system1_postload | |
| 112 | 112 | { |
| 113 | 113 | memset(sprite_onscreen_map, 255, 256*256); |
| 114 | 114 | memset(bg_dirtybuffer, 1, 1024); |
| r2375 | r2376 | |
| 124 | 124 | |
| 125 | 125 | tmp_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 126 | 126 | |
| 127 | state_save_register_ | |
| 127 | state_save_register_ | |
| 128 | 128 | state_save_register_global(system1_background_memory); |
| 129 | 129 | state_save_register_global(system1_video_mode); |
| 130 | 130 | |
| r2375 | r2376 | |
| 145 | 145 | |
| 146 | 146 | system1_sprite_xoffset = 1+7*2; |
| 147 | 147 | |
| 148 | state_save_register_ | |
| 148 | state_save_register_ | |
| 149 | 149 | state_save_register_global(system1_background_memory); |
| 150 | 150 | state_save_register_global(system1_video_mode); |
| 151 | 151 |
| r2375 | r2376 | |
|---|---|---|
| 97 | 97 | |
| 98 | 98 | UINT32* stv_vdp2_cram; |
| 99 | 99 | void video_update_vdp1(running_machine *machine); |
| 100 | int stv_vdp1_start ( | |
| 100 | int stv_vdp1_start (running_machine *machine); | |
| 101 | 101 | static void stv_vdp2_dynamic_res_change(void); |
| 102 | 102 | static void refresh_palette_data(void); |
| 103 | 103 | static int stv_vdp2_window_process(int x,int y); |
| r2375 | r2376 | |
| 5238 | 5238 | return stv_vdp2_regs[offset]; |
| 5239 | 5239 | } |
| 5240 | 5240 | |
| 5241 | static | |
| 5241 | static STATE_POSTLOAD( stv_vdp2_state_save_postload | |
| 5242 | 5242 | { |
| 5243 | 5243 | UINT8 *stv_vdp2_vram_decode = stv_vdp2_gfx_decode; |
| 5244 | 5244 | int offset; |
| r2375 | r2376 | |
| 5288 | 5288 | state_save_register_global_pointer(stv_vdp2_regs, 0x040000/4); |
| 5289 | 5289 | state_save_register_global_pointer(stv_vdp2_vram, 0x100000/4); |
| 5290 | 5290 | state_save_register_global_pointer(stv_vdp2_cram, 0x080000/4); |
| 5291 | state_save_register_ | |
| 5291 | state_save_register_ | |
| 5292 | 5292 | |
| 5293 | 5293 | return 0; |
| 5294 | 5294 | } |
| r2375 | r2376 | |
| 5298 | 5298 | { |
| 5299 | 5299 | stv_vdp2_roz_bitmap[0] = stv_vdp2_roz_bitmap[1] = NULL; |
| 5300 | 5300 | stv_vdp2_start(machine); |
| 5301 | stv_vdp1_start(); | |
| 5301 | stv_vdp1_start(machine); | |
| 5302 | 5302 | debug.l_en = 0xff; |
| 5303 | 5303 | debug.error = 0xffffffff; |
| 5304 | 5304 | debug.roz = 0; |
| r2375 | r2376 | |
|---|---|---|
| 87 | 87 | static int old_coin_state; |
| 88 | 88 | |
| 89 | 89 | static void |
| 90 | handle_mcu( | |
| 90 | handle_mcu( running_machine *machine ) | |
| 91 | 91 | { |
| 92 | 92 | UINT8 *IORAM = (UINT8 *)namcofl_mcuram; |
| 93 | 93 | static int toggle; |
| 94 | int new_coin_state = readinputport(3)&0x30; | |
| 95 | unsigned p1 = readinputport(0); | |
| 96 | unsigned p2 = readinputport(2); | |
| 97 | unsigned p3 = readinputport(1); | |
| 98 | unsigned p4 = readinputport(3); | |
| 94 | int new_coin_state = input_port_read_indexed(machine, 3)&0x30; | |
| 95 | unsigned p1 = input_port_read_indexed(machine, 0); | |
| 96 | unsigned p2 = input_port_read_indexed(machine, 2); | |
| 97 | unsigned p3 = input_port_read_indexed(machine, 1); | |
| 98 | unsigned p4 = input_port_read_indexed(machine, 3); | |
| 99 | 99 | |
| 100 | 100 | IORAM[BYTE4_XOR_LE(0x6000)] = p1; |
| 101 | 101 | IORAM[BYTE4_XOR_LE(0x6003)] = p2; |
| 102 | 102 | IORAM[BYTE4_XOR_LE(0x6005)] = p3; |
| 103 | 103 | IORAM[BYTE4_XOR_LE(0x60b8)] = p4; |
| 104 | 104 | |
| 105 | IORAM[BYTE4_XOR_LE(0x6014)] = readinputport(6)-1; // handle | |
| 106 | IORAM[BYTE4_XOR_LE(0x6016)] = readinputport(5); // brake | |
| 107 | IORAM[BYTE4_XOR_LE(0x6018)] = readinputport(4); // accelerator | |
| 105 | IORAM[BYTE4_XOR_LE(0x6014)] = input_port_read_indexed(machine, 6)-1; // handle | |
| 106 | IORAM[BYTE4_XOR_LE(0x6016)] = input_port_read_indexed(machine, 5); // brake | |
| 107 | IORAM[BYTE4_XOR_LE(0x6018)] = input_port_read_indexed(machine, 4); // accelerator | |
| 108 | 108 | |
| 109 | 109 | if (!(new_coin_state & 0x20) && (old_coin_state & 0x20)) |
| 110 | 110 | { |
| r2375 | r2376 | |
| 145 | 145 | { |
| 146 | 146 | int pri; |
| 147 | 147 | |
| 148 | handle_mcu(); | |
| 148 | handle_mcu(screen->machine); | |
| 149 | 149 | namcofl_install_palette(screen->machine); |
| 150 | 150 | |
| 151 | 151 | fillbitmap( bitmap, get_black_pen(screen->machine), cliprect ); |
| r2375 | r2376 | |
| 180 | 180 | VIDEO_START( namcofl ) |
| 181 | 181 | { |
| 182 | 182 | credits1 = credits2 = 0; |
| 183 | old_coin_state = | |
| 183 | old_coin_state = | |
| 184 | 184 | |
| 185 | 185 | namco_tilemap_init( NAMCONB1_TILEGFX, memory_region(NAMCONB1_TILEMASKREGION), TilemapCB ); |
| 186 | 186 | namco_obj_init(NAMCONB1_SPRITEGFX,0x0,FLobjcode2tile); |
| r2375 | r2376 | |
|---|---|---|
| 171 | 171 | Initialize video hardware emulation |
| 172 | 172 | ***************************************************************************/ |
| 173 | 173 | |
| 174 | static STATE_POSTLOAD( chaknpop_postload ) | |
| 175 | { | |
| 176 | set_vram_bank(); | |
| 177 | tx_tilemap_mark_all_dirty(); | |
| 178 | } | |
| 179 | ||
| 180 | ||
| 174 | 181 | VIDEO_START( chaknpop ) |
| 175 | 182 | { |
| 176 | 183 | UINT8 *RAM = memory_region(REGION_CPU1); |
| r2375 | r2376 | |
| 194 | 201 | state_save_register_global(flip_x); |
| 195 | 202 | state_save_register_global(flip_y); |
| 196 | 203 | |
| 197 | state_save_register_func_postload(set_vram_bank); | |
| 198 | state_save_register_func_postload(tx_tilemap_mark_all_dirty); | |
| 204 | state_save_register_postload(machine, chaknpop_postload, NULL); | |
| 199 | 205 | } |
| 200 | 206 | |
| 201 | 207 |
| r2375 | r2376 | |
|---|---|---|
| 166 | 166 | * |
| 167 | 167 | *************************************/ |
| 168 | 168 | |
| 169 | UINT32 amiga_gethvpos(voi | |
| 169 | UINT32 amiga_gethvpos(const device_config *screen) | |
| 170 | 170 | { |
| 171 | UINT32 hvpos = (last_scanline << 8) | (video_screen_get_hpos(Machine->primary_screen) >> 2); | |
| 172 | UINT32 latchedpos = readinputportbytag_safe("HVPOS", 0); | |
| 171 | UINT32 hvpos = (last_scanline << 8) | (video_screen_get_hpos(screen) >> 2); | |
| 172 | UINT32 latchedpos = input_port_read_safe(screen->machine, "HVPOS", 0); | |
| 173 | 173 | |
| 174 | 174 | /* if there's no latched position, or if we are in the active display area */ |
| 175 | 175 | /* but before the latching point, return the live HV position */ |
| r2375 | r2376 | |
|---|---|---|
| 165 | 165 | SET_TILE_INFO(0, code, 0, 0); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | static STATE_POSTLOAD( cloak_postload ) | |
| 169 | { | |
| 170 | set_current_bitmap_videoram_pointer(); | |
| 171 | } | |
| 172 | ||
| 168 | 173 | VIDEO_START( cloak ) |
| 169 | 174 | { |
| 170 | 175 | bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); |
| r2375 | r2376 | |
| 181 | 186 | state_save_register_global_pointer(bitmap_videoram1, 256*256); |
| 182 | 187 | state_save_register_global_pointer(bitmap_videoram2, 256*256); |
| 183 | 188 | state_save_register_global_pointer(palette_ram, NUM_PENS); |
| 184 | state_save_register_ | |
| 189 | state_save_register_ | |
| 185 | 190 | } |
| 186 | 191 | |
| 187 | 192 | static void draw_bitmap(bitmap_t *bitmap, const rectangle *cliprect) |
| r2375 | r2376 | |
|---|---|---|
| 4 | 4 | TODO: |
| 5 | 5 | - dynamic screen resolution |
| 6 | 6 | - bg pen (or the pen of the lower tilemap?) |
| 7 | - hook up roz tilemaps with roz enable / disable and tweak it (mainly missing offsets) | |
| 8 | - sprites with shadow bit have bad colors | |
| 7 | - roz centering | |
| 8 | - sprites, that have the shadow bit set but aren't shadows, have bad colors | |
| 9 | 9 | - check if the data&0x8000 condition in tilemaps is valid even when 4bpp mode it's used |
| 10 | 10 | - namco logo in emeralda demo is missing (it's used with a roz effect) |
| 11 | 11 | - invisible dolphin sprite in emeralda instruction screen |
| r2375 | r2376 | |
| 410 | 410 | pen_t *palette_shadow_table = machine->shadow_table; |
| 411 | 411 | dest[x] = palette_shadow_table[dest[x]]; |
| 412 | 412 | } |
| 413 | else if( bShadow && !((gfx_region == 0 && color == 0x0f) || (gfx_region == 1 && color == 0xff))) | |
| 414 | { | |
| 415 | //bad colors! | |
| 416 | dest[x] = pal_base + c; | |
| 417 | } | |
| 413 | 418 | else |
| 414 | 419 | { |
| 415 | 420 | dest[x] = pal_base + c; |
| r2375 | r2376 | |
| 588 | 593 | } |
| 589 | 594 | else |
| 590 | 595 | { |
| 591 | tilemap_set_scrollx( bg_tilemap[which], 0, scrollx ); | |
| 592 | tilemap_set_scrolly( bg_tilemap[which], 0, scrolly ); | |
| 593 | tilemap_draw_primask( bitmap, &clip, bg_tilemap[which], 0, primask, 0 ); | |
| 596 | // used in emeraldia | |
| 597 | if(which == 1 && namcona1_vreg[0x8a/2] == 0xfd /* maybe reg & 0x4 */) | |
| 598 | { | |
| 599 | INT32 incxx = ((INT16)namcona1_vreg[0xc0/2])<<8; //or incyy ? | |
| 600 | INT32 incxy = ((INT16)namcona1_vreg[0xc2/2])<<8; | |
| 601 | INT32 incyx = ((INT16)namcona1_vreg[0xc4/2])<<8; | |
| 602 | INT32 incyy = ((INT16)namcona1_vreg[0xc6/2])<<8; //or incxx ? | |
| 603 | UINT32 startx = (INT32)(INT16)namcona1_vreg[0xc8/2]<<12; | |
| 604 | UINT32 starty = (INT32)(INT16)namcona1_vreg[0xca/2]<<12; | |
| 605 | //namcona1_vreg[0xcc/2]; // changes dx/dy ? | |
| 594 | 606 | |
| 595 | #if 0 | |
| 596 | INT16 incxy, incyx, incxx, incyy; | |
| 597 | INT16 xoffset, yoffset; | |
| 598 | UINT32 startx,starty; | |
| 607 | // all ROZ parameters now in 16.16 format | |
| 599 | 608 | |
| 600 | incxx = (INT16)namcona1_vreg[0xc0/2]; // or incyy ? | |
| 601 | incxy = (INT16)namcona1_vreg[0xc2/2]; | |
| 602 | incyx = (INT16)namcona1_vreg[0xc4/2]; | |
| 603 | incyy = (INT16)namcona1_vreg[0xc6/2]; // or incxx ? | |
| 604 | xoffset = namcona1_vreg[0xc8/2]; | |
| 605 | yoffset = namcona1_vreg[0xca/2]; | |
| 606 | //namcona1_vreg[0xcc/2]; // ? | |
| 609 | // now, apply adjustments to startx, starty to translate the | |
| 610 | // ROZ plane. Note that these are corrected by the inc parameters | |
| 611 | // to account for scale/rotate state. | |
| 612 | int dx = 46; // horizontal adjust in pixels | |
| 613 | int dy = -8; // vertical adjust in pixels | |
| 614 | startx += dx*incxx + dy*incyx; | |
| 615 | starty += dx*incyx + dy*incyy; | |
| 607 | 616 | |
| 608 | startx = ((xoffset + a) << 12); | |
| 609 | starty = ((yoffset + b) << 12); | |
| 617 | tilemap_draw_roz_primask(bitmap, &clip, bg_tilemap[which], | |
| 618 | startx, starty, incxx, incxy, incyx, incyy, | |
| 619 | 0, 0, primask, 0); | |
| 610 | 620 | |
| 611 | popmessage("scrollx = %x - scrolly = %x - xo = %d - yo = %d",scrollx,scrolly,xoffset,yoffset); | |
| 612 | ||
| 613 | tilemap_draw_roz_primask(bitmap, &clip, bg_tilemap[which], | |
| 614 | startx , starty , | |
| 615 | incxx << 8, incxy << 8, incyx << 8, incyy << 8, | |
| 616 | 0, 0, primask, 0); | |
| 617 | #endif | |
| 618 | ||
| 621 | } | |
| 622 | else | |
| 623 | { | |
| 624 | tilemap_set_scrollx( bg_tilemap[which], 0, scrollx ); | |
| 625 | tilemap_set_scrolly( bg_tilemap[which], 0, scrolly ); | |
| 626 | tilemap_draw_primask( bitmap, &clip, bg_tilemap[which], 0, primask, 0 ); | |
| 627 | } | |
| 619 | 628 | } |
| 620 | 629 | } |
| 621 | 630 | } |
| r2375 | r2376 | |
|---|---|---|
| 840 | 840 | num = port_tag_to_index("VIDHW"); |
| 841 | 841 | if (num>=0) |
| 842 | 842 | { |
| 843 | newset = | |
| 843 | newset = | |
| 844 | 844 | if (newset != state->vidhw) |
| 845 | 845 | { |
| 846 | 846 | state->vidhw = newset; |
| r2375 | r2376 | |
|---|---|---|
| 274 | 274 | WRITE8_HANDLER( travrusa_flipscreen_w ) |
| 275 | 275 | { |
| 276 | 276 | /* screen flip is handled both by software and hardware */ |
| 277 | data ^= ~ | |
| 277 | data ^= ~ | |
| 278 | 278 | |
| 279 | 279 | flip_screen_set(data & 1); |
| 280 | 280 |
| r2375 | r2376 | |
|---|---|---|
| 547 | 547 | |
| 548 | 548 | #endif |
| 549 | 549 | |
| 550 | static | |
| 550 | static STATE_POSTLOAD( updatevisiblearea | |
| 551 | 551 | { |
| 552 | 552 | rectangle visarea; |
| 553 | 553 | float refresh; |
| r2375 | r2376 | |
| 617 | 617 | video_screen_configure(Machine->primary_screen, m_n_screenwidth, m_n_screenheight, &visarea, HZ_TO_ATTOSECONDS(refresh)); |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | static void psx_gpu_init( | |
| 620 | static void psx_gpu_init( running_machine *machine ) | |
| 621 | 621 | { |
| 622 | 622 | int n_line; |
| 623 | 623 | int n_level; |
| r2375 | r2376 | |
| 772 | 772 | state_save_register_global( psxgpu.n_iy ); |
| 773 | 773 | state_save_register_global( psxgpu.n_ti ); |
| 774 | 774 | |
| 775 | state_save_register_ | |
| 775 | state_save_register_ | |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | VIDEO_START( psx_type1 ) |
| 779 | 779 | { |
| 780 | 780 | m_n_gputype = 1; |
| 781 | psx_gpu_init(); | |
| 781 | psx_gpu_init(machine); | |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | VIDEO_START( psx_type2 ) |
| 785 | 785 | { |
| 786 | 786 | m_n_gputype = 2; |
| 787 | psx_gpu_init(); | |
| 787 | psx_gpu_init(machine); | |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | VIDEO_UPDATE( psx ) |
| r2375 | r2376 | |
| 3694 | 3694 | m_n_twy = 0; |
| 3695 | 3695 | m_n_twh = 255; |
| 3696 | 3696 | m_n_tww = 255; |
| 3697 | updatevisiblearea(); | |
| 3697 | updatevisiblearea(machine, NULL); | |
| 3698 | 3698 | break; |
| 3699 | 3699 | case 0x01: |
| 3700 | 3700 | verboselog( 1, "not handled: reset command buffer\n" ); |
| r2375 | r2376 | |
| 3748 | 3748 | { |
| 3749 | 3749 | m_b_reverseflag = ( data >> 7 ) & 1; |
| 3750 | 3750 | } |
| 3751 | updatevisiblearea(); | |
| 3751 | updatevisiblearea(machine, NULL); | |
| 3752 | 3752 | break; |
| 3753 | 3753 | case 0x09: |
| 3754 | 3754 | verboselog( 1, "not handled: GPU Control 0x09: %08x\n", data ); |
| r2375 | r2376 | |
|---|---|---|
| 93 | 93 | |
| 94 | 94 | VIDEO_START( dbz ) |
| 95 | 95 | { |
| 96 | K053251_vh_start(); | |
| 96 | K053251_vh_start(machine); | |
| 97 | 97 | K056832_vh_start(machine, REGION_GFX1, K056832_BPP_4, 1, NULL, dbz_tile_callback, 1); |
| 98 | 98 | K053247_vh_start(machine, REGION_GFX2, -52, 16, NORMAL_PLANE_ORDER, dbz_sprite_callback); |
| 99 | 99 |
| r2375 | r2376 | |
|---|---|---|
| 32 | 32 | { |
| 33 | 33 | switch (offset) |
| 34 | 34 | { |
| 35 | case 0x08: return readinputport(1); // Player 2 | |
| 36 | case 0x10: return readinputport(2); // Coins, Tilt, Service | |
| 37 | case 0x20: return readinputport(0) ^ invert_controls; // Player 1 | |
| 38 | case 0x21: return readinputport(3); // DIPs | |
| 39 | case 0x22: return readinputport(4); // DIPs + VBLANK | |
| 35 | case 0x08: return input_port_read_indexed(machine, 1); // Player 2 | |
| 36 | case 0x10: return input_port_read_indexed(machine, 2); // Coins, Tilt, Service | |
| 37 | case 0x20: return input_port_read_indexed(machine, 0) ^ invert_controls; // Player 1 | |
| 38 | case 0x21: return input_port_read_indexed(machine, 3); // DIPs | |
| 39 | case 0x22: return input_port_read_indexed(machine, 4); // DIPs + VBLANK | |
| 40 | 40 | default: return 0; |
| 41 | 41 | } |
| 42 | 42 | } |
| r2375 | r2376 | |
|---|---|---|
| 45 | 45 | |
| 46 | 46 | VIDEO_START( simpsons ) |
| 47 | 47 | { |
| 48 | K053251_vh_start(); | |
| 48 | K053251_vh_start(machine); | |
| 49 | 49 | |
| 50 | 50 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tile_callback); |
| 51 | 51 | K053247_vh_start(machine,REGION_GFX2,53,23,NORMAL_PLANE_ORDER,sprite_callback); |
| r2375 | r2376 | |
|---|---|---|
| 518 | 518 | /* original arcade doesn't work in this way */ |
| 519 | 519 | #ifdef MAME_DEBUG |
| 520 | 520 | { |
| 521 | int in = | |
| 521 | int in = | |
| 522 | 522 | static int lastin; |
| 523 | 523 | |
| 524 | 524 | if ((in ^ lastin) & polepos_gear_bit) |
| r2375 | r2376 | |
|---|---|---|
| 762 | 762 | { PC080SN_get_bg_tile_info_1, PC080SN_get_fg_tile_info_1 } |
| 763 | 763 | }; |
| 764 | 764 | |
| 765 | static | |
| 765 | static STATE_POSTLOAD( PC080SN_restore_scroll | |
| 766 | 766 | { |
| 767 | int chip = (FPTR)param; | |
| 767 | 768 | int flip; |
| 768 | 769 | |
| 769 | 770 | PC080SN_bgscrollx[chip][0] = -PC080SN_ctrl[chip][0]; |
| r2375 | r2376 | |
| 779 | 780 | |
| 780 | 781 | /* opaque parameter is no longer supported and will be removed */ |
| 781 | 782 | |
| 782 | void PC080SN_vh_start(int chips,int gfxnum,int x_offset,int y_offset,int y_invert, | |
| 783 | void PC080SN_vh_start(running_machine *machine,int chips,int gfxnum,int x_offset,int y_offset,int y_invert, | |
| 783 | 784 | int opaque,int dblwidth) |
| 784 | 785 | { |
| 785 | 786 | int i; |
| r2375 | r2376 | |
| 817 | 818 | |
| 818 | 819 | state_save_register_item_pointer("PC080SN", i, PC080SN_ram[i], PC080SN_RAM_SIZE/2); |
| 819 | 820 | state_save_register_item_array("PC080SN", i, PC080SN_ctrl[i]); |
| 820 | state_save_register_ | |
| 821 | state_save_register_ | |
| 821 | 822 | |
| 822 | 823 | /* use the given gfx set for bg tiles */ |
| 823 | 824 | PC080SN_bg_gfx[i] = gfxnum; |
| r2375 | r2376 | |
| 1233 | 1234 | state_save_register_global_pointer(PC090OJ_ram, PC090OJ_RAM_SIZE/2); |
| 1234 | 1235 | state_save_register_global_pointer(PC090OJ_ram_buffered, PC090OJ_RAM_SIZE/2); |
| 1235 | 1236 | state_save_register_global(PC090OJ_ctrl); |
| 1236 | ||
| 1237 | // state_save_register_func_postload(PC090OJ_restore); | |
| 1238 | 1237 | } |
| 1239 | 1238 | |
| 1240 | 1239 | READ16_HANDLER( PC090OJ_word_0_r ) // in case we find a game using 2... |
| r2375 | r2376 | |
| 1504 | 1503 | TC0080VCO_chars_dirty = 1; |
| 1505 | 1504 | } |
| 1506 | 1505 | |
| 1507 | static void TC0080VCO_dirty_tilemaps(void) | |
| 1508 | { | |
| 1509 | tilemap_mark_all_tiles_dirty(TC0080VCO_tilemap[0]); | |
| 1510 | tilemap_mark_all_tiles_dirty(TC0080VCO_tilemap[1]); | |
| 1511 | tilemap_mark_all_tiles_dirty(TC0080VCO_tilemap[2]); | |
| 1512 | } | |
| 1513 | ||
| 1514 | 1506 | static void TC0080VCO_restore_scroll(void) |
| 1515 | 1507 | { |
| 1516 | 1508 | TC0080VCO_flipscreen = TC0080VCO_scroll_ram[0] & 0x0c00; |
| r2375 | r2376 | |
| 1526 | 1518 | } |
| 1527 | 1519 | |
| 1528 | 1520 | |
| 1521 | static STATE_POSTLOAD( TC0080VCO_postload ) | |
| 1522 | { | |
| 1523 | TC0080VCO_set_layer_ptrs(); | |
| 1524 | TC0080VCO_dirty_chars(); | |
| 1525 | TC0080VCO_restore_scroll(); | |
| 1526 | } | |
| 1527 | ||
| 1529 | 1528 | void TC0080VCO_vh_start(running_machine *machine, int gfxnum,int has_fg0,int bg_xoffs,int bg_yoffs,int bg_flip_yoffs) |
| 1530 | 1529 | { |
| 1531 | 1530 | int gfx_index=0; |
| r2375 | r2376 | |
| 1555 | 1554 | |
| 1556 | 1555 | state_save_register_global_pointer(TC0080VCO_ram, TC0080VCO_RAM_SIZE/2); |
| 1557 | 1556 | state_save_register_global(TC0080VCO_has_tx); |
| 1558 | state_save_register_func_postload(TC0080VCO_set_layer_ptrs); | |
| 1559 | 1557 | |
| 1560 | 1558 | /* Perform extra initialisations for text layer */ |
| 1561 | 1559 | { |
| r2375 | r2376 | |
| 1563 | 1561 | TC0080VCO_char_dirty = auto_malloc(TC0080VCO_TOTAL_CHARS); |
| 1564 | 1562 | |
| 1565 | 1563 | TC0080VCO_dirty_chars(); |
| 1566 | state_save_register_func_postload(TC0080VCO_dirty_chars); | |
| 1567 | 1564 | |
| 1568 | 1565 | /* find first empty slot to decode gfx */ |
| 1569 | 1566 | for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) |
| r2375 | r2376 | |
| 1584 | 1581 | tilemap_set_transparent_pen( TC0080VCO_tilemap[2],0 ); |
| 1585 | 1582 | } |
| 1586 | 1583 | |
| 1587 | state_save_register_func_postload(TC0080VCO_dirty_tilemaps); // unnecessary ? | |
| 1588 | state_save_register_func_postload(TC0080VCO_restore_scroll); | |
| 1584 | state_save_register_postload(machine, TC0080VCO_postload, NULL); | |
| 1589 | 1585 | |
| 1590 | 1586 | /* bg0 tilemap scrollable per pixel row */ |
| 1591 | 1587 | tilemap_set_scroll_rows(TC0080VCO_tilemap[0],512); |
| r2375 | r2376 | |
| 2278 | 2274 | } |
| 2279 | 2275 | |
| 2280 | 2276 | |
| 2277 | static STATE_POSTLOAD( TC0100SCN_postload ) | |
| 2278 | { | |
| 2279 | int chip = (FPTR)param; | |
| 2280 | ||
| 2281 | TC0100SCN_set_layer_ptrs(chip); | |
| 2282 | TC0100SCN_dirty_chars(chip); | |
| 2283 | TC0100SCN_restore_scroll(chip); | |
| 2284 | } | |
| 2285 | ||
| 2281 | 2286 | void TC0100SCN_vh_start(running_machine *machine, int chips,int gfxnum,int x_offset,int y_offset,int flip_xoffs, |
| 2282 | 2287 | int flip_yoffs,int flip_text_xoffs,int flip_text_yoffs,int multiscrn_xoffs) |
| 2283 | 2288 | { |
| r2375 | r2376 | |
| 2329 | 2334 | state_save_register_item("TC0100SCN", i, TC0100SCN_dblwidth[i]); |
| 2330 | 2335 | } |
| 2331 | 2336 | |
| 2332 | state_save_register_func_postload_int(TC0100SCN_set_layer_ptrs, i); | |
| 2333 | state_save_register_func_postload_int(TC0100SCN_dirty_chars, i); | |
| 2334 | state_save_register_func_postload_int(TC0100SCN_dirty_tilemaps, i); // unnecessary ? | |
| 2335 | state_save_register_func_postload_int(TC0100SCN_restore_scroll, i); | |
| 2337 | state_save_register_postload(machine, TC0100SCN_postload, (void *)i); | |
| 2336 | 2338 | |
| 2337 | 2339 | /* find first empty slot to decode gfx */ |
| 2338 | 2340 | for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) |
| r2375 | r2376 | |
| 3157 | 3159 | } |
| 3158 | 3160 | |
| 3159 | 3161 | |
| 3162 | static STATE_POSTLOAD( TC0480SCP_postload ) | |
| 3163 | { | |
| 3164 | TC0480SCP_set_layer_ptrs(); | |
| 3165 | TC0480SCP_dirty_chars(); | |
| 3166 | TC0480SCP_restore_scroll(); | |
| 3167 | } | |
| 3168 | ||
| 3160 | 3169 | void TC0480SCP_vh_start(running_machine *machine, int gfxnum,int pixels,int x_offset,int y_offset,int text_xoffs, |
| 3161 | 3170 | int text_yoffs,int flip_xoffs,int flip_yoffs,int col_base) |
| 3162 | 3171 | { |
| r2375 | r2376 | |
| 3194 | 3203 | state_save_register_global_pointer(TC0480SCP_ram, TC0480SCP_RAM_SIZE/2); |
| 3195 | 3204 | state_save_register_global_array(TC0480SCP_ctrl); |
| 3196 | 3205 | state_save_register_global(TC0480SCP_dblwidth); |
| 3197 | state_save_register_func_postload(TC0480SCP_set_layer_ptrs); | |
| 3198 | state_save_register_func_postload(TC0480SCP_dirty_chars); | |
| 3199 | state_save_register_func_postload(TC0480SCP_dirty_tilemaps); // unnecessary ? | |
| 3200 | state_save_register_func_postload(TC0480SCP_restore_scroll); | |
| 3206 | state_save_register_postload(machine, TC0480SCP_postload, NULL); | |
| 3201 | 3207 | |
| 3202 | 3208 | /* find first empty slot to decode gfx */ |
| 3203 | 3209 | for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) |
| r2375 | r2376 | |
| 4689 | 4695 | #define TC0110PCR_RAM_SIZE 0x2000 |
| 4690 | 4696 | |
| 4691 | 4697 | |
| 4692 | static | |
| 4698 | static STATE_POSTLOAD( TC0110PCR_restore_colors | |
| 4693 | 4699 | { |
| 4700 | int chip = (FPTR)param; | |
| 4694 | 4701 | int i,color,r=0,g=0,b=0; |
| 4695 | 4702 | |
| 4696 | 4703 | for (i=0; i<(256*16); i++) |
| r2375 | r2376 | |
| 4730 | 4737 | } |
| 4731 | 4738 | |
| 4732 | 4739 | |
| 4733 | void TC0110PCR_vh_start( | |
| 4740 | void TC0110PCR_vh_start(running_machine *machine) | |
| 4734 | 4741 | { |
| 4735 | 4742 | TC0110PCR_ram[0] = auto_malloc(TC0110PCR_RAM_SIZE * sizeof(*TC0110PCR_ram[0])); |
| 4736 | 4743 | |
| 4737 | 4744 | state_save_register_global_pointer(TC0110PCR_ram[0], TC0110PCR_RAM_SIZE); |
| 4738 | state_save_register_ | |
| 4745 | state_save_register_ | |
| 4739 | 4746 | |
| 4740 | 4747 | TC0110PCR_type = 0; /* default, xBBBBBGGGGGRRRRR */ |
| 4741 | 4748 | } |
| 4742 | 4749 | |
| 4743 | void TC0110PCR_1_vh_start( | |
| 4750 | void TC0110PCR_1_vh_start(running_machine *machine) | |
| 4744 | 4751 | { |
| 4745 | 4752 | TC0110PCR_ram[1] = auto_malloc(TC0110PCR_RAM_SIZE * sizeof(*TC0110PCR_ram[1])); |
| 4746 | 4753 | |
| 4747 | 4754 | state_save_register_global_pointer(TC0110PCR_ram[1], TC0110PCR_RAM_SIZE); |
| 4748 | state_save_register_ | |
| 4755 | state_save_register_ | |
| 4749 | 4756 | } |
| 4750 | 4757 | |
| 4751 | void TC0110PCR_2_vh_start( | |
| 4758 | void TC0110PCR_2_vh_start(running_machine *machine) | |
| 4752 | 4759 | { |
| 4753 | 4760 | TC0110PCR_ram[2] = auto_malloc(TC0110PCR_RAM_SIZE * sizeof(*TC0110PCR_ram[2])); |
| 4754 | 4761 | |
| 4755 | 4762 | state_save_register_global_pointer(TC0110PCR_ram[2], TC0110PCR_RAM_SIZE); |
| 4756 | state_save_register_ | |
| 4763 | state_save_register_ | |
| 4757 | 4764 | } |
| 4758 | 4765 | |
| 4759 | 4766 | READ16_HANDLER( TC0110PCR_word_r ) |
| r2375 | r2376 | |
| 4945 | 4952 | switch (offset) |
| 4946 | 4953 | { |
| 4947 | 4954 | case 0x00: /* IN00-07 (DSA) */ |
| 4948 | return input_port_ | |
| 4955 | return input_port_ | |
| 4949 | 4956 | |
| 4950 | 4957 | case 0x01: /* IN08-15 (DSB) */ |
| 4951 | return input_port_ | |
| 4958 | return input_port_ | |
| 4952 | 4959 | |
| 4953 | 4960 | case 0x02: /* IN16-23 (1P) */ |
| 4954 | return input_port_ | |
| 4961 | return input_port_ | |
| 4955 | 4962 | |
| 4956 | 4963 | case 0x03: /* IN24-31 (2P) */ |
| 4957 | return input_port_ | |
| 4964 | return input_port_ | |
| 4958 | 4965 | |
| 4959 | 4966 | case 0x04: /* coin counters and lockout */ |
| 4960 | 4967 | return TC0220IOC_regs[4]; |
| 4961 | 4968 | |
| 4962 | 4969 | case 0x07: /* INB0-7 (coin) */ |
| 4963 | return input_port_ | |
| 4970 | return input_port_ | |
| 4964 | 4971 | |
| 4965 | 4972 | default: |
| 4966 | 4973 | logerror("PC %06x: warning - read TC0220IOC address %02x\n",activecpu_get_pc(),offset); |
| r2375 | r2376 | |
| 5106 | 5113 | switch (offset) |
| 5107 | 5114 | { |
| 5108 | 5115 | case 0x00: /* DSA */ |
| 5109 | return input_port_ | |
| 5116 | return input_port_ | |
| 5110 | 5117 | |
| 5111 | 5118 | case 0x01: /* DSB */ |
| 5112 | return input_port_ | |
| 5119 | return input_port_ | |
| 5113 | 5120 | |
| 5114 | 5121 | case 0x02: /* 1P */ |
| 5115 | return input_port_ | |
| 5122 | return input_port_ | |
| 5116 | 5123 | |
| 5117 | 5124 | case 0x03: /* 2P */ |
| 5118 | return input_port_ | |
| 5125 | return input_port_ | |
| 5119 | 5126 | |
| 5120 | 5127 | case 0x04: /* coin counters and lockout */ |
| 5121 | 5128 | return TC0510NIO_regs[4]; |
| 5122 | 5129 | |
| 5123 | 5130 | case 0x07: /* coin */ |
| 5124 | return input_port_ | |
| 5131 | return input_port_ | |
| 5125 | 5132 | |
| 5126 | 5133 | default: |
| 5127 | 5134 | logerror("PC %06x: warning - read TC0510NIO address %02x\n",activecpu_get_pc(),offset); |
| r2375 | r2376 | |
| 5189 | 5196 | switch (offset) |
| 5190 | 5197 | { |
| 5191 | 5198 | case 0x00: /* DSA */ |
| 5192 | return input_port_ | |
| 5199 | return input_port_ | |
| 5193 | 5200 | |
| 5194 | 5201 | case 0x01: /* DSB */ |
| 5195 | return input_port_ | |
| 5202 | return input_port_ | |
| 5196 | 5203 | |
| 5197 | 5204 | case 0x02: /* 1P */ |
| 5198 | return input_port_ | |
| 5205 | return input_port_ | |
| 5199 | 5206 | |
| 5200 | 5207 | case 0x03: /* 2P */ |
| 5201 | return input_port_ | |
| 5208 | return input_port_ | |
| 5202 | 5209 | |
| 5203 | 5210 | case 0x04: /* coin counters and lockout */ |
| 5204 | 5211 | return TC0640FIO_regs[4]; |
| 5205 | 5212 | |
| 5206 | 5213 | case 0x07: /* coin */ |
| 5207 | return input_port_ | |
| 5214 | return input_port_ | |
| 5208 | 5215 | |
| 5209 | 5216 | default: |
| 5210 | 5217 | logerror("PC %06x: warning - read TC0640FIO address %02x\n",activecpu_get_pc(),offset); |
| r2375 | r2376 | |
|---|---|---|
| 309 | 309 | { |
| 310 | 310 | btime_palette = (data >> 2) & 0x03; |
| 311 | 311 | |
| 312 | if (!(input_port_ | |
| 312 | if (!(input_port_ | |
| 313 | 313 | { |
| 314 | 314 | flip_screen_set(data & 0x01); |
| 315 | 315 | } |
| r2375 | r2376 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | /***************************************************************************/ |
| 19 | 19 | |
| 20 | void PC080SN_vh_start(int chips,int gfxnum,int x_offset,int y_offset,int y_invert,int opaque,int dblwidth); | |
| 20 | void PC080SN_vh_start(running_machine *machine,int chips,int gfxnum,int x_offset,int y_offset,int y_invert,int opaque,int dblwidth); | |
| 21 | 21 | READ16_HANDLER ( PC080SN_word_0_r ); |
| 22 | 22 | WRITE16_HANDLER( PC080SN_word_0_w ); |
| 23 | 23 | WRITE16_HANDLER( PC080SN_xscroll_word_0_w ); |
| r2375 | r2376 | |
| 172 | 172 | |
| 173 | 173 | /***************************************************************************/ |
| 174 | 174 | |
| 175 | void TC0110PCR_vh_start(void); | |
| 176 | void TC0110PCR_1_vh_start(void); /* 2nd chip */ | |
| 177 | void TC0110PCR_2_vh_start(void); /* 3rd chip */ | |
| 175 | void TC0110PCR_vh_start(running_machine *machine); | |
| 176 | void TC0110PCR_1_vh_start(running_machine *machine); /* 2nd chip */ | |
| 177 | void TC0110PCR_2_vh_start(running_machine *machine); /* 3rd chip */ | |
| 178 | 178 | READ16_HANDLER ( TC0110PCR_word_r ); |
| 179 | 179 | READ16_HANDLER ( TC0110PCR_word_1_r ); /* 2nd chip */ |
| 180 | 180 | READ16_HANDLER ( TC0110PCR_word_2_r ); /* 3rd chip */ |
| r2375 | r2376 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | These are some of the CPS-B chip numbers: | |
| 3 | The CPS1 system is made of 3 boards: A, B and C. The first two games also exist | |
| 4 | a 2-board setups, where the C-board is integrated into the B-board. | |
| 4 | 5 | |
| 5 | NAME CPS-B # C-board PAL's B-board PAL's | |
| 6 | Forgotten Worlds / Lost Worlds CPS-B-01 DL-0411-10001 None LWCH1 & LW10 | |
| 7 | Ghouls 'n Ghosts CPS-B-01 DL-0411-10001 None DM620, LW10 | |
| 8 | Strider CPS-B-01 DL-0411-10001 None ST24N1 & LW10 or ST22B | |
| 9 | Dynasty Wars CPS-B-02 DL-0411-10002 ? ? | |
| 10 | Willow CPS-B-03 DL-0411-10003 None WL24B & LW10 | |
| 11 | UN Squadron / Area 88 CPS-B-11 DL-0411-10004 None AR24B & LW10 | |
| 12 | Street Fighter II (ETC Rev G) CPS-B-11 DL-0411-10004 None STF29 & IOB1 | |
| 13 | Final Fight (World / Japan) CPS-B-04 DL-0411-10005 None S224B & LW10 | |
| 14 | Final Fight (US) CPS-B-04* DL-0411-10001 None S224B & LW10 | |
| 15 | *actually CPS-B-01, the original number was scratched out and "04" stamped over it | |
| 16 | Varth CPS-B-04 DL-0411-10005 None VA24B & LW10 | |
| 17 | 1941 CPS-B-05 DL-0411-10006 ? YI24B & ? | |
| 18 | Street Fighter II (US Rev D) CPS-B-05 DL-0411-10006 C632 STF29 & IOB1 | |
| 19 | Mercs (US) CPS-B-12 DL-0411-10007 C628 0224B & IOB1 | |
| 20 | Street Fighter II (Japan Rev C) CPS-B-12 DL-0411-10007 C632 STF29 & IOB1 | |
| 21 | Magic Sword (US) CPS-B-13 DL-0411-10008 None MS24B & IOB1 | |
| 22 | Street Fighter II (Japan) CPS-B-13 DL-0411-10008 C632 STF29 & IOB1 | |
| 23 | Chiki Chiki Boys / Mega Twins CPS-B-14 DL-0411-10009 ? CK24B & IOB1 | |
| 24 | Street Fighter II (US Rev I) CPS-B-14 DL-0411-10009 C632 STF29 & IOB1 | |
| 25 | Nemo CPS-B-15 DL-0411-10010 ? NM24B & ? | |
| 26 | Carrier Air Wing CPS-B-16 DL-0411-10011 None CA24B & IOB1 | |
| 27 | Street Fighter II CPS-B-17 DL-0411-10012 C632 STF29 & IOB1 | |
| 28 | Three Wonders* CPS-B-21 DL-0921-10014 IOC1 & C632 RT24B & IOB1 | |
| 29 | King of Dragons* CPS-B-21 DL-0921-10014 IOC1 & C632 KD29B & IOB1 | |
| 30 | Captain Commando* (US) CPS-B-21 DL-0921-10014 IOC1 & C632 CC63B, CCPRG & IOB1 | |
| 31 | Knights of the Round* CPS-B-21 DL-0921-10014 IOC1 & C632 KR63B, BPRG1 & IOB1 | |
| 32 | Street Fighter II' Champion Edition CPS-B-21 DL-0921-10014 IOC1 & C632 S9263B, BPRG1 & IOB1 | |
| 33 | Capcom World 2* CPS-B-21 DL-0921-10014 IOC1 Q522B & IOB1 | |
| 34 | Quiz and Dragons* CPS-B-21 DL-0921-10014 IOC1 QD22B & IOB1 | |
| 35 | Warriors of Fate* CPS-B-21 DL-0921-10014 IOC1 TK263B, BPRG1 & IOB1 | |
| 36 | Street Fighter II Turbo Hyper Fighting CPS-B-21 DL-0921-10014 IOC1 & C632 S9263B, BPRG1 & IOB1 | |
| 37 | Cadillacs and Dinosaurs* CPS-B-21 DL-0921-10014 IOC1 CD63B, BPRG1 & IOB1 | |
| 38 | Punisher* CPS-B-21 DL-0921-10014 IOC1 PS63B, BPRG1 & IOB1 | |
| 39 | Saturday Night Slam Masters* CPS-B-21 DL-0921-10014 IOC1 MB63B, BPRG1 & IOB1 | |
| 40 | Muscle Bomber Duo* CPS-B-21 DL-0921-10014 ? ? | |
| 41 | Pnickies CPS-B-21? DL-0921-10014? ? ? | |
| 42 | Pang 3 CPS-B-21 DL-0921-10014 IOC1 & C632 CP1B1F, CP1B8K & CP1B9KA | |
| 43 | Megaman the Power Battle CPS-B-21 DL-0921-10014 IOC1 & C632 RCM63B, BPRG1 & IOB1 | |
| 6 | There are several revisions of the A-board, but they are functionally equivalent | |
| 7 | and interchangeable except for 89626A-4 DASH used by sf2 which has a 12MHz xtal | |
| 8 | replacing the 10Hz one. Note that it's likely that from one point onwards Capcom | |
| 9 | simply switched to make only 89626A-4 DASH board, that is all games after a | |
| 10 | certain point should use the 12MHz xtal not just sf2. | |
| 11 | Verified: Quiz and Dragons (US) comes with the DASH version (original pcb with sticker). | |
| 44 | 12 | |
| 45 | Street Fighter Zero changer system (Japan) CPS-B-21 DL-0921-10014 ? ? | |
| 13 | Known A-board revisions: | |
| 14 | 88617A-4 | |
| 15 | 88617A-5 | |
| 16 | 88617A-7 | |
| 17 | 88617A-7b | |
| 18 | 89626A-4 | |
| 19 | 89626A-4 DASH | |
| 46 | 20 | |
| 21 | NAME Year B-board # B-board PALs C-board # CPS-B # C-board PALs | |
| 22 | ------------------------------------------- ---- -------- --------------------- --------- ----------------------- ------------- | |
| 23 | Forgotten Worlds / Lost Worlds 1988 88618B-2 LWCHR LWIO None CPS-B-01 DL-0411-10001 None | |
| 24 | (alt B-board revision) 88621B-2 LW621 LWIO ? | |
| 25 | Ghouls 'n Ghosts (World / US) 1988 88620B-2 DM620 LWIO None CPS-B-01 DL-0411-10001 None | |
| 26 | (alt B-board revision - Japan) 88622B-2 DM22A LWIO 88622-C-1 CPS-B-01 DL-0411-10001 None | |
| 27 | Strider 1989 89624B-2 ST24M1 LWIO 88622-C-1 CPS-B-01 DL-0411-10001 None | |
| 28 | (alt B-board version) 89624B-3 ST24B2 LWIO | |
| 29 | (alt B-board revision) ? ST22B ? | |
| 30 | Dynasty Wars 1989 ? ? ? CPS-B-02 DL-0411-10002 | |
| 31 | Willow 1989 89624B-3 WL24B LWIO 88622-C-4 CPS-B-03 DL-0411-10003 None | |
| 32 | UN Squadron / Area 88 1989 89624B-3 AR24B LWIO 88622-C-4 CPS-B-11 DL-0411-10004 None | |
| 33 | (alt B-board revision) 1989 88622B-2 AR22B LWIO | |
| 34 | Final Fight (first rev) 1989 89624B-3 S224B IOB1 88622-C-5 CPS-B-04 DL-0411-10005 None | |
| 35 | Final Fight (US 900112) ? CPS-B-04@ DL-0411-10001 None | |
| 36 | Final Fight (US 900613) ? CPS-B-05 DL-0411-10006 | |
| 37 | Final Fight (Japan 900305) ? CPS-B-02 DL-0411-10002 | |
| 38 | 1941 1990 ? YI24B ? 88622-C-5 CPS-B-05 DL-0411-10006 ? | |
| 39 | Mercs (US) 1990 89624B-3 0224B IOB1 90628-C-1 CPS-B-12 DL-0411-10007 C628 | |
| 40 | Magic Sword (US) 1990 89624B-3 MS24B IOB1 88622-C-5 CPS-B-13 DL-0411-10008 None | |
| 41 | Chiki Chiki Boys / Mega Twins 1990 89624B-3 CK24B IOB1 88622-C-5 CPS-B-14 DL-0411-10009 None | |
| 42 | Nemo 1990 89624B-3 NM24B IOB1 88622-C-5 CPS-B-15 DL-0411-10010 None | |
| 43 | Carrier Air Wing / U.S. Navy 1990 89624B-3 CA24B IOB1 88622-C-5 CPS-B-16 DL-0411-10011 None | |
| 44 | (alt B-board revision) 89625B-1 CA22B | |
| 45 | Street Fighter II (910214) 1991 ? STF29 IOB1 90632C-1 CPS-B-17 DL-0411-10012 C632 | |
| 46 | Street Fighter II (US 910206) CPS-B-17 DL-0411-10012 | |
| 47 | Street Fighter II (US 910228) CPS-B-18 ? | |
| 48 | Street Fighter II (Japan 910306) CPS-B-12 DL-0411-10007 | |
| 49 | Street Fighter II (US 910318) CPS-B-05 DL-0411-10006 | |
| 50 | Street Fighter II (US 910411) CPS-B-15 DL-0411-10010 | |
| 51 | Street Fighter II (World 910522) CPS-B-11 DL-0411-10004 | |
| 52 | Street Fighter II (US 910522) CPS-B-14 DL-0411-10009 | |
| 53 | Street Fighter II (US 911101) CPS-B-17 DL-0411-10012 | |
| 54 | Street Fighter II (Japan 911210) CPS-B-13 DL-0411-10008 | |
| 55 | Three Wonders* 1991 89624B-3 RT24B IOB1 90630C-4 CPS-B-21 DL-0921-10014 IOC1 | |
| 56 | (alt B-board revision) 89625B-1 RT22B IOB1 | |
| 57 | King of Dragons* 1991 90629B-3 KD29B IOB1 90631C-5 CPS-B-21 DL-0921-10014 C632 IOC1 | |
| 58 | Captain Commando* 1991 91635B-2 CC63B CCPRG IOB1 90631C-5 CPS-B-21 DL-0921-10014 C632 IOC1 | |
| 59 | Knights of the Round* 1991 91635B-2 KR63B BPRG1 IOB1 90631C-5 CPS-B-21 DL-0921-10014 C632 IOC1 | |
| 60 | Street Fighter II' Champion Edition 1992 91635B-2 S9263B BPRG1 IOB1 92631C-6 CPS-B-21 DL-0921-10014 C632 IOC1 | |
| 61 | Varth (World / US) 1992 89624B-3 VA24B IOB1 88622-C-5 CPS-B-04 DL-0411-10005 None | |
| 62 | Varth (Japan)* 1992 ? ? ? CPS-B-21 DL-0921-10014 ? | |
| 63 | Capcom World 2* 1992 ? Q522B IOB1 ? CPS-B-21 DL-0921-10014 IOC1 | |
| 64 | Quiz and Dragons (US)* 1992 89625B-1 QD22B IOB1 92641C-1 CPS-B-21 DL-0921-10014 IOC1 | |
| 65 | Quiz and Dragons (Japan)* 1994 ? ? IOB1 ? CPS-B-21 DL-0921-10014 IOC1 | |
| 66 | Warriors of Fate* 1992 ? TK263B BPRG1 IOB1 92641C-1 CPS-B-21 DL-0921-10014 IOC1 | |
| 67 | Street Fighter II Turbo Hyper Fighting 1992 91635B-2 S9263B BPRG1 IOB1 92631C-6 CPS-B-21 DL-0921-10014 C632 IOC1 | |
| 68 | Cadillacs and Dinosaurs* 1993 ? CD63B BPRG1 IOB1 92641C-1 CPS-B-21 DL-0921-10014 IOC1 | |
| 69 | Punisher* 1993 91635B-2 PS63B BPRG1 IOB1 92641C-1 CPS-B-21 DL-0921-10014 IOC1 | |
| 70 | Saturday Night Slam Masters* 1993 ? MB63B BPRG1 IOB1 92641C-1 CPS-B-21 DL-0921-10014 IOC1 | |
| 71 | Muscle Bomber Duo* 1993 ? ? 92641C-1 CPS-B-21 DL-0921-10014 ? | |
| 72 | Quiz Tonosama no Yabou 2 1995 ? ? ? ? | |
| 73 | Pnickies 1994 ? ? ? CPS-B-21? DL-0921-10014? ? | |
| 74 | Pang 3 1995 94916-10 CP1B1F,CP1B8K,CP1B9KA 92631C-6 CPS-B-21 DL-0921-10014 C632 IOC1 | |
| 75 | Megaman the Power Battle 1995 ? RCM63B BPRG1 IOB1 ? CPS-B-21 DL-0921-10014 C632 IOC1 | |
| 76 | ||
| 77 | @actually CPS-B-01, the original number was scratched out and "04" stamped over it | |
| 47 | 78 | *denotes Suicide Battery |
| 48 | 79 | |
| 80 | The C628/C632 PALs on some C-boards probably handle the extra inputs (6 buttons/third player). | |
| 81 | ||
| 49 | 82 | You can set the suicide CPS-B-21 chips to their default layer register and priority bit values |
| 50 | 83 | if you pull pins 45 and 46 high (floating the pins seems to work, too). The default is the same |
| 51 | 84 | values as Street Fighter 2 CE/Turbo. |
| r2375 | r2376 | |
| 58 | 91 | 0x04-0x05 Scroll2 (16x16) RAM base (/256) |
| 59 | 92 | 0x06-0x07 Scroll3 (32x32) RAM base (/256) |
| 60 | 93 | 0x08-0x09 rowscroll RAM base (/256) |
| 61 | 0x0a-0x0b Palette base (/256) | |
| 94 | 0x0a-0x0b Palette base (/256) after this register is written to, the palette | |
| 95 | is copied from gfxram to the dedicated ram. The palette control | |
| 96 | register (see below) determines how the copy should happen. | |
| 97 | Tests on a msword pcb show that the minimum alignment for the palette | |
| 98 | is 0x400 bytes. The hardware seems to ignore bit 1, while when bit 0 | |
| 99 | is set the palette doesn't seem to be copied. However, some games set | |
| 100 | bit 0 during boot (ghouls, strider, 1941) so it still isn't clear | |
| 101 | what bit 0 should actually do. | |
| 62 | 102 | 0x0c-0x0d Scroll 1 X |
| 63 | 103 | 0x0e-0x0f Scroll 1 Y |
| 64 | 104 | 0x10-0x11 Scroll 2 X |
| r2375 | r2376 | |
| 70 | 110 | 0x1c-0x1d Starfield 2 X |
| 71 | 111 | 0x1e-0x1f Starfield 2 Y |
| 72 | 112 | 0x20-0x21 start offset for the rowscroll matrix |
| 73 | 0x22-0x23 unknown but widely used - usually 0x0e. bit 0 enables rowscroll | |
| 74 | on layer 2. bit 15 is flip screen. | |
| 113 | 0x22-0x23 video control. Usually 0x0e. | |
| 114 | bit 0 enables rowscroll on layer 2. | |
| 115 | bit 15 is flip screen. | |
| 116 | ghouls sets bit 14. Purpose unknown. | |
| 117 | 1941 uses bits 1-3 by setting them to 0 on screen transitions, | |
| 118 | however it also uses the normal layer control register so there | |
| 119 | doesn't seem to be an obvious effect. | |
| 75 | 120 | |
| 121 | Games known to use rowscroll: | |
| 122 | SF2 | |
| 123 | Mega Twins (underwater, cave) | |
| 124 | Carrier Air Wing (hazy background at beginning of mission 8, put 07 at ff8501 to jump there) | |
| 125 | Magic Sword (fire on floor 3; screen distort after continue) | |
| 126 | Varth (title screen) | |
| 127 | Captain Commando (end game sequence) | |
| 76 | 128 | |
| 129 | Tests done on msword at the beginning of gameplay (many thanks to Corrado Tomaselli for these): | |
| 130 | 3e is the default value set by the game (not 0e like most games) | |
| 131 | 3c the last two rows of scroll1 are repeated on the whole screen | |
| 132 | 3a scroll2 is disabled | |
| 133 | 36 scroll3 is disabled | |
| 134 | 2e no visible differences | |
| 135 | 1e no visible differences | |
| 136 | one might suspect that bits 4&5 should disable the star layers, but | |
| 137 | Strider sets this register to 0x0e so that's not possible. | |
| 138 | ||
| 139 | TODO: | |
| 140 | the scroll2/scroll3 disable bits are supported by the emulation, | |
| 141 | while the scroll1 weird effect is not (it doesn't seem to make a | |
| 142 | difference on any game). | |
| 143 | ||
| 144 | ||
| 77 | 145 | Some registers move from game to game.. following example strider |
| 78 | 146 | 0x66-0x67 Layer control register |
| 79 | 147 | bits 14-15 seem to be unused |
| 80 | 148 | ghouls sets bits 15 in service mode when you press button 2 in |
| 81 | the input test | |
| 149 | the input test, with no apparent effect on the pcb. | |
| 150 | qtono2 sets them both at the game over screen. | |
| 82 | 151 | bits 6-13 (4 groups of 2 bits) select layer draw order |
| 83 | 152 | bits 1-5 enable the three tilemap layers and the two starfield |
| 84 | 153 | layers (the bit order changes from game to game). |
| r2375 | r2376 | |
| 86 | 155 | bit 0 could be rowscroll related. It is set by captain commando, |
| 87 | 156 | varth, mtwins, mssword, cawing while rowscroll is active. However |
| 88 | 157 | kodj and sf2 do NOT set this bit while they are using rowscroll. |
| 89 | Games known to use row scrolling: | |
| 90 | SF2 | |
| 91 | Mega Twins (underwater, cave) | |
| 92 | Carrier Air Wing (hazy background at beginning of mission 8, put 07 at ff8501 to jump there) | |
| 93 | Magic Sword (fire on floor 3; screen distort after continue) | |
| 94 | Varth (title screen) | |
| 95 | Captain Commando (end game sequence) | |
| 158 | Tests on the msword pcb show that even if this bit is not set, | |
| 159 | rowscroll still works. Therefore, the purpose of this bit is unclear. | |
| 96 | 160 | 0x68-0x69 Priority mask \ Tiles in the layer just below sprites can have |
| 97 | 161 | 0x6a-0x6b Priority mask | four priority levels, each one associated with one |
| 98 | 162 | 0x6c-0x6d Priority mask | of these masks. The masks indicate pens in the tile |
| 99 | 163 | 0x6e-0x6f Priority mask / that have priority over sprites. |
| 100 | 0x70-0x71 Control register (usually 0x003f). The details of how this register | |
| 101 | works are unknown, but it definitely affects the palette, and games | |
| 102 | always set it together with the palette base register. | |
| 103 | Experiments on the real board show that values different from 0x3f in | |
| 104 | the low 6 bits cause wrong colors. The other bits seem to be unused. | |
| 105 | There is one CPS2 game (Slammasters II) setting this to 0x2f: the | |
| 106 | purpose is unknown. | |
| 107 | The only other places where this register seems to be set to a value | |
| 108 | different from 0x3f is during startup tests. Examples: | |
| 164 | 0x70-0x71 Palette control register. This indicates which palette | |
| 165 | pages to copy when the palette base register is written to. | |
| 166 | There is one CPS2 game (Slammasters II) setting this to 0x2f; all the other | |
| 167 | games normally set it to 0x3f, though in some cases different values are | |
| 168 | used during boot: | |
| 109 | 169 | ghouls 0x02 (and palette base is set to 9105; palette base is 9100 normally) |
| 110 | 170 | strider 0x02 (and palette base is set to 9145; palette base is 9140 normally) |
| 111 | 171 | 1941 0x02 (and palette base is set to 9145; palette base is 9140 normally) |
| r2375 | r2376 | |
| 113 | 173 | kod 0x0f |
| 114 | 174 | mtwins 0x0f |
| 115 | 175 | |
| 176 | bit 0: copy page 0 (sprites) | |
| 177 | bit 1: copy page 1 (scroll1) | |
| 178 | bit 2: copy page 2 (scroll2) | |
| 179 | bit 3: copy page 3 (scroll3) | |
| 180 | bit 4: copy page 4 (stars1) | |
| 181 | bit 5: copy page 5 (stars2) | |
| 182 | ||
| 183 | An important quirk is that if bit 0 is not set (sprite page is not copied) | |
| 184 | page 0 in gfxram is not skipped but instead is copied to page 1; that is, | |
| 185 | all pages are moved down by one. For the other pages, if the bit is not | |
| 186 | set the gfxram page is skipped. | |
| 187 | ||
| 188 | bits 0-3 have been verified with reasonable confidence on a msword pcb, | |
| 189 | while bits 4-5 are only supposed. | |
| 190 | ||
| 116 | 191 | Fixed registers |
| 117 | 192 | 0x80-0x81 Sound command |
| 118 | 193 | 0x88-0x89 Sound fade |
| 119 | 194 | |
| 195 | ||
| 196 | A special note has to be made about tile/sprite codes. Even if all graphics are | |
| 197 | stored together in the same ROMs, the hardware knows which part of the ROM space | |
| 198 | is 8x8 tiles, 16x16 tiles, 16x16 spites, 32x32 tiles, and all games tested only | |
| 199 | draw tiles if their code falls in the valid range. If a tile is out of range, it | |
| 200 | is replaced by transparent pixels. | |
| 201 | Ideally, this shouldn't be important as far as the emulation is concerned, since | |
| 202 | games should only request tiles from valid ranges. In practice, many games contain | |
| 203 | bugs which make them try to display out of range tiles. The masking applied by | |
| 204 | the hardware therefore needs to be emulated properly, otherwise glitches appear. | |
| 205 | ||
| 206 | There are various versions of the ROM board (B-board), so the implementation | |
| 207 | details may vary, but in general the tile ranges are controlled by a PAL found | |
| 208 | on the B-board (see the table at the top of this file). | |
| 209 | ||
| 210 | The A-board passes 23 bits of address to the B-board when requesting gfx ROM data. | |
| 211 | The B-board selects 64 bits of data, that is 16 4bpp pixels, and returns half of | |
| 212 | them depending on a signal from the C board. | |
| 213 | The 23 address bits are laid out this way (note that the top 3 bits select the | |
| 214 | tile type; the purpose of the top bit is unknown): | |
| 215 | ||
| 216 | sprite 000ccccccccccccccccyyyy | |
| 217 | scroll1 001?ccccccccccccccccyyy | |
| 218 | scroll2 010ccccccccccccccccyyyy | |
| 219 | scroll3 011ccccccccccccccyyyyyx | |
| 220 | stars 100000000sxxxxxyyyyyyyy (to be verified) | |
| 221 | ||
| 222 | where | |
| 223 | c is the tile code | |
| 224 | y is the y position in the tile | |
| 225 | x is the x position in the tile (only applicable to 32x32 tiles) | |
| 226 | ||
| 227 | E.g. on the 89624B-3 board, used by cawing and others, the top 13 bits of the | |
| 228 | address are passed to the 16L8B PAL @1A, which outputs the /OE signal for roms | |
| 229 | 1,3,5,7 (together), 2,4,6,8 (together), 10,12,14,16,20,22,24,26 (together) or | |
| 230 | 11,13,15,17,21,23,25,27 (together). | |
| 231 | Note that in cawing only sockets 1,3,5,7 are populated, so effectively there is | |
| 232 | only one bank. | |
| 233 | ||
| 234 | The above would mean that | |
| 235 | 1) 8x8 and 16x16 tiles have a 16-bit tile code, while | |
| 236 | 32x32 tiles have a 14-bit tile code | |
| 237 | 2) which ROM bank to use is determined by | |
| 238 | bits 15-7 of a 8x8 tile code, | |
| 239 | bits 15-6 of a 16x16 tile code, | |
| 240 | bits 13-4 of a 32x32 tile code | |
| 241 | ||
| 242 | If the PAL decides that the tile code is out of range and doesn't output any /OE | |
| 243 | signal, no ROM is read and pullup resistors force the result to all 1 (which | |
| 244 | means a transparent tile). | |
| 245 | ||
| 246 | Note that there are several known cases (nemo, cawing, 3wonders, varth, etc.) where | |
| 247 | 16x16 tiles are used for BOTH sprites and scroll2. | |
| 248 | ||
| 249 | Ideally, the PALs should be dumped and loaded like the ROMs, and the mapping should | |
| 250 | be derived from the loaded PALs at run time. | |
| 251 | In practice, this is unlikely to happen, so we'll have to tolerate using hardcoded | |
| 252 | maps for every game. | |
| 253 | ||
| 254 | ||
| 120 | 255 | Known Bug List |
| 121 | 256 | ============== |
| 122 | 257 | CPS2: |
| r2375 | r2376 | |
| 131 | 266 | * Sprites are currently lagged by one frame to keep sync with backgrounds. This causes |
| 132 | 267 | sprites to stay on screen one frame longer (visable in VSAV attract mode). |
| 133 | 268 | |
| 269 | * The boot screen of some CPS2 games has a blue background instead of black, | |
| 270 | however that might be the correct behaviour. | |
| 271 | ||
| 134 | 272 | Marvel Vs. Capcom |
| 135 | 273 | * Sometimes currupt gfx are displayed on the 32x32 layer as the screen flashes at the |
| 136 | 274 | start of super combo moves. The problem seems to be due to tiles being fetched before |
| r2375 | r2376 | |
| 138 | 276 | |
| 139 | 277 | CPS1: |
| 140 | 278 | SF2 |
| 141 | * Missing chain in the foreground in Ken's level, and sign in Cun Li's level. | |
| 279 | * Missing chain in the foreground in Ken's level, and sign in Chun Li's level. | |
| 142 | 280 | Those graphics are in the backmost layer. |
| 143 | 281 | |
| 144 | UN Squadron | |
| 145 | * DOT TEST in service mode shows garbage chars | |
| 146 | ||
| 147 | Magic Sword. | |
| 148 | * during attract mode, characters are shown with a black background. There is | |
| 149 | a background, but the layers are disabled. I think this IS the correct | |
| 150 | behaviour. | |
| 151 | ||
| 152 | 282 | King of Dragons (World). |
| 153 | 283 | * Distortion effect missing on character description screen during attract |
| 154 | mode. The game rapidly toggles on and off the layer enable bit. Again, I | |
| 155 | think this IS the correct behaviour. The Japanese version does the | |
| 284 | mode. The game rapidly toggles on and off the layer enable bit. | |
| 285 | I think this IS the correct behaviour. The Japanese version does the | |
| 156 | 286 | distortion as expected. |
| 157 | 287 | |
| 158 | 288 | 3wonders |
| 159 | * one bad tile at the end of level 1 | |
| 160 | 289 | * writes to output ports 42, 44, 46. |
| 161 | 290 | |
| 162 | 291 | qad |
| 163 | 292 | * layer enable mask incomplete |
| 164 | 293 | |
| 165 | wof | |
| 166 | * In round 8, when the player goes over a bridge, there is a problem with | |
| 167 | some sprites. When an enemy falls to the floor near the edge of the bridge, | |
| 168 | parts of it become visible under the bridge. | |
| 169 | 294 | |
| 170 | varth | |
| 171 | * the background color during startup is brown, while it should most likely be | |
| 172 | black. This is caused by the background color palette entry (0xbff), however | |
| 173 | that entry is definitely correct and used by other games (3wonders, mtwins) | |
| 174 | to make the background different from black. | |
| 175 | The boot screen of some CPS2 also has a blue background instead of black, | |
| 176 | however that might be the correct behaviour. | |
| 177 | ||
| 178 | ||
| 179 | 295 | Unknown issues |
| 180 | 296 | ============== |
| 181 | 297 | |
| r2375 | r2376 | |
| 191 | 307 | |
| 192 | 308 | #define VERBOSE 0 |
| 193 | 309 | |
| 194 | #define CPS1_DUMP_VIDEO 0 | |
| 195 | ||
| 196 | 310 | /******************************************************************** |
| 197 | 311 | |
| 198 | 312 | Configuration table: |
| r2375 | r2376 | |
| 200 | 314 | ********************************************************************/ |
| 201 | 315 | |
| 202 | 316 | /* Game specific data */ |
| 317 | ||
| 318 | #define GFXTYPE_SPRITES (1<<0) | |
| 319 | #define GFXTYPE_SCROLL1 (1<<1) | |
| 320 | #define GFXTYPE_SCROLL2 (1<<2) | |
| 321 | #define GFXTYPE_SCROLL3 (1<<3) | |
| 322 | #define GFXTYPE_STARS (1<<4) | |
| 323 | ||
| 324 | ||
| 325 | struct gfx_range | |
| 326 | { | |
| 327 | // start and end are as passed by the game (shift adjusted to be all | |
| 328 | // in the same scale a 8x8 tiles): they don't necessarily match the | |
| 329 | // position in ROM. | |
| 330 | int type; | |
| 331 | int start; | |
| 332 | int end; | |
| 333 | int bank; | |
| 334 | }; | |
| 335 | ||
| 203 | 336 | struct CPS1config |
| 204 | 337 | { |
| 205 | 338 | const char *name; /* game driver name */ |
| r2375 | r2376 | |
| 221 | 354 | |
| 222 | 355 | int layer_control; |
| 223 | 356 | int priority[4]; |
| 224 | int control | |
| 357 | int palette_control | |
| 225 | 358 | |
| 226 | 359 | /* ideally, the layer enable masks should consist of only one bit, */ |
| 227 | 360 | /* but in many cases it is unknown which bit is which. */ |
| 228 | 361 | int layer_enable_mask[5]; |
| 229 | 362 | |
| 363 | int bank_size; | |
| 364 | const struct gfx_range *bank_mapper; | |
| 365 | ||
| 230 | 366 | int bank_scroll1; |
| 231 | 367 | int bank_scroll2; |
| 232 | 368 | int bank_scroll3; |
| r2375 | r2376 | |
| 237 | 373 | const int start_scroll3; |
| 238 | 374 | const int end_scroll3; |
| 239 | 375 | |
| 240 | int | |
| 376 | int b | |
| 241 | 377 | }; |
| 242 | 378 | |
| 243 | 379 | static const struct CPS1config *cps1_game_config; |
| 244 | 380 | |
| 245 | /* CPSB ID multiply protection ctrl priority masks unknwn layer enable masks */ | |
| 381 | ||
| 382 | /* CPSB ID multiply protection ctrl priority masks palctrl layer enable masks */ | |
| 246 | 383 | #define CPS_B_01 0x00,0x0000, 0,0,0,0, /* n/a */ 0x66,{0x68,0x6a,0x6c,0x6e},0x70, {0x02,0x04,0x08,0x30,0x30} |
| 247 | 384 | #define CPS_B_02 0x60,0x0002, 0,0,0,0, /* n/a */ 0x6c,{0x6a,0x68,0x66,0x64},0x62, {0x02,0x04,0x08,0x00,0x00} |
| 248 | 385 | #define CPS_B_03 0x00,0x0000, 0,0,0,0, /* n/a */ 0x70,{0x6e,0x6c,0x6a,0x68},0x66, {0x20,0x10,0x08,0x00,0x00} |
| r2375 | r2376 | |
| 272 | 409 | #define HACK_B_1 0x00,0x0000, 0x00,0x00,0x00,0x00, 0x54,{0x52,0x50,0x4e,0x4c},0x5c, {0xff,0xff,0xff,0x00,0x00} |
| 273 | 410 | |
| 274 | 411 | |
| 412 | static const struct gfx_range mapper_LWCHR[] = | |
| 413 | { | |
| 414 | // verified from PAL dump (PAL16P8B @ 3A): | |
| 415 | // bank size = 8000 | |
| 416 | // bank 0 = pin 16 | |
| 417 | // bank 1 = pin 19 | |
| 418 | // pin 12 and pin 14 are always enabled (except for stars) | |
| 419 | // note that allowed codes go up to 0x1ffff but physical ROM is half that size | |
| 420 | ||
| 421 | /* type start end bank */ | |
| 422 | { GFXTYPE_STARS, 0x00000, 0x1ffff, 0 }, | |
| 423 | { GFXTYPE_SCROLL2, 0x00000, 0x1ffff, 0 }, | |
| 424 | { GFXTYPE_SCROLL3, 0x00000, 0x1ffff, 0 }, | |
| 425 | ||
| 426 | { GFXTYPE_SPRITES, 0x00000, 0x07fff, 1 }, | |
| 427 | { GFXTYPE_SCROLL1, 0x00000, 0x1ffff, 1 }, | |
| 428 | { 0 } | |
| 429 | }; | |
| 430 | ||
| 431 | static const struct gfx_range mapper_DM620[] = | |
| 432 | { | |
| 433 | /* type start end bank */ | |
| 434 | { GFXTYPE_SPRITES, 0x0000, 0x1fff, 0 }, | |
| 435 | { GFXTYPE_SCROLL1, 0x2000, 0x3fff, 0 }, | |
| 436 | { GFXTYPE_SCROLL2, 0x4000, 0x7fff, 0 }, | |
| 437 | ||
| 438 | { GFXTYPE_SCROLL3, 0x8000, 0x9fff, 1 }, | |
| 439 | { GFXTYPE_SPRITES, 0x2000, 0x7fff, 1 }, // a000-ffff physical | |
| 440 | { 0 } | |
| 441 | }; | |
| 442 | ||
| 443 | static const struct gfx_range mapper_ST24M1[] = | |
| 444 | { | |
| 445 | // verified from PAL dump: | |
| 446 | // bank size = 4000 | |
| 447 | // bank 0 = pin 19 | |
| 448 | // bank 1 = pin 16 | |
| 449 | // bank 2 = pin 14 | |
| 450 | // bank 3 = pin 12 | |
| 451 | ||
| 452 | /* type start end bank */ | |
| 453 | { GFXTYPE_STARS, 0x00000, 0x1ffff, 0 }, | |
| 454 | { GFXTYPE_SPRITES, 0x00000, 0x03fff, 0 }, | |
| 455 | ||
| 456 | { GFXTYPE_SPRITES, 0x04000, 0x04fff, 1 }, | |
| 457 | { GFXTYPE_SCROLL2, 0x04000, 0x07fff, 1 }, | |
| 458 | ||
| 459 | { GFXTYPE_SCROLL3, 0x00000, 0x03fff, 2 }, | |
| 460 | ||
| 461 | { GFXTYPE_SCROLL3, 0x04000, 0x07fff, 3 }, | |
| 462 | { GFXTYPE_SCROLL1, 0x07000, 0x07fff, 3 }, | |
| 463 | { 0 } | |
| 464 | }; | |
| 465 | ||
| 466 | static const struct gfx_range mapper_dynwar[] = // unknown PAL | |
| 467 | { | |
| 468 | /* type start end bank */ | |
| 469 | { GFXTYPE_SPRITES, 0x0000, 0x5fff, 0 }, | |
| 470 | { GFXTYPE_SCROLL1, 0x6000, 0x7fff, 0 }, | |
| 471 | ||
| 472 | { GFXTYPE_SCROLL3, 0x0000, 0x3fff, 1 }, // 8000-bfff physical | |
| 473 | { GFXTYPE_SCROLL2, 0x4000, 0x7fff, 1 }, // c000-ffff physical | |
| 474 | { 0 } | |
| 475 | }; | |
| 476 | ||
| 477 | static const struct gfx_range mapper_WL24B[] = | |
| 478 | { | |
| 479 | // verified from PAL dump: | |
| 480 | // bank size = 8000 | |
| 481 | // bank 0 = pin 16 | |
| 482 | // bank 1 = pin 12 | |
| 483 | // pin 14 and pin 19 are never enabled | |
| 484 | ||
| 485 | /* type start end bank */ | |
| 486 | { GFXTYPE_SPRITES, 0x0000, 0x4fff, 0 }, | |
| 487 | { GFXTYPE_SCROLL3, 0x5000, 0x6fff, 0 }, | |
| 488 | { GFXTYPE_SCROLL1, 0x7000, 0x7fff, 0 }, | |
| 489 | ||
| 490 | { GFXTYPE_SCROLL2, 0x0000, 0x3fff, 1 }, | |
| 491 | { 0 } | |
| 492 | }; | |
| 493 | ||
| 494 | static const struct gfx_range mapper_S224B[] = | |
| 495 | { | |
| 496 | // verified from PAL dump: | |
| 497 | // bank size = 8000 | |
| 498 | // bank 0 = pin 16 | |
| 499 | // pin 12 & pin 14 give an alternate half-size mapping which would allow to | |
| 500 | // populate the 8-bit ROM sockets instead of the 16-bit ones: | |
| 501 | // pin 12 | |
| 502 | // 0 00000 - 03fff | |
| 503 | // pin 14 | |
| 504 | // 0 04000 - 043ff | |
| 505 | // 1 04400 - 04bff | |
| 506 | // 2 06000 - 07fff | |
| 507 | // 3 04c00 - 05fff | |
| 508 | // pin 19 is never enabled | |
| 509 | ||
| 510 | /* type start end bank */ | |
| 511 | { GFXTYPE_SPRITES, 0x0000, 0x43ff, 0 }, | |
| 512 | { GFXTYPE_SCROLL1, 0x4400, 0x4bff, 0 }, | |
| 513 | { GFXTYPE_SCROLL3, 0x4c00, 0x5fff, 0 }, | |
| 514 | { GFXTYPE_SCROLL2, 0x6000, 0x7fff, 0 }, | |
| 515 | { 0 } | |
| 516 | }; | |
| 517 | ||
| 518 | static const struct gfx_range mapper_YI24B[] = | |
| 519 | { | |
| 520 | // verified from JED: | |
| 521 | // bank size = 8000 | |
| 522 | // bank 0 = pin 16 | |
| 523 | // pin 12 & pin 14 give an alternate half-size mapping which would allow to | |
| 524 | // populate the 8-bit ROM sockets instead of the 16-bit ones: | |
| 525 | // pin 12 | |
| 526 | // 0 0000-1fff | |
| 527 | // 3 2000-3fff | |
| 528 | // pin 14 | |
| 529 | // 1 4000-47ff | |
| 530 | // 2 4800-7fff | |
| 531 | // pin 19 is never enabled | |
| 532 | ||
| 533 | /* type start end bank */ | |
| 534 | { GFXTYPE_SPRITES, 0x0000, 0x1fff, 0 }, | |
| 535 | { GFXTYPE_SCROLL3, 0x2000, 0x3fff, 0 }, | |
| 536 | { GFXTYPE_SCROLL1, 0x4000, 0x47ff, 0 }, | |
| 537 | { GFXTYPE_SCROLL2, 0x4800, 0x7fff, 0 }, | |
| 538 | { 0 } | |
| 539 | }; | |
| 540 | ||
| 541 | static const struct gfx_range mapper_AR24B[] = | |
| 542 | { | |
| 543 | // verified from JED: | |
| 544 | // bank size = 8000 | |
| 545 | // bank 0 = pin 16 | |
| 546 | // pin 12 & pin 14 give an alternate half-size mapping which would allow to | |
| 547 | // populate the 8-bit ROM sockets instead of the 16-bit ones: | |
| 548 | // pin 12 | |
| 549 | // 0 0000-2fff | |
| 550 | // 1 3000-3fff | |
| 551 | // pin 14 | |
| 552 | // 2 4000-5fff | |
| 553 | // 3 6000-7fff | |
| 554 | // pin 19 is never enabled | |
| 555 | ||
| 556 | /* type start end bank */ | |
| 557 | { GFXTYPE_SPRITES, 0x0000, 0x2fff, 0 }, | |
| 558 | { GFXTYPE_SCROLL1, 0x3000, 0x3fff, 0 }, | |
| 559 | { GFXTYPE_SCROLL2, 0x4000, 0x5fff, 0 }, | |
| 560 | { GFXTYPE_SCROLL3, 0x6000, 0x7fff, 0 }, | |
| 561 | { 0 } | |
| 562 | }; | |
| 563 | ||
| 564 | static const struct gfx_range mapper_0224B[] = | |
| 565 | { | |
| 566 | // verified from PAL dump: | |
| 567 | // bank size = 8000 | |
| 568 | // bank 0 = pin 19 | |
| 569 | // bank 1 = pin 12 | |
| 570 | // pin 16 & pin 14 appear to be an alternate half-size mapping for bank 0 | |
| 571 | // but scroll1 is missing: | |
| 572 | // pin 16 | |
| 573 | // 2 00c00 - 03bff | |
| 574 | // 3 03c00 - 03fff | |
| 575 | // pin 14 | |
| 576 | // 3 04000 - 04bff | |
| 577 | // 0 04c00 - 07fff | |
| 578 | ||
| 579 | /* type start end bank */ | |
| 580 | { GFXTYPE_SCROLL1, 0x0000, 0x0bff, 0 }, | |
| 581 | { GFXTYPE_SCROLL2, 0x0c00, 0x3bff, 0 }, | |
| 582 | { GFXTYPE_SCROLL3, 0x3c00, 0x4bff, 0 }, | |
| 583 | { GFXTYPE_SPRITES, 0x4c00, 0x7fff, 0 }, | |
| 584 | ||
| 585 | { GFXTYPE_SPRITES, 0x8000, 0xa7ff, 1 }, | |
| 586 | { GFXTYPE_SCROLL2, 0xa800, 0xb7ff, 1 }, | |
| 587 | { GFXTYPE_SCROLL3, 0xb800, 0xbfff, 1 }, | |
| 588 | { 0 } | |
| 589 | }; | |
| 590 | ||
| 591 | static const struct gfx_range mapper_MS24B[] = | |
| 592 | { | |
| 593 | // verified from PAL dump: | |
| 594 | // bank size = 8000 | |
| 595 | // bank 0 = pin 16 or pin 14 (for 16-bit or 8-bit ROMs) | |
| 596 | // pin 12 is enabled only for sprites, purpose unknown | |
| 597 | // 0 0000-3fff | |
| 598 | // pin 19 is never enabled | |
| 599 | ||
| 600 | /* type start end bank */ | |
| 601 | { GFXTYPE_SPRITES, 0x0000, 0x3fff, 0 }, | |
| 602 | { GFXTYPE_SCROLL1, 0x4000, 0x4fff, 0 }, | |
| 603 | { GFXTYPE_SCROLL2, 0x5000, 0x6fff, 0 }, | |
| 604 | { GFXTYPE_SCROLL3, 0x7000, 0x7fff, 0 }, | |
| 605 | { 0 } | |
| 606 | }; | |
| 607 | ||
| 608 | static const struct gfx_range mapper_CK24B[] = | |
| 609 | { | |
| 610 | /* type start end bank */ | |
| 611 | { GFXTYPE_SPRITES, 0x0000, 0x2fff, 0 }, | |
| 612 | { GFXTYPE_SCROLL1, 0x3000, 0x3fff, 0 }, | |
| 613 | { GFXTYPE_SCROLL2, 0x4000, 0x6fff, 0 }, | |
| 614 | { GFXTYPE_SCROLL3, 0x7000, 0x7fff, 0 }, | |
| 615 | { 0 } | |
| 616 | }; | |
| 617 | ||
| 618 | static const struct gfx_range mapper_NM24B[] = | |
| 619 | { | |
| 620 | // verified from PAL dump: | |
| 621 | // bank size = 8000 | |
| 622 | // bank 0 = pin 16 | |
| 623 | // pin 12 & pin 14 give an alternate half-size mapping which would allow to | |
| 624 | // populate the 8-bit ROM sockets instead of the 16-bit ones: | |
| 625 | // pin 12 | |
| 626 | // 0 00000 - 03fff | |
| 627 | // 2 00000 - 03fff | |
| 628 | // pin 14 | |
| 629 | // 1 04000 - 047ff | |
| 630 | // 0 04800 - 067ff | |
| 631 | // 2 04800 - 067ff | |
| 632 | // 3 06800 - 07fff | |
| 633 | // pin 19 is never enabled | |
| 634 | ||
| 635 | /* type start end bank */ | |
| 636 | { GFXTYPE_SPRITES, 0x0000, 0x3fff, 0 }, | |
| 637 | { GFXTYPE_SCROLL2, 0x0000, 0x3fff, 0 }, | |
| 638 | { GFXTYPE_SCROLL1, 0x4000, 0x47ff, 0 }, | |
| 639 | { GFXTYPE_SPRITES, 0x4800, 0x67ff, 0 }, | |
| 640 | { GFXTYPE_SCROLL2, 0x4800, 0x67ff, 0 }, | |
| 641 | { GFXTYPE_SCROLL3, 0x6800, 0x7fff, 0 }, | |
| 642 | { 0 } | |
| 643 | }; | |
| 644 | ||
| 645 | static const struct gfx_range mapper_CA24B[] = | |
| 646 | { | |
| 647 | // verified from PAL dump: | |
| 648 | // bank size = 8000 | |
| 649 | // bank 0 = pin 16 | |
| 650 | // pin 12 & pin 14 give an alternate half-size mapping which would allow to | |
| 651 | // populate the 8-bit ROM sockets instead of the 16-bit ones: | |
| 652 | // pin 12 | |
| 653 | // 0 0000-2fff | |
| 654 | // 2 0000-2fff | |
| 655 | // 3 3000-3fff | |
| 656 | // pin 14 | |
| 657 | // 3 4000-4fff | |
| 658 | // 1 5000-57ff | |
| 659 | // 0 5800-7fff | |
| 660 | // 2 5800-7fff | |
| 661 | // pin 19 is never enabled (actually it is always enabled when PAL pin 1 is 1, purpose unknown) | |
| 662 | ||
| 663 | /* type start end bank */ | |
| 664 | { GFXTYPE_SPRITES, 0x0000, 0x2fff, 0 }, | |
| 665 | { GFXTYPE_SCROLL2, 0x0000, 0x2fff, 0 }, | |
| 666 | { GFXTYPE_SCROLL3, 0x3000, 0x4fff, 0 }, | |
| 667 | { GFXTYPE_SCROLL1, 0x5000, 0x57ff, 0 }, | |
| 668 | { GFXTYPE_SPRITES, 0x5800, 0x7fff, 0 }, | |
| 669 | { GFXTYPE_SCROLL2, 0x5800, 0x7fff, 0 }, | |
| 670 | { 0 } | |
| 671 | }; | |
| 672 | ||
| 673 | static const struct gfx_range mapper_STF29[] = | |
| 674 | { | |
| 675 | /* type start end bank */ | |
| 676 | { GFXTYPE_SPRITES, 0x00000, 0x07fff, 0 }, | |
| 677 | ||
| 678 | { GFXTYPE_SPRITES, 0x08000, 0x0ffff, 1 }, | |
| 679 | ||
| 680 | { GFXTYPE_SPRITES, 0x10000, 0x11fff, 2 }, | |
| 681 | { GFXTYPE_SCROLL3, 0x02000, 0x03fff, 2 }, // 12000-13fff physical | |
| 682 | { GFXTYPE_SCROLL1, 0x04000, 0x04fff, 2 }, // 14000-14fff physical | |
| 683 | { GFXTYPE_SCROLL2, 0x05000, 0x07fff, 2 }, // 15000-17fff physical | |
| 684 | { 0 } | |
| 685 | }; | |
| 686 | ||
| 687 | static const struct gfx_range mapper_RT24B[] = | |
| 688 | { | |
| 689 | /* type start end bank */ | |
| 690 | { GFXTYPE_SPRITES, 0x0000, 0x53ff, 0 }, | |
| 691 | { GFXTYPE_SCROLL1, 0x5400, 0x6fff, 0 }, | |
| 692 | { GFXTYPE_SCROLL3, 0x7000, 0x7fff, 0 }, | |
| 693 | ||
| 694 | { GFXTYPE_SCROLL3, 0x0000, 0x27ff, 1 }, // 8000-a7ff physical | |
| 695 | { GFXTYPE_SCROLL2, 0x2800, 0x53ff, 1 }, // a800-d3ff physical | |
| 696 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x5400, 0x7fff, 1 }, // d400-ffff physical | |
| 697 | { 0 } | |
| 698 | }; | |
| 699 | ||
| 700 | static const struct gfx_range mapper_KD29B[] = | |
| 701 | { | |
| 702 | /* type start end bank */ | |
| 703 | { GFXTYPE_SPRITES, 0x0000, 0x7fff, 0 }, | |
| 704 | ||
| 705 | { GFXTYPE_SPRITES, 0x8000, 0x8fff, 1 }, | |
| 706 | { GFXTYPE_SCROLL2, 0x9000, 0xbfff, 1 }, | |
| 707 | { GFXTYPE_SCROLL1, 0xc000, 0xd7ff, 1 }, | |
| 708 | { GFXTYPE_SCROLL3, 0xd800, 0xffff, 1 }, | |
| 709 | { 0 } | |
| 710 | }; | |
| 711 | ||
| 712 | static const struct gfx_range mapper_CC63B[] = | |
| 713 | { | |
| 714 | /* type start end bank */ | |
| 715 | { GFXTYPE_SPRITES, 0x0000, 0x7fff, 0 }, | |
| 716 | ||
| 717 | { GFXTYPE_SPRITES, 0x8000, 0x9fff, 1 }, | |
| 718 | { GFXTYPE_SCROLL3, 0xa000, 0xbfff, 1 }, | |
| 719 | { GFXTYPE_SCROLL1, 0xc000, 0xcfff, 1 }, | |
| 720 | { GFXTYPE_SCROLL2, 0xd000, 0xffff, 1 }, | |
| 721 | { 0 } | |
| 722 | }; | |
| 723 | ||
| 724 | static const struct gfx_range mapper_KR63B[] = | |
| 725 | { | |
| 726 | /* type start end bank */ | |
| 727 | { GFXTYPE_SPRITES, 0x0000, 0x7fff, 0 }, | |
| 728 | ||
| 729 | { GFXTYPE_SPRITES, 0x8000, 0x87ff, 1 }, | |
| 730 | { GFXTYPE_SCROLL1, 0x8800, 0x97ff, 1 }, | |
| 731 | { GFXTYPE_SCROLL2, 0x9800, 0xcfff, 1 }, | |
| 732 | { GFXTYPE_SCROLL3, 0xd000, 0xffff, 1 }, | |
| 733 | { 0 } | |
| 734 | }; | |
| 735 | ||
| 736 | static const struct gfx_range mapper_S9263B[] = | |
| 737 | { | |
| 738 | /* type start end bank */ | |
| 739 | { GFXTYPE_SPRITES, 0x00000, 0x07fff, 0 }, | |
| 740 | ||
| 741 | { GFXTYPE_SPRITES, 0x08000, 0x0ffff, 1 }, | |
| 742 | ||
| 743 | { GFXTYPE_SPRITES, 0x10000, 0x11fff, 2 }, | |
| 744 | { GFXTYPE_SCROLL3, 0x02000, 0x03fff, 2 }, // 12000-13fff physical | |
| 745 | { GFXTYPE_SCROLL1, 0x04000, 0x04fff, 2 }, // 14000-14fff physical | |
| 746 | { GFXTYPE_SCROLL2, 0x05000, 0x07fff, 2 }, // 15000-17fff physical | |
| 747 | { 0 } | |
| 748 | }; | |
| 749 | ||
| 750 | static const struct gfx_range mapper_VA24B[] = | |
| 751 | { | |
| 752 | /* type start end bank */ | |
| 753 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x0000, 0x57ff, 0 }, | |
| 754 | { GFXTYPE_SCROLL1, 0x5800, 0x5fff, 0 }, | |
| 755 | { GFXTYPE_SCROLL3, 0x6000, 0x7fff, 0 }, | |
| 756 | { 0 } | |
| 757 | }; | |
| 758 | ||
| 759 | static const struct gfx_range mapper_Q522B[] = | |
| 760 | { | |
| 761 | /* type start end bank */ | |
| 762 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x0000, 0x6fff, 0 }, | |
| 763 | { GFXTYPE_SCROLL3, 0x7000, 0x77ff, 0 }, | |
| 764 | { GFXTYPE_SCROLL1, 0x7800, 0x7fff, 0 }, | |
| 765 | { 0 } | |
| 766 | }; | |
| 767 | ||
| 768 | static const struct gfx_range mapper_TK263B[] = | |
| 769 | { | |
| 770 | /* type start end bank */ | |
| 771 | { GFXTYPE_SPRITES, 0x0000, 0x7fff, 0 }, | |
| 772 | ||
| 773 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x8000, 0xcfff, 1 }, | |
| 774 | { GFXTYPE_SCROLL1, 0xd000, 0xdfff, 1 }, | |
| 775 | { GFXTYPE_SCROLL3, 0xe000, 0xffff, 1 }, | |
| 776 | { 0 } | |
| 777 | }; | |
| 778 | ||
| 779 | static const struct gfx_range mapper_CD63B[] = | |
| 780 | { | |
| 781 | /* type start end bank */ | |
| 782 | { GFXTYPE_SCROLL1, 0x0000, 0x0fff, 0 }, | |
| 783 | { GFXTYPE_SPRITES, 0x1000, 0x7fff, 0 }, | |
| 784 | ||
| 785 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x8000, 0xdfff, 1 }, | |
| 786 | { GFXTYPE_SCROLL3, 0xe000, 0xffff, 1 }, | |
| 787 | { 0 } | |
| 788 | }; | |
| 789 | ||
| 790 | static const struct gfx_range mapper_PS63B[] = | |
| 791 | { | |
| 792 | /* type start end bank */ | |
| 793 | { GFXTYPE_SCROLL1, 0x0000, 0x0fff, 0 }, | |
| 794 | { GFXTYPE_SPRITES, 0x1000, 0x7fff, 0 }, | |
| 795 | ||
| 796 | { GFXTYPE_SPRITES, 0x8000, 0xa7ff, 1 }, | |
| 797 | { GFXTYPE_SCROLL2, 0xa800, 0xdbff, 1 }, | |
| 798 | { GFXTYPE_SCROLL3, 0xdc00, 0xffff, 1 }, | |
| 799 | { 0 } | |
| 800 | }; | |
| 801 | ||
| 802 | static const struct gfx_range mapper_MB63B[] = | |
| 803 | { | |
| 804 | /* type start end bank */ | |
| 805 | { GFXTYPE_SCROLL1, 0x00000, 0x00fff, 0 }, | |
| 806 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x01000, 0x07fff, 0 }, | |
| 807 | ||
| 808 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x08000, 0x0ffff, 1 }, | |
| 809 | ||
| 810 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x10000, 0x167ff, 2 }, | |
| 811 | { GFXTYPE_SCROLL3, 0x16800, 0x17fff, 2 }, | |
| 812 | { 0 } | |
| 813 | }; | |
| 814 | ||
| 815 | static const struct gfx_range mapper_QD22B[] = | |
| 816 | { | |
| 817 | /* type start end bank */ | |
| 818 | { GFXTYPE_SCROLL1, 0x0000, 0x07ff, 0 }, | |
| 819 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x0800, 0x27ff, 0 }, | |
| 820 | { GFXTYPE_SCROLL3, 0x2800, 0x3fff, 0 }, | |
| 821 | { 0 } | |
| 822 | }; | |
| 823 | ||
| 824 | static const struct gfx_range mapper_qadj[] = | |
| 825 | { | |
| 826 | /* type start end bank */ | |
| 827 | { GFXTYPE_SCROLL1, 0x0000, 0x07ff, 0 }, | |
| 828 | { GFXTYPE_SCROLL3, 0x0800, 0x1fff, 0 }, | |
| 829 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x2000, 0x7fff, 0 }, | |
| 830 | { 0 } | |
| 831 | }; | |
| 832 | ||
| 833 | static const struct gfx_range mapper_qtono2[] = | |
| 834 | { | |
| 835 | /* type start end bank */ | |
| 836 | { GFXTYPE_SCROLL1, 0x0000, 0x0fff, 0 }, | |
| 837 | { GFXTYPE_SCROLL3, 0x1000, 0x3fff, 0 }, | |
| 838 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x4000, 0x7fff, 0 }, | |
| 839 | ||
| 840 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x8000, 0xffff, 1 }, | |
| 841 | { 0 } | |
| 842 | }; | |
| 843 | ||
| 844 | static const struct gfx_range mapper_RCM63B[] = | |
| 845 | { | |
| 846 | /* type start end bank */ | |
| 847 | { GFXTYPE_SCROLL1, 0x00000, 0x017ff, 0 }, | |
| 848 | { GFXTYPE_SPRITES, 0x01800, 0x07fff, 0 }, | |
| 849 | ||
| 850 | { GFXTYPE_SPRITES, 0x08000, 0x0ffff, 1 }, | |
| 851 | ||
| 852 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x10000, 0x17fff, 2 }, | |
| 853 | ||
| 854 | { GFXTYPE_SCROLL2, 0x18000, 0x19fff, 3 }, | |
| 855 | { GFXTYPE_SCROLL3, 0x1a000, 0x1ffff, 3 }, | |
| 856 | { 0 } | |
| 857 | }; | |
| 858 | ||
| 859 | static const struct gfx_range mapper_pnickj[] = | |
| 860 | { | |
| 861 | /* type start end bank */ | |
| 862 | { GFXTYPE_SCROLL1, 0x0000, 0x0fff, 0 }, | |
| 863 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x1000, 0x5fff, 0 }, | |
| 864 | { GFXTYPE_SCROLL3, 0x6000, 0x7fff, 0 }, | |
| 865 | { 0 } | |
| 866 | }; | |
| 867 | ||
| 868 | static const struct gfx_range mapper_pang3[] = | |
| 869 | { | |
| 870 | /* type start end bank */ | |
| 871 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x0000, 0x7fff, 0 }, | |
| 872 | ||
| 873 | { GFXTYPE_SPRITES | GFXTYPE_SCROLL2, 0x8000, 0x9fff, 1 }, | |
| 874 | { GFXTYPE_SCROLL1, 0xa000, 0xbfff, 1 }, | |
| 875 | { GFXTYPE_SCROLL3, 0xc000, 0xffff, 1 }, | |
| 876 | { 0 } | |
| 877 | }; | |
| 878 | ||
| 879 | ||
| 880 | ||
| 881 | /* | |
| 882 | I don't know if CPS2 ROM boards use PALs as well; since all games seem to be | |
| 883 | well behaved, I'll just assume that there is no strong checking of gfx type. | |
| 884 | (sprites are not listed here because they are addressed linearly by the CPS2 | |
| 885 | sprite code) | |
| 886 | */ | |
| 887 | static const struct gfx_range mapper_cps2[] = | |
| 888 | { | |
| 889 | /* type start end bank */ | |
| 890 | { GFXTYPE_SCROLL1 | GFXTYPE_SCROLL2 | GFXTYPE_SCROLL3, 0x00000, 0x07fff, 4 }, // 20000-27fff physical | |
| 891 | { GFXTYPE_SCROLL1 | GFXTYPE_SCROLL2 | GFXTYPE_SCROLL3, 0x08000, 0x0ffff, 5 }, // 28000-2ffff physical | |
| 892 | { GFXTYPE_SCROLL2 | GFXTYPE_SCROLL3, 0x10000, 0x17fff, 6 }, // 30000-37fff physical | |
| 893 | { GFXTYPE_SCROLL2 | GFXTYPE_SCROLL3, 0x18000, 0x1ffff, 7 }, // 38000-3ffff physical | |
| 894 | { 0 } | |
| 895 | }; | |
| 896 | ||
| 897 | ||
| 898 | ||
| 275 | 899 | static const struct CPS1config cps1_config_table[]= |
| 276 | 900 | { |
| 277 | /* name CPSB banks tile limits kludge */ | |
| 278 | {"forgottn",CPS_B_01, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 7 }, | |
| 279 | {"lostwrld",CPS_B_01, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 7 }, | |
| 280 | {"ghouls", CPS_B_01, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 1 }, | |
| 281 | {"ghoulsu", CPS_B_01, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 1 }, | |
| 282 | {"daimakai",CPS_B_01, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 1 }, | |
| 283 | {"strider", CPS_B_01, 1,0,1, 0x0000,0xffff,0x0000,0xffff, 11 }, | |
| 284 | {"stridrua",CPS_B_01, 1,0,1, 0x0000,0xffff,0x0000,0xffff, 11 }, | |
| 285 | {"striderj",CPS_B_01, 1,0,1, 0x0000,0xffff,0x0000,0xffff, 11 }, | |
| 286 | {"stridrja",CPS_B_01, 1,0,1, 0x0000,0xffff,0x0000,0xffff, 11 }, | |
| 287 | {"dynwar", CPS_B_02, 0,1,1, 0x0000,0xffff,0x0000,0xffff }, | |
| 288 | {"dynwarj", CPS_B_02, 0,1,1, 0x0000,0xffff,0x0000,0xffff }, | |
| 289 | {"willow", CPS_B_03, 0,1,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 290 | {"willowj", CPS_B_03, 0,1,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 291 | {"willowje",CPS_B_03, 0,1,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 292 | {"ffight", CPS_B_04, 0,0,0, 0x0001,0xffff,0x0001,0xffff }, | |
| 293 | {"ffightu", CPS_B_04, 0,0,0, 0x0001,0xffff,0x0001,0xffff }, | |
| 294 | {"ffightua",CPS_B_01, 0,0,0, 0x0001,0xffff,0x0001,0xffff }, | |
| 295 | {"ffightub",CPS_B_05, 0,0,0, 0x0001,0xffff,0x0001,0xffff }, // I think | |
| 296 | {"ffightj", CPS_B_04, 0,0,0, 0x0001,0xffff,0x0001,0xffff }, | |
| 297 | {"ffightj1",CPS_B_02, 0,0,0, 0x0001,0xffff,0x0001,0xffff }, | |
| 298 | {"1941", CPS_B_05, 0,0,0, 0x0000,0xffff,0x0400,0x07ff }, | |
| 299 | {"1941j", CPS_B_05, 0,0,0, 0x0000,0xffff,0x0400,0x07ff }, | |
| 300 | {"unsquad", CPS_B_11, 0,0,0, 0x0000,0xffff,0x0001,0xffff, 11 }, /* CPSB ID not checked, but it's the same as sf2eg */ | |
| 301 | {"area88", CPS_B_11, 0,0,0, 0x0000,0xffff,0x0001,0xffff, 11 }, /* CPSB ID not checked, but it's the same as sf2eg */ | |
| 302 | {"mercs", CPS_B_12, 0,0,0, 0x0600,0x5bff,0x0700,0x17ff, 4 }, /* (uses port 74) */ | |
| 303 | {"mercsu", CPS_B_12, 0,0,0, 0x0600,0x5bff,0x0700,0x17ff, 4 }, /* (uses port 74) */ | |
| 304 | {"mercsua", CPS_B_12, 0,0,0, 0x0600,0x5bff,0x0700,0x17ff, 4 }, /* (uses port 74) */ | |
| 305 | {"mercsj", CPS_B_12, 0,0,0, 0x0600,0x5bff,0x0700,0x17ff, 4 }, /* (uses port 74) */ | |
| 306 | {"msword", CPS_B_13, 0,0,0, 0x2800,0x37ff,0x0000,0xffff, 3 }, /* CPSB ID not checked, but it's the same as sf2j */ | |
| 307 | {"mswordr1",CPS_B_13, 0,0,0, 0x2800,0x37ff,0x0000,0xffff, 3 }, /* CPSB ID not checked, but it's the same as sf2j */ | |
| 308 | {"mswordu", CPS_B_13, 0,0,0, 0x2800,0x37ff,0x0000,0xffff, 3 }, /* CPSB ID not checked, but it's the same as sf2j */ | |
| 309 | {"mswordj", CPS_B_13, 0,0,0, 0x2800,0x37ff,0x0000,0xffff, 3 }, /* CPSB ID not checked, but it's the same as sf2j */ | |
| 310 | {"mtwins", CPS_B_14, 0,0,0, 0x0000,0x3fff,0x0e00,0xffff }, | |
| 311 | {"chikij", CPS_B_14, 0,0,0, 0x0000,0x3fff,0x0e00,0xffff }, | |
| 312 | {"nemo", CPS_B_15, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 313 | {"nemoj", CPS_B_15, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 314 | {"cawing", CPS_B_16, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 315 | {"cawingr1",CPS_B_16, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 316 | {"cawingu", CPS_B_16, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 317 | {"cawingj", CPS_B_16, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 318 | {"sf2", CPS_B_11, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 319 | {"sf2eb", CPS_B_17, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 320 | {"sf2ua", CPS_B_17, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 321 | {"sf2ub", CPS_B_17, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 322 | {"sf2ud", CPS_B_05, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 323 | {"sf2ue", CPS_B_18, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 324 | {"sf2uf", CPS_B_15, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 325 | {"sf2ui", CPS_B_14, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 326 | {"sf2uk", CPS_B_17, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, // check CPS_B | |
| 327 | {"sf2j", CPS_B_13, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 328 | {"sf2ja", CPS_B_17, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 329 | {"sf2jc", CPS_B_12, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 901 | /* name CPSB bank size gfx mapper kludge */ | |
| 902 | {"forgottn", CPS_B_01, 0x8000, mapper_LWCHR }, | |
| 903 | {"lostwrld", CPS_B_01, 0x8000, mapper_LWCHR }, | |
| 904 | {"ghouls", CPS_B_01, 0x8000, mapper_DM620 }, | |
| 905 | {"ghoulsu", CPS_B_01, 0x8000, mapper_DM620 }, | |
| 906 | {"daimakai", CPS_B_01, 0x8000, mapper_DM620 }, | |
| 907 | {"strider", CPS_B_01, 0x4000, mapper_ST24M1 }, | |
| 908 | {"stridrua", CPS_B_01, 0x4000, mapper_ST24M1 }, | |
| 909 | {"striderj", CPS_B_01, 0x4000, mapper_ST24M1 }, | |
| 910 | {"stridrja", CPS_B_01, 0x4000, mapper_ST24M1 }, | |
| 911 | {"dynwar", CPS_B_02, 0x8000, mapper_dynwar }, | |
| 912 | {"dynwarj", CPS_B_02, 0x8000, mapper_dynwar }, | |
| 913 | {"willow", CPS_B_03, 0x8000, mapper_WL24B }, | |
| 914 | {"willowj", CPS_B_03, 0x8000, mapper_WL24B }, | |
| 915 | {"willowje", CPS_B_03, 0x8000, mapper_WL24B }, | |
| 916 | {"ffight", CPS_B_04, 0x8000, mapper_S224B }, | |
| 917 | {"ffightu", CPS_B_04, 0x8000, mapper_S224B }, | |
| 918 | {"ffightua", CPS_B_01, 0x8000, mapper_S224B }, | |
| 919 | {"ffightub", CPS_B_05, 0x8000, mapper_S224B }, | |
| 920 | {"ffightj", CPS_B_04, 0x8000, mapper_S224B }, | |
| 921 | {"ffightj1", CPS_B_02, 0x8000, mapper_S224B }, | |
| 922 | {"1941", CPS_B_05, 0x8000, mapper_YI24B }, | |
| 923 | {"1941j", CPS_B_05, 0x8000, mapper_YI24B }, | |
| 924 | {"unsquad", CPS_B_11, 0x8000, mapper_AR24B }, /* CPSB ID not checked, but it's the same as sf2eg */ | |
| 925 | {"area88", CPS_B_11, 0x8000, mapper_AR24B }, /* CPSB ID not checked, but it's the same as sf2eg */ | |
| 926 | {"mercs", CPS_B_12, 0x8000, mapper_0224B }, /* (uses port 74) */ | |
| 927 | {"mercsu", CPS_B_12, 0x8000, mapper_0224B }, /* (uses port 74) */ | |
| 928 | {"mercsua", CPS_B_12, 0x8000, mapper_0224B }, /* (uses port 74) */ | |
| 929 | {"mercsj", CPS_B_12, 0x8000, mapper_0224B }, /* (uses port 74) */ | |
| 930 | {"msword", CPS_B_13, 0x8000, mapper_MS24B }, /* CPSB ID not checked, but it's the same as sf2j */ | |
| 931 | {"mswordr1", CPS_B_13, 0x8000, mapper_MS24B }, /* CPSB ID not checked, but it's the same as sf2j */ | |
| 932 | {"mswordu", CPS_B_13, 0x8000, mapper_MS24B }, /* CPSB ID not checked, but it's the same as sf2j */ | |
| 933 | {"mswordj", CPS_B_13, 0x8000, mapper_MS24B }, /* CPSB ID not checked, but it's the same as sf2j */ | |
| 934 | {"mtwins", CPS_B_14, 0x8000, mapper_CK24B }, | |
| 935 | {"chikij", CPS_B_14, 0x8000, mapper_CK24B }, | |
| 936 | {"nemo", CPS_B_15, 0x8000, mapper_NM24B }, | |
| 937 | {"nemoj", CPS_B_15, 0x8000, mapper_NM24B }, | |
| 938 | {"cawing", CPS_B_16, 0x8000, mapper_CA24B }, | |
| 939 | {"cawingr1", CPS_B_16, 0x8000, mapper_CA24B }, | |
| 940 | {"cawingu", CPS_B_16, 0x8000, mapper_CA24B }, | |
| 941 | {"cawingj", CPS_B_16, 0x8000, mapper_CA24B }, | |
| 942 | {"sf2", CPS_B_11, 0x8000, mapper_STF29 }, | |
| 943 | {"sf2eb", CPS_B_17, 0x8000, mapper_STF29 }, | |
| 944 | {"sf2ua", CPS_B_17, 0x8000, mapper_STF29 }, | |
| 945 | {"sf2ub", CPS_B_17, 0x8000, mapper_STF29 }, | |
| 946 | {"sf2ud", CPS_B_05, 0x8000, mapper_STF29 }, | |
| 947 | {"sf2ue", CPS_B_18, 0x8000, mapper_STF29 }, | |
| 948 | {"sf2uf", CPS_B_15, 0x8000, mapper_STF29 }, | |
| 949 | {"sf2ui", CPS_B_14, 0x8000, mapper_STF29 }, | |
| 950 | {"sf2uk", CPS_B_17, 0x8000, mapper_STF29 }, // check CPS_B | |
| 951 | {"sf2j", CPS_B_13, 0x8000, mapper_STF29 }, | |
| 952 | {"sf2ja", CPS_B_17, 0x8000, mapper_STF29 }, | |
| 953 | {"sf2jc", CPS_B_12, 0x8000, mapper_STF29 }, | |
| 330 | 954 | /* from here onwards the CPS-B board has suicide battery and multiply protection */ |
| 331 | {"3wonders",BATTRY_1, 0,1,0, 0x0000,0xffff,0x0000,0xffff, 2 }, | |
| 332 | {"3wonderu",BATTRY_1, 0,1,0, 0x0000,0xffff,0x0000,0xffff, 2 }, | |
| 333 | {"wonder3", BATTRY_1, 0,1,0, 0x0000,0xffff,0x0000,0xffff, 2 }, | |
| 334 | {"kod", BATTRY_2, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 335 | {"kodu", BATTRY_2, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 336 | {"kodj", BATTRY_2, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 337 | {"kodb", BATTRY_2, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, /* bootleg, doesn't use multiply protection */ | |
| 338 | {"captcomm",BATTRY_3, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 11 }, | |
| 339 | {"captcomu",BATTRY_3, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 11 }, | |
| 340 | {"captcomj",BATTRY_3, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 11 }, | |
| 341 | {"knights", BATTRY_4, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 3 }, | |
| 342 | {"knightsu",BATTRY_4, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 3 }, | |
| 343 | {"knightsj",BATTRY_4, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 3 }, | |
| 344 | {"sf2ce", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 345 | {"sf2ceua", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 346 | {"sf2ceub", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 347 | {"sf2ceuc", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 348 | {"sf2cej", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 349 | {"sf2rb", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 350 | {"sf2rb2", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 351 | {"sf2red", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 352 | {"sf2v004", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 353 | {"sf2accp2",NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 354 | {"sf2m1", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 355 | {"sf2m2", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 356 | {"sf2m3", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 357 | {"sf2m4", HACK_B_1, 2,2,2, 0x0000,0xffff,0x0000,0xffff, 10 }, | |
| 358 | {"sf2m5", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff, 10 }, | |
| 359 | {"sf2m6", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff, 10 }, | |
| 360 | {"sf2m7", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff, 10 }, | |
| 361 | {"sf2yyc", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff, 10 }, | |
| 362 | {"sf2koryu",NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff, 10 }, | |
| 363 | {"varth", CPS_B_04, 0,0,0, 0x0000,0xffff,0x0c00,0x0fff }, /* CPSB test has been patched out (60=0008) */ | |
| 364 | {"varthr1", CPS_B_04, 0,0,0, 0x0000,0xffff,0x0c00,0x0fff }, /* CPSB test has been patched out (60=0008) */ | |
| 365 | {"varthu", CPS_B_04, 0,0,0, 0x0000,0xffff,0x0c00,0x0fff }, /* CPSB test has been patched out (60=0008) */ | |
| 366 | {"varthj", BATTRY_5, 0,0,0, 0x0000,0xffff,0x0c00,0x0fff }, /* CPSB test has been patched out (72=0001) */ | |
| 367 | {"cworld2j",BATTRY_6, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, /* The 0x76 priority values are incorrect values */ | |
| 368 | {"wof", NOBATTRY, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, /* bootleg? */ | |
| 369 | {"wofa", NOBATTRY, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, /* bootleg? */ | |
| 370 | {"wofu", QSOUND_1, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 371 | {"wofj", QSOUND_1, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 372 | {"dino", QSOUND_2, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, /* layer enable never used */ | |
| 373 | {"dinou", QSOUND_2, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, /* layer enable never used */ | |
| 374 | {"dinoj", QSOUND_2, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, /* layer enable never used */ | |
| 375 | {"punisher",QSOUND_3, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 376 | {"punishru",QSOUND_3, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 377 | {"punishrj",QSOUND_3, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 378 | {"slammast",QSOUND_4, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 379 | {"slammasu",QSOUND_4, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 380 | {"mbomberj",QSOUND_4, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 381 | {"mbombrd", QSOUND_5, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 382 | {"mbombrdj",QSOUND_5, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 383 | {"sf2hf", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 384 | {"sf2t", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 385 | {"sf2tj", NOBATTRY, 2,2,2, 0x0000,0xffff,0x0000,0xffff }, | |
| 386 | {"qad", BATTRY_7, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, /* TODO: layer enable */ | |
| 387 | {"qadj", NOBATTRY, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 388 | {"qtono2", NOBATTRY, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 389 | {"megaman", NOBATTRY, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 390 | {"rockmanj",NOBATTRY, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 391 | {"pnickj", NOBATTRY, 0,0,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 392 | {"pang3", NOBATTRY, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 5 }, /* EEPROM port is among the CPS registers */ | |
| 393 | {"pang3j", NOBATTRY, 0,0,0, 0x0000,0xffff,0x0000,0xffff, 5 }, /* EEPROM port is among the CPS registers */ | |
| 955 | {"3wonders", BATTRY_1, 0x8000, mapper_RT24B }, | |
| 956 | {"3wonderu", BATTRY_1, 0x8000, mapper_RT24B }, | |
| 957 | {"wonder3", BATTRY_1, 0x8000, mapper_RT24B }, | |
| 958 | {"kod", BATTRY_2, 0x8000, mapper_KD29B }, | |
| 959 | {"kodu", BATTRY_2, 0x8000, mapper_KD29B }, | |
| 960 | {"kodj", BATTRY_2, 0x8000, mapper_KD29B }, | |
| 961 | {"kodb", BATTRY_2, 0x8000, mapper_KD29B }, /* bootleg, doesn't use multiply protection */ | |
| 962 | {"captcomm", BATTRY_3, 0x8000, mapper_CC63B }, | |
| 963 | {"captcomu", BATTRY_3, 0x8000, mapper_CC63B }, | |
| 964 | {"captcomj", BATTRY_3, 0x8000, mapper_CC63B }, | |
| 965 | {"knights", BATTRY_4, 0x8000, mapper_KR63B }, | |
| 966 | {"knightsu", BATTRY_4, 0x8000, mapper_KR63B }, | |
| 967 | {"knightsj", BATTRY_4, 0x8000, mapper_KR63B }, | |
| 968 | {"sf2ce", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 969 | {"sf2ceua", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 970 | {"sf2ceub", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 971 | {"sf2ceuc", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 972 | {"sf2cej", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 973 | {"sf2rb", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 974 | {"sf2rb2", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 975 | {"sf2red", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 976 | {"sf2v004", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 977 | {"sf2accp2", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 978 | {"sf2m1", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 979 | {"sf2m2", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 980 | {"sf2m3", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 981 | {"sf2m4", HACK_B_1, 0x8000, mapper_S9263B, 1 }, | |
| 982 | {"sf2m5", NOBATTRY, 0x8000, mapper_S9263B, 1 }, | |
| 983 | {"sf2m6", NOBATTRY, 0x8000, mapper_S9263B, 1 }, | |
| 984 | {"sf2m7", NOBATTRY, 0x8000, mapper_S9263B, 1 }, | |
| 985 | {"sf2yyc", NOBATTRY, 0x8000, mapper_S9263B, 1 }, | |
| 986 | {"sf2koryu", NOBATTRY, 0x8000, mapper_S9263B, 1 }, | |
| 987 | {"varth", CPS_B_04, 0x8000, mapper_VA24B }, /* CPSB test has been patched out (60=0008) */ | |
| 988 | {"varthr1", CPS_B_04, 0x8000, mapper_VA24B }, /* CPSB test has been patched out (60=0008) */ | |
| 989 | {"varthu", CPS_B_04, 0x8000, mapper_VA24B }, /* CPSB test has been patched out (60=0008) */ | |
| 990 | {"varthj", BATTRY_5, 0x8000, mapper_VA24B }, /* CPSB test has been patched out (72=0001) */ | |
| 991 | {"cworld2j", BATTRY_6, 0x8000, mapper_Q522B }, /* The 0x76 priority values are incorrect values */ | |
| 992 | {"wof", NOBATTRY, 0x8000, mapper_TK263B }, /* bootleg? */ | |
| 993 | {"wofa", NOBATTRY, 0x8000, mapper_TK263B }, /* bootleg? */ | |
| 994 | {"wofu", QSOUND_1, 0x8000, mapper_TK263B }, | |
| 995 | {"wofj", QSOUND_1, 0x8000, mapper_TK263B }, | |
| 996 | {"dino", QSOUND_2, 0x8000, mapper_CD63B }, /* layer enable never used */ | |
| 997 | {"dinou", QSOUND_2, 0x8000, mapper_CD63B }, /* layer enable never used */ | |
| 998 | {"dinoj", QSOUND_2, 0x8000, mapper_CD63B }, /* layer enable never used */ | |
| 999 | {"punisher", QSOUND_3, 0x8000, mapper_PS63B }, | |
| 1000 | {"punishru", QSOUND_3, 0x8000, mapper_PS63B }, | |
| 1001 | {"punishrj", QSOUND_3, 0x8000, mapper_PS63B }, | |
| 1002 | {"slammast", QSOUND_4, 0x8000, mapper_MB63B }, | |
| 1003 | {"slammasu", QSOUND_4, 0x8000, mapper_MB63B }, | |
| 1004 | {"mbomberj", QSOUND_4, 0x8000, mapper_MB63B }, | |
| 1005 | {"mbombrd", QSOUND_5, 0x8000, mapper_MB63B }, | |
| 1006 | {"mbombrdj", QSOUND_5, 0x8000, mapper_MB63B }, | |
| 1007 | {"sf2hf", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 1008 | {"sf2t", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 1009 | {"sf2tj", NOBATTRY, 0x8000, mapper_S9263B }, | |
| 1010 | {"qad", BATTRY_7, 0x8000, mapper_QD22B }, /* TODO: layer enable */ | |
| 1011 | {"qadj", NOBATTRY, 0x8000, mapper_qadj }, | |
| 1012 | {"qtono2", NOBATTRY, 0x8000, mapper_qtono2 }, | |
| 1013 | {"megaman", NOBATTRY, 0x8000, mapper_RCM63B }, | |
| 1014 | {"rockmanj", NOBATTRY, 0x8000, mapper_RCM63B }, | |
| 1015 | {"pnickj", NOBATTRY, 0x8000, mapper_pnickj }, | |
| 1016 | {"pang3", NOBATTRY, 0x8000, mapper_pang3 }, /* EEPROM port is among the CPS registers (handled by DRIVER_INIT) */ | |
| 1017 | {"pang3j", NOBATTRY, 0x8000, mapper_pang3 }, /* EEPROM port is among the CPS registers (handled by DRIVER_INIT) */ | |
| 394 | 1018 | #ifdef MESS |
| 395 | {"sfzch", NOBATTRY, 0 | |
| 1019 | {"sfzch", NOBATTRY, 0 | |
| 396 | 1020 | #endif |
| 397 | 1021 | |
| 398 | 1022 | /* CPS2 games */ |
| 399 | {"cps2", NOBATTRY, 4,4,4, 0x0000,0xffff,0x0000,0xffff }, | |
| 400 | {"ssf2", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 401 | {"ssf2u", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 402 | {"ssf2a", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 403 | {"ssf2ar1", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 404 | {"ssf2j", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 405 | {"ssf2jr1", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 406 | {"ssf2jr2", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 407 | {"ssf2tb", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 408 | {"ssf2tbr1",NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 409 | {"ssf2tbj", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff }, | |
| 410 | {"ssf2t", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff, 9 }, | |
| 411 | {"ssf2tu", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff, 9 }, | |
| 412 | {"ssf2tur1",NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff, 9 }, | |
| 413 | {"ssf2ta", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff, 9 }, | |
| 414 | {"ssf2xj", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff, 9 }, | |
| 415 | {"xmcota", NOBATTRY, 4,4,4, 0x0000,0xffff,0x0000,0xffff, 8 }, | |
| 416 | {"xmcotau", NOBATTRY, 4,4,4, 0x0000,0xffff,0x0000,0xffff, 8 }, | |
| 417 | {"xmcotah", NOBATTRY, 4,4,4, 0x0000,0xffff,0x0000,0xffff, 8 }, | |
| 418 | {"xmcotaj", NOBATTRY, 4,4,4, 0x0000,0xffff,0x0000,0xffff, 8 }, | |
| 419 | {"xmcotaj1",NOBATTRY, 4,4,4, 0x0000,0xffff,0x0000,0xffff, 8 }, | |
| 420 | {"xmcotaj2",NOBATTRY, 4,4,4, 0x0000,0xffff,0x0000,0xffff, 8 }, | |
| 421 | {"xmcotajr",NOBATTRY, 4,4,4, 0x0000,0xffff,0x0000,0xffff, 8 }, | |
| 422 | {"xmcotaa", NOBATTRY, 4,4,4, 0x0000,0xffff,0x0000,0xffff, 8 }, | |
| 423 | {"hsf2", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff, 9 }, | |
| 424 | {"hsf2j", NOBATTRY, 4,4,0, 0x0000,0xffff,0x0000,0xffff, 9 }, | |
| 1023 | {"cps2", NOBATTRY, 0x8000, mapper_cps2 }, | |
| 1024 | ||
| 425 | 1025 | {0} /* End of table */ |
| 426 | 1026 | }; |
| 427 | 1027 | |
| 1028 | ||
| 1029 | ||
| 1030 | /* Public variables */ | |
| 1031 | UINT16 *cps1_gfxram; | |
| 1032 | UINT16 *cps1_output; | |
| 1033 | ||
| 1034 | size_t cps1_gfxram_size; | |
| 1035 | size_t cps1_output_size; | |
| 1036 | ||
| 1037 | /* Offset of each palette entry */ | |
| 1038 | #define cps1_palette_entries (32*6) /* Number colour schemes in palette */ | |
| 1039 | ||
| 1040 | static const int cps1_scroll_size =0x4000; /* scroll1, scroll2, scroll3 */ | |
| 1041 | static const int cps1_obj_size =0x0800; | |
| 1042 | static const int cps1_other_size =0x0800; | |
| 1043 | static const int cps1_palette_align=0x0400; /* minimum alignment is a single palette page (512 colors). Verified on pcb. */ | |
| 1044 | static const int cps1_palette_size=cps1_palette_entries*32; /* Size of palette RAM */ | |
| 1045 | ||
| 1046 | static UINT16 *cps1_scroll1; | |
| 1047 | static UINT16 *cps1_scroll2; | |
| 1048 | static UINT16 *cps1_scroll3; | |
| 1049 | static UINT16 *cps1_obj; | |
| 1050 | static UINT16 *cps1_buffered_obj; | |
| 1051 | UINT16 *cps1_other; | |
| 1052 | ||
| 1053 | /* Working variables */ | |
| 1054 | static int cps1_last_sprite_offset; /* Offset of the last sprite */ | |
| 1055 | static int cps1_stars_enabled[2]; /* Layer enabled [Y/N] */ | |
| 1056 | ||
| 1057 | tilemap *cps1_bg_tilemap[3]; | |
| 1058 | ||
| 1059 | ||
| 1060 | int cps1_scroll1x, cps1_scroll1y; | |
| 1061 | int cps1_scroll2x, cps1_scroll2y; | |
| 1062 | int cps1_scroll3x, cps1_scroll3y; | |
| 1063 | static int stars1x, stars1y, stars2x, stars2y; | |
| 1064 | ||
| 1065 | ||
| 1066 | /* Output ports */ | |
| 1067 | #define CPS1_OBJ_BASE 0x00 /* Base address of objects */ | |
| 1068 | #define CPS1_SCROLL1_BASE 0x02 /* Base address of scroll 1 */ | |
| 1069 | #define CPS1_SCROLL2_BASE 0x04 /* Base address of scroll 2 */ | |
| 1070 | #define CPS1_SCROLL3_BASE 0x06 /* Base address of scroll 3 */ | |
| 1071 | #define CPS1_OTHER_BASE 0x08 /* Base address of other video */ | |
| 1072 | #define CPS1_PALETTE_BASE 0x0a /* Base address of palette */ | |
| 1073 | #define CPS1_SCROLL1_SCROLLX 0x0c /* Scroll 1 X */ | |
| 1074 | #define CPS1_SCROLL1_SCROLLY 0x0e /* Scroll 1 Y */ | |
| 1075 | #define CPS1_SCROLL2_SCROLLX 0x10 /* Scroll 2 X */ | |
| 1076 | #define CPS1_SCROLL2_SCROLLY 0x12 /* Scroll 2 Y */ | |
| 1077 | #define CPS1_SCROLL3_SCROLLX 0x14 /* Scroll 3 X */ | |
| 1078 | #define CPS1_SCROLL3_SCROLLY 0x16 /* Scroll 3 Y */ | |
| 1079 | #define CPS1_STARS1_SCROLLX 0x18 /* Stars 1 X */ | |
| 1080 | #define CPS1_STARS1_SCROLLY 0x1a /* Stars 1 Y */ | |
| 1081 | #define CPS1_STARS2_SCROLLX 0x1c /* Stars 2 X */ | |
| 1082 | #define CPS1_STARS2_SCROLLY 0x1e /* Stars 2 Y */ | |
| 1083 | #define CPS1_ROWSCROLL_OFFS 0x20 /* base of row scroll offsets in other RAM */ | |
| 1084 | #define CPS1_VIDEOCONTROL 0x22 /* flip screen, rowscroll enable */ | |
| 1085 | ||
| 1086 | #define CPS1_SCROLL2_WIDTH 0x40 | |
| 1087 | #define CPS1_SCROLL2_HEIGHT 0x40 | |
| 1088 | ||
| 1089 | ||
| 1090 | /* | |
| 1091 | CPS1 VIDEO RENDERER | |
| 1092 | ||
| 1093 | */ | |
| 1094 | /* first 0x4000 of gfx ROM are used, but 0x0000-0x1fff is == 0x2000-0x3fff */ | |
| 1095 | static const int stars_rom_size = 0x2000; | |
| 1096 | ||
| 1097 | /* PSL: CPS2 support */ | |
| 1098 | static const int cps2_obj_size =0x2000; | |
| 1099 | UINT16 *cps2_objram1,*cps2_objram2; | |
| 1100 | UINT16 *cps2_output; | |
| 1101 | ||
| 1102 | size_t cps2_output_size; | |
| 1103 | static UINT16 *cps2_buffered_obj; | |
| 1104 | static int pri_ctrl; /* Sprite layer priorities */ | |
| 1105 | static int cps2_objram_bank; | |
| 1106 | static int cps2_last_sprite_offset; /* Offset of the last sprite */ | |
| 1107 | ||
| 1108 | #define CPS2_OBJ_BASE 0x00 /* Unknown (not base address of objects). Could be bass address of bank used when object swap bit set? */ | |
| 1109 | #define CPS2_OBJ_UK1 0x02 /* Unknown (nearly always 0x807d, or 0x808e when screen flipped) */ | |
| 1110 | #define CPS2_OBJ_PRI 0x04 /* Layers priorities */ | |
| 1111 | #define CPS2_OBJ_UK2 0x06 /* Unknown (usually 0x0000, 0x1101 in ssf2, 0x0001 in 19XX) */ | |
| 1112 | #define CPS2_OBJ_XOFFS 0x08 /* X offset (usually 0x0040) */ | |
| 1113 | #define CPS2_OBJ_YOFFS 0x0a /* Y offset (always 0x0010) */ | |
| 1114 | ||
| 1115 | ||
| 428 | 1116 | static int cps_version; |
| 429 | 1117 | int cps1_scanline1; |
| 430 | 1118 | int cps1_scanline2; |
| 431 | 1119 | int cps1_scancalls; |
| 432 | 1120 | |
| 433 | 1121 | |
| 1122 | static void cps1_build_palette(running_machine *machine, const UINT16* const palette_base); | |
| 1123 | ||
| 1124 | ||
| 434 | 1125 | static MACHINE_RESET( cps ) |
| 435 | 1126 | { |
| 436 | 1127 | const char *gamename = machine->gamedrv->name; |
| r2375 | r2376 | |
| 538 | 1229 | return (cps1_output[cps1_game_config->mult_factor1/2] * |
| 539 | 1230 | cps1_output[cps1_game_config->mult_factor2/2]) >> 16; |
| 540 | 1231 | |
| 541 | /* Pang 3 EEPROM interface */ | |
| 542 | if (cps1_game_config->kludge == 5 && offset == 0x7a/2) | |
| 543 | return cps1_eeprom_port_r(machine,0,mem_mask); | |
| 544 | ||
| 545 | 1232 | return cps1_output[offset]; |
| 546 | 1233 | } |
| 547 | 1234 | |
| 1235 | ||
| 548 | 1236 | WRITE16_HANDLER( cps1_output_w ) |
| 549 | 1237 | { |
| 550 | /* Pang 3 EEPROM interface */ | |
| 551 | if (cps1_game_config->kludge == 5 && offset == 0x7a/2) | |
| 552 | { | |
| 553 | cps1_eeprom_port_w(machine,0,data,mem_mask); | |
| 554 | return; | |
| 555 | } | |
| 556 | ||
| 557 | 1238 | data = COMBINE_DATA(&cps1_output[offset]); |
| 558 | 1239 | |
| 559 | 1240 | /* To mark scanlines for raster effects */ |
| r2375 | r2376 | |
| 568 | 1249 | |
| 569 | 1250 | |
| 570 | 1251 | #ifdef MAME_DEBUG |
| 571 | if (cps1_game_config->control_reg && offset == cps1_game_config->control_reg/2 && data != 0x3f) | |
| 572 | logerror("control_reg = %04x",data); | |
| 1252 | if (cps1_game_config->palette_control && offset == cps1_game_config->palette_control/2 && data != 0x3f) | |
| 1253 | logerror("palette_control = %04x",data); | |
| 573 | 1254 | #endif |
| 574 | 1255 | if (VERBOSE) |
| 575 | 1256 | { |
| r2375 | r2376 | |
| 579 | 1260 | offset != cps1_game_config->priority[1]/2 && |
| 580 | 1261 | offset != cps1_game_config->priority[2]/2 && |
| 581 | 1262 | offset != cps1_game_config->priority[3]/2 && |
| 582 | offset != cps1_game_config->control | |
| 1263 | offset != cps1_game_config->palette_control | |
| 583 | 1264 | logerror("PC %06x: write %02x to output port %02x\n",activecpu_get_pc(),data,offset*2); |
| 584 | 1265 | |
| 585 | 1266 | #ifdef MAME_DEBUG |
| 586 | if (offset == 0x22/2 && (data & ~0x8001) != 0x0e) | |
| 587 | logerror("port 22 = %04x",data); | |
| 588 | 1267 | if (cps1_game_config->priority[0] && offset == cps1_game_config->priority[0]/2 && data != 0x00) |
| 589 | 1268 | popmessage("priority0 %04x",data); |
| 590 | 1269 | #endif |
| 591 | 1270 | } |
| 1271 | ||
| 1272 | /* | |
| 1273 | The main CPU writes the palette to gfxram, and the CPS-B custom copies it | |
| 1274 | to the real palette RAM, which is separated from gfxram. | |
| 1275 | This is done ONLY after the palette base register is written to. It is not | |
| 1276 | known what the exact timing should be, how long it should take and when it | |
| 1277 | should happen. We are assuming that the copy happens immediately, since it | |
| 1278 | fixes glitches in the ghouls intro, but it might happen at next vblank. | |
| 1279 | */ | |
| 1280 | if (offset == CPS1_PALETTE_BASE/2) | |
| 1281 | cps1_build_palette(machine, cps1_base(CPS1_PALETTE_BASE,cps1_palette_align)); | |
| 592 | 1282 | } |
| 593 | 1283 | |
| 594 | 1284 | |
| 595 | 1285 | |
| 596 | /* Public variables */ | |
| 597 | UINT16 *cps1_gfxram; | |
| 598 | UINT16 *cps1_output; | |
| 599 | ||
| 600 | size_t cps1_gfxram_size; | |
| 601 | size_t cps1_output_size; | |
| 602 | ||
| 603 | /* Offset of each palette entry */ | |
| 604 | static int palette_basecolor[6]; | |
| 605 | #define cps1_palette_entries (32*6) /* Number colour schemes in palette */ | |
| 606 | ||
| 607 | static const int cps1_scroll_size =0x4000; /* scroll1, scroll2, scroll3 */ | |
| 608 | static const int cps1_obj_size =0x0800; | |
| 609 | static const int cps1_other_size =0x0800; | |
| 610 | static const int cps1_palette_align=0x0800; /* can't be larger than this, breaks ringdest & batcirc otherwise */ | |
| 611 | static const int cps1_palette_size=cps1_palette_entries*32; /* Size of palette RAM */ | |
| 612 | ||
| 613 | static UINT16 *cps1_scroll1; | |
| 614 | static UINT16 *cps1_scroll2; | |
| 615 | static UINT16 *cps1_scroll3; | |
| 616 | static UINT16 *cps1_obj; | |
| 617 | static UINT16 *cps1_buffered_obj; | |
| 618 | static UINT16 *cps1_palette; | |
| 619 | UINT16 *cps1_other; | |
| 620 | static UINT16 *cps1_old_palette; | |
| 621 | ||
| 622 | /* Working variables */ | |
| 623 | static int cps1_last_sprite_offset; /* Offset of the last sprite */ | |
| 624 | static int cps1_stars_enabled[2]; /* Layer enabled [Y/N] */ | |
| 625 | ||
| 626 | tilemap *cps1_bg_tilemap[3]; | |
| 627 | ||
| 628 | ||
| 629 | int cps1_scroll1x, cps1_scroll1y; | |
| 630 | int cps1_scroll2x, cps1_scroll2y; | |
| 631 | int cps1_scroll3x, cps1_scroll3y; | |
| 632 | static int stars1x, stars1y, stars2x, stars2y; | |
| 633 | ||
| 634 | ||
| 635 | /* Output ports */ | |
| 636 | #define CPS1_OBJ_BASE 0x00 /* Base address of objects */ | |
| 637 | #define CPS1_SCROLL1_BASE 0x02 /* Base address of scroll 1 */ | |
| 638 | #define CPS1_SCROLL2_BASE 0x04 /* Base address of scroll 2 */ | |
| 639 | #define CPS1_SCROLL3_BASE 0x06 /* Base address of scroll 3 */ | |
| 640 | #define CPS1_OTHER_BASE 0x08 /* Base address of other video */ | |
| 641 | #define CPS1_PALETTE_BASE 0x0a /* Base address of palette */ | |
| 642 | #define CPS1_SCROLL1_SCROLLX 0x0c /* Scroll 1 X */ | |
| 643 | #define CPS1_SCROLL1_SCROLLY 0x0e /* Scroll 1 Y */ | |
| 644 | #define CPS1_SCROLL2_SCROLLX 0x10 /* Scroll 2 X */ | |
| 645 | #define CPS1_SCROLL2_SCROLLY 0x12 /* Scroll 2 Y */ | |
| 646 | #define CPS1_SCROLL3_SCROLLX 0x14 /* Scroll 3 X */ | |
| 647 | #define CPS1_SCROLL3_SCROLLY 0x16 /* Scroll 3 Y */ | |
| 648 | #define CPS1_STARS1_SCROLLX 0x18 /* Stars 1 X */ | |
| 649 | #define CPS1_STARS1_SCROLLY 0x1a /* Stars 1 Y */ | |
| 650 | #define CPS1_STARS2_SCROLLX 0x1c /* Stars 2 X */ | |
| 651 | #define CPS1_STARS2_SCROLLY 0x1e /* Stars 2 Y */ | |
| 652 | ||
| 653 | #define CPS1_ROWSCROLL_OFFS 0x20 /* base of row scroll offsets in other RAM */ | |
| 654 | ||
| 655 | #define CPS1_SCROLL2_WIDTH 0x40 | |
| 656 | #define CPS1_SCROLL2_HEIGHT 0x40 | |
| 657 | ||
| 658 | ||
| 659 | /* | |
| 660 | CPS1 VIDEO RENDERER | |
| 661 | ||
| 662 | */ | |
| 663 | /* first 0x4000 of gfx ROM are used, but 0x0000-0x1fff is == 0x2000-0x3fff */ | |
| 664 | static const int stars_rom_size = 0x2000; | |
| 665 | ||
| 666 | /* PSL: CPS2 support */ | |
| 667 | static const int cps2_obj_size =0x2000; | |
| 668 | UINT16 *cps2_objram1,*cps2_objram2; | |
| 669 | UINT16 *cps2_output; | |
| 670 | ||
| 671 | size_t cps2_output_size; | |
| 672 | static UINT16 *cps2_buffered_obj; | |
| 673 | static int pri_ctrl; /* Sprite layer priorities */ | |
| 674 | static int cps2_objram_bank; | |
| 675 | static int cps2_last_sprite_offset; /* Offset of the last sprite */ | |
| 676 | ||
| 677 | #define CPS2_OBJ_BASE 0x00 /* Unknown (not base address of objects). Could be bass address of bank used when object swap bit set? */ | |
| 678 | #define CPS2_OBJ_UK1 0x02 /* Unknown (nearly always 0x807d, or 0x808e when screen flipped) */ | |
| 679 | #define CPS2_OBJ_PRI 0x04 /* Layers priorities */ | |
| 680 | #define CPS2_OBJ_UK2 0x06 /* Unknown (usually 0x0000, 0x1101 in ssf2, 0x0001 in 19XX) */ | |
| 681 | #define CPS2_OBJ_XOFFS 0x08 /* X offset (usually 0x0040) */ | |
| 682 | #define CPS2_OBJ_YOFFS 0x0a /* Y offset (always 0x0010) */ | |
| 683 | ||
| 684 | 1286 | INLINE int cps2_port(int offset) |
| 685 | 1287 | { |
| 686 | 1288 | return cps2_output[offset/2]; |
| r2375 | r2376 | |
| 774 | 1376 | } |
| 775 | 1377 | |
| 776 | 1378 | |
| 777 | #if CPS1_DUMP_VIDEO | |
| 778 | static void cps1_dump_video(void) | |
| 779 | { | |
| 780 | FILE *fp; | |
| 781 | fp=fopen("SCROLL1.DMP", "w+b"); | |
| 782 | if (fp) | |
| 783 | { | |
| 784 | fwrite(cps1_scroll1, cps1_scroll_size, 1, fp); | |
| 785 | fclose(fp); | |
| 786 | } | |
| 787 | fp=fopen("SCROLL2.DMP", "w+b"); | |
| 788 | if (fp) | |
| 789 | { | |
| 790 | fwrite(cps1_scroll2, cps1_scroll_size, 1, fp); | |
| 791 | fclose(fp); | |
| 792 | } | |
| 793 | fp=fopen("SCROLL3.DMP", "w+b"); | |
| 794 | if (fp) | |
| 795 | { | |
| 796 | fwrite(cps1_scroll3, cps1_scroll_size, 1, fp); | |
| 797 | fclose(fp); | |
| 798 | } | |
| 799 | ||
| 800 | fp=fopen("OBJ.DMP", "w+b"); | |
| 801 | if (fp) | |
| 802 | { | |
| 803 | fwrite(cps1_obj, cps1_obj_size, 1, fp); | |
| 804 | fclose(fp); | |
| 805 | } | |
| 806 | if (cps_version == 2) | |
| 807 | { | |
| 808 | /* PSL: CPS2 support */ | |
| 809 | fp=fopen("OBJCPS2.DMP", "w+b"); | |
| 810 | if (fp) | |
| 811 | { | |
| 812 | fwrite(cps2_objram1, cps2_obj_size, 1, fp); | |
| 813 | fwrite(cps2_objram2, cps2_obj_size, 1, fp); | |
| 814 | fclose(fp); | |
| 815 | } | |
| 816 | fp=fopen("CPS2OUTP.DMP", "w+b"); | |
| 817 | if (fp) | |
| 818 | { | |
| 819 | fwrite(cps2_output, cps2_output_size, 1, fp); | |
| 820 | fclose(fp); | |
| 821 | } | |
| 822 | ||
| 823 | } | |
| 824 | ||
| 825 | ||
| 826 | fp=fopen("OTHER.DMP", "w+b"); | |
| 827 | if (fp) | |
| 828 | { | |
| 829 | fwrite(cps1_other, cps1_other_size, 1, fp); | |
| 830 | fclose(fp); | |
| 831 | } | |
| 832 | ||
| 833 | fp=fopen("PALETTE.DMP", "w+b"); | |
| 834 | if (fp) | |
| 835 | { | |
| 836 | fwrite(cps1_palette, cps1_palette_size, 1, fp); | |
| 837 | fclose(fp); | |
| 838 | } | |
| 839 | ||
| 840 | fp=fopen("OUTPUT.DMP", "w+b"); | |
| 841 | if (fp) | |
| 842 | { | |
| 843 | fwrite(cps1_output, cps1_output_size, 1, fp); | |
| 844 | fclose(fp); | |
| 845 | } | |
| 846 | fp=fopen("VIDEO.DMP", "w+b"); | |
| 847 | if (fp) | |
| 848 | { | |
| 849 | fwrite(cps1_gfxram, cps1_gfxram_size, 1, fp); | |
| 850 | fclose(fp); | |
| 851 | } | |
| 852 | ||
| 853 | } | |
| 854 | #endif | |
| 855 | ||
| 856 | ||
| 857 | 1379 | void cps1_get_video_base(void ) |
| 858 | 1380 | { |
| 859 | int layercontrol, scroll1xoff, scroll2xoff, scroll3xoff; | |
| 1381 | int layercontrol, videocontrol, scroll1xoff, scroll2xoff, scroll3xoff; | |
| 860 | 1382 | |
| 861 | 1383 | /* Re-calculate the VIDEO RAM base */ |
| 862 | 1384 | if (cps1_scroll1 != cps1_base(CPS1_SCROLL1_BASE,cps1_scroll_size)) |
| r2375 | r2376 | |
| 876 | 1398 | } |
| 877 | 1399 | |
| 878 | 1400 | /* Some of the sf2 hacks use only sprite port 0x9100 and the scroll layers are offset */ |
| 879 | if (cps1_game_config->kludge == 1 | |
| 1401 | if (cps1_game_config->bootleg_kludge == 1 | |
| 880 | 1402 | { |
| 881 | 1403 | cps1_output[CPS1_OBJ_BASE/2] = 0x9100; |
| 882 | 1404 | cps1_obj=cps1_base(CPS1_OBJ_BASE, cps1_obj_size); |
| r2375 | r2376 | |
| 891 | 1413 | scroll2xoff = 0; |
| 892 | 1414 | scroll3xoff = 0; |
| 893 | 1415 | } |
| 894 | cps1_palette=cps1_base(CPS1_PALETTE_BASE,cps1_palette_align); | |
| 895 | 1416 | cps1_other=cps1_base(CPS1_OTHER_BASE,cps1_other_size); |
| 896 | 1417 | |
| 897 | 1418 | /* Get scroll values */ |
| r2375 | r2376 | |
| 908 | 1429 | |
| 909 | 1430 | /* Get layer enable bits */ |
| 910 | 1431 | layercontrol=cps1_port(cps1_game_config->layer_control); |
| 1432 | videocontrol=cps1_port(CPS1_VIDEOCONTROL); | |
| 911 | 1433 | tilemap_set_enable(cps1_bg_tilemap[0],layercontrol & cps1_game_config->layer_enable_mask[0]); |
| 912 | tilemap_set_enable(cps1_bg_tilemap[1],layercontrol & cps1_game_config->layer_enable_mask[1]); | |
| 913 | tilemap_set_enable(cps1_bg_tilemap[2],layercontrol & cps1_game_config->layer_enable_mask[2]); | |
| 1434 | tilemap_set_enable(cps1_bg_tilemap[1],(layercontrol & cps1_game_config->layer_enable_mask[1]) && (videocontrol & 4)); | |
| 1435 | tilemap_set_enable(cps1_bg_tilemap[2],(layercontrol & cps1_game_config->layer_enable_mask[2]) && (videocontrol & 8)); | |
| 914 | 1436 | cps1_stars_enabled[0] = layercontrol & cps1_game_config->layer_enable_mask[3]; |
| 915 | 1437 | cps1_stars_enabled[1] = layercontrol & cps1_game_config->layer_enable_mask[4]; |
| 916 | 1438 | |
| r2375 | r2376 | |
| 982 | 1504 | |
| 983 | 1505 | |
| 984 | 1506 | |
| 1507 | static int gfxrom_bank_mapper(running_machine *machine, int type, int code) | |
| 1508 | { | |
| 1509 | const struct gfx_range *range = cps1_game_config->bank_mapper; | |
| 1510 | int shift = 0; | |
| 1511 | ||
| 1512 | assert(range); | |
| 1513 | ||
| 1514 | switch (type) | |
| 1515 | { | |
| 1516 | case GFXTYPE_SPRITES: shift = 1; break; | |
| 1517 | case GFXTYPE_SCROLL1: shift = 0; break; | |
| 1518 | case GFXTYPE_SCROLL2: shift = 1; break; | |
| 1519 | case GFXTYPE_SCROLL3: shift = 3; break; | |
| 1520 | } | |
| 1521 | ||
| 1522 | code <<= shift; | |
| 1523 | ||
| 1524 | while (range->type) | |
| 1525 | { | |
| 1526 | if (code >= range->start && code <= range->end) | |
| 1527 | { | |
| 1528 | if (range->type & type) | |
| 1529 | { | |
| 1530 | return ((code & (cps1_game_config->bank_size - 1)) + (range->bank * cps1_game_config->bank_size)) >> shift; | |
| 1531 | } | |
| 1532 | } | |
| 1533 | ||
| 1534 | ++range; | |
| 1535 | } | |
| 1536 | ||
| 1537 | #ifdef MAME_DEBUG | |
| 1538 | // popmessage("tile %02x/%04x out of range", type,code>>shift); | |
| 1539 | #endif | |
| 1540 | ||
| 1541 | return -1; | |
| 1542 | } | |
| 1543 | ||
| 1544 | ||
| 985 | 1545 | /*************************************************************************** |
| 986 | 1546 | |
| 987 | 1547 | Start the video hardware emulation. |
| r2375 | r2376 | |
| 1010 | 1570 | |
| 1011 | 1571 | static TILE_GET_INFO( get_tile0_info ) |
| 1012 | 1572 | { |
| 1013 | int base = cps1_game_config->bank_scroll1 * 0x08000; | |
| 1014 | 1573 | int code = cps1_scroll1[2*tile_index]; |
| 1015 | 1574 | int attr = cps1_scroll1[2*tile_index+1]; |
| 1016 | 1575 | int gfxset; |
| 1017 | 1576 | |
| 1577 | code = gfxrom_bank_mapper(machine, GFXTYPE_SCROLL1, code); | |
| 1578 | ||
| 1018 | 1579 | /* allows us to reproduce a problem seen with a ffight board where USA and Japanese |
| 1019 | roms have been mixed to be reproduced (ffightua) -- it looks like each column | |
| 1020 | should alternate between the left and right side of the 16x16 tiles */ | |
| 1580 | roms have been mixed to be reproduced (ffightua) -- it looks like each column | |
| 1581 | should alternate between the left and right side of the 16x16 tiles */ | |
| 1021 | 1582 | gfxset = (tile_index & 0x20) >> 5; |
| 1022 | 1583 | |
| 1023 | 1584 | SET_TILE_INFO( |
| 1024 | 1585 | gfxset, |
| 1025 | code + base, | |
| 1026 | (attr & 0x1f) + palette_basecolor[1], | |
| 1586 | code, | |
| 1587 | (attr & 0x1f) + 0x20, | |
| 1027 | 1588 | TILE_FLIPYX((attr & 0x60) >> 5)); |
| 1028 | 1589 | tileinfo->group = (attr & 0x0180) >> 7; |
| 1029 | 1590 | |
| 1030 | if ((cps1_game_config->kludge == 3 && code == 0xf020) || // knights & msword: startup text | |
| 1031 | (cps1_game_config->kludge == 2 && code == 0x0000) || // 3wonders: bottom of screen, between lives of first player and the word INSERT COIN | |
| 1032 | (cps1_game_config->kludge == 11 && code == 0x0020)) // strider, unsquad, captcomm | |
| 1033 | { | |
| 1591 | // for out of range tiles, switch to fully transparent data | |
| 1592 | // (but still call SET_TILE_INFO, otherwise problems might occur on boot e.g. unsquad) | |
| 1593 | if (code == -1) | |
| 1034 | 1594 | tileinfo->pen_data = empty_tile; |
| 1035 | } | |
| 1036 | 1595 | } |
| 1037 | 1596 | |
| 1038 | 1597 | static TILE_GET_INFO( get_tile1_info ) |
| 1039 | 1598 | { |
| 1040 | int base = cps1_game_config->bank_scroll2 * 0x04000; | |
| 1041 | const int startcode = cps1_game_config->start_scroll2; | |
| 1042 | const int endcode = cps1_game_config->end_scroll2; | |
| 1043 | 1599 | int code = cps1_scroll2[2*tile_index]; |
| 1044 | 1600 | int attr = cps1_scroll2[2*tile_index+1]; |
| 1045 | 1601 | |
| 1602 | code = gfxrom_bank_mapper(machine, GFXTYPE_SCROLL2, code); | |
| 1603 | ||
| 1046 | 1604 | SET_TILE_INFO( |
| 1047 | 1605 | 2, |
| 1048 | code + base, | |
| 1049 | (attr & 0x1f) + palette_basecolor[2], | |
| 1606 | code, | |
| 1607 | (attr & 0x1f) + 0x40, | |
| 1050 | 1608 | TILE_FLIPYX((attr & 0x60) >> 5)); |
| 1051 | 1609 | tileinfo->group = (attr & 0x0180) >> 7; |
| 1052 | 1610 | |
| 1053 | if (code < startcode || code > endcode | |
| 1054 | /* | |
| 1055 | MERCS has an gap in the scroll 2 layout | |
| 1056 | (bad tiles at start of level 2)*/ | |
| 1057 | || (cps1_game_config->kludge == 4 && (code >= 0x1e00 && code < 0x5400)) | |
| 1058 | ) | |
| 1059 | { | |
| 1611 | // for out of range tiles, switch to fully transparent data | |
| 1612 | if (code == -1) | |
| 1060 | 1613 | tileinfo->pen_data = empty_tile; |
| 1061 | } | |
| 1062 | 1614 | } |
| 1063 | 1615 | |
| 1064 | 1616 | static TILE_GET_INFO( get_tile2_info ) |
| 1065 | 1617 | { |
| 1066 | int base = cps1_game_config->bank_scroll3 * 0x1000; | |
| 1067 | const int startcode = cps1_game_config->start_scroll3; | |
| 1068 | const int endcode = cps1_game_config->end_scroll3; | |
| 1069 | int code = cps1_scroll3[2*tile_index]; | |
| 1618 | int code = cps1_scroll3[2*tile_index] & 0x3fff; | |
| 1070 | 1619 | int attr = cps1_scroll3[2*tile_index+1]; |
| 1071 | 1620 | |
| 1072 | if (cps1_game_config->kludge == 2 && code < 0x0e00) | |
| 1073 | { | |
| 1074 | code += 0x1000; | |
| 1075 | } | |
| 1076 | if (cps1_game_config->kludge == 8 && code >= 0x5800) | |
| 1077 | { | |
| 1078 | code -= 0x4000; | |
| 1079 | } | |
| 1080 | if (cps1_game_config->kludge == 9 && code < 0x5600) | |
| 1081 | { | |
| 1082 | code += 0x4000; | |
| 1083 | } | |
| 1621 | code = gfxrom_bank_mapper(machine, GFXTYPE_SCROLL3, code); | |
| 1084 | 1622 | |
| 1085 | 1623 | SET_TILE_INFO( |
| 1086 | 1624 | 3, |
| 1087 | code + base, | |
| 1088 | (attr & 0x1f) + palette_basecolor[3], | |
| 1625 | code, | |
| 1626 | (attr & 0x1f) + 0x60, | |
| 1089 | 1627 | TILE_FLIPYX((attr & 0x60) >> 5)); |
| 1090 | 1628 | tileinfo->group = (attr & 0x0180) >> 7; |
| 1091 | 1629 | |
| 1092 | if (code < startcode || code > endcode) | |
| 1093 | { | |
| 1630 | // for out of range tiles, switch to fully transparent data | |
| 1631 | // (but still call SET_TILE_INFO, otherwise problems might occur on boot e.g. unsquad) | |
| 1632 | if (code == -1) | |
| 1094 | 1633 | tileinfo->pen_data = empty_tile; |
| 1095 | } | |
| 1096 | 1634 | } |
| 1097 | 1635 | |
| 1098 | 1636 | |
| r2375 | r2376 | |
| 1116 | 1654 | } |
| 1117 | 1655 | } |
| 1118 | 1656 | |
| 1119 | static void cps1_create_empty_8x8_tile(running_machine *machine) | |
| 1120 | { | |
| 1121 | /* for the 8x8 layer we can't use GFX_RAW so we need to create an empty tile | |
| 1122 | so that the 'don't draw tile' kludges work */ | |
| 1123 | static const gfx_layout empty_layout8x8 = | |
| 1124 | { | |
| 1125 | 8,8, | |
| 1126 | 1, | |
| 1127 | 4, | |
| 1128 | { 0, 1, 2, 3 }, | |
| 1129 | { 1*4, 0*4, 3*4, 2*4, 5*4, 4*4, 7*4, 6*4 }, | |
| 1130 | { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64 }, | |
| 1131 | 64*8 | |
| 1132 | }; | |
| 1133 | ||
| 1134 | machine->gfx[4] = allocgfx(&empty_layout8x8); | |
| 1135 | decodechar(machine->gfx[4], 0, (UINT8 *)empty_tile); | |
| 1136 | machine->gfx[4]->total_colors = 0x100; | |
| 1137 | ||
| 1138 | } | |
| 1139 | ||
| 1140 | 1657 | static VIDEO_START( cps ) |
| 1141 | 1658 | { |
| 1142 | 1659 | int i; |
| 1143 | 1660 | |
| 1144 | ||
| 1661 | | |
| 1145 | 1662 | |
| 1146 | 1663 | cps1_bg_tilemap[0] = tilemap_create(get_tile0_info,tilemap0_scan, 8, 8,64,64); |
| 1147 | 1664 | cps1_bg_tilemap[1] = tilemap_create(get_tile1_info,tilemap1_scan,16,16,64,64); |
| r2375 | r2376 | |
| 1149 | 1666 | |
| 1150 | 1667 | /* front masks will change at runtime to handle sprite occluding */ |
| 1151 | 1668 | cps1_update_transmasks(); |
| 1669 | ||
| 1152 | 1670 | memset(empty_tile,0xff,sizeof(empty_tile)); |
| 1153 | 1671 | |
| 1154 | cps1_create_empty_8x8_tile(machine); | |
| 1155 | ||
| 1156 | cps1_old_palette=auto_malloc(cps1_palette_size); | |
| 1157 | memset(cps1_old_palette, 0x00, cps1_palette_size); | |
| 1158 | 1672 | for (i = 0;i < cps1_palette_entries*16;i++) |
| 1159 | 1673 | { |
| 1160 | 1674 | palette_set_color(machine,i,MAKE_RGB(0,0,0)); |
| r2375 | r2376 | |
| 1184 | 1698 | cps1_output[CPS1_SCROLL2_BASE/2] = 0x9040; |
| 1185 | 1699 | cps1_output[CPS1_SCROLL3_BASE/2] = 0x9080; |
| 1186 | 1700 | cps1_output[CPS1_OTHER_BASE/2] = 0x9100; |
| 1187 | cps1_output[CPS1_PALETTE_BASE/2] = 0x90c0; | |
| 1188 | 1701 | |
| 1189 | 1702 | assert_always(cps1_game_config, "cps1_game_config hasn't been set up yet"); |
| 1190 | 1703 | |
| 1191 | 1704 | /* Set up old base */ |
| 1192 | 1705 | cps1_get_video_base(); /* Calculate base pointers */ |
| 1193 | 1706 | cps1_get_video_base(); /* Calculate old base pointers */ |
| 1194 | ||
| 1195 | /* set palette banks */ | |
| 1196 | palette_basecolor[0] = 0*32; /* obj */ | |
| 1197 | palette_basecolor[1] = 1*32; /* scroll1 */ | |
| 1198 | palette_basecolor[2] = 2*32; /* scroll2 */ | |
| 1199 | palette_basecolor[3] = 3*32; /* scroll3 */ | |
| 1200 | palette_basecolor[4] = 4*32; /* stars1 */ | |
| 1201 | palette_basecolor[5] = 5*32; /* stars2 (and bg) */ | |
| 1202 | 1707 | } |
| 1203 | 1708 | |
| 1204 | 1709 | VIDEO_START( cps1 ) |
| r2375 | r2376 | |
| 1221 | 1726 | |
| 1222 | 1727 | ***************************************************************************/ |
| 1223 | 1728 | |
| 1224 | void cps1_build_palette(running_machine *machine) | |
| 1729 | static void cps1_build_palette(running_machine *machine, const UINT16* const palette_base) | |
| 1225 | 1730 | { |
| 1226 | int offset; | |
| 1731 | int offset, page; | |
| 1732 | const UINT16 *palette_ram = palette_base; | |
| 1227 | 1733 | |
| 1228 | for (offset = 0; offset < cps1_palette_entries*16; offset++) | |
| 1734 | int ctrl = cps1_port(cps1_game_config->palette_control); | |
| 1735 | ||
| 1736 | /* | |
| 1737 | The palette is copied only for pages that are enabled in the ctrl | |
| 1738 | register. Note that if the sprite palette (page 0) is skipped, the | |
| 1739 | all the following pages are scaled down by one. | |
| 1740 | */ | |
| 1741 | for (page = 0; page < 6; ++page) | |
| 1229 | 1742 | { |
| 1230 | int palette = cps1_palette[offset]; | |
| 1231 | ||
| 1232 | if (palette != cps1_old_palette[offset]) | |
| 1743 | if (BIT(ctrl,page)) | |
| 1233 | 1744 | { |
| 1234 | int red, green, blue, bright; | |
| 1745 | for (offset = 0; offset < 0x200; ++offset) | |
| 1746 | { | |
| 1747 | int palette = *(palette_ram++); | |
| 1748 | int r, g, b, bright; | |
| 1235 | 1749 | |
| 1236 | bright = 0x10 + (palette>>12); | |
| 1750 | // from my understanding of the schematics, when the 'brightness' | |
| 1751 | // component is set to 0 it should reduce brightness to 1/3 | |
| 1237 | 1752 | |
| 1238 | red = ((palette>>8)&0x0f) * bright * 0x11 / 0x1f; | |
| 1239 | green = ((palette>>4)&0x0f) * bright * 0x11 / 0x1f; | |
| 1240 | blue = ((palette>>0)&0x0f) * bright * 0x11 / 0x1f; | |
| 1753 | bright = 0x0f + ((palette>>12)<<1); | |
| 1241 | 1754 | |
| 1242 | palette_set_color (machine, offset, MAKE_RGB(red, green, blue)); | |
| 1243 | cps1_old_palette[offset] = palette; | |
| 1755 | r = ((palette>>8)&0x0f) * 0x11 * bright / 0x2d; | |
| 1756 | g = ((palette>>4)&0x0f) * 0x11 * bright / 0x2d; | |
| 1757 | b = ((palette>>0)&0x0f) * 0x11 * bright / 0x2d; | |
| 1758 | ||
| 1759 | palette_set_color (machine, 0x200*page + offset, MAKE_RGB(r, g, b)); | |
| 1760 | } | |
| 1244 | 1761 | } |
| 1762 | else | |
| 1763 | { | |
| 1764 | if (page > 0) | |
| 1765 | palette_ram += 0x200; | |
| 1766 | } | |
| 1245 | 1767 | } |
| 1246 | 1768 | } |
| 1247 | 1769 | |
| r2375 | r2376 | |
| 1326 | 1848 | UINT16 *base=cps1_buffered_obj; |
| 1327 | 1849 | |
| 1328 | 1850 | /* some sf2 hacks draw the sprites in reverse order */ |
| 1329 | if (cps1_game_config->kludge == 1 | |
| 1851 | if (cps1_game_config->bootleg_kludge == 1 | |
| 1330 | 1852 | { |
| 1331 | 1853 | base += cps1_last_sprite_offset; |
| 1332 | 1854 | baseadd = -4; |
| r2375 | r2376 | |
| 1347 | 1869 | // x-=0x20; |
| 1348 | 1870 | // y+=0x20; |
| 1349 | 1871 | |
| 1350 | if (cps1_game_config->kludge == 7) | |
| 1351 | { | |
| 1352 | code += 0x4000; | |
| 1353 | } | |
| 1354 | if (cps1_game_config->kludge == 1 && code >= 0x01000) | |
| 1355 | { | |
| 1356 | code += 0x4000; | |
| 1357 | } | |
| 1358 | if (cps1_game_config->kludge == 2 && code >= 0x02a00) | |
| 1359 | { | |
| 1360 | code += 0x4000; | |
| 1361 | } | |
| 1872 | code = gfxrom_bank_mapper(machine, GFXTYPE_SPRITES, code); | |
| 1362 | 1873 | |
| 1363 | if (code | |
| 1874 | if (code != | |
| 1364 | 1875 | { |
| 1365 | 1876 | if (colour & 0xff00 ) |
| 1366 | 1877 | { |
| r2375 | r2376 | |
| 1386 | 1897 | DRAWSPRITE( |
| 1387 | 1898 | // code+(nx-1)-nxs+0x10*(ny-1-nys), |
| 1388 | 1899 | (code & ~0xf) + ((code + (nx-1) - nxs) & 0xf) + 0x10*(ny-1-nys), |
| 1389 | (col&0x1f) | |
| 1900 | (col&0x1f) | |
| 1390 | 1901 | 1,1, |
| 1391 | 1902 | sx,sy); |
| 1392 | 1903 | } |
| r2375 | r2376 | |
| 1404 | 1915 | DRAWSPRITE( |
| 1405 | 1916 | // code+nxs+0x10*(ny-1-nys), |
| 1406 | 1917 | (code & ~0xf) + ((code + nxs) & 0xf) + 0x10*(ny-1-nys), |
| 1407 | (col&0x1f) | |
| 1918 | (col&0x1f) | |
| 1408 | 1919 | 0,1, |
| 1409 | 1920 | sx,sy); |
| 1410 | 1921 | } |
| r2375 | r2376 | |
| 1425 | 1936 | DRAWSPRITE( |
| 1426 | 1937 | // code+(nx-1)-nxs+0x10*nys, |
| 1427 | 1938 | (code & ~0xf) + ((code + (nx-1) - nxs) & 0xf) + 0x10*nys, |
| 1428 | (col&0x1f) | |
| 1939 | (col&0x1f) | |
| 1429 | 1940 | 1,0, |
| 1430 | 1941 | sx,sy); |
| 1431 | 1942 | } |
| r2375 | r2376 | |
| 1443 | 1954 | DRAWSPRITE( |
| 1444 | 1955 | // code+nxs+0x10*nys, |
| 1445 | 1956 | (code & ~0xf) + ((code + nxs) & 0xf) + 0x10*nys, // fix 00406: qadj: When playing as the ninja, there is one broekn frame in his animation loop when walking. |
| 1446 | (col&0x1f) | |
| 1957 | (col&0x1f) | |
| 1447 | 1958 | 0,0, |
| 1448 | 1959 | sx,sy); |
| 1449 | 1960 | } |
| r2375 | r2376 | |
| 1456 | 1967 | /* Simple case... 1 sprite */ |
| 1457 | 1968 | DRAWSPRITE( |
| 1458 | 1969 | code, |
| 1459 | (col&0x1f) | |
| 1970 | (col&0x1f) | |
| 1460 | 1971 | colour&0x20,colour&0x40, |
| 1461 | 1972 | x & 0x1ff,y & 0x1ff); |
| 1462 | 1973 | } |
| r2375 | r2376 | |
| 1617 | 2128 | sy = (y+nys*16+yoffs) & 0x3ff; |
| 1618 | 2129 | DRAWSPRITE( |
| 1619 | 2130 | code+(nx-1)-nxs+0x10*(ny-1-nys), |
| 1620 | (col&0x1f) | |
| 2131 | (col&0x1f) | |
| 1621 | 2132 | 1,1, |
| 1622 | 2133 | sx,sy); |
| 1623 | 2134 | } |
| r2375 | r2376 | |
| 1634 | 2145 | |
| 1635 | 2146 | DRAWSPRITE( |
| 1636 | 2147 | code+nxs+0x10*(ny-1-nys), |
| 1637 | (col&0x1f) | |
| 2148 | (col&0x1f) | |
| 1638 | 2149 | 0,1, |
| 1639 | 2150 | sx,sy); |
| 1640 | 2151 | } |
| r2375 | r2376 | |
| 1654 | 2165 | |
| 1655 | 2166 | DRAWSPRITE( |
| 1656 | 2167 | code+(nx-1)-nxs+0x10*nys, |
| 1657 | (col&0x1f) | |
| 2168 | (col&0x1f) | |
| 1658 | 2169 | 1,0, |
| 1659 | 2170 | sx,sy); |
| 1660 | 2171 | } |
| r2375 | r2376 | |
| 1672 | 2183 | DRAWSPRITE( |
| 1673 | 2184 | // code+nxs+0x10*nys, |
| 1674 | 2185 | (code & ~0xf) + ((code + nxs) & 0xf) + 0x10*nys, // pgear fix |
| 1675 | (col&0x1f) | |
| 2186 | (col&0x1f) | |
| 1676 | 2187 | 0,0, |
| 1677 | 2188 | sx,sy); |
| 1678 | 2189 | } |
| r2375 | r2376 | |
| 1685 | 2196 | /* Simple case... 1 sprite */ |
| 1686 | 2197 | DRAWSPRITE( |
| 1687 | 2198 | code, |
| 1688 | (col&0x1f) | |
| 2199 | (col&0x1f) | |
| 1689 | 2200 | colour&0x20,colour&0x40, |
| 1690 | 2201 | (x+xoffs) & 0x3ff,(y+yoffs) & 0x3ff); |
| 1691 | 2202 | } |
| r2375 | r2376 | |
| 1802 | 2313 | VIDEO_UPDATE( cps1 ) |
| 1803 | 2314 | { |
| 1804 | 2315 | int layercontrol,l0,l1,l2,l3; |
| 1805 | int videocontrol=cps1_port( | |
| 2316 | int videocontrol=cps1_port(CPS1_VIDEOCONTROL); | |
| 1806 | 2317 | |
| 1807 | 2318 | |
| 1808 | 2319 | flip_screen_set(videocontrol & 0x8000); |
| r2375 | r2376 | |
| 1818 | 2329 | { |
| 1819 | 2330 | cps2_find_last_sprite(); |
| 1820 | 2331 | } |
| 1821 | /* Build palette */ | |
| 1822 | cps1_build_palette(screen->machine); | |
| 1823 | 2332 | |
| 1824 | 2333 | cps1_update_transmasks(); |
| 1825 | 2334 | |
| r2375 | r2376 | |
| 1925 | 2434 | cps2_render_sprites(screen->machine,bitmap,cliprect,primasks); |
| 1926 | 2435 | } |
| 1927 | 2436 | |
| 1928 | #if CPS1_DUMP_VIDEO | |
| 1929 | if (input_code_pressed(KEYCODE_F)) | |
| 1930 | { | |
| 1931 | cps1_dump_video(); | |
| 1932 | } | |
| 1933 | #endif | |
| 1934 | 2437 | return 0; |
| 1935 | 2438 | } |
| 1936 | 2439 | |
| r2375 | r2376 | |
| 1956 | 2459 | cps2_set_sprite_priorities(); |
| 1957 | 2460 | memcpy(cps2_buffered_obj, cps2_objbase(), cps2_obj_size); |
| 1958 | 2461 | } |
| 1959 |
| r2375 | r2376 | |
|---|---|---|
| 40 | 40 | int width = visarea->max_x + 1 - visarea->min_x; |
| 41 | 41 | int height = visarea->max_y + 1 - visarea->min_y; |
| 42 | 42 | |
| 43 | *x = ((readinputport(2 + player * 2) & 0xff) * width) / 255; | |
| 44 | *y = ((readinputport(3 + player * 2) & 0xff) * height) / 255; | |
| 43 | *x = ((input_port_read_indexed(machine, 2 + player * 2) & 0xff) * width) / 255; | |
| 44 | *y = ((input_port_read_indexed(machine, 3 + player * 2) & 0xff) * height) / 255; | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 |
| r2375 | r2376 | |
|---|---|---|
| 479 | 479 | |
| 480 | 480 | /* a read from offsets 12-15 return input port values */ |
| 481 | 481 | if (offset >= 12 && offset <= 15) |
| 482 | result = | |
| 482 | result = | |
| 483 | 483 | |
| 484 | 484 | return result; |
| 485 | 485 | } |
| r2375 | r2376 | |
|---|---|---|
| 169 | 169 | const gfx_element *gfx = machine->gfx[2]; |
| 170 | 170 | |
| 171 | 171 | int tile_number, attributes, color, sx, sy; |
| 172 | int yflip; | |
| 172 | 173 | int offs; |
| 173 | 174 | |
| 174 | 175 | for(offs = 0; offs < 50*4; offs+=4) |
| r2375 | r2376 | |
| 176 | 177 | if(*(UINT32*)(spriteram+offs) == 0 || *(UINT32*)(spriteram+offs) == -1) continue; |
| 177 | 178 | |
| 178 | 179 | tile_number = spriteram[offs+1]; |
| 180 | attributes = spriteram[offs+3]; /* YBFX.CCCC */ | |
| 181 | if(attributes & 0x40) tile_number |= 256; | |
| 182 | ||
| 183 | color = attributes & 0xf; | |
| 184 | sx = xscroll - spriteram[offs+2]; | |
| 185 | if(!(attributes & 0x80)) sx += 256; | |
| 186 | sy = -yscroll + spriteram[offs]; | |
| 187 | if(attributes & 0x10) sy += 256; | |
| 188 | sx &= 0x1ff; | |
| 189 | sy &= 0x1ff; | |
| 190 | if (sx > 512-16) sx -= 512; | |
| 191 | if (sy > 512-16) sy -= 512; | |
| 192 | yflip = attributes & 0x20; | |
| 193 | ||
| 194 | drawgfx(bitmap,gfx,tile_number,color,0,yflip,sx,sy,cliprect,TRANSPARENCY_PEN_TABLE,7); | |
| 195 | } | |
| 196 | } | |
| 197 | ||
| 198 | VIDEO_UPDATE( tnk3 ) | |
| 199 | { | |
| 200 | UINT8 *ram = snk_rambase - 0xd000; | |
| 201 | int attributes = ram[0xc800]; | |
| 202 | /* | |
| 203 | X------- | |
| 204 | -X------ character bank (for text layer) | |
| 205 | --X----- | |
| 206 | ---X---- scrolly MSB (background) | |
| 207 | ----X--- scrolly MSB (sprites) | |
| 208 | -----X-- | |
| 209 | ------X- scrollx MSB (background) | |
| 210 | -------X scrollx MSB (sprites) | |
| 211 | */ | |
| 212 | ||
| 213 | /* to be moved to memmap */ | |
| 214 | spriteram = &ram[0xd000]; | |
| 215 | ||
| 216 | { | |
| 217 | int bg_scrollx = -ram[0xcc00] + 15; | |
| 218 | int bg_scrolly = -ram[0xcb00] + 8; | |
| 219 | if(attributes & 0x02) bg_scrollx += 256; | |
| 220 | if(attributes & 0x10) bg_scrolly += 256; | |
| 221 | tnk3_draw_background(screen->machine, bitmap, cliprect, bg_scrollx, bg_scrolly, 64, 64, 0 ); | |
| 222 | } | |
| 223 | ||
| 224 | { | |
| 225 | int sp_scrollx = ram[0xca00] + 29; | |
| 226 | int sp_scrolly = ram[0xc900] + 9; | |
| 227 | if(attributes & 0x01) sp_scrollx += 256; | |
| 228 | if(attributes & 0x08) sp_scrolly += 256; | |
| 229 | tnk3_draw_sprites(screen->machine, bitmap, cliprect, sp_scrollx, sp_scrolly ); | |
| 230 | } | |
| 231 | ||
| 232 | { | |
| 233 | int bank = (attributes & 0x40) ? 1:0; | |
| 234 | ||
| 235 | tnk3_draw_text(screen->machine, bitmap, cliprect, bank, &ram[0xf800] ); | |
| 236 | tnk3_draw_status(screen->machine, bitmap, cliprect, bank, &ram[0xfc00] ); | |
| 237 | } | |
| 238 | return 0; | |
| 239 | } | |
| 240 | ||
| 241 | void athena_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int xscroll, int yscroll ) | |
| 242 | { | |
| 243 | const gfx_element *gfx = machine->gfx[2]; | |
| 244 | ||
| 245 | int tile_number, attributes, color, sx, sy; | |
| 246 | int offs; | |
| 247 | ||
| 248 | for(offs = 0; offs < 50*4; offs+=4) | |
| 249 | { | |
| 250 | if(*(UINT32*)(spriteram+offs) == 0 || *(UINT32*)(spriteram+offs) == -1) continue; | |
| 251 | ||
| 252 | tile_number = spriteram[offs+1]; | |
| 179 | 253 | attributes = spriteram[offs+3]; /* YBBX.CCCC */ |
| 180 | 254 | if(attributes & 0x40) tile_number |= 256; |
| 181 | 255 | if(attributes & 0x20) tile_number |= 512; |
| r2375 | r2376 | |
| 194 | 268 | } |
| 195 | 269 | } |
| 196 | 270 | |
| 197 | VIDEO_UPDATE( tnk3 ) | |
| 271 | /* Same as tnk3 but sprite attribute bit 5 is extra bank bit instead of y-flip. */ | |
| 272 | VIDEO_UPDATE( athena ) | |
| 198 | 273 | { |
| 199 | 274 | UINT8 *ram = snk_rambase - 0xd000; |
| 200 | 275 | int attributes = ram[0xc800]; |
| r2375 | r2376 | |
| 225 | 300 | int sp_scrolly = ram[0xc900] + 9; |
| 226 | 301 | if(attributes & 0x01) sp_scrollx += 256; |
| 227 | 302 | if(attributes & 0x08) sp_scrolly += 256; |
| 228 | tn | |
| 303 | athena | |
| 229 | 304 | } |
| 230 | 305 | |
| 231 | 306 | { |
| r2375 | r2376 | |
|---|---|---|
| 106 | 106 | * communication with the sound CPU. |
| 107 | 107 | */ |
| 108 | 108 | static void |
| 109 | handle_mcu( | |
| 109 | handle_mcu( running_machine *machine ) | |
| 110 | 110 | { |
| 111 | 111 | static int toggle; |
| 112 | 112 | static UINT16 credits; |
| r2375 | r2376 | |
| 115 | 115 | static int old_p2; |
| 116 | 116 | static int old_p3; |
| 117 | 117 | static int old_p4; |
| 118 | int new_coin_state = readinputport(0)&0x3; /* coin1,2 */ | |
| 119 | unsigned dsw = readinputport(1)<<16; | |
| 120 | unsigned p1 = readinputport(2); | |
| 121 | unsigned p2 = readinputport(3); | |
| 118 | int new_coin_state = input_port_read_indexed(machine, 0)&0x3; /* coin1,2 */ | |
| 119 | unsigned dsw = input_port_read_indexed(machine, 1)<<16; | |
| 120 | unsigned p1 = input_port_read_indexed(machine, 2); | |
| 121 | unsigned p2 = input_port_read_indexed(machine, 3); | |
| 122 | 122 | unsigned p3; |
| 123 | 123 | unsigned p4; |
| 124 | 124 | toggle = !toggle; |
| 125 | 125 | if( toggle ) dsw &= ~(0x80<<16); |
| 126 | 126 | if( namcos2_gametype == NAMCONB2_MACH_BREAKERS ) |
| 127 | 127 | { |
| 128 | p3 = readinputport(4); | |
| 129 | p4 = readinputport(5); | |
| 128 | p3 = input_port_read_indexed(machine, 4); | |
| 129 | p4 = input_port_read_indexed(machine, 5); | |
| 130 | 130 | } |
| 131 | 131 | else |
| 132 | 132 | { |
| r2375 | r2376 | |
| 161 | 161 | video_update_common(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bROZ ) |
| 162 | 162 | { |
| 163 | 163 | int pri; |
| 164 | handle_mcu(); | |
| 164 | handle_mcu(machine); | |
| 165 | 165 | namconb1_install_palette(machine); |
| 166 | 166 | |
| 167 | 167 | if( bROZ ) |
| r2375 | r2376 | |
|---|---|---|
| 128 | 128 | SET_TILE_INFO(sys24_char_gfx_index, val & sys24_tile_mask, (val >> 7) & 0xff, 0); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | static | |
| 131 | static STATE_POSTLOAD( sys24_tile_dirtyall | |
| 132 | 132 | { |
| 133 | 133 | memset(sys24_char_dirtymap, 1, SYS24_TILES); |
| 134 | 134 | sys24_char_dirty = 1; |
| r2375 | r2376 | |
| 170 | 170 | |
| 171 | 171 | state_save_register_global_pointer(sys24_tile_ram, 0x10000/2); |
| 172 | 172 | state_save_register_global_pointer(sys24_char_ram, 0x80000/2); |
| 173 | state_save_register_ | |
| 173 | state_save_register_ | |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | void sys24_tile_update(running_machine *machine) |
| r2375 | r2376 | |
|---|---|---|
| 32 | 32 | int xbit, ybit, size; |
| 33 | 33 | |
| 34 | 34 | size = 2; |
| 35 | if (input_port_ | |
| 35 | if (input_port_ | |
| 36 | 36 | { |
| 37 | 37 | size = 4; |
| 38 | 38 | } |
| r2375 | r2376 | |
| 57 | 57 | { |
| 58 | 58 | int i,x,y; |
| 59 | 59 | |
| 60 | int video_inverted = | |
| 60 | int video_inverted = | |
| 61 | 61 | |
| 62 | 62 | /* The first row of characters are invisible */ |
| 63 | 63 | for (i = 0; i < (VERT_RES - 1) * HORZ_RES; i++) |
| r2375 | r2376 | |
|---|---|---|
| 8 | 8 | videoram[offset] = data; |
| 9 | 9 | tilemap_mark_tile_dirty(bg_tilemap, offset); |
| 10 | 10 | |
| 11 | if (input_port_ | |
| 11 | if (input_port_ | |
| 12 | 12 | { |
| 13 | 13 | logerror("blockade_videoram_w: scanline %d\n", video_screen_get_vpos(machine->primary_screen)); |
| 14 | 14 | cpu_spinuntil_int(); |
| r2375 | r2376 | |
|---|---|---|
| 187 | 187 | 0x1B3,0x1B4,0x1B5,0x1B6,0x1B7,0x1B8,0x1B9,0x1BA,0x1BB,0x1BC,0x1BD,0x1BE,0x1BF,0x1BF |
| 188 | 188 | }; |
| 189 | 189 | |
| 190 | static void lorddgun_calc_gun_scr(int i) | |
| 190 | static void lorddgun_calc_gun_scr(running_machine *machine, int i) | |
| 191 | 191 | { |
| 192 | int x = | |
| 192 | int x = | |
| 193 | 193 | if ( (x < 0) || (x > sizeof(lordgun_gun_x_table)/sizeof(lordgun_gun_x_table[0])) ) |
| 194 | 194 | x = 0; |
| 195 | 195 | |
| 196 | 196 | lordgun_gun[i].scr_x = lordgun_gun_x_table[x]; |
| 197 | lordgun_gun[i].scr_y = | |
| 197 | lordgun_gun[i].scr_y = | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | void lordgun_update_gun(int i) | |
| 200 | void lordgun_update_gun(running_machine *machine, int i) | |
| 201 | 201 | { |
| 202 | const rectangle *visarea = video_screen_get_visible_area( | |
| 202 | const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen); | |
| 203 | 203 | |
| 204 | lordgun_gun[i].hw_x = readinputport(5+i); | |
| 205 | lordgun_gun[i].hw_y = readinputport(7+i); | |
| 204 | lordgun_gun[i].hw_x = input_port_read_indexed(machine, 5+i); | |
| 205 | lordgun_gun[i].hw_y = input_port_read_indexed(machine, 7+i); | |
| 206 | 206 | |
| 207 | lorddgun_calc_gun_scr(i); | |
| 207 | lorddgun_calc_gun_scr(machine, i); | |
| 208 | 208 | |
| 209 | 209 | if ( (lordgun_gun[i].scr_x < visarea->min_x) || |
| 210 | 210 | (lordgun_gun[i].scr_x > visarea->max_x) || |
| r2375 | r2376 | |
|---|---|---|
| 317 | 317 | tilemap_set_scrolly(pf4_tilemap,0,(pf4_scrolly >> 7) - (tiles_offsety - scrolly_offs)); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | static | |
| 320 | static STATE_POSTLOAD( rallybik_flipscreen | |
| 321 | 321 | { |
| 322 | 322 | rallybik_bcu_flipscreen_w(Machine, 0, bcu_flipscreen, 0); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | static | |
| 325 | static STATE_POSTLOAD( toaplan1_flipscreen | |
| 326 | 326 | { |
| 327 | 327 | toaplan1_bcu_flipscreen_w(Machine, 0, bcu_flipscreen, 0); |
| 328 | 328 | } |
| r2375 | r2376 | |
| 368 | 368 | state_save_register_global(pf_voffs); |
| 369 | 369 | state_save_register_global(spriteram_offs); |
| 370 | 370 | |
| 371 | state_save_register_ | |
| 371 | state_save_register_ | |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | VIDEO_START( toaplan1 ) |
| r2375 | r2376 | |
| 418 | 418 | state_save_register_global(pf_voffs); |
| 419 | 419 | state_save_register_global(spriteram_offs); |
| 420 | 420 | |
| 421 | state_save_register_ | |
| 421 | state_save_register_ | |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 |
| r2375 | r2376 | |
|---|---|---|
| 239 | 239 | |
| 240 | 240 | VIDEO_START( punkshot ) |
| 241 | 241 | { |
| 242 | K053251_vh_start(); | |
| 242 | K053251_vh_start(machine); | |
| 243 | 243 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tmnt_tile_callback); |
| 244 | 244 | K051960_vh_start(machine,REGION_GFX2,NORMAL_PLANE_ORDER,punkshot_sprite_callback); |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | VIDEO_START( lgtnfght ) /* also tmnt2, ssriders */ |
| 248 | 248 | { |
| 249 | K053251_vh_start(); | |
| 249 | K053251_vh_start(machine); | |
| 250 | 250 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tmnt_tile_callback); |
| 251 | 251 | K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER,lgtnfght_sprite_callback); |
| 252 | 252 | |
| r2375 | r2376 | |
| 262 | 262 | |
| 263 | 263 | VIDEO_START( sunsetbl ) |
| 264 | 264 | { |
| 265 | K053251_vh_start(); | |
| 265 | K053251_vh_start(machine); | |
| 266 | 266 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,ssbl_tile_callback); |
| 267 | 267 | K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER,lgtnfght_sprite_callback); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | VIDEO_START( blswhstl ) |
| 271 | 271 | { |
| 272 | K053251_vh_start(); | |
| 272 | K053251_vh_start(machine); | |
| 273 | 273 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,blswhstl_tile_callback); |
| 274 | 274 | K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER,blswhstl_sprite_callback); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | VIDEO_START( glfgreat ) |
| 278 | 278 | { |
| 279 | K053251_vh_start(); | |
| 279 | K053251_vh_start(machine); | |
| 280 | 280 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tmnt_tile_callback); |
| 281 | 281 | K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER,lgtnfght_sprite_callback); |
| 282 | 282 | |
| r2375 | r2376 | |
| 290 | 290 | |
| 291 | 291 | VIDEO_START( thndrx2 ) |
| 292 | 292 | { |
| 293 | K053251_vh_start(); | |
| 293 | K053251_vh_start(machine); | |
| 294 | 294 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tmnt_tile_callback); |
| 295 | 295 | K051960_vh_start(machine,REGION_GFX2,NORMAL_PLANE_ORDER,thndrx2_sprite_callback); |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | VIDEO_START( prmrsocr ) |
| 299 | 299 | { |
| 300 | K053251_vh_start(); | |
| 300 | K053251_vh_start(machine); | |
| 301 | 301 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tmnt_tile_callback); |
| 302 | 302 | K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER,prmrsocr_sprite_callback); |
| 303 | 303 |
| r2375 | r2376 | |
|---|---|---|
| 93 | 93 | |
| 94 | 94 | VIDEO_START( bionicc ) |
| 95 | 95 | { |
| 96 | tx_tilemap = tilemap_create(get_tx_tile_info,tilemap_scan_rows, 8,8,32,32); | |
| 97 | fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows, 16,16,64,64); | |
| 98 | bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows, 8,8,64,64); | |
| 96 | tx_tilemap = tilemap_create(get_tx_tile_info,tilemap_scan_rows, 8, 8,32,32); | |
| 97 | fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows,16,16,64,64); | |
| 98 | bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows, 8, 8,64,64); | |
| 99 | 99 | |
| 100 | 100 | tilemap_set_transparent_pen(tx_tilemap,3); |
| 101 | 101 | tilemap_set_transmask(fg_tilemap,0,0xffff,0x8000); /* split type 0 is completely transparent in front half */ |
| r2375 | r2376 | |
| 219 | 219 | |
| 220 | 220 | VIDEO_UPDATE( bionicc ) |
| 221 | 221 | { |
| 222 | fillbitmap(bitmap, | |
| 222 | fillbitmap(bitmap,get_black_pen(screen->machine),cliprect); | |
| 223 | 223 | tilemap_draw(bitmap,cliprect,fg_tilemap,1|TILEMAP_DRAW_LAYER1,0); /* nothing in FRONT */ |
| 224 | 224 | tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); |
| 225 | 225 | tilemap_draw(bitmap,cliprect,fg_tilemap,0|TILEMAP_DRAW_LAYER1,0); |
| r2375 | r2376 | |
|---|---|---|
| 434 | 434 | |
| 435 | 435 | tilemap *tmptilemap0, *tmptilemap1; |
| 436 | 436 | |
| 437 | flip_screen_set(~ | |
| 437 | flip_screen_set(~ | |
| 438 | 438 | |
| 439 | 439 | /* Layers enable (not quite right) */ |
| 440 | 440 |
| r2375 | r2376 | |
|---|---|---|
| 36 | 36 | actual_get_fg_tile_info(machine, tileinfo, tile_index, darius_fg_ram, 2); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | static void dirty_fg_tilemap(void) | |
| 40 | { | |
| 41 | tilemap_mark_all_tiles_dirty(fg_tilemap); | |
| 42 | } | |
| 43 | ||
| 44 | 39 | /***************************************************************************/ |
| 45 | 40 | |
| 46 | 41 | VIDEO_START( darius ) |
| r2375 | r2376 | |
| 50 | 45 | spritelist = auto_malloc(0x800 * sizeof(*spritelist)); |
| 51 | 46 | |
| 52 | 47 | /* (chips, gfxnum, x_offs, y_offs, y_invert, opaque, dblwidth) */ |
| 53 | PC080SN_vh_start(1,1,-16,8,0,1,1); | |
| 48 | PC080SN_vh_start(machine,1,1,-16,8,0,1,1); | |
| 54 | 49 | |
| 55 | 50 | tilemap_set_transparent_pen(fg_tilemap,0); |
| 56 | ||
| 57 | /* colors from saved states are often screwy (and this doesn't help...) */ | |
| 58 | state_save_register_func_postload(dirty_fg_tilemap); | |
| 59 | 51 | } |
| 60 | 52 | |
| 61 | 53 | /***************************************************************************/ |
| r2375 | r2376 | |
|---|---|---|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | static | |
| 421 | static STATE_POSTLOAD( st0016_postload | |
| 422 | 422 | { |
| 423 | 423 | int i; |
| 424 | 424 | st0016_rom_bank_w(Machine,0,st0016_rom_bank); |
| r2375 | r2376 | |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | |
| 430 | void st0016_save_init( | |
| 430 | void st0016_save_init(running_machine *machine) | |
| 431 | 431 | { |
| 432 | 432 | state_save_register_global(st0016_spr_bank); |
| 433 | 433 | state_save_register_global(st0016_spr2_bank); |
| r2375 | r2376 | |
| 438 | 438 | state_save_register_global_pointer(st0016_charram, ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE); |
| 439 | 439 | state_save_register_global_pointer(st0016_paletteram, ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE); |
| 440 | 440 | state_save_register_global_pointer(st0016_spriteram, ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE); |
| 441 | state_save_register_ | |
| 441 | state_save_register_ | |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | |
| r2375 | r2376 | |
| 499 | 499 | |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | st0016_save_init(); | |
| 502 | st0016_save_init(machine); | |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | |
| r2375 | r2376 | |
| 670 | 670 | { |
| 671 | 671 | if(ISMACS1) |
| 672 | 672 | { |
| 673 | if(!( | |
| 673 | if(!( | |
| 674 | 674 | { |
| 675 | 675 | macs_ram2[0]++; |
| 676 | 676 | } |
| r2375 | r2376 | |
|---|---|---|
| 40 | 40 | |
| 41 | 41 | cur_alpha = 0; |
| 42 | 42 | |
| 43 | K053251_vh_start(); | |
| 43 | K053251_vh_start(machine); | |
| 44 | 44 | K054338_vh_start(); |
| 45 | 45 | K053250_vh_start(1, ®ion); |
| 46 | 46 |
| r2375 | r2376 | |
|---|---|---|
| 1443 | 1443 | * Stop drawing if exceeded 32 objects and |
| 1444 | 1444 | * enforcing that limit is enabled */ |
| 1445 | 1445 | range_over++; |
| 1446 | if( range_over == 32 ) //&& ( | |
| 1446 | if( range_over == 32 ) //&& ( | |
| 1447 | 1447 | { |
| 1448 | 1448 | /* Set the flag in STAT77 register */ |
| 1449 | 1449 | snes_ram[STAT77] |= 0x40; |
| r2375 | r2376 | |
| 1984 | 1984 | |
| 1985 | 1985 | if( !debug_options.input_count-- ) |
| 1986 | 1986 | { |
| 1987 | UINT8 toggles = | |
| 1987 | UINT8 toggles = | |
| 1988 | 1988 | if( toggles & 0x1 ) |
| 1989 | 1989 | debug_options.bg_disabled[0] = !debug_options.bg_disabled[0]; |
| 1990 | 1990 | if( toggles & 0x2 ) |
| r2375 | r2376 | |
| 2001 | 2001 | debug_options.bg_disabled[5] = !debug_options.bg_disabled[5]; |
| 2002 | 2002 | if( toggles & 0x80 ) |
| 2003 | 2003 | debug_options.windows_disabled = !debug_options.windows_disabled; |
| 2004 | toggles = | |
| 2004 | toggles = | |
| 2005 | 2005 | if( toggles & 0x4 ) |
| 2006 | 2006 | debug_options.transparency_disabled = !debug_options.transparency_disabled; |
| 2007 | 2007 | debug_options.input_count = 5; |
| r2375 | r2376 | |
| 2111 | 2111 | } |
| 2112 | 2112 | /* Just for testing, draw as many tiles as possible */ |
| 2113 | 2113 | { |
| 2114 | UINT8 adjust = readinputport( 1 ); | |
| 2115 | UINT8 dip = readinputport( 9 ); | |
| 2116 | UINT8 inp = readinputport( 11 ); | |
| 2114 | UINT8 adjust = input_port_read_indexed(machine, 1 ); | |
| 2115 | UINT8 dip = input_port_read_indexed(machine, 9 ); | |
| 2116 | UINT8 inp = input_port_read_indexed(machine, 11 ); | |
| 2117 | 2117 | UINT8 dt = 1 << ((dip & 0x3) - 1); |
| 2118 | 2118 | UINT8 dm = 1 << (((dip & 0xc) >> 2) - 1); |
| 2119 | 2119 | if( dt ) |
| r2375 | r2376 | |
|---|---|---|
| 243 | 243 | |
| 244 | 244 | VIDEO_UPDATE( spacewar ) |
| 245 | 245 | { |
| 246 | int sw_option = | |
| 246 | int sw_option = | |
| 247 | 247 | |
| 248 | 248 | VIDEO_UPDATE_CALL(cinemat); |
| 249 | 249 |
| r2375 | r2376 | |
|---|---|---|
| 183 | 183 | |
| 184 | 184 | and allows the shift to be handled using two buttons */ |
| 185 | 185 | |
| 186 | static int read_shift( | |
| 186 | static int read_shift(running_machine *machine) | |
| 187 | 187 | { |
| 188 | 188 | static int ret = 1; /* start with low shift */ |
| 189 | switch ( ( | |
| 189 | switch ( ( | |
| 190 | 190 | { |
| 191 | 191 | case 1 : ret = 1; break; // low shift: button 3 |
| 192 | 192 | case 2 : ret = 0; break; // high shift: button 4 |
| r2375 | r2376 | |
| 204 | 204 | We support just 2 values for now.. |
| 205 | 205 | */ |
| 206 | 206 | |
| 207 | static int read_accelerator( | |
| 207 | static int read_accelerator(running_machine *machine) | |
| 208 | 208 | { |
| 209 | if ( | |
| 209 | if ( | |
| 210 | 210 | else return 0xff; |
| 211 | 211 | } |
| 212 | 212 | |
| r2375 | r2376 | |
| 219 | 219 | { |
| 220 | 220 | switch (offset) |
| 221 | 221 | { |
| 222 | case 0x0000/2 : return readinputport(1); // Coins | |
| 223 | case 0x0002/2 : return readinputport(2) + | |
| 224 | (read_shift()<<1); // Buttons | |
| 225 | case 0x0004/2 : return readinputport(3); // Motor Limit Switches | |
| 226 | case 0x0006/2 : return readinputport(4); // DSW 1 & 2 | |
| 222 | case 0x0000/2 : return input_port_read_indexed(machine, 1); // Coins | |
| 223 | case 0x0002/2 : return input_port_read_indexed(machine, 2) + | |
| 224 | (read_shift(machine)<<1); // Buttons | |
| 225 | case 0x0004/2 : return input_port_read_indexed(machine, 3); // Motor Limit Switches | |
| 226 | case 0x0006/2 : return input_port_read_indexed(machine, 4); // DSW 1 & 2 | |
| 227 | 227 | |
| 228 | 228 | case 0x0008/2 : return soundlatch2_word_r(machine,0,0); // From sound cpu |
| 229 | 229 | |
| 230 | 230 | case 0x0010/2 : |
| 231 | 231 | switch (cischeat_ip_select & 0x3) |
| 232 | 232 | { |
| 233 | case 0 : return | |
| 233 | case 0 : return | |
| 234 | 234 | case 1 : return 0xffff; // Cockpit: Up / Down Position |
| 235 | 235 | case 2 : return 0xffff; // Cockpit: Left / Right Position? |
| 236 | case 3 : return ~read_accelerator(); // Accelerator (Pedal) | |
| 236 | case 3 : return ~read_accelerator(machine); // Accelerator (Pedal) | |
| 237 | 237 | default: return 0xffff; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | |
| 241 | case 0x2200/2 : return | |
| 241 | case 0x2200/2 : return | |
| 242 | 242 | |
| 243 | 243 | default: SHOW_READ_ERROR("vreg %04X read!",offset*2); |
| 244 | 244 | return megasys1_vregs[offset]; |
| r2375 | r2376 | |
| 316 | 316 | { |
| 317 | 317 | switch (offset) |
| 318 | 318 | { |
| 319 | case 0x0000/2 : return readinputport(1); // Coins | |
| 320 | case 0x0002/2 : return readinputport(2) + | |
| 321 | (read_shift()<<1); // Buttons | |
| 322 | case 0x0004/2 : return readinputport(3); // Motor Limit Switches | |
| 323 | case 0x0006/2 : return readinputport(4); // DSW 1 & 2 | |
| 319 | case 0x0000/2 : return input_port_read_indexed(machine, 1); // Coins | |
| 320 | case 0x0002/2 : return input_port_read_indexed(machine, 2) + | |
| 321 | (read_shift(machine)<<1); // Buttons | |
| 322 | case 0x0004/2 : return input_port_read_indexed(machine, 3); // Motor Limit Switches | |
| 323 | case 0x0006/2 : return input_port_read_indexed(machine, 4); // DSW 1 & 2 | |
| 324 | 324 | |
| 325 | 325 | case 0x0010/2 : |
| 326 | 326 | switch (cischeat_ip_select & 0x3) |
| 327 | 327 | { |
| 328 | case 0 : return | |
| 328 | case 0 : return | |
| 329 | 329 | case 1 : return ~0; // Cockpit: Up / Down Position? |
| 330 | 330 | case 2 : return ~0; // Cockpit: Left / Right Position? |
| 331 | 331 | default: return ~0; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | case 0x2200/2 : return | |
| 334 | case 0x2200/2 : return | |
| 335 | 335 | case 0x2300/2 : return soundlatch2_r(machine,0); // From sound cpu |
| 336 | 336 | |
| 337 | 337 | default: SHOW_READ_ERROR("vreg %04X read!",offset*2); |
| r2375 | r2376 | |
| 412 | 412 | { |
| 413 | 413 | case 0x0000/2 : // DSW 1&2: coinage changes with Country |
| 414 | 414 | { |
| 415 | int val = readinputport(1); | |
| 416 | if (val & 0x0200) return readinputport(6) | val; // JP, US | |
| 417 | else return readinputport(7) | val; // UK, FR | |
| 415 | int val = input_port_read_indexed(machine, 1); | |
| 416 | if (val & 0x0200) return input_port_read_indexed(machine, 6) | val; // JP, US | |
| 417 | else return input_port_read_indexed(machine, 7) | val; // UK, FR | |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // case 0x0002/2 : return 0xFFFF; |
| 421 | case 0x0004/2 : return readinputport(2) + | |
| 422 | (read_shift()<<5); // Buttons | |
| 421 | case 0x0004/2 : return input_port_read_indexed(machine, 2) + | |
| 422 | (read_shift(machine)<<5); // Buttons | |
| 423 | 423 | |
| 424 | case 0x0006/2 : return | |
| 424 | case 0x0006/2 : return | |
| 425 | 425 | case 0x0008/2 : return soundlatch2_r(machine,0); // From sound cpu |
| 426 | 426 | |
| 427 | case 0x000c/2 : return | |
| 427 | case 0x000c/2 : return | |
| 428 | 428 | |
| 429 | 429 | case 0x0010/2 : // Accel + Driving Wheel |
| 430 | return (read_accelerator()&0xff) + (( | |
| 430 | return (read_accelerator(machine)&0xff) + (( | |
| 431 | 431 | |
| 432 | 432 | default: SHOW_READ_ERROR("vreg %04X read!",offset*2); |
| 433 | 433 | return megasys1_vregs[offset]; |
| r2375 | r2376 | |
| 460 | 460 | |
| 461 | 461 | switch (offset) |
| 462 | 462 | { |
| 463 | case 0x0000/2 : return | |
| 463 | case 0x0000/2 : return | |
| 464 | 464 | |
| 465 | case 0x0004/2 : return | |
| 465 | case 0x0004/2 : return | |
| 466 | 466 | |
| 467 | 467 | case 0x0008/2 : return soundlatch2_r(machine,0); // From sound cpu |
| 468 | 468 | |
| 469 | 469 | case 0x0010/2 : // X, Y |
| 470 | return | |
| 470 | return | |
| 471 | 471 | |
| 472 | 472 | case 0x0018/2 : |
| 473 | 473 | return (f1gpstr2_ioready[0]&1) ? 0xff : 0xf0; |
| r2375 | r2376 | |
|---|---|---|
| 141 | 141 | |
| 142 | 142 | VIDEO_UPDATE( vicdual_bw_or_color ) |
| 143 | 143 | { |
| 144 | if (vicdual_is_cabinet_color()) | |
| 144 | if (vicdual_is_cabinet_color(screen->machine)) | |
| 145 | 145 | VIDEO_UPDATE_CALL(vicdual_color); |
| 146 | 146 | else |
| 147 | 147 | VIDEO_UPDATE_CALL(vicdual_bw); |
| r2375 | r2376 | |
|---|---|---|
| 103 | 103 | bg_tilemap = tilemap_create(warlords_get_tile_info, tilemap_scan_rows, 8,8, 32,32); |
| 104 | 104 | |
| 105 | 105 | /* we overload centiped_flipscreen here to track the cocktail/upright state */ |
| 106 | centiped_flipscreen = | |
| 106 | centiped_flipscreen = | |
| 107 | 107 | tilemap_set_flip(bg_tilemap, centiped_flipscreen ? TILEMAP_FLIPX : 0); |
| 108 | 108 | } |
| 109 | 109 | |
| r2375 | r2376 | |
| 443 | 443 | |
| 444 | 444 | VIDEO_UPDATE( warlords ) |
| 445 | 445 | { |
| 446 | int upright_mode = | |
| 446 | int upright_mode = | |
| 447 | 447 | int offs; |
| 448 | 448 | |
| 449 | 449 | /* if the cocktail/upright switch flipped, force refresh */ |
| r2375 | r2376 | |
|---|---|---|
| 46 | 46 | common_get_piv_tile_info(machine,tileinfo,tile_index,2); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | static void dirty_piv_tilemaps(void) | |
| 50 | { | |
| 51 | tilemap_mark_all_tiles_dirty(wgp_piv_tilemap[0]); | |
| 52 | tilemap_mark_all_tiles_dirty(wgp_piv_tilemap[1]); | |
| 53 | tilemap_mark_all_tiles_dirty(wgp_piv_tilemap[2]); | |
| 54 | } | |
| 55 | 49 | |
| 56 | ||
| 57 | 50 | static void wgp_core_vh_start(running_machine *machine, int x_offs,int y_offs,int piv_xoffs,int piv_yoffs) |
| 58 | 51 | { |
| 59 | 52 | wgp_piv_tilemap[0] = tilemap_create(get_piv0_tile_info,tilemap_scan_rows,16,16,64,64); |
| r2375 | r2376 | |
| 63 | 56 | TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,x_offs,y_offs,0,0,0,0,0); |
| 64 | 57 | |
| 65 | 58 | if (has_TC0110PCR()) |
| 66 | TC0110PCR_vh_start(); | |
| 59 | TC0110PCR_vh_start(machine); | |
| 67 | 60 | |
| 68 | 61 | wgp_piv_xoffs = piv_xoffs; |
| 69 | 62 | wgp_piv_yoffs = piv_yoffs; |
| r2375 | r2376 | |
| 84 | 77 | applies rowscroll manually */ |
| 85 | 78 | |
| 86 | 79 | TC0100SCN_set_colbanks(0x80,0xc0,0x40); |
| 87 | ||
| 88 | /* colors from saved states are often screwy (and this doesn't help...) */ | |
| 89 | state_save_register_func_postload(dirty_piv_tilemaps); | |
| 90 | 80 | } |
| 91 | 81 | |
| 92 | 82 | VIDEO_START( wgp ) |
| r2375 | r2376 | |
|---|---|---|
| 395 | 395 | free(dst); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | static void mark_all_tiles_dirty(void) | |
| 399 | { | |
| 400 | tilemap_mark_all_tiles_dirty(tx_tilemap); | |
| 401 | tilemap_mark_all_tiles_dirty(bg1_tilemap); | |
| 402 | tilemap_mark_all_tiles_dirty(bg2_tilemap); | |
| 403 | } | |
| 404 | ||
| 405 | 398 | VIDEO_START( tceptor ) |
| 406 | 399 | { |
| 407 | 400 | int gfx_index; |
| r2375 | r2376 | |
| 445 | 438 | state_save_register_global(bg1_scroll_y); |
| 446 | 439 | state_save_register_global(bg2_scroll_x); |
| 447 | 440 | state_save_register_global(bg2_scroll_y); |
| 448 | ||
| 449 | state_save_register_func_postload(mark_all_tiles_dirty); | |
| 450 | 441 | } |
| 451 | 442 | |
| 452 | 443 |
| r2375 | r2376 | |
|---|---|---|
| 44 | 44 | |
| 45 | 45 | VIDEO_START( surpratk ) |
| 46 | 46 | { |
| 47 | K053251_vh_start(); | |
| 47 | K053251_vh_start(machine); | |
| 48 | 48 | |
| 49 | 49 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tile_callback); |
| 50 | 50 | K053245_vh_start(machine,0,REGION_GFX2,NORMAL_PLANE_ORDER,sprite_callback); |
| r2375 | r2376 | |
|---|---|---|
| 29 | 29 | #define VERBOSE 0 |
| 30 | 30 | |
| 31 | 31 | static void gtia_reset(running_machine *machine); |
| 32 | static void gtia_state(void); | |
| 33 | static void gtia_state_postload(void); | |
| 32 | static void gtia_state(running_machine *machine); | |
| 33 | static STATE_POSTLOAD( gtia_state_postload ); | |
| 34 | 34 | |
| 35 | 35 | /********************************************** |
| 36 | 36 | * split a color into hue and luminance values |
| r2375 | r2376 | |
| 64 | 64 | * |
| 65 | 65 | *************************************/ |
| 66 | 66 | |
| 67 | void gtia_init(const gtia_interface *intf) | |
| 67 | void gtia_init(running_machine *machine, const gtia_interface *intf) | |
| 68 | 68 | { |
| 69 | 69 | memset(>ia, 0, sizeof(gtia)); |
| 70 | 70 | gtia.intf = *intf; |
| r2375 | r2376 | |
| 72 | 72 | add_reset_callback(Machine, gtia_reset); |
| 73 | 73 | |
| 74 | 74 | /* state saves */ |
| 75 | gtia_state(); | |
| 75 | gtia_state(machine); | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | |
| 80 | static void gtia_state( | |
| 80 | static void gtia_state(running_machine *machine) | |
| 81 | 81 | { |
| 82 | 82 | state_save_register_global(gtia.r.m0pf); |
| 83 | 83 | state_save_register_global(gtia.r.m1pf); |
| r2375 | r2376 | |
| 140 | 140 | state_save_register_global(gtia.w.gractl); |
| 141 | 141 | state_save_register_global(gtia.w.hitclr); |
| 142 | 142 | state_save_register_global(gtia.w.cons); |
| 143 | state_save_register_ | |
| 143 | state_save_register_ | |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | |
| r2375 | r2376 | |
| 758 | 758 | |
| 759 | 759 | |
| 760 | 760 | |
| 761 | static | |
| 761 | static STATE_POSTLOAD( gtia_state_postload | |
| 762 | 762 | { |
| 763 | 763 | recalc_p0(); |
| 764 | 764 | recalc_p1(); |
| r2375 | r2376 | |
|---|---|---|
| 138 | 138 | |
| 139 | 139 | extern gtia_struct gtia; |
| 140 | 140 | |
| 141 | void gtia_init(const gtia_interface *intf); | |
| 141 | void gtia_init(running_machine *machine, const gtia_interface *intf); | |
| 142 | 142 | READ8_HANDLER( atari_gtia_r ); |
| 143 | 143 | WRITE8_HANDLER( atari_gtia_w ); |
| 144 | 144 |
| r2375 | r2376 | |
|---|---|---|
| 279 | 279 | WRITE8_HANDLER( m52_flipscreen_w ) |
| 280 | 280 | { |
| 281 | 281 | /* screen flip is handled both by software and hardware */ |
| 282 | flip_screen_set((data & 0x01) ^ (~ | |
| 282 | flip_screen_set((data & 0x01) ^ (~ | |
| 283 | 283 | |
| 284 | 284 | coin_counter_w(0, data & 0x02); |
| 285 | 285 | coin_counter_w(1, data & 0x20); |
| r2375 | r2376 | |
|---|---|---|
| 242 | 242 | { |
| 243 | 243 | /* use an overlay only in upright mode */ |
| 244 | 244 | if (geebee_handleoverlay) |
| 245 | output_set_value("overlay", ( | |
| 245 | output_set_value("overlay", ( | |
| 246 | 246 | |
| 247 | 247 | tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); |
| 248 | 248 |
| r2375 | r2376 | |
|---|---|---|
| 241 | 241 | |
| 242 | 242 | int width = visarea->max_x + 1 - visarea->min_x; |
| 243 | 243 | int height = visarea->max_y + 1 - visarea->min_y; |
| 244 | *x = visarea->min_x + (((readinputport(3 + player * 2) & 0xff) * width) >> 8); | |
| 245 | *y = visarea->min_y + (((readinputport(4 + player * 2) & 0xff) * height) >> 8); | |
| 244 | *x = visarea->min_x + (((input_port_read_indexed(machine, 3 + player * 2) & 0xff) * width) >> 8); | |
| 245 | *y = visarea->min_y + (((input_port_read_indexed(machine, 4 + player * 2) & 0xff) * height) >> 8); | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | |
| r2375 | r2376 | |
| 741 | 741 | return (beamy << 16) | (beamx ^ 0x1ff); |
| 742 | 742 | |
| 743 | 743 | case 2: |
| 744 | return | |
| 744 | return | |
| 745 | 745 | } |
| 746 | 746 | return 0; |
| 747 | 747 | } |
| r2375 | r2376 | |
| 802 | 802 | } while (!adjust_object_timer(machine, vc)); |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | static STATE_POSTLOAD( cojag_postload ) | |
| 806 | { | |
| 807 | update_cpu_irq(); | |
| 808 | } | |
| 805 | 809 | |
| 806 | 810 | VIDEO_START( cojag ) |
| 807 | 811 | { |
| r2375 | r2376 | |
| 818 | 822 | state_save_register_global_array(blitter_regs); |
| 819 | 823 | state_save_register_global_array(gpu_regs); |
| 820 | 824 | state_save_register_global(cpu_irq_state); |
| 821 | state_save_register_ | |
| 825 | state_save_register_ | |
| 822 | 826 | } |
| 823 | 827 | |
| 824 | 828 |
| r2375 | r2376 | |
|---|---|---|
| 269 | 269 | |
| 270 | 270 | VIDEO_UPDATE( helifire ) |
| 271 | 271 | { |
| 272 | int SUN_BRIGHTNESS = readinputport(4); | |
| 273 | int SEA_BRIGHTNESS = readinputport(5); | |
| 272 | int SUN_BRIGHTNESS = input_port_read_indexed(screen->machine, 4); | |
| 273 | int SEA_BRIGHTNESS = input_port_read_indexed(screen->machine, 5); | |
| 274 | 274 | |
| 275 | 275 | static const int wave[8] = { 0, 1, 2, 2, 2, 1, 0, 0 }; |
| 276 | 276 |
| r2375 | r2376 | |
|---|---|---|
| 274 | 274 | * |
| 275 | 275 | *************************************/ |
| 276 | 276 | |
| 277 | static void turbo_prepare_sprites(turbo_state *state, UINT8 y, sprite_info *info) | |
| 277 | static void turbo_prepare_sprites(running_machine *machine, turbo_state *state, UINT8 y, sprite_info *info) | |
| 278 | 278 | { |
| 279 | 279 | const UINT8 *pr1119 = memory_region(REGION_PROMS) + 0x200; |
| 280 | 280 | int sprnum; |
| r2375 | r2376 | |
| 334 | 334 | VR1 = 310 Ohm |
| 335 | 335 | VR2 = 910 Ohm |
| 336 | 336 | */ |
| 337 | info->step[level] = sprite_xscale(xscale, 1.0e3 * | |
| 337 | info->step[level] = sprite_xscale(xscale, 1.0e3 * | |
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | } |
| r2375 | r2376 | |
| 428 | 428 | |
| 429 | 429 | /* compute the sprite information; we use y-1 since this info was computed during HBLANK */ |
| 430 | 430 | /* on the previous scanline */ |
| 431 | turbo_prepare_sprites(state, y, &sprinfo); | |
| 431 | turbo_prepare_sprites(screen->machine, state, y, &sprinfo); | |
| 432 | 432 | |
| 433 | 433 | /* loop over columns */ |
| 434 | 434 | for (x = 0; x <= cliprect->max_x; x += TURBO_X_SCALE) |
| r2375 | r2376 | |
|---|---|---|
| 16 | 16 | TC0100SCN_vh_start(machine,chips,TC0100SCN_GFX_NUM,x_offs,0,0,0,0,0,multiscrn_xoffs); |
| 17 | 17 | |
| 18 | 18 | if (has_TC0110PCR()) |
| 19 | TC0110PCR_vh_start(); | |
| 19 | TC0110PCR_vh_start(machine); | |
| 20 | 20 | |
| 21 | 21 | if (has_second_TC0110PCR()) |
| 22 | TC0110PCR_1_vh_start(); | |
| 22 | TC0110PCR_1_vh_start(machine); | |
| 23 | 23 | |
| 24 | 24 | /* Ensure palette from correct TC0110PCR used for each screen */ |
| 25 | 25 | TC0100SCN_set_chip_colbanks(0,0x100,0x0); |
| r2375 | r2376 | |
|---|---|---|
| 295 | 295 | WRITE8_HANDLER( m62_flipscreen_w ) |
| 296 | 296 | { |
| 297 | 297 | /* screen flip is handled both by software and hardware */ |
| 298 | data ^= ~ | |
| 298 | data ^= ~ | |
| 299 | 299 | |
| 300 | 300 | flipscreen = data & 0x01; |
| 301 | 301 | if (flipscreen) |
| r2375 | r2376 | |
|---|---|---|
| 532 | 532 | break; |
| 533 | 533 | |
| 534 | 534 | case 0x10: /* player 1 handle */ |
| 535 | result = | |
| 535 | result = | |
| 536 | 536 | break; |
| 537 | 537 | |
| 538 | 538 | case 0x11: /* player 2 handle */ |
| 539 | result = | |
| 539 | result = | |
| 540 | 540 | break; |
| 541 | 541 | |
| 542 | 542 | case 0x12: /* player 3 handle */ |
| 543 | result = | |
| 543 | result = | |
| 544 | 544 | break; |
| 545 | 545 | |
| 546 | 546 | case 0x13: /* player 4 handle */ |
| 547 | result = | |
| 547 | result = | |
| 548 | 548 | break; |
| 549 | 549 | |
| 550 | 550 | case 0x14: /* keypad column 0 */ |
| 551 | result = | |
| 551 | result = | |
| 552 | 552 | break; |
| 553 | 553 | |
| 554 | 554 | case 0x15: /* keypad column 1 */ |
| 555 | result = | |
| 555 | result = | |
| 556 | 556 | break; |
| 557 | 557 | |
| 558 | 558 | case 0x16: /* keypad column 2 */ |
| 559 | result = | |
| 559 | result = | |
| 560 | 560 | break; |
| 561 | 561 | |
| 562 | 562 | case 0x17: /* keypad column 3 */ |
| 563 | result = | |
| 563 | result = | |
| 564 | 564 | break; |
| 565 | 565 | |
| 566 | 566 | case 0x1c: /* player 1 knob */ |
| 567 | result = | |
| 567 | result = | |
| 568 | 568 | break; |
| 569 | 569 | |
| 570 | 570 | case 0x1d: /* player 2 knob */ |
| 571 | result = | |
| 571 | result = | |
| 572 | 572 | break; |
| 573 | 573 | |
| 574 | 574 | case 0x1e: /* player 3 knob */ |
| 575 | result = | |
| 575 | result = | |
| 576 | 576 | break; |
| 577 | 577 | |
| 578 | 578 | case 0x1f: /* player 4 knob */ |
| 579 | result = | |
| 579 | result = | |
| 580 | 580 | break; |
| 581 | 581 | } |
| 582 | 582 | |
| r2375 | r2376 | |
| 727 | 727 | /* OR/XOR */ |
| 728 | 728 | if (funcgen_control & 0x30) |
| 729 | 729 | { |
| 730 | UINT8 olddata = program_read_byte | |
| 730 | UINT8 olddata = program_read_byte | |
| 731 | 731 | |
| 732 | 732 | /* compute any intercepts */ |
| 733 | 733 | funcgen_intercept &= 0x0f; |
| r2375 | r2376 | |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | /* write the result */ |
| 751 | program_write_byte | |
| 751 | program_write_byte | |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | |
| r2375 | r2376 | |
| 842 | 842 | if (curwidth == 0 && (pattern_mode & 0x08) != 0) |
| 843 | 843 | busdata = 0; |
| 844 | 844 | else |
| 845 | busdata = program_read_byte | |
| 845 | busdata = program_read_byte | |
| 846 | 846 | |
| 847 | 847 | /* increment the appropriate address */ |
| 848 | 848 | if ((pattern_mode & 0x01) == 0) |
| r2375 | r2376 | |
| 854 | 854 | |
| 855 | 855 | /* address is selected between source/dest based on mode.d0 */ |
| 856 | 856 | busaddr = ((pattern_mode & 0x01) != 0) ? pattern_source : pattern_dest; |
| 857 | program_write_byte | |
| 857 | program_write_byte | |
| 858 | 858 | |
| 859 | 859 | /* increment the appropriate address */ |
| 860 | 860 | if ((pattern_mode & 0x01) == 0) |
| r2375 | r2376 | |
|---|---|---|
| 62 | 62 | 0); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | static void all_tiles_dirty(void) | |
| 66 | { | |
| 67 | tilemap_mark_all_tiles_dirty(bg_tilemap); | |
| 68 | tilemap_mark_all_tiles_dirty(fg_tilemap); | |
| 69 | } | |
| 70 | ||
| 71 | 65 | VIDEO_START( renegade ) |
| 72 | 66 | { |
| 73 | 67 | bg_tilemap = tilemap_create(get_bg_tilemap_info, tilemap_scan_rows, 16, 16, 64, 16); |
| r2375 | r2376 | |
| 77 | 71 | tilemap_set_scrolldx(bg_tilemap, 256, 0); |
| 78 | 72 | |
| 79 | 73 | state_save_register_global(renegade_scrollx); |
| 80 | state_save_register_func_postload(all_tiles_dirty); | |
| 81 | 74 | } |
| 82 | 75 | |
| 83 | 76 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| r2375 | r2376 | |
|---|---|---|
| 171 | 171 | switch(offset) |
| 172 | 172 | { |
| 173 | 173 | case 0x00: |
| 174 | val = input_port_ | |
| 174 | val = input_port_ | |
| 175 | 175 | break; |
| 176 | 176 | case 0x01: |
| 177 | val = input_port_ | |
| 177 | val = input_port_ | |
| 178 | 178 | break; |
| 179 | 179 | case 0x02: |
| 180 | val = input_port_ | |
| 180 | val = input_port_ | |
| 181 | 181 | break; |
| 182 | 182 | case 0x03: |
| 183 | val = input_port_ | |
| 183 | val = input_port_ | |
| 184 | 184 | break; |
| 185 | 185 | case 0x04: |
| 186 | val = input_port_ | |
| 186 | val = input_port_ | |
| 187 | 187 | break; |
| 188 | 188 | default: |
| 189 | 189 | val = ps5_io_ram[offset]; |
| r2375 | r2376 | |
|---|---|---|
| 29 | 29 | TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,4,0,0,0,0,0,0); |
| 30 | 30 | |
| 31 | 31 | if (has_TC0110PCR()) |
| 32 | TC0110PCR_vh_start(); | |
| 32 | TC0110PCR_vh_start(machine); | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 |
| r2375 | r2376 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | void c8080bw_flip_screen_w(int data) | |
| 27 | void c8080bw_flip_screen_w(running_machine *machine, int data) | |
| 28 | 28 | { |
| 29 | 29 | color_map = data; |
| 30 | c8080bw_flip_screen = data && ( | |
| 30 | c8080bw_flip_screen = data && ( | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 |
| r2375 | r2376 | |
|---|---|---|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | |
| 157 | static | |
| 157 | static STATE_POSTLOAD( taitosj_postload | |
| 158 | 158 | { |
| 159 | 159 | memset(dirtycharacter1, 1, sizeof(dirtycharacter1)); |
| 160 | 160 | memset(dirtycharacter2, 1, sizeof(dirtycharacter2)); |
| r2375 | r2376 | |
| 221 | 221 | |
| 222 | 222 | compute_draw_order(); |
| 223 | 223 | |
| 224 | state_save_register_ | |
| 224 | state_save_register_ | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 |
| r2375 | r2376 | |
|---|---|---|
| 91 | 91 | draw_bombs(bitmap, cliprect); |
| 92 | 92 | |
| 93 | 93 | /* watchdog is disabled during service mode */ |
| 94 | watchdog_enable(screen->machine, !( | |
| 94 | watchdog_enable(screen->machine, !( | |
| 95 | 95 | |
| 96 | 96 | return 0; |
| 97 | 97 | } |
| r2375 | r2376 | |
|---|---|---|
| 446 | 446 | { |
| 447 | 447 | int i; |
| 448 | 448 | |
| 449 | int beamx = ((readinputport(4) & 0xff) * (HBSTART - HBEND)) >> 8; | |
| 450 | int beamy = ((readinputport(5) & 0xff) * (VBSTART - VBEND)) >> 8; | |
| 449 | int beamx = ((input_port_read_indexed(screen->machine, 4) & 0xff) * (HBSTART - HBEND)) >> 8; | |
| 450 | int beamy = ((input_port_read_indexed(screen->machine, 5) & 0xff) * (VBSTART - VBEND)) >> 8; | |
| 451 | 451 | |
| 452 | 452 | /* The timing of this FIRQ is very important. The games look for an FIRQ |
| 453 | 453 | and then wait about 650 cycles, clear the old FIRQ, and wait a |
| r2375 | r2376 | |
|---|---|---|
| 1969 | 1969 | static TILE_GET_INFO( K052109_get_tile_info2 ) { K052109_get_tile_info(machine,tileinfo,tile_index,2,K052109_colorram_B,K052109_videoram_B,K052109_videoram2_B); } |
| 1970 | 1970 | |
| 1971 | 1971 | |
| 1972 | static | |
| 1972 | static STATE_POSTLOAD( K052109_tileflip_reset | |
| 1973 | 1973 | { |
| 1974 | 1974 | int data = K052109_ram[0x1e80]; |
| 1975 | 1975 | tilemap_set_flip(K052109_tilemap[0],(data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); |
| r2375 | r2376 | |
| 2079 | 2079 | state_save_register_global_array(K052109_dy); |
| 2080 | 2080 | state_save_register_global(has_extra_video_ram); |
| 2081 | 2081 | |
| 2082 | state_save_register_ | |
| 2082 | state_save_register_ | |
| 2083 | 2083 | } |
| 2084 | 2084 | |
| 2085 | 2085 | READ8_HANDLER( K052109_r ) |
| r2375 | r2376 | |
| 5077 | 5077 | static tilemap *K053251_tilemaps[5]; |
| 5078 | 5078 | static int K053251_tilemaps_set; |
| 5079 | 5079 | |
| 5080 | static | |
| 5080 | static STATE_POSTLOAD( K053251_reset_indexes | |
| 5081 | 5081 | { |
| 5082 | 5082 | K053251_palette_index[0] = 32 * ((K053251_ram[9] >> 0) & 0x03); |
| 5083 | 5083 | K053251_palette_index[1] = 32 * ((K053251_ram[9] >> 2) & 0x03); |
| r2375 | r2376 | |
| 5086 | 5086 | K053251_palette_index[4] = 16 * ((K053251_ram[10] >> 3) & 0x07); |
| 5087 | 5087 | } |
| 5088 | 5088 | |
| 5089 | void K053251_vh_start( | |
| 5089 | void K053251_vh_start(running_machine *machine) | |
| 5090 | 5090 | { |
| 5091 | 5091 | K053251_set_tilemaps(NULL,NULL,NULL,NULL,NULL); |
| 5092 | 5092 | |
| 5093 | 5093 | state_save_register_global_array(K053251_ram); |
| 5094 | state_save_register_ | |
| 5094 | state_save_register_ | |
| 5095 | 5095 | } |
| 5096 | 5096 | |
| 5097 | 5097 | void K053251_set_tilemaps(tilemap *ci0,tilemap *ci1,tilemap *ci2,tilemap *ci3,tilemap *ci4) |
| r2375 | r2376 | |
| 5615 | 5615 | K056832_change_rombank(); |
| 5616 | 5616 | } |
| 5617 | 5617 | |
| 5618 | static STATE_POSTLOAD( K056832_postload ) | |
| 5619 | { | |
| 5620 | K056832_UpdatePageLayout(); | |
| 5621 | K056832_change_rambank(); | |
| 5622 | K056832_change_rombank(); | |
| 5623 | } | |
| 5624 | ||
| 5618 | 5625 | void K056832_vh_start(running_machine *machine, int gfx_memory_region, int bpp, int big, |
| 5619 | 5626 | int (*scrolld)[4][2], |
| 5620 | 5627 | void (*callback)(int layer, int *code, int *color, int *flags), |
| r2375 | r2376 | |
| 5825 | 5832 | state_save_register_global_array(K056832_dy); |
| 5826 | 5833 | state_save_register_global_array(K056832_LayerTileMode); |
| 5827 | 5834 | |
| 5828 | state_save_register_func_postload(K056832_UpdatePageLayout); | |
| 5829 | state_save_register_func_postload(K056832_change_rambank); | |
| 5830 | state_save_register_func_postload(K056832_change_rombank); | |
| 5835 | state_save_register_postload(machine, K056832_postload, NULL); | |
| 5831 | 5836 | } |
| 5832 | 5837 | |
| 5833 | 5838 | /* call if a game uses external linescroll */ |
| r2375 | r2376 | |
|---|---|---|
| 241 | 241 | int K053251_get_priority(int ci); |
| 242 | 242 | int K053251_get_palette_index(int ci); |
| 243 | 243 | void K053251_set_tilemaps(tilemap *ci0,tilemap *ci1,tilemap *ci2,tilemap *ci3,tilemap *ci4); |
| 244 | void K053251_vh_start( | |
| 244 | void K053251_vh_start(running_machine *machine); | |
| 245 | 245 | |
| 246 | 246 | |
| 247 | 247 | WRITE8_HANDLER( K054000_w ); |
| r2375 | r2376 | |
|---|---|---|
| 346 | 346 | coin_counter_w(1,data & 0x02); |
| 347 | 347 | |
| 348 | 348 | /* bit 2 is flip screen (handled both by software and hardware) */ |
| 349 | flip_screen_set(((data & 0x04) >> 2) ^ ((~ | |
| 349 | flip_screen_set(((data & 0x04) >> 2) ^ ((~ | |
| 350 | 350 | |
| 351 | 351 | /* bit 3 is display disable */ |
| 352 | 352 | video_off = data & 0x08; |
| r2375 | r2376 | |
| 372 | 372 | coin_counter_w(1,data & 0x02); |
| 373 | 373 | |
| 374 | 374 | /* bit 2 is flip screen (handled both by software and hardware) */ |
| 375 | flip_screen_set(((data & 0x04) >> 2) ^ ((~ | |
| 375 | flip_screen_set(((data & 0x04) >> 2) ^ ((~ | |
| 376 | 376 | |
| 377 | 377 | /* bit 3 is display disable */ |
| 378 | 378 | video_off = data & 0x08; |
| r2375 | r2376 | |
|---|---|---|
| 253 | 253 | |
| 254 | 254 | static VIDEO_UPDATE( madalien ) |
| 255 | 255 | { |
| 256 | int flip = BIT( | |
| 256 | int flip = BIT( | |
| 257 | 257 | |
| 258 | 258 | // bits #0 and #1 define scrolling mode |
| 259 | 259 | // |
| r2375 | r2376 | |
|---|---|---|
| 75 | 75 | |
| 76 | 76 | READ8_HANDLER( aeroboto_in0_r ) |
| 77 | 77 | { |
| 78 | return | |
| 78 | return | |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | WRITE8_HANDLER( aeroboto_3000_w ) |
| r2375 | r2376 | |
|---|---|---|
| 76 | 76 | tilemap_set_transparent_pen(oneshot_fg_tilemap,0); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | static void draw_crosshairs( bitmap_t *bitmap, const rectangle *cliprect ) | |
| 79 | static void draw_crosshairs( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) | |
| 80 | 80 | { |
| 81 | 81 | int xpos,ypos; |
| 82 | 82 | /* get gun raw coordonates (player 1) */ |
| 83 | gun_x_p1 = (readinputport(5) & 0xff) * 320 / 256; | |
| 84 | gun_y_p1 = (readinputport(6) & 0xff) * 240 / 256; | |
| 83 | gun_x_p1 = (input_port_read_indexed(machine, 5) & 0xff) * 320 / 256; | |
| 84 | gun_y_p1 = (input_port_read_indexed(machine, 6) & 0xff) * 240 / 256; | |
| 85 | 85 | |
| 86 | 86 | /* compute the coordonates for drawing (from routine at 0x009ab0) */ |
| 87 | 87 | xpos = gun_x_p1; |
| r2375 | r2376 | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | /* get gun raw coordonates (player 2) */ |
| 98 | gun_x_p2 = (readinputport(7) & 0xff) * 320 / 256; | |
| 99 | gun_y_p2 = (readinputport(8) & 0xff) * 240 / 256; | |
| 98 | gun_x_p2 = (input_port_read_indexed(machine, 7) & 0xff) * 320 / 256; | |
| 99 | gun_y_p2 = (input_port_read_indexed(machine, 8) & 0xff) * 240 / 256; | |
| 100 | 100 | /* compute the coordonates for drawing (from routine at 0x009b6e) */ |
| 101 | 101 | xpos = gun_x_p2; |
| 102 | 102 | ypos = gun_y_p2; |
| r2375 | r2376 | |
| 177 | 177 | tilemap_draw(bitmap,cliprect,oneshot_mid_tilemap,0,0); |
| 178 | 178 | draw_sprites(screen->machine,bitmap,cliprect); |
| 179 | 179 | tilemap_draw(bitmap,cliprect,oneshot_fg_tilemap,0,0); |
| 180 | draw_crosshairs(bitmap,cliprect); | |
| 180 | draw_crosshairs(screen->machine,bitmap,cliprect); | |
| 181 | 181 | return 0; |
| 182 | 182 | } |
| 183 | 183 | |
| r2375 | r2376 | |
| 191 | 191 | tilemap_draw(bitmap,cliprect,oneshot_fg_tilemap,0,0); |
| 192 | 192 | tilemap_draw(bitmap,cliprect,oneshot_bg_tilemap,0,0); |
| 193 | 193 | draw_sprites(screen->machine,bitmap,cliprect); |
| 194 | // draw_crosshairs(bitmap,cliprect); // not a gun game | |
| 194 | // draw_crosshairs(screen->machine,bitmap,cliprect); // not a gun game | |
| 195 | 195 | |
| 196 | 196 | // popmessage ("%04x %04x %04x %04x %04x %04x %04x %04x", oneshot_scroll[0],oneshot_scroll[1],oneshot_scroll[2],oneshot_scroll[3],oneshot_scroll[4],oneshot_scroll[5],oneshot_scroll[6],oneshot_scroll[7]); |
| 197 | 197 | return 0; |
| r2375 | r2376 | |
|---|---|---|
| 9 | 9 | VIDEO_START( topspeed ) |
| 10 | 10 | { |
| 11 | 11 | /* (chips, gfxnum, x_offs, y_offs, y_invert, opaque, dblwidth) */ |
| 12 | PC080SN_vh_start(2,1,0,8,0,0,0); | |
| 12 | PC080SN_vh_start(machine,2,1,0,8,0,0,0); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 |
| r2375 | r2376 | |
|---|---|---|
| 51 | 51 | |
| 52 | 52 | VIDEO_START( overdriv ) |
| 53 | 53 | { |
| 54 | K053251_vh_start(); | |
| 54 | K053251_vh_start(machine); | |
| 55 | 55 | K051316_vh_start_0(machine,REGION_GFX2,4,TRUE,0,zoom_callback_0); |
| 56 | 56 | K051316_vh_start_1(machine,REGION_GFX3,4,FALSE,0,zoom_callback_1); |
| 57 | 57 | K053247_vh_start(machine, REGION_GFX1,77,22,NORMAL_PLANE_ORDER,overdriv_sprite_callback); |
| r2375 | r2376 | |
|---|---|---|
| 212 | 212 | mario_state *state = screen->machine->driver_data; |
| 213 | 213 | int t; |
| 214 | 214 | |
| 215 | t = | |
| 215 | t = | |
| 216 | 216 | if (t != state->monitor) |
| 217 | 217 | { |
| 218 | 218 | state->monitor = t; |
| r2375 | r2376 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | VIDEO_START( xmen ) |
| 50 | 50 | { |
| 51 | K053251_vh_start(); | |
| 51 | K053251_vh_start(machine); | |
| 52 | 52 | |
| 53 | 53 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,xmen_tile_callback); |
| 54 | 54 | K053247_vh_start(machine,REGION_GFX2,53,-2,NORMAL_PLANE_ORDER,xmen_sprite_callback); |
| r2375 | r2376 | |
| 60 | 60 | |
| 61 | 61 | VIDEO_START( xmen6p ) |
| 62 | 62 | { |
| 63 | K053251_vh_start(); | |
| 63 | K053251_vh_start(machine); | |
| 64 | 64 | |
| 65 | 65 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,xmen_tile_callback); |
| 66 | 66 | K053247_vh_start(machine,REGION_GFX2,53,-2,NORMAL_PLANE_ORDER,xmen_sprite_callback); |
| r2375 | r2376 | |
|---|---|---|
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "video/konamiic.h" |
| 12 | 12 | |
| 13 | #define GUNX( a ) ( ( readinputport( a ) * 287 ) / 0xff ) | |
| 14 | #define GUNY( a ) ( ( readinputport( a ) * 223 ) / 0xff ) | |
| 13 | #define GUNX( a ) ( ( input_port_read_indexed(machine, a ) * 287 ) / 0xff ) | |
| 14 | #define GUNY( a ) ( ( input_port_read_indexed(machine, a ) * 223 ) / 0xff ) | |
| 15 | 15 | |
| 16 | 16 | static int sprite_colorbase; |
| 17 | 17 | static int layer_colorbase[4]; |
| r2375 | r2376 | |
| 49 | 49 | { |
| 50 | 50 | int i; |
| 51 | 51 | |
| 52 | K053251_vh_start(); | |
| 52 | K053251_vh_start(machine); | |
| 53 | 53 | |
| 54 | 54 | K056832_vh_start(machine, REGION_GFX1, K056832_BPP_8LE, 1, NULL, lethalen_tile_callback, 0); |
| 55 | 55 |
| r2375 | r2376 | |
|---|---|---|
| 128 | 128 | pleiads_sound_control_c_w(machine,offset,data); |
| 129 | 129 | |
| 130 | 130 | naughtyb_cocktail = |
| 131 | ( ( input_port_ | |
| 131 | ( ( input_port_ | |
| 132 | 132 | ( data & 0x01 ) ); // handling player 2 |
| 133 | 133 | palreg = (data >> 1) & 0x03; // pallette sel is bit 1 & 2 |
| 134 | 134 | bankreg = (data >> 2) & 0x01; // banksel is just bit 2 |
| r2375 | r2376 | |
| 140 | 140 | pleiads_sound_control_c_w(machine,offset,data); |
| 141 | 141 | |
| 142 | 142 | naughtyb_cocktail = |
| 143 | ( ( input_port_ | |
| 143 | ( ( input_port_ | |
| 144 | 144 | ( data & 0x01 ) ); // handling player 2 |
| 145 | 145 | palreg = (data >> 1) & 0x03; // pallette sel is bit 1 & 2 |
| 146 | 146 | bankreg = (data >> 3) & 0x01; // banksel is just bit 3 |
| r2375 | r2376 | |
|---|---|---|
| 111 | 111 | UINT8 *TEXT_COLOR = memory_region( REGION_PROMS ); |
| 112 | 112 | |
| 113 | 113 | |
| 114 | flip = momoko_flipscreen ^ ( | |
| 114 | flip = momoko_flipscreen ^ ( | |
| 115 | 115 | |
| 116 | 116 | /* draw BG layer */ |
| 117 | 117 |
| r2375 | r2376 | |
|---|---|---|
| 24 | 24 | TC0150ROD_vh_start(); |
| 25 | 25 | |
| 26 | 26 | if (has_TC0110PCR()) |
| 27 | TC0110PCR_vh_start(); | |
| 27 | TC0110PCR_vh_start(machine); | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | VIDEO_START( taitoz ) |
| r2375 | r2376 | |
|---|---|---|
| 234 | 234 | videoram_pg_index = data & 1; |
| 235 | 235 | memory_set_bank(1, videoram_pg_index); |
| 236 | 236 | |
| 237 | cocktail_mode = videoram_pg_index && (input_port_ | |
| 237 | cocktail_mode = videoram_pg_index && (input_port_ | |
| 238 | 238 | |
| 239 | 239 | tilemap_set_flip(ALL_TILEMAPS, cocktail_mode ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); |
| 240 | 240 | tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); |
| r2375 | r2376 | |
| 257 | 257 | videoram_pg_index = data & 1; |
| 258 | 258 | memory_set_bank(1, videoram_pg_index); |
| 259 | 259 | |
| 260 | cocktail_mode = videoram_pg_index && (input_port_ | |
| 260 | cocktail_mode = videoram_pg_index && (input_port_ | |
| 261 | 261 | |
| 262 | 262 | tilemap_set_flip(ALL_TILEMAPS, cocktail_mode ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); |
| 263 | 263 | tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); |
| r2375 | r2376 | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | |
| 293 | ||
| 293 | CUSTOM_I | |
| 294 | 294 | { |
| 295 | 295 | if (cocktail_mode) |
| 296 | return ( | |
| 296 | return ( | |
| 297 | 297 | else |
| 298 | return | |
| 298 | return ( | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | ||
| 301 | CUSTOM_I | |
| 302 | 302 | { |
| 303 | int ret = readinputportbytag("IN0") & 0xf7; | |
| 304 | ||
| 305 | 303 | /* handle Pleiads protection */ |
| 306 | 304 | switch (pleiads_protection_question) |
| 307 | 305 | { |
| 308 | 306 | case 0x00: |
| 309 | 307 | case 0x20: |
| 310 | 308 | /* Bit 3 is 0 */ |
| 309 | return 0; | |
| 311 | 310 | break; |
| 312 | 311 | case 0x0c: |
| 313 | 312 | case 0x30: |
| 314 | 313 | /* Bit 3 is 1 */ |
| 315 | ret | |
| 314 | return 1 | |
| 316 | 315 | break; |
| 317 | 316 | default: |
| 318 | 317 | logerror("Unknown protection question %02X at %04X\n", pleiads_protection_question, activecpu_get_pc()); |
| 318 | return 0; | |
| 319 | 319 | } |
| 320 | ||
| 321 | return ret; | |
| 322 | 320 | } |
| 323 | 321 | |
| 324 | 322 | READ8_HANDLER( survival_input_port_0_r ) |
| 325 | 323 | { |
| 326 | int ret = | |
| 324 | int ret = | |
| 327 | 325 | |
| 328 | 326 | if (survival_protection_value) |
| 329 | 327 | { |
| r2375 | r2376 | |
|---|---|---|
| 64 | 64 | state_save_register_global(pbillian_show_power); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | static void superqix_postload(void) | |
| 68 | { | |
| 69 | tilemap_mark_all_tiles_dirty(bg_tilemap); | |
| 70 | } | |
| 71 | ||
| 72 | 67 | VIDEO_START( superqix ) |
| 73 | 68 | { |
| 74 | 69 | fg_bitmap[0] = auto_bitmap_alloc(256, 256, video_screen_get_format(machine->primary_screen)); |
| r2375 | r2376 | |
| 82 | 77 | state_save_register_global(show_bitmap); |
| 83 | 78 | state_save_register_global_bitmap(fg_bitmap[0]); |
| 84 | 79 | state_save_register_global_bitmap(fg_bitmap[1]); |
| 85 | state_save_register_func_postload(superqix_postload); | |
| 86 | 80 | } |
| 87 | 81 | |
| 88 | 82 | |
| r2375 | r2376 | |
| 241 | 235 | { |
| 242 | 236 | int curr_power; |
| 243 | 237 | |
| 244 | curr_power = (( | |
| 238 | curr_power = (( | |
| 245 | 239 | if (last_power[0] != curr_power) |
| 246 | 240 | { |
| 247 | 241 | popmessage ("Power %d%%", curr_power); |
| 248 | 242 | last_power[0] = curr_power; |
| 249 | 243 | } |
| 250 | 244 | |
| 251 | curr_power = (( | |
| 245 | curr_power = (( | |
| 252 | 246 | if (last_power[1] != curr_power) |
| 253 | 247 | { |
| 254 | 248 | popmessage ("Power %d%%", curr_power); |
| r2375 | r2376 | |
|---|---|---|
| 20 | 20 | VIDEO_START( rastan ) |
| 21 | 21 | { |
| 22 | 22 | /* (chips, gfxnum, x_offs, y_offs, y_invert, opaque, dblwidth) */ |
| 23 | PC080SN_vh_start(1,0,0,0,0,0,0); | |
| 23 | PC080SN_vh_start(machine,1,0,0,0,0,0,0); | |
| 24 | 24 | PC090OJ_vh_start(1,0,0,0); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | VIDEO_START( opwolf ) |
| 28 | 28 | { |
| 29 | PC080SN_vh_start(1,1,0,0,0,0,0); | |
| 29 | PC080SN_vh_start(machine,1,1,0,0,0,0,0); | |
| 30 | 30 | PC090OJ_vh_start(0,0,0,0); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | VIDEO_START( rainbow ) |
| 34 | 34 | { |
| 35 | 35 | /* (chips, gfxnum, x_offs, y_offs, y_invert, opaque, dblwidth) */ |
| 36 | PC080SN_vh_start(1,1,0,0,0,0,0); | |
| 36 | PC080SN_vh_start(machine,1,1,0,0,0,0,0); | |
| 37 | 37 | PC090OJ_vh_start(0,0,0,0); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | VIDEO_START( jumping ) |
| 41 | 41 | { |
| 42 | PC080SN_vh_start(1,1,0,0,1,0,0); | |
| 42 | PC080SN_vh_start(machine,1,1,0,0,1,0,0); | |
| 43 | 43 | |
| 44 | 44 | PC080SN_set_trans_pen(0,1,15); |
| 45 | 45 |
| r2375 | r2376 | |
|---|---|---|
| 41 | 41 | { |
| 42 | 42 | int i; |
| 43 | 43 | |
| 44 | K053251_vh_start(); | |
| 44 | K053251_vh_start(machine); | |
| 45 | 45 | K056832_vh_start(machine, REGION_GFX1, K056832_BPP_4, 1, NULL, gijoe_tile_callback, 0); |
| 46 | 46 | |
| 47 | 47 | K056832_linemap_enable(1); |
| r2375 | r2376 | |
|---|---|---|
| 781 | 781 | |
| 782 | 782 | VIDEO_UPDATE_CALL(generic_bitmapped); |
| 783 | 783 | |
| 784 | new_tv_artifacts = | |
| 784 | new_tv_artifacts = | |
| 785 | 785 | if( tv_artifacts != new_tv_artifacts ) |
| 786 | 786 | { |
| 787 | 787 | tv_artifacts = new_tv_artifacts; |
| r2375 | r2376 | |
| 1492 | 1492 | * |
| 1493 | 1493 | *****************************************************************************/ |
| 1494 | 1494 | |
| 1495 | static void generic_atari_interrupt(void (*handle_keyboard)( | |
| 1495 | static void generic_atari_interrupt(running_machine *machine, void (*handle_keyboard)(running_machine *machine), int button_count) | |
| 1496 | 1496 | { |
| 1497 | 1497 | int button_port, i; |
| 1498 | 1498 | |
| r2375 | r2376 | |
| 1506 | 1506 | |
| 1507 | 1507 | if( antic.scanline == VBL_START ) |
| 1508 | 1508 | { |
| 1509 | button_port = | |
| 1509 | button_port = | |
| 1510 | 1510 | |
| 1511 | 1511 | /* specify buttons relevant to this Atari variant */ |
| 1512 | 1512 | for (i = 0; i < button_count; i++) |
| r2375 | r2376 | |
| 1520 | 1520 | for (i = button_count; i < 4; i++) |
| 1521 | 1521 | gtia.r.but[i] = 1; |
| 1522 | 1522 | |
| 1523 | handle_keyboard(); | |
| 1523 | handle_keyboard(machine); | |
| 1524 | 1524 | |
| 1525 | 1525 | /* do nothing new for the rest of the frame */ |
| 1526 | 1526 | antic.modelines = video_screen_get_height(Machine->primary_screen) - VBL_START; |
| r2375 | r2376 | |
| 1544 | 1544 | |
| 1545 | 1545 | INTERRUPT_GEN( a400_interrupt ) |
| 1546 | 1546 | { |
| 1547 | generic_atari_interrupt(a800_handle_keyboard, 4); | |
| 1547 | generic_atari_interrupt(machine, a800_handle_keyboard, 4); | |
| 1548 | 1548 | } |
| 1549 | 1549 | |
| 1550 | 1550 | INTERRUPT_GEN( a800_interrupt ) |
| 1551 | 1551 | { |
| 1552 | generic_atari_interrupt(a800_handle_keyboard, 4); | |
| 1552 | generic_atari_interrupt(machine, a800_handle_keyboard, 4); | |
| 1553 | 1553 | } |
| 1554 | 1554 | |
| 1555 | 1555 | INTERRUPT_GEN( a800xl_interrupt ) |
| 1556 | 1556 | { |
| 1557 | generic_atari_interrupt(a800_handle_keyboard, 2); | |
| 1557 | generic_atari_interrupt(machine, a800_handle_keyboard, 2); | |
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | INTERRUPT_GEN( a5200_interrupt ) |
| 1561 | 1561 | { |
| 1562 | generic_atari_interrupt(a5200_handle_keypads, 4); | |
| 1562 | generic_atari_interrupt(machine, a5200_handle_keypads, 4); | |
| 1563 | 1563 | } |
| r2375 | r2376 | |
|---|---|---|
| 158 | 158 | WRITE8_HANDLER( m57_flipscreen_w ) |
| 159 | 159 | { |
| 160 | 160 | /* screen flip is handled both by software and hardware */ |
| 161 | flipscreen = (data & 0x01) ^ (~ | |
| 161 | flipscreen = (data & 0x01) ^ (~ | |
| 162 | 162 | tilemap_set_flip(bg_tilemap, flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); |
| 163 | 163 | |
| 164 | 164 | coin_counter_w(0,data & 0x02); |
| r2375 | r2376 | |
|---|---|---|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
| 171 | static | |
| 171 | static STATE_POSTLOAD( regenerate_pens | |
| 172 | 172 | { |
| 173 | 173 | int i; |
| 174 | 174 | |
| r2375 | r2376 | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
| 180 | void neogeo_set_palette_bank(UINT8 data) | |
| 180 | void neogeo_set_palette_bank(running_machine *machine, UINT8 data) | |
| 181 | 181 | { |
| 182 | 182 | if (data != palette_bank) |
| 183 | 183 | { |
| 184 | 184 | palette_bank = data; |
| 185 | 185 | |
| 186 | regenerate_pens(); | |
| 186 | regenerate_pens(machine, NULL); | |
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | |
| 191 | void neogeo_set_screen_dark(UINT8 data) | |
| 191 | void neogeo_set_screen_dark(running_machine *machine, UINT8 data) | |
| 192 | 192 | { |
| 193 | 193 | if (data != screen_dark) |
| 194 | 194 | { |
| 195 | 195 | screen_dark = data; |
| 196 | 196 | |
| 197 | regenerate_pens(); | |
| 197 | regenerate_pens(machine, NULL); | |
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
| r2375 | r2376 | |
| 899 | 899 | state_save_register_global(auto_animation_counter); |
| 900 | 900 | state_save_register_global(auto_animation_frame_counter); |
| 901 | 901 | |
| 902 | state_save_register_ | |
| 902 | state_save_register_ | |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 |
| r2375 | r2376 | |
|---|---|---|
| 44 | 44 | |
| 45 | 45 | VIDEO_START( parodius ) |
| 46 | 46 | { |
| 47 | K053251_vh_start(); | |
| 47 | K053251_vh_start(machine); | |
| 48 | 48 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,tile_callback); |
| 49 | 49 | K053245_vh_start(machine,0,REGION_GFX2,NORMAL_PLANE_ORDER,sprite_callback); |
| 50 | 50 | } |
| r2375 | r2376 | |
|---|---|---|
| 346 | 346 | |
| 347 | 347 | static READ8_HANDLER( combascb_io_r ) |
| 348 | 348 | { |
| 349 | return | |
| 349 | return | |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | static WRITE8_HANDLER( combascb_priority_w ) |
| r2375 | r2376 | |
|---|---|---|
| 1309 | 1309 | //logerror(" sprite DMA: %d (scanline: %d)\n", page, chips[num].scanline); |
| 1310 | 1310 | for (i = 0; i < SPRITERAM_SIZE; i++) |
| 1311 | 1311 | { |
| 1312 | UINT8 spriteData = program_read_byte | |
| 1312 | UINT8 spriteData = program_read_byte | |
| 1313 | 1313 | ppu2c0x_w (num, PPU_SPRITE_DATA, spriteData); |
| 1314 | 1314 | } |
| 1315 | 1315 |
| r2375 | r2376 | |
|---|---|---|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if (has_TC0110PCR()) |
| 114 | TC0110PCR_vh_start(); | |
| 114 | TC0110PCR_vh_start(machine); | |
| 115 | 115 | |
| 116 | 116 | if (has_TC0280GRD()) |
| 117 | 117 | TC0280GRD_vh_start(TC0280GRD_GFX_NUM); |
| r2375 | r2376 | |
|---|---|---|
| 44 | 44 | |
| 45 | 45 | VIDEO_START( asterix ) |
| 46 | 46 | { |
| 47 | K053251_vh_start(); | |
| 47 | K053251_vh_start(machine); | |
| 48 | 48 | K056832_vh_start(machine, REGION_GFX1, K056832_BPP_4, 1, NULL, asterix_tile_callback, 1); |
| 49 | 49 | K053245_vh_start(machine,0, REGION_GFX2,NORMAL_PLANE_ORDER, asterix_sprite_callback); |
| 50 | 50 |
| r2375 | r2376 | |
|---|---|---|
| 70 | 70 | * |
| 71 | 71 | *************************************/ |
| 72 | 72 | |
| 73 | INLINE void latch_condition(int collision) | |
| 73 | INLINE void latch_condition(running_machine *machine, int collision) | |
| 74 | 74 | { |
| 75 | 75 | collision ^= collision_invert; |
| 76 | int_condition = ( | |
| 76 | int_condition = ( | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | INTERRUPT_GEN( exidy_vblank_interrupt ) |
| 81 | 81 | { |
| 82 | 82 | /* latch the current condition */ |
| 83 | latch_condition(0); | |
| 83 | latch_condition(machine, 0); | |
| 84 | 84 | int_condition &= ~0x80; |
| 85 | 85 | |
| 86 | 86 | /* set the IRQ line */ |
| r2375 | r2376 | |
| 283 | 283 | static TIMER_CALLBACK( collision_irq_callback ) |
| 284 | 284 | { |
| 285 | 285 | /* latch the collision bits */ |
| 286 | latch_condition(param); | |
| 286 | latch_condition(machine, param); | |
| 287 | 287 | |
| 288 | 288 | /* set the IRQ line */ |
| 289 | 289 | cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); |
| r2375 | r2376 | |
|---|---|---|
| 47 | 47 | |
| 48 | 48 | alpha_enabled = 0; |
| 49 | 49 | |
| 50 | K053251_vh_start(); | |
| 50 | K053251_vh_start(machine); | |
| 51 | 51 | K054338_vh_start(); |
| 52 | 52 | |
| 53 | 53 | K056832_vh_start(machine, REGION_GFX1, K056832_BPP_4, 1, NULL, moo_tile_callback, 0); |
| r2375 | r2376 | |
|---|---|---|
| 463 | 463 | m92_screenrefresh(screen->machine, bitmap, cliprect); |
| 464 | 464 | |
| 465 | 465 | /* Flipscreen appears hardwired to the dipswitch - strange */ |
| 466 | if ( | |
| 466 | if ( | |
| 467 | 467 | flip_screen_set(0); |
| 468 | 468 | else |
| 469 | 469 | flip_screen_set(1); |
| r2375 | r2376 | |
|---|---|---|
| 203 | 203 | WRITE8_HANDLER( yard_flipscreen_w ) |
| 204 | 204 | { |
| 205 | 205 | /* screen flip is handled both by software and hardware */ |
| 206 | flip_screen_set((data & 0x01) ^ (~ | |
| 206 | flip_screen_set((data & 0x01) ^ (~ | |
| 207 | 207 | |
| 208 | 208 | coin_counter_w(0, data & 0x02); |
| 209 | 209 | coin_counter_w(1, data & 0x20); |
| r2375 | r2376 | |
|---|---|---|
| 54 | 54 | |
| 55 | 55 | VIDEO_START( vendetta ) |
| 56 | 56 | { |
| 57 | K053251_vh_start(); | |
| 57 | K053251_vh_start(machine); | |
| 58 | 58 | |
| 59 | 59 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,vendetta_tile_callback); |
| 60 | 60 | K053247_vh_start(machine,REGION_GFX2,53,6,NORMAL_PLANE_ORDER,sprite_callback); |
| r2375 | r2376 | |
| 62 | 62 | |
| 63 | 63 | VIDEO_START( esckids ) |
| 64 | 64 | { |
| 65 | K053251_vh_start(); | |
| 65 | K053251_vh_start(machine); | |
| 66 | 66 | |
| 67 | 67 | K052109_vh_start(machine,REGION_GFX1,NORMAL_PLANE_ORDER,esckids_tile_callback); |
| 68 | 68 | K053247_vh_start(machine,REGION_GFX2,101,6,NORMAL_PLANE_ORDER,sprite_callback); |
| r2375 | r2376 | |
|---|---|---|
| 37 | 37 | |
| 38 | 38 | READ8_HANDLER( tinvader_port_0_r ) |
| 39 | 39 | { |
| 40 | return input_port_ | |
| 40 | return input_port_ | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /*****************************************/ |
| r2375 | r2376 | |
|---|---|---|
| 33 | 33 | TC0100SCN_vh_start(machine,chips,TC0100SCN_GFX_NUM,taito_hide_pixels,0,0,0,0,0,2); |
| 34 | 34 | |
| 35 | 35 | if (has_TC0110PCR()) |
| 36 | TC0110PCR_vh_start(); | |
| 36 | TC0110PCR_vh_start(machine); | |
| 37 | 37 | |
| 38 | 38 | if (has_second_TC0110PCR()) |
| 39 | TC0110PCR_1_vh_start(); | |
| 39 | TC0110PCR_1_vh_start(machine); | |
| 40 | 40 | |
| 41 | 41 | if (has_third_TC0110PCR()) |
| 42 | TC0110PCR_2_vh_start(); | |
| 42 | TC0110PCR_2_vh_start(machine); | |
| 43 | 43 | |
| 44 | 44 | /* Ensure palette from correct TC0110PCR used for each screen */ |
| 45 | 45 | TC0100SCN_set_chip_colbanks(0x0,0x100,0x200); |
| r2375 | r2376 | |
|---|---|---|
| 317 | 317 | { |
| 318 | 318 | /* analog inputs seem to be hooked up here -- might not actually map to blitter */ |
| 319 | 319 | if (offset == 0x02/2) |
| 320 | return | |
| 320 | return | |
| 321 | 321 | if (offset == 0x0e/2) |
| 322 | return | |
| 322 | return | |
| 323 | 323 | |
| 324 | 324 | /* early code polls on this bit, wants it to be 0 */ |
| 325 | 325 | if (offset == 0x36/2) |
| r2375 | r2376 | |
|---|---|---|
| 144 | 144 | g = ((g<<5) + (g<<2) + (g>>1)); |
| 145 | 145 | b = ((b<<5) + (b<<2) + (b>>1)); |
| 146 | 146 | |
| 147 | if ((i = | |
| 147 | if ((i = | |
| 148 | 148 | { |
| 149 | 149 | r = (float)r * rgb[i][0]; |
| 150 | 150 | g = (float)g * rgb[i][1]; |
| r2375 | r2376 | |
|---|---|---|
| 10 | 10 | { |
| 11 | 11 | PC090OJ_vh_start(0,0,8,buffering); /* gfxset, x offset, y offset, buffering */ |
| 12 | 12 | TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,x_offs,0,0,0,0,0,0); |
| 13 | TC0110PCR_vh_start(); | |
| 13 | TC0110PCR_vh_start(machine); | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | VIDEO_START( asuka ) |
| r2375 | r2376 | |
|---|---|---|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | /*coin setting MCU simulation*/ |
| 557 | static void mcu_run(UINT8 dsw_setting) | |
| 557 | static void mcu_run(running_machine *machine, UINT8 dsw_setting) | |
| 558 | 558 | { |
| 559 | 559 | static UINT8 read_coin; |
| 560 | 560 | static UINT8 old_value; |
| r2375 | r2376 | |
| 563 | 563 | /*needed because of the uncompatibility of the dsw settings.*/ |
| 564 | 564 | if(dsw_setting) |
| 565 | 565 | { |
| 566 | dsw_a = (readinputport(2+dsw_setting) & 0x7); | |
| 567 | dsw_b = (readinputport(2+dsw_setting) & 0x38) >> 3; | |
| 566 | dsw_a = (input_port_read_indexed(machine, 2+dsw_setting) & 0x7); | |
| 567 | dsw_b = (input_port_read_indexed(machine, 2+dsw_setting) & 0x38) >> 3; | |
| 568 | 568 | } |
| 569 | 569 | else |
| 570 | 570 | { |
| 571 | dsw_a = (readinputport(2) & 0x0700) >> 8; | |
| 572 | dsw_b = (readinputport(2) & 0x3800) >> 11; | |
| 571 | dsw_a = (input_port_read_indexed(machine, 2) & 0x0700) >> 8; | |
| 572 | dsw_b = (input_port_read_indexed(machine, 2) & 0x3800) >> 11; | |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | read_coin = old_value; |
| 576 | old_value = | |
| 576 | old_value = | |
| 577 | 577 | |
| 578 | 578 | if(dsw_a == 0 || dsw_b == 0) |
| 579 | 579 | nmk16_mainram[0x9000/2]|=0x4000; //free_play |
| 580 | 580 | |
| 581 | 581 | if(read_coin != old_value) |
| 582 | 582 | { |
| 583 | if(!( | |
| 583 | if(!( | |
| 584 | 584 | { |
| 585 | 585 | switch(dsw_a & 7) |
| 586 | 586 | { |
| r2375 | r2376 | |
| 615 | 615 | } |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | if(!( | |
| 618 | if(!( | |
| 619 | 619 | { |
| 620 | 620 | switch(dsw_b & 7) |
| 621 | 621 | { |
| r2375 | r2376 | |
| 650 | 650 | } |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | if(!( | |
| 653 | if(!( | |
| 654 | 654 | nmk16_mainram[0xef00/2]++; |
| 655 | 655 | |
| 656 | 656 | if(nmk16_mainram[0xef00/2] >= 1 && (nmk16_mainram[0x9000/2] & 0x8000))/*enable start button*/ |
| 657 | 657 | { |
| 658 | 658 | /*Start a 1-player game,but don't decrement if the player 1 is already playing*/ |
| 659 | if((!( | |
| 659 | if((!( | |
| 660 | 660 | && (!(nmk16_mainram[0x9000/2] & 0x0200)) /*PLAYER-1 playing*/ |
| 661 | 661 | ) |
| 662 | 662 | nmk16_mainram[0xef00/2]--; |
| 663 | 663 | |
| 664 | 664 | /*Start a 2-players game,but don't decrement if the player 2 is already playing*/ |
| 665 | if((!( | |
| 665 | if((!( | |
| 666 | 666 | && (!(nmk16_mainram[0x9000/2] & 0x0100)) |
| 667 | 667 | ) |
| 668 | 668 | { |
| r2375 | r2376 | |
| 679 | 679 | |
| 680 | 680 | VIDEO_UPDATE( tdragon ) |
| 681 | 681 | { |
| 682 | mcu_run(1); | |
| 682 | mcu_run(screen->machine, 1); | |
| 683 | 683 | |
| 684 | 684 | tilemap_set_scrollx(tx_tilemap,0,-videoshift); |
| 685 | 685 | |
| r2375 | r2376 | |
| 696 | 696 | |
| 697 | 697 | VIDEO_UPDATE( hachamf ) |
| 698 | 698 | { |
| 699 | mcu_run(0); | |
| 699 | mcu_run(screen->machine, 0); | |
| 700 | 700 | |
| 701 | 701 | tilemap_set_scrollx(tx_tilemap,0,-videoshift); |
| 702 | 702 | |
| r2375 | r2376 | |
| 1052 | 1052 | if (dsw_flipscreen) |
| 1053 | 1053 | { |
| 1054 | 1054 | |
| 1055 | flip_screen_x_set(~readinputport(2) & 0x0100); | |
| 1056 | flip_screen_y_set(~readinputport(2) & 0x0200); | |
| 1055 | flip_screen_x_set(~input_port_read_indexed(machine, 2) & 0x0100); | |
| 1056 | flip_screen_y_set(~input_port_read_indexed(machine, 2) & 0x0200); | |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | tilemap_set_scrollx(tilemap_0, 0, afega_scroll_0[1] + xoffset); |
| r2375 | r2376 | |
|---|---|---|
| 865 | 865 | } |
| 866 | 866 | case 0x22: |
| 867 | 867 | { |
| 868 | val = 0x40 | | |
| 868 | val = 0x40 | | |
| 869 | 869 | break; |
| 870 | 870 | } |
| 871 | 871 | default: |
| r2375 | r2376 | |
| 1409 | 1409 | |
| 1410 | 1410 | /* Clock is low */ |
| 1411 | 1411 | if (!(data & 0x08)) |
| 1412 | mux_input = | |
| 1412 | mux_input = | |
| 1413 | 1413 | } |
| 1414 | 1414 | break; |
| 1415 | 1415 | } |
| r2375 | r2376 | |
|---|---|---|
| 165 | 165 | pulse = 0; |
| 166 | 166 | else pulse = 0x04; |
| 167 | 167 | } |
| 168 | return | |
| 168 | return | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | static ADDRESS_MAP_START( rcasino_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2375 | r2376 | |
|---|---|---|
| 226 | 226 | |
| 227 | 227 | static READ8_HANDLER( nycaptor_by_r ) |
| 228 | 228 | { |
| 229 | int port= | |
| 229 | int port= | |
| 230 | 230 | if(nyc_gametype==1) |
| 231 | 231 | port=255-port; |
| 232 | 232 | return port-8; |
| r2375 | r2376 | |
| 234 | 234 | |
| 235 | 235 | static READ8_HANDLER( nycaptor_bx_r ) |
| 236 | 236 | { |
| 237 | return ( | |
| 237 | return ( | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 |
| r2375 | r2376 | |
|---|---|---|
| 193 | 193 | if (pang_port5_kludge) /* hack... music doesn't work otherwise */ |
| 194 | 194 | bit ^= 0x08; |
| 195 | 195 | |
| 196 | return (input_port_ | |
| 196 | return (input_port_ | |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | static WRITE8_HANDLER( eeprom_cs_w ) |
| r2375 | r2376 | |
| 229 | 229 | { |
| 230 | 230 | int delta; |
| 231 | 231 | |
| 232 | delta = ( | |
| 232 | delta = ( | |
| 233 | 233 | if (delta & 0x80) |
| 234 | 234 | { |
| 235 | 235 | delta = (-delta) & 0xff; |
| r2375 | r2376 | |
| 256 | 256 | { |
| 257 | 257 | int res; |
| 258 | 258 | |
| 259 | res = | |
| 259 | res = | |
| 260 | 260 | if (dir[offset]) res |= 0x08; |
| 261 | 261 | |
| 262 | 262 | return res; |
| r2375 | r2376 | |
| 268 | 268 | if (data == 0x08) |
| 269 | 269 | { |
| 270 | 270 | /* reset the dial counters */ |
| 271 | dial[0] = readinputport(4); | |
| 272 | dial[1] = readinputport(5); | |
| 271 | dial[0] = input_port_read_indexed(machine, 4); | |
| 272 | dial[1] = input_port_read_indexed(machine, 5); | |
| 273 | 273 | } |
| 274 | 274 | else if (data == 0x80) |
| 275 | 275 | dial_selected = 0; |
| r2375 | r2376 | |
| 285 | 285 | int i; |
| 286 | 286 | |
| 287 | 287 | for (i = 0;i < 5;i++) |
| 288 | if (keymatrix & (0x80 >> i)) return | |
| 288 | if (keymatrix & (0x80 >> i)) return | |
| 289 | 289 | |
| 290 | 290 | return 0xff; |
| 291 | 291 | } |
| r2375 | r2376 | |
| 304 | 304 | { |
| 305 | 305 | case 0: |
| 306 | 306 | default: |
| 307 | return | |
| 307 | return | |
| 308 | 308 | break; |
| 309 | 309 | case 1: /* Mahjong games */ |
| 310 | 310 | if (offset) return mahjong_input_r(machine,offset-1); |
| 311 | else return | |
| 311 | else return | |
| 312 | 312 | break; |
| 313 | 313 | case 2: /* Block Block - dial control */ |
| 314 | 314 | if (offset) return block_input_r(machine,offset-1); |
| 315 | else return | |
| 315 | else return | |
| 316 | 316 | break; |
| 317 | 317 | case 3: /* Super Pang - simulate START 1 press to initialize EEPROM */ |
| 318 | if (offset || init_eeprom_count == 0) return | |
| 318 | if (offset || init_eeprom_count == 0) return | |
| 319 | 319 | else |
| 320 | 320 | { |
| 321 | 321 | init_eeprom_count--; |
| 322 | return | |
| 322 | return | |
| 323 | 323 | } |
| 324 | 324 | break; |
| 325 | 325 | } |
| r2375 | r2376 | |
|---|---|---|
| 54 | 54 | |
| 55 | 55 | static WRITE8_HANDLER( blktiger_coinlockout_w ) |
| 56 | 56 | { |
| 57 | if ( | |
| 57 | if ( | |
| 58 | 58 | { |
| 59 | 59 | coin_lockout_w(0,~data & 0x01); |
| 60 | 60 | coin_lockout_w(1,~data & 0x02); |
| r2375 | r2376 | |
|---|---|---|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
| 74 | static void update_plunger( | |
| 74 | static void update_plunger(running_machine *machine) | |
| 75 | 75 | { |
| 76 | UINT8 val = | |
| 76 | UINT8 val = | |
| 77 | 77 | |
| 78 | 78 | if (prev != val) |
| 79 | 79 | { |
| r2375 | r2376 | |
| 96 | 96 | { |
| 97 | 97 | int scanline = param; |
| 98 | 98 | |
| 99 | update_plunger(); | |
| 99 | update_plunger(machine); | |
| 100 | 100 | |
| 101 | 101 | cpunum_set_input_line(machine, 0, 0, PULSE_LINE); |
| 102 | 102 | |
| r2375 | r2376 | |
| 138 | 138 | |
| 139 | 139 | static READ8_HANDLER( mgolf_dial_r ) |
| 140 | 140 | { |
| 141 | UINT8 val = | |
| 141 | UINT8 val = | |
| 142 | 142 | |
| 143 | if (( | |
| 143 | if (( | |
| 144 | 144 | { |
| 145 | 145 | val |= 0x01; |
| 146 | 146 | } |
| 147 | if (( | |
| 147 | if (( | |
| 148 | 148 | { |
| 149 | 149 | val |= 0x02; |
| 150 | 150 | } |
| r2375 | r2376 | |
| 157 | 157 | { |
| 158 | 158 | double plunger = calc_plunger_pos(); /* see Video Pinball */ |
| 159 | 159 | |
| 160 | UINT8 val = | |
| 160 | UINT8 val = | |
| 161 | 161 | |
| 162 | 162 | if (plunger >= 0.000 && plunger <= 0.001) |
| 163 | 163 | { |
| r2375 | r2376 | |
|---|---|---|
| 118 | 118 | |
| 119 | 119 | static READ32_HANDLER( avengrs_control_r ) |
| 120 | 120 | { |
| 121 | return ( | |
| 121 | return ( | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | static READ32_HANDLER(test2_r) |
| 125 | 125 | { |
| 126 | 126 | // if (offset==0) |
| 127 | // return | |
| 127 | // return | |
| 128 | 128 | // logerror("%08x: Test2_r %d\n",activecpu_get_pc(),offset); |
| 129 | 129 | return mame_rand(Machine); //0xffffffff; |
| 130 | 130 | } |
| r2375 | r2376 | |
|---|---|---|
| 97 | 97 | |
| 98 | 98 | static READ8_HANDLER( tunhunt_button_r ) |
| 99 | 99 | { |
| 100 | int data = | |
| 100 | int data = | |
| 101 | 101 | return ((data>>offset)&1)?0x00:0x80; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | static READ8_HANDLER( dsw1_r ) |
| 106 | 106 | { |
| 107 | return | |
| 107 | return | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | static READ8_HANDLER( dsw2_0r ) |
| 112 | 112 | { |
| 113 | return ( | |
| 113 | return ( | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | static READ8_HANDLER( dsw2_1r ) |
| 118 | 118 | { |
| 119 | return ( | |
| 119 | return ( | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | static READ8_HANDLER( dsw2_2r ) |
| 124 | 124 | { |
| 125 | return ( | |
| 125 | return ( | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
| 129 | 129 | static READ8_HANDLER( dsw2_3r ) |
| 130 | 130 | { |
| 131 | return ( | |
| 131 | return ( | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | static READ8_HANDLER( dsw2_4r ) |
| 136 | 136 | { |
| 137 | return ( | |
| 137 | return ( | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 |
| r2375 | r2376 | |
|---|---|---|
| 183 | 183 | |
| 184 | 184 | static INTERRUPT_GEN( tryout_interrupt ) |
| 185 | 185 | { |
| 186 | if ((input_port_ | |
| 186 | if ((input_port_ | |
| 187 | 187 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE); |
| 188 | 188 | } |
| 189 | 189 |
| r2375 | r2376 | |
|---|---|---|
| 94 | 94 | switch (offset) |
| 95 | 95 | { |
| 96 | 96 | case 0x00/2: |
| 97 | if (readinputport(1) & 0x20) | |
| 98 | return(readinputport(2) | readinputport(4)<<8); | |
| 97 | if (input_port_read_indexed(machine, 1) & 0x20) | |
| 98 | return(input_port_read_indexed(machine, 2) | input_port_read_indexed(machine, 4)<<8); | |
| 99 | 99 | else |
| 100 | 100 | { |
| 101 | data = | |
| 101 | data = | |
| 102 | 102 | return(data<<8 | data); |
| 103 | 103 | } |
| 104 | 104 | break; |
| 105 | 105 | |
| 106 | 106 | case 0x02/2: |
| 107 | if (readinputport(1) & 0x20) | |
| 108 | return(readinputport(3) | readinputport(5)<<8); | |
| 107 | if (input_port_read_indexed(machine, 1) & 0x20) | |
| 108 | return(input_port_read_indexed(machine, 3) | input_port_read_indexed(machine, 5)<<8); | |
| 109 | 109 | else |
| 110 | 110 | { |
| 111 | data = | |
| 111 | data = | |
| 112 | 112 | return(data<<8 | data); |
| 113 | 113 | } |
| 114 | 114 | break; |
| r2375 | r2376 | |
| 125 | 125 | case 0x06/2: |
| 126 | 126 | if (ACCESSING_BITS_0_7) |
| 127 | 127 | { |
| 128 | data = | |
| 128 | data = | |
| 129 | 129 | |
| 130 | 130 | if (init_eeprom_count) |
| 131 | 131 | { |
| r2375 | r2376 | |
|---|---|---|
| 181 | 181 | static READ32_HANDLER(Input_r) |
| 182 | 182 | { |
| 183 | 183 | if(offset==0) |
| 184 | return | |
| 184 | return | |
| 185 | 185 | else if(offset==1) |
| 186 | return | |
| 186 | return | |
| 187 | 187 | else if(offset==2) |
| 188 | 188 | { |
| 189 | UINT8 Port4= | |
| 189 | UINT8 Port4= | |
| 190 | 190 | if(!(Port4&0x10) && ((OldPort4^Port4)&0x10)) //coin buttons trigger IRQs |
| 191 | 191 | IntReq(machine, 12); |
| 192 | 192 | if(!(Port4&0x20) && ((OldPort4^Port4)&0x20)) |
| 193 | 193 | IntReq(machine, 19); |
| 194 | 194 | OldPort4=Port4; |
| 195 | return /*dips*/ | |
| 195 | return /*dips*/ | |
| 196 | 196 | } |
| 197 | 197 | return 0; |
| 198 | 198 | } |
| r2375 | r2376 | |
|---|---|---|
| 320 | 320 | |
| 321 | 321 | if (tempest_player_select) |
| 322 | 322 | { |
| 323 | ret = | |
| 323 | ret = | |
| 324 | 324 | } |
| 325 | 325 | else |
| 326 | 326 | { |
| 327 | ret = | |
| 327 | ret = | |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | return ret; |
| r2375 | r2376 | |
| 336 | 336 | |
| 337 | 337 | if (tempest_player_select) |
| 338 | 338 | { |
| 339 | ret = | |
| 339 | ret = | |
| 340 | 340 | } |
| 341 | 341 | else |
| 342 | 342 | { |
| 343 | ret = | |
| 343 | ret = | |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | return ret; |
| r2375 | r2376 | |
| 349 | 349 | |
| 350 | 350 | static READ8_HANDLER( tempest_IN0_r ) |
| 351 | 351 | { |
| 352 | int res = | |
| 352 | int res = | |
| 353 | 353 | |
| 354 | 354 | if (avgdvg_done()) |
| 355 | 355 | res |= 0x40; |
| r2375 | r2376 | |
| 364 | 364 | |
| 365 | 365 | static READ8_HANDLER( input_port_1_bit_r ) |
| 366 | 366 | { |
| 367 | return ( | |
| 367 | return ( | |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | |
| 371 | 371 | static READ8_HANDLER( input_port_2_bit_r ) |
| 372 | 372 | { |
| 373 | return ( | |
| 373 | return ( | |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 |
| r2375 | r2376 | |
|---|---|---|
| 70 | 70 | atarigen_interrupt_reset(update_interrupts); |
| 71 | 71 | atarigen_scanline_timer_reset(machine->primary_screen, eprom_scanline_update, 8); |
| 72 | 72 | atarijsa_reset(); |
| 73 | atarigen_init_save_state(); | |
| 73 | atarigen_init_save_state(machine); | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| r2375 | r2376 | |
| 90 | 90 | |
| 91 | 91 | static READ16_HANDLER( special_port1_r ) |
| 92 | 92 | { |
| 93 | int result = | |
| 93 | int result = | |
| 94 | 94 | |
| 95 | 95 | if (atarigen_sound_to_cpu_ready) result ^= 0x0004; |
| 96 | 96 | if (atarigen_cpu_to_sound_ready) result ^= 0x0008; |
| r2375 | r2376 | |
| 103 | 103 | static READ16_HANDLER( adc_r ) |
| 104 | 104 | { |
| 105 | 105 | static int last_offset; |
| 106 | int result = | |
| 106 | int result = | |
| 107 | 107 | last_offset = offset; |
| 108 | 108 | return result; |
| 109 | 109 | } |
| r2375 | r2376 | |
|---|---|---|
| 130 | 130 | /* i doubt these are both really the same.. */ |
| 131 | 131 | case 0x40: |
| 132 | 132 | case 0x4f: |
| 133 | return | |
| 133 | return | |
| 134 | 134 | |
| 135 | 135 | case 0x53: |
| 136 | return | |
| 136 | return | |
| 137 | 137 | |
| 138 | 138 | case 0x57: |
| 139 | return | |
| 139 | return | |
| 140 | 140 | |
| 141 | 141 | case 0x5b: |
| 142 | return | |
| 142 | return | |
| 143 | 143 | |
| 144 | 144 | case 0x5d: |
| 145 | return | |
| 145 | return | |
| 146 | 146 | |
| 147 | 147 | case 0x5e: |
| 148 | return | |
| 148 | return | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | printf("chinsan_input_port_0_r unk_r %02x\n", chinsan_port_select); |
| r2375 | r2376 | |
| 159 | 159 | /* i doubt these are both really the same.. */ |
| 160 | 160 | case 0x40: |
| 161 | 161 | case 0x4f: |
| 162 | return | |
| 162 | return | |
| 163 | 163 | |
| 164 | 164 | case 0x53: |
| 165 | return | |
| 165 | return | |
| 166 | 166 | |
| 167 | 167 | case 0x57: |
| 168 | return | |
| 168 | return | |
| 169 | 169 | |
| 170 | 170 | case 0x5b: |
| 171 | return | |
| 171 | return | |
| 172 | 172 | |
| 173 | 173 | case 0x5d: |
| 174 | return | |
| 174 | return | |
| 175 | 175 | |
| 176 | 176 | case 0x5e: |
| 177 | return | |
| 177 | return | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | printf("chinsan_input_port_1_r unk_r %02x\n", chinsan_port_select); |
| r2375 | r2376 | |
|---|---|---|
| 248 | 248 | skyfox_bg_pos += (skyfox_bg_ctrl >> 1) & 0x7; // maybe.. |
| 249 | 249 | |
| 250 | 250 | /* Check coin 1 & 2 */ |
| 251 | if (( | |
| 251 | if (( | |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | static MACHINE_DRIVER_START( skyfox ) |
| r2375 | r2376 | |
|---|---|---|
| 95 | 95 | |
| 96 | 96 | static void ar_coin_hack(void) |
| 97 | 97 | { |
| 98 | if(input_port_ | |
| 98 | if(input_port_ | |
| 99 | 99 | { |
| 100 | 100 | if(coin_stat==0) |
| 101 | 101 | { |
| r2375 | r2376 | |
| 221 | 221 | /* Even reads must return 0xff - Odd reads must return the contents of input port 5. |
| 222 | 222 | Code at 0x5061 is executed once during P.O.S.T. where there is one read. |
| 223 | 223 | Code at 0x50b4 is then executed each frame (not sure) where there are 2 reads. */ |
| 224 | return ( (cshooter_counter++ & 1) ? 0xff : input_port_ | |
| 224 | return ( (cshooter_counter++ & 1) ? 0xff : input_port_ | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | static WRITE8_HANDLER ( cshooter_c500_w ) |
| r2375 | r2376 | |
|---|---|---|
| 92 | 92 | VIDEO_START( turbofrc ); |
| 93 | 93 | VIDEO_UPDATE( pspikes ); |
| 94 | 94 | VIDEO_UPDATE( pspikesb ); |
| 95 | VIDEO_UPDATE( spikes91 ); | |
| 95 | 96 | VIDEO_UPDATE( karatblz ); |
| 96 | 97 | VIDEO_UPDATE( spinlbrk ); |
| 97 | 98 | VIDEO_UPDATE( turbofrc ); |
| r2375 | r2376 | |
| 192 | 193 | AM_RANGE(0xfff008, 0xfff009) AM_WRITE(pspikesb_oki_banking_w) |
| 193 | 194 | ADDRESS_MAP_END |
| 194 | 195 | |
| 195 | static ADDRESS_MAP_START( p | |
| 196 | static ADDRESS_MAP_START( spikes91 | |
| 196 | 197 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 197 | 198 | AM_RANGE(0x100000, 0x10ffff) AM_RAM /* work RAM */ |
| 198 | 199 | AM_RANGE(0x200000, 0x203fff) AM_RAM AM_BASE(&aerofgt_spriteram1) AM_SIZE(&aerofgt_spriteram1_size) |
| r2375 | r2376 | |
| 1149 | 1150 | 128*8 |
| 1150 | 1151 | }; |
| 1151 | 1152 | |
| 1152 | static const gfx_layout p | |
| 1153 | static const gfx_layout spikes91 | |
| 1153 | 1154 | { |
| 1154 | 1155 | 16,16, |
| 1155 | 1156 | RGN_FRAC(1,4), |
| r2375 | r2376 | |
| 1202 | 1203 | GFXDECODE_ENTRY( REGION_GFX2, 0, pspikesb_spritelayout, 1024, 64 ) /* colors 1024-2047 in 4 banks */ |
| 1203 | 1204 | GFXDECODE_END |
| 1204 | 1205 | |
| 1205 | static GFXDECODE_START( p | |
| 1206 | static GFXDECODE_START( spikes91 | |
| 1206 | 1207 | GFXDECODE_ENTRY( REGION_GFX1, 0, pspikesb_charlayout, 0, 64 ) /* colors 0-1023 in 8 banks */ |
| 1207 | GFXDECODE_ENTRY( REGION_GFX2, 0, p | |
| 1208 | GFXDECODE_ENTRY( REGION_GFX2, 0, spikes91 | |
| 1208 | 1209 | GFXDECODE_END |
| 1209 | 1210 | |
| 1210 | 1211 | |
| r2375 | r2376 | |
| 1298 | 1299 | MDRV_SOUND_ROUTE(2, "right", 1.0) |
| 1299 | 1300 | MACHINE_DRIVER_END |
| 1300 | 1301 | |
| 1301 | static MACHINE_DRIVER_START( p | |
| 1302 | static MACHINE_DRIVER_START( spikes91 | |
| 1302 | 1303 | |
| 1303 | 1304 | /* basic machine hardware */ |
| 1304 | 1305 | MDRV_CPU_ADD(M68000,20000000/2) /* 10 MHz (?) */ |
| 1305 | MDRV_CPU_PROGRAM_MAP(p | |
| 1306 | MDRV_CPU_PROGRAM_MAP(spikes91 | |
| 1306 | 1307 | MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* all irq vectors are the same */ |
| 1307 | 1308 | |
| 1308 | 1309 | /* + Z80 for sound */ |
| r2375 | r2376 | |
| 1314 | 1315 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 1315 | 1316 | MDRV_SCREEN_SIZE(64*8, 32*8) |
| 1316 | 1317 | MDRV_SCREEN_VISIBLE_AREA(0*8+4, 44*8+4-1, 0*8, 30*8-1) |
| 1317 | MDRV_GFXDECODE(p | |
| 1318 | MDRV_GFXDECODE(spikes91 | |
| 1318 | 1319 | MDRV_PALETTE_LENGTH(2048) |
| 1319 | 1320 | |
| 1320 | 1321 | MDRV_VIDEO_START(pspikes) |
| 1321 | MDRV_VIDEO_UPDATE( | |
| 1322 | MDRV_VIDEO_UPDATE( | |
| 1322 | 1323 | |
| 1323 | 1324 | /* sound hardware */ |
| 1324 | 1325 | /* the sound hardware is completely different on this: |
| r2375 | r2376 | |
| 1762 | 1763 | |
| 1763 | 1764 | /* |
| 1764 | 1765 | |
| 1765 | ||
| 1766 | 1991 | |
| 1766 | 1767 | |
| 1767 | 1768 | Anno 1991 |
| 1768 | 1769 | Produttore |
| r2375 | r2376 | |
| 1810 | 1811 | |
| 1811 | 1812 | */ |
| 1812 | 1813 | |
| 1813 | ROM_START( p | |
| 1814 | ROM_START( spikes91 | |
| 1814 | 1815 | ROM_REGION( 0x40000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1815 | 1816 | ROM_LOAD16_BYTE( "7.ic2", 0x00001, 0x20000, CRC(41e38d7e) SHA1(d0c226a8b61a2311c781ed5747d78b8dbddbc7ef) ) |
| 1816 | 1817 | ROM_LOAD16_BYTE( "8.ic3", 0x00000, 0x20000, CRC(9c488daa) SHA1(8336fec855786c6cc6a836d86b74e130d60013b7) ) |
| r2375 | r2376 | |
| 1827 | 1828 | ROM_LOAD( "13.ic120", 0x80000, 0x40000, CRC(89213a8c) SHA1(8524d5c14669d9b03f1fe050c4318d4111bc8ef7) ) |
| 1828 | 1829 | ROM_LOAD( "14.ic121", 0xc0000, 0x40000, CRC(468cbf5b) SHA1(60fbc2771e40f8de51a51891b8ddcc14e2b1e52c) ) |
| 1829 | 1830 | |
| 1830 | ROM_REGION( 0x020000, REGION_USER1, 0 ) /* | |
| 1831 | ROM_REGION( 0x020000, REGION_USER1, 0 ) /* l | |
| 1831 | 1832 | ROM_LOAD( "10.ic104", 0x00000, 0x10000, CRC(769ade77) SHA1(9cb581d02592c69f37d4b5a902d3515f40915ec4) ) |
| 1832 | 1833 | ROM_LOAD( "9.ic103", 0x10000, 0x10000, CRC(201cb748) SHA1(f78d384e4e9c5996a278f76fb4d5f28812a27de5) ) |
| 1833 | 1834 | |
| r2375 | r2376 | |
| 2335 | 2336 | GAME( 1991, pspikesk, pspikes, pspikes, pspikes, 0, ROT0, "Video System Co.", "Power Spikes (Korea)", GAME_NO_COCKTAIL ) |
| 2336 | 2337 | GAME( 1991, svolly91, pspikes, pspikes, pspikes, 0, ROT0, "Video System Co.", "Super Volley '91 (Japan)", GAME_NO_COCKTAIL ) |
| 2337 | 2338 | GAME( 1991, pspikesb, pspikes, pspikesb, pspikesb, 0, ROT0, "bootleg", "Power Spikes (bootleg)", GAME_NO_COCKTAIL ) |
| 2338 | GAME( 1991, p | |
| 2339 | GAME( 1991, spikes91 | |
| 2339 | 2340 | GAME( 1991, pspikesc, pspikes, pspikesc, pspikesc, 0, ROT0, "bootleg", "Power Spikes (China)", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND ) |
| 2340 | 2341 | GAME( 1991, karatblz, 0, karatblz, karatblz, 0, ROT0, "Video System Co.", "Karate Blazers (World?)", GAME_NO_COCKTAIL ) |
| 2341 | 2342 | GAME( 1991, karatblu, karatblz, karatblz, karatblz, 0, ROT0, "Video System Co.", "Karate Blazers (US)", GAME_NO_COCKTAIL ) |
| r2375 | r2376 | |
| 2345 | 2346 | GAME( 1992, aerofgtb, aerofgt, aerofgtb, aerofgtb, 0, ROT270, "Video System Co.", "Aero Fighters (Turbo Force hardware set 1)", GAME_NO_COCKTAIL ) |
| 2346 | 2347 | GAME( 1992, aerofgtc, aerofgt, aerofgtb, aerofgtb, 0, ROT270, "Video System Co.", "Aero Fighters (Turbo Force hardware set 2)", GAME_NO_COCKTAIL ) |
| 2347 | 2348 | GAME( 1992, sonicwi, aerofgt, aerofgtb, aerofgtb, 0, ROT270, "Video System Co.", "Sonic Wings (Japan)", GAME_NO_COCKTAIL ) |
| 2348 | GAME( 1992, aerfboot, aerofgt, aerfboot, aerofgtb, 0, ROT270, "bootleg", "Aero Fighters (bootleg)", GAME_NO_COCKTAIL | GAME_NO_SOUND | |
| 2349 | GAME( 1992, aerfboot, aerofgt, aerfboot, aerofgtb, 0, ROT270, "bootleg", "Aero Fighters (bootleg)", GAME_NO_COCKTAIL | GAME_NO_SOUND | |
| 2349 | 2350 | GAME( 1997, wbbc97, 0, wbbc97, wbbc97, 0, ROT0, "Comad", "Beach Festival World Championship 1997", GAME_NO_COCKTAIL ) |
| r2375 | r2376 | |
|---|---|---|
| 82 | 82 | static TIMER_CALLBACK( interrupt_callback ) |
| 83 | 83 | { |
| 84 | 84 | int scanline; |
| 85 | int coin = ( | |
| 85 | int coin = ( | |
| 86 | 86 | |
| 87 | 87 | cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); |
| 88 | 88 | |
| r2375 | r2376 | |
| 114 | 114 | |
| 115 | 115 | static READ8_HANDLER( fgoal_analog_r ) |
| 116 | 116 | { |
| 117 | return | |
| 117 | return | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | static READ8_HANDLER( fgoal_switches_r ) |
| 122 | 122 | { |
| 123 | 123 | if (video_screen_get_vpos(machine->primary_screen) & 0x80) |
| 124 | return | |
| 124 | return | |
| 125 | 125 | else |
| 126 | return | |
| 126 | return | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 |
| r2375 | r2376 | |
|---|---|---|
| 105 | 105 | a800 sound port 3 |
| 106 | 106 | ac00 sound port 4 |
| 107 | 107 | |
| 108 | Note: | |
| 109 | idsoccer seems to run on a modified version of this board which allows for | |
| 110 | more sprite tiles, it also has a MSM5205 chip for sample playback. | |
| 108 | Notes: | |
| 109 | ------ | |
| 110 | - idsoccer seems to run on a modified version of this board which allows for | |
| 111 | more sprite tiles, it also has a MSM5205 chip for sample playback. | |
| 111 | 112 | |
| 112 | ***************************************************************************/ | |
| 113 | TODO: | |
| 114 | ----- | |
| 113 | 115 | |
| 114 | /* | |
| 116 | - third CPU | |
| 117 | - dip switch reading bug. dorunrun and docastle are VERY timing sensitive, and | |
| 118 | dip switch reading will fail if the main CPU is running at the nominally correct | |
| 119 | 4MHz speed. This is kludge by slighly lowering the speed to 3.98MHz. | |
| 120 | - the dorunrun attract mode sequence is also very timing sensitive. The behaviour | |
| 121 | of the "dorunru2" set, verified on the real board, with all dips in the OFF | |
| 122 | position (easiest difficulty setting), should be, for the first 12 rounds of | |
| 123 | demo play: | |
| 124 | 1) Mr do moves right. Kills all monsters and a letter 'E'. | |
| 125 | 2) Mr do moves Left. Picks up 'A' letter, but dies. | |
| 126 | 3) Mr do moves right. Kills all monsters. | |
| 127 | 4) Mr do moves left. Kills 'X' monster. | |
| 128 | 5) Mr do moves right. | |
| 129 | 6) Mr do moves left. Get 'T' monster. | |
| 130 | 7) Mr do moves right. | |
| 131 | 8) Mr do moves left. Kills 'E' monster - but already has this. | |
| 132 | 9) Mr do moves right. | |
| 133 | 10) Mr do moves left. Kills 'R' monster. | |
| 134 | 11) Mr do moves right. | |
| 135 | 12) Mr do moves. Kills 'A' monster. Shows winning extra Mr do. | |
| 115 | 136 | |
| 116 | TODO: | |
| 137 | Small changes to the CPU speed alter the demo timing and can cause the above | |
| 138 | sequence not to work (e.g. Mr Do might not fill all monsters at once on the | |
| 139 | first round). The 3.98MHz speed makes the sequence work. | |
| 140 | Note that this only works in the dorunru2 set. The dorunrun set works slightly | |
| 141 | differently, however it hasn't been compared with the real board so it might be | |
| 142 | right. | |
| 143 | - unknown ports 0 and 2 | |
| 144 | - bad communication in idsoccer | |
| 145 | - adpcm status in idsoccer | |
| 146 | - real values for the adpcm interface in idsoccer | |
| 147 | - handle flipscreen on/off based on address line A7 (cX0X/cX8X) | |
| 117 | 148 | |
| 118 | - third CPU | |
| 119 | - dip switch reading bug | |
| 120 | - unknown ports 0 and 2 | |
| 121 | - bad communication in idsoccer | |
| 122 | - adpcm status in idsoccer | |
| 123 | - real values for the adpcm interface in idsoccer | |
| 124 | - handle flipscreen on/off based on address line A7 (cX0X/cX8X) | |
| 149 | ***************************************************************************/ | |
| 125 | 150 | |
| 126 | */ | |
| 127 | ||
| 128 | 151 | #include "driver.h" |
| 129 | 152 | #include "deprecat.h" |
| 130 | 153 | #include "sound/msm5205.h" |
| r2375 | r2376 | |
| 628 | 651 | static MACHINE_DRIVER_START( docastle ) |
| 629 | 652 | // basic machine hardware |
| 630 | 653 | // MDRV_CPU_ADD_TAG("main", Z80, 4000000) // 4 MHz |
| 631 | MDRV_CPU_ADD_TAG("main", Z80, 390000 | |
| 654 | MDRV_CPU_ADD_TAG("main", Z80, 3980000 | |
| 632 | 655 | MDRV_CPU_PROGRAM_MAP(docastle_map, 0) |
| 633 | 656 | MDRV_CPU_IO_MAP(docastle_io_map, 0) |
| 634 | 657 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| r2375 | r2376 | |
|---|---|---|
| 52 | 52 | UINT32 r = 0; |
| 53 | 53 | |
| 54 | 54 | if (ACCESSING_BITS_24_31) |
| 55 | r |= (((EEPROM_read_bit()) << 1) | ( | |
| 55 | r |= (((EEPROM_read_bit()) << 1) | ( | |
| 56 | 56 | |
| 57 | 57 | return r; |
| 58 | 58 | } |
| r2375 | r2376 | |
| 69 | 69 | |
| 70 | 70 | static READ32_HANDLER( control1_r ) |
| 71 | 71 | { |
| 72 | return ( | |
| 72 | return ( | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | static READ32_HANDLER( control2_r ) |
| 76 | 76 | { |
| 77 | return ( | |
| 77 | return ( | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | static WRITE32_HANDLER( int_ack_w ) |
| r2375 | r2376 | |
|---|---|---|
| 68 | 68 | static VIDEO_UPDATE(hitme) |
| 69 | 69 | { |
| 70 | 70 | /* the card width resistor comes from an input port, scaled to the range 0-25 kOhms */ |
| 71 | double width_resist = | |
| 71 | double width_resist = | |
| 72 | 72 | /* this triggers a oneshot for the following length of time */ |
| 73 | 73 | double width_duration = 0.45 * 1000e-12 * width_resist; |
| 74 | 74 | /* the dot clock runs at the standard horizontal frequency * 320+16 clocks per scanline */ |
| r2375 | r2376 | |
| 126 | 126 | * |
| 127 | 127 | *************************************/ |
| 128 | 128 | |
| 129 | static UINT8 read_port_and_t0(int port) | |
| 129 | static UINT8 read_port_and_t0(running_machine *machine, int port) | |
| 130 | 130 | { |
| 131 | UINT8 val = | |
| 131 | UINT8 val = | |
| 132 | 132 | if (attotime_compare(timer_get_time(), timeout_time) > 0) |
| 133 | 133 | val ^= 0x80; |
| 134 | 134 | return val; |
| r2375 | r2376 | |
| 137 | 137 | |
| 138 | 138 | static UINT8 read_port_and_t0_and_hblank(running_machine *machine, int port) |
| 139 | 139 | { |
| 140 | UINT8 val = read_port_and_t0(port); | |
| 140 | UINT8 val = read_port_and_t0(machine, port); | |
| 141 | 141 | if (video_screen_get_hpos(machine->primary_screen) < (video_screen_get_width(machine->primary_screen) * 9 / 10)) |
| 142 | 142 | val ^= 0x04; |
| 143 | 143 | return val; |
| r2375 | r2376 | |
| 152 | 152 | |
| 153 | 153 | static READ8_HANDLER( hitme_port_1_r ) |
| 154 | 154 | { |
| 155 | return read_port_and_t0(1); | |
| 155 | return read_port_and_t0(machine, 1); | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
| r2375 | r2376 | |
| 164 | 164 | |
| 165 | 165 | static READ8_HANDLER( hitme_port_3_r ) |
| 166 | 166 | { |
| 167 | return read_port_and_t0(3); | |
| 167 | return read_port_and_t0(machine, 3); | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
| r2375 | r2376 | |
| 183 | 183 | In fact, it is very important that our timing calculation timeout AFTER the sound |
| 184 | 184 | system's equivalent computation, or else we will hang notes. |
| 185 | 185 | */ |
| 186 | UINT8 raw_game_speed = | |
| 186 | UINT8 raw_game_speed = | |
| 187 | 187 | double resistance = raw_game_speed * 25000 / 100; |
| 188 | 188 | attotime duration = attotime_make(0, ATTOSECONDS_PER_SECOND * 0.45 * 6.8e-6 * resistance * (data+1)); |
| 189 | 189 | timeout_time = attotime_add(timer_get_time(), duration); |
| r2375 | r2376 | |
|---|---|---|
| 252 | 252 | |
| 253 | 253 | static INTERRUPT_GEN( bzone_interrupt ) |
| 254 | 254 | { |
| 255 | if ( | |
| 255 | if ( | |
| 256 | 256 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 257 | 257 | } |
| 258 | 258 | |
| r2375 | r2376 | |
| 268 | 268 | { |
| 269 | 269 | int res; |
| 270 | 270 | |
| 271 | res = | |
| 271 | res = | |
| 272 | 272 | |
| 273 | 273 | if (activecpu_gettotalcycles() & 0x100) |
| 274 | 274 | res |= IN0_3KHZ; |
| r2375 | r2376 | |
| 299 | 299 | |
| 300 | 300 | static READ8_HANDLER( redbaron_joy_r ) |
| 301 | 301 | { |
| 302 | return | |
| 302 | return | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | |
| r2375 | r2376 | |
| 807 | 807 | static WRITE8_HANDLER( analog_select_w ) |
| 808 | 808 | { |
| 809 | 809 | if (offset <= 2) |
| 810 | analog_data = | |
| 810 | analog_data = | |
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 |
| r2375 | r2376 | |
|---|---|---|
| 240 | 240 | int which = (iochip_regs[0][2] >> 2) & 7; |
| 241 | 241 | |
| 242 | 242 | /* on the write, latch the selected input port and stash the value */ |
| 243 | int value = | |
| 243 | int value = | |
| 244 | 244 | |
| 245 | 245 | /* reverse some port values */ |
| 246 | 246 | if (adc_reverse[which]) |
| r2375 | r2376 | |
| 300 | 300 | D6: /INTR of ADC0804 |
| 301 | 301 | D5-D0: CN C pin 24-19 (switch state 0= open, 1= closed) |
| 302 | 302 | */ |
| 303 | return iochip_r(0, 0, | |
| 303 | return iochip_r(0, 0, | |
| 304 | 304 | |
| 305 | 305 | case 1: |
| 306 | 306 | /* I/O port: CN C pins 17,15,13,11,9,7,5,3 */ |
| 307 | return iochip_r(0, 1, | |
| 307 | return iochip_r(0, 1, | |
| 308 | 308 | |
| 309 | 309 | case 2: |
| 310 | 310 | /* Output port */ |
| r2375 | r2376 | |
| 375 | 375 | { |
| 376 | 376 | case 0: |
| 377 | 377 | /* Input port: switches, CN D pin A1-8 (switch state 1= open, 0= closed) */ |
| 378 | return iochip_r(1, 0, | |
| 378 | return iochip_r(1, 0, | |
| 379 | 379 | |
| 380 | 380 | case 1: |
| 381 | 381 | /* Input port: switches, CN D pin A9-16 (switch state 1= open, 0= closed) */ |
| 382 | return iochip_r(1, 1, | |
| 382 | return iochip_r(1, 1, | |
| 383 | 383 | |
| 384 | 384 | case 2: |
| 385 | 385 | /* Input port: DIP switches (1= off, 0= on) */ |
| 386 | return iochip_r(1, 2, | |
| 386 | return iochip_r(1, 2, | |
| 387 | 387 | |
| 388 | 388 | case 3: |
| 389 | 389 | /* Input port: DIP switches (1= off, 0= on) */ |
| 390 | return iochip_r(1, 3, | |
| 390 | return iochip_r(1, 3, | |
| 391 | 391 | |
| 392 | 392 | case 4: |
| 393 | 393 | /* Unused */ |
| r2375 | r2376 | |
| 2178 | 2178 | ROM_LOAD( "epr12587.14", 0x00000, 0x8000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) |
| 2179 | 2179 | ROM_END |
| 2180 | 2180 | |
| 2181 | /************************************************************************************************************************** | |
| 2182 | Super Monaco GP, Sega X-board | |
| 2183 | CPU: FD1094 (317-0124a) | |
| 2184 | */ | |
| 2185 | ROM_START( smgpja ) | |
| 2186 | ROM_REGION( 0x80000, REGION_CPU1, 0 ) /* 68000 code */ | |
| 2187 | ROM_LOAD16_BYTE( "epr12432a.58", 0x00000, 0x20000, CRC(22517672) SHA1(db9ac40e83e9786bc9dad70f62c2080d3df694ee) ) | |
| 2188 | ROM_LOAD16_BYTE( "epr12433a.63", 0x00001, 0x20000, CRC(a46b5d13) SHA1(3a7de5cb6f3e6d726f0ea886a87125dedc6f849f) ) | |
| 2181 | 2189 | |
| 2190 | ROM_REGION( 0x2000, REGION_USER1, 0 ) /* decryption key */ | |
| 2191 | ROM_LOAD( "317-0124a.key", 0x0000, 0x2000, CRC(022a8a16) SHA1(4fd80105cb85ccba77cf1e76a21d6e245d5d2e7d) ) | |
| 2192 | ||
| 2193 | ROM_REGION( 0x80000, REGION_CPU2, 0 ) /* 2nd 68000 code */ | |
| 2194 | ROM_LOAD16_BYTE( "epr12441a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) ) | |
| 2195 | ROM_LOAD16_BYTE( "epr12442a.29", 0x00001, 0x20000, CRC(77a5ec16) SHA1(b8cf6a3f12689d89bbdd9fb39d1cb7d1a3c10602) ) | |
| 2196 | ||
| 2197 | ROM_REGION( 0x30000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */ | |
| 2198 | ROM_LOAD( "epr12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) ) | |
| 2199 | ROM_LOAD( "epr12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) ) | |
| 2200 | ROM_LOAD( "epr12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977)) | |
| 2201 | ||
| 2202 | ROM_REGION32_LE( 0x200000, REGION_GFX2, 0 ) /* sprites */ | |
| 2203 | ROM_LOAD32_BYTE( "mpr12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) ) | |
| 2204 | ROM_LOAD32_BYTE( "mpr12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) ) | |
| 2205 | ROM_LOAD32_BYTE( "mpr12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) ) | |
| 2206 | ROM_LOAD32_BYTE( "mpr12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) ) | |
| 2207 | ROM_LOAD32_BYTE( "mpr12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) ) | |
| 2208 | ROM_LOAD32_BYTE( "mpr12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) ) | |
| 2209 | ROM_LOAD32_BYTE( "mpr12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) ) | |
| 2210 | ROM_LOAD32_BYTE( "mpr12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) ) | |
| 2211 | ROM_LOAD32_BYTE( "mpr12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) ) | |
| 2212 | ROM_LOAD32_BYTE( "mpr12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) ) | |
| 2213 | ROM_LOAD32_BYTE( "mpr12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) ) | |
| 2214 | ROM_LOAD32_BYTE( "mpr12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) ) | |
| 2215 | ROM_LOAD32_BYTE( "epr12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) ) | |
| 2216 | ROM_LOAD32_BYTE( "epr12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) ) | |
| 2217 | ROM_LOAD32_BYTE( "epr12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) ) | |
| 2218 | ROM_LOAD32_BYTE( "epr12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) ) | |
| 2219 | ||
| 2220 | ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_ERASE00 ) /* road gfx */ | |
| 2221 | /* none?? */ | |
| 2222 | ||
| 2223 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* sound CPU */ | |
| 2224 | ROM_LOAD( "epr12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) ) | |
| 2225 | ||
| 2226 | ROM_REGION( 0x80000, REGION_SOUND1, ROMREGION_ERASEFF ) /* Sega PCM sound data */ | |
| 2227 | ROM_LOAD( "mpr12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) | |
| 2228 | ROM_LOAD( "mpr12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) | |
| 2229 | ROM_LOAD( "mpr12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) | |
| 2230 | ||
| 2231 | ROM_REGION( 0x10000, REGION_CPU4, 0 ) /* comms */ | |
| 2232 | ROM_LOAD( "epr12587.14", 0x00000, 0x8000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) | |
| 2233 | ROM_END | |
| 2234 | ||
| 2235 | ||
| 2182 | 2236 | /************************************************************************************************************************** |
| 2183 | 2237 | ************************************************************************************************************************** |
| 2184 | 2238 | ************************************************************************************************************************** |
| r2375 | r2376 | |
| 2423 | 2477 | GAME( 1989, loffireu, loffire, xboard, loffire, loffire, ROT0, "Sega", "Line of Fire / Bakudan Yarou (US, FD1094 317-0135)", 0 ) |
| 2424 | 2478 | GAME( 1989, loffirej, loffire, xboard, loffire, loffire, ROT0, "Sega", "Line of Fire / Bakudan Yarou (Japan, FD1094 317-0134)", 0 ) |
| 2425 | 2479 | GAME( 1989, rachero, 0, xboard, rachero, generic_xboard, ROT0, "Sega", "Racing Hero (FD1094 317-0144)", 0 ) |
| 2426 | GAME( 1989, smgp, 0, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 8, World, Rev B, 'Twin', FD1094 317-0126a)", 0 ) | |
| 2427 | GAME( 1989, smgp6, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 7, World, Rev A, FD1094 317-0126a)", 0 ) | |
| 2428 | GAME( 1989, smgp5, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 6, World, 'Air Drive Cabinet', FD1094 317-0126)", 0 ) | |
| 2429 | GAME( 1989, smgpu, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 5, US, Rev C, FD1094 317-0125a)", 0 ) | |
| 2430 | GAME( 1989, smgpu1, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 4, US, Rev B, FD1094 317-0125a)", 0 ) | |
| 2431 | GAME( 1989, smgpu2, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 3, US, Rev A, FD1094 317-0125a)", 0 ) | |
| 2432 | GAME( 1989, smgpu3, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 2, US, FD1094 317-0125a)", 0 ) | |
| 2433 | GAME( 1989, smgpj, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 1, Japan, Rev B, FD1094 317-0124a)", 0 ) | |
| 2480 | GAME( 1989, smgp, 0, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 9, World, Rev B, 'Twin', FD1094 317-0126a)", 0 ) | |
| 2481 | GAME( 1989, smgp6, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 8, World, Rev A, FD1094 317-0126a)", 0 ) | |
| 2482 | GAME( 1989, smgp5, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 7, World, 'Air Drive Cabinet', FD1094 317-0126)", 0 ) | |
| 2483 | GAME( 1989, smgpu, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 6, US, Rev C, FD1094 317-0125a)", 0 ) | |
| 2484 | GAME( 1989, smgpu1, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 5, US, Rev B, FD1094 317-0125a)", 0 ) | |
| 2485 | GAME( 1989, smgpu2, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 4, US, Rev A, FD1094 317-0125a)", 0 ) | |
| 2486 | GAME( 1989, smgpu3, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 3, US, FD1094 317-0125a)", 0 ) | |
| 2487 | GAME( 1989, smgpj, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 2, Japan, Rev B, FD1094 317-0124a)", 0 ) | |
| 2488 | GAME( 1989, smgpja, smgp, smgp, smgp, smgp, ROT0, "Sega", "Super Monaco GP (set 1, Japan, Rev A, FD1094 317-0124a)", 0 ) | |
| 2434 | 2489 | GAME( 1990, abcop, 0, xboard, abcop, generic_xboard, ROT0, "Sega", "A.B. Cop (FD1094 317-0169b)", 0 ) |
| 2435 | 2490 | GAME( 1990, gprider, 0, xboard, gprider, gprider, ROT0, "Sega", "GP Rider (set 2, World, FD1094 317-0163)", GAME_NOT_WORKING ) // no prg roms |
| 2436 | 2491 | GAME( 1990, gprider1, gprider, xboard, gprider, gprider, ROT0, "Sega", "GP Rider (set 1, US, FD1094 317-0162)", 0 ) |
| r2375 | r2376 | |
|---|---|---|
| 117 | 117 | nbmj9195_inputport = (data ^ 0xff); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | static int nbmj9195_dipsw_r( | |
| 120 | static int nbmj9195_dipsw_r(running_machine *machine) | |
| 121 | 121 | { |
| 122 | return (((( | |
| 122 | return (((( | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | static void nbmj9195_dipswbitsel_w(int data) |
| r2375 | r2376 | |
| 149 | 149 | static READ8_HANDLER( mscoutm_dipsw_0_r ) |
| 150 | 150 | { |
| 151 | 151 | // DIPSW A |
| 152 | return (((readinputport(0) & 0x01) << 7) | ((readinputport(0) & 0x02) << 5) | | |
| 153 | ((readinputport(0) & 0x04) << 3) | ((readinputport(0) & 0x08) << 1) | | |
| 154 | ((readinputport(0) & 0x10) >> 1) | ((readinputport(0) & 0x20) >> 3) | | |
| 155 | ((readinputport(0) & 0x40) >> 5) | ((readinputport(0) & 0x80) >> 7)); | |
| 152 | return (((input_port_read_indexed(machine, 0) & 0x01) << 7) | ((input_port_read_indexed(machine, 0) & 0x02) << 5) | | |
| 153 | ((input_port_read_indexed(machine, 0) & 0x04) << 3) | ((input_port_read_indexed(machine, 0) & 0x08) << 1) | | |
| 154 | ((input_port_read_indexed(machine, 0) & 0x10) >> 1) | ((input_port_read_indexed(machine, 0) & 0x20) >> 3) | | |
| 155 | ((input_port_read_indexed(machine, 0) & 0x40) >> 5) | ((input_port_read_indexed(machine, 0) & 0x80) >> 7)); | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | static READ8_HANDLER( mscoutm_dipsw_1_r ) |
| 159 | 159 | { |
| 160 | 160 | // DIPSW B |
| 161 | return (((readinputport(1) & 0x01) << 7) | ((readinputport(1) & 0x02) << 5) | | |
| 162 | ((readinputport(1) & 0x04) << 3) | ((readinputport(1) & 0x08) << 1) | | |
| 163 | ((readinputport(1) & 0x10) >> 1) | ((readinputport(1) & 0x20) >> 3) | | |
| 164 | ((readinputport(1) & 0x40) >> 5) | ((readinputport(1) & 0x80) >> 7)); | |
| 161 | return (((input_port_read_indexed(machine, 1) & 0x01) << 7) | ((input_port_read_indexed(machine, 1) & 0x02) << 5) | | |
| 162 | ((input_port_read_indexed(machine, 1) & 0x04) << 3) | ((input_port_read_indexed(machine, 1) & 0x08) << 1) | | |
| 163 | ((input_port_read_indexed(machine, 1) & 0x10) >> 1) | ((input_port_read_indexed(machine, 1) & 0x20) >> 3) | | |
| 164 | ((input_port_read_indexed(machine, 1) & 0x40) >> 5) | ((input_port_read_indexed(machine, 1) & 0x80) >> 7)); | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
| r2375 | r2376 | |
| 182 | 182 | { |
| 183 | 183 | case 0: /* PA_0 */ |
| 184 | 184 | // COIN IN, ETC... |
| 185 | portdata = | |
| 185 | portdata = | |
| 186 | 186 | break; |
| 187 | 187 | case 1: /* PB_0 */ |
| 188 | 188 | // PLAYER1 KEY, DIPSW A/B |
| 189 | 189 | switch (mscoutm_inputport) |
| 190 | 190 | { |
| 191 | 191 | case 0x01: |
| 192 | portdata = | |
| 192 | portdata = | |
| 193 | 193 | break; |
| 194 | 194 | case 0x02: |
| 195 | portdata = | |
| 195 | portdata = | |
| 196 | 196 | break; |
| 197 | 197 | case 0x04: |
| 198 | portdata = | |
| 198 | portdata = | |
| 199 | 199 | break; |
| 200 | 200 | case 0x08: |
| 201 | portdata = | |
| 201 | portdata = | |
| 202 | 202 | break; |
| 203 | 203 | case 0x10: |
| 204 | portdata = | |
| 204 | portdata = | |
| 205 | 205 | break; |
| 206 | 206 | default: |
| 207 | portdata = ( | |
| 207 | portdata = ( | |
| 208 | 208 | break; |
| 209 | 209 | } |
| 210 | 210 | break; |
| r2375 | r2376 | |
| 213 | 213 | switch (mscoutm_inputport) |
| 214 | 214 | { |
| 215 | 215 | case 0x01: |
| 216 | portdata = | |
| 216 | portdata = | |
| 217 | 217 | break; |
| 218 | 218 | case 0x02: |
| 219 | portdata = | |
| 219 | portdata = | |
| 220 | 220 | break; |
| 221 | 221 | case 0x04: |
| 222 | portdata = | |
| 222 | portdata = | |
| 223 | 223 | break; |
| 224 | 224 | case 0x08: |
| 225 | portdata = | |
| 225 | portdata = | |
| 226 | 226 | break; |
| 227 | 227 | case 0x10: |
| 228 | portdata = | |
| 228 | portdata = | |
| 229 | 229 | break; |
| 230 | 230 | default: |
| 231 | portdata = ( | |
| 231 | portdata = ( | |
| 232 | 232 | break; |
| 233 | 233 | } |
| 234 | 234 | break; |
| r2375 | r2376 | |
| 267 | 267 | { |
| 268 | 268 | case 0: /* PA_0 */ |
| 269 | 269 | // COIN IN, ETC... |
| 270 | portdata = (( | |
| 270 | portdata = (( | |
| 271 | 271 | break; |
| 272 | 272 | case 1: /* PB_0 */ |
| 273 | 273 | // PLAYER1 KEY, DIPSW A/B |
| 274 | 274 | switch (nbmj9195_inputport) |
| 275 | 275 | { |
| 276 | 276 | case 0x01: |
| 277 | portdata = | |
| 277 | portdata = | |
| 278 | 278 | break; |
| 279 | 279 | case 0x02: |
| 280 | portdata = | |
| 280 | portdata = | |
| 281 | 281 | break; |
| 282 | 282 | case 0x04: |
| 283 | portdata = | |
| 283 | portdata = | |
| 284 | 284 | break; |
| 285 | 285 | case 0x08: |
| 286 | portdata = | |
| 286 | portdata = | |
| 287 | 287 | break; |
| 288 | 288 | case 0x10: |
| 289 | portdata = (( | |
| 289 | portdata = (( | |
| 290 | 290 | break; |
| 291 | 291 | default: |
| 292 | portdata = ( | |
| 292 | portdata = ( | |
| 293 | 293 | break; |
| 294 | 294 | } |
| 295 | 295 | break; |
| r2375 | r2376 | |
| 298 | 298 | switch (nbmj9195_inputport) |
| 299 | 299 | { |
| 300 | 300 | case 0x01: |
| 301 | portdata = | |
| 301 | portdata = | |
| 302 | 302 | break; |
| 303 | 303 | case 0x02: |
| 304 | portdata = | |
| 304 | portdata = | |
| 305 | 305 | break; |
| 306 | 306 | case 0x04: |
| 307 | portdata = | |
| 307 | portdata = | |
| 308 | 308 | break; |
| 309 | 309 | case 0x08: |
| 310 | portdata = | |
| 310 | portdata = | |
| 311 | 311 | break; |
| 312 | 312 | case 0x10: |
| 313 | portdata = | |
| 313 | portdata = | |
| 314 | 314 | break; |
| 315 | 315 | default: |
| 316 | portdata = ( | |
| 316 | portdata = ( | |
| 317 | 317 | break; |
| 318 | 318 | } |
| 319 | 319 | break; |
| r2375 | r2376 | |
|---|---|---|
| 53 | 53 | #include "sound/ay8910.h" |
| 54 | 54 | |
| 55 | 55 | |
| 56 | extern UINT8 *sonson_scroll; | |
| 57 | ||
| 58 | 56 | WRITE8_HANDLER( sonson_videoram_w ); |
| 59 | 57 | WRITE8_HANDLER( sonson_colorram_w ); |
| 60 | WRITE8_HANDLER( sonson_scroll_w ); | |
| 58 | WRITE8_HANDLER( sonson_scrollx_w ); | |
| 61 | 59 | WRITE8_HANDLER( sonson_flipscreen_w ); |
| 62 | 60 | |
| 63 | 61 | PALETTE_INIT( sonson ); |
| r2375 | r2376 | |
| 68 | 66 | { |
| 69 | 67 | static int last; |
| 70 | 68 | |
| 69 | data &= 1; | |
| 70 | ||
| 71 | 71 | if (last == 0 && data == 1) |
| 72 | 72 | { |
| 73 | 73 | /* setting bit 0 low then high triggers IRQ on the sound CPU */ |
| r2375 | r2376 | |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | |
| 82 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 83 | AM_RANGE(0x0000, 0x17ff) AM_READ(SMH_RAM) | |
| 84 | AM_RANGE(0x4000, 0xffff) AM_READ(SMH_ROM) | |
| 82 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 83 | AM_RANGE(0x0000, 0x0fff) AM_RAM | |
| 84 | AM_RANGE(0x1000, 0x13ff) AM_RAM AM_WRITE(sonson_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) | |
| 85 | AM_RANGE(0x1400, 0x17ff) AM_RAM AM_WRITE(sonson_colorram_w) AM_BASE(&colorram) | |
| 86 | AM_RANGE(0x2020, 0x207f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 87 | AM_RANGE(0x3000, 0x3000) AM_WRITE(sonson_scrollx_w) | |
| 85 | 88 | AM_RANGE(0x3002, 0x3002) AM_READ(input_port_0_r) /* IN0 */ |
| 86 | 89 | AM_RANGE(0x3003, 0x3003) AM_READ(input_port_1_r) /* IN1 */ |
| 87 | 90 | AM_RANGE(0x3004, 0x3004) AM_READ(input_port_2_r) /* IN2 */ |
| 88 | 91 | AM_RANGE(0x3005, 0x3005) AM_READ(input_port_3_r) /* DSW0 */ |
| 89 | 92 | AM_RANGE(0x3006, 0x3006) AM_READ(input_port_4_r) /* DSW1 */ |
| 90 | ADDRESS_MAP_END | |
| 91 | ||
| 92 | static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 93 | AM_RANGE(0x0000, 0x0fff) AM_WRITE(SMH_RAM) | |
| 94 | AM_RANGE(0x1000, 0x13ff) AM_WRITE(sonson_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) | |
| 95 | AM_RANGE(0x1400, 0x17ff) AM_WRITE(sonson_colorram_w) AM_BASE(&colorram) | |
| 96 | AM_RANGE(0x2020, 0x207f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 97 | AM_RANGE(0x3000, 0x3000) AM_WRITE(SMH_RAM) AM_BASE(&sonson_scroll) | |
| 98 | AM_RANGE(0x3008, 0x3008) AM_WRITE(SMH_NOP) | |
| 93 | AM_RANGE(0x3008, 0x3008) AM_WRITENOP // might be Y scroll, but the game always sets it to 0 | |
| 99 | 94 | AM_RANGE(0x3010, 0x3010) AM_WRITE(soundlatch_w) |
| 100 | 95 | AM_RANGE(0x3018, 0x3018) AM_WRITE(sonson_flipscreen_w) |
| 101 | 96 | AM_RANGE(0x3019, 0x3019) AM_WRITE(sonson_sh_irqtrigger_w) |
| 102 | AM_RANGE(0x4000, 0xffff) AM_ | |
| 97 | AM_RANGE(0x4000, 0xffff) AM_ | |
| 103 | 98 | ADDRESS_MAP_END |
| 104 | 99 | |
| 105 | static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 106 | AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM) | |
| 107 | AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) | |
| 108 | AM_RANGE(0xe000, 0xffff) AM_READ(SMH_ROM) | |
| 109 | ADDRESS_MAP_END | |
| 110 | ||
| 111 | static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 112 | AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM) | |
| 100 | static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 101 | AM_RANGE(0x0000, 0x07ff) AM_RAM | |
| 113 | 102 | AM_RANGE(0x2000, 0x2000) AM_WRITE(AY8910_control_port_0_w) |
| 114 | 103 | AM_RANGE(0x2001, 0x2001) AM_WRITE(AY8910_write_port_0_w) |
| 115 | 104 | AM_RANGE(0x4000, 0x4000) AM_WRITE(AY8910_control_port_1_w) |
| 116 | 105 | AM_RANGE(0x4001, 0x4001) AM_WRITE(AY8910_write_port_1_w) |
| 117 | AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_ROM) | |
| 106 | AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) | |
| 107 | AM_RANGE(0xe000, 0xffff) AM_ROM | |
| 118 | 108 | ADDRESS_MAP_END |
| 119 | 109 | |
| 120 | 110 | |
| r2375 | r2376 | |
| 239 | 229 | |
| 240 | 230 | /* basic machine hardware */ |
| 241 | 231 | MDRV_CPU_ADD(M6809,12000000/6) /* 2 MHz ??? */ |
| 242 | MDRV_CPU_PROGRAM_MAP( | |
| 232 | MDRV_CPU_PROGRAM_MAP( | |
| 243 | 233 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| 244 | 234 | |
| 245 | 235 | MDRV_CPU_ADD(M6809,12000000/6) |
| 246 | 236 | /* audio CPU */ /* 2 MHz ??? */ |
| 247 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 237 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 248 | 238 | MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4) /* FIRQs are triggered by the main CPU */ |
| 249 | 239 | |
| 250 | 240 | |
| 251 | 241 | /* video hardware */ |
| 252 | 242 | MDRV_SCREEN_ADD("main", RASTER) |
| 253 | 243 | MDRV_SCREEN_REFRESH_RATE(60) |
| 254 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 255 | 244 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 256 | 245 | MDRV_SCREEN_SIZE(32*8, 32*8) |
| 257 | 246 | MDRV_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 1*8, 31*8-1) |
| r2375 | r2376 | |
|---|---|---|
| 141 | 141 | int eep = EEPROM_read_bit(); |
| 142 | 142 | UINT32 returndata; |
| 143 | 143 | |
| 144 | returndata = | |
| 144 | returndata = | |
| 145 | 145 | |
| 146 | 146 | returndata^= ( (eep<<8) ); |
| 147 | 147 | return returndata; |
| r2375 | r2376 | |
| 172 | 172 | { |
| 173 | 173 | UINT32 returndata; |
| 174 | 174 | |
| 175 | returndata = | |
| 175 | returndata = | |
| 176 | 176 | |
| 177 | 177 | return returndata; |
| 178 | 178 | } |
| r2375 | r2376 | |
|---|---|---|
| 53 | 53 | |
| 54 | 54 | static READ16_HANDLER( ghunter_trackball_low_r ) |
| 55 | 55 | { |
| 56 | return ( | |
| 56 | return ( | |
| 57 | 57 | } |
| 58 | 58 | static READ16_HANDLER( ghunter_trackball_high_r ) |
| 59 | 59 | { |
| 60 | return (( | |
| 60 | return (( | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /* Memory Maps */ |
| r2375 | r2376 | |
|---|---|---|
| 165 | 165 | { |
| 166 | 166 | if ( port_bank < 7 ) |
| 167 | 167 | { |
| 168 | return | |
| 168 | return | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /* output is pulled up for non-mapped ports */ |
| r2375 | r2376 | |
|---|---|---|
| 82 | 82 | |
| 83 | 83 | static READ8_HANDLER( copsnrob_misc_r ) |
| 84 | 84 | { |
| 85 | return misc | ( | |
| 85 | return misc | ( | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | static WRITE8_HANDLER( copsnrob_misc_w ) |
| r2375 | r2376 | |
|---|---|---|
| 148 | 148 | hack_irq = 0; |
| 149 | 149 | update_irq_state(Machine); |
| 150 | 150 | } |
| 151 | return | |
| 151 | return | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
| r2375 | r2376 | |
| 378 | 378 | |
| 379 | 379 | static READ16_HANDLER( special_port5_r ) |
| 380 | 380 | { |
| 381 | return | |
| 381 | return | |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 |
| r2375 | r2376 | |
|---|---|---|
| 1080 | 1080 | |
| 1081 | 1081 | static DRIVER_INIT( twincobr ) |
| 1082 | 1082 | { |
| 1083 | twincobr_driver_savestate(); | |
| 1083 | twincobr_driver_savestate(machine); | |
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 |
| r2375 | r2376 | |
|---|---|---|
| 148 | 148 | case 3: |
| 149 | 149 | case 4: |
| 150 | 150 | case 5: |
| 151 | return | |
| 151 | return | |
| 152 | 152 | |
| 153 | 153 | /* busy flag; this is polled to check the custom CPU's readiness */ |
| 154 | 154 | /* we just toggle it on and off until the main CPU gets the result */ |
| r2375 | r2376 | |
|---|---|---|
| 596 | 596 | if (ACCESSING_BITS_24_31) |
| 597 | 597 | { |
| 598 | 598 | //printf("read sysreg 0\n"); |
| 599 | r |= | |
| 599 | r |= | |
| 600 | 600 | } |
| 601 | 601 | if (ACCESSING_BITS_16_23) |
| 602 | 602 | { |
| 603 | r |= | |
| 603 | r |= | |
| 604 | 604 | } |
| 605 | 605 | if (ACCESSING_BITS_8_15) |
| 606 | 606 | { |
| 607 | r |= | |
| 607 | r |= | |
| 608 | 608 | } |
| 609 | 609 | if (ACCESSING_BITS_0_7) |
| 610 | 610 | { |
| r2375 | r2376 | |
| 615 | 615 | { |
| 616 | 616 | if (ACCESSING_BITS_24_31) |
| 617 | 617 | { |
| 618 | r |= | |
| 618 | r |= | |
| 619 | 619 | } |
| 620 | 620 | } |
| 621 | 621 | return r; |
| r2375 | r2376 | |
|---|---|---|
| 53 | 53 | static INTERRUPT_GEN( thief_interrupt ) |
| 54 | 54 | { |
| 55 | 55 | /* SLAM switch causes an NMI if it's pressed */ |
| 56 | if( (input_port_ | |
| 56 | if( (input_port_ | |
| 57 | 57 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 58 | 58 | else |
| 59 | 59 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| r2375 | r2376 | |
| 158 | 158 | { |
| 159 | 159 | switch( thief_input_select ) |
| 160 | 160 | { |
| 161 | case 0x01: return readinputport(0); /* dsw#1 */ | |
| 162 | case 0x02: return readinputport(1); /* dsw#2 */ | |
| 163 | case 0x04: return readinputport(2); /* inp#1 */ | |
| 164 | case 0x08: return readinputport(3); /* inp#2 */ | |
| 161 | case 0x01: return input_port_read_indexed(machine, 0); /* dsw#1 */ | |
| 162 | case 0x02: return input_port_read_indexed(machine, 1); /* dsw#2 */ | |
| 163 | case 0x04: return input_port_read_indexed(machine, 2); /* inp#1 */ | |
| 164 | case 0x08: return input_port_read_indexed(machine, 3); /* inp#2 */ | |
| 165 | 165 | } |
| 166 | 166 | return 0x00; |
| 167 | 167 | } |
| r2375 | r2376 | |
|---|---|---|
| 291 | 291 | |
| 292 | 292 | static READ8_HANDLER( leta_r ) |
| 293 | 293 | { |
| 294 | return | |
| 294 | return | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 |
| r2375 | r2376 | |
|---|---|---|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | static int service_mode( | |
| 50 | static int service_mode(running_machine *machine) | |
| 51 | 51 | { |
| 52 | UINT8 v = | |
| 52 | UINT8 v = | |
| 53 | 53 | |
| 54 | 54 | if (GAME_IS_SPRINT1) |
| 55 | 55 | { |
| r2375 | r2376 | |
| 80 | 80 | |
| 81 | 81 | for (i = 0; i < 2; i++) |
| 82 | 82 | { |
| 83 | signed char delta = | |
| 83 | signed char delta = | |
| 84 | 84 | |
| 85 | 85 | if (delta < 0) |
| 86 | 86 | { |
| r2375 | r2376 | |
| 93 | 93 | |
| 94 | 94 | dial[i] += delta; |
| 95 | 95 | |
| 96 | switch ( | |
| 96 | switch ( | |
| 97 | 97 | { |
| 98 | 98 | case 1: gear[i] = 1; break; |
| 99 | 99 | case 2: gear[i] = 2; break; |
| r2375 | r2376 | |
| 109 | 109 | |
| 110 | 110 | /* interrupts and watchdog are disabled during service mode */ |
| 111 | 111 | |
| 112 | watchdog_enable(machine, !service_mode()); | |
| 112 | watchdog_enable(machine, !service_mode(machine)); | |
| 113 | 113 | |
| 114 | if (!service_mode()) | |
| 114 | if (!service_mode(machine)) | |
| 115 | 115 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 116 | 116 | } |
| 117 | 117 | |
| r2375 | r2376 | |
| 124 | 124 | |
| 125 | 125 | static READ8_HANDLER( sprint2_dip_r ) |
| 126 | 126 | { |
| 127 | return ( | |
| 127 | return ( | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
| 131 | 131 | static READ8_HANDLER( sprint2_input_A_r ) |
| 132 | 132 | { |
| 133 | UINT8 val = | |
| 133 | UINT8 val = | |
| 134 | 134 | |
| 135 | 135 | if (GAME_IS_SPRINT2) |
| 136 | 136 | { |
| r2375 | r2376 | |
| 148 | 148 | |
| 149 | 149 | static READ8_HANDLER( sprint2_input_B_r ) |
| 150 | 150 | { |
| 151 | UINT8 val = | |
| 151 | UINT8 val = | |
| 152 | 152 | |
| 153 | 153 | if (GAME_IS_SPRINT1) |
| 154 | 154 | { |
| r2375 | r2376 | |
|---|---|---|
| 140 | 140 | UINT16 port; |
| 141 | 141 | |
| 142 | 142 | /* Read the fake input port */ |
| 143 | UINT8 trackball_pos = | |
| 143 | UINT8 trackball_pos = | |
| 144 | 144 | |
| 145 | 145 | /* Calculate the change from the last position. */ |
| 146 | 146 | UINT8 trackball_diff = trackball_old[which] - trackball_pos; |
| r2375 | r2376 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | for (i = 0; i < 2; i++) |
| 22 | 22 | { |
| 23 | switch ( | |
| 23 | switch ( | |
| 24 | 24 | { |
| 25 | 25 | case 0x01: dragrace_gear[i] = 1; break; |
| 26 | 26 | case 0x02: dragrace_gear[i] = 2; break; |
| r2375 | r2376 | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /* watchdog is disabled during service mode */ |
| 34 | watchdog_enable(machine, | |
| 34 | watchdog_enable(machine, | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| r2375 | r2376 | |
| 116 | 116 | |
| 117 | 117 | static READ8_HANDLER( dragrace_input_r ) |
| 118 | 118 | { |
| 119 | int val = | |
| 119 | int val = | |
| 120 | 120 | |
| 121 | 121 | UINT8 maskA = 1 << (offset % 8); |
| 122 | 122 | UINT8 maskB = 1 << (offset / 8); |
| r2375 | r2376 | |
| 125 | 125 | |
| 126 | 126 | for (i = 0; i < 2; i++) |
| 127 | 127 | { |
| 128 | int in = | |
| 128 | int in = | |
| 129 | 129 | |
| 130 | 130 | if (dragrace_gear[i] != 0) |
| 131 | 131 | { |
| r2375 | r2376 | |
| 151 | 151 | |
| 152 | 152 | for (i = 0; i < 2; i++) |
| 153 | 153 | { |
| 154 | int dial = | |
| 154 | int dial = | |
| 155 | 155 | |
| 156 | 156 | bitA[i] = ((dial + 1) / 2) & 1; |
| 157 | 157 | bitB[i] = ((dial + 0) / 2) & 1; |
| r2375 | r2376 | |
|---|---|---|
| 508 | 508 | |
| 509 | 509 | if (ACCESSING_BITS_8_15) |
| 510 | 510 | { |
| 511 | UINT8 nibble = parallel_latched;//( | |
| 511 | UINT8 nibble = parallel_latched;//( | |
| 512 | 512 | r |= ((~nibble & 0x08) << 12) | ((nibble & 0x07) << 11); |
| 513 | 513 | logerror("%08X:parallel_port_r()\n", activecpu_get_pc()); |
| 514 | 514 | /* if (controls_data == 0x18) |
| 515 | 515 | { |
| 516 | r |= | |
| 516 | r |= | |
| 517 | 517 | } |
| 518 | 518 | else if (controls_data == 0x60) |
| 519 | 519 | { |
| 520 | r |= | |
| 520 | r |= | |
| 521 | 521 | } |
| 522 | 522 | else if (controls_data == 0xff || controls_data == 0x50) |
| 523 | 523 | { |
| 524 | r |= | |
| 524 | r |= | |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | //r |= control_read << 8;*/ |
| r2375 | r2376 | |
| 557 | 557 | |
| 558 | 558 | logerror("%08X:", activecpu_get_pc()); |
| 559 | 559 | |
| 560 | parallel_latched = ( | |
| 560 | parallel_latched = ( | |
| 561 | 561 | // parallel_pointer++; |
| 562 | 562 | // logerror("[%02X] Advance pointer to %d\n", data, parallel_pointer); |
| 563 | 563 | switch (data & 0xfc) |
| r2375 | r2376 | |
| 814 | 814 | |
| 815 | 815 | static const struct dma8237_interface dma8237_2_config = |
| 816 | 816 | { |
| 817 | 0, | |
| 818 | 1.0e-6, // 1us | |
| 817 | 0, | |
| 818 | 1.0e-6, // 1us | |
| 819 | 819 | |
| 820 | 820 | NULL, |
| 821 | 821 | NULL, |
| r2375 | r2376 | |
| 1066 | 1066 | pic8259_set_irq_line(1, 6, state); |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | static int mediagx_get_out2(running_machine *machine) { | |
| 1070 | return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2 ); | |
| 1071 | } | |
| 1072 | ||
| 1069 | 1073 | static const struct kbdc8042_interface at8042 = |
| 1070 | 1074 | { |
| 1071 | KBDC8042_AT386, set_gate_a20, keyboard_interrupt | |
| 1075 | KBDC8042_AT386, set_gate_a20, keyboard_interrupt, mediagx_get_out2 | |
| 1072 | 1076 | }; |
| 1073 | 1077 | |
| 1074 | 1078 | static const struct ide_interface ide_intf = |
| r2375 | r2376 | |
|---|---|---|
| 141 | 141 | |
| 142 | 142 | static READ32_HANDLER( port0_r ) |
| 143 | 143 | { |
| 144 | return | |
| 144 | return | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | static READ32_HANDLER( port1_r ) |
| 149 | 149 | { |
| 150 | return ( | |
| 150 | return ( | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | static READ32_HANDLER( port2_r ) |
| 155 | 155 | { |
| 156 | return | |
| 156 | return | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 |
| r2375 | r2376 | |
|---|---|---|
| 923 | 923 | static READ32_HANDLER( spi_controls1_r ) |
| 924 | 924 | { |
| 925 | 925 | if( ACCESSING_BITS_0_7 ) { |
| 926 | return ( | |
| 926 | return ( | |
| 927 | 927 | } |
| 928 | 928 | return 0xffffffff; |
| 929 | 929 | } |
| r2375 | r2376 | |
| 931 | 931 | static READ32_HANDLER( spi_controls2_r ) |
| 932 | 932 | { |
| 933 | 933 | if( ACCESSING_BITS_0_7 ) { |
| 934 | return (( | |
| 934 | return (( | |
| 935 | 935 | } |
| 936 | 936 | return 0xffffffff; |
| 937 | 937 | } |
| r2375 | r2376 | |
| 995 | 995 | |
| 996 | 996 | static READ8_HANDLER( z80_jp1_r ) |
| 997 | 997 | { |
| 998 | return | |
| 998 | return | |
| 999 | 999 | } |
| 1000 | 1000 | |
| 1001 | 1001 | static READ8_HANDLER( z80_coin_r ) |
| 1002 | 1002 | { |
| 1003 | return | |
| 1003 | return | |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | static READ32_HANDLER( soundrom_r ) |
| r2375 | r2376 | |
| 1971 | 1971 | cpu_spinuntil_int(); // idle |
| 1972 | 1972 | // Hack to enter test mode |
| 1973 | 1973 | r = spimainram[(0x002894c-0x800)/4] & (~0x400); |
| 1974 | return r | ((( | |
| 1974 | return r | ((( | |
| 1975 | 1975 | } |
| 1976 | 1976 | |
| 1977 | 1977 | /* rfjetj */ |
| r2375 | r2376 | |
|---|---|---|
| 255 | 255 | break; |
| 256 | 256 | |
| 257 | 257 | case 0x100: |
| 258 | iop_answer = (INT8)(- | |
| 258 | iop_answer = (INT8)(- | |
| 259 | 259 | break; |
| 260 | 260 | case 0x101: |
| 261 | iop_answer = (INT8)(- | |
| 261 | iop_answer = (INT8)(- | |
| 262 | 262 | break; |
| 263 | 263 | case 0x102: |
| 264 | iop_answer = (INT8)(- | |
| 264 | iop_answer = (INT8)(- | |
| 265 | 265 | break; |
| 266 | 266 | case 0x103: |
| 267 | iop_answer = (INT8)(- | |
| 267 | iop_answer = (INT8)(- | |
| 268 | 268 | break; |
| 269 | 269 | |
| 270 | 270 | case 0x500: |
| 271 | iop_answer = | |
| 271 | iop_answer = | |
| 272 | 272 | break; |
| 273 | 273 | } |
| 274 | 274 | |
| r2375 | r2376 | |
| 420 | 420 | static UINT8 oldx, oldy; |
| 421 | 421 | static UINT16 lastresult; |
| 422 | 422 | |
| 423 | int result = (readinputportbytag("IN1") & 0x00ff) | (lastresult & 0xff00); | |
| 424 | UINT8 newx = readinputportbytag("XAXIS"); | |
| 425 | UINT8 newy = readinputportbytag("YAXIS"); | |
| 423 | int result = (input_port_read(machine, "IN1") & 0x00ff) | (lastresult & 0xff00); | |
| 424 | UINT8 newx = input_port_read(machine, "XAXIS"); | |
| 425 | UINT8 newy = input_port_read(machine, "YAXIS"); | |
| 426 | 426 | int dx = (INT8)(newx - oldx); |
| 427 | 427 | int dy = (INT8)(newy - oldy); |
| 428 | 428 |
| r2375 | r2376 | |
|---|---|---|
| 180 | 180 | |
| 181 | 181 | ***************************************************************************/ |
| 182 | 182 | |
| 183 | static READ8_HANDLER( in0_l ) { return readinputport(0); } // P1 joystick | |
| 184 | static READ8_HANDLER( in0_h ) { return readinputport(0) >> 4; } // P2 joystick | |
| 185 | static READ8_HANDLER( in1_l ) { return readinputport(1); } // fire and start buttons | |
| 186 | static READ8_HANDLER( in1_h ) { return readinputport(1) >> 4; } // coins | |
| 187 | static READ8_HANDLER( dipA_l ) { return readinputport(2); } // dips A | |
| 188 | static READ8_HANDLER( dipA_h ) { return readinputport(2) >> 4; } // dips A | |
| 189 | static READ8_HANDLER( dipB_l ) { return readinputport(3); } // dips B | |
| 190 | static READ8_HANDLER( dipB_h ) { return readinputport(3) >> 4; } // dips B | |
| 183 | static READ8_HANDLER( in0_l ) { return input_port_read_indexed(machine, 0); } // P1 joystick | |
| 184 | static READ8_HANDLER( in0_h ) { return input_port_read_indexed(machine, 0) >> 4; } // P2 joystick | |
| 185 | static READ8_HANDLER( in1_l ) { return input_port_read_indexed(machine, 1); } // fire and start buttons | |
| 186 | static READ8_HANDLER( in1_h ) { return input_port_read_indexed(machine, 1) >> 4; } // coins | |
| 187 | static READ8_HANDLER( dipA_l ) { return input_port_read_indexed(machine, 2); } // dips A | |
| 188 | static READ8_HANDLER( dipA_h ) { return input_port_read_indexed(machine, 2) >> 4; } // dips A | |
| 189 | static READ8_HANDLER( dipB_l ) { return input_port_read_indexed(machine, 3); } // dips B | |
| 190 | static READ8_HANDLER( dipB_h ) { return input_port_read_indexed(machine, 3) >> 4; } // dips B | |
| 191 | 191 | static WRITE8_HANDLER( out_lamps0 ) |
| 192 | 192 | { |
| 193 | 193 | set_led_status(0,data & 1); |
| r2375 | r2376 | |
|---|---|---|
| 96 | 96 | { |
| 97 | 97 | case 0x02: |
| 98 | 98 | { |
| 99 | switch( | |
| 99 | switch( | |
| 100 | 100 | { |
| 101 | 101 | case 0x002: return 0x02; |
| 102 | 102 | case 0x001: return 0x01; |
| r2375 | r2376 | |
| 115 | 115 | } |
| 116 | 116 | case 0x04: |
| 117 | 117 | { |
| 118 | switch( | |
| 118 | switch( | |
| 119 | 119 | { |
| 120 | 120 | case 0x002: return 0x02; |
| 121 | 121 | case 0x001: return 0x01; |
| r2375 | r2376 | |
|---|---|---|
| 248 | 248 | { |
| 249 | 249 | UINT8 dipsw_a, dipsw_b; |
| 250 | 250 | |
| 251 | dipsw_a = (((readinputport(0) & 0x01) << 7) | ((readinputport(0) & 0x02) << 5) | | |
| 252 | ((readinputport(0) & 0x04) << 3) | ((readinputport(0) & 0x08) << 1) | | |
| 253 | ((readinputport(0) & 0x10) >> 1) | ((readinputport(0) & 0x20) >> 3) | | |
| 254 | ((readinputport(0) & 0x40) >> 5) | ((readinputport(0) & 0x80) >> 7)); | |
| 251 | dipsw_a = (((input_port_read_indexed(machine, 0) & 0x01) << 7) | ((input_port_read_indexed(machine, 0) & 0x02) << 5) | | |
| 252 | ((input_port_read_indexed(machine, 0) & 0x04) << 3) | ((input_port_read_indexed(machine, 0) & 0x08) << 1) | | |
| 253 | ((input_port_read_indexed(machine, 0) & 0x10) >> 1) | ((input_port_read_indexed(machine, 0) & 0x20) >> 3) | | |
| 254 | ((input_port_read_indexed(machine, 0) & 0x40) >> 5) | ((input_port_read_indexed(machine, 0) & 0x80) >> 7)); | |
| 255 | 255 | |
| 256 | dipsw_b = (((readinputport(1) & 0x01) << 7) | ((readinputport(1) & 0x02) << 5) | | |
| 257 | ((readinputport(1) & 0x04) << 3) | ((readinputport(1) & 0x08) << 1) | | |
| 258 | ((readinputport(1) & 0x10) >> 1) | ((readinputport(1) & 0x20) >> 3) | | |
| 259 | ((readinputport(1) & 0x40) >> 5) | ((readinputport(1) & 0x80) >> 7)); | |
| 256 | dipsw_b = (((input_port_read_indexed(machine, 1) & 0x01) << 7) | ((input_port_read_indexed(machine, 1) & 0x02) << 5) | | |
| 257 | ((input_port_read_indexed(machine, 1) & 0x04) << 3) | ((input_port_read_indexed(machine, 1) & 0x08) << 1) | | |
| 258 | ((input_port_read_indexed(machine, 1) & 0x10) >> 1) | ((input_port_read_indexed(machine, 1) & 0x20) >> 3) | | |
| 259 | ((input_port_read_indexed(machine, 1) & 0x40) >> 5) | ((input_port_read_indexed(machine, 1) & 0x80) >> 7)); | |
| 260 | 260 | |
| 261 | 261 | return ((dipsw_a << 8) | dipsw_b); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | static READ16_HANDLER( niyanpai_inputport_0_r ) |
| 265 | 265 | { |
| 266 | return (( | |
| 266 | return (( | |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | static READ16_HANDLER( niyanpai_inputport_1_r ) |
| 270 | 270 | { |
| 271 | return (( | |
| 271 | return (( | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | static READ16_HANDLER( musobana_inputport_0_r ) |
| r2375 | r2376 | |
| 277 | 277 | |
| 278 | 278 | switch ((musobana_inputport ^ 0xff00) >> 8) |
| 279 | 279 | { |
| 280 | case 0x01: portdata = ((readinputport(3) << 8) | (readinputport(8))); break; | |
| 281 | case 0x02: portdata = ((readinputport(4) << 8) | (readinputport(9))); break; | |
| 282 | case 0x04: portdata = ((readinputport(5) << 8) | (readinputport(10))); break; | |
| 283 | case 0x08: portdata = ((readinputport(6) << 8) | (readinputport(11))); break; | |
| 284 | case 0x10: portdata = ((readinputport(7) << 8) | (readinputport(12))); break; | |
| 285 | default: portdata = (((readinputport(3) << 8) | (readinputport(8)))) & (((readinputport(4) << 8) | (readinputport(9)))) & (((readinputport(5) << 8) | (readinputport(10)))) & (((readinputport(6) << 8) | (readinputport(11)))) & (((readinputport(7) << 8) | (readinputport(12)))); break; | |
| 280 | case 0x01: portdata = ((input_port_read_indexed(machine, 3) << 8) | (input_port_read_indexed(machine, 8))); break; | |
| 281 | case 0x02: portdata = ((input_port_read_indexed(machine, 4) << 8) | (input_port_read_indexed(machine, 9))); break; | |
| 282 | case 0x04: portdata = ((input_port_read_indexed(machine, 5) << 8) | (input_port_read_indexed(machine, 10))); break; | |
| 283 | case 0x08: portdata = ((input_port_read_indexed(machine, 6) << 8) | (input_port_read_indexed(machine, 11))); break; | |
| 284 | case 0x10: portdata = ((input_port_read_indexed(machine, 7) << 8) | (input_port_read_indexed(machine, 12))); break; | |
| 285 | default: portdata = (((input_port_read_indexed(machine, 3) << 8) | (input_port_read_indexed(machine, 8)))) & (((input_port_read_indexed(machine, 4) << 8) | (input_port_read_indexed(machine, 9)))) & (((input_port_read_indexed(machine, 5) << 8) | (input_port_read_indexed(machine, 10)))) & (((input_port_read_indexed(machine, 6) << 8) | (input_port_read_indexed(machine, 11)))) & (((input_port_read_indexed(machine, 7) << 8) | (input_port_read_indexed(machine, 12)))); break; | |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | return (portdata); |
| r2375 | r2376 | |
| 298 | 298 | if (tmp68301_parallel_interface_r(machine, 0x0005, 0x00ff) & 0x0004) musobana_outcoin_flag ^= 1; |
| 299 | 299 | else musobana_outcoin_flag = 1; |
| 300 | 300 | |
| 301 | return ((( | |
| 301 | return ((( | |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | static WRITE16_HANDLER ( musobana_inputport_w ) |
| r2375 | r2376 | |
|---|---|---|
| 215 | 215 | |
| 216 | 216 | switch (state->a2d_select) |
| 217 | 217 | { |
| 218 | case 0: ret = readinputport(2); break; | |
| 219 | case 2: ret = readinputport(3); break; | |
| 218 | case 0: ret = input_port_read_indexed(machine, 2); break; | |
| 219 | case 2: ret = input_port_read_indexed(machine, 3); break; | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | return ret; |
| r2375 | r2376 | |
|---|---|---|
| 655 | 655 | t1 = input_override[offset]; // strobe 0-7 data 0-4 |
| 656 | 656 | t2 = input_override[offset+idx]; // strobe 8-B data 0-4 |
| 657 | 657 | |
| 658 | t1 = (sc2_Inputs[offset] & t1) | ( ( | |
| 658 | t1 = (sc2_Inputs[offset] & t1) | ( ( | |
| 659 | 659 | if (idx == 8) |
| 660 | t2 = (sc2_Inputs[offset+8] & t2) | ( ( | |
| 660 | t2 = (sc2_Inputs[offset+8] & t2) | ( ( | |
| 661 | 661 | else |
| 662 | t2 = (sc2_Inputs[offset+4] & t2) | ( ( ( | |
| 662 | t2 = (sc2_Inputs[offset+4] & t2) | ( ( ( | |
| 663 | 663 | |
| 664 | 664 | sc2_Inputs[offset] = (sc2_Inputs[offset] & ~0x1F) | t1; |
| 665 | 665 | sc2_Inputs[offset+idx] = (sc2_Inputs[offset+idx] & ~0x60) | t2; |
| r2375 | r2376 | |
|---|---|---|
| 702 | 702 | |
| 703 | 703 | static READ32_HANDLER( nova_input_port_0_r ) |
| 704 | 704 | { |
| 705 | return | |
| 705 | return | |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | static READ32_HANDLER( nova_input_port_3_r ) |
| 709 | 709 | { |
| 710 | return | |
| 710 | return | |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | static READ32_HANDLER( nova_input_port_dip_r ) |
| 714 | 714 | { |
| 715 | return | |
| 715 | return | |
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | static UINT32 timer_0_temp[4]; |
| r2375 | r2376 | |
|---|---|---|
| 564 | 564 | { |
| 565 | 565 | switch (keyboard_row) |
| 566 | 566 | { |
| 567 | case 0x01: return readinputport(3); | |
| 568 | case 0x02: return readinputport(4); | |
| 569 | case 0x04: return readinputport(5); | |
| 570 | case 0x08: return readinputport(6); | |
| 571 | case 0x10: return readinputport(7); | |
| 567 | case 0x01: return input_port_read_indexed(machine, 3); | |
| 568 | case 0x02: return input_port_read_indexed(machine, 4); | |
| 569 | case 0x04: return input_port_read_indexed(machine, 5); | |
| 570 | case 0x08: return input_port_read_indexed(machine, 6); | |
| 571 | case 0x10: return input_port_read_indexed(machine, 7); | |
| 572 | 572 | default: logerror("p1_r with keyboard_row = %02x\n",keyboard_row); return 0xffff; |
| 573 | 573 | } |
| 574 | 574 | } |
| r2375 | r2376 | |
| 686 | 686 | |
| 687 | 687 | static READ16_HANDLER( pzlbowl_coins_r ) |
| 688 | 688 | { |
| 689 | return | |
| 689 | return | |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | static WRITE16_HANDLER( pzlbowl_coin_counter_w ) |
| r2375 | r2376 | |
| 770 | 770 | |
| 771 | 771 | static READ16_HANDLER( samshoot_lightgun1_r ) |
| 772 | 772 | { |
| 773 | // popmessage("%02x %02x",readinputport(3),readinputport(2)); | |
| 774 | return (readinputport(2) << 8) | readinputport(3); | |
| 773 | // popmessage("%02x %02x",input_port_read_indexed(machine, 3),input_port_read_indexed(machine, 2)); | |
| 774 | return (input_port_read_indexed(machine, 2) << 8) | input_port_read_indexed(machine, 3); | |
| 775 | 775 | } |
| 776 | 776 | static READ16_HANDLER( samshoot_lightgun2_r ) |
| 777 | 777 | { |
| 778 | return ( | |
| 778 | return ( | |
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | static WRITE16_HANDLER( samshoot_coin_w ) |
| r2375 | r2376 | |
|---|---|---|
| 319 | 319 | switch(offset) |
| 320 | 320 | { |
| 321 | 321 | case 0x02: return reg_a002; |
| 322 | case 0x04: return readinputportbytag("A004"); | |
| 323 | case 0x05: return readinputportbytag("A005"); | |
| 324 | case 0x0c: return input_port_0_r(machine,0); // stats / reset | |
| 325 | case 0x0e: return readinputportbytag("A00E");// coin/reset | |
| 322 | case 0x04: return input_port_read(machine, "A004"); | |
| 323 | case 0x05: return input_port_read(machine, "A005"); | |
| 324 | case 0x0c: return input_port_read_indexed(machine, 0); // stats / reset | |
| 325 | case 0x0e: return input_port_read(machine, "A00E");// coin/reset | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | |
| r2375 | r2376 | |
| 331 | 331 | switch(reg_a002&0x3f) |
| 332 | 332 | { |
| 333 | 333 | case 0x3b: |
| 334 | return input_port_ | |
| 334 | return input_port_ | |
| 335 | 335 | case 0x3e: |
| 336 | return input_port_ | |
| 336 | return input_port_ | |
| 337 | 337 | case 0x3d: |
| 338 | return input_port_ | |
| 338 | return input_port_ | |
| 339 | 339 | default: |
| 340 | 340 | logerror("A000 read with mux=0x%02x\n",reg_a002&0x3f); |
| 341 | 341 | } |
| r2375 | r2376 | |
| 411 | 411 | scrolly=data; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | static READ8_HANDLER(portA_r) { return readinputportbytag("YM_PortA"); } | |
| 415 | static READ8_HANDLER(portB_r) { return readinputportbytag("YM_PortB");} | |
| 414 | static READ8_HANDLER(portA_r) { return input_port_read(machine, "YM_PortA"); } | |
| 415 | static READ8_HANDLER(portB_r) { return input_port_read(machine, "YM_PortB");} | |
| 416 | 416 | |
| 417 | 417 | static const struct YM2203interface ym2203_interface_0 = |
| 418 | 418 | { |
| r2375 | r2376 | |
|---|---|---|
| 63 | 63 | switch ((offset & 0x1c) >> 2){ |
| 64 | 64 | case 0x00: /* inputs + DIPSW #3 + coinsw */ |
| 65 | 65 | if (offset & 0x02) |
| 66 | data = | |
| 66 | data = | |
| 67 | 67 | else |
| 68 | data = | |
| 68 | data = | |
| 69 | 69 | break; |
| 70 | 70 | case 0x01: /* DIPSW #1 & DIPSW #2 */ |
| 71 | 71 | if (offset & 0x02) |
| 72 | data = | |
| 72 | data = | |
| 73 | 73 | break; |
| 74 | 74 | } |
| 75 | 75 |
| r2375 | r2376 | |
|---|---|---|
| 237 | 237 | int res = 0x3f; |
| 238 | 238 | |
| 239 | 239 | /* the game reads all rows at once (keyb = 0) to check if a key is pressed */ |
| 240 | if (~keyb & 0x01) res &= readinputport(3); | |
| 241 | if (~keyb & 0x02) res &= readinputport(4); | |
| 242 | if (~keyb & 0x04) res &= readinputport(5); | |
| 243 | if (~keyb & 0x08) res &= readinputport(6); | |
| 244 | if (~keyb & 0x10) res &= readinputport(7); | |
| 240 | if (~keyb & 0x01) res &= input_port_read_indexed(machine, 3); | |
| 241 | if (~keyb & 0x02) res &= input_port_read_indexed(machine, 4); | |
| 242 | if (~keyb & 0x04) res &= input_port_read_indexed(machine, 5); | |
| 243 | if (~keyb & 0x08) res &= input_port_read_indexed(machine, 6); | |
| 244 | if (~keyb & 0x10) res &= input_port_read_indexed(machine, 7); | |
| 245 | 245 | |
| 246 | 246 | return res; |
| 247 | 247 | } |
| r2375 | r2376 | |
| 251 | 251 | int res = 0x3f; |
| 252 | 252 | |
| 253 | 253 | /* the game reads all rows at once (keyb = 0) to check if a key is pressed */ |
| 254 | if (~keyb & 0x01) res &= readinputport(8); | |
| 255 | if (~keyb & 0x02) res &= readinputport(9); | |
| 256 | if (~keyb & 0x04) res &= readinputport(10); | |
| 257 | if (~keyb & 0x08) res &= readinputport(11); | |
| 258 | if (~keyb & 0x10) res &= readinputport(12); | |
| 254 | if (~keyb & 0x01) res &= input_port_read_indexed(machine, 8); | |
| 255 | if (~keyb & 0x02) res &= input_port_read_indexed(machine, 9); | |
| 256 | if (~keyb & 0x04) res &= input_port_read_indexed(machine, 10); | |
| 257 | if (~keyb & 0x08) res &= input_port_read_indexed(machine, 11); | |
| 258 | if (~keyb & 0x10) res &= input_port_read_indexed(machine, 12); | |
| 259 | 259 | |
| 260 | 260 | return res; |
| 261 | 261 | } |
| r2375 | r2376 | |
| 614 | 614 | switch( yarunara_select ) |
| 615 | 615 | { |
| 616 | 616 | case 0x00: |
| 617 | return | |
| 617 | return | |
| 618 | 618 | |
| 619 | 619 | case 0x02: |
| 620 | 620 | return 0xff; // bit 7 must be 1. Bit 2? |
| r2375 | r2376 | |
| 631 | 631 | // player 2 |
| 632 | 632 | case 0x01: //quiztvqq |
| 633 | 633 | case 0x81: |
| 634 | return | |
| 634 | return | |
| 635 | 635 | |
| 636 | 636 | // player 1 |
| 637 | 637 | case 0x02: //quiztvqq |
| 638 | 638 | case 0x82: |
| 639 | return | |
| 639 | return | |
| 640 | 640 | |
| 641 | 641 | default: |
| 642 | 642 | return 0xff; |
| r2375 | r2376 | |
| 954 | 954 | |
| 955 | 955 | static READ8_HANDLER( mjelctrn_keyboard_1_r ) |
| 956 | 956 | { |
| 957 | return (hanamai_keyboard_1_r(machine,0) & 0x3f) | ( | |
| 957 | return (hanamai_keyboard_1_r(machine,0) & 0x3f) | ( | |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | static READ8_HANDLER( mjelctrn_dsw_r ) |
| 961 | 961 | { |
| 962 | 962 | int dsw = (keyb & 0xc0) >> 6; |
| 963 | 963 | if (dsw >= 2) dsw = dsw - 2 + 13; // 0-3 -> IN0,IN1,IN13,IN14 |
| 964 | return | |
| 964 | return | |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | static WRITE8_HANDLER( mjelctrn_blitter_ack_w ) |
| r2375 | r2376 | |
| 1027 | 1027 | static READ8_HANDLER( htengoku_dsw_r ) |
| 1028 | 1028 | { |
| 1029 | 1029 | |
| 1030 | if (!(htengoku_dsw & 0x01)) return readinputport(11); | |
| 1031 | if (!(htengoku_dsw & 0x02)) return readinputport(12); | |
| 1032 | if (!(htengoku_dsw & 0x04)) return readinputport(13); | |
| 1033 | if (!(htengoku_dsw & 0x08)) return readinputport(14); | |
| 1034 | if (!(htengoku_dsw & 0x10)) return readinputport(15); | |
| 1030 | if (!(htengoku_dsw & 0x01)) return input_port_read_indexed(machine, 11); | |
| 1031 | if (!(htengoku_dsw & 0x02)) return input_port_read_indexed(machine, 12); | |
| 1032 | if (!(htengoku_dsw & 0x04)) return input_port_read_indexed(machine, 13); | |
| 1033 | if (!(htengoku_dsw & 0x08)) return input_port_read_indexed(machine, 14); | |
| 1034 | if (!(htengoku_dsw & 0x10)) return input_port_read_indexed(machine, 15); | |
| 1035 | 1035 | logerror("%06x: warning, unknown bits read, htengoku_dsw = %02x\n", activecpu_get_pc(), htengoku_dsw); |
| 1036 | 1036 | |
| 1037 | 1037 | return 0xff; |
| r2375 | r2376 | |
| 1064 | 1064 | { |
| 1065 | 1065 | switch( htengoku_select ) |
| 1066 | 1066 | { |
| 1067 | case 0x81: return readinputport(1 + 5 + htengoku_ip++); | |
| 1068 | case 0x82: return readinputport(1 + htengoku_ip++); | |
| 1067 | case 0x81: return input_port_read_indexed(machine, 1 + 5 + htengoku_ip++); | |
| 1068 | case 0x82: return input_port_read_indexed(machine, 1 + htengoku_ip++); | |
| 1069 | 1069 | case 0x0d: return 0xff; // unused |
| 1070 | 1070 | } |
| 1071 | 1071 | logerror("%04x: input_r with select = %02x\n",activecpu_get_pc(),htengoku_select); |
| r2375 | r2376 | |
| 1076 | 1076 | { |
| 1077 | 1077 | switch( htengoku_select ) |
| 1078 | 1078 | { |
| 1079 | case 0x00: return | |
| 1079 | case 0x00: return | |
| 1080 | 1080 | case 0x01: return 0xff; //? |
| 1081 | 1081 | case 0x02: return 0xbf | ((htengoku_hopper && !(video_screen_get_frame_number(machine->primary_screen)%10)) ? 0 : (1<<6));; // bit 7 = blitter busy, bit 6 = hopper |
| 1082 | 1082 | case 0x03: return htengoku_coins; |
| r2375 | r2376 | |
| 1196 | 1196 | switch( tenkai_ipsel ) |
| 1197 | 1197 | { |
| 1198 | 1198 | case 0x00: |
| 1199 | return | |
| 1199 | return | |
| 1200 | 1200 | |
| 1201 | 1201 | default: |
| 1202 | 1202 | logerror("%04x: unmapped ip_sel=%02x read from offs %x\n",activecpu_get_pc(),tenkai_ipsel,offset); |
| r2375 | r2376 | |
| 1215 | 1215 | case 0x81: |
| 1216 | 1216 | if (tenkai_ip >= 5) |
| 1217 | 1217 | logerror("%04x: unmapped tenkai_ip=%02x read\n",activecpu_get_pc(),tenkai_ip); |
| 1218 | return 0xff;// | |
| 1218 | return 0xff;// | |
| 1219 | 1219 | |
| 1220 | 1220 | // player 1 |
| 1221 | 1221 | case 0x82: |
| 1222 | 1222 | if (tenkai_ip >= 5) |
| 1223 | 1223 | logerror("%04x: unmapped tenkai_ip=%02x read\n",activecpu_get_pc(),tenkai_ip); |
| 1224 | return | |
| 1224 | return | |
| 1225 | 1225 | |
| 1226 | 1226 | default: |
| 1227 | 1227 | logerror("%04x: unmapped ip_sel=%02x read from offs %x\n",activecpu_get_pc(),tenkai_ipsel,offset); |
| r2375 | r2376 | |
| 1239 | 1239 | } |
| 1240 | 1240 | static READ8_HANDLER( tenkai_dsw_r ) |
| 1241 | 1241 | { |
| 1242 | if (~tenkai_dswsel & 0x01) return readinputport(0); | |
| 1243 | if (~tenkai_dswsel & 0x02) return readinputport(1); | |
| 1244 | if (~tenkai_dswsel & 0x04) return readinputport(2); | |
| 1245 | if (~tenkai_dswsel & 0x08) return readinputport(3); | |
| 1246 | if (~tenkai_dswsel & 0x10) return readinputport(4); | |
| 1242 | if (~tenkai_dswsel & 0x01) return input_port_read_indexed(machine, 0); | |
| 1243 | if (~tenkai_dswsel & 0x02) return input_port_read_indexed(machine, 1); | |
| 1244 | if (~tenkai_dswsel & 0x04) return input_port_read_indexed(machine, 2); | |
| 1245 | if (~tenkai_dswsel & 0x08) return input_port_read_indexed(machine, 3); | |
| 1246 | if (~tenkai_dswsel & 0x10) return input_port_read_indexed(machine, 4); | |
| 1247 | 1247 | logerror("%04x: unmapped dsw %02x read\n",activecpu_get_pc(),tenkai_dswsel); |
| 1248 | 1248 | return 0xff; |
| 1249 | 1249 | } |
| r2375 | r2376 | |
|---|---|---|
| 291 | 291 | { |
| 292 | 292 | static int coin = 0; |
| 293 | 293 | |
| 294 | if ( | |
| 294 | if ( | |
| 295 | 295 | if ( coin == 0 ) { |
| 296 | 296 | coin = 1; |
| 297 | 297 | nmi_line_pulse(machine, cpunum); |
| r2375 | r2376 | |
|---|---|---|
| 246 | 246 | { |
| 247 | 247 | if( m_b_lastclock ) |
| 248 | 248 | { |
| 249 | verboselog( 2, "read dip %02x -> %02x\n", n_data, ( ( readinputport( 7 ) >> m_n_dip_bit ) & 1 ) * PSX_SIO_IN_DATA ); | |
| 250 | psx_sio_input( 0, PSX_SIO_IN_DATA, ( ( readinputport( 7 ) >> m_n_dip_bit ) & 1 ) * PSX_SIO_IN_DATA ); | |
| 249 | verboselog( 2, "read dip %02x -> %02x\n", n_data, ( ( input_port_read_indexed(Machine, 7 ) >> m_n_dip_bit ) & 1 ) * PSX_SIO_IN_DATA ); | |
| 250 | psx_sio_input( 0, PSX_SIO_IN_DATA, ( ( input_port_read_indexed(Machine, 7 ) >> m_n_dip_bit ) & 1 ) * PSX_SIO_IN_DATA ); | |
| 251 | 251 | m_n_dip_bit++; |
| 252 | 252 | m_n_dip_bit &= 7; |
| 253 | 253 | } |
| r2375 | r2376 | |
| 379 | 379 | AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP |
| 380 | 380 | ADDRESS_MAP_END |
| 381 | 381 | |
| 382 | static ADDRESS_MAP_START( link_ | |
| 382 | static ADDRESS_MAP_START( link_ | |
| 383 | 383 | ADDRESS_MAP_END |
| 384 | 384 | |
| 385 | static ADDRESS_MAP_START( link_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 386 | ADDRESS_MAP_END | |
| 387 | ||
| 388 | static void zn_driver_init( void ) | |
| 385 | static void zn_driver_init( running_machine *machine ) | |
| 389 | 386 | { |
| 390 | 387 | int n_game; |
| 391 | 388 | |
| 392 | psx_driver_init(); | |
| 389 | psx_driver_init(machine); | |
| 393 | 390 | |
| 394 | 391 | n_game = 0; |
| 395 | 392 | while( zn_config_table[ n_game ].s_name != NULL ) |
| r2375 | r2376 | |
| 638 | 635 | memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fb80000, 0x1fbfffff, 0, 0, SMH_BANK3 ); /* country rom */ |
| 639 | 636 | memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb60000, 0x1fb60003, 0, 0, zn_qsound_w ); |
| 640 | 637 | |
| 641 | zn_driver_init(); | |
| 638 | zn_driver_init(machine); | |
| 642 | 639 | |
| 643 | 640 | if( strcmp( machine->gamedrv->name, "glpracr" ) == 0 || |
| 644 | 641 | strcmp( machine->gamedrv->name, "glprac2l" ) == 0 ) |
| r2375 | r2376 | |
| 870 | 867 | memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fb80000, 0x1fbfffff, 0, 0, SMH_BANK3 ); /* country rom */ |
| 871 | 868 | memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb60000, 0x1fb60003, 0, 0, zn_qsound_w ); |
| 872 | 869 | |
| 873 | zn_driver_init(); | |
| 870 | zn_driver_init(machine); | |
| 874 | 871 | } |
| 875 | 872 | |
| 876 | 873 | static MACHINE_RESET( coh3002c ) |
| r2375 | r2376 | |
| 1218 | 1215 | memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, SMH_BANK2 ); |
| 1219 | 1216 | memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, SMH_BANK2 ); |
| 1220 | 1217 | |
| 1221 | zn_driver_init(); | |
| 1218 | zn_driver_init(machine); | |
| 1222 | 1219 | mb3773_init(); |
| 1223 | 1220 | } |
| 1224 | 1221 | |
| r2375 | r2376 | |
| 1257 | 1254 | } |
| 1258 | 1255 | } |
| 1259 | 1256 | |
| 1260 | static ADDRESS_MAP_START( fx1a_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 1261 | AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) | |
| 1262 | AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10) | |
| 1263 | AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM) | |
| 1264 | AM_RANGE(0xe000, 0xe000) AM_READ(YM2610_status_port_0_A_r) | |
| 1265 | AM_RANGE(0xe001, 0xe001) AM_READ(YM2610_read_port_0_r) | |
| 1266 | AM_RANGE(0xe002, 0xe002) AM_READ(YM2610_status_port_0_B_r) | |
| 1267 | AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP) | |
| 1268 | AM_RANGE(0xe201, 0xe201) AM_READ(taitosound_slave_comm_r) | |
| 1269 | AM_RANGE(0xea00, 0xea00) AM_READ(SMH_NOP) | |
| 1270 | ADDRESS_MAP_END | |
| 1271 | ||
| 1272 | static ADDRESS_MAP_START( fx1a_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 1273 | AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) | |
| 1274 | AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM) | |
| 1275 | AM_RANGE(0xe000, 0xe000) AM_WRITE(YM2610_control_port_0_A_w) | |
| 1276 | AM_RANGE(0xe001, 0xe001) AM_WRITE(YM2610_data_port_0_A_w) | |
| 1277 | AM_RANGE(0xe002, 0xe002) AM_WRITE(YM2610_control_port_0_B_w) | |
| 1257 | static ADDRESS_MAP_START( fx1a_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 1258 | AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10) /* Fallthrough */ | |
| 1259 | AM_RANGE(0x0000, 0x7fff) AM_ROM | |
| 1260 | AM_RANGE(0xc000, 0xdfff) AM_RAM | |
| 1261 | AM_RANGE(0xe000, 0xe000) AM_READWRITE(YM2610_status_port_0_A_r, YM2610_control_port_0_A_w) | |
| 1262 | AM_RANGE(0xe001, 0xe001) AM_READWRITE(YM2610_read_port_0_r, YM2610_data_port_0_A_w) | |
| 1263 | AM_RANGE(0xe002, 0xe002) AM_READWRITE(YM2610_status_port_0_B_r, YM2610_control_port_0_B_w) | |
| 1278 | 1264 | AM_RANGE(0xe003, 0xe003) AM_WRITE(YM2610_data_port_0_B_w) |
| 1279 | AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w) | |
| 1280 | AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w) | |
| 1265 | AM_RANGE(0xe200, 0xe200) AM_READWRITE(SMH_NOP, taitosound_slave_port_w) | |
| 1266 | AM_RANGE(0xe201, 0xe201) AM_READWRITE(taitosound_slave_comm_r, taitosound_slave_comm_w) | |
| 1281 | 1267 | AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan */ |
| 1282 | AM_RANGE(0xee00, 0xee00) AM_ | |
| 1268 | AM_RANGE(0xee00, 0xee00) AM_ | |
| 1283 | 1269 | AM_RANGE(0xf000, 0xf000) AM_WRITE(SMH_NOP) /* ? */ |
| 1284 | 1270 | AM_RANGE(0xf200, 0xf200) AM_WRITE(fx1a_sound_bankswitch_w) |
| 1285 | 1271 | ADDRESS_MAP_END |
| r2375 | r2376 | |
| 1305 | 1291 | |
| 1306 | 1292 | MDRV_CPU_ADD( Z80, 16000000 / 4 ) |
| 1307 | 1293 | /* audio CPU */ /* 4 MHz */ |
| 1308 | MDRV_CPU_PROGRAM_MAP( fx1a_sound_ | |
| 1294 | MDRV_CPU_PROGRAM_MAP( fx1a_sound_ | |
| 1309 | 1295 | MDRV_MACHINE_RESET( coh1000ta ) |
| 1310 | 1296 | MDRV_NVRAM_HANDLER( coh1000ta ) |
| 1311 | 1297 | |
| r2375 | r2376 | |
| 1349 | 1335 | memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size2 - 1 ), 0, 0, SMH_BANK3 ); |
| 1350 | 1336 | memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size2 - 1 ), 0, 0, SMH_BANK3 ); |
| 1351 | 1337 | |
| 1352 | zn_driver_init(); | |
| 1338 | zn_driver_init(machine); | |
| 1353 | 1339 | mb3773_init(); |
| 1354 | 1340 | } |
| 1355 | 1341 | |
| r2375 | r2376 | |
| 1540 | 1526 | memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb40000, 0x1fb40003, 0, 0, coh3002t_unknown_w ); |
| 1541 | 1527 | memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fb40000, 0x1fb40003, 0, 0, coh3002t_unknown_r ); |
| 1542 | 1528 | |
| 1543 | zn_driver_init(); | |
| 1529 | zn_driver_init(machine); | |
| 1544 | 1530 | } |
| 1545 | 1531 | |
| 1546 | 1532 | static MACHINE_RESET( coh3002t ) |
| r2375 | r2376 | |
| 1725 | 1711 | // init hard disk |
| 1726 | 1712 | ide_controller_init(0, &atpsx_intf); |
| 1727 | 1713 | |
| 1728 | zn_driver_init(); | |
| 1714 | zn_driver_init(machine); | |
| 1729 | 1715 | } |
| 1730 | 1716 | |
| 1731 | 1717 | static MACHINE_RESET( coh1000w ) |
| r2375 | r2376 | |
| 1913 | 1899 | memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fa10300, 0x1fa10303, 0, 0, coh1002e_bank_w ); |
| 1914 | 1900 | memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00007, 0, 0, coh1002e_latch_w ); |
| 1915 | 1901 | |
| 1916 | zn_driver_init(); | |
| 1902 | zn_driver_init(machine); | |
| 1917 | 1903 | } |
| 1918 | 1904 | |
| 1919 | 1905 | static MACHINE_RESET( coh1002e ) |
| r2375 | r2376 | |
| 2257 | 2243 | ide_controller_init( 0, &jdredd_ide_intf ); |
| 2258 | 2244 | } |
| 2259 | 2245 | |
| 2260 | zn_driver_init(); | |
| 2246 | zn_driver_init(machine); | |
| 2261 | 2247 | } |
| 2262 | 2248 | |
| 2263 | 2249 | static MACHINE_RESET( coh1000a ) |
| r2375 | r2376 | |
| 2404 | 2390 | memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); /* banked rom */ |
| 2405 | 2391 | memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, coh1001l_bnk_w ); |
| 2406 | 2392 | |
| 2407 | zn_driver_init(); | |
| 2393 | zn_driver_init(machine); | |
| 2408 | 2394 | } |
| 2409 | 2395 | |
| 2410 | 2396 | static MACHINE_RESET( coh1001l ) |
| r2375 | r2376 | |
| 2450 | 2436 | memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fbfffff, 0, 0, SMH_BANK2 ); |
| 2451 | 2437 | memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, coh1002v_bnk_w ); |
| 2452 | 2438 | |
| 2453 | zn_driver_init(); | |
| 2439 | zn_driver_init(machine); | |
| 2454 | 2440 | } |
| 2455 | 2441 | |
| 2456 | 2442 | static MACHINE_RESET( coh1002v ) |
| r2375 | r2376 | |
| 2675 | 2661 | memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, cbaj_z80_w ); |
| 2676 | 2662 | memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00004, 0x1fb00007, 0, 0, coh1002m_bank_w ); |
| 2677 | 2663 | |
| 2678 | zn_driver_init(); | |
| 2664 | zn_driver_init(machine); | |
| 2679 | 2665 | } |
| 2680 | 2666 | |
| 2681 | 2667 | static MACHINE_RESET( coh1002m ) |
| r2375 | r2376 | |
| 2752 | 2738 | MDRV_IMPORT_FROM( zn1_2mb_vram ) |
| 2753 | 2739 | |
| 2754 | 2740 | MDRV_CPU_ADD( Z80, 8000000 ) |
| 2755 | MDRV_CPU_PROGRAM_MAP( link_ | |
| 2741 | MDRV_CPU_PROGRAM_MAP( link_ | |
| 2756 | 2742 | |
| 2757 | 2743 | MDRV_MACHINE_RESET( coh1002m ) |
| 2758 | 2744 | MDRV_NVRAM_HANDLER( at28c16_0 ) |
| r2375 | r2376 | |
| 4349 | 4335 | GAME( 1999, flamegun, tps, coh1002m, zn, coh1002m, ROT0, "GAPS Inc.", "Flame Gunner", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 4350 | 4336 | GAME( 1999, flameguj, flamegun, coh1002m, zn, coh1002m, ROT0, "GAPS Inc.", "Flame Gunner (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 4351 | 4337 | GAME( 2000, tblkkuzu, tps, coh1002m, zn, coh1002m, ROT0, "Tamsoft/D3 Publisher", "The Block Kuzushi (JAPAN)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 4352 | GAME( 2000, 1on1gov, tps, coh1002m, zn, coh1002m, ROT0, "Tecmo", "1 on 1 Government (JAPAN)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | |
| 4338 | GAME( 2000, 1on1gov, tps, coh1002m, zn, coh1002m, ROT0, "Tecmo", "1 on 1 Government (JAPAN)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | |
| 4353 | 4339 | GAME( 2000, tecmowcm, tps, coh1002m, zn, coh1002m, ROT0, "Tecmo", "Tecmo World Cup Millennium (JAPAN)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 4354 | 4340 | GAME( 2001, mfjump, tps, coh1002m, zn, coh1002m, ROT0, "Tecmo", "Monster Farm Jump (JAPAN)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 4355 | 4341 |
| r2375 | r2376 | |
|---|---|---|
| 78 | 78 | { |
| 79 | 79 | /* low value in the given bit selects */ |
| 80 | 80 | if (!(input_mux & 0x01)) |
| 81 | return | |
| 81 | return | |
| 82 | 82 | else if (!(input_mux & 0x02)) |
| 83 | return | |
| 83 | return | |
| 84 | 84 | else if (!(input_mux & 0x04)) |
| 85 | return | |
| 85 | return | |
| 86 | 86 | return 0xff; |
| 87 | 87 | } |
| 88 | 88 |
| r2375 | r2376 | |
|---|---|---|
| 1708 | 1708 | INPUT_PORTS_END |
| 1709 | 1709 | |
| 1710 | 1710 | |
| 1711 | #define MODE_BUTTON(player) ( (readinputport(player) & 0x800) >> 11 ) | |
| 1712 | #define Z_BUTTON(player) ( (readinputport(player) & 0x400) >> 10 ) | |
| 1713 | #define Y_BUTTON(player) ( (readinputport(player) & 0x200) >> 9 ) | |
| 1714 | #define X_BUTTON(player) ( (readinputport(player) & 0x100) >> 8 ) | |
| 1711 | #define MODE_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x800) >> 11 ) | |
| 1712 | #define Z_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x400) >> 10 ) | |
| 1713 | #define Y_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x200) >> 9 ) | |
| 1714 | #define X_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x100) >> 8 ) | |
| 1715 | 1715 | |
| 1716 | 1716 | |
| 1717 | #define START_BUTTON(player) ( (readinputport(player) & 0x80) >> 7 ) | |
| 1718 | #define C_BUTTON(player) ( (readinputport(player) & 0x40) >> 6 ) | |
| 1719 | #define B_BUTTON(player) ( (readinputport(player) & 0x20) >> 5 ) | |
| 1720 | #define A_BUTTON(player) ( (readinputport(player) & 0x10) >> 4 ) | |
| 1721 | #define RIGHT_BUTTON(player) ( (readinputport(player) & 0x08) >> 3 ) | |
| 1722 | #define LEFT_BUTTON(player) ( (readinputport(player) & 0x04) >> 2 ) | |
| 1723 | #define DOWN_BUTTON(player) ( (readinputport(player) & 0x02) >> 1 ) | |
| 1724 | #define UP_BUTTON(player) ( (readinputport(player) & 0x01) >> 0 ) | |
| 1725 | #define MD_RESET_BUTTON ( (readinputportbytag_safe("RESET",0x00) & 0x01) >> 0 ) | |
| 1717 | #define START_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x80) >> 7 ) | |
| 1718 | #define C_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x40) >> 6 ) | |
| 1719 | #define B_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x20) >> 5 ) | |
| 1720 | #define A_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x10) >> 4 ) | |
| 1721 | #define RIGHT_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x08) >> 3 ) | |
| 1722 | #define LEFT_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x04) >> 2 ) | |
| 1723 | #define DOWN_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x02) >> 1 ) | |
| 1724 | #define UP_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x01) >> 0 ) | |
| 1725 | #define MD_RESET_BUTTON ( (input_port_read_safe(Machine, "RESET",0x00) & 0x01) >> 0 ) | |
| 1726 | 1726 | |
| 1727 | 1727 | static UINT8 megadrive_io_data_regs[3]; |
| 1728 | 1728 | static UINT8 megadrive_io_ctrl_regs[3]; |
| r2375 | r2376 | |
| 2909 | 2909 | /* emulate testmode plug */ |
| 2910 | 2910 | static UINT8 megadrive_io_read_data_port_svp(int portnum) |
| 2911 | 2911 | { |
| 2912 | if (portnum == 0 && | |
| 2912 | if (portnum == 0 && | |
| 2913 | 2913 | { |
| 2914 | 2914 | return (megadrive_io_data_regs[0] & 0xc0); |
| 2915 | 2915 | } |
| r2375 | r2376 | |
| 4755 | 4755 | /* default state of z80 = reset, with bus */ |
| 4756 | 4756 | mame_printf_debug("Resetting Megadrive / Genesis\n"); |
| 4757 | 4757 | |
| 4758 | switch ( | |
| 4758 | switch ( | |
| 4759 | 4759 | { |
| 4760 | 4760 | |
| 4761 | 4761 | case 1: // US |
| r2375 | r2376 | |
|---|---|---|
| 197 | 197 | ***************************************************************************/ |
| 198 | 198 | static UINT16 *mcu_ram, galpani3_mcu_com[4]; |
| 199 | 199 | |
| 200 | static void galpani3_mcu_run( | |
| 200 | static void galpani3_mcu_run(running_machine *machine) | |
| 201 | 201 | { |
| 202 | 202 | UINT16 mcu_command = mcu_ram[0x0010/2]; /* command nb */ |
| 203 | 203 | UINT16 mcu_offset = mcu_ram[0x0012/2] / 2; /* offset in shared RAM where MCU will write */ |
| r2375 | r2376 | |
| 215 | 215 | { |
| 216 | 216 | case 0x03: // DSW |
| 217 | 217 | { |
| 218 | mcu_ram[mcu_offset] = | |
| 218 | mcu_ram[mcu_offset] = | |
| 219 | 219 | logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n",activecpu_get_pc(),mcu_command,mcu_offset*2); |
| 220 | 220 | } |
| 221 | 221 | break; |
| r2375 | r2376 | |
| 295 | 295 | if (galpani3_mcu_com[3] != 0xFFFF) return; \ |
| 296 | 296 | \ |
| 297 | 297 | memset(galpani3_mcu_com, 0, 4 * sizeof( UINT16 ) ); \ |
| 298 | galpani3_mcu_run(); \ | |
| 298 | galpani3_mcu_run(machine); \ | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | GALPANI3_MCU_COM_W(0) |
| r2375 | r2376 | |
|---|---|---|
| 354 | 354 | |
| 355 | 355 | static READ16_HANDLER( special_port3_r ) |
| 356 | 356 | { |
| 357 | int result = | |
| 357 | int result = | |
| 358 | 358 | if (sound_int_state) result ^= 0x08; |
| 359 | 359 | return result; |
| 360 | 360 | } |
| r2375 | r2376 | |
| 362 | 362 | |
| 363 | 363 | static READ16_HANDLER( special_port4_r ) |
| 364 | 364 | { |
| 365 | int result = | |
| 365 | int result = | |
| 366 | 366 | if (sound_int_state) result ^= 0x08; |
| 367 | 367 | return result; |
| 368 | 368 | } |
| r2375 | r2376 | |
| 370 | 370 | |
| 371 | 371 | static READ16_HANDLER( trackball_r ) |
| 372 | 372 | { |
| 373 | int lower = readinputportbytag("TRACKX1"); | |
| 374 | int upper = readinputportbytag("TRACKY1"); | |
| 373 | int lower = input_port_read(machine, "TRACKX1"); | |
| 374 | int upper = input_port_read(machine, "TRACKY1"); | |
| 375 | 375 | |
| 376 | 376 | return (lower & 15) | ((upper & 15) << 4); |
| 377 | 377 | } |
| r2375 | r2376 | |
| 379 | 379 | |
| 380 | 380 | static READ32_HANDLER( trackball32_8bit_r ) |
| 381 | 381 | { |
| 382 | int lower = readinputportbytag("TRACKX1"); | |
| 383 | int upper = readinputportbytag("TRACKY1"); | |
| 382 | int lower = input_port_read(machine, "TRACKX1"); | |
| 383 | int upper = input_port_read(machine, "TRACKY1"); | |
| 384 | 384 | |
| 385 | 385 | return (lower & 255) | ((upper & 255) << 8); |
| 386 | 386 | } |
| r2375 | r2376 | |
| 398 | 398 | int upper, lower; |
| 399 | 399 | int dx, dy; |
| 400 | 400 | |
| 401 | int curx = readinputportbytag("TRACKX1"); | |
| 402 | int cury = readinputportbytag("TRACKY1"); | |
| 401 | int curx = input_port_read(machine, "TRACKX1"); | |
| 402 | int cury = input_port_read(machine, "TRACKY1"); | |
| 403 | 403 | |
| 404 | 404 | dx = curx - effx; |
| 405 | 405 | if (dx < -0x80) dx += 0x100; |
| r2375 | r2376 | |
| 437 | 437 | int upper, lower; |
| 438 | 438 | int dx, dy; |
| 439 | 439 | |
| 440 | int curx = readinputportbytag("TRACKX2"); | |
| 441 | int cury = readinputportbytag("TRACKY2"); | |
| 440 | int curx = input_port_read(machine, "TRACKX2"); | |
| 441 | int cury = input_port_read(machine, "TRACKY2"); | |
| 442 | 442 | |
| 443 | 443 | dx = curx - effx; |
| 444 | 444 | if (dx < -0x80) dx += 0x100; |
| r2375 | r2376 | |
| 473 | 473 | |
| 474 | 474 | static READ32_HANDLER( drivedge_steering_r ) |
| 475 | 475 | { |
| 476 | int val = | |
| 476 | int val = | |
| 477 | 477 | if (val < 0) val = 0x100 | (-val); |
| 478 | 478 | return val << 16; |
| 479 | 479 | } |
| r2375 | r2376 | |
| 481 | 481 | |
| 482 | 482 | static READ32_HANDLER( drivedge_gas_r ) |
| 483 | 483 | { |
| 484 | int val = | |
| 484 | int val = | |
| 485 | 485 | return val << 16; |
| 486 | 486 | } |
| 487 | 487 |
| r2375 | r2376 | |
|---|---|---|
| 301 | 301 | { |
| 302 | 302 | printf("Read Prototyping card [%02x] @ PC=%05x\n",offset,activecpu_get_pc()); |
| 303 | 303 | if(offset == 1) |
| 304 | return | |
| 304 | return | |
| 305 | 305 | |
| 306 | 306 | return disk_data[offset]; |
| 307 | 307 | } |
| r2375 | r2376 | |
|---|---|---|
| 146 | 146 | |
| 147 | 147 | static READ16_HANDLER( horekid_IN2_r ) |
| 148 | 148 | { |
| 149 | int data = | |
| 149 | int data = | |
| 150 | 150 | |
| 151 | 151 | if (!(data & 0x40)) // FAKE button 3 for "Debug Mode" |
| 152 | 152 | { |
| r2375 | r2376 | |
|---|---|---|
| 75 | 75 | // POT switch position, read from port A of the first S2636 |
| 76 | 76 | // Not sure of the correct values to return, but these should |
| 77 | 77 | // do based on the game code. |
| 78 | switch( | |
| 78 | switch( | |
| 79 | 79 | { |
| 80 | 80 | case 0: // Normal play |
| 81 | 81 | return 0xf0; |
| r2375 | r2376 | |
|---|---|---|
| 331 | 331 | { |
| 332 | 332 | /* Protection/IO chip 75, same as Lemmings & Robocop 2 */ |
| 333 | 333 | switch (offset<<2) { |
| 334 | case 0x0a0: return readinputport(0); /* Player 1 & 2 controls */ | |
| 335 | case 0x158: return readinputport(1); /* Player 3 & 4 controls */ | |
| 336 | case 0xed4: return readinputport(2); /* Misc */ | |
| 334 | case 0x0a0: return input_port_read_indexed(machine, 0); /* Player 1 & 2 controls */ | |
| 335 | case 0x158: return input_port_read_indexed(machine, 1); /* Player 3 & 4 controls */ | |
| 336 | case 0xed4: return input_port_read_indexed(machine, 2); /* Misc */ | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | logerror("%08x: Unmapped protection read %04x\n",activecpu_get_pc(),offset<<2); |
| r2375 | r2376 | |
| 343 | 343 | static READ32_HANDLER( captaven_soundcpu_r ) |
| 344 | 344 | { |
| 345 | 345 | /* Top byte - top bit low == sound cpu busy, bottom word is dips */ |
| 346 | return 0xffff0000 | | |
| 346 | return 0xffff0000 | | |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | static READ32_HANDLER( fghthist_control_r ) |
| 350 | 350 | { |
| 351 | 351 | switch (offset) { |
| 352 | case 0: return 0xffff0000 | readinputport(0); | |
| 353 | case 1: return 0xffff0000 | readinputport(1); //check top bits?? | |
| 352 | case 0: return 0xffff0000 | input_port_read_indexed(machine, 0); | |
| 353 | case 1: return 0xffff0000 | input_port_read_indexed(machine, 1); //check top bits?? | |
| 354 | 354 | case 2: return 0xfffffffe | EEPROM_read_bit(); |
| 355 | 355 | } |
| 356 | 356 | |
| r2375 | r2376 | |
| 375 | 375 | static READ32_HANDLER( dragngun_service_r ) |
| 376 | 376 | { |
| 377 | 377 | // logerror("%08x:Read service\n",activecpu_get_pc()); |
| 378 | return | |
| 378 | return | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | static READ32_HANDLER( lockload_gun_mirror_r ) |
| r2375 | r2376 | |
| 383 | 383 | //logerror("%08x:Read gun %d\n",activecpu_get_pc(),offset); |
| 384 | 384 | //return ((mame_rand(Machine)%0xffff)<<16) | mame_rand(Machine)%0xffff; |
| 385 | 385 | if (offset) /* Mirror of player 1 and player 2 fire buttons */ |
| 386 | return readinputport(5) | ((mame_rand(Machine)%0xff)<<16); | |
| 387 | return readinputport(4) | readinputport(6) | (readinputport(6)<<16) | (readinputport(6)<<24); //((mame_rand(Machine)%0xff)<<16); | |
| 386 | return input_port_read_indexed(machine, 5) | ((mame_rand(Machine)%0xff)<<16); | |
| 387 | return input_port_read_indexed(machine, 4) | input_port_read_indexed(machine, 6) | (input_port_read_indexed(machine, 6)<<16) | (input_port_read_indexed(machine, 6)<<24); //((mame_rand(Machine)%0xff)<<16); | |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | static READ32_HANDLER( dragngun_prot_r ) |
| r2375 | r2376 | |
| 398 | 398 | //definitely vblank in locked load |
| 399 | 399 | |
| 400 | 400 | switch (offset<<1) { |
| 401 | case 0x140/2: return 0xffff0000 | readinputport(0); /* IN0 */ | |
| 402 | case 0xadc/2: return 0xffff0000 | readinputport(1) | strobe; /* IN1 */ | |
| 403 | case 0x6a0/2: return 0xffff0000 | readinputport(2); /* IN2 (Dip switch) */ | |
| 401 | case 0x140/2: return 0xffff0000 | input_port_read_indexed(machine, 0); /* IN0 */ | |
| 402 | case 0xadc/2: return 0xffff0000 | input_port_read_indexed(machine, 1) | strobe; /* IN1 */ | |
| 403 | case 0x6a0/2: return 0xffff0000 | input_port_read_indexed(machine, 2); /* IN2 (Dip switch) */ | |
| 404 | 404 | } |
| 405 | 405 | return 0xffffffff; |
| 406 | 406 | } |
| r2375 | r2376 | |
| 411 | 411 | { |
| 412 | 412 | /* Ports 0-3 are read, but seem unused */ |
| 413 | 413 | switch (dragngun_lightgun_port) { |
| 414 | case 4: return readinputport(4); break; | |
| 415 | case 5: return readinputport(5); break; | |
| 416 | case 6: return readinputport(6); break; | |
| 417 | case 7: return readinputport(7); break; | |
| 414 | case 4: return input_port_read_indexed(machine, 4); break; | |
| 415 | case 5: return input_port_read_indexed(machine, 5); break; | |
| 416 | case 6: return input_port_read_indexed(machine, 6); break; | |
| 417 | case 7: return input_port_read_indexed(machine, 7); break; | |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // logerror("Illegal lightgun port %d read \n",dragngun_lightgun_port); |
| r2375 | r2376 | |
| 460 | 460 | static READ32_HANDLER( tattass_prot_r ) |
| 461 | 461 | { |
| 462 | 462 | switch (offset<<1) { |
| 463 | case 0x280: return readinputport(0) << 16; /* IN0 */ | |
| 464 | case 0x4c4: return readinputport(1) << 16; /* IN1 */ | |
| 463 | case 0x280: return input_port_read_indexed(machine, 0) << 16; /* IN0 */ | |
| 464 | case 0x4c4: return input_port_read_indexed(machine, 1) << 16; /* IN1 */ | |
| 465 | 465 | case 0x35a: return tattass_eprom_bit << 16; |
| 466 | 466 | } |
| 467 | 467 | |
| r2375 | r2376 | |
| 623 | 623 | { |
| 624 | 624 | |
| 625 | 625 | switch (offset<<1) { |
| 626 | case 0x280: return readinputport(0) << 16| 0xffff; /* IN0 */ | |
| 627 | case 0x4c4: return readinputport(1) << 16| 0xffff; /* IN1 */ | |
| 626 | case 0x280: return input_port_read_indexed(machine, 0) << 16| 0xffff; /* IN0 */ | |
| 627 | case 0x4c4: return input_port_read_indexed(machine, 1) << 16| 0xffff; /* IN1 */ | |
| 628 | 628 | case 0x35a: return (EEPROM_read_bit()<< 16) | 0xffff; // Debug switch in low word?? |
| 629 | 629 | } |
| 630 | 630 |
| r2375 | r2376 | |
|---|---|---|
| 451 | 451 | static const UINT8 translate49[7] = { 0x8, 0xc, 0xe, 0xf, 0x3, 0x1, 0x0 }; |
| 452 | 452 | const char *namex = param; |
| 453 | 453 | const char *namey = namex + strlen(namex) + 1; |
| 454 | return (translate49[ | |
| 454 | return (translate49[ | |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | |
| r2375 | r2376 | |
| 464 | 464 | |
| 465 | 465 | static CUSTOM_INPUT( keypad_r ) |
| 466 | 466 | { |
| 467 | UINT32 bits = | |
| 467 | UINT32 bits = | |
| 468 | 468 | UINT8 select = keypad_select; |
| 469 | 469 | while ((select & 1) != 0) |
| 470 | 470 | { |
| r2375 | r2376 | |
| 487 | 487 | static const char * const tags[] = { "ANALOG0", "ANALOG1", "ANALOG2", "ANALOG3" }; |
| 488 | 488 | if (offset < 8 || offset > 11) |
| 489 | 489 | logerror("%06X:analog_r(%X)\n", activecpu_get_pc(), offset); |
| 490 | return | |
| 490 | return | |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | |
| r2375 | r2376 | |
| 553 | 553 | { "GUNX1", "GUNY1" }, |
| 554 | 554 | { "GUNX2", "GUNY2" } |
| 555 | 555 | }; |
| 556 | gun_x[player] = readinputportbytag(names[player][0]) * (visarea->max_x + 1 - visarea->min_x) / 255 + visarea->min_x + BEAM_XOFFS; | |
| 557 | gun_y[player] = readinputportbytag(names[player][1]) * (visarea->max_y + 1 - visarea->min_y) / 255 + visarea->min_y; | |
| 556 | gun_x[player] = input_port_read(machine, names[player][0]) * (visarea->max_x + 1 - visarea->min_x) / 255 + visarea->min_x + BEAM_XOFFS; | |
| 557 | gun_y[player] = input_port_read(machine, names[player][1]) * (visarea->max_y + 1 - visarea->min_y) / 255 + visarea->min_y; | |
| 558 | 558 | timer_adjust_oneshot(gun_timer[player], video_screen_get_time_until_pos(machine->primary_screen, MAX(0, gun_y[player] - BEAM_DY), MAX(0, gun_x[player] - BEAM_DX)), player); |
| 559 | 559 | } |
| 560 | 560 | } |
| r2375 | r2376 | |
|---|---|---|
| 79 | 79 | static MACHINE_START( grchamp ) |
| 80 | 80 | { |
| 81 | 81 | /* if the coin system is 1 way, lock Coin B (Page 40) */ |
| 82 | if ( | |
| 82 | if ( | |
| 83 | 83 | coin_lockout_w(1, 1); |
| 84 | 84 | } |
| 85 | 85 |
| r2375 | r2376 | |
|---|---|---|
| 79 | 79 | |
| 80 | 80 | switch(goodejan_mux_data) |
| 81 | 81 | { |
| 82 | case 1: ret = readinputport(1); break; | |
| 83 | case 2: ret = readinputport(2); break; | |
| 84 | case 4: ret = readinputport(3); break; | |
| 85 | case 8: ret = readinputport(4); break; | |
| 86 | case 0x10: ret = readinputport(5); break; | |
| 82 | case 1: ret = input_port_read_indexed(machine, 1); break; | |
| 83 | case 2: ret = input_port_read_indexed(machine, 2); break; | |
| 84 | case 4: ret = input_port_read_indexed(machine, 3); break; | |
| 85 | case 8: ret = input_port_read_indexed(machine, 4); break; | |
| 86 | case 0x10: ret = input_port_read_indexed(machine, 5); break; | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | return ret; |
| r2375 | r2376 | |
|---|---|---|
| 422 | 422 | int num = (FPTR)param; |
| 423 | 423 | int delta, res; |
| 424 | 424 | |
| 425 | delta = | |
| 425 | delta = | |
| 426 | 426 | |
| 427 | 427 | if (delta < 0x80) |
| 428 | 428 | { |
| r2375 | r2376 | |
|---|---|---|
| 175 | 175 | { |
| 176 | 176 | if (offset == 0) |
| 177 | 177 | { |
| 178 | return ( | |
| 178 | return ( | |
| 179 | 179 | } |
| 180 | 180 | else if (offset == 1) |
| 181 | 181 | { |
| 182 | return ( | |
| 182 | return ( | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return 0; |
| r2375 | r2376 | |
|---|---|---|
| 123 | 123 | |
| 124 | 124 | static CUSTOM_INPUT( astrof_p1_controls_r ) |
| 125 | 125 | { |
| 126 | return | |
| 126 | return | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
| r2375 | r2376 | |
| 134 | 134 | /* on an upright cabinets, a single set of controls |
| 135 | 135 | is connected to both sets of pins on the edge |
| 136 | 136 | connector */ |
| 137 | if (readinputportbytag("CAB")) | |
| 138 | ret = readinputportbytag("P2"); | |
| 137 | if (input_port_read(machine, "CAB")) | |
| 138 | ret = input_port_read(machine, "P2"); | |
| 139 | 139 | else |
| 140 | ret = | |
| 140 | ret = | |
| 141 | 141 | |
| 142 | 142 | return ret; |
| 143 | 143 | } |
| r2375 | r2376 | |
| 223 | 223 | |
| 224 | 224 | static WRITE8_HANDLER( video_control_1_w ) |
| 225 | 225 | { |
| 226 | flipscreen = ((data >> 0) & 0x01) & | |
| 226 | flipscreen = ((data >> 0) & 0x01) & | |
| 227 | 227 | |
| 228 | 228 | /* this ties to the CLR pin of the shift registers */ |
| 229 | 229 | screen_off = (data & 0x02) ? TRUE : FALSE; |
| r2375 | r2376 | |
|---|---|---|
| 326 | 326 | { |
| 327 | 327 | switch (offset<<1) { |
| 328 | 328 | case 0: /* Player controls */ |
| 329 | return ( | |
| 329 | return ( | |
| 330 | 330 | case 2: /* Start buttons & VBL */ |
| 331 | return | |
| 331 | return | |
| 332 | 332 | case 4: /* Dipswitch A & B */ |
| 333 | return ( | |
| 333 | return ( | |
| 334 | 334 | case 6: /* i8751 return values */ |
| 335 | 335 | return i8751_return; |
| 336 | 336 | } |
| r2375 | r2376 | |
| 652 | 652 | static int latch; |
| 653 | 653 | |
| 654 | 654 | /* Coin input to the i8751 generates an interrupt to the main cpu */ |
| 655 | if (readinputport(3) == coin_mask) latch=1; | |
| 656 | if (readinputport(3) != coin_mask && latch) { | |
| 655 | if (input_port_read_indexed(machine, 3) == coin_mask) latch=1; | |
| 656 | if (input_port_read_indexed(machine, 3) != coin_mask && latch) { | |
| 657 | 657 | if (i8751_needs_ack) { |
| 658 | 658 | /* i8751 is busy - queue the command */ |
| 659 | i8751_coin_pending= | |
| 659 | i8751_coin_pending= | |
| 660 | 660 | } else { |
| 661 | i8751_return= | |
| 661 | i8751_return= | |
| 662 | 662 | cpunum_set_input_line(machine, 0,6,HOLD_LINE); |
| 663 | 663 | i8751_needs_ack=1; |
| 664 | 664 | } |
| r2375 | r2376 | |
|---|---|---|
| 207 | 207 | |
| 208 | 208 | static READ16_HANDLER( port0_r ) |
| 209 | 209 | { |
| 210 | int result = | |
| 210 | int result = | |
| 211 | 211 | result ^= ticket_dispenser_r(machine,0) >> 3; |
| 212 | 212 | return result; |
| 213 | 213 | } |
| r2375 | r2376 | |
| 215 | 215 | |
| 216 | 216 | static READ16_HANDLER( analogx_r ) |
| 217 | 217 | { |
| 218 | return ( | |
| 218 | return ( | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | |
| r2375 | r2376 | |
| 223 | 223 | { |
| 224 | 224 | /* doubles as a watchdog address */ |
| 225 | 225 | watchdog_reset_w(machine,0,0); |
| 226 | return ( | |
| 226 | return ( | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 |
| r2375 | r2376 | |
|---|---|---|
| 46 | 46 | |
| 47 | 47 | static READ8_HANDLER( mcu_portA_r ) |
| 48 | 48 | { |
| 49 | portA_in = | |
| 49 | portA_in = | |
| 50 | 50 | return (portA_in & ~ddrA) | (portA_out & ddrA); |
| 51 | 51 | } |
| 52 | 52 |
| r2375 | r2376 | |
|---|---|---|
| 1457 | 1457 | { |
| 1458 | 1458 | if (data < 8 || data > 15) |
| 1459 | 1459 | logerror("%08X:Unexpected analog port select = %08X\n", activecpu_get_pc(), data); |
| 1460 | pending_analog_read = | |
| 1460 | pending_analog_read = | |
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 |
| r2375 | r2376 | |
|---|---|---|
| 18 | 18 | { |
| 19 | 19 | if (cpu_getiloops() == 0) |
| 20 | 20 | { |
| 21 | if (~input_port_ | |
| 21 | if (~input_port_ | |
| 22 | 22 | { |
| 23 | 23 | cpunum_set_input_line_and_vector(machine, 0,0,HOLD_LINE,0xf7); /* RST 30h */ |
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | else if (~input_port_ | |
| 26 | else if (~input_port_ | |
| 27 | 27 | { |
| 28 | 28 | cpunum_set_input_line_and_vector(machine, 0,0,HOLD_LINE,0xef); /* RST 28h */ |
| 29 | 29 | return; |
| r2375 | r2376 | |
| 39 | 39 | if (offset == 0) |
| 40 | 40 | return mame_rand(machine); |
| 41 | 41 | else |
| 42 | return (mame_rand(machine) & 0x07) | input_port_ | |
| 42 | return (mame_rand(machine) & 0x07) | input_port_ | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | static WRITE8_HANDLER( kopunch_lamp_w ) |
| r2375 | r2376 | |
|---|---|---|
| 256 | 256 | return misc_io_data[offset]; |
| 257 | 257 | |
| 258 | 258 | /* otherwise, return an input port */ |
| 259 | return | |
| 259 | return | |
| 260 | 260 | |
| 261 | 261 | /* 'SEGA' protection */ |
| 262 | 262 | case 0x10/2: |
| r2375 | r2376 | |
| 357 | 357 | { |
| 358 | 358 | static const char *const ports[] = { "ADC0", "ADC1", "ADC2", "ADC3", "ADC4", "ADC5", "ADC6" }; |
| 359 | 359 | int selected = ((offset & 3) == 3) ? (3 + (misc_io_data[0x08/2] & 3)) : (offset & 3); |
| 360 | int value = | |
| 360 | int value = | |
| 361 | 361 | analog_data[offset & 3] = value; |
| 362 | 362 | } |
| 363 | 363 |
| r2375 | r2376 | |
|---|---|---|
| 99 | 99 | /* when reading the even ports, do a real analog port update */ |
| 100 | 100 | if (which == 0) |
| 101 | 101 | { |
| 102 | int dx = (INT8)readinputport(2); | |
| 103 | int dy = (INT8)readinputport(3); | |
| 102 | int dx = (INT8)input_port_read_indexed(machine, 2); | |
| 103 | int dy = (INT8)input_port_read_indexed(machine, 3); | |
| 104 | 104 | |
| 105 | 105 | cur[0] = dx + dy; |
| 106 | 106 | cur[1] = dx - dy; |
| r2375 | r2376 | |
| 140 | 140 | |
| 141 | 141 | static READ16_HANDLER( special_port0_r ) |
| 142 | 142 | { |
| 143 | int result = | |
| 143 | int result = | |
| 144 | 144 | |
| 145 | 145 | if ((result & 0x0800) && atarigen_get_hblank(machine->primary_screen)) |
| 146 | 146 | result &= ~0x0800; |
| r2375 | r2376 | |
|---|---|---|
| 76 | 76 | /* the EEPROM is read thru bit 4 */ |
| 77 | 77 | static READ16_HANDLER( xorworld_input_r ) |
| 78 | 78 | { |
| 79 | return | |
| 79 | return | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | static WRITE16_HANDLER( eeprom_chip_select_w ) |
| r2375 | r2376 | |
|---|---|---|
| 323 | 323 | if (protection_data != 0xff) |
| 324 | 324 | ret = protection_data ^ 0x88; |
| 325 | 325 | else |
| 326 | ret = | |
| 326 | ret = | |
| 327 | 327 | break; |
| 328 | 328 | |
| 329 | 329 | case 0x02: |
| r2375 | r2376 | |
| 369 | 369 | |
| 370 | 370 | static WRITE8_HANDLER( enigma2_flip_screen_w ) |
| 371 | 371 | { |
| 372 | engima2_flip_screen = ((data >> 5) & 0x01) && (( | |
| 372 | engima2_flip_screen = ((data >> 5) & 0x01) && (( | |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | |
| 376 | 376 | static CUSTOM_INPUT( p1_controls_r ) |
| 377 | 377 | { |
| 378 | return | |
| 378 | return | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | |
| 382 | 382 | static CUSTOM_INPUT( p2_controls_r ) |
| 383 | 383 | { |
| 384 | 384 | if (engima2_flip_screen) |
| 385 | return | |
| 385 | return | |
| 386 | 386 | else |
| 387 | return | |
| 387 | return | |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 |
| r2375 | r2376 | |
|---|---|---|
| 388 | 388 | return ppi8255_0_r(machine, offset & 3); |
| 389 | 389 | |
| 390 | 390 | case 0x10/2: |
| 391 | return | |
| 391 | return | |
| 392 | 392 | |
| 393 | 393 | case 0x30/2: |
| 394 | 394 | { |
| 395 | 395 | static const char *const ports[] = { "ADC0", "ADC1", "ADC2", "ADC3", "ADC4", "ADC5", "ADC6", "ADC7" }; |
| 396 | return | |
| 396 | return | |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | case 0x60/2: |
| r2375 | r2376 | |
| 451 | 451 | case 0x1002/2: |
| 452 | 452 | case 0x1004/2: |
| 453 | 453 | case 0x1006/2: |
| 454 | return | |
| 454 | return | |
| 455 | 455 | |
| 456 | 456 | case 0x3020/2: |
| 457 | 457 | { |
| 458 | 458 | static const char *const ports[] = { "ADC0", "ADC1", "ADC2", "ADC3" }; |
| 459 | return | |
| 459 | return | |
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | logerror("%06X:misc_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2); |
| r2375 | r2376 | |
|---|---|---|
| 104 | 104 | { |
| 105 | 105 | if(!offset) |
| 106 | 106 | { |
| 107 | return input_port_ | |
| 107 | return input_port_ | |
| 108 | 108 | } |
| 109 | 109 | return 0; |
| 110 | 110 | } |
| r2375 | r2376 | |
|---|---|---|
| 205 | 205 | adc1038_data_in = bit & 1; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | static void adc1038_clk_w(int bit) | |
| 208 | static void adc1038_clk_w(running_machine *machine, int bit) | |
| 209 | 209 | { |
| 210 | 210 | // GTI Club doesn't sync on SARS |
| 211 | 211 | if (adc1038_gticlub_hack) |
| r2375 | r2376 | |
| 216 | 216 | |
| 217 | 217 | switch (adc1038_adr) |
| 218 | 218 | { |
| 219 | case 0: adc1038_adc_data = readinputport(4); break; | |
| 220 | case 1: adc1038_adc_data = readinputport(5); break; | |
| 221 | case 2: adc1038_adc_data = readinputport(6); break; | |
| 222 | case 3: adc1038_adc_data = readinputport(7); break; | |
| 219 | case 0: adc1038_adc_data = input_port_read_indexed(machine, 4); break; | |
| 220 | case 1: adc1038_adc_data = input_port_read_indexed(machine, 5); break; | |
| 221 | case 2: adc1038_adc_data = input_port_read_indexed(machine, 6); break; | |
| 222 | case 3: adc1038_adc_data = input_port_read_indexed(machine, 7); break; | |
| 223 | 223 | case 4: adc1038_adc_data = 0x000; break; |
| 224 | 224 | case 5: adc1038_adc_data = 0x000; break; |
| 225 | 225 | case 6: adc1038_adc_data = 0x000; break; |
| r2375 | r2376 | |
| 255 | 255 | adc1038_clk = bit; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | static int adc1038_sars_r( | |
| 258 | static int adc1038_sars_r(running_machine *machine) | |
| 259 | 259 | { |
| 260 | 260 | adc1038_cycle = 0; |
| 261 | 261 | |
| 262 | 262 | switch (adc1038_adr) |
| 263 | 263 | { |
| 264 | case 0: adc1038_adc_data = readinputport(4); break; | |
| 265 | case 1: adc1038_adc_data = readinputport(5); break; | |
| 266 | case 2: adc1038_adc_data = readinputport(6); break; | |
| 267 | case 3: adc1038_adc_data = readinputport(7); break; | |
| 264 | case 0: adc1038_adc_data = input_port_read_indexed(machine, 4); break; | |
| 265 | case 1: adc1038_adc_data = input_port_read_indexed(machine, 5); break; | |
| 266 | case 2: adc1038_adc_data = input_port_read_indexed(machine, 6); break; | |
| 267 | case 3: adc1038_adc_data = input_port_read_indexed(machine, 7); break; | |
| 268 | 268 | case 4: adc1038_adc_data = 0x000; break; |
| 269 | 269 | case 5: adc1038_adc_data = 0x000; break; |
| 270 | 270 | case 6: adc1038_adc_data = 0x000; break; |
| r2375 | r2376 | |
| 285 | 285 | { |
| 286 | 286 | if (ACCESSING_BITS_24_31) |
| 287 | 287 | { |
| 288 | r |= | |
| 288 | r |= | |
| 289 | 289 | } |
| 290 | 290 | if (ACCESSING_BITS_16_23) |
| 291 | 291 | { |
| 292 | r |= | |
| 292 | r |= | |
| 293 | 293 | } |
| 294 | 294 | if (ACCESSING_BITS_8_15) |
| 295 | 295 | { |
| 296 | r |= (adc1038_sars_r() << 7) << 8; | |
| 296 | r |= (adc1038_sars_r(machine) << 7) << 8; | |
| 297 | 297 | } |
| 298 | 298 | if (ACCESSING_BITS_0_7) |
| 299 | 299 | { |
| 300 | r |= | |
| 300 | r |= | |
| 301 | 301 | } |
| 302 | 302 | return r; |
| 303 | 303 | } |
| r2375 | r2376 | |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | adc1038_di_w((data >> 24) & 1); |
| 360 | adc1038_clk_w((data >> 25) & 1); | |
| 360 | adc1038_clk_w(machine, (data >> 25) & 1); | |
| 361 | 361 | |
| 362 | 362 | set_cgboard_id((data >> 28) & 0x3); |
| 363 | 363 | } |
| r2375 | r2376 | |
|---|---|---|
| 440 | 440 | |
| 441 | 441 | if (bcd_7445<10) |
| 442 | 442 | { |
| 443 | ret = | |
| 443 | ret = | |
| 444 | 444 | } |
| 445 | 445 | return ret; |
| 446 | 446 | } |
| r2375 | r2376 | |
|---|---|---|
| 202 | 202 | |
| 203 | 203 | static READ16_HANDLER( analog_r ) |
| 204 | 204 | { |
| 205 | return | |
| 205 | return | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
| r2375 | r2376 | |
| 353 | 353 | |
| 354 | 354 | static READ8_HANDLER( pot_r ) |
| 355 | 355 | { |
| 356 | return ( | |
| 356 | return ( | |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | static const struct POKEYinterface pokey_interface = |
| r2375 | r2376 | |
|---|---|---|
| 514 | 514 | /***************************************************************************/ |
| 515 | 515 | |
| 516 | 516 | static void |
| 517 | simulate_mcu( | |
| 517 | simulate_mcu( running_machine *machine ) | |
| 518 | 518 | { |
| 519 | 519 | int i; |
| 520 | 520 | UINT16 data; |
| r2375 | r2376 | |
| 524 | 524 | |
| 525 | 525 | if (is_na2) |
| 526 | 526 | { |
| 527 | mcu_ram[0xfc0/2] = | |
| 527 | mcu_ram[0xfc0/2] = | |
| 528 | 528 | |
| 529 | 529 | for( i=1; i<=4; i++ ) |
| 530 | 530 | { |
| 531 | data = | |
| 531 | data = | |
| 532 | 532 | switch( namcona1_gametype ) |
| 533 | 533 | { |
| 534 | 534 | case NAMCO_KNCKHEAD: |
| r2375 | r2376 | |
| 547 | 547 | if( data&0x4000 ) data |= 0x10; /* jump */ |
| 548 | 548 | if( i==1 ) |
| 549 | 549 | { |
| 550 | if( | |
| 550 | if( | |
| 551 | 551 | } |
| 552 | 552 | if( i==2 ) |
| 553 | 553 | { |
| 554 | if( | |
| 554 | if( | |
| 555 | 555 | } |
| 556 | 556 | break; |
| 557 | 557 | |
| r2375 | r2376 | |
| 570 | 570 | mcu_ram[0xfc0/2+0x08] = 0xffff; /* analog6,7 */ |
| 571 | 571 | mcu_ram[0xfc0/2+0x09] = 0xffff; /* encoder0,1 */ |
| 572 | 572 | |
| 573 | poll_coins = | |
| 573 | poll_coins = | |
| 574 | 574 | if( (poll_coins&0x8)&~(mCoinState&0x8) ) mCoinCount[0]++; |
| 575 | 575 | if( (poll_coins&0x4)&~(mCoinState&0x4) ) mCoinCount[1]++; |
| 576 | 576 | if( (poll_coins&0x2)&~(mCoinState&0x2) ) mCoinCount[2]++; |
| r2375 | r2376 | |
| 581 | 581 | mcu_ram[0xfc0/2+0xb] = (mCoinCount[2]<<8)|mCoinCount[3]; |
| 582 | 582 | |
| 583 | 583 | /* special handling for F/A */ |
| 584 | data = ~(( | |
| 584 | data = ~(( | |
| 585 | 585 | mcu_ram[0xffc/2] = data; |
| 586 | 586 | mcu_ram[0xffe/2] = data; |
| 587 | 587 | |
| 588 | 588 | if( namcona1_gametype == NAMCO_XDAY2 ) |
| 589 | 589 | { |
| 590 | int p1 = readinputport(1); | |
| 591 | int p2 = readinputport(2); | |
| 590 | int p1 = input_port_read_indexed(machine, 1); | |
| 591 | int p2 = input_port_read_indexed(machine, 2); | |
| 592 | 592 | UINT32 code = 0; |
| 593 | 593 | if( p2&0x40 ) code |= 0x2000; // enter (top-level of self-test) |
| 594 | 594 | if( p2&0x20 ) code |= 0x1000; // exit (top-level of self-test) |
| r2375 | r2376 | |
| 1195 | 1195 | switch (mcu_port6 & 0xe0) |
| 1196 | 1196 | { |
| 1197 | 1197 | case 0x40: |
| 1198 | return | |
| 1198 | return | |
| 1199 | 1199 | break; |
| 1200 | 1200 | |
| 1201 | 1201 | case 0x60: |
| 1202 | return | |
| 1202 | return | |
| 1203 | 1203 | break; |
| 1204 | 1204 | |
| 1205 | 1205 | case 0x20: |
| 1206 | return | |
| 1206 | return | |
| 1207 | 1207 | break; |
| 1208 | 1208 | |
| 1209 | 1209 | case 0x00: |
| 1210 | return | |
| 1210 | return | |
| 1211 | 1211 | break; |
| 1212 | 1212 | } |
| 1213 | 1213 | |
| r2375 | r2376 | |
| 1256 | 1256 | static READ8_HANDLER( portana_r ) |
| 1257 | 1257 | { |
| 1258 | 1258 | static const UINT8 bitnum[8] = { 0x40, 0x20, 0x10, 0x01, 0x02, 0x04, 0x08, 0x80 }; |
| 1259 | UINT8 port = | |
| 1259 | UINT8 port = | |
| 1260 | 1260 | |
| 1261 | 1261 | return (port & bitnum[offset>>1]) ? 0xff : 0x00; |
| 1262 | 1262 | } |
| r2375 | r2376 | |
| 1275 | 1275 | int level = cpu_getiloops(); /* 0,1,2,3,4 */ |
| 1276 | 1276 | if( level==0 ) |
| 1277 | 1277 | { |
| 1278 | simulate_mcu(); | |
| 1278 | simulate_mcu(machine); | |
| 1279 | 1279 | } |
| 1280 | if( | |
| 1280 | if( | |
| 1281 | 1281 | { |
| 1282 | 1282 | if( (namcona1_vreg[0x1a/2]&(1<<level))==0 ) |
| 1283 | 1283 | { |
| r2375 | r2376 | |
|---|---|---|
| 835 | 835 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 836 | 836 | |
| 837 | 837 | MDRV_SOUND_ADD(DAC, 0) |
| 838 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", | |
| 838 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) | |
| 839 | 839 | |
| 840 | 840 | MDRV_SOUND_ADD(DAC, 0) |
| 841 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", | |
| 841 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) | |
| 842 | 842 | MACHINE_DRIVER_END |
| 843 | 843 | |
| 844 | 844 | static MACHINE_DRIVER_START( armedf ) |
| r2375 | r2376 | |
|---|---|---|
| 146 | 146 | switch (bit_mask) |
| 147 | 147 | { |
| 148 | 148 | case 0x01: |
| 149 | return (( | |
| 149 | return (( | |
| 150 | 150 | case 0x02: |
| 151 | return (( | |
| 151 | return (( | |
| 152 | 152 | default: |
| 153 | 153 | logerror("sidewndr_payout_r : invalid %02X bit_mask\n",bit_mask); |
| 154 | 154 | return 0; |
| r2375 | r2376 | |
| 162 | 162 | switch (bit_mask) |
| 163 | 163 | { |
| 164 | 164 | case 0x01: |
| 165 | return (( | |
| 165 | return (( | |
| 166 | 166 | case 0x02: |
| 167 | return (( | |
| 167 | return (( | |
| 168 | 168 | case 0x04: |
| 169 | return (( | |
| 169 | return (( | |
| 170 | 170 | case 0x08: |
| 171 | return (( | |
| 171 | return (( | |
| 172 | 172 | default: |
| 173 | 173 | logerror("starspnr_coinage_r : invalid %02X bit_mask\n",bit_mask); |
| 174 | 174 | return 0; |
| r2375 | r2376 | |
| 182 | 182 | switch (bit_mask) |
| 183 | 183 | { |
| 184 | 184 | case 0x01: |
| 185 | return (( | |
| 185 | return (( | |
| 186 | 186 | case 0x02: |
| 187 | return (( | |
| 187 | return (( | |
| 188 | 188 | case 0x04: |
| 189 | return (( | |
| 189 | return (( | |
| 190 | 190 | default: |
| 191 | 191 | logerror("starspnr_payout_r : invalid %02X bit_mask\n",bit_mask); |
| 192 | 192 | return 0; |
| r2375 | r2376 | |
|---|---|---|
| 593 | 593 | #if DEBUG_DISC_SOUND |
| 594 | 594 | static UINT8 ui_snd = 0; |
| 595 | 595 | static UINT8 lst = 0; |
| 596 | if (!lst && ( | |
| 596 | if (!lst && ( | |
| 597 | 597 | { |
| 598 | 598 | ui_snd = (ui_snd + 1) % 10; |
| 599 | 599 | popmessage("Sound %d", ui_snd); |
| 600 | 600 | } |
| 601 | lst = | |
| 601 | lst = | |
| 602 | 602 | if (ui_snd<8) |
| 603 | dkongjr_snd_w1(ui_snd, ( | |
| 603 | dkongjr_snd_w1(ui_snd, ( | |
| 604 | 604 | else |
| 605 | dkongjr_snd_w2(ui_snd-8, ( | |
| 605 | dkongjr_snd_w2(ui_snd-8, ( | |
| 606 | 606 | #endif |
| 607 | 607 | |
| 608 | r = ( | |
| 608 | r = ( | |
| 609 | 609 | coin_counter_w(offset, r >> 7); |
| 610 | 610 | if (r & 0x10) |
| 611 | 611 | r = (r & ~0x10) | 0x80; /* service ==> coint */ |
| r2375 | r2376 | |
|---|---|---|
| 66 | 66 | |
| 67 | 67 | UINT8 wheel[4] = |
| 68 | 68 | { |
| 69 | readinputportbytag("WHEEL1"), | |
| 70 | readinputportbytag("WHEEL2"), | |
| 71 | readinputportbytag("WHEEL3"), | |
| 72 | readinputportbytag("WHEEL4") | |
| 69 | input_port_read(machine, "WHEEL1"), | |
| 70 | input_port_read(machine, "WHEEL2"), | |
| 71 | input_port_read(machine, "WHEEL3"), | |
| 72 | input_port_read(machine, "WHEEL4") | |
| 73 | 73 | }; |
| 74 | 74 | UINT8 lever[4] = |
| 75 | 75 | { |
| 76 | readinputportbytag("LEVER1"), | |
| 77 | readinputportbytag("LEVER2"), | |
| 78 | readinputportbytag("LEVER3"), | |
| 79 | readinputportbytag("LEVER4") | |
| 76 | input_port_read(machine, "LEVER1"), | |
| 77 | input_port_read(machine, "LEVER2"), | |
| 78 | input_port_read(machine, "LEVER3"), | |
| 79 | input_port_read(machine, "LEVER4") | |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | 82 | int i; |
| r2375 | r2376 | |
| 115 | 115 | |
| 116 | 116 | /* NMI and watchdog are disabled during service mode */ |
| 117 | 117 | |
| 118 | watchdog_enable(machine, | |
| 118 | watchdog_enable(machine, | |
| 119 | 119 | |
| 120 | if ( | |
| 120 | if ( | |
| 121 | 121 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 122 | 122 | |
| 123 | 123 | timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, nmi_callback); |
| r2375 | r2376 | |
| 148 | 148 | |
| 149 | 149 | static READ8_HANDLER( sprint4_analog_r ) |
| 150 | 150 | { |
| 151 | return ( | |
| 151 | return ( | |
| 152 | 152 | } |
| 153 | 153 | static READ8_HANDLER( sprint4_coin_r ) |
| 154 | 154 | { |
| 155 | return ( | |
| 155 | return ( | |
| 156 | 156 | } |
| 157 | 157 | static READ8_HANDLER( sprint4_collision_r ) |
| 158 | 158 | { |
| 159 | return ( | |
| 159 | return ( | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
| 163 | 163 | static READ8_HANDLER( sprint4_options_r ) |
| 164 | 164 | { |
| 165 | return ( | |
| 165 | return ( | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 |
| r2375 | r2376 | |
|---|---|---|
| 52 | 52 | |
| 53 | 53 | static READ8_HANDLER( skyraid_port_0_r ) |
| 54 | 54 | { |
| 55 | UINT8 val = | |
| 55 | UINT8 val = | |
| 56 | 56 | |
| 57 | if ( | |
| 57 | if ( | |
| 58 | 58 | val |= 0x40; |
| 59 | if ( | |
| 59 | if ( | |
| 60 | 60 | val |= 0x80; |
| 61 | 61 | |
| 62 | 62 | return val; |
| r2375 | r2376 | |
|---|---|---|
| 302 | 302 | if (cpu_getiloops() == 0) |
| 303 | 303 | return; |
| 304 | 304 | /* generate NMI on coin insertion */ |
| 305 | if ((~ | |
| 305 | if ((~ | |
| 306 | 306 | cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, ASSERT_LINE); |
| 307 | 307 | } |
| 308 | 308 |
| r2375 | r2376 | |
|---|---|---|
| 78 | 78 | static int cheat = 0; |
| 79 | 79 | static const int bits[] = { 0xee, 0xff, 0xbb, 0xaa }; |
| 80 | 80 | |
| 81 | res = | |
| 81 | res = | |
| 82 | 82 | |
| 83 | if (( | |
| 83 | if (( | |
| 84 | 84 | { |
| 85 | 85 | res |= 0x55; |
| 86 | 86 | res &= bits[cheat]; |
| r2375 | r2376 | |
| 96 | 96 | static int cheat = 0; |
| 97 | 97 | static const int bits[] = { 0xee, 0xff, 0xbb, 0xaa }; |
| 98 | 98 | |
| 99 | res = | |
| 99 | res = | |
| 100 | 100 | |
| 101 | if (( | |
| 101 | if (( | |
| 102 | 102 | { |
| 103 | 103 | res |= 0x55; |
| 104 | 104 | res &= bits[cheat]; |
| r2375 | r2376 | |
|---|---|---|
| 1305 | 1305 | |
| 1306 | 1306 | static READ16_HANDLER( ddenlovr_special_r ) |
| 1307 | 1307 | { |
| 1308 | int res = | |
| 1308 | int res = | |
| 1309 | 1309 | |
| 1310 | 1310 | return res; |
| 1311 | 1311 | } |
| r2375 | r2376 | |
| 1486 | 1486 | /* 0 and 1 are read from offset 1, 2 from offset 0... */ |
| 1487 | 1487 | switch( ddenlovr_select2 ) |
| 1488 | 1488 | { |
| 1489 | case 0x00: return readinputport(0); | |
| 1490 | case 0x01: return readinputport(1); | |
| 1491 | case 0x02: return readinputport(2); | |
| 1489 | case 0x00: return input_port_read_indexed(machine, 0); | |
| 1490 | case 0x01: return input_port_read_indexed(machine, 1); | |
| 1491 | case 0x02: return input_port_read_indexed(machine, 2); | |
| 1492 | 1492 | } |
| 1493 | 1493 | return 0xff; |
| 1494 | 1494 | } |
| r2375 | r2376 | |
| 1496 | 1496 | |
| 1497 | 1497 | static READ8_HANDLER( quiz365_input_r ) |
| 1498 | 1498 | { |
| 1499 | if (!(ddenlovr_select & 0x01)) return readinputport(3); | |
| 1500 | if (!(ddenlovr_select & 0x02)) return readinputport(4); | |
| 1501 | if (!(ddenlovr_select & 0x04)) return readinputport(5); | |
| 1499 | if (!(ddenlovr_select & 0x01)) return input_port_read_indexed(machine, 3); | |
| 1500 | if (!(ddenlovr_select & 0x02)) return input_port_read_indexed(machine, 4); | |
| 1501 | if (!(ddenlovr_select & 0x04)) return input_port_read_indexed(machine, 5); | |
| 1502 | 1502 | if (!(ddenlovr_select & 0x08)) return 0xff;//mame_rand(machine); |
| 1503 | 1503 | if (!(ddenlovr_select & 0x10)) return 0xff;//mame_rand(machine); |
| 1504 | 1504 | return 0xff; |
| r2375 | r2376 | |
| 1510 | 1510 | /* 0 and 1 are read from offset 1, 2 from offset 0... */ |
| 1511 | 1511 | switch( ddenlovr_select2 ) |
| 1512 | 1512 | { |
| 1513 | case 0x10: return readinputport(0); | |
| 1514 | case 0x11: return readinputport(1); | |
| 1515 | case 0x12: return readinputport(2) | (ddenlovr_blitter_irq_flag << 6); | |
| 1513 | case 0x10: return input_port_read_indexed(machine, 0); | |
| 1514 | case 0x11: return input_port_read_indexed(machine, 1); | |
| 1515 | case 0x12: return input_port_read_indexed(machine, 2) | (ddenlovr_blitter_irq_flag << 6); | |
| 1516 | 1516 | } |
| 1517 | 1517 | return 0xff; |
| 1518 | 1518 | } |
| r2375 | r2376 | |
| 1615 | 1615 | static READ16_HANDLER( ddenlvrj_dsw_r ) |
| 1616 | 1616 | { |
| 1617 | 1617 | UINT16 dsw = 0; |
| 1618 | if ((~*ddenlvrj_dsw_sel) & 0x01) dsw |= readinputport(3); // dsw 1 | |
| 1619 | if ((~*ddenlvrj_dsw_sel) & 0x02) dsw |= readinputport(4); // dsw 2 | |
| 1620 | if ((~*ddenlvrj_dsw_sel) & 0x04) dsw |= readinputport(5); // ? | |
| 1618 | if ((~*ddenlvrj_dsw_sel) & 0x01) dsw |= input_port_read_indexed(machine, 3); // dsw 1 | |
| 1619 | if ((~*ddenlvrj_dsw_sel) & 0x02) dsw |= input_port_read_indexed(machine, 4); // dsw 2 | |
| 1620 | if ((~*ddenlvrj_dsw_sel) & 0x04) dsw |= input_port_read_indexed(machine, 5); // ? | |
| 1621 | 1621 | return dsw; |
| 1622 | 1622 | } |
| 1623 | 1623 | |
| r2375 | r2376 | |
| 1633 | 1633 | |
| 1634 | 1634 | static READ16_HANDLER( ddenlvrj_blitter_r ) |
| 1635 | 1635 | { |
| 1636 | return | |
| 1636 | return | |
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | 1639 | static ADDRESS_MAP_START( ddenlvrj_readmem, ADDRESS_SPACE_PROGRAM, 16 ) |
| r2375 | r2376 | |
| 1718 | 1718 | |
| 1719 | 1719 | static READ16_HANDLER( nettoqc_special_r ) |
| 1720 | 1720 | { |
| 1721 | return | |
| 1721 | return | |
| 1722 | 1722 | } |
| 1723 | 1723 | |
| 1724 | 1724 | static READ16_HANDLER( nettoqc_input_r ) |
| 1725 | 1725 | { |
| 1726 | if (!(ddenlovr_select & 0x01)) return readinputport(3); | |
| 1727 | if (!(ddenlovr_select & 0x02)) return readinputport(4); | |
| 1728 | if (!(ddenlovr_select & 0x04)) return readinputport(5); | |
| 1726 | if (!(ddenlovr_select & 0x01)) return input_port_read_indexed(machine, 3); | |
| 1727 | if (!(ddenlovr_select & 0x02)) return input_port_read_indexed(machine, 4); | |
| 1728 | if (!(ddenlovr_select & 0x04)) return input_port_read_indexed(machine, 5); | |
| 1729 | 1729 | return 0xffff; |
| 1730 | 1730 | } |
| 1731 | 1731 | |
| r2375 | r2376 | |
| 1810 | 1810 | |
| 1811 | 1811 | static READ8_HANDLER( rongrong_input_r ) |
| 1812 | 1812 | { |
| 1813 | if (!(ddenlovr_select & 0x01)) return readinputport(3); | |
| 1814 | if (!(ddenlovr_select & 0x02)) return readinputport(4); | |
| 1813 | if (!(ddenlovr_select & 0x01)) return input_port_read_indexed(machine, 3); | |
| 1814 | if (!(ddenlovr_select & 0x02)) return input_port_read_indexed(machine, 4); | |
| 1815 | 1815 | if (!(ddenlovr_select & 0x04)) return 0xff;//mame_rand(machine); |
| 1816 | 1816 | if (!(ddenlovr_select & 0x08)) return 0xff;//mame_rand(machine); |
| 1817 | if (!(ddenlovr_select & 0x10)) return | |
| 1817 | if (!(ddenlovr_select & 0x10)) return | |
| 1818 | 1818 | return 0xff; |
| 1819 | 1819 | } |
| 1820 | 1820 | |
| r2375 | r2376 | |
| 2131 | 2131 | |
| 2132 | 2132 | static READ8_HANDLER( funkyfig_dsw_r ) |
| 2133 | 2133 | { |
| 2134 | if (!(ddenlovr_select & 0x01)) return readinputport(3); | |
| 2135 | if (!(ddenlovr_select & 0x02)) return readinputport(4); | |
| 2136 | if (!(ddenlovr_select & 0x04)) return readinputport(5); | |
| 2134 | if (!(ddenlovr_select & 0x01)) return input_port_read_indexed(machine, 3); | |
| 2135 | if (!(ddenlovr_select & 0x02)) return input_port_read_indexed(machine, 4); | |
| 2136 | if (!(ddenlovr_select & 0x04)) return input_port_read_indexed(machine, 5); | |
| 2137 | 2137 | logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", activecpu_get_pc(), ddenlovr_select); |
| 2138 | 2138 | return 0xff; |
| 2139 | 2139 | } |
| r2375 | r2376 | |
| 2144 | 2144 | { |
| 2145 | 2145 | switch( ddenlovr_select2 ) |
| 2146 | 2146 | { |
| 2147 | case 0x22: return | |
| 2147 | case 0x22: return | |
| 2148 | 2148 | case 0x23: return funkyfig_lockout; |
| 2149 | 2149 | } |
| 2150 | 2150 | logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", activecpu_get_pc(), ddenlovr_select2); |
| r2375 | r2376 | |
| 2155 | 2155 | { |
| 2156 | 2156 | switch( ddenlovr_select2 ) |
| 2157 | 2157 | { |
| 2158 | case 0x20: return readinputport(0); | |
| 2159 | case 0x21: return readinputport(1); | |
| 2158 | case 0x20: return input_port_read_indexed(machine, 0); | |
| 2159 | case 0x21: return input_port_read_indexed(machine, 1); | |
| 2160 | 2160 | } |
| 2161 | 2161 | logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", activecpu_get_pc(), ddenlovr_select2); |
| 2162 | 2162 | return 0xff; |
| r2375 | r2376 | |
| 2266 | 2266 | { |
| 2267 | 2267 | UINT8 val = 0xff; |
| 2268 | 2268 | |
| 2269 | if (!(keyb & 0x01)) val = readinputport(offset * 5 + 1); | |
| 2270 | else if (!(keyb & 0x02)) val = readinputport(offset * 5 + 2); | |
| 2271 | else if (!(keyb & 0x04)) val = readinputport(offset * 5 + 3); | |
| 2272 | else if (!(keyb & 0x08)) val = readinputport(offset * 5 + 4); | |
| 2273 | else if (!(keyb & 0x10)) val = readinputport(offset * 5 + 5); | |
| 2269 | if (!(keyb & 0x01)) val = input_port_read_indexed(machine, offset * 5 + 1); | |
| 2270 | else if (!(keyb & 0x02)) val = input_port_read_indexed(machine, offset * 5 + 2); | |
| 2271 | else if (!(keyb & 0x04)) val = input_port_read_indexed(machine, offset * 5 + 3); | |
| 2272 | else if (!(keyb & 0x08)) val = input_port_read_indexed(machine, offset * 5 + 4); | |
| 2273 | else if (!(keyb & 0x10)) val = input_port_read_indexed(machine, offset * 5 + 5); | |
| 2274 | 2274 | |
| 2275 | val |= | |
| 2275 | val |= | |
| 2276 | 2276 | return val; |
| 2277 | 2277 | } |
| 2278 | 2278 | |
| 2279 | 2279 | static READ8_HANDLER( hanakanz_dsw_r ) |
| 2280 | 2280 | { |
| 2281 | if (!(dsw & 0x01)) return readinputport(11); | |
| 2282 | if (!(dsw & 0x02)) return readinputport(12); | |
| 2283 | if (!(dsw & 0x04)) return readinputport(13); | |
| 2284 | if (!(dsw & 0x08)) return readinputport(14); | |
| 2285 | if (!(dsw & 0x10)) return readinputport(15); | |
| 2281 | if (!(dsw & 0x01)) return input_port_read_indexed(machine, 11); | |
| 2282 | if (!(dsw & 0x02)) return input_port_read_indexed(machine, 12); | |
| 2283 | if (!(dsw & 0x04)) return input_port_read_indexed(machine, 13); | |
| 2284 | if (!(dsw & 0x08)) return input_port_read_indexed(machine, 14); | |
| 2285 | if (!(dsw & 0x10)) return input_port_read_indexed(machine, 15); | |
| 2286 | 2286 | return 0xff; |
| 2287 | 2287 | } |
| 2288 | 2288 | |
| r2375 | r2376 | |
| 2471 | 2471 | { |
| 2472 | 2472 | UINT8 val = 0xff; |
| 2473 | 2473 | |
| 2474 | if (!(keyb & 0x01)) val = readinputport(offset * 5 + 1); | |
| 2475 | else if (!(keyb & 0x02)) val = readinputport(offset * 5 + 2); | |
| 2476 | else if (!(keyb & 0x04)) val = readinputport(offset * 5 + 3); | |
| 2477 | else if (!(keyb & 0x08)) val = readinputport(offset * 5 + 4); | |
| 2478 | else if (!(keyb & 0x10)) val = readinputport(offset * 5 + 5); | |
| 2474 | if (!(keyb & 0x01)) val = input_port_read_indexed(machine, offset * 5 + 1); | |
| 2475 | else if (!(keyb & 0x02)) val = input_port_read_indexed(machine, offset * 5 + 2); | |
| 2476 | else if (!(keyb & 0x04)) val = input_port_read_indexed(machine, offset * 5 + 3); | |
| 2477 | else if (!(keyb & 0x08)) val = input_port_read_indexed(machine, offset * 5 + 4); | |
| 2478 | else if (!(keyb & 0x10)) val = input_port_read_indexed(machine, offset * 5 + 5); | |
| 2479 | 2479 | |
| 2480 | val |= | |
| 2480 | val |= | |
| 2481 | 2481 | if (offset) val |= 0x80; // blitter busy |
| 2482 | 2482 | return val; |
| 2483 | 2483 | } |
| r2375 | r2376 | |
| 2633 | 2633 | { |
| 2634 | 2634 | switch( ddenlovr_select2 ) |
| 2635 | 2635 | { |
| 2636 | case 0x00: return | |
| 2636 | case 0x00: return | |
| 2637 | 2637 | case 0x01: return 0xff; |
| 2638 | 2638 | case 0x02: return 0xff; // bit 7 = 0 -> blitter busy, + hopper switch |
| 2639 | 2639 | case 0x03: return 0xff; |
| r2375 | r2376 | |
| 2648 | 2648 | { |
| 2649 | 2649 | UINT8 ret = 0xff; |
| 2650 | 2650 | |
| 2651 | if (keyb & 0x01) ret = readinputport(1); | |
| 2652 | else if (keyb & 0x02) ret = readinputport(2); | |
| 2653 | else if (keyb & 0x04) ret = readinputport(3); | |
| 2654 | else if (keyb & 0x08) ret = readinputport(4); | |
| 2655 | else if (keyb & 0x10) ret = readinputport(5); | |
| 2651 | if (keyb & 0x01) ret = input_port_read_indexed(machine, 1); | |
| 2652 | else if (keyb & 0x02) ret = input_port_read_indexed(machine, 2); | |
| 2653 | else if (keyb & 0x04) ret = input_port_read_indexed(machine, 3); | |
| 2654 | else if (keyb & 0x08) ret = input_port_read_indexed(machine, 4); | |
| 2655 | else if (keyb & 0x10) ret = input_port_read_indexed(machine, 5); | |
| 2656 | 2656 | else logerror("%06x: warning, unknown bits read, keyb = %02x\n", activecpu_get_pc(), keyb); |
| 2657 | 2657 | |
| 2658 | 2658 | keyb <<= 1; |
| r2375 | r2376 | |
| 2662 | 2662 | |
| 2663 | 2663 | static READ8_HANDLER( mjmyster_dsw_r ) |
| 2664 | 2664 | { |
| 2665 | if (!(ddenlovr_select & 0x01)) return readinputport(9); | |
| 2666 | if (!(ddenlovr_select & 0x02)) return readinputport(8); | |
| 2667 | if (!(ddenlovr_select & 0x04)) return readinputport(7); | |
| 2668 | if (!(ddenlovr_select & 0x08)) return readinputport(6); | |
| 2669 | if (!(ddenlovr_select & 0x10)) return readinputport(10); | |
| 2665 | if (!(ddenlovr_select & 0x01)) return input_port_read_indexed(machine, 9); | |
| 2666 | if (!(ddenlovr_select & 0x02)) return input_port_read_indexed(machine, 8); | |
| 2667 | if (!(ddenlovr_select & 0x04)) return input_port_read_indexed(machine, 7); | |
| 2668 | if (!(ddenlovr_select & 0x08)) return input_port_read_indexed(machine, 6); | |
| 2669 | if (!(ddenlovr_select & 0x10)) return input_port_read_indexed(machine, 10); | |
| 2670 | 2670 | logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", activecpu_get_pc(), ddenlovr_select); |
| 2671 | 2671 | return 0xff; |
| 2672 | 2672 | } |
| r2375 | r2376 | |
| 2765 | 2765 | |
| 2766 | 2766 | static READ8_HANDLER( hginga_dsw_r ) |
| 2767 | 2767 | { |
| 2768 | if (!(ddenlovr_select & 0x01)) return readinputport(11); | |
| 2769 | if (!(ddenlovr_select & 0x02)) return readinputport(12); | |
| 2770 | if (!(ddenlovr_select & 0x04)) return readinputport(13); | |
| 2771 | if (!(ddenlovr_select & 0x08)) return readinputport(14); | |
| 2772 | if (!(ddenlovr_select & 0x10)) return readinputport(15); | |
| 2768 | if (!(ddenlovr_select & 0x01)) return input_port_read_indexed(machine, 11); | |
| 2769 | if (!(ddenlovr_select & 0x02)) return input_port_read_indexed(machine, 12); | |
| 2770 | if (!(ddenlovr_select & 0x04)) return input_port_read_indexed(machine, 13); | |
| 2771 | if (!(ddenlovr_select & 0x08)) return input_port_read_indexed(machine, 14); | |
| 2772 | if (!(ddenlovr_select & 0x10)) return input_port_read_indexed(machine, 15); | |
| 2773 | 2773 | logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", activecpu_get_pc(), ddenlovr_select); |
| 2774 | 2774 | return 0xff; |
| 2775 | 2775 | } |
| r2375 | r2376 | |
| 2786 | 2786 | { |
| 2787 | 2787 | switch( hginga_select ) |
| 2788 | 2788 | { |
| 2789 | case 0x20: return readinputport(0); | |
| 2790 | case 0x21: return readinputport(16); | |
| 2789 | case 0x20: return input_port_read_indexed(machine, 0); | |
| 2790 | case 0x21: return input_port_read_indexed(machine, 16); | |
| 2791 | 2791 | case 0x22: return 0x7f; // bit 7 = blitter busy, bit 6 = hopper |
| 2792 | 2792 | case 0x23: return hginga_coins; |
| 2793 | 2793 | } |
| r2375 | r2376 | |
| 2832 | 2832 | |
| 2833 | 2833 | // player 1 |
| 2834 | 2834 | case 0xa1: |
| 2835 | return | |
| 2835 | return | |
| 2836 | 2836 | |
| 2837 | 2837 | // player 2 |
| 2838 | 2838 | case 0xa2: |
| 2839 | return | |
| 2839 | return | |
| 2840 | 2840 | } |
| 2841 | 2841 | logerror("%04x: input_r with select = %02x\n",activecpu_get_pc(),hginga_select); |
| 2842 | 2842 | return 0xff; |
| r2375 | r2376 | |
| 2914 | 2914 | { |
| 2915 | 2915 | UINT8 hopper_bit = ((hgokou_hopper && !(video_screen_get_frame_number(machine->primary_screen)%10)) ? 0 : (1<<6)); |
| 2916 | 2916 | |
| 2917 | if (!(ddenlovr_select2 & 0x01)) return readinputport(player * 5 + 1) | hopper_bit; | |
| 2918 | if (!(ddenlovr_select2 & 0x02)) return readinputport(player * 5 + 2) | hopper_bit; | |
| 2919 | if (!(ddenlovr_select2 & 0x04)) return readinputport(player * 5 + 3) | hopper_bit; | |
| 2920 | if (!(ddenlovr_select2 & 0x08)) return readinputport(player * 5 + 4) | hopper_bit; | |
| 2921 | if (!(ddenlovr_select2 & 0x10)) return readinputport(player * 5 + 5) | hopper_bit; | |
| 2917 | if (!(ddenlovr_select2 & 0x01)) return input_port_read_indexed(machine, player * 5 + 1) | hopper_bit; | |
| 2918 | if (!(ddenlovr_select2 & 0x02)) return input_port_read_indexed(machine, player * 5 + 2) | hopper_bit; | |
| 2919 | if (!(ddenlovr_select2 & 0x04)) return input_port_read_indexed(machine, player * 5 + 3) | hopper_bit; | |
| 2920 | if (!(ddenlovr_select2 & 0x08)) return input_port_read_indexed(machine, player * 5 + 4) | hopper_bit; | |
| 2921 | if (!(ddenlovr_select2 & 0x10)) return input_port_read_indexed(machine, player * 5 + 5) | hopper_bit; | |
| 2922 | 2922 | |
| 2923 | 2923 | return 0x7f; // bit 7 = blitter busy, bit 6 = hopper |
| 2924 | 2924 | } |
| r2375 | r2376 | |
| 2927 | 2927 | { |
| 2928 | 2928 | switch (hginga_select) |
| 2929 | 2929 | { |
| 2930 | case 0x20: return | |
| 2930 | case 0x20: return | |
| 2931 | 2931 | case 0x21: return hgokou_player_r(machine, 1); |
| 2932 | 2932 | case 0x22: return hgokou_player_r(machine, 0); |
| 2933 | 2933 | case 0x23: return hginga_coins; |
| r2375 | r2376 | |
| 3037 | 3037 | { |
| 3038 | 3038 | switch (hginga_select) |
| 3039 | 3039 | { |
| 3040 | case 0x00: return readinputport(0); // P1 (Joy) | |
| 3041 | case 0x01: return readinputport(1); // P2 (Joy) | |
| 3042 | case 0x02: return readinputport(2); // Coins | |
| 3040 | case 0x00: return input_port_read_indexed(machine, 0); // P1 (Joy) | |
| 3041 | case 0x01: return input_port_read_indexed(machine, 1); // P2 (Joy) | |
| 3042 | case 0x02: return input_port_read_indexed(machine, 2); // Coins | |
| 3043 | 3043 | case 0x0d: return 0x00; |
| 3044 | case 0x80: return readinputport(3 + hginga_ip++); // P1 (Keys) | |
| 3045 | case 0x81: return readinputport(8 + hginga_ip++); // P2 (Keys) | |
| 3044 | case 0x80: return input_port_read_indexed(machine, 3 + hginga_ip++); // P1 (Keys) | |
| 3045 | case 0x81: return input_port_read_indexed(machine, 8 + hginga_ip++); // P2 (Keys) | |
| 3046 | 3046 | } |
| 3047 | 3047 | logerror("%06x: warning, unknown bits read, hginga_select = %02x\n", activecpu_get_pc(), hginga_select); |
| 3048 | 3048 | return 0xff; |
| r2375 | r2376 | |
| 3050 | 3050 | |
| 3051 | 3051 | static READ8_HANDLER( hparadis_dsw_r ) |
| 3052 | 3052 | { |
| 3053 | if (!(ddenlovr_select & 0x01)) return readinputport(13); | |
| 3054 | if (!(ddenlovr_select & 0x02)) return readinputport(14); | |
| 3053 | if (!(ddenlovr_select & 0x01)) return input_port_read_indexed(machine, 13); | |
| 3054 | if (!(ddenlovr_select & 0x02)) return input_port_read_indexed(machine, 14); | |
| 3055 | 3055 | if (!(ddenlovr_select & 0x04)) return 0xff; |
| 3056 | 3056 | if (!(ddenlovr_select & 0x08)) return 0xff; |
| 3057 | if (!(ddenlovr_select & 0x10)) return | |
| 3057 | if (!(ddenlovr_select & 0x10)) return | |
| 3058 | 3058 | return 0xff; |
| 3059 | 3059 | } |
| 3060 | 3060 | |
| r2375 | r2376 | |
| 3118 | 3118 | { |
| 3119 | 3119 | switch( ddenlovr_select2 ) |
| 3120 | 3120 | { |
| 3121 | case 0x80: return | |
| 3121 | case 0x80: return | |
| 3122 | 3122 | case 0x81: return 0x00; |
| 3123 | 3123 | case 0x82: return 0xff; // bit 7 = 0 -> blitter busy, + hopper switch |
| 3124 | 3124 | case 0x83: return 0x00; |
| r2375 | r2376 | |
| 3194 | 3194 | static READ16_HANDLER( akamaru_dsw_r ) |
| 3195 | 3195 | { |
| 3196 | 3196 | UINT16 dsw = 0; |
| 3197 | if (akamaru_dsw_sel[1] == 0xff) dsw |= readinputport(3); | |
| 3198 | if (akamaru_dsw_sel[0] == 0xff) dsw |= readinputport(4); | |
| 3197 | if (akamaru_dsw_sel[1] == 0xff) dsw |= input_port_read_indexed(machine, 3); | |
| 3198 | if (akamaru_dsw_sel[0] == 0xff) dsw |= input_port_read_indexed(machine, 4); | |
| 3199 | 3199 | return dsw; |
| 3200 | 3200 | } |
| 3201 | 3201 | |
| r2375 | r2376 | |
| 3280 | 3280 | { |
| 3281 | 3281 | UINT8 val = 0xff; |
| 3282 | 3282 | |
| 3283 | if (!(keyb & 0x01)) val = readinputport(offset * 5 + 1); | |
| 3284 | else if (!(keyb & 0x02)) val = readinputport(offset * 5 + 2); | |
| 3285 | else if (!(keyb & 0x04)) val = readinputport(offset * 5 + 3); | |
| 3286 | else if (!(keyb & 0x08)) val = readinputport(offset * 5 + 4); | |
| 3287 | else if (!(keyb & 0x10)) val = readinputport(offset * 5 + 5); | |
| 3283 | if (!(keyb & 0x01)) val = input_port_read_indexed(machine, offset * 5 + 1); | |
| 3284 | else if (!(keyb & 0x02)) val = input_port_read_indexed(machine, offset * 5 + 2); | |
| 3285 | else if (!(keyb & 0x04)) val = input_port_read_indexed(machine, offset * 5 + 3); | |
| 3286 | else if (!(keyb & 0x08)) val = input_port_read_indexed(machine, offset * 5 + 4); | |
| 3287 | else if (!(keyb & 0x10)) val = input_port_read_indexed(machine, offset * 5 + 5); | |
| 3288 | 3288 | |
| 3289 | 3289 | return val; |
| 3290 | 3290 | } |
| r2375 | r2376 | |
| 3296 | 3296 | // bit 7 = 1 -> blitter busy |
| 3297 | 3297 | // bit 6 = 0 -> VBLANK? |
| 3298 | 3298 | // bit 5 = 0 -> RTC? |
| 3299 | return | |
| 3299 | return | |
| 3300 | 3300 | } |
| 3301 | 3301 | |
| 3302 | 3302 | static WRITE8_HANDLER( mjflove_blitter_w ) |
| r2375 | r2376 | |
|---|---|---|
| 78 | 78 | #include "sound/2151intf.h" |
| 79 | 79 | #include "sound/okim6295.h" |
| 80 | 80 | |
| 81 | extern void (*toybox_mcu_run)(void); /* one of the following */ | |
| 82 | void bloodwar_mcu_run(void); | |
| 83 | void bonkadv_mcu_run(void); | |
| 84 | void gtmr_mcu_run(void); | |
| 81 | extern void (*toybox_mcu_run)(running_machine *machine); /* one of the following */ | |
| 82 | void bloodwar_mcu_run(running_machine *machine); | |
| 83 | void bonkadv_mcu_run(running_machine *machine); | |
| 84 | void gtmr_mcu_run(running_machine *machine); | |
| 85 | 85 | |
| 86 | 86 | /*************************************************************************** |
| 87 | 87 | |
| r2375 | r2376 | |
| 603 | 603 | |
| 604 | 604 | static READ16_HANDLER( gtmr_wheel_r ) |
| 605 | 605 | { |
| 606 | if ( (readinputport(4) & 0x1800) == 0x10) // DSW setting | |
| 607 | return readinputport(5)<<8; // 360' Wheel | |
| 606 | if ( (input_port_read_indexed(machine, 4) & 0x1800) == 0x10) // DSW setting | |
| 607 | return input_port_read_indexed(machine, 5)<<8; // 360' Wheel | |
| 608 | 608 | else |
| 609 | return | |
| 609 | return | |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | static WRITE16_HANDLER( gtmr_oki_0_bank_w ) |
| r2375 | r2376 | |
| 708 | 708 | |
| 709 | 709 | static READ16_HANDLER( gtmr2_wheel_r ) |
| 710 | 710 | { |
| 711 | switch ( | |
| 711 | switch ( | |
| 712 | 712 | { |
| 713 | 713 | case 0x0000: // 270' A. Wheel |
| 714 | return ( | |
| 714 | return ( | |
| 715 | 715 | break; |
| 716 | 716 | case 0x1000: // 270' D. Wheel |
| 717 | return ( | |
| 717 | return ( | |
| 718 | 718 | break; |
| 719 | 719 | case 0x0800: // 360' Wheel |
| 720 | return ( | |
| 720 | return ( | |
| 721 | 721 | break; |
| 722 | 722 | default: |
| 723 | 723 | logerror("gtmr2_wheel_r : read at %06x with joystick\n", activecpu_get_pc()); |
| r2375 | r2376 | |
| 728 | 728 | |
| 729 | 729 | static READ16_HANDLER( gtmr2_IN1_r ) |
| 730 | 730 | { |
| 731 | return ( | |
| 731 | return ( | |
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | static ADDRESS_MAP_START( gtmr2_readmem, ADDRESS_SPACE_PROGRAM, 16 ) |
| r2375 | r2376 | |
|---|---|---|
| 115 | 115 | |
| 116 | 116 | static READ16_HANDLER( dbz_inp0_r ) |
| 117 | 117 | { |
| 118 | return | |
| 118 | return | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | static READ16_HANDLER( dbz_inp1_r ) |
| 122 | 122 | { |
| 123 | return | |
| 123 | return | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | static READ16_HANDLER( dbz_inp2_r ) |
| 127 | 127 | { |
| 128 | return | |
| 128 | return | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | static WRITE16_HANDLER( dbz_sound_command_w ) |
| r2375 | r2376 | |
|---|---|---|
| 236 | 236 | switch( offset ) |
| 237 | 237 | { |
| 238 | 238 | case 2/2: |
| 239 | return ( ( | |
| 239 | return ( ( | |
| 240 | 240 | |
| 241 | 241 | // 0x00110007 is controller device select |
| 242 | 242 | // 0x001100D5 is controller data |
| r2375 | r2376 | |
| 245 | 245 | switch( (io_ram[7/2]) & 0xff ) |
| 246 | 246 | { |
| 247 | 247 | case 0: |
| 248 | io_ram[0xd5/2] = | |
| 248 | io_ram[0xd5/2] = | |
| 249 | 249 | break; |
| 250 | 250 | |
| 251 | 251 | case 0x20: |
| 252 | io_ram[0xd5/2] = | |
| 252 | io_ram[0xd5/2] = | |
| 253 | 253 | break; |
| 254 | 254 | |
| 255 | 255 | case 0x40: |
| 256 | io_ram[0xd5/2] = | |
| 256 | io_ram[0xd5/2] = | |
| 257 | 257 | break; |
| 258 | 258 | |
| 259 | 259 | case 0x42: |
| r2375 | r2376 | |
| 265 | 265 | break; |
| 266 | 266 | |
| 267 | 267 | case 0x60: |
| 268 | io_ram[0xd5/2] = | |
| 268 | io_ram[0xd5/2] = | |
| 269 | 269 | break; |
| 270 | 270 | |
| 271 | 271 | default: |
| r2375 | r2376 | |
| 274 | 274 | return 0; |
| 275 | 275 | |
| 276 | 276 | case 6/2: |
| 277 | return | |
| 277 | return | |
| 278 | 278 | |
| 279 | 279 | case 9/2: |
| 280 | return | |
| 280 | return | |
| 281 | 281 | |
| 282 | 282 | case 0xb/2: |
| 283 | return | |
| 283 | return | |
| 284 | 284 | |
| 285 | 285 | case 0xd5/2: |
| 286 | 286 | return io_ram[offset]; // controller data |
| r2375 | r2376 | |
|---|---|---|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | static void memm_driver_init( | |
| 307 | static void memm_driver_init( running_machine *machine ) | |
| 308 | 308 | { |
| 309 | psx_driver_init(); | |
| 309 | psx_driver_init(machine); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | static void memn_driver_init( | |
| 312 | static void memn_driver_init( running_machine *machine ) | |
| 313 | 313 | { |
| 314 | 314 | UINT8 *BIOS = (UINT8 *)memory_region( REGION_USER1 ); |
| 315 | 315 | UINT8 *ROM = (UINT8 *)memory_region( REGION_USER2 ); |
| r2375 | r2376 | |
| 317 | 317 | memcpy32le( (UINT32 *)( BIOS + 0x0000000 ), ROM + 0x08000, 0x001c000 ); |
| 318 | 318 | memcpy32le( (UINT32 *)( BIOS + 0x0020000 ), ROM + 0x24000, 0x03dffff ); |
| 319 | 319 | |
| 320 | psx_driver_init(); | |
| 320 | psx_driver_init(machine); | |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | static void decrypt_bios( int b15, int b14, int b13, int b12, int b11, int b10, int b9, int b8, |
| r2375 | r2376 | |
| 336 | 336 | |
| 337 | 337 | static DRIVER_INIT( mrdrilr2 ) |
| 338 | 338 | { |
| 339 | memm_driver_init(); | |
| 339 | memm_driver_init(machine); | |
| 340 | 340 | decrypt_bios( 0xc, 0xd, 0xf, 0xe, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x4, 0x1, 0x2, 0x5, 0x0, 0x3 ); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | static DRIVER_INIT( gjspace ) |
| 344 | 344 | { |
| 345 | memn_driver_init(); | |
| 345 | memn_driver_init(machine); | |
| 346 | 346 | decrypt_bios( 0x0, 0x2, 0xe, 0xd, 0xf, 0x6, 0xc, 0x7, 0x5, 0x1, 0x9, 0x8, 0xa, 0x3, 0x4, 0xb ); |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | static DRIVER_INIT( mrdrilrg ) |
| 350 | 350 | { |
| 351 | memn_driver_init(); | |
| 351 | memn_driver_init(machine); | |
| 352 | 352 | decrypt_bios( 0x6, 0x4, 0x7, 0x5, 0x2, 0x1, 0x0, 0x3, 0xc, 0xd, 0xe, 0xf, 0x8, 0x9, 0xb, 0xa ); |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | static DRIVER_INIT( knpuzzle ) |
| 356 | 356 | { |
| 357 | memn_driver_init(); | |
| 357 | memn_driver_init(machine); | |
| 358 | 358 | decrypt_bios( 0x6, 0x7, 0x4, 0x5, 0x2, 0x0, 0x3, 0x1, 0xc, 0xd, 0xe, 0xf, 0x9, 0xb, 0x8, 0xa ); |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | static DRIVER_INIT( startrgn ) |
| 362 | 362 | { |
| 363 | memn_driver_init(); | |
| 363 | memn_driver_init(machine); | |
| 364 | 364 | decrypt_bios( 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9 ); |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | static DRIVER_INIT( gamshara ) |
| 368 | 368 | { |
| 369 | memn_driver_init(); | |
| 369 | memn_driver_init(machine); | |
| 370 | 370 | decrypt_bios( 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb ); |
| 371 | 371 | } |
| 372 | 372 |
| r2375 | r2376 | |
|---|---|---|
| 193 | 193 | |
| 194 | 194 | static READ16_HANDLER( port4_r ) |
| 195 | 195 | { |
| 196 | int temp = | |
| 196 | int temp = | |
| 197 | 197 | if (atarigen_cpu_to_sound_ready) temp ^= 0x0020; |
| 198 | 198 | if (atarigen_sound_to_cpu_ready) temp ^= 0x0010; |
| 199 | 199 | return temp; |
| r2375 | r2376 | |
| 237 | 237 | if (atarigen_cpu_to_sound_ready) temp ^= 0x80; |
| 238 | 238 | if (atarigen_sound_to_cpu_ready) temp ^= 0x40; |
| 239 | 239 | if (tms5220_ready_r()) temp ^= 0x20; |
| 240 | if (!( | |
| 240 | if (!( | |
| 241 | 241 | |
| 242 | 242 | return temp; |
| 243 | 243 | } |
| r2375 | r2376 | |
|---|---|---|
| 213 | 213 | static READ32_HANDLER ( ms32_read_inputs1 ) |
| 214 | 214 | { |
| 215 | 215 | int a,b,c,d; |
| 216 | a = readinputport(0); // unknown | |
| 217 | b = readinputport(1); // System inputs | |
| 218 | c = readinputport(2); // Player 1 inputs | |
| 219 | d = readinputport(3); // Player 2 inputs | |
| 216 | a = input_port_read_indexed(machine, 0); // unknown | |
| 217 | b = input_port_read_indexed(machine, 1); // System inputs | |
| 218 | c = input_port_read_indexed(machine, 2); // Player 1 inputs | |
| 219 | d = input_port_read_indexed(machine, 3); // Player 2 inputs | |
| 220 | 220 | return a << 24 | b << 16 | c << 0 | d << 8; |
| 221 | 221 | } |
| 222 | 222 | |
| r2375 | r2376 | |
| 224 | 224 | static READ32_HANDLER ( ms32_mahjong_read_inputs1 ) |
| 225 | 225 | { |
| 226 | 226 | int a,b,c,d; |
| 227 | a = readinputport(0); // unknown | |
| 228 | b = readinputport(1); // System inputs | |
| 227 | a = input_port_read_indexed(machine, 0); // unknown | |
| 228 | b = input_port_read_indexed(machine, 1); // System inputs | |
| 229 | 229 | |
| 230 | 230 | switch (ms32_mahjong_input_select[0]) |
| 231 | 231 | { |
| 232 | 232 | case 0x01: |
| 233 | c = | |
| 233 | c = | |
| 234 | 234 | break; |
| 235 | 235 | case 0x02: |
| 236 | c = | |
| 236 | c = | |
| 237 | 237 | break; |
| 238 | 238 | case 0x04: |
| 239 | c = | |
| 239 | c = | |
| 240 | 240 | break; |
| 241 | 241 | case 0x08: |
| 242 | c = | |
| 242 | c = | |
| 243 | 243 | break; |
| 244 | 244 | case 0x10: |
| 245 | c = | |
| 245 | c = | |
| 246 | 246 | break; |
| 247 | 247 | default: |
| 248 | 248 | c = 0; |
| 249 | 249 | |
| 250 | 250 | } |
| 251 | d = | |
| 251 | d = | |
| 252 | 252 | return a << 24 | b << 16 | c << 0 | d << 8; |
| 253 | 253 | } |
| 254 | 254 | |
| r2375 | r2376 | |
| 256 | 256 | static READ32_HANDLER ( ms32_read_inputs2 ) |
| 257 | 257 | { |
| 258 | 258 | int a,b,c,d; |
| 259 | a = readinputport(4); // Dip 1 | |
| 260 | b = readinputport(5); // Dip 2 | |
| 261 | c = readinputport(6); // Dip 3 | |
| 262 | d = readinputport(7); // unused ? | |
| 259 | a = input_port_read_indexed(machine, 4); // Dip 1 | |
| 260 | b = input_port_read_indexed(machine, 5); // Dip 2 | |
| 261 | c = input_port_read_indexed(machine, 6); // Dip 3 | |
| 262 | d = input_port_read_indexed(machine, 7); // unused ? | |
| 263 | 263 | return a << 8 | b << 0 | c << 16 | d << 24; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | static READ32_HANDLER ( ms32_read_inputs3 ) |
| 267 | 267 | { |
| 268 | 268 | int a,b,c,d; |
| 269 | a = readinputport(10); // unused? | |
| 270 | b = readinputport(10); // unused? | |
| 271 | c = readinputport(9); | |
| 272 | d = (readinputport(8) - 0xb0) & 0xff; | |
| 269 | a = input_port_read_indexed(machine, 10); // unused? | |
| 270 | b = input_port_read_indexed(machine, 10); // unused? | |
| 271 | c = input_port_read_indexed(machine, 9); | |
| 272 | d = (input_port_read_indexed(machine, 8) - 0xb0) & 0xff; | |
| 273 | 273 | return a << 24 | b << 16 | c << 8 | d << 0; |
| 274 | 274 | } |
| 275 | 275 |
| r2375 | r2376 | |
|---|---|---|
| 705 | 705 | static READ8_HANDLER( pia_ic5_porta_r ) |
| 706 | 706 | { |
| 707 | 707 | LOG(("%04x IC5 PIA Read of Port A (AUX1)\n",activecpu_get_previouspc())); |
| 708 | return | |
| 708 | return | |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | |
| r2375 | r2376 | |
| 716 | 716 | coin_lockout_w(1, (pia_get_output_b(2) & 0x02) ); |
| 717 | 717 | coin_lockout_w(2, (pia_get_output_b(2) & 0x04) ); |
| 718 | 718 | coin_lockout_w(3, (pia_get_output_b(2) & 0x08) ); |
| 719 | return | |
| 719 | return | |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | |
| r2375 | r2376 | |
| 956 | 956 | /* The orange inputs are polled twice as often as the black ones, for reasons of efficiency. |
| 957 | 957 | This is achieved via connecting every input line to an AND gate, thus allowing two strobes |
| 958 | 958 | to represent each orange input bank (strobes are active low). */ |
| 959 | pia_set_input_cb1(2, (readinputportbytag("AUX2") & 0x80)); | |
| 960 | return readinputport(input_read); | |
| 959 | pia_set_input_cb1(2, (input_port_read(machine, "AUX2") & 0x80)); | |
| 960 | return input_port_read_indexed(machine, input_read); | |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 |
| r2375 | r2376 | |
|---|---|---|
| 54 | 54 | switch (offset<<1) |
| 55 | 55 | { |
| 56 | 56 | case 0: /* Dip Switches */ |
| 57 | return ( | |
| 57 | return ( | |
| 58 | 58 | |
| 59 | 59 | case 2: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 60 | return ( | |
| 60 | return ( | |
| 61 | 61 | |
| 62 | 62 | case 4: /* Credits */ |
| 63 | return | |
| 63 | return | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | return ~0; |
| r2375 | r2376 | |
|---|---|---|
| 92 | 92 | |
| 93 | 93 | static READ8_HANDLER( friskyt_portB_r ) |
| 94 | 94 | { |
| 95 | return (portb & 0x9f) | ( | |
| 95 | return (portb & 0x9f) | ( | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | static WRITE8_HANDLER( friskyt_portB_w ) |
| r2375 | r2376 | |
|---|---|---|
| 1201 | 1201 | /***************************************************************************/ |
| 1202 | 1202 | |
| 1203 | 1203 | static READ16_HANDLER( ga_io_players_r ) { |
| 1204 | return ( | |
| 1204 | return ( | |
| 1205 | 1205 | } |
| 1206 | 1206 | static READ16_HANDLER( ga_io_service_r ) |
| 1207 | 1207 | { |
| r2375 | r2376 | |
| 1401 | 1401 | static READ16_HANDLER( passht4b_service_r ) |
| 1402 | 1402 | { |
| 1403 | 1403 | UINT16 val=input_port_2_word_r(machine,offset,0); |
| 1404 | if(!(readinputport(0) & 0x40)) val&=0xef; | |
| 1405 | if(!(readinputport(1) & 0x40)) val&=0xdf; | |
| 1406 | if(!(readinputport(5) & 0x40)) val&=0xbf; | |
| 1407 | if(!(readinputport(6) & 0x40)) val&=0x7f; | |
| 1404 | if(!(input_port_read_indexed(machine, 0) & 0x40)) val&=0xef; | |
| 1405 | if(!(input_port_read_indexed(machine, 1) & 0x40)) val&=0xdf; | |
| 1406 | if(!(input_port_read_indexed(machine, 5) & 0x40)) val&=0xbf; | |
| 1407 | if(!(input_port_read_indexed(machine, 6) & 0x40)) val&=0x7f; | |
| 1408 | 1408 | |
| 1409 | passht4b_io3_val=(readinputport(0)<<4) | (readinputport(5)&0xf); | |
| 1410 | passht4b_io2_val=(readinputport(1)<<4) | (readinputport(6)&0xf); | |
| 1409 | passht4b_io3_val=(input_port_read_indexed(machine, 0)<<4) | (input_port_read_indexed(machine, 5)&0xf); | |
| 1410 | passht4b_io2_val=(input_port_read_indexed(machine, 1)<<4) | (input_port_read_indexed(machine, 6)&0xf); | |
| 1411 | 1411 | |
| 1412 | 1412 | passht4b_io1_val=0xff; |
| 1413 | 1413 | |
| 1414 | 1414 | // player 1 buttons |
| 1415 | if(!(readinputport(0) & 0x10)) passht4b_io1_val &=0xfe; | |
| 1416 | if(!(readinputport(0) & 0x20)) passht4b_io1_val &=0xfd; | |
| 1417 | if(!(readinputport(0) & 0x80)) passht4b_io1_val &=0xfc; | |
| 1415 | if(!(input_port_read_indexed(machine, 0) & 0x10)) passht4b_io1_val &=0xfe; | |
| 1416 | if(!(input_port_read_indexed(machine, 0) & 0x20)) passht4b_io1_val &=0xfd; | |
| 1417 | if(!(input_port_read_indexed(machine, 0) & 0x80)) passht4b_io1_val &=0xfc; | |
| 1418 | 1418 | |
| 1419 | 1419 | // player 2 buttons |
| 1420 | if(!(readinputport(1) & 0x10)) passht4b_io1_val &=0xfb; | |
| 1421 | if(!(readinputport(1) & 0x20)) passht4b_io1_val &=0xf7; | |
| 1422 | if(!(readinputport(1) & 0x80)) passht4b_io1_val &=0xf3; | |
| 1420 | if(!(input_port_read_indexed(machine, 1) & 0x10)) passht4b_io1_val &=0xfb; | |
| 1421 | if(!(input_port_read_indexed(machine, 1) & 0x20)) passht4b_io1_val &=0xf7; | |
| 1422 | if(!(input_port_read_indexed(machine, 1) & 0x80)) passht4b_io1_val &=0xf3; | |
| 1423 | 1423 | |
| 1424 | 1424 | // player 3 buttons |
| 1425 | if(!(readinputport(5) & 0x10)) passht4b_io1_val &=0xef; | |
| 1426 | if(!(readinputport(5) & 0x20)) passht4b_io1_val &=0xdf; | |
| 1427 | if(!(readinputport(5) & 0x80)) passht4b_io1_val &=0xcf; | |
| 1425 | if(!(input_port_read_indexed(machine, 5) & 0x10)) passht4b_io1_val &=0xef; | |
| 1426 | if(!(input_port_read_indexed(machine, 5) & 0x20)) passht4b_io1_val &=0xdf; | |
| 1427 | if(!(input_port_read_indexed(machine, 5) & 0x80)) passht4b_io1_val &=0xcf; | |
| 1428 | 1428 | |
| 1429 | 1429 | // player 4 buttons |
| 1430 | if(!(readinputport(6) & 0x10)) passht4b_io1_val &=0xbf; | |
| 1431 | if(!(readinputport(6) & 0x20)) passht4b_io1_val &=0x7f; | |
| 1432 | if(!(readinputport(6) & 0x80)) passht4b_io1_val &=0x3f; | |
| 1430 | if(!(input_port_read_indexed(machine, 6) & 0x10)) passht4b_io1_val &=0xbf; | |
| 1431 | if(!(input_port_read_indexed(machine, 6) & 0x20)) passht4b_io1_val &=0x7f; | |
| 1432 | if(!(input_port_read_indexed(machine, 6) & 0x80)) passht4b_io1_val &=0x3f; | |
| 1433 | 1433 | |
| 1434 | 1434 | return val; |
| 1435 | 1435 | } |
| r2375 | r2376 | |
|---|---|---|
| 39 | 39 | |
| 40 | 40 | static READ32_HANDLER( port2_r ) |
| 41 | 41 | { |
| 42 | return (EEPROM_read_bit() << 23) | ( | |
| 42 | return (EEPROM_read_bit() << 23) | ( | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | static WRITE32_HANDLER( eeprom_w ) |
| r2375 | r2376 | |
|---|---|---|
| 86 | 86 | |
| 87 | 87 | static INTERRUPT_GEN( redalert_vblank_interrupt ) |
| 88 | 88 | { |
| 89 | if( | |
| 89 | if( | |
| 90 | 90 | /* the service coin as conntected to the CPU's RDY pin as well */ |
| 91 | 91 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 92 | 92 |
| r2375 | r2376 | |
|---|---|---|
| 120 | 120 | |
| 121 | 121 | static READ8_HANDLER( demoderm_ip1_r ) |
| 122 | 122 | { |
| 123 | return | |
| 123 | return | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | static READ8_HANDLER( demoderm_ip2_r ) |
| 128 | 128 | { |
| 129 | return | |
| 129 | return | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| r2375 | r2376 | |
| 157 | 157 | static READ8_HANDLER( maxrpm_ip2_r ) |
| 158 | 158 | { |
| 159 | 159 | static const UINT8 shift_bits[5] = { 0x00, 0x05, 0x06, 0x01, 0x02 }; |
| 160 | UINT8 start = readinputportbytag("MONO.IP0"); | |
| 161 | UINT8 shift = readinputportbytag("SHIFT"); | |
| 160 | UINT8 start = input_port_read(machine, "MONO.IP0"); | |
| 161 | UINT8 shift = input_port_read(machine, "SHIFT"); | |
| 162 | 162 | |
| 163 | 163 | /* reset on a start */ |
| 164 | 164 | if (!(start & 0x08)) |
| r2375 | r2376 | |
| 231 | 231 | |
| 232 | 232 | /* when the read is toggled is when the ADC value is latched */ |
| 233 | 233 | if (!(data & 0x80)) |
| 234 | latched_input = | |
| 234 | latched_input = | |
| 235 | 235 | |
| 236 | 236 | /* when both the write and the enable are low, it's a write to the ADC0844 */ |
| 237 | 237 | /* unfortunately the behavior below doesn't match up with the inputs on the */ |
| r2375 | r2376 | |
| 253 | 253 | |
| 254 | 254 | static READ8_HANDLER( rampage_ip4_r ) |
| 255 | 255 | { |
| 256 | return | |
| 256 | return | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
| r2375 | r2376 | |
| 276 | 276 | |
| 277 | 277 | static READ8_HANDLER( powerdrv_ip2_r ) |
| 278 | 278 | { |
| 279 | return | |
| 279 | return | |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | |
| r2375 | r2376 | |
| 320 | 320 | |
| 321 | 321 | static READ8_HANDLER( stargrds_ip0_r ) |
| 322 | 322 | { |
| 323 | UINT8 result = | |
| 323 | UINT8 result = | |
| 324 | 324 | return result | ((soundsgood_status_r(machine, 0) << 4) & 0x10); |
| 325 | 325 | } |
| 326 | 326 | |
| r2375 | r2376 | |
| 361 | 361 | |
| 362 | 362 | static READ8_HANDLER( spyhunt_ip1_r ) |
| 363 | 363 | { |
| 364 | return | |
| 364 | return | |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | |
| 368 | 368 | static READ8_HANDLER( spyhunt_ip2_r ) |
| 369 | 369 | { |
| 370 | 370 | /* multiplexed steering wheel/gas pedal */ |
| 371 | return | |
| 371 | return | |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | |
| r2375 | r2376 | |
| 420 | 420 | { |
| 421 | 421 | /* multiplexed steering wheel/gas pedal */ |
| 422 | 422 | if (input_mux) |
| 423 | return | |
| 423 | return | |
| 424 | 424 | |
| 425 | return | |
| 425 | return | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 |
| r2375 | r2376 | |
|---|---|---|
| 32 | 32 | switch (offset<<1) |
| 33 | 33 | { |
| 34 | 34 | case 0: /* Player 1 & 2 joystick & buttons */ |
| 35 | return ( | |
| 35 | return ( | |
| 36 | 36 | |
| 37 | 37 | case 2: /* Credits, start buttons */ |
| 38 | return | |
| 38 | return ( | |
| 39 | 39 | |
| 40 | case 4: /* Byte 4: Dipswitch bank 2, Byte 5: Dipswitch Bank 1 */ | |
| 41 | return (readinputport(3) + (readinputport(4) << 8)); | |
| 40 | case 4: /* Dip switches */ | |
| 41 | return (input_port_read(machine, "DSW1") | (input_port_read(machine, "DSW2") << 8)); | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",activecpu_get_pc(),0x30c000+offset); |
| r2375 | r2376 | |
| 114 | 114 | /******************************************************************************/ |
| 115 | 115 | |
| 116 | 116 | static INPUT_PORTS_START( stadhero ) |
| 117 | PORT_START /* Player 1 controls */ | |
| 118 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY | |
| 119 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY | |
| 120 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY | |
| 121 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY | |
| 122 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 123 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 124 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) | |
| 117 | PORT_START_TAG("P1") /* 0x30c001 : Player 1 controls */ | |
| 118 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 119 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 120 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 121 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 122 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 123 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 124 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 125 | 125 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 126 | 126 | |
| 127 | PORT_START /* Player 2 controls */ | |
| 128 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 129 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 130 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 127 | PORT_START_TAG("P2") /* 0x30c000 : Player 2 controls */ | |
| 128 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 129 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 130 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 131 | 131 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) |
| 132 | 132 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 133 | 133 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 134 | 134 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 135 | 135 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 136 | 136 | |
| 137 | PORT_START /* Credits, start buttons */ | |
| 138 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 139 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 140 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) | |
| 141 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) | |
| 137 | PORT_START_TAG("COIN") /* 0x30c002 & 0x30c003 : Credits, start buttons */ | |
| 138 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */ | |
| 139 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */ | |
| 140 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */ | |
| 141 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */ | |
| 142 | 142 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 143 | 143 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 144 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_ | |
| 144 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 145 | 145 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 146 | 146 | |
| 147 | PORT_START /* Dip switch bank 1 */ | |
| 147 | PORT_START_TAG("DSW1") /* 0x30c005 : Dip switch bank 1 */ | |
| 148 | 148 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) ) |
| 149 | 149 | PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) |
| 150 | 150 | PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) |
| r2375 | r2376 | |
| 155 | 155 | PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) ) |
| 156 | 156 | PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) ) |
| 157 | 157 | PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) |
| 158 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 159 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 160 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 158 | PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW ) | |
| 161 | 159 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) |
| 162 | 160 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 163 | 161 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 164 | 162 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) |
| 165 | 163 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 166 | 164 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 167 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 168 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 169 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 165 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) | |
| 170 | 166 | |
| 171 | PORT_START /* Dip switch bank 2 */ | |
| 172 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 173 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 174 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 175 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 176 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 177 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 178 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 179 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 180 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 181 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 182 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 183 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 184 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 185 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 186 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 187 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 188 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 189 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 190 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 191 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 192 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 193 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 194 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 195 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 167 | PORT_START_TAG("DSW2") /* 0x30c004 : Dip switch bank 2 */ | |
| 168 | PORT_DIPNAME( 0x03, 0x03, "Time (1P Vs CPU)" ) /* Table at 0x0014f6 */ | |
| 169 | PORT_DIPSETTING( 0x02, "600" ) | |
| 170 | PORT_DIPSETTING( 0x03, "500" ) | |
| 171 | PORT_DIPSETTING( 0x01, "450" ) | |
| 172 | PORT_DIPSETTING( 0x00, "400" ) | |
| 173 | PORT_DIPNAME( 0x0c, 0x0c, "Time (1P Vs 2P)" ) /* Table at 0x0014fe */ | |
| 174 | PORT_DIPSETTING( 0x08, "270" ) | |
| 175 | PORT_DIPSETTING( 0x0c, "210" ) | |
| 176 | PORT_DIPSETTING( 0x04, "180" ) | |
| 177 | PORT_DIPSETTING( 0x00, "120" ) | |
| 178 | PORT_DIPNAME( 0x30, 0x30, "Final Set" ) /* Table at 0x00078c */ | |
| 179 | PORT_DIPSETTING( 0x20, "3 Credits" ) | |
| 180 | PORT_DIPSETTING( 0x30, "4 Credits" ) | |
| 181 | PORT_DIPSETTING( 0x10, "5 Credits" ) | |
| 182 | PORT_DIPSETTING( 0x00, "6 Credits" ) | |
| 183 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) | |
| 184 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) | |
| 196 | 185 | INPUT_PORTS_END |
| 197 | 186 | |
| 198 | 187 | /******************************************************************************/ |
| r2375 | r2376 | |
|---|---|---|
| 20 | 20 | (great now I can fall under the skyway like I did at Chuck'n Cheese;) |
| 21 | 21 | - fixed Vanguard2 scroll offsets |
| 22 | 22 | - tuned music tempo and wavegen frequency |
| 23 | ||
| 24 | 2008.04.04: Small note regarding DipSwitches. Locations and values have been | |
| 25 | verified with the manual for both Marvin's Maze and Mad Crasher. Vanguard II | |
| 26 | DIPs have been checked against jammaboards diplist, no manual available ATM. | |
| 27 | DSW2:7 in madcrash is listed as Difficulty, but it's not clear how it affects | |
| 28 | the gameplay difficulty | |
| 29 | ||
| 23 | 30 | */ |
| 24 | 31 | |
| 25 | 32 | #include "driver.h" |
| r2375 | r2376 | |
| 127 | 134 | /* this input port has one of its bits mapped to sound CPU status */ |
| 128 | 135 | static READ8_HANDLER( marvins_port_0_r ) |
| 129 | 136 | { |
| 130 | return(input_port_ | |
| 137 | return(input_port_ | |
| 131 | 138 | } |
| 132 | 139 | |
| 133 | 140 | static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2375 | r2376 | |
| 163 | 170 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 164 | 171 | AM_RANGE(0x6000, 0x6000) AM_WRITE(marvins_palette_bank_w) |
| 165 | 172 | AM_RANGE(0x8000, 0x8000) AM_READ(marvins_port_0_r) /* coin input, start, sound CPU status */ |
| 166 | AM_RANGE(0x8100, 0x8100) AM_READ(input_port_1_r) /* player #1 controls */ | |
| 167 | AM_RANGE(0x8200, 0x8200) AM_READ(input_port_2_r) /* player #2 controls */ | |
| 173 | AM_RANGE(0x8100, 0x8100) AM_READ_PORT("IN1") /* player #1 controls */ | |
| 174 | AM_RANGE(0x8200, 0x8200) AM_READ_PORT("IN2") /* player #2 controls */ | |
| 168 | 175 | AM_RANGE(0x8300, 0x8300) AM_WRITE(sound_command_w) |
| 169 | AM_RANGE(0x8400, 0x8400) AM_READ(input_port_3_r) /* dipswitch#1 */ | |
| 170 | AM_RANGE(0x8500, 0x8500) AM_READ(input_port_4_r) /* dipswitch#2 */ | |
| 171 | AM_RANGE(0x8600, 0x8600) AM_RAM // video attribute | |
| 176 | AM_RANGE(0x8400, 0x8400) AM_READ_PORT("DSW1") /* dipswitch#1 */ | |
| 177 | AM_RANGE(0x8500, 0x8500) AM_READ_PORT("DSW2") /* dipswitch#2 */ | |
| 178 | AM_RANGE(0x8600, 0x8600) AM_RAM /* video attribute */ | |
| 172 | 179 | AM_RANGE(0x8700, 0x8700) AM_READWRITE(snk_cpuB_nmi_trigger_r, snk_cpuA_nmi_ack_w) |
| 173 | 180 | AM_RANGE(0xc000, 0xcfff) AM_RAM AM_BASE(&spriteram) AM_SHARE(1) |
| 174 | 181 | AM_RANGE(0xd000, 0xdfff) AM_READWRITE(SMH_RAM, marvins_background_ram_w) AM_SHARE(2) AM_BASE(&spriteram_3) |
| r2375 | r2376 | |
| 189 | 196 | static ADDRESS_MAP_START( madcrash_cpuA_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 190 | 197 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 191 | 198 | AM_RANGE(0x8000, 0x8000) AM_READ(marvins_port_0_r) /* coin input, start, sound CPU status */ |
| 192 | AM_RANGE(0x8100, 0x8100) AM_READ(input_port_1_r) /* player #1 controls */ | |
| 193 | AM_RANGE(0x8200, 0x8200) AM_READ(input_port_2_r) /* player #2 controls */ | |
| 199 | AM_RANGE(0x8100, 0x8100) AM_READ_PORT("IN1") /* player #1 controls */ | |
| 200 | AM_RANGE(0x8200, 0x8200) AM_READ_PORT("IN2") /* player #2 controls */ | |
| 194 | 201 | AM_RANGE(0x8300, 0x8300) AM_WRITE(sound_command_w) |
| 195 | AM_RANGE(0x8400, 0x8400) AM_READ(input_port_3_r) /* dipswitch#1 */ | |
| 196 | AM_RANGE(0x8500, 0x8500) AM_READ(input_port_4_r) /* dipswitch#2 */ | |
| 202 | AM_RANGE(0x8400, 0x8400) AM_READ_PORT("DSW1") /* dipswitch#1 */ | |
| 203 | AM_RANGE(0x8500, 0x8500) AM_READ_PORT("DSW2") /* dipswitch#2 */ | |
| 197 | 204 | AM_RANGE(0x8600, 0x86ff) AM_RAM // video attribute |
| 198 | 205 | AM_RANGE(0x8700, 0x8700) AM_READWRITE(snk_cpuB_nmi_trigger_r, snk_cpuA_nmi_ack_w) |
| 199 | 206 | // AM_RANGE(0xc800, 0xc800) AM_WRITE(marvins_palette_bank_w) // palette bank switch (c8f1 for Vanguard) |
| r2375 | r2376 | |
| 245 | 252 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 246 | 253 | |
| 247 | 254 | PORT_START_TAG("DSW1") |
| 248 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) | |
| 255 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2") | |
| 249 | 256 | PORT_DIPSETTING( 0x00, "1" ) |
| 250 | 257 | PORT_DIPSETTING( 0x01, "2" ) |
| 251 | 258 | PORT_DIPSETTING( 0x02, "3" ) |
| 252 | 259 | PORT_DIPSETTING( 0x03, "5" ) |
| 253 | PORT_DIPNAME(0x04, 0x04, "Infinite Lives (Cheat)") | |
| 260 | PORT_DIPNAME(0x04, 0x04, "Infinite Lives (Cheat)") PORT_DIPLOCATION("SW1:3") | |
| 254 | 261 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 255 | 262 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 256 | PORT_DIPNAME( 0x38, 0x00, DEF_STR( Coinage ) ) | |
| 263 | PORT_DIPNAME( 0x38, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:4,5,6") | |
| 257 | 264 | PORT_DIPSETTING( 0x38, DEF_STR( 5C_1C ) ) |
| 258 | 265 | PORT_DIPSETTING( 0x30, DEF_STR( 3C_1C ) ) |
| 259 | 266 | PORT_DIPSETTING( 0x28, DEF_STR( 2C_1C ) ) |
| r2375 | r2376 | |
| 262 | 269 | PORT_DIPSETTING( 0x10, DEF_STR( 1C_3C ) ) |
| 263 | 270 | PORT_DIPSETTING( 0x18, DEF_STR( 1C_5C ) ) |
| 264 | 271 | PORT_DIPSETTING( 0x20, DEF_STR( 1C_6C ) ) |
| 265 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) ) | |
| 272 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW1:7") | |
| 266 | 273 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 267 | 274 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 268 | PORT_DIPNAME( 0x80, 0x80, "Freeze" ) | |
| 275 | PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("SW1:8") | |
| 269 | 276 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 270 | 277 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 271 | 278 | |
| 272 | 279 | PORT_START_TAG("DSW2") |
| 273 | PORT_DIPNAME( 0x07, 0x00, "1st Bonus Life" ) | |
| 280 | PORT_DIPNAME( 0x07, 0x00, "1st Bonus Life" ) PORT_DIPLOCATION("SW2:1,2,3") | |
| 274 | 281 | PORT_DIPSETTING( 0x00, "10000" ) |
| 275 | 282 | PORT_DIPSETTING( 0x01, "20000" ) |
| 276 | 283 | PORT_DIPSETTING( 0x02, "30000" ) |
| r2375 | r2376 | |
| 279 | 286 | PORT_DIPSETTING( 0x05, "60000" ) |
| 280 | 287 | PORT_DIPSETTING( 0x06, "70000" ) |
| 281 | 288 | PORT_DIPSETTING( 0x07, "80000" ) |
| 282 | PORT_DIPNAME( 0x18, 0x08, "2nd Bonus Life" ) | |
| 289 | PORT_DIPNAME( 0x18, 0x08, "2nd Bonus Life" ) PORT_DIPLOCATION("SW2:4,5") | |
| 283 | 290 | PORT_DIPSETTING( 0x08, "1st bonus*2" ) |
| 284 | 291 | PORT_DIPSETTING( 0x10, "1st bonus*3" ) |
| 285 | 292 | PORT_DIPSETTING( 0x18, "1st bonus*4" ) |
| 286 | 293 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 287 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) | |
| 294 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:6") | |
| 288 | 295 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 289 | 296 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 290 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) | |
| 297 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:7") | |
| 291 | 298 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 292 | 299 | PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) |
| 293 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) | |
| 300 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8") | |
| 294 | 301 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 295 | 302 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 296 | 303 | INPUT_PORTS_END |
| r2375 | r2376 | |
| 326 | 333 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 327 | 334 | |
| 328 | 335 | PORT_START_TAG("DSW1") |
| 329 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) | |
| 336 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3") | |
| 330 | 337 | PORT_DIPSETTING( 0x00, DEF_STR( 6C_1C ) ) |
| 331 | 338 | PORT_DIPSETTING( 0x01, DEF_STR( 5C_1C ) ) |
| 332 | 339 | PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) |
| r2375 | r2376 | |
| 335 | 342 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) |
| 336 | 343 | PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) |
| 337 | 344 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_5C ) ) |
| 338 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Bonus_Life ) ) | |
| 345 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:4,5,6") | |
| 339 | 346 | PORT_DIPSETTING( 0x38, "30000" ) |
| 340 | 347 | PORT_DIPSETTING( 0x30, "40000" ) |
| 341 | 348 | PORT_DIPSETTING( 0x28, "50000" ) |
| r2375 | r2376 | |
| 344 | 351 | PORT_DIPSETTING( 0x10, "80000" ) |
| 345 | 352 | PORT_DIPSETTING( 0x08, "90000" ) |
| 346 | 353 | PORT_DIPSETTING( 0x00, "100000" ) |
| 347 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Lives ) ) | |
| 354 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:7,8") | |
| 348 | 355 | PORT_DIPSETTING( 0x00, "1" ) |
| 349 | 356 | PORT_DIPSETTING( 0x40, "2" ) |
| 350 | 357 | PORT_DIPSETTING( 0x80, "3" ) |
| 351 | 358 | PORT_DIPSETTING( 0xc0, "5" ) |
| 352 | 359 | |
| 353 | 360 | PORT_START_TAG("DSW2") |
| 354 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 361 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:1") | |
| 355 | 362 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 356 | 363 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 357 | PORT_DIPNAME( 0x02, 0x02, "Freeze" ) | |
| 364 | PORT_DIPNAME( 0x02, 0x02, "Freeze" ) PORT_DIPLOCATION("SW2:2") | |
| 358 | 365 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 359 | 366 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 360 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) ) | |
| 367 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:3") | |
| 361 | 368 | PORT_DIPSETTING( 0x04, DEF_STR( Upright ) ) |
| 362 | 369 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) |
| 363 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Language ) ) | |
| 370 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Language ) ) PORT_DIPLOCATION("SW2:4") | |
| 364 | 371 | PORT_DIPSETTING( 0x08, DEF_STR( English ) ) |
| 365 | 372 | PORT_DIPSETTING( 0x00, DEF_STR( Japanese ) ) |
| 366 | PORT_DIPNAME( 0x10, 0x00, "Bonus Life Occurence" ) | |
| 373 | PORT_DIPNAME( 0x10, 0x00, "Bonus Life Occurence" ) PORT_DIPLOCATION("SW2:5") | |
| 367 | 374 | PORT_DIPSETTING( 0x00, "Every bonus" ) |
| 368 | 375 | PORT_DIPSETTING( 0x10, "Bonus only" ) |
| 369 | PORT_DIPNAME( 0x20, 0x20, "Infinite Lives (Cheat)") | |
| 376 | PORT_DIPNAME( 0x20, 0x20, "Infinite Lives (Cheat)") PORT_DIPLOCATION("SW2:6") | |
| 370 | 377 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 371 | 378 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 372 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) ) | |
| 379 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW2:7") | |
| 373 | 380 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 374 | 381 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 375 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) | |
| 382 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8") | |
| 376 | 383 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 377 | 384 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 378 | 385 | INPUT_PORTS_END |
| r2375 | r2376 | |
| 408 | 415 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 409 | 416 | |
| 410 | 417 | PORT_START_TAG("DSW1") |
| 411 | PORT_DIPNAME( 0x01, 0x01, "Unused SW 1-0" ) | |
| 412 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 413 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 414 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) ) | |
| 418 | PORT_DIPUNUSED_DIPLOC(0x01, IP_ACTIVE_LOW, "SW1:1") /* Listed as Unused */ | |
| 419 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:2") | |
| 415 | 420 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 416 | 421 | PORT_DIPSETTING( 0x02, DEF_STR( Cocktail ) ) |
| 417 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) ) | |
| 422 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:3") | |
| 418 | 423 | PORT_DIPSETTING( 0x04, "3" ) |
| 419 | 424 | PORT_DIPSETTING( 0x00, "5" ) |
| 420 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coinage ) ) | |
| 425 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:4,5,6") | |
| 421 | 426 | // PORT_DIPSETTING( 0x08, DEF_STR( 5C_1C ) ) |
| 422 | 427 | PORT_DIPSETTING( 0x10, DEF_STR( 5C_1C ) ) |
| 423 | 428 | PORT_DIPSETTING( 0x20, DEF_STR( 3C_1C ) ) |
| r2375 | r2376 | |
| 426 | 431 | PORT_DIPSETTING( 0x30, DEF_STR( 1C_2C ) ) |
| 427 | 432 | PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) ) |
| 428 | 433 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 429 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) ) | |
| 434 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:7,8") | |
| 430 | 435 | PORT_DIPSETTING( 0xc0, "20000 60000" ) |
| 431 | 436 | PORT_DIPSETTING( 0x80, "40000 90000" ) |
| 432 | 437 | PORT_DIPSETTING( 0x40, "50000 120000" ) |
| 433 | 438 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 434 | 439 | |
| 435 | 440 | PORT_START_TAG("DSW2") |
| 436 | PORT_DIPNAME( 0x01, 0x00, "Bonus Life Occurence" ) | |
| 437 | PORT_DIPSETTING( 0x01, "1st, 2nd, then every 2nd" ) // Check the "Non Bugs" page | |
| 441 | PORT_DIPNAME( 0x01, 0x00, "Bonus Life Occurence" ) PORT_DIPLOCATION("SW2:1") | |
| 442 | PORT_DIPSETTING( 0x01, "1st, 2nd, then every 2nd" ) /* Check the "Non Bugs" page */ | |
| 438 | 443 | PORT_DIPSETTING( 0x00, "1st and 2nd only" ) |
| 439 | PORT_DIPNAME( 0x06, 0x04, DEF_STR( Difficulty ) ) | |
| 440 | PORT_DIPSETTING( 0x06, DEF_STR( Easy ) ) | |
| 444 | PORT_DIPNAME( 0x06, 0x04, "Scroll Speed" ) PORT_DIPLOCATION("SW2:2,3") | |
| 445 | PORT_DIPSETTING( 0x06, "Slow" )//DEF_STR( Easy ) ) | |
| 441 | 446 | PORT_DIPSETTING( 0x04, DEF_STR( Normal ) ) |
| 442 | PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) | |
| 443 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) | |
| 444 | PORT_DIPNAME( 0x18, 0x10, "Game mode" ) | |
| 447 | PORT_DIPSETTING( 0x02, "Fast" )//DEF_STR( Hard ) ) | |
| 448 | PORT_DIPSETTING( 0x00, "Faster" ) | |
| 449 | PORT_DIPNAME( 0x18, 0x10, "Game mode" ) PORT_DIPLOCATION("SW2:4,5") | |
| 445 | 450 | PORT_DIPSETTING( 0x18, "Demo Sounds Off" ) |
| 446 | 451 | PORT_DIPSETTING( 0x10, "Demo Sounds On" ) |
| 447 | 452 | PORT_DIPSETTING( 0x08, "Infinite Lives (Cheat)") |
| 448 | 453 | PORT_DIPSETTING( 0x00, "Freeze" ) |
| 449 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) | |
| 454 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:6") | |
| 450 | 455 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 451 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // Check the "Non Bugs" page | |
| 452 | PORT_DIPNAME( 0x40, 0x40, "Unused SW 2-6" ) | |
| 453 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 454 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 455 | PORT_DIPNAME( 0x80, 0x80, "Unknown SW 2-7" ) // tested in many places | |
| 456 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 457 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 456 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) /* Check the "Non Bugs" page */ | |
| 457 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:7") | |
| 458 | PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) | |
| 459 | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) | |
| 460 | PORT_DIPUNKNOWN_DIPLOC(0x80, IP_ACTIVE_LOW, "SW2:8") /* Listed as Unused, it is actually tested in many places */ | |
| 458 | 461 | INPUT_PORTS_END |
| 459 | 462 | |
| 460 | 463 |
| r2375 | r2376 | |
|---|---|---|
| 143 | 143 | |
| 144 | 144 | static READ16_HANDLER( aladbl_r ) |
| 145 | 145 | { |
| 146 | if (activecpu_get_pc()==0x1b2a56) return ( | |
| 146 | if (activecpu_get_pc()==0x1b2a56) return ( | |
| 147 | 147 | if (activecpu_get_pc()==0x1b2a72) return 0x0000; |
| 148 | if (activecpu_get_pc()==0x1b2d24) return ( | |
| 148 | if (activecpu_get_pc()==0x1b2d24) return ( | |
| 149 | 149 | if (activecpu_get_pc()==0x1b2d4e) return 0x0000; |
| 150 | 150 | |
| 151 | 151 | logerror("aladbl_r : %06x\n",activecpu_get_pc()); |
| r2375 | r2376 | |
|---|---|---|
| 191 | 191 | |
| 192 | 192 | static READ16_HANDLER( input_port_2_word_r_cust ) |
| 193 | 193 | { |
| 194 | return | |
| 194 | return | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /******************************************************************************* |
| r2375 | r2376 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | static READ8_HANDLER( actfan_control_0_r ) |
| 50 | 50 | { |
| 51 | return | |
| 51 | return | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | static READ8_HANDLER( actfan_control_1_r ) |
| 55 | 55 | { |
| 56 | 56 | switch (offset) { |
| 57 | case 0: return readinputport(0); /* Player 1 */ | |
| 58 | case 1: return readinputport(1); /* Player 2 */ | |
| 59 | case 2: return readinputport(3); /* Dip 1 */ | |
| 60 | case 3: return readinputport(4); /* Dip 2 */ | |
| 57 | case 0: return input_port_read_indexed(machine, 0); /* Player 1 */ | |
| 58 | case 1: return input_port_read_indexed(machine, 1); /* Player 2 */ | |
| 59 | case 2: return input_port_read_indexed(machine, 3); /* Dip 1 */ | |
| 60 | case 3: return input_port_read_indexed(machine, 4); /* Dip 2 */ | |
| 61 | 61 | } |
| 62 | 62 | return 0xff; |
| 63 | 63 | } |
| r2375 | r2376 | |
| 72 | 72 | static READ8_HANDLER( triothep_control_r ) |
| 73 | 73 | { |
| 74 | 74 | switch (trio_control_select) { |
| 75 | case 0: return readinputportbytag("IN0"); /* Player 1 */ | |
| 76 | case 1: return readinputportbytag("IN1"); /* Player 2 */ | |
| 77 | case 2: return readinputportbytag("DSW1"); /* Dip 1 */ | |
| 78 | case 3: return readinputportbytag("DSW2"); /* Dip 2 */ | |
| 79 | case 4: return readinputportbytag("IN2"); /* VBL */ | |
| 75 | case 0: return input_port_read(machine, "IN0"); /* Player 1 */ | |
| 76 | case 1: return input_port_read(machine, "IN1"); /* Player 2 */ | |
| 77 | case 2: return input_port_read(machine, "DSW1"); /* Dip 1 */ | |
| 78 | case 3: return input_port_read(machine, "DSW2"); /* Dip 2 */ | |
| 79 | case 4: return input_port_read(machine, "IN2"); /* VBL */ | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | return 0xff; |
| r2375 | r2376 | |
|---|---|---|
| 670 | 670 | static READ16_HANDLER( io_r ) |
| 671 | 671 | { |
| 672 | 672 | if(offset < 0x8) |
| 673 | return | |
| 673 | return | |
| 674 | 674 | if(offset < 0x10) { |
| 675 | 675 | offset -= 0x8; |
| 676 | 676 | if(offset < 3) |
| 677 | return | |
| 677 | return | |
| 678 | 678 | return 0xff; |
| 679 | 679 | } |
| 680 | 680 |
| r2375 | r2376 | |
|---|---|---|
| 302 | 302 | |
| 303 | 303 | static READ8_HANDLER( polepos_adc_r ) |
| 304 | 304 | { |
| 305 | return | |
| 305 | return | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | static READ8_HANDLER( polepos_ready_r ) |
| r2375 | r2376 | |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | |
| 380 | static READ8_HANDLER( in0_l ) { return readinputport(0) & auto_start_mask; } // fire and start buttons | |
| 381 | static READ8_HANDLER( in0_h ) { return readinputport(0) >> 4; } // coins | |
| 382 | static READ8_HANDLER( dipA_l ) { return readinputport(1); } // dips A | |
| 383 | static READ8_HANDLER( dipA_h ) { return readinputport(1) >> 4; } // dips A | |
| 384 | static READ8_HANDLER( dipB_l ) { return readinputport(2); } // dips B | |
| 385 | static READ8_HANDLER( dipB_h ) { return readinputport(2) >> 4; } // dips B | |
| 386 | static READ8_HANDLER( in1_l ) { return readinputport(5); } // wheel | |
| 387 | static READ8_HANDLER( in1_h ) { return readinputport(5) >> 4; } // wheel | |
| 380 | static READ8_HANDLER( in0_l ) { return input_port_read_indexed(machine, 0) & auto_start_mask; } // fire and start buttons | |
| 381 | static READ8_HANDLER( in0_h ) { return input_port_read_indexed(machine, 0) >> 4; } // coins | |
| 382 | static READ8_HANDLER( dipA_l ) { return input_port_read_indexed(machine, 1); } // dips A | |
| 383 | static READ8_HANDLER( dipA_h ) { return input_port_read_indexed(machine, 1) >> 4; } // dips A | |
| 384 | static READ8_HANDLER( dipB_l ) { return input_port_read_indexed(machine, 2); } // dips B | |
| 385 | static READ8_HANDLER( dipB_h ) { return input_port_read_indexed(machine, 2) >> 4; } // dips B | |
| 386 | static READ8_HANDLER( in1_l ) { return input_port_read_indexed(machine, 5); } // wheel | |
| 387 | static READ8_HANDLER( in1_h ) { return input_port_read_indexed(machine, 5) >> 4; } // wheel | |
| 388 | 388 | static WRITE8_HANDLER( out_0 ) |
| 389 | 389 | { |
| 390 | 390 | // no start lamps in pole position |
| r2375 | r2376 | |
|---|---|---|
| 52 | 52 | |
| 53 | 53 | static READ8_HANDLER( topgunbl_rotary_r ) |
| 54 | 54 | { |
| 55 | return (1 << ( | |
| 55 | return (1 << ( | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | static WRITE8_HANDLER( jackal_flipscreen_w ) |
| r2375 | r2376 | |
|---|---|---|
| 319 | 319 | |
| 320 | 320 | static CUSTOM_INPUT( seawolf_erase_input_r ) |
| 321 | 321 | { |
| 322 | return readinputportbytag(SEAWOLF_ERASE_SW_PORT_TAG) & | |
| 323 | readinputportbytag(SEAWOLF_ERASE_DIP_PORT_TAG); | |
| 322 | return input_port_read(machine, SEAWOLF_ERASE_SW_PORT_TAG) & | |
| 323 | input_port_read(machine, SEAWOLF_ERASE_DIP_PORT_TAG); | |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
| r2375 | r2376 | |
| 542 | 542 | #define TORNBASE_CAB_TYPE_PORT_TAG ("CAB") |
| 543 | 543 | |
| 544 | 544 | |
| 545 | UINT8 tornbase_get_cabinet_type() | |
| 545 | UINT8 tornbase_get_cabinet_type(running_machine *machine) | |
| 546 | 546 | { |
| 547 | return | |
| 547 | return | |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | |
| 551 | 551 | static CUSTOM_INPUT( tornbase_hit_left_input_r ) |
| 552 | 552 | { |
| 553 | return | |
| 553 | return | |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | |
| r2375 | r2376 | |
| 558 | 558 | { |
| 559 | 559 | UINT32 ret; |
| 560 | 560 | |
| 561 | switch (tornbase_get_cabinet_type()) | |
| 561 | switch (tornbase_get_cabinet_type(machine)) | |
| 562 | 562 | { |
| 563 | 563 | case TORNBASE_CAB_TYPE_UPRIGHT_OLD: |
| 564 | ret = | |
| 564 | ret = | |
| 565 | 565 | break; |
| 566 | 566 | |
| 567 | 567 | case TORNBASE_CAB_TYPE_UPRIGHT_NEW: |
| 568 | 568 | case TORNBASE_CAB_TYPE_COCKTAIL: |
| 569 | 569 | default: |
| 570 | ret = | |
| 570 | ret = | |
| 571 | 571 | break; |
| 572 | 572 | } |
| 573 | 573 | |
| r2375 | r2376 | |
| 579 | 579 | { |
| 580 | 580 | UINT32 ret; |
| 581 | 581 | |
| 582 | switch (tornbase_get_cabinet_type()) | |
| 582 | switch (tornbase_get_cabinet_type(machine)) | |
| 583 | 583 | { |
| 584 | 584 | case TORNBASE_CAB_TYPE_UPRIGHT_OLD: |
| 585 | 585 | case TORNBASE_CAB_TYPE_UPRIGHT_NEW: |
| 586 | ret = | |
| 586 | ret = | |
| 587 | 587 | break; |
| 588 | 588 | |
| 589 | 589 | case TORNBASE_CAB_TYPE_COCKTAIL: |
| 590 | 590 | default: |
| 591 | ret = | |
| 591 | ret = | |
| 592 | 592 | break; |
| 593 | 593 | } |
| 594 | 594 | |
| r2375 | r2376 | |
| 598 | 598 | |
| 599 | 599 | static CUSTOM_INPUT( tornbase_pitch_right_input_r ) |
| 600 | 600 | { |
| 601 | return | |
| 601 | return | |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | |
| 605 | 605 | static CUSTOM_INPUT( tornbase_score_input_r ) |
| 606 | 606 | { |
| 607 | return readinputportbytag(TORNBASE_SCORE_SW_PORT_TAG) & | |
| 608 | readinputportbytag(TORNBASE_SCORE_DIP_PORT_TAG); | |
| 607 | return input_port_read(machine, TORNBASE_SCORE_SW_PORT_TAG) & | |
| 608 | input_port_read(machine, TORNBASE_SCORE_DIP_PORT_TAG); | |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | |
| r2375 | r2376 | |
| 857 | 857 | static UINT8 maze_tone_timing_state; |
| 858 | 858 | |
| 859 | 859 | |
| 860 | static | |
| 860 | static STATE_POSTLOAD( maze_update_discrete | |
| 861 | 861 | { |
| 862 | maze_write_discrete( | |
| 862 | maze_write_discrete(machine, maze_tone_timing_state); | |
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | |
| r2375 | r2376 | |
| 880 | 880 | |
| 881 | 881 | /* setup for save states */ |
| 882 | 882 | state_save_register_global(maze_tone_timing_state); |
| 883 | state_save_register_ | |
| 883 | state_save_register_ | |
| 884 | 884 | |
| 885 | 885 | MACHINE_START_CALL(mw8080bw); |
| 886 | 886 | } |
| r2375 | r2376 | |
| 1182 | 1182 | UINT32 ret; |
| 1183 | 1183 | |
| 1184 | 1184 | if (desertgu_controller_select) |
| 1185 | ret = | |
| 1185 | ret = | |
| 1186 | 1186 | else |
| 1187 | ret = | |
| 1187 | ret = | |
| 1188 | 1188 | |
| 1189 | 1189 | return ret; |
| 1190 | 1190 | } |
| r2375 | r2376 | |
| 1195 | 1195 | UINT32 ret; |
| 1196 | 1196 | |
| 1197 | 1197 | if (desertgu_controller_select) |
| 1198 | ret = | |
| 1198 | ret = | |
| 1199 | 1199 | else |
| 1200 | ret = | |
| 1200 | ret = | |
| 1201 | 1201 | |
| 1202 | 1202 | return ret; |
| 1203 | 1203 | } |
| r2375 | r2376 | |
| 1308 | 1308 | { |
| 1309 | 1309 | UINT32 ret; |
| 1310 | 1310 | |
| 1311 | if (readinputportbytag(DPLAY_CAB_TYPE_PORT_TAG) == DPLAY_CAB_TYPE_UPRIGHT) | |
| 1312 | ret = readinputportbytag(DPLAY_L_PITCH_PORT_TAG); | |
| 1311 | if (input_port_read(machine, DPLAY_CAB_TYPE_PORT_TAG) == DPLAY_CAB_TYPE_UPRIGHT) | |
| 1312 | ret = input_port_read(machine, DPLAY_L_PITCH_PORT_TAG); | |
| 1313 | 1313 | else |
| 1314 | ret = | |
| 1314 | ret = | |
| 1315 | 1315 | |
| 1316 | 1316 | return ret; |
| 1317 | 1317 | } |
| r2375 | r2376 | |
| 1319 | 1319 | |
| 1320 | 1320 | static CUSTOM_INPUT( dplay_pitch_right_input_r ) |
| 1321 | 1321 | { |
| 1322 | return | |
| 1322 | return | |
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | 1325 | |
| r2375 | r2376 | |
| 1698 | 1698 | |
| 1699 | 1699 | if (clowns_controller_select) |
| 1700 | 1700 | { |
| 1701 | ret = | |
| 1701 | ret = | |
| 1702 | 1702 | } |
| 1703 | 1703 | else |
| 1704 | 1704 | { |
| 1705 | ret = | |
| 1705 | ret = | |
| 1706 | 1706 | } |
| 1707 | 1707 | |
| 1708 | 1708 | return ret; |
| r2375 | r2376 | |
| 2447 | 2447 | |
| 2448 | 2448 | static CUSTOM_INPUT( invaders_coin_input_r ) |
| 2449 | 2449 | { |
| 2450 | UINT32 ret = | |
| 2450 | UINT32 ret = | |
| 2451 | 2451 | |
| 2452 | 2452 | coin_counter_w(0, !ret); |
| 2453 | 2453 | |
| r2375 | r2376 | |
| 2462 | 2462 | /* upright PCB : switches visible |
| 2463 | 2463 | cocktail PCB: HI */ |
| 2464 | 2464 | |
| 2465 | if (invaders_is_cabinet_cocktail()) | |
| 2465 | if (invaders_is_cabinet_cocktail(machine)) | |
| 2466 | 2466 | ret = 0x03; |
| 2467 | 2467 | else |
| 2468 | ret = | |
| 2468 | ret = | |
| 2469 | 2469 | |
| 2470 | 2470 | return ret; |
| 2471 | 2471 | } |
| r2375 | r2376 | |
| 2478 | 2478 | /* upright PCB : switch visible |
| 2479 | 2479 | cocktail PCB: HI */ |
| 2480 | 2480 | |
| 2481 | if (invaders_is_cabinet_cocktail()) | |
| 2481 | if (invaders_is_cabinet_cocktail(machine)) | |
| 2482 | 2482 | ret = 0x01; |
| 2483 | 2483 | else |
| 2484 | ret = | |
| 2484 | ret = | |
| 2485 | 2485 | |
| 2486 | 2486 | return ret; |
| 2487 | 2487 | } |
| r2375 | r2376 | |
| 2494 | 2494 | /* upright PCB : P1 controls |
| 2495 | 2495 | cocktail PCB: HI */ |
| 2496 | 2496 | |
| 2497 | if (invaders_is_cabinet_cocktail()) | |
| 2497 | if (invaders_is_cabinet_cocktail(machine)) | |
| 2498 | 2498 | ret = 0x07; |
| 2499 | 2499 | else |
| 2500 | ret = | |
| 2500 | ret = | |
| 2501 | 2501 | |
| 2502 | 2502 | return ret; |
| 2503 | 2503 | } |
| r2375 | r2376 | |
| 2510 | 2510 | /* upright PCB : P1 controls |
| 2511 | 2511 | cocktail PCB: P2 controls */ |
| 2512 | 2512 | |
| 2513 | if (invaders_is_cabinet_cocktail()) | |
| 2514 | ret = readinputportbytag(INVADERS_P2_CONTROL_PORT_TAG); | |
| 2513 | if (invaders_is_cabinet_cocktail(machine)) | |
| 2514 | ret = input_port_read(machine, INVADERS_P2_CONTROL_PORT_TAG); | |
| 2515 | 2515 | else |
| 2516 | ret = | |
| 2516 | ret = | |
| 2517 | 2517 | |
| 2518 | 2518 | return ret; |
| 2519 | 2519 | } |
| 2520 | 2520 | |
| 2521 | 2521 | |
| 2522 | int invaders_is_cabinet_cocktail() | |
| 2522 | int invaders_is_cabinet_cocktail(running_machine *machine) | |
| 2523 | 2523 | { |
| 2524 | return | |
| 2524 | return | |
| 2525 | 2525 | } |
| 2526 | 2526 | |
| 2527 | 2527 | |
| r2375 | r2376 | |
| 2647 | 2647 | |
| 2648 | 2648 | static CUSTOM_INPUT( blueshrk_coin_input_r ) |
| 2649 | 2649 | { |
| 2650 | UINT32 ret = | |
| 2650 | UINT32 ret = | |
| 2651 | 2651 | |
| 2652 | 2652 | coin_counter_w(0, !ret); |
| 2653 | 2653 | |
| r2375 | r2376 | |
| 2724 | 2724 | #ifdef UNUSED_FUNCTION |
| 2725 | 2725 | static UINT32 invad2ct_coin_input_r(void *param) |
| 2726 | 2726 | { |
| 2727 | UINT32 ret = | |
| 2727 | UINT32 ret = | |
| 2728 | 2728 | |
| 2729 | 2729 | coin_counter_w(0, !ret); |
| 2730 | 2730 |
| r2375 | r2376 | |
|---|---|---|
| 233 | 233 | { |
| 234 | 234 | int rhi, rlo; |
| 235 | 235 | |
| 236 | rhi = ( readinputportbytag("DSWA") & 0x01 ) << 4; | |
| 237 | rhi |= ( readinputportbytag("DSWA") & 0x04 ) << 3; | |
| 238 | rhi |= ( readinputportbytag("DSWA") & 0x10 ) << 2; | |
| 239 | rhi |= ( readinputportbytag("DSWA") & 0x40 ) << 1; | |
| 236 | rhi = ( input_port_read(machine, "DSWA") & 0x01 ) << 4; | |
| 237 | rhi |= ( input_port_read(machine, "DSWA") & 0x04 ) << 3; | |
| 238 | rhi |= ( input_port_read(machine, "DSWA") & 0x10 ) << 2; | |
| 239 | rhi |= ( input_port_read(machine, "DSWA") & 0x40 ) << 1; | |
| 240 | 240 | |
| 241 | rlo = ( readinputportbytag("DSWB") & 0x01 ); | |
| 242 | rlo |= ( readinputportbytag("DSWB") & 0x04 ) >> 1; | |
| 243 | rlo |= ( readinputportbytag("DSWB") & 0x10 ) >> 2; | |
| 244 | rlo |= ( readinputportbytag("DSWB") & 0x40 ) >> 3; | |
| 241 | rlo = ( input_port_read(machine, "DSWB") & 0x01 ); | |
| 242 | rlo |= ( input_port_read(machine, "DSWB") & 0x04 ) >> 1; | |
| 243 | rlo |= ( input_port_read(machine, "DSWB") & 0x10 ) >> 2; | |
| 244 | rlo |= ( input_port_read(machine, "DSWB") & 0x40 ) >> 3; | |
| 245 | 245 | |
| 246 | 246 | return rhi | rlo; |
| 247 | 247 | } |
| r2375 | r2376 | |
| 250 | 250 | { |
| 251 | 251 | int rhi, rlo; |
| 252 | 252 | |
| 253 | rhi = ( readinputportbytag("DSWA") & 0x02 ) << 3; | |
| 254 | rhi |= ( readinputportbytag("DSWA") & 0x08 ) << 2; | |
| 255 | rhi |= ( readinputportbytag("DSWA") & 0x20 ) << 1; | |
| 256 | rhi |= ( readinputportbytag("DSWA") & 0x80 ); | |
| 253 | rhi = ( input_port_read(machine, "DSWA") & 0x02 ) << 3; | |
| 254 | rhi |= ( input_port_read(machine, "DSWA") & 0x08 ) << 2; | |
| 255 | rhi |= ( input_port_read(machine, "DSWA") & 0x20 ) << 1; | |
| 256 | rhi |= ( input_port_read(machine, "DSWA") & 0x80 ); | |
| 257 | 257 | |
| 258 | rlo = ( readinputportbytag("DSWB") & 0x02 ) >> 1; | |
| 259 | rlo |= ( readinputportbytag("DSWB") & 0x08 ) >> 2; | |
| 260 | rlo |= ( readinputportbytag("DSWB") & 0x20 ) >> 3; | |
| 261 | rlo |= ( readinputportbytag("DSWB") & 0x80 ) >> 4; | |
| 258 | rlo = ( input_port_read(machine, "DSWB") & 0x02 ) >> 1; | |
| 259 | rlo |= ( input_port_read(machine, "DSWB") & 0x08 ) >> 2; | |
| 260 | rlo |= ( input_port_read(machine, "DSWB") & 0x20 ) >> 3; | |
| 261 | rlo |= ( input_port_read(machine, "DSWB") & 0x80 ) >> 4; | |
| 262 | 262 | |
| 263 | 263 | return rhi | rlo; |
| 264 | 264 | } |
| r2375 | r2376 | |
|---|---|---|
| 490 | 490 | { |
| 491 | 491 | switch (*hardhead_ip) |
| 492 | 492 | { |
| 493 | case 0: return readinputport(0); | |
| 494 | case 1: return readinputport(1); | |
| 495 | case 2: return readinputport(2); | |
| 496 | case 3: return readinputport(3); | |
| 493 | case 0: return input_port_read_indexed(machine, 0); | |
| 494 | case 1: return input_port_read_indexed(machine, 1); | |
| 495 | case 2: return input_port_read_indexed(machine, 2); | |
| 496 | case 3: return input_port_read_indexed(machine, 3); | |
| 497 | 497 | default: |
| 498 | 498 | logerror("CPU #0 - PC %04X: Unknown IP read: %02X\n",activecpu_get_pc(),*hardhead_ip); |
| 499 | 499 | return 0xff; |
| r2375 | r2376 | |
|---|---|---|
| 38 | 38 | switch (offset<<1) |
| 39 | 39 | { |
| 40 | 40 | case 4: /* Dip Switches */ |
| 41 | return ( | |
| 41 | return ( | |
| 42 | 42 | case 2: /* Credits */ |
| 43 | return | |
| 43 | return | |
| 44 | 44 | case 0: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 45 | return ( | |
| 45 | return ( | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | logerror("Unknown control read at %d\n",offset); |
| r2375 | r2376 | |
| 51 | 51 | |
| 52 | 52 | /******************************************************************************/ |
| 53 | 53 | |
| 54 | static ADDRESS_MAP_START( vaportra_readmem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 55 | AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM) | |
| 56 | AM_RANGE(0x100000, 0x10000f) AM_READ(vaportra_control_r) | |
| 57 | ||
| 58 | AM_RANGE(0x200000, 0x201fff) AM_READ(SMH_RAM) | |
| 59 | AM_RANGE(0x202000, 0x203fff) AM_READ(SMH_RAM) | |
| 60 | AM_RANGE(0x280000, 0x281fff) AM_READ(SMH_RAM) | |
| 61 | AM_RANGE(0x282000, 0x283fff) AM_READ(SMH_RAM) | |
| 62 | ||
| 63 | AM_RANGE(0x300000, 0x300fff) AM_READ(SMH_RAM) | |
| 64 | AM_RANGE(0x304000, 0x304fff) AM_READ(SMH_RAM) | |
| 65 | AM_RANGE(0x308000, 0x308001) AM_READ(SMH_NOP) | |
| 66 | AM_RANGE(0xff8000, 0xff87ff) AM_READ(SMH_RAM) | |
| 67 | AM_RANGE(0xffc000, 0xffffff) AM_READ(SMH_RAM) | |
| 68 | ADDRESS_MAP_END | |
| 69 | ||
| 70 | static ADDRESS_MAP_START( vaportra_writemem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 71 | AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM) | |
| 54 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 55 | AM_RANGE(0x000000, 0x07ffff) AM_ROM | |
| 72 | 56 | AM_RANGE(0x100000, 0x100003) AM_WRITE(vaportra_priority_w) |
| 73 | 57 | AM_RANGE(0x100006, 0x100007) AM_WRITE(vaportra_sound_w) |
| 74 | ||
| 75 | AM_RANGE(0x200000, 0x201fff) AM_WRITE(deco16_pf3_data_w) AM_BASE(&deco16_pf3_data) | |
| 76 | AM_RANGE(0x202000, 0x203fff) AM_WRITE(deco16_pf4_data_w) AM_BASE(&deco16_pf4_data) | |
| 58 | AM_RANGE(0x100000, 0x10000f) AM_READ(vaportra_control_r) | |
| 59 | AM_RANGE(0x200000, 0x201fff) AM_RAM AM_WRITE(deco16_pf3_data_w) AM_BASE(&deco16_pf3_data) | |
| 60 | AM_RANGE(0x202000, 0x203fff) AM_RAM AM_WRITE(deco16_pf4_data_w) AM_BASE(&deco16_pf4_data) | |
| 77 | 61 | AM_RANGE(0x240000, 0x24000f) AM_WRITE(SMH_RAM) AM_BASE(&deco16_pf34_control) |
| 78 | ||
| 79 | AM_RANGE(0x280000, 0x281fff) AM_WRITE(deco16_pf1_data_w) AM_BASE(&deco16_pf1_data) | |
| 80 | AM_RANGE(0x282000, 0x283fff) AM_WRITE(deco16_pf2_data_w) AM_BASE(&deco16_pf2_data) | |
| 62 | AM_RANGE(0x280000, 0x281fff) AM_RAM AM_WRITE(deco16_pf1_data_w) AM_BASE(&deco16_pf1_data) | |
| 63 | AM_RANGE(0x282000, 0x283fff) AM_RAM AM_WRITE(deco16_pf2_data_w) AM_BASE(&deco16_pf2_data) | |
| 81 | 64 | AM_RANGE(0x2c0000, 0x2c000f) AM_WRITE(SMH_RAM) AM_BASE(&deco16_pf12_control) |
| 82 | ||
| 83 | AM_RANGE(0x300000, 0x3009ff) AM_WRITE(vaportra_palette_24bit_rg_w) AM_BASE(&paletteram16) | |
| 84 | AM_RANGE(0x304000, 0x3049ff) AM_WRITE(vaportra_palette_24bit_b_w) AM_BASE(&paletteram16_2) | |
| 85 | ||
| 86 | AM_RANGE(0x308000, 0x308001) AM_WRITE(SMH_NOP) | |
| 65 | AM_RANGE(0x300000, 0x3009ff) AM_RAM AM_WRITE(vaportra_palette_24bit_rg_w) AM_BASE(&paletteram16) | |
| 66 | AM_RANGE(0x304000, 0x3049ff) AM_RAM AM_WRITE(vaportra_palette_24bit_b_w) AM_BASE(&paletteram16_2) | |
| 67 | AM_RANGE(0x308000, 0x308001) AM_NOP | |
| 87 | 68 | AM_RANGE(0x30c000, 0x30c001) AM_WRITE(buffer_spriteram16_w) |
| 88 | AM_RANGE(0xff8000, 0xff87ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 89 | AM_RANGE(0xffc000, 0xffffff) AM_WRITE(SMH_RAM) | |
| 69 | AM_RANGE(0xff8000, 0xff87ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 70 | AM_RANGE(0xffc000, 0xffffff) AM_RAM | |
| 90 | 71 | ADDRESS_MAP_END |
| 91 | 72 | |
| 73 | ||
| 92 | 74 | /******************************************************************************/ |
| 93 | 75 | |
| 94 | 76 | static READ8_HANDLER( vaportra_soundlatch_r ) |
| r2375 | r2376 | |
| 121 | 103 | } |
| 122 | 104 | } |
| 123 | 105 | |
| 124 | static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 125 | AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM) | |
| 126 | AM_RANGE(0x100000, 0x100001) AM_READ(YM2203_status_port_0_r) | |
| 127 | AM_RANGE(0x110000, 0x110001) AM_READ(YM2151_status_port_0_r) | |
| 128 | AM_RANGE(0x120000, 0x120001) AM_READ(OKIM6295_status_0_r) | |
| 129 | AM_RANGE(0x130000, 0x130001) AM_READ(OKIM6295_status_1_r) | |
| 106 | static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 107 | AM_RANGE(0x000000, 0x00ffff) AM_ROM | |
| 108 | AM_RANGE(0x100000, 0x100001) AM_READWRITE(YM2203_status_port_0_r, YM2203_w) | |
| 109 | AM_RANGE(0x110000, 0x110001) AM_READWRITE(YM2151_status_port_0_r, YM2151_w) | |
| 110 | AM_RANGE(0x120000, 0x120001) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w) | |
| 111 | AM_RANGE(0x130000, 0x130001) AM_READWRITE(OKIM6295_status_1_r, OKIM6295_data_1_w) | |
| 130 | 112 | AM_RANGE(0x140000, 0x140001) AM_READ(vaportra_soundlatch_r) |
| 131 | AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8) | |
| 132 | ADDRESS_MAP_END | |
| 133 | ||
| 134 | static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 135 | AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM) | |
| 136 | AM_RANGE(0x100000, 0x100001) AM_WRITE(YM2203_w) | |
| 137 | AM_RANGE(0x110000, 0x110001) AM_WRITE(YM2151_w) | |
| 138 | AM_RANGE(0x120000, 0x120001) AM_WRITE(OKIM6295_data_0_w) | |
| 139 | AM_RANGE(0x130000, 0x130001) AM_WRITE(OKIM6295_data_1_w) | |
| 140 | AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8) | |
| 113 | AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8,SMH_BANK8) /* ??? LOOKUP ??? */ | |
| 141 | 114 | AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(H6280_timer_w) |
| 142 | 115 | AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(H6280_irq_status_w) |
| 143 | 116 | ADDRESS_MAP_END |
| r2375 | r2376 | |
| 274 | 247 | |
| 275 | 248 | /* basic machine hardware */ |
| 276 | 249 | MDRV_CPU_ADD(M68000,12000000) /* Custom chip 59 */ |
| 277 | MDRV_CPU_PROGRAM_MAP( | |
| 250 | MDRV_CPU_PROGRAM_MAP(main | |
| 278 | 251 | MDRV_CPU_VBLANK_INT("main", irq6_line_hold) |
| 279 | 252 | |
| 280 | 253 | MDRV_CPU_ADD(H6280, 32220000/4) /* Custom chip 45; Audio section crystal is 32.220 MHz */ |
| 281 | 254 | /* audio CPU */ |
| 282 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 255 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 283 | 256 | |
| 284 | 257 | /* video hardware */ |
| 285 | 258 | MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM) |
| r2375 | r2376 | |
|---|---|---|
| 164 | 164 | READ16_HANDLER( cps1_dsw_r ) |
| 165 | 165 | { |
| 166 | 166 | static const char *const dswname[3] = { "DSWA", "DSWB", "DSWC" }; |
| 167 | int control = | |
| 167 | int control = | |
| 168 | 168 | return control << 8 | control; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | READ16_HANDLER( cps1_in0_r ) |
| 172 | 172 | { |
| 173 | int buttons = | |
| 173 | int buttons = | |
| 174 | 174 | return buttons << 8 | buttons; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | READ16_HANDLER( cps1_in1_r ) |
| 178 | 178 | { |
| 179 | int buttons = | |
| 179 | int buttons = | |
| 180 | 180 | return buttons; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | READ16_HANDLER( cps1_in2_r ) |
| 184 | 184 | { |
| 185 | int buttons = | |
| 185 | int buttons = | |
| 186 | 186 | return buttons << 8 | buttons; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | READ16_HANDLER( cps1_in3_r ) |
| 190 | 190 | { |
| 191 | int buttons = | |
| 191 | int buttons = | |
| 192 | 192 | return buttons << 8 | buttons; |
| 193 | 193 | } |
| 194 | 194 | |
| r2375 | r2376 | |
| 197 | 197 | |
| 198 | 198 | static READ16_HANDLER( forgottn_dial_0_r ) |
| 199 | 199 | { |
| 200 | return (( | |
| 200 | return (( | |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | static READ16_HANDLER( forgottn_dial_1_r ) |
| 204 | 204 | { |
| 205 | return (( | |
| 205 | return (( | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | static WRITE16_HANDLER( forgottn_dial_0_reset_w ) |
| 209 | 209 | { |
| 210 | dial[0] = | |
| 210 | dial[0] = | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | static WRITE16_HANDLER( forgottn_dial_1_reset_w ) |
| 214 | 214 | { |
| 215 | dial[1] = | |
| 215 | dial[1] = | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | |
| r2375 | r2376 | |
| 3390 | 3390 | INPUT_PORTS_END |
| 3391 | 3391 | |
| 3392 | 3392 | /* |
| 3393 | Previously only the Right Hand Side of each 16x16 tile was used to make the 8x8 tiles | |
| 3394 | with the following comment | |
| 3395 | ||
| 3396 | "fixes cawing which uses character 0x0002 as space, typo instead of 0x20?" | |
| 3397 | ||
| 3398 | A Final Fight board with mismatched USA and Japan GFX appears to prove this statement | |
| 3399 | wrong as the columns of the tilemap alternate between sides of the 16x16 tile resulting | |
| 3393 | A Final Fight board with mismatched USA and Japan GFX proves that the columns | |
| 3394 | of the 8x8 tilemap alternate between sides of the 16x16 tile resulting | |
| 3400 | 3395 | in a corrupt WDUD screen (see ffightua) |
| 3401 | 3396 | */ |
| 3402 | 3397 | |
| r2375 | r2376 | |
| 3455 | 3450 | * |
| 3456 | 3451 | ********************************************************************/ |
| 3457 | 3452 | |
| 3458 | static MACHINE_DRIVER_START( cps1 ) | |
| 3453 | static MACHINE_DRIVER_START( cps1_10MHz ) | |
| 3459 | 3454 | |
| 3460 | 3455 | /* basic machine hardware */ |
| 3461 | 3456 | MDRV_CPU_ADD_TAG("main", M68000, 10000000) |
| r2375 | r2376 | |
| 3495 | 3490 | MACHINE_DRIVER_END |
| 3496 | 3491 | |
| 3497 | 3492 | #ifndef MESS |
| 3498 | static MACHINE_DRIVER_START( s | |
| 3493 | static MACHINE_DRIVER_START( cps1_12MHz ) | |
| 3499 | 3494 | |
| 3500 | 3495 | /* basic machine hardware */ |
| 3501 | MDRV_IMPORT_FROM(cps1) | |
| 3496 | MDRV_IMPORT_FROM(cps1_10MHz) | |
| 3497 | ||
| 3502 | 3498 | MDRV_CPU_REPLACE("main", M68000, 12000000) |
| 3503 | 3499 | MACHINE_DRIVER_END |
| 3504 | 3500 | |
| 3505 | 3501 | static MACHINE_DRIVER_START( pang3 ) |
| 3506 | 3502 | |
| 3507 | 3503 | /* basic machine hardware */ |
| 3508 | MDRV_IMPORT_FROM(cps1) | |
| 3504 | MDRV_IMPORT_FROM(cps1_12MHz) | |
| 3505 | ||
| 3509 | 3506 | MDRV_NVRAM_HANDLER(pang3) |
| 3510 | 3507 | MACHINE_DRIVER_END |
| 3511 | 3508 | |
| 3512 | 3509 | static MACHINE_DRIVER_START( qsound ) |
| 3513 | 3510 | |
| 3514 | 3511 | /* basic machine hardware */ |
| 3515 | MDRV_IMPORT_FROM(cps1) | |
| 3512 | MDRV_IMPORT_FROM(cps1_12MHz) | |
| 3513 | ||
| 3516 | 3514 | MDRV_CPU_REPLACE("main", M68000, 12000000) |
| 3517 | 3515 | MDRV_CPU_VBLANK_INT("main", cps1_qsound_interrupt) /* ??? interrupts per frame */ |
| 3518 | 3516 | |
| r2375 | r2376 | |
| 7303 | 7301 | |
| 7304 | 7302 | static DRIVER_INIT( pang3 ) |
| 7305 | 7303 | { |
| 7304 | /* Pang 3 EEPROM interface is at a different address */ | |
| 7305 | memory_install_readwrite16_handler (0, ADDRESS_SPACE_PROGRAM, 0x80017a, 0x80017b, 0, 0, cps1_eeprom_port_r, cps1_eeprom_port_w); | |
| 7306 | ||
| 7307 | DRIVER_INIT_CALL(cps1); | |
| 7308 | } | |
| 7309 | ||
| 7310 | static DRIVER_INIT( pang3j ) | |
| 7311 | { | |
| 7306 | 7312 | UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); |
| 7307 | 7313 | int A,src,dst; |
| 7308 | 7314 | |
| r2375 | r2376 | |
| 7322 | 7328 | rom[A/2] = dst; |
| 7323 | 7329 | } |
| 7324 | 7330 | |
| 7325 | DRIVER_INIT_CALL( | |
| 7331 | DRIVER_INIT_CALL( | |
| 7326 | 7332 | } |
| 7327 | 7333 | #endif |
| 7328 | 7334 | |
| 7329 | 7335 | |
| 7330 | GAME( 1988, forgottn, 0, cps1, forgottn, cps1, ROT0, "Capcom", "Forgotten Worlds (US)", 0 ) | |
| 7331 | GAME( 1988, lostwrld, forgottn, cps1, forgottn, cps1, ROT0, "Capcom", "Lost Worlds (Japan)", 0 ) | |
| 7332 | GAME( 1988, ghouls, 0, cps1, ghouls, cps1, ROT0, "Capcom", "Ghouls'n Ghosts (World)" , 0) // Wed.26.10.1988 in the ROMS | |
| 7333 | GAME( 1988, ghoulsu, ghouls, cps1, ghoulsu, cps1, ROT0, "Capcom", "Ghouls'n Ghosts (US)" , 0) // Wed.26.10.1988 in the ROMS | |
| 7334 | GAME( 1988, daimakai, ghouls, cps1, daimakai, cps1, ROT0, "Capcom", "Dai Makai-Mura (Japan)" , 0) // Wed.26.10.1988 in the ROMS | |
| 7335 | GAME( 1989, strider, 0, cps1, strider, cps1, ROT0, "Capcom", "Strider (US set 1)", 0 ) | |
| 7336 | GAME( 1989, stridrua, strider, cps1, stridrua, cps1, ROT0, "Capcom", "Strider (US set 2)", 0 ) | |
| 7337 | GAME( 1989, striderj, strider, cps1, strider, cps1, ROT0, "Capcom", "Strider Hiryu (Japan set 1)", 0 ) | |
| 7338 | GAME( 1989, stridrja, strider, cps1, strider, cps1, ROT0, "Capcom", "Strider Hiryu (Japan set 2)", 0 ) | |
| 7339 | GAME( 1989, dynwar, 0, cps1, dynwar, cps1, ROT0, "Capcom", "Dynasty Wars (World)", 0 ) // (c) Capcom U.S.A. | |
| 7340 | GAME( 1989, dynwarj, dynwar, cps1, dynwar, cps1, ROT0, "Capcom", "Tenchi wo Kurau (Japan)", 0 ) | |
| 7341 | GAME( 1989, willow, 0, cps1, willow, cps1, ROT0, "Capcom", "Willow (US)", 0 ) | |
| 7342 | GAME( 1989, willowj, willow, cps1, willow, cps1, ROT0, "Capcom", "Willow (Japan, Japanese)" , 0) // Japan "warning" | |
| 7343 | GAME( 1989, willowje, willow, cps1, willow, cps1, ROT0, "Capcom", "Willow (Japan, English)", 0 ) // (c) Capcom U.S.A. but Japan "warning" | |
| 7344 | GAME( 1989, unsquad, 0, cps1, unsquad, cps1, ROT0, "Capcom", "U.N. Squadron (US)", 0 ) | |
| 7345 | GAME( 1989, area88, unsquad, cps1, unsquad, cps1, ROT0, "Capcom", "Area 88 (Japan)", 0 ) | |
| 7346 | GAME( 1989, ffight, 0, cps1, ffight, cps1, ROT0, "Capcom", "Final Fight (World)", 0 ) | |
| 7347 | GAME( 1989, ffightu, ffight, cps1, ffight, cps1, ROT0, "Capcom", "Final Fight (US)", 0 ) | |
| 7348 | GAME( 1989, ffightua, ffight, cps1, ffight, cps1, ROT0, "Capcom", "Final Fight (US 900112)", 0 ) | |
| 7349 | GAME( 1989, ffightub, ffight, cps1, ffight, cps1, ROT0, "Capcom", "Final Fight (US 900613)", 0 ) | |
| 7350 | GAME( 1989, ffightj, ffight, cps1, ffight, cps1, ROT0, "Capcom", "Final Fight (Japan)", 0 ) | |
| 7351 | GAME( 1989, ffightj1, ffight, cps1, ffight, cps1, ROT0, "Capcom", "Final Fight (Japan 900305)", 0 ) | |
| 7352 | GAME( 1990, 1941, 0, cps1, 1941, cps1, ROT270, "Capcom", "1941 - Counter Attack (World)", 0 ) | |
| 7353 | GAME( 1990, 1941j, 1941, cps1, 1941, cps1, ROT270, "Capcom", "1941 - Counter Attack (Japan)", 0 ) | |
| 7354 | GAME( 1990, mercs, 0, cps1, mercs, cps1, ROT270, "Capcom", "Mercs (World 900302)" , 0) // "ETC" | |
| 7355 | GAME( 1990, mercsu, mercs, cps1, mercs, cps1, ROT270, "Capcom", "Mercs (US 900302)", 0 ) | |
| 7356 | GAME( 1990, mercsua, mercs, cps1, mercs, cps1, ROT270, "Capcom", "Mercs (US 900608)", 0 ) | |
| 7357 | GAME( 1990, mercsj, mercs, cps1, mercs, cps1, ROT270, "Capcom", "Senjou no Ookami II (Japan 900302)", 0 ) | |
| 7358 | GAME( 1990, mtwins, 0, cps1, mtwins, cps1, ROT0, "Capcom", "Mega Twins (World 900619)", 0 ) // "ETC" - (c) Capcom U.S.A. with World "warning" | |
| 7359 | GAME( 1990, chikij, mtwins, cps1, mtwins, cps1, ROT0, "Capcom", "Chiki Chiki Boys (Japan 900619)", 0 ) | |
| 7360 | GAME( 1990, msword, 0, cps1, msword, cps1, ROT0, "Capcom", "Magic Sword - Heroic Fantasy (World 900725)" , 0) // 25.07.1990 "Other Country" | |
| 7361 | GAME( 1990, mswordr1, msword, cps1, msword, cps1, ROT0, "Capcom", "Magic Sword - Heroic Fantasy (World 900623)" , 0) // 23.06.1990 "Other Country" | |
| 7362 | GAME( 1990, mswordu, msword, cps1, msword, cps1, ROT0, "Capcom", "Magic Sword - Heroic Fantasy (US 900725)" , 0) // 25.07.1990 "U.S.A." | |
| 7363 | GAME( 1990, mswordj, msword, cps1, msword, cps1, ROT0, "Capcom", "Magic Sword (Japan 900623)" , 0) // 23.06.1990 "Japan" | |
| 7364 | GAME( 1990, cawing, 0, cps1, cawing, cps1, ROT0, "Capcom", "Carrier Air Wing (World 901012)" , 0) // "ETC" | |
| 7365 | GAME( 1990, cawingr1, cawing, cps1, cawing, cps1, ROT0, "Capcom", "Carrier Air Wing (World 901009)" , 0) // "ETC" | |
| 7366 | GAME( 1990, cawingu, cawing, cps1, cawing, cps1, ROT0, "Capcom", "Carrier Air Wing (US 901012)", 0 ) | |
| 7367 | GAME( 1990, cawingj, cawing, cps1, cawing, cps1, ROT0, "Capcom", "U.S. Navy (Japan 901012)", 0 ) | |
| 7368 | GAME( 1990, nemo, 0, cps1, nemo, cps1, ROT0, "Capcom", "Nemo (World 901130)" , 0) // "ETC" | |
| 7369 | GAME( 1990, nemoj, nemo, cps1, nemo, cps1, ROT0, "Capcom", "Nemo (Japan 901120)", 0 ) | |
| 7370 | GAME( 1991, sf2, 0, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (World 910522)" , 0) // "ETC" | |
| 7371 | GAME( 1991, sf2eb, sf2, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (World 910214)" , 0) // "ETC" | |
| 7372 | GAME( 1991, sf2ua, sf2, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910206)", 0 ) | |
| 7373 | GAME( 1991, sf2ub, sf2, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910214)", 0 ) | |
| 7374 | GAME( 1991, sf2ud, sf2, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910318)", 0 ) | |
| 7375 | GAME( 1991, sf2ue, sf2, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910228)", 0 ) | |
| 7376 | GAME( 1991, sf2uf, sf2, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910411)", 0 ) | |
| 7377 | GAME( 1991, sf2ui, sf2, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910522)", 0 ) | |
| 7378 | GAME( 1991, sf2uk, sf2, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 911101)", 0 ) | |
| 7379 | GAME( 1991, sf2j, sf2, sf2, sf2j, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (Japan 911210)", 0 ) | |
| 7380 | GAME( 1991, sf2ja, sf2, sf2, sf2j, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (Japan 910214)", 0 ) | |
| 7381 | GAME( 1991, sf2jc, sf2, sf2, sf2j, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (Japan 910306)", 0 ) | |
| 7382 | GAME( 1991, 3wonders, 0, cps1, 3wonders, cps1, ROT0, "Capcom", "Three Wonders (World 910520)" , 0) // "ETC" | |
| 7383 | GAME( 1991, 3wonderu, 3wonders, cps1, 3wonders, cps1, ROT0, "Capcom", "Three Wonders (US 910520)", 0 ) | |
| 7384 | GAME( 1991, wonder3, 3wonders, cps1, 3wonders, cps1, ROT0, "Capcom", "Wonder 3 (Japan 910520)", 0 ) | |
| 7385 | GAME( 1991, kod, 0, cps1, kod, cps1, ROT0, "Capcom", "The King of Dragons (World 910711)" , 0) // "ETC" | |
| 7386 | GAME( 1991, kodu, kod, cps1, kodj, cps1, ROT0, "Capcom", "The King of Dragons (US 910910)", 0 ) | |
| 7387 | GAME( 1991, kodj, kod, cps1, kodj, cps1, ROT0, "Capcom", "The King of Dragons (Japan 910805)", 0 ) | |
| 7388 | GAME( 1991, kodb, kod, cps1, kod, cps1, ROT0, "Capcom", "The King of Dragons (bootleg)", GAME_NOT_WORKING ) // 910731 "ETC" | |
| 7389 | GAME( 1991, captcomm, 0, cps1, captcomm, cps1, ROT0, "Capcom", "Captain Commando (World 911014)" , 0) // "OTHER COUNTRY" | |
| 7390 | GAME( 1991, captcomu, captcomm, cps1, captcomm, cps1, ROT0, "Capcom", "Captain Commando (US 910928)", 0 ) | |
| 7391 | GAME( 1991, captcomj, captcomm, cps1, captcomm, cps1, ROT0, "Capcom", "Captain Commando (Japan 911202)", 0 ) | |
| 7392 | GAME( 1991, knights, 0, cps1, knights, cps1, ROT0, "Capcom", "Knights of the Round (World 911127)" , 0) // "ETC" | |
| 7393 | GAME( 1991, knightsu, knights, cps1, knights, cps1, ROT0, "Capcom", "Knights of the Round (US 911127)", 0 ) | |
| 7394 | GAME( 1991, knightsj, knights, cps1, knights, cps1, ROT0, "Capcom", "Knights of the Round (Japan 911127)", 0 ) | |
| 7395 | GAME( 1992, sf2ce, 0, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (World 920313)" , 0) // "ETC" | |
| 7396 | GAME( 1992, sf2ceua, sf2ce, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (US 920313)", 0 ) | |
| 7397 | GAME( 1992, sf2ceub, sf2ce, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (US 920513)", 0 ) | |
| 7398 | GAME( 1992, sf2ceuc, sf2ce, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (US 920803)", 0 ) | |
| 7399 | GAME( 1992, sf2cej, sf2ce, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (Japan 920513)", 0 ) | |
| 7400 | GAME( 1992, sf2rb, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Rainbow set 1)" , 0) // 920322 - based on World version | |
| 7401 | GAME( 1992, sf2rb2, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Rainbow set 2)" , 0) // 920322 - based on World version | |
| 7402 | GAME( 1992, sf2red, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Red Wave)" , 0) // 920313 - based on World version | |
| 7403 | GAME( 1992, sf2v004, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II! - Champion Edition (V004)", 0 ) // "102092" !!! - based on (heavily modified) World version | |
| 7404 | GAME( 1992, sf2accp2, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Accelerator Pt.II)" , 0) // 920313 - based on USA version | |
| 7405 | GAME( 1992, sf2m1, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M1)", GAME_NOT_WORKING ) | |
| 7406 | GAME( 1992, sf2m2, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M2)", GAME_NOT_WORKING ) | |
| 7407 | GAME( 1992, sf2m3, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M3)", GAME_NOT_WORKING ) | |
| 7408 | GAME( 1992, sf2m4, sf2ce, sf2, sf2j, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M4)", 0 ) | |
| 7409 | GAME( 1992, sf2m5, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M5)", 0 ) | |
| 7410 | GAME( 1992, sf2m6, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M6)", 0 ) | |
| 7411 | GAME( 1992, sf2m7, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M7)", 0 ) | |
| 7412 | GAME( 1992, sf2yyc, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (YYC)", 0 ) | |
| 7413 | GAME( 1992, sf2koryu, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Kouryu)", 0 ) | |
| 7414 | GAME( 1992, varth, 0, cps1, varth, cps1, ROT270, "Capcom", "Varth - Operation Thunderstorm (World 920714)" , 0) // "ETC" | |
| 7415 | GAME( 1992, varthr1, varth, cps1, varth, cps1, ROT270, "Capcom", "Varth - Operation Thunderstorm (World 920612)" , 0) // "ETC" | |
| 7416 | GAME( 1992, varthu, varth, cps1, varth, cps1, ROT270, "Capcom (Romstar license)", "Varth - Operation Thunderstorm (US 920612)", 0 ) | |
| 7417 | GAME( 1992, varthj, varth, cps1, varth, cps1, ROT270, "Capcom", "Varth - Operation Thunderstorm (Japan 920714)", 0 ) | |
| 7418 | GAME( 1992, cworld2j, 0, cps1, cworld2j, cps1, ROT0, "Capcom", "Capcom World 2 (Japan 920611)", 0 ) | |
| 7419 | GAME( 1992, sf2hf, sf2ce, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Hyper Fighting (World 921209)", 0 ) | |
| 7420 | GAME( 1992, sf2t, sf2ce, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Hyper Fighting (US 921209)", 0 ) | |
| 7421 | GAME( 1992, sf2tj, sf2ce, sf2, sf2j, cps1, ROT0, "Capcom", "Street Fighter II' Turbo - Hyper Fighting (Japan 921209)", 0 ) | |
| 7422 | GAME( 1992, qad, 0, cps1, qad, cps1, ROT0, "Capcom", "Quiz & Dragons (US 920701)", 0 ) | |
| 7423 | GAME( 1994, qadj, qad, cps1, qadj, cps1, ROT0, "Capcom", "Quiz & Dragons (Japan 940921)", 0 ) | |
| 7424 | GAME( 1995, qtono2, 0, cps1, qtono2, cps1, ROT0, "Capcom", "Quiz Tonosama no Yabou 2 Zenkoku-ban (Japan 950123)", 0 ) | |
| 7425 | GAME( 1995, megaman, 0, cps1, megaman, cps1, ROT0, "Capcom", "Mega Man - The Power Battle (CPS1 Asia 951006)", 0 ) | |
| 7426 | GAME( 1995, rockmanj, megaman, cps1, rockmanj, cps1, ROT0, "Capcom", "Rockman - The Power Battle (CPS1 Japan 950922)", 0 ) | |
| 7336 | GAME( 1988, forgottn, 0, cps1_10MHz, forgottn, cps1, ROT0, "Capcom", "Forgotten Worlds (US)", 0 ) | |
| 7337 | GAME( 1988, lostwrld, forgottn, cps1_10MHz, forgottn, cps1, ROT0, "Capcom", "Lost Worlds (Japan)", 0 ) | |
| 7338 | GAME( 1988, ghouls, 0, cps1_10MHz, ghouls, cps1, ROT0, "Capcom", "Ghouls'n Ghosts (World)" , 0) // Wed.26.10.1988 in the ROMS | |
| 7339 | GAME( 1988, ghoulsu, ghouls, cps1_10MHz, ghoulsu, cps1, ROT0, "Capcom", "Ghouls'n Ghosts (US)" , 0) // Wed.26.10.1988 in the ROMS | |
| 7340 | GAME( 1988, daimakai, ghouls, cps1_10MHz, daimakai, cps1, ROT0, "Capcom", "Dai Makai-Mura (Japan)" , 0) // Wed.26.10.1988 in the ROMS | |
| 7341 | GAME( 1989, strider, 0, cps1_10MHz, strider, cps1, ROT0, "Capcom", "Strider (US set 1)", 0 ) | |
| 7342 | GAME( 1989, stridrua, strider, cps1_10MHz, stridrua, cps1, ROT0, "Capcom", "Strider (US set 2)", 0 ) | |
| 7343 | GAME( 1989, striderj, strider, cps1_10MHz, strider, cps1, ROT0, "Capcom", "Strider Hiryu (Japan set 1)", 0 ) | |
| 7344 | GAME( 1989, stridrja, strider, cps1_10MHz, strider, cps1, ROT0, "Capcom", "Strider Hiryu (Japan set 2)", 0 ) | |
| 7345 | GAME( 1989, dynwar, 0, cps1_10MHz, dynwar, cps1, ROT0, "Capcom", "Dynasty Wars (World)", 0 ) // (c) Capcom U.S.A. | |
| 7346 | GAME( 1989, dynwarj, dynwar, cps1_10MHz, dynwar, cps1, ROT0, "Capcom", "Tenchi wo Kurau (Japan)", 0 ) | |
| 7347 | GAME( 1989, willow, 0, cps1_10MHz, willow, cps1, ROT0, "Capcom", "Willow (US)", 0 ) | |
| 7348 | GAME( 1989, willowj, willow, cps1_10MHz, willow, cps1, ROT0, "Capcom", "Willow (Japan, Japanese)" , 0) // Japan "warning" | |
| 7349 | GAME( 1989, willowje, willow, cps1_10MHz, willow, cps1, ROT0, "Capcom", "Willow (Japan, English)", 0 ) // (c) Capcom U.S.A. but Japan "warning" | |
| 7350 | GAME( 1989, unsquad, 0, cps1_10MHz, unsquad, cps1, ROT0, "Capcom", "U.N. Squadron (US)", 0 ) | |
| 7351 | GAME( 1989, area88, unsquad, cps1_10MHz, unsquad, cps1, ROT0, "Capcom", "Area 88 (Japan)", 0 ) | |
| 7352 | GAME( 1989, ffight, 0, cps1_10MHz, ffight, cps1, ROT0, "Capcom", "Final Fight (World)", 0 ) | |
| 7353 | GAME( 1989, ffightu, ffight, cps1_10MHz, ffight, cps1, ROT0, "Capcom", "Final Fight (US)", 0 ) | |
| 7354 | GAME( 1989, ffightua, ffight, cps1_10MHz, ffight, cps1, ROT0, "Capcom", "Final Fight (US 900112)", 0 ) | |
| 7355 | GAME( 1989, ffightub, ffight, cps1_10MHz, ffight, cps1, ROT0, "Capcom", "Final Fight (US 900613)", 0 ) | |
| 7356 | GAME( 1989, ffightj, ffight, cps1_10MHz, ffight, cps1, ROT0, "Capcom", "Final Fight (Japan)", 0 ) | |
| 7357 | GAME( 1989, ffightj1, ffight, cps1_10MHz, ffight, cps1, ROT0, "Capcom", "Final Fight (Japan 900305)", 0 ) | |
| 7358 | GAME( 1990, 1941, 0, cps1_10MHz, 1941, cps1, ROT270, "Capcom", "1941 - Counter Attack (World)", 0 ) | |
| 7359 | GAME( 1990, 1941j, 1941, cps1_10MHz, 1941, cps1, ROT270, "Capcom", "1941 - Counter Attack (Japan)", 0 ) | |
| 7360 | GAME( 1990, mercs, 0, cps1_10MHz, mercs, cps1, ROT270, "Capcom", "Mercs (World 900302)" , 0) // "ETC" | |
| 7361 | GAME( 1990, mercsu, mercs, cps1_10MHz, mercs, cps1, ROT270, "Capcom", "Mercs (US 900302)", 0 ) | |
| 7362 | GAME( 1990, mercsua, mercs, cps1_10MHz, mercs, cps1, ROT270, "Capcom", "Mercs (US 900608)", 0 ) | |
| 7363 | GAME( 1990, mercsj, mercs, cps1_10MHz, mercs, cps1, ROT270, "Capcom", "Senjou no Ookami II (Japan 900302)", 0 ) | |
| 7364 | GAME( 1990, mtwins, 0, cps1_10MHz, mtwins, cps1, ROT0, "Capcom", "Mega Twins (World 900619)", 0 ) // "ETC" - (c) Capcom U.S.A. with World "warning" | |
| 7365 | GAME( 1990, chikij, mtwins, cps1_10MHz, mtwins, cps1, ROT0, "Capcom", "Chiki Chiki Boys (Japan 900619)", 0 ) | |
| 7366 | GAME( 1990, msword, 0, cps1_10MHz, msword, cps1, ROT0, "Capcom", "Magic Sword - Heroic Fantasy (World 900725)" , 0) // 25.07.1990 "Other Country" | |
| 7367 | GAME( 1990, mswordr1, msword, cps1_10MHz, msword, cps1, ROT0, "Capcom", "Magic Sword - Heroic Fantasy (World 900623)" , 0) // 23.06.1990 "Other Country" | |
| 7368 | GAME( 1990, mswordu, msword, cps1_10MHz, msword, cps1, ROT0, "Capcom", "Magic Sword - Heroic Fantasy (US 900725)" , 0) // 25.07.1990 "U.S.A." | |
| 7369 | GAME( 1990, mswordj, msword, cps1_10MHz, msword, cps1, ROT0, "Capcom", "Magic Sword (Japan 900623)" , 0) // 23.06.1990 "Japan" | |
| 7370 | GAME( 1990, cawing, 0, cps1_10MHz, cawing, cps1, ROT0, "Capcom", "Carrier Air Wing (World 901012)" , 0) // "ETC" | |
| 7371 | GAME( 1990, cawingr1, cawing, cps1_10MHz, cawing, cps1, ROT0, "Capcom", "Carrier Air Wing (World 901009)" , 0) // "ETC" | |
| 7372 | GAME( 1990, cawingu, cawing, cps1_10MHz, cawing, cps1, ROT0, "Capcom", "Carrier Air Wing (US 901012)", 0 ) | |
| 7373 | GAME( 1990, cawingj, cawing, cps1_10MHz, cawing, cps1, ROT0, "Capcom", "U.S. Navy (Japan 901012)", 0 ) | |
| 7374 | GAME( 1990, nemo, 0, cps1_10MHz, nemo, cps1, ROT0, "Capcom", "Nemo (World 901130)" , 0) // "ETC" | |
| 7375 | GAME( 1990, nemoj, nemo, cps1_10MHz, nemo, cps1, ROT0, "Capcom", "Nemo (Japan 901120)", 0 ) | |
| 7376 | GAME( 1991, sf2, 0, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (World 910522)" , 0) // "ETC" | |
| 7377 | GAME( 1991, sf2eb, sf2, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (World 910214)" , 0) // "ETC" | |
| 7378 | GAME( 1991, sf2ua, sf2, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910206)", 0 ) | |
| 7379 | GAME( 1991, sf2ub, sf2, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910214)", 0 ) | |
| 7380 | GAME( 1991, sf2ud, sf2, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910318)", 0 ) | |
| 7381 | GAME( 1991, sf2ue, sf2, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910228)", 0 ) | |
| 7382 | GAME( 1991, sf2uf, sf2, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910411)", 0 ) | |
| 7383 | GAME( 1991, sf2ui, sf2, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 910522)", 0 ) | |
| 7384 | GAME( 1991, sf2uk, sf2, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (US 911101)", 0 ) | |
| 7385 | GAME( 1991, sf2j, sf2, cps1_12MHz, sf2j, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (Japan 911210)", 0 ) | |
| 7386 | GAME( 1991, sf2ja, sf2, cps1_12MHz, sf2j, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (Japan 910214)", 0 ) | |
| 7387 | GAME( 1991, sf2jc, sf2, cps1_12MHz, sf2j, cps1, ROT0, "Capcom", "Street Fighter II - The World Warrior (Japan 910306)", 0 ) | |
| 7388 | GAME( 1991, 3wonders, 0, cps1_10MHz, 3wonders, cps1, ROT0, "Capcom", "Three Wonders (World 910520)" , 0) // "ETC" | |
| 7389 | GAME( 1991, 3wonderu, 3wonders, cps1_10MHz, 3wonders, cps1, ROT0, "Capcom", "Three Wonders (US 910520)", 0 ) | |
| 7390 | GAME( 1991, wonder3, 3wonders, cps1_10MHz, 3wonders, cps1, ROT0, "Capcom", "Wonder 3 (Japan 910520)", 0 ) | |
| 7391 | GAME( 1991, kod, 0, cps1_10MHz, kod, cps1, ROT0, "Capcom", "The King of Dragons (World 910711)" , 0) // "ETC" | |
| 7392 | GAME( 1991, kodu, kod, cps1_10MHz, kodj, cps1, ROT0, "Capcom", "The King of Dragons (US 910910)", 0 ) | |
| 7393 | GAME( 1991, kodj, kod, cps1_10MHz, kodj, cps1, ROT0, "Capcom", "The King of Dragons (Japan 910805)", 0 ) | |
| 7394 | GAME( 1991, kodb, kod, cps1_10MHz, kod, cps1, ROT0, "Capcom", "The King of Dragons (bootleg)", GAME_NOT_WORKING ) // 910731 "ETC" | |
| 7395 | GAME( 1991, captcomm, 0, cps1_10MHz, captcomm, cps1, ROT0, "Capcom", "Captain Commando (World 911014)" , 0) // "OTHER COUNTRY" | |
| 7396 | GAME( 1991, captcomu, captcomm, cps1_10MHz, captcomm, cps1, ROT0, "Capcom", "Captain Commando (US 910928)", 0 ) | |
| 7397 | GAME( 1991, captcomj, captcomm, cps1_10MHz, captcomm, cps1, ROT0, "Capcom", "Captain Commando (Japan 911202)", 0 ) | |
| 7398 | GAME( 1991, knights, 0, cps1_10MHz, knights, cps1, ROT0, "Capcom", "Knights of the Round (World 911127)" , 0) // "ETC" | |
| 7399 | GAME( 1991, knightsu, knights, cps1_10MHz, knights, cps1, ROT0, "Capcom", "Knights of the Round (US 911127)", 0 ) | |
| 7400 | GAME( 1991, knightsj, knights, cps1_10MHz, knights, cps1, ROT0, "Capcom", "Knights of the Round (Japan 911127)", 0 ) | |
| 7401 | GAME( 1992, sf2ce, 0, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (World 920313)" , 0) // "ETC" | |
| 7402 | GAME( 1992, sf2ceua, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (US 920313)", 0 ) | |
| 7403 | GAME( 1992, sf2ceub, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (US 920513)", 0 ) | |
| 7404 | GAME( 1992, sf2ceuc, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (US 920803)", 0 ) | |
| 7405 | GAME( 1992, sf2cej, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (Japan 920513)", 0 ) | |
| 7406 | GAME( 1992, sf2rb, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Rainbow set 1)" , 0) // 920322 - based on World version | |
| 7407 | GAME( 1992, sf2rb2, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Rainbow set 2)" , 0) // 920322 - based on World version | |
| 7408 | GAME( 1992, sf2red, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Red Wave)" , 0) // 920313 - based on World version | |
| 7409 | GAME( 1992, sf2v004, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II! - Champion Edition (V004)", 0 ) // "102092" !!! - based on (heavily modified) World version | |
| 7410 | GAME( 1992, sf2accp2, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Accelerator Pt.II)" , 0) // 920313 - based on USA version | |
| 7411 | GAME( 1992, sf2m1, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M1)", GAME_NOT_WORKING ) | |
| 7412 | GAME( 1992, sf2m2, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M2)", GAME_NOT_WORKING ) | |
| 7413 | GAME( 1992, sf2m3, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M3)", GAME_NOT_WORKING ) | |
| 7414 | GAME( 1992, sf2m4, sf2ce, cps1_12MHz, sf2j, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M4)", 0 ) | |
| 7415 | GAME( 1992, sf2m5, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M5)", 0 ) | |
| 7416 | GAME( 1992, sf2m6, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M6)", 0 ) | |
| 7417 | GAME( 1992, sf2m7, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (M7)", 0 ) | |
| 7418 | GAME( 1992, sf2yyc, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (YYC)", 0 ) | |
| 7419 | GAME( 1992, sf2koryu, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Kouryu)", 0 ) | |
| 7420 | GAME( 1992, varth, 0, cps1_10MHz, varth, cps1, ROT270, "Capcom", "Varth - Operation Thunderstorm (World 920714)" , 0) // "ETC" | |
| 7421 | GAME( 1992, varthr1, varth, cps1_10MHz, varth, cps1, ROT270, "Capcom", "Varth - Operation Thunderstorm (World 920612)" , 0) // "ETC" | |
| 7422 | GAME( 1992, varthu, varth, cps1_10MHz, varth, cps1, ROT270, "Capcom (Romstar license)", "Varth - Operation Thunderstorm (US 920612)", 0 ) | |
| 7423 | GAME( 1992, varthj, varth, cps1_10MHz, varth, cps1, ROT270, "Capcom", "Varth - Operation Thunderstorm (Japan 920714)", 0 ) | |
| 7424 | GAME( 1992, cworld2j, 0, cps1_10MHz, cworld2j, cps1, ROT0, "Capcom", "Capcom World 2 (Japan 920611)", 0 ) | |
| 7425 | GAME( 1992, sf2hf, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Hyper Fighting (World 921209)", 0 ) | |
| 7426 | GAME( 1992, sf2t, sf2ce, cps1_12MHz, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Hyper Fighting (US 921209)", 0 ) | |
| 7427 | GAME( 1992, sf2tj, sf2ce, cps1_12MHz, sf2j, cps1, ROT0, "Capcom", "Street Fighter II' Turbo - Hyper Fighting (Japan 921209)", 0 ) | |
| 7428 | GAME( 1992, qad, 0, cps1_12MHz, qad, cps1, ROT0, "Capcom", "Quiz & Dragons (US 920701)", 0 ) // 12MHz verified | |
| 7429 | GAME( 1994, qadj, qad, cps1_10MHz, qadj, cps1, ROT0, "Capcom", "Quiz & Dragons (Japan 940921)", 0 ) | |
| 7430 | GAME( 1995, qtono2, 0, cps1_10MHz, qtono2, cps1, ROT0, "Capcom", "Quiz Tonosama no Yabou 2 Zenkoku-ban (Japan 950123)", 0 ) | |
| 7431 | GAME( 1995, megaman, 0, cps1_10MHz, megaman, cps1, ROT0, "Capcom", "Mega Man - The Power Battle (CPS1 Asia 951006)", 0 ) | |
| 7432 | GAME( 1995, rockmanj, megaman, cps1_10MHz, rockmanj, cps1, ROT0, "Capcom", "Rockman - The Power Battle (CPS1 Japan 950922)", 0 ) | |
| 7427 | 7433 | |
| 7428 | GAME( 1992, wof, 0, qsound, wof, wof, ROT0, "Capcom", "Warriors of Fate (World 921002)" , 0) // "ETC" | |
| 7429 | GAME( 1992, wofa, wof, qsound, wof, wof, ROT0, "Capcom", "Sangokushi II (Asia 921005)" , 0) // World "warning" | |
| 7430 | GAME( 1992, wofu, wof, qsound, wof, wof, ROT0, "Capcom", "Warriors of Fate (US 921031)" , 0) // World "warning" | |
| 7431 | GAME( 1992, wofj, wof, qsound, wof, wof, ROT0, "Capcom", "Tenchi wo Kurau II - Sekiheki no Tatakai (Japan 921031)", 0 ) | |
| 7432 | GAME( 1993, dino, 0, qsound, dino, dino, ROT0, "Capcom", "Cadillacs and Dinosaurs (World 930201)" , 0) // "ETC" | |
| 7433 | GAME( 1993, dinou, dino, qsound, dino, dino , ROT0, "Capcom", "Cadillacs and Dinosaurs (US 930201)", 0 ) | |
| 7434 | GAME( 1993, dinoj, dino, qsound, dino, dino , ROT0, "Capcom", "Cadillacs Kyouryuu-Shinseiki (Japan 930201)", 0 ) | |
| 7435 | GAME( 1993, punisher, 0, qsound, punisher, punisher, ROT0, "Capcom", "The Punisher (World 930422)" , 0) // "ETC" | |
| 7436 | GAME( 1993, punishru, punisher, qsound, punisher, punisher, ROT0, "Capcom", "The Punisher (US 930422)", 0 ) | |
| 7437 | GAME( 1993, punishrj, punisher, qsound, punisher, punisher, ROT0, "Capcom", "The Punisher (Japan 930422)", 0 ) | |
| 7438 | GAME( 1993, slammast, 0, qsound, slammast, slammast, ROT0, "Capcom", "Saturday Night Slam Masters (World 930713)" , 0) // "ETC" | |
| 7439 | GAME( 1993, slammasu, slammast, qsound, slammast, slammast, ROT0, "Capcom", "Saturday Night Slam Masters (US 930713)", 0 ) | |
| 7440 | GAME( 1993, mbomberj, slammast, qsound, slammast, slammast, ROT0, "Capcom", "Muscle Bomber - The Body Explosion (Japan 930713)", 0 ) | |
| 7441 | GAME( 1993, mbombrd, slammast, qsound, slammast, slammast, ROT0, "Capcom", "Muscle Bomber Duo - Ultimate Team Battle (World 931206)" , 0) // "ETC" | |
| 7442 | GAME( 1993, mbombrdj, slammast, qsound, slammast, slammast, ROT0, "Capcom", "Muscle Bomber Duo - Heat Up Warriors (Japan 931206)", 0 ) | |
| 7434 | GAME( 1992, wof, 0, qsound, wof, wof, ROT0, "Capcom", "Warriors of Fate (World 921002)" , 0) // "ETC" | |
| 7435 | GAME( 1992, wofa, wof, qsound, wof, wof, ROT0, "Capcom", "Sangokushi II (Asia 921005)" , 0) // World "warning" | |
| 7436 | GAME( 1992, wofu, wof, qsound, wof, wof, ROT0, "Capcom", "Warriors of Fate (US 921031)" , 0) // World "warning" | |
| 7437 | GAME( 1992, wofj, wof, qsound, wof, wof, ROT0, "Capcom", "Tenchi wo Kurau II - Sekiheki no Tatakai (Japan 921031)", 0 ) | |
| 7438 | GAME( 1993, dino, 0, qsound, dino, dino, ROT0, "Capcom", "Cadillacs and Dinosaurs (World 930201)" , 0) // "ETC" | |
| 7439 | GAME( 1993, dinou, dino, qsound, dino, dino , ROT0, "Capcom", "Cadillacs and Dinosaurs (US 930201)", 0 ) | |
| 7440 | GAME( 1993, dinoj, dino, qsound, dino, dino , ROT0, "Capcom", "Cadillacs Kyouryuu-Shinseiki (Japan 930201)", 0 ) | |
| 7441 | GAME( 1993, punisher, 0, qsound, punisher, punisher, ROT0, "Capcom", "The Punisher (World 930422)" , 0) // "ETC" | |
| 7442 | GAME( 1993, punishru, punisher, qsound, punisher, punisher, ROT0, "Capcom", "The Punisher (US 930422)", 0 ) | |
| 7443 | GAME( 1993, punishrj, punisher, qsound, punisher, punisher, ROT0, "Capcom", "The Punisher (Japan 930422)", 0 ) | |
| 7444 | GAME( 1993, slammast, 0, qsound, slammast, slammast, ROT0, "Capcom", "Saturday Night Slam Masters (World 930713)" , 0) // "ETC" | |
| 7445 | GAME( 1993, slammasu, slammast, qsound, slammast, slammast, ROT0, "Capcom", "Saturday Night Slam Masters (US 930713)", 0 ) | |
| 7446 | GAME( 1993, mbomberj, slammast, qsound, slammast, slammast, ROT0, "Capcom", "Muscle Bomber - The Body Explosion (Japan 930713)", 0 ) | |
| 7447 | GAME( 1993, mbombrd, slammast, qsound, slammast, slammast, ROT0, "Capcom", "Muscle Bomber Duo - Ultimate Team Battle (World 931206)" , 0) // "ETC" | |
| 7448 | GAME( 1993, mbombrdj, slammast, qsound, slammast, slammast, ROT0, "Capcom", "Muscle Bomber Duo - Heat Up Warriors (Japan 931206)", 0 ) | |
| 7443 | 7449 | |
| 7444 | GAME( 1994, pnickj, 0, cps1, | |
| 7450 | GAME( 1994, pnickj, 0, cps1_10MHz, | |
| 7445 | 7451 | /* Japanese version of Pang 3 is encrypted, Euro version is not */ |
| 7446 | GAME( 1995, pang3, 0, pang3, pang3, cps1, ROT0, "Mitchell", "Pang! 3 (Euro 950511)", 0 ) | |
| 7447 | GAME( 1995, pang3j, pang3, pang3, pang3, pang3, ROT0, "Mitchell", "Pang! 3 (Japan 950511)", 0 ) | |
| 7452 | GAME( 1995, pang3, 0, pang3, pang3, pang3, ROT0, "Mitchell", "Pang! 3 (Euro 950511)", 0 ) | |
| 7453 | GAME( 1995, pang3j, pang3, pang3, pang3, pang3j, ROT0, "Mitchell", "Pang! 3 (Japan 950511)", 0 ) |
| r2375 | r2376 | |
|---|---|---|
| 135 | 135 | |
| 136 | 136 | static READ8_HANDLER( ninjakun_io_A002_r ) |
| 137 | 137 | { |
| 138 | return ninjakun_io_a002_ctrl | | |
| 138 | return ninjakun_io_a002_ctrl | | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | static WRITE8_HANDLER( ninjakun_cpu1_io_A002_w ) |
| r2375 | r2376 | |
|---|---|---|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| 81 | static void move_motor(stactics_state *state) | |
| 81 | static void move_motor(running_machine *machine, stactics_state *state) | |
| 82 | 82 | { |
| 83 | 83 | /* monitor motor under joystick control */ |
| 84 | 84 | if (*state->motor_on & 0x01) |
| 85 | 85 | { |
| 86 | int ip3 = readinputport(3); | |
| 87 | int ip4 = readinputport(4); | |
| 86 | int ip3 = input_port_read_indexed(machine, 3); | |
| 87 | int ip4 = input_port_read_indexed(machine, 4); | |
| 88 | 88 | |
| 89 | 89 | /* up */ |
| 90 | 90 | if (((ip4 & 0x01) == 0) && (state->vert_pos > -128)) |
| r2375 | r2376 | |
| 157 | 157 | { |
| 158 | 158 | stactics_state *state = machine->driver_data; |
| 159 | 159 | |
| 160 | move_motor(state); | |
| 160 | move_motor(machine, state); | |
| 161 | 161 | |
| 162 | 162 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 163 | 163 | } |
| r2375 | r2376 | |
|---|---|---|
| 354 | 354 | * |
| 355 | 355 | *************************************/ |
| 356 | 356 | |
| 357 | static READ32_HANDLER( input_port_0_020_r ) { return readinputport(0) << 16; } | |
| 358 | static READ32_HANDLER( input_port_1_020_r ) { return readinputport(1) << 16; } | |
| 359 | static READ32_HANDLER( input_port_2_020_r ) { return readinputport(2) << 16; } | |
| 360 | static READ32_HANDLER( input_port_3_020_r ) { return readinputport(3) << 16; } | |
| 357 | static READ32_HANDLER( input_port_0_020_r ) { return input_port_read_indexed(machine, 0) << 16; } | |
| 358 | static READ32_HANDLER( input_port_1_020_r ) { return input_port_read_indexed(machine, 1) << 16; } | |
| 359 | static READ32_HANDLER( input_port_2_020_r ) { return input_port_read_indexed(machine, 2) << 16; } | |
| 360 | static READ32_HANDLER( input_port_3_020_r ) { return input_port_read_indexed(machine, 3) << 16; } | |
| 361 | 361 | |
| 362 | 362 | |
| 363 | 363 | static CUSTOM_INPUT( analog_bit_r ) |
| r2375 | r2376 | |
| 393 | 393 | { |
| 394 | 394 | if (!(data & 0xff)) |
| 395 | 395 | { |
| 396 | analog_ports[0] = readinputportbytag_safe("ANALOG0", 0); | |
| 397 | analog_ports[1] = readinputportbytag_safe("ANALOG1", 0); | |
| 398 | analog_ports[2] = readinputportbytag_safe("ANALOG2", 0); | |
| 399 | analog_ports[3] = readinputportbytag_safe("ANALOG3", 0); | |
| 396 | analog_ports[0] = input_port_read_safe(machine, "ANALOG0", 0); | |
| 397 | analog_ports[1] = input_port_read_safe(machine, "ANALOG1", 0); | |
| 398 | analog_ports[2] = input_port_read_safe(machine, "ANALOG2", 0); | |
| 399 | analog_ports[3] = input_port_read_safe(machine, "ANALOG3", 0); | |
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | else |
| r2375 | r2376 | |
|---|---|---|
| 575 | 575 | UINT16 n_coin; |
| 576 | 576 | UINT32 n_input; |
| 577 | 577 | |
| 578 | n_input = ( | |
| 578 | n_input = ( | |
| 579 | 579 | SHRAM( 0xbd00 ) = n_input | ( ( n_input & ~SHRAM( 0xbd00 ) ) >> 8 ) | ( SHRAM( 0xbd00 ) & 0x0000ffff ); |
| 580 | 580 | |
| 581 | n_input = | |
| 581 | n_input = | |
| 582 | 582 | SHRAM( 0xbd04 ) = n_input | ( ( n_input & ~SHRAM( 0xbd04 ) ) >> 8 ); |
| 583 | 583 | |
| 584 | n_input = | |
| 584 | n_input = | |
| 585 | 585 | SHRAM( 0xbd08 ) = n_input | ( ( n_input & ~SHRAM( 0xbd08 ) ) >> 8 ) | ( SHRAM( 0xbd08 ) & 0xffff0000 ); |
| 586 | 586 | |
| 587 | n_coin = | |
| 587 | n_coin = | |
| 588 | 588 | |
| 589 | 589 | if( ( n_coin & m_n_oldcoin & 0x08 ) != 0 ) |
| 590 | 590 | { |
| r2375 | r2376 | |
| 627 | 627 | |
| 628 | 628 | SHRAM( 0xbd30 ) = ( SHRAM( 0xbd30 ) & 0x0000ffff ) | ( 0x0080 << 16 ); |
| 629 | 629 | |
| 630 | SHRAM( 0xbd08 ) = ( SHRAM( 0xbd08 ) & 0x0000ffff ) | ( readinputportbytag( "STEERING" ) << 16 ); | |
| 631 | SHRAM( 0xbd0c ) = ( SHRAM( 0xbd0c ) & 0xffff0000 ) | ( readinputportbytag( "GAS" ) << 0 ); | |
| 630 | SHRAM( 0xbd08 ) = ( SHRAM( 0xbd08 ) & 0x0000ffff ) | ( input_port_read(machine, "STEERING" ) << 16 ); | |
| 631 | SHRAM( 0xbd0c ) = ( SHRAM( 0xbd0c ) & 0xffff0000 ) | ( input_port_read(machine, "GAS" ) << 0 ); | |
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | static TIMER_CALLBACK( mcu_timer ) |
| 636 | 636 | { |
| 637 | SHRAM( 0xbd00 ) = ( SHRAM( 0xbd00 ) & 0xffffff00 ) | | |
| 637 | SHRAM( 0xbd00 ) = ( SHRAM( 0xbd00 ) & 0xffffff00 ) | | |
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | static UINT32 m_n_bankoffset; |
| r2375 | r2376 | |
| 715 | 715 | switch( offset ) |
| 716 | 716 | { |
| 717 | 717 | case 0: |
| 718 | data = | |
| 718 | data = | |
| 719 | 719 | break; |
| 720 | 720 | case 1: |
| 721 | data = ( | |
| 721 | data = ( | |
| 722 | 722 | break; |
| 723 | 723 | case 2: |
| 724 | data = | |
| 724 | data = | |
| 725 | 725 | break; |
| 726 | 726 | case 3: |
| 727 | data = ( | |
| 727 | data = ( | |
| 728 | 728 | break; |
| 729 | 729 | } |
| 730 | 730 | verboselog( 2, "lightgun_r( %08x, %08x ) %08x\n", offset, mem_mask, data ); |
| r2375 | r2376 | |
| 800 | 800 | timer = timer_alloc( mcu_timer , NULL); |
| 801 | 801 | timer_adjust_periodic( timer, ATTOTIME_IN_HZ( 600 ), 0, ATTOTIME_IN_HZ( 600 ) ); |
| 802 | 802 | |
| 803 | psx_driver_init(); | |
| 803 | psx_driver_init(machine); | |
| 804 | 804 | namcoc7x_on_driver_init(); |
| 805 | 805 | namcoc7x_set_host_ram(namcos11_sharedram); |
| 806 | 806 |
| r2375 | r2376 | |
|---|---|---|
| 70 | 70 | |
| 71 | 71 | static CUSTOM_INPUT( cclownz_paddle ) |
| 72 | 72 | { |
| 73 | int value = | |
| 73 | int value = | |
| 74 | 74 | return ((value << 4) & 0xf00) | (value & 0x00f); |
| 75 | 75 | } |
| 76 | 76 |
| r2375 | r2376 | |
|---|---|---|
| 714 | 714 | /* used by most games */ |
| 715 | 715 | static READ8_HANDLER( special_port0_r ) |
| 716 | 716 | { |
| 717 | UINT8 result = | |
| 717 | UINT8 result = | |
| 718 | 718 | result = (result & 0xfe) | (pia_portb_data & 0x01); |
| 719 | 719 | return result; |
| 720 | 720 | } |
| r2375 | r2376 | |
| 723 | 723 | /* used by Rim Rockin' Basketball */ |
| 724 | 724 | static READ8_HANDLER( special_port1_r ) |
| 725 | 725 | { |
| 726 | UINT8 result = | |
| 726 | UINT8 result = | |
| 727 | 727 | result = (result & 0x7f) | ((pia_portb_data & 0x01) << 7); |
| 728 | 728 | return result; |
| 729 | 729 | } |
| r2375 | r2376 | |
|---|---|---|
| 360 | 360 | static READ8_HANDLER( konami_porta_0_r ) |
| 361 | 361 | { |
| 362 | 362 | // logerror("%04X:ppi0_porta_r\n", activecpu_get_pc()); |
| 363 | return | |
| 363 | return | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | |
| 367 | 367 | static READ8_HANDLER( konami_portb_0_r ) |
| 368 | 368 | { |
| 369 | 369 | // logerror("%04X:ppi0_portb_r\n", activecpu_get_pc()); |
| 370 | return | |
| 370 | return | |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | |
| 374 | 374 | static READ8_HANDLER( konami_portc_0_r ) |
| 375 | 375 | { |
| 376 | 376 | logerror("%04X:ppi0_portc_r\n", activecpu_get_pc()); |
| 377 | return | |
| 377 | return | |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | |
| 381 | 381 | static READ8_HANDLER( konami_portc_1_r ) |
| 382 | 382 | { |
| 383 | 383 | logerror("%04X:ppi1_portc_r\n", activecpu_get_pc()); |
| 384 | return | |
| 384 | return | |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | |
| r2375 | r2376 | |
| 761 | 761 | const char *portname = param; |
| 762 | 762 | if (gmgalax_selected_game != 0) |
| 763 | 763 | portname += strlen(portname) + 1; |
| 764 | return | |
| 764 | return | |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | |
| r2375 | r2376 | |
| 817 | 817 | |
| 818 | 818 | static CUSTOM_INPUT( azurian_port_r ) |
| 819 | 819 | { |
| 820 | return ( | |
| 820 | return ( | |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | |
| r2375 | r2376 | |
| 831 | 831 | static CUSTOM_INPUT( kingball_muxbit_r ) |
| 832 | 832 | { |
| 833 | 833 | /* multiplex the service mode switch with a speech DIP switch */ |
| 834 | return ( | |
| 834 | return ( | |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | 837 |
| r2375 | r2376 | |
|---|---|---|
| 211 | 211 | static MACHINE_RESET( bbusters ) |
| 212 | 212 | { |
| 213 | 213 | UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); |
| 214 | int data = | |
| 214 | int data = | |
| 215 | 215 | |
| 216 | 216 | /* Country/Version : |
| 217 | 217 | - 0x0000 : Japan? |
| r2375 | r2376 | |
| 230 | 230 | static MACHINE_RESET( mechatt ) |
| 231 | 231 | { |
| 232 | 232 | UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); |
| 233 | int data = | |
| 233 | int data = | |
| 234 | 234 | |
| 235 | 235 | /* Country : |
| 236 | 236 | - 0x0000 : Japan |
| r2375 | r2376 | |
| 260 | 260 | |
| 261 | 261 | static READ16_HANDLER( control_3_r ) |
| 262 | 262 | { |
| 263 | return | |
| 263 | return | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | static WRITE16_HANDLER( gun_select_w ) |
| r2375 | r2376 | |
| 272 | 272 | |
| 273 | 273 | static READ16_HANDLER( kludge_r ) |
| 274 | 274 | { |
| 275 | bbuster_ram[0xa692/2]=readinputportbytag("IN5")<<1; | |
| 276 | bbuster_ram[0xa694/2]=readinputportbytag("IN6")<<1; | |
| 277 | bbuster_ram[0xa696/2]=readinputportbytag("IN7")<<1; | |
| 278 | bbuster_ram[0xa698/2]=readinputportbytag("IN8")<<1; | |
| 279 | bbuster_ram[0xa69a/2]=readinputportbytag("IN9")<<1; | |
| 280 | bbuster_ram[0xa69c/2]=readinputportbytag("IN10")<<1; | |
| 275 | bbuster_ram[0xa692/2]=input_port_read(machine, "IN5")<<1; | |
| 276 | bbuster_ram[0xa694/2]=input_port_read(machine, "IN6")<<1; | |
| 277 | bbuster_ram[0xa696/2]=input_port_read(machine, "IN7")<<1; | |
| 278 | bbuster_ram[0xa698/2]=input_port_read(machine, "IN8")<<1; | |
| 279 | bbuster_ram[0xa69a/2]=input_port_read(machine, "IN9")<<1; | |
| 280 | bbuster_ram[0xa69c/2]=input_port_read(machine, "IN10")<<1; | |
| 281 | 281 | return 0; |
| 282 | 282 | } |
| 283 | 283 | |
| r2375 | r2376 | |
| 292 | 292 | int baseport=2,x,y; |
| 293 | 293 | if (offset) baseport=4; /* Player 2 */ |
| 294 | 294 | |
| 295 | x=readinputport(baseport); | |
| 296 | y=readinputport(baseport+1); | |
| 295 | x=input_port_read_indexed(machine, baseport); | |
| 296 | y=input_port_read_indexed(machine, baseport+1); | |
| 297 | 297 | |
| 298 | 298 | /* Todo - does the hardware really clamp like this? */ |
| 299 | 299 | x+=0x18; |
| r2375 | r2376 | |
|---|---|---|
| 290 | 290 | /*********************************************************************/ |
| 291 | 291 | |
| 292 | 292 | |
| 293 | static int snk_rot( int which ){ | |
| 293 | static int snk_rot( running_machine *machine, int which ){ | |
| 294 | 294 | static int last_value[2] = {0, 0}; |
| 295 | 295 | static int cp_count[2] = {0, 0}; |
| 296 | 296 | int bttn; |
| 297 | int value = | |
| 297 | int value = | |
| 298 | 298 | |
| 299 | 299 | /* For Guerilla War we add a 0xf0 value for 1 input read once every 8 rotations. |
| 300 | 300 | * 0xf0 isn't a valid direction, but avoids the "joystick error" protection |
| r2375 | r2376 | |
| 325 | 325 | return value; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | case SNK_ROT_PLAYER1: return snk_rot( 0 ); | |
| 329 | case SNK_ROT_PLAYER2: return snk_rot( 1 ); | |
| 328 | case SNK_ROT_PLAYER1: return snk_rot( machine, 0 ); | |
| 329 | case SNK_ROT_PLAYER2: return snk_rot( machine, 1 ); | |
| 330 | 330 | |
| 331 | case SNK_INP1: return input_port_1_r(machine,0); | |
| 332 | case SNK_INP2: return input_port_2_r(machine,0); | |
| 333 | case SNK_INP3: return input_port_3_r(machine,0); | |
| 334 | case SNK_INP4: return input_port_4_r(machine,0); | |
| 335 | case SNK_INP5: return input_port_5_r(machine,0); | |
| 336 | case SNK_INP6: return input_port_6_r(machine,0); | |
| 337 | case SNK_INP7: return input_port_7_r(machine,0); | |
| 338 | case SNK_INP8: return input_port_8_r(machine,0); | |
| 339 | case SNK_INP9: return input_port_9_r(machine,0); | |
| 340 | case SNK_INP10: return input_port_10_r(machine,0); | |
| 341 | case SNK_INP11: return input_port_11_r(machine,0); | |
| 331 | case SNK_INP1: return input_port_read_indexed(machine, 1); | |
| 332 | case SNK_INP2: return input_port_read_indexed(machine, 2); | |
| 333 | case SNK_INP3: return input_port_read_indexed(machine, 3); | |
| 334 | case SNK_INP4: return input_port_read_indexed(machine, 4); | |
| 335 | case SNK_INP5: return input_port_read_indexed(machine, 5); | |
| 336 | case SNK_INP6: return input_port_read_indexed(machine, 6); | |
| 337 | case SNK_INP7: return input_port_read_indexed(machine, 7); | |
| 338 | case SNK_INP8: return input_port_read_indexed(machine, 8); | |
| 339 | case SNK_INP9: return input_port_read_indexed(machine, 9); | |
| 340 | case SNK_INP10: return input_port_read_indexed(machine, 10); | |
| 341 | case SNK_INP11: return input_port_read_indexed(machine, 11); | |
| 342 | 342 | |
| 343 | 343 | default: |
| 344 | 344 | logerror("read from unmapped input port:%d\n", which ); |
| r2375 | r2376 | |
|---|---|---|
| 664 | 664 | |
| 665 | 665 | switch( offset ) |
| 666 | 666 | { |
| 667 | case 0: case 1: result = (UINT8)(0x0f+readinputport(7)*224/255); break; /* Y (p2) */ | |
| 668 | case 2: case 3: result = (UINT8)(0x26+readinputport(6)*288/314); break; /* X (p2) */ | |
| 669 | case 4: case 5: result = (UINT8)(0x0f+readinputport(5)*224/255); break; /* Y (p1) */ | |
| 670 | case 6: case 7: result = (UINT8)(0x26+readinputport(4)*288/314); break; /* X (p1) */ | |
| 667 | case 0: case 1: result = (UINT8)(0x0f+input_port_read_indexed(machine, 7)*224/255); break; /* Y (p2) */ | |
| 668 | case 2: case 3: result = (UINT8)(0x26+input_port_read_indexed(machine, 6)*288/314); break; /* X (p2) */ | |
| 669 | case 4: case 5: result = (UINT8)(0x0f+input_port_read_indexed(machine, 5)*224/255); break; /* Y (p1) */ | |
| 670 | case 6: case 7: result = (UINT8)(0x26+input_port_read_indexed(machine, 4)*288/314); break; /* X (p1) */ | |
| 671 | 671 | } |
| 672 | 672 | return result<<24; |
| 673 | 673 | } /* gunbulet_gun_r */ |
| r2375 | r2376 | |
|---|---|---|
| 163 | 163 | |
| 164 | 164 | static READ8_HANDLER( victnine_port_5_r ) |
| 165 | 165 | { |
| 166 | return (victnine_mcu_status_r(machine,0) & 3) | ( | |
| 166 | return (victnine_mcu_status_r(machine,0) & 3) | ( | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | static ADDRESS_MAP_START( victnine_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2375 | r2376 | |
|---|---|---|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | static void fcrash_build_palette(running_machine *machine) | |
| 126 | { | |
| 127 | int offset; | |
| 128 | ||
| 129 | for (offset = 0; offset < 32*6*16; offset++) | |
| 130 | { | |
| 131 | int palette = cps1_gfxram[0x14000/2 + offset]; | |
| 132 | int r, g, b, bright; | |
| 133 | ||
| 134 | // from my understanding of the schematics, when the 'brightness' | |
| 135 | // component is set to 0 it should reduce brightness to 1/3 | |
| 136 | ||
| 137 | bright = 0x0f + ((palette>>12)<<1); | |
| 138 | ||
| 139 | r = ((palette>>8)&0x0f) * 0x11 * bright / 0x2d; | |
| 140 | g = ((palette>>4)&0x0f) * 0x11 * bright / 0x2d; | |
| 141 | b = ((palette>>0)&0x0f) * 0x11 * bright / 0x2d; | |
| 142 | ||
| 143 | palette_set_color (machine, offset, MAKE_RGB(r, g, b)); | |
| 144 | } | |
| 145 | } | |
| 146 | ||
| 125 | 147 | static VIDEO_UPDATE( fcrash ) |
| 126 | 148 | { |
| 127 | 149 | int layercontrol,l0,l1,l2,l3; |
| r2375 | r2376 | |
| 136 | 158 | cps1_get_video_base(); |
| 137 | 159 | |
| 138 | 160 | /* Build palette */ |
| 139 | c | |
| 161 | fcrash_build_palette(screen->machine); | |
| 140 | 162 | |
| 141 | 163 | fcrash_update_transmasks(); |
| 142 | 164 | |
| r2375 | r2376 | |
| 172 | 194 | tilemap_set_enable(cps1_bg_tilemap[2],1); |
| 173 | 195 | |
| 174 | 196 | /* Blank screen */ |
| 175 | fillbitmap(bitmap, | |
| 197 | fillbitmap(bitmap, | |
| 176 | 198 | |
| 177 | 199 | fillbitmap(priority_bitmap,0,cliprect); |
| 178 | 200 | l0 = (layercontrol >> 0x06) & 03; |
| r2375 | r2376 | |
|---|---|---|
| 1050 | 1050 | { |
| 1051 | 1051 | switch( mux_data&0xf0 ) /* bits 4-7 */ |
| 1052 | 1052 | { |
| 1053 | case 0x10: return input_port_0_r(machine,0); | |
| 1054 | case 0x20: return input_port_1_r(machine,0); | |
| 1055 | case 0x40: return input_port_2_r(machine,0); | |
| 1056 | case 0x80: return input_port_3_r(machine,0); | |
| 1053 | case 0x10: return input_port_read_indexed(machine, 0); | |
| 1054 | case 0x20: return input_port_read_indexed(machine, 1); | |
| 1055 | case 0x40: return input_port_read_indexed(machine, 2); | |
| 1056 | case 0x80: return input_port_read_indexed(machine, 3); | |
| 1057 | 1057 | } |
| 1058 | 1058 | return 0xff; |
| 1059 | 1059 | } |
| r2375 | r2376 | |
|---|---|---|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
| 113 | static STATE_POSTLOAD( atetris_postload ) | |
| 114 | { | |
| 115 | reset_bank(); | |
| 116 | } | |
| 117 | ||
| 118 | ||
| 113 | 119 | static MACHINE_START( atetris ) |
| 114 | 120 | { |
| 115 | 121 | /* Allocate interrupt timer */ |
| r2375 | r2376 | |
| 118 | 124 | /* Set up save state */ |
| 119 | 125 | state_save_register_global(current_bank); |
| 120 | 126 | state_save_register_global(nvram_write_enable); |
| 121 | state_save_register_ | |
| 127 | state_save_register_ | |
| 122 | 128 | } |
| 123 | 129 | |
| 124 | 130 |
| r2375 | r2376 | |
|---|---|---|
| 189 | 189 | /* mostly not noticed since sound is */ |
| 190 | 190 | /* only enabled if game in progress! */ |
| 191 | 191 | |
| 192 | if ((input_port_ | |
| 192 | if ((input_port_ | |
| 193 | 193 | panic_sound_output_w(machine,17,1); |
| 194 | 194 | |
| 195 | 195 | cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xcf); /* RST 08h */ |
| r2375 | r2376 | |
| 204 | 204 | |
| 205 | 205 | if (pixel_clock == 0) |
| 206 | 206 | { |
| 207 | if ( | |
| 207 | if ( | |
| 208 | 208 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 209 | 209 | } |
| 210 | 210 | } |
| r2375 | r2376 | |
| 218 | 218 | It makes sense and works fine, but I cannot be 100% sure this is correct, |
| 219 | 219 | as I have no Cosmic Guerilla console :-) . */ |
| 220 | 220 | |
| 221 | if (( | |
| 221 | if (( | |
| 222 | 222 | /* on tms9980, a 6 on the interrupt bus means level 4 interrupt */ |
| 223 | 223 | cpunum_set_input_line_and_vector(machine, 0, 0, ASSERT_LINE, 6); |
| 224 | 224 | else |
| r2375 | r2376 | |
| 228 | 228 | static INTERRUPT_GEN( magspot_interrupt ) |
| 229 | 229 | { |
| 230 | 230 | /* Coin 1 causes an IRQ, Coin 2 an NMI */ |
| 231 | if (input_port_ | |
| 231 | if (input_port_ | |
| 232 | 232 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 233 | else if (input_port_ | |
| 233 | else if (input_port_ | |
| 234 | 234 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | static INTERRUPT_GEN( nomnlnd_interrupt ) |
| 238 | 238 | { |
| 239 | 239 | /* Coin causes an NMI */ |
| 240 | if (input_port_ | |
| 240 | if (input_port_ | |
| 241 | 241 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 242 | 242 | } |
| 243 | 243 | |
| r2375 | r2376 | |
| 252 | 252 | { |
| 253 | 253 | /* The top four address lines from the CRTC are bits 0-3 */ |
| 254 | 254 | |
| 255 | return (input_port_ | |
| 255 | return (input_port_ | |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | static READ8_HANDLER( magspot_coinage_dip_r ) |
| 259 | 259 | { |
| 260 | return (input_port_ | |
| 260 | return (input_port_ | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | |
| r2375 | r2376 | |
| 266 | 266 | static READ8_HANDLER( nomnlnd_port_0_1_r ) |
| 267 | 267 | { |
| 268 | 268 | int control; |
| 269 | int fire = input_port_ | |
| 269 | int fire = input_port_ | |
| 270 | 270 | |
| 271 | 271 | if (offset) |
| 272 | control = input_port_ | |
| 272 | control = input_port_ | |
| 273 | 273 | else |
| 274 | control = input_port_ | |
| 274 | control = input_port_ | |
| 275 | 275 | |
| 276 | 276 | /* If firing - stop tank */ |
| 277 | 277 |
| r2375 | r2376 | |
|---|---|---|
| 433 | 433 | |
| 434 | 434 | static READ32_HANDLER(ctrl0_r) |
| 435 | 435 | { |
| 436 | UINT32 ret = | |
| 436 | UINT32 ret = | |
| 437 | 437 | ret <<= 16; |
| 438 | 438 | if(model2_ctrlmode==0) |
| 439 | 439 | { |
| r2375 | r2376 | |
| 447 | 447 | } |
| 448 | 448 | static READ32_HANDLER(ctrl1_r) |
| 449 | 449 | { |
| 450 | return | |
| 450 | return | |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | static READ32_HANDLER(ctrl10_r) |
| 454 | 454 | { |
| 455 | return | |
| 455 | return | |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | static READ32_HANDLER(ctrl14_r) |
| 459 | 459 | { |
| 460 | return | |
| 460 | return | |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | static READ32_HANDLER(analog_r) |
| 464 | 464 | { |
| 465 | 465 | if (offset) |
| 466 | return | |
| 466 | return | |
| 467 | 467 | |
| 468 | return | |
| 468 | return | |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | static READ32_HANDLER(fifoctl_r) |
| r2375 | r2376 | |
|---|---|---|
| 225 | 225 | |
| 226 | 226 | static READ8_HANDLER(via_b_in) |
| 227 | 227 | { |
| 228 | return input_port_ | |
| 228 | return input_port_ | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | |
| r2375 | r2376 | |
| 447 | 447 | { |
| 448 | 448 | switch(bmc_input) |
| 449 | 449 | { |
| 450 | case 0x00: return input_port_1_r(machine,0); | |
| 451 | case 0x40: return input_port_2_r(machine,0); | |
| 450 | case 0x00: return input_port_read_indexed(machine, 1); | |
| 451 | case 0x40: return input_port_read_indexed(machine, 2); | |
| 452 | 452 | } |
| 453 | 453 | logerror("unknown input - %X (PC=%X)\n",bmc_input,activecpu_get_previouspc()); |
| 454 | 454 | return 0xff; |
| r2375 | r2376 | |
|---|---|---|
| 99 | 99 | switch (offset) |
| 100 | 100 | { |
| 101 | 101 | case 0x050 >> 1: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 102 | return ( | |
| 102 | return ( | |
| 103 | 103 | case 0x76a >> 1: /* Credits */ |
| 104 | return | |
| 104 | return | |
| 105 | 105 | case 0x0ac >> 1: /* DIPS */ |
| 106 | return ( | |
| 106 | return ( | |
| 107 | 107 | |
| 108 | 108 | // Protection TODO |
| 109 | 109 | } |
| r2375 | r2376 | |
| 117 | 117 | switch (offset) |
| 118 | 118 | { |
| 119 | 119 | case 0x050 >> 1: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 120 | return ( | |
| 120 | return ( | |
| 121 | 121 | case 0x76a >> 1: /* Credits */ |
| 122 | return | |
| 122 | return | |
| 123 | 123 | case 0x0ac >> 1: /* DIPS */ |
| 124 | return ( | |
| 124 | return ( | |
| 125 | 125 | } |
| 126 | 126 | return sshangha_prot_data[offset]; |
| 127 | 127 | } |
| r2375 | r2376 | |
|---|---|---|
| 79 | 79 | |
| 80 | 80 | res = 0; |
| 81 | 81 | for (i = 0;i < 8;i++) |
| 82 | res |= (( | |
| 82 | res |= (( | |
| 83 | 83 | |
| 84 | 84 | return res; |
| 85 | 85 | } |
| r2375 | r2376 | |
|---|---|---|
| 286 | 286 | static READ8_HANDLER( lazercmd_data_port_r ) |
| 287 | 287 | { |
| 288 | 288 | int data; |
| 289 | data = input_port_ | |
| 289 | data = input_port_ | |
| 290 | 290 | return data; |
| 291 | 291 | } |
| 292 | 292 | |
| r2375 | r2376 | |
| 381 | 381 | switch (offset) |
| 382 | 382 | { |
| 383 | 383 | case 0: /* player 1 joysticks */ |
| 384 | data = input_port_ | |
| 384 | data = input_port_ | |
| 385 | 385 | break; |
| 386 | 386 | case 1: /* player 2 joysticks */ |
| 387 | data = input_port_ | |
| 387 | data = input_port_ | |
| 388 | 388 | break; |
| 389 | 389 | case 2: /* player 1 + 2 buttons */ |
| 390 | data = input_port_ | |
| 390 | data = input_port_ | |
| 391 | 391 | break; |
| 392 | 392 | case 3: /* coin slot + start buttons */ |
| 393 | data = input_port_ | |
| 393 | data = input_port_ | |
| 394 | 394 | break; |
| 395 | 395 | case 4: /* vertical scan counter */ |
| 396 | 396 | data = ((timer_count&0x10)>>1)|((timer_count&0x20)>>3)|((timer_count&0x40)>>5)|((timer_count&0x80)>>7); |
| r2375 | r2376 | |
|---|---|---|
| 61 | 61 | |
| 62 | 62 | static READ8_HANDLER( p1c_r ) |
| 63 | 63 | { |
| 64 | return (s2 << 7) | (s4 << 6) | (( | |
| 64 | return (s2 << 7) | (s4 << 6) | (( | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | static WRITE8_HANDLER( p1a_w ) |
| r2375 | r2376 | |
|---|---|---|
| 67 | 67 | { |
| 68 | 68 | cpunum_resume(0, SUSPEND_ANY_REASON); |
| 69 | 69 | |
| 70 | if ((input_port_ | |
| 70 | if ((input_port_ | |
| 71 | 71 | { |
| 72 | 72 | just_been_reset = 1; |
| 73 | 73 | cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, PULSE_LINE); |
| r2375 | r2376 | |
| 78 | 78 | { |
| 79 | 79 | /* coin latch is bit 7 */ |
| 80 | 80 | |
| 81 | UINT8 temp = (input_port_ | |
| 81 | UINT8 temp = (input_port_ | |
| 82 | 82 | return (coin_latch<<7) | (temp); |
| 83 | 83 | } |
| 84 | 84 |
| r2375 | r2376 | |
|---|---|---|
| 848 | 848 | static READ16_HANDLER( joy_or_paddle_r ) |
| 849 | 849 | { |
| 850 | 850 | if (readpaddle != 0) |
| 851 | return ( | |
| 851 | return ( | |
| 852 | 852 | else |
| 853 | return ( | |
| 853 | return ( | |
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | |
| r2375 | r2376 | |
| 1289 | 1289 | ROM_LOAD16_WORD_SWAP( "nff.04", 0x080000, 0x80000, CRC(dba1c66e) SHA1(4764e77d4da5d19d9acded27df1e1bcba06b0fcf) ) |
| 1290 | 1290 | ROM_LOAD16_WORD_SWAP( "nffu.05", 0x100000, 0x80000, CRC(ea813eb7) SHA1(34e0175a5f22d08c3538369b4bfd077a7427a128) ) |
| 1291 | 1291 | |
| 1292 | ROM_REGION( 0x | |
| 1292 | ROM_REGION( 0x1400000, REGION_GFX1, 0 ) | |
| 1293 | 1293 | ROMX_LOAD( "nff.13m", 0x0000000, 0x400000, CRC(c9fca741) SHA1(1781d4fc18b6d6f79b7b39d9bcace750fb61a5cf) , ROM_GROUPWORD | ROM_SKIP(6) ) |
| 1294 | 1294 | ROMX_LOAD( "nff.15m", 0x0000002, 0x400000, CRC(f809d898) SHA1(a0b6af49e1780678d808c317b875161cedddb314) , ROM_GROUPWORD | ROM_SKIP(6) ) |
| 1295 | 1295 | ROMX_LOAD( "nff.17m", 0x0000004, 0x400000, CRC(15ba4507) SHA1(bed6a82bf1dc1aa501d4c2d098115a15e18d446a) , ROM_GROUPWORD | ROM_SKIP(6) ) |
| r2375 | r2376 | |
| 1314 | 1314 | ROM_LOAD16_WORD_SWAP( "nff.04", 0x080000, 0x80000, CRC(dba1c66e) SHA1(4764e77d4da5d19d9acded27df1e1bcba06b0fcf) ) |
| 1315 | 1315 | ROM_LOAD16_WORD_SWAP( "nffj.05", 0x100000, 0x80000, CRC(7f20c2ef) SHA1(380dc54d94c29c049a4c00ed58013e04eec87086) ) |
| 1316 | 1316 | |
| 1317 | ROM_REGION( 0x | |
| 1317 | ROM_REGION( 0x1400000, REGION_GFX1, 0 ) | |
| 1318 | 1318 | ROMX_LOAD( "nff.13m", 0x0000000, 0x400000, CRC(c9fca741) SHA1(1781d4fc18b6d6f79b7b39d9bcace750fb61a5cf) , ROM_GROUPWORD | ROM_SKIP(6) ) |
| 1319 | 1319 | ROMX_LOAD( "nff.15m", 0x0000002, 0x400000, CRC(f809d898) SHA1(a0b6af49e1780678d808c317b875161cedddb314) , ROM_GROUPWORD | ROM_SKIP(6) ) |
| 1320 | 1320 | ROMX_LOAD( "nff.17m", 0x0000004, 0x400000, CRC(15ba4507) SHA1(bed6a82bf1dc1aa501d4c2d098115a15e18d446a) , ROM_GROUPWORD | ROM_SKIP(6) ) |
| r2375 | r2376 | |
| 1926 | 1926 | |
| 1927 | 1927 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 1928 | 1928 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 1929 | ROMX_LOAD( "csc.14m", 0x800000, 0x200000, CRC(e8904afa) SHA1(39713ffca4e3a754c7c44c0ef4d99fb5a77d8da7) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 73 to 76 joined in all eprom version */ | |
| 1930 | ROMX_LOAD( "csc.16m", 0x800002, 0x200000, CRC(c98c8079) SHA1(22d68ba2ef62b51981bb3e99ec2cde8d1b36514b) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 63 to 66 joined in all eprom version */ | |
| 1931 | ROMX_LOAD( "csc.18m", 0x800004, 0x200000, CRC(c030df5a) SHA1(6d5e5a05531e168d0d44c591f9185ae300908fc2) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 83 to 86 joined in all eprom version */ | |
| 1932 | ROMX_LOAD( "csc.20m", 0x800006, 0x200000, CRC(b4e55863) SHA1(da66f0a36266b906e4c149aec152c323bb184c57) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 93 to 96 joined in all eprom version */ | |
| 1929 | ROMX_LOAD( "csc.14m", 0x800000, 0x200000, CRC(e8904afa) SHA1(39713ffca4e3a754c7c44c0ef4d99fb5a77d8da7) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 73 to 76 joined in all eprom version */ | |
| 1930 | ROMX_LOAD( "csc.16m", 0x800002, 0x200000, CRC(c98c8079) SHA1(22d68ba2ef62b51981bb3e99ec2cde8d1b36514b) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 63 to 66 joined in all eprom version */ | |
| 1931 | ROMX_LOAD( "csc.18m", 0x800004, 0x200000, CRC(c030df5a) SHA1(6d5e5a05531e168d0d44c591f9185ae300908fc2) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 83 to 86 joined in all eprom version */ | |
| 1932 | ROMX_LOAD( "csc.20m", 0x800006, 0x200000, CRC(b4e55863) SHA1(da66f0a36266b906e4c149aec152c323bb184c57) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 93 to 96 joined in all eprom version */ | |
| 1933 | 1933 | |
| 1934 | 1934 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 1935 | 1935 | ROM_LOAD( "csc.01", 0x00000, 0x08000, CRC(ee162111) SHA1(ce8d4bd32bb10ee8b0274ba6fcef05a583b39d48) ) |
| r2375 | r2376 | |
| 1950 | 1950 | |
| 1951 | 1951 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 1952 | 1952 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 1953 | ROMX_LOAD( "csc.14m", 0x800000, 0x200000, CRC(e8904afa) SHA1(39713ffca4e3a754c7c44c0ef4d99fb5a77d8da7) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1954 | ROMX_LOAD( "csc.16m", 0x800002, 0x200000, CRC(c98c8079) SHA1(22d68ba2ef62b51981bb3e99ec2cde8d1b36514b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1955 | ROMX_LOAD( "csc.18m", 0x800004, 0x200000, CRC(c030df5a) SHA1(6d5e5a05531e168d0d44c591f9185ae300908fc2) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1956 | ROMX_LOAD( "csc.20m", 0x800006, 0x200000, CRC(b4e55863) SHA1(da66f0a36266b906e4c149aec152c323bb184c57) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1953 | ROMX_LOAD( "csc.14m", 0x800000, 0x200000, CRC(e8904afa) SHA1(39713ffca4e3a754c7c44c0ef4d99fb5a77d8da7) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1954 | ROMX_LOAD( "csc.16m", 0x800002, 0x200000, CRC(c98c8079) SHA1(22d68ba2ef62b51981bb3e99ec2cde8d1b36514b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1955 | ROMX_LOAD( "csc.18m", 0x800004, 0x200000, CRC(c030df5a) SHA1(6d5e5a05531e168d0d44c591f9185ae300908fc2) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1956 | ROMX_LOAD( "csc.20m", 0x800006, 0x200000, CRC(b4e55863) SHA1(da66f0a36266b906e4c149aec152c323bb184c57) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1957 | 1957 | |
| 1958 | 1958 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 1959 | 1959 | ROM_LOAD( "csc.01", 0x00000, 0x08000, CRC(ee162111) SHA1(ce8d4bd32bb10ee8b0274ba6fcef05a583b39d48) ) |
| r2375 | r2376 | |
| 1974 | 1974 | |
| 1975 | 1975 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 1976 | 1976 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 1977 | ROMX_LOAD( "csc.14m", 0x800000, 0x200000, CRC(e8904afa) SHA1(39713ffca4e3a754c7c44c0ef4d99fb5a77d8da7) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1978 | ROMX_LOAD( "csc.16m", 0x800002, 0x200000, CRC(c98c8079) SHA1(22d68ba2ef62b51981bb3e99ec2cde8d1b36514b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1979 | ROMX_LOAD( "csc.18m", 0x800004, 0x200000, CRC(c030df5a) SHA1(6d5e5a05531e168d0d44c591f9185ae300908fc2) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1980 | ROMX_LOAD( "csc.20m", 0x800006, 0x200000, CRC(b4e55863) SHA1(da66f0a36266b906e4c149aec152c323bb184c57) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1977 | ROMX_LOAD( "csc.14m", 0x800000, 0x200000, CRC(e8904afa) SHA1(39713ffca4e3a754c7c44c0ef4d99fb5a77d8da7) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1978 | ROMX_LOAD( "csc.16m", 0x800002, 0x200000, CRC(c98c8079) SHA1(22d68ba2ef62b51981bb3e99ec2cde8d1b36514b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1979 | ROMX_LOAD( "csc.18m", 0x800004, 0x200000, CRC(c030df5a) SHA1(6d5e5a05531e168d0d44c591f9185ae300908fc2) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1980 | ROMX_LOAD( "csc.20m", 0x800006, 0x200000, CRC(b4e55863) SHA1(da66f0a36266b906e4c149aec152c323bb184c57) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 1981 | 1981 | |
| 1982 | 1982 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 1983 | 1983 | ROM_LOAD( "csc.01", 0x00000, 0x08000, CRC(ee162111) SHA1(ce8d4bd32bb10ee8b0274ba6fcef05a583b39d48) ) |
| r2375 | r2376 | |
| 1998 | 1998 | |
| 1999 | 1999 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 2000 | 2000 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 2001 | ROMX_LOAD( "csc.14m", 0x800000, 0x200000, CRC(e8904afa) SHA1(39713ffca4e3a754c7c44c0ef4d99fb5a77d8da7) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 73 to 76 joined in all eprom version */ | |
| 2002 | ROMX_LOAD( "csc.16m", 0x800002, 0x200000, CRC(c98c8079) SHA1(22d68ba2ef62b51981bb3e99ec2cde8d1b36514b) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 63 to 66 joined in all eprom version */ | |
| 2003 | ROMX_LOAD( "csc.18m", 0x800004, 0x200000, CRC(c030df5a) SHA1(6d5e5a05531e168d0d44c591f9185ae300908fc2) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 83 to 86 joined in all eprom version */ | |
| 2004 | ROMX_LOAD( "csc.20m", 0x800006, 0x200000, CRC(b4e55863) SHA1(da66f0a36266b906e4c149aec152c323bb184c57) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 93 to 96 joined in all eprom version */ | |
| 2001 | ROMX_LOAD( "csc.14m", 0x800000, 0x200000, CRC(e8904afa) SHA1(39713ffca4e3a754c7c44c0ef4d99fb5a77d8da7) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 73 to 76 joined in all eprom version */ | |
| 2002 | ROMX_LOAD( "csc.16m", 0x800002, 0x200000, CRC(c98c8079) SHA1(22d68ba2ef62b51981bb3e99ec2cde8d1b36514b) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 63 to 66 joined in all eprom version */ | |
| 2003 | ROMX_LOAD( "csc.18m", 0x800004, 0x200000, CRC(c030df5a) SHA1(6d5e5a05531e168d0d44c591f9185ae300908fc2) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 83 to 86 joined in all eprom version */ | |
| 2004 | ROMX_LOAD( "csc.20m", 0x800006, 0x200000, CRC(b4e55863) SHA1(da66f0a36266b906e4c149aec152c323bb184c57) , ROM_GROUPWORD | ROM_SKIP(6) ) /* roms 93 to 96 joined in all eprom version */ | |
| 2005 | 2005 | |
| 2006 | 2006 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 2007 | 2007 | ROM_LOAD( "csc.01", 0x00000, 0x08000, CRC(ee162111) SHA1(ce8d4bd32bb10ee8b0274ba6fcef05a583b39d48) ) |
| r2375 | r2376 | |
| 3222 | 3222 | |
| 3223 | 3223 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 3224 | 3224 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 3225 | ROMX_LOAD( "rm2.14m", 0x800000, 0x200000, CRC(9b1f00b4) SHA1(c1c5c2d9d00121425ae6598444d704f420ef4eef) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3226 | ROMX_LOAD( "rm2.16m", 0x800002, 0x200000, CRC(c2bb0c24) SHA1(38724c49d9db49765a4ed9bc2dc8f57cec45ec7c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3227 | ROMX_LOAD( "rm2.18m", 0x800004, 0x200000, CRC(12257251) SHA1(20cb58afda0e6200991277817485340a6a41ae2b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3228 | ROMX_LOAD( "rm2.20m", 0x800006, 0x200000, CRC(f9b6e786) SHA1(aeb4acff7208e66a35198143fd2478039fdaa3a6) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3225 | ROMX_LOAD( "rm2.14m", 0x800000, 0x200000, CRC(9b1f00b4) SHA1(c1c5c2d9d00121425ae6598444d704f420ef4eef) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3226 | ROMX_LOAD( "rm2.16m", 0x800002, 0x200000, CRC(c2bb0c24) SHA1(38724c49d9db49765a4ed9bc2dc8f57cec45ec7c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3227 | ROMX_LOAD( "rm2.18m", 0x800004, 0x200000, CRC(12257251) SHA1(20cb58afda0e6200991277817485340a6a41ae2b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3228 | ROMX_LOAD( "rm2.20m", 0x800006, 0x200000, CRC(f9b6e786) SHA1(aeb4acff7208e66a35198143fd2478039fdaa3a6) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3229 | 3229 | |
| 3230 | 3230 | ROM_REGION(QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 3231 | 3231 | ROM_LOAD( "rm2.01a", 0x00000, 0x08000, CRC(d18e7859) SHA1(0939fac70042d0b4db5c2fdcef1f79b95febd45e) ) |
| r2375 | r2376 | |
| 3245 | 3245 | |
| 3246 | 3246 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 3247 | 3247 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 3248 | ROMX_LOAD( "rm2.14m", 0x800000, 0x200000, CRC(9b1f00b4) SHA1(c1c5c2d9d00121425ae6598444d704f420ef4eef) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3249 | ROMX_LOAD( "rm2.16m", 0x800002, 0x200000, CRC(c2bb0c24) SHA1(38724c49d9db49765a4ed9bc2dc8f57cec45ec7c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3250 | ROMX_LOAD( "rm2.18m", 0x800004, 0x200000, CRC(12257251) SHA1(20cb58afda0e6200991277817485340a6a41ae2b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3251 | ROMX_LOAD( "rm2.20m", 0x800006, 0x200000, CRC(f9b6e786) SHA1(aeb4acff7208e66a35198143fd2478039fdaa3a6) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3248 | ROMX_LOAD( "rm2.14m", 0x800000, 0x200000, CRC(9b1f00b4) SHA1(c1c5c2d9d00121425ae6598444d704f420ef4eef) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3249 | ROMX_LOAD( "rm2.16m", 0x800002, 0x200000, CRC(c2bb0c24) SHA1(38724c49d9db49765a4ed9bc2dc8f57cec45ec7c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3250 | ROMX_LOAD( "rm2.18m", 0x800004, 0x200000, CRC(12257251) SHA1(20cb58afda0e6200991277817485340a6a41ae2b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3251 | ROMX_LOAD( "rm2.20m", 0x800006, 0x200000, CRC(f9b6e786) SHA1(aeb4acff7208e66a35198143fd2478039fdaa3a6) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3252 | 3252 | |
| 3253 | 3253 | ROM_REGION(QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 3254 | 3254 | ROM_LOAD( "rm2.01a", 0x00000, 0x08000, CRC(d18e7859) SHA1(0939fac70042d0b4db5c2fdcef1f79b95febd45e) ) |
| r2375 | r2376 | |
| 3268 | 3268 | |
| 3269 | 3269 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 3270 | 3270 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 3271 | ROMX_LOAD( "rm2.14m", 0x800000, 0x200000, CRC(9b1f00b4) SHA1(c1c5c2d9d00121425ae6598444d704f420ef4eef) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3272 | ROMX_LOAD( "rm2.16m", 0x800002, 0x200000, CRC(c2bb0c24) SHA1(38724c49d9db49765a4ed9bc2dc8f57cec45ec7c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3273 | ROMX_LOAD( "rm2.18m", 0x800004, 0x200000, CRC(12257251) SHA1(20cb58afda0e6200991277817485340a6a41ae2b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3274 | ROMX_LOAD( "rm2.20m", 0x800006, 0x200000, CRC(f9b6e786) SHA1(aeb4acff7208e66a35198143fd2478039fdaa3a6) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3271 | ROMX_LOAD( "rm2.14m", 0x800000, 0x200000, CRC(9b1f00b4) SHA1(c1c5c2d9d00121425ae6598444d704f420ef4eef) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3272 | ROMX_LOAD( "rm2.16m", 0x800002, 0x200000, CRC(c2bb0c24) SHA1(38724c49d9db49765a4ed9bc2dc8f57cec45ec7c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3273 | ROMX_LOAD( "rm2.18m", 0x800004, 0x200000, CRC(12257251) SHA1(20cb58afda0e6200991277817485340a6a41ae2b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3274 | ROMX_LOAD( "rm2.20m", 0x800006, 0x200000, CRC(f9b6e786) SHA1(aeb4acff7208e66a35198143fd2478039fdaa3a6) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 3275 | 3275 | |
| 3276 | 3276 | ROM_REGION(QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 3277 | 3277 | ROM_LOAD( "rm2.01a", 0x00000, 0x08000, CRC(d18e7859) SHA1(0939fac70042d0b4db5c2fdcef1f79b95febd45e) ) |
| r2375 | r2376 | |
| 4144 | 4144 | ROM_LOAD16_WORD_SWAP( "mpn.03", 0x000000, 0x80000, CRC(6e7ed03c) SHA1(3562362d9573252d4d19dbfd0ec7e47e9eaa5f46) ) /* USA version, but has no "u" in label code */ |
| 4145 | 4145 | ROM_LOAD16_WORD_SWAP( "mpn.04", 0x080000, 0x80000, CRC(de079131) SHA1(95da2a03cb642963aabfebd8337003961ca4db71) ) |
| 4146 | 4146 | |
| 4147 | ROM_REGION( 0x0800000, REGION_GFX1, 0 ) | |
| 4148 | ROMX_LOAD( "mpn.13m", 0x0000000, 0x200000, CRC(c5f123dc) SHA1(e459571416ab64f0280cda7dfa0d8836faa745c9) , ROM_GROUPWORD | ROM_SKIP(6) ) /* This version uses roms chips */ | |
| 4149 | ROMX_LOAD( "mpn.15m", 0x0000002, 0x200000, CRC(8e033265) SHA1(d05ca8fb825423ff6b099c06aaa500c0a947454a) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4150 | ROMX_LOAD( "mpn.17m", 0x0000004, 0x200000, CRC(cfcd73d2) SHA1(3415c063ac3632159df0fa74899bde8c90f4a2a1) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4151 | ROMX_LOAD( "mpn.19m", 0x0000006, 0x200000, CRC(2db1ffbc) SHA1(ca58c9359c2c629896c40e78c14907f562e2cdad) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4147 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) | |
| 4148 | ROM_FILL( 0x000000, 0x800000, 0 ) | |
| 4149 | ROMX_LOAD( "mpn.13m", 0x800000, 0x200000, CRC(c5f123dc) SHA1(e459571416ab64f0280cda7dfa0d8836faa745c9) , ROM_GROUPWORD | ROM_SKIP(6) ) /* This version uses roms chips */ | |
| 4150 | ROMX_LOAD( "mpn.15m", 0x800002, 0x200000, CRC(8e033265) SHA1(d05ca8fb825423ff6b099c06aaa500c0a947454a) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4151 | ROMX_LOAD( "mpn.17m", 0x800004, 0x200000, CRC(cfcd73d2) SHA1(3415c063ac3632159df0fa74899bde8c90f4a2a1) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4152 | ROMX_LOAD( "mpn.19m", 0x800006, 0x200000, CRC(2db1ffbc) SHA1(ca58c9359c2c629896c40e78c14907f562e2cdad) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4152 | 4153 | |
| 4153 | 4154 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4154 | 4155 | ROM_LOAD( "mpn.01", 0x00000, 0x08000, CRC(90c7adb6) SHA1(a2653e977e5e0457b249e098e5ca0abc93dac336) ) |
| r2375 | r2376 | |
| 4541 | 4542 | |
| 4542 | 4543 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4543 | 4544 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4544 | ROMX_LOAD( "tqz.14m", 0x800000, 0x200000, CRC(98af88a2) SHA1(d3620faf2162a1f3a62a238715da4da429376d3c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4545 | ROMX_LOAD( "tqz.16m", 0x800002, 0x200000, CRC(df82d491) SHA1(fd3c8303cbcacb132a90398ff61f47d2d68157ae) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4546 | ROMX_LOAD( "tqz.18m", 0x800004, 0x200000, CRC(42f132ff) SHA1(0e0a128524010dba033a9b9ab2c56fe92a1767da) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4547 | ROMX_LOAD( "tqz.20m", 0x800006, 0x200000, CRC(b2e128a3) SHA1(8ae3161749d5206f16b755c29466cd5ca249b665) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4545 | ROMX_LOAD( "tqz.14m", 0x800000, 0x200000, CRC(98af88a2) SHA1(d3620faf2162a1f3a62a238715da4da429376d3c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4546 | ROMX_LOAD( "tqz.16m", 0x800002, 0x200000, CRC(df82d491) SHA1(fd3c8303cbcacb132a90398ff61f47d2d68157ae) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4547 | ROMX_LOAD( "tqz.18m", 0x800004, 0x200000, CRC(42f132ff) SHA1(0e0a128524010dba033a9b9ab2c56fe92a1767da) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4548 | ROMX_LOAD( "tqz.20m", 0x800006, 0x200000, CRC(b2e128a3) SHA1(8ae3161749d5206f16b755c29466cd5ca249b665) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4548 | 4549 | |
| 4549 | 4550 | ROM_REGION(QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4550 | 4551 | ROM_LOAD( "tqz.01", 0x00000, 0x08000, CRC(e9ce9d0a) SHA1(29f2987788e914e0a55f9130a99e411d15a7cc9b) ) |
| r2375 | r2376 | |
| 4662 | 4663 | |
| 4663 | 4664 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4664 | 4665 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4665 | ROMX_LOAD( "rcm.73", 0x800000, 0x80000, CRC(774c6e04) SHA1(6bd14960218e31d5a043b20a1b9d2d69cace761e) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4666 | ROMX_LOAD( "rcm.63", 0x800002, 0x80000, CRC(acad7c62) SHA1(eec10990339c9fd8fdae896a5fd98d5bf0220ed1) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4667 | ROMX_LOAD( "rcm.83", 0x800004, 0x80000, CRC(6af30499) SHA1(a97bf2f382b6edc1e920e18d8ad5ca18131a2f21) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4668 | ROMX_LOAD( "rcm.93", 0x800006, 0x80000, CRC(7a5a5166) SHA1(2160015e2e43e2c024a3af56da961ac02ffc74e9) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4669 | ROMX_LOAD( "rcm.74", 0xa00000, 0x80000, CRC(004ec725) SHA1(b1d3bcf920b0a1d0f4b59c77f5962e8162bbef65) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4670 | ROMX_LOAD( "rcm.64", 0xa00002, 0x80000, CRC(65c0464e) SHA1(4a035f4d28fc8aa72bfe0a06392b93b0abfba458) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4671 | ROMX_LOAD( "rcm.84", 0xa00004, 0x80000, CRC(fb3097cc) SHA1(7bff2372809cdfa4dcd8537a448b177c0e86a94e) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4672 | ROMX_LOAD( "rcm.94", 0xa00006, 0x80000, CRC(2e16557a) SHA1(f4a916c1524a8de23fc6afabc8c724a89530c631) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4673 | ROMX_LOAD( "rcm.75", 0xc00000, 0x80000, CRC(70a73f99) SHA1(6dd126b4e64e34d5911ed5877b1b94b503404249) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4674 | ROMX_LOAD( "rcm.65", 0xc00002, 0x80000, CRC(ecedad3d) SHA1(dea1377f086ea3a45ced983e258beb6607b295c9) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4675 | ROMX_LOAD( "rcm.85", 0xc00004, 0x80000, CRC(3d6186d8) SHA1(70f1ff678dd1ec533360458a564953fc5634cbc5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4676 | ROMX_LOAD( "rcm.95", 0xc00006, 0x80000, CRC(8c7700f1) SHA1(84846af535e9e333e911486d545988568554b67b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4677 | ROMX_LOAD( "rcm.76", 0xe00000, 0x80000, CRC(89a889ad) SHA1(1ffe112051a3afc94df1326f17ef58dc2fc531aa) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4678 | ROMX_LOAD( "rcm.66", 0xe00002, 0x80000, CRC(1300eb7b) SHA1(db4f53b1cf521df99d073dcf0bfafe7b113e95d5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4679 | ROMX_LOAD( "rcm.86", 0xe00004, 0x80000, CRC(6d974ebd) SHA1(41de66481a64fa8a6471c512fc5dcaf96d95ee69) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4680 | ROMX_LOAD( "rcm.96", 0xe00006, 0x80000, CRC(7da4cd24) SHA1(dd44377ff9f83f15cac032c4e7ef2071adcfa196) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4666 | ROMX_LOAD( "rcm.73", 0x800000, 0x080000, CRC(774c6e04) SHA1(6bd14960218e31d5a043b20a1b9d2d69cace761e) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4667 | ROMX_LOAD( "rcm.63", 0x800002, 0x080000, CRC(acad7c62) SHA1(eec10990339c9fd8fdae896a5fd98d5bf0220ed1) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4668 | ROMX_LOAD( "rcm.83", 0x800004, 0x080000, CRC(6af30499) SHA1(a97bf2f382b6edc1e920e18d8ad5ca18131a2f21) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4669 | ROMX_LOAD( "rcm.93", 0x800006, 0x080000, CRC(7a5a5166) SHA1(2160015e2e43e2c024a3af56da961ac02ffc74e9) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4670 | ROMX_LOAD( "rcm.74", 0xa00000, 0x080000, CRC(004ec725) SHA1(b1d3bcf920b0a1d0f4b59c77f5962e8162bbef65) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4671 | ROMX_LOAD( "rcm.64", 0xa00002, 0x080000, CRC(65c0464e) SHA1(4a035f4d28fc8aa72bfe0a06392b93b0abfba458) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4672 | ROMX_LOAD( "rcm.84", 0xa00004, 0x080000, CRC(fb3097cc) SHA1(7bff2372809cdfa4dcd8537a448b177c0e86a94e) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4673 | ROMX_LOAD( "rcm.94", 0xa00006, 0x080000, CRC(2e16557a) SHA1(f4a916c1524a8de23fc6afabc8c724a89530c631) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4674 | ROMX_LOAD( "rcm.75", 0xc00000, 0x080000, CRC(70a73f99) SHA1(6dd126b4e64e34d5911ed5877b1b94b503404249) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4675 | ROMX_LOAD( "rcm.65", 0xc00002, 0x080000, CRC(ecedad3d) SHA1(dea1377f086ea3a45ced983e258beb6607b295c9) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4676 | ROMX_LOAD( "rcm.85", 0xc00004, 0x080000, CRC(3d6186d8) SHA1(70f1ff678dd1ec533360458a564953fc5634cbc5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4677 | ROMX_LOAD( "rcm.95", 0xc00006, 0x080000, CRC(8c7700f1) SHA1(84846af535e9e333e911486d545988568554b67b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4678 | ROMX_LOAD( "rcm.76", 0xe00000, 0x080000, CRC(89a889ad) SHA1(1ffe112051a3afc94df1326f17ef58dc2fc531aa) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4679 | ROMX_LOAD( "rcm.66", 0xe00002, 0x080000, CRC(1300eb7b) SHA1(db4f53b1cf521df99d073dcf0bfafe7b113e95d5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4680 | ROMX_LOAD( "rcm.86", 0xe00004, 0x080000, CRC(6d974ebd) SHA1(41de66481a64fa8a6471c512fc5dcaf96d95ee69) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4681 | ROMX_LOAD( "rcm.96", 0xe00006, 0x080000, CRC(7da4cd24) SHA1(dd44377ff9f83f15cac032c4e7ef2071adcfa196) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4681 | 4682 | |
| 4682 | 4683 | ROM_REGION(QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4683 | 4684 | ROM_LOAD( "rcm.01", 0x00000, 0x08000, CRC(d60cf8a3) SHA1(dccd84b93e62489c703011422d0fe84444c7f7db) ) |
| r2375 | r2376 | |
| 4702 | 4703 | |
| 4703 | 4704 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4704 | 4705 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4705 | ROMX_LOAD( "rcm.73", 0x800000, 0x80000, CRC(774c6e04) SHA1(6bd14960218e31d5a043b20a1b9d2d69cace761e) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4706 | ROMX_LOAD( "rcm.63", 0x800002, 0x80000, CRC(acad7c62) SHA1(eec10990339c9fd8fdae896a5fd98d5bf0220ed1) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4707 | ROMX_LOAD( "rcm.83", 0x800004, 0x80000, CRC(6af30499) SHA1(a97bf2f382b6edc1e920e18d8ad5ca18131a2f21) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4708 | ROMX_LOAD( "rcm.93", 0x800006, 0x80000, CRC(7a5a5166) SHA1(2160015e2e43e2c024a3af56da961ac02ffc74e9) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4709 | ROMX_LOAD( "rcm.74", 0xa00000, 0x80000, CRC(004ec725) SHA1(b1d3bcf920b0a1d0f4b59c77f5962e8162bbef65) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4710 | ROMX_LOAD( "rcm.64", 0xa00002, 0x80000, CRC(65c0464e) SHA1(4a035f4d28fc8aa72bfe0a06392b93b0abfba458) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4711 | ROMX_LOAD( "rcm.84", 0xa00004, 0x80000, CRC(fb3097cc) SHA1(7bff2372809cdfa4dcd8537a448b177c0e86a94e) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4712 | ROMX_LOAD( "rcm.94", 0xa00006, 0x80000, CRC(2e16557a) SHA1(f4a916c1524a8de23fc6afabc8c724a89530c631) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4713 | ROMX_LOAD( "rcm.75", 0xc00000, 0x80000, CRC(70a73f99) SHA1(6dd126b4e64e34d5911ed5877b1b94b503404249) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4714 | ROMX_LOAD( "rcm.65", 0xc00002, 0x80000, CRC(ecedad3d) SHA1(dea1377f086ea3a45ced983e258beb6607b295c9) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4715 | ROMX_LOAD( "rcm.85", 0xc00004, 0x80000, CRC(3d6186d8) SHA1(70f1ff678dd1ec533360458a564953fc5634cbc5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4716 | ROMX_LOAD( "rcm.95", 0xc00006, 0x80000, CRC(8c7700f1) SHA1(84846af535e9e333e911486d545988568554b67b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4717 | ROMX_LOAD( "rcm.76", 0xe00000, 0x80000, CRC(89a889ad) SHA1(1ffe112051a3afc94df1326f17ef58dc2fc531aa) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4718 | ROMX_LOAD( "rcm.66", 0xe00002, 0x80000, CRC(1300eb7b) SHA1(db4f53b1cf521df99d073dcf0bfafe7b113e95d5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4719 | ROMX_LOAD( "rcm.86", 0xe00004, 0x80000, CRC(6d974ebd) SHA1(41de66481a64fa8a6471c512fc5dcaf96d95ee69) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4720 | ROMX_LOAD( "rcm.96", 0xe00006, 0x80000, CRC(7da4cd24) SHA1(dd44377ff9f83f15cac032c4e7ef2071adcfa196) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4706 | ROMX_LOAD( "rcm.73", 0x800000, 0x080000, CRC(774c6e04) SHA1(6bd14960218e31d5a043b20a1b9d2d69cace761e) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4707 | ROMX_LOAD( "rcm.63", 0x800002, 0x080000, CRC(acad7c62) SHA1(eec10990339c9fd8fdae896a5fd98d5bf0220ed1) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4708 | ROMX_LOAD( "rcm.83", 0x800004, 0x080000, CRC(6af30499) SHA1(a97bf2f382b6edc1e920e18d8ad5ca18131a2f21) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4709 | ROMX_LOAD( "rcm.93", 0x800006, 0x080000, CRC(7a5a5166) SHA1(2160015e2e43e2c024a3af56da961ac02ffc74e9) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4710 | ROMX_LOAD( "rcm.74", 0xa00000, 0x080000, CRC(004ec725) SHA1(b1d3bcf920b0a1d0f4b59c77f5962e8162bbef65) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4711 | ROMX_LOAD( "rcm.64", 0xa00002, 0x080000, CRC(65c0464e) SHA1(4a035f4d28fc8aa72bfe0a06392b93b0abfba458) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4712 | ROMX_LOAD( "rcm.84", 0xa00004, 0x080000, CRC(fb3097cc) SHA1(7bff2372809cdfa4dcd8537a448b177c0e86a94e) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4713 | ROMX_LOAD( "rcm.94", 0xa00006, 0x080000, CRC(2e16557a) SHA1(f4a916c1524a8de23fc6afabc8c724a89530c631) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4714 | ROMX_LOAD( "rcm.75", 0xc00000, 0x080000, CRC(70a73f99) SHA1(6dd126b4e64e34d5911ed5877b1b94b503404249) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4715 | ROMX_LOAD( "rcm.65", 0xc00002, 0x080000, CRC(ecedad3d) SHA1(dea1377f086ea3a45ced983e258beb6607b295c9) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4716 | ROMX_LOAD( "rcm.85", 0xc00004, 0x080000, CRC(3d6186d8) SHA1(70f1ff678dd1ec533360458a564953fc5634cbc5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4717 | ROMX_LOAD( "rcm.95", 0xc00006, 0x080000, CRC(8c7700f1) SHA1(84846af535e9e333e911486d545988568554b67b) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4718 | ROMX_LOAD( "rcm.76", 0xe00000, 0x080000, CRC(89a889ad) SHA1(1ffe112051a3afc94df1326f17ef58dc2fc531aa) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4719 | ROMX_LOAD( "rcm.66", 0xe00002, 0x080000, CRC(1300eb7b) SHA1(db4f53b1cf521df99d073dcf0bfafe7b113e95d5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4720 | ROMX_LOAD( "rcm.86", 0xe00004, 0x080000, CRC(6d974ebd) SHA1(41de66481a64fa8a6471c512fc5dcaf96d95ee69) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4721 | ROMX_LOAD( "rcm.96", 0xe00006, 0x080000, CRC(7da4cd24) SHA1(dd44377ff9f83f15cac032c4e7ef2071adcfa196) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4721 | 4722 | |
| 4722 | 4723 | ROM_REGION(QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4723 | 4724 | ROM_LOAD( "rcm.01", 0x00000, 0x08000, CRC(d60cf8a3) SHA1(dccd84b93e62489c703011422d0fe84444c7f7db) ) |
| r2375 | r2376 | |
| 4743 | 4744 | |
| 4744 | 4745 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4745 | 4746 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4746 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4747 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4748 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4749 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4747 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4748 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4749 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4750 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4750 | 4751 | |
| 4751 | 4752 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4752 | 4753 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 4767 | 4768 | |
| 4768 | 4769 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4769 | 4770 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4770 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4771 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4772 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4773 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4771 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4772 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4773 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4774 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4774 | 4775 | |
| 4775 | 4776 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4776 | 4777 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 4791 | 4792 | |
| 4792 | 4793 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4793 | 4794 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4794 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4795 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4796 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4797 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4795 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4796 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4797 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4798 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4798 | 4799 | |
| 4799 | 4800 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4800 | 4801 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 4815 | 4816 | |
| 4816 | 4817 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4817 | 4818 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4818 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4819 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4820 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4821 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4819 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4820 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4821 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4822 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4822 | 4823 | |
| 4823 | 4824 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4824 | 4825 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 4839 | 4840 | |
| 4840 | 4841 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4841 | 4842 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4842 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4843 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4844 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4845 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4843 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4844 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4845 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4846 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4846 | 4847 | |
| 4847 | 4848 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4848 | 4849 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 4863 | 4864 | |
| 4864 | 4865 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4865 | 4866 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4866 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4867 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4868 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4869 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4867 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4868 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4869 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4870 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4870 | 4871 | |
| 4871 | 4872 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4872 | 4873 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 4887 | 4888 | |
| 4888 | 4889 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4889 | 4890 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4890 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4891 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4892 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4893 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4891 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4892 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4893 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4894 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4894 | 4895 | |
| 4895 | 4896 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4896 | 4897 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 4911 | 4912 | |
| 4912 | 4913 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4913 | 4914 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4914 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4915 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4916 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4917 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4915 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4916 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4917 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4918 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4918 | 4919 | |
| 4919 | 4920 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4920 | 4921 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 4935 | 4936 | |
| 4936 | 4937 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4937 | 4938 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4938 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4939 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4940 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4941 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4939 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4940 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4941 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4942 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4942 | 4943 | |
| 4943 | 4944 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4944 | 4945 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 4959 | 4960 | |
| 4960 | 4961 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4961 | 4962 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4962 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4963 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4964 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4965 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4963 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4964 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4965 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4966 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4966 | 4967 | |
| 4967 | 4968 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4968 | 4969 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 4983 | 4984 | |
| 4984 | 4985 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 4985 | 4986 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 4986 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4987 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4988 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4989 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4987 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4988 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4989 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4990 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 4990 | 4991 | |
| 4991 | 4992 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 4992 | 4993 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 5007 | 5008 | |
| 5008 | 5009 | ROM_REGION( 0x1000000, REGION_GFX1, 0 ) |
| 5009 | 5010 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 5010 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5011 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5012 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5013 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5011 | ROMX_LOAD( "sfz.14m", 0x800000, 0x200000, CRC(90fefdb3) SHA1(5eb28c8de57acfeaefebdd01509c7d9ba5244705) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5012 | ROMX_LOAD( "sfz.16m", 0x800002, 0x200000, CRC(5354c948) SHA1(07588f1ba6addc04fef3274c971174aaf3e632ab) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5013 | ROMX_LOAD( "sfz.18m", 0x800004, 0x200000, CRC(41a1e790) SHA1(ce25dad542308691dbe9606b26279bbd59ea4b81) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5014 | ROMX_LOAD( "sfz.20m", 0x800006, 0x200000, CRC(a549df98) SHA1(f054e95df650a891ef56da8bfb31cb2c945a9aed) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5014 | 5015 | |
| 5015 | 5016 | ROM_REGION( QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 5016 | 5017 | ROM_LOAD( "sfz.01", 0x00000, 0x08000, CRC(ffffec7d) SHA1(75b4aef001b72a0f571b51b2b97803facc1832dd) ) |
| r2375 | r2376 | |
| 5739 | 5740 | |
| 5740 | 5741 | ROM_REGION( 0xC00000, REGION_GFX1, 0 ) |
| 5741 | 5742 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 5742 | ROMX_LOAD( "pzf.14m", 0x800000, 0x100000, CRC(2d4881cb) SHA1(fd3baa183c25bed153b19c251980e2fb761600e2) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5743 | ROMX_LOAD( "pzf.16m", 0x800002, 0x100000, CRC(4b0fd1be) SHA1(377aafdcdb7a866b1c8487670e3598d8197976e4) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5744 | ROMX_LOAD( "pzf.18m", 0x800004, 0x100000, CRC(e43aac33) SHA1(d041e0688c3807d3363861a7f216de43b34d846c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5745 | ROMX_LOAD( "pzf.20m", 0x800006, 0x100000, CRC(7f536ff1) SHA1(905b9d62ef7bef47297c7f4a4dd697aed6df38a5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5743 | ROMX_LOAD( "pzf.14m", 0x800000, 0x100000, CRC(2d4881cb) SHA1(fd3baa183c25bed153b19c251980e2fb761600e2) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5744 | ROMX_LOAD( "pzf.16m", 0x800002, 0x100000, CRC(4b0fd1be) SHA1(377aafdcdb7a866b1c8487670e3598d8197976e4) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5745 | ROMX_LOAD( "pzf.18m", 0x800004, 0x100000, CRC(e43aac33) SHA1(d041e0688c3807d3363861a7f216de43b34d846c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5746 | ROMX_LOAD( "pzf.20m", 0x800006, 0x100000, CRC(7f536ff1) SHA1(905b9d62ef7bef47297c7f4a4dd697aed6df38a5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5746 | 5747 | |
| 5747 | 5748 | ROM_REGION(QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 5748 | 5749 | ROM_LOAD( "pzf.01", 0x00000, 0x08000, CRC(600fb2a3) SHA1(1fab1c2a23bf6ad8309d29ddbbc29435a8aeea13) ) |
| r2375 | r2376 | |
| 5761 | 5762 | |
| 5762 | 5763 | ROM_REGION( 0xC00000, REGION_GFX1, 0 ) |
| 5763 | 5764 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 5764 | ROMX_LOAD( "pzf.14m", 0x800000, 0x100000, CRC(2d4881cb) SHA1(fd3baa183c25bed153b19c251980e2fb761600e2) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5765 | ROMX_LOAD( "pzf.16m", 0x800002, 0x100000, CRC(4b0fd1be) SHA1(377aafdcdb7a866b1c8487670e3598d8197976e4) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5766 | ROMX_LOAD( "pzf.18m", 0x800004, 0x100000, CRC(e43aac33) SHA1(d041e0688c3807d3363861a7f216de43b34d846c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5767 | ROMX_LOAD( "pzf.20m", 0x800006, 0x100000, CRC(7f536ff1) SHA1(905b9d62ef7bef47297c7f4a4dd697aed6df38a5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5765 | ROMX_LOAD( "pzf.14m", 0x800000, 0x100000, CRC(2d4881cb) SHA1(fd3baa183c25bed153b19c251980e2fb761600e2) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5766 | ROMX_LOAD( "pzf.16m", 0x800002, 0x100000, CRC(4b0fd1be) SHA1(377aafdcdb7a866b1c8487670e3598d8197976e4) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5767 | ROMX_LOAD( "pzf.18m", 0x800004, 0x100000, CRC(e43aac33) SHA1(d041e0688c3807d3363861a7f216de43b34d846c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5768 | ROMX_LOAD( "pzf.20m", 0x800006, 0x100000, CRC(7f536ff1) SHA1(905b9d62ef7bef47297c7f4a4dd697aed6df38a5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5768 | 5769 | |
| 5769 | 5770 | ROM_REGION(QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 5770 | 5771 | ROM_LOAD( "pzf.01", 0x00000, 0x08000, CRC(600fb2a3) SHA1(1fab1c2a23bf6ad8309d29ddbbc29435a8aeea13) ) |
| r2375 | r2376 | |
| 5783 | 5784 | |
| 5784 | 5785 | ROM_REGION( 0xC00000, REGION_GFX1, 0 ) |
| 5785 | 5786 | ROM_FILL( 0x000000, 0x800000, 0 ) |
| 5786 | ROMX_LOAD( "pzf.14m", 0x800000, 0x100000, CRC(2d4881cb) SHA1(fd3baa183c25bed153b19c251980e2fb761600e2) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5787 | ROMX_LOAD( "pzf.16m", 0x800002, 0x100000, CRC(4b0fd1be) SHA1(377aafdcdb7a866b1c8487670e3598d8197976e4) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5788 | ROMX_LOAD( "pzf.18m", 0x800004, 0x100000, CRC(e43aac33) SHA1(d041e0688c3807d3363861a7f216de43b34d846c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5789 | ROMX_LOAD( "pzf.20m", 0x800006, 0x100000, CRC(7f536ff1) SHA1(905b9d62ef7bef47297c7f4a4dd697aed6df38a5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5787 | ROMX_LOAD( "pzf.14m", 0x800000, 0x100000, CRC(2d4881cb) SHA1(fd3baa183c25bed153b19c251980e2fb761600e2) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5788 | ROMX_LOAD( "pzf.16m", 0x800002, 0x100000, CRC(4b0fd1be) SHA1(377aafdcdb7a866b1c8487670e3598d8197976e4) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5789 | ROMX_LOAD( "pzf.18m", 0x800004, 0x100000, CRC(e43aac33) SHA1(d041e0688c3807d3363861a7f216de43b34d846c) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5790 | ROMX_LOAD( "pzf.20m", 0x800006, 0x100000, CRC(7f536ff1) SHA1(905b9d62ef7bef47297c7f4a4dd697aed6df38a5) , ROM_GROUPWORD | ROM_SKIP(6) ) | |
| 5790 | 5791 | |
| 5791 | 5792 | ROM_REGION(QSOUND_SIZE, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */ |
| 5792 | 5793 | ROM_LOAD( "pzf.01", 0x00000, 0x08000, CRC(600fb2a3) SHA1(1fab1c2a23bf6ad8309d29ddbbc29435a8aeea13) ) |
| r2375 | r2376 | |
|---|---|---|
| 55 | 55 | WRITE16_HANDLER( lordgun_vram_2_w ); |
| 56 | 56 | WRITE16_HANDLER( lordgun_vram_3_w ); |
| 57 | 57 | |
| 58 | void lordgun_update_gun(int i); | |
| 58 | void lordgun_update_gun(running_machine *machine, int i); | |
| 59 | 59 | |
| 60 | 60 | VIDEO_START( lordgun ); |
| 61 | 61 | VIDEO_UPDATE( lordgun ); |
| r2375 | r2376 | |
| 111 | 111 | |
| 112 | 112 | static READ8_HANDLER( lordgun_eeprom_r ) |
| 113 | 113 | { |
| 114 | return | |
| 114 | return | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | static WRITE8_HANDLER( lordgun_eeprom_w ) |
| r2375 | r2376 | |
| 130 | 130 | // Update light guns positions |
| 131 | 131 | for (i = 0; i < 2; i++) |
| 132 | 132 | if ( (data & (0x04 << i)) && !(old & (0x04 << i)) ) |
| 133 | lordgun_update_gun(i); | |
| 133 | lordgun_update_gun(machine, i); | |
| 134 | 134 | |
| 135 | 135 | // latch the bit |
| 136 | 136 | EEPROM_write_bit(data & 0x40); |
| r2375 | r2376 | |
|---|---|---|
| 33 | 33 | static READ16_HANDLER( lemmings_trackball_r ) |
| 34 | 34 | { |
| 35 | 35 | switch (offset) { |
| 36 | case 0: return readinputport(4); break; | |
| 37 | case 1: return readinputport(5); break; | |
| 38 | case 4: return readinputport(6); break; | |
| 39 | case 5: return readinputport(7); break; | |
| 36 | case 0: return input_port_read_indexed(machine, 4); break; | |
| 37 | case 1: return input_port_read_indexed(machine, 5); break; | |
| 38 | case 4: return input_port_read_indexed(machine, 6); break; | |
| 39 | case 5: return input_port_read_indexed(machine, 7); break; | |
| 40 | 40 | } |
| 41 | 41 | return 0; |
| 42 | 42 | } |
| r2375 | r2376 | |
| 46 | 46 | { |
| 47 | 47 | switch (offset<<1) { |
| 48 | 48 | case 0x41a: /* Player input */ |
| 49 | return | |
| 49 | return | |
| 50 | 50 | |
| 51 | 51 | case 0x320: /* Coins */ |
| 52 | return | |
| 52 | return | |
| 53 | 53 | |
| 54 | 54 | case 0x4e6: /* Dips */ |
| 55 | return ( | |
| 55 | return ( | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return 0; |
| r2375 | r2376 | |
|---|---|---|
| 42 | 42 | switch (offset) |
| 43 | 43 | { |
| 44 | 44 | case 0x00: |
| 45 | return | |
| 45 | return | |
| 46 | 46 | case 0x01: |
| 47 | return ( | |
| 47 | return ( | |
| 48 | 48 | case 0x04: |
| 49 | return ( | |
| 49 | return ( | |
| 50 | 50 | case 0x05: |
| 51 | return | |
| 51 | return | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",activecpu_get_pc(),0x800000+offset); |
| r2375 | r2376 | |
|---|---|---|
| 45 | 45 | static int cheat = 0; |
| 46 | 46 | static const int bits[] = { 0xee, 0xff, 0xbb, 0xaa }; |
| 47 | 47 | |
| 48 | res = | |
| 48 | res = | |
| 49 | 49 | |
| 50 | 50 | if ((res & 0x80) == 0) |
| 51 | 51 | { |
| r2375 | r2376 | |
|---|---|---|
| 1357 | 1357 | MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) |
| 1358 | 1358 | |
| 1359 | 1359 | MDRV_SCREEN_ADD("main", RASTER) |
| 1360 | MDRV_SCREEN_REFRESH_RATE( | |
| 1360 | MDRV_SCREEN_REFRESH_RATE( (28000000.0 / 4) / (450 * 282) ) /* fixed by SUZ */ | |
| 1361 | 1361 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 1362 | 1362 | MDRV_SCREEN_SIZE(432, 262) /* copied these from toaplan2, to be verified */ |
| 1363 | 1363 | MDRV_SCREEN_VISIBLE_AREA(0, 319, 16, 255) |
| r2375 | r2376 | |
| 2089 | 2089 | |
| 2090 | 2090 | static DRIVER_INIT( toaplan1 ) |
| 2091 | 2091 | { |
| 2092 | toaplan1_driver_savestate(); | |
| 2092 | toaplan1_driver_savestate(machine); | |
| 2093 | 2093 | } |
| 2094 | 2094 | |
| 2095 | 2095 | static DRIVER_INIT( demonwld ) |
| 2096 | 2096 | { |
| 2097 | toaplan1_driver_savestate(); | |
| 2098 | demonwld_driver_savestate(); | |
| 2097 | toaplan1_driver_savestate(machine); | |
| 2098 | demonwld_driver_savestate(machine); | |
| 2099 | 2099 | } |
| 2100 | 2100 | |
| 2101 | 2101 | static DRIVER_INIT( vimana ) |
| 2102 | 2102 | { |
| 2103 | toaplan1_driver_savestate(); | |
| 2104 | vimana_driver_savestate(); | |
| 2103 | toaplan1_driver_savestate(machine); | |
| 2104 | vimana_driver_savestate(machine); | |
| 2105 | 2105 | } |
| 2106 | 2106 | |
| 2107 | 2107 |
| r2375 | r2376 | |
|---|---|---|
| 231 | 231 | /* read as two bits from each of 4 ports. For this reason, the input */ |
| 232 | 232 | /* ports have been organized logically, and are demangled at runtime. */ |
| 233 | 233 | /* 4 input ports each provide 8 bits of information. */ |
| 234 | UINT8 d7d6 = readinputportbytag("D7D6"); | |
| 235 | UINT8 d5d4 = readinputportbytag("D5D4"); | |
| 236 | UINT8 d3d2 = readinputportbytag("D3D2"); | |
| 237 | UINT8 d1d0 = readinputportbytag("D1D0"); | |
| 234 | UINT8 d7d6 = input_port_read(machine, "D7D6"); | |
| 235 | UINT8 d5d4 = input_port_read(machine, "D5D4"); | |
| 236 | UINT8 d3d2 = input_port_read(machine, "D3D2"); | |
| 237 | UINT8 d1d0 = input_port_read(machine, "D1D0"); | |
| 238 | 238 | int shift = offset & 3; |
| 239 | 239 | return demangle(d7d6 >> shift, d5d4 >> shift, d3d2 >> shift, d1d0 >> shift); |
| 240 | 240 | } |
| r2375 | r2376 | |
| 246 | 246 | /* versus cocktail cabinets; we fix this here. The input ports are */ |
| 247 | 247 | /* coded for cocktail mode; for upright mode, we manually shuffle the */ |
| 248 | 248 | /* bits around. */ |
| 249 | UINT8 d7d6 = readinputportbytag("D7D6"); | |
| 250 | UINT8 d5d4 = readinputportbytag("D5D4"); | |
| 251 | UINT8 d3d2 = readinputportbytag("D3D2"); | |
| 252 | UINT8 d1d0 = readinputportbytag("D1D0"); | |
| 249 | UINT8 d7d6 = input_port_read(machine, "D7D6"); | |
| 250 | UINT8 d5d4 = input_port_read(machine, "D5D4"); | |
| 251 | UINT8 d3d2 = input_port_read(machine, "D3D2"); | |
| 252 | UINT8 d1d0 = input_port_read(machine, "D1D0"); | |
| 253 | 253 | int shift = offset & 3; |
| 254 | 254 | |
| 255 | 255 | /* tweak bits for the upright case */ |
| 256 | 256 | UINT8 upright = d3d2 & 0x04; |
| 257 | 257 | if (upright) |
| 258 | 258 | { |
| 259 | UINT8 fc = | |
| 259 | UINT8 fc = | |
| 260 | 260 | d7d6 |= 0x60; |
| 261 | 261 | d5d4 = (d5d4 & ~0x1c) | |
| 262 | 262 | ((~fc & 0x20) >> 3) | /* IPT_BUTTON2 */ |
| r2375 | r2376 | |
| 270 | 270 | |
| 271 | 271 | static READ8_HANDLER( spaceod_port_fc_r ) |
| 272 | 272 | { |
| 273 | UINT8 upright = readinputportbytag("D3D2") & 0x04; | |
| 274 | UINT8 fc = readinputportbytag("FC"); | |
| 273 | UINT8 upright = input_port_read(machine, "D3D2") & 0x04; | |
| 274 | UINT8 fc = input_port_read(machine, "FC"); | |
| 275 | 275 | |
| 276 | 276 | /* tweak bits for the upright case */ |
| 277 | 277 | if (upright) |
| r2375 | r2376 | |
|---|---|---|
| 56 | 56 | int i; |
| 57 | 57 | |
| 58 | 58 | for (i = 0;i < 5;i++) |
| 59 | if (~keyb & (1 << i)) res &= | |
| 59 | if (~keyb & (1 << i)) res &= | |
| 60 | 60 | |
| 61 | 61 | return res; |
| 62 | 62 | } |
| r2375 | r2376 | |
|---|---|---|
| 2563 | 2563 | MDRV_SPEAKER_STANDARD_STEREO("left", "right") |
| 2564 | 2564 | |
| 2565 | 2565 | MDRV_SOUND_ADD(YM2151, XTAL_3_579545MHz) |
| 2566 | MDRV_SOUND_ROUTE(0, "left", 1.0) | |
| 2567 | MDRV_SOUND_ROUTE(1, "right", 1.0) | |
| 2566 | MDRV_SOUND_ROUTE(0, "left", 0.70) | |
| 2567 | MDRV_SOUND_ROUTE(1, "right", 0.70) | |
| 2568 | 2568 | |
| 2569 | 2569 | MDRV_SOUND_ADD(K053260, XTAL_3_579545MHz) |
| 2570 | 2570 | MDRV_SOUND_CONFIG(k053260_interface) |
| 2571 | MDRV_SOUND_ROUTE(0, "right", 0.75) /* fixed inverted stereo channels */ | |
| 2572 | MDRV_SOUND_ROUTE(1, "left", 0.75) | |
| 2571 | MDRV_SOUND_ROUTE(0, "right", 0.50) /* fixed inverted stereo channels */ | |
| 2572 | MDRV_SOUND_ROUTE(1, "left", 0.50) | |
| 2573 | 2573 | MACHINE_DRIVER_END |
| 2574 | 2574 | |
| 2575 | 2575 | |
| r2375 | r2376 | |
| 2721 | 2721 | |
| 2722 | 2722 | MDRV_SOUND_ADD(K053260, XTAL_3_579545MHz) |
| 2723 | 2723 | MDRV_SOUND_CONFIG(k053260_interface) |
| 2724 | MDRV_SOUND_ROUTE(0, "left", 0.70) | |
| 2725 | MDRV_SOUND_ROUTE(1, "right", 0.70) | |
| 2724 | MDRV_SOUND_ROUTE(0, "left", 0.75) | |
| 2725 | MDRV_SOUND_ROUTE(1, "right", 0.75) | |
| 2726 | 2726 | MACHINE_DRIVER_END |
| 2727 | 2727 | |
| 2728 | 2728 | |
| r2375 | r2376 | |
| 2764 | 2764 | |
| 2765 | 2765 | MDRV_SOUND_ADD(K053260, XTAL_3_579545MHz) |
| 2766 | 2766 | MDRV_SOUND_CONFIG(k053260_interface) |
| 2767 | MDRV_SOUND_ROUTE(0, "left", 0.75) | |
| 2768 | MDRV_SOUND_ROUTE(1, "right", 0.75) | |
| 2767 | MDRV_SOUND_ROUTE(0, "left", 0.70) | |
| 2768 | MDRV_SOUND_ROUTE(1, "right", 0.70) | |
| 2769 | 2769 | MACHINE_DRIVER_END |
| 2770 | 2770 | |
| 2771 | 2771 | |
| r2375 | r2376 | |
| 2839 | 2839 | |
| 2840 | 2840 | MDRV_SOUND_ADD(K053260, XTAL_3_579545MHz) |
| 2841 | 2841 | MDRV_SOUND_CONFIG(k053260_interface) |
| 2842 | MDRV_SOUND_ROUTE(0, "left", 0.70) | |
| 2843 | MDRV_SOUND_ROUTE(1, "right", 0.70) | |
| 2842 | MDRV_SOUND_ROUTE(0, "left", 0.75) | |
| 2843 | MDRV_SOUND_ROUTE(1, "right", 0.75) | |
| 2844 | 2844 | MACHINE_DRIVER_END |
| 2845 | 2845 | |
| 2846 | 2846 |
| r2375 | r2376 | |
|---|---|---|
| 295 | 295 | } |
| 296 | 296 | case 0xd: |
| 297 | 297 | { |
| 298 | val = | |
| 298 | val = | |
| 299 | 299 | break; |
| 300 | 300 | } |
| 301 | 301 | case 0xe: |
| r2375 | r2376 | |
| 409 | 409 | { |
| 410 | 410 | if (touch_cnt == 0) |
| 411 | 411 | { |
| 412 | if ( | |
| 412 | if ( | |
| 413 | 413 | { |
| 414 | 414 | touch_data[0] = 0x2a; |
| 415 | touch_data[1] = 0x7 - (readinputportbytag("TOUCH_Y") >> 5) + 0x30; | |
| 416 | touch_data[2] = (readinputportbytag("TOUCH_X") >> 5) + 0x30; | |
| 415 | touch_data[1] = 0x7 - (input_port_read(machine, "TOUCH_Y") >> 5) + 0x30; | |
| 416 | touch_data[2] = (input_port_read(machine, "TOUCH_X") >> 5) + 0x30; | |
| 417 | 417 | |
| 418 | 418 | /* Return RXRDY */ |
| 419 | 419 | return 0x1; |
| r2375 | r2376 | |
| 477 | 477 | { |
| 478 | 478 | case 0: |
| 479 | 479 | { |
| 480 | val = | |
| 480 | val = | |
| 481 | 481 | break; |
| 482 | 482 | } |
| 483 | 483 | case 2: |
| 484 | 484 | { |
| 485 | val = | |
| 485 | val = | |
| 486 | 486 | break; |
| 487 | 487 | } |
| 488 | 488 | case 4: |
| 489 | 489 | { |
| 490 | val = | |
| 490 | val = | |
| 491 | 491 | break; |
| 492 | 492 | } |
| 493 | 493 | case 9: |
| 494 | 494 | { |
| 495 | val = | |
| 495 | val = | |
| 496 | 496 | break; |
| 497 | 497 | } |
| 498 | 498 | } |
| r2375 | r2376 | |
|---|---|---|
| 1145 | 1145 | switch( offset ) |
| 1146 | 1146 | { |
| 1147 | 1147 | case 0: |
| 1148 | data = | |
| 1148 | data = | |
| 1149 | 1149 | break; |
| 1150 | 1150 | case 1: |
| 1151 | data = ( | |
| 1151 | data = ( | |
| 1152 | 1152 | break; |
| 1153 | 1153 | case 2: |
| 1154 | data = | |
| 1154 | data = | |
| 1155 | 1155 | break; |
| 1156 | 1156 | case 3: |
| 1157 | data = ( | |
| 1157 | data = ( | |
| 1158 | 1158 | break; |
| 1159 | 1159 | } |
| 1160 | 1160 | verboselog( 2, "system11gun_r( %08x, %08x ) %08x\n", offset, mem_mask, data ); |
| r2375 | r2376 | |
| 1387 | 1387 | int index = port_tag_to_index("IN3"); |
| 1388 | 1388 | if( index != -1 ) |
| 1389 | 1389 | { |
| 1390 | int rv = | |
| 1390 | int rv = | |
| 1391 | 1391 | |
| 1392 | 1392 | if( ( offset & 1 ) != 0 ) |
| 1393 | 1393 | { |
| r2375 | r2376 | |
| 1406 | 1406 | int index = port_tag_to_index("IN4"); |
| 1407 | 1407 | if( index != -1 ) |
| 1408 | 1408 | { |
| 1409 | int rv = | |
| 1409 | int rv = | |
| 1410 | 1410 | |
| 1411 | 1411 | if( ( offset & 1 ) != 0 ) |
| 1412 | 1412 | { |
| r2375 | r2376 | |
| 1439 | 1439 | |
| 1440 | 1440 | static DRIVER_INIT( namcos12 ) |
| 1441 | 1441 | { |
| 1442 | psx_driver_init(); | |
| 1442 | psx_driver_init(machine); | |
| 1443 | 1443 | |
| 1444 | 1444 | psx_dma_install_read_handler( 5, namcos12_rom_read ); |
| 1445 | 1445 | |
| r2375 | r2376 | |
| 1473 | 1473 | |
| 1474 | 1474 | static MACHINE_DRIVER_START( coh700 ) |
| 1475 | 1475 | /* basic machine hardware */ |
| 1476 | MDRV_CPU_ADD( | |
| 1476 | MDRV_CPU_ADD( | |
| 1477 | 1477 | MDRV_CPU_PROGRAM_MAP( namcos12_map, 0 ) |
| 1478 | 1478 | MDRV_CPU_VBLANK_INT("main", psx_vblank) |
| 1479 | 1479 |
| r2375 | r2376 | |
|---|---|---|
| 72 | 72 | COMBINE_DATA(dest); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | /* machine/seicop.c */ | |
| 76 | extern READ16_HANDLER( raiden2_cop2_r ); | |
| 77 | extern WRITE16_HANDLER( raiden2_cop2_w ); | |
| 78 | extern void cop_init(void); | |
| 75 | 79 | |
| 80 | ||
| 81 | ||
| 76 | 82 | /* SPRITE DRAWING (move to video file) */ |
| 77 | 83 | |
| 78 | 84 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ,int pri_mask ) |
| r2375 | r2376 | |
| 476 | 482 | |
| 477 | 483 | static INTERRUPT_GEN( raiden2_interrupt ) |
| 478 | 484 | { |
| 479 | mainram[0x740/2] = | |
| 485 | mainram[0x740/2] = | |
| 480 | 486 | mainram[0x742/2] = 0xffff; |
| 481 | mainram[0x744/2] = | |
| 487 | mainram[0x744/2] = | |
| 482 | 488 | mainram[0x746/2] = 0xffff; |
| 483 | 489 | mainram[0x748/2] = 0xffff; |
| 484 | 490 | mainram[0x74a/2] = 0xffff; |
| 485 | mainram[0x74c/2] = | |
| 491 | mainram[0x74c/2] = | |
| 486 | 492 | mainram[0x74e/2] = 0xffff; |
| 487 | 493 | |
| 488 | 494 | cpunum_set_input_line_and_vector(machine, cpunum, 0, HOLD_LINE, 0xc0/4); /* VBL */ |
| r2375 | r2376 | |
| 491 | 497 | |
| 492 | 498 | |
| 493 | 499 | |
| 494 | // COPX functions, terribly incomplete | |
| 495 | 500 | |
| 496 | typedef struct _cop_state cop_state; | |
| 497 | struct _cop_state | |
| 498 | { | |
| 499 | UINT16 offset; /* last write offset */ | |
| 500 | UINT16 ram[0x200/2]; /* RAM from 0x400-0x5ff */ | |
| 501 | ||
| 502 | UINT32 reg[4]; /* registers */ | |
| 503 | ||
| 504 | UINT16 func_trigger[0x100/8]; /* function trigger */ | |
| 505 | UINT16 func_value[0x100/8]; /* function value (?) */ | |
| 506 | UINT16 func_mask[0x100/8]; /* function mask (?) */ | |
| 507 | UINT16 program[0x100]; /* program "code" */ | |
| 508 | }; | |
| 509 | ||
| 510 | static cop_state cop_data; | |
| 511 | ||
| 512 | ||
| 513 | #define VERBOSE 1 | |
| 514 | #define COP_LOG(x) do { if (VERBOSE) logerror x; } while (0) | |
| 515 | ||
| 516 | ||
| 517 | ||
| 518 | INLINE UINT16 cop_ram_r(cop_state *cop, UINT16 offset) | |
| 519 | { | |
| 520 | return cop->ram[(offset - 0x400) / 2]; | |
| 521 | } | |
| 522 | ||
| 523 | INLINE void cop_ram_w(cop_state *cop, UINT16 offset, UINT16 data) | |
| 524 | { | |
| 525 | cop->ram[(offset - 0x400) / 2] = data; | |
| 526 | } | |
| 527 | ||
| 528 | INLINE UINT32 r32(offs_t address) | |
| 529 | { | |
| 530 | return (program_read_word(address + 0) << 0) | | |
| 531 | (program_read_word(address + 2) << 16); | |
| 532 | } | |
| 533 | ||
| 534 | INLINE void w32(offs_t address, UINT32 data) | |
| 535 | { | |
| 536 | program_write_word(address + 0, data >> 0); | |
| 537 | program_write_word(address + 2, data >> 16); | |
| 538 | } | |
| 539 | ||
| 540 | ||
| 541 | static void cop_init(void) | |
| 542 | { | |
| 543 | memset(&cop_data, 0, sizeof(cop_data)); | |
| 544 | } | |
| 545 | ||
| 546 | ||
| 547 | static WRITE16_HANDLER( cop_w ) | |
| 548 | { | |
| 549 | cop_state *cop = &cop_data; | |
| 550 | UINT32 temp32; | |
| 551 | UINT8 regnum; | |
| 552 | int func; | |
| 553 | ||
| 554 | /* all COP data writes are word-length (?) */ | |
| 555 | data = COMBINE_DATA(&cop->ram[offset]); | |
| 556 | ||
| 557 | /* handle writes */ | |
| 558 | switch (offset + 0x400) | |
| 559 | { | |
| 560 | /* ----- BCD conversion ----- */ | |
| 561 | ||
| 562 | case 0x420: /* LSW of number */ | |
| 563 | case 0x422: /* MSW of number */ | |
| 564 | temp32 = cop_ram_r(cop, 0x420) | (cop_ram_r(cop, 0x422) << 16); | |
| 565 | cop_ram_w(cop, 0x590, ((temp32 / 1) % 10) + (((temp32 / 10) % 10) << 8) + 0x3030); | |
| 566 | cop_ram_w(cop, 0x592, ((temp32 / 100) % 10) + (((temp32 / 1000) % 10) << 8) + 0x3030); | |
| 567 | cop_ram_w(cop, 0x594, ((temp32 / 10000) % 10) + (((temp32 / 100000) % 10) << 8) + 0x3030); | |
| 568 | cop_ram_w(cop, 0x596, ((temp32 / 1000000) % 10) + (((temp32 / 10000000) % 10) << 8) + 0x3030); | |
| 569 | cop_ram_w(cop, 0x598, ((temp32 / 100000000) % 10) + (((temp32 / 1000000000) % 10) << 8) + 0x3030); | |
| 570 | break; | |
| 571 | ||
| 572 | /* ----- program upload registers ----- */ | |
| 573 | ||
| 574 | case 0x432: /* COP program data */ | |
| 575 | COP_LOG(("%05X:COP Prog Data = %04X\n", activecpu_get_pc(), data)); | |
| 576 | cop->program[cop_ram_r(cop, 0x434)] = data; | |
| 577 | break; | |
| 578 | ||
| 579 | case 0x434: /* COP program address */ | |
| 580 | COP_LOG(("%05X:COP Prog Addr = %04X\n", activecpu_get_pc(), data)); | |
| 581 | assert((data & ~0xff) == 0); | |
| 582 | temp32 = (data & 0xff) / 8; | |
| 583 | cop->func_value[temp32] = cop_ram_r(cop, 0x438); | |
| 584 | cop->func_mask[temp32] = cop_ram_r(cop, 0x43a); | |
| 585 | cop->func_trigger[temp32] = cop_ram_r(cop, 0x43c); | |
| 586 | break; | |
| 587 | ||
| 588 | case 0x438: /* COP program entry value (0,4,5,6,7,8,9,F) */ | |
| 589 | COP_LOG(("%05X:COP Prog Val = %04X\n", activecpu_get_pc(), data)); | |
| 590 | break; | |
| 591 | ||
| 592 | case 0x43a: /* COP program entry mask */ | |
| 593 | COP_LOG(("%05X:COP Prog Mask = %04X\n", activecpu_get_pc(), data)); | |
| 594 | break; | |
| 595 | ||
| 596 | case 0x43c: /* COP program trigger value */ | |
| 597 | COP_LOG(("%05X:COP Prog Trig = %04X\n", activecpu_get_pc(), data)); | |
| 598 | break; | |
| 599 | ||
| 600 | /* ----- ???? ----- */ | |
| 601 | ||
| 602 | case 0x47a: /* clear RAM */ | |
| 603 | if (cop_ram_r(cop, 0x47e) == 0x118) | |
| 604 | { | |
| 605 | UINT32 addr = cop_ram_r(cop, 0x478) << 6; | |
| 606 | int count = (cop_ram_r(cop, 0x47a) + 1) << 5; | |
| 607 | COP_LOG(("%05X:COP RAM clear from %05X to %05X\n", activecpu_get_pc(), addr, addr + count)); | |
| 608 | while (count--) | |
| 609 | program_write_byte(addr++, 0); | |
| 610 | } | |
| 611 | else | |
| 612 | { | |
| 613 | COP_LOG(("%05X:COP Unknown RAM clear(%04X) = %04X\n", activecpu_get_pc(), cop_ram_r(cop, 0x47e), data)); | |
| 614 | } | |
| 615 | break; | |
| 616 | ||
| 617 | /* ----- program data registers ----- */ | |
| 618 | ||
| 619 | case 0x4a0: /* COP register high word */ | |
| 620 | case 0x4a2: /* COP register high word */ | |
| 621 | case 0x4a4: /* COP register high word */ | |
| 622 | case 0x4a6: /* COP register high word */ | |
| 623 | regnum = (offset / 2) % 4; | |
| 624 | COP_LOG(("%05X:COP RegHi(%d) = %04X\n", activecpu_get_pc(), regnum, data)); | |
| 625 | cop->reg[regnum] = (cop->reg[regnum] & 0x0000ffff) | (data << 16); | |
| 626 | break; | |
| 627 | ||
| 628 | case 0x4c0: /* COP register low word */ | |
| 629 | case 0x4c2: /* COP register low word */ | |
| 630 | case 0x4c4: /* COP register low word */ | |
| 631 | case 0x4c6: /* COP register low word */ | |
| 632 | regnum = (offset / 2) % 4; | |
| 633 | COP_LOG(("%05X:COP RegLo(%d) = %04X\n", activecpu_get_pc(), regnum, data)); | |
| 634 | cop->reg[regnum] = (cop->reg[regnum] & 0xffff0000) | data; | |
| 635 | break; | |
| 636 | ||
| 637 | /* ----- program trigger register ----- */ | |
| 638 | ||
| 639 | case 0x500: /* COP trigger */ | |
| 640 | COP_LOG(("%05X:COP Trigger = %04X\n", activecpu_get_pc(), data)); | |
| 641 | for (func = 0; func < ARRAY_LENGTH(cop->func_trigger); func++) | |
| 642 | if (cop->func_trigger[func] == data) | |
| 643 | { | |
| 644 | int offs; | |
| 645 | ||
| 646 | COP_LOG((" Execute:")); | |
| 647 | for (offs = 0; offs < 8; offs++) | |
| 648 | { | |
| 649 | if (cop->program[func * 8 + offs] == 0) | |
| 650 | break; | |
| 651 | COP_LOG((" %04X", cop->program[func * 8 + offs])); | |
| 652 | } | |
| 653 | COP_LOG(("\n")); | |
| 654 | ||
| 655 | /* special cases for now */ | |
| 656 | if (data == 0x5205 || data == 0x5a05) | |
| 657 | { | |
| 658 | COP_LOG((" Copy 32 bits from %05X to %05X\n", cop->reg[0], cop->reg[1])); | |
| 659 | w32(cop->reg[1], r32(cop->reg[0])); | |
| 660 | } | |
| 661 | else if (data == 0xf205) | |
| 662 | { | |
| 663 | COP_LOG((" Copy 32 bits from %05X to %05X\n", cop->reg[0] + 4, cop->reg[1])); | |
| 664 | w32(cop->reg[2], r32(cop->reg[0] + 4)); | |
| 665 | } | |
| 666 | break; | |
| 667 | } | |
| 668 | assert(func != ARRAY_LENGTH(cop->func_trigger)); | |
| 669 | break; | |
| 670 | ||
| 671 | /* ----- other stuff ----- */ | |
| 672 | ||
| 673 | default: /* unknown */ | |
| 674 | COP_LOG(("%05X:COP Unknown(%04X) = %04X\n", activecpu_get_pc(), offset + 0x400, data)); | |
| 675 | break; | |
| 676 | } | |
| 677 | } | |
| 678 | ||
| 679 | ||
| 680 | static READ16_HANDLER( cop_r ) | |
| 681 | { | |
| 682 | cop_state *cop = &cop_data; | |
| 683 | COP_LOG(("%05X:COP Read(%04X) = %04X\n", activecpu_get_pc(), offset*2 + 0x400, cop->ram[offset])); | |
| 684 | return cop->ram[offset]; | |
| 685 | } | |
| 686 | ||
| 687 | ||
| 688 | 501 | // Sprite encryption key upload |
| 689 | 502 | |
| 690 | 503 | static UINT32 sprcpt_adr, sprcpt_idx; |
| r2375 | r2376 | |
| 935 | 748 | /* MEMORY MAPS */ |
| 936 | 749 | |
| 937 | 750 | static ADDRESS_MAP_START( raiden2_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 938 | AM_RANGE(0x00400, 0x005ff) AM_READWRITE(cop_r, cop_w) | |
| 751 | AM_RANGE(0x00400, 0x005ff) AM_READWRITE(raiden2_cop2_r, raiden2_cop2_w) | |
| 939 | 752 | |
| 940 | 753 | AM_RANGE(0x006a0, 0x006a3) AM_WRITE(sprcpt_val_1_w) |
| 941 | 754 | AM_RANGE(0x006a4, 0x006a7) AM_WRITE(sprcpt_data_3_w) |
| r2375 | r2376 | |
| 1887 | 1700 | ROM_LOAD( "6.pcm", 0x00000, 0x40000, CRC(48be32b1) SHA1(969d2191a3c46871ee8bf93088b3cecce3eccf0c) ) // 6.4a |
| 1888 | 1701 | ROM_END |
| 1889 | 1702 | |
| 1890 | /* Different hardware, COP-D3 | |
| 1703 | /* Different hardware, uses COPX-D3 for protection */ | |
| 1891 | 1704 | ROM_START( nzerotea ) |
| 1892 | 1705 | ROM_REGION( 0x200000, REGION_USER1, 0 ) /* v30 main cpu */ |
| 1893 | 1706 | ROM_LOAD16_BYTE("prg1", 0x000000, 0x80000, CRC(3c7d9410) SHA1(25f2121b6c2be73f11263934266901ed5d64d2ee) ) |
| r2375 | r2376 | |
| 2059 | 1872 | |
| 2060 | 1873 | static READ16_HANDLER( rdx_v33_eeprom_r ) |
| 2061 | 1874 | { |
| 2062 | return | |
| 1875 | return | |
| 2063 | 1876 | } |
| 2064 | 1877 | |
| 2065 | 1878 | |
| r2375 | r2376 | |
| 2093 | 1906 | |
| 2094 | 1907 | static READ16_HANDLER( r2_playerin_r ) |
| 2095 | 1908 | { |
| 2096 | return | |
| 1909 | return | |
| 2097 | 1910 | } |
| 2098 | 1911 | static READ16_HANDLER( rdx_v33_oki_r ) |
| 2099 | 1912 | { |
| r2375 | r2376 | |
| 2302 | 2115 | GAME( 1993, zeroteaa, zeroteam,raiden2, raiden2, raiden2, ROT0, "Seibu Kaihatsu", "Zero Team (set 2)", GAME_NOT_WORKING|GAME_NO_SOUND) |
| 2303 | 2116 | GAME( 1993, zeroteab, zeroteam,raiden2, raiden2, raiden2, ROT0, "Seibu Kaihatsu", "Zero Team (set 3)", GAME_NOT_WORKING|GAME_NO_SOUND) |
| 2304 | 2117 | GAME( 1993, zerotsel, zeroteam,raiden2, raiden2, raiden2, ROT0, "Seibu Kaihatsu", "Zero Team Selection", GAME_NOT_WORKING|GAME_NO_SOUND) |
| 2305 | GAME( 1993, nzerotea, zeroteam,raiden2, raiden2, raiden2, ROT0, "Seibu Kaihatsu", "New Zero Team", GAME_NOT_WORKING|GAME_NO_SOUND) | |
| 2306 | 2118 | |
| 2119 | // 'V33 system type_b' - uses V33 CPU, COPX-D3 external protection rom, but still has the proper sound system | |
| 2120 | GAME( 1993, nzerotea, zeroteam,raiden2, raiden2, raiden2, ROT0, "Seibu Kaihatsu", "New Zero Team", GAME_NOT_WORKING|GAME_NO_SOUND) // this uses a v33 and COPD3 | |
| 2121 | ||
| 2307 | 2122 | // newer PCB, with V33 CPU and COPD3 protection, but weak sound hardware. - was marked as Raiden DX New in the rom dump, but boots as Raiden 2 New version, is it switchable? |
| 2308 | 2123 | GAME( 1996, r2dx_v33, 0, rdx_v33, rdx_v33, rdx_v33, ROT270, "Seibu Kaihatsu", "Raiden 2 / DX (newer V33 PCB)", GAME_NOT_WORKING|GAME_NO_SOUND) |
| r2375 | r2376 | |
|---|---|---|
| 490 | 490 | if(io_reg[0x0F] & 0x01) |
| 491 | 491 | return io_reg[0x00]; |
| 492 | 492 | else |
| 493 | return | |
| 493 | return | |
| 494 | 494 | break; |
| 495 | 495 | |
| 496 | 496 | case 0x01: /* Port B - 2P controls */ |
| 497 | 497 | if(io_reg[0x0F] & 0x02) |
| 498 | 498 | return io_reg[0x01]; |
| 499 | 499 | else |
| 500 | return | |
| 500 | return | |
| 501 | 501 | break; |
| 502 | 502 | |
| 503 | 503 | case 0x02: /* Port C - Bidirectional I/O port */ |
| r2375 | r2376 | |
| 518 | 518 | if(io_reg[0x0F] & 0x10) |
| 519 | 519 | return io_reg[0x04]; |
| 520 | 520 | else |
| 521 | return | |
| 521 | return | |
| 522 | 522 | break; |
| 523 | 523 | |
| 524 | 524 | case 0x05: /* Port F - DIP switch #1 */ |
| 525 | 525 | if(io_reg[0x0F] & 0x20) |
| 526 | 526 | return io_reg[0x05]; |
| 527 | 527 | else |
| 528 | return | |
| 528 | return | |
| 529 | 529 | break; |
| 530 | 530 | |
| 531 | 531 | case 0x06: /* Port G - DIP switch #2 */ |
| 532 | 532 | if(io_reg[0x0F] & 0x40) |
| 533 | 533 | return io_reg[0x06]; |
| 534 | 534 | else |
| 535 | return | |
| 535 | return | |
| 536 | 536 | break; |
| 537 | 537 | |
| 538 | 538 | case 0x07: /* Port H - Tile banking control */ |
| r2375 | r2376 | |
|---|---|---|
| 421 | 421 | { |
| 422 | 422 | if (ACCESSING_BITS_24_31) |
| 423 | 423 | { |
| 424 | r |= (( | |
| 424 | r |= (( | |
| 425 | 425 | } |
| 426 | 426 | return r; |
| 427 | 427 | } |
| r2375 | r2376 | |
| 430 | 430 | if (ACCESSING_BITS_24_31) |
| 431 | 431 | { |
| 432 | 432 | UINT32 data = EEPROM_read_bit() & 1; |
| 433 | data |= | |
| 433 | data |= | |
| 434 | 434 | r |= data << 24; |
| 435 | 435 | } |
| 436 | 436 | return r; |
| r2375 | r2376 | |
| 439 | 439 | { |
| 440 | 440 | if (ACCESSING_BITS_24_31) |
| 441 | 441 | { |
| 442 | r |= | |
| 442 | r |= | |
| 443 | 443 | } |
| 444 | 444 | return r; |
| 445 | 445 | } |
| r2375 | r2376 | |
| 447 | 447 | { |
| 448 | 448 | if (ACCESSING_BITS_24_31) |
| 449 | 449 | { |
| 450 | r |= | |
| 450 | r |= | |
| 451 | 451 | } |
| 452 | 452 | return r; |
| 453 | 453 | } |
| r2375 | r2376 | |
| 463 | 463 | { |
| 464 | 464 | if (ACCESSING_BITS_24_31) |
| 465 | 465 | { |
| 466 | r |= | |
| 466 | r |= | |
| 467 | 467 | } |
| 468 | 468 | return r; |
| 469 | 469 | } |
| r2375 | r2376 | |
| 869 | 869 | |
| 870 | 870 | static READ8_HANDLER(hc11_analog_r) |
| 871 | 871 | { |
| 872 | return | |
| 872 | return | |
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | |
| r2375 | r2376 | |
| 1423 | 1423 | */ |
| 1424 | 1424 | ROM_END |
| 1425 | 1425 | |
| 1426 | ROM_START( sidebs2j ) | |
| 1427 | ROM_REGION(0x200000, REGION_CPU1, 0) /* 68040 code */ | |
| 1428 | ROM_LOAD32_BYTE( "e38-23.36", 0x000000, 0x80000, CRC(b3d8e2d9) SHA1(6de6a51c3d9ace532fa03517bab93101b5a3eaae) ) | |
| 1429 | ROM_LOAD32_BYTE( "e38-24.37", 0x000001, 0x80000, CRC(2a47d80d) SHA1(41b889e4a1397c7f0d4f6ef136ed8abfd7e1ed86) ) | |
| 1430 | ROM_LOAD32_BYTE( "e38-25.38", 0x000002, 0x80000, CRC(f1a8a4df) SHA1(e4cf75969fb0503df2290522194b097f5cb983a3) ) | |
| 1431 | ROM_LOAD32_BYTE( "e38-26.39", 0x000003, 0x80000, CRC(b550fbf2) SHA1(a0a461af7e71c6ad6468cfdee2bc7161ae31bbfb) ) | |
| 1432 | ||
| 1433 | ROM_REGION( 0x180000, REGION_CPU2, 0 ) /* 68000 Code */ | |
| 1434 | ROM_LOAD16_BYTE( "e38-19.30", 0x100001, 0x040000, CRC(3f50cb7b) SHA1(76af65c9b74ede843a3182f79cecda8c3e3febe6) ) | |
| 1435 | ROM_LOAD16_BYTE( "e38-20.31", 0x100000, 0x040000, CRC(d01340e7) SHA1(76ee48d644dc1ec415d47e0df4864c64ac928b9d) ) | |
| 1436 | ||
| 1437 | ROM_REGION( 0x010000, REGION_USER1, 0 ) /* MC68HC11M0 code */ | |
| 1438 | ROM_LOAD( "e17-23.65", 0x000000, 0x010000, CRC(80ac1428) SHA1(5a2a1e60a11ecdb8743c20ddacfb61f9fd00f01c) ) | |
| 1439 | ||
| 1440 | ROM_REGION( 0x00080, REGION_USER2, 0 ) /* eeprom */ | |
| 1441 | ROM_LOAD( "93c46.87", 0x000000, 0x000080, CRC(50fdcce0) SHA1(6e901856755ccdcf478a457c510c0de58683216a) ) | |
| 1442 | ||
| 1443 | ROM_REGION( 0x1800000, REGION_GFX1, 0 ) | |
| 1444 | ROM_LOAD32_WORD( "e38-05.9", 0x0800002, 0x200000, CRC(bda366bf) SHA1(a7558e6d5e4583a2d8e3d2bfa8cabcc459d3ee83) ) | |
| 1445 | ROM_LOAD32_WORD( "e38-13.22", 0x0800000, 0x200000, CRC(1bd7582b) SHA1(35763b9489f995433f66ef72d4f6b6ac67df5480) ) | |
| 1446 | ROM_LOAD32_WORD( "e38-06.10", 0x0c00002, 0x200000, CRC(308d2783) SHA1(22c309273444bc6c1df78069850958a739664998) ) | |
| 1447 | ROM_LOAD32_WORD( "e38-14.23", 0x0c00000, 0x200000, CRC(f1699f27) SHA1(3c9a9cefe6f215fd9f0a9746da97147d14df1da4) ) | |
| 1448 | ROM_LOAD32_WORD( "e38-07.11", 0x1000002, 0x200000, CRC(226ba93d) SHA1(98e6342d070ddd988c1e9bff21afcfb28df86844) ) | |
| 1449 | ROM_LOAD32_WORD( "e38-15.24", 0x1000000, 0x200000, CRC(2853c2e3) SHA1(046dbbd4bcb3b07cddab19a284fee9fe736f8def) ) | |
| 1450 | ROM_LOAD32_WORD( "e38-08.12", 0x1400002, 0x200000, CRC(9c513b32) SHA1(fe26e39d3d65073d23d525bc17771f0c244a38c2) ) | |
| 1451 | ROM_LOAD32_WORD( "e38-16.25", 0x1400000, 0x200000, CRC(fceafae2) SHA1(540ecd5d1aa64c0428a08ea1e4e634e00f7e6bd6) ) | |
| 1452 | ||
| 1453 | ROM_REGION( 0x1000000, REGION_GFX2, 0 ) /* only accessible to the TMS */ | |
| 1454 | ROM_LOAD( "e38-01.5", 0x0000000, 0x200000, CRC(a3c2e2c7) SHA1(538208534f996782167e4cf0d157ad93ce2937bd) ) | |
| 1455 | ROM_LOAD( "e38-02.6", 0x0200000, 0x200000, CRC(ecdfb75a) SHA1(85e7afa321846816fa3bd9074ad9dec95abe23fe) ) | |
| 1456 | ROM_LOAD( "e38-03.7", 0x0400000, 0x200000, CRC(28e9cb59) SHA1(a2651fd81a1263573f868864ee049f8fc4177ffa) ) | |
| 1457 | ROM_LOAD( "e38-04.8", 0x0600000, 0x080000, CRC(26cab05b) SHA1(d5bcf021646dade834840051e0ce083319c53985) ) | |
| 1458 | ROM_RELOAD( 0x680000, 0x80000 ) | |
| 1459 | ROM_RELOAD( 0x700000, 0x80000 ) | |
| 1460 | ROM_RELOAD( 0x780000, 0x80000 ) | |
| 1461 | ROM_LOAD( "e38-09.18", 0x0800000, 0x200000, CRC(03c95a7f) SHA1(fc046cf5fcfcf5648f68af4bed78576f6d67b32f) ) | |
| 1462 | ROM_LOAD( "e38-10.19", 0x0a00000, 0x200000, CRC(0fb06794) SHA1(2d0e3b07ded698235572fe9e907a84d5779ac2c5) ) | |
| 1463 | ROM_LOAD( "e38-11.20", 0x0c00000, 0x200000, CRC(6a312351) SHA1(8037e377f8eef4cc6dd84aec9c829106f0bb130c) ) | |
| 1464 | ROM_LOAD( "e38-12.21", 0x0e00000, 0x080000, CRC(193a5774) SHA1(aa017ae4fec92bb87c0eb94f59d093853ddbabc9) ) | |
| 1465 | ROM_RELOAD( 0xe80000, 0x80000 ) | |
| 1466 | ROM_RELOAD( 0xf00000, 0x80000 ) | |
| 1467 | ROM_RELOAD( 0xf80000, 0x80000 ) | |
| 1468 | ||
| 1469 | ROM_REGION16_BE( 0x1000000, REGION_SOUND1, ROMREGION_ERASE00 ) | |
| 1470 | ROM_LOAD16_BYTE( "e23-15.32", 0x000000, 0x200000, CRC(8955b7c7) SHA1(767626bd5cf6810b0368ee85e487c12ef7e8a23d) ) // from sidebs (redump) | |
| 1471 | ROM_LOAD16_BYTE( "e38-17.33", 0x400000, 0x200000, CRC(61e81c7f) SHA1(aa650bc139685ad456c233b79aa60005a8fd6d79) ) | |
| 1472 | ROM_LOAD16_BYTE( "e38-18.34", 0x800000, 0x200000, CRC(43e2f149) SHA1(32ea9156948a886dda5bd071e9f493ddc2b06212) ) | |
| 1473 | ROM_LOAD16_BYTE( "e38-21.35", 0xc00000, 0x200000, CRC(25373c5f) SHA1(ab9f917dbde7c808be2cd836ce2d3fc558e290f1) ) | |
| 1474 | ||
| 1475 | /* PALS | |
| 1476 | e23-28.18 NOT A ROM | |
| 1477 | e23-27.13 NOT A ROM | |
| 1478 | e23-26.4 NOT A ROM | |
| 1479 | e23-25-1.3 NOT A ROM | |
| 1480 | e23-30.40 NOT A ROM | |
| 1481 | e23-29.39 NOT A ROM | |
| 1482 | e23-31.46 NOT A ROM | |
| 1483 | e23-32-1.51 NOT A ROM | |
| 1484 | e23-34.72 NOT A ROM | |
| 1485 | e23-33.53 NOT A ROM | |
| 1486 | e23-35.110 NOT A ROM | |
| 1487 | e23-38.73 NOT A ROM | |
| 1488 | e23-37.69 NOT A ROM | |
| 1489 | */ | |
| 1490 | ROM_END | |
| 1491 | ||
| 1426 | 1492 | ROM_START( dendeg ) |
| 1427 | 1493 | ROM_REGION(0x200000, REGION_CPU1, 0) /* 68040 code */ |
| 1428 | 1494 | ROM_LOAD32_BYTE( "e35-21.036", 0x000000, 0x80000, CRC(bc70ca97) SHA1(724a24da9d6f163c26e7528ee2c15bd06f2c4382) ) |
| r2375 | r2376 | |
| 1725 | 1791 | GAME( 1998, dendeg2x, dendeg2, taitojc, dendeg, taitojc, ROT0, "Taito", "Densya De Go 2 Ex", GAME_NOT_WORKING ) |
| 1726 | 1792 | GAME( 1996, sidebs, 0, taitojc, sidebs, taitojc, ROT0, "Taito", "Side By Side", GAME_NOT_WORKING ) |
| 1727 | 1793 | GAME( 1997, sidebs2, 0, taitojc, sidebs, taitojc, ROT0, "Taito", "Side By Side 2", GAME_IMPERFECT_GRAPHICS ) |
| 1794 | GAME( 1997, sidebs2j, sidebs2, taitojc, sidebs, taitojc, ROT0, "Taito", "Side By Side 2 (Japan)", GAME_IMPERFECT_GRAPHICS ) | |
| 1728 | 1795 | GAME( 1995, landgear, 0, taitojc, landgear, taitojc, ROT0, "Taito", "Landing Gear", GAME_NOT_WORKING ) |
| 1729 | 1796 | GAME( 1995, dangcurv, 0, taitojc, dangcurv, taitojc, ROT0, "Taito", "Dangerous Curves", GAME_NOT_WORKING ) |
| r2375 | r2376 | |
|---|---|---|
| 177 | 177 | /* input becomes the starting point for the trackball counters */ |
| 178 | 178 | if (((data ^ ctrld) & 0x10) && (data & 0x10)) |
| 179 | 179 | { |
| 180 | UINT8 trackball = readinputport(4); | |
| 181 | UINT8 switches = readinputport(0); | |
| 180 | UINT8 trackball = input_port_read_indexed(machine, 4); | |
| 181 | UINT8 switches = input_port_read_indexed(machine, 0); | |
| 182 | 182 | trackball_offset = ((trackball & 0xf0) - (switches & 0xf0)) | ((trackball - switches) & 0x0f); |
| 183 | 183 | } |
| 184 | 184 | ctrld = data & 0x10; |
| r2375 | r2376 | |
| 190 | 190 | /* if ctrld is high, the /ld signal on the LS191 is NOT set, meaning that the trackball is counting */ |
| 191 | 191 | if (ctrld) |
| 192 | 192 | { |
| 193 | UINT8 trackball = | |
| 193 | UINT8 trackball = | |
| 194 | 194 | return ((trackball & 0xf0) - (trackball_offset & 0xf0)) | ((trackball - trackball_offset) & 0x0f); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /* otherwise, the LS191 is simply passing through the raw switch inputs */ |
| 198 | 198 | else |
| 199 | return | |
| 199 | return | |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 |
| r2375 | r2376 | |
|---|---|---|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | |
| 386 | static void get_pens(pen_t *pens) | |
| 386 | static void get_pens(running_machine *machine, pen_t *pens) | |
| 387 | 387 | { |
| 388 | 388 | static const int resistances_wg[] = { 750, 0 }; |
| 389 | 389 | static const int resistances_el[] = { 1.0 / ((1.0 / 750.0) + (1.0 / 360.0)), 0 }; |
| r2375 | r2376 | |
| 391 | 391 | int color; |
| 392 | 392 | double color_weights[2]; |
| 393 | 393 | |
| 394 | if ( | |
| 394 | if ( | |
| 395 | 395 | compute_resistor_weights(0, 0xff, -1.0, |
| 396 | 396 | 2, resistances_wg, color_weights, 0, 270, |
| 397 | 397 | 2, resistances_wg, color_weights, 0, 270, |
| r2375 | r2376 | |
| 423 | 423 | pen_t pens[NUM_PENS]; |
| 424 | 424 | offs_t offs; |
| 425 | 425 | |
| 426 | get_pens(pens); | |
| 426 | get_pens(screen->machine, pens); | |
| 427 | 427 | |
| 428 | 428 | for (offs = 0; offs < berzerk_videoram_size; offs++) |
| 429 | 429 | { |
| r2375 | r2376 | |
|---|---|---|
| 133 | 133 | { |
| 134 | 134 | int joy; |
| 135 | 135 | |
| 136 | joy = | |
| 136 | joy = | |
| 137 | 137 | if (joy & 1) return -63; |
| 138 | 138 | if (joy & 2) return 63; |
| 139 | return | |
| 139 | return | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | static READ8_HANDLER( tehkanwc_track_1_r ) |
| 143 | 143 | { |
| 144 | 144 | int joy; |
| 145 | 145 | |
| 146 | joy = | |
| 146 | joy = | |
| 147 | 147 | if (joy & 1) return -63; |
| 148 | 148 | if (joy & 2) return 63; |
| 149 | return | |
| 149 | return | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | static WRITE8_HANDLER( tehkanwc_track_0_reset_w ) |
| 153 | 153 | { |
| 154 | 154 | /* reset the trackball counters */ |
| 155 | track0[offset] = | |
| 155 | track0[offset] = | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | static WRITE8_HANDLER( tehkanwc_track_1_reset_w ) |
| 159 | 159 | { |
| 160 | 160 | /* reset the trackball counters */ |
| 161 | track1[offset] = | |
| 161 | track1[offset] = | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 |
| r2375 | r2376 | |
|---|---|---|
| 26 | 26 | - sprite / background priority ( see level 1: birds walk through |
| 27 | 27 | branches of different trees ) |
| 28 | 28 | - see the beginning of level 3: background screwed |
| 29 | - gray tiles around the title in Top Secret | |
| 29 | 30 | |
| 30 | 31 | ToDo: |
| 31 | 32 | - get rid of input port hack |
| r2375 | r2376 | |
| 96 | 97 | |
| 97 | 98 | static WRITE16_HANDLER( bionicc_mpu_trigger_w ) |
| 98 | 99 | { |
| 99 | data = | |
| 100 | data = | |
| 100 | 101 | bionicc_inp[0] = data ^ 0x0f; |
| 101 | 102 | |
| 102 | data = | |
| 103 | data = | |
| 103 | 104 | bionicc_inp[1] = data ^ 0xff; |
| 104 | 105 | |
| 105 | data = | |
| 106 | data = | |
| 106 | 107 | bionicc_inp[2] = data ^ 0xff; |
| 107 | 108 | } |
| 108 | 109 |
| r2375 | r2376 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | static READ8_HANDLER( citycon_in_r ) |
| 23 | 23 | { |
| 24 | return | |
| 24 | return | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 |
| r2375 | r2376 | |
|---|---|---|
| 229 | 229 | |
| 230 | 230 | /* screen flip multiplexes controls */ |
| 231 | 231 | if (suprridr_is_screen_flipped()) |
| 232 | ret = | |
| 232 | ret = | |
| 233 | 233 | else |
| 234 | ret = | |
| 234 | ret = | |
| 235 | 235 | |
| 236 | 236 | return ret; |
| 237 | 237 | } |
| r2375 | r2376 | |
| 352 | 352 | static MACHINE_DRIVER_START( suprridr ) |
| 353 | 353 | |
| 354 | 354 | /* basic machine hardware */ |
| 355 | MDRV_CPU_ADD(Z80, 1 | |
| 355 | MDRV_CPU_ADD(Z80, XTAL_49_152MHz | |
| 356 | 356 | MDRV_CPU_PROGRAM_MAP(main_map,0) |
| 357 | 357 | MDRV_CPU_IO_MAP(main_portmap,0) |
| 358 | 358 | MDRV_CPU_VBLANK_INT("main", main_nmi_gen) |
| 359 | 359 | |
| 360 | MDRV_CPU_ADD(Z80, 10000000/4) /* | |
| 360 | MDRV_CPU_ADD(Z80, 10000000/4) /* 2.5 | |
| 361 | 361 | /* audio CPU */ |
| 362 | 362 | MDRV_CPU_PROGRAM_MAP(sound_map,0) |
| 363 | 363 | MDRV_CPU_IO_MAP(sound_portmap,0) |
| r2375 | r2376 | |
| 380 | 380 | /* sound hardware */ |
| 381 | 381 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 382 | 382 | |
| 383 | MDRV_SOUND_ADD(AY8910, 1 | |
| 383 | MDRV_SOUND_ADD(AY8910, XTAL_49_152MHz | |
| 384 | 384 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 385 | 385 | |
| 386 | MDRV_SOUND_ADD(AY8910, 1 | |
| 386 | MDRV_SOUND_ADD(AY8910, XTAL_49_152MHz | |
| 387 | 387 | MDRV_SOUND_CONFIG(ay8910_interface) |
| 388 | 388 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 389 | 389 | MACHINE_DRIVER_END |
| r2375 | r2376 | |
|---|---|---|
| 101 | 101 | |
| 102 | 102 | ***************************************************************************/ |
| 103 | 103 | |
| 104 | static int psikyo_readcoinport(int has_mcu) | |
| 104 | static int psikyo_readcoinport(running_machine *machine, int has_mcu) | |
| 105 | 105 | { |
| 106 | int ret = | |
| 106 | int ret = | |
| 107 | 107 | |
| 108 | 108 | if (has_mcu) |
| 109 | 109 | { |
| r2375 | r2376 | |
| 142 | 142 | { |
| 143 | 143 | switch(offset) |
| 144 | 144 | { |
| 145 | case 0x0: return (readinputport(0) << 16) | 0xffff; | |
| 146 | case 0x1: return (readinputport(2) << 16) | readinputport(4); | |
| 147 | case 0x2: return (psikyo_readcoinport(0) << 16) | readinputport(3); | |
| 145 | case 0x0: return (input_port_read_indexed(machine, 0) << 16) | 0xffff; | |
| 146 | case 0x1: return (input_port_read_indexed(machine, 2) << 16) | input_port_read_indexed(machine, 4); | |
| 147 | case 0x2: return (psikyo_readcoinport(machine, 0) << 16) | input_port_read_indexed(machine, 3); | |
| 148 | 148 | default: logerror("PC %06X - Read input %02X !\n", activecpu_get_pc(), offset*2); |
| 149 | 149 | return 0; |
| 150 | 150 | } |
| r2375 | r2376 | |
| 154 | 154 | { |
| 155 | 155 | switch(offset) |
| 156 | 156 | { |
| 157 | case 0x0: return (readinputport(0) << 16) | psikyo_readcoinport(0); | |
| 158 | case 0x1: return (readinputport(2) << 16) | readinputport(3); | |
| 157 | case 0x0: return (input_port_read_indexed(machine, 0) << 16) | psikyo_readcoinport(machine, 0); | |
| 158 | case 0x1: return (input_port_read_indexed(machine, 2) << 16) | input_port_read_indexed(machine, 3); | |
| 159 | 159 | default: logerror("PC %06X - Read input %02X !\n", activecpu_get_pc(), offset*2); |
| 160 | 160 | return 0; |
| 161 | 161 | } |
| r2375 | r2376 | |
| 310 | 310 | { |
| 311 | 311 | switch(offset) |
| 312 | 312 | { |
| 313 | case 0x0: return (readinputport(0) << 16) | psikyo_readcoinport(1); | |
| 314 | case 0x1: return (((readinputport(2) << 16) | readinputport(3)) & 0xffff000f) | s1945_mcu_r(machine, offset-1, mem_mask); | |
| 313 | case 0x0: return (input_port_read_indexed(machine, 0) << 16) | psikyo_readcoinport(machine, 1); | |
| 314 | case 0x1: return (((input_port_read_indexed(machine, 2) << 16) | input_port_read_indexed(machine, 3)) & 0xffff000f) | s1945_mcu_r(machine, offset-1, mem_mask); | |
| 315 | 315 | case 0x2: return s1945_mcu_r(machine, offset-1, mem_mask); |
| 316 | 316 | default: logerror("PC %06X - Read input %02X !\n", activecpu_get_pc(), offset*2); |
| 317 | 317 | return 0; |
| r2375 | r2376 | |
|---|---|---|
| 137 | 137 | |
| 138 | 138 | bit = EEPROM_read_bit() << 7; |
| 139 | 139 | |
| 140 | return (input_port_ | |
| 140 | return (input_port_ | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | static READ16_HANDLER( hotmind_port2_r ) |
| r2375 | r2376 | |
| 146 | 146 | |
| 147 | 147 | bit = EEPROM_read_bit() << 7; |
| 148 | 148 | |
| 149 | return (input_port_ | |
| 149 | return (input_port_ | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | static WRITE16_HANDLER( wbeachvl_coin_eeprom_w ) |
| r2375 | r2376 | |
|---|---|---|
| 1058 | 1058 | { |
| 1059 | 1059 | if(model3_controls_bank & 0x1) { |
| 1060 | 1060 | eeprom_bit = EEPROM_read_bit() << 5; |
| 1061 | return (( | |
| 1061 | return (( | |
| 1062 | 1062 | } |
| 1063 | 1063 | else { |
| 1064 | return ( | |
| 1064 | return ( | |
| 1065 | 1065 | } |
| 1066 | 1066 | } |
| 1067 | 1067 | break; |
| r2375 | r2376 | |
| 1069 | 1069 | case 1: |
| 1070 | 1070 | if (ACCESSING_BITS_56_63) |
| 1071 | 1071 | { |
| 1072 | return (UINT64) | |
| 1072 | return (UINT64) | |
| 1073 | 1073 | } |
| 1074 | 1074 | else if (ACCESSING_BITS_24_31) |
| 1075 | 1075 | { |
| 1076 | return | |
| 1076 | return | |
| 1077 | 1077 | } |
| 1078 | 1078 | break; |
| 1079 | 1079 | |
| r2375 | r2376 | |
| 1107 | 1107 | case 7: |
| 1108 | 1108 | if (ACCESSING_BITS_24_31) /* ADC Data read */ |
| 1109 | 1109 | { |
| 1110 | UINT8 adc_data = | |
| 1110 | UINT8 adc_data = | |
| 1111 | 1111 | adc_channel++; |
| 1112 | 1112 | adc_channel &= 0x7; |
| 1113 | 1113 | return (UINT64)adc_data << 24; |
| r2375 | r2376 | |
| 1159 | 1159 | switch(lightgun_reg_sel) /* read lightrun register */ |
| 1160 | 1160 | { |
| 1161 | 1161 | case 0: /* player 1 gun X-position, lower 8-bits */ |
| 1162 | model3_serial_fifo2 = | |
| 1162 | model3_serial_fifo2 = | |
| 1163 | 1163 | break; |
| 1164 | 1164 | case 1: /* player 1 gun X-position, upper 2-bits */ |
| 1165 | model3_serial_fifo2 = ( | |
| 1165 | model3_serial_fifo2 = ( | |
| 1166 | 1166 | break; |
| 1167 | 1167 | case 2: /* player 1 gun Y-position, lower 8-bits */ |
| 1168 | model3_serial_fifo2 = | |
| 1168 | model3_serial_fifo2 = | |
| 1169 | 1169 | break; |
| 1170 | 1170 | case 3: /* player 1 gun Y-position, upper 2-bits */ |
| 1171 | model3_serial_fifo2 = ( | |
| 1171 | model3_serial_fifo2 = ( | |
| 1172 | 1172 | break; |
| 1173 | 1173 | case 4: /* player 2 gun X-position, lower 8-bits */ |
| 1174 | model3_serial_fifo2 = | |
| 1174 | model3_serial_fifo2 = | |
| 1175 | 1175 | break; |
| 1176 | 1176 | case 5: /* player 2 gun X-position, upper 2-bits */ |
| 1177 | model3_serial_fifo2 = ( | |
| 1177 | model3_serial_fifo2 = ( | |
| 1178 | 1178 | break; |
| 1179 | 1179 | case 6: /* player 2 gun Y-position, lower 8-bits */ |
| 1180 | model3_serial_fifo2 = | |
| 1180 | model3_serial_fifo2 = | |
| 1181 | 1181 | break; |
| 1182 | 1182 | case 7: /* player 2 gun Y-position, upper 2-bits */ |
| 1183 | model3_serial_fifo2 = ( | |
| 1183 | model3_serial_fifo2 = ( | |
| 1184 | 1184 | break; |
| 1185 | 1185 | case 8: /* gun offscreen (bit set = gun offscreen, bit clear = gun on screen) */ |
| 1186 | 1186 | model3_serial_fifo2 = 0; /* bit 0 = player 1, bit 1 = player 2 */ |
| 1187 | if( | |
| 1187 | if( | |
| 1188 | 1188 | model3_serial_fifo2 |= 0x01; |
| 1189 | 1189 | } |
| 1190 | 1190 | break; |
| r2375 | r2376 | |
|---|---|---|
| 2061 | 2061 | else if(kb_cmd==5) |
| 2062 | 2062 | { |
| 2063 | 2063 | UINT32 protvalue; |
| 2064 | protvalue = 0x89911400| | |
| 2064 | protvalue = 0x89911400| | |
| 2065 | 2065 | res=(protvalue>>(8*(ptr-1)))&0xff; |
| 2066 | 2066 | |
| 2067 | 2067 | } |
| r2375 | r2376 | |
| 2140 | 2140 | { |
| 2141 | 2141 | if (PGMLOGERROR) logerror("prot_r %04x, %04x\n", offset,ddp2_protram[offset]); |
| 2142 | 2142 | |
| 2143 | if (offset == 0x02/2) return | |
| 2143 | if (offset == 0x02/2) return | |
| 2144 | 2144 | |
| 2145 | 2145 | if (offset == 0x1f00/2) return 0; |
| 2146 | 2146 | |
| r2375 | r2376 | |
| 2252 | 2252 | res=olds_cmd3; |
| 2253 | 2253 | else if(kb_cmd==5) |
| 2254 | 2254 | { |
| 2255 | UINT32 protvalue = 0x900000| | |
| 2255 | UINT32 protvalue = 0x900000| | |
| 2256 | 2256 | res=(protvalue>>(8*(ptr-1)))&0xff; // includes region 1 = taiwan , 2 = china, 3 = japan (title = orlegend special), 4 = korea, 5 = hongkong, 6 = world |
| 2257 | 2257 | |
| 2258 | 2258 | } |
| r2375 | r2376 | |
|---|---|---|
| 98 | 98 | { |
| 99 | 99 | gameplan_state *state = machine->driver_data; |
| 100 | 100 | |
| 101 | return | |
| 101 | return | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 |
| r2375 | r2376 | |
|---|---|---|
| 111 | 111 | |
| 112 | 112 | static INTERRUPT_GEN( capbowl_interrupt ) |
| 113 | 113 | { |
| 114 | if ( | |
| 114 | if ( | |
| 115 | 115 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); /* trigger self test */ |
| 116 | 116 | } |
| 117 | 117 |
| r2375 | r2376 | |
|---|---|---|
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | 1194 | |
| 1195 | static STATE_POSTLOAD( darius_postload ) | |
| 1196 | { | |
| 1197 | parse_control(); | |
| 1198 | reset_sound_region(); | |
| 1199 | } | |
| 1200 | ||
| 1195 | 1201 | static MACHINE_START( darius ) |
| 1196 | 1202 | { |
| 1197 | 1203 | state_save_register_global(cpua_ctrl); |
| 1198 | state_save_register_func_postload(parse_control); | |
| 1199 | 1204 | |
| 1200 | 1205 | // (there are other sound vars that may need saving too) // |
| 1201 | 1206 | state_save_register_global(banknum); |
| 1202 | 1207 | state_save_register_global(adpcm_command); |
| 1203 | 1208 | state_save_register_global(nmi_enable); |
| 1204 | state_save_register_ | |
| 1209 | state_save_register_ | |
| 1205 | 1210 | } |
| 1206 | 1211 | |
| 1207 | 1212 |
| r2375 | r2376 | |
|---|---|---|
| 146 | 146 | static READ8_HANDLER(controls_r) |
| 147 | 147 | { |
| 148 | 148 | int data=7; |
| 149 | switch(input_port_ | |
| 149 | switch(input_port_ | |
| 150 | 150 | { |
| 151 | 151 | case 0x01: data=1; break; |
| 152 | 152 | case 0x02: data=2; break; |
| r2375 | r2376 | |
| 156 | 156 | case 0x20: data=6; break; |
| 157 | 157 | case 0x40: data=0; break; |
| 158 | 158 | } |
| 159 | return (input_port_ | |
| 159 | return (input_port_ | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | static ADDRESS_MAP_START( ssingles_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2375 | r2376 | |
|---|---|---|
| 313 | 313 | switch (offset) |
| 314 | 314 | { |
| 315 | 315 | case 2: /* $90 -- sound return */ |
| 316 | result = 0xffff0000 | | |
| 316 | result = 0xffff0000 | | |
| 317 | 317 | result &= ~0x0002; |
| 318 | 318 | if (dcs_control_r() & 0x800) |
| 319 | 319 | result |= 0x0002; |
| r2375 | r2376 | |
| 322 | 322 | case 0: /* $80 */ |
| 323 | 323 | case 1: /* $88 */ |
| 324 | 324 | case 3: /* $98 */ |
| 325 | result = 0xffff0000 | | |
| 325 | result = 0xffff0000 | | |
| 326 | 326 | break; |
| 327 | 327 | |
| 328 | 328 | case 4: /* $a0 */ |
| 329 | result = 0xffff0000 | | |
| 329 | result = 0xffff0000 | | |
| 330 | 330 | if (activecpu_get_pc() == 0x802d428) |
| 331 | 331 | cpu_spinuntil_int(); |
| 332 | 332 | break; |
| r2375 | r2376 | |
|---|---|---|
| 122 | 122 | |
| 123 | 123 | bit = EEPROM_read_bit() << 7; |
| 124 | 124 | |
| 125 | return (input_port_ | |
| 125 | return (input_port_ | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | static WRITE8_HANDLER( eeprom_cs_w ) |
| r2375 | r2376 | |
|---|---|---|
| 270 | 270 | |
| 271 | 271 | static READ32_HANDLER( input_0_r ) |
| 272 | 272 | { |
| 273 | return | |
| 273 | return | |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | |
| 277 | 277 | static READ32_HANDLER( input_1_r ) |
| 278 | 278 | { |
| 279 | return | |
| 279 | return | |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | |
| 283 | 283 | static READ32_HANDLER( input_2_r ) |
| 284 | 284 | { |
| 285 | int result = | |
| 285 | int result = | |
| 286 | 286 | if (atarigen_sound_to_cpu_ready) result ^= 0x10; |
| 287 | 287 | if (atarigen_cpu_to_sound_ready) result ^= 0x20; |
| 288 | 288 | return result; |
| r2375 | r2376 | |
| 291 | 291 | |
| 292 | 292 | static READ32_HANDLER( input_3_r ) |
| 293 | 293 | { |
| 294 | return | |
| 294 | return | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 |
| r2375 | r2376 | |
|---|---|---|
| 44 | 44 | xxxx - input port #2 |
| 45 | 45 | xxxx - dip switches (2x8 bits) (multiplexed) |
| 46 | 46 | */ |
| 47 | int retval=input_port_ | |
| 47 | int retval=input_port_ | |
| 48 | 48 | switch(mux_port&0x30) |
| 49 | 49 | { |
| 50 | case 0x00: retval|=((input_port_4_r(machine,0)&1)<<4)|((input_port_4_r(machine,0)&0x10)<<1)|((input_port_5_r(machine,0)&1)<<6)|((input_port_5_r(machine,0)&0x10)<<3);break; | |
| 51 | case 0x10: retval|=((input_port_4_r(machine,0)&2)<<3)|((input_port_4_r(machine,0)&0x20) )|((input_port_5_r(machine,0)&2)<<5)|((input_port_5_r(machine,0)&0x20)<<2);break; | |
| 52 | case 0x20: retval|=((input_port_4_r(machine,0)&4)<<2)|((input_port_4_r(machine,0)&0x40)>>1)|((input_port_5_r(machine,0)&4)<<4)|((input_port_5_r(machine,0)&0x40)<<1);break; | |
| 53 | case 0x30: retval|=((input_port_4_r(machine,0)&8)<<1)|((input_port_4_r(machine,0)&0x80)>>2)|((input_port_5_r(machine,0)&8)<<3)|((input_port_5_r(machine,0)&0x80) );break; | |
| 50 | case 0x00: retval|=((input_port_read_indexed(machine, 4)&1)<<4)|((input_port_read_indexed(machine, 4)&0x10)<<1)|((input_port_read_indexed(machine, 5)&1)<<6)|((input_port_read_indexed(machine, 5)&0x10)<<3);break; | |
| 51 | case 0x10: retval|=((input_port_read_indexed(machine, 4)&2)<<3)|((input_port_read_indexed(machine, 4)&0x20) )|((input_port_read_indexed(machine, 5)&2)<<5)|((input_port_read_indexed(machine, 5)&0x20)<<2);break; | |
| 52 | case 0x20: retval|=((input_port_read_indexed(machine, 4)&4)<<2)|((input_port_read_indexed(machine, 4)&0x40)>>1)|((input_port_read_indexed(machine, 5)&4)<<4)|((input_port_read_indexed(machine, 5)&0x40)<<1);break; | |
| 53 | case 0x30: retval|=((input_port_read_indexed(machine, 4)&8)<<1)|((input_port_read_indexed(machine, 4)&0x80)>>2)|((input_port_read_indexed(machine, 5)&8)<<3)|((input_port_read_indexed(machine, 5)&0x80) );break; | |
| 54 | 54 | } |
| 55 | 55 | return retval; |
| 56 | 56 | } |
| r2375 | r2376 | |
|---|---|---|
| 608 | 608 | K054539_init_flags(0, K054539_REVERSE_STEREO); |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | static STATE_POSTLOAD( xexex_postload ) | |
| 612 | { | |
| 613 | parse_control2(); | |
| 614 | reset_sound_region(); | |
| 615 | } | |
| 616 | ||
| 611 | 617 | static MACHINE_START( xexex ) |
| 612 | 618 | { |
| 613 | 619 | state_save_register_global(cur_control2); |
| 614 | state_save_register_func_postload(parse_control2); | |
| 615 | 620 | state_save_register_global(cur_sound_region); |
| 616 | state_save_register_ | |
| 621 | state_save_register_ | |
| 617 | 622 | |
| 618 | 623 | resume_trigger = 1000; |
| 619 | 624 |
| r2375 | r2376 | |
|---|---|---|
| 133 | 133 | //might need to be reversed for cocktail stuff |
| 134 | 134 | |
| 135 | 135 | /* x/y multiplexed */ |
| 136 | return | |
| 136 | return | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | static READ8_HANDLER( marinedt_coll_r ) |
| r2375 | r2376 | |
|---|---|---|
| 96 | 96 | |
| 97 | 97 | static READ16_HANDLER( special_port1_r ) |
| 98 | 98 | { |
| 99 | int temp = | |
| 99 | int temp = | |
| 100 | 100 | if (atarigen_cpu_to_sound_ready) temp ^= 0x0040; |
| 101 | 101 | if (atarigen_get_hblank(machine->primary_screen)) temp ^= 0x0010; |
| 102 | 102 | return temp; |
| r2375 | r2376 | |
|---|---|---|
| 342 | 342 | |
| 343 | 343 | static DRIVER_INIT( konamigq ) |
| 344 | 344 | { |
| 345 | psx_driver_init(); | |
| 345 | psx_driver_init(machine); | |
| 346 | 346 | |
| 347 | 347 | m_p_n_pcmram = memory_region( REGION_SOUND1 ) + 0x80000; |
| 348 | 348 | } |
| r2375 | r2376 | |
|---|---|---|
| 205 | 205 | /*******************************************************/ |
| 206 | 206 | |
| 207 | 207 | static READ8_HANDLER( mrflea_input0_r ){ |
| 208 | if( mrflea_select0 == 0x0f ) return readinputport(0); | |
| 209 | if( mrflea_select0 == 0x0e ) return readinputport(1); | |
| 208 | if( mrflea_select0 == 0x0f ) return input_port_read_indexed(machine, 0); | |
| 209 | if( mrflea_select0 == 0x0e ) return input_port_read_indexed(machine, 1); | |
| 210 | 210 | return 0x00; |
| 211 | 211 | } |
| 212 | 212 | |
| r2375 | r2376 | |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | static READ8_HANDLER( mrflea_input2_r ){ |
| 218 | if( mrflea_select2 == 0x0f ) return readinputport(2); | |
| 219 | if( mrflea_select2 == 0x0e ) return readinputport(3); | |
| 218 | if( mrflea_select2 == 0x0f ) return input_port_read_indexed(machine, 2); | |
| 219 | if( mrflea_select2 == 0x0e ) return input_port_read_indexed(machine, 3); | |
| 220 | 220 | return 0x00; |
| 221 | 221 | } |
| 222 | 222 |
| r2375 | r2376 | |
|---|---|---|
| 1782 | 1782 | |
| 1783 | 1783 | static READ32_HANDLER( cps3_io1_r ) |
| 1784 | 1784 | { |
| 1785 | return | |
| 1785 | return | |
| 1786 | 1786 | } |
| 1787 | 1787 | |
| 1788 | 1788 | static READ32_HANDLER( cps3_io2_r ) |
| 1789 | 1789 | { |
| 1790 | return | |
| 1790 | return | |
| 1791 | 1791 | } |
| 1792 | 1792 | |
| 1793 | 1793 | // this seems to be dma active flags, and maybe vblank... not if it is anything else |
| r2375 | r2376 | |
|---|---|---|
| 156 | 156 | |
| 157 | 157 | static READ16_HANDLER( mcatadv_dsw_r ) |
| 158 | 158 | { |
| 159 | return | |
| 159 | return | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | static WRITE16_HANDLER( mcat_soundlatch_w ) |
| r2375 | r2376 | |
|---|---|---|
| 87 | 87 | |
| 88 | 88 | static READ8_HANDLER( inputs_r ) |
| 89 | 89 | { |
| 90 | return ( | |
| 90 | return ( | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | static READ8_HANDLER( switches_r ) |
| 95 | 95 | { |
| 96 | 96 | static const UINT8 switch_shuffle[8] = { 2,5,4,3,0,1,6,7 }; |
| 97 | return ( | |
| 97 | return ( | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
| r2375 | r2376 | |
| 154 | 154 | if (port_tag_to_index("ANALOGX") != -1) |
| 155 | 155 | { |
| 156 | 156 | int xval = (INT16)(cpunum_get_reg(0, CCPU_X) << 4) >> 4; |
| 157 | return ( | |
| 157 | return ( | |
| 158 | 158 | } |
| 159 | 159 | return 0; |
| 160 | 160 | } |
| r2375 | r2376 | |
| 173 | 173 | int delta_wheel; |
| 174 | 174 | |
| 175 | 175 | /* the shift register is cleared once per 'frame' */ |
| 176 | delta_wheel = (INT8) | |
| 176 | delta_wheel = (INT8) | |
| 177 | 177 | if (delta_wheel > 3) |
| 178 | 178 | delta_wheel = 3; |
| 179 | 179 | else if (delta_wheel < -3) |
| r2375 | r2376 | |
| 186 | 186 | static READ8_HANDLER( speedfrk_gear_r ) |
| 187 | 187 | { |
| 188 | 188 | static int gear = 0x0e; |
| 189 | int gearval = | |
| 189 | int gearval = | |
| 190 | 190 | |
| 191 | 191 | /* check the fake gear input port and determine the bit settings for the gear */ |
| 192 | 192 | if ((gearval & 0x0f) != 0x0f) |
| 193 | 193 | gear = gearval & 0x0f; |
| 194 | 194 | |
| 195 | 195 | /* add the start key into the mix -- note that it overlaps 4th gear */ |
| 196 | if (!( | |
| 196 | if (!( | |
| 197 | 197 | gear &= ~0x08; |
| 198 | 198 | |
| 199 | 199 | return (gear >> offset) & 1; |
| r2375 | r2376 | |
| 239 | 239 | { |
| 240 | 240 | /* handle special keys first */ |
| 241 | 241 | if (sundance_port_map[offset].portname) |
| 242 | return ( | |
| 242 | return ( | |
| 243 | 243 | else |
| 244 | return ( | |
| 244 | return ( | |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | |
| r2375 | r2376 | |
| 254 | 254 | |
| 255 | 255 | static READ8_HANDLER( boxingb_dial_r ) |
| 256 | 256 | { |
| 257 | int value = | |
| 257 | int value = | |
| 258 | 258 | if (!mux_select) offset += 4; |
| 259 | 259 | return (value >> offset) & 1; |
| 260 | 260 | } |
| r2375 | r2376 | |
|---|---|---|
| 721 | 721 | } |
| 722 | 722 | if (mcu_data == 0xff) mcu_data = 0x10; |
| 723 | 723 | else mcu_data = 0x00; |
| 724 | return ( mcu_data | input_port_ | |
| 724 | return ( mcu_data | input_port_ | |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | static READ16_HANDLER( pipibibi_z80_status_r ) |
| r2375 | r2376 | |
| 741 | 741 | { |
| 742 | 742 | INT8 value, new_value; |
| 743 | 743 | |
| 744 | new_value = input_port_ | |
| 744 | new_value = input_port_ | |
| 745 | 745 | if (new_value == old_p1_paddle_h) return 0; |
| 746 | 746 | value = new_value - old_p1_paddle_h; |
| 747 | 747 | old_p1_paddle_h = new_value; |
| r2375 | r2376 | |
| 752 | 752 | { |
| 753 | 753 | INT8 value, new_value; |
| 754 | 754 | |
| 755 | new_value = input_port_ | |
| 755 | new_value = input_port_ | |
| 756 | 756 | if (new_value == old_p2_paddle_h) return 0; |
| 757 | 757 | value = new_value - old_p2_paddle_h; |
| 758 | 758 | old_p2_paddle_h = new_value; |
| r2375 | r2376 | |
|---|---|---|
| 110 | 110 | { |
| 111 | 111 | if (~keyb & (1 << i)) |
| 112 | 112 | { |
| 113 | res = | |
| 113 | res = | |
| 114 | 114 | break; |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | res |= ( | |
| 118 | res |= ( | |
| 119 | 119 | |
| 120 | 120 | if (nvram_init_count) |
| 121 | 121 | { |
| r2375 | r2376 | |
|---|---|---|
| 220 | 220 | ***************************************************************************/ |
| 221 | 221 | static UINT16 *mcu_ram, jchan_mcu_com[4]; |
| 222 | 222 | |
| 223 | static void jchan_mcu_run( | |
| 223 | static void jchan_mcu_run(running_machine *machine) | |
| 224 | 224 | { |
| 225 | 225 | UINT16 mcu_command = mcu_ram[0x0010/2]; /* command nb */ |
| 226 | 226 | UINT16 mcu_offset = mcu_ram[0x0012/2] / 2; /* offset in shared RAM where MCU will write */ |
| r2375 | r2376 | |
| 302 | 302 | |
| 303 | 303 | case 0x03: // DSW |
| 304 | 304 | { |
| 305 | mcu_ram[mcu_offset] = | |
| 305 | mcu_ram[mcu_offset] = | |
| 306 | 306 | logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n",activecpu_get_pc(),mcu_command,mcu_offset*2); |
| 307 | 307 | } |
| 308 | 308 | break; |
| r2375 | r2376 | |
| 377 | 377 | if (jchan_mcu_com[3] != 0xFFFF) return; \ |
| 378 | 378 | \ |
| 379 | 379 | memset(jchan_mcu_com, 0, 4 * sizeof( UINT16 ) ); \ |
| 380 | jchan_mcu_run(); \ | |
| 380 | jchan_mcu_run(machine); \ | |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | JCHAN_MCU_COM_W(0) |
| r2375 | r2376 | |
| 455 | 455 | { |
| 456 | 456 | switch(offset) |
| 457 | 457 | { |
| 458 | case 0/2: return readinputport(0); // Player 1 controls | |
| 459 | case 2/2: return readinputport(1); // Player 2 controls | |
| 458 | case 0/2: return input_port_read_indexed(machine, 0); // Player 1 controls | |
| 459 | case 2/2: return input_port_read_indexed(machine, 1); // Player 2 controls | |
| 460 | 460 | default: logerror("jchan_ctrl_r unknown!"); break; |
| 461 | 461 | } |
| 462 | 462 | return jchan_ctrl[offset]; |
| r2375 | r2376 | |
|---|---|---|
| 83 | 83 | |
| 84 | 84 | static READ8_HANDLER( sgladiat_inp0_r ) |
| 85 | 85 | { |
| 86 | return( | |
| 86 | return( | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | static WRITE8_HANDLER( sglatiat_flipscreen_w ) |
| r2375 | r2376 | |
|---|---|---|
| 688 | 688 | K007232_set_bank( 0, 0, ~data&1 ); //* (wecleman062gre) |
| 689 | 689 | } |
| 690 | 690 | |
| 691 | static ADDRESS_MAP_START( wecleman_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 692 | AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) // ROM | |
| 693 | AM_RANGE(0x8000, 0x83ff) AM_READ(SMH_RAM) // RAM | |
| 694 | AM_RANGE(0x9000, 0x9000) AM_READ(multiply_r) // Protection | |
| 695 | AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) // From main CPU | |
| 696 | AM_RANGE(0xb000, 0xb00d) AM_READ(K007232_read_port_0_r) // K007232 (Reading offset 5/b triggers the sample) | |
| 697 | AM_RANGE(0xc001, 0xc001) AM_READ(YM2151_status_port_0_r) // YM2151 | |
| 698 | ADDRESS_MAP_END | |
| 699 | ||
| 700 | static ADDRESS_MAP_START( wecleman_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 701 | AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) // ROM | |
| 702 | AM_RANGE(0x8000, 0x83ff) AM_WRITE(SMH_RAM) // RAM | |
| 691 | static ADDRESS_MAP_START( wecleman_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 692 | AM_RANGE(0x0000, 0x7fff) AM_ROM | |
| 693 | AM_RANGE(0x8000, 0x83ff) AM_RAM | |
| 703 | 694 | AM_RANGE(0x8500, 0x8500) AM_WRITE(SMH_NOP) // incresed with speed (global volume)? |
| 695 | AM_RANGE(0x9000, 0x9000) AM_READ(multiply_r) // Protection | |
| 704 | 696 | AM_RANGE(0x9000, 0x9001) AM_WRITE(multiply_w) // Protection |
| 705 | 697 | AM_RANGE(0x9006, 0x9006) AM_WRITE(SMH_NOP) // ? |
| 706 | AM_RANGE(0xb000, 0xb00d) AM_WRITE(K007232_write_port_0_w) // K007232 | |
| 698 | AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) // From main CPU | |
| 699 | AM_RANGE(0xb000, 0xb00d) AM_READWRITE(K007232_read_port_0_r, K007232_write_port_0_w) // K007232 (Reading offset 5/b triggers the sample) | |
| 707 | 700 | AM_RANGE(0xc000, 0xc000) AM_WRITE(YM2151_register_port_0_w) // YM2151 |
| 708 | AM_RANGE(0xc001, 0xc001) AM_WRITE(YM2151_data_port_0_w) | |
| 701 | AM_RANGE(0xc001, 0xc001) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w) | |
| 709 | 702 | AM_RANGE(0xf000, 0xf000) AM_WRITE(wecleman_K00723216_bank_w) // Samples banking |
| 710 | 703 | ADDRESS_MAP_END |
| 711 | 704 | |
| r2375 | r2376 | |
| 803 | 796 | HOTCHASE_K007232_RW(1) |
| 804 | 797 | HOTCHASE_K007232_RW(2) |
| 805 | 798 | |
| 806 | static ADDRESS_MAP_START( hotchase_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 807 | AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM) // RAM | |
| 808 | AM_RANGE(0x1000, 0x100d) AM_READ(hotchase_K007232_0_r) // 3 x K007232 | |
| 809 | AM_RANGE(0x2000, 0x200d) AM_READ(hotchase_K007232_1_r) | |
| 810 | AM_RANGE(0x3000, 0x300d) AM_READ(hotchase_K007232_2_r) | |
| 811 | AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r) // From main CPU (Read on IRQ) | |
| 812 | AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) // ROM | |
| 813 | ADDRESS_MAP_END | |
| 814 | ||
| 815 | static ADDRESS_MAP_START( hotchase_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 816 | AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM) // RAM | |
| 817 | AM_RANGE(0x1000, 0x100d) AM_WRITE(hotchase_K007232_0_w) // 3 x K007232 | |
| 818 | AM_RANGE(0x2000, 0x200d) AM_WRITE(hotchase_K007232_1_w) | |
| 819 | AM_RANGE(0x3000, 0x300d) AM_WRITE(hotchase_K007232_2_w) | |
| 799 | static ADDRESS_MAP_START( hotchase_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 800 | AM_RANGE(0x0000, 0x07ff) AM_RAM | |
| 801 | AM_RANGE(0x1000, 0x100d) AM_READWRITE(hotchase_K007232_0_r, hotchase_K007232_0_w) // 3 x K007232 | |
| 802 | AM_RANGE(0x2000, 0x200d) AM_READWRITE(hotchase_K007232_1_r, hotchase_K007232_1_w) | |
| 803 | AM_RANGE(0x3000, 0x300d) AM_READWRITE(hotchase_K007232_2_r, hotchase_K007232_2_w) | |
| 820 | 804 | AM_RANGE(0x4000, 0x4007) AM_WRITE(hotchase_sound_control_w) // Sound volume, banking, etc. |
| 821 | 805 | AM_RANGE(0x5000, 0x5000) AM_WRITE(SMH_NOP) // ? (written with 0 on IRQ, 1 on FIRQ) |
| 806 | AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r) // From main CPU (Read on IRQ) | |
| 822 | 807 | AM_RANGE(0x7000, 0x7000) AM_WRITE(SMH_NOP) // Command acknowledge ? |
| 823 | AM_RANGE(0x8000, 0xffff) AM_ | |
| 808 | AM_RANGE(0x8000, 0xffff) AM_ | |
| 824 | 809 | ADDRESS_MAP_END |
| 825 | 810 | |
| 826 | 811 | |
| r2375 | r2376 | |
| 1123 | 1108 | /* Schems: can be reset, no nmi, soundlatch, 3.58MHz */ |
| 1124 | 1109 | MDRV_CPU_ADD(Z80, 3579545) |
| 1125 | 1110 | /* audio CPU */ |
| 1126 | MDRV_CPU_PROGRAM_MAP(wecleman_sound_ | |
| 1111 | MDRV_CPU_PROGRAM_MAP(wecleman_sound_ | |
| 1127 | 1112 | |
| 1128 | 1113 | MDRV_INTERLEAVE(100) |
| 1129 | 1114 | |
| r2375 | r2376 | |
| 1179 | 1164 | |
| 1180 | 1165 | MDRV_CPU_ADD(M6809, 3579545 / 2) |
| 1181 | 1166 | /* audio CPU */ /* 3.579/2 MHz - PCB is drawn in one set's readme */ |
| 1182 | MDRV_CPU_PROGRAM_MAP(hotchase_sound_ | |
| 1167 | MDRV_CPU_PROGRAM_MAP(hotchase_sound_ | |
| 1183 | 1168 | MDRV_CPU_PERIODIC_INT( hotchase_sound_timer, 496 ) |
| 1184 | 1169 | |
| 1185 | 1170 | /* Amuse: every 2 ms */ |
| r2375 | r2376 | |
|---|---|---|
| 75 | 75 | |
| 76 | 76 | /* enable coin & start input? Wild guess!!! */ |
| 77 | 77 | if (pc3092_data[1] & 0x02) |
| 78 | ret = | |
| 78 | ret = | |
| 79 | 79 | else |
| 80 | 80 | ret = 0x00; |
| 81 | 81 | |
| r2375 | r2376 | |
| 145 | 145 | |
| 146 | 146 | if (LOG_PC3259) logerror("%04X: read PC3259 #%d = 0x%02x\n", safe_activecpu_get_pc(), reg, ret); |
| 147 | 147 | |
| 148 | return ret | ( | |
| 148 | return ret | ( | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 |
| r2375 | r2376 | |
|---|---|---|
| 1400 | 1400 | { |
| 1401 | 1401 | if (data < 8 || data > 15) |
| 1402 | 1402 | logerror("%08X:Unexpected analog port select = %08X\n", activecpu_get_pc(), data); |
| 1403 | pending_analog_read = | |
| 1403 | pending_analog_read = | |
| 1404 | 1404 | } |
| 1405 | 1405 | |
| 1406 | 1406 | |
| r2375 | r2376 | |
| 1418 | 1418 | switch (offset) |
| 1419 | 1419 | { |
| 1420 | 1420 | case 0: /* low 8 bits of X */ |
| 1421 | result = ( | |
| 1421 | result = ( | |
| 1422 | 1422 | break; |
| 1423 | 1423 | |
| 1424 | 1424 | case 1: /* upper 4 bits of X */ |
| 1425 | result = (readinputport(4) >> 4) & 0x0f; | |
| 1426 | result |= (readinputport(8) & 0x03) << 4; | |
| 1425 | result = (input_port_read_indexed(machine, 4) >> 4) & 0x0f; | |
| 1426 | result |= (input_port_read_indexed(machine, 8) & 0x03) << 4; | |
| 1427 | 1427 | result |= 0x40; |
| 1428 | 1428 | break; |
| 1429 | 1429 | |
| 1430 | 1430 | case 2: /* low 8 bits of Y */ |
| 1431 | result = ( | |
| 1431 | result = ( | |
| 1432 | 1432 | break; |
| 1433 | 1433 | |
| 1434 | 1434 | case 3: /* upper 4 bits of Y */ |
| 1435 | result = ( | |
| 1435 | result = ( | |
| 1436 | 1436 | break; |
| 1437 | 1437 | |
| 1438 | 1438 | case 4: /* low 8 bits of X */ |
| 1439 | result = ( | |
| 1439 | result = ( | |
| 1440 | 1440 | break; |
| 1441 | 1441 | |
| 1442 | 1442 | case 5: /* upper 4 bits of X */ |
| 1443 | result = (readinputport(6) >> 4) & 0x0f; | |
| 1444 | result |= (readinputport(8) & 0x30); | |
| 1443 | result = (input_port_read_indexed(machine, 6) >> 4) & 0x0f; | |
| 1444 | result |= (input_port_read_indexed(machine, 8) & 0x30); | |
| 1445 | 1445 | result |= 0x40; |
| 1446 | 1446 | break; |
| 1447 | 1447 | |
| 1448 | 1448 | case 6: /* low 8 bits of Y */ |
| 1449 | result = ( | |
| 1449 | result = ( | |
| 1450 | 1450 | break; |
| 1451 | 1451 | |
| 1452 | 1452 | case 7: /* upper 4 bits of Y */ |
| 1453 | result = ( | |
| 1453 | result = ( | |
| 1454 | 1454 | break; |
| 1455 | 1455 | } |
| 1456 | 1456 | return result; |
| r2375 | r2376 | |
|---|---|---|
| 84 | 84 | |
| 85 | 85 | static READ16_HANDLER( special_port_4_r ) |
| 86 | 86 | { |
| 87 | int result = | |
| 87 | int result = | |
| 88 | 88 | |
| 89 | 89 | if (sound_to_main_ready) |
| 90 | 90 | result |= 0x01; |
| r2375 | r2376 | |
|---|---|---|
| 230 | 230 | |
| 231 | 231 | static READ16_HANDLER( tetrisp2_ip_1_word_r ) |
| 232 | 232 | { |
| 233 | return ( | |
| 233 | return ( | |
| 234 | 234 | ( mame_rand(Machine) & ~0xfcff ) | |
| 235 | 235 | ( 1 << (8 + (mame_rand(Machine)&1)) ); |
| 236 | 236 | } |
| r2375 | r2376 | |
| 306 | 306 | |
| 307 | 307 | static READ16_HANDLER( rocknms_port_0_r ) |
| 308 | 308 | { |
| 309 | return (( | |
| 309 | return (( | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | static WRITE16_HANDLER( rocknms_sub2main_w ) |
| r2375 | r2376 | |
|---|---|---|
| 265 | 265 | |
| 266 | 266 | static READ16_HANDLER( kyros_dip_r ) |
| 267 | 267 | { |
| 268 | return | |
| 268 | return | |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | static READ16_HANDLER( control_1_r ) |
| 272 | 272 | { |
| 273 | 273 | if (invert_controls) |
| 274 | return ~( | |
| 274 | return ~( | |
| 275 | 275 | |
| 276 | return ( | |
| 276 | return ( | |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | static READ16_HANDLER( control_2_r ) |
| 280 | 280 | { |
| 281 | 281 | if (invert_controls) |
| 282 | return ~( | |
| 282 | return ~( | |
| 283 | 283 | |
| 284 | return readinputportbytag("IN3") + /* Low byte of CN1 */ | |
| 285 | ((~(1 << (readinputportbytag("IN5") * 12 / 256))) << 8); | |
| 284 | return input_port_read(machine, "IN3") + /* Low byte of CN1 */ | |
| 285 | ((~(1 << (input_port_read(machine, "IN5") * 12 / 256))) << 8); | |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | static READ16_HANDLER( control_2_V_r ) |
| 289 | 289 | { |
| 290 | return | |
| 290 | return | |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | static READ16_HANDLER( control_3_r ) |
| 294 | 294 | { |
| 295 | 295 | if (invert_controls) |
| 296 | return ~((( ~(1 << ( | |
| 296 | return ~((( ~(1 << ( | |
| 297 | 297 | |
| 298 | return (( ~(1 << ( | |
| 298 | return (( ~(1 << ( | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /* High 4 bits of CN1 & CN2 */ |
| 302 | 302 | static READ16_HANDLER( control_4_r ) |
| 303 | 303 | { |
| 304 | 304 | if (invert_controls) |
| 305 | return ~(((( ~(1 << (readinputportbytag("IN6") * 12 / 256)) ) <<4)&0xf000) | |
| 306 | + ((( ~(1 << (readinputportbytag("IN5") * 12 / 256)) ) )&0x0f00)); | |
| 305 | return ~(((( ~(1 << (input_port_read(machine, "IN6") * 12 / 256)) ) <<4)&0xf000) | |
| 306 | + ((( ~(1 << (input_port_read(machine, "IN5") * 12 / 256)) ) )&0x0f00)); | |
| 307 | 307 | |
| 308 | return ((( ~(1 << (readinputportbytag("IN6") * 12 / 256)) ) <<4)&0xf000) | |
| 309 | + ((( ~(1 << (readinputportbytag("IN5") * 12 / 256)) ) )&0x0f00); | |
| 308 | return ((( ~(1 << (input_port_read(machine, "IN6") * 12 / 256)) ) <<4)&0xf000) | |
| 309 | + ((( ~(1 << (input_port_read(machine, "IN5") * 12 / 256)) ) )&0x0f00); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | static READ16_HANDLER( jongbou_inputs_r ) |
| 313 | 313 | { |
| 314 | UINT8 inp1 = readinputportbytag("IN3"); | |
| 315 | UINT8 inp2 = readinputportbytag("IN4"); | |
| 314 | UINT8 inp1 = input_port_read(machine, "IN3"); | |
| 315 | UINT8 inp2 = input_port_read(machine, "IN4"); | |
| 316 | 316 | inp1 = ((inp1 & 0x01) << 3) + ((inp1 & 0x02) << 1) + ((inp1 & 0x04) >> 1) + ((inp1 & 0x08) >> 3); |
| 317 | 317 | inp2 = ((inp2 & 0x01) << 3) + ((inp2 & 0x02) << 1) + ((inp2 & 0x04) >> 1) + ((inp2 & 0x08) >> 3); |
| 318 | return | |
| 318 | return | |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | /******************************************************************************/ |
| r2375 | r2376 | |
| 381 | 381 | return 0; |
| 382 | 382 | case 0x29: /* Query microcontroller for coin insert */ |
| 383 | 383 | trigstate++; |
| 384 | if ((readinputportbytag("IN2")&0x3)==3) latch=0; | |
| 385 | if ((readinputportbytag("IN2")&0x1)==0 && !latch) | |
| 384 | if ((input_port_read(machine, "IN2")&0x3)==3) latch=0; | |
| 385 | if ((input_port_read(machine, "IN2")&0x1)==0 && !latch) | |
| 386 | 386 | { |
| 387 | 387 | shared_ram[0x29] = (source&0xff00)|(coin_id&0xff); // coinA |
| 388 | 388 | shared_ram[0x22] = (source&0xff00)|0x0; |
| 389 | 389 | latch=1; |
| 390 | 390 | |
| 391 | coinvalue = (~ | |
| 391 | coinvalue = (~ | |
| 392 | 392 | deposits1++; |
| 393 | 393 | if (deposits1 == coinage1[coinvalue][0]) |
| 394 | 394 | { |
| r2375 | r2376 | |
| 398 | 398 | else |
| 399 | 399 | credits = 0; |
| 400 | 400 | } |
| 401 | else if (( | |
| 401 | else if (( | |
| 402 | 402 | { |
| 403 | 403 | shared_ram[0x29] = (source&0xff00)|(coin_id>>8); // coinB |
| 404 | 404 | shared_ram[0x22] = (source&0xff00)|0x0; |
| 405 | 405 | latch=1; |
| 406 | 406 | |
| 407 | coinvalue = (~ | |
| 407 | coinvalue = (~ | |
| 408 | 408 | deposits2++; |
| 409 | 409 | if (deposits2 == coinage2[coinvalue][0]) |
| 410 | 410 | { |
| r2375 | r2376 | |
| 460 | 460 | switch (offset) |
| 461 | 461 | { |
| 462 | 462 | case 0: /* Dipswitch 2 */ |
| 463 | shared_ram[0] = (source&0xff00)| | |
| 463 | shared_ram[0] = (source&0xff00)| | |
| 464 | 464 | return 0; |
| 465 | 465 | |
| 466 | 466 | case 0x22: /* Coin value */ |
| r2375 | r2376 | |
| 468 | 468 | return 0; |
| 469 | 469 | |
| 470 | 470 | case 0x29: /* Query microcontroller for coin insert */ |
| 471 | if ((readinputportbytag("IN2")&0x3)==3) latch=0; | |
| 472 | if ((readinputportbytag("IN2")&0x1)==0 && !latch) | |
| 471 | if ((input_port_read(machine, "IN2")&0x3)==3) latch=0; | |
| 472 | if ((input_port_read(machine, "IN2")&0x1)==0 && !latch) | |
| 473 | 473 | { |
| 474 | 474 | shared_ram[0x29] = (source&0xff00)|(coin_id&0xff); // coinA |
| 475 | 475 | shared_ram[0x22] = (source&0xff00)|0x0; |
| r2375 | r2376 | |
| 478 | 478 | if ((coin_id&0xff) == 0x22) |
| 479 | 479 | { |
| 480 | 480 | if(!strcmp(machine->gamedrv->name, "btlfildb")) |
| 481 | coinvalue = ( | |
| 481 | coinvalue = ( | |
| 482 | 482 | else |
| 483 | coinvalue = (~ | |
| 483 | coinvalue = (~ | |
| 484 | 484 | |
| 485 | 485 | deposits1++; |
| 486 | 486 | if (deposits1 == coinage1[coinvalue][0]) |
| r2375 | r2376 | |
| 492 | 492 | credits = 0; |
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | else if (( | |
| 495 | else if (( | |
| 496 | 496 | { |
| 497 | 497 | shared_ram[0x29] = (source&0xff00)|(coin_id>>8); // coinB |
| 498 | 498 | shared_ram[0x22] = (source&0xff00)|0x0; |
| r2375 | r2376 | |
| 501 | 501 | if ((coin_id>>8) == 0x22) |
| 502 | 502 | { |
| 503 | 503 | if(!strcmp(machine->gamedrv->name, "btlfildb")) |
| 504 | coinvalue = ( | |
| 504 | coinvalue = ( | |
| 505 | 505 | else |
| 506 | coinvalue = (~ | |
| 506 | coinvalue = (~ | |
| 507 | 507 | |
| 508 | 508 | deposits2++; |
| 509 | 509 | if (deposits2 == coinage2[coinvalue][0]) |
| r2375 | r2376 | |
| 556 | 556 | switch (offset) |
| 557 | 557 | { |
| 558 | 558 | case 0: /* Dipswitch 1 */ |
| 559 | shared_ram[0] = (source&0xff00)| | |
| 559 | shared_ram[0] = (source&0xff00)| | |
| 560 | 560 | return 0; |
| 561 | 561 | case 0x22: /* Coin value */ |
| 562 | 562 | shared_ram[0x22] = (source&0xff00)|(credits&0x00ff); |
| 563 | 563 | return 0; |
| 564 | 564 | case 0x29: /* Query microcontroller for coin insert */ |
| 565 | if ((readinputportbytag("IN2")&0x3)==3) latch=0; | |
| 566 | if ((readinputportbytag("IN2")&0x1)==0 && !latch) | |
| 565 | if ((input_port_read(machine, "IN2")&0x3)==3) latch=0; | |
| 566 | if ((input_port_read(machine, "IN2")&0x1)==0 && !latch) | |
| 567 | 567 | { |
| 568 | 568 | shared_ram[0x29] = (source&0xff00)|(coin_id&0xff); // coinA |
| 569 | 569 | shared_ram[0x22] = (source&0xff00)|0x0; |
| r2375 | r2376 | |
| 571 | 571 | |
| 572 | 572 | if ((coin_id&0xff) == 0x22) |
| 573 | 573 | { |
| 574 | coinvalue = (~ | |
| 574 | coinvalue = (~ | |
| 575 | 575 | deposits1++; |
| 576 | 576 | if (deposits1 == coinage1[coinvalue][0]) |
| 577 | 577 | { |
| r2375 | r2376 | |
| 582 | 582 | credits = 0; |
| 583 | 583 | } |
| 584 | 584 | } |
| 585 | else if (( | |
| 585 | else if (( | |
| 586 | 586 | { |
| 587 | 587 | shared_ram[0x29] = (source&0xff00)|(coin_id>>8); // coinB |
| 588 | 588 | shared_ram[0x22] = (source&0xff00)|0x0; |
| r2375 | r2376 | |
| 590 | 590 | |
| 591 | 591 | if ((coin_id>>8) == 0x22) |
| 592 | 592 | { |
| 593 | coinvalue = (~ | |
| 593 | coinvalue = (~ | |
| 594 | 594 | deposits2++; |
| 595 | 595 | if (deposits2 == coinage2[coinvalue][0]) |
| 596 | 596 | { |
| r2375 | r2376 | |
| 616 | 616 | break; |
| 617 | 617 | |
| 618 | 618 | case 0x1f00: /* Dipswitch 1 */ |
| 619 | shared_ram[0x1f00] = (source&0xff00)| | |
| 619 | shared_ram[0x1f00] = (source&0xff00)| | |
| 620 | 620 | return 0; |
| 621 | 621 | case 0x1f29: /* Query microcontroller for coin insert */ |
| 622 | if ((readinputportbytag("IN2")&0x3)==3) latch=0; | |
| 623 | if ((readinputportbytag("IN2")&0x1)==0 && !latch) | |
| 622 | if ((input_port_read(machine, "IN2")&0x3)==3) latch=0; | |
| 623 | if ((input_port_read(machine, "IN2")&0x1)==0 && !latch) | |
| 624 | 624 | { |
| 625 | 625 | shared_ram[0x1f29] = (source&0xff00)|(coin_id&0xff); // coinA |
| 626 | 626 | shared_ram[0x1f22] = (source&0xff00)|0x0; |
| r2375 | r2376 | |
| 628 | 628 | |
| 629 | 629 | if ((coin_id&0xff) == 0x22) |
| 630 | 630 | { |
| 631 | coinvalue = (~ | |
| 631 | coinvalue = (~ | |
| 632 | 632 | deposits1++; |
| 633 | 633 | if (deposits1 == coinage1[coinvalue][0]) |
| 634 | 634 | { |
| r2375 | r2376 | |
| 639 | 639 | credits = 0; |
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | else if (( | |
| 642 | else if (( | |
| 643 | 643 | { |
| 644 | 644 | shared_ram[0x1f29] = (source&0xff00)|(coin_id>>8); // coinB |
| 645 | 645 | shared_ram[0x1f22] = (source&0xff00)|0x0; |
| r2375 | r2376 | |
| 647 | 647 | |
| 648 | 648 | if ((coin_id>>8) == 0x22) |
| 649 | 649 | { |
| 650 | coinvalue = (~ | |
| 650 | coinvalue = (~ | |
| 651 | 651 | deposits2++; |
| 652 | 652 | if (deposits2 == coinage2[coinvalue][0]) |
| 653 | 653 | { |
| r2375 | r2376 | |
| 668 | 668 | the microcontroller supplies it (it does for all the other games, |
| 669 | 669 | but usually to 0x0 in RAM) when 0x21 is read (code at 0x009332) */ |
| 670 | 670 | source=shared_ram[0x0163]; |
| 671 | shared_ram[0x0163] = (source&0x00ff)|( | |
| 671 | shared_ram[0x0163] = (source&0x00ff)|( | |
| 672 | 672 | |
| 673 | 673 | return 0; |
| 674 | 674 | case 0x1ffe: /* Custom ID check */ |
| r2375 | r2376 | |
|---|---|---|
| 45 | 45 | |
| 46 | 46 | memset(mask, 0, sizeof mask); |
| 47 | 47 | |
| 48 | mask[readinputport(3)] |= 0x01; | |
| 49 | mask[readinputport(4)] |= 0x02; | |
| 50 | mask[readinputport(5)] |= 0x04; | |
| 51 | mask[readinputport(6)] |= 0x08; | |
| 52 | mask[readinputport(7)] |= 0x10; | |
| 53 | mask[readinputport(8)] |= 0x20; | |
| 48 | mask[input_port_read_indexed(machine, 3)] |= 0x01; | |
| 49 | mask[input_port_read_indexed(machine, 4)] |= 0x02; | |
| 50 | mask[input_port_read_indexed(machine, 5)] |= 0x04; | |
| 51 | mask[input_port_read_indexed(machine, 6)] |= 0x08; | |
| 52 | mask[input_port_read_indexed(machine, 7)] |= 0x10; | |
| 53 | mask[input_port_read_indexed(machine, 8)] |= 0x20; | |
| 54 | 54 | |
| 55 | 55 | for (i = 1; i < 256; i++) |
| 56 | 56 | if (mask[i] != 0) |
| r2375 | r2376 | |
| 88 | 88 | |
| 89 | 89 | static READ8_HANDLER( boxer_input_r ) |
| 90 | 90 | { |
| 91 | UINT8 val = | |
| 91 | UINT8 val = | |
| 92 | 92 | |
| 93 | if ( | |
| 93 | if ( | |
| 94 | 94 | val |= 0x02; |
| 95 | 95 | |
| 96 | 96 | return (val << ((offset & 7) ^ 7)) & 0x80; |
| r2375 | r2376 | |
| 112 | 112 | break; |
| 113 | 113 | |
| 114 | 114 | case 2: |
| 115 | val = | |
| 115 | val = | |
| 116 | 116 | break; |
| 117 | 117 | |
| 118 | 118 | case 3: |
| 119 | val = | |
| 119 | val = | |
| 120 | 120 | break; |
| 121 | 121 | } |
| 122 | 122 |
| r2375 | r2376 | |
|---|---|---|
| 105 | 105 | { |
| 106 | 106 | switch (offset & 15) |
| 107 | 107 | { |
| 108 | case 0: return input_port_0_r(machine,0); | |
| 109 | case 1: return input_port_1_r(machine,0); /* Note: need to loopback sounds lengths on that one */ | |
| 110 | case 5: return input_port_4_r(machine,0); | |
| 111 | case 6: return input_port_2_r(machine,0); | |
| 112 | case 7: return input_port_3_r(machine,0); | |
| 108 | case 0: return input_port_read_indexed(machine, 0); | |
| 109 | case 1: return input_port_read_indexed(machine, 1); /* Note: need to loopback sounds lengths on that one */ | |
| 110 | case 5: return input_port_read_indexed(machine, 4); | |
| 111 | case 6: return input_port_read_indexed(machine, 2); | |
| 112 | case 7: return input_port_read_indexed(machine, 3); | |
| 113 | 113 | default: return 0xff; |
| 114 | 114 | } |
| 115 | 115 | } |
| r2375 | r2376 | |
| 132 | 132 | |
| 133 | 133 | switch (offset & 15) |
| 134 | 134 | { |
| 135 | case 0: return input_port_0_r(machine,0); | |
| 136 | case 1: return input_port_1_r(machine,0); | |
| 135 | case 0: return input_port_read_indexed(machine, 0); | |
| 136 | case 1: return input_port_read_indexed(machine, 1); | |
| 137 | 137 | case 2: |
| 138 | temp = fireone_select ? input_port_ | |
| 138 | temp = fireone_select ? input_port_ | |
| 139 | 139 | temp = (temp & 0xc0) | fireone_paddle_map[temp & 0x3f]; |
| 140 | 140 | return temp; |
| 141 | 141 | default: return 0xff; |
| r2375 | r2376 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | - Proper touchscreen controller emulation. Currently it's flakey and |
| 19 | 19 | tends to stop registering user input (try coining up in that case) |
| 20 | - Protection in tm4k | |
| 20 | - Protection in tm4k and later games | |
| 21 | 21 | - Coin optics |
| 22 | 22 | - RTC emulation (there's code to check the upper bytes of NVRAM to see if |
| 23 | 23 | the real time clock is present, and to only use it in that case) |
| 24 | 24 | |
| 25 | To be dumped and added: | |
| 26 | ||
| 27 | Touch Master 2000 | |
| 28 | Touch Master 6000 | |
| 29 | Touch Master 7000 * | |
| 30 | Touch Master 8000 *(?) | |
| 31 | ||
| 32 | * There is a reported "Minnesota" version with modifications due to legal issues | |
| 33 | Touch Master 5000 is labeled "DOMESTIC" (AKA "Standard"), is there an EXPORT version? | |
| 34 | Is there a Touch Master 6000? TM5K is version 7.10, then TM7K is version 8, TM8K is version 9.04 | |
| 35 | Starting with Touch Master 2000, each later version is a chipswap for the mainboard. | |
| 36 | IE: Touch Master 8000 chips can update any Touch Master mainboard 2000 through 7000 | |
| 37 | ||
| 38 | Touch Master 8000 part lists: | |
| 39 | ||
| 40 | A-5343-60194-3 U8 Sound | |
| 41 | A-5343-60194-2 U51 Program code | |
| 42 | A-5343-60194-1 U52 Program code | |
| 43 | A-5343-60194-6 U36 Graphics | |
| 44 | A-5343-60194-4 U37 Graphics | |
| 45 | A-5343-60194-7 U38 Graphics | |
| 46 | A-5343-60194-5 U39 Graphics | |
| 47 | A-5343-60194-8 U40 Graphics | |
| 48 | A-5343-60194-9 U41 Graphics | |
| 49 | A-21657-007 Security Key | |
| 50 | ||
| 51 | ****************************************************************** | |
| 52 | ||
| 25 | 53 | [Galaxy Games] |
| 26 | 54 | |
| 27 | 55 | Input: Trackballs and buttons |
| r2375 | r2376 | |
| 67 | 95 | |
| 68 | 96 | static int touchscreen; |
| 69 | 97 | |
| 70 | static void show_touchscreen( | |
| 98 | static void show_touchscreen(running_machine *machine) | |
| 71 | 99 | { |
| 72 | 100 | #ifdef MAME_DEBUG |
| 73 | popmessage("% d] %03x %03x - %d",touchscreen, | |
| 101 | popmessage("% d] %03x %03x - %d",touchscreen, | |
| 74 | 102 | #endif |
| 75 | 103 | } |
| 76 | 104 | |
| r2375 | r2376 | |
| 79 | 107 | if (ACCESSING_BITS_0_7 && data == 0x05) |
| 80 | 108 | { |
| 81 | 109 | touchscreen = 0; |
| 82 | show_touchscreen(); | |
| 110 | show_touchscreen(machine); | |
| 83 | 111 | } |
| 84 | 112 | } |
| 85 | 113 | |
| r2375 | r2376 | |
| 89 | 117 | touchscreen++; |
| 90 | 118 | if (touchscreen == 6) |
| 91 | 119 | touchscreen = -1; |
| 92 | show_touchscreen(); | |
| 120 | show_touchscreen(machine); | |
| 93 | 121 | |
| 94 | 122 | return 0; |
| 95 | 123 | } |
| r2375 | r2376 | |
| 107 | 135 | { |
| 108 | 136 | UINT16 val = 0; |
| 109 | 137 | |
| 110 | int press1 = readinputportbytag("TSCREEN_X") & 0x4000; | |
| 111 | int press2 = readinputportbytag("TSCREEN_X") & 0x8000; | |
| 138 | int press1 = input_port_read(machine, "TSCREEN_X") & 0x4000; | |
| 139 | int press2 = input_port_read(machine, "TSCREEN_X") & 0x8000; | |
| 112 | 140 | if (press1) press2 = 1; |
| 113 | 141 | |
| 114 | 142 | switch (touchscreen) |
| 115 | 143 | { |
| 116 | 144 | case 1: val = press1 ? 0 : 1<<6; break; // press |
| 117 | case 2: val = readinputportbytag("TSCREEN_X") & 0x003; break; | |
| 118 | case 3: val = (readinputportbytag("TSCREEN_X") >> 2) & 0x7f; break; | |
| 145 | case 2: val = input_port_read(machine, "TSCREEN_X") & 0x003; break; | |
| 146 | case 3: val = (input_port_read(machine, "TSCREEN_X") >> 2) & 0x7f; break; | |
| 119 | 147 | case 4: val = 0; break; |
| 120 | case 5: val = (( | |
| 148 | case 5: val = (( | |
| 121 | 149 | |
| 122 | 150 | default: |
| 123 | 151 | return 0; |
| r2375 | r2376 | |
| 356 | 384 | |
| 357 | 385 | static READ16_HANDLER( tmaster_coins_r ) |
| 358 | 386 | { |
| 359 | return | |
| 387 | return | |
| 360 | 388 | } |
| 361 | 389 | |
| 362 | 390 | static ADDRESS_MAP_START( tmaster_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| r2375 | r2376 | |
| 840 | 868 | TM3K_u40.bin 5.0 Video Images & Graphics ccb4 |
| 841 | 869 | TM3K_u41.bin 5.0 Video Images & Graphics 54a7 |
| 842 | 870 | u62 (NOT INCLUDED) N/A Battery Memory Module N/A |
| 843 | J12 | |
| 871 | J12 DA | |
| 844 | 872 | ----------------------------------------------------------------------------------- |
| 845 | 873 | |
| 846 | 874 | SCN68681c1n40 |
| r2375 | r2376 | |
| 850 | 878 | |
| 851 | 879 | ROM_START( tm3k ) |
| 852 | 880 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) // 68000 Code |
| 853 | ROM_LOAD16_BYTE( "tm3k_u52.bin", 0x000001, 0x100000, CRC(8c6a0db7) SHA1(6b0eae60ea471cd8c4001749ac2677d8d4532567) ) | |
| 854 | ROM_LOAD16_BYTE( "tm3k_u51.bin", 0x000000, 0x100000, CRC(c9522279) SHA1(e613b791f831271722f05b7e96c35519fa9fc174) ) | |
| 881 | ROM_LOAD16_BYTE( "tm3k_u52.bin", 0x000001, 0x100000, CRC(8c6a0db7) SHA1(6b0eae60ea471cd8c4001749ac2677d8d4532567) ) /* Ver: 5.01 Standard 11-4-97 */ | |
| 882 | ROM_LOAD16_BYTE( "tm3k_u51.bin", 0x000000, 0x100000, CRC(c9522279) SHA1(e613b791f831271722f05b7e96c35519fa9fc174) ) /* Ver: 5.01 Standard 11-4-97 */ | |
| 855 | 883 | |
| 856 | 884 | ROM_REGION( 0x600000, REGION_GFX1, 0 ) // Blitter gfx |
| 857 | 885 | ROM_LOAD16_BYTE( "tm3k_u38.bin", 0x000000, 0x100000, CRC(a6683899) SHA1(d05024390917cdb1871d030996da8e1eb6460918) ) |
| r2375 | r2376 | |
| 887 | 915 | TM4K_u40.bin 6.0 Video Images & Graphics 208A |
| 888 | 916 | TM4K_u41.bin 6.0 Video Images & Graphics 385D |
| 889 | 917 | u62 (NOT INCLUDED) N/A Battery Memory Module N/A |
| 890 | J12 | |
| 918 | J12 DA | |
| 891 | 919 | ----------------------------------------------------------------------------------- |
| 892 | 920 | |
| 893 | 921 | SCN68681c1n40 |
| r2375 | r2376 | |
| 897 | 925 | |
| 898 | 926 | ROM_START( tm4k ) |
| 899 | 927 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) // 68000 Code |
| 900 | ROM_LOAD16_BYTE( "tm4k_u51.bin", 0x000000, 0x100000, CRC(3d8d7848) SHA1(31638f23cdd5e6cfbb2270e953f84fe1bd437950) ) | |
| 901 | ROM_LOAD16_BYTE( "tm4k_u52.bin", 0x000001, 0x100000, CRC(6d412871) SHA1(ae27c7723b292daf6682c53bafac22e4a3cd1ece) ) | |
| 928 | ROM_LOAD16_BYTE( "tm4k_u51.bin", 0x000000, 0x100000, CRC(3d8d7848) SHA1(31638f23cdd5e6cfbb2270e953f84fe1bd437950) ) /* Ver: 6.02 Standard 4-14-98 */ | |
| 929 | ROM_LOAD16_BYTE( "tm4k_u52.bin", 0x000001, 0x100000, CRC(6d412871) SHA1(ae27c7723b292daf6682c53bafac22e4a3cd1ece) ) /* Ver: 6.02 Standard 4-14-98 */ | |
| 902 | 930 | |
| 903 | 931 | ROM_REGION( 0x600000, REGION_GFX1, 0 ) // Blitter gfx |
| 904 | ROM_LOAD16_BYTE( "tm4k_u38.bin", 0x000000, 0x100000, CRC(a6683899) SHA1(d05024390917cdb1871d030996da8e1eb6460918) ) | |
| 905 | ROM_LOAD16_BYTE( "tm4k_u36.bin", 0x000001, 0x100000, CRC(7bde520d) SHA1(77750b689e2f0d47804042456e54bbd9c28deeac) ) | |
| 906 | ROM_LOAD16_BYTE( "tm4k_u39.bin", 0x200000, 0x100000, CRC(bac88cfb) SHA1(26ed169296b890c5f5b50c418c15299355a6592f) ) | |
| 907 | ROM_LOAD16_BYTE( "tm4k_u37.bin", 0x200001, 0x100000, CRC(bf49fafa) SHA1(b400667bf654dc9cd01a85c8b99670459400fd60) ) | |
| 908 | ROM_LOAD16_BYTE( "tm4k_u41.bin", 0x400000, 0x100000, CRC(e97edb1e) SHA1(75510676cf1692ad03efd4ccd57d25af1cc8ef2a) ) | |
| 909 | ROM_LOAD16_BYTE( "tm4k_u40.bin", 0x400001, 0x100000, CRC(f6771a09) SHA1(74f71d5e910006c83a38170f24aa811c38a3e020) ) | |
| 932 | ROM_LOAD16_BYTE( "tm4k_u38.bin", 0x000000, 0x100000, CRC(a6683899) SHA1(d05024390917cdb1871d030996da8e1eb6460918) ) /* Mask rom labeled 5341-15746-03 U38 VIDEO IMAGE */ | |
| 933 | ROM_LOAD16_BYTE( "tm4k_u36.bin", 0x000001, 0x100000, CRC(7bde520d) SHA1(77750b689e2f0d47804042456e54bbd9c28deeac) ) /* Mask rom labeled 5341-15746-01 U36 VIDEO IMAGE */ | |
| 934 | ROM_LOAD16_BYTE( "tm4k_u39.bin", 0x200000, 0x100000, CRC(bac88cfb) SHA1(26ed169296b890c5f5b50c418c15299355a6592f) ) /* Mask rom labeled 5341-15746-04 U39 VIDEO IMAGE */ | |
| 935 | ROM_LOAD16_BYTE( "tm4k_u37.bin", 0x200001, 0x100000, CRC(bf49fafa) SHA1(b400667bf654dc9cd01a85c8b99670459400fd60) ) /* Mask rom labeled 5341-15746-02 U37 VIDEO IMAGE */ | |
| 936 | ROM_LOAD16_BYTE( "tm4k_u41.bin", 0x400000, 0x100000, CRC(e97edb1e) SHA1(75510676cf1692ad03efd4ccd57d25af1cc8ef2a) ) /* Mask rom labeled 5341-15746-06 U41 VIDEO IMAGE */ | |
| 937 | ROM_LOAD16_BYTE( "tm4k_u40.bin", 0x400001, 0x100000, CRC(f6771a09) SHA1(74f71d5e910006c83a38170f24aa811c38a3e020) ) /* Mask rom labeled 5341-15746-05 U40 VIDEO IMAGE */ | |
| 910 | 938 | |
| 911 | 939 | ROM_REGION( 0x100000, REGION_SOUND1, 0 ) // Samples |
| 912 | ROM_LOAD( "tm4k_u8.bin", 0x00000, 0x100000, CRC(48c3782b) SHA1(bfe105ddbde8bbbd84665dfdd565d6d41926834a) ) | |
| 940 | ROM_LOAD( "tm4k_u8.bin", 0x00000, 0x100000, CRC(48c3782b) SHA1(bfe105ddbde8bbbd84665dfdd565d6d41926834a) ) /* Mask rom labeled 5341-15746-07 U8 SOUND IMAGE */ | |
| 913 | 941 | ROM_END |
| 914 | 942 | |
| 915 | 943 | /*************************************************************************** |
| 916 | 944 | |
| 945 | Touchmaster 5000 | |
| 946 | by Midway (c) 1998 | |
| 947 | touchscreen game | |
| 948 | ||
| 949 | All chips are ST M27C801 | |
| 950 | --------------------------- | |
| 951 | ||
| 952 | Name Board Location Version Use Checksum | |
| 953 | ----------------------------------------------------------------------------------- | |
| 954 | tm5k_sound.u8 7.0 Audio Program & sounds F474 | |
| 955 | tm5k_v7_10.u51 7.10 Game Program & Cpu instructions 1A51 | |
| 956 | tm5k_v7_10.u52 7.10 Game Program & Cpu instructions 5A01 | |
| 957 | tm5k_graphic.u36 7.0 Video Images & Graphics DB7F | |
| 958 | tm5k_graphic.u37 7.0 Video Images & Graphics 871B | |
| 959 | tm5k_graphic.u38 7.0 Video Images & Graphics EDCE | |
| 960 | tm5k_graphic.u39 7.0 Video Images & Graphics 657F | |
| 961 | tm5k_graphic.u40 7.0 Video Images & Graphics 93E0 | |
| 962 | tm5k_graphic.u41 7.0 Video Images & Graphics FCA5 | |
| 963 | ||
| 964 | J12 DALLAS DS1204V N/A Security Key (required for this Version) - Labeled A-21657-004 | |
| 965 | ----------------------------------------------------------------------------------- | |
| 966 | ||
| 967 | ||
| 968 | ***************************************************************************/ | |
| 969 | ||
| 970 | ROM_START( tm5k ) | |
| 971 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) // 68000 Code | |
| 972 | ROM_LOAD16_BYTE( "tm5k_v7_10.u51", 0x000000, 0x100000, CRC(df0bd25e) SHA1(db1a197ed4c868743397f3823f3f1d42b9329f80) ) /* TOUCHMASTER 5000 U51 DOMESTIC 7.10 (Standard 10-9-98) */ | |
| 973 | ROM_LOAD16_BYTE( "tm5k_v7_10.u52", 0x000001, 0x100000, CRC(ddf9e8dc) SHA1(3228f2eba067bdf1bd639116bffc589585ea3e72) ) /* TOUCHMASTER 5000 U52 DOMESTIC 7.10 (Standard 10-9-98) */ | |
| 974 | ||
| 975 | ROM_REGION( 0x600000, REGION_GFX1, 0 ) // Blitter gfx | |
| 976 | ROM_LOAD16_BYTE( "tm5k_graphic.u38", 0x000000, 0x100000, CRC(93038e7c) SHA1(448f69bf51ac992f6b35b471cba9675c67984cd7) ) /* Labeled GRAPHIC U38 7.0 */ | |
| 977 | ROM_LOAD16_BYTE( "tm5k_graphic.u36", 0x000001, 0x100000, CRC(5453a44a) SHA1(094439a56336ca933b0b7ede8c057546d1d490b2) ) /* Labeled GRAPHIC U36 7.0 */ | |
| 978 | ROM_LOAD16_BYTE( "tm5k_graphic.u39", 0x200000, 0x100000, CRC(1349fdc7) SHA1(5118983be584455320f0d6006133f38e6a8ee0d8) ) /* Labeled GRAPHIC U39 7.0 */ | |
| 979 | ROM_LOAD16_BYTE( "tm5k_graphic.u37", 0x200001, 0x100000, CRC(8bcc376c) SHA1(0588f6f96090b26a3ce0eb3a933a5cc9d8ce742d) ) /* Labeled GRAPHIC U37 7.0 */ | |
| 980 | ROM_LOAD16_BYTE( "tm5k_graphic.u41", 0x400000, 0x100000, CRC(c8717fef) SHA1(fbd13321db0f35b7bdf207468f28792a7666bb2e) ) /* Labeled GRAPHIC U41 7.0 */ | |
| 981 | ROM_LOAD16_BYTE( "tm5k_graphic.u40", 0x400001, 0x100000, CRC(cff3f962) SHA1(2389d94ffa0eaf2d2f62315822273db031eea033) ) /* Labeled GRAPHIC U40 7.0 */ | |
| 982 | ||
| 983 | ROM_REGION( 0x100000, REGION_SOUND1, 0 ) // Samples | |
| 984 | ROM_LOAD( "tm5k_sound.u8", 0x00000, 0x100000, CRC(c6070a60) SHA1(2dc20bf2217a36374b5a691133ad43f53dbe29ca) ) /* Labeled SOUND U8 7.0 */ | |
| 985 | ROM_END | |
| 986 | ||
| 987 | /*************************************************************************** | |
| 988 | ||
| 989 | Touchmaster 7000 | |
| 990 | by Midway (c) 1998 | |
| 991 | touchscreen game | |
| 992 | ||
| 993 | All chips are ST M27C801 | |
| 994 | --------------------------- | |
| 995 | ||
| 996 | Name Board Location Version Use Checksum | |
| 997 | ----------------------------------------------------------------------------------- | |
| 998 | tm7k_sound.u8 8.0 Audio Program & sounds F474 (same as TM5K) | |
| 999 | tm7k_v8.u51 8.00 Game Program & Cpu instructions 82A5 | |
| 1000 | tm7k_v8.u52 8.00 Game Program & Cpu instructions 81E1 | |
| 1001 | tm7k_graphic.u36 8.0 Video Images & Graphics DB7F (same as TM5K) | |
| 1002 | tm7k_graphic.u37 8.0 Video Images & Graphics 7461 | |
| 1003 | tm7k_graphic.u38 8.0 Video Images & Graphics EDCE (same as TM5K) | |
| 1004 | tm7k_graphic.u39 8.0 Video Images & Graphics 2BB6 | |
| 1005 | tm7k_graphic.u40 8.0 Video Images & Graphics B103 | |
| 1006 | tm7k_graphic.u41 8.0 Video Images & Graphics 11CA | |
| 1007 | ||
| 1008 | J12 DALLAS DS1204V N/A Security Key (required for this Version) - Labeled A-21657-005 | |
| 1009 | ----------------------------------------------------------------------------------- | |
| 1010 | ||
| 1011 | ||
| 1012 | ***************************************************************************/ | |
| 1013 | ||
| 1014 | ROM_START( tm7k ) | |
| 1015 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) // 68000 Code | |
| 1016 | ROM_LOAD16_BYTE( "tm7k_v8.u51", 0x000000, 0x100000, CRC(83ec3da7) SHA1(37fa7183e7acc2eab35ac431d99cbbfe4862979e) ) /* TOUCHMASTER 7000 U51 DOMESTIC 8.00 (Standard 03/26/99) */ | |
| 1017 | ROM_LOAD16_BYTE( "tm7k_v8.u52", 0x000001, 0x100000, CRC(e2004282) SHA1(aa73029f31e2062cabedfcd778db97b314624ae8) ) /* TOUCHMASTER 7000 U52 DOMESTIC 8.00 (Standard 03/26/99) */ | |
| 1018 | ||
| 1019 | ROM_REGION( 0x600000, REGION_GFX1, 0 ) // Blitter gfx | |
| 1020 | ROM_LOAD16_BYTE( "tm7k_graphic.u38", 0x000000, 0x100000, CRC(93038e7c) SHA1(448f69bf51ac992f6b35b471cba9675c67984cd7) ) /* Labeled GRAPHIC U38 8.0 */ | |
| 1021 | ROM_LOAD16_BYTE( "tm7k_graphic.u36", 0x000001, 0x100000, CRC(5453a44a) SHA1(094439a56336ca933b0b7ede8c057546d1d490b2) ) /* Labeled GRAPHIC U36 8.0 */ | |
| 1022 | ROM_LOAD16_BYTE( "tm7k_graphic.u39", 0x200000, 0x100000, CRC(26af8da8) SHA1(02555b1597a4962f1fd0c3ffc89e5c8338aa3085) ) /* Labeled GRAPHIC U39 8.0 */ | |
| 1023 | ROM_LOAD16_BYTE( "tm7k_graphic.u37", 0x200001, 0x100000, CRC(9a705043) SHA1(cffb31859544c1c4082be78b3bca5ad9cd0d2a45) ) /* Labeled GRAPHIC U37 8.0 */ | |
| 1024 | ROM_LOAD16_BYTE( "tm7k_graphic.u41", 0x400000, 0x100000, CRC(99b6edda) SHA1(c0ee2834fdbfbc1159a6d08c45552d4d9c1c4ea4) ) /* Labeled GRAPHIC U41 8.0 */ | |
| 1025 | ROM_LOAD16_BYTE( "tm7k_graphic.u40", 0x400001, 0x100000, CRC(a3925379) SHA1(74836325ab10466e23105a3b54fc706c0dd5f06c) ) /* Labeled GRAPHIC U40 8.0 */ | |
| 1026 | ||
| 1027 | ROM_REGION( 0x100000, REGION_SOUND1, 0 ) // Samples | |
| 1028 | ROM_LOAD( "tm7k_sound.u8", 0x00000, 0x100000, CRC(c6070a60) SHA1(2dc20bf2217a36374b5a691133ad43f53dbe29ca) ) /* Labeled SOUND U8 8.0 */ | |
| 1029 | ROM_END | |
| 1030 | ||
| 1031 | /*************************************************************************** | |
| 1032 | ||
| 917 | 1033 | Galaxy Games BIOS v. 1.90 |
| 918 | 1034 | |
| 919 | 1035 | This is a multi-game cocktail cabinet released in 1998. Namco seems to have |
| r2375 | r2376 | |
| 992 | 1108 | |
| 993 | 1109 | ROM[0x8342C/2] = 0x601a; |
| 994 | 1110 | ROM[0x8346C/2] = 0x6002; |
| 1111 | /* | |
| 1112 | Protection starts: | |
| 1113 | ||
| 1114 | 8341C: addi.w #$384, D0 0640 0384 | |
| 1115 | 83420: move.w D0, $207a86.l 33C0 0020 7A86 | |
| 1116 | 83426: btst #$7, ($1,A5) 082D 0007 0001 | |
| 1117 | 8342C: beq $83448 671A <-- First patch goes here | |
| 1118 | ||
| 1119 | */ | |
| 1120 | ||
| 995 | 1121 | } |
| 996 | 1122 | |
| 1123 | static DRIVER_INIT( tm5k ) | |
| 1124 | { | |
| 1125 | UINT16 *ROM = (UINT16 *)memory_region( REGION_CPU1 ); | |
| 1126 | ||
| 1127 | // protection | |
| 1128 | ROM[0x96002/2] = 0x4e75; | |
| 1129 | ||
| 1130 | ROM[0x95fd0/2] = 0x6002; | |
| 1131 | ROM[0x95ff8/2] = 0x6002; | |
| 1132 | /* | |
| 1133 | Protection starts: | |
| 1134 | ||
| 1135 | 95FBE: addi.w #$384, D0 0640 0384 | |
| 1136 | 95FC2: move.w D0, $207e9a.l 33C0 0020 7E9A | |
| 1137 | 95FC8: moveq #$f, D0 700F | |
| 1138 | 95FCA: and.w (A4), D0 C054 | |
| 1139 | 95FCC: cmpi.w #$3, D0 0C40 0003 | |
| 1140 | 95FD0: bcs $95fd4 6502 <-- First patch goes here | |
| 1141 | ||
| 1142 | */ | |
| 1143 | ||
| 1144 | } | |
| 1145 | ||
| 1146 | static DRIVER_INIT( tm7k ) | |
| 1147 | { | |
| 1148 | UINT16 *ROM = (UINT16 *)memory_region( REGION_CPU1 ); | |
| 1149 | ||
| 1150 | // protection | |
| 1151 | ROM[0x81594/2] = 0x4e75; | |
| 1152 | ||
| 1153 | ROM[0x81564/2] = 0x6004; | |
| 1154 | ROM[0x8158c/2] = 0x6002; | |
| 1155 | /* | |
| 1156 | Protection starts: | |
| 1157 | ||
| 1158 | 81552: addi.w #$76c, D0 0640 076C | |
| 1159 | 81556: move.w D0, $207104.l 33C0 0020 7104 | |
| 1160 | 8155C: moveq #$f, D0 700F | |
| 1161 | 8155E: and.w (A4), D0 C054 | |
| 1162 | 81560: cmpi.w #$3, D0 0C40 0003 | |
| 1163 | 81564: bcs $8156A 6504 <-- First patch goes here | |
| 1164 | ||
| 1165 | */ | |
| 1166 | ||
| 1167 | } | |
| 1168 | ||
| 997 | 1169 | static DRIVER_INIT( galgames ) |
| 998 | 1170 | { |
| 999 | 1171 | // configure memory banks |
| r2375 | r2376 | |
| 1007 | 1179 | GAME( 1996, tm, 0, tm, tmaster, 0, ROT0, "Midway", "Touchmaster", GAME_NOT_WORKING ) |
| 1008 | 1180 | GAME( 1997, tm3k, 0, tm3k, tmaster, tm3k, ROT0, "Midway", "Touchmaster 3000 (v5.01)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS) // imp. graphics due to bad dump |
| 1009 | 1181 | GAME( 1998, tm4k, 0, tm3k, tmaster, tm4k, ROT0, "Midway", "Touchmaster 4000 (v6.02)", GAME_NOT_WORKING ) |
| 1182 | GAME( 1998, tm5k, 0, tm3k, tmaster, tm5k, ROT0, "Midway", "Touchmaster 5000 (v7.10)", GAME_NOT_WORKING ) | |
| 1183 | GAME( 1999, tm7k, 0, tm3k, tmaster, tm7k, ROT0, "Midway", "Touchmaster 7000 (v8.00)", GAME_NOT_WORKING ) | |
| 1010 | 1184 | GAME( 1998, galgbios, 0, galgames, galgames, galgames, ROT0, "Creative Electonics & Software", "Galaxy Games (BIOS v1.90)", GAME_IS_BIOS_ROOT ) |
| r2375 | r2376 | |
|---|---|---|
| 93 | 93 | |
| 94 | 94 | static READ8_HANDLER( spinner_r ) |
| 95 | 95 | { |
| 96 | return | |
| 96 | return | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | static READ8_HANDLER( gigas_spinner_r ) |
| 100 | 100 | { |
| 101 | return | |
| 101 | return | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | static MACHINE_RESET( pbillrd ) |
| r2375 | r2376 | |
|---|---|---|
| 532 | 532 | |
| 533 | 533 | READ16_HANDLER( scudhamm_analog_r ) |
| 534 | 534 | { |
| 535 | return | |
| 535 | return | |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | /* |
| r2375 | r2376 | |
| 627 | 627 | int armdelta; |
| 628 | 628 | static int armold = 0; |
| 629 | 629 | |
| 630 | armdelta = readinputport(1) - armold; | |
| 631 | armold = readinputport(1); | |
| 630 | armdelta = input_port_read_indexed(machine, 1) - armold; | |
| 631 | armold = input_port_read_indexed(machine, 1); | |
| 632 | 632 | |
| 633 | 633 | return ~( scudhamm_motor_command + armdelta ); // + x : x<=0 and player loses, x>0 and player wins |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | static READ16_HANDLER( armchmp2_buttons_r ) |
| 637 | 637 | { |
| 638 | int arm_x = | |
| 638 | int arm_x = | |
| 639 | 639 | |
| 640 | UINT16 ret = | |
| 640 | UINT16 ret = | |
| 641 | 641 | |
| 642 | 642 | if (arm_x < 0x40) ret &= ~1; |
| 643 | 643 | else if (arm_x > 0xc0) ret &= ~2; |
| r2375 | r2376 | |
|---|---|---|
| 203 | 203 | |
| 204 | 204 | /* TODO: REMOVE (THIS IS HANDLED BY "SUBCPU") */ |
| 205 | 205 | static void |
| 206 | ReadAnalogDrivingPorts( UINT16 *gas, UINT16 *brake, UINT16 *steer ) | |
| 206 | ReadAnalogDrivingPorts( running_machine *machine, UINT16 *gas, UINT16 *brake, UINT16 *steer ) | |
| 207 | 207 | { |
| 208 | *gas = readinputport(2); | |
| 209 | *brake = readinputport(3); | |
| 210 | *steer = readinputport(4); | |
| 208 | *gas = input_port_read_indexed(machine, 2); | |
| 209 | *brake = input_port_read_indexed(machine, 3); | |
| 210 | *steer = input_port_read_indexed(machine, 4); | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /* TODO: REMOVE (THIS IS HANDLED BY "SUBCPU") */ |
| 214 | 214 | static UINT16 |
| 215 | AnalogAsDigital( | |
| 215 | AnalogAsDigital( running_machine *machine ) | |
| 216 | 216 | { |
| 217 | UINT16 stick = readinputport(1); | |
| 218 | UINT16 gas = readinputport(2); | |
| 219 | UINT16 steer = readinputport(4); | |
| 217 | UINT16 stick = input_port_read_indexed(machine, 1); | |
| 218 | UINT16 gas = input_port_read_indexed(machine, 2); | |
| 219 | UINT16 steer = input_port_read_indexed(machine, 4); | |
| 220 | 220 | UINT16 result = 0xffff; |
| 221 | 221 | |
| 222 | 222 | switch( namcos22_gametype ) |
| r2375 | r2376 | |
| 263 | 263 | |
| 264 | 264 | /* TODO: REMOVE (THIS IS HANDLED BY "SUBCPU") */ |
| 265 | 265 | static void |
| 266 | HandleCoinage(int slots) | |
| 266 | HandleCoinage(running_machine *machine, int slots) | |
| 267 | 267 | { |
| 268 | 268 | UINT16 *share16 = (UINT16 *)namcos22_shareram; |
| 269 | 269 | UINT32 coin_state; |
| 270 | 270 | |
| 271 | coin_state = | |
| 271 | coin_state = | |
| 272 | 272 | |
| 273 | 273 | if (!(coin_state & 0x1000) && (old_coin_state & 0x1000)) |
| 274 | 274 | { |
| r2375 | r2376 | |
| 292 | 292 | |
| 293 | 293 | /* TODO: REMOVE (THIS IS HANDLED BY "SUBCPU") */ |
| 294 | 294 | static void |
| 295 | HandleDrivingIO( | |
| 295 | HandleDrivingIO( running_machine *machine ) | |
| 296 | 296 | { |
| 297 | 297 | if( nthbyte(namcos22_system_controller,0x18)!=0 ) |
| 298 | 298 | { |
| 299 | UINT16 flags = | |
| 299 | UINT16 flags = | |
| 300 | 300 | UINT16 gas,brake,steer; |
| 301 | ReadAnalogDrivingPorts( &gas, &brake, &steer ); | |
| 301 | ReadAnalogDrivingPorts( machine, &gas, &brake, &steer ); | |
| 302 | 302 | |
| 303 | HandleCoinage(2); | |
| 303 | HandleCoinage(machine, 2); | |
| 304 | 304 | |
| 305 | 305 | switch (namcos22_gametype) |
| 306 | 306 | { |
| r2375 | r2376 | |
| 348 | 348 | |
| 349 | 349 | /* TODO: REMOVE (THIS IS HANDLED BY "SUBCPU") */ |
| 350 | 350 | static void |
| 351 | HandleCyberCommandoIO( | |
| 351 | HandleCyberCommandoIO( running_machine *machine ) | |
| 352 | 352 | { |
| 353 | 353 | if( nthbyte(namcos22_system_controller,0x18)!=0 ) |
| 354 | 354 | { |
| 355 | UINT16 flags = | |
| 355 | UINT16 flags = | |
| 356 | 356 | |
| 357 | UINT16 volume0 = readinputport(2)*0x10; | |
| 358 | UINT16 volume1 = readinputport(3)*0x10; | |
| 359 | UINT16 volume2 = readinputport(4)*0x10; | |
| 360 | UINT16 volume3 = readinputport(5)*0x10; | |
| 357 | UINT16 volume0 = input_port_read_indexed(machine, 2)*0x10; | |
| 358 | UINT16 volume1 = input_port_read_indexed(machine, 3)*0x10; | |
| 359 | UINT16 volume2 = input_port_read_indexed(machine, 4)*0x10; | |
| 360 | UINT16 volume3 = input_port_read_indexed(machine, 5)*0x10; | |
| 361 | 361 | |
| 362 | 362 | namcos22_shareram[0x030/4] = (flags<<16)|volume0; |
| 363 | 363 | namcos22_shareram[0x034/4] = (volume1<<16)|volume2; |
| 364 | 364 | namcos22_shareram[0x038/4] = volume3<<16; |
| 365 | 365 | |
| 366 | HandleCoinage(1); | |
| 366 | HandleCoinage(machine, 1); | |
| 367 | 367 | } |
| 368 | 368 | } /* HandleCyberCommandoIO */ |
| 369 | 369 | |
| r2375 | r2376 | |
| 1299 | 1299 | } |
| 1300 | 1300 | static WRITE32_HANDLER( namcos22_portbit_w ) |
| 1301 | 1301 | { |
| 1302 | unsigned dat50000008 = AnalogAsDigital(); | |
| 1302 | unsigned dat50000008 = AnalogAsDigital(machine); | |
| 1303 | 1303 | unsigned dat5000000a = 0xffff; |
| 1304 | 1304 | mSys22PortBits = (dat50000008<<16)|dat5000000a; |
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | static READ32_HANDLER( namcos22_dipswitch_r ) |
| 1308 | 1308 | { |
| 1309 | return | |
| 1309 | return | |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | 1312 | static READ32_HANDLER( namcos22_mcuram_r ) |
| r2375 | r2376 | |
| 1376 | 1376 | |
| 1377 | 1377 | static READ32_HANDLER( namcos22_gun_r ) |
| 1378 | 1378 | { |
| 1379 | int xpos = readinputport(1)*640/0xff; | |
| 1380 | int ypos = readinputport(2)*480/0xff; | |
| 1379 | int xpos = input_port_read_indexed(machine, 1)*640/0xff; | |
| 1380 | int ypos = input_port_read_indexed(machine, 2)*480/0xff; | |
| 1381 | 1381 | switch( offset ) |
| 1382 | 1382 | { |
| 1383 | 1383 | case 0: /* 430000 */ |
| r2375 | r2376 | |
| 1541 | 1541 | { |
| 1542 | 1542 | if (mFrameCount & 1) |
| 1543 | 1543 | { |
| 1544 | return | |
| 1544 | return | |
| 1545 | 1545 | } |
| 1546 | 1546 | else |
| 1547 | 1547 | { |
| 1548 | return | |
| 1548 | return | |
| 1549 | 1549 | } |
| 1550 | 1550 | } |
| 1551 | 1551 | else |
| r2375 | r2376 | |
| 1564 | 1564 | { |
| 1565 | 1565 | if (p4 & 8) |
| 1566 | 1566 | { |
| 1567 | return | |
| 1567 | return | |
| 1568 | 1568 | } |
| 1569 | 1569 | else |
| 1570 | 1570 | { |
| 1571 | return | |
| 1571 | return | |
| 1572 | 1572 | } |
| 1573 | 1573 | } |
| 1574 | 1574 | } |
| r2375 | r2376 | |
| 1611 | 1611 | { |
| 1612 | 1612 | static UINT16 ddx, ddy; |
| 1613 | 1613 | |
| 1614 | ddx = ((readinputport(2)^0xff)-1)<<2; | |
| 1615 | ddy = (readinputport(3)-1)<<2; | |
| 1614 | ddx = ((input_port_read_indexed(machine, 2)^0xff)-1)<<2; | |
| 1615 | ddy = (input_port_read_indexed(machine, 3)-1)<<2; | |
| 1616 | 1616 | |
| 1617 | 1617 | switch (offset) |
| 1618 | 1618 | { |
| r2375 | r2376 | |
| 1625 | 1625 | // and timer A3 is configured by the MCU program to cause an interrupt each time |
| 1626 | 1626 | // it's clocked. by counting the number of interrupts in a frame, we can determine |
| 1627 | 1627 | // how fast the user is pedaling. |
| 1628 | if( | |
| 1628 | if( | |
| 1629 | 1629 | { |
| 1630 | 1630 | int i; |
| 1631 | 1631 | for (i = 0; i < 16; i++) |
| r2375 | r2376 | |
| 1654 | 1654 | // 0 H+L = swing, 1 H+L = edge |
| 1655 | 1655 | static READ8_HANDLER( alpineracer_mcu_adc_r ) |
| 1656 | 1656 | { |
| 1657 | UINT16 swing = (0xff-readinputport(2))<<2; | |
| 1658 | UINT16 edge = (0xff-readinputport(3))<<2; | |
| 1657 | UINT16 swing = (0xff-input_port_read_indexed(machine, 2))<<2; | |
| 1658 | UINT16 edge = (0xff-input_port_read_indexed(machine, 3))<<2; | |
| 1659 | 1659 | |
| 1660 | 1660 | // fake out the centering a bit |
| 1661 | if (readinputport(2) == 0x80) swing = 0x200; | |
| 1662 | if (readinputport(3) == 0x80) edge = 0x200; | |
| 1661 | if (input_port_read_indexed(machine, 2) == 0x80) swing = 0x200; | |
| 1662 | if (input_port_read_indexed(machine, 3) == 0x80) edge = 0x200; | |
| 1663 | 1663 | |
| 1664 | 1664 | switch (offset) |
| 1665 | 1665 | { |
| r2375 | r2376 | |
| 1688 | 1688 | static READ8_HANDLER( cybrcycc_mcu_adc_r ) |
| 1689 | 1689 | { |
| 1690 | 1690 | UINT16 gas,brake,steer; |
| 1691 | ReadAnalogDrivingPorts( &gas, &brake, &steer ); | |
| 1691 | ReadAnalogDrivingPorts( machine, &gas, &brake, &steer ); | |
| 1692 | 1692 | |
| 1693 | 1693 | gas <<= 2; |
| 1694 | 1694 | brake <<= 2; |
| r2375 | r2376 | |
| 1730 | 1730 | { |
| 1731 | 1731 | UINT16 pedal, x, y; |
| 1732 | 1732 | |
| 1733 | pedal = readinputport(1)<<2; | |
| 1734 | x = readinputport(2)<<2; | |
| 1735 | y = readinputport(3)<<2; | |
| 1733 | pedal = input_port_read_indexed(machine, 1)<<2; | |
| 1734 | x = input_port_read_indexed(machine, 2)<<2; | |
| 1735 | y = input_port_read_indexed(machine, 3)<<2; | |
| 1736 | 1736 | |
| 1737 | 1737 | |
| 1738 | 1738 | switch (offset) |
| r2375 | r2376 | |
| 2127 | 2127 | switch( namcos22_gametype ) |
| 2128 | 2128 | { |
| 2129 | 2129 | case NAMCOS22_RIDGE_RACER: |
| 2130 | HandleDrivingIO(); | |
| 2130 | HandleDrivingIO(machine); | |
| 2131 | 2131 | irq_level1 = 4; |
| 2132 | 2132 | irq_level2 = 5; |
| 2133 | 2133 | // 1:0a0b6 |
| r2375 | r2376 | |
| 2140 | 2140 | break; |
| 2141 | 2141 | |
| 2142 | 2142 | case NAMCOS22_RIDGE_RACER2: |
| 2143 | HandleDrivingIO(); | |
| 2143 | HandleDrivingIO(machine); | |
| 2144 | 2144 | irq_level1 = 1; |
| 2145 | 2145 | irq_level2 = 5; |
| 2146 | 2146 | //1:0d10c 40000005 |
| r2375 | r2376 | |
| 2153 | 2153 | break; |
| 2154 | 2154 | |
| 2155 | 2155 | case NAMCOS22_RAVE_RACER: |
| 2156 | HandleDrivingIO(); | |
| 2156 | HandleDrivingIO(machine); | |
| 2157 | 2157 | break; |
| 2158 | 2158 | |
| 2159 | 2159 | case NAMCOS22_VICTORY_LAP: |
| 2160 | HandleDrivingIO(); | |
| 2160 | HandleDrivingIO(machine); | |
| 2161 | 2161 | // a54 indir to 21c2 (hblank?) |
| 2162 | 2162 | // a5a (rte) |
| 2163 | 2163 | // a5c (rte) |
| r2375 | r2376 | |
| 2170 | 2170 | break; |
| 2171 | 2171 | |
| 2172 | 2172 | case NAMCOS22_ACE_DRIVER: |
| 2173 | HandleDrivingIO(); | |
| 2173 | HandleDrivingIO(machine); | |
| 2174 | 2174 | // 9f8 (rte) |
| 2175 | 2175 | // 9fa (rte) |
| 2176 | 2176 | // 9fc (rte) |
| r2375 | r2376 | |
| 2188 | 2188 | //move.b #$35, $40000004.l |
| 2189 | 2189 | // |
| 2190 | 2190 | //move.b #$34, $40000004.l |
| 2191 | HandleCyberCommandoIO(); | |
| 2191 | HandleCyberCommandoIO(machine); | |
| 2192 | 2192 | irq_level1 = nthbyte(namcos22_system_controller,0x04)&0x7; |
| 2193 | 2193 | irq_level2 = nthbyte(namcos22_system_controller,0x02)&0x7; |
| 2194 | 2194 | break; |
| r2375 | r2376 | |
| 4331 | 4331 | |
| 4332 | 4332 | install_c74_speedup(); |
| 4333 | 4333 | |
| 4334 | old_coin_state = | |
| 4334 | old_coin_state = | |
| 4335 | 4335 | credits1 = credits2 = 0; |
| 4336 | 4336 | } |
| 4337 | 4337 | |
| r2375 | r2376 | |
| 4341 | 4341 | |
| 4342 | 4342 | install_c74_speedup(); |
| 4343 | 4343 | |
| 4344 | old_coin_state = | |
| 4344 | old_coin_state = | |
| 4345 | 4345 | credits1 = credits2 = 0; |
| 4346 | 4346 | } |
| 4347 | 4347 | |
| r2375 | r2376 | |
| 4351 | 4351 | |
| 4352 | 4352 | install_c74_speedup(); |
| 4353 | 4353 | |
| 4354 | old_coin_state = | |
| 4354 | old_coin_state = | |
| 4355 | 4355 | credits1 = credits2 = 0; |
| 4356 | 4356 | } |
| 4357 | 4357 | |
| r2375 | r2376 | |
| 4361 | 4361 | |
| 4362 | 4362 | install_c74_speedup(); |
| 4363 | 4363 | |
| 4364 | old_coin_state = | |
| 4364 | old_coin_state = | |
| 4365 | 4365 | credits1 = credits2 = 0; |
| 4366 | 4366 | } |
| 4367 | 4367 | |
| r2375 | r2376 | |
| 4371 | 4371 | |
| 4372 | 4372 | install_c74_speedup(); |
| 4373 | 4373 | |
| 4374 | old_coin_state = | |
| 4374 | old_coin_state = | |
| 4375 | 4375 | credits1 = credits2 = 0; |
| 4376 | 4376 | } |
| 4377 | 4377 | |
| r2375 | r2376 | |
| 4388 | 4388 | |
| 4389 | 4389 | install_c74_speedup(); |
| 4390 | 4390 | |
| 4391 | old_coin_state = | |
| 4391 | old_coin_state = | |
| 4392 | 4392 | credits1 = credits2 = 0; |
| 4393 | 4393 | } |
| 4394 | 4394 |
| r2375 | r2376 | |
|---|---|---|
| 41 | 41 | |
| 42 | 42 | memset(potsense, 0, sizeof potsense); |
| 43 | 43 | |
| 44 | potsense[readinputport(1)] |= 1; | |
| 45 | potsense[readinputport(2)] |= 2; | |
| 46 | potsense[readinputport(3)] |= 4; | |
| 47 | potsense[readinputport(4)] |= 8; | |
| 44 | potsense[input_port_read_indexed(machine, 1)] |= 1; | |
| 45 | potsense[input_port_read_indexed(machine, 2)] |= 2; | |
| 46 | potsense[input_port_read_indexed(machine, 3)] |= 4; | |
| 47 | potsense[input_port_read_indexed(machine, 4)] |= 8; | |
| 48 | 48 | |
| 49 | 49 | for (i = 0; i < 64; i++) |
| 50 | 50 | if (potsense[i] != 0) |
| r2375 | r2376 | |
| 79 | 79 | |
| 80 | 80 | static READ8_HANDLER( flyball_input_r ) |
| 81 | 81 | { |
| 82 | return | |
| 82 | return | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | static READ8_HANDLER( flyball_scanline_r ) |
| r2375 | r2376 | |
|---|---|---|
| 45 | 45 | */ |
| 46 | 46 | static INTERRUPT_GEN( redclash_interrupt ) |
| 47 | 47 | { |
| 48 | if ( | |
| 48 | if ( | |
| 49 | 49 | cpunum_set_input_line(machine, 0,0,ASSERT_LINE); |
| 50 | else if ( | |
| 50 | else if ( | |
| 51 | 51 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 52 | 52 | } |
| 53 | 53 |
| r2375 | r2376 | |
|---|---|---|
| 85 | 85 | |
| 86 | 86 | static CUSTOM_INPUT( vicdual_read_coin_status ) |
| 87 | 87 | { |
| 88 | UINT32 coin_input = | |
| 88 | UINT32 coin_input = | |
| 89 | 89 | |
| 90 | 90 | if (coin_input && !last_coin_input) |
| 91 | 91 | { |
| r2375 | r2376 | |
| 188 | 188 | #define COLOR_BW_PORT_TAG "COLOR_BW" |
| 189 | 189 | |
| 190 | 190 | |
| 191 | int vicdual_is_cabinet_color( | |
| 191 | int vicdual_is_cabinet_color(running_machine *machine) | |
| 192 | 192 | { |
| 193 | return ( | |
| 193 | return ( | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
| r2375 | r2376 | |
| 352 | 352 | { |
| 353 | 353 | UINT8 ret = 0; |
| 354 | 354 | |
| 355 | if (offset & 0x01) ret = input_port_0_r(machine,0); | |
| 356 | if (offset & 0x08) ret = input_port_1_r(machine,0); | |
| 355 | if (offset & 0x01) ret = input_port_read_indexed(machine, 0); | |
| 356 | if (offset & 0x08) ret = input_port_read_indexed(machine, 1); | |
| 357 | 357 | |
| 358 | 358 | return ret; |
| 359 | 359 | } |
| r2375 | r2376 | |
| 436 | 436 | { |
| 437 | 437 | UINT8 ret = 0; |
| 438 | 438 | |
| 439 | if (offset & 0x01) ret = input_port_0_r(machine,0); | |
| 440 | if (offset & 0x08) ret = input_port_1_r(machine,0); | |
| 439 | if (offset & 0x01) ret = input_port_read_indexed(machine, 0); | |
| 440 | if (offset & 0x08) ret = input_port_read_indexed(machine, 1); | |
| 441 | 441 | |
| 442 | 442 | return ret; |
| 443 | 443 | } |
| r2375 | r2376 | |
| 544 | 544 | { |
| 545 | 545 | UINT8 ret = 0; |
| 546 | 546 | |
| 547 | if (offset & 0x01) ret = input_port_0_r(machine,0); | |
| 548 | if (offset & 0x08) ret = input_port_1_r(machine,0); | |
| 547 | if (offset & 0x01) ret = input_port_read_indexed(machine, 0); | |
| 548 | if (offset & 0x08) ret = input_port_read_indexed(machine, 1); | |
| 549 | 549 | |
| 550 | 550 | return ret; |
| 551 | 551 | } |
| r2375 | r2376 | |
| 2098 | 2098 | { |
| 2099 | 2099 | UINT8 ret = 0; |
| 2100 | 2100 | |
| 2101 | if (offset & 0x01) ret = input_port_0_r(machine,0); | |
| 2102 | if (offset & 0x08) ret = input_port_1_r(machine,0); | |
| 2101 | if (offset & 0x01) ret = input_port_read_indexed(machine, 0); | |
| 2102 | if (offset & 0x08) ret = input_port_read_indexed(machine, 1); | |
| 2103 | 2103 | |
| 2104 | 2104 | return ret; |
| 2105 | 2105 | } |
| r2375 | r2376 | |
| 2193 | 2193 | { |
| 2194 | 2194 | UINT8 ret = 0; |
| 2195 | 2195 | |
| 2196 | if (offset & 0x01) ret = input_port_0_r(machine,0); | |
| 2197 | if (offset & 0x02) ret = input_port_1_r(machine,0); | |
| 2198 | if (offset & 0x08) ret = input_port_2_r(machine,0); | |
| 2196 | if (offset & 0x01) ret = input_port_read_indexed(machine, 0); | |
| 2197 | if (offset & 0x02) ret = input_port_read_indexed(machine, 1); | |
| 2198 | if (offset & 0x08) ret = input_port_read_indexed(machine, 2); | |
| 2199 | 2199 | |
| 2200 | 2200 | return ret; |
| 2201 | 2201 | } |
| r2375 | r2376 | |
|---|---|---|
| 66 | 66 | { |
| 67 | 67 | static int h256 = 0x0400; |
| 68 | 68 | |
| 69 | int result = | |
| 69 | int result = | |
| 70 | 70 | |
| 71 | 71 | if (atarigen_cpu_to_sound_ready) result ^= 0x0200; |
| 72 | 72 | result ^= h256 ^= 0x0400; |
| r2375 | r2376 | |
|---|---|---|
| 1000 | 1000 | { |
| 1001 | 1001 | if (cpu_getiloops() != 0) |
| 1002 | 1002 | { |
| 1003 | UINT8 val = | |
| 1003 | UINT8 val = | |
| 1004 | 1004 | |
| 1005 | 1005 | coin_counter_w(0, val & 1); |
| 1006 | 1006 | |
| r2375 | r2376 | |
| 1016 | 1016 | { |
| 1017 | 1017 | if (cpu_getiloops() != 0) |
| 1018 | 1018 | { |
| 1019 | UINT8 val = | |
| 1019 | UINT8 val = | |
| 1020 | 1020 | |
| 1021 | 1021 | coin_counter_w(0, val & 1); |
| 1022 | 1022 | coin_counter_w(1, val & 2); |
| r2375 | r2376 | |
|---|---|---|
| 444 | 444 | { |
| 445 | 445 | switch( mux_data & 0x0f ) /* bits 0-3 */ |
| 446 | 446 | { |
| 447 | case 0x01: return input_port_0_r(machine,0); | |
| 448 | case 0x02: return input_port_1_r(machine,0); | |
| 449 | case 0x04: return input_port_2_r(machine,0); | |
| 450 | case 0x08: return input_port_3_r(machine,0); | |
| 451 | case 0x00: return input_port_4_r(machine,0); | |
| 447 | case 0x01: return input_port_read_indexed(machine, 0); | |
| 448 | case 0x02: return input_port_read_indexed(machine, 1); | |
| 449 | case 0x04: return input_port_read_indexed(machine, 2); | |
| 450 | case 0x08: return input_port_read_indexed(machine, 3); | |
| 451 | case 0x00: return input_port_read_indexed(machine, 4); | |
| 452 | 452 | } |
| 453 | 453 | return 0xff; |
| 454 | 454 | } |
| r2375 | r2376 | |
|---|---|---|
| 546 | 546 | |
| 547 | 547 | |
| 548 | 548 | static READ8_HANDLER( scramb2_protection_r ) { return 0x25; } |
| 549 | static READ8_HANDLER( scramb2_port0_r ) { return (readinputport(0)>>offset)&0x1; } | |
| 550 | static READ8_HANDLER( scramb2_port1_r ) { return (readinputport(1)>>offset)&0x1; } | |
| 551 | static READ8_HANDLER( scramb2_port2_r ) { return (readinputport(2)>>offset)&0x1; } | |
| 549 | static READ8_HANDLER( scramb2_port0_r ) { return (input_port_read_indexed(machine, 0)>>offset)&0x1; } | |
| 550 | static READ8_HANDLER( scramb2_port1_r ) { return (input_port_read_indexed(machine, 1)>>offset)&0x1; } | |
| 551 | static READ8_HANDLER( scramb2_port2_r ) { return (input_port_read_indexed(machine, 2)>>offset)&0x1; } | |
| 552 | 552 | |
| 553 | 553 | static ADDRESS_MAP_START( scramb2_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 554 | 554 | AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) |
| r2375 | r2376 | |
|---|---|---|
| 507 | 507 | * to prevent the counter from wrapping around between reads. |
| 508 | 508 | */ |
| 509 | 509 | |
| 510 | INLINE int read_trackball(int idx, int switch_port) | |
| 510 | INLINE int read_trackball(running_machine *machine, int idx, int switch_port) | |
| 511 | 511 | { |
| 512 | 512 | UINT8 newpos; |
| 513 | 513 | |
| r2375 | r2376 | |
| 517 | 517 | |
| 518 | 518 | /* if we're to read the dipswitches behind the trackball data, do it now */ |
| 519 | 519 | if (dsw_select) |
| 520 | return ( | |
| 520 | return ( | |
| 521 | 521 | |
| 522 | 522 | /* get the new position and adjust the result */ |
| 523 | newpos = | |
| 523 | newpos = | |
| 524 | 524 | if (newpos != oldpos[idx]) |
| 525 | 525 | { |
| 526 | 526 | sign[idx] = (newpos - oldpos[idx]) & 0x80; |
| r2375 | r2376 | |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | /* blend with the bits from the switch port */ |
| 531 | return ( | |
| 531 | return ( | |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | |
| 535 | 535 | static READ8_HANDLER( centiped_IN0_r ) |
| 536 | 536 | { |
| 537 | return read_trackball(0, 0); | |
| 537 | return read_trackball(machine, 0, 0); | |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | |
| 541 | 541 | static READ8_HANDLER( centiped_IN2_r ) |
| 542 | 542 | { |
| 543 | return read_trackball(1, 2); | |
| 543 | return read_trackball(machine, 1, 2); | |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | |
| 547 | 547 | static READ8_HANDLER( milliped_IN1_r ) |
| 548 | 548 | { |
| 549 | return read_trackball(1, 1); | |
| 549 | return read_trackball(machine, 1, 1); | |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | static READ8_HANDLER( milliped_IN2_r ) |
| 553 | 553 | { |
| 554 | UINT8 data = | |
| 554 | UINT8 data = | |
| 555 | 555 | |
| 556 | 556 | /* MSH - 15 Feb, 2007 |
| 557 | 557 | * The P2 X Joystick inputs are not properly handled in |
| r2375 | r2376 | |
| 562 | 562 | */ |
| 563 | 563 | if (0 != control_select) { |
| 564 | 564 | /* Bottom 4 bits is our joystick inputs */ |
| 565 | UINT8 joy2data = | |
| 565 | UINT8 joy2data = | |
| 566 | 566 | data = data & 0xf0; /* Keep the top 4 bits */ |
| 567 | 567 | data |= (joy2data & 0x0a) >> 1; /* flip left and up */ |
| 568 | 568 | data |= (joy2data & 0x05) << 1; /* flip right and down */ |
| r2375 | r2376 | |
| 584 | 584 | |
| 585 | 585 | static READ8_HANDLER( mazeinv_input_r ) |
| 586 | 586 | { |
| 587 | return | |
| 587 | return | |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 |
| r2375 | r2376 | |
|---|---|---|
| 214 | 214 | |
| 215 | 215 | /* digital joystick type */ |
| 216 | 216 | if (joystick_type == 1) |
| 217 | newval = ( | |
| 217 | newval = ( | |
| 218 | 218 | |
| 219 | 219 | /* Hall-effect analog joystick */ |
| 220 | 220 | else if (joystick_type == 2) |
| 221 | newval = | |
| 221 | newval = | |
| 222 | 222 | |
| 223 | 223 | /* Road Blasters gas pedal */ |
| 224 | 224 | else if (joystick_type == 3) |
| 225 | newval = | |
| 225 | newval = | |
| 226 | 226 | |
| 227 | 227 | /* the A4 bit enables/disables joystick IRQs */ |
| 228 | 228 | joystick_int_enable = ((offset >> 3) & 1) ^ 1; |
| r2375 | r2376 | |
| 268 | 268 | |
| 269 | 269 | if (player == 0) |
| 270 | 270 | { |
| 271 | posx = (INT8)readinputport(0); | |
| 272 | posy = (INT8)readinputport(1); | |
| 271 | posx = (INT8)input_port_read_indexed(machine, 0); | |
| 272 | posy = (INT8)input_port_read_indexed(machine, 1); | |
| 273 | 273 | } |
| 274 | 274 | else |
| 275 | 275 | { |
| 276 | posx = (INT8)readinputport(2); | |
| 277 | posy = (INT8)readinputport(3); | |
| 276 | posx = (INT8)input_port_read_indexed(machine, 2); | |
| 277 | posy = (INT8)input_port_read_indexed(machine, 3); | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | cur[player][0] = posx + posy; |
| r2375 | r2376 | |
| 286 | 286 | |
| 287 | 287 | /* Road Blasters steering wheel */ |
| 288 | 288 | else if (trackball_type == 2) |
| 289 | result = | |
| 289 | result = | |
| 290 | 290 | |
| 291 | 291 | return result; |
| 292 | 292 | } |
| r2375 | r2376 | |
| 301 | 301 | |
| 302 | 302 | static READ16_HANDLER( port4_r ) |
| 303 | 303 | { |
| 304 | int temp = | |
| 304 | int temp = | |
| 305 | 305 | if (atarigen_cpu_to_sound_ready) temp ^= 0x0080; |
| 306 | 306 | return temp; |
| 307 | 307 | } |
| r2375 | r2376 | |
| 316 | 316 | |
| 317 | 317 | static READ8_HANDLER( switch_6502_r ) |
| 318 | 318 | { |
| 319 | int temp = | |
| 319 | int temp = | |
| 320 | 320 | |
| 321 | 321 | if (atarigen_cpu_to_sound_ready) temp ^= 0x08; |
| 322 | 322 | if (atarigen_sound_to_cpu_ready) temp ^= 0x10; |
| 323 | if (!( | |
| 323 | if (!( | |
| 324 | 324 | |
| 325 | 325 | return temp; |
| 326 | 326 | } |
| r2375 | r2376 | |
|---|---|---|
| 548 | 548 | static READ16_HANDLER( wgp_adinput_r ) |
| 549 | 549 | { |
| 550 | 550 | int steer = 0x40; |
| 551 | int fake = | |
| 551 | int fake = | |
| 552 | 552 | |
| 553 | 553 | if (!(fake & 0x10)) /* Analogue steer (the real control method) */ |
| 554 | 554 | { |
| 555 | 555 | /* Reduce span to 0x80 */ |
| 556 | steer = ( | |
| 556 | steer = ( | |
| 557 | 557 | } |
| 558 | 558 | else /* Digital steer */ |
| 559 | 559 | { |
| r2375 | r2376 | |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | case 0x05: |
| 601 | return | |
| 601 | return | |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | logerror("CPU #0 PC %06x: warning - read unmapped a/d input offset %06x\n",activecpu_get_pc(),offset); |
| r2375 | r2376 | |
| 935 | 935 | graphics glitches. |
| 936 | 936 | ***********************************************************/ |
| 937 | 937 | |
| 938 | static STATE_POSTLOAD( wgp_postload ) | |
| 939 | { | |
| 940 | parse_control(); | |
| 941 | reset_sound_region(); | |
| 942 | } | |
| 943 | ||
| 938 | 944 | static MACHINE_START( wgp ) |
| 939 | 945 | { |
| 940 | 946 | state_save_register_global(cpua_ctrl); |
| 941 | state_save_register_func_postload(parse_control); | |
| 942 | ||
| 943 | 947 | state_save_register_global(banknum); |
| 944 | state_save_register_ | |
| 948 | state_save_register_ | |
| 945 | 949 | } |
| 946 | 950 | |
| 947 | 951 | static MACHINE_DRIVER_START( wgp ) |
| r2375 | r2376 | |
|---|---|---|
| 354 | 354 | |
| 355 | 355 | static READ16_HANDLER( in0_r ) |
| 356 | 356 | { |
| 357 | return | |
| 357 | return | |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | static WRITE8_HANDLER( pending_command_clear_w ) |
| r2375 | r2376 | |
|---|---|---|
| 34 | 34 | |
| 35 | 35 | for (i = 0; i < 8; i++) |
| 36 | 36 | { |
| 37 | UINT8 val = | |
| 37 | UINT8 val = | |
| 38 | 38 | |
| 39 | 39 | signed char delta = (val - dial[i]) & 15; |
| 40 | 40 | |
| r2375 | r2376 | |
| 71 | 71 | |
| 72 | 72 | static READ8_HANDLER( sprint8_input_r ) |
| 73 | 73 | { |
| 74 | UINT8 val = | |
| 74 | UINT8 val = | |
| 75 | 75 | |
| 76 | 76 | if (steer_dir[offset]) |
| 77 | 77 | { |
| r2375 | r2376 | |
|---|---|---|
| 491 | 491 | |
| 492 | 492 | static READ16_HANDLER( gdfs_eeprom_r ) |
| 493 | 493 | { |
| 494 | return (((gdfs_lightgun_select & 1) ? 0 : 0xff) ^ | |
| 494 | return (((gdfs_lightgun_select & 1) ? 0 : 0xff) ^ | |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | static WRITE16_HANDLER( gdfs_eeprom_w ) |
| r2375 | r2376 | |
| 644 | 644 | static READ16_HANDLER( hypreact_input_r ) |
| 645 | 645 | { |
| 646 | 646 | UINT16 input_sel = *ssv_input_sel; |
| 647 | if (input_sel & 0x0001) return readinputport(5); | |
| 648 | if (input_sel & 0x0002) return readinputport(6); | |
| 649 | if (input_sel & 0x0004) return readinputport(7); | |
| 650 | if (input_sel & 0x0008) return readinputport(8); | |
| 647 | if (input_sel & 0x0001) return input_port_read_indexed(machine, 5); | |
| 648 | if (input_sel & 0x0002) return input_port_read_indexed(machine, 6); | |
| 649 | if (input_sel & 0x0004) return input_port_read_indexed(machine, 7); | |
| 650 | if (input_sel & 0x0008) return input_port_read_indexed(machine, 8); | |
| 651 | 651 | logerror("CPU #0 PC %06X: unknown input read: %04X\n",activecpu_get_pc(),input_sel); |
| 652 | 652 | return 0xffff; |
| 653 | 653 | } |
| r2375 | r2376 | |
| 792 | 792 | static READ16_HANDLER( srmp4_input_r ) |
| 793 | 793 | { |
| 794 | 794 | UINT16 input_sel = *ssv_input_sel; |
| 795 | if (input_sel & 0x0002) return readinputport(5); | |
| 796 | if (input_sel & 0x0004) return readinputport(6); | |
| 797 | if (input_sel & 0x0008) return readinputport(7); | |
| 798 | if (input_sel & 0x0010) return readinputport(8); | |
| 795 | if (input_sel & 0x0002) return input_port_read_indexed(machine, 5); | |
| 796 | if (input_sel & 0x0004) return input_port_read_indexed(machine, 6); | |
| 797 | if (input_sel & 0x0008) return input_port_read_indexed(machine, 7); | |
| 798 | if (input_sel & 0x0010) return input_port_read_indexed(machine, 8); | |
| 799 | 799 | logerror("CPU #0 PC %06X: unknown input read: %04X\n",activecpu_get_pc(),input_sel); |
| 800 | 800 | return 0xffff; |
| 801 | 801 | } |
| r2375 | r2376 | |
| 841 | 841 | static READ16_HANDLER( srmp7_input_r ) |
| 842 | 842 | { |
| 843 | 843 | UINT16 input_sel = *ssv_input_sel; |
| 844 | if (input_sel & 0x0002) return readinputport(5); | |
| 845 | if (input_sel & 0x0004) return readinputport(6); | |
| 846 | if (input_sel & 0x0008) return readinputport(7); | |
| 847 | if (input_sel & 0x0010) return readinputport(8); | |
| 844 | if (input_sel & 0x0002) return input_port_read_indexed(machine, 5); | |
| 845 | if (input_sel & 0x0004) return input_port_read_indexed(machine, 6); | |
| 846 | if (input_sel & 0x0008) return input_port_read_indexed(machine, 7); | |
| 847 | if (input_sel & 0x0010) return input_port_read_indexed(machine, 8); | |
| 848 | 848 | logerror("CPU #0 PC %06X: unknown input read: %04X\n",activecpu_get_pc(),input_sel); |
| 849 | 849 | return 0xffff; |
| 850 | 850 | } |
| r2375 | r2376 | |
| 898 | 898 | |
| 899 | 899 | static READ16_HANDLER( sxyreact_ballswitch_r ) |
| 900 | 900 | { |
| 901 | return | |
| 901 | return | |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | static READ16_HANDLER( sxyreact_dial_r ) |
| r2375 | r2376 | |
| 913 | 913 | static int old; |
| 914 | 914 | |
| 915 | 915 | if (data & 0x20) |
| 916 | serial = | |
| 916 | serial = | |
| 917 | 917 | |
| 918 | 918 | if ( (old & 0x40) && !(data & 0x40) ) // $40 -> $00 |
| 919 | 919 | serial <<= 1; // shift 1 bit |
| r2375 | r2376 | |
| 1071 | 1071 | { |
| 1072 | 1072 | switch(trackball_select) |
| 1073 | 1073 | { |
| 1074 | case 0x60: return (readinputport(5) >> 8) & 0xff; | |
| 1075 | case 0x40: return (readinputport(5) >> 0) & 0xff; | |
| 1074 | case 0x60: return (input_port_read_indexed(machine, 5) >> 8) & 0xff; | |
| 1075 | case 0x40: return (input_port_read_indexed(machine, 5) >> 0) & 0xff; | |
| 1076 | 1076 | |
| 1077 | case 0x70: return (readinputport(6) >> 8) & 0xff; | |
| 1078 | case 0x50: return (readinputport(6) >> 0) & 0xff; | |
| 1077 | case 0x70: return (input_port_read_indexed(machine, 6) >> 8) & 0xff; | |
| 1078 | case 0x50: return (input_port_read_indexed(machine, 6) >> 0) & 0xff; | |
| 1079 | 1079 | } |
| 1080 | 1080 | return 0; |
| 1081 | 1081 | } |
| r2375 | r2376 | |
|---|---|---|
| 312 | 312 | switch( offset ) |
| 313 | 313 | { |
| 314 | 314 | case 0x00: /* "counter 1" lo */ |
| 315 | return | |
| 315 | return | |
| 316 | 316 | |
| 317 | 317 | case 0x01: /* "counter 2" lo */ |
| 318 | return | |
| 318 | return | |
| 319 | 319 | |
| 320 | 320 | case 0x02: /* "counter 1" hi */ |
| 321 | return ( | |
| 321 | return ( | |
| 322 | 322 | |
| 323 | 323 | case 0x03: /* "counter 2" hi */ |
| 324 | return ( | |
| 324 | return ( | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | return 0; |
| r2375 | r2376 | |
| 332 | 332 | switch( offset ) |
| 333 | 333 | { |
| 334 | 334 | case 0x00: /* "counter 3" lo */ |
| 335 | return | |
| 335 | return | |
| 336 | 336 | |
| 337 | 337 | case 0x02: /* "counter 3" hi */ |
| 338 | return ( | |
| 338 | return ( | |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | return 0; |
| r2375 | r2376 | |
| 355 | 355 | reset_sound_region(); |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | static STATE_POSTLOAD( taitoair_postload ) | |
| 359 | { | |
| 360 | reset_sound_region(); | |
| 361 | } | |
| 358 | 362 | |
| 359 | 363 | static MACHINE_START( taitoair ) |
| 360 | 364 | { |
| 361 | 365 | dsp_HOLD_signal = ASSERT_LINE; |
| 362 | 366 | |
| 363 | 367 | state_save_register_global(banknum); |
| 364 | state_save_register_ | |
| 368 | state_save_register_ | |
| 365 | 369 | } |
| 366 | 370 | |
| 367 | 371 |
| r2375 | r2376 | |
|---|---|---|
| 83 | 83 | |
| 84 | 84 | static READ16_HANDLER( special_port2_r ) |
| 85 | 85 | { |
| 86 | int temp = | |
| 86 | int temp = | |
| 87 | 87 | if (atarigen_cpu_to_sound_ready) temp ^= 0x0020; |
| 88 | 88 | if (atarigen_sound_to_cpu_ready) temp ^= 0x0010; |
| 89 | 89 | temp ^= 0x0008; /* A2D.EOC always high for now */ |
| r2375 | r2376 | |
| 93 | 93 | |
| 94 | 94 | static WRITE16_HANDLER( a2d_select_w ) |
| 95 | 95 | { |
| 96 | analog_data = | |
| 96 | analog_data = | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 |
| r2375 | r2376 | |
|---|---|---|
| 150 | 150 | |
| 151 | 151 | static READ8_HANDLER( dsw0_r ) |
| 152 | 152 | { |
| 153 | return fix_input0( | |
| 153 | return fix_input0( | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | static READ8_HANDLER( dsw1_r ) |
| 157 | 157 | { |
| 158 | return fix_input1( | |
| 158 | return fix_input1( | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | static READ8_HANDLER( input0_r ) |
| 162 | 162 | { |
| 163 | return fix_input0( | |
| 163 | return fix_input0( | |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | static READ8_HANDLER( input1_r ) |
| 167 | 167 | { |
| 168 | return fix_input1( | |
| 168 | return fix_input1( | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | static READ8_HANDLER( readFF ) |
| r2375 | r2376 | |
|---|---|---|
| 101 | 101 | switch (offset) |
| 102 | 102 | { |
| 103 | 103 | case 0 : |
| 104 | data = ( | |
| 104 | data = ( | |
| 105 | 105 | break; |
| 106 | 106 | case 1 : |
| 107 | data = ( | |
| 107 | data = ( | |
| 108 | 108 | break; |
| 109 | 109 | } |
| 110 | 110 |
| r2375 | r2376 | |
|---|---|---|
| 64 | 64 | |
| 65 | 65 | static READ16_HANDLER( port1_r ) |
| 66 | 66 | { |
| 67 | int result = | |
| 67 | int result = | |
| 68 | 68 | if (atarigen_sound_to_cpu_ready) result ^= 0x0004; |
| 69 | 69 | if (atarigen_cpu_to_sound_ready) result ^= 0x0008; |
| 70 | 70 | result ^= 0x0010; |
| r2375 | r2376 | |
|---|---|---|
| 47 | 47 | switch( mux ) |
| 48 | 48 | { |
| 49 | 49 | case 1: /* start buttons */ |
| 50 | buttons = | |
| 50 | buttons = | |
| 51 | 51 | break; |
| 52 | 52 | case 2: /* player 1 buttons */ |
| 53 | buttons = | |
| 53 | buttons = | |
| 54 | 54 | break; |
| 55 | 55 | case 4: /* player 2 buttons */ |
| 56 | buttons = | |
| 56 | buttons = | |
| 57 | 57 | break; |
| 58 | 58 | } |
| 59 | 59 | |
| r2375 | r2376 | |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | return (input_port_ | |
| 72 | return (input_port_ | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | static WRITE8_HANDLER( hanaawas_inputs_mux_w ) |
| r2375 | r2376 | |
|---|---|---|
| 75 | 75 | static MACHINE_RESET( aquarium ) |
| 76 | 76 | { |
| 77 | 77 | UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); |
| 78 | int data = | |
| 78 | int data = | |
| 79 | 79 | |
| 80 | 80 | /* Language : 0x0000 = Japanese - Other value = English */ |
| 81 | 81 |
| r2375 | r2376 | |
|---|---|---|
| 374 | 374 | |
| 375 | 375 | static READ16_HANDLER( daitorid_soundstatus_r ) |
| 376 | 376 | { |
| 377 | return | |
| 377 | return | |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | static WRITE16_HANDLER( metro_soundstatus_w ) |
| r2375 | r2376 | |
| 908 | 908 | /* Really weird way of mapping 3 DSWs */ |
| 909 | 909 | static READ16_HANDLER( balcube_dsw_r ) |
| 910 | 910 | { |
| 911 | UINT16 dsw1 = readinputport(2) >> 0; | |
| 912 | UINT16 dsw2 = readinputport(2) >> 8; | |
| 913 | UINT16 dsw3 = readinputport(3); | |
| 911 | UINT16 dsw1 = input_port_read_indexed(machine, 2) >> 0; | |
| 912 | UINT16 dsw2 = input_port_read_indexed(machine, 2) >> 8; | |
| 913 | UINT16 dsw3 = input_port_read_indexed(machine, 3); | |
| 914 | 914 | |
| 915 | 915 | switch (offset*2) |
| 916 | 916 | { |
| r2375 | r2376 | |
| 1415 | 1415 | { |
| 1416 | 1416 | UINT16 input_sel = (*gakusai_input_sel) ^ 0x3e; |
| 1417 | 1417 | // Bit 0 ?? |
| 1418 | if (input_sel & 0x0002) return readinputport(0); | |
| 1419 | if (input_sel & 0x0004) return readinputport(1); | |
| 1420 | if (input_sel & 0x0008) return readinputport(2); | |
| 1421 | if (input_sel & 0x0010) return readinputport(3); | |
| 1422 | if (input_sel & 0x0020) return readinputport(4); | |
| 1418 | if (input_sel & 0x0002) return input_port_read_indexed(machine, 0); | |
| 1419 | if (input_sel & 0x0004) return input_port_read_indexed(machine, 1); | |
| 1420 | if (input_sel & 0x0008) return input_port_read_indexed(machine, 2); | |
| 1421 | if (input_sel & 0x0010) return input_port_read_indexed(machine, 3); | |
| 1422 | if (input_sel & 0x0020) return input_port_read_indexed(machine, 4); | |
| 1423 | 1423 | return 0xffff; |
| 1424 | 1424 | } |
| 1425 | 1425 | |
| r2375 | r2376 | |
| 2097 | 2097 | |
| 2098 | 2098 | static READ16_HANDLER( puzzlet_dsw_r ) |
| 2099 | 2099 | { |
| 2100 | return | |
| 2100 | return | |
| 2101 | 2101 | } |
| 2102 | 2102 | |
| 2103 | 2103 | static WRITE16_HANDLER( puzzlet_irq_enable_w ) |
| r2375 | r2376 | |
|---|---|---|
| 181 | 181 | |
| 182 | 182 | static READ8_HANDLER( angelkds_input_r ) |
| 183 | 183 | { |
| 184 | int fake = | |
| 184 | int fake = | |
| 185 | 185 | |
| 186 | return ((fake & 0x01) ? fake : | |
| 186 | return ((fake & 0x01) ? fake : | |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | #else |
| 190 | 190 | |
| 191 | 191 | static READ8_HANDLER( angelkds_input_r ) |
| 192 | 192 | { |
| 193 | return | |
| 193 | return | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | #endif |
| r2375 | r2376 | |
|---|---|---|
| 104 | 104 | |
| 105 | 105 | static READ32_HANDLER( port0_r ) |
| 106 | 106 | { |
| 107 | UINT16 val = | |
| 107 | UINT16 val = | |
| 108 | 108 | UINT16 diff = val ^ last_port0; |
| 109 | 109 | |
| 110 | 110 | /* make sure the shift controls are mutually exclusive */ |
| r2375 | r2376 | |
| 126 | 126 | |
| 127 | 127 | static READ32_HANDLER( port1_r ) |
| 128 | 128 | { |
| 129 | return ( | |
| 129 | return ( | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | static READ32_HANDLER( port2_r ) |
| 134 | 134 | { |
| 135 | return ( | |
| 135 | return ( | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
| r2375 | r2376 | |
| 169 | 169 | int which = (data >> adc_shift) - 4; |
| 170 | 170 | if (which < 0 || which > 2) |
| 171 | 171 | logerror("adc_w: unexpected which = %02X\n", which + 4); |
| 172 | adc_data = | |
| 172 | adc_data = | |
| 173 | 173 | timer_set(ATTOTIME_IN_MSEC(1), NULL, 0, adc_ready); |
| 174 | 174 | } |
| 175 | 175 | else |
| r2375 | r2376 | |
|---|---|---|
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | |
| 71 | static ADDRESS_MAP_START( usgames_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 72 | AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_RAM) | |
| 73 | ||
| 71 | static ADDRESS_MAP_START( usgames_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 72 | AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) | |
| 74 | 73 | AM_RANGE(0x2000, 0x2000) AM_READ(input_port_1_r) |
| 75 | 74 | AM_RANGE(0x2010, 0x2010) AM_READ(input_port_0_r) |
| 76 | AM_RANGE(0x2041, 0x2041) AM_READ(input_port_2_r) | |
| 77 | AM_RANGE(0x2070, 0x2070) AM_READ(input_port_3_r) | |
| 78 | ||
| 79 | AM_RANGE(0x2800, 0x2fff) AM_READ(SMH_RAM) | |
| 80 | AM_RANGE(0x3000, 0x3fff) AM_READ(SMH_RAM) | |
| 81 | AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) | |
| 82 | AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) | |
| 83 | ADDRESS_MAP_END | |
| 84 | ||
| 85 | static ADDRESS_MAP_START( usg185_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 86 | AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_RAM) | |
| 87 | ||
| 88 | AM_RANGE(0x2400, 0x2400) AM_READ(input_port_1_r) | |
| 89 | AM_RANGE(0x2410, 0x2410) AM_READ(input_port_0_r) | |
| 90 | AM_RANGE(0x2441, 0x2441) AM_READ(input_port_2_r) | |
| 91 | AM_RANGE(0x2470, 0x2470) AM_READ(input_port_3_r) | |
| 92 | ||
| 93 | AM_RANGE(0x2800, 0x2fff) AM_READ(SMH_RAM) | |
| 94 | AM_RANGE(0x3000, 0x3fff) AM_READ(SMH_RAM) | |
| 95 | AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) | |
| 96 | AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) | |
| 97 | ADDRESS_MAP_END | |
| 98 | ||
| 99 | static ADDRESS_MAP_START( usgames_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 100 | AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_RAM) AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) | |
| 101 | ||
| 102 | 75 | AM_RANGE(0x2020, 0x2020) AM_WRITE(lamps1_w) |
| 103 | 76 | AM_RANGE(0x2030, 0x2030) AM_WRITE(lamps2_w) |
| 104 | ||
| 105 | 77 | AM_RANGE(0x2040, 0x2040) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w) |
| 78 | AM_RANGE(0x2041, 0x2041) AM_READ(input_port_2_r) | |
| 106 | 79 | AM_RANGE(0x2041, 0x2041) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w) |
| 107 | ||
| 80 | AM_RANGE(0x2060, 0x2060) AM_WRITE(usgames_rombank_w) | |
| 81 | AM_RANGE(0x2070, 0x2070) AM_READ(input_port_3_r) | |
| 108 | 82 | AM_RANGE(0x2400, 0x2400) AM_WRITE(AY8910_control_port_0_w) |
| 109 | 83 | AM_RANGE(0x2401, 0x2401) AM_WRITE(AY8910_write_port_0_w) |
| 110 | ||
| 111 | AM_RANGE(0x2060, 0x2060) AM_WRITE(usgames_rombank_w) | |
| 112 | ||
| 113 | AM_RANGE(0x2800, 0x2fff) AM_WRITE(usgames_charram_w) AM_BASE(&usgames_charram) | |
| 114 | AM_RANGE(0x3000, 0x3fff) AM_WRITE(usgames_videoram_w) AM_BASE(&usgames_videoram) | |
| 115 | AM_RANGE(0x4000, 0x7fff) AM_WRITE(SMH_ROM) | |
| 116 | AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM) | |
| 84 | AM_RANGE(0x2800, 0x2fff) AM_RAM AM_WRITE(usgames_charram_w) AM_BASE(&usgames_charram) | |
| 85 | AM_RANGE(0x3000, 0x3fff) AM_RAM AM_WRITE(usgames_videoram_w) AM_BASE(&usgames_videoram) | |
| 86 | AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) | |
| 87 | AM_RANGE(0x8000, 0xffff) AM_ROM | |
| 117 | 88 | ADDRESS_MAP_END |
| 118 | 89 | |
| 119 | static ADDRESS_MAP_START( usg185_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 120 | AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_RAM) AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) | |
| 121 | 90 | |
| 91 | static ADDRESS_MAP_START( usg185_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 92 | AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) | |
| 93 | AM_RANGE(0x2000, 0x2000) AM_WRITE(AY8910_control_port_0_w) | |
| 94 | AM_RANGE(0x2001, 0x2001) AM_WRITE(AY8910_write_port_0_w) | |
| 95 | AM_RANGE(0x2400, 0x2400) AM_READ(input_port_1_r) | |
| 96 | AM_RANGE(0x2410, 0x2410) AM_READ(input_port_0_r) | |
| 122 | 97 | AM_RANGE(0x2420, 0x2420) AM_WRITE(lamps1_w) |
| 123 | 98 | AM_RANGE(0x2430, 0x2430) AM_WRITE(lamps2_w) |
| 124 | ||
| 125 | 99 | AM_RANGE(0x2440, 0x2440) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w) |
| 100 | AM_RANGE(0x2441, 0x2441) AM_READ(input_port_2_r) | |
| 126 | 101 | AM_RANGE(0x2441, 0x2441) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w) |
| 127 | ||
| 128 | AM_RANGE(0x2000, 0x2000) AM_WRITE(AY8910_control_port_0_w) | |
| 129 | AM_RANGE(0x2001, 0x2001) AM_WRITE(AY8910_write_port_0_w) | |
| 130 | ||
| 131 | 102 | AM_RANGE(0x2460, 0x2460) AM_WRITE(usgames_rombank_w) |
| 132 | ||
| 133 | AM_RANGE(0x2800, 0x2fff) AM_WRITE(usgames_charram_w) AM_BASE(&usgames_charram) | |
| 134 | AM_RANGE(0x3000, 0x3fff) AM_WRITE(usgames_videoram_w) AM_BASE(&usgames_videoram) | |
| 135 | AM_RANGE(0x4000, 0x7fff) AM_WRITE(SMH_ROM) | |
| 136 | AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM) | |
| 103 | AM_RANGE(0x2470, 0x2470) AM_READ(input_port_3_r) | |
| 104 | AM_RANGE(0x2800, 0x2fff) AM_RAM AM_WRITE(usgames_charram_w) AM_BASE(&usgames_charram) | |
| 105 | AM_RANGE(0x3000, 0x3fff) AM_RAM AM_WRITE(usgames_videoram_w) AM_BASE(&usgames_videoram) | |
| 106 | AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) | |
| 107 | AM_RANGE(0x8000, 0xffff) AM_ROM | |
| 137 | 108 | ADDRESS_MAP_END |
| 138 | 109 | |
| 139 | 110 | #define USGIN0\ |
| r2375 | r2376 | |
| 290 | 261 | |
| 291 | 262 | /* basic machine hardware */ |
| 292 | 263 | MDRV_CPU_ADD_TAG("main", M6809, 2000000) /* ?? */ |
| 293 | MDRV_CPU_PROGRAM_MAP(usgames_ | |
| 264 | MDRV_CPU_PROGRAM_MAP(usgames_ | |
| 294 | 265 | MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,5) /* ?? */ |
| 295 | 266 | |
| 296 | 267 | MDRV_NVRAM_HANDLER(generic_0fill) |
| r2375 | r2376 | |
| 322 | 293 | static MACHINE_DRIVER_START( usg185 ) |
| 323 | 294 | MDRV_IMPORT_FROM(usg32) |
| 324 | 295 | MDRV_CPU_MODIFY("main") |
| 325 | MDRV_CPU_PROGRAM_MAP(usg185_ | |
| 296 | MDRV_CPU_PROGRAM_MAP(usg185_ | |
| 326 | 297 | MACHINE_DRIVER_END |
| 327 | 298 | |
| 328 | 299 |
| r2375 | r2376 | |
|---|---|---|
| 140 | 140 | static READ16_HANDLER( opwolf_in_r ) |
| 141 | 141 | { |
| 142 | 142 | static const char *const inname[2] = { "IN0", "IN1" }; |
| 143 | return | |
| 143 | return | |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | static READ16_HANDLER( opwolf_dsw_r ) |
| 147 | 147 | { |
| 148 | 148 | static const char *const dswname[2] = { "DSWA", "DSWB" }; |
| 149 | return | |
| 149 | return | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | static READ16_HANDLER( opwolf_lightgun_r ) |
| r2375 | r2376 | |
| 156 | 156 | switch (offset) |
| 157 | 157 | { |
| 158 | 158 | case 0x00: /* P1X - Have to remap 8 bit input value, into 0-319 visible range */ |
| 159 | scaled=( | |
| 159 | scaled=( | |
| 160 | 160 | return (scaled + 0x15 + opwolf_gun_xoffs); |
| 161 | 161 | case 0x01: /* P1Y */ |
| 162 | return ( | |
| 162 | return ( | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | return 0xff; |
| r2375 | r2376 | |
| 167 | 167 | |
| 168 | 168 | static READ8_HANDLER( z80_input1_r ) |
| 169 | 169 | { |
| 170 | return | |
| 170 | return | |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | static READ8_HANDLER( z80_input2_r ) |
| 174 | 174 | { |
| 175 | return | |
| 175 | return | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 |
| r2375 | r2376 | |
|---|---|---|
| 885 | 885 | { |
| 886 | 886 | switch( mux_data&0xf0 ) /* bits 4-7 */ |
| 887 | 887 | { |
| 888 | case 0x10: return input_port_0_r(machine,0); | |
| 889 | case 0x20: return input_port_1_r(machine,0); | |
| 890 | case 0x40: return input_port_2_r(machine,0); | |
| 891 | case 0x80: return input_port_3_r(machine,0); | |
| 888 | case 0x10: return input_port_read_indexed(machine, 0); | |
| 889 | case 0x20: return input_port_read_indexed(machine, 1); | |
| 890 | case 0x40: return input_port_read_indexed(machine, 2); | |
| 891 | case 0x80: return input_port_read_indexed(machine, 3); | |
| 892 | 892 | } |
| 893 | 893 | return 0xff; |
| 894 | 894 | } |
| r2375 | r2376 | |
|---|---|---|
| 79 | 79 | |
| 80 | 80 | static READ8_HANDLER( zaccaria_dsw_r ) |
| 81 | 81 | { |
| 82 | return | |
| 82 | return | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
| r2375 | r2376 | |
| 300 | 300 | switch (offset) |
| 301 | 301 | { |
| 302 | 302 | case 0: |
| 303 | return (input_port_ | |
| 303 | return (input_port_ | |
| 304 | 304 | |
| 305 | 305 | case 2: |
| 306 | 306 | return 0x10; /* Jack Rabbit */ |
| r2375 | r2376 | |
| 329 | 329 | |
| 330 | 330 | |
| 331 | 331 | |
| 332 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 333 | AM_RANGE(0x0000, 0x5fff) AM_READ(SMH_ROM) | |
| 332 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 333 | AM_RANGE(0x0000, 0x5fff) AM_ROM | |
| 334 | 334 | AM_RANGE(0x6000, 0x63ff) AM_READ(SMH_RAM) |
| 335 | 335 | AM_RANGE(0x6400, 0x6407) AM_READ(zaccaria_prot1_r) |
| 336 | AM_RANGE(0x6c00, 0x6c07) AM_READ(zaccaria_prot2_r) | |
| 337 | AM_RANGE(0x6e00, 0x6e00) AM_READ(zaccaria_dsw_r) | |
| 338 | AM_RANGE(0x7000, 0x77ff) AM_READ(SMH_RAM) | |
| 339 | AM_RANGE(0x7800, 0x7803) AM_READ(ppi8255_0_r) | |
| 340 | AM_RANGE(0x7c00, 0x7c00) AM_READ(watchdog_reset_r) | |
| 341 | AM_RANGE(0x8000, 0xdfff) AM_READ(SMH_ROM) | |
| 342 | ADDRESS_MAP_END | |
| 343 | ||
| 344 | static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 345 | AM_RANGE(0x0000, 0x5fff) AM_WRITE(SMH_ROM) | |
| 346 | 336 | AM_RANGE(0x6000, 0x67ff) AM_WRITE(zaccaria_videoram_w) AM_BASE(&zaccaria_videoram) /* 6400-67ff is 4 bits wide */ |
| 347 | 337 | AM_RANGE(0x6800, 0x683f) AM_WRITE(zaccaria_attributes_w) AM_BASE(&zaccaria_attributesram) |
| 348 | AM_RANGE(0x6840, 0x685f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 349 | AM_RANGE(0x6881, 0x68bc) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2) AM_SIZE(&spriteram_2_size) | |
| 338 | AM_RANGE(0x6840, 0x685f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 339 | AM_RANGE(0x6881, 0x68bc) AM_RAM AM_BASE(&spriteram_2) AM_SIZE(&spriteram_2_size) | |
| 350 | 340 | AM_RANGE(0x6c00, 0x6c00) AM_WRITE(zaccaria_flip_screen_x_w) |
| 351 | 341 | AM_RANGE(0x6c01, 0x6c01) AM_WRITE(zaccaria_flip_screen_y_w) |
| 352 | 342 | AM_RANGE(0x6c02, 0x6c02) AM_WRITE(SMH_NOP) /* sound reset */ |
| 353 | AM_RANGE(0x6e00, 0x6e00) AM_WRITE(sound_command_w) | |
| 354 | 343 | AM_RANGE(0x6c06, 0x6c06) AM_WRITE(coin_w) |
| 355 | 344 | AM_RANGE(0x6c07, 0x6c07) AM_WRITE(nmienable_w) |
| 356 | AM_RANGE(0x7000, 0x77ff) AM_WRITE(SMH_RAM) | |
| 357 | AM_RANGE(0x7800, 0x7803) AM_WRITE(ppi8255_0_w) | |
| 358 | AM_RANGE(0x8000, 0xdfff) AM_WRITE(SMH_ROM) | |
| 345 | AM_RANGE(0x6c00, 0x6c07) AM_READ(zaccaria_prot2_r) | |
| 346 | AM_RANGE(0x6e00, 0x6e00) AM_READWRITE(zaccaria_dsw_r, sound_command_w) | |
| 347 | AM_RANGE(0x7000, 0x77ff) AM_RAM | |
| 348 | AM_RANGE(0x7800, 0x7803) AM_READWRITE(ppi8255_0_r, ppi8255_0_w) | |
| 349 | AM_RANGE(0x7c00, 0x7c00) AM_READ(watchdog_reset_r) | |
| 350 | AM_RANGE(0x8000, 0xdfff) AM_ROM | |
| 359 | 351 | ADDRESS_MAP_END |
| 360 | 352 | |
| 361 | static ADDRESS_MAP_START( sound_readmem1, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 362 | AM_RANGE(0x0000, 0x007f) AM_READ(SMH_RAM) | |
| 363 | AM_RANGE(0x500c, 0x500f) AM_READ(pia_0_r) | |
| 364 | AM_RANGE(0xa000, 0xbfff) AM_READ(SMH_ROM) | |
| 365 | AM_RANGE(0xe000, 0xffff) AM_READ(SMH_ROM) | |
| 353 | static ADDRESS_MAP_START( sound_map_1, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 354 | AM_RANGE(0x0000, 0x007f) AM_RAM | |
| 355 | AM_RANGE(0x500c, 0x500f) AM_READWRITE(pia_0_r, pia_0_w) | |
| 356 | AM_RANGE(0xa000, 0xbfff) AM_ROM | |
| 357 | AM_RANGE(0xe000, 0xffff) AM_ROM | |
| 366 | 358 | ADDRESS_MAP_END |
| 367 | 359 | |
| 368 | static ADDRESS_MAP_START( sound_writemem1, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 369 | AM_RANGE(0x0000, 0x007f) AM_WRITE(SMH_RAM) | |
| 370 | AM_RANGE(0x500c, 0x500f) AM_WRITE(pia_0_w) | |
| 371 | AM_RANGE(0xa000, 0xbfff) AM_WRITE(SMH_ROM) | |
| 372 | AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_ROM) | |
| 373 | ADDRESS_MAP_END | |
| 374 | ||
| 375 | static ADDRESS_MAP_START( sound_readmem2, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 376 | AM_RANGE(0x0000, 0x007f) AM_READ(SMH_RAM) | |
| 377 | AM_RANGE(0x0090, 0x0093) AM_READ(pia_1_r) | |
| 378 | AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_r) | |
| 379 | AM_RANGE(0xa000, 0xbfff) AM_READ(SMH_ROM) | |
| 380 | AM_RANGE(0xe000, 0xffff) AM_READ(SMH_ROM) | |
| 381 | ADDRESS_MAP_END | |
| 382 | ||
| 383 | static ADDRESS_MAP_START( sound_writemem2, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 384 | AM_RANGE(0x0000, 0x007f) AM_WRITE(SMH_RAM) | |
| 385 | AM_RANGE(0x0090, 0x0093) AM_WRITE(pia_1_w) | |
| 360 | static ADDRESS_MAP_START( sound_map_2, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 361 | AM_RANGE(0x0000, 0x007f) AM_RAM | |
| 362 | AM_RANGE(0x0090, 0x0093) AM_READWRITE(pia_1_r, pia_1_w) | |
| 386 | 363 | AM_RANGE(0x1000, 0x1000) AM_WRITE(mc1408_data_w) /* MC1408 */ |
| 387 | 364 | AM_RANGE(0x1400, 0x1400) AM_WRITE(sound1_command_w) |
| 388 | AM_RANGE(0xa000, 0xbfff) AM_WRITE(SMH_ROM) | |
| 389 | AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_ROM) | |
| 365 | AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_r) | |
| 366 | AM_RANGE(0xa000, 0xbfff) AM_ROM | |
| 367 | AM_RANGE(0xe000, 0xffff) AM_ROM | |
| 390 | 368 | ADDRESS_MAP_END |
| 391 | 369 | |
| 392 | 370 | |
| r2375 | r2376 | |
| 661 | 639 | |
| 662 | 640 | /* basic machine hardware */ |
| 663 | 641 | MDRV_CPU_ADD(Z80,XTAL_18_432MHz/6) /* verified on pcb */ |
| 664 | MDRV_CPU_PROGRAM_MAP( | |
| 642 | MDRV_CPU_PROGRAM_MAP( | |
| 665 | 643 | MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) |
| 666 | 644 | |
| 667 | 645 | MDRV_CPU_ADD(M6802,XTAL_3_579545MHz) /* verified on pcb */ |
| 668 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 646 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 669 | 647 | MDRV_CPU_PERIODIC_INT(zaccaria_cb1_toggle,(double)3580000/4096) |
| 670 | 648 | |
| 671 | 649 | MDRV_CPU_ADD(M6802,XTAL_3_579545MHz) /* verified on pcb */ |
| 672 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 650 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 673 | 651 | |
| 674 | 652 | MDRV_MACHINE_START(zaccaria) |
| 675 | 653 | MDRV_MACHINE_RESET(zaccaria) |
| r2375 | r2376 | |
|---|---|---|
| 191 | 191 | switch (offset) |
| 192 | 192 | { |
| 193 | 193 | case 0 : |
| 194 | data = ( | |
| 194 | data = ( | |
| 195 | 195 | break; |
| 196 | 196 | case 1 : |
| 197 | data = ( | |
| 197 | data = ( | |
| 198 | 198 | break; |
| 199 | 199 | case 2 : |
| 200 | data = ( | |
| 200 | data = ( | |
| 201 | 201 | break; |
| 202 | 202 | case 3 : |
| 203 | data = ( | |
| 203 | data = ( | |
| 204 | 204 | break; |
| 205 | 205 | } |
| 206 | 206 |
| r2375 | r2376 | |
|---|---|---|
| 161 | 161 | { |
| 162 | 162 | switch(mux_data) |
| 163 | 163 | { |
| 164 | case 0x00: return readinputport(0); | |
| 165 | case 0x01: return readinputport(1); | |
| 166 | case 0x02: return readinputport(2); | |
| 167 | case 0x04: return readinputport(3); | |
| 168 | case 0x08: return readinputport(4); | |
| 164 | case 0x00: return input_port_read_indexed(machine, 0); | |
| 165 | case 0x01: return input_port_read_indexed(machine, 1); | |
| 166 | case 0x02: return input_port_read_indexed(machine, 2); | |
| 167 | case 0x04: return input_port_read_indexed(machine, 3); | |
| 168 | case 0x08: return input_port_read_indexed(machine, 4); | |
| 169 | 169 | /* FIXME: Was this a quick hack? */ |
| 170 | case 0x10: return 0xff; //return readinputport(5); | |
| 171 | case 0x20: return 0xff; //return readinputport(6); | |
| 170 | case 0x10: return 0xff; //return input_port_read_indexed(machine, 5); | |
| 171 | case 0x20: return 0xff; //return input_port_read_indexed(machine, 6); | |
| 172 | 172 | } |
| 173 | 173 | return 0xff; |
| 174 | 174 | } |
| r2375 | r2376 | |
|---|---|---|
| 109 | 109 | { |
| 110 | 110 | |
| 111 | 111 | case 0xef: |
| 112 | return | |
| 112 | return | |
| 113 | 113 | |
| 114 | 114 | case 0xf7: |
| 115 | return | |
| 115 | return | |
| 116 | 116 | |
| 117 | 117 | case 0xfb: |
| 118 | return | |
| 118 | return | |
| 119 | 119 | |
| 120 | 120 | case 0xfd: |
| 121 | return | |
| 121 | return | |
| 122 | 122 | |
| 123 | 123 | case 0xfe: |
| 124 | return | |
| 124 | return | |
| 125 | 125 | |
| 126 | 126 | default: |
| 127 | 127 | printf("keyboard1_r, select %02x\n",keyboard_select); |
| r2375 | r2376 | |
| 137 | 137 | switch (keyboard_select) |
| 138 | 138 | { |
| 139 | 139 | case 0xef: |
| 140 | return | |
| 140 | return | |
| 141 | 141 | |
| 142 | 142 | case 0xf7: |
| 143 | return | |
| 143 | return | |
| 144 | 144 | |
| 145 | 145 | case 0xfb: |
| 146 | return | |
| 146 | return | |
| 147 | 147 | |
| 148 | 148 | case 0xfd: |
| 149 | return | |
| 149 | return | |
| 150 | 150 | |
| 151 | 151 | case 0xfe: |
| 152 | return | |
| 152 | return | |
| 153 | 153 | |
| 154 | 154 | default: |
| 155 | 155 | printf("keyboard2_r, select %02x\n",keyboard_select); |
| r2375 | r2376 | |
|---|---|---|
| 64 | 64 | { |
| 65 | 65 | switch(offset) |
| 66 | 66 | { |
| 67 | case 0: return input_port_0_r(machine,0); | |
| 68 | case 2: return input_port_1_r(machine,0); | |
| 67 | case 0: return input_port_read_indexed(machine, 0); | |
| 68 | case 2: return input_port_read_indexed(machine, 1); | |
| 69 | 69 | } |
| 70 | 70 | return 0xff; |
| 71 | 71 | } |
| r2375 | r2376 | |
|---|---|---|
| 674 | 674 | |
| 675 | 675 | if (ACCESSING_BITS_24_31) |
| 676 | 676 | { |
| 677 | r |= ( | |
| 677 | r |= ( | |
| 678 | 678 | } |
| 679 | 679 | if (ACCESSING_BITS_8_15) |
| 680 | 680 | { |
| 681 | r |= ( | |
| 681 | r |= ( | |
| 682 | 682 | } |
| 683 | 683 | if (ACCESSING_BITS_0_7) |
| 684 | 684 | { |
| 685 | r |= ( | |
| 685 | r |= ( | |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | return r; |
| r2375 | r2376 | |
| 692 | 692 | { |
| 693 | 693 | if (offset == 0) |
| 694 | 694 | { |
| 695 | return | |
| 695 | return | |
| 696 | 696 | } |
| 697 | 697 | else |
| 698 | 698 | { |
| 699 | return | |
| 699 | return | |
| 700 | 700 | } |
| 701 | 701 | } |
| 702 | 702 | |
| r2375 | r2376 | |
| 1383 | 1383 | { |
| 1384 | 1384 | if (offset == 0) // Keyboard Wheel (P1) |
| 1385 | 1385 | { |
| 1386 | return | |
| 1386 | return | |
| 1387 | 1387 | } |
| 1388 | 1388 | else if (offset == 2) // Keyboard Wheel (P2) |
| 1389 | 1389 | { |
| 1390 | return | |
| 1390 | return | |
| 1391 | 1391 | } |
| 1392 | 1392 | |
| 1393 | 1393 | return 0; |
| r2375 | r2376 | |
| 1471 | 1471 | |
| 1472 | 1472 | for (keyboard=0; keyboard < 2; keyboard++) |
| 1473 | 1473 | { |
| 1474 | UINT32 kbstate = | |
| 1474 | UINT32 kbstate = | |
| 1475 | 1475 | int uart_channel = kb_uart_channel[keyboard]; |
| 1476 | 1476 | |
| 1477 | 1477 | if (kbstate != keyboard_state[keyboard]) |
| r2375 | r2376 | |
|---|---|---|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
| 42 | static UINT8 difficulty_input_port_r(int bit) | |
| 42 | static UINT8 difficulty_input_port_r(running_machine *machine, int bit) | |
| 43 | 43 | { |
| 44 | 44 | UINT8 ret = 0; |
| 45 | 45 | |
| 46 | 46 | /* read fake port and remap the buttons to 2 bits */ |
| 47 | UINT8 raw = | |
| 47 | UINT8 raw = | |
| 48 | 48 | |
| 49 | 49 | if (raw & (1 << (bit + 1))) |
| 50 | 50 | ret = 0x03; /* expert */ |
| r2375 | r2376 | |
| 63 | 63 | |
| 64 | 64 | switch (input_port_select) |
| 65 | 65 | { |
| 66 | case 0x01: ret = readinputportbytag("IN0"); break; | |
| 67 | case 0x02: ret = readinputportbytag("IN1"); break; | |
| 68 | case 0x04: ret = (readinputportbytag("IN2") & 0xf0) | | |
| 69 | difficulty_input_port_r(0) | | |
| 70 | (difficulty_input_port_r(3) << 2); break; | |
| 71 | case 0x08: ret = readinputportbytag("IN3"); break; | |
| 66 | case 0x01: ret = input_port_read(machine, "IN0"); break; | |
| 67 | case 0x02: ret = input_port_read(machine, "IN1"); break; | |
| 68 | case 0x04: ret = (input_port_read(machine, "IN2") & 0xf0) | | |
| 69 | difficulty_input_port_r(machine, 0) | | |
| 70 | (difficulty_input_port_r(machine, 3) << 2); break; | |
| 71 | case 0x08: ret = input_port_read(machine, "IN3"); break; | |
| 72 | 72 | case 0x10: |
| 73 | 73 | case 0x20: break; /* these two are not really used */ |
| 74 | 74 | default: logerror("Unexpected port read: %02X\n", input_port_select); |
| r2375 | r2376 | |
| 107 | 107 | |
| 108 | 108 | analog_port_val = 0xff; |
| 109 | 109 | |
| 110 | timer_adjust_oneshot(analog_timer_1, compute_duration(readinputportbytag("AN1")), 0x02); | |
| 111 | timer_adjust_oneshot(analog_timer_2, compute_duration(readinputportbytag("AN2")), 0x01); | |
| 110 | timer_adjust_oneshot(analog_timer_1, compute_duration(input_port_read(machine, "AN1")), 0x02); | |
| 111 | timer_adjust_oneshot(analog_timer_2, compute_duration(input_port_read(machine, "AN2")), 0x01); | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 |
| r2375 | r2376 | |
|---|---|---|
| 100 | 100 | static int coin; |
| 101 | 101 | int port; |
| 102 | 102 | |
| 103 | port = | |
| 103 | port = | |
| 104 | 104 | |
| 105 | 105 | if (port != 0xc0) /* Coin */ |
| 106 | 106 | { |
| r2375 | r2376 | |
|---|---|---|
| 104 | 104 | */ |
| 105 | 105 | eolith_speedup_read(); |
| 106 | 106 | |
| 107 | return ( | |
| 107 | return ( | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | static WRITE32_HANDLER( systemcontrol_w ) |
| r2375 | r2376 | |
|---|---|---|
| 377 | 377 | |
| 378 | 378 | */ |
| 379 | 379 | bit5 ^= 0x20; |
| 380 | return bigevglf_mcu_status_r(machine,0) | ( | |
| 380 | return bigevglf_mcu_status_r(machine,0) | ( | |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | static ADDRESS_MAP_START( bigevglf_sub_readport, ADDRESS_SPACE_IO, 8 ) |
| r2375 | r2376 | |
|---|---|---|
| 159 | 159 | |
| 160 | 160 | soundflag = pending_command ? 0x0000 : 0x0080; // bit7 |
| 161 | 161 | eeprom = (EEPROM_read_bit() & 1) << 6; // bit6 |
| 162 | inputport = | |
| 162 | inputport = | |
| 163 | 163 | |
| 164 | 164 | return (soundflag | eeprom | inputport); |
| 165 | 165 | } |
| r2375 | r2376 | |
|---|---|---|
| 172 | 172 | * |
| 173 | 173 | *************************************/ |
| 174 | 174 | |
| 175 | static | |
| 175 | static STATE_POSTLOAD( bankselect_postload | |
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | |
| r2375 | r2376 | |
| 252 | 252 | state_save_register_global(which_adc); |
| 253 | 253 | state_save_register_global(p2portwr_state); |
| 254 | 254 | state_save_register_global(p2portrd_state); |
| 255 | state_save_register_ | |
| 255 | state_save_register_ | |
| 256 | 256 | state_save_register_global(sound_reset_state); |
| 257 | 257 | } |
| 258 | 258 | |
| r2375 | r2376 | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | |
| 362 | static | |
| 362 | static STATE_POSTLOAD( bankselect_postload | |
| 363 | 363 | { |
| 364 | 364 | bankselect_w(Machine, 0, bankselect[0], 0); |
| 365 | 365 | bankselect_w(Machine, 1, bankselect[1], 0); |
| r2375 | r2376 | |
| 425 | 425 | static READ16_HANDLER( adc_r ) |
| 426 | 426 | { |
| 427 | 427 | if (which_adc < pedal_count) |
| 428 | return ~ | |
| 428 | return ~ | |
| 429 | 429 | |
| 430 | return | |
| 430 | return | |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | |
| r2375 | r2376 | |
| 444 | 444 | static double last_angle; |
| 445 | 445 | static int rotations; |
| 446 | 446 | |
| 447 | int analogx = readinputport(7) - 128; | |
| 448 | int analogy = readinputport(8) - 128; | |
| 447 | int analogx = input_port_read_indexed(machine, 7) - 128; | |
| 448 | int analogy = input_port_read_indexed(machine, 8) - 128; | |
| 449 | 449 | double angle; |
| 450 | 450 | |
| 451 | 451 | /* if the joystick is centered, leave the rest of this alone */ |
| r2375 | r2376 | |
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | return | |
| 484 | return | |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 |
| r2375 | r2376 | |
|---|---|---|
| 141 | 141 | for (i=0; i<6; i++) |
| 142 | 142 | { |
| 143 | 143 | if (p & (1 << i)) |
| 144 | ret |= | |
| 144 | ret |= | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | return ret; |
| r2375 | r2376 | |
|---|---|---|
| 326 | 326 | case 1: // dip switches |
| 327 | 327 | switch (offset) |
| 328 | 328 | { |
| 329 | case 0: result = readinputportbytag("DIPSW1"); break; | |
| 330 | case 1: result = readinputportbytag("DIPSW2"); break; | |
| 329 | case 0: result = input_port_read(machine, "DIPSW1"); break; | |
| 330 | case 1: result = input_port_read(machine, "DIPSW2"); break; | |
| 331 | 331 | case 2: result = 0x02; break; |
| 332 | 332 | } |
| 333 | 333 | break; |
| r2375 | r2376 | |
| 335 | 335 | case 2: // player inputs |
| 336 | 336 | switch (offset) |
| 337 | 337 | { |
| 338 | case 0: result = readinputportbytag("PAD1"); break; | |
| 339 | case 1: result = readinputportbytag("PAD2"); break; | |
| 338 | case 0: result = input_port_read(machine, "PAD1"); break; | |
| 339 | case 1: result = input_port_read(machine, "PAD2"); break; | |
| 340 | 340 | case 2: result = 0x01; break; |
| 341 | 341 | } |
| 342 | 342 | break; |
| r2375 | r2376 | |
|---|---|---|
| 147 | 147 | int res; |
| 148 | 148 | |
| 149 | 149 | offset &= 3; |
| 150 | res = | |
| 150 | res = | |
| 151 | 151 | if (offset == 3) |
| 152 | 152 | { |
| 153 | res = | |
| 153 | res = | |
| 154 | 154 | if (handle_joystick) |
| 155 | 155 | { |
| 156 | 156 | /* map digital two-way joystick to two fixed VOLIN values */ |
| r2375 | r2376 | |
| 218 | 218 | /* Read Switch Inputs */ |
| 219 | 219 | static READ8_HANDLER( warpwarp_sw_r ) |
| 220 | 220 | { |
| 221 | return ( | |
| 221 | return ( | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /* Read Dipswitches */ |
| 225 | 225 | static READ8_HANDLER( warpwarp_dsw1_r ) |
| 226 | 226 | { |
| 227 | return ( | |
| 227 | return ( | |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /* Read mux Controller Inputs */ |
| r2375 | r2376 | |
| 232 | 232 | { |
| 233 | 233 | int res; |
| 234 | 234 | |
| 235 | res = | |
| 235 | res = | |
| 236 | 236 | if (handle_joystick) |
| 237 | 237 | { |
| 238 | 238 | if (res & 1) return 0x0f; |
| r2375 | r2376 | |
|---|---|---|
| 45 | 45 | */ |
| 46 | 46 | |
| 47 | 47 | #include "driver.h" |
| 48 | #include "deprecat.h" | |
| 48 | 49 | #include "memconv.h" |
| 49 | 50 | #include "sound/custom.h" |
| 50 | 51 | #include "includes/amiga.h" |
| r2375 | r2376 | |
| 106 | 107 | |
| 107 | 108 | static UINT8 cd32_cia_0_porta_r(void) |
| 108 | 109 | { |
| 109 | return | |
| 110 | return | |
| 110 | 111 | } |
| 111 | 112 | |
| 112 | 113 | static void cd32_cia_0_porta_w(UINT8 data) |
| r2375 | r2376 | |
| 148 | 149 | |
| 149 | 150 | static READ32_HANDLER( dipswitch_r ) |
| 150 | 151 | { |
| 151 | return | |
| 152 | return | |
| 152 | 153 | } |
| 153 | 154 | |
| 154 | 155 | static ADDRESS_MAP_START( cd32_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| r2375 | r2376 | |
|---|---|---|
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | |
| 62 | return | |
| 62 | return | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | static READ16_HANDLER( wheelfir_rand2 ) |
| 66 | 66 | { |
| 67 | return | |
| 67 | return | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 |
| r2375 | r2376 | |
|---|---|---|
| 89 | 89 | switch (offset<<1) |
| 90 | 90 | { |
| 91 | 91 | case 0: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 92 | return ( | |
| 92 | return ( | |
| 93 | 93 | |
| 94 | 94 | case 2: /* Dip Switches */ |
| 95 | return ( | |
| 95 | return ( | |
| 96 | 96 | |
| 97 | 97 | case 4: /* Protection */ |
| 98 | 98 | logerror("%04x : protection control read at 30c000 %d\n",activecpu_get_pc(),offset); |
| 99 | 99 | return prot; |
| 100 | 100 | |
| 101 | 101 | case 6: /* Credits, VBL in byte 7 */ |
| 102 | return | |
| 102 | return | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | return ~0; |
| r2375 | r2376 | |
|---|---|---|
| 345 | 345 | static WRITE8_HANDLER( dunhuang_input_w ) { dunhuang_input = data; } |
| 346 | 346 | static READ8_HANDLER( dunhuang_service_r ) |
| 347 | 347 | { |
| 348 | return | |
| 348 | return | |
| 349 | 349 | | ((dunhuang_hopper && !(video_screen_get_frame_number(machine->primary_screen)%10)) ? 0x00 : 0x08) // bit 3: hopper sensor |
| 350 | 350 | | 0x80 // bit 7 low -> tiles block transferrer busy |
| 351 | 351 | ; |
| r2375 | r2376 | |
| 353 | 353 | |
| 354 | 354 | static READ8_HANDLER( dunhuang_dsw_r ) |
| 355 | 355 | { |
| 356 | if (!(dunhuang_input & 0x01)) return readinputport(0); | |
| 357 | if (!(dunhuang_input & 0x02)) return readinputport(1); | |
| 358 | if (!(dunhuang_input & 0x04)) return readinputport(2); | |
| 359 | if (!(dunhuang_input & 0x08)) return readinputport(3); | |
| 360 | if (!(dunhuang_input & 0x10)) return readinputport(4); | |
| 356 | if (!(dunhuang_input & 0x01)) return input_port_read_indexed(machine, 0); | |
| 357 | if (!(dunhuang_input & 0x02)) return input_port_read_indexed(machine, 1); | |
| 358 | if (!(dunhuang_input & 0x04)) return input_port_read_indexed(machine, 2); | |
| 359 | if (!(dunhuang_input & 0x08)) return input_port_read_indexed(machine, 3); | |
| 360 | if (!(dunhuang_input & 0x10)) return input_port_read_indexed(machine, 4); | |
| 361 | 361 | logerror("%06x: warning, unknown dsw bits read, dunhuang_input = %02x\n", activecpu_get_pc(), dunhuang_input); |
| 362 | 362 | return 0xff; |
| 363 | 363 | } |
| 364 | 364 | static READ8_HANDLER( dunhuang_input_r ) |
| 365 | 365 | { |
| 366 | if (!(dunhuang_input & 0x01)) return readinputport(6); | |
| 367 | if (!(dunhuang_input & 0x02)) return readinputport(7); | |
| 368 | if (!(dunhuang_input & 0x04)) return readinputport(8); | |
| 369 | if (!(dunhuang_input & 0x08)) return readinputport(9); | |
| 370 | if (!(dunhuang_input & 0x10)) return readinputport(10); | |
| 366 | if (!(dunhuang_input & 0x01)) return input_port_read_indexed(machine, 6); | |
| 367 | if (!(dunhuang_input & 0x02)) return input_port_read_indexed(machine, 7); | |
| 368 | if (!(dunhuang_input & 0x04)) return input_port_read_indexed(machine, 8); | |
| 369 | if (!(dunhuang_input & 0x08)) return input_port_read_indexed(machine, 9); | |
| 370 | if (!(dunhuang_input & 0x10)) return input_port_read_indexed(machine, 10); | |
| 371 | 371 | logerror("%06x: warning, unknown input bits read, dunhuang_input = %02x\n", activecpu_get_pc(), dunhuang_input); |
| 372 | 372 | return 0xff; |
| 373 | 373 | } |
| r2375 | r2376 | |
|---|---|---|
| 146 | 146 | int ret; |
| 147 | 147 | |
| 148 | 148 | switch (ojankohs_portselect) { |
| 149 | case 0x01: ret = readinputportbytag("IN4"); break; | |
| 150 | case 0x02: ret = readinputportbytag("IN5"); break; | |
| 151 | case 0x04: ret = readinputportbytag("IN6"); break; | |
| 152 | case 0x08: ret = readinputportbytag("IN7"); break; | |
| 153 | case 0x10: ret = readinputportbytag("IN8"); break; | |
| 149 | case 0x01: ret = input_port_read(machine, "IN4"); break; | |
| 150 | case 0x02: ret = input_port_read(machine, "IN5"); break; | |
| 151 | case 0x04: ret = input_port_read(machine, "IN6"); break; | |
| 152 | case 0x08: ret = input_port_read(machine, "IN7"); break; | |
| 153 | case 0x10: ret = input_port_read(machine, "IN8"); break; | |
| 154 | 154 | case 0x20: ret = 0xff; break; |
| 155 | 155 | case 0x3f: ret = 0xff; |
| 156 | ret &= readinputportbytag("IN4"); | |
| 157 | ret &= readinputportbytag("IN5"); | |
| 158 | ret &= readinputportbytag("IN6"); | |
| 159 | ret &= readinputportbytag("IN7"); | |
| 160 | ret &= readinputportbytag("IN8"); | |
| 156 | ret &= input_port_read(machine, "IN4"); | |
| 157 | ret &= input_port_read(machine, "IN5"); | |
| 158 | ret &= input_port_read(machine, "IN6"); | |
| 159 | ret &= input_port_read(machine, "IN7"); | |
| 160 | ret &= input_port_read(machine, "IN8"); | |
| 161 | 161 | break; |
| 162 | 162 | default: ret = 0xff; |
| 163 | 163 | logerror("PC:%04X unknown %02X\n", activecpu_get_pc(), ojankohs_portselect); |
| r2375 | r2376 | |
| 174 | 174 | |
| 175 | 175 | for (i = 0; i < 5; i++) { |
| 176 | 176 | if (~ojankohs_portselect & (1 << i)) |
| 177 | ret |= | |
| 177 | ret |= | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | return (ret & 0x3f) | ( | |
| 180 | return (ret & 0x3f) | ( | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | static READ8_HANDLER( ojankohs_ay8910_0_r ) |
| 184 | 184 | { |
| 185 | 185 | // DIPSW 1 |
| 186 | return (((readinputportbytag("DSW1") & 0x01) << 7) | ((readinputportbytag("DSW1") & 0x02) << 5) | | |
| 187 | ((readinputportbytag("DSW1") & 0x04) << 3) | ((readinputportbytag("DSW1") & 0x08) << 1) | | |
| 188 | ((readinputportbytag("DSW1") & 0x10) >> 1) | ((readinputportbytag("DSW1") & 0x20) >> 3) | | |
| 189 | ((readinputportbytag("DSW1") & 0x40) >> 5) | ((readinputportbytag("DSW1") & 0x80) >> 7)); | |
| 186 | return (((input_port_read(machine, "DSW1") & 0x01) << 7) | ((input_port_read(machine, "DSW1") & 0x02) << 5) | | |
| 187 | ((input_port_read(machine, "DSW1") & 0x04) << 3) | ((input_port_read(machine, "DSW1") & 0x08) << 1) | | |
| 188 | ((input_port_read(machine, "DSW1") & 0x10) >> 1) | ((input_port_read(machine, "DSW1") & 0x20) >> 3) | | |
| 189 | ((input_port_read(machine, "DSW1") & 0x40) >> 5) | ((input_port_read(machine, "DSW1") & 0x80) >> 7)); | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | static READ8_HANDLER( ojankohs_ay8910_1_r ) |
| 193 | 193 | { |
| 194 | 194 | // DIPSW 1 |
| 195 | return (((readinputportbytag("DSW2") & 0x01) << 7) | ((readinputportbytag("DSW2") & 0x02) << 5) | | |
| 196 | ((readinputportbytag("DSW2") & 0x04) << 3) | ((readinputportbytag("DSW2") & 0x08) << 1) | | |
| 197 | ((readinputportbytag("DSW2") & 0x10) >> 1) | ((readinputportbytag("DSW2") & 0x20) >> 3) | | |
| 198 | ((readinputportbytag("DSW2") & 0x40) >> 5) | ((readinputportbytag("DSW2") & 0x80) >> 7)); | |
| 195 | return (((input_port_read(machine, "DSW2") & 0x01) << 7) | ((input_port_read(machine, "DSW2") & 0x02) << 5) | | |
| 196 | ((input_port_read(machine, "DSW2") & 0x04) << 3) | ((input_port_read(machine, "DSW2") & 0x08) << 1) | | |
| 197 | ((input_port_read(machine, "DSW2") & 0x10) >> 1) | ((input_port_read(machine, "DSW2") & 0x20) >> 3) | | |
| 198 | ((input_port_read(machine, "DSW2") & 0x40) >> 5) | ((input_port_read(machine, "DSW2") & 0x80) >> 7)); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | static READ8_HANDLER( ojankoy_ay8910_0_r ) |
| 202 | 202 | { |
| 203 | return | |
| 203 | return | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | static READ8_HANDLER( ojankoy_ay8910_1_r ) |
| 207 | 207 | { |
| 208 | return | |
| 208 | return | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | static READ8_HANDLER( ccasino_dipsw3_r ) |
| 212 | 212 | { |
| 213 | return ( | |
| 213 | return ( | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | static READ8_HANDLER( ccasino_dipsw4_r ) |
| 217 | 217 | { |
| 218 | return ( | |
| 218 | return ( | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | static WRITE8_HANDLER( ojankoy_coinctr_w ) |
| r2375 | r2376 | |
|---|---|---|
| 68 | 68 | Last but not least, the set of ROMs i have for Euro League seem to have |
| 69 | 69 | the sprites corrupted. The game seems to be exactly the same as the |
| 70 | 70 | World Cup 90 bootleg. |
| 71 | ||
| 72 | Noted added by ClawGrip 28-Mar-2008: | |
| 73 | ----------------------------------- | |
| 74 | -Dumped and added the all the PCB GALs. | |
| 75 | -Removed the second YM2203, Ernesto said it wasn't present on his board, | |
| 76 | and also isn't on mine. | |
| 77 | -My PCB has a different ROM (a05.bin), but only two bytes are different. | |
| 78 | Dox suggested that it can be just a year or text mod, so I decided not | |
| 79 | to include my set. If anyone wants it, please mail me: | |
| 80 | clawgrip at hotmail dot com. I can't find any graphical difference | |
| 81 | between my set and the one already on MAME. | |
| 82 | ||
| 71 | 83 | */ |
| 72 | 84 | |
| 73 | 85 | #include "driver.h" |
| r2375 | r2376 | |
| 151 | 163 | } |
| 152 | 164 | |
| 153 | 165 | |
| 154 | static ADDRESS_MAP_START( wc90b_readmem1, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 155 | AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) | |
| 156 | AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_RAM) /* Main RAM */ | |
| 157 | AM_RANGE(0xa000, 0xafff) AM_READ(SMH_RAM) /* fg video ram */ | |
| 158 | AM_RANGE(0xc000, 0xcfff) AM_READ(SMH_RAM) /* bg video ram */ | |
| 159 | AM_RANGE(0xe000, 0xefff) AM_READ(SMH_RAM) /* tx video ram */ | |
| 160 | AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_BANK1) | |
| 161 | AM_RANGE(0xf800, 0xfbff) AM_READ(wc90b_shared_r) | |
| 166 | static ADDRESS_MAP_START( wc90b_map1, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 167 | AM_RANGE(0x0000, 0x7fff) AM_ROM | |
| 168 | AM_RANGE(0x8000, 0x9fff) AM_RAM /* Main RAM */ | |
| 169 | AM_RANGE(0xa000, 0xafff) AM_RAM AM_WRITE(wc90b_fgvideoram_w) AM_BASE(&wc90b_fgvideoram) | |
| 170 | AM_RANGE(0xc000, 0xcfff) AM_RAM AM_WRITE(wc90b_bgvideoram_w) AM_BASE(&wc90b_bgvideoram) | |
| 171 | AM_RANGE(0xe000, 0xefff) AM_RAM AM_WRITE(wc90b_txvideoram_w) AM_BASE(&wc90b_txvideoram) | |
| 172 | AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK(1) | |
| 173 | AM_RANGE(0xf800, 0xfbff) AM_READWRITE(wc90b_shared_r, wc90b_shared_w) AM_BASE(&wc90b_shared) | |
| 174 | AM_RANGE(0xfc00, 0xfc00) AM_WRITE(wc90b_bankswitch_w) | |
| 175 | AM_RANGE(0xfd00, 0xfd00) AM_WRITE(wc90b_sound_command_w) | |
| 176 | AM_RANGE(0xfd04, 0xfd04) AM_WRITEONLY AM_BASE(&wc90b_scroll1y) | |
| 177 | AM_RANGE(0xfd06, 0xfd06) AM_WRITEONLY AM_BASE(&wc90b_scroll1x) | |
| 178 | AM_RANGE(0xfd08, 0xfd08) AM_WRITEONLY AM_BASE(&wc90b_scroll2y) | |
| 179 | AM_RANGE(0xfd0a, 0xfd0a) AM_WRITEONLY AM_BASE(&wc90b_scroll2x) | |
| 162 | 180 | AM_RANGE(0xfd00, 0xfd00) AM_READ(input_port_0_r) /* Stick 1, Coin 1 & Start 1 */ |
| 163 | 181 | AM_RANGE(0xfd02, 0xfd02) AM_READ(input_port_1_r) /* Stick 2, Coin 2 & Start 2 */ |
| 164 | 182 | AM_RANGE(0xfd06, 0xfd06) AM_READ(input_port_2_r) /* DIP Switch A */ |
| 165 | 183 | AM_RANGE(0xfd08, 0xfd08) AM_READ(input_port_3_r) /* DIP Switch B */ |
| 166 | AM_RANGE(0xfd00, 0xffff) AM_READ(SMH_RAM) | |
| 167 | 184 | ADDRESS_MAP_END |
| 168 | 185 | |
| 169 | static ADDRESS_MAP_START( wc90b_readmem2, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 170 | AM_RANGE(0x0000, 0xbfff) AM_READ(SMH_ROM) | |
| 171 | AM_RANGE(0xc000, 0xc1ff) AM_READ(SMH_RAM) | |
| 172 | AM_RANGE(0xc200, 0xe1ff) AM_READ(SMH_RAM) | |
| 173 | AM_RANGE(0xe000, 0xe7ff) AM_READ(SMH_RAM) | |
| 174 | AM_RANGE(0xe800, 0xefff) AM_READ(SMH_ROM) | |
| 175 | AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_BANK2) | |
| 176 | AM_RANGE(0xf800, 0xfbff) AM_READ(wc90b_shared_r) | |
| 177 | ADDRESS_MAP_END | |
| 178 | ||
| 179 | static ADDRESS_MAP_START( wc90b_writemem1, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 180 | AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) | |
| 181 | AM_RANGE(0x8000, 0x9fff) AM_WRITE(SMH_RAM) | |
| 182 | AM_RANGE(0xa000, 0xafff) AM_WRITE(wc90b_fgvideoram_w) AM_BASE(&wc90b_fgvideoram) | |
| 183 | AM_RANGE(0xc000, 0xcfff) AM_WRITE(wc90b_bgvideoram_w) AM_BASE(&wc90b_bgvideoram) | |
| 184 | AM_RANGE(0xe000, 0xefff) AM_WRITE(wc90b_txvideoram_w) AM_BASE(&wc90b_txvideoram) | |
| 185 | AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_ROM) | |
| 186 | AM_RANGE(0xf800, 0xfbff) AM_WRITE(wc90b_shared_w) AM_BASE(&wc90b_shared) | |
| 187 | AM_RANGE(0xfc00, 0xfc00) AM_WRITE(wc90b_bankswitch_w) | |
| 188 | AM_RANGE(0xfd00, 0xfd00) AM_WRITE(wc90b_sound_command_w) | |
| 189 | AM_RANGE(0xfd04, 0xfd04) AM_WRITE(SMH_RAM) AM_BASE(&wc90b_scroll1y) | |
| 190 | AM_RANGE(0xfd06, 0xfd06) AM_WRITE(SMH_RAM) AM_BASE(&wc90b_scroll1x) | |
| 191 | AM_RANGE(0xfd08, 0xfd08) AM_WRITE(SMH_RAM) AM_BASE(&wc90b_scroll2y) | |
| 192 | AM_RANGE(0xfd0a, 0xfd0a) AM_WRITE(SMH_RAM) AM_BASE(&wc90b_scroll2x) | |
| 193 | ADDRESS_MAP_END | |
| 194 | ||
| 195 | static ADDRESS_MAP_START( wc90b_writemem2, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 196 | AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM) | |
| 197 | AM_RANGE(0xc000, 0xcfff) AM_WRITE(SMH_RAM) | |
| 198 | AM_RANGE(0xd000, 0xd7ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 199 | AM_RANGE(0xd800, 0xdfff) AM_WRITE(SMH_RAM) | |
| 200 | AM_RANGE(0xe000, 0xe7ff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_be_w) AM_BASE(&paletteram) | |
| 201 | AM_RANGE(0xe800, 0xefff) AM_WRITE(SMH_ROM) | |
| 202 | AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_ROM) | |
| 203 | AM_RANGE(0xf800, 0xfbff) AM_WRITE(wc90b_shared_w) | |
| 186 | static ADDRESS_MAP_START( wc90b_map2, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 187 | AM_RANGE(0x0000, 0xbfff) AM_ROM | |
| 188 | AM_RANGE(0xc000, 0xcfff) AM_RAM | |
| 189 | AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 190 | AM_RANGE(0xd800, 0xdfff) AM_RAM | |
| 191 | AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_be_w) AM_BASE(&paletteram) | |
| 192 | AM_RANGE(0xe800, 0xefff) AM_ROM | |
| 193 | AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK(2) | |
| 194 | AM_RANGE(0xf800, 0xfbff) AM_READWRITE(wc90b_shared_r, wc90b_shared_w) | |
| 204 | 195 | AM_RANGE(0xfc00, 0xfc00) AM_WRITE(wc90b_bankswitch1_w) |
| 205 | 196 | ADDRESS_MAP_END |
| 206 | 197 | |
| r2375 | r2376 | |
| 211 | 202 | AM_RANGE(0xe400, 0xe400) AM_WRITE(adpcm_data_w) |
| 212 | 203 | AM_RANGE(0xe800, 0xe800) AM_READWRITE(YM2203_status_port_0_r, YM2203_control_port_0_w) |
| 213 | 204 | AM_RANGE(0xe801, 0xe801) AM_READWRITE(YM2203_read_port_0_r, YM2203_write_port_0_w) |
| 214 | AM_RANGE(0xec00, 0xec00) AM_READWRITE(YM2203_status_port_1_r, YM2203_control_port_1_w) | |
| 215 | AM_RANGE(0xec01, 0xec01) AM_READWRITE(YM2203_read_port_1_r, YM2203_write_port_1_w) | |
| 216 | 205 | AM_RANGE(0xf000, 0xf7ff) AM_RAM |
| 217 | 206 | AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r) |
| 218 | 207 | ADDRESS_MAP_END |
| r2375 | r2376 | |
| 391 | 380 | static MACHINE_DRIVER_START( wc90b ) |
| 392 | 381 | |
| 393 | 382 | /* basic machine hardware */ |
| 394 | MDRV_CPU_ADD(Z80, 6000000) /* 6.0 MHz ??? */ | |
| 395 | MDRV_CPU_PROGRAM_MAP(wc90b_readmem1,wc90b_writemem1) | |
| 383 | MDRV_CPU_ADD(Z80, XTAL_14MHz/2) | |
| 384 | MDRV_CPU_PROGRAM_MAP(wc90b_map1,0) | |
| 396 | 385 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| 397 | 386 | |
| 398 | MDRV_CPU_ADD(Z80, 6000000) /* 6.0 MHz ??? */ | |
| 399 | MDRV_CPU_PROGRAM_MAP(wc90b_readmem2,wc90b_writemem2) | |
| 387 | MDRV_CPU_ADD(Z80, XTAL_14MHz/2) | |
| 388 | MDRV_CPU_PROGRAM_MAP(wc90b_map2,0) | |
| 400 | 389 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| 401 | 390 | |
| 402 | MDRV_CPU_ADD(Z80, 2510000) // based on goal92 speed measured by guru (although maybe it should be 10mhz / 4 which is close) | |
| 403 | /* audio CPU */ /* 2.51 MHz */ | |
| 391 | MDRV_CPU_ADD(Z80, XTAL_19_6608MHz/8) | |
| 404 | 392 | MDRV_CPU_PROGRAM_MAP(sound_cpu,0) |
| 405 | | |
| 393 | | |
| 406 | 394 | |
| 407 | 395 | /* video hardware */ |
| 408 | 396 | MDRV_SCREEN_ADD("main", RASTER) |
| r2375 | r2376 | |
| 423 | 411 | |
| 424 | 412 | MDRV_SOUND_ADD(YM2203, 2510000/2) |
| 425 | 413 | MDRV_SOUND_CONFIG(ym2203_interface) |
| 426 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.2 | |
| 414 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) | |
| 427 | 415 | |
| 428 | MDRV_SOUND_ADD(YM2203, 2510000/2) | |
| 429 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 430 | ||
| 431 | 416 | MDRV_SOUND_ADD(MSM5205, 384000) |
| 432 | 417 | MDRV_SOUND_CONFIG(msm5205_interface) |
| 433 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0. | |
| 418 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) | |
| 434 | 419 | MACHINE_DRIVER_END |
| 435 | 420 | |
| 436 | 421 | ROM_START( wc90b ) |
| r2375 | r2376 | |
| 467 | 452 | ROM_LOAD( "151_a17.bin", 0x050000, 0x10000, CRC(228429d8) SHA1(3b2dbea53807929c24d593c469a83172f7747f66) ) |
| 468 | 453 | ROM_LOAD( "152_a18.bin", 0x060000, 0x10000, CRC(516b6c09) SHA1(9d02514dece864b087f67886009ce54bd51b5575) ) |
| 469 | 454 | ROM_LOAD( "153_a19.bin", 0x070000, 0x10000, CRC(f36390a9) SHA1(e5ea36e91b3ced068281524ee79d0432f489715c) ) |
| 455 | ||
| 456 | ROM_REGION( 0x1000, REGION_PLDS, ROMREGION_DISPOSE ) | |
| 457 | ROM_LOAD( "el_ic39_gal16v8_0.bin", 0x0000, 0x0117, NO_DUMP SHA1(894b345b395097acf6cf52ab8bc922099f97a85f) ) | |
| 458 | ROM_LOAD( "el_ic44_gal16v8_1.bin", 0x0200, 0x0117, NO_DUMP SHA1(fd41f55d857995fe87217dd9679c42760c241dc4) ) | |
| 459 | ROM_LOAD( "el_ic54_gal16v8_2.bin", 0x0400, 0x0117, NO_DUMP SHA1(f6d138fe42549219e11ee8524b05fe3c2b43f5d3) ) | |
| 460 | ROM_LOAD( "el_ic100_gal16v8_3.bin", 0x0600, 0x0117, NO_DUMP SHA1(515fcdf378e75ed078f54439fefce8807403bdd5) ) | |
| 461 | ROM_LOAD( "el_ic143_gal16v8_4.bin", 0x0800, 0x0117, NO_DUMP SHA1(fbe632437eac2418da7a3c3e947cfd36f6211407) ) | |
| 470 | 462 | ROM_END |
| 471 | 463 | |
| 472 | 464 | |
| 465 | #if 0 | |
| 466 | /* Different bootleg set with only one new ROM, a05 (added as "el_ic98_27c512_05.bin"), not included because it's | |
| 467 | probably just a minor text mod from the supported set (only two bytes differs), although I cannot find the difference: | |
| 468 | Comparing files a05.bin and el_ic98_27c512_05.bin | |
| 469 | 00000590: 0F 0B | |
| 470 | 00000591: FF FA | |
| 471 | */ | |
| 472 | ROM_START( wc90ba ) | |
| 473 | ROM_REGION( 0x20000, REGION_CPU1, 0 ) | |
| 474 | ROM_LOAD( "a02.bin", 0x00000, 0x10000, CRC(192a03dd) SHA1(ab98d370bba5437f956631b0199b173be55f1c27) ) /* c000-ffff is not used */ | |
| 475 | ROM_LOAD( "a03.bin", 0x10000, 0x10000, CRC(f54ff17a) SHA1(a19850fc28a5a0da20795a5cc6b56d9c16554bce) ) /* banked at f000-f7ff */ | |
| 476 | ||
| 477 | ROM_REGION( 0x20000, REGION_CPU2, 0 ) /* Second CPU */ | |
| 478 | ROM_LOAD( "a04.bin", 0x00000, 0x10000, CRC(3d535e2f) SHA1(f1e1878b5a8316e770c74a1e1f29a7a81a4e5dfe) ) /* c000-ffff is not used */ | |
| 479 | ROM_LOAD( "el_ic98_27c512_05.bin",0x10000, 0x10000, CRC(c70d8c13) SHA1(365718725ea7d0355c68ba703b7f9624cb1134bc) ) | |
| 480 | ||
| 481 | ROM_REGION( 0x18000, REGION_CPU3, 0 ) | |
| 482 | ROM_LOAD( "a01.bin", 0x00000, 0x8000, CRC(3d317622) SHA1(ae4e8c5247bc215a2769786cb8639bce2f80db22) ) | |
| 483 | ROM_CONTINUE( 0x10000, 0x8000 ) /* banked at 8000-bfff */ | |
| 484 | ||
| 485 | ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 486 | ROM_LOAD( "a06.bin", 0x000000, 0x04000, CRC(3b5387b7) SHA1(b839b4eafe8bf6f9e841e19fee1bdb64a66f3448) ) | |
| 487 | ROM_LOAD( "a08.bin", 0x004000, 0x04000, CRC(c622a5a3) SHA1(468c8c24af1f6f244228b66df04cb0ea81c1875e) ) | |
| 488 | ROM_LOAD( "a10.bin", 0x008000, 0x04000, CRC(0923d9f6) SHA1(4b10ee3fc17bb63cda51b2a978d066b6a140a551) ) | |
| 489 | ROM_LOAD( "a20.bin", 0x00c000, 0x04000, CRC(b8dec83e) SHA1(fe617ddccdd0dbd05ca09a1507074aa14b529322) ) | |
| 490 | ||
| 491 | ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE ) | |
| 492 | ROM_LOAD( "a07.bin", 0x000000, 0x20000, CRC(38c31817) SHA1(cb24ed8702d62066366924c033c07ffc78bd1fad) ) | |
| 493 | ROM_LOAD( "a09.bin", 0x020000, 0x20000, CRC(32e39e29) SHA1(44f22ed6c983541c7fea5857ba0456aaa87b36d1) ) | |
| 494 | ROM_LOAD( "a11.bin", 0x040000, 0x20000, CRC(5ccec796) SHA1(2cc191a4267819eb31962726e2ed4567c825c39e) ) | |
| 495 | ROM_LOAD( "a21.bin", 0x060000, 0x20000, CRC(0c54a091) SHA1(3eecb285b5a7bbc310c87492516d7ffb2841aa3b) ) | |
| 496 | ||
| 497 | ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_INVERT ) | |
| 498 | ROM_LOAD( "146_a12.bin", 0x000000, 0x10000, CRC(d5a60096) SHA1(a8e351a4b020b4fc2b2cb7d3f0fdfb43fc44d7d9) ) | |
| 499 | ROM_LOAD( "147_a13.bin", 0x010000, 0x10000, CRC(36bbf467) SHA1(627b5847ffb098c92edfd58c25391799f3b209e0) ) | |
| 500 | ROM_LOAD( "148_a14.bin", 0x020000, 0x10000, CRC(26371c18) SHA1(0887041d86dc9f19dad264ae27dc56fb89ac3265) ) | |
| 501 | ROM_LOAD( "149_a15.bin", 0x030000, 0x10000, CRC(75aa9b86) SHA1(0c221bd2e8a5472bb0e515f27fb72b0c8e8c0ca4) ) | |
| 502 | ROM_LOAD( "150_a16.bin", 0x040000, 0x10000, CRC(0da825f9) SHA1(cfba0c85fc767726c1d63f87468335d1c2f1eed8) ) | |
| 503 | ROM_LOAD( "151_a17.bin", 0x050000, 0x10000, CRC(228429d8) SHA1(3b2dbea53807929c24d593c469a83172f7747f66) ) | |
| 504 | ROM_LOAD( "152_a18.bin", 0x060000, 0x10000, CRC(516b6c09) SHA1(9d02514dece864b087f67886009ce54bd51b5575) ) | |
| 505 | ROM_LOAD( "153_a19.bin", 0x070000, 0x10000, CRC(f36390a9) SHA1(e5ea36e91b3ced068281524ee79d0432f489715c) ) | |
| 506 | ||
| 507 | ROM_REGION( 0x1000, REGION_PLDS, ROMREGION_DISPOSE ) | |
| 508 | ROM_LOAD( "el_ic39_gal16v8_0.bin", 0x0000, 0x0117, NO_DUMP SHA1(894b345b395097acf6cf52ab8bc922099f97a85f) ) | |
| 509 | ROM_LOAD( "el_ic44_gal16v8_1.bin", 0x0200, 0x0117, NO_DUMP SHA1(fd41f55d857995fe87217dd9679c42760c241dc4) ) | |
| 510 | ROM_LOAD( "el_ic54_gal16v8_2.bin", 0x0400, 0x0117, NO_DUMP SHA1(f6d138fe42549219e11ee8524b05fe3c2b43f5d3) ) | |
| 511 | ROM_LOAD( "el_ic100_gal16v8_3.bin", 0x0600, 0x0117, NO_DUMP SHA1(515fcdf378e75ed078f54439fefce8807403bdd5) ) | |
| 512 | ROM_LOAD( "el_ic143_gal16v8_4.bin", 0x0800, 0x0117, NO_DUMP SHA1(fbe632437eac2418da7a3c3e947cfd36f6211407) ) | |
| 513 | ROM_END | |
| 514 | #endif | |
| 515 | ||
| 516 | ||
| 473 | 517 | GAME( 1989, wc90b, wc90, wc90b, wc90b, 0, ROT0, "bootleg", "Euro League", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND ) |
| 518 | //GAME( 1989, wc90ba, wc90, wc90b, wc90b, 0, ROT0, "bootleg", "Euro League (alt version)", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND ) |
| r2375 | r2376 | |
|---|---|---|
| 70 | 70 | const UINT8 *ROM = memory_region(REGION_CPU1); |
| 71 | 71 | |
| 72 | 72 | if (deco16_bank) { |
| 73 | if (offset==0) return readinputportbytag("IN1"); /* Player 1 controls */ | |
| 74 | if (offset==1) return readinputportbytag("IN2"); /* Player 2 controls */ | |
| 75 | if (offset==2) return readinputportbytag("IN3"); /* Vblank, coins */ | |
| 76 | if (offset==3) return readinputportbytag("DSW1"); /* Dip 1 */ | |
| 77 | if (offset==4) return readinputportbytag("DSW2"); /* Dip 2 */ | |
| 73 | if (offset==0) return input_port_read(machine, "IN1"); /* Player 1 controls */ | |
| 74 | if (offset==1) return input_port_read(machine, "IN2"); /* Player 2 controls */ | |
| 75 | if (offset==2) return input_port_read(machine, "IN3"); /* Vblank, coins */ | |
| 76 | if (offset==3) return input_port_read(machine, "DSW1"); /* Dip 1 */ | |
| 77 | if (offset==4) return input_port_read(machine, "DSW2"); /* Dip 2 */ | |
| 78 | 78 | |
| 79 | 79 | logerror("%04x: Read input %d\n",activecpu_get_pc(),offset); |
| 80 | 80 | return 0xff; |
| r2375 | r2376 | |
| 498 | 498 | static INTERRUPT_GEN( deco16_interrupt ) |
| 499 | 499 | { |
| 500 | 500 | static int latch=0; |
| 501 | int p=~ | |
| 501 | int p=~ | |
| 502 | 502 | if (p&0x43 && !latch) { |
| 503 | 503 | cpunum_set_input_line(machine, 0,DECO16_IRQ_LINE,ASSERT_LINE); |
| 504 | 504 | latch=1; |
| r2375 | r2376 | |
|---|---|---|
| 104 | 104 | static int inputs[4]; |
| 105 | 105 | |
| 106 | 106 | #if 0 // default - more sensitive (state change and timing measured on real board?) |
| 107 | static void mcu63705_update_inputs( | |
| 107 | static void mcu63705_update_inputs(running_machine *machine) | |
| 108 | 108 | { |
| 109 | 109 | static int running[2],jumped[2]; |
| 110 | 110 | int buttons[2]; |
| r2375 | r2376 | |
| 116 | 116 | static int prev[2][2],countup[2][2],countdown[2][2]; |
| 117 | 117 | int curr[2][2]; |
| 118 | 118 | |
| 119 | curr[p][0] = readinputport(2+p) & 0x01; | |
| 120 | curr[p][1] = readinputport(2+p) & 0x02; | |
| 119 | curr[p][0] = input_port_read_indexed(machine, 2+p) & 0x01; | |
| 120 | curr[p][1] = input_port_read_indexed(machine, 2+p) & 0x02; | |
| 121 | 121 | |
| 122 | 122 | for (j = 0;j <= 1;j++) |
| 123 | 123 | { |
| r2375 | r2376 | |
| 152 | 152 | static int prev[2]; |
| 153 | 153 | int curr[2]; |
| 154 | 154 | |
| 155 | curr[p] = | |
| 155 | curr[p] = | |
| 156 | 156 | |
| 157 | 157 | if (jumped[p]) buttons[p] = 0; /* jump only momentarily flips the buttons */ |
| 158 | 158 | else buttons[p] = curr[p]; |
| r2375 | r2376 | |
| 163 | 163 | prev[p] = curr[p]; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | inputs[0] = readinputport(2) & 0xcf; | |
| 167 | inputs[1] = readinputport(3) & 0x0f; | |
| 166 | inputs[0] = input_port_read_indexed(machine, 2) & 0xcf; | |
| 167 | inputs[1] = input_port_read_indexed(machine, 3) & 0x0f; | |
| 168 | 168 | inputs[2] = running[0] | buttons[0]; |
| 169 | 169 | inputs[3] = running[1] | buttons[1]; |
| 170 | 170 | } |
| 171 | 171 | #else // alternate - less sensitive |
| 172 | static void mcu63705_update_inputs( | |
| 172 | static void mcu63705_update_inputs(running_machine *machine) | |
| 173 | 173 | { |
| 174 | 174 | #define DBLTAP_TOLERANCE 5 |
| 175 | 175 | |
| r2375 | r2376 | |
| 187 | 187 | |
| 188 | 188 | for (p=0; p<=1; p++) |
| 189 | 189 | { |
| 190 | curr_port[p] = | |
| 190 | curr_port[p] = | |
| 191 | 191 | curr_dash[p] = 0; |
| 192 | 192 | |
| 193 | 193 | if (curr_port[p] & R) |
| r2375 | r2376 | |
| 242 | 242 | case 1: return inputs[1]; |
| 243 | 243 | case 2: return inputs[2]; |
| 244 | 244 | case 3: return inputs[3]; |
| 245 | case 4: return | |
| 245 | case 4: return | |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
| r2375 | r2376 | |
| 250 | 250 | { |
| 251 | 251 | // logerror("CPU #0 PC %04x: write %02x to 63701 control address 3800\n",activecpu_get_pc(),data); |
| 252 | 252 | mcu63701_command = data; |
| 253 | mcu63705_update_inputs(); | |
| 253 | mcu63705_update_inputs(machine); | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | |
| 257 | 257 | static READ8_HANDLER( port_0_r ) |
| 258 | 258 | { |
| 259 | int port = | |
| 259 | int port = | |
| 260 | 260 | |
| 261 | 261 | toggle^=0x02; /* mcu63701_busy flag */ |
| 262 | 262 |
| r2375 | r2376 | |
|---|---|---|
| 410 | 410 | { |
| 411 | 411 | /* read sensor RAM */ |
| 412 | 412 | case 0x40: |
| 413 | result = ~ | |
| 413 | result = ~ | |
| 414 | 414 | break; |
| 415 | 415 | |
| 416 | 416 | /* read display RAM */ |
| r2375 | r2376 | |
| 545 | 545 | { |
| 546 | 546 | turbo_state *state = machine->driver_data; |
| 547 | 547 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); |
| 548 | return | |
| 548 | return | |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | |
| r2375 | r2376 | |
| 560 | 560 | static READ8_HANDLER( turbo_analog_r ) |
| 561 | 561 | { |
| 562 | 562 | turbo_state *state = machine->driver_data; |
| 563 | return | |
| 563 | return | |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | |
| 567 | 567 | static WRITE8_HANDLER( turbo_analog_reset_w ) |
| 568 | 568 | { |
| 569 | 569 | turbo_state *state = machine->driver_data; |
| 570 | state->turbo_last_analog = | |
| 570 | state->turbo_last_analog = | |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | |
| r2375 | r2376 | |
| 606 | 606 | |
| 607 | 607 | static READ8_HANDLER( buckrog_port_2_r ) |
| 608 | 608 | { |
| 609 | int inp1 = readinputport(2); | |
| 610 | int inp2 = readinputport(3); | |
| 609 | int inp1 = input_port_read_indexed(machine, 2); | |
| 610 | int inp2 = input_port_read_indexed(machine, 3); | |
| 611 | 611 | |
| 612 | 612 | return (((inp2 >> 6) & 1) << 7) | |
| 613 | 613 | (((inp2 >> 4) & 1) << 6) | |
| r2375 | r2376 | |
| 622 | 622 | |
| 623 | 623 | static READ8_HANDLER( buckrog_port_3_r ) |
| 624 | 624 | { |
| 625 | int inp1 = readinputport(2); | |
| 626 | int inp2 = readinputport(3); | |
| 625 | int inp1 = input_port_read_indexed(machine, 2); | |
| 626 | int inp2 = input_port_read_indexed(machine, 3); | |
| 627 | 627 | |
| 628 | 628 | return (((inp2 >> 7) & 1) << 7) | |
| 629 | 629 | (((inp2 >> 5) & 1) << 6) | |
| r2375 | r2376 | |
|---|---|---|
| 1520 | 1520 | /* DSW reading for 16 bit CPUs */ |
| 1521 | 1521 | static READ16_HANDLER( seta_dsw_r ) |
| 1522 | 1522 | { |
| 1523 | UINT16 dsw = | |
| 1523 | UINT16 dsw = | |
| 1524 | 1524 | if (offset == 0) return (dsw >> 8) & 0xff; |
| 1525 | 1525 | else return (dsw >> 0) & 0xff; |
| 1526 | 1526 | } |
| r2375 | r2376 | |
| 1530 | 1530 | |
| 1531 | 1531 | static READ8_HANDLER( dsw1_r ) |
| 1532 | 1532 | { |
| 1533 | return ( | |
| 1533 | return ( | |
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | static READ8_HANDLER( dsw2_r ) |
| 1537 | 1537 | { |
| 1538 | return ( | |
| 1538 | return ( | |
| 1539 | 1539 | } |
| 1540 | 1540 | |
| 1541 | 1541 | |
| r2375 | r2376 | |
| 1654 | 1654 | |
| 1655 | 1655 | static READ16_HANDLER ( calibr50_ip_r ) |
| 1656 | 1656 | { |
| 1657 | int dir1 = readinputportbytag("IN4") & 0xfff; // analog port | |
| 1658 | int dir2 = readinputportbytag("IN5") & 0xfff; // analog port | |
| 1657 | int dir1 = input_port_read(machine, "IN4") & 0xfff; // analog port | |
| 1658 | int dir2 = input_port_read(machine, "IN5") & 0xfff; // analog port | |
| 1659 | 1659 | |
| 1660 | 1660 | switch (offset) |
| 1661 | 1661 | { |
| 1662 | case 0x00/2: return readinputportbytag("IN0"); // p1 | |
| 1663 | case 0x02/2: return readinputportbytag("IN1"); // p2 | |
| 1662 | case 0x00/2: return input_port_read(machine, "IN0"); // p1 | |
| 1663 | case 0x02/2: return input_port_read(machine, "IN1"); // p2 | |
| 1664 | 1664 | |
| 1665 | case 0x08/2: return | |
| 1665 | case 0x08/2: return | |
| 1666 | 1666 | |
| 1667 | 1667 | case 0x10/2: return (dir1&0xff); // lower 8 bits of p1 rotation |
| 1668 | 1668 | case 0x12/2: return (dir1>>8); // upper 4 bits of p1 rotation |
| r2375 | r2376 | |
| 1729 | 1729 | { |
| 1730 | 1730 | switch (offset) |
| 1731 | 1731 | { |
| 1732 | case 0/2: return (readinputport(3) >> 8) & 0xf; | |
| 1733 | case 2/2: return (readinputport(3) >> 12) & 0xf; | |
| 1734 | case 4/2: return (readinputport(3) >> 0) & 0xf; | |
| 1735 | case 6/2: return (readinputport(3) >> 4) & 0xf; | |
| 1732 | case 0/2: return (input_port_read_indexed(machine, 3) >> 8) & 0xf; | |
| 1733 | case 2/2: return (input_port_read_indexed(machine, 3) >> 12) & 0xf; | |
| 1734 | case 4/2: return (input_port_read_indexed(machine, 3) >> 0) & 0xf; | |
| 1735 | case 6/2: return (input_port_read_indexed(machine, 3) >> 4) & 0xf; | |
| 1736 | 1736 | } |
| 1737 | 1737 | return 0; |
| 1738 | 1738 | } |
| r2375 | r2376 | |
| 1741 | 1741 | { |
| 1742 | 1742 | switch (offset) |
| 1743 | 1743 | { |
| 1744 | case 0/2: return (readinputport(0) >> 0) & 0xff; | |
| 1745 | case 2/2: return (readinputport(0) >> 8) & 0xff; | |
| 1744 | case 0/2: return (input_port_read_indexed(machine, 0) >> 0) & 0xff; | |
| 1745 | case 2/2: return (input_port_read_indexed(machine, 0) >> 8) & 0xff; | |
| 1746 | 1746 | } |
| 1747 | 1747 | return 0; |
| 1748 | 1748 | } |
| r2375 | r2376 | |
| 1751 | 1751 | { |
| 1752 | 1752 | switch (offset) |
| 1753 | 1753 | { |
| 1754 | case 0/2: return (readinputport(1) >> 0) & 0xff; | |
| 1755 | case 2/2: return (readinputport(1) >> 8) & 0xff; | |
| 1754 | case 0/2: return (input_port_read_indexed(machine, 1) >> 0) & 0xff; | |
| 1755 | case 2/2: return (input_port_read_indexed(machine, 1) >> 8) & 0xff; | |
| 1756 | 1756 | } |
| 1757 | 1757 | return 0; |
| 1758 | 1758 | } |
| r2375 | r2376 | |
| 1960 | 1960 | |
| 1961 | 1961 | static READ16_HANDLER( zombraid_gun_r ) // Serial interface |
| 1962 | 1962 | { |
| 1963 | int data = | |
| 1963 | int data = | |
| 1964 | 1964 | return (data >> gun_input_bit) & 1; |
| 1965 | 1965 | } |
| 1966 | 1966 | |
| r2375 | r2376 | |
| 2371 | 2371 | static READ16_HANDLER( krzybowl_input_r ) |
| 2372 | 2372 | { |
| 2373 | 2373 | // analog ports |
| 2374 | int dir1x = readinputport(4) & 0xfff; | |
| 2375 | int dir1y = readinputport(5) & 0xfff; | |
| 2376 | int dir2x = readinputport(6) & 0xfff; | |
| 2377 | int dir2y = readinputport(7) & 0xfff; | |
| 2374 | int dir1x = input_port_read_indexed(machine, 4) & 0xfff; | |
| 2375 | int dir1y = input_port_read_indexed(machine, 5) & 0xfff; | |
| 2376 | int dir2x = input_port_read_indexed(machine, 6) & 0xfff; | |
| 2377 | int dir2y = input_port_read_indexed(machine, 7) & 0xfff; | |
| 2378 | 2378 | |
| 2379 | 2379 | switch (offset) |
| 2380 | 2380 | { |
| r2375 | r2376 | |
| 2604 | 2604 | |
| 2605 | 2605 | switch( offset ) |
| 2606 | 2606 | { |
| 2607 | case 0x00/2: return | |
| 2607 | case 0x00/2: return | |
| 2608 | 2608 | case 0x02/2: return 0xffff; |
| 2609 | case 0x04/2: return | |
| 2609 | case 0x04/2: return | |
| 2610 | 2610 | // case 0x06/2: |
| 2611 | 2611 | case 0x08/2: return 0xffff; |
| 2612 | 2612 | |
| r2375 | r2376 | |
| 2885 | 2885 | |
| 2886 | 2886 | static READ8_HANDLER( downtown_ip_r ) |
| 2887 | 2887 | { |
| 2888 | int dir1 = readinputport(4); // analog port | |
| 2889 | int dir2 = readinputport(5); // analog port | |
| 2888 | int dir1 = input_port_read_indexed(machine, 4); // analog port | |
| 2889 | int dir2 = input_port_read_indexed(machine, 5); // analog port | |
| 2890 | 2890 | |
| 2891 | 2891 | dir1 = (~ (0x800 >> ((dir1 * 12)/0x100)) ) & 0xfff; |
| 2892 | 2892 | dir2 = (~ (0x800 >> ((dir2 * 12)/0x100)) ) & 0xfff; |
| 2893 | 2893 | |
| 2894 | 2894 | switch (offset) |
| 2895 | 2895 | { |
| 2896 | case 0: return ( | |
| 2896 | case 0: return ( | |
| 2897 | 2897 | case 1: return (dir1&0xff); // lower 8 bits of p1 rotation |
| 2898 | case 2: return | |
| 2898 | case 2: return | |
| 2899 | 2899 | case 3: return 0xff; // ? |
| 2900 | 2900 | case 4: return (dir2>>8); // upper 4 bits of p2 rotation + ? |
| 2901 | 2901 | case 5: return (dir2&0xff); // lower 8 bits of p2 rotation |
| 2902 | case 6: return | |
| 2902 | case 6: return | |
| 2903 | 2903 | case 7: return 0xff; // ? |
| 2904 | 2904 | } |
| 2905 | 2905 | |
| r2375 | r2376 | |
| 3102 | 3102 | static READ16_HANDLER( inttoote_dsw_r ) |
| 3103 | 3103 | { |
| 3104 | 3104 | int shift = offset * 4; |
| 3105 | return ((((readinputport(0) >> shift) & 0xf)) << 0) | | |
| 3106 | ((((readinputport(1) >> shift) & 0xf)) << 4) | | |
| 3107 | ((((readinputport(1) >> (shift+8)) & 0xf)) << 8) ; | |
| 3105 | return ((((input_port_read_indexed(machine, 0) >> shift) & 0xf)) << 0) | | |
| 3106 | ((((input_port_read_indexed(machine, 1) >> shift) & 0xf)) << 4) | | |
| 3107 | ((((input_port_read_indexed(machine, 1) >> (shift+8)) & 0xf)) << 8) ; | |
| 3108 | 3108 | } |
| 3109 | 3109 | |
| 3110 | 3110 | static UINT16 *inttoote_key_select; |
| r2375 | r2376 | |
| 3112 | 3112 | { |
| 3113 | 3113 | switch( *inttoote_key_select ) |
| 3114 | 3114 | { |
| 3115 | case 0x08: return readinputport(4+0); | |
| 3116 | case 0x10: return readinputport(4+1); | |
| 3117 | case 0x20: return readinputport(4+2); | |
| 3118 | case 0x40: return readinputport(4+3); | |
| 3119 | case 0x80: return readinputport(4+4); | |
| 3115 | case 0x08: return input_port_read_indexed(machine, 4+0); | |
| 3116 | case 0x10: return input_port_read_indexed(machine, 4+1); | |
| 3117 | case 0x20: return input_port_read_indexed(machine, 4+2); | |
| 3118 | case 0x40: return input_port_read_indexed(machine, 4+3); | |
| 3119 | case 0x80: return input_port_read_indexed(machine, 4+4); | |
| 3120 | 3120 | } |
| 3121 | 3121 | logerror("%06X: unknown read, select = %04x\n",activecpu_get_pc(),*inttoote_key_select); |
| 3122 | 3122 | return 0xffff; |
| r2375 | r2376 | |
|---|---|---|
| 133 | 133 | /* coinup */ |
| 134 | 134 | static int trigger = 0; |
| 135 | 135 | |
| 136 | if ( | |
| 136 | if ( | |
| 137 | 137 | { |
| 138 | 138 | if ( trigger == 0 ) |
| 139 | 139 | { |
| r2375 | r2376 | |
|---|---|---|
| 91 | 91 | static READ8_HANDLER( laserbat_input_r ) |
| 92 | 92 | { |
| 93 | 93 | // Add coktail inputs |
| 94 | return | |
| 94 | return | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | static WRITE8_HANDLER( laserbat_cnteff_w ) |
| r2375 | r2376 | |
|---|---|---|
| 13 | 13 | static READ16_HANDLER( ssf2ghw_dsw_r ) |
| 14 | 14 | { |
| 15 | 15 | static const char *const dswname[3] = { "DSWA", "DSWB", "DSWC" }; |
| 16 | return | |
| 16 | return | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | static DRIVER_INIT( ssf2ghw ) |
| r2375 | r2376 | |
|---|---|---|
| 281 | 281 | { |
| 282 | 282 | int dsw, dsw1, dsw2; |
| 283 | 283 | |
| 284 | dsw1 = readinputportbytag("DSWA"); | |
| 285 | dsw2 = readinputportbytag("DSWB"); | |
| 284 | dsw1 = input_port_read(machine, "DSWA"); | |
| 285 | dsw2 = input_port_read(machine, "DSWB"); | |
| 286 | 286 | |
| 287 | 287 | switch (kageki_csport_sel) |
| 288 | 288 | { |
| r2375 | r2376 | |
|---|---|---|
| 125 | 125 | VIDEO_UPDATE( nitrobal ); |
| 126 | 126 | WRITE16_HANDLER( rohga_buffer_spriteram16_w ); |
| 127 | 127 | |
| 128 | static READ16_HANDLER( rohga_dip3_r ) { return readinputport(3); } | |
| 129 | static READ16_HANDLER( nitrobal_control_r ) { return readinputport(3); } | |
| 130 | static READ16_HANDLER( schmeisr_control_r ) { return readinputport(1); } | |
| 128 | static READ16_HANDLER( rohga_dip3_r ) { return input_port_read_indexed(machine, 3); } | |
| 129 | static READ16_HANDLER( nitrobal_control_r ) { return input_port_read_indexed(machine, 3); } | |
| 130 | static READ16_HANDLER( schmeisr_control_r ) { return input_port_read_indexed(machine, 1); } | |
| 131 | 131 | |
| 132 | 132 | /**********************************************************************************/ |
| 133 | 133 |
| r2375 | r2376 | |
|---|---|---|
| 107 | 107 | } |
| 108 | 108 | else |
| 109 | 109 | { |
| 110 | return ( | |
| 110 | return ( | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /* FIXME: code will never execute */ |
| r2375 | r2376 | |
|---|---|---|
| 63 | 63 | atarivc_reset(machine->primary_screen, atarivc_eof_data, 2); |
| 64 | 64 | atarigen_scanline_timer_reset(machine->primary_screen, batman_scanline_update, 8); |
| 65 | 65 | atarijsa_reset(); |
| 66 | atarigen_init_save_state(); | |
| 66 | atarigen_init_save_state(machine); | |
| 67 | 67 | state_save_register_global(latch_data); |
| 68 | 68 | |
| 69 | 69 | } |
| r2375 | r2376 | |
| 97 | 97 | |
| 98 | 98 | static READ16_HANDLER( special_port2_r ) |
| 99 | 99 | { |
| 100 | int result = | |
| 100 | int result = | |
| 101 | 101 | if (atarigen_sound_to_cpu_ready) result ^= 0x0010; |
| 102 | 102 | if (atarigen_cpu_to_sound_ready) result ^= 0x0020; |
| 103 | 103 | return result; |
| r2375 | r2376 | |
|---|---|---|
| 217 | 217 | bit 12-15: accel |
| 218 | 218 | */ |
| 219 | 219 | |
| 220 | int data=readinputport(7); | |
| 221 | int data2=readinputport(6); | |
| 220 | int data=input_port_read_indexed(machine, 7); | |
| 221 | int data2=input_port_read_indexed(machine, 6); | |
| 222 | 222 | |
| 223 | 223 | int ret=0x0000; |
| 224 | 224 |
| r2375 | r2376 | |
|---|---|---|
| 193 | 193 | #ifdef UNUSED_FUNCTION |
| 194 | 194 | static INTERRUPT_GEN( progolf_interrupt ) |
| 195 | 195 | { |
| 196 | //if ( | |
| 196 | //if ( | |
| 197 | 197 | cpunum_set_input_line(machine, 0, /*0*/INPUT_LINE_NMI, /*HOLD_LINE*/PULSE_LINE); |
| 198 | 198 | } |
| 199 | 199 | #endif |
| r2375 | r2376 | |
|---|---|---|
| 63 | 63 | |
| 64 | 64 | static READ16_HANDLER( magicstk_port2_r ) |
| 65 | 65 | { |
| 66 | return (input_port_ | |
| 66 | return (input_port_ | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | static WRITE16_HANDLER( magicstk_coin_eeprom_w ) |
| r2375 | r2376 | |
|---|---|---|
| 507 | 507 | /*Order is surely wrong but whatever...*/ |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | static UINT8 stv_SMPC_r8 (int offset) | |
| 510 | static UINT8 stv_SMPC_r8 (running_machine *machine, int offset) | |
| 511 | 511 | { |
| 512 | 512 | int return_data; |
| 513 | 513 | |
| r2375 | r2376 | |
| 518 | 518 | return_data = 0x20 ^ 0xff; |
| 519 | 519 | |
| 520 | 520 | if (offset == 0x75)//PDR1 read |
| 521 | return_data = | |
| 521 | return_data = | |
| 522 | 522 | |
| 523 | 523 | if (offset == 0x77)//PDR2 read |
| 524 | 524 | return_data= (0xfe | EEPROM_read_bit()); |
| 525 | 525 | |
| 526 | 526 | // if (offset == 0x33) //country code |
| 527 | // return_data = | |
| 527 | // return_data = | |
| 528 | 528 | |
| 529 | 529 | if (activecpu_get_pc()==0x060020E6) return_data = 0x10;//??? |
| 530 | 530 | |
| r2375 | r2376 | |
| 683 | 683 | |
| 684 | 684 | smpc_ram[0x31]=0x00; //? |
| 685 | 685 | |
| 686 | //smpc_ram[0x33]= | |
| 686 | //smpc_ram[0x33]= | |
| 687 | 687 | |
| 688 | 688 | smpc_ram[0x35]=0x00; |
| 689 | 689 | smpc_ram[0x37]=0x00; |
| r2375 | r2376 | |
| 769 | 769 | /* registers are all byte accesses, convert here */ |
| 770 | 770 | offset = offset << 2; // multiply offset by 4 |
| 771 | 771 | |
| 772 | if (ACCESSING_BITS_24_31) { byte = 0; readdata = stv_SMPC_r8(offset+byte) << 24; } | |
| 773 | if (ACCESSING_BITS_16_23) { byte = 1; readdata = stv_SMPC_r8(offset+byte) << 16; } | |
| 774 | if (ACCESSING_BITS_8_15) { byte = 2; readdata = stv_SMPC_r8(offset+byte) << 8; } | |
| 775 | if (ACCESSING_BITS_0_7) { byte = 3; readdata = stv_SMPC_r8(offset+byte) << 0; } | |
| 772 | if (ACCESSING_BITS_24_31) { byte = 0; readdata = stv_SMPC_r8(machine, offset+byte) << 24; } | |
| 773 | if (ACCESSING_BITS_16_23) { byte = 1; readdata = stv_SMPC_r8(machine, offset+byte) << 16; } | |
| 774 | if (ACCESSING_BITS_8_15) { byte = 2; readdata = stv_SMPC_r8(machine, offset+byte) << 8; } | |
| 775 | if (ACCESSING_BITS_0_7) { byte = 3; readdata = stv_SMPC_r8(machine, offset+byte) << 0; } | |
| 776 | 776 | |
| 777 | 777 | return readdata; |
| 778 | 778 | } |
| r2375 | r2376 | |
| 952 | 952 | case 0: |
| 953 | 953 | switch(port_sel) |
| 954 | 954 | { |
| 955 | case 0x77: return 0xff000000|( | |
| 955 | case 0x77: return 0xff000000|( | |
| 956 | 956 | case 0x67: |
| 957 | 957 | { |
| 958 | 958 | switch(mux_data) |
| 959 | 959 | { |
| 960 | 960 | /*Mahjong panel interface,bit wise(ACTIVE LOW)*/ |
| 961 | case 0xfe: return 0xff000000 | (readinputport(7) << 16) | 0x0000ff00 | (readinputport(12)); | |
| 962 | case 0xfd: return 0xff000000 | (readinputport(8) << 16) | 0x0000ff00 | (readinputport(13)); | |
| 963 | case 0xfb: return 0xff000000 | (readinputport(9) << 16) | 0x0000ff00 | (readinputport(14)); | |
| 964 | case 0xf7: return 0xff000000 | (readinputport(10) << 16) | 0x0000ff00 | (readinputport(15)); | |
| 965 | case 0xef: return 0xff000000 | (readinputport(11) << 16) | 0x0000ff00 | (readinputport(16)); | |
| 961 | case 0xfe: return 0xff000000 | (input_port_read_indexed(machine, 7) << 16) | 0x0000ff00 | (input_port_read_indexed(machine, 12)); | |
| 962 | case 0xfd: return 0xff000000 | (input_port_read_indexed(machine, 8) << 16) | 0x0000ff00 | (input_port_read_indexed(machine, 13)); | |
| 963 | case 0xfb: return 0xff000000 | (input_port_read_indexed(machine, 9) << 16) | 0x0000ff00 | (input_port_read_indexed(machine, 14)); | |
| 964 | case 0xf7: return 0xff000000 | (input_port_read_indexed(machine, 10) << 16) | 0x0000ff00 | (input_port_read_indexed(machine, 15)); | |
| 965 | case 0xef: return 0xff000000 | (input_port_read_indexed(machine, 11) << 16) | 0x0000ff00 | (input_port_read_indexed(machine, 16)); | |
| 966 | 966 | /*Joystick panel*/ |
| 967 | 967 | default: |
| 968 | 968 | //popmessage("%02x MUX DATA",mux_data); |
| 969 | return ( | |
| 969 | return ( | |
| 970 | 970 | } |
| 971 | 971 | } |
| 972 | 972 | case 0x47: |
| r2375 | r2376 | |
| 976 | 976 | int data1 = 0, data2 = 0; |
| 977 | 977 | |
| 978 | 978 | /* Critter Crusher */ |
| 979 | data1 = | |
| 979 | data1 = | |
| 980 | 980 | data1 = BITSWAP8(data1, 2, 3, 0, 1, 6, 7, 5, 4) & 0xf3; |
| 981 | data1 |= (readinputport(2) & 1) ? 0x0 : 0x4; | |
| 982 | data2 = readinputport(8); | |
| 981 | data1 |= (input_port_read_indexed(machine, 2) & 1) ? 0x0 : 0x4; | |
| 982 | data2 = input_port_read_indexed(machine, 8); | |
| 983 | 983 | data2 = BITSWAP8(data2, 2, 3, 0, 1, 6, 7, 5, 4) & 0xf3; |
| 984 | data2 |= ( | |
| 984 | data2 |= ( | |
| 985 | 985 | |
| 986 | 986 | return 0xff000000 | data1 << 16 | 0x0000ff00 | data2; |
| 987 | 987 | } |
| r2375 | r2376 | |
| 989 | 989 | //default: |
| 990 | 990 | default: |
| 991 | 991 | //popmessage("%02x PORT SEL",port_sel); |
| 992 | return ( | |
| 992 | return ( | |
| 993 | 993 | } |
| 994 | 994 | case 1: |
| 995 | 995 | if ( strcmp(machine->gamedrv->name,"critcrsh") == 0 ) |
| 996 | 996 | { |
| 997 | return (( | |
| 997 | return (( | |
| 998 | 998 | } |
| 999 | 999 | else |
| 1000 | 1000 | { |
| 1001 | return ( | |
| 1001 | return ( | |
| 1002 | 1002 | } |
| 1003 | 1003 | case 2: |
| 1004 | 1004 | switch(port_sel) |
| 1005 | 1005 | { |
| 1006 | case 0x77: return ( | |
| 1006 | case 0x77: return ( | |
| 1007 | 1007 | case 0x67: return 0xffffffff;/**/ |
| 1008 | 1008 | case 0x20: return 0xffff0000 | (ioga[2] & 0xffff); |
| 1009 | 1009 | case 0x10: return ((ioga[2] & 0xffff) << 16) | 0xffff; |
| r2375 | r2376 | |
| 2521 | 2521 | smpc_ram[0x2d] = DectoBCD(systime.local_time.minute); |
| 2522 | 2522 | smpc_ram[0x2f] = DectoBCD(systime.local_time.second); |
| 2523 | 2523 | smpc_ram[0x31] = 0x00; //CTG1=0 CTG0=0 (correct??) |
| 2524 | // smpc_ram[0x33] = | |
| 2524 | // smpc_ram[0x33] = | |
| 2525 | 2525 | smpc_ram[0x5f] = 0x10; |
| 2526 | 2526 | |
| 2527 | 2527 | #ifdef MAME_DEBUG |
| r2375 | r2376 | |
|---|---|---|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | |
| 506 | static READ8_HANDLER( megaplay_r0) { return readinputportbytag("BIOS_IN0") ; } | |
| 507 | static READ8_HANDLER( megaplay_r1) { return readinputportbytag("BIOS_IN1") ; } | |
| 508 | static READ8_HANDLER( megaplay_r2) { return readinputportbytag("BIOS_DSW0") ; } | |
| 509 | static READ8_HANDLER( megaplay_r3) { return readinputportbytag("BIOS_DSW1") ; } | |
| 506 | static READ8_HANDLER( megaplay_r0) { return input_port_read(machine, "BIOS_IN0") ; } | |
| 507 | static READ8_HANDLER( megaplay_r1) { return input_port_read(machine, "BIOS_IN1") ; } | |
| 508 | static READ8_HANDLER( megaplay_r2) { return input_port_read(machine, "BIOS_DSW0") ; } | |
| 509 | static READ8_HANDLER( megaplay_r3) { return input_port_read(machine, "BIOS_DSW1") ; } | |
| 510 | 510 | |
| 511 | 511 | static int mt_bank_bank_pos = 0; |
| 512 | 512 | static int mt_bank_partial = 0; |
| r2375 | r2376 | |
|---|---|---|
| 735 | 735 | // ROM_LOAD( "d24-16.79", 0x00000, 0xa??, NO_DUMP ) |
| 736 | 736 | ROM_END |
| 737 | 737 | |
| 738 | static STATE_POSTLOAD( warriorb_postload ) | |
| 739 | { | |
| 740 | reset_sound_region(); | |
| 741 | } | |
| 738 | 742 | |
| 739 | 743 | static MACHINE_START( warriorb ) |
| 740 | 744 | { |
| 741 | 745 | state_save_register_global(banknum); |
| 742 | state_save_register_ | |
| 746 | state_save_register_ | |
| 743 | 747 | } |
| 744 | 748 | |
| 745 | 749 | static MACHINE_RESET( taito_dualscreen ) |
| r2375 | r2376 | |
|---|---|---|
| 334 | 334 | \ |
| 335 | 335 | for (i = 0; i < NUM; i++) \ |
| 336 | 336 | if ((~igs_input_sel) & (1 << i) ) \ |
| 337 | ret = | |
| 337 | ret = | |
| 338 | 338 | \ |
| 339 | 339 | /* 0x0100 is blitter busy */ \ |
| 340 | 340 | return (ret & 0xff) | 0x0000; \ |
| r2375 | r2376 | |
| 663 | 663 | switch(igs_magic[0]) |
| 664 | 664 | { |
| 665 | 665 | case 0x01: |
| 666 | if (~igs_input_sel2 & 0x01) return readinputport(4); | |
| 667 | if (~igs_input_sel2 & 0x02) return readinputport(5); | |
| 668 | if (~igs_input_sel2 & 0x04) return readinputport(6); | |
| 669 | if (~igs_input_sel2 & 0x08) return readinputport(7); | |
| 670 | if (~igs_input_sel2 & 0x10) return readinputport(8); | |
| 666 | if (~igs_input_sel2 & 0x01) return input_port_read_indexed(machine, 4); | |
| 667 | if (~igs_input_sel2 & 0x02) return input_port_read_indexed(machine, 5); | |
| 668 | if (~igs_input_sel2 & 0x04) return input_port_read_indexed(machine, 6); | |
| 669 | if (~igs_input_sel2 & 0x08) return input_port_read_indexed(machine, 7); | |
| 670 | if (~igs_input_sel2 & 0x10) return input_port_read_indexed(machine, 8); | |
| 671 | 671 | /* fall through */ |
| 672 | 672 | default: |
| 673 | 673 | logerror("%06x: warning, reading with igs_magic = %02x\n", activecpu_get_pc(), igs_magic[0]); |
| r2375 | r2376 | |
| 736 | 736 | { |
| 737 | 737 | switch(igs_magic[0]) |
| 738 | 738 | { |
| 739 | case 0x00: return readinputport(4); | |
| 740 | case 0x01: return readinputport(5); | |
| 741 | case 0x02: return readinputport(6); | |
| 739 | case 0x00: return input_port_read_indexed(machine, 4); | |
| 740 | case 0x01: return input_port_read_indexed(machine, 5); | |
| 741 | case 0x02: return input_port_read_indexed(machine, 6); | |
| 742 | 742 | |
| 743 | 743 | case 0x20: return 0x49; |
| 744 | 744 | case 0x21: return 0x47; |
| r2375 | r2376 | |
| 803 | 803 | { |
| 804 | 804 | switch(igs_magic[0]) |
| 805 | 805 | { |
| 806 | case 0x00: return | |
| 806 | case 0x00: return | |
| 807 | 807 | |
| 808 | 808 | case 0x20: return 0x49; |
| 809 | 809 | case 0x21: return 0x47; |
| r2375 | r2376 | |
| 873 | 873 | case 0: return igs_input_sel2; |
| 874 | 874 | |
| 875 | 875 | case 1: |
| 876 | if (~igs_input_sel2 & 0x01) return readinputport(6); | |
| 877 | if (~igs_input_sel2 & 0x02) return readinputport(7); | |
| 878 | if (~igs_input_sel2 & 0x04) return readinputport(8); | |
| 879 | if (~igs_input_sel2 & 0x08) return readinputport(9); | |
| 880 | if (~igs_input_sel2 & 0x10) return readinputport(10); | |
| 876 | if (~igs_input_sel2 & 0x01) return input_port_read_indexed(machine, 6); | |
| 877 | if (~igs_input_sel2 & 0x02) return input_port_read_indexed(machine, 7); | |
| 878 | if (~igs_input_sel2 & 0x04) return input_port_read_indexed(machine, 8); | |
| 879 | if (~igs_input_sel2 & 0x08) return input_port_read_indexed(machine, 9); | |
| 880 | if (~igs_input_sel2 & 0x10) return input_port_read_indexed(machine, 10); | |
| 881 | 881 | |
| 882 | 882 | logerror("%06x: warning, reading with igs_input_sel2 = %02x\n", activecpu_get_pc(), igs_input_sel2); |
| 883 | 883 | break; |
| r2375 | r2376 | |
| 918 | 918 | { |
| 919 | 919 | switch(igs_magic[0]) |
| 920 | 920 | { |
| 921 | case 0x00: return readinputport(5); | |
| 922 | case 0x01: return readinputport(6); | |
| 921 | case 0x00: return input_port_read_indexed(machine, 5); | |
| 922 | case 0x01: return input_port_read_indexed(machine, 6); | |
| 923 | 923 | |
| 924 | 924 | case 0x20: return 0x49; |
| 925 | 925 | case 0x21: return 0x47; |
| r2375 | r2376 | |
| 985 | 985 | { |
| 986 | 986 | switch(igs_magic[0]) |
| 987 | 987 | { |
| 988 | case 0x00: return | |
| 988 | case 0x00: return | |
| 989 | 989 | |
| 990 | 990 | case 0x02: |
| 991 | if (~igs_input_sel2 & 0x01) return readinputport(4); | |
| 992 | if (~igs_input_sel2 & 0x02) return readinputport(5); | |
| 993 | if (~igs_input_sel2 & 0x04) return readinputport(6); | |
| 994 | if (~igs_input_sel2 & 0x08) return readinputport(7); | |
| 995 | if (~igs_input_sel2 & 0x10) return readinputport(8); | |
| 991 | if (~igs_input_sel2 & 0x01) return input_port_read_indexed(machine, 4); | |
| 992 | if (~igs_input_sel2 & 0x02) return input_port_read_indexed(machine, 5); | |
| 993 | if (~igs_input_sel2 & 0x04) return input_port_read_indexed(machine, 6); | |
| 994 | if (~igs_input_sel2 & 0x08) return input_port_read_indexed(machine, 7); | |
| 995 | if (~igs_input_sel2 & 0x10) return input_port_read_indexed(machine, 8); | |
| 996 | 996 | /* fall through */ |
| 997 | 997 | default: |
| 998 | 998 | logerror("%06x: warning, reading with igs_magic = %02x\n", activecpu_get_pc(), igs_magic[0]); |
| r2375 | r2376 | |
| 1194 | 1194 | static VIDEO_EOF( vbowl ) |
| 1195 | 1195 | { |
| 1196 | 1196 | vbowl_trackball[0] = vbowl_trackball[1]; |
| 1197 | vbowl_trackball[1] = ( | |
| 1197 | vbowl_trackball[1] = ( | |
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | 1200 | static WRITE16_HANDLER( vbowl_pen_hi_w ) |
| r2375 | r2376 | |
|---|---|---|
| 41 | 41 | switch(offset) |
| 42 | 42 | { |
| 43 | 43 | case 0: |
| 44 | return | |
| 44 | return | |
| 45 | 45 | case 1: |
| 46 | return | |
| 46 | return | |
| 47 | 47 | case 2: |
| 48 | return | |
| 48 | return | |
| 49 | 49 | case 3: |
| 50 | return | |
| 50 | return | |
| 51 | 51 | case 7: |
| 52 | return | |
| 52 | return | |
| 53 | 53 | |
| 54 | 54 | default: |
| 55 | 55 | logerror("reading unhandled goal92 inputs %04X %04X @ PC = %04X\n",offset, mem_mask,activecpu_get_pc()); |
| r2375 | r2376 | |
|---|---|---|
| 159 | 159 | static READ8_HANDLER( trackball_r ) |
| 160 | 160 | { |
| 161 | 161 | UINT8 ret; |
| 162 | UINT8 port4 = readinputport(4); | |
| 163 | UINT8 port5 = readinputport(5); | |
| 162 | UINT8 port4 = input_port_read_indexed(machine, 4); | |
| 163 | UINT8 port5 = input_port_read_indexed(machine, 5); | |
| 164 | 164 | |
| 165 | 165 | ret = (((port4 - last_trackball_val[0]) & 0x0f)<<4) | ((port5 - last_trackball_val[1]) & 0x0f); |
| 166 | 166 |
| r2375 | r2376 | |
|---|---|---|
| 159 | 159 | |
| 160 | 160 | static READ16_HANDLER( dipsw_r ) // dips |
| 161 | 161 | { |
| 162 | return input_port_ | |
| 162 | return input_port_ | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | static READ16_HANDLER( player1_r ) // players 1 and 3 |
| 166 | 166 | { |
| 167 | return 0xff | (input_port_ | |
| 167 | return 0xff | (input_port_ | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | static READ16_HANDLER( player2_r ) // players 2 and 4 |
| 171 | 171 | { |
| 172 | return input_port_ | |
| 172 | return input_port_ | |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | static READ16_HANDLER( bishi_K056832_rom_r ) |
| r2375 | r2376 | |
|---|---|---|
| 203 | 203 | |
| 204 | 204 | static READ32_HANDLER( finalgdr_input0_r ) |
| 205 | 205 | { |
| 206 | return | |
| 206 | return | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | static READ32_HANDLER( finalgdr_input1_r ) |
| 210 | 210 | { |
| 211 | return | |
| 211 | return | |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | static WRITE32_HANDLER( finalgdr_oki_bank_w ) |
| r2375 | r2376 | |
| 617 | 617 | |
| 618 | 618 | static MACHINE_DRIVER_START( sound_qs1000 ) |
| 619 | 619 | MDRV_CPU_ADD(I8052, 24000000/4) /* 6 MHz? */ |
| 620 | MDRV_CPU_PROGRAM_MAP( | |
| 620 | MDRV_CPU_PROGRAM_MAP( | |
| 621 | 621 | MDRV_CPU_DATA_MAP( qs1000_data_map, 0 ) |
| 622 | 622 | |
| 623 | 623 | MACHINE_DRIVER_END |
| r2375 | r2376 | |
|---|---|---|
| 60 | 60 | for (i=0; i<5; i++) |
| 61 | 61 | { |
| 62 | 62 | if (p & (1 << i)) |
| 63 | ret &= | |
| 63 | ret &= | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | return ret; |
| r2375 | r2376 | |
|---|---|---|
| 72 | 72 | |
| 73 | 73 | static READ8_HANDLER( poolshrk_input_r ) |
| 74 | 74 | { |
| 75 | UINT8 val = | |
| 75 | UINT8 val = | |
| 76 | 76 | |
| 77 | int x = readinputport(4 + (offset & 1)); | |
| 78 | int y = readinputport(6 + (offset & 1)); | |
| 77 | int x = input_port_read_indexed(machine, 4 + (offset & 1)); | |
| 78 | int y = input_port_read_indexed(machine, 6 + (offset & 1)); | |
| 79 | 79 | |
| 80 | 80 | if (x >= poolshrk_da_latch) val |= 8; |
| 81 | 81 | if (y >= poolshrk_da_latch) val |= 4; |
| r2375 | r2376 | |
|---|---|---|
| 22 | 22 | |
| 23 | 23 | #include "driver.h" |
| 24 | 24 | #include "render.h" |
| 25 | #include "deprecat.h" | |
| 25 | 26 | #include "includes/amiga.h" |
| 26 | 27 | #include "machine/laserdsc.h" |
| 27 | 28 | |
| r2375 | r2376 | |
| 50 | 51 | { |
| 51 | 52 | const rectangle *visarea = video_screen_get_visible_area(screen); |
| 52 | 53 | |
| 53 | int xpos = readinputportbytag_safe((player == 0) ? "GUN1X" : "GUN2X", -1); | |
| 54 | int ypos = readinputportbytag_safe((player == 0) ? "GUN1Y" : "GUN2Y", -1); | |
| 54 | int xpos = input_port_read_safe(screen->machine, (player == 0) ? "GUN1X" : "GUN2X", -1); | |
| 55 | int ypos = input_port_read_safe(screen->machine, (player == 0) ? "GUN1Y" : "GUN2Y", -1); | |
| 55 | 56 | |
| 56 | 57 | if (xpos == -1 || ypos == -1) |
| 57 | 58 | return FALSE; |
| r2375 | r2376 | |
| 251 | 252 | static CUSTOM_INPUT( lightgun_trigger_r ) |
| 252 | 253 | { |
| 253 | 254 | /* read the trigger control based on the input select */ |
| 254 | return ( | |
| 255 | return ( | |
| 255 | 256 | } |
| 256 | 257 | |
| 257 | 258 | |
| 258 | 259 | static CUSTOM_INPUT( lightgun_holster_r ) |
| 259 | 260 | { |
| 260 | 261 | /* read the holster control based on the input select */ |
| 261 | return ( | |
| 262 | return ( | |
| 262 | 263 | } |
| 263 | 264 | |
| 264 | 265 | |
| r2375 | r2376 | |
| 287 | 288 | |
| 288 | 289 | static UINT8 alg_cia_0_porta_r(void) |
| 289 | 290 | { |
| 290 | return | |
| 291 | return | |
| 291 | 292 | } |
| 292 | 293 | |
| 293 | 294 |
| r2375 | r2376 | |
|---|---|---|
| 77 | 77 | static READ32_HANDLER( vegaeo_custom_read ) |
| 78 | 78 | { |
| 79 | 79 | eolith_speedup_read(); |
| 80 | return | |
| 80 | return | |
| 81 | 81 | } |
| 82 | 82 | static ADDRESS_MAP_START( vega_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 83 | 83 | AM_RANGE(0x00000000, 0x001fffff) AM_RAM |
| r2375 | r2376 | |
|---|---|---|
| 156 | 156 | UINT16 ret; |
| 157 | 157 | |
| 158 | 158 | switch (fromanc2_portselect) { |
| 159 | case 0x01: ret = readinputportbytag("IN1"); break; | |
| 160 | case 0x02: ret = readinputportbytag("IN2"); break; | |
| 161 | case 0x04: ret = readinputportbytag("IN3"); break; | |
| 162 | case 0x08: ret = readinputportbytag("IN4"); break; | |
| 159 | case 0x01: ret = input_port_read(machine, "IN1"); break; | |
| 160 | case 0x02: ret = input_port_read(machine, "IN2"); break; | |
| 161 | case 0x04: ret = input_port_read(machine, "IN3"); break; | |
| 162 | case 0x08: ret = input_port_read(machine, "IN4"); break; | |
| 163 | 163 | default: ret = 0xffff; |
| 164 | 164 | logerror("PC:%08X unknown %02X\n", activecpu_get_pc(), fromanc2_portselect); |
| 165 | 165 | break; |
| r2375 | r2376 | |
| 176 | 176 | ((fromanc2_subcpu_nmi_flag & 1) << 6) | |
| 177 | 177 | ((fromanc2_sndcpu_nmi_flag & 1) << 5)); |
| 178 | 178 | eeprom = (EEPROM_read_bit() & 1) << 7; // EEPROM DATA |
| 179 | coinsw = | |
| 179 | coinsw = | |
| 180 | 180 | |
| 181 | 181 | return (cflag | eeprom | coinsw); |
| 182 | 182 | } |
| r2375 | r2376 | |
| 187 | 187 | |
| 188 | 188 | cflag = (fromanc2_sndcpu_nmi_flag & 1) << 5; |
| 189 | 189 | eeprom = (EEPROM_read_bit() & 1) << 7; // EEPROM DATA |
| 190 | coinsw = | |
| 190 | coinsw = | |
| 191 | 191 | |
| 192 | 192 | return (cflag | eeprom | coinsw); |
| 193 | 193 | } |
| r2375 | r2376 | |
|---|---|---|
| 174 | 174 | UINT8 newval; |
| 175 | 175 | |
| 176 | 176 | /* first read the new trackball value and compute the signed delta */ |
| 177 | newval = | |
| 177 | newval = | |
| 178 | 178 | delta = (int)newval - (int)last_analog_input[offset]; |
| 179 | 179 | |
| 180 | 180 | /* handle the case where we wrap around from 0x00 to 0xff, or vice versa */ |
| r2375 | r2376 | |
|---|---|---|
| 1202 | 1202 | return 0xffffffff; |
| 1203 | 1203 | |
| 1204 | 1204 | case 0x0000: |
| 1205 | return | |
| 1205 | return | |
| 1206 | 1206 | |
| 1207 | 1207 | case 0x0080: |
| 1208 | return | |
| 1208 | return | |
| 1209 | 1209 | |
| 1210 | 1210 | case 0x2000: |
| 1211 | return | |
| 1211 | return | |
| 1212 | 1212 | |
| 1213 | 1213 | case 0x2080: |
| 1214 | return | |
| 1214 | return | |
| 1215 | 1215 | |
| 1216 | 1216 | } |
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | 1219 | static READ32_HANDLER( bnstars2_r ) |
| 1220 | 1220 | { |
| 1221 | return | |
| 1221 | return | |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | static READ32_HANDLER( bnstars3_r ) |
| 1225 | 1225 | { |
| 1226 | return | |
| 1226 | return | |
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | 1229 | static WRITE32_HANDLER( bnstars1_mahjong_select_w ) |
| r2375 | r2376 | |
|---|---|---|
| 128 | 128 | /* Light Gun - need to wiggle the input slightly otherwise fire doesn't work */ |
| 129 | 129 | static READ16_HANDLER( unico_gunx_0_msb_r ) |
| 130 | 130 | { |
| 131 | int x= | |
| 131 | int x= | |
| 132 | 132 | |
| 133 | 133 | x=x*384/256; /* On screen pixel X */ |
| 134 | 134 | if (x<0x160) x=0x30 + (x*0xd0/0x15f); |
| r2375 | r2376 | |
| 139 | 139 | |
| 140 | 140 | static READ16_HANDLER( unico_guny_0_msb_r ) |
| 141 | 141 | { |
| 142 | int y= | |
| 142 | int y= | |
| 143 | 143 | |
| 144 | 144 | y=0x18+((y*0xe0)/0xff); |
| 145 | 145 | |
| r2375 | r2376 | |
| 148 | 148 | |
| 149 | 149 | static READ16_HANDLER( unico_gunx_1_msb_r ) |
| 150 | 150 | { |
| 151 | int x= | |
| 151 | int x= | |
| 152 | 152 | |
| 153 | 153 | x=x*384/256; /* On screen pixel X */ |
| 154 | 154 | if (x<0x160) x=0x30 + (x*0xd0/0x15f); |
| r2375 | r2376 | |
| 159 | 159 | |
| 160 | 160 | static READ16_HANDLER( unico_guny_1_msb_r ) |
| 161 | 161 | { |
| 162 | int y= | |
| 162 | int y= | |
| 163 | 163 | |
| 164 | 164 | y=0x18+((y*0xe0)/0xff); |
| 165 | 165 | |
| r2375 | r2376 | |
| 214 | 214 | Zero Point 2 |
| 215 | 215 | ***************************************************************************/ |
| 216 | 216 | |
| 217 | static READ32_HANDLER( zeropnt2_coins_r ) { return (readinputportbytag("IN0") << 16) | 0xffff; } | |
| 218 | static READ32_HANDLER( zeropnt2_dsw1_r ) { return (readinputportbytag("DSW1") << 16) | 0xffff; } | |
| 219 | static READ32_HANDLER( zeropnt2_dsw2_r ) { return (readinputportbytag("DSW2") << 16) | 0xffff; } | |
| 220 | static READ32_HANDLER( zeropnt2_buttons_r ) { return ((readinputportbytag("IN7") | ((EEPROM_read_bit() & 0x01) << 7)) << 16) | 0xffff; } | |
| 217 | static READ32_HANDLER( zeropnt2_coins_r ) { return (input_port_read(machine, "IN0") << 16) | 0xffff; } | |
| 218 | static READ32_HANDLER( zeropnt2_dsw1_r ) { return (input_port_read(machine, "DSW1") << 16) | 0xffff; } | |
| 219 | static READ32_HANDLER( zeropnt2_dsw2_r ) { return (input_port_read(machine, "DSW2") << 16) | 0xffff; } | |
| 220 | static READ32_HANDLER( zeropnt2_buttons_r ) { return ((input_port_read(machine, "IN7") | ((EEPROM_read_bit() & 0x01) << 7)) << 16) | 0xffff; } | |
| 221 | 221 | |
| 222 | 222 | static READ32_HANDLER( zeropnt2_gunx_0_msb_r ) { return (unico_gunx_0_msb_r(machine,0,0)-0x0800) << 16; } |
| 223 | 223 | static READ32_HANDLER( zeropnt2_guny_0_msb_r ) { return (unico_guny_0_msb_r(machine,0,0)+0x0800) << 16; } |
| r2375 | r2376 | |
|---|---|---|
| 53 | 53 | static READ16_HANDLER( realbrk_dsw_r ) |
| 54 | 54 | { |
| 55 | 55 | UINT16 sel = ~realbrk_dsw_select[0]; |
| 56 | if (sel & 0x01) return (readinputport(2) & 0x00ff) << 8; // DSW1 low bits | |
| 57 | if (sel & 0x02) return (readinputport(3) & 0x00ff) << 8; // DSW2 low bits | |
| 58 | if (sel & 0x04) return (readinputport(4) & 0x00ff) << 8; // DSW3 low bits | |
| 59 | if (sel & 0x08) return (readinputport(5) & 0x00ff) << 8; // DSW4 low bits | |
| 56 | if (sel & 0x01) return (input_port_read_indexed(machine, 2) & 0x00ff) << 8; // DSW1 low bits | |
| 57 | if (sel & 0x02) return (input_port_read_indexed(machine, 3) & 0x00ff) << 8; // DSW2 low bits | |
| 58 | if (sel & 0x04) return (input_port_read_indexed(machine, 4) & 0x00ff) << 8; // DSW3 low bits | |
| 59 | if (sel & 0x08) return (input_port_read_indexed(machine, 5) & 0x00ff) << 8; // DSW4 low bits | |
| 60 | 60 | |
| 61 | if (sel & 0x10) return ((readinputport(2) & 0x0300) << 0) | // DSWs high 2 bits | |
| 62 | ((readinputport(3) & 0x0300) << 2) | | |
| 63 | ((readinputport(4) & 0x0300) << 4) | | |
| 64 | ((readinputport(5) & 0x0300) << 6) ; | |
| 61 | if (sel & 0x10) return ((input_port_read_indexed(machine, 2) & 0x0300) << 0) | // DSWs high 2 bits | |
| 62 | ((input_port_read_indexed(machine, 3) & 0x0300) << 2) | | |
| 63 | ((input_port_read_indexed(machine, 4) & 0x0300) << 4) | | |
| 64 | ((input_port_read_indexed(machine, 5) & 0x0300) << 6) ; | |
| 65 | 65 | |
| 66 | 66 | logerror("CPU #0 PC %06X: read with unknown dsw_select = %02x\n",activecpu_get_pc(),realbrk_dsw_select[0]); |
| 67 | 67 | return 0xffff; |
| r2375 | r2376 | |
|---|---|---|
| 48 | 48 | ***************************************************************************/ |
| 49 | 49 | |
| 50 | 50 | #include "driver.h" |
| 51 | #include "deprecat.h" | |
| 51 | 52 | #include "sound/custom.h" |
| 52 | 53 | #include "includes/amiga.h" |
| 53 | 54 | |
| r2375 | r2376 | |
| 93 | 94 | |
| 94 | 95 | static UINT8 arcadia_cia_0_porta_r(void) |
| 95 | 96 | { |
| 96 | return | |
| 97 | return | |
| 97 | 98 | } |
| 98 | 99 | |
| 99 | 100 | static void arcadia_cia_0_porta_w(UINT8 data) |
| r2375 | r2376 | |
| 133 | 134 | |
| 134 | 135 | static UINT8 arcadia_cia_0_portb_r(void) |
| 135 | 136 | { |
| 136 | return | |
| 137 | return | |
| 137 | 138 | } |
| 138 | 139 | |
| 139 | 140 | static void arcadia_cia_0_portb_w(UINT8 data) |
| r2375 | r2376 | |
|---|---|---|
| 257 | 257 | /* read as two bits from each of 4 ports. For this reason, the input */ |
| 258 | 258 | /* ports have been organized logically, and are demangled at runtime. */ |
| 259 | 259 | /* 4 input ports each provide 8 bits of information. */ |
| 260 | UINT8 d7d6 = readinputportbytag("D7D6"); | |
| 261 | UINT8 d5d4 = readinputportbytag("D5D4"); | |
| 262 | UINT8 d3d2 = readinputportbytag("D3D2"); | |
| 263 | UINT8 d1d0 = readinputportbytag("D1D0"); | |
| 260 | UINT8 d7d6 = input_port_read(machine, "D7D6"); | |
| 261 | UINT8 d5d4 = input_port_read(machine, "D5D4"); | |
| 262 | UINT8 d3d2 = input_port_read(machine, "D3D2"); | |
| 263 | UINT8 d1d0 = input_port_read(machine, "D1D0"); | |
| 264 | 264 | int shift = offset & 3; |
| 265 | 265 | return demangle(d7d6 >> shift, d5d4 >> shift, d3d2 >> shift, d1d0 >> shift); |
| 266 | 266 | } |
| r2375 | r2376 | |
| 284 | 284 | INT8 delta; |
| 285 | 285 | |
| 286 | 286 | if (spinner_select & 1) |
| 287 | return | |
| 287 | return | |
| 288 | 288 | |
| 289 | 289 | /* |
| 290 | 290 | * The values returned are always increasing. That is, regardless of whether |
| r2375 | r2376 | |
| 294 | 294 | */ |
| 295 | 295 | |
| 296 | 296 | /* I'm sure this can be further simplified ;-) BW */ |
| 297 | delta = | |
| 297 | delta = | |
| 298 | 298 | if (delta != 0) |
| 299 | 299 | { |
| 300 | 300 | spinner_sign = (delta >> 7) & 1; |
| r2375 | r2376 | |
| 313 | 313 | |
| 314 | 314 | static CUSTOM_INPUT( elim4_joint_coin_r ) |
| 315 | 315 | { |
| 316 | return ( | |
| 316 | return ( | |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | |
| r2375 | r2376 | |
| 329 | 329 | { |
| 330 | 330 | case 6: |
| 331 | 331 | /* player 3 & 4 controls */ |
| 332 | result = | |
| 332 | result = | |
| 333 | 333 | break; |
| 334 | 334 | case 7: |
| 335 | 335 | /* the 4 coin inputs */ |
| 336 | result = | |
| 336 | result = | |
| 337 | 337 | break; |
| 338 | 338 | } |
| 339 | 339 | } |
| r2375 | r2376 | |
|---|---|---|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | |
| 147 | static READ16_HANDLER ( varia_dips_bit8_r ) { return ((readinputport(3) & 0x80) << 0) | ((readinputport(2) & 0x80) >> 1); } | |
| 148 | static READ16_HANDLER ( varia_dips_bit7_r ) { return ((readinputport(3) & 0x40) << 1) | ((readinputport(2) & 0x40) >> 0); } | |
| 149 | static READ16_HANDLER ( varia_dips_bit6_r ) { return ((readinputport(3) & 0x20) << 2) | ((readinputport(2) & 0x20) << 1); } | |
| 150 | static READ16_HANDLER ( varia_dips_bit5_r ) { return ((readinputport(3) & 0x10) << 3) | ((readinputport(2) & 0x10) << 2); } | |
| 151 | static READ16_HANDLER ( varia_dips_bit4_r ) { return ((readinputport(3) & 0x08) << 4) | ((readinputport(2) & 0x08) << 3); } | |
| 152 | static READ16_HANDLER ( varia_dips_bit3_r ) { return ((readinputport(3) & 0x04) << 5) | ((readinputport(2) & 0x04) << 4); } | |
| 153 | static READ16_HANDLER ( varia_dips_bit2_r ) { return ((readinputport(3) & 0x02) << 6) | ((readinputport(2) & 0x02) << 5); } | |
| 154 | static READ16_HANDLER ( varia_dips_bit1_r ) { return ((readinputport(3) & 0x01) << 7) | ((readinputport(2) & 0x01) << 6); } | |
| 147 | static READ16_HANDLER ( varia_dips_bit8_r ) { return ((input_port_read_indexed(machine, 3) & 0x80) << 0) | ((input_port_read_indexed(machine, 2) & 0x80) >> 1); } | |
| 148 | static READ16_HANDLER ( varia_dips_bit7_r ) { return ((input_port_read_indexed(machine, 3) & 0x40) << 1) | ((input_port_read_indexed(machine, 2) & 0x40) >> 0); } | |
| 149 | static READ16_HANDLER ( varia_dips_bit6_r ) { return ((input_port_read_indexed(machine, 3) & 0x20) << 2) | ((input_port_read_indexed(machine, 2) & 0x20) << 1); } | |
| 150 | static READ16_HANDLER ( varia_dips_bit5_r ) { return ((input_port_read_indexed(machine, 3) & 0x10) << 3) | ((input_port_read_indexed(machine, 2) & 0x10) << 2); } | |
| 151 | static READ16_HANDLER ( varia_dips_bit4_r ) { return ((input_port_read_indexed(machine, 3) & 0x08) << 4) | ((input_port_read_indexed(machine, 2) & 0x08) << 3); } | |
| 152 | static READ16_HANDLER ( varia_dips_bit3_r ) { return ((input_port_read_indexed(machine, 3) & 0x04) << 5) | ((input_port_read_indexed(machine, 2) & 0x04) << 4); } | |
| 153 | static READ16_HANDLER ( varia_dips_bit2_r ) { return ((input_port_read_indexed(machine, 3) & 0x02) << 6) | ((input_port_read_indexed(machine, 2) & 0x02) << 5); } | |
| 154 | static READ16_HANDLER ( varia_dips_bit1_r ) { return ((input_port_read_indexed(machine, 3) & 0x01) << 7) | ((input_port_read_indexed(machine, 2) & 0x01) << 6); } | |
| 155 | 155 | |
| 156 | 156 | static WRITE16_HANDLER( vmetal_control_w ) |
| 157 | 157 | { |
| r2375 | r2376 | |
|---|---|---|
| 62 | 62 | static READ8_HANDLER( control_data_r ) |
| 63 | 63 | { |
| 64 | 64 | switch (control_port_select) { |
| 65 | case 0xfe: return readinputportbytag("IN0"); /* Player 1 */ | |
| 66 | case 0xfd: return readinputportbytag("IN1"); /* Player 2 */ | |
| 67 | case 0xfb: return readinputportbytag("IN2"); /* Coins */ | |
| 68 | case 0xf7: return readinputportbytag("DSW2"); /* Dip 2 */ | |
| 69 | case 0xef: return readinputportbytag("DSW1"); /* Dip 1 */ | |
| 65 | case 0xfe: return input_port_read(machine, "IN0"); /* Player 1 */ | |
| 66 | case 0xfd: return input_port_read(machine, "IN1"); /* Player 2 */ | |
| 67 | case 0xfb: return input_port_read(machine, "IN2"); /* Coins */ | |
| 68 | case 0xf7: return input_port_read(machine, "DSW2"); /* Dip 2 */ | |
| 69 | case 0xef: return input_port_read(machine, "DSW1"); /* Dip 1 */ | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | return 0xff; |
| r2375 | r2376 | |
|---|---|---|
| 193 | 193 | |
| 194 | 194 | static READ32_HANDLER( dreamwld_inputs_r ) |
| 195 | 195 | { |
| 196 | return | |
| 196 | return | |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | static READ32_HANDLER( dreamwld_dips_r ) |
| 200 | 200 | { |
| 201 | 201 | int x; |
| 202 | x= | |
| 202 | x= | |
| 203 | 203 | return x|(x<<16); |
| 204 | 204 | } |
| 205 | 205 |
| r2375 | r2376 | |
|---|---|---|
| 245 | 245 | |
| 246 | 246 | static READ8_HANDLER( xain_input_port_4_r ) |
| 247 | 247 | { |
| 248 | return | |
| 248 | return | |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | static INTERRUPT_GEN( xain_interrupt ) |
| r2375 | r2376 | |
|---|---|---|
| 73 | 73 | { |
| 74 | 74 | if (input_ports_hack) |
| 75 | 75 | { |
| 76 | rambase[0x004] = readinputport(4); /* COIN */ | |
| 77 | rambase[0x005] = readinputport(3); /* IN1 */ | |
| 78 | rambase[0x006] = readinputport(2); /* IN0 */ | |
| 76 | rambase[0x004] = input_port_read_indexed(machine, 4); /* COIN */ | |
| 77 | rambase[0x005] = input_port_read_indexed(machine, 3); /* IN1 */ | |
| 78 | rambase[0x006] = input_port_read_indexed(machine, 2); /* IN0 */ | |
| 79 | 79 | } |
| 80 | 80 | cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xd7); /* RST 10h vblank */ |
| 81 | 81 | } |
| r2375 | r2376 | |
|---|---|---|
| 412 | 412 | |
| 413 | 413 | static READ8_HANDLER( dsw_r ) |
| 414 | 414 | { |
| 415 | int ret = | |
| 415 | int ret = | |
| 416 | 416 | if (!(offset & 2)) ret >>= 4; |
| 417 | 417 | return 0xf0 | ret; |
| 418 | 418 | } |
| r2375 | r2376 | |
|---|---|---|
| 1390 | 1390 | |
| 1391 | 1391 | /* video hardware */ |
| 1392 | 1392 | MDRV_GFXDECODE(ldrun3) |
| 1393 | MDRV_VIDEO_START(ldrun2) | |
| 1394 | MDRV_VIDEO_UPDATE(ldrun) | |
| 1393 | 1395 | MACHINE_DRIVER_END |
| 1394 | 1396 | |
| 1395 | 1397 |
| r2375 | r2376 | |
|---|---|---|
| 258 | 258 | static CUSTOM_INPUT( ebases_trackball_r ) |
| 259 | 259 | { |
| 260 | 260 | static const char *const names[] = { "TRACKX2", "TRACKY2", "TRACKX1", "TRACKY1" }; |
| 261 | return | |
| 261 | return | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
| r2375 | r2376 | |
| 285 | 285 | { |
| 286 | 286 | coin_counter_w(0, (offset >> 8) & 1); |
| 287 | 287 | coin_counter_w(1, (offset >> 9) & 1); |
| 288 | return | |
| 288 | return | |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | |
| r2375 | r2376 | |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | |
| 450 | static | |
| 450 | static STATE_POSTLOAD( profbank_banksw_restore | |
| 451 | 451 | { |
| 452 | 452 | profpac_banksw_w(Machine, 0, profpac_bank); |
| 453 | 453 | } |
| r2375 | r2376 | |
| 474 | 474 | static CUSTOM_INPUT( demndragn_joystick_r ) |
| 475 | 475 | { |
| 476 | 476 | static const char *const names[] = { "MOVEX", "MOVEY" }; |
| 477 | return | |
| 477 | return | |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | |
| r2375 | r2376 | |
| 1727 | 1727 | |
| 1728 | 1728 | /* reset banking */ |
| 1729 | 1729 | profpac_banksw_w(machine, 0, 0); |
| 1730 | state_save_register_ | |
| 1730 | state_save_register_ | |
| 1731 | 1731 | } |
| 1732 | 1732 | |
| 1733 | 1733 | |
| r2375 | r2376 | |
| 1741 | 1741 | |
| 1742 | 1742 | /* reset banking */ |
| 1743 | 1743 | profpac_banksw_w(machine, 0, 0); |
| 1744 | state_save_register_ | |
| 1744 | state_save_register_ | |
| 1745 | 1745 | } |
| 1746 | 1746 | |
| 1747 | 1747 | |
| r2375 | r2376 | |
| 1760 | 1760 | |
| 1761 | 1761 | /* reset banking */ |
| 1762 | 1762 | profpac_banksw_w(machine, 0, 0); |
| 1763 | state_save_register_ | |
| 1763 | state_save_register_ | |
| 1764 | 1764 | } |
| 1765 | 1765 | |
| 1766 | 1766 |
| r2375 | r2376 | |
|---|---|---|
| 117 | 117 | |
| 118 | 118 | static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 119 | 119 | AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM) |
| 120 | AM_RANGE(0x6000, 0x6000) AM_READ(input_port_0_r) /* IO Coin */ | |
| 121 | AM_RANGE(0x6001, 0x6001) AM_READ(input_port_1_r) /* P1 IO */ | |
| 122 | AM_RANGE(0x6002, 0x6002) AM_READ(input_port_2_r) /* P2 IO */ | |
| 123 | AM_RANGE(0x8000, 0x8000) AM_READ(input_port_3_r) /* DIP 1 */ | |
| 124 | AM_RANGE(0x8001, 0x8001) AM_READ(input_port_4_r) /* DIP 2 */ | |
| 120 | AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0") /* IO Coin */ | |
| 121 | AM_RANGE(0x6001, 0x6001) AM_READ_PORT("IN1") /* P1 IO */ | |
| 122 | AM_RANGE(0x6002, 0x6002) AM_READ_PORT("IN2") /* P2 IO */ | |
| 123 | AM_RANGE(0x8000, 0x8000) AM_READ_PORT("DSW1") /* DIP 1 */ | |
| 124 | AM_RANGE(0x8001, 0x8001) AM_READ_PORT("DSW2") /* DIP 2 */ | |
| 125 | 125 | AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE(1) |
| 126 | 126 | ADDRESS_MAP_END |
| 127 | 127 | |
| r2375 | r2376 | |
| 163 | 163 | ADDRESS_MAP_END |
| 164 | 164 | |
| 165 | 165 | static INPUT_PORTS_START( megazone ) |
| 166 | /* 0x6000 -> 0xe320 (CPU1) = 0x3b20 (CPU0) */ | |
| 166 | 167 | PORT_START_TAG("IN0") |
| 167 | 168 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 168 | 169 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| r2375 | r2376 | |
| 173 | 174 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 174 | 175 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 175 | 176 | |
| 177 | /* 0x6001 -> 0xe31e (CPU1) = 0x3b1e (CPU0) */ | |
| 176 | 178 | PORT_START_TAG("IN1") |
| 177 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY | |
| 179 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY | |
| 178 | 180 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY |
| 179 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY | |
| 180 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY | |
| 181 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY | |
| 182 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY | |
| 181 | 183 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 182 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_ | |
| 184 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_ | |
| 183 | 185 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 184 | 186 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 185 | 187 | |
| 188 | /* 0x6002 -> 0xe31e (CPU1) = 0x3b1e (CPU0) or 0xe31f (CPU1) = 0x3b1f (CPU0) in "test mode" */ | |
| 186 | 189 | PORT_START_TAG("IN2") |
| 187 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL | |
| 190 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL | |
| 188 | 191 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL |
| 189 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_COCKTAIL | |
| 190 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_COCKTAIL | |
| 192 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL | |
| 193 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL | |
| 191 | 194 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 192 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_ | |
| 195 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_ | |
| 193 | 196 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 194 | 197 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 195 | 198 | |
| 199 | /* 0x8000 -> 0xe020 (CPU1) = 0x3820 (CPU0) */ | |
| 196 | 200 | PORT_START_TAG("DSW1") |
| 197 | 201 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) |
| 198 | 202 | PORT_DIPSETTING( 0x03, "3" ) |
| 199 | 203 | PORT_DIPSETTING( 0x02, "4" ) |
| 200 | 204 | PORT_DIPSETTING( 0x01, "5" ) |
| 201 | PORT_DIPSETTING( 0x00, " | |
| 205 | PORT_DIPSETTING( 0x00, "7 | |
| 202 | 206 | PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) ) |
| 203 | 207 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 204 | 208 | PORT_DIPSETTING( 0x04, DEF_STR( Cocktail ) ) |
| 205 | 209 | PORT_DIPNAME( 0x18, 0x18, DEF_STR( Bonus_Life ) ) |
| 206 | PORT_DIPSETTING( 0x18, "20k 70k" ) | |
| 207 | PORT_DIPSETTING( 0x10, "20k 80k" ) | |
| 208 | PORT_DIPSETTING( 0x08, "30k 90k" ) | |
| 209 | PORT_DIPSETTING( 0x00, "30k 100k" ) | |
| 210 | PORT_DIPSETTING( 0x18, "20k 70k 70k+" ) | |
| 211 | PORT_DIPSETTING( 0x10, "20k 80k 80k+" ) | |
| 212 | PORT_DIPSETTING( 0x08, "30k 90k 90k+" ) | |
| 213 | PORT_DIPSETTING( 0x00, "30k 100k 100k+" ) | |
| 210 | 214 | PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) ) |
| 211 | 215 | PORT_DIPSETTING( 0x60, DEF_STR( Easy ) ) |
| 212 | 216 | PORT_DIPSETTING( 0x40, DEF_STR( Normal ) ) |
| 213 | PORT_DIPSETTING( 0x20, "Difficult" ) | |
| 214 | PORT_DIPSETTING( 0x00, "Very Difficult" ) | |
| 217 | PORT_DIPSETTING( 0x20, DEF_STR( Hard ) ) | |
| 218 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) | |
| 215 | 219 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) |
| 216 | 220 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 217 | 221 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 218 | 222 | |
| 223 | /* 0x8001 -> 0xe021 (CPU1) = 0x3821 (CPU0) */ | |
| 219 | 224 | PORT_START_TAG("DSW2") |
| 220 | 225 | PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) |
| 221 | 226 | PORT_DIPSETTING( 0x02, DEF_STR( 4C_1C ) ) |
| r2375 | r2376 | |
| 250 | 255 | PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) ) |
| 251 | 256 | PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) ) |
| 252 | 257 | PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) ) |
| 253 | ||
| 258 | // PORT_DIPSETTING( 0x00, DEF_STR( 1C | |
| 254 | 259 | INPUT_PORTS_END |
| 255 | 260 | |
| 261 | static INPUT_PORTS_START( megazona ) | |
| 262 | PORT_INCLUDE( megazone ) | |
| 256 | 263 | |
| 264 | PORT_MODIFY("DSW1") | |
| 265 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) | |
| 266 | PORT_DIPSETTING( 0x03, "2" ) | |
| 267 | PORT_DIPSETTING( 0x02, "3" ) | |
| 268 | PORT_DIPSETTING( 0x01, "4" ) | |
| 269 | PORT_DIPSETTING( 0x00, "7" ) | |
| 270 | INPUT_PORTS_END | |
| 257 | 271 | |
| 272 | ||
| 258 | 273 | static const gfx_layout charlayout = |
| 259 | 274 | { |
| 260 | 275 | 8,8, /* 8*8 characters */ |
| r2375 | r2376 | |
| 577 | 592 | |
| 578 | 593 | /* these just display a Konami copyright, no logo */ |
| 579 | 594 | GAME( 1983, megazone, 0, megazone, megazone, megazone, ROT90, "Konami", "Mega Zone (Konami set 1)", 0 ) |
| 580 | GAME( 1983, megazona, megazone, megazone, megazon | |
| 595 | GAME( 1983, megazona, megazone, megazone, megazona, megazone, ROT90, "Konami", "Mega Zone (Konami set 2)", 0 ) | |
| 581 | 596 | |
| 582 | 597 | /* these display Konami and Kosuka copyright, no logo */ |
| 583 | 598 | GAME( 1983, megazonb, megazone, megazone, megazone, megazone, ROT90, "Konami / Kosuka", "Mega Zone (Kosuka set 1)", 0 ) |
| r2375 | r2376 | |
|---|---|---|
| 153 | 153 | |
| 154 | 154 | static READ32_HANDLER(hvysmsh_eeprom_r) |
| 155 | 155 | { |
| 156 | return (EEPROM_read_bit()<<24) | | |
| 156 | return (EEPROM_read_bit()<<24) | | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | static WRITE32_HANDLER(hvysmsh_eeprom_w) |
| r2375 | r2376 | |
| 196 | 196 | |
| 197 | 197 | static READ32_HANDLER(wcvol95_eeprom_r) |
| 198 | 198 | { |
| 199 | return (EEPROM_read_bit()<<24) | | |
| 199 | return (EEPROM_read_bit()<<24) | | |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | static WRITE32_HANDLER(wcvol95_eeprom_w) |
| r2375 | r2376 | |
|---|---|---|
| 243 | 243 | memory_set_bankptr(1, &RAM[bank ? 0x10000 : 0x4000]); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | static STATE_POSTLOAD( renegade_postload ) | |
| 247 | { | |
| 248 | setbank(); | |
| 249 | } | |
| 250 | ||
| 246 | 251 | static MACHINE_START( renegade ) |
| 247 | 252 | { |
| 248 | 253 | state_save_register_global_array(mcu_buffer); |
| r2375 | r2376 | |
| 251 | 256 | state_save_register_global(mcu_key); |
| 252 | 257 | |
| 253 | 258 | state_save_register_global(bank); |
| 254 | state_save_register_ | |
| 259 | state_save_register_ | |
| 255 | 260 | } |
| 256 | 261 | |
| 257 | 262 | static DRIVER_INIT( kuniokun ) |
| r2375 | r2376 | |
| 489 | 494 | { |
| 490 | 495 | /* |
| 491 | 496 | static int coin; |
| 492 | int port = | |
| 497 | int port = | |
| 493 | 498 | if (port != 0xc0) |
| 494 | 499 | { |
| 495 | 500 | if (coin == 0) |
| r2375 | r2376 | |
|---|---|---|
| 716 | 716 | { |
| 717 | 717 | int bit0,bit1; |
| 718 | 718 | |
| 719 | bit0 = (readinputportbytag("DSWB") >> offset) & 1; | |
| 720 | bit1 = (readinputportbytag("DSWA") >> offset) & 1; | |
| 719 | bit0 = (input_port_read(machine, "DSWB") >> offset) & 1; | |
| 720 | bit1 = (input_port_read(machine, "DSWA") >> offset) & 1; | |
| 721 | 721 | |
| 722 | 722 | return bit0 | (bit1 << 1); |
| 723 | 723 | } |
| r2375 | r2376 | |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | |
| 774 | static READ8_HANDLER( in0_l ) { return readinputportbytag("IN0"); } // fire and start buttons | |
| 775 | static READ8_HANDLER( in0_h ) { return readinputportbytag("IN0") >> 4; } // coins | |
| 776 | static READ8_HANDLER( in1_l ) { return readinputportbytag("IN1"); } // P1 joystick | |
| 777 | static READ8_HANDLER( in1_h ) { return readinputportbytag("IN1") >> 4; } // P2 joystick | |
| 778 | static READ8_HANDLER( dipA_l ) { return readinputportbytag("DSWA"); } // dips A | |
| 779 | static READ8_HANDLER( dipA_h ) { return readinputportbytag("DSWA") >> 4; } // dips A | |
| 780 | static READ8_HANDLER( dipB_l ) { return readinputportbytag("DSWB"); } // dips B | |
| 781 | static READ8_HANDLER( dipB_h ) { return readinputportbytag("DSWB") >> 4; } // dips B | |
| 774 | static READ8_HANDLER( in0_l ) { return input_port_read(machine, "IN0"); } // fire and start buttons | |
| 775 | static READ8_HANDLER( in0_h ) { return input_port_read(machine, "IN0") >> 4; } // coins | |
| 776 | static READ8_HANDLER( in1_l ) { return input_port_read(machine, "IN1"); } // P1 joystick | |
| 777 | static READ8_HANDLER( in1_h ) { return input_port_read(machine, "IN1") >> 4; } // P2 joystick | |
| 778 | static READ8_HANDLER( dipA_l ) { return input_port_read(machine, "DSWA"); } // dips A | |
| 779 | static READ8_HANDLER( dipA_h ) { return input_port_read(machine, "DSWA") >> 4; } // dips A | |
| 780 | static READ8_HANDLER( dipB_l ) { return input_port_read(machine, "DSWB"); } // dips B | |
| 781 | static READ8_HANDLER( dipB_h ) { return input_port_read(machine, "DSWB") >> 4; } // dips B | |
| 782 | 782 | static WRITE8_HANDLER( out_0 ) |
| 783 | 783 | { |
| 784 | 784 | set_led_status(1,data & 1); |
| r2375 | r2376 | |
|---|---|---|
| 95 | 95 | /*It's bit-wise*/ |
| 96 | 96 | switch(macs_mux_data&0x0f) |
| 97 | 97 | { |
| 98 | case 0x00: return readinputportbytag("IN0"); | |
| 99 | case 0x01: return readinputportbytag("IN1"); | |
| 100 | case 0x02: return readinputportbytag("IN2"); | |
| 101 | case 0x04: return readinputportbytag("IN3"); | |
| 102 | case 0x08: return readinputportbytag("IN4"); | |
| 98 | case 0x00: return input_port_read(machine, "IN0"); | |
| 99 | case 0x01: return input_port_read(machine, "IN1"); | |
| 100 | case 0x02: return input_port_read(machine, "IN2"); | |
| 101 | case 0x04: return input_port_read(machine, "IN3"); | |
| 102 | case 0x08: return input_port_read(machine, "IN4"); | |
| 103 | 103 | default: |
| 104 | 104 | logerror("Unmapped mahjong panel mux data %02x\n",macs_mux_data); |
| 105 | 105 | return 0xff; |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | case 1: return readinputportbytag("SYS0"); | |
| 109 | case 2: return readinputportbytag("DSW0"); | |
| 110 | case 3: return readinputportbytag("DSW1"); | |
| 111 | case 4: return readinputportbytag("DSW2"); | |
| 112 | case 5: return readinputportbytag("DSW3"); | |
| 113 | case 6: return readinputportbytag("DSW4"); | |
| 114 | case 7: return readinputportbytag("SYS1"); | |
| 108 | case 1: return input_port_read(machine, "SYS0"); | |
| 109 | case 2: return input_port_read(machine, "DSW0"); | |
| 110 | case 3: return input_port_read(machine, "DSW1"); | |
| 111 | case 4: return input_port_read(machine, "DSW2"); | |
| 112 | case 5: return input_port_read(machine, "DSW3"); | |
| 113 | case 6: return input_port_read(machine, "DSW4"); | |
| 114 | case 7: return input_port_read(machine, "SYS1"); | |
| 115 | 115 | default: popmessage("Unmapped I/O read at PC = %06x offset = %02x",activecpu_get_pc(),offset+0xc0); |
| 116 | 116 | } |
| 117 | 117 |
| r2375 | r2376 | |
|---|---|---|
| 177 | 177 | static READ8_HANDLER (controls_r) |
| 178 | 178 | { |
| 179 | 179 | if(sbw_system&2) |
| 180 | return input_port_ | |
| 180 | return input_port_ | |
| 181 | 181 | else |
| 182 | return input_port_ | |
| 182 | return input_port_ | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2375 | r2376 | |
|---|---|---|
| 205 | 205 | switch( port ) |
| 206 | 206 | { |
| 207 | 207 | case 0x08: /* trackball y coords bottom 8 bits for 2nd player */ |
| 208 | return | |
| 208 | return | |
| 209 | 209 | |
| 210 | 210 | case 0x09: /* trackball y coords top 8 bits for 2nd player */ |
| 211 | if ( | |
| 211 | if ( | |
| 212 | 212 | return 0xff; |
| 213 | 213 | else /* y+ direction (positive value) */ |
| 214 | 214 | return 0x00; |
| 215 | 215 | |
| 216 | 216 | case 0x0a: /* trackball x coords bottom 8 bits for 2nd player */ |
| 217 | return | |
| 217 | return | |
| 218 | 218 | |
| 219 | 219 | case 0x0b: /* trackball x coords top 8 bits for 2nd player */ |
| 220 | if ( | |
| 220 | if ( | |
| 221 | 221 | return 0xff; |
| 222 | 222 | else /* x+ direction (positive value) */ |
| 223 | 223 | return 0x00; |
| 224 | 224 | |
| 225 | 225 | case 0x0c: /* trackball y coords bottom 8 bits for 1st player */ |
| 226 | return | |
| 226 | return | |
| 227 | 227 | |
| 228 | 228 | case 0x0d: /* trackball y coords top 8 bits for 1st player */ |
| 229 | if ( | |
| 229 | if ( | |
| 230 | 230 | return 0xff; |
| 231 | 231 | else /* y+ direction (positive value) */ |
| 232 | 232 | return 0x00; |
| 233 | 233 | |
| 234 | 234 | case 0x0e: /* trackball x coords bottom 8 bits for 1st player */ |
| 235 | return | |
| 235 | return | |
| 236 | 236 | |
| 237 | 237 | case 0x0f: /* trackball x coords top 8 bits for 1st player */ |
| 238 | if ( | |
| 238 | if ( | |
| 239 | 239 | return 0xff; |
| 240 | 240 | else /* x+ direction (positive value) */ |
| 241 | 241 | return 0x00; |
| r2375 | r2376 | |
| 566 | 566 | GFXDECODE_END |
| 567 | 567 | |
| 568 | 568 | |
| 569 | static STATE_POSTLOAD( taitoh_postload ) | |
| 570 | { | |
| 571 | reset_sound_region(); | |
| 572 | } | |
| 573 | ||
| 569 | 574 | static MACHINE_START( taitoh ) |
| 570 | 575 | { |
| 571 | 576 | state_save_register_global(banknum); |
| 572 | state_save_register_ | |
| 577 | state_save_register_ | |
| 573 | 578 | } |
| 574 | 579 | |
| 575 | 580 |
| r2375 | r2376 | |
|---|---|---|
| 892 | 892 | static READ8_HANDLER( sfl_input_r ) |
| 893 | 893 | { |
| 894 | 894 | sfl_int^=0x80;//vblank flag ? |
| 895 | return sfl_int|input_port_ | |
| 895 | return sfl_int|input_port_ | |
| 896 | 896 | } |
| 897 | 897 | |
| 898 | 898 | static ADDRESS_MAP_START( sflush_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2375 | r2376 | |
|---|---|---|
| 416 | 416 | static READ16_HANDLER( othunder_lightgun_r ) |
| 417 | 417 | { |
| 418 | 418 | static const char *const dswname[4] = { P1X_PORT_TAG, P1Y_PORT_TAG, P2X_PORT_TAG, P2Y_PORT_TAG }; |
| 419 | return | |
| 419 | return | |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | static WRITE16_HANDLER( othunder_lightgun_w ) |
| r2375 | r2376 | |
| 441 | 441 | memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | static STATE_POSTLOAD( othunder_postload ) | |
| 445 | { | |
| 446 | reset_sound_region(); | |
| 447 | } | |
| 448 | ||
| 444 | 449 | static MACHINE_START( othunder ) |
| 445 | 450 | { |
| 446 | 451 | state_save_register_global(banknum); |
| 447 | state_save_register_ | |
| 452 | state_save_register_ | |
| 448 | 453 | } |
| 449 | 454 | |
| 450 | 455 |
| r2375 | r2376 | |
|---|---|---|
| 111 | 111 | |
| 112 | 112 | static READ8_HANDLER( gray5bit_controller0_r ) |
| 113 | 113 | { |
| 114 | return (input_port_ | |
| 114 | return (input_port_ | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | static READ8_HANDLER( gray5bit_controller1_r ) |
| 118 | 118 | { |
| 119 | return (input_port_ | |
| 119 | return (input_port_ | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | static WRITE8_HANDLER( sound_w ) |
| r2375 | r2376 | |
|---|---|---|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // send format tablet packet |
| 264 | if ( | |
| 264 | if ( | |
| 265 | 265 | { |
| 266 | int tx = readinputportbytag("TOUCH_X"); | |
| 267 | int ty = readinputportbytag("TOUCH_Y"); | |
| 266 | int tx = input_port_read(machine, "TOUCH_X"); | |
| 267 | int ty = input_port_read(machine, "TOUCH_Y"); | |
| 268 | 268 | |
| 269 | 269 | if ( microtouch.touch_callback == NULL || |
| 270 | 270 | microtouch.touch_callback( &tx, &ty ) != 0 ) |
| r2375 | r2376 | |
| 864 | 864 | |
| 865 | 865 | static READ8_HANDLER(meritm_ay8930_port_a_r) |
| 866 | 866 | { |
| 867 | return | |
| 867 | return | |
| 868 | 868 | }; |
| 869 | 869 | |
| 870 | 870 | static WRITE8_HANDLER(meritm_ay8930_port_b_w) |
| r2375 | r2376 | |
| 922 | 922 | |
| 923 | 923 | static READ8_HANDLER(meritm_io_pio_port_a_r) |
| 924 | 924 | { |
| 925 | return | |
| 925 | return | |
| 926 | 926 | }; |
| 927 | 927 | |
| 928 | 928 | static READ8_HANDLER(meritm_io_pio_port_b_r) |
| 929 | 929 | { |
| 930 | return | |
| 930 | return | |
| 931 | 931 | }; |
| 932 | 932 | |
| 933 | 933 | static WRITE8_HANDLER(meritm_io_pio_port_a_w) |
| r2375 | r2376 | |
|---|---|---|
| 212 | 212 | |
| 213 | 213 | static READ16_HANDLER( opwolf3_adc_r ) |
| 214 | 214 | { |
| 215 | return | |
| 215 | return | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | static WRITE16_HANDLER( opwolf3_adc_req_w ) |
| r2375 | r2376 | |
| 232 | 232 | memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | static STATE_POSTLOAD( slapshot_postload ) | |
| 236 | { | |
| 237 | reset_sound_region(); | |
| 238 | } | |
| 239 | ||
| 235 | 240 | static MACHINE_START( slapshot ) |
| 236 | 241 | { |
| 237 | 242 | state_save_register_global(banknum); |
| 238 | state_save_register_ | |
| 243 | state_save_register_ | |
| 239 | 244 | } |
| 240 | 245 | |
| 241 | 246 |
| r2375 | r2376 | |
|---|---|---|
| 42 | 42 | |
| 43 | 43 | static READ32_HANDLER(IOCR_r) |
| 44 | 44 | { |
| 45 | return (input_port_ | |
| 45 | return (input_port_ | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | static WRITE32_HANDLER(IOCR_w) |
| r2375 | r2376 | |
|---|---|---|
| 43 | 43 | |
| 44 | 44 | static int e0_data,credits,coins; |
| 45 | 45 | |
| 46 | static void handle_coins(int coin) | |
| 46 | static void handle_coins(running_machine *machine, int coin) | |
| 47 | 47 | { |
| 48 | 48 | static const int coinage_table[4][2] = {{2,3},{2,1},{1,2},{1,1}}; |
| 49 | 49 | int tmp = 0; |
| r2375 | r2376 | |
| 52 | 52 | |
| 53 | 53 | if (coin & 1) // Coin 2 ! |
| 54 | 54 | { |
| 55 | tmp = ( | |
| 55 | tmp = ( | |
| 56 | 56 | coins++; |
| 57 | 57 | if (coins >= coinage_table[tmp][0]) |
| 58 | 58 | { |
| r2375 | r2376 | |
| 65 | 65 | |
| 66 | 66 | if (coin & 2) // Coin 1 ! |
| 67 | 67 | { |
| 68 | tmp = ( | |
| 68 | tmp = ( | |
| 69 | 69 | coins++; |
| 70 | 70 | if (coins >= coinage_table[tmp][0]) |
| 71 | 71 | { |
| r2375 | r2376 | |
| 99 | 99 | switch (e0_data) |
| 100 | 100 | { |
| 101 | 101 | case 0x81 : |
| 102 | return | |
| 102 | return | |
| 103 | 103 | break; |
| 104 | 104 | case 0x82 : |
| 105 | return | |
| 105 | return | |
| 106 | 106 | break; |
| 107 | 107 | case 0x91: |
| 108 | 108 | /* check coin inputs */ |
| 109 | coin = (( | |
| 109 | coin = (( | |
| 110 | 110 | if (coin ^ prev_coin && coin != 3) |
| 111 | 111 | { |
| 112 | if (credits < 9) handle_coins(coin); | |
| 112 | if (credits < 9) handle_coins(machine, coin); | |
| 113 | 113 | } |
| 114 | 114 | prev_coin = coin; |
| 115 | 115 | return credits; |
| 116 | 116 | break; |
| 117 | 117 | case 0x92: |
| 118 | return (( | |
| 118 | return (( | |
| 119 | 119 | break; |
| 120 | 120 | case 0xe0: /* reset? */ |
| 121 | 121 | coins = 0; |
| r2375 | r2376 | |
| 127 | 127 | return 0xff; |
| 128 | 128 | break; |
| 129 | 129 | case 0xfe: /* Dip Switches 1 to 4 */ |
| 130 | return | |
| 130 | return | |
| 131 | 131 | break; |
| 132 | 132 | case 0xff: /* Dip Switches 5 to 8 */ |
| 133 | return | |
| 133 | return | |
| 134 | 134 | break; |
| 135 | 135 | } |
| 136 | 136 | } |
| r2375 | r2376 | |
|---|---|---|
| 133 | 133 | logerror("%08x: Unmapped IRQ write %d %04x\n",activecpu_get_pc(),offset,data); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | static READ16_HANDLER( robocop2_dip3_r ) { return | |
| 136 | static READ16_HANDLER( robocop2_dip3_r ) { return | |
| 137 | 137 | |
| 138 | 138 | static READ16_HANDLER( robocop2_prot_r ) |
| 139 | 139 | { |
| 140 | 140 | switch (offset<<1) { |
| 141 | 141 | case 0x41a: /* Player 1 & 2 input ports */ |
| 142 | return | |
| 142 | return | |
| 143 | 143 | case 0x320: /* Coins */ |
| 144 | return | |
| 144 | return | |
| 145 | 145 | case 0x4e6: /* Dip switches */ |
| 146 | return | |
| 146 | return | |
| 147 | 147 | case 0x504: /* PC: 6b6. b4, 2c, 36 written before read */ |
| 148 | 148 | logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",activecpu_get_pc(),offset); |
| 149 | 149 | return 0x84; |
| r2375 | r2376 | |
|---|---|---|
| 210 | 210 | { |
| 211 | 211 | int shift = 4 * (offset & 1); |
| 212 | 212 | int port = offset & 2; |
| 213 | int r = ( readinputport( port+0 ) << shift ) & 0xf0; | |
| 214 | r |= ( readinputport( port+1 ) >> (4-shift) ) & 0x0f; | |
| 213 | int r = ( input_port_read_indexed(machine, port+0 ) << shift ) & 0xf0; | |
| 214 | r |= ( input_port_read_indexed(machine, port+1 ) >> (4-shift) ) & 0x0f; | |
| 215 | 215 | return r; |
| 216 | 216 | } |
| 217 | 217 |
| r2375 | r2376 | |
|---|---|---|
| 221 | 221 | |
| 222 | 222 | // logerror("Unk EEPROM read mask %x\n", mem_mask); |
| 223 | 223 | |
| 224 | return | |
| 224 | return | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | static INTERRUPT_GEN(psikyosh_interrupt) |
| r2375 | r2376 | |
| 234 | 234 | int ret = 0xff; |
| 235 | 235 | int sel = (ps4_io_select[0] & 0x0000ff00) >> 8; |
| 236 | 236 | |
| 237 | if (sel & 1) ret &= readinputport(0+4*offset); | |
| 238 | if (sel & 2) ret &= readinputport(1+4*offset); | |
| 239 | if (sel & 4) ret &= readinputport(2+4*offset); | |
| 240 | if (sel & 8) ret &= readinputport(3+4*offset); | |
| 237 | if (sel & 1) ret &= input_port_read_indexed(machine, 0+4*offset); | |
| 238 | if (sel & 2) ret &= input_port_read_indexed(machine, 1+4*offset); | |
| 239 | if (sel & 4) ret &= input_port_read_indexed(machine, 2+4*offset); | |
| 240 | if (sel & 8) ret &= input_port_read_indexed(machine, 3+4*offset); | |
| 241 | 241 | |
| 242 | return ret<<24 | | |
| 242 | return ret<<24 | | |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | static READ32_HANDLER(ps4_io32_r) /* used by loderndf/hotdebut */ |
| 246 | 246 | { |
| 247 | return (( | |
| 247 | return (( | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | static WRITE32_HANDLER( ps4_paletteram32_RRRRRRRRGGGGGGGGBBBBBBBBxxxxxxxx_dword_w ) |
| r2375 | r2376 | |
| 1068 | 1068 | return ps4_ram[0x00001c/4]; |
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | static | |
| 1071 | static STATE | |
| 1072 | 1072 | { |
| 1073 | set_hotgmck_pcm_bank((FPTR)param); | |
| 1074 | } | |
| 1075 | ||
| 1076 | static void install_hotgmck_pcm_bank(running_machine *machine) | |
| 1077 | { | |
| 1073 | 1078 | UINT8 *ymf_pcm = memory_region(REGION_SOUND1); |
| 1074 | 1079 | UINT8 *pcm_rom = memory_region(REGION_SOUND2); |
| 1075 | 1080 | |
| r2375 | r2376 | |
| 1080 | 1085 | set_hotgmck_pcm_bank(1); |
| 1081 | 1086 | |
| 1082 | 1087 | memory_install_write32_handler(0, ADDRESS_SPACE_PROGRAM, 0x5800008, 0x580000b, 0, 0, hotgmck_pcm_bank_w ); |
| 1083 | state_save_register_func_postload_int(set_hotgmck_pcm_bank, 0); | |
| 1084 | state_save_register_func_postload_int(set_hotgmck_pcm_bank, 1); | |
| 1088 | state_save_register_postload(machine, hotgmck_pcm_bank_postload, (void *)0); | |
| 1089 | state_save_register_postload(machine, hotgmck_pcm_bank_postload, (void *)1); | |
| 1085 | 1090 | } |
| 1086 | 1091 | |
| 1087 | 1092 | static DRIVER_INIT( hotgmck ) |
| r2375 | r2376 | |
| 1089 | 1094 | UINT8 *RAM = memory_region(REGION_CPU1); |
| 1090 | 1095 | memory_set_bankptr(1,&RAM[0x100000]); |
| 1091 | 1096 | memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x5800000, 0x5800007, 0, 0, hotgmck_io32_r ); // Different Inputs |
| 1092 | install_hotgmck_pcm_bank(); // Banked PCM ROM | |
| 1097 | install_hotgmck_pcm_bank(machine); // Banked PCM ROM | |
| 1093 | 1098 | } |
| 1094 | 1099 | |
| 1095 | 1100 | static DRIVER_INIT( loderndf ) |
| r2375 | r2376 | |
|---|---|---|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | ||
| 175 | STATE_POSTLOAD( wardner_restore_bank | |
| 176 | 176 | { |
| 177 | 177 | wardner_ramrom_bank_sw(Machine,0,1); /* Dummy value to ensure restoration */ |
| 178 | 178 | wardner_ramrom_bank_sw(Machine,0,wardner_membank); |
| r2375 | r2376 | |
| 674 | 674 | |
| 675 | 675 | static DRIVER_INIT( wardner ) |
| 676 | 676 | { |
| 677 | wardner_driver_savestate(); /* Save-State stuff in src/machine/twincobr.c */ | |
| 677 | wardner_driver_savestate(machine); /* Save-State stuff in src/machine/twincobr.c */ | |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 |
| r2375 | r2376 | |
|---|---|---|
| 73 | 73 | |
| 74 | 74 | static READ8_HANDLER( jcross_port_0_r ) |
| 75 | 75 | { |
| 76 | return(input_port_ | |
| 76 | return(input_port_ | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | static WRITE8_HANDLER(jcross_vregs0_w){jcross_vregs[0]=data;} |
| r2375 | r2376 | |
|---|---|---|
| 133 | 133 | |
| 134 | 134 | static READ16_HANDLER( mirage_controls_r ) |
| 135 | 135 | { |
| 136 | return | |
| 136 | return | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | static READ16_HANDLER( random_readers ) |
| r2375 | r2376 | |
| 143 | 143 | |
| 144 | 144 | static READ16_HANDLER( mirage_input_r ) |
| 145 | 145 | { |
| 146 | UINT16 port = | |
| 146 | UINT16 port = | |
| 147 | 147 | return port; |
| 148 | 148 | } |
| 149 | 149 |
| r2375 | r2376 | |
|---|---|---|
| 658 | 658 | if (ctrld) /* trackball */ |
| 659 | 659 | { |
| 660 | 660 | if (!flipscreen) |
| 661 | result = (( | |
| 661 | result = (( | |
| 662 | 662 | else |
| 663 | result = (( | |
| 663 | result = (( | |
| 664 | 664 | } |
| 665 | 665 | else /* buttons */ |
| 666 | result = | |
| 666 | result = | |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | /* IN1 */ |
| 670 | 670 | else if (offset < 0x4a00) |
| 671 | result = | |
| 671 | result = | |
| 672 | 672 | |
| 673 | 673 | /* IN2 */ |
| 674 | 674 | else if (offset < 0x4b00) |
| 675 | result = | |
| 675 | result = | |
| 676 | 676 | |
| 677 | 677 | /* anything else */ |
| 678 | 678 | else |
| r2375 | r2376 | |
|---|---|---|
| 136 | 136 | switch (offset) |
| 137 | 137 | { |
| 138 | 138 | // player inputs dsw1 dsw2 |
| 139 | case 0: data=readinputport(0) | ((readinputport(4)&0x02)<<5) | ((readinputport(5)&0x01)<<4); break; | |
| 140 | case 1: data=readinputport(1) | ((readinputport(4)&0x01)<<6) | ((readinputport(5)&0x02)<<3); break; | |
| 141 | case 2: data=readinputport(2) | ((readinputport(4)&0x08)<<3) | ((readinputport(5)&0x04)<<2); break; | |
| 142 | case 3: data=readinputport(3) | ((readinputport(4)&0x04)<<4) | ((readinputport(5)&0x08)<<1); break; | |
| 143 | case 4: data= ((readinputport(4)&0x20)<<2) | ((readinputport(5)&0x10)<<1); break; | |
| 144 | case 5: data= ((readinputport(4)&0x10)<<3) | ((readinputport(5)&0x20)<<0); break; | |
| 145 | case 6: data= ((readinputport(4)&0x80)<<0) | ((readinputport(5)&0x40)>>1); break; | |
| 146 | case 7: data= ((readinputport(4)&0x40)<<1) | ((readinputport(5)&0x80)>>2); break; | |
| 139 | case 0: data=input_port_read_indexed(machine, 0) | ((input_port_read_indexed(machine, 4)&0x02)<<5) | ((input_port_read_indexed(machine, 5)&0x01)<<4); break; | |
| 140 | case 1: data=input_port_read_indexed(machine, 1) | ((input_port_read_indexed(machine, 4)&0x01)<<6) | ((input_port_read_indexed(machine, 5)&0x02)<<3); break; | |
| 141 | case 2: data=input_port_read_indexed(machine, 2) | ((input_port_read_indexed(machine, 4)&0x08)<<3) | ((input_port_read_indexed(machine, 5)&0x04)<<2); break; | |
| 142 | case 3: data=input_port_read_indexed(machine, 3) | ((input_port_read_indexed(machine, 4)&0x04)<<4) | ((input_port_read_indexed(machine, 5)&0x08)<<1); break; | |
| 143 | case 4: data= ((input_port_read_indexed(machine, 4)&0x20)<<2) | ((input_port_read_indexed(machine, 5)&0x10)<<1); break; | |
| 144 | case 5: data= ((input_port_read_indexed(machine, 4)&0x10)<<3) | ((input_port_read_indexed(machine, 5)&0x20)<<0); break; | |
| 145 | case 6: data= ((input_port_read_indexed(machine, 4)&0x80)<<0) | ((input_port_read_indexed(machine, 5)&0x40)>>1); break; | |
| 146 | case 7: data= ((input_port_read_indexed(machine, 4)&0x40)<<1) | ((input_port_read_indexed(machine, 5)&0x80)>>2); break; | |
| 147 | 147 | } |
| 148 | 148 | return data; |
| 149 | 149 | } |
| r2375 | r2376 | |
|---|---|---|
| 225 | 225 | } /* ProtectionOut */ |
| 226 | 226 | |
| 227 | 227 | static int |
| 228 | GetLives( | |
| 228 | GetLives( running_machine *machine ) | |
| 229 | 229 | { |
| 230 | int dsw = | |
| 230 | int dsw = | |
| 231 | 231 | switch( dsw&0x30 ) |
| 232 | 232 | { |
| 233 | 233 | case 0x10: return 3; |
| r2375 | r2376 | |
| 240 | 240 | |
| 241 | 241 | static WRITE8_HANDLER( coinplus_w ) |
| 242 | 242 | { |
| 243 | int dsw = | |
| 243 | int dsw = | |
| 244 | 244 | coin_counter_w( 0, data&1 ); |
| 245 | 245 | coin_counter_w( 1, data&2 ); |
| 246 | 246 | if( data&1 ) |
| r2375 | r2376 | |
| 268 | 268 | } /* coinplus_w */ |
| 269 | 269 | |
| 270 | 270 | static void |
| 271 | OutputProtectionState( int i, int type ) | |
| 271 | OutputProtectionState( running_machine *machine, int i, int type ) | |
| 272 | 272 | { |
| 273 | int io = ~ | |
| 273 | int io = ~ | |
| 274 | 274 | int dat = 0x00; |
| 275 | 275 | |
| 276 | 276 | switch( mDjBoyState ) |
| r2375 | r2376 | |
| 337 | 337 | { /* p1 start */ |
| 338 | 338 | dat = 0x16; |
| 339 | 339 | mDjBoyState = eDJBOY_ACTIVE_GAMEPLAY; |
| 340 | lives[0] = GetLives(); | |
| 340 | lives[0] = GetLives(machine); | |
| 341 | 341 | logerror( "P1 START!\n" ); |
| 342 | 342 | coin-=4; |
| 343 | 343 | } |
| r2375 | r2376 | |
| 345 | 345 | { /* p2 start */ |
| 346 | 346 | dat = 0x0a; |
| 347 | 347 | mDjBoyState = eDJBOY_ACTIVE_GAMEPLAY; |
| 348 | lives[0] = GetLives(); | |
| 349 | lives[1] = GetLives(); | |
| 348 | lives[0] = GetLives(machine); | |
| 349 | lives[1] = GetLives(machine); | |
| 350 | 350 | logerror( "P2 START!\n" ); |
| 351 | 351 | coin-=8; |
| 352 | 352 | } |
| r2375 | r2376 | |
| 364 | 364 | if( (io&1) && lives[0]==0 ) |
| 365 | 365 | { |
| 366 | 366 | dat = 0x12; /* continue (P1) */ |
| 367 | lives[0] = GetLives(); | |
| 367 | lives[0] = GetLives(machine); | |
| 368 | 368 | mDjBoyState = eDJBOY_ACTIVE_GAMEPLAY; |
| 369 | 369 | coin-=4; |
| 370 | 370 | logerror( "P1 CONTINUE!\n" ); |
| r2375 | r2376 | |
| 372 | 372 | else if( (io&2) && lives[1]==0 ) |
| 373 | 373 | { |
| 374 | 374 | dat = 0x08; /* continue (P2) */ |
| 375 | lives[1] = GetLives(); | |
| 375 | lives[1] = GetLives(machine); | |
| 376 | 376 | mDjBoyState = eDJBOY_ACTIVE_GAMEPLAY; |
| 377 | 377 | coin-=4; |
| 378 | 378 | logerror( "P2 CONTINUE!\n" ); |
| r2375 | r2376 | |
| 385 | 385 | } /* OutputProtectionState */ |
| 386 | 386 | |
| 387 | 387 | static void |
| 388 | CommonProt( int i, int type ) | |
| 388 | CommonProt( running_machine *machine, int i, int type ) | |
| 389 | 389 | { |
| 390 | 390 | int displayedCredits = coin/4; |
| 391 | 391 | if( displayedCredits>9 ) |
| r2375 | r2376 | |
| 393 | 393 | displayedCredits = 9; |
| 394 | 394 | } |
| 395 | 395 | ProtectionOut( i++, displayedCredits ); |
| 396 | ProtectionOut( i++, readinputport(0) ); /* COIN/START */ | |
| 397 | OutputProtectionState( i, type ); | |
| 396 | ProtectionOut( i++, input_port_read_indexed(machine, 0) ); /* COIN/START */ | |
| 397 | OutputProtectionState( machine, i, type ); | |
| 398 | 398 | } /* CommonProt */ |
| 399 | 399 | |
| 400 | 400 | static WRITE8_HANDLER( beast_data_w ) |
| r2375 | r2376 | |
| 408 | 408 | if( prot_mode == ePROT_WAIT_DSW1_WRITEBACK ) |
| 409 | 409 | { |
| 410 | 410 | logerror( "[DSW1_WRITEBACK]\n" ); |
| 411 | ProtectionOut( 0, | |
| 411 | ProtectionOut( 0, | |
| 412 | 412 | prot_mode = ePROT_WAIT_DSW2_WRITEBACK; |
| 413 | 413 | } |
| 414 | 414 | else if( prot_mode == ePROT_WAIT_DSW2_WRITEBACK ) |
| r2375 | r2376 | |
| 454 | 454 | break; |
| 455 | 455 | |
| 456 | 456 | case 0x01: // pc=7389 |
| 457 | OutputProtectionState( 0, 0x01 ); | |
| 457 | OutputProtectionState( machine, 0, 0x01 ); | |
| 458 | 458 | break; |
| 459 | 459 | |
| 460 | 460 | case 0x02: |
| 461 | CommonProt( 0,0x02 ); | |
| 461 | CommonProt( machine,0,0x02 ); | |
| 462 | 462 | break; |
| 463 | 463 | |
| 464 | 464 | case 0x03: /* prepare for memory write to protection device ram (pc == 0x7987) */ // -> 0x02 |
| r2375 | r2376 | |
| 472 | 472 | ProtectionOut( 1,0 ); // ? |
| 473 | 473 | ProtectionOut( 2,0 ); // ? |
| 474 | 474 | ProtectionOut( 3,0 ); // ? |
| 475 | CommonProt( 4,0x04 ); | |
| 475 | CommonProt( machine, 4,0x04 ); | |
| 476 | 476 | break; |
| 477 | 477 | |
| 478 | 478 | case 0x05: /* 0x71f4 */ |
| 479 | ProtectionOut( 0, | |
| 479 | ProtectionOut( 0, | |
| 480 | 480 | ProtectionOut( 1,0 ); // ? |
| 481 | ProtectionOut( 2, | |
| 481 | ProtectionOut( 2, | |
| 482 | 482 | ProtectionOut( 3,0 ); // ? |
| 483 | 483 | ProtectionOut( 4,0 ); // ? |
| 484 | CommonProt( 5,0x05 ); | |
| 484 | CommonProt( machine, 5,0x05 ); | |
| 485 | 485 | break; |
| 486 | 486 | |
| 487 | 487 | case 0x07: |
| 488 | CommonProt( 0,0x07 ); | |
| 488 | CommonProt( machine, 0,0x07 ); | |
| 489 | 489 | break; |
| 490 | 490 | |
| 491 | 491 | case 0x08: /* pc == 0x727a */ |
| 492 | ProtectionOut( 0,readinputport(0) ); /* COIN/START */ | |
| 493 | ProtectionOut( 1,readinputport(1) ); /* JOY1 */ | |
| 494 | ProtectionOut( 2,readinputport(2) ); /* JOY2 */ | |
| 495 | ProtectionOut( 3,readinputport(3) ); /* DSW1 */ | |
| 496 | ProtectionOut( 4,readinputport(4) ); /* DSW2 */ | |
| 497 | CommonProt( 5, 0x08 ); | |
| 492 | ProtectionOut( 0,input_port_read_indexed(machine, 0) ); /* COIN/START */ | |
| 493 | ProtectionOut( 1,input_port_read_indexed(machine, 1) ); /* JOY1 */ | |
| 494 | ProtectionOut( 2,input_port_read_indexed(machine, 2) ); /* JOY2 */ | |
| 495 | ProtectionOut( 3,input_port_read_indexed(machine, 3) ); /* DSW1 */ | |
| 496 | ProtectionOut( 4,input_port_read_indexed(machine, 4) ); /* DSW2 */ | |
| 497 | CommonProt( machine, 5, 0x08 ); | |
| 498 | 498 | break; |
| 499 | 499 | |
| 500 | 500 | case 0x09: |
| 501 | 501 | ProtectionOut( 0,0 ); // ? |
| 502 | 502 | ProtectionOut( 1,0 ); // ? |
| 503 | 503 | ProtectionOut( 2,0 ); // ? |
| 504 | CommonProt( 3, 0x09 ); | |
| 504 | CommonProt( machine, 3, 0x09 ); | |
| 505 | 505 | break; |
| 506 | 506 | |
| 507 | 507 | case 0x0a: |
| 508 | CommonProt( 0,0x0a ); | |
| 508 | CommonProt( machine,0,0x0a ); | |
| 509 | 509 | break; |
| 510 | 510 | |
| 511 | 511 | case 0x0c: |
| 512 | CommonProt( 1,0x0c ); | |
| 512 | CommonProt( machine,1,0x0c ); | |
| 513 | 513 | break; |
| 514 | 514 | |
| 515 | 515 | case 0x0d: |
| 516 | CommonProt( 2,0x0d ); | |
| 516 | CommonProt( machine,2,0x0d ); | |
| 517 | 517 | break; |
| 518 | 518 | |
| 519 | 519 | case 0xfe: /* prepare for memory read from protection device ram (pc == 0x79ee, 0x7a3f) */ |
| r2375 | r2376 | |
| 531 | 531 | break; |
| 532 | 532 | |
| 533 | 533 | case 0xff: /* read DSW (pc == 0x714d) */ |
| 534 | ProtectionOut( 0, | |
| 534 | ProtectionOut( 0, | |
| 535 | 535 | prot_mode = ePROT_WAIT_DSW1_WRITEBACK; |
| 536 | 536 | break; |
| 537 | 537 |
| r2375 | r2376 | |
|---|---|---|
| 79 | 79 | |
| 80 | 80 | res = 0; |
| 81 | 81 | for (i = 0;i < 8;i++) |
| 82 | res |= (( | |
| 82 | res |= (( | |
| 83 | 83 | |
| 84 | 84 | return res; |
| 85 | 85 | } |
| r2375 | r2376 | |
|---|---|---|
| 332 | 332 | switch (offset) |
| 333 | 333 | { |
| 334 | 334 | case 0x00: |
| 335 | return | |
| 335 | return | |
| 336 | 336 | case 0x01: |
| 337 | return ( | |
| 337 | return ( | |
| 338 | 338 | case 0x02: |
| 339 | return | |
| 339 | return | |
| 340 | 340 | case 0x03: |
| 341 | return ( | |
| 341 | return ( | |
| 342 | 342 | default: |
| 343 | 343 | logerror("taitox unknown dsw read offset: %04x\n", offset); |
| 344 | 344 | return 0x00; |
| r2375 | r2376 | |
| 350 | 350 | switch (offset) |
| 351 | 351 | { |
| 352 | 352 | case 0x00: |
| 353 | return | |
| 353 | return | |
| 354 | 354 | case 0x01: |
| 355 | return | |
| 355 | return | |
| 356 | 356 | case 0x02: |
| 357 | return | |
| 357 | return | |
| 358 | 358 | |
| 359 | 359 | default: |
| 360 | 360 | logerror("taitox unknown input read offset: %04x\n", offset); |
| r2375 | r2376 | |
| 995 | 995 | irqhandler |
| 996 | 996 | }; |
| 997 | 997 | |
| 998 | static STATE_POSTLOAD( taitox_postload ) | |
| 999 | { | |
| 1000 | reset_sound_region(); | |
| 1001 | } | |
| 998 | 1002 | |
| 999 | 1003 | static MACHINE_START( taitox ) |
| 1000 | 1004 | { |
| 1001 | 1005 | state_save_register_global(banknum); |
| 1002 | state_save_register_ | |
| 1006 | state_save_register_ | |
| 1003 | 1007 | } |
| 1004 | 1008 | |
| 1005 | 1009 | /**************************************************************************/ |
| r2375 | r2376 | |
|---|---|---|
| 89 | 89 | |
| 90 | 90 | static READ8_HANDLER( joinem_input1_r ) |
| 91 | 91 | { |
| 92 | UINT8 ret = | |
| 92 | UINT8 ret = | |
| 93 | 93 | |
| 94 | if(( | |
| 94 | if(( | |
| 95 | 95 | ret |= 0x20; |
| 96 | 96 | |
| 97 | 97 | return ret; |
| r2375 | r2376 | |
| 918 | 918 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 919 | 919 | else |
| 920 | 920 | { |
| 921 | if(!( | |
| 921 | if(!( | |
| 922 | 922 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 923 | 923 | } |
| 924 | 924 | } |
| r2375 | r2376 | |
|---|---|---|
| 91 | 91 | switch (offset<<1) |
| 92 | 92 | { |
| 93 | 93 | case 0: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 94 | return ( | |
| 94 | return ( | |
| 95 | 95 | case 2: /* Dips */ |
| 96 | return ( | |
| 96 | return ( | |
| 97 | 97 | case 8: /* Credits */ |
| 98 | return | |
| 98 | return | |
| 99 | 99 | case 10: /* ? */ |
| 100 | 100 | case 12: |
| 101 | 101 | return 0; |
| r2375 | r2376 | |
|---|---|---|
| 337 | 337 | port_tag = "GEARP2"; |
| 338 | 338 | |
| 339 | 339 | /* gear MUST be 1, 2 or 3 */ |
| 340 | if (readinputportbytag(port_tag) & 0x01) kikstart_gears[player] = 0x02; | |
| 341 | if (readinputportbytag(port_tag) & 0x02) kikstart_gears[player] = 0x03; | |
| 342 | if (readinputportbytag(port_tag) & 0x04) kikstart_gears[player] = 0x01; | |
| 340 | if (input_port_read(machine, port_tag) & 0x01) kikstart_gears[player] = 0x02; | |
| 341 | if (input_port_read(machine, port_tag) & 0x02) kikstart_gears[player] = 0x03; | |
| 342 | if (input_port_read(machine, port_tag) & 0x04) kikstart_gears[player] = 0x01; | |
| 343 | 343 | |
| 344 | 344 | return kikstart_gears[player]; |
| 345 | 345 | } |
| r2375 | r2376 | |
| 552 | 552 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) |
| 553 | 553 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 554 | 554 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 555 | PORT_DIPNAME( 0x18, 0x | |
| 555 | PORT_DIPNAME( 0x18, 0x00, DEF_STR( Lives ) ) | |
| 556 | 556 | PORT_DIPSETTING( 0x00, "3" ) |
| 557 | 557 | PORT_DIPSETTING( 0x08, "4" ) |
| 558 | 558 | PORT_DIPSETTING( 0x10, "5" ) |
| r2375 | r2376 | |
| 561 | 561 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 562 | 562 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 563 | 563 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 564 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) ) | |
| 565 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 566 | PORT_DIPSETTING( 0x80, DEF_STR( Cocktail ) ) | |
| 564 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) ) | |
| 565 | PORT_DIPSETTING( 0x80, DEF_STR( Upright ) ) | |
| 566 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) | |
| 567 | 567 | |
| 568 | 568 | PORT_START_TAG("DSW2") /* Coinage */ |
| 569 | 569 | DSW2_PORT |
| r2375 | r2376 | |
| 2647 | 2647 | state_save_register_global(dac_vol); |
| 2648 | 2648 | } |
| 2649 | 2649 | |
| 2650 | GAME( 1981, spaceskr, 0, nomcu, spaceskr, 0, ROT | |
| 2650 | GAME( 1981, spaceskr, 0, nomcu, spaceskr, 0, ROT | |
| 2651 | 2651 | GAME( 1981, spacecr, 0, nomcu, spacecr, spacecr, ROT90, "Taito Corporation", "Space Cruiser", GAME_SUPPORTS_SAVE ) |
| 2652 | 2652 | GAME( 1982, junglek, 0, nomcu, junglek, 0, ROT180, "Taito Corporation", "Jungle King (Japan)", GAME_SUPPORTS_SAVE ) |
| 2653 | 2653 | GAME( 1982, junglkj2, junglek, nomcu, junglek, 0, ROT180, "Taito Corporation", "Jungle King (Japan, earlier)", GAME_SUPPORTS_SAVE ) |
| r2375 | r2376 | |
|---|---|---|
| 64 | 64 | { |
| 65 | 65 | UINT8 val = 0; |
| 66 | 66 | |
| 67 | if (( | |
| 67 | if (( | |
| 68 | 68 | { |
| 69 | 69 | val |= 0x80; |
| 70 | 70 | } |
| 71 | if (( | |
| 71 | if (( | |
| 72 | 72 | { |
| 73 | 73 | val |= 0x01; |
| 74 | 74 | } |
| r2375 | r2376 | |
| 79 | 79 | |
| 80 | 80 | static READ8_HANDLER( canyon_options_r ) |
| 81 | 81 | { |
| 82 | return ( | |
| 82 | return ( | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 |
| r2375 | r2376 | |
|---|---|---|
| 220 | 220 | |
| 221 | 221 | static INTERRUPT_GEN( ettrivia_interrupt ) |
| 222 | 222 | { |
| 223 | if( | |
| 223 | if( | |
| 224 | 224 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 225 | 225 | else |
| 226 | 226 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| r2375 | r2376 | |
|---|---|---|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | #define MCU_READ(_number_,_bit_,_offset_,_retval_)\ |
| 198 | if((0xffff - | |
| 198 | if((0xffff - | |
| 199 | 199 | |
| 200 | 200 | /*RAM-based protection handlings*/ |
| 201 | 201 | static void daireika_mcu_run(running_machine *machine) |
| r2375 | r2376 | |
|---|---|---|
| 136 | 136 | |
| 137 | 137 | static READ8_HANDLER( payout_r ) |
| 138 | 138 | { |
| 139 | result = | |
| 139 | result = | |
| 140 | 140 | |
| 141 | 141 | if (payout) |
| 142 | 142 | { |
| r2375 | r2376 | |
|---|---|---|
| 174 | 174 | |
| 175 | 175 | switch (ttmahjng_port_select) |
| 176 | 176 | { |
| 177 | case 1: ret = readinputport(2); break; | |
| 178 | case 2: ret = readinputport(3); break; | |
| 179 | case 4: ret = readinputport(4); break; | |
| 180 | case 8: ret = readinputport(5); break; | |
| 177 | case 1: ret = input_port_read_indexed(machine, 2); break; | |
| 178 | case 2: ret = input_port_read_indexed(machine, 3); break; | |
| 179 | case 4: ret = input_port_read_indexed(machine, 4); break; | |
| 180 | case 8: ret = input_port_read_indexed(machine, 5); break; | |
| 181 | 181 | default: break; |
| 182 | 182 | } |
| 183 | 183 |
| r2375 | r2376 | |
|---|---|---|
| 148 | 148 | { |
| 149 | 149 | static int last = 0; |
| 150 | 150 | |
| 151 | if ( | |
| 151 | if ( | |
| 152 | 152 | last = 0; |
| 153 | 153 | else |
| 154 | 154 | { |
| r2375 | r2376 | |
|---|---|---|
| 290 | 290 | static CUSTOM_INPUT( hitnmiss_button1_r ) |
| 291 | 291 | { |
| 292 | 292 | /* button 1 shows up in two bits */ |
| 293 | UINT32 button1 = | |
| 293 | UINT32 button1 = | |
| 294 | 294 | return (button1 << 1) | button1; |
| 295 | 295 | } |
| 296 | 296 | |
| r2375 | r2376 | |
| 343 | 343 | { |
| 344 | 344 | /* I/O1 accesses clear the CIRQ flip/flop */ |
| 345 | 345 | cpunum_set_input_line(machine, 0, 0, CLEAR_LINE); |
| 346 | return | |
| 346 | return | |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 |
| r2375 | r2376 | |
|---|---|---|
| 389 | 389 | |
| 390 | 390 | static READ16_HANDLER( dipswitches_r ) |
| 391 | 391 | { |
| 392 | return ( | |
| 392 | return ( | |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | /* |
| r2375 | r2376 | |
| 448 | 448 | |
| 449 | 449 | static WRITE8_HANDLER( tx1_ppi_latch_w ) |
| 450 | 450 | { |
| 451 | tx1_ppi_latch_a = ((readinputportbytag("AN_BRAKE") & 0xf) << 4) | (readinputportbytag("AN_ACCELERATOR") & 0xf); | |
| 452 | tx1_ppi_latch_b = readinputportbytag("AN_STEERING"); | |
| 451 | tx1_ppi_latch_a = ((input_port_read(machine, "AN_BRAKE") & 0xf) << 4) | (input_port_read(machine, "AN_ACCELERATOR") & 0xf); | |
| 452 | tx1_ppi_latch_b = input_port_read(machine, "AN_STEERING"); | |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | static READ8_HANDLER( tx1_ppi_porta_r ) |
| r2375 | r2376 | |
| 459 | 459 | |
| 460 | 460 | static READ8_HANDLER( tx1_ppi_portb_r ) |
| 461 | 461 | { |
| 462 | return | |
| 462 | return | |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | static ADDRESS_MAP_START( tx1_sound_prg, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2375 | r2376 | |
| 535 | 535 | { |
| 536 | 536 | if ( offset == 1 ) |
| 537 | 537 | { |
| 538 | return (( | |
| 538 | return (( | |
| 539 | 539 | } |
| 540 | 540 | else |
| 541 | 541 | { |
| 542 | return ( | |
| 542 | return ( | |
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | |
| r2375 | r2376 | |
| 547 | 547 | { |
| 548 | 548 | if ( offset == 0 ) |
| 549 | 549 | { |
| 550 | return (( | |
| 550 | return (( | |
| 551 | 551 | } |
| 552 | 552 | else |
| 553 | 553 | { |
| 554 | return ( | |
| 554 | return ( | |
| 555 | 555 | } |
| 556 | 556 | } |
| 557 | 557 |
| r2375 | r2376 | |
|---|---|---|
| 138 | 138 | switch (offset<<1) |
| 139 | 139 | { |
| 140 | 140 | case 0: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 141 | return ( | |
| 141 | return ( | |
| 142 | 142 | |
| 143 | 143 | case 2: /* Player 3 & Player 4 joysticks & fire buttons */ |
| 144 | return ( | |
| 144 | return ( | |
| 145 | 145 | |
| 146 | 146 | case 4: /* Dip 1 (stored at 0x3f8035) */ |
| 147 | return | |
| 147 | return | |
| 148 | 148 | |
| 149 | 149 | case 6: /* Dip 2 (stored at 0x3f8034) */ |
| 150 | return | |
| 150 | return | |
| 151 | 151 | |
| 152 | 152 | case 8: /* VBL, Credits */ |
| 153 | return | |
| 153 | return | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | return 0xffff; |
| r2375 | r2376 | |
| 165 | 165 | |
| 166 | 166 | static READ16_HANDLER( dassault_sub_control_r ) |
| 167 | 167 | { |
| 168 | return | |
| 168 | return | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | static WRITE16_HANDLER( dassault_sound_w ) |
| r2375 | r2376 | |
|---|---|---|
| 56 | 56 | |
| 57 | 57 | static READ8_HANDLER(ssrj_wheel_r) |
| 58 | 58 | { |
| 59 | int port= input_port_ | |
| 59 | int port= input_port_ | |
| 60 | 60 | int retval=port-oldport; |
| 61 | 61 | oldport=port; |
| 62 | 62 | return retval; |
| r2375 | r2376 | |
|---|---|---|
| 72 | 72 | |
| 73 | 73 | static READ16_HANDLER( inputs_r ) |
| 74 | 74 | { |
| 75 | int temp = | |
| 75 | int temp = | |
| 76 | 76 | if (atarigen_cpu_to_sound_ready) temp ^= 0x0040; |
| 77 | 77 | if (atarigen_get_hblank(machine->primary_screen)) temp ^= 0x0010; |
| 78 | 78 | return temp; |
| r2375 | r2376 | |
|---|---|---|
| 162 | 162 | static READ16_HANDLER(cyclwarr_palette_r) { return paletteram16[offset]; } |
| 163 | 163 | static READ16_HANDLER(cyclwarr_sprite_r) { return spriteram16[offset]; } |
| 164 | 164 | static WRITE16_HANDLER(cyclwarr_sprite_w) { COMBINE_DATA(&spriteram16[offset]); } |
| 165 | static READ16_HANDLER(cyclwarr_input_r) { return readinputport(offset); } | |
| 166 | static READ16_HANDLER(cyclwarr_input2_r) { return readinputport(offset+4); } | |
| 165 | static READ16_HANDLER(cyclwarr_input_r) { return input_port_read_indexed(machine, offset); } | |
| 166 | static READ16_HANDLER(cyclwarr_input2_r) { return input_port_read_indexed(machine, offset+4); } | |
| 167 | 167 | static WRITE16_HANDLER(bigfight_a20000_w) { COMBINE_DATA(&bigfight_a20000[offset]); } |
| 168 | 168 | static WRITE16_HANDLER(bigfight_a40000_w) { COMBINE_DATA(&bigfight_a40000[offset]); } |
| 169 | 169 | static WRITE16_HANDLER(bigfight_a60000_w) { COMBINE_DATA(&bigfight_a60000[offset]); } |
| r2375 | r2376 | |
|---|---|---|
| 37 | 37 | switch (offset<<1) |
| 38 | 38 | { |
| 39 | 39 | case 0: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 40 | return ( | |
| 40 | return ( | |
| 41 | 41 | case 2: /* Dips */ |
| 42 | return ( | |
| 42 | return ( | |
| 43 | 43 | case 8: /* Credits */ |
| 44 | return | |
| 44 | return | |
| 45 | 45 | case 10: /* ? Not used for anything */ |
| 46 | 46 | case 12: |
| 47 | 47 | return 0; |
| r2375 | r2376 | |
|---|---|---|
| 77 | 77 | static WRITE16_HANDLER( blmbycar_pot_wheel_reset_w ) |
| 78 | 78 | { |
| 79 | 79 | if (ACCESSING_BITS_0_7) |
| 80 | pot_wheel = ~ | |
| 80 | pot_wheel = ~ | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | static WRITE16_HANDLER( blmbycar_pot_wheel_shift_w ) |
| r2375 | r2376 | |
| 102 | 102 | |
| 103 | 103 | static READ16_HANDLER( blmbycar_opt_wheel_r ) |
| 104 | 104 | { |
| 105 | return (~ | |
| 105 | return (~ | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 |
| r2375 | r2376 | |
|---|---|---|
| 39 | 39 | static READ8_HANDLER( port_b_u3_r ) |
| 40 | 40 | { |
| 41 | 41 | logerror("%04x: read DIP\n",activecpu_get_pc()); |
| 42 | return | |
| 42 | return | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 |
| r2375 | r2376 | |
|---|---|---|
| 136 | 136 | PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) \ |
| 137 | 137 | PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) \ |
| 138 | 138 | PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 139 | PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_START1 ) \ | |
| 140 | PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_START2 ) | |
| 139 | PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ | |
| 140 | PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 141 | 141 | |
| 142 | /* Caused 01081: | |
| 143 | * PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_START1 ) \ | |
| 144 | * PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_START2 ) | |
| 145 | */ | |
| 146 | ||
| 142 | 147 | #define MEGAPLAY_DSWA \ |
| 143 | 148 | PORT_START \ |
| 144 | 149 | PORT_DIPNAME( 0x0f, 0x0f, "Coin slot 1" ) PORT_DIPLOCATION("SW1:1,2,3,4") \ |
| r2375 | r2376 | |
| 878 | 883 | case 1: /* port A data (joypad 1) */ |
| 879 | 884 | |
| 880 | 885 | if (genesis_io_ram[offset] & 0x40) |
| 881 | return_value = | |
| 886 | return_value = | |
| 882 | 887 | else |
| 883 | 888 | { |
| 884 | return_value = readinputport(2) & (genesis_io_ram[4]^0xff); | |
| 885 | return_value |= readinputport(1) & 0x03; | |
| 889 | return_value = input_port_read_indexed(machine, 2) & (genesis_io_ram[4]^0xff); | |
| 890 | return_value |= input_port_read_indexed(machine, 1) & 0x03; | |
| 886 | 891 | } |
| 887 | 892 | return_value = (genesis_io_ram[offset] & 0x80) | return_value; |
| 888 | 893 | // logerror ("reading joypad 1 , type %02x %02x\n",genesis_io_ram[offset] & 0xb0, return_value &0x7f); |
| r2375 | r2376 | |
| 891 | 896 | case 2: /* port B data (joypad 2) */ |
| 892 | 897 | |
| 893 | 898 | if (genesis_io_ram[offset] & 0x40) |
| 894 | return_value = | |
| 899 | return_value = | |
| 895 | 900 | else |
| 896 | 901 | { |
| 897 | return_value = readinputport(4) & (genesis_io_ram[5]^0xff); | |
| 898 | return_value |= readinputport(3) & 0x03; | |
| 902 | return_value = input_port_read_indexed(machine, 4) & (genesis_io_ram[5]^0xff); | |
| 903 | return_value |= input_port_read_indexed(machine, 3) & 0x03; | |
| 899 | 904 | } |
| 900 | 905 | return_value = (genesis_io_ram[offset] & 0x80) | return_value; |
| 901 | 906 | // logerror ("reading joypad 2 , type %02x %02x\n",genesis_io_ram[offset] & 0xb0, return_value &0x7f); |
| r2375 | r2376 | |
|---|---|---|
| 304 | 304 | |
| 305 | 305 | for (t = 0 ; t < 8 ; t ++) |
| 306 | 306 | { |
| 307 | if (!( | |
| 307 | if (!( | |
| 308 | 308 | { |
| 309 | 309 | return (i + t); |
| 310 | 310 | } |
| r2375 | r2376 | |
| 313 | 313 | } |
| 314 | 314 | else /* Analizer and memory reset keys */ |
| 315 | 315 | { |
| 316 | return | |
| 316 | return | |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | return 0xffff; |
| r2375 | r2376 | |
| 527 | 527 | |
| 528 | 528 | for (t = 0 ; t < 8 ; t ++) |
| 529 | 529 | { |
| 530 | if (!( | |
| 530 | if (!( | |
| 531 | 531 | { |
| 532 | 532 | keydata = (i + t); |
| 533 | 533 | } |
| r2375 | r2376 | |
| 540 | 540 | |
| 541 | 541 | if ((activecpu_get_pc() == 0x8926) || (activecpu_get_pc() == 0x7822)) /* Analizer and memory reset keys */ |
| 542 | 542 | { |
| 543 | keydata = | |
| 543 | keydata = | |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | return keydata; |
| r2375 | r2376 | |
|---|---|---|
| 617 | 617 | |
| 618 | 618 | for (i = 0;i < 4;i++) |
| 619 | 619 | { |
| 620 | curr = | |
| 620 | curr = | |
| 621 | 621 | diff[i] = (curr - prev[i]); |
| 622 | 622 | prev[i] = curr; |
| 623 | 623 | } |
| r2375 | r2376 | |
| 629 | 629 | case 0: |
| 630 | 630 | return (diff[0] & 0xff) | ((diff[2] & 0xff) << 8); |
| 631 | 631 | case 1: |
| 632 | return ((diff[0] >> 8) & 0x1f) | (diff[2] & 0x1f00) | ( | |
| 632 | return ((diff[0] >> 8) & 0x1f) | (diff[2] & 0x1f00) | ( | |
| 633 | 633 | case 2: |
| 634 | 634 | return (diff[1] & 0xff) | ((diff[3] & 0xff) << 8); |
| 635 | 635 | case 3: |
| r2375 | r2376 | |
|---|---|---|
| 78 | 78 | |
| 79 | 79 | static READ16_HANDLER( control_1_r ) |
| 80 | 80 | { |
| 81 | return ( | |
| 81 | return ( | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | static READ16_HANDLER( control_2_r ) |
| 85 | 85 | { |
| 86 | return | |
| 86 | return | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | static READ16_HANDLER( dip_1_r ) |
| 90 | 90 | { |
| 91 | return | |
| 91 | return | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | static READ16_HANDLER( dip_2_r ) |
| 95 | 95 | { |
| 96 | return | |
| 96 | return | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | static READ16_HANDLER( rotary_1_r ) |
| 100 | 100 | { |
| 101 | return (( ~(1 << | |
| 101 | return (( ~(1 << | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | static READ16_HANDLER( rotary_2_r ) |
| 105 | 105 | { |
| 106 | return (( ~(1 << | |
| 106 | return (( ~(1 << | |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | static READ16_HANDLER( rotary_lsb_r ) |
| 110 | 110 | { |
| 111 | return ((( ~(1 << readinputportbytag("ROT2")) ) <<4)&0xf000) | |
| 112 | + ((( ~(1 << readinputportbytag("ROT1")) ) )&0x0f00); | |
| 111 | return ((( ~(1 << input_port_read(machine, "ROT2")) ) <<4)&0xf000) | |
| 112 | + ((( ~(1 << input_port_read(machine, "ROT1")) ) )&0x0f00); | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | static READ16_HANDLER( protcontrols_r ) |
| 116 | 116 | { |
| 117 | return | |
| 117 | return | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | static WRITE16_HANDLER( protection_w ) |
| r2375 | r2376 | |
|---|---|---|
| 313 | 313 | |
| 314 | 314 | static DRIVER_INIT( konamigv ) |
| 315 | 315 | { |
| 316 | psx_driver_init(); | |
| 316 | psx_driver_init(machine); | |
| 317 | 317 | |
| 318 | 318 | /* init the scsi controller and hook up it's DMA */ |
| 319 | 319 | am53cf96_init(&scsi_intf); |
| r2375 | r2376 | |
| 525 | 525 | |
| 526 | 526 | for( axis = 0; axis < 2; axis++ ) |
| 527 | 527 | { |
| 528 | value = | |
| 528 | value = | |
| 529 | 529 | diff = value - trackball_prev[ axis ]; |
| 530 | 530 | trackball_prev[ axis ] = value; |
| 531 | 531 | trackball_data[ axis ] = ( ( diff & 0xf00 ) << 16 ) | ( ( diff & 0xff ) << 8 ); |
| r2375 | r2376 | |
| 610 | 610 | |
| 611 | 611 | for( axis = 0; axis < 4; axis++ ) |
| 612 | 612 | { |
| 613 | value = | |
| 613 | value = | |
| 614 | 614 | diff = value - btc_trackball_prev[ axis ]; |
| 615 | 615 | btc_trackball_prev[ axis ] = value; |
| 616 | 616 | btc_trackball_data[ axis ] = ( ( diff & 0xf00 ) << 16 ) | ( ( diff & 0xff ) << 8 ); |
| r2375 | r2376 | |
|---|---|---|
| 101 | 101 | /* Check for coin insertion */ |
| 102 | 102 | /* the following only works in the bootleg version, which doesn't have an */ |
| 103 | 103 | /* 8751 - the real thing is much more complicated than that. */ |
| 104 | if (( | |
| 104 | if (( | |
| 105 | 105 | return 0; |
| 106 | 106 | } |
| 107 | 107 | |
| r2375 | r2376 | |
| 545 | 545 | |
| 546 | 546 | /* Check for coin IRQ */ |
| 547 | 547 | if (cpu_getiloops()) { |
| 548 | if ((readinputport(5) & 0x7) != 0x7 && !latch) { | |
| 549 | coin_command_pending=~readinputport(5); | |
| 548 | if ((input_port_read_indexed(machine, 5) & 0x7) != 0x7 && !latch) { | |
| 549 | coin_command_pending=~input_port_read_indexed(machine, 5); | |
| 550 | 550 | latch=1; |
| 551 | 551 | } |
| 552 | if (( | |
| 552 | if (( | |
| 553 | 553 | latch=0; |
| 554 | 554 | |
| 555 | 555 | /* Make sure coin IRQ's aren't generated when another command is pending, the main cpu |
| r2375 | r2376 | |
|---|---|---|
| 81 | 81 | |
| 82 | 82 | static READ8_HANDLER( switch_input_r ) |
| 83 | 83 | { |
| 84 | return | |
| 84 | return | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | static READ8_HANDLER( analog_input_r ) |
| 89 | 89 | { |
| 90 | return (( | |
| 90 | return (( | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 |
| r2375 | r2376 | |
|---|---|---|
| 338 | 338 | { |
| 339 | 339 | if (protection_command != 0x59) |
| 340 | 340 | { |
| 341 | int coins = | |
| 341 | int coins = | |
| 342 | 342 | if (coins & 1) protection_data = 1; |
| 343 | 343 | else if (coins & 2) protection_data = 2; |
| 344 | 344 | else if (coins & 4) protection_data = 3; |
| r2375 | r2376 | |
|---|---|---|
| 54 | 54 | |
| 55 | 55 | static READ16_HANDLER( oneshot_in0_word_r ) |
| 56 | 56 | { |
| 57 | int data = | |
| 57 | int data = | |
| 58 | 58 | |
| 59 | 59 | switch (data & 0x0c) |
| 60 | 60 | { |
| r2375 | r2376 | |
|---|---|---|
| 86 | 86 | |
| 87 | 87 | static READ16_HANDLER( stlforce_input_port_1_r ) |
| 88 | 88 | { |
| 89 | return ( | |
| 89 | return ( | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | static WRITE16_HANDLER( eeprom_w ) |
| r2375 | r2376 | |
|---|---|---|
| 87 | 87 | |
| 88 | 88 | for (i = 0;i < 31;i++) |
| 89 | 89 | { |
| 90 | if ( | |
| 90 | if ( | |
| 91 | 91 | } |
| 92 | if ( | |
| 92 | if ( | |
| 93 | 93 | return 0; |
| 94 | 94 | } |
| 95 | 95 | case 0x5c7b: // rmhaihai, rmhaisei, rmhaijin |
| r2375 | r2376 | |
|---|---|---|
| 332 | 332 | { |
| 333 | 333 | UINT8 port = TC0220IOC_port_r(machine,0); /* read port number */ |
| 334 | 334 | int steer = 0; |
| 335 | int analogue_steer = readinputportbytag_safe(STEER_PORT_TAG,0x00); | |
| 336 | int fake = readinputportbytag_safe(FAKE_PORT_TAG,0x00); | |
| 335 | int analogue_steer = input_port_read_safe(machine, STEER_PORT_TAG,0x00); | |
| 336 | int fake = input_port_read_safe(machine, FAKE_PORT_TAG,0x00); | |
| 337 | 337 | |
| 338 | 338 | if (!(fake & 0x10)) /* Analogue steer (the real control method) */ |
| 339 | 339 | { |
| r2375 | r2376 | |
| 679 | 679 | MACHINE DRIVERS |
| 680 | 680 | ***********************************************************/ |
| 681 | 681 | |
| 682 | static STATE_POSTLOAD( topspeed_postload ) | |
| 683 | { | |
| 684 | parse_control(); | |
| 685 | reset_sound_region(); | |
| 686 | } | |
| 687 | ||
| 682 | 688 | static MACHINE_START( topspeed ) |
| 683 | 689 | { |
| 684 | 690 | state_save_register_global(cpua_ctrl); |
| 685 | state_save_register_func_postload(parse_control); | |
| 686 | ||
| 687 | 691 | state_save_register_global(ioc220_port); |
| 688 | ||
| 689 | 692 | state_save_register_global(banknum); |
| 690 | state_save_register_ | |
| 693 | state_save_register_ | |
| 691 | 694 | } |
| 692 | 695 | |
| 693 | 696 | static MACHINE_DRIVER_START( topspeed ) |
| r2375 | r2376 | |
|---|---|---|
| 171 | 171 | { |
| 172 | 172 | if (ACCESSING_BITS_24_31) |
| 173 | 173 | { |
| 174 | r |= | |
| 174 | r |= | |
| 175 | 175 | } |
| 176 | 176 | if (ACCESSING_BITS_16_23) |
| 177 | 177 | { |
| 178 | r |= | |
| 178 | r |= | |
| 179 | 179 | } |
| 180 | 180 | if (ACCESSING_BITS_8_15) |
| 181 | 181 | { |
| 182 | 182 | int adc_bit = adc083x_do_read(0); |
| 183 | r |= (( | |
| 183 | r |= (( | |
| 184 | 184 | } |
| 185 | 185 | if (ACCESSING_BITS_0_7) |
| 186 | 186 | { |
| 187 | r |= | |
| 187 | r |= | |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | else if (offset == 1) |
| r2375 | r2376 | |
| 249 | 249 | switch (input) |
| 250 | 250 | { |
| 251 | 251 | case ADC083X_CH0: |
| 252 | return (double)(5 * | |
| 252 | return (double)(5 * | |
| 253 | 253 | case ADC083X_CH1: |
| 254 | return (double)(5 * | |
| 254 | return (double)(5 * | |
| 255 | 255 | case ADC083X_CH2: |
| 256 | return (double)(5 * | |
| 256 | return (double)(5 * | |
| 257 | 257 | case ADC083X_CH3: |
| 258 | 258 | return 0; |
| 259 | 259 | case ADC083X_COM: |
| r2375 | r2376 | |
|---|---|---|
| 47 | 47 | static READ8_HANDLER( amspdwy_wheel_##_n_##_r ) \ |
| 48 | 48 | { \ |
| 49 | 49 | static UINT8 wheel_old, ret; \ |
| 50 | UINT8 wheel = | |
| 50 | UINT8 wheel = | |
| 51 | 51 | if (wheel != wheel_old) \ |
| 52 | 52 | { \ |
| 53 | 53 | wheel = (wheel & 0x7fff) - (wheel & 0x8000); \ |
| r2375 | r2376 | |
| 55 | 55 | else ret = ((-wheel) & 0xf) | 0x10; \ |
| 56 | 56 | wheel_old = wheel; \ |
| 57 | 57 | } \ |
| 58 | return ret | | |
| 58 | return ret | | |
| 59 | 59 | } |
| 60 | 60 | AMSPDWY_WHEEL_R( 0 ) |
| 61 | 61 | AMSPDWY_WHEEL_R( 1 ) |
| r2375 | r2376 | |
| 63 | 63 | |
| 64 | 64 | static READ8_HANDLER( amspdwy_sound_r ) |
| 65 | 65 | { |
| 66 | return (YM2151_status_port_0_r(machine,0) & ~ 0x30) | | |
| 66 | return (YM2151_status_port_0_r(machine,0) & ~ 0x30) | | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | static WRITE8_HANDLER( amspdwy_sound_w ) |
| r2375 | r2376 | |
|---|---|---|
| 2288 | 2288 | temp = 0; |
| 2289 | 2289 | |
| 2290 | 2290 | if (port_fa_last == 0x08) /* 0000 1000 */ /* Angle */ |
| 2291 | temp = | |
| 2291 | temp = | |
| 2292 | 2292 | |
| 2293 | 2293 | if (port_fa_last == 0x09) /* 0000 1001 */ /* Accel */ |
| 2294 | temp = | |
| 2294 | temp = | |
| 2295 | 2295 | |
| 2296 | 2296 | return temp; |
| 2297 | 2297 | } |
| r2375 | r2376 | |
| 2327 | 2327 | |
| 2328 | 2328 | if (data & 1) |
| 2329 | 2329 | { |
| 2330 | int curr = | |
| 2330 | int curr = | |
| 2331 | 2331 | diff1 = ((curr - last1) & 0x0fff) | (curr & 0xf000); |
| 2332 | 2332 | last1 = curr; |
| 2333 | 2333 | } |
| 2334 | 2334 | if (data & 2) |
| 2335 | 2335 | { |
| 2336 | int curr = | |
| 2336 | int curr = | |
| 2337 | 2337 | diff2 = ((curr - last2) & 0x0fff) | (curr & 0xf000); |
| 2338 | 2338 | last2 = curr; |
| 2339 | 2339 | } |
| r2375 | r2376 | |
|---|---|---|
| 179 | 179 | static int old_x[2], old_y[2], old_f[2]; |
| 180 | 180 | static UINT8 ret[2]; |
| 181 | 181 | |
| 182 | switch ( | |
| 182 | switch ( | |
| 183 | 183 | { |
| 184 | 184 | case 3: |
| 185 | case 1: return readinputport(0 + offset); // Lightgun buttons | |
| 186 | case 2: return readinputport(4 + offset); // Joystick | |
| 185 | case 1: return input_port_read_indexed(machine, 0 + offset); // Lightgun buttons | |
| 186 | case 2: return input_port_read_indexed(machine, 4 + offset); // Joystick | |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | // Trackball |
| 190 | 190 | |
| 191 | x = readinputport(13 + offset * 2); | |
| 192 | y = readinputport(12 + offset * 2); | |
| 191 | x = input_port_read_indexed(machine, 13 + offset * 2); | |
| 192 | y = input_port_read_indexed(machine, 12 + offset * 2); | |
| 193 | 193 | f = video_screen_get_frame_number(machine->primary_screen); |
| 194 | 194 | |
| 195 | ret[offset] = (ret[offset] & 0x14) | ( | |
| 195 | ret[offset] = (ret[offset] & 0x14) | ( | |
| 196 | 196 | |
| 197 | 197 | x = (x & 0x7f) - (x & 0x80); |
| 198 | 198 | y = (y & 0x7f) - (y & 0x80); |
| r2375 | r2376 | |
| 696 | 696 | static CUSTOM_INPUT( wheelrun_wheel_r ) |
| 697 | 697 | { |
| 698 | 698 | int player = (FPTR)param; |
| 699 | int delta = | |
| 699 | int delta = | |
| 700 | 700 | delta = (delta & 0x7f) - (delta & 0x80) + 4; |
| 701 | 701 | |
| 702 | 702 | if (delta > 7) delta = 7; |
| r2375 | r2376 | |
|---|---|---|
| 205 | 205 | */ |
| 206 | 206 | |
| 207 | 207 | #include "driver.h" |
| 208 | #include "deprecat.h" | |
| 208 | 209 | #include "cdrom.h" |
| 209 | 210 | #include "cpu/mips/psx.h" |
| 210 | 211 | #include "includes/psx.h" |
| r2375 | r2376 | |
| 300 | 301 | switch (offset) |
| 301 | 302 | { |
| 302 | 303 | case 0: |
| 303 | data = | |
| 304 | data = | |
| 304 | 305 | break; |
| 305 | 306 | case 1: |
| 306 | 307 | { |
| 307 | data = | |
| 308 | data = | |
| 308 | 309 | data |= 0x000000c0; |
| 309 | 310 | |
| 310 | 311 | if( has_ds2401[ security_cart_number ] ) |
| r2375 | r2376 | |
| 340 | 341 | break; |
| 341 | 342 | } |
| 342 | 343 | case 2: |
| 343 | data = | |
| 344 | data = | |
| 344 | 345 | break; |
| 345 | 346 | case 3: |
| 346 | data = | |
| 347 | data = | |
| 347 | 348 | break; |
| 348 | 349 | } |
| 349 | 350 | |
| r2375 | r2376 | |
| 1385 | 1386 | switch( input ) |
| 1386 | 1387 | { |
| 1387 | 1388 | case ADC083X_CH0: |
| 1388 | return (double) ( | |
| 1389 | return (double) ( | |
| 1389 | 1390 | case ADC083X_CH1: |
| 1390 | return (double) ( | |
| 1391 | return (double) ( | |
| 1391 | 1392 | case ADC083X_CH2: |
| 1392 | return (double) ( | |
| 1393 | return (double) ( | |
| 1393 | 1394 | case ADC083X_CH3: |
| 1394 | return (double) ( | |
| 1395 | return (double) ( | |
| 1395 | 1396 | case ADC083X_AGND: |
| 1396 | 1397 | return 0; |
| 1397 | 1398 | case ADC083X_VREF: |
| r2375 | r2376 | |
| 1490 | 1491 | { |
| 1491 | 1492 | int i; |
| 1492 | 1493 | |
| 1493 | psx_driver_init(); | |
| 1494 | psx_driver_init(machine); | |
| 1494 | 1495 | atapi_init(machine); |
| 1495 | 1496 | psx_dma_install_read_handler(5, cdrom_dma_read); |
| 1496 | 1497 | psx_dma_install_write_handler(5, cdrom_dma_write); |
| r2375 | r2376 | |
| 1537 | 1538 | psx_dma_install_write_handler |
| 1538 | 1539 | }; |
| 1539 | 1540 | |
| 1540 | static void update_mode( | |
| 1541 | static void update_mode( running_machine *machine ) | |
| 1541 | 1542 | { |
| 1542 | int cart = readinputportbytag( "CART" ); | |
| 1543 | int cd = readinputportbytag( "CD" ); | |
| 1543 | int cart = input_port_read(machine, "CART" ); | |
| 1544 | int cd = input_port_read(machine, "CD" ); | |
| 1544 | 1545 | static SCSIInstance *new_cdrom; |
| 1545 | 1546 | |
| 1546 | 1547 | if( chiptype[ 1 ] != 0 ) |
| r2375 | r2376 | |
| 1570 | 1571 | |
| 1571 | 1572 | static INTERRUPT_GEN( sys573_vblank ) |
| 1572 | 1573 | { |
| 1573 | update_mode(); | |
| 1574 | update_mode(machine); | |
| 1574 | 1575 | |
| 1575 | 1576 | if( strcmp( machine->gamedrv->name, "ddr2ml" ) == 0 ) |
| 1576 | 1577 | { |
| r2375 | r2376 | |
| 1604 | 1605 | switch( offset ) |
| 1605 | 1606 | { |
| 1606 | 1607 | case 0x26: |
| 1607 | uPD4701_y_add( 0, readinputportbytag_safe( "uPD4701_y", 0 ) ); | |
| 1608 | uPD4701_switches_set( 0, readinputportbytag_safe( "uPD4701_switches", 0 ) ); | |
| 1608 | uPD4701_y_add( 0, input_port_read_safe(machine, "uPD4701_y", 0 ) ); | |
| 1609 | uPD4701_switches_set( 0, input_port_read_safe(machine, "uPD4701_switches", 0 ) ); | |
| 1609 | 1610 | |
| 1610 | 1611 | uPD4701_cs_w( 0, 0 ); |
| 1611 | 1612 | uPD4701_xy_w( 0, 1 ); |
| r2375 | r2376 | |
| 1881 | 1882 | |
| 1882 | 1883 | static CUSTOM_INPUT( gn845pwbb_read ) |
| 1883 | 1884 | { |
| 1884 | return | |
| 1885 | return | |
| 1885 | 1886 | } |
| 1886 | 1887 | |
| 1887 | 1888 | static void gn845pwbb_output_callback( int offset, int data ) |
| r2375 | r2376 | |
|---|---|---|
| 110 | 110 | |
| 111 | 111 | static READ16_HANDLER( special_port0_r ) |
| 112 | 112 | { |
| 113 | int temp = | |
| 113 | int temp = | |
| 114 | 114 | if (atarigen_cpu_to_sound_ready) temp ^= 0x1000; |
| 115 | 115 | temp ^= 0x2000; /* A2DOK always high for now */ |
| 116 | 116 | return temp; |
| r2375 | r2376 | |
| 127 | 127 | { |
| 128 | 128 | /* Pit Fighter has no A2D, just another input port */ |
| 129 | 129 | if (atarig1_pitfight) |
| 130 | return | |
| 130 | return | |
| 131 | 131 | |
| 132 | 132 | /* otherwise, assume it's hydra */ |
| 133 | 133 | if (which_input < 3) |
| 134 | return | |
| 134 | return | |
| 135 | 135 | |
| 136 | 136 | return 0; |
| 137 | 137 | } |
| r2375 | r2376 | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
| 164 | static | |
| 164 | static STATE_POSTLOAD( pitfighb_state_postload | |
| 165 | 165 | { |
| 166 | 166 | int bank = bslapstic_bank; |
| 167 | 167 | bslapstic_bank = -1; |
| r2375 | r2376 | |
| 964 | 964 | pitfighb_cheap_slapstic_init(); |
| 965 | 965 | state_save_register_global(bslapstic_bank); |
| 966 | 966 | state_save_register_global(bslapstic_primed); |
| 967 | state_save_register_ | |
| 967 | state_save_register_ | |
| 968 | 968 | } |
| 969 | 969 | else if (slapstic != 0) |
| 970 | 970 | atarigen_slapstic_init(0, slapstic_base, 0, slapstic); |
| r2375 | r2376 | |
|---|---|---|
| 125 | 125 | /* on the VBLANK, read the pot and schedule an interrupt time for it */ |
| 126 | 126 | if (scanline == video_screen_get_visible_area(machine->primary_screen)->max_y + 1) |
| 127 | 127 | { |
| 128 | UINT8 potvalue = | |
| 128 | UINT8 potvalue = | |
| 129 | 129 | timer_adjust_oneshot(pot_timer, video_screen_get_time_until_pos(machine->primary_screen, 72 + (potvalue / 2), (potvalue % 2) * 128), 0); |
| 130 | 130 | } |
| 131 | 131 | |
| r2375 | r2376 | |
| 156 | 156 | |
| 157 | 157 | /* DIP switches are selected by ADR0+ADR1 if ADR3 == 0 */ |
| 158 | 158 | if ((offset & 0x0b) == 0x00) |
| 159 | result &= ( | |
| 159 | result &= ( | |
| 160 | 160 | if ((offset & 0x0b) == 0x01) |
| 161 | result &= ( | |
| 161 | result &= ( | |
| 162 | 162 | if ((offset & 0x0b) == 0x02) |
| 163 | result &= ( | |
| 163 | result &= ( | |
| 164 | 164 | if ((offset & 0x0b) == 0x03) |
| 165 | result &= ( | |
| 165 | result &= ( | |
| 166 | 166 | |
| 167 | 167 | /* other switches are selected by ADR0+ADR1+ADR2 if ADR4 == 0 */ |
| 168 | 168 | if ((offset & 0x17) == 0x00) |
| 169 | result &= ( | |
| 169 | result &= ( | |
| 170 | 170 | if ((offset & 0x17) == 0x04) |
| 171 | 171 | result &= ((pot_trigger[0] & ~pot_mask[0]) << 7) | 0x7f; |
| 172 | 172 | if ((offset & 0x17) == 0x05) |
| 173 | 173 | result &= ((pot_trigger[1] & ~pot_mask[1]) << 7) | 0x7f; |
| 174 | 174 | if ((offset & 0x17) == 0x06) |
| 175 | result &= | |
| 175 | result &= | |
| 176 | 176 | if ((offset & 0x17) == 0x07) |
| 177 | result &= ( | |
| 177 | result &= ( | |
| 178 | 178 | |
| 179 | 179 | return result; |
| 180 | 180 | } |
| r2375 | r2376 | |
|---|---|---|
| 57 | 57 | int curr,delta; |
| 58 | 58 | |
| 59 | 59 | |
| 60 | curr = | |
| 60 | curr = | |
| 61 | 61 | delta = (curr - last[offset]) & 0xff; |
| 62 | 62 | last[offset] = curr; |
| 63 | 63 | return (delta & 0x80) | (curr >> 1); |
| r2375 | r2376 | |
|---|---|---|
| 95 | 95 | |
| 96 | 96 | static READ16_HANDLER( special_port1_r ) |
| 97 | 97 | { |
| 98 | int result = | |
| 98 | int result = | |
| 99 | 99 | if (atarigen_get_hblank(machine->primary_screen)) result ^= 0x8000; |
| 100 | 100 | if (atarigen_cpu_to_sound_ready) result ^= 0x2000; |
| 101 | 101 | return result; |
| r2375 | r2376 | |
|---|---|---|
| 253 | 253 | int res1; |
| 254 | 254 | int res2; |
| 255 | 255 | |
| 256 | res1 = readinputportbytag("IN3"); | |
| 257 | res2 = readinputportbytag("IN4"); | |
| 256 | res1 = input_port_read(machine, "IN3"); | |
| 257 | res2 = input_port_read(machine, "IN4"); | |
| 258 | 258 | res = 0x00; |
| 259 | 259 | |
| 260 | 260 | switch (offset & 0x07) |
| r2375 | r2376 | |
|---|---|---|
| 13 | 13 | different tiles available for use in the foreground layer. |
| 14 | 14 | |
| 15 | 15 | |
| 16 | Legionnaire BK3 charsets | |
| 17 | ------------------------ | |
| 18 | 16 | |
| 19 | The GFX roms contain two odd sections of 256 16x16 tiles marked as BK3. | |
| 20 | These need to be brought together and decoded as a single section of | |
| 21 | 0x200 tiles. | |
| 22 | ||
| 23 | The 0x104000 area appears to be extra paletteram? | |
| 24 | ||
| 25 | ||
| 26 | 17 | TODO |
| 27 | 18 | ---- |
| 28 | 19 | |
| 29 | 20 | Unemulated protection messes up both games. |
| 30 | 21 | |
| 31 | S | |
| 22 | S | |
| 32 | 23 | |
| 33 | 24 | |
| 34 | 25 | Legionnaire |
| r2375 | r2376 | |
| 38 | 29 | |
| 39 | 30 | Need 16 px off top of vis area? |
| 40 | 31 | |
| 32 | The 0x104000 area appears to be extra paletteram? | |
| 41 | 33 | |
| 42 | Heated Barrel | |
| 43 | ------------- | |
| 44 | 34 | |
| 45 | Big problems with layers not being cleared, especially the text | |
| 46 | layer. There may be a write to the COP controlling layer clearance? | |
| 47 | ||
| 48 | Ends with Access violation when you die on round 1 boss. A lot of | |
| 49 | non-existent area reads in log - maybe because of bad reads from | |
| 50 | the COP. | |
| 51 | ||
| 52 | ||
| 53 | 35 | Denjin Makai |
| 54 | 36 | ------------ |
| 55 | 37 | |
| 56 | 38 | Palette Ram format correct,but color offset wrong? |
| 57 | Probably protection related,game updates paletteram with rom data | |
| 39 | Probably protection related,game updates paletteram with rom data (or bad program rom?).. | |
| 58 | 40 | |
| 59 | 41 | Need a sound kludge to start. |
| 60 | 42 | |
| 61 | Sprite | |
| 43 | Bad Sprite rom - | |
| 62 | 44 | |
| 63 | 45 | |
| 64 | 46 | Godzilla |
| r2375 | r2376 | |
| 97 | 79 | #include "sound/3812intf.h" |
| 98 | 80 | #include "cpu/m68000/m68000.h" |
| 99 | 81 | |
| 82 | /* machine/seicop.c */ | |
| 83 | extern UINT16* cop_mcu_ram; | |
| 84 | extern READ16_HANDLER( legionna_mcu_r ); | |
| 85 | extern WRITE16_HANDLER( legionna_mcu_w ); | |
| 86 | extern READ16_HANDLER( heatbrl_mcu_r ); | |
| 87 | extern WRITE16_HANDLER( heatbrl_mcu_w ); | |
| 88 | extern READ16_HANDLER( godzilla_cop_mcu_r ); | |
| 89 | extern WRITE16_HANDLER( godzilla_cop_mcu_w ); | |
| 90 | extern READ16_HANDLER( denjinmk_cop_mcu_r ); | |
| 91 | extern WRITE16_HANDLER( denjinmk_cop_mcu_w ); | |
| 92 | extern READ16_HANDLER( sdgndmrb_cop_mcu_r ); | |
| 93 | extern WRITE16_HANDLER( sdgndmrb_cop_mcu_w ); | |
| 94 | extern READ16_HANDLER( copdx_0_r ); | |
| 95 | extern WRITE16_HANDLER( copdx_0_w ); | |
| 96 | extern READ16_HANDLER( copdxbl_0_r ); | |
| 97 | extern WRITE16_HANDLER( copdxbl_0_w ); | |
| 98 | ||
| 99 | ||
| 100 | ||
| 101 | ||
| 102 | ||
| 100 | 103 | extern WRITE16_HANDLER( legionna_background_w ); |
| 101 | 104 | extern WRITE16_HANDLER( legionna_foreground_w ); |
| 102 | 105 | extern WRITE16_HANDLER( legionna_midground_w ); |
| r2375 | r2376 | |
| 109 | 112 | extern VIDEO_UPDATE( legionna ); |
| 110 | 113 | extern VIDEO_UPDATE( godzilla ); |
| 111 | 114 | extern VIDEO_UPDATE( sdgndmrb ); |
| 112 | void heatbrl_setgfxbank(UINT16 data); | |
| 113 | void denjinmk_setgfxbank(UINT16 data); | |
| 114 | 115 | |
| 116 | ||
| 115 | 117 | extern UINT16 *legionna_back_data,*legionna_fore_data,*legionna_mid_data,*legionna_scrollram16,*legionna_textram; |
| 116 | static UINT16 *mcu_ram; | |
| 117 | extern UINT8 sdgndmrb_pri_n; | |
| 118 | 118 | |
| 119 | ||
| 119 | 120 | static WRITE16_HANDLER( legionna_paletteram16_w ) /* xBBBBxRRRRxGGGGx */ |
| 120 | 121 | { |
| 121 | 122 | int a; |
| r2375 | r2376 | |
| 124 | 125 | palette_set_color_rgb(Machine,offset,pal4bit(a >> 1),pal4bit(a >> 6),pal4bit(a >> 11)); |
| 125 | 126 | } |
| 126 | 127 | |
| 127 | ||
| 128 | /* Mcu reads in attract in Legionnaire game demo | |
| 129 | ||
| 130 | Guess the 0x400-0x5ff area of the COP is protection related. | |
| 131 | ||
| 132 | CPU0 PC 0032a2 unknown MCU write offset: 0260 data: 9c6c | |
| 133 | CPU0 PC 0032a8 unknown MCU write offset: 0250 data: 0010 | |
| 134 | CPU0 PC 0032c8 unknown MCU write offset: 0261 data: 987c | |
| 135 | CPU0 PC 0032ce unknown MCU write offset: 0251 data: 0010 | |
| 136 | CPU0 PC 003546 unknown MCU write offset: 0262 data: 02c4 | |
| 137 | CPU0 PC 00354a unknown MCU write offset: 0252 data: 0004 | |
| 138 | CPU0 PC 00355c unknown MCU write offset: 0263 data: 0000 | |
| 139 | CPU0 PC 003560 unknown MCU write offset: 0253 data: 0004 | |
| 140 | CPU0 PC 003568 unknown MCU write offset: 0280 data: a180 | |
| 141 | CPU0 PC 00356e unknown MCU write offset: 0280 data: a980 | |
| 142 | CPU0 PC 003574 unknown MCU write offset: 0280 data: b100 | |
| 143 | CPU0 PC 00357a unknown MCU write offset: 0280 data: b900 | |
| 144 | CPU0 PC 003580 unknown MCU read offset: 02c4 | |
| 145 | CPU0 PC 003588 unknown MCU read offset: 02c2 | |
| 146 | CPU0 PC 003594 unknown MCU read offset: 02c1 | |
| 147 | CPU0 PC 0035a0 unknown MCU read offset: 02c3 | |
| 148 | CPU0 PC 0032a2 unknown MCU write offset: 0260 data: 9c6c | |
| 149 | CPU0 PC 0032a8 unknown MCU write offset: 0250 data: 0010 | |
| 150 | CPU0 PC 0032c8 unknown MCU write offset: 0261 data: 987c | |
| 151 | CPU0 PC 0032ce unknown MCU write offset: 0251 data: 0010 | |
| 152 | CPU0 PC 003422 unknown MCU write offset: 0280 data: 138e | |
| 153 | CPU0 PC 003428 unknown MCU read offset: 02da | |
| 154 | CPU0 PC 00342e unknown MCU read offset: 02d8 | |
| 155 | CPU0 PC 00346c unknown MCU write offset: 0280 data: 3bb0 | |
| 156 | CPU0 PC 0032a2 unknown MCU write offset: 0260 data: 987c | |
| 157 | CPU0 PC 0032a8 unknown MCU write offset: 0250 data: 0010 | |
| 158 | CPU0 PC 003306 unknown MCU write offset: 0280 data: 8100 | |
| 159 | CPU0 PC 00330c unknown MCU write offset: 0280 data: 8900 | |
| 160 | ||
| 161 | ||
| 162 | Mcu reads in attract in Heated Barrel game demo (note | |
| 163 | partial similarity) | |
| 164 | ||
| 165 | (i) This sequence repeats a number of times early on: | |
| 166 | ||
| 167 | CPU0 PC 0085b4 unknown MCU write offset: 0210 data: 0064 | |
| 168 | CPU0 PC 0085ba unknown MCU write offset: 0211 data: 0000 | |
| 169 | CPU0 PC 0085be unknown MCU read offset: 02ca | |
| 170 | CPU0 PC 0085ee unknown MCU read offset: 02c9 | |
| 171 | CPU0 PC 008622 unknown MCU read offset: 02c8 | |
| 172 | [Protection BCD,see protection_bcd_jsr()] | |
| 173 | ||
| 174 | (ii) This happens a few times: | |
| 175 | ||
| 176 | CPU0 PC 0017ac unknown MCU write offset: 0260 data: b6cc | |
| 177 | CPU0 PC 0017b2 unknown MCU write offset: 0250 data: 0010 | |
| 178 | CPU0 PC 0017d2 unknown MCU write offset: 0261 data: babc | |
| 179 | CPU0 PC 0017d8 unknown MCU write offset: 0251 data: 0010 | |
| 180 | CPU0 PC 00192c unknown MCU write offset: 0280 data: 138e | |
| 181 | CPU0 PC 001932 unknown MCU read offset: 02da | |
| 182 | CPU0 PC 001938 unknown MCU read offset: 02d8 | |
| 183 | CPU0 PC 001976 unknown MCU write offset: 0280 data: 3bb0 | |
| 184 | CPU0 PC 0017ac unknown MCU write offset: 0260 data: b6cc | |
| 185 | CPU0 PC 0017b2 unknown MCU write offset: 0250 data: 0010 | |
| 186 | CPU0 PC 0017d2 unknown MCU write offset: 0261 data: bb9c | |
| 187 | CPU0 PC 0017d8 unknown MCU write offset: 0251 data: 0010 | |
| 188 | CPU0 PC 00192c unknown MCU write offset: 0280 data: 138e | |
| 189 | CPU0 PC 001932 unknown MCU read offset: 02da | |
| 190 | CPU0 PC 001938 unknown MCU read offset: 02d8 | |
| 191 | CPU0 PC 001976 unknown MCU write offset: 0280 data: 3bb0 | |
| 192 | ||
| 193 | ||
| 194 | ||
| 195 | (iii) Later on this happens a lot: | |
| 196 | ||
| 197 | CPU0 PC 0017ac unknown MCU write offset: 0260 data: c61c | |
| 198 | CPU0 PC 0017b2 unknown MCU write offset: 0250 data: 0010 | |
| 199 | CPU0 PC 0017d2 unknown MCU write offset: 0261 data: bb9c | |
| 200 | CPU0 PC 0017d8 unknown MCU write offset: 0251 data: 0010 | |
| 201 | CPU0 PC 001a5c unknown MCU write offset: 0262 data: aa48 | |
| 202 | CPU0 PC 001a62 unknown MCU write offset: 0252 data: 0003 | |
| 203 | CPU0 PC 001a7c unknown MCU write offset: 0263 data: a0c8 | |
| 204 | CPU0 PC 001a82 unknown MCU write offset: 0253 data: 0003 | |
| 205 | CPU0 PC 001a86 unknown MCU write offset: 0280 data: a100 | |
| 206 | CPU0 PC 001a8c unknown MCU write offset: 0280 data: b080 | |
| 207 | CPU0 PC 001a92 unknown MCU write offset: 0280 data: a900 | |
| 208 | CPU0 PC 001a98 unknown MCU write offset: 0280 data: b880 | |
| 209 | CPU0 PC 001a9e unknown MCU read offset: 02c0 | |
| 210 | CPU0 PC 001aa6 unknown MCU read offset: 02c2 | |
| 211 | CPU0 PC 001ab2 unknown MCU read offset: 02c1 | |
| 212 | ||
| 213 | write to $500 these values to determine the kind of sub-routine to do | |
| 214 | hit_check | |
| 215 | a180 | |
| 216 | a980 | |
| 217 | b100 | |
| 218 | b900 | |
| 219 | || b880 (heatbrl) | |
| 220 | ||
| 221 | movement protection | |
| 222 | 8100 | |
| 223 | 8900 | |
| 224 | ||
| 225 | 00DB2A: D6A8 0048 add.l ($48,A0), D3 | |
| 226 | 00DB2E: D8A8 0044 add.l ($44,A0), D4 | |
| 227 | 00DB32: 0C83 FFF0 0000 cmpi.l #-$100000, D3 | |
| 228 | 00DB38: 6D2E blt $db68 | |
| 229 | 00DB3A: 0C83 0100 0000 cmpi.l #$1000000, D3 | |
| 230 | 00DB40: 6C26 bge $db68 | |
| 231 | 00DB42: 2143 003C move.l D3, ($3c,A0) | |
| 232 | 00DB46: 0C84 FFF0 0000 cmpi.l #-$100000, D4 | |
| 233 | 00DB4C: 6D1A blt $db68 | |
| 234 | 00DB4E: 0C84 0100 0000 cmpi.l #$1000000, D4 | |
| 235 | 00DB54: 6E12 bgt $db68 | |
| 236 | 00DB56: 2144 0038 move.l D4, ($38,A0) | |
| 237 | 00DB5A: 3168 003C 0022 move.w ($3c,A0), ($22,A0) | |
| 238 | 00DB60: 3168 0038 0024 move.w ($38,A0), ($24,A0) | |
| 239 | 00DB66: 4E75 rts | |
| 240 | ||
| 241 | ||
| 242 | sprite DMA | |
| 243 | ||
| 244 | */ | |
| 245 | /*Movement protection*//*Legionnaire,Heated Barrel*/ | |
| 246 | static UINT32 ram_addr[2],rom_addr[2]; | |
| 247 | /*Sprite DMA protection*//*SD Gundam*/ | |
| 248 | static UINT8 dma_status; | |
| 249 | static UINT32 dma_src,dma_dst; | |
| 250 | static UINT16 prot_data[2],dma_size; | |
| 251 | /*Number protection*//*Heated Barrel,SD Gundam,Godzilla,Denjin Makai*/ | |
| 252 | static UINT32 prot_bcd[4]; | |
| 253 | /*Hit check protection*//*Legionnaire,Heated Barrel,SD Gundam*/ | |
| 254 | static UINT8 xy_check; | |
| 255 | static UINT32 hit_check_x,hit_check_y; | |
| 256 | ||
| 257 | ||
| 258 | ||
| 259 | #define CRT_MODE(_x_,_y_,_flip_) \ | |
| 260 | { \ | |
| 261 | rectangle visarea = *video_screen_get_visible_area(machine->primary_screen); \ | |
| 262 | visarea.min_x = 0; \ | |
| 263 | visarea.max_x = _x_-1; \ | |
| 264 | visarea.min_y = 0; \ | |
| 265 | visarea.max_y = _y_-1; \ | |
| 266 | video_screen_configure(machine->primary_screen, _x_, _y_, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds ); \ | |
| 267 | flip_screen_set(_flip_); \ | |
| 268 | } \ | |
| 269 | ||
| 270 | /*TODO: numbers over 65535?*/ | |
| 271 | static UINT32 protection_bcd_jsr(UINT16 prot_data) | |
| 272 | { | |
| 273 | UINT32 res,bcd_data; | |
| 274 | ||
| 275 | res = 0; | |
| 276 | bcd_data = prot_data; | |
| 277 | while(bcd_data > 0) | |
| 278 | { | |
| 279 | if(bcd_data > 999) | |
| 280 | { | |
| 281 | res+=0x01000000; | |
| 282 | bcd_data-=1000; | |
| 283 | } | |
| 284 | else if(bcd_data > 99) | |
| 285 | { | |
| 286 | res+=0x00010000; | |
| 287 | bcd_data-=100; | |
| 288 | } | |
| 289 | else if(bcd_data > 9) | |
| 290 | { | |
| 291 | res+=0x00000100; | |
| 292 | bcd_data-=10; | |
| 293 | } | |
| 294 | else | |
| 295 | { | |
| 296 | res++; | |
| 297 | bcd_data--; | |
| 298 | } | |
| 299 | } | |
| 300 | ||
| 301 | return res & 0x0f0f0f0f; | |
| 302 | } | |
| 303 | ||
| 304 | /*TODO: -move x-axis limits,to calculate basing on the screen xy-axis values*/ | |
| 305 | /* -the second value should be end of calculation (in other words,check everything between the two values) */ | |
| 306 | #define PLAYER 0 | |
| 307 | #define ENEMY 1 | |
| 308 | static void protection_move_jsr(UINT32 work_ram,UINT8 k) | |
| 309 | { | |
| 310 | static UINT32 move_data,x_data,y_data; | |
| 311 | /*Read the movement data to execute*/ | |
| 312 | move_data = ((program_read_word(work_ram+0x34)<<16) & 0xffff0000) | | |
| 313 | (program_read_word(work_ram+0x36) & 0xffff); | |
| 314 | ||
| 315 | /*Read the x/y axis of the sprite to change*/ | |
| 316 | x_data = (program_read_word(work_ram+0x8)); | |
| 317 | y_data = (program_read_word(work_ram+0x4)); | |
| 318 | /*it's bit sensitive AFAIK*/ | |
| 319 | /*move_data hi-word on player | |
| 320 | $17 = walk floor | |
| 321 | $1b = jump | |
| 322 | $30 = ? | |
| 323 | */ | |
| 324 | /*Check the kind of movement that we need to execute*/ | |
| 325 | switch(k & 1) | |
| 326 | { | |
| 327 | case PLAYER: | |
| 328 | switch(move_data & 0xffff) | |
| 329 | { | |
| 330 | case 0x0000: x_data++; break; //right | |
| 331 | case 0x0040: y_data++; break; //down | |
| 332 | case 0x00c0: y_data--; break; //up | |
| 333 | case 0x0080: x_data--; break; //left | |
| 334 | case 0x00a0: y_data--; x_data--; break; //up-left | |
| 335 | case 0x0060: y_data++; x_data--; break; //down-left | |
| 336 | case 0x0020: y_data++; x_data++; break; //down-right | |
| 337 | case 0x00e0: y_data--; x_data++; break; //up-right | |
| 338 | } | |
| 339 | break; | |
| 340 | /*wrong...*/ | |
| 341 | case ENEMY: | |
| 342 | switch(move_data & 0xffff) | |
| 343 | { | |
| 344 | case 0x0000: x_data++; break; //right | |
| 345 | case 0x0040: y_data++; break; //down | |
| 346 | case 0x00c0: y_data--; break; //up | |
| 347 | case 0x0080: x_data--; break; //left | |
| 348 | case 0x00a0: y_data--; x_data--; break; //up-left | |
| 349 | case 0x0060: y_data++; x_data--; break; //down-left | |
| 350 | case 0x0020: y_data++; x_data++; break; //down-right | |
| 351 | case 0x00e0: y_data--; x_data++; break; //up-right | |
| 352 | default: | |
| 353 | popmessage("%08x",move_data); | |
| 354 | break; | |
| 355 | } | |
| 356 | break; | |
| 357 | } | |
| 358 | /*Write the new values to the sprite x/y data*/ | |
| 359 | program_write_word(work_ram+0x8,x_data); | |
| 360 | program_write_word(work_ram+0x4,y_data); | |
| 361 | } | |
| 362 | ||
| 363 | #ifdef UNUSED_FUNCTION | |
| 364 | static void protection_move2_jsr(void) | |
| 365 | { | |
| 366 | // static UINT32 move_data; | |
| 367 | // popmessage("%08x %08x %08x %08x",ram_addr[0],ram_addr[1],rom_addr[0],rom_addr[1]); | |
| 368 | } | |
| 369 | #endif | |
| 370 | ||
| 371 | static UINT16 hit_check; | |
| 372 | ||
| 373 | static void protection_hit_jsr(UINT32 work_ram1,UINT32 work_ram2) | |
| 374 | { | |
| 375 | int x1,y1,x2,y2/*,hit1,hit2*/; | |
| 376 | x1 = (program_read_word(work_ram1+0x8)); | |
| 377 | y1 = (program_read_word(work_ram1+0x4)); | |
| 378 | //hit1 = (program_read_word(work_ram1-));//this sprite is attacking | |
| 379 | x2 = (program_read_word(work_ram2+0x8)); | |
| 380 | y2 = (program_read_word(work_ram2+0x4)); | |
| 381 | //hit2 = (program_read_word()); | |
| 382 | ||
| 383 | popmessage("%08x:x=%04x y=%04x %08x:x=%04x y=%04x",work_ram1,x1,y1,work_ram2,x2,y2); | |
| 384 | ||
| 385 | if((x1 >= (x2-0x80)) && | |
| 386 | (x1 <= (x2+0x80)) && | |
| 387 | (y1 >= (y2-3)) && | |
| 388 | (y1 <= (y2+3))) | |
| 389 | hit_check = 0; | |
| 390 | else | |
| 391 | hit_check = 0xffff; | |
| 392 | } | |
| 393 | ||
| 394 | /*directional movement protection*/ | |
| 395 | static void moveprot_jsr(void) | |
| 396 | { | |
| 397 | static INT16 x_axis,y_axis; | |
| 398 | static UINT16 move_data,distance,move_type; | |
| 399 | move_data = program_read_word(ram_addr[0]+0x36); | |
| 400 | x_axis = program_read_word(ram_addr[0]+0x08); | |
| 401 | y_axis = program_read_word(ram_addr[0]+0x04); | |
| 402 | ||
| 403 | distance = (move_data & 0xf); | |
| 404 | move_type = (move_data & 0xf0)>>4; | |
| 405 | switch(move_type) | |
| 406 | { | |
| 407 | case 0x0f://right | |
| 408 | program_write_word(ram_addr[0]+0x08,x_axis+distance); | |
| 409 | //program_write_word(0x110004,); | |
| 410 | break; | |
| 411 | case 0x0b://up | |
| 412 | program_write_word(ram_addr[0]+0x04,y_axis-distance); | |
| 413 | break; | |
| 414 | case 0x07://left | |
| 415 | program_write_word(ram_addr[0]+0x08,x_axis-distance); | |
| 416 | break; | |
| 417 | case 0x03://down | |
| 418 | program_write_word(ram_addr[0]+0x04,y_axis+distance); | |
| 419 | break; | |
| 420 | case 0x0d://up-right | |
| 421 | program_write_word(ram_addr[0]+0x08,x_axis+distance); | |
| 422 | program_write_word(ram_addr[0]+0x04,y_axis-distance); | |
| 423 | break; | |
| 424 | case 0x09://up-left | |
| 425 | program_write_word(ram_addr[0]+0x04,y_axis-distance); | |
| 426 | program_write_word(ram_addr[0]+0x08,x_axis-distance); | |
| 427 | break; | |
| 428 | case 0x01://down-right | |
| 429 | program_write_word(ram_addr[0]+0x04,y_axis+distance); | |
| 430 | program_write_word(ram_addr[0]+0x08,x_axis+distance); | |
| 431 | break; | |
| 432 | case 0x05://down-left | |
| 433 | program_write_word(ram_addr[0]+0x04,y_axis+distance); | |
| 434 | program_write_word(ram_addr[0]+0x08,x_axis-distance); | |
| 435 | break; | |
| 436 | default: | |
| 437 | logerror("Warning: \"0x205\" command called with move_type parameter = %02x\n",move_type); | |
| 438 | ||
| 439 | //down-right | |
| 440 | //down-left | |
| 441 | } | |
| 442 | //program_write_word(0x110008,x_axis+tmp); | |
| 443 | //program_write_word(0x110004,y_axis+tmp); | |
| 444 | ||
| 445 | //program_write_word(0x110008,x_axis); | |
| 446 | //program_write_word(0x110004,y_axis); | |
| 447 | } | |
| 448 | ||
| 449 | /* | |
| 450 | 00454E: 3028 0008 move.w ($8,A0), D0 ;player | |
| 451 | 004552: 3228 000C move.w ($c,A0), D1 | |
| 452 | 004556: 342B 0008 move.w ($8,A3), D2 ;enemy | |
| 453 | 00455A: 362B 000C move.w ($c,A3), D3 | |
| 454 | 00455E: 33C0 0011 0048 move.w D0, $110048.l ;player x | |
| 455 | 004564: 33C1 0011 0044 move.w D1, $110044.l ;player y | |
| 456 | 00456A: 33C2 0011 0008 move.w D2, $110008.l ;enemy x | |
| 457 | 004570: 33C3 0011 0004 move.w D3, $110004.l ;enemy y | |
| 458 | ||
| 459 | */ | |
| 460 | /*sprite "look" protection*/ | |
| 461 | static void move2prot_jsr(void) | |
| 462 | { | |
| 463 | static INT16 x_pl,y_pl,x_en,y_en,res; | |
| 464 | x_pl = program_read_word(ram_addr[1]+0x8); | |
| 465 | y_pl = program_read_word(ram_addr[1]+0x4); | |
| 466 | x_en = program_read_word(ram_addr[0]+0x8); | |
| 467 | y_en = program_read_word(ram_addr[0]+0x4); | |
| 468 | ||
| 469 | res = 0; | |
| 470 | if(x_en > x_pl) | |
| 471 | res|=0x80; | |
| 472 | ||
| 473 | if((x_en > x_pl-0x20) && (x_en < x_pl+0x20)) | |
| 474 | res|=0x40; | |
| 475 | //... | |
| 476 | //if(y_en > y_pl) | |
| 477 | // res|=0x40; | |
| 478 | ||
| 479 | program_write_word(ram_addr[0]+0x36,res); | |
| 480 | } | |
| 481 | ||
| 482 | #ifdef UNUSED_FUNCTION | |
| 483 | /*"To point" movement protection*/ | |
| 484 | static void move3x_prot_jsr(void) | |
| 485 | { | |
| 486 | static INT16 x_pl,x_en,x_dis; | |
| 487 | x_pl = program_read_word(ram_addr[1]+0x8); | |
| 488 | x_en = program_read_word(ram_addr[0]+0x8); | |
| 489 | x_dis = ((program_read_word(ram_addr[0]+0x34) & 0xf0) >> 4); | |
| 490 | ||
| 491 | if(x_en > x_pl) | |
| 492 | x_dis^=0xffff; | |
| 493 | ||
| 494 | program_write_word(ram_addr[0]+0x36,-0x40);/*enable command*/ | |
| 495 | program_write_word(ram_addr[0]+0x14,x_dis); | |
| 496 | } | |
| 497 | ||
| 498 | static void move3y_prot_jsr(void) | |
| 499 | { | |
| 500 | static INT16 y_pl,y_en,y_dis; | |
| 501 | y_pl = program_read_word(ram_addr[1]+0x4); | |
| 502 | y_en = program_read_word(ram_addr[0]+0x4); | |
| 503 | y_dis = (program_read_word(ram_addr[0]+0x34) & 0xf); | |
| 504 | ||
| 505 | if(y_en > y_pl) | |
| 506 | y_dis^=0xffff; | |
| 507 | ||
| 508 | program_write_word(ram_addr[0]+0x36,-0x80);/*enable command*/ | |
| 509 | program_write_word(ram_addr[0]+0x10,y_dis); | |
| 510 | } | |
| 511 | #endif | |
| 512 | ||
| 513 | ||
| 514 | static READ16_HANDLER( mcu_r ) | |
| 515 | { | |
| 516 | switch (offset) | |
| 517 | { | |
| 518 | /* Protection is not understood */ | |
| 519 | ||
| 520 | case (0x470/2): /* read PC $110a, could be some sort of control word: | |
| 521 | sometimes a bit is changed then it's poked back in... */ | |
| 522 | return (mame_rand(Machine) &0xffff); | |
| 523 | ||
| 524 | case (0x582/2): /* read PC $3594 */ | |
| 525 | return (0); | |
| 526 | ||
| 527 | case (0x584/2): /* read PC $3588 */ | |
| 528 | return (0); | |
| 529 | ||
| 530 | case (0x586/2): /* read PC $35a0 */ | |
| 531 | return (0); | |
| 532 | ||
| 533 | case (0x588/2): /* read PC $3580 */ | |
| 534 | return hit_check; | |
| 535 | ||
| 536 | case (0x5b0/2): /* bit 15 is branched on a few times in the $3300 area */ | |
| 537 | return (0); | |
| 538 | ||
| 539 | case (0x5b4/2): /* read and stored in ram before +0x5b0 bit 15 tested */ | |
| 540 | return (0); | |
| 541 | ||
| 542 | /* Non-protection reads */ | |
| 543 | ||
| 544 | case (0x708/2): /* seibu sound: these three around $b10 on */ | |
| 545 | return seibu_main_word_r(machine,2,0); | |
| 546 | ||
| 547 | case (0x70c/2): | |
| 548 | return seibu_main_word_r(machine,3,0); | |
| 549 | ||
| 550 | case (0x714/2): | |
| 551 | return seibu_main_word_r(machine,5,0); | |
| 552 | ||
| 553 | /* Inputs */ | |
| 554 | ||
| 555 | case (0x740/2): /* code at $b00 sticks waiting for bit 6 hi */ | |
| 556 | return input_port_1_word_r(machine,0,0); | |
| 557 | ||
| 558 | case (0x744/2): | |
| 559 | return input_port_2_word_r(machine,0,0); | |
| 560 | ||
| 561 | case (0x748/2): /* code at $f4a reads this 4 times in _weird_ fashion */ | |
| 562 | return input_port_0_word_r(machine,0,0); | |
| 563 | ||
| 564 | case (0x74c/2): | |
| 565 | return input_port_3_word_r(machine,0,0); | |
| 566 | ||
| 567 | } | |
| 568 | //logerror("CPU0 PC %06x unknown MCU read offset: %04x\n",activecpu_get_previouspc(),offset); | |
| 569 | ||
| 570 | return mcu_ram[offset]; | |
| 571 | } | |
| 572 | ||
| 573 | static WRITE16_HANDLER( mcu_w ) | |
| 574 | { | |
| 575 | COMBINE_DATA(&mcu_ram[offset]); | |
| 576 | ||
| 577 | switch (offset) | |
| 578 | { | |
| 579 | ||
| 580 | case (0x4c0/2): | |
| 581 | { | |
| 582 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 583 | prot_data[0] = mcu_ram[offset]; | |
| 584 | ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 585 | break; | |
| 586 | } | |
| 587 | ||
| 588 | case (0x4a0/2): | |
| 589 | { | |
| 590 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 591 | prot_data[1] = mcu_ram[offset]; | |
| 592 | ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 593 | break; | |
| 594 | } | |
| 595 | ||
| 596 | case (0x4c2/2): | |
| 597 | { | |
| 598 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 599 | prot_data[0] = mcu_ram[offset]; | |
| 600 | ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 601 | break; | |
| 602 | } | |
| 603 | ||
| 604 | case (0x4a2/2): | |
| 605 | { | |
| 606 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 607 | prot_data[1] = mcu_ram[offset]; | |
| 608 | ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 609 | break; | |
| 610 | } | |
| 611 | ||
| 612 | case (0x4c4/2): | |
| 613 | { | |
| 614 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 615 | prot_data[0] = mcu_ram[offset]; | |
| 616 | rom_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 617 | break; | |
| 618 | } | |
| 619 | ||
| 620 | case (0x4a4/2): | |
| 621 | { | |
| 622 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 623 | prot_data[1] = mcu_ram[offset]; | |
| 624 | rom_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 625 | break; | |
| 626 | } | |
| 627 | ||
| 628 | case (0x4c6/2): | |
| 629 | { | |
| 630 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 631 | prot_data[0] = mcu_ram[offset]; | |
| 632 | rom_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 633 | break; | |
| 634 | } | |
| 635 | ||
| 636 | case (0x4a6/2): | |
| 637 | { | |
| 638 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 639 | prot_data[1] = mcu_ram[offset]; | |
| 640 | rom_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 641 | break; | |
| 642 | } | |
| 643 | ||
| 644 | case (0x500/2): | |
| 645 | { | |
| 646 | /*Movement protection*/ | |
| 647 | if(mcu_ram[0x500/2] == 0x8900 || mcu_ram[0x500/2] == 0x0205) | |
| 648 | { | |
| 649 | static UINT16 xy_data[2]; | |
| 650 | static UINT8 k; | |
| 651 | xy_data[0] = program_read_word(rom_addr[0]); | |
| 652 | xy_data[1] = program_read_word(rom_addr[1]); | |
| 653 | k = (mcu_ram[0x500/2] == 0x0205) ? ENEMY : PLAYER; | |
| 654 | protection_move_jsr(ram_addr[0],k); | |
| 655 | //protection_move_jsr(ram_addr[1]); //??? | |
| 656 | //popmessage("%08x %08x %04x %04x",ram_addr[0],ram_addr[1],xy_data[0],xy_data[1]); | |
| 657 | } | |
| 658 | else if(mcu_ram[0x500/2] == 0x3bb0 || mcu_ram[0x500/2] == 0x138e) | |
| 659 | { | |
| 660 | protection_hit_jsr(ram_addr[0],ram_addr[1]); | |
| 661 | } | |
| 662 | break; | |
| 663 | } | |
| 664 | ||
| 665 | // 61a bit 0 is flipscreen | |
| 666 | // 61c probably layer disables, like Dcon | |
| 667 | // 620 - 62a scroll control; is there a layer priority switch...? | |
| 668 | ||
| 669 | case (0x620/2): | |
| 670 | { | |
| 671 | legionna_scrollram16[0] = mcu_ram[offset]; | |
| 672 | break; | |
| 673 | } | |
| 674 | case (0x622/2): | |
| 675 | { | |
| 676 | legionna_scrollram16[1] = mcu_ram[offset]; | |
| 677 | break; | |
| 678 | } | |
| 679 | case (0x624/2): | |
| 680 | { | |
| 681 | legionna_scrollram16[2] = mcu_ram[offset]; | |
| 682 | break; | |
| 683 | } | |
| 684 | case (0x626/2): | |
| 685 | { | |
| 686 | legionna_scrollram16[3] = mcu_ram[offset]; | |
| 687 | break; | |
| 688 | } | |
| 689 | case (0x628/2): | |
| 690 | { | |
| 691 | legionna_scrollram16[4] = mcu_ram[offset]; | |
| 692 | break; | |
| 693 | } | |
| 694 | case (0x62a/2): | |
| 695 | { | |
| 696 | legionna_scrollram16[5] = mcu_ram[offset]; | |
| 697 | break; | |
| 698 | } | |
| 699 | case (0x700/2): /* seibu(0) */ | |
| 700 | { | |
| 701 | seibu_main_word_w(machine,0,mcu_ram[offset],0xff00); | |
| 702 | break; | |
| 703 | } | |
| 704 | case (0x704/2): /* seibu(1) */ | |
| 705 | { | |
| 706 | seibu_main_word_w(machine,1,mcu_ram[offset],0xff00); | |
| 707 | break; | |
| 708 | } | |
| 709 | case (0x710/2): /* seibu(4) */ | |
| 710 | { | |
| 711 | seibu_main_word_w(machine,4,mcu_ram[offset],0xff00); | |
| 712 | break; | |
| 713 | } | |
| 714 | case (0x718/2): /* seibu(6) */ | |
| 715 | { | |
| 716 | seibu_main_word_w(machine,6,mcu_ram[offset],0xff00); | |
| 717 | break; | |
| 718 | } | |
| 719 | // default: | |
| 720 | //logerror("CPU0 PC %06x unknown MCU write offset: %04x data: %04x\n",activecpu_get_previouspc(),offset,data); | |
| 721 | } | |
| 722 | } | |
| 723 | ||
| 724 | ||
| 725 | ||
| 726 | /* | |
| 727 | player-1 priorities list: | |
| 728 | 1086d8: show this sprite (bit 15) | |
| 729 | 1086dc: lives (BCD,bits 3,2,1,0) | |
| 730 | 1086de: energy bar (upper byte) | |
| 731 | 1086e0: walk animation (lower byte) | |
| 732 | 1086ec: "death" status (bit 15) | |
| 733 | 1086f4: sprite y axis | |
| 734 | 1086f0: sprite x axis | |
| 735 | ||
| 736 | Sprite DMA TODO: | |
| 737 | -sprite priorities,likely to be a protection issue because in-game sprites MUST | |
| 738 | be behind the foreground layer but the attract mode logos (the ones used when | |
| 739 | the story is explained) should be above it.They both use 0 as priority number. | |
| 740 | -sprites at the very left border disappears. | |
| 741 | -some bullets STILL remains on screen? | |
| 742 | -3rd mid-boss disappears (0x1f0),2nd boss lasers wrong positioning | |
| 743 | ||
| 744 | spriteram DMA [1] | |
| 745 | 001DE4: 3086 move.w D6, (A0) ;$100400,color + other stuff | |
| 746 | 001DE6: 2440 movea.l D0, A2 | |
| 747 | 001DE8: 0269 0004 0002 andi.w #$4, ($2,A1) | |
| 748 | 001DEE: 3152 000C move.w (A2), ($c,A0) ;DMA size | |
| 749 | 001DF2: 3145 0002 move.w D5, ($2,A0) | |
| 750 | 001DF6: 0245 0040 andi.w #$40, D5 | |
| 751 | 001DFA: 2009 move.l A1, D0 | |
| 752 | 001DFC: 3140 00C0 move.w D0, ($c0,A0) ;RAM -> $1004c0 (work ram index?) | |
| 753 | 001E00: 4840 swap D0 | |
| 754 | 001E02: 3140 00A0 move.w D0, ($a0,A0) ;RAM -> $1004a0 | |
| 755 | 001E06: 200A move.l A2, D0 | |
| 756 | 001E08: 3140 0014 move.w D0, ($14,A0) ;$ROM lo -> $100414 src | |
| 757 | 001E0C: 4840 swap D0 | |
| 758 | 001E0E: 3140 0012 move.w D0, ($12,A0) ;$ROM hi -> $100412 | |
| 759 | 001E12: 2679 0010 8116 movea.l $108116.l, A3 ;points to dst spriteram | |
| 760 | 001E18: 3839 0010 810A move.w $10810a.l, D4 ;spriteram index | |
| 761 | 001E1E: 260B move.l A3, D3 | |
| 762 | 001E20: 3143 00C8 move.w D3, ($c8,A0) ;sets the dst spriteram | |
| 763 | 001E24: 4843 swap D3 | |
| 764 | 001E26: 3143 00A8 move.w D3, ($a8,A0) | |
| 765 | 001E2A: 45EA 0004 lea ($4,A2), A2 | |
| 766 | //at this point we're ready for DMAing | |
| 767 | 001E2E: 317C A180 0100 move.w #$a180, ($100,A0) ;<-DMA parameters!? | |
| 768 | 001E34: 317C 6980 0102 move.w #$6980, ($102,A0) ;<-"" | |
| 769 | 001E3A: 317C C480 0102 move.w #$c480, ($102,A0) ;<-"" | |
| 770 | 001E40: 317C 0000 0010 move.w #$0, ($10,A0) ;<-"" | |
| 771 | 001E46: 302A 0002 move.w ($2,A2), D0 | |
| 772 | 001E4A: 816B 0006 or.w D0, ($6,A3) | |
| 773 | 001E4E: 45EA 0006 lea ($6,A2), A2 | |
| 774 | 001E52: 302B 0008 move.w ($8,A3), D0 | |
| 775 | 001E56: B079 0010 8112 cmp.w $108112.l, D0 | |
| 776 | 001E5C: 6E00 0054 bgt $1eb2 | |
| 777 | 001E60: B079 0010 8110 cmp.w $108110.l, D0 | |
| 778 | 001E66: 6D00 004A blt $1eb2 | |
| 779 | 001E6A: 026B 7FFF 000A andi.w #$7fff, ($a,A3) | |
| 780 | 001E70: 8B6B 0004 or.w D5, ($4,A3) | |
| 781 | 001E74: 47EB 0008 lea ($8,A3), A3 | |
| 782 | 001E78: 260B move.l A3, D3 | |
| 783 | 001E7A: 3143 00C8 move.w D3, ($c8,A0) | |
| 784 | 001E7E: 4843 swap D3 | |
| 785 | 001E80: 3143 00A8 move.w D3, ($a8,A0) | |
| 786 | 001E84: 5244 addq.w #1, D4 | |
| 787 | 001E86: B879 0010 8114 cmp.w $108114.l, D4 | |
| 788 | 001E8C: 6500 000C bcs $1e9a | |
| 789 | 001E90: 0069 0002 0002 ori.w #$2, ($2,A1) | |
| 790 | 001E96: 6000 000C bra $1ea4 | |
| 791 | //Note: I believe the above program is there just for protection copy | |
| 792 | 001E9A: 3028 01B0 move.w ($1b0,A0), D0 ;bit 1 = DMA job finished | |
| 793 | 001E9E: 0240 0002 andi.w #$2, D0 | |
| 794 | 001EA2: 6790 beq $1e34 | |
| 795 | 001EA4: 33C4 0010 810A move.w D4, $10810a.l | |
| 796 | 001EAA: 23CB 0010 8116 move.l A3, $108116.l | |
| 797 | 001EB0: 4E75 rts | |
| 798 | ||
| 799 | x/y check [2] | |
| 800 | 002030: E58D lsl.l #2, D5 | |
| 801 | 002032: 0685 0003 0000 addi.l #$30000, D5 | |
| 802 | 002038: 33C5 0010 04C4 move.w D5, $1004c4.l | |
| 803 | 00203E: 4845 swap D5 | |
| 804 | 002040: 33C5 0010 04A4 move.w D5, $1004a4.l | |
| 805 | 002046: E58E lsl.l #2, D6 | |
| 806 | 002048: 0686 0003 0000 addi.l #$30000, D6 | |
| 807 | 00204E: 33C6 0010 04C6 move.w D6, $1004c6.l | |
| 808 | 002054: 4846 swap D6 | |
| 809 | 002056: 33C6 0010 04A6 move.w D6, $1004a6.l | |
| 810 | 00205C: 33FC A180 0010 0500 move.w #$a180, $100500.l | |
| 811 | 002064: 33FC B100 0010 0500 move.w #$b100, $100500.l | |
| 812 | 00206C: 33FC A980 0010 0500 move.w #$a980, $100500.l | |
| 813 | 002074: 33FC B900 0010 0500 move.w #$b900, $100500.l | |
| 814 | 00207C: 4E75 rts | |
| 815 | [...] | |
| 816 | //then reads at $580 | |
| 817 | ||
| 818 | */ | |
| 819 | ||
| 820 | static UINT16 s_i; | |
| 821 | ||
| 822 | static void dma_transfer(void) | |
| 823 | { | |
| 824 | static UINT16 rel_xy; | |
| 825 | static UINT16 abs_x,abs_y; | |
| 826 | static UINT16 param; | |
| 827 | ||
| 828 | //for(s_i = dma_size;s_i > 0;s_i--) | |
| 829 | { | |
| 830 | /*Sprite Color*/ | |
| 831 | param = program_read_word(0x100400) & 0x3f; | |
| 832 | /*Write the entire parameters [offs+0]*/ | |
| 833 | program_write_word(dma_dst,program_read_word(dma_src) + param); | |
| 834 | /*Sprite Priority (guess)*/ | |
| 835 | //param = ((program_read_word(0x100400) & 0x40) ? 0x4000 : 0); | |
| 836 | /*Write the sprite number [offs+1]*/ | |
| 837 | program_write_word(dma_dst+2,program_read_word(dma_src+2)); | |
| 838 | /*Sprite Relative x/y coords*/ | |
| 839 | rel_xy = program_read_word(dma_src+4); /*???*/ | |
| 840 | /*temporary hardwired,it should point to 0x4c0/0x4a0*/ | |
| 841 | abs_x = (program_read_word(0x110008) - program_read_word(0x10048e)); | |
| 842 | abs_y = (program_read_word(0x110004) - program_read_word(0x10048c)); | |
| 843 | program_write_word(dma_dst+4,((rel_xy & 0x7f) + (abs_x) - ((rel_xy & 0x80) ? 0x80 : 0)) & 0x1ff); | |
| 844 | program_write_word(dma_dst+6,(((rel_xy & 0x7f00) >> 8) + (abs_y) + (0x10) - ((rel_xy & 0x8000) ? 0x80 : 0)) & 0x1ff); | |
| 845 | dma_dst+=8; | |
| 846 | dma_src+=6; | |
| 847 | } | |
| 848 | } | |
| 849 | ||
| 850 | ||
| 851 | /* | |
| 852 | switch(program_read_word(hit_check_x)) | |
| 853 | { | |
| 854 | case 0xb4: xparam = 0x0c/2; break; | |
| 855 | case 0xb8: xparam = 0x10/2; break; | |
| 856 | case 0xbc: xparam = 0x14/2; break; | |
| 857 | case 0xc0: xparam = 0x18/2; break; | |
| 858 | case 0xc4: xparam = 0x1c/2; break; | |
| 859 | case 0xd4: xparam = 0x20/2; break; | |
| 860 | ... | |
| 861 | case 0xb0: xparam = 0x08/2; | |
| 862 | case 0xac: xparam = 0x04/2; | |
| 863 | } | |
| 864 | */ | |
| 865 | static UINT16 check_calc(UINT16 param) | |
| 866 | { | |
| 867 | UINT16 num,i; | |
| 868 | ||
| 869 | i = param; | |
| 870 | i-=0xac; | |
| 871 | i/=4; | |
| 872 | num = (0x4/2); | |
| 873 | for(;i>0;i--) | |
| 874 | num+=(0x4/2); | |
| 875 | ||
| 876 | return num; | |
| 877 | } | |
| 878 | ||
| 879 | static UINT16 hit_check_jsr(void) | |
| 880 | { | |
| 881 | static INT16 xsrc,xdst,ysrc,ydst,xparam,yparam; | |
| 882 | xsrc = (program_read_word(0x110008)); | |
| 883 | ysrc = (program_read_word(0x110004)); | |
| 884 | xdst = (program_read_word(0x110048)); | |
| 885 | ydst = (program_read_word(0x110044)); | |
| 886 | ||
| 887 | /*Here we check the destination sprite width*/ | |
| 888 | /*0x4a4/0x4c4*/ | |
| 889 | xparam = check_calc(program_read_word(hit_check_x)); | |
| 890 | /*Here we check the destination sprite height*/ | |
| 891 | /*0x4a6/0x4c6*/ | |
| 892 | yparam = check_calc(program_read_word(hit_check_y)); | |
| 893 | ||
| 894 | if(!xparam || !yparam) | |
| 895 | popmessage("SRC:%04x %04x DST:%04x %04x V:%08x %08x",xsrc,ysrc,xdst,ydst,program_read_word(hit_check_x),program_read_word(hit_check_y)); | |
| 896 | if(xdst >= (xsrc-xparam) && ydst >= (ysrc-yparam) && | |
| 897 | xdst <= (xsrc+xparam) && ydst <= (ysrc+yparam)) | |
| 898 | return 0;//sprites collide | |
| 899 | else | |
| 900 | return 3;//sprites do not collide | |
| 901 | } | |
| 902 | ||
| 903 | #define UP 0xc0 | |
| 904 | #define UP_RIGHT 0xe0 | |
| 905 | #define RIGHT 0x00 | |
| 906 | #define DOWN_RIGHT 0x20 | |
| 907 | #define DOWN 0x40 | |
| 908 | #define DOWN_LEFT 0x60 | |
| 909 | #define LEFT 0x80 | |
| 910 | #define UP_LEFT 0xa0 | |
| 911 | ||
| 912 | /*Heated Barrel*/ | |
| 913 | /*command 0x8100 will check for the direction of the sprite*/ | |
| 914 | /*command 0x8900 will check the "point" movement*/ | |
| 915 | static void cop2_move3_prot(void) | |
| 916 | { | |
| 917 | static INT16 x_pl,x_en; | |
| 918 | static INT16 y_pl,y_en; | |
| 919 | static INT16 x_dis,y_dis; | |
| 920 | static INT16 dir,dis; | |
| 921 | x_pl = program_read_word(ram_addr[1]+0x8); | |
| 922 | x_en = program_read_word(ram_addr[0]+0x8); | |
| 923 | dis = ((program_read_word(ram_addr[0]+0x34) & 0xf0) >> 4); | |
| 924 | y_pl = program_read_word(ram_addr[1]+0x4); | |
| 925 | y_en = program_read_word(ram_addr[0]+0x4); | |
| 926 | ||
| 927 | /* | |
| 928 | xxxx ---- select the direction of the enemy sprite | |
| 929 | ||
| 930 | 0xc0 up | |
| 931 | up-left 0xa0 | 0xe0 up-right | |
| 932 | left 0x80 <-o-> 0x00 right | |
| 933 | down-left 0x60 | 0x20 down-right | |
| 934 | 0x40 down | |
| 935 | */ | |
| 936 | ||
| 937 | if(x_en >= x_pl) | |
| 938 | { | |
| 939 | if((y_en >= (y_pl-0x10)) && (y_en <= (y_pl+0x10))) | |
| 940 | dir = LEFT; | |
| 941 | else if(y_en < (y_pl-0x10)) | |
| 942 | dir = DOWN_LEFT; | |
| 943 | else if(y_en > (y_pl+0x10)) | |
| 944 | dir = UP_LEFT; | |
| 945 | } | |
| 946 | else if(x_en < x_pl) | |
| 947 | { | |
| 948 | if((y_en >= (y_pl-0x10)) && (y_en <= (y_pl+0x10))) | |
| 949 | dir = RIGHT; | |
| 950 | else if(y_en < (y_pl-0x10)) | |
| 951 | dir = DOWN_RIGHT; | |
| 952 | else if(y_en > (y_pl+0x10)) | |
| 953 | dir = UP_RIGHT; | |
| 954 | } | |
| 955 | /*UP DOWN cases*/ | |
| 956 | if((x_en >= (x_pl-0x10)) && (x_en <= (x_pl+0x10))) | |
| 957 | { | |
| 958 | if(y_en >= y_pl) | |
| 959 | dir = UP; | |
| 960 | else if(y_en < y_pl) | |
| 961 | dir = DOWN; | |
| 962 | } | |
| 963 | ||
| 964 | program_write_word(ram_addr[0]+0x36,dir); | |
| 965 | ||
| 966 | /*TODO*/ | |
| 967 | x_dis = (x_pl-x_en); | |
| 968 | y_dis = (y_pl-y_en); | |
| 969 | ||
| 970 | if(x_dis > 4) | |
| 971 | x_dis = 4; | |
| 972 | ||
| 973 | if(x_dis < -4) | |
| 974 | x_dis = -4; | |
| 975 | ||
| 976 | if(y_dis > 4) | |
| 977 | y_dis = 4; | |
| 978 | ||
| 979 | if(y_dis < -4) | |
| 980 | y_dis = -4; | |
| 981 | ||
| 982 | //if(y_en > y_pl) | |
| 983 | // y_dis^=0xffff; | |
| 984 | ||
| 985 | //if(x_en > x_pl) | |
| 986 | // x_dis^=0xffff; | |
| 987 | ||
| 988 | program_write_word(ram_addr[0]+0x10,y_dis); | |
| 989 | program_write_word(ram_addr[0]+0x14,x_dis); | |
| 990 | } | |
| 991 | ||
| 992 | /**/ | |
| 993 | static UINT16 cop2_hit_prot(void) | |
| 994 | { | |
| 995 | static INT16 xsrc,xdst; | |
| 996 | static INT16 ysrc,ydst; | |
| 997 | static INT16 xp,yp; | |
| 998 | static INT16 param1,param2; | |
| 999 | static INT16 val; | |
| 1000 | ||
| 1001 | param1 = program_read_word(rom_addr[0]); | |
| 1002 | param2 = program_read_word(rom_addr[1]); | |
| 1003 | ||
| 1004 | xsrc = program_read_word(ram_addr[0]+0x8) + program_read_word(ram_addr[0]+0x14); | |
| 1005 | ysrc = program_read_word(ram_addr[0]+0x4) + program_read_word(ram_addr[0]+0x10); | |
| 1006 | xdst = program_read_word(ram_addr[1]+0x8) + program_read_word(ram_addr[1]+0x14); | |
| 1007 | ydst = program_read_word(ram_addr[1]+0x4) + program_read_word(ram_addr[1]+0x10); | |
| 1008 | ||
| 1009 | // xp = (param1 & 0x00f0) >> 4; | |
| 1010 | // yp = (param1 & 0x0f00) >> 8; | |
| 1011 | ||
| 1012 | // popmessage("%04x %04x",param1,param2); | |
| 1013 | ||
| 1014 | xp = 0; | |
| 1015 | yp = 0; | |
| 1016 | for(val = ((param1 & 0xff0) >> 4); val > 0; val-=5) | |
| 1017 | xp++; | |
| 1018 | ||
| 1019 | for(val = ((param1 & 0xff0) >> 4); val > 0; val-=3) | |
| 1020 | yp++; | |
| 1021 | ||
| 1022 | /*TODO*/ | |
| 1023 | // xp+=4; | |
| 1024 | // yp+=4; | |
| 1025 | ||
| 1026 | if(xsrc >= xdst && xsrc <= xdst+xp && ysrc >= xdst && ysrc <= ydst+yp) | |
| 1027 | return 0; | |
| 1028 | else | |
| 1029 | return 3; | |
| 1030 | } | |
| 1031 | ||
| 1032 | static void cop2_move2_prot(void) | |
| 1033 | { | |
| 1034 | static INT16 xsrc,ysrc; | |
| 1035 | static INT16 param2; | |
| 1036 | ||
| 1037 | xsrc = program_read_word(ram_addr[0]+0x14); | |
| 1038 | ysrc = program_read_word(ram_addr[0]+0x10); | |
| 1039 | param2 = program_read_word(rom_addr[1]); | |
| 1040 | ||
| 1041 | switch(param2) | |
| 1042 | { | |
| 1043 | case 0x10: xsrc++; break; //right | |
| 1044 | case 0x30: xsrc--; break; //left | |
| 1045 | case 0x40: ysrc--; break; //up | |
| 1046 | case 0x60: ysrc++; break; //down | |
| 1047 | case 0x08: ysrc--; xsrc++; break; //up-right | |
| 1048 | case 0x38: ysrc--; xsrc--; break; //up-left | |
| 1049 | case 0x28: ysrc++; xsrc--; break; //down-left | |
| 1050 | case 0x18: ysrc++; xsrc++; break; //down-right | |
| 1051 | } | |
| 1052 | ||
| 1053 | program_write_word(ram_addr[0]+0x14,xsrc); | |
| 1054 | program_write_word(ram_addr[0]+0x10,ysrc); | |
| 1055 | } | |
| 1056 | ||
| 1057 | ||
| 1058 | static READ16_HANDLER( cop2_mcu_r ) | |
| 1059 | { | |
| 1060 | switch (offset) | |
| 1061 | { | |
| 1062 | /* Protection is not understood */ | |
| 1063 | ||
| 1064 | /*hit protection*/ | |
| 1065 | case (0x580/2): | |
| 1066 | { | |
| 1067 | return xy_check; | |
| 1068 | } | |
| 1069 | case (0x582/2): | |
| 1070 | { | |
| 1071 | if(input_code_pressed(KEYCODE_X)) | |
| 1072 | return 0;//xy_check; | |
| 1073 | else | |
| 1074 | return 3; | |
| 1075 | } | |
| 1076 | case (0x584/2): | |
| 1077 | { | |
| 1078 | /*---- ---- ---- --xx used bits*/ | |
| 1079 | //if(!xy_check) | |
| 1080 | //{ | |
| 1081 | // xy_check = 3; | |
| 1082 | // return 0; | |
| 1083 | //} | |
| 1084 | //else return 3; | |
| 1085 | if(input_code_pressed(KEYCODE_C)) | |
| 1086 | return 0;//xy_check; | |
| 1087 | else | |
| 1088 | return 3; | |
| 1089 | } | |
| 1090 | ||
| 1091 | /*number protection*/ | |
| 1092 | case (0x590/2): | |
| 1093 | { | |
| 1094 | /*BCD read*/ | |
| 1095 | return (prot_bcd[0] & 0xffff) + 0x3030; | |
| 1096 | } | |
| 1097 | case (0x592/2): | |
| 1098 | { | |
| 1099 | return ((prot_bcd[0] & 0xffff0000) >> 16) + 0x3030; | |
| 1100 | } | |
| 1101 | case (0x594/2): | |
| 1102 | { | |
| 1103 | return (prot_bcd[1] & 0xffff) + 0x3030; | |
| 1104 | } | |
| 1105 | case (0x596/2): | |
| 1106 | { | |
| 1107 | return ((prot_bcd[1] & 0xffff0000) >> 16) + 0x3030; | |
| 1108 | } | |
| 1109 | case (0x598/2): | |
| 1110 | { | |
| 1111 | return (prot_bcd[2] & 0xffff) + 0x3030; | |
| 1112 | } | |
| 1113 | case (0x59a/2): | |
| 1114 | { | |
| 1115 | return ((prot_bcd[2] & 0xffff0000) >> 16) + 0x3030; | |
| 1116 | } | |
| 1117 | case (0x59c/2): | |
| 1118 | { | |
| 1119 | return 0x3030; | |
| 1120 | } | |
| 1121 | ||
| 1122 | case (0x5b0/2): /* bit 15 is branched on a few times in the $1938 area */ | |
| 1123 | return (mcu_ram[offset]); | |
| 1124 | ||
| 1125 | case (0x5b4/2): /* read at $1932 and stored in ram before +0x5b0 bit 15 tested */ | |
| 1126 | return (0); | |
| 1127 | ||
| 1128 | /* Non-protection reads */ | |
| 1129 | ||
| 1130 | case (0x7c8/2): /* seibu sound */ | |
| 1131 | return seibu_main_word_r(machine,2,0); | |
| 1132 | ||
| 1133 | case (0x7cc/2): | |
| 1134 | return seibu_main_word_r(machine,3,0); | |
| 1135 | ||
| 1136 | case (0x7d4/2): | |
| 1137 | return seibu_main_word_r(machine,5,0); | |
| 1138 | ||
| 1139 | /* Inputs */ | |
| 1140 | ||
| 1141 | case (0x740/2): | |
| 1142 | return input_port_1_word_r(machine,0,0); | |
| 1143 | ||
| 1144 | case (0x744/2): | |
| 1145 | return input_port_2_word_r(machine,0,0); | |
| 1146 | ||
| 1147 | case (0x748/2): | |
| 1148 | return input_port_4_word_r(machine,0,0); | |
| 1149 | ||
| 1150 | case (0x74c/2): | |
| 1151 | return input_port_3_word_r(machine,0,0); | |
| 1152 | ||
| 1153 | } | |
| 1154 | //logerror("CPU0 PC %06x unknown MCU read offset: %04x\n",activecpu_get_previouspc(),offset); | |
| 1155 | ||
| 1156 | return mcu_ram[offset]; | |
| 1157 | } | |
| 1158 | ||
| 1159 | static WRITE16_HANDLER( cop2_mcu_w ) | |
| 1160 | { | |
| 1161 | COMBINE_DATA(&mcu_ram[offset]); | |
| 1162 | ||
| 1163 | switch (offset) | |
| 1164 | { | |
| 1165 | case (0x470/2): | |
| 1166 | { | |
| 1167 | heatbrl_setgfxbank( mcu_ram[offset] ); | |
| 1168 | break; | |
| 1169 | } | |
| 1170 | ||
| 1171 | /*"Number protection" sub-routine*/ | |
| 1172 | case (0x420/2): | |
| 1173 | { | |
| 1174 | //coin counter write | |
| 1175 | //popmessage("%04x",mcu_ram[offset]); | |
| 1176 | prot_bcd[0] = protection_bcd_jsr(mcu_ram[offset]); | |
| 1177 | //prot_bcd = mcu_ram[offset] - 0x22; | |
| 1178 | break; | |
| 1179 | } | |
| 1180 | case (0x422/2): | |
| 1181 | { | |
| 1182 | prot_bcd[1] = protection_bcd_jsr(mcu_ram[offset]); | |
| 1183 | break; | |
| 1184 | } | |
| 1185 | ||
| 1186 | case (0x478/2): | |
| 1187 | { | |
| 1188 | static UINT16 i; | |
| 1189 | /* | |
| 1190 | AM_RANGE(0x100800, 0x100fff) AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 1191 | AM_RANGE(0x101000, 0x1017ff) AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 1192 | AM_RANGE(0x101800, 0x101fff) AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 1193 | AM_RANGE(0x102000, 0x102fff) AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 1194 | */ | |
| 1195 | switch(mcu_ram[offset]) | |
| 1196 | { | |
| 1197 | /*layer clearance*/ | |
| 1198 | case 0x4080: | |
| 1199 | /*text layer*/ | |
| 1200 | for(i=0;i<0x1000;i+=2) | |
| 1201 | program_write_word(i+0x102000,0x0000); | |
| 1202 | /*background layer*/ | |
| 1203 | for(i=0;i<0x800;i+=2) | |
| 1204 | program_write_word(i+0x100800,0x0000); | |
| 1205 | break; | |
| 1206 | case 0x4100: break; | |
| 1207 | case 0x41c0: break; | |
| 1208 | //default: popmessage("%04x",mcu_ram[offset]); | |
| 1209 | } | |
| 1210 | break; | |
| 1211 | } | |
| 1212 | ||
| 1213 | /*sprite ram clear(Guess)*/ | |
| 1214 | case (0x47e/2): | |
| 1215 | { | |
| 1216 | static UINT16 i; | |
| 1217 | if(mcu_ram[0x47e/2] == 0x118) | |
| 1218 | { | |
| 1219 | for(i=0;i<0x800;i+=2) | |
| 1220 | program_write_word((0x103000 | i),0x0000); | |
| 1221 | } | |
| 1222 | break; | |
| 1223 | } | |
| 1224 | ||
| 1225 | // 65a bit 0 is flipscreen | |
| 1226 | // 65c probably layer disables, like Dcon? Used on screen when you press P1-4 start (values 13, 11, 0 seen) | |
| 1227 | // 660 - 66a scroll control; is there a layer priority switch...? | |
| 1228 | case (0x4c0/2): | |
| 1229 | { | |
| 1230 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 1231 | prot_data[0] = mcu_ram[offset]; | |
| 1232 | ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1233 | break; | |
| 1234 | } | |
| 1235 | ||
| 1236 | case (0x4a0/2): | |
| 1237 | { | |
| 1238 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 1239 | prot_data[1] = mcu_ram[offset]; | |
| 1240 | ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1241 | break; | |
| 1242 | } | |
| 1243 | ||
| 1244 | case (0x4c2/2): | |
| 1245 | { | |
| 1246 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 1247 | prot_data[0] = mcu_ram[offset]; | |
| 1248 | ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1249 | break; | |
| 1250 | } | |
| 1251 | ||
| 1252 | case (0x4a2/2): | |
| 1253 | { | |
| 1254 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 1255 | prot_data[1] = mcu_ram[offset]; | |
| 1256 | ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1257 | break; | |
| 1258 | } | |
| 1259 | ||
| 1260 | ||
| 1261 | /*Hit Check x address*/ | |
| 1262 | case (0x4c4/2): | |
| 1263 | { | |
| 1264 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 1265 | prot_data[0] = mcu_ram[offset]; | |
| 1266 | rom_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1267 | break; | |
| 1268 | } | |
| 1269 | ||
| 1270 | case (0x4a4/2): | |
| 1271 | { | |
| 1272 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 1273 | prot_data[1] = mcu_ram[offset]; | |
| 1274 | rom_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1275 | break; | |
| 1276 | } | |
| 1277 | ||
| 1278 | /*Hit Check y address*/ | |
| 1279 | case (0x4c6/2): | |
| 1280 | { | |
| 1281 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 1282 | prot_data[0] = mcu_ram[offset]; | |
| 1283 | rom_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1284 | break; | |
| 1285 | } | |
| 1286 | ||
| 1287 | case (0x4a6/2): | |
| 1288 | { | |
| 1289 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 1290 | prot_data[1] = mcu_ram[offset]; | |
| 1291 | rom_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1292 | break; | |
| 1293 | } | |
| 1294 | ||
| 1295 | case (0x500/2): | |
| 1296 | { | |
| 1297 | switch(mcu_ram[0x500/2]) | |
| 1298 | { | |
| 1299 | case 0x8100: | |
| 1300 | break; | |
| 1301 | case 0x8900: | |
| 1302 | { | |
| 1303 | cop2_move3_prot(); | |
| 1304 | break; | |
| 1305 | } | |
| 1306 | case 0x205: | |
| 1307 | { | |
| 1308 | cop2_move2_prot(); | |
| 1309 | break; | |
| 1310 | } | |
| 1311 | case 0xa100: | |
| 1312 | break; | |
| 1313 | case 0xb080: | |
| 1314 | break; | |
| 1315 | case 0xa900: | |
| 1316 | break; | |
| 1317 | case 0xb880: | |
| 1318 | { | |
| 1319 | xy_check = cop2_hit_prot(); | |
| 1320 | break; | |
| 1321 | } | |
| 1322 | default: | |
| 1323 | logerror("DMA CMD 0x500 with parameter = %04x PC = %08x\n",mcu_ram[offset],activecpu_get_previouspc()); | |
| 1324 | } | |
| 1325 | break; | |
| 1326 | } | |
| 1327 | ||
| 1328 | ||
| 1329 | case (0x660/2): | |
| 1330 | { | |
| 1331 | legionna_scrollram16[0] = mcu_ram[offset]; | |
| 1332 | break; | |
| 1333 | } | |
| 1334 | case (0x662/2): | |
| 1335 | { | |
| 1336 | legionna_scrollram16[1] = mcu_ram[offset]; | |
| 1337 | break; | |
| 1338 | } | |
| 1339 | case (0x664/2): | |
| 1340 | { | |
| 1341 | legionna_scrollram16[2] = mcu_ram[offset]; | |
| 1342 | break; | |
| 1343 | } | |
| 1344 | case (0x666/2): | |
| 1345 | { | |
| 1346 | legionna_scrollram16[3] = mcu_ram[offset]; | |
| 1347 | break; | |
| 1348 | } | |
| 1349 | case (0x668/2): | |
| 1350 | { | |
| 1351 | legionna_scrollram16[4] = mcu_ram[offset]; | |
| 1352 | break; | |
| 1353 | } | |
| 1354 | case (0x66a/2): | |
| 1355 | { | |
| 1356 | legionna_scrollram16[5] = mcu_ram[offset]; | |
| 1357 | break; | |
| 1358 | } | |
| 1359 | case (0x7c0/2): /* seibu(0) */ | |
| 1360 | { | |
| 1361 | seibu_main_word_w(machine,0,mcu_ram[offset],0xff00); | |
| 1362 | break; | |
| 1363 | } | |
| 1364 | case (0x7c4/2): /* seibu(1) */ | |
| 1365 | { | |
| 1366 | seibu_main_word_w(machine,1,mcu_ram[offset],0xff00); | |
| 1367 | break; | |
| 1368 | } | |
| 1369 | case (0x7d0/2): /* seibu(4) */ | |
| 1370 | { | |
| 1371 | seibu_main_word_w(machine,4,mcu_ram[offset],0xff00); | |
| 1372 | break; | |
| 1373 | } | |
| 1374 | case (0x7d8/2): /* seibu(6) */ | |
| 1375 | { | |
| 1376 | seibu_main_word_w(machine,6,mcu_ram[offset],0xff00); | |
| 1377 | break; | |
| 1378 | } | |
| 1379 | default: | |
| 1380 | logerror("CPU0 PC %06x unknown MCU write offset: %04x data: %04x\n",activecpu_get_previouspc(),offset,data); | |
| 1381 | } | |
| 1382 | } | |
| 1383 | ||
| 1384 | ||
| 1385 | static READ16_HANDLER( sdgndmrb_cop_mcu_r ) | |
| 1386 | { | |
| 1387 | switch (offset) | |
| 1388 | { | |
| 1389 | /*hit protection*/ | |
| 1390 | case (0x580/2): | |
| 1391 | { | |
| 1392 | /*PC=ce96*/ | |
| 1393 | /*---- ---- ---- --xx used bits*/ | |
| 1394 | //if(!xy_check) | |
| 1395 | //{ | |
| 1396 | // xy_check = 3; | |
| 1397 | // return 0; | |
| 1398 | //} | |
| 1399 | //else return 3; | |
| 1400 | return xy_check; | |
| 1401 | } | |
| 1402 | ||
| 1403 | /*number protection*/ | |
| 1404 | case (0x590/2): | |
| 1405 | { | |
| 1406 | /*BCD read*/ | |
| 1407 | return (prot_bcd[0] & 0xffff) + 0x3030; | |
| 1408 | } | |
| 1409 | case (0x592/2): | |
| 1410 | { | |
| 1411 | return ((prot_bcd[0] & 0xffff0000) >> 16) + 0x3030; | |
| 1412 | } | |
| 1413 | case (0x594/2): | |
| 1414 | { | |
| 1415 | return (prot_bcd[1] & 0xffff) + 0x3030; | |
| 1416 | } | |
| 1417 | case (0x596/2): | |
| 1418 | { | |
| 1419 | return ((prot_bcd[1] & 0xffff0000) >> 16) + 0x3030; | |
| 1420 | } | |
| 1421 | case (0x598/2): | |
| 1422 | { | |
| 1423 | return (prot_bcd[2] & 0xffff) + 0x3030; | |
| 1424 | } | |
| 1425 | case (0x59a/2): | |
| 1426 | { | |
| 1427 | return ((prot_bcd[2] & 0xffff0000) >> 16) + 0x3030; | |
| 1428 | } | |
| 1429 | case (0x59c/2): | |
| 1430 | { | |
| 1431 | return 0x3030; | |
| 1432 | } | |
| 1433 | ||
| 1434 | case (0x5b0/2): | |
| 1435 | /*check if the DMA has been finished*/ | |
| 1436 | if(dma_status == 1) | |
| 1437 | { | |
| 1438 | dma_status = 0; | |
| 1439 | return 2; | |
| 1440 | } | |
| 1441 | return mcu_ram[offset]; | |
| 1442 | ||
| 1443 | /* Non-protection reads */ | |
| 1444 | case (0x708/2): /* seibu sound */ | |
| 1445 | return seibu_main_word_r(machine,2,0); | |
| 1446 | ||
| 1447 | case (0x70c/2): | |
| 1448 | return seibu_main_word_r(machine,3,0); | |
| 1449 | ||
| 1450 | case (0x714/2): | |
| 1451 | return seibu_main_word_r(machine,5,0); | |
| 1452 | ||
| 1453 | /* Inputs */ | |
| 1454 | ||
| 1455 | case (0x740/2): | |
| 1456 | return input_port_1_word_r(machine,0,0); | |
| 1457 | ||
| 1458 | case (0x744/2): | |
| 1459 | return input_port_2_word_r(machine,0,0); | |
| 1460 | ||
| 1461 | case (0x748/2): | |
| 1462 | return input_port_4_word_r(machine,0,0); | |
| 1463 | ||
| 1464 | case (0x74c/2): | |
| 1465 | return input_port_3_word_r(machine,0,0); | |
| 1466 | ||
| 1467 | case (0x75c/2): | |
| 1468 | return input_port_5_word_r(machine,0,0); | |
| 1469 | } | |
| 1470 | // return mame_rand(Machine); | |
| 1471 | if(offset > (0x500/2) && offset < (0x600/2)) | |
| 1472 | { | |
| 1473 | logerror("CPU0 PC %06x MCU read offset: %04x\n",activecpu_get_previouspc(),offset*2); | |
| 1474 | //popmessage("PC %06x MCU read: %04x",activecpu_get_previouspc(),offset*2); | |
| 1475 | } | |
| 1476 | ||
| 1477 | return mcu_ram[offset]; | |
| 1478 | } | |
| 1479 | ||
| 1480 | static WRITE16_HANDLER( sdgndmrb_cop_mcu_w ) | |
| 1481 | { | |
| 1482 | COMBINE_DATA(&mcu_ram[offset]); | |
| 1483 | ||
| 1484 | switch (offset) | |
| 1485 | { | |
| 1486 | case (0x478/2): | |
| 1487 | { | |
| 1488 | static UINT16 i; | |
| 1489 | /* | |
| 1490 | AM_RANGE(0x100800, 0x100fff) AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 1491 | AM_RANGE(0x101000, 0x1017ff) AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 1492 | AM_RANGE(0x101800, 0x101fff) AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 1493 | AM_RANGE(0x102000, 0x102fff) AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 1494 | */ | |
| 1495 | switch(mcu_ram[offset]) | |
| 1496 | { | |
| 1497 | /*txt layer clearance*/ | |
| 1498 | case 0x4080: | |
| 1499 | for(i=0;i<0x1000;i+=2) | |
| 1500 | program_write_word(i+0x102000,0x0000); | |
| 1501 | break; | |
| 1502 | case 0x4100: break; | |
| 1503 | case 0x41c0: break; | |
| 1504 | //default: popmessage("%04x",mcu_ram[offset]); | |
| 1505 | } | |
| 1506 | break; | |
| 1507 | } | |
| 1508 | ||
| 1509 | /*The following two transfers the index of the work ram that should be picked up, | |
| 1510 | Both of them are united into one index of 32-bits*/ | |
| 1511 | ||
| 1512 | /*DMA source address*/ | |
| 1513 | case (0x414/2): | |
| 1514 | { | |
| 1515 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 1516 | prot_data[0] = mcu_ram[offset]; | |
| 1517 | dma_src = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1518 | break; | |
| 1519 | } | |
| 1520 | ||
| 1521 | case (0x412/2): | |
| 1522 | { | |
| 1523 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 1524 | prot_data[1] = mcu_ram[offset]; | |
| 1525 | dma_src = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1526 | break; | |
| 1527 | } | |
| 1528 | ||
| 1529 | case (0x4c0/2): | |
| 1530 | { | |
| 1531 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 1532 | prot_data[0] = mcu_ram[offset]; | |
| 1533 | ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1534 | break; | |
| 1535 | } | |
| 1536 | ||
| 1537 | case (0x4a0/2): | |
| 1538 | { | |
| 1539 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 1540 | prot_data[1] = mcu_ram[offset]; | |
| 1541 | ram_addr[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1542 | break; | |
| 1543 | } | |
| 1544 | ||
| 1545 | case (0x4c2/2): | |
| 1546 | { | |
| 1547 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 1548 | prot_data[0] = mcu_ram[offset]; | |
| 1549 | ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1550 | break; | |
| 1551 | } | |
| 1552 | ||
| 1553 | case (0x4a2/2): | |
| 1554 | { | |
| 1555 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 1556 | prot_data[1] = mcu_ram[offset]; | |
| 1557 | ram_addr[1] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1558 | break; | |
| 1559 | } | |
| 1560 | ||
| 1561 | ||
| 1562 | /*Hit Check x address*/ | |
| 1563 | case (0x4c4/2): | |
| 1564 | { | |
| 1565 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 1566 | prot_data[0] = mcu_ram[offset]; | |
| 1567 | hit_check_x = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1568 | break; | |
| 1569 | } | |
| 1570 | ||
| 1571 | case (0x4a4/2): | |
| 1572 | { | |
| 1573 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 1574 | prot_data[1] = mcu_ram[offset]; | |
| 1575 | hit_check_x = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1576 | break; | |
| 1577 | } | |
| 1578 | ||
| 1579 | /*Hit Check y address*/ | |
| 1580 | case (0x4c6/2): | |
| 1581 | { | |
| 1582 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 1583 | prot_data[0] = mcu_ram[offset]; | |
| 1584 | hit_check_y = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1585 | break; | |
| 1586 | } | |
| 1587 | ||
| 1588 | case (0x4a6/2): | |
| 1589 | { | |
| 1590 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 1591 | prot_data[1] = mcu_ram[offset]; | |
| 1592 | hit_check_y = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 1593 | break; | |
| 1594 | } | |
| 1595 | ||
| 1596 | /*DMA destination address*/ | |
| 1597 | case (0x4c8/2): | |
| 1598 | { | |
| 1599 | /*---- ---- ---- ---- xxxx xxxx xxxx xxxx*/ | |
| 1600 | prot_data[0] = mcu_ram[offset]; | |
| 1601 | dma_dst = ((prot_data[0]&0xffff)+4)|((prot_data[1]&0xffff)<<16); | |
| 1602 | break; | |
| 1603 | } | |
| 1604 | ||
| 1605 | case (0x4a8/2): | |
| 1606 | { | |
| 1607 | /*xxxx xxxx xxxx xxxx ---- ---- ---- ----*/ | |
| 1608 | prot_data[1] = mcu_ram[offset]; | |
| 1609 | dma_dst = ((prot_data[0]&0xffff)+4)|((prot_data[1]&0xffff)<<16); | |
| 1610 | break; | |
| 1611 | } | |
| 1612 | ||
| 1613 | /*"Number protection" sub-routine*/ | |
| 1614 | case (0x420/2): | |
| 1615 | { | |
| 1616 | //coin counter write | |
| 1617 | //popmessage("%04x",mcu_ram[offset]); | |
| 1618 | prot_bcd[0] = protection_bcd_jsr(mcu_ram[offset]); | |
| 1619 | //prot_bcd = mcu_ram[offset] - 0x22; | |
| 1620 | break; | |
| 1621 | } | |
| 1622 | ||
| 1623 | case (0x422/2): | |
| 1624 | { | |
| 1625 | prot_bcd[1] = protection_bcd_jsr(mcu_ram[offset]); | |
| 1626 | break; | |
| 1627 | } | |
| 1628 | ||
| 1629 | case (0x424/2): | |
| 1630 | { | |
| 1631 | prot_bcd[2] = protection_bcd_jsr(mcu_ram[offset]); | |
| 1632 | break; | |
| 1633 | } | |
| 1634 | ||
| 1635 | /*sprite ram clear(Guess)*/ | |
| 1636 | case (0x47e/2): | |
| 1637 | { | |
| 1638 | static UINT16 i; | |
| 1639 | if(mcu_ram[0x47e/2] == 0x118) | |
| 1640 | { | |
| 1641 | for(i=0;i<0x800;i+=2) | |
| 1642 | program_write_word((0x107000 | i),0x0000); | |
| 1643 | } | |
| 1644 | break; | |
| 1645 | } | |
| 1646 | ||
| 1647 | case (0x40c/2): | |
| 1648 | { | |
| 1649 | dma_size = mcu_ram[offset]; | |
| 1650 | break; | |
| 1651 | } | |
| 1652 | ||
| 1653 | case (0x500/2): | |
| 1654 | { | |
| 1655 | switch(mcu_ram[0x500/2]) | |
| 1656 | { | |
| 1657 | case 0xa180:/*do the job [1]*/ | |
| 1658 | { | |
| 1659 | //popmessage("%08x %08x %04x",dma_src,dma_dst,dma_size); | |
| 1660 | /*fix the offset for easier reading*/ | |
| 1661 | dma_src+=4; | |
| 1662 | //dma_dst+=4; | |
| 1663 | s_i = dma_size; | |
| 1664 | //dma_dst+=((program_read_word(0x110000) & 0x000f) * 8); | |
| 1665 | //program_write_word(0x1004c8,dma_dst & 0xffff); | |
| 1666 | //dma_status = 1; | |
| 1667 | break; | |
| 1668 | } | |
| 1669 | case 0xb100: | |
| 1670 | break; | |
| 1671 | case 0xa980: | |
| 1672 | break; | |
| 1673 | case 0xb900: | |
| 1674 | { | |
| 1675 | xy_check = hit_check_jsr(); | |
| 1676 | break; | |
| 1677 | } | |
| 1678 | /*bullet movement protection,conflicts with [3],will be worked out*/ | |
| 1679 | case 0x8100: | |
| 1680 | { | |
| 1681 | //move3x_prot_jsr(); | |
| 1682 | break; | |
| 1683 | } | |
| 1684 | case 0x8900: | |
| 1685 | { | |
| 1686 | //move3y_prot_jsr(); | |
| 1687 | break; | |
| 1688 | } | |
| 1689 | case 0x0205:/*do the job [3]*/ | |
| 1690 | { | |
| 1691 | moveprot_jsr(); | |
| 1692 | break; | |
| 1693 | } | |
| 1694 | case 0x138e:/*do the job [4]*/ | |
| 1695 | break; | |
| 1696 | case 0x3bb0: | |
| 1697 | { | |
| 1698 | move2prot_jsr(); | |
| 1699 | break; | |
| 1700 | } | |
| 1701 | default: | |
| 1702 | logerror("DMA CMD 0x500 with parameter = %04x PC = %08x\n",mcu_ram[offset],activecpu_get_previouspc()); | |
| 1703 | } | |
| 1704 | break; | |
| 1705 | } | |
| 1706 | ||
| 1707 | case (0x502/2): | |
| 1708 | { | |
| 1709 | if(mcu_ram[0x502/2] == 0xc480) | |
| 1710 | { | |
| 1711 | dma_transfer(); | |
| 1712 | s_i--; | |
| 1713 | if(s_i == 0) | |
| 1714 | dma_status = 1; | |
| 1715 | } | |
| 1716 | break; | |
| 1717 | } | |
| 1718 | ||
| 1719 | /* TODO: tilemaps x-axis are offset,we use a temporary kludge for now */ | |
| 1720 | case (0x620/2): | |
| 1721 | { | |
| 1722 | legionna_scrollram16[0] = 0x10 + mcu_ram[offset]; | |
| 1723 | break; | |
| 1724 | } | |
| 1725 | case (0x622/2): | |
| 1726 | { | |
| 1727 | legionna_scrollram16[1] = mcu_ram[offset]; | |
| 1728 | break; | |
| 1729 | } | |
| 1730 | case (0x624/2): | |
| 1731 | { | |
| 1732 | legionna_scrollram16[2] = 0x10 + mcu_ram[offset]; | |
| 1733 | break; | |
| 1734 | } | |
| 1735 | case (0x626/2): | |
| 1736 | { | |
| 1737 | legionna_scrollram16[3] = mcu_ram[offset]; | |
| 1738 | break; | |
| 1739 | } | |
| 1740 | case (0x628/2): | |
| 1741 | { | |
| 1742 | legionna_scrollram16[4] = 0x10 + mcu_ram[offset]; | |
| 1743 | break; | |
| 1744 | } | |
| 1745 | case (0x62a/2): | |
| 1746 | { | |
| 1747 | legionna_scrollram16[5] = mcu_ram[offset]; | |
| 1748 | break; | |
| 1749 | } | |
| 1750 | /* scroll mirrors? */ | |
| 1751 | case (0x62c/2): | |
| 1752 | case (0x62e/2): | |
| 1753 | case (0x630/2): | |
| 1754 | case (0x632/2): | |
| 1755 | case (0x634/2): | |
| 1756 | case (0x636/2): | |
| 1757 | break; | |
| 1758 | /*Layer Enable,bit wise active low*/ | |
| 1759 | case (0x61c/2): | |
| 1760 | { | |
| 1761 | /* | |
| 1762 | ---x ---- (used in test mode) | |
| 1763 | ---- x--- Text Layer | |
| 1764 | ---- -x-- Foreground Layer | |
| 1765 | ---- --x- Midground Layer | |
| 1766 | ---- ---x Background Layer | |
| 1767 | */ | |
| 1768 | sdgndmrb_pri_n = mcu_ram[offset] & 0xf; | |
| 1769 | break; | |
| 1770 | } | |
| 1771 | ||
| 1772 | /* Text Layer scroll registers */ | |
| 1773 | case (0x638/2): | |
| 1774 | { | |
| 1775 | legionna_scrollram16[6] = 0x38 + mcu_ram[offset]; | |
| 1776 | break; | |
| 1777 | } | |
| 1778 | case (0x63a/2): | |
| 1779 | { | |
| 1780 | legionna_scrollram16[7] = mcu_ram[offset]; | |
| 1781 | break; | |
| 1782 | } | |
| 1783 | /*C.R.T. Controller (note:game calls it OBJ register)*/ | |
| 1784 | case (0x644/2): | |
| 1785 | { | |
| 1786 | /* | |
| 1787 | data = setting | |
| 1788 | 0x01e = 320x256 | |
| 1789 | 0x0e1 = 320x256 REVERSE | |
| 1790 | 0x016 = 320x240 | |
| 1791 | 0x0e9 = 320x240 REVERSE | |
| 1792 | 0x004 = 320x224 | |
| 1793 | 0x10b = 320x224 REVERSE | |
| 1794 | It is like to be per cases and not per bits. | |
| 1795 | */ | |
| 1796 | switch(data) | |
| 1797 | { | |
| 1798 | case 0x0000: | |
| 1799 | case 0x0003: | |
| 1800 | case 0x001e: CRT_MODE(320,224,0); break; | |
| 1801 | case 0x00e1: CRT_MODE(320,224,1); break; | |
| 1802 | case 0x0016: CRT_MODE(320,256,0); break; | |
| 1803 | case 0x00e9: CRT_MODE(320,256,1); break; | |
| 1804 | case 0x0004: CRT_MODE(320,240,0); break; | |
| 1805 | case 0x00fb: CRT_MODE(320,240,1); break; | |
| 1806 | default: | |
| 1807 | #ifdef MAME_DEBUG | |
| 1808 | popmessage("Warning: Undefined CRT Mode %04x",data); | |
| 1809 | #endif | |
| 1810 | CRT_MODE(320,256,0); | |
| 1811 | } | |
| 1812 | } | |
| 1813 | break; | |
| 1814 | ||
| 1815 | /* Seems a mirror for the choices in the test menu... */ | |
| 1816 | case (0x67c/2): | |
| 1817 | case (0x680/2): | |
| 1818 | break; | |
| 1819 | case (0x6fc/2): | |
| 1820 | break; | |
| 1821 | ||
| 1822 | case (0x700/2): /* seibu(0) */ | |
| 1823 | { | |
| 1824 | seibu_main_word_w(machine,0,mcu_ram[offset],0xff00); | |
| 1825 | break; | |
| 1826 | } | |
| 1827 | case (0x704/2): /* seibu(1) */ | |
| 1828 | { | |
| 1829 | seibu_main_word_w(machine,1,mcu_ram[offset],0xff00); | |
| 1830 | break; | |
| 1831 | } | |
| 1832 | case (0x710/2): /* seibu(4) */ | |
| 1833 | { | |
| 1834 | seibu_main_word_w(machine,4,mcu_ram[offset],0xff00); | |
| 1835 | break; | |
| 1836 | } | |
| 1837 | case (0x718/2): /* seibu(6) */ | |
| 1838 | { | |
| 1839 | seibu_main_word_w(machine,6,mcu_ram[offset],0xff00); | |
| 1840 | break; | |
| 1841 | } | |
| 1842 | ||
| 1843 | // default: | |
| 1844 | // logerror("CPU0 PC %06x MCU write offset: %04x data: %04x\n",activecpu_get_previouspc(),offset*2,data); | |
| 1845 | // popmessage("CPU0 PC %06x MCU write offset: %04x data: %04x",activecpu_get_previouspc(),offset*2,data); | |
| 1846 | } | |
| 1847 | } | |
| 1848 | ||
| 1849 | static READ16_HANDLER( denjinmk_cop_mcu_r ) | |
| 1850 | { | |
| 1851 | switch (offset) | |
| 1852 | { | |
| 1853 | /*number protection*/ | |
| 1854 | case (0x590/2): | |
| 1855 | { | |
| 1856 | /*BCD read*/ | |
| 1857 | return (prot_bcd[0] & 0xffff) + 0x3030; | |
| 1858 | } | |
| 1859 | case (0x592/2): | |
| 1860 | { | |
| 1861 | return ((prot_bcd[0] & 0xffff0000) >> 16) + 0x3030; | |
| 1862 | } | |
| 1863 | case (0x594/2): | |
| 1864 | { | |
| 1865 | return 0x3030; | |
| 1866 | } | |
| 1867 | case (0x596/2): | |
| 1868 | { | |
| 1869 | return 0x3030; | |
| 1870 | } | |
| 1871 | case (0x598/2): | |
| 1872 | { | |
| 1873 | return 0x3030; | |
| 1874 | } | |
| 1875 | case (0x59a/2): | |
| 1876 | { | |
| 1877 | return 0x3030; | |
| 1878 | } | |
| 1879 | case (0x59c/2): | |
| 1880 | { | |
| 1881 | return 0x3030; | |
| 1882 | } | |
| 1883 | ||
| 1884 | /* Non-protection reads */ | |
| 1885 | ||
| 1886 | case (0x708/2): /* seibu sound */ | |
| 1887 | return seibu_main_word_r(machine,2,0); | |
| 1888 | ||
| 1889 | case (0x70c/2): | |
| 1890 | return seibu_main_word_r(machine,3,0); | |
| 1891 | ||
| 1892 | case (0x714/2): | |
| 1893 | return seibu_main_word_r(machine,5,0); | |
| 1894 | ||
| 1895 | /* Inputs */ | |
| 1896 | ||
| 1897 | case (0x740/2): | |
| 1898 | return input_port_1_word_r(machine,0,0); | |
| 1899 | ||
| 1900 | case (0x744/2): | |
| 1901 | return input_port_2_word_r(machine,0,0); | |
| 1902 | ||
| 1903 | case (0x748/2): | |
| 1904 | return input_port_4_word_r(machine,0,0); | |
| 1905 | ||
| 1906 | case (0x74c/2): | |
| 1907 | return input_port_3_word_r(machine,0,0); | |
| 1908 | ||
| 1909 | } | |
| 1910 | //logerror("CPU0 PC %06x unknown MCU read offset: %04x\n",activecpu_get_previouspc(),offset); | |
| 1911 | ||
| 1912 | return mcu_ram[offset]; | |
| 1913 | } | |
| 1914 | ||
| 1915 | static WRITE16_HANDLER( denjinmk_cop_mcu_w ) | |
| 1916 | { | |
| 1917 | COMBINE_DATA(&mcu_ram[offset]); | |
| 1918 | ||
| 1919 | switch (offset) | |
| 1920 | { | |
| 1921 | /*"Number protection" sub-routine*/ | |
| 1922 | case (0x420/2): | |
| 1923 | { | |
| 1924 | //coin counter write | |
| 1925 | //popmessage("%04x",mcu_ram[offset]); | |
| 1926 | prot_bcd[0] = protection_bcd_jsr(mcu_ram[offset]); | |
| 1927 | //prot_bcd = mcu_ram[offset] - 0x22; | |
| 1928 | break; | |
| 1929 | } | |
| 1930 | ||
| 1931 | ||
| 1932 | case (0x470/2): | |
| 1933 | { | |
| 1934 | denjinmk_setgfxbank( mcu_ram[offset] ); | |
| 1935 | break; | |
| 1936 | } | |
| 1937 | case (0x620/2): | |
| 1938 | { | |
| 1939 | legionna_scrollram16[0] = mcu_ram[offset]; | |
| 1940 | break; | |
| 1941 | } | |
| 1942 | case (0x622/2): | |
| 1943 | { | |
| 1944 | legionna_scrollram16[1] = mcu_ram[offset]; | |
| 1945 | break; | |
| 1946 | } | |
| 1947 | case (0x624/2): | |
| 1948 | { | |
| 1949 | legionna_scrollram16[2] = mcu_ram[offset]; | |
| 1950 | break; | |
| 1951 | } | |
| 1952 | case (0x626/2): | |
| 1953 | { | |
| 1954 | legionna_scrollram16[3] = mcu_ram[offset]; | |
| 1955 | break; | |
| 1956 | } | |
| 1957 | case (0x628/2): | |
| 1958 | { | |
| 1959 | legionna_scrollram16[4] = mcu_ram[offset]; | |
| 1960 | break; | |
| 1961 | } | |
| 1962 | case (0x62a/2): | |
| 1963 | { | |
| 1964 | legionna_scrollram16[5] = mcu_ram[offset]; | |
| 1965 | break; | |
| 1966 | } | |
| 1967 | case (0x700/2): /* seibu(0) */ | |
| 1968 | { | |
| 1969 | seibu_main_word_w(machine,0,mcu_ram[offset],0xff00); | |
| 1970 | break; | |
| 1971 | } | |
| 1972 | case (0x704/2): /* seibu(1) */ | |
| 1973 | { | |
| 1974 | seibu_main_word_w(machine,1,mcu_ram[offset],0xff00); | |
| 1975 | break; | |
| 1976 | } | |
| 1977 | case (0x710/2): /* seibu(4) */ | |
| 1978 | { | |
| 1979 | seibu_main_word_w(machine,4,mcu_ram[offset],0xff00); | |
| 1980 | break; | |
| 1981 | } | |
| 1982 | case (0x718/2): /* seibu(6) */ | |
| 1983 | { | |
| 1984 | seibu_main_word_w(machine,6,mcu_ram[offset],0xff00); | |
| 1985 | break; | |
| 1986 | } | |
| 1987 | // default: | |
| 1988 | // if(offset >= (0x700/2) && offset < (0x800/2)) | |
| 1989 | //printf("CPU0 PC %06x MCU write offset: %04x data: %04x\n",activecpu_get_previouspc(),offset*2,data); | |
| 1990 | } | |
| 1991 | } | |
| 1992 | ||
| 1993 | static READ16_HANDLER( godzilla_cop_mcu_r ) | |
| 1994 | { | |
| 1995 | switch (offset) | |
| 1996 | { | |
| 1997 | /*number protection*/ | |
| 1998 | case (0x590/2): | |
| 1999 | { | |
| 2000 | /*BCD read*/ | |
| 2001 | return (prot_bcd[0] & 0xffff) + 0x3030; | |
| 2002 | } | |
| 2003 | case (0x592/2): | |
| 2004 | { | |
| 2005 | return ((prot_bcd[0] & 0xffff0000) >> 16) + 0x3030; | |
| 2006 | } | |
| 2007 | case (0x594/2): | |
| 2008 | { | |
| 2009 | return 0x3030; | |
| 2010 | } | |
| 2011 | case (0x596/2): | |
| 2012 | { | |
| 2013 | return 0x3030; | |
| 2014 | } | |
| 2015 | case (0x598/2): | |
| 2016 | { | |
| 2017 | return 0x3030; | |
| 2018 | } | |
| 2019 | case (0x59a/2): | |
| 2020 | { | |
| 2021 | return 0x3030; | |
| 2022 | } | |
| 2023 | case (0x59c/2): | |
| 2024 | { | |
| 2025 | return 0x3030; | |
| 2026 | } | |
| 2027 | ||
| 2028 | /* Non-protection reads */ | |
| 2029 | ||
| 2030 | case (0x7c8/2): /* seibu sound */ | |
| 2031 | return seibu_main_word_r(machine,2,0); | |
| 2032 | ||
| 2033 | case (0x7cc/2): | |
| 2034 | return seibu_main_word_r(machine,3,0); | |
| 2035 | ||
| 2036 | case (0x7d4/2): | |
| 2037 | return seibu_main_word_r(machine,5,0); | |
| 2038 | ||
| 2039 | /* Inputs */ | |
| 2040 | ||
| 2041 | case (0x740/2): | |
| 2042 | return input_port_1_word_r(machine,0,0); | |
| 2043 | ||
| 2044 | case (0x744/2): | |
| 2045 | return input_port_2_word_r(machine,0,0); | |
| 2046 | ||
| 2047 | case (0x748/2): | |
| 2048 | return input_port_4_word_r(machine,0,0); | |
| 2049 | ||
| 2050 | case (0x74c/2): | |
| 2051 | return input_port_3_word_r(machine,0,0); | |
| 2052 | ||
| 2053 | } | |
| 2054 | // if(offset >= (0x400/2) && offset < (0x600/2) && offset != (0x5a4/2)) | |
| 2055 | // popmessage("CPU0 PC %06x unknown MCU read offset: %04x\n",activecpu_get_previouspc(),offset*2); | |
| 2056 | ||
| 2057 | return mcu_ram[offset]; | |
| 2058 | } | |
| 2059 | ||
| 2060 | static WRITE16_HANDLER( godzilla_cop_mcu_w ) | |
| 2061 | { | |
| 2062 | COMBINE_DATA(&mcu_ram[offset]); | |
| 2063 | ||
| 2064 | switch (offset) | |
| 2065 | { | |
| 2066 | /*"Number protection" sub-routine*/ | |
| 2067 | case (0x420/2): | |
| 2068 | { | |
| 2069 | //coin counter write | |
| 2070 | //popmessage("%04x",mcu_ram[offset]); | |
| 2071 | prot_bcd[0] = protection_bcd_jsr(mcu_ram[offset]); | |
| 2072 | //prot_bcd = mcu_ram[offset] - 0x22; | |
| 2073 | break; | |
| 2074 | } | |
| 2075 | ||
| 2076 | case (0x478/2): | |
| 2077 | { | |
| 2078 | static UINT16 i; | |
| 2079 | /* | |
| 2080 | */ | |
| 2081 | switch(mcu_ram[offset]) | |
| 2082 | { | |
| 2083 | /*txt layer clearance*/ | |
| 2084 | case 0x40a0: | |
| 2085 | for(i=0;i<0x1000;i+=2) | |
| 2086 | program_write_word(i+0x102800,0x0000); | |
| 2087 | break; | |
| 2088 | case 0x4040: break; | |
| 2089 | case 0x4140: break; | |
| 2090 | case 0x4180: break; | |
| 2091 | case 0x4100: break; | |
| 2092 | case 0x41c0: break; | |
| 2093 | //default: popmessage("%04x",mcu_ram[offset]); | |
| 2094 | } | |
| 2095 | break; | |
| 2096 | } | |
| 2097 | ||
| 2098 | case (0x620/2): | |
| 2099 | { | |
| 2100 | legionna_scrollram16[0] = mcu_ram[offset]; | |
| 2101 | break; | |
| 2102 | } | |
| 2103 | case (0x622/2): | |
| 2104 | { | |
| 2105 | legionna_scrollram16[1] = mcu_ram[offset]; | |
| 2106 | break; | |
| 2107 | } | |
| 2108 | case (0x624/2): | |
| 2109 | { | |
| 2110 | legionna_scrollram16[2] = mcu_ram[offset]; | |
| 2111 | break; | |
| 2112 | } | |
| 2113 | case (0x626/2): | |
| 2114 | { | |
| 2115 | legionna_scrollram16[3] = mcu_ram[offset]; | |
| 2116 | break; | |
| 2117 | } | |
| 2118 | case (0x628/2): | |
| 2119 | { | |
| 2120 | legionna_scrollram16[4] = mcu_ram[offset]; | |
| 2121 | break; | |
| 2122 | } | |
| 2123 | case (0x62a/2): | |
| 2124 | { | |
| 2125 | legionna_scrollram16[5] = mcu_ram[offset]; | |
| 2126 | break; | |
| 2127 | } | |
| 2128 | ||
| 2129 | case (0x7c0/2): /* seibu(0) */ | |
| 2130 | { | |
| 2131 | seibu_main_word_w(machine,0,mcu_ram[offset],0xff00); | |
| 2132 | break; | |
| 2133 | } | |
| 2134 | case (0x7c4/2): /* seibu(1) */ | |
| 2135 | { | |
| 2136 | seibu_main_word_w(machine,1,mcu_ram[offset],0xff00); | |
| 2137 | break; | |
| 2138 | } | |
| 2139 | case (0x7d0/2): /* seibu(4) */ | |
| 2140 | { | |
| 2141 | seibu_main_word_w(machine,4,mcu_ram[offset],0xff00); | |
| 2142 | break; | |
| 2143 | } | |
| 2144 | case (0x7d8/2): /* seibu(6) */ | |
| 2145 | { | |
| 2146 | seibu_main_word_w(machine,6,mcu_ram[offset],0xff00); | |
| 2147 | break; | |
| 2148 | } | |
| 2149 | // default: | |
| 2150 | // logerror("CPU0 PC %06x MCU write offset: %04x data: %04x\n",activecpu_get_previouspc(),offset*2,data); | |
| 2151 | } | |
| 2152 | } | |
| 2153 | ||
| 2154 | static READ16_HANDLER( copdx_0_r ) | |
| 2155 | { | |
| 2156 | switch(offset) | |
| 2157 | { | |
| 2158 | //case (0x47e/2): | |
| 2159 | //case (0x5b0/2): | |
| 2160 | //case (0x5b4/2): | |
| 2161 | // return mcu_ram[offset]; | |
| 2162 | ||
| 2163 | case (0x700/2): | |
| 2164 | return input_port_1_word_r(machine,0,0); | |
| 2165 | ||
| 2166 | case (0x704/2): | |
| 2167 | return input_port_2_word_r(machine,0,0); | |
| 2168 | ||
| 2169 | case (0x708/2): | |
| 2170 | return input_port_4_word_r(machine,0,0); | |
| 2171 | ||
| 2172 | case (0x70c/2): | |
| 2173 | return input_port_3_word_r(machine,0,0); | |
| 2174 | ||
| 2175 | case (0x71c/2): | |
| 2176 | return input_port_5_word_r(machine,0,0); | |
| 2177 | ||
| 2178 | case (0x748/2): /* seibu sound */ | |
| 2179 | return seibu_main_word_r(machine,2,0); | |
| 2180 | case (0x74c/2): | |
| 2181 | return seibu_main_word_r(machine,3,0); | |
| 2182 | case (0x754/2): | |
| 2183 | return seibu_main_word_r(machine,5,0); | |
| 2184 | ||
| 2185 | } | |
| 2186 | ||
| 2187 | //logerror("COP has read at PC=%06x offset = %04x\n",activecpu_get_pc(),offset*2); | |
| 2188 | ||
| 2189 | return mcu_ram[offset]; | |
| 2190 | } | |
| 2191 | ||
| 2192 | static UINT16 cop_fct; | |
| 2193 | static UINT32 cop_reg[8]; | |
| 2194 | ||
| 2195 | /*This is version 1,so some stuff is different (less complex)*/ | |
| 2196 | static void cop_run(void) | |
| 2197 | { | |
| 2198 | switch(cop_fct) | |
| 2199 | { | |
| 2200 | /*???*/ | |
| 2201 | case 0x8100: | |
| 2202 | { | |
| 2203 | UINT32 src = cop_reg[0]; | |
| 2204 | program_write_word(src+0x36,0xffc0); | |
| 2205 | break; | |
| 2206 | } | |
| 2207 | case 0x8900: | |
| 2208 | { | |
| 2209 | UINT32 src = cop_reg[0]; | |
| 2210 | program_write_word(src+0x36,0xff80); | |
| 2211 | break; | |
| 2212 | } | |
| 2213 | /*Right*/ | |
| 2214 | case 0x0205: | |
| 2215 | { | |
| 2216 | UINT32 src = cop_reg[0]; | |
| 2217 | INT16 y = program_read_word(src+0x4); | |
| 2218 | INT16 x = program_read_word(src+0x8); | |
| 2219 | INT16 y_rel = program_read_word(src+0x10); | |
| 2220 | INT16 x_rel = program_read_word(src+0x14); | |
| 2221 | program_write_word(src+0x4,(y+y_rel)); | |
| 2222 | program_write_word(src+0x8,(x+x_rel)); | |
| 2223 | /*printf("%08x %08x %08x %08x %08x\n",cop_reg[0], | |
| 2224 | program_read_word(cop_reg[0]+0x4), | |
| 2225 | program_read_word(cop_reg[0]+0x8), | |
| 2226 | program_read_word(cop_reg[0]+0x10), | |
| 2227 | program_read_word(cop_reg[0]+0x14));*/ | |
| 2228 | break; | |
| 2229 | } | |
| 2230 | /*???*/ | |
| 2231 | case 0x3bb0: | |
| 2232 | { | |
| 2233 | //UINT32 dst = cop_reg[0]; | |
| 2234 | //UINT32 dst = cop_reg[1]; | |
| 2235 | //program_write_word(dst, mame_rand(Machine)/*program_read_word(src)*/); | |
| 2236 | //program_write_word(dst+2,mame_rand(Machine)/*program_read_word(src+2)*/); | |
| 2237 | //program_write_word(dst+4,mame_rand(Machine)/*program_read_word(src+4)*/); | |
| 2238 | //program_write_word(dst+6,mame_rand(Machine)/*program_read_word(src+6)*/); | |
| 2239 | //printf("%04x\n",cop_reg[0]); | |
| 2240 | break; | |
| 2241 | } | |
| 2242 | default: | |
| 2243 | //printf("%04x\n",cop_fct); | |
| 2244 | break; | |
| 2245 | } | |
| 2246 | } | |
| 2247 | //tmp_data[1] = mcu_ram[offset]; | |
| 2248 | //cop_reg[0] = (prot_data[0]&0xffff)|((prot_data[1]&0xffff)<<16); | |
| 2249 | ||
| 2250 | static void cop_reg_w(UINT16 data,UINT8 offset,UINT8 mask) | |
| 2251 | { | |
| 2252 | if(mask) | |
| 2253 | cop_reg[offset] = ((data&0xffff)<<16) | (cop_reg[offset]&0xffff); | |
| 2254 | else | |
| 2255 | cop_reg[offset] = (cop_reg[offset]&0xffff0000) | (data&0xffff); | |
| 2256 | ||
| 2257 | //popmessage("%08x",cop_reg[offset]); | |
| 2258 | } | |
| 2259 | ||
| 2260 | static WRITE16_HANDLER( copdx_0_w ) | |
| 2261 | { | |
| 2262 | COMBINE_DATA(&mcu_ram[offset]); | |
| 2263 | ||
| 2264 | switch(offset) | |
| 2265 | { | |
| 2266 | case (0x4a0/2): | |
| 2267 | case (0x4a2/2): | |
| 2268 | case (0x4a4/2): | |
| 2269 | case (0x4a6/2): | |
| 2270 | case (0x4a8/2): | |
| 2271 | case (0x4aa/2): | |
| 2272 | case (0x4ac/2): | |
| 2273 | case (0x4ae/2): | |
| 2274 | case (0x4c0/2): | |
| 2275 | case (0x4c2/2): | |
| 2276 | case (0x4c4/2): | |
| 2277 | case (0x4c6/2): | |
| 2278 | case (0x4c8/2): | |
| 2279 | case (0x4ca/2): | |
| 2280 | case (0x4cc/2): | |
| 2281 | case (0x4ce/2): | |
| 2282 | cop_reg_w(mcu_ram[offset],offset & 0x000f, (offset < (0x4b0/2)) ? 1 : 0); | |
| 2283 | break; | |
| 2284 | /*layer clearance,but the bootleg doesn't send values,so this function is an | |
| 2285 | original left-over.*/ | |
| 2286 | case (0x478/2): | |
| 2287 | { | |
| 2288 | /* | |
| 2289 | AM_RANGE(0x100800, 0x100fff) AM_READWRITE(SMH_RAM,legionna_background_w) AM_BASE(&legionna_back_data) | |
| 2290 | AM_RANGE(0x101000, 0x1017ff) AM_READWRITE(SMH_RAM,legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 2291 | AM_RANGE(0x101800, 0x101fff) AM_READWRITE(SMH_RAM,legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 2292 | AM_RANGE(0x102000, 0x102fff) AM_READWRITE(SMH_RAM,legionna_text_w) AM_BASE(&legionna_textram) | |
| 2293 | */ | |
| 2294 | break; | |
| 2295 | } | |
| 2296 | case (0x500/2): | |
| 2297 | { | |
| 2298 | cop_fct = mcu_ram[offset]; | |
| 2299 | cop_run(); | |
| 2300 | break; | |
| 2301 | } | |
| 2302 | case (0x604/2): | |
| 2303 | { | |
| 2304 | //C.R.T. Controller | |
| 2305 | /* | |
| 2306 | data = setting | |
| 2307 | 0x01e = 320x256 ---- ---x xxx- | |
| 2308 | 0x0e1 = 320x256 REVERSE ---- xxx- ---x | |
| 2309 | 0x016 = 320x240 ---- ---x -xx- | |
| 2310 | 0x0e9 = 320x240 REVERSE ---- xxx- x--x | |
| 2311 | 0x004 = 320x224 ---- ---- -x-- | |
| 2312 | 0x10b = 320x224 REVERSE ---x ---- x-xx | |
| 2313 | For now we use this by cases and not per bits. | |
| 2314 | */ | |
| 2315 | ||
| 2316 | switch(data) | |
| 2317 | { | |
| 2318 | case 0x0000: | |
| 2319 | case 0x001e: CRT_MODE(320,256,0); break; | |
| 2320 | case 0x00e1: CRT_MODE(320,256,1); break; | |
| 2321 | case 0x0016: CRT_MODE(320,240,0); break; | |
| 2322 | case 0x00e9: CRT_MODE(320,240,1); break; | |
| 2323 | case 0x0004: CRT_MODE(320,224,0); break; | |
| 2324 | case 0x010b: CRT_MODE(320,224,1); break; | |
| 2325 | default: | |
| 2326 | #ifdef MAME_DEBUG | |
| 2327 | popmessage("Warning: Undefined CRT Mode %04x",data); | |
| 2328 | #endif | |
| 2329 | CRT_MODE(320,256,0); | |
| 2330 | } | |
| 2331 | break; | |
| 2332 | } | |
| 2333 | /*TODO: what's going on here,some scroll values aren't sent in these locations | |
| 2334 | but somewhere else?*/ | |
| 2335 | case (0x62c/2): | |
| 2336 | { | |
| 2337 | legionna_scrollram16[0] = mcu_ram[offset]; | |
| 2338 | break; | |
| 2339 | } | |
| 2340 | case (0x62e/2): | |
| 2341 | { | |
| 2342 | legionna_scrollram16[1] = mcu_ram[offset]; | |
| 2343 | break; | |
| 2344 | } | |
| 2345 | case (0x630/2): | |
| 2346 | { | |
| 2347 | legionna_scrollram16[2] = mcu_ram[offset]; | |
| 2348 | break; | |
| 2349 | } | |
| 2350 | case (0x632/2): | |
| 2351 | { | |
| 2352 | legionna_scrollram16[3] = mcu_ram[offset]; | |
| 2353 | break; | |
| 2354 | } | |
| 2355 | case (0x634/2): | |
| 2356 | { | |
| 2357 | legionna_scrollram16[4] = mcu_ram[offset]; | |
| 2358 | break; | |
| 2359 | } | |
| 2360 | case (0x636/2): | |
| 2361 | { | |
| 2362 | legionna_scrollram16[5] = mcu_ram[offset]; | |
| 2363 | break; | |
| 2364 | } | |
| 2365 | case (0x638/2): | |
| 2366 | { | |
| 2367 | legionna_scrollram16[6] = mcu_ram[offset]; | |
| 2368 | break; | |
| 2369 | } | |
| 2370 | case (0x63a/2): | |
| 2371 | { | |
| 2372 | legionna_scrollram16[7] = mcu_ram[offset]; | |
| 2373 | break; | |
| 2374 | } | |
| 2375 | /*video regs (not scrollram,something else)*/ | |
| 2376 | //case (0x660/2): | |
| 2377 | //case (0x662/2): | |
| 2378 | //case (0x664/2): | |
| 2379 | //case (0x666/2): | |
| 2380 | //case (0x668/2): | |
| 2381 | //case (0x66a/2): | |
| 2382 | //case (0x66c/2): | |
| 2383 | //case (0x66e/2): | |
| 2384 | // break; | |
| 2385 | ||
| 2386 | case (0x740/2): /* seibu(0) */ | |
| 2387 | { | |
| 2388 | seibu_main_word_w(machine,0,mcu_ram[offset],0xff00); | |
| 2389 | break; | |
| 2390 | } | |
| 2391 | case (0x744/2): /* seibu(1) */ | |
| 2392 | { | |
| 2393 | seibu_main_word_w(machine,1,mcu_ram[offset],0xff00); | |
| 2394 | break; | |
| 2395 | } | |
| 2396 | case (0x750/2): /* seibu(4) */ | |
| 2397 | { | |
| 2398 | seibu_main_word_w(machine,4,mcu_ram[offset],0xff00); | |
| 2399 | break; | |
| 2400 | } | |
| 2401 | case (0x758/2): /* seibu(6) */ | |
| 2402 | { | |
| 2403 | seibu_main_word_w(machine,6,mcu_ram[offset],0xff00); | |
| 2404 | break; | |
| 2405 | } | |
| 2406 | } | |
| 2407 | //usrintf_showmessage("COP:write at PC=%06x offset = %04x data %04x\n",activecpu_get_pc(),offset*2,data); | |
| 2408 | } | |
| 2409 | ||
| 2410 | static READ16_HANDLER( copdxbl_0_r ) | |
| 2411 | { | |
| 2412 | switch(offset) | |
| 2413 | { | |
| 2414 | //case (0x47e/2): | |
| 2415 | //case (0x5b0/2): | |
| 2416 | //case (0x5b4/2): | |
| 2417 | // return mcu_ram[offset]; | |
| 2418 | ||
| 2419 | case (0x700/2): | |
| 2420 | return input_port_1_word_r(machine,0,0); | |
| 2421 | ||
| 2422 | case (0x704/2): | |
| 2423 | return input_port_2_word_r(machine,0,0); | |
| 2424 | ||
| 2425 | case (0x708/2): | |
| 2426 | return input_port_4_word_r(machine,0,0); | |
| 2427 | ||
| 2428 | case (0x70c/2): | |
| 2429 | return input_port_3_word_r(machine,0,0); | |
| 2430 | ||
| 2431 | case (0x71c/2): | |
| 2432 | return input_port_5_word_r(machine,0,0); | |
| 2433 | #if 0 | |
| 2434 | case (0x748/2): /* seibu sound */ | |
| 2435 | return seibu_main_word_r(2,0); | |
| 2436 | case (0x74c/2): | |
| 2437 | return seibu_main_word_r(3,0); | |
| 2438 | case (0x754/2): | |
| 2439 | return seibu_main_word_r(5,0); | |
| 2440 | #endif | |
| 2441 | ||
| 2442 | } | |
| 2443 | ||
| 2444 | //logerror("COP has read at PC=%06x offset = %04x\n",activecpu_get_pc(),offset*2); | |
| 2445 | ||
| 2446 | return mcu_ram[offset]; | |
| 2447 | } | |
| 2448 | ||
| 2449 | static WRITE16_HANDLER( copdxbl_0_w ) | |
| 2450 | { | |
| 2451 | COMBINE_DATA(&mcu_ram[offset]); | |
| 2452 | ||
| 2453 | switch(offset) | |
| 2454 | { | |
| 2455 | case (0x4a0/2): | |
| 2456 | case (0x4a2/2): | |
| 2457 | case (0x4a4/2): | |
| 2458 | case (0x4a6/2): | |
| 2459 | case (0x4a8/2): | |
| 2460 | case (0x4aa/2): | |
| 2461 | case (0x4ac/2): | |
| 2462 | case (0x4ae/2): | |
| 2463 | case (0x4c0/2): | |
| 2464 | case (0x4c2/2): | |
| 2465 | case (0x4c4/2): | |
| 2466 | case (0x4c6/2): | |
| 2467 | case (0x4c8/2): | |
| 2468 | case (0x4ca/2): | |
| 2469 | case (0x4cc/2): | |
| 2470 | case (0x4ce/2): | |
| 2471 | cop_reg_w(mcu_ram[offset],offset & 0x000f, (offset < (0x4b0/2)) ? 1 : 0); | |
| 2472 | break; | |
| 2473 | /*layer clearance,but the bootleg doesn't send values,so this function | |
| 2474 | is an original left-over.*/ | |
| 2475 | case (0x478/2): | |
| 2476 | { | |
| 2477 | /* | |
| 2478 | AM_RANGE(0x100800, 0x100fff) AM_READWRITE(SMH_RAM,legionna_background_w) AM_BASE(&legionna_back_data) | |
| 2479 | AM_RANGE(0x101000, 0x1017ff) AM_READWRITE(SMH_RAM,legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 2480 | AM_RANGE(0x101800, 0x101fff) AM_READWRITE(SMH_RAM,legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 2481 | AM_RANGE(0x102000, 0x102fff) AM_READWRITE(SMH_RAM,legionna_text_w) AM_BASE(&legionna_textram) | |
| 2482 | */ | |
| 2483 | break; | |
| 2484 | } | |
| 2485 | case (0x500/2): | |
| 2486 | { | |
| 2487 | cop_fct = mcu_ram[offset]; | |
| 2488 | cop_run(); | |
| 2489 | break; | |
| 2490 | } | |
| 2491 | case (0x604/2): | |
| 2492 | { | |
| 2493 | //C.R.T. Controller | |
| 2494 | /* | |
| 2495 | data = setting | |
| 2496 | 0x01e = 320x256 ---- ---x xxx- | |
| 2497 | 0x0e1 = 320x256 REVERSE ---- xxx- ---x | |
| 2498 | 0x016 = 320x240 ---- ---x -xx- | |
| 2499 | 0x0e9 = 320x240 REVERSE ---- xxx- x--x | |
| 2500 | 0x004 = 320x224 ---- ---- -x-- | |
| 2501 | 0x10b = 320x224 REVERSE ---x ---- x-xx | |
| 2502 | For now we use this by cases and not per bits. | |
| 2503 | */ | |
| 2504 | ||
| 2505 | switch(data) | |
| 2506 | { | |
| 2507 | case 0x0000: | |
| 2508 | case 0x001e: CRT_MODE(320,256,0); break; | |
| 2509 | case 0x00e1: CRT_MODE(320,256,1); break; | |
| 2510 | case 0x0016: CRT_MODE(320,240,0); break; | |
| 2511 | case 0x00e9: CRT_MODE(320,240,1); break; | |
| 2512 | case 0x0004: CRT_MODE(320,224,0); break; | |
| 2513 | case 0x010b: CRT_MODE(320,224,1); break; | |
| 2514 | default: | |
| 2515 | #ifdef MAME_DEBUG | |
| 2516 | popmessage("Warning: Undefined CRT Mode %04x",data); | |
| 2517 | #endif | |
| 2518 | CRT_MODE(320,256,0); | |
| 2519 | } | |
| 2520 | break; | |
| 2521 | } | |
| 2522 | /*TODO: kludge on x-axis.*/ | |
| 2523 | case (0x660/2): | |
| 2524 | { | |
| 2525 | legionna_scrollram16[0] = mcu_ram[offset] - 0x1f0; | |
| 2526 | break; | |
| 2527 | } | |
| 2528 | case (0x662/2): | |
| 2529 | { | |
| 2530 | legionna_scrollram16[1] = mcu_ram[offset]; | |
| 2531 | break; | |
| 2532 | } | |
| 2533 | case (0x664/2): | |
| 2534 | { | |
| 2535 | legionna_scrollram16[2] = mcu_ram[offset] - 0x1f0; | |
| 2536 | break; | |
| 2537 | } | |
| 2538 | case (0x666/2): | |
| 2539 | { | |
| 2540 | legionna_scrollram16[3] = mcu_ram[offset]; | |
| 2541 | break; | |
| 2542 | } | |
| 2543 | case (0x668/2): | |
| 2544 | { | |
| 2545 | legionna_scrollram16[4] = mcu_ram[offset] - 0x1f0; | |
| 2546 | break; | |
| 2547 | } | |
| 2548 | case (0x66a/2): | |
| 2549 | { | |
| 2550 | legionna_scrollram16[5] = mcu_ram[offset]; | |
| 2551 | break; | |
| 2552 | } | |
| 2553 | case (0x66c/2): | |
| 2554 | { | |
| 2555 | legionna_scrollram16[6] = mcu_ram[offset] - 0x1f0; | |
| 2556 | break; | |
| 2557 | } | |
| 2558 | case (0x66e/2): | |
| 2559 | { | |
| 2560 | legionna_scrollram16[7] = mcu_ram[offset]; | |
| 2561 | break; | |
| 2562 | } | |
| 2563 | /*WRONG*/ | |
| 2564 | case (0x65c/2): | |
| 2565 | { | |
| 2566 | soundlatch_w(machine,1,data&0xff); | |
| 2567 | cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE ); | |
| 2568 | break; | |
| 2569 | } | |
| 2570 | /*video regs (not scrollram,something else)*/ | |
| 2571 | //case (0x660/2): | |
| 2572 | //case (0x662/2): | |
| 2573 | //case (0x664/2): | |
| 2574 | //case (0x666/2): | |
| 2575 | //case (0x668/2): | |
| 2576 | //case (0x66a/2): | |
| 2577 | //case (0x66c/2): | |
| 2578 | //case (0x66e/2): | |
| 2579 | // break; | |
| 2580 | /*bootleg sound HW*/ | |
| 2581 | /*case (0x740/2): | |
| 2582 | { | |
| 2583 | soundlatch_w(1,data&0x00ff); | |
| 2584 | cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE ); | |
| 2585 | break; | |
| 2586 | }*/ | |
| 2587 | #if 0 | |
| 2588 | case (0x740/2): /* seibu(0) */ | |
| 2589 | { | |
| 2590 | seibu_main_word_w(0,mcu_ram[offset],0xff00); | |
| 2591 | break; | |
| 2592 | } | |
| 2593 | case (0x744/2): /* seibu(1) */ | |
| 2594 | { | |
| 2595 | seibu_main_word_w(1,mcu_ram[offset],0xff00); | |
| 2596 | break; | |
| 2597 | } | |
| 2598 | case (0x750/2): /* seibu(4) */ | |
| 2599 | { | |
| 2600 | seibu_main_word_w(4,mcu_ram[offset],0xff00); | |
| 2601 | break; | |
| 2602 | } | |
| 2603 | case (0x758/2): /* seibu(6) */ | |
| 2604 | { | |
| 2605 | seibu_main_word_w(6,mcu_ram[offset],0xff00); | |
| 2606 | break; | |
| 2607 | } | |
| 2608 | #endif | |
| 2609 | } | |
| 2610 | //usrintf_showmessage("COP:write at PC=%06x offset = %04x data %04x\n",activecpu_get_pc(),offset*2,data); | |
| 2611 | } | |
| 2612 | ||
| 2613 | 128 | /*****************************************************************************/ |
| 2614 | 129 | |
| 2615 | static ADDRESS_MAP_START( legionna_readmem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 2616 | AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM) | |
| 2617 | AM_RANGE(0x100000, 0x1007ff) AM_READ(mcu_r) /* COP mcu */ | |
| 2618 | AM_RANGE(0x101000, 0x1017ff) AM_READ(SMH_RAM) /* 32x16 bg layer, 16x16 tiles */ | |
| 2619 | AM_RANGE(0x101800, 0x101fff) AM_READ(SMH_RAM) /* 32x16 bg layer, 16x16 tiles */ | |
| 2620 | AM_RANGE(0x102000, 0x1027ff) AM_READ(SMH_RAM) /* 32x16 bg layer, 16x16 tiles */ | |
| 2621 | AM_RANGE(0x102800, 0x1037ff) AM_READ(SMH_RAM) /* 64x32 text/front layer, 8x8 tiles */ | |
| 2622 | 130 | |
| 2623 | /* The 4000-4fff area contains PALETTE words and may be extra paletteram? */ | |
| 2624 | AM_RANGE(0x104000, 0x104fff) AM_READ(SMH_RAM) /* palette mirror ? */ | |
| 2625 | // AM_RANGE(0x104000, 0x10401f) AM_READ(SMH_RAM) /* debugging... */ | |
| 2626 | // AM_RANGE(0x104200, 0x1043ff) AM_READ(SMH_RAM) /* ??? */ | |
| 2627 | // AM_RANGE(0x104600, 0x1047ff) AM_READ(SMH_RAM) /* ??? */ | |
| 2628 | // AM_RANGE(0x104800, 0x10481f) AM_READ(SMH_RAM) /* ??? */ | |
| 2629 | ||
| 2630 | AM_RANGE(0x105000, 0x105fff) AM_READ(SMH_RAM) /* spriteram */ | |
| 2631 | AM_RANGE(0x106000, 0x106fff) AM_READ(SMH_RAM) | |
| 2632 | AM_RANGE(0x107000, 0x107fff) AM_READ(SMH_RAM) /* palette */ | |
| 2633 | AM_RANGE(0x108000, 0x11ffff) AM_READ(SMH_RAM) /* main ram */ | |
| 131 | static ADDRESS_MAP_START( legionna_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 132 | AM_RANGE(0x000000, 0x07ffff) AM_ROM | |
| 133 | //AM_RANGE(0x100000, 0x1003ff) AM_RAM | |
| 134 | AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_READWRITE(legionna_mcu_r, legionna_mcu_w) AM_BASE(&cop_mcu_ram) /* COP mcu */ | |
| 135 | AM_RANGE(0x101000, 0x1017ff) AM_RAM AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 136 | AM_RANGE(0x101800, 0x101fff) AM_RAM AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 137 | AM_RANGE(0x102000, 0x1027ff) AM_RAM AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 138 | AM_RANGE(0x102800, 0x1037ff) AM_RAM AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 139 | AM_RANGE(0x104000, 0x104fff) AM_RAM /* The 4000-4fff area contains PALETTE words and may be extra paletteram? */ | |
| 140 | AM_RANGE(0x105000, 0x105fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 141 | AM_RANGE(0x106000, 0x106fff) AM_RAM /* is this used outside inits ?? */ | |
| 142 | AM_RANGE(0x107000, 0x107fff) AM_RAM AM_WRITE(legionna_paletteram16_w) AM_BASE(&paletteram16) /* palette xRRRRxGGGGxBBBBx ? */ | |
| 143 | AM_RANGE(0x108000, 0x11ffff) AM_RAM /* main ram */ | |
| 2634 | 144 | ADDRESS_MAP_END |
| 2635 | 145 | |
| 2636 | static ADDRESS_MAP_START( legionna_writemem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 2637 | AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM) | |
| 2638 | AM_RANGE(0x100000, 0x1007ff) AM_WRITE(mcu_w) AM_BASE(&mcu_ram) /* COP mcu */ | |
| 2639 | AM_RANGE(0x101000, 0x1017ff) AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 2640 | AM_RANGE(0x101800, 0x101fff) AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 2641 | AM_RANGE(0x102000, 0x1027ff) AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 2642 | AM_RANGE(0x102800, 0x1037ff) AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 2643 | 146 | |
| 2644 | /* The 4000-4fff area contains PALETTE words and may be extra paletteram? */ | |
| 2645 | AM_RANGE(0x104000, 0x104fff) AM_WRITE(SMH_RAM) | |
| 2646 | // AM_RANGE(0x104000, 0x104fff) AM_WRITE(legionna_paletteram16_w) | |
| 2647 | // AM_RANGE(0x104000, 0x10401f) AM_WRITE(SMH_RAM) | |
| 2648 | // AM_RANGE(0x104200, 0x1043ff) AM_WRITE(SMH_RAM) | |
| 2649 | // AM_RANGE(0x104600, 0x1047ff) AM_WRITE(SMH_RAM) | |
| 2650 | // AM_RANGE(0x104800, 0x10481f) AM_WRITE(SMH_RAM) | |
| 2651 | ||
| 2652 | AM_RANGE(0x105000, 0x105fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 2653 | AM_RANGE(0x106000, 0x106fff) AM_WRITE(SMH_RAM) /* is this used outside inits ?? */ | |
| 2654 | AM_RANGE(0x107000, 0x107fff) AM_WRITE(legionna_paletteram16_w) AM_BASE(&paletteram16) /* palette xRRRRxGGGGxBBBBx ? */ | |
| 2655 | AM_RANGE(0x108000, 0x11ffff) AM_WRITE(SMH_RAM) | |
| 147 | static ADDRESS_MAP_START( heatbrl_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 148 | AM_RANGE(0x000000, 0x07ffff) AM_ROM | |
| 149 | //AM_RANGE(0x100000, 0x1003ff) AM_RAM | |
| 150 | AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_READWRITE(heatbrl_mcu_r, heatbrl_mcu_w) AM_BASE(&cop_mcu_ram) /* COP mcu */ | |
| 151 | AM_RANGE(0x100800, 0x100fff) AM_RAM AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 152 | AM_RANGE(0x101000, 0x1017ff) AM_RAM AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 153 | AM_RANGE(0x101800, 0x101fff) AM_RAM AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 154 | AM_RANGE(0x102000, 0x102fff) AM_RAM AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 155 | AM_RANGE(0x103000, 0x103fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 156 | AM_RANGE(0x104000, 0x104fff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 157 | AM_RANGE(0x108000, 0x11ffff) AM_RAM | |
| 2656 | 158 | ADDRESS_MAP_END |
| 2657 | 159 | |
| 2658 | static ADDRESS_MAP_START( heatbrl_readmem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 2659 | AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM) | |
| 2660 | AM_RANGE(0x100000, 0x1007ff) AM_READ(cop2_mcu_r) /* COP mcu */ | |
| 2661 | AM_RANGE(0x100800, 0x100fff) AM_READ(SMH_RAM) /* 32x16 bg layer, 16x16 tiles */ | |
| 2662 | AM_RANGE(0x101000, 0x1017ff) AM_READ(SMH_RAM) /* 32x16 bg layer, 16x16 tiles */ | |
| 2663 | AM_RANGE(0x101800, 0x101fff) AM_READ(SMH_RAM) /* 32x16 bg layer, 16x16 tiles */ | |
| 2664 | AM_RANGE(0x102000, 0x102fff) AM_READ(SMH_RAM) /* 64x32 text/front layer, 8x8 tiles */ | |
| 2665 | AM_RANGE(0x103000, 0x103fff) AM_READ(SMH_RAM) /* spriteram */ | |
| 2666 | AM_RANGE(0x104000, 0x104fff) AM_READ(SMH_RAM) /* palette */ | |
| 2667 | AM_RANGE(0x108000, 0x11ffff) AM_READ(SMH_RAM) /* main ram */ | |
| 160 | static ADDRESS_MAP_START( godzilla_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 161 | AM_RANGE(0x000000, 0x0fffff) AM_ROM | |
| 162 | //AM_RANGE(0x100000, 0x1003ff) AM_RAM | |
| 163 | AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_READWRITE(godzilla_cop_mcu_r, godzilla_cop_mcu_w) AM_BASE(&cop_mcu_ram) /* COP mcu */ | |
| 164 | AM_RANGE(0x100800, 0x100fff) AM_RAM | |
| 165 | AM_RANGE(0x101000, 0x101fff) AM_RAM AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 166 | AM_RANGE(0x102000, 0x1027ff) AM_RAM AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 167 | AM_RANGE(0x102800, 0x1037ff) AM_RAM AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 168 | AM_RANGE(0x103800, 0x103fff) AM_RAM AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 169 | AM_RANGE(0x104000, 0x104fff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 170 | AM_RANGE(0x105000, 0x105fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 171 | AM_RANGE(0x106000, 0x1067ff) AM_RAM | |
| 172 | AM_RANGE(0x106800, 0x106fff) AM_RAM | |
| 173 | AM_RANGE(0x107000, 0x107fff) AM_RAM /*Ani-DSP ram*/ | |
| 174 | AM_RANGE(0x108000, 0x11ffff) AM_RAM | |
| 2668 | 175 | ADDRESS_MAP_END |
| 2669 | 176 | |
| 2670 | static ADDRESS_MAP_START( heatbrl_writemem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 2671 | AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM) | |
| 2672 | AM_RANGE(0x100000, 0x1007ff) AM_WRITE(cop2_mcu_w) AM_BASE(&mcu_ram) /* COP mcu */ | |
| 2673 | AM_RANGE(0x100800, 0x100fff) AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 2674 | AM_RANGE(0x101000, 0x1017ff) AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 2675 | AM_RANGE(0x101800, 0x101fff) AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 2676 | AM_RANGE(0x102000, 0x102fff) AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 2677 | AM_RANGE(0x103000, 0x103fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 2678 | AM_RANGE(0x104000, 0x104fff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 2679 | AM_RANGE(0x108000, 0x11ffff) AM_WRITE(SMH_RAM) | |
| 177 | static ADDRESS_MAP_START( denjinmk_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 178 | AM_RANGE(0x000000, 0x0fffff) AM_ROM | |
| 179 | //AM_RANGE(0x100000, 0x1003ff) AM_RAM | |
| 180 | AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_READWRITE(denjinmk_cop_mcu_r, denjinmk_cop_mcu_w) AM_BASE(&cop_mcu_ram) /* COP mcu */ | |
| 181 | AM_RANGE(0x100800, 0x100fff) AM_RAM | |
| 182 | AM_RANGE(0x101000, 0x1017ff) AM_RAM AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 183 | AM_RANGE(0x101800, 0x101fff) AM_RAM AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 184 | AM_RANGE(0x102000, 0x1027ff) AM_RAM AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 185 | AM_RANGE(0x102800, 0x103fff) AM_RAM AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 186 | AM_RANGE(0x104000, 0x104fff) AM_RAM | |
| 187 | AM_RANGE(0x105000, 0x105fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 188 | AM_RANGE(0x106000, 0x107fff) AM_RAM | |
| 189 | AM_RANGE(0x108000, 0x11dfff) AM_RAM | |
| 190 | AM_RANGE(0x11e000, 0x11efff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 191 | AM_RANGE(0x11f000, 0x11ffff) AM_RAM | |
| 2680 | 192 | ADDRESS_MAP_END |
| 2681 | 193 | |
| 2682 | static ADDRESS_MAP_START( godzilla_readmem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 2683 | AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM) | |
| 2684 | AM_RANGE(0x100000, 0x1007ff) AM_READ(godzilla_cop_mcu_r) /* COP mcu */ | |
| 2685 | AM_RANGE(0x100800, 0x100fff) AM_READ(SMH_RAM) | |
| 2686 | AM_RANGE(0x101000, 0x101fff) AM_READ(SMH_RAM) | |
| 2687 | AM_RANGE(0x102000, 0x102fff) AM_READ(SMH_RAM) | |
| 2688 | AM_RANGE(0x103000, 0x103fff) AM_READ(SMH_RAM) | |
| 2689 | AM_RANGE(0x104000, 0x104fff) AM_READ(SMH_RAM) | |
| 2690 | AM_RANGE(0x105000, 0x106fff) AM_READ(SMH_RAM) | |
| 2691 | AM_RANGE(0x107000, 0x107fff) AM_READ(SMH_RAM) /*Ani-DSP ram*/ | |
| 2692 | AM_RANGE(0x108000, 0x11ffff) AM_READ(SMH_RAM) /* main ram */ | |
| 194 | static ADDRESS_MAP_START( sdgndmrb_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 195 | AM_RANGE(0x000000, 0x0fffff) AM_ROM | |
| 196 | //AM_RANGE(0x100000, 0x1003ff) AM_RAM | |
| 197 | AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_READWRITE(sdgndmrb_cop_mcu_r, sdgndmrb_cop_mcu_w) AM_BASE(&cop_mcu_ram) /* COP mcu */ | |
| 198 | AM_RANGE(0x100800, 0x100fff) AM_RAM AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 199 | AM_RANGE(0x101000, 0x1017ff) AM_RAM AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 200 | AM_RANGE(0x101800, 0x101fff) AM_RAM AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 201 | AM_RANGE(0x102000, 0x102fff) AM_RAM AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 202 | AM_RANGE(0x103000, 0x103fff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 203 | AM_RANGE(0x104000, 0x104fff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) | |
| 204 | AM_RANGE(0x105000, 0x105fff) AM_RAM | |
| 205 | AM_RANGE(0x106000, 0x106fff) AM_RAM | |
| 206 | AM_RANGE(0x107000, 0x107fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 207 | AM_RANGE(0x108000, 0x11ffff) AM_RAM | |
| 2693 | 208 | ADDRESS_MAP_END |
| 2694 | 209 | |
| 2695 | static ADDRESS_MAP_START( godzilla_writemem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 2696 | AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM) | |
| 2697 | AM_RANGE(0x100000, 0x1007ff) AM_WRITE(godzilla_cop_mcu_w) AM_BASE(&mcu_ram) /* COP mcu */ | |
| 2698 | AM_RANGE(0x100800, 0x100fff) AM_WRITE(SMH_RAM) | |
| 2699 | AM_RANGE(0x101000, 0x101fff) AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 2700 | AM_RANGE(0x102000, 0x1027ff) AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 2701 | AM_RANGE(0x102800, 0x1037ff) AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 2702 | AM_RANGE(0x103800, 0x103fff) AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 2703 | AM_RANGE(0x104000, 0x104fff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 2704 | AM_RANGE(0x105000, 0x105fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 2705 | AM_RANGE(0x106000, 0x1067ff) AM_WRITE(SMH_RAM) | |
| 2706 | AM_RANGE(0x106800, 0x106fff) AM_WRITE(SMH_RAM) | |
| 2707 | AM_RANGE(0x107000, 0x107fff) AM_WRITE(SMH_RAM) /*Ani-DSP ram*/ | |
| 2708 | AM_RANGE(0x108000, 0x11ffff) AM_WRITE(SMH_RAM) | |
| 2709 | ADDRESS_MAP_END | |
| 2710 | ||
| 2711 | static ADDRESS_MAP_START( denjinmk_readmem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 2712 | AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM) | |
| 2713 | AM_RANGE(0x100000, 0x1007ff) AM_READ(denjinmk_cop_mcu_r) /* COP mcu */ | |
| 2714 | AM_RANGE(0x100800, 0x100fff) AM_READ(SMH_RAM) | |
| 2715 | AM_RANGE(0x101000, 0x101fff) AM_READ(SMH_RAM) | |
| 2716 | AM_RANGE(0x102000, 0x103fff) AM_READ(SMH_RAM) | |
| 2717 | AM_RANGE(0x104000, 0x104fff) AM_READ(SMH_RAM) | |
| 2718 | AM_RANGE(0x105000, 0x105fff) AM_READ(SMH_RAM) | |
| 2719 | AM_RANGE(0x106000, 0x106fff) AM_READ(SMH_RAM) | |
| 2720 | AM_RANGE(0x107000, 0x107fff) AM_READ(SMH_RAM) | |
| 2721 | AM_RANGE(0x108000, 0x11dfff) AM_READ(SMH_RAM) /* main ram */ | |
| 2722 | AM_RANGE(0x11e000, 0x11efff) AM_READ(SMH_RAM) | |
| 2723 | AM_RANGE(0x11f000, 0x11ffff) AM_READ(SMH_RAM) | |
| 2724 | ADDRESS_MAP_END | |
| 2725 | ||
| 2726 | static ADDRESS_MAP_START( denjinmk_writemem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 2727 | AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM) | |
| 2728 | AM_RANGE(0x100000, 0x1007ff) AM_WRITE(denjinmk_cop_mcu_w) AM_BASE(&mcu_ram) /* COP mcu */ | |
| 2729 | AM_RANGE(0x100800, 0x100fff) AM_WRITE(SMH_RAM) | |
| 2730 | AM_RANGE(0x101000, 0x1017ff) AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 2731 | AM_RANGE(0x101800, 0x101fff) AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 2732 | AM_RANGE(0x102000, 0x1027ff) AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 2733 | AM_RANGE(0x102800, 0x103fff) AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 2734 | AM_RANGE(0x104000, 0x104fff) AM_WRITE(SMH_RAM) | |
| 2735 | AM_RANGE(0x105000, 0x105fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 2736 | AM_RANGE(0x106000, 0x107fff) AM_WRITE(SMH_RAM) | |
| 2737 | AM_RANGE(0x108000, 0x11dfff) AM_WRITE(SMH_RAM) /* main ram */ | |
| 2738 | AM_RANGE(0x11e000, 0x11efff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 2739 | AM_RANGE(0x11f000, 0x11ffff) AM_WRITE(SMH_RAM) | |
| 2740 | ADDRESS_MAP_END | |
| 2741 | ||
| 2742 | static ADDRESS_MAP_START( sdgndmrb_readmem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 2743 | AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM) | |
| 2744 | AM_RANGE(0x100000, 0x1007ff) AM_READ(sdgndmrb_cop_mcu_r) /* COP mcu */ | |
| 2745 | AM_RANGE(0x100800, 0x100fff) AM_READ(SMH_RAM) /* 32x16 bg layer, 16x16 tiles */ | |
| 2746 | AM_RANGE(0x101000, 0x1017ff) AM_READ(SMH_RAM) /* 32x16 bg layer, 16x16 tiles */ | |
| 2747 | AM_RANGE(0x101800, 0x101fff) AM_READ(SMH_RAM) /* 32x16 bg layer, 16x16 tiles */ | |
| 2748 | AM_RANGE(0x102000, 0x102fff) AM_READ(SMH_RAM) /* 64x32 text/front layer, 8x8 tiles */ | |
| 2749 | AM_RANGE(0x103000, 0x103fff) AM_READ(SMH_RAM) /* palette */ | |
| 2750 | AM_RANGE(0x104000, 0x104fff) AM_READ(SMH_RAM) /* palette mirror */ | |
| 2751 | AM_RANGE(0x105000, 0x105fff) AM_READ(SMH_RAM) | |
| 2752 | AM_RANGE(0x107000, 0x107fff) AM_READ(SMH_RAM) /* extra spriteram? */ | |
| 2753 | AM_RANGE(0x108000, 0x11ffff) AM_READ(SMH_RAM) /* main ram */ | |
| 2754 | ADDRESS_MAP_END | |
| 2755 | ||
| 2756 | static ADDRESS_MAP_START( sdgndmrb_writemem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 2757 | AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM) | |
| 2758 | AM_RANGE(0x100000, 0x1007ff) AM_WRITE(sdgndmrb_cop_mcu_w) AM_BASE(&mcu_ram) /* COP mcu */ | |
| 2759 | AM_RANGE(0x100800, 0x100fff) AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 2760 | AM_RANGE(0x101000, 0x1017ff) AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 2761 | AM_RANGE(0x101800, 0x101fff) AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 2762 | AM_RANGE(0x102000, 0x102fff) AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 2763 | AM_RANGE(0x103000, 0x103fff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 2764 | AM_RANGE(0x104000, 0x104fff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) | |
| 2765 | AM_RANGE(0x105000, 0x105fff) AM_WRITE(SMH_RAM) | |
| 2766 | AM_RANGE(0x106000, 0x106fff) AM_WRITE(SMH_RAM) | |
| 2767 | AM_RANGE(0x107000, 0x107fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 2768 | AM_RANGE(0x108000, 0x11ffff) AM_WRITE(SMH_RAM) | |
| 2769 | ADDRESS_MAP_END | |
| 2770 | ||
| 2771 | 210 | static ADDRESS_MAP_START( cupsoc_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 2772 | 211 | AM_RANGE(0x000000, 0x0fffff) AM_ROM |
| 2773 | AM_RANGE(0x100000, 0x1007ff) AM_READWRITE(copdx_0_r,copdx_0_w) AM_BASE(&mcu_ram) | |
| 2774 | AM_RANGE(0x100800, 0x100fff) AM_READWRITE(SMH_RAM,legionna_background_w) AM_BASE(&legionna_back_data) | |
| 2775 | AM_RANGE(0x101000, 0x1017ff) AM_READWRITE(SMH_RAM,legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 2776 | AM_RANGE(0x101800, 0x101fff) AM_READWRITE(SMH_RAM,legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 2777 | AM_RANGE(0x102000, 0x102fff) AM_READWRITE(SMH_RAM,legionna_text_w) AM_BASE(&legionna_textram) | |
| 2778 | AM_RANGE(0x103000, 0x103fff) AM_READWRITE(SMH_RAM,paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 2779 | AM_RANGE(0x104000, 0x104fff) AM_READWRITE(SMH_RAM,paletteram16_xBBBBBGGGGGRRRRR_word_w) /*<according to the debug mode,there is a DMA that copies from here to the paletteram>*/ | |
| 212 | //AM_RANGE(0x100000, 0x1003ff) AM_RAM | |
| 213 | AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_READWRITE(copdx_0_r,copdx_0_w) AM_BASE(&cop_mcu_ram) | |
| 214 | AM_RANGE(0x100800, 0x100fff) AM_RAM AM_READWRITE(SMH_RAM,legionna_background_w) AM_BASE(&legionna_back_data) | |
| 215 | AM_RANGE(0x101000, 0x1017ff) AM_RAM AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 216 | AM_RANGE(0x101800, 0x101fff) AM_RAM AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 217 | AM_RANGE(0x102000, 0x102fff) AM_RAM AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 218 | AM_RANGE(0x103000, 0x103fff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 219 | AM_RANGE(0x104000, 0x104fff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) /*<according to the debug mode,there is a DMA that copies from here to the paletteram>*/ | |
| 2780 | 220 | AM_RANGE(0x105000, 0x106fff) AM_RAM |
| 2781 | 221 | AM_RANGE(0x107000, 0x1077ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) |
| 2782 | 222 | AM_RANGE(0x107800, 0x107fff) AM_RAM /*Ani Dsp(?) Ram*/ |
| r2375 | r2376 | |
| 2788 | 228 | |
| 2789 | 229 | static ADDRESS_MAP_START( cupsocbl_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 2790 | 230 | AM_RANGE(0x000000, 0x0fffff) AM_ROM |
| 2791 | AM_RANGE(0x100000, 0x1007ff) AM_READWRITE(copdxbl_0_r,copdxbl_0_w) AM_BASE(&mcu_ram) | |
| 2792 | AM_RANGE(0x100800, 0x100fff) AM_READWRITE(SMH_RAM,legionna_background_w) AM_BASE(&legionna_back_data) | |
| 2793 | AM_RANGE(0x101000, 0x1017ff) AM_READWRITE(SMH_RAM,legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 2794 | AM_RANGE(0x101800, 0x101fff) AM_READWRITE(SMH_RAM,legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 2795 | AM_RANGE(0x102000, 0x102fff) AM_READWRITE(SMH_RAM,legionna_text_w) AM_BASE(&legionna_textram) | |
| 2796 | AM_RANGE(0x103000, 0x103fff) AM_READWRITE(SMH_RAM,paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 2797 | AM_RANGE(0x104000, 0x104fff) AM_READWRITE(SMH_RAM,paletteram16_xBBBBBGGGGGRRRRR_word_w) /*<according to the debug mode,there is a DMA that copies from here to the paletteram>*/ | |
| 231 | //AM_RANGE(0x100000, 0x1003ff) AM_RAM | |
| 232 | AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_READWRITE(copdxbl_0_r,copdxbl_0_w) AM_BASE(&cop_mcu_ram) | |
| 233 | AM_RANGE(0x100800, 0x100fff) AM_RAM AM_WRITE(legionna_background_w) AM_BASE(&legionna_back_data) | |
| 234 | AM_RANGE(0x101000, 0x1017ff) AM_RAM AM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data) | |
| 235 | AM_RANGE(0x101800, 0x101fff) AM_RAM AM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data) | |
| 236 | AM_RANGE(0x102000, 0x102fff) AM_RAM AM_WRITE(legionna_text_w) AM_BASE(&legionna_textram) | |
| 237 | AM_RANGE(0x103000, 0x103fff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 238 | AM_RANGE(0x104000, 0x104fff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) /*<according to the debug mode,there is a DMA that copies from here to the paletteram>*/ | |
| 2798 | 239 | AM_RANGE(0x105000, 0x106fff) AM_RAM |
| 2799 | 240 | AM_RANGE(0x107000, 0x1077ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) |
| 2800 | 241 | AM_RANGE(0x107800, 0x107fff) AM_RAM /*Ani Dsp(?) Ram*/ |
| r2375 | r2376 | |
| 3249 | 690 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 3250 | 691 | INPUT_PORTS_END |
| 3251 | 692 | |
| 693 | static INPUT_PORTS_START( denjinmk ) | |
| 694 | SEIBU_COIN_INPUTS /* coin inputs read through sound cpu */ | |
| 695 | ||
| 696 | PORT_START | |
| 697 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) | |
| 698 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 699 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 700 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) | |
| 701 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 702 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 703 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) | |
| 704 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 705 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 706 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) | |
| 707 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 708 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 709 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) | |
| 710 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) | |
| 711 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 712 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) | |
| 713 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) | |
| 714 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 715 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) | |
| 716 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 717 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 718 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) | |
| 719 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 720 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 721 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) | |
| 722 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) | |
| 723 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 724 | PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) | |
| 725 | PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) | |
| 726 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 727 | PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) | |
| 728 | PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) | |
| 729 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 730 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) | |
| 731 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) | |
| 732 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 733 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) | |
| 734 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) | |
| 735 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 736 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) | |
| 737 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 738 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 739 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Service_Mode ) ) | |
| 740 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 741 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 742 | ||
| 743 | PORT_START | |
| 744 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 745 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 746 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 747 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 748 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 749 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 750 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) //debug button | |
| 751 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 752 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 753 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 754 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 755 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 756 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 757 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 758 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 759 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 760 | ||
| 761 | PORT_START | |
| 762 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 ) | |
| 763 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 ) | |
| 764 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 765 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 766 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 767 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 768 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 769 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 770 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 771 | ||
| 772 | PORT_START | |
| 773 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) | |
| 774 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) | |
| 775 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) | |
| 776 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) | |
| 777 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) | |
| 778 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) | |
| 779 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 780 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 781 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4) | |
| 782 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4) | |
| 783 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4) | |
| 784 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4) | |
| 785 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) | |
| 786 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) | |
| 787 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 788 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 789 | ||
| 790 | PORT_START | |
| 791 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) | |
| 792 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 793 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 794 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) | |
| 795 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 796 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 797 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) | |
| 798 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 799 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 800 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) | |
| 801 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 802 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 803 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) | |
| 804 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) | |
| 805 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 806 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) | |
| 807 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) | |
| 808 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 809 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) | |
| 810 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 811 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 812 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) | |
| 813 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 814 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 815 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) | |
| 816 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) | |
| 817 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 818 | PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) | |
| 819 | PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) | |
| 820 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 821 | PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) | |
| 822 | PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) | |
| 823 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 824 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) | |
| 825 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) | |
| 826 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 827 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) | |
| 828 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) | |
| 829 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 830 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) | |
| 831 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 832 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 833 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) | |
| 834 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 835 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 836 | INPUT_PORTS_END | |
| 837 | ||
| 838 | ||
| 3252 | 839 | static INPUT_PORTS_START( cupsoc ) |
| 3253 | 840 | SEIBU_COIN_INPUTS /* coin inputs read through sound cpu */ |
| 3254 | 841 | |
| r2375 | r2376 | |
| 3365 | 952 | |
| 3366 | 953 | /*****************************************************************************/ |
| 3367 | 954 | |
| 3368 | ||
| 3369 | static const gfx_layout legionna_charlayout = | |
| 955 | static const gfx_layout legionna_new_charlayout = | |
| 3370 | 956 | { |
| 3371 | 957 | 8,8, |
| 3372 | RGN_FRAC(1, | |
| 958 | RGN_FRAC(1,1), | |
| 3373 | 959 | 4, |
| 3374 | { 0, 4, 4096*16*8+0, 4096*16*8+4 }, | |
| 3375 | { 3, 2, 1, 0, 8+3, 8+2, 8+1, 8+0 }, | |
| 3376 | { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, | |
| 3377 | 16*8 | |
| 960 | { 0, 4, 8, 12 }, | |
| 961 | { 3, 2, 1, 0, 16+3, 16+2, 16+1, 16+0 }, | |
| 962 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, | |
| 963 | 32*8 | |
| 3378 | 964 | }; |
| 3379 | 965 | |
| 3380 | static const gfx_layout heatbrl_charlayout = | |
| 966 | ||
| 967 | void descramble_legionnaire_gfx(UINT8* src) | |
| 3381 | 968 | { |
| 3382 | 8,8, | |
| 3383 | RGN_FRAC(1,2), /* second half is junk, like legionna we may need a different decode */ | |
| 3384 | 4, | |
| 3385 | { 0, 4, 4096*16*8+0, 4096*16*8+4 }, | |
| 3386 | { 3, 2, 1, 0, 8+3, 8+2, 8+1, 8+0 }, | |
| 3387 | { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, | |
| 3388 | 16*8 | |
| 3389 | }; | |
| 969 | UINT8 *buffer; | |
| 970 | int len = 0x10000; | |
| 3390 | 971 | |
| 972 | /* rearrange gfx */ | |
| 973 | buffer = malloc_or_die(len); | |
| 974 | { | |
| 975 | int i; | |
| 976 | for (i = 0;i < len; i++) | |
| 977 | { | |
| 978 | buffer[i] = src[BITSWAP24(i, | |
| 979 | 23,22,21,20, | |
| 980 | 19,18,17,16, | |
| 981 | 6,5,15,14,13,12, | |
| 982 | 11,10,9,8, | |
| 983 | 7,4, | |
| 984 | 3,2,1,0)]; | |
| 985 | } | |
| 986 | memcpy(src,buffer,len); | |
| 987 | free(buffer); | |
| 988 | } | |
| 3391 | 989 | |
| 3392 | static const gfx_layout legionna_char2layout = | |
| 3393 | { | |
| 3394 | 16,16, | |
| 3395 | 256, /* Can't use RGN_FRAC as (1,16) not supported */ | |
| 3396 | 4, | |
| 3397 | { 0, 4, 4096*16*8+0, 4096*16*8+4 }, | |
| 3398 | { 3, 2, 1, 0, 11, 10, 9, 8, | |
| 3399 | 1024*16*8 +3, 1024*16*8 +2, 1024*16*8 +1, 1024*16*8 +0, | |
| 3400 | 1024*16*8 +11, 1024*16*8 +10, 1024*16*8 +9, 1024*16*8 +8 }, | |
| 3401 | { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, | |
| 3402 | 512*16*8 +0*16, 512*16*8 +1*16, 512*16*8 +2*16, 512*16*8 +3*16, | |
| 3403 | 512*16*8 +4*16, 512*16*8 +5*16, 512*16*8 +6*16, 512*16*8 +7*16 }, | |
| 3404 | 16*8 | |
| 3405 | }; | |
| 990 | } | |
| 3406 | 991 | |
| 992 | ||
| 3407 | 993 | static const gfx_layout legionna_tilelayout = |
| 3408 | 994 | { |
| 3409 | 995 | 16,16, |
| r2375 | r2376 | |
| 3431 | 1017 | }; |
| 3432 | 1018 | |
| 3433 | 1019 | static GFXDECODE_START( legionna ) |
| 3434 | GFXDECODE_ENTRY( REGION_GFX1, 0, legionna_charlayout, 48*16, 16 ) | |
| 1020 | GFXDECODE_ENTRY( REGION_GFX1, 0, legionna_new_charlayout, 48*16, 16 ) | |
| 3435 | 1021 | GFXDECODE_ENTRY( REGION_GFX3, 0, legionna_tilelayout, 0*16, 16 ) |
| 3436 | GFXDECODE_ENTRY( REGION_GFX4, 0, legionna_ | |
| 1022 | GFXDECODE_ENTRY( REGION_GFX4, 0, legionna_ti | |
| 3437 | 1023 | GFXDECODE_ENTRY( REGION_GFX2, 0, legionna_spritelayout, 0*16, 8*16 ) |
| 3438 | GFXDECODE_ENTRY( REGION_GFX5, 0, legionna_tilelayout, 32*16, 16 ) | |
| 1024 | GFXDECODE_ENTRY( REGION_GFX5, 0, legionna_tilelayout, 32*16, 16 ) | |
| 3439 | 1025 | GFXDECODE_ENTRY( REGION_GFX6, 0, legionna_tilelayout, 16*16, 16 ) |
| 3440 | 1026 | GFXDECODE_END |
| 3441 | 1027 | |
| 3442 | 1028 | static GFXDECODE_START( heatbrl ) |
| 3443 | GFXDECODE_ENTRY( REGION_GFX1, 0, | |
| 1029 | GFXDECODE_ENTRY( REGION_GFX1, 0, legionna_new_charlayout, 48*16, 16 ) | |
| 3444 | 1030 | GFXDECODE_ENTRY( REGION_GFX3, 0, legionna_tilelayout, 0*16, 16 ) |
| 3445 | GFXDECODE_ENTRY( REGION_GFX4, 0, legionna_ | |
| 1031 | GFXDECODE_ENTRY( REGION_GFX4, 0, legionna_ti | |
| 3446 | 1032 | GFXDECODE_ENTRY( REGION_GFX2, 0, legionna_spritelayout, 0*16, 8*16 ) |
| 3447 | 1033 | GFXDECODE_ENTRY( REGION_GFX5, 0, legionna_tilelayout, 32*16, 16 ) |
| 3448 | 1034 | GFXDECODE_ENTRY( REGION_GFX6, 0, legionna_tilelayout, 16*16, 16 ) |
| 3449 | 1035 | GFXDECODE_END |
| 3450 | 1036 | |
| 3451 | 1037 | static GFXDECODE_START( sdgndmrb ) |
| 3452 | GFXDECODE_ENTRY( REGION_GFX1, 0, | |
| 1038 | GFXDECODE_ENTRY( REGION_GFX1, 0, legionna_new_charlayout, 48*16, 16 ) | |
| 3453 | 1039 | GFXDECODE_ENTRY( REGION_GFX3, 0, legionna_tilelayout, 0*16, 16 ) |
| 3454 | GFXDECODE_ENTRY( REGION_GFX4, 0, legionna_ | |
| 1040 | GFXDECODE_ENTRY( REGION_GFX4, 0, legionna_tile | |
| 3455 | 1041 | GFXDECODE_ENTRY( REGION_GFX2, 0, legionna_spritelayout, 0*16, 8*16 ) |
| 3456 | 1042 | GFXDECODE_ENTRY( REGION_GFX5, 0, legionna_tilelayout, 32*16, 16 ) |
| 3457 | 1043 | GFXDECODE_ENTRY( REGION_GFX6, 0, legionna_tilelayout, 16*16, 16 ) |
| r2375 | r2376 | |
| 3463 | 1049 | |
| 3464 | 1050 | /* basic machine hardware */ |
| 3465 | 1051 | MDRV_CPU_ADD(M68000,20000000/2) /* ??? */ |
| 3466 | MDRV_CPU_PROGRAM_MAP(legionna_ | |
| 1052 | MDRV_CPU_PROGRAM_MAP(legionna_ | |
| 3467 | 1053 | MDRV_CPU_VBLANK_INT("main", irq4_line_hold)/* VBL */ |
| 3468 | 1054 | |
| 3469 | 1055 | SEIBU_SOUND_SYSTEM_CPU(14318180/4) |
| r2375 | r2376 | |
| 3495 | 1081 | |
| 3496 | 1082 | /* basic machine hardware */ |
| 3497 | 1083 | MDRV_CPU_ADD(M68000,20000000/2) /* ??? */ |
| 3498 | MDRV_CPU_PROGRAM_MAP(heatbrl_ | |
| 1084 | MDRV_CPU_PROGRAM_MAP(heatbrl_ | |
| 3499 | 1085 | MDRV_CPU_VBLANK_INT("main", irq4_line_hold)/* VBL */ |
| 3500 | 1086 | |
| 3501 | 1087 | SEIBU_SOUND_SYSTEM_CPU(14318180/4) |
| r2375 | r2376 | |
| 3526 | 1112 | |
| 3527 | 1113 | /* basic machine hardware */ |
| 3528 | 1114 | MDRV_CPU_ADD(M68000, 20000000/2) |
| 3529 | MDRV_CPU_PROGRAM_MAP(godzilla_ | |
| 1115 | MDRV_CPU_PROGRAM_MAP(godzilla_ | |
| 3530 | 1116 | MDRV_CPU_VBLANK_INT("main", irq4_line_hold) |
| 3531 | 1117 | |
| 3532 | 1118 | SEIBU2_SOUND_SYSTEM_CPU(14318180/4) |
| r2375 | r2376 | |
| 3557 | 1143 | |
| 3558 | 1144 | /* basic machine hardware */ |
| 3559 | 1145 | MDRV_CPU_ADD(M68000, 20000000/2) |
| 3560 | MDRV_CPU_PROGRAM_MAP(denjinmk_ | |
| 1146 | MDRV_CPU_PROGRAM_MAP(denjinmk_ | |
| 3561 | 1147 | MDRV_CPU_VBLANK_INT("main", irq4_line_hold) |
| 3562 | 1148 | |
| 3563 | 1149 | SEIBU2_SOUND_SYSTEM_CPU(14318180/4) |
| r2375 | r2376 | |
| 3588 | 1174 | |
| 3589 | 1175 | /* basic machine hardware */ |
| 3590 | 1176 | MDRV_CPU_ADD(M68000, 20000000/2) |
| 3591 | MDRV_CPU_PROGRAM_MAP(sdgndmrb_ | |
| 1177 | MDRV_CPU_PROGRAM_MAP(sdgndmrb_ | |
| 3592 | 1178 | MDRV_CPU_VBLANK_INT("main", irq4_line_hold) |
| 3593 | 1179 | |
| 3594 | 1180 | SEIBU2_SOUND_SYSTEM_CPU(14318180/4) |
| r2375 | r2376 | |
| 3708 | 1294 | ROM_LOAD( "6", 0x00000, 0x08000, CRC(fe7b8d06) SHA1(1e5b52ea4b4042940e2ee2db75c7c0f24973422a) ) |
| 3709 | 1295 | ROM_CONTINUE( 0x10000, 0x08000 ) /* banked stuff */ |
| 3710 | 1296 | |
| 3711 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 3712 | ROM_LOAD( "7", 0x000000, 0x10000, CRC(88e26809) SHA1(40ee55d3b5329b6f657e0621d93c4caf6a035fdf) ) /* chars, some BK3 tiles too */ | |
| 3713 | ROM_LOAD( "8", 0x010000, 0x10000, CRC(06e35407) SHA1(affeeb97b7f3cfa9b65a584ebe25c16a5b2c9a89) ) | |
| 1297 | ROM_REGION( 0x020000, REGION_USER1, ROMREGION_DISPOSE ) /* load the tiles here so we can split them up into the required regions by hand */ | |
| 1298 | ROM_LOAD16_BYTE( "7", 0x000000, 0x10000, CRC(88e26809) SHA1(40ee55d3b5329b6f657e0621d93c4caf6a035fdf) ) | |
| 1299 | ROM_LOAD16_BYTE( "8", 0x000001, 0x10000, CRC(06e35407) SHA1(affeeb97b7f3cfa9b65a584ebe25c16a5b2c9a89) ) | |
| 3714 | 1300 | |
| 1301 | ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE ) /* FG Tiles */ | |
| 1302 | ROM_COPY( REGION_USER1, 0x010000, 0x000000, 0x010000 ) | |
| 1303 | ||
| 1304 | ROM_REGION( 0x010000, REGION_GFX5, ROMREGION_DISPOSE ) /* BK3 */ | |
| 1305 | ROM_COPY( REGION_USER1, 0x000000, 0x000000, 0x010000 ) /* decrambled in INIT */ | |
| 1306 | ||
| 3715 | 1307 | ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 3716 | 1308 | ROM_LOAD( "obj1", 0x000000, 0x100000, CRC(d35602f5) SHA1(79379abf1c8131df47f81f42b2dc6876926a4e9d) ) /* sprites */ |
| 3717 | 1309 | ROM_LOAD( "obj2", 0x100000, 0x100000, CRC(351d3917) SHA1(014562ac55c09227c08275df3129df19d81af164) ) |
| 3718 | 1310 | |
| 3719 | ROM_REGION( 0x100000, REGION_ | |
| 1311 | ROM_REGION( 0x100000, REGION_USER2, ROMREGION_DISPOSE ) /* load the tiles here so we can split them up into the required regions by hand */ | |
| 3720 | 1312 | ROM_LOAD( "back", 0x000000, 0x100000, CRC(58280989) SHA1(e3eef1f52829a91b8f87cfe27776a1f12679b3ca) ) /* 3 sets of tiles ('MBK','LBK','BK3') */ |
| 3721 | 1313 | |
| 3722 | ROM_REGION( 0x020000, REGION_GFX4, ROMREGION_DISPOSE ) /* example BK3 decode */ | |
| 3723 | ROM_COPY( REGION_GFX1, 0x00000, 0x00000, 0x20000 ) | |
| 1314 | ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE ) /* MBK */ | |
| 1315 | ROM_COPY( REGION_USER2, 0x000000, 0x000000, 0x80000 ) | |
| 3724 | 1316 | |
| 3725 | ROM_REGION( 0x020000, REGION_GFX5, ROMREGION_DISPOSE ) /* we _should_ decode all BK3 tiles here */ | |
| 1317 | ROM_REGION( 0x100000, REGION_GFX4, ROMREGION_DISPOSE ) | |
| 1318 | /* Not Used */ | |
| 3726 | 1319 | |
| 3727 | ROM_REGION( 0x080000, REGION_GFX6, ROMREGION_DISPOSE ) /* LBK tiles (plus BK3 at end) */ | |
| 3728 | ROM_COPY( REGION_GFX3, 0x80000, 0x00000, 0x80000 ) | |
| 1320 | ROM_REGION( 0x80000, REGION_GFX6, ROMREGION_DISPOSE ) /* LBK */ | |
| 1321 | ROM_COPY( REGION_USER2, 0x080000, 0x000000, 0x78000 ) | |
| 3729 | 1322 | |
| 3730 | 1323 | ROM_REGION( 0x020000, REGION_SOUND1, 0 ) /* ADPCM samples */ |
| 3731 | 1324 | ROM_LOAD( "5", 0x00000, 0x20000, CRC(21d09bde) SHA1(8dce5011e083706ac7b57c5aee4b79d30fa8d4cb) ) |
| r2375 | r2376 | |
| 3742 | 1335 | ROM_LOAD( "6", 0x00000, 0x08000, CRC(fe7b8d06) SHA1(1e5b52ea4b4042940e2ee2db75c7c0f24973422a) ) |
| 3743 | 1336 | ROM_CONTINUE( 0x10000, 0x08000 ) /* banked stuff */ |
| 3744 | 1337 | |
| 3745 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 3746 | ROM_LOAD( "7", 0x000000, 0x10000, CRC(88e26809) SHA1(40ee55d3b5329b6f657e0621d93c4caf6a035fdf) ) /* chars, some BK3 tiles too */ | |
| 3747 | ROM_LOAD( "8", 0x010000, 0x10000, CRC(06e35407) SHA1(affeeb97b7f3cfa9b65a584ebe25c16a5b2c9a89) ) | |
| 1338 | ROM_REGION( 0x020000, REGION_USER1, ROMREGION_DISPOSE ) /* load the tiles here so we can split them up into the required regions by hand */ | |
| 1339 | ROM_LOAD16_BYTE( "7", 0x000000, 0x10000, CRC(88e26809) SHA1(40ee55d3b5329b6f657e0621d93c4caf6a035fdf) ) /* chars, some BK3 tiles too */ | |
| 1340 | ROM_LOAD16_BYTE( "8", 0x000001, 0x10000, CRC(06e35407) SHA1(affeeb97b7f3cfa9b65a584ebe25c16a5b2c9a89) ) | |
| 3748 | 1341 | |
| 1342 | ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE ) /* FG Tiles */ | |
| 1343 | ROM_COPY( REGION_USER1, 0x010000, 0x000000, 0x010000 ) | |
| 1344 | ||
| 1345 | ROM_REGION( 0x010000, REGION_GFX5, ROMREGION_DISPOSE ) /* BK3 */ | |
| 1346 | ROM_COPY( REGION_USER1, 0x000000, 0x000000, 0x010000 ) /* decrambled in INIT */ | |
| 1347 | ||
| 3749 | 1348 | ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 3750 | 1349 | ROM_LOAD( "obj1", 0x000000, 0x100000, CRC(d35602f5) SHA1(79379abf1c8131df47f81f42b2dc6876926a4e9d) ) /* sprites */ |
| 3751 | 1350 | ROM_LOAD( "obj2", 0x100000, 0x100000, CRC(351d3917) SHA1(014562ac55c09227c08275df3129df19d81af164) ) |
| 3752 | 1351 | |
| 3753 | ROM_REGION( 0x100000, REGION_ | |
| 1352 | ROM_REGION( 0x100000, REGION_USER2, ROMREGION_DISPOSE ) /* load the tiles here so we can split them up into the required regions by hand */ | |
| 3754 | 1353 | ROM_LOAD( "back", 0x000000, 0x100000, CRC(58280989) SHA1(e3eef1f52829a91b8f87cfe27776a1f12679b3ca) ) /* 3 sets of tiles ('MBK','LBK','BK3') */ |
| 3755 | 1354 | |
| 3756 | ROM_REGION( 0x020000, REGION_GFX4, ROMREGION_DISPOSE ) /* example BK3 decode */ | |
| 3757 | ROM_COPY( REGION_GFX1, 0x00000, 0x00000, 0x20000 ) | |
| 1355 | ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE ) /* MBK */ | |
| 1356 | ROM_COPY( REGION_USER2, 0x000000, 0x000000, 0x80000 ) | |
| 3758 | 1357 | |
| 3759 | ROM_REGION( 0x020000, REGION_GFX5, ROMREGION_DISPOSE ) /* we _should_ decode all BK3 tiles here */ | |
| 1358 | ROM_REGION( 0x100000, REGION_GFX4, ROMREGION_DISPOSE ) | |
| 1359 | /* Not Used */ | |
| 3760 | 1360 | |
| 3761 | ROM_REGION( 0x080000, REGION_GFX6, ROMREGION_DISPOSE ) /* LBK tiles (plus BK3 at end) */ | |
| 3762 | ROM_COPY( REGION_GFX3, 0x80000, 0x00000, 0x80000 ) | |
| 1361 | ROM_REGION( 0x80000, REGION_GFX6, ROMREGION_DISPOSE ) /* LBK */ | |
| 1362 | ROM_COPY( REGION_USER2, 0x080000, 0x000000, 0x78000 ) | |
| 3763 | 1363 | |
| 3764 | 1364 | ROM_REGION( 0x020000, REGION_SOUND1, 0 ) /* ADPCM samples */ |
| 3765 | 1365 | ROM_LOAD( "5", 0x00000, 0x20000, CRC(21d09bde) SHA1(8dce5011e083706ac7b57c5aee4b79d30fa8d4cb) ) |
| r2375 | r2376 | |
| 3777 | 1377 | ROM_CONTINUE( 0x10000, 0x08000 ) /* banked stuff */ |
| 3778 | 1378 | |
| 3779 | 1379 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 3780 | ROM_LOAD( "barrel.6", 0x000000, 0x10000, CRC(bea3c581) SHA1(7f7f0a74bf106acaf57c182d47f0c707da2011bd) ) /* chars */ | |
| 3781 | ROM_LOAD( "barrel.5", 0x010000, 0x10000, CRC(5604d155) SHA1(afc30347b1e1316ec25056c0c1576f78be5f1a72) ) | |
| 1380 | ROM_LOAD16_BYTE( "barrel.6", 0x000000, 0x10000, CRC(bea3c581) SHA1(7f7f0a74bf106acaf57c182d47f0c707da2011bd) ) /* chars */ | |
| 1381 | ROM_LOAD16_BYTE( "barrel.5", 0x000001, 0x10000, CRC(5604d155) SHA1(afc30347b1e1316ec25056c0c1576f78be5f1a72) ) | |
| 3782 | 1382 | |
| 3783 | 1383 | ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 3784 | 1384 | ROM_LOAD( "obj1", 0x000000, 0x100000, CRC(f7a7c31c) SHA1(683e5c7a0732ff5fd56167dd82035ca050de0507) ) /* sprites */ |
| r2375 | r2376 | |
| 3787 | 1387 | ROM_REGION( 0x100000, REGION_GFX3, ROMREGION_DISPOSE ) /* MBK tiles */ |
| 3788 | 1388 | ROM_LOAD( "bg-1", 0x000000, 0x100000, CRC(2f5d8baa) SHA1(0bf687c46c603150eadb304adcd78d53a338e615) ) |
| 3789 | 1389 | |
| 3790 | ROM_REGION( 0x020000, REGION_GFX4, ROMREGION_DISPOSE ) /* not used */ | |
| 1390 | ROM_REGION( 0x020000, REGION_GFX4, ROMREGION_DISPOSE ) /* not used? */ | |
| 1391 | ROM_COPY( REGION_GFX1, 0x010000, 0x000000, 0x010000 ) // this is just corrupt tiles if we decode it | |
| 3791 | 1392 | |
| 3792 | 1393 | ROM_REGION( 0x080000, REGION_GFX5, ROMREGION_DISPOSE ) /* BK3 tiles */ |
| 3793 | 1394 | ROM_LOAD( "bg-3", 0x000000, 0x080000, CRC(83850e2d) SHA1(cdc2df8e3bc58319c50768ea2a05b9c7ddc2a652) ) |
| r2375 | r2376 | |
| 3811 | 1412 | ROM_CONTINUE( 0x10000, 0x08000 ) /* banked stuff */ |
| 3812 | 1413 | |
| 3813 | 1414 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 3814 | ROM_LOAD( "barrel.6", 0x000000, 0x10000, CRC(bea3c581) SHA1(7f7f0a74bf106acaf57c182d47f0c707da2011bd) ) /* chars */ | |
| 3815 | ROM_LOAD( "barrel.5", 0x010000, 0x10000, CRC(5604d155) SHA1(afc30347b1e1316ec25056c0c1576f78be5f1a72) ) | |
| 1415 | ROM_LOAD16_BYTE( "barrel.6", 0x000000, 0x10000, CRC(bea3c581) SHA1(7f7f0a74bf106acaf57c182d47f0c707da2011bd) ) /* chars */ | |
| 1416 | ROM_LOAD16_BYTE( "barrel.5", 0x000001, 0x10000, CRC(5604d155) SHA1(afc30347b1e1316ec25056c0c1576f78be5f1a72) ) | |
| 3816 | 1417 | |
| 3817 | 1418 | /* Sprite + tilemap gfx roms not dumped, for now we use ones from heatbrlu |
| 3818 | 1419 | Readme mentions as undumped: |
| r2375 | r2376 | |
| 3850 | 1451 | ROM_CONTINUE( 0x10000, 0x08000 ) /* banked stuff */ |
| 3851 | 1452 | |
| 3852 | 1453 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 3853 | ROM_LOAD( "barrel.6", 0x000000, 0x10000, CRC(bea3c581) SHA1(7f7f0a74bf106acaf57c182d47f0c707da2011bd) ) /* chars */ | |
| 3854 | ROM_LOAD( "barrel.5", 0x010000, 0x10000, CRC(5604d155) SHA1(afc30347b1e1316ec25056c0c1576f78be5f1a72) ) | |
| 1454 | ROM_LOAD16_BYTE( "barrel.6", 0x000000, 0x10000, CRC(bea3c581) SHA1(7f7f0a74bf106acaf57c182d47f0c707da2011bd) ) /* chars */ | |
| 1455 | ROM_LOAD16_BYTE( "barrel.5", 0x000001, 0x10000, CRC(5604d155) SHA1(afc30347b1e1316ec25056c0c1576f78be5f1a72) ) | |
| 3855 | 1456 | |
| 3856 | 1457 | ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 3857 | 1458 | ROM_LOAD( "obj1", 0x000000, 0x100000, CRC(f7a7c31c) SHA1(683e5c7a0732ff5fd56167dd82035ca050de0507) ) /* sprites */ |
| r2375 | r2376 | |
| 3934 | 1535 | ROM_CONTINUE( 0x010000, 0x08000 ) /* banked stuff */ |
| 3935 | 1536 | |
| 3936 | 1537 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 3937 | ROM_LOAD( "11.620", 0x000000, 0x010000, CRC(58e0e41f) SHA1(563c633eb3d4df41e467c93957c74b540a0ae43c) ) | |
| 3938 | ROM_LOAD( "10.615", 0x010000, 0x010000, CRC(9c22bc13) SHA1(a94d9ed63ee1f5e358ebcaf517e6a1c986fa5d96) ) | |
| 1538 | ROM_LOAD16_BYTE( "11.620", 0x000000, 0x010000, CRC(58e0e41f) SHA1(563c633eb3d4df41e467c93957c74b540a0ae43c) ) | |
| 1539 | ROM_LOAD16_BYTE( "10.615", 0x000001, 0x010000, CRC(9c22bc13) SHA1(a94d9ed63ee1f5e358ebcaf517e6a1c986fa5d96) ) | |
| 3939 | 1540 | |
| 3940 | 1541 | ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 3941 | ROM_LOAD( "obj1.748", 0x300000, 0x100000, CRC(146bacb0) SHA1(1331f04f3d9e6236cec7524e9da1782ed1916ff7) ) | |
| 1542 | ROM_LOAD( "obj1.748", 0x300000, 0x100000, CRC(146bacb0) SHA1(1331f04f3d9e6236cec7524e9da1782ed1916ff7) ) // this might be half size like denjinmk, same pcb.. | |
| 3942 | 1543 | ROM_LOAD( "obj2.756", 0x200000, 0x100000, CRC(91c2a6a5) SHA1(0e9d9d94c3d99a54c6f9f99270e65682eb0a8b6a) ) |
| 3943 | 1544 | ROM_LOAD( "obj3.743", 0x100000, 0x100000, CRC(5af0114e) SHA1(9362de9ade6db67ab0e3a2dfea580e688bbf7729) ) |
| 3944 | 1545 | ROM_LOAD( "obj4.757", 0x000000, 0x100000, CRC(7448b054) SHA1(5c08319329eb8c90b63e5393c0011bc39911ebbb) ) |
| r2375 | r2376 | |
| 4051 | 1652 | ROM_CONTINUE( 0x010000, 0x08000 ) /* banked stuff */ |
| 4052 | 1653 | |
| 4053 | 1654 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 4054 | ROM_LOAD( "rom7.620", 0x000000, 0x010000, CRC(e1f759b1) SHA1(ddc60e78e7791a59c59403dd4089b3f6e1ecf8cb) ) | |
| 4055 | ROM_LOAD( "rom8.615", 0x010000, 0x010000, CRC(cc36af0d) SHA1(69c2ae38f03be79be4d138fcc73a6a86407eb285) ) | |
| 1655 | ROM_LOAD16_BYTE( "rom7.620", 0x000000, 0x010000, CRC(e1f759b1) SHA1(ddc60e78e7791a59c59403dd4089b3f6e1ecf8cb) ) | |
| 1656 | ROM_LOAD16_BYTE( "rom8.615", 0x000001, 0x010000, CRC(cc36af0d) SHA1(69c2ae38f03be79be4d138fcc73a6a86407eb285) ) | |
| 4056 | 1657 | |
| 4057 | ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE ) | |
| 4058 | /**/ROM_LOAD( "obj-0-3.748", 0x000000, 0x100000, CRC(3dcc7b04) SHA1(3c3ad5ddc18a42046348dcb54e65f6173c003d72) ) | |
| 4059 | ROM_LOAD( "obj-8-9.757", 0x100000, 0x100000, CRC(c8f7e1c9) SHA1(a746d187b50a0ecdd5a7f687a2601e5dc8bfe272) ) | |
| 4060 | ROM_LOAD( "obj-4-5.756", 0x200000, 0x100000, CRC(01f8d4e6) SHA1(25b69da693be8c3404f750b419c330a7a56e88ec) ) | |
| 4061 | ROM_LOAD( "obj-6-7.743", 0x300000, 0x100000, CRC(e5805757) SHA1(9d392c27eef7c1fcda560dac17ba9d7ae2287ac8) ) | |
| 1658 | ROM_REGION( 0x500000, REGION_GFX2, ROMREGION_DISPOSE ) | |
| 1659 | ROM_LOAD( "obj-0-3.748", 0x000000, 0x100000, BAD_DUMP CRC(3dcc7b04) SHA1(3c3ad5ddc18a42046348dcb54e65f6173c003d72) ) /* half size?# 0,1 */ | |
| 1660 | /* the graphics for this region are missing, the previous rom should probably be twice the size, note the filename 0-3 */ | |
| 1661 | ROM_LOAD( "obj-4-5.756", 0x200000, 0x100000, CRC(01f8d4e6) SHA1(25b69da693be8c3404f750b419c330a7a56e88ec) ) /* 4,5 */ | |
| 1662 | ROM_LOAD( "obj-6-7.743", 0x300000, 0x100000, CRC(e5805757) SHA1(9d392c27eef7c1fcda560dac17ba9d7ae2287ac8) ) /* 6,7 */ | |
| 1663 | ROM_LOAD( "obj-8-9.757", 0x400000, 0x100000, CRC(c8f7e1c9) SHA1(a746d187b50a0ecdd5a7f687a2601e5dc8bfe272) ) /* 8,9 */ | |
| 4062 | 1664 | |
| 4063 | 1665 | ROM_REGION( 0x100000, REGION_GFX3, ROMREGION_DISPOSE ) /* MBK tiles */ |
| 4064 | 1666 | ROM_LOAD( "bg-1-ab.618", 0x000000, 0x100000, CRC(eaad151a) SHA1(bdd1d83ee8497efe20f21baf873e786446372bcb) ) |
| r2375 | r2376 | |
| 4146 | 1748 | ROM_CONTINUE( 0x010000, 0x08000 ) |
| 4147 | 1749 | |
| 4148 | 1750 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 4149 | ROM_LOAD( "rb-f1.620", 0x000000, 0x010000, CRC(792c403d) SHA1(3c606af696fe8f3d6edefdab3940bd5eb341bca9) ) | |
| 4150 | ROM_LOAD( "rb-f2.615", 0x010000, 0x010000, CRC(a30e0903) SHA1(b9e7646da1ccab6dadaca6beda08125b34946653) ) | |
| 1751 | ROM_LOAD16_BYTE( "rb-f1.620", 0x000000, 0x010000, CRC(792c403d) SHA1(3c606af696fe8f3d6edefdab3940bd5eb341bca9) ) | |
| 1752 | ROM_LOAD16_BYTE( "rb-f2.615", 0x000001, 0x010000, CRC(a30e0903) SHA1(b9e7646da1ccab6dadaca6beda08125b34946653) ) | |
| 4151 | 1753 | |
| 4152 | 1754 | ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 4153 | 1755 | ROM_LOAD( "rb-spr01.748", 0x000000, 0x100000, CRC(11a3479d) SHA1(4d2d06d62da02c6e9884735de8c319f37ca1715c) ) |
| r2375 | r2376 | |
| 4172 | 1774 | ROM_LOAD( "copx-d2.313", 0x0000, 0x040000, CRC(a6732ff9) SHA1(c4856ec77869d9098da24b1bb3d7d58bb74b4cda) ) |
| 4173 | 1775 | ROM_END |
| 4174 | 1776 | |
| 1777 | ||
| 4175 | 1778 | ROM_START( cupsoc ) |
| 4176 | 1779 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* 68000 code */ |
| 4177 | ROM_LOAD32_BYTE( "seibu1.10n", 0x000000, 0x040000, CRC(e91fdc95) SHA1(71c56fffabca79e73dfc61aad17bc58e09a28680) ) | |
| 4178 | ROM_LOAD32_BYTE( "seibu2.10q", 0x000001, 0x040000, CRC(7816df3c) SHA1(d5cfbf493cc00c47406b314c08e9cbf159a7f98c) ) | |
| 4179 | ROM_LOAD32_BYTE( "seibu3.10f", 0x000002, 0x040000, CRC(3be8a330) SHA1(f821080acd29c5801abc36da3341aabaea82ceb0) ) | |
| 4180 | ROM_LOAD32_BYTE( "seibu4.10k", 0x000003, 0x040000, CRC(f30167ea) SHA1(5431296e3245631c90362373027c54166f8fba16) ) | |
| 1780 | ROM_LOAD32_BYTE( "scc_01.bin", 0x000000, 0x040000, CRC(c122203c) SHA1(93c0ae90c0ed3889b9159774ba89536108c9b259) ) | |
| 1781 | ROM_LOAD32_BYTE( "scc_02.bin", 0x000001, 0x040000, CRC(105511b4) SHA1(f2ebe95a10f5928f57d4f532e2d2432f13b774b2) ) | |
| 1782 | ROM_LOAD32_BYTE( "scc_03.bin", 0x000002, 0x040000, CRC(2d23d78f) SHA1(c479ded8782f2d23e123b7d00ec57c18a8f80578) ) | |
| 1783 | ROM_LOAD32_BYTE( "scc_04.bin", 0x000003, 0x040000, CRC(e8877461) SHA1(3be44459699fd455b0daaac10e8a37d1b7985607) ) | |
| 4181 | 1784 | |
| 4182 | 1785 | ROM_REGION( 0x20000*2, REGION_CPU2, 0 ) /* Z80 code, banked data */ |
| 4183 | 1786 | ROM_LOAD( "seibu7.8a", 0x000000, 0x08000, CRC(f63329f9) SHA1(51736de48efc14415cfdf169b43623d4c95fde2b) ) |
| 4184 | 1787 | ROM_CONTINUE( 0x010000, 0x08000 ) /* banked stuff */ |
| 4185 | 1788 | |
| 4186 | 1789 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 4187 | ROM_LOAD( "seibu6.7x", 0x000000, 0x010000, CRC(21c1e1b8) SHA1(30928c8ef98bf32ba0bf795ddadba1c95fcffe9d) ) | |
| 4188 | ROM_LOAD( "seibu5.7y", 0x010000, 0x010000, CRC(955d9fd7) SHA1(782451e8e85f7ba285d6cacd9d3fdcf48bde60bc) ) | |
| 1790 | ROM_LOAD16_BYTE( "scc_06.bin", 0x000000, 0x010000, CRC(f1a18ec6) SHA1(43f8ec3fc541b8dc2a17533329dd3448afadcb3b) ) | |
| 1791 | ROM_LOAD16_BYTE( "scc_05.bin", 0x000001, 0x010000, CRC(c0358503) SHA1(e87991c6a6f3e060a1b03b4899fa891510fca15f) ) | |
| 4189 | 1792 | |
| 4190 | 1793 | ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 4191 | 1794 | ROM_LOAD( "obj.8c", 0x000000, 0x100000, CRC(e2377895) SHA1(1d1c7f31a08a464139cdaf383a5e1ade0717dc9f) ) |
| r2375 | r2376 | |
| 4203 | 1806 | |
| 4204 | 1807 | ROM_REGION( 0x040000, REGION_SOUND1, 0 ) /* ADPCM samples */ |
| 4205 | 1808 | ROM_LOAD( "seibu8.7a", 0x000000, 0x040000, CRC(6f594808) SHA1(218aa12068aa587c7656355f6a6b86d97c868774) ) |
| 1809 | ||
| 1810 | ROM_REGION( 0x080000, REGION_USER1, 0 ) | |
| 1811 | ROM_LOAD( "copx-d1.bin", 0x000000, 0x080000, CRC(029bc402) SHA1(0f64e4c32d95abfa3920b39ed3cf0cc6eb50191b) ) | |
| 4206 | 1812 | ROM_END |
| 4207 | 1813 | |
| 4208 | ROM_START( cupsoc | |
| 1814 | ROM_START( cupsocs ) | |
| 4209 | 1815 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* 68000 code */ |
| 4210 | ROM_LOAD32_BYTE( "scc_01.bin", 0x000000, 0x040000, CRC(c122203c) SHA1(93c0ae90c0ed3889b9159774ba89536108c9b259) ) | |
| 4211 | ROM_LOAD32_BYTE( "scc_02.bin", 0x000001, 0x040000, CRC(105511b4) SHA1(f2ebe95a10f5928f57d4f532e2d2432f13b774b2) ) | |
| 4212 | ROM_LOAD32_BYTE( "scc_03.bin", 0x000002, 0x040000, CRC(2d23d78f) SHA1(c479ded8782f2d23e123b7d00ec57c18a8f80578) ) | |
| 4213 | ROM_LOAD32_BYTE( "scc_04.bin", 0x000003, 0x040000, CRC(e8877461) SHA1(3be44459699fd455b0daaac10e8a37d1b7985607) ) | |
| 1816 | ROM_LOAD32_BYTE( "1_10n.bin", 0x000000, 0x040000, CRC(b67835c5) SHA1(4fa562630d1f9cfb6f5bfff3295ebbdd227e4da5) ) | |
| 1817 | ROM_LOAD32_BYTE( "2_10q.bin", 0x000001, 0x040000, CRC(de65509c) SHA1(3362258b6d86fc63afa205712416a4aac0cf10e4) ) | |
| 1818 | ROM_LOAD32_BYTE( "3_10f.bin", 0x000002, 0x040000, CRC(c0333f0c) SHA1(ed02897724de4cf981aa8c6ce98551b9e79efff3) ) | |
| 1819 | ROM_LOAD32_BYTE( "4_10k.bin", 0x000003, 0x040000, CRC(288f11d4) SHA1(424cb3d1428f7195decce2ba6eebc1e24d9bb207) ) | |
| 4214 | 1820 | |
| 4215 | 1821 | ROM_REGION( 0x20000*2, REGION_CPU2, 0 ) /* Z80 code, banked data */ |
| 4216 | ROM_LOAD( " | |
| 1822 | ROM_LOAD( " | |
| 4217 | 1823 | ROM_CONTINUE( 0x010000, 0x08000 ) /* banked stuff */ |
| 4218 | 1824 | |
| 4219 | 1825 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 4220 | ROM_LOAD( "scc_06.bin", 0x000000, 0x010000, CRC(f1a18ec6) SHA1(43f8ec3fc541b8dc2a17533329dd3448afadcb3b) ) | |
| 4221 | ROM_LOAD( "scc_05.bin", 0x010000, 0x010000, CRC(c0358503) SHA1(e87991c6a6f3e060a1b03b4899fa891510fca15f) ) | |
| 1826 | ROM_LOAD16_BYTE( "6_7x.bin", 0x000000, 0x010000, CRC(7981366e) SHA1(b859bf23c5ae466f4020958a06935192fa68ee8d) ) | |
| 1827 | ROM_LOAD16_BYTE( "5_7y.bin", 0x000001, 0x010000, CRC(26cbfaf0) SHA1(1ba7bc1cecb4bd06ba5c2d3eaa9c9e38e2106cd2) ) | |
| 4222 | 1828 | |
| 4223 | 1829 | ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 4224 | 1830 | ROM_LOAD( "obj.8c", 0x000000, 0x100000, CRC(e2377895) SHA1(1d1c7f31a08a464139cdaf383a5e1ade0717dc9f) ) |
| r2375 | r2376 | |
| 4235 | 1841 | ROM_COPY( REGION_GFX5, 0x00000, 0x00000, 0x080000 ) |
| 4236 | 1842 | |
| 4237 | 1843 | ROM_REGION( 0x040000, REGION_SOUND1, 0 ) /* ADPCM samples */ |
| 4238 | ROM_LOAD( " | |
| 1844 | ROM_LOAD( " | |
| 4239 | 1845 | |
| 4240 | 1846 | ROM_REGION( 0x080000, REGION_USER1, 0 ) |
| 4241 | 1847 | ROM_LOAD( "copx-d1.bin", 0x000000, 0x080000, CRC(029bc402) SHA1(0f64e4c32d95abfa3920b39ed3cf0cc6eb50191b) ) |
| 4242 | 1848 | ROM_END |
| 4243 | 1849 | |
| 1850 | ROM_START( cupsocs2 ) | |
| 1851 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* 68000 code */ | |
| 1852 | ROM_LOAD32_BYTE( "seibu1.10n", 0x000000, 0x040000, CRC(e91fdc95) SHA1(71c56fffabca79e73dfc61aad17bc58e09a28680) ) | |
| 1853 | ROM_LOAD32_BYTE( "seibu2.10q", 0x000001, 0x040000, CRC(7816df3c) SHA1(d5cfbf493cc00c47406b314c08e9cbf159a7f98c) ) | |
| 1854 | ROM_LOAD32_BYTE( "seibu3.10f", 0x000002, 0x040000, CRC(3be8a330) SHA1(f821080acd29c5801abc36da3341aabaea82ceb0) ) | |
| 1855 | ROM_LOAD32_BYTE( "seibu4.10k", 0x000003, 0x040000, CRC(f30167ea) SHA1(5431296e3245631c90362373027c54166f8fba16) ) | |
| 1856 | ||
| 1857 | ROM_REGION( 0x20000*2, REGION_CPU2, 0 ) /* Z80 code, banked data */ | |
| 1858 | ROM_LOAD( "seibu7.8a", 0x000000, 0x08000, CRC(f63329f9) SHA1(51736de48efc14415cfdf169b43623d4c95fde2b) ) | |
| 1859 | ROM_CONTINUE( 0x010000, 0x08000 ) /* banked stuff */ | |
| 1860 | ||
| 1861 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1862 | ROM_LOAD16_BYTE( "seibu6.7x", 0x000000, 0x010000, CRC(21c1e1b8) SHA1(30928c8ef98bf32ba0bf795ddadba1c95fcffe9d) ) | |
| 1863 | ROM_LOAD16_BYTE( "seibu5.7y", 0x000001, 0x010000, CRC(955d9fd7) SHA1(782451e8e85f7ba285d6cacd9d3fdcf48bde60bc) ) | |
| 1864 | ||
| 1865 | ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE ) | |
| 1866 | ROM_LOAD( "obj.8c", 0x000000, 0x100000, CRC(e2377895) SHA1(1d1c7f31a08a464139cdaf383a5e1ade0717dc9f) ) | |
| 1867 | ||
| 1868 | ROM_REGION( 0x100000, REGION_GFX3, ROMREGION_DISPOSE ) /* MBK tiles */ | |
| 1869 | ROM_LOAD( "back-1.4y", 0x000000, 0x100000, CRC(3dfea0ec) SHA1(8f41d267e488e07831946ef898d593897f10bfe2) ) | |
| 1870 | ||
| 1871 | ROM_REGION( 0x020000, REGION_GFX4, ROMREGION_DISPOSE ) /* not used */ | |
| 1872 | ||
| 1873 | ROM_REGION( 0x080000, REGION_GFX5, ROMREGION_DISPOSE ) /* BK3 tiles */ | |
| 1874 | ROM_LOAD( "back-2.6y", 0x000000, 0x080000, CRC(e07712af) SHA1(2a0285d6a1e0141838e898252b8d922a6263b05f) ) | |
| 1875 | ||
| 1876 | ROM_REGION( 0x080000, REGION_GFX6, ROMREGION_DISPOSE ) /* LBK tiles */ | |
| 1877 | ROM_COPY( REGION_GFX5, 0x00000, 0x00000, 0x080000 ) | |
| 1878 | ||
| 1879 | ROM_REGION( 0x040000, REGION_SOUND1, 0 ) /* ADPCM samples */ | |
| 1880 | ROM_LOAD( "seibu8.7a", 0x000000, 0x040000, CRC(6f594808) SHA1(218aa12068aa587c7656355f6a6b86d97c868774) ) | |
| 1881 | ROM_END | |
| 1882 | ||
| 1883 | ||
| 4244 | 1884 | ROM_START( olysoc92 ) |
| 4245 | 1885 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* 68000 code */ |
| 4246 | 1886 | ROM_LOAD32_BYTE( "u025.1", 0x000000, 0x040000, CRC(a94e7780) SHA1(abbe328be425b4529e6b75ffa723c6771e4b6fcf) ) |
| r2375 | r2376 | |
| 4253 | 1893 | ROM_CONTINUE( 0x010000, 0x08000 ) /* banked stuff */ |
| 4254 | 1894 | |
| 4255 | 1895 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 4256 | ROM_LOAD( "seibu6.7x", 0x000000, 0x010000, CRC(21c1e1b8) SHA1(30928c8ef98bf32ba0bf795ddadba1c95fcffe9d) ) | |
| 4257 | ROM_LOAD( "seibu5.7y", 0x010000, 0x010000, CRC(955d9fd7) SHA1(782451e8e85f7ba285d6cacd9d3fdcf48bde60bc) ) | |
| 1896 | ROM_LOAD16_BYTE( "seibu6.7x", 0x000000, 0x010000, CRC(21c1e1b8) SHA1(30928c8ef98bf32ba0bf795ddadba1c95fcffe9d) ) | |
| 1897 | ROM_LOAD16_BYTE( "seibu5.7y", 0x000001, 0x010000, CRC(955d9fd7) SHA1(782451e8e85f7ba285d6cacd9d3fdcf48bde60bc) ) | |
| 4258 | 1898 | |
| 4259 | 1899 | ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 4260 | 1900 | ROM_LOAD( "obj.8c", 0x000000, 0x100000, CRC(e2377895) SHA1(1d1c7f31a08a464139cdaf383a5e1ade0717dc9f) ) |
| r2375 | r2376 | |
| 4304 | 1944 | |
| 4305 | 1945 | */ |
| 4306 | 1946 | |
| 4307 | ROM_START( cupsocb | |
| 1947 | ROM_START( cupsocsb | |
| 4308 | 1948 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* 68000 Code */ |
| 4309 | 1949 | ROM_LOAD16_BYTE( "sc_04.bin", 0x00001, 0x80000, CRC(22566087) SHA1(4392f46ca50cc9947823a5190aa25f5e9654aa0d) ) |
| 4310 | 1950 | ROM_LOAD16_BYTE( "sc_05.bin", 0x00000, 0x80000, CRC(2f977dff) SHA1(4d8d6e7d06ce17bb7292072965911f8b1f1067e2) ) |
| r2375 | r2376 | |
| 4315 | 1955 | ROM_CONTINUE( 0x000000, 0x08000 ) |
| 4316 | 1956 | |
| 4317 | 1957 | ROM_REGION( 0x020000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 4318 | ROM_LOAD( "seibu6.7x", 0x000000, 0x010000, CRC(21c1e1b8) SHA1(30928c8ef98bf32ba0bf795ddadba1c95fcffe9d) ) | |
| 4319 | ROM_LOAD( "seibu5.7y", 0x010000, 0x010000, CRC(955d9fd7) SHA1(782451e8e85f7ba285d6cacd9d3fdcf48bde60bc) ) | |
| 1958 | ROM_LOAD16_BYTE( "seibu6.7x", 0x000000, 0x010000, CRC(21c1e1b8) SHA1(30928c8ef98bf32ba0bf795ddadba1c95fcffe9d) ) | |
| 1959 | ROM_LOAD16_BYTE( "seibu5.7y", 0x000001, 0x010000, CRC(955d9fd7) SHA1(782451e8e85f7ba285d6cacd9d3fdcf48bde60bc) ) | |
| 4320 | 1960 | |
| 4321 | 1961 | ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 4322 | 1962 | ROM_LOAD( "obj.8c", 0x000000, 0x100000, CRC(e2377895) SHA1(1d1c7f31a08a464139cdaf383a5e1ade0717dc9f) ) |
| r2375 | r2376 | |
| 4354 | 1994 | ROM_LOAD( "sc_03.bin", 0x000000, 0x080000, CRC(6e254d12) SHA1(857779dbd276b688201a8ea3afd5817e38acad2e) ) |
| 4355 | 1995 | ROM_END |
| 4356 | 1996 | |
| 4357 | static DRIVER_INIT( legionna ) | |
| 4358 | { | |
| 4359 | /* Unscramble gfx: quarters 1&2 swapped, quarters 3&4 swapped */ | |
| 4360 | 1997 | |
| 4361 | UINT8 *gfx = memory_region(REGION_GFX1); | |
| 4362 | int len = memory_region_length(REGION_GFX1)/2; | |
| 4363 | int a,i; | |
| 4364 | 1998 | |
| 4365 | for (i = 0; i < len/2; i++) | |
| 4366 | { | |
| 4367 | a = gfx[i]; | |
| 4368 | gfx[i] = gfx[i + len/2]; | |
| 4369 | gfx[i+len/2] = a; | |
| 4370 | ||
| 4371 | a = gfx[i+len]; | |
| 4372 | gfx[i+len] = gfx[i + len/2 + len]; | |
| 4373 | gfx[i + len/2 +len] = a; | |
| 4374 | } | |
| 4375 | } | |
| 4376 | ||
| 4377 | 1999 | #define CUPSOC_DEBUG_MODE 1 |
| 4378 | 2000 | |
| 4379 | 2001 | static DRIVER_INIT( cupsoc ) |
| r2375 | r2376 | |
| 4387 | 2009 | #endif |
| 4388 | 2010 | } |
| 4389 | 2011 | |
| 2012 | static DRIVER_INIT( denjinmk ) | |
| 2013 | { | |
| 2014 | /* problem with audio comms? */ | |
| 2015 | UINT16 *ROM = (UINT16 *)memory_region(REGION_CPU1); | |
| 2016 | ROM[0x5fe4/2] = 0x4e71; | |
| 2017 | } | |
| 4390 | 2018 | |
| 4391 | GAME( 1992, legionna, 0, legionna, legionna, legionna, ROT0, "Tad", "Legionnaire (World)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 4392 | GAME( 1992, legionnu, legionna, legionna, legionna, legionna, ROT0, "Tad (Fabtek license)", "Legionnaire (US)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 2019 | DRIVER_INIT( legiongfx ) | |
| 2020 | { | |
| 2021 | descramble_legionnaire_gfx( memory_region(REGION_GFX5) ); | |
| 2022 | } | |
| 4393 | 2023 | |
| 4394 | GAME( 1992, heatbrl, 0, heatbrl, heatbrl, 0, ROT0, "Tad", "Heated Barrel (World)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 4395 | GAME( 1992, heatbrlo, heatbrl, heatbrl, heatbrl, 0, ROT0, "Tad", "Heated Barrel (World old version)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 4396 | GAME( 1992, heatbrlu, heatbrl, heatbrl, heatbrl, 0, ROT0, "Tad", "Heated Barrel (US)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 4397 | 2024 | |
| 2025 | ||
| 2026 | GAME( 1992, legionna, 0, legionna, legionna, legiongfx, ROT0, "Tad", "Legionnaire (World)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 2027 | GAME( 1992, legionnu, legionna, legionna, legionna, legiongfx, ROT0, "Tad (Fabtek license)", "Legionnaire (US)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 2028 | ||
| 2029 | GAME( 1992, heatbrl, 0, heatbrl, heatbrl, 0, ROT0, "Tad", "Heated Barrel (World)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 2030 | GAME( 1992, heatbrlo, heatbrl, heatbrl, heatbrl, 0, ROT0, "Tad", "Heated Barrel (World old version)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 2031 | GAME( 1992, heatbrlu, heatbrl, heatbrl, heatbrl, 0, ROT0, "Tad", "Heated Barrel (US)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 2032 | ||
| 4398 | 2033 | GAME( 1993, godzilla, 0, godzilla, godzilla, 0, ROT0, "Banpresto", "Godzilla", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) |
| 4399 | 2034 | GAME( 1993, sdgndmrb, 0, sdgndmrb, sdgndmrb, 0, ROT0, "Banpresto", "SD Gundam Sangokushi Rainbow Tairiku Senki", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) |
| 4400 | GAME( 1993, denjinmk, 0, denjinmk, | |
| 2035 | GAME( 1993, denjinmk, 0, denjinmk, | |
| 4401 | 2036 | |
| 4402 | GAME( 1992, cupsoc, 0, cupsoc, cupsoc, 0, ROT0, "Seibu", "Seibu Cup Soccer (set 1)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 4403 | GAME( 1992, cupsoc2, cupsoc, cupsoc, cupsoc, 0, ROT0, "Seibu", "Seibu Cup Soccer (set 2)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 2037 | GAME( 1992, cupsoc, 0, cupsoc, cupsoc, 0, ROT0, "Seibu", "Seibu Cup Soccer", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 2038 | GAME( 1992, cupsocs, cupsoc, cupsoc, cupsoc, 0, ROT0, "Seibu", "Seibu Cup Soccer :Selection: (set 1)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 2039 | GAME( 1992, cupsocs2, cupsoc, cupsoc, cupsoc, 0, ROT0, "Seibu", "Seibu Cup Soccer :Selection: (set 2)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 2040 | GAME( 1992, cupsocsb, cupsoc, cupsocbl, cupsoc, cupsoc, ROT0, "bootleg", "Seibu Cup Soccer :Selection: (bootleg)", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 4404 | 2041 | GAME( 1992, olysoc92, cupsoc, cupsoc, cupsoc, 0, ROT0, "Seibu", "Olympic Soccer '92", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) |
| 4405 | GAME( 1992, cupsocbl, cupsoc, cupsocbl, cupsoc, cupsoc, ROT0, "bootleg", "Seibu Cup Soccer (bootleg)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| r2375 | r2376 | |
|---|---|---|
| 180 | 180 | |
| 181 | 181 | static READ16_HANDLER( livequiz_eeprom_r ) |
| 182 | 182 | { |
| 183 | return | |
| 183 | return | |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | static WRITE16_HANDLER( livequiz_eeprom_w ) |
| r2375 | r2376 | |
|---|---|---|
| 74 | 74 | |
| 75 | 75 | READ8_HANDLER( zwackery_port_2_r ) |
| 76 | 76 | { |
| 77 | int result = readinputport(2); | |
| 78 | int wheel = readinputport(5); | |
| 77 | int result = input_port_read_indexed(machine, 2); | |
| 78 | int wheel = input_port_read_indexed(machine, 5); | |
| 79 | 79 | |
| 80 | 80 | return result | ((wheel >> 2) & 0x3e); |
| 81 | 81 | } |
| r2375 | r2376 | |
| 135 | 135 | |
| 136 | 136 | static READ16_HANDLER( spyhunt2_port_0_r ) |
| 137 | 137 | { |
| 138 | int result = | |
| 138 | int result = | |
| 139 | 139 | int which = (control_word >> 3) & 3; |
| 140 | int analog = | |
| 140 | int analog = | |
| 141 | 141 | return result | ((soundsgood_status_r(machine, 0) & 1) << 5) | (analog << 8); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
| 145 | 145 | static READ16_HANDLER( spyhunt2_port_1_r ) |
| 146 | 146 | { |
| 147 | int result = | |
| 147 | int result = | |
| 148 | 148 | return result | ((turbocs_status_r(machine, 0) & 1) << 7); |
| 149 | 149 | } |
| 150 | 150 | |
| r2375 | r2376 | |
| 197 | 197 | |
| 198 | 198 | static READ16_HANDLER( archrivl_port_1_r ) |
| 199 | 199 | { |
| 200 | return (translate49[readinputportbytag("49WAYY2") >> 4] << 12) | | |
| 201 | (translate49[readinputportbytag("49WAYX2") >> 4] << 8) | | |
| 202 | (translate49[readinputportbytag("49WAYY1") >> 4] << 4) | | |
| 203 | (translate49[readinputportbytag("49WAYX1") >> 4] << 0); | |
| 200 | return (translate49[input_port_read(machine, "49WAYY2") >> 4] << 12) | | |
| 201 | (translate49[input_port_read(machine, "49WAYX2") >> 4] << 8) | | |
| 202 | (translate49[input_port_read(machine, "49WAYY1") >> 4] << 4) | | |
| 203 | (translate49[input_port_read(machine, "49WAYX1") >> 4] << 0); | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
| r2375 | r2376 | |
| 259 | 259 | static READ16_HANDLER( pigskin_port_1_r ) |
| 260 | 260 | { |
| 261 | 261 | /* see archrivl_port_1_r for 49-way joystick description */ |
| 262 | return readinputportbytag("IN1") | | |
| 263 | (translate49[readinputportbytag("49WAYX1") >> 4] << 12) | | |
| 264 | (translate49[readinputportbytag("49WAYY1") >> 4] << 8); | |
| 262 | return input_port_read(machine, "IN1") | | |
| 263 | (translate49[input_port_read(machine, "49WAYX1") >> 4] << 12) | | |
| 264 | (translate49[input_port_read(machine, "49WAYY1") >> 4] << 8); | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | |
| 268 | 268 | static READ16_HANDLER( pigskin_port_2_r ) |
| 269 | 269 | { |
| 270 | 270 | /* see archrivl_port_1_r for 49-way joystick description */ |
| 271 | return readinputportbytag("DSW") | | |
| 272 | (translate49[readinputportbytag("49WAYX2") >> 4] << 12) | | |
| 273 | (translate49[readinputportbytag("49WAYY2") >> 4] << 8); | |
| 271 | return input_port_read(machine, "DSW") | | |
| 272 | (translate49[input_port_read(machine, "49WAYX2") >> 4] << 12) | | |
| 273 | (translate49[input_port_read(machine, "49WAYY2") >> 4] << 8); | |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | |
| r2375 | r2376 | |
| 283 | 283 | |
| 284 | 284 | static READ16_HANDLER( trisport_port_1_r ) |
| 285 | 285 | { |
| 286 | int xaxis = (INT8)readinputportbytag("AN1"); | |
| 287 | int yaxis = (INT8)readinputportbytag("AN2"); | |
| 288 | int result = readinputportbytag("IN1"); | |
| 286 | int xaxis = (INT8)input_port_read(machine, "AN1"); | |
| 287 | int yaxis = (INT8)input_port_read(machine, "AN2"); | |
| 288 | int result = input_port_read(machine, "IN1"); | |
| 289 | 289 | |
| 290 | 290 | result |= (xaxis & 0x3c) << 6; |
| 291 | 291 | result |= (yaxis & 0x3c) << 10; |
| r2375 | r2376 | |
|---|---|---|
| 177 | 177 | static int gsword_coins_in(void) |
| 178 | 178 | { |
| 179 | 179 | /* emulate 8741 coin slot */ |
| 180 | if ( | |
| 180 | if ( | |
| 181 | 181 | { |
| 182 | 182 | logerror("Coin In\n"); |
| 183 | 183 | return 0x80; |
| r2375 | r2376 | |
| 215 | 215 | switch (offset) |
| 216 | 216 | { |
| 217 | 217 | case 0x01: /* start button , coins */ |
| 218 | return | |
| 218 | return | |
| 219 | 219 | case 0x02: /* Player 1 Controller */ |
| 220 | return | |
| 220 | return | |
| 221 | 221 | case 0x04: /* Player 2 Controller */ |
| 222 | return | |
| 222 | return | |
| 223 | 223 | // default: |
| 224 | 224 | // logerror("8741-2 unknown read %d PC=%04x\n",offset,activecpu_get_pc()); |
| 225 | 225 | } |
| r2375 | r2376 | |
| 232 | 232 | switch (offset) |
| 233 | 233 | { |
| 234 | 234 | case 0x01: /* start button */ |
| 235 | return | |
| 235 | return | |
| 236 | 236 | case 0x02: /* Player 1 Controller? */ |
| 237 | return | |
| 237 | return | |
| 238 | 238 | case 0x04: /* Player 2 Controller? */ |
| 239 | return | |
| 239 | return | |
| 240 | 240 | } |
| 241 | 241 | /* unknown */ |
| 242 | 242 | // logerror("8741-3 unknown read %d PC=%04x\n",offset,activecpu_get_pc()); |
| r2375 | r2376 | |
|---|---|---|
| 460 | 460 | else irq3_line_hold(machine, cpunum); |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | static STATE_POSTLOAD( xmen_postload ) | |
| 464 | { | |
| 465 | sound_reset_bank(); | |
| 466 | } | |
| 467 | ||
| 463 | 468 | static MACHINE_START( xmen ) |
| 464 | 469 | { |
| 465 | 470 | state_save_register_global(sound_curbank); |
| 466 | state_save_register_ | |
| 471 | state_save_register_ | |
| 467 | 472 | } |
| 468 | 473 | |
| 469 | 474 | static MACHINE_DRIVER_START( xmen ) |
| r2375 | r2376 | |
| 489 | 494 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 490 | 495 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 491 | 496 | MDRV_SCREEN_SIZE(64*8, 32*8) |
| 492 | MDRV_SCREEN_VISIBLE_AREA(14*8, (64-14)*8-1, 2*8, 30*8-1 ) | |
| 493 | ||
| 497 | MDRV_SCREEN_VISIBLE_AREA(13*8, (64-13)*8-1, 2*8, 30*8-1 ) /* correct, same issue of TMNT2 */ | |
| 494 | 498 | MDRV_PALETTE_LENGTH(2048) |
| 495 | 499 | |
| 496 | 500 | MDRV_VIDEO_START(xmen) |
| r2375 | r2376 | |
|---|---|---|
| 148 | 148 | /* player inputs */ |
| 149 | 149 | static READ32_HANDLER(io32_r) |
| 150 | 150 | { |
| 151 | return (( | |
| 151 | return (( | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /* dipswitches */ |
| 155 | 155 | static READ32_HANDLER(io32_1_r) |
| 156 | 156 | { |
| 157 | return | |
| 157 | return | |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /* sound I/O */ |
| r2375 | r2376 | |
|---|---|---|
| 46 | 46 | |
| 47 | 47 | static READ8_HANDLER( analog_port_r ) |
| 48 | 48 | { |
| 49 | return | |
| 49 | return | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | static READ8_HANDLER( player_inputs_r ) |
| 53 | 53 | { |
| 54 | return | |
| 54 | return | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | static WRITE8_HANDLER( sound_irq_w ) |
| r2375 | r2376 | |
|---|---|---|
| 177 | 177 | #define SOUND_CLOCK XTAL_18_432MHz |
| 178 | 178 | |
| 179 | 179 | |
| 180 | #define GUNX( a ) (( ( readinputport( a ) * 287 ) / 0xff ) + 16) | |
| 181 | #define GUNY( a ) (( ( readinputport( a ) * 223 ) / 0xff ) + 10) | |
| 180 | #define GUNX( a ) (( ( input_port_read_indexed(machine, a ) * 287 ) / 0xff ) + 16) | |
| 181 | #define GUNY( a ) (( ( input_port_read_indexed(machine, a ) * 223 ) / 0xff ) + 10) | |
| 182 | 182 | |
| 183 | 183 | VIDEO_START(lethalen); |
| 184 | 184 | VIDEO_UPDATE(lethalen); |
| r2375 | r2376 | |
| 230 | 230 | |
| 231 | 231 | static READ8_HANDLER( control2_r ) |
| 232 | 232 | { |
| 233 | return 0x02 | EEPROM_read_bit() | (input_port_ | |
| 233 | return 0x02 | EEPROM_read_bit() | (input_port_ | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | static WRITE8_HANDLER( control2_w ) |
| r2375 | r2376 | |
|---|---|---|
| 26 | 26 | static WRITE8_HANDLER(videopin_out2_w); |
| 27 | 27 | |
| 28 | 28 | |
| 29 | static void update_plunger( | |
| 29 | static void update_plunger(running_machine *machine) | |
| 30 | 30 | { |
| 31 | UINT8 val = | |
| 31 | UINT8 val = | |
| 32 | 32 | |
| 33 | 33 | if (prev != val) |
| 34 | 34 | { |
| r2375 | r2376 | |
| 51 | 51 | { |
| 52 | 52 | int scanline = param; |
| 53 | 53 | |
| 54 | update_plunger(); | |
| 54 | update_plunger(machine); | |
| 55 | 55 | |
| 56 | 56 | cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); |
| 57 | 57 | |
| r2375 | r2376 | |
| 94 | 94 | // signals received. This results in the MPU displaying the |
| 95 | 95 | // ball being shot onto the playfield at a certain speed. |
| 96 | 96 | |
| 97 | UINT8 val = | |
| 97 | UINT8 val = | |
| 98 | 98 | |
| 99 | 99 | if (plunger >= 0.000 && plunger <= 0.001) |
| 100 | 100 | { |
| r2375 | r2376 | |
|---|---|---|
| 105 | 105 | |
| 106 | 106 | static READ8_HANDLER( vblank_r ) |
| 107 | 107 | { |
| 108 | return | |
| 108 | return | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2375 | r2376 | |
| 288 | 288 | { |
| 289 | 289 | static int coin = 0; |
| 290 | 290 | |
| 291 | if ( ( ~ | |
| 291 | if ( ( ~ | |
| 292 | 292 | if ( coin == 0 ) { |
| 293 | 293 | coin = 1; |
| 294 | 294 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| r2375 | r2376 | |
|---|---|---|
| 161 | 161 | { |
| 162 | 162 | switch (data) |
| 163 | 163 | { |
| 164 | case 0x00: protection_res = | |
| 164 | case 0x00: protection_res = | |
| 165 | 165 | case 0x20: protection_res = 0x49; break; |
| 166 | 166 | case 0x21: protection_res = 0x47; break; |
| 167 | 167 | case 0x22: protection_res = 0x53; break; |
| r2375 | r2376 | |
|---|---|---|
| 111 | 111 | |
| 112 | 112 | static READ8_HANDLER( in0_port_r ) |
| 113 | 113 | { |
| 114 | int in0 = input_port_ | |
| 114 | int in0 = input_port_ | |
| 115 | 115 | |
| 116 | 116 | if ( naughtyb_cocktail ) |
| 117 | 117 | { |
| 118 | 118 | // cabinet == cocktail -AND- handling player 2 |
| 119 | 119 | |
| 120 | 120 | in0 = ( in0 & 0x03 ) | // start buttons |
| 121 | ( input_port_ | |
| 121 | ( input_port_ | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | return in0; |
| r2375 | r2376 | |
| 128 | 128 | { |
| 129 | 129 | // vblank replaces the cabinet dip |
| 130 | 130 | |
| 131 | return ( ( input_port_2_r(machine,0) & 0x7F ) | // dsw0 | |
| 132 | ( input_port_3_r(machine,0) & 0x80 ) ); // vblank | |
| 131 | return ( ( input_port_read_indexed(machine, 2) & 0x7F ) | // dsw0 | |
| 132 | ( input_port_read_indexed(machine, 3) & 0x80 ) ); // vblank | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /* Pop Flamer |
| r2375 | r2376 | |
| 217 | 217 | |
| 218 | 218 | static INTERRUPT_GEN( naughtyb_interrupt ) |
| 219 | 219 | { |
| 220 | if ( | |
| 220 | if ( | |
| 221 | 221 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 222 | 222 | } |
| 223 | 223 |
| r2375 | r2376 | |
|---|---|---|
| 54 | 54 | { |
| 55 | 55 | UINT8 val = 0; |
| 56 | 56 | |
| 57 | if ( | |
| 57 | if ( | |
| 58 | 58 | { |
| 59 | 59 | val |= 0x80; |
| 60 | 60 | } |
| 61 | if ( | |
| 61 | if ( | |
| 62 | 62 | { |
| 63 | 63 | val |= 0x40; |
| 64 | 64 | } |
| r2375 | r2376 | |
| 69 | 69 | |
| 70 | 70 | static READ8_HANDLER( runaway_pot_r ) |
| 71 | 71 | { |
| 72 | return ( | |
| 72 | return ( | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 |
| r2375 | r2376 | |
|---|---|---|
| 394 | 394 | |
| 395 | 395 | static const struct dma8237_interface dma8237_2_config = |
| 396 | 396 | { |
| 397 | 0, | |
| 398 | 1.0e-6, // 1us | |
| 397 | 0, | |
| 398 | 1.0e-6, // 1us | |
| 399 | 399 | |
| 400 | 400 | NULL, |
| 401 | 401 | NULL, |
| r2375 | r2376 | |
| 616 | 616 | pic8259_set_irq_line(1, 6, state); |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | static int taitowlf_get_out2(running_machine *machine) { | |
| 620 | return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2 ); | |
| 621 | } | |
| 622 | ||
| 619 | 623 | static const struct kbdc8042_interface at8042 = |
| 620 | 624 | { |
| 621 | KBDC8042_AT386, set_gate_a20, keyboard_interrupt | |
| 625 | KBDC8042_AT386, set_gate_a20, keyboard_interrupt, taitowlf_get_out2 | |
| 622 | 626 | }; |
| 623 | 627 | |
| 624 | 628 | static const struct ide_interface ide_intf = |
| r2375 | r2376 | |
|---|---|---|
| 56 | 56 | |
| 57 | 57 | ***************************************************************************/ |
| 58 | 58 | |
| 59 | static READ8_HANDLER( in0_l ) { return readinputport(0); } // P1 joystick | |
| 60 | static READ8_HANDLER( in0_h ) { return readinputport(0) >> 4; } // P2 joystick | |
| 61 | static READ8_HANDLER( in1_l ) { return readinputport(1); } // fire and start buttons | |
| 62 | static READ8_HANDLER( in1_h ) { return readinputport(1) >> 4; } // coins | |
| 63 | static READ8_HANDLER( dipA_l ) { return readinputport(2); } // dips A | |
| 64 | static READ8_HANDLER( dipA_h ) { return readinputport(2) >> 4; } // dips A | |
| 65 | static READ8_HANDLER( dipB_l ) { return readinputport(3); } // dips B | |
| 66 | static READ8_HANDLER( dipB_h ) { return readinputport(3) >> 4; } // dips B | |
| 67 | static READ8_HANDLER( in2_l ) { return readinputport(4); } // P1 joystick left in liblrabl | |
| 68 | static READ8_HANDLER( in2_h ) { return readinputport(4) >> 4; } // P2 joystick left in liblrabl | |
| 69 | static READ8_HANDLER( in3 ) { return readinputport(5); } // test, cocktail, optional buttons | |
| 59 | static READ8_HANDLER( in0_l ) { return input_port_read_indexed(machine, 0); } // P1 joystick | |
| 60 | static READ8_HANDLER( in0_h ) { return input_port_read_indexed(machine, 0) >> 4; } // P2 joystick | |
| 61 | static READ8_HANDLER( in1_l ) { return input_port_read_indexed(machine, 1); } // fire and start buttons | |
| 62 | static READ8_HANDLER( in1_h ) { return input_port_read_indexed(machine, 1) >> 4; } // coins | |
| 63 | static READ8_HANDLER( dipA_l ) { return input_port_read_indexed(machine, 2); } // dips A | |
| 64 | static READ8_HANDLER( dipA_h ) { return input_port_read_indexed(machine, 2) >> 4; } // dips A | |
| 65 | static READ8_HANDLER( dipB_l ) { return input_port_read_indexed(machine, 3); } // dips B | |
| 66 | static READ8_HANDLER( dipB_h ) { return input_port_read_indexed(machine, 3) >> 4; } // dips B | |
| 67 | static READ8_HANDLER( in2_l ) { return input_port_read_indexed(machine, 4); } // P1 joystick left in liblrabl | |
| 68 | static READ8_HANDLER( in2_h ) { return input_port_read_indexed(machine, 4) >> 4; } // P2 joystick left in liblrabl | |
| 69 | static READ8_HANDLER( in3 ) { return input_port_read_indexed(machine, 5); } // test, cocktail, optional buttons | |
| 70 | 70 | static WRITE8_HANDLER( out_coin0 ) |
| 71 | 71 | { |
| 72 | 72 | coin_lockout_global_w(data & 4); |
| r2375 | r2376 | |
|---|---|---|
| 355 | 355 | switch (offset<<1) |
| 356 | 356 | { |
| 357 | 357 | case 0: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 358 | return ( | |
| 358 | return ( | |
| 359 | 359 | case 2: /* Dips */ |
| 360 | return ( | |
| 360 | return ( | |
| 361 | 361 | case 8: /* Credits */ |
| 362 | return | |
| 362 | return | |
| 363 | 363 | case 10: /* ? */ |
| 364 | 364 | case 12: |
| 365 | 365 | return 0; |
| r2375 | r2376 | |
| 3360 | 3360 | { |
| 3361 | 3361 | // mame_printf_debug("bcstory_io %06x\n",activecpu_get_pc()); |
| 3362 | 3362 | if (activecpu_get_pc()==0x0560) return 0x1a0; |
| 3363 | else return | |
| 3363 | else return | |
| 3364 | 3364 | } |
| 3365 | 3365 | |
| 3366 | 3366 | static DRIVER_INIT ( bcstory ) |
| r2375 | r2376 | |
|---|---|---|
| 811 | 811 | |
| 812 | 812 | switch(offset) |
| 813 | 813 | { |
| 814 | case 0x01: return | |
| 814 | case 0x01: return | |
| 815 | 815 | case 0x03: return (int)(upd7759_0_busy_r(machine,0))<<3; |
| 816 | 816 | default: return 0; |
| 817 | 817 | } |
| r2375 | r2376 | |
|---|---|---|
| 28 | 28 | |
| 29 | 29 | static CUSTOM_INPUT( get_joystick ) |
| 30 | 30 | { |
| 31 | UINT8 joy = | |
| 31 | UINT8 joy = | |
| 32 | 32 | |
| 33 | 33 | if (joy == 1) |
| 34 | 34 | { |
| r2375 | r2376 | |
| 52 | 52 | |
| 53 | 53 | /* NMI and watchdog are disabled during service mode */ |
| 54 | 54 | |
| 55 | watchdog_enable(machine, | |
| 55 | watchdog_enable(machine, | |
| 56 | 56 | |
| 57 | if ( | |
| 57 | if ( | |
| 58 | 58 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 59 | 59 | |
| 60 | 60 | timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, nmi_callback); |
| r2375 | r2376 | |
| 75 | 75 | |
| 76 | 76 | static READ8_HANDLER( ultratnk_analog_r ) |
| 77 | 77 | { |
| 78 | return ( | |
| 78 | return ( | |
| 79 | 79 | } |
| 80 | 80 | static READ8_HANDLER( ultratnk_coin_r ) |
| 81 | 81 | { |
| 82 | return ( | |
| 82 | return ( | |
| 83 | 83 | } |
| 84 | 84 | static READ8_HANDLER( ultratnk_collision_r ) |
| 85 | 85 | { |
| 86 | return ( | |
| 86 | return ( | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | static READ8_HANDLER( ultratnk_options_r ) |
| 91 | 91 | { |
| 92 | return ( | |
| 92 | return ( | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 |
| r2375 | r2376 | |
|---|---|---|
| 1155 | 1155 | |
| 1156 | 1156 | |
| 1157 | 1157 | |
| 1158 | static STATE_POSTLOAD( quizf1_postload ) | |
| 1159 | { | |
| 1160 | set_m90_bank(); | |
| 1161 | } | |
| 1158 | 1162 | |
| 1159 | 1163 | static DRIVER_INIT( quizf1 ) |
| 1160 | 1164 | { |
| r2375 | r2376 | |
| 1162 | 1166 | set_m90_bank(); |
| 1163 | 1167 | |
| 1164 | 1168 | state_save_register_global(bankaddress); |
| 1165 | state_save_register_ | |
| 1169 | state_save_register_ | |
| 1166 | 1170 | } |
| 1167 | 1171 | |
| 1168 | 1172 |
| r2375 | r2376 | |
|---|---|---|
| 130 | 130 | static READ8_HANDLER( tugboat_input_r ) |
| 131 | 131 | { |
| 132 | 132 | if (~ctrl & 0x80) |
| 133 | return | |
| 133 | return | |
| 134 | 134 | else if (~ctrl & 0x40) |
| 135 | return | |
| 135 | return | |
| 136 | 136 | else if (~ctrl & 0x20) |
| 137 | return | |
| 137 | return | |
| 138 | 138 | else if (~ctrl & 0x10) |
| 139 | return | |
| 139 | return | |
| 140 | 140 | else |
| 141 | return | |
| 141 | return | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | static READ8_HANDLER( tugboat_ctrl_r ) |
| r2375 | r2376 | |
|---|---|---|
| 520 | 520 | TODO Lists |
| 521 | 521 | ========== |
| 522 | 522 | |
| 523 | Add cpu idle time skip to improve speed. | |
| 524 | ||
| 525 | 523 | Is the no-Z80 sound handling correct: some voices in Bshark |
| 526 | 524 | aren't that clear. |
| 527 | 525 | |
| r2375 | r2376 | |
| 582 | 580 | |
| 583 | 581 | Some layer offsets are out a little. |
| 584 | 582 | |
| 583 | Road layer has wrong colors--regression? | |
| 585 | 584 | |
| 585 | ||
| 586 | 586 | Battle Shark |
| 587 | 587 | ------------ |
| 588 | 588 | |
| r2375 | r2376 | |
| 777 | 777 | #include "video/taitoic.h" |
| 778 | 778 | #include "audio/taitosnd.h" |
| 779 | 779 | #include "sound/2610intf.h" |
| 780 | #include "sound/flt_vol.h" | |
| 780 | 781 | |
| 781 | 782 | VIDEO_START( taitoz ); |
| 782 | 783 | VIDEO_START( spacegun ); |
| r2375 | r2376 | |
| 1399 | 1400 | #endif |
| 1400 | 1401 | |
| 1401 | 1402 | |
| 1403 | /**** sound pan control ****/ | |
| 1404 | static WRITE8_HANDLER( taitoz_pancontrol ) | |
| 1405 | { | |
| 1406 | // static UINT8 taitoz_pandata[4]; | |
| 1407 | ||
| 1408 | offset = offset&3; | |
| 1409 | ||
| 1410 | // taitoz_pandata[offset] = data; | |
| 1411 | // popmessage(" pan %02x %02x %02x %02x", taitoz_pandata[0], taitoz_pandata[1], taitoz_pandata[2], taitoz_pandata[3] ); | |
| 1412 | ||
| 1413 | flt_volume_set_volume(offset, data / 255.0f); | |
| 1414 | } | |
| 1415 | ||
| 1416 | static WRITE16_HANDLER( spacegun_pancontrol ) | |
| 1417 | { | |
| 1418 | if (ACCESSING_BITS_0_7) | |
| 1419 | taitoz_pancontrol(machine,offset,data & 0xff); | |
| 1420 | } | |
| 1421 | ||
| 1422 | ||
| 1402 | 1423 | /*********************************************************** |
| 1403 | 1424 | SAVE STATES |
| 1404 | 1425 | ***********************************************************/ |
| 1405 | 1426 | |
| 1427 | static STATE_POSTLOAD( taitoz_postload ) | |
| 1428 | { | |
| 1429 | parse_control(); | |
| 1430 | reset_sound_region(); | |
| 1431 | } | |
| 1432 | ||
| 1406 | 1433 | static MACHINE_START( taitoz ) |
| 1407 | 1434 | { |
| 1408 | 1435 | state_save_register_global(cpua_ctrl); |
| 1409 | state_save_register_func_postload(parse_control); | |
| 1410 | 1436 | |
| 1411 | 1437 | /* these are specific to various games: we ought to split the inits */ |
| 1412 | 1438 | state_save_register_global(sci_int6); |
| r2375 | r2376 | |
| 1414 | 1440 | state_save_register_global(ioc220_port); |
| 1415 | 1441 | |
| 1416 | 1442 | state_save_register_global(banknum); |
| 1417 | state_save_register_ | |
| 1443 | state_save_register_ | |
| 1418 | 1444 | } |
| 1419 | 1445 | |
| 1420 | 1446 | |
| r2375 | r2376 | |
| 1595 | 1621 | AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM) |
| 1596 | 1622 | AM_RANGE(0x108000, 0x10bfff) AM_WRITE(SMH_RAM) |
| 1597 | 1623 | AM_RANGE(0x110000, 0x113fff) AM_WRITE(sharedram_w) |
| 1598 | ||
| 1624 | | |
| 1599 | 1625 | AM_RANGE(0x600000, 0x600001) AM_WRITE(YM2610_control_port_0_A_lsb_w) |
| 1600 | 1626 | AM_RANGE(0x600002, 0x600003) AM_WRITE(YM2610_data_port_0_A_lsb_w) |
| 1601 | 1627 | AM_RANGE(0x600004, 0x600005) AM_WRITE(YM2610_control_port_0_B_lsb_w) |
| r2375 | r2376 | |
| 1784 | 1810 | AM_RANGE(0xc00006, 0xc00007) AM_WRITE(YM2610_data_port_0_B_lsb_w) |
| 1785 | 1811 | AM_RANGE(0xc0000c, 0xc0000d) AM_WRITE(SMH_NOP) // interrupt controller? |
| 1786 | 1812 | AM_RANGE(0xc0000e, 0xc0000f) AM_WRITE(SMH_NOP) |
| 1787 | ||
| 1813 | | |
| 1788 | 1814 | // AM_RANGE(0xe00000, 0xe00001) AM_WRITE(SMH_NOP) /* ??? */ |
| 1789 | 1815 | AM_RANGE(0xf00000, 0xf00007) AM_WRITE(spacegun_lightgun_w) |
| 1790 | 1816 | ADDRESS_MAP_END |
| r2375 | r2376 | |
| 1904 | 1930 | AM_RANGE(0xe003, 0xe003) AM_WRITE(YM2610_data_port_0_B_w) |
| 1905 | 1931 | AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w) |
| 1906 | 1932 | AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w) |
| 1907 | AM_RANGE(0xe400, 0xe403) AM_WRITE( | |
| 1933 | AM_RANGE(0xe400, 0xe403) AM_WRITE(taitoz_pancontrol) /* pan */ | |
| 1908 | 1934 | AM_RANGE(0xee00, 0xee00) AM_WRITE(SMH_NOP) /* ? */ |
| 1909 | 1935 | AM_RANGE(0xf000, 0xf000) AM_WRITE(SMH_NOP) /* ? */ |
| 1910 | 1936 | AM_RANGE(0xf200, 0xf200) AM_WRITE(sound_bankswitch_w) |
| r2375 | r2376 | |
| 2003 | 2029 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 ) |
| 2004 | 2030 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 2005 | 2031 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 2006 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) /* 3 for accel [7 levels] */ | |
| 2007 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) | |
| 2032 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) /* 3 for accel [7 levels] */ | |
| 2033 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) | |
| 2008 | 2034 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) /* main accel key */ |
| 2009 | 2035 | |
| 2010 | 2036 | PORT_START /* IN1: b3 not mapped: standardized on holding b4=lo gear */ |
| r2375 | r2376 | |
| 2012 | 2038 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2013 | 2039 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT ) |
| 2014 | 2040 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) |
| 2015 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) /* gear shift lo/hi */ | |
| 2016 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(1) /* 3 for brake [7 levels] */ | |
| 2017 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1) | |
| 2041 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) /* gear shift lo/hi */ | |
| 2042 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1) /* 3 for brake [7 levels] */ | |
| 2043 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) | |
| 2018 | 2044 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) /* main brake key */ |
| 2019 | 2045 | |
| 2020 | 2046 | PORT_START /* IN2, unused */ |
| r2375 | r2376 | |
| 2862 | 2888 | MDRV_VIDEO_UPDATE(contcirc) |
| 2863 | 2889 | |
| 2864 | 2890 | /* sound hardware */ |
| 2865 | MDRV_SPEAKER_STANDARD_STEREO("left", "right") | |
| 2891 | MDRV_SPEAKER_ADD("front", 0.0, 0.0, 0.7) | |
| 2892 | MDRV_SPEAKER_ADD("rear", 0.0, 0.0, 1.3) | |
| 2893 | MDRV_SPEAKER_ADD("subwoofer", 0.0, 0.0, 1.0) | |
| 2866 | 2894 | |
| 2867 | 2895 | MDRV_SOUND_ADD(YM2610, 16000000/2) |
| 2868 | 2896 | MDRV_SOUND_CONFIG(ym2610_interface) |
| 2869 | MDRV_SOUND_ROUTE(0, "left", 0.25) | |
| 2870 | MDRV_SOUND_ROUTE(0, "right", 0.25) | |
| 2871 | MDRV_SOUND_ROUTE(1, "left", 1.0) | |
| 2872 | MDRV_SOUND_ROUTE(2, "right", 1.0) | |
| 2897 | MDRV_SOUND_ROUTE(0, "subwoofer", 0.20) | |
| 2898 | MDRV_SOUND_ROUTE(1, "2610.1.l", 2.0) | |
| 2899 | MDRV_SOUND_ROUTE(1, "2610.1.r", 2.0) | |
| 2900 | MDRV_SOUND_ROUTE(2, "2610.2.l", 2.0) | |
| 2901 | MDRV_SOUND_ROUTE(2, "2610.2.r", 2.0) | |
| 2873 | 2902 | |
| 2903 | MDRV_SOUND_ADD_TAG("2610.1.r", FILTER_VOLUME, 0) | |
| 2904 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rear", 1.0) | |
| 2905 | MDRV_SOUND_ADD_TAG("2610.1.l", FILTER_VOLUME, 0) | |
| 2906 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "front", 1.0) | |
| 2907 | MDRV_SOUND_ADD_TAG("2610.2.r", FILTER_VOLUME, 0) | |
| 2908 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rear", 1.0) | |
| 2909 | MDRV_SOUND_ADD_TAG("2610.2.l", FILTER_VOLUME, 0) | |
| 2910 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "front", 1.0) | |
| 2911 | ||
| 2874 | 2912 | // MDRV_SOUND_ADD(CUSTOM, subwoofer_interface) |
| 2875 | 2913 | MACHINE_DRIVER_END |
| 2876 | 2914 | |
| r2375 | r2376 | |
| 2909 | 2947 | /* sound hardware */ |
| 2910 | 2948 | MDRV_SPEAKER_ADD("front", 0.0, 0.0, 0.7) |
| 2911 | 2949 | MDRV_SPEAKER_ADD("rear", 0.0, 0.0, 1.3) |
| 2950 | MDRV_SPEAKER_ADD("subwoofer", 0.0, 0.0, 1.0) | |
| 2912 | 2951 | |
| 2913 | 2952 | MDRV_SOUND_ADD(YM2610, 16000000/2) |
| 2914 | 2953 | MDRV_SOUND_CONFIG(ym2610_interface) |
| 2915 | MDRV_SOUND_ROUTE(0, "rear", 0.25) | |
| 2916 | MDRV_SOUND_ROUTE(0, "front", 0.25) | |
| 2917 | MDRV_SOUND_ROUTE(1, "rear", 1.0) | |
| 2918 | MDRV_SOUND_ROUTE(2, "front", 1.0) | |
| 2954 | MDRV_SOUND_ROUTE(0, "subwoofer", 0.20) | |
| 2955 | MDRV_SOUND_ROUTE(1, "2610.1.l", 1.0) | |
| 2956 | MDRV_SOUND_ROUTE(1, "2610.1.r", 1.0) | |
| 2957 | MDRV_SOUND_ROUTE(2, "2610.2.l", 1.0) | |
| 2958 | MDRV_SOUND_ROUTE(2, "2610.2.r", 1.0) | |
| 2959 | ||
| 2960 | MDRV_SOUND_ADD_TAG("2610.1.r", FILTER_VOLUME, 0) | |
| 2961 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rear", 1.0) | |
| 2962 | MDRV_SOUND_ADD_TAG("2610.1.l", FILTER_VOLUME, 0) | |
| 2963 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "front", 1.0) | |
| 2964 | MDRV_SOUND_ADD_TAG("2610.2.r", FILTER_VOLUME, 0) | |
| 2965 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rear", 1.0) | |
| 2966 | MDRV_SOUND_ADD_TAG("2610.2.l", FILTER_VOLUME, 0) | |
| 2967 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "front", 1.0) | |
| 2919 | 2968 | MACHINE_DRIVER_END |
| 2920 | 2969 | |
| 2921 | 2970 | |
| r2375 | r2376 | |
| 2959 | 3008 | MDRV_SOUND_CONFIG(ym2610_interface) |
| 2960 | 3009 | MDRV_SOUND_ROUTE(0, "left", 0.25) |
| 2961 | 3010 | MDRV_SOUND_ROUTE(0, "right", 0.25) |
| 2962 | MDRV_SOUND_ROUTE(1, "left", 1.0) | |
| 2963 | MDRV_SOUND_ROUTE(2, "right", 1.0) | |
| 3011 | MDRV_SOUND_ROUTE(1, "2610.1.l", 20.0) | |
| 3012 | MDRV_SOUND_ROUTE(1, "2610.1.r", 20.0) | |
| 3013 | MDRV_SOUND_ROUTE(2, "2610.2.l", 20.0) | |
| 3014 | MDRV_SOUND_ROUTE(2, "2610.2.r", 20.0) | |
| 2964 | 3015 | |
| 3016 | MDRV_SOUND_ADD_TAG("2610.1.r", FILTER_VOLUME, 0) | |
| 3017 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3018 | MDRV_SOUND_ADD_TAG("2610.1.l", FILTER_VOLUME, 0) | |
| 3019 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3020 | MDRV_SOUND_ADD_TAG("2610.2.r", FILTER_VOLUME, 0) | |
| 3021 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3022 | MDRV_SOUND_ADD_TAG("2610.2.l", FILTER_VOLUME, 0) | |
| 3023 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3024 | ||
| 2965 | 3025 | // MDRV_SOUND_ADD(CUSTOM, subwoofer_interface) |
| 2966 | 3026 | MACHINE_DRIVER_END |
| 2967 | 3027 | |
| r2375 | r2376 | |
| 3002 | 3062 | MDRV_SOUND_CONFIG(ym2610_interfaceb) |
| 3003 | 3063 | MDRV_SOUND_ROUTE(0, "left", 0.25) |
| 3004 | 3064 | MDRV_SOUND_ROUTE(0, "right", 0.25) |
| 3005 | MDRV_SOUND_ROUTE(1, "left", 1.0) | |
| 3006 | MDRV_SOUND_ROUTE(2, "right", 1.0) | |
| 3065 | MDRV_SOUND_ROUTE(1, "2610.1.l", 28.0) | |
| 3066 | MDRV_SOUND_ROUTE(1, "2610.1.r", 28.0) | |
| 3067 | MDRV_SOUND_ROUTE(2, "2610.2.l", 28.0) | |
| 3068 | MDRV_SOUND_ROUTE(2, "2610.2.r", 28.0) | |
| 3069 | ||
| 3070 | MDRV_SOUND_ADD_TAG("2610.1.r", FILTER_VOLUME, 0) | |
| 3071 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3072 | MDRV_SOUND_ADD_TAG("2610.1.l", FILTER_VOLUME, 0) | |
| 3073 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3074 | MDRV_SOUND_ADD_TAG("2610.2.r", FILTER_VOLUME, 0) | |
| 3075 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3076 | MDRV_SOUND_ADD_TAG("2610.2.l", FILTER_VOLUME, 0) | |
| 3077 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3007 | 3078 | MACHINE_DRIVER_END |
| 3008 | 3079 | |
| 3009 | 3080 | |
| r2375 | r2376 | |
| 3047 | 3118 | MDRV_SOUND_CONFIG(ym2610_interface) |
| 3048 | 3119 | MDRV_SOUND_ROUTE(0, "left", 0.25) |
| 3049 | 3120 | MDRV_SOUND_ROUTE(0, "right", 0.25) |
| 3050 | MDRV_SOUND_ROUTE(1, "left", 1.0) | |
| 3051 | MDRV_SOUND_ROUTE(2, "right", 1.0) | |
| 3121 | MDRV_SOUND_ROUTE(1, "2610.1.l", 2.0) | |
| 3122 | MDRV_SOUND_ROUTE(1, "2610.1.r", 2.0) | |
| 3123 | MDRV_SOUND_ROUTE(2, "2610.2.l", 2.0) | |
| 3124 | MDRV_SOUND_ROUTE(2, "2610.2.r", 2.0) | |
| 3125 | ||
| 3126 | MDRV_SOUND_ADD_TAG("2610.1.r", FILTER_VOLUME, 0) | |
| 3127 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3128 | MDRV_SOUND_ADD_TAG("2610.1.l", FILTER_VOLUME, 0) | |
| 3129 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3130 | MDRV_SOUND_ADD_TAG("2610.2.r", FILTER_VOLUME, 0) | |
| 3131 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3132 | MDRV_SOUND_ADD_TAG("2610.2.l", FILTER_VOLUME, 0) | |
| 3133 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3052 | 3134 | MACHINE_DRIVER_END |
| 3053 | 3135 | |
| 3054 | 3136 | |
| r2375 | r2376 | |
| 3088 | 3170 | /* sound hardware */ |
| 3089 | 3171 | MDRV_SPEAKER_ADD("front", 0.0, 0.0, 0.7) |
| 3090 | 3172 | MDRV_SPEAKER_ADD("rear", 0.0, 0.0, 1.3) |
| 3173 | MDRV_SPEAKER_ADD("subwoofer", 0.0, 0.0, 1.0) | |
| 3091 | 3174 | |
| 3092 | 3175 | MDRV_SOUND_ADD(YM2610, 16000000/2) |
| 3093 | 3176 | MDRV_SOUND_CONFIG(ym2610_interface) |
| 3094 | MDRV_SOUND_ROUTE(0, "front", 0.25) | |
| 3095 | MDRV_SOUND_ROUTE(0, "rear", 0.25) | |
| 3096 | MDRV_SOUND_ROUTE(1, "front", 1.0) | |
| 3097 | MDRV_SOUND_ROUTE(2, "rear", 1.0) | |
| 3177 | MDRV_SOUND_ROUTE(0, "subwoofer", 0.20) | |
| 3178 | MDRV_SOUND_ROUTE(1, "2610.1.l", 2.0) | |
| 3179 | MDRV_SOUND_ROUTE(1, "2610.1.r", 2.0) | |
| 3180 | MDRV_SOUND_ROUTE(2, "2610.2.l", 2.0) | |
| 3181 | MDRV_SOUND_ROUTE(2, "2610.2.r", 2.0) | |
| 3182 | ||
| 3183 | MDRV_SOUND_ADD_TAG("2610.1.r", FILTER_VOLUME, 0) | |
| 3184 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rear", 1.0) | |
| 3185 | MDRV_SOUND_ADD_TAG("2610.1.l", FILTER_VOLUME, 0) | |
| 3186 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "front", 1.0) | |
| 3187 | MDRV_SOUND_ADD_TAG("2610.2.r", FILTER_VOLUME, 0) | |
| 3188 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rear", 1.0) | |
| 3189 | MDRV_SOUND_ADD_TAG("2610.2.l", FILTER_VOLUME, 0) | |
| 3190 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "front", 1.0) | |
| 3098 | 3191 | MACHINE_DRIVER_END |
| 3099 | 3192 | |
| 3100 | 3193 | |
| r2375 | r2376 | |
| 3138 | 3231 | MDRV_SOUND_CONFIG(ym2610_interface) |
| 3139 | 3232 | MDRV_SOUND_ROUTE(0, "left", 0.25) |
| 3140 | 3233 | MDRV_SOUND_ROUTE(0, "right", 0.25) |
| 3141 | MDRV_SOUND_ROUTE(1, "left", 1.0) | |
| 3142 | MDRV_SOUND_ROUTE(2, "right", 1.0) | |
| 3234 | MDRV_SOUND_ROUTE(1, "2610.1.l", 2.0) | |
| 3235 | MDRV_SOUND_ROUTE(1, "2610.1.r", 2.0) | |
| 3236 | MDRV_SOUND_ROUTE(2, "2610.2.l", 2.0) | |
| 3237 | MDRV_SOUND_ROUTE(2, "2610.2.r", 2.0) | |
| 3238 | ||
| 3239 | MDRV_SOUND_ADD_TAG("2610.1.r", FILTER_VOLUME, 0) | |
| 3240 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3241 | MDRV_SOUND_ADD_TAG("2610.1.l", FILTER_VOLUME, 0) | |
| 3242 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3243 | MDRV_SOUND_ADD_TAG("2610.2.r", FILTER_VOLUME, 0) | |
| 3244 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3245 | MDRV_SOUND_ADD_TAG("2610.2.l", FILTER_VOLUME, 0) | |
| 3246 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3143 | 3247 | MACHINE_DRIVER_END |
| 3144 | 3248 | |
| 3145 | 3249 | |
| r2375 | r2376 | |
| 3179 | 3283 | MDRV_SOUND_CONFIG(ym2610_interfaceb) |
| 3180 | 3284 | MDRV_SOUND_ROUTE(0, "left", 0.25) |
| 3181 | 3285 | MDRV_SOUND_ROUTE(0, "right", 0.25) |
| 3182 | MDRV_SOUND_ROUTE(1, "left", 1.0) | |
| 3183 | MDRV_SOUND_ROUTE(2, "right", 1.0) | |
| 3286 | MDRV_SOUND_ROUTE(1, "2610.1.l", 8.0) | |
| 3287 | MDRV_SOUND_ROUTE(1, "2610.1.r", 8.0) | |
| 3288 | MDRV_SOUND_ROUTE(2, "2610.2.l", 8.0) | |
| 3289 | MDRV_SOUND_ROUTE(2, "2610.2.r", 8.0) | |
| 3290 | ||
| 3291 | MDRV_SOUND_ADD_TAG("2610.1.r", FILTER_VOLUME, 0) | |
| 3292 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3293 | MDRV_SOUND_ADD_TAG("2610.1.l", FILTER_VOLUME, 0) | |
| 3294 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3295 | MDRV_SOUND_ADD_TAG("2610.2.r", FILTER_VOLUME, 0) | |
| 3296 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3297 | MDRV_SOUND_ADD_TAG("2610.2.l", FILTER_VOLUME, 0) | |
| 3298 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3184 | 3299 | MACHINE_DRIVER_END |
| 3185 | 3300 | |
| 3186 | 3301 | |
| r2375 | r2376 | |
| 3224 | 3339 | MDRV_SOUND_CONFIG(ym2610_interface) |
| 3225 | 3340 | MDRV_SOUND_ROUTE(0, "left", 0.25) |
| 3226 | 3341 | MDRV_SOUND_ROUTE(0, "right", 0.25) |
| 3227 | MDRV_SOUND_ROUTE(1, "left", 1.0) | |
| 3228 | MDRV_SOUND_ROUTE(2, "right", 1.0) | |
| 3342 | MDRV_SOUND_ROUTE(1, "2610.1.l", 8.0) | |
| 3343 | MDRV_SOUND_ROUTE(1, "2610.1.r", 8.0) | |
| 3344 | MDRV_SOUND_ROUTE(2, "2610.2.l", 8.0) | |
| 3345 | MDRV_SOUND_ROUTE(2, "2610.2.r", 8.0) | |
| 3346 | ||
| 3347 | MDRV_SOUND_ADD_TAG("2610.1.r", FILTER_VOLUME, 0) | |
| 3348 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3349 | MDRV_SOUND_ADD_TAG("2610.1.l", FILTER_VOLUME, 0) | |
| 3350 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3351 | MDRV_SOUND_ADD_TAG("2610.2.r", FILTER_VOLUME, 0) | |
| 3352 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3353 | MDRV_SOUND_ADD_TAG("2610.2.l", FILTER_VOLUME, 0) | |
| 3354 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3229 | 3355 | MACHINE_DRIVER_END |
| 3230 | 3356 | |
| 3231 | 3357 | |
| r2375 | r2376 | |
| 3268 | 3394 | MDRV_SOUND_CONFIG(ym2610_interface) |
| 3269 | 3395 | MDRV_SOUND_ROUTE(0, "left", 0.25) |
| 3270 | 3396 | MDRV_SOUND_ROUTE(0, "right", 0.25) |
| 3271 | MDRV_SOUND_ROUTE(1, "left", 1.0) | |
| 3272 | MDRV_SOUND_ROUTE(2, "right", 1.0) | |
| 3397 | MDRV_SOUND_ROUTE(1, "2610.1.l", 8.0) | |
| 3398 | MDRV_SOUND_ROUTE(1, "2610.1.r", 8.0) | |
| 3399 | MDRV_SOUND_ROUTE(2, "2610.2.l", 8.0) | |
| 3400 | MDRV_SOUND_ROUTE(2, "2610.2.r", 8.0) | |
| 3401 | ||
| 3402 | MDRV_SOUND_ADD_TAG("2610.1.r", FILTER_VOLUME, 0) | |
| 3403 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3404 | MDRV_SOUND_ADD_TAG("2610.1.l", FILTER_VOLUME, 0) | |
| 3405 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3406 | MDRV_SOUND_ADD_TAG("2610.2.r", FILTER_VOLUME, 0) | |
| 3407 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 3408 | MDRV_SOUND_ADD_TAG("2610.2.l", FILTER_VOLUME, 0) | |
| 3409 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 3273 | 3410 | MACHINE_DRIVER_END |
| 3274 | 3411 | |
| 3275 | 3412 | |
| r2375 | r2376 | |
| 4086 | 4223 | ROM_LOAD16_WORD( "c78-04.3", 0x00000, 0x80000, CRC(cc1aa37c) SHA1(cfa2eb338dc81c98c637c2f0b14d2baea8b115f5) ) /* STY spritemap */ |
| 4087 | 4224 | |
| 4088 | 4225 | ROM_REGION( 0x180000, REGION_SOUND1, 0 ) /* ADPCM samples */ |
| 4089 | ROM_LOAD( "c78-12.33", 0x000000, 0x80000, CRC(fbb39585) SHA1(4b7cdf9a3fba71155871b3e52d2301e50bf817ca) ) // Half size ?? | |
| 4226 | ROM_LOAD( "c78-12.33", 0x000000, 0x80000, BAD_DUMP CRC(fbb39585) SHA1(4b7cdf9a3fba71155871b3e52d2301e50bf817ca) ) // Half size ?? | |
| 4090 | 4227 | // ??? gap 0x80000-fffff // |
| 4091 | 4228 | ROM_LOAD( "c78-13.46", 0x100000, 0x80000, CRC(1b363aa2) SHA1(0aae3988024654e98cc0c784307b1c329c8f0783) ) |
| 4092 | 4229 | |
| r2375 | r2376 | |
| 4201 | 4338 | cpua_ctrl = 0xff; |
| 4202 | 4339 | } |
| 4203 | 4340 | |
| 4341 | static STATE_POSTLOAD( bshark_postload ) | |
| 4342 | { | |
| 4343 | parse_control_noz80(); | |
| 4344 | } | |
| 4345 | ||
| 4204 | 4346 | static DRIVER_INIT( bshark ) |
| 4205 | 4347 | { |
| 4206 | 4348 | cpua_ctrl = 0xff; |
| 4207 | state_save_register_ | |
| 4349 | state_save_register_ | |
| 4208 | 4350 | |
| 4209 | 4351 | state_save_register_global(eep_latch); |
| 4210 | 4352 | } |
| r2375 | r2376 | |
|---|---|---|
| 51 | 51 | AM_RANGE(0x5800, 0x5bff) AM_WRITE(phoenix_scroll_w) |
| 52 | 52 | AM_RANGE(0x6000, 0x63ff) AM_WRITE(phoenix_sound_control_a_w) |
| 53 | 53 | AM_RANGE(0x6800, 0x6bff) AM_WRITE(phoenix_sound_control_b_w) |
| 54 | AM_RANGE(0x7000, 0x73ff) AM_READ | |
| 54 | AM_RANGE(0x7000, 0x73ff) AM_READ | |
| 55 | 55 | AM_RANGE(0x7800, 0x7bff) AM_READ_PORT("DSW0") /* DSW */ |
| 56 | 56 | ADDRESS_MAP_END |
| 57 | 57 | |
| r2375 | r2376 | |
| 62 | 62 | AM_RANGE(0x5800, 0x5bff) AM_WRITE(phoenix_scroll_w) |
| 63 | 63 | AM_RANGE(0x6000, 0x63ff) AM_WRITE(pleiads_sound_control_a_w) |
| 64 | 64 | AM_RANGE(0x6800, 0x6bff) AM_WRITE(pleiads_sound_control_b_w) |
| 65 | AM_RANGE(0x7000, 0x73ff) AM_READ | |
| 65 | AM_RANGE(0x7000, 0x73ff) AM_READ | |
| 66 | 66 | AM_RANGE(0x7800, 0x7bff) AM_READ_PORT("DSW0") /* DSW */ |
| 67 | 67 | ADDRESS_MAP_END |
| 68 | 68 | |
| r2375 | r2376 | |
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | static INPUT_PORTS_START( phoenix ) |
| 83 | PORT_START_TAG("IN0") | |
| 83 | PORT_START_TAG("IN0") | |
| 84 | 84 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 85 | 85 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) |
| 86 | 86 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) |
| 87 | 87 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 88 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 89 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY | |
| 90 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY | |
| 91 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 88 | PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(player_input_r, 0) | |
| 92 | 89 | |
| 93 | PORT_START_TAG("IN1") /* IN1 */ | |
| 94 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) /* comes from IN0 0-2 */ | |
| 95 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 96 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL | |
| 97 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL | |
| 98 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL | |
| 99 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL | |
| 100 | ||
| 101 | PORT_START_TAG("DSW0") /* DSW0 */ | |
| 102 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION( "SW1:1,2" ) | |
| 90 | PORT_START_TAG("DSW0") | |
| 91 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION( "SW1:1,2" ) | |
| 103 | 92 | PORT_DIPSETTING( 0x00, "3" ) |
| 104 | 93 | PORT_DIPSETTING( 0x01, "4" ) |
| 105 | 94 | PORT_DIPSETTING( 0x02, "5" ) |
| 106 | 95 | PORT_DIPSETTING( 0x03, "6" ) |
| 107 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) ) | |
| 96 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION( "SW1:3,4" ) | |
| 108 | 97 | PORT_DIPSETTING( 0x00, "3K 30K" ) |
| 109 | 98 | PORT_DIPSETTING( 0x04, "4K 40K" ) |
| 110 | 99 | PORT_DIPSETTING( 0x08, "5K 50K" ) |
| 111 | 100 | PORT_DIPSETTING( 0x0c, "6K 60K" ) |
| 112 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Coinage ) ) | |
| 101 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION( "SW1:5" ) | |
| 113 | 102 | PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) |
| 114 | 103 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) |
| 115 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 104 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION( "SW1:6" ) | |
| 116 | 105 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 117 | 106 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 118 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 107 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION( "SW1:7" ) | |
| 119 | 108 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 120 | 109 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 121 | 110 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 122 | 111 | |
| 123 | 112 | PORT_START_TAG("CAB") /* fake port for non-memory mapped dip switch */ |
| 124 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) | |
| 113 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION( "SW1:!8" ) | |
| 125 | 114 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 126 | 115 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| 116 | ||
| 117 | PORT_START_TAG("CTRL") /* fake port for multiplexed controls */ | |
| 118 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 119 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY | |
| 120 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY | |
| 121 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 122 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_CONDITION("CAB",0x01,PORTCOND_EQUALS,0x01) | |
| 123 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL PORT_CONDITION("CAB",0x01,PORTCOND_EQUALS,0x01) | |
| 124 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL PORT_CONDITION("CAB",0x01,PORTCOND_EQUALS,0x01) | |
| 125 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL PORT_CONDITION("CAB",0x01,PORTCOND_EQUALS,0x01) | |
| 127 | 126 | INPUT_PORTS_END |
| 128 | 127 | |
| 129 | 128 | static INPUT_PORTS_START( phoenixa ) |
| r2375 | r2376 | |
| 131 | 130 | |
| 132 | 131 | PORT_MODIFY("DSW0") |
| 133 | 132 | /* Coinage is backwards from phoenix (Amstar) */ |
| 134 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Coinage ) ) | |
| 133 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Coinage ) ) PORT_DIPLOCATION( "SW1:5" ) | |
| 135 | 134 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) |
| 136 | 135 | PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) ) |
| 137 | 136 | INPUT_PORTS_END |
| r2375 | r2376 | |
| 139 | 138 | static INPUT_PORTS_START( phoenixt ) |
| 140 | 139 | PORT_INCLUDE( phoenix ) |
| 141 | 140 | |
| 142 | PORT_MODIFY("DSW0") | |
| 143 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION( "SW1:5" ) | |
| 141 | PORT_MODIFY("DSW0") | |
| 142 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION( "SW1:5" ) | |
| 144 | 143 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 145 | 144 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 146 | 145 | INPUT_PORTS_END |
| r2375 | r2376 | |
| 148 | 147 | static INPUT_PORTS_START( phoenix3 ) |
| 149 | 148 | PORT_INCLUDE( phoenix ) |
| 150 | 149 | |
| 150 | PORT_MODIFY("IN0") | |
| 151 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 152 | ||
| 151 | 153 | PORT_MODIFY("DSW0") |
| 152 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 154 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION( "SW1:5" ) | |
| 153 | 155 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 154 | 156 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 155 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 157 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION( "SW1:6" ) | |
| 156 | 158 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 157 | 159 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 158 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Coinage ) ) | |
| 160 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION( "SW1:7" ) | |
| 159 | 161 | PORT_DIPSETTING( 0x40, "A - 2C/1C B - 1C/3C" ) |
| 160 | 162 | PORT_DIPSETTING( 0x00, "A - 1C/1C B - 1C/6C" ) |
| 161 | 163 | INPUT_PORTS_END |
| 162 | 164 | |
| 163 | 165 | static INPUT_PORTS_START( condor ) |
| 164 | PORT_INCLUDE( phoenix ) | |
| 166 | PORT_START_TAG("IN0") | |
| 167 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) | |
| 168 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 ) | |
| 169 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START2 ) | |
| 170 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 ) | |
| 171 | PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(player_input_r, 0) | |
| 165 | 172 | |
| 166 | PORT_MODIFY("DSW0") | |
| 167 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION( "SW1:1,2" ) | |
| 173 | PORT_START_TAG("DSW0") | |
| 174 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION( "SW1:1,2" ) | |
| 168 | 175 | PORT_DIPSETTING( 0x00, "2" ) |
| 169 | 176 | PORT_DIPSETTING( 0x01, "3" ) |
| 170 | 177 | PORT_DIPSETTING( 0x02, "4" ) |
| 171 | 178 | PORT_DIPSETTING( 0x03, "5" ) |
| 172 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) ) | |
| 179 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION( "SW1:3,4" ) | |
| 173 | 180 | PORT_DIPSETTING( 0x00, "Every 6000" ) |
| 174 | 181 | PORT_DIPSETTING( 0x08, "Every 10000" ) |
| 175 | 182 | PORT_DIPSETTING( 0x04, "Every 14000" ) |
| 176 | 183 | PORT_DIPSETTING( 0x0c, "Every 18000" ) |
| 177 | PORT_DIPNAME( 0x70, 0x30, "Fuel Consumption" ) | |
| 184 | PORT_DIPNAME( 0x70, 0x30, "Fuel Consumption" ) PORT_DIPLOCATION( "SW1:5,6,7" ) | |
| 178 | 185 | PORT_DIPSETTING( 0x00, "Slowest" ) |
| 179 | 186 | PORT_DIPSETTING( 0x10, "Slower" ) |
| 180 | 187 | PORT_DIPSETTING( 0x20, "Slow" ) |
| r2375 | r2376 | |
| 183 | 190 | PORT_DIPSETTING( 0x50, "Fast" ) |
| 184 | 191 | PORT_DIPSETTING( 0x60, "Faster" ) |
| 185 | 192 | PORT_DIPSETTING( 0x70, "Fastest" ) |
| 193 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) | |
| 186 | 194 | |
| 187 | PORT_START_TAG("COINAGE") | |
| 188 | PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_B ) ) | |
| 195 | PORT_START_TAG("DSW1") | |
| 196 | PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_B ) ) PORT_DIPLOCATION( "SW2:1,2,3,4" ) | |
| 189 | 197 | PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) ) |
| 190 | 198 | PORT_DIPSETTING( 0x09, DEF_STR( 2C_2C ) ) |
| 191 | 199 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) |
| r2375 | r2376 | |
| 202 | 210 | PORT_DIPSETTING( 0x05, DEF_STR( 1C_6C ) ) |
| 203 | 211 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_7C ) ) |
| 204 | 212 | PORT_DIPSETTING( 0x07, DEF_STR( 1C_8C ) ) |
| 205 | PORT_DIPNAME( 0xf0, 0x00, DEF_STR( Coin_A ) ) | |
| 213 | PORT_DIPNAME( 0xf0, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION( "SW2:5,6,7,8" ) | |
| 206 | 214 | PORT_DIPSETTING( 0x80, DEF_STR( 2C_1C ) ) |
| 207 | 215 | PORT_DIPSETTING( 0x90, DEF_STR( 2C_2C ) ) |
| 208 | 216 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) |
| r2375 | r2376 | |
| 219 | 227 | PORT_DIPSETTING( 0x50, DEF_STR( 1C_6C ) ) |
| 220 | 228 | PORT_DIPSETTING( 0x60, DEF_STR( 1C_7C ) ) |
| 221 | 229 | PORT_DIPSETTING( 0x70, DEF_STR( 1C_8C ) ) |
| 230 | ||
| 231 | PORT_START_TAG("CAB") /* fake port for non-memory mapped dip switch */ | |
| 232 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION( "SW1:!8" ) | |
| 233 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 234 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) | |
| 235 | ||
| 236 | PORT_START_TAG("CTRL") /* fake port for multiplexed controls */ | |
| 237 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) | |
| 238 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY | |
| 239 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY | |
| 240 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) | |
| 241 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL PORT_CONDITION("CAB",0x01,PORTCOND_EQUALS,0x01) | |
| 242 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL PORT_CONDITION("CAB",0x01,PORTCOND_EQUALS,0x01) | |
| 243 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL PORT_CONDITION("CAB",0x01,PORTCOND_EQUALS,0x01) | |
| 244 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL PORT_CONDITION("CAB",0x01,PORTCOND_EQUALS,0x01) | |
| 222 | 245 | INPUT_PORTS_END |
| 223 | 246 | |
| 224 | static INPUT_PORTS_START( falcon | |
| 247 | static INPUT_PORTS_START( falconz ) | |
| 225 | 248 | PORT_INCLUDE( phoenix ) |
| 226 | 249 | |
| 227 | 250 | PORT_MODIFY("DSW0") |
| 228 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) | |
| 251 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION( "SW1:1,2" ) | |
| 229 | 252 | PORT_DIPSETTING( 0x00, "2" ) |
| 230 | 253 | PORT_DIPSETTING( 0x01, "3" ) |
| 231 | 254 | PORT_DIPSETTING( 0x02, "4" ) |
| 232 | 255 | PORT_DIPSETTING( 0x03, "5" ) |
| 233 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) ) | |
| 256 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION( "SW1:3,4" ) | |
| 234 | 257 | PORT_DIPSETTING( 0x00, "3K 30K" ) |
| 235 | 258 | PORT_DIPSETTING( 0x04, "4K 40K" ) |
| 236 | 259 | PORT_DIPSETTING( 0x08, "5K 50K" ) |
| 237 | 260 | PORT_DIPSETTING( 0x0c, "6K 60K" ) |
| 238 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 261 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION( "SW1:5" ) | |
| 239 | 262 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 240 | 263 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 241 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 264 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION( "SW1:6" ) | |
| 242 | 265 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 243 | 266 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 244 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Coinage ) ) | |
| 267 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Coinage ) ) PORT_DIPLOCATION( "SW1:7" ) | |
| 245 | 268 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) |
| 246 | 269 | PORT_DIPSETTING( 0x40, DEF_STR( 1C_1C ) ) |
| 247 | 270 | INPUT_PORTS_END |
| 248 | 271 | |
| 249 | ||
| 250 | 272 | static INPUT_PORTS_START( nextfase ) |
| 251 | 273 | PORT_INCLUDE( phoenix ) |
| 252 | 274 | |
| 253 | 275 | PORT_MODIFY("DSW0") |
| 254 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) | |
| 276 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION( "SW1:1,2" ) | |
| 255 | 277 | PORT_DIPSETTING( 0x00, "1" ) |
| 256 | 278 | PORT_DIPSETTING( 0x01, "2" ) |
| 257 | 279 | PORT_DIPSETTING( 0x02, "3" ) |
| 258 | 280 | PORT_DIPSETTING( 0x03, "4" ) |
| 259 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) ) | |
| 281 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION( "SW1:3,4" ) | |
| 260 | 282 | PORT_DIPSETTING( 0x00, "3K 30K" ) |
| 261 | 283 | PORT_DIPSETTING( 0x04, "4K 40K" ) |
| 262 | 284 | PORT_DIPSETTING( 0x08, "5K 50K" ) |
| 263 | 285 | PORT_DIPSETTING( 0x0c, "6K 60K" ) |
| 264 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 286 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION( "SW1:5" ) | |
| 265 | 287 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 266 | 288 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 267 | PORT_DIPNAME( 0x60, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION( "SW1:6,7" ) | |
| 268 | PORT_DIPSETTING( 0x00, "1C/1C & 1C/2C" ) | |
| 269 | PORT_DIPSETTING( 0x20, "2C/3C & 1C/3C" ) | |
| 270 | PORT_DIPSETTING( 0x40, "1C/2C & 1C/4C" ) | |
| 271 | PORT_DIPSETTING( 0x60, "2C/5C & 1C/5C" ) | |
| 289 | PORT_DIPNAME( 0x60, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION( "SW1:6,7" ) | |
| 290 | PORT_DIPSETTING( 0x00, "A - 1C/1C B - 1C/2C" ) | |
| 291 | PORT_DIPSETTING( 0x20, "A - 2C/3C B - 1C/3C" ) | |
| 292 | PORT_DIPSETTING( 0x40, "A - 1C/2C B - 1C/4C" ) | |
| 293 | PORT_DIPSETTING( 0x60, "A - 2C/5C B - 1C/5C" ) | |
| 272 | 294 | INPUT_PORTS_END |
| 273 | 295 | |
| 274 | 296 | |
| r2375 | r2376 | |
| 276 | 298 | PORT_INCLUDE( phoenix ) |
| 277 | 299 | |
| 278 | 300 | PORT_MODIFY("IN0") |
| 279 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) | |
| 301 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) | |
| 280 | 302 | |
| 281 | 303 | PORT_MODIFY("DSW0") |
| 282 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) | |
| 304 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION( "SW1:7" ) | |
| 283 | 305 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 284 | 306 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 285 | 307 | INPUT_PORTS_END |
| r2375 | r2376 | |
| 288 | 310 | PORT_INCLUDE( pleiads ) |
| 289 | 311 | |
| 290 | 312 | PORT_MODIFY("DSW0") |
| 291 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) ) | |
| 313 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION( "SW1:3,4" ) | |
| 292 | 314 | PORT_DIPSETTING( 0x00, "7K 70K" ) |
| 293 | 315 | PORT_DIPSETTING( 0x04, "8K 80K" ) |
| 294 | 316 | PORT_DIPSETTING( 0x08, "9K 90K" ) |
| 295 | /*PORT_DIPSETTING( 0x0c, "INVALID" ) Sets bonus to A000 */ | |
| 317 | /*PORT_DIPSETTING( 0x0c, "INVALID" ) Sets bonus to A000 */ | |
| 296 | 318 | INPUT_PORTS_END |
| 297 | 319 | |
| 298 | 320 | static INPUT_PORTS_START( capitol ) |
| 299 | 321 | PORT_INCLUDE( phoenix ) |
| 300 | 322 | |
| 301 | 323 | PORT_MODIFY("DSW0") |
| 302 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) | |
| 324 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION( "SW1:7" ) | |
| 303 | 325 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 304 | 326 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 305 | 327 | INPUT_PORTS_END |
| 306 | 328 | |
| 329 | ||
| 307 | 330 | static INPUT_PORTS_START( survival ) |
| 308 | 331 | PORT_START_TAG("IN0") /* IN0 */ |
| 309 | 332 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 310 | 333 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) |
| 311 | 334 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) |
| 312 | 335 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 313 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) | |
| 336 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) | |
| 314 | 337 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) |
| 315 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) | |
| 316 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) | |
| 338 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) | |
| 339 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) | |
| 317 | 340 | |
| 318 | 341 | PORT_START_TAG("IN1") /* IN1 */ |
| 319 | 342 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) /* comes from IN0 0-2 */ |
| 320 | 343 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 321 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL | |
| 322 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL | |
| 323 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL | |
| 344 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL | |
| 345 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL | |
| 346 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL | |
| 324 | 347 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL |
| 325 | 348 | |
| 326 | 349 | PORT_START_TAG("DSW0") |
| r2375 | r2376 | |
| 749 | 772 | ROM_LOAD( "mmi6301.ic41", 0x0100, 0x0100, CRC(e176b768) SHA1(e2184dd495ed579f10b6da0b78379e02d7a6229f) ) /* palette high bits */ |
| 750 | 773 | ROM_END |
| 751 | 774 | |
| 752 | ROM_START( | |
| 775 | ROM_START( falconz | |
| 753 | 776 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 777 | ROM_LOAD( "f45.bin", 0x0000, 0x0800, CRC(9158b43b) SHA1(222cbcfb3f95d09bb90148813541c2613d8b7e1c) ) | |
| 778 | ROM_LOAD( "f46.bin", 0x0800, 0x0800, CRC(22ddb600) SHA1(9606d11722261990c34b788baae5dc7516ba52d6) ) | |
| 779 | ROM_LOAD( "f47.bin", 0x1000, 0x0800, CRC(cb2838d9) SHA1(332e339475b17d17eeb43a524c5cb3bf9818837a) ) | |
| 780 | ROM_LOAD( "f48.bin", 0x1800, 0x0800, CRC(552cf57a) SHA1(d9d36495f0cb25c1648e0807c8d37daf49bbf0d4) ) | |
| 781 | ROM_LOAD( "f49.bin", 0x2000, 0x0800, CRC(1ff3a982) SHA1(66fb39e7abdf7a9c6e2eb01d41cfe9429781d6aa) ) | |
| 782 | ROM_LOAD( "f50.bin", 0x2800, 0x0800, CRC(8c83bff7) SHA1(3dfb090d7e3a9ae8da882b06e166c48555eaf77c) ) | |
| 783 | ROM_LOAD( "f51.bin", 0x3000, 0x0800, CRC(805ec2e8) SHA1(7e56fc9990eb99512078e2b1e2874fb33b0aa05c) ) | |
| 784 | ROM_LOAD( "f52.bin", 0x3800, 0x0800, CRC(33f3af63) SHA1(f2e2ebdec205360a6fa8ce4bc8cdf15b82b02728) ) | |
| 785 | ||
| 786 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 787 | ROM_LOAD( "ic23.3d", 0x0000, 0x0800, CRC(3c7e623f) SHA1(e7ff5fc371664af44785c079e92eeb2d8530187b) ) | |
| 788 | ROM_LOAD( "ic24.4d", 0x0800, 0x0800, CRC(59916d3b) SHA1(71aec70a8e096ed1f0c2297b3ae7dca1b8ecc38d) ) | |
| 789 | ||
| 790 | ROM_REGION( 0x1000, REGION_GFX2, ROMREGION_DISPOSE ) | |
| 791 | ROM_LOAD( "f39.bin", 0x0000, 0x0800, CRC(53c52eb0) SHA1(19624ca359996b77d3c65ef78a7af90eeb092377) ) | |
| 792 | ROM_LOAD( "f40.bin", 0x0800, 0x0800, CRC(eba42f0f) SHA1(378282cb2c4e10c23179ae3c605ae7bf691150f6) ) | |
| 793 | ||
| 794 | ROM_REGION( 0x0200, REGION_PROMS, 0 ) | |
| 795 | ROM_LOAD( "mmi6301.ic40", 0x0000, 0x0100, CRC(79350b25) SHA1(57411be4c1d89677f7919ae295446da90612c8a8) ) /* palette low bits */ | |
| 796 | ROM_LOAD( "mmi6301.ic41", 0x0100, 0x0100, CRC(e176b768) SHA1(e2184dd495ed579f10b6da0b78379e02d7a6229f) ) /* palette high bits */ | |
| 797 | ROM_END | |
| 798 | ||
| 799 | ROM_START( vautourz ) | |
| 800 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 754 | 801 | ROM_LOAD( "vautour1.bin", 0x0000, 0x0800, CRC(a600f6a4) SHA1(f1aea5ec71da0d0664fb90b87602fe4c4eed2dbe) ) |
| 755 | 802 | ROM_LOAD( "vautour2.bin", 0x0800, 0x0800, CRC(3699b11a) SHA1(7122685cbfcd75898eaa68f8c5bf87c11df59a3b) ) |
| 756 | 803 | ROM_LOAD( "vautour3.bin", 0x1000, 0x0800, CRC(750b059b) SHA1(6fbaa2ef4c7eef6f731a73b2d33a02fff21b318a) ) |
| r2375 | r2376 | |
| 821 | 868 | ROM_LOAD( "mmi6301.ic41", 0x0100, 0x0100, CRC(e176b768) SHA1(e2184dd495ed579f10b6da0b78379e02d7a6229f) ) /* palette high bits */ |
| 822 | 869 | ROM_END |
| 823 | 870 | |
| 824 | ROM_START( falcona ) | |
| 825 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 826 | ROM_LOAD( "f45.bin", 0x0000, 0x0800, CRC(9158b43b) SHA1(222cbcfb3f95d09bb90148813541c2613d8b7e1c) ) | |
| 827 | ROM_LOAD( "f46.bin", 0x0800, 0x0800, CRC(22ddb600) SHA1(9606d11722261990c34b788baae5dc7516ba52d6) ) | |
| 828 | ROM_LOAD( "f47.bin", 0x1000, 0x0800, CRC(cb2838d9) SHA1(332e339475b17d17eeb43a524c5cb3bf9818837a) ) | |
| 829 | ROM_LOAD( "f48.bin", 0x1800, 0x0800, CRC(552cf57a) SHA1(d9d36495f0cb25c1648e0807c8d37daf49bbf0d4) ) | |
| 830 | ROM_LOAD( "f49.bin", 0x2000, 0x0800, CRC(1ff3a982) SHA1(66fb39e7abdf7a9c6e2eb01d41cfe9429781d6aa) ) | |
| 831 | ROM_LOAD( "f50.bin", 0x2800, 0x0800, CRC(8c83bff7) SHA1(3dfb090d7e3a9ae8da882b06e166c48555eaf77c) ) | |
| 832 | ROM_LOAD( "f51.bin", 0x3000, 0x0800, CRC(805ec2e8) SHA1(7e56fc9990eb99512078e2b1e2874fb33b0aa05c) ) | |
| 833 | ROM_LOAD( "f52.bin", 0x3800, 0x0800, CRC(33f3af63) SHA1(f2e2ebdec205360a6fa8ce4bc8cdf15b82b02728) ) | |
| 834 | ||
| 835 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 836 | ROM_LOAD( "ic23.3d", 0x0000, 0x0800, CRC(3c7e623f) SHA1(e7ff5fc371664af44785c079e92eeb2d8530187b) ) | |
| 837 | ROM_LOAD( "ic24.4d", 0x0800, 0x0800, CRC(59916d3b) SHA1(71aec70a8e096ed1f0c2297b3ae7dca1b8ecc38d) ) | |
| 838 | ||
| 839 | ROM_REGION( 0x1000, REGION_GFX2, ROMREGION_DISPOSE ) | |
| 840 | ROM_LOAD( "f39.bin", 0x0000, 0x0800, CRC(53c52eb0) SHA1(19624ca359996b77d3c65ef78a7af90eeb092377) ) | |
| 841 | ROM_LOAD( "f40.bin", 0x0800, 0x0800, CRC(eba42f0f) SHA1(378282cb2c4e10c23179ae3c605ae7bf691150f6) ) | |
| 842 | ||
| 843 | ROM_REGION( 0x0200, REGION_PROMS, 0 ) | |
| 844 | ROM_LOAD( "mmi6301.ic40", 0x0000, 0x0100, CRC(79350b25) SHA1(57411be4c1d89677f7919ae295446da90612c8a8) ) /* palette low bits */ | |
| 845 | ROM_LOAD( "mmi6301.ic41", 0x0100, 0x0100, CRC(e176b768) SHA1(e2184dd495ed579f10b6da0b78379e02d7a6229f) ) /* palette high bits */ | |
| 846 | ROM_END | |
| 847 | ||
| 848 | 871 | ROM_START( nextfase ) |
| 849 | 872 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 850 | 873 | ROM_LOAD( "nf01.bin", 0x0000, 0x0800, CRC(b31ce820) SHA1(dfdb17995a14b66d2571c2c8de481d2792f9ce6a) ) |
| r2375 | r2376 | |
| 995 | 1018 | static DRIVER_INIT( condor ) |
| 996 | 1019 | { |
| 997 | 1020 | /* additional inputs for coinage */ |
| 998 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x5000, 0, 0, | |
| 1021 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x5000, 0, 0, | |
| 999 | 1022 | } |
| 1000 | 1023 | |
| 1001 | 1024 | static DRIVER_INIT( survival ) |
| r2375 | r2376 | |
| 1008 | 1031 | |
| 1009 | 1032 | |
| 1010 | 1033 | |
| 1011 | GAME( 1980, phoenix, 0, phoenix, phoenix, 0, ROT90, "Amstar", "Phoenix (Amstar)", GAME_SUPPORTS_SAVE ) | |
| 1012 | GAME( 1980, phoenixa, phoenix, phoenix, phoenixa, 0, ROT90, "Amstar (Centuri license)", "Phoenix (Centuri), Set 1", GAME_SUPPORTS_SAVE ) | |
| 1013 | GAME( 1980, phoenixb, phoenix, phoenix, phoenixa, 0, ROT90, "Amstar (Centuri license)", "Phoenix (Centuri), Set 2", GAME_SUPPORTS_SAVE ) | |
| 1014 | GAME( 1980, phoenixt, phoenix, phoenix, phoenixt, 0, ROT90, "Taito", "Phoenix (Taito)", GAME_SUPPORTS_SAVE ) | |
| 1015 | GAME( 1980, phoenix3, phoenix, phoenix, phoenix3, 0, ROT90, "bootleg", "Phoenix (T.P.N.)", GAME_SUPPORTS_SAVE ) | |
| 1016 | GAME( 1981, phoenixc, phoenix, phoenix, phoenixt, 0, ROT90, "bootleg?", "Phoenix (IRECSA, G.G.I Corp)", GAME_SUPPORTS_SAVE ) | |
| 1017 | ||
| 1018 | ||
| 1019 | GAME( 1981, condor, phoenix, condor, condor, condor, ROT90, "Sidam (bootleg)", "Condor (bootleg of Phoenix)", GAME_SUPPORTS_SAVE ) | |
| 1034 | GAME( 1980, phoenix, 0, phoenix, phoenix, 0, ROT90, "Amstar", "Phoenix (Amstar)", GAME_SUPPORTS_SAVE ) | |
| 1035 | GAME( 1980, phoenixa, phoenix, phoenix, phoenixa, 0, ROT90, "Amstar (Centuri license)", "Phoenix (Centuri, set 1)", GAME_SUPPORTS_SAVE ) | |
| 1036 | GAME( 1980, phoenixb, phoenix, phoenix, phoenixa, 0, ROT90, "Amstar (Centuri license)", "Phoenix (Centuri, set 2)", GAME_SUPPORTS_SAVE ) | |
| 1037 | GAME( 1980, phoenixt, phoenix, phoenix, phoenixt, 0, ROT90, "Taito", "Phoenix (Taito)", GAME_SUPPORTS_SAVE ) | |
| 1038 | GAME( 1980, phoenix3, phoenix, phoenix, phoenix3, 0, ROT90, "bootleg", "Phoenix (T.P.N.)", GAME_SUPPORTS_SAVE ) | |
| 1039 | GAME( 1981, phoenixc, phoenix, phoenix, phoenixt, 0, ROT90, "bootleg?", "Phoenix (IRECSA, G.G.I Corp)", GAME_SUPPORTS_SAVE ) | |
| 1040 | GAME( 1981, condor, phoenix, condor, condor, condor, ROT90, "Sidam (bootleg)", "Condor (bootleg of Phoenix)", GAME_SUPPORTS_SAVE ) | |
| 1020 | 1041 | // the following 2 were common bootlegs in england & france respectively |
| 1021 | GAME( 1980, falcon, phoenix, phoenix, phoenixt, 0, ROT90, "bootleg", "Falcon (bootleg of Phoenix) (set 1)", GAME_SUPPORTS_SAVE ) | |
| 1022 | GAME( 1980, vautour, phoenix, phoenix, phoenixt, 0, ROT90, "Jeutel (bootleg)", "Vautour (bootleg of Phoenix) (set 1)", GAME_SUPPORTS_SAVE ) | |
| 1023 | GAME( 1980, vautour2, phoenix, condor, condor, condor, ROT90, "bootleg", "Vautour (bootleg of Phoenix) (set 2)", GAME_SUPPORTS_SAVE ) | |
| 1024 | // fenix is an italian bootleg based on vautour | |
| 1025 | GAME( 1980, fenix, phoenix, condor, condor, condor, ROT90, "bootleg", "Fenix (bootleg of Phoenix)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) | |
| 1026 | GAME( 1980, griffon, phoenix, condor, condor, condor, ROT90, "Videotron (bootleg)", "Griffon (bootleg of Phoenix)", GAME_SUPPORTS_SAVE ) | |
| 1027 | GAME( 1980, falcona, phoenix, condor, falcona, 0, ROT90, "bootleg", "Falcon (bootleg of Phoenix) (set 2)", GAME_SUPPORTS_SAVE ) | |
| 1042 | GAME( 1980, falcon, phoenix, phoenix, phoenixt, 0, ROT90, "bootleg", "Falcon (bootleg of Phoenix) (8085A CPU)", GAME_SUPPORTS_SAVE ) | |
| 1043 | GAME( 1980, vautour, phoenix, phoenix, phoenixt, 0, ROT90, "Jeutel (bootleg)", "Vautour (bootleg of Phoenix) (8085A CPU)", GAME_SUPPORTS_SAVE ) | |
| 1044 | GAME( 1980, falconz, phoenix, condor, falconz, 0, ROT90, "bootleg", "Falcon (bootleg of Phoenix) (Z80 CPU)", GAME_SUPPORTS_SAVE ) | |
| 1045 | GAME( 1980, vautourz, phoenix, condor, condor, condor, ROT90, "bootleg", "Vautour (bootleg of Phoenix) (Z80 CPU)", GAME_SUPPORTS_SAVE ) | |
| 1046 | // fenix is an italian bootleg based on vautourz | |
| 1047 | GAME( 1980, fenix, phoenix, condor, condor, condor, ROT90, "bootleg", "Fenix (bootleg of Phoenix)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) | |
| 1048 | GAME( 1980, griffon, phoenix, condor, condor, condor, ROT90, "Videotron (bootleg)", "Griffon (bootleg of Phoenix)", GAME_SUPPORTS_SAVE ) | |
| 1028 | 1049 | // nextfase is a spanish bootleg |
| 1029 | GAME( 1981, nextfase, phoenix, phoenix, nextfase, 0, ROT90, "Petaco S.A. (bootleg)","Next Fase (bootleg of Phoenix)", GAME_SUPPORTS_SAVE ) | |
| 1050 | GAME( 1981, nextfase, phoenix, phoenix, nextfase, 0, ROT90, "Petaco S.A. (bootleg)", "Next Fase (bootleg of Phoenix)", GAME_SUPPORTS_SAVE ) | |
| 1030 | 1051 | |
| 1031 | GAME( 1981, pleiads, 0, pleiads, pleiads, 0, ROT90, "Tehkan", "Pleiads (Tehkan)", GAME_IMPERFECT_COLORS ) | |
| 1032 | GAME( 1981, pleiadbl, pleiads, pleiads, pleiads, 0, ROT90, "bootleg", "Pleiads (bootleg)", GAME_IMPERFECT_COLORS ) | |
| 1033 | GAME( 1981, pleiadce, pleiads, pleiads, pleiadce, 0, ROT90, "Tehkan (Centuri license)", "Pleiads (Centuri)", GAME_IMPERFECT_COLORS ) | |
| 1034 | GAME( 1981, capitol, pleiads, phoenix, capitol, 0, ROT90, "Universal Video Spiel", "Capitol", GAME_IMPERFECT_COLORS ) | |
| 1035 | GAME( 1982, survival, 0, survival, survival, survival, ROT90, "Rock-ola", "Survival", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 1052 | GAME( 1981, pleiads, 0, pleiads, pleiads, 0, ROT90, "Tehkan", "Pleiads (Tehkan)", GAME_IMPERFECT_COLORS ) | |
| 1053 | GAME( 1981, pleiadbl, pleiads, pleiads, pleiads, 0, ROT90, "bootleg", "Pleiads (bootleg)", GAME_IMPERFECT_COLORS ) | |
| 1054 | GAME( 1981, pleiadce, pleiads, pleiads, pleiadce, 0, ROT90, "Tehkan (Centuri license)", "Pleiads (Centuri)", GAME_IMPERFECT_COLORS ) | |
| 1055 | GAME( 1981, capitol, pleiads, phoenix, capitol, 0, ROT90, "Universal Video Spiel", "Capitol", GAME_IMPERFECT_COLORS ) | |
| 1056 | ||
| 1057 | GAME( 1982, survival, 0, survival, survival, survival, ROT90, "Rock-ola", "Survival", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) |
| r2375 | r2376 | |
|---|---|---|
| 306 | 306 | { |
| 307 | 307 | // high byte: |
| 308 | 308 | // mask 0x1c: from sound? |
| 309 | return (mame_rand(Machine) & 0x1c00) | | |
| 309 | return (mame_rand(Machine) & 0x1c00) | | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | static READ16_HANDLER( lastfght_c00004_r ) |
| 313 | 313 | { |
| 314 | return | |
| 314 | return | |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | static READ16_HANDLER( lastfght_c00006_r ) |
| r2375 | r2376 | |
| 319 | 319 | // low byte: |
| 320 | 320 | // bit 7 = protection? |
| 321 | 321 | // bit 5 = blitter? |
| 322 | return | |
| 322 | return | |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | static WRITE16_HANDLER( lastfght_c00006_w ) |
| r2375 | r2376 | |
|---|---|---|
| 58 | 58 | |
| 59 | 59 | static READ8_HANDLER( input_port_bit_r ) |
| 60 | 60 | { |
| 61 | return ( | |
| 61 | return ( | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| r2375 | r2376 | |
| 82 | 82 | |
| 83 | 83 | if (dial_enable_1 && !dial_enable_2) |
| 84 | 84 | { |
| 85 | lo = readinputport(3); | |
| 86 | hi = readinputport(4); | |
| 85 | lo = input_port_read_indexed(machine, 3); | |
| 86 | hi = input_port_read_indexed(machine, 4); | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | if (dial_enable_2 && !dial_enable_1) |
| 90 | 90 | { |
| 91 | lo = readinputport(5); | |
| 92 | hi = readinputport(6); | |
| 91 | lo = input_port_read_indexed(machine, 5); | |
| 92 | hi = input_port_read_indexed(machine, 6); | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | lo = 12 * lo / 256; |
| r2375 | r2376 | |
|---|---|---|
| 159 | 159 | //6-down |
| 160 | 160 | //7-leftdwn |
| 161 | 161 | |
| 162 | UINT8 val= ( | |
| 162 | UINT8 val= ( | |
| 163 | 163 | /* bit0 = left |
| 164 | 164 | bit1 = right |
| 165 | 165 | bit2 = down |
| r2375 | r2376 | |
|---|---|---|
| 195 | 195 | static READ8_HANDLER( in4_mcu_r ) |
| 196 | 196 | { |
| 197 | 197 | // logerror("%04x: in4_mcu_r\n",activecpu_get_pc()); |
| 198 | return | |
| 198 | return | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | static READ8_HANDLER( sqix_from_mcu_r ) |
| r2375 | r2376 | |
| 268 | 268 | { |
| 269 | 269 | if ((port1 & 0x10) == 0) |
| 270 | 270 | { |
| 271 | return | |
| 271 | return | |
| 272 | 272 | } |
| 273 | 273 | else if ((port1 & 0x20) == 0) |
| 274 | 274 | { |
| 275 | return | |
| 275 | return | |
| 276 | 276 | } |
| 277 | 277 | else if ((port1 & 0x40) == 0) |
| 278 | 278 | { |
| r2375 | r2376 | |
| 297 | 297 | |
| 298 | 298 | static READ8_HANDLER( bootleg_in0_r ) |
| 299 | 299 | { |
| 300 | return BITSWAP8( | |
| 300 | return BITSWAP8( | |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | static WRITE8_HANDLER( bootleg_flipscreen_w ) |
| r2375 | r2376 | |
| 318 | 318 | * connected to the 68705 which acts as a counter. |
| 319 | 319 | */ |
| 320 | 320 | |
| 321 | static int read_dial(int player) | |
| 321 | static int read_dial(running_machine *machine, int player) | |
| 322 | 322 | { |
| 323 | 323 | int newpos; |
| 324 | 324 | static int oldpos[2]; |
| 325 | 325 | static int sign[2]; |
| 326 | 326 | |
| 327 | 327 | /* get the new position and adjust the result */ |
| 328 | newpos = | |
| 328 | newpos = | |
| 329 | 329 | if (newpos != oldpos[player]) |
| 330 | 330 | { |
| 331 | 331 | sign[player] = ((newpos - oldpos[player]) & 0x80) >> 7; |
| r2375 | r2376 | |
| 401 | 401 | switch (data & 0x07) |
| 402 | 402 | { |
| 403 | 403 | case 0x0: // dsw A |
| 404 | portA_in = | |
| 404 | portA_in = | |
| 405 | 405 | break; |
| 406 | 406 | |
| 407 | 407 | case 0x1: // dsw B |
| 408 | portA_in = | |
| 408 | portA_in = | |
| 409 | 409 | break; |
| 410 | 410 | |
| 411 | 411 | case 0x2: |
| r2375 | r2376 | |
| 424 | 424 | break; |
| 425 | 425 | |
| 426 | 426 | case 0x6: |
| 427 | portA_in = read_dial(0); | |
| 427 | portA_in = read_dial(machine, 0); | |
| 428 | 428 | break; |
| 429 | 429 | |
| 430 | 430 | case 0x7: |
| 431 | portA_in = read_dial(1); | |
| 431 | portA_in = read_dial(machine, 1); | |
| 432 | 432 | break; |
| 433 | 433 | } |
| 434 | 434 | } |
| r2375 | r2376 | |
| 449 | 449 | static READ8_HANDLER(hotsmash_ay_port_a_r) |
| 450 | 450 | { |
| 451 | 451 | //logerror("%04x: ay_port_a_r and mcu_pending is %d\n",activecpu_get_pc(),from_mcu_pending); |
| 452 | return | |
| 452 | return | |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | /************************************************************************** |
| r2375 | r2376 | |
| 469 | 469 | |
| 470 | 470 | switch (from_z80) |
| 471 | 471 | { |
| 472 | case 0x01: return readinputport(4 + 2 * curr_player); | |
| 473 | case 0x02: return readinputport(5 + 2 * curr_player); | |
| 474 | case 0x04: return readinputport(0); | |
| 475 | case 0x08: return readinputport(1); | |
| 472 | case 0x01: return input_port_read_indexed(machine, 4 + 2 * curr_player); | |
| 473 | case 0x02: return input_port_read_indexed(machine, 5 + 2 * curr_player); | |
| 474 | case 0x04: return input_port_read_indexed(machine, 0); | |
| 475 | case 0x08: return input_port_read_indexed(machine, 1); | |
| 476 | 476 | case 0x80: curr_player = 0; return 0; |
| 477 | 477 | case 0x81: curr_player = 1; return 0; |
| 478 | 478 | } |
| r2375 | r2376 | |
| 485 | 485 | { |
| 486 | 486 | // logerror("%04x: ay_port_a_r\n",activecpu_get_pc()); |
| 487 | 487 | /* bits 76------ MCU status bits */ |
| 488 | return (mame_rand(Machine)&0xc0)| | |
| 488 | return (mame_rand(Machine)&0xc0)| | |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 |
| r2375 | r2376 | |
|---|---|---|
| 368 | 368 | |
| 369 | 369 | static READ32_HANDLER( jamma_r ) |
| 370 | 370 | { |
| 371 | return | |
| 371 | return | |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | |
| r2375 | r2376 | |
| 381 | 381 | // D5 = /VOLUMEUP |
| 382 | 382 | // D4 = /VOLUMEDOWN |
| 383 | 383 | // D3-D0 = ACTC4-1 |
| 384 | return | |
| 384 | return | |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 |
| r2375 | r2376 | |
|---|---|---|
| 105 | 105 | |
| 106 | 106 | static READ16_HANDLER( special_port0_r ) |
| 107 | 107 | { |
| 108 | int temp = | |
| 108 | int temp = | |
| 109 | 109 | if (atarigen_cpu_to_sound_ready) temp ^= 0x0080; |
| 110 | 110 | return temp; |
| 111 | 111 | } |
| r2375 | r2376 | |
| 113 | 113 | |
| 114 | 114 | static READ16_HANDLER( special_port2_r ) |
| 115 | 115 | { |
| 116 | int temp = | |
| 116 | int temp = | |
| 117 | 117 | if (atarigen_cpu_to_sound_ready) temp ^= 0x2000; |
| 118 | 118 | return temp; |
| 119 | 119 | } |
| r2375 | r2376 | |
|---|---|---|
| 359 | 359 | { |
| 360 | 360 | switch (offset) |
| 361 | 361 | { |
| 362 | case 0: return readinputportbytag("ADC_BANK"); | |
| 363 | case 1: return readinputportbytag("ADC_PITCH"); | |
| 364 | case 2: return readinputportbytag("ADC_MISSILE"); | |
| 365 | case 3: return readinputportbytag("ADC_HOVER"); | |
| 362 | case 0: return input_port_read(machine, "ADC_BANK"); | |
| 363 | case 1: return input_port_read(machine, "ADC_PITCH"); | |
| 364 | case 2: return input_port_read(machine, "ADC_MISSILE"); | |
| 365 | case 3: return input_port_read(machine, "ADC_HOVER"); | |
| 366 | 366 | default: return 0; |
| 367 | 367 | } |
| 368 | 368 | } |
| r2375 | r2376 | |
|---|---|---|
| 604 | 604 | ***************************************************************************/ |
| 605 | 605 | |
| 606 | 606 | static int mux; |
| 607 | static READ8_HANDLER( in0_l ) { return readinputportbytag("IN0"); } // P1 joystick | |
| 608 | static READ8_HANDLER( in0_h ) { return readinputportbytag("IN0") >> 4; } // P2 joystick | |
| 609 | static READ8_HANDLER( in1_l ) { return readinputportbytag("IN1"); } // fire and start buttons | |
| 610 | static READ8_HANDLER( in1_h ) { return readinputportbytag("IN1") >> 4; } // coins | |
| 611 | static READ8_HANDLER( in2 ) { return readinputportbytag("DSW0"); } // test, cocktail, optional buttons | |
| 612 | static READ8_HANDLER( dipA_l ) { return readinputportbytag("DSW1"); } // dips A | |
| 613 | static READ8_HANDLER( dipA_h ) { return readinputportbytag("DSW1") >> 4; } // dips A | |
| 614 | static READ8_HANDLER( dipB_mux ) { return readinputportbytag("DSW2") >> (4*mux); } // dips B | |
| 607 | static READ8_HANDLER( in0_l ) { return input_port_read(machine, "IN0"); } // P1 joystick | |
| 608 | static READ8_HANDLER( in0_h ) { return input_port_read(machine, "IN0") >> 4; } // P2 joystick | |
| 609 | static READ8_HANDLER( in1_l ) { return input_port_read(machine, "IN1"); } // fire and start buttons | |
| 610 | static READ8_HANDLER( in1_h ) { return input_port_read(machine, "IN1") >> 4; } // coins | |
| 611 | static READ8_HANDLER( in2 ) { return input_port_read(machine, "DSW0"); } // test, cocktail, optional buttons | |
| 612 | static READ8_HANDLER( dipA_l ) { return input_port_read(machine, "DSW1"); } // dips A | |
| 613 | static READ8_HANDLER( dipA_h ) { return input_port_read(machine, "DSW1") >> 4; } // dips A | |
| 614 | static READ8_HANDLER( dipB_mux ) { return input_port_read(machine, "DSW2") >> (4*mux); } // dips B | |
| 615 | 615 | static READ8_HANDLER( dipB_muxi ) // dips B |
| 616 | 616 | { |
| 617 | 617 | // bits are interleaved in Phozon |
| 618 | return BITSWAP8( | |
| 618 | return BITSWAP8( | |
| 619 | 619 | } |
| 620 | 620 | static WRITE8_HANDLER( out_mux ) { mux = data & 1; } |
| 621 | 621 | static WRITE8_HANDLER( out_lamps ) |
| r2375 | r2376 | |
|---|---|---|
| 162 | 162 | static READ16_HANDLER( pntnpuzl_eeprom_r ) |
| 163 | 163 | { |
| 164 | 164 | /* bit 11 is EEPROM data */ |
| 165 | return (pntnpuzl_eeprom & 0xf4ff) | (EEPROM_read_bit()<<11) | ( | |
| 165 | return (pntnpuzl_eeprom & 0xf4ff) | (EEPROM_read_bit()<<11) | ( | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | static WRITE16_HANDLER( pntnpuzl_eeprom_w ) |
| r2375 | r2376 | |
| 293 | 293 | |
| 294 | 294 | static READ16_HANDLER( pntnpuzl_vblank_r ) |
| 295 | 295 | { |
| 296 | return ( | |
| 296 | return ( | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | |
| r2375 | r2376 | |
| 351 | 351 | if (serial_out == 0x11) |
| 352 | 352 | { |
| 353 | 353 | static int touchscr[5]; |
| 354 | if ( | |
| 354 | if ( | |
| 355 | 355 | { |
| 356 | 356 | touchscr[0] = 0x1b; |
| 357 | touchscr[2] = BITSWAP8(readinputport(1),0,1,2,3,4,5,6,7); | |
| 358 | touchscr[4] = BITSWAP8(readinputport(2),0,1,2,3,4,5,6,7); | |
| 357 | touchscr[2] = BITSWAP8(input_port_read_indexed(machine, 1),0,1,2,3,4,5,6,7); | |
| 358 | touchscr[4] = BITSWAP8(input_port_read_indexed(machine, 2),0,1,2,3,4,5,6,7); | |
| 359 | 359 | } |
| 360 | 360 | else |
| 361 | 361 | touchscr[0] = 0; |
| r2375 | r2376 | |
| 412 | 412 | |
| 413 | 413 | static INTERRUPT_GEN( pntnpuzl_irq ) |
| 414 | 414 | { |
| 415 | if ( | |
| 415 | if ( | |
| 416 | 416 | cpunum_set_input_line(machine, 0, 1, PULSE_LINE); |
| 417 | else if ( | |
| 417 | else if ( | |
| 418 | 418 | cpunum_set_input_line(machine, 0, 2, PULSE_LINE); |
| 419 | else if ( | |
| 419 | else if ( | |
| 420 | 420 | cpunum_set_input_line(machine, 0, 4, PULSE_LINE); |
| 421 | 421 | } |
| 422 | 422 |
| r2375 | r2376 | |
|---|---|---|
| 58 | 58 | { |
| 59 | 59 | UINT8 dsw_val; |
| 60 | 60 | |
| 61 | dsw_val = | |
| 61 | dsw_val = | |
| 62 | 62 | |
| 63 | 63 | if ( BIT( offset, 7 ) == 0 ) |
| 64 | 64 | { |
| r2375 | r2376 | |
| 100 | 100 | { |
| 101 | 101 | if ( jamma_if_control_latch & 0x10 ) |
| 102 | 102 | { |
| 103 | return | |
| 103 | return | |
| 104 | 104 | } |
| 105 | 105 | else |
| 106 | 106 | { |
| 107 | return | |
| 107 | return | |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 |
| r2375 | r2376 | |
|---|---|---|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | |
| 258 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 259 | AM_RANGE(0x0000, 0xbfff) AM_READ(SMH_ROM) | |
| 260 | AM_RANGE(0xd000, 0xdfff) AM_READ(SMH_RAM) | |
| 261 | AM_RANGE(0xe000, 0xefff) AM_READ(SMH_RAM) | |
| 262 | AM_RANGE(0xf800, 0xf800) AM_READ(input_port_0_r) | |
| 263 | AM_RANGE(0xf801, 0xf801) AM_READ(input_port_1_r) | |
| 264 | AM_RANGE(0xf802, 0xf802) AM_READ(input_port_2_r) | |
| 265 | AM_RANGE(0xf806, 0xf806) AM_READ(input_port_3_r) | |
| 266 | ADDRESS_MAP_END | |
| 267 | ||
| 268 | static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 269 | AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM) | |
| 270 | AM_RANGE(0xd000, 0xdfff) AM_WRITE(SMH_RAM) | |
| 271 | AM_RANGE(0xe000, 0xe1ff) AM_WRITE(SMH_RAM) | |
| 272 | AM_RANGE(0xe200, 0xe2ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 273 | AM_RANGE(0xe300, 0xe3ff) AM_WRITE(SMH_RAM) AM_BASE(&wilytowr_scrollram) | |
| 274 | AM_RANGE(0xe400, 0xe7ff) AM_WRITE(wilytowr_videoram2_w) AM_BASE(&wilytowr_videoram2) | |
| 275 | AM_RANGE(0xe800, 0xebff) AM_WRITE(wilytowr_videoram_w) AM_BASE(&videoram) | |
| 276 | AM_RANGE(0xec00, 0xefff) AM_WRITE(wilytowr_colorram_w) AM_BASE(&colorram) | |
| 258 | static ADDRESS_MAP_START( wilytowr_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 259 | AM_RANGE(0x0000, 0xbfff) AM_ROM | |
| 260 | AM_RANGE(0xd000, 0xdfff) AM_RAM | |
| 261 | AM_RANGE(0xe000, 0xe1ff) AM_RAM | |
| 262 | AM_RANGE(0xe200, 0xe2ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 263 | AM_RANGE(0xe300, 0xe3ff) AM_RAM AM_BASE(&wilytowr_scrollram) | |
| 264 | AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_WRITE(wilytowr_videoram2_w) AM_BASE(&wilytowr_videoram2) | |
| 265 | AM_RANGE(0xe800, 0xebff) AM_RAM AM_WRITE(wilytowr_videoram_w) AM_BASE(&videoram) | |
| 266 | AM_RANGE(0xec00, 0xefff) AM_RAM AM_WRITE(wilytowr_colorram_w) AM_BASE(&colorram) | |
| 277 | 267 | AM_RANGE(0xf000, 0xf000) AM_WRITE(interrupt_enable_w) /* NMI enable */ |
| 278 | 268 | AM_RANGE(0xf002, 0xf002) AM_WRITE(wilytwr_flipscreen_w) |
| 279 | 269 | AM_RANGE(0xf003, 0xf003) AM_WRITE(wilytwr_palbank_w) |
| 280 | 270 | AM_RANGE(0xf006, 0xf007) AM_WRITE(coin_w) |
| 281 | AM_RANGE(0xf800, 0xf800) AM_WRITE(soundlatch_w) | |
| 282 | AM_RANGE(0xf801, 0xf801) AM_WRITE(SMH_NOP) /* continues game when in stop mode (cleared by NMI handler) */ | |
| 271 | AM_RANGE(0xf800, 0xf800) AM_READWRITE(input_port_0_r, soundlatch_w) | |
| 272 | AM_RANGE(0xf801, 0xf801) AM_READWRITE(input_port_1_r, SMH_NOP) /* continues game when in stop mode (cleared by NMI handler) */ | |
| 273 | AM_RANGE(0xf802, 0xf802) AM_READ(input_port_2_r) | |
| 283 | 274 | AM_RANGE(0xf803, 0xf803) AM_WRITE(snd_irq_w) |
| 275 | AM_RANGE(0xf806, 0xf806) AM_READ(input_port_3_r) | |
| 284 | 276 | ADDRESS_MAP_END |
| 285 | 277 | |
| 286 | 278 | static ADDRESS_MAP_START( fghtbskt_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2375 | r2376 | |
| 310 | 302 | AM_RANGE(0xf807, 0xf807) AM_WRITE(fghtbskt_samples_w) |
| 311 | 303 | ADDRESS_MAP_END |
| 312 | 304 | |
| 313 | static ADDRESS_MAP_START( i8039_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 314 | AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_ROM) | |
| 305 | static ADDRESS_MAP_START( i8039_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 306 | AM_RANGE(0x0000, 0x0fff) AM_ROM | |
| 315 | 307 | ADDRESS_MAP_END |
| 316 | 308 | |
| 317 | static ADDRESS_MAP_START( i8039_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 318 | AM_RANGE(0x0000, 0x0fff) AM_WRITE(SMH_ROM) | |
| 319 | ADDRESS_MAP_END | |
| 320 | 309 | |
| 321 | static ADDRESS_MAP_START( i8039_readport, ADDRESS_SPACE_IO, 8 ) | |
| 322 | // AM_RANGE(0x00, 0xff) | |
| 310 | static ADDRESS_MAP_START( i8039_port_map, ADDRESS_SPACE_IO, 8 ) | |
| 323 | 311 | // AM_RANGE(I8039_t1, I8039_t1) |
| 324 | ADDRESS_MAP_END | |
| 325 | ||
| 326 | static ADDRESS_MAP_START( i8039_writeport, ADDRESS_SPACE_IO, 8 ) | |
| 327 | 312 | AM_RANGE(0x00, 0xff) AM_WRITE(snddata_w) |
| 328 | 313 | AM_RANGE(I8039_p1, I8039_p1) AM_WRITE(p1_w) |
| 329 | 314 | AM_RANGE(I8039_p2, I8039_p2) AM_WRITE(p2_w) |
| r2375 | r2376 | |
| 523 | 508 | |
| 524 | 509 | /* basic machine hardware */ |
| 525 | 510 | MDRV_CPU_ADD(Z80,4000000) /* 4 MHz ???? */ |
| 526 | MDRV_CPU_PROGRAM_MAP( | |
| 511 | MDRV_CPU_PROGRAM_MAP( | |
| 527 | 512 | MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) |
| 528 | 513 | |
| 529 | MDRV_CPU_ADD(I8039,8000000) /* ????? */ | |
| 530 | 514 | /* audio CPU */ |
| 531 | MDRV_CPU_PROGRAM_MAP(i8039_readmem,i8039_writemem) | |
| 532 | MDRV_CPU_IO_MAP(i8039_readport,i8039_writeport) | |
| 515 | MDRV_CPU_ADD(I8039,8000000) /* ????? */ | |
| 516 | MDRV_CPU_PROGRAM_MAP(i8039_map,0) | |
| 517 | MDRV_CPU_IO_MAP(i8039_port_map,0) | |
| 533 | 518 | |
| 534 | 519 | /* video hardware */ |
| 535 | 520 | MDRV_SCREEN_ADD("main", RASTER) |
| r2375 | r2376 | |
| 563 | 548 | MDRV_CPU_PROGRAM_MAP(fghtbskt_map,0) |
| 564 | 549 | MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) |
| 565 | 550 | |
| 566 | MDRV_CPU_ADD(I8039,12000000/4) /* ????? */ | |
| 567 | 551 | /* audio CPU */ |
| 568 | MDRV_CPU_PROGRAM_MAP(i8039_readmem,i8039_writemem) | |
| 569 | MDRV_CPU_IO_MAP(i8039_readport,i8039_writeport) | |
| 552 | MDRV_CPU_ADD(I8039,12000000/4) /* ????? */ | |
| 553 | MDRV_CPU_PROGRAM_MAP(i8039_map,0) | |
| 554 | MDRV_CPU_IO_MAP(i8039_port_map,0) | |
| 570 | 555 | |
| 571 | 556 | /* video hardware */ |
| 572 | 557 | MDRV_SCREEN_ADD("main", RASTER) |
| r2375 | r2376 | |
|---|---|---|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | |
| 594 | static UINT16 common_io_chip_r(int which, offs_t offset, UINT16 mem_mask) | |
| 594 | static UINT16 common_io_chip_r(running_machine *machine, int which, offs_t offset, UINT16 mem_mask) | |
| 595 | 595 | { |
| 596 | 596 | offset &= 0x1f/2; |
| 597 | 597 | |
| r2375 | r2376 | |
| 611 | 611 | return misc_io_data[which][offset]; |
| 612 | 612 | |
| 613 | 613 | /* otherwise, return an input port */ |
| 614 | return | |
| 614 | return | |
| 615 | 615 | |
| 616 | 616 | /* 'SEGA' protection */ |
| 617 | 617 | case 0x10/2: |
| r2375 | r2376 | |
| 700 | 700 | |
| 701 | 701 | static READ16_HANDLER( io_chip_r ) |
| 702 | 702 | { |
| 703 | return common_io_chip_r(0, offset, mem_mask); | |
| 703 | return common_io_chip_r(machine, 0, offset, mem_mask); | |
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | |
| r2375 | r2376 | |
| 712 | 712 | |
| 713 | 713 | static READ32_HANDLER( io_chip_0_r ) |
| 714 | 714 | { |
| 715 | return common_io_chip_r(0, offset*2+0, mem_mask) | | |
| 716 | (common_io_chip_r(0, offset*2+1, mem_mask >> 16) << 16); | |
| 715 | return common_io_chip_r(machine, 0, offset*2+0, mem_mask) | | |
| 716 | (common_io_chip_r(machine, 0, offset*2+1, mem_mask >> 16) << 16); | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | |
| r2375 | r2376 | |
| 728 | 728 | |
| 729 | 729 | static READ32_HANDLER( io_chip_1_r ) |
| 730 | 730 | { |
| 731 | return common_io_chip_r(1, offset*2+0, mem_mask) | | |
| 732 | (common_io_chip_r(1, offset*2+1, mem_mask >> 16) << 16); | |
| 731 | return common_io_chip_r(machine, 1, offset*2+0, mem_mask) | | |
| 732 | (common_io_chip_r(machine, 1, offset*2+1, mem_mask >> 16) << 16); | |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | |
| r2375 | r2376 | |
| 868 | 868 | case 0x12/2: |
| 869 | 869 | case 0x14/2: |
| 870 | 870 | case 0x16/2: |
| 871 | analog_value[offset & 3] = | |
| 871 | analog_value[offset & 3] = | |
| 872 | 872 | return; |
| 873 | 873 | } |
| 874 | 874 | logerror("%06X:unknown analog_custom_io_w(%X) = %04X & %04X\n", activecpu_get_pc(), offset*2, data, mem_mask ^ 0xffff); |
| r2375 | r2376 | |
| 884 | 884 | case 0x22/2: |
| 885 | 885 | case 0x24/2: |
| 886 | 886 | case 0x26/2: |
| 887 | return | |
| 887 | return | |
| 888 | 888 | } |
| 889 | 889 | |
| 890 | 890 | logerror("%06X:unknown extra_custom_io_r(%X) & %04X\n", activecpu_get_pc(), offset*2, mem_mask ^ 0xffff); |
| r2375 | r2376 | |
| 901 | 901 | case 0x12/2: |
| 902 | 902 | case 0x14/2: |
| 903 | 903 | case 0x16/2: |
| 904 | analog_value[offset & 3] = | |
| 904 | analog_value[offset & 3] = | |
| 905 | 905 | return; |
| 906 | 906 | |
| 907 | 907 | case 0x20/2: |
| r2375 | r2376 | |
| 924 | 924 | case 0x0c/2: |
| 925 | 925 | case 0x10/2: |
| 926 | 926 | case 0x14/2: |
| 927 | return (UINT8)( | |
| 927 | return (UINT8)( | |
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | logerror("%06X:unknown sonic_custom_io_r(%X) & %04X\n", activecpu_get_pc(), offset*2, mem_mask ^ 0xffff); |
| r2375 | r2376 | |
| 941 | 941 | case 0x00/2: |
| 942 | 942 | case 0x08/2: |
| 943 | 943 | case 0x10/2: |
| 944 | sonic_last[offset/2 + 0] = readinputportbytag(names[offset/2 + 0]); | |
| 945 | sonic_last[offset/2 + 1] = readinputportbytag(names[offset/2 + 1]); | |
| 944 | sonic_last[offset/2 + 0] = input_port_read(machine, names[offset/2 + 0]); | |
| 945 | sonic_last[offset/2 + 1] = input_port_read(machine, names[offset/2 + 1]); | |
| 946 | 946 | return; |
| 947 | 947 | } |
| 948 | 948 |
| r2375 | r2376 | |
|---|---|---|
| 139 | 139 | /* sound IRQ is on 32V */ |
| 140 | 140 | if (scanline & 32) |
| 141 | 141 | atarigen_6502_irq_ack_r(screen->machine, 0); |
| 142 | else if (!( | |
| 142 | else if (!( | |
| 143 | 143 | atarigen_6502_irq_gen(screen->machine, 0); |
| 144 | 144 | } |
| 145 | 145 | |
| r2375 | r2376 | |
| 240 | 240 | 0x02 = coin 2 |
| 241 | 241 | 0x01 = coin 1 |
| 242 | 242 | */ |
| 243 | result = readinputport(3); | |
| 244 | if (!(readinputport(0) & 0x0080)) result ^= 0x90; | |
| 243 | result = input_port_read_indexed(machine, 3); | |
| 244 | if (!(input_port_read_indexed(machine, 0) & 0x0080)) result ^= 0x90; | |
| 245 | 245 | if (atarigen_cpu_to_sound_ready) result ^= 0x40; |
| 246 | 246 | if (atarigen_sound_to_cpu_ready) result ^= 0x20; |
| 247 | 247 | result ^= 0x10; |
| r2375 | r2376 | |
| 633 | 633 | /* sound IRQ is on 32V */ |
| 634 | 634 | // if (scanline & 32) |
| 635 | 635 | // atarigen_6502_irq_ack_r(screen->machine, 0); |
| 636 | // else if (!( | |
| 636 | // else if (!( | |
| 637 | 637 | // atarigen_6502_irq_gen(screen->machine, 0); |
| 638 | 638 | } |
| 639 | 639 |
| r2375 | r2376 | |
|---|---|---|
| 272 | 272 | if (bits_gone_hi & 0x08) sample_start(5, SND_FLEET4, 0); |
| 273 | 273 | if (bits_gone_hi & 0x10) sample_start(4, SND_UFOHIT, 0); |
| 274 | 274 | |
| 275 | screen_flip = ( | |
| 275 | screen_flip = ( | |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | |
| r2375 | r2376 | |
| 303 | 303 | |
| 304 | 304 | if (bits_gone_hi & 0x04) sample_start(3, SND_INVADERHIT, 0); |
| 305 | 305 | |
| 306 | screen_flip = ( | |
| 306 | screen_flip = ( | |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 |
| r2375 | r2376 | |
|---|---|---|
| 404 | 404 | { |
| 405 | 405 | if (ACCESSING_BITS_24_31) |
| 406 | 406 | { |
| 407 | return ((EEPROM_read_bit() << 28) | ( | |
| 407 | return ((EEPROM_read_bit() << 28) | ( | |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | logerror("Unk EEPROM read mask %x\n", mem_mask); |
| r2375 | r2376 | |
| 419 | 419 | |
| 420 | 420 | static READ32_HANDLER(io32_r) |
| 421 | 421 | { |
| 422 | return (( | |
| 422 | return (( | |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | static WRITE32_HANDLER( paletteram32_RRRRRRRRGGGGGGGGBBBBBBBBxxxxxxxx_dword_w ) |
| r2375 | r2376 | |
|---|---|---|
| 234 | 234 | static READ32_HANDLER( darkhors_eeprom_r ) |
| 235 | 235 | { |
| 236 | 236 | // bit 31? |
| 237 | return | |
| 237 | return | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | static WRITE32_HANDLER( darkhors_eeprom_w ) |
| r2375 | r2376 | |
| 302 | 302 | int bit_p1 = mask_to_bit((input_sel & 0x00ff0000) >> 16); |
| 303 | 303 | int bit_p2 = mask_to_bit((input_sel & 0xff000000) >> 24); |
| 304 | 304 | |
| 305 | return (readinputport(5 + bit_p1) & 0x00ffffff) | | |
| 306 | (readinputport(5 + bit_p2) & 0xff000000) ; | |
| 305 | return (input_port_read_indexed(machine, 5 + bit_p1) & 0x00ffffff) | | |
| 306 | (input_port_read_indexed(machine, 5 + bit_p2) & 0xff000000) ; | |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | static WRITE32_HANDLER( darkhors_unk1_w ) |
| r2375 | r2376 | |
|---|---|---|
| 224 | 224 | |
| 225 | 225 | for (i = 0; i < 5; i++) |
| 226 | 226 | if (bishjan_input & (1 << i)) |
| 227 | res = | |
| 227 | res = | |
| 228 | 228 | |
| 229 | 229 | return (res << 8) | |
| 230 | | |
| 230 | | |
| 231 | 231 | ((bishjan_hopper && !(video_screen_get_frame_number(machine->primary_screen)%10)) ? 0x00 : 0x04) // bit 2: hopper sensor |
| 232 | 232 | ; |
| 233 | 233 | } |
| r2375 | r2376 | |
|---|---|---|
| 90 | 90 | |
| 91 | 91 | static READ16_HANDLER( special_port3_r ) |
| 92 | 92 | { |
| 93 | int result = | |
| 93 | int result = | |
| 94 | 94 | if (atarigen_cpu_to_sound_ready) result ^= 0x0020; |
| 95 | 95 | return result; |
| 96 | 96 | } |
| r2375 | r2376 | |
|---|---|---|
| 24 | 24 | **********************************************************************************/ |
| 25 | 25 | |
| 26 | 26 | #include "driver.h" |
| 27 | #include "deprecat.h" | |
| 27 | 28 | #include "includes/amiga.h" |
| 28 | 29 | |
| 29 | 30 | |
| r2375 | r2376 | |
| 209 | 210 | if (data & 4) |
| 210 | 211 | { |
| 211 | 212 | if (LOG_IO) logerror("Internal register (%d) read\n", nvram_address_latch); |
| 212 | nvram_data_latch = (nvram_address_latch == 0) ? | |
| 213 | nvram_data_latch = (nvram_address_latch == 0) ? | |
| 213 | 214 | } |
| 214 | 215 | |
| 215 | 216 | /* if SEL == 0, we read NVRAM */ |
| r2375 | r2376 | |
|---|---|---|
| 412 | 412 | |
| 413 | 413 | static TIMER_CALLBACK( equites_frq_adjuster_callback ) |
| 414 | 414 | { |
| 415 | UINT8 frq = | |
| 415 | UINT8 frq = | |
| 416 | 416 | |
| 417 | 417 | msm5232_set_clock(sndti_token(SOUND_MSM5232, 0), MSM5232_MIN_CLOCK + frq * (MSM5232_MAX_CLOCK - MSM5232_MIN_CLOCK) / 100); |
| 418 | 418 | //popmessage("8155: C %02x A %02x AY: A %02x B %02x Unk:%x", eq8155_port_c,eq8155_port_a,ay_port_a,ay_port_b,eq_cymbal_ctrl&15); |
| r2375 | r2376 | |
| 643 | 643 | #if HVOLTAGE_DEBUG |
| 644 | 644 | static READ16_HANDLER(hvoltage_debug_r) |
| 645 | 645 | { |
| 646 | return( | |
| 646 | return( | |
| 647 | 647 | } |
| 648 | 648 | #endif |
| 649 | 649 |
| r2375 | r2376 | |
|---|---|---|
| 7038 | 7038 | |
| 7039 | 7039 | static TIMER_CALLBACK( svcpcb_bios_timer_callback ) |
| 7040 | 7040 | { |
| 7041 | int harddip3 = | |
| 7041 | int harddip3 = | |
| 7042 | 7042 | memory_set_bankptr(NEOGEO_BANK_BIOS, memory_region(NEOGEO_REGION_MAIN_CPU_BIOS)+0x20000+harddip3*0x20000); |
| 7043 | 7043 | } |
| 7044 | 7044 |
| r2375 | r2376 | |
|---|---|---|
| 293 | 293 | |
| 294 | 294 | static READ8_HANDLER( omegrace_spinner1_r ) |
| 295 | 295 | { |
| 296 | return (spinnerTable[ | |
| 296 | return (spinnerTable[ | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 |
| r2375 | r2376 | |
|---|---|---|
| 1118 | 1118 | decrypted[A] = swap_bits_5_6(rom[A]); |
| 1119 | 1119 | |
| 1120 | 1120 | /* Call the state save setup code in machine/decocass.c */ |
| 1121 | decocass_machine_state_save_init(); | |
| 1121 | decocass_machine_state_save_init(machine); | |
| 1122 | 1122 | /* and in video/decocass.c, too */ |
| 1123 | 1123 | decocass_video_state_save_init(); |
| 1124 | 1124 | } |
| r2375 | r2376 | |
|---|---|---|
| 119 | 119 | { |
| 120 | 120 | if (ACCESSING_BITS_0_7) |
| 121 | 121 | { |
| 122 | int res = | |
| 122 | int res = | |
| 123 | 123 | |
| 124 | 124 | if (init_eeprom_count) |
| 125 | 125 | { |
| r2375 | r2376 | |
| 139 | 139 | { |
| 140 | 140 | if (ACCESSING_BITS_0_7) |
| 141 | 141 | { |
| 142 | int res = | |
| 142 | int res = | |
| 143 | 143 | |
| 144 | 144 | if (init_eeprom_count) |
| 145 | 145 | { |
| r2375 | r2376 | |
| 173 | 173 | { |
| 174 | 174 | if (ACCESSING_BITS_8_15) |
| 175 | 175 | { |
| 176 | return ( | |
| 176 | return ( | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | return | |
| 179 | return | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | static WRITE16_HANDLER( mmeeprom_w ) |
| r2375 | r2376 | |
| 316 | 316 | |
| 317 | 317 | static READ16_HANDLER( player1_r ) |
| 318 | 318 | { |
| 319 | return | |
| 319 | return | |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | static READ16_HANDLER( player2_r ) |
| 323 | 323 | { |
| 324 | return | |
| 324 | return | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | static READ16_HANDLER( mmplayer1_r ) |
| 328 | 328 | { |
| 329 | return | |
| 329 | return | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | static READ16_HANDLER( mmplayer2_r ) |
| 333 | 333 | { |
| 334 | return | |
| 334 | return | |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | static READ16_HANDLER( mmcoins_r ) |
| 338 | 338 | { |
| 339 | int res = | |
| 339 | int res = | |
| 340 | 340 | |
| 341 | 341 | if (init_eeprom_count) |
| 342 | 342 | { |
| r2375 | r2376 | |
| 349 | 349 | |
| 350 | 350 | static READ16_HANDLER( dddcoins_r ) |
| 351 | 351 | { |
| 352 | int res = ( | |
| 352 | int res = ( | |
| 353 | 353 | |
| 354 | 354 | if (init_eeprom_count) |
| 355 | 355 | { |
| r2375 | r2376 | |
| 850 | 850 | GFXDECODE_ENTRY( REGION_GFX3, 0, bglayout_8bpp, 0x0000, 8 ) |
| 851 | 851 | GFXDECODE_END |
| 852 | 852 | |
| 853 | static STATE_POSTLOAD( mystwarr_postload ) | |
| 854 | { | |
| 855 | reset_sound_region(); | |
| 856 | } | |
| 857 | ||
| 853 | 858 | static MACHINE_START( mystwarr ) |
| 854 | 859 | { |
| 855 | 860 | /* set default bankswitch */ |
| r2375 | r2376 | |
| 860 | 865 | |
| 861 | 866 | state_save_register_global(mw_irq_control); |
| 862 | 867 | state_save_register_global(cur_sound_region); |
| 863 | state_save_register_ | |
| 868 | state_save_register_ | |
| 864 | 869 | } |
| 865 | 870 | |
| 866 | 871 | static MACHINE_RESET(mystwarr) |
| r2375 | r2376 | |
|---|---|---|
| 203 | 203 | int ret = 0xff; |
| 204 | 204 | |
| 205 | 205 | if (fromance_portselect & 0x01) |
| 206 | ret &= | |
| 206 | ret &= | |
| 207 | 207 | if (fromance_portselect & 0x02) |
| 208 | ret &= | |
| 208 | ret &= | |
| 209 | 209 | if (fromance_portselect & 0x04) |
| 210 | ret &= | |
| 210 | ret &= | |
| 211 | 211 | if (fromance_portselect & 0x08) |
| 212 | ret &= | |
| 212 | ret &= | |
| 213 | 213 | if (fromance_portselect & 0x10) |
| 214 | ret &= | |
| 214 | ret &= | |
| 215 | 215 | |
| 216 | 216 | return ret; |
| 217 | 217 | } |
| r2375 | r2376 | |
|---|---|---|
| 295 | 295 | if (laserdisc_type & LASERDISC_TYPE_VARIABLE) |
| 296 | 296 | { |
| 297 | 297 | laserdisc_type &= ~LASERDISC_TYPE_MASK; |
| 298 | laserdisc_type |= ( | |
| 298 | laserdisc_type |= ( | |
| 299 | 299 | } |
| 300 | 300 | laserdisc_reset(discinfo, laserdisc_type & LASERDISC_TYPE_MASK); |
| 301 | 301 | } |
| r2375 | r2376 | |
|---|---|---|
| 53 | 53 | switch (inputport_selected) |
| 54 | 54 | { |
| 55 | 55 | case 0x00: /* DSW B (bits 0-4) */ |
| 56 | return ( | |
| 56 | return ( | |
| 57 | 57 | case 0x01: /* DSW B (bits 5-7), DSW A (bits 0-1) */ |
| 58 | return (( | |
| 58 | return (( | |
| 59 | 59 | case 0x02: /* DSW A (bits 2-6) */ |
| 60 | return ( | |
| 60 | return ( | |
| 61 | 61 | case 0x03: /* DSW A (bit 7), DSW C (bits 0-3) */ |
| 62 | return (( | |
| 62 | return (( | |
| 63 | 63 | case 0x04: /* coins, start */ |
| 64 | return | |
| 64 | return | |
| 65 | 65 | case 0x05: /* 2P controls */ |
| 66 | return | |
| 66 | return | |
| 67 | 67 | case 0x06: /* 1P controls */ |
| 68 | return | |
| 68 | return | |
| 69 | 69 | default: |
| 70 | 70 | return 0xff; |
| 71 | 71 | } |
| r2375 | r2376 | |
|---|---|---|
| 47 | 47 | static void scanline_update(const device_config *screen, int scanline) |
| 48 | 48 | { |
| 49 | 49 | /* generate 32V signals */ |
| 50 | if ((scanline & 32) == 0 && !( | |
| 50 | if ((scanline & 32) == 0 && !( | |
| 51 | 51 | atarigen_scanline_int_gen(screen->machine, 0); |
| 52 | 52 | } |
| 53 | 53 |
| r2375 | r2376 | |
|---|---|---|
| 1430 | 1430 | else |
| 1431 | 1431 | fillbitmap(bitmap, bgcolor, cliprect); |
| 1432 | 1432 | |
| 1433 | if ( | |
| 1433 | if ( | |
| 1434 | 1434 | copy_scroll_xp(bitmap, render_layer[2], *scrollx1, *scrolly1); |
| 1435 | 1435 | copy_fixed_2b (bitmap, render_layer[1]); |
| 1436 | 1436 | copy_fixed_xp (bitmap, render_layer[0]); |
| r2375 | r2376 | |
| 1593 | 1593 | { |
| 1594 | 1594 | // This is a hack, but it lets you coin up when COIN1 or COIN2 are signaled. |
| 1595 | 1595 | // See NMI for the twisted logic that is involved in handling coin input. |
| 1596 | int inp = | |
| 1596 | int inp = | |
| 1597 | 1597 | int result = 0x01; // dual coin slots |
| 1598 | 1598 | |
| 1599 | 1599 | if (inp & 0x80) result |= 0x02; |
| r2375 | r2376 | |
| 1605 | 1605 | |
| 1606 | 1606 | static READ8_HANDLER( io_mirror_r ) |
| 1607 | 1607 | { |
| 1608 | return( | |
| 1608 | return( | |
| 1609 | 1609 | } |
| 1610 | 1610 | |
| 1611 | 1611 |
| r2375 | r2376 | |
|---|---|---|
| 52 | 52 | |
| 53 | 53 | res = 0; |
| 54 | 54 | for (i = 0; i < 8; i++) |
| 55 | res |= (( | |
| 55 | res |= (( | |
| 56 | 56 | |
| 57 | 57 | return res; |
| 58 | 58 | } |
| r2375 | r2376 | |
|---|---|---|
| 257 | 257 | |
| 258 | 258 | static READ32_HANDLER( inp1_r ) |
| 259 | 259 | { |
| 260 | UINT32 result = ( | |
| 260 | UINT32 result = ( | |
| 261 | 261 | |
| 262 | 262 | return result; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | static READ32_HANDLER( inp2_r ) |
| 266 | 266 | { |
| 267 | return ( | |
| 267 | return ( | |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | static READ32_HANDLER( turntable_r ) |
| r2375 | r2376 | |
| 276 | 276 | UINT8 pos; |
| 277 | 277 | int delta; |
| 278 | 278 | |
| 279 | pos = | |
| 279 | pos = | |
| 280 | 280 | delta = pos - turntable_last_pos[turntable_select]; |
| 281 | 281 | if (delta < -128) |
| 282 | 282 | delta += 256; |
| r2375 | r2376 | |
| 1183 | 1183 | * |
| 1184 | 1184 | *************************************/ |
| 1185 | 1185 | |
| 1186 | static STATE_POSTLOAD( djmain_postload ) | |
| 1187 | { | |
| 1188 | sndram_set_bank(); | |
| 1189 | } | |
| 1190 | ||
| 1186 | 1191 | static MACHINE_START( djmain ) |
| 1187 | 1192 | { |
| 1188 | 1193 | UINT8 *region = memory_region(REGION_SOUND1); |
| r2375 | r2376 | |
| 1193 | 1198 | state_save_register_global(v_ctrl); |
| 1194 | 1199 | state_save_register_global_array(obj_regs); |
| 1195 | 1200 | |
| 1196 | state_save_register_ | |
| 1201 | state_save_register_ | |
| 1197 | 1202 | } |
| 1198 | 1203 | |
| 1199 | 1204 |
| r2375 | r2376 | |
|---|---|---|
| 335 | 335 | return (PS7500_IO[IRQSTA]&PS7500_IO[IRQMSKA])|0x80; |
| 336 | 336 | |
| 337 | 337 | case IOCR: //TODO: nINT1, OD[n] p.81 |
| 338 | return (input_port_ | |
| 338 | return (input_port_ | |
| 339 | 339 | |
| 340 | 340 | case VIDCR: |
| 341 | 341 | return (PS7500_IO[offset]|0x50)&0xfffffff0; |
| r2375 | r2376 | |
|---|---|---|
| 169 | 169 | |
| 170 | 170 | static READ8_HANDLER( firetrk_dip_r ) |
| 171 | 171 | { |
| 172 | UINT8 val0 = readinputportbytag("DIP_0"); | |
| 173 | UINT8 val1 = readinputportbytag("DIP_1"); | |
| 172 | UINT8 val0 = input_port_read(machine, "DIP_0"); | |
| 173 | UINT8 val1 = input_port_read(machine, "DIP_1"); | |
| 174 | 174 | |
| 175 | 175 | if (val1 & (1 << (2 * offset + 0))) val0 |= 1; |
| 176 | 176 | if (val1 & (1 << (2 * offset + 1))) val0 |= 2; |
| r2375 | r2376 | |
| 181 | 181 | |
| 182 | 182 | static READ8_HANDLER( montecar_dip_r ) |
| 183 | 183 | { |
| 184 | UINT8 val0 = readinputportbytag("DIP_0"); | |
| 185 | UINT8 val1 = readinputportbytag("DIP_1"); | |
| 184 | UINT8 val0 = input_port_read(machine, "DIP_0"); | |
| 185 | UINT8 val1 = input_port_read(machine, "DIP_1"); | |
| 186 | 186 | |
| 187 | 187 | if (val1 & (1 << (3 - offset))) val0 |= 1; |
| 188 | 188 | if (val1 & (1 << (7 - offset))) val0 |= 2; |
| r2375 | r2376 | |
| 244 | 244 | /* update steering wheels */ |
| 245 | 245 | for (i = 0; i < 2; i++) |
| 246 | 246 | { |
| 247 | UINT32 new_dial = | |
| 247 | UINT32 new_dial = | |
| 248 | 248 | INT32 delta = new_dial - dial[i]; |
| 249 | 249 | |
| 250 | 250 | if (delta != 0) |
| r2375 | r2376 | |
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | return ((readinputportbytag_safe("BIT_0", 0) & (1 << offset)) ? 0x01 : 0) | | |
| 260 | ((readinputportbytag_safe("BIT_6", 0) & (1 << offset)) ? 0x40 : 0) | | |
| 261 | ((readinputportbytag_safe("BIT_7", 0) & (1 << offset)) ? 0x80 : 0); | |
| 259 | return ((input_port_read_safe(machine, "BIT_0", 0) & (1 << offset)) ? 0x01 : 0) | | |
| 260 | ((input_port_read_safe(machine, "BIT_6", 0) & (1 << offset)) ? 0x40 : 0) | | |
| 261 | ((input_port_read_safe(machine, "BIT_7", 0) & (1 << offset)) ? 0x80 : 0); | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 |
| r2375 | r2376 | |
|---|---|---|
| 419 | 419 | static READ8_HANDLER( peplus_crtc_lpen2_r ) |
| 420 | 420 | { |
| 421 | 421 | UINT8 ret_val = 0x00; |
| 422 | UINT8 x_val = readinputportbytag_safe("TOUCH_X",0x00); | |
| 423 | UINT8 y_val = (0x19 - readinputportbytag_safe("TOUCH_Y",0x00)); | |
| 422 | UINT8 x_val = input_port_read_safe(machine, "TOUCH_X",0x00); | |
| 423 | UINT8 y_val = (0x19 - input_port_read_safe(machine, "TOUCH_Y",0x00)); | |
| 424 | 424 | UINT16 t_val = y_val * 0x28 + (x_val+1); |
| 425 | 425 | |
| 426 | 426 | switch(vid_register) { |
| r2375 | r2376 | |
| 530 | 530 | sda = i2cmem_read(0, I2CMEM_SDA); |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | if (( | |
| 533 | if (( | |
| 534 | 534 | coin_state = 1; // Start Coin Cycle |
| 535 | 535 | last_cycles = activecpu_gettotalcycles(); |
| 536 | 536 | } else { |
| r2375 | r2376 | |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | if (curr_cycles - last_door > 6000) { // Guessing with 6000 |
| 569 | if (( | |
| 569 | if (( | |
| 570 | 570 | door_open = (!door_open & 0x01); |
| 571 | 571 | } else { |
| 572 | 572 | door_open = 1; |
| r2375 | r2376 | |
| 963 | 963 | autohold_addr = 0x5e7e; // AutoHold Address |
| 964 | 964 | |
| 965 | 965 | if (autohold_addr) |
| 966 | program_ram[autohold_addr] = | |
| 966 | program_ram[autohold_addr] = | |
| 967 | 967 | */ |
| 968 | 968 | } |
| 969 | 969 |
| r2375 | r2376 | |
|---|---|---|
| 510 | 510 | { |
| 511 | 511 | switch(port) { |
| 512 | 512 | case 0: |
| 513 | return | |
| 513 | return | |
| 514 | 514 | case 1: |
| 515 | return | |
| 515 | return | |
| 516 | 516 | case 2: |
| 517 | 517 | return 0xff; |
| 518 | 518 | case 3: |
| 519 | 519 | return 0xff; |
| 520 | 520 | case 4: |
| 521 | return | |
| 521 | return | |
| 522 | 522 | case 5: // Dip switches |
| 523 | return | |
| 523 | return | |
| 524 | 524 | case 6: |
| 525 | return | |
| 525 | return | |
| 526 | 526 | case 7: // DAC |
| 527 | 527 | return 0xff; |
| 528 | 528 | } |
| r2375 | r2376 | |
| 534 | 534 | switch(port) { |
| 535 | 535 | case 0: { |
| 536 | 536 | static const UINT8 pos[16] = { 0, 1, 3, 2, 6, 4, 12, 8, 9 }; |
| 537 | return ( | |
| 537 | return ( | |
| 538 | 538 | } |
| 539 | 539 | case 1: |
| 540 | return | |
| 540 | return | |
| 541 | 541 | case 2: |
| 542 | 542 | return 0xff; |
| 543 | 543 | case 3: |
| 544 | 544 | return 0xff; |
| 545 | 545 | case 4: |
| 546 | return | |
| 546 | return | |
| 547 | 547 | case 5: // Dip switches |
| 548 | return | |
| 548 | return | |
| 549 | 549 | case 6: |
| 550 | return | |
| 550 | return | |
| 551 | 551 | case 7: // DAC |
| 552 | 552 | return 0xff; |
| 553 | 553 | } |
| r2375 | r2376 | |
| 564 | 564 | case 1: |
| 565 | 565 | return 0xff; |
| 566 | 566 | case 2: |
| 567 | return | |
| 567 | return | |
| 568 | 568 | case 3: |
| 569 | 569 | return 0xff; |
| 570 | 570 | case 4: |
| 571 | return | |
| 571 | return | |
| 572 | 572 | case 5: // Dip switches |
| 573 | return | |
| 573 | return | |
| 574 | 574 | case 6: |
| 575 | return | |
| 575 | return | |
| 576 | 576 | case 7: // DAC |
| 577 | 577 | return 0xff; |
| 578 | 578 | } |
| r2375 | r2376 | |
| 583 | 583 | { |
| 584 | 584 | switch(port) { |
| 585 | 585 | case 0: |
| 586 | return | |
| 586 | return | |
| 587 | 587 | case 1: |
| 588 | return | |
| 588 | return | |
| 589 | 589 | case 2: // P3 inputs |
| 590 | return | |
| 590 | return | |
| 591 | 591 | case 3: |
| 592 | 592 | return 0xff; |
| 593 | 593 | case 4: |
| 594 | return | |
| 594 | return | |
| 595 | 595 | case 5: // Dip switches |
| 596 | return | |
| 596 | return | |
| 597 | 597 | case 6: |
| 598 | return | |
| 598 | return | |
| 599 | 599 | case 7: // DAC |
| 600 | 600 | return 0xff; |
| 601 | 601 | } |
| r2375 | r2376 | |
| 636 | 636 | { |
| 637 | 637 | if(ACCESSING_BITS_0_7) { |
| 638 | 638 | data &= 3; |
| 639 | hotrod_ctrl_cur = | |
| 639 | hotrod_ctrl_cur = | |
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | 642 | |
| r2375 | r2376 | |
| 646 | 646 | switch(offset) { |
| 647 | 647 | // Steering dials |
| 648 | 648 | case 0: |
| 649 | return | |
| 649 | return | |
| 650 | 650 | case 1: |
| 651 | return | |
| 651 | return | |
| 652 | 652 | case 2: |
| 653 | return | |
| 653 | return | |
| 654 | 654 | case 3: |
| 655 | return | |
| 655 | return | |
| 656 | 656 | case 4: |
| 657 | return | |
| 657 | return | |
| 658 | 658 | case 5: |
| 659 | return | |
| 659 | return | |
| 660 | 660 | case 6: |
| 661 | return | |
| 661 | return | |
| 662 | 662 | case 7: |
| 663 | return | |
| 663 | return | |
| 664 | 664 | |
| 665 | 665 | case 8: { // Serial ADCs for the accel |
| 666 | 666 | int v = hotrod_ctrl_cur & 0x80; |
| r2375 | r2376 | |
|---|---|---|
| 1601 | 1601 | } |
| 1602 | 1602 | } |
| 1603 | 1603 | |
| 1604 | static void | |
| 1605 | RoadMarkAllDirty(void) | |
| 1604 | static STATE_POSTLOAD( RoadMarkAllDirty ) | |
| 1606 | 1605 | { |
| 1607 | 1606 | memset( mpRoadDirty,0x01,ROAD_TILE_COUNT_MAX ); |
| 1608 | 1607 | mbRoadSomethingIsDirty = 1; |
| r2375 | r2376 | |
| 1632 | 1631 | |
| 1633 | 1632 | state_save_register_global_pointer(mpRoadDirty, ROAD_TILE_COUNT_MAX); |
| 1634 | 1633 | state_save_register_global_pointer(mpRoadRAM, 0x20000 / 2); |
| 1635 | state_save_register_ | |
| 1634 | state_save_register_ | |
| 1636 | 1635 | |
| 1637 | 1636 | } |
| 1638 | 1637 | } |
| r2375 | r2376 | |
|---|---|---|
| 114 | 114 | |
| 115 | 115 | static READ8_HANDLER(prot_r) |
| 116 | 116 | { |
| 117 | return (input_port_ | |
| 117 | return (input_port_ | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | static WRITE8_HANDLER(prot_w) |
| r2375 | r2376 | |
|---|---|---|
| 279 | 279 | return ppi8255_0_r(machine, offset & 3); |
| 280 | 280 | |
| 281 | 281 | case 0x1000/2: |
| 282 | return | |
| 282 | return | |
| 283 | 283 | |
| 284 | 284 | case 0x2000/2: |
| 285 | return | |
| 285 | return | |
| 286 | 286 | } |
| 287 | 287 | logerror("%06X:standard_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2); |
| 288 | 288 | return 0xffff; |
| r2375 | r2376 | |
| 580 | 580 | { |
| 581 | 581 | switch (video_control & 0xf) |
| 582 | 582 | { |
| 583 | case 0x00: return readinputportbytag("P1"); | |
| 584 | case 0x04: return readinputportbytag("ANALOGX1"); | |
| 585 | case 0x08: return readinputportbytag("ANALOGY1"); | |
| 586 | case 0x0c: return readinputportbytag("UNUSED"); | |
| 583 | case 0x00: return input_port_read(machine, "P1"); | |
| 584 | case 0x04: return input_port_read(machine, "ANALOGX1"); | |
| 585 | case 0x08: return input_port_read(machine, "ANALOGY1"); | |
| 586 | case 0x0c: return input_port_read(machine, "UNUSED"); | |
| 587 | 587 | } |
| 588 | 588 | break; |
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | case 0x02: |
| 592 | return | |
| 592 | return | |
| 593 | 593 | |
| 594 | 594 | case 0x03: |
| 595 | 595 | { |
| 596 | 596 | switch (video_control & 0xf) |
| 597 | 597 | { |
| 598 | case 0x00: return readinputportbytag("P2"); | |
| 599 | case 0x04: return readinputportbytag("ANALOGX2"); | |
| 600 | case 0x08: return readinputportbytag("ANALOGY2"); | |
| 601 | case 0x0c: return readinputportbytag("POW2"); | |
| 598 | case 0x00: return input_port_read(machine, "P2"); | |
| 599 | case 0x04: return input_port_read(machine, "ANALOGX2"); | |
| 600 | case 0x08: return input_port_read(machine, "ANALOGY2"); | |
| 601 | case 0x0c: return input_port_read(machine, "POW2"); | |
| 602 | 602 | } |
| 603 | 603 | break; |
| 604 | 604 | } |
| r2375 | r2376 | |
| 628 | 628 | /* upper bit of the trackball controls */ |
| 629 | 629 | case 0: |
| 630 | 630 | { |
| 631 | UINT8 buttons = readinputportbytag("SERVICE"); | |
| 632 | UINT8 analog1 = readinputportbytag((video_control & 4) ? "ANALOGY1" : "ANALOGX1"); | |
| 633 | UINT8 analog2 = readinputportbytag((video_control & 4) ? "ANALOGY2" : "ANALOGX2"); | |
| 631 | UINT8 buttons = input_port_read(machine, "SERVICE"); | |
| 632 | UINT8 analog1 = input_port_read(machine, (video_control & 4) ? "ANALOGY1" : "ANALOGX1"); | |
| 633 | UINT8 analog2 = input_port_read(machine, (video_control & 4) ? "ANALOGY2" : "ANALOGX2"); | |
| 634 | 634 | buttons |= (analog1 & 0x80) >> 1; |
| 635 | 635 | buttons |= (analog2 & 0x80); |
| 636 | 636 | return buttons; |
| r2375 | r2376 | |
| 640 | 640 | /* player 1 select switch mapped to bit 7 */ |
| 641 | 641 | case 1: |
| 642 | 642 | { |
| 643 | UINT8 buttons = readinputportbytag("BUTTONS1"); | |
| 644 | UINT8 analog = readinputportbytag((video_control & 4) ? "ANALOGY1" : "ANALOGX1"); | |
| 643 | UINT8 buttons = input_port_read(machine, "BUTTONS1"); | |
| 644 | UINT8 analog = input_port_read(machine, (video_control & 4) ? "ANALOGY1" : "ANALOGX1"); | |
| 645 | 645 | return (buttons & 0x80) | (analog & 0x7f); |
| 646 | 646 | } |
| 647 | 647 | |
| r2375 | r2376 | |
| 649 | 649 | case 2: |
| 650 | 650 | { |
| 651 | 651 | if (video_control & 4) |
| 652 | return ( | |
| 652 | return ( | |
| 653 | 653 | else |
| 654 | 654 | { |
| 655 | 655 | static UINT8 last_buttons1 = 0; |
| 656 | 656 | static UINT8 last_buttons2 = 0; |
| 657 | UINT8 buttons1 = readinputportbytag("BUTTONS1"); | |
| 658 | UINT8 buttons2 = readinputportbytag("BUTTONS2"); | |
| 657 | UINT8 buttons1 = input_port_read(machine, "BUTTONS1"); | |
| 658 | UINT8 buttons2 = input_port_read(machine, "BUTTONS2"); | |
| 659 | 659 | |
| 660 | 660 | if (!(buttons1 & 0x01)) |
| 661 | 661 | last_buttons1 = 0; |
| r2375 | r2376 | |
| 683 | 683 | /* player 2 select switch mapped to bit 7 */ |
| 684 | 684 | case 3: |
| 685 | 685 | { |
| 686 | UINT8 buttons = readinputportbytag("BUTTONS2"); | |
| 687 | UINT8 analog = readinputportbytag((video_control & 4) ? "ANALOGY2" : "ANALOGX2"); | |
| 686 | UINT8 buttons = input_port_read(machine, "BUTTONS2"); | |
| 687 | UINT8 analog = input_port_read(machine, (video_control & 4) ? "ANALOGY2" : "ANALOGX2"); | |
| 688 | 688 | return (buttons & 0x80) | (analog & 0x7f); |
| 689 | 689 | } |
| 690 | 690 | } |
| r2375 | r2376 | |
| 714 | 714 | case 1: |
| 715 | 715 | switch ((read_port++)&3) |
| 716 | 716 | { |
| 717 | case 0: return readinputportbytag("P1"); | |
| 718 | case 1: return readinputportbytag("P2"); | |
| 719 | case 2: return readinputportbytag("P3"); | |
| 720 | case 3: return readinputportbytag("P4"); | |
| 717 | case 0: return input_port_read(machine, "P1"); | |
| 718 | case 1: return input_port_read(machine, "P2"); | |
| 719 | case 2: return input_port_read(machine, "P3"); | |
| 720 | case 3: return input_port_read(machine, "P4"); | |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | 723 | break; |
| r2375 | r2376 | |
| 740 | 740 | case 0x1000/2: |
| 741 | 741 | switch (offset & 3) |
| 742 | 742 | { |
| 743 | case 1: return readinputportbytag((video_control & 4) ? "ANALOGY1" : "ANALOGX1"); | |
| 744 | case 3: return readinputportbytag((video_control & 4) ? "ANALOGY2" : "ANALOGX2"); | |
| 743 | case 1: return input_port_read(machine, (video_control & 4) ? "ANALOGY1" : "ANALOGX1"); | |
| 744 | case 3: return input_port_read(machine, (video_control & 4) ? "ANALOGY2" : "ANALOGX2"); | |
| 745 | 745 | } |
| 746 | 746 | break; |
| 747 | 747 | } |
| r2375 | r2376 | |
| 765 | 765 | switch (offset & 3) |
| 766 | 766 | { |
| 767 | 767 | case 1: |
| 768 | if ( | |
| 768 | if ( | |
| 769 | 769 | return 0xff & ~(1 << mj_input_num); |
| 770 | 770 | return 0xff; |
| 771 | 771 | |
| 772 | 772 | case 2: |
| 773 | return | |
| 773 | return | |
| 774 | 774 | } |
| 775 | 775 | break; |
| 776 | 776 | } |
| r2375 | r2376 | |
|---|---|---|
| 332 | 332 | |
| 333 | 333 | sprintf(tag, "IN%s-%d", (const char *)param, controller_select & 0x01); |
| 334 | 334 | |
| 335 | return | |
| 335 | return | |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | |
| r2375 | r2376 | |
| 351 | 351 | { |
| 352 | 352 | default: |
| 353 | 353 | case 0x00: ret = 0x0000; break; /* nothing? */ |
| 354 | case 0x09: ret = readinputportbytag("MAHJONG1"); break; | |
| 355 | case 0x12: ret = readinputportbytag("MAHJONG2"); break; | |
| 356 | case 0x1b: ret = readinputportbytag("MAHJONG3"); break; /* player 1 normal inputs? */ | |
| 357 | case 0x24: ret = readinputportbytag("MAHJONG4"); break; | |
| 354 | case 0x09: ret = input_port_read(machine, "MAHJONG1"); break; | |
| 355 | case 0x12: ret = input_port_read(machine, "MAHJONG2"); break; | |
| 356 | case 0x1b: ret = input_port_read(machine, "MAHJONG3"); break; /* player 1 normal inputs? */ | |
| 357 | case 0x24: ret = input_port_read(machine, "MAHJONG4"); break; | |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | return ret; |
| r2375 | r2376 | |
| 817 | 817 | switch (offset & 0x07) |
| 818 | 818 | { |
| 819 | 819 | default: |
| 820 | case 0x00: neogeo_set_screen_dark(bit); break; | |
| 820 | case 0x00: neogeo_set_screen_dark(machine, bit); break; | |
| 821 | 821 | case 0x01: set_main_cpu_vector_table_source(bit); |
| 822 | 822 | set_audio_cpu_rom_source(bit); /* this is a guess */ |
| 823 | 823 | break; |
| 824 | 824 | case 0x05: neogeo_set_fixed_layer_source(bit); break; |
| 825 | 825 | case 0x06: set_save_ram_unlock(bit); break; |
| 826 | case 0x07: neogeo_set_palette_bank(bit); break; | |
| 826 | case 0x07: neogeo_set_palette_bank(machine, bit); break; | |
| 827 | 827 | |
| 828 | 828 | case 0x02: /* unknown - HC32 middle pin 1 */ |
| 829 | 829 | case 0x03: /* unknown - uPD4990 pin ? */ |
| r2375 | r2376 | |
| 944 | 944 | * |
| 945 | 945 | *************************************/ |
| 946 | 946 | |
| 947 | static STATE_POSTLOAD( neogeo_postload ) | |
| 948 | { | |
| 949 | _set_main_cpu_bank_address(); | |
| 950 | _set_main_cpu_vector_table_source(); | |
| 951 | set_audio_cpu_banking(); | |
| 952 | _set_audio_cpu_rom_source(); | |
| 953 | set_outputs(); | |
| 954 | } | |
| 955 | ||
| 947 | 956 | static MACHINE_START( neogeo ) |
| 948 | 957 | { |
| 949 | 958 | /* set the BIOS bank */ |
| r2375 | r2376 | |
| 987 | 996 | state_save_register_global(led1_value); |
| 988 | 997 | state_save_register_global(led2_value); |
| 989 | 998 | |
| 990 | state_save_register_func_postload(_set_main_cpu_bank_address); | |
| 991 | state_save_register_func_postload(_set_main_cpu_vector_table_source); | |
| 992 | state_save_register_func_postload(set_audio_cpu_banking); | |
| 993 | state_save_register_func_postload(_set_audio_cpu_rom_source); | |
| 994 | state_save_register_func_postload(set_outputs); | |
| 999 | state_save_register_postload(machine, neogeo_postload, NULL); | |
| 995 | 1000 | } |
| 996 | 1001 | |
| 997 | 1002 |
| r2375 | r2376 | |
|---|---|---|
| 489 | 489 | // excpuint stat, objdma stat, eeprom do |
| 490 | 490 | |
| 491 | 491 | // note: racin' force expects bit 1 of the eeprom port to toggle |
| 492 | return( | |
| 492 | return( | |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | static WRITE32_HANDLER( eeprom_w ) |
| r2375 | r2376 | |
| 870 | 870 | switch( input ) |
| 871 | 871 | { |
| 872 | 872 | case ADC083X_CH0: |
| 873 | return ( (double)5 * | |
| 873 | return ( (double)5 * | |
| 874 | 874 | case ADC083X_CH1: |
| 875 | return ( (double)5 * | |
| 875 | return ( (double)5 * | |
| 876 | 876 | case ADC083X_VREF: |
| 877 | 877 | return 5; |
| 878 | 878 | } |
| r2375 | r2376 | |
| 881 | 881 | |
| 882 | 882 | static READ32_HANDLER( le2_gun_H_r ) |
| 883 | 883 | { |
| 884 | int p1x = readinputport(9)*287/0xff+22; | |
| 885 | int p2x = readinputport(11)*287/0xff+22; | |
| 884 | int p1x = input_port_read_indexed(machine, 9)*287/0xff+22; | |
| 885 | int p2x = input_port_read_indexed(machine, 11)*287/0xff+22; | |
| 886 | 886 | |
| 887 | 887 | return (p1x<<16)|p2x; |
| 888 | 888 | } |
| 889 | 889 | |
| 890 | 890 | static READ32_HANDLER( le2_gun_V_r ) |
| 891 | 891 | { |
| 892 | int p1y = readinputport(10)*223/0xff+1; | |
| 893 | int p2y = readinputport(12)*223/0xff+1; | |
| 892 | int p1y = input_port_read_indexed(machine, 10)*223/0xff+1; | |
| 893 | int p2y = input_port_read_indexed(machine, 12)*223/0xff+1; | |
| 894 | 894 | |
| 895 | 895 | return (p1y<<16)|p2y; |
| 896 | 896 | } |
| 897 | 897 | |
| 898 | 898 | static READ32_HANDLER( service_r ) |
| 899 | 899 | { |
| 900 | int res = ( | |
| 900 | int res = ( | |
| 901 | 901 | |
| 902 | 902 | if (init_eeprom_count) |
| 903 | 903 | { |
| r2375 | r2376 | |
| 910 | 910 | |
| 911 | 911 | static READ32_HANDLER( players_r ) |
| 912 | 912 | { |
| 913 | return ( | |
| 913 | return ( | |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 |
| r2375 | r2376 | |
|---|---|---|
| 39 | 39 | |
| 40 | 40 | static UINT8 adc_select; |
| 41 | 41 | |
| 42 | static void (*i8751_vblank_hook)( | |
| 42 | static void (*i8751_vblank_hook)(running_machine *machine); | |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | |
| r2375 | r2376 | |
| 150 | 150 | return ppi8255_0_r(machine, offset & 3); |
| 151 | 151 | |
| 152 | 152 | case 0x1000/2: /* Input ports and DIP switches */ |
| 153 | return | |
| 153 | return | |
| 154 | 154 | |
| 155 | 155 | case 0x3000/2: /* PPI @ 4C */ |
| 156 | 156 | return ppi8255_1_r(machine, offset & 3); |
| 157 | 157 | |
| 158 | 158 | case 0x3020/2: /* ADC0804 data output */ |
| 159 | return | |
| 159 | return | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | logerror("%06X:hangon_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2); |
| r2375 | r2376 | |
| 195 | 195 | return ppi8255_0_r(machine, offset & 3); |
| 196 | 196 | |
| 197 | 197 | case 0x0010/2: /* Input ports and DIP switches */ |
| 198 | return | |
| 198 | return | |
| 199 | 199 | |
| 200 | 200 | case 0x0020/2: /* PPI @ 4C */ |
| 201 | 201 | if (offset == 2) return 0; |
| 202 | 202 | return ppi8255_1_r(machine, offset & 3); |
| 203 | 203 | |
| 204 | 204 | case 0x0030/2: /* ADC0804 data output */ |
| 205 | return | |
| 205 | return | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | logerror("%06X:sharrier_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2); |
| r2375 | r2376 | |
| 312 | 312 | { |
| 313 | 313 | /* if we have a fake 8751 handler, call it on VBLANK */ |
| 314 | 314 | if (i8751_vblank_hook != NULL) |
| 315 | (*i8751_vblank_hook)(); | |
| 315 | (*i8751_vblank_hook)(machine); | |
| 316 | 316 | irq4_line_hold(machine, cpunum); |
| 317 | 317 | } |
| 318 | 318 | |
| r2375 | r2376 | |
| 324 | 324 | * |
| 325 | 325 | *************************************/ |
| 326 | 326 | |
| 327 | static void sharrier_i8751_sim( | |
| 327 | static void sharrier_i8751_sim(running_machine *machine) | |
| 328 | 328 | { |
| 329 | workram[0x492/2] = ( | |
| 329 | workram[0x492/2] = ( | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 |
| r2375 | r2376 | |
|---|---|---|
| 78 | 78 | |
| 79 | 79 | static READ16_HANDLER( special_port2_r ) |
| 80 | 80 | { |
| 81 | int result = | |
| 81 | int result = | |
| 82 | 82 | |
| 83 | 83 | if (atarigen_sound_to_cpu_ready) result ^= 0x0004; |
| 84 | 84 | if (atarigen_cpu_to_sound_ready) result ^= 0x0008; |
| r2375 | r2376 | |
|---|---|---|
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | |
| 113 | static ADDRESS_MAP_START( ultraman_readmem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 114 | AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM) /* ROM */ | |
| 115 | AM_RANGE(0x080000, 0x08ffff) AM_READ(SMH_RAM) /* RAM */ | |
| 116 | AM_RANGE(0x180000, 0x183fff) AM_READ(SMH_RAM) /* Palette */ | |
| 113 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 114 | AM_RANGE(0x000000, 0x03ffff) AM_ROM | |
| 115 | AM_RANGE(0x080000, 0x08ffff) AM_RAM | |
| 116 | AM_RANGE(0x180000, 0x183fff) AM_RAM AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)/* Palette */ | |
| 117 | 117 | AM_RANGE(0x1c0000, 0x1c0001) AM_READ(input_port_0_word_r) /* Coins + Service */ |
| 118 | 118 | AM_RANGE(0x1c0002, 0x1c0003) AM_READ(input_port_1_word_r) /* 1P controls */ |
| 119 | 119 | AM_RANGE(0x1c0004, 0x1c0005) AM_READ(input_port_2_word_r) /* 2P controls */ |
| 120 | 120 | AM_RANGE(0x1c0006, 0x1c0007) AM_READ(input_port_3_word_r) /* DIPSW #1 */ |
| 121 | 121 | AM_RANGE(0x1c0008, 0x1c0009) AM_READ(input_port_4_word_r) /* DIPSW #2 */ |
| 122 | AM_RANGE(0x204000, 0x204fff) AM_READ(ultraman_K051316_0_r) /* K051316 #0 RAM */ | |
| 123 | AM_RANGE(0x205000, 0x205fff) AM_READ(ultraman_K051316_1_r) /* K051316 #1 RAM */ | |
| 124 | AM_RANGE(0x206000, 0x206fff) AM_READ(ultraman_K051316_2_r) /* K051316 #2 RAM */ | |
| 125 | AM_RANGE(0x304000, 0x30400f) AM_READ(ultraman_K051937_r) /* Sprite control */ | |
| 126 | AM_RANGE(0x304800, 0x304fff) AM_READ(ultraman_K051960_r) /* Sprite RAM */ | |
| 127 | ADDRESS_MAP_END | |
| 128 | ||
| 129 | static ADDRESS_MAP_START( ultraman_writemem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 130 | AM_RANGE(0x000000, 0x03ffff) AM_WRITE(SMH_ROM) /* ROM */ | |
| 131 | AM_RANGE(0x080000, 0x08ffff) AM_WRITE(SMH_RAM) /* RAM */ | |
| 132 | AM_RANGE(0x180000, 0x183fff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)/* Palette */ | |
| 133 | 122 | AM_RANGE(0x1c0018, 0x1c0019) AM_WRITE(ultraman_gfxctrl_w) /* counters + gfx ctrl */ |
| 134 | 123 | AM_RANGE(0x1c0020, 0x1c0021) AM_WRITE(sound_cmd_w) |
| 135 | 124 | AM_RANGE(0x1c0028, 0x1c0029) AM_WRITE(sound_irq_trigger_w) |
| 136 | 125 | AM_RANGE(0x1c0030, 0x1c0031) AM_WRITE(watchdog_reset16_w) |
| 137 | AM_RANGE(0x204000, 0x204fff) AM_WRITE(ultraman_K051316_0_w) /* K051316 #0 RAM */ | |
| 138 | AM_RANGE(0x205000, 0x205fff) AM_WRITE(ultraman_K051316_1_w) /* K051316 #1 RAM */ | |
| 139 | AM_RANGE(0x206000, 0x206fff) AM_WRITE(ultraman_K051316_2_w) /* K051316 #2 RAM */ | |
| 140 | AM_RANGE(0x207f80, 0x207f9f) AM_WRITE(ultraman_K051316_ctrl_0_w ) /* K051316 #0 registers */ | |
| 126 | AM_RANGE(0x204000, 0x204fff) AM_READWRITE(ultraman_K051316_0_r, ultraman_K051316_0_w) /* K051316 #0 RAM */ | |
| 127 | AM_RANGE(0x205000, 0x205fff) AM_READWRITE(ultraman_K051316_1_r, ultraman_K051316_1_w) /* K051316 #1 RAM */ | |
| 128 | AM_RANGE(0x206000, 0x206fff) AM_READWRITE(ultraman_K051316_2_r, ultraman_K051316_2_w) /* K051316 #2 RAM */ | |
| 129 | AM_RANGE(0x207f80, 0x207f9f) AM_WRITE(ultraman_K051316_ctrl_0_w ) /* K051316 #0 registers */ | |
| 141 | 130 | AM_RANGE(0x207fa0, 0x207fbf) AM_WRITE(ultraman_K051316_ctrl_1_w ) /* K051316 #1 registers */ |
| 142 | 131 | AM_RANGE(0x207fc0, 0x207fdf) AM_WRITE(ultraman_K051316_ctrl_2_w ) /* K051316 #2 registers */ |
| 143 | AM_RANGE(0x304000, 0x30400f) AM_WRITE(ultraman_K051937_w) /* Sprite control */ | |
| 144 | AM_RANGE(0x304800, 0x304fff) AM_WRITE(ultraman_K051960_w) /* Sprite RAM */ | |
| 132 | AM_RANGE(0x304000, 0x30400f) AM_READWRITE(ultraman_K051937_r, ultraman_K051937_w) /* Sprite control */ | |
| 133 | AM_RANGE(0x304800, 0x304fff) AM_READWRITE(ultraman_K051960_r, ultraman_K051960_w) /* Sprite RAM */ | |
| 145 | 134 | ADDRESS_MAP_END |
| 146 | 135 | |
| 147 | static ADDRESS_MAP_START( ultraman_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 148 | AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) /* ROM */ | |
| 149 | AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_RAM) /* RAM */ | |
| 150 | AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r) /* Sound latch read */ | |
| 151 | AM_RANGE(0xe000, 0xe000) AM_READ(OKIM6295_status_0_r) /* M6295 */ | |
| 152 | AM_RANGE(0xf001, 0xf001) AM_READ(YM2151_status_port_0_r) /* YM2151 */ | |
| 136 | static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 137 | AM_RANGE(0x0000, 0x7fff) AM_ROM | |
| 138 | AM_RANGE(0x8000, 0xbfff) AM_RAM | |
| 139 | AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r) /* Sound latch read */ | |
| 140 | // AM_RANGE(0xd000, 0xd000) AM_WRITE(SMH_NOP) /* ??? */ | |
| 141 | AM_RANGE(0xe000, 0xe000) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w) /* M6295 */ | |
| 142 | AM_RANGE(0xf000, 0xf000) AM_WRITE(YM2151_register_port_0_w) /* YM2151 */ | |
| 143 | AM_RANGE(0xf001, 0xf001) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w) /* YM2151 */ | |
| 153 | 144 | ADDRESS_MAP_END |
| 154 | 145 | |
| 155 | static ADDRESS_MAP_START( ultraman_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 156 | AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) /* ROM */ | |
| 157 | AM_RANGE(0x8000, 0xbfff) AM_WRITE(SMH_RAM) /* RAM */ | |
| 158 | // AM_RANGE(0xd000, 0xd000) AM_WRITE(SMH_NOP) /* ??? */ | |
| 159 | AM_RANGE(0xe000, 0xe000) AM_WRITE(OKIM6295_data_0_w) /* M6295 */ | |
| 160 | AM_RANGE(0xf000, 0xf000) AM_WRITE(YM2151_register_port_0_w) /* YM2151 */ | |
| 161 | AM_RANGE(0xf001, 0xf001) AM_WRITE(YM2151_data_port_0_w) /* YM2151 */ | |
| 162 | ADDRESS_MAP_END | |
| 163 | ||
| 164 | static ADDRESS_MAP_START( ultraman_writeport_sound, ADDRESS_SPACE_IO, 8 ) | |
| 146 | static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 165 | 147 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 166 | 148 | // AM_RANGE(0x00, 0x00) AM_WRITE(SMH_NOP) /* ??? */ |
| 167 | 149 | ADDRESS_MAP_END |
| r2375 | r2376 | |
| 266 | 248 | |
| 267 | 249 | /* basic machine hardware */ |
| 268 | 250 | MDRV_CPU_ADD(M68000,24000000/2) /* 12 MHz? */ |
| 269 | MDRV_CPU_PROGRAM_MAP( | |
| 251 | MDRV_CPU_PROGRAM_MAP( | |
| 270 | 252 | MDRV_CPU_VBLANK_INT("main", irq4_line_hold) |
| 271 | 253 | |
| 272 | MDRV_CPU_ADD(Z80,24000000/6) | |
| 273 | 254 | /* audio CPU */ /* 4 MHz? */ |
| 274 | MDRV_CPU_PROGRAM_MAP(ultraman_readmem_sound,ultraman_writemem_sound) | |
| 275 | MDRV_CPU_IO_MAP(0,ultraman_writeport_sound) | |
| 255 | MDRV_CPU_ADD(Z80,24000000/6) | |
| 256 | MDRV_CPU_PROGRAM_MAP(sound_map,0) | |
| 257 | MDRV_CPU_IO_MAP(sound_io_map,0) | |
| 276 | 258 | |
| 277 | 259 | MDRV_INTERLEAVE(10) |
| 278 | 260 |
| r2375 | r2376 | |
|---|---|---|
| 154 | 154 | |
| 155 | 155 | static CUSTOM_INPUT( ladybug_p1_control_r ) |
| 156 | 156 | { |
| 157 | return | |
| 157 | return | |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | static CUSTOM_INPUT( ladybug_p2_control_r ) |
| r2375 | r2376 | |
| 162 | 162 | UINT32 ret; |
| 163 | 163 | |
| 164 | 164 | /* upright cabinet only uses a single set of controls */ |
| 165 | if (readinputportbytag("DSW0") & 0x20) | |
| 166 | ret = readinputportbytag(LADYBUG_P2_CONTROL_PORT_TAG); | |
| 165 | if (input_port_read(machine, "DSW0") & 0x20) | |
| 166 | ret = input_port_read(machine, LADYBUG_P2_CONTROL_PORT_TAG); | |
| 167 | 167 | else |
| 168 | ret = | |
| 168 | ret = | |
| 169 | 169 | |
| 170 | 170 | return ret; |
| 171 | 171 | } |
| r2375 | r2376 | |
|---|---|---|
| 60 | 60 | |
| 61 | 61 | static READ16_HANDLER( switches_r ) |
| 62 | 62 | { |
| 63 | return ( | |
| 63 | return ( | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | static READ16_HANDLER( trackball_r ) |
| 68 | 68 | { |
| 69 | return ( | |
| 69 | return ( | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | static READ8_HANDLER( input_1_r ) |
| 74 | 74 | { |
| 75 | return ( | |
| 75 | return ( | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | static READ8_HANDLER( input_2_r ) |
| 80 | 80 | { |
| 81 | return ( | |
| 81 | return ( | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 |
| r2375 | r2376 | |
|---|---|---|
| 169 | 169 | { |
| 170 | 170 | UINT8 curr; |
| 171 | 171 | |
| 172 | curr = | |
| 172 | curr = | |
| 173 | 173 | |
| 174 | 174 | dir[i] = curr - pos[i]; |
| 175 | 175 | sign[i] = dir[i] & 0x80; |
| r2375 | r2376 | |
|---|---|---|
| 372 | 372 | |
| 373 | 373 | /* otherwise, return an input port */ |
| 374 | 374 | if (offset == 0x04/2 && sound_banks) |
| 375 | return (readinputport(offset) & 0xbf) | (upd7759_0_busy_r(machine,0) << 6); | |
| 376 | return readinputport(offset); | |
| 375 | return (input_port_read_indexed(machine, offset) & 0xbf) | (upd7759_0_busy_r(machine,0) << 6); | |
| 376 | return input_port_read_indexed(machine, offset); | |
| 377 | 377 | |
| 378 | 378 | /* 'SEGA' protection */ |
| 379 | 379 | case 0x10/2: |
| r2375 | r2376 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | static INTERRUPT_GEN( starshp1_interrupt ) |
| 19 | 19 | { |
| 20 | if (( | |
| 20 | if (( | |
| 21 | 21 | cpunum_set_input_line(machine, 0, 0, PULSE_LINE); |
| 22 | 22 | } |
| 23 | 23 | |
| r2375 | r2376 | |
| 69 | 69 | switch (starshp1_analog_in_select) |
| 70 | 70 | { |
| 71 | 71 | case 0: |
| 72 | val = | |
| 72 | val = | |
| 73 | 73 | break; |
| 74 | 74 | case 1: |
| 75 | val = | |
| 75 | val = | |
| 76 | 76 | break; |
| 77 | 77 | case 2: |
| 78 | 78 | val = 0x20; /* DAC feedback, not used */ |
| 79 | 79 | break; |
| 80 | 80 | case 3: |
| 81 | val = | |
| 81 | val = | |
| 82 | 82 | break; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | return (val & 0x3f) | | |
| 85 | return (val & 0x3f) | | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | static READ8_HANDLER( starshp1_port_2_r ) |
| 90 | 90 | { |
| 91 | return | |
| 91 | return | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 |
| r2375 | r2376 | |
|---|---|---|
| 3851 | 3851 | MACHINE DRIVERS |
| 3852 | 3852 | ***********************************************************/ |
| 3853 | 3853 | |
| 3854 | static STATE_POSTLOAD( f2_postload ) | |
| 3855 | { | |
| 3856 | reset_sound_region(); | |
| 3857 | } | |
| 3858 | ||
| 3854 | 3859 | static MACHINE_START( f2 ) |
| 3855 | 3860 | { |
| 3856 | 3861 | state_save_register_global(banknum); |
| 3857 | state_save_register_ | |
| 3862 | state_save_register_ | |
| 3858 | 3863 | } |
| 3859 | 3864 | |
| 3860 | 3865 | static MACHINE_RESET( qcrayon ) |
| r2375 | r2376 | |
| 5901 | 5906 | state_save_register_global(yesnoj_dsw); |
| 5902 | 5907 | } |
| 5903 | 5908 | |
| 5909 | static STATE_POSTLOAD( driveout_postload ) | |
| 5910 | { | |
| 5911 | reset_driveout_sound_region(); | |
| 5912 | } | |
| 5913 | ||
| 5904 | 5914 | static DRIVER_INIT( driveout ) |
| 5905 | 5915 | { |
| 5906 | 5916 | state_save_register_global(driveout_sound_latch); |
| 5907 | 5917 | state_save_register_global(oki_bank); |
| 5908 | state_save_register_ | |
| 5918 | state_save_register_ | |
| 5909 | 5919 | } |
| 5910 | 5920 | |
| 5911 | 5921 |
| r2375 | r2376 | |
|---|---|---|
| 222 | 222 | { |
| 223 | 223 | case 0: |
| 224 | 224 | default: |
| 225 | joy = (( | |
| 225 | joy = (( | |
| 226 | 226 | break; |
| 227 | 227 | case 1: |
| 228 | joy = (( | |
| 228 | joy = (( | |
| 229 | 229 | break; |
| 230 | 230 | case 2: |
| 231 | joy = (( | |
| 231 | joy = (( | |
| 232 | 232 | break; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | return joy | ( | |
| 235 | return joy | ( | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | static WRITE8_HANDLER( reactor_output_w ) |
| r2375 | r2376 | |
|---|---|---|
| 264 | 264 | { |
| 265 | 265 | if (keyb & (1 << i)) |
| 266 | 266 | { |
| 267 | res = | |
| 267 | res = | |
| 268 | 268 | break; |
| 269 | 269 | } |
| 270 | 270 | } |
| r2375 | r2376 | |
| 398 | 398 | |
| 399 | 399 | static READ8_HANDLER( reikaids_io_r ) |
| 400 | 400 | { |
| 401 | int res = | |
| 401 | int res = | |
| 402 | 402 | |
| 403 | 403 | res |= BIT(upd7807_portc,2) * 0x01; // bit 0 = upd7807 status |
| 404 | 404 | res |= BIT(upd7807_portc,6) * 0x02; // bit 1 = upd7807 data |
| r2375 | r2376 | |
| 468 | 468 | |
| 469 | 469 | static READ8_HANDLER( pteacher_keyboard_r ) |
| 470 | 470 | { |
| 471 | int dips = | |
| 471 | int dips = | |
| 472 | 472 | |
| 473 | 473 | // logerror("%04x: keyboard_r with port A = %02x\n",activecpu_get_pc(),upd7807_porta); |
| 474 | 474 | |
| r2375 | r2376 | |
| 476 | 476 | { |
| 477 | 477 | /* player 1 + dip switches */ |
| 478 | 478 | int row = (upd7807_porta & 0x07); |
| 479 | return | |
| 479 | return | |
| 480 | 480 | } |
| 481 | 481 | if (upd7807_porta & 0x08) |
| 482 | 482 | { |
| r2375 | r2376 | |
|---|---|---|
| 145 | 145 | static CUSTOM_INPUT( teetert_input_direction_r ) |
| 146 | 146 | { |
| 147 | 147 | int result = 0; |
| 148 | UINT8 dial = | |
| 148 | UINT8 dial = | |
| 149 | 149 | |
| 150 | 150 | if (dial != last_dial) |
| 151 | 151 | { |
| r2375 | r2376 | |
| 164 | 164 | |
| 165 | 165 | static CUSTOM_INPUT( teetert_input_movement_r ) |
| 166 | 166 | { |
| 167 | UINT8 dial = | |
| 167 | UINT8 dial = | |
| 168 | 168 | |
| 169 | 169 | return (dial != last_dial) ? 1 : 0; |
| 170 | 170 | } |
| r2375 | r2376 | |
|---|---|---|
| 38 | 38 | |
| 39 | 39 | static READ8_HANDLER( xxmissio_status_r ) |
| 40 | 40 | { |
| 41 | xxmissio_status = (xxmissio_status | 2) & ( | |
| 41 | xxmissio_status = (xxmissio_status | 2) & ( | |
| 42 | 42 | return xxmissio_status; |
| 43 | 43 | } |
| 44 | 44 |
| r2375 | r2376 | |
|---|---|---|
| 161 | 161 | switch (offset) |
| 162 | 162 | { |
| 163 | 163 | case 0 : |
| 164 | data = ( | |
| 164 | data = ( | |
| 165 | 165 | break; |
| 166 | 166 | case 1 : |
| 167 | data = ( | |
| 167 | data = ( | |
| 168 | 168 | break; |
| 169 | 169 | case 2 : |
| 170 | data = (( | |
| 170 | data = (( | |
| 171 | 171 | break; |
| 172 | 172 | case 3 : |
| 173 | data = (( | |
| 173 | data = (( | |
| 174 | 174 | break; |
| 175 | 175 | } |
| 176 | 176 |
| r2375 | r2376 | |
|---|---|---|
| 729 | 729 | //SamSho64 |
| 730 | 730 | // case 0x00: toggi^=1; if (toggi==1) {return 0x00000400;} else {return 0x00000300;}; |
| 731 | 731 | //RoadsEdge |
| 732 | // case 0x00: return | |
| 732 | // case 0x00: return | |
| 733 | 733 | |
| 734 | 734 | //Fatfurwa |
| 735 | 735 | case 0x00: return 0x00000400; |
| 736 | case 0x04: return readinputportbytag("IPT_NONE") | (readinputportbytag("FATFURWA_TST_ETC")<<16); | |
| 737 | case 0x08: return readinputportbytag("FATFURWA_PLR_2") | (readinputportbytag("FATFURWA_PLR_1")<<16); | |
| 736 | case 0x04: return input_port_read(machine, "IPT_NONE") | (input_port_read(machine, "FATFURWA_TST_ETC")<<16); | |
| 737 | case 0x08: return input_port_read(machine, "FATFURWA_PLR_2") | (input_port_read(machine, "FATFURWA_PLR_1")<<16); | |
| 738 | 738 | |
| 739 | 739 | // This takes care of the 'machine' error code |
| 740 | 740 | case 0x600: return no_machine_error_code; |
| r2375 | r2376 | |
|---|---|---|
| 236 | 236 | |
| 237 | 237 | static READ32_HANDLER ( macrossp_ports1_r ) |
| 238 | 238 | { |
| 239 | return (( | |
| 239 | return (( | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | static READ32_HANDLER ( macrossp_ports2_r ) |
| 243 | 243 | { |
| 244 | return (( | |
| 244 | return (( | |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | static WRITE32_HANDLER( paletteram32_macrossp_w ) |
| r2375 | r2376 | |
|---|---|---|
| 216 | 216 | |
| 217 | 217 | static READ8_HANDLER( gladiator_dsw1_r ) |
| 218 | 218 | { |
| 219 | int orig = | |
| 219 | int orig = | |
| 220 | 220 | |
| 221 | 221 | return BITSWAP8(orig, 0,1,2,3,4,5,6,7); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | static READ8_HANDLER( gladiator_dsw2_r ) |
| 225 | 225 | { |
| 226 | int orig = | |
| 226 | int orig = | |
| 227 | 227 | |
| 228 | 228 | return BITSWAP8(orig, 2,3,4,5,6,7,1,0); |
| 229 | 229 | } |
| r2375 | r2376 | |
| 232 | 232 | { |
| 233 | 233 | int coins = 0; |
| 234 | 234 | |
| 235 | if( | |
| 235 | if( | |
| 236 | 236 | switch(offset) |
| 237 | 237 | { |
| 238 | 238 | case 0x01: /* start button , coins */ |
| 239 | return | |
| 239 | return | |
| 240 | 240 | case 0x02: /* Player 1 Controller , coins */ |
| 241 | return | |
| 241 | return | |
| 242 | 242 | case 0x04: /* Player 2 Controller , coins */ |
| 243 | return | |
| 243 | return | |
| 244 | 244 | } |
| 245 | 245 | /* unknown */ |
| 246 | 246 | return 0; |
| r2375 | r2376 | |
| 251 | 251 | switch(offset) |
| 252 | 252 | { |
| 253 | 253 | case 0x01: /* button 3 */ |
| 254 | return | |
| 254 | return | |
| 255 | 255 | } |
| 256 | 256 | /* unknown */ |
| 257 | 257 | return 0; |
| r2375 | r2376 | |
| 278 | 278 | /* YM2203 port A handler (input) */ |
| 279 | 279 | static READ8_HANDLER( gladiator_dsw3_r ) |
| 280 | 280 | { |
| 281 | return | |
| 281 | return | |
| 282 | 282 | } |
| 283 | 283 | /* YM2203 port B handler (output) */ |
| 284 | 284 | static WRITE8_HANDLER( gladiator_int_control_w ) |
| r2375 | r2376 | |
|---|---|---|
| 371 | 371 | else |
| 372 | 372 | { |
| 373 | 373 | static int oldsteer; |
| 374 | int newsteer = | |
| 374 | int newsteer = | |
| 375 | 375 | if( newsteer!=oldsteer ) |
| 376 | 376 | { |
| 377 | 377 | if( imola_steerlatch==0 ) |
| r2375 | r2376 | |
|---|---|---|
| 46 | 46 | static INT32 oldinput=0; |
| 47 | 47 | INT32 coincnt; |
| 48 | 48 | #ifdef MAME_DEBUG |
| 49 | INT32 input= | |
| 49 | INT32 input= | |
| 50 | 50 | #else |
| 51 | INT32 input= | |
| 51 | INT32 input= | |
| 52 | 52 | #endif |
| 53 | 53 | |
| 54 | 54 | if(input&3) |
| r2375 | r2376 | |
|---|---|---|
| 98 | 98 | /* bit 1 is EEPROM ready */ |
| 99 | 99 | /* bit 3 is service button */ |
| 100 | 100 | /* bits 4-7 are DIP switches */ |
| 101 | res = EEPROM_read_bit() | input_port_ | |
| 101 | res = EEPROM_read_bit() | input_port_ | |
| 102 | 102 | |
| 103 | 103 | if (init_eeprom_count) |
| 104 | 104 | { |
| r2375 | r2376 | |
| 261 | 261 | |
| 262 | 262 | static READ16_HANDLER( player1_r ) // players 1 and 3 |
| 263 | 263 | { |
| 264 | return input_port_ | |
| 264 | return input_port_ | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | static READ16_HANDLER( player2_r ) // players 2 and 4 |
| 268 | 268 | { |
| 269 | return input_port_ | |
| 269 | return input_port_ | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | static WRITE16_HANDLER( moo_prot_w ) |
| r2375 | r2376 | |
|---|---|---|
| 45 | 45 | static READ16_HANDLER( eolith16_custom_r ) |
| 46 | 46 | { |
| 47 | 47 | eolith_speedup_read(); |
| 48 | return ( | |
| 48 | return ( | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 |
| r2375 | r2376 | |
|---|---|---|
| 533 | 533 | switch(mux_ctrl) |
| 534 | 534 | { |
| 535 | 535 | case 0: |
| 536 | return input_port_ | |
| 536 | return input_port_ | |
| 537 | 537 | case 1: |
| 538 | return input_port_ | |
| 538 | return input_port_ | |
| 539 | 539 | case 2: |
| 540 | return input_port_ | |
| 540 | return input_port_ | |
| 541 | 541 | case 3: |
| 542 | return input_port_ | |
| 542 | return input_port_ | |
| 543 | 543 | case 7: |
| 544 | return input_port_ | |
| 544 | return input_port_ | |
| 545 | 545 | default: |
| 546 | 546 | logerror("Mux read from unknown port %d (%04x)\n", mux_ctrl, activecpu_get_pc()); |
| 547 | 547 | return 0xff; |
| r2375 | r2376 | |
| 620 | 620 | static READ8_HANDLER( horshoes_tracky_reset_r ) |
| 621 | 621 | { |
| 622 | 622 | /* reset the trackball counter */ |
| 623 | tracky = | |
| 623 | tracky = | |
| 624 | 624 | return 0; |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | static READ8_HANDLER( horshoes_trackx_reset_r ) |
| 628 | 628 | { |
| 629 | 629 | /* reset the trackball counter */ |
| 630 | trackx = | |
| 630 | trackx = | |
| 631 | 631 | return 0; |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | static READ8_HANDLER( horshoes_tracky_lo_r ) |
| 635 | 635 | { |
| 636 | return ( | |
| 636 | return ( | |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | static READ8_HANDLER( horshoes_tracky_hi_r ) |
| 640 | 640 | { |
| 641 | return ( | |
| 641 | return ( | |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | static READ8_HANDLER( horshoes_trackx_lo_r ) |
| 645 | 645 | { |
| 646 | return ( | |
| 646 | return ( | |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | static READ8_HANDLER( horshoes_trackx_hi_r ) |
| 650 | 650 | { |
| 651 | return ( | |
| 651 | return ( | |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 |
| r2375 | r2376 | |
|---|---|---|
| 428 | 428 | |
| 429 | 429 | static const struct dma8237_interface dma8237_2_config = |
| 430 | 430 | { |
| 431 | 0, | |
| 432 | 1.0e-6, // 1us | |
| 431 | 0, | |
| 432 | 1.0e-6, // 1us | |
| 433 | 433 | |
| 434 | 434 | NULL, |
| 435 | 435 | NULL, |
| r2375 | r2376 | |
| 650 | 650 | pic8259_set_irq_line(1, 6, state); |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | static int gamecstl_get_out2(running_machine *machine) { | |
| 654 | return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2 ); | |
| 655 | } | |
| 656 | ||
| 653 | 657 | static const struct kbdc8042_interface at8042 = |
| 654 | 658 | { |
| 655 | KBDC8042_AT386, set_gate_a20, keyboard_interrupt | |
| 659 | KBDC8042_AT386, set_gate_a20, keyboard_interrupt, gamecstl_get_out2 | |
| 656 | 660 | }; |
| 657 | 661 | |
| 658 | 662 | static const struct ide_interface ide_intf = |
| r2375 | r2376 | |
|---|---|---|
| 87 | 87 | int i; |
| 88 | 88 | |
| 89 | 89 | for (i = 0;i < 4;i++) |
| 90 | last[i] = | |
| 90 | last[i] = | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | static READ16_HANDLER( track_r ) |
| r2375 | r2376 | |
| 95 | 95 | switch (offset) |
| 96 | 96 | { |
| 97 | 97 | default: |
| 98 | case 0: return (( readinputport(3) - last[0]) & 0x00ff) | (((readinputport(5) - last[2]) & 0x00ff) << 8); /* X lo */ | |
| 99 | case 1: return (((readinputport(3) - last[0]) & 0xff00) >> 8) | (( readinputport(5) - last[2]) & 0xff00); /* X hi */ | |
| 100 | case 2: return (( readinputport(4) - last[1]) & 0x00ff) | (((readinputport(6) - last[3]) & 0x00ff) << 8); /* Y lo */ | |
| 101 | case 3: return (((readinputport(4) - last[1]) & 0xff00) >> 8) | (( readinputport(6) - last[3]) & 0xff00); /* Y hi */ | |
| 98 | case 0: return (( input_port_read_indexed(machine, 3) - last[0]) & 0x00ff) | (((input_port_read_indexed(machine, 5) - last[2]) & 0x00ff) << 8); /* X lo */ | |
| 99 | case 1: return (((input_port_read_indexed(machine, 3) - last[0]) & 0xff00) >> 8) | (( input_port_read_indexed(machine, 5) - last[2]) & 0xff00); /* X hi */ | |
| 100 | case 2: return (( input_port_read_indexed(machine, 4) - last[1]) & 0x00ff) | (((input_port_read_indexed(machine, 6) - last[3]) & 0x00ff) << 8); /* Y lo */ | |
| 101 | case 3: return (((input_port_read_indexed(machine, 4) - last[1]) & 0xff00) >> 8) | (( input_port_read_indexed(machine, 6) - last[3]) & 0xff00); /* Y hi */ | |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 |
| r2375 | r2376 | |
|---|---|---|
| 36 | 36 | EF4 Coin 1 |
| 37 | 37 | */ |
| 38 | 38 | |
| 39 | return | |
| 39 | return | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | static void cidelsa_q_w(int q) |
| r2375 | r2376 | |
|---|---|---|
| 43 | 43 | { |
| 44 | 44 | const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen); |
| 45 | 45 | |
| 46 | *x = (((readinputport(4 + player * 2) & 0xff) * (visarea->max_x - visarea->min_x)) >> 8) + visarea->min_x; | |
| 47 | *y = (((readinputport(5 + player * 2) & 0xff) * (visarea->max_y - visarea->min_y)) >> 8) + visarea->min_y; | |
| 46 | *x = (((input_port_read_indexed(machine, 4 + player * 2) & 0xff) * (visarea->max_x - visarea->min_x)) >> 8) + visarea->min_x; | |
| 47 | *y = (((input_port_read_indexed(machine, 5 + player * 2) & 0xff) * (visarea->max_y - visarea->min_y)) >> 8) + visarea->min_y; | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 |
| r2375 | r2376 | |
|---|---|---|
| 220 | 220 | memory_set_bankptr(1,&RAM[bankaddress]); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | static STATE_POSTLOAD( m92_postload ) | |
| 224 | { | |
| 225 | set_m92_bank(); | |
| 226 | } | |
| 227 | ||
| 223 | 228 | static MACHINE_START( m92 ) |
| 224 | 229 | { |
| 225 | 230 | state_save_register_global(irqvector); |
| 226 | 231 | state_save_register_global(sound_status); |
| 227 | 232 | state_save_register_global(bankaddress); |
| 228 | state_save_register_ | |
| 233 | state_save_register_ | |
| 229 | 234 | |
| 230 | 235 | scanline_timer = timer_alloc(m92_scanline_interrupt, NULL); |
| 231 | 236 | } |
| r2375 | r2376 | |
|---|---|---|
| 551 | 551 | |
| 552 | 552 | static READ8_HANDLER( CPUC_ready_r ) { snk_sound_busy_bit = 0; return 0; } |
| 553 | 553 | |
| 554 | static READ8_HANDLER( hal21_input_port_0_r ) { return input_port_ | |
| 554 | static READ8_HANDLER( hal21_input_port_0_r ) { return input_port_ | |
| 555 | 555 | |
| 556 | 556 | static WRITE8_HANDLER( hal21_soundcommand_w ) { hal21_sound_scheduler(machine, 1, data); } |
| 557 | 557 | static WRITE8_HANDLER( hal21_soundack_w ) { hal21_sound_scheduler(machine,2, data); } |
| r2375 | r2376 | |
|---|---|---|
| 150 | 150 | |
| 151 | 151 | res |= 0x02;//konami_eeprom_ack() << 5; /* add the ack */ |
| 152 | 152 | |
| 153 | res |= | |
| 153 | res |= | |
| 154 | 154 | |
| 155 | 155 | if (init_eeprom_count) |
| 156 | 156 | { |
| r2375 | r2376 | |
|---|---|---|
| 50 | 50 | |
| 51 | 51 | /* PCB supports two dials, but cab has only got one */ |
| 52 | 52 | |
| 53 | timer_set(video_screen_get_time_until_pos(machine->primary_screen, | |
| 53 | timer_set(video_screen_get_time_until_pos(machine->primary_screen, | |
| 54 | 54 | timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, destroyr_frame_callback); |
| 55 | 55 | } |
| 56 | 56 | |
| r2375 | r2376 | |
| 137 | 137 | |
| 138 | 138 | if (offset == 0) |
| 139 | 139 | { |
| 140 | UINT8 ret = | |
| 140 | UINT8 ret = | |
| 141 | 141 | |
| 142 | 142 | if (destroyr_potsense[0] && destroyr_potmask[0]) |
| 143 | 143 | ret |= 4; |
| r2375 | r2376 | |
| 149 | 149 | |
| 150 | 150 | if (offset == 1) |
| 151 | 151 | { |
| 152 | return | |
| 152 | return | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | logerror("unmapped input port %d\n", offset); |
| r2375 | r2376 | |
|---|---|---|
| 1120 | 1120 | switch (offset & (0x3000/2)) |
| 1121 | 1121 | { |
| 1122 | 1122 | case 0x1000/2: |
| 1123 | return | |
| 1123 | return | |
| 1124 | 1124 | |
| 1125 | 1125 | case 0x2000/2: |
| 1126 | return | |
| 1126 | return | |
| 1127 | 1127 | } |
| 1128 | 1128 | logerror("%06X:standard_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2); |
| 1129 | 1129 | return segaic16_open_bus_r(machine,0,0); |
| r2375 | r2376 | |
| 1379 | 1379 | } |
| 1380 | 1380 | |
| 1381 | 1381 | /* read inputs */ |
| 1382 | workram[inputoffs] = ~ | |
| 1382 | workram[inputoffs] = ~ | |
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | 1385 | static void altbeasj_i8751_sim(running_machine *machine) |
| r2375 | r2376 | |
| 1458 | 1458 | } |
| 1459 | 1459 | |
| 1460 | 1460 | /* read inputs */ |
| 1461 | workram[0x2cd0/2] = (readinputport(1) << 8) | readinputport(3); | |
| 1462 | workram[0x2c96/2] = readinputport(0) << 8; | |
| 1461 | workram[0x2cd0/2] = (input_port_read_indexed(machine, 1) << 8) | input_port_read_indexed(machine, 3); | |
| 1462 | workram[0x2c96/2] = input_port_read_indexed(machine, 0) << 8; | |
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | |
| r2375 | r2376 | |
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | 1481 | /* read inputs */ |
| 1482 | workram[0x01e6/2] = readinputport(0) << 8; | |
| 1483 | workram[0x01e8/2] = readinputport(1) << 8; | |
| 1484 | workram[0x01ea/2] = readinputport(3) << 8; | |
| 1482 | workram[0x01e6/2] = input_port_read_indexed(machine, 0) << 8; | |
| 1483 | workram[0x01e8/2] = input_port_read_indexed(machine, 1) << 8; | |
| 1484 | workram[0x01ea/2] = input_port_read_indexed(machine, 3) << 8; | |
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | 1487 | |
| r2375 | r2376 | |
| 1518 | 1518 | } |
| 1519 | 1519 | |
| 1520 | 1520 | /* read inputs */ |
| 1521 | workram[0x2082/2] = | |
| 1521 | workram[0x2082/2] = | |
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | |
| r2375 | r2376 | |
| 1554 | 1554 | case 0x3000/2: |
| 1555 | 1555 | switch ((offset/2) & 7) |
| 1556 | 1556 | { |
| 1557 | case 0: return (readinputportbytag("ANALOGX1") << 4) >> (8 * (offset & 1)); | |
| 1558 | case 1: return (readinputportbytag("ANALOGY1") << 4) >> (8 * (offset & 1)); | |
| 1559 | case 2: return (readinputportbytag("ANALOGX2") << 4) >> (8 * (offset & 1)); | |
| 1560 | case 3: return (readinputportbytag("ANALOGY2") << 4) >> (8 * (offset & 1)); | |
| 1561 | case 4: return (readinputportbytag("ANALOGX3") << 4) >> (8 * (offset & 1)); | |
| 1562 | case 5: return (readinputportbytag("ANALOGY3") << 4) >> (8 * (offset & 1)); | |
| 1563 | case 6: return (readinputportbytag("ANALOGX4") << 4) >> (8 * (offset & 1)); | |
| 1564 | case 7: return (readinputportbytag("ANALOGY4") << 4) >> (8 * (offset & 1)); | |
| 1557 | case 0: return (input_port_read(machine, "ANALOGX1") << 4) >> (8 * (offset & 1)); | |
| 1558 | case 1: return (input_port_read(machine, "ANALOGY1") << 4) >> (8 * (offset & 1)); | |
| 1559 | case 2: return (input_port_read(machine, "ANALOGX2") << 4) >> (8 * (offset & 1)); | |
| 1560 | case 3: return (input_port_read(machine, "ANALOGY2") << 4) >> (8 * (offset & 1)); | |
| 1561 | case 4: return (input_port_read(machine, "ANALOGX3") << 4) >> (8 * (offset & 1)); | |
| 1562 | case 5: return (input_port_read(machine, "ANALOGY3") << 4) >> (8 * (offset & 1)); | |
| 1563 | case 6: return (input_port_read(machine, "ANALOGX4") << 4) >> (8 * (offset & 1)); | |
| 1564 | case 7: return (input_port_read(machine, "ANALOGY4") << 4) >> (8 * (offset & 1)); | |
| 1565 | 1565 | } |
| 1566 | 1566 | break; |
| 1567 | 1567 | } |
| r2375 | r2376 | |
| 1605 | 1605 | switch (offset & 0x30/2) |
| 1606 | 1606 | { |
| 1607 | 1607 | case 0x20/2: |
| 1608 | hwc_input_value = | |
| 1608 | hwc_input_value = | |
| 1609 | 1609 | break; |
| 1610 | 1610 | |
| 1611 | 1611 | case 0x30/2: |
| r2375 | r2376 | |
| 1637 | 1637 | case 0x3000/2: |
| 1638 | 1638 | switch (offset & 3) |
| 1639 | 1639 | { |
| 1640 | case 0: return readinputportbytag("P1"); | |
| 1641 | case 1: return readinputportbytag("P2"); | |
| 1642 | case 2: return readinputportbytag("P3"); | |
| 1643 | case 3: return readinputportbytag("P4"); | |
| 1640 | case 0: return input_port_read(machine, "P1"); | |
| 1641 | case 1: return input_port_read(machine, "P2"); | |
| 1642 | case 2: return input_port_read(machine, "P3"); | |
| 1643 | case 3: return input_port_read(machine, "P4"); | |
| 1644 | 1644 | } |
| 1645 | 1645 | break; |
| 1646 | 1646 | } |
| r2375 | r2376 | |
| 1662 | 1662 | case 0x3000/2: |
| 1663 | 1663 | switch ((offset/2) & 3) |
| 1664 | 1664 | { |
| 1665 | case 0: return readinputportbytag("ANALOGX1"); | |
| 1666 | case 1: return readinputportbytag("ANALOGY1"); | |
| 1667 | case 2: return readinputportbytag("ANALOGX2"); | |
| 1668 | case 3: return readinputportbytag("ANALOGY2"); | |
| 1665 | case 0: return input_port_read(machine, "ANALOGX1"); | |
| 1666 | case 1: return input_port_read(machine, "ANALOGY1"); | |
| 1667 | case 2: return input_port_read(machine, "ANALOGX2"); | |
| 1668 | case 3: return input_port_read(machine, "ANALOGY2"); | |
| 1669 | 1669 | } |
| 1670 | 1670 | break; |
| 1671 | 1671 | } |
| r2375 | r2376 | |
| 1689 | 1689 | switch (offset & 3) |
| 1690 | 1690 | { |
| 1691 | 1691 | case 1: |
| 1692 | if ( | |
| 1692 | if ( | |
| 1693 | 1693 | return 0xff & ~(1 << mj_input_num); |
| 1694 | 1694 | return 0xff; |
| 1695 | 1695 | |
| 1696 | 1696 | case 2: |
| 1697 | return | |
| 1697 | return | |
| 1698 | 1698 | } |
| 1699 | 1699 | break; |
| 1700 | 1700 | } |
| r2375 | r2376 | |
|---|---|---|
| 149 | 149 | switch (offset) |
| 150 | 150 | { |
| 151 | 151 | case 0x00: |
| 152 | tmp = | |
| 152 | tmp = | |
| 153 | 153 | tmp &= 0xcfff; |
| 154 | tmp |= (( | |
| 154 | tmp |= (( | |
| 155 | 155 | break; |
| 156 | 156 | case 0x01: |
| 157 | tmp = | |
| 157 | tmp = | |
| 158 | 158 | tmp &= 0xc0ff; |
| 159 | tmp |= (( | |
| 159 | tmp |= (( | |
| 160 | 160 | break; |
| 161 | 161 | case 0x02: |
| 162 | tmp = | |
| 162 | tmp = | |
| 163 | 163 | tmp &= 0xc0ff; |
| 164 | tmp |= (( | |
| 164 | tmp |= (( | |
| 165 | 165 | break; |
| 166 | 166 | case 0x03: |
| 167 | tmp = ( | |
| 167 | tmp = ( | |
| 168 | 168 | tmp &= 0xfcff; |
| 169 | tmp |= (( | |
| 169 | tmp |= (( | |
| 170 | 170 | break; |
| 171 | 171 | } |
| 172 | 172 |
| r2375 | r2376 | |
|---|---|---|
| 833 | 833 | ROM_RELOAD( 0x3000, 0x1000 ) |
| 834 | 834 | |
| 835 | 835 | ROM_REGION( 0x4000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 836 | ROM_LOAD( "hopper08.6f", 0x0000, 0x2000, CRC(06d37e64) SHA1(c0923a1a40dca43b66e14d755dacf7767d62ab8b) ) | |
| 837 | ROM_LOAD( "hopper09.6k", 0x2000, 0x2000, CRC(047921c7) SHA1(8ef4722a98be540e4b5c67965599c400511b4a52) ) | |
| 836 | ROM_LOAD( "hopper09.6k", 0x0000, 0x2000, CRC(047921c7) SHA1(8ef4722a98be540e4b5c67965599c400511b4a52) ) | |
| 837 | ROM_LOAD( "hopper08.6f", 0x2000, 0x2000, CRC(06d37e64) SHA1(c0923a1a40dca43b66e14d755dacf7767d62ab8b) ) | |
| 838 | 838 | |
| 839 | 839 | ROM_REGION( 0x0200, REGION_PROMS, 0 ) |
| 840 | 840 | ROM_LOAD( "7052hop.1b", 0x0000, 0x0100, CRC(94450775) SHA1(e15fcf6d1cd7cfc0d98e82bd0559b6d342aac9ed) ) /* palette low 4 bits */ |
| r2375 | r2376 | |
|---|---|---|
| 100 | 100 | in_0_shift = 0; |
| 101 | 101 | in_1_shift = 0; |
| 102 | 102 | |
| 103 | in_0 = readinputport(0); | |
| 104 | in_1 = readinputport(1); | |
| 103 | in_0 = input_port_read_indexed(machine, 0); | |
| 104 | in_1 = input_port_read_indexed(machine, 1); | |
| 105 | 105 | |
| 106 | 106 | multigam_in_dsw_shift = 0; |
| 107 | multigam_in_dsw = | |
| 107 | multigam_in_dsw = | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | static READ8_HANDLER( multigam_IN1_r ) |
| r2375 | r2376 | |
| 117 | 117 | /* bit 0: serial input (dsw) |
| 118 | 118 | bit 1: coin */ |
| 119 | 119 | return ((multigam_in_dsw >> multigam_in_dsw_shift++) & 0x01) | |
| 120 | | |
| 120 | | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 |
| r2375 | r2376 | |
|---|---|---|
| 81 | 81 | |
| 82 | 82 | static READ32_HANDLER( special_port2_r ) |
| 83 | 83 | { |
| 84 | int temp = | |
| 84 | int temp = | |
| 85 | 85 | if (atarigen_cpu_to_sound_ready) temp ^= 0x0020; |
| 86 | 86 | if (atarigen_sound_to_cpu_ready) temp ^= 0x0010; |
| 87 | 87 | temp ^= 0x0008; /* A2D.EOC always high for now */ |
| r2375 | r2376 | |
| 91 | 91 | |
| 92 | 92 | static READ32_HANDLER( special_port3_r ) |
| 93 | 93 | { |
| 94 | int temp = | |
| 94 | int temp = | |
| 95 | 95 | return (temp << 16) | temp; |
| 96 | 96 | } |
| 97 | 97 | |
| r2375 | r2376 | |
| 111 | 111 | switch (offset) |
| 112 | 112 | { |
| 113 | 113 | case 0: |
| 114 | return ( | |
| 114 | return ( | |
| 115 | 115 | case 1: |
| 116 | return ( | |
| 116 | return ( | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | return 0; |
| r2375 | r2376 | |
| 1169 | 1169 | |
| 1170 | 1170 | static READ32_HANDLER( inputs_01_r ) |
| 1171 | 1171 | { |
| 1172 | return ( | |
| 1172 | return ( | |
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | 1175 |
| r2375 | r2376 | |
|---|---|---|
| 556 | 556 | int value = 0; |
| 557 | 557 | switch (input) |
| 558 | 558 | { |
| 559 | case 0: value = readinputport(4) - 0x800; break; | |
| 560 | case 1: value = readinputport(5); break; | |
| 561 | case 2: value = readinputport(6); break; | |
| 562 | case 3: value = readinputport(7); break; | |
| 563 | case 4: value = readinputport(8); break; | |
| 559 | case 0: value = input_port_read_indexed(Machine, 4) - 0x800; break; | |
| 560 | case 1: value = input_port_read_indexed(Machine, 5); break; | |
| 561 | case 2: value = input_port_read_indexed(Machine, 6); break; | |
| 562 | case 3: value = input_port_read_indexed(Machine, 7); break; | |
| 563 | case 4: value = input_port_read_indexed(Machine, 8); break; | |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | return (double)(value) / 2047.0; |
| r2375 | r2376 | |
| 573 | 573 | { |
| 574 | 574 | if (ACCESSING_BITS_24_31) |
| 575 | 575 | { |
| 576 | r |= | |
| 576 | r |= | |
| 577 | 577 | } |
| 578 | 578 | if (ACCESSING_BITS_16_23) |
| 579 | 579 | { |
| 580 | r |= | |
| 580 | r |= | |
| 581 | 581 | } |
| 582 | 582 | if (ACCESSING_BITS_8_15) |
| 583 | 583 | { |
| 584 | r |= | |
| 584 | r |= | |
| 585 | 585 | } |
| 586 | 586 | if (ACCESSING_BITS_0_7) |
| 587 | 587 | { |
| r2375 | r2376 | |
| 592 | 592 | { |
| 593 | 593 | if (ACCESSING_BITS_24_31) |
| 594 | 594 | { |
| 595 | r |= | |
| 595 | r |= | |
| 596 | 596 | } |
| 597 | 597 | } |
| 598 | 598 | return r; |
| r2375 | r2376 | |
|---|---|---|
| 93 | 93 | switch (offset) |
| 94 | 94 | { |
| 95 | 95 | case 0x00 >> 1: |
| 96 | return | |
| 96 | return | |
| 97 | 97 | case 0x02 >> 1: |
| 98 | 98 | return 0xffff; // to avoid game to reset (needs more work) |
| 99 | 99 | } |
| r2375 | r2376 | |
| 108 | 108 | switch (offset) |
| 109 | 109 | { |
| 110 | 110 | case 0x00 >>1: |
| 111 | return | |
| 111 | return | |
| 112 | 112 | case 0x02 >>1: |
| 113 | return | |
| 113 | return | |
| 114 | 114 | case 0x04 >>1: |
| 115 | return | |
| 115 | return | |
| 116 | 116 | } |
| 117 | 117 | return 0xffff; |
| 118 | 118 |
| r2375 | r2376 | |
|---|---|---|
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | |
| 117 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 118 | AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) | |
| 119 | AM_RANGE(0x8000, 0x8fff) AM_READ(vastar_bg2videoram_r) | |
| 120 | AM_RANGE(0x9000, 0x9fff) AM_READ(vastar_bg1videoram_r) | |
| 121 | AM_RANGE(0xa000, 0xafff) AM_READ(vastar_bg2videoram_r) /* mirror address */ | |
| 122 | AM_RANGE(0xb000, 0xbfff) AM_READ(vastar_bg1videoram_r) /* mirror address */ | |
| 123 | AM_RANGE(0xc400, 0xcfff) AM_READ(SMH_RAM) | |
| 124 | AM_RANGE(0xe000, 0xe000) AM_READ(watchdog_reset_r) | |
| 125 | AM_RANGE(0xf000, 0xf0ff) AM_READ(vastar_sharedram_r) | |
| 126 | AM_RANGE(0xf100, 0xf7ff) AM_READ(SMH_RAM) | |
| 127 | ADDRESS_MAP_END | |
| 128 | ||
| 129 | static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 130 | AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) | |
| 131 | AM_RANGE(0x8000, 0x8fff) AM_WRITE(vastar_bg2videoram_w) AM_BASE(&vastar_bg2videoram) | |
| 132 | AM_RANGE(0x9000, 0x9fff) AM_WRITE(vastar_bg1videoram_w) AM_BASE(&vastar_bg1videoram) | |
| 133 | AM_RANGE(0xa000, 0xafff) AM_WRITE(vastar_bg2videoram_w) /* mirror address */ | |
| 134 | AM_RANGE(0xb000, 0xbfff) AM_WRITE(vastar_bg1videoram_w) /* mirror address */ | |
| 117 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 118 | AM_RANGE(0x0000, 0x7fff) AM_ROM | |
| 119 | AM_RANGE(0x8000, 0x8fff) AM_READWRITE(vastar_bg2videoram_r, vastar_bg2videoram_w) AM_BASE(&vastar_bg2videoram) | |
| 120 | AM_RANGE(0x9000, 0x9fff) AM_READWRITE(vastar_bg1videoram_r, vastar_bg1videoram_w) AM_BASE(&vastar_bg1videoram) | |
| 121 | AM_RANGE(0xa000, 0xafff) AM_READWRITE(vastar_bg2videoram_r, vastar_bg2videoram_w) /* mirror address */ | |
| 122 | AM_RANGE(0xb000, 0xbfff) AM_READWRITE(vastar_bg1videoram_r, vastar_bg1videoram_w) /* mirror address */ | |
| 135 | 123 | AM_RANGE(0xc000, 0xc000) AM_WRITE(SMH_RAM) AM_BASE(&vastar_sprite_priority) /* sprite/BG priority */ |
| 136 | AM_RANGE(0xc400, 0xcfff) AM_WRITE(vastar_fgvideoram_w) AM_BASE(&vastar_fgvideoram) | |
| 137 | AM_RANGE(0xe000, 0xe000) AM_WRITE(watchdog_reset_w) | |
| 138 | AM_RANGE(0xf000, 0xf0ff) AM_WRITE(vastar_sharedram_w) AM_BASE(&vastar_sharedram) | |
| 139 | AM_RANGE(0xf100, 0xf7ff) AM_WRITE(SMH_RAM) | |
| 124 | AM_RANGE(0xc400, 0xcfff) AM_RAM AM_WRITE(vastar_fgvideoram_w) AM_BASE(&vastar_fgvideoram) | |
| 125 | AM_RANGE(0xe000, 0xe000) AM_READWRITE(watchdog_reset_r, watchdog_reset_w) | |
| 126 | AM_RANGE(0xf000, 0xf0ff) AM_READWRITE(vastar_sharedram_r, vastar_sharedram_w) AM_BASE(&vastar_sharedram) | |
| 127 | AM_RANGE(0xf100, 0xf7ff) AM_RAM | |
| 140 | 128 | |
| 141 | /* in hidden portions of video RAM: */ | |
| 129 | /* in hidden portions of video RAM: (fallthrough) */ | |
| 142 | 130 | AM_RANGE(0xc400, 0xc43f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) /* actually c410-c41f and c430-c43f */ |
| 143 | 131 | AM_RANGE(0xc7c0, 0xc7df) AM_WRITE(SMH_RAM) AM_BASE(&vastar_bg1_scroll) |
| 144 | 132 | AM_RANGE(0xc7e0, 0xc7ff) AM_WRITE(SMH_RAM) AM_BASE(&vastar_bg2_scroll) |
| r2375 | r2376 | |
| 146 | 134 | AM_RANGE(0xcc00, 0xcc3f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_3) /* actually cc10-cc1f and cc30-cc3f */ |
| 147 | 135 | ADDRESS_MAP_END |
| 148 | 136 | |
| 149 | static ADDRESS_MAP_START( | |
| 137 | static ADDRESS_MAP_START( main_port_map, ADDRESS_SPACE_IO, 8 ) | |
| 150 | 138 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 151 | 139 | AM_RANGE(0x00, 0x00) AM_WRITE(interrupt_enable_w) |
| 152 | 140 | AM_RANGE(0x01, 0x01) AM_WRITE(flip_screen_w) |
| 153 | 141 | AM_RANGE(0x02, 0x02) AM_WRITE(vastar_hold_cpu2_w) |
| 154 | 142 | ADDRESS_MAP_END |
| 155 | 143 | |
| 156 | static ADDRESS_MAP_START( cpu2_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 157 | AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM) | |
| 158 | AM_RANGE(0x4000, 0x40ff) AM_READ(vastar_sharedram_r) | |
| 144 | ||
| 145 | static ADDRESS_MAP_START( cpu2_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 146 | AM_RANGE(0x0000, 0x1fff) AM_ROM | |
| 147 | AM_RANGE(0x4000, 0x40ff) AM_READWRITE(vastar_sharedram_r, vastar_sharedram_w) | |
| 159 | 148 | AM_RANGE(0x8000, 0x8000) AM_READ(input_port_1_r) |
| 160 | 149 | AM_RANGE(0x8040, 0x8040) AM_READ(input_port_0_r) |
| 161 | 150 | AM_RANGE(0x8080, 0x8080) AM_READ(input_port_2_r) |
| 162 | 151 | ADDRESS_MAP_END |
| 163 | 152 | |
| 164 | static ADDRESS_MAP_START( cpu2_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 165 | AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_ROM) | |
| 166 | AM_RANGE(0x4000, 0x40ff) AM_WRITE(vastar_sharedram_w) | |
| 167 | ADDRESS_MAP_END | |
| 168 | ||
| 169 | static ADDRESS_MAP_START( cpu2_readport, ADDRESS_SPACE_IO, 8 ) | |
| 153 | static ADDRESS_MAP_START( cpu2_port_map, ADDRESS_SPACE_IO, 8 ) | |
| 170 | 154 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 171 | AM_RANGE(0x02, 0x02) AM_READ(AY8910_read_port_0_r) | |
| 172 | ADDRESS_MAP_END | |
| 173 | ||
| 174 | static ADDRESS_MAP_START( cpu2_writeport, ADDRESS_SPACE_IO, 8 ) | |
| 175 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 176 | 155 | AM_RANGE(0x00, 0x00) AM_WRITE(AY8910_control_port_0_w) |
| 177 | 156 | AM_RANGE(0x01, 0x01) AM_WRITE(AY8910_write_port_0_w) |
| 157 | AM_RANGE(0x02, 0x02) AM_READ(AY8910_read_port_0_r) | |
| 178 | 158 | ADDRESS_MAP_END |
| 179 | 159 | |
| 180 | 160 | |
| 181 | ||
| 182 | 161 | static INPUT_PORTS_START( vastar ) |
| 183 | 162 | PORT_START_TAG("IN0") |
| 184 | 163 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| r2375 | r2376 | |
| 325 | 304 | |
| 326 | 305 | /* basic machine hardware */ |
| 327 | 306 | MDRV_CPU_ADD(Z80, 3072000) /* 3.072 MHz ???? */ |
| 328 | MDRV_CPU_PROGRAM_MAP(readmem,writemem) | |
| 329 | MDRV_CPU_IO_MAP(0,writeport) | |
| 307 | MDRV_CPU_PROGRAM_MAP(main_map,0) | |
| 308 | MDRV_CPU_IO_MAP(main_port_map,0) | |
| 330 | 309 | MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) |
| 331 | 310 | |
| 332 | 311 | MDRV_CPU_ADD(Z80, 3072000) /* 3.072 MHz ???? */ |
| 333 | MDRV_CPU_PROGRAM_MAP(cpu2_readmem,cpu2_writemem) | |
| 334 | MDRV_CPU_IO_MAP(cpu2_readport,cpu2_writeport) | |
| 312 | MDRV_CPU_PROGRAM_MAP(cpu2_map,0) | |
| 313 | MDRV_CPU_IO_MAP(cpu2_port_map,0) | |
| 335 | 314 | MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4) /* ??? */ |
| 336 | 315 | |
| 337 | 316 | MDRV_INTERLEAVE(10) /* 10 CPU slices per frame - seems enough to ensure proper */ |
| r2375 | r2376 | |
|---|---|---|
| 104 | 104 | |
| 105 | 105 | static READ16_HANDLER( special_port2_r ) |
| 106 | 106 | { |
| 107 | int result = | |
| 107 | int result = | |
| 108 | 108 | if (atarigen_cpu_to_sound_ready) result ^= 0x0020; |
| 109 | 109 | if (!(result & 0x0080) || atarigen_get_hblank(machine->primary_screen)) result ^= 0x0001; |
| 110 | 110 | return result; |
| r2375 | r2376 | |
|---|---|---|
| 58 | 58 | case 0x0: /* MSW: Test switch, coins, eeprom access, LSW: Player Buttons, Start, Tilt, Service */ |
| 59 | 59 | e=EEPROM_read_bit(); |
| 60 | 60 | e=e|(e<<8); |
| 61 | return ((e | readinputport(2) | (readinputport(2)<<8))<<16) /* top byte may be mirror of bottom byte?? see bubblem */ | |
| 62 | | readinputport(1); | |
| 61 | return ((e | input_port_read_indexed(machine, 2) | (input_port_read_indexed(machine, 2)<<8))<<16) /* top byte may be mirror of bottom byte?? see bubblem */ | |
| 62 | | input_port_read_indexed(machine, 1); | |
| 63 | 63 | |
| 64 | 64 | case 0x1: /* MSW: Coin counters/lockouts are readable, LSW: Joysticks (Player 1 & 2) */ |
| 65 | return (coin_word[0]<<16) | | |
| 65 | return (coin_word[0]<<16) | | |
| 66 | 66 | |
| 67 | 67 | case 0x2: /* Analog control 1 */ |
| 68 | return (( | |
| 68 | return (( | |
| 69 | 69 | |
| 70 | 70 | case 0x3: /* Analog control 2 */ |
| 71 | return (( | |
| 71 | return (( | |
| 72 | 72 | |
| 73 | 73 | case 0x4: /* Player 3 & 4 fire buttons (Player 2 top fire buttons in Kaiser Knuckle) */ |
| 74 | return | |
| 74 | return | |
| 75 | 75 | |
| 76 | 76 | case 0x5: /* Player 3 & 4 joysticks (Player 1 top fire buttons in Kaiser Knuckle) */ |
| 77 | return (coin_word[1]<<16) | | |
| 77 | return (coin_word[1]<<16) | | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n",activecpu_get_pc(),offset); |
| r2375 | r2376 | |
|---|---|---|
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | static READ16_HANDLER(p1_gun_x) {return (readinputport(3)*320/0x100)+1;} | |
| 273 | static READ16_HANDLER(p1_gun_y) {return (readinputport(5)*240/0x100)-4;} | |
| 274 | static READ16_HANDLER(p2_gun_x) {return (readinputport(4)*320/0x100)+1;} | |
| 275 | static READ16_HANDLER(p2_gun_y) {return (readinputport(6)*240/0x100)-4;} | |
| 272 | static READ16_HANDLER(p1_gun_x) {return (input_port_read_indexed(machine, 3)*320/0x100)+1;} | |
| 273 | static READ16_HANDLER(p1_gun_y) {return (input_port_read_indexed(machine, 5)*240/0x100)-4;} | |
| 274 | static READ16_HANDLER(p2_gun_x) {return (input_port_read_indexed(machine, 4)*320/0x100)+1;} | |
| 275 | static READ16_HANDLER(p2_gun_y) {return (input_port_read_indexed(machine, 6)*240/0x100)-4;} | |
| 276 | 276 | |
| 277 | 277 | static ADDRESS_MAP_START( bang_readmem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 278 | 278 | AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM) /* ROM */ |
| r2375 | r2376 | |
|---|---|---|
| 92 | 92 | static READ8_HANDLER(homerun_40_r) |
| 93 | 93 | { |
| 94 | 94 | if(video_screen_get_vpos(machine->primary_screen)>116) |
| 95 | return | |
| 95 | return | |
| 96 | 96 | else |
| 97 | return | |
| 97 | return | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | static ADDRESS_MAP_START( homerun_iomap, ADDRESS_SPACE_IO, 8 ) |
| r2375 | r2376 | |
|---|---|---|
| 552 | 552 | case 0x01: |
| 553 | 553 | case 0x02: |
| 554 | 554 | { |
| 555 | return | |
| 555 | return | |
| 556 | 556 | } |
| 557 | 557 | case 0x30: |
| 558 | 558 | { |
| r2375 | r2376 | |
|---|---|---|
| 144 | 144 | switch (inputport_selected) |
| 145 | 145 | { |
| 146 | 146 | case 0x00: /* DSW A (bits 0-4) */ |
| 147 | return ( | |
| 147 | return ( | |
| 148 | 148 | case 0x01: /* DSW A (bits 5-7), DSW B (bits 0-1) */ |
| 149 | return (( | |
| 149 | return (( | |
| 150 | 150 | case 0x02: /* DSW B (bits 2-6) */ |
| 151 | return ( | |
| 151 | return ( | |
| 152 | 152 | case 0x03: /* DSW B (bit 7), DSW C (bits 0-3) */ |
| 153 | return (( | |
| 153 | return (( | |
| 154 | 154 | case 0x04: /* coins, start */ |
| 155 | return | |
| 155 | return | |
| 156 | 156 | case 0x05: /* 2P controls */ |
| 157 | return | |
| 157 | return | |
| 158 | 158 | case 0x06: /* 1P controls */ |
| 159 | return | |
| 159 | return | |
| 160 | 160 | default: |
| 161 | 161 | return 0xff; |
| 162 | 162 | } |
| r2375 | r2376 | |
|---|---|---|
| 34 | 34 | { |
| 35 | 35 | static int coin; |
| 36 | 36 | |
| 37 | if (( | |
| 37 | if (( | |
| 38 | 38 | { |
| 39 | 39 | if (coin == 0) |
| 40 | 40 | { |
| r2375 | r2376 | |
|---|---|---|
| 319 | 319 | /* game in cocktail mode, they don't work at all. So we fake-mux */ |
| 320 | 320 | /* the controls through player 1's ports */ |
| 321 | 321 | if (mcr_cocktail_flip) |
| 322 | return | |
| 322 | return | |
| 323 | 323 | else |
| 324 | return (( | |
| 324 | return (( | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | |
| r2375 | r2376 | |
| 329 | 329 | { |
| 330 | 330 | /* same deal as above */ |
| 331 | 331 | if (mcr_cocktail_flip) |
| 332 | return | |
| 332 | return | |
| 333 | 333 | else |
| 334 | return ( | |
| 334 | return ( | |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | |
| r2375 | r2376 | |
| 344 | 344 | |
| 345 | 345 | static READ8_HANDLER( kick_ip1_r ) |
| 346 | 346 | { |
| 347 | return ( | |
| 347 | return ( | |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | |
| r2375 | r2376 | |
| 364 | 364 | static READ8_HANDLER( wacko_ip1_r ) |
| 365 | 365 | { |
| 366 | 366 | if (!input_mux) |
| 367 | return | |
| 367 | return | |
| 368 | 368 | else |
| 369 | return | |
| 369 | return | |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | |
| 373 | 373 | static READ8_HANDLER( wacko_ip2_r ) |
| 374 | 374 | { |
| 375 | 375 | if (!input_mux) |
| 376 | return | |
| 376 | return | |
| 377 | 377 | else |
| 378 | return | |
| 378 | return | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | |
| r2375 | r2376 | |
| 388 | 388 | |
| 389 | 389 | static READ8_HANDLER( kroozr_ip1_r ) |
| 390 | 390 | { |
| 391 | int dial = | |
| 391 | int dial = | |
| 392 | 392 | return ((dial & 0x80) >> 1) | ((dial & 0x70) >> 4); |
| 393 | 393 | } |
| 394 | 394 | |
| r2375 | r2376 | |
| 581 | 581 | |
| 582 | 582 | static READ8_HANDLER( demoderb_ip1_r ) |
| 583 | 583 | { |
| 584 | return | |
| 584 | return | |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | |
| 588 | 588 | static READ8_HANDLER( demoderb_ip2_r ) |
| 589 | 589 | { |
| 590 | return | |
| 590 | return | |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 |
| r2375 | r2376 | |
|---|---|---|
| 192 | 192 | |
| 193 | 193 | static READ8_HANDLER( controller_r ) |
| 194 | 194 | { |
| 195 | return | |
| 195 | return | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 |
| r2375 | r2376 | |
|---|---|---|
| 927 | 927 | ROM_LOAD( "c07-12.107", 0x00000, 0x80000, CRC(e0b71258) SHA1(0258e308b643d723475824752ebffc4ea29d1ac4) ) |
| 928 | 928 | ROM_END |
| 929 | 929 | |
| 930 | static STATE_POSTLOAD( ninjaw_postload ) | |
| 931 | { | |
| 932 | parse_control(); | |
| 933 | reset_sound_region(); | |
| 934 | } | |
| 930 | 935 | |
| 931 | 936 | static MACHINE_START( ninjaw ) |
| 932 | 937 | { |
| 933 | 938 | cpua_ctrl = 0xff; |
| 934 | 939 | state_save_register_global(cpua_ctrl); |
| 935 | state_save_register_func_postload(parse_control); | |
| 936 | ||
| 937 | 940 | state_save_register_global(banknum); |
| 938 | state_save_register_ | |
| 941 | state_save_register_ | |
| 939 | 942 | } |
| 940 | 943 | |
| 941 | 944 | static MACHINE_RESET( ninjaw ) |
| r2375 | r2376 | |
|---|---|---|
| 18 | 18 | 2600-27ff Background attribute RAM #2 |
| 19 | 19 | 4000-ffff ROM |
| 20 | 20 | |
| 21 | ||
| 22 | 2008.04.04: Small note regarding DipSwitches. Locations and values have been | |
| 23 | verified with the manual for both Mat Mania and Mania Challenge. | |
| 24 | Exciting Hour DIPs confirmed with crazykong diplist, no manual available ATM. | |
| 25 | Notice that the manual for Mat Mania lists DSW2:3,4 as Unused, but they | |
| 26 | correctly affect the timer speed during the game. Also, default difficulty | |
| 27 | in Mat Mania is Normal, while manual for Mania Challenge reports Easy. | |
| 28 | The driver has been updated accordingly. | |
| 29 | ||
| 21 | 30 | ***************************************************************************/ |
| 22 | 31 | |
| 23 | 32 | #include "driver.h" |
| r2375 | r2376 | |
| 82 | 91 | AM_RANGE(0x0000, 0x077f) AM_READ(SMH_RAM) |
| 83 | 92 | AM_RANGE(0x1000, 0x17ff) AM_READ(SMH_RAM) |
| 84 | 93 | AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM) |
| 85 | AM_RANGE(0x3000, 0x3000) AM_READ(input_port_0_r) | |
| 86 | AM_RANGE(0x3010, 0x3010) AM_READ(input_port_1_r) | |
| 87 | AM_RANGE(0x3020, 0x3020) AM_READ(input_port_2_r) | |
| 88 | AM_RANGE(0x3030, 0x3030) AM_READ(input_port_3_r) | |
| 94 | AM_RANGE(0x3000, 0x3000) AM_READ_PORT("IN0") | |
| 95 | AM_RANGE(0x3010, 0x3010) AM_READ_PORT("IN1") | |
| 96 | AM_RANGE(0x3020, 0x3020) AM_READ_PORT("DSW2") | |
| 97 | AM_RANGE(0x3030, 0x3030) AM_READ_PORT("DSW1") | |
| 89 | 98 | AM_RANGE(0x4000, 0xffff) AM_READ(SMH_ROM) |
| 90 | 99 | ADDRESS_MAP_END |
| 91 | 100 | |
| r2375 | r2376 | |
| 110 | 119 | AM_RANGE(0x0000, 0x077f) AM_READ(SMH_RAM) |
| 111 | 120 | AM_RANGE(0x1000, 0x17ff) AM_READ(SMH_RAM) |
| 112 | 121 | AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM) |
| 113 | AM_RANGE(0x3000, 0x3000) AM_READ(input_port_0_r) | |
| 114 | AM_RANGE(0x3010, 0x3010) AM_READ(input_port_1_r) | |
| 115 | AM_RANGE(0x3020, 0x3020) AM_READ(input_port_2_r) | |
| 116 | AM_RANGE(0x3030, 0x3030) AM_READ(input_port_3_r) | |
| 122 | AM_RANGE(0x3000, 0x3000) AM_READ_PORT("IN0") | |
| 123 | AM_RANGE(0x3010, 0x3010) AM_READ_PORT("IN1") | |
| 124 | AM_RANGE(0x3020, 0x3020) AM_READ_PORT("DSW2") | |
| 125 | AM_RANGE(0x3030, 0x3030) AM_READ_PORT("DSW1") | |
| 117 | 126 | AM_RANGE(0x3040, 0x3040) AM_READ(maniach_mcu_r) |
| 118 | 127 | AM_RANGE(0x3041, 0x3041) AM_READ(maniach_mcu_status_r) |
| 119 | 128 | AM_RANGE(0x4000, 0xffff) AM_READ(SMH_ROM) |
| r2375 | r2376 | |
| 191 | 200 | |
| 192 | 201 | |
| 193 | 202 | static INPUT_PORTS_START( matmania ) |
| 194 | PORT_START | |
| 203 | PORT_START_TAG("IN0") | |
| 195 | 204 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY |
| 196 | 205 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| 197 | 206 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| r2375 | r2376 | |
| 201 | 210 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) |
| 202 | 211 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) |
| 203 | 212 | |
| 204 | PORT_START | |
| 213 | PORT_START_TAG("IN1") | |
| 205 | 214 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) |
| 206 | 215 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| 207 | 216 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) |
| r2375 | r2376 | |
| 211 | 220 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) |
| 212 | 221 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 213 | 222 | |
| 214 | PORT_START /* DSW1 */ | |
| 215 | PORT_DIPNAME(0x03, 0x03, DEF_STR( Difficulty ) ) | |
| 216 | PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) | |
| 217 | PORT_DIPSETTING( 0x02, DEF_STR( Medium ) ) | |
| 218 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) | |
| 219 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) | |
| 220 | PORT_DIPNAME(0x0c, 0x0c, "Tournament Time" ) // Tournament time is always 3:00, but time per 1 second is shorter. | |
| 221 | PORT_DIPSETTING( 0x00, "2:12" ) | |
| 222 | PORT_DIPSETTING( 0x04, "2:24" ) | |
| 223 | PORT_DIPSETTING( 0x08, "2:30" ) | |
| 224 | PORT_DIPSETTING( 0x0c, "2:36" ) | |
| 225 | PORT_DIPNAME(0x10, 0x10, DEF_STR( Unused ) ) | |
| 226 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 227 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 228 | PORT_DIPNAME(0x20, 0x20, DEF_STR( Unused ) ) | |
| 229 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 230 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 231 | PORT_DIPNAME(0x40, 0x40, DEF_STR( Unused ) ) | |
| 232 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 233 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 234 | PORT_DIPNAME(0x80, 0x80, DEF_STR( Unused ) ) | |
| 235 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 236 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 237 | ||
| 238 | PORT_START /* DSW2 */ | |
| 239 | PORT_DIPNAME(0x03, 0x03, DEF_STR( Coin_A ) ) | |
| 223 | PORT_START_TAG("DSW1") | |
| 224 | PORT_DIPNAME(0x03, 0x03, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2") | |
| 240 | 225 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) |
| 241 | 226 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) |
| 242 | 227 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) |
| 243 | 228 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) ) |
| 244 | PORT_DIPNAME(0x0c, 0x0c, DEF_STR( Coin_B ) ) | |
| 229 | PORT_DIPNAME(0x0c, 0x0c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:3,4") | |
| 245 | 230 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) |
| 246 | 231 | PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) ) |
| 247 | 232 | PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) |
| 248 | 233 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) |
| 249 | PORT_DIPNAME(0x10, 0x10, DEF_STR( Demo_Sounds ) ) | |
| 234 | PORT_DIPNAME(0x10, 0x10, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:5") | |
| 250 | 235 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 251 | 236 | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) |
| 252 | PORT_DIPNAME(0x20, 0x00, DEF_STR( Cabinet ) ) // The default setting should be cocktail. | |
| 253 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 237 | PORT_DIPNAME(0x20, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:6") | |
| 238 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) /* The default setting should be cocktail. */ | |
| 254 | 239 | PORT_DIPSETTING( 0x20, DEF_STR( Cocktail ) ) |
| 255 | PORT_SERVICE( 0x40, IP_ACTIVE_LOW ) | |
| 256 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) | |
| 240 | PORT_SERVICE_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW1:7" ) | |
| 241 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) /* Listed as always ON among DIPs in the manual */ | |
| 242 | ||
| 243 | PORT_START_TAG("DSW2") | |
| 244 | PORT_DIPNAME(0x03, 0x02, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") | |
| 245 | PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) | |
| 246 | PORT_DIPSETTING( 0x02, DEF_STR( Medium ) ) /* According to the manual, default is Medium */ | |
| 247 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) | |
| 248 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) | |
| 249 | PORT_DIPNAME(0x0c, 0x0c, "Tournament Time" ) PORT_DIPLOCATION("SW2:3,4") | |
| 250 | PORT_DIPSETTING( 0x00, "2:12" ) /* Tournament time is always 3:00, but time per 1 second is shorter. */ | |
| 251 | PORT_DIPSETTING( 0x04, "2:24" ) | |
| 252 | PORT_DIPSETTING( 0x08, "2:30" ) | |
| 253 | PORT_DIPSETTING( 0x0c, "2:36" ) | |
| 254 | PORT_DIPUNUSED_DIPLOC(0x10, IP_ACTIVE_LOW, "SW2:5") /* Listed as Unused */ | |
| 255 | PORT_DIPUNUSED_DIPLOC(0x20, IP_ACTIVE_LOW, "SW2:6") /* Listed as Unused */ | |
| 256 | PORT_DIPUNUSED_DIPLOC(0x40, IP_ACTIVE_LOW, "SW2:7") /* Listed as Unused */ | |
| 257 | PORT_DIPUNUSED_DIPLOC(0x80, IP_ACTIVE_LOW, "SW2:8") /* Listed as Unused */ | |
| 257 | 258 | INPUT_PORTS_END |
| 258 | 259 | |
| 260 | static INPUT_PORTS_START( maniach ) | |
| 261 | PORT_INCLUDE( matmania ) | |
| 262 | ||
| 263 | PORT_MODIFY("DSW2") | |
| 264 | PORT_DIPNAME(0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") | |
| 265 | PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) /* According to the manual, default for this game is Easy */ | |
| 266 | PORT_DIPSETTING( 0x02, DEF_STR( Medium ) ) | |
| 267 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) | |
| 268 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) | |
| 269 | INPUT_PORTS_END | |
| 270 | ||
| 271 | ||
| 259 | 272 | static const gfx_layout charlayout = |
| 260 | 273 | { |
| 261 | 274 | 8,8, /* 8*8 characters */ |
| r2375 | r2376 | |
| 660 | 673 | |
| 661 | 674 | |
| 662 | 675 | GAME( 1985, matmania, 0, matmania, matmania, 0, ROT270, "Technos (Taito America license)", "Mat Mania", 0 ) |
| 663 | GAME( 1985, excthour, matmania, matmania, matmania, 0, ROT270, "Technos (Taito license)", "Exciting Hour", 0 ) | |
| 664 | GAME( 1986, maniach, 0, maniach, matmania, 0, ROT270, "Technos (Taito America license)", "Mania Challenge (set 1)", 0 ) | |
| 665 | GAME( 1986, maniach2, maniach, maniach, matmania, 0, ROT270, "Technos (Taito America license)", "Mania Challenge (set 2)" , 0) /* earlier version? */ | |
| 676 | GAME( 1985, excthour, matmania, matmania, maniach, 0, ROT270, "Technos (Taito license)", "Exciting Hour", 0 ) | |
| 677 | GAME( 1986, maniach, 0, maniach, maniach, 0, ROT270, "Technos (Taito America license)", "Mania Challenge (set 1)", 0 ) | |
| 678 | GAME( 1986, maniach2, maniach, maniach, maniach, 0, ROT270, "Technos (Taito America license)", "Mania Challenge (set 2)" , 0) /* earlier version? */ |
| r2375 | r2376 | |
|---|---|---|
| 71 | 71 | extern VIDEO_EOF( twin16 ); |
| 72 | 72 | extern VIDEO_UPDATE( vulcan ); |
| 73 | 73 | |
| 74 | ||
| 74 | 75 | extern void twin16_spriteram_process( void ); |
| 75 | 76 | |
| 76 | 77 | UINT16 twin16_custom_video; |
| r2375 | r2376 | |
| 218 | 219 | { |
| 219 | 220 | switch( offset ) |
| 220 | 221 | { |
| 221 | case 0x00: return readinputport(0); // coin | |
| 222 | case 0x01: return readinputport(1); // p1 | |
| 223 | case 0x02: return readinputport(2); // p2 | |
| 224 | case 0x03: return readinputport(3); // p3 (Dark Adventure) | |
| 225 | case 0x08: return readinputport(5); // DSW1 | |
| 226 | case 0x09: return readinputport(4); // DSW2 | |
| 227 | case 0x0c: return readinputport(6); // DSW3 | |
| 222 | case 0x00: return input_port_read_indexed(machine, 0); // coin | |
| 223 | case 0x01: return input_port_read_indexed(machine, 1); // p1 | |
| 224 | case 0x02: return input_port_read_indexed(machine, 2); // p2 | |
| 225 | case 0x03: return input_port_read_indexed(machine, 3); // p3 (Dark Adventure) | |
| 226 | case 0x08: return input_port_read_indexed(machine, 5); // DSW1 | |
| 227 | case 0x09: return input_port_read_indexed(machine, 4); // DSW2 | |
| 228 | case 0x0c: return input_port_read_indexed(machine, 6); // DSW3 | |
| 228 | 229 | } |
| 229 | 230 | return 0; |
| 230 | 231 | } |
| r2375 | r2376 | |
| 958 | 959 | /* audio CPU */ |
| 959 | 960 | MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound) |
| 960 | 961 | |
| 961 | MDRV_CPU_ADD(M68000, 1 | |
| 962 | MDRV_CPU_ADD(M68000, XTAL_18_432MHz/2) | |
| 962 | 963 | MDRV_CPU_PROGRAM_MAP(readmem_sub,writemem_sub) |
| 963 | 964 | MDRV_CPU_VBLANK_INT("main", CPUB_interrupt) |
| 964 | 965 | |
| 965 | MDRV_CPU_ADD(M68000, 1 | |
| 966 | MDRV_CPU_ADD(M68000, XTAL_18_432MHz/2) | |
| 966 | 967 | MDRV_CPU_PROGRAM_MAP(readmem,writemem) |
| 967 | 968 | MDRV_CPU_VBLANK_INT("main", CPUA_interrupt) |
| 968 | 969 | |
| r2375 | r2376 | |
| 972 | 973 | MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM) |
| 973 | 974 | |
| 974 | 975 | MDRV_SCREEN_ADD("main", RASTER) |
| 975 | MDRV_SCREEN_REFRESH_RATE(6 | |
| 976 | MDRV_SCREEN_REFRESH_RATE(((double)XTAL_18_432MHz / 2) / (576 * 264)) | |
| 976 | 977 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) |
| 977 | 978 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 978 | 979 | MDRV_SCREEN_SIZE(40*8, 32*8) |
| r2375 | r2376 | |
| 1069 | 1070 | MDRV_SCREEN_MODIFY("main") |
| 1070 | 1071 | MDRV_SCREEN_VISIBLE_AREA(1*8, 39*8-1, 2*8, 30*8-1) |
| 1071 | 1072 | MDRV_VIDEO_START(fround) |
| 1073 | ||
| 1072 | 1074 | MACHINE_DRIVER_END |
| 1073 | 1075 | |
| 1074 | 1076 | static MACHINE_DRIVER_START( vulcan ) |
| r2375 | r2376 | |
|---|---|---|
| 175 | 175 | [ Main CPU - System A / Z ] |
| 176 | 176 | ***************************************************************************/ |
| 177 | 177 | |
| 178 | static READ16_HANDLER( coins_r ) {return readinputport(0);} // < 00 | Coins > | |
| 179 | static READ16_HANDLER( player1_r ) {return readinputport(1);} // < 00 | Player 1 > | |
| 180 | static READ16_HANDLER( player2_r ) {return readinputport(2) * 256 + | |
| 181 | readinputport(3);} // < Reserve | Player 2 > | |
| 182 | static READ16_HANDLER( dsw1_r ) {return readinputport(4);} // DSW 1 | |
| 183 | static READ16_HANDLER( dsw2_r ) {return readinputport(5);} // DSW 2 | |
| 184 | static READ16_HANDLER( dsw_r ) {return readinputport(4) * 256 + | |
| 185 | readinputport(5);} // < DSW 1 | DSW 2 > | |
| 178 | static READ16_HANDLER( coins_r ) {return input_port_read_indexed(machine, 0);} // < 00 | Coins > | |
| 179 | static READ16_HANDLER( player1_r ) {return input_port_read_indexed(machine, 1);} // < 00 | Player 1 > | |
| 180 | static READ16_HANDLER( player2_r ) {return input_port_read_indexed(machine, 2) * 256 + | |
| 181 | input_port_read_indexed(machine, 3);} // < Reserve | Player 2 > | |
| 182 | static READ16_HANDLER( dsw1_r ) {return input_port_read_indexed(machine, 4);} // DSW 1 | |
| 183 | static READ16_HANDLER( dsw2_r ) {return input_port_read_indexed(machine, 5);} // DSW 2 | |
| 184 | static READ16_HANDLER( dsw_r ) {return input_port_read_indexed(machine, 4) * 256 + | |
| 185 | input_port_read_indexed(machine, 5);} // < DSW 1 | DSW 2 > | |
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | #define INTERRUPT_NUM_A 3 |
| r2375 | r2376 | |
|---|---|---|
| 173 | 173 | |
| 174 | 174 | static READ16_HANDLER( country_sndpending_r ) |
| 175 | 175 | { |
| 176 | return | |
| 176 | return | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | static WRITE8_HANDLER( pending_command_clear_w ) |
| r2375 | r2376 | |
|---|---|---|
| 56 | 56 | |
| 57 | 57 | static READ8_HANDLER( clshroad_input_r ) |
| 58 | 58 | { |
| 59 | return ((~readinputportbytag("IN0") & (1 << offset)) ? 1 : 0) | | |
| 60 | ((~readinputportbytag("IN1") & (1 << offset)) ? 2 : 0) | | |
| 61 | ((~readinputportbytag("DSW1") & (1 << offset)) ? 4 : 0) | | |
| 62 | ((~readinputportbytag("DSW2") & (1 << offset)) ? 8 : 0) ; | |
| 59 | return ((~input_port_read(machine, "IN0") & (1 << offset)) ? 1 : 0) | | |
| 60 | ((~input_port_read(machine, "IN1") & (1 << offset)) ? 2 : 0) | | |
| 61 | ((~input_port_read(machine, "DSW1") & (1 << offset)) ? 4 : 0) | | |
| 62 | ((~input_port_read(machine, "DSW2") & (1 << offset)) ? 8 : 0) ; | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 |
| r2375 | r2376 | |
|---|---|---|
| 368 | 368 | static MACHINE_RESET( mschamp ) |
| 369 | 369 | { |
| 370 | 370 | UINT8 *rom = memory_region(REGION_CPU1) + 0x10000; |
| 371 | int whichbank = | |
| 371 | int whichbank = | |
| 372 | 372 | |
| 373 | 373 | memory_configure_bank(1, 0, 2, &rom[0x0000], 0x8000); |
| 374 | 374 | memory_configure_bank(2, 0, 2, &rom[0x4000], 0x8000); |
| r2375 | r2376 | |
| 405 | 405 | int portnum = port_tag_to_index("FAKE"); |
| 406 | 406 | if (portnum != -1) |
| 407 | 407 | { |
| 408 | UINT8 value = | |
| 408 | UINT8 value = | |
| 409 | 409 | if ((value & 7) == 5 || (value & 6) == 2) |
| 410 | 410 | irq0_line_hold(machine, cpunum); |
| 411 | 411 | } |
| r2375 | r2376 | |
|---|---|---|
| 128 | 128 | |
| 129 | 129 | static READ16_HANDLER( port_0_r ) |
| 130 | 130 | { |
| 131 | return ( | |
| 131 | return ( | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | static READ16_HANDLER( port_2_r ) |
| 136 | 136 | { |
| 137 | return ( | |
| 137 | return ( | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 |
| r2375 | r2376 | |
|---|---|---|
| 125 | 125 | static int accel, wheel; |
| 126 | 126 | |
| 127 | 127 | switch (analog_ctrl & 0x03){ |
| 128 | case 0x00: return (accel = readinputport(5)); /* accelerator */ | |
| 129 | case 0x01: return (wheel = readinputport(6)); /* steering */ | |
| 128 | case 0x00: return (accel = input_port_read_indexed(machine, 5)); /* accelerator */ | |
| 129 | case 0x01: return (wheel = input_port_read_indexed(machine, 6)); /* steering */ | |
| 130 | 130 | case 0x02: return accel; /* accelerator (previous?) */ |
| 131 | 131 | case 0x03: return wheel; /* steering (previous?) */ |
| 132 | 132 | } |
| r2375 | r2376 | |
|---|---|---|
| 78 | 78 | break; |
| 79 | 79 | |
| 80 | 80 | case 1: |
| 81 | if (~ | |
| 81 | if (~ | |
| 82 | 82 | { if (!coin) { coin = 1; cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE); } } |
| 83 | 83 | else |
| 84 | 84 | coin = 0; |
| 85 | 85 | break; |
| 86 | 86 | |
| 87 | 87 | case 2: |
| 88 | if ( | |
| 88 | if ( | |
| 89 | 89 | break; |
| 90 | 90 | } |
| 91 | 91 | } |
| r2375 | r2376 | |
| 104 | 104 | |
| 105 | 105 | static READ8_HANDLER( bwp1_io_r ) |
| 106 | 106 | { |
| 107 | if (offset == 0) return(readinputport(0)); | |
| 108 | if (offset == 1) return(readinputport(1)); | |
| 109 | if (offset == 2) return(readinputport(2)); | |
| 110 | if (offset == 3) return(readinputport(3)); | |
| 111 | if (offset == 4) return(readinputport(4)); | |
| 107 | if (offset == 0) return(input_port_read_indexed(machine, 0)); | |
| 108 | if (offset == 1) return(input_port_read_indexed(machine, 1)); | |
| 109 | if (offset == 2) return(input_port_read_indexed(machine, 2)); | |
| 110 | if (offset == 3) return(input_port_read_indexed(machine, 3)); | |
| 111 | if (offset == 4) return(input_port_read_indexed(machine, 4)); | |
| 112 | 112 | |
| 113 | 113 | return((bwp123_membase[0])[0x1b00 + offset]); |
| 114 | 114 | } |
| r2375 | r2376 | |
|---|---|---|
| 348 | 348 | static READ16_HANDLER( srmp6_inputs_r ) |
| 349 | 349 | { |
| 350 | 350 | if (offset == 0) // DSW |
| 351 | return | |
| 351 | return | |
| 352 | 352 | |
| 353 | 353 | switch(srmp6_input_select) // inputs |
| 354 | 354 | { |
| 355 | case 1<<0: return readinputport(0); | |
| 356 | case 1<<1: return readinputport(1); | |
| 357 | case 1<<2: return readinputport(2); | |
| 358 | case 1<<3: return readinputport(3); | |
| 355 | case 1<<0: return input_port_read_indexed(machine, 0); | |
| 356 | case 1<<1: return input_port_read_indexed(machine, 1); | |
| 357 | case 1<<2: return input_port_read_indexed(machine, 2); | |
| 358 | case 1<<3: return input_port_read_indexed(machine, 3); | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | return 0; |
| r2375 | r2376 | |
|---|---|---|
| 124 | 124 | program_write_word(0xffc00e, 0); |
| 125 | 125 | |
| 126 | 126 | sf_fg_scroll_w(machine, 0, d1, 0); |
| 127 | sf_ | |
| 127 | sf_bg_scroll_w(machine, 0, d2, 0); | |
| 128 | 128 | break; |
| 129 | 129 | } |
| 130 | 130 | case 4: |
| r2375 | r2376 | |
| 144 | 144 | } |
| 145 | 145 | program_write_word(0xffc682, d1); |
| 146 | 146 | program_write_word(0xffc00e, off); |
| 147 | sf_ | |
| 147 | sf_bg_scroll_w(machine, 0, d1, 0); | |
| 148 | 148 | } |
| 149 | 149 | break; |
| 150 | 150 | } |
| r2375 | r2376 | |
| 166 | 166 | |
| 167 | 167 | static READ16_HANDLER( button1_r ) |
| 168 | 168 | { |
| 169 | return (scale[input_port_ | |
| 169 | return (scale[input_port_ | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | static READ16_HANDLER( button2_r ) |
| 173 | 173 | { |
| 174 | return (scale[input_port_ | |
| 174 | return (scale[input_port_ | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 |
| r2375 | r2376 | |
|---|---|---|
| 67 | 67 | { |
| 68 | 68 | switch(sengokumj_mux_data) |
| 69 | 69 | { |
| 70 | case 1: return readinputport(2); | |
| 71 | case 2: return readinputport(3); | |
| 72 | case 4: return readinputport(4); | |
| 73 | case 8: return readinputport(5); | |
| 74 | case 0x10: return readinputport(6); | |
| 75 | case 0x20: return readinputport(7); | |
| 70 | case 1: return input_port_read_indexed(machine, 2); | |
| 71 | case 2: return input_port_read_indexed(machine, 3); | |
| 72 | case 4: return input_port_read_indexed(machine, 4); | |
| 73 | case 8: return input_port_read_indexed(machine, 5); | |
| 74 | case 0x10: return input_port_read_indexed(machine, 6); | |
| 75 | case 0x20: return input_port_read_indexed(machine, 7); | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return 0xffff; |
| r2375 | r2376 | |
|---|---|---|
| 106 | 106 | in_0_shift = 0; |
| 107 | 107 | in_1_shift = 0; |
| 108 | 108 | |
| 109 | in_0 = readinputport(0); | |
| 110 | in_1 = readinputport(1); | |
| 109 | in_0 = input_port_read_indexed(machine, 0); | |
| 110 | in_1 = input_port_read_indexed(machine, 1); | |
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 |
| r2375 | r2376 | |
|---|---|---|
| 311 | 311 | |
| 312 | 312 | static READ16_HANDLER( cave_input1_r ) |
| 313 | 313 | { |
| 314 | return | |
| 314 | return | |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | static READ16_HANDLER( guwange_input1_r ) |
| 318 | 318 | { |
| 319 | return | |
| 319 | return | |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | static READ16_HANDLER( gaia_dsw_r ) |
| 323 | 323 | { |
| 324 | return | |
| 324 | return | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | static WRITE16_HANDLER( cave_eeprom_msb_w ) |
| r2375 | r2376 | |
| 870 | 870 | |
| 871 | 871 | static READ16_HANDLER( korokoro_input0_r ) |
| 872 | 872 | { |
| 873 | return | |
| 873 | return | |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | 876 | static READ16_HANDLER( korokoro_input1_r ) |
| 877 | 877 | { |
| 878 | return | |
| 878 | return | |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | static ADDRESS_MAP_START( korokoro_readmem, ADDRESS_SPACE_PROGRAM, 16 ) |
| r2375 | r2376 | |
| 1077 | 1077 | static READ16_HANDLER( sailormn_input0_r ) |
| 1078 | 1078 | { |
| 1079 | 1079 | // watchdog_reset16_r(0,0); // written too rarely for mame. |
| 1080 | return | |
| 1080 | return | |
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | 1083 | static READ16_HANDLER( agallet_irq_cause_r ) |
| r2375 | r2376 | |
| 1984 | 1984 | /* modify the eeprom on a reset with the desired region for the games that have the |
| 1985 | 1985 | region factory set in eeprom */ |
| 1986 | 1986 | if (cave_region_byte >= 0) |
| 1987 | EEPROM_get_data_pointer(0)[cave_region_byte] = | |
| 1987 | EEPROM_get_data_pointer(0)[cave_region_byte] = | |
| 1988 | 1988 | } |
| 1989 | 1989 | |
| 1990 | 1990 | static const struct YMZ280Binterface ymz280b_intf = |
| r2375 | r2376 | |
|---|---|---|
| 224 | 224 | \ |
| 225 | 225 | static READ32_HANDLER( io32_##_N_##_r ) \ |
| 226 | 226 | { \ |
| 227 | return ( | |
| 227 | return ( | |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | FUUKI32_INPUT( 0 ) /* $800000.l Coins Inputs */ |
| r2375 | r2376 | |
|---|---|---|
| 119 | 119 | { |
| 120 | 120 | switch (offset) { |
| 121 | 121 | case 0: /* Rotary low byte */ |
| 122 | return ~((1 << ( | |
| 122 | return ~((1 << ( | |
| 123 | 123 | case 1: /* Joystick = bottom 4 bits, rotary = top 4 */ |
| 124 | return ((~((1 << ( | |
| 124 | return ((~((1 << ( | |
| 125 | 125 | } |
| 126 | 126 | return 0xff; |
| 127 | 127 | } |
| r2375 | r2376 | |
| 130 | 130 | { |
| 131 | 131 | switch (offset) { |
| 132 | 132 | case 0: /* Rotary low byte */ |
| 133 | return ~((1 << ( | |
| 133 | return ~((1 << ( | |
| 134 | 134 | case 1: /* Joystick = bottom 4 bits, rotary = top 4 */ |
| 135 | return ((~((1 << ( | |
| 135 | return ((~((1 << ( | |
| 136 | 136 | } |
| 137 | 137 | return 0xff; |
| 138 | 138 | } |
| r2375 | r2376 | |
| 178 | 178 | if (i8751_value==0x5000) i8751_return=((coins / 10) << 4) | (coins % 10); /* Coin request */ |
| 179 | 179 | if (i8751_value==0x6000) {i8751_value=-1; coins--; } /* Coin clear */ |
| 180 | 180 | /* Nb: Command 0x4000 for setting coinage options is not supported */ |
| 181 | if ((readinputport(4)&1)==1) latch=1; | |
| 182 | if ((readinputport(4)&1)!=1 && latch) {coins++; latch=0;} | |
| 181 | if ((input_port_read_indexed(machine, 4)&1)==1) latch=1; | |
| 182 | if ((input_port_read_indexed(machine, 4)&1)!=1 && latch) {coins++; latch=0;} | |
| 183 | 183 | |
| 184 | 184 | /* This next value is the index to a series of tables, |
| 185 | 185 | each table controls the end of level bad guy, wrong values crash the |
| r2375 | r2376 | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /* Coins are controlled by the i8751 */ |
| 249 | if ((readinputport(4)&3)==3) latch=1; | |
| 250 | if ((readinputport(4)&1)!=1 && latch) {coin1++; snd=1; latch=0;} | |
| 251 | if ((readinputport(4)&2)!=2 && latch) {coin2++; snd=1; latch=0;} | |
| 249 | if ((input_port_read_indexed(machine, 4)&3)==3) latch=1; | |
| 250 | if ((input_port_read_indexed(machine, 4)&1)!=1 && latch) {coin1++; snd=1; latch=0;} | |
| 251 | if ((input_port_read_indexed(machine, 4)&2)!=2 && latch) {coin2++; snd=1; latch=0;} | |
| 252 | 252 | |
| 253 | 253 | /* Work out return values */ |
| 254 | 254 | if (i8751_value==0x0000) {i8751_return=0; coin1=coin2=snd=0;} |
| r2375 | r2376 | |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /* Coins are controlled by the i8751 */ |
| 282 | if (/*(readinputport(2)&3)==3*/!latch) {latch=1;coin1=coin2=0;} | |
| 283 | if ((readinputport(2)&1)!=1 && latch) {coin1=1; latch=0;} | |
| 284 | if ((readinputport(2)&2)!=2 && latch) {coin2=1; latch=0;} | |
| 282 | if (/*(input_port_read_indexed(machine, 2)&3)==3*/!latch) {latch=1;coin1=coin2=0;} | |
| 283 | if ((input_port_read_indexed(machine, 2)&1)!=1 && latch) {coin1=1; latch=0;} | |
| 284 | if ((input_port_read_indexed(machine, 2)&2)!=2 && latch) {coin2=1; latch=0;} | |
| 285 | 285 | |
| 286 | 286 | if (i8751_value==0x0050) i8751_return=0; /* Breywood ID */ |
| 287 | 287 | if (i8751_value==0x0051) i8751_return=0; /* Shackled ID */ |
| r2375 | r2376 | |
| 309 | 309 | if(offset==0) |
| 310 | 310 | { |
| 311 | 311 | /* Coins are controlled by the i8751 */ |
| 312 | if ((readinputport(2)&3)==3 && !latch) latch=1; | |
| 313 | if ((readinputport(2)&3)!=3 && latch) {coin++; latch=0;snd=0x400;i8751_return=0x400;return;} | |
| 312 | if ((input_port_read_indexed(machine, 2)&3)==3 && !latch) latch=1; | |
| 313 | if ((input_port_read_indexed(machine, 2)&3)!=3 && latch) {coin++; latch=0;snd=0x400;i8751_return=0x400;return;} | |
| 314 | 314 | if (i8751_value==0x007a) i8751_return=0x0185; /* Japan ID code */ |
| 315 | 315 | if (i8751_value==0x007b) i8751_return=0x0184; /* USA ID code */ |
| 316 | 316 | if (i8751_value==0x0001) {coin=snd=0;}//??? |
| r2375 | r2376 | |
| 340 | 340 | if(offset==0) |
| 341 | 341 | { |
| 342 | 342 | /* Coins are controlled by the i8751 */ |
| 343 | if ((readinputport(2)&3)==3 && !latch) latch=1; | |
| 344 | if ((readinputport(2)&3)!=3 && latch) {coin++; latch=0;snd=0x1200; i8751_return=0x1200;return;} | |
| 343 | if ((input_port_read_indexed(machine, 2)&3)==3 && !latch) latch=1; | |
| 344 | if ((input_port_read_indexed(machine, 2)&3)!=3 && latch) {coin++; latch=0;snd=0x1200; i8751_return=0x1200;return;} | |
| 345 | 345 | |
| 346 | 346 | if (i8751_value==0x054a) {i8751_return=~(0x4a); coin=0; snd=0;} /* Captain Silver (Japan) ID */ |
| 347 | 347 | if (i8751_value==0x054c) {i8751_return=~(0x4c); coin=0; snd=0;} /* Captain Silver (World) ID */ |
| r2375 | r2376 | |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | /* Coins are controlled by the i8751 */ |
| 369 | if ((readinputport(2)&3)==3) latch=1; | |
| 370 | if ((readinputport(2)&1)!=1 && latch) {coin1++; latch=0;} | |
| 371 | if ((readinputport(2)&2)!=2 && latch) {coin2++; latch=0;} | |
| 369 | if ((input_port_read_indexed(machine, 2)&3)==3) latch=1; | |
| 370 | if ((input_port_read_indexed(machine, 2)&1)!=1 && latch) {coin1++; latch=0;} | |
| 371 | if ((input_port_read_indexed(machine, 2)&2)!=2 && latch) {coin2++; latch=0;} | |
| 372 | 372 | |
| 373 | 373 | /* Work out return values */ |
| 374 | 374 | if ((i8751_value>>8)==0x00) {i8751_return=0; coin1=coin2=0;} |
| r2375 | r2376 | |
| 2046 | 2046 | static INTERRUPT_GEN( ghostb_interrupt ) |
| 2047 | 2047 | { |
| 2048 | 2048 | static int latch[4]; |
| 2049 | int i8751_out= | |
| 2049 | int i8751_out= | |
| 2050 | 2050 | |
| 2051 | 2051 | /* Ghostbusters coins are controlled by the i8751 */ |
| 2052 | 2052 | if ((i8751_out & 0x8) == 0x8) latch[0]=1; |
| r2375 | r2376 | |
| 2073 | 2073 | { |
| 2074 | 2074 | static int latch=1; |
| 2075 | 2075 | |
| 2076 | if ((readinputport(2) & 0x7) == 0x7) latch=1; | |
| 2077 | if (latch && (readinputport(2) & 0x7) != 0x7) { | |
| 2076 | if ((input_port_read_indexed(machine, 2) & 0x7) == 0x7) latch=1; | |
| 2077 | if (latch && (input_port_read_indexed(machine, 2) & 0x7) != 0x7) { | |
| 2078 | 2078 | latch=0; |
| 2079 | 2079 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 2080 | 2080 | } |
| r2375 | r2376 | |
|---|---|---|
| 106 | 106 | |
| 107 | 107 | static READ32_HANDLER( inputs_01_r ) |
| 108 | 108 | { |
| 109 | return ( | |
| 109 | return ( | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | static READ32_HANDLER( special_port2_r ) |
| 114 | 114 | { |
| 115 | int temp = | |
| 115 | int temp = | |
| 116 | 116 | temp ^= 0x0001; /* /A2DRDY always high for now */ |
| 117 | 117 | temp ^= 0x0008; /* A2D.EOC always high for now */ |
| 118 | 118 | return (temp << 16) | temp; |
| r2375 | r2376 | |
| 121 | 121 | |
| 122 | 122 | static READ32_HANDLER( special_port3_r ) |
| 123 | 123 | { |
| 124 | int temp = | |
| 124 | int temp = | |
| 125 | 125 | if (atarigen_video_int_state) temp ^= 0x0001; |
| 126 | 126 | if (atarigen_scanline_int_state) temp ^= 0x0002; |
| 127 | 127 | return (temp << 16) | temp; |
| r2375 | r2376 | |
| 131 | 131 | #if (HACK_TMEK_CONTROLS) |
| 132 | 132 | INLINE void compute_fake_pots(int *pots) |
| 133 | 133 | { |
| 134 | int fake = | |
| 134 | int fake = | |
| 135 | 135 | |
| 136 | 136 | pots[0] = pots[1] = pots[2] = pots[3] = 0x80; |
| 137 | 137 | |
| r2375 | r2376 | |
| 168 | 168 | compute_fake_pots(pots); |
| 169 | 169 | return (pots[0] << 24) | (pots[3] << 8); |
| 170 | 170 | #else |
| 171 | return ( | |
| 171 | return ( | |
| 172 | 172 | #endif |
| 173 | 173 | } |
| 174 | 174 | |
| r2375 | r2376 | |
| 180 | 180 | compute_fake_pots(pots); |
| 181 | 181 | return (pots[2] << 24) | (pots[1] << 8); |
| 182 | 182 | #else |
| 183 | return ( | |
| 183 | return ( | |
| 184 | 184 | #endif |
| 185 | 185 | } |
| 186 | 186 |
| r2375 | r2376 | |
|---|---|---|
| 54 | 54 | |
| 55 | 55 | static READ16_HANDLER( tourtabl_read_input_port ) |
| 56 | 56 | { |
| 57 | return | |
| 57 | return | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | static READ8_HANDLER( tourtabl_get_databus_contents ) |
| r2375 | r2376 | |
|---|---|---|
| 320 | 320 | { |
| 321 | 321 | offset &=0x1fff; |
| 322 | 322 | // if(offset == 0) |
| 323 | // return ( | |
| 323 | // return ( | |
| 324 | 324 | return (ic36_ram[offset] << 8) + ic36_ram[offset+1]; |
| 325 | 325 | } |
| 326 | 326 | |
| r2375 | r2376 | |
| 471 | 471 | |
| 472 | 472 | if (genesis_io_ram[offset] & 0x40) |
| 473 | 473 | { |
| 474 | int iport = | |
| 474 | int iport = | |
| 475 | 475 | return_value = iport & 0x3f; |
| 476 | 476 | } |
| 477 | 477 | else |
| 478 | 478 | { |
| 479 | int iport1 = readinputport(12); | |
| 480 | int iport2 = readinputport(7) >> 1; | |
| 479 | int iport1 = input_port_read_indexed(machine, 12); | |
| 480 | int iport2 = input_port_read_indexed(machine, 7) >> 1; | |
| 481 | 481 | return_value = (iport1 & 0x10) + (iport2 & 0x20); |
| 482 | 482 | if(iport1 & 0x10 || iport2 & 0x20) |
| 483 | 483 | return_value+=1; |
| r2375 | r2376 | |
| 492 | 492 | |
| 493 | 493 | if (genesis_io_ram[offset] & 0x40) |
| 494 | 494 | { |
| 495 | int iport1 = (readinputport(9) & 0xc0) >> 6; | |
| 496 | int iport2 = (readinputport(8) & 0x0f) << 2; | |
| 495 | int iport1 = (input_port_read_indexed(machine, 9) & 0xc0) >> 6; | |
| 496 | int iport2 = (input_port_read_indexed(machine, 8) & 0x0f) << 2; | |
| 497 | 497 | return_value = (iport1 + iport2) & 0x3f; |
| 498 | 498 | } |
| 499 | 499 | else |
| 500 | 500 | { |
| 501 | int iport1 = readinputport(12) << 2; | |
| 502 | int iport2 = readinputport(7) >> 2; | |
| 501 | int iport1 = input_port_read_indexed(machine, 12) << 2; | |
| 502 | int iport2 = input_port_read_indexed(machine, 7) >> 2; | |
| 503 | 503 | return_value = (iport1 & 0x10) + (iport2 & 0x20); |
| 504 | 504 | if(iport1 & 0x10 || iport2 & 0x20) |
| 505 | 505 | return_value+=1; |
| r2375 | r2376 | |
| 541 | 541 | case 1: /* port A data (joypad 1) */ |
| 542 | 542 | |
| 543 | 543 | if (genesis_io_ram[offset] & 0x40) |
| 544 | return_value = | |
| 544 | return_value = | |
| 545 | 545 | else |
| 546 | 546 | { |
| 547 | return_value = readinputport(2) & (genesis_io_ram[4]^0xff); | |
| 548 | return_value |= readinputport(1) & 0x03; | |
| 547 | return_value = input_port_read_indexed(machine, 2) & (genesis_io_ram[4]^0xff); | |
| 548 | return_value |= input_port_read_indexed(machine, 1) & 0x03; | |
| 549 | 549 | } |
| 550 | 550 | return_value = (genesis_io_ram[offset] & 0x80) | return_value; |
| 551 | 551 | // logerror ("reading joypad 1 , type %02x %02x\n",genesis_io_ram[offset] & 0xb0, return_value &0x7f); |
| r2375 | r2376 | |
| 554 | 554 | case 2: /* port B data (joypad 2) */ |
| 555 | 555 | |
| 556 | 556 | if (genesis_io_ram[offset] & 0x40) |
| 557 | return_value = | |
| 557 | return_value = | |
| 558 | 558 | else |
| 559 | 559 | { |
| 560 | return_value = readinputport(4) & (genesis_io_ram[5]^0xff); | |
| 561 | return_value |= readinputport(3) & 0x03; | |
| 560 | return_value = input_port_read_indexed(machine, 4) & (genesis_io_ram[5]^0xff); | |
| 561 | return_value |= input_port_read_indexed(machine, 3) & 0x03; | |
| 562 | 562 | } |
| 563 | 563 | return_value = (genesis_io_ram[offset] & 0x80) | return_value; |
| 564 | 564 | // logerror ("reading joypad 2 , type %02x %02x\n",genesis_io_ram[offset] & 0xb0, return_value &0x7f); |
| r2375 | r2376 | |
|---|---|---|
| 248 | 248 | |
| 249 | 249 | static READ8_HANDLER( leta_r ) |
| 250 | 250 | { |
| 251 | return | |
| 251 | return | |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 |
| r2375 | r2376 | |
|---|---|---|
| 165 | 165 | |
| 166 | 166 | static READ16_HANDLER( common_port_r ) |
| 167 | 167 | { |
| 168 | return | |
| 168 | return | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 |
| r2375 | r2376 | |
|---|---|---|
| 95 | 95 | |
| 96 | 96 | static READ8_HANDLER( changela_68705_portB_r ) |
| 97 | 97 | { |
| 98 | return (portB_out & ddrB) | ( | |
| 98 | return (portB_out & ddrB) | ( | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | static WRITE8_HANDLER( changela_68705_portB_w ) |
| r2375 | r2376 | |
| 177 | 177 | |
| 178 | 178 | static READ8_HANDLER( changela_30_r ) |
| 179 | 179 | { |
| 180 | return | |
| 180 | return | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | static READ8_HANDLER( changela_31_r ) |
| r2375 | r2376 | |
| 186 | 186 | or if the new value is greater than the old value, and it did wrap around, |
| 187 | 187 | then we are moving LEFT. */ |
| 188 | 188 | static UINT8 prev_value = 0; |
| 189 | UINT8 curr_value = | |
| 189 | UINT8 curr_value = | |
| 190 | 190 | static int dir = 0; |
| 191 | 191 | |
| 192 | 192 | if( (curr_value < prev_value && (prev_value - curr_value) < 0x80) |
| r2375 | r2376 | |
| 204 | 204 | |
| 205 | 205 | static READ8_HANDLER( changela_2c_r ) |
| 206 | 206 | { |
| 207 | int val = | |
| 207 | int val = | |
| 208 | 208 | |
| 209 | 209 | val = (val&0x30) | ((val&1)<<7) | (((val&1)^1)<<6); |
| 210 | 210 | |
| r2375 | r2376 | |
| 221 | 221 | v8 = 1; |
| 222 | 222 | |
| 223 | 223 | /* Gas pedal is made up of 2 switches, 1 active low, 1 active high */ |
| 224 | switch( | |
| 224 | switch( | |
| 225 | 225 | { |
| 226 | 226 | case 0x02: |
| 227 | 227 | gas = 0x80; |
| r2375 | r2376 | |
| 234 | 234 | break; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | return ( | |
| 237 | return ( | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | static WRITE8_HANDLER( mcu_PC0_w ) |
| r2375 | r2376 | |
|---|---|---|
| 448 | 448 | { |
| 449 | 449 | int rv; |
| 450 | 450 | |
| 451 | rv = ( | |
| 451 | rv = ( | |
| 452 | 452 | rv &= ~1; |
| 453 | 453 | rv |= EEPROM_read_bit(); // as per code at 4d932 |
| 454 | 454 | return rv; |
| r2375 | r2376 | |
| 458 | 458 | { |
| 459 | 459 | int rv; |
| 460 | 460 | |
| 461 | rv = ( | |
| 461 | rv = ( | |
| 462 | 462 | rv &= ~0x80; |
| 463 | 463 | rv |= (EEPROM_read_bit()<<7); // as per code at 778 |
| 464 | 464 | return rv; |
| r2375 | r2376 | |
|---|---|---|
| 76 | 76 | discrete_sound_w(machine, TRIPLHNT_LAMP_EN, triplhnt_misc_flags & 0x02); // Lamp is used to reset noise |
| 77 | 77 | discrete_sound_w(machine, TRIPLHNT_BEAR_EN, triplhnt_misc_flags & 0x80); // bear |
| 78 | 78 | |
| 79 | is_witch_hunt = | |
| 79 | is_witch_hunt = | |
| 80 | 80 | bit = ~triplhnt_misc_flags & 0x40; |
| 81 | 81 | |
| 82 | 82 | /* if we're not playing the sample yet, start it */ |
| r2375 | r2376 | |
| 108 | 108 | static READ8_HANDLER( triplhnt_input_port_4_r ) |
| 109 | 109 | { |
| 110 | 110 | watchdog_reset_w(machine, 0, 0); |
| 111 | return | |
| 111 | return | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | static READ8_HANDLER( triplhnt_misc_r ) |
| 116 | 116 | { |
| 117 | 117 | triplhnt_update_misc(machine, offset); |
| 118 | return | |
| 118 | return | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | static READ8_HANDLER( triplhnt_da_latch_r ) |
| 123 | 123 | { |
| 124 | int cross_x = readinputport(8); | |
| 125 | int cross_y = readinputport(9); | |
| 124 | int cross_x = input_port_read_indexed(machine, 8); | |
| 125 | int cross_y = input_port_read_indexed(machine, 9); | |
| 126 | 126 | |
| 127 | 127 | triplhnt_da_latch = offset; |
| 128 | 128 |
| r2375 | r2376 | |
|---|---|---|
| 231 | 231 | { |
| 232 | 232 | /* some kind of screen indicator? checked by backfira set before it will boot */ |
| 233 | 233 | int backfire_screen = mame_rand(Machine)&1; |
| 234 | return ((EEPROM_read_bit()<<24) | | |
| 234 | return ((EEPROM_read_bit()<<24) | | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | static READ32_HANDLER(backfire_control2_r) |
| 238 | 238 | { |
| 239 | 239 | // logerror("%08x:Read eprom %08x (%08x)\n",activecpu_get_pc(),offset<<1,mem_mask); |
| 240 | return (EEPROM_read_bit()<<24) | | |
| 240 | return (EEPROM_read_bit()<<24) | | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | #ifdef UNUSED_FUNCTION |
| 244 | 244 | static READ32_HANDLER(backfire_control3_r) |
| 245 | 245 | { |
| 246 | 246 | // logerror("%08x:Read eprom %08x (%08x)\n",activecpu_get_pc(),offset<<1,mem_mask); |
| 247 | return (EEPROM_read_bit()<<24) | | |
| 247 | return (EEPROM_read_bit()<<24) | | |
| 248 | 248 | } |
| 249 | 249 | #endif |
| 250 | 250 | |
| r2375 | r2376 | |
| 306 | 306 | #ifdef UNUSED_FUNCTION |
| 307 | 307 | READ32_HANDLER( backfire_unknown_wheel_r ) |
| 308 | 308 | { |
| 309 | return | |
| 309 | return | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | READ32_HANDLER( backfire_wheel1_r ) |
| r2375 | r2376 | |
|---|---|---|
| 58 | 58 | |
| 59 | 59 | static READ8_HANDLER( wolfpack_input_r ) |
| 60 | 60 | { |
| 61 | UINT8 val = | |
| 61 | UINT8 val = | |
| 62 | 62 | |
| 63 | if ((( | |
| 63 | if ((( | |
| 64 | 64 | { |
| 65 | 65 | val |= 1; |
| 66 | 66 | } |
| 67 | if ((( | |
| 67 | if ((( | |
| 68 | 68 | { |
| 69 | 69 | val |= 2; |
| 70 | 70 | } |
| r2375 | r2376 | |
|---|---|---|
| 81 | 81 | { |
| 82 | 82 | int val; |
| 83 | 83 | |
| 84 | val = | |
| 84 | val = | |
| 85 | 85 | return ((val << (7-offset)) & 0x80); |
| 86 | 86 | } |
| 87 | 87 | |
| r2375 | r2376 | |
| 89 | 89 | { |
| 90 | 90 | int val; |
| 91 | 91 | |
| 92 | val = | |
| 92 | val = | |
| 93 | 93 | return ((val << (7-offset)) & 0x80); |
| 94 | 94 | } |
| 95 | 95 | |
| r2375 | r2376 | |
| 97 | 97 | { |
| 98 | 98 | int val; |
| 99 | 99 | |
| 100 | val = | |
| 100 | val = | |
| 101 | 101 | return ((val << (7-offset)) & 0x80); |
| 102 | 102 | } |
| 103 | 103 | |
| r2375 | r2376 | |
| 177 | 177 | |
| 178 | 178 | static INTERRUPT_GEN( tankbatt_interrupt ) |
| 179 | 179 | { |
| 180 | if (( | |
| 180 | if (( | |
| 181 | 181 | else if (tankbatt_nmi_enable) cpunum_set_input_line(machine, 0,INPUT_LINE_NMI,PULSE_LINE); |
| 182 | 182 | } |
| 183 | 183 |
| r2375 | r2376 | |
|---|---|---|
| 236 | 236 | return misc_io_data[offset]; |
| 237 | 237 | |
| 238 | 238 | /* otherwise, return an input port */ |
| 239 | return | |
| 239 | return | |
| 240 | 240 | |
| 241 | 241 | /* 'SEGA' protection */ |
| 242 | 242 | case 0x10/2: |
| r2375 | r2376 | |
| 330 | 330 | |
| 331 | 331 | /* video control latch */ |
| 332 | 332 | case 0x2000/2: |
| 333 | return | |
| 333 | return | |
| 334 | 334 | } |
| 335 | 335 | if (custom_io_r) |
| 336 | 336 | return custom_io_r(machine, offset, mem_mask); |
| r2375 | r2376 | |
| 419 | 419 | switch (offset) |
| 420 | 420 | { |
| 421 | 421 | case 0x3020/2: |
| 422 | return | |
| 422 | return | |
| 423 | 423 | |
| 424 | 424 | case 0x3022/2: |
| 425 | return | |
| 425 | return | |
| 426 | 426 | |
| 427 | 427 | case 0x3024/2: |
| 428 | return | |
| 428 | return | |
| 429 | 429 | } |
| 430 | 430 | return segaic16_open_bus_r(machine,0,0); |
| 431 | 431 | } |
| r2375 | r2376 | |
| 460 | 460 | switch (offset) |
| 461 | 461 | { |
| 462 | 462 | case 0x3010/2: |
| 463 | lghost_value = 255 - | |
| 463 | lghost_value = 255 - | |
| 464 | 464 | break; |
| 465 | 465 | |
| 466 | 466 | case 0x3012/2: |
| 467 | lghost_value = | |
| 467 | lghost_value = | |
| 468 | 468 | break; |
| 469 | 469 | |
| 470 | 470 | case 0x3014/2: |
| 471 | lghost_value = 255 - | |
| 471 | lghost_value = 255 - | |
| 472 | 472 | break; |
| 473 | 473 | |
| 474 | 474 | case 0x3016/2: |
| 475 | lghost_value = | |
| 475 | lghost_value = | |
| 476 | 476 | break; |
| 477 | 477 | |
| 478 | 478 | case 0x3020/2: |
| r2375 | r2376 | |
| 494 | 494 | switch (offset) |
| 495 | 495 | { |
| 496 | 496 | case 0x3000/2: |
| 497 | return ( | |
| 497 | return ( | |
| 498 | 498 | |
| 499 | 499 | case 0x3004/2: |
| 500 | return ( | |
| 500 | return ( | |
| 501 | 501 | |
| 502 | 502 | case 0x3008/2: |
| 503 | return ( | |
| 503 | return ( | |
| 504 | 504 | |
| 505 | 505 | case 0x300c/2: |
| 506 | return ( | |
| 506 | return ( | |
| 507 | 507 | |
| 508 | 508 | case 0x3010/2: |
| 509 | return ( | |
| 509 | return ( | |
| 510 | 510 | |
| 511 | 511 | case 0x3014/2: |
| 512 | return ( | |
| 512 | return ( | |
| 513 | 513 | } |
| 514 | 514 | return segaic16_open_bus_r(machine,0,0); |
| 515 | 515 | } |
| r2375 | r2376 | |
| 521 | 521 | { |
| 522 | 522 | case 0x3000/2: |
| 523 | 523 | case 0x3004/2: |
| 524 | wwally_last_x[0] = readinputportbytag("TRACKX1"); | |
| 525 | wwally_last_y[0] = readinputportbytag("TRACKY1"); | |
| 524 | wwally_last_x[0] = input_port_read(machine, "TRACKX1"); | |
| 525 | wwally_last_y[0] = input_port_read(machine, "TRACKY1"); | |
| 526 | 526 | break; |
| 527 | 527 | |
| 528 | 528 | case 0x3008/2: |
| 529 | 529 | case 0x300c/2: |
| 530 | wwally_last_x[1] = readinputportbytag("TRACKX2"); | |
| 531 | wwally_last_y[1] = readinputportbytag("TRACKY2"); | |
| 530 | wwally_last_x[1] = input_port_read(machine, "TRACKX2"); | |
| 531 | wwally_last_y[1] = input_port_read(machine, "TRACKY2"); | |
| 532 | 532 | break; |
| 533 | 533 | |
| 534 | 534 | case 0x3010/2: |
| 535 | 535 | case 0x3014/2: |
| 536 | wwally_last_x[2] = readinputportbytag("TRACKX3"); | |
| 537 | wwally_last_y[2] = readinputportbytag("TRACKY3"); | |
| 536 | wwally_last_x[2] = input_port_read(machine, "TRACKX3"); | |
| 537 | wwally_last_y[2] = input_port_read(machine, "TRACKY3"); | |
| 538 | 538 | break; |
| 539 | 539 | } |
| 540 | 540 | } |
| r2375 | r2376 | |
| 1040 | 1040 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) |
| 1041 | 1041 | |
| 1042 | 1042 | PORT_MODIFY("P2") |
| 1043 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN) | |
| 1044 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) | |
| 1045 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) | |
| 1046 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) | |
| 1047 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED) /* P2 joystick inputs, unused in lghost */ | |
| 1048 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 1049 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 1050 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 1043 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1044 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1045 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1046 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1047 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) /* P2 joystick inputs, unused in lghost */ | |
| 1048 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1049 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1050 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1051 | 1051 | |
| 1052 | 1052 | PORT_MODIFY("SERVICE") |
| 1053 | 1053 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r2375 | r2376 | |
| 1064 | 1064 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 1065 | 1065 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1066 | 1066 | PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:3,4,5") |
| 1067 | PORT_DIPSETTING( 0x04, DEF_STR( Harder ) ) | |
| 1068 | PORT_DIPSETTING( 0x08, DEF_STR( Hardest ) ) | |
| 1069 | 1067 | PORT_DIPSETTING( 0x0c, DEF_STR( Easiest ) ) |
| 1068 | PORT_DIPSETTING( 0x14, DEF_STR( Easier ) ) | |
| 1069 | PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) | |
| 1070 | 1070 | PORT_DIPSETTING( 0x1c, DEF_STR( Normal ) ) |
| 1071 | 1071 | PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) |
| 1072 | PORT_DIPSETTING( 0x14, DEF_STR( Easier ) ) | |
| 1073 | PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) | |
| 1072 | PORT_DIPSETTING( 0x04, DEF_STR( Harder ) ) | |
| 1073 | PORT_DIPSETTING( 0x08, DEF_STR( Hardest ) ) | |
| 1074 | 1074 | PORT_DIPSETTING( 0x00, "Extra Hardest" ) |
| 1075 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6") | |
| 1076 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 1077 | PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) | |
| 1075 | 1078 | PORT_DIPNAME( 0x40, 0x40, "Coin Chute" ) PORT_DIPLOCATION("SWB:7") |
| 1076 | 1079 | PORT_DIPSETTING( 0x00, "Common" ) |
| 1077 | 1080 | PORT_DIPSETTING( 0x40, "Individual" ) |
| r2375 | r2376 | |
|---|---|---|
| 84 | 84 | switch (offset) |
| 85 | 85 | { |
| 86 | 86 | case 0: /* Dipswitch 2 */ |
| 87 | shared_ram[0] = (source&0xff00)| | |
| 87 | shared_ram[0] = (source&0xff00)| | |
| 88 | 88 | return 0; |
| 89 | 89 | |
| 90 | 90 | case 0x22: /* Coin value */ |
| r2375 | r2376 | |
| 95 | 95 | |
| 96 | 96 | credits=0; |
| 97 | 97 | |
| 98 | if (( | |
| 98 | if (( | |
| 99 | 99 | |
| 100 | if (( | |
| 100 | if (( | |
| 101 | 101 | { |
| 102 | 102 | shared_ram[0x29] = (source&0xff00)|(0x22); // coinA |
| 103 | 103 | shared_ram[0x22] = (source&0xff00)|0x0; |
| 104 | 104 | latch=1; |
| 105 | 105 | |
| 106 | coinvalue = (~ | |
| 106 | coinvalue = (~ | |
| 107 | 107 | |
| 108 | 108 | deposits1++; |
| 109 | 109 | if (deposits1 == coinage1[coinvalue][0]) |
| r2375 | r2376 | |
| 114 | 114 | else |
| 115 | 115 | credits = 0; |
| 116 | 116 | } |
| 117 | else if (( | |
| 117 | else if (( | |
| 118 | 118 | { |
| 119 | 119 | shared_ram[0x29] = (source&0xff00)|(0x22); // coinA |
| 120 | 120 | shared_ram[0x22] = (source&0xff00)|0x0; |
| 121 | 121 | latch=1; |
| 122 | 122 | |
| 123 | coinvalue = (~ | |
| 123 | coinvalue = (~ | |
| 124 | 124 | |
| 125 | 125 | deposits2++; |
| 126 | 126 | if (deposits2 == coinage2[coinvalue][0]) |
| r2375 | r2376 | |
|---|---|---|
| 251 | 251 | { |
| 252 | 252 | switch (dsw_select) |
| 253 | 253 | { |
| 254 | case 0x00: return readinputport(13); /* DSW3 */ | |
| 255 | case 0x20: return readinputport(14); /* DSW4 */ | |
| 256 | case 0x40: return readinputport(12); /* DSW2 */ | |
| 254 | case 0x00: return input_port_read_indexed(machine, 13); /* DSW3 */ | |
| 255 | case 0x20: return input_port_read_indexed(machine, 14); /* DSW4 */ | |
| 256 | case 0x40: return input_port_read_indexed(machine, 12); /* DSW2 */ | |
| 257 | 257 | } |
| 258 | 258 | return 0; |
| 259 | 259 | } |
| r2375 | r2376 | |
| 271 | 271 | { |
| 272 | 272 | switch (suzume_bank) |
| 273 | 273 | { |
| 274 | case 0x08: return readinputport(14); /* DSW4 */ | |
| 275 | case 0x10: return readinputport(13); /* DSW3 */ | |
| 276 | case 0x18: return readinputport(12); /* DSW2 */ | |
| 274 | case 0x08: return input_port_read_indexed(machine, 14); /* DSW4 */ | |
| 275 | case 0x10: return input_port_read_indexed(machine, 13); /* DSW3 */ | |
| 276 | case 0x18: return input_port_read_indexed(machine, 12); /* DSW2 */ | |
| 277 | 277 | } |
| 278 | 278 | return 0; |
| 279 | 279 | } |
| r2375 | r2376 | |
| 312 | 312 | |
| 313 | 313 | static READ8_HANDLER( mjapinky_dsw_r ) |
| 314 | 314 | { |
| 315 | if (rombank == 0x0e) return | |
| 315 | if (rombank == 0x0e) return | |
| 316 | 316 | else return *(memory_region(REGION_CPU1) + 0x10000 + 0x8000 * rombank); |
| 317 | 317 | } |
| 318 | 318 | |
| r2375 | r2376 | |
| 502 | 502 | |
| 503 | 503 | static READ8_HANDLER( janptr96_dsw_r ) |
| 504 | 504 | { |
| 505 | if (~dsw_select & 0x01) return readinputportbytag("DSW4"); | |
| 506 | if (~dsw_select & 0x02) return readinputportbytag("DSW3"); | |
| 507 | if (~dsw_select & 0x04) return readinputportbytag("DSW2"); | |
| 508 | if (~dsw_select & 0x08) return readinputportbytag("DSW1"); | |
| 509 | if (~dsw_select & 0x10) return readinputportbytag("DSWTOP"); | |
| 505 | if (~dsw_select & 0x01) return input_port_read(machine, "DSW4"); | |
| 506 | if (~dsw_select & 0x02) return input_port_read(machine, "DSW3"); | |
| 507 | if (~dsw_select & 0x04) return input_port_read(machine, "DSW2"); | |
| 508 | if (~dsw_select & 0x08) return input_port_read(machine, "DSW1"); | |
| 509 | if (~dsw_select & 0x10) return input_port_read(machine, "DSWTOP"); | |
| 510 | 510 | return 0xff; |
| 511 | 511 | } |
| 512 | 512 | |
| r2375 | r2376 | |
| 572 | 572 | |
| 573 | 573 | switch(offset) |
| 574 | 574 | { |
| 575 | case 0x8000: return readinputport(14); // dsw 4 | |
| 576 | case 0x8200: return readinputport(13); // dsw 3 | |
| 575 | case 0x8000: return input_port_read_indexed(machine, 14); // dsw 4 | |
| 576 | case 0x8200: return input_port_read_indexed(machine, 13); // dsw 3 | |
| 577 | 577 | case 0x9001: return AY8910_read_port_0_r(machine,0); // inputs |
| 578 | case 0x9011: return | |
| 578 | case 0x9011: return | |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | logerror("%04X: unmapped input read at %04X\n", activecpu_get_pc(), offset); |
| r2375 | r2376 | |
| 624 | 624 | |
| 625 | 625 | static READ8_HANDLER( mjifb_p3_r ) |
| 626 | 626 | { |
| 627 | return | |
| 627 | return | |
| 628 | 628 | } |
| 629 | 629 | static READ8_HANDLER( mjifb_p5_r ) |
| 630 | 630 | { |
| 631 | return | |
| 631 | return | |
| 632 | 632 | } |
| 633 | 633 | static READ8_HANDLER( mjifb_p6_r ) |
| 634 | 634 | { |
| 635 | return | |
| 635 | return | |
| 636 | 636 | } |
| 637 | 637 | static READ8_HANDLER( mjifb_p7_r ) |
| 638 | 638 | { |
| 639 | return | |
| 639 | return | |
| 640 | 640 | } |
| 641 | 641 | static READ8_HANDLER( mjifb_p8_r ) |
| 642 | 642 | { |
| r2375 | r2376 | |
| 679 | 679 | |
| 680 | 680 | switch(offset) |
| 681 | 681 | { |
| 682 | case 0x8000: return readinputport(14); // dsw 2 | |
| 683 | case 0x8001: return readinputport(13); // dsw 1 | |
| 682 | case 0x8000: return input_port_read_indexed(machine, 14); // dsw 2 | |
| 683 | case 0x8001: return input_port_read_indexed(machine, 13); // dsw 1 | |
| 684 | 684 | case 0x9001: return AY8910_read_port_0_r(machine,0); // inputs |
| 685 | case 0x9011: return | |
| 685 | case 0x9011: return | |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | logerror("%04X: unmapped input read at %04X\n", activecpu_get_pc(), offset); |
| r2375 | r2376 | |
| 795 | 795 | { |
| 796 | 796 | switch( dsw_select ) |
| 797 | 797 | { |
| 798 | case 0x00: return readinputportbytag("DSW1"); | |
| 799 | case 0x01: return readinputportbytag("DSW2"); | |
| 800 | case 0x02: return readinputportbytag("DSW3"); | |
| 801 | case 0x03: return readinputportbytag("DSW4"); | |
| 802 | case 0x04: return readinputportbytag("DSWTOP"); | |
| 798 | case 0x00: return input_port_read(machine, "DSW1"); | |
| 799 | case 0x01: return input_port_read(machine, "DSW2"); | |
| 800 | case 0x02: return input_port_read(machine, "DSW3"); | |
| 801 | case 0x03: return input_port_read(machine, "DSW4"); | |
| 802 | case 0x04: return input_port_read(machine, "DSWTOP"); | |
| 803 | 803 | } |
| 804 | 804 | logerror("%04X: unmapped dsw read %02X\n", activecpu_get_pc(), dsw_select); |
| 805 | 805 | return 0xff; |
| r2375 | r2376 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "deprecat.h" | |
| 11 | 12 | #include "includes/amiga.h" |
| 12 | 13 | #include "sound/es5503.h" |
| 13 | 14 | |
| r2375 | r2376 | |
| 30 | 31 | |
| 31 | 32 | static UINT8 mquake_cia_0_porta_r(void) |
| 32 | 33 | { |
| 33 | return | |
| 34 | return | |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | static void mquake_cia_0_porta_w(UINT8 data) |
| r2375 | r2376 | |
| 124 | 125 | static READ16_HANDLER( coin_chip_r ) |
| 125 | 126 | { |
| 126 | 127 | if (offset == 1) |
| 127 | return | |
| 128 | return | |
| 128 | 129 | logerror("%06x:coin_chip_r(%02x) & %04x\n", activecpu_get_pc(), offset, mem_mask ^ 0xffff); |
| 129 | 130 | return 0xffff; |
| 130 | 131 | } |
| r2375 | r2376 | |
|---|---|---|
| 181 | 181 | /* I have NO IDEA if this is correct or not */ |
| 182 | 182 | state->bottomline = ~data & 0x20; |
| 183 | 183 | |
| 184 | if ( | |
| 184 | if ( | |
| 185 | 185 | state->flip = ~data & 0x10; |
| 186 | 186 | |
| 187 | if (!( | |
| 187 | if (!( | |
| 188 | 188 | sound_global_enable(~data & 0x80); |
| 189 | 189 | |
| 190 | 190 | /* sound command in lower 4 bytes */ |
| r2375 | r2376 | |
| 257 | 257 | |
| 258 | 258 | state->bottomline = ~data & 0x20; |
| 259 | 259 | |
| 260 | if ( | |
| 260 | if ( | |
| 261 | 261 | state->flip = ~data & 0x10; |
| 262 | 262 | |
| 263 | if (!( | |
| 263 | if (!( | |
| 264 | 264 | sound_global_enable(~data & 0x80); |
| 265 | 265 | } |
| 266 | 266 | |
| r2375 | r2376 | |
| 287 | 287 | if (data & 0xF0) |
| 288 | 288 | popmessage("M15 ctrl: %02x",data); |
| 289 | 289 | #endif |
| 290 | if ( | |
| 290 | if ( | |
| 291 | 291 | state->flip = ~data & 0x04; |
| 292 | if (!( | |
| 292 | if (!( | |
| 293 | 293 | sound_global_enable(~data & 0x08); |
| 294 | 294 | } |
| 295 | 295 |
| r2375 | r2376 | |
|---|---|---|
| 1230 | 1230 | return utf8_from_tstring(namestring); |
| 1231 | 1231 | |
| 1232 | 1232 | // otherwise, allocate space to add the suffix |
| 1233 | combined = malloc_or_die(_tcslen(namestring) + 1 + _tcslen(suffix) + 1); | |
| 1233 | combined = malloc_or_die(sizeof(TCHAR) * (_tcslen(namestring) + 1 + _tcslen(suffix) + 1)); | |
| 1234 | 1234 | _tcscpy(combined, namestring); |
| 1235 | 1235 | _tcscat(combined, TEXT(" ")); |
| 1236 | 1236 | _tcscat(combined, suffix); |
| r2375 | r2376 | |
|---|---|---|
| 5591 | 5591 | // read playback header |
| 5592 | 5592 | mame_fread(pPlayBack, &input_header, sizeof(inp_header)); |
| 5593 | 5593 | |
| 5594 | if (!isalnum(input_header.name[0])) // If first byte is not alpha-numeric | |
| 5594 | if (!isalnum(input_header.gamename[0])) // If first byte is not alpha-numeric | |
| 5595 | 5595 | mame_fseek(pPlayBack, 0, SEEK_SET); // old .inp file - no header |
| 5596 | 5596 | else |
| 5597 | 5597 | { |
| 5598 | 5598 | int i; |
| 5599 | 5599 | for (i = 0; drivers[i] != 0; i++) // find game and play it |
| 5600 | 5600 | { |
| 5601 | if (strcmp(drivers[i]->name, input_header.name) == 0) | |
| 5601 | if (strcmp(drivers[i]->name, input_header.gamename) == 0) | |
| 5602 | 5602 | { |
| 5603 | 5603 | nGame = i; |
| 5604 | 5604 | break; |
| r2375 | r2376 | |
|---|---|---|
| 61 | 61 | /****************************************************************************/ |
| 62 | 62 | /* Read a byte from given memory location */ |
| 63 | 63 | /****************************************************************************/ |
| 64 | #define M6805_RDMEM(Addr) ((unsigned)program_read_byte_8(Addr)) | |
| 64 | #define M6805_RDMEM(Addr) ((unsigned)program_read_byte_8be(Addr)) | |
| 65 | 65 | |
| 66 | 66 | /****************************************************************************/ |
| 67 | 67 | /* Write a byte to given memory location */ |
| 68 | 68 | /****************************************************************************/ |
| 69 | #define M6805_WRMEM(Addr,Value) (program_write_byte_8(Addr,Value)) | |
| 69 | #define M6805_WRMEM(Addr,Value) (program_write_byte_8be(Addr,Value)) | |
| 70 | 70 | |
| 71 | 71 | /****************************************************************************/ |
| 72 | 72 | /* M6805_RDOP() is identical to M6805_RDMEM() except it is used for reading */ |
| r2375 | r2376 | |
|---|---|---|
| 70 | 70 | |
| 71 | 71 | #define DefaultBase(Seg) ((seg_prefix && (Seg==DS || Seg==SS)) ? prefix_base : I.sregs[Seg] << 4) |
| 72 | 72 | |
| 73 | #define GetMemB(Seg,Off) ((UINT8)program_read_byte_8((DefaultBase(Seg)+(Off)))) | |
| 74 | #define GetMemW(Seg,Off) ((UINT16) program_read_byte_8((DefaultBase(Seg)+(Off))) + (program_read_byte_8((DefaultBase(Seg)+((Off)+1)))<<8) ) | |
| 73 | #define GetMemB(Seg,Off) ((UINT8)program_read_byte_8le((DefaultBase(Seg)+(Off)))) | |
| 74 | #define GetMemW(Seg,Off) ((UINT16) program_read_byte_8le((DefaultBase(Seg)+(Off))) + (program_read_byte_8le((DefaultBase(Seg)+((Off)+1)))<<8) ) | |
| 75 | 75 | |
| 76 | #define PutMemB(Seg,Off,x) { program_write_byte_8((DefaultBase(Seg)+(Off)),(x)); } | |
| 76 | #define PutMemB(Seg,Off,x) { program_write_byte_8le((DefaultBase(Seg)+(Off)),(x)); } | |
| 77 | 77 | #define PutMemW(Seg,Off,x) { PutMemB(Seg,Off,(x)&0xff); PutMemB(Seg,(Off)+1,(BYTE)((x)>>8)); } |
| 78 | 78 | |
| 79 | 79 | /* Todo: Remove these later - plus readword could overflow */ |
| 80 | #define ReadByte(ea) ((BYTE)program_read_byte_8((ea))) | |
| 81 | #define ReadWord(ea) (program_read_byte_8((ea))+(program_read_byte_8(((ea)+1))<<8)) | |
| 82 | #define WriteByte(ea,val) { program_write_byte_8((ea),val); } | |
| 83 | #define WriteWord(ea,val) { program_write_byte_8((ea),(BYTE)(val)); program_write_byte_8(((ea)+1),(val)>>8); } | |
| 80 | #define ReadByte(ea) ((BYTE)program_read_byte_8le((ea))) | |
| 81 | #define ReadWord(ea) (program_read_byte_8le((ea))+(program_read_byte_8le(((ea)+1))<<8)) | |
| 82 | #define WriteByte(ea,val) { program_write_byte_8le((ea),val); } | |
| 83 | #define WriteWord(ea,val) { program_write_byte_8le((ea),(BYTE)(val)); program_write_byte_8le(((ea)+1),(val)>>8); } | |
| 84 | 84 | |
| 85 | #define read_port(port) io_read_byte_8(port) | |
| 86 | #define write_port(port,val) io_write_byte_8(port,val) | |
| 85 | #define read_port(port) io_read_byte_8le(port) | |
| 86 | #define write_port(port,val) io_write_byte_8le(port,val) | |
| 87 | 87 | |
| 88 | 88 | #define FETCH (cpu_readop_arg((I.sregs[CS]<<4)+I.ip++)) |
| 89 | 89 | #define FETCHOP (cpu_readop((I.sregs[CS]<<4)+I.ip++)) |
| r2375 | r2376 | |
|---|---|---|
| 19 | 19 | /* Read a byte from given memory location */ |
| 20 | 20 | /****************************************************************************/ |
| 21 | 21 | /* ASG 971005 -- changed to program_read_byte_8/cpu_writemem16 */ |
| 22 | #define M6809_RDMEM(Addr) ((unsigned)program_read_byte_8(Addr)) | |
| 22 | #define M6809_RDMEM(Addr) ((unsigned)program_read_byte_8be(Addr)) | |
| 23 | 23 | |
| 24 | 24 | /****************************************************************************/ |
| 25 | 25 | /* Write a byte to given memory location */ |
| 26 | 26 | /****************************************************************************/ |
| 27 | #define M6809_WRMEM(Addr,Value) (program_write_byte_8(Addr,Value)) | |
| 27 | #define M6809_WRMEM(Addr,Value) (program_write_byte_8be(Addr,Value)) | |
| 28 | 28 | |
| 29 | 29 | /****************************************************************************/ |
| 30 | 30 | /* Z80_RDOP() is identical to Z80_RDMEM() except it is used for reading */ |
| r2375 | r2376 | |
|---|---|---|
| 316 | 316 | h8.regs[reg] = data; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | static | |
| 319 | static STATE_POSTLOAD( h8_onstateload | |
| 320 | 320 | { |
| 321 | 321 | h8_set_ccr(h8.ccr); |
| 322 | 322 | } |
| r2375 | r2376 | |
| 344 | 344 | state_save_register_item("H8/3002", index, h8.h8TCNT3); |
| 345 | 345 | state_save_register_item("H8/3002", index, h8.h8TCNT4); |
| 346 | 346 | |
| 347 | state_save_register_ | |
| 347 | state_save_register_ | |
| 348 | 348 | |
| 349 | 349 | h8_itu_init(); |
| 350 | 350 | } |
| r2375 | r2376 | |
|---|---|---|
| 400 | 400 | val = io_read_byte(H8_SERIAL_B); |
| 401 | 401 | break; |
| 402 | 402 | case 0xe0: |
| 403 | val = io_read_byte | |
| 403 | val = io_read_byte | |
| 404 | 404 | break; |
| 405 | 405 | case 0xe1: |
| 406 | val = io_read_byte | |
| 406 | val = io_read_byte | |
| 407 | 407 | break; |
| 408 | 408 | case 0xe2: |
| 409 | val = io_read_byte | |
| 409 | val = io_read_byte | |
| 410 | 410 | break; |
| 411 | 411 | case 0xe3: |
| 412 | val = io_read_byte | |
| 412 | val = io_read_byte | |
| 413 | 413 | break; |
| 414 | 414 | case 0xe4: |
| 415 | val = io_read_byte | |
| 415 | val = io_read_byte | |
| 416 | 416 | break; |
| 417 | 417 | case 0xe5: |
| 418 | val = io_read_byte | |
| 418 | val = io_read_byte | |
| 419 | 419 | break; |
| 420 | 420 | case 0xe6: |
| 421 | val = io_read_byte | |
| 421 | val = io_read_byte | |
| 422 | 422 | break; |
| 423 | 423 | case 0xe7: |
| 424 | val = io_read_byte | |
| 424 | val = io_read_byte | |
| 425 | 425 | break; |
| 426 | 426 | case 0xe8: // adc status |
| 427 | 427 | val = 0x80; |
| 428 | 428 | break; |
| 429 | 429 | case 0xc7: // port 4 data |
| 430 | val = io_read_byte | |
| 430 | val = io_read_byte | |
| 431 | 431 | break; |
| 432 | 432 | case 0xcb: // port 6 data |
| 433 | val = io_read_byte | |
| 433 | val = io_read_byte | |
| 434 | 434 | break; |
| 435 | 435 | case 0xce: // port 7 data |
| 436 | val = io_read_byte | |
| 436 | val = io_read_byte | |
| 437 | 437 | break; |
| 438 | 438 | case 0xcf: // port 8 data |
| 439 | val = io_read_byte | |
| 439 | val = io_read_byte | |
| 440 | 440 | break; |
| 441 | 441 | case 0xd2: // port 9 data |
| 442 | val = io_read_byte | |
| 442 | val = io_read_byte | |
| 443 | 443 | break; |
| 444 | 444 | case 0xd3: // port a data |
| 445 | val = io_read_byte | |
| 445 | val = io_read_byte | |
| 446 | 446 | break; |
| 447 | 447 | case 0xd6: // port b data |
| 448 | val = io_read_byte | |
| 448 | val = io_read_byte | |
| 449 | 449 | break; |
| 450 | 450 | case 0xf6: |
| 451 | 451 | val = h8_ISR_r(); |
| r2375 | r2376 | |
| 482 | 482 | io_write_byte(H8_SERIAL_B, val); |
| 483 | 483 | break; |
| 484 | 484 | case 0xc7: |
| 485 | io_write_byte | |
| 485 | io_write_byte | |
| 486 | 486 | break; |
| 487 | 487 | case 0xcb: // port 6 data |
| 488 | io_write_byte | |
| 488 | io_write_byte | |
| 489 | 489 | break; |
| 490 | 490 | case 0xce: // port 7 data |
| 491 | io_write_byte | |
| 491 | io_write_byte | |
| 492 | 492 | break; |
| 493 | 493 | case 0xcf: // port 8 data |
| 494 | io_write_byte | |
| 494 | io_write_byte | |
| 495 | 495 | break; |
| 496 | 496 | case 0xd2: // port 9 data |
| 497 | io_write_byte | |
| 497 | io_write_byte | |
| 498 | 498 | break; |
| 499 | 499 | case 0xd3: // port a data |
| 500 | io_write_byte | |
| 500 | io_write_byte | |
| 501 | 501 | break; |
| 502 | 502 | case 0xd6: // port b data |
| 503 | io_write_byte | |
| 503 | io_write_byte | |
| 504 | 504 | break; |
| 505 | 505 | case 0xf6: |
| 506 | 506 | h8_ISR_w(val); |
| r2375 | r2376 | |
| 684 | 684 | val = io_read_byte(H8_SERIAL_B); |
| 685 | 685 | break; |
| 686 | 686 | case 0xe0: |
| 687 | val = io_read_byte | |
| 687 | val = io_read_byte | |
| 688 | 688 | break; |
| 689 | 689 | case 0xe1: |
| 690 | val = io_read_byte | |
| 690 | val = io_read_byte | |
| 691 | 691 | break; |
| 692 | 692 | case 0xe2: |
| 693 | val = io_read_byte | |
| 693 | val = io_read_byte | |
| 694 | 694 | break; |
| 695 | 695 | case 0xe3: |
| 696 | val = io_read_byte | |
| 696 | val = io_read_byte | |
| 697 | 697 | break; |
| 698 | 698 | case 0xe4: |
| 699 | val = io_read_byte | |
| 699 | val = io_read_byte | |
| 700 | 700 | break; |
| 701 | 701 | case 0xe5: |
| 702 | val = io_read_byte | |
| 702 | val = io_read_byte | |
| 703 | 703 | break; |
| 704 | 704 | case 0xe6: |
| 705 | val = io_read_byte | |
| 705 | val = io_read_byte | |
| 706 | 706 | break; |
| 707 | 707 | case 0xe7: |
| 708 | val = io_read_byte | |
| 708 | val = io_read_byte | |
| 709 | 709 | break; |
| 710 | 710 | case 0xe8: // adc status |
| 711 | 711 | val = 0x80; |
| 712 | 712 | break; |
| 713 | 713 | |
| 714 | 714 | case 0xd3: // port 4 data |
| 715 | val = io_read_byte | |
| 715 | val = io_read_byte | |
| 716 | 716 | break; |
| 717 | 717 | case 0xd5: // port 6 data |
| 718 | val = io_read_byte | |
| 718 | val = io_read_byte | |
| 719 | 719 | break; |
| 720 | 720 | case 0xd6: // port 7 data |
| 721 | val = io_read_byte | |
| 721 | val = io_read_byte | |
| 722 | 722 | break; |
| 723 | 723 | case 0xd7: // port 8 data |
| 724 | val = io_read_byte | |
| 724 | val = io_read_byte | |
| 725 | 725 | break; |
| 726 | 726 | case 0xd8: // port 9 data |
| 727 | val = io_read_byte | |
| 727 | val = io_read_byte | |
| 728 | 728 | break; |
| 729 | 729 | case 0xd9: // port a data |
| 730 | val = io_read_byte | |
| 730 | val = io_read_byte | |
| 731 | 731 | break; |
| 732 | 732 | case 0xda: // port b data |
| 733 | val = io_read_byte | |
| 733 | val = io_read_byte | |
| 734 | 734 | break; |
| 735 | 735 | default: |
| 736 | 736 | val = h8.per_regs[reg]; |
| r2375 | r2376 | |
| 766 | 766 | io_write_byte(H8_SERIAL_B, val); |
| 767 | 767 | break; |
| 768 | 768 | case 0xd3: |
| 769 | io_write_byte | |
| 769 | io_write_byte | |
| 770 | 770 | break; |
| 771 | 771 | case 0xd5: // port 6 data |
| 772 | io_write_byte | |
| 772 | io_write_byte | |
| 773 | 773 | break; |
| 774 | 774 | case 0xd6: // port 7 data |
| 775 | io_write_byte | |
| 775 | io_write_byte | |
| 776 | 776 | break; |
| 777 | 777 | case 0xd7: // port 8 data |
| 778 | io_write_byte | |
| 778 | io_write_byte | |
| 779 | 779 | break; |
| 780 | 780 | case 0xd8: // port 9 data |
| 781 | io_write_byte | |
| 781 | io_write_byte | |
| 782 | 782 | break; |
| 783 | 783 | case 0xd9: // port a data |
| 784 | io_write_byte | |
| 784 | io_write_byte | |
| 785 | 785 | break; |
| 786 | 786 | case 0xda: // port b data |
| 787 | io_write_byte | |
| 787 | io_write_byte | |
| 788 | 788 | break; |
| 789 | 789 | } |
| 790 | 790 | } |
| r2375 | r2376 | |
|---|---|---|
| 26 | 26 | return (cpu_readop(addr) << 8) | (cpu_readop(addr + 1)); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | static UINT16 readword_d8(offs_t address) | |
| 30 | { | |
| 31 | UINT16 result = program_read_byte_8(address) << 8; | |
| 32 | return result | program_read_byte_8(address + 1); | |
| 33 | } | |
| 34 | ||
| 35 | static void writeword_d8(offs_t address, UINT16 data) | |
| 36 | { | |
| 37 | program_write_byte_8(address, data >> 8); | |
| 38 | program_write_byte_8(address + 1, data); | |
| 39 | } | |
| 40 | ||
| 41 | static UINT32 readlong_d8(offs_t address) | |
| 42 | { | |
| 43 | UINT32 result = program_read_byte_8(address) << 24; | |
| 44 | result |= program_read_byte_8(address + 1) << 16; | |
| 45 | result |= program_read_byte_8(address + 2) << 8; | |
| 46 | return result | program_read_byte_8(address + 3); | |
| 47 | } | |
| 48 | ||
| 49 | static void writelong_d8(offs_t address, UINT32 data) | |
| 50 | { | |
| 51 | program_write_byte_8(address, data >> 24); | |
| 52 | program_write_byte_8(address + 1, data >> 16); | |
| 53 | program_write_byte_8(address + 2, data >> 8); | |
| 54 | program_write_byte_8(address + 3, data); | |
| 55 | } | |
| 56 | ||
| 57 | 29 | /* interface for 20/22-bit address bus, 8-bit data bus (68008) */ |
| 58 | 30 | static const struct m68k_memory_interface interface_d8 = |
| 59 | 31 | { |
| 60 | 32 | 0, |
| 61 | 33 | m68008_read_immediate_16, |
| 62 | program_read_byte_8, | |
| 63 | readword_d8, | |
| 64 | readlong_d8, | |
| 65 | program_write_byte_8, | |
| 66 | writeword_d8, | |
| 67 | writelong_d8 | |
| 34 | program_read_byte_8be, | |
| 35 | program_read_word_8be, | |
| 36 | program_read_dword_8be, | |
| 37 | program_write_byte_8be, | |
| 38 | program_write_word_8be, | |
| 39 | program_write_dword_8be | |
| 68 | 40 | }; |
| 69 | 41 | |
| 70 | 42 | /**************************************************************************** |
| r2375 | r2376 | |
| 76 | 48 | return cpu_readop16((address) ^ m68k_memory_intf.opcode_xor); |
| 77 | 49 | } |
| 78 | 50 | |
| 79 | static UINT32 readlong_d16(offs_t address) | |
| 80 | { | |
| 81 | UINT32 result = program_read_word_16be(address) << 16; | |
| 82 | return result | program_read_word_16be(address + 2); | |
| 83 | } | |
| 84 | ||
| 85 | static void writelong_d16(offs_t address, UINT32 data) | |
| 86 | { | |
| 87 | program_write_word_16be(address, data >> 16); | |
| 88 | program_write_word_16be(address + 2, data); | |
| 89 | } | |
| 90 | ||
| 91 | 51 | /* interface for 24-bit address bus, 16-bit data bus (68000, 68010) */ |
| 92 | 52 | static const struct m68k_memory_interface interface_d16 = |
| 93 | 53 | { |
| r2375 | r2376 | |
| 95 | 55 | read_immediate_16, |
| 96 | 56 | program_read_byte_16be, |
| 97 | 57 | program_read_word_16be, |
| 98 | read | |
| 58 | program_read | |
| 99 | 59 | program_write_byte_16be, |
| 100 | 60 | program_write_word_16be, |
| 101 | write | |
| 61 | program_write | |
| 102 | 62 | }; |
| 103 | 63 | |
| 104 | 64 | /**************************************************************************** |
| r2375 | r2376 | |
| 281 | 241 | |
| 282 | 242 | static void m68008_set_context(void *src) |
| 283 | 243 | { |
| 284 | if (m68k_memory_intf.read8 != program_read_byte_8) | |
| 244 | if (m68k_memory_intf.read8 != program_read_byte_8be) | |
| 285 | 245 | m68k_memory_intf = interface_d8; |
| 286 | 246 | m68k_set_context(src); |
| 287 | 247 | } |
| r2375 | r2376 | |
|---|---|---|
| 978 | 978 | UINT8 halted; |
| 979 | 979 | } m68k_substate; |
| 980 | 980 | |
| 981 | static void m68k_prepare_substate(void) | |
| 981 | static void m68k_prepare_substate(running_machine *machine, void *param) | |
| 982 | 982 | { |
| 983 | 983 | m68k_substate.sr = m68ki_get_sr(); |
| 984 | 984 | m68k_substate.stopped = (CPU_STOPPED & STOP_LEVEL_STOP) != 0; |
| 985 | 985 | m68k_substate.halted = (CPU_STOPPED & STOP_LEVEL_HALT) != 0; |
| 986 | 986 | } |
| 987 | 987 | |
| 988 | static void m68k_post_load(void) | |
| 988 | static void m68k_post_load(running_machine *machine, void *param) | |
| 989 | 989 | { |
| 990 | 990 | m68ki_set_sr_noint_nosp(m68k_substate.sr); |
| 991 | 991 | CPU_STOPPED = m68k_substate.stopped ? STOP_LEVEL_STOP : 0 |
| r2375 | r2376 | |
| 1014 | 1014 | state_save_register_item(type, index, m68k_substate.halted); |
| 1015 | 1015 | state_save_register_item(type, index, CPU_PREF_ADDR); |
| 1016 | 1016 | state_save_register_item(type, index, CPU_PREF_DATA); |
| 1017 | state_save_register_func_presave(m68k_prepare_substate); | |
| 1018 | state_save_register_func_postload(m68k_post_load); | |
| 1017 | state_save_register_presave(Machine, m68k_prepare_substate, NULL); | |
| 1018 | state_save_register_postload(Machine, m68k_post_load, NULL); | |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | #endif /* M68K_COMPILE_FOR_MAME */ |
| r2375 | r2376 | |
|---|---|---|
| 61 | 61 | #define RDMEM(a) (data_read_word_16be((a) * 2) & 0xfff) |
| 62 | 62 | #define WRMEM(a,v) (data_write_word_16be((a) * 2, (v))) |
| 63 | 63 | |
| 64 | #define READPORT(a) (io_read_byte_8(a)) | |
| 65 | #define WRITEPORT(a,v) (io_write_byte_8((a), (v))) | |
| 64 | #define READPORT(a) (io_read_byte_8be(a)) | |
| 65 | #define WRITEPORT(a,v) (io_write_byte_8be((a), (v))) | |
| 66 | 66 | |
| 67 | 67 | #define SET_A0() do { ccpu.a0flag = ccpu.A; } while (0) |
| 68 | 68 | #define SET_CMP_VAL(x) do { ccpu.cmpacc = *ccpu.acc; ccpu.cmpval = (x) & 0xfff; } while (0) |
| r2375 | r2376 | |
|---|---|---|
| 119 | 119 | /* Memory functions */ |
| 120 | 120 | /****************************************************************************/ |
| 121 | 121 | |
| 122 | #define mem_ReadByte(A) ((UINT8)program_read_byte_8(A)) | |
| 123 | #define mem_WriteByte(A,V) (program_write_byte_8(A,V)) | |
| 122 | #define mem_ReadByte(A) ((UINT8)program_read_byte_8le(A)) | |
| 123 | #define mem_WriteByte(A,V) (program_write_byte_8le(A,V)) | |
| 124 | 124 | |
| 125 | 125 | INLINE UINT16 mem_ReadWord (UINT32 address) |
| 126 | 126 | { |
| r2375 | r2376 | |
|---|---|---|
| 102 | 102 | |
| 103 | 103 | static void check_interrupt(void); |
| 104 | 104 | static TIMER_CALLBACK( scanline_callback ); |
| 105 | static | |
| 105 | static STATE_POSTLOAD( tms34010_state_postload | |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | /*************************************************************************** |
| r2375 | r2376 | |
| 672 | 672 | state_save_register_item("tms34010", index, state.pixelshift); |
| 673 | 673 | state_save_register_item("tms34010", index, state.gfxcycles); |
| 674 | 674 | state_save_register_item_pointer("tms34010", index, (&state.regs[0].reg), ARRAY_LENGTH(state.regs)); |
| 675 | state_save_register_ | |
| 675 | state_save_register_ | |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | static void tms34010_reset(void) |
| r2375 | r2376 | |
| 1622 | 1622 | SAVE STATE |
| 1623 | 1623 | ***************************************************************************/ |
| 1624 | 1624 | |
| 1625 | static | |
| 1625 | static STATE_POSTLOAD( tms34010_state_postload | |
| 1626 | 1626 | { |
| 1627 | 1627 | change_pc(TOBYTE(PC)); |
| 1628 | 1628 | set_raster_op(); |
| r2375 | r2376 | |
|---|---|---|
| 1377 | 1377 | #------------------------------------------------- |
| 1378 | 1378 | |
| 1379 | 1379 | CPUDEFS += -DHAS_PSXCPU=$(if $(filter PSXCPU,$(CPUS)),1,0) |
| 1380 | CPUDEFS += -DHAS_CXD8661R=$(if $(filter CXD8661R,$(CPUS)),1,0) | |
| 1380 | 1381 | |
| 1381 | ifneq ($(filter PSXCPU,$(CPUS)),) | |
| 1382 | ifneq ($(filter PSXCPU CXD8661R,$(CPUS)),) | |
| 1382 | 1383 | OBJDIRS += $(CPUOBJ)/mips |
| 1383 | 1384 | CPUOBJS += $(CPUOBJ)/mips/psx.o |
| 1384 | 1385 | DBGOBJS += $(CPUOBJ)/mips/mipsdasm.o |
| r2375 | r2376 | |
|---|---|---|
| 504 | 504 | switch (offset) |
| 505 | 505 | { |
| 506 | 506 | case 2: // p0 |
| 507 | return io_read_byte_8(M37710_PORT0); | |
| 507 | return io_read_byte_8le(M37710_PORT0); | |
| 508 | 508 | break; |
| 509 | 509 | case 3: // p1 |
| 510 | return io_read_byte_8(M37710_PORT1); | |
| 510 | return io_read_byte_8le(M37710_PORT1); | |
| 511 | 511 | break; |
| 512 | 512 | case 6: // p2 |
| 513 | return io_read_byte_8(M37710_PORT2); | |
| 513 | return io_read_byte_8le(M37710_PORT2); | |
| 514 | 514 | break; |
| 515 | 515 | case 7: // p3 |
| 516 | return io_read_byte_8(M37710_PORT3); | |
| 516 | return io_read_byte_8le(M37710_PORT3); | |
| 517 | 517 | break; |
| 518 | 518 | case 0xa: // p4 |
| 519 | return io_read_byte_8(M37710_PORT4); | |
| 519 | return io_read_byte_8le(M37710_PORT4); | |
| 520 | 520 | break; |
| 521 | 521 | case 0xb: // p5 |
| 522 | return io_read_byte_8(M37710_PORT5); | |
| 522 | return io_read_byte_8le(M37710_PORT5); | |
| 523 | 523 | break; |
| 524 | 524 | case 0xe: // p6 |
| 525 | return io_read_byte_8(M37710_PORT6); | |
| 525 | return io_read_byte_8le(M37710_PORT6); | |
| 526 | 526 | break; |
| 527 | 527 | case 0xf: // p7 |
| 528 | return io_read_byte_8(M37710_PORT7); | |
| 528 | return io_read_byte_8le(M37710_PORT7); | |
| 529 | 529 | break; |
| 530 | 530 | case 0x12: // p8 |
| 531 | return io_read_byte_8(M37710_PORT8); | |
| 531 | return io_read_byte_8le(M37710_PORT8); | |
| 532 | 532 | break; |
| 533 | 533 | |
| 534 | 534 | case 0x20: |
| 535 | return io_read_byte_8(M37710_ADC0_L); | |
| 535 | return io_read_byte_8le(M37710_ADC0_L); | |
| 536 | 536 | break; |
| 537 | 537 | case 0x21: |
| 538 | return io_read_byte_8(M37710_ADC0_H); | |
| 538 | return io_read_byte_8le(M37710_ADC0_H); | |
| 539 | 539 | break; |
| 540 | 540 | case 0x22: |
| 541 | return io_read_byte_8(M37710_ADC1_L); | |
| 541 | return io_read_byte_8le(M37710_ADC1_L); | |
| 542 | 542 | break; |
| 543 | 543 | case 0x23: |
| 544 | return io_read_byte_8(M37710_ADC1_H); | |
| 544 | return io_read_byte_8le(M37710_ADC1_H); | |
| 545 | 545 | break; |
| 546 | 546 | case 0x24: |
| 547 | return io_read_byte_8(M37710_ADC2_L); | |
| 547 | return io_read_byte_8le(M37710_ADC2_L); | |
| 548 | 548 | break; |
| 549 | 549 | case 0x25: |
| 550 | return io_read_byte_8(M37710_ADC2_H); | |
| 550 | return io_read_byte_8le(M37710_ADC2_H); | |
| 551 | 551 | break; |
| 552 | 552 | case 0x26: |
| 553 | return io_read_byte_8(M37710_ADC3_L); | |
| 553 | return io_read_byte_8le(M37710_ADC3_L); | |
| 554 | 554 | break; |
| 555 | 555 | case 0x27: |
| 556 | return io_read_byte_8(M37710_ADC3_H); | |
| 556 | return io_read_byte_8le(M37710_ADC3_H); | |
| 557 | 557 | break; |
| 558 | 558 | case 0x28: |
| 559 | return io_read_byte_8(M37710_ADC4_L); | |
| 559 | return io_read_byte_8le(M37710_ADC4_L); | |
| 560 | 560 | break; |
| 561 | 561 | case 0x29: |
| 562 | return io_read_byte_8(M37710_ADC4_H); | |
| 562 | return io_read_byte_8le(M37710_ADC4_H); | |
| 563 | 563 | break; |
| 564 | 564 | case 0x2a: |
| 565 | return io_read_byte_8(M37710_ADC5_L); | |
| 565 | return io_read_byte_8le(M37710_ADC5_L); | |
| 566 | 566 | break; |
| 567 | 567 | case 0x2b: |
| 568 | return io_read_byte_8(M37710_ADC5_H); | |
| 568 | return io_read_byte_8le(M37710_ADC5_H); | |
| 569 | 569 | break; |
| 570 | 570 | case 0x2c: |
| 571 | return io_read_byte_8(M37710_ADC6_L); | |
| 571 | return io_read_byte_8le(M37710_ADC6_L); | |
| 572 | 572 | break; |
| 573 | 573 | case 0x2d: |
| 574 | return io_read_byte_8(M37710_ADC6_H); | |
| 574 | return io_read_byte_8le(M37710_ADC6_H); | |
| 575 | 575 | break; |
| 576 | 576 | case 0x2e: |
| 577 | return io_read_byte_8(M37710_ADC7_L); | |
| 577 | return io_read_byte_8le(M37710_ADC7_L); | |
| 578 | 578 | break; |
| 579 | 579 | case 0x2f: |
| 580 | return io_read_byte_8(M37710_ADC7_H); | |
| 580 | return io_read_byte_8le(M37710_ADC7_H); | |
| 581 | 581 | break; |
| 582 | 582 | case 0x35: |
| 583 | 583 | return 0xff; // UART control |
| r2375 | r2376 | |
| 598 | 598 | switch(offset) |
| 599 | 599 | { |
| 600 | 600 | case 2: // p0 |
| 601 | io_write_byte_8(M37710_PORT0, data); | |
| 601 | io_write_byte_8le(M37710_PORT0, data); | |
| 602 | 602 | return; |
| 603 | 603 | break; |
| 604 | 604 | case 3: // p1 |
| 605 | io_write_byte_8(M37710_PORT1, data); | |
| 605 | io_write_byte_8le(M37710_PORT1, data); | |
| 606 | 606 | return; |
| 607 | 607 | break; |
| 608 | 608 | case 6: // p2 |
| 609 | io_write_byte_8(M37710_PORT2, data); | |
| 609 | io_write_byte_8le(M37710_PORT2, data); | |
| 610 | 610 | return; |
| 611 | 611 | break; |
| 612 | 612 | case 7: // p3 |
| 613 | io_write_byte_8(M37710_PORT3, data); | |
| 613 | io_write_byte_8le(M37710_PORT3, data); | |
| 614 | 614 | return; |
| 615 | 615 | break; |
| 616 | 616 | case 0xa: // p4 |
| 617 | io_write_byte_8(M37710_PORT4, data); | |
| 617 | io_write_byte_8le(M37710_PORT4, data); | |
| 618 | 618 | return; |
| 619 | 619 | break; |
| 620 | 620 | case 0xb: // p5 |
| 621 | io_write_byte_8(M37710_PORT5, data); | |
| 621 | io_write_byte_8le(M37710_PORT5, data); | |
| 622 | 622 | return; |
| 623 | 623 | break; |
| 624 | 624 | case 0xe: // p6 |
| 625 | io_write_byte_8(M37710_PORT6, data); | |
| 625 | io_write_byte_8le(M37710_PORT6, data); | |
| 626 | 626 | return; |
| 627 | 627 | break; |
| 628 | 628 | case 0xf: // p7 |
| 629 | io_write_byte_8(M37710_PORT7, data); | |
| 629 | io_write_byte_8le(M37710_PORT7, data); | |
| 630 | 630 | return; |
| 631 | 631 | break; |
| 632 | 632 | case 0x12: // p8 |
| 633 | io_write_byte_8(M37710_PORT8, data); | |
| 633 | io_write_byte_8le(M37710_PORT8, data); | |
| 634 | 634 | return; |
| 635 | 635 | break; |
| 636 | 636 | |
| r2375 | r2376 | |
| 1041 | 1041 | } |
| 1042 | 1042 | #endif /* ENABLE_DEBUGGER */ |
| 1043 | 1043 | |
| 1044 | static | |
| 1044 | static STATE_POSTLOAD( m37710_restore_state | |
| 1045 | 1045 | { |
| 1046 | 1046 | // restore proper function pointers |
| 1047 | 1047 | m37710i_set_execution_mode((FLAG_M>>4) | (FLAG_X>>4)); |
| r2375 | r2376 | |
| 1112 | 1112 | state_save_register_item("M377xx", index, m37710i_cpu.reload[7].seconds); |
| 1113 | 1113 | state_save_register_item("M377xx", index, m37710i_cpu.reload[7].attoseconds); |
| 1114 | 1114 | |
| 1115 | state_save_register_ | |
| 1115 | state_save_register_ | |
| 1116 | 1116 | } |
| 1117 | 1117 | |
| 1118 | 1118 | /************************************************************************** |
| r2375 | r2376 | |
|---|---|---|
| 811 | 811 | static UINT8 z180_readcontrol(offs_t port) |
| 812 | 812 | { |
| 813 | 813 | /* normal external readport */ |
| 814 | UINT8 data = io_read_byte_8(port); | |
| 814 | UINT8 data = io_read_byte_8le(port); | |
| 815 | 815 | |
| 816 | 816 | /* remap internal I/O registers */ |
| 817 | 817 | if((port & (IO_IOCR & 0xc0)) == (IO_IOCR & 0xc0)) |
| r2375 | r2376 | |
| 1239 | 1239 | static void z180_writecontrol(offs_t port, UINT8 data) |
| 1240 | 1240 | { |
| 1241 | 1241 | /* normal external write port */ |
| 1242 | io_write_byte_8(port, data); | |
| 1242 | io_write_byte_8le(port, data); | |
| 1243 | 1243 | |
| 1244 | 1244 | /* remap internal I/O registers */ |
| 1245 | 1245 | if((port & (IO_IOCR & 0xc0)) == (IO_IOCR & 0xc0)) |
| r2375 | r2376 | |
| 1604 | 1604 | switch( IO_DMODE & (Z180_DMODE_SM | Z180_DMODE_DM) ) |
| 1605 | 1605 | { |
| 1606 | 1606 | case 0x00: /* memory SAR0+1 to memory DAR0+1 */ |
| 1607 | program_write_byte_8(dar0++, program_read_byte_8(sar0++)); | |
| 1607 | program_write_byte_8le(dar0++, program_read_byte_8le(sar0++)); | |
| 1608 | 1608 | break; |
| 1609 | 1609 | case 0x04: /* memory SAR0-1 to memory DAR0+1 */ |
| 1610 | program_write_byte_8(dar0++, program_read_byte_8(sar0--)); | |
| 1610 | program_write_byte_8le(dar0++, program_read_byte_8le(sar0--)); | |
| 1611 | 1611 | break; |
| 1612 | 1612 | case 0x08: /* memory SAR0 fixed to memory DAR0+1 */ |
| 1613 | program_write_byte_8(dar0++, program_read_byte_8(sar0)); | |
| 1613 | program_write_byte_8le(dar0++, program_read_byte_8le(sar0)); | |
| 1614 | 1614 | break; |
| 1615 | 1615 | case 0x0c: /* I/O SAR0 fixed to memory DAR0+1 */ |
| 1616 | 1616 | if (Z180.iol & Z180_DREQ0) |
| 1617 | 1617 | { |
| 1618 | program_write_byte_8(dar0++, IN(sar0)); | |
| 1618 | program_write_byte_8le(dar0++, IN(sar0)); | |
| 1619 | 1619 | /* edge sensitive DREQ0 ? */ |
| 1620 | 1620 | if (IO_DCNTL & Z180_DCNTL_DIM0) |
| 1621 | 1621 | { |
| r2375 | r2376 | |
| 1625 | 1625 | } |
| 1626 | 1626 | break; |
| 1627 | 1627 | case 0x10: /* memory SAR0+1 to memory DAR0-1 */ |
| 1628 | program_write_byte_8(dar0--, program_read_byte_8(sar0++)); | |
| 1628 | program_write_byte_8le(dar0--, program_read_byte_8le(sar0++)); | |
| 1629 | 1629 | break; |
| 1630 | 1630 | case 0x14: /* memory SAR0-1 to memory DAR0-1 */ |
| 1631 | program_write_byte_8(dar0--, program_read_byte_8(sar0--)); | |
| 1631 | program_write_byte_8le(dar0--, program_read_byte_8le(sar0--)); | |
| 1632 | 1632 | break; |
| 1633 | 1633 | case 0x18: /* memory SAR0 fixed to memory DAR0-1 */ |
| 1634 | program_write_byte_8(dar0--, program_read_byte_8(sar0)); | |
| 1634 | program_write_byte_8le(dar0--, program_read_byte_8le(sar0)); | |
| 1635 | 1635 | break; |
| 1636 | 1636 | case 0x1c: /* I/O SAR0 fixed to memory DAR0-1 */ |
| 1637 | 1637 | if (Z180.iol & Z180_DREQ0) |
| 1638 | 1638 | { |
| 1639 | program_write_byte_8(dar0--, IN(sar0)); | |
| 1639 | program_write_byte_8le(dar0--, IN(sar0)); | |
| 1640 | 1640 | /* edge sensitive DREQ0 ? */ |
| 1641 | 1641 | if (IO_DCNTL & Z180_DCNTL_DIM0) |
| 1642 | 1642 | { |
| r2375 | r2376 | |
| 1646 | 1646 | } |
| 1647 | 1647 | break; |
| 1648 | 1648 | case 0x20: /* memory SAR0+1 to memory DAR0 fixed */ |
| 1649 | program_write_byte_8(dar0, program_read_byte_8(sar0++)); | |
| 1649 | program_write_byte_8le(dar0, program_read_byte_8le(sar0++)); | |
| 1650 | 1650 | break; |
| 1651 | 1651 | case 0x24: /* memory SAR0-1 to memory DAR0 fixed */ |
| 1652 | program_write_byte_8(dar0, program_read_byte_8(sar0--)); | |
| 1652 | program_write_byte_8le(dar0, program_read_byte_8le(sar0--)); | |
| 1653 | 1653 | break; |
| 1654 | 1654 | case 0x28: /* reserved */ |
| 1655 | 1655 | break; |
| r2375 | r2376 | |
| 1658 | 1658 | case 0x30: /* memory SAR0+1 to I/O DAR0 fixed */ |
| 1659 | 1659 | if (Z180.iol & Z180_DREQ0) |
| 1660 | 1660 | { |
| 1661 | OUT(dar0, program_read_byte_8(sar0++)); | |
| 1661 | OUT(dar0, program_read_byte_8le(sar0++)); | |
| 1662 | 1662 | /* edge sensitive DREQ0 ? */ |
| 1663 | 1663 | if (IO_DCNTL & Z180_DCNTL_DIM0) |
| 1664 | 1664 | { |
| r2375 | r2376 | |
| 1670 | 1670 | case 0x34: /* memory SAR0-1 to I/O DAR0 fixed */ |
| 1671 | 1671 | if (Z180.iol & Z180_DREQ0) |
| 1672 | 1672 | { |
| 1673 | OUT(dar0, program_read_byte_8(sar0--)); | |
| 1673 | OUT(dar0, program_read_byte_8le(sar0--)); | |
| 1674 | 1674 | /* edge sensitive DREQ0 ? */ |
| 1675 | 1675 | if (IO_DCNTL & Z180_DCNTL_DIM0) |
| 1676 | 1676 | { |
| r2375 | r2376 | |
| 1735 | 1735 | switch (IO_DCNTL & (Z180_DCNTL_DIM1 | Z180_DCNTL_DIM0)) |
| 1736 | 1736 | { |
| 1737 | 1737 | case 0x00: /* memory MAR1+1 to I/O IAR1 fixed */ |
| 1738 | io_write_byte_8(iar1, program_read_byte_8(mar1++)); | |
| 1738 | io_write_byte_8le(iar1, program_read_byte_8le(mar1++)); | |
| 1739 | 1739 | break; |
| 1740 | 1740 | case 0x01: /* memory MAR1-1 to I/O IAR1 fixed */ |
| 1741 | io_write_byte_8(iar1, program_read_byte_8(mar1--)); | |
| 1741 | io_write_byte_8le(iar1, program_read_byte_8le(mar1--)); | |
| 1742 | 1742 | break; |
| 1743 | 1743 | case 0x02: /* I/O IAR1 fixed to memory MAR1+1 */ |
| 1744 | program_write_byte_8(mar1++, io_read_byte_8(iar1)); | |
| 1744 | program_write_byte_8le(mar1++, io_read_byte_8le(iar1)); | |
| 1745 | 1745 | break; |
| 1746 | 1746 | case 0x03: /* I/O IAR1 fixed to memory MAR1-1 */ |
| 1747 | program_write_byte_8(mar1--, io_read_byte_8(iar1)); | |
| 1747 | program_write_byte_8le(mar1--, io_read_byte_8le(iar1)); | |
| 1748 | 1748 | break; |
| 1749 | 1749 | } |
| 1750 | 1750 |
| r2375 | r2376 | |
|---|---|---|
| 24 | 24 | ***************************************************************/ |
| 25 | 25 | #define IN(port) \ |
| 26 | 26 | (((port ^ IO_IOCR) & 0xffc0) == 0) ? \ |
| 27 | z180_readcontrol(port) : io_read_byte_8(port) | |
| 27 | z180_readcontrol(port) : io_read_byte_8le(port) | |
| 28 | 28 | |
| 29 | 29 | /*************************************************************** |
| 30 | 30 | * Output a byte to given I/O port |
| r2375 | r2376 | |
| 32 | 32 | #define OUT(port,value) \ |
| 33 | 33 | if (((port ^ IO_IOCR) & 0xffc0) == 0) \ |
| 34 | 34 | z180_writecontrol(port,value); \ |
| 35 | else io_write_byte_8(port,value) | |
| 35 | else io_write_byte_8le(port,value) | |
| 36 | 36 | |
| 37 | 37 | /*************************************************************** |
| 38 | 38 | * MMU calculate the memory managemant lookup table |
| r2375 | r2376 | |
| 68 | 68 | /*************************************************************** |
| 69 | 69 | * Read a byte from given memory location |
| 70 | 70 | ***************************************************************/ |
| 71 | #define RM(addr) program_read_byte_8(MMU_REMAP_ADDR(addr)) | |
| 71 | #define RM(addr) program_read_byte_8le(MMU_REMAP_ADDR(addr)) | |
| 72 | 72 | UINT8 z180_readmem(offs_t offset) |
| 73 | 73 | { |
| 74 | 74 | return RM(offset); |
| r2375 | r2376 | |
| 77 | 77 | /*************************************************************** |
| 78 | 78 | * Write a byte to given memory location |
| 79 | 79 | ***************************************************************/ |
| 80 | #define WM(addr,value) program_write_byte_8(MMU_REMAP_ADDR(addr),value) | |
| 80 | #define WM(addr,value) program_write_byte_8le(MMU_REMAP_ADDR(addr),value) | |
| 81 | 81 | void z180_writemem(offs_t offset, UINT8 data) |
| 82 | 82 | { |
| 83 | 83 | WM(offset, data); |
| r2375 | r2376 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | #ifdef I8086 |
| 6 | 6 | #if (HAS_I8088||HAS_I80188) |
| 7 | static UINT16 read_word_8(offs_t addr) | |
| 8 | { | |
| 9 | UINT16 result = program_read_byte_8(addr); | |
| 10 | return result | (program_read_byte_8(addr + 1) << 8); | |
| 11 | } | |
| 12 | ||
| 13 | static void write_word_8(offs_t addr, UINT16 data) | |
| 14 | { | |
| 15 | program_write_byte_8(addr, data); | |
| 16 | program_write_byte_8(addr + 1, data >> 8); | |
| 17 | } | |
| 18 | ||
| 19 | static UINT16 read_port_word_8(offs_t addr) | |
| 20 | { | |
| 21 | UINT16 result = io_read_byte_8(addr); | |
| 22 | return result | (io_read_byte_8(addr + 1) << 8); | |
| 23 | } | |
| 24 | ||
| 25 | static void write_port_word_8(offs_t addr, UINT16 data) | |
| 26 | { | |
| 27 | io_write_byte_8(addr, data); | |
| 28 | io_write_byte_8(addr + 1, data >> 8); | |
| 29 | } | |
| 30 | ||
| 31 | 7 | static void configure_memory_8bit(void) |
| 32 | 8 | { |
| 33 | 9 | I.mem.fetch_xor = 0; |
| 34 | 10 | |
| 35 | I.mem.rbyte = program_read_byte_8; | |
| 36 | I.mem.rword = read_word_8; | |
| 37 | I.mem.wbyte = program_write_byte_8; | |
| 38 | I.mem.wword = write_word_8; | |
| 11 | I.mem.rbyte = program_read_byte_8le; | |
| 12 | I.mem.rword = program_read_word_8le; | |
| 13 | I.mem.wbyte = program_write_byte_8le; | |
| 14 | I.mem.wword = program_write_word_8le; | |
| 39 | 15 | |
| 40 | I.mem.rbyte_port = io_read_byte_8; | |
| 41 | I.mem.rword_port = read_port_word_8; | |
| 42 | I.mem.wbyte_port = io_write_byte_8; | |
| 43 | I.mem.wword_port = write_port_word_8; | |
| 16 | I.mem.rbyte_port = io_read_byte_8le; | |
| 17 | I.mem.rword_port = io_read_word_8le; | |
| 18 | I.mem.wbyte_port = io_write_byte_8le; | |
| 19 | I.mem.wword_port = io_write_word_8le; | |
| 44 | 20 | } |
| 45 | 21 | #endif |
| 46 | 22 | #endif |
| r2375 | r2376 | |
|---|---|---|
| 14 | 14 | #undef PutMemW |
| 15 | 15 | |
| 16 | 16 | /* ASG 971005 -- changed to program_read_byte_8/program_write_byte_8 */ |
| 17 | #define GetMemB(Seg,Off) ( (BYTE)program_read_byte_8((DefaultBase(Seg)+(Off))&AMASK)) | |
| 17 | #define GetMemB(Seg,Off) ( (BYTE)program_read_byte_8le((DefaultBase(Seg)+(Off))&AMASK)) | |
| 18 | 18 | #define GetMemW(Seg,Off) ( (WORD)GetMemB(Seg,Off)+(WORD)(GetMemB(Seg,(Off)+1)<<8)) |
| 19 | #define PutMemB(Seg,Off,x) { program_write_byte_8((DefaultBase(Seg)+(Off))&AMASK,(x)); } | |
| 19 | #define PutMemB(Seg,Off,x) { program_write_byte_8le((DefaultBase(Seg)+(Off))&AMASK,(x)); } | |
| 20 | 20 | #define PutMemW(Seg,Off,x) { PutMemB(Seg,Off,(BYTE)(x)); PutMemB(Seg,(Off)+1,(BYTE)((x)>>8)); } |
| 21 | 21 | |
| 22 | 22 | #undef PEEKBYTE |
| 23 | #define PEEKBYTE(ea) ((BYTE)program_read_byte_8((ea)&AMASK)) | |
| 23 | #define PEEKBYTE(ea) ((BYTE)program_read_byte_8le((ea)&AMASK)) | |
| 24 | 24 | |
| 25 | 25 | #undef ReadByte |
| 26 | 26 | #undef ReadWord |
| 27 | 27 | #undef WriteByte |
| 28 | 28 | #undef WriteWord |
| 29 | 29 | |
| 30 | #define ReadByte(ea) ((BYTE)program_read_byte_8((ea)&AMASK)) | |
| 31 | #define ReadWord(ea) (program_read_byte_8((ea)&AMASK)+(program_read_byte_8(((ea)+1)&AMASK)<<8)) | |
| 32 | #define WriteByte(ea,val) { program_write_byte_8((ea)&AMASK,val); } | |
| 33 | #define WriteWord(ea,val) { program_write_byte_8((ea)&AMASK,(BYTE)(val)); program_write_byte_8(((ea)+1)&AMASK,(val)>>8); } | |
| 30 | #define ReadByte(ea) ((BYTE)program_read_byte_8le((ea)&AMASK)) | |
| 31 | #define ReadWord(ea) (program_read_byte_8le((ea)&AMASK)+(program_read_byte_8le(((ea)+1)&AMASK)<<8)) | |
| 32 | #define WriteByte(ea,val) { program_write_byte_8le((ea)&AMASK,val); } | |
| 33 | #define WriteWord(ea,val) { program_write_byte_8le((ea)&AMASK,(BYTE)(val)); program_write_byte_8le(((ea)+1)&AMASK,(val)>>8); } | |
| 34 | 34 | |
| 35 | 35 | #undef CHANGE_PC |
| 36 | 36 | #define CHANGE_PC(addr) change_pc(addr) |
| r2375 | r2376 | |
|---|---|---|
| 539 | 539 | |
| 540 | 540 | #define RDOP(O) O = cpu_readop(PCD); PC++ |
| 541 | 541 | #define RDOPARG(A) A = cpu_readop_arg(PCD); PC++ |
| 542 | #define RM(A) program_read_byte_8(A) | |
| 543 | #define WM(A,V) program_write_byte_8(A,V) | |
| 542 | #define RM(A) program_read_byte_8le(A) | |
| 543 | #define WM(A,V) program_write_byte_8le(A,V) | |
| 544 | 544 | |
| 545 | 545 | #define ZHC_ADD(after,before,carry) \ |
| 546 | 546 | if (after == 0) PSW |= Z; else PSW &= ~Z; \ |
| r2375 | r2376 | |
| 581 | 581 | { |
| 582 | 582 | case UPD7810_PORTA: |
| 583 | 583 | if (upd7810.ma) // NS20031301 no need to read if the port is set as output |
| 584 | upd7810.pa_in = io_read_byte_8(port); | |
| 584 | upd7810.pa_in = io_read_byte_8le(port); | |
| 585 | 585 | data = (upd7810.pa_in & upd7810.ma) | (upd7810.pa_out & ~upd7810.ma); |
| 586 | 586 | break; |
| 587 | 587 | case UPD7810_PORTB: |
| 588 | 588 | if (upd7810.mb) // NS20031301 no need to read if the port is set as output |
| 589 | upd7810.pb_in = io_read_byte_8(port); | |
| 589 | upd7810.pb_in = io_read_byte_8le(port); | |
| 590 | 590 | data = (upd7810.pb_in & upd7810.mb) | (upd7810.pb_out & ~upd7810.mb); |
| 591 | 591 | break; |
| 592 | 592 | case UPD7810_PORTC: |
| 593 | 593 | if (upd7810.mc) // NS20031301 no need to read if the port is set as output |
| 594 | upd7810.pc_in = io_read_byte_8(port); | |
| 594 | upd7810.pc_in = io_read_byte_8le(port); | |
| 595 | 595 | data = (upd7810.pc_in & upd7810.mc) | (upd7810.pc_out & ~upd7810.mc); |
| 596 | 596 | if (upd7810.mcc & 0x01) /* PC0 = TxD output */ |
| 597 | 597 | data = (data & ~0x01) | (upd7810.txd & 1 ? 0x01 : 0x00); |
| r2375 | r2376 | |
| 611 | 611 | data = (data & ~0x80) | (upd7810.co1 & 1 ? 0x80 : 0x00); |
| 612 | 612 | break; |
| 613 | 613 | case UPD7810_PORTD: |
| 614 | upd7810.pd_in = io_read_byte_8(port); | |
| 614 | upd7810.pd_in = io_read_byte_8le(port); | |
| 615 | 615 | switch (upd7810.mm & 0x07) |
| 616 | 616 | { |
| 617 | 617 | case 0x00: /* PD input mode, PF port mode */ |
| r2375 | r2376 | |
| 626 | 626 | } |
| 627 | 627 | break; |
| 628 | 628 | case UPD7810_PORTF: |
| 629 | upd7810.pf_in = io_read_byte_8(port); | |
| 629 | upd7810.pf_in = io_read_byte_8le(port); | |
| 630 | 630 | switch (upd7810.mm & 0x06) |
| 631 | 631 | { |
| 632 | 632 | case 0x00: /* PD input/output mode, PF port mode */ |
| r2375 | r2376 | |
| 646 | 646 | } |
| 647 | 647 | break; |
| 648 | 648 | case UPD7807_PORTT: // NS20031301 partial implementation |
| 649 | data = io_read_byte_8(port); | |
| 649 | data = io_read_byte_8le(port); | |
| 650 | 650 | break; |
| 651 | 651 | default: |
| 652 | 652 | logerror("uPD7810 internal error: RP() called with invalid port number\n"); |
| r2375 | r2376 | |
| 662 | 662 | upd7810.pa_out = data; |
| 663 | 663 | // data = (data & ~upd7810.ma) | (upd7810.pa_in & upd7810.ma); |
| 664 | 664 | data = (data & ~upd7810.ma) | (upd7810.ma); // NS20031401 |
| 665 | io_write_byte_8(port, data); | |
| 665 | io_write_byte_8le(port, data); | |
| 666 | 666 | break; |
| 667 | 667 | case UPD7810_PORTB: |
| 668 | 668 | upd7810.pb_out = data; |
| 669 | 669 | // data = (data & ~upd7810.mb) | (upd7810.pb_in & upd7810.mb); |
| 670 | 670 | data = (data & ~upd7810.mb) | (upd7810.mb); // NS20031401 |
| 671 | io_write_byte_8(port, data); | |
| 671 | io_write_byte_8le(port, data); | |
| 672 | 672 | break; |
| 673 | 673 | case UPD7810_PORTC: |
| 674 | 674 | upd7810.pc_out = data; |
| r2375 | r2376 | |
| 690 | 690 | data = (data & ~0x40) | (upd7810.co0 & 1 ? 0x40 : 0x00); |
| 691 | 691 | if (upd7810.mcc & 0x80) /* PC7 = CO1 output */ |
| 692 | 692 | data = (data & ~0x80) | (upd7810.co1 & 1 ? 0x80 : 0x00); |
| 693 | io_write_byte_8(port, data); | |
| 693 | io_write_byte_8le(port, data); | |
| 694 | 694 | break; |
| 695 | 695 | case UPD7810_PORTD: |
| 696 | 696 | upd7810.pd_out = data; |
| r2375 | r2376 | |
| 705 | 705 | default: /* PD extension mode, PF port/extension mode */ |
| 706 | 706 | return; |
| 707 | 707 | } |
| 708 | io_write_byte_8(port, data); | |
| 708 | io_write_byte_8le(port, data); | |
| 709 | 709 | break; |
| 710 | 710 | case UPD7810_PORTF: |
| 711 | 711 | upd7810.pf_out = data; |
| r2375 | r2376 | |
| 724 | 724 | data |= 0xff; /* what would come out for the lower bits here? */ |
| 725 | 725 | break; |
| 726 | 726 | } |
| 727 | io_write_byte_8(port, data); | |
| 727 | io_write_byte_8le(port, data); | |
| 728 | 728 | break; |
| 729 | 729 | default: |
| 730 | 730 | logerror("uPD7810 internal error: RP() called with invalid port number\n"); |
| r2375 | r2376 | |
|---|---|---|
| 90 | 90 | static minx_regs regs; |
| 91 | 91 | static int minx_icount; |
| 92 | 92 | |
| 93 | #define rd(offset) program_read_byte_8( offset ) | |
| 94 | #define wr(offset,data) program_write_byte_8( offset, data ) | |
| 93 | #define rd(offset) program_read_byte_8be( offset ) | |
| 94 | #define wr(offset,data) program_write_byte_8be( offset, data ) | |
| 95 | 95 | #define minx_PC ( ( regs.PC & 0x8000 ) ? ( regs.V << 15 ) | (regs.PC & 0x7FFF ) : regs.PC ) |
| 96 | 96 | |
| 97 | 97 | INLINE UINT16 rd16( UINT32 offset ) { |
| r2375 | r2376 | |
|---|---|---|
| 130 | 130 | |
| 131 | 131 | extern void spc700_get_info(UINT32 state, cpuinfo *info); |
| 132 | 132 | |
| 133 | #define spc700_read_8(addr) program_read_byte_8(addr) | |
| 134 | #define spc700_write_8(addr,data) program_write_byte_8(addr,data) | |
| 133 | #define spc700_read_8(addr) program_read_byte_8le(addr) | |
| 134 | #define spc700_write_8(addr,data) program_write_byte_8le(addr,data) | |
| 135 | 135 | |
| 136 | 136 | #define spc700_read_8_direct(A) spc700_read_8(A) |
| 137 | 137 | #define spc700_write_8_direct(A, V) spc700_write_8(A, V) |
| 138 | 138 | //#define spc700_read_instruction(A) cpu_readop(A) |
| 139 | 139 | //#define spc700_read_8_immediate(A) cpu_readop_arg(A) |
| 140 | #define spc700_read_instruction(A) program_read_byte_8(A) | |
| 141 | #define spc700_read_8_immediate(A) program_read_byte_8(A) | |
| 140 | #define spc700_read_instruction(A) program_read_byte_8le(A) | |
| 141 | #define spc700_read_8_immediate(A) program_read_byte_8le(A) | |
| 142 | 142 | #define spc700_jumping(A) change_pc(A) |
| 143 | 143 | #define spc700_branching(A) change_pc(A) |
| 144 | 144 |
| r2375 | r2376 | |
|---|---|---|
| 205 | 205 | /* |
| 206 | 206 | * Input a UINT8 from given I/O port |
| 207 | 207 | */ |
| 208 | #define I8039_In(Port) ((UINT8)io_read_byte_8(Port)) | |
| 208 | #define I8039_In(Port) ((UINT8)io_read_byte_8le(Port)) | |
| 209 | 209 | |
| 210 | 210 | |
| 211 | 211 | /* |
| 212 | 212 | * Output a UINT8 to given I/O port |
| 213 | 213 | */ |
| 214 | #define I8039_Out(Port,Value) (io_write_byte_8(Port,Value)) | |
| 214 | #define I8039_Out(Port,Value) (io_write_byte_8le(Port,Value)) | |
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | /* |
| 218 | 218 | * Read a UINT8 from given memory location |
| 219 | 219 | */ |
| 220 | #define I8039_RDMEM(A) ((unsigned)program_read_byte_8(A)) | |
| 220 | #define I8039_RDMEM(A) ((unsigned)program_read_byte_8le(A)) | |
| 221 | 221 | |
| 222 | 222 | |
| 223 | 223 | /* |
| 224 | 224 | * Write a UINT8 to given memory location |
| 225 | 225 | */ |
| 226 | #define I8039_WRMEM(A,V) (program_write_byte_8(A,V)) | |
| 226 | #define I8039_WRMEM(A,V) (program_write_byte_8le(A,V)) | |
| 227 | 227 | |
| 228 | 228 | |
| 229 | 229 | /* |
| r2375 | r2376 | |
|---|---|---|
| 20 | 20 | /* Read a byte from given memory location */ |
| 21 | 21 | /****************************************************************************/ |
| 22 | 22 | /* ASG 971005 -- changed to program_read_byte_8/cpu_writemem16 */ |
| 23 | #define HD6309_RDMEM(Addr) ((unsigned)program_read_byte_8(Addr)) | |
| 23 | #define HD6309_RDMEM(Addr) ((unsigned)program_read_byte_8be(Addr)) | |
| 24 | 24 | |
| 25 | 25 | /****************************************************************************/ |
| 26 | 26 | /* Write a byte to given memory location */ |
| 27 | 27 | /****************************************************************************/ |
| 28 | #define HD6309_WRMEM(Addr,Value) (program_write_byte_8(Addr,Value)) | |
| 28 | #define HD6309_WRMEM(Addr,Value) (program_write_byte_8be(Addr,Value)) | |
| 29 | 29 | |
| 30 | 30 | /****************************************************************************/ |
| 31 | 31 | /* Z80_RDOP() is identical to Z80_RDMEM() except it is used for reading */ |
| r2375 | r2376 | |
|---|---|---|
| 387 | 387 | WM( (mAddr+3)&0xffff, p->b.l ); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | static void UpdateState( | |
| 390 | static void UpdateState( | |
| 391 | 391 | { |
| 392 | 392 | if ( hd6309.md & MD_EM ) |
| 393 | 393 | { |
| r2375 | r2376 | |
| 511 | 511 | UpdateState(); |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | static STATE_POSTLOAD( hd6309_postload ) | |
| 515 | { | |
| 516 | UpdateState(); | |
| 517 | } | |
| 514 | 518 | |
| 515 | 519 | static void hd6309_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 516 | 520 | { |
| r2375 | r2376 | |
| 525 | 529 | state_save_register_item("hd6309", index, DP); |
| 526 | 530 | state_save_register_item("hd6309", index, CC); |
| 527 | 531 | state_save_register_item("hd6309", index, MD); |
| 528 | state_save_register_ | |
| 532 | state_save_register_ | |
| 529 | 533 | state_save_register_item("hd6309", index, hd6309.int_state); |
| 530 | 534 | state_save_register_item("hd6309", index, hd6309.nmi_state); |
| 531 | 535 | state_save_register_item("hd6309", index, hd6309.irq_state[0]); |
| r2375 | r2376 | |
|---|---|---|
| 159 | 159 | #define R16D8( N,R,I ) mode##N = MODE_R16D8; r##N = R; r##N##b = I; |
| 160 | 160 | #define R16R8( N,R,g ) mode##N = MODE_R16R8; r##N = R; r##N##b = g; |
| 161 | 161 | |
| 162 | INLINE UINT8 RM8 (UINT32 a) { return program_read_byte_8( a ); } | |
| 162 | INLINE UINT8 RM8 (UINT32 a) { return program_read_byte_8le( a ); } | |
| 163 | 163 | INLINE UINT16 RM16(UINT32 a) { return RM8(a) | (RM8( (a+1) & 0xffff ) << 8); } |
| 164 | 164 | |
| 165 | INLINE void WM8 (UINT32 a, UINT8 v) { program_write_byte_8( a, v ); } | |
| 165 | INLINE void WM8 (UINT32 a, UINT8 v) { program_write_byte_8le( a, v ); } | |
| 166 | 166 | INLINE void WM16(UINT32 a, UINT16 v) { WM8(a,v); WM8( (a+1) & 0xffff, v >> 8); } |
| 167 | 167 | |
| 168 | INLINE UINT8 RX8 (UINT32 a, UINT32 base) { return program_read_byte_8( base | a ); } | |
| 168 | INLINE UINT8 RX8 (UINT32 a, UINT32 base) { return program_read_byte_8le( base | a ); } | |
| 169 | 169 | INLINE UINT16 RX16(UINT32 a, UINT32 base) { return RX8(a,base) | (RX8( (a+1) & 0xffff, base ) << 8); } |
| 170 | 170 | |
| 171 | INLINE void WX8 (UINT32 a, UINT8 v, UINT32 base) { program_write_byte_8( base | a, v ); } | |
| 171 | INLINE void WX8 (UINT32 a, UINT8 v, UINT32 base) { program_write_byte_8le( base | a, v ); } | |
| 172 | 172 | INLINE void WX16(UINT32 a, UINT16 v, UINT32 base) { WX8(a,v,base); WX8( (a+1) & 0xffff, v >> 8, base); } |
| 173 | 173 | |
| 174 | 174 | INLINE UINT8 READ8(void) { UINT8 b0 = RM8( addr++ ); addr &= 0xffff; return b0; } |
| r2375 | r2376 | |
| 2276 | 2276 | |
| 2277 | 2277 | static READ8_HANDLER( t90_internal_registers_r ) |
| 2278 | 2278 | { |
| 2279 | #define RIO io_read_byte_8( T90_IOBASE+offset ) | |
| 2279 | #define RIO io_read_byte_8le( T90_IOBASE+offset ) | |
| 2280 | 2280 | |
| 2281 | 2281 | UINT8 data = T90.internal_registers[offset]; |
| 2282 | 2282 | switch ( T90_IOBASE + offset ) |
| r2375 | r2376 | |
| 2484 | 2484 | |
| 2485 | 2485 | static WRITE8_HANDLER( t90_internal_registers_w ) |
| 2486 | 2486 | { |
| 2487 | #define WIO io_write_byte_8( T90_IOBASE+offset, data ) | |
| 2487 | #define WIO io_write_byte_8le( T90_IOBASE+offset, data ) | |
| 2488 | 2488 | |
| 2489 | 2489 | UINT8 out_mask; |
| 2490 | 2490 | UINT8 old = T90.internal_registers[offset]; |
| r2375 | r2376 | |
|---|---|---|
| 191 | 191 | * RDMEM |
| 192 | 192 | * read memory byte from addr |
| 193 | 193 | ***************************************************************/ |
| 194 | #define RDMEM(addr) program_read_byte_8(addr) | |
| 194 | #define RDMEM(addr) program_read_byte_8le(addr) | |
| 195 | 195 | |
| 196 | 196 | /*************************************************************** |
| 197 | 197 | * handy table to build PC relative offsets |
| r2375 | r2376 | |
| 508 | 508 | * Store source register to memory addr (CC unchanged) |
| 509 | 509 | ***************************************************************/ |
| 510 | 510 | #define M_STR(address,source) \ |
| 511 | program_write_byte_8(address, source) | |
| 511 | program_write_byte_8le(address, source) | |
| 512 | 512 | |
| 513 | 513 | /*************************************************************** |
| 514 | 514 | * M_AND |
| r2375 | r2376 | |
| 653 | 653 | ***************************************************************/ |
| 654 | 654 | #define M_SPSU() \ |
| 655 | 655 | { \ |
| 656 | R0 = ((S.psu & ~PSU34) | (io_read_byte_8(S2650_SENSE_PORT) & SI)); \ | |
| 656 | R0 = ((S.psu & ~PSU34) | (io_read_byte_8le(S2650_SENSE_PORT) & SI)); \ | |
| 657 | 657 | SET_CC(R0); \ |
| 658 | 658 | } |
| 659 | 659 | |
| r2375 | r2376 | |
| 723 | 723 | #define M_TPSU() \ |
| 724 | 724 | { \ |
| 725 | 725 | UINT8 tpsu = ARG(); \ |
| 726 | UINT8 rpsu = (S.psu | (io_read_byte_8(S2650_SENSE_PORT) & SI)); \ | |
| 726 | UINT8 rpsu = (S.psu | (io_read_byte_8le(S2650_SENSE_PORT) & SI)); \ | |
| 727 | 727 | S.psl &= ~CC; \ |
| 728 | 728 | if( (rpsu & tpsu) != tpsu ) \ |
| 729 | 729 | S.psl |= 0x80; \ |
| r2375 | r2376 | |
| 855 | 855 | { |
| 856 | 856 | /* OR'd with Input to allow for external connections */ |
| 857 | 857 | |
| 858 | return (((S.psu & SI) ? 1 : 0) | ((io_read_byte_8(S2650_SENSE_PORT) & SI) ? 1 : 0)); | |
| 858 | return (((S.psu & SI) ? 1 : 0) | ((io_read_byte_8le(S2650_SENSE_PORT) & SI) ? 1 : 0)); | |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | static int s2650_execute(int cycles) |
| r2375 | r2376 | |
| 989 | 989 | case 0x32: /* REDC,2 */ |
| 990 | 990 | case 0x33: /* REDC,3 */ |
| 991 | 991 | s2650_ICount -= 6; |
| 992 | S.reg[S.r] = io_read_byte_8(S2650_CTRL_PORT); | |
| 992 | S.reg[S.r] = io_read_byte_8le(S2650_CTRL_PORT); | |
| 993 | 993 | SET_CC( S.reg[S.r] ); |
| 994 | 994 | break; |
| 995 | 995 | |
| r2375 | r2376 | |
| 1079 | 1079 | case 0x56: /* REDE,2 v */ |
| 1080 | 1080 | case 0x57: /* REDE,3 v */ |
| 1081 | 1081 | s2650_ICount -= 9; |
| 1082 | S.reg[S.r] = io_read_byte_8( ARG() ); | |
| 1082 | S.reg[S.r] = io_read_byte_8le( ARG() ); | |
| 1083 | 1083 | SET_CC(S.reg[S.r]); |
| 1084 | 1084 | break; |
| 1085 | 1085 | |
| r2375 | r2376 | |
| 1138 | 1138 | case 0x72: /* REDD,2 */ |
| 1139 | 1139 | case 0x73: /* REDD,3 */ |
| 1140 | 1140 | s2650_ICount -= 6; |
| 1141 | S.reg[S.r] = io_read_byte_8(S2650_DATA_PORT); | |
| 1141 | S.reg[S.r] = io_read_byte_8le(S2650_DATA_PORT); | |
| 1142 | 1142 | SET_CC(S.reg[S.r]); |
| 1143 | 1143 | break; |
| 1144 | 1144 | |
| r2375 | r2376 | |
| 1294 | 1294 | case 0xb2: /* WRTC,2 */ |
| 1295 | 1295 | case 0xb3: /* WRTC,3 */ |
| 1296 | 1296 | s2650_ICount -= 6; |
| 1297 | io_write_byte_8(S2650_CTRL_PORT,S.reg[S.r]); | |
| 1297 | io_write_byte_8le(S2650_CTRL_PORT,S.reg[S.r]); | |
| 1298 | 1298 | break; |
| 1299 | 1299 | |
| 1300 | 1300 | case 0xb4: /* TPSU */ |
| r2375 | r2376 | |
| 1380 | 1380 | case 0xd6: /* WRTE,2 v */ |
| 1381 | 1381 | case 0xd7: /* WRTE,3 v */ |
| 1382 | 1382 | s2650_ICount -= 9; |
| 1383 | io_write_byte_8( ARG(), S.reg[S.r] ); | |
| 1383 | io_write_byte_8le( ARG(), S.reg[S.r] ); | |
| 1384 | 1384 | break; |
| 1385 | 1385 | |
| 1386 | 1386 | case 0xd8: /* BIRR,0 (*)a */ |
| r2375 | r2376 | |
| 1438 | 1438 | case 0xf2: /* WRTD,2 */ |
| 1439 | 1439 | case 0xf3: /* WRTD,3 */ |
| 1440 | 1440 | s2650_ICount -= 6; |
| 1441 | io_write_byte_8(S2650_DATA_PORT, S.reg[S.r]); | |
| 1441 | io_write_byte_8le(S2650_DATA_PORT, S.reg[S.r]); | |
| 1442 | 1442 | break; |
| 1443 | 1443 | |
| 1444 | 1444 | case 0xf4: /* TMI,0 v */ |
| r2375 | r2376 | |
|---|---|---|
| 385 | 385 | #define SAME_SRCF_DST (decode)->same_srcf_dst |
| 386 | 386 | |
| 387 | 387 | #if (HAS_E116T || HAS_E116XT || HAS_E116XS || HAS_E116XSR || HAS_GMS30C2116 || HAS_GMS30C2216) |
| 388 | static UINT32 program_read_dword_16be(offs_t address) | |
| 388 | static UINT32 internal_program_read_dword_16be(offs_t address) | |
| 389 | 389 | { |
| 390 | 390 | return (program_read_word_16be(address & ~1) << 16) | program_read_word_16be((address & ~1) + 2); |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | static void program_write_dword_16be(offs_t address, UINT32 data) | |
| 393 | static void internal_program_write_dword_16be(offs_t address, UINT32 data) | |
| 394 | 394 | { |
| 395 | 395 | program_write_word_16be(address & ~1, (data & 0xffff0000)>>16); |
| 396 | 396 | program_write_word_16be((address & ~1)+2, data & 0xffff); |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | static UINT32 io_read_dword_16be(offs_t address) | |
| 399 | static UINT32 internal_io_read_dword_16be(offs_t address) | |
| 400 | 400 | { |
| 401 | 401 | return (io_read_word_16be(address & ~1)<< 16) | io_read_word_16be((address & ~1) + 2); |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | static void io_write_dword_16be(offs_t address, UINT32 data) | |
| 404 | static void internal_io_write_dword_16be(offs_t address, UINT32 data) | |
| 405 | 405 | { |
| 406 | 406 | io_write_word_16be(address & ~1, (data & 0xffff0000)>>16); |
| 407 | 407 | io_write_word_16be((address & ~1)+2, data & 0xffff); |
| r2375 | r2376 | |
| 1586 | 1586 | { |
| 1587 | 1587 | hyp_cpu_read_byte = program_read_byte_16be; |
| 1588 | 1588 | hyp_cpu_read_half_word = program_read_word_16be; |
| 1589 | hyp_cpu_read_word = program_read_dword_16be; | |
| 1590 | hyp_cpu_read_io_word = io_read_dword_16be; | |
| 1589 | hyp_cpu_read_word = internal_program_read_dword_16be; | |
| 1590 | hyp_cpu_read_io_word = internal_io_read_dword_16be; | |
| 1591 | 1591 | |
| 1592 | 1592 | hyp_cpu_write_byte = program_write_byte_16be; |
| 1593 | 1593 | hyp_cpu_write_half_word = program_write_word_16be; |
| 1594 | hyp_cpu_write_word = program_write_dword_16be; | |
| 1595 | hyp_cpu_write_io_word = io_write_dword_16be; | |
| 1594 | hyp_cpu_write_word = internal_program_write_dword_16be; | |
| 1595 | hyp_cpu_write_io_word = internal_io_write_dword_16be; | |
| 1596 | 1596 | |
| 1597 | 1597 | hyp_type_16bit = 1; |
| 1598 | 1598 |
| r2375 | r2376 | |
|---|---|---|
| 489 | 489 | |
| 490 | 490 | /*************************************************************************/ |
| 491 | 491 | |
| 492 | static | |
| 492 | static STATE_POSTLOAD( i386_postload | |
| 493 | 493 | { |
| 494 | 494 | int i; |
| 495 | 495 | for (i = 0; i < 6; i++) |
| r2375 | r2376 | |
| 581 | 581 | state_save_register_item(state_type, index, I.ldtr.flags); |
| 582 | 582 | state_save_register_item(state_type, index, I.irq_state); |
| 583 | 583 | state_save_register_item(state_type, index, I.performed_intersegment_jump); |
| 584 | state_save_register_ | |
| 584 | state_save_register_ | |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | static void build_opcode_table(UINT32 features) |
| r2375 | r2376 | |
|---|---|---|
| 12 | 12 | #define INSTRUCTION(mnemonic) INLINE void (mnemonic)(UINT8 opcode) |
| 13 | 13 | |
| 14 | 14 | #define ROM(addr) cpu_readop(addr) |
| 15 | #define RAM_W(addr, value) (data_write_byte_8(addr, value)) | |
| 16 | #define RAM_R(addr) (data_read_byte_8(addr)) | |
| 15 | #define RAM_W(addr, value) (data_write_byte_8le(addr, value)) | |
| 16 | #define RAM_R(addr) (data_read_byte_8le(addr)) | |
| 17 | 17 | |
| 18 | #define IN(addr) io_read_byte_8(addr) | |
| 19 | #define OUT(addr, value) io_write_byte_8(addr, value) | |
| 18 | #define IN(addr) io_read_byte_8le(addr) | |
| 19 | #define OUT(addr, value) io_write_byte_8le(addr, value) | |
| 20 | 20 | |
| 21 | 21 | #define A R.A |
| 22 | 22 | #define B R.B |
| r2375 | r2376 | |
|---|---|---|
| 66 | 66 | |
| 67 | 67 | #define PEEK_OP() cpu_readop(PCW) |
| 68 | 68 | |
| 69 | #define RDMEM(addr) program_read_byte_8(addr); m65ce02_ICount -= 1 | |
| 70 | #define WRMEM(addr,data) program_write_byte_8(addr,data); m65ce02_ICount -= 1 | |
| 69 | #define RDMEM(addr) program_read_byte_8le(addr); m65ce02_ICount -= 1 | |
| 70 | #define WRMEM(addr,data) program_write_byte_8le(addr,data); m65ce02_ICount -= 1 | |
| 71 | 71 |
| r2375 | r2376 | |
|---|---|---|
| 55 | 55 | |
| 56 | 56 | #define PEEK_OP() cpu_readop(M4510_MEM(PCD)) |
| 57 | 57 | |
| 58 | #define RDMEM(addr) program_read_byte_8(addr); m4510_ICount -= 1 | |
| 59 | #define WRMEM(addr,data) program_write_byte_8(addr,data); m4510_ICount -= 1 | |
| 58 | #define RDMEM(addr) program_read_byte_8le(addr); m4510_ICount -= 1 | |
| 59 | #define WRMEM(addr,data) program_write_byte_8le(addr,data); m4510_ICount -= 1 | |
| 60 | 60 | |
| 61 | 61 | /*************************************************************** |
| 62 | 62 | * RDOP read an opcode |
| r2375 | r2376 | |
|---|---|---|
| 189 | 189 | OP(47) { RD_DUM; ILL; } /* 2 ILL / 5 RMB4 ZPG ?? */ |
| 190 | 190 | OP(67) { |
| 191 | 191 | int tmp; RD_IMM; |
| 192 | m6502.a=io_read_byte_8(0); | |
| 192 | m6502.a=io_read_byte_8le(0); | |
| 193 | 193 | |
| 194 | 194 | // logerror("%04x: VBL (0x67)\n",activecpu_get_pc()); |
| 195 | 195 | |
| r2375 | r2376 | |
| 275 | 275 | OP(4b) { int tmp; m6502_ICount -= 1; RD_IMM; |
| 276 | 276 | logerror("%04x: OP4B %02x\n",activecpu_get_pc(),tmp); |
| 277 | 277 | |
| 278 | // m6502.a=io_read_byte_8(0); | |
| 278 | // m6502.a=io_read_byte_8le(0); | |
| 279 | 279 | |
| 280 | 280 | //tilt?? |
| 281 | 281 | |
| r2375 | r2376 | |
| 367 | 367 | OP(8f) { int tmp; m6502_ICount -= 1; RD_IMM; |
| 368 | 368 | logerror("%04x: BANK (8F) %02x\n",activecpu_get_pc(),tmp); |
| 369 | 369 | |
| 370 | io_write_byte_8(0,tmp); | |
| 370 | io_write_byte_8le(0,tmp); | |
| 371 | 371 | |
| 372 | 372 | //swap bank in/out |
| 373 | 373 |
| r2375 | r2376 | |
|---|---|---|
| 173 | 173 | #define M4510 |
| 174 | 174 | #include "t65ce02.c" |
| 175 | 175 | |
| 176 | static READ8_HANDLER( default_rdmem_id ) { return program_read_byte_8(offset); } | |
| 177 | static WRITE8_HANDLER( default_wrmem_id ) { program_write_byte_8(offset, data); } | |
| 176 | static READ8_HANDLER( default_rdmem_id ) { return program_read_byte_8le(offset); } | |
| 177 | static WRITE8_HANDLER( default_wrmem_id ) { program_write_byte_8le(offset, data); } | |
| 178 | 178 | |
| 179 | 179 | static void m4510_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 180 | 180 | { |
| r2375 | r2376 | |
|---|---|---|
| 81 | 81 | /*************************************************************** |
| 82 | 82 | * RDMEM read memory |
| 83 | 83 | ***************************************************************/ |
| 84 | #define RDMEM(addr) program_read_byte_8(addr); m6502_ICount -= 1 | |
| 84 | #define RDMEM(addr) program_read_byte_8le(addr); m6502_ICount -= 1 | |
| 85 | 85 | |
| 86 | 86 | /*************************************************************** |
| 87 | 87 | * WRMEM write memory |
| 88 | 88 | ***************************************************************/ |
| 89 | #define WRMEM(addr,data) program_write_byte_8(addr,data); m6502_ICount -= 1 | |
| 89 | #define WRMEM(addr,data) program_write_byte_8le(addr,data); m6502_ICount -= 1 | |
| 90 | 90 | |
| 91 | 91 | /*************************************************************** |
| 92 | 92 | * BRA branch relative |
| r2375 | r2376 | |
|---|---|---|
| 89 | 89 | |
| 90 | 90 | static m6502_Regs m6502; |
| 91 | 91 | |
| 92 | static READ8_HANDLER( default_rdmem_id ) { return program_read_byte_8(offset); } | |
| 93 | static WRITE8_HANDLER( default_wdmem_id ) { program_write_byte_8(offset, data); } | |
| 92 | static READ8_HANDLER( default_rdmem_id ) { return program_read_byte_8le(offset); } | |
| 93 | static WRITE8_HANDLER( default_wdmem_id ) { program_write_byte_8le(offset, data); } | |
| 94 | 94 | |
| 95 | 95 | /*************************************************************** |
| 96 | 96 | * include the opcode macros, functions and tables |
| r2375 | r2376 | |
|---|---|---|
| 52 | 52 | * RDMEM read memory |
| 53 | 53 | ***************************************************************/ |
| 54 | 54 | #undef RDMEM |
| 55 | #define RDMEM(addr) program_read_byte_8(addr); m6502_ICount -= 1 | |
| 55 | #define RDMEM(addr) program_read_byte_8le(addr); m6502_ICount -= 1 | |
| 56 | 56 | |
| 57 | 57 | /*************************************************************** |
| 58 | 58 | * WRMEM write memory |
| 59 | 59 | ***************************************************************/ |
| 60 | 60 | #undef WRMEM |
| 61 | #define WRMEM(addr,data) program_write_byte_8(addr,data); m6502_ICount -= 1 | |
| 61 | #define WRMEM(addr,data) program_write_byte_8le(addr,data); m6502_ICount -= 1 | |
| 62 | 62 | |
| 63 | 63 | /*************************************************************** |
| 64 | 64 | * push a register onto the stack |
| r2375 | r2376 | |
|---|---|---|
| 119 | 119 | AM_RANGE(0x00001, 0x00001) AM_MIRROR(0xF0000) AM_READWRITE(m6509_read_00001, m6509_write_00001) |
| 120 | 120 | ADDRESS_MAP_END |
| 121 | 121 | |
| 122 | static READ8_HANDLER( default_rdmem_id ) { return program_read_byte_8(offset); } | |
| 123 | static WRITE8_HANDLER( default_wdmem_id ) { program_write_byte_8(offset, data); } | |
| 122 | static READ8_HANDLER( default_rdmem_id ) { return program_read_byte_8le(offset); } | |
| 123 | static WRITE8_HANDLER( default_wdmem_id ) { program_write_byte_8le(offset, data); } | |
| 124 | 124 | |
| 125 | 125 | static void m6509_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 126 | 126 | { |
| r2375 | r2376 | |
|---|---|---|
| 91 | 91 | |
| 92 | 92 | static void m65ce02_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 93 | 93 | { |
| 94 | m65ce02.rdmem_id = program_read_byte_8; | |
| 95 | m65ce02.wrmem_id = program_write_byte_8; | |
| 94 | m65ce02.rdmem_id = program_read_byte_8le; | |
| 95 | m65ce02.wrmem_id = program_write_byte_8le; | |
| 96 | 96 | m65ce02.irq_callback = irqcallback; |
| 97 | 97 | } |
| 98 | 98 |
| r2375 | r2376 | |
|---|---|---|
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | static STATE_POSTLOAD( jaguar_postload ) | |
| 419 | { | |
| 420 | update_register_banks(); | |
| 421 | check_irqs(); | |
| 422 | } | |
| 423 | ||
| 418 | 424 | static void jaguar_state_register(int index, const char *type) |
| 419 | 425 | { |
| 420 | 426 | state_save_register_item_array(type, index, jaguar.r); |
| 421 | 427 | state_save_register_item_array(type, index, jaguar.a); |
| 422 | 428 | state_save_register_item_array(type, index, jaguar.ctrl); |
| 423 | 429 | state_save_register_item(type, index, jaguar.ppc); |
| 424 | state_save_register_func_postload(update_register_banks); | |
| 425 | state_save_register_func_postload(check_irqs); | |
| 430 | state_save_register_postload(Machine, jaguar_postload, NULL); | |
| 426 | 431 | } |
| 427 | 432 | |
| 428 | 433 | static void jaguargpu_init(int index, int clock, const void *_config, int (*irqcallback)(int)) |
| r2375 | r2376 | |
|---|---|---|
| 107 | 107 | |
| 108 | 108 | #define M_IN \ |
| 109 | 109 | I.XX.d=ARG(); \ |
| 110 | I.AF.b.h=io_read_byte_8(I.XX.d); | |
| 110 | I.AF.b.h=io_read_byte_8le(I.XX.d); | |
| 111 | 111 | |
| 112 | 112 | #define M_OUT \ |
| 113 | 113 | I.XX.d=ARG(); \ |
| 114 | io_write_byte_8(I.XX.d,I.AF.b.h) | |
| 114 | io_write_byte_8le(I.XX.d,I.AF.b.h) | |
| 115 | 115 | |
| 116 | 116 | #define M_DAD(R) { \ |
| 117 | 117 | int q = I.HL.d + I.R.d; \ |
| r2375 | r2376 | |
|---|---|---|
| 176 | 176 | |
| 177 | 177 | static UINT8 RM(UINT32 a) |
| 178 | 178 | { |
| 179 | return program_read_byte_8(a); | |
| 179 | return program_read_byte_8le(a); | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | static void WM(UINT32 a, UINT8 v) |
| 183 | 183 | { |
| 184 | program_write_byte_8(a, v); | |
| 184 | program_write_byte_8le(a, v); | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | INLINE void execute_one(int opcode) |
| r2375 | r2376 | |
|---|---|---|
| 233 | 233 | { |
| 234 | 234 | if( mode == 0 ) |
| 235 | 235 | { |
| 236 | return io_read_byte_8(addr); | |
| 236 | return io_read_byte_8le(addr); | |
| 237 | 237 | } |
| 238 | 238 | else |
| 239 | 239 | { |
| r2375 | r2376 | |
| 246 | 246 | { |
| 247 | 247 | if( mode == 0 ) |
| 248 | 248 | { |
| 249 | return io_read_byte_8((UINT16)(addr)) + | |
| 250 | (io_read_byte_8((UINT16)(addr+1)) << 8); | |
| 249 | return io_read_byte_8le((UINT16)(addr)) + | |
| 250 | (io_read_byte_8le((UINT16)(addr+1)) << 8); | |
| 251 | 251 | } |
| 252 | 252 | else |
| 253 | 253 | { |
| r2375 | r2376 | |
| 261 | 261 | { |
| 262 | 262 | if( mode == 0 ) |
| 263 | 263 | { |
| 264 | return io_read_byte_8((UINT16)(addr)) + | |
| 265 | (io_read_byte_8((UINT16)(addr+1)) << 8) + | |
| 266 | (io_read_byte_8((UINT16)(addr+2)) << 16) + | |
| 267 | (io_read_byte_8((UINT16)(addr+3)) << 24); | |
| 264 | return io_read_byte_8le((UINT16)(addr)) + | |
| 265 | (io_read_byte_8le((UINT16)(addr+1)) << 8) + | |
| 266 | (io_read_byte_8le((UINT16)(addr+2)) << 16) + | |
| 267 | (io_read_byte_8le((UINT16)(addr+3)) << 24); | |
| 268 | 268 | } |
| 269 | 269 | else |
| 270 | 270 | { |
| r2375 | r2376 | |
| 278 | 278 | { |
| 279 | 279 | if( mode == 0 ) |
| 280 | 280 | { |
| 281 | io_write_byte_8(addr,value); | |
| 281 | io_write_byte_8le(addr,value); | |
| 282 | 282 | } |
| 283 | 283 | else |
| 284 | 284 | { |
| r2375 | r2376 | |
| 290 | 290 | { |
| 291 | 291 | if( mode == 0 ) |
| 292 | 292 | { |
| 293 | io_write_byte_8((UINT16)(addr),value & 0xff); | |
| 294 | io_write_byte_8((UINT16)(addr+1),(value >> 8) & 0xff); | |
| 293 | io_write_byte_8le((UINT16)(addr),value & 0xff); | |
| 294 | io_write_byte_8le((UINT16)(addr+1),(value >> 8) & 0xff); | |
| 295 | 295 | } |
| 296 | 296 | else |
| 297 | 297 | { |
| r2375 | r2376 | |
| 304 | 304 | { |
| 305 | 305 | if( mode == 0 ) |
| 306 | 306 | { |
| 307 | io_write_byte_8((UINT16)(addr),value & 0xff); | |
| 308 | io_write_byte_8((UINT16)(addr+1),(value >> 8) & 0xff); | |
| 309 | io_write_byte_8((UINT16)(addr+2),(value >> 16) & 0xff); | |
| 310 | io_write_byte_8((UINT16)(addr+3),(value >> 24) & 0xff); | |
| 307 | io_write_byte_8le((UINT16)(addr),value & 0xff); | |
| 308 | io_write_byte_8le((UINT16)(addr+1),(value >> 8) & 0xff); | |
| 309 | io_write_byte_8le((UINT16)(addr+2),(value >> 16) & 0xff); | |
| 310 | io_write_byte_8le((UINT16)(addr+3),(value >> 24) & 0xff); | |
| 311 | 311 | } |
| 312 | 312 | else |
| 313 | 313 | { |
| r2375 | r2376 | |
|---|---|---|
| 61 | 61 | }; |
| 62 | 62 | |
| 63 | 63 | UINT8 sm85cpu_mem_readbyte( UINT32 offset ) { |
| 64 | return ( offset < 0x10 ) ? regs.register_base[offset] : program_read_byte_8( offset ); | |
| 64 | return ( offset < 0x10 ) ? regs.register_base[offset] : program_read_byte_8be( offset ); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | void sm85cpu_mem_writebyte( UINT32 offset, UINT8 data ) { |
| 68 | 68 | if ( offset < 0x10 ) { |
| 69 | 69 | regs.register_base[offset] = data; |
| 70 | 70 | } else { |
| 71 | program_write_byte_8( offset, data ); | |
| 71 | program_write_byte_8be( offset, data ); | |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 |
| r2375 | r2376 | |
|---|---|---|
| 68 | 68 | |
| 69 | 69 | #define READOP(a) (cpu_readop(a)) |
| 70 | 70 | |
| 71 | #define RDMEM(a) (data_read_byte_8(a)) | |
| 72 | #define WRMEM(a,v) (data_write_byte_8((a), (v))) | |
| 71 | #define RDMEM(a) (data_read_byte_8be(a)) | |
| 72 | #define WRMEM(a,v) (data_write_byte_8be((a), (v))) | |
| 73 | 73 | |
| 74 | #define READPORT(a) (io_read_byte_8(a)) | |
| 75 | #define WRITEPORT(a,v) (io_write_byte_8((a), (v))) | |
| 74 | #define READPORT(a) (io_read_byte_8be(a)) | |
| 75 | #define WRITEPORT(a,v) (io_write_byte_8be((a), (v))) | |
| 76 | 76 | |
| 77 | 77 | #define TEST_ST() (mb88.st & 1) |
| 78 | 78 | #define TEST_ZF() (mb88.zf & 1) |
| r2375 | r2376 | |
|---|---|---|
| 44 | 44 | /* |
| 45 | 45 | * Read a UINT8 from given memory location |
| 46 | 46 | */ |
| 47 | #define ALPHA8201_RDMEM(A) ((unsigned)program_read_byte_8(A)) | |
| 47 | #define ALPHA8201_RDMEM(A) ((unsigned)program_read_byte_8le(A)) | |
| 48 | 48 | |
| 49 | 49 | /* |
| 50 | 50 | * Write a UINT8 to given memory location |
| 51 | 51 | */ |
| 52 | #define ALPHA8201_WRMEM(A,V) (program_write_byte_8(A,V)) | |
| 52 | #define ALPHA8201_WRMEM(A,V) (program_write_byte_8le(A,V)) | |
| 53 | 53 | |
| 54 | 54 | /* |
| 55 | 55 | * ALPHA8201_RDOP() is identical to ALPHA8201_RDMEM() except it is used for reading |
| r2375 | r2376 | |
|---|---|---|
| 448 | 448 | |
| 449 | 449 | static int papertape_read(void) |
| 450 | 450 | { |
| 451 | return io_read_byte_8(0) & 0x1f; | |
| 451 | return io_read_byte_8be(0) & 0x1f; | |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | static void papertape_punch(int data) |
| 455 | 455 | { |
| 456 | io_write_byte_8(0, data); | |
| 456 | io_write_byte_8be(0, data); | |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /* |
| r2375 | r2376 | |
|---|---|---|
| 91 | 91 | #undef G65816_CALL_DEBUGGER |
| 92 | 92 | #define G65816_CALL_DEBUGGER CALL_DEBUGGER |
| 93 | 93 | |
| 94 | #define g65816_read_8(addr) program_read_byte_8(addr) | |
| 95 | #define g65816_write_8(addr,data) program_write_byte_8(addr,data) | |
| 96 | #define g65816_read_8_immediate(A) program_read_byte_8(A) | |
| 94 | #define g65816_read_8(addr) program_read_byte_8be(addr) | |
| 95 | #define g65816_write_8(addr,data) program_write_byte_8be(addr,data) | |
| 96 | #define g65816_read_8_immediate(A) program_read_byte_8be(A) | |
| 97 | 97 | #define g65816_jumping(A) change_pc(A) |
| 98 | 98 | #define g65816_branching(A) |
| 99 | 99 |
| r2375 | r2376 | |
|---|---|---|
| 121 | 121 | NULL |
| 122 | 122 | }; |
| 123 | 123 | |
| 124 | extern int necv_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom); | |
| 124 | extern int necv_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom, const nec_config *config); | |
| 125 | 125 | |
| 126 | 126 | /* NEC registers */ |
| 127 | 127 | typedef union |
| r2375 | r2376 | |
| 320 | 320 | |
| 321 | 321 | #define OP(num,func_name) static void func_name(void) |
| 322 | 322 | |
| 323 | OP( 0x00, i_add_br8 ) { DEF_br8; ADDB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,1 | |
| 323 | OP( 0x00, i_add_br8 ) { DEF_br8; ADDB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,16,7); } | |
| 324 | 324 | OP( 0x01, i_add_wr16 ) { DEF_wr16; ADDW; PutbackRMWord(ModRM,dst); CLKR(24,24,11,24,16,7,2,EA);} |
| 325 | OP( 0x02, i_add_r8b ) { DEF_r8b; ADDB; RegByte(ModRM)=dst; CLKM(2,2,2,11,1 | |
| 325 | OP( 0x02, i_add_r8b ) { DEF_r8b; ADDB; RegByte(ModRM)=dst; CLKM(2,2,2,11,11,6); } | |
| 326 | 326 | OP( 0x03, i_add_r16w ) { DEF_r16w; ADDW; RegWord(ModRM)=dst; CLKR(15,15,8,15,11,6,2,EA); } |
| 327 | 327 | OP( 0x04, i_add_ald8 ) { DEF_ald8; ADDB; I.regs.b[AL]=dst; CLKS(4,4,2); } |
| 328 | 328 | OP( 0x05, i_add_axd16) { DEF_axd16; ADDW; I.regs.w[AW]=dst; CLKS(4,4,2); } |
| 329 | 329 | OP( 0x06, i_push_es ) { PUSH(I.sregs[DS1]); CLKS(12,8,3); } |
| 330 | 330 | OP( 0x07, i_pop_es ) { POP(I.sregs[DS1]); CLKS(12,8,5); } |
| 331 | 331 | |
| 332 | OP( 0x08, i_or_br8 ) { DEF_br8; ORB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,1 | |
| 332 | OP( 0x08, i_or_br8 ) { DEF_br8; ORB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,16,7); } | |
| 333 | 333 | OP( 0x09, i_or_wr16 ) { DEF_wr16; ORW; PutbackRMWord(ModRM,dst); CLKR(24,24,11,24,16,7,2,EA);} |
| 334 | OP( 0x0a, i_or_r8b ) { DEF_r8b; ORB; RegByte(ModRM)=dst; CLKM(2,2,2,11,1 | |
| 334 | OP( 0x0a, i_or_r8b ) { DEF_r8b; ORB; RegByte(ModRM)=dst; CLKM(2,2,2,11,11,6); } | |
| 335 | 335 | OP( 0x0b, i_or_r16w ) { DEF_r16w; ORW; RegWord(ModRM)=dst; CLKR(15,15,8,15,11,6,2,EA); } |
| 336 | 336 | OP( 0x0c, i_or_ald8 ) { DEF_ald8; ORB; I.regs.b[AL]=dst; CLKS(4,4,2); } |
| 337 | 337 | OP( 0x0d, i_or_axd16 ) { DEF_axd16; ORW; I.regs.w[AW]=dst; CLKS(4,4,2); } |
| 338 | OP( 0x0e, i_push_cs ) { PUSH(I.sregs[PS]); CLKS(12,8, | |
| 338 | OP( 0x0e, i_push_cs ) { PUSH(I.sregs[PS]); CLKS(12,8,3); } | |
| 339 | 339 | OP( 0x0f, i_pre_nec ) { UINT32 ModRM, tmp, tmp2; |
| 340 | 340 | switch (FETCH) { |
| 341 | 341 | case 0x10 : BITOP_BYTE; CLKS(3,3,4); tmp2 = I.regs.b[CL] & 0x7; I.ZeroVal = (tmp & (1<<tmp2)) ? 1 : 0; I.CarryVal=I.OverVal=0; break; /* Test */ |
| r2375 | r2376 | |
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | OP( 0x10, i_adc_br8 ) { DEF_br8; src+=CF; ADDB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,1 | |
| 374 | OP( 0x10, i_adc_br8 ) { DEF_br8; src+=CF; ADDB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,16,7); } | |
| 375 | 375 | OP( 0x11, i_adc_wr16 ) { DEF_wr16; src+=CF; ADDW; PutbackRMWord(ModRM,dst); CLKR(24,24,11,24,16,7,2,EA);} |
| 376 | OP( 0x12, i_adc_r8b ) { DEF_r8b; src+=CF; ADDB; RegByte(ModRM)=dst; CLKM(2,2,2,11,1 | |
| 376 | OP( 0x12, i_adc_r8b ) { DEF_r8b; src+=CF; ADDB; RegByte(ModRM)=dst; CLKM(2,2,2,11,11,6); } | |
| 377 | 377 | OP( 0x13, i_adc_r16w ) { DEF_r16w; src+=CF; ADDW; RegWord(ModRM)=dst; CLKR(15,15,8,15,11,6,2,EA); } |
| 378 | 378 | OP( 0x14, i_adc_ald8 ) { DEF_ald8; src+=CF; ADDB; I.regs.b[AL]=dst; CLKS(4,4,2); } |
| 379 | 379 | OP( 0x15, i_adc_axd16) { DEF_axd16; src+=CF; ADDW; I.regs.w[AW]=dst; CLKS(4,4,2); } |
| 380 | 380 | OP( 0x16, i_push_ss ) { PUSH(I.sregs[SS]); CLKS(12,8,3); } |
| 381 | 381 | OP( 0x17, i_pop_ss ) { POP(I.sregs[SS]); CLKS(12,8,5); I.no_interrupt=1; } |
| 382 | 382 | |
| 383 | OP( 0x18, i_sbb_br8 ) { DEF_br8; src+=CF; SUBB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,1 | |
| 383 | OP( 0x18, i_sbb_br8 ) { DEF_br8; src+=CF; SUBB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,16,7); } | |
| 384 | 384 | OP( 0x19, i_sbb_wr16 ) { DEF_wr16; src+=CF; SUBW; PutbackRMWord(ModRM,dst); CLKR(24,24,11,24,16,7,2,EA);} |
| 385 | OP( 0x1a, i_sbb_r8b ) { DEF_r8b; src+=CF; SUBB; RegByte(ModRM)=dst; CLKM(2,2,2,11,1 | |
| 385 | OP( 0x1a, i_sbb_r8b ) { DEF_r8b; src+=CF; SUBB; RegByte(ModRM)=dst; CLKM(2,2,2,11,11,6); } | |
| 386 | 386 | OP( 0x1b, i_sbb_r16w ) { DEF_r16w; src+=CF; SUBW; RegWord(ModRM)=dst; CLKR(15,15,8,15,11,6,2,EA); } |
| 387 | 387 | OP( 0x1c, i_sbb_ald8 ) { DEF_ald8; src+=CF; SUBB; I.regs.b[AL]=dst; CLKS(4,4,2); } |
| 388 | 388 | OP( 0x1d, i_sbb_axd16) { DEF_axd16; src+=CF; SUBW; I.regs.w[AW]=dst; CLKS(4,4,2); } |
| 389 | 389 | OP( 0x1e, i_push_ds ) { PUSH(I.sregs[DS0]); CLKS(12,8,3); } |
| 390 | 390 | OP( 0x1f, i_pop_ds ) { POP(I.sregs[DS0]); CLKS(12,8,5); } |
| 391 | 391 | |
| 392 | OP( 0x20, i_and_br8 ) { DEF_br8; ANDB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,1 | |
| 392 | OP( 0x20, i_and_br8 ) { DEF_br8; ANDB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,16,7); } | |
| 393 | 393 | OP( 0x21, i_and_wr16 ) { DEF_wr16; ANDW; PutbackRMWord(ModRM,dst); CLKR(24,24,11,24,16,7,2,EA);} |
| 394 | OP( 0x22, i_and_r8b ) { DEF_r8b; ANDB; RegByte(ModRM)=dst; CLKM(2,2,2,11,1 | |
| 394 | OP( 0x22, i_and_r8b ) { DEF_r8b; ANDB; RegByte(ModRM)=dst; CLKM(2,2,2,11,11,6); } | |
| 395 | 395 | OP( 0x23, i_and_r16w ) { DEF_r16w; ANDW; RegWord(ModRM)=dst; CLKR(15,15,8,15,11,6,2,EA); } |
| 396 | 396 | OP( 0x24, i_and_ald8 ) { DEF_ald8; ANDB; I.regs.b[AL]=dst; CLKS(4,4,2); } |
| 397 | 397 | OP( 0x25, i_and_axd16) { DEF_axd16; ANDW; I.regs.w[AW]=dst; CLKS(4,4,2); } |
| 398 | 398 | OP( 0x26, i_es ) { seg_prefix=TRUE; prefix_base=I.sregs[DS1]<<4; CLK(2); nec_instruction[fetchop()](); seg_prefix=FALSE; } |
| 399 | 399 | OP( 0x27, i_daa ) { ADJ4(6,0x60); CLKS(3,3,2); } |
| 400 | 400 | |
| 401 | OP( 0x28, i_sub_br8 ) { DEF_br8; SUBB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,1 | |
| 401 | OP( 0x28, i_sub_br8 ) { DEF_br8; SUBB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,16,7); } | |
| 402 | 402 | OP( 0x29, i_sub_wr16 ) { DEF_wr16; SUBW; PutbackRMWord(ModRM,dst); CLKR(24,24,11,24,16,7,2,EA);} |
| 403 | OP( 0x2a, i_sub_r8b ) { DEF_r8b; SUBB; RegByte(ModRM)=dst; CLKM(2,2,2,11,1 | |
| 403 | OP( 0x2a, i_sub_r8b ) { DEF_r8b; SUBB; RegByte(ModRM)=dst; CLKM(2,2,2,11,11,6); } | |
| 404 | 404 | OP( 0x2b, i_sub_r16w ) { DEF_r16w; SUBW; RegWord(ModRM)=dst; CLKR(15,15,8,15,11,6,2,EA); } |
| 405 | 405 | OP( 0x2c, i_sub_ald8 ) { DEF_ald8; SUBB; I.regs.b[AL]=dst; CLKS(4,4,2); } |
| 406 | 406 | OP( 0x2d, i_sub_axd16) { DEF_axd16; SUBW; I.regs.w[AW]=dst; CLKS(4,4,2); } |
| 407 | 407 | OP( 0x2e, i_cs ) { seg_prefix=TRUE; prefix_base=I.sregs[PS]<<4; CLK(2); nec_instruction[fetchop()](); seg_prefix=FALSE; } |
| 408 | 408 | OP( 0x2f, i_das ) { ADJ4(-6,-0x60); CLKS(3,3,2); } |
| 409 | 409 | |
| 410 | OP( 0x30, i_xor_br8 ) { DEF_br8; XORB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,1 | |
| 410 | OP( 0x30, i_xor_br8 ) { DEF_br8; XORB; PutbackRMByte(ModRM,dst); CLKM(2,2,2,16,16,7); } | |
| 411 | 411 | OP( 0x31, i_xor_wr16 ) { DEF_wr16; XORW; PutbackRMWord(ModRM,dst); CLKR(24,24,11,24,16,7,2,EA);} |
| 412 | OP( 0x32, i_xor_r8b ) { DEF_r8b; XORB; RegByte(ModRM)=dst; CLKM(2,2,2,11,1 | |
| 412 | OP( 0x32, i_xor_r8b ) { DEF_r8b; XORB; RegByte(ModRM)=dst; CLKM(2,2,2,11,11,6); } | |
| 413 | 413 | OP( 0x33, i_xor_r16w ) { DEF_r16w; XORW; RegWord(ModRM)=dst; CLKR(15,15,8,15,11,6,2,EA); } |
| 414 | 414 | OP( 0x34, i_xor_ald8 ) { DEF_ald8; XORB; I.regs.b[AL]=dst; CLKS(4,4,2); } |
| 415 | 415 | OP( 0x35, i_xor_axd16) { DEF_axd16; XORW; I.regs.w[AW]=dst; CLKS(4,4,2); } |
| 416 | 416 | OP( 0x36, i_ss ) { seg_prefix=TRUE; prefix_base=I.sregs[SS]<<4; CLK(2); nec_instruction[fetchop()](); seg_prefix=FALSE; } |
| 417 | 417 | OP( 0x37, i_aaa ) { ADJB(6, (I.regs.b[AL] > 0xf9) ? 2 : 1); CLKS(7,7,4); } |
| 418 | 418 | |
| 419 | OP( 0x38, i_cmp_br8 ) { DEF_br8; SUBB; CLKM(2,2,2,11,1 | |
| 419 | OP( 0x38, i_cmp_br8 ) { DEF_br8; SUBB; CLKM(2,2,2,11,11,6); } | |
| 420 | 420 | OP( 0x39, i_cmp_wr16 ) { DEF_wr16; SUBW; CLKR(15,15,8,15,11,6,2,EA);} |
| 421 | OP( 0x3a, i_cmp_r8b ) { DEF_r8b; SUBB; CLKM(2,2,2,11,1 | |
| 421 | OP( 0x3a, i_cmp_r8b ) { DEF_r8b; SUBB; CLKM(2,2,2,11,11,6); } | |
| 422 | 422 | OP( 0x3b, i_cmp_r16w ) { DEF_r16w; SUBW; CLKR(15,15,8,15,11,6,2,EA); } |
| 423 | 423 | OP( 0x3c, i_cmp_ald8 ) { DEF_ald8; SUBB; CLKS(4,4,2); } |
| 424 | 424 | OP( 0x3d, i_cmp_axd16) { DEF_axd16; SUBW; CLKS(4,4,2); } |
| r2375 | r2376 | |
| 1043 | 1043 | #ifdef ENABLE_DEBUGGER |
| 1044 | 1044 | static offs_t nec_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) |
| 1045 | 1045 | { |
| 1046 | return necv_dasm_one(buffer, pc, oprom); | |
| 1046 | return necv_dasm_one(buffer, pc, oprom, I.config); | |
| 1047 | 1047 | } |
| 1048 | 1048 | #endif /* ENABLE_DEBUGGER */ |
| 1049 | 1049 | |
| r2375 | r2376 | |
| 1086 | 1086 | *****************************************************************************/ |
| 1087 | 1087 | |
| 1088 | 1088 | #if (HAS_V20||HAS_V25) |
| 1089 | static UINT16 read_word_8(offs_t addr) | |
| 1090 | { | |
| 1091 | UINT16 result = program_read_byte_8(addr); | |
| 1092 | return result | (program_read_byte_8(addr + 1) << 8); | |
| 1093 | } | |
| 1094 | ||
| 1095 | static void write_word_8(offs_t addr, UINT16 data) | |
| 1096 | { | |
| 1097 | program_write_byte_8(addr, data); | |
| 1098 | program_write_byte_8(addr + 1, data >> 8); | |
| 1099 | } | |
| 1100 | ||
| 1101 | static UINT16 read_port_word_8(offs_t addr) | |
| 1102 | { | |
| 1103 | UINT16 result = io_read_byte_8(addr); | |
| 1104 | return result | (io_read_byte_8(addr + 1) << 8); | |
| 1105 | } | |
| 1106 | ||
| 1107 | static void write_port_word_8(offs_t addr, UINT16 data) | |
| 1108 | { | |
| 1109 | io_write_byte_8(addr, data); | |
| 1110 | io_write_byte_8(addr + 1, data >> 8); | |
| 1111 | } | |
| 1112 | ||
| 1113 | 1089 | static void configure_memory_8bit(void) |
| 1114 | 1090 | { |
| 1115 | 1091 | I.mem.fetch_xor = 0; |
| 1116 | 1092 | |
| 1117 | I.mem.rbyte = program_read_byte_8; | |
| 1118 | I.mem.rword = read_word_8; | |
| 1119 | I.mem.wbyte = program_write_byte_8; | |
| 1120 | I.mem.wword = write_word_8; | |
| 1093 | I.mem.rbyte = program_read_byte_8le; | |
| 1094 | I.mem.rword = program_read_word_8le; | |
| 1095 | I.mem.wbyte = program_write_byte_8le; | |
| 1096 | I.mem.wword = program_write_word_8le; | |
| 1121 | 1097 | |
| 1122 | I.mem.rbyte_port = io_read_byte_8; | |
| 1123 | I.mem.rword_port = read_port_word_8; | |
| 1124 | I.mem.wbyte_port = io_write_byte_8; | |
| 1125 | I.mem.wword_port = write_port_word_8; | |
| 1098 | I.mem.rbyte_port = io_read_byte_8le; | |
| 1099 | I.mem.rword_port = io_read_word_8le; | |
| 1100 | I.mem.wbyte_port = io_write_byte_8le; | |
| 1101 | I.mem.wword_port = io_write_word_8le; | |
| 1126 | 1102 | } |
| 1127 | 1103 | #endif |
| 1128 | 1104 |
| r2375 | r2376 | |
|---|---|---|
| 7 | 7 | |
| 8 | 8 | #include "cpuintrf.h" |
| 9 | 9 | |
| 10 | typedef struct _nec_config nec_config; | |
| 11 | struct _nec_config | |
| 12 | { | |
| 13 | const UINT8* v25v35_decryptiontable; // internal decryption table | |
| 14 | }; | |
| 15 | ||
| 16 | /* default configuration */ | |
| 17 | static const nec_config default_config = | |
| 18 | { | |
| 19 | NULL | |
| 20 | }; | |
| 21 | ||
| 22 | static const nec_config *Iconfig; | |
| 23 | ||
| 10 | 24 | enum { |
| 11 | 25 | PARAM_REG8 = 1, /* 8-bit register */ |
| 12 | 26 | PARAM_REG16, /* 16-bit register */ |
| r2375 | r2376 | |
| 1437 | 1451 | } |
| 1438 | 1452 | } |
| 1439 | 1453 | |
| 1440 | static void decode_opcode(char *s, const I386_OPCODE *op, UINT8 op1) | |
| 1454 | static void decode_opcode(char *s, const I386_OPCODE *op, UINT8 op1 ) | |
| 1441 | 1455 | { |
| 1442 | 1456 | int i; |
| 1443 | 1457 | UINT8 op2; |
| r2375 | r2376 | |
| 1455 | 1469 | case SEG_SS: |
| 1456 | 1470 | segment = op->flags; |
| 1457 | 1471 | op2 = FETCH(); |
| 1472 | if (Iconfig->v25v35_decryptiontable) op2 = Iconfig->v25v35_decryptiontable[op2]; | |
| 1458 | 1473 | decode_opcode( s, &necv_opcode_table1[op2], op1 ); |
| 1459 | 1474 | return; |
| 1460 | 1475 | |
| 1461 | 1476 | case PREFIX: |
| 1462 | 1477 | s += sprintf( s, "%-8s", op->mnemonic ); |
| 1463 | 1478 | op2 = FETCH(); |
| 1479 | if (Iconfig->v25v35_decryptiontable) op2 = Iconfig->v25v35_decryptiontable[op2]; | |
| 1464 | 1480 | decode_opcode( s, &necv_opcode_table1[op2], op1 ); |
| 1465 | 1481 | return; |
| 1466 | 1482 | |
| 1467 | 1483 | case GROUP: |
| 1468 | 1484 | handle_modrm( modrm_string ); |
| 1469 | 1485 | for( i=0; i < ARRAY_LENGTH(group_op_table); i++ ) { |
| 1470 | if( mame_stricmp(op->mnemonic, group_op_table[i].mnemonic) == 0 ) { | |
| 1486 | if( mame_stricmp(op->mnemonic, group_op_table[i].mnemonic) == 0 ) | |
| 1487 | { | |
| 1471 | 1488 | decode_opcode( s, &group_op_table[i].opcode[MODRM_REG1], op1 ); |
| 1472 | 1489 | return; |
| 1473 | 1490 | } |
| r2375 | r2376 | |
| 1506 | 1523 | sprintf(s, "???"); |
| 1507 | 1524 | } |
| 1508 | 1525 | |
| 1509 | int necv_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom) | |
| 1526 | int necv_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom, const nec_config *_config) | |
| 1510 | 1527 | { |
| 1511 | 1528 | UINT8 op; |
| 1529 | const nec_config *config = _config ? _config : &default_config; | |
| 1530 | Iconfig = config; | |
| 1512 | 1531 | |
| 1513 | 1532 | opcode_ptr = opcode_ptr_base = oprom; |
| 1514 | 1533 | pc = eip; |
| r2375 | r2376 | |
| 1517 | 1536 | |
| 1518 | 1537 | op = FETCH(); |
| 1519 | 1538 | |
| 1539 | if (Iconfig->v25v35_decryptiontable) op = Iconfig->v25v35_decryptiontable[op]; | |
| 1540 | ||
| 1520 | 1541 | decode_opcode( buffer, &necv_opcode_table1[op], op ); |
| 1521 | 1542 | return (pc-eip) | dasm_flags | DASMFLAG_SUPPORTED; |
| 1522 | 1543 | } |
| r2375 | r2376 | |
|---|---|---|
| 191 | 191 | * Read a byte from External Code Memory (Usually Program Rom(s) Space) |
| 192 | 192 | ***************************************************************************** |
| 193 | 193 | This area is mapped from 0-FFFF internally (64K) */ |
| 194 | #define CODEMEM_R(a) (UINT8)program_read_byte_8(a) | |
| 194 | #define CODEMEM_R(a) (UINT8)program_read_byte_8le(a) | |
| 195 | 195 | /***************************************************************************** |
| 196 | 196 | * Read/Write a byte from/to External Data Memory (Usually RAM or other I/O) |
| 197 | 197 | ***************************************************************************** |
| r2375 | r2376 | |
| 202 | 202 | addresses, w/o any contention. |
| 203 | 203 | As far as the 8051 program code which is executing knows data memory still lives |
| 204 | 204 | in the 0-FFFF range.*/ |
| 205 | #define DATAMEM_R(a) (UINT8)data_read_byte_8(a) | |
| 206 | #define DATAMEM_W(a,v) data_write_byte_8(a,v) | |
| 205 | #define DATAMEM_R(a) (UINT8)data_read_byte_8le(a) | |
| 206 | #define DATAMEM_W(a,v) data_write_byte_8le(a,v) | |
| 207 | 207 | |
| 208 | 208 | /*************************************************************** |
| 209 | 209 | * Read/Write a byte from/to the Internal RAM |
| r2375 | r2376 | |
|---|---|---|
| 1 | 1 | ..\..\..\..\dismips.exe: dismips.c mipsdasm.c r3kdasm.c mips3dsm.c ../../../lib/util/corestr.c |
| 2 | gcc -O3 -Wall -I../../../emu -I../../../ | |
| 2 | gcc -O3 -Wall -I../../../emu -I../../../osd |
| r2375 | r2376 | |
|---|---|---|
| 109 | 109 | #define EXCEPTION_BADCOP 11 |
| 110 | 110 | #define EXCEPTION_OVERFLOW 12 |
| 111 | 111 | #define EXCEPTION_TRAP 13 |
| 112 | #define EXCEPTION_COUNT 16 | |
| 112 | 113 | |
| 113 | 114 | |
| 114 | 115 |
| r2375 | r2376 | |
|---|---|---|
| 291 | 291 | case 0x08: /* JR */ |
| 292 | 292 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 293 | 293 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 294 | desc->targetpc = BRANCH_TARGET_DYNAMIC; | |
| 294 | 295 | desc->delayslots = 1; |
| 295 | 296 | return TRUE; |
| 296 | 297 | |
| r2375 | r2376 | |
| 298 | 299 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 299 | 300 | desc->gpr.modified |= REGFLAG_R(RDREG); |
| 300 | 301 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 302 | desc->targetpc = BRANCH_TARGET_DYNAMIC; | |
| 301 | 303 | desc->delayslots = 1; |
| 302 | 304 | return TRUE; |
| 303 | 305 |
| r2375 | r2376 | |
|---|---|---|
| 42 | 42 | |
| 43 | 43 | static UINT8 *filebuf; |
| 44 | 44 | static UINT32 offset; |
| 45 | static | |
| 45 | static | |
| 46 | 46 | |
| 47 | 47 | static const char *const Options[]= |
| 48 | 48 | { |
| r2375 | r2376 | |
| 308 | 308 | break; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | i &= DASMFLAG_LENGTHMASK; | |
| 312 | ||
| 311 | 313 | printf( "%08x: ", pc + offset ); |
| 312 | 314 | for( j = 0; j < i; j++ ) |
| 313 | 315 | { |
| r2375 | r2376 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | * Son | |
| 2 | * PlayStation | |
| 3 | 3 | * |
| 4 | * PSX CPU emulator for the MAME project written by smf | |
| 5 | * Thanks to Farfetch'd for information on the delay slot bug | |
| 4 | * Licensed to the MAME Team for distribution under the MAME license. | |
| 6 | 5 | * |
| 7 | * The PSX CPU is a custom r3000a with a built in | |
| 8 | * geometry transform engine, no mmu & no data cache. | |
| 6 | * Known chip id's | |
| 7 | * CXD8530AQ | |
| 8 | * CXD8530BQ | |
| 9 | * CXD8530CQ | |
| 10 | * CXD8661R | |
| 11 | * CXD8606BQ | |
| 12 | * CXD8606CQ | |
| 9 | 13 | * |
| 10 | * There is a stall circuit for load delays, but | |
| 11 | * it doesn't work if the load occurs in a branch | |
| 12 | * delay slot. | |
| 14 | * The PlayStation CPU is based on the LSI LR33300. | |
| 13 | 15 | * |
| 16 | * Differences from the LR33300: | |
| 17 | * | |
| 18 | * There is only 1k of data cache ram ( the LR33300 has 2k ) | |
| 19 | * | |
| 20 | * There is no data cache tag ram, so the data cache ram can only be used as a fast area | |
| 21 | * of ram ( which is a standard LR33300 feature ). | |
| 22 | * | |
| 23 | * If COP0 is disabled in user mode you get a coprocessor unusable exception, while | |
| 24 | * the LR33300 is documented to generate a reserved instruction exception. | |
| 25 | * | |
| 26 | * Known limitations of the emulation: | |
| 27 | * | |
| 28 | * Only read & write break points are emulated, trace and program counter breakpoints are not. | |
| 29 | * | |
| 30 | * Load/Store timings are based on load scheduling turned off & no write cache. This affects when | |
| 31 | * bus error exceptions occur and also when the read & write handlers are called. A scheduled | |
| 32 | * load will complete if a load breakpoint fires, but an unscheduled load will not. | |
| 33 | * | |
| 34 | * Reading from the data and instruction cache at the same time causes a bus conflict that | |
| 35 | * corrupts the data in a reliable but strange way, which is not emulated. | |
| 36 | * | |
| 37 | * Values written to COP1 & COP3 can be read back by the next instruction, which is not emulated. | |
| 38 | * Because of loadscheduling the value loaded with LWC1/LWC3 can be read by more than the next | |
| 39 | * instruction. | |
| 40 | * | |
| 41 | * SWC0 writes stale data from a previous operation, this is only partially emulated as the timing | |
| 42 | * is complicated. Left over instruction fetches are currently emulated as they are the most | |
| 43 | * 'interesting' and have no impact on the rest of the emulation. | |
| 44 | * | |
| 45 | * MTC0 timing is not emulated, switching to user mode while in kernel space continues | |
| 46 | * execution for another two instructions before taking an exception. Using RFE to do the same | |
| 47 | * thing causes the exception straight away, unless the RFE is the first instructio that follows | |
| 48 | * an MTC0 instruction. | |
| 49 | * | |
| 50 | * The PRId register should be 1 on some revisions of the CPU ( there might be other values too ). | |
| 51 | * | |
| 52 | * Moving to the HI/LO register after a multiply or divide, but before reading the results will | |
| 53 | * always abort the operation as if you did it immediately. In reality it should complete on it's | |
| 54 | * own, and aborting before it completes would result in returning the working results. | |
| 55 | * | |
| 56 | * Running code in cached address space does not use or update the instruction cache. | |
| 57 | * | |
| 58 | * Wait states are not emulated. | |
| 59 | * | |
| 60 | * Bus errors caused by instruction fetches are not supported. | |
| 61 | * | |
| 14 | 62 | */ |
| 15 | 63 | |
| 16 | 64 | #include "debugger.h" |
| r2375 | r2376 | |
| 23 | 71 | #define EXC_INT ( 0 ) |
| 24 | 72 | #define EXC_ADEL ( 4 ) |
| 25 | 73 | #define EXC_ADES ( 5 ) |
| 74 | #define EXC_DBE ( 7 ) | |
| 26 | 75 | #define EXC_SYS ( 8 ) |
| 27 | 76 | #define EXC_BP ( 9 ) |
| 28 | 77 | #define EXC_RI ( 10 ) |
| 29 | 78 | #define EXC_CPU ( 11 ) |
| 30 | 79 | #define EXC_OVF ( 12 ) |
| 31 | 80 | |
| 81 | #define CP0_INDEX ( 0 ) | |
| 32 | 82 | #define CP0_RANDOM ( 1 ) |
| 33 | #define CP0_BADVADDR ( 8 ) | |
| 83 | #define CP0_ENTRYLO ( 2 ) | |
| 84 | #define CP0_CONTEXT ( 4 ) | |
| 85 | #define CP0_ENTRYHI ( 10 ) | |
| 86 | ||
| 87 | #define CP0_BPC ( 3 ) | |
| 88 | #define CP0_BDA ( 5 ) | |
| 89 | #define CP0_TAR ( 6 ) | |
| 90 | #define CP0_DCIC ( 7 ) | |
| 91 | #define CP0_BADA ( 8 ) | |
| 92 | #define CP0_BDAM ( 9 ) | |
| 93 | #define CP0_BPCM ( 11 ) | |
| 34 | 94 | #define CP0_SR ( 12 ) |
| 35 | 95 | #define CP0_CAUSE ( 13 ) |
| 36 | 96 | #define CP0_EPC ( 14 ) |
| 37 | 97 | #define CP0_PRID ( 15 ) |
| 38 | 98 | |
| 99 | #define DCIC_STATUS ( 0x3f ) | |
| 100 | #define DCIC_DB ( 1L << 0 ) | |
| 101 | #define DCIC_DA ( 1L << 2 ) | |
| 102 | #define DCIC_R ( 1L << 3 ) | |
| 103 | #define DCIC_W ( 1L << 4 ) | |
| 104 | #define DCIC_DE ( 1L << 23 ) | |
| 105 | #define DCIC_DAE ( 1L << 25 ) | |
| 106 | #define DCIC_DR ( 1L << 26 ) | |
| 107 | #define DCIC_DW ( 1L << 27 ) | |
| 108 | #define DCIC_KD ( 1L << 29 ) | |
| 109 | #define DCIC_UD ( 1L << 30 ) | |
| 110 | #define DCIC_TR ( 1L << 31 ) | |
| 111 | ||
| 39 | 112 | #define SR_IEC ( 1L << 0 ) |
| 40 | 113 | #define SR_KUC ( 1L << 1 ) |
| 41 | 114 | #define SR_ISC ( 1L << 16 ) |
| 42 | 115 | #define SR_SWC ( 1L << 17 ) |
| 43 | #define SR_TS ( 1L << 21 ) | |
| 44 | 116 | #define SR_BEV ( 1L << 22 ) |
| 45 | #define SR_RE ( 1L << 25 ) | |
| 46 | 117 | #define SR_CU0 ( 1L << 28 ) |
| 47 | 118 | #define SR_CU1 ( 1L << 29 ) |
| 48 | 119 | #define SR_CU2 ( 1L << 30 ) |
| r2375 | r2376 | |
| 57 | 128 | #define CAUSE_IP6 ( 1L << 14 ) |
| 58 | 129 | #define CAUSE_IP7 ( 1L << 15 ) |
| 59 | 130 | #define CAUSE_CE ( 3L << 28 ) |
| 60 | #define CAUSE_CE0 ( 0L << 28 ) | |
| 61 | #define CAUSE_CE1 ( 1L << 28 ) | |
| 62 | #define CAUSE_CE2 ( 2L << 28 ) | |
| 131 | #define CAUSE_BT ( 1L << 30 ) | |
| 63 | 132 | #define CAUSE_BD ( 1L << 31 ) |
| 64 | 133 | |
| 134 | #define BIU_LOCK ( 0x00000001 ) | |
| 135 | #define BIU_INV ( 0x00000002 ) | |
| 136 | #define BIU_TAG ( 0x00000004 ) | |
| 137 | #define BIU_RAM ( 0x00000008 ) | |
| 138 | #define BIU_DS ( 0x00000080 ) | |
| 139 | #define BIU_IS1 ( 0x00000800 ) | |
| 140 | ||
| 141 | #define ICACHE_ENTRIES ( 0x400 ) | |
| 142 | #define DCACHE_ENTRIES ( 0x100 ) | |
| 143 | ||
| 144 | #define TAG_MATCH_MASK ( 0 - ( ICACHE_ENTRIES * 4 ) ) | |
| 145 | #define TAG_MATCH ( 0x10 ) | |
| 146 | #define TAG_VALID ( 0x0f ) | |
| 147 | ||
| 148 | #define MULTIPLIER_OPERATION_IDLE ( 0 ) | |
| 149 | #define MULTIPLIER_OPERATION_MULT ( 1 ) | |
| 150 | #define MULTIPLIER_OPERATION_MULTU ( 2 ) | |
| 151 | #define MULTIPLIER_OPERATION_DIV ( 3 ) | |
| 152 | #define MULTIPLIER_OPERATION_DIVU ( 4 ) | |
| 153 | ||
| 65 | 154 | static const char *const delayn[] = |
| 66 | 155 | { |
| 67 | " | |
| 156 | " | |
| 68 | 157 | "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", |
| 69 | 158 | "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", |
| 70 | 159 | "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra", |
| 71 | "pc" | |
| 160 | "pc", "!pc" | |
| 72 | 161 | }; |
| 73 | 162 | |
| 74 | #define REGPC ( 32 ) | |
| 75 | ||
| 76 | 163 | typedef struct |
| 77 | 164 | { |
| 78 | 165 | UINT32 op; |
| r2375 | r2376 | |
| 81 | 168 | UINT32 delayr; |
| 82 | 169 | UINT32 hi; |
| 83 | 170 | UINT32 lo; |
| 171 | UINT32 biu; | |
| 172 | UINT32 berr; | |
| 84 | 173 | UINT32 r[ 32 ]; |
| 85 | UINT32 cp0r[ | |
| 174 | UINT32 cp0r[ 16 ]; | |
| 86 | 175 | PAIR cp2cr[ 32 ]; |
| 87 | 176 | PAIR cp2dr[ 32 ]; |
| 177 | UINT32 icacheTag[ ICACHE_ENTRIES / 4 ]; | |
| 178 | UINT32 icache[ ICACHE_ENTRIES ]; | |
| 179 | UINT32 dcache[ DCACHE_ENTRIES ]; | |
| 180 | int multiplier_operation; | |
| 181 | UINT32 multiplier_operand1; | |
| 182 | UINT32 multiplier_operand2; | |
| 88 | 183 | int (*irq_callback)(int irqline); |
| 184 | UINT8 (*readbyte)( UINT32 ); | |
| 185 | UINT16 (*readhalf)( UINT32 ); | |
| 186 | UINT32 (*readword)( UINT32 ); | |
| 187 | UINT32 (*readword_masked)( UINT32, UINT32 ); | |
| 188 | void (*writeword)( UINT32, UINT32 ); | |
| 189 | void (*writeword_masked)( UINT32, UINT32, UINT32 ); | |
| 190 | UINT32 bad_byte_address_mask; | |
| 191 | UINT32 bad_half_address_mask; | |
| 192 | UINT32 bad_word_address_mask; | |
| 89 | 193 | } mips_cpu_context; |
| 90 | 194 | |
| 91 | 195 | static mips_cpu_context mipscpu; |
| r2375 | r2376 | |
| 94 | 198 | |
| 95 | 199 | static const UINT32 mips_mtc0_writemask[]= |
| 96 | 200 | { |
| 97 | 0xffffffff, /* INDEX */ | |
| 98 | 0x00000000, /* RANDOM */ | |
| 99 | 0xffffff00, /* ENTRYLO */ | |
| 100 | 0x00000000, | |
| 101 | 0xffe00000, /* CONTEXT */ | |
| 102 | 0x00000000, | |
| 103 | 0x00000000, | |
| 104 | 0x00000000, | |
| 105 | 0x00000000, /* BADVADDR */ | |
| 106 | 0x00000000, | |
| 107 | 0xffffffc0, /* ENTRYHI */ | |
| 108 | 0x00000000, | |
| 109 | 0xf27fff3f, /* SR */ | |
| 201 | 0x00000000, /* !INDEX */ | |
| 202 | 0x00000000, /* !RANDOM */ | |
| 203 | 0x00000000, /* !ENTRYLO */ | |
| 204 | 0xffffffff, /* BPC */ | |
| 205 | 0x00000000, /* !CONTEXT */ | |
| 206 | 0xffffffff, /* BDA */ | |
| 207 | 0x00000000, /* TAR */ | |
| 208 | 0xff80f03f, /* DCIC */ | |
| 209 | 0x00000000, /* BADA */ | |
| 210 | 0xffffffff, /* BDAM */ | |
| 211 | 0x00000000, /* !ENTRYHI */ | |
| 212 | 0xffffffff, /* BPCM */ | |
| 213 | 0xf04fff3f, /* SR */ | |
| 110 | 214 | 0x00000300, /* CAUSE */ |
| 111 | 215 | 0x00000000, /* EPC */ |
| 112 | 0x00000000, /* PRID */ | |
| 113 | 0x00000000, | |
| 114 | 0x00000000, | |
| 115 | 0x00000000, | |
| 116 | 0x00000000, | |
| 117 | 0x00000000, | |
| 118 | 0x00000000, | |
| 119 | 0x00000000, | |
| 120 | 0x00000000, | |
| 121 | 0x00000000, | |
| 122 | 0x00000000, | |
| 123 | 0x00000000, | |
| 124 | 0x00000000, | |
| 125 | 0x00000000, | |
| 126 | 0x00000000, | |
| 127 | 0x00000000, | |
| 128 | 0x00000000 | |
| 216 | 0x00000000 /* PRID */ | |
| 129 | 217 | }; |
| 130 | 218 | |
| 131 | 219 | #if 0 |
| r2375 | r2376 | |
| 142 | 230 | INLINE void ATTR_PRINTF(1,2) GTELOG(const char *a, ...) {} |
| 143 | 231 | #endif |
| 144 | 232 | |
| 145 | static UINT32 getcp2dr( int n_reg ); | |
| 146 | static void setcp2dr( int n_reg, UINT32 n_value ); | |
| 147 | static UINT32 getcp2cr( int n_reg ); | |
| 148 | static void setcp2cr( int n_reg, UINT32 n_value ); | |
| 149 | static void docop2( int gteop ); | |
| 233 | static UINT32 getcp1dr( int reg ); | |
| 234 | static void setcp1dr( int reg, UINT32 value ); | |
| 235 | static UINT32 getcp1cr( int reg ); | |
| 236 | static void setcp1cr( int reg, UINT32 value ); | |
| 237 | //static void docop1( int op ); | |
| 238 | ||
| 239 | ||
| 240 | static UINT32 getcp2dr( int reg ); | |
| 241 | static void setcp2dr( int reg, UINT32 value ); | |
| 242 | static UINT32 getcp2cr( int reg ); | |
| 243 | static void setcp2cr( int reg, UINT32 value ); | |
| 244 | static void docop2( int op ); | |
| 245 | ||
| 246 | ||
| 247 | static UINT32 getcp3dr( int reg ); | |
| 248 | static void setcp3dr( int reg, UINT32 value ); | |
| 249 | static UINT32 getcp3cr( int reg ); | |
| 250 | static void setcp3cr( int reg, UINT32 value ); | |
| 251 | //static void docop3( int op ); | |
| 252 | ||
| 253 | ||
| 150 | 254 | static void mips_exception( int exception ); |
| 255 | static void mips_load_bad_address( UINT32 address ); | |
| 151 | 256 | |
| 152 | 257 | static void mips_stop( void ) |
| 153 | 258 | { |
| 154 | 259 | DEBUGGER_BREAK; |
| 155 | CALL_DEBUGGER(mipscpu.pc); | |
| 260 | CALL_DEBUGGER( mipscpu.pc ); | |
| 156 | 261 | } |
| 157 | 262 | |
| 158 | 263 | #if LOG_BIOSCALL |
| r2375 | r2376 | |
| 481 | 586 | } |
| 482 | 587 | else |
| 483 | 588 | { |
| 484 | return pr | |
| 589 | return mipscpu.r | |
| 485 | 590 | } |
| 486 | 591 | } |
| 487 | 592 | |
| r2375 | r2376 | |
| 502 | 607 | |
| 503 | 608 | for( ;; ) |
| 504 | 609 | { |
| 505 | UINT8 c = pr | |
| 610 | UINT8 c = mipscpu.r | |
| 506 | 611 | if( c == 0 ) |
| 507 | 612 | { |
| 508 | 613 | break; |
| r2375 | r2376 | |
| 592 | 697 | int fd = log_bioscall_parameter( 0 ); |
| 593 | 698 | int buf = log_bioscall_parameter( 1 ); |
| 594 | 699 | int nbytes = log_bioscall_parameter( 2 ); |
| 700 | ||
| 595 | 701 | if( fd == 1 ) |
| 596 | 702 | { |
| 597 | 703 | while( nbytes > 0 ) |
| 598 | 704 | { |
| 599 | UINT8 c = pr | |
| 705 | UINT8 c = mipscpu.r | |
| 600 | 706 | putchar( c ); |
| 601 | 707 | nbytes--; |
| 602 | 708 | buf++; |
| r2375 | r2376 | |
| 623 | 729 | while( *( prototype ) != 0 ) |
| 624 | 730 | { |
| 625 | 731 | int ch = *( prototype ); |
| 732 | ||
| 626 | 733 | switch( ch ) |
| 627 | 734 | { |
| 628 | 735 | case '(': |
| r2375 | r2376 | |
| 634 | 741 | parmstart = prototype; |
| 635 | 742 | } |
| 636 | 743 | break; |
| 744 | ||
| 637 | 745 | case ')': |
| 638 | 746 | if( brackets == 1 ) |
| 639 | 747 | { |
| r2375 | r2376 | |
| 642 | 750 | prototype++; |
| 643 | 751 | brackets--; |
| 644 | 752 | break; |
| 753 | ||
| 645 | 754 | case ',': |
| 646 | 755 | if( brackets == 1 ) |
| 647 | 756 | { |
| r2375 | r2376 | |
| 649 | 758 | } |
| 650 | 759 | prototype++; |
| 651 | 760 | break; |
| 761 | ||
| 652 | 762 | default: |
| 653 | 763 | if( brackets == 0 ) |
| 654 | 764 | { |
| r2375 | r2376 | |
| 682 | 792 | UINT32 format = log_bioscall_parameter( parm - 1 ); |
| 683 | 793 | const char *parmstr = NULL; |
| 684 | 794 | int percent = 0; |
| 795 | ||
| 685 | 796 | for( ;; ) |
| 686 | 797 | { |
| 687 | UINT8 c = pr | |
| 798 | UINT8 c = mipscpu.r | |
| 688 | 799 | if( c == 0 ) |
| 689 | 800 | { |
| 690 | 801 | break; |
| r2375 | r2376 | |
| 805 | 916 | { |
| 806 | 917 | char buf[ 1024 ]; |
| 807 | 918 | int operation = activecpu_get_reg( MIPS_R4 ); |
| 919 | ||
| 808 | 920 | switch( operation ) |
| 809 | 921 | { |
| 810 | 922 | case 0: |
| 811 | 923 | strcpy( buf, "void Exception()" ); |
| 812 | 924 | break; |
| 925 | ||
| 813 | 926 | case 1: |
| 814 | 927 | strcpy( buf, "void EnterCriticalSection()" ); |
| 815 | 928 | break; |
| 929 | ||
| 816 | 930 | case 2: |
| 817 | 931 | strcpy( buf, "void ExitCriticalSection()" ); |
| 818 | 932 | break; |
| 933 | ||
| 819 | 934 | default: |
| 820 | 935 | sprintf( buf, "unknown_%02x", operation ); |
| 821 | 936 | break; |
| r2375 | r2376 | |
| 825 | 940 | |
| 826 | 941 | #endif |
| 827 | 942 | |
| 943 | static UINT32 mips_cache_readword( UINT32 offset ) | |
| 944 | { | |
| 945 | UINT32 data = 0; | |
| 946 | ||
| 947 | if( ( mipscpu.biu & BIU_TAG ) != 0 ) | |
| 948 | { | |
| 949 | if( ( mipscpu.biu & BIU_IS1 ) != 0 ) | |
| 950 | { | |
| 951 | UINT32 tag = mipscpu.icacheTag[ ( offset / 16 ) % ( ICACHE_ENTRIES / 4 ) ]; | |
| 952 | data |= tag & TAG_VALID; | |
| 953 | ||
| 954 | if( ( ( tag ^ offset ) & TAG_MATCH_MASK ) == 0 ) | |
| 955 | { | |
| 956 | data |= TAG_MATCH; | |
| 957 | } | |
| 958 | } | |
| 959 | } | |
| 960 | else if( ( mipscpu.biu & ( BIU_LOCK | BIU_INV ) ) != 0 ) | |
| 961 | { | |
| 962 | } | |
| 963 | else | |
| 964 | { | |
| 965 | if( ( mipscpu.biu & BIU_IS1 ) == BIU_IS1 ) | |
| 966 | { | |
| 967 | data |= mipscpu.icache[ ( offset / 4 ) % ICACHE_ENTRIES ]; | |
| 968 | } | |
| 969 | ||
| 970 | if( ( mipscpu.biu & BIU_DS ) == BIU_DS ) | |
| 971 | { | |
| 972 | data |= mipscpu.dcache[ ( offset / 4 ) % DCACHE_ENTRIES ]; | |
| 973 | } | |
| 974 | } | |
| 975 | ||
| 976 | return data; | |
| 977 | } | |
| 978 | ||
| 979 | static UINT8 mips_cache_readbyte( UINT32 offset ) | |
| 980 | { | |
| 981 | return mips_cache_readword( offset ) >> ( ( offset & 3 ) * 8 ); | |
| 982 | } | |
| 983 | ||
| 984 | static UINT16 mips_cache_readhalf( UINT32 offset ) | |
| 985 | { | |
| 986 | return mips_cache_readword( offset ) >> ( ( offset & 2 ) * 8 ); | |
| 987 | } | |
| 988 | ||
| 989 | static UINT32 mips_cache_readword_masked( UINT32 offset, UINT32 mask ) | |
| 990 | { | |
| 991 | return mips_cache_readword( offset ); | |
| 992 | } | |
| 993 | ||
| 994 | static void mips_cache_writeword( UINT32 offset, UINT32 data ) | |
| 995 | { | |
| 996 | if( ( mipscpu.biu & BIU_TAG ) != 0 ) | |
| 997 | { | |
| 998 | if( ( mipscpu.biu & BIU_IS1 ) != 0 ) | |
| 999 | { | |
| 1000 | mipscpu.icacheTag[ ( offset / 16 ) % ( ICACHE_ENTRIES / 4 ) ] = ( data & TAG_VALID ) | ( offset & TAG_MATCH_MASK ); | |
| 1001 | } | |
| 1002 | } | |
| 1003 | else if( ( mipscpu.biu & ( BIU_LOCK | BIU_INV ) ) != 0 ) | |
| 1004 | { | |
| 1005 | if( ( mipscpu.biu & BIU_IS1 ) != 0 ) | |
| 1006 | { | |
| 1007 | mipscpu.icacheTag[ ( offset / 16 ) % ( ICACHE_ENTRIES / 4 ) ] = ( offset & TAG_MATCH_MASK ); | |
| 1008 | } | |
| 1009 | } | |
| 1010 | else | |
| 1011 | { | |
| 1012 | if( ( mipscpu.biu & BIU_IS1 ) != 0 ) | |
| 1013 | { | |
| 1014 | mipscpu.icache[ ( offset / 4 ) % ICACHE_ENTRIES ] = data; | |
| 1015 | } | |
| 1016 | ||
| 1017 | if( ( mipscpu.biu & BIU_DS ) != 0 ) | |
| 1018 | { | |
| 1019 | mipscpu.dcache[ ( offset / 4 ) % DCACHE_ENTRIES ] = data; | |
| 1020 | } | |
| 1021 | } | |
| 1022 | } | |
| 1023 | ||
| 1024 | static void mips_cache_writeword_masked( UINT32 offset, UINT32 data, UINT32 mask ) | |
| 1025 | { | |
| 1026 | mips_cache_writeword( offset, data ); | |
| 1027 | } | |
| 1028 | ||
| 1029 | static void mips_update_memory_handlers( void ) | |
| 1030 | { | |
| 1031 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 1032 | { | |
| 1033 | mipscpu.readbyte = mips_cache_readbyte; | |
| 1034 | mipscpu.readhalf = mips_cache_readhalf; | |
| 1035 | mipscpu.readword = mips_cache_readword; | |
| 1036 | mipscpu.readword_masked = mips_cache_readword_masked; | |
| 1037 | mipscpu.writeword = mips_cache_writeword; | |
| 1038 | mipscpu.writeword_masked = mips_cache_writeword_masked; | |
| 1039 | } | |
| 1040 | else | |
| 1041 | { | |
| 1042 | mipscpu.readbyte = program_read_byte_32le; | |
| 1043 | mipscpu.readhalf = program_read_word_32le; | |
| 1044 | mipscpu.readword = program_read_dword_32le; | |
| 1045 | mipscpu.readword_masked = program_read_dword_masked_32le; | |
| 1046 | mipscpu.writeword = program_write_dword_32le; | |
| 1047 | mipscpu.writeword_masked = program_write_dword_masked_32le; | |
| 1048 | } | |
| 1049 | } | |
| 1050 | ||
| 1051 | INLINE void funct_mthi( void ) | |
| 1052 | { | |
| 1053 | mipscpu.multiplier_operation = MULTIPLIER_OPERATION_IDLE; | |
| 1054 | mipscpu.hi = mipscpu.r[ INS_RS( mipscpu.op ) ]; | |
| 1055 | } | |
| 1056 | ||
| 1057 | INLINE void funct_mtlo( void ) | |
| 1058 | { | |
| 1059 | mipscpu.multiplier_operation = MULTIPLIER_OPERATION_IDLE; | |
| 1060 | mipscpu.lo = mipscpu.r[ INS_RS( mipscpu.op ) ]; | |
| 1061 | } | |
| 1062 | ||
| 1063 | INLINE void funct_mult( void ) | |
| 1064 | { | |
| 1065 | mipscpu.multiplier_operation = MULTIPLIER_OPERATION_MULT; | |
| 1066 | mipscpu.multiplier_operand1 = mipscpu.r[ INS_RS( mipscpu.op ) ]; | |
| 1067 | mipscpu.multiplier_operand2 = mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1068 | mipscpu.lo = mipscpu.multiplier_operand1; | |
| 1069 | } | |
| 1070 | ||
| 1071 | INLINE void funct_multu( void ) | |
| 1072 | { | |
| 1073 | mipscpu.multiplier_operation = MULTIPLIER_OPERATION_MULTU; | |
| 1074 | mipscpu.multiplier_operand1 = mipscpu.r[ INS_RS( mipscpu.op ) ]; | |
| 1075 | mipscpu.multiplier_operand2 = mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1076 | mipscpu.lo = mipscpu.multiplier_operand1; | |
| 1077 | } | |
| 1078 | ||
| 1079 | INLINE void funct_div( void ) | |
| 1080 | { | |
| 1081 | mipscpu.multiplier_operation = MULTIPLIER_OPERATION_DIV; | |
| 1082 | mipscpu.multiplier_operand1 = mipscpu.r[ INS_RS( mipscpu.op ) ]; | |
| 1083 | mipscpu.multiplier_operand2 = mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1084 | mipscpu.lo = mipscpu.multiplier_operand1; | |
| 1085 | mipscpu.hi = 0; | |
| 1086 | } | |
| 1087 | ||
| 1088 | INLINE void funct_divu( void ) | |
| 1089 | { | |
| 1090 | mipscpu.multiplier_operation = MULTIPLIER_OPERATION_DIVU; | |
| 1091 | mipscpu.multiplier_operand1 = mipscpu.r[ INS_RS( mipscpu.op ) ]; | |
| 1092 | mipscpu.multiplier_operand2 = mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1093 | mipscpu.lo = mipscpu.multiplier_operand1; | |
| 1094 | mipscpu.hi = 0; | |
| 1095 | } | |
| 1096 | ||
| 1097 | static void multiplier_update( void ) | |
| 1098 | { | |
| 1099 | switch( mipscpu.multiplier_operation ) | |
| 1100 | { | |
| 1101 | case MULTIPLIER_OPERATION_MULT: | |
| 1102 | { | |
| 1103 | INT64 result = MUL_64_32_32( (INT32)mipscpu.multiplier_operand1, (INT32)mipscpu.multiplier_operand2 ); | |
| 1104 | mipscpu.lo = LO32_32_64( result ); | |
| 1105 | mipscpu.hi = HI32_32_64( result ); | |
| 1106 | } | |
| 1107 | break; | |
| 1108 | ||
| 1109 | case MULTIPLIER_OPERATION_MULTU: | |
| 1110 | { | |
| 1111 | UINT64 result = MUL_U64_U32_U32( mipscpu.multiplier_operand1, mipscpu.multiplier_operand2 ); | |
| 1112 | mipscpu.lo = LO32_U32_U64( result ); | |
| 1113 | mipscpu.hi = HI32_U32_U64( result ); | |
| 1114 | } | |
| 1115 | break; | |
| 1116 | ||
| 1117 | case MULTIPLIER_OPERATION_DIV: | |
| 1118 | if( mipscpu.multiplier_operand2 != 0 ) | |
| 1119 | { | |
| 1120 | mipscpu.lo = (INT32)mipscpu.multiplier_operand1 / (INT32)mipscpu.multiplier_operand2; | |
| 1121 | mipscpu.hi = (INT32)mipscpu.multiplier_operand1 % (INT32)mipscpu.multiplier_operand2; | |
| 1122 | } | |
| 1123 | else | |
| 1124 | { | |
| 1125 | if( (INT32)mipscpu.multiplier_operand1 < 0 ) | |
| 1126 | { | |
| 1127 | mipscpu.lo = 1; | |
| 1128 | } | |
| 1129 | else | |
| 1130 | { | |
| 1131 | mipscpu.lo = 0xffffffff; | |
| 1132 | } | |
| 1133 | ||
| 1134 | mipscpu.hi = mipscpu.multiplier_operand1; | |
| 1135 | } | |
| 1136 | break; | |
| 1137 | ||
| 1138 | case MULTIPLIER_OPERATION_DIVU: | |
| 1139 | if( mipscpu.multiplier_operand2 != 0 ) | |
| 1140 | { | |
| 1141 | mipscpu.lo = mipscpu.multiplier_operand1 / mipscpu.multiplier_operand2; | |
| 1142 | mipscpu.hi = mipscpu.multiplier_operand1 % mipscpu.multiplier_operand2; | |
| 1143 | } | |
| 1144 | else | |
| 1145 | { | |
| 1146 | mipscpu.lo = 0xffffffff; | |
| 1147 | mipscpu.hi = mipscpu.multiplier_operand1; | |
| 1148 | } | |
| 1149 | break; | |
| 1150 | } | |
| 1151 | ||
| 1152 | mipscpu.multiplier_operation = MULTIPLIER_OPERATION_IDLE; | |
| 1153 | } | |
| 1154 | ||
| 1155 | static UINT32 mips_get_hi( void ) | |
| 1156 | { | |
| 1157 | if( mipscpu.multiplier_operation != MULTIPLIER_OPERATION_IDLE ) | |
| 1158 | { | |
| 1159 | multiplier_update(); | |
| 1160 | } | |
| 1161 | ||
| 1162 | return mipscpu.hi; | |
| 1163 | } | |
| 1164 | ||
| 1165 | static UINT32 mips_get_lo( void ) | |
| 1166 | { | |
| 1167 | if( mipscpu.multiplier_operation != MULTIPLIER_OPERATION_IDLE ) | |
| 1168 | { | |
| 1169 | multiplier_update(); | |
| 1170 | } | |
| 1171 | return mipscpu.lo; | |
| 1172 | } | |
| 1173 | ||
| 1174 | static int mips_execute_unstoppable_instructions( int executeCop2 ) | |
| 1175 | { | |
| 1176 | switch( INS_OP( mipscpu.op ) ) | |
| 1177 | { | |
| 1178 | case OP_SPECIAL: | |
| 1179 | switch( INS_FUNCT( mipscpu.op ) ) | |
| 1180 | { | |
| 1181 | case FUNCT_MTHI: | |
| 1182 | funct_mthi(); | |
| 1183 | break; | |
| 1184 | ||
| 1185 | case FUNCT_MTLO: | |
| 1186 | funct_mtlo(); | |
| 1187 | break; | |
| 1188 | ||
| 1189 | case FUNCT_MULT: | |
| 1190 | funct_mult(); | |
| 1191 | break; | |
| 1192 | ||
| 1193 | case FUNCT_MULTU: | |
| 1194 | funct_multu(); | |
| 1195 | break; | |
| 1196 | ||
| 1197 | case FUNCT_DIV: | |
| 1198 | funct_div(); | |
| 1199 | break; | |
| 1200 | ||
| 1201 | case FUNCT_DIVU: | |
| 1202 | funct_divu(); | |
| 1203 | break; | |
| 1204 | } | |
| 1205 | break; | |
| 1206 | ||
| 1207 | case OP_COP2: | |
| 1208 | if( executeCop2 ) | |
| 1209 | { | |
| 1210 | switch( INS_CO( mipscpu.op ) ) | |
| 1211 | { | |
| 1212 | case 1: | |
| 1213 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_CU2 ) == 0 ) | |
| 1214 | { | |
| 1215 | return 0; | |
| 1216 | } | |
| 1217 | ||
| 1218 | docop2( INS_COFUN( mipscpu.op ) ); | |
| 1219 | break; | |
| 1220 | } | |
| 1221 | } | |
| 1222 | } | |
| 1223 | ||
| 1224 | return 1; | |
| 1225 | } | |
| 1226 | ||
| 1227 | static void mips_update_address_masks( void ) | |
| 1228 | { | |
| 1229 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) != 0 ) | |
| 1230 | { | |
| 1231 | mipscpu.bad_byte_address_mask = 0x80000000; | |
| 1232 | mipscpu.bad_half_address_mask = 0x80000001; | |
| 1233 | mipscpu.bad_word_address_mask = 0x80000003; | |
| 1234 | } | |
| 1235 | else | |
| 1236 | { | |
| 1237 | mipscpu.bad_byte_address_mask = 0; | |
| 1238 | mipscpu.bad_half_address_mask = 1; | |
| 1239 | mipscpu.bad_word_address_mask = 3; | |
| 1240 | } | |
| 1241 | } | |
| 1242 | ||
| 1243 | static READ32_HANDLER( psx_berr_r ) | |
| 1244 | { | |
| 1245 | mipscpu.berr = 1; | |
| 1246 | ||
| 1247 | return 0; | |
| 1248 | } | |
| 1249 | ||
| 1250 | static WRITE32_HANDLER( psx_berr_w ) | |
| 1251 | { | |
| 1252 | mipscpu.berr = 1; | |
| 1253 | } | |
| 1254 | ||
| 1255 | static void mips_update_scratchpad( void ) | |
| 1256 | { | |
| 1257 | int cpu = cpu_getactivecpu(); | |
| 1258 | ||
| 1259 | if( ( mipscpu.biu & BIU_RAM ) == 0 ) | |
| 1260 | { | |
| 1261 | memory_install_read32_handler ( cpu, ADDRESS_SPACE_PROGRAM, 0x1f800000, 0x1f8003ff, 0, 0, psx_berr_r ); | |
| 1262 | memory_install_write32_handler( cpu, ADDRESS_SPACE_PROGRAM, 0x1f800000, 0x1f8003ff, 0, 0, psx_berr_w ); | |
| 1263 | } | |
| 1264 | else if( ( mipscpu.biu & BIU_DS ) == 0 ) | |
| 1265 | { | |
| 1266 | memory_install_read32_handler ( cpu, ADDRESS_SPACE_PROGRAM, 0x1f800000, 0x1f8003ff, 0, 0, psx_berr_r ); | |
| 1267 | memory_install_write32_handler( cpu, ADDRESS_SPACE_PROGRAM, 0x1f800000, 0x1f8003ff, 0, 0, SMH_NOP ); | |
| 1268 | } | |
| 1269 | else | |
| 1270 | { | |
| 1271 | memory_install_read32_handler ( cpu, ADDRESS_SPACE_PROGRAM, 0x1f800000, 0x1f8003ff, 0, 0, SMH_BANK32 ); | |
| 1272 | memory_install_write32_handler( cpu, ADDRESS_SPACE_PROGRAM, 0x1f800000, 0x1f8003ff, 0, 0, SMH_BANK32 ); | |
| 1273 | ||
| 1274 | memory_set_bankptr( 32, mipscpu.dcache ); | |
| 1275 | } | |
| 1276 | } | |
| 1277 | ||
| 828 | 1278 | INLINE void mips_set_cp0r( int reg, UINT32 value ) |
| 829 | 1279 | { |
| 1280 | UINT32 old = mipscpu.cp0r[ reg ]; | |
| 1281 | ||
| 830 | 1282 | mipscpu.cp0r[ reg ] = value; |
| 831 | if( reg == CP0_SR || reg == CP0_CAUSE ) | |
| 1283 | ||
| 1284 | if( reg == CP0_SR ) | |
| 832 | 1285 | { |
| 833 | if( ( | |
| 1286 | if( ( old | |
| 834 | 1287 | { |
| 835 | mips_ | |
| 1288 | mips_u | |
| 836 | 1289 | } |
| 837 | else if( mipscpu.delayr != REGPC && ( mipscpu.pc & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 3 ) ) != 0 ) | |
| 1290 | ||
| 1291 | if( ( old & SR_KUC ) != ( value & SR_KUC ) ) | |
| 838 | 1292 | { |
| 839 | mips_exception( EXC_ADEL ); | |
| 840 | mips_set_cp0r( CP0_BADVADDR, mipscpu.pc ); | |
| 1293 | mips_update_address_masks(); | |
| 841 | 1294 | } |
| 842 | 1295 | } |
| 1296 | ||
| 1297 | if( ( reg == CP0_SR || reg == CP0_CAUSE ) && | |
| 1298 | ( mipscpu.cp0r[ CP0_SR ] & SR_IEC ) != 0 && | |
| 1299 | ( mipscpu.cp0r[ CP0_SR ] & mipscpu.cp0r[ CP0_CAUSE ] & CAUSE_IP ) != 0 ) | |
| 1300 | { | |
| 1301 | mipscpu.op = cpu_readop32( mipscpu.pc ); | |
| 1302 | mips_execute_unstoppable_instructions( 1 ); | |
| 1303 | mips_exception( EXC_INT ); | |
| 1304 | } | |
| 1305 | else if( reg == CP0_SR && | |
| 1306 | mipscpu.delayr != MIPS_DELAYR_PC && | |
| 1307 | ( mipscpu.pc & mipscpu.bad_word_address_mask ) != 0 ) | |
| 1308 | { | |
| 1309 | mips_load_bad_address( mipscpu.pc ); | |
| 1310 | } | |
| 843 | 1311 | } |
| 844 | 1312 | |
| 845 | 1313 | INLINE void mips_commit_delayed_load( void ) |
| r2375 | r2376 | |
| 852 | 1320 | } |
| 853 | 1321 | } |
| 854 | 1322 | |
| 855 | ||
| 1323 | static void mips_set | |
| 856 | 1324 | { |
| 857 | if( ( n_adr & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 3 ) ) != 0 ) | |
| 1325 | mipscpu.pc = val; | |
| 1326 | change_pc( val ); | |
| 1327 | } | |
| 1328 | ||
| 1329 | static void mips_fetch_next_op( void ) | |
| 1330 | { | |
| 1331 | if( mipscpu.delayr == MIPS_DELAYR_PC ) | |
| 858 | 1332 | { |
| 859 | mips_exception( EXC_ADEL ); | |
| 860 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 1333 | UINT32 safepc = mipscpu.delayv & ~mipscpu.bad_word_address_mask; | |
| 1334 | ||
| 1335 | change_pc( safepc ); | |
| 1336 | mipscpu.op = cpu_readop32( safepc ); | |
| 1337 | change_pc( mipscpu.pc ); | |
| 861 | 1338 | } |
| 862 | else | |
| 1339 | else | |
| 863 | 1340 | { |
| 1341 | mipscpu.op = cpu_readop32( mipscpu.pc + 4 ); | |
| 1342 | } | |
| 1343 | } | |
| 1344 | ||
| 1345 | INLINE int mips_advance_pc( void ) | |
| 1346 | { | |
| 1347 | if( mipscpu.delayr == MIPS_DELAYR_PC ) | |
| 1348 | { | |
| 864 | 1349 | mipscpu.pc = mipscpu.delayv; |
| 865 | change_pc( mipscpu.delayv ); | |
| 866 | mipscpu.delayv = n_adr; | |
| 1350 | mipscpu.delayr = 0; | |
| 1351 | mipscpu.delayv = 0; | |
| 1352 | ||
| 1353 | if( ( mipscpu.pc & mipscpu.bad_word_address_mask ) != 0 ) | |
| 1354 | { | |
| 1355 | mips_load_bad_address( mipscpu.pc ); | |
| 1356 | return 0; | |
| 1357 | } | |
| 1358 | else | |
| 1359 | { | |
| 1360 | change_pc( mipscpu.pc ); | |
| 1361 | } | |
| 867 | 1362 | } |
| 1363 | else if( mipscpu.delayr == MIPS_DELAYR_NOTPC ) | |
| 1364 | { | |
| 1365 | mipscpu.delayr = 0; | |
| 1366 | mipscpu.delayv = 0; | |
| 1367 | mipscpu.pc += 4; | |
| 1368 | } | |
| 868 | 1369 | else |
| 869 | 1370 | { |
| 870 | 1371 | mips_commit_delayed_load(); |
| 871 | mipscpu.delayr = REGPC; | |
| 872 | mipscpu.delayv = n_adr; | |
| 873 | 1372 | mipscpu.pc += 4; |
| 874 | 1373 | } |
| 1374 | ||
| 1375 | return 1; | |
| 875 | 1376 | } |
| 876 | 1377 | |
| 877 | INLINE void mips_ | |
| 1378 | INLINE void mips_load | |
| 878 | 1379 | { |
| 879 | mipscp | |
| 1380 | mips_advance_p | |
| 880 | 1381 | |
| 881 | change_pc( val ); | |
| 882 | mipscpu.delayr = 0; | |
| 883 | mipscpu.delayv = 0; | |
| 1382 | if( reg != 0 ) | |
| 1383 | { | |
| 1384 | mipscpu.r[ reg ] = value; | |
| 1385 | } | |
| 884 | 1386 | } |
| 885 | 1387 | |
| 886 | INLINE void mips_ | |
| 1388 | INLINE void mips_ | |
| 887 | 1389 | { |
| 888 | if( mipscpu.delayr == REGPC ) | |
| 1390 | mips_advance_pc(); | |
| 1391 | ||
| 1392 | mipscpu.delayr = reg; | |
| 1393 | mipscpu.delayv = value; | |
| 1394 | } | |
| 1395 | ||
| 1396 | INLINE void mips_branch( UINT32 address ) | |
| 1397 | { | |
| 1398 | mips_advance_pc(); | |
| 1399 | ||
| 1400 | mipscpu.delayr = MIPS_DELAYR_PC; | |
| 1401 | mipscpu.delayv = address; | |
| 1402 | } | |
| 1403 | ||
| 1404 | INLINE void mips_conditional_branch( int takeBranch ) | |
| 1405 | { | |
| 1406 | mips_advance_pc(); | |
| 1407 | ||
| 1408 | if( takeBranch ) | |
| 889 | 1409 | { |
| 890 | mips_set_pc( mipscpu.delayv ); | |
| 1410 | mipscpu.delayr = MIPS_DELAYR_PC; | |
| 1411 | mipscpu.delayv = mipscpu.pc + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ) << 2 ); | |
| 891 | 1412 | } |
| 892 | 1413 | else |
| 893 | 1414 | { |
| 894 | mips_commit_delayed_load(); | |
| 895 | mipscpu.pc += 4; | |
| 1415 | mipscpu.delayr = MIPS_DELAYR_NOTPC; | |
| 1416 | mipscpu.delayv = 0; | |
| 896 | 1417 | } |
| 897 | 1418 | } |
| 898 | 1419 | |
| 899 | INLINE void mips_ | |
| 1420 | INLINE void mips_unconditio | |
| 900 | 1421 | { |
| 901 | 1422 | mips_advance_pc(); |
| 902 | if( n_r != 0 ) | |
| 903 | { | |
| 904 | mipscpu.r[ n_r ] = n_v; | |
| 905 | } | |
| 1423 | ||
| 1424 | mipscpu.delayr = MIPS_DELAYR_PC; | |
| 1425 | mipscpu.delayv = ( mipscpu.pc & 0xf0000000 ) + ( INS_TARGET( mipscpu.op ) << 2 ); | |
| 906 | 1426 | } |
| 907 | 1427 | |
| 908 | ||
| 1428 | static void mips_common_exc | |
| 909 | 1429 | { |
| 910 | if( mipscpu.delayr == REGPC ) | |
| 1430 | int cause = ( exception << 2 ) | ( ( ( mipscpu.op >> 26 ) & 3 ) << 28 ); | |
| 1431 | ||
| 1432 | if( mipscpu.delayr == MIPS_DELAYR_PC ) | |
| 911 | 1433 | { |
| 912 | mips_set_pc( mipscpu.delayv ); | |
| 913 | mipscpu.delayr = n_r; | |
| 914 | mipscpu.delayv = n_v; | |
| 1434 | cause |= CAUSE_BT; | |
| 1435 | mips_set_cp0r( CP0_TAR, mipscpu.delayv ); | |
| 915 | 1436 | } |
| 1437 | else if( mipscpu.delayr == MIPS_DELAYR_NOTPC ) | |
| 1438 | { | |
| 1439 | mips_set_cp0r( CP0_TAR, mipscpu.pc + 4 ); | |
| 1440 | } | |
| 916 | 1441 | else |
| 917 | 1442 | { |
| 918 | 1443 | mips_commit_delayed_load(); |
| 919 | mipscpu.pc += 4; | |
| 920 | if( n_r != 0 ) | |
| 921 | { | |
| 922 | mipscpu.r[ n_r ] = n_v; | |
| 923 | } | |
| 924 | 1444 | } |
| 925 | } | |
| 926 | 1445 | |
| 927 | static void mips_exception( int exception ) | |
| 928 | { | |
| 929 | mips_set_cp0r( CP0_SR, ( mipscpu.cp0r[ CP0_SR ] & ~0x3f ) | ( ( mipscpu.cp0r[ CP0_SR ] << 2 ) & 0x3f ) ); | |
| 930 | if( mipscpu.delayr == REGPC ) | |
| 1446 | if( mipscpu.delayr == MIPS_DELAYR_PC || mipscpu.delayr == MIPS_DELAYR_NOTPC ) | |
| 931 | 1447 | { |
| 1448 | cause |= CAUSE_BD; | |
| 932 | 1449 | mips_set_cp0r( CP0_EPC, mipscpu.pc - 4 ); |
| 933 | mips_set_cp0r( CP0_CAUSE, ( mipscpu.cp0r[ CP0_CAUSE ] & ~CAUSE_EXC ) | CAUSE_BD | ( exception << 2 ) ); | |
| 934 | 1450 | } |
| 935 | 1451 | else |
| 936 | 1452 | { |
| 937 | mips_commit_delayed_load(); | |
| 938 | 1453 | mips_set_cp0r( CP0_EPC, mipscpu.pc ); |
| 939 | mips_set_cp0r( CP0_CAUSE, ( mipscpu.cp0r[ CP0_CAUSE ] & ~( CAUSE_EXC | CAUSE_BD ) ) | ( exception << 2 ) ); | |
| 940 | 1454 | } |
| 1455 | ||
| 1456 | #if LOG_BIOSCALL | |
| 1457 | if( exception != EXC_INT ) | |
| 1458 | { | |
| 1459 | logerror( "%08x: Exception %d\n", mipscpu.pc, exception ); | |
| 1460 | } | |
| 1461 | #endif | |
| 1462 | ||
| 1463 | mipscpu.delayr = 0; | |
| 1464 | mipscpu.delayv = 0; | |
| 1465 | mipscpu.berr = 0; | |
| 1466 | ||
| 941 | 1467 | if( mipscpu.cp0r[ CP0_SR ] & SR_BEV ) |
| 942 | 1468 | { |
| 943 | mips_set_pc( | |
| 1469 | mips_set_pc( romOffset | |
| 944 | 1470 | } |
| 945 | 1471 | else |
| 946 | 1472 | { |
| 947 | mips_set_pc( | |
| 1473 | mips_set_pc( ramOffset | |
| 948 | 1474 | } |
| 1475 | ||
| 1476 | mips_set_cp0r( CP0_SR, ( mipscpu.cp0r[ CP0_SR ] & ~0x3f ) | ( ( mipscpu.cp0r[ CP0_SR ] << 2 ) & 0x3f ) ); | |
| 1477 | mips_set_cp0r( CP0_CAUSE, ( mipscpu.cp0r[ CP0_CAUSE ] & ~( CAUSE_EXC | CAUSE_BD | CAUSE_BT | CAUSE_CE ) ) | cause ); | |
| 949 | 1478 | } |
| 950 | 1479 | |
| 1480 | static void mips_exception( int exception ) | |
| 1481 | { | |
| 1482 | mips_common_exception( exception, 0xbfc00180, 0x80000080 ); | |
| 1483 | } | |
| 1484 | ||
| 1485 | static void mips_breakpoint_exception( void ) | |
| 1486 | { | |
| 1487 | mips_fetch_next_op(); | |
| 1488 | mips_execute_unstoppable_instructions( 1 ); | |
| 1489 | mips_common_exception( EXC_BP, 0xbfc00140, 0x80000040 ); | |
| 1490 | } | |
| 1491 | ||
| 1492 | static void mips_load_bus_error_exception( void ) | |
| 1493 | { | |
| 1494 | mips_fetch_next_op(); | |
| 1495 | mips_execute_unstoppable_instructions( 0 ); | |
| 1496 | mips_common_exception( EXC_DBE, 0xbfc00180, 0x80000080 ); | |
| 1497 | } | |
| 1498 | ||
| 1499 | static void mips_store_bus_error_exception( void ) | |
| 1500 | { | |
| 1501 | mips_fetch_next_op(); | |
| 1502 | ||
| 1503 | if( mips_execute_unstoppable_instructions( 1 ) ) | |
| 1504 | { | |
| 1505 | if( !mips_advance_pc() ) | |
| 1506 | { | |
| 1507 | return; | |
| 1508 | } | |
| 1509 | ||
| 1510 | mips_fetch_next_op(); | |
| 1511 | mips_execute_unstoppable_instructions( 0 ); | |
| 1512 | } | |
| 1513 | ||
| 1514 | mips_common_exception( EXC_DBE, 0xbfc00180, 0x80000080 ); | |
| 1515 | } | |
| 1516 | ||
| 1517 | static void mips_load_bad_address( UINT32 address ) | |
| 1518 | { | |
| 1519 | mips_set_cp0r( CP0_BADA, address ); | |
| 1520 | mips_exception( EXC_ADEL ); | |
| 1521 | } | |
| 1522 | ||
| 1523 | static void mips_store_bad_address( UINT32 address ) | |
| 1524 | { | |
| 1525 | mips_set_cp0r( CP0_BADA, address ); | |
| 1526 | mips_exception( EXC_ADES ); | |
| 1527 | } | |
| 1528 | ||
| 1529 | INLINE int mips_data_address_breakpoint( int dcic_rw, int dcic_status, UINT32 address ) | |
| 1530 | { | |
| 1531 | if( address < 0x1f000000 || address > 0x1fffffff ) | |
| 1532 | { | |
| 1533 | if( ( mipscpu.cp0r[ CP0_DCIC ] & DCIC_DE ) != 0 && | |
| 1534 | ( ( ( mipscpu.cp0r[ CP0_DCIC ] & DCIC_KD ) != 0 && ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) == 0 ) || | |
| 1535 | ( ( mipscpu.cp0r[ CP0_DCIC ] & DCIC_UD ) != 0 && ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) != 0 ) ) ) | |
| 1536 | { | |
| 1537 | if( ( mipscpu.cp0r[ CP0_DCIC ] & dcic_rw ) == dcic_rw && | |
| 1538 | ( address & mipscpu.cp0r[ CP0_BDAM ] ) == ( mipscpu.cp0r[ CP0_BDA ] & mipscpu.cp0r[ CP0_BDAM ] ) ) | |
| 1539 | { | |
| 1540 | mipscpu.cp0r[ CP0_DCIC ] = ( mipscpu.cp0r[ CP0_DCIC ] & ~DCIC_STATUS ) | dcic_status; | |
| 1541 | ||
| 1542 | if( ( mipscpu.cp0r[ CP0_DCIC ] & DCIC_TR ) != 0 ) | |
| 1543 | { | |
| 1544 | return 1; | |
| 1545 | } | |
| 1546 | } | |
| 1547 | } | |
| 1548 | } | |
| 1549 | ||
| 1550 | return 0; | |
| 1551 | } | |
| 1552 | ||
| 1553 | INLINE int mips_load_data_address_breakpoint( UINT32 address ) | |
| 1554 | { | |
| 1555 | return mips_data_address_breakpoint( DCIC_DR | DCIC_DAE, DCIC_DB | DCIC_DA | DCIC_R, address ); | |
| 1556 | } | |
| 1557 | ||
| 1558 | INLINE int mips_store_data_address_breakpoint( UINT32 address ) | |
| 1559 | { | |
| 1560 | return mips_data_address_breakpoint( DCIC_DW | DCIC_DAE, DCIC_DB | DCIC_DA | DCIC_W, address ); | |
| 1561 | } | |
| 1562 | ||
| 1563 | static STATE_POSTLOAD( mips_postload ) | |
| 1564 | { | |
| 1565 | mips_update_memory_handlers(); | |
| 1566 | mips_update_address_masks(); | |
| 1567 | mips_update_scratchpad(); | |
| 1568 | } | |
| 1569 | ||
| 1570 | static void mips_state_register( const char *type, int index ) | |
| 1571 | { | |
| 1572 | state_save_register_item( type, index, mipscpu.op ); | |
| 1573 | state_save_register_item( type, index, mipscpu.pc ); | |
| 1574 | state_save_register_item( type, index, mipscpu.delayv ); | |
| 1575 | state_save_register_item( type, index, mipscpu.delayr ); | |
| 1576 | state_save_register_item( type, index, mipscpu.hi ); | |
| 1577 | state_save_register_item( type, index, mipscpu.lo ); | |
| 1578 | state_save_register_item( type, index, mipscpu.biu ); | |
| 1579 | state_save_register_item_array( type, index, mipscpu.r ); | |
| 1580 | state_save_register_item_array( type, index, mipscpu.cp0r ); | |
| 1581 | state_save_register_item_array( type, index, mipscpu.cp2cr ); | |
| 1582 | state_save_register_item_array( type, index, mipscpu.cp2dr ); | |
| 1583 | state_save_register_item_array( type, index, mipscpu.icacheTag ); | |
| 1584 | state_save_register_item_array( type, index, mipscpu.icache ); | |
| 1585 | state_save_register_item_array( type, index, mipscpu.dcache ); | |
| 1586 | state_save_register_item( type, index, mipscpu.multiplier_operation ); | |
| 1587 | state_save_register_item( type, index, mipscpu.multiplier_operand1 ); | |
| 1588 | state_save_register_item( type, index, mipscpu.multiplier_operand2 ); | |
| 1589 | state_save_register_postload( Machine, mips_postload, NULL ); | |
| 1590 | } | |
| 1591 | ||
| 951 | 1592 | static void mips_init( int index, int clock, const void *config, int (*irqcallback)(int) ) |
| 952 | 1593 | { |
| 953 | 1594 | mipscpu.irq_callback = irqcallback; |
| 954 | 1595 | |
| 955 | state_save_register_item( "psxcpu", index, mipscpu.op ); | |
| 956 | state_save_register_item( "psxcpu", index, mipscpu.pc ); | |
| 957 | state_save_register_item( "psxcpu", index, mipscpu.delayv ); | |
| 958 | state_save_register_item( "psxcpu", index, mipscpu.delayr ); | |
| 959 | state_save_register_item( "psxcpu", index, mipscpu.hi ); | |
| 960 | state_save_register_item( "psxcpu", index, mipscpu.lo ); | |
| 961 | state_save_register_item_array( "psxcpu", index, mipscpu.r ); | |
| 962 | state_save_register_item_array( "psxcpu", index, mipscpu.cp0r ); | |
| 963 | state_save_register_item_array( "psxcpu", index, mipscpu.cp2cr ); | |
| 964 | state_save_register_item_array( "psxcpu", index, mipscpu.cp2dr ); | |
| 1596 | mips_state_register( "psxcpu", index ); | |
| 965 | 1597 | } |
| 966 | 1598 | |
| 967 | 1599 | static void mips_reset( void ) |
| 968 | 1600 | { |
| 969 | mips_set_cp0r( CP0_SR, ( mipscpu.cp0r[ CP0_SR ] & ~( SR_TS | SR_SWC | SR_KUC | SR_IEC ) ) | SR_BEV ); | |
| 970 | mips_set_cp0r( CP0_RANDOM, 63 ); /* todo: */ | |
| 971 | mips_set_cp0r( CP0_PRID, 0x00000200 ); /* todo: */ | |
| 1601 | mipscpu.delayr = 0; | |
| 1602 | mipscpu.delayv = 0; | |
| 1603 | ||
| 1604 | mipscpu.multiplier_operation = MULTIPLIER_OPERATION_IDLE; | |
| 1605 | ||
| 1606 | mips_update_memory_handlers(); | |
| 1607 | mips_update_address_masks(); | |
| 1608 | mips_update_scratchpad(); | |
| 1609 | ||
| 1610 | mips_set_cp0r( CP0_SR, SR_BEV ); | |
| 1611 | mips_set_cp0r( CP0_CAUSE, 0x00000000 ); | |
| 1612 | mips_set_cp0r( CP0_PRID, 0x00000002 ); | |
| 1613 | mips_set_cp0r( CP0_DCIC, 0x00000000 ); | |
| 1614 | mips_set_cp0r( CP0_BPCM, 0xffffffff ); | |
| 1615 | mips_set_cp0r( CP0_BDAM, 0xffffffff ); | |
| 972 | 1616 | mips_set_pc( 0xbfc00000 ); |
| 973 | 1617 | } |
| 974 | 1618 | |
| r2375 | r2376 | |
| 976 | 1620 | { |
| 977 | 1621 | } |
| 978 | 1622 | |
| 1623 | static UINT32 mips_get_register_from_pipeline( int reg ) | |
| 1624 | { | |
| 1625 | if( mipscpu.delayr == reg ) | |
| 1626 | { | |
| 1627 | UINT32 data = mipscpu.delayv; | |
| 1628 | ||
| 1629 | mipscpu.delayr = 0; | |
| 1630 | mipscpu.delayv = 0; | |
| 1631 | ||
| 1632 | return data; | |
| 1633 | } | |
| 1634 | ||
| 1635 | return mipscpu.r[ reg ]; | |
| 1636 | } | |
| 1637 | ||
| 1638 | static int mips_cop0_usable( void ) | |
| 1639 | { | |
| 1640 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) != 0 && ( mipscpu.cp0r[ CP0_SR ] & SR_CU0 ) == 0 ) | |
| 1641 | { | |
| 1642 | mips_exception( EXC_CPU ); | |
| 1643 | ||
| 1644 | return 0; | |
| 1645 | } | |
| 1646 | ||
| 1647 | return 1; | |
| 1648 | } | |
| 1649 | ||
| 1650 | static void mips_lwc( int cop, int sr_cu ) | |
| 1651 | { | |
| 1652 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1653 | int breakpoint = mips_load_data_address_breakpoint( address ); | |
| 1654 | ||
| 1655 | if( ( mipscpu.cp0r[ CP0_SR ] & sr_cu ) == 0 ) | |
| 1656 | { | |
| 1657 | mips_exception( EXC_CPU ); | |
| 1658 | } | |
| 1659 | else if( ( address & mipscpu.bad_word_address_mask ) != 0 ) | |
| 1660 | { | |
| 1661 | mips_load_bad_address( address ); | |
| 1662 | } | |
| 1663 | else if( breakpoint ) | |
| 1664 | { | |
| 1665 | mips_breakpoint_exception(); | |
| 1666 | } | |
| 1667 | else | |
| 1668 | { | |
| 1669 | UINT32 data = mipscpu.readword( address ); | |
| 1670 | ||
| 1671 | if( mipscpu.berr ) | |
| 1672 | { | |
| 1673 | mips_load_bus_error_exception(); | |
| 1674 | } | |
| 1675 | else | |
| 1676 | { | |
| 1677 | int reg = INS_RT( mipscpu.op ); | |
| 1678 | ||
| 1679 | mips_advance_pc(); | |
| 1680 | ||
| 1681 | switch( cop ) | |
| 1682 | { | |
| 1683 | case 0: | |
| 1684 | /* lwc0 doesn't update any cop0 registers */ | |
| 1685 | break; | |
| 1686 | ||
| 1687 | case 1: | |
| 1688 | setcp1dr( reg, data ); | |
| 1689 | break; | |
| 1690 | ||
| 1691 | case 2: | |
| 1692 | setcp2dr( reg, data ); | |
| 1693 | break; | |
| 1694 | ||
| 1695 | case 3: | |
| 1696 | setcp3dr( reg, data ); | |
| 1697 | break; | |
| 1698 | } | |
| 1699 | } | |
| 1700 | } | |
| 1701 | } | |
| 1702 | ||
| 1703 | static void mips_swc( int cop, int sr_cu ) | |
| 1704 | { | |
| 1705 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1706 | int breakpoint = mips_store_data_address_breakpoint( address ); | |
| 1707 | ||
| 1708 | if( ( mipscpu.cp0r[ CP0_SR ] & sr_cu ) == 0 ) | |
| 1709 | { | |
| 1710 | mips_exception( EXC_CPU ); | |
| 1711 | } | |
| 1712 | else if( ( address & mipscpu.bad_word_address_mask ) != 0 ) | |
| 1713 | { | |
| 1714 | mips_store_bad_address( address ); | |
| 1715 | } | |
| 1716 | else | |
| 1717 | { | |
| 1718 | UINT32 data = 0; | |
| 1719 | ||
| 1720 | switch( cop ) | |
| 1721 | { | |
| 1722 | case 0: | |
| 1723 | { | |
| 1724 | int address; | |
| 1725 | ||
| 1726 | if( mipscpu.delayr == MIPS_DELAYR_PC ) | |
| 1727 | { | |
| 1728 | switch( mipscpu.delayv & 0x0c ) | |
| 1729 | { | |
| 1730 | case 0x0c: | |
| 1731 | address = mipscpu.delayv; | |
| 1732 | break; | |
| 1733 | ||
| 1734 | default: | |
| 1735 | address = mipscpu.delayv + 4; | |
| 1736 | break; | |
| 1737 | } | |
| 1738 | } | |
| 1739 | else | |
| 1740 | { | |
| 1741 | switch( mipscpu.pc & 0x0c ) | |
| 1742 | { | |
| 1743 | case 0x0: | |
| 1744 | case 0xc: | |
| 1745 | address = mipscpu.pc + 0x08; | |
| 1746 | break; | |
| 1747 | ||
| 1748 | default: | |
| 1749 | address = mipscpu.pc | 0x0c; | |
| 1750 | break; | |
| 1751 | } | |
| 1752 | } | |
| 1753 | ||
| 1754 | data = program_read_dword_32le( address ); | |
| 1755 | } | |
| 1756 | break; | |
| 1757 | ||
| 1758 | case 1: | |
| 1759 | data = getcp1dr( INS_RT( mipscpu.op ) ); | |
| 1760 | break; | |
| 1761 | ||
| 1762 | case 2: | |
| 1763 | data = getcp2dr( INS_RT( mipscpu.op ) ); | |
| 1764 | break; | |
| 1765 | ||
| 1766 | case 3: | |
| 1767 | data = getcp3dr( INS_RT( mipscpu.op ) ); | |
| 1768 | break; | |
| 1769 | } | |
| 1770 | ||
| 1771 | mipscpu.writeword( address, data ); | |
| 1772 | ||
| 1773 | if( breakpoint ) | |
| 1774 | { | |
| 1775 | mips_breakpoint_exception(); | |
| 1776 | } | |
| 1777 | else if( mipscpu.berr ) | |
| 1778 | { | |
| 1779 | mips_store_bus_error_exception(); | |
| 1780 | } | |
| 1781 | else | |
| 1782 | { | |
| 1783 | mips_advance_pc(); | |
| 1784 | } | |
| 1785 | } | |
| 1786 | } | |
| 1787 | ||
| 1788 | static void mips_bc( int cop, int sr_cu, int condition ) | |
| 1789 | { | |
| 1790 | if( ( mipscpu.cp0r[ CP0_SR ] & sr_cu ) == 0 ) | |
| 1791 | { | |
| 1792 | mips_exception( EXC_CPU ); | |
| 1793 | } | |
| 1794 | else | |
| 1795 | { | |
| 1796 | mips_conditional_branch( !condition ); | |
| 1797 | } | |
| 1798 | } | |
| 1799 | ||
| 979 | 1800 | static int mips_execute( int cycles ) |
| 980 | 1801 | { |
| 981 | UINT32 n_res; | |
| 982 | ||
| 983 | 1802 | mips_ICount = cycles; |
| 984 | 1803 | do |
| 985 | 1804 | { |
| r2375 | r2376 | |
| 987 | 1806 | log_bioscall(); |
| 988 | 1807 | #endif |
| 989 | 1808 | |
| 990 | CALL_DEBUGGER(mipscpu.pc); | |
| 1809 | CALL_DEBUGGER( mipscpu.pc ); | |
| 991 | 1810 | |
| 992 | 1811 | mipscpu.op = cpu_readop32( mipscpu.pc ); |
| 993 | 1812 | switch( INS_OP( mipscpu.op ) ) |
| r2375 | r2376 | |
| 998 | 1817 | case FUNCT_SLL: |
| 999 | 1818 | mips_load( INS_RD( mipscpu.op ), mipscpu.r[ INS_RT( mipscpu.op ) ] << INS_SHAMT( mipscpu.op ) ); |
| 1000 | 1819 | break; |
| 1820 | ||
| 1001 | 1821 | case FUNCT_SRL: |
| 1002 | 1822 | mips_load( INS_RD( mipscpu.op ), mipscpu.r[ INS_RT( mipscpu.op ) ] >> INS_SHAMT( mipscpu.op ) ); |
| 1003 | 1823 | break; |
| 1824 | ||
| 1004 | 1825 | case FUNCT_SRA: |
| 1005 | 1826 | mips_load( INS_RD( mipscpu.op ), (INT32)mipscpu.r[ INS_RT( mipscpu.op ) ] >> INS_SHAMT( mipscpu.op ) ); |
| 1006 | 1827 | break; |
| 1828 | ||
| 1007 | 1829 | case FUNCT_SLLV: |
| 1008 | 1830 | mips_load( INS_RD( mipscpu.op ), mipscpu.r[ INS_RT( mipscpu.op ) ] << ( mipscpu.r[ INS_RS( mipscpu.op ) ] & 31 ) ); |
| 1009 | 1831 | break; |
| 1832 | ||
| 1010 | 1833 | case FUNCT_SRLV: |
| 1011 | 1834 | mips_load( INS_RD( mipscpu.op ), mipscpu.r[ INS_RT( mipscpu.op ) ] >> ( mipscpu.r[ INS_RS( mipscpu.op ) ] & 31 ) ); |
| 1012 | 1835 | break; |
| 1836 | ||
| 1013 | 1837 | case FUNCT_SRAV: |
| 1014 | 1838 | mips_load( INS_RD( mipscpu.op ), (INT32)mipscpu.r[ INS_RT( mipscpu.op ) ] >> ( mipscpu.r[ INS_RS( mipscpu.op ) ] & 31 ) ); |
| 1015 | 1839 | break; |
| 1840 | ||
| 1016 | 1841 | case FUNCT_JR: |
| 1017 | if( INS_RD( mipscpu.op ) != 0 ) | |
| 1018 | { | |
| 1019 | mips_exception( EXC_RI ); | |
| 1020 | } | |
| 1021 | else | |
| 1022 | { | |
| 1023 | mips_delayed_branch( mipscpu.r[ INS_RS( mipscpu.op ) ] ); | |
| 1024 | } | |
| 1842 | mips_branch( mipscpu.r[ INS_RS( mipscpu.op ) ] ); | |
| 1025 | 1843 | break; |
| 1844 | ||
| 1026 | 1845 | case FUNCT_JALR: |
| 1027 | n_res = mipscpu.pc + 8; | |
| 1028 | mips_delayed_branch( mipscpu.r[ INS_RS( mipscpu.op ) ] ); | |
| 1846 | mips_branch( mipscpu.r[ INS_RS( mipscpu.op ) ] ); | |
| 1029 | 1847 | if( INS_RD( mipscpu.op ) != 0 ) |
| 1030 | 1848 | { |
| 1031 | mipscpu.r[ INS_RD( mipscpu.op ) ] = | |
| 1849 | mipscpu.r[ INS_RD( mipscpu.op ) ] = mip | |
| 1032 | 1850 | } |
| 1033 | 1851 | break; |
| 1852 | ||
| 1034 | 1853 | case FUNCT_SYSCALL: |
| 1035 | 1854 | #if LOG_BIOSCALL |
| 1036 | 1855 | log_syscall(); |
| 1037 | 1856 | #endif |
| 1038 | 1857 | mips_exception( EXC_SYS ); |
| 1039 | 1858 | break; |
| 1859 | ||
| 1040 | 1860 | case FUNCT_BREAK: |
| 1041 | 1861 | mips_exception( EXC_BP ); |
| 1042 | 1862 | break; |
| 1863 | ||
| 1043 | 1864 | case FUNCT_MFHI: |
| 1044 | mips_load( INS_RD( mipscpu.op ), mips | |
| 1865 | mips_load( INS_RD( mipscpu.op ), mips_get_hi() ); | |
| 1045 | 1866 | break; |
| 1867 | ||
| 1046 | 1868 | case FUNCT_MTHI: |
| 1047 | if( INS_RD( mipscpu.op ) != 0 ) | |
| 1048 | { | |
| 1049 | mips_exception( EXC_RI ); | |
| 1050 | } | |
| 1051 | else | |
| 1052 | { | |
| 1053 | mips_advance_pc(); | |
| 1054 | mipscpu.hi = mipscpu.r[ INS_RS( mipscpu.op ) ]; | |
| 1055 | } | |
| 1869 | funct_mthi(); | |
| 1870 | mips_advance_pc(); | |
| 1056 | 1871 | break; |
| 1872 | ||
| 1057 | 1873 | case FUNCT_MFLO: |
| 1058 | mips_load( INS_RD( mipscpu.op ), | |
| 1874 | mips_load( INS_RD( mipscpu.op ), | |
| 1059 | 1875 | break; |
| 1876 | ||
| 1060 | 1877 | case FUNCT_MTLO: |
| 1061 | if( INS_RD( mipscpu.op ) != 0 ) | |
| 1062 | { | |
| 1063 | mips_exception( EXC_RI ); | |
| 1064 | } | |
| 1065 | else | |
| 1066 | { | |
| 1067 | mips_advance_pc(); | |
| 1068 | mipscpu.lo = mipscpu.r[ INS_RS( mipscpu.op ) ]; | |
| 1069 | } | |
| 1878 | funct_mtlo(); | |
| 1879 | mips_advance_pc(); | |
| 1070 | 1880 | break; |
| 1881 | ||
| 1071 | 1882 | case FUNCT_MULT: |
| 1072 | if( INS_RD( mipscpu.op ) != 0 ) | |
| 1073 | { | |
| 1074 | mips_exception( EXC_RI ); | |
| 1075 | } | |
| 1076 | else | |
| 1077 | { | |
| 1078 | INT64 n_res64; | |
| 1079 | n_res64 = MUL_64_32_32( (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ], (INT32)mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1080 | mips_advance_pc(); | |
| 1081 | mipscpu.lo = LO32_32_64( n_res64 ); | |
| 1082 | mipscpu.hi = HI32_32_64( n_res64 ); | |
| 1083 | } | |
| 1883 | funct_mult(); | |
| 1884 | mips_advance_pc(); | |
| 1084 | 1885 | break; |
| 1886 | ||
| 1085 | 1887 | case FUNCT_MULTU: |
| 1086 | if( INS_RD( mipscpu.op ) != 0 ) | |
| 1087 | { | |
| 1088 | mips_exception( EXC_RI ); | |
| 1089 | } | |
| 1090 | else | |
| 1091 | { | |
| 1092 | UINT64 n_res64; | |
| 1093 | n_res64 = MUL_U64_U32_U32( mipscpu.r[ INS_RS( mipscpu.op ) ], mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1094 | mips_advance_pc(); | |
| 1095 | mipscpu.lo = LO32_U32_U64( n_res64 ); | |
| 1096 | mipscpu.hi = HI32_U32_U64( n_res64 ); | |
| 1097 | } | |
| 1888 | funct_multu(); | |
| 1889 | mips_advance_pc(); | |
| 1098 | 1890 | break; |
| 1891 | ||
| 1099 | 1892 | case FUNCT_DIV: |
| 1100 | if( INS_RD( mipscpu.op ) != 0 ) | |
| 1101 | { | |
| 1102 | mips_exception( EXC_RI ); | |
| 1103 | } | |
| 1104 | else | |
| 1105 | { | |
| 1106 | UINT32 n_div; | |
| 1107 | UINT32 n_mod; | |
| 1108 | if( mipscpu.r[ INS_RT( mipscpu.op ) ] != 0 ) | |
| 1109 | { | |
| 1110 | n_div = (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] / (INT32)mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1111 | n_mod = (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] % (INT32)mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1112 | mips_advance_pc(); | |
| 1113 | mipscpu.lo = n_div; | |
| 1114 | mipscpu.hi = n_mod; | |
| 1115 | } | |
| 1116 | else | |
| 1117 | { | |
| 1118 | mips_advance_pc(); | |
| 1119 | } | |
| 1120 | } | |
| 1893 | funct_div(); | |
| 1894 | mips_advance_pc(); | |
| 1121 | 1895 | break; |
| 1896 | ||
| 1122 | 1897 | case FUNCT_DIVU: |
| 1123 | if( INS_RD( mipscpu.op ) != 0 ) | |
| 1124 | { | |
| 1125 | mips_exception( EXC_RI ); | |
| 1126 | } | |
| 1127 | else | |
| 1128 | { | |
| 1129 | UINT32 n_div; | |
| 1130 | UINT32 n_mod; | |
| 1131 | if( mipscpu.r[ INS_RT( mipscpu.op ) ] != 0 ) | |
| 1132 | { | |
| 1133 | n_div = mipscpu.r[ INS_RS( mipscpu.op ) ] / mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1134 | n_mod = mipscpu.r[ INS_RS( mipscpu.op ) ] % mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1135 | mips_advance_pc(); | |
| 1136 | mipscpu.lo = n_div; | |
| 1137 | mipscpu.hi = n_mod; | |
| 1138 | } | |
| 1139 | else | |
| 1140 | { | |
| 1141 | mips_advance_pc(); | |
| 1142 | } | |
| 1143 | } | |
| 1898 | funct_divu(); | |
| 1899 | mips_advance_pc(); | |
| 1144 | 1900 | break; |
| 1901 | ||
| 1145 | 1902 | case FUNCT_ADD: |
| 1146 | 1903 | { |
| 1147 | n_res = mipscpu.r[ INS_RS( mipscpu.op ) ] + mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1148 | if( (INT32)( ~( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ mipscpu.r[ INS_RT( mipscpu.op ) ] ) & ( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ n_res ) ) < 0 ) | |
| 1904 | UINT32 result = mipscpu.r[ INS_RS( mipscpu.op ) ] + mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1905 | if( (INT32)( ~( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ mipscpu.r[ INS_RT( mipscpu.op ) ] ) & ( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ result ) ) < 0 ) | |
| 1149 | 1906 | { |
| 1150 | 1907 | mips_exception( EXC_OVF ); |
| 1151 | 1908 | } |
| 1152 | 1909 | else |
| 1153 | 1910 | { |
| 1154 | mips_load( INS_RD( mipscpu.op ), | |
| 1911 | mips_load( INS_RD( mipscpu.op ), | |
| 1155 | 1912 | } |
| 1156 | 1913 | } |
| 1157 | 1914 | break; |
| 1915 | ||
| 1158 | 1916 | case FUNCT_ADDU: |
| 1159 | 1917 | mips_load( INS_RD( mipscpu.op ), mipscpu.r[ INS_RS( mipscpu.op ) ] + mipscpu.r[ INS_RT( mipscpu.op ) ] ); |
| 1160 | 1918 | break; |
| 1919 | ||
| 1161 | 1920 | case FUNCT_SUB: |
| 1162 | n_res = mipscpu.r[ INS_RS( mipscpu.op ) ] - mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1163 | if( (INT32)( ( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ mipscpu.r[ INS_RT( mipscpu.op ) ] ) & ( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ n_res ) ) < 0 ) | |
| 1164 | 1921 | { |
| 1165 | mips_exception( EXC_OVF ); | |
| 1922 | UINT32 result = mipscpu.r[ INS_RS( mipscpu.op ) ] - mipscpu.r[ INS_RT( mipscpu.op ) ]; | |
| 1923 | if( (INT32)( ( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ mipscpu.r[ INS_RT( mipscpu.op ) ] ) & ( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ result ) ) < 0 ) | |
| 1924 | { | |
| 1925 | mips_exception( EXC_OVF ); | |
| 1926 | } | |
| 1927 | else | |
| 1928 | { | |
| 1929 | mips_load( INS_RD( mipscpu.op ), result ); | |
| 1930 | } | |
| 1166 | 1931 | } |
| 1167 | else | |
| 1168 | { | |
| 1169 | mips_load( INS_RD( mipscpu.op ), n_res ); | |
| 1170 | } | |
| 1171 | 1932 | break; |
| 1933 | ||
| 1172 | 1934 | case FUNCT_SUBU: |
| 1173 | 1935 | mips_load( INS_RD( mipscpu.op ), mipscpu.r[ INS_RS( mipscpu.op ) ] - mipscpu.r[ INS_RT( mipscpu.op ) ] ); |
| 1174 | 1936 | break; |
| 1937 | ||
| 1175 | 1938 | case FUNCT_AND: |
| 1176 | 1939 | mips_load( INS_RD( mipscpu.op ), mipscpu.r[ INS_RS( mipscpu.op ) ] & mipscpu.r[ INS_RT( mipscpu.op ) ] ); |
| 1177 | 1940 | break; |
| 1941 | ||
| 1178 | 1942 | case FUNCT_OR: |
| 1179 | 1943 | mips_load( INS_RD( mipscpu.op ), mipscpu.r[ INS_RS( mipscpu.op ) ] | mipscpu.r[ INS_RT( mipscpu.op ) ] ); |
| 1180 | 1944 | break; |
| 1945 | ||
| 1181 | 1946 | case FUNCT_XOR: |
| 1182 | 1947 | mips_load( INS_RD( mipscpu.op ), mipscpu.r[ INS_RS( mipscpu.op ) ] ^ mipscpu.r[ INS_RT( mipscpu.op ) ] ); |
| 1183 | 1948 | break; |
| 1949 | ||
| 1184 | 1950 | case FUNCT_NOR: |
| 1185 | 1951 | mips_load( INS_RD( mipscpu.op ), ~( mipscpu.r[ INS_RS( mipscpu.op ) ] | mipscpu.r[ INS_RT( mipscpu.op ) ] ) ); |
| 1186 | 1952 | break; |
| 1953 | ||
| 1187 | 1954 | case FUNCT_SLT: |
| 1188 | 1955 | mips_load( INS_RD( mipscpu.op ), (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] < (INT32)mipscpu.r[ INS_RT( mipscpu.op ) ] ); |
| 1189 | 1956 | break; |
| 1957 | ||
| 1190 | 1958 | case FUNCT_SLTU: |
| 1191 | 1959 | mips_load( INS_RD( mipscpu.op ), mipscpu.r[ INS_RS( mipscpu.op ) ] < mipscpu.r[ INS_RT( mipscpu.op ) ] ); |
| 1192 | 1960 | break; |
| 1961 | ||
| 1193 | 1962 | default: |
| 1194 | 1963 | mips_exception( EXC_RI ); |
| 1195 | 1964 | break; |
| 1196 | 1965 | } |
| 1197 | 1966 | break; |
| 1967 | ||
| 1198 | 1968 | case OP_REGIMM: |
| 1199 | switch( INS_RT( mipscpu.op ) ) | |
| 1969 | switch( INS_RT_REGIMM( mipscpu.op ) ) | |
| 1200 | 1970 | { |
| 1201 | 1971 | case RT_BLTZ: |
| 1202 | if( (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] < 0 ) | |
| 1972 | mips_conditional_branch( (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] < 0 ); | |
| 1973 | ||
| 1974 | if( INS_RT( mipscpu.op ) == RT_BLTZAL ) | |
| 1203 | 1975 | { |
| 1204 | mips | |
| 1976 | mips | |
| 1205 | 1977 | } |
| 1206 | else | |
| 1207 | { | |
| 1208 | mips_advance_pc(); | |
| 1209 | } | |
| 1210 | 1978 | break; |
| 1979 | ||
| 1211 | 1980 | case RT_BGEZ: |
| 1212 | if( (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] >= 0 ) | |
| 1981 | mips_conditional_branch( (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] >= 0 ); | |
| 1982 | ||
| 1983 | if( INS_RT( mipscpu.op ) == RT_BGEZAL ) | |
| 1213 | 1984 | { |
| 1214 | mips | |
| 1985 | mips | |
| 1215 | 1986 | } |
| 1216 | else | |
| 1217 | { | |
| 1218 | mips_advance_pc(); | |
| 1219 | } | |
| 1220 | 1987 | break; |
| 1221 | case RT_BLTZAL: | |
| 1222 | n_res = mipscpu.pc + 8; | |
| 1223 | if( (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] < 0 ) | |
| 1224 | { | |
| 1225 | mips_delayed_branch( mipscpu.pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ) << 2 ) ); | |
| 1226 | } | |
| 1227 | else | |
| 1228 | { | |
| 1229 | mips_advance_pc(); | |
| 1230 | } | |
| 1231 | mipscpu.r[ 31 ] = n_res; | |
| 1232 | break; | |
| 1233 | case RT_BGEZAL: | |
| 1234 | n_res = mipscpu.pc + 8; | |
| 1235 | if( (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] >= 0 ) | |
| 1236 | { | |
| 1237 | mips_delayed_branch( mipscpu.pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ) << 2 ) ); | |
| 1238 | } | |
| 1239 | else | |
| 1240 | { | |
| 1241 | mips_advance_pc(); | |
| 1242 | } | |
| 1243 | mipscpu.r[ 31 ] = n_res; | |
| 1244 | break; | |
| 1245 | 1988 | } |
| 1246 | 1989 | break; |
| 1990 | ||
| 1247 | 1991 | case OP_J: |
| 1248 | mips_d | |
| 1992 | mips_unconditional | |
| 1249 | 1993 | break; |
| 1994 | ||
| 1250 | 1995 | case OP_JAL: |
| 1251 | n_res = mipscpu.pc + 8; | |
| 1252 | mips_delayed_branch( ( ( mipscpu.pc + 4 ) & 0xf0000000 ) + ( INS_TARGET( mipscpu.op ) << 2 ) ); | |
| 1253 | mipscpu.r[ 31 ] = n_res; | |
| 1996 | mips_unconditional_branch(); | |
| 1997 | mipscpu.r[ 31 ] = mipscpu.pc + 4; | |
| 1254 | 1998 | break; |
| 1999 | ||
| 1255 | 2000 | case OP_BEQ: |
| 1256 | if( mipscpu.r[ INS_RS( mipscpu.op ) ] == mipscpu.r[ INS_RT( mipscpu.op ) ] ) | |
| 1257 | { | |
| 1258 | mips_delayed_branch( mipscpu.pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ) << 2 ) ); | |
| 1259 | } | |
| 1260 | else | |
| 1261 | { | |
| 1262 | mips_advance_pc(); | |
| 1263 | } | |
| 2001 | mips_conditional_branch( mipscpu.r[ INS_RS( mipscpu.op ) ] == mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1264 | 2002 | break; |
| 2003 | ||
| 1265 | 2004 | case OP_BNE: |
| 1266 | if( mipscpu.r[ INS_RS( mipscpu.op ) ] != mipscpu.r[ INS_RT( mipscpu.op ) ] ) | |
| 1267 | { | |
| 1268 | mips_delayed_branch( mipscpu.pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ) << 2 ) ); | |
| 1269 | } | |
| 1270 | else | |
| 1271 | { | |
| 1272 | mips_advance_pc(); | |
| 1273 | } | |
| 2005 | mips_conditional_branch( mipscpu.r[ INS_RS( mipscpu.op ) ] != mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1274 | 2006 | break; |
| 2007 | ||
| 1275 | 2008 | case OP_BLEZ: |
| 1276 | if( INS_RT( mipscpu.op ) != 0 ) | |
| 1277 | { | |
| 1278 | mips_exception( EXC_RI ); | |
| 1279 | } | |
| 1280 | else if( (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] <= 0 ) | |
| 1281 | { | |
| 1282 | mips_delayed_branch( mipscpu.pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ) << 2 ) ); | |
| 1283 | } | |
| 1284 | else | |
| 1285 | { | |
| 1286 | mips_advance_pc(); | |
| 1287 | } | |
| 2009 | mips_conditional_branch( (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] < 0 || mipscpu.r[ INS_RS( mipscpu.op ) ] == mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1288 | 2010 | break; |
| 2011 | ||
| 1289 | 2012 | case OP_BGTZ: |
| 1290 | if( INS_RT( mipscpu.op ) != 0 ) | |
| 1291 | { | |
| 1292 | mips_exception( EXC_RI ); | |
| 1293 | } | |
| 1294 | else if( (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] > 0 ) | |
| 1295 | { | |
| 1296 | mips_delayed_branch( mipscpu.pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ) << 2 ) ); | |
| 1297 | } | |
| 1298 | else | |
| 1299 | { | |
| 1300 | mips_advance_pc(); | |
| 1301 | } | |
| 2013 | mips_conditional_branch( (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] >= 0 && mipscpu.r[ INS_RS( mipscpu.op ) ] != mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1302 | 2014 | break; |
| 2015 | ||
| 1303 | 2016 | case OP_ADDI: |
| 1304 | 2017 | { |
| 1305 | UINT32 n_imm; | |
| 1306 | n_imm = MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1307 | n_res = mipscpu.r[ INS_RS( mipscpu.op ) ] + n_imm; | |
| 1308 | if( (INT32)( ~( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ n_imm ) & ( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ n_res ) ) < 0 ) | |
| 2018 | UINT32 immediate = MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2019 | UINT32 result = mipscpu.r[ INS_RS( mipscpu.op ) ] + immediate; | |
| 2020 | if( (INT32)( ~( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ immediate ) & ( mipscpu.r[ INS_RS( mipscpu.op ) ] ^ result ) ) < 0 ) | |
| 1309 | 2021 | { |
| 1310 | 2022 | mips_exception( EXC_OVF ); |
| 1311 | 2023 | } |
| 1312 | 2024 | else |
| 1313 | 2025 | { |
| 1314 | mips_load( INS_RT( mipscpu.op ), | |
| 2026 | mips_load( INS_RT( mipscpu.op ), | |
| 1315 | 2027 | } |
| 1316 | 2028 | } |
| 1317 | 2029 | break; |
| 2030 | ||
| 1318 | 2031 | case OP_ADDIU: |
| 1319 | 2032 | mips_load( INS_RT( mipscpu.op ), mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ) ); |
| 1320 | 2033 | break; |
| 2034 | ||
| 1321 | 2035 | case OP_SLTI: |
| 1322 | 2036 | mips_load( INS_RT( mipscpu.op ), (INT32)mipscpu.r[ INS_RS( mipscpu.op ) ] < MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ) ); |
| 1323 | 2037 | break; |
| 2038 | ||
| 1324 | 2039 | case OP_SLTIU: |
| 1325 | 2040 | mips_load( INS_RT( mipscpu.op ), mipscpu.r[ INS_RS( mipscpu.op ) ] < (UINT32)MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ) ); |
| 1326 | 2041 | break; |
| 2042 | ||
| 1327 | 2043 | case OP_ANDI: |
| 1328 | 2044 | mips_load( INS_RT( mipscpu.op ), mipscpu.r[ INS_RS( mipscpu.op ) ] & INS_IMMEDIATE( mipscpu.op ) ); |
| 1329 | 2045 | break; |
| 2046 | ||
| 1330 | 2047 | case OP_ORI: |
| 1331 | 2048 | mips_load( INS_RT( mipscpu.op ), mipscpu.r[ INS_RS( mipscpu.op ) ] | INS_IMMEDIATE( mipscpu.op ) ); |
| 1332 | 2049 | break; |
| 2050 | ||
| 1333 | 2051 | case OP_XORI: |
| 1334 | 2052 | mips_load( INS_RT( mipscpu.op ), mipscpu.r[ INS_RS( mipscpu.op ) ] ^ INS_IMMEDIATE( mipscpu.op ) ); |
| 1335 | 2053 | break; |
| 2054 | ||
| 1336 | 2055 | case OP_LUI: |
| 1337 | 2056 | mips_load( INS_RT( mipscpu.op ), INS_IMMEDIATE( mipscpu.op ) << 16 ); |
| 1338 | 2057 | break; |
| 2058 | ||
| 1339 | 2059 | case OP_COP0: |
| 1340 | i | |
| 2060 | switch( IN | |
| 1341 | 2061 | { |
| 1342 | mips_exception( EXC_CPU ); | |
| 1343 | mips_set_cp0r( CP0_CAUSE, ( mipscpu.cp0r[ CP0_CAUSE ] & ~CAUSE_CE ) | CAUSE_CE0 ); | |
| 1344 | } | |
| 1345 | else | |
| 1346 | { | |
| 1347 | switch( INS_RS( mipscpu.op ) ) | |
| 2062 | case RS_MFC: | |
| 1348 | 2063 | { |
| 1349 | case RS_MFC: | |
| 1350 | mips_delayed_load( INS_RT( mipscpu.op ), mipscpu.cp0r[ INS_RD( mipscpu.op ) ] ); | |
| 1351 | break; | |
| 1352 | case RS_CFC: | |
| 1353 | /* todo: */ | |
| 1354 | logerror( "%08x: COP0 CFC not supported\n", mipscpu.pc ); | |
| 1355 | mips_stop(); | |
| 1356 | mips_advance_pc(); | |
| 1357 | break; | |
| 1358 | case RS_MTC: | |
| 1359 | n_res = ( mipscpu.cp0r[ INS_RD( mipscpu.op ) ] & ~mips_mtc0_writemask[ INS_RD( mipscpu.op ) ] ) | | |
| 1360 | ( mipscpu.r[ INS_RT( mipscpu.op ) ] & mips_mtc0_writemask[ INS_RD( mipscpu.op ) ] ); | |
| 1361 | mips_advance_pc(); | |
| 1362 | mips_set_cp0r( INS_RD( mipscpu.op ), n_res ); | |
| 1363 | break; | |
| 1364 | case RS_CTC: | |
| 1365 | /* todo: */ | |
| 1366 | logerror( "%08x: COP0 CTC not supported\n", mipscpu.pc ); | |
| 1367 | mips_stop(); | |
| 1368 | mips_advance_pc(); | |
| 1369 | break; | |
| 1370 | case RS_BC: | |
| 1371 | switch( INS_RT( mipscpu.op ) ) | |
| 2064 | int reg = INS_RD( mipscpu.op ); | |
| 2065 | ||
| 2066 | if( reg == CP0_INDEX || | |
| 2067 | reg == CP0_RANDOM || | |
| 2068 | reg == CP0_ENTRYLO || | |
| 2069 | reg == CP0_CONTEXT || | |
| 2070 | reg == CP0_ENTRYHI ) | |
| 1372 | 2071 | { |
| 1373 | case RT_BCF: | |
| 1374 | /* todo: */ | |
| 1375 | logerror( "%08x: COP0 BCF not supported\n", mipscpu.pc ); | |
| 1376 | mips_stop(); | |
| 2072 | mips_exception( EXC_RI ); | |
| 2073 | } | |
| 2074 | else if( reg < 16 ) | |
| 2075 | { | |
| 2076 | if( mips_cop0_usable() ) | |
| 2077 | { | |
| 2078 | mips_delayed_load( INS_RT( mipscpu.op ), mipscpu.cp0r[ reg ] ); | |
| 2079 | } | |
| 2080 | } | |
| 2081 | else | |
| 2082 | { | |
| 1377 | 2083 | mips_advance_pc(); |
| 1378 | break; | |
| 1379 | case RT_BCT: | |
| 1380 | /* todo: */ | |
| 1381 | logerror( "%08x: COP0 BCT not supported\n", mipscpu.pc ); | |
| 1382 | mips_stop(); | |
| 2084 | } | |
| 2085 | } | |
| 2086 | break; | |
| 2087 | ||
| 2088 | case RS_CFC: | |
| 2089 | mips_exception( EXC_RI ); | |
| 2090 | break; | |
| 2091 | ||
| 2092 | case RS_MTC: | |
| 2093 | { | |
| 2094 | int reg = INS_RD( mipscpu.op ); | |
| 2095 | ||
| 2096 | if( reg == CP0_INDEX || | |
| 2097 | reg == CP0_RANDOM || | |
| 2098 | reg == CP0_ENTRYLO || | |
| 2099 | reg == CP0_CONTEXT || | |
| 2100 | reg == CP0_ENTRYHI ) | |
| 2101 | { | |
| 2102 | mips_exception( EXC_RI ); | |
| 2103 | } | |
| 2104 | else if( reg < 16 ) | |
| 2105 | { | |
| 2106 | if( mips_cop0_usable() ) | |
| 2107 | { | |
| 2108 | UINT32 data = ( mipscpu.cp0r[ reg ] & ~mips_mtc0_writemask[ reg ] ) | | |
| 2109 | ( mipscpu.r[ INS_RT( mipscpu.op ) ] & mips_mtc0_writemask[ reg ] ); | |
| 2110 | mips_advance_pc(); | |
| 2111 | ||
| 2112 | mips_set_cp0r( reg, data ); | |
| 2113 | } | |
| 2114 | } | |
| 2115 | else | |
| 2116 | { | |
| 1383 | 2117 | mips_advance_pc(); |
| 1384 | break; | |
| 1385 | default: | |
| 1386 | /* todo: */ | |
| 1387 | logerror( "%08x: COP0 unknown command %08x\n", mipscpu.pc, mipscpu.op ); | |
| 1388 | mips_stop(); | |
| 1389 | mips_advance_pc(); | |
| 1390 | break; | |
| 1391 | 2118 | } |
| 2119 | } | |
| 2120 | break; | |
| 2121 | ||
| 2122 | case RS_CTC: | |
| 2123 | mips_exception( EXC_RI ); | |
| 2124 | break; | |
| 2125 | ||
| 2126 | case RS_BC: | |
| 2127 | case RS_BC_ALT: | |
| 2128 | switch( INS_BC( mipscpu.op ) ) | |
| 2129 | { | |
| 2130 | case BC_BCF: | |
| 2131 | mips_bc( 0, SR_CU0, 0 ); | |
| 1392 | 2132 | break; |
| 1393 | default: | |
| 1394 | switch( INS_CO( mipscpu.op ) ) | |
| 2133 | ||
| 2134 | case BC_BCT: | |
| 2135 | mips_bc( 0, SR_CU0, 1 ); | |
| 2136 | break; | |
| 2137 | } | |
| 2138 | break; | |
| 2139 | ||
| 2140 | default: | |
| 2141 | switch( INS_CO( mipscpu.op ) ) | |
| 2142 | { | |
| 2143 | case 1: | |
| 2144 | switch( INS_CF( mipscpu.op ) ) | |
| 1395 | 2145 | { |
| 1396 | case 1: | |
| 1397 | switch( INS_CF( mipscpu.op ) ) | |
| 2146 | case CF_TLBR: | |
| 2147 | case CF_TLBWI: | |
| 2148 | case CF_TLBWR: | |
| 2149 | case CF_TLBP: | |
| 2150 | mips_exception( EXC_RI ); | |
| 2151 | break; | |
| 2152 | ||
| 2153 | case CF_RFE: | |
| 2154 | if( mips_cop0_usable() ) | |
| 1398 | 2155 | { |
| 1399 | case CF_RFE: | |
| 1400 | 2156 | mips_advance_pc(); |
| 1401 | 2157 | mips_set_cp0r( CP0_SR, ( mipscpu.cp0r[ CP0_SR ] & ~0xf ) | ( ( mipscpu.cp0r[ CP0_SR ] >> 2 ) & 0xf ) ); |
| 1402 | break; | |
| 1403 | default: | |
| 1404 | /* todo: */ | |
| 1405 | logerror( "%08x: COP0 unknown command %08x\n", mipscpu.pc, mipscpu.op ); | |
| 1406 | mips_stop(); | |
| 1407 | mips_advance_pc(); | |
| 1408 | break; | |
| 1409 | 2158 | } |
| 1410 | 2159 | break; |
| 2160 | ||
| 1411 | 2161 | default: |
| 1412 | /* todo: */ | |
| 1413 | logerror( "%08x: COP0 unknown command %08x\n", mipscpu.pc, mipscpu.op ); | |
| 1414 | mips_stop(); | |
| 1415 | 2162 | mips_advance_pc(); |
| 1416 | 2163 | break; |
| 1417 | 2164 | } |
| 1418 | 2165 | break; |
| 2166 | ||
| 2167 | default: | |
| 2168 | mips_advance_pc(); | |
| 2169 | break; | |
| 1419 | 2170 | } |
| 2171 | break; | |
| 1420 | 2172 | } |
| 1421 | 2173 | break; |
| 2174 | ||
| 1422 | 2175 | case OP_COP1: |
| 1423 | 2176 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_CU1 ) == 0 ) |
| 1424 | 2177 | { |
| 1425 | 2178 | mips_exception( EXC_CPU ); |
| 1426 | mips_set_cp0r( CP0_CAUSE, ( mipscpu.cp0r[ CP0_CAUSE ] & ~CAUSE_CE ) | CAUSE_CE1 ); | |
| 1427 | 2179 | } |
| 1428 | 2180 | else |
| 1429 | 2181 | { |
| 1430 | 2182 | switch( INS_RS( mipscpu.op ) ) |
| 1431 | 2183 | { |
| 1432 | 2184 | case RS_MFC: |
| 1433 | /* todo: */ | |
| 1434 | logerror( "%08x: COP1 BCT not supported\n", mipscpu.pc ); | |
| 1435 | mips_stop(); | |
| 1436 | mips_advance_pc(); | |
| 2185 | mips_delayed_load( INS_RT( mipscpu.op ), getcp1dr( INS_RD( mipscpu.op ) ) ); | |
| 1437 | 2186 | break; |
| 2187 | ||
| 1438 | 2188 | case RS_CFC: |
| 1439 | /* todo: */ | |
| 1440 | logerror( "%08x: COP1 CFC not supported\n", mipscpu.pc ); | |
| 1441 | mips_stop(); | |
| 1442 | mips_advance_pc(); | |
| 2189 | mips_delayed_load( INS_RT( mipscpu.op ), getcp1cr( INS_RD( mipscpu.op ) ) ); | |
| 1443 | 2190 | break; |
| 2191 | ||
| 1444 | 2192 | case RS_MTC: |
| 1445 | /* todo: */ | |
| 1446 | logerror( "%08x: COP1 MTC not supported\n", mipscpu.pc ); | |
| 1447 | mips_stop(); | |
| 2193 | setcp1dr( INS_RD( mipscpu.op ), mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1448 | 2194 | mips_advance_pc(); |
| 1449 | 2195 | break; |
| 2196 | ||
| 1450 | 2197 | case RS_CTC: |
| 1451 | /* todo: */ | |
| 1452 | logerror( "%08x: COP1 CTC not supported\n", mipscpu.pc ); | |
| 1453 | mips_stop(); | |
| 2198 | setcp1cr( INS_RD( mipscpu.op ), mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1454 | 2199 | mips_advance_pc(); |
| 1455 | 2200 | break; |
| 2201 | ||
| 1456 | 2202 | case RS_BC: |
| 1457 | switch( INS_RT( mipscpu.op ) ) | |
| 2203 | case RS_BC_ALT: | |
| 2204 | switch( INS_BC( mipscpu.op ) ) | |
| 1458 | 2205 | { |
| 1459 | case RT_BCF: | |
| 1460 | /* todo: */ | |
| 1461 | logerror( "%08x: COP1 BCF not supported\n", mipscpu.pc ); | |
| 1462 | mips_stop(); | |
| 1463 | mips_advance_pc(); | |
| 2206 | case BC_BCF: | |
| 2207 | mips_bc( 1, SR_CU1, 0 ); | |
| 1464 | 2208 | break; |
| 1465 | case RT_BCT: | |
| 1466 | /* todo: */ | |
| 1467 | logerror( "%08x: COP1 BCT not supported\n", mipscpu.pc ); | |
| 1468 | mips_stop(); | |
| 1469 | mips_advance_pc(); | |
| 2209 | ||
| 2210 | case BC_BCT: | |
| 2211 | mips_bc( 1, SR_CU1, 1 ); | |
| 1470 | 2212 | break; |
| 1471 | default: | |
| 1472 | /* todo: */ | |
| 1473 | logerror( "%08x: COP1 unknown command %08x\n", mipscpu.pc, mipscpu.op ); | |
| 1474 | mips_stop(); | |
| 1475 | mips_advance_pc(); | |
| 1476 | break; | |
| 1477 | 2213 | } |
| 1478 | 2214 | break; |
| 2215 | ||
| 1479 | 2216 | default: |
| 1480 | switch( INS_CO( mipscpu.op ) ) | |
| 1481 | { | |
| 1482 | case 1: | |
| 1483 | /* todo: */ | |
| 1484 | logerror( "%08x: COP1 unknown command %08x\n", mipscpu.pc, mipscpu.op ); | |
| 1485 | mips_stop(); | |
| 1486 | mips_advance_pc(); | |
| 1487 | break; | |
| 1488 | default: | |
| 1489 | /* todo: */ | |
| 1490 | logerror( "%08x: COP1 unknown command %08x\n", mipscpu.pc, mipscpu.op ); | |
| 1491 | mips_stop(); | |
| 1492 | mips_advance_pc(); | |
| 1493 | break; | |
| 1494 | } | |
| 2217 | mips_advance_pc(); | |
| 1495 | 2218 | break; |
| 1496 | 2219 | } |
| 1497 | 2220 | } |
| 1498 | 2221 | break; |
| 2222 | ||
| 1499 | 2223 | case OP_COP2: |
| 1500 | 2224 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_CU2 ) == 0 ) |
| 1501 | 2225 | { |
| 1502 | 2226 | mips_exception( EXC_CPU ); |
| 1503 | mips_set_cp0r( CP0_CAUSE, ( mipscpu.cp0r[ CP0_CAUSE ] & ~CAUSE_CE ) | CAUSE_CE2 ); | |
| 1504 | 2227 | } |
| 1505 | 2228 | else |
| 1506 | 2229 | { |
| r2375 | r2376 | |
| 1509 | 2232 | case RS_MFC: |
| 1510 | 2233 | mips_delayed_load( INS_RT( mipscpu.op ), getcp2dr( INS_RD( mipscpu.op ) ) ); |
| 1511 | 2234 | break; |
| 2235 | ||
| 1512 | 2236 | case RS_CFC: |
| 1513 | 2237 | mips_delayed_load( INS_RT( mipscpu.op ), getcp2cr( INS_RD( mipscpu.op ) ) ); |
| 1514 | 2238 | break; |
| 2239 | ||
| 1515 | 2240 | case RS_MTC: |
| 1516 | 2241 | setcp2dr( INS_RD( mipscpu.op ), mipscpu.r[ INS_RT( mipscpu.op ) ] ); |
| 1517 | 2242 | mips_advance_pc(); |
| 1518 | 2243 | break; |
| 2244 | ||
| 1519 | 2245 | case RS_CTC: |
| 1520 | 2246 | setcp2cr( INS_RD( mipscpu.op ), mipscpu.r[ INS_RT( mipscpu.op ) ] ); |
| 1521 | 2247 | mips_advance_pc(); |
| 1522 | 2248 | break; |
| 2249 | ||
| 1523 | 2250 | case RS_BC: |
| 1524 | switch( INS_RT( mipscpu.op ) ) | |
| 2251 | case RS_BC_ALT: | |
| 2252 | switch( INS_BC( mipscpu.op ) ) | |
| 1525 | 2253 | { |
| 1526 | case RT_BCF: | |
| 1527 | /* todo: */ | |
| 1528 | logerror( "%08x: COP2 BCF not supported\n", mipscpu.pc ); | |
| 1529 | mips_stop(); | |
| 1530 | mips_advance_pc(); | |
| 2254 | case BC_BCF: | |
| 2255 | mips_bc( 2, SR_CU2, 0 ); | |
| 1531 | 2256 | break; |
| 1532 | case RT_BCT: | |
| 1533 | /* todo: */ | |
| 1534 | logerror( "%08x: COP2 BCT not supported\n", mipscpu.pc ); | |
| 1535 | mips_stop(); | |
| 1536 | mips_advance_pc(); | |
| 2257 | ||
| 2258 | case BC_BCT: | |
| 2259 | mips_bc( 2, SR_CU2, 1 ); | |
| 1537 | 2260 | break; |
| 1538 | default: | |
| 1539 | /* todo: */ | |
| 1540 | logerror( "%08x: COP2 unknown command %08x\n", mipscpu.pc, mipscpu.op ); | |
| 1541 | mips_stop(); | |
| 1542 | mips_advance_pc(); | |
| 1543 | break; | |
| 1544 | 2261 | } |
| 1545 | 2262 | break; |
| 2263 | ||
| 1546 | 2264 | default: |
| 1547 | 2265 | switch( INS_CO( mipscpu.op ) ) |
| 1548 | 2266 | { |
| r2375 | r2376 | |
| 1550 | 2268 | docop2( INS_COFUN( mipscpu.op ) ); |
| 1551 | 2269 | mips_advance_pc(); |
| 1552 | 2270 | break; |
| 2271 | ||
| 1553 | 2272 | default: |
| 1554 | /* todo: */ | |
| 1555 | logerror( "%08x: COP2 unknown command %08x\n", mipscpu.pc, mipscpu.op ); | |
| 1556 | mips_stop(); | |
| 1557 | 2273 | mips_advance_pc(); |
| 1558 | 2274 | break; |
| 1559 | 2275 | } |
| r2375 | r2376 | |
| 1561 | 2277 | } |
| 1562 | 2278 | } |
| 1563 | 2279 | break; |
| 1564 | case OP_LB: | |
| 1565 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 2280 | ||
| 2281 | case OP_COP3: | |
| 2282 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_CU3 ) == 0 ) | |
| 1566 | 2283 | { |
| 1567 | /* todo: */ | |
| 1568 | logerror( "%08x: LB SR_ISC not supported\n", mipscpu.pc ); | |
| 1569 | mips_stop(); | |
| 1570 | mips_advance_pc(); | |
| 2284 | mips_exception( EXC_CPU ); | |
| 1571 | 2285 | } |
| 1572 | else | |
| 2286 | else | |
| 1573 | 2287 | { |
| 1574 | UINT32 n_adr; | |
| 1575 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1576 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 2288 | switch( INS_RS( mipscpu.op ) ) | |
| 1577 | 2289 | { |
| 1578 | mips_exception( EXC_ADEL ); | |
| 1579 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2290 | case RS_MFC: | |
| 2291 | mips_delayed_load( INS_RT( mipscpu.op ), getcp3dr( INS_RD( mipscpu.op ) ) ); | |
| 2292 | break; | |
| 2293 | ||
| 2294 | case RS_CFC: | |
| 2295 | mips_delayed_load( INS_RT( mipscpu.op ), getcp3cr( INS_RD( mipscpu.op ) ) ); | |
| 2296 | break; | |
| 2297 | ||
| 2298 | case RS_MTC: | |
| 2299 | setcp3dr( INS_RD( mipscpu.op ), mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 2300 | mips_advance_pc(); | |
| 2301 | break; | |
| 2302 | ||
| 2303 | case RS_CTC: | |
| 2304 | setcp3cr( INS_RD( mipscpu.op ), mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 2305 | mips_advance_pc(); | |
| 2306 | break; | |
| 2307 | ||
| 2308 | case RS_BC: | |
| 2309 | case RS_BC_ALT: | |
| 2310 | switch( INS_BC( mipscpu.op ) ) | |
| 2311 | { | |
| 2312 | case BC_BCF: | |
| 2313 | mips_bc( 3, SR_CU3, 0 ); | |
| 2314 | break; | |
| 2315 | ||
| 2316 | case BC_BCT: | |
| 2317 | mips_bc( 3, SR_CU3, 1 ); | |
| 2318 | break; | |
| 2319 | } | |
| 2320 | break; | |
| 2321 | ||
| 2322 | default: | |
| 2323 | mips_advance_pc(); | |
| 2324 | break; | |
| 1580 | 2325 | } |
| 1581 | else | |
| 1582 | { | |
| 1583 | mips_delayed_load( INS_RT( mipscpu.op ), MIPS_BYTE_EXTEND( program_read_byte_32le( n_adr ^ 3 ) ) ); | |
| 1584 | } | |
| 1585 | 2326 | } |
| 1586 | else | |
| 2327 | break; | |
| 2328 | ||
| 2329 | case OP_LB: | |
| 1587 | 2330 | { |
| 1588 | UINT32 n_adr; | |
| 1589 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1590 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 2331 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2332 | int breakpoint = mips_load_data_address_breakpoint( address ); | |
| 2333 | ||
| 2334 | if( ( address & mipscpu.bad_byte_address_mask ) != 0 ) | |
| 1591 | 2335 | { |
| 1592 | mips_exception( EXC_ADEL ); | |
| 1593 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2336 | mips_load_bad_address( address ); | |
| 1594 | 2337 | } |
| 2338 | else if( breakpoint ) | |
| 2339 | { | |
| 2340 | mips_breakpoint_exception(); | |
| 2341 | } | |
| 1595 | 2342 | else |
| 1596 | 2343 | { |
| 1597 | mips_delayed_load( INS_RT( mipscpu.op ), MIPS_BYTE_EXTEND( program_read_byte_32le( n_adr ) ) ); | |
| 2344 | UINT32 data = MIPS_BYTE_EXTEND( mipscpu.readbyte( address ) ); | |
| 2345 | ||
| 2346 | if( mipscpu.berr ) | |
| 2347 | { | |
| 2348 | mips_load_bus_error_exception(); | |
| 2349 | } | |
| 2350 | else | |
| 2351 | { | |
| 2352 | mips_delayed_load( INS_RT( mipscpu.op ), data ); | |
| 2353 | } | |
| 1598 | 2354 | } |
| 1599 | 2355 | } |
| 1600 | 2356 | break; |
| 2357 | ||
| 1601 | 2358 | case OP_LH: |
| 1602 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 1603 | 2359 | { |
| 1604 | /* todo: */ | |
| 1605 | logerror( "%08x: LH SR_ISC not supported\n", mipscpu.pc ); | |
| 1606 | mips_stop(); | |
| 1607 | mips_advance_pc(); | |
| 1608 | } | |
| 1609 | else if( ( mipscpu.cp0r[ CP0_SR ] & ( SR_RE | SR_KUC ) ) == ( SR_RE | SR_KUC ) ) | |
| 1610 | { | |
| 1611 | UINT32 n_adr; | |
| 1612 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1613 | if( ( n_adr & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 1 ) ) != 0 ) | |
| 2360 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2361 | int breakpoint = mips_load_data_address_breakpoint( address ); | |
| 2362 | ||
| 2363 | if( ( address & mipscpu.bad_half_address_mask ) != 0 ) | |
| 1614 | 2364 | { |
| 1615 | mips_exception( EXC_ADEL ); | |
| 1616 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2365 | mips_load_bad_address( address ); | |
| 1617 | 2366 | } |
| 1618 | else | |
| 2367 | else if( breakpoint ) | |
| 1619 | 2368 | { |
| 1620 | mips_ | |
| 2369 | mips_bre | |
| 1621 | 2370 | } |
| 1622 | } | |
| 1623 | else | |
| 1624 | { | |
| 1625 | UINT32 n_adr; | |
| 1626 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1627 | if( ( n_adr & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 1 ) ) != 0 ) | |
| 1628 | { | |
| 1629 | mips_exception( EXC_ADEL ); | |
| 1630 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 1631 | } | |
| 1632 | 2371 | else |
| 1633 | 2372 | { |
| 1634 | mips_delayed_load( INS_RT( mipscpu.op ), MIPS_WORD_EXTEND( program_read_word_32le( n_adr ) ) ); | |
| 2373 | UINT32 data = MIPS_WORD_EXTEND( mipscpu.readhalf( address ) ); | |
| 2374 | ||
| 2375 | if( mipscpu.berr ) | |
| 2376 | { | |
| 2377 | mips_load_bus_error_exception(); | |
| 2378 | } | |
| 2379 | else | |
| 2380 | { | |
| 2381 | mips_delayed_load( INS_RT( mipscpu.op ), data ); | |
| 2382 | } | |
| 1635 | 2383 | } |
| 1636 | 2384 | } |
| 1637 | 2385 | break; |
| 2386 | ||
| 1638 | 2387 | case OP_LWL: |
| 1639 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 1640 | 2388 | { |
| 1641 | /* todo: */ | |
| 1642 | logerror( "%08x: LWL SR_ISC not supported\n", mipscpu.pc ); | |
| 1643 | mips_stop(); | |
| 1644 | mips_advance_pc(); | |
| 1645 | } | |
| 1646 | else if( ( mipscpu.cp0r[ CP0_SR ] & ( SR_RE | SR_KUC ) ) == ( SR_RE | SR_KUC ) ) | |
| 1647 | { | |
| 1648 | UINT32 n_adr; | |
| 1649 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1650 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 2389 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2390 | int load_type = address & 3; | |
| 2391 | int breakpoint; | |
| 2392 | ||
| 2393 | address &= ~3; | |
| 2394 | breakpoint = mips_load_data_address_breakpoint( address ); | |
| 2395 | ||
| 2396 | if( ( address & mipscpu.bad_byte_address_mask ) != 0 ) | |
| 1651 | 2397 | { |
| 1652 | mips_exception( EXC_ADEL ); | |
| 1653 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2398 | mips_load_bad_address( address ); | |
| 1654 | 2399 | } |
| 1655 | else | |
| 2400 | else if( breakpoint ) | |
| 1656 | 2401 | { |
| 1657 | switch( n_adr & 3 ) | |
| 1658 | { | |
| 1659 | case 0: | |
| 1660 | n_res = ( mipscpu.r[ INS_RT( mipscpu.op ) ] & 0x00ffffff ) | ( (UINT32)program_read_byte_32le( n_adr + 3 ) << 24 ); | |
| 1661 | break; | |
| 1662 | case 1: | |
| 1663 | n_res = ( mipscpu.r[ INS_RT( mipscpu.op ) ] & 0x0000ffff ) | ( (UINT32)program_read_word_32le( n_adr + 1 ) << 16 ); | |
| 1664 | break; | |
| 1665 | case 2: | |
| 1666 | n_res = ( mipscpu.r[ INS_RT( mipscpu.op ) ] & 0x000000ff ) | ( (UINT32)program_read_byte_32le( n_adr - 1 ) << 8 ) | ( (UINT32)program_read_word_32le( n_adr ) << 16 ); | |
| 1667 | break; | |
| 1668 | default: | |
| 1669 | n_res = program_read_dword_32le( n_adr - 3 ); | |
| 1670 | break; | |
| 1671 | } | |
| 1672 | mips_delayed_load( INS_RT( mipscpu.op ), n_res ); | |
| 2402 | mips_breakpoint_exception(); | |
| 1673 | 2403 | } |
| 1674 | } | |
| 1675 | else | |
| 1676 | { | |
| 1677 | UINT32 n_adr; | |
| 1678 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1679 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 1680 | { | |
| 1681 | mips_exception( EXC_ADEL ); | |
| 1682 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 1683 | } | |
| 1684 | 2404 | else |
| 1685 | 2405 | { |
| 1686 | switch( n_adr & 3 ) | |
| 2406 | UINT32 data = mips_get_register_from_pipeline( INS_RT( mipscpu.op ) ); | |
| 2407 | ||
| 2408 | switch( load_type ) | |
| 1687 | 2409 | { |
| 1688 | 2410 | case 0: |
| 1689 | | |
| 2411 | data | |
| 1690 | 2412 | break; |
| 2413 | ||
| 1691 | 2414 | case 1: |
| 1692 | | |
| 2415 | data | |
| 1693 | 2416 | break; |
| 2417 | ||
| 1694 | 2418 | case 2: |
| 1695 | | |
| 2419 | data | |
| 1696 | 2420 | break; |
| 1697 | default: | |
| 1698 | n_res = program_read_dword_32le( n_adr - 3 ); | |
| 2421 | ||
| 2422 | case 3: | |
| 2423 | data = mipscpu.readword( address ); | |
| 1699 | 2424 | break; |
| 1700 | 2425 | } |
| 1701 | mips_delayed_load( INS_RT( mipscpu.op ), n_res ); | |
| 2426 | ||
| 2427 | if( mipscpu.berr ) | |
| 2428 | { | |
| 2429 | mips_load_bus_error_exception(); | |
| 2430 | } | |
| 2431 | else | |
| 2432 | { | |
| 2433 | mips_delayed_load( INS_RT( mipscpu.op ), data ); | |
| 2434 | } | |
| 1702 | 2435 | } |
| 1703 | 2436 | } |
| 1704 | 2437 | break; |
| 2438 | ||
| 1705 | 2439 | case OP_LW: |
| 1706 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 1707 | 2440 | { |
| 1708 | /* todo: */ | |
| 1709 | logerror( "%08x: LW SR_ISC not supported\n", mipscpu.pc ); | |
| 1710 | mips_stop(); | |
| 1711 | mips_advance_pc(); | |
| 1712 | } | |
| 1713 | else | |
| 1714 | { | |
| 1715 | UINT32 n_adr; | |
| 1716 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1717 | if( ( n_adr & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 3 ) ) != 0 ) | |
| 2441 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2442 | int breakpoint = mips_load_data_address_breakpoint( address ); | |
| 2443 | ||
| 2444 | if( ( address & mipscpu.bad_word_address_mask ) != 0 ) | |
| 1718 | 2445 | { |
| 1719 | mips_exception( EXC_ADEL ); | |
| 1720 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2446 | mips_load_bad_address( address ); | |
| 1721 | 2447 | } |
| 2448 | else if( breakpoint ) | |
| 2449 | { | |
| 2450 | mips_breakpoint_exception(); | |
| 2451 | } | |
| 1722 | 2452 | else |
| 1723 | 2453 | { |
| 1724 | mips_delayed_load( INS_RT( mipscpu.op ), program_read_dword_32le( n_adr ) ); | |
| 2454 | UINT32 data = mipscpu.readword( address ); | |
| 2455 | ||
| 2456 | if( mipscpu.berr ) | |
| 2457 | { | |
| 2458 | mips_load_bus_error_exception(); | |
| 2459 | } | |
| 2460 | else | |
| 2461 | { | |
| 2462 | mips_delayed_load( INS_RT( mipscpu.op ), data ); | |
| 2463 | } | |
| 1725 | 2464 | } |
| 1726 | 2465 | } |
| 1727 | 2466 | break; |
| 2467 | ||
| 1728 | 2468 | case OP_LBU: |
| 1729 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 1730 | 2469 | { |
| 1731 | /* todo: */ | |
| 1732 | logerror( "%08x: LBU SR_ISC not supported\n", mipscpu.pc ); | |
| 1733 | mips_stop(); | |
| 1734 | mips_advance_pc(); | |
| 1735 | } | |
| 1736 | else if( ( mipscpu.cp0r[ CP0_SR ] & ( SR_RE | SR_KUC ) ) == ( SR_RE | SR_KUC ) ) | |
| 1737 | { | |
| 1738 | UINT32 n_adr; | |
| 1739 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1740 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 2470 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2471 | int breakpoint = mips_load_data_address_breakpoint( address ); | |
| 2472 | ||
| 2473 | if( ( address & mipscpu.bad_byte_address_mask ) != 0 ) | |
| 1741 | 2474 | { |
| 1742 | mips_exception( EXC_ADEL ); | |
| 1743 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2475 | mips_load_bad_address( address ); | |
| 1744 | 2476 | } |
| 1745 | else | |
| 2477 | else if( breakpoint ) | |
| 1746 | 2478 | { |
| 1747 | mips_ | |
| 2479 | mips_bre | |
| 1748 | 2480 | } |
| 1749 | } | |
| 1750 | else | |
| 1751 | { | |
| 1752 | UINT32 n_adr; | |
| 1753 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1754 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 1755 | { | |
| 1756 | mips_exception( EXC_ADEL ); | |
| 1757 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 1758 | } | |
| 1759 | 2481 | else |
| 1760 | 2482 | { |
| 1761 | mips_delayed_load( INS_RT( mipscpu.op ), program_read_byte_32le( n_adr ) ); | |
| 2483 | UINT32 data = mipscpu.readbyte( address ); | |
| 2484 | ||
| 2485 | if( mipscpu.berr ) | |
| 2486 | { | |
| 2487 | mips_load_bus_error_exception(); | |
| 2488 | } | |
| 2489 | else | |
| 2490 | { | |
| 2491 | mips_delayed_load( INS_RT( mipscpu.op ), data ); | |
| 2492 | } | |
| 1762 | 2493 | } |
| 1763 | 2494 | } |
| 1764 | 2495 | break; |
| 2496 | ||
| 1765 | 2497 | case OP_LHU: |
| 1766 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 1767 | 2498 | { |
| 1768 | /* todo: */ | |
| 1769 | logerror( "%08x: LHU SR_ISC not supported\n", mipscpu.pc ); | |
| 1770 | mips_stop(); | |
| 1771 | mips_advance_pc(); | |
| 1772 | } | |
| 1773 | else if( ( mipscpu.cp0r[ CP0_SR ] & ( SR_RE | SR_KUC ) ) == ( SR_RE | SR_KUC ) ) | |
| 1774 | { | |
| 1775 | UINT32 n_adr; | |
| 1776 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1777 | if( ( n_adr & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 1 ) ) != 0 ) | |
| 2499 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2500 | int breakpoint = mips_load_data_address_breakpoint( address ); | |
| 2501 | ||
| 2502 | if( ( address & mipscpu.bad_half_address_mask ) != 0 ) | |
| 1778 | 2503 | { |
| 1779 | mips_exception( EXC_ADEL ); | |
| 1780 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2504 | mips_load_bad_address( address ); | |
| 1781 | 2505 | } |
| 1782 | else | |
| 2506 | else if( breakpoint ) | |
| 1783 | 2507 | { |
| 1784 | mips_ | |
| 2508 | mips_bre | |
| 1785 | 2509 | } |
| 1786 | } | |
| 1787 | else | |
| 1788 | { | |
| 1789 | UINT32 n_adr; | |
| 1790 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1791 | if( ( n_adr & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 1 ) ) != 0 ) | |
| 1792 | { | |
| 1793 | mips_exception( EXC_ADEL ); | |
| 1794 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 1795 | } | |
| 1796 | 2510 | else |
| 1797 | 2511 | { |
| 1798 | mips_delayed_load( INS_RT( mipscpu.op ), program_read_word_32le( n_adr ) ); | |
| 2512 | UINT32 data = mipscpu.readhalf( address ); | |
| 2513 | ||
| 2514 | if( mipscpu.berr ) | |
| 2515 | { | |
| 2516 | mips_load_bus_error_exception(); | |
| 2517 | } | |
| 2518 | else | |
| 2519 | { | |
| 2520 | mips_delayed_load( INS_RT( mipscpu.op ), data ); | |
| 2521 | } | |
| 1799 | 2522 | } |
| 1800 | 2523 | } |
| 1801 | 2524 | break; |
| 2525 | ||
| 1802 | 2526 | case OP_LWR: |
| 1803 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 1804 | 2527 | { |
| 1805 | /* todo: */ | |
| 1806 | logerror( "%08x: LWR SR_ISC not supported\n", mipscpu.pc ); | |
| 1807 | mips_stop(); | |
| 1808 | mips_advance_pc(); | |
| 1809 | } | |
| 1810 | else if( ( mipscpu.cp0r[ CP0_SR ] & ( SR_RE | SR_KUC ) ) == ( SR_RE | SR_KUC ) ) | |
| 1811 | { | |
| 1812 | UINT32 n_adr; | |
| 1813 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1814 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 2528 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2529 | int breakpoint = mips_load_data_address_breakpoint( address ); | |
| 2530 | ||
| 2531 | if( ( address & mipscpu.bad_byte_address_mask ) != 0 ) | |
| 1815 | 2532 | { |
| 1816 | mips_exception( EXC_ADEL ); | |
| 1817 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2533 | mips_load_bad_address( address ); | |
| 1818 | 2534 | } |
| 2535 | else if( breakpoint ) | |
| 2536 | { | |
| 2537 | mips_breakpoint_exception(); | |
| 2538 | } | |
| 1819 | 2539 | else |
| 1820 | 2540 | { |
| 1821 | switch( n_adr & 3 ) | |
| 2541 | UINT32 data = mips_get_register_from_pipeline( INS_RT( mipscpu.op ) ); | |
| 2542 | ||
| 2543 | switch( address & 3 ) | |
| 1822 | 2544 | { |
| 1823 | case 3: | |
| 1824 | n_res = ( mipscpu.r[ INS_RT( mipscpu.op ) ] & 0xffffff00 ) | program_read_byte_32le( n_adr - 3 ); | |
| 2545 | case 0: | |
| 2546 | data = mipscpu.readword( address ); | |
| 1825 | 2547 | break; |
| 1826 | case 2: | |
| 1827 | n_res = ( mipscpu.r[ INS_RT( mipscpu.op ) ] & 0xffff0000 ) | program_read_word_32le( n_adr - 2 ); | |
| 1828 | break; | |
| 2548 | ||
| 1829 | 2549 | case 1: |
| 1830 | | |
| 2550 | data | |
| 1831 | 2551 | break; |
| 1832 | default: | |
| 1833 | n_res = program_read_dword_32le( n_adr ); | |
| 2552 | ||
| 2553 | case 2: | |
| 2554 | data = ( data & 0xffff0000 ) | ( mipscpu.readword_masked( address, 0x0000ffff ) >> 16 ); | |
| 1834 | 2555 | break; |
| 1835 | } | |
| 1836 | mips_delayed_load( INS_RT( mipscpu.op ), n_res ); | |
| 1837 | } | |
| 1838 | } | |
| 1839 | else | |
| 1840 | { | |
| 1841 | UINT32 n_adr; | |
| 1842 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1843 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 1844 | { | |
| 1845 | mips_exception( EXC_ADEL ); | |
| 1846 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 1847 | } | |
| 1848 | else | |
| 1849 | { | |
| 1850 | switch( n_adr & 3 ) | |
| 1851 | { | |
| 2556 | ||
| 1852 | 2557 | case 3: |
| 1853 | | |
| 2558 | data | |
| 1854 | 2559 | break; |
| 1855 | case 2: | |
| 1856 | n_res = ( mipscpu.r[ INS_RT( mipscpu.op ) ] & 0xffff0000 ) | program_read_word_32le( n_adr ); | |
| 1857 | break; | |
| 1858 | case 1: | |
| 1859 | n_res = ( mipscpu.r[ INS_RT( mipscpu.op ) ] & 0xff000000 ) | program_read_byte_32le( n_adr ) | ( (UINT32)program_read_word_32le( n_adr + 1 ) << 8 ); | |
| 1860 | break; | |
| 1861 | default: | |
| 1862 | n_res = program_read_dword_32le( n_adr ); | |
| 1863 | break; | |
| 1864 | 2560 | } |
| 1865 | mips_delayed_load( INS_RT( mipscpu.op ), n_res ); | |
| 2561 | ||
| 2562 | if( mipscpu.berr ) | |
| 2563 | { | |
| 2564 | mips_load_bus_error_exception(); | |
| 2565 | } | |
| 2566 | else | |
| 2567 | { | |
| 2568 | mips_delayed_load( INS_RT( mipscpu.op ), data ); | |
| 2569 | } | |
| 1866 | 2570 | } |
| 1867 | 2571 | } |
| 1868 | 2572 | break; |
| 2573 | ||
| 1869 | 2574 | case OP_SB: |
| 1870 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 1871 | 2575 | { |
| 1872 | /* todo: */ | |
| 1873 | logerror( "%08x: SB SR_ISC not supported\n", mipscpu.pc ); | |
| 1874 | mips_stop(); | |
| 1875 | mips_advance_pc(); | |
| 1876 | } | |
| 1877 | else if( ( mipscpu.cp0r[ CP0_SR ] & ( SR_RE | SR_KUC ) ) == ( SR_RE | SR_KUC ) ) | |
| 1878 | { | |
| 1879 | UINT32 n_adr; | |
| 1880 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1881 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 2576 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2577 | int breakpoint = mips_store_data_address_breakpoint( address ); | |
| 2578 | ||
| 2579 | if( ( address & mipscpu.bad_byte_address_mask ) != 0 ) | |
| 1882 | 2580 | { |
| 1883 | mips_exception( EXC_ADES ); | |
| 1884 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2581 | mips_store_bad_address( address ); | |
| 1885 | 2582 | } |
| 1886 | 2583 | else |
| 1887 | 2584 | { |
| 1888 | program_write_byte_32le( n_adr ^ 3, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1889 | mips_advance_pc(); | |
| 2585 | int shift = 8 * ( address & 3 ); | |
| 2586 | mipscpu.writeword_masked( address, mipscpu.r[ INS_RT( mipscpu.op ) ] << shift, ~( 0xff << shift ) ); | |
| 2587 | ||
| 2588 | if( breakpoint ) | |
| 2589 | { | |
| 2590 | mips_breakpoint_exception(); | |
| 2591 | } | |
| 2592 | else if( mipscpu.berr ) | |
| 2593 | { | |
| 2594 | mips_store_bus_error_exception(); | |
| 2595 | } | |
| 2596 | else | |
| 2597 | { | |
| 2598 | mips_advance_pc(); | |
| 2599 | } | |
| 1890 | 2600 | } |
| 1891 | 2601 | } |
| 1892 | else | |
| 1893 | { | |
| 1894 | UINT32 n_adr; | |
| 1895 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1896 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 1897 | { | |
| 1898 | mips_exception( EXC_ADES ); | |
| 1899 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 1900 | } | |
| 1901 | else | |
| 1902 | { | |
| 1903 | program_write_byte_32le( n_adr, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1904 | mips_advance_pc(); | |
| 1905 | } | |
| 1906 | } | |
| 1907 | 2602 | break; |
| 2603 | ||
| 1908 | 2604 | case OP_SH: |
| 1909 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 1910 | 2605 | { |
| 1911 | /* todo: */ | |
| 1912 | logerror( "%08x: SH SR_ISC not supported\n", mipscpu.pc ); | |
| 1913 | mips_stop(); | |
| 1914 | mips_advance_pc(); | |
| 1915 | } | |
| 1916 | else if( ( mipscpu.cp0r[ CP0_SR ] & ( SR_RE | SR_KUC ) ) == ( SR_RE | SR_KUC ) ) | |
| 1917 | { | |
| 1918 | UINT32 n_adr; | |
| 1919 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1920 | if( ( n_adr & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 1 ) ) != 0 ) | |
| 2606 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2607 | int breakpoint = mips_store_data_address_breakpoint( address ); | |
| 2608 | ||
| 2609 | if( ( address & mipscpu.bad_half_address_mask ) != 0 ) | |
| 1921 | 2610 | { |
| 1922 | mips_exception( EXC_ADES ); | |
| 1923 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2611 | mips_store_bad_address( address ); | |
| 1924 | 2612 | } |
| 1925 | 2613 | else |
| 1926 | 2614 | { |
| 1927 | program_write_word_32le( n_adr ^ 2, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1928 | mips_advance_pc(); | |
| 2615 | int shift = 8 * ( address & 2 ); | |
| 2616 | mipscpu.writeword_masked( address, mipscpu.r[ INS_RT( mipscpu.op ) ] << shift, ~( 0xffff << shift ) ); | |
| 2617 | ||
| 2618 | if( breakpoint ) | |
| 2619 | { | |
| 2620 | mips_breakpoint_exception(); | |
| 2621 | } | |
| 2622 | else if( mipscpu.berr ) | |
| 2623 | { | |
| 2624 | mips_store_bus_error_exception(); | |
| 2625 | } | |
| 2626 | else | |
| 2627 | { | |
| 2628 | mips_advance_pc(); | |
| 2629 | } | |
| 1929 | 2630 | } |
| 1930 | 2631 | } |
| 1931 | else | |
| 1932 | { | |
| 1933 | UINT32 n_adr; | |
| 1934 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1935 | if( ( n_adr & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 1 ) ) != 0 ) | |
| 1936 | { | |
| 1937 | mips_exception( EXC_ADES ); | |
| 1938 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 1939 | } | |
| 1940 | else | |
| 1941 | { | |
| 1942 | program_write_word_32le( n_adr, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 1943 | mips_advance_pc(); | |
| 1944 | } | |
| 1945 | } | |
| 1946 | 2632 | break; |
| 2633 | ||
| 1947 | 2634 | case OP_SWL: |
| 1948 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 1949 | 2635 | { |
| 1950 | /* todo: */ | |
| 1951 | logerror( "%08x: SWL SR_ISC not supported\n", mipscpu.pc ); | |
| 1952 | mips_stop(); | |
| 1953 | mips_advance_pc(); | |
| 1954 | } | |
| 1955 | else if( ( mipscpu.cp0r[ CP0_SR ] & ( SR_RE | SR_KUC ) ) == ( SR_RE | SR_KUC ) ) | |
| 1956 | { | |
| 1957 | UINT32 n_adr; | |
| 1958 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1959 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 2636 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2637 | int save_type = address & 3; | |
| 2638 | int breakpoint; | |
| 2639 | ||
| 2640 | address &= ~3; | |
| 2641 | breakpoint = mips_store_data_address_breakpoint( address ); | |
| 2642 | ||
| 2643 | if( ( address & mipscpu.bad_byte_address_mask ) != 0 ) | |
| 1960 | 2644 | { |
| 1961 | mips_exception( EXC_ADES ); | |
| 1962 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2645 | mips_store_bad_address( address ); | |
| 1963 | 2646 | } |
| 1964 | 2647 | else |
| 1965 | 2648 | { |
| 1966 | switch( | |
| 2649 | switch( s | |
| 1967 | 2650 | { |
| 1968 | 2651 | case 0: |
| 1969 | | |
| 2652 | | |
| 1970 | 2653 | break; |
| 2654 | ||
| 1971 | 2655 | case 1: |
| 1972 | | |
| 2656 | | |
| 1973 | 2657 | break; |
| 2658 | ||
| 1974 | 2659 | case 2: |
| 1975 | program_write_byte_32le( n_adr - 1, mipscpu.r[ INS_RT( mipscpu.op ) ] >> 8 ); | |
| 1976 | program_write_word_32le( n_adr, mipscpu.r[ INS_RT( mipscpu.op ) ] >> 16 ); | |
| 2660 | mipscpu.writeword_masked( address, mipscpu.r[ INS_RT( mipscpu.op ) ] >> 8, 0xff000000 ); | |
| 1977 | 2661 | break; |
| 2662 | ||
| 1978 | 2663 | case 3: |
| 1979 | | |
| 2664 | | |
| 1980 | 2665 | break; |
| 1981 | 2666 | } |
| 1982 | mips_advance_pc(); | |
| 1983 | } | |
| 1984 | } | |
| 1985 | else | |
| 1986 | { | |
| 1987 | UINT32 n_adr; | |
| 1988 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 1989 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 1990 | { | |
| 1991 | mips_exception( EXC_ADES ); | |
| 1992 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 1993 | } | |
| 1994 | else | |
| 1995 | { | |
| 1996 | switch( n_adr & 3 ) | |
| 2667 | ||
| 2668 | if( breakpoint ) | |
| 1997 | 2669 | { |
| 1998 | case 0: | |
| 1999 | program_write_byte_32le( n_adr, mipscpu.r[ INS_RT( mipscpu.op ) ] >> 24 ); | |
| 2000 | break; | |
| 2001 | case 1: | |
| 2002 | program_write_word_32le( n_adr - 1, mipscpu.r[ INS_RT( mipscpu.op ) ] >> 16 ); | |
| 2003 | break; | |
| 2004 | case 2: | |
| 2005 | program_write_word_32le( n_adr - 2, mipscpu.r[ INS_RT( mipscpu.op ) ] >> 8 ); | |
| 2006 | program_write_byte_32le( n_adr, mipscpu.r[ INS_RT( mipscpu.op ) ] >> 24 ); | |
| 2007 | break; | |
| 2008 | case 3: | |
| 2009 | program_write_dword_32le( n_adr - 3, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 2010 | break; | |
| 2670 | mips_breakpoint_exception(); | |
| 2011 | 2671 | } |
| 2012 | mips_advance_pc(); | |
| 2672 | else if( mipscpu.berr ) | |
| 2673 | { | |
| 2674 | mips_store_bus_error_exception(); | |
| 2675 | } | |
| 2676 | else | |
| 2677 | { | |
| 2678 | mips_advance_pc(); | |
| 2679 | } | |
| 2013 | 2680 | } |
| 2014 | 2681 | } |
| 2015 | 2682 | break; |
| 2683 | ||
| 2016 | 2684 | case OP_SW: |
| 2017 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 2018 | 2685 | { |
| 2019 | /* todo: */ | |
| 2020 | /* used by bootstrap | |
| 2021 | logerror( "%08x: SW SR_ISC not supported\n", mipscpu.pc ); | |
| 2022 | mips_stop(); | |
| 2023 | */ | |
| 2024 | mips_advance_pc(); | |
| 2025 | } | |
| 2026 | else | |
| 2027 | { | |
| 2028 | UINT32 n_adr; | |
| 2029 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2030 | if( ( n_adr & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 3 ) ) != 0 ) | |
| 2686 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2687 | int breakpoint = mips_store_data_address_breakpoint( address ); | |
| 2688 | ||
| 2689 | if( ( address & mipscpu.bad_word_address_mask ) != 0 ) | |
| 2031 | 2690 | { |
| 2032 | mips_exception( EXC_ADES ); | |
| 2033 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2691 | mips_store_bad_address( address ); | |
| 2034 | 2692 | } |
| 2035 | 2693 | else |
| 2036 | 2694 | { |
| 2037 | program_write_dword_32le( n_adr, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 2038 | mips_advance_pc(); | |
| 2695 | mipscpu.writeword( address, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 2696 | ||
| 2697 | if( breakpoint ) | |
| 2698 | { | |
| 2699 | mips_breakpoint_exception(); | |
| 2700 | } | |
| 2701 | else if( mipscpu.berr ) | |
| 2702 | { | |
| 2703 | mips_store_bus_error_exception(); | |
| 2704 | } | |
| 2705 | else | |
| 2706 | { | |
| 2707 | mips_advance_pc(); | |
| 2708 | } | |
| 2039 | 2709 | } |
| 2040 | 2710 | } |
| 2041 | 2711 | break; |
| 2712 | ||
| 2042 | 2713 | case OP_SWR: |
| 2043 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 2044 | 2714 | { |
| 2045 | /* todo: */ | |
| 2046 | logerror( "%08x: SWR SR_ISC not supported\n", mipscpu.pc ); | |
| 2047 | mips_stop(); | |
| 2048 | mips_advance_pc(); | |
| 2049 | } | |
| 2050 | else if( ( mipscpu.cp0r[ CP0_SR ] & ( SR_RE | SR_KUC ) ) == ( SR_RE | SR_KUC ) ) | |
| 2051 | { | |
| 2052 | UINT32 n_adr; | |
| 2053 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2054 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 2715 | UINT32 address = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2716 | int breakpoint = mips_store_data_address_breakpoint( address ); | |
| 2717 | ||
| 2718 | if( ( address & mipscpu.bad_byte_address_mask ) != 0 ) | |
| 2055 | 2719 | { |
| 2056 | mips_exception( EXC_ADES ); | |
| 2057 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2720 | mips_store_bad_address( address ); | |
| 2058 | 2721 | } |
| 2059 | 2722 | else |
| 2060 | 2723 | { |
| 2061 | switch( | |
| 2724 | switch( | |
| 2062 | 2725 | { |
| 2063 | 2726 | case 0: |
| 2064 | | |
| 2727 | | |
| 2065 | 2728 | break; |
| 2729 | ||
| 2066 | 2730 | case 1: |
| 2067 | program_write_word_32le( n_adr - 1, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 2068 | program_write_byte_32le( n_adr + 1, mipscpu.r[ INS_RT( mipscpu.op ) ] >> 16 ); | |
| 2731 | mipscpu.writeword_masked( address, mipscpu.r[ INS_RT( mipscpu.op ) ] << 8, 0x000000ff ); | |
| 2069 | 2732 | break; |
| 2733 | ||
| 2070 | 2734 | case 2: |
| 2071 | | |
| 2735 | | |
| 2072 | 2736 | break; |
| 2737 | ||
| 2073 | 2738 | case 3: |
| 2074 | | |
| 2739 | | |
| 2075 | 2740 | break; |
| 2076 | 2741 | } |
| 2077 | mips_advance_pc(); | |
| 2078 | } | |
| 2079 | } | |
| 2080 | else | |
| 2081 | { | |
| 2082 | UINT32 n_adr; | |
| 2083 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2084 | if( ( n_adr & ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) ) != 0 ) | |
| 2085 | { | |
| 2086 | mips_exception( EXC_ADES ); | |
| 2087 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2088 | } | |
| 2089 | else | |
| 2090 | { | |
| 2091 | switch( n_adr & 3 ) | |
| 2742 | ||
| 2743 | if( breakpoint ) | |
| 2092 | 2744 | { |
| 2093 | case 0: | |
| 2094 | program_write_dword_32le( n_adr, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 2095 | break; | |
| 2096 | case 1: | |
| 2097 | program_write_byte_32le( n_adr, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 2098 | program_write_word_32le( n_adr + 1, mipscpu.r[ INS_RT( mipscpu.op ) ] >> 8 ); | |
| 2099 | break; | |
| 2100 | case 2: | |
| 2101 | program_write_word_32le( n_adr, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 2102 | break; | |
| 2103 | case 3: | |
| 2104 | program_write_byte_32le( n_adr, mipscpu.r[ INS_RT( mipscpu.op ) ] ); | |
| 2105 | break; | |
| 2745 | mips_breakpoint_exception(); | |
| 2106 | 2746 | } |
| 2107 | mips_advance_pc(); | |
| 2747 | else if( mipscpu.berr ) | |
| 2748 | { | |
| 2749 | mips_store_bus_error_exception(); | |
| 2750 | } | |
| 2751 | else | |
| 2752 | { | |
| 2753 | mips_advance_pc(); | |
| 2754 | } | |
| 2108 | 2755 | } |
| 2109 | 2756 | } |
| 2110 | 2757 | break; |
| 2758 | ||
| 2759 | case OP_LWC0: | |
| 2760 | mips_lwc( 0, SR_CU0 ); | |
| 2761 | break; | |
| 2762 | ||
| 2111 | 2763 | case OP_LWC1: |
| 2112 | /* todo: */ | |
| 2113 | logerror( "%08x: COP1 LWC not supported\n", mipscpu.pc ); | |
| 2114 | mips_stop(); | |
| 2115 | mips_advance_pc(); | |
| 2764 | mips_lwc( 1, SR_CU1 ); | |
| 2116 | 2765 | break; |
| 2766 | ||
| 2117 | 2767 | case OP_LWC2: |
| 2118 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_CU2 ) == 0 ) | |
| 2119 | { | |
| 2120 | mips_exception( EXC_CPU ); | |
| 2121 | mips_set_cp0r( CP0_CAUSE, ( mipscpu.cp0r[ CP0_CAUSE ] & ~CAUSE_CE ) | CAUSE_CE2 ); | |
| 2122 | } | |
| 2123 | else if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 2124 | { | |
| 2125 | /* todo: */ | |
| 2126 | logerror( "%08x: LWC2 SR_ISC not supported\n", mipscpu.pc ); | |
| 2127 | mips_stop(); | |
| 2128 | mips_advance_pc(); | |
| 2129 | } | |
| 2130 | else | |
| 2131 | { | |
| 2132 | UINT32 n_adr; | |
| 2133 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2134 | if( ( n_adr & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 3 ) ) != 0 ) | |
| 2135 | { | |
| 2136 | mips_exception( EXC_ADEL ); | |
| 2137 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2138 | } | |
| 2139 | else | |
| 2140 | { | |
| 2141 | /* todo: delay? */ | |
| 2142 | setcp2dr( INS_RT( mipscpu.op ), program_read_dword_32le( n_adr ) ); | |
| 2143 | mips_advance_pc(); | |
| 2144 | } | |
| 2145 | } | |
| 2768 | mips_lwc( 2, SR_CU2 ); | |
| 2146 | 2769 | break; |
| 2770 | ||
| 2771 | case OP_LWC3: | |
| 2772 | mips_lwc( 3, SR_CU3 ); | |
| 2773 | break; | |
| 2774 | ||
| 2775 | case OP_SWC0: | |
| 2776 | mips_swc( 0, SR_CU0 ); | |
| 2777 | break; | |
| 2778 | ||
| 2147 | 2779 | case OP_SWC1: |
| 2148 | /* todo: */ | |
| 2149 | logerror( "%08x: COP1 SWC not supported\n", mipscpu.pc ); | |
| 2150 | mips_stop(); | |
| 2151 | mips_advance_pc(); | |
| 2780 | mips_swc( 1, SR_CU1 ); | |
| 2152 | 2781 | break; |
| 2782 | ||
| 2153 | 2783 | case OP_SWC2: |
| 2154 | if( ( mipscpu.cp0r[ CP0_SR ] & SR_CU2 ) == 0 ) | |
| 2155 | { | |
| 2156 | mips_exception( EXC_CPU ); | |
| 2157 | mips_set_cp0r( CP0_CAUSE, ( mipscpu.cp0r[ CP0_CAUSE ] & ~CAUSE_CE ) | CAUSE_CE2 ); | |
| 2158 | } | |
| 2159 | else if( ( mipscpu.cp0r[ CP0_SR ] & SR_ISC ) != 0 ) | |
| 2160 | { | |
| 2161 | /* todo: */ | |
| 2162 | logerror( "%08x: SWC2 SR_ISC not supported\n", mipscpu.pc ); | |
| 2163 | mips_stop(); | |
| 2164 | mips_advance_pc(); | |
| 2165 | } | |
| 2166 | else | |
| 2167 | { | |
| 2168 | UINT32 n_adr; | |
| 2169 | n_adr = mipscpu.r[ INS_RS( mipscpu.op ) ] + MIPS_WORD_EXTEND( INS_IMMEDIATE( mipscpu.op ) ); | |
| 2170 | if( ( n_adr & ( ( ( mipscpu.cp0r[ CP0_SR ] & SR_KUC ) << 30 ) | 3 ) ) != 0 ) | |
| 2171 | { | |
| 2172 | mips_exception( EXC_ADES ); | |
| 2173 | mips_set_cp0r( CP0_BADVADDR, n_adr ); | |
| 2174 | } | |
| 2175 | else | |
| 2176 | { | |
| 2177 | program_write_dword_32le( n_adr, getcp2dr( INS_RT( mipscpu.op ) ) ); | |
| 2178 | mips_advance_pc(); | |
| 2179 | } | |
| 2180 | } | |
| 2784 | mips_swc( 2, SR_CU2 ); | |
| 2181 | 2785 | break; |
| 2786 | ||
| 2787 | case OP_SWC3: | |
| 2788 | mips_swc( 3, SR_CU3 ); | |
| 2789 | break; | |
| 2790 | ||
| 2182 | 2791 | default: |
| 2183 | 2792 | logerror( "%08x: unknown opcode %08x\n", mipscpu.pc, mipscpu.op ); |
| 2184 | 2793 | mips_stop(); |
| r2375 | r2376 | |
| 2217 | 2826 | case MIPS_IRQ0: |
| 2218 | 2827 | ip = CAUSE_IP2; |
| 2219 | 2828 | break; |
| 2829 | ||
| 2220 | 2830 | case MIPS_IRQ1: |
| 2221 | 2831 | ip = CAUSE_IP3; |
| 2222 | 2832 | break; |
| 2833 | ||
| 2223 | 2834 | case MIPS_IRQ2: |
| 2224 | 2835 | ip = CAUSE_IP4; |
| 2225 | 2836 | break; |
| 2837 | ||
| 2226 | 2838 | case MIPS_IRQ3: |
| 2227 | 2839 | ip = CAUSE_IP5; |
| 2228 | 2840 | break; |
| 2841 | ||
| 2229 | 2842 | case MIPS_IRQ4: |
| 2230 | 2843 | ip = CAUSE_IP6; |
| 2231 | 2844 | break; |
| 2845 | ||
| 2232 | 2846 | case MIPS_IRQ5: |
| 2233 | 2847 | ip = CAUSE_IP7; |
| 2234 | 2848 | break; |
| 2849 | ||
| 2235 | 2850 | default: |
| 2236 | 2851 | return; |
| 2237 | 2852 | } |
| r2375 | r2376 | |
| 2241 | 2856 | case CLEAR_LINE: |
| 2242 | 2857 | mips_set_cp0r( CP0_CAUSE, mipscpu.cp0r[ CP0_CAUSE ] & ~ip ); |
| 2243 | 2858 | break; |
| 2859 | ||
| 2244 | 2860 | case ASSERT_LINE: |
| 2245 | 2861 | mips_set_cp0r( CP0_CAUSE, mipscpu.cp0r[ CP0_CAUSE ] |= ip ); |
| 2862 | ||
| 2246 | 2863 | if( mipscpu.irq_callback ) |
| 2247 | 2864 | { |
| 2248 | 2865 | /* HOLD_LINE interrupts are not supported by the architecture. |
| r2375 | r2376 | |
| 2257 | 2874 | } |
| 2258 | 2875 | } |
| 2259 | 2876 | |
| 2877 | static READ32_HANDLER( psx_biu_r ) | |
| 2878 | { | |
| 2879 | return mipscpu.biu; | |
| 2880 | } | |
| 2881 | ||
| 2882 | static WRITE32_HANDLER( psx_biu_w ) | |
| 2883 | { | |
| 2884 | UINT32 old = mipscpu.biu; | |
| 2885 | ||
| 2886 | COMBINE_DATA( &mipscpu.biu ); | |
| 2887 | ||
| 2888 | if( ( old & ( BIU_RAM | BIU_DS ) ) != ( mipscpu.biu & ( BIU_RAM | BIU_DS ) ) ) | |
| 2889 | { | |
| 2890 | mips_update_scratchpad(); | |
| 2891 | } | |
| 2892 | } | |
| 2893 | ||
| 2894 | // On-board RAM and peripherals | |
| 2895 | static ADDRESS_MAP_START( psxcpu_internal_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 2896 | AM_RANGE(0x00800000, 0x1effffff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2897 | AM_RANGE(0x1f800400, 0x1f800fff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2898 | AM_RANGE(0x20000000, 0x7fffffff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2899 | AM_RANGE(0x80800000, 0x9effffff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2900 | AM_RANGE(0xa0800000, 0xbeffffff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2901 | AM_RANGE(0xc0000000, 0xfffdffff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2902 | AM_RANGE(0xfffe0130, 0xfffe0133) AM_READWRITE(psx_biu_r, psx_biu_w) | |
| 2903 | ADDRESS_MAP_END | |
| 2904 | ||
| 2905 | static ADDRESS_MAP_START( cxd8661r_internal_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 2906 | AM_RANGE(0x01000000, 0x1effffff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2907 | AM_RANGE(0x1f800400, 0x1f800fff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2908 | AM_RANGE(0x20000000, 0x7fffffff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2909 | AM_RANGE(0x81000000, 0x9effffff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2910 | AM_RANGE(0xa1000000, 0xbeffffff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2911 | AM_RANGE(0xc0000000, 0xfffdffff) AM_READWRITE(psx_berr_r, psx_berr_w) | |
| 2912 | AM_RANGE(0xfffe0130, 0xfffe0133) AM_READWRITE(psx_biu_r, psx_biu_w) | |
| 2913 | ADDRESS_MAP_END | |
| 2914 | ||
| 2260 | 2915 | /**************************************************************************** |
| 2261 | 2916 | * Return a formatted string for a register |
| 2262 | 2917 | ****************************************************************************/ |
| r2375 | r2376 | |
| 2268 | 2923 | } |
| 2269 | 2924 | #endif /* ENABLE_DEBUGGER */ |
| 2270 | 2925 | |
| 2926 | ||
| 2927 | static UINT32 getcp1dr( int reg ) | |
| 2928 | { | |
| 2929 | /* if a mtc/ctc precedes then this will get the value moved (which cop1 register is irrelevant). */ | |
| 2930 | /* if a mfc/cfc follows then it will get the same value as this one. */ | |
| 2931 | return program_read_dword_32le( mipscpu.pc + 4 ); | |
| 2932 | } | |
| 2933 | ||
| 2934 | static void setcp1dr( int reg, UINT32 value ) | |
| 2935 | { | |
| 2936 | } | |
| 2937 | ||
| 2938 | static UINT32 getcp1cr( int reg ) | |
| 2939 | { | |
| 2940 | /* if a mtc/ctc precedes then this will get the value moved (which cop1 register is irrelevant). */ | |
| 2941 | /* if a mfc/cfc follows then it will get the same value as this one. */ | |
| 2942 | return program_read_dword_32le( mipscpu.pc + 4 ); | |
| 2943 | } | |
| 2944 | ||
| 2945 | static void setcp1cr( int reg, UINT32 value ) | |
| 2946 | { | |
| 2947 | } | |
| 2948 | ||
| 2949 | ||
| 2950 | static UINT32 getcp3dr( int reg ) | |
| 2951 | { | |
| 2952 | /* if you have mtc/ctc with an mfc/cfc directly afterwards then you get the value that was moved. */ | |
| 2953 | /* if you have an lwc with an mfc/cfc somewhere after it then you get the value that is loaded */ | |
| 2954 | /* otherwise you get the next opcode. which register you transfer to or from is irrelevant. */ | |
| 2955 | return program_read_dword_32le( mipscpu.pc + 4 ); | |
| 2956 | } | |
| 2957 | ||
| 2958 | static void setcp3dr( int reg, UINT32 value ) | |
| 2959 | { | |
| 2960 | } | |
| 2961 | ||
| 2962 | static UINT32 getcp3cr( int reg ) | |
| 2963 | { | |
| 2964 | /* if you have mtc/ctc with an mfc/cfc directly afterwards then you get the value that was moved. */ | |
| 2965 | /* if you have an lwc with an mfc/cfc somewhere after it then you get the value that is loaded */ | |
| 2966 | /* otherwise you get the next opcode. which register you transfer to or from is irrelevant. */ | |
| 2967 | return program_read_dword_32le( mipscpu.pc + 4 ); | |
| 2968 | } | |
| 2969 | ||
| 2970 | static void setcp3cr( int reg, UINT32 value ) | |
| 2971 | { | |
| 2972 | } | |
| 2973 | ||
| 2974 | ||
| 2271 | 2975 | /* preliminary gte code */ |
| 2272 | 2976 | |
| 2273 | 2977 | #define VXY0 ( mipscpu.cp2dr[ 0 ].d ) |
| r2375 | r2376 | |
| 2381 | 3085 | #define ZSF4 ( mipscpu.cp2cr[ 30 ].w.l ) |
| 2382 | 3086 | #define FLAG ( mipscpu.cp2cr[ 31 ].d ) |
| 2383 | 3087 | |
| 2384 | ||
| 3088 | INLINE | |
| 2385 | 3089 | { |
| 2386 | if( | |
| 3090 | if( value | |
| 2387 | 3091 | { |
| 2388 | mipscpu.cp2dr[ n_reg ].d = (INT32)(INT16)mipscpu.cp2dr[ n_reg ].d; | |
| 3092 | FLAG |= flag; | |
| 3093 | return max; | |
| 2389 | 3094 | } |
| 2390 | else if( | |
| 3095 | else if( value | |
| 2391 | 3096 | { |
| 2392 | mipscpu.cp2dr[ n_reg ].d = (UINT32)(UINT16)mipscpu.cp2dr[ n_reg ].d; | |
| 3097 | FLAG |= flag; | |
| 3098 | return min; | |
| 2393 | 3099 | } |
| 2394 | else if( n_reg == 29 ) | |
| 3100 | return value; | |
| 3101 | } | |
| 3102 | ||
| 3103 | static UINT32 getcp2dr( int reg ) | |
| 3104 | { | |
| 3105 | switch( reg ) | |
| 2395 | 3106 | { |
| 2396 | ORGB = ( ( IR1 >> 7 ) & 0x1f ) | ( ( IR2 >> 2 ) & 0x3e0 ) | ( ( IR3 << 3 ) & 0x7c00 ); | |
| 3107 | case 1: | |
| 3108 | case 3: | |
| 3109 | case 5: | |
| 3110 | case 8: | |
| 3111 | case 9: | |
| 3112 | case 10: | |
| 3113 | case 11: | |
| 3114 | mipscpu.cp2dr[ reg ].d = (INT32)(INT16)mipscpu.cp2dr[ reg ].d; | |
| 3115 | break; | |
| 3116 | ||
| 3117 | case 7: | |
| 3118 | case 16: | |
| 3119 | case 17: | |
| 3120 | case 18: | |
| 3121 | case 19: | |
| 3122 | mipscpu.cp2dr[ reg ].d = (UINT32)(UINT16)mipscpu.cp2dr[ reg ].d; | |
| 3123 | break; | |
| 3124 | ||
| 3125 | case 15: | |
| 3126 | mipscpu.cp2dr[ reg ].d = SXY2; | |
| 3127 | break; | |
| 3128 | ||
| 3129 | case 28: | |
| 3130 | case 29: | |
| 3131 | mipscpu.cp2dr[ reg ].d = LIM( (INT16)IR1 >> 7, 0x1f, 0, 0 ) | ( LIM( (INT16)IR2 >> 7, 0x1f, 0, 0 ) << 5 ) | ( LIM( (INT16)IR3 >> 7, 0x1f, 0, 0 ) << 10 ); | |
| 3132 | break; | |
| 2397 | 3133 | } |
| 2398 | GTELOG( "get CP2DR%u=%08x", n_reg, mipscpu.cp2dr[ n_reg ].d ); | |
| 2399 | return mipscpu.cp2dr[ n_reg ].d; | |
| 3134 | ||
| 3135 | GTELOG( "get CP2DR%u=%08x", reg, mipscpu.cp2dr[ reg ].d ); | |
| 3136 | return mipscpu.cp2dr[ reg ].d; | |
| 2400 | 3137 | } |
| 2401 | 3138 | |
| 2402 | static void setcp2dr( int | |
| 3139 | static void setcp2dr( int | |
| 2403 | 3140 | { |
| 2404 | GTELOG( "set CP2DR%u=%08x", n_reg, n_value ); | |
| 2405 | mipscpu.cp2dr[ n_reg ].d = n_value; | |
| 3141 | GTELOG( "set CP2DR%u=%08x", reg, value ); | |
| 2406 | 3142 | |
| 2407 | i | |
| 3143 | switch( | |
| 2408 | 3144 | { |
| 3145 | case 15: | |
| 2409 | 3146 | SXY0 = SXY1; |
| 2410 | 3147 | SXY1 = SXY2; |
| 2411 | SXY2 = SXYP; | |
| 2412 | } | |
| 2413 | else if( n_reg == 28 ) | |
| 3148 | SXY2 = value; | |
| 3149 | break; | |
| 3150 | ||
| 3151 | case 28: | |
| 3152 | IR1 = ( value & 0x1f ) << 7; | |
| 3153 | IR2 = ( value & 0x3e0 ) << 2; | |
| 3154 | IR3 = ( value & 0x7c00 ) >> 3; | |
| 3155 | break; | |
| 3156 | ||
| 3157 | case 30: | |
| 2414 | 3158 | { |
| 2415 | IR1 = ( IRGB & 0x1f ) << 4; | |
| 2416 | IR2 = ( IRGB & 0x3e0 ) >> 1; | |
| 2417 | IR3 = ( IRGB & 0x7c00 ) >> 6; | |
| 2418 | } | |
| 2419 | else if( n_reg == 30 ) | |
| 2420 | { | |
| 2421 | UINT32 n_lzcs = LZCS; | |
| 2422 | UINT32 n_lzcr = 0; | |
| 3159 | UINT32 lzcs = value; | |
| 3160 | UINT32 lzcr = 0; | |
| 2423 | 3161 | |
| 2424 | if( ( | |
| 3162 | if( ( | |
| 2425 | 3163 | { |
| 2426 | | |
| 3164 | | |
| 2427 | 3165 | } |
| 2428 | while( ( | |
| 3166 | while( ( | |
| 2429 | 3167 | { |
| 2430 | n_lzcr++; | |
| 2431 | n_lzcs <<= 1; | |
| 3168 | lzcr++; | |
| 3169 | lzcs <<= 1; | |
| 2432 | 3170 | } |
| 2433 | LZCR = n_lzcr; | |
| 3171 | LZCR = lzcr; | |
| 3172 | break; | |
| 2434 | 3173 | } |
| 3174 | ||
| 3175 | case 31: | |
| 3176 | value = mipscpu.cp2dr[ reg ].d; | |
| 3177 | break; | |
| 3178 | } | |
| 3179 | ||
| 3180 | mipscpu.cp2dr[ reg ].d = value; | |
| 2435 | 3181 | } |
| 2436 | 3182 | |
| 2437 | static UINT32 getcp2cr( int | |
| 3183 | static UINT32 getcp2cr( int | |
| 2438 | 3184 | { |
| 2439 | GTELOG( "get CP2CR%u=%08x", n_reg, mipscpu.cp2cr[ n_reg ].d ); | |
| 2440 | return mipscpu.cp2cr[ n_reg ].d; | |
| 3185 | GTELOG( "get CP2CR%u=%08x", reg, mipscpu.cp2cr[ reg ].d ); | |
| 3186 | ||
| 3187 | return mipscpu.cp2cr[ reg ].d; | |
| 2441 | 3188 | } |
| 2442 | 3189 | |
| 2443 | static void setcp2cr( int | |
| 3190 | static void setcp2cr( int | |
| 2444 | 3191 | { |
| 2445 | GTELOG( "set CP2CR%u=%08x", n_reg, n_value ); | |
| 2446 | mipscpu.cp2cr[ n_reg ].d = n_value; | |
| 2447 | } | |
| 3192 | GTELOG( "set CP2CR%u=%08x", reg, value ); | |
| 2448 | 3193 | |
| 2449 | INLINE INT32 LIM( INT32 n_value, INT32 n_max, INT32 n_min, UINT32 n_flag ) | |
| 2450 | { | |
| 2451 | if( n_value > n_max ) | |
| 3194 | switch( reg ) | |
| 2452 | 3195 | { |
| 2453 | FLAG |= n_flag; | |
| 2454 | return n_max; | |
| 3196 | case 4: | |
| 3197 | case 12: | |
| 3198 | case 20: | |
| 3199 | case 26: | |
| 3200 | case 27: | |
| 3201 | case 29: | |
| 3202 | case 30: | |
| 3203 | value = (INT32)(INT16) value; | |
| 3204 | break; | |
| 3205 | ||
| 3206 | case 31: | |
| 3207 | value = ( mipscpu.cp2cr[ reg ].d & 0x80000fff ) | ( value & ~0x80000fff ); | |
| 3208 | break; | |
| 2455 | 3209 | } |
| 2456 | else if( n_value < n_min ) | |
| 2457 | { | |
| 2458 | FLAG |= n_flag; | |
| 2459 | return n_min; | |
| 2460 | } | |
| 2461 | return n_value; | |
| 3210 | ||
| 3211 | mipscpu.cp2cr[ reg ].d = value; | |
| 2462 | 3212 | } |
| 2463 | 3213 | |
| 2464 | 3214 | INLINE INT64 BOUNDS( INT64 n_value, INT64 n_max, int n_maxflag, INT64 n_min, int n_minflag ) |
| 2465 | 3215 | { |
| 2466 | 3216 | if( n_value > n_max ) |
| 2467 | 3217 | { |
| 2468 | FLAG |= | |
| 3218 | FLAG |= | |
| 2469 | 3219 | } |
| 2470 | 3220 | else if( n_value < n_min ) |
| 2471 | 3221 | { |
| 2472 | FLAG |= | |
| 3222 | FLAG |= | |
| 2473 | 3223 | } |
| 2474 | 3224 | return n_value; |
| 2475 | 3225 | } |
| 2476 | 3226 | |
| 2477 | #define A1( a ) BOUNDS( ( a ), 0x7fffffff, 30, -(INT64)0x80000000, 27 ) | |
| 2478 | #define A2( a ) BOUNDS( ( a ), 0x7fffffff, 29, -(INT64)0x80000000, 26 ) | |
| 2479 | #define A3( a ) BOUNDS( ( a ), 0x7fffffff, 28, -(INT64)0x80000000, 25 ) | |
| 3227 | #define A1( a ) BOUNDS( ( a ), 0x7fffffff, ( 1 << 30 ), -(INT64)0x80000000, ( 1 << 27 ) ) | |
| 3228 | #define A2( a ) BOUNDS( ( a ), 0x7fffffff, ( 1 << 29 ), -(INT64)0x80000000, ( 1 << 26 ) ) | |
| 3229 | #define A3( a ) BOUNDS( ( a ), 0x7fffffff, ( 1 << 28 ), -(INT64)0x80000000, ( 1 << 25 ) ) | |
| 2480 | 3230 | #define Lm_B1( a, l ) LIM( ( a ), 0x7fff, -0x8000 * !l, ( 1 << 31 ) | ( 1 << 24 ) ) |
| 2481 | 3231 | #define Lm_B2( a, l ) LIM( ( a ), 0x7fff, -0x8000 * !l, ( 1 << 31 ) | ( 1 << 23 ) ) |
| 2482 | 3232 | #define Lm_B3( a, l ) LIM( ( a ), 0x7fff, -0x8000 * !l, ( 1 << 31 ) | ( 1 << 22 ) ) |
| r2375 | r2376 | |
| 2530 | 3280 | static const UINT32 *const p_n_fc[] = { &RFC, &GFC, &BFC }; |
| 2531 | 3281 | static const UINT32 *const p_n_zc[] = { &n_zc, &n_zc, &n_zc }; |
| 2532 | 3282 | static const UINT32 *const *const p_p_n_cv[] = { p_n_tr, p_n_bk, p_n_fc, p_n_zc }; |
| 3283 | INT64 mac0; | |
| 2533 | 3284 | |
| 2534 | 3285 | switch( GTE_FUNCT( gteop ) ) |
| 2535 | 3286 | { |
| r2375 | r2376 | |
| 2975 | 3726 | return; |
| 2976 | 3727 | } |
| 2977 | 3728 | break; |
| 3729 | ||
| 2978 | 3730 | case 0x2d: |
| 2979 | if( gteop == 0x158002d ) | |
| 2980 | { | |
| 2981 | GTELOG( "AVSZ3" ); | |
| 2982 | FLAG = 0; | |
| 3731 | GTELOG( "AVSZ3" ); | |
| 3732 | FLAG = 0; | |
| 2983 | 3733 | |
| 2984 | MAC0 = F( ( (INT64)(INT16)ZSF3 * SZ1 ) + ( (INT16)ZSF3 * SZ2 ) + ( (INT16)ZSF3 * SZ3 ) ); | |
| 2985 | OTZ = Lm_D( (INT32)MAC0 >> 12 ); | |
| 2986 | return; | |
| 2987 | } | |
| 2988 | break; | |
| 3734 | mac0 = F( (INT64)( ZSF3 * SZ1 ) + ( ZSF3 * SZ2 ) + ( ZSF3 * SZ3 ) ); | |
| 3735 | OTZ = Lm_D( mac0 >> 12 ); | |
| 3736 | ||
| 3737 | MAC0 = mac0; | |
| 3738 | return; | |
| 3739 | ||
| 2989 | 3740 | case 0x2e: |
| 2990 | if( gteop == 0x168002e ) | |
| 2991 | { | |
| 2992 | GTELOG( "AVSZ4" ); | |
| 2993 | FLAG = 0; | |
| 3741 | GTELOG( "AVSZ4" ); | |
| 3742 | FLAG = 0; | |
| 2994 | 3743 | |
| 2995 | MAC0 = F( ( (INT64)(INT16)ZSF4 * SZ0 ) + ( (INT16)ZSF4 * SZ1 ) + ( (INT16)ZSF4 * SZ2 ) + ( (INT16)ZSF4 * SZ3 ) ); | |
| 2996 | OTZ = Lm_D( (INT32)MAC0 >> 12 ); | |
| 2997 | return; | |
| 2998 | } | |
| 2999 | break; | |
| 3744 | mac0 = F( (INT64)( ZSF4 * SZ0 ) + ( ZSF4 * SZ1 ) + ( ZSF4 * SZ2 ) + ( ZSF4 * SZ3 ) ); | |
| 3745 | OTZ = Lm_D( mac0 >> 12 ); | |
| 3746 | ||
| 3747 | MAC0 = mac0; | |
| 3748 | return; | |
| 3749 | ||
| 3000 | 3750 | case 0x30: |
| 3001 | 3751 | if( gteop == 0x0280030 ) |
| 3002 | 3752 | { |
| r2375 | r2376 | |
| 3151 | 3901 | case CPUINFO_INT_REGISTER + MIPS_PC: mips_set_pc( info->i ); break; |
| 3152 | 3902 | case CPUINFO_INT_SP: /* no stack */ break; |
| 3153 | 3903 | case CPUINFO_INT_REGISTER + MIPS_DELAYV: mipscpu.delayv = info->i; break; |
| 3154 | case CPUINFO_INT_REGISTER + MIPS_DELAYR: if( info->i <= | |
| 3904 | case CPUINFO_INT_REGISTER + MIPS_DELAYR: if( info->i <= MIPS_DELAYR_NOTPC ) mipscpu.delayr = info->i; break; | |
| 3155 | 3905 | case CPUINFO_INT_REGISTER + MIPS_HI: mipscpu.hi = info->i; break; |
| 3156 | 3906 | case CPUINFO_INT_REGISTER + MIPS_LO: mipscpu.lo = info->i; break; |
| 3907 | case CPUINFO_INT_REGISTER + MIPS_BIU: mipscpu.biu = info->i; break; | |
| 3157 | 3908 | case CPUINFO_INT_REGISTER + MIPS_R0: mipscpu.r[ 0 ] = info->i; break; |
| 3158 | 3909 | case CPUINFO_INT_REGISTER + MIPS_R1: mipscpu.r[ 1 ] = info->i; break; |
| 3159 | 3910 | case CPUINFO_INT_REGISTER + MIPS_R2: mipscpu.r[ 2 ] = info->i; break; |
| r2375 | r2376 | |
| 3202 | 3953 | case CPUINFO_INT_REGISTER + MIPS_CP0R13: mips_set_cp0r( 13, info->i ); break; |
| 3203 | 3954 | case CPUINFO_INT_REGISTER + MIPS_CP0R14: mips_set_cp0r( 14, info->i ); break; |
| 3204 | 3955 | case CPUINFO_INT_REGISTER + MIPS_CP0R15: mips_set_cp0r( 15, info->i ); break; |
| 3205 | case CPUINFO_INT_REGISTER + MIPS_CP0R16: mips_set_cp0r( 16, info->i ); break; | |
| 3206 | case CPUINFO_INT_REGISTER + MIPS_CP0R17: mips_set_cp0r( 17, info->i ); break; | |
| 3207 | case CPUINFO_INT_REGISTER + MIPS_CP0R18: mips_set_cp0r( 18, info->i ); break; | |
| 3208 | case CPUINFO_INT_REGISTER + MIPS_CP0R19: mips_set_cp0r( 19, info->i ); break; | |
| 3209 | case CPUINFO_INT_REGISTER + MIPS_CP0R20: mips_set_cp0r( 20, info->i ); break; | |
| 3210 | case CPUINFO_INT_REGISTER + MIPS_CP0R21: mips_set_cp0r( 21, info->i ); break; | |
| 3211 | case CPUINFO_INT_REGISTER + MIPS_CP0R22: mips_set_cp0r( 22, info->i ); break; | |
| 3212 | case CPUINFO_INT_REGISTER + MIPS_CP0R23: mips_set_cp0r( 23, info->i ); break; | |
| 3213 | case CPUINFO_INT_REGISTER + MIPS_CP0R24: mips_set_cp0r( 24, info->i ); break; | |
| 3214 | case CPUINFO_INT_REGISTER + MIPS_CP0R25: mips_set_cp0r( 25, info->i ); break; | |
| 3215 | case CPUINFO_INT_REGISTER + MIPS_CP0R26: mips_set_cp0r( 26, info->i ); break; | |
| 3216 | case CPUINFO_INT_REGISTER + MIPS_CP0R27: mips_set_cp0r( 27, info->i ); break; | |
| 3217 | case CPUINFO_INT_REGISTER + MIPS_CP0R28: mips_set_cp0r( 28, info->i ); break; | |
| 3218 | case CPUINFO_INT_REGISTER + MIPS_CP0R29: mips_set_cp0r( 29, info->i ); break; | |
| 3219 | case CPUINFO_INT_REGISTER + MIPS_CP0R30: mips_set_cp0r( 30, info->i ); break; | |
| 3220 | case CPUINFO_INT_REGISTER + MIPS_CP0R31: mips_set_cp0r( 31, info->i ); break; | |
| 3221 | 3956 | case CPUINFO_INT_REGISTER + MIPS_CP2DR0: mipscpu.cp2dr[ 0 ].d = info->i; break; |
| 3222 | 3957 | case CPUINFO_INT_REGISTER + MIPS_CP2DR1: mipscpu.cp2dr[ 1 ].d = info->i; break; |
| 3223 | 3958 | case CPUINFO_INT_REGISTER + MIPS_CP2DR2: mipscpu.cp2dr[ 2 ].d = info->i; break; |
| r2375 | r2376 | |
| 3337 | 4072 | case CPUINFO_INT_REGISTER + MIPS_DELAYR: info->i = mipscpu.delayr; break; |
| 3338 | 4073 | case CPUINFO_INT_REGISTER + MIPS_HI: info->i = mipscpu.hi; break; |
| 3339 | 4074 | case CPUINFO_INT_REGISTER + MIPS_LO: info->i = mipscpu.lo; break; |
| 4075 | case CPUINFO_INT_REGISTER + MIPS_BIU: info->i = mipscpu.biu; break; | |
| 3340 | 4076 | case CPUINFO_INT_REGISTER + MIPS_R0: info->i = mipscpu.r[ 0 ]; break; |
| 3341 | 4077 | case CPUINFO_INT_REGISTER + MIPS_R1: info->i = mipscpu.r[ 1 ]; break; |
| 3342 | 4078 | case CPUINFO_INT_REGISTER + MIPS_R2: info->i = mipscpu.r[ 2 ]; break; |
| r2375 | r2376 | |
| 3385 | 4121 | case CPUINFO_INT_REGISTER + MIPS_CP0R13: info->i = mipscpu.cp0r[ 13 ]; break; |
| 3386 | 4122 | case CPUINFO_INT_REGISTER + MIPS_CP0R14: info->i = mipscpu.cp0r[ 14 ]; break; |
| 3387 | 4123 | case CPUINFO_INT_REGISTER + MIPS_CP0R15: info->i = mipscpu.cp0r[ 15 ]; break; |
| 3388 | case CPUINFO_INT_REGISTER + MIPS_CP0R16: info->i = mipscpu.cp0r[ 16 ]; break; | |
| 3389 | case CPUINFO_INT_REGISTER + MIPS_CP0R17: info->i = mipscpu.cp0r[ 17 ]; break; | |
| 3390 | case CPUINFO_INT_REGISTER + MIPS_CP0R18: info->i = mipscpu.cp0r[ 18 ]; break; | |
| 3391 | case CPUINFO_INT_REGISTER + MIPS_CP0R19: info->i = mipscpu.cp0r[ 19 ]; break; | |
| 3392 | case CPUINFO_INT_REGISTER + MIPS_CP0R20: info->i = mipscpu.cp0r[ 20 ]; break; | |
| 3393 | case CPUINFO_INT_REGISTER + MIPS_CP0R21: info->i = mipscpu.cp0r[ 21 ]; break; | |
| 3394 | case CPUINFO_INT_REGISTER + MIPS_CP0R22: info->i = mipscpu.cp0r[ 22 ]; break; | |
| 3395 | case CPUINFO_INT_REGISTER + MIPS_CP0R23: info->i = mipscpu.cp0r[ 23 ]; break; | |
| 3396 | case CPUINFO_INT_REGISTER + MIPS_CP0R24: info->i = mipscpu.cp0r[ 24 ]; break; | |
| 3397 | case CPUINFO_INT_REGISTER + MIPS_CP0R25: info->i = mipscpu.cp0r[ 25 ]; break; | |
| 3398 | case CPUINFO_INT_REGISTER + MIPS_CP0R26: info->i = mipscpu.cp0r[ 26 ]; break; | |
| 3399 | case CPUINFO_INT_REGISTER + MIPS_CP0R27: info->i = mipscpu.cp0r[ 27 ]; break; | |
| 3400 | case CPUINFO_INT_REGISTER + MIPS_CP0R28: info->i = mipscpu.cp0r[ 28 ]; break; | |
| 3401 | case CPUINFO_INT_REGISTER + MIPS_CP0R29: info->i = mipscpu.cp0r[ 29 ]; break; | |
| 3402 | case CPUINFO_INT_REGISTER + MIPS_CP0R30: info->i = mipscpu.cp0r[ 30 ]; break; | |
| 3403 | case CPUINFO_INT_REGISTER + MIPS_CP0R31: info->i = mipscpu.cp0r[ 31 ]; break; | |
| 3404 | 4124 | case CPUINFO_INT_REGISTER + MIPS_CP2DR0: info->i = mipscpu.cp2dr[ 0 ].d; break; |
| 3405 | 4125 | case CPUINFO_INT_REGISTER + MIPS_CP2DR1: info->i = mipscpu.cp2dr[ 1 ].d; break; |
| 3406 | 4126 | case CPUINFO_INT_REGISTER + MIPS_CP2DR2: info->i = mipscpu.cp2dr[ 2 ].d; break; |
| r2375 | r2376 | |
| 3480 | 4200 | #endif /* ENABLE_DEBUGGER */ |
| 3481 | 4201 | case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &mips_ICount; break; |
| 3482 | 4202 | |
| 4203 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = address_map_psxcpu_internal_map; break; | |
| 4204 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map32 = 0; break; | |
| 4205 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO: info->internal_map32 = 0; break; | |
| 4206 | ||
| 3483 | 4207 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 3484 | case CPUINFO_STR_NAME: strcpy(info->s, "PSX CPU"); break; | |
| 3485 | case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "mipscpu"); break; | |
| 3486 | case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "1.5"); break; | |
| 3487 | case CPUINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break; | |
| 3488 | case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright smf"); break; | |
| 4208 | case CPUINFO_STR_NAME: strcpy(info->s, "PSX CPU"); break; | |
| 4209 | case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "MIPS"); break; | |
| 4210 | case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "2.0"); break; | |
| 4211 | case CPUINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break; | |
| 4212 | case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright 2008 smf"); break; | |
| 3489 | 4213 | |
| 3490 | case CPUINFO_STR_FLAGS: strcpy(info->s, " "); | |
| 4214 | case CPUINFO_STR_FLAGS: strcpy(info->s, " "); | |
| 3491 | 4215 | |
| 3492 | 4216 | case CPUINFO_STR_REGISTER + MIPS_PC: sprintf( info->s, "pc :%08x", mipscpu.pc ); break; |
| 3493 | case CPUINFO_STR_REGISTER + MIPS_DELAYV: sprintf( info->s, "delay :%08x", mipscpu.delayv ); break; | |
| 3494 | case CPUINFO_STR_REGISTER + MIPS_DELAYR: sprintf( info->s, "delay %s:%02x", delayn[ mipscpu.delayr ], mipscpu.delayr ); break; | |
| 4217 | case CPUINFO_STR_REGISTER + MIPS_DELAYV: sprintf( info->s, "delayv :%08x", mipscpu.delayv ); break; | |
| 4218 | case CPUINFO_STR_REGISTER + MIPS_DELAYR: sprintf( info->s, "delayr :%02x %s", mipscpu.delayr, delayn[ mipscpu.delayr ] ); break; | |
| 3495 | 4219 | case CPUINFO_STR_REGISTER + MIPS_HI: sprintf( info->s, "hi :%08x", mipscpu.hi ); break; |
| 3496 | 4220 | case CPUINFO_STR_REGISTER + MIPS_LO: sprintf( info->s, "lo :%08x", mipscpu.lo ); break; |
| 4221 | case CPUINFO_STR_REGISTER + MIPS_BIU: sprintf( info->s, "biu :%08x", mipscpu.biu ); break; | |
| 3497 | 4222 | case CPUINFO_STR_REGISTER + MIPS_R0: sprintf( info->s, "zero :%08x", mipscpu.r[ 0 ] ); break; |
| 3498 | 4223 | case CPUINFO_STR_REGISTER + MIPS_R1: sprintf( info->s, "at :%08x", mipscpu.r[ 1 ] ); break; |
| 3499 | 4224 | case CPUINFO_STR_REGISTER + MIPS_R2: sprintf( info->s, "v0 :%08x", mipscpu.r[ 2 ] ); break; |
| r2375 | r2376 | |
| 3526 | 4251 | case CPUINFO_STR_REGISTER + MIPS_R29: sprintf( info->s, "sp :%08x", mipscpu.r[ 29 ] ); break; |
| 3527 | 4252 | case CPUINFO_STR_REGISTER + MIPS_R30: sprintf( info->s, "fp :%08x", mipscpu.r[ 30 ] ); break; |
| 3528 | 4253 | case CPUINFO_STR_REGISTER + MIPS_R31: sprintf( info->s, "ra :%08x", mipscpu.r[ 31 ] ); break; |
| 3529 | case CPUINFO_STR_REGISTER + MIPS_CP0R0: sprintf( info->s, "Index :%08x", mipscpu.cp0r[ 0 ] ); break; | |
| 3530 | case CPUINFO_STR_REGISTER + MIPS_CP0R1: sprintf( info->s, "Random :%08x", mipscpu.cp0r[ 1 ] ); break; | |
| 3531 | case CPUINFO_STR_REGISTER + MIPS_CP0R2: sprintf( info->s, "EntryLo :%08x", mipscpu.cp0r[ 2 ] ); break; | |
| 3532 | case CPUINFO_STR_REGISTER + MIPS_CP0R3: sprintf( info->s, "cp0r3 :%08x", mipscpu.cp0r[ 3 ] ); break; | |
| 3533 | case CPUINFO_STR_REGISTER + MIPS_CP0R4: sprintf( info->s, "Context :%08x", mipscpu.cp0r[ 4 ] ); break; | |
| 3534 | case CPUINFO_STR_REGISTER + MIPS_CP0R5: sprintf( info->s, "cp0r5 :%08x", mipscpu.cp0r[ 5 ] ); break; | |
| 3535 | case CPUINFO_STR_REGISTER + MIPS_CP0R6: sprintf( info->s, "cp0r6 :%08x", mipscpu.cp0r[ 6 ] ); break; | |
| 3536 | case CPUINFO_STR_REGISTER + MIPS_CP0R7: sprintf( info->s, "cp0r7 :%08x", mipscpu.cp0r[ 7 ] ); break; | |
| 3537 | case CPUINFO_STR_REGISTER + MIPS_CP0R8: sprintf( info->s, "BadVAddr:%08x", mipscpu.cp0r[ 8 ] ); break; | |
| 3538 | case CPUINFO_STR_REGISTER + MIPS_CP0R9: sprintf( info->s, "cp0r9 :%08x", mipscpu.cp0r[ 9 ] ); break; | |
| 3539 | case CPUINFO_STR_REGISTER + MIPS_CP0R10: sprintf( info->s, "EntryHi :%08x", mipscpu.cp0r[ 10 ] ); break; | |
| 3540 | case CPUINFO_STR_REGISTER + MIPS_CP0R11: sprintf( info->s, "cp0r11 :%08x", mipscpu.cp0r[ 11 ] ); break; | |
| 4254 | case CPUINFO_STR_REGISTER + MIPS_CP0R0: sprintf( info->s, "!Index :%08x", mipscpu.cp0r[ 0 ] ); break; | |
| 4255 | case CPUINFO_STR_REGISTER + MIPS_CP0R1: sprintf( info->s, "!Random :%08x", mipscpu.cp0r[ 1 ] ); break; | |
| 4256 | case CPUINFO_STR_REGISTER + MIPS_CP0R2: sprintf( info->s, "!EntryLo:%08x", mipscpu.cp0r[ 2 ] ); break; | |
| 4257 | case CPUINFO_STR_REGISTER + MIPS_CP0R3: sprintf( info->s, "BPC :%08x", mipscpu.cp0r[ 3 ] ); break; | |
| 4258 | case CPUINFO_STR_REGISTER + MIPS_CP0R4: sprintf( info->s, "!Context:%08x", mipscpu.cp0r[ 4 ] ); break; | |
| 4259 | case CPUINFO_STR_REGISTER + MIPS_CP0R5: sprintf( info->s, "BDA :%08x", mipscpu.cp0r[ 5 ] ); break; | |
| 4260 | case CPUINFO_STR_REGISTER + MIPS_CP0R6: sprintf( info->s, "TAR :%08x", mipscpu.cp0r[ 6 ] ); break; | |
| 4261 | case CPUINFO_STR_REGISTER + MIPS_CP0R7: sprintf( info->s, "DCIC :%08x", mipscpu.cp0r[ 7 ] ); break; | |
| 4262 | case CPUINFO_STR_REGISTER + MIPS_CP0R8: sprintf( info->s, "BadA :%08x", mipscpu.cp0r[ 8 ] ); break; | |
| 4263 | case CPUINFO_STR_REGISTER + MIPS_CP0R9: sprintf( info->s, "BDAM :%08x", mipscpu.cp0r[ 9 ] ); break; | |
| 4264 | case CPUINFO_STR_REGISTER + MIPS_CP0R10: sprintf( info->s, "!EntryHi:%08x", mipscpu.cp0r[ 10 ] ); break; | |
| 4265 | case CPUINFO_STR_REGISTER + MIPS_CP0R11: sprintf( info->s, "BPCM :%08x", mipscpu.cp0r[ 11 ] ); break; | |
| 3541 | 4266 | case CPUINFO_STR_REGISTER + MIPS_CP0R12: sprintf( info->s, "SR :%08x", mipscpu.cp0r[ 12 ] ); break; |
| 3542 | 4267 | case CPUINFO_STR_REGISTER + MIPS_CP0R13: sprintf( info->s, "Cause :%08x", mipscpu.cp0r[ 13 ] ); break; |
| 3543 | 4268 | case CPUINFO_STR_REGISTER + MIPS_CP0R14: sprintf( info->s, "EPC :%08x", mipscpu.cp0r[ 14 ] ); break; |
| 3544 | 4269 | case CPUINFO_STR_REGISTER + MIPS_CP0R15: sprintf( info->s, "PRId :%08x", mipscpu.cp0r[ 15 ] ); break; |
| 3545 | case CPUINFO_STR_REGISTER + MIPS_CP0R16: sprintf( info->s, "cp0r16 :%08x", mipscpu.cp0r[ 16 ] ); break; | |
| 3546 | case CPUINFO_STR_REGISTER + MIPS_CP0R17: sprintf( info->s, "cp0r17 :%08x", mipscpu.cp0r[ 17 ] ); break; | |
| 3547 | case CPUINFO_STR_REGISTER + MIPS_CP0R18: sprintf( info->s, "cp0r18 :%08x", mipscpu.cp0r[ 18 ] ); break; | |
| 3548 | case CPUINFO_STR_REGISTER + MIPS_CP0R19: sprintf( info->s, "cp0r19 :%08x", mipscpu.cp0r[ 19 ] ); break; | |
| 3549 | case CPUINFO_STR_REGISTER + MIPS_CP0R20: sprintf( info->s, "cp0r20 :%08x", mipscpu.cp0r[ 20 ] ); break; | |
| 3550 | case CPUINFO_STR_REGISTER + MIPS_CP0R21: sprintf( info->s, "cp0r21 :%08x", mipscpu.cp0r[ 21 ] ); break; | |
| 3551 | case CPUINFO_STR_REGISTER + MIPS_CP0R22: sprintf( info->s, "cp0r22 :%08x", mipscpu.cp0r[ 22 ] ); break; | |
| 3552 | case CPUINFO_STR_REGISTER + MIPS_CP0R23: sprintf( info->s, "cp0r23 :%08x", mipscpu.cp0r[ 23 ] ); break; | |
| 3553 | case CPUINFO_STR_REGISTER + MIPS_CP0R24: sprintf( info->s, "cp0r24 :%08x", mipscpu.cp0r[ 24 ] ); break; | |
| 3554 | case CPUINFO_STR_REGISTER + MIPS_CP0R25: sprintf( info->s, "cp0r25 :%08x", mipscpu.cp0r[ 25 ] ); break; | |
| 3555 | case CPUINFO_STR_REGISTER + MIPS_CP0R26: sprintf( info->s, "cp0r26 :%08x", mipscpu.cp0r[ 26 ] ); break; | |
| 3556 | case CPUINFO_STR_REGISTER + MIPS_CP0R27: sprintf( info->s, "cp0r27 :%08x", mipscpu.cp0r[ 27 ] ); break; | |
| 3557 | case CPUINFO_STR_REGISTER + MIPS_CP0R28: sprintf( info->s, "cp0r28 :%08x", mipscpu.cp0r[ 28 ] ); break; | |
| 3558 | case CPUINFO_STR_REGISTER + MIPS_CP0R29: sprintf( info->s, "cp0r29 :%08x", mipscpu.cp0r[ 29 ] ); break; | |
| 3559 | case CPUINFO_STR_REGISTER + MIPS_CP0R30: sprintf( info->s, "cp0r30 :%08x", mipscpu.cp0r[ 30 ] ); break; | |
| 3560 | case CPUINFO_STR_REGISTER + MIPS_CP0R31: sprintf( info->s, "cp0r31 :%08x", mipscpu.cp0r[ 31 ] ); break; | |
| 3561 | 4270 | case CPUINFO_STR_REGISTER + MIPS_CP2DR0: sprintf( info->s, "vxy0 :%08x", mipscpu.cp2dr[ 0 ].d ); break; |
| 3562 | 4271 | case CPUINFO_STR_REGISTER + MIPS_CP2DR1: sprintf( info->s, "vz0 :%08x", mipscpu.cp2dr[ 1 ].d ); break; |
| 3563 | 4272 | case CPUINFO_STR_REGISTER + MIPS_CP2DR2: sprintf( info->s, "vxy1 :%08x", mipscpu.cp2dr[ 2 ].d ); break; |
| r2375 | r2376 | |
| 3644 | 4353 | } |
| 3645 | 4354 | } |
| 3646 | 4355 | #endif |
| 4356 | ||
| 4357 | #if (HAS_CXD8661R) | |
| 4358 | ||
| 4359 | void cxd8661r_get_info(UINT32 state, cpuinfo *info) | |
| 4360 | { | |
| 4361 | switch (state) | |
| 4362 | { | |
| 4363 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = address_map_cxd8661r_internal_map; break; | |
| 4364 | ||
| 4365 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 4366 | case CPUINFO_STR_NAME: strcpy(info->s, "CXD8661R"); break; | |
| 4367 | ||
| 4368 | default: | |
| 4369 | mips_get_info(state, info); | |
| 4370 | break; | |
| 4371 | } | |
| 4372 | } | |
| 4373 | ||
| 4374 | #endif |
| r2375 | r2376 | |
|---|---|---|
| 31 | 31 | |
| 32 | 32 | static const char *const s_cp0genreg[] = |
| 33 | 33 | { |
| 34 | "Index", "Random", "EntryLo", "cp0r3", "Context", "cp0r5", "cp0r6", "cp0r7", | |
| 35 | "BadVAddr", "cp0r9", "EntryHi", "cp0r11", "SR", "Cause", "EPC", "PRId", | |
| 34 | "!Index", "!Random", "!EntryLo", "BPC", "!Context", "BDA", "TAR", "DCIC", | |
| 35 | "BadA", "BDAM", "!EntryHi", "BPCM", "SR", "Cause", "EPC", "PRId", | |
| 36 | 36 | "cp0r16", "cp0r17", "cp0r18", "cp0r19", "cp0r20", "cp0r21", "cp0r22", "cp0r23", |
| 37 | 37 | "cp0r24", "cp0r25", "cp0r26", "cp0r27", "cp0r28", "cp0r29", "cp0r30", "cp0r31" |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | static const char *const s_cp0ctlreg[] = | |
| 41 | { | |
| 42 | "cp0cr0", "cp0cr1", "cp0cr2", "cp0cr3", "cp0cr4", "cp0cr5", "cp0cr6", "cp0cr7", | |
| 43 | "cp0cr8", "cp0cr9", "cp0cr10", "cp0cr11", "cp0cr12", "cp0cr13", "cp0cr14", "cp0cr15", | |
| 44 | "cp0cr16", "cp0cr17", "cp0cr18", "cp0cr19", "cp0cr20", "cp0cr21", "cp0cr22", "cp0cr23", | |
| 45 | "cp0cr24", "cp0cr25", "cp0cr26", "cp0cr27", "cp0cr28", "cp0cr29", "cp0cr30", "cp0cr31" | |
| 46 | }; | |
| 47 | ||
| 40 | 48 | static const char *const s_cp1genreg[] = |
| 41 | 49 | { |
| 42 | 50 | "cp1r0", "cp1r1", "cp1r2", "cp1r3", "cp1r4", "cp1r5", "cp1r6", "cp1r7", |
| r2375 | r2376 | |
| 69 | 77 | "ofx", "ofy", "h", "dqa", "dqb", "zsf3", "zsf4", "flag" |
| 70 | 78 | }; |
| 71 | 79 | |
| 80 | static const char *const s_cp3genreg[] = | |
| 81 | { | |
| 82 | "cp3r0", "cp3r1", "cp3r2", "cp3r3", "cp3r4", "cp3r5", "cp3r6", "cp3r7", | |
| 83 | "cp3r8", "cp3r9", "cp3r10", "cp3r11", "cp3r12", "cp3r13", "cp3r14", "cp3r15", | |
| 84 | "cp3r16", "cp3r17", "cp3r18", "cp3r19", "cp3r20", "cp3r21", "cp3r22", "cp3r22", | |
| 85 | "cp3r23", "cp3r24", "cp3r25", "cp3r26", "cp3r27", "cp3r28", "cp3r29", "cp3r30" | |
| 86 | }; | |
| 87 | ||
| 88 | static const char *const s_cp3ctlreg[] = | |
| 89 | { | |
| 90 | "cp3cr0", "cp3cr1", "cp3cr2", "cp3cr3", "cp3cr4", "cp3cr5", "cp3cr6", "cp3cr7", | |
| 91 | "cp3cr8", "cp3cr9", "cp3cr10", "cp3cr11", "cp3cr12", "cp3cr13", "cp3cr14", "cp3cr15", | |
| 92 | "cp3cr16", "cp3cr17", "cp3cr18", "cp3cr19", "cp3cr20", "cp3cr21", "cp3cr22", "cp3cr23", | |
| 93 | "cp3cr24", "cp3cr25", "cp3cr26", "cp3cr27", "cp3cr28", "cp3cr29", "cp3cr30", "cp3cr31" | |
| 94 | }; | |
| 95 | ||
| 72 | 96 | static const char *const s_gtesf[] = |
| 73 | 97 | { |
| 74 | 98 | "0", "12" |
| r2375 | r2376 | |
| 94 | 118 | "0", "1" |
| 95 | 119 | }; |
| 96 | 120 | |
| 97 | static char * | |
| 121 | static char *effective_address( UINT32 pc, UINT32 op ) | |
| 98 | 122 | { |
| 99 | 123 | static char s_address[ 20 ]; |
| 100 | 124 | #ifndef STANDALONE |
| r2375 | r2376 | |
| 109 | 133 | return s_address; |
| 110 | 134 | } |
| 111 | 135 | |
| 136 | static UINT32 relative_address( UINT32 pc, UINT32 op ) | |
| 137 | { | |
| 138 | UINT32 nextpc = pc + 4; | |
| 139 | #ifndef STANDALONE | |
| 140 | if( pc == activecpu_get_pc() && activecpu_get_reg( MIPS_DELAYR ) == 32 ) | |
| 141 | { | |
| 142 | nextpc = activecpu_get_reg( MIPS_DELAYV ); | |
| 143 | } | |
| 144 | #endif | |
| 145 | return nextpc + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ); | |
| 146 | } | |
| 147 | ||
| 148 | static UINT32 jump_address( UINT32 pc, UINT32 op ) | |
| 149 | { | |
| 150 | UINT32 nextpc = pc + 4; | |
| 151 | #ifndef STANDALONE | |
| 152 | if( pc == activecpu_get_pc() && activecpu_get_reg( MIPS_DELAYR ) == 32 ) | |
| 153 | { | |
| 154 | nextpc = activecpu_get_reg( MIPS_DELAYV ); | |
| 155 | } | |
| 156 | #endif | |
| 157 | return ( nextpc & 0xf0000000 ) + ( INS_TARGET( op ) << 2 ); | |
| 158 | } | |
| 159 | ||
| 160 | static UINT32 fetch_op( const UINT8 *opram ) | |
| 161 | { | |
| 162 | return ( opram[ 3 ] << 24 ) | ( opram[ 2 ] << 16 ) | ( opram[ 1 ] << 8 ) | ( opram[ 0 ] << 0 ); | |
| 163 | } | |
| 164 | ||
| 165 | static char *upper_address( UINT32 op, const UINT8 *opram ) | |
| 166 | { | |
| 167 | static char s_address[ 20 ]; | |
| 168 | UINT32 nextop = fetch_op( opram ); | |
| 169 | ||
| 170 | if( INS_OP( nextop ) == OP_ORI && INS_RT( op ) == INS_RS( nextop ) ) | |
| 171 | { | |
| 172 | sprintf( s_address, "$%04x ; 0x%08x", INS_IMMEDIATE( op ), ( INS_IMMEDIATE( op ) << 16 ) | INS_IMMEDIATE( nextop ) ); | |
| 173 | } | |
| 174 | else if( INS_OP( nextop ) == OP_ADDIU && INS_RT( op ) == INS_RS( nextop ) ) | |
| 175 | { | |
| 176 | sprintf( s_address, "$%04x ; 0x%08x", INS_IMMEDIATE( op ), ( INS_IMMEDIATE( op ) << 16 ) + (INT16) INS_IMMEDIATE( nextop ) ); | |
| 177 | } | |
| 178 | else | |
| 179 | { | |
| 180 | sprintf( s_address, "$%04x", INS_IMMEDIATE( op ) ); | |
| 181 | } | |
| 182 | ||
| 183 | return s_address; | |
| 184 | } | |
| 185 | ||
| 112 | 186 | unsigned DasmMIPS( char *buffer, UINT32 pc, const UINT8 *opram ) |
| 113 | 187 | { |
| 114 | 188 | UINT32 op; |
| 115 | 189 | const UINT8 *oldopram; |
| 190 | UINT32 flags = 0; | |
| 116 | 191 | |
| 117 | 192 | oldopram = opram; |
| 118 | op = | |
| 193 | op = fetch_op | |
| 119 | 194 | opram += 4; |
| 120 | 195 | |
| 121 | 196 | sprintf( buffer, "dw $%08x", op ); |
| r2375 | r2376 | |
| 152 | 227 | sprintf( buffer, "srav %s,%s,%s", s_cpugenreg[ INS_RD( op ) ], s_cpugenreg[ INS_RT( op ) ], s_cpugenreg[ INS_RS( op ) ] ); |
| 153 | 228 | break; |
| 154 | 229 | case FUNCT_JR: |
| 155 | if( INS_RD( op ) == 0 ) | |
| 230 | sprintf( buffer, "jr %s", s_cpugenreg[ INS_RS( op ) ] ); | |
| 231 | if( INS_RS( op ) == 31 ) | |
| 156 | 232 | { |
| 157 | | |
| 233 | | |
| 158 | 234 | } |
| 159 | 235 | break; |
| 160 | 236 | case FUNCT_JALR: |
| 161 | 237 | sprintf( buffer, "jalr %s,%s", s_cpugenreg[ INS_RD( op ) ], s_cpugenreg[ INS_RS( op ) ] ); |
| 238 | flags = DASMFLAG_STEP_OVER | DASMFLAG_STEP_OVER_EXTRA( 1 ); | |
| 162 | 239 | break; |
| 163 | 240 | case FUNCT_SYSCALL: |
| 164 | 241 | sprintf( buffer, "syscall $%05x", INS_CODE( op ) ); |
| 242 | flags = DASMFLAG_STEP_OVER; | |
| 165 | 243 | break; |
| 166 | 244 | case FUNCT_BREAK: |
| 167 | 245 | sprintf( buffer, "break $%05x", INS_CODE( op ) ); |
| 246 | flags = DASMFLAG_STEP_OVER; | |
| 168 | 247 | break; |
| 169 | 248 | case FUNCT_MFHI: |
| 170 | 249 | sprintf( buffer, "mfhi %s", s_cpugenreg[ INS_RD( op ) ] ); |
| 171 | 250 | break; |
| 172 | 251 | case FUNCT_MTHI: |
| 173 | if( INS_RD( op ) == 0 ) | |
| 174 | { | |
| 175 | sprintf( buffer, "mthi %s", s_cpugenreg[ INS_RS( op ) ] ); | |
| 176 | } | |
| 252 | sprintf( buffer, "mthi %s", s_cpugenreg[ INS_RS( op ) ] ); | |
| 177 | 253 | break; |
| 178 | 254 | case FUNCT_MFLO: |
| 179 | 255 | sprintf( buffer, "mflo %s", s_cpugenreg[ INS_RD( op ) ] ); |
| 180 | 256 | break; |
| 181 | 257 | case FUNCT_MTLO: |
| 182 | if( INS_RD( op ) == 0 ) | |
| 183 | { | |
| 184 | sprintf( buffer, "mtlo %s", s_cpugenreg[ INS_RS( op ) ] ); | |
| 185 | } | |
| 258 | sprintf( buffer, "mtlo %s", s_cpugenreg[ INS_RS( op ) ] ); | |
| 186 | 259 | break; |
| 187 | 260 | case FUNCT_MULT: |
| 188 | if( INS_RD( op ) == 0 ) | |
| 189 | { | |
| 190 | sprintf( buffer, "mult %s,%s", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ] ); | |
| 191 | } | |
| 261 | sprintf( buffer, "mult %s,%s", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ] ); | |
| 192 | 262 | break; |
| 193 | 263 | case FUNCT_MULTU: |
| 194 | if( INS_RD( op ) == 0 ) | |
| 195 | { | |
| 196 | sprintf( buffer, "multu %s,%s", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ] ); | |
| 197 | } | |
| 264 | sprintf( buffer, "multu %s,%s", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ] ); | |
| 198 | 265 | break; |
| 199 | 266 | case FUNCT_DIV: |
| 200 | if( INS_RD( op ) == 0 ) | |
| 201 | { | |
| 202 | sprintf( buffer, "div %s,%s", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ] ); | |
| 203 | } | |
| 267 | sprintf( buffer, "div %s,%s", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ] ); | |
| 204 | 268 | break; |
| 205 | 269 | case FUNCT_DIVU: |
| 206 | if( INS_RD( op ) == 0 ) | |
| 207 | { | |
| 208 | sprintf( buffer, "divu %s,%s", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ] ); | |
| 209 | } | |
| 270 | sprintf( buffer, "divu %s,%s", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ] ); | |
| 210 | 271 | break; |
| 211 | 272 | case FUNCT_ADD: |
| 212 | 273 | sprintf( buffer, "add %s,%s,%s", s_cpugenreg[ INS_RD( op ) ], s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ] ); |
| r2375 | r2376 | |
| 241 | 302 | } |
| 242 | 303 | break; |
| 243 | 304 | case OP_REGIMM: |
| 244 | switch( INS_RT( op ) ) | |
| 305 | switch( INS_RT_REGIMM( op ) ) | |
| 245 | 306 | { |
| 246 | 307 | case RT_BLTZ: |
| 247 | sprintf( buffer, "bltz %s,$%08x", s_cpugenreg[ INS_RS( op ) ], pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 308 | if( INS_RT( op ) == RT_BLTZAL ) | |
| 309 | { | |
| 310 | sprintf( buffer, "bltzal %s,$%08x", s_cpugenreg[ INS_RS( op ) ], relative_address( pc, op ) ); | |
| 311 | flags = DASMFLAG_STEP_OVER | DASMFLAG_STEP_OVER_EXTRA( 1 ); | |
| 312 | } | |
| 313 | else | |
| 314 | { | |
| 315 | sprintf( buffer, "bltz %s,$%08x", s_cpugenreg[ INS_RS( op ) ], relative_address( pc, op ) ); | |
| 316 | } | |
| 248 | 317 | break; |
| 249 | 318 | case RT_BGEZ: |
| 250 | sprintf( buffer, "bgez %s,$%08x", s_cpugenreg[ INS_RS( op ) ], pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 319 | if( INS_RT( op ) == RT_BGEZAL ) | |
| 320 | { | |
| 321 | sprintf( buffer, "bgezal %s,$%08x", s_cpugenreg[ INS_RS( op ) ], relative_address( pc, op ) ); | |
| 322 | flags = DASMFLAG_STEP_OVER | DASMFLAG_STEP_OVER_EXTRA( 1 ); | |
| 323 | } | |
| 324 | else | |
| 325 | { | |
| 326 | sprintf( buffer, "bgez %s,$%08x", s_cpugenreg[ INS_RS( op ) ], relative_address( pc, op ) ); | |
| 327 | } | |
| 251 | 328 | break; |
| 252 | case RT_BLTZAL: | |
| 253 | sprintf( buffer, "bltzal %s,$%08x", s_cpugenreg[ INS_RS( op ) ], pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 254 | break; | |
| 255 | case RT_BGEZAL: | |
| 256 | sprintf( buffer, "bgezal %s,$%08x", s_cpugenreg[ INS_RS( op ) ], pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 257 | break; | |
| 258 | 329 | } |
| 259 | 330 | break; |
| 260 | 331 | case OP_J: |
| 261 | sprintf( buffer, "j $%08x", ( | |
| 332 | sprintf( buffer, "j $%08x", jump_address( | |
| 262 | 333 | break; |
| 263 | 334 | case OP_JAL: |
| 264 | sprintf( buffer, "jal $%08x", ( ( pc + 4 ) & 0xF0000000 ) + ( INS_TARGET( op ) << 2 ) ); | |
| 335 | sprintf( buffer, "jal $%08x", jump_address( pc, op ) ); | |
| 336 | flags = DASMFLAG_STEP_OVER | DASMFLAG_STEP_OVER_EXTRA( 1 ); | |
| 265 | 337 | break; |
| 266 | 338 | case OP_BEQ: |
| 267 | sprintf( buffer, "beq %s,%s,$%08x", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ], | |
| 339 | sprintf( buffer, "beq %s,%s,$%08x", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ], relative | |
| 268 | 340 | break; |
| 269 | 341 | case OP_BNE: |
| 270 | sprintf( buffer, "bne %s,%s,$%08x", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ], | |
| 342 | sprintf( buffer, "bne %s,%s,$%08x", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ], relative | |
| 271 | 343 | break; |
| 272 | 344 | case OP_BLEZ: |
| 273 | if( INS_RT( op ) == 0 ) | |
| 274 | { | |
| 275 | sprintf( buffer, "blez %s,$%08x", s_cpugenreg[ INS_RS( op ) ], pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 276 | } | |
| 345 | sprintf( buffer, "blez %s,%s,$%08x", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ], relative_address( pc, op ) ); | |
| 277 | 346 | break; |
| 278 | 347 | case OP_BGTZ: |
| 279 | if( INS_RT( op ) == 0 ) | |
| 280 | { | |
| 281 | sprintf( buffer, "bgtz %s,$%08x", s_cpugenreg[ INS_RS( op ) ], pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 282 | } | |
| 348 | sprintf( buffer, "bgtz %s,%s,$%08x", s_cpugenreg[ INS_RS( op ) ], s_cpugenreg[ INS_RT( op ) ], relative_address( pc, op ) ); | |
| 283 | 349 | break; |
| 284 | 350 | case OP_ADDI: |
| 285 | 351 | sprintf( buffer, "addi %s,%s,%s", s_cpugenreg[ INS_RT( op ) ], s_cpugenreg[ INS_RS( op ) ], make_signed_hex_str_16( INS_IMMEDIATE( op ) ) ); |
| r2375 | r2376 | |
| 303 | 369 | sprintf( buffer, "xori %s,%s,$%04x", s_cpugenreg[ INS_RT( op ) ], s_cpugenreg[ INS_RS( op ) ], INS_IMMEDIATE( op ) ); |
| 304 | 370 | break; |
| 305 | 371 | case OP_LUI: |
| 306 | sprintf( buffer, "lui %s, | |
| 372 | sprintf( buffer, "lui %s, | |
| 307 | 373 | break; |
| 308 | 374 | case OP_COP0: |
| 309 | 375 | switch( INS_RS( op ) ) |
| r2375 | r2376 | |
| 311 | 377 | case RS_MFC: |
| 312 | 378 | sprintf( buffer, "mfc0 %s,%s", s_cpugenreg[ INS_RT( op ) ], s_cp0genreg[ INS_RD( op ) ] ); |
| 313 | 379 | break; |
| 380 | case RS_CFC: | |
| 381 | sprintf( buffer, "!cfc0 %s,%s", s_cpugenreg[ INS_RT( op ) ], s_cp0ctlreg[ INS_RD( op ) ] ); | |
| 382 | break; | |
| 314 | 383 | case RS_MTC: |
| 315 | 384 | sprintf( buffer, "mtc0 %s,%s", s_cpugenreg[ INS_RT( op ) ], s_cp0genreg[ INS_RD( op ) ] ); |
| 316 | 385 | break; |
| 386 | case RS_CTC: | |
| 387 | sprintf( buffer, "!ctc0 %s,%s", s_cpugenreg[ INS_RT( op ) ], s_cp0ctlreg[ INS_RD( op ) ] ); | |
| 388 | break; | |
| 317 | 389 | case RS_BC: |
| 318 | switch( INS_RT( op ) ) | |
| 390 | case RS_BC_ALT: | |
| 391 | switch( INS_BC( op ) ) | |
| 319 | 392 | { |
| 320 | case RT_BCF: | |
| 321 | sprintf( buffer, "bc0f $%08x", pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 393 | case BC_BCF: | |
| 394 | sprintf( buffer, "bc0f $%08x", relative_address( pc, op ) ); | |
| 322 | 395 | break; |
| 323 | case RT_BCT: | |
| 324 | sprintf( buffer, "bc0t $%08x", pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 396 | case BC_BCT: | |
| 397 | sprintf( buffer, "bc0t $%08x", relative_address( pc, op ) ); | |
| 325 | 398 | break; |
| 326 | 399 | } |
| 327 | 400 | break; |
| r2375 | r2376 | |
| 333 | 406 | |
| 334 | 407 | switch( INS_CF( op ) ) |
| 335 | 408 | { |
| 336 | case 1: | |
| 337 | sprintf( buffer, "tlbr" ); | |
| 409 | case CF_TLBR: | |
| 410 | sprintf( buffer, "!tlbr" ); | |
| 338 | 411 | break; |
| 339 | case 4: | |
| 340 | sprintf( buffer, "tlbwi" ); | |
| 412 | case CF_TLBWI: | |
| 413 | sprintf( buffer, "!tlbwi" ); | |
| 341 | 414 | break; |
| 342 | case 6: | |
| 343 | sprintf( buffer, "tlbwr" ); | |
| 415 | case CF_TLBWR: | |
| 416 | sprintf( buffer, "!tlbwr" ); | |
| 344 | 417 | break; |
| 345 | case 8: | |
| 346 | sprintf( buffer, "tlbp" ); | |
| 418 | case CF_TLBP: | |
| 419 | sprintf( buffer, "!tlbp" ); | |
| 347 | 420 | break; |
| 348 | case | |
| 421 | case CF_RFE: | |
| 349 | 422 | sprintf( buffer, "rfe" ); |
| 350 | 423 | break; |
| 351 | 424 | } |
| r2375 | r2376 | |
| 370 | 443 | sprintf( buffer, "ctc1 %s,%s", s_cpugenreg[ INS_RT( op ) ], s_cp1ctlreg[ INS_RD( op ) ] ); |
| 371 | 444 | break; |
| 372 | 445 | case RS_BC: |
| 373 | switch( INS_RT( op ) ) | |
| 446 | case RS_BC_ALT: | |
| 447 | switch( INS_BC( op ) ) | |
| 374 | 448 | { |
| 375 | case RT_BCF: | |
| 376 | sprintf( buffer, "bc1f $%08x", pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 449 | case BC_BCF: | |
| 450 | sprintf( buffer, "bc1f $%08x", relative_address( pc, op ) ); | |
| 377 | 451 | break; |
| 378 | case RT_BCT: | |
| 379 | sprintf( buffer, "bc1t $%08x", pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 452 | case BC_BCT: | |
| 453 | sprintf( buffer, "bc1t $%08x", relative_address( pc, op ) ); | |
| 380 | 454 | break; |
| 381 | 455 | } |
| 382 | 456 | break; |
| r2375 | r2376 | |
| 406 | 480 | sprintf( buffer, "ctc2 %s,%s", s_cpugenreg[ INS_RT( op ) ], s_cp2ctlreg[ INS_RD( op ) ] ); |
| 407 | 481 | break; |
| 408 | 482 | case RS_BC: |
| 409 | switch( INS_RT( op ) ) | |
| 483 | case RS_BC_ALT: | |
| 484 | switch( INS_BC( op ) ) | |
| 410 | 485 | { |
| 411 | case RT_BCF: | |
| 412 | sprintf( buffer, "bc2f $%08x", pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 486 | case BC_BCF: | |
| 487 | sprintf( buffer, "bc2f $%08x", relative_address( pc, op ) ); | |
| 413 | 488 | break; |
| 414 | case RT_BCT: | |
| 415 | sprintf( buffer, "bc2t $%08x", pc + 4 + ( MIPS_WORD_EXTEND( INS_IMMEDIATE( op ) ) << 2 ) ); | |
| 489 | case BC_BCT: | |
| 490 | sprintf( buffer, "bc2t $%08x", relative_address( pc, op ) ); | |
| 416 | 491 | break; |
| 417 | 492 | } |
| 418 | 493 | break; |
| r2375 | r2376 | |
| 567 | 642 | break; |
| 568 | 643 | } |
| 569 | 644 | break; |
| 645 | case OP_COP3: | |
| 646 | switch( INS_RS( op ) ) | |
| 647 | { | |
| 648 | case RS_MFC: | |
| 649 | sprintf( buffer, "mfc3 %s,%s", s_cpugenreg[ INS_RT( op ) ], s_cp3genreg[ INS_RD( op ) ] ); | |
| 650 | break; | |
| 651 | case RS_CFC: | |
| 652 | sprintf( buffer, "cfc3 %s,%s", s_cpugenreg[ INS_RT( op ) ], s_cp3ctlreg[ INS_RD( op ) ] ); | |
| 653 | break; | |
| 654 | case RS_MTC: | |
| 655 | sprintf( buffer, "mtc3 %s,%s", s_cpugenreg[ INS_RT( op ) ], s_cp3genreg[ INS_RD( op ) ] ); | |
| 656 | break; | |
| 657 | case RS_CTC: | |
| 658 | sprintf( buffer, "ctc3 %s,%s", s_cpugenreg[ INS_RT( op ) ], s_cp3ctlreg[ INS_RD( op ) ] ); | |
| 659 | break; | |
| 660 | case RS_BC: | |
| 661 | case RS_BC_ALT: | |
| 662 | switch( INS_BC( op ) ) | |
| 663 | { | |
| 664 | case BC_BCF: | |
| 665 | sprintf( buffer, "bc3f $%08x", relative_address( pc, op ) ); | |
| 666 | break; | |
| 667 | case BC_BCT: | |
| 668 | sprintf( buffer, "bc3t $%08x", relative_address( pc, op ) ); | |
| 669 | break; | |
| 670 | } | |
| 671 | break; | |
| 672 | default: | |
| 673 | switch( INS_CO( op ) ) | |
| 674 | { | |
| 675 | case 1: | |
| 676 | sprintf( buffer, "cop3 $%07x", INS_COFUN( op ) ); | |
| 677 | break; | |
| 678 | } | |
| 679 | break; | |
| 680 | } | |
| 681 | break; | |
| 570 | 682 | case OP_LB: |
| 571 | sprintf( buffer, "lb %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 683 | sprintf( buffer, "lb %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 572 | 684 | break; |
| 573 | 685 | case OP_LH: |
| 574 | sprintf( buffer, "lh %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 686 | sprintf( buffer, "lh %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 575 | 687 | break; |
| 576 | 688 | case OP_LWL: |
| 577 | sprintf( buffer, "lwl %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 689 | sprintf( buffer, "lwl %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 578 | 690 | break; |
| 579 | 691 | case OP_LW: |
| 580 | sprintf( buffer, "lw %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 692 | sprintf( buffer, "lw %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 581 | 693 | break; |
| 582 | 694 | case OP_LBU: |
| 583 | sprintf( buffer, "lbu %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 695 | sprintf( buffer, "lbu %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 584 | 696 | break; |
| 585 | 697 | case OP_LHU: |
| 586 | sprintf( buffer, "lhu %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 698 | sprintf( buffer, "lhu %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 587 | 699 | break; |
| 588 | 700 | case OP_LWR: |
| 589 | sprintf( buffer, "lwr %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 701 | sprintf( buffer, "lwr %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 590 | 702 | break; |
| 591 | 703 | case OP_SB: |
| 592 | sprintf( buffer, "sb %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 704 | sprintf( buffer, "sb %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 593 | 705 | break; |
| 594 | 706 | case OP_SH: |
| 595 | sprintf( buffer, "sh %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 707 | sprintf( buffer, "sh %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 596 | 708 | break; |
| 597 | 709 | case OP_SWL: |
| 598 | sprintf( buffer, "swl %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 710 | sprintf( buffer, "swl %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 599 | 711 | break; |
| 600 | 712 | case OP_SW: |
| 601 | sprintf( buffer, "sw %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 713 | sprintf( buffer, "sw %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 602 | 714 | break; |
| 603 | 715 | case OP_SWR: |
| 604 | sprintf( buffer, "swr %s,%s", s_cpugenreg[ INS_RT( op ) ], | |
| 716 | sprintf( buffer, "swr %s,%s", s_cpugenreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 605 | 717 | break; |
| 718 | case OP_LWC0: | |
| 719 | sprintf( buffer, "lwc0 %s,%s", s_cp0genreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 720 | break; | |
| 606 | 721 | case OP_LWC1: |
| 607 | sprintf( buffer, "lwc1 %s,%s", s_cp1genreg[ INS_RT( op ) ], | |
| 722 | sprintf( buffer, "lwc1 %s,%s", s_cp1genreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 608 | 723 | break; |
| 609 | 724 | case OP_LWC2: |
| 610 | sprintf( buffer, "lwc2 %s,%s", s_cp2genreg[ INS_RT( op ) ], | |
| 725 | sprintf( buffer, "lwc2 %s,%s", s_cp2genreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 611 | 726 | break; |
| 727 | case OP_LWC3: | |
| 728 | sprintf( buffer, "lwc3 %s,%s", s_cp2genreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 729 | break; | |
| 730 | case OP_SWC0: | |
| 731 | sprintf( buffer, "swc0 %s,%s", s_cp0genreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 732 | break; | |
| 612 | 733 | case OP_SWC1: |
| 613 | sprintf( buffer, "swc1 %s,%s", s_cp1genreg[ INS_RT( op ) ], | |
| 734 | sprintf( buffer, "swc1 %s,%s", s_cp1genreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 614 | 735 | break; |
| 615 | 736 | case OP_SWC2: |
| 616 | sprintf( buffer, "swc2 %s,%s", s_cp2genreg[ INS_RT( op ) ], | |
| 737 | sprintf( buffer, "swc2 %s,%s", s_cp2genreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 617 | 738 | break; |
| 739 | case OP_SWC3: | |
| 740 | sprintf( buffer, "swc3 %s,%s", s_cp2genreg[ INS_RT( op ) ], effective_address( pc, op ) ); | |
| 741 | break; | |
| 618 | 742 | } |
| 619 | return ( opram - oldopram ) | DASMFLAG_SUPPORTED; | |
| 743 | return ( opram - oldopram ) | flags | DASMFLAG_SUPPORTED; | |
| 620 | 744 | } |
| r2375 | r2376 | |
|---|---|---|
| 3 | 3 | |
| 4 | 4 | #include "cpuintrf.h" |
| 5 | 5 | |
| 6 | #define MIPS_DELAYR_PC ( 32 ) | |
| 7 | #define MIPS_DELAYR_NOTPC ( 33 ) | |
| 8 | ||
| 6 | 9 | enum |
| 7 | 10 | { |
| 8 | 11 | MIPS_PC = 1, |
| 9 | 12 | MIPS_DELAYV, MIPS_DELAYR, |
| 10 | 13 | MIPS_HI, MIPS_LO, |
| 14 | MIPS_BIU, | |
| 11 | 15 | MIPS_R0, MIPS_R1, |
| 12 | 16 | MIPS_R2, MIPS_R3, |
| 13 | 17 | MIPS_R4, MIPS_R5, |
| r2375 | r2376 | |
| 32 | 36 | MIPS_CP0R10, MIPS_CP0R11, |
| 33 | 37 | MIPS_CP0R12, MIPS_CP0R13, |
| 34 | 38 | MIPS_CP0R14, MIPS_CP0R15, |
| 35 | MIPS_CP0R16, MIPS_CP0R17, | |
| 36 | MIPS_CP0R18, MIPS_CP0R19, | |
| 37 | MIPS_CP0R20, MIPS_CP0R21, | |
| 38 | MIPS_CP0R22, MIPS_CP0R23, | |
| 39 | MIPS_CP0R24, MIPS_CP0R25, | |
| 40 | MIPS_CP0R26, MIPS_CP0R27, | |
| 41 | MIPS_CP0R28, MIPS_CP0R29, | |
| 42 | MIPS_CP0R30, MIPS_CP0R31, | |
| 43 | 39 | MIPS_CP2DR0, MIPS_CP2DR1, |
| 44 | 40 | MIPS_CP2DR2, MIPS_CP2DR3, |
| 45 | 41 | MIPS_CP2DR4, MIPS_CP2DR5, |
| r2375 | r2376 | |
| 97 | 93 | #define INS_CODE( op ) ( ( op >> 6 ) & 0xfffff ) |
| 98 | 94 | #define INS_CO( op ) ( ( op >> 25 ) & 1 ) |
| 99 | 95 | #define INS_COFUN( op ) ( op & 0x1ffffff ) |
| 100 | #define INS_CF( op ) ( op & 63 ) | |
| 96 | #define INS_CF( op ) ( op & 31 ) | |
| 97 | #define INS_BC( op ) ( ( op >> 16 ) & 1 ) | |
| 98 | #define INS_RT_REGIMM( op ) ( ( op >> 16 ) & 1 ) | |
| 101 | 99 | |
| 102 | 100 | #define GTE_OP( op ) ( ( op >> 20 ) & 31 ) |
| 103 | 101 | #define GTE_SF( op ) ( ( op >> 19 ) & 1 ) |
| r2375 | r2376 | |
| 128 | 126 | #define OP_COP0 ( 16 ) |
| 129 | 127 | #define OP_COP1 ( 17 ) |
| 130 | 128 | #define OP_COP2 ( 18 ) |
| 129 | #define OP_COP3 ( 19 ) | |
| 131 | 130 | #define OP_LB ( 32 ) |
| 132 | 131 | #define OP_LH ( 33 ) |
| 133 | 132 | #define OP_LWL ( 34 ) |
| r2375 | r2376 | |
| 140 | 139 | #define OP_SWL ( 42 ) |
| 141 | 140 | #define OP_SW ( 43 ) |
| 142 | 141 | #define OP_SWR ( 46 ) |
| 142 | #define OP_LWC0 ( 48 ) | |
| 143 | 143 | #define OP_LWC1 ( 49 ) |
| 144 | 144 | #define OP_LWC2 ( 50 ) |
| 145 | #define OP_LWC3 ( 51 ) | |
| 146 | #define OP_SWC0 ( 56 ) | |
| 145 | 147 | #define OP_SWC1 ( 57 ) |
| 146 | 148 | #define OP_SWC2 ( 58 ) |
| 149 | #define OP_SWC3 ( 59 ) | |
| 147 | 150 | |
| 148 | 151 | /* OP_SPECIAL */ |
| 149 | 152 | #define FUNCT_SLL ( 0 ) |
| r2375 | r2376 | |
| 187 | 190 | #define RS_MTC ( 4 ) |
| 188 | 191 | #define RS_CTC ( 6 ) |
| 189 | 192 | #define RS_BC ( 8 ) |
| 193 | #define RS_BC_ALT ( 12 ) | |
| 190 | 194 | |
| 191 | /* RS_BC */ | |
| 192 | #define RT_BCF ( 0 ) | |
| 193 | #define RT_BCT ( 1 ) | |
| 195 | /* BC_BC */ | |
| 196 | #define BC_BCF ( 0 ) | |
| 197 | #define BC_BCT ( 1 ) | |
| 194 | 198 | |
| 195 | 199 | /* OP_COP0 */ |
| 200 | #define CF_TLBR ( 1 ) | |
| 201 | #define CF_TLBWI ( 2 ) | |
| 202 | #define CF_TLBWR ( 6 ) | |
| 203 | #define CF_TLBP ( 8 ) | |
| 196 | 204 | #define CF_RFE ( 16 ) |
| 197 | 205 | |
| 198 | 206 | #ifdef ENABLE_DEBUGGER |
| r2375 | r2376 | |
|---|---|---|
| 29 | 29 | static void tlb_write_common(mips3_state *mips, int index); |
| 30 | 30 | static void tlb_entry_log_half(mips3_tlb_entry *tlbent, int index, int which); |
| 31 | 31 | |
| 32 | static UINT64 program_read_qword_32be(offs_t offset); | |
| 33 | 32 | static UINT64 program_read_qword_masked_32be(offs_t offset, UINT64 mem_mask); |
| 34 | ||
| 35 | static void program_write_qword_32be(offs_t offset, UINT64 data); | |
| 36 | 33 | static void program_write_qword_masked_32be(offs_t offset, UINT64 data, UINT64 mem_mask); |
| 37 | ||
| 38 | static UINT64 program_read_qword_32le(offs_t offset); | |
| 39 | 34 | static UINT64 program_read_qword_masked_32le(offs_t offset, UINT64 mem_mask); |
| 40 | ||
| 41 | static void program_write_qword_32le(offs_t offset, UINT64 data); | |
| 42 | 35 | static void program_write_qword_masked_32le(offs_t offset, UINT64 data, UINT64 mem_mask); |
| 43 | 36 | |
| 44 | 37 | |
| r2375 | r2376 | |
| 52 | 45 | program_read_byte_32be, |
| 53 | 46 | program_read_word_32be, |
| 54 | 47 | program_read_dword_32be, |
| 55 | program_read_masked_32be, | |
| 48 | program_read_dword_masked_32be, | |
| 56 | 49 | program_read_qword_32be, |
| 57 | 50 | program_read_qword_masked_32be, |
| 58 | 51 | |
| 59 | 52 | program_write_byte_32be, |
| 60 | 53 | program_write_word_32be, |
| 61 | 54 | program_write_dword_32be, |
| 62 | program_write_masked_32be, | |
| 55 | program_write_dword_masked_32be, | |
| 63 | 56 | program_write_qword_32be, |
| 64 | 57 | program_write_qword_masked_32be |
| 65 | 58 | }; |
| r2375 | r2376 | |
| 69 | 62 | program_read_byte_32le, |
| 70 | 63 | program_read_word_32le, |
| 71 | 64 | program_read_dword_32le, |
| 72 | program_read_masked_32le, | |
| 65 | program_read_dword_masked_32le, | |
| 73 | 66 | program_read_qword_32le, |
| 74 | 67 | program_read_qword_masked_32le, |
| 75 | 68 | |
| 76 | 69 | program_write_byte_32le, |
| 77 | 70 | program_write_word_32le, |
| 78 | 71 | program_write_dword_32le, |
| 79 | program_write_masked_32le, | |
| 72 | program_write_dword_masked_32le, | |
| 80 | 73 | program_write_qword_32le, |
| 81 | 74 | program_write_qword_masked_32le |
| 82 | 75 | }; |
| r2375 | r2376 | |
| 875 | 868 | ***************************************************************************/ |
| 876 | 869 | |
| 877 | 870 | /*------------------------------------------------- |
| 878 | program_read_qword_32be - read a 64-bit | |
| 879 | big-endian value | |
| 880 | -------------------------------------------------*/ | |
| 881 | ||
| 882 | static UINT64 program_read_qword_32be(offs_t offset) | |
| 883 | { | |
| 884 | UINT64 result = (UINT64)program_read_dword_32be(offset) << 32; | |
| 885 | return result | program_read_dword_32be(offset + 4); | |
| 886 | } | |
| 887 | ||
| 888 | ||
| 889 | /*------------------------------------------------- | |
| 890 | 871 | program_read_qword_masked_32be - read a 64-bit |
| 891 | 872 | big-endian value with explicit masking |
| 892 | 873 | -------------------------------------------------*/ |
| r2375 | r2376 | |
| 895 | 876 | { |
| 896 | 877 | UINT64 result = 0; |
| 897 | 878 | if (ACCESSING_BITS_32_63) |
| 898 | result |= (UINT64)program_read_masked_32be(offset, mem_mask >> 32) << 32; | |
| 879 | result |= (UINT64)program_read_dword_masked_32be(offset, mem_mask >> 32) << 32; | |
| 899 | 880 | if (ACCESSING_BITS_0_31) |
| 900 | result |= program_read_masked_32be(offset + 4, mem_mask); | |
| 881 | result |= program_read_dword_masked_32be(offset + 4, mem_mask); | |
| 901 | 882 | return result; |
| 902 | 883 | } |
| 903 | 884 | |
| 904 | 885 | |
| 905 | 886 | /*------------------------------------------------- |
| 906 | program_read_qword_32le - read a 64-bit | |
| 907 | little-endian value | |
| 908 | -------------------------------------------------*/ | |
| 909 | ||
| 910 | static UINT64 program_read_qword_32le(offs_t offset) | |
| 911 | { | |
| 912 | UINT64 result = program_read_dword_32le(offset); | |
| 913 | return result | ((UINT64)program_read_dword_32le(offset + 4) << 32); | |
| 914 | } | |
| 915 | ||
| 916 | ||
| 917 | /*------------------------------------------------- | |
| 918 | 887 | program_read_qword_masked_32le - read a 64-bit |
| 919 | 888 | little-endian value with explicit masking |
| 920 | 889 | -------------------------------------------------*/ |
| r2375 | r2376 | |
| 923 | 892 | { |
| 924 | 893 | UINT64 result = 0; |
| 925 | 894 | if (ACCESSING_BITS_0_31) |
| 926 | result |= program_read_masked_32le(offset, mem_mask); | |
| 895 | result |= program_read_dword_masked_32le(offset, mem_mask); | |
| 927 | 896 | if (ACCESSING_BITS_32_63) |
| 928 | result |= (UINT64)program_read_masked_32le(offset + 4, mem_mask >> 32) << 32; | |
| 897 | result |= (UINT64)program_read_dword_masked_32le(offset + 4, mem_mask >> 32) << 32; | |
| 929 | 898 | return result; |
| 930 | 899 | } |
| 931 | 900 | |
| 932 | 901 | |
| 933 | 902 | /*------------------------------------------------- |
| 934 | program_write_qword_32be - write a 64-bit | |
| 935 | big-endian value | |
| 936 | -------------------------------------------------*/ | |
| 937 | ||
| 938 | static void program_write_qword_32be(offs_t offset, UINT64 data) | |
| 939 | { | |
| 940 | program_write_dword_32be(offset, data >> 32); | |
| 941 | program_write_dword_32be(offset + 4, data); | |
| 942 | } | |
| 943 | ||
| 944 | ||
| 945 | /*------------------------------------------------- | |
| 946 | 903 | program_write_qword_masked_32be - write a |
| 947 | 904 | 64-bit big-endian value with explicit masking |
| 948 | 905 | -------------------------------------------------*/ |
| r2375 | r2376 | |
| 950 | 907 | static void program_write_qword_masked_32be(offs_t offset, UINT64 data, UINT64 mem_mask) |
| 951 | 908 | { |
| 952 | 909 | if (ACCESSING_BITS_32_63) |
| 953 | program_write_masked_32be(offset, data >> 32, mem_mask >> 32); | |
| 910 | program_write_dword_masked_32be(offset, data >> 32, mem_mask >> 32); | |
| 954 | 911 | if (ACCESSING_BITS_0_31) |
| 955 | program_write_masked_32be(offset + 4, data, mem_mask); | |
| 912 | program_write_dword_masked_32be(offset + 4, data, mem_mask); | |
| 956 | 913 | } |
| 957 | 914 | |
| 958 | 915 | |
| 959 | 916 | /*------------------------------------------------- |
| 960 | program_write_qword_32le - write a 64-bit | |
| 961 | little-endian value | |
| 962 | -------------------------------------------------*/ | |
| 963 | ||
| 964 | static void program_write_qword_32le(offs_t offset, UINT64 data) | |
| 965 | { | |
| 966 | program_write_dword_32le(offset, data); | |
| 967 | program_write_dword_32le(offset + 4, data >> 32); | |
| 968 | } | |
| 969 | ||
| 970 | ||
| 971 | /*------------------------------------------------- | |
| 972 | 917 | program_write_qword_masked_32le - write a |
| 973 | 918 | 64-bit little-endian value with explicit masking |
| 974 | 919 | -------------------------------------------------*/ |
| r2375 | r2376 | |
| 976 | 921 | static void program_write_qword_masked_32le(offs_t offset, UINT64 data, UINT64 mem_mask) |
| 977 | 922 | { |
| 978 | 923 | if (ACCESSING_BITS_0_31) |
| 979 | program_write_masked_32le(offset, data, mem_mask); | |
| 924 | program_write_dword_masked_32le(offset, data, mem_mask); | |
| 980 | 925 | if (ACCESSING_BITS_32_63) |
| 981 | program_write_masked_32le(offset + 4, data >> 32, mem_mask >> 32); | |
| 926 | program_write_dword_masked_32le(offset + 4, data >> 32, mem_mask >> 32); | |
| 982 | 927 | } |
| r2375 | r2376 | |
|---|---|---|
| 57 | 57 | static int tms7000_div_by_16_trigger; |
| 58 | 58 | static int tms7000_cycles_per_INT2; |
| 59 | 59 | |
| 60 | #define RM(Addr) ((unsigned)program_read_byte_8(Addr)) | |
| 61 | #define WM(Addr,Value) (program_write_byte_8(Addr,Value)) | |
| 60 | #define RM(Addr) ((unsigned)program_read_byte_8be(Addr)) | |
| 61 | #define WM(Addr,Value) (program_write_byte_8be(Addr,Value)) | |
| 62 | 62 | |
| 63 | 63 | INLINE UINT16 RM16( UINT32 mAddr ) /* Read memory (16-bit) */ |
| 64 | 64 | { |
| r2375 | r2376 | |
| 619 | 619 | break; |
| 620 | 620 | |
| 621 | 621 | case 0x06: /* Port B write */ |
| 622 | io_write_byte_8( TMS7000_PORTB, data ); | |
| 622 | io_write_byte_8be( TMS7000_PORTB, data ); | |
| 623 | 623 | tms7000.pf[ 0x06 ] = data; |
| 624 | 624 | break; |
| 625 | 625 | |
| 626 | 626 | case 0x08: /* Port C write */ |
| 627 | 627 | temp1 = data & tms7000.pf[ 0x09 ]; /* Mask off input bits */ |
| 628 | io_write_byte_8( TMS7000_PORTC, temp1 ); | |
| 628 | io_write_byte_8be( TMS7000_PORTC, temp1 ); | |
| 629 | 629 | tms7000.pf[ 0x08 ] = temp1; |
| 630 | 630 | break; |
| 631 | 631 | |
| 632 | 632 | case 0x0a: /* Port D write */ |
| 633 | 633 | temp1 = data & tms7000.pf[ 0x0b ]; /* Mask off input bits */ |
| 634 | io_write_byte_8( TMS7000_PORTD, temp1 ); | |
| 634 | io_write_byte_8be( TMS7000_PORTD, temp1 ); | |
| 635 | 635 | tms7000.pf[ 0x0a ] = temp1; |
| 636 | 636 | break; |
| 637 | 637 | |
| r2375 | r2376 | |
| 666 | 666 | break; |
| 667 | 667 | |
| 668 | 668 | case 0x04: /* Port A read */ |
| 669 | result = io_read_byte_8( TMS7000_PORTA ); | |
| 669 | result = io_read_byte_8be( TMS7000_PORTA ); | |
| 670 | 670 | break; |
| 671 | 671 | |
| 672 | 672 | |
| r2375 | r2376 | |
| 677 | 677 | |
| 678 | 678 | case 0x08: /* Port C read */ |
| 679 | 679 | temp1 = tms7000.pf[ 0x08 ] & tms7000.pf[ 0x09 ]; /* Get previous output bits */ |
| 680 | temp2 = io_read_byte_8( TMS7000_PORTC ); /* Read port */ | |
| 680 | temp2 = io_read_byte_8be( TMS7000_PORTC ); /* Read port */ | |
| 681 | 681 | temp3 = temp2 & (~tms7000.pf[ 0x09 ]); /* Mask off output bits */ |
| 682 | 682 | result = temp1 | temp3; /* OR together */ |
| 683 | 683 | break; |
| 684 | 684 | |
| 685 | 685 | case 0x0a: /* Port D read */ |
| 686 | 686 | temp1 = tms7000.pf[ 0x0a ] & tms7000.pf[ 0x0b ]; /* Get previous output bits */ |
| 687 | temp2 = io_read_byte_8( TMS7000_PORTD ); /* Read port */ | |
| 687 | temp2 = io_read_byte_8be( TMS7000_PORTD ); /* Read port */ | |
| 688 | 688 | temp3 = temp2 & (~tms7000.pf[ 0x0b ]); /* Mask off output bits */ |
| 689 | 689 | result = temp1 | temp3; /* OR together */ |
| 690 | 690 | break; |
| r2375 | r2376 | |
|---|---|---|
| 136 | 136 | * the memory location addressed by DC0; then all devices increment |
| 137 | 137 | * DC0. |
| 138 | 138 | */ |
| 139 | f8.dbus = program_read_byte_8(f8.dc0); | |
| 139 | f8.dbus = program_read_byte_8be(f8.dc0); | |
| 140 | 140 | f8.dc0 += 1; |
| 141 | 141 | f8_icount -= cL; |
| 142 | 142 | } |
| r2375 | r2376 | |
| 167 | 167 | * Store the data bus contents into the memory location pointed |
| 168 | 168 | * to by DC0; increment DC0. |
| 169 | 169 | */ |
| 170 | program_write_byte_8(f8.dc0, f8.dbus); | |
| 170 | program_write_byte_8be(f8.dc0, f8.dbus); | |
| 171 | 171 | f8.dc0 += 1; |
| 172 | 172 | f8_icount -= cL; |
| 173 | 173 | } |
| r2375 | r2376 | |
| 403 | 403 | * register was addressed; the device containing the addressed port |
| 404 | 404 | * must place the contents of the data bus into the address port. |
| 405 | 405 | */ |
| 406 | io_write_byte_8(f8.io, f8.dbus); | |
| 406 | io_write_byte_8be(f8.io, f8.dbus); | |
| 407 | 407 | f8_icount -= cL; |
| 408 | 408 | } |
| 409 | 409 | |
| r2375 | r2376 | |
| 416 | 416 | * contents of timer and interrupt control registers cannot be read |
| 417 | 417 | * back onto the data bus). |
| 418 | 418 | */ |
| 419 | f8.dbus = io_read_byte_8(f8.io); | |
| 419 | f8.dbus = io_read_byte_8be(f8.io); | |
| 420 | 420 | f8_icount -= cL; |
| 421 | 421 | } |
| 422 | 422 | |
| r2375 | r2376 | |
| 1258 | 1258 | { |
| 1259 | 1259 | ROMC_1C(cS); |
| 1260 | 1260 | CLR_OZCS; |
| 1261 | f8.a = io_read_byte_8(n); | |
| 1261 | f8.a = io_read_byte_8be(n); | |
| 1262 | 1262 | SET_SZ(f8.a); |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| r2375 | r2376 | |
| 1283 | 1283 | static void f8_outs_0(int n) |
| 1284 | 1284 | { |
| 1285 | 1285 | ROMC_1C(cS); |
| 1286 | io_write_byte_8(n, f8.a); | |
| 1286 | io_write_byte_8be(n, f8.a); | |
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | 1289 | /*************************************************** |
| r2375 | r2376 | |
|---|---|---|
| 565 | 565 | /*************************************************************** |
| 566 | 566 | * Input a byte from given I/O port |
| 567 | 567 | ***************************************************************/ |
| 568 | #define IN(port) ((UINT8)io_read_byte_8(port)) | |
| 568 | #define IN(port) ((UINT8)io_read_byte_8le(port)) | |
| 569 | 569 | |
| 570 | 570 | /*************************************************************** |
| 571 | 571 | * Output a byte to given I/O port |
| 572 | 572 | ***************************************************************/ |
| 573 | #define OUT(port,value) io_write_byte_8(port,value) | |
| 573 | #define OUT(port,value) io_write_byte_8le(port,value) | |
| 574 | 574 | |
| 575 | 575 | /*************************************************************** |
| 576 | 576 | * Read a byte from given memory location |
| 577 | 577 | ***************************************************************/ |
| 578 | #define RM(addr) (UINT8)program_read_byte_8(addr) | |
| 578 | #define RM(addr) (UINT8)program_read_byte_8le(addr) | |
| 579 | 579 | |
| 580 | 580 | /*************************************************************** |
| 581 | 581 | * Read a word from given memory location |
| r2375 | r2376 | |
| 589 | 589 | /*************************************************************** |
| 590 | 590 | * Write a byte to given memory location |
| 591 | 591 | ***************************************************************/ |
| 592 | #define WM(addr,value) program_write_byte_8(addr,value) | |
| 592 | #define WM(addr,value) program_write_byte_8le(addr,value) | |
| 593 | 593 | |
| 594 | 594 | /*************************************************************** |
| 595 | 595 | * Write a word to given memory location |
| r2375 | r2376 | |
|---|---|---|
| 777 | 777 | int val; |
| 778 | 778 | |
| 779 | 779 | TMS99XX_ICOUNT -= 2; |
| 780 | val = program_read_byte_8(addr); | |
| 781 | return (val << 8) | program_read_byte_8(addr+1); | |
| 780 | val = program_read_byte_8be(addr); | |
| 781 | return (val << 8) | program_read_byte_8be(addr+1); | |
| 782 | 782 | } |
| 783 | #define writeword(addr,data) { TMS99XX_ICOUNT -= 2; program_write_byte_8((addr), (data) >> 8); program_write_byte_8((addr) + 1, (data) & 0xff); } | |
| 783 | #define writeword(addr,data) { TMS99XX_ICOUNT -= 2; program_write_byte_8be((addr), (data) >> 8); program_write_byte_8be((addr) + 1, (data) & 0xff); } | |
| 784 | 784 | |
| 785 | 785 | #if 0 |
| 786 | #define readbyte(addr) (TMS99XX_ICOUNT -= 2, program_read_byte_8(addr)) | |
| 787 | #define writebyte(addr,data) { TMS99XX_ICOUNT -= 2; program_write_byte_8((addr),(data)); } | |
| 786 | #define readbyte(addr) (TMS99XX_ICOUNT -= 2, program_read_byte_8be(addr)) | |
| 787 | #define writebyte(addr,data) { TMS99XX_ICOUNT -= 2; program_write_byte_8be((addr),(data)); } | |
| 788 | 788 | #else |
| 789 | 789 | /*This is how it really works*/ |
| 790 | 790 | /*Note that every writebyte must match a readbyte (which is indeed the case)*/ |
| r2375 | r2376 | |
| 795 | 795 | TMS99XX_ICOUNT -= 2; |
| 796 | 796 | if (addr & 1) |
| 797 | 797 | { |
| 798 | extra_byte = program_read_byte_8(addr-1); | |
| 799 | return program_read_byte_8(addr); | |
| 798 | extra_byte = program_read_byte_8be(addr-1); | |
| 799 | return program_read_byte_8be(addr); | |
| 800 | 800 | } |
| 801 | 801 | else |
| 802 | 802 | { |
| 803 | int val = program_read_byte_8(addr); | |
| 804 | extra_byte = program_read_byte_8(addr+1); | |
| 803 | int val = program_read_byte_8be(addr); | |
| 804 | extra_byte = program_read_byte_8be(addr+1); | |
| 805 | 805 | return val; |
| 806 | 806 | } |
| 807 | 807 | } |
| r2375 | r2376 | |
| 810 | 810 | TMS99XX_ICOUNT -= 2; |
| 811 | 811 | if (addr & 1) |
| 812 | 812 | { |
| 813 | program_write_byte_8(addr-1, extra_byte); | |
| 814 | program_write_byte_8(addr, data); | |
| 813 | program_write_byte_8be(addr-1, extra_byte); | |
| 814 | program_write_byte_8be(addr, data); | |
| 815 | 815 | } |
| 816 | 816 | else |
| 817 | 817 | { |
| 818 | program_write_byte_8(addr, data); | |
| 819 | program_write_byte_8(addr+1, extra_byte); | |
| 818 | program_write_byte_8be(addr, data); | |
| 819 | program_write_byte_8be(addr+1, extra_byte); | |
| 820 | 820 | } |
| 821 | 821 | } |
| 822 | 822 | #endif |
| r2375 | r2376 | |
| 836 | 836 | else |
| 837 | 837 | { |
| 838 | 838 | TMS99XX_ICOUNT -= 2; |
| 839 | return (program_read_byte_8(addr) << 8) + program_read_byte_8(addr + 1); | |
| 839 | return (program_read_byte_8be(addr) << 8) + program_read_byte_8be(addr + 1); | |
| 840 | 840 | } |
| 841 | 841 | } |
| 842 | 842 | static void writeword(int addr, int data) |
| r2375 | r2376 | |
| 847 | 847 | else if (!(addr < 0x2000)) |
| 848 | 848 | { |
| 849 | 849 | TMS99XX_ICOUNT -= 2; |
| 850 | program_write_byte_8(addr, data >> 8); | |
| 851 | program_write_byte_8(addr + 1, data & 0xff); | |
| 850 | program_write_byte_8be(addr, data >> 8); | |
| 851 | program_write_byte_8be(addr + 1, data & 0xff); | |
| 852 | 852 | } |
| 853 | 853 | } |
| 854 | 854 | |
| r2375 | r2376 | |
| 865 | 865 | TMS99XX_ICOUNT -= 2; |
| 866 | 866 | if (addr & 1) |
| 867 | 867 | { |
| 868 | extra_byte = program_read_byte_8(addr-1); | |
| 869 | return program_read_byte_8(addr); | |
| 868 | extra_byte = program_read_byte_8be(addr-1); | |
| 869 | return program_read_byte_8be(addr); | |
| 870 | 870 | } |
| 871 | 871 | else |
| 872 | 872 | { |
| 873 | int val = program_read_byte_8(addr); | |
| 874 | extra_byte = program_read_byte_8(addr+1); | |
| 873 | int val = program_read_byte_8be(addr); | |
| 874 | extra_byte = program_read_byte_8be(addr+1); | |
| 875 | 875 | return val; |
| 876 | 876 | } |
| 877 | 877 | } |
| r2375 | r2376 | |
| 886 | 886 | TMS99XX_ICOUNT -= 2; |
| 887 | 887 | if (addr & 1) |
| 888 | 888 | { |
| 889 | program_write_byte_8(addr-1, extra_byte); | |
| 890 | program_write_byte_8(addr, data); | |
| 889 | program_write_byte_8be(addr-1, extra_byte); | |
| 890 | program_write_byte_8be(addr, data); | |
| 891 | 891 | } |
| 892 | 892 | else |
| 893 | 893 | { |
| 894 | program_write_byte_8(addr, data); | |
| 895 | program_write_byte_8(addr+1, extra_byte); | |
| 894 | program_write_byte_8be(addr, data); | |
| 895 | program_write_byte_8be(addr+1, extra_byte); | |
| 896 | 896 | } |
| 897 | 897 | } |
| 898 | 898 | } |
| r2375 | r2376 | |
| 909 | 909 | { |
| 910 | 910 | int reply; |
| 911 | 911 | TMS99XX_ICOUNT -= I.memory_wait_states_word; |
| 912 | reply = program_read_byte_8(addr); | |
| 913 | return (reply << 8) | program_read_byte_8(addr + 1); | |
| 912 | reply = program_read_byte_8be(addr); | |
| 913 | return (reply << 8) | program_read_byte_8be(addr + 1); | |
| 914 | 914 | } |
| 915 | 915 | else if (addr < 0xf0fc) |
| 916 | 916 | { |
| r2375 | r2376 | |
| 920 | 920 | { |
| 921 | 921 | int reply; |
| 922 | 922 | TMS99XX_ICOUNT -= I.memory_wait_states_word; |
| 923 | reply = program_read_byte_8(addr); | |
| 924 | return (reply << 8) | program_read_byte_8(addr + 1); | |
| 923 | reply = program_read_byte_8be(addr); | |
| 924 | return (reply << 8) | program_read_byte_8be(addr + 1); | |
| 925 | 925 | } |
| 926 | 926 | else if (addr < 0xfffc) |
| 927 | 927 | { |
| r2375 | r2376 | |
| 944 | 944 | if ((addr < 0xf000) || (I.is_mp9537)) |
| 945 | 945 | { |
| 946 | 946 | TMS99XX_ICOUNT -= I.memory_wait_states_word; |
| 947 | program_write_byte_8(addr, data >> 8); | |
| 948 | program_write_byte_8(addr + 1, data & 0xff); | |
| 947 | program_write_byte_8be(addr, data >> 8); | |
| 948 | program_write_byte_8be(addr + 1, data & 0xff); | |
| 949 | 949 | } |
| 950 | 950 | else if (addr < 0xf0fc) |
| 951 | 951 | { |
| r2375 | r2376 | |
| 954 | 954 | else if (addr < 0xfffa) |
| 955 | 955 | { |
| 956 | 956 | TMS99XX_ICOUNT -= I.memory_wait_states_word; |
| 957 | program_write_byte_8(addr, data >> 8); | |
| 958 | program_write_byte_8(addr + 1, data & 0xff); | |
| 957 | program_write_byte_8be(addr, data >> 8); | |
| 958 | program_write_byte_8be(addr + 1, data & 0xff); | |
| 959 | 959 | } |
| 960 | 960 | else if (addr < 0xfffc) |
| 961 | 961 | { |
| r2375 | r2376 | |
| 974 | 974 | if ((addr < 0xf000) || (I.is_mp9537)) |
| 975 | 975 | { |
| 976 | 976 | TMS99XX_ICOUNT -= I.memory_wait_states_byte; |
| 977 | return program_read_byte_8(addr); | |
| 977 | return program_read_byte_8be(addr); | |
| 978 | 978 | } |
| 979 | 979 | else if (addr < 0xf0fc) |
| 980 | 980 | { |
| r2375 | r2376 | |
| 983 | 983 | else if (addr < 0xfffa) |
| 984 | 984 | { |
| 985 | 985 | TMS99XX_ICOUNT -= I.memory_wait_states_byte; |
| 986 | return program_read_byte_8(addr); | |
| 986 | return program_read_byte_8be(addr); | |
| 987 | 987 | } |
| 988 | 988 | else if (addr < 0xfffc) |
| 989 | 989 | { |
| r2375 | r2376 | |
| 1013 | 1013 | if ((addr < 0xf000) || (I.is_mp9537)) |
| 1014 | 1014 | { |
| 1015 | 1015 | TMS99XX_ICOUNT -= I.memory_wait_states_byte; |
| 1016 | program_write_byte_8(addr, data); | |
| 1016 | program_write_byte_8be(addr, data); | |
| 1017 | 1017 | } |
| 1018 | 1018 | else if (addr < 0xf0fc) |
| 1019 | 1019 | { |
| r2375 | r2376 | |
| 1022 | 1022 | else if (addr < 0xfffa) |
| 1023 | 1023 | { |
| 1024 | 1024 | TMS99XX_ICOUNT -= I.memory_wait_states_byte; |
| 1025 | program_write_byte_8(addr, data); | |
| 1025 | program_write_byte_8be(addr, data); | |
| 1026 | 1026 | } |
| 1027 | 1027 | else if (addr < 0xfffc) |
| 1028 | 1028 | { |
| r2375 | r2376 | |
| 2049 | 2049 | CRU_PRIVILEGE_VIOLATION = -1 |
| 2050 | 2050 | } cru_error_code; |
| 2051 | 2051 | |
| 2052 | #define WRITEPORT(port, data) io_write_byte_8(port, data) | |
| 2052 | #define WRITEPORT(port, data) io_write_byte_8be(port, data) | |
| 2053 | 2053 | |
| 2054 | 2054 | #if (TMS99XX_MODEL == TMS9940_ID) || (TMS99XX_MODEL == TMS9985_ID) |
| 2055 | 2055 | /* on tms9940, we have to handle internal CRU ports */ |
| r2375 | r2376 | |
| 2268 | 2268 | read at the same address. This seems to be impossible to emulate efficiently, so, if you need |
| 2269 | 2269 | to emulate this, you're in trouble. |
| 2270 | 2270 | */ |
| 2271 | #define READPORT(port) io_read_byte_8(port) | |
| 2271 | #define READPORT(port) io_read_byte_8be(port) | |
| 2272 | 2272 | |
| 2273 | 2273 | |
| 2274 | 2274 | #if (TMS99XX_MODEL == TMS9940_ID) || (TMS99XX_MODEL == TMS9985_ID) |
| r2375 | r2376 | |
|---|---|---|
| 47 | 47 | */ |
| 48 | 48 | |
| 49 | 49 | #define PIC16C5x_T0 0x10 |
| 50 | #define PIC16C5x_T0_In (io_read_byte_8(PIC16C5x_T0)) | |
| 50 | #define PIC16C5x_T0_In (io_read_byte_8le(PIC16C5x_T0)) | |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | /**************************************************************************** |
| 54 | 54 | * Input a word from given I/O port |
| 55 | 55 | */ |
| 56 | 56 | |
| 57 | #define PIC16C5x_In(Port) ((UINT8)io_read_byte_8((Port))) | |
| 57 | #define PIC16C5x_In(Port) ((UINT8)io_read_byte_8le((Port))) | |
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | /**************************************************************************** |
| 61 | 61 | * Output a word to given I/O port |
| 62 | 62 | */ |
| 63 | 63 | |
| 64 | #define PIC16C5x_Out(Port,Value) (io_write_byte_8((Port),Value)) | |
| 64 | #define PIC16C5x_Out(Port,Value) (io_write_byte_8le((Port),Value)) | |
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | |
| r2375 | r2376 | |
| 69 | 69 | * Read a word from given RAM memory location |
| 70 | 70 | */ |
| 71 | 71 | |
| 72 | #define PIC16C5x_RAM_RDMEM(A) ((UINT8)data_read_byte_8(A)) | |
| 72 | #define PIC16C5x_RAM_RDMEM(A) ((UINT8)data_read_byte_8le(A)) | |
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | /**************************************************************************** |
| 76 | 76 | * Write a word to given RAM memory location |
| 77 | 77 | */ |
| 78 | 78 | |
| 79 | #define PIC16C5x_RAM_WRMEM(A,V) (data_write_byte_8(A,V)) | |
| 79 | #define PIC16C5x_RAM_WRMEM(A,V) (data_write_byte_8le(A,V)) | |
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 |
| r2375 | r2376 | |
|---|---|---|
| 127 | 127 | ***************************************************************/ |
| 128 | 128 | INLINE UINT8 RDMEM(offs_t addr) { |
| 129 | 129 | CHECK_VDC_VCE_PENALTY(addr); |
| 130 | return program_read_byte_8(TRANSLATED(addr)); | |
| 130 | return program_read_byte_8le(TRANSLATED(addr)); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /*************************************************************** |
| r2375 | r2376 | |
| 135 | 135 | ***************************************************************/ |
| 136 | 136 | INLINE void WRMEM(offs_t addr, UINT8 data) { |
| 137 | 137 | CHECK_VDC_VCE_PENALTY(addr); |
| 138 | program_write_byte_8(TRANSLATED(addr),data); | |
| 138 | program_write_byte_8le(TRANSLATED(addr),data); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /*************************************************************** |
| 142 | 142 | * RDMEMZ read memory - zero page |
| 143 | 143 | ***************************************************************/ |
| 144 | 144 | #define RDMEMZ(addr) \ |
| 145 | program_read_byte_8( (h6280.mmr[1] << 13) | ((addr)&0x1fff)); | |
| 145 | program_read_byte_8le( (h6280.mmr[1] << 13) | ((addr)&0x1fff)); | |
| 146 | 146 | |
| 147 | 147 | /*************************************************************** |
| 148 | 148 | * WRMEMZ write memory - zero page |
| 149 | 149 | ***************************************************************/ |
| 150 | 150 | #define WRMEMZ(addr,data) \ |
| 151 | program_write_byte_8( (h6280.mmr[1] << 13) | ((addr)&0x1fff),data); | |
| 151 | program_write_byte_8le( (h6280.mmr[1] << 13) | ((addr)&0x1fff),data); | |
| 152 | 152 | |
| 153 | 153 | /*************************************************************** |
| 154 | 154 | * RDMEMW read word from memory |
| 155 | 155 | ***************************************************************/ |
| 156 | 156 | #define RDMEMW(addr) \ |
| 157 | program_read_byte_8(TRANSLATED(addr)) \ | |
| 158 | | ( program_read_byte_8(TRANSLATED(addr+1)) << 8 ) | |
| 157 | program_read_byte_8le(TRANSLATED(addr)) \ | |
| 158 | | ( program_read_byte_8le(TRANSLATED(addr+1)) << 8 ) | |
| 159 | 159 | |
| 160 | 160 | /*************************************************************** |
| 161 | 161 | * RDZPWORD read a word from a zero page address |
| 162 | 162 | ***************************************************************/ |
| 163 | 163 | #define RDZPWORD(addr) \ |
| 164 | 164 | ((addr&0xff)==0xff) ? \ |
| 165 | program_read_byte_8( (h6280.mmr[1] << 13) | ((addr)&0x1fff)) \ | |
| 166 | +(program_read_byte_8( (h6280.mmr[1] << 13) | ((addr-0xff)&0x1fff))<<8) : \ | |
| 167 | program_read_byte_8( (h6280.mmr[1] << 13) | ((addr)&0x1fff)) \ | |
| 168 | +(program_read_byte_8( (h6280.mmr[1] << 13) | ((addr+1)&0x1fff))<<8) | |
| 165 | program_read_byte_8le( (h6280.mmr[1] << 13) | ((addr)&0x1fff)) \ | |
| 166 | +(program_read_byte_8le( (h6280.mmr[1] << 13) | ((addr-0xff)&0x1fff))<<8) : \ | |
| 167 | program_read_byte_8le( (h6280.mmr[1] << 13) | ((addr)&0x1fff)) \ | |
| 168 | +(program_read_byte_8le( (h6280.mmr[1] << 13) | ((addr+1)&0x1fff))<<8) | |
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | /*************************************************************** |
| 172 | 172 | * push a register onto the stack |
| 173 | 173 | ***************************************************************/ |
| 174 | #define PUSH(Rg) program_write_byte_8( (h6280.mmr[1] << 13) | h6280.sp.d,Rg); S-- | |
| 174 | #define PUSH(Rg) program_write_byte_8le( (h6280.mmr[1] << 13) | h6280.sp.d,Rg); S-- | |
| 175 | 175 | |
| 176 | 176 | /*************************************************************** |
| 177 | 177 | * pull a register from the stack |
| 178 | 178 | ***************************************************************/ |
| 179 | #define PULL(Rg) S++; Rg = program_read_byte_8( (h6280.mmr[1] << 13) | h6280.sp.d) | |
| 179 | #define PULL(Rg) S++; Rg = program_read_byte_8le( (h6280.mmr[1] << 13) | h6280.sp.d) | |
| 180 | 180 | |
| 181 | 181 | /*************************************************************** |
| 182 | 182 | * RDOP read an opcode |
| r2375 | r2376 | |
| 1117 | 1117 | ***************************************************************/ |
| 1118 | 1118 | #define ST0 \ |
| 1119 | 1119 | CLEAR_T; \ |
| 1120 | io_write_byte_8(0x0000,tmp) | |
| 1120 | io_write_byte_8le(0x0000,tmp) | |
| 1121 | 1121 | |
| 1122 | 1122 | /* 6280 ******************************************************** |
| 1123 | 1123 | * ST1 Store at hardware address 2 |
| 1124 | 1124 | ***************************************************************/ |
| 1125 | 1125 | #define ST1 \ |
| 1126 | 1126 | CLEAR_T; \ |
| 1127 | io_write_byte_8(0x0002,tmp) | |
| 1127 | io_write_byte_8le(0x0002,tmp) | |
| 1128 | 1128 | |
| 1129 | 1129 | /* 6280 ******************************************************** |
| 1130 | 1130 | * ST2 Store at hardware address 3 |
| 1131 | 1131 | ***************************************************************/ |
| 1132 | 1132 | #define ST2 \ |
| 1133 | 1133 | CLEAR_T; \ |
| 1134 | io_write_byte_8(0x0003,tmp) | |
| 1134 | io_write_byte_8le(0x0003,tmp) | |
| 1135 | 1135 | |
| 1136 | 1136 | /* 6280 ******************************************************** |
| 1137 | 1137 | * STA Store accumulator |
| r2375 | r2376 | |
|---|---|---|
| 182 | 182 | /* Read a byte from given memory location */ |
| 183 | 183 | /****************************************************************************/ |
| 184 | 184 | /* ASG 971005 -- changed to program_read_byte_8/program_write_byte_8 */ |
| 185 | #define M6800_RDMEM(Addr) ((unsigned)program_read_byte_8(Addr)) | |
| 185 | #define M6800_RDMEM(Addr) ((unsigned)program_read_byte_8be(Addr)) | |
| 186 | 186 | |
| 187 | 187 | /****************************************************************************/ |
| 188 | 188 | /* Write a byte to given memory location */ |
| 189 | 189 | /****************************************************************************/ |
| 190 | #define M6800_WRMEM(Addr,Value) (program_write_byte_8(Addr,Value)) | |
| 190 | #define M6800_WRMEM(Addr,Value) (program_write_byte_8be(Addr,Value)) | |
| 191 | 191 | |
| 192 | 192 | /****************************************************************************/ |
| 193 | 193 | /* M6800_RDOP() is identical to M6800_RDMEM() except it is used for reading */ |
| r2375 | r2376 | |
|---|---|---|
| 613 | 613 | m6800.port2_data = (m6800.port2_data & 0xef) | (value << 4); |
| 614 | 614 | |
| 615 | 615 | if(m6800.port2_ddr == 0xff) |
| 616 | io_write_byte_8(M6803_PORT2,m6800.port2_data); | |
| 616 | io_write_byte_8be(M6803_PORT2,m6800.port2_data); | |
| 617 | 617 | else |
| 618 | io_write_byte_8(M6803_PORT2,(m6800.port2_data & m6800.port2_ddr) | |
| 619 | | (io_read_byte_8(M6803_PORT2) & (m6800.port2_ddr ^ 0xff))); | |
| 618 | io_write_byte_8be(M6803_PORT2,(m6800.port2_data & m6800.port2_ddr) | |
| 619 | | (io_read_byte_8be(M6803_PORT2) & (m6800.port2_ddr ^ 0xff))); | |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | static int m6800_rx(void) |
| 623 | 623 | { |
| 624 | return (io_read_byte_8(M6803_PORT2) & M6800_PORT2_IO3) >> 3; | |
| 624 | return (io_read_byte_8be(M6803_PORT2) & M6800_PORT2_IO3) >> 3; | |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | static TIMER_CALLBACK(m6800_tx_tick) |
| r2375 | r2376 | |
| 2293 | 2293 | case 0x01: |
| 2294 | 2294 | return m6800.port2_ddr; |
| 2295 | 2295 | case 0x02: |
| 2296 | return (io_read_byte_8(M6803_PORT1) & (m6800.port1_ddr ^ 0xff)) | |
| 2296 | return (io_read_byte_8be(M6803_PORT1) & (m6800.port1_ddr ^ 0xff)) | |
| 2297 | 2297 | | (m6800.port1_data & m6800.port1_ddr); |
| 2298 | 2298 | case 0x03: |
| 2299 | return (io_read_byte_8(M6803_PORT2) & (m6800.port2_ddr ^ 0xff)) | |
| 2299 | return (io_read_byte_8be(M6803_PORT2) & (m6800.port2_ddr ^ 0xff)) | |
| 2300 | 2300 | | (m6800.port2_data & m6800.port2_ddr); |
| 2301 | 2301 | case 0x04: |
| 2302 | 2302 | return m6800.port3_ddr; |
| 2303 | 2303 | case 0x05: |
| 2304 | 2304 | return m6800.port4_ddr; |
| 2305 | 2305 | case 0x06: |
| 2306 | return (io_read_byte_8(M6803_PORT3) & (m6800.port3_ddr ^ 0xff)) | |
| 2306 | return (io_read_byte_8be(M6803_PORT3) & (m6800.port3_ddr ^ 0xff)) | |
| 2307 | 2307 | | (m6800.port3_data & m6800.port3_ddr); |
| 2308 | 2308 | case 0x07: |
| 2309 | return (io_read_byte_8(M6803_PORT4) & (m6800.port4_ddr ^ 0xff)) | |
| 2309 | return (io_read_byte_8be(M6803_PORT4) & (m6800.port4_ddr ^ 0xff)) | |
| 2310 | 2310 | | (m6800.port4_data & m6800.port4_ddr); |
| 2311 | 2311 | case 0x08: |
| 2312 | 2312 | m6800.pending_tcsr = 0; |
| r2375 | r2376 | |
| 2391 | 2391 | { |
| 2392 | 2392 | m6800.port1_ddr = data; |
| 2393 | 2393 | if(m6800.port1_ddr == 0xff) |
| 2394 | io_write_byte_8(M6803_PORT1,m6800.port1_data); | |
| 2394 | io_write_byte_8be(M6803_PORT1,m6800.port1_data); | |
| 2395 | 2395 | else |
| 2396 | io_write_byte_8(M6803_PORT1,(m6800.port1_data & m6800.port1_ddr) | |
| 2397 | | (io_read_byte_8(M6803_PORT1) & (m6800.port1_ddr ^ 0xff))); | |
| 2396 | io_write_byte_8be(M6803_PORT1,(m6800.port1_data & m6800.port1_ddr) | |
| 2397 | | (io_read_byte_8be(M6803_PORT1) & (m6800.port1_ddr ^ 0xff))); | |
| 2398 | 2398 | } |
| 2399 | 2399 | break; |
| 2400 | 2400 | case 0x01: |
| r2375 | r2376 | |
| 2402 | 2402 | { |
| 2403 | 2403 | m6800.port2_ddr = data; |
| 2404 | 2404 | if(m6800.port2_ddr == 0xff) |
| 2405 | io_write_byte_8(M6803_PORT2,m6800.port2_data); | |
| 2405 | io_write_byte_8be(M6803_PORT2,m6800.port2_data); | |
| 2406 | 2406 | else |
| 2407 | io_write_byte_8(M6803_PORT2,(m6800.port2_data & m6800.port2_ddr) | |
| 2408 | | (io_read_byte_8(M6803_PORT2) & (m6800.port2_ddr ^ 0xff))); | |
| 2407 | io_write_byte_8be(M6803_PORT2,(m6800.port2_data & m6800.port2_ddr) | |
| 2408 | | (io_read_byte_8be(M6803_PORT2) & (m6800.port2_ddr ^ 0xff))); | |
| 2409 | 2409 | |
| 2410 | 2410 | if (m6800.port2_ddr & 2) |
| 2411 | 2411 | logerror("CPU #%d PC %04x: warning - port 2 bit 1 set as output (OLVL) - not supported\n",cpu_getactivecpu(),activecpu_get_pc()); |
| r2375 | r2376 | |
| 2414 | 2414 | case 0x02: |
| 2415 | 2415 | m6800.port1_data = data; |
| 2416 | 2416 | if(m6800.port1_ddr == 0xff) |
| 2417 | io_write_byte_8(M6803_PORT1,m6800.port1_data); | |
| 2417 | io_write_byte_8be(M6803_PORT1,m6800.port1_data); | |
| 2418 | 2418 | else |
| 2419 | io_write_byte_8(M6803_PORT1,(m6800.port1_data & m6800.port1_ddr) | |
| 2420 | | (io_read_byte_8(M6803_PORT1) & (m6800.port1_ddr ^ 0xff))); | |
| 2419 | io_write_byte_8be(M6803_PORT1,(m6800.port1_data & m6800.port1_ddr) | |
| 2420 | | (io_read_byte_8be(M6803_PORT1) & (m6800.port1_ddr ^ 0xff))); | |
| 2421 | 2421 | break; |
| 2422 | 2422 | case 0x03: |
| 2423 | 2423 | if (m6800.trcsr & M6800_TRCSR_TE) |
| r2375 | r2376 | |
| 2429 | 2429 | m6800.port2_data = data; |
| 2430 | 2430 | } |
| 2431 | 2431 | if(m6800.port2_ddr == 0xff) |
| 2432 | io_write_byte_8(M6803_PORT2,m6800.port2_data); | |
| 2432 | io_write_byte_8be(M6803_PORT2,m6800.port2_data); | |
| 2433 | 2433 | else |
| 2434 | io_write_byte_8(M6803_PORT2,(m6800.port2_data & m6800.port2_ddr) | |
| 2435 | | (io_read_byte_8(M6803_PORT2) & (m6800.port2_ddr ^ 0xff))); | |
| 2434 | io_write_byte_8be(M6803_PORT2,(m6800.port2_data & m6800.port2_ddr) | |
| 2435 | | (io_read_byte_8be(M6803_PORT2) & (m6800.port2_ddr ^ 0xff))); | |
| 2436 | 2436 | break; |
| 2437 | 2437 | case 0x04: |
| 2438 | 2438 | if (m6800.port3_ddr != data) |
| 2439 | 2439 | { |
| 2440 | 2440 | m6800.port3_ddr = data; |
| 2441 | 2441 | if(m6800.port3_ddr == 0xff) |
| 2442 | io_write_byte_8(M6803_PORT3,m6800.port3_data); | |
| 2442 | io_write_byte_8be(M6803_PORT3,m6800.port3_data); | |
| 2443 | 2443 | else |
| 2444 | io_write_byte_8(M6803_PORT3,(m6800.port3_data & m6800.port3_ddr) | |
| 2445 | | (io_read_byte_8(M6803_PORT3) & (m6800.port3_ddr ^ 0xff))); | |
| 2444 | io_write_byte_8be(M6803_PORT3,(m6800.port3_data & m6800.port3_ddr) | |
| 2445 | | (io_read_byte_8be(M6803_PORT3) & (m6800.port3_ddr ^ 0xff))); | |
| 2446 | 2446 | } |
| 2447 | 2447 | break; |
| 2448 | 2448 | case 0x05: |
| r2375 | r2376 | |
| 2450 | 2450 | { |
| 2451 | 2451 | m6800.port4_ddr = data; |
| 2452 | 2452 | if(m6800.port4_ddr == 0xff) |
| 2453 | io_write_byte_8(M6803_PORT4,m6800.port4_data); | |
| 2453 | io_write_byte_8be(M6803_PORT4,m6800.port4_data); | |
| 2454 | 2454 | else |
| 2455 | io_write_byte_8(M6803_PORT4,(m6800.port4_data & m6800.port4_ddr) | |
| 2456 | | (io_read_byte_8(M6803_PORT4) & (m6800.port4_ddr ^ 0xff))); | |
| 2455 | io_write_byte_8be(M6803_PORT4,(m6800.port4_data & m6800.port4_ddr) | |
| 2456 | | (io_read_byte_8be(M6803_PORT4) & (m6800.port4_ddr ^ 0xff))); | |
| 2457 | 2457 | } |
| 2458 | 2458 | break; |
| 2459 | 2459 | case 0x06: |
| 2460 | 2460 | m6800.port3_data = data; |
| 2461 | 2461 | if(m6800.port3_ddr == 0xff) |
| 2462 | io_write_byte_8(M6803_PORT3,m6800.port3_data); | |
| 2462 | io_write_byte_8be(M6803_PORT3,m6800.port3_data); | |
| 2463 | 2463 | else |
| 2464 | io_write_byte_8(M6803_PORT3,(m6800.port3_data & m6800.port3_ddr) | |
| 2465 | | (io_read_byte_8(M6803_PORT3) & (m6800.port3_ddr ^ 0xff))); | |
| 2464 | io_write_byte_8be(M6803_PORT3,(m6800.port3_data & m6800.port3_ddr) | |
| 2465 | | (io_read_byte_8be(M6803_PORT3) & (m6800.port3_ddr ^ 0xff))); | |
| 2466 | 2466 | break; |
| 2467 | 2467 | case 0x07: |
| 2468 | 2468 | m6800.port4_data = data; |
| 2469 | 2469 | if(m6800.port4_ddr == 0xff) |
| 2470 | io_write_byte_8(M6803_PORT4,m6800.port4_data); | |
| 2470 | io_write_byte_8be(M6803_PORT4,m6800.port4_data); | |
| 2471 | 2471 | else |
| 2472 | io_write_byte_8(M6803_PORT4,(m6800.port4_data & m6800.port4_ddr) | |
| 2473 | | (io_read_byte_8(M6803_PORT4) & (m6800.port4_ddr ^ 0xff))); | |
| 2472 | io_write_byte_8be(M6803_PORT4,(m6800.port4_data & m6800.port4_ddr) | |
| 2473 | | (io_read_byte_8be(M6803_PORT4) & (m6800.port4_ddr ^ 0xff))); | |
| 2474 | 2474 | break; |
| 2475 | 2475 | case 0x08: |
| 2476 | 2476 | m6800.tcsr = data; |
| r2375 | r2376 | |
|---|---|---|
| 114 | 114 | |
| 115 | 115 | static I8X41 i8x41; |
| 116 | 116 | |
| 117 | #define RM(a) program_read_byte_8(a) | |
| 118 | #define WM(a,v) program_write_byte_8(a,v) | |
| 119 | #define RP(a) io_read_byte_8(a) | |
| 120 | #define WP(a,v) io_write_byte_8(a,v) | |
| 117 | #define RM(a) program_read_byte_8le(a) | |
| 118 | #define WM(a,v) program_write_byte_8le(a,v) | |
| 119 | #define RP(a) io_read_byte_8le(a) | |
| 120 | #define WP(a,v) io_write_byte_8le(a,v) | |
| 121 | 121 | #define ROP(pc) cpu_readop(pc) |
| 122 | 122 | #define ROP_ARG(pc) cpu_readop_arg(pc) |
| 123 | 123 |
| r2375 | r2376 | |
|---|---|---|
| 23 | 23 | /****************************************************************************/ |
| 24 | 24 | /* Read a byte from given memory location */ |
| 25 | 25 | /****************************************************************************/ |
| 26 | #define KONAMI_RDMEM(Addr) ((unsigned)program_read_byte_8(Addr)) | |
| 26 | #define KONAMI_RDMEM(Addr) ((unsigned)program_read_byte_8be(Addr)) | |
| 27 | 27 | |
| 28 | 28 | /****************************************************************************/ |
| 29 | 29 | /* Write a byte to given memory location */ |
| 30 | 30 | /****************************************************************************/ |
| 31 | #define KONAMI_WRMEM(Addr,Value) (program_write_byte_8(Addr,Value)) | |
| 31 | #define KONAMI_WRMEM(Addr,Value) (program_write_byte_8be(Addr,Value)) | |
| 32 | 32 | |
| 33 | 33 | /****************************************************************************/ |
| 34 | 34 | /* Z80_RDOP() is identical to Z80_RDMEM() except it is used for reading */ |
| r2375 | r2376 | |
|---|---|---|
| 166 | 166 | FUNCTION PROTOTYPES |
| 167 | 167 | ***************************************************************************/ |
| 168 | 168 | |
| 169 | static | |
| 169 | static STATE_POSTLOAD( stream_postload | |
| 170 | 170 | static void allocate_resample_buffers(streams_private *strdata, sound_stream *stream); |
| 171 | 171 | static void allocate_output_buffers(streams_private *strdata, sound_stream *stream); |
| 172 | 172 | static void recompute_sample_rate_data(streams_private *strdata, sound_stream *stream); |
| r2375 | r2376 | |
| 374 | 374 | /* create a unique tag for saving */ |
| 375 | 375 | sprintf(statetag, "stream.%d", stream->index); |
| 376 | 376 | state_save_register_item(statetag, 0, stream->sample_rate); |
| 377 | state_save_register_ | |
| 377 | state_save_register_ | |
| 378 | 378 | |
| 379 | 379 | /* allocate space for the inputs */ |
| 380 | 380 | if (inputs > 0) |
| r2375 | r2376 | |
| 633 | 633 | stream_postload - save/restore callback |
| 634 | 634 | -------------------------------------------------*/ |
| 635 | 635 | |
| 636 | static | |
| 636 | static STATE_POSTLOAD( stream_postload | |
| 637 | 637 | { |
| 638 | streams_private *strdata = | |
| 638 | streams_private *strdata = machine->streams_data; | |
| 639 | 639 | sound_stream *stream = param; |
| 640 | 640 | int outputnum; |
| 641 | 641 |
| r2375 | r2376 | |
|---|---|---|
| 144 | 144 | |
| 145 | 145 | /* State Save Postload */ |
| 146 | 146 | |
| 147 | static | |
| 147 | static STATE_POSTLOAD( cdp1869_state_save_postload | |
| 148 | 148 | { |
| 149 | 149 | update_prd_changed_timer(param); |
| 150 | 150 | } |
| r2375 | r2376 | |
| 804 | 804 | // register for state saving |
| 805 | 805 | |
| 806 | 806 | state_save_combine_module_and_tag(unique_tag, "CDP1869", device->tag); |
| 807 | state_save_register_ | |
| 807 | state_save_register_ | |
| 808 | 808 | |
| 809 | 809 | state_save_register_item(unique_tag, 0, cdp1869->dispoff); |
| 810 | 810 | state_save_register_item(unique_tag, 0, cdp1869->fresvert); |
| r2375 | r2376 | |
|---|---|---|
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "poly.h" |
| 10 | #include "deprecat.h" | |
| 10 | 11 | #include "eminline.h" |
| 11 | 12 | #include "mame.h" |
| 12 | 13 | #include "state.h" |
| r2375 | r2376 | |
| 206 | 207 | static void **allocate_array(size_t *itemsize, UINT32 itemcount); |
| 207 | 208 | static void free_array(void **array); |
| 208 | 209 | static void *poly_item_callback(void *param, int threadid); |
| 209 | static | |
| 210 | static STATE_PRESAVE( poly_state_presave | |
| 210 | 211 | |
| 211 | 212 | |
| 212 | 213 | |
| r2375 | r2376 | |
| 360 | 361 | poly->queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ); |
| 361 | 362 | |
| 362 | 363 | /* request a pre-save callback for synchronization */ |
| 363 | state_save_register_ | |
| 364 | state_save_register_ | |
| 364 | 365 | return poly; |
| 365 | 366 | } |
| 366 | 367 | |
| r2375 | r2376 | |
| 1420 | 1421 | ensure everything is synced before saving |
| 1421 | 1422 | -------------------------------------------------*/ |
| 1422 | 1423 | |
| 1423 | static | |
| 1424 | static STATE_PRESAVE( poly_state_presave | |
| 1424 | 1425 | { |
| 1425 | 1426 | poly_manager *poly = param; |
| 1426 | 1427 | poly_wait(poly, "pre-save"); |
| r2375 | r2376 | |
|---|---|---|
| 108 | 108 | }; |
| 109 | 109 | |
| 110 | 110 | |
| 111 | static | |
| 111 | static STATE_POSTLOAD( mc6845_state_save_postload | |
| 112 | 112 | static void recompute_parameters(mc6845_t *mc6845, int postload); |
| 113 | 113 | static void update_de_changed_timer(mc6845_t *mc6845); |
| 114 | 114 | static void update_hsync_changed_timers(mc6845_t *mc6845); |
| r2375 | r2376 | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| 135 | static | |
| 135 | static STATE_POSTLOAD( mc6845_state_save_postload | |
| 136 | 136 | { |
| 137 | 137 | recompute_parameters(param, TRUE); |
| 138 | 138 | } |
| r2375 | r2376 | |
| 723 | 723 | /* register for state saving */ |
| 724 | 724 | state_save_combine_module_and_tag(unique_tag, device_tags[device_type], device->tag); |
| 725 | 725 | |
| 726 | state_save_register_ | |
| 726 | state_save_register_ | |
| 727 | 727 | |
| 728 | 728 | state_save_register_item(unique_tag, 0, mc6845->clock); |
| 729 | 729 | state_save_register_item(unique_tag, 0, mc6845->hpixels_per_column); |
| r2375 | r2376 | |
|---|---|---|
| 869 | 869 | begin_resource_tracking(); |
| 870 | 870 | config = machine_config_alloc(game->machine_config); |
| 871 | 871 | #ifdef MESS |
| 872 | /* temporary hook until MESS device transition is complete */ | |
| 872 | 873 | mess_devices_setup(config, game); |
| 873 | 874 | #endif /* MESS */ |
| 874 | 875 | input = input_port_allocate(game->ipt, NULL); |
| r2375 | r2376 | |
|---|---|---|
| 138 | 138 | |
| 139 | 139 | /* system management helpers */ |
| 140 | 140 | static void tilemap_exit(running_machine *machine); |
| 141 | static | |
| 141 | static STATE_POSTLOAD( tilemap_postload | |
| 142 | 142 | static void tilemap_dispose(tilemap *tmap); |
| 143 | 143 | |
| 144 | 144 | /* logical <-> memory index mapping */ |
| r2375 | r2376 | |
| 355 | 355 | tilemap_instance++; |
| 356 | 356 | |
| 357 | 357 | /* reset everything after a load */ |
| 358 | state_save_register_ | |
| 358 | state_save_register_ | |
| 359 | 359 | return tmap; |
| 360 | 360 | } |
| 361 | 361 | |
| r2375 | r2376 | |
| 379 | 379 | |
| 380 | 380 | void tilemap_set_palette_offset(tilemap *tmap, UINT32 offset) |
| 381 | 381 | { |
| 382 | if (tmap->palette_offset != offset) | |
| 383 | { | |
| 384 | tmap->palette_offset = offset; | |
| 385 | tilemap_mark_all_tiles_dirty(tmap); | |
| 386 | } | |
| 382 | tmap->palette_offset = offset; | |
| 387 | 383 | } |
| 388 | 384 | |
| 389 | 385 | |
| r2375 | r2376 | |
| 1054 | 1050 | invalidate everything |
| 1055 | 1051 | -------------------------------------------------*/ |
| 1056 | 1052 | |
| 1057 | static | |
| 1053 | static STATE_POSTLOAD( tilemap_postload | |
| 1058 | 1054 | { |
| 1059 | 1055 | /* recompute the mappings for this tilemap */ |
| 1060 | 1056 | tilemap *tmap = param; |
| r2375 | r2376 | |
|---|---|---|
| 432 | 432 | /* specify a parameter to be passed into the tile_get_info callback */ |
| 433 | 433 | void tilemap_set_user_data(tilemap *tmap, void *user_data); |
| 434 | 434 | |
| 435 | /* specify an offset to be added to each pixel before looking up the palette */ | |
| 435 | /* specify an offset to be added to each pixel before looking up the palette | |
| 436 | * The offset only applies at final rendering time (e.g., tilemap_draw()) | |
| 437 | * It does not apply to the cached pixmap, which is provided by tilemap_get_pixmap(). | |
| 438 | */ | |
| 436 | 439 | void tilemap_set_palette_offset(tilemap *tmap, UINT32 offset); |
| 437 | 440 | |
| 438 | 441 | /* set an enable flag for the tilemap; if 0, requests to draw the tilemap are ignored */ |
| r2375 | r2376 | |
|---|---|---|
| 181 | 181 | static osd_ticks_t throttle_until_ticks(running_machine *machine, osd_ticks_t target_ticks); |
| 182 | 182 | static void update_frameskip(running_machine *machine); |
| 183 | 183 | static void recompute_speed(running_machine *machine, attotime emutime); |
| 184 | static void update_refresh_speed(running_machine *machine); | |
| 184 | 185 | |
| 185 | 186 | /* screen snapshots */ |
| 186 | 187 | static void create_snapshot_bitmap(const device_config *screen); |
| r2375 | r2376 | |
| 305 | 306 | |
| 306 | 307 | /* extract initial execution state from global configuration settings */ |
| 307 | 308 | global.speed = original_speed_setting(); |
| 309 | update_refresh_speed(machine); | |
| 308 | 310 | global.throttle = options_get_bool(mame_options(), OPTION_THROTTLE); |
| 309 | 311 | global.auto_frameskip = options_get_bool(mame_options(), OPTION_AUTOFRAMESKIP); |
| 310 | 312 | global.frameskip_level = options_get_int(mame_options(), OPTION_FRAMESKIP); |
| r2375 | r2376 | |
| 699 | 701 | else |
| 700 | 702 | state->vblank_period = config->vblank; |
| 701 | 703 | |
| 702 | /* adjust speed if necessary */ | |
| 703 | if (options_get_bool(mame_options(), OPTION_REFRESHSPEED)) | |
| 704 | { | |
| 705 | float minrefresh = render_get_max_update_rate(); | |
| 706 | if (minrefresh != 0) | |
| 707 | { | |
| 708 | UINT32 target_speed = floor(minrefresh * 100.0 / ATTOSECONDS_TO_HZ(frame_period)); | |
| 709 | UINT32 original_speed = original_speed_setting(); | |
| 710 | target_speed = MIN(target_speed, original_speed); | |
| 711 | if (target_speed != global.speed) | |
| 712 | { | |
| 713 | mame_printf_verbose("Adjusting target speed to %d%%\n", target_speed); | |
| 714 | global.speed = target_speed; | |
| 715 | } | |
| 716 | } | |
| 717 | } | |
| 718 | ||
| 719 | 704 | /* if we are on scanline 0 already, reset the update timer immediately */ |
| 720 | 705 | /* otherwise, defer until the next scanline 0 */ |
| 721 | 706 | if (video_screen_get_vpos(screen) == 0) |
| r2375 | r2376 | |
| 725 | 710 | |
| 726 | 711 | /* start the VBLANK timer */ |
| 727 | 712 | timer_adjust_oneshot(state->vblank_begin_timer, video_screen_get_time_until_vblank_start(screen), 0); |
| 713 | ||
| 714 | /* adjust speed if necessary */ | |
| 715 | update_refresh_speed(screen->machine); | |
| 728 | 716 | } |
| 729 | 717 | |
| 730 | 718 | |
| r2375 | r2376 | |
| 1620 | 1608 | |
| 1621 | 1609 | |
| 1622 | 1610 | /*------------------------------------------------- |
| 1611 | video_get_speed_percent - return the current | |
| 1612 | effective speed percentage | |
| 1613 | -------------------------------------------------*/ | |
| 1614 | ||
| 1615 | double video_get_speed_percent(running_machine *machine) | |
| 1616 | { | |
| 1617 | return global.speed_percent; | |
| 1618 | } | |
| 1619 | ||
| 1620 | ||
| 1621 | /*------------------------------------------------- | |
| 1623 | 1622 | video_get_frameskip - return the current |
| 1624 | 1623 | actual frameskip (-1 means autoframeskip) |
| 1625 | 1624 | -------------------------------------------------*/ |
| r2375 | r2376 | |
| 1973 | 1972 | |
| 1974 | 1973 | |
| 1975 | 1974 | /*------------------------------------------------- |
| 1975 | update_refresh_speed - update the global.speed | |
| 1976 | based on the maximum refresh rate supported | |
| 1977 | -------------------------------------------------*/ | |
| 1978 | ||
| 1979 | static void update_refresh_speed(running_machine *machine) | |
| 1980 | { | |
| 1981 | /* only do this if the refreshspeed option is used */ | |
| 1982 | if (options_get_bool(mame_options(), OPTION_REFRESHSPEED)) | |
| 1983 | { | |
| 1984 | float minrefresh = render_get_max_update_rate(); | |
| 1985 | if (minrefresh != 0) | |
| 1986 | { | |
| 1987 | attoseconds_t min_frame_period = ATTOSECONDS_PER_SECOND; | |
| 1988 | UINT32 original_speed = original_speed_setting(); | |
| 1989 | const device_config *screen; | |
| 1990 | UINT32 target_speed; | |
| 1991 | ||
| 1992 | /* find the screen with the shortest frame period (max refresh rate) */ | |
| 1993 | for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen)) | |
| 1994 | { | |
| 1995 | screen_state *state = get_safe_token(screen); | |
| 1996 | min_frame_period = MIN(min_frame_period, state->frame_period); | |
| 1997 | } | |
| 1998 | ||
| 1999 | /* compute a target speed as an integral percentage */ | |
| 2000 | target_speed = floor(minrefresh * 100.0 / ATTOSECONDS_TO_HZ(min_frame_period)); | |
| 2001 | target_speed = MIN(target_speed, original_speed); | |
| 2002 | ||
| 2003 | /* if we changed, log that verbosely */ | |
| 2004 | if (target_speed != global.speed) | |
| 2005 | { | |
| 2006 | mame_printf_verbose("Adjusting target speed to %d%%\n", target_speed); | |
| 2007 | global.speed = target_speed; | |
| 2008 | } | |
| 2009 | } | |
| 2010 | } | |
| 2011 | } | |
| 2012 | ||
| 2013 | ||
| 2014 | /*------------------------------------------------- | |
| 1976 | 2015 | recompute_speed - recompute the current |
| 1977 | 2016 | overall speed; we assume this is called only |
| 1978 | 2017 | if we did not skip a frame |
| r2375 | r2376 | |
|---|---|---|
| 341 | 341 | /* program accessors */ |
| 342 | 342 | { |
| 343 | 343 | { |
| 344 | { memory_set_opbase, program_read_byte_8, NULL, NULL, NULL, NULL, NULL, program_write_byte_8, NULL, NULL, NULL, NULL, NULL }, | |
| 345 | { memory_set_opbase, program_read_byte_8, NULL, NULL, NULL, NULL, NULL, program_write_byte_8, NULL, NULL, NULL, NULL, NULL } | |
| 344 | { memory_set_opbase, program_read_byte_8le, program_read_word_8le, program_read_dword_8le, NULL, program_read_qword_8le, NULL, program_write_byte_8le, program_write_word_8le, program_write_dword_8le, NULL, program_write_qword_8le, NULL }, | |
| 345 | { memory_set_opbase, program_read_byte_8be, program_read_word_8be, program_read_dword_8be, NULL, program_read_qword_8be, NULL, program_write_byte_8be, program_write_word_8be, program_write_dword_8be, NULL, program_write_qword_8be, NULL } | |
| 346 | 346 | }, |
| 347 | 347 | { |
| 348 | { memory_set_opbase, program_read_byte_16le, program_read_word_16le, NULL, NULL, NULL, NULL, program_write_byte_16le, program_write_word_16le, NULL, NULL, NULL, NULL }, | |
| 349 | { memory_set_opbase, program_read_byte_16be, program_read_word_16be, NULL, NULL, NULL, NULL, program_write_byte_16be, program_write_word_16be, NULL, NULL, NULL, NULL } | |
| 348 | { memory_set_opbase, program_read_byte_16le, program_read_word_16le, program_read_dword_16le, NULL, program_read_qword_16le, NULL, program_write_byte_16le, program_write_word_16le, program_write_dword_16le, NULL, program_write_qword_16le, NULL }, | |
| 349 | { memory_set_opbase, program_read_byte_16be, program_read_word_16be, program_read_dword_16be, NULL, program_read_qword_16be, NULL, program_write_byte_16be, program_write_word_16be, program_write_dword_16be, NULL, program_write_qword_16be, NULL } | |
| 350 | 350 | }, |
| 351 | 351 | { |
| 352 | { memory_set_opbase, program_read_byte_32le, program_read_word_32le, program_read_dword_32le, program_read_masked_32le, NULL, NULL, program_write_byte_32le, program_write_word_32le, program_write_dword_32le, program_write_masked_32le, NULL, NULL }, | |
| 353 | { memory_set_opbase, program_read_byte_32be, program_read_word_32be, program_read_dword_32be, program_read_masked_32be, NULL, NULL, program_write_byte_32be, program_write_word_32be, program_write_dword_32be, program_write_masked_32be, NULL, NULL } | |
| 352 | { memory_set_opbase, program_read_byte_32le, program_read_word_32le, program_read_dword_32le, program_read_dword_masked_32le, program_read_qword_32le, NULL, program_write_byte_32le, program_write_word_32le, program_write_dword_32le, program_write_dword_masked_32le, program_write_qword_32le, NULL }, | |
| 353 | { memory_set_opbase, program_read_byte_32be, program_read_word_32be, program_read_dword_32be, program_read_dword_masked_32be, program_read_qword_32be, NULL, program_write_byte_32be, program_write_word_32be, program_write_dword_32be, program_write_dword_masked_32be, program_write_qword_32be, NULL } | |
| 354 | 354 | }, |
| 355 | 355 | { |
| 356 | { memory_set_opbase, program_read_byte_64le, program_read_word_64le, program_read_dword_64le, NULL, program_read_qword_64le, program_read_masked_64le, program_write_byte_64le, program_write_word_64le, program_write_dword_64le, NULL, program_write_qword_64le, program_write_masked_64le }, | |
| 357 | { memory_set_opbase, program_read_byte_64be, program_read_word_64be, program_read_dword_64be, NULL, program_read_qword_64be, program_read_masked_64be, program_write_byte_64be, program_write_word_64be, program_write_dword_64be, NULL, program_write_qword_64be, program_write_masked_64be } | |
| 356 | { memory_set_opbase, program_read_byte_64le, program_read_word_64le, program_read_dword_64le, NULL, program_read_qword_64le, program_read_qword_masked_64le, program_write_byte_64le, program_write_word_64le, program_write_dword_64le, NULL, program_write_qword_64le, program_write_qword_masked_64le }, | |
| 357 | { memory_set_opbase, program_read_byte_64be, program_read_word_64be, program_read_dword_64be, NULL, program_read_qword_64be, program_read_qword_masked_64be, program_write_byte_64be, program_write_word_64be, program_write_dword_64be, NULL, program_write_qword_64be, program_write_qword_masked_64be } | |
| 358 | 358 | } |
| 359 | 359 | }, |
| 360 | 360 | |
| 361 | 361 | /* data accessors */ |
| 362 | 362 | { |
| 363 | 363 | { |
| 364 | { memory_set_opbase, data_read_byte_8, NULL, NULL, NULL, NULL, NULL, data_write_byte_8, NULL, NULL, NULL, NULL, NULL }, | |
| 365 | { memory_set_opbase, data_read_byte_8, NULL, NULL, NULL, NULL, NULL, data_write_byte_8, NULL, NULL, NULL, NULL, NULL } | |
| 364 | { memory_set_opbase, data_read_byte_8le, data_read_word_8le, data_read_dword_8le, NULL, data_read_qword_8le, NULL, data_write_byte_8le, data_write_word_8le, data_write_dword_8le, NULL, data_write_qword_8le, NULL }, | |
| 365 | { memory_set_opbase, data_read_byte_8be, data_read_word_8be, data_read_dword_8be, NULL, data_read_qword_8be, NULL, data_write_byte_8be, data_write_word_8be, data_write_dword_8be, NULL, data_write_qword_8be, NULL } | |
| 366 | 366 | }, |
| 367 | 367 | { |
| 368 | { memory_set_opbase, data_read_byte_16le, data_read_word_16le, NULL, NULL, NULL, NULL, data_write_byte_16le, data_write_word_16le, NULL, NULL, NULL, NULL }, | |
| 369 | { memory_set_opbase, data_read_byte_16be, data_read_word_16be, NULL, NULL, NULL, NULL, data_write_byte_16be, data_write_word_16be, NULL, NULL, NULL, NULL } | |
| 368 | { memory_set_opbase, data_read_byte_16le, data_read_word_16le, data_read_dword_16le, NULL, data_read_qword_16le, NULL, data_write_byte_16le, data_write_word_16le, data_write_dword_16le, NULL, data_write_qword_16le, NULL }, | |
| 369 | { memory_set_opbase, data_read_byte_16be, data_read_word_16be, data_read_dword_16be, NULL, data_read_qword_16be, NULL, data_write_byte_16be, data_write_word_16be, data_write_dword_16be, NULL, data_write_qword_16be, NULL } | |
| 370 | 370 | }, |
| 371 | 371 | { |
| 372 | { memory_set_opbase, data_read_byte_32le, data_read_word_32le, data_read_dword_32le, data_read_masked_32le, NULL, NULL, data_write_byte_32le, data_write_word_32le, data_write_dword_32le, data_write_masked_32le, NULL, NULL }, | |
| 373 | { memory_set_opbase, data_read_byte_32be, data_read_word_32be, data_read_dword_32be, data_read_masked_32be, NULL, NULL, data_write_byte_32be, data_write_word_32be, data_write_dword_32be, data_write_masked_32be, NULL, NULL } | |
| 372 | { memory_set_opbase, data_read_byte_32le, data_read_word_32le, data_read_dword_32le, data_read_dword_masked_32le, data_read_qword_32le, NULL, data_write_byte_32le, data_write_word_32le, data_write_dword_32le, data_write_dword_masked_32le, data_write_qword_32le, NULL }, | |
| 373 | { memory_set_opbase, data_read_byte_32be, data_read_word_32be, data_read_dword_32be, data_read_dword_masked_32be, data_read_qword_32be, NULL, data_write_byte_32be, data_write_word_32be, data_write_dword_32be, data_write_dword_masked_32be, data_write_qword_32be, NULL } | |
| 374 | 374 | }, |
| 375 | 375 | { |
| 376 | { memory_set_opbase, data_read_byte_64le, data_read_word_64le, data_read_dword_64le, NULL, data_read_qword_64le, data_read_masked_64le, data_write_byte_64le, data_write_word_64le, data_write_dword_64le, NULL, data_write_qword_64le, data_write_masked_64le }, | |
| 377 | { memory_set_opbase, data_read_byte_64be, data_read_word_64be, data_read_dword_64be, NULL, data_read_qword_64be, data_read_masked_64be, data_write_byte_64be, data_write_word_64be, data_write_dword_64be, NULL, data_write_qword_64be, data_write_masked_64be } | |
| 376 | { memory_set_opbase, data_read_byte_64le, data_read_word_64le, data_read_dword_64le, NULL, data_read_qword_64le, data_read_qword_masked_64le, data_write_byte_64le, data_write_word_64le, data_write_dword_64le, NULL, data_write_qword_64le, data_write_qword_masked_64le }, | |
| 377 | { memory_set_opbase, data_read_byte_64be, data_read_word_64be, data_read_dword_64be, NULL, data_read_qword_64be, data_read_qword_masked_64be, data_write_byte_64be, data_write_word_64be, data_write_dword_64be, NULL, data_write_qword_64be, data_write_qword_masked_64be } | |
| 378 | 378 | } |
| 379 | 379 | }, |
| 380 | 380 | |
| 381 | 381 | /* I/O accessors */ |
| 382 | 382 | { |
| 383 | 383 | { |
| 384 | { memory_set_opbase, io_read_byte_8, NULL, NULL, NULL, NULL, NULL, io_write_byte_8, NULL, NULL, NULL, NULL, NULL }, | |
| 385 | { memory_set_opbase, io_read_byte_8, NULL, NULL, NULL, NULL, NULL, io_write_byte_8, NULL, NULL, NULL, NULL, NULL } | |
| 384 | { memory_set_opbase, io_read_byte_8le, io_read_word_8le, io_read_dword_8le, NULL, io_read_qword_8le, NULL, io_write_byte_8le, io_write_word_8le, io_write_dword_8le, NULL, io_write_qword_8le, NULL }, | |
| 385 | { memory_set_opbase, io_read_byte_8be, io_read_word_8be, io_read_dword_8be, NULL, io_read_qword_8be, NULL, io_write_byte_8be, io_write_word_8be, io_write_dword_8be, NULL, io_write_qword_8be, NULL } | |
| 386 | 386 | }, |
| 387 | 387 | { |
| 388 | { memory_set_opbase, io_read_byte_16le, io_read_word_16le, NULL, NULL, NULL, NULL, io_write_byte_16le, io_write_word_16le, NULL, NULL, NULL, NULL }, | |
| 389 | { memory_set_opbase, io_read_byte_16be, io_read_word_16be, NULL, NULL, NULL, NULL, io_write_byte_16be, io_write_word_16be, NULL, NULL, NULL, NULL } | |
| 388 | { memory_set_opbase, io_read_byte_16le, io_read_word_16le, io_read_dword_16le, NULL, io_read_qword_16le, NULL, io_write_byte_16le, io_write_word_16le, io_write_dword_16le, NULL, io_write_qword_16le, NULL }, | |
| 389 | { memory_set_opbase, io_read_byte_16be, io_read_word_16be, io_read_dword_16be, NULL, io_read_qword_16be, NULL, io_write_byte_16be, io_write_word_16be, io_write_dword_16be, NULL, io_write_qword_16be, NULL } | |
| 390 | 390 | }, |
| 391 | 391 | { |
| 392 | { memory_set_opbase, io_read_byte_32le, io_read_word_32le, io_read_dword_32le, io_read_masked_32le, NULL, NULL, io_write_byte_32le, io_write_word_32le, io_write_dword_32le, io_write_masked_32le, NULL, NULL }, | |
| 393 | { memory_set_opbase, io_read_byte_32be, io_read_word_32be, io_read_dword_32be, io_read_masked_32be, NULL, NULL, io_write_byte_32be, io_write_word_32be, io_write_dword_32be, io_write_masked_32be, NULL, NULL } | |
| 392 | { memory_set_opbase, io_read_byte_32le, io_read_word_32le, io_read_dword_32le, io_read_dword_masked_32le, io_read_qword_32le, NULL, io_write_byte_32le, io_write_word_32le, io_write_dword_32le, io_write_dword_masked_32le, io_write_qword_32le, NULL }, | |
| 393 | { memory_set_opbase, io_read_byte_32be, io_read_word_32be, io_read_dword_32be, io_read_dword_masked_32be, io_read_qword_32be, NULL, io_write_byte_32be, io_write_word_32be, io_write_dword_32be, io_write_dword_masked_32be, io_write_qword_32be, NULL } | |
| 394 | 394 | }, |
| 395 | 395 | { |
| 396 | { memory_set_opbase, io_read_byte_64le, io_read_word_64le, io_read_dword_64le, NULL, io_read_qword_64le, io_read_masked_64le, io_write_byte_64le, io_write_word_64le, io_write_dword_64le, NULL, io_write_qword_64le, io_write_masked_64le }, | |
| 397 | { memory_set_opbase, io_read_byte_64be, io_read_word_64be, io_read_dword_64be, NULL, io_read_qword_64be, io_read_masked_64be, io_write_byte_64be, io_write_word_64be, io_write_dword_64be, NULL, io_write_qword_64be, io_write_masked_64be } | |
| 396 | { memory_set_opbase, io_read_byte_64le, io_read_word_64le, io_read_dword_64le, NULL, io_read_qword_64le, io_read_qword_masked_64le, io_write_byte_64le, io_write_word_64le, io_write_dword_64le, NULL, io_write_qword_64le, io_write_qword_masked_64le }, | |
| 397 | { memory_set_opbase, io_read_byte_64be, io_read_word_64be, io_read_dword_64be, NULL, io_read_qword_64be, io_read_qword_masked_64be, io_write_byte_64be, io_write_word_64be, io_write_dword_64be, NULL, io_write_qword_64be, io_write_qword_masked_64be } | |
| 398 | 398 | } |
| 399 | 399 | }, |
| 400 | 400 | }; |
| r2375 | r2376 | |
| 428 | 428 | static void *allocate_memory_block(int cpunum, int spacenum, offs_t bytestart, offs_t byteend, void *memory); |
| 429 | 429 | static void register_for_save(int cpunum, int spacenum, offs_t bytestart, void *base, size_t numbytes); |
| 430 | 430 | static address_map_entry *assign_intersecting_blocks(addrspace_data *space, offs_t bytestart, offs_t byteend, UINT8 *base); |
| 431 | static void memory_init_locate( | |
| 431 | static void memory_init_locate(running_machine *machine); | |
| 432 | 432 | static void *memory_find_base(int cpunum, int spacenum, offs_t byteaddress); |
| 433 | 433 | static genf *get_static_handler(int databits, int readorwrite, int spacenum, int which); |
| 434 | 434 | static void memory_exit(running_machine *machine); |
| r2375 | r2376 | |
| 513 | 513 | memory_init_allocate(machine->config); |
| 514 | 514 | |
| 515 | 515 | /* find all the allocated pointers */ |
| 516 | memory_init_locate(); | |
| 516 | memory_init_locate(machine); | |
| 517 | 517 | |
| 518 | 518 | /* dump the final memory configuration */ |
| 519 | 519 | mem_dump(); |
| r2375 | r2376 | |
| 2384 | 2384 | reattach_banks - reconnect banks after a load |
| 2385 | 2385 | -------------------------------------------------*/ |
| 2386 | 2386 | |
| 2387 | static | |
| 2387 | static STATE_POSTLOAD( reattach_banks | |
| 2388 | 2388 | { |
| 2389 | 2389 | int banknum; |
| 2390 | 2390 | |
| r2375 | r2376 | |
| 2404 | 2404 | into the final allocated memory |
| 2405 | 2405 | -------------------------------------------------*/ |
| 2406 | 2406 | |
| 2407 | static void memory_init_locate( | |
| 2407 | static void memory_init_locate(running_machine *machine) | |
| 2408 | 2408 | { |
| 2409 | 2409 | int cpunum, spacenum, banknum; |
| 2410 | 2410 | |
| r2375 | r2376 | |
| 2452 | 2452 | } |
| 2453 | 2453 | |
| 2454 | 2454 | /* request a callback to fix up the banks when done */ |
| 2455 | state_save_register_ | |
| 2455 | state_save_register_ | |
| 2456 | 2456 | } |
| 2457 | 2457 | |
| 2458 | 2458 | |
| r2375 | r2376 | |
| 2494 | 2494 | } |
| 2495 | 2495 | |
| 2496 | 2496 | |
| 2497 | /*------------------------------------------------- | |
| 2498 | PERFORM_LOOKUP - common lookup procedure | |
| 2499 | -------------------------------------------------*/ | |
| 2500 | 2497 | |
| 2501 | #define PERFORM_LOOKUP(lookup,handlers,spacenum,extraand) \ | |
| 2502 | /* perform lookup */ \ | |
| 2503 | address &= active_address_space[spacenum].bytemask & extraand; \ | |
| 2504 | entry = active_address_space[spacenum].lookup[LEVEL1_INDEX(address)]; \ | |
| 2505 | if (entry >= SUBTABLE_BASE) \ | |
| 2506 | entry = active_address_space[spacenum].lookup[LEVEL2_INDEX(entry,address)]; \ | |
| 2507 | handler = &active_address_space[spacenum].handlers[entry]; \ | |
| 2508 | ||
| 2509 | ||
| 2510 | 2498 | /*------------------------------------------------- |
| 2511 | READBYTE - generic byte-sized read handler | |
| 2512 | -------------------------------------------------*/ | |
| 2513 | ||
| 2514 | #define READBYTE8(name,spacenum) \ | |
| 2515 | UINT8 name(offs_t original_address) \ | |
| 2516 | { \ | |
| 2517 | offs_t address = original_address; \ | |
| 2518 | const handler_data *handler; \ | |
| 2519 | UINT32 entry; \ | |
| 2520 | MEMREADSTART(); \ | |
| 2521 | PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~0); \ | |
| 2522 | DEBUG_HOOK_READ(spacenum, address, 0xff); \ | |
| 2523 | \ | |
| 2524 | /* handle banks inline */ \ | |
| 2525 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2526 | if (entry < STATIC_RAM) \ | |
| 2527 | MEMREADEND(bank_ptr[entry][address]); \ | |
| 2528 | \ | |
| 2529 | /* fall back to the handler */ \ | |
| 2530 | else \ | |
| 2531 | MEMREADEND((*handler->handler.read.mhandler8)(handler->object, address)); \ | |
| 2532 | } \ | |
| 2533 | ||
| 2534 | #define READBYTE(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype) \ | |
| 2535 | UINT8 name(offs_t original_address) \ | |
| 2536 | { \ | |
| 2537 | offs_t address = original_address; \ | |
| 2538 | const handler_data *handler; \ | |
| 2539 | UINT32 entry; \ | |
| 2540 | MEMREADSTART(); \ | |
| 2541 | PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~0); \ | |
| 2542 | DEBUG_HOOK_READ(spacenum, address - xormacro(shiftbytes), (masktype)0xff << (8 * (shiftbytes))); \ | |
| 2543 | \ | |
| 2544 | /* handle banks inline */ \ | |
| 2545 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2546 | if (entry < STATIC_RAM) \ | |
| 2547 | MEMREADEND(bank_ptr[entry][xormacro(address)]); \ | |
| 2548 | \ | |
| 2549 | /* fall back to the handler */ \ | |
| 2550 | else \ | |
| 2551 | { \ | |
| 2552 | int shift = 8 * (shiftbytes); \ | |
| 2553 | MEMREADEND((*handler->handler.read.handlertype)(handler->object, address >> (ignorebits), ~((masktype)0xff << shift)) >> shift);\ | |
| 2554 | } \ | |
| 2555 | } \ | |
| 2556 | ||
| 2557 | #define READBYTE16BE(name,space) READBYTE(name,space,BYTE_XOR_BE, mhandler16,1,~address & 1,UINT16) | |
| 2558 | #define READBYTE16LE(name,space) READBYTE(name,space,BYTE_XOR_LE, mhandler16,1, address & 1,UINT16) | |
| 2559 | #define READBYTE32BE(name,space) READBYTE(name,space,BYTE4_XOR_BE,mhandler32,2,~address & 3,UINT32) | |
| 2560 | #define READBYTE32LE(name,space) READBYTE(name,space,BYTE4_XOR_LE,mhandler32,2, address & 3,UINT32) | |
| 2561 | #define READBYTE64BE(name,space) READBYTE(name,space,BYTE8_XOR_BE,mhandler64,3,~address & 7,UINT64) | |
| 2562 | #define READBYTE64LE(name,space) READBYTE(name,space,BYTE8_XOR_LE,mhandler64,3, address & 7,UINT64) | |
| 2563 | ||
| 2564 | ||
| 2565 | /*------------------------------------------------- | |
| 2566 | READWORD - generic word-sized read handler | |
| 2567 | (16-bit, 32-bit and 64-bit aligned only!) | |
| 2568 | -------------------------------------------------*/ | |
| 2569 | ||
| 2570 | #define READWORD16(name,spacenum) \ | |
| 2571 | UINT16 name(offs_t original_address) \ | |
| 2572 | { \ | |
| 2573 | offs_t address = original_address; \ | |
| 2574 | const handler_data *handler; \ | |
| 2575 | UINT32 entry; \ | |
| 2576 | MEMREADSTART(); \ | |
| 2577 | PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~1); \ | |
| 2578 | DEBUG_HOOK_READ(spacenum, address, 0xffff); \ | |
| 2579 | \ | |
| 2580 | /* handle banks inline */ \ | |
| 2581 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2582 | if (entry < STATIC_RAM) \ | |
| 2583 | MEMREADEND(*(UINT16 *)&bank_ptr[entry][address]); \ | |
| 2584 | \ | |
| 2585 | /* fall back to the handler */ \ | |
| 2586 | else \ | |
| 2587 | MEMREADEND((*handler->handler.read.mhandler16)(handler->object, address >> 1, 0));\ | |
| 2588 | } \ | |
| 2589 | ||
| 2590 | #define READWORD(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype) \ | |
| 2591 | UINT16 name(offs_t original_address) \ | |
| 2592 | { \ | |
| 2593 | offs_t address = original_address; \ | |
| 2594 | const handler_data *handler; \ | |
| 2595 | UINT32 entry; \ | |
| 2596 | MEMREADSTART(); \ | |
| 2597 | PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~1); \ | |
| 2598 | DEBUG_HOOK_READ(spacenum, address - xormacro(shiftbytes), (masktype)0xffff << (8 * (shiftbytes))); \ | |
| 2599 | \ | |
| 2600 | /* handle banks inline */ \ | |
| 2601 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2602 | if (entry < STATIC_RAM) \ | |
| 2603 | MEMREADEND(*(UINT16 *)&bank_ptr[entry][xormacro(address)]); \ | |
| 2604 | \ | |
| 2605 | /* fall back to the handler */ \ | |
| 2606 | else \ | |
| 2607 | { \ | |
| 2608 | int shift = 8 * (shiftbytes); \ | |
| 2609 | MEMREADEND((*handler->handler.read.handlertype)(handler->object, address >> (ignorebits), ~((masktype)0xffff << shift)) >> shift);\ | |
| 2610 | } \ | |
| 2611 | } \ | |
| 2612 | ||
| 2613 | #define READWORD32BE(name,space) READWORD(name,space,WORD_XOR_BE, mhandler32,2,~address & 2,UINT32) | |
| 2614 | #define READWORD32LE(name,space) READWORD(name,space,WORD_XOR_LE, mhandler32,2, address & 2,UINT32) | |
| 2615 | #define READWORD64BE(name,space) READWORD(name,space,WORD2_XOR_BE,mhandler64,3,~address & 6,UINT64) | |
| 2616 | #define READWORD64LE(name,space) READWORD(name,space,WORD2_XOR_LE,mhandler64,3, address & 6,UINT64) | |
| 2617 | ||
| 2618 | ||
| 2619 | /*------------------------------------------------- | |
| 2620 | READDWORD - generic dword-sized read handler | |
| 2621 | (32-bit and 64-bit aligned only!) | |
| 2622 | -------------------------------------------------*/ | |
| 2623 | ||
| 2624 | #define READDWORD32(name,spacenum) \ | |
| 2625 | UINT32 name(offs_t original_address) \ | |
| 2626 | { \ | |
| 2627 | offs_t address = original_address; \ | |
| 2628 | const handler_data *handler; \ | |
| 2629 | UINT32 entry; \ | |
| 2630 | MEMREADSTART(); \ | |
| 2631 | PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~3); \ | |
| 2632 | DEBUG_HOOK_READ(spacenum, address, 0xffffffff); \ | |
| 2633 | \ | |
| 2634 | /* handle banks inline */ \ | |
| 2635 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2636 | if (entry < STATIC_RAM) \ | |
| 2637 | MEMREADEND(*(UINT32 *)&bank_ptr[entry][address]); \ | |
| 2638 | \ | |
| 2639 | /* fall back to the handler */ \ | |
| 2640 | else \ | |
| 2641 | MEMREADEND((*handler->handler.read.mhandler32)(handler->object, address >> 2, 0));\ | |
| 2642 | } \ | |
| 2643 | ||
| 2644 | #define READMASKED32(name,spacenum) \ | |
| 2645 | UINT32 name(offs_t original_address, UINT32 mem_mask) \ | |
| 2646 | { \ | |
| 2647 | offs_t address = original_address; \ | |
| 2648 | const handler_data *handler; \ | |
| 2649 | UINT32 entry; \ | |
| 2650 | MEMREADSTART(); \ | |
| 2651 | PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~3); \ | |
| 2652 | DEBUG_HOOK_READ(spacenum, address, ~mem_mask); \ | |
| 2653 | \ | |
| 2654 | /* handle banks inline */ \ | |
| 2655 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2656 | if (entry < STATIC_RAM) \ | |
| 2657 | MEMREADEND(*(UINT32 *)&bank_ptr[entry][address]); \ | |
| 2658 | \ | |
| 2659 | /* fall back to the handler */ \ | |
| 2660 | else \ | |
| 2661 | MEMREADEND((*handler->handler.read.mhandler32)(handler->object, address >> 2, mem_mask));\ | |
| 2662 | } \ | |
| 2663 | ||
| 2664 | #define READDWORD(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype) \ | |
| 2665 | UINT32 name(offs_t original_address) \ | |
| 2666 | { \ | |
| 2667 | offs_t address = original_address; \ | |
| 2668 | const handler_data *handler; \ | |
| 2669 | UINT32 entry; \ | |
| 2670 | MEMREADSTART(); \ | |
| 2671 | PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~3); \ | |
| 2672 | DEBUG_HOOK_READ(spacenum, address - xormacro(shiftbytes), (masktype)0xffffffff << (8 * (shiftbytes))); \ | |
| 2673 | \ | |
| 2674 | /* handle banks inline */ \ | |
| 2675 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2676 | if (entry < STATIC_RAM) \ | |
| 2677 | MEMREADEND(*(UINT32 *)&bank_ptr[entry][xormacro(address)]); \ | |
| 2678 | \ | |
| 2679 | /* fall back to the handler */ \ | |
| 2680 | else \ | |
| 2681 | { \ | |
| 2682 | int shift = 8 * (shiftbytes); \ | |
| 2683 | MEMREADEND((*handler->handler.read.handlertype)(handler->object, address >> (ignorebits), ~((masktype)0xffffffff << shift)) >> shift);\ | |
| 2684 | } \ | |
| 2685 | } \ | |
| 2686 | ||
| 2687 | #define READDWORD64BE(name,space) READDWORD(name,space,DWORD_XOR_BE,mhandler64,3,~address & 4,UINT64) | |
| 2688 | #define READDWORD64LE(name,space) READDWORD(name,space,DWORD_XOR_LE,mhandler64,3, address & 4,UINT64) | |
| 2689 | ||
| 2690 | ||
| 2691 | /*------------------------------------------------- | |
| 2692 | READQWORD - generic qword-sized read handler | |
| 2693 | (64-bit aligned only!) | |
| 2694 | -------------------------------------------------*/ | |
| 2695 | ||
| 2696 | #define READQWORD64(name,spacenum) \ | |
| 2697 | UINT64 name(offs_t original_address) \ | |
| 2698 | { \ | |
| 2699 | offs_t address = original_address; \ | |
| 2700 | const handler_data *handler; \ | |
| 2701 | UINT32 entry; \ | |
| 2702 | MEMREADSTART(); \ | |
| 2703 | PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~7); \ | |
| 2704 | DEBUG_HOOK_READ(spacenum, address, ~(UINT64)0); \ | |
| 2705 | \ | |
| 2706 | /* handle banks inline */ \ | |
| 2707 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2708 | if (entry < STATIC_RAM) \ | |
| 2709 | MEMREADEND(*(UINT64 *)&bank_ptr[entry][address]); \ | |
| 2710 | \ | |
| 2711 | /* fall back to the handler */ \ | |
| 2712 | else \ | |
| 2713 | MEMREADEND((*handler->handler.read.mhandler64)(handler->object, address >> 3, 0));\ | |
| 2714 | } \ | |
| 2715 | ||
| 2716 | #define READMASKED64(name,spacenum) \ | |
| 2717 | UINT64 name(offs_t original_address, UINT64 mem_mask) \ | |
| 2718 | { \ | |
| 2719 | offs_t address = original_address; \ | |
| 2720 | const handler_data *handler; \ | |
| 2721 | UINT32 entry; \ | |
| 2722 | MEMREADSTART(); \ | |
| 2723 | PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~7); \ | |
| 2724 | DEBUG_HOOK_READ(spacenum, address, ~mem_mask); \ | |
| 2725 | \ | |
| 2726 | /* handle banks inline */ \ | |
| 2727 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2728 | if (entry < STATIC_RAM) \ | |
| 2729 | MEMREADEND(*(UINT64 *)&bank_ptr[entry][address]); \ | |
| 2730 | \ | |
| 2731 | /* fall back to the handler */ \ | |
| 2732 | else \ | |
| 2733 | MEMREADEND((*handler->handler.read.mhandler64)(handler->object, address >> 3, mem_mask));\ | |
| 2734 | } \ | |
| 2735 | ||
| 2736 | ||
| 2737 | /*------------------------------------------------- | |
| 2738 | WRITEBYTE - generic byte-sized write handler | |
| 2739 | -------------------------------------------------*/ | |
| 2740 | ||
| 2741 | #define WRITEBYTE8(name,spacenum) \ | |
| 2742 | void name(offs_t original_address, UINT8 data) \ | |
| 2743 | { \ | |
| 2744 | offs_t address = original_address; \ | |
| 2745 | const handler_data *handler; \ | |
| 2746 | UINT32 entry; \ | |
| 2747 | MEMWRITESTART(); \ | |
| 2748 | PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~0); \ | |
| 2749 | DEBUG_HOOK_WRITE(spacenum, address, data, 0xff); \ | |
| 2750 | \ | |
| 2751 | /* handle banks inline */ \ | |
| 2752 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2753 | if (entry < STATIC_RAM) \ | |
| 2754 | MEMWRITEEND(bank_ptr[entry][address] = data); \ | |
| 2755 | \ | |
| 2756 | /* fall back to the handler */ \ | |
| 2757 | else \ | |
| 2758 | MEMWRITEEND((*handler->handler.write.mhandler8)(handler->object, address, data));\ | |
| 2759 | } \ | |
| 2760 | ||
| 2761 | #define WRITEBYTE(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype) \ | |
| 2762 | void name(offs_t original_address, UINT8 data) \ | |
| 2763 | { \ | |
| 2764 | offs_t address = original_address; \ | |
| 2765 | const handler_data *handler; \ | |
| 2766 | UINT32 entry; \ | |
| 2767 | MEMWRITESTART(); \ | |
| 2768 | PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~0); \ | |
| 2769 | DEBUG_HOOK_WRITE(spacenum, address - xormacro(shiftbytes), (masktype)data << (8 * (shiftbytes)), (masktype)0xff << (8 * (shiftbytes))); \ | |
| 2770 | \ | |
| 2771 | /* handle banks inline */ \ | |
| 2772 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2773 | if (entry < STATIC_RAM) \ | |
| 2774 | MEMWRITEEND(bank_ptr[entry][xormacro(address)] = data); \ | |
| 2775 | \ | |
| 2776 | /* fall back to the handler */ \ | |
| 2777 | else \ | |
| 2778 | { \ | |
| 2779 | int shift = 8 * (shiftbytes); \ | |
| 2780 | MEMWRITEEND((*handler->handler.write.handlertype)(handler->object, address >> (ignorebits), (masktype)data << shift, ~((masktype)0xff << shift)));\ | |
| 2781 | } \ | |
| 2782 | } \ | |
| 2783 | ||
| 2784 | #define WRITEBYTE16BE(name,space) WRITEBYTE(name,space,BYTE_XOR_BE, mhandler16,1,~address & 1,UINT16) | |
| 2785 | #define WRITEBYTE16LE(name,space) WRITEBYTE(name,space,BYTE_XOR_LE, mhandler16,1, address & 1,UINT16) | |
| 2786 | #define WRITEBYTE32BE(name,space) WRITEBYTE(name,space,BYTE4_XOR_BE,mhandler32,2,~address & 3,UINT32) | |
| 2787 | #define WRITEBYTE32LE(name,space) WRITEBYTE(name,space,BYTE4_XOR_LE,mhandler32,2, address & 3,UINT32) | |
| 2788 | #define WRITEBYTE64BE(name,space) WRITEBYTE(name,space,BYTE8_XOR_BE,mhandler64,3,~address & 7,UINT64) | |
| 2789 | #define WRITEBYTE64LE(name,space) WRITEBYTE(name,space,BYTE8_XOR_LE,mhandler64,3, address & 7,UINT64) | |
| 2790 | ||
| 2791 | ||
| 2792 | /*------------------------------------------------- | |
| 2793 | WRITEWORD - generic word-sized write handler | |
| 2794 | (16-bit, 32-bit and 64-bit aligned only!) | |
| 2795 | -------------------------------------------------*/ | |
| 2796 | ||
| 2797 | #define WRITEWORD16(name,spacenum) \ | |
| 2798 | void name(offs_t original_address, UINT16 data) \ | |
| 2799 | { \ | |
| 2800 | offs_t address = original_address; \ | |
| 2801 | const handler_data *handler; \ | |
| 2802 | UINT32 entry; \ | |
| 2803 | MEMWRITESTART(); \ | |
| 2804 | PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~1); \ | |
| 2805 | DEBUG_HOOK_WRITE(spacenum, address, data, 0xffff); \ | |
| 2806 | \ | |
| 2807 | /* handle banks inline */ \ | |
| 2808 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2809 | if (entry < STATIC_RAM) \ | |
| 2810 | MEMWRITEEND(*(UINT16 *)&bank_ptr[entry][address] = data); \ | |
| 2811 | \ | |
| 2812 | /* fall back to the handler */ \ | |
| 2813 | else \ | |
| 2814 | MEMWRITEEND((*handler->handler.write.mhandler16)(handler->object, address >> 1, data, 0));\ | |
| 2815 | } \ | |
| 2816 | ||
| 2817 | #define WRITEWORD(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype) \ | |
| 2818 | void name(offs_t original_address, UINT16 data) \ | |
| 2819 | { \ | |
| 2820 | offs_t address = original_address; \ | |
| 2821 | const handler_data *handler; \ | |
| 2822 | UINT32 entry; \ | |
| 2823 | MEMWRITESTART(); \ | |
| 2824 | PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~1); \ | |
| 2825 | DEBUG_HOOK_WRITE(spacenum, address - xormacro(shiftbytes), (masktype)data << (8 * (shiftbytes)), (masktype)0xffff << (8 * (shiftbytes))); \ | |
| 2826 | \ | |
| 2827 | /* handle banks inline */ \ | |
| 2828 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2829 | if (entry < STATIC_RAM) \ | |
| 2830 | MEMWRITEEND(*(UINT16 *)&bank_ptr[entry][xormacro(address)] = data); \ | |
| 2831 | \ | |
| 2832 | /* fall back to the handler */ \ | |
| 2833 | else \ | |
| 2834 | { \ | |
| 2835 | int shift = 8 * (shiftbytes); \ | |
| 2836 | MEMWRITEEND((*handler->handler.write.handlertype)(handler->object, address >> (ignorebits), (masktype)data << shift, ~((masktype)0xffff << shift)));\ | |
| 2837 | } \ | |
| 2838 | } \ | |
| 2839 | ||
| 2840 | #define WRITEWORD32BE(name,space) WRITEWORD(name,space,WORD_XOR_BE, mhandler32,2,~address & 2,UINT32) | |
| 2841 | #define WRITEWORD32LE(name,space) WRITEWORD(name,space,WORD_XOR_LE, mhandler32,2, address & 2,UINT32) | |
| 2842 | #define WRITEWORD64BE(name,space) WRITEWORD(name,space,WORD2_XOR_BE,mhandler64,3,~address & 6,UINT64) | |
| 2843 | #define WRITEWORD64LE(name,space) WRITEWORD(name,space,WORD2_XOR_LE,mhandler64,3, address & 6,UINT64) | |
| 2844 | ||
| 2845 | ||
| 2846 | /*------------------------------------------------- | |
| 2847 | WRITEDWORD - dword-sized write handler | |
| 2848 | (32-bit and 64-bit aligned only!) | |
| 2849 | -------------------------------------------------*/ | |
| 2850 | ||
| 2851 | #define WRITEDWORD32(name,spacenum) \ | |
| 2852 | void name(offs_t original_address, UINT32 data) \ | |
| 2853 | { \ | |
| 2854 | offs_t address = original_address; \ | |
| 2855 | const handler_data *handler; \ | |
| 2856 | UINT32 entry; \ | |
| 2857 | MEMWRITESTART(); \ | |
| 2858 | PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~3); \ | |
| 2859 | DEBUG_HOOK_WRITE(spacenum, address, data, 0xffffffff); \ | |
| 2860 | \ | |
| 2861 | /* handle banks inline */ \ | |
| 2862 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2863 | if (entry < STATIC_RAM) \ | |
| 2864 | MEMWRITEEND(*(UINT32 *)&bank_ptr[entry][address] = data); \ | |
| 2865 | \ | |
| 2866 | /* fall back to the handler */ \ | |
| 2867 | else \ | |
| 2868 | MEMWRITEEND((*handler->handler.write.mhandler32)(handler->object, address >> 2, data, 0));\ | |
| 2869 | } \ | |
| 2870 | ||
| 2871 | #define WRITEMASKED32(name,spacenum) \ | |
| 2872 | void name(offs_t original_address, UINT32 data, UINT32 mem_mask) \ | |
| 2873 | { \ | |
| 2874 | offs_t address = original_address; \ | |
| 2875 | const handler_data *handler; \ | |
| 2876 | UINT32 entry; \ | |
| 2877 | MEMWRITESTART(); \ | |
| 2878 | PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~3); \ | |
| 2879 | DEBUG_HOOK_WRITE(spacenum, address, data, ~mem_mask); \ | |
| 2880 | \ | |
| 2881 | /* handle banks inline */ \ | |
| 2882 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2883 | if (entry < STATIC_RAM) \ | |
| 2884 | { \ | |
| 2885 | UINT32 *dest = (UINT32 *)&bank_ptr[entry][address]; \ | |
| 2886 | MEMWRITEEND(*dest = (*dest & mem_mask) | (data & ~mem_mask)); \ | |
| 2887 | } \ | |
| 2888 | \ | |
| 2889 | /* fall back to the handler */ \ | |
| 2890 | else \ | |
| 2891 | MEMWRITEEND((*handler->handler.write.mhandler32)(handler->object, address >> 2, data, mem_mask));\ | |
| 2892 | } \ | |
| 2893 | ||
| 2894 | #define WRITEDWORD(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype) \ | |
| 2895 | void name(offs_t original_address, UINT32 data) \ | |
| 2896 | { \ | |
| 2897 | offs_t address = original_address; \ | |
| 2898 | const handler_data *handler; \ | |
| 2899 | UINT32 entry; \ | |
| 2900 | MEMWRITESTART(); \ | |
| 2901 | PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~3); \ | |
| 2902 | DEBUG_HOOK_WRITE(spacenum, address - xormacro(shiftbytes), (masktype)data << (8 * (shiftbytes)), (masktype)0xffffffff << (8 * (shiftbytes))); \ | |
| 2903 | \ | |
| 2904 | /* handle banks inline */ \ | |
| 2905 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2906 | if (entry < STATIC_RAM) \ | |
| 2907 | MEMWRITEEND(*(UINT32 *)&bank_ptr[entry][xormacro(address)] = data); \ | |
| 2908 | \ | |
| 2909 | /* fall back to the handler */ \ | |
| 2910 | else \ | |
| 2911 | { \ | |
| 2912 | int shift = 8 * (shiftbytes); \ | |
| 2913 | MEMWRITEEND((*handler->handler.write.handlertype)(handler->object, address >> (ignorebits), (masktype)data << shift, ~((masktype)0xffffffff << shift)));\ | |
| 2914 | } \ | |
| 2915 | } \ | |
| 2916 | ||
| 2917 | #define WRITEDWORD64BE(name,space) WRITEDWORD(name,space,DWORD_XOR_BE,mhandler64,3,~address & 4,UINT64) | |
| 2918 | #define WRITEDWORD64LE(name,space) WRITEDWORD(name,space,DWORD_XOR_LE,mhandler64,3, address & 4,UINT64) | |
| 2919 | ||
| 2920 | ||
| 2921 | /*------------------------------------------------- | |
| 2922 | WRITEQWORD - qword-sized write handler | |
| 2923 | (64-bit aligned only!) | |
| 2924 | -------------------------------------------------*/ | |
| 2925 | ||
| 2926 | #define WRITEQWORD64(name,spacenum) \ | |
| 2927 | void name(offs_t original_address, UINT64 data) \ | |
| 2928 | { \ | |
| 2929 | offs_t address = original_address; \ | |
| 2930 | const handler_data *handler; \ | |
| 2931 | UINT32 entry; \ | |
| 2932 | MEMWRITESTART(); \ | |
| 2933 | PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~7); \ | |
| 2934 | DEBUG_HOOK_WRITE(spacenum, address, data, ~(UINT64)0); \ | |
| 2935 | \ | |
| 2936 | /* handle banks inline */ \ | |
| 2937 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2938 | if (entry < STATIC_RAM) \ | |
| 2939 | MEMWRITEEND(*(UINT64 *)&bank_ptr[entry][address] = data); \ | |
| 2940 | \ | |
| 2941 | /* fall back to the handler */ \ | |
| 2942 | else \ | |
| 2943 | MEMWRITEEND((*handler->handler.write.mhandler64)(handler->object, address >> 3, data, 0));\ | |
| 2944 | } \ | |
| 2945 | ||
| 2946 | #define WRITEMASKED64(name,spacenum) \ | |
| 2947 | void name(offs_t original_address, UINT64 data, UINT64 mem_mask) \ | |
| 2948 | { \ | |
| 2949 | offs_t address = original_address; \ | |
| 2950 | const handler_data *handler; \ | |
| 2951 | UINT32 entry; \ | |
| 2952 | MEMWRITESTART(); \ | |
| 2953 | PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~7); \ | |
| 2954 | DEBUG_HOOK_WRITE(spacenum, address, data, ~mem_mask); \ | |
| 2955 | \ | |
| 2956 | /* handle banks inline */ \ | |
| 2957 | address = (address - handler->bytestart) & handler->bytemask; \ | |
| 2958 | if (entry < STATIC_RAM) \ | |
| 2959 | { \ | |
| 2960 | UINT64 *dest = (UINT64 *)&bank_ptr[entry][address]; \ | |
| 2961 | MEMWRITEEND(*dest = (*dest & mem_mask) | (data & ~mem_mask)); \ | |
| 2962 | } \ | |
| 2963 | \ | |
| 2964 | /* fall back to the handler */ \ | |
| 2965 | else \ | |
| 2966 | MEMWRITEEND((*handler->handler.write.mhandler64)(handler->object, address >> 3, data, mem_mask));\ | |
| 2967 | } \ | |
| 2968 | ||
| 2969 | ||
| 2970 | /*------------------------------------------------- | |
| 2971 | Program memory handlers | |
| 2972 | -------------------------------------------------*/ | |
| 2973 | ||
| 2974 | READBYTE8(program_read_byte_8, ADDRESS_SPACE_PROGRAM) | |
| 2975 | WRITEBYTE8(program_write_byte_8, ADDRESS_SPACE_PROGRAM) | |
| 2976 | ||
| 2977 | READBYTE16BE(program_read_byte_16be, ADDRESS_SPACE_PROGRAM) | |
| 2978 | READWORD16(program_read_word_16be, ADDRESS_SPACE_PROGRAM) | |
| 2979 | WRITEBYTE16BE(program_write_byte_16be, ADDRESS_SPACE_PROGRAM) | |
| 2980 | WRITEWORD16(program_write_word_16be, ADDRESS_SPACE_PROGRAM) | |
| 2981 | ||
| 2982 | READBYTE16LE(program_read_byte_16le, ADDRESS_SPACE_PROGRAM) | |
| 2983 | READWORD16(program_read_word_16le, ADDRESS_SPACE_PROGRAM) | |
| 2984 | WRITEBYTE16LE(program_write_byte_16le, ADDRESS_SPACE_PROGRAM) | |
| 2985 | WRITEWORD16(program_write_word_16le, ADDRESS_SPACE_PROGRAM) | |
| 2986 | ||
| 2987 | READBYTE32BE(program_read_byte_32be, ADDRESS_SPACE_PROGRAM) | |
| 2988 | READWORD32BE(program_read_word_32be, ADDRESS_SPACE_PROGRAM) | |
| 2989 | READDWORD32(program_read_dword_32be, ADDRESS_SPACE_PROGRAM) | |
| 2990 | READMASKED32(program_read_masked_32be, ADDRESS_SPACE_PROGRAM) | |
| 2991 | WRITEBYTE32BE(program_write_byte_32be, ADDRESS_SPACE_PROGRAM) | |
| 2992 | WRITEWORD32BE(program_write_word_32be, ADDRESS_SPACE_PROGRAM) | |
| 2993 | WRITEDWORD32(program_write_dword_32be, ADDRESS_SPACE_PROGRAM) | |
| 2994 | WRITEMASKED32(program_write_masked_32be,ADDRESS_SPACE_PROGRAM) | |
| 2995 | ||
| 2996 | READBYTE32LE(program_read_byte_32le, ADDRESS_SPACE_PROGRAM) | |
| 2997 | READWORD32LE(program_read_word_32le, ADDRESS_SPACE_PROGRAM) | |
| 2998 | READDWORD32(program_read_dword_32le, ADDRESS_SPACE_PROGRAM) | |
| 2999 | READMASKED32(program_read_masked_32le, ADDRESS_SPACE_PROGRAM) | |
| 3000 | WRITEBYTE32LE(program_write_byte_32le, ADDRESS_SPACE_PROGRAM) | |
| 3001 | WRITEWORD32LE(program_write_word_32le, ADDRESS_SPACE_PROGRAM) | |
| 3002 | WRITEDWORD32(program_write_dword_32le, ADDRESS_SPACE_PROGRAM) | |
| 3003 | WRITEMASKED32(program_write_masked_32le,ADDRESS_SPACE_PROGRAM) | |
| 3004 | ||
| 3005 | READBYTE64BE(program_read_byte_64be, ADDRESS_SPACE_PROGRAM) | |
| 3006 | READWORD64BE(program_read_word_64be, ADDRESS_SPACE_PROGRAM) | |
| 3007 | READDWORD64BE(program_read_dword_64be, ADDRESS_SPACE_PROGRAM) | |
| 3008 | READQWORD64(program_read_qword_64be, ADDRESS_SPACE_PROGRAM) | |
| 3009 | READMASKED64(program_read_masked_64be, ADDRESS_SPACE_PROGRAM) | |
| 3010 | WRITEBYTE64BE(program_write_byte_64be, ADDRESS_SPACE_PROGRAM) | |
| 3011 | WRITEWORD64BE(program_write_word_64be, ADDRESS_SPACE_PROGRAM) | |
| 3012 | WRITEDWORD64BE(program_write_dword_64be, ADDRESS_SPACE_PROGRAM) | |
| 3013 | WRITEQWORD64(program_write_qword_64be, ADDRESS_SPACE_PROGRAM) | |
| 3014 | WRITEMASKED64(program_write_masked_64be,ADDRESS_SPACE_PROGRAM) | |
| 3015 | ||
| 3016 | READBYTE64LE(program_read_byte_64le, ADDRESS_SPACE_PROGRAM) | |
| 3017 | READWORD64LE(program_read_word_64le, ADDRESS_SPACE_PROGRAM) | |
| 3018 | READDWORD64LE(program_read_dword_64le, ADDRESS_SPACE_PROGRAM) | |
| 3019 | READQWORD64(program_read_qword_64le, ADDRESS_SPACE_PROGRAM) | |
| 3020 | READMASKED64(program_read_masked_64le, ADDRESS_SPACE_PROGRAM) | |
| 3021 | WRITEBYTE64LE(program_write_byte_64le, ADDRESS_SPACE_PROGRAM) | |
| 3022 | WRITEWORD64LE(program_write_word_64le, ADDRESS_SPACE_PROGRAM) | |
| 3023 | WRITEDWORD64LE(program_write_dword_64le, ADDRESS_SPACE_PROGRAM) | |
| 3024 | WRITEQWORD64(program_write_qword_64le, ADDRESS_SPACE_PROGRAM) | |
| 3025 | WRITEMASKED64(program_write_masked_64le,ADDRESS_SPACE_PROGRAM) | |
| 3026 | ||
| 3027 | ||
| 3028 | /*------------------------------------------------- | |
| 3029 | Data memory handlers | |
| 3030 | -------------------------------------------------*/ | |
| 3031 | ||
| 3032 | READBYTE8(data_read_byte_8, ADDRESS_SPACE_DATA) | |
| 3033 | WRITEBYTE8(data_write_byte_8, ADDRESS_SPACE_DATA) | |
| 3034 | ||
| 3035 | READBYTE16BE(data_read_byte_16be, ADDRESS_SPACE_DATA) | |
| 3036 | READWORD16(data_read_word_16be, ADDRESS_SPACE_DATA) | |
| 3037 | WRITEBYTE16BE(data_write_byte_16be, ADDRESS_SPACE_DATA) | |
| 3038 | WRITEWORD16(data_write_word_16be, ADDRESS_SPACE_DATA) | |
| 3039 | ||
| 3040 | READBYTE16LE(data_read_byte_16le, ADDRESS_SPACE_DATA) | |
| 3041 | READWORD16(data_read_word_16le, ADDRESS_SPACE_DATA) | |
| 3042 | WRITEBYTE16LE(data_write_byte_16le, ADDRESS_SPACE_DATA) | |
| 3043 | WRITEWORD16(data_write_word_16le, ADDRESS_SPACE_DATA) | |
| 3044 | ||
| 3045 | READBYTE32BE(data_read_byte_32be, ADDRESS_SPACE_DATA) | |
| 3046 | READWORD32BE(data_read_word_32be, ADDRESS_SPACE_DATA) | |
| 3047 | READDWORD32(data_read_dword_32be, ADDRESS_SPACE_DATA) | |
| 3048 | READMASKED32(data_read_masked_32be, ADDRESS_SPACE_DATA) | |
| 3049 | WRITEBYTE32BE(data_write_byte_32be, ADDRESS_SPACE_DATA) | |
| 3050 | WRITEWORD32BE(data_write_word_32be, ADDRESS_SPACE_DATA) | |
| 3051 | WRITEDWORD32(data_write_dword_32be, ADDRESS_SPACE_DATA) | |
| 3052 | WRITEMASKED32(data_write_masked_32be,ADDRESS_SPACE_DATA) | |
| 3053 | ||
| 3054 | READBYTE32LE(data_read_byte_32le, ADDRESS_SPACE_DATA) | |
| 3055 | READWORD32LE(data_read_word_32le, ADDRESS_SPACE_DATA) | |
| 3056 | READDWORD32(data_read_dword_32le, ADDRESS_SPACE_DATA) | |
| 3057 | READMASKED32(data_read_masked_32le, ADDRESS_SPACE_DATA) | |
| 3058 | WRITEBYTE32LE(data_write_byte_32le, ADDRESS_SPACE_DATA) | |
| 3059 | WRITEWORD32LE(data_write_word_32le, ADDRESS_SPACE_DATA) | |
| 3060 | WRITEDWORD32(data_write_dword_32le, ADDRESS_SPACE_DATA) | |
| 3061 | WRITEMASKED32(data_write_masked_32le,ADDRESS_SPACE_DATA) | |
| 3062 | ||
| 3063 | READBYTE64BE(data_read_byte_64be, ADDRESS_SPACE_DATA) | |
| 3064 | READWORD64BE(data_read_word_64be, ADDRESS_SPACE_DATA) | |
| 3065 | READDWORD64BE(data_read_dword_64be, ADDRESS_SPACE_DATA) | |
| 3066 | READQWORD64(data_read_qword_64be, ADDRESS_SPACE_DATA) | |
| 3067 | READMASKED64(data_read_masked_64be, ADDRESS_SPACE_DATA) | |
| 3068 | WRITEBYTE64BE(data_write_byte_64be, ADDRESS_SPACE_DATA) | |
| 3069 | WRITEWORD64BE(data_write_word_64be, ADDRESS_SPACE_DATA) | |
| 3070 | WRITEDWORD64BE(data_write_dword_64be, ADDRESS_SPACE_DATA) | |
| 3071 | WRITEQWORD64(data_write_qword_64be, ADDRESS_SPACE_DATA) | |
| 3072 | WRITEMASKED64(data_write_masked_64be,ADDRESS_SPACE_DATA) | |
| 3073 | ||
| 3074 | READBYTE64LE(data_read_byte_64le, ADDRESS_SPACE_DATA) | |
| 3075 | READWORD64LE(data_read_word_64le, ADDRESS_SPACE_DATA) | |
| 3076 | READDWORD64LE(data_read_dword_64le, ADDRESS_SPACE_DATA) | |
| 3077 | READQWORD64(data_read_qword_64le, ADDRESS_SPACE_DATA) | |
| 3078 | READMASKED64(data_read_masked_64le, ADDRESS_SPACE_DATA) | |
| 3079 | WRITEBYTE64LE(data_write_byte_64le, ADDRESS_SPACE_DATA) | |
| 3080 | WRITEWORD64LE(data_write_word_64le, ADDRESS_SPACE_DATA) | |
| 3081 | WRITEDWORD64LE(data_write_dword_64le, ADDRESS_SPACE_DATA) | |
| 3082 | WRITEQWORD64(data_write_qword_64le, ADDRESS_SPACE_DATA) | |
| 3083 | WRITEMASKED64(data_write_masked_64le,ADDRESS_SPACE_DATA) | |
| 3084 | ||
| 3085 | ||
| 3086 | /*------------------------------------------------- | |
| 3087 | I/O memory handlers | |
| 3088 | -------------------------------------------------*/ | |
| 3089 | ||
| 3090 | READBYTE8(io_read_byte_8, ADDRESS_SPACE_IO) | |
| 3091 | WRITEBYTE8(io_write_byte_8, ADDRESS_SPACE_IO) | |
| 3092 | ||
| 3093 | READBYTE16BE(io_read_byte_16be, ADDRESS_SPACE_IO) | |
| 3094 | READWORD16(io_read_word_16be, ADDRESS_SPACE_IO) | |
| 3095 | WRITEBYTE16BE(io_write_byte_16be, ADDRESS_SPACE_IO) | |
| 3096 | WRITEWORD16(io_write_word_16be, ADDRESS_SPACE_IO) | |
| 3097 | ||
| 3098 | READBYTE16LE(io_read_byte_16le, ADDRESS_SPACE_IO) | |
| 3099 | READWORD16(io_read_word_16le, ADDRESS_SPACE_IO) | |
| 3100 | WRITEBYTE16LE(io_write_byte_16le, ADDRESS_SPACE_IO) | |
| 3101 | WRITEWORD16(io_write_word_16le, ADDRESS_SPACE_IO) | |
| 3102 | ||
| 3103 | READBYTE32BE(io_read_byte_32be, ADDRESS_SPACE_IO) | |
| 3104 | READWORD32BE(io_read_word_32be, ADDRESS_SPACE_IO) | |
| 3105 | READDWORD32(io_read_dword_32be, ADDRESS_SPACE_IO) | |
| 3106 | READMASKED32(io_read_masked_32be, ADDRESS_SPACE_IO) | |
| 3107 | WRITEBYTE32BE(io_write_byte_32be, ADDRESS_SPACE_IO) | |
| 3108 | WRITEWORD32BE(io_write_word_32be, ADDRESS_SPACE_IO) | |
| 3109 | WRITEDWORD32(io_write_dword_32be, ADDRESS_SPACE_IO) | |
| 3110 | WRITEMASKED32(io_write_masked_32be,ADDRESS_SPACE_IO) | |
| 3111 | ||
| 3112 | READBYTE32LE(io_read_byte_32le, ADDRESS_SPACE_IO) | |
| 3113 | READWORD32LE(io_read_word_32le, ADDRESS_SPACE_IO) | |
| 3114 | READDWORD32(io_read_dword_32le, ADDRESS_SPACE_IO) | |
| 3115 | READMASKED32(io_read_masked_32le, ADDRESS_SPACE_IO) | |
| 3116 | WRITEBYTE32LE(io_write_byte_32le, ADDRESS_SPACE_IO) | |
| 3117 | WRITEWORD32LE(io_write_word_32le, ADDRESS_SPACE_IO) | |
| 3118 | WRITEDWORD32(io_write_dword_32le, ADDRESS_SPACE_IO) | |
| 3119 | WRITEMASKED32(io_write_masked_32le,ADDRESS_SPACE_IO) | |
| 3120 | ||
| 3121 | READBYTE64BE(io_read_byte_64be, ADDRESS_SPACE_IO) | |
| 3122 | READWORD64BE(io_read_word_64be, ADDRESS_SPACE_IO) | |
| 3123 | READDWORD64BE(io_read_dword_64be, ADDRESS_SPACE_IO) | |
| 3124 | READQWORD64(io_read_qword_64be, ADDRESS_SPACE_IO) | |
| 3125 | READMASKED64(io_read_masked_64be, ADDRESS_SPACE_IO) | |
| 3126 | WRITEBYTE64BE(io_write_byte_64be, ADDRESS_SPACE_IO) | |
| 3127 | WRITEWORD64BE(io_write_word_64be, ADDRESS_SPACE_IO) | |
| 3128 | WRITEDWORD64BE(io_write_dword_64be, ADDRESS_SPACE_IO) | |
| 3129 | WRITEQWORD64(io_write_qword_64be, ADDRESS_SPACE_IO) | |
| 3130 | WRITEMASKED64(io_write_masked_64be,ADDRESS_SPACE_IO) | |
| 3131 | ||
| 3132 | READBYTE64LE(io_read_byte_64le, ADDRESS_SPACE_IO) | |
| 3133 | READWORD64LE(io_read_word_64le, ADDRESS_SPACE_IO) | |
| 3134 | READDWORD64LE(io_read_dword_64le, ADDRESS_SPACE_IO) | |
| 3135 | READQWORD64(io_read_qword_64le, ADDRESS_SPACE_IO) | |
| 3136 | READMASKED64(io_read_masked_64le, ADDRESS_SPACE_IO) | |
| 3137 | WRITEBYTE64LE(io_write_byte_64le, ADDRESS_SPACE_IO) | |
| 3138 | WRITEWORD64LE(io_write_word_64le, ADDRESS_SPACE_IO) | |
| 3139 | WRITEDWORD64LE(io_write_dword_64le, ADDRESS_SPACE_IO) | |
| 3140 | WRITEQWORD64(io_write_qword_64le, ADDRESS_SPACE_IO) | |
| 3141 | WRITEMASKED64(io_write_masked_64le,ADDRESS_SPACE_IO) | |
| 3142 | ||
| 3143 | ||
| 3144 | /*------------------------------------------------- | |
| 3145 | 2499 | safe opcode reading |
| 3146 | 2500 | -------------------------------------------------*/ |
| 3147 | 2501 | |
| r2375 | r2376 | |
| 3587 | 2941 | } |
| 3588 | 2942 | } |
| 3589 | 2943 | } |
| 2944 | ||
| 2945 | ||
| 2946 | ||
| 2947 | ||
| 2948 | ||
| 2949 | ||
| 2950 | ||
| 2951 | /*************************************************************************** | |
| 2952 | MEMORY HANDLER LOOKUP HELPERS | |
| 2953 | ***************************************************************************/ | |
| 2954 | ||
| 2955 | /*------------------------------------------------- | |
| 2956 | Program memory handlers | |
| 2957 | -------------------------------------------------*/ | |
| 2958 | ||
| 2959 | INLINE UINT32 lookup_read_entry(const address_space *space, offs_t address) | |
| 2960 | { | |
| 2961 | UINT32 entry = space->readlookup[LEVEL1_INDEX(address)]; | |
| 2962 | if (entry >= SUBTABLE_BASE) | |
| 2963 | entry = space->readlookup[LEVEL2_INDEX(entry, address)]; | |
| 2964 | return entry; | |
| 2965 | } | |
| 2966 | ||
| 2967 | ||
| 2968 | INLINE UINT32 lookup_write_entry(const address_space *space, offs_t address) | |
| 2969 | { | |
| 2970 | UINT32 entry = space->writelookup[LEVEL1_INDEX(address)]; | |
| 2971 | if (entry >= SUBTABLE_BASE) | |
| 2972 | entry = space->writelookup[LEVEL2_INDEX(entry, address)]; | |
| 2973 | return entry; | |
| 2974 | } | |
| 2975 | ||
| 2976 | ||
| 2977 | /*************************************************************************** | |
| 2978 | 8-BIT READ HANDLERS | |
| 2979 | ***************************************************************************/ | |
| 2980 | ||
| 2981 | /*------------------------------------------------- | |
| 2982 | read_byte_generic - read a byte from an | |
| 2983 | arbitrary address space | |
| 2984 | -------------------------------------------------*/ | |
| 2985 | ||
| 2986 | INLINE UINT8 read_byte_generic(UINT8 spacenum, offs_t address) | |
| 2987 | { | |
| 2988 | const address_space *space = &active_address_space[spacenum]; | |
| 2989 | const handler_data *handler; | |
| 2990 | offs_t offset; | |
| 2991 | UINT32 entry; | |
| 2992 | UINT8 result; | |
| 2993 | ||
| 2994 | profiler_mark(PROFILER_MEMREAD); | |
| 2995 | ||
| 2996 | address &= space->bytemask; | |
| 2997 | entry = lookup_read_entry(space, address); | |
| 2998 | handler = &space->readhandlers[entry]; | |
| 2999 | ||
| 3000 | DEBUG_HOOK_READ(spacenum, address, 0xff); | |
| 3001 | ||
| 3002 | offset = (address - handler->bytestart) & handler->bytemask; | |
| 3003 | if (entry < STATIC_RAM) | |
| 3004 | result = bank_ptr[entry][offset]; | |
| 3005 | else | |
| 3006 | result = (*handler->handler.read.mhandler8)(handler->object, offset); | |
| 3007 | ||
| 3008 | profiler_mark(PROFILER_END); | |
| 3009 | ||
| 3010 | return result; | |
| 3011 | } | |
| 3012 | ||
| 3013 | ||
| 3014 | /*------------------------------------------------- | |
| 3015 | ADDRESS_SPACE_PROGRAM | |
| 3016 | -------------------------------------------------*/ | |
| 3017 | ||
| 3018 | UINT8 program_read_byte_8le(offs_t address) | |
| 3019 | { | |
| 3020 | return read_byte_generic(ADDRESS_SPACE_PROGRAM, address); | |
| 3021 | } | |
| 3022 | ||
| 3023 | UINT8 program_read_byte_8be(offs_t address) | |
| 3024 | { | |
| 3025 | return read_byte_generic(ADDRESS_SPACE_PROGRAM, address); | |
| 3026 | } | |
| 3027 | ||
| 3028 | UINT16 program_read_word_8le(offs_t address) | |
| 3029 | { | |
| 3030 | UINT16 result = program_read_byte_8le(address + 0) << 0; | |
| 3031 | return result | (program_read_byte_8le(address + 1) << 8); | |
| 3032 | } | |
| 3033 | ||
| 3034 | UINT16 program_read_word_8be(offs_t address) | |
| 3035 | { | |
| 3036 | UINT16 result = program_read_byte_8be(address + 0) << 8; | |
| 3037 | return result | (program_read_byte_8be(address + 1) << 0); | |
| 3038 | } | |
| 3039 | ||
| 3040 | UINT32 program_read_dword_8le(offs_t address) | |
| 3041 | { | |
| 3042 | UINT32 result = program_read_word_8le(address + 0) << 0; | |
| 3043 | return result | (program_read_word_8le(address + 2) << 16); | |
| 3044 | } | |
| 3045 | ||
| 3046 | UINT32 program_read_dword_8be(offs_t address) | |
| 3047 | { | |
| 3048 | UINT32 result = program_read_word_8be(address + 0) << 16; | |
| 3049 | return result | (program_read_word_8be(address + 2) << 0); | |
| 3050 | } | |
| 3051 | ||
| 3052 | UINT64 program_read_qword_8le(offs_t address) | |
| 3053 | { | |
| 3054 | UINT64 result = (UINT64)program_read_dword_8le(address + 0) << 0; | |
| 3055 | return result | ((UINT64)program_read_dword_8le(address + 4) << 32); | |
| 3056 | } | |
| 3057 | ||
| 3058 | UINT64 program_read_qword_8be(offs_t address) | |
| 3059 | { | |
| 3060 | UINT64 result = (UINT64)program_read_dword_8le(address + 0) << 32; | |
| 3061 | return result | ((UINT64)program_read_dword_8le(address + 4) << 0); | |
| 3062 | } | |
| 3063 | ||
| 3064 | ||
| 3065 | /*------------------------------------------------- | |
| 3066 | ADDRESS_SPACE_DATA | |
| 3067 | -------------------------------------------------*/ | |
| 3068 | ||
| 3069 | UINT8 data_read_byte_8le(offs_t address) | |
| 3070 | { | |
| 3071 | return read_byte_generic(ADDRESS_SPACE_DATA, address); | |
| 3072 | } | |
| 3073 | ||
| 3074 | UINT8 data_read_byte_8be(offs_t address) | |
| 3075 | { | |
| 3076 | return read_byte_generic(ADDRESS_SPACE_DATA, address); | |
| 3077 | } | |
| 3078 | ||
| 3079 | UINT16 data_read_word_8le(offs_t address) | |
| 3080 | { | |
| 3081 | UINT16 result = data_read_byte_8le(address + 0) << 0; | |
| 3082 | return result | (data_read_byte_8le(address + 1) << 8); | |
| 3083 | } | |
| 3084 | ||
| 3085 | UINT16 data_read_word_8be(offs_t address) | |
| 3086 | { | |
| 3087 | UINT16 result = data_read_byte_8be(address + 0) << 8; | |
| 3088 | return result | (data_read_byte_8be(address + 1) << 0); | |
| 3089 | } | |
| 3090 | ||
| 3091 | UINT32 data_read_dword_8le(offs_t address) | |
| 3092 | { | |
| 3093 | UINT32 result = data_read_word_8le(address + 0) << 0; | |
| 3094 | return result | (data_read_word_8le(address + 2) << 16); | |
| 3095 | } | |
| 3096 | ||
| 3097 | UINT32 data_read_dword_8be(offs_t address) | |
| 3098 | { | |
| 3099 | UINT32 result = data_read_word_8be(address + 0) << 16; | |
| 3100 | return result | (data_read_word_8be(address + 2) << 0); | |
| 3101 | } | |
| 3102 | ||
| 3103 | UINT64 data_read_qword_8le(offs_t address) | |
| 3104 | { | |
| 3105 | UINT64 result = (UINT64)data_read_dword_8le(address + 0) << 0; | |
| 3106 | return result | ((UINT64)data_read_dword_8le(address + 4) << 32); | |
| 3107 | } | |
| 3108 | ||
| 3109 | UINT64 data_read_qword_8be(offs_t address) | |
| 3110 | { | |
| 3111 | UINT64 result = (UINT64)data_read_dword_8le(address + 0) << 32; | |
| 3112 | return result | ((UINT64)data_read_dword_8le(address + 4) << 0); | |
| 3113 | } | |
| 3114 | ||
| 3115 | ||
| 3116 | /*------------------------------------------------- | |
| 3117 | ADDRESS_SPACE_IO | |
| 3118 | -------------------------------------------------*/ | |
| 3119 | ||
| 3120 | UINT8 io_read_byte_8le(offs_t address) | |
| 3121 | { | |
| 3122 | return read_byte_generic(ADDRESS_SPACE_IO, address); | |
| 3123 | } | |
| 3124 | ||
| 3125 | UINT8 io_read_byte_8be(offs_t address) | |
| 3126 | { | |
| 3127 | return read_byte_generic(ADDRESS_SPACE_IO, address); | |
| 3128 | } | |
| 3129 | ||
| 3130 | UINT16 io_read_word_8le(offs_t address) | |
| 3131 | { | |
| 3132 | UINT16 result = io_read_byte_8le(address + 0) << 0; | |
| 3133 | return result | (io_read_byte_8le(address + 1) << 8); | |
| 3134 | } | |
| 3135 | ||
| 3136 | UINT16 io_read_word_8be(offs_t address) | |
| 3137 | { | |
| 3138 | UINT16 result = io_read_byte_8be(address + 0) << 8; | |
| 3139 | return result | (io_read_byte_8be(address + 1) << 0); | |
| 3140 | } | |
| 3141 | ||
| 3142 | UINT32 io_read_dword_8le(offs_t address) | |
| 3143 | { | |
| 3144 | UINT32 result = io_read_word_8le(address + 0) << 0; | |
| 3145 | return result | (io_read_word_8le(address + 2) << 16); | |
| 3146 | } | |
| 3147 | ||
| 3148 | UINT32 io_read_dword_8be(offs_t address) | |
| 3149 | { | |
| 3150 | UINT32 result = io_read_word_8be(address + 0) << 16; | |
| 3151 | return result | (io_read_word_8be(address + 2) << 0); | |
| 3152 | } | |
| 3153 | ||
| 3154 | UINT64 io_read_qword_8le(offs_t address) | |
| 3155 | { | |
| 3156 | UINT64 result = (UINT64)io_read_dword_8le(address + 0) << 0; | |
| 3157 | return result | ((UINT64)io_read_dword_8le(address + 4) << 32); | |
| 3158 | } | |
| 3159 | ||
| 3160 | UINT64 io_read_qword_8be(offs_t address) | |
| 3161 | { | |
| 3162 | UINT64 result = (UINT64)io_read_dword_8le(address + 0) << 32; | |
| 3163 | return result | ((UINT64)io_read_dword_8le(address + 4) << 0); | |
| 3164 | } | |
| 3165 | ||
| 3166 | ||
| 3167 | ||
| 3168 | /*************************************************************************** | |
| 3169 | 8-BIT WRITE HANDLERS | |
| 3170 | ***************************************************************************/ | |
| 3171 | ||
| 3172 | /*------------------------------------------------- | |
| 3173 | write_byte_generic - write a byte to an | |
| 3174 | arbitrary address space | |
| 3175 | -------------------------------------------------*/ | |
| 3176 | ||
| 3177 | INLINE void write_byte_generic(UINT8 spacenum, offs_t address, UINT8 data) | |
| 3178 | { | |
| 3179 | const address_space *space = &active_address_space[spacenum]; | |
| 3180 | const handler_data *handler; | |
| 3181 | offs_t offset; | |
| 3182 | UINT32 entry; | |
| 3183 | ||
| 3184 | profiler_mark(PROFILER_MEMWRITE); | |
| 3185 | ||
| 3186 | address &= space->bytemask; | |
| 3187 | entry = lookup_write_entry(space, address); | |
| 3188 | handler = &space->writehandlers[entry]; | |
| 3189 | ||
| 3190 | DEBUG_HOOK_WRITE(spacenum, address, data, 0xff); | |
| 3191 | ||
| 3192 | offset = (address - handler->bytestart) & handler->bytemask; | |
| 3193 | if (entry < STATIC_RAM) | |
| 3194 | bank_ptr[entry][offset] = data; | |
| 3195 | else | |
| 3196 | (*handler->handler.write.mhandler8)(handler->object, offset, data); | |
| 3197 | ||
| 3198 | profiler_mark(PROFILER_END); | |
| 3199 | } | |
| 3200 | ||
| 3201 | ||
| 3202 | /*------------------------------------------------- | |
| 3203 | ADDRESS_SPACE_PROGRAM | |
| 3204 | -------------------------------------------------*/ | |
| 3205 | ||
| 3206 | void program_write_byte_8le(offs_t address, UINT8 data) | |
| 3207 | { | |
| 3208 | write_byte_generic(ADDRESS_SPACE_PROGRAM, address, data); | |
| 3209 | } | |
| 3210 | ||
| 3211 | void program_write_byte_8be(offs_t address, UINT8 data) | |
| 3212 | { | |
| 3213 | write_byte_generic(ADDRESS_SPACE_PROGRAM, address, data); | |
| 3214 | } | |
| 3215 | ||
| 3216 | void program_write_word_8le(offs_t address, UINT16 data) | |
| 3217 | { | |
| 3218 | program_write_byte_8le(address + 0, data >> 0); | |
| 3219 | program_write_byte_8le(address + 1, data >> 8); | |
| 3220 | } | |
| 3221 | ||
| 3222 | void program_write_word_8be(offs_t address, UINT16 data) | |
| 3223 | { | |
| 3224 | program_write_byte_8be(address + 0, data >> 8); | |
| 3225 | program_write_byte_8be(address + 1, data >> 0); | |
| 3226 | } | |
| 3227 | ||
| 3228 | void program_write_dword_8le(offs_t address, UINT32 data) | |
| 3229 | { | |
| 3230 | program_write_word_8le(address + 0, data >> 0); | |
| 3231 | program_write_word_8le(address + 2, data >> 16); | |
| 3232 | } | |
| 3233 | ||
| 3234 | void program_write_dword_8be(offs_t address, UINT32 data) | |
| 3235 | { | |
| 3236 | program_write_word_8be(address + 0, data >> 16); | |
| 3237 | program_write_word_8be(address + 2, data >> 0); | |
| 3238 | } | |
| 3239 | ||
| 3240 | void program_write_qword_8le(offs_t address, UINT64 data) | |
| 3241 | { | |
| 3242 | program_write_dword_8le(address + 0, data >> 0); | |
| 3243 | program_write_dword_8le(address + 4, data >> 32); | |
| 3244 | } | |
| 3245 | ||
| 3246 | void program_write_qword_8be(offs_t address, UINT64 data) | |
| 3247 | { | |
| 3248 | program_write_dword_8be(address + 0, data >> 32); | |
| 3249 | program_write_dword_8be(address + 4, data >> 0); | |
| 3250 | } | |
| 3251 | ||
| 3252 | ||
| 3253 | /*------------------------------------------------- | |
| 3254 | ADDRESS_SPACE_DATA | |
| 3255 | -------------------------------------------------*/ | |
| 3256 | ||
| 3257 | void data_write_byte_8le(offs_t address, UINT8 data) | |
| 3258 | { | |
| 3259 | write_byte_generic(ADDRESS_SPACE_DATA, address, data); | |
| 3260 | } | |
| 3261 | ||
| 3262 | void data_write_byte_8be(offs_t address, UINT8 data) | |
| 3263 | { | |
| 3264 | write_byte_generic(ADDRESS_SPACE_DATA, address, data); | |
| 3265 | } | |
| 3266 | ||
| 3267 | void data_write_word_8le(offs_t address, UINT16 data) | |
| 3268 | { | |
| 3269 | data_write_byte_8le(address + 0, data >> 0); | |
| 3270 | data_write_byte_8le(address + 1, data >> 8); | |
| 3271 | } | |
| 3272 | ||
| 3273 | void data_write_word_8be(offs_t address, UINT16 data) | |
| 3274 | { | |
| 3275 | data_write_byte_8be(address + 0, data >> 8); | |
| 3276 | data_write_byte_8be(address + 1, data >> 0); | |
| 3277 | } | |
| 3278 | ||
| 3279 | void data_write_dword_8le(offs_t address, UINT32 data) | |
| 3280 | { | |
| 3281 | data_write_word_8le(address + 0, data >> 0); | |
| 3282 | data_write_word_8le(address + 2, data >> 16); | |
| 3283 | } | |
| 3284 | ||
| 3285 | void data_write_dword_8be(offs_t address, UINT32 data) | |
| 3286 | { | |
| 3287 | data_write_word_8be(address + 0, data >> 16); | |
| 3288 | data_write_word_8be(address + 2, data >> 0); | |
| 3289 | } | |
| 3290 | ||
| 3291 | void data_write_qword_8le(offs_t address, UINT64 data) | |
| 3292 | { | |
| 3293 | data_write_dword_8le(address + 0, data >> 0); | |
| 3294 | data_write_dword_8le(address + 4, data >> 32); | |
| 3295 | } | |
| 3296 | ||
| 3297 | void data_write_qword_8be(offs_t address, UINT64 data) | |
| 3298 | { | |
| 3299 | data_write_dword_8be(address + 0, data >> 32); | |
| 3300 | data_write_dword_8be(address + 4, data >> 0); | |
| 3301 | } | |
| 3302 | ||
| 3303 | ||
| 3304 | /*------------------------------------------------- | |
| 3305 | ADDRESS_SPACE_IO | |
| 3306 | -------------------------------------------------*/ | |
| 3307 | ||
| 3308 | void io_write_byte_8le(offs_t address, UINT8 data) | |
| 3309 | { | |
| 3310 | write_byte_generic(ADDRESS_SPACE_IO, address, data); | |
| 3311 | } | |
| 3312 | ||
| 3313 | void io_write_byte_8be(offs_t address, UINT8 data) | |
| 3314 | { | |
| 3315 | write_byte_generic(ADDRESS_SPACE_IO, address, data); | |
| 3316 | } | |
| 3317 | ||
| 3318 | void io_write_word_8le(offs_t address, UINT16 data) | |
| 3319 | { | |
| 3320 | io_write_byte_8le(address + 0, data >> 0); | |
| 3321 | io_write_byte_8le(address + 1, data >> 8); | |
| 3322 | } | |
| 3323 | ||
| 3324 | void io_write_word_8be(offs_t address, UINT16 data) | |
| 3325 | { | |
| 3326 | io_write_byte_8be(address + 0, data >> 8); | |
| 3327 | io_write_byte_8be(address + 1, data >> 0); | |
| 3328 | } | |
| 3329 | ||
| 3330 | void io_write_dword_8le(offs_t address, UINT32 data) | |
| 3331 | { | |
| 3332 | io_write_word_8le(address + 0, data >> 0); | |
| 3333 | io_write_word_8le(address + 2, data >> 16); | |
| 3334 | } | |
| 3335 | ||
| 3336 | void io_write_dword_8be(offs_t address, UINT32 data) | |
| 3337 | { | |
| 3338 | io_write_word_8be(address + 0, data >> 16); | |
| 3339 | io_write_word_8be(address + 2, data >> 0); | |
| 3340 | } | |
| 3341 | ||
| 3342 | void io_write_qword_8le(offs_t address, UINT64 data) | |
| 3343 | { | |
| 3344 | io_write_dword_8le(address + 0, data >> 0); | |
| 3345 | io_write_dword_8le(address + 4, data >> 32); | |
| 3346 | } | |
| 3347 | ||
| 3348 | void io_write_qword_8be(offs_t address, UINT64 data) | |
| 3349 | { | |
| 3350 | io_write_dword_8be(address + 0, data >> 32); | |
| 3351 | io_write_dword_8be(address + 4, data >> 0); | |
| 3352 | } | |
| 3353 | ||
| 3354 | ||
| 3355 | ||
| 3356 | /*************************************************************************** | |
| 3357 | 16-BIT READ HANDLERS | |
| 3358 | ***************************************************************************/ | |
| 3359 | ||
| 3360 | /*------------------------------------------------- | |
| 3361 | read_word_masked_generic - read a word from | |
| 3362 | an arbitrary address space | |
| 3363 | -------------------------------------------------*/ | |
| 3364 | ||
| 3365 | INLINE UINT16 read_word_masked_generic(UINT8 spacenum, offs_t address, UINT16 mem_mask) | |
| 3366 | { | |
| 3367 | const address_space *space = &active_address_space[spacenum]; | |
| 3368 | const handler_data *handler; | |
| 3369 | offs_t offset; | |
| 3370 | UINT32 entry; | |
| 3371 | UINT16 result; | |
| 3372 | ||
| 3373 | profiler_mark(PROFILER_MEMREAD); | |
| 3374 | ||
| 3375 | address &= space->bytemask; | |
| 3376 | entry = lookup_read_entry(space, address); | |
| 3377 | handler = &space->readhandlers[entry]; | |
| 3378 | ||
| 3379 | DEBUG_HOOK_READ(spacenum, address & ~1, (UINT16)~mem_mask); | |
| 3380 | ||
| 3381 | offset = (address - handler->bytestart) & handler->bytemask; | |
| 3382 | if (entry < STATIC_RAM) | |
| 3383 | result = *(UINT16 *)&bank_ptr[entry][offset & ~1]; | |
| 3384 | else | |
| 3385 | result = (*handler->handler.read.mhandler16)(handler->object, offset >> 1, mem_mask); | |
| 3386 | ||
| 3387 | profiler_mark(PROFILER_END); | |
| 3388 | ||
| 3389 | return result; | |
| 3390 | } | |
| 3391 | ||
| 3392 | ||
| 3393 | /*------------------------------------------------- | |
| 3394 | ADDRESS_SPACE_PROGRAM | |
| 3395 | -------------------------------------------------*/ | |
| 3396 | ||
| 3397 | UINT8 program_read_byte_16le(offs_t address) | |
| 3398 | { | |
| 3399 | UINT32 shift = (address & 1) * 8; | |
| 3400 | return read_word_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~(0xff << shift)) >> shift; | |
| 3401 | } | |
| 3402 | ||
| 3403 | UINT8 program_read_byte_16be(offs_t address) | |
| 3404 | { | |
| 3405 | UINT32 shift = (~address & 1) * 8; | |
| 3406 | return read_word_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~(0xff << shift)) >> shift; | |
| 3407 | } | |
| 3408 | ||
| 3409 | UINT16 program_read_word_16le(offs_t address) | |
| 3410 | { | |
| 3411 | return read_word_masked_generic(ADDRESS_SPACE_PROGRAM, address, 0); | |
| 3412 | } | |
| 3413 | ||
| 3414 | UINT16 program_read_word_16be(offs_t address) | |
| 3415 | { | |
| 3416 | return read_word_masked_generic(ADDRESS_SPACE_PROGRAM, address, 0); | |
| 3417 | } | |
| 3418 | ||
| 3419 | UINT32 program_read_dword_16le(offs_t address) | |
| 3420 | { | |
| 3421 | UINT32 result = program_read_word_16le(address + 0) << 0; | |
| 3422 | return result | (program_read_word_16le(address + 2) << 16); | |
| 3423 | } | |
| 3424 | ||
| 3425 | UINT32 program_read_dword_16be(offs_t address) | |
| 3426 | { | |
| 3427 | UINT32 result = program_read_word_16be(address + 0) << 16; | |
| 3428 | return result | (program_read_word_16be(address + 2) << 0); | |
| 3429 | } | |
| 3430 | ||
| 3431 | UINT64 program_read_qword_16le(offs_t address) | |
| 3432 | { | |
| 3433 | UINT64 result = (UINT64)program_read_dword_16le(address + 0) << 0; | |
| 3434 | return result | ((UINT64)program_read_dword_16le(address + 4) << 32); | |
| 3435 | } | |
| 3436 | ||
| 3437 | UINT64 program_read_qword_16be(offs_t address) | |
| 3438 | { | |
| 3439 | UINT64 result = (UINT64)program_read_dword_16le(address + 0) << 32; | |
| 3440 | return result | ((UINT64)program_read_dword_16le(address + 4) << 0); | |
| 3441 | } | |
| 3442 | ||
| 3443 | ||
| 3444 | /*------------------------------------------------- | |
| 3445 | ADDRESS_SPACE_DATA | |
| 3446 | -------------------------------------------------*/ | |
| 3447 | ||
| 3448 | UINT8 data_read_byte_16le(offs_t address) | |
| 3449 | { | |
| 3450 | UINT32 shift = (address & 1) * 8; | |
| 3451 | return read_word_masked_generic(ADDRESS_SPACE_DATA, address, ~(0xff << shift)) >> shift; | |
| 3452 | } | |
| 3453 | ||
| 3454 | UINT8 data_read_byte_16be(offs_t address) | |
| 3455 | { | |
| 3456 | UINT32 shift = (~address & 1) * 8; | |
| 3457 | return read_word_masked_generic(ADDRESS_SPACE_DATA, address, ~(0xff << shift)) >> shift; | |
| 3458 | } | |
| 3459 | ||
| 3460 | UINT16 data_read_word_16le(offs_t address) | |
| 3461 | { | |
| 3462 | return read_word_masked_generic(ADDRESS_SPACE_DATA, address, 0); | |
| 3463 | } | |
| 3464 | ||
| 3465 | UINT16 data_read_word_16be(offs_t address) | |
| 3466 | { | |
| 3467 | return read_word_masked_generic(ADDRESS_SPACE_DATA, address, 0); | |
| 3468 | } | |
| 3469 | ||
| 3470 | UINT32 data_read_dword_16le(offs_t address) | |
| 3471 | { | |
| 3472 | UINT32 result = data_read_word_16le(address + 0) << 0; | |
| 3473 | return result | (data_read_word_16le(address + 2) << 16); | |
| 3474 | } | |
| 3475 | ||
| 3476 | UINT32 data_read_dword_16be(offs_t address) | |
| 3477 | { | |
| 3478 | UINT32 result = data_read_word_16be(address + 0) << 16; | |
| 3479 | return result | (data_read_word_16be(address + 2) << 0); | |
| 3480 | } | |
| 3481 | ||
| 3482 | UINT64 data_read_qword_16le(offs_t address) | |
| 3483 | { | |
| 3484 | UINT64 result = (UINT64)data_read_dword_16le(address + 0) << 0; | |
| 3485 | return result | ((UINT64)data_read_dword_16le(address + 4) << 32); | |
| 3486 | } | |
| 3487 | ||
| 3488 | UINT64 data_read_qword_16be(offs_t address) | |
| 3489 | { | |
| 3490 | UINT64 result = (UINT64)data_read_dword_16le(address + 0) << 32; | |
| 3491 | return result | ((UINT64)data_read_dword_16le(address + 4) << 0); | |
| 3492 | } | |
| 3493 | ||
| 3494 | ||
| 3495 | /*------------------------------------------------- | |
| 3496 | ADDRESS_SPACE_IO | |
| 3497 | -------------------------------------------------*/ | |
| 3498 | ||
| 3499 | UINT8 io_read_byte_16le(offs_t address) | |
| 3500 | { | |
| 3501 | UINT32 shift = (address & 1) * 8; | |
| 3502 | return read_word_masked_generic(ADDRESS_SPACE_IO, address, ~(0xff << shift)) >> shift; | |
| 3503 | } | |
| 3504 | ||
| 3505 | UINT8 io_read_byte_16be(offs_t address) | |
| 3506 | { | |
| 3507 | UINT32 shift = (~address & 1) * 8; | |
| 3508 | return read_word_masked_generic(ADDRESS_SPACE_IO, address, ~(0xff << shift)) >> shift; | |
| 3509 | } | |
| 3510 | ||
| 3511 | UINT16 io_read_word_16le(offs_t address) | |
| 3512 | { | |
| 3513 | return read_word_masked_generic(ADDRESS_SPACE_IO, address, 0); | |
| 3514 | } | |
| 3515 | ||
| 3516 | UINT16 io_read_word_16be(offs_t address) | |
| 3517 | { | |
| 3518 | return read_word_masked_generic(ADDRESS_SPACE_IO, address, 0); | |
| 3519 | } | |
| 3520 | ||
| 3521 | UINT32 io_read_dword_16le(offs_t address) | |
| 3522 | { | |
| 3523 | UINT32 result = io_read_word_16le(address + 0) << 0; | |
| 3524 | return result | (io_read_word_16le(address + 2) << 16); | |
| 3525 | } | |
| 3526 | ||
| 3527 | UINT32 io_read_dword_16be(offs_t address) | |
| 3528 | { | |
| 3529 | UINT32 result = io_read_word_16be(address + 0) << 16; | |
| 3530 | return result | (io_read_word_16be(address + 2) << 0); | |
| 3531 | } | |
| 3532 | ||
| 3533 | UINT64 io_read_qword_16le(offs_t address) | |
| 3534 | { | |
| 3535 | UINT64 result = (UINT64)io_read_dword_16le(address + 0) << 0; | |
| 3536 | return result | ((UINT64)io_read_dword_16le(address + 4) << 32); | |
| 3537 | } | |
| 3538 | ||
| 3539 | UINT64 io_read_qword_16be(offs_t address) | |
| 3540 | { | |
| 3541 | UINT64 result = (UINT64)io_read_dword_16le(address + 0) << 32; | |
| 3542 | return result | ((UINT64)io_read_dword_16le(address + 4) << 0); | |
| 3543 | } | |
| 3544 | ||
| 3545 | ||
| 3546 | ||
| 3547 | /*************************************************************************** | |
| 3548 | 16-BIT WRITE HANDLERS | |
| 3549 | ***************************************************************************/ | |
| 3550 | ||
| 3551 | /*------------------------------------------------- | |
| 3552 | write_word_masked_generic - write a masked | |
| 3553 | word to an arbitrary address space | |
| 3554 | -------------------------------------------------*/ | |
| 3555 | ||
| 3556 | INLINE void write_word_masked_generic(UINT8 spacenum, offs_t address, UINT16 data, UINT16 mem_mask) | |
| 3557 | { | |
| 3558 | const address_space *space = &active_address_space[spacenum]; | |
| 3559 | const handler_data *handler; | |
| 3560 | offs_t offset; | |
| 3561 | UINT32 entry; | |
| 3562 | ||
| 3563 | profiler_mark(PROFILER_MEMWRITE); | |
| 3564 | ||
| 3565 | address &= space->bytemask; | |
| 3566 | entry = lookup_write_entry(space, address); | |
| 3567 | handler = &space->writehandlers[entry]; | |
| 3568 | ||
| 3569 | DEBUG_HOOK_WRITE(spacenum, address & ~1, data, (UINT16)~mem_mask); | |
| 3570 | ||
| 3571 | offset = (address - handler->bytestart) & handler->bytemask; | |
| 3572 | if (entry < STATIC_RAM) | |
| 3573 | { | |
| 3574 | UINT16 *dest = (UINT16 *)&bank_ptr[entry][offset & ~1]; | |
| 3575 | *dest = (*dest & mem_mask) | (data & ~mem_mask); | |
| 3576 | } | |
| 3577 | else | |
| 3578 | (*handler->handler.write.mhandler16)(handler->object, offset >> 1, data, mem_mask); | |
| 3579 | ||
| 3580 | profiler_mark(PROFILER_END); | |
| 3581 | } | |
| 3582 | ||
| 3583 | ||
| 3584 | /*------------------------------------------------- | |
| 3585 | ADDRESS_SPACE_PROGRAM | |
| 3586 | -------------------------------------------------*/ | |
| 3587 | ||
| 3588 | void program_write_byte_16le(offs_t address, UINT8 data) | |
| 3589 | { | |
| 3590 | UINT32 shift = (address & 1) * 8; | |
| 3591 | write_word_masked_generic(ADDRESS_SPACE_PROGRAM, address, data << shift, ~(0xff << shift)); | |
| 3592 | } | |
| 3593 | ||
| 3594 | void program_write_byte_16be(offs_t address, UINT8 data) | |
| 3595 | { | |
| 3596 | UINT32 shift = (~address & 1) * 8; | |
| 3597 | write_word_masked_generic(ADDRESS_SPACE_PROGRAM, address, data << shift, ~(0xff << shift)); | |
| 3598 | } | |
| 3599 | ||
| 3600 | void program_write_word_16le(offs_t address, UINT16 data) | |
| 3601 | { | |
| 3602 | write_word_masked_generic(ADDRESS_SPACE_PROGRAM, address, data, 0); | |
| 3603 | } | |
| 3604 | ||
| 3605 | void program_write_word_16be(offs_t address, UINT16 data) | |
| 3606 | { | |
| 3607 | write_word_masked_generic(ADDRESS_SPACE_PROGRAM, address, data, 0); | |
| 3608 | } | |
| 3609 | ||
| 3610 | void program_write_dword_16le(offs_t address, UINT32 data) | |
| 3611 | { | |
| 3612 | program_write_word_16le(address + 0, data >> 0); | |
| 3613 | program_write_word_16le(address + 2, data >> 16); | |
| 3614 | } | |
| 3615 | ||
| 3616 | void program_write_dword_16be(offs_t address, UINT32 data) | |
| 3617 | { | |
| 3618 | program_write_word_16be(address + 0, data >> 16); | |
| 3619 | program_write_word_16be(address + 2, data >> 0); | |
| 3620 | } | |
| 3621 | ||
| 3622 | void program_write_qword_16le(offs_t address, UINT64 data) | |
| 3623 | { | |
| 3624 | program_write_dword_16le(address + 0, data >> 0); | |
| 3625 | program_write_dword_16le(address + 4, data >> 32); | |
| 3626 | } | |
| 3627 | ||
| 3628 | void program_write_qword_16be(offs_t address, UINT64 data) | |
| 3629 | { | |
| 3630 | program_write_dword_16be(address + 0, data >> 32); | |
| 3631 | program_write_dword_16be(address + 4, data >> 0); | |
| 3632 | } | |
| 3633 | ||
| 3634 | ||
| 3635 | /*------------------------------------------------- | |
| 3636 | ADDRESS_SPACE_DATA | |
| 3637 | -------------------------------------------------*/ | |
| 3638 | ||
| 3639 | void data_write_byte_16le(offs_t address, UINT8 data) | |
| 3640 | { | |
| 3641 | UINT32 shift = (address & 1) * 8; | |
| 3642 | write_word_masked_generic(ADDRESS_SPACE_DATA, address, data << shift, ~(0xff << shift)); | |
| 3643 | } | |
| 3644 | ||
| 3645 | void data_write_byte_16be(offs_t address, UINT8 data) | |
| 3646 | { | |
| 3647 | UINT32 shift = (~address & 1) * 8; | |
| 3648 | write_word_masked_generic(ADDRESS_SPACE_DATA, address, data << shift, ~(0xff << shift)); | |
| 3649 | } | |
| 3650 | ||
| 3651 | void data_write_word_16le(offs_t address, UINT16 data) | |
| 3652 | { | |
| 3653 | write_word_masked_generic(ADDRESS_SPACE_DATA, address, data, 0); | |
| 3654 | } | |
| 3655 | ||
| 3656 | void data_write_word_16be(offs_t address, UINT16 data) | |
| 3657 | { | |
| 3658 | write_word_masked_generic(ADDRESS_SPACE_DATA, address, data, 0); | |
| 3659 | } | |
| 3660 | ||
| 3661 | void data_write_dword_16le(offs_t address, UINT32 data) | |
| 3662 | { | |
| 3663 | data_write_word_16le(address + 0, data >> 0); | |
| 3664 | data_write_word_16le(address + 2, data >> 16); | |
| 3665 | } | |
| 3666 | ||
| 3667 | void data_write_dword_16be(offs_t address, UINT32 data) | |
| 3668 | { | |
| 3669 | data_write_word_16be(address + 0, data >> 16); | |
| 3670 | data_write_word_16be(address + 2, data >> 0); | |
| 3671 | } | |
| 3672 | ||
| 3673 | void data_write_qword_16le(offs_t address, UINT64 data) | |
| 3674 | { | |
| 3675 | data_write_dword_16le(address + 0, data >> 0); | |
| 3676 | data_write_dword_16le(address + 4, data >> 32); | |
| 3677 | } | |
| 3678 | ||
| 3679 | void data_write_qword_16be(offs_t address, UINT64 data) | |
| 3680 | { | |
| 3681 | data_write_dword_16be(address + 0, data >> 32); | |
| 3682 | data_write_dword_16be(address + 4, data >> 0); | |
| 3683 | } | |
| 3684 | ||
| 3685 | ||
| 3686 | /*------------------------------------------------- | |
| 3687 | ADDRESS_SPACE_IO | |
| 3688 | -------------------------------------------------*/ | |
| 3689 | ||
| 3690 | void io_write_byte_16le(offs_t address, UINT8 data) | |
| 3691 | { | |
| 3692 | UINT32 shift = (address & 1) * 8; | |
| 3693 | write_word_masked_generic(ADDRESS_SPACE_IO, address, data << shift, ~(0xff << shift)); | |
| 3694 | } | |
| 3695 | ||
| 3696 | void io_write_byte_16be(offs_t address, UINT8 data) | |
| 3697 | { | |
| 3698 | UINT32 shift = (~address & 1) * 8; | |
| 3699 | write_word_masked_generic(ADDRESS_SPACE_IO, address, data << shift, ~(0xff << shift)); | |
| 3700 | } | |
| 3701 | ||
| 3702 | void io_write_word_16le(offs_t address, UINT16 data) | |
| 3703 | { | |
| 3704 | write_word_masked_generic(ADDRESS_SPACE_IO, address, data, 0); | |
| 3705 | } | |
| 3706 | ||
| 3707 | void io_write_word_16be(offs_t address, UINT16 data) | |
| 3708 | { | |
| 3709 | write_word_masked_generic(ADDRESS_SPACE_IO, address, data, 0); | |
| 3710 | } | |
| 3711 | ||
| 3712 | void io_write_dword_16le(offs_t address, UINT32 data) | |
| 3713 | { | |
| 3714 | io_write_word_16le(address + 0, data >> 0); | |
| 3715 | io_write_word_16le(address + 2, data >> 16); | |
| 3716 | } | |
| 3717 | ||
| 3718 | void io_write_dword_16be(offs_t address, UINT32 data) | |
| 3719 | { | |
| 3720 | io_write_word_16be(address + 0, data >> 16); | |
| 3721 | io_write_word_16be(address + 2, data >> 0); | |
| 3722 | } | |
| 3723 | ||
| 3724 | void io_write_qword_16le(offs_t address, UINT64 data) | |
| 3725 | { | |
| 3726 | io_write_dword_16le(address + 0, data >> 0); | |
| 3727 | io_write_dword_16le(address + 4, data >> 32); | |
| 3728 | } | |
| 3729 | ||
| 3730 | void io_write_qword_16be(offs_t address, UINT64 data) | |
| 3731 | { | |
| 3732 | io_write_dword_16be(address + 0, data >> 32); | |
| 3733 | io_write_dword_16be(address + 4, data >> 0); | |
| 3734 | } | |
| 3735 | ||
| 3736 | ||
| 3737 | ||
| 3738 | /*************************************************************************** | |
| 3739 | 32-BIT READ HANDLERS | |
| 3740 | ***************************************************************************/ | |
| 3741 | ||
| 3742 | /*------------------------------------------------- | |
| 3743 | read_dword_masked_generic - read a dword from | |
| 3744 | an arbitrary address space | |
| 3745 | -------------------------------------------------*/ | |
| 3746 | ||
| 3747 | INLINE UINT32 read_dword_masked_generic(UINT8 spacenum, offs_t address, UINT32 mem_mask) | |
| 3748 | { | |
| 3749 | const address_space *space = &active_address_space[spacenum]; | |
| 3750 | const handler_data *handler; | |
| 3751 | offs_t offset; | |
| 3752 | UINT32 entry; | |
| 3753 | UINT32 result; | |
| 3754 | ||
| 3755 | profiler_mark(PROFILER_MEMREAD); | |
| 3756 | ||
| 3757 | address &= space->bytemask; | |
| 3758 | entry = lookup_read_entry(space, address); | |
| 3759 | handler = &space->readhandlers[entry]; | |
| 3760 | ||
| 3761 | DEBUG_HOOK_READ(spacenum, address & ~3, (UINT32)~mem_mask); | |
| 3762 | ||
| 3763 | offset = (address - handler->bytestart) & handler->bytemask; | |
| 3764 | if (entry < STATIC_RAM) | |
| 3765 | result = *(UINT32 *)&bank_ptr[entry][offset & ~3]; | |
| 3766 | else | |
| 3767 | result = (*handler->handler.read.mhandler32)(handler->object, offset >> 2, mem_mask); | |
| 3768 | ||
| 3769 | profiler_mark(PROFILER_END); | |
| 3770 | ||
| 3771 | return result; | |
| 3772 | } | |
| 3773 | ||
| 3774 | ||
| 3775 | /*------------------------------------------------- | |
| 3776 | ADDRESS_SPACE_PROGRAM | |
| 3777 | -------------------------------------------------*/ | |
| 3778 | ||
| 3779 | UINT8 program_read_byte_32le(offs_t address) | |
| 3780 | { | |
| 3781 | UINT32 shift = (address & 3) * 8; | |
| 3782 | return read_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~(0xff << shift)) >> shift; | |
| 3783 | } | |
| 3784 | ||
| 3785 | UINT8 program_read_byte_32be(offs_t address) | |
| 3786 | { | |
| 3787 | UINT32 shift = (~address & 3) * 8; | |
| 3788 | return read_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~(0xff << shift)) >> shift; | |
| 3789 | } | |
| 3790 | ||
| 3791 | UINT16 program_read_word_32le(offs_t address) | |
| 3792 | { | |
| 3793 | UINT32 shift = (address & 2) * 8; | |
| 3794 | return read_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~(0xffff << shift)) >> shift; | |
| 3795 | } | |
| 3796 | ||
| 3797 | UINT16 program_read_word_32be(offs_t address) | |
| 3798 | { | |
| 3799 | UINT32 shift = (~address & 2) * 8; | |
| 3800 | return read_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~(0xffff << shift)) >> shift; | |
| 3801 | } | |
| 3802 | ||
| 3803 | UINT32 program_read_dword_32le(offs_t address) | |
| 3804 | { | |
| 3805 | return read_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, 0); | |
| 3806 | } | |
| 3807 | ||
| 3808 | UINT32 program_read_dword_32be(offs_t address) | |
| 3809 | { | |
| 3810 | return read_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, 0); | |
| 3811 | } | |
| 3812 | ||
| 3813 | UINT32 program_read_dword_masked_32le(offs_t address, UINT32 mem_mask) | |
| 3814 | { | |
| 3815 | return read_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, mem_mask); | |
| 3816 | } | |
| 3817 | ||
| 3818 | UINT32 program_read_dword_masked_32be(offs_t address, UINT32 mem_mask) | |
| 3819 | { | |
| 3820 | return read_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, mem_mask); | |
| 3821 | } | |
| 3822 | ||
| 3823 | UINT64 program_read_qword_32le(offs_t address) | |
| 3824 | { | |
| 3825 | UINT64 result = (UINT64)program_read_dword_32le(address + 0) << 0; | |
| 3826 | return result | ((UINT64)program_read_dword_32le(address + 4) << 32); | |
| 3827 | } | |
| 3828 | ||
| 3829 | UINT64 program_read_qword_32be(offs_t address) | |
| 3830 | { | |
| 3831 | UINT64 result = (UINT64)program_read_dword_32le(address + 0) << 32; | |
| 3832 | return result | ((UINT64)program_read_dword_32le(address + 4) << 0); | |
| 3833 | } | |
| 3834 | ||
| 3835 | ||
| 3836 | /*------------------------------------------------- | |
| 3837 | ADDRESS_SPACE_DATA | |
| 3838 | -------------------------------------------------*/ | |
| 3839 | ||
| 3840 | UINT8 data_read_byte_32le(offs_t address) | |
| 3841 | { | |
| 3842 | UINT32 shift = (address & 3) * 8; | |
| 3843 | return read_dword_masked_generic(ADDRESS_SPACE_DATA, address, ~(0xff << shift)) >> shift; | |
| 3844 | } | |
| 3845 | ||
| 3846 | UINT8 data_read_byte_32be(offs_t address) | |
| 3847 | { | |
| 3848 | UINT32 shift = (~address & 3) * 8; | |
| 3849 | return read_dword_masked_generic(ADDRESS_SPACE_DATA, address, ~(0xff << shift)) >> shift; | |
| 3850 | } | |
| 3851 | ||
| 3852 | UINT16 data_read_word_32le(offs_t address) | |
| 3853 | { | |
| 3854 | UINT32 shift = (address & 2) * 8; | |
| 3855 | return read_dword_masked_generic(ADDRESS_SPACE_DATA, address, ~(0xffff << shift)) >> shift; | |
| 3856 | } | |
| 3857 | ||
| 3858 | UINT16 data_read_word_32be(offs_t address) | |
| 3859 | { | |
| 3860 | UINT32 shift = (~address & 2) * 8; | |
| 3861 | return read_dword_masked_generic(ADDRESS_SPACE_DATA, address, ~(0xffff << shift)) >> shift; | |
| 3862 | } | |
| 3863 | ||
| 3864 | UINT32 data_read_dword_32le(offs_t address) | |
| 3865 | { | |
| 3866 | return read_dword_masked_generic(ADDRESS_SPACE_DATA, address, 0); | |
| 3867 | } | |
| 3868 | ||
| 3869 | UINT32 data_read_dword_32be(offs_t address) | |
| 3870 | { | |
| 3871 | return read_dword_masked_generic(ADDRESS_SPACE_DATA, address, 0); | |
| 3872 | } | |
| 3873 | ||
| 3874 | UINT32 data_read_dword_masked_32le(offs_t address, UINT32 mem_mask) | |
| 3875 | { | |
| 3876 | return read_dword_masked_generic(ADDRESS_SPACE_DATA, address, mem_mask); | |
| 3877 | } | |
| 3878 | ||
| 3879 | UINT32 data_read_dword_masked_32be(offs_t address, UINT32 mem_mask) | |
| 3880 | { | |
| 3881 | return read_dword_masked_generic(ADDRESS_SPACE_DATA, address, mem_mask); | |
| 3882 | } | |
| 3883 | ||
| 3884 | UINT64 data_read_qword_32le(offs_t address) | |
| 3885 | { | |
| 3886 | UINT64 result = (UINT64)data_read_dword_32le(address + 0) << 0; | |
| 3887 | return result | ((UINT64)data_read_dword_32le(address + 4) << 32); | |
| 3888 | } | |
| 3889 | ||
| 3890 | UINT64 data_read_qword_32be(offs_t address) | |
| 3891 | { | |
| 3892 | UINT64 result = (UINT64)data_read_dword_32le(address + 0) << 32; | |
| 3893 | return result | ((UINT64)data_read_dword_32le(address + 4) << 0); | |
| 3894 | } | |
| 3895 | ||
| 3896 | ||
| 3897 | /*------------------------------------------------- | |
| 3898 | ADDRESS_SPACE_IO | |
| 3899 | -------------------------------------------------*/ | |
| 3900 | ||
| 3901 | UINT8 io_read_byte_32le(offs_t address) | |
| 3902 | { | |
| 3903 | UINT32 shift = (address & 3) * 8; | |
| 3904 | return read_dword_masked_generic(ADDRESS_SPACE_IO, address, ~(0xff << shift)) >> shift; | |
| 3905 | } | |
| 3906 | ||
| 3907 | UINT8 io_read_byte_32be(offs_t address) | |
| 3908 | { | |
| 3909 | UINT32 shift = (~address & 3) * 8; | |
| 3910 | return read_dword_masked_generic(ADDRESS_SPACE_IO, address, ~(0xff << shift)) >> shift; | |
| 3911 | } | |
| 3912 | ||
| 3913 | UINT16 io_read_word_32le(offs_t address) | |
| 3914 | { | |
| 3915 | UINT32 shift = (address & 2) * 8; | |
| 3916 | return read_dword_masked_generic(ADDRESS_SPACE_IO, address, ~(0xffff << shift)) >> shift; | |
| 3917 | } | |
| 3918 | ||
| 3919 | UINT16 io_read_word_32be(offs_t address) | |
| 3920 | { | |
| 3921 | UINT32 shift = (~address & 2) * 8; | |
| 3922 | return read_dword_masked_generic(ADDRESS_SPACE_IO, address, ~(0xffff << shift)) >> shift; | |
| 3923 | } | |
| 3924 | ||
| 3925 | UINT32 io_read_dword_32le(offs_t address) | |
| 3926 | { | |
| 3927 | return read_dword_masked_generic(ADDRESS_SPACE_IO, address, 0); | |
| 3928 | } | |
| 3929 | ||
| 3930 | UINT32 io_read_dword_32be(offs_t address) | |
| 3931 | { | |
| 3932 | return read_dword_masked_generic(ADDRESS_SPACE_IO, address, 0); | |
| 3933 | } | |
| 3934 | ||
| 3935 | UINT32 io_read_dword_masked_32le(offs_t address, UINT32 mem_mask) | |
| 3936 | { | |
| 3937 | return read_dword_masked_generic(ADDRESS_SPACE_IO, address, mem_mask); | |
| 3938 | } | |
| 3939 | ||
| 3940 | UINT32 io_read_dword_masked_32be(offs_t address, UINT32 mem_mask) | |
| 3941 | { | |
| 3942 | return read_dword_masked_generic(ADDRESS_SPACE_IO, address, mem_mask); | |
| 3943 | } | |
| 3944 | ||
| 3945 | UINT64 io_read_qword_32le(offs_t address) | |
| 3946 | { | |
| 3947 | UINT64 result = (UINT64)io_read_dword_32le(address + 0) << 0; | |
| 3948 | return result | ((UINT64)io_read_dword_32le(address + 4) << 32); | |
| 3949 | } | |
| 3950 | ||
| 3951 | UINT64 io_read_qword_32be(offs_t address) | |
| 3952 | { | |
| 3953 | UINT64 result = (UINT64)io_read_dword_32le(address + 0) << 32; | |
| 3954 | return result | ((UINT64)io_read_dword_32le(address + 4) << 0); | |
| 3955 | } | |
| 3956 | ||
| 3957 | ||
| 3958 | ||
| 3959 | /*************************************************************************** | |
| 3960 | 32-BIT WRITE HANDLERS | |
| 3961 | ***************************************************************************/ | |
| 3962 | ||
| 3963 | /*------------------------------------------------- | |
| 3964 | write_dword_masked_generic - write a masked | |
| 3965 | dword to an arbitrary address space | |
| 3966 | -------------------------------------------------*/ | |
| 3967 | ||
| 3968 | INLINE void write_dword_masked_generic(UINT8 spacenum, offs_t address, UINT32 data, UINT32 mem_mask) | |
| 3969 | { | |
| 3970 | const address_space *space = &active_address_space[spacenum]; | |
| 3971 | const handler_data *handler; | |
| 3972 | offs_t offset; | |
| 3973 | UINT32 entry; | |
| 3974 | ||
| 3975 | profiler_mark(PROFILER_MEMWRITE); | |
| 3976 | ||
| 3977 | address &= space->bytemask; | |
| 3978 | entry = lookup_write_entry(space, address); | |
| 3979 | handler = &space->writehandlers[entry]; | |
| 3980 | ||
| 3981 | DEBUG_HOOK_WRITE(spacenum, address & ~3, data, (UINT32)~mem_mask); | |
| 3982 | ||
| 3983 | offset = (address - handler->bytestart) & handler->bytemask; | |
| 3984 | if (entry < STATIC_RAM) | |
| 3985 | { | |
| 3986 | UINT32 *dest = (UINT32 *)&bank_ptr[entry][offset & ~3]; | |
| 3987 | *dest = (*dest & mem_mask) | (data & ~mem_mask); | |
| 3988 | } | |
| 3989 | else | |
| 3990 | (*handler->handler.write.mhandler32)(handler->object, offset >> 2, data, mem_mask); | |
| 3991 | ||
| 3992 | profiler_mark(PROFILER_END); | |
| 3993 | } | |
| 3994 | ||
| 3995 | ||
| 3996 | /*------------------------------------------------- | |
| 3997 | ADDRESS_SPACE_PROGRAM | |
| 3998 | -------------------------------------------------*/ | |
| 3999 | ||
| 4000 | void program_write_byte_32le(offs_t address, UINT8 data) | |
| 4001 | { | |
| 4002 | UINT32 shift = (address & 3) * 8; | |
| 4003 | write_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data << shift, ~(0xff << shift)); | |
| 4004 | } | |
| 4005 | ||
| 4006 | void program_write_byte_32be(offs_t address, UINT8 data) | |
| 4007 | { | |
| 4008 | UINT32 shift = (~address & 3) * 8; | |
| 4009 | write_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data << shift, ~(0xff << shift)); | |
| 4010 | } | |
| 4011 | ||
| 4012 | void program_write_word_32le(offs_t address, UINT16 data) | |
| 4013 | { | |
| 4014 | UINT32 shift = (address & 2) * 8; | |
| 4015 | write_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data << shift, ~(0xffff << shift)); | |
| 4016 | } | |
| 4017 | ||
| 4018 | void program_write_word_32be(offs_t address, UINT16 data) | |
| 4019 | { | |
| 4020 | UINT32 shift = (~address & 2) * 8; | |
| 4021 | write_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data << shift, ~(0xffff << shift)); | |
| 4022 | } | |
| 4023 | ||
| 4024 | void program_write_dword_32le(offs_t address, UINT32 data) | |
| 4025 | { | |
| 4026 | write_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data, 0); | |
| 4027 | } | |
| 4028 | ||
| 4029 | void program_write_dword_32be(offs_t address, UINT32 data) | |
| 4030 | { | |
| 4031 | write_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data, 0); | |
| 4032 | } | |
| 4033 | ||
| 4034 | void program_write_dword_masked_32le(offs_t address, UINT32 data, UINT32 mem_mask) | |
| 4035 | { | |
| 4036 | write_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data, mem_mask); | |
| 4037 | } | |
| 4038 | ||
| 4039 | void program_write_dword_masked_32be(offs_t address, UINT32 data, UINT32 mem_mask) | |
| 4040 | { | |
| 4041 | write_dword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data, mem_mask); | |
| 4042 | } | |
| 4043 | ||
| 4044 | void program_write_qword_32le(offs_t address, UINT64 data) | |
| 4045 | { | |
| 4046 | program_write_dword_32le(address + 0, data >> 0); | |
| 4047 | program_write_dword_32le(address + 4, data >> 32); | |
| 4048 | } | |
| 4049 | ||
| 4050 | void program_write_qword_32be(offs_t address, UINT64 data) | |
| 4051 | { | |
| 4052 | program_write_dword_32be(address + 0, data >> 32); | |
| 4053 | program_write_dword_32be(address + 4, data >> 0); | |
| 4054 | } | |
| 4055 | ||
| 4056 | ||
| 4057 | /*------------------------------------------------- | |
| 4058 | ADDRESS_SPACE_DATA | |
| 4059 | -------------------------------------------------*/ | |
| 4060 | ||
| 4061 | void data_write_byte_32le(offs_t address, UINT8 data) | |
| 4062 | { | |
| 4063 | UINT32 shift = (address & 3) * 8; | |
| 4064 | write_dword_masked_generic(ADDRESS_SPACE_DATA, address, data << shift, ~(0xff << shift)); | |
| 4065 | } | |
| 4066 | ||
| 4067 | void data_write_byte_32be(offs_t address, UINT8 data) | |
| 4068 | { | |
| 4069 | UINT32 shift = (~address & 3) * 8; | |
| 4070 | write_dword_masked_generic(ADDRESS_SPACE_DATA, address, data << shift, ~(0xff << shift)); | |
| 4071 | } | |
| 4072 | ||
| 4073 | void data_write_word_32le(offs_t address, UINT16 data) | |
| 4074 | { | |
| 4075 | UINT32 shift = (address & 2) * 8; | |
| 4076 | write_dword_masked_generic(ADDRESS_SPACE_DATA, address, data << shift, ~(0xffff << shift)); | |
| 4077 | } | |
| 4078 | ||
| 4079 | void data_write_word_32be(offs_t address, UINT16 data) | |
| 4080 | { | |
| 4081 | UINT32 shift = (~address & 2) * 8; | |
| 4082 | write_dword_masked_generic(ADDRESS_SPACE_DATA, address, data << shift, ~(0xffff << shift)); | |
| 4083 | } | |
| 4084 | ||
| 4085 | void data_write_dword_32le(offs_t address, UINT32 data) | |
| 4086 | { | |
| 4087 | write_dword_masked_generic(ADDRESS_SPACE_DATA, address, data, 0); | |
| 4088 | } | |
| 4089 | ||
| 4090 | void data_write_dword_32be(offs_t address, UINT32 data) | |
| 4091 | { | |
| 4092 | write_dword_masked_generic(ADDRESS_SPACE_DATA, address, data, 0); | |
| 4093 | } | |
| 4094 | ||
| 4095 | void data_write_dword_masked_32le(offs_t address, UINT32 data, UINT32 mem_mask) | |
| 4096 | { | |
| 4097 | write_dword_masked_generic(ADDRESS_SPACE_DATA, address, data, mem_mask); | |
| 4098 | } | |
| 4099 | ||
| 4100 | void data_write_dword_masked_32be(offs_t address, UINT32 data, UINT32 mem_mask) | |
| 4101 | { | |
| 4102 | write_dword_masked_generic(ADDRESS_SPACE_DATA, address, data, mem_mask); | |
| 4103 | } | |
| 4104 | ||
| 4105 | void data_write_qword_32le(offs_t address, UINT64 data) | |
| 4106 | { | |
| 4107 | data_write_dword_32le(address + 0, data >> 0); | |
| 4108 | data_write_dword_32le(address + 4, data >> 32); | |
| 4109 | } | |
| 4110 | ||
| 4111 | void data_write_qword_32be(offs_t address, UINT64 data) | |
| 4112 | { | |
| 4113 | data_write_dword_32be(address + 0, data >> 32); | |
| 4114 | data_write_dword_32be(address + 4, data >> 0); | |
| 4115 | } | |
| 4116 | ||
| 4117 | ||
| 4118 | /*------------------------------------------------- | |
| 4119 | ADDRESS_SPACE_IO | |
| 4120 | -------------------------------------------------*/ | |
| 4121 | ||
| 4122 | void io_write_byte_32le(offs_t address, UINT8 data) | |
| 4123 | { | |
| 4124 | UINT32 shift = (address & 3) * 8; | |
| 4125 | write_dword_masked_generic(ADDRESS_SPACE_IO, address, data << shift, ~(0xff << shift)); | |
| 4126 | } | |
| 4127 | ||
| 4128 | void io_write_byte_32be(offs_t address, UINT8 data) | |
| 4129 | { | |
| 4130 | UINT32 shift = (~address & 3) * 8; | |
| 4131 | write_dword_masked_generic(ADDRESS_SPACE_IO, address, data << shift, ~(0xff << shift)); | |
| 4132 | } | |
| 4133 | ||
| 4134 | void io_write_word_32le(offs_t address, UINT16 data) | |
| 4135 | { | |
| 4136 | UINT32 shift = (address & 2) * 8; | |
| 4137 | write_dword_masked_generic(ADDRESS_SPACE_IO, address, data << shift, ~(0xffff << shift)); | |
| 4138 | } | |
| 4139 | ||
| 4140 | void io_write_word_32be(offs_t address, UINT16 data) | |
| 4141 | { | |
| 4142 | UINT32 shift = (~address & 2) * 8; | |
| 4143 | write_dword_masked_generic(ADDRESS_SPACE_IO, address, data << shift, ~(0xffff << shift)); | |
| 4144 | } | |
| 4145 | ||
| 4146 | void io_write_dword_32le(offs_t address, UINT32 data) | |
| 4147 | { | |
| 4148 | write_dword_masked_generic(ADDRESS_SPACE_IO, address, data, 0); | |
| 4149 | } | |
| 4150 | ||
| 4151 | void io_write_dword_32be(offs_t address, UINT32 data) | |
| 4152 | { | |
| 4153 | write_dword_masked_generic(ADDRESS_SPACE_IO, address, data, 0); | |
| 4154 | } | |
| 4155 | ||
| 4156 | void io_write_dword_masked_32le(offs_t address, UINT32 data, UINT32 mem_mask) | |
| 4157 | { | |
| 4158 | write_dword_masked_generic(ADDRESS_SPACE_IO, address, data, mem_mask); | |
| 4159 | } | |
| 4160 | ||
| 4161 | void io_write_dword_masked_32be(offs_t address, UINT32 data, UINT32 mem_mask) | |
| 4162 | { | |
| 4163 | write_dword_masked_generic(ADDRESS_SPACE_IO, address, data, mem_mask); | |
| 4164 | } | |
| 4165 | ||
| 4166 | void io_write_qword_32le(offs_t address, UINT64 data) | |
| 4167 | { | |
| 4168 | io_write_dword_32le(address + 0, data >> 0); | |
| 4169 | io_write_dword_32le(address + 4, data >> 32); | |
| 4170 | } | |
| 4171 | ||
| 4172 | void io_write_qword_32be(offs_t address, UINT64 data) | |
| 4173 | { | |
| 4174 | io_write_dword_32be(address + 0, data >> 32); | |
| 4175 | io_write_dword_32be(address + 4, data >> 0); | |
| 4176 | } | |
| 4177 | ||
| 4178 | ||
| 4179 | ||
| 4180 | /*************************************************************************** | |
| 4181 | 64-BIT READ HANDLERS | |
| 4182 | ***************************************************************************/ | |
| 4183 | ||
| 4184 | /*------------------------------------------------- | |
| 4185 | read_qword_masked_generic - read a qword from | |
| 4186 | an arbitrary address space | |
| 4187 | -------------------------------------------------*/ | |
| 4188 | ||
| 4189 | INLINE UINT64 read_qword_masked_generic(UINT8 spacenum, offs_t address, UINT64 mem_mask) | |
| 4190 | { | |
| 4191 | const address_space *space = &active_address_space[spacenum]; | |
| 4192 | const handler_data *handler; | |
| 4193 | offs_t offset; | |
| 4194 | UINT32 entry; | |
| 4195 | UINT64 result; | |
| 4196 | ||
| 4197 | profiler_mark(PROFILER_MEMREAD); | |
| 4198 | ||
| 4199 | address &= space->bytemask; | |
| 4200 | entry = lookup_read_entry(space, address); | |
| 4201 | handler = &space->readhandlers[entry]; | |
| 4202 | ||
| 4203 | DEBUG_HOOK_READ(spacenum, address & ~7, ~mem_mask); | |
| 4204 | ||
| 4205 | offset = (address - handler->bytestart) & handler->bytemask; | |
| 4206 | if (entry < STATIC_RAM) | |
| 4207 | result = *(UINT64 *)&bank_ptr[entry][offset & ~7]; | |
| 4208 | else | |
| 4209 | result = (*handler->handler.read.mhandler64)(handler->object, offset >> 3, mem_mask); | |
| 4210 | ||
| 4211 | profiler_mark(PROFILER_END); | |
| 4212 | ||
| 4213 | return result; | |
| 4214 | } | |
| 4215 | ||
| 4216 | ||
| 4217 | /*------------------------------------------------- | |
| 4218 | ADDRESS_SPACE_PROGRAM | |
| 4219 | -------------------------------------------------*/ | |
| 4220 | ||
| 4221 | UINT8 program_read_byte_64le(offs_t address) | |
| 4222 | { | |
| 4223 | UINT32 shift = (address & 7) * 8; | |
| 4224 | return read_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~((UINT64)0xff << shift)) >> shift; | |
| 4225 | } | |
| 4226 | ||
| 4227 | UINT8 program_read_byte_64be(offs_t address) | |
| 4228 | { | |
| 4229 | UINT32 shift = (~address & 7) * 8; | |
| 4230 | return read_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~((UINT64)0xff << shift)) >> shift; | |
| 4231 | } | |
| 4232 | ||
| 4233 | UINT16 program_read_word_64le(offs_t address) | |
| 4234 | { | |
| 4235 | UINT32 shift = (address & 6) * 8; | |
| 4236 | return read_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~((UINT64)0xffff << shift)) >> shift; | |
| 4237 | } | |
| 4238 | ||
| 4239 | UINT16 program_read_word_64be(offs_t address) | |
| 4240 | { | |
| 4241 | UINT32 shift = (~address & 6) * 8; | |
| 4242 | return read_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~((UINT64)0xffff << shift)) >> shift; | |
| 4243 | } | |
| 4244 | ||
| 4245 | UINT32 program_read_dword_64le(offs_t address) | |
| 4246 | { | |
| 4247 | UINT32 shift = (address & 4) * 8; | |
| 4248 | return read_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~((UINT64)0xffffffff << shift)) >> shift; | |
| 4249 | } | |
| 4250 | ||
| 4251 | UINT32 program_read_dword_64be(offs_t address) | |
| 4252 | { | |
| 4253 | UINT32 shift = (~address & 4) * 8; | |
| 4254 | return read_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, ~((UINT64)0xffffffff << shift)) >> shift; | |
| 4255 | } | |
| 4256 | ||
| 4257 | UINT64 program_read_qword_64le(offs_t address) | |
| 4258 | { | |
| 4259 | return read_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, 0); | |
| 4260 | } | |
| 4261 | ||
| 4262 | UINT64 program_read_qword_64be(offs_t address) | |
| 4263 | { | |
| 4264 | return read_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, 0); | |
| 4265 | } | |
| 4266 | ||
| 4267 | UINT64 program_read_qword_masked_64le(offs_t address, UINT64 mem_mask) | |
| 4268 | { | |
| 4269 | return read_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, mem_mask); | |
| 4270 | } | |
| 4271 | ||
| 4272 | UINT64 program_read_qword_masked_64be(offs_t address, UINT64 mem_mask) | |
| 4273 | { | |
| 4274 | return read_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, mem_mask); | |
| 4275 | } | |
| 4276 | ||
| 4277 | ||
| 4278 | /*------------------------------------------------- | |
| 4279 | ADDRESS_SPACE_DATA | |
| 4280 | -------------------------------------------------*/ | |
| 4281 | ||
| 4282 | UINT8 data_read_byte_64le(offs_t address) | |
| 4283 | { | |
| 4284 | UINT32 shift = (address & 7) * 8; | |
| 4285 | return read_qword_masked_generic(ADDRESS_SPACE_DATA, address, ~((UINT64)0xff << shift)) >> shift; | |
| 4286 | } | |
| 4287 | ||
| 4288 | UINT8 data_read_byte_64be(offs_t address) | |
| 4289 | { | |
| 4290 | UINT32 shift = (~address & 7) * 8; | |
| 4291 | return read_qword_masked_generic(ADDRESS_SPACE_DATA, address, ~((UINT64)0xff << shift)) >> shift; | |
| 4292 | } | |
| 4293 | ||
| 4294 | UINT16 data_read_word_64le(offs_t address) | |
| 4295 | { | |
| 4296 | UINT32 shift = (address & 6) * 8; | |
| 4297 | return read_qword_masked_generic(ADDRESS_SPACE_DATA, address, ~((UINT64)0xffff << shift)) >> shift; | |
| 4298 | } | |
| 4299 | ||
| 4300 | UINT16 data_read_word_64be(offs_t address) | |
| 4301 | { | |
| 4302 | UINT32 shift = (~address & 6) * 8; | |
| 4303 | return read_qword_masked_generic(ADDRESS_SPACE_DATA, address, ~((UINT64)0xffff << shift)) >> shift; | |
| 4304 | } | |
| 4305 | ||
| 4306 | UINT32 data_read_dword_64le(offs_t address) | |
| 4307 | { | |
| 4308 | UINT32 shift = (address & 4) * 8; | |
| 4309 | return read_qword_masked_generic(ADDRESS_SPACE_DATA, address, ~((UINT64)0xffffffff << shift)) >> shift; | |
| 4310 | } | |
| 4311 | ||
| 4312 | UINT32 data_read_dword_64be(offs_t address) | |
| 4313 | { | |
| 4314 | UINT32 shift = (~address & 4) * 8; | |
| 4315 | return read_qword_masked_generic(ADDRESS_SPACE_DATA, address, ~((UINT64)0xffffffff << shift)) >> shift; | |
| 4316 | } | |
| 4317 | ||
| 4318 | UINT64 data_read_qword_64le(offs_t address) | |
| 4319 | { | |
| 4320 | return read_qword_masked_generic(ADDRESS_SPACE_DATA, address, 0); | |
| 4321 | } | |
| 4322 | ||
| 4323 | UINT64 data_read_qword_64be(offs_t address) | |
| 4324 | { | |
| 4325 | return read_qword_masked_generic(ADDRESS_SPACE_DATA, address, 0); | |
| 4326 | } | |
| 4327 | ||
| 4328 | UINT64 data_read_qword_masked_64le(offs_t address, UINT64 mem_mask) | |
| 4329 | { | |
| 4330 | return read_qword_masked_generic(ADDRESS_SPACE_DATA, address, mem_mask); | |
| 4331 | } | |
| 4332 | ||
| 4333 | UINT64 data_read_qword_masked_64be(offs_t address, UINT64 mem_mask) | |
| 4334 | { | |
| 4335 | return read_qword_masked_generic(ADDRESS_SPACE_DATA, address, mem_mask); | |
| 4336 | } | |
| 4337 | ||
| 4338 | ||
| 4339 | /*------------------------------------------------- | |
| 4340 | ADDRESS_SPACE_IO | |
| 4341 | -------------------------------------------------*/ | |
| 4342 | ||
| 4343 | UINT8 io_read_byte_64le(offs_t address) | |
| 4344 | { | |
| 4345 | UINT32 shift = (address & 7) * 8; | |
| 4346 | return read_qword_masked_generic(ADDRESS_SPACE_IO, address, ~((UINT64)0xff << shift)) >> shift; | |
| 4347 | } | |
| 4348 | ||
| 4349 | UINT8 io_read_byte_64be(offs_t address) | |
| 4350 | { | |
| 4351 | UINT32 shift = (~address & 7) * 8; | |
| 4352 | return read_qword_masked_generic(ADDRESS_SPACE_IO, address, ~((UINT64)0xff << shift)) >> shift; | |
| 4353 | } | |
| 4354 | ||
| 4355 | UINT16 io_read_word_64le(offs_t address) | |
| 4356 | { | |
| 4357 | UINT32 shift = (address & 6) * 8; | |
| 4358 | return read_qword_masked_generic(ADDRESS_SPACE_IO, address, ~((UINT64)0xffff << shift)) >> shift; | |
| 4359 | } | |
| 4360 | ||
| 4361 | UINT16 io_read_word_64be(offs_t address) | |
| 4362 | { | |
| 4363 | UINT32 shift = (~address & 6) * 8; | |
| 4364 | return read_qword_masked_generic(ADDRESS_SPACE_IO, address, ~((UINT64)0xffff << shift)) >> shift; | |
| 4365 | } | |
| 4366 | ||
| 4367 | UINT32 io_read_dword_64le(offs_t address) | |
| 4368 | { | |
| 4369 | UINT32 shift = (address & 4) * 8; | |
| 4370 | return read_qword_masked_generic(ADDRESS_SPACE_IO, address, ~((UINT64)0xffffffff << shift)) >> shift; | |
| 4371 | } | |
| 4372 | ||
| 4373 | UINT32 io_read_dword_64be(offs_t address) | |
| 4374 | { | |
| 4375 | UINT32 shift = (~address & 4) * 8; | |
| 4376 | return read_qword_masked_generic(ADDRESS_SPACE_IO, address, ~((UINT64)0xffffffff << shift)) >> shift; | |
| 4377 | } | |
| 4378 | ||
| 4379 | UINT64 io_read_qword_64le(offs_t address) | |
| 4380 | { | |
| 4381 | return read_qword_masked_generic(ADDRESS_SPACE_IO, address, 0); | |
| 4382 | } | |
| 4383 | ||
| 4384 | UINT64 io_read_qword_64be(offs_t address) | |
| 4385 | { | |
| 4386 | return read_qword_masked_generic(ADDRESS_SPACE_IO, address, 0); | |
| 4387 | } | |
| 4388 | ||
| 4389 | UINT64 io_read_qword_masked_64le(offs_t address, UINT64 mem_mask) | |
| 4390 | { | |
| 4391 | return read_qword_masked_generic(ADDRESS_SPACE_IO, address, mem_mask); | |
| 4392 | } | |
| 4393 | ||
| 4394 | UINT64 io_read_qword_masked_64be(offs_t address, UINT64 mem_mask) | |
| 4395 | { | |
| 4396 | return read_qword_masked_generic(ADDRESS_SPACE_IO, address, mem_mask); | |
| 4397 | } | |
| 4398 | ||
| 4399 | ||
| 4400 | ||
| 4401 | /*************************************************************************** | |
| 4402 | 64-BIT WRITE HANDLERS | |
| 4403 | ***************************************************************************/ | |
| 4404 | ||
| 4405 | /*------------------------------------------------- | |
| 4406 | write_qword_masked_generic - write a masked | |
| 4407 | dword to an arbitrary address space | |
| 4408 | -------------------------------------------------*/ | |
| 4409 | ||
| 4410 | INLINE void write_qword_masked_generic(UINT8 spacenum, offs_t address, UINT64 data, UINT64 mem_mask) | |
| 4411 | { | |
| 4412 | const address_space *space = &active_address_space[spacenum]; | |
| 4413 | const handler_data *handler; | |
| 4414 | offs_t offset; | |
| 4415 | UINT32 entry; | |
| 4416 | ||
| 4417 | profiler_mark(PROFILER_MEMWRITE); | |
| 4418 | ||
| 4419 | address &= space->bytemask; | |
| 4420 | entry = lookup_write_entry(space, address); | |
| 4421 | handler = &space->writehandlers[entry]; | |
| 4422 | ||
| 4423 | DEBUG_HOOK_WRITE(spacenum, address & ~7, data, ~mem_mask); | |
| 4424 | ||
| 4425 | offset = (address - handler->bytestart) & handler->bytemask; | |
| 4426 | if (entry < STATIC_RAM) | |
| 4427 | { | |
| 4428 | UINT64 *dest = (UINT64 *)&bank_ptr[entry][offset & ~7]; | |
| 4429 | *dest = (*dest & mem_mask) | (data & ~mem_mask); | |
| 4430 | } | |
| 4431 | else | |
| 4432 | (*handler->handler.write.mhandler64)(handler->object, offset >> 3, data, mem_mask); | |
| 4433 | ||
| 4434 | profiler_mark(PROFILER_END); | |
| 4435 | } | |
| 4436 | ||
| 4437 | ||
| 4438 | /*------------------------------------------------- | |
| 4439 | ADDRESS_SPACE_PROGRAM | |
| 4440 | -------------------------------------------------*/ | |
| 4441 | ||
| 4442 | void program_write_byte_64le(offs_t address, UINT8 data) | |
| 4443 | { | |
| 4444 | UINT32 shift = (address & 7) * 8; | |
| 4445 | write_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, (UINT64)data << shift, ~((UINT64)0xff << shift)); | |
| 4446 | } | |
| 4447 | ||
| 4448 | void program_write_byte_64be(offs_t address, UINT8 data) | |
| 4449 | { | |
| 4450 | UINT32 shift = (~address & 7) * 8; | |
| 4451 | write_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, (UINT64)data << shift, ~((UINT64)0xff << shift)); | |
| 4452 | } | |
| 4453 | ||
| 4454 | void program_write_word_64le(offs_t address, UINT16 data) | |
| 4455 | { | |
| 4456 | UINT32 shift = (address & 6) * 8; | |
| 4457 | write_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, (UINT64)data << shift, ~((UINT64)0xffff << shift)); | |
| 4458 | } | |
| 4459 | ||
| 4460 | void program_write_word_64be(offs_t address, UINT16 data) | |
| 4461 | { | |
| 4462 | UINT32 shift = (~address & 6) * 8; | |
| 4463 | write_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, (UINT64)data << shift, ~((UINT64)0xffff << shift)); | |
| 4464 | } | |
| 4465 | ||
| 4466 | void program_write_dword_64le(offs_t address, UINT32 data) | |
| 4467 | { | |
| 4468 | UINT32 shift = (address & 4) * 8; | |
| 4469 | write_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, (UINT64)data << shift, ~((UINT64)0xffffffff << shift)); | |
| 4470 | } | |
| 4471 | ||
| 4472 | void program_write_dword_64be(offs_t address, UINT32 data) | |
| 4473 | { | |
| 4474 | UINT32 shift = (~address & 4) * 8; | |
| 4475 | write_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, (UINT64)data << shift, ~((UINT64)0xffffffff << shift)); | |
| 4476 | } | |
| 4477 | ||
| 4478 | void program_write_qword_64le(offs_t address, UINT64 data) | |
| 4479 | { | |
| 4480 | write_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data, 0); | |
| 4481 | } | |
| 4482 | ||
| 4483 | void program_write_qword_64be(offs_t address, UINT64 data) | |
| 4484 | { | |
| 4485 | write_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data, 0); | |
| 4486 | } | |
| 4487 | ||
| 4488 | void program_write_qword_masked_64le(offs_t address, UINT64 data, UINT64 mem_mask) | |
| 4489 | { | |
| 4490 | write_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data, mem_mask); | |
| 4491 | } | |
| 4492 | ||
| 4493 | void program_write_qword_masked_64be(offs_t address, UINT64 data, UINT64 mem_mask) | |
| 4494 | { | |
| 4495 | write_qword_masked_generic(ADDRESS_SPACE_PROGRAM, address, data, mem_mask); | |
| 4496 | } | |
| 4497 | ||
| 4498 | ||
| 4499 | /*------------------------------------------------- | |
| 4500 | ADDRESS_SPACE_DATA | |
| 4501 | -------------------------------------------------*/ | |
| 4502 | ||
| 4503 | void data_write_byte_64le(offs_t address, UINT8 data) | |
| 4504 | { | |
| 4505 | UINT32 shift = (address & 7) * 8; | |
| 4506 | write_qword_masked_generic(ADDRESS_SPACE_DATA, address, (UINT64)data << shift, ~((UINT64)0xff << shift)); | |
| 4507 | } | |
| 4508 | ||
| 4509 | void data_write_byte_64be(offs_t address, UINT8 data) | |
| 4510 | { | |
| 4511 | UINT32 shift = (~address & 7) * 8; | |
| 4512 | write_qword_masked_generic(ADDRESS_SPACE_DATA, address, (UINT64)data << shift, ~((UINT64)0xff << shift)); | |
| 4513 | } | |
| 4514 | ||
| 4515 | void data_write_word_64le(offs_t address, UINT16 data) | |
| 4516 | { | |
| 4517 | UINT32 shift = (address & 6) * 8; | |
| 4518 | write_qword_masked_generic(ADDRESS_SPACE_DATA, address, (UINT64)data << shift, ~((UINT64)0xffff << shift)); | |
| 4519 | } | |
| 4520 | ||
| 4521 | void data_write_word_64be(offs_t address, UINT16 data) | |
| 4522 | { | |
| 4523 | UINT32 shift = (~address & 6) * 8; | |
| 4524 | write_qword_masked_generic(ADDRESS_SPACE_DATA, address, (UINT64)data << shift, ~((UINT64)0xffff << shift)); | |
| 4525 | } | |
| 4526 | ||
| 4527 | void data_write_dword_64le(offs_t address, UINT32 data) | |
| 4528 | { | |
| 4529 | UINT32 shift = (address & 4) * 8; | |
| 4530 | write_qword_masked_generic(ADDRESS_SPACE_DATA, address, (UINT64)data << shift, ~((UINT64)0xffffffff << shift)); | |
| 4531 | } | |
| 4532 | ||
| 4533 | void data_write_dword_64be(offs_t address, UINT32 data) | |
| 4534 | { | |
| 4535 | UINT32 shift = (~address & 4) * 8; | |
| 4536 | write_qword_masked_generic(ADDRESS_SPACE_DATA, address, (UINT64)data << shift, ~((UINT64)0xffffffff << shift)); | |
| 4537 | } | |
| 4538 | ||
| 4539 | void data_write_qword_64le(offs_t address, UINT64 data) | |
| 4540 | { | |
| 4541 | write_qword_masked_generic(ADDRESS_SPACE_DATA, address, data, 0); | |
| 4542 | } | |
| 4543 | ||
| 4544 | void data_write_qword_64be(offs_t address, UINT64 data) | |
| 4545 | { | |
| 4546 | write_qword_masked_generic(ADDRESS_SPACE_DATA, address, data, 0); | |
| 4547 | } | |
| 4548 | ||
| 4549 | void data_write_qword_masked_64le(offs_t address, UINT64 data, UINT64 mem_mask) | |
| 4550 | { | |
| 4551 | write_qword_masked_generic(ADDRESS_SPACE_DATA, address, data, mem_mask); | |
| 4552 | } | |
| 4553 | ||
| 4554 | void data_write_qword_masked_64be(offs_t address, UINT64 data, UINT64 mem_mask) | |
| 4555 | { | |
| 4556 | write_qword_masked_generic(ADDRESS_SPACE_DATA, address, data, mem_mask); | |
| 4557 | } | |
| 4558 | ||
| 4559 | ||
| 4560 | /*------------------------------------------------- | |
| 4561 | ADDRESS_SPACE_IO | |
| 4562 | -------------------------------------------------*/ | |
| 4563 | ||
| 4564 | void io_write_byte_64le(offs_t address, UINT8 data) | |
| 4565 | { | |
| 4566 | UINT32 shift = (address & 7) * 8; | |
| 4567 | write_qword_masked_generic(ADDRESS_SPACE_IO, address, (UINT64)data << shift, ~((UINT64)0xff << shift)); | |
| 4568 | } | |
| 4569 | ||
| 4570 | void io_write_byte_64be(offs_t address, UINT8 data) | |
| 4571 | { | |
| 4572 | UINT32 shift = (~address & 7) * 8; | |
| 4573 | write_qword_masked_generic(ADDRESS_SPACE_IO, address, (UINT64)data << shift, ~((UINT64)0xff << shift)); | |
| 4574 | } | |
| 4575 | ||
| 4576 | void io_write_word_64le(offs_t address, UINT16 data) | |
| 4577 | { | |
| 4578 | UINT32 shift = (address & 6) * 8; | |
| 4579 | write_qword_masked_generic(ADDRESS_SPACE_IO, address, (UINT64)data << shift, ~((UINT64)0xffff << shift)); | |
| 4580 | } | |
| 4581 | ||
| 4582 | void io_write_word_64be(offs_t address, UINT16 data) | |
| 4583 | { | |
| 4584 | UINT32 shift = (~address & 6) * 8; | |
| 4585 | write_qword_masked_generic(ADDRESS_SPACE_IO, address, (UINT64)data << shift, ~((UINT64)0xffff << shift)); | |
| 4586 | } | |
| 4587 | ||
| 4588 | void io_write_dword_64le(offs_t address, UINT32 data) | |
| 4589 | { | |
| 4590 | UINT32 shift = (address & 4) * 8; | |
| 4591 | write_qword_masked_generic(ADDRESS_SPACE_IO, address, (UINT64)data << shift, ~((UINT64)0xffffffff << shift)); | |
| 4592 | } | |
| 4593 | ||
| 4594 | void io_write_dword_64be(offs_t address, UINT32 data) | |
| 4595 | { | |
| 4596 | UINT32 shift = (~address & 4) * 8; | |
| 4597 | write_qword_masked_generic(ADDRESS_SPACE_IO, address, (UINT64)data << shift, ~((UINT64)0xffffffff << shift)); | |
| 4598 | } | |
| 4599 | ||
| 4600 | void io_write_qword_64le(offs_t address, UINT64 data) | |
| 4601 | { | |
| 4602 | write_qword_masked_generic(ADDRESS_SPACE_IO, address, data, 0); | |
| 4603 | } | |
| 4604 | ||
| 4605 | void io_write_qword_64be(offs_t address, UINT64 data) | |
| 4606 | { | |
| 4607 | write_qword_masked_generic(ADDRESS_SPACE_IO, address, data, 0); | |
| 4608 | } | |
| 4609 | ||
| 4610 | void io_write_qword_masked_64le(offs_t address, UINT64 data, UINT64 mem_mask) | |
| 4611 | { | |
| 4612 | write_qword_masked_generic(ADDRESS_SPACE_IO, address, data, mem_mask); | |
| 4613 | } | |
| 4614 | ||
| 4615 | void io_write_qword_masked_64be(offs_t address, UINT64 data, UINT64 mem_mask) | |
| 4616 | { | |
| 4617 | write_qword_masked_generic(ADDRESS_SPACE_IO, address, data, mem_mask); | |
| 4618 | } |
| r2375 | r2376 | |
|---|---|---|
| 236 | 236 | /* return text to display about the current speed */ |
| 237 | 237 | const char *video_get_speed_text(running_machine *machine); |
| 238 | 238 | |
| 239 | /* return the current effective speed percentage */ | |
| 240 | double video_get_speed_percent(running_machine *machine); | |
| 241 | ||
| 239 | 242 | /* get/set the current frameskip (-1 means auto) */ |
| 240 | 243 | int video_get_frameskip(void); |
| 241 | 244 | void video_set_frameskip(int frameskip); |
| r2375 | r2376 | |
|---|---|---|
| 801 | 801 | ***************************************************************************/ |
| 802 | 802 | |
| 803 | 803 | /* declare program address space handlers */ |
| 804 | UINT8 program_read_byte_8(offs_t address); | |
| 805 | void program_write_byte_8(offs_t address, UINT8 data); | |
| 804 | UINT8 program_read_byte_8le(offs_t address); | |
| 805 | UINT16 program_read_word_8le(offs_t address); | |
| 806 | UINT32 program_read_dword_8le(offs_t address); | |
| 807 | UINT64 program_read_qword_8le(offs_t address); | |
| 808 | void program_write_byte_8le(offs_t address, UINT8 data); | |
| 809 | void program_write_word_8le(offs_t address, UINT16 data); | |
| 810 | void program_write_dword_8le(offs_t address, UINT32 data); | |
| 811 | void program_write_qword_8le(offs_t address, UINT64 data); | |
| 806 | 812 | |
| 807 | UINT8 program_read_byte_16be(offs_t address); | |
| 808 | UINT16 program_read_word_16be(offs_t address); | |
| 809 | void program_write_byte_16be(offs_t address, UINT8 data); | |
| 810 | void program_write_word_16be(offs_t address, UINT16 data); | |
| 813 | UINT8 program_read_byte_8be(offs_t address); | |
| 814 | UINT16 program_read_word_8be(offs_t address); | |
| 815 | UINT32 program_read_dword_8be(offs_t address); | |
| 816 | UINT64 program_read_qword_8be(offs_t address); | |
| 817 | void program_write_byte_8be(offs_t address, UINT8 data); | |
| 818 | void program_write_word_8be(offs_t address, UINT16 data); | |
| 819 | void program_write_dword_8be(offs_t address, UINT32 data); | |
| 820 | void program_write_qword_8be(offs_t address, UINT64 data); | |
| 811 | 821 | |
| 812 | 822 | UINT8 program_read_byte_16le(offs_t address); |
| 813 | 823 | UINT16 program_read_word_16le(offs_t address); |
| 824 | UINT32 program_read_dword_16le(offs_t address); | |
| 825 | UINT64 program_read_qword_16le(offs_t address); | |
| 814 | 826 | void program_write_byte_16le(offs_t address, UINT8 data); |
| 815 | 827 | void program_write_word_16le(offs_t address, UINT16 data); |
| 828 | void program_write_dword_16le(offs_t address, UINT32 data); | |
| 829 | void program_write_qword_16le(offs_t address, UINT64 data); | |
| 816 | 830 | |
| 817 | UINT8 program_read_byte_32be(offs_t address); | |
| 818 | UINT16 program_read_word_32be(offs_t address); | |
| 819 | UINT32 program_read_dword_32be(offs_t address); | |
| 820 | UINT32 program_read_masked_32be(offs_t address, UINT32 mem_mask); | |
| 821 | void program_write_byte_32be(offs_t address, UINT8 data); | |
| 822 | void program_write_word_32be(offs_t address, UINT16 data); | |
| 823 | void program_write_dword_32be(offs_t address, UINT32 data); | |
| 824 | void program_write_masked_32be(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 831 | UINT8 program_read_byte_16be(offs_t address); | |
| 832 | UINT16 program_read_word_16be(offs_t address); | |
| 833 | UINT32 program_read_dword_16be(offs_t address); | |
| 834 | UINT64 program_read_qword_16be(offs_t address); | |
| 835 | void program_write_byte_16be(offs_t address, UINT8 data); | |
| 836 | void program_write_word_16be(offs_t address, UINT16 data); | |
| 837 | void program_write_dword_16be(offs_t address, UINT32 data); | |
| 838 | void program_write_qword_16be(offs_t address, UINT64 data); | |
| 825 | 839 | |
| 826 | 840 | UINT8 program_read_byte_32le(offs_t address); |
| 827 | 841 | UINT16 program_read_word_32le(offs_t address); |
| 828 | 842 | UINT32 program_read_dword_32le(offs_t address); |
| 829 | UINT32 program_read_masked_32le(offs_t address, UINT32 mem_mask); | |
| 843 | UINT32 program_read_dword_masked_32le(offs_t address, UINT32 mem_mask); | |
| 844 | UINT64 program_read_qword_32le(offs_t address); | |
| 830 | 845 | void program_write_byte_32le(offs_t address, UINT8 data); |
| 831 | 846 | void program_write_word_32le(offs_t address, UINT16 data); |
| 832 | 847 | void program_write_dword_32le(offs_t address, UINT32 data); |
| 833 | void program_write_masked_32le(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 848 | void program_write_dword_masked_32le(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 849 | void program_write_qword_32le(offs_t address, UINT64 data); | |
| 834 | 850 | |
| 835 | UINT8 program_read_byte_64be(offs_t address); | |
| 836 | UINT16 program_read_word_64be(offs_t address); | |
| 837 | UINT32 program_read_dword_64be(offs_t address); | |
| 838 | UINT64 program_read_qword_64be(offs_t address); | |
| 839 | UINT64 program_read_masked_64be(offs_t address, UINT64 mem_mask); | |
| 840 | void program_write_byte_64be(offs_t address, UINT8 data); | |
| 841 | void program_write_word_64be(offs_t address, UINT16 data); | |
| 842 | void program_write_dword_64be(offs_t address, UINT32 data); | |
| 843 | void program_write_qword_64be(offs_t address, UINT64 data); | |
| 844 | void program_write_masked_64be(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 851 | UINT8 program_read_byte_32be(offs_t address); | |
| 852 | UINT16 program_read_word_32be(offs_t address); | |
| 853 | UINT32 program_read_dword_32be(offs_t address); | |
| 854 | UINT32 program_read_dword_masked_32be(offs_t address, UINT32 mem_mask); | |
| 855 | UINT64 program_read_qword_32be(offs_t address); | |
| 856 | void program_write_byte_32be(offs_t address, UINT8 data); | |
| 857 | void program_write_word_32be(offs_t address, UINT16 data); | |
| 858 | void program_write_dword_32be(offs_t address, UINT32 data); | |
| 859 | void program_write_dword_masked_32be(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 860 | void program_write_qword_32be(offs_t address, UINT64 data); | |
| 845 | 861 | |
| 846 | 862 | UINT8 program_read_byte_64le(offs_t address); |
| 847 | 863 | UINT16 program_read_word_64le(offs_t address); |
| 848 | 864 | UINT32 program_read_dword_64le(offs_t address); |
| 849 | 865 | UINT64 program_read_qword_64le(offs_t address); |
| 850 | UINT64 program_read_masked_64le(offs_t address, UINT64 mem_mask); | |
| 866 | UINT64 program_read_qword_masked_64le(offs_t address, UINT64 mem_mask); | |
| 851 | 867 | void program_write_byte_64le(offs_t address, UINT8 data); |
| 852 | 868 | void program_write_word_64le(offs_t address, UINT16 data); |
| 853 | 869 | void program_write_dword_64le(offs_t address, UINT32 data); |
| 854 | 870 | void program_write_qword_64le(offs_t address, UINT64 data); |
| 855 | void program_write_masked_64le(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 871 | void program_write_qword_masked_64le(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 856 | 872 | |
| 873 | UINT8 program_read_byte_64be(offs_t address); | |
| 874 | UINT16 program_read_word_64be(offs_t address); | |
| 875 | UINT32 program_read_dword_64be(offs_t address); | |
| 876 | UINT64 program_read_qword_64be(offs_t address); | |
| 877 | UINT64 program_read_qword_masked_64be(offs_t address, UINT64 mem_mask); | |
| 878 | void program_write_byte_64be(offs_t address, UINT8 data); | |
| 879 | void program_write_word_64be(offs_t address, UINT16 data); | |
| 880 | void program_write_dword_64be(offs_t address, UINT32 data); | |
| 881 | void program_write_qword_64be(offs_t address, UINT64 data); | |
| 882 | void program_write_qword_masked_64be(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 883 | ||
| 884 | ||
| 857 | 885 | /* declare data address space handlers */ |
| 858 | UINT8 data_read_byte_8(offs_t address); | |
| 859 | void data_write_byte_8(offs_t address, UINT8 data); | |
| 886 | UINT8 data_read_byte_8le(offs_t address); | |
| 887 | UINT16 data_read_word_8le(offs_t address); | |
| 888 | UINT32 data_read_dword_8le(offs_t address); | |
| 889 | UINT64 data_read_qword_8le(offs_t address); | |
| 890 | void data_write_byte_8le(offs_t address, UINT8 data); | |
| 891 | void data_write_word_8le(offs_t address, UINT16 data); | |
| 892 | void data_write_dword_8le(offs_t address, UINT32 data); | |
| 893 | void data_write_qword_8le(offs_t address, UINT64 data); | |
| 860 | 894 | |
| 861 | UINT8 data_read_byte_16be(offs_t address); | |
| 862 | UINT16 data_read_word_16be(offs_t address); | |
| 863 | void data_write_byte_16be(offs_t address, UINT8 data); | |
| 864 | void data_write_word_16be(offs_t address, UINT16 data); | |
| 895 | UINT8 data_read_byte_8be(offs_t address); | |
| 896 | UINT16 data_read_word_8be(offs_t address); | |
| 897 | UINT32 data_read_dword_8be(offs_t address); | |
| 898 | UINT64 data_read_qword_8be(offs_t address); | |
| 899 | void data_write_byte_8be(offs_t address, UINT8 data); | |
| 900 | void data_write_word_8be(offs_t address, UINT16 data); | |
| 901 | void data_write_dword_8be(offs_t address, UINT32 data); | |
| 902 | void data_write_qword_8be(offs_t address, UINT64 data); | |
| 865 | 903 | |
| 866 | 904 | UINT8 data_read_byte_16le(offs_t address); |
| 867 | 905 | UINT16 data_read_word_16le(offs_t address); |
| 906 | UINT32 data_read_dword_16le(offs_t address); | |
| 907 | UINT64 data_read_qword_16le(offs_t address); | |
| 868 | 908 | void data_write_byte_16le(offs_t address, UINT8 data); |
| 869 | 909 | void data_write_word_16le(offs_t address, UINT16 data); |
| 910 | void data_write_dword_16le(offs_t address, UINT32 data); | |
| 911 | void data_write_qword_16le(offs_t address, UINT64 data); | |
| 870 | 912 | |
| 871 | UINT8 data_read_byte_32be(offs_t address); | |
| 872 | UINT16 data_read_word_32be(offs_t address); | |
| 873 | UINT32 data_read_dword_32be(offs_t address); | |
| 874 | UINT32 data_read_masked_32be(offs_t address, UINT32 mem_mask); | |
| 875 | void data_write_byte_32be(offs_t address, UINT8 data); | |
| 876 | void data_write_word_32be(offs_t address, UINT16 data); | |
| 877 | void data_write_dword_32be(offs_t address, UINT32 data); | |
| 878 | void data_write_masked_32be(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 913 | UINT8 data_read_byte_16be(offs_t address); | |
| 914 | UINT16 data_read_word_16be(offs_t address); | |
| 915 | UINT32 data_read_dword_16be(offs_t address); | |
| 916 | UINT64 data_read_qword_16be(offs_t address); | |
| 917 | void data_write_byte_16be(offs_t address, UINT8 data); | |
| 918 | void data_write_word_16be(offs_t address, UINT16 data); | |
| 919 | void data_write_dword_16be(offs_t address, UINT32 data); | |
| 920 | void data_write_qword_16be(offs_t address, UINT64 data); | |
| 879 | 921 | |
| 880 | 922 | UINT8 data_read_byte_32le(offs_t address); |
| 881 | 923 | UINT16 data_read_word_32le(offs_t address); |
| 882 | 924 | UINT32 data_read_dword_32le(offs_t address); |
| 883 | UINT32 data_read_masked_32le(offs_t address, UINT32 mem_mask); | |
| 925 | UINT32 data_read_dword_masked_32le(offs_t address, UINT32 mem_mask); | |
| 926 | UINT64 data_read_qword_32le(offs_t address); | |
| 884 | 927 | void data_write_byte_32le(offs_t address, UINT8 data); |
| 885 | 928 | void data_write_word_32le(offs_t address, UINT16 data); |
| 886 | 929 | void data_write_dword_32le(offs_t address, UINT32 data); |
| 887 | void data_write_masked_32le(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 930 | void data_write_dword_masked_32le(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 931 | void data_write_qword_32le(offs_t address, UINT64 data); | |
| 888 | 932 | |
| 889 | UINT8 data_read_byte_64be(offs_t address); | |
| 890 | UINT16 data_read_word_64be(offs_t address); | |
| 891 | UINT32 data_read_dword_64be(offs_t address); | |
| 892 | UINT64 data_read_qword_64be(offs_t address); | |
| 893 | UINT64 data_read_masked_64be(offs_t address, UINT64 mem_mask); | |
| 894 | void data_write_byte_64be(offs_t address, UINT8 data); | |
| 895 | void data_write_word_64be(offs_t address, UINT16 data); | |
| 896 | void data_write_dword_64be(offs_t address, UINT32 data); | |
| 897 | void data_write_qword_64be(offs_t address, UINT64 data); | |
| 898 | void data_write_masked_64be(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 933 | UINT8 data_read_byte_32be(offs_t address); | |
| 934 | UINT16 data_read_word_32be(offs_t address); | |
| 935 | UINT32 data_read_dword_32be(offs_t address); | |
| 936 | UINT32 data_read_dword_masked_32be(offs_t address, UINT32 mem_mask); | |
| 937 | UINT64 data_read_qword_32be(offs_t address); | |
| 938 | void data_write_byte_32be(offs_t address, UINT8 data); | |
| 939 | void data_write_word_32be(offs_t address, UINT16 data); | |
| 940 | void data_write_dword_32be(offs_t address, UINT32 data); | |
| 941 | void data_write_dword_masked_32be(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 942 | void data_write_qword_32be(offs_t address, UINT64 data); | |
| 899 | 943 | |
| 900 | 944 | UINT8 data_read_byte_64le(offs_t address); |
| 901 | 945 | UINT16 data_read_word_64le(offs_t address); |
| 902 | 946 | UINT32 data_read_dword_64le(offs_t address); |
| 903 | 947 | UINT64 data_read_qword_64le(offs_t address); |
| 904 | UINT64 data_read_masked_64le(offs_t address, UINT64 mem_mask); | |
| 948 | UINT64 data_read_qword_masked_64le(offs_t address, UINT64 mem_mask); | |
| 905 | 949 | void data_write_byte_64le(offs_t address, UINT8 data); |
| 906 | 950 | void data_write_word_64le(offs_t address, UINT16 data); |
| 907 | 951 | void data_write_dword_64le(offs_t address, UINT32 data); |
| 908 | 952 | void data_write_qword_64le(offs_t address, UINT64 data); |
| 909 | void data_write_masked_64le(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 953 | void data_write_qword_masked_64le(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 910 | 954 | |
| 911 | /* declare I/O address space handlers */ | |
| 912 | UINT8 io_read_byte_8(offs_t address); | |
| 913 | void io_write_byte_8(offs_t address, UINT8 data); | |
| 955 | UINT8 data_read_byte_64be(offs_t address); | |
| 956 | UINT16 data_read_word_64be(offs_t address); | |
| 957 | UINT32 data_read_dword_64be(offs_t address); | |
| 958 | UINT64 data_read_qword_64be(offs_t address); | |
| 959 | UINT64 data_read_qword_masked_64be(offs_t address, UINT64 mem_mask); | |
| 960 | void data_write_byte_64be(offs_t address, UINT8 data); | |
| 961 | void data_write_word_64be(offs_t address, UINT16 data); | |
| 962 | void data_write_dword_64be(offs_t address, UINT32 data); | |
| 963 | void data_write_qword_64be(offs_t address, UINT64 data); | |
| 964 | void data_write_qword_masked_64be(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 914 | 965 | |
| 915 | UINT8 io_read_byte_16be(offs_t address); | |
| 916 | UINT16 io_read_word_16be(offs_t address); | |
| 917 | void io_write_byte_16be(offs_t address, UINT8 data); | |
| 918 | void io_write_word_16be(offs_t address, UINT16 data); | |
| 919 | 966 | |
| 967 | /* declare io address space handlers */ | |
| 968 | UINT8 io_read_byte_8le(offs_t address); | |
| 969 | UINT16 io_read_word_8le(offs_t address); | |
| 970 | UINT32 io_read_dword_8le(offs_t address); | |
| 971 | UINT64 io_read_qword_8le(offs_t address); | |
| 972 | void io_write_byte_8le(offs_t address, UINT8 data); | |
| 973 | void io_write_word_8le(offs_t address, UINT16 data); | |
| 974 | void io_write_dword_8le(offs_t address, UINT32 data); | |
| 975 | void io_write_qword_8le(offs_t address, UINT64 data); | |
| 976 | ||
| 977 | UINT8 io_read_byte_8be(offs_t address); | |
| 978 | UINT16 io_read_word_8be(offs_t address); | |
| 979 | UINT32 io_read_dword_8be(offs_t address); | |
| 980 | UINT64 io_read_qword_8be(offs_t address); | |
| 981 | void io_write_byte_8be(offs_t address, UINT8 data); | |
| 982 | void io_write_word_8be(offs_t address, UINT16 data); | |
| 983 | void io_write_dword_8be(offs_t address, UINT32 data); | |
| 984 | void io_write_qword_8be(offs_t address, UINT64 data); | |
| 985 | ||
| 920 | 986 | UINT8 io_read_byte_16le(offs_t address); |
| 921 | 987 | UINT16 io_read_word_16le(offs_t address); |
| 988 | UINT32 io_read_dword_16le(offs_t address); | |
| 989 | UINT64 io_read_qword_16le(offs_t address); | |
| 922 | 990 | void io_write_byte_16le(offs_t address, UINT8 data); |
| 923 | 991 | void io_write_word_16le(offs_t address, UINT16 data); |
| 992 | void io_write_dword_16le(offs_t address, UINT32 data); | |
| 993 | void io_write_qword_16le(offs_t address, UINT64 data); | |
| 924 | 994 | |
| 925 | UINT8 io_read_byte_32be(offs_t address); | |
| 926 | UINT16 io_read_word_32be(offs_t address); | |
| 927 | UINT32 io_read_dword_32be(offs_t address); | |
| 928 | UINT32 io_read_masked_32be(offs_t address, UINT32 mem_mask); | |
| 929 | void io_write_byte_32be(offs_t address, UINT8 data); | |
| 930 | void io_write_word_32be(offs_t address, UINT16 data); | |
| 931 | void io_write_dword_32be(offs_t address, UINT32 data); | |
| 932 | void io_write_masked_32be(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 995 | UINT8 io_read_byte_16be(offs_t address); | |
| 996 | UINT16 io_read_word_16be(offs_t address); | |
| 997 | UINT32 io_read_dword_16be(offs_t address); | |
| 998 | UINT64 io_read_qword_16be(offs_t address); | |
| 999 | void io_write_byte_16be(offs_t address, UINT8 data); | |
| 1000 | void io_write_word_16be(offs_t address, UINT16 data); | |
| 1001 | void io_write_dword_16be(offs_t address, UINT32 data); | |
| 1002 | void io_write_qword_16be(offs_t address, UINT64 data); | |
| 933 | 1003 | |
| 934 | 1004 | UINT8 io_read_byte_32le(offs_t address); |
| 935 | 1005 | UINT16 io_read_word_32le(offs_t address); |
| 936 | 1006 | UINT32 io_read_dword_32le(offs_t address); |
| 937 | UINT32 io_read_masked_32le(offs_t address, UINT32 mem_mask); | |
| 1007 | UINT32 io_read_dword_masked_32le(offs_t address, UINT32 mem_mask); | |
| 1008 | UINT64 io_read_qword_32le(offs_t address); | |
| 938 | 1009 | void io_write_byte_32le(offs_t address, UINT8 data); |
| 939 | 1010 | void io_write_word_32le(offs_t address, UINT16 data); |
| 940 | 1011 | void io_write_dword_32le(offs_t address, UINT32 data); |
| 941 | void io_write_masked_32le(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 1012 | void io_write_dword_masked_32le(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 1013 | void io_write_qword_32le(offs_t address, UINT64 data); | |
| 942 | 1014 | |
| 943 | UINT8 io_read_byte_64be(offs_t address); | |
| 944 | UINT16 io_read_word_64be(offs_t address); | |
| 945 | UINT32 io_read_dword_64be(offs_t address); | |
| 946 | UINT64 io_read_qword_64be(offs_t address); | |
| 947 | UINT64 io_read_masked_64be(offs_t address, UINT64 mem_mask); | |
| 948 | void io_write_byte_64be(offs_t address, UINT8 data); | |
| 949 | void io_write_word_64be(offs_t address, UINT16 data); | |
| 950 | void io_write_dword_64be(offs_t address, UINT32 data); | |
| 951 | void io_write_qword_64be(offs_t address, UINT64 data); | |
| 952 | void io_write_masked_64be(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 1015 | UINT8 io_read_byte_32be(offs_t address); | |
| 1016 | UINT16 io_read_word_32be(offs_t address); | |
| 1017 | UINT32 io_read_dword_32be(offs_t address); | |
| 1018 | UINT32 io_read_dword_masked_32be(offs_t address, UINT32 mem_mask); | |
| 1019 | UINT64 io_read_qword_32be(offs_t address); | |
| 1020 | void io_write_byte_32be(offs_t address, UINT8 data); | |
| 1021 | void io_write_word_32be(offs_t address, UINT16 data); | |
| 1022 | void io_write_dword_32be(offs_t address, UINT32 data); | |
| 1023 | void io_write_dword_masked_32be(offs_t address, UINT32 data, UINT32 mem_mask); | |
| 1024 | void io_write_qword_32be(offs_t address, UINT64 data); | |
| 953 | 1025 | |
| 954 | 1026 | UINT8 io_read_byte_64le(offs_t address); |
| 955 | 1027 | UINT16 io_read_word_64le(offs_t address); |
| 956 | 1028 | UINT32 io_read_dword_64le(offs_t address); |
| 957 | 1029 | UINT64 io_read_qword_64le(offs_t address); |
| 958 | UINT64 io_read_masked_64le(offs_t address, UINT64 mem_mask); | |
| 1030 | UINT64 io_read_qword_masked_64le(offs_t address, UINT64 mem_mask); | |
| 959 | 1031 | void io_write_byte_64le(offs_t address, UINT8 data); |
| 960 | 1032 | void io_write_word_64le(offs_t address, UINT16 data); |
| 961 | 1033 | void io_write_dword_64le(offs_t address, UINT32 data); |
| 962 | 1034 | void io_write_qword_64le(offs_t address, UINT64 data); |
| 963 | void io_write_masked_64le(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 1035 | void io_write_qword_masked_64le(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 964 | 1036 | |
| 1037 | UINT8 io_read_byte_64be(offs_t address); | |
| 1038 | UINT16 io_read_word_64be(offs_t address); | |
| 1039 | UINT32 io_read_dword_64be(offs_t address); | |
| 1040 | UINT64 io_read_qword_64be(offs_t address); | |
| 1041 | UINT64 io_read_qword_masked_64be(offs_t address, UINT64 mem_mask); | |
| 1042 | void io_write_byte_64be(offs_t address, UINT8 data); | |
| 1043 | void io_write_word_64be(offs_t address, UINT16 data); | |
| 1044 | void io_write_dword_64be(offs_t address, UINT32 data); | |
| 1045 | void io_write_qword_64be(offs_t address, UINT64 data); | |
| 1046 | void io_write_qword_masked_64be(offs_t address, UINT64 data, UINT64 mem_mask); | |
| 965 | 1047 | |
| 1048 | ||
| 966 | 1049 | #endif /* __MEMORY_H__ */ |
| r2375 | r2376 | |
|---|---|---|
| 1517 | 1517 | static void init_machine(running_machine *machine) |
| 1518 | 1518 | { |
| 1519 | 1519 | mame_private *mame = machine->mame_data; |
| 1520 | time_t newbase; | |
| 1520 | 1521 | int num; |
| 1521 | 1522 | |
| 1522 | 1523 | /* initialize basic can't-fail systems here */ |
| r2375 | r2376 | |
| 1545 | 1546 | /* init the osd layer */ |
| 1546 | 1547 | osd_init(machine); |
| 1547 | 1548 | |
| 1549 | /* initialize the base time (needed for doing record/playback) */ | |
| 1550 | time(&mame->base_time); | |
| 1551 | ||
| 1548 | 1552 | /* initialize the input system and input ports for the game */ |
| 1549 | 1553 | /* this must be done before memory_init in order to allow specifying */ |
| 1550 | 1554 | /* callbacks based on input port tags */ |
| 1551 | input_port_init(machine, machine->gamedrv->ipt); | |
| 1555 | newbase = input_port_init(machine, machine->gamedrv->ipt); | |
| 1556 | if (newbase != 0) | |
| 1557 | mame->base_time = newbase; | |
| 1552 | 1558 | |
| 1553 | /* initialize the base time (if not doing record/playback) */ | |
| 1554 | if (machine->record_file == NULL && machine->playback_file == NULL) | |
| 1555 | time(&mame->base_time); | |
| 1556 | else | |
| 1557 | mame->base_time = 0; | |
| 1558 | ||
| 1559 | 1559 | /* first load ROMs, then populate memory, and finally initialize CPUs */ |
| 1560 | 1560 | /* these operations must proceed in this order */ |
| 1561 | 1561 | rom_init(machine, machine->gamedrv->rom); |
| r2375 | r2376 | |
|---|---|---|
| 133 | 133 | typedef struct _analog_port_info analog_port_info; |
| 134 | 134 | struct _analog_port_info |
| 135 | 135 | { |
| 136 | analog_port_info * next; /* linked list */ | |
| 137 | input_port_entry * port; /* pointer to the input port referenced */ | |
| 138 | double accum; /* accumulated value (including relative adjustments) */ | |
| 139 | double previous; /* previous adjusted value */ | |
| 140 | INT32 previousanalog; /* previous analog value */ | |
| 141 | INT32 minimum; /* minimum adjusted value */ | |
| 142 | INT32 maximum; /* maximum adjusted value */ | |
| 143 | INT32 center; /* center adjusted value for autocentering */ | |
| 144 | INT32 reverse_val; /* value where we subtract from to reverse directions */ | |
| 145 | double scalepos; /* scale factor to apply to positive adjusted values */ | |
| 146 | double scaleneg; /* scale factor to apply to negative adjusted values */ | |
| 147 | double keyscalepos; /* scale factor to apply to the key delta field when pos */ | |
| 148 | double keyscaleneg; /* scale factor to apply to the key delta field when neg */ | |
| 149 | double positionalscale;/* scale factor to divide a joystick into positions */ | |
| 150 | UINT8 shift; /* left shift to apply to the final result */ | |
| 151 | UINT8 bits; /* how many bits of resolution are expected? */ | |
| 152 | UINT8 absolute; /* is this an absolute or relative input? */ | |
| 153 | UINT8 wraps; /* does the control wrap around? */ | |
| 154 | UINT8 one_of_x; /* is this a 1 of X positional input? */ | |
| 155 | UINT8 autocenter; /* autocenter this input? */ | |
| 156 | UINT8 single_scale; /* scale joystick differently if default is between min/max */ | |
| 157 | UINT8 interpolate; /* should we do linear interpolation for mid-frame reads? */ | |
| 158 | UINT8 lastdigital; /* was the last modification caused by a digital form? */ | |
| 159 | UINT32 crosshair_pos; /* position of fake crosshair */ | |
| 136 | analog_port_info * next; /* linked list */ | |
| 137 | input_port_entry * portentry; /* pointer to the input port entry referenced */ | |
| 138 | INT32 accum; /* accumulated value (including relative adjustments) */ | |
| 139 | INT32 previous; /* previous adjusted value */ | |
| 140 | INT32 previousanalog; /* previous analog value */ | |
| 141 | INT32 minimum; /* minimum adjusted value */ | |
| 142 | INT32 maximum; /* maximum adjusted value */ | |
| 143 | INT32 center; /* center adjusted value for autocentering */ | |
| 144 | INT32 reverse_val; /* value where we subtract from to reverse directions */ | |
| 145 | INT64 scalepos; /* scale factor to apply to positive adjusted values */ | |
| 146 | INT64 scaleneg; /* scale factor to apply to negative adjusted values */ | |
| 147 | INT64 keyscalepos; /* scale factor to apply to the key delta field when pos */ | |
| 148 | INT64 keyscaleneg; /* scale factor to apply to the key delta field when neg */ | |
| 149 | INT64 positionalscale; /* scale factor to divide a joystick into positions */ | |
| 150 | UINT8 shift; /* left shift to apply to the final result */ | |
| 151 | UINT8 bits; /* how many bits of resolution are expected? */ | |
| 152 | UINT8 absolute; /* is this an absolute or relative input? */ | |
| 153 | UINT8 wraps; /* does the control wrap around? */ | |
| 154 | UINT8 one_of_x; /* is this a 1 of X positional input? */ | |
| 155 | UINT8 autocenter; /* autocenter this input? */ | |
| 156 | UINT8 single_scale; /* scale joystick differently if default is between min/max */ | |
| 157 | UINT8 interpolate; /* should we do linear interpolation for mid-frame reads? */ | |
| 158 | UINT8 lastdigital; /* was the last modification caused by a digital form? */ | |
| 159 | UINT32 crosshair_pos; /* position of fake crosshair */ | |
| 160 | 160 | }; |
| 161 | 161 | |
| 162 | 162 | |
| 163 | 163 | typedef struct _custom_port_info custom_port_info; |
| 164 | 164 | struct _custom_port_info |
| 165 | 165 | { |
| 166 | custom_port_info * next; /* linked list */ | |
| 167 | input_port_entry * port; /* pointer to the input port referenced */ | |
| 168 | UINT8 shift; /* left shift to apply to the final result */ | |
| 166 | custom_port_info * next; /* linked list */ | |
| 167 | input_port_entry * portentry; /* pointer to the input port entry referenced */ | |
| 168 | UINT8 shift; /* left shift to apply to the final result */ | |
| 169 | 169 | }; |
| 170 | 170 | |
| 171 | 171 | |
| 172 | 172 | typedef struct _changed_port_info changed_port_info; |
| 173 | 173 | struct _changed_port_info |
| 174 | 174 | { |
| 175 | changed_port_info * next; /* linked list */ | |
| 176 | input_port_entry * port; /* pointer to the input port referenced */ | |
| 177 | UINT8 shift; /* right shift to apply before calling callback */ | |
| 175 | changed_port_info * next; /* linked list */ | |
| 176 | input_port_entry * portentry; /* pointer to the input port entry referenced */ | |
| 177 | UINT8 shift; /* right shift to apply before calling callback */ | |
| 178 | 178 | }; |
| 179 | 179 | |
| 180 | 180 | |
| 181 | 181 | typedef struct _input_bit_info input_bit_info; |
| 182 | 182 | struct _input_bit_info |
| 183 | 183 | { |
| 184 | input_port_entry * port; /* port for this input */ | |
| 185 | UINT8 impulse; /* counter for impulse controls */ | |
| 186 | UINT8 last; /* were we pressed last time? */ | |
| 184 | input_port_entry * portentry; /* port entry for this input */ | |
| 185 | UINT8 impulse; /* counter for impulse controls */ | |
| 186 | UINT8 last; /* were we pressed last time? */ | |
| 187 | 187 | }; |
| 188 | 188 | |
| 189 | 189 | |
| 190 | 190 | typedef struct _input_port_info input_port_info; |
| 191 | 191 | struct _input_port_info |
| 192 | 192 | { |
| 193 | const char * tag; /* tag for this port */ | |
| 194 | UINT32 defvalue; /* default value of all the bits */ | |
| 195 | UINT32 analog; /* value from analog inputs */ | |
| 196 | UINT32 analogmask; /* mask of all analog inputs */ | |
| 197 | UINT32 digital; /* value from digital inputs */ | |
| 198 | UINT32 vblank; /* value of all IPT_VBLANK bits */ | |
| 199 | UINT32 playback; /* current playback override */ | |
| 200 | UINT8 has_custom; /* do we have any custom ports? */ | |
| 193 | const char * tag; /* tag for this port */ | |
| 194 | UINT32 defvalue; /* default value of all the bits */ | |
| 195 | UINT32 digital; /* value from digital inputs */ | |
| 196 | UINT32 vblank; /* value of all IPT_VBLANK bits */ | |
| 201 | 197 | input_bit_info bit[MAX_BITS_PER_PORT]; /* info about each bit in the port */ |
| 202 | analog_port_info * analoginfo; /* pointer to linked list of analog port info */ | |
| 203 | custom_port_info * custominfo; /* pointer to linked list of custom port info */ | |
| 204 | changed_port_info * changedinfo;/* pointer to linked list of changed port info */ | |
| 198 | analog_port_info * analoginfo; /* pointer to linked list of analog port info */ | |
| 199 | custom_port_info * custominfo; /* pointer to linked list of custom port info */ | |
| 200 | changed_port_info * changedinfo; /* pointer to linked list of changed port info */ | |
| 205 | 201 | }; |
| 206 | 202 | |
| 207 | 203 | |
| 208 | 204 | typedef struct _digital_joystick_info digital_joystick_info; |
| 209 | 205 | struct _digital_joystick_info |
| 210 | 206 | { |
| 211 | input_port_entry * port[4]; /* port for up,down,left,right respectively */ | |
| 212 | UINT8 inuse; /* is this joystick used? */ | |
| 213 | UINT8 current; /* current value */ | |
| 214 | UINT8 current4way;/* current 4-way value */ | |
| 215 | UINT8 previous; /* previous value */ | |
| 207 | input_port_entry * portentry[4]; /* port entry for up,down,left,right respectively */ | |
| 208 | UINT8 inuse; /* is this joystick used? */ | |
| 209 | UINT8 current; /* current value */ | |
| 210 | UINT8 current4way; /* current 4-way value */ | |
| 211 | UINT8 previous; /* previous value */ | |
| 216 | 212 | }; |
| 217 | 213 | |
| 218 | 214 | |
| 219 | 215 | struct _input_port_init_params |
| 220 | 216 | { |
| 221 | input_port_entry * ports; /* base of the port array */ | |
| 222 | int max_ports; /* maximum number of ports we can support */ | |
| 223 | int current_port;/* current port index */ | |
| 217 | input_port_entry * ports; /* base of the port array */ | |
| 218 | int max_ports; /* maximum number of ports we can support */ | |
| 219 | int current_port; /* current port index */ | |
| 224 | 220 | }; |
| 225 | 221 | |
| 226 | 222 | |
| r2375 | r2376 | |
| 234 | 230 | #define JOYSTICK_INFO_FOR_PORT(in) (&joystick_info[(in)->player][((in)->type - __ipt_digital_joystick_start) / 4]) |
| 235 | 231 | #define JOYSTICK_DIR_FOR_PORT(in) (((in)->type - __ipt_digital_joystick_start) % 4) |
| 236 | 232 | |
| 237 | #define APPLY_SENSITIVITY(x,s) (((double)(x) * (s)) / 100) | |
| 238 | #define APPLY_INVERSE_SENSITIVITY(x,s) (((double)(x) * 100) / (s)) | |
| 233 | #define APPLY_SENSITIVITY(x,s) (((INT64)(x) * (s)) / 100) | |
| 234 | #define APPLY_INVERSE_SENSITIVITY(x,s) (((INT64)(x) * 100) / (s)) | |
| 239 | 235 | |
| 236 | #define COMPUTE_SCALE(num,den) (((INT64)(num) << 24) / (den)) | |
| 237 | #define RECIP_SCALE(s) (((INT64)1 << 48) / (s)) | |
| 238 | #define APPLY_SCALE(x,s) (((INT64)(x) * (s)) >> 24) | |
| 240 | 239 | |
| 241 | 240 | |
| 241 | ||
| 242 | 242 | /*************************************************************************** |
| 243 | 243 | GLOBAL VARIABLES |
| 244 | 244 | ***************************************************************************/ |
| r2375 | r2376 | |
| 258 | 258 | /* original input_ports without modifications */ |
| 259 | 259 | static input_port_entry *input_ports_default; |
| 260 | 260 | |
| 261 | /* recorded speed read from an INP file */ | |
| 262 | static double rec_speed; | |
| 263 | ||
| 264 | /* set to TRUE if INP file being played is an extended INP file */ | |
| 265 | static int extended_inp; | |
| 266 | ||
| 267 | /* for average speed calculations */ | |
| 261 | /* for scaling analog ports */ | |
| 268 | 262 | static attotime last_update; |
| 269 | 263 | static attoseconds_t last_delta; |
| 270 | static int framecount; | |
| 271 | static double totalspeed; | |
| 272 | 264 | |
| 265 | /* playback information */ | |
| 266 | static UINT64 playback_accumulated_speed; | |
| 267 | static UINT32 playback_accumulated_frames; | |
| 273 | 268 | |
| 274 | 269 | |
| 270 | ||
| 275 | 271 | /*************************************************************************** |
| 276 | 272 | PORT HANDLER TABLES |
| 277 | 273 | ***************************************************************************/ |
| r2375 | r2376 | |
| 1034 | 1030 | FUNCTION PROTOTYPES |
| 1035 | 1031 | ***************************************************************************/ |
| 1036 | 1032 | |
| 1037 | static void setup_playback(running_machine *machine); | |
| 1038 | static void setup_record(running_machine *machine); | |
| 1039 | 1033 | static void input_port_exit(running_machine *machine); |
| 1040 | 1034 | static void input_port_frame(running_machine *machine); |
| 1035 | static void input_port_frame_update(running_machine *machine); | |
| 1041 | 1036 | static void input_port_load(int config_type, xml_data_node *parentnode); |
| 1042 | 1037 | static void input_port_save(int config_type, xml_data_node *parentnode); |
| 1043 | static void update_digital_joysticks( | |
| 1038 | static void update_digital_joysticks(running_machine *machine); | |
| 1044 | 1039 | static void update_analog_port(int port); |
| 1045 | static void interpolate_analog_port(int port); | |
| 1046 | 1040 | static void autoselect_device(const input_port_entry *ipt, int type1, int type2, int type3, const char *option, const char *ananame); |
| 1047 | 1041 | |
| 1042 | /* playback and record */ | |
| 1043 | static time_t playback_init(running_machine *machine); | |
| 1044 | static void record_init(running_machine *machine); | |
| 1045 | static void playback_end(running_machine *machine, const char *message); | |
| 1046 | static void record_end(running_machine *machine, const char *message); | |
| 1047 | static void playback_frame(running_machine *machine, attotime curtime); | |
| 1048 | static void record_frame(running_machine *machine, attotime curtime); | |
| 1049 | static void playback_port(running_machine *machine, input_port_info *portinfo); | |
| 1050 | static void record_port(running_machine *machine, input_port_info *portinfo); | |
| 1048 | 1051 | |
| 1049 | 1052 | |
| 1053 | ||
| 1050 | 1054 | /*************************************************************************** |
| 1051 | 1055 | CORE IMPLEMENTATION |
| 1052 | 1056 | ***************************************************************************/ |
| r2375 | r2376 | |
| 1057 | 1061 | * |
| 1058 | 1062 | *************************************/ |
| 1059 | 1063 | |
| 1060 | ||
| 1064 | t | |
| 1061 | 1065 | { |
| 1062 | 1066 | int ipnum, player; |
| 1067 | time_t basetime; | |
| 1063 | 1068 | |
| 1064 | 1069 | /* add an exit callback */ |
| 1065 | 1070 | add_exit_callback(machine, input_port_exit); |
| r2375 | r2376 | |
| 1089 | 1094 | if (ipt != NULL) |
| 1090 | 1095 | { |
| 1091 | 1096 | const char *joystick_map_default = options_get_string(mame_options(), OPTION_JOYSTICK_MAP); |
| 1092 | input_port_entry *port; | |
| 1097 | input_port_entry *portentry; | |
| 1093 | 1098 | int portnum; |
| 1094 | 1099 | |
| 1095 | 1100 | /* allocate input ports */ |
| r2375 | r2376 | |
| 1110 | 1115 | |
| 1111 | 1116 | /* look for 4-way joysticks and change the default map if we find any */ |
| 1112 | 1117 | if (joystick_map_default[0] == 0 || strcmp(joystick_map_default, "auto") == 0) |
| 1113 | for (port = machine->input_ports; port->type != IPT_END; port++) | |
| 1114 | if (IS_DIGITAL_JOYSTICK(port) && port->way == 4) | |
| 1118 | for (portentry = machine->input_ports; portentry->type != IPT_END; portentry++) | |
| 1119 | if (IS_DIGITAL_JOYSTICK(portentry) && portentry->way == 4) | |
| 1115 | 1120 | { |
| 1116 | input_device_set_joystick_map(-1, port->rotated ? joystick_map_4way_diagonal : joystick_map_4way_sticky); | |
| 1121 | input_device_set_joystick_map(-1, portentry->rotated ? joystick_map_4way_diagonal : joystick_map_4way_sticky); | |
| 1117 | 1122 | break; |
| 1118 | 1123 | } |
| 1119 | 1124 | |
| 1120 | 1125 | /* identify all the tagged ports up front so the memory system can access them */ |
| 1121 | 1126 | portnum = 0; |
| 1122 | for (port = machine->input_ports; port->type != IPT_END; port++) | |
| 1123 | if (port->type == IPT_PORT) | |
| 1124 | port_info[portnum++].tag = port->start.tag; | |
| 1127 | for (portentry = machine->input_ports; portentry->type != IPT_END; portentry++) | |
| 1128 | if (portentry->type == IPT_PORT) | |
| 1129 | port_info[portnum++].tag = portentry->start.tag; | |
| 1125 | 1130 | |
| 1126 | 1131 | /* look up all the tags referenced in conditions */ |
| 1127 | for (port = machine->input_ports; port->type != IPT_END; port++) | |
| 1128 | if (port->condition.tag) | |
| 1132 | for (portentry = machine->input_ports; portentry->type != IPT_END; portentry++) | |
| 1133 | if (portentry->condition.tag) | |
| 1129 | 1134 | { |
| 1130 | int tag = port_tag_to_index(port->condition.tag); | |
| 1135 | int tag = port_tag_to_index(portentry->condition.tag); | |
| 1131 | 1136 | if (tag == -1) |
| 1132 | fatalerror("Conditional port references invalid tag '%s'", port->condition.tag); | |
| 1133 | port->condition.portnum = tag; | |
| 1137 | fatalerror("Conditional port references invalid tag '%s'", portentry->condition.tag); | |
| 1138 | portentry->condition.portnum = tag; | |
| 1134 | 1139 | } |
| 1135 | 1140 | } |
| 1136 | 1141 | |
| r2375 | r2376 | |
| 1138 | 1143 | config_register("input", input_port_load, input_port_save); |
| 1139 | 1144 | |
| 1140 | 1145 | /* open playback and record files if specified */ |
| 1141 | setup_playback(machine); | |
| 1142 | setup_record(machine); | |
| 1143 | } | |
| 1146 | basetime = playback_init(machine); | |
| 1147 | record_init(machine); | |
| 1144 | 1148 | |
| 1145 | ||
| 1146 | ||
| 1147 | /************************************* | |
| 1148 | * | |
| 1149 | * Set up for playback | |
| 1150 | * | |
| 1151 | *************************************/ | |
| 1152 | ||
| 1153 | static void setup_playback(running_machine *machine) | |
| 1154 | { | |
| 1155 | const char *filename = options_get_string(mame_options(), OPTION_PLAYBACK); | |
| 1156 | ext_inp_header extinpheader; | |
| 1157 | inp_header inpheader; | |
| 1158 | file_error filerr; | |
| 1159 | time_t started_time; | |
| 1160 | char check[7]; | |
| 1161 | ||
| 1162 | /* if no file, nothing to do */ | |
| 1163 | if (filename[0] == 0) | |
| 1164 | return; | |
| 1165 | ||
| 1166 | /* open the playback file */ | |
| 1167 | filerr = mame_fopen(SEARCHPATH_INPUTLOG, filename, OPEN_FLAG_READ, &machine->playback_file); | |
| 1168 | assert_always(filerr == FILERR_NONE, "Failed to open file for playback"); | |
| 1169 | ||
| 1170 | /* read first four bytes to check INP type */ | |
| 1171 | mame_fread(machine->playback_file, check, 7); | |
| 1172 | mame_fseek(machine->playback_file, 0, SEEK_SET); | |
| 1173 | ||
| 1174 | /* Check if input file is an eXtended INP file */ | |
| 1175 | extended_inp = (memcmp(check, "XINP\0\0\0", 7) == 0); | |
| 1176 | if (!extended_inp) | |
| 1177 | { | |
| 1178 | /* read playback header */ | |
| 1179 | mame_fread(machine->playback_file, &inpheader, sizeof(inpheader)); | |
| 1180 | ||
| 1181 | /* if the first byte is not alphanumeric, it's an old INP file with no header */ | |
| 1182 | if (!isalnum(inpheader.name[0])) | |
| 1183 | mame_fseek(machine->playback_file, 0, SEEK_SET); | |
| 1184 | ||
| 1185 | /* else verify the header against the current game */ | |
| 1186 | else if (strcmp(machine->gamedrv->name, inpheader.name) != 0) | |
| 1187 | fatalerror("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", inpheader.name, machine->gamedrv->name); | |
| 1188 | ||
| 1189 | /* otherwise, print a message indicating what's happening */ | |
| 1190 | else | |
| 1191 | mame_printf_info("Playing back previously recorded " GAMENOUN " %s\n", machine->gamedrv->name); | |
| 1192 | } | |
| 1193 | else | |
| 1194 | { | |
| 1195 | /* read playback header */ | |
| 1196 | mame_fread(machine->playback_file, &extinpheader, sizeof(extinpheader)); | |
| 1197 | ||
| 1198 | /* output info to console */ | |
| 1199 | mame_printf_info("Extended INP file info:\n"); | |
| 1200 | mame_printf_info("Version string: %s\n", extinpheader.version); | |
| 1201 | started_time = (time_t)extinpheader.starttime; | |
| 1202 | mame_printf_info("Start time: %s\n", ctime(&started_time)); | |
| 1203 | ||
| 1204 | /* verify header against current game */ | |
| 1205 | if (strcmp(machine->gamedrv->name, extinpheader.shortname) != 0) | |
| 1206 | fatalerror("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", extinpheader.shortname, machine->gamedrv->name); | |
| 1207 | else | |
| 1208 | mame_printf_info("Playing back previously recorded " GAMENOUN " %s\n", machine->gamedrv->name); | |
| 1209 | } | |
| 1149 | return basetime; | |
| 1210 | 1150 | } |
| 1211 | 1151 | |
| 1212 | 1152 | |
| 1213 | /************************************* | |
| 1214 | * | |
| 1215 | * Set up for recording | |
| 1216 | * | |
| 1217 | *************************************/ | |
| 1218 | 1153 | |
| 1219 | static void setup_record(running_machine *machine) | |
| 1220 | { | |
| 1221 | const char *filename = options_get_string(mame_options(), OPTION_RECORD); | |
| 1222 | inp_header inpheader; | |
| 1223 | file_error filerr; | |
| 1224 | ||
| 1225 | /* if no file, nothing to do */ | |
| 1226 | if (filename[0] == 0) | |
| 1227 | return; | |
| 1228 | ||
| 1229 | /* open the record file */ | |
| 1230 | filerr = mame_fopen(SEARCHPATH_INPUTLOG, filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &machine->record_file); | |
| 1231 | assert_always(filerr == FILERR_NONE, "Failed to open file for recording"); | |
| 1232 | ||
| 1233 | /* create a header */ | |
| 1234 | memset(&inpheader, 0, sizeof(inpheader)); | |
| 1235 | strcpy(inpheader.name, machine->gamedrv->name); | |
| 1236 | mame_fwrite(machine->record_file, &inpheader, sizeof(inpheader)); | |
| 1237 | } | |
| 1238 | ||
| 1239 | ||
| 1240 | ||
| 1241 | 1154 | /************************************* |
| 1242 | 1155 | * |
| 1243 | 1156 | * Input port exit |
| r2375 | r2376 | |
| 1247 | 1160 | void input_port_exit(running_machine *machine) |
| 1248 | 1161 | { |
| 1249 | 1162 | /* close any playback or recording files */ |
| 1250 | if (machine->playback_file != NULL) | |
| 1251 | mame_fclose(machine->playback_file); | |
| 1252 | if (machine->record_file != NULL) | |
| 1253 | mame_fclose(machine->record_file); | |
| 1163 | playback_end(machine, NULL); | |
| 1164 | record_end(machine, NULL); | |
| 1254 | 1165 | } |
| 1255 | 1166 | |
| 1256 | 1167 | |
| r2375 | r2376 | |
| 1263 | 1174 | |
| 1264 | 1175 | static void input_port_postload(void) |
| 1265 | 1176 | { |
| 1266 | input_port_entry *port; | |
| 1177 | input_port_entry *portentry; | |
| 1267 | 1178 | int portnum, bitnum; |
| 1268 | 1179 | UINT32 mask; |
| 1269 | 1180 | |
| 1270 | 1181 | /* loop over the ports and identify all the analog inputs */ |
| 1271 | 1182 | portnum = -1; |
| 1272 | 1183 | bitnum = 0; |
| 1273 | for (port = Machine->input_ports; port->type != IPT_END; port++) | |
| 1184 | for (portentry = Machine->input_ports; portentry->type != IPT_END; portentry++) | |
| 1274 | 1185 | { |
| 1275 | 1186 | /* if this is IPT_PORT, increment the port number */ |
| 1276 | if (port->type == IPT_PORT) | |
| 1187 | if (portentry->type == IPT_PORT) | |
| 1277 | 1188 | { |
| 1278 | 1189 | portnum++; |
| 1279 | 1190 | bitnum = 0; |
| 1280 | 1191 | } |
| 1281 | 1192 | |
| 1282 | 1193 | /* if this is not a DIP setting or config setting, add it to the list */ |
| 1283 | else if (port->type != IPT_DIPSWITCH_SETTING && port->type != IPT_CONFIG_SETTING) | |
| 1194 | else if (portentry->type != IPT_DIPSWITCH_SETTING && portentry->type != IPT_CONFIG_SETTING) | |
| 1284 | 1195 | { |
| 1285 | 1196 | /* fatal error if we didn't hit an IPT_PORT */ |
| 1286 | 1197 | if (portnum < 0) |
| r2375 | r2376 | |
| 1291 | 1202 | fatalerror("Error in InputPort definition: too many bits for a port (%d max)", MAX_BITS_PER_PORT); |
| 1292 | 1203 | |
| 1293 | 1204 | /* fill in the bit info */ |
| 1294 | port_info[portnum].bit[bitnum].port = port; | |
| 1205 | port_info[portnum].bit[bitnum].portentry = portentry; | |
| 1295 | 1206 | port_info[portnum].bit[bitnum].impulse = 0; |
| 1296 | 1207 | port_info[portnum].bit[bitnum++].last = 0; |
| 1297 | 1208 | |
| 1298 | 1209 | /* if this is a custom input, add it to the list */ |
| 1299 | if (port->custom != NULL) | |
| 1210 | if (portentry->custom != NULL) | |
| 1300 | 1211 | { |
| 1301 | 1212 | custom_port_info *info; |
| 1302 | 1213 | |
| r2375 | r2376 | |
| 1305 | 1216 | memset(info, 0, sizeof(*info)); |
| 1306 | 1217 | |
| 1307 | 1218 | /* fill in the data */ |
| 1308 | info->port = port; | |
| 1309 | for (mask = port->mask; !(mask & 1); mask >>= 1) | |
| 1219 | info->portentry = portentry; | |
| 1220 | for (mask = portentry->mask; !(mask & 1); mask >>= 1) | |
| 1310 | 1221 | info->shift++; |
| 1311 | 1222 | |
| 1312 | 1223 | /* hook in the list */ |
| r2375 | r2376 | |
| 1315 | 1226 | } |
| 1316 | 1227 | |
| 1317 | 1228 | /* if this is a changed input, add it to the list */ |
| 1318 | else if (port->changed != NULL) | |
| 1229 | else if (portentry->changed != NULL) | |
| 1319 | 1230 | { |
| 1320 | 1231 | changed_port_info *info; |
| 1321 | 1232 | |
| r2375 | r2376 | |
| 1324 | 1235 | memset(info, 0, sizeof(*info)); |
| 1325 | 1236 | |
| 1326 | 1237 | /* fill in the data */ |
| 1327 | info->port = port; | |
| 1328 | for (mask = port->mask; !(mask & 1); mask >>= 1) | |
| 1238 | info->portentry = portentry; | |
| 1239 | for (mask = portentry->mask; !(mask & 1); mask >>= 1) | |
| 1329 | 1240 | info->shift++; |
| 1330 | 1241 | |
| 1331 | 1242 | /* hook in the list */ |
| r2375 | r2376 | |
| 1334 | 1245 | } |
| 1335 | 1246 | |
| 1336 | 1247 | /* if this is an analog port, create an info struct for it */ |
| 1337 | else if (IS_ANALOG(port)) | |
| 1248 | else if (IS_ANALOG(portentry)) | |
| 1338 | 1249 | { |
| 1339 | 1250 | analog_port_info *info; |
| 1340 | 1251 | |
| r2375 | r2376 | |
| 1343 | 1254 | memset(info, 0, sizeof(*info)); |
| 1344 | 1255 | |
| 1345 | 1256 | /* fill in the data */ |
| 1346 | info->port = port; | |
| 1347 | for (mask = port->mask; !(mask & 1); mask >>= 1) | |
| 1257 | info->portentry = portentry; | |
| 1258 | for (mask = portentry->mask; !(mask & 1); mask >>= 1) | |
| 1348 | 1259 | info->shift++; |
| 1349 | 1260 | for ( ; mask & 1; mask >>= 1) |
| 1350 | 1261 | info->bits++; |
| r2375 | r2376 | |
| 1355 | 1266 | info->interpolate = 1; |
| 1356 | 1267 | |
| 1357 | 1268 | /* adjust default, min, and max so they fall in the bitmask range */ |
| 1358 | port->default_value = (port->default_value & port->mask) >> info->shift; | |
| 1359 | if (port->type != IPT_POSITIONAL && port->type != IPT_POSITIONAL_V) | |
| 1269 | portentry->default_value = (portentry->default_value & portentry->mask) >> info->shift; | |
| 1270 | if (portentry->type != IPT_POSITIONAL && portentry->type != IPT_POSITIONAL_V) | |
| 1360 | 1271 | { |
| 1361 | port->analog.min = (port->analog.min & port->mask) >> info->shift; | |
| 1362 | port->analog.max = (port->analog.max & port->mask) >> info->shift; | |
| 1272 | portentry->analog.min = (portentry->analog.min & portentry->mask) >> info->shift; | |
| 1273 | portentry->analog.max = (portentry->analog.max & portentry->mask) >> info->shift; | |
| 1363 | 1274 | } |
| 1364 | 1275 | |
| 1365 | switch (port->type) | |
| 1276 | switch (portentry->type) | |
| 1366 | 1277 | { |
| 1367 | 1278 | /* pedals start at and autocenter to the min range*/ |
| 1368 | 1279 | case IPT_PEDAL: |
| r2375 | r2376 | |
| 1370 | 1281 | case IPT_PEDAL3: |
| 1371 | 1282 | info->center = INPUT_ABSOLUTE_MIN; |
| 1372 | 1283 | /* force pedals to start at their scaled minimum */ |
| 1373 | info->accum = APPLY_INVERSE_SENSITIVITY(info->center, port->analog.sensitivity); | |
| 1284 | info->accum = APPLY_INVERSE_SENSITIVITY(info->center, portentry->analog.sensitivity); | |
| 1374 | 1285 | /* fall through to complete setup */ |
| 1375 | 1286 | |
| 1376 | 1287 | /* pedals, paddles and analog joysticks are absolute and autocenter */ |
| r2375 | r2376 | |
| 1408 | 1319 | /* set each position to be 512 units */ |
| 1409 | 1320 | case IPT_POSITIONAL: |
| 1410 | 1321 | case IPT_POSITIONAL_V: |
| 1411 | info->positionalscale = ( | |
| 1322 | info->positionalscale = COMPUTE_SCALE( | |
| 1412 | 1323 | /* force to only use PORT_POSITIONS data */ |
| 1413 | port->analog.min = 0; | |
| 1414 | port->analog.max--; | |
| 1415 | info->autocenter = !port->analog.wraps; | |
| 1416 | info->wraps = port->analog.wraps; | |
| 1324 | portentry->analog.min = 0; | |
| 1325 | portentry->analog.max--; | |
| 1326 | info->autocenter = !portentry->analog.wraps; | |
| 1327 | info->wraps = portentry->analog.wraps; | |
| 1417 | 1328 | break; |
| 1418 | 1329 | |
| 1419 | 1330 | default: |
| r2375 | r2376 | |
| 1428 | 1339 | * and the default port value is between min/max, |
| 1429 | 1340 | * we need to scale differently for the +/- directions. |
| 1430 | 1341 | * All other absolute types use a 1:1 scale */ |
| 1431 | info->single_scale = (port->default_value == port->analog.min) || (port->default_value == port->analog.max); | |
| 1342 | info->single_scale = (portentry->default_value == portentry->analog.min) || (portentry->default_value == portentry->analog.max); | |
| 1432 | 1343 | |
| 1433 | 1344 | if (!info->single_scale) |
| 1434 | 1345 | { |
| 1435 | 1346 | /* axis moves in both directions from the default value */ |
| 1436 | 1347 | |
| 1437 | 1348 | /* unsigned */ |
| 1438 | info->scalepos = ((double)port->analog.max - (double)port->default_value) / (double)(INPUT_ABSOLUTE_MAX - 0); | |
| 1439 | info->scaleneg = ((double)port->default_value - (double)port->analog.min) / (double)(0 - INPUT_ABSOLUTE_MIN); | |
| 1349 | info->scalepos = COMPUTE_SCALE(portentry->analog.max - portentry->default_value, INPUT_ABSOLUTE_MAX - 0); | |
| 1350 | info->scaleneg = COMPUTE_SCALE(portentry->default_value - portentry->analog.min, 0 - INPUT_ABSOLUTE_MIN); | |
| 1440 | 1351 | |
| 1441 | if (port->analog.min > port->analog.max) | |
| 1352 | if (portentry->analog.min > portentry->analog.max) | |
| 1442 | 1353 | { |
| 1443 | 1354 | /* signed */ |
| 1444 | 1355 | info->scaleneg *= -1; |
| r2375 | r2376 | |
| 1450 | 1361 | else |
| 1451 | 1362 | { |
| 1452 | 1363 | /* single axis that increases from default */ |
| 1453 | info->scalepos = ( | |
| 1364 | info->scalepos = COMPUTE_SCALE( | |
| 1454 | 1365 | |
| 1455 | 1366 | /* move from default */ |
| 1456 | if (port->default_value == port->analog.max) | |
| 1367 | if (portentry->default_value == portentry->analog.max) | |
| 1457 | 1368 | info->scalepos *= -1; |
| 1458 | 1369 | |
| 1459 | 1370 | /* make the scaling the same for easier coding when we need to scale */ |
| r2375 | r2376 | |
| 1471 | 1382 | /* The validity checks are purposely set up to not allow you to use anything other */ |
| 1472 | 1383 | /* a default of 0 and PORT_MINMAX(0,mask). This is in case the need arises to use */ |
| 1473 | 1384 | /* this feature in the future. Keeping the code in does not hurt anything. */ |
| 1474 | if (port->analog.min > port->analog.max) | |
| 1385 | if (portentry->analog.min > portentry->analog.max) | |
| 1475 | 1386 | /* adjust for signed */ |
| 1476 | port->analog.min *= -1; | |
| 1387 | portentry->analog.min *= -1; | |
| 1477 | 1388 | |
| 1478 | info->minimum = (port->analog.min - port->default_value) * 512; | |
| 1479 | info->maximum = (port->analog.max - port->default_value) * 512; | |
| 1389 | info->minimum = (portentry->analog.min - portentry->default_value) * 512; | |
| 1390 | info->maximum = (portentry->analog.max - portentry->default_value) * 512; | |
| 1480 | 1391 | |
| 1481 | 1392 | /* make the scaling the same for easier coding when we need to scale */ |
| 1482 | info->scaleneg = info->scalepos = 1 | |
| 1393 | info->scaleneg = info->scalepos = COMPUTE_SCALE(1, | |
| 1483 | 1394 | |
| 1484 | if (port->analog.reset) | |
| 1395 | if (portentry->analog.reset) | |
| 1485 | 1396 | /* delta values reverse from center */ |
| 1486 | 1397 | info->reverse_val = 0; |
| 1487 | 1398 | else |
| r2375 | r2376 | |
| 1490 | 1401 | info->reverse_val = info->maximum + info->minimum; |
| 1491 | 1402 | |
| 1492 | 1403 | /* relative controls reverse from 1 past their max range */ |
| 1493 | if (info->positionalscale == 0) info->reverse_val += 512; | |
| 1404 | if (info->positionalscale == 0) | |
| 1405 | info->reverse_val += 512; | |
| 1494 | 1406 | } |
| 1495 | 1407 | } |
| 1496 | 1408 | |
| 1497 | 1409 | /* compute scale for keypresses */ |
| 1498 | info->keyscalepos = 1.0 / info->scalepos; | |
| 1499 | info->keyscaleneg = 1.0 / info->scaleneg; | |
| 1410 | info->keyscalepos = RECIP_SCALE(info->scalepos); | |
| 1411 | info->keyscaleneg = RECIP_SCALE(info->scaleneg); | |
| 1500 | 1412 | |
| 1501 | 1413 | /* hook in the list */ |
| 1502 | 1414 | info->next = port_info[portnum].analoginfo; |
| r2375 | r2376 | |
| 1504 | 1416 | } |
| 1505 | 1417 | |
| 1506 | 1418 | /* if this is a digital joystick port, update info on it */ |
| 1507 | else if (IS_DIGITAL_JOYSTICK(port)) | |
| 1419 | else if (IS_DIGITAL_JOYSTICK(portentry)) | |
| 1508 | 1420 | { |
| 1509 | digital_joystick_info *info = JOYSTICK_INFO_FOR_PORT(port); | |
| 1510 | info->port[JOYSTICK_DIR_FOR_PORT(port)] = port; | |
| 1421 | digital_joystick_info *info = JOYSTICK_INFO_FOR_PORT(portentry); | |
| 1422 | info->portentry[JOYSTICK_DIR_FOR_PORT(portentry)] = portentry; | |
| 1511 | 1423 | info->inuse = 1; |
| 1512 | 1424 | } |
| 1513 | 1425 | } |
| 1514 | 1426 | } |
| 1515 | 1427 | |
| 1516 | 1428 | /* run an initial update */ |
| 1517 | input_port_frame(Machine); | |
| 1429 | input_port_frame_update(Machine); | |
| 1518 | 1430 | } |
| 1519 | 1431 | |
| 1520 | 1432 | |
| r2375 | r2376 | |
| 1951 | 1863 | static void input_port_detokenize(input_port_init_params *param, const input_port_token *ipt) |
| 1952 | 1864 | { |
| 1953 | 1865 | UINT32 entrytype = INPUT_TOKEN_INVALID; |
| 1954 | input_port_entry *port = NULL; | |
| 1866 | input_port_entry *portentry = NULL; | |
| 1955 | 1867 | const char *modify_tag = NULL; |
| 1956 | 1868 | int seq_index[3] = {0}; |
| 1957 | 1869 | |
| r2375 | r2376 | |
| 1982 | 1894 | case INPUT_TOKEN_START: |
| 1983 | 1895 | case INPUT_TOKEN_START_TAG: |
| 1984 | 1896 | modify_tag = NULL; |
| 1985 | port = input_port_initialize(param, IPT_PORT, NULL, 0, 0); | |
| 1897 | portentry = input_port_initialize(param, IPT_PORT, NULL, 0, 0); | |
| 1986 | 1898 | if (entrytype == INPUT_TOKEN_START_TAG) |
| 1987 | port->start.tag = TOKEN_GET_STRING(ipt); | |
| 1899 | portentry->start.tag = TOKEN_GET_STRING(ipt); | |
| 1988 | 1900 | break; |
| 1989 | 1901 | |
| 1990 | 1902 | /* modify an existing port */ |
| r2375 | r2376 | |
| 1997 | 1909 | TOKEN_UNGET_UINT32(ipt); |
| 1998 | 1910 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, type, 24); |
| 1999 | 1911 | TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32); |
| 2000 | port = input_port_initialize(param, type, modify_tag, mask, defval); | |
| 1912 | portentry = input_port_initialize(param, type, modify_tag, mask, defval); | |
| 2001 | 1913 | seq_index[0] = seq_index[1] = seq_index[2] = 0; |
| 2002 | 1914 | break; |
| 2003 | 1915 | |
| r2375 | r2376 | |
| 2006 | 1918 | TOKEN_GET_UINT32_UNPACK3(ipt, entrytype, 8, hasdiploc, 1, strindex, 23); |
| 2007 | 1919 | TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32); |
| 2008 | 1920 | |
| 2009 | port = input_port_initialize(param, IPT_DIPSWITCH_NAME, modify_tag, mask, mask & defval); | |
| 1921 | portentry = input_port_initialize(param, IPT_DIPSWITCH_NAME, modify_tag, mask, mask & defval); | |
| 2010 | 1922 | temptoken.i = strindex; |
| 2011 | port->name = input_port_string_from_token(temptoken); | |
| 1923 | portentry->name = input_port_string_from_token(temptoken); | |
| 2012 | 1924 | if (strindex == INPUT_STRING_Service_Mode) |
| 2013 | 1925 | { |
| 2014 | port->toggle = TRUE; | |
| 2015 | port->seq.code[0] = KEYCODE_F2; | |
| 1926 | portentry->toggle = TRUE; | |
| 1927 | portentry->seq.code[0] = KEYCODE_F2; | |
| 2016 | 1928 | } |
| 2017 | 1929 | if (hasdiploc) |
| 2018 | input_port_parse_diplocation(port, TOKEN_GET_STRING(ipt)); | |
| 1930 | input_port_parse_diplocation(portentry, TOKEN_GET_STRING(ipt)); | |
| 2019 | 1931 | |
| 2020 | port = input_port_initialize(param, IPT_DIPSWITCH_SETTING, modify_tag, 0, mask & defval); | |
| 1932 | portentry = input_port_initialize(param, IPT_DIPSWITCH_SETTING, modify_tag, 0, mask & defval); | |
| 2021 | 1933 | temptoken.i = INPUT_STRING_Off; |
| 2022 | port->name = input_port_string_from_token(temptoken); | |
| 1934 | portentry->name = input_port_string_from_token(temptoken); | |
| 2023 | 1935 | |
| 2024 | port = input_port_initialize(param, IPT_DIPSWITCH_SETTING, modify_tag, 0, mask & ~defval); | |
| 1936 | portentry = input_port_initialize(param, IPT_DIPSWITCH_SETTING, modify_tag, 0, mask & ~defval); | |
| 2025 | 1937 | temptoken.i = INPUT_STRING_On; |
| 2026 | port->name = input_port_string_from_token(temptoken); | |
| 1938 | portentry->name = input_port_string_from_token(temptoken); | |
| 2027 | 1939 | break; |
| 2028 | 1940 | |
| 2029 | 1941 | /* append a code */ |
| r2375 | r2376 | |
| 2031 | 1943 | TOKEN_UNGET_UINT32(ipt); |
| 2032 | 1944 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, val, 32); |
| 2033 | 1945 | if (seq_index[0] > 0) |
| 2034 | port->seq.code[seq_index[0]++] = SEQCODE_OR; | |
| 2035 | port->seq.code[seq_index[0]++] = val; | |
| 1946 | portentry->seq.code[seq_index[0]++] = SEQCODE_OR; | |
| 1947 | portentry->seq.code[seq_index[0]++] = val; | |
| 2036 | 1948 | break; |
| 2037 | 1949 | |
| 2038 | 1950 | case INPUT_TOKEN_CODE_DEC: |
| 2039 | 1951 | TOKEN_UNGET_UINT32(ipt); |
| 2040 | 1952 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, val, 32); |
| 2041 | 1953 | if (seq_index[1] > 0) |
| 2042 | port->analog.decseq.code[seq_index[1]++] = SEQCODE_OR; | |
| 2043 | port->analog.decseq.code[seq_index[1]++] = val; | |
| 1954 | portentry->analog.decseq.code[seq_index[1]++] = SEQCODE_OR; | |
| 1955 | portentry->analog.decseq.code[seq_index[1]++] = val; | |
| 2044 | 1956 | break; |
| 2045 | 1957 | |
| 2046 | 1958 | case INPUT_TOKEN_CODE_INC: |
| 2047 | 1959 | TOKEN_UNGET_UINT32(ipt); |
| 2048 | 1960 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, val, 32); |
| 2049 | 1961 | if (seq_index[2] > 0) |
| 2050 | port->analog.incseq.code[seq_index[2]++] = SEQCODE_OR; | |
| 2051 | port->analog.incseq.code[seq_index[2]++] = val; | |
| 1962 | portentry->analog.incseq.code[seq_index[2]++] = SEQCODE_OR; | |
| 1963 | portentry->analog.incseq.code[seq_index[2]++] = val; | |
| 2052 | 1964 | break; |
| 2053 | 1965 | |
| 2054 | 1966 | /* joystick flags */ |
| r2375 | r2376 | |
| 2056 | 1968 | case INPUT_TOKEN_4WAY: |
| 2057 | 1969 | case INPUT_TOKEN_8WAY: |
| 2058 | 1970 | case INPUT_TOKEN_16WAY: |
| 2059 | port->way = 2 << (entrytype - INPUT_TOKEN_2WAY); | |
| 1971 | portentry->way = 2 << (entrytype - INPUT_TOKEN_2WAY); | |
| 2060 | 1972 | break; |
| 2061 | 1973 | |
| 2062 | 1974 | case INPUT_TOKEN_ROTATED: |
| 2063 | port->rotated = TRUE; | |
| 1975 | portentry->rotated = TRUE; | |
| 2064 | 1976 | break; |
| 2065 | 1977 | |
| 2066 | 1978 | /* general flags */ |
| 2067 | 1979 | case INPUT_TOKEN_NAME: |
| 2068 | port->name = input_port_string_from_token(*ipt++); | |
| 1980 | portentry->name = input_port_string_from_token(*ipt++); | |
| 2069 | 1981 | break; |
| 2070 | 1982 | |
| 2071 | 1983 | case INPUT_TOKEN_PLAYER1: |
| r2375 | r2376 | |
| 2076 | 1988 | case INPUT_TOKEN_PLAYER6: |
| 2077 | 1989 | case INPUT_TOKEN_PLAYER7: |
| 2078 | 1990 | case INPUT_TOKEN_PLAYER8: |
| 2079 | port->player = entrytype - INPUT_TOKEN_PLAYER1; | |
| 1991 | portentry->player = entrytype - INPUT_TOKEN_PLAYER1; | |
| 2080 | 1992 | break; |
| 2081 | 1993 | |
| 2082 | 1994 | case INPUT_TOKEN_COCKTAIL: |
| 2083 | port->cocktail = TRUE; | |
| 2084 | port->player = 1; | |
| 1995 | portentry->cocktail = TRUE; | |
| 1996 | portentry->player = 1; | |
| 2085 | 1997 | break; |
| 2086 | 1998 | |
| 2087 | 1999 | case INPUT_TOKEN_TOGGLE: |
| 2088 | port->toggle = TRUE; | |
| 2000 | portentry->toggle = TRUE; | |
| 2089 | 2001 | break; |
| 2090 | 2002 | |
| 2091 | 2003 | case INPUT_TOKEN_IMPULSE: |
| 2092 | 2004 | TOKEN_UNGET_UINT32(ipt); |
| 2093 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, port->impulse, 24); | |
| 2005 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, portentry->impulse, 24); | |
| 2094 | 2006 | break; |
| 2095 | 2007 | |
| 2096 | 2008 | case INPUT_TOKEN_REVERSE: |
| 2097 | port->analog.reverse = TRUE; | |
| 2009 | portentry->analog.reverse = TRUE; | |
| 2098 | 2010 | break; |
| 2099 | 2011 | |
| 2100 | 2012 | case INPUT_TOKEN_RESET: |
| 2101 | port->analog.reset = TRUE; | |
| 2013 | portentry->analog.reset = TRUE; | |
| 2102 | 2014 | break; |
| 2103 | 2015 | |
| 2104 | 2016 | case INPUT_TOKEN_UNUSED: |
| 2105 | port->unused = TRUE; | |
| 2017 | portentry->unused = TRUE; | |
| 2106 | 2018 | break; |
| 2107 | 2019 | |
| 2108 | 2020 | /* analog settings */ |
| 2109 | 2021 | case INPUT_TOKEN_MINMAX: |
| 2110 | TOKEN_GET_UINT64_UNPACK2(ipt, port->analog.min, 32, port->analog.max, 32); | |
| 2022 | TOKEN_GET_UINT64_UNPACK2(ipt, portentry->analog.min, 32, portentry->analog.max, 32); | |
| 2111 | 2023 | break; |
| 2112 | 2024 | |
| 2113 | 2025 | case INPUT_TOKEN_SENSITIVITY: |
| 2114 | 2026 | TOKEN_UNGET_UINT32(ipt); |
| 2115 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, port->analog.sensitivity, 24); | |
| 2027 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, portentry->analog.sensitivity, 24); | |
| 2116 | 2028 | break; |
| 2117 | 2029 | |
| 2118 | 2030 | case INPUT_TOKEN_KEYDELTA: |
| 2119 | 2031 | TOKEN_UNGET_UINT32(ipt); |
| 2120 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, port->analog.delta, -24); | |
| 2121 | port->analog.centerdelta = port->analog.delta; | |
| 2032 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, portentry->analog.delta, -24); | |
| 2033 | portentry->analog.centerdelta = portentry->analog.delta; | |
| 2122 | 2034 | break; |
| 2123 | 2035 | |
| 2124 | 2036 | case INPUT_TOKEN_CENTERDELTA: |
| 2125 | 2037 | TOKEN_UNGET_UINT32(ipt); |
| 2126 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, port->analog.centerdelta, -24); | |
| 2038 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, portentry->analog.centerdelta, -24); | |
| 2127 | 2039 | break; |
| 2128 | 2040 | |
| 2129 | 2041 | case INPUT_TOKEN_CROSSHAIR: |
| 2130 | 2042 | TOKEN_UNGET_UINT32(ipt); |
| 2131 | TOKEN_GET_UINT32_UNPACK3(ipt, entrytype, 8, port->analog.crossaxis, 4, port->analog.crossaltaxis, -20); | |
| 2132 | TOKEN_GET_UINT64_UNPACK2(ipt, port->analog.crossscale, -32, port->analog.crossoffset, -32); | |
| 2133 | port->analog.crossaltaxis *= 1.0f / 65536.0f; | |
| 2134 | port->analog.crossscale *= 1.0f / 65536.0f; | |
| 2135 | port->analog.crossoffset *= 1.0f / 65536.0f; | |
| 2043 | TOKEN_GET_UINT32_UNPACK3(ipt, entrytype, 8, portentry->analog.crossaxis, 4, portentry->analog.crossaltaxis, -20); | |
| 2044 | TOKEN_GET_UINT64_UNPACK2(ipt, portentry->analog.crossscale, -32, portentry->analog.crossoffset, -32); | |
| 2045 | portentry->analog.crossaltaxis *= 1.0f / 65536.0f; | |
| 2046 | portentry->analog.crossscale *= 1.0f / 65536.0f; | |
| 2047 | portentry->analog.crossoffset *= 1.0f / 65536.0f; | |
| 2136 | 2048 | break; |
| 2137 | 2049 | |
| 2138 | 2050 | case INPUT_TOKEN_FULL_TURN_COUNT: |
| 2139 | 2051 | TOKEN_UNGET_UINT32(ipt); |
| 2140 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, port->analog.full_turn_count, 24); | |
| 2052 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, portentry->analog.full_turn_count, 24); | |
| 2141 | 2053 | break; |
| 2142 | 2054 | |
| 2143 | 2055 | case INPUT_TOKEN_POSITIONS: |
| 2144 | 2056 | TOKEN_UNGET_UINT32(ipt); |
| 2145 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, port->analog.max, 24); | |
| 2057 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, portentry->analog.max, 24); | |
| 2146 | 2058 | break; |
| 2147 | 2059 | |
| 2148 | 2060 | case INPUT_TOKEN_WRAPS: |
| 2149 | port->analog.wraps = TRUE; | |
| 2061 | portentry->analog.wraps = TRUE; | |
| 2150 | 2062 | break; |
| 2151 | 2063 | |
| 2152 | 2064 | case INPUT_TOKEN_REMAP_TABLE: |
| 2153 | port->analog.remap_table = TOKEN_GET_PTR(ipt, ui32ptr); | |
| 2065 | portentry->analog.remap_table = TOKEN_GET_PTR(ipt, ui32ptr); | |
| 2154 | 2066 | break; |
| 2155 | 2067 | |
| 2156 | 2068 | case INPUT_TOKEN_INVERT: |
| 2157 | port->analog.invert = TRUE; | |
| 2069 | portentry->analog.invert = TRUE; | |
| 2158 | 2070 | break; |
| 2159 | 2071 | |
| 2160 | 2072 | /* custom callbacks */ |
| 2161 | 2073 | case INPUT_TOKEN_CUSTOM: |
| 2162 | port->custom = TOKEN_GET_PTR(ipt, customptr); | |
| 2163 | port->custom_param = (void *)TOKEN_GET_PTR(ipt, voidptr); | |
| 2074 | portentry->custom = TOKEN_GET_PTR(ipt, customptr); | |
| 2075 | portentry->custom_param = (void *)TOKEN_GET_PTR(ipt, voidptr); | |
| 2164 | 2076 | break; |
| 2165 | 2077 | |
| 2166 | 2078 | /* changed callbacks */ |
| 2167 | 2079 | case INPUT_TOKEN_CHANGED: |
| 2168 | port->changed = TOKEN_GET_PTR(ipt, changedptr); | |
| 2169 | port->changed_param = (void *)TOKEN_GET_PTR(ipt, voidptr); | |
| 2080 | portentry->changed = TOKEN_GET_PTR(ipt, changedptr); | |
| 2081 | portentry->changed_param = (void *)TOKEN_GET_PTR(ipt, voidptr); | |
| 2170 | 2082 | break; |
| 2171 | 2083 | |
| 2172 | 2084 | /* dip switch definition */ |
| 2173 | 2085 | case INPUT_TOKEN_DIPNAME: |
| 2174 | 2086 | TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32); |
| 2175 | port = input_port_initialize(param, IPT_DIPSWITCH_NAME, modify_tag, mask, defval); | |
| 2087 | portentry = input_port_initialize(param, IPT_DIPSWITCH_NAME, modify_tag, mask, defval); | |
| 2176 | 2088 | seq_index[0] = seq_index[1] = seq_index[2] = 0; |
| 2177 | port->name = input_port_string_from_token(*ipt++); | |
| 2089 | portentry->name = input_port_string_from_token(*ipt++); | |
| 2178 | 2090 | break; |
| 2179 | 2091 | |
| 2180 | 2092 | case INPUT_TOKEN_DIPSETTING: |
| 2181 | 2093 | TOKEN_UNGET_UINT32(ipt); |
| 2182 | 2094 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, defval, 32); |
| 2183 | port = input_port_initialize(param, IPT_DIPSWITCH_SETTING, modify_tag, 0, defval); | |
| 2095 | portentry = input_port_initialize(param, IPT_DIPSWITCH_SETTING, modify_tag, 0, defval); | |
| 2184 | 2096 | seq_index[0] = seq_index[1] = seq_index[2] = 0; |
| 2185 | port->name = input_port_string_from_token(*ipt++); | |
| 2097 | portentry->name = input_port_string_from_token(*ipt++); | |
| 2186 | 2098 | break; |
| 2187 | 2099 | |
| 2188 | 2100 | /* physical location */ |
| 2189 | 2101 | case INPUT_TOKEN_DIPLOCATION: |
| 2190 | input_port_parse_diplocation(port, TOKEN_GET_STRING(ipt)); | |
| 2102 | input_port_parse_diplocation(portentry, TOKEN_GET_STRING(ipt)); | |
| 2191 | 2103 | break; |
| 2192 | 2104 | |
| 2193 | 2105 | /* conditionals for dip switch settings */ |
| 2194 | 2106 | case INPUT_TOKEN_CONDITION: |
| 2195 | 2107 | TOKEN_UNGET_UINT32(ipt); |
| 2196 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, port->condition.condition, 24); | |
| 2197 | TOKEN_GET_UINT64_UNPACK2(ipt, port->condition.mask, 32, port->condition.value, 32); | |
| 2198 | port->condition.tag = TOKEN_GET_STRING(ipt); | |
| 2108 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, portentry->condition.condition, 24); | |
| 2109 | TOKEN_GET_UINT64_UNPACK2(ipt, portentry->condition.mask, 32, portentry->condition.value, 32); | |
| 2110 | portentry->condition.tag = TOKEN_GET_STRING(ipt); | |
| 2199 | 2111 | break; |
| 2200 | 2112 | |
| 2201 | 2113 | /* analog adjuster definition */ |
| 2202 | 2114 | case INPUT_TOKEN_ADJUSTER: |
| 2203 | 2115 | TOKEN_UNGET_UINT32(ipt); |
| 2204 | 2116 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, defval, 32); |
| 2205 | port = input_port_initialize(param, IPT_ADJUSTER, modify_tag, 0xff, defval | (defval << 8)); | |
| 2117 | portentry = input_port_initialize(param, IPT_ADJUSTER, modify_tag, 0xff, defval | (defval << 8)); | |
| 2206 | 2118 | seq_index[0] = seq_index[1] = seq_index[2] = 0; |
| 2207 | port->name = TOKEN_GET_STRING(ipt); | |
| 2119 | portentry->name = TOKEN_GET_STRING(ipt); | |
| 2208 | 2120 | break; |
| 2209 | 2121 | |
| 2210 | 2122 | /* configuration definition */ |
| 2211 | 2123 | case INPUT_TOKEN_CONFNAME: |
| 2212 | 2124 | TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32); |
| 2213 | port = input_port_initialize(param, IPT_CONFIG_NAME, modify_tag, mask, defval); | |
| 2125 | portentry = input_port_initialize(param, IPT_CONFIG_NAME, modify_tag, mask, defval); | |
| 2214 | 2126 | seq_index[0] = seq_index[1] = seq_index[2] = 0; |
| 2215 | port->name = input_port_string_from_token(*ipt++); | |
| 2127 | portentry->name = input_port_string_from_token(*ipt++); | |
| 2216 | 2128 | break; |
| 2217 | 2129 | |
| 2218 | 2130 | case INPUT_TOKEN_CONFSETTING: |
| 2219 | 2131 | TOKEN_UNGET_UINT32(ipt); |
| 2220 | 2132 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, defval, 32); |
| 2221 | port = input_port_initialize(param, IPT_CONFIG_SETTING, modify_tag, 0, defval); | |
| 2133 | portentry = input_port_initialize(param, IPT_CONFIG_SETTING, modify_tag, 0, defval); | |
| 2222 | 2134 | seq_index[0] = seq_index[1] = seq_index[2] = 0; |
| 2223 | port->name = input_port_string_from_token(*ipt++); | |
| 2135 | portentry->name = input_port_string_from_token(*ipt++); | |
| 2224 | 2136 | break; |
| 2225 | 2137 | |
| 2226 | 2138 | #ifdef MESS |
| r2375 | r2376 | |
| 2229 | 2141 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, val, 24); |
| 2230 | 2142 | { |
| 2231 | 2143 | int ch; |
| 2232 | for (ch = 0; port->keyboard.chars[ch] != 0; ch++) | |
| 2144 | for (ch = 0; portentry->keyboard.chars[ch] != 0; ch++) | |
| 2233 | 2145 | ; |
| 2234 | port->keyboard.chars[ch] = (unicode_char) val; | |
| 2146 | portentry->keyboard.chars[ch] = (unicode_char) val; | |
| 2235 | 2147 | } |
| 2236 | 2148 | break; |
| 2237 | 2149 | |
| 2238 | 2150 | /* category definition */ |
| 2239 | 2151 | case INPUT_TOKEN_CATEGORY: |
| 2240 | 2152 | TOKEN_UNGET_UINT32(ipt); |
| 2241 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, port->category, 24); | |
| 2153 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, portentry->category, 24); | |
| 2242 | 2154 | break; |
| 2243 | 2155 | |
| 2244 | 2156 | case INPUT_TOKEN_CATEGORY_NAME: |
| 2245 | 2157 | TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32); |
| 2246 | port = input_port_initialize(param, IPT_CATEGORY_NAME, modify_tag, mask, defval); | |
| 2158 | portentry = input_port_initialize(param, IPT_CATEGORY_NAME, modify_tag, mask, defval); | |
| 2247 | 2159 | seq_index[0] = seq_index[1] = seq_index[2] = 0; |
| 2248 | port->name = input_port_string_from_token(*ipt++); | |
| 2160 | portentry->name = input_port_string_from_token(*ipt++); | |
| 2249 | 2161 | break; |
| 2250 | 2162 | |
| 2251 | 2163 | case INPUT_TOKEN_CATEGORY_SETTING: |
| 2252 | 2164 | TOKEN_UNGET_UINT32(ipt); |
| 2253 | 2165 | TOKEN_GET_UINT64_UNPACK3(ipt, entrytype, 8, defval, 32, category, 16); |
| 2254 | port = input_port_initialize(param, IPT_CATEGORY_SETTING, modify_tag, 0, defval); | |
| 2166 | portentry = input_port_initialize(param, IPT_CATEGORY_SETTING, modify_tag, 0, defval); | |
| 2255 | 2167 | seq_index[0] = seq_index[1] = seq_index[2] = 0; |
| 2256 | port->name = input_port_string_from_token(*ipt++); | |
| 2257 | port->category = category; | |
| 2168 | portentry->name = input_port_string_from_token(*ipt++); | |
| 2169 | portentry->category = category; | |
| 2258 | 2170 | break; |
| 2259 | 2171 | #endif /* MESS */ |
| 2260 | 2172 | |
| r2375 | r2376 | |
| 2276 | 2188 | input_port_entry *input_port_initialize(input_port_init_params *iip, UINT32 type, const char *tag, UINT32 mask, UINT32 defval) |
| 2277 | 2189 | { |
| 2278 | 2190 | /* this function is used within an INPUT_PORT callback to set up a single port */ |
| 2279 | input_port_entry *port; | |
| 2191 | input_port_entry *portentry; | |
| 2280 | 2192 | input_code code; |
| 2281 | 2193 | |
| 2282 | 2194 | /* are we modifying an existing port? */ |
| r2375 | r2376 | |
| 2310 | 2222 | { |
| 2311 | 2223 | memmove(&iip->ports[portnum + 1], &iip->ports[portnum], (iip->current_port - portnum) * sizeof(iip->ports[0])); |
| 2312 | 2224 | iip->current_port++; |
| 2313 | port = &iip->ports[portnum]; | |
| 2225 | portentry = &iip->ports[portnum]; | |
| 2314 | 2226 | } |
| 2315 | 2227 | else |
| 2316 | port = &iip->ports[iip->current_port++]; | |
| 2228 | portentry = &iip->ports[iip->current_port++]; | |
| 2317 | 2229 | } |
| 2318 | 2230 | |
| 2319 | 2231 | /* otherwise, just allocate a new one from the end */ |
| r2375 | r2376 | |
| 2321 | 2233 | { |
| 2322 | 2234 | if (iip->current_port >= iip->max_ports) |
| 2323 | 2235 | fatalerror("Too many input ports"); |
| 2324 | port = &iip->ports[iip->current_port++]; | |
| 2236 | portentry = &iip->ports[iip->current_port++]; | |
| 2325 | 2237 | } |
| 2326 | 2238 | |
| 2327 | 2239 | /* set up defaults */ |
| 2328 | memset(port, 0, sizeof(*port)); | |
| 2329 | port->name = IP_NAME_DEFAULT; | |
| 2330 | port->type = type; | |
| 2331 | port->mask = mask; | |
| 2332 | port->default_value = defval; | |
| 2240 | memset(portentry, 0, sizeof(*portentry)); | |
| 2241 | portentry->name = IP_NAME_DEFAULT; | |
| 2242 | portentry->type = type; | |
| 2243 | portentry->mask = mask; | |
| 2244 | portentry->default_value = defval; | |
| 2333 | 2245 | |
| 2334 | 2246 | /* default min to 0 and max to the mask value */ |
| 2335 | 2247 | /* they can be overwritten by PORT_MINMAX */ |
| 2336 | if (port_type_is_analog(port->type) && !port->analog.min && !port->analog.max) | |
| 2337 | port->analog.max = port->mask; | |
| 2248 | if (port_type_is_analog(portentry->type) && !portentry->analog.min && !portentry->analog.max) | |
| 2249 | portentry->analog.max = portentry->mask; | |
| 2338 | 2250 | |
| 2339 | 2251 | /* sets up default port codes */ |
| 2340 | switch (port->type) | |
| 2252 | switch (portentry->type) | |
| 2341 | 2253 | { |
| 2342 | 2254 | case IPT_DIPSWITCH_NAME: |
| 2343 | 2255 | case IPT_DIPSWITCH_SETTING: |
| r2375 | r2376 | |
| 2352 | 2264 | } |
| 2353 | 2265 | |
| 2354 | 2266 | /* set the default codes */ |
| 2355 | input_seq_set_1(&port->seq, code); | |
| 2356 | input_seq_set_1(&port->analog.incseq, code); | |
| 2357 | input_seq_set_1(&port->analog.decseq, code); | |
| 2358 | return port; | |
| 2267 | input_seq_set_1(&portentry->seq, code); | |
| 2268 | input_seq_set_1(&portentry->analog.incseq, code); | |
| 2269 | input_seq_set_1(&portentry->analog.decseq, code); | |
| 2270 | return portentry; | |
| 2359 | 2271 | } |
| 2360 | 2272 | |
| 2361 | 2273 | |
| r2375 | r2376 | |
| 2532 | 2444 | * |
| 2533 | 2445 | *************************************/ |
| 2534 | 2446 | |
| 2535 | int input_port_active(const input_port_entry *port) | |
| 2447 | int input_port_active(const input_port_entry *portentry) | |
| 2536 | 2448 | { |
| 2537 | return (input_port_name(port) != NULL && !port->unused); | |
| 2449 | return (input_port_name(portentry) != NULL && !portentry->unused); | |
| 2538 | 2450 | } |
| 2539 | 2451 | |
| 2540 | 2452 | |
| r2375 | r2376 | |
| 2552 | 2464 | |
| 2553 | 2465 | int port_type_in_use(int type) |
| 2554 | 2466 | { |
| 2555 | input_port_entry *port; | |
| 2556 | for (port = Machine->input_ports; port->type != IPT_END; port++) | |
| 2557 | if (port->type == type) | |
| 2467 | input_port_entry *portentry; | |
| 2468 | for (portentry = Machine->input_ports; portentry->type != IPT_END; portentry++) | |
| 2469 | if (portentry->type == type) | |
| 2558 | 2470 | return 1; |
| 2559 | 2471 | return 0; |
| 2560 | 2472 | } |
| r2375 | r2376 | |
| 2571 | 2483 | |
| 2572 | 2484 | int port_tag_to_index(const char *tag) |
| 2573 | 2485 | { |
| 2574 | int port; | |
| 2486 | int portnum; | |
| 2575 | 2487 | |
| 2576 | 2488 | /* find the matching tag */ |
| 2577 | for (port = 0; port < MAX_INPUT_PORTS; port++) | |
| 2578 | if (port_info[port].tag != NULL && !strcmp(port_info[port].tag, tag)) | |
| 2579 | return port; | |
| 2489 | for (portnum = 0; portnum < MAX_INPUT_PORTS; portnum++) | |
| 2490 | if (port_info[portnum].tag != NULL && !strcmp(port_info[portnum].tag, tag)) | |
| 2491 | return portnum; | |
| 2580 | 2492 | return -1; |
| 2581 | 2493 | } |
| 2582 | 2494 | |
| 2583 | 2495 | |
| 2584 | 2496 | read8_machine_func port_tag_to_handler8(const char *tag) |
| 2585 | 2497 | { |
| 2586 | int port = port_tag_to_index(tag); | |
| 2587 | return (port == -1) ? SMH_NOP : port_handler8[port]; | |
| 2498 | int portnum = port_tag_to_index(tag); | |
| 2499 | return (portnum == -1) ? SMH_NOP : port_handler8[portnum]; | |
| 2588 | 2500 | } |
| 2589 | 2501 | |
| 2590 | 2502 | |
| 2591 | 2503 | read16_machine_func port_tag_to_handler16(const char *tag) |
| 2592 | 2504 | { |
| 2593 | int port = port_tag_to_index(tag); | |
| 2594 | return (port == -1) ? SMH_NOP : port_handler16[port]; | |
| 2505 | int portnum = port_tag_to_index(tag); | |
| 2506 | return (portnum == -1) ? SMH_NOP : port_handler16[portnum]; | |
| 2595 | 2507 | } |
| 2596 | 2508 | |
| 2597 | 2509 | |
| 2598 | 2510 | read32_machine_func port_tag_to_handler32(const char *tag) |
| 2599 | 2511 | { |
| 2600 | int port = port_tag_to_index(tag); | |
| 2601 | return (port == -1) ? SMH_NOP : port_handler32[port]; | |
| 2512 | int portnum = port_tag_to_index(tag); | |
| 2513 | return (portnum == -1) ? SMH_NOP : port_handler32[portnum]; | |
| 2602 | 2514 | } |
| 2603 | 2515 | |
| 2604 | 2516 | |
| r2375 | r2376 | |
| 2608 | 2520 | } |
| 2609 | 2521 | |
| 2610 | 2522 | |
| 2611 | const char *input_port_name(const input_port_entry *port) | |
| 2523 | const char *input_port_name(const input_port_entry *portentry) | |
| 2612 | 2524 | { |
| 2613 | 2525 | int defindex; |
| 2614 | 2526 | |
| 2615 | 2527 | /* if we have a non-default name, use that */ |
| 2616 | if (port->name != IP_NAME_DEFAULT) | |
| 2617 | return port->name; | |
| 2528 | if (portentry->name != IP_NAME_DEFAULT) | |
| 2529 | return portentry->name; | |
| 2618 | 2530 | |
| 2619 | 2531 | /* if the port exists, return the default name */ |
| 2620 | defindex = default_ports_lookup[port->type][port->player]; | |
| 2532 | defindex = default_ports_lookup[portentry->type][portentry->player]; | |
| 2621 | 2533 | if (defindex != -1) |
| 2622 | 2534 | return default_ports[defindex].name; |
| 2623 | 2535 | |
| r2375 | r2376 | |
| 2626 | 2538 | } |
| 2627 | 2539 | |
| 2628 | 2540 | |
| 2629 | const input_seq *input_port_seq(input_port_entry *port, input_seq_type seqtype) | |
| 2541 | const input_seq *input_port_seq(input_port_entry *portentry, input_seq_type seqtype) | |
| 2630 | 2542 | { |
| 2631 | 2543 | static const input_seq ip_none = SEQ_DEF_0; |
| 2632 | 2544 | input_seq *portseq; |
| 2633 | 2545 | |
| 2634 | 2546 | /* if port is disabled, return no key */ |
| 2635 | if (port->unused) | |
| 2547 | if (portentry->unused) | |
| 2636 | 2548 | return &ip_none; |
| 2637 | 2549 | |
| 2638 | 2550 | /* handle the various seq types */ |
| 2639 | 2551 | switch (seqtype) |
| 2640 | 2552 | { |
| 2641 | 2553 | case SEQ_TYPE_STANDARD: |
| 2642 | portseq = &port->seq; | |
| 2554 | portseq = &portentry->seq; | |
| 2643 | 2555 | break; |
| 2644 | 2556 | |
| 2645 | 2557 | case SEQ_TYPE_INCREMENT: |
| 2646 | if (!IS_ANALOG(port)) | |
| 2558 | if (!IS_ANALOG(portentry)) | |
| 2647 | 2559 | return &ip_none; |
| 2648 | portseq = &port->analog.incseq; | |
| 2560 | portseq = &portentry->analog.incseq; | |
| 2649 | 2561 | break; |
| 2650 | 2562 | |
| 2651 | 2563 | case SEQ_TYPE_DECREMENT: |
| 2652 | if (!IS_ANALOG(port)) | |
| 2564 | if (!IS_ANALOG(portentry)) | |
| 2653 | 2565 | return &ip_none; |
| 2654 | portseq = &port->analog.decseq; | |
| 2566 | portseq = &portentry->analog.decseq; | |
| 2655 | 2567 | break; |
| 2656 | 2568 | |
| 2657 | 2569 | default: |
| r2375 | r2376 | |
| 2663 | 2575 | return portseq; |
| 2664 | 2576 | |
| 2665 | 2577 | /* otherwise find the default setting */ |
| 2666 | return input_port_default_seq(port->type, port->player, seqtype); | |
| 2578 | return input_port_default_seq(portentry->type, portentry->player, seqtype); | |
| 2667 | 2579 | } |
| 2668 | 2580 | |
| 2669 | 2581 | |
| r2375 | r2376 | |
| 2694 | 2606 | switch (in->condition.condition) |
| 2695 | 2607 | { |
| 2696 | 2608 | case PORTCOND_EQUALS: |
| 2697 | return (( | |
| 2609 | return (( | |
| 2698 | 2610 | case PORTCOND_NOTEQUALS: |
| 2699 | return (( | |
| 2611 | return (( | |
| 2700 | 2612 | } |
| 2701 | 2613 | return 1; |
| 2702 | 2614 | } |
| r2375 | r2376 | |
| 2797 | 2709 | |
| 2798 | 2710 | /************************************* |
| 2799 | 2711 | * |
| 2800 | * Playback/record helper | |
| 2801 | * | |
| 2802 | *************************************/ | |
| 2803 | ||
| 2804 | static void update_playback_record(running_machine *machine, int portnum, UINT32 portvalue) | |
| 2805 | { | |
| 2806 | /* handle playback */ | |
| 2807 | if (machine->playback_file != NULL) | |
| 2808 | { | |
| 2809 | UINT32 result; | |
| 2810 | ||
| 2811 | /* a successful read goes into the playback field which overrides everything else */ | |
| 2812 | if (mame_fread(machine->playback_file, &result, sizeof(result)) == sizeof(result)) | |
| 2813 | portvalue = port_info[portnum].playback = BIG_ENDIANIZE_INT32(result); | |
| 2814 | ||
| 2815 | /* a failure causes us to close the playback file and stop playback */ | |
| 2816 | else | |
| 2817 | { | |
| 2818 | mame_fclose(machine->playback_file); | |
| 2819 | machine->playback_file = NULL; | |
| 2820 | if (!extended_inp) | |
| 2821 | popmessage("End of playback"); | |
| 2822 | else | |
| 2823 | { | |
| 2824 | popmessage("End of playback - %i frames - Average speed %f%%", framecount, (double)totalspeed/framecount); | |
| 2825 | printf("End of playback - %i frames - Average speed %f%%\n", framecount, (double)totalspeed/framecount); | |
| 2826 | } | |
| 2827 | } | |
| 2828 | } | |
| 2829 | ||
| 2830 | /* handle recording */ | |
| 2831 | if (machine->record_file != NULL) | |
| 2832 | { | |
| 2833 | UINT32 result = BIG_ENDIANIZE_INT32(portvalue); | |
| 2834 | ||
| 2835 | /* a successful write just works */ | |
| 2836 | if (mame_fwrite(machine->record_file, &result, sizeof(result)) == sizeof(result)) | |
| 2837 | ; | |
| 2838 | ||
| 2839 | /* a failure causes us to close the record file and stop recording */ | |
| 2840 | else | |
| 2841 | { | |
| 2842 | mame_fclose(machine->record_file); | |
| 2843 | machine->record_file = NULL; | |
| 2844 | } | |
| 2845 | } | |
| 2846 | } | |
| 2847 | ||
| 2848 | ||
| 2849 | ||
| 2850 | /************************************* | |
| 2851 | * | |
| 2852 | 2712 | * Update default ports |
| 2853 | 2713 | * |
| 2854 | 2714 | *************************************/ |
| r2375 | r2376 | |
| 2872 | 2732 | portinfo->defvalue = 0; |
| 2873 | 2733 | |
| 2874 | 2734 | /* first compute the default value for the entire port */ |
| 2875 | for (bitnum = 0, info = &portinfo->bit[0]; bitnum < MAX_BITS_PER_PORT && info->port; bitnum++, info++) | |
| 2876 | if (input_port_condition(info->port)) | |
| 2877 | portinfo->defvalue = (portinfo->defvalue & ~info->port->mask) | (info->port->default_value & info->port->mask); | |
| 2735 | for (bitnum = 0, info = &portinfo->bit[0]; bitnum < MAX_BITS_PER_PORT && info->portentry; bitnum++, info++) | |
| 2736 | if (input_port_condition(info->portentry)) | |
| 2737 | portinfo->defvalue = (portinfo->defvalue & ~info->portentry->mask) | (info->portentry->default_value & info->portentry->mask); | |
| 2878 | 2738 | } |
| 2879 | 2739 | } |
| 2880 | 2740 | |
| r2375 | r2376 | |
| 2888 | 2748 | |
| 2889 | 2749 | static void input_port_frame(running_machine *machine) |
| 2890 | 2750 | { |
| 2751 | /* if we're paused, don't do anything */ | |
| 2752 | if (mame_is_paused(machine)) | |
| 2753 | return; | |
| 2754 | ||
| 2755 | /* otherwise, use the common code */ | |
| 2756 | input_port_frame_update(machine); | |
| 2757 | } | |
| 2758 | ||
| 2759 | ||
| 2760 | static void input_port_frame_update(running_machine *machine) | |
| 2761 | { | |
| 2891 | 2762 | int ui_visible = ui_is_menu_active() || ui_is_slider_active(); |
| 2892 | 2763 | attotime curtime = timer_get_time(); |
| 2893 | 2764 | int portnum, bitnum; |
| 2894 | 2765 | |
| 2895 | 2766 | profiler_mark(PROFILER_INPUT); |
| 2896 | 2767 | |
| 2768 | /* record/playback information about the current frame */ | |
| 2769 | playback_frame(machine, curtime); | |
| 2770 | record_frame(machine, curtime); | |
| 2771 | ||
| 2897 | 2772 | /* track the duration of the previous frame */ |
| 2898 | 2773 | last_delta = attotime_to_attoseconds(attotime_sub(curtime, last_update)) / ATTOSECONDS_PER_SECOND_SQRT; |
| 2899 | 2774 | last_update = curtime; |
| r2375 | r2376 | |
| 2904 | 2779 | update_analog_port(portnum); |
| 2905 | 2780 | |
| 2906 | 2781 | /* update the digital joysticks first */ |
| 2907 | update_digital_joysticks(); | |
| 2782 | update_digital_joysticks(machine); | |
| 2908 | 2783 | |
| 2909 | 2784 | /* compute default values for all the ports */ |
| 2910 | 2785 | input_port_update_defaults(); |
| r2375 | r2376 | |
| 2918 | 2793 | |
| 2919 | 2794 | /* compute the VBLANK mask */ |
| 2920 | 2795 | portinfo->vblank = 0; |
| 2921 | for (bitnum = 0, info = &portinfo->bit[0]; bitnum < MAX_BITS_PER_PORT && info->port; bitnum++, info++) | |
| 2922 | if (info->port->type == IPT_VBLANK) | |
| 2923 | portinfo->vblank ^= info->port->mask; | |
| 2796 | for (bitnum = 0, info = &portinfo->bit[0]; bitnum < MAX_BITS_PER_PORT && info->portentry; bitnum++, info++) | |
| 2797 | if (input_port_condition(info->portentry) && info->portentry->type == IPT_VBLANK) | |
| 2798 | portinfo->vblank ^= info->portentry->mask; | |
| 2924 | 2799 | |
| 2925 | 2800 | /* now loop back and modify based on the inputs */ |
| 2926 | 2801 | portinfo->digital = 0; |
| 2927 | for (bitnum = 0, info = &portinfo->bit[0]; bitnum < MAX_BITS_PER_PORT && info->port; bitnum++, info++) | |
| 2928 | if (input_port_condition(info->port)) | |
| 2802 | for (bitnum = 0, info = &portinfo->bit[0]; bitnum < MAX_BITS_PER_PORT && info->portentry; bitnum++, info++) | |
| 2803 | if (input_port_condition(info->portentry)) | |
| 2929 | 2804 | { |
| 2930 | input_port_entry *port = info->port; | |
| 2805 | input_port_entry *portentry = info->portentry; | |
| 2931 | 2806 | |
| 2932 | 2807 | /* handle non-analog types, but only when the UI isn't visible */ |
| 2933 | if (port->type != IPT_VBLANK && !IS_ANALOG(port) && !ui_visible) | |
| 2808 | if (portentry->type != IPT_VBLANK && !IS_ANALOG(portentry) && !ui_visible) | |
| 2934 | 2809 | { |
| 2935 | 2810 | /* if the sequence for this port is currently pressed.... */ |
| 2936 | if (input_seq_pressed(input_port_seq(port, SEQ_TYPE_STANDARD))) | |
| 2811 | if (input_seq_pressed(input_port_seq(portentry, SEQ_TYPE_STANDARD))) | |
| 2937 | 2812 | { |
| 2938 | 2813 | #ifdef MESS |
| 2939 | 2814 | /* (MESS-specific) check for disabled keyboard */ |
| 2940 | if (port->type == IPT_KEYBOARD && osd_keyboard_disabled()) | |
| 2815 | if (portentry->type == IPT_KEYBOARD && osd_keyboard_disabled()) | |
| 2941 | 2816 | continue; |
| 2942 | 2817 | #endif |
| 2943 | 2818 | /* skip locked-out coin inputs */ |
| 2944 | if (port->type >= IPT_COIN1 && port->type <= IPT_COIN8 && coinlockedout[port->type - IPT_COIN1]) | |
| 2819 | if (portentry->type >= IPT_COIN1 && portentry->type <= IPT_COIN8 && coinlockedout[portentry->type - IPT_COIN1]) | |
| 2820 | { | |
| 2821 | ui_popup_time(3, "Coinlock disabled %s.", input_port_name(portentry)); | |
| 2945 | 2822 | continue; |
| 2946 | if (port->type >= IPT_SERVICE1 && port->type <= IPT_SERVICE4 && servicecoinlockedout[port->type - IPT_SERVICE1]) | |
| 2823 | } | |
| 2824 | if (portentry->type >= IPT_SERVICE1 && portentry->type <= IPT_SERVICE4 && servicecoinlockedout[portentry->type - IPT_SERVICE1]) | |
| 2825 | { | |
| 2826 | ui_popup_time(3, "Coinlock disabled %s.", input_port_name(portentry)); | |
| 2947 | 2827 | continue; |
| 2948 | ||
| 2828 | } | |
| 2949 | 2829 | /* if this is a downward press and we're an impulse control, reset the count */ |
| 2950 | if (port->impulse) | |
| 2830 | if (portentry->impulse) | |
| 2951 | 2831 | { |
| 2952 | 2832 | if (info->last == 0) |
| 2953 | info->impulse = port->impulse; | |
| 2833 | info->impulse = portentry->impulse; | |
| 2954 | 2834 | } |
| 2955 | 2835 | |
| 2956 | 2836 | /* if this is a downward press and we're a toggle control, toggle the value */ |
| 2957 | else if (port->toggle) | |
| 2837 | else if (portentry->toggle) | |
| 2958 | 2838 | { |
| 2959 | 2839 | if (info->last == 0) |
| 2960 | 2840 | { |
| 2961 | port->default_value ^= port->mask; | |
| 2962 | portinfo->digital ^= port->mask; | |
| 2841 | portentry->default_value ^= portentry->mask; | |
| 2842 | portinfo->digital ^= portentry->mask; | |
| 2963 | 2843 | } |
| 2964 | 2844 | } |
| 2965 | 2845 | |
| 2966 | 2846 | /* if this is a digital joystick type, apply either standard or 4-way rules */ |
| 2967 | else if (IS_DIGITAL_JOYSTICK(port)) | |
| 2847 | else if (IS_DIGITAL_JOYSTICK(portentry)) | |
| 2968 | 2848 | { |
| 2969 | digital_joystick_info *joyinfo = JOYSTICK_INFO_FOR_PORT(port); | |
| 2849 | digital_joystick_info *joyinfo = JOYSTICK_INFO_FOR_PORT(portentry); | |
| 2970 | 2850 | UINT8 mask; |
| 2971 | switch( port->way ) | |
| 2851 | switch( portentry->way ) | |
| 2972 | 2852 | { |
| 2973 | 2853 | case 4: |
| 2974 | 2854 | mask = joyinfo->current4way; |
| r2375 | r2376 | |
| 2980 | 2860 | mask = joyinfo->current; |
| 2981 | 2861 | break; |
| 2982 | 2862 | } |
| 2983 | if ((mask >> JOYSTICK_DIR_FOR_PORT(port)) & 1) | |
| 2984 | portinfo->digital ^= port->mask; | |
| 2863 | if ((mask >> JOYSTICK_DIR_FOR_PORT(portentry)) & 1) | |
| 2864 | portinfo->digital ^= portentry->mask; | |
| 2985 | 2865 | } |
| 2986 | 2866 | |
| 2987 | 2867 | /* otherwise, just set it raw */ |
| 2988 | 2868 | else |
| 2989 | portinfo->digital ^= port->mask; | |
| 2869 | portinfo->digital ^= portentry->mask; | |
| 2990 | 2870 | |
| 2991 | 2871 | /* track the last value */ |
| 2992 | 2872 | info->last = 1; |
| r2375 | r2376 | |
| 2995 | 2875 | info->last = 0; |
| 2996 | 2876 | |
| 2997 | 2877 | /* handle the impulse countdown */ |
| 2998 | if (port->impulse && info->impulse > 0) | |
| 2878 | if (portentry->impulse && info->impulse > 0) | |
| 2999 | 2879 | { |
| 3000 | 2880 | info->impulse--; |
| 3001 | 2881 | info->last = 1; |
| 3002 | portinfo->digital ^= port->mask; | |
| 2882 | portinfo->digital ^= portentry->mask; | |
| 3003 | 2883 | } |
| 3004 | 2884 | } |
| 3005 | 2885 | |
| r2375 | r2376 | |
| 3008 | 2888 | |
| 3009 | 2889 | /* call changed handlers */ |
| 3010 | 2890 | for (changed = portinfo->changedinfo; changed; changed = changed->next) |
| 3011 | if (input_port_condition(changed->port)) | |
| 2891 | if (input_port_condition(changed->portentry)) | |
| 3012 | 2892 | { |
| 3013 | input_port_entry *port = changed->port; | |
| 2893 | input_port_entry *portentry = changed->portentry; | |
| 3014 | 2894 | |
| 3015 | UINT32 new_unmasked_value = readinputport(portnum); | |
| 3016 | UINT32 newval = (new_unmasked_value & port->mask) >> changed->shift; | |
| 3017 | UINT32 oldval = (port->changed_last_value & port->mask) >> changed->shift; | |
| 2895 | UINT32 new_unmasked_value = input_port_read_indexed(machine, portnum); | |
| 2896 | UINT32 newval = (new_unmasked_value & portentry->mask) >> changed->shift; | |
| 2897 | UINT32 oldval = (portentry->changed_last_value & portentry->mask) >> changed->shift; | |
| 3018 | 2898 | |
| 3019 | 2899 | if (newval != oldval) |
| 3020 | (*port->changed)(machine, port->changed_param, oldval, newval); | |
| 2900 | (*portentry->changed)(machine, portentry->changed_param, oldval, newval); | |
| 3021 | 2901 | |
| 3022 | port->changed_last_value = new_unmasked_value; | |
| 2902 | portentry->changed_last_value = new_unmasked_value; | |
| 3023 | 2903 | } |
| 3024 | 2904 | } |
| 3025 | 2905 | |
| 3026 | 2906 | #ifdef MESS |
| 3027 | 2907 | /* less MESS to MESSy things */ |
| 3028 | inputx_update(); | |
| 2908 | inputx_update(machine); | |
| 3029 | 2909 | #endif |
| 3030 | 2910 | |
| 3031 | 2911 | /* handle playback/record */ |
| 3032 | 2912 | for (portnum = 0; portnum < MAX_INPUT_PORTS; portnum++) |
| 3033 | 2913 | { |
| 3034 | /* analog ports automatically update on every read */ | |
| 3035 | if (port_info[portnum].analoginfo) | |
| 3036 | readinputport(portnum); | |
| 3037 | ||
| 3038 | /* non-analog ports must be manually updated */ | |
| 3039 | else | |
| 3040 | update_playback_record(machine, portnum, readinputport(portnum)); | |
| 2914 | playback_port(machine, &port_info[portnum]); | |
| 2915 | record_port(machine, &port_info[portnum]); | |
| 3041 | 2916 | } |
| 3042 | 2917 | |
| 3043 | /* store speed read from INP file, if extended INP */ | |
| 3044 | if (machine->playback_file != NULL && extended_inp) | |
| 3045 | { | |
| 3046 | UINT32 dummy; | |
| 3047 | mame_fread(machine->playback_file, &rec_speed, sizeof(rec_speed)); | |
| 3048 | mame_fread(machine->playback_file, &dummy, sizeof(dummy)); | |
| 3049 | framecount++; | |
| 3050 | rec_speed *= 100; | |
| 3051 | totalspeed += rec_speed; | |
| 3052 | } | |
| 3053 | ||
| 3054 | 2918 | profiler_mark(PROFILER_END); |
| 3055 | 2919 | } |
| 3056 | 2920 | |
| r2375 | r2376 | |
| 3062 | 2926 | * |
| 3063 | 2927 | *************************************/ |
| 3064 | 2928 | |
| 3065 | static void update_digital_joysticks( | |
| 2929 | static void update_digital_joysticks(running_machine *machine) | |
| 3066 | 2930 | { |
| 3067 | 2931 | int player, joyindex; |
| 3068 | 2932 | |
| r2375 | r2376 | |
| 3077 | 2941 | info->current = 0; |
| 3078 | 2942 | |
| 3079 | 2943 | /* read all the associated ports */ |
| 3080 | if (info->port[JOYDIR_UP] != NULL && input_seq_pressed(input_port_seq(info->port[JOYDIR_UP], SEQ_TYPE_STANDARD))) | |
| 2944 | if (info->portentry[JOYDIR_UP] != NULL && input_seq_pressed(input_port_seq(info->portentry[JOYDIR_UP], SEQ_TYPE_STANDARD))) | |
| 3081 | 2945 | info->current |= JOYDIR_UP_BIT; |
| 3082 | if (info->port[JOYDIR_DOWN] != NULL && input_seq_pressed(input_port_seq(info->port[JOYDIR_DOWN], SEQ_TYPE_STANDARD))) | |
| 2946 | if (info->portentry[JOYDIR_DOWN] != NULL && input_seq_pressed(input_port_seq(info->portentry[JOYDIR_DOWN], SEQ_TYPE_STANDARD))) | |
| 3083 | 2947 | info->current |= JOYDIR_DOWN_BIT; |
| 3084 | if (info->port[JOYDIR_LEFT] != NULL && input_seq_pressed(input_port_seq(info->port[JOYDIR_LEFT], SEQ_TYPE_STANDARD))) | |
| 2948 | if (info->portentry[JOYDIR_LEFT] != NULL && input_seq_pressed(input_port_seq(info->portentry[JOYDIR_LEFT], SEQ_TYPE_STANDARD))) | |
| 3085 | 2949 | info->current |= JOYDIR_LEFT_BIT; |
| 3086 | if (info->port[JOYDIR_RIGHT] != NULL && input_seq_pressed(input_port_seq(info->port[JOYDIR_RIGHT], SEQ_TYPE_STANDARD))) | |
| 2950 | if (info->portentry[JOYDIR_RIGHT] != NULL && input_seq_pressed(input_port_seq(info->portentry[JOYDIR_RIGHT], SEQ_TYPE_STANDARD))) | |
| 3087 | 2951 | info->current |= JOYDIR_RIGHT_BIT; |
| 3088 | 2952 | |
| 3089 | 2953 | /* lock out opposing directions (left + right or up + down) */ |
| r2375 | r2376 | |
| 3128 | 2992 | if ((info->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) && |
| 3129 | 2993 | (info->current4way & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT))) |
| 3130 | 2994 | { |
| 3131 | if (mame_rand( | |
| 2995 | if (mame_rand(machine) & 1) | |
| 3132 | 2996 | info->current4way &= ~(JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT); |
| 3133 | 2997 | else |
| 3134 | 2998 | info->current4way &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT); |
| r2375 | r2376 | |
| 3146 | 3010 | * |
| 3147 | 3011 | *************************************/ |
| 3148 | 3012 | |
| 3149 | INLINE INT32 apply_analog_min_max(const analog_port_info *info, | |
| 3013 | INLINE INT32 apply_analog_min_max(const analog_port_info *info, INT32 | |
| 3150 | 3014 | { |
| 3151 | const input_port_entry *port = info->port; | |
| 3152 | double adjmax, adjmin, adj1, adjdif; | |
| 3015 | const input_port_entry *portentry = info->portentry; | |
| 3016 | INT32 adjmax, adjmin, adj1, adjdif; | |
| 3153 | 3017 | |
| 3154 | 3018 | /* take the analog minimum and maximum values and apply the inverse of the */ |
| 3155 | 3019 | /* sensitivity so that we can clamp against them before applying sensitivity */ |
| 3156 | adjmin = APPLY_INVERSE_SENSITIVITY(info->minimum, port->analog.sensitivity); | |
| 3157 | adjmax = APPLY_INVERSE_SENSITIVITY(info->maximum, port->analog.sensitivity); | |
| 3158 | adj1 = APPLY_INVERSE_SENSITIVITY(512, port->analog.sensitivity); | |
| 3020 | adjmin = APPLY_INVERSE_SENSITIVITY(info->minimum, portentry->analog.sensitivity); | |
| 3021 | adjmax = APPLY_INVERSE_SENSITIVITY(info->maximum, portentry->analog.sensitivity); | |
| 3022 | adj1 = APPLY_INVERSE_SENSITIVITY(512, portentry->analog.sensitivity); | |
| 3159 | 3023 | |
| 3160 | 3024 | /* for absolute devices, clamp to the bounds absolutely */ |
| 3161 | 3025 | if (!info->wraps) |
| r2375 | r2376 | |
| 3170 | 3034 | else |
| 3171 | 3035 | { |
| 3172 | 3036 | adjdif = adjmax - adjmin + adj1; |
| 3173 | if (port->analog.reverse) | |
| 3037 | if (portentry->analog.reverse) | |
| 3174 | 3038 | { |
| 3175 | 3039 | while (value <= adjmin - adj1) |
| 3176 | 3040 | value += adjdif; |
| r2375 | r2376 | |
| 3204 | 3068 | /* loop over all analog ports in this port number */ |
| 3205 | 3069 | for (info = port_info[portnum].analoginfo; info != NULL; info = info->next) |
| 3206 | 3070 | { |
| 3207 | input_port_entry *port = info->port; | |
| 3071 | input_port_entry *portentry = info->portentry; | |
| 3208 | 3072 | INT32 rawvalue; |
| 3209 | double delta = 0, keyscale; | |
| 3210 | int keypressed = 0; | |
| 3073 | INT32 delta = 0; | |
| 3074 | INT64 keyscale; | |
| 3075 | int keypressed = FALSE; | |
| 3211 | 3076 | input_item_class itemclass; |
| 3212 | 3077 | |
| 3213 | 3078 | /* clamp the previous value to the min/max range and remember it */ |
| 3214 | 3079 | info->previous = info->accum = apply_analog_min_max(info, info->accum); |
| 3215 | 3080 | |
| 3216 | 3081 | /* get the new raw analog value and its type */ |
| 3217 | rawvalue = input_seq_axis_value(input_port_seq(port, SEQ_TYPE_STANDARD), &itemclass); | |
| 3082 | rawvalue = input_seq_axis_value(input_port_seq(portentry, SEQ_TYPE_STANDARD), &itemclass); | |
| 3218 | 3083 | |
| 3219 | 3084 | /* if we got an absolute input, it overrides everything else */ |
| 3220 | 3085 | if (itemclass == ITEM_CLASS_ABSOLUTE) |
| r2375 | r2376 | |
| 3227 | 3092 | /* apply the inverse of the sensitivity to the raw value so that */ |
| 3228 | 3093 | /* it will still cover the full min->max range requested after */ |
| 3229 | 3094 | /* we apply the sensitivity adjustment */ |
| 3230 | if (info->absolute || port->analog.reset) | |
| 3095 | if (info->absolute || portentry->analog.reset) | |
| 3231 | 3096 | { |
| 3232 | 3097 | /* if port is absolute, then just return the absolute data supplied */ |
| 3233 | info->accum = APPLY_INVERSE_SENSITIVITY(rawvalue, port->analog.sensitivity); | |
| 3098 | info->accum = APPLY_INVERSE_SENSITIVITY(rawvalue, portentry->analog.sensitivity); | |
| 3234 | 3099 | } |
| 3235 | 3100 | else if (info->positionalscale != 0) |
| 3236 | 3101 | { |
| 3237 | 3102 | /* if port is positional, we will take the full analog control and divide it */ |
| 3238 | 3103 | /* into positions, that way as the control is moved full scale, */ |
| 3239 | 3104 | /* it moves through all the positions */ |
| 3240 | rawvalue = | |
| 3105 | rawvalue = APPLY_SCALE | |
| 3241 | 3106 | |
| 3242 | 3107 | /* clamp the high value so it does not roll over */ |
| 3243 | if (rawvalue > info->maximum) rawvalue = info->maximum; | |
| 3244 | info->accum = APPLY_INVERSE_SENSITIVITY(rawvalue, port->analog.sensitivity); | |
| 3108 | rawvalue = MIN(rawvalue, info->maximum); | |
| 3109 | info->accum = APPLY_INVERSE_SENSITIVITY(rawvalue, portentry->analog.sensitivity); | |
| 3245 | 3110 | } |
| 3246 | 3111 | else |
| 3247 | 3112 | /* if port is relative, we use the value to simulate the speed of relative movement */ |
| 3248 | 3113 | /* sensitivity adjustment is allowed for this mode */ |
| 3249 | 3114 | info->accum += rawvalue; |
| 3250 | 3115 | |
| 3251 | info->lastdigital = | |
| 3116 | info->lastdigital = FALSE; | |
| 3252 | 3117 | /* do not bother with other control types if the analog data is changing */ |
| 3253 | | |
| 3118 | conti | |
| 3254 | 3119 | } |
| 3255 | 3120 | else |
| 3256 | 3121 | { |
| 3257 | 3122 | /* we still have to update fake relative from joystick control */ |
| 3258 | if (!info->absolute && info->positionalscale == 0) info->accum += rawvalue; | |
| 3123 | if (!info->absolute && info->positionalscale == 0) | |
| 3124 | info->accum += rawvalue; | |
| 3259 | 3125 | } |
| 3260 | 3126 | } |
| 3261 | 3127 | |
| r2375 | r2376 | |
| 3271 | 3137 | |
| 3272 | 3138 | /* if the decrement code sequence is pressed, add the key delta to */ |
| 3273 | 3139 | /* the accumulated delta; also note that the last input was a digital one */ |
| 3274 | if (input_seq_pressed(input_port_seq(info->port, SEQ_TYPE_DECREMENT))) | |
| 3140 | if (input_seq_pressed(input_port_seq(info->portentry, SEQ_TYPE_DECREMENT))) | |
| 3275 | 3141 | { |
| 3276 | keypressed = 1; | |
| 3277 | if (port->analog.delta) | |
| 3278 | delta -= (double)(port->analog.delta) * keyscale; | |
| 3142 | keypressed = TRUE; | |
| 3143 | if (portentry->analog.delta) | |
| 3144 | delta -= APPLY_SCALE(portentry->analog.delta, keyscale); | |
| 3279 | 3145 | else if (info->lastdigital != 1) |
| 3280 | 3146 | /* decrement only once when first pressed */ |
| 3281 | delta -= keyscale; | |
| 3147 | delta -= APPLY_SCALE(1, keyscale); | |
| 3282 | 3148 | info->lastdigital = 1; |
| 3283 | 3149 | } |
| 3284 | 3150 | |
| 3285 | 3151 | /* same for the increment code sequence */ |
| 3286 | if (input_seq_pressed(input_port_seq(info->port, SEQ_TYPE_INCREMENT))) | |
| 3152 | if (input_seq_pressed(input_port_seq(info->portentry, SEQ_TYPE_INCREMENT))) | |
| 3287 | 3153 | { |
| 3288 | keypressed = 1; | |
| 3289 | if (port->analog.delta) | |
| 3290 | delta += (double)(port->analog.delta) * keyscale; | |
| 3154 | keypressed = TRUE; | |
| 3155 | if (portentry->analog.delta) | |
| 3156 | delta += APPLY_SCALE(portentry->analog.delta, keyscale); | |
| 3291 | 3157 | else if (info->lastdigital != 2) |
| 3292 | 3158 | /* increment only once when first pressed */ |
| 3293 | delta += keyscale; | |
| 3159 | delta += APPLY_SCALE(1, keyscale); | |
| 3294 | 3160 | info->lastdigital = 2; |
| 3295 | 3161 | } |
| 3296 | 3162 | |
| r2375 | r2376 | |
| 3298 | 3164 | /* applying the deltas so that we only return this frame's delta */ |
| 3299 | 3165 | /* note that centering only works for relative controls */ |
| 3300 | 3166 | /* no need to check if absolute here because it is checked by the validity tests */ |
| 3301 | if (port->analog.reset) | |
| 3167 | if (portentry->analog.reset) | |
| 3302 | 3168 | info->accum = 0; |
| 3303 | 3169 | |
| 3304 | 3170 | /* apply the delta to the accumulated value */ |
| r2375 | r2376 | |
| 3309 | 3175 | /* was pressed, apply autocentering */ |
| 3310 | 3176 | if (info->autocenter) |
| 3311 | 3177 | { |
| 3312 | | |
| 3178 | INT32 | |
| 3313 | 3179 | if (info->lastdigital && !keypressed) |
| 3314 | 3180 | { |
| 3315 | 3181 | /* autocenter from positive values */ |
| 3316 | 3182 | if (info->accum >= center) |
| 3317 | 3183 | { |
| 3318 | info->accum -= ( | |
| 3184 | info->accum -= APPLY_SCALE( | |
| 3319 | 3185 | if (info->accum < center) |
| 3320 | 3186 | { |
| 3321 | 3187 | info->accum = center; |
| r2375 | r2376 | |
| 3326 | 3192 | /* autocenter from negative values */ |
| 3327 | 3193 | else |
| 3328 | 3194 | { |
| 3329 | info->accum += ( | |
| 3195 | info->accum += APPLY_SCALE( | |
| 3330 | 3196 | if (info->accum > center) |
| 3331 | 3197 | { |
| 3332 | 3198 | info->accum = center; |
| r2375 | r2376 | |
| 3348 | 3214 | * |
| 3349 | 3215 | *************************************/ |
| 3350 | 3216 | |
| 3351 | static | |
| 3217 | static UINT32 merge_interpolated_analog_da | |
| 3352 | 3218 | { |
| 3353 | 3219 | analog_port_info *info; |
| 3220 | UINT32 result = digital; | |
| 3354 | 3221 | |
| 3355 | 3222 | profiler_mark(PROFILER_INPUT); |
| 3356 | 3223 | |
| 3357 | /* set the default mask and value */ | |
| 3358 | port_info[portnum].analogmask = 0; | |
| 3359 | port_info[portnum].analog = 0; | |
| 3360 | ||
| 3361 | 3224 | /* loop over all analog ports in this port number */ |
| 3362 | 3225 | for (info = port_info[portnum].analoginfo; info != NULL; info = info->next) |
| 3363 | 3226 | { |
| 3364 | input_port_entry *port = info->port; | |
| 3227 | input_port_entry *portentry = info->portentry; | |
| 3365 | 3228 | |
| 3366 | if (input_port_condition( | |
| 3229 | if (input_port_condition( | |
| 3367 | 3230 | { |
| 3368 | | |
| 3231 | INT32 | |
| 3369 | 3232 | INT32 value; |
| 3370 | 3233 | |
| 3371 | 3234 | /* interpolate or not */ |
| 3372 | if (info->interpolate && !port->analog.reset && last_delta != 0) | |
| 3235 | if (info->interpolate && !portentry->analog.reset && last_delta != 0) | |
| 3373 | 3236 | { |
| 3374 | 3237 | attoseconds_t time_since_last = attotime_to_attoseconds(attotime_sub(timer_get_time(), last_update)) / ATTOSECONDS_PER_SECOND_SQRT; |
| 3375 | 3238 | current = info->previous + ((INT64)(info->accum - info->previous) * time_since_last / last_delta); |
| r2375 | r2376 | |
| 3379 | 3242 | |
| 3380 | 3243 | /* apply the min/max and then the sensitivity */ |
| 3381 | 3244 | current = apply_analog_min_max(info, current); |
| 3382 | current = APPLY_SENSITIVITY(current, port->analog.sensitivity); | |
| 3245 | current = APPLY_SENSITIVITY(current, portentry->analog.sensitivity); | |
| 3383 | 3246 | |
| 3384 | 3247 | /* apply reversal if needed */ |
| 3385 | if (port->analog.reverse) | |
| 3386 | current = info->reverse_val - current; | |
| 3387 | else | |
| 3388 | if (info->single_scale) | |
| 3248 | if (portentry->analog.reverse) | |
| 3249 | current = info->reverse_val - current; | |
| 3250 | else if (info->single_scale) | |
| 3389 | 3251 | /* it's a pedal or the default value is equal to min/max */ |
| 3390 | 3252 | /* so we need to adjust the center to the minimum */ |
| 3391 | 3253 | current -= INPUT_ABSOLUTE_MIN; |
| 3392 | 3254 | |
| 3393 | 3255 | /* map differently for positive and negative values */ |
| 3394 | if (current >= 0 ) | |
| 3395 | value = (INT32)(current * info->scalepos); | |
| 3256 | if (current >= 0) | |
| 3257 | value = APPLY_SCALE(current, info->scalepos); | |
| 3396 | 3258 | else |
| 3397 | value = (INT32)(current * info->scaleneg); | |
| 3398 | value += port->default_value; | |
| 3259 | value = APPLY_SCALE(current, info->scaleneg); | |
| 3260 | value += portentry->default_value; | |
| 3399 | 3261 | |
| 3400 | /* store croshair position before any remapping */ | |
| 3401 | info->crosshair_pos = (INT32)value & (port->mask >> info->shift); | |
| 3262 | /* store crosshair position before any remapping */ | |
| 3263 | info->crosshair_pos = (INT32)value & (portentry->mask >> info->shift); | |
| 3402 | 3264 | |
| 3403 | 3265 | /* remap the value if needed */ |
| 3404 | if (port->analog.remap_table) | |
| 3405 | value = info->port->analog.remap_table[value]; | |
| 3266 | if (portentry->analog.remap_table) | |
| 3267 | value = info->portentry->analog.remap_table[value]; | |
| 3406 | 3268 | |
| 3407 | 3269 | /* invert bits if needed */ |
| 3408 | if (port->analog.invert) | |
| 3270 | if (portentry->analog.invert) | |
| 3409 | 3271 | value = ~value; |
| 3410 | 3272 | |
| 3411 | 3273 | /* insert into the port */ |
| 3412 | port_info[portnum].analogmask |= info->port->mask; | |
| 3413 | port_info[portnum].analog = (port_info[portnum].analog & ~port->mask) | ((value << info->shift) & port->mask); | |
| 3274 | result = (result & ~portentry->mask) | ((value << info->shift) & portentry->mask); | |
| 3414 | 3275 | } |
| 3415 | 3276 | } |
| 3416 | 3277 | |
| 3417 | 3278 | profiler_mark(PROFILER_END); |
| 3279 | return result; | |
| 3418 | 3280 | } |
| 3419 | 3281 | |
| 3420 | 3282 | |
| r2375 | r2376 | |
| 3425 | 3287 | * |
| 3426 | 3288 | *************************************/ |
| 3427 | 3289 | |
| 3428 | UINT32 | |
| 3290 | UINT32 | |
| 3429 | 3291 | { |
| 3430 | input_port_info *portinfo = &port_info[port]; | |
| 3292 | input_port_info *portinfo = &port_info[portnum]; | |
| 3431 | 3293 | custom_port_info *custom; |
| 3432 | 3294 | UINT32 result; |
| 3433 | 3295 | |
| 3434 | /* interpolate analog values */ | |
| 3435 | interpolate_analog_port(port); | |
| 3296 | /* start with the digital */ | |
| 3297 | result = portinfo->defvalue ^ portinfo->digital; | |
| 3436 | 3298 | |
| 3299 | /* merge in analog portions */ | |
| 3300 | result = merge_interpolated_analog_data(portnum, result); | |
| 3301 | ||
| 3437 | 3302 | /* update custom values */ |
| 3438 | 3303 | for (custom = portinfo->custominfo; custom; custom = custom->next) |
| 3439 | if (input_port_condition(custom->port)) | |
| 3304 | if (input_port_condition(custom->portentry)) | |
| 3440 | 3305 | { |
| 3441 | 3306 | /* replace the bits with bits from the custom routine */ |
| 3442 | input_port_entry *port = custom->port; | |
| 3443 | portinfo->digital &= ~port->mask; | |
| 3444 | portinfo->digital |= ((*port->custom)(Machine, port->custom_param) << custom->shift) & port->mask; | |
| 3307 | input_port_entry *portentry = custom->portentry; | |
| 3308 | result &= ~portentry->mask; | |
| 3309 | result |= ((*portentry->custom)(machine, portentry->custom_param) << custom->shift) & portentry->mask; | |
| 3445 | 3310 | } |
| 3446 | 3311 | |
| 3447 | /* compute the current result: default value XOR the digital, merged with the analog */ | |
| 3448 | result = ((portinfo->defvalue ^ portinfo->digital) & ~portinfo->analogmask) | portinfo->analog; | |
| 3449 | ||
| 3450 | /* if we have analog data, update the recording state */ | |
| 3451 | if (port_info[port].analoginfo) | |
| 3452 | update_playback_record(Machine, port, result); | |
| 3453 | ||
| 3454 | /* if we're playing back, use the recorded value for inputs instead */ | |
| 3455 | if (Machine->playback_file != NULL) | |
| 3456 | result = portinfo->playback; | |
| 3457 | ||
| 3458 | /* handle VBLANK bits after inputs */ | |
| 3312 | /* handle VBLANK bits */ | |
| 3459 | 3313 | if (portinfo->vblank) |
| 3460 | 3314 | { |
| 3461 | 3315 | /* reset the VBLANK bits to their default value, regardless of inputs */ |
| 3462 | 3316 | result = (result & ~portinfo->vblank) | (portinfo->defvalue & portinfo->vblank); |
| 3463 | 3317 | |
| 3464 | 3318 | /* toggle VBLANK if we're in a VBLANK state */ |
| 3465 | if (video_screen_get_vblank( | |
| 3319 | if (video_screen_get_vblank(machine->primary_screen)) | |
| 3466 | 3320 | result ^= portinfo->vblank; |
| 3467 | 3321 | } |
| 3468 | 3322 | return result; |
| 3469 | 3323 | } |
| 3470 | 3324 | |
| 3471 | 3325 | |
| 3472 | UINT32 | |
| 3326 | UINT32 | |
| 3473 | 3327 | { |
| 3474 | int port = port_tag_to_index(tag); | |
| 3475 | if (port != -1) | |
| 3476 | return readinputport(port); | |
| 3328 | int portnum = port_tag_to_index(tag); | |
| 3329 | if (portnum != -1) | |
| 3330 | return input_port_read_indexed(machine, portnum); | |
| 3477 | 3331 | |
| 3478 | 3332 | /* otherwise fail horribly */ |
| 3479 | 3333 | fatalerror("Unable to locate input port '%s'", tag); |
| r2375 | r2376 | |
| 3481 | 3335 | } |
| 3482 | 3336 | |
| 3483 | 3337 | |
| 3484 | UINT32 | |
| 3338 | UINT32 | |
| 3485 | 3339 | { |
| 3486 | int port = port_tag_to_index(tag); | |
| 3487 | if (port != -1) | |
| 3488 | return readinputport(port); | |
| 3340 | int portnum = port_tag_to_index(tag); | |
| 3341 | if (portnum != -1) | |
| 3342 | return input_port_read_indexed(machine, portnum); | |
| 3489 | 3343 | return defvalue; |
| 3490 | 3344 | } |
| 3491 | 3345 | |
| 3492 | 3346 | |
| 3493 | 3347 | |
| 3494 | UINT32 input_port_read_indexed(running_machine *machine, int port) { return readinputport(port); } | |
| 3495 | UINT32 input_port_read(running_machine *machine, const char *tag) { return readinputportbytag(tag); } | |
| 3496 | UINT32 input_port_read_safe(running_machine *machine, const char *tag, UINT32 defvalue) { return readinputportbytag_safe(tag, defvalue); } | |
| 3497 | ||
| 3498 | ||
| 3499 | ||
| 3500 | 3348 | /************************************* |
| 3501 | 3349 | * |
| 3502 | 3350 | * Input port writing |
| 3503 | 3351 | * |
| 3504 | 3352 | *************************************/ |
| 3505 | 3353 | |
| 3506 | void input_port_set_digital_value(int portnum, UINT32 value, UINT32 mask) | |
| 3354 | void input_port_set_digital_value(running_machine *machine, int port_num, UINT32 value, UINT32 mask) | |
| 3507 | 3355 | { |
| 3508 | input_port_info *portinfo = &port_info[portnum]; | |
| 3356 | /* used by MESS for natural keyboard input */ | |
| 3357 | input_port_info *portinfo = &port_info[port_num]; | |
| 3509 | 3358 | portinfo->digital &= ~mask; |
| 3510 | 3359 | portinfo->digital |= value; |
| 3511 | 3360 | } |
| r2375 | r2376 | |
| 3522 | 3371 | { |
| 3523 | 3372 | input_port_info *portinfo = &port_info[port_num]; |
| 3524 | 3373 | analog_port_info *info; |
| 3525 | input_port_entry *port; | |
| 3374 | input_port_entry *portentry; | |
| 3526 | 3375 | UINT32 result = 0; |
| 3527 | 3376 | |
| 3528 | 3377 | for (info = portinfo->analoginfo; info; info = info->next) |
| 3529 | 3378 | { |
| 3530 | port = info->port; | |
| 3531 | if (port->player == player && port->analog.crossaxis == axis) | |
| 3379 | portentry = info->portentry; | |
| 3380 | if (portentry->player == player && portentry->analog.crossaxis == axis) | |
| 3532 | 3381 | { |
| 3533 | 3382 | result = info->crosshair_pos; |
| 3534 | 3383 | break; |
| r2375 | r2376 | |
| 3593 | 3442 | break; |
| 3594 | 3443 | } |
| 3595 | 3444 | } |
| 3445 | ||
| 3446 | ||
| 3447 | ||
| 3448 | /*************************************************************************** | |
| 3449 | PLAYBACK AND RECORD | |
| 3450 | ***************************************************************************/ | |
| 3451 | ||
| 3452 | /*------------------------------------------------- | |
| 3453 | playback_read_uint8 - read an 8-bit value | |
| 3454 | from the playback file | |
| 3455 | -------------------------------------------------*/ | |
| 3456 | ||
| 3457 | static UINT8 playback_read_uint8(running_machine *machine) | |
| 3458 | { | |
| 3459 | UINT8 result; | |
| 3460 | ||
| 3461 | /* protect against NULL handles if previous reads fail */ | |
| 3462 | if (machine->playback_file == NULL) | |
| 3463 | return 0; | |
| 3464 | ||
| 3465 | /* read the value; if we fail, end playback */ | |
| 3466 | if (mame_fread(machine->playback_file, &result, sizeof(result)) != sizeof(result)) | |
| 3467 | { | |
| 3468 | playback_end(machine, "End of file"); | |
| 3469 | return 0; | |
| 3470 | } | |
| 3471 | ||
| 3472 | /* return the appropriate value */ | |
| 3473 | return result; | |
| 3474 | } | |
| 3475 | ||
| 3476 | ||
| 3477 | /*------------------------------------------------- | |
| 3478 | record_write_uint8 - write an 8-bit value | |
| 3479 | to the record file | |
| 3480 | -------------------------------------------------*/ | |
| 3481 | ||
| 3482 | static void record_write_uint8(running_machine *machine, UINT8 data) | |
| 3483 | { | |
| 3484 | UINT8 result = data; | |
| 3485 | ||
| 3486 | /* protect against NULL handles if previous reads fail */ | |
| 3487 | if (machine->record_file == NULL) | |
| 3488 | return; | |
| 3489 | ||
| 3490 | /* read the value; if we fail, end playback */ | |
| 3491 | if (mame_fwrite(machine->record_file, &result, sizeof(result)) != sizeof(result)) | |
| 3492 | record_end(machine, "Out of space"); | |
| 3493 | } | |
| 3494 | ||
| 3495 | ||
| 3496 | /*------------------------------------------------- | |
| 3497 | playback_read_uint32 - read a 32-bit value | |
| 3498 | from the playback file | |
| 3499 | -------------------------------------------------*/ | |
| 3500 | ||
| 3501 | static UINT32 playback_read_uint32(running_machine *machine) | |
| 3502 | { | |
| 3503 | UINT32 result; | |
| 3504 | ||
| 3505 | /* protect against NULL handles if previous reads fail */ | |
| 3506 | if (machine->playback_file == NULL) | |
| 3507 | return 0; | |
| 3508 | ||
| 3509 | /* read the value; if we fail, end playback */ | |
| 3510 | if (mame_fread(machine->playback_file, &result, sizeof(result)) != sizeof(result)) | |
| 3511 | { | |
| 3512 | playback_end(machine, "End of file"); | |
| 3513 | return 0; | |
| 3514 | } | |
| 3515 | ||
| 3516 | /* return the appropriate value */ | |
| 3517 | return LITTLE_ENDIANIZE_INT32(result); | |
| 3518 | } | |
| 3519 | ||
| 3520 | ||
| 3521 | /*------------------------------------------------- | |
| 3522 | record_write_uint32 - write a 32-bit value | |
| 3523 | to the record file | |
| 3524 | -------------------------------------------------*/ | |
| 3525 | ||
| 3526 | static void record_write_uint32(running_machine *machine, UINT32 data) | |
| 3527 | { | |
| 3528 | UINT32 result = LITTLE_ENDIANIZE_INT32(data); | |
| 3529 | ||
| 3530 | /* protect against NULL handles if previous reads fail */ | |
| 3531 | if (machine->record_file == NULL) | |
| 3532 | return; | |
| 3533 | ||
| 3534 | /* read the value; if we fail, end playback */ | |
| 3535 | if (mame_fwrite(machine->record_file, &result, sizeof(result)) != sizeof(result)) | |
| 3536 | record_end(machine, "Out of space"); | |
| 3537 | } | |
| 3538 | ||
| 3539 | ||
| 3540 | /*------------------------------------------------- | |
| 3541 | playback_read_uint64 - read a 64-bit value | |
| 3542 | from the playback file | |
| 3543 | -------------------------------------------------*/ | |
| 3544 | ||
| 3545 | static UINT64 playback_read_uint64(running_machine *machine) | |
| 3546 | { | |
| 3547 | UINT64 result; | |
| 3548 | ||
| 3549 | /* protect against NULL handles if previous reads fail */ | |
| 3550 | if (machine->playback_file == NULL) | |
| 3551 | return 0; | |
| 3552 | ||
| 3553 | /* read the value; if we fail, end playback */ | |
| 3554 | if (mame_fread(machine->playback_file, &result, sizeof(result)) != sizeof(result)) | |
| 3555 | { | |
| 3556 | playback_end(machine, "End of file"); | |
| 3557 | return 0; | |
| 3558 | } | |
| 3559 | ||
| 3560 | /* return the appropriate value */ | |
| 3561 | return LITTLE_ENDIANIZE_INT64(result); | |
| 3562 | } | |
| 3563 | ||
| 3564 | ||
| 3565 | /*------------------------------------------------- | |
| 3566 | record_write_uint64 - write a 64-bit value | |
| 3567 | to the record file | |
| 3568 | -------------------------------------------------*/ | |
| 3569 | ||
| 3570 | static void record_write_uint64(running_machine *machine, UINT64 data) | |
| 3571 | { | |
| 3572 | UINT64 result = LITTLE_ENDIANIZE_INT64(data); | |
| 3573 | ||
| 3574 | /* protect against NULL handles if previous reads fail */ | |
| 3575 | if (machine->record_file == NULL) | |
| 3576 | return; | |
| 3577 | ||
| 3578 | /* read the value; if we fail, end playback */ | |
| 3579 | if (mame_fwrite(machine->record_file, &result, sizeof(result)) != sizeof(result)) | |
| 3580 | record_end(machine, "Out of space"); | |
| 3581 | } | |
| 3582 | ||
| 3583 | ||
| 3584 | /*------------------------------------------------- | |
| 3585 | playback_init - initialize INP playback | |
| 3586 | -------------------------------------------------*/ | |
| 3587 | ||
| 3588 | static time_t playback_init(running_machine *machine) | |
| 3589 | { | |
| 3590 | const char *filename = options_get_string(mame_options(), OPTION_PLAYBACK); | |
| 3591 | UINT8 header[INP_HEADER_SIZE]; | |
| 3592 | file_error filerr; | |
| 3593 | time_t basetime; | |
| 3594 | ||
| 3595 | /* if no file, nothing to do */ | |
| 3596 | if (filename[0] == 0) | |
| 3597 | return 0; | |
| 3598 | ||
| 3599 | /* open the playback file */ | |
| 3600 | filerr = mame_fopen(SEARCHPATH_INPUTLOG, filename, OPEN_FLAG_READ, &machine->playback_file); | |
| 3601 | assert_always(filerr == FILERR_NONE, "Failed to open file for playback"); | |
| 3602 | ||
| 3603 | /* read the header and verify that it is a modern version; if not, print an error */ | |
| 3604 | if (mame_fread(machine->playback_file, header, sizeof(header)) != sizeof(header)) | |
| 3605 | fatalerror("Input file is corrupt or invalid (missing header)"); | |
| 3606 | if (memcmp(header, "MAMEINP\0", 8) != 0) | |
| 3607 | fatalerror("Input file invalid or in an older, unsupported format"); | |
| 3608 | if (header[0x10] != INP_HEADER_MAJVERSION) | |
| 3609 | fatalerror("Input file format version mismatch"); | |
| 3610 | ||
| 3611 | /* output info to console */ | |
| 3612 | mame_printf_info("Input file: %s\n", filename); | |
| 3613 | mame_printf_info("INP version %d.%d\n", header[0x10], header[0x11]); | |
| 3614 | basetime = header[0x08] | (header[0x09] << 8) | (header[0x0a] << 16) | (header[0x0b] << 24) | | |
| 3615 | ((UINT64)header[0x0c] << 32) | ((UINT64)header[0x0d] << 40) | ((UINT64)header[0x0e] << 48) | ((UINT64)header[0x0f] << 56); | |
| 3616 | mame_printf_info("Created %s", ctime(&basetime)); | |
| 3617 | mame_printf_info("Recorded using %s\n", header + 0x20); | |
| 3618 | ||
| 3619 | /* verify the header against the current game */ | |
| 3620 | if (memcmp(machine->gamedrv->name, header + 0x14, strlen(machine->gamedrv->name) + 1) != 0) | |
| 3621 | fatalerror("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", header + 0x14, machine->gamedrv->name); | |
| 3622 | ||
| 3623 | return basetime; | |
| 3624 | } | |
| 3625 | ||
| 3626 | ||
| 3627 | /*------------------------------------------------- | |
| 3628 | record_init - initialize INP recording | |
| 3629 | -------------------------------------------------*/ | |
| 3630 | ||
| 3631 | static void record_init(running_machine *machine) | |
| 3632 | { | |
| 3633 | const char *filename = options_get_string(mame_options(), OPTION_RECORD); | |
| 3634 | UINT8 header[INP_HEADER_SIZE]; | |
| 3635 | mame_system_time systime; | |
| 3636 | file_error filerr; | |
| 3637 | ||
| 3638 | /* if no file, nothing to do */ | |
| 3639 | if (filename[0] == 0) | |
| 3640 | return; | |
| 3641 | ||
| 3642 | /* open the record file */ | |
| 3643 | filerr = mame_fopen(SEARCHPATH_INPUTLOG, filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &machine->record_file); | |
| 3644 | assert_always(filerr == FILERR_NONE, "Failed to open file for recording"); | |
| 3645 | ||
| 3646 | /* get the base time */ | |
| 3647 | mame_get_base_datetime(machine, &systime); | |
| 3648 | ||
| 3649 | /* fill in the header */ | |
| 3650 | memset(header, 0, sizeof(header)); | |
| 3651 | memcpy(header, "MAMEINP\0", 8); | |
| 3652 | header[0x08] = systime.time >> 0; | |
| 3653 | header[0x09] = systime.time >> 8; | |
| 3654 | header[0x0a] = systime.time >> 16; | |
| 3655 | header[0x0b] = systime.time >> 24; | |
| 3656 | header[0x0c] = systime.time >> 32; | |
| 3657 | header[0x0d] = systime.time >> 40; | |
| 3658 | header[0x0e] = systime.time >> 48; | |
| 3659 | header[0x0f] = systime.time >> 56; | |
| 3660 | header[0x10] = INP_HEADER_MAJVERSION; | |
| 3661 | header[0x11] = INP_HEADER_MINVERSION; | |
| 3662 | strcpy((char *)header + 0x14, machine->gamedrv->name); | |
| 3663 | sprintf((char *)header + 0x20, APPNAME " %s", build_version); | |
| 3664 | ||
| 3665 | /* write it */ | |
| 3666 | mame_fwrite(machine->record_file, header, sizeof(header)); | |
| 3667 | } | |
| 3668 | ||
| 3669 | ||
| 3670 | /*------------------------------------------------- | |
| 3671 | playback_end - end INP playback | |
| 3672 | -------------------------------------------------*/ | |
| 3673 | ||
| 3674 | static void playback_end(running_machine *machine, const char *message) | |
| 3675 | { | |
| 3676 | /* only applies if we have a live file */ | |
| 3677 | if (machine->playback_file != NULL) | |
| 3678 | { | |
| 3679 | /* close the file */ | |
| 3680 | mame_fclose(machine->playback_file); | |
| 3681 | machine->playback_file = NULL; | |
| 3682 | ||
| 3683 | /* pop a message */ | |
| 3684 | if (message != NULL) | |
| 3685 | popmessage("Playback Ended\nReason: %s", message); | |
| 3686 | ||
| 3687 | /* display speed stats */ | |
| 3688 | playback_accumulated_speed /= playback_accumulated_frames; | |
| 3689 | mame_printf_info("Total playback frames: %d\n", (UINT32)playback_accumulated_frames); | |
| 3690 | mame_printf_info("Average recorded speed: %d%%\n", (UINT32)((playback_accumulated_speed * 200 + 1) >> 21)); | |
| 3691 | } | |
| 3692 | } | |
| 3693 | ||
| 3694 | ||
| 3695 | /*------------------------------------------------- | |
| 3696 | record_end - end INP recording | |
| 3697 | -------------------------------------------------*/ | |
| 3698 | ||
| 3699 | static void record_end(running_machine *machine, const char *message) | |
| 3700 | { | |
| 3701 | /* only applies if we have a live file */ | |
| 3702 | if (machine->record_file != NULL) | |
| 3703 | { | |
| 3704 | /* close the file */ | |
| 3705 | mame_fclose(machine->record_file); | |
| 3706 | machine->record_file = NULL; | |
| 3707 | ||
| 3708 | /* pop a message */ | |
| 3709 | if (message != NULL) | |
| 3710 | popmessage("Recording Ended\nReason: %s", message); | |
| 3711 | } | |
| 3712 | } | |
| 3713 | ||
| 3714 | ||
| 3715 | /*------------------------------------------------- | |
| 3716 | playback_frame - start of frame callback for | |
| 3717 | playback | |
| 3718 | -------------------------------------------------*/ | |
| 3719 | ||
| 3720 | static void playback_frame(running_machine *machine, attotime curtime) | |
| 3721 | { | |
| 3722 | /* if playing back, fetch the information and verify */ | |
| 3723 | if (machine->playback_file != NULL) | |
| 3724 | { | |
| 3725 | attotime readtime; | |
| 3726 | ||
| 3727 | /* first the absolute time */ | |
| 3728 | readtime.seconds = playback_read_uint32(machine); | |
| 3729 | readtime.attoseconds = playback_read_uint64(machine); | |
| 3730 | if (attotime_compare(readtime, curtime) != 0) | |
| 3731 | playback_end(machine, "Out of sync"); | |
| 3732 | ||
| 3733 | /* then the speed */ | |
| 3734 | playback_accumulated_speed += playback_read_uint32(machine); | |
| 3735 | playback_accumulated_frames++; | |
| 3736 | } | |
| 3737 | } | |
| 3738 | ||
| 3739 | ||
| 3740 | /*------------------------------------------------- | |
| 3741 | record_frame - start of frame callback for | |
| 3742 | recording | |
| 3743 | -------------------------------------------------*/ | |
| 3744 | ||
| 3745 | static void record_frame(running_machine *machine, attotime curtime) | |
| 3746 | { | |
| 3747 | /* if recording, record information about the current frame */ | |
| 3748 | if (machine->record_file != NULL) | |
| 3749 | { | |
| 3750 | /* first the absolute time */ | |
| 3751 | record_write_uint32(machine, curtime.seconds); | |
| 3752 | record_write_uint64(machine, curtime.attoseconds); | |
| 3753 | ||
| 3754 | /* then the current speed */ | |
| 3755 | record_write_uint32(machine, video_get_speed_percent(machine) * (double)(1 << 20)); | |
| 3756 | } | |
| 3757 | } | |
| 3758 | ||
| 3759 | ||
| 3760 | /*------------------------------------------------- | |
| 3761 | playback_port - per-port callback for playback | |
| 3762 | -------------------------------------------------*/ | |
| 3763 | ||
| 3764 | static void playback_port(running_machine *machine, input_port_info *portinfo) | |
| 3765 | { | |
| 3766 | /* if playing back, fetch information about this port */ | |
| 3767 | if (machine->playback_file != NULL) | |
| 3768 | { | |
| 3769 | analog_port_info *analog; | |
| 3770 | ||
| 3771 | /* read the digital value */ | |
| 3772 | portinfo->digital = playback_read_uint32(machine); | |
| 3773 | ||
| 3774 | /* loop over analog ports and save their data */ | |
| 3775 | for (analog = portinfo->analoginfo; analog != NULL; analog = analog->next) | |
| 3776 | { | |
| 3777 | /* read current and previous values */ | |
| 3778 | analog->accum = playback_read_uint32(machine); | |
| 3779 | analog->previous = playback_read_uint32(machine); | |
| 3780 | ||
| 3781 | /* read configuration information */ | |
| 3782 | analog->portentry->analog.sensitivity = playback_read_uint32(machine); | |
| 3783 | analog->portentry->analog.reverse = playback_read_uint8(machine); | |
| 3784 | } | |
| 3785 | } | |
| 3786 | } | |
| 3787 | ||
| 3788 | ||
| 3789 | /*------------------------------------------------- | |
| 3790 | record_port - per-port callback for record | |
| 3791 | -------------------------------------------------*/ | |
| 3792 | ||
| 3793 | static void record_port(running_machine *machine, input_port_info *portinfo) | |
| 3794 | { | |
| 3795 | /* if recording, store information about this port */ | |
| 3796 | if (machine->record_file != NULL) | |
| 3797 | { | |
| 3798 | analog_port_info *analog; | |
| 3799 | ||
| 3800 | /* store the digital value */ | |
| 3801 | record_write_uint32(machine, portinfo->digital); | |
| 3802 | ||
| 3803 | /* loop over analog ports and save their data */ | |
| 3804 | for (analog = portinfo->analoginfo; analog != NULL; analog = analog->next) | |
| 3805 | { | |
| 3806 | /* store current and previous values */ | |
| 3807 | record_write_uint32(machine, analog->accum); | |
| 3808 | record_write_uint32(machine, analog->previous); | |
| 3809 | ||
| 3810 | /* store configuration information */ | |
| 3811 | record_write_uint32(machine, analog->portentry->analog.sensitivity); | |
| 3812 | record_write_uint8(machine, analog->portentry->analog.reverse); | |
| 3813 | } | |
| 3814 | } | |
| 3815 | } |
| r2375 | r2376 | |
|---|---|---|
| 741 | 741 | return 0; |
| 742 | 742 | |
| 743 | 743 | case SCSIOP_ALLOC_INSTANCE: |
| 744 | SCSIBase( &SCSIClassCDROM, operation, file, intparm + SCSI_DEVICE_CDROM_STATE_BASE, ptrparm ); | |
| 745 | scsicd_alloc_instance( *((SCSIInstance **) ptrparm), intparm + SCSI_DEVICE_CDROM_STATE_BASE ); | |
| 744 | SCSIBase( &SCSIClassCDROM, operation, file, intparm, ptrparm ); | |
| 745 | scsicd_alloc_instance( *((SCSIInstance **) ptrparm), intparm ); | |
| 746 | 746 | return 0; |
| 747 | 747 | |
| 748 | 748 | case SCSIOP_DELETE_INSTANCE: |
| r2375 | r2376 | |
|---|---|---|
| 13 | 13 | extern const SCSIClass SCSIClassCDROM; |
| 14 | 14 | #define SCSI_DEVICE_CDROM &SCSIClassCDROM |
| 15 | 15 | |
| 16 | // we pass in the disk ID for each SCSI device, but that's not unique across device types. | |
| 17 | // to avoid collisions, each non-HDD SCSI device type should have it's own BASE to prevent | |
| 18 | // this problem. | |
| 19 | #define SCSI_DEVICE_CDROM_STATE_BASE (32) | |
| 20 | ||
| 21 | 16 | #endif |
| 22 | 17 |
| r2375 | r2376 | |
|---|---|---|
| 713 | 713 | 8-bit read handlers |
| 714 | 714 | -------------------------------------------------*/ |
| 715 | 715 | |
| 716 | READ8_HANDLER( input_port_0_r ) { return readinputport(0); } | |
| 717 | READ8_HANDLER( input_port_1_r ) { return readinputport(1); } | |
| 718 | READ8_HANDLER( input_port_2_r ) { return readinputport(2); } | |
| 719 | READ8_HANDLER( input_port_3_r ) { return readinputport(3); } | |
| 720 | READ8_HANDLER( input_port_4_r ) { return readinputport(4); } | |
| 721 | READ8_HANDLER( input_port_5_r ) { return readinputport(5); } | |
| 722 | READ8_HANDLER( input_port_6_r ) { return readinputport(6); } | |
| 723 | READ8_HANDLER( input_port_7_r ) { return readinputport(7); } | |
| 724 | READ8_HANDLER( input_port_8_r ) { return readinputport(8); } | |
| 725 | READ8_HANDLER( input_port_9_r ) { return readinputport(9); } | |
| 726 | READ8_HANDLER( input_port_10_r ) { return readinputport(10); } | |
| 727 | READ8_HANDLER( input_port_11_r ) { return readinputport(11); } | |
| 728 | READ8_HANDLER( input_port_12_r ) { return readinputport(12); } | |
| 729 | READ8_HANDLER( input_port_13_r ) { return readinputport(13); } | |
| 730 | READ8_HANDLER( input_port_14_r ) { return readinputport(14); } | |
| 731 | READ8_HANDLER( input_port_15_r ) { return readinputport(15); } | |
| 732 | READ8_HANDLER( input_port_16_r ) { return readinputport(16); } | |
| 733 | READ8_HANDLER( input_port_17_r ) { return readinputport(17); } | |
| 734 | READ8_HANDLER( input_port_18_r ) { return readinputport(18); } | |
| 735 | READ8_HANDLER( input_port_19_r ) { return readinputport(19); } | |
| 736 | READ8_HANDLER( input_port_20_r ) { return readinputport(20); } | |
| 737 | READ8_HANDLER( input_port_21_r ) { return readinputport(21); } | |
| 738 | READ8_HANDLER( input_port_22_r ) { return readinputport(22); } | |
| 739 | READ8_HANDLER( input_port_23_r ) { return readinputport(23); } | |
| 740 | READ8_HANDLER( input_port_24_r ) { return readinputport(24); } | |
| 741 | READ8_HANDLER( input_port_25_r ) { return readinputport(25); } | |
| 742 | READ8_HANDLER( input_port_26_r ) { return readinputport(26); } | |
| 743 | READ8_HANDLER( input_port_27_r ) { return readinputport(27); } | |
| 744 | READ8_HANDLER( input_port_28_r ) { return readinputport(28); } | |
| 745 | READ8_HANDLER( input_port_29_r ) { return readinputport(29); } | |
| 746 | READ8_HANDLER( input_port_30_r ) { return readinputport(30); } | |
| 747 | READ8_HANDLER( input_port_31_r ) { return readinputport(31); } | |
| 716 | READ8_HANDLER( input_port_0_r ) { return input_port_read_indexed(machine, 0); } | |
| 717 | READ8_HANDLER( input_port_1_r ) { return input_port_read_indexed(machine, 1); } | |
| 718 | READ8_HANDLER( input_port_2_r ) { return input_port_read_indexed(machine, 2); } | |
| 719 | READ8_HANDLER( input_port_3_r ) { return input_port_read_indexed(machine, 3); } | |
| 720 | READ8_HANDLER( input_port_4_r ) { return input_port_read_indexed(machine, 4); } | |
| 721 | READ8_HANDLER( input_port_5_r ) { return input_port_read_indexed(machine, 5); } | |
| 722 | READ8_HANDLER( input_port_6_r ) { return input_port_read_indexed(machine, 6); } | |
| 723 | READ8_HANDLER( input_port_7_r ) { return input_port_read_indexed(machine, 7); } | |
| 724 | READ8_HANDLER( input_port_8_r ) { return input_port_read_indexed(machine, 8); } | |
| 725 | READ8_HANDLER( input_port_9_r ) { return input_port_read_indexed(machine, 9); } | |
| 726 | READ8_HANDLER( input_port_10_r ) { return input_port_read_indexed(machine, 10); } | |
| 727 | READ8_HANDLER( input_port_11_r ) { return input_port_read_indexed(machine, 11); } | |
| 728 | READ8_HANDLER( input_port_12_r ) { return input_port_read_indexed(machine, 12); } | |
| 729 | READ8_HANDLER( input_port_13_r ) { return input_port_read_indexed(machine, 13); } | |
| 730 | READ8_HANDLER( input_port_14_r ) { return input_port_read_indexed(machine, 14); } | |
| 731 | READ8_HANDLER( input_port_15_r ) { return input_port_read_indexed(machine, 15); } | |
| 732 | READ8_HANDLER( input_port_16_r ) { return input_port_read_indexed(machine, 16); } | |
| 733 | READ8_HANDLER( input_port_17_r ) { return input_port_read_indexed(machine, 17); } | |
| 734 | READ8_HANDLER( input_port_18_r ) { return input_port_read_indexed(machine, 18); } | |
| 735 | READ8_HANDLER( input_port_19_r ) { return input_port_read_indexed(machine, 19); } | |
| 736 | READ8_HANDLER( input_port_20_r ) { return input_port_read_indexed(machine, 20); } | |
| 737 | READ8_HANDLER( input_port_21_r ) { return input_port_read_indexed(machine, 21); } | |
| 738 | READ8_HANDLER( input_port_22_r ) { return input_port_read_indexed(machine, 22); } | |
| 739 | READ8_HANDLER( input_port_23_r ) { return input_port_read_indexed(machine, 23); } | |
| 740 | READ8_HANDLER( input_port_24_r ) { return input_port_read_indexed(machine, 24); } | |
| 741 | READ8_HANDLER( input_port_25_r ) { return input_port_read_indexed(machine, 25); } | |
| 742 | READ8_HANDLER( input_port_26_r ) { return input_port_read_indexed(machine, 26); } | |
| 743 | READ8_HANDLER( input_port_27_r ) { return input_port_read_indexed(machine, 27); } | |
| 744 | READ8_HANDLER( input_port_28_r ) { return input_port_read_indexed(machine, 28); } | |
| 745 | READ8_HANDLER( input_port_29_r ) { return input_port_read_indexed(machine, 29); } | |
| 746 | READ8_HANDLER( input_port_30_r ) { return input_port_read_indexed(machine, 30); } | |
| 747 | READ8_HANDLER( input_port_31_r ) { return input_port_read_indexed(machine, 31); } | |
| 748 | 748 | |
| 749 | 749 | |
| 750 | 750 | /*------------------------------------------------- |
| 751 | 751 | 16-bit read handlers |
| 752 | 752 | -------------------------------------------------*/ |
| 753 | 753 | |
| 754 | READ16_HANDLER( input_port_0_word_r ) { return readinputport(0); } | |
| 755 | READ16_HANDLER( input_port_1_word_r ) { return readinputport(1); } | |
| 756 | READ16_HANDLER( input_port_2_word_r ) { return readinputport(2); } | |
| 757 | READ16_HANDLER( input_port_3_word_r ) { return readinputport(3); } | |
| 758 | READ16_HANDLER( input_port_4_word_r ) { return readinputport(4); } | |
| 759 | READ16_HANDLER( input_port_5_word_r ) { return readinputport(5); } | |
| 760 | READ16_HANDLER( input_port_6_word_r ) { return readinputport(6); } | |
| 761 | READ16_HANDLER( input_port_7_word_r ) { return readinputport(7); } | |
| 762 | READ16_HANDLER( input_port_8_word_r ) { return readinputport(8); } | |
| 763 | READ16_HANDLER( input_port_9_word_r ) { return readinputport(9); } | |
| 764 | READ16_HANDLER( input_port_10_word_r ) { return readinputport(10); } | |
| 765 | READ16_HANDLER( input_port_11_word_r ) { return readinputport(11); } | |
| 766 | READ16_HANDLER( input_port_12_word_r ) { return readinputport(12); } | |
| 767 | READ16_HANDLER( input_port_13_word_r ) { return readinputport(13); } | |
| 768 | READ16_HANDLER( input_port_14_word_r ) { return readinputport(14); } | |
| 769 | READ16_HANDLER( input_port_15_word_r ) { return readinputport(15); } | |
| 770 | READ16_HANDLER( input_port_16_word_r ) { return readinputport(16); } | |
| 771 | READ16_HANDLER( input_port_17_word_r ) { return readinputport(17); } | |
| 772 | READ16_HANDLER( input_port_18_word_r ) { return readinputport(18); } | |
| 773 | READ16_HANDLER( input_port_19_word_r ) { return readinputport(19); } | |
| 774 | READ16_HANDLER( input_port_20_word_r ) { return readinputport(20); } | |
| 775 | READ16_HANDLER( input_port_21_word_r ) { return readinputport(21); } | |
| 776 | READ16_HANDLER( input_port_22_word_r ) { return readinputport(22); } | |
| 777 | READ16_HANDLER( input_port_23_word_r ) { return readinputport(23); } | |
| 778 | READ16_HANDLER( input_port_24_word_r ) { return readinputport(24); } | |
| 779 | READ16_HANDLER( input_port_25_word_r ) { return readinputport(25); } | |
| 780 | READ16_HANDLER( input_port_26_word_r ) { return readinputport(26); } | |
| 781 | READ16_HANDLER( input_port_27_word_r ) { return readinputport(27); } | |
| 782 | READ16_HANDLER( input_port_28_word_r ) { return readinputport(28); } | |
| 783 | READ16_HANDLER( input_port_29_word_r ) { return readinputport(29); } | |
| 784 | READ16_HANDLER( input_port_30_word_r ) { return readinputport(30); } | |
| 785 | READ16_HANDLER( input_port_31_word_r ) { return readinputport(31); } | |
| 754 | READ16_HANDLER( input_port_0_word_r ) { return input_port_read_indexed(machine, 0); } | |
| 755 | READ16_HANDLER( input_port_1_word_r ) { return input_port_read_indexed(machine, 1); } | |
| 756 | READ16_HANDLER( input_port_2_word_r ) { return input_port_read_indexed(machine, 2); } | |
| 757 | READ16_HANDLER( input_port_3_word_r ) { return input_port_read_indexed(machine, 3); } | |
| 758 | READ16_HANDLER( input_port_4_word_r ) { return input_port_read_indexed(machine, 4); } | |
| 759 | READ16_HANDLER( input_port_5_word_r ) { return input_port_read_indexed(machine, 5); } | |
| 760 | READ16_HANDLER( input_port_6_word_r ) { return input_port_read_indexed(machine, 6); } | |
| 761 | READ16_HANDLER( input_port_7_word_r ) { return input_port_read_indexed(machine, 7); } | |
| 762 | READ16_HANDLER( input_port_8_word_r ) { return input_port_read_indexed(machine, 8); } | |
| 763 | READ16_HANDLER( input_port_9_word_r ) { return input_port_read_indexed(machine, 9); } | |
| 764 | READ16_HANDLER( input_port_10_word_r ) { return input_port_read_indexed(machine, 10); } | |
| 765 | READ16_HANDLER( input_port_11_word_r ) { return input_port_read_indexed(machine, 11); } | |
| 766 | READ16_HANDLER( input_port_12_word_r ) { return input_port_read_indexed(machine, 12); } | |
| 767 | READ16_HANDLER( input_port_13_word_r ) { return input_port_read_indexed(machine, 13); } | |
| 768 | READ16_HANDLER( input_port_14_word_r ) { return input_port_read_indexed(machine, 14); } | |
| 769 | READ16_HANDLER( input_port_15_word_r ) { return input_port_read_indexed(machine, 15); } | |
| 770 | READ16_HANDLER( input_port_16_word_r ) { return input_port_read_indexed(machine, 16); } | |
| 771 | READ16_HANDLER( input_port_17_word_r ) { return input_port_read_indexed(machine, 17); } | |
| 772 | READ16_HANDLER( input_port_18_word_r ) { return input_port_read_indexed(machine, 18); } | |
| 773 | READ16_HANDLER( input_port_19_word_r ) { return input_port_read_indexed(machine, 19); } | |
| 774 | READ16_HANDLER( input_port_20_word_r ) { return input_port_read_indexed(machine, 20); } | |
| 775 | READ16_HANDLER( input_port_21_word_r ) { return input_port_read_indexed(machine, 21); } | |
| 776 | READ16_HANDLER( input_port_22_word_r ) { return input_port_read_indexed(machine, 22); } | |
| 777 | READ16_HANDLER( input_port_23_word_r ) { return input_port_read_indexed(machine, 23); } | |
| 778 | READ16_HANDLER( input_port_24_word_r ) { return input_port_read_indexed(machine, 24); } | |
| 779 | READ16_HANDLER( input_port_25_word_r ) { return input_port_read_indexed(machine, 25); } | |
| 780 | READ16_HANDLER( input_port_26_word_r ) { return input_port_read_indexed(machine, 26); } | |
| 781 | READ16_HANDLER( input_port_27_word_r ) { return input_port_read_indexed(machine, 27); } | |
| 782 | READ16_HANDLER( input_port_28_word_r ) { return input_port_read_indexed(machine, 28); } | |
| 783 | READ16_HANDLER( input_port_29_word_r ) { return input_port_read_indexed(machine, 29); } | |
| 784 | READ16_HANDLER( input_port_30_word_r ) { return input_port_read_indexed(machine, 30); } | |
| 785 | READ16_HANDLER( input_port_31_word_r ) { return input_port_read_indexed(machine, 31); } | |
| 786 | 786 | |
| 787 | 787 | |
| 788 | 788 | /*------------------------------------------------- |
| 789 | 789 | 32-bit read handlers |
| 790 | 790 | -------------------------------------------------*/ |
| 791 | 791 | |
| 792 | READ32_HANDLER( input_port_0_dword_r ) { return readinputport(0); } | |
| 793 | READ32_HANDLER( input_port_1_dword_r ) { return readinputport(1); } | |
| 794 | READ32_HANDLER( input_port_2_dword_r ) { return readinputport(2); } | |
| 795 | READ32_HANDLER( input_port_3_dword_r ) { return readinputport(3); } | |
| 796 | READ32_HANDLER( input_port_4_dword_r ) { return readinputport(4); } | |
| 797 | READ32_HANDLER( input_port_5_dword_r ) { return readinputport(5); } | |
| 798 | READ32_HANDLER( input_port_6_dword_r ) { return readinputport(6); } | |
| 799 | READ32_HANDLER( input_port_7_dword_r ) { return readinputport(7); } | |
| 800 | READ32_HANDLER( input_port_8_dword_r ) { return readinputport(8); } | |
| 801 | READ32_HANDLER( input_port_9_dword_r ) { return readinputport(9); } | |
| 802 | READ32_HANDLER( input_port_10_dword_r ) { return readinputport(10); } | |
| 803 | READ32_HANDLER( input_port_11_dword_r ) { return readinputport(11); } | |
| 804 | READ32_HANDLER( input_port_12_dword_r ) { return readinputport(12); } | |
| 805 | READ32_HANDLER( input_port_13_dword_r ) { return readinputport(13); } | |
| 806 | READ32_HANDLER( input_port_14_dword_r ) { return readinputport(14); } | |
| 807 | READ32_HANDLER( input_port_15_dword_r ) { return readinputport(15); } | |
| 808 | READ32_HANDLER( input_port_16_dword_r ) { return readinputport(16); } | |
| 809 | READ32_HANDLER( input_port_17_dword_r ) { return readinputport(17); } | |
| 810 | READ32_HANDLER( input_port_18_dword_r ) { return readinputport(18); } | |
| 811 | READ32_HANDLER( input_port_19_dword_r ) { return readinputport(19); } | |
| 812 | READ32_HANDLER( input_port_20_dword_r ) { return readinputport(20); } | |
| 813 | READ32_HANDLER( input_port_21_dword_r ) { return readinputport(21); } | |
| 814 | READ32_HANDLER( input_port_22_dword_r ) { return readinputport(22); } | |
| 815 | READ32_HANDLER( input_port_23_dword_r ) { return readinputport(23); } | |
| 816 | READ32_HANDLER( input_port_24_dword_r ) { return readinputport(24); } | |
| 817 | READ32_HANDLER( input_port_25_dword_r ) { return readinputport(25); } | |
| 818 | READ32_HANDLER( input_port_26_dword_r ) { return readinputport(26); } | |
| 819 | READ32_HANDLER( input_port_27_dword_r ) { return readinputport(27); } | |
| 820 | READ32_HANDLER( input_port_28_dword_r ) { return readinputport(28); } | |
| 821 | READ32_HANDLER( input_port_29_dword_r ) { return readinputport(29); } | |
| 822 | READ32_HANDLER( input_port_30_dword_r ) { return readinputport(30); } | |
| 823 | READ32_HANDLER( input_port_31_dword_r ) { return readinputport(31); } | |
| 792 | READ32_HANDLER( input_port_0_dword_r ) { return input_port_read_indexed(machine, 0); } | |
| 793 | READ32_HANDLER( input_port_1_dword_r ) { return input_port_read_indexed(machine, 1); } | |
| 794 | READ32_HANDLER( input_port_2_dword_r ) { return input_port_read_indexed(machine, 2); } | |
| 795 | READ32_HANDLER( input_port_3_dword_r ) { return input_port_read_indexed(machine, 3); } | |
| 796 | READ32_HANDLER( input_port_4_dword_r ) { return input_port_read_indexed(machine, 4); } | |
| 797 | READ32_HANDLER( input_port_5_dword_r ) { return input_port_read_indexed(machine, 5); } | |
| 798 | READ32_HANDLER( input_port_6_dword_r ) { return input_port_read_indexed(machine, 6); } | |
| 799 | READ32_HANDLER( input_port_7_dword_r ) { return input_port_read_indexed(machine, 7); } | |
| 800 | READ32_HANDLER( input_port_8_dword_r ) { return input_port_read_indexed(machine, 8); } | |
| 801 | READ32_HANDLER( input_port_9_dword_r ) { return input_port_read_indexed(machine, 9); } | |
| 802 | READ32_HANDLER( input_port_10_dword_r ) { return input_port_read_indexed(machine, 10); } | |
| 803 | READ32_HANDLER( input_port_11_dword_r ) { return input_port_read_indexed(machine, 11); } | |
| 804 | READ32_HANDLER( input_port_12_dword_r ) { return input_port_read_indexed(machine, 12); } | |
| 805 | READ32_HANDLER( input_port_13_dword_r ) { return input_port_read_indexed(machine, 13); } | |
| 806 | READ32_HANDLER( input_port_14_dword_r ) { return input_port_read_indexed(machine, 14); } | |
| 807 | READ32_HANDLER( input_port_15_dword_r ) { return input_port_read_indexed(machine, 15); } | |
| 808 | READ32_HANDLER( input_port_16_dword_r ) { return input_port_read_indexed(machine, 16); } | |
| 809 | READ32_HANDLER( input_port_17_dword_r ) { return input_port_read_indexed(machine, 17); } | |
| 810 | READ32_HANDLER( input_port_18_dword_r ) { return input_port_read_indexed(machine, 18); } | |
| 811 | READ32_HANDLER( input_port_19_dword_r ) { return input_port_read_indexed(machine, 19); } | |
| 812 | READ32_HANDLER( input_port_20_dword_r ) { return input_port_read_indexed(machine, 20); } | |
| 813 | READ32_HANDLER( input_port_21_dword_r ) { return input_port_read_indexed(machine, 21); } | |
| 814 | READ32_HANDLER( input_port_22_dword_r ) { return input_port_read_indexed(machine, 22); } | |
| 815 | READ32_HANDLER( input_port_23_dword_r ) { return input_port_read_indexed(machine, 23); } | |
| 816 | READ32_HANDLER( input_port_24_dword_r ) { return input_port_read_indexed(machine, 24); } | |
| 817 | READ32_HANDLER( input_port_25_dword_r ) { return input_port_read_indexed(machine, 25); } | |
| 818 | READ32_HANDLER( input_port_26_dword_r ) { return input_port_read_indexed(machine, 26); } | |
| 819 | READ32_HANDLER( input_port_27_dword_r ) { return input_port_read_indexed(machine, 27); } | |
| 820 | READ32_HANDLER( input_port_28_dword_r ) { return input_port_read_indexed(machine, 28); } | |
| 821 | READ32_HANDLER( input_port_29_dword_r ) { return input_port_read_indexed(machine, 29); } | |
| 822 | READ32_HANDLER( input_port_30_dword_r ) { return input_port_read_indexed(machine, 30); } | |
| 823 | READ32_HANDLER( input_port_31_dword_r ) { return input_port_read_indexed(machine, 31); } | |
| 824 | 824 |
| r2375 | r2376 | |
|---|---|---|
| 1170 | 1170 | { |
| 1171 | 1171 | struct pit8253_timer *timer = get_timer(pit,i); |
| 1172 | 1172 | /* According to Intel's 8254 docs, the state of a timer is undefined |
| 1173 | until the first mode control word is written. Here we define this | |
| 1174 | undefined behaviour */ | |
| 1173 | until the first mode control word is written. Here we define this | |
| 1174 | undefined behaviour */ | |
| 1175 | 1175 | timer->control = timer->status = 0x30; |
| 1176 | 1176 | timer->rmsb = timer->wmsb = 0; |
| 1177 | 1177 | timer->count = timer->value = timer->latch = 0; |
| r2375 | r2376 | |
| 1201 | 1201 | switch ( state ) { |
| 1202 | 1202 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 1203 | 1203 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(pit8253_t); break; |
| 1204 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = | |
| 1204 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0 | |
| 1205 | 1205 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 1206 | 1206 | |
| 1207 | 1207 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| r2375 | r2376 | |
| 1231 | 1231 | default: DEVICE_GET_INFO_CALL(pit8253); break; |
| 1232 | 1232 | } |
| 1233 | 1233 | } |
| 1234 |
| r2375 | r2376 | |
|---|---|---|
| 29 | 29 | pit8253_output_changed_func output_changed; |
| 30 | 30 | |
| 31 | 31 | /* If specified, this gets called whenever the frequency of the output for this |
| 32 | timer changes. */ | |
| 33 | pit8253_frequency_changed_func frequency_changed; | |
| 32 | timer changes. */ | |
| 33 | pit8253_frequency_changed_func frequency_changed; | |
| 34 | 34 | } timer[3]; |
| 35 | 35 | }; |
| 36 | 36 |
| r2375 | r2376 | |
|---|---|---|
| 39 | 39 | #define INPUT_PORT_PAIR_TOKENS (2 * sizeof(UINT32) / sizeof(FPTR)) |
| 40 | 40 | |
| 41 | 41 | |
| 42 | #define INP_HEADER_SIZE 64 | |
| 43 | #define INP_HEADER_MAJVERSION 2 | |
| 44 | #define INP_HEADER_MINVERSION 0 | |
| 45 | ||
| 46 | ||
| 42 | 47 | /* macro for a custom callback functions (PORT_CUSTOM) */ |
| 43 | 48 | #define CUSTOM_INPUT(name) UINT32 name(running_machine *machine, void *param) |
| 44 | 49 | |
| r2375 | r2376 | |
| 630 | 635 | typedef struct _inp_header inp_header; |
| 631 | 636 | struct _inp_header |
| 632 | 637 | { |
| 633 | char name[9]; /* 8 bytes for game->name + NUL */ | |
| 634 | char version[3]; /* byte[0] = 0, byte[1] = version byte[2] = beta_version */ | |
| 635 | char reserved[20]; /* for future use, possible store game options? */ | |
| 638 | char header[8]; /* +00: 8 byte header - must be "MAMEINP\0" */ | |
| 639 | UINT64 basetime; /* +08: base time of recording */ | |
| 640 | UINT8 majversion; /* +10: major INP version */ | |
| 641 | UINT8 minversion; /* +11: minor INP version */ | |
| 642 | UINT8 reserved[2]; /* +12: must be zero */ | |
| 643 | char gamename[12]; /* +14: game name string, NULL-terminated */ | |
| 644 | char version[32]; /* +20: system version string, NULL-terminated */ | |
| 636 | 645 | }; |
| 637 | 646 | |
| 638 | 647 | |
| 639 | typedef struct _ext_inp_header ext_inp_header; | |
| 640 | struct _ext_inp_header | |
| 641 | { | |
| 642 | char header[7]; /* must be "XINP" followed by NULLs */ | |
| 643 | char shortname[9]; /* game shortname */ | |
| 644 | char version[32]; /* MAME version string */ | |
| 645 | UINT32 starttime; /* approximate INP start time */ | |
| 646 | char dummy[32]; /* for possible future expansion */ | |
| 647 | }; | |
| 648 | 648 | |
| 649 | ||
| 650 | ||
| 651 | 649 | /*************************************************************************** |
| 652 | 650 | MACROS FOR BUILDING INPUT PORTS |
| 653 | 651 | ***************************************************************************/ |
| r2375 | r2376 | |
| 904 | 902 | FUNCTION PROTOTYPES |
| 905 | 903 | ***************************************************************************/ |
| 906 | 904 | |
| 907 | ||
| 905 | t | |
| 908 | 906 | const char *input_port_string_from_token(const input_port_token token); |
| 909 | 907 | |
| 910 | 908 | input_port_entry *input_port_initialize(input_port_init_params *params, UINT32 type, const char *tag, UINT32 mask, UINT32 defval); |
| r2375 | r2376 | |
| 938 | 936 | |
| 939 | 937 | void input_port_update_defaults(void); |
| 940 | 938 | |
| 941 | void input_port_set_digital_value(int port, UINT32 value, UINT32 mask); | |
| 939 | void input_port_set_digital_value(running_machine *machine, int port_num, UINT32 value, UINT32 mask); | |
| 942 | 940 | |
| 943 | 941 | UINT32 get_crosshair_pos(int port_num, UINT8 player, UINT8 axis); |
| 944 | 942 | |
| 945 | /* leaving these in temporarily until 0.124u2 */ | |
| 946 | UINT32 readinputport(int port); | |
| 947 | UINT32 readinputportbytag(const char *tag); | |
| 948 | UINT32 readinputportbytag_safe(const char *tag, UINT32 defvalue); | |
| 949 | ||
| 950 | 943 | UINT32 input_port_read_indexed(running_machine *machine, int port); |
| 951 | 944 | UINT32 input_port_read(running_machine *machine, const char *tag); |
| 952 | 945 | UINT32 input_port_read_safe(running_machine *machine, const char *tag, UINT32 defvalue); |
| r2375 | r2376 | |
|---|---|---|
| 213 | 213 | void mb86233_get_info(UINT32 state, cpuinfo *info); |
| 214 | 214 | void ssp1601_get_info(UINT32 state, cpuinfo *info); |
| 215 | 215 | void minx_get_info(UINT32 state, cpuinfo *info); |
| 216 | void cxd8661r_get_info(UINT32 state, cpuinfo *info); | |
| 216 | 217 | |
| 217 | 218 | |
| 218 | 219 | |
| r2375 | r2376 | |
| 824 | 825 | #if (HAS_MINX) |
| 825 | 826 | { CPU_MINX, minx_get_info }, |
| 826 | 827 | #endif |
| 828 | #if (HAS_CXD8661R) | |
| 829 | { CPU_CXD8661R, cxd8661r_get_info }, | |
| 830 | #endif | |
| 827 | 831 | }; |
| 828 | 832 | |
| 829 | 833 |
| r2375 | r2376 | |
|---|---|---|
| 241 | 241 | CPU_MB86233, |
| 242 | 242 | CPU_SSP1601, |
| 243 | 243 | CPU_MINX, |
| 244 | CPU_CXD8661R, | |
| 244 | 245 | CPU_COUNT |
| 245 | 246 | }; |
| 246 | 247 | typedef enum _cpu_type cpu_type; |
| r2375 | r2376 | |
|---|---|---|
| 12 | 12 | ***************************************************************************/ |
| 13 | 13 | |
| 14 | 14 | #include "sndintrf.h" |
| 15 | #include "deprecat.h" | |
| 15 | 16 | #include "streams.h" |
| 16 | 17 | #include "sound/fm.h" |
| 17 | 18 | #include "sound/2612intf.h" |
| r2375 | r2376 | |
| 79 | 80 | } |
| 80 | 81 | |
| 81 | 82 | |
| 82 | static | |
| 83 | static STATE_POSTLOAD( ym2612_postload | |
| 83 | 84 | { |
| 84 | 85 | struct ym2612_info *info = param; |
| 85 | 86 | YM2612Postload(info->chip); |
| r2375 | r2376 | |
| 108 | 109 | /**** initialize YM2612 ****/ |
| 109 | 110 | info->chip = YM2612Init(info,sndindex,clock,rate,timer_handler,IRQHandler); |
| 110 | 111 | |
| 111 | state_save_register_ | |
| 112 | state_save_register_ | |
| 112 | 113 | |
| 113 | 114 | if (info->chip) |
| 114 | 115 | return info; |
| r2375 | r2376 | |
|---|---|---|
| 18 | 18 | *********************************************************/ |
| 19 | 19 | |
| 20 | 20 | #include "sndintrf.h" |
| 21 | #include "deprecat.h" | |
| 21 | 22 | #include "streams.h" |
| 22 | 23 | #include "k054539.h" |
| 23 | 24 | #include <math.h> |
| r2375 | r2376 | |
| 592 | 593 | regbase[offset] = data; |
| 593 | 594 | } |
| 594 | 595 | |
| 595 | static | |
| 596 | static STATE_POSTLOAD( reset_zones | |
| 596 | 597 | { |
| 597 | 598 | struct k054539_info *info = param; |
| 598 | 599 | int data = info->regs[0x22e]; |
| r2375 | r2376 | |
| 662 | 663 | |
| 663 | 664 | K054539_init_chip(info, clock, sndindex); |
| 664 | 665 | |
| 665 | state_save_register_ | |
| 666 | state_save_register_ | |
| 666 | 667 | return info; |
| 667 | 668 | } |
| 668 | 669 |
| r2375 | r2376 | |
|---|---|---|
| 122 | 122 | if (DSS_ADJUSTMENT__ENABLE) |
| 123 | 123 | { |
| 124 | 124 | struct dss_adjustment_context *context = node->context; |
| 125 | INT32 rawportval = | |
| 125 | INT32 rawportval = | |
| 126 | 126 | |
| 127 | 127 | /* only recompute if the value changed from last time */ |
| 128 | 128 | if (rawportval != context->lastpval) |
| r2375 | r2376 | |
|---|---|---|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
| 194 | static | |
| 194 | static STATE_POSTLOAD( YMZ280B_state_save_update_step | |
| 195 | 195 | { |
| 196 | 196 | struct YMZ280BChip *chip = param; |
| 197 | 197 | int j; |
| r2375 | r2376 | |
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | state_save_register_ | |
| 693 | state_save_register_ | |
| 694 | 694 | |
| 695 | 695 | #if MAKE_WAVS |
| 696 | 696 | chip->wavresample = wav_open("resamp.wav", INTERNAL_SAMPLE_RATE, 2); |
| r2375 | r2376 | |
|---|---|---|
| 100 | 100 | #include <math.h> |
| 101 | 101 | |
| 102 | 102 | #include "sndintrf.h" |
| 103 | #include "deprecat.h" | |
| 103 | 104 | #include "streams.h" |
| 104 | 105 | #include "upd7759.h" |
| 105 | 106 | |
| r2375 | r2376 | |
| 579 | 580 | } |
| 580 | 581 | |
| 581 | 582 | |
| 582 | static | |
| 583 | static STATE_POSTLOAD( upd7759_postload | |
| 583 | 584 | { |
| 584 | 585 | struct upd7759_chip *chip = (struct upd7759_chip *)param; |
| 585 | 586 | chip->rom = chip->rombase + chip->romoffset; |
| r2375 | r2376 | |
| 615 | 616 | state_save_register_item("upd7759", index, chip->sample); |
| 616 | 617 | |
| 617 | 618 | state_save_register_item("upd7759", index, chip->romoffset); |
| 618 | state_save_register_ | |
| 619 | state_save_register_ | |
| 619 | 620 | } |
| 620 | 621 | |
| 621 | 622 |
| r2375 | r2376 | |
|---|---|---|
| 1386 | 1386 | /* |
| 1387 | 1387 | * state save support for MAME |
| 1388 | 1388 | */ |
| 1389 | ||
| 1389 | STATE_POSTLOAD( YM2151Postload | |
| 1390 | 1390 | { |
| 1391 | YM2151 *YM2151_chip = (YM2151 *) | |
| 1391 | YM2151 *YM2151_chip = (YM2151 *) | |
| 1392 | 1392 | int j; |
| 1393 | 1393 | |
| 1394 | 1394 | for (j=0; j<8; j++) |
| r2375 | r2376 | |
| 1494 | 1494 | |
| 1495 | 1495 | state_save_register_item_array(buf1, sndindex, chip->connect); |
| 1496 | 1496 | |
| 1497 | state_save_register_ | |
| 1497 | state_save_register_ | |
| 1498 | 1498 | } |
| 1499 | 1499 | #else |
| 1500 | ||
| 1500 | STATE_POSTLOAD( YM2151Postload | |
| 1501 | 1501 | { |
| 1502 | 1502 | } |
| 1503 | 1503 |
| r2375 | r2376 | |
|---|---|---|
| 82 | 82 | void YM2151SetPortWriteHandler(void *chip, write8_machine_func handler); |
| 83 | 83 | |
| 84 | 84 | /* refresh chip when load state */ |
| 85 | ||
| 85 | STATE_POSTLOAD( YM2151Postload | |
| 86 | 86 | #endif /*_H_YM2151_*/ |
| r2375 | r2376 | |
|---|---|---|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | |
| 497 | static | |
| 497 | static STATE_POSTLOAD( samples_postload | |
| 498 | 498 | { |
| 499 | 499 | struct samples_info *info = param; |
| 500 | 500 | int i; |
| r2375 | r2376 | |
| 566 | 566 | state_save_register_item("samples", sndindex * MAX_CHANNELS + i, info->channel[i].loop); |
| 567 | 567 | state_save_register_item("samples", sndindex * MAX_CHANNELS + i, info->channel[i].paused); |
| 568 | 568 | } |
| 569 | state_save_register_ | |
| 569 | state_save_register_ | |
| 570 | 570 | |
| 571 | 571 | /* initialize any custom handlers */ |
| 572 | 572 | if (intf->start) |
| r2375 | r2376 | |
|---|---|---|
| 12 | 12 | ***************************************************************************/ |
| 13 | 13 | |
| 14 | 14 | #include "sndintrf.h" |
| 15 | #include "deprecat.h" | |
| 15 | 16 | #include "streams.h" |
| 16 | 17 | #include "ay8910.h" |
| 17 | 18 | #include "2610intf.h" |
| r2375 | r2376 | |
| 112 | 113 | } |
| 113 | 114 | |
| 114 | 115 | |
| 115 | static | |
| 116 | static STATE_POSTLOAD( ym2610_postload | |
| 116 | 117 | { |
| 117 | 118 | struct ym2610_info *info = param; |
| 118 | 119 | YM2610Postload(info->chip); |
| r2375 | r2376 | |
| 154 | 155 | pcmbufa,pcmsizea,pcmbufb,pcmsizeb, |
| 155 | 156 | timer_handler,IRQHandler,&psgintf); |
| 156 | 157 | |
| 157 | state_save_register_ | |
| 158 | state_save_register_ | |
| 158 | 159 | |
| 159 | 160 | if (info->chip) |
| 160 | 161 | return info; |
| r2375 | r2376 | |
|---|---|---|
| 70 | 70 | #include <math.h> |
| 71 | 71 | |
| 72 | 72 | #include "sndintrf.h" /* use M.A.M.E. */ |
| 73 | #include "deprecat.h" /* use M.A.M.E. */ | |
| 73 | 74 | |
| 74 | 75 | #include "ymdeltat.h" |
| 75 | 76 | |
| r2375 | r2376 | |
| 1820 | 1821 | } |
| 1821 | 1822 | |
| 1822 | 1823 | |
| 1823 | static | |
| 1824 | static STATE_POSTLOAD( OPL_postload | |
| 1824 | 1825 | { |
| 1825 | 1826 | FM_OPL *OPL = (FM_OPL *)param; |
| 1826 | 1827 | int slot, ch; |
| r2375 | r2376 | |
| 1970 | 1971 | state_save_register_item(statename, index, OPL->statusmask); |
| 1971 | 1972 | state_save_register_item(statename, index, OPL->mode); |
| 1972 | 1973 | |
| 1973 | state_save_register_ | |
| 1974 | state_save_register_ | |
| 1974 | 1975 | } |
| 1975 | 1976 | |
| 1976 | 1977 |
| r2375 | r2376 | |
|---|---|---|
| 12 | 12 | ***************************************************************************/ |
| 13 | 13 | |
| 14 | 14 | #include "sndintrf.h" |
| 15 | #include "deprecat.h" | |
| 15 | 16 | #include "streams.h" |
| 16 | 17 | #include "ay8910.h" |
| 17 | 18 | #include "2608intf.h" |
| r2375 | r2376 | |
| 110 | 111 | } |
| 111 | 112 | |
| 112 | 113 | |
| 113 | static | |
| 114 | static STATE_POSTLOAD( ym2608_postload | |
| 114 | 115 | { |
| 115 | 116 | struct ym2608_info *info = param; |
| 116 | 117 | YM2608Postload(info->chip); |
| r2375 | r2376 | |
| 149 | 150 | pcmbufa,pcmsizea, |
| 150 | 151 | timer_handler,IRQHandler,&psgintf); |
| 151 | 152 | |
| 152 | state_save_register_ | |
| 153 | state_save_register_ | |
| 153 | 154 | |
| 154 | 155 | if (info->chip) |
| 155 | 156 | return info; |
| r2375 | r2376 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | #include "sndintrf.h" |
| 10 | 10 | #include "streams.h" |
| 11 | #include "deprecat.h" | |
| 11 | 12 | #include "fm.h" |
| 12 | 13 | #include "2151intf.h" |
| 13 | 14 | #include "ym2151.h" |
| r2375 | r2376 | |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | 32 | |
| 32 | static | |
| 33 | static STATE_POSTLOAD( ym2151_postload | |
| 33 | 34 | { |
| 34 | 35 | struct ym2151_info *info = param; |
| 35 | YM2151Postload(info->chip); | |
| 36 | YM2151Postload(machine, info->chip); | |
| 36 | 37 | } |
| 37 | 38 | |
| 38 | 39 | |
| r2375 | r2376 | |
| 54 | 55 | |
| 55 | 56 | info->chip = YM2151Init(sndindex,clock,rate); |
| 56 | 57 | |
| 57 | state_save_register_ | |
| 58 | state_save_register_ | |
| 58 | 59 | |
| 59 | 60 | if (info->chip != 0) |
| 60 | 61 | { |
| r2375 | r2376 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | #include <math.h> |
| 31 | 31 | #include "sndintrf.h" |
| 32 | #include "deprecat.h" | |
| 32 | 33 | #include "streams.h" |
| 33 | 34 | #include "multipcm.h" |
| 34 | 35 | |
| r2375 | r2376 | |
| 101 | 102 | |
| 102 | 103 | } MultiPCMT; |
| 103 | 104 | |
| 104 | static | |
| 105 | static STATE_POSTLOAD( MultiPCM_postload | |
| 105 | 106 | { |
| 106 | 107 | MultiPCMT *mpcm = param; |
| 107 | 108 | int j; |
| r2375 | r2376 | |
| 329 | 330 | state_save_register_item(mname, sndindex, mpcm->curvoice); |
| 330 | 331 | } |
| 331 | 332 | |
| 332 | state_save_register_ | |
| 333 | state_save_register_ | |
| 333 | 334 | |
| 334 | 335 | return mpcm; |
| 335 | 336 | } |
| r2375 | r2376 | |
|---|---|---|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | |
| 479 | static | |
| 479 | static STATE_POSTLOAD( VLM5030_restore_state | |
| 480 | 480 | { |
| 481 | 481 | struct vlm5030_info *chip = param; |
| 482 | 482 | int i; |
| r2375 | r2376 | |
| 680 | 680 | state_save_register_item(VLM_NAME,sndindex,chip->target_pitch); |
| 681 | 681 | state_save_register_item_array(VLM_NAME,sndindex,chip->target_k); |
| 682 | 682 | state_save_register_item_array(VLM_NAME,sndindex,chip->x); |
| 683 | state_save_register_ | |
| 683 | state_save_register_ | |
| 684 | 684 | |
| 685 | 685 | return chip; |
| 686 | 686 | } |
| r2375 | r2376 | |
|---|---|---|
| 1 | 1 | #include <math.h> |
| 2 | 2 | #include "sndintrf.h" |
| 3 | #include "deprecat.h" | |
| 3 | 4 | #include "streams.h" |
| 4 | 5 | #include "2203intf.h" |
| 5 | 6 | #include "fm.h" |
| r2375 | r2376 | |
| 97 | 98 | } |
| 98 | 99 | |
| 99 | 100 | |
| 100 | static | |
| 101 | static STATE_POSTLOAD( ym2203_postload | |
| 101 | 102 | { |
| 102 | 103 | struct ym2203_info *info = param; |
| 103 | 104 | YM2203Postload(info->chip); |
| r2375 | r2376 | |
| 128 | 129 | /* Initialize FM emurator */ |
| 129 | 130 | info->chip = YM2203Init(info,sndindex,clock,rate,timer_handler,IRQHandler,&psgintf); |
| 130 | 131 | |
| 131 | state_save_register_ | |
| 132 | state_save_register_ | |
| 132 | 133 | |
| 133 | 134 | if (info->chip) |
| 134 | 135 | return info; |
| r2375 | r2376 | |
|---|---|---|
| 759 | 759 | void input_device_item_add(input_device *device, const char *name, void *internal, input_item_id itemid, item_get_state_func getstate) |
| 760 | 760 | { |
| 761 | 761 | input_device_item *item; |
| 762 | input_item_id itemid_std = itemid; | |
| 762 | 763 | |
| 763 | 764 | assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call input_device_item_add at init time!"); |
| 764 | 765 | assert(name != NULL); |
| r2375 | r2376 | |
| 787 | 788 | item->name = astring_cpyc(auto_astring_alloc(), name); |
| 788 | 789 | item->token = NULL; |
| 789 | 790 | item->internal = internal; |
| 790 | item->itemclass = input_item_standard_class(device->devclass, itemid); | |
| 791 | item->itemclass = input_item_standard_class(device->devclass, itemid_std); | |
| 791 | 792 | item->itemid = itemid; |
| 792 | 793 | item->getstate = getstate; |
| 793 | 794 |
| r2375 | r2376 | |
|---|---|---|
| 51 | 51 | SS_MSB_FIRST = 0x02 |
| 52 | 52 | }; |
| 53 | 53 | |
| 54 | enum | |
| 55 | { | |
| 56 | FUNC_NOPARAM, | |
| 57 | FUNC_INTPARAM, | |
| 58 | FUNC_PTRPARAM | |
| 59 | }; | |
| 60 | 54 | |
| 61 | 55 | |
| 62 | ||
| 63 | 56 | /*************************************************************************** |
| 64 | 57 | TYPE DEFINITIONS |
| 65 | 58 | ***************************************************************************/ |
| r2375 | r2376 | |
| 81 | 74 | struct _ss_func |
| 82 | 75 | { |
| 83 | 76 | ss_func * next; /* pointer to next entry */ |
| 84 | int type; /* type of callback */ | |
| 85 | 77 | union |
| 86 | 78 | { |
| 87 | void (*voidf)(void); | |
| 88 | void (*intf)(int param); | |
| 89 | void (*ptrf)(void *param); | |
| 79 | state_presave_func presave; /* presave callback */ | |
| 80 | state_postload_func postload; /* postload callback */ | |
| 90 | 81 | } func; /* function pointers */ |
| 91 | union | |
| 92 | { | |
| 93 | int intp; | |
| 94 | void *ptrp; | |
| 95 | } param; /* parameters */ | |
| 82 | void * param; /* function parameter */ | |
| 96 | 83 | int tag; /* saving tag */ |
| 97 | 84 | }; |
| 98 | 85 | |
| r2375 | r2376 | |
| 305 | 292 | ***************************************************************************/ |
| 306 | 293 | |
| 307 | 294 | /*------------------------------------------------- |
| 308 | register_func_void - register a function | |
| 309 | callback that takes no parameters | |
| 295 | state_save_register_presave - | |
| 296 | register a pre-save function callback | |
| 310 | 297 | -------------------------------------------------*/ |
| 311 | 298 | |
| 312 | ||
| 299 | ||
| 313 | 300 | { |
| 314 | 301 | ss_func **cur; |
| 315 | 302 | |
| 316 | 303 | /* check for invalid timing */ |
| 317 | 304 | if (!ss_registration_allowed) |
| 318 | { | |
| 319 | logerror("Attempt to register callback function after state registration is closed!"); | |
| 320 | if (Machine->gamedrv->flags & GAME_SUPPORTS_SAVE) | |
| 321 | fatalerror("Attempt to register callback function after state registration is closed!"); | |
| 322 | ss_illegal_regs++; | |
| 323 | return; | |
| 324 | } | |
| 325 | ||
| 326 | /* scan for duplicates and push through to the end */ | |
| 327 | for (cur = root; *cur; cur = &(*cur)->next) | |
| 328 | if ((*cur)->func.voidf == func && (*cur)->tag == ss_current_tag) | |
| 329 | fatalerror("Duplicate save state function (%d, 0x%p)", ss_current_tag, func); | |
| 330 | ||
| 331 | /* allocate a new entry */ | |
| 332 | *cur = malloc_or_die(sizeof(ss_func)); | |
| 333 | ||
| 334 | /* fill it in */ | |
| 335 | (*cur)->next = NULL; | |
| 336 | (*cur)->type = FUNC_NOPARAM; | |
| 337 | (*cur)->func.voidf = func; | |
| 338 | (*cur)->tag = ss_current_tag; | |
| 339 | restrack_register_object(OBJTYPE_STATEREG, *cur, (root == &ss_prefunc_reg) ? 1 : 2, __FILE__, __LINE__); | |
| 340 | } | |
| 341 | ||
| 342 | void state_save_register_func_presave(void (*func)(void)) | |
| 343 | { | |
| 344 | register_func_void(&ss_prefunc_reg, func); | |
| 345 | } | |
| 346 | ||
| 347 | void state_save_register_func_postload(void (*func)(void)) | |
| 348 | { | |
| 349 | register_func_void(&ss_postfunc_reg, func); | |
| 350 | } | |
| 351 | ||
| 352 | ||
| 353 | /*------------------------------------------------- | |
| 354 | register_func_int - register a function | |
| 355 | callback that takes an integer parameter | |
| 356 | -------------------------------------------------*/ | |
| 357 | ||
| 358 | static void register_func_int(ss_func **root, void (*func)(int), int param) | |
| 359 | { | |
| 360 | ss_func **cur; | |
| 361 | ||
| 362 | /* check for invalid timing */ | |
| 363 | if (!ss_registration_allowed) | |
| 364 | 305 | fatalerror("Attempt to register callback function after state registration is closed!"); |
| 365 | 306 | |
| 366 | 307 | /* scan for duplicates and push through to the end */ |
| 367 | for (cur = root; *cur; cur = &(*cur)->next) | |
| 368 | if ((*cur)->func.intf == func && (*cur)->param.intp == param && (*cur)->tag == ss_current_tag) | |
| 369 | fatalerror("Duplicate save state function (%d, %d, %p)", ss_current_tag, param, func); | |
| 308 | for (cur = &ss_prefunc_reg; *cur; cur = &(*cur)->next) | |
| 309 | if ((*cur)->func.presave == func && (*cur)->param == param && (*cur)->tag == ss_current_tag) | |
| 310 | fatalerror("Duplicate save state function (%d, %p, %p)", ss_current_tag, param, func); | |
| 370 | 311 | |
| 371 | 312 | /* allocate a new entry */ |
| 372 | 313 | *cur = malloc_or_die(sizeof(ss_func)); |
| 373 | 314 | |
| 374 | 315 | /* fill it in */ |
| 375 | (*cur)->next = NULL; | |
| 376 | (*cur)->type = FUNC_INTPARAM; | |
| 377 | (*cur)->func.intf = func; | |
| 378 | (*cur)->param.intp = param; | |
| 379 | (*cur)->tag = ss_current_tag; | |
| 380 | restrack_register_object(OBJTYPE_STATEREG, *cur, (root == &ss_prefunc_reg) ? 1 : 2, __FILE__, __LINE__); | |
| 316 | (*cur)->next = NULL; | |
| 317 | (*cur)->func.presave = func; | |
| 318 | (*cur)->param = param; | |
| 319 | (*cur)->tag = ss_current_tag; | |
| 320 | restrack_register_object(OBJTYPE_STATEREG, *cur, 1, __FILE__, __LINE__); | |
| 381 | 321 | } |
| 382 | 322 | |
| 383 | void state_save_register_func_presave_int(void (*func)(int), int param) | |
| 384 | { | |
| 385 | register_func_int(&ss_prefunc_reg, func, param); | |
| 386 | } | |
| 387 | 323 | |
| 388 | void state_save_register_func_postload_int(void (*func)(int), int param) | |
| 389 | { | |
| 390 | register_func_int(&ss_postfunc_reg, func, param); | |
| 391 | } | |
| 392 | ||
| 393 | ||
| 394 | 324 | /*------------------------------------------------- |
| 395 | register_func_ptr - register a function | |
| 396 | callback that takes a void * parameter | |
| 325 | state_save_register_postload - | |
| 326 | register a post-load function callback | |
| 397 | 327 | -------------------------------------------------*/ |
| 398 | 328 | |
| 399 | ||
| 329 | ||
| 400 | 330 | { |
| 401 | 331 | ss_func **cur; |
| 402 | 332 | |
| r2375 | r2376 | |
| 405 | 335 | fatalerror("Attempt to register callback function after state registration is closed!"); |
| 406 | 336 | |
| 407 | 337 | /* scan for duplicates and push through to the end */ |
| 408 | for (cur = root; *cur; cur = &(*cur)->next) | |
| 409 | if ((*cur)->func.ptrf == func && (*cur)->param.ptrp == param && (*cur)->tag == ss_current_tag) | |
| 338 | for (cur = &ss_postfunc_reg; *cur; cur = &(*cur)->next) | |
| 339 | if ((*cur)->func.postload == func && (*cur)->param == param && (*cur)->tag == ss_current_tag) | |
| 410 | 340 | fatalerror("Duplicate save state function (%d, %p, %p)", ss_current_tag, param, func); |
| 411 | 341 | |
| 412 | 342 | /* allocate a new entry */ |
| 413 | 343 | *cur = malloc_or_die(sizeof(ss_func)); |
| 414 | 344 | |
| 415 | 345 | /* fill it in */ |
| 416 | (*cur)->next = NULL; | |
| 417 | (*cur)->type = FUNC_PTRPARAM; | |
| 418 | (*cur)->func.ptrf = func; | |
| 419 | (*cur)->param.ptrp = param; | |
| 420 | (*cur)->tag = ss_current_tag; | |
| 421 | restrack_register_object(OBJTYPE_STATEREG, *cur, (root == &ss_prefunc_reg) ? 1 : 2, __FILE__, __LINE__); | |
| 346 | (*cur)->next = NULL; | |
| 347 | (*cur)->func.postload = func; | |
| 348 | (*cur)->param = param; | |
| 349 | (*cur)->tag = ss_current_tag; | |
| 350 | restrack_register_object(OBJTYPE_STATEREG, *cur, 2, __FILE__, __LINE__); | |
| 422 | 351 | } |
| 423 | 352 | |
| 424 | void state_save_register_func_presave_ptr(void (*func)(void *), void * param) | |
| 425 | { | |
| 426 | register_func_ptr(&ss_prefunc_reg, func, param); | |
| 427 | } | |
| 428 | 353 | |
| 429 | void state_save_register_func_postload_ptr(void (*func)(void *), void * param) | |
| 430 | { | |
| 431 | register_func_ptr(&ss_postfunc_reg, func, param); | |
| 432 | } | |
| 433 | 354 | |
| 434 | ||
| 435 | ||
| 436 | 355 | /*************************************************************************** |
| 437 | 356 | REGISTRATION FREEING |
| 438 | 357 | ***************************************************************************/ |
| r2375 | r2376 | |
| 594 | 513 | |
| 595 | 514 | |
| 596 | 515 | /*------------------------------------------------- |
| 597 | call_hook_functions - loop through all the | |
| 598 | hook functions and call them | |
| 599 | -------------------------------------------------*/ | |
| 600 | ||
| 601 | static int call_hook_functions(ss_func *funclist) | |
| 602 | { | |
| 603 | ss_func *func; | |
| 604 | int count = 0; | |
| 605 | ||
| 606 | /* iterate over the list of functions */ | |
| 607 | for (func = funclist; func; func = func->next) | |
| 608 | if (func->tag == ss_current_tag) | |
| 609 | { | |
| 610 | count++; | |
| 611 | ||
| 612 | /* call with the appropriate parameters */ | |
| 613 | switch (func->type) | |
| 614 | { | |
| 615 | case FUNC_NOPARAM: (func->func.voidf)(); break; | |
| 616 | case FUNC_INTPARAM: (func->func.intf)(func->param.intp); break; | |
| 617 | case FUNC_PTRPARAM: (func->func.ptrf)(func->param.ptrp); break; | |
| 618 | } | |
| 619 | } | |
| 620 | ||
| 621 | return count; | |
| 622 | } | |
| 623 | ||
| 624 | ||
| 625 | /*------------------------------------------------- | |
| 626 | 516 | get_signature - compute the signature, which |
| 627 | 517 | is a CRC over the structure of the data |
| 628 | 518 | -------------------------------------------------*/ |
| r2375 | r2376 | |
| 768 | 658 | void state_save_save_continue(void) |
| 769 | 659 | { |
| 770 | 660 | ss_entry *entry; |
| 771 | int count; | |
| 661 | ss_func *func; | |
| 662 | int count = 0; | |
| 772 | 663 | |
| 773 | 664 | LOG(("Saving tag %d\n", ss_current_tag)); |
| 774 | 665 | |
| 775 | 666 | /* call the pre-save functions */ |
| 776 | 667 | LOG((" calling pre-save functions\n")); |
| 777 | count = call_hook_functions(ss_prefunc_reg); | |
| 668 | ||
| 669 | /* iterate over the list of functions */ | |
| 670 | for (func = ss_prefunc_reg; func; func = func->next) | |
| 671 | if (func->tag == ss_current_tag) | |
| 672 | { | |
| 673 | count++; | |
| 674 | (*func->func.presave)(Machine, func->param); | |
| 675 | } | |
| 778 | 676 | LOG((" %d functions called\n", count)); |
| 779 | 677 | |
| 780 | 678 | /* then copy in all the data */ |
| r2375 | r2376 | |
| 873 | 771 | void state_save_load_continue(void) |
| 874 | 772 | { |
| 875 | 773 | ss_entry *entry; |
| 774 | ss_func *func; | |
| 876 | 775 | int need_convert; |
| 877 | int count; | |
| 776 | int count = 0; | |
| 878 | 777 | |
| 879 | 778 | /* first determine whether or not we need to convert the endianness of the data */ |
| 880 | 779 | #ifdef LSB_FIRST |
| r2375 | r2376 | |
| 898 | 797 | |
| 899 | 798 | /* call the post-load functions */ |
| 900 | 799 | LOG((" calling post-load functions\n")); |
| 901 | count = call_hook_functions(ss_postfunc_reg); | |
| 800 | for (func = ss_postfunc_reg; func; func = func->next) | |
| 801 | if (func->tag == ss_current_tag) | |
| 802 | { | |
| 803 | count++; | |
| 804 | (*func->func.postload)(Machine, func->param); | |
| 805 | } | |
| 902 | 806 | LOG((" %d functions called\n", count)); |
| 903 | 807 | } |
| 904 | 808 |
| r2375 | r2376 | |
|---|---|---|
| 104 | 104 | FUNCTION PROTOTYPES |
| 105 | 105 | ***************************************************************************/ |
| 106 | 106 | |
| 107 | static | |
| 107 | static STATE_POSTLOAD( timer_postload | |
| 108 | 108 | static void timer_logtimers(void); |
| 109 | 109 | static void timer_remove(emu_timer *which); |
| 110 | 110 | |
| r2375 | r2376 | |
| 280 | 280 | state_save_push_tag(0); |
| 281 | 281 | state_save_register_item("timer", 0, global_basetime.seconds); |
| 282 | 282 | state_save_register_item("timer", 0, global_basetime.attoseconds); |
| 283 | state_save_register_ | |
| 283 | state_save_register_ | |
| 284 | 284 | state_save_pop_tag(); |
| 285 | 285 | |
| 286 | 286 | /* reset the timers */ |
| r2375 | r2376 | |
| 427 | 427 | timer_postload - after loading a save state |
| 428 | 428 | -------------------------------------------------*/ |
| 429 | 429 | |
| 430 | static | |
| 430 | static STATE_POSTLOAD( timer_postload | |
| 431 | 431 | { |
| 432 | 432 | emu_timer *privlist = NULL; |
| 433 | 433 | emu_timer *t; |
| r2375 | r2376 | |
|---|---|---|
| 75 | 75 | FUNCTION PROTOTYPES |
| 76 | 76 | ***************************************************************************/ |
| 77 | 77 | |
| 78 | static void palette_presave(void); | |
| 79 | static void palette_postload(void); | |
| 78 | static void palette_presave(running_machine *machine, void *param); | |
| 79 | static void palette_postload(running_machine *machine, void *param); | |
| 80 | 80 | static void palette_exit(running_machine *machine); |
| 81 | 81 | static void allocate_palette(running_machine *machine, palette_private *palette); |
| 82 | 82 | static void allocate_color_tables(running_machine *machine, palette_private *palette); |
| r2375 | r2376 | |
| 151 | 151 | palette->save_bright = auto_malloc(sizeof(*palette->save_bright) * numcolors); |
| 152 | 152 | state_save_register_global_pointer(palette->save_pen, numcolors); |
| 153 | 153 | state_save_register_global_pointer(palette->save_bright, numcolors); |
| 154 | state_save_register_func_presave(palette_presave); | |
| 155 | state_save_register_func_postload(palette_postload); | |
| 154 | state_save_register_presave(machine, palette_presave, palette); | |
| 155 | state_save_register_postload(machine, palette_postload, palette); | |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
| r2375 | r2376 | |
| 534 | 534 | for saving |
| 535 | 535 | -------------------------------------------------*/ |
| 536 | 536 | |
| 537 | static void palette_presave(void) | |
| 537 | static void palette_presave(running_machine *machine, void *param) | |
| 538 | 538 | { |
| 539 | int numcolors = palette_get_num_colors(Machine->palette); | |
| 540 | palette_private *palette = Machine->palette_data; | |
| 539 | int numcolors = palette_get_num_colors(machine->palette); | |
| 540 | palette_private *palette = param; | |
| 541 | 541 | int index; |
| 542 | 542 | |
| 543 | 543 | /* fill the save arrays with updated pen and brightness information */ |
| 544 | 544 | for (index = 0; index < numcolors; index++) |
| 545 | 545 | { |
| 546 | palette->save_pen[index] = palette_entry_get_color(Machine->palette, index); | |
| 547 | palette->save_bright[index] = palette_entry_get_contrast(Machine->palette, index); | |
| 546 | palette->save_pen[index] = palette_entry_get_color(machine->palette, index); | |
| 547 | palette->save_bright[index] = palette_entry_get_contrast(machine->palette, index); | |
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | |
| r2375 | r2376 | |
| 554 | 554 | actually update the palette |
| 555 | 555 | -------------------------------------------------*/ |
| 556 | 556 | |
| 557 | static void palette_postload(void) | |
| 557 | static void palette_postload(running_machine *machine, void *param) | |
| 558 | 558 | { |
| 559 | int numcolors = palette_get_num_colors(Machine->palette); | |
| 560 | palette_private *palette = Machine->palette_data; | |
| 559 | int numcolors = palette_get_num_colors(machine->palette); | |
| 560 | palette_private *palette = param; | |
| 561 | 561 | int index; |
| 562 | 562 | |
| 563 | 563 | /* reset the pen and brightness for each entry */ |
| 564 | 564 | for (index = 0; index < numcolors; index++) |
| 565 | 565 | { |
| 566 | palette_entry_set_color(Machine->palette, index, palette->save_pen[index]); | |
| 567 | palette_entry_set_contrast(Machine->palette, index, palette->save_bright[index]); | |
| 566 | palette_entry_set_color(machine->palette, index, palette->save_pen[index]); | |
| 567 | palette_entry_set_contrast(machine->palette, index, palette->save_bright[index]); | |
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 |
| r2375 | r2376 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | /*************************************************************************** |
| 22 | TYPE DEFINTIONS | |
| 23 | ***************************************************************************/ | |
| 24 | ||
| 25 | typedef void (*state_presave_func)(running_machine *machine, void *param); | |
| 26 | typedef void (*state_postload_func)(running_machine *machine, void *param); | |
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | /*************************************************************************** | |
| 22 | 31 | MACROS |
| 23 | 32 | ***************************************************************************/ |
| 24 | 33 | |
| 34 | #define STATE_PRESAVE(name) void name(running_machine *machine, void *param) | |
| 35 | #define STATE_POSTLOAD(name) void name(running_machine *machine, void *param) | |
| 36 | ||
| 37 | ||
| 25 | 38 | #define IS_COMPATIBLE_TYPE(_valtype, _checktype) \ |
| 26 | 39 | (sizeof(_valtype) == sizeof(_checktype) && TYPES_COMPATIBLE(typeof(_valtype), _checktype)) |
| 27 | 40 | |
| r2375 | r2376 | |
| 88 | 101 | void state_save_register_memory(const char *module, UINT32 instance, const char *name, void *val, UINT32 valsize, UINT32 valcount); |
| 89 | 102 | void state_save_register_bitmap(const char *module, UINT32 instance, const char *name, bitmap_t *val); |
| 90 | 103 | |
| 91 | void state_save_register_func_presave(void (*func)(void)); | |
| 92 | void state_save_register_func_postload(void (*func)(void)); | |
| 104 | void state_save_register_presave(running_machine *machine, state_presave_func func, void *param); | |
| 105 | void state_save_register_postload(running_machine *machine, state_postload_func func, void *param); | |
| 93 | 106 | |
| 94 | void state_save_register_func_presave_int(void (*func)(int), int param); | |
| 95 | void state_save_register_func_postload_int(void (*func)(int), int param); | |
| 96 | ||
| 97 | void state_save_register_func_presave_ptr(void (*func)(void *), void *param); | |
| 98 | void state_save_register_func_postload_ptr(void (*func)(void *), void *param); | |
| 99 | ||
| 100 | 107 | /* Save and load functions */ |
| 101 | 108 | /* The tags are a hack around the current cpu structures */ |
| 102 | 109 | int state_save_save_begin(mame_file *file); |
| r2375 | r2376 | |
|---|---|---|
| 229 | 229 | |
| 230 | 230 | #define MDRV_DEVICE_CONFIG_DATAFP32(_struct, _field, _val, _fixbits) \ |
| 231 | 231 | TOKEN_UINT32_PACK4(MCONFIG_TOKEN_DEVICE_CONFIG_DATAFP32, 8, sizeof(((_struct *)NULL)->_field), 6, _fixbits, 6, offsetof(_struct, _field), 12), \ |
| 232 | TOKEN_UINT32(( | |
| 232 | TOKEN_UINT32(( | |
| 233 | 233 | |
| 234 | 234 | #define MDRV_DEVICE_CONFIG_DATAFP64(_struct, _field, _val, _fixbits) \ |
| 235 | 235 | TOKEN_UINT32_PACK4(MCONFIG_TOKEN_DEVICE_CONFIG_DATAFP64, 8, sizeof(((_struct *)NULL)->_field), 6, _fixbits, 6, offsetof(_struct, _field), 12), \ |
| 236 | TOKEN_UINT64(( | |
| 236 | TOKEN_UINT64(( | |
| 237 | 237 | |
| 238 | 238 | #ifdef PTR64 |
| 239 | 239 | #define MDRV_DEVICE_CONFIG_DATAPTR(_struct, _field, _val) MDRV_DEVICE_CONFIG_DATA64(_struct, _field, _val) |
| r2375 | r2376 | |
|---|---|---|
| 92 | 92 | XTAL_17_73447MHz = 17734470, /* 4 times the PAL subcarrier */ |
| 93 | 93 | XTAL_18MHz = 18000000, /* S.A.R, Ikari Warriors 3 */ |
| 94 | 94 | XTAL_18_432MHz = 18432000, /* Extremely common, used on 100's of PCBs */ |
| 95 | XTAL_19_6608MHz = 19660800, /* Euro League (bootleg), labeled as "UKI 19.6608 20PF" */ | |
| 95 | 96 | XTAL_19_923MHz = 19923000, /* Cinematronics vectors */ |
| 96 | 97 | XTAL_19_968MHz = 19968000, /* Used mostly by some Taito games */ |
| 97 | 98 | XTAL_20MHz = 20000000, |
| r2375 | r2376 | |
|---|---|---|
| 515 | 515 | case '<' : d += sprintf(d, "<"); break; |
| 516 | 516 | case '>' : d += sprintf(d, ">"); break; |
| 517 | 517 | default: |
| 518 | if (*string >= ' ' && *string <= '~') | |
| 519 | *d++ = *string; | |
| 520 | else | |
| 521 | d += sprintf(d, "&#%d;", (unsigned)(unsigned char)*string); | |
| 518 | *d++ = *string; | |
| 522 | 519 | } |
| 523 | 520 | ++string; |
| 524 | 521 | } |
| r2375 | r2376 | |
|---|---|---|
| 379 | 379 | |
| 380 | 380 | static rtc_type_t real_time_clock(void) |
| 381 | 381 | { |
| 382 | return (rtc_type_t) (int) | |
| 382 | return (rtc_type_t) (int) | |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 |
| r2375 | r2376 | |
|---|---|---|
| 1716 | 1716 | if ( offset == 8 ) |
| 1717 | 1717 | { |
| 1718 | 1718 | /* network ID of the computer */ |
| 1719 | UINT8 id = | |
| 1719 | UINT8 id = | |
| 1720 | 1720 | VLOG(( "%f $%04x to7_network_r: read id $%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), id )); |
| 1721 | 1721 | return id; |
| 1722 | 1722 | } |
| r2375 | r2376 | |
| 1774 | 1774 | |
| 1775 | 1775 | void to7_floppy_reset ( running_machine *machine ) |
| 1776 | 1776 | { |
| 1777 | to7_controller_type = ( | |
| 1777 | to7_controller_type = ( | |
| 1778 | 1778 | |
| 1779 | 1779 | switch ( to7_controller_type ) |
| 1780 | 1780 | { |
| r2375 | r2376 | |
|---|---|---|
| 1307 | 1307 | dst = ((UINT16)(HDMA3 & 0x1F) << 8) | (HDMA4 & 0xF0); |
| 1308 | 1308 | dst |= 0x8000; |
| 1309 | 1309 | while( length > 0 ) { |
| 1310 | program_write_byte | |
| 1310 | program_write_byte | |
| 1311 | 1311 | length--; |
| 1312 | 1312 | } |
| 1313 | 1313 | HDMA1 = src >> 8; |
| r2375 | r2376 | |
| 1942 | 1942 | UINT8 *P = gb_oam; |
| 1943 | 1943 | offset = (UINT16) data << 8; |
| 1944 | 1944 | for (data = 0; data < 0xA0; data++) |
| 1945 | *P++ = program_read_byte | |
| 1945 | *P++ = program_read_byte | |
| 1946 | 1946 | } |
| 1947 | 1947 | return; |
| 1948 | 1948 | case 0x07: /* BGP - Background Palette */ |
| r2375 | r2376 | |
|---|---|---|
| 1804 | 1804 | |
| 1805 | 1805 | |
| 1806 | 1806 | |
| 1807 | static STATE_POSTLOAD( m6847_postload ) | |
| 1808 | { | |
| 1809 | set_field_sync(); | |
| 1810 | set_horizontal_sync(); | |
| 1811 | set_dirty(); | |
| 1812 | } | |
| 1813 | ||
| 1814 | ||
| 1815 | ||
| 1807 | 1816 | void m6847_init(running_machine *machine, const m6847_config *cfg) |
| 1808 | 1817 | { |
| 1809 | 1818 | const m6847_variant *v; |
| r2375 | r2376 | |
| 1890 | 1899 | timer_adjust_periodic(m6847->fs_rise_timer, attotime_zero, 0, attotime_make(0, frame_period)); |
| 1891 | 1900 | |
| 1892 | 1901 | /* setup save states */ |
| 1893 | state_save_register_func_postload(set_field_sync); | |
| 1894 | state_save_register_func_postload(set_horizontal_sync); | |
| 1895 | state_save_register_func_postload(set_dirty); | |
| 1902 | state_save_register_postload(machine, m6847_postload, NULL); | |
| 1896 | 1903 | |
| 1897 | 1904 | /* build font */ |
| 1898 | 1905 | build_fontdata(v); |
| r2375 | r2376 | |
|---|---|---|
| 30 | 30 | |
| 31 | 31 | /**************************************************************************/ |
| 32 | 32 | |
| 33 | static | |
| 33 | static STATE_POSTLOAD( pc_video_postload | |
| 34 | 34 | { |
| 35 | 35 | pc_anythingdirty = 1; |
| 36 | 36 | pc_current_height = -1; |
| r2375 | r2376 | |
| 64 | 64 | video_start_generic_bitmapped(machine); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | state_save_register_ | |
| 67 | state_save_register_ | |
| 68 | 68 | return pc_crtc; |
| 69 | 69 | } |
| 70 | 70 |
| r2375 | r2376 | |
|---|---|---|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | /* fetch data */ |
| 301 | c = RAM ? RAM[read_addr] : program_read_byte | |
| 301 | c = RAM ? RAM[read_addr] : program_read_byte | |
| 302 | 302 | |
| 303 | 303 | /* if bits 6 and 5 are zero, the byte contains a serial attribute */ |
| 304 | 304 | if ((c & ((1<<6) | (1<<5)))==0) |
| r2375 | r2376 | |
|---|---|---|
| 784 | 784 | |
| 785 | 785 | |
| 786 | 786 | |
| 787 | static STATE_POSTLOAD( coco3_video_postload ) | |
| 788 | { | |
| 789 | coco3_set_dirty(); | |
| 790 | } | |
| 791 | ||
| 792 | ||
| 793 | ||
| 787 | 794 | static void internal_video_start_coco3(running_machine *machine, m6847_type type) |
| 788 | 795 | { |
| 789 | 796 | int i; |
| r2375 | r2376 | |
| 840 | 847 | state_save_register_global(video->legacy_video); |
| 841 | 848 | state_save_register_global(video->top_border_scanlines); |
| 842 | 849 | state_save_register_global(video->display_scanlines); |
| 843 | state_save_register_ | |
| 850 | state_save_register_ | |
| 844 | 851 | } |
| 845 | 852 | |
| 846 | 853 |
| r2375 | r2376 | |
|---|---|---|
| 923 | 923 | |
| 924 | 924 | |
| 925 | 925 | |
| 926 | void inputx_update( | |
| 926 | void inputx_update(running_machine *machine) | |
| 927 | 927 | { |
| 928 | 928 | const key_buffer *keybuf; |
| 929 | 929 | const mess_input_code *code; |
| r2375 | r2376 | |
| 948 | 948 | for (i = 0; i < ARRAY_LENGTH(code->ipt) && code->ipt[i]; i++) |
| 949 | 949 | { |
| 950 | 950 | value = code->ipt[i]->mask; |
| 951 | input_port_set_digital_value(code->port[i], value, value); | |
| 951 | input_port_set_digital_value(machine, code->port[i], value, value); | |
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | 954 | } |
| r2375 | r2376 | |
|---|---|---|
| 61 | 61 | |
| 62 | 62 | /* these are called by the core; they should not be called from FEs */ |
| 63 | 63 | void inputx_init(running_machine *machine); |
| 64 | void inputx_update( | |
| 64 | void inputx_update(running_machine *machine); | |
| 65 | 65 | void inputx_handle_mess_extensions(input_port_entry *ipt); |
| 66 | 66 | |
| 67 | 67 | /* called by drivers to setup natural keyboard support */ |
| r2375 | r2376 | |
|---|---|---|
| 669 | 669 | dst = ws_portram[0x44] + (ws_portram[0x45] << 8) + (ws_portram[0x43] << 16); |
| 670 | 670 | length = ws_portram[0x46] + (ws_portram[0x47] << 8); |
| 671 | 671 | for( ; length > 0; length-- ) { |
| 672 | program_write_byte | |
| 672 | program_write_byte | |
| 673 | 673 | src++; |
| 674 | 674 | dst++; |
| 675 | 675 | } |
| r2375 | r2376 | |
| 1375 | 1375 | /* Handle Sound DMA */ |
| 1376 | 1376 | if ( ( sound_dma.enable & 0x88 ) == 0x80 ) { |
| 1377 | 1377 | /* TODO: Output sound DMA byte */ |
| 1378 | wswan_port_w( machine, 0x89, program_read_byte | |
| 1378 | wswan_port_w( machine, 0x89, program_read_byte | |
| 1379 | 1379 | sound_dma.size--; |
| 1380 | 1380 | sound_dma.source = ( sound_dma.source + 1 ) & 0x0FFFFF; |
| 1381 | 1381 | if ( sound_dma.size == 0 ) { |
| r2375 | r2376 | |
|---|---|---|
| 160 | 160 | { |
| 161 | 161 | int config; |
| 162 | 162 | |
| 163 | config = | |
| 163 | config = | |
| 164 | 164 | pdp1_reset_param.extend_support = (config >> pdp1_config_extend_bit) & pdp1_config_extend_mask; |
| 165 | 165 | pdp1_reset_param.hw_mul_div = (config >> pdp1_config_hw_mul_div_bit) & pdp1_config_hw_mul_div_mask; |
| 166 | 166 | pdp1_reset_param.type_20_sbs = (config >> pdp1_config_type_20_sbs_bit) & pdp1_config_type_20_sbs_mask; |
| r2375 | r2376 | |
| 1175 | 1175 | */ |
| 1176 | 1176 | void iot_011(int op2, int nac, int mb, int *io, int ac) |
| 1177 | 1177 | { |
| 1178 | int key_state = | |
| 1178 | int key_state = | |
| 1179 | 1179 | int reply; |
| 1180 | 1180 | |
| 1181 | 1181 | |
| r2375 | r2376 | |
| 1260 | 1260 | |
| 1261 | 1261 | |
| 1262 | 1262 | for (i=0; i<4; i++) |
| 1263 | typewriter_keys[i] = | |
| 1263 | typewriter_keys[i] = | |
| 1264 | 1264 | |
| 1265 | 1265 | for (i=0; i<4; i++) |
| 1266 | 1266 | { |
| r2375 | r2376 | |
| 1286 | 1286 | |
| 1287 | 1287 | static void pdp1_lightpen(void) |
| 1288 | 1288 | { |
| 1289 | running_machine *machine = Machine; | |
| 1289 | 1290 | int x_delta, y_delta; |
| 1290 | 1291 | int current_state; |
| 1291 | 1292 | static int previous_state; |
| 1292 | 1293 | |
| 1293 | lightpen.active = ( | |
| 1294 | lightpen.active = ( | |
| 1294 | 1295 | |
| 1295 | current_state = | |
| 1296 | current_state = | |
| 1296 | 1297 | |
| 1297 | 1298 | /* update pen down state */ |
| 1298 | 1299 | lightpen.down = lightpen.active && (current_state & pdp1_lightpen_down); |
| r2375 | r2376 | |
| 1314 | 1315 | previous_state = current_state; |
| 1315 | 1316 | |
| 1316 | 1317 | /* update pen position */ |
| 1317 | x_delta = readinputport(pdp1_lightpen_x); | |
| 1318 | y_delta = readinputport(pdp1_lightpen_y); | |
| 1318 | x_delta = input_port_read_indexed(machine, pdp1_lightpen_x); | |
| 1319 | y_delta = input_port_read_indexed(machine, pdp1_lightpen_y); | |
| 1319 | 1320 | |
| 1320 | 1321 | if (x_delta >= 0x80) |
| 1321 | 1322 | x_delta -= 0x100; |
| r2375 | r2376 | |
| 1355 | 1356 | int ta_transitions; |
| 1356 | 1357 | |
| 1357 | 1358 | |
| 1358 | cpunum_set_reg(0, PDP1_SS, | |
| 1359 | cpunum_set_reg(0, PDP1_SS, | |
| 1359 | 1360 | |
| 1360 | 1361 | /* read new state of control keys */ |
| 1361 | control_keys = | |
| 1362 | control_keys = | |
| 1362 | 1363 | |
| 1363 | 1364 | if (control_keys & pdp1_control) |
| 1364 | 1365 | { |
| r2375 | r2376 | |
| 1450 | 1451 | |
| 1451 | 1452 | |
| 1452 | 1453 | /* handle test word keys */ |
| 1453 | tw_keys = ( | |
| 1454 | tw_keys = ( | |
| 1454 | 1455 | |
| 1455 | 1456 | /* compute transitions */ |
| 1456 | 1457 | tw_transitions = tw_keys & (~ old_tw_keys); |
| r2375 | r2376 | |
| 1463 | 1464 | |
| 1464 | 1465 | |
| 1465 | 1466 | /* handle address keys */ |
| 1466 | ta_keys = | |
| 1467 | ta_keys = | |
| 1467 | 1468 | |
| 1468 | 1469 | /* compute transitions */ |
| 1469 | 1470 | ta_transitions = ta_keys & (~ old_ta_keys); |
| r2375 | r2376 | |
|---|---|---|
| 1334 | 1334 | |
| 1335 | 1335 | |
| 1336 | 1336 | |
| 1337 | static | |
| 1337 | static STATE_POSTLOAD( mac_state_load | |
| 1338 | 1338 | { |
| 1339 | 1339 | int overlay = mac_overlay; |
| 1340 | 1340 | mac_overlay = -1; |
| r2375 | r2376 | |
| 1370 | 1370 | |
| 1371 | 1371 | /* save state stuff */ |
| 1372 | 1372 | state_save_register_global(mac_overlay); |
| 1373 | state_save_register_ | |
| 1373 | state_save_register_ | |
| 1374 | 1374 | } |
| 1375 | 1375 | |
| 1376 | 1376 |
| r2375 | r2376 | |
|---|---|---|
| 687 | 687 | UINT8 tile = pokemini_ram[ 0x360 + ( y * vdp.map_size_x ) + x ]; |
| 688 | 688 | int i; |
| 689 | 689 | for( i = 0; i < 8; i++ ) { |
| 690 | pokemini_ram[ ( y * 96 ) + ( x * 8 ) + i ] = program_read_byte | |
| 690 | pokemini_ram[ ( y * 96 ) + ( x * 8 ) + i ] = program_read_byte | |
| 691 | 691 | } |
| 692 | 692 | } |
| 693 | 693 | } |
| r2375 | r2376 | |
|---|---|---|
| 965 | 965 | { |
| 966 | 966 | coco_input_device result = INPUTDEVICE_NA; |
| 967 | 967 | |
| 968 | switch( | |
| 968 | switch( | |
| 969 | 969 | { |
| 970 | 970 | case 0x00: |
| 971 | 971 | /* "Normal" */ |
| r2375 | r2376 | |
| 1041 | 1041 | { |
| 1042 | 1042 | double val; |
| 1043 | 1043 | |
| 1044 | val = | |
| 1044 | val = | |
| 1045 | 1045 | |
| 1046 | 1046 | if (get_input_device(INPUTPORT_RIGHT_JOYSTICK) == INPUTDEVICE_HIRES_CC3MAX_INTERFACE) |
| 1047 | 1047 | { |
| r2375 | r2376 | |
| 1292 | 1292 | joystick = mux_sel2; |
| 1293 | 1293 | |
| 1294 | 1294 | /* poll keyoard keys */ |
| 1295 | if ((readinputport(0) | pia0_pb) != 0xff) porta &= ~0x01; | |
| 1296 | if ((readinputport(1) | pia0_pb) != 0xff) porta &= ~0x02; | |
| 1297 | if ((readinputport(2) | pia0_pb) != 0xff) porta &= ~0x04; | |
| 1298 | if ((readinputport(3) | pia0_pb) != 0xff) porta &= ~0x08; | |
| 1299 | if ((readinputport(4) | pia0_pb) != 0xff) porta &= ~0x10; | |
| 1300 | if ((readinputport(5) | pia0_pb) != 0xff) porta &= ~0x20; | |
| 1301 | if ((readinputport(6) | pia0_pb) != 0xff) porta &= ~0x40; | |
| 1295 | if ((input_port_read_indexed(machine, 0) | pia0_pb) != 0xff) porta &= ~0x01; | |
| 1296 | if ((input_port_read_indexed(machine, 1) | pia0_pb) != 0xff) porta &= ~0x02; | |
| 1297 | if ((input_port_read_indexed(machine, 2) | pia0_pb) != 0xff) porta &= ~0x04; | |
| 1298 | if ((input_port_read_indexed(machine, 3) | pia0_pb) != 0xff) porta &= ~0x08; | |
| 1299 | if ((input_port_read_indexed(machine, 4) | pia0_pb) != 0xff) porta &= ~0x10; | |
| 1300 | if ((input_port_read_indexed(machine, 5) | pia0_pb) != 0xff) porta &= ~0x20; | |
| 1301 | if ((input_port_read_indexed(machine, 6) | pia0_pb) != 0xff) porta &= ~0x40; | |
| 1302 | 1302 | |
| 1303 | if ((readinputport(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x01; | |
| 1304 | if ((readinputport(1) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x02; | |
| 1305 | if ((readinputport(2) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x04; | |
| 1306 | if ((readinputport(3) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x08; | |
| 1307 | if ((readinputport(4) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x10; | |
| 1308 | if ((readinputport(5) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x20; | |
| 1309 | if ((readinputport(6) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x40; | |
| 1303 | if ((input_port_read_indexed(machine, 0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x01; | |
| 1304 | if ((input_port_read_indexed(machine, 1) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x02; | |
| 1305 | if ((input_port_read_indexed(machine, 2) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x04; | |
| 1306 | if ((input_port_read_indexed(machine, 3) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x08; | |
| 1307 | if ((input_port_read_indexed(machine, 4) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x10; | |
| 1308 | if ((input_port_read_indexed(machine, 5) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x20; | |
| 1309 | if ((input_port_read_indexed(machine, 6) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x40; | |
| 1310 | 1310 | |
| 1311 | 1311 | switch(get_input_device(joystick ? INPUTPORT_LEFT_JOYSTICK : INPUTPORT_RIGHT_JOYSTICK)) |
| 1312 | 1312 | { |
| 1313 | 1313 | case INPUTDEVICE_RIGHT_JOYSTICK: |
| 1314 | joyval = | |
| 1314 | joyval = | |
| 1315 | 1315 | if (dac <= joyval) |
| 1316 | 1316 | porta |= 0x80; |
| 1317 | 1317 | break; |
| 1318 | 1318 | |
| 1319 | 1319 | case INPUTDEVICE_LEFT_JOYSTICK: |
| 1320 | joyval = | |
| 1320 | joyval = | |
| 1321 | 1321 | if (dac <= joyval) |
| 1322 | 1322 | porta |= 0x80; |
| 1323 | 1323 | break; |
| r2375 | r2376 | |
| 1329 | 1329 | break; |
| 1330 | 1330 | |
| 1331 | 1331 | case INPUTDEVICE_RAT: |
| 1332 | joyval = | |
| 1332 | joyval = | |
| 1333 | 1333 | if ((dac >> 2) <= joy_rat_table[joyval]) |
| 1334 | 1334 | porta |= 0x80; |
| 1335 | 1335 | break; |
| 1336 | 1336 | |
| 1337 | 1337 | case INPUTDEVICE_DIECOM_LIGHTGUN: |
| 1338 | if( (video_screen_get_vpos(machine->primary_screen) == | |
| 1338 | if( (video_screen_get_vpos(machine->primary_screen) == | |
| 1339 | 1339 | { |
| 1340 | 1340 | /* If gun is pointing at the current scan line, set hit bit and cache horizontal timer value */ |
| 1341 | 1341 | dclg_output_h |= 0x02; |
| 1342 | dclg_timer = | |
| 1342 | dclg_timer = | |
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | 1345 | if ( (dac >> 2) <= dclg_table[ (joystick_axis ? dclg_output_h : dclg_output_v) & 0x03 ]) |
| r2375 | r2376 | |
| 1348 | 1348 | if( (dclg_state == 7) ) |
| 1349 | 1349 | { |
| 1350 | 1350 | /* While in state 7, prepare to chech next video frame for a hit */ |
| 1351 | dclg_time = video_screen_get_time_until_pos(machine->primary_screen, | |
| 1351 | dclg_time = video_screen_get_time_until_pos(machine->primary_screen, | |
| 1352 | 1352 | } |
| 1353 | 1353 | |
| 1354 | 1354 | break; |
| r2375 | r2376 | |
| 1374 | 1374 | } |
| 1375 | 1375 | |
| 1376 | 1376 | /* sample joystick buttons */ |
| 1377 | porta &= ~readinputportbytag_safe("joystick_buttons", 0); | |
| 1378 | port_za &= ~readinputportbytag_safe("joystick_buttons", 0); | |
| 1377 | porta &= ~input_port_read_safe(machine, "joystick_buttons", 0); | |
| 1378 | port_za &= ~input_port_read_safe(machine, "joystick_buttons", 0); | |
| 1379 | 1379 | |
| 1380 | 1380 | pia_set_input_a(0, porta, port_za); |
| 1381 | 1381 | return porta; |
| r2375 | r2376 | |
| 3052 | 3052 | coco3_mmu_update(0, 8); |
| 3053 | 3053 | } |
| 3054 | 3054 | |
| 3055 | static | |
| 3055 | static STATE_POSTLOAD( coco3_state_postload | |
| 3056 | 3056 | { |
| 3057 | 3057 | coco3_mmu_update(0, 8); |
| 3058 | 3058 | } |
| 3059 | 3059 | |
| 3060 | 3060 | static void update_lightgun(running_machine *machine) |
| 3061 | 3061 | { |
| 3062 | int is_lightgun = | |
| 3062 | int is_lightgun = | |
| 3063 | 3063 | crosshair_set_screen(machine, 0, is_lightgun ? CROSSHAIR_SCREEN_ALL : CROSSHAIR_SCREEN_NONE); |
| 3064 | 3064 | } |
| 3065 | 3065 | |
| r2375 | r2376 | |
| 3105 | 3105 | state_save_register_global(coco3_interupt_line); |
| 3106 | 3106 | state_save_register_global(gime_irq); |
| 3107 | 3107 | state_save_register_global(gime_firq); |
| 3108 | state_save_register_ | |
| 3108 | state_save_register_ | |
| 3109 | 3109 | |
| 3110 | 3110 | /* need to specify lightgun crosshairs */ |
| 3111 | 3111 | timer_set(attotime_zero, NULL, 0, update_lightgun_timer_callback); |
| r2375 | r2376 | |
|---|---|---|
| 4248 | 4248 | if(0==(offset&0x7FFF)) |
| 4249 | 4249 | return; |
| 4250 | 4250 | |
| 4251 | data = data|(program_read_byte | |
| 4251 | data = data|(program_read_byte | |
| 4252 | 4252 | |
| 4253 | 4253 | /* Switch 8k VROM bank */ |
| 4254 | 4254 | chr8 (data >> 4); |
| r2375 | r2376 | |
|---|---|---|
| 322 | 322 | |
| 323 | 323 | |
| 324 | 324 | |
| 325 | static STATE_POSTLOAD( to7_update_cart_bank_postload ) | |
| 326 | { | |
| 327 | to7_update_cart_bank(); | |
| 328 | } | |
| 329 | ||
| 330 | ||
| 331 | ||
| 325 | 332 | /* write signal to 0000-1fff generates a bank switch */ |
| 326 | 333 | WRITE8_HANDLER ( to7_cartridge_w ) |
| 327 | 334 | { |
| r2375 | r2376 | |
| 1327 | 1334 | state_save_register_global( to7_lightpen ); |
| 1328 | 1335 | state_save_register_global( to7_lightpen_step ); |
| 1329 | 1336 | state_save_register_global_pointer( (mem + 0x10000), 0x10000 ); |
| 1330 | state_save_register_ | |
| 1337 | state_save_register_ | |
| 1331 | 1338 | } |
| 1332 | 1339 | |
| 1333 | 1340 | |
| r2375 | r2376 | |
| 1395 | 1402 | |
| 1396 | 1403 | |
| 1397 | 1404 | |
| 1405 | static STATE_POSTLOAD ( to770_update_ram_bank_postload ) | |
| 1406 | { | |
| 1407 | to770_update_ram_bank(); | |
| 1408 | } | |
| 1409 | ||
| 1410 | ||
| 1411 | ||
| 1398 | 1412 | static WRITE8_HANDLER ( to770_sys_portb_out ) |
| 1399 | 1413 | { |
| 1400 | 1414 | to770_update_ram_bank(); |
| r2375 | r2376 | |
| 1545 | 1559 | state_save_register_global( to7_lightpen ); |
| 1546 | 1560 | state_save_register_global( to7_lightpen_step ); |
| 1547 | 1561 | state_save_register_global_pointer( (mem + 0x10000), 0x10000 ); |
| 1548 | state_save_register_func_postload( to770_update_ram_bank ); | |
| 1549 | state_save_register_func_postload( to7_update_cart_bank ); | |
| 1562 | state_save_register_postload(machine, to770_update_ram_bank_postload, NULL ); | |
| 1563 | state_save_register_postload(machine, to7_update_cart_bank_postload, NULL ); | |
| 1550 | 1564 | } |
| 1551 | 1565 | |
| 1552 | 1566 | |
| r2375 | r2376 | |
| 1788 | 1802 | |
| 1789 | 1803 | |
| 1790 | 1804 | |
| 1805 | static STATE_POSTLOAD( mo5_update_cart_bank_postload ) | |
| 1806 | { | |
| 1807 | mo5_update_cart_bank(); | |
| 1808 | } | |
| 1809 | ||
| 1810 | ||
| 1811 | ||
| 1791 | 1812 | /* write signal to b000-cfff generates a bank switch */ |
| 1792 | 1813 | WRITE8_HANDLER ( mo5_cartridge_w ) |
| 1793 | 1814 | { |
| r2375 | r2376 | |
| 1895 | 1916 | state_save_register_global( to7_lightpen_step ); |
| 1896 | 1917 | state_save_register_global( mo5_reg_cart ); |
| 1897 | 1918 | state_save_register_global_pointer( (mem + 0x10000), 0x10000 ); |
| 1898 | state_save_register_ | |
| 1919 | state_save_register_ | |
| 1899 | 1920 | } |
| 1900 | 1921 | |
| 1901 | 1922 | |
| r2375 | r2376 | |
| 2147 | 2168 | |
| 2148 | 2169 | |
| 2149 | 2170 | |
| 2171 | static STATE_POSTLOAD( to9_update_cart_bank_postload ) | |
| 2172 | { | |
| 2173 | to9_update_cart_bank(); | |
| 2174 | } | |
| 2175 | ||
| 2176 | ||
| 2177 | ||
| 2150 | 2178 | /* write signal to 0000-1fff generates a bank switch */ |
| 2151 | 2179 | WRITE8_HANDLER ( to9_cartridge_w ) |
| 2152 | 2180 | { |
| r2375 | r2376 | |
| 2217 | 2245 | |
| 2218 | 2246 | |
| 2219 | 2247 | |
| 2248 | static STATE_POSTLOAD( to9_update_ram_bank_postload ) | |
| 2249 | { | |
| 2250 | to9_update_ram_bank(); | |
| 2251 | } | |
| 2252 | ||
| 2253 | ||
| 2254 | ||
| 2220 | 2255 | /* ------------ keyboard (6850 ACIA + 6805 CPU) ------------ */ |
| 2221 | 2256 | |
| 2222 | 2257 | /* The 6805 chip scans the keyboard and sends ASCII codes to the 6909. |
| r2375 | r2376 | |
| 2835 | 2870 | state_save_register_global( to7_lightpen_step ); |
| 2836 | 2871 | state_save_register_global( to9_soft_bank ); |
| 2837 | 2872 | state_save_register_global_pointer( (mem + 0x10000), 0x10000 ); |
| 2838 | state_save_register_func_postload( to9_update_ram_bank ); | |
| 2839 | state_save_register_func_postload( to9_update_cart_bank ); | |
| 2873 | state_save_register_postload(machine, to9_update_ram_bank_postload, NULL ); | |
| 2874 | state_save_register_postload(machine, to9_update_cart_bank_postload, NULL ); | |
| 2840 | 2875 | } |
| 2841 | 2876 | |
| 2842 | 2877 | |
| r2375 | r2376 | |
| 3201 | 3236 | |
| 3202 | 3237 | |
| 3203 | 3238 | |
| 3239 | static STATE_POSTLOAD( to8_update_floppy_bank_postload ) | |
| 3240 | { | |
| 3241 | to8_update_floppy_bank(); | |
| 3242 | } | |
| 3243 | ||
| 3244 | ||
| 3245 | ||
| 3204 | 3246 | static void to8_update_ram_bank ( void ) |
| 3205 | 3247 | { |
| 3206 | 3248 | UINT8 bank = 0; |
| r2375 | r2376 | |
| 3257 | 3299 | |
| 3258 | 3300 | |
| 3259 | 3301 | |
| 3302 | static STATE_POSTLOAD( to8_update_ram_bank_postload ) | |
| 3303 | { | |
| 3304 | to8_update_ram_bank(); | |
| 3305 | } | |
| 3306 | ||
| 3307 | ||
| 3308 | ||
| 3260 | 3309 | static void to8_update_cart_bank ( void ) |
| 3261 | 3310 | { |
| 3262 | 3311 | static int old_bank = -1; |
| r2375 | r2376 | |
| 3309 | 3358 | |
| 3310 | 3359 | |
| 3311 | 3360 | |
| 3361 | static STATE_POSTLOAD( to8_update_cart_bank_postload ) | |
| 3362 | { | |
| 3363 | to8_update_cart_bank(); | |
| 3364 | } | |
| 3365 | ||
| 3366 | ||
| 3367 | ||
| 3312 | 3368 | /* ROM bank switch */ |
| 3313 | 3369 | WRITE8_HANDLER ( to8_cartridge_w ) |
| 3314 | 3370 | { |
| r2375 | r2376 | |
| 3785 | 3841 | state_save_register_global( to8_data_vpage ); |
| 3786 | 3842 | state_save_register_global( to8_cart_vpage ); |
| 3787 | 3843 | state_save_register_global_pointer( (mem + 0x10000), 0x10000 ); |
| 3788 | state_save_register_func_postload( to8_update_ram_bank ); | |
| 3789 | state_save_register_func_postload( to8_update_cart_bank ); | |
| 3790 | state_save_register_func_postload( to8_update_floppy_bank ); | |
| 3844 | state_save_register_postload(machine, to8_update_ram_bank_postload, NULL ); | |
| 3845 | state_save_register_postload(machine, to8_update_cart_bank_postload, NULL ); | |
| 3846 | state_save_register_postload(machine, to8_update_floppy_bank_postload, NULL ); | |
| 3791 | 3847 | } |
| 3792 | 3848 | |
| 3793 | 3849 | |
| r2375 | r2376 | |
| 3947 | 4003 | state_save_register_global( to8_data_vpage ); |
| 3948 | 4004 | state_save_register_global( to8_cart_vpage ); |
| 3949 | 4005 | state_save_register_global_pointer( (mem + 0x10000), 0x10000 ); |
| 3950 | state_save_register_func_postload( to8_update_ram_bank ); | |
| 3951 | state_save_register_func_postload( to8_update_cart_bank ); | |
| 3952 | state_save_register_func_postload( to8_update_floppy_bank ); | |
| 4006 | state_save_register_postload(machine, to8_update_ram_bank_postload, NULL ); | |
| 4007 | state_save_register_postload(machine, to8_update_cart_bank_postload, NULL ); | |
| 4008 | state_save_register_postload(machine, to8_update_floppy_bank_postload, NULL ); | |
| 3953 | 4009 | } |
| 3954 | 4010 | |
| 3955 | 4011 | |
| r2375 | r2376 | |
| 3979 | 4035 | |
| 3980 | 4036 | |
| 3981 | 4037 | |
| 4038 | static STATE_POSTLOAD( mo6_update_ram_bank_postload ) | |
| 4039 | { | |
| 4040 | mo6_update_ram_bank(); | |
| 4041 | } | |
| 4042 | ||
| 4043 | ||
| 4044 | ||
| 3982 | 4045 | static void mo6_update_cart_bank ( void ) |
| 3983 | 4046 | { |
| 3984 | 4047 | int b = (pia_get_output_a( THOM_PIA_SYS ) >> 5) & 1; |
| r2375 | r2376 | |
| 4056 | 4119 | |
| 4057 | 4120 | |
| 4058 | 4121 | |
| 4122 | static STATE_POSTLOAD( mo6_update_cart_bank_postload ) | |
| 4123 | { | |
| 4124 | mo6_update_cart_bank(); | |
| 4125 | } | |
| 4126 | ||
| 4127 | ||
| 4128 | ||
| 4059 | 4129 | /* write signal generates a bank switch */ |
| 4060 | 4130 | WRITE8_HANDLER ( mo6_cartridge_w ) |
| 4061 | 4131 | { |
| r2375 | r2376 | |
| 4515 | 4585 | state_save_register_global( to8_cart_vpage ); |
| 4516 | 4586 | state_save_register_global( mo5_reg_cart ); |
| 4517 | 4587 | state_save_register_global_pointer( (mem + 0x10000), 0x10000 ); |
| 4518 | state_save_register_func_postload( mo6_update_ram_bank ); | |
| 4519 | state_save_register_func_postload( mo6_update_cart_bank ); | |
| 4588 | state_save_register_postload(machine, mo6_update_ram_bank_postload, NULL ); | |
| 4589 | state_save_register_postload(machine, mo6_update_cart_bank_postload, NULL ); | |
| 4520 | 4590 | } |
| 4521 | 4591 | |
| 4522 | 4592 | |
| r2375 | r2376 | |
| 4782 | 4852 | state_save_register_global( to8_cart_vpage ); |
| 4783 | 4853 | state_save_register_global( mo5_reg_cart ); |
| 4784 | 4854 | state_save_register_global_pointer( (mem + 0x10000), 0x10000 ); |
| 4785 | state_save_register_func_postload( mo6_update_ram_bank ); | |
| 4786 | state_save_register_func_postload( mo6_update_cart_bank ); | |
| 4855 | state_save_register_postload(machine, mo6_update_ram_bank_postload, NULL ); | |
| 4856 | state_save_register_postload(machine, mo6_update_cart_bank_postload, NULL ); | |
| 4787 | 4857 | } |
| r2375 | r2376 | |
|---|---|---|
| 1206 | 1206 | #endif |
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | static | |
| 1209 | static STATE_POSTLOAD( lynx_postload | |
| 1210 | 1210 | { |
| 1211 | 1211 | lynx_memory_config_w(Machine, 0, lynx_memory_config); |
| 1212 | 1212 | } |
| r2375 | r2376 | |
| 1215 | 1215 | { |
| 1216 | 1216 | state_save_register_global(lynx_memory_config); |
| 1217 | 1217 | state_save_register_global_pointer(lynx_mem_fe00, lynx_mem_fe00_size); |
| 1218 | state_save_register_ | |
| 1218 | state_save_register_ | |
| 1219 | 1219 | |
| 1220 | 1220 | memory_configure_bank(3, 0, 1, memory_region(REGION_CPU1) + 0x0000, 0); |
| 1221 | 1221 | memory_configure_bank(3, 1, 1, lynx_mem_fe00, 0); |
| r2375 | r2376 | |
|---|---|---|
| 305 | 305 | { |
| 306 | 306 | sp_reg = cpunum_get_reg(0, Z80_SP); |
| 307 | 307 | return_addr = |
| 308 | ((UINT16) program_read_byte_8(sp_reg + 0) ) >> 8 | | |
| 309 | ((UINT16) program_read_byte_8(sp_reg + 1) ) >> 0; | |
| 308 | ((UINT16) program_read_byte(sp_reg + 0) ) >> 8 | | |
| 309 | ((UINT16) program_read_byte(sp_reg + 1) ) >> 0; | |
| 310 | 310 | |
| 311 | 311 | sp_reg += 2; |
| 312 | 312 | cpunum_set_reg(0, Z80_SP, (sp_reg & 0x0ffff)); |
| r2375 | r2376 | |
| 618 | 618 | addr = cpunum_get_reg(0, Z80_SP) & 0xFFFF; |
| 619 | 619 | |
| 620 | 620 | cpunum_set_reg(0, Z80_PC, |
| 621 | ((UINT16) program_read_byte_8(addr + 0) ) >> 8 | | |
| 622 | ((UINT16) program_read_byte_8(addr + 1) ) >> 0); | |
| 621 | ((UINT16) program_read_byte(addr + 0) ) >> 8 | | |
| 622 | ((UINT16) program_read_byte(addr + 1) ) >> 0); | |
| 623 | 623 | |
| 624 | 624 | addr += 2; |
| 625 | 625 | cpunum_set_reg(0, Z80_SP, (addr & 0x0ffff)); |
| r2375 | r2376 | |
|---|---|---|
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | |
| 122 | static STATE_POSTLOAD( update_sam_postload ) | |
| 123 | { | |
| 124 | update_sam(); | |
| 125 | } | |
| 126 | ||
| 127 | ||
| 128 | ||
| 122 | 129 | void sam_init(running_machine *machine, const sam6883_interface *intf) |
| 123 | 130 | { |
| 124 | 131 | sam.state = 0; |
| r2375 | r2376 | |
| 130 | 137 | /* save state registration */ |
| 131 | 138 | state_save_register_item("6883sam", 0, sam.state); |
| 132 | 139 | state_save_register_item("6883sam", 0, sam.video_position); |
| 133 | state_save_register_ | |
| 140 | state_save_register_ | |
| 134 | 141 | } |
| 135 | 142 | |
| 136 | 143 |
| r2375 | r2376 | |
|---|---|---|
| 1120 | 1120 | |
| 1121 | 1121 | |
| 1122 | 1122 | for (i=0; i<4; i++) |
| 1123 | typewriter_keys[i] = | |
| 1123 | typewriter_keys[i] = | |
| 1124 | 1124 | |
| 1125 | 1125 | for (i=0; i<4; i++) |
| 1126 | 1126 | { |
| r2375 | r2376 | |
| 1162 | 1162 | |
| 1163 | 1163 | |
| 1164 | 1164 | /* read new state of control keys */ |
| 1165 | control_keys = | |
| 1165 | control_keys = | |
| 1166 | 1166 | |
| 1167 | 1167 | if (control_keys & tx0_control) |
| 1168 | 1168 | { |
| r2375 | r2376 | |
| 1231 | 1231 | |
| 1232 | 1232 | |
| 1233 | 1233 | /* handle toggle switch register keys */ |
| 1234 | tsr_keys = ( | |
| 1234 | tsr_keys = ( | |
| 1235 | 1235 | |
| 1236 | 1236 | /* compute transitions */ |
| 1237 | 1237 | tsr_transitions = tsr_keys & (~ old_tsr_keys); |
| r2375 | r2376 | |
|---|---|---|
| 248 | 248 | if (sscanf((char *)line, "%x %x %x %x %x %x %x %x %x %x\010\010\n", |
| 249 | 249 | &addr, &b0, &b1, &b2, &b3, &b4, &b5, &b6, &b7, &dummy) == 10) |
| 250 | 250 | { |
| 251 | program_write_byte_8(addr++, b0); | |
| 252 | program_write_byte_8(addr++, b1); | |
| 253 | program_write_byte_8(addr++, b2); | |
| 254 | program_write_byte_8(addr++, b3); | |
| 255 | program_write_byte_8(addr++, b4); | |
| 256 | program_write_byte_8(addr++, b5); | |
| 257 | program_write_byte_8(addr++, b6); | |
| 258 | program_write_byte_8(addr++, b7); | |
| 251 | program_write_byte(addr++, b0); | |
| 252 | program_write_byte(addr++, b1); | |
| 253 | program_write_byte(addr++, b2); | |
| 254 | program_write_byte(addr++, b3); | |
| 255 | program_write_byte(addr++, b4); | |
| 256 | program_write_byte(addr++, b5); | |
| 257 | program_write_byte(addr++, b6); | |
| 258 | program_write_byte(addr++, b7); | |
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 |
| r2375 | r2376 | |
|---|---|---|
| 208 | 208 | switch (header[21]) |
| 209 | 209 | { |
| 210 | 210 | case VZ_BASIC: /* 0xF0 */ |
| 211 | program_write_byte_8(0x78a4, start % 256); /* start of basic program */ | |
| 212 | program_write_byte_8(0x78a5, start / 256); | |
| 213 | program_write_byte_8(0x78f9, end % 256); /* end of basic program */ | |
| 214 | program_write_byte_8(0x78fa, end / 256); | |
| 215 | program_write_byte_8(0x78fb, end % 256); /* start variable table */ | |
| 216 | program_write_byte_8(0x78fc, end / 256); | |
| 217 | program_write_byte_8(0x78fd, end % 256); /* start free mem, end variable table */ | |
| 218 | program_write_byte_8(0x78fe, end / 256); | |
| 211 | program_write_byte(0x78a4, start % 256); /* start of basic program */ | |
| 212 | program_write_byte(0x78a5, start / 256); | |
| 213 | program_write_byte(0x78f9, end % 256); /* end of basic program */ | |
| 214 | program_write_byte(0x78fa, end / 256); | |
| 215 | program_write_byte(0x78fb, end % 256); /* start variable table */ | |
| 216 | program_write_byte(0x78fc, end / 256); | |
| 217 | program_write_byte(0x78fd, end % 256); /* start free mem, end variable table */ | |
| 218 | program_write_byte(0x78fe, end / 256); | |
| 219 | 219 | popmessage("%s (B)\nsize=%04X : start=%04X : end=%04X",pgmname,size,start,end); |
| 220 | 220 | free(pgmname); |
| 221 | 221 | break; |
| 222 | 222 | |
| 223 | 223 | case VZ_MCODE: /* 0xF1 */ |
| 224 | program_write_byte_8(0x788e, start % 256); /* usr subroutine address */ | |
| 225 | program_write_byte_8(0x788f, start / 256); | |
| 224 | program_write_byte(0x788e, start % 256); /* usr subroutine address */ | |
| 225 | program_write_byte(0x788f, start / 256); | |
| 226 | 226 | popmessage("%s (M)\nsize=%04X : start=%04X : end=%04X",pgmname,size,start,end); |
| 227 | 227 | free(pgmname); |
| 228 | 228 | cpunum_set_reg(0, REG_PC, start); /* start program */ |
| r2375 | r2376 | |
|---|---|---|
| 295 | 295 | *****************************************************************************/ |
| 296 | 296 | static void cpm_conout_chr(int data) |
| 297 | 297 | { |
| 298 | io_write_byte | |
| 298 | io_write_byte | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /***************************************************************************** |
| r2375 | r2376 | |
| 650 | 650 | break; |
| 651 | 651 | |
| 652 | 652 | case 0x02: /* CSTAT */ |
| 653 | tmp = io_read_byte | |
| 653 | tmp = io_read_byte | |
| 654 | 654 | af = (af & 0xff) | (tmp << 8); |
| 655 | 655 | |
| 656 | 656 | if (VERBOSE_CONIO) |
| r2375 | r2376 | |
| 658 | 658 | break; |
| 659 | 659 | |
| 660 | 660 | case 0x03: /* CONIN */ |
| 661 | if ( io_read_byte | |
| 661 | if ( io_read_byte | |
| 662 | 662 | { |
| 663 | 663 | activecpu_set_reg( Z80_PC, activecpu_get_reg(Z80_PC) - 2 ); |
| 664 | 664 | break; |
| 665 | 665 | } |
| 666 | tmp = io_read_byte | |
| 666 | tmp = io_read_byte | |
| 667 | 667 | af = (af & 0xff) | (tmp << 8); |
| 668 | 668 | if (VERBOSE_CONIO) |
| 669 | 669 | logerror("BIOS 03 console input A:%02X\n", tmp); |
| r2375 | r2376 | |
|---|---|---|
| 98 | 98 | LOG(("cas_copy_callback block ($%02X) %d at $%04X\n", data, block_len, block_ofs)); |
| 99 | 99 | while( block_len && cas_size ) |
| 100 | 100 | { |
| 101 | program_write_byte | |
| 101 | program_write_byte | |
| 102 | 102 | offs++; |
| 103 | 103 | block_ofs++; |
| 104 | 104 | block_len--; |
| r2375 | r2376 | |
| 178 | 178 | LOG(("trs80_cmd_load block ($%02X) %d at $%04X\n", data, block_len, block_ofs)); |
| 179 | 179 | while( block_len && quickload_size ) |
| 180 | 180 | { |
| 181 | program_write_byte | |
| 181 | program_write_byte | |
| 182 | 182 | offs++; |
| 183 | 183 | block_ofs++; |
| 184 | 184 | block_len--; |
| r2375 | r2376 | |
|---|---|---|
| 293 | 293 | |
| 294 | 294 | |
| 295 | 295 | |
| 296 | static STATE_POSTLOAD( apple2_update_memory_postload ) | |
| 297 | { | |
| 298 | apple2_update_memory(); | |
| 299 | } | |
| 300 | ||
| 301 | ||
| 302 | ||
| 296 | 303 | /* ----------------------------------------------------------------------- |
| 297 | 304 | * Apple II memory map |
| 298 | 305 | * ----------------------------------------------------------------------- */ |
| r2375 | r2376 | |
| 1063 | 1070 | |
| 1064 | 1071 | if (offset == 0) |
| 1065 | 1072 | { |
| 1066 | joystick_x1_time = attotime_to_double(timer_get_time()) + x_calibration * readinputportbytag("joystick_1_x"); | |
| 1067 | joystick_y1_time = attotime_to_double(timer_get_time()) + y_calibration * readinputportbytag("joystick_1_y"); | |
| 1068 | joystick_x2_time = attotime_to_double(timer_get_time()) + x_calibration * readinputportbytag("joystick_2_x"); | |
| 1069 | joystick_y2_time = attotime_to_double(timer_get_time()) + y_calibration * readinputportbytag("joystick_2_y"); | |
| 1073 | joystick_x1_time = attotime_to_double(timer_get_time()) + x_calibration * input_port_read(machine, "joystick_1_x"); | |
| 1074 | joystick_y1_time = attotime_to_double(timer_get_time()) + y_calibration * input_port_read(machine, "joystick_1_y"); | |
| 1075 | joystick_x2_time = attotime_to_double(timer_get_time()) + x_calibration * input_port_read(machine, "joystick_2_x"); | |
| 1076 | joystick_y2_time = attotime_to_double(timer_get_time()) + y_calibration * input_port_read(machine, "joystick_2_y"); | |
| 1070 | 1077 | } |
| 1071 | 1078 | return 0; |
| 1072 | 1079 | } |
| r2375 | r2376 | |
| 1532 | 1539 | |
| 1533 | 1540 | /* state save registers */ |
| 1534 | 1541 | state_save_register_global(a2); |
| 1535 | state_save_register_ | |
| 1542 | state_save_register_ | |
| 1536 | 1543 | |
| 1537 | 1544 | /* apple2 behaves much better when the default memory is zero */ |
| 1538 | 1545 | memset(mess_ram, 0, mess_ram_size); |
| r2375 | r2376 | |
|---|---|---|
| 749 | 749 | } |
| 750 | 750 | else if (!ultimax) |
| 751 | 751 | c64_bankswitch (0); |
| 752 | c64_memory[0x000] = program_read_byte_8( 0 ); | |
| 753 | c64_memory[0x001] = program_read_byte_8( 1 ); | |
| 752 | c64_memory[0x000] = program_read_byte( 0 ); | |
| 753 | c64_memory[0x001] = program_read_byte( 1 ); | |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | UINT8 c64_m6510_port_read(UINT8 direction) |
| r2375 | r2376 | |
|---|---|---|
| 210 | 210 | CPUS += TMS7000_EXL |
| 211 | 211 | CPUS += SM8500 |
| 212 | 212 | CPUS += V30MZ |
| 213 | #CPUS += CXD8661R | |
| 213 | 214 | #CPUS += SSP1610 |
| 214 | 215 | CPUS += UPD7801 |
| 215 | 216 | CPUS += M68008 |
| r2375 | r2376 | |
|---|---|---|
| 130 | 130 | ***************************************************************************/ |
| 131 | 131 | |
| 132 | 132 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 133 | CONS( 1995, sfzch, 0, 0, cps1, sfzch, cps1, NULL, "Capcom", "CPS Changer (Street Fighter ZERO)" , 0) | |
| 133 | CONS( 1995, sfzch, 0, 0, cps1_10MHz, sfzch, cps1, NULL, "Capcom", "CPS Changer (Street Fighter ZERO)" , 0) | |
| 134 | 134 |
| r2375 | r2376 | |
|---|---|---|
| 335 | 335 | |
| 336 | 336 | |
| 337 | 337 | /* read new state of edit keys */ |
| 338 | edit_keys = ( | |
| 338 | edit_keys = ( | |
| 339 | 339 | |
| 340 | 340 | /* toggle data reg according to transitions */ |
| 341 | 341 | panel_data_reg ^= edit_keys & (~ old_edit_keys); |
| r2375 | r2376 | |
| 345 | 345 | |
| 346 | 346 | |
| 347 | 347 | /* read new state of control keys */ |
| 348 | control_keys = | |
| 348 | control_keys = | |
| 349 | 349 | |
| 350 | 350 | /* compute transitions */ |
| 351 | 351 | control_transitions = control_keys & (~ old_control_keys); |
| r2375 | r2376 | |
|---|---|---|
| 1045 | 1045 | static READ8_HANDLER(modeFE_switch_r) |
| 1046 | 1046 | { |
| 1047 | 1047 | modeFE_switch(offset, 0 ); |
| 1048 | return program_read_byte | |
| 1048 | return program_read_byte | |
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | static WRITE8_HANDLER(modeFE_switch_w) |
| 1052 | 1052 | { |
| 1053 | program_write_byte | |
| 1053 | program_write_byte | |
| 1054 | 1054 | modeFE_switch(offset, 0 ); |
| 1055 | 1055 | } |
| 1056 | 1056 | |
| r2375 | r2376 | |
| 1342 | 1342 | if ( ! ( last_address & 0x1080 ) ) { |
| 1343 | 1343 | return offset; |
| 1344 | 1344 | } |
| 1345 | last_byte = program_read_byte | |
| 1345 | last_byte = program_read_byte | |
| 1346 | 1346 | if ( last_byte < 0x80 || last_byte == 0xFF ) { |
| 1347 | 1347 | return last_byte; |
| 1348 | 1348 | } |
| r2375 | r2376 | |
| 1350 | 1350 | if ( ! ( prev_address & 0x1080 ) ) { |
| 1351 | 1351 | return last_byte; |
| 1352 | 1352 | } |
| 1353 | prev_byte = program_read_byte | |
| 1353 | prev_byte = program_read_byte | |
| 1354 | 1354 | if ( prev_byte == 0xB1 ) { /* LDA (XX),Y */ |
| 1355 | return program_read_byte | |
| 1355 | return program_read_byte | |
| 1356 | 1356 | } |
| 1357 | 1357 | return last_byte; |
| 1358 | 1358 | } |
| r2375 | r2376 | |
|---|---|---|
| 346 | 346 | PC3 Not connected |
| 347 | 347 | */ |
| 348 | 348 | |
| 349 | if ( | |
| 349 | if ( | |
| 350 | 350 | { |
| 351 | 351 | ramcard_set_banks(data & 0x07); |
| 352 | 352 | } |
| r2375 | r2376 | |
| 500 | 500 | wd17xx_init(machine, WD_TYPE_2793, bw2_wd17xx_callback, NULL); |
| 501 | 501 | wd17xx_set_density(DEN_MFM_LO); |
| 502 | 502 | |
| 503 | if ( | |
| 503 | if ( | |
| 504 | 504 | { |
| 505 | 505 | // RAMCARD installed |
| 506 | 506 |
| r2375 | r2376 | |
|---|---|---|
| 721 | 721 | |
| 722 | 722 | static DRIVER_INIT( psx ) |
| 723 | 723 | { |
| 724 | psx_driver_init(); | |
| 724 | psx_driver_init(machine); | |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | static INPUT_PORTS_START( psx ) |
| r2375 | r2376 | |
|---|---|---|
| 144 | 144 | UINT8 data = 0xe0; |
| 145 | 145 | UINT8 row = ~(offset >> 8); |
| 146 | 146 | |
| 147 | if (row & 0x80) data &= readinputportbytag("keyboard_row_7f") & 0xe0; | |
| 148 | if (row & 0x40) data &= readinputportbytag("keyboard_row_bf") & 0xe0; | |
| 149 | if (row & 0x20) data &= readinputportbytag("keyboard_row_df") & 0xe0; | |
| 150 | if (row & 0x10) data &= readinputportbytag("keyboard_row_ef") & 0xe0; | |
| 151 | if (row & 0x08) data &= readinputportbytag("keyboard_row_f7") & 0xe0; | |
| 152 | if (row & 0x04) data &= readinputportbytag("keyboard_row_fb") & 0xe0; | |
| 153 | if (row & 0x02) data &= readinputportbytag("keyboard_row_fd") & 0xe0; | |
| 154 | if (row & 0x01) data &= readinputportbytag("keyboard_row_fe") & 0xe0; | |
| 147 | if (row & 0x80) data &= input_port_read(machine, "keyboard_row_7f") & 0xe0; | |
| 148 | if (row & 0x40) data &= input_port_read(machine, "keyboard_row_bf") & 0xe0; | |
| 149 | if (row & 0x20) data &= input_port_read(machine, "keyboard_row_df") & 0xe0; | |
| 150 | if (row & 0x10) data &= input_port_read(machine, "keyboard_row_ef") & 0xe0; | |
| 151 | if (row & 0x08) data &= input_port_read(machine, "keyboard_row_f7") & 0xe0; | |
| 152 | if (row & 0x04) data &= input_port_read(machine, "keyboard_row_fb") & 0xe0; | |
| 153 | if (row & 0x02) data &= input_port_read(machine, "keyboard_row_fd") & 0xe0; | |
| 154 | if (row & 0x01) data &= input_port_read(machine, "keyboard_row_fe") & 0xe0; | |
| 155 | 155 | |
| 156 | 156 | return data | coupe_regs.status; |
| 157 | 157 | } |
| r2375 | r2376 | |
| 222 | 222 | |
| 223 | 223 | if (row == 0) |
| 224 | 224 | { |
| 225 | data &= | |
| 225 | data &= | |
| 226 | 226 | } |
| 227 | 227 | else |
| 228 | 228 | { |
| 229 | if (row & 0x80) data &= readinputportbytag("keyboard_row_7f") & 0x1f; | |
| 230 | if (row & 0x40) data &= readinputportbytag("keyboard_row_bf") & 0x1f; | |
| 231 | if (row & 0x20) data &= readinputportbytag("keyboard_row_df") & 0x1f; | |
| 232 | if (row & 0x10) data &= readinputportbytag("keyboard_row_ef") & 0x1f; | |
| 233 | if (row & 0x08) data &= readinputportbytag("keyboard_row_f7") & 0x1f; | |
| 234 | if (row & 0x04) data &= readinputportbytag("keyboard_row_fb") & 0x1f; | |
| 235 | if (row & 0x02) data &= readinputportbytag("keyboard_row_fd") & 0x1f; | |
| 236 | if (row & 0x01) data &= readinputportbytag("keyboard_row_fe") & 0x1f; | |
| 229 | if (row & 0x80) data &= input_port_read(machine, "keyboard_row_7f") & 0x1f; | |
| 230 | if (row & 0x40) data &= input_port_read(machine, "keyboard_row_bf") & 0x1f; | |
| 231 | if (row & 0x20) data &= input_port_read(machine, "keyboard_row_df") & 0x1f; | |
| 232 | if (row & 0x10) data &= input_port_read(machine, "keyboard_row_ef") & 0x1f; | |
| 233 | if (row & 0x08) data &= input_port_read(machine, "keyboard_row_f7") & 0x1f; | |
| 234 | if (row & 0x04) data &= input_port_read(machine, "keyboard_row_fb") & 0x1f; | |
| 235 | if (row & 0x02) data &= input_port_read(machine, "keyboard_row_fd") & 0x1f; | |
| 236 | if (row & 0x01) data &= input_port_read(machine, "keyboard_row_fe") & 0x1f; | |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | return data | 0xe0; |
| r2375 | r2376 | |
|---|---|---|
| 73 | 73 | |
| 74 | 74 | Source Changes: |
| 75 | 75 | ---------------- |
| 76 | - The core is based on MAME 0.124u | |
| 76 | - The core is based on MAME 0.124u2. This incorporates all features of the | |
| 77 | 77 | update to this core. [MAME team] |
| 78 | 78 | |
| 79 | 79 | - Major changes to transition MESS's device system onto MAME's device system. |
| Previous | 15994 Revisions | Next |