| Previous | 15994 Revisions | Next |
| r1294 Monday 19th November, 2007 at 14:34:26 UTC by Nathan Woods |
|---|
| Updated to MAME 0.121 core |
| [ROOT] | whatsnew.txt |
| [docs] | messnew.txt |
| [src/emu] | attotime.c* attotime.h* cheat.c cpuexec.c cpuexec.h cpuintrf.c driver.c driver.h eigccx86.h eminline.h emu.mak emuopts.h info.c mame.c profiler.c sound.c streams.c streams.h timer.c timer.h ui.c uimenu.c validity.c video.c video.h |
| [src/emu/cpu] | cpu.mak |
| [src/emu/cpu/ccpu] | ccpu.c |
| [src/emu/cpu/dsp56k] | dsp56k.c |
| [src/emu/cpu/f8] | f3853.c |
| [src/emu/cpu/h83002] | h8periph.c h8priv.h |
| [src/emu/cpu/m37710] | m37710.c m37710cm.h |
| [src/emu/cpu/m6800] | m6800.c |
| [src/emu/cpu/mips] | mips3com.c mips3com.h |
| [src/emu/cpu/powerpc] | ppc.c ppcdrc.c |
| [src/emu/cpu/sc61860] | sc61860.c |
| [src/emu/cpu/sh2] | sh2.c |
| [src/emu/cpu/sh4] | sh4.c |
| [src/emu/cpu/tlcs90] | tlcs90.c |
| [src/emu/cpu/tms32031] | tms32031.c tms32031.h |
| [src/emu/cpu/tms34010] | tms34010.c |
| [src/emu/cpu/tms9900] | 99xxcore.h |
| [src/emu/debug] | debugcpu.c |
| [src/emu/machine] | 6522via.c 6526cia.c 6532riot.c 6840ptm.c 6850acia.c 74123.c 8042kbdc.c 8237dma.c am53cf96.c ds2401.c ds2404.c idectrl.c intelfsh.c laserdsc.c mb3773.c mc146818.c pc16552d.c pd4990a.c pic8259.c pit8253.c rtc65271.c scsihd.c timekpr.c tmp68301.c wd33c93.c z80ctc.c z80ctc.h z80sio.c |
| [src/emu/sound] | 2151intf.c 2203intf.c 2608intf.c 2610intf.c 2612intf.c 262intf.c 3812intf.c es5503.c fm.c fm.h fmopl.c fmopl.h ics2115.c k053260.c k054539.c msm5205.c nes_apu.c pokey.c scsp.c sp0250.c upd7759.c ym2151.c ym2413.c ymf262.c ymf262.h ymf271.c ymf278b.c ymz280b.c |
| [src/emu/video] | cdp1869.c crtc6845.c rgbvmx.h tms34061.c vooddefs.h voodoo.c |
| [src/mame] | mame.mak mamedriv.c |
| [src/mame/audio] | 8080bw.c amiga.c atarijsa.c cage.c cchasm.c cinemat.c dcs.c exidy.c exidy440.c galaxian.c geebee.c gottlieb.c irem.c jaguar.c leland.c mcr.c n8080.c namco54.c rockola.c segag80r.c segasnd.c senjyo.c snes.c starwars.c system16.c taito_en.c targ.c tiamc1.c turbo.c vicdual.c warpwarp.c williams.c |
| [src/mame/drivers] | acefruit.c actfancr.c aerofgt.c afega.c aleck64.c alg.c ampoker.c arcadia.c artmagic.c asterix.c astrof.c asuka.c atarifb.c atarisy1.c atetris.c backfire.c bagman.c battlane.c beaminv.c beathead.c berzerk.c bestleag.c bfcobra.c bfm_sc2.c bionicc.c bishi.c blockade.c boxer.c brkthru.c btime.c btoads.c bublbobl.c bwing.c cabal.c canyon.c capbowl.c carrera.c cave.c cball.c cbuster.c ccastles.c centiped.c chinsan.c cidelsa.c circus.c cischeat.c clayshoo.c cliffhgr.c cloud9.c clshroad.c cninja.c cojag.c combatsc.c coolpool.c coolridr.c cps1.c cps2.c cps3.c crgolf.c crshrace.c crystal.c cshooter.c cubocd32.c cultures.c cvs.c darkhors.c darkmist.c darkseal.c dassault.c ddenlovr.c ddragon.c dec0.c dec8.c deco156.c deco32.c deco_mlc.c decocass.c destroyr.c discoboy.c dkong.c dlair.c dmndrby.c dragrace.c dreamwld.c drmicro.c dunhuang.c dwarfd.c dynax.c egghunt.c enigma2.c equites.c ertictac.c esd16.c esh.c exctsccr.c exterm.c fcrash.c fgoal.c finalizr.c firebeat.c firetrk.c flyball.c foodf.c funkyjet.c fuukifg2.c fuukifg3.c gaelco.c gaelco3d.c galaxia.c galpani2.c galpani3.c gameplan.c gcpinbal.c genesis.c ghosteo.c gijoe.c ginganin.c glass.c gottlieb.c gpworld.c gridlee.c groundfx.c gstriker.c gunbustr.c halleys.c hanaroku.c harddriv.c higemaru.c hitme.c hng64.c homedata.c hornet.c hyprduel.c igs_blit.c itech32.c itech8.c jack.c jackal.c jchan.c jedi.c jpmimpct.c kaneko16.c kinst.c kncljoe.c konamigq.c konamigv.c konamigx.c kopunch.c ksys573.c laserbas.c lemmings.c lethal.c lethalj.c lgp.c liberate.c littlerb.c looping.c ltcasino.c m107.c m62.c m92.c macrossp.c magmax.c malzak.c marineb.c mario.c mastboy.c maxaflex.c mcr68.c mediagx.c megadriv.c megaplay.c megatech.c metlclsh.c metro.c mgolf.c micro3d.c midvunit.c midzeus.c mirage.c missile.c mjkjidai.c mjsister.c mnight.c model1.c model2.c model3.c mogura.c moo.c mouser.c mpatrol.c mpu4.c mquake.c mrdo.c mrflea.c ms32.c mustache.c mw8080bw.c mystston.c mystwarr.c namcofl.c namcona1.c namconb1.c namcond1.c namcos11.c namcos12.c namcos21.c namcos22.c namcos23.c naomi.c naughtyb.c nemesis.c neodrvr.c neogeo.c ninjakd2.c nitedrvr.c onetwo.c orbit.c othunder.c pacman.c parodius.c pbaction.c peplus.c pgm.c pipeline.c pkscram.c plygonet.c pntnpuzl.c policetr.c polyplay.c ppmast93.c progolf.c psychic5.c pturn.c qdrmfgp.c rabbit.c redclash.c renegade.c rockola.c rohga.c rollerg.c runaway.c sandscrp.c sangho.c sauro.c sbrkout.c scramble.c scregg.c seattle.c segae.c segag80r.c segag80v.c segald.c segaorun.c segas16a.c segas16b.c segas18.c segas32.c segaxbd.c segaybd.c seibuspi.c senjyo.c seta.c shanghai.c shaolins.c simpl156.c simpsons.c skullxbo.c skyarmy.c skychut.c skylncr.c skyraid.c slapshot.c snk.c snowbros.c spacefb.c splash.c sprint4.c sprint8.c spy.c srmp6.c ssfindo.c sshangha.c sslam.c sspeedr.c ssv.c st0016.c stadhero.c starfire.c starwars.c statriv2.c stv.c stvinit.c suna16.c suna8.c supbtime.c superqix.c suprloco.c suprnova.c suprslam.c system1.c system24.c tagteam.c taito_b.c taito_f2.c taito_f3.c taito_z.c tank8.c tankbatt.c tatsumi.c tecmosys.c tehkanwc.c tempest.c tetrisp2.c thayers.c thunderj.c thunderx.c tiamc1.c tickee.c tmaster.c tmnt.c tnzs.c toaplan2.c topspeed.c toypop.c travrusa.c troangel.c truco.c trucocl.c trvquest.c tubep.c tugboat.c tumbleb.c tumblep.c turbo.c tx1.c ultratnk.c ultrsprt.c undrfire.c upscope.c vamphalf.c vaportra.c vegas.c vendetta.c vicdual.c videopin.c vmetal.c wecleman.c welltris.c wgp.c wheelfir.c wilytowr.c wiz.c wolfpack.c wwfsstar.c xain.c xexex.c xxmissio.c yard.c yiear.c zac2650.c zn.c zr107.c |
| [src/mame/includes] | amiga.h mcr.h midzeus.h |
| [src/mame/machine] | amiga.c arkanoid.c asic65.c atarigen.c balsente.c cubocd32.c dec0.c decocass.c decocass.h equites.c exctsccr.c gaelco2.c galaxian.c harddriv.c irobot.c kabuki.c kaneko16.c konamiic.c konppc.c leland.c mcr.c meters.c* meters.h* mhavoc.c midwayic.c model1.c mw8080bw.c n64.c namco50.c namcoio.c namcos1.c namcos2.c nb1413m3.c opwolf.c pcshare.c pgmcrypt.c pitnrun.c playch10.c psx.c qix.c rainbow.c s16fd.c s24fd.c scudsp.c segas32.c slapfght.c slapstic.c slikshot.c snes.c steppers.c steppers.h stfight.c stvcd.c tait8741.c taitosj.c ticket.c tx1.c vertigo.c volfied.c vsnes.c williams.c xevious.c |
| [src/mame/video] | airbustr.c angelkds.c argus.c armedf.c artmagic.c asterix.c astrocde.c asuka.c atari.c atarimo.c atarirle.c atarisy1.c atarisy2.c avgdvg.c blstroid.c brkthru.c buggychl.c cave.c cchasm.c changela.c cps1.c crshrace.c csk.c dcheese.c dday.c deco32.c decocass.c dkong.c dynax.c esd16.c exctsccr.c exidy.c exidy440.c flstory.c freekick.c fromance.c gaiden.c galaxian.c gcpinbal.c genesis.c gstriker.c gsword.c gtia.c gticlub.c homerun.c hyhoo.c hyprduel.c iqblock.c itech32.c itech8.c jackal.c jaguar.c kan_pand.c kaneko16.c kickgoal.c konamiic.c ksayakyu.c ladyfrog.c leland.c lethalj.c lordgun.c m107.c m62.c m92.c mcatadv.c mcr3.c megasys1.c metro.c midtunit.c midvunit.c midyunit.c mjsister.c mnight.c model2.c momoko.c moo.c ms32.c n8080.c namcofl.c namcos2.c nbmj8688.c nbmj8891.c nbmj8991.c nbmj9195.c neogeo.c ninjakid.c niyanpai.c nycaptor.c omegaf.c pastelg.c pitnrun.c powerins.c ppu2c0x.c psikyosh.c psx.c psychic5.c qix.c renegade.c route16.c rpunch.c sbasketb.c segag80r.c segag80v.c segaic16.c segas32.c segasyse.c slapshot.c sprint8.c ssv.c stvvdp1.c stvvdp2.c suna16.c suna8.c system1.c system16.c taitoic.c taitosj.c tank8.c tatsumi.c tceptor.c thief.c tiamc1.c tickee.c toaplan1.c toaplan2.c triplhnt.c tsamurai.c tubep.c usgames.c victory.c vigilant.c wecleman.c wgp.c |
| [src/mess] | image.c inputx.c inputx.h mess.mak |
| [src/mess/audio] | dave.c lynx.c mea8000.c svision.c t6721.c |
| [src/mess/devices] | bitbngr.c cassette.c flopdrv.c snapquik.c sonydriv.c thomflop.c |
| [src/mess/drivers] | a2600.c a310.c abc80.c abc80x.c adam.c amiga.c amstrad.c apple1.c atari.c atarist.c avigo.c bbc.c coleco.c crvision.c dgn_beta.c einstein.c exelv.c exidy.c glasgow.c ip22.c mac.c mephisto.c mk1.c mk2.c mz700.c nc.c nes.c pcw.c pcw16.c psx.c ql.c saturn.c spectrum.c studio2.c super80.c svision.c tm990189.c tmc1800.c tmc2000e.c tutor.c vip.c x68k.c z88.c zx.c |
| [src/mess/formats] | mz_cas.c thom_cas.c thom_dsk.c |
| [src/mess/includes] | apple1.h cbm.h cbmdrive.h coco.h vectrex.h zx.h |
| [src/mess/machine] | 6551.c 68901mfp.c 99_dsk.c amigacd.c amigacrt.c amigafdc.c amigakbd.c apple1.c apple2.c apple2gs.c applefdc.c at29040.c atom.c ay3600.c bbc.c c65.c cbmb.c cbmdrive.c centroni.c coco.c compis.c corvushd.c dai.c electron.c europc.c gamecom.c gb.c geneve.c hd63450.c hd63450.h hp48.c i8271.c ibmpc.c intv.c kc.c kim1.c lisa.c lviv.c lynx.c mac.c matsucd.c mc6843.c mc6846.c mc6854.c mfm.c microtan.c mm58274c.c mz700.c nec765.c nes_mmc.c odyssey2.c oric.c osborne1.c pc1251.c pc1350.c pc1401.c pc1403.c pc8801.c pc_hdc.c pc_joy.c pc_mouse.c pc_turbo.c pce.c pcf8593.c pclpt.c pdp1.c pet.c pmd85.c pokemini.c rp5c15.c rriot.c serial.c sgi.c sms.c tc8521.c thomson.c ti85.c ti990.c ti99_4x.c tms5501.c tms9901.c tms9902.c trs80.c tx0.c uart8250.c upd7002.c vc1541.c vc20tape.c vectrex.c wd17xx.c wswan.c z80dart.c zx.c |
| [src/mess/tools/messtest] | core.c core.h testmess.c tstutils.c |
| [src/mess/video] | 911_vdt.c abc80.c aim65.c apple1.c apple2.c atarist.c border.c cdp1861.c cdp1864.c coco3.c crtc6845.c gb.c kc.c m6845.c m6847.c m6847.h mz700.c odyssey2.c oric.c pc_cga.c pc_mda.c pc_vga.c saa5050.c smsvdp.c spectrum.c ted7360.c thomson.c vdc8563.c vectrex.c vic4567.c vic6560.c vic6567.c x68k.c zx.c zx8301.c |
| [src/osd/windows] | drawd3d.c drawdd.c input.c osinline.h |
| [src/osd/winui] | properties.c |
| r1293 | r1294 | |
|---|---|---|
| 182 | 182 | ctc_intf.baseclock = machine->drv->cpu[1].clock; |
| 183 | 183 | z80ctc_init (0, &ctc_intf); |
| 184 | 184 | |
| 185 | | |
| 185 | | |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 |
| r1293 | r1294 | |
|---|---|---|
| 23 | 23 | static int music2_latch = 0; |
| 24 | 24 | static int sound_signal = 0; |
| 25 | 25 | static int sound_volume = 0; |
| 26 | static | |
| 26 | static | |
| 27 | 27 | static int music_signal = 0; |
| 28 | 28 | static int music_volume = 0; |
| 29 | static | |
| 29 | static | |
| 30 | 30 | static int noise = 0; |
| 31 | 31 | |
| 32 | 32 | static TIMER_CALLBACK( sound_volume_decay ) |
| r1293 | r1294 | |
| 54 | 54 | * discharge C90(?) (1uF) through R13||R14 (22k||47k) |
| 55 | 55 | * 0.639 * 15k * 1uF -> 0.9585s |
| 56 | 56 | */ |
| 57 | mame_time period = scale_down_mame_time(scale_up_mame_time(MAME_TIME_IN_HZ(32768), 95850), 100000); | |
| 58 | mame_timer_adjust(sound_volume_timer, period, 0, period); | |
| 57 | attotime period = attotime_div(attotime_mul(ATTOTIME_IN_HZ(32768), 95850), 100000); | |
| 58 | timer_adjust(sound_volume_timer, period, 0, period); | |
| 59 | 59 | } |
| 60 | 60 | else |
| 61 | 61 | { |
| r1293 | r1294 | |
| 66 | 66 | * ...but this is not very realistic for the game sound :( |
| 67 | 67 | * maybe there _is_ a discharge through the diode D17? |
| 68 | 68 | */ |
| 69 | // mame_time period = scale_down_mame_time(scale_up_mame_time(MAME_TIME_IN_HZ(32768), 702900), 100000); | |
| 70 | mame_time period = scale_down_mame_time(scale_up_mame_time(MAME_TIME_IN_HZ(32768), 191700), 100000); | |
| 71 | mame_timer_adjust(sound_volume_timer, period, 0, period); | |
| 69 | // attotime period = attotime_div(attotime_mul(ATTOTIME_IN_HZ(32768), 702900), 100000); | |
| 70 | attotime period = attotime_div(attotime_mul(ATTOTIME_IN_HZ(32768), 191700), 100000); | |
| 71 | timer_adjust(sound_volume_timer, period, 0, period); | |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| r1293 | r1294 | |
| 102 | 102 | * 0.639 * 15k * 10uF -> 9.585s |
| 103 | 103 | * ...I'm sure this is off by one number of magnitude :/ |
| 104 | 104 | */ |
| 105 | mame_time period = scale_down_mame_time(scale_up_mame_time(MAME_TIME_IN_HZ(32768), 95850), 100000); | |
| 106 | mame_timer_adjust(music_volume_timer, period, 0, period); | |
| 105 | attotime period = attotime_div(attotime_mul(ATTOTIME_IN_HZ(32768), 95850), 100000); | |
| 106 | timer_adjust(music_volume_timer, period, 0, period); | |
| 107 | 107 | } |
| 108 | 108 | else |
| 109 | 109 | { |
| r1293 | r1294 | |
| 112 | 112 | * discharge C95(?) (10uF) through R14 (47k) |
| 113 | 113 | * 0.639 * 47k * 10uF -> 30.033s |
| 114 | 114 | */ |
| 115 | // mame_time period = scale_down_mame_time(scale_up_mame_time(MAME_TIME_IN_HZ(32768), 3003300), 100000); | |
| 116 | mame_time period = scale_down_mame_time(scale_up_mame_time(MAME_TIME_IN_HZ(32768), 300330), 100000); | |
| 117 | mame_timer_adjust(music_volume_timer, period, 0, period); | |
| 115 | // attotime period = attotime_div(attotime_mul(ATTOTIME_IN_HZ(32768), 3003300), 100000); | |
| 116 | attotime period = attotime_div(attotime_mul(ATTOTIME_IN_HZ(32768), 300330), 100000); | |
| 117 | timer_adjust(music_volume_timer, period, 0, period); | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | } |
| r1293 | r1294 | |
| 215 | 215 | |
| 216 | 216 | channel = stream_create(0, 1, CLOCK_16H, NULL, warpwarp_sound_update); |
| 217 | 217 | |
| 218 | sound_volume_timer = mame_timer_alloc(sound_volume_decay); | |
| 219 | music_volume_timer = mame_timer_alloc(music_volume_decay); | |
| 218 | sound_volume_timer = timer_alloc(sound_volume_decay); | |
| 219 | music_volume_timer = timer_alloc(music_volume_decay); | |
| 220 | 220 | return auto_malloc(1); |
| 221 | 221 | } |
| r1293 | r1294 | |
|---|---|---|
| 34 | 34 | { |
| 35 | 35 | UINT8 enabled; |
| 36 | 36 | UINT16 counter; |
| 37 | | |
| 37 | | |
| 38 | 38 | } timers[3]; |
| 39 | 39 | static sound_stream *channel; |
| 40 | 40 | static UINT8 DSPregs[256]; /* DSP registers */ |
| 41 | UINT8 snes_ipl_region[64]; /* SPC top 64 bytes */ | |
| 41 | static UINT8 snes_ipl_region[64]; /* SPC top 64 bytes */ | |
| 42 | 42 | |
| 43 | 43 | static const int gauss[]= |
| 44 | 44 | { |
| r1293 | r1294 | |
| 1153 | 1153 | channel = stream_create( 0, 2, 32000, NULL, snes_sh_update ); |
| 1154 | 1154 | |
| 1155 | 1155 | /* Initialize the timers */ |
| 1156 | timers[0].timer = mame_timer_alloc( snes_spc_timer ); | |
| 1157 | mame_timer_adjust( timers[0].timer, MAME_TIME_IN_HZ(8000), 0, MAME_TIME_IN_HZ(8000) ); | |
| 1158 | mame_timer_enable( timers[0].timer, 0 ); | |
| 1159 | timers[1].timer = mame_timer_alloc( snes_spc_timer ); | |
| 1160 | mame_timer_adjust( timers[1].timer, MAME_TIME_IN_HZ(8000), 1, MAME_TIME_IN_HZ(8000) ); | |
| 1161 | mame_timer_enable( timers[1].timer, 0 ); | |
| 1162 | timers[2].timer = mame_timer_alloc( snes_spc_timer ); | |
| 1163 | mame_timer_adjust( timers[2].timer, MAME_TIME_IN_HZ(64000), 2, MAME_TIME_IN_HZ(64000) ); | |
| 1164 | mame_timer_enable( timers[2].timer, 0 ); | |
| 1156 | timers[0].timer = timer_alloc( snes_spc_timer ); | |
| 1157 | timer_adjust( timers[0].timer, ATTOTIME_IN_HZ(8000), 0, ATTOTIME_IN_HZ(8000) ); | |
| 1158 | timer_enable( timers[0].timer, 0 ); | |
| 1159 | timers[1].timer = timer_alloc( snes_spc_timer ); | |
| 1160 | timer_adjust( timers[1].timer, ATTOTIME_IN_HZ(8000), 1, ATTOTIME_IN_HZ(8000) ); | |
| 1161 | timer_enable( timers[1].timer, 0 ); | |
| 1162 | timers[2].timer = timer_alloc( snes_spc_timer ); | |
| 1163 | timer_adjust( timers[2].timer, ATTOTIME_IN_HZ(64000), 2, ATTOTIME_IN_HZ(64000) ); | |
| 1164 | timer_enable( timers[2].timer, 0 ); | |
| 1165 | 1165 | |
| 1166 | 1166 | DSP_Reset(); |
| 1167 | 1167 | |
| r1293 | r1294 | |
| 1270 | 1270 | spc_ram[0xff] = 0; |
| 1271 | 1271 | } |
| 1272 | 1272 | timers[0].enabled = data & 0x1; |
| 1273 | | |
| 1273 | | |
| 1274 | 1274 | timers[1].enabled = (data & 0x2) >> 1; |
| 1275 | | |
| 1275 | | |
| 1276 | 1276 | timers[2].enabled = (data & 0x4) >> 2; |
| 1277 | | |
| 1277 | | |
| 1278 | 1278 | if( data & 0x10 ) |
| 1279 | 1279 | { |
| 1280 | 1280 | spc_port_in[0] = 0; |
| r1293 | r1294 | |
| 1309 | 1309 | case 0x7: /* Port 3 */ |
| 1310 | 1310 | // mame_printf_debug("SPC: %02x to APU @ %d (PC=%x)\n", data, offset&3, activecpu_get_pc()); |
| 1311 | 1311 | spc_port_out[offset - 4] = data; |
| 1312 | cpu_boost_interleave(time_zero, | |
| 1312 | cpu_boost_interleave(attotime_zero, | |
| 1313 | 1313 | break; |
| 1314 | 1314 | case 0xA: /* Timer 0 */ |
| 1315 | 1315 | case 0xB: /* Timer 1 */ |
| r1293 | r1294 | |
|---|---|---|
| 166 | 166 | static UINT16 dsp_regs[DSP_REGS]; |
| 167 | 167 | |
| 168 | 168 | static UINT16 serial_frequency; |
| 169 | static | |
| 169 | static | |
| 170 | 170 | |
| 171 | 171 | static UINT8 gpu_irq_state; |
| 172 | 172 | |
| r1293 | r1294 | |
| 285 | 285 | void cojag_sound_reset(void) |
| 286 | 286 | { |
| 287 | 287 | #if ENABLE_SPEEDUP_HACKS |
| 288 | serial_timer = | |
| 288 | serial_timer = | |
| 289 | 289 | #else |
| 290 | serial_timer = | |
| 290 | serial_timer = | |
| 291 | 291 | #endif |
| 292 | 292 | } |
| 293 | 293 | |
| r1293 | r1294 | |
| 461 | 461 | logerror("Unexpected write to SMODE = %X\n", data); |
| 462 | 462 | if ((data & 0x3f) == 0x15) |
| 463 | 463 | { |
| 464 | mame_time rate = scale_up_mame_time(MAME_TIME_IN_HZ(26000000), 32 * 2 * (serial_frequency + 1)); | |
| 465 | mame_timer_adjust(serial_timer, rate, 0, rate); | |
| 464 | attotime rate = attotime_mul(ATTOTIME_IN_HZ(26000000), 32 * 2 * (serial_frequency + 1)); | |
| 465 | timer_adjust(serial_timer, rate, 0, rate); | |
| 466 | 466 | } |
| 467 | 467 | break; |
| 468 | 468 |
| r1293 | r1294 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | static int n8080_hardware; |
| 15 | 15 | |
| 16 | static | |
| 16 | static | |
| 17 | 17 | |
| 18 | 18 | static int helifire_dac_phase; |
| 19 | 19 | |
| r1293 | r1294 | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
| 152 | static void start_mono_flop(int n, | |
| 152 | static void start_mono_flop(int n, | |
| 153 | 153 | { |
| 154 | 154 | mono_flop[n] = 1; |
| 155 | 155 | |
| 156 | 156 | update_SN76477_status(); |
| 157 | 157 | |
| 158 | | |
| 158 | | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | |
| r1293 | r1294 | |
| 165 | 165 | |
| 166 | 166 | update_SN76477_status(); |
| 167 | 167 | |
| 168 | | |
| 168 | | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | |
| r1293 | r1294 | |
| 189 | 189 | } |
| 190 | 190 | if (changes & (1 << 0x3)) |
| 191 | 191 | { |
| 192 | start_mono_flop(0, | |
| 192 | start_mono_flop(0, | |
| 193 | 193 | } |
| 194 | 194 | if (changes & (1 << 0x6)) |
| 195 | 195 | { |
| 196 | start_mono_flop(1, | |
| 196 | start_mono_flop(1, | |
| 197 | 197 | } |
| 198 | 198 | if (changes & (1 << 0x4)) |
| 199 | 199 | { |
| 200 | start_mono_flop(2, | |
| 200 | start_mono_flop(2, | |
| 201 | 201 | } |
| 202 | 202 | if (changes & ((1 << 0x2) | (1 << 0x3) | (1 << 0x5))) |
| 203 | 203 | { |
| r1293 | r1294 | |
| 216 | 216 | } |
| 217 | 217 | if (changes & (1 << 0x6)) |
| 218 | 218 | { |
| 219 | start_mono_flop(0, | |
| 219 | start_mono_flop(0, | |
| 220 | 220 | } |
| 221 | 221 | if (changes & (1 << 0x4)) |
| 222 | 222 | { |
| 223 | start_mono_flop(1, | |
| 223 | start_mono_flop(1, | |
| 224 | 224 | } |
| 225 | 225 | if (changes & ((1 << 0x2) | (1 << 0x3) | (1 << 0x5))) |
| 226 | 226 | { |
| r1293 | r1294 | |
| 434 | 434 | helifire_dac_timing = DECAY_RATE * log(helifire_dac_volume); |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | helifire_dac_timing += | |
| 437 | helifire_dac_timing += | |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | |
| r1293 | r1294 | |
| 444 | 444 | |
| 445 | 445 | if (mono_flop[2]) |
| 446 | 446 | { |
| 447 | voltage = 5 * (1 - exp(- | |
| 447 | voltage = 5 * (1 - exp(- | |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | SN76477_vco_voltage_w(0, voltage); |
| r1293 | r1294 | |
| 453 | 453 | |
| 454 | 454 | static TIMER_CALLBACK( helifire_dac_volume_timer ) |
| 455 | 455 | { |
| 456 | double t = helifire_dac_timing - | |
| 456 | double t = helifire_dac_timing - | |
| 457 | 457 | |
| 458 | 458 | if (helifire_dac_phase) |
| 459 | 459 | { |
| r1293 | r1294 | |
| 470 | 470 | { |
| 471 | 471 | n8080_hardware = 1; |
| 472 | 472 | |
| 473 | | |
| 473 | | |
| 474 | 474 | |
| 475 | sound_timer[0] = mame_timer_alloc(stop_mono_flop_callback); | |
| 476 | sound_timer[1] = mame_timer_alloc(stop_mono_flop_callback); | |
| 477 | sound_timer[2] = mame_timer_alloc(stop_mono_flop_callback); | |
| 475 | sound_timer[0] = timer_alloc(stop_mono_flop_callback); | |
| 476 | sound_timer[1] = timer_alloc(stop_mono_flop_callback); | |
| 477 | sound_timer[2] = timer_alloc(stop_mono_flop_callback); | |
| 478 | 478 | |
| 479 | 479 | mono_flop[0] = 0; |
| 480 | 480 | mono_flop[1] = 0; |
| r1293 | r1294 | |
| 489 | 489 | { |
| 490 | 490 | n8080_hardware = 2; |
| 491 | 491 | |
| 492 | sound_timer[0] = mame_timer_alloc(stop_mono_flop_callback); | |
| 493 | sound_timer[1] = mame_timer_alloc(stop_mono_flop_callback); | |
| 492 | sound_timer[0] = timer_alloc(stop_mono_flop_callback); | |
| 493 | sound_timer[1] = timer_alloc(stop_mono_flop_callback); | |
| 494 | 494 | |
| 495 | 495 | mono_flop[0] = 0; |
| 496 | 496 | mono_flop[1] = 0; |
| r1293 | r1294 | |
| 504 | 504 | { |
| 505 | 505 | n8080_hardware = 3; |
| 506 | 506 | |
| 507 | | |
| 507 | | |
| 508 | 508 | |
| 509 | 509 | helifire_dac_volume = 1; |
| 510 | 510 | helifire_dac_timing = 0; |
| r1293 | r1294 | |
|---|---|---|
| 44 | 44 | typedef struct _audio_channel audio_channel; |
| 45 | 45 | struct _audio_channel |
| 46 | 46 | { |
| 47 | | |
| 47 | | |
| 48 | 48 | UINT32 curlocation; |
| 49 | 49 | UINT16 curlength; |
| 50 | 50 | UINT16 curticks; |
| r1293 | r1294 | |
| 90 | 90 | { |
| 91 | 91 | chan->curlocation = CUSTOM_REG_LONG(REG_AUD0LCH + chan->index * 8); |
| 92 | 92 | chan->curlength = CUSTOM_REG(REG_AUD0LEN + chan->index * 8); |
| 93 | | |
| 93 | | |
| 94 | 94 | LOG(("dma_reload(%d): offs=%05X len=%04X\n", chan->index, chan->curlocation, chan->curlength)); |
| 95 | 95 | } |
| 96 | 96 | |
| r1293 | r1294 | |
| 271 | 271 | for (i = 0; i < 4; i++) |
| 272 | 272 | { |
| 273 | 273 | audio_state->channel[i].index = i; |
| 274 | audio_state->channel[i].irq_timer = | |
| 274 | audio_state->channel[i].irq_timer = | |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /* create the stream */ |
| r1293 | r1294 | |
|---|---|---|
| 1520 | 1520 | } |
| 1521 | 1521 | |
| 1522 | 1522 | |
| 1523 | ADDRESS_MAP_START( demon_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 1523 | static ADDRESS_MAP_START( demon_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 1524 | 1524 | AM_RANGE(0x0000, 0x1fff) AM_ROM |
| 1525 | 1525 | AM_RANGE(0x3000, 0x33ff) AM_RAM |
| 1526 | 1526 | AM_RANGE(0x4001, 0x4001) AM_READ(AY8910_read_port_0_r) |
| r1293 | r1294 | |
| 1536 | 1536 | ADDRESS_MAP_END |
| 1537 | 1537 | |
| 1538 | 1538 | |
| 1539 | ADDRESS_MAP_START( demon_sound_ports, ADDRESS_SPACE_IO, 8 ) | |
| 1539 | static ADDRESS_MAP_START( demon_sound_ports, ADDRESS_SPACE_IO, 8 ) | |
| 1540 | 1540 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 1541 | 1541 | AM_RANGE(0x00, 0x03) AM_WRITE(z80ctc_0_w) |
| 1542 | 1542 | AM_RANGE(0x1c, 0x1f) AM_WRITE(z80ctc_0_w) |
| r1293 | r1294 | |
|---|---|---|
| 37 | 37 | #define LOG(x) |
| 38 | 38 | #endif |
| 39 | 39 | |
| 40 | static | |
| 40 | static | |
| 41 | 41 | static INT32 freq = MAXFREQ; |
| 42 | 42 | |
| 43 | 43 | #define STEP 1 |
| r1293 | r1294 | |
| 69 | 69 | #define CHANNEL_SHOOT 1 |
| 70 | 70 | #define CHANNEL_LFO 2 |
| 71 | 71 | static sound_stream * tone_stream; |
| 72 | static | |
| 72 | static | |
| 73 | 73 | |
| 74 | 74 | static TIMER_CALLBACK( lfo_timer_cb ); |
| 75 | 75 | static TIMER_CALLBACK( galaxian_sh_update ); |
| r1293 | r1294 | |
| 363 | 363 | sample_set_volume(CHANNEL_LFO+2,0); |
| 364 | 364 | sample_start_raw(CHANNEL_LFO+2,backgroundwave,sizeof(backgroundwave)/2,1000,1); |
| 365 | 365 | |
| 366 | noisetimer = mame_timer_alloc(noise_timer_cb); | |
| 367 | mame_timer_adjust(noisetimer, MAME_TIME_IN_NSEC((155000+22000)/100*693*22), 0, MAME_TIME_IN_NSEC((155000+22000)/100*693*22)); | |
| 366 | noisetimer = timer_alloc(noise_timer_cb); | |
| 367 | timer_adjust(noisetimer, ATTOTIME_IN_NSEC((155000+22000)/100*693*22), 0, ATTOTIME_IN_NSEC((155000+22000)/100*693*22)); | |
| 368 | 368 | |
| 369 | lfotimer = | |
| 369 | lfotimer = | |
| 370 | 370 | |
| 371 | | |
| 371 | | |
| 372 | 372 | |
| 373 | 373 | state_save_register_global(freq); |
| 374 | 374 | state_save_register_global(noise_enable); |
| r1293 | r1294 | |
| 446 | 446 | #undef Vbe |
| 447 | 447 | #undef Vcc |
| 448 | 448 | logerror("lfo timer bits:%d%d%d%d r1:%d, r2:%d, re: %d, td: %9.2fsec\n", lfobit[0], lfobit[1], lfobit[2], lfobit[3], (int)r1, (int)r2, (int)Re, td); |
| 449 | | |
| 449 | | |
| 450 | 450 | #else |
| 451 | 451 | double r0, r1, rx = 100000.0; |
| 452 | 452 | |
| r1293 | r1294 | |
| 503 | 503 | rx = rx + 2000000.0 * r0 / (r0+r1); |
| 504 | 504 | |
| 505 | 505 | LOG(("lfotimer bits:%d%d%d%d r0:%d, r1:%d, rx: %d, time: %9.2fus\n", lfobit[3], lfobit[2], lfobit[1], lfobit[0], (int)r0, (int)r1, (int)rx, 0.639 * rx)); |
| 506 | | |
| 506 | | |
| 507 | 507 | #endif |
| 508 | 508 | } |
| 509 | 509 |
| r1293 | r1294 | |
|---|---|---|
| 107 | 107 | #else |
| 108 | 108 | |
| 109 | 109 | if (((data ^ last_sound_a) & 0x1e) && (last_sound_a & 0x1e) != 0x1e) |
| 110 | | |
| 110 | | |
| 111 | 111 | else |
| 112 | 112 | update_sound_a(data); |
| 113 | 113 |
| r1293 | r1294 | |
|---|---|---|
| 729 | 729 | * |
| 730 | 730 | *************************************/ |
| 731 | 731 | |
| 732 | ADDRESS_MAP_START( atarijsa1_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 732 | static ADDRESS_MAP_START( atarijsa1_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 733 | 733 | AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_RAM) |
| 734 | 734 | AM_RANGE(0x2000, 0x2001) AM_READ(YM2151_status_port_0_r) |
| 735 | 735 | AM_RANGE(0x2800, 0x2bff) AM_READ(jsa1_io_r) |
| r1293 | r1294 | |
| 737 | 737 | ADDRESS_MAP_END |
| 738 | 738 | |
| 739 | 739 | |
| 740 | ADDRESS_MAP_START( atarijsa1_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 740 | static ADDRESS_MAP_START( atarijsa1_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 741 | 741 | AM_RANGE(0x0000, 0x1fff) AM_WRITE(MWA8_RAM) |
| 742 | 742 | AM_RANGE(0x2000, 0x2000) AM_WRITE(YM2151_register_port_0_w) |
| 743 | 743 | AM_RANGE(0x2001, 0x2001) AM_WRITE(YM2151_data_port_0_w) |
| r1293 | r1294 | |
| 746 | 746 | ADDRESS_MAP_END |
| 747 | 747 | |
| 748 | 748 | |
| 749 | ADDRESS_MAP_START( atarijsa2_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 749 | static ADDRESS_MAP_START( atarijsa2_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 750 | 750 | AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_RAM) |
| 751 | 751 | AM_RANGE(0x2000, 0x2001) AM_READ(YM2151_status_port_0_r) |
| 752 | 752 | AM_RANGE(0x2800, 0x2bff) AM_READ(jsa2_io_r) |
| r1293 | r1294 | |
| 754 | 754 | ADDRESS_MAP_END |
| 755 | 755 | |
| 756 | 756 | |
| 757 | ADDRESS_MAP_START( atarijsa2_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 757 | static ADDRESS_MAP_START( atarijsa2_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 758 | 758 | AM_RANGE(0x0000, 0x1fff) AM_WRITE(MWA8_RAM) |
| 759 | 759 | AM_RANGE(0x2000, 0x2000) AM_WRITE(YM2151_register_port_0_w) |
| 760 | 760 | AM_RANGE(0x2001, 0x2001) AM_WRITE(YM2151_data_port_0_w) |
| r1293 | r1294 | |
| 764 | 764 | |
| 765 | 765 | |
| 766 | 766 | /* full map verified from schematics and Batman GALs */ |
| 767 | ADDRESS_MAP_START( atarijsa3_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 767 | static ADDRESS_MAP_START( atarijsa3_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 768 | 768 | AM_RANGE(0x0000, 0x1fff) AM_RAM |
| 769 | 769 | AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x07fe) AM_WRITE(YM2151_register_port_0_w) |
| 770 | 770 | AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x07fe) AM_WRITE(YM2151_data_port_0_w) |
| r1293 | r1294 | |
| 774 | 774 | ADDRESS_MAP_END |
| 775 | 775 | |
| 776 | 776 | |
| 777 | ADDRESS_MAP_START( atarijsa3s_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 777 | static ADDRESS_MAP_START( atarijsa3s_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 778 | 778 | AM_RANGE(0x0000, 0x1fff) AM_RAM |
| 779 | 779 | AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x07fe) AM_WRITE(YM2151_register_port_0_w) |
| 780 | 780 | AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x07fe) AM_WRITE(YM2151_data_port_0_w) |
| r1293 | r1294 | |
|---|---|---|
| 34 | 34 | *************************************/ |
| 35 | 35 | |
| 36 | 36 | static int cage_cpu; |
| 37 | static | |
| 37 | static | |
| 38 | 38 | |
| 39 | 39 | static UINT8 cpu_to_cage_ready; |
| 40 | 40 | static UINT8 cage_to_cpu_ready; |
| 41 | 41 | |
| 42 | 42 | static void (*cage_irqhandler)(int); |
| 43 | 43 | |
| 44 | static | |
| 44 | static | |
| 45 | 45 | |
| 46 | 46 | static UINT8 dma_enabled; |
| 47 | 47 | static UINT8 dma_timer_enabled; |
| 48 | static | |
| 48 | static | |
| 49 | 49 | |
| 50 | static UINT8 timer_enabled[2]; | |
| 51 | static mame_timer *timer[2]; | |
| 50 | static UINT8 cage_timer_enabled[2]; | |
| 51 | static emu_timer *timer[2]; | |
| 52 | 52 | |
| 53 | 53 | static UINT32 *tms32031_io_regs; |
| 54 | 54 | |
| r1293 | r1294 | |
| 153 | 153 | |
| 154 | 154 | void cage_init(int boot_region, offs_t speedup) |
| 155 | 155 | { |
| 156 | | |
| 156 | | |
| 157 | 157 | |
| 158 | 158 | cage_irqhandler = NULL; |
| 159 | 159 | |
| r1293 | r1294 | |
| 161 | 161 | memory_set_bankptr(11, memory_region(boot_region + 1)); |
| 162 | 162 | |
| 163 | 163 | cage_cpu = mame_find_cpu_index(Machine, "cage"); |
| 164 | cage_cpu_clock_period = MAME_TIME_IN_HZ(Machine->drv->cpu[cage_cpu].clock); | |
| 165 | cage_cpu_h1_clock_period = scale_up_mame_time(cage_cpu_clock_period, 2); | |
| 164 | cage_cpu_clock_period = ATTOTIME_IN_HZ(Machine->drv->cpu[cage_cpu].clock); | |
| 165 | cage_cpu_h1_clock_period = attotime_mul(cage_cpu_clock_period, 2); | |
| 166 | 166 | |
| 167 | dma_timer = mame_timer_alloc(dma_timer_callback); | |
| 168 | timer[0] = mame_timer_alloc(timer_callback); | |
| 169 | timer[1] = mame_timer_alloc(timer_callback); | |
| 167 | dma_timer = timer_alloc(dma_timer_callback); | |
| 168 | timer[0] = timer_alloc(timer_callback); | |
| 169 | timer[1] = timer_alloc(timer_callback); | |
| 170 | 170 | |
| 171 | 171 | if (speedup) |
| 172 | 172 | speedup_ram = memory_install_write32_handler(cage_cpu, ADDRESS_SPACE_PROGRAM, speedup, speedup, 0, 0, speedup_w); |
| r1293 | r1294 | |
| 201 | 201 | { |
| 202 | 202 | if (dma_timer_enabled) |
| 203 | 203 | { |
| 204 | | |
| 204 | | |
| 205 | 205 | dma_timer_enabled = 0; |
| 206 | 206 | } |
| 207 | 207 | return; |
| r1293 | r1294 | |
| 251 | 251 | /* compute the time of the interrupt and set the timer */ |
| 252 | 252 | if (!dma_timer_enabled) |
| 253 | 253 | { |
| 254 | mame_time period = scale_up_mame_time(serial_period_per_word, tms32031_io_regs[DMA_TRANSFER_COUNT]); | |
| 255 | mame_timer_adjust(dma_timer, period, addr, period); | |
| 254 | attotime period = attotime_mul(serial_period_per_word, tms32031_io_regs[DMA_TRANSFER_COUNT]); | |
| 255 | timer_adjust(dma_timer, period, addr, period); | |
| 256 | 256 | dma_timer_enabled = 1; |
| 257 | 257 | } |
| 258 | 258 | } |
| r1293 | r1294 | |
| 260 | 260 | /* see if we turned off */ |
| 261 | 261 | else if (!enabled && dma_enabled) |
| 262 | 262 | { |
| 263 | | |
| 263 | | |
| 264 | 264 | dma_timer_enabled = 0; |
| 265 | 265 | } |
| 266 | 266 | |
| r1293 | r1294 | |
| 282 | 282 | |
| 283 | 283 | /* set the interrupt */ |
| 284 | 284 | cpunum_set_input_line(cage_cpu, TMS32031_TINT0 + which, ASSERT_LINE); |
| 285 | timer_enabled[which] = 0; | |
| 285 | cage_timer_enabled[which] = 0; | |
| 286 | 286 | update_timer(which); |
| 287 | 287 | } |
| 288 | 288 | |
| r1293 | r1294 | |
| 294 | 294 | int enabled = ((tms32031_io_regs[base + TIMER0_GLOBAL_CTL] & 0xc0) == 0xc0); |
| 295 | 295 | |
| 296 | 296 | /* see if we turned on */ |
| 297 | if (enabled && !timer_enabled[which]) | |
| 297 | if (enabled && !cage_timer_enabled[which]) | |
| 298 | 298 | { |
| 299 | | |
| 299 | | |
| 300 | 300 | |
| 301 | 301 | /* make sure our assumptions are correct */ |
| 302 | 302 | if (tms32031_io_regs[base + TIMER0_GLOBAL_CTL] != 0x2c1) |
| 303 | 303 | logerror("CAGE TIMER%d: unexpected timer config %08X!\n", which, tms32031_io_regs[base + TIMER0_GLOBAL_CTL]); |
| 304 | 304 | |
| 305 | | |
| 305 | | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /* see if we turned off */ |
| 309 | else if (!enabled && timer_enabled[which]) | |
| 309 | else if (!enabled && cage_timer_enabled[which]) | |
| 310 | 310 | { |
| 311 | | |
| 311 | | |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /* set the new state */ |
| 315 | timer_enabled[which] = enabled; | |
| 315 | cage_timer_enabled[which] = enabled; | |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | |
| r1293 | r1294 | |
| 325 | 325 | |
| 326 | 326 | static void update_serial(void) |
| 327 | 327 | { |
| 328 | | |
| 328 | | |
| 329 | 329 | UINT32 freq; |
| 330 | 330 | |
| 331 | 331 | /* we start out at half the H1 frequency (or 2x the H1 period) */ |
| 332 | serial_clock_period = | |
| 332 | serial_clock_period = | |
| 333 | 333 | |
| 334 | 334 | /* if we're in clock mode, muliply by another factor of 2 */ |
| 335 | 335 | if (tms32031_io_regs[SPORT_GLOBAL_CTL] & 4) |
| 336 | serial_clock_period = | |
| 336 | serial_clock_period = | |
| 337 | 337 | |
| 338 | 338 | /* now multiply by the timer period */ |
| 339 | bit_clock_period = | |
| 339 | bit_clock_period = | |
| 340 | 340 | |
| 341 | 341 | /* and times the number of bits per sample */ |
| 342 | serial_period_per_word = | |
| 342 | serial_period_per_word = | |
| 343 | 343 | |
| 344 | 344 | /* compute the step value to stretch this to the sample_rate */ |
| 345 | freq = S | |
| 345 | freq = ATTOS | |
| 346 | 346 | if (freq > 0 && freq < 100000) |
| 347 | 347 | { |
| 348 | 348 | dmadac_set_frequency(0, DAC_BUFFER_CHANNELS, freq); |
| r1293 | r1294 | |
| 411 | 411 | |
| 412 | 412 | case SPORT_DATA_TX: |
| 413 | 413 | #if (DAC_BUFFER_CHANNELS == 4) |
| 414 | if ((int)S | |
| 414 | if ((int)ATTOS | |
| 415 | 415 | tms32031_io_regs[SPORT_RX_CTL] ^= 0x800; |
| 416 | 416 | #endif |
| 417 | 417 | break; |
| r1293 | r1294 | |
| 549 | 549 | |
| 550 | 550 | dma_enabled = 0; |
| 551 | 551 | dma_timer_enabled = 0; |
| 552 | | |
| 552 | | |
| 553 | 553 | |
| 554 | timer_enabled[0] = 0; | |
| 555 | timer_enabled[1] = 0; | |
| 556 | mame_timer_adjust(timer[0], time_never, 0, time_never); | |
| 557 | mame_timer_adjust(timer[1], time_never, 0, time_never); | |
| 554 | cage_timer_enabled[0] = 0; | |
| 555 | cage_timer_enabled[1] = 0; | |
| 556 | timer_adjust(timer[0], attotime_never, 0, attotime_never); | |
| 557 | timer_adjust(timer[1], attotime_never, 0, attotime_never); | |
| 558 | 558 | |
| 559 | 559 | memset(tms32031_io_regs, 0, 0x60 * 4); |
| 560 | 560 |
| r1293 | r1294 | |
|---|---|---|
| 128 | 128 | // The input clock to the 06XX interface chip is 64H, that is |
| 129 | 129 | // 18432000/6/64 = 48kHz, so it makes sense for the irq line to be |
| 130 | 130 | // asserted for one clock cycle ~= 21us. |
| 131 | | |
| 131 | | |
| 132 | 132 | } |
| r1293 | r1294 | |
|---|---|---|
| 54 | 54 | static TIMER_CALLBACK( senjyo_sh_update ) |
| 55 | 55 | { |
| 56 | 56 | /* ctc2 timer single tone generator frequency */ |
| 57 | mame_time period = z80ctc_getperiod (0, 2); | |
| 58 | if (compare_mame_times(period, time_zero) != 0 ) | |
| 59 | single_rate = SUBSECONDS_TO_HZ(period.subseconds); | |
| 57 | attotime period = z80ctc_getperiod (0, 2); | |
| 58 | if (attotime_compare(period, attotime_zero) != 0 ) | |
| 59 | single_rate = ATTOSECONDS_TO_HZ(period.attoseconds); | |
| 60 | 60 | else |
| 61 | 61 | single_rate = 0; |
| 62 | 62 | |
| r1293 | r1294 | |
| 84 | 84 | sample_set_volume(0,0); |
| 85 | 85 | sample_start_raw(0,_single,SINGLE_LENGTH,single_rate,1); |
| 86 | 86 | |
| 87 | | |
| 87 | | |
| 88 | 88 | } |
| r1293 | r1294 | |
|---|---|---|
| 404 | 404 | * |
| 405 | 405 | *************************************/ |
| 406 | 406 | |
| 407 | void exidy440_m6844_update(void) | |
| 407 | static void exidy440_m6844_update(void) | |
| 408 | 408 | { |
| 409 | 409 | /* update the stream */ |
| 410 | 410 | stream_update(stream); |
| r1293 | r1294 | |
|---|---|---|
| 39 | 39 | * |
| 40 | 40 | *************************************/ |
| 41 | 41 | |
| 42 | UINT8 mcr_sound_config; | |
| 42 | static UINT8 mcr_sound_config; | |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | |
| r1293 | r1294 | |
| 463 | 463 | /********* memory interfaces ***********/ |
| 464 | 464 | |
| 465 | 465 | /* address map verified from schematics */ |
| 466 | ADDRESS_MAP_START( ssio_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 466 | static ADDRESS_MAP_START( ssio_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 467 | 467 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 468 | 468 | AM_RANGE(0x0000, 0x3fff) AM_ROM |
| 469 | 469 | AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x0c00) AM_RAM |
| r1293 | r1294 | |
| 537 | 537 | |
| 538 | 538 | /* oftentimes games will write one nibble at a time; the sync on this is very */ |
| 539 | 539 | /* important, so we boost the interleave briefly while this happens */ |
| 540 | cpu_boost_interleave(time_zero, | |
| 540 | cpu_boost_interleave(attotime_zero, | |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | static READ16_HANDLER( csdeluxe_pia_r ) |
| r1293 | r1294 | |
| 581 | 581 | /********* memory interfaces ***********/ |
| 582 | 582 | |
| 583 | 583 | /* address map determined by PAL; not verified */ |
| 584 | ADDRESS_MAP_START( csdeluxe_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 584 | static ADDRESS_MAP_START( csdeluxe_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 585 | 585 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) | AMEF_ABITS(17) ) |
| 586 | 586 | AM_RANGE(0x000000, 0x007fff) AM_ROM |
| 587 | 587 | AM_RANGE(0x018000, 0x018007) AM_READWRITE(csdeluxe_pia_r, csdeluxe_pia_w) |
| r1293 | r1294 | |
| 657 | 657 | |
| 658 | 658 | /* oftentimes games will write one nibble at a time; the sync on this is very */ |
| 659 | 659 | /* important, so we boost the interleave briefly while this happens */ |
| 660 | cpu_boost_interleave(time_zero, | |
| 660 | cpu_boost_interleave(attotime_zero, | |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | |
| r1293 | r1294 | |
| 682 | 682 | /********* memory interfaces ***********/ |
| 683 | 683 | |
| 684 | 684 | /* address map determined by PAL; not verified */ |
| 685 | ADDRESS_MAP_START( soundsgood_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 685 | static ADDRESS_MAP_START( soundsgood_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 686 | 686 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) | AMEF_ABITS(19) ) |
| 687 | 687 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 688 | 688 | AM_RANGE(0x060000, 0x060007) AM_READWRITE(pia_1_msb_alt_r, pia_1_msb_alt_w) |
| r1293 | r1294 | |
| 748 | 748 | |
| 749 | 749 | /* oftentimes games will write one nibble at a time; the sync on this is very */ |
| 750 | 750 | /* important, so we boost the interleave briefly while this happens */ |
| 751 | cpu_boost_interleave(time_zero, | |
| 751 | cpu_boost_interleave(attotime_zero, | |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | |
| r1293 | r1294 | |
| 772 | 772 | /********* memory interfaces ***********/ |
| 773 | 773 | |
| 774 | 774 | /* address map verified from schematics */ |
| 775 | ADDRESS_MAP_START( turbocs_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 775 | static ADDRESS_MAP_START( turbocs_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 776 | 776 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 777 | 777 | AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x3800) AM_RAM |
| 778 | 778 | AM_RANGE(0x4000, 0x4003) AM_MIRROR(0x3ffc) AM_READWRITE(pia_0_alt_r, pia_0_alt_w) |
| r1293 | r1294 | |
| 896 | 896 | /* address map verified from schematics */ |
| 897 | 897 | /* note that jumpers control the ROM sizes; if these are changed, use the alternate */ |
| 898 | 898 | /* address map below */ |
| 899 | ADDRESS_MAP_START( squawkntalk_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 899 | static ADDRESS_MAP_START( squawkntalk_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 900 | 900 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 901 | 901 | AM_RANGE(0x0000, 0x007f) AM_RAM /* internal RAM */ |
| 902 | 902 | AM_RANGE(0x0080, 0x0083) AM_MIRROR(0x4f6c) AM_READWRITE(pia_0_r, pia_0_w) |
| r1293 | r1294 | |
| 907 | 907 | |
| 908 | 908 | /* alternate address map if the ROM jumpers are changed to support a smaller */ |
| 909 | 909 | /* ROM size of 2k */ |
| 910 | #ifdef UNUSED_FUNCTION | |
| 910 | 911 | ADDRESS_MAP_START( squawkntalk_alt_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 911 | 912 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 912 | 913 | AM_RANGE(0x0000, 0x007f) AM_RAM /* internal RAM */ |
| r1293 | r1294 | |
| 915 | 916 | AM_RANGE(0x0800, 0x0fff) AM_MIRROR(0x6000) AM_WRITE(squawkntalk_dac_w) |
| 916 | 917 | AM_RANGE(0x8000, 0x9fff) AM_MIRROR(0x6000) AM_ROM |
| 917 | 918 | ADDRESS_MAP_END |
| 919 | #endif | |
| 918 | 920 | |
| 919 | 921 | |
| 920 | 922 | /********* PIA interfaces ***********/ |
| r1293 | r1294 | |
|---|---|---|
| 317 | 317 | cpunum_set_input_line(usb.cpunum, INPUT_LINE_RESET, ASSERT_LINE); |
| 318 | 318 | |
| 319 | 319 | /* start the clock timer */ |
| 320 | | |
| 320 | | |
| 321 | 321 | usb.t1_clock_mask = t1_clock_mask; |
| 322 | 322 | } |
| 323 | 323 | |
| r1293 | r1294 | |
| 363 | 363 | timer_call_after_resynch(data, delayed_usb_data_w); |
| 364 | 364 | |
| 365 | 365 | /* boost the interleave so that sequences can be sent */ |
| 366 | cpu_boost_interleave(time_zero, | |
| 366 | cpu_boost_interleave(attotime_zero, | |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 |
| r1293 | r1294 | |
|---|---|---|
| 15 | 15 | * Oct 2004, Derrick Renaud |
| 16 | 16 | ************************************************************************/ |
| 17 | 17 | |
| 18 | static | |
| 18 | static | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | /* Discrete Sound Input Nodes */ |
| r1293 | r1294 | |
| 139 | 139 | |
| 140 | 140 | MACHINE_START( frogs_audio ) |
| 141 | 141 | { |
| 142 | frogs_croak_timer = | |
| 142 | frogs_croak_timer = | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
| r1293 | r1294 | |
| 168 | 168 | if (last_croak) |
| 169 | 169 | { |
| 170 | 170 | /* The croak will keep playing until .429s after being disabled */ |
| 171 | | |
| 171 | | |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | if (new_buzzz) |
| r1293 | r1294 | |
|---|---|---|
| 745 | 745 | #define HD38880_CMV 0x20 |
| 746 | 746 | #define HD68880_SYBS 0x0f |
| 747 | 747 | |
| 748 | int hd38880_cmd; | |
| 749 | UINT32 hd38880_addr; | |
| 750 | int hd38880_data_bytes; | |
| 751 | double hd38880_speed; | |
| 748 | static int hd38880_cmd; | |
| 749 | static UINT32 hd38880_addr; | |
| 750 | static int hd38880_data_bytes; | |
| 751 | static double hd38880_speed; | |
| 752 | 752 | |
| 753 | 753 | |
| 754 | 754 | static void rockola_speech_w(UINT8 data, UINT16 *table, int start) |
| r1293 | r1294 | |
|---|---|---|
| 128 | 128 | |
| 129 | 129 | |
| 130 | 130 | |
| 131 | ADDRESS_MAP_START( irem_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 131 | static ADDRESS_MAP_START( irem_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 132 | 132 | AM_RANGE(0x4000, 0xffff) AM_READ(MRA8_ROM) |
| 133 | 133 | ADDRESS_MAP_END |
| 134 | 134 | |
| 135 | ADDRESS_MAP_START( irem_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 135 | static ADDRESS_MAP_START( irem_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 136 | 136 | AM_RANGE(0x0800, 0x0800) AM_WRITE(MWA8_NOP) /* IACK */ |
| 137 | 137 | AM_RANGE(0x0801, 0x0802) AM_WRITE(irem_adpcm_w) |
| 138 | 138 | AM_RANGE(0x9000, 0x9000) AM_WRITE(MWA8_NOP) /* IACK */ |
| 139 | 139 | AM_RANGE(0x4000, 0xffff) AM_WRITE(MWA8_ROM) |
| 140 | 140 | ADDRESS_MAP_END |
| 141 | 141 | |
| 142 | ADDRESS_MAP_START( irem_sound_readport, ADDRESS_SPACE_IO, 8 ) | |
| 142 | static ADDRESS_MAP_START( irem_sound_readport, ADDRESS_SPACE_IO, 8 ) | |
| 143 | 143 | AM_RANGE(M6803_PORT1, M6803_PORT1) AM_READ(irem_port1_r) |
| 144 | 144 | AM_RANGE(M6803_PORT2, M6803_PORT2) AM_READ(irem_port2_r) |
| 145 | 145 | ADDRESS_MAP_END |
| 146 | 146 | |
| 147 | ADDRESS_MAP_START( irem_sound_writeport, ADDRESS_SPACE_IO, 8 ) | |
| 147 | static ADDRESS_MAP_START( irem_sound_writeport, ADDRESS_SPACE_IO, 8 ) | |
| 148 | 148 | AM_RANGE(M6803_PORT1, M6803_PORT1) AM_WRITE(irem_port1_w) |
| 149 | 149 | AM_RANGE(M6803_PORT2, M6803_PORT2) AM_WRITE(irem_port2_w) |
| 150 | 150 | ADDRESS_MAP_END |
| r1293 | r1294 | |
|---|---|---|
| 227 | 227 | UINT16 maxA; |
| 228 | 228 | UINT16 maxB; |
| 229 | 229 | UINT16 count; |
| 230 | mame_timer *int_timer; | |
| 231 | mame_timer *time_timer; | |
| 230 | emu_timer *int_timer; | |
| 231 | emu_timer *time_timer; | |
| 232 | 232 | UINT8 time_timer_active; |
| 233 | | |
| 233 | | |
| 234 | 234 | }; |
| 235 | 235 | |
| 236 | 236 | struct dma_state |
| r1293 | r1294 | |
| 240 | 240 | UINT16 count; |
| 241 | 241 | UINT16 control; |
| 242 | 242 | UINT8 finished; |
| 243 | | |
| 243 | | |
| 244 | 244 | }; |
| 245 | 245 | |
| 246 | 246 | struct intr_state |
| r1293 | r1294 | |
| 284 | 284 | |
| 285 | 285 | static struct counter_state |
| 286 | 286 | { |
| 287 | | |
| 287 | | |
| 288 | 288 | INT32 count; |
| 289 | 289 | UINT8 mode; |
| 290 | 290 | UINT8 readbyte; |
| r1293 | r1294 | |
| 526 | 526 | is_redline = 0; |
| 527 | 527 | |
| 528 | 528 | /* create timers here so they stick around */ |
| 529 | i80186.timer[0].int_timer = mame_timer_alloc(internal_timer_int); | |
| 530 | i80186.timer[1].int_timer = mame_timer_alloc(internal_timer_int); | |
| 531 | i80186.timer[2].int_timer = mame_timer_alloc(internal_timer_int); | |
| 532 | i80186.timer[0].time_timer = mame_timer_alloc(NULL); | |
| 533 | i80186.timer[1].time_timer = mame_timer_alloc(NULL); | |
| 534 | i80186.timer[2].time_timer = mame_timer_alloc(NULL); | |
| 535 | i80186.dma[0].finish_timer = mame_timer_alloc(dma_timer_callback); | |
| 536 | i80186.dma[1].finish_timer = mame_timer_alloc(dma_timer_callback); | |
| 529 | i80186.timer[0].int_timer = timer_alloc(internal_timer_int); | |
| 530 | i80186.timer[1].int_timer = timer_alloc(internal_timer_int); | |
| 531 | i80186.timer[2].int_timer = timer_alloc(internal_timer_int); | |
| 532 | i80186.timer[0].time_timer = timer_alloc(NULL); | |
| 533 | i80186.timer[1].time_timer = timer_alloc(NULL); | |
| 534 | i80186.timer[2].time_timer = timer_alloc(NULL); | |
| 535 | i80186.dma[0].finish_timer = timer_alloc(dma_timer_callback); | |
| 536 | i80186.dma[1].finish_timer = timer_alloc(dma_timer_callback); | |
| 537 | 537 | |
| 538 | 538 | for (i = 0; i < 9; i++) |
| 539 | counter[i].timer = | |
| 539 | counter[i].timer = | |
| 540 | 540 | |
| 541 | 541 | return auto_malloc(1); |
| 542 | 542 | } |
| r1293 | r1294 | |
| 553 | 553 | static void leland_80186_reset(void) |
| 554 | 554 | { |
| 555 | 555 | struct i80186_state oldstate = i80186; |
| 556 | | |
| 556 | | |
| 557 | 557 | int i; |
| 558 | 558 | |
| 559 | 559 | /* reset the i80186 state, but save the timers */ |
| r1293 | r1294 | |
| 612 | 612 | |
| 613 | 613 | static int int_callback(int line) |
| 614 | 614 | { |
| 615 | if (LOG_INTERRUPTS) logerror("(%f) **** Acknowledged interrupt vector %02X\n", | |
| 615 | if (LOG_INTERRUPTS) logerror("(%f) **** Acknowledged interrupt vector %02X\n", | |
| 616 | 616 | |
| 617 | 617 | /* clear the interrupt */ |
| 618 | 618 | activecpu_set_info_int(CPUINFO_INT_INPUT_STATE + 0, CLEAR_LINE); |
| r1293 | r1294 | |
| 725 | 725 | if (!i80186.intr.pending) |
| 726 | 726 | cpunum_set_input_line(2, 0, ASSERT_LINE); |
| 727 | 727 | i80186.intr.pending = 1; |
| 728 | if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", | |
| 728 | if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", | |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | |
| r1293 | r1294 | |
| 750 | 750 | case 0x0f: i80186.intr.in_service &= ~0x80; break; |
| 751 | 751 | default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", activecpu_get_pc(), data & 0x1f); |
| 752 | 752 | } |
| 753 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", | |
| 753 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", | |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | /* non-specific case */ |
| r1293 | r1294 | |
| 763 | 763 | if ((i80186.intr.timer & 7) == i && (i80186.intr.in_service & 0x01)) |
| 764 | 764 | { |
| 765 | 765 | i80186.intr.in_service &= ~0x01; |
| 766 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", | |
| 766 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", | |
| 767 | 767 | return; |
| 768 | 768 | } |
| 769 | 769 | |
| r1293 | r1294 | |
| 772 | 772 | if ((i80186.intr.dma[j] & 7) == i && (i80186.intr.in_service & (0x04 << j))) |
| 773 | 773 | { |
| 774 | 774 | i80186.intr.in_service &= ~(0x04 << j); |
| 775 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", | |
| 775 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", | |
| 776 | 776 | return; |
| 777 | 777 | } |
| 778 | 778 | |
| r1293 | r1294 | |
| 781 | 781 | if ((i80186.intr.ext[j] & 7) == i && (i80186.intr.in_service & (0x10 << j))) |
| 782 | 782 | { |
| 783 | 783 | i80186.intr.in_service &= ~(0x10 << j); |
| 784 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", | |
| 784 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", | |
| 785 | 785 | return; |
| 786 | 786 | } |
| 787 | 787 | } |
| r1293 | r1294 | |
| 818 | 818 | if (t->control & 0x0001) |
| 819 | 819 | { |
| 820 | 820 | int count = t->maxA ? t->maxA : 0x10000; |
| 821 | | |
| 821 | | |
| 822 | 822 | if (LOG_TIMER) logerror(" Repriming interrupt\n"); |
| 823 | 823 | } |
| 824 | 824 | else |
| 825 | | |
| 825 | | |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | |
| r1293 | r1294 | |
| 833 | 833 | /* if we have a timing timer running, adjust the count */ |
| 834 | 834 | if (t->time_timer_active) |
| 835 | 835 | { |
| 836 | mame_time current_time = mame_timer_timeelapsed(t->time_timer); | |
| 837 | int net_clocks = mame_time_to_double(scale_up_mame_time(sub_mame_times(current_time, t->last_time), 2000000)); | |
| 836 | attotime current_time = timer_timeelapsed(t->time_timer); | |
| 837 | int net_clocks = attotime_to_double(attotime_mul(attotime_sub(current_time, t->last_time), 2000000)); | |
| 838 | 838 | t->last_time = current_time; |
| 839 | 839 | |
| 840 | 840 | /* set the max count bit if we passed the max */ |
| r1293 | r1294 | |
| 936 | 936 | internal_timer_sync(which); |
| 937 | 937 | |
| 938 | 938 | /* nuke the timer and force the interrupt timer to be recomputed */ |
| 939 | | |
| 939 | | |
| 940 | 940 | t->time_timer_active = 0; |
| 941 | 941 | update_int_timer = 1; |
| 942 | 942 | } |
| r1293 | r1294 | |
| 945 | 945 | else if ((diff & 0x8000) && (new_control & 0x8000)) |
| 946 | 946 | { |
| 947 | 947 | /* start the timing */ |
| 948 | | |
| 948 | | |
| 949 | 949 | t->time_timer_active = 1; |
| 950 | 950 | update_int_timer = 1; |
| 951 | 951 | } |
| r1293 | r1294 | |
| 974 | 974 | { |
| 975 | 975 | int diff = t->maxA - t->count; |
| 976 | 976 | if (diff <= 0) diff += 0x10000; |
| 977 | | |
| 977 | | |
| 978 | 978 | if (LOG_TIMER) logerror("Set interrupt timer for %d\n", which); |
| 979 | 979 | } |
| 980 | 980 | else |
| 981 | | |
| 981 | | |
| 982 | 982 | } |
| 983 | 983 | } |
| 984 | 984 | |
| r1293 | r1294 | |
| 1063 | 1063 | if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest); |
| 1064 | 1064 | |
| 1065 | 1065 | d->finished = 0; |
| 1066 | | |
| 1066 | | |
| 1067 | 1067 | } |
| 1068 | 1068 | } |
| 1069 | 1069 | |
| r1293 | r1294 | |
| 1524 | 1524 | if (counter[which].timer) |
| 1525 | 1525 | { |
| 1526 | 1526 | /* determine how many 2MHz cycles are remaining */ |
| 1527 | int count = | |
| 1527 | int count = | |
| 1528 | 1528 | counter[which].count = (count < 0) ? 0 : count; |
| 1529 | 1529 | } |
| 1530 | 1530 | } |
| r1293 | r1294 | |
| 1606 | 1606 | if (ctr->count == 0) ctr->count = 0x10000; |
| 1607 | 1607 | |
| 1608 | 1608 | /* reset/start the timer */ |
| 1609 | | |
| 1609 | | |
| 1610 | 1610 | |
| 1611 | 1611 | if (LOG_PIT) logerror("PIT counter %d set to %d (%d Hz)\n", which, ctr->count, 4000000 / ctr->count); |
| 1612 | 1612 |
| r1293 | r1294 | |
|---|---|---|
| 7 | 7 | static UINT16 es5510_dsp_ram[0x200]; |
| 8 | 8 | static UINT32 es5510_gpr[0xc0]; |
| 9 | 9 | static UINT32 es5510_gpr_latch; |
| 10 | static | |
| 10 | static | |
| 11 | 11 | static int timer_mode,m68681_imr; |
| 12 | 12 | |
| 13 | 13 | static int es_tmp=1; |
| r1293 | r1294 | |
| 80 | 80 | |
| 81 | 81 | void f3_68681_reset(void) |
| 82 | 82 | { |
| 83 | timer_68681 = | |
| 83 | timer_68681 = | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | READ16_HANDLER(f3_68681_r) |
| r1293 | r1294 | |
| 120 | 120 | case 3: |
| 121 | 121 | logerror("Counter: X1/Clk - divided by 16, counter is %04x, so interrupt every %d cycles\n",counter,(M68000_CLOCK/M68681_CLOCK)*counter*16); |
| 122 | 122 | timer_mode=TIMER_SINGLESHOT; |
| 123 | | |
| 123 | | |
| 124 | 124 | break; |
| 125 | 125 | case 4: |
| 126 | 126 | logerror("Timer: Unimplemented external IP2\n"); |
| r1293 | r1294 | |
| 131 | 131 | case 6: |
| 132 | 132 | logerror("Timer: X1/Clk, counter is %04x, so interrupt every %d cycles\n",counter,(M68000_CLOCK/M68681_CLOCK)*counter); |
| 133 | 133 | timer_mode=TIMER_PULSE; |
| 134 | | |
| 134 | | |
| 135 | 135 | break; |
| 136 | 136 | case 7: |
| 137 | 137 | logerror("Timer: Unimplemented X1/Clk - divided by 16\n"); |
| r1293 | r1294 | |
|---|---|---|
| 13 | 13 | #include "sound/custom.h" |
| 14 | 14 | #include "includes/warpwarp.h" |
| 15 | 15 | |
| 16 | static | |
| 16 | static | |
| 17 | 17 | static UINT16 *decay = NULL; |
| 18 | 18 | static sound_stream *channel; |
| 19 | 19 | static int sound_latch = 0; |
| r1293 | r1294 | |
| 45 | 45 | * Decay: |
| 46 | 46 | * discharge C33 (1uF) through R50 (22k) -> 0.14058s |
| 47 | 47 | */ |
| 48 | mame_time period = scale_down_mame_time(scale_up_mame_time(MAME_TIME_IN_HZ(32768), 14058), 100000); | |
| 49 | mame_timer_adjust(volume_timer, period, 0, period); | |
| 48 | attotime period = attotime_div(attotime_mul(ATTOTIME_IN_HZ(32768), 14058), 100000); | |
| 49 | timer_adjust(volume_timer, period, 0, period); | |
| 50 | 50 | } |
| 51 | 51 | else |
| 52 | 52 | { |
| r1293 | r1294 | |
| 57 | 57 | * I can only guess here that the decay should be slower, |
| 58 | 58 | * maybe half as fast? |
| 59 | 59 | */ |
| 60 | mame_time period = scale_down_mame_time(scale_up_mame_time(MAME_TIME_IN_HZ(32768), 29060), 100000); | |
| 61 | mame_timer_adjust(volume_timer, period, 0, period); | |
| 60 | attotime period = attotime_div(attotime_mul(ATTOTIME_IN_HZ(32768), 29060), 100000); | |
| 61 | timer_adjust(volume_timer, period, 0, period); | |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| r1293 | r1294 | |
| 125 | 125 | channel = stream_create(0, 1, 18432000 / 3 / 2 / 384, NULL, geebee_sound_update); |
| 126 | 126 | vcount = 0; |
| 127 | 127 | |
| 128 | volume_timer = | |
| 128 | volume_timer = | |
| 129 | 129 | return auto_malloc(1); |
| 130 | 130 | } |
| r1293 | r1294 | |
|---|---|---|
| 67 | 67 | #define T8253_CWORD 3 |
| 68 | 68 | |
| 69 | 69 | |
| 70 | void timer8253_reset(struct timer8253struct *t) { | |
| 70 | static void timer8253_reset(struct timer8253struct *t) { | |
| 71 | 71 | memset(t,0,sizeof(struct timer8253struct)); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | |
| 75 | void timer8253_tick(struct timer8253struct *t,int chn) { | |
| 75 | static void timer8253_tick(struct timer8253struct *t,int chn) { | |
| 76 | 76 | if (t->channel[chn].enable && t->channel[chn].gate) { |
| 77 | 77 | switch (t->channel[chn].cntMode) { |
| 78 | 78 | case 0: |
| r1293 | r1294 | |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | |
| 112 | void timer8253_wr(struct timer8253struct *t, int reg, UINT8 val) | |
| 112 | static void timer8253_wr(struct timer8253struct *t, int reg, UINT8 val) | |
| 113 | 113 | { |
| 114 | 114 | int chn; |
| 115 | 115 | |
| r1293 | r1294 | |
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | void timer8253_set_gate(struct timer8253struct *t, int chn, UINT8 gate) | |
| 216 | static void timer8253_set_gate(struct timer8253struct *t, int chn, UINT8 gate) | |
| 217 | 217 | { |
| 218 | 218 | t->channel[chn].gate = gate; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | |
| 222 | 222 | |
| 223 | char timer8253_get_output(struct timer8253struct *t, int chn) | |
| 223 | static char timer8253_get_output(struct timer8253struct *t, int chn) | |
| 224 | 224 | { |
| 225 | 225 | return t->channel[chn].output; |
| 226 | 226 | } |
| r1293 | r1294 | |
|---|---|---|
| 44 | 44 | static UINT8 square_state; |
| 45 | 45 | static UINT8 square_count; |
| 46 | 46 | |
| 47 | static | |
| 47 | static | |
| 48 | 48 | static sound_stream *sega005_stream; |
| 49 | 49 | |
| 50 | 50 | static UINT8 n7751_command; |
| r1293 | r1294 | |
| 519 | 519 | if ((diff & 0x20) && !(newval & 0x20)) |
| 520 | 520 | { |
| 521 | 521 | //mame_printf_debug("Stopping timer\n"); |
| 522 | | |
| 522 | | |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | /* if bit 5 goes low, we start the timer again */ |
| 526 | 526 | if ((diff & 0x20) && (newval & 0x20)) |
| 527 | 527 | { |
| 528 | 528 | //mame_printf_debug("Starting timer\n"); |
| 529 | | |
| 529 | | |
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | 532 | |
| r1293 | r1294 | |
| 579 | 579 | sega005_stream = stream_create(0, 1, SEGA005_COUNTER_FREQ, NULL, sega005_stream_update); |
| 580 | 580 | |
| 581 | 581 | /* create a timer for the 555 */ |
| 582 | sega005_sound_timer = | |
| 582 | sega005_sound_timer = | |
| 583 | 583 | |
| 584 | 584 | /* set the initial sound data */ |
| 585 | 585 | sound_data = 0x00; |
| r1293 | r1294 | |
| 632 | 632 | |
| 633 | 633 | static SOUND_START( spaceod ); |
| 634 | 634 | |
| 635 | const char *spaceod_sample_names[] = | |
| 635 | static const char *spaceod_sample_names[] = | |
| 636 | 636 | { |
| 637 | 637 | "*spaceod", |
| 638 | 638 | "fire.wav", /* 0 */ |
| r1293 | r1294 | |
| 796 | 796 | * |
| 797 | 797 | *************************************/ |
| 798 | 798 | |
| 799 | ADDRESS_MAP_START( monsterb_7751_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 799 | static ADDRESS_MAP_START( monsterb_7751_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 800 | 800 | AM_RANGE(0x0000, 0x03ff) AM_ROM |
| 801 | 801 | ADDRESS_MAP_END |
| 802 | 802 | |
| 803 | ADDRESS_MAP_START( monsterb_7751_portmap, ADDRESS_SPACE_IO, 8 ) | |
| 803 | static ADDRESS_MAP_START( monsterb_7751_portmap, ADDRESS_SPACE_IO, 8 ) | |
| 804 | 804 | AM_RANGE(I8039_t1, I8039_t1) AM_READ(n7751_t1_r) |
| 805 | 805 | AM_RANGE(I8039_p2, I8039_p2) AM_READ(n7751_command_r) |
| 806 | 806 | AM_RANGE(I8039_bus, I8039_bus) AM_READ(n7751_rom_r) |
| r1293 | r1294 | |
| 934 | 934 | */ |
| 935 | 935 | n7751_command = data & 0x07; |
| 936 | 936 | cpunum_set_input_line(1, 0, ((data & 0x08) == 0) ? ASSERT_LINE : CLEAR_LINE); |
| 937 | cpu_boost_interleave(time_zero, | |
| 937 | cpu_boost_interleave(attotime_zero, | |
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 |
| r1293 | r1294 | |
|---|---|---|
| 36 | 36 | STATIC GLOBALS |
| 37 | 37 | ****************************************************************************/ |
| 38 | 38 | |
| 39 | UINT8 williams_sound_int_state; | |
| 39 | static UINT8 williams_sound_int_state; | |
| 40 | 40 | |
| 41 | 41 | static UINT8 audio_talkback; |
| 42 | 42 | |
| r1293 | r1294 | |
| 84 | 84 | ****************************************************************************/ |
| 85 | 85 | |
| 86 | 86 | /* CVSD readmem/writemem structures */ |
| 87 | ADDRESS_MAP_START( williams_cvsd_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 87 | static ADDRESS_MAP_START( williams_cvsd_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 88 | 88 | AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM |
| 89 | 89 | AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x1ffe) AM_WRITE(YM2151_register_port_0_w) |
| 90 | 90 | AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x1ffe) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w) |
| r1293 | r1294 | |
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | /* NARC master readmem/writemem structures */ |
| 100 | ADDRESS_MAP_START( williams_narc_master_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 100 | static ADDRESS_MAP_START( williams_narc_master_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 101 | 101 | AM_RANGE(0x0000, 0x1fff) AM_RAM |
| 102 | 102 | AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x03fe) AM_WRITE(YM2151_register_port_0_w) |
| 103 | 103 | AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x03fe) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w) |
| r1293 | r1294 | |
| 112 | 112 | ADDRESS_MAP_END |
| 113 | 113 | |
| 114 | 114 | /* NARC slave readmem/writemem structures */ |
| 115 | ADDRESS_MAP_START( williams_narc_slave_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 115 | static ADDRESS_MAP_START( williams_narc_slave_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 116 | 116 | AM_RANGE(0x0000, 0x1fff) AM_RAM |
| 117 | 117 | AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x03ff) AM_WRITE(hc55516_0_clock_set_w) |
| 118 | 118 | AM_RANGE(0x2400, 0x2400) AM_MIRROR(0x03ff) AM_WRITE(hc55516_0_digit_clock_clear_w) |
| r1293 | r1294 | |
| 127 | 127 | |
| 128 | 128 | |
| 129 | 129 | /* ADPCM readmem/writemem structures */ |
| 130 | ADDRESS_MAP_START( williams_adpcm_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 130 | static ADDRESS_MAP_START( williams_adpcm_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 131 | 131 | AM_RANGE(0x0000, 0x1fff) AM_RAM |
| 132 | 132 | AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x03ff) AM_WRITE(adpcm_bank_select_w) |
| 133 | 133 | AM_RANGE(0x2400, 0x2400) AM_MIRROR(0x03fe) AM_WRITE(YM2151_register_port_0_w) |
| r1293 | r1294 | |
|---|---|---|
| 39 | 39 | if ((data & 0x0f) != 8) |
| 40 | 40 | { |
| 41 | 41 | cpunum_set_input_line(2, INPUT_LINE_RESET, PULSE_LINE); |
| 42 | | |
| 42 | | |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 |
| r1293 | r1294 | |
|---|---|---|
| 158 | 158 | /* Should be decrementing every data*1024 6532 clock cycles */ |
| 159 | 159 | /* 6532 runs at 1.5 MHz */ |
| 160 | 160 | |
| 161 | | |
| 161 | | |
| 162 | 162 | return; |
| 163 | 163 | |
| 164 | 164 | default: |
| r1293 | r1294 | |
| 181 | 181 | { |
| 182 | 182 | port_A |= 0x40; /* result from sound cpu pending */ |
| 183 | 183 | main_data = param; |
| 184 | cpu_boost_interleave(time_zero, | |
| 184 | cpu_boost_interleave(attotime_zero, | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | READ8_HANDLER( starwars_sin_r ) |
| r1293 | r1294 | |
| 225 | 225 | |
| 226 | 226 | port_A |= 0x80; /* command from main cpu pending */ |
| 227 | 227 | sound_data = param; |
| 228 | cpu_boost_interleave(time_zero, | |
| 228 | cpu_boost_interleave(attotime_zero, | |
| 229 | 229 | |
| 230 | 230 | if (PA7_irq) |
| 231 | 231 | cpunum_set_input_line(1, M6809_IRQ_LINE, ASSERT_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | #ifdef UNUSED_FUNCTION | |
| 89 | 90 | void gottlieb_knocker(void) |
| 90 | 91 | { |
| 91 | 92 | if (!strcmp(Machine->gamedrv->name,"reactor")) /* reactor */ |
| r1293 | r1294 | |
| 94 | 95 | else if (sndti_exists(SOUND_SAMPLES, 0)) /* qbert */ |
| 95 | 96 | sample_start(0,44,0); |
| 96 | 97 | } |
| 98 | #endif | |
| 97 | 99 | |
| 98 | 100 | /* callback for the timer */ |
| 99 | 101 | static TIMER_CALLBACK( gottlieb_nmi_generate ) |
| r1293 | r1294 | |
| 148 | 150 | } |
| 149 | 151 | |
| 150 | 152 | /* generate a NMI after a while to make the CPU continue to send data */ |
| 151 | | |
| 153 | | |
| 152 | 154 | } |
| 153 | 155 | |
| 154 | 156 | WRITE8_HANDLER( gottlieb_speech_clock_DAC_w ) |
| r1293 | r1294 | |
| 199 | 201 | |
| 200 | 202 | |
| 201 | 203 | static UINT8 psg_latch; |
| 202 | static | |
| 204 | static | |
| 203 | 205 | static int nmi_rate; |
| 204 | 206 | static int sp0250_drq; |
| 205 | 207 | static UINT8 sp0250_latch; |
| r1293 | r1294 | |
| 207 | 209 | static TIMER_CALLBACK( nmi_callback ); |
| 208 | 210 | void gottlieb_sound_init(void) |
| 209 | 211 | { |
| 210 | nmi_timer = | |
| 212 | nmi_timer = | |
| 211 | 213 | } |
| 212 | 214 | |
| 213 | 215 | void stooges_sp0250_drq(int level) |
| r1293 | r1294 | |
| 245 | 247 | if (data & 0x01) |
| 246 | 248 | { |
| 247 | 249 | /* base clock is 250kHz divided by 256 */ |
| 248 | mame_time interval = scale_up_mame_time(MAME_TIME_IN_HZ(250000), 256 * (256-nmi_rate)); | |
| 249 | mame_timer_adjust(nmi_timer, interval, 0, interval); | |
| 250 | attotime interval = attotime_mul(ATTOTIME_IN_HZ(250000), 256 * (256-nmi_rate)); | |
| 251 | timer_adjust(nmi_timer, interval, 0, interval); | |
| 250 | 252 | } |
| 251 | 253 | else |
| 252 | | |
| 254 | | |
| 253 | 255 | |
| 254 | 256 | /* Bit 1 controls a LED on the sound board. I'm not emulating it */ |
| 255 | 257 | } |
| r1293 | r1294 | |
|---|---|---|
| 292 | 292 | UINT8 channels; |
| 293 | 293 | UINT16 size; |
| 294 | 294 | UINT16 incs; |
| 295 | mame_timer *reg_timer; | |
| 296 | mame_timer *sport_timer; | |
| 297 | mame_timer *internal_timer; | |
| 295 | emu_timer *reg_timer; | |
| 296 | emu_timer *sport_timer; | |
| 297 | emu_timer *internal_timer; | |
| 298 | 298 | INT32 ireg; |
| 299 | 299 | UINT16 ireg_base; |
| 300 | 300 | UINT16 control_regs[32]; |
| r1293 | r1294 | |
| 343 | 343 | INT32 writes_left; |
| 344 | 344 | UINT16 sum; |
| 345 | 345 | INT32 fifo_entries; |
| 346 | | |
| 346 | | |
| 347 | 347 | }; |
| 348 | 348 | |
| 349 | 349 | |
| r1293 | r1294 | |
| 423 | 423 | *************************************/ |
| 424 | 424 | |
| 425 | 425 | /* DCS 2k memory map */ |
| 426 | ADDRESS_MAP_START( dcs_2k_program_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 426 | static ADDRESS_MAP_START( dcs_2k_program_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 427 | 427 | AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&dcs_internal_program_ram) |
| 428 | 428 | AM_RANGE(0x0800, 0x0fff) AM_RAM AM_SHARE(1) AM_BASE(&dcs_external_program_ram) |
| 429 | 429 | AM_RANGE(0x1000, 0x17ff) AM_RAM AM_SHARE(1) |
| 430 | 430 | AM_RANGE(0x1800, 0x1fff) AM_RAM AM_SHARE(1) |
| 431 | 431 | ADDRESS_MAP_END |
| 432 | 432 | |
| 433 | ADDRESS_MAP_START( dcs_2k_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 433 | static ADDRESS_MAP_START( dcs_2k_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 434 | 434 | AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_READWRITE(dcs_dataram_r, dcs_dataram_w) |
| 435 | 435 | AM_RANGE(0x2000, 0x2fff) AM_ROMBANK(20) |
| 436 | 436 | AM_RANGE(0x3000, 0x33ff) AM_WRITE(dcs_data_bank_select_w) |
| r1293 | r1294 | |
| 441 | 441 | |
| 442 | 442 | |
| 443 | 443 | /* DCS 2k with UART memory map */ |
| 444 | ADDRESS_MAP_START( dcs_2k_uart_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 444 | static ADDRESS_MAP_START( dcs_2k_uart_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 445 | 445 | AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_READWRITE(dcs_dataram_r, dcs_dataram_w) |
| 446 | 446 | AM_RANGE(0x2000, 0x2fff) AM_ROMBANK(20) |
| 447 | 447 | AM_RANGE(0x3000, 0x33ff) AM_WRITE(dcs_data_bank_select_w) |
| r1293 | r1294 | |
| 454 | 454 | |
| 455 | 455 | |
| 456 | 456 | /* DCS 8k memory map */ |
| 457 | ADDRESS_MAP_START( dcs_8k_program_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 457 | static ADDRESS_MAP_START( dcs_8k_program_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 458 | 458 | AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&dcs_internal_program_ram) |
| 459 | 459 | AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE(&dcs_external_program_ram) |
| 460 | 460 | ADDRESS_MAP_END |
| 461 | 461 | |
| 462 | ADDRESS_MAP_START( dcs_8k_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 462 | static ADDRESS_MAP_START( dcs_8k_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 463 | 463 | AM_RANGE(0x0000, 0x07ff) AM_RAM |
| 464 | 464 | AM_RANGE(0x0800, 0x1fff) AM_READWRITE(dcs_dataram_r, dcs_dataram_w) |
| 465 | 465 | AM_RANGE(0x2000, 0x2fff) AM_ROMBANK(20) |
| r1293 | r1294 | |
| 477 | 477 | * |
| 478 | 478 | *************************************/ |
| 479 | 479 | |
| 480 | ADDRESS_MAP_START( dcs2_program_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 480 | static ADDRESS_MAP_START( dcs2_program_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 481 | 481 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 482 | 482 | AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&dcs_internal_program_ram) |
| 483 | 483 | ADDRESS_MAP_END |
| 484 | 484 | |
| 485 | 485 | |
| 486 | ADDRESS_MAP_START( dcs2_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 486 | static ADDRESS_MAP_START( dcs2_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 487 | 487 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 488 | 488 | AM_RANGE(0x0400, 0x0400) AM_READWRITE(input_latch_r, input_latch_ack_w) |
| 489 | 489 | AM_RANGE(0x0401, 0x0401) AM_WRITE(output_latch_w) |
| r1293 | r1294 | |
| 503 | 503 | * |
| 504 | 504 | *************************************/ |
| 505 | 505 | |
| 506 | ADDRESS_MAP_START( dsio_program_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 506 | static ADDRESS_MAP_START( dsio_program_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 507 | 507 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 508 | 508 | AM_RANGE(0x0000, 0x3fff) AM_RAM AM_BASE(&dcs_internal_program_ram) |
| 509 | 509 | ADDRESS_MAP_END |
| 510 | 510 | |
| 511 | 511 | |
| 512 | ADDRESS_MAP_START( dsio_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 512 | static ADDRESS_MAP_START( dsio_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 513 | 513 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 514 | 514 | AM_RANGE(0x0000, 0x03ff) AM_RAMBANK(20) |
| 515 | 515 | AM_RANGE(0x0400, 0x3fdf) AM_RAM |
| r1293 | r1294 | |
| 517 | 517 | ADDRESS_MAP_END |
| 518 | 518 | |
| 519 | 519 | |
| 520 | ADDRESS_MAP_START( dsio_io_map, ADDRESS_SPACE_IO, 16 ) | |
| 520 | static ADDRESS_MAP_START( dsio_io_map, ADDRESS_SPACE_IO, 16 ) | |
| 521 | 521 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 522 | 522 | AM_RANGE(0x0400, 0x0400) AM_READWRITE(input_latch_r, input_latch_ack_w) |
| 523 | 523 | AM_RANGE(0x0401, 0x0401) AM_WRITE(output_latch_w) |
| r1293 | r1294 | |
| 535 | 535 | * |
| 536 | 536 | *************************************/ |
| 537 | 537 | |
| 538 | ADDRESS_MAP_START( denver_program_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 538 | static ADDRESS_MAP_START( denver_program_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 539 | 539 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 540 | 540 | AM_RANGE(0x0000, 0x3fff) AM_RAM AM_BASE(&dcs_internal_program_ram) |
| 541 | 541 | ADDRESS_MAP_END |
| 542 | 542 | |
| 543 | 543 | |
| 544 | ADDRESS_MAP_START( denver_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 544 | static ADDRESS_MAP_START( denver_data_map, ADDRESS_SPACE_DATA, 16 ) | |
| 545 | 545 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 546 | 546 | AM_RANGE(0x0000, 0x07ff) AM_RAMBANK(20) |
| 547 | 547 | AM_RANGE(0x0800, 0x3fdf) AM_RAM |
| r1293 | r1294 | |
| 549 | 549 | ADDRESS_MAP_END |
| 550 | 550 | |
| 551 | 551 | |
| 552 | ADDRESS_MAP_START( denver_io_map, ADDRESS_SPACE_IO, 16 ) | |
| 552 | static ADDRESS_MAP_START( denver_io_map, ADDRESS_SPACE_IO, 16 ) | |
| 553 | 553 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 554 | 554 | AM_RANGE(0x0400, 0x0400) AM_READWRITE(input_latch_r, input_latch_ack_w) |
| 555 | 555 | AM_RANGE(0x0401, 0x0401) AM_WRITE(output_latch_w) |
| r1293 | r1294 | |
| 810 | 810 | /* reset timers */ |
| 811 | 811 | dcs.timer_enable = 0; |
| 812 | 812 | dcs.timer_scale = 1; |
| 813 | | |
| 813 | | |
| 814 | 814 | |
| 815 | 815 | /* start the SPORT0 timer */ |
| 816 | 816 | if (dcs.sport_timer) |
| 817 | | |
| 817 | | |
| 818 | 818 | |
| 819 | 819 | /* reset the HLE transfer states */ |
| 820 | 820 | transfer.dcs_state = transfer.state = 0; |
| r1293 | r1294 | |
| 891 | 891 | dcs.sounddata_words = dcs.bootrom_words; |
| 892 | 892 | |
| 893 | 893 | /* create the timers */ |
| 894 | dcs.internal_timer = mame_timer_alloc(internal_timer_callback); | |
| 895 | dcs.reg_timer = mame_timer_alloc(dcs_irq); | |
| 894 | dcs.internal_timer = timer_alloc(internal_timer_callback); | |
| 895 | dcs.reg_timer = timer_alloc(dcs_irq); | |
| 896 | 896 | |
| 897 | 897 | /* non-RAM based automatically acks */ |
| 898 | 898 | dcs.auto_ack = TRUE; |
| r1293 | r1294 | |
| 942 | 942 | dcs_sram = auto_malloc(0x8000*4); |
| 943 | 943 | |
| 944 | 944 | /* create the timers */ |
| 945 | dcs.internal_timer = mame_timer_alloc(internal_timer_callback); | |
| 946 | dcs.reg_timer = mame_timer_alloc(dcs_irq); | |
| 947 | dcs.sport_timer = mame_timer_alloc(sport0_irq); | |
| 945 | dcs.internal_timer = timer_alloc(internal_timer_callback); | |
| 946 | dcs.reg_timer = timer_alloc(dcs_irq); | |
| 947 | dcs.sport_timer = timer_alloc(sport0_irq); | |
| 948 | 948 | |
| 949 | 949 | /* we don't do auto-ack by default */ |
| 950 | 950 | dcs.auto_ack = FALSE; |
| r1293 | r1294 | |
| 955 | 955 | |
| 956 | 956 | /* allocate a watchdog timer for HLE transfers */ |
| 957 | 957 | if (HLE_TRANSFERS) |
| 958 | transfer.watchdog = | |
| 958 | transfer.watchdog = | |
| 959 | 959 | |
| 960 | 960 | /* reset the system */ |
| 961 | 961 | dcs_reset(Machine, 0); |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | 964 | |
| 965 | #ifdef UNUSED_FUNCTION | |
| 965 | 966 | void dsio_init(int dram_in_mb, offs_t polling_offset) |
| 966 | 967 | { |
| 967 | 968 | dcs2_init(dram_in_mb, polling_offset); |
| 968 | 969 | } |
| 970 | #endif | |
| 969 | 971 | |
| 970 | 972 | |
| 971 | 973 | void dcs_set_auto_ack(int state) |
| r1293 | r1294 | |
| 1434 | 1436 | { |
| 1435 | 1437 | /* only boost for DCS2 boards */ |
| 1436 | 1438 | if (!dcs.auto_ack && !HLE_TRANSFERS) |
| 1437 | cpu_boost_interleave( | |
| 1439 | cpu_boost_interleave( | |
| 1438 | 1440 | return dcs.latch_control; |
| 1439 | 1441 | } |
| 1440 | 1442 | |
| r1293 | r1294 | |
| 1492 | 1494 | logerror("%08X:dcs_data_w(%04X)\n", activecpu_get_pc(), data); |
| 1493 | 1495 | |
| 1494 | 1496 | /* boost the interleave temporarily */ |
| 1495 | cpu_boost_interleave( | |
| 1497 | cpu_boost_interleave( | |
| 1496 | 1498 | |
| 1497 | 1499 | /* set the IRQ line on the ADSP */ |
| 1498 | 1500 | cpunum_set_input_line(dcs.cpunum, ADSP2105_IRQ2, ASSERT_LINE); |
| r1293 | r1294 | |
| 1683 | 1685 | |
| 1684 | 1686 | /* set the next timer, but only if it's for a reasonable number */ |
| 1685 | 1687 | if (!dcs.timer_ignore && (dcs.timer_period > 10 || dcs.timer_scale > 1)) |
| 1686 | | |
| 1688 | | |
| 1687 | 1689 | cpunum_set_input_line(dcs.cpunum, ADSP2105_TIMER, PULSE_LINE); |
| 1688 | 1690 | } |
| 1689 | 1691 | |
| r1293 | r1294 | |
| 1718 | 1720 | |
| 1719 | 1721 | /* adjust the timer if not optimized */ |
| 1720 | 1722 | if (!dcs.timer_ignore) |
| 1721 | | |
| 1723 | | |
| 1722 | 1724 | } |
| 1723 | 1725 | |
| 1724 | 1726 | |
| r1293 | r1294 | |
| 1728 | 1730 | dcs.timer_ignore = 0; |
| 1729 | 1731 | if (enable) |
| 1730 | 1732 | { |
| 1731 | // mame_printf_debug("Timer enabled @ %d cycles/int, or %f Hz\n", dcs.timer_scale * (dcs.timer_period + 1), 1.0 / | |
| 1733 | // mame_printf_debug("Timer enabled @ %d cycles/int, or %f Hz\n", dcs.timer_scale * (dcs.timer_period + 1), 1.0 / | |
| 1732 | 1734 | reset_timer(); |
| 1733 | 1735 | } |
| 1734 | 1736 | else |
| 1735 | 1737 | { |
| 1736 | 1738 | // mame_printf_debug("Timer disabled\n"); |
| 1737 | | |
| 1739 | | |
| 1738 | 1740 | } |
| 1739 | 1741 | } |
| 1740 | 1742 | |
| r1293 | r1294 | |
| 1812 | 1814 | if ((data & 0x0800) == 0) |
| 1813 | 1815 | { |
| 1814 | 1816 | dmadac_enable(0, dcs.channels, 0); |
| 1815 | | |
| 1817 | | |
| 1816 | 1818 | } |
| 1817 | 1819 | break; |
| 1818 | 1820 | |
| r1293 | r1294 | |
| 1821 | 1823 | if ((data & 0x0002) == 0) |
| 1822 | 1824 | { |
| 1823 | 1825 | dmadac_enable(0, dcs.channels, 0); |
| 1824 | | |
| 1826 | | |
| 1825 | 1827 | } |
| 1826 | 1828 | break; |
| 1827 | 1829 | |
| r1293 | r1294 | |
| 1921 | 1923 | /* calculate how long until we generate an interrupt */ |
| 1922 | 1924 | |
| 1923 | 1925 | /* frequency the time per each bit sent */ |
| 1924 | | |
| 1926 | | |
| 1925 | 1927 | |
| 1926 | 1928 | /* now put it down to samples, so we know what the channel frequency has to be */ |
| 1927 | sample_period = scale_up_mame_time(sample_period, 16 * dcs.channels); | |
| 1928 | dmadac_set_frequency(0, dcs.channels, SUBSECONDS_TO_HZ(sample_period.subseconds)); | |
| 1929 | sample_period = attotime_mul(sample_period, 16 * dcs.channels); | |
| 1930 | dmadac_set_frequency(0, dcs.channels, ATTOSECONDS_TO_HZ(sample_period.attoseconds)); | |
| 1929 | 1931 | dmadac_enable(0, dcs.channels, 1); |
| 1930 | 1932 | |
| 1931 | 1933 | /* fire off a timer wich will hit every half-buffer */ |
| 1932 | 1934 | if (dcs.incs) |
| 1933 | 1935 | { |
| 1934 | mame_time period = scale_down_mame_time(scale_up_mame_time(sample_period, dcs.size), (2 * dcs.channels * dcs.incs)); | |
| 1935 | mame_timer_adjust(dcs.reg_timer, period, 0, period); | |
| 1936 | attotime period = attotime_div(attotime_mul(sample_period, dcs.size), (2 * dcs.channels * dcs.incs)); | |
| 1937 | timer_adjust(dcs.reg_timer, period, 0, period); | |
| 1936 | 1938 | } |
| 1937 | 1939 | } |
| 1938 | 1940 | |
| r1293 | r1294 | |
| 1985 | 1987 | dmadac_enable(0, dcs.channels, 0); |
| 1986 | 1988 | |
| 1987 | 1989 | /* remove timer */ |
| 1988 | | |
| 1990 | | |
| 1989 | 1991 | } |
| 1990 | 1992 | |
| 1991 | 1993 | |
| r1293 | r1294 | |
| 2034 | 2036 | for ( ; transfer.fifo_entries; transfer.fifo_entries--) |
| 2035 | 2037 | preprocess_write((*dcs.fifo_data_r)()); |
| 2036 | 2038 | } |
| 2037 | | |
| 2039 | | |
| 2038 | 2040 | } |
| 2039 | 2041 | |
| 2040 | 2042 | |
| r1293 | r1294 | |
| 2043 | 2045 | /* if the output is full, stall for a usec */ |
| 2044 | 2046 | if (IS_OUTPUT_FULL()) |
| 2045 | 2047 | { |
| 2046 | | |
| 2048 | | |
| 2047 | 2049 | return; |
| 2048 | 2050 | } |
| 2049 | 2051 | output_latch_w(0, 0x000a, 0); |
| r1293 | r1294 | |
| 2055 | 2057 | /* if the output is full, stall for a usec */ |
| 2056 | 2058 | if (IS_OUTPUT_FULL()) |
| 2057 | 2059 | { |
| 2058 | | |
| 2060 | | |
| 2059 | 2061 | return; |
| 2060 | 2062 | } |
| 2061 | 2063 | output_latch_w(0, param, 0); |
| 2062 | 2064 | |
| 2063 | 2065 | /* chain to the next word we need to write back */ |
| 2064 | | |
| 2066 | | |
| 2065 | 2067 | } |
| 2066 | 2068 | |
| 2067 | 2069 | |
| r1293 | r1294 | |
| 2171 | 2173 | |
| 2172 | 2174 | /* if we're done, start a timer to send the response words */ |
| 2173 | 2175 | if (transfer.state == 0) |
| 2174 | | |
| 2176 | | |
| 2175 | 2177 | return 1; |
| 2176 | 2178 | } |
| 2177 | 2179 | break; |
| r1293 | r1294 | |
| 2185 | 2187 | /* if the output is full, stall for a usec */ |
| 2186 | 2188 | if (IS_OUTPUT_FULL()) |
| 2187 | 2189 | { |
| 2188 | | |
| 2190 | | |
| 2189 | 2191 | return; |
| 2190 | 2192 | } |
| 2191 | 2193 | output_latch_w(0, param, 0); |
| r1293 | r1294 | |
| 2248 | 2250 | transfer.sum = 0; |
| 2249 | 2251 | if (HLE_TRANSFERS) |
| 2250 | 2252 | { |
| 2251 | | |
| 2253 | | |
| 2252 | 2254 | return 1; |
| 2253 | 2255 | } |
| 2254 | 2256 | break; |
| r1293 | r1294 | |
| 2273 | 2275 | /* if we're done, start a timer to send the response words */ |
| 2274 | 2276 | if (transfer.state == 0) |
| 2275 | 2277 | { |
| 2276 | mame_timer_set(MAME_TIME_IN_USEC(1), transfer.sum, s2_ack_callback); | |
| 2277 | mame_timer_adjust(transfer.watchdog, time_never, 0, time_never); | |
| 2278 | timer_set(ATTOTIME_IN_USEC(1), transfer.sum, s2_ack_callback); | |
| 2279 | timer_adjust(transfer.watchdog, attotime_never, 0, attotime_never); | |
| 2278 | 2280 | } |
| 2279 | 2281 | return 1; |
| 2280 | 2282 | } |
| r1293 | r1294 | |
|---|---|---|
| 48 | 48 | static UINT8 riot_irq_state; |
| 49 | 49 | |
| 50 | 50 | /* 6532 variables */ |
| 51 | static | |
| 51 | static | |
| 52 | 52 | static UINT8 riot_irq_flag; |
| 53 | 53 | static UINT8 riot_timer_irq_enable; |
| 54 | 54 | static UINT8 riot_PA7_irq_enable; |
| r1293 | r1294 | |
| 420 | 420 | sh6840_LFSR_3 = 0xffffffff; |
| 421 | 421 | |
| 422 | 422 | /* Init 6532 */ |
| 423 | riot_timer = | |
| 423 | riot_timer = | |
| 424 | 424 | riot_irq_flag = 0; |
| 425 | 425 | riot_timer_irq_enable = 0; |
| 426 | 426 | riot_porta_data = 0xff; |
| r1293 | r1294 | |
| 491 | 491 | |
| 492 | 492 | /* now start counting clock cycles down */ |
| 493 | 493 | riot_state = RIOT_POST_COUNT; |
| 494 | | |
| 494 | | |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | /* if not, we are done counting down */ |
| 498 | 498 | else |
| 499 | 499 | { |
| 500 | 500 | riot_state = RIOT_IDLE; |
| 501 | | |
| 501 | | |
| 502 | 502 | } |
| 503 | 503 | } |
| 504 | 504 | |
| r1293 | r1294 | |
| 536 | 536 | if (!(data & 0x01) && (riot_portb_data & 0x01)) |
| 537 | 537 | { |
| 538 | 538 | riot_porta_data = tms5220_status_r(0); |
| 539 | logerror("(%f)%04X:TMS5220 status read = %02X\n", | |
| 539 | logerror("(%f)%04X:TMS5220 status read = %02X\n", | |
| 540 | 540 | } |
| 541 | 541 | if (!(data & 0x02) && (riot_portb_data & 0x02)) |
| 542 | 542 | { |
| 543 | logerror("(%f)%04X:TMS5220 data write = %02X\n", | |
| 543 | logerror("(%f)%04X:TMS5220 data write = %02X\n", | |
| 544 | 544 | tms5220_data_w(0, riot_porta_data); |
| 545 | 545 | } |
| 546 | 546 | } |
| r1293 | r1294 | |
| 575 | 575 | |
| 576 | 576 | /* set a new timer */ |
| 577 | 577 | riot_clock_divisor = divisors[offset & 0x03]; |
| 578 | | |
| 578 | | |
| 579 | 579 | riot_state = RIOT_COUNT; |
| 580 | 580 | } |
| 581 | 581 | } |
| r1293 | r1294 | |
| 641 | 641 | return 0x00; |
| 642 | 642 | |
| 643 | 643 | case RIOT_COUNT: |
| 644 | return | |
| 644 | return | |
| 645 | 645 | |
| 646 | 646 | case RIOT_POST_COUNT: |
| 647 | return | |
| 647 | return | |
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | 650 | |
| r1293 | r1294 | |
| 843 | 843 | } |
| 844 | 844 | if (!(offset & 0x40)) |
| 845 | 845 | { |
| 846 | mame_time curtime = mame_timer_get_time(); | |
| 847 | int clock_pulse = curtime.subseconds / HZ_TO_SUBSECONDS(2 * CVSD_CLOCK_FREQ); | |
| 846 | attotime curtime = timer_get_time(); | |
| 847 | int clock_pulse = curtime.attoseconds / HZ_TO_ATTOSECONDS(2 * CVSD_CLOCK_FREQ); | |
| 848 | 848 | return (clock_pulse & 1) << 7; |
| 849 | 849 | } |
| 850 | 850 | return 0; |
| r1293 | r1294 | |
|---|---|---|
| 9 | 9 | #include "sound/speaker.h" |
| 10 | 10 | |
| 11 | 11 | |
| 12 | static mame_timer *schaser_effect_555_timer; | |
| 13 | static mame_time schaser_effect_555_time_remain; | |
| 12 | static emu_timer *schaser_effect_555_timer; | |
| 13 | static attotime schaser_effect_555_time_remain; | |
| 14 | 14 | static int schaser_effect_555_is_low; |
| 15 | 15 | static int schaser_explosion; |
| 16 | 16 | static UINT8 port_1_last = 0; |
| r1293 | r1294 | |
| 797 | 797 | { |
| 798 | 798 | if (effect) |
| 799 | 799 | { |
| 800 | if (compare | |
| 800 | if (attotime_compare | |
| 801 | 801 | { |
| 802 | 802 | /* timer re-enabled, use up remaining 555 high time */ |
| 803 | | |
| 803 | | |
| 804 | 804 | } |
| 805 | 805 | else if (!schaser_effect_555_is_low) |
| 806 | 806 | { |
| 807 | 807 | /* set 555 high time */ |
| 808 | mame_time new_time = make_mame_time(0, MAX_SUBSECONDS * .8873 * schaser_effect_rc[effect]); | |
| 809 | mame_timer_adjust(schaser_effect_555_timer, new_time, effect, time_zero); | |
| 808 | attotime new_time = attotime_make(0, ATTOSECONDS_PER_SECOND * .8873 * schaser_effect_rc[effect]); | |
| 809 | timer_adjust(schaser_effect_555_timer, new_time, effect, attotime_zero); | |
| 810 | 810 | } |
| 811 | 811 | } |
| 812 | 812 | else |
| r1293 | r1294 | |
| 814 | 814 | /* disable effect - stops at end of low cycle */ |
| 815 | 815 | if (!schaser_effect_555_is_low) |
| 816 | 816 | { |
| 817 | schaser_effect_555_time_remain = mame_timer_timeleft(schaser_effect_555_timer); | |
| 818 | mame_timer_adjust(schaser_effect_555_timer, time_never, 0, time_never); | |
| 817 | schaser_effect_555_time_remain = timer_timeleft(schaser_effect_555_timer); | |
| 818 | timer_adjust(schaser_effect_555_timer, attotime_never, 0, attotime_never); | |
| 819 | 819 | } |
| 820 | 820 | } |
| 821 | 821 | last_effect = effect; |
| r1293 | r1294 | |
| 860 | 860 | static TIMER_CALLBACK( schaser_effect_555_cb ) |
| 861 | 861 | { |
| 862 | 862 | int effect = param; |
| 863 | | |
| 863 | | |
| 864 | 864 | /* Toggle 555 output */ |
| 865 | 865 | schaser_effect_555_is_low = !schaser_effect_555_is_low; |
| 866 | schaser_effect_555_time_remain = time_zero; | |
| 866 | schaser_effect_555_time_remain = attotime_zero; | |
| 867 | 867 | |
| 868 | 868 | if (schaser_effect_555_is_low) |
| 869 | new_time = | |
| 869 | new_time = | |
| 870 | 870 | else |
| 871 | 871 | { |
| 872 | 872 | if (effect) |
| 873 | new_time = | |
| 873 | new_time = | |
| 874 | 874 | else |
| 875 | new_time = time_never; | |
| 875 | new_time = attotime_never; | |
| 876 | 876 | } |
| 877 | | |
| 877 | | |
| 878 | 878 | SN76477_enable_w(0, !(schaser_effect_555_is_low || schaser_explosion)); |
| 879 | 879 | SN76477_one_shot_cap_voltage_w(0, !(schaser_effect_555_is_low || schaser_explosion) ? 0 : SN76477_EXTERNAL_VOLTAGE_DISCONNECT); |
| 880 | 880 | } |
| r1293 | r1294 | |
| 882 | 882 | |
| 883 | 883 | MACHINE_START( schaser ) |
| 884 | 884 | { |
| 885 | schaser_effect_555_timer = | |
| 885 | schaser_effect_555_timer = | |
| 886 | 886 | |
| 887 | 887 | machine_start_mw8080bw(machine); |
| 888 | 888 | } |
| r1293 | r1294 | |
| 891 | 891 | MACHINE_RESET( schaser ) |
| 892 | 892 | { |
| 893 | 893 | schaser_effect_555_is_low = 0; |
| 894 | | |
| 894 | | |
| 895 | 895 | schaser_sh_port_1_w(0, 0); |
| 896 | 896 | schaser_sh_port_2_w(0, 0); |
| 897 | schaser_effect_555_time_remain = time_zero; | |
| 897 | schaser_effect_555_time_remain = attotime_zero; | |
| 898 | 898 | |
| 899 | 899 | machine_reset_mw8080bw(machine); |
| 900 | 900 | } |
| r1293 | r1294 | |
|---|---|---|
| 47 | 47 | #define FALLING_EDGE(bit) (!(data & bit) && (targ_sh_ctrl0 & bit)) |
| 48 | 48 | |
| 49 | 49 | |
| 50 | void targ_tone_generator(int data) | |
| 50 | static void targ_tone_generator(int data) | |
| 51 | 51 | { |
| 52 | 52 | int maxfreq; |
| 53 | 53 |
| r1293 | r1294 | |
|---|---|---|
| 827 | 827 | |
| 828 | 828 | state_save_register_item("cchip", 0, current_bank); |
| 829 | 829 | |
| 830 | | |
| 830 | | |
| 831 | 831 | } |
| r1293 | r1294 | |
|---|---|---|
| 118 | 118 | #if DEBUG_DSP |
| 119 | 119 | static FILE *log_file = NULL; |
| 120 | 120 | #endif |
| 121 | void dsp_dasm_opcode( UINT32 op, char *buffer ); | |
| 121 | static void dsp_dasm_opcode( UINT32 op, char *buffer ); | |
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | |
| r1293 | r1294 | |
| 1008 | 1008 | }; |
| 1009 | 1009 | |
| 1010 | 1010 | |
| 1011 | void dsp_dasm_prefix( const char* format, char* buffer, UINT32 *data ) | |
| 1011 | static void dsp_dasm_prefix( const char* format, char* buffer, UINT32 *data ) | |
| 1012 | 1012 | { |
| 1013 | 1013 | |
| 1014 | 1014 | for ( ; *format; format++ ) |
| r1293 | r1294 | |
| 1109 | 1109 | } |
| 1110 | 1110 | *buffer = 0; |
| 1111 | 1111 | } |
| 1112 | void dsp_dasm_operation( UINT32 op, char *buffer ) | |
| 1112 | static void dsp_dasm_operation( UINT32 op, char *buffer ) | |
| 1113 | 1113 | { |
| 1114 | 1114 | char *my_buffer = buffer; |
| 1115 | 1115 | char temp_buffer[64]; |
| r1293 | r1294 | |
| 1175 | 1175 | sprintf( my_buffer, "%-10s", temp_buffer ); |
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | void dsp_dasm_move_immediate( UINT32 op, char *buffer ) | |
| 1178 | static void dsp_dasm_move_immediate( UINT32 op, char *buffer ) | |
| 1179 | 1179 | { |
| 1180 | 1180 | UINT32 data[3]; |
| 1181 | 1181 | if ( (op & 0x2000000) ) |
| r1293 | r1294 | |
| 1193 | 1193 | } |
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | void dsp_dasm_jump( UINT32 op, char *buffer ) | |
| 1196 | static void dsp_dasm_jump( UINT32 op, char *buffer ) | |
| 1197 | 1197 | { |
| 1198 | 1198 | UINT32 data[2]; |
| 1199 | 1199 | if ( op & 0x3F80000 ) |
| r1293 | r1294 | |
| 1209 | 1209 | } |
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | void dsp_dasm_loop( UINT32 op, char* buffer ) | |
| 1212 | static void dsp_dasm_loop( UINT32 op, char* buffer ) | |
| 1213 | 1213 | { |
| 1214 | 1214 | if ( op & 0x8000000 ) |
| 1215 | 1215 | { |
| r1293 | r1294 | |
| 1221 | 1221 | } |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | void dsp_dasm_end( UINT32 op, char* buffer ) | |
| 1224 | static void dsp_dasm_end( UINT32 op, char* buffer ) | |
| 1225 | 1225 | { |
| 1226 | 1226 | if ( op & 0x8000000 ) |
| 1227 | 1227 | { |
| r1293 | r1294 | |
| 1233 | 1233 | } |
| 1234 | 1234 | } |
| 1235 | 1235 | |
| 1236 | void dsp_dasm_dma( UINT32 op, char* buffer ) | |
| 1236 | static void dsp_dasm_dma( UINT32 op, char* buffer ) | |
| 1237 | 1237 | { |
| 1238 | 1238 | UINT32 data[4]; |
| 1239 | 1239 | data[0] = (op & 0x4000) >> 14; /* H */ |
| r1293 | r1294 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | ***************************************************************************/ |
| 19 | 19 | |
| 20 | static | |
| 20 | static | |
| 21 | 21 | |
| 22 | 22 | static UINT8 customio[16]; |
| 23 | 23 | static char battles_customio_command; |
| r1293 | r1294 | |
| 36 | 36 | battles_customio_command_count = 0; |
| 37 | 37 | battles_customio_data = 0; |
| 38 | 38 | battles_sound_played = 0; |
| 39 | nmi_timer = | |
| 39 | nmi_timer = | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
| r1293 | r1294 | |
| 96 | 96 | switch (data) |
| 97 | 97 | { |
| 98 | 98 | case 0x10: |
| 99 | | |
| 99 | | |
| 100 | 100 | return; /* nop */ |
| 101 | 101 | } |
| 102 | | |
| 102 | | |
| 103 | 103 | |
| 104 | 104 | } |
| 105 | 105 |
| r1293 | r1294 | |
|---|---|---|
| 59 | 59 | UINT8 cdrom_cmd_resp; |
| 60 | 60 | cdrom_file *cdrom; |
| 61 | 61 | UINT8 * cdrom_toc; |
| 62 | mame_timer *dma_timer; | |
| 63 | mame_timer *frame_timer; | |
| 62 | emu_timer *dma_timer; | |
| 63 | emu_timer *frame_timer; | |
| 64 | 64 | } akiko; |
| 65 | 65 | |
| 66 | 66 | static TIMER_CALLBACK(akiko_dma_proc); |
| r1293 | r1294 | |
| 94 | 94 | akiko.cdrom_cmd_resp = 0; |
| 95 | 95 | akiko.cdrom = cdrom_open(get_disk_handle(0)); |
| 96 | 96 | akiko.cdrom_toc = NULL; |
| 97 | akiko.dma_timer = mame_timer_alloc(akiko_dma_proc); | |
| 98 | akiko.frame_timer = mame_timer_alloc(akiko_frame_proc); | |
| 97 | akiko.dma_timer = timer_alloc(akiko_dma_proc); | |
| 98 | akiko.frame_timer = timer_alloc(akiko_frame_proc); | |
| 99 | 99 | |
| 100 | 100 | /* create the TOC table */ |
| 101 | 101 | if ( akiko.cdrom != NULL && cdrom_get_last_track(akiko.cdrom) ) |
| r1293 | r1294 | |
| 274 | 274 | if (cddanum != -1) |
| 275 | 275 | { |
| 276 | 276 | cdda_stop_audio(cddanum); |
| 277 | | |
| 277 | | |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
| r1293 | r1294 | |
| 284 | 284 | if (cddanum != -1) |
| 285 | 285 | { |
| 286 | 286 | cdda_start_audio(cddanum, lba, num_blocks); |
| 287 | | |
| 287 | | |
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
| r1293 | r1294 | |
| 299 | 299 | |
| 300 | 300 | if ( pause ) |
| 301 | 301 | { |
| 302 | | |
| 302 | | |
| 303 | 303 | } |
| 304 | 304 | else |
| 305 | 305 | { |
| 306 | | |
| 306 | | |
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | } |
| r1293 | r1294 | |
| 367 | 367 | akiko_set_cd_status( 0x80000000 ); /* subcode ready */ |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | | |
| 370 | | |
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | |
| r1293 | r1294 | |
| 472 | 472 | if ( akiko.cdrom_readreqmask == 0 ) |
| 473 | 473 | akiko_set_cd_status(0x04000000); |
| 474 | 474 | else |
| 475 | | |
| 475 | | |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | static void akiko_start_dma( void ) |
| r1293 | r1294 | |
| 488 | 488 | |
| 489 | 489 | akiko.cdrom_lba_cur = akiko.cdrom_lba_start; |
| 490 | 490 | |
| 491 | | |
| 491 | | |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | static void akiko_setup_response( int len, UINT8 *r1 ) |
| r1293 | r1294 | |
| 679 | 679 | { |
| 680 | 680 | akiko.cdrom_cmd_start = (akiko.cdrom_cmd_start+3) & 0xff; |
| 681 | 681 | |
| 682 | | |
| 682 | | |
| 683 | 683 | |
| 684 | 684 | break; |
| 685 | 685 | } |
| r1293 | r1294 | |
|---|---|---|
| 8 | 8 | int pc10_nmi_enable; /* nmi enable */ |
| 9 | 9 | int pc10_dog_di; /* watchdog disable */ |
| 10 | 10 | int pc10_int_detect; /* interrupt detect */ |
| 11 | int pc10_gun_controller; | |
| 11 | static int pc10_gun_controller; | |
| 12 | 12 | int pc10_game_mode; /* Used in Single monitor version to display Game or PPU */ |
| 13 | 13 | int pc10_dispmask_old; |
| 14 | 14 |
| r1293 | r1294 | |
|---|---|---|
| 46 | 46 | if it is then it copies the cached data to the user region where code is |
| 47 | 47 | executed from, if its not cached then it gets decrypted to the current |
| 48 | 48 | cache position using the functions in fd1094.c */ |
| 49 | void fd1094_setstate_and_decrypt(int state) | |
| 49 | static void fd1094_setstate_and_decrypt(int state) | |
| 50 | 50 | { |
| 51 | 51 | int i; |
| 52 | 52 | UINT32 addr; |
| r1293 | r1294 | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /* Callback for CMP.L instructions (state change) */ |
| 98 | void fd1094_cmp_callback(UINT32 val, int reg) | |
| 98 | static void fd1094_cmp_callback(UINT32 val, int reg) | |
| 99 | 99 | { |
| 100 | 100 | if (reg == 0 && (val & 0x0000ffff) == 0x0000ffff) // ? |
| 101 | 101 | { |
| r1293 | r1294 | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /* Callback when the FD1094 enters interrupt code */ |
| 107 | int fd1094_int_callback (int irq) | |
| 107 | static int fd1094_int_callback (int irq) | |
| 108 | 108 | { |
| 109 | 109 | fd1094_setstate_and_decrypt(FD1094_STATE_IRQ); |
| 110 | 110 | return (0x60+irq*4)/4; // vector address |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | void fd1094_rte_callback (void) | |
| 113 | static void fd1094_rte_callback (void) | |
| 114 | 114 | { |
| 115 | 115 | fd1094_setstate_and_decrypt(FD1094_STATE_RTE); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | /* KLUDGE, set the initial PC / SP based on table as we can't decrypt them yet */ |
| 120 | void fd1094_kludge_reset_values(void) | |
| 120 | static void fd1094_kludge_reset_values(void) | |
| 121 | 121 | { |
| 122 | 122 | int i; |
| 123 | 123 |
| r1293 | r1294 | |
|---|---|---|
| 12 | 12 | #include "includes/galaxian.h" |
| 13 | 13 | |
| 14 | 14 | static int irq_line; |
| 15 | static | |
| 15 | static | |
| 16 | 16 | |
| 17 | 17 | static UINT8 kingball_speech_dip; |
| 18 | 18 | static UINT8 kingball_sound; |
| r1293 | r1294 | |
| 63 | 63 | |
| 64 | 64 | param = (param + 0x10) & 0xff; |
| 65 | 65 | |
| 66 | | |
| 66 | | |
| 67 | 67 | |
| 68 | 68 | TTL7474_update(0); |
| 69 | 69 | } |
| r1293 | r1294 | |
| 84 | 84 | TTL7474_preset_w(1, 0); |
| 85 | 85 | |
| 86 | 86 | /* start a timer to generate interrupts */ |
| 87 | int_timer = mame_timer_alloc(interrupt_timer); | |
| 88 | mame_timer_adjust(int_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_zero); | |
| 87 | int_timer = timer_alloc(interrupt_timer); | |
| 88 | timer_adjust(int_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_zero); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | MACHINE_RESET( galaxian ) |
| r1293 | r1294 | |
|---|---|---|
| 194 | 194 | if (asic65_type == ASIC65_ROMBASED) |
| 195 | 195 | { |
| 196 | 196 | timer_call_after_resynch(data | (offset << 16), m68k_asic65_deferred_w); |
| 197 | cpu_boost_interleave(time_zero, | |
| 197 | cpu_boost_interleave(attotime_zero, | |
| 198 | 198 | return; |
| 199 | 199 | } |
| 200 | 200 | |
| r1293 | r1294 | |
| 232 | 232 | if (asic65_type == ASIC65_ROMBASED) |
| 233 | 233 | { |
| 234 | 234 | asic65_68full = 0; |
| 235 | cpu_boost_interleave(time_zero, | |
| 235 | cpu_boost_interleave(attotime_zero, | |
| 236 | 236 | return asic65_68data; |
| 237 | 237 | } |
| 238 | 238 | |
| r1293 | r1294 | |
| 452 | 452 | /* bit 14 = 68FULL */ |
| 453 | 453 | /* bit 13 = XFLG */ |
| 454 | 454 | /* bit 12 = controlled by jumper */ |
| 455 | cpu_boost_interleave(time_zero, | |
| 455 | cpu_boost_interleave(attotime_zero, | |
| 456 | 456 | return (asic65_tfull << 15) | (asic65_68full << 14) | (asic65_xflg << 13) | 0x0000; |
| 457 | 457 | } |
| 458 | 458 | else |
| r1293 | r1294 | |
|---|---|---|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | |
| 322 | #ifdef UNUSED_FUNCTION | |
| 322 | 323 | static UINT8 dfront_tab[256] = { |
| 323 | 324 | 0x51, 0xc4, 0xe3, 0x10, 0x1c, 0xad, 0x8a, 0x39, 0x8c, 0xe0, 0xa5, 0x04, 0x0f, 0xe4, 0x35, 0xc3, |
| 324 | 325 | 0x2d, 0x6b, 0x32, 0xe2, 0x60, 0x54, 0x63, 0x06, 0xa3, 0xf1, 0x0b, 0x5f, 0x6c, 0x5c, 0xb3, 0xec, |
| r1293 | r1294 | |
| 431 | 432 | src[i] = x; |
| 432 | 433 | } |
| 433 | 434 | } |
| 435 | #endif | |
| 434 | 436 | |
| 435 | 437 | |
| 436 | 438 | static UINT8 mm_tab[256] = { |
| r1293 | r1294 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | #define xxxx 0x00 |
| 14 | 14 | |
| 15 | const UINT8 ga2_v25_opcode_table[256] = { | |
| 15 | static const UINT8 ga2_v25_opcode_table[256] = { | |
| 16 | 16 | xxxx,xxxx,0xEA,xxxx,xxxx,0x8B,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, |
| 17 | 17 | xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,0xFA, |
| 18 | 18 | xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,0x49,xxxx,xxxx,xxxx, |
| r1293 | r1294 | |
| 33 | 33 | |
| 34 | 34 | #undef xxxx |
| 35 | 35 | |
| 36 | void nec_v25_cpu_decrypt(void) | |
| 36 | static void nec_v25_cpu_decrypt(void) | |
| 37 | 37 | { |
| 38 | 38 | int i; |
| 39 | 39 | UINT8 *rom = memory_region(REGION_CPU3); |
| r1293 | r1294 | |
|---|---|---|
| 13 | 13 | UINT8 *slapfight_dpram; |
| 14 | 14 | size_t slapfight_dpram_size; |
| 15 | 15 | |
| 16 | int slapfight_status; | |
| 17 | int getstar_sequence_index; | |
| 18 | int getstar_sh_intenabled; | |
| 16 | static int slapfight_status; | |
| 17 | static int getstar_sequence_index; | |
| 18 | static int getstar_sh_intenabled; | |
| 19 | 19 | |
| 20 | 20 | static int slapfight_status_state; |
| 21 | 21 | extern UINT8 *getstar_e803; |
| r1293 | r1294 | |
|---|---|---|
| 113 | 113 | gamma_irq_clock = 0; |
| 114 | 114 | |
| 115 | 115 | /* set a timer going for the CPU interrupt generators */ |
| 116 | | |
| 116 | | |
| 117 | 117 | |
| 118 | 118 | state_save_register_item("misc", 0, alpha_data); |
| 119 | 119 | state_save_register_item("misc", 0, alpha_rcvd); |
| r1293 | r1294 | |
| 146 | 146 | cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE); |
| 147 | 147 | |
| 148 | 148 | /* the sound CPU needs to reply in 250microseconds (according to Neil Bradley) */ |
| 149 | | |
| 149 | | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 |
| r1293 | r1294 | |
|---|---|---|
| 258 | 258 | mrulemap = (struct MRULELIST *)byte_ptr; // pointer table to rule lists |
| 259 | 259 | mrulepool = (struct MRULE *)(byte_ptr + 0x4000); // rules pool |
| 260 | 260 | |
| 261 | | |
| 261 | | |
| 262 | 262 | |
| 263 | 263 | seedMT(mame_rand(Machine)); |
| 264 | 264 | } |
| r1293 | r1294 | |
|---|---|---|
| 12 | 12 | /* tape direction, speed and timing (used also in video/decocass.c) */ |
| 13 | 13 | INT32 tape_dir; |
| 14 | 14 | INT32 tape_speed; |
| 15 | mame_time tape_time0; | |
| 16 | mame_timer *tape_timer; | |
| 15 | attotime tape_time0; | |
| 16 | emu_timer *tape_timer; | |
| 17 | 17 | |
| 18 | 18 | static INT32 firsttime = 1; |
| 19 | 19 | static INT32 tape_present; |
| r1293 | r1294 | |
| 94 | 94 | |
| 95 | 95 | /* sound latches, ACK status bits and NMI timer */ |
| 96 | 96 | static UINT8 decocass_sound_ack; |
| 97 | static | |
| 97 | static | |
| 98 | 98 | |
| 99 | 99 | WRITE8_HANDLER( decocass_coin_counter_w ) |
| 100 | 100 | { |
| r1293 | r1294 | |
| 148 | 148 | WRITE8_HANDLER( decocass_sound_nmi_enable_w ) |
| 149 | 149 | { |
| 150 | 150 | LOG(2,("CPU #%d sound NMI enb -> $%02x\n", cpu_getactivecpu(), data)); |
| 151 | | |
| 151 | | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | READ8_HANDLER( decocass_sound_nmi_enable_r ) |
| 155 | 155 | { |
| 156 | 156 | UINT8 data = 0xff; |
| 157 | 157 | LOG(2,("CPU #%d sound NMI enb <- $%02x\n", cpu_getactivecpu(), data)); |
| 158 | | |
| 158 | | |
| 159 | 159 | return data; |
| 160 | 160 | } |
| 161 | 161 | |
| r1293 | r1294 | |
| 277 | 277 | |
| 278 | 278 | WRITE8_HANDLER( decocass_reset_w ) |
| 279 | 279 | { |
| 280 | LOG(1,("%9.7f 6502-PC: %04x decocass_reset_w(%02x): $%02x\n", | |
| 280 | LOG(1,("%9.7f 6502-PC: %04x decocass_reset_w(%02x): $%02x\n", | |
| 281 | 281 | decocass_reset = data; |
| 282 | 282 | |
| 283 | 283 | /* CPU #1 active hight reset */ |
| r1293 | r1294 | |
| 285 | 285 | |
| 286 | 286 | /* on reset also remove the sound timer */ |
| 287 | 287 | if (data & 1) |
| 288 | | |
| 288 | | |
| 289 | 289 | |
| 290 | 290 | /* 8041 active low reset */ |
| 291 | 291 | cpunum_set_input_line(2, INPUT_LINE_RESET, (data & 0x08) ^ 0x08 ); |
| r1293 | r1294 | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | |
| 340 | ||
| 340 | ||
| 341 | 341 | { |
| 342 | | |
| 342 | | |
| 343 | 343 | |
| 344 | 344 | if (tape_timer) |
| 345 | 345 | { |
| 346 | | |
| 346 | | |
| 347 | 347 | |
| 348 | 348 | if (tape_dir > 0) |
| 349 | 349 | { |
| 350 | ret = a | |
| 350 | ret = a | |
| 351 | 351 | |
| 352 | if (compare_mame_times(ret, MAME_TIME_IN_MSEC(999900)) > 0) | |
| 353 | ret = MAME_TIME_IN_MSEC(999900); | |
| 352 | if (attotime_compare(ret, ATTOTIME_IN_MSEC(999900)) > 0) | |
| 353 | ret = ATTOTIME_IN_MSEC(999900); | |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | if (tape_dir < 0) |
| 357 | 357 | { |
| 358 | if (compare_mame_times(tape_time, elapsed) > 0) | |
| 359 | ret = sub_mame_times(tape_time, elapsed); | |
| 358 | if (attotime_compare(tape_time, elapsed) > 0) | |
| 359 | ret = attotime_sub(tape_time, elapsed); | |
| 360 | 360 | else |
| 361 | ret = time_zero; | |
| 361 | ret = attotime_zero; | |
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | |
| r1293 | r1294 | |
| 371 | 371 | static int last_byte; |
| 372 | 372 | int offset, rclk, rdata, tape_bit, tape_byte, tape_block; |
| 373 | 373 | |
| 374 | | |
| 374 | | |
| 375 | 375 | |
| 376 | offset = (int)( | |
| 376 | offset = (int)( | |
| 377 | 377 | |
| 378 | 378 | /* reset RCLK and RDATA inputs */ |
| 379 | 379 | rclk = 0; |
| r1293 | r1294 | |
| 388 | 388 | { |
| 389 | 389 | tape_bot_eot = 1; |
| 390 | 390 | set_led_status(1, 1); |
| 391 | LOG(5,("tape %5.4fs: %s found LEADER\n", | |
| 391 | LOG(5,("tape %5.4fs: %s found LEADER\n", | |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | else |
| r1293 | r1294 | |
| 399 | 399 | { |
| 400 | 400 | tape_bot_eot = 0; |
| 401 | 401 | set_led_status(1, 0); |
| 402 | LOG(5,("tape %5.4fs: %s between BOT + LEADER\n", | |
| 402 | LOG(5,("tape %5.4fs: %s between BOT + LEADER\n", | |
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | else |
| r1293 | r1294 | |
| 410 | 410 | { |
| 411 | 411 | tape_bot_eot = 1; |
| 412 | 412 | set_led_status(1, 1); |
| 413 | LOG(5,("tape %5.4fs: %s found BOT\n", | |
| 413 | LOG(5,("tape %5.4fs: %s found BOT\n", | |
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | else |
| r1293 | r1294 | |
| 423 | 423 | { |
| 424 | 424 | tape_bot_eot = 0; |
| 425 | 425 | set_led_status(1, 0); |
| 426 | LOG(5,("tape %5.4fs: %s data area\n", | |
| 426 | LOG(5,("tape %5.4fs: %s data area\n", | |
| 427 | 427 | } |
| 428 | 428 | rclk = (offset ^ 1) & 1; |
| 429 | 429 | tape_bit = (offset / 2) % 8; |
| r1293 | r1294 | |
| 441 | 441 | rdata = (0x00 >> tape_bit) & 1; |
| 442 | 442 | if (tape_byte != last_byte) |
| 443 | 443 | { |
| 444 | LOG(5,("tape %5.4fs: LEADIN $00\n", | |
| 444 | LOG(5,("tape %5.4fs: LEADIN $00\n", | |
| 445 | 445 | set_led_status(2, 1); |
| 446 | 446 | } |
| 447 | 447 | } |
| r1293 | r1294 | |
| 450 | 450 | { |
| 451 | 451 | rdata = (0xaa >> tape_bit) & 1; |
| 452 | 452 | if (tape_byte != last_byte) |
| 453 | LOG(5,("tape %5.4fs: HEADER $aa\n", | |
| 453 | LOG(5,("tape %5.4fs: HEADER $aa\n", | |
| 454 | 454 | } |
| 455 | 455 | else |
| 456 | 456 | if (tape_byte < TAPE_BLOCK) |
| r1293 | r1294 | |
| 458 | 458 | UINT8 *ptr = memory_region(REGION_USER2) + tape_block * 256 + tape_byte - TAPE_HEADER; |
| 459 | 459 | rdata = (*ptr >> tape_bit) & 1; |
| 460 | 460 | if (tape_byte != last_byte) |
| 461 | LOG(4,("tape %5.4fs: DATA(%02x) $%02x\n", | |
| 461 | LOG(4,("tape %5.4fs: DATA(%02x) $%02x\n", | |
| 462 | 462 | } |
| 463 | 463 | else |
| 464 | 464 | if (tape_byte < TAPE_CRC16_MSB) |
| 465 | 465 | { |
| 466 | 466 | rdata = (tape_crc16_msb[tape_block] >> tape_bit) & 1; |
| 467 | 467 | if (tape_byte != last_byte) |
| 468 | LOG(4,("tape %5.4fs: CRC16 MSB $%02x\n", | |
| 468 | LOG(4,("tape %5.4fs: CRC16 MSB $%02x\n", | |
| 469 | 469 | } |
| 470 | 470 | else |
| 471 | 471 | if (tape_byte < TAPE_CRC16_LSB) |
| 472 | 472 | { |
| 473 | 473 | rdata = (tape_crc16_lsb[tape_block] >> tape_bit) & 1; |
| 474 | 474 | if (tape_byte != last_byte) |
| 475 | LOG(4,("tape %5.4fs: CRC16 LSB $%02x\n", | |
| 475 | LOG(4,("tape %5.4fs: CRC16 LSB $%02x\n", | |
| 476 | 476 | } |
| 477 | 477 | else |
| 478 | 478 | if (tape_byte < TAPE_TRAILER) |
| 479 | 479 | { |
| 480 | 480 | rdata = (0xaa >> tape_bit) & 1; |
| 481 | 481 | if (tape_byte != last_byte) |
| 482 | LOG(4,("tape %5.4fs: TRAILER $aa\n", | |
| 482 | LOG(4,("tape %5.4fs: TRAILER $aa\n", | |
| 483 | 483 | } |
| 484 | 484 | else |
| 485 | 485 | if (tape_byte < TAPE_LEADOUT) |
| 486 | 486 | { |
| 487 | 487 | rdata = (0x00 >> tape_bit) & 1; |
| 488 | 488 | if (tape_byte != last_byte) |
| 489 | LOG(4,("tape %5.4fs: LEADOUT $00\n", | |
| 489 | LOG(4,("tape %5.4fs: LEADOUT $00\n", | |
| 490 | 490 | } |
| 491 | 491 | else |
| 492 | 492 | if (tape_byte < TAPE_LONGCLOCK) |
| 493 | 493 | { |
| 494 | 494 | if (tape_byte != last_byte) |
| 495 | 495 | { |
| 496 | LOG(4,("tape %5.4fs: LONG CLOCK\n", | |
| 496 | LOG(4,("tape %5.4fs: LONG CLOCK\n", | |
| 497 | 497 | set_led_status(2, 0); |
| 498 | 498 | } |
| 499 | 499 | rclk = 1; |
| r1293 | r1294 | |
| 509 | 509 | { |
| 510 | 510 | tape_bot_eot = 1; |
| 511 | 511 | set_led_status(1, 1); |
| 512 | LOG(5,("tape %5.4fs: %s found EOT\n", | |
| 512 | LOG(5,("tape %5.4fs: %s found EOT\n", | |
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | else |
| r1293 | r1294 | |
| 520 | 520 | { |
| 521 | 521 | tape_bot_eot = 0; |
| 522 | 522 | set_led_status(1, 0); |
| 523 | LOG(5,("tape %5.4fs: %s EOT and TRAILER\n", | |
| 523 | LOG(5,("tape %5.4fs: %s EOT and TRAILER\n", | |
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | else |
| r1293 | r1294 | |
| 530 | 530 | { |
| 531 | 531 | tape_bot_eot = 1; |
| 532 | 532 | set_led_status(1, 1); |
| 533 | LOG(5,("tape %5.4fs: %s found TRAILER\n", | |
| 533 | LOG(5,("tape %5.4fs: %s found TRAILER\n", | |
| 534 | 534 | } |
| 535 | 535 | offset = tape_length - 1; |
| 536 | 536 | } |
| r1293 | r1294 | |
| 599 | 599 | |
| 600 | 600 | data = (BIT0(data) << 0) | (BIT1(data) << 1) | 0x7c; |
| 601 | 601 | LOG(4,("%9.7f 6502-PC: %04x decocass_type1_latch_26_pass_3_inv_2_r(%02x): $%02x <- (%s %s)\n", |
| 602 | | |
| 602 | | |
| 603 | 603 | (data & 1) ? "OBF" : "-", |
| 604 | 604 | (data & 2) ? "IBF" : "-")); |
| 605 | 605 | } |
| r1293 | r1294 | |
| 647 | 647 | (((prom[promaddr] >> 4) & 1) << MAP7(type1_outmap)); |
| 648 | 648 | |
| 649 | 649 | LOG(3,("%9.7f 6502-PC: %04x decocass_type1_latch_26_pass_3_inv_2_r(%02x): $%02x\n", |
| 650 | | |
| 650 | | |
| 651 | 651 | |
| 652 | 652 | latch1 = save; /* latch the data for the next A0 == 0 read */ |
| 653 | 653 | } |
| r1293 | r1294 | |
| 679 | 679 | |
| 680 | 680 | data = (BIT0(data) << 0) | (BIT1(data) << 1) | 0x7c; |
| 681 | 681 | LOG(4,("%9.7f 6502-PC: %04x decocass_type1_pass_136_r(%02x): $%02x <- (%s %s)\n", |
| 682 | | |
| 682 | | |
| 683 | 683 | (data & 1) ? "OBF" : "-", |
| 684 | 684 | (data & 2) ? "IBF" : "-")); |
| 685 | 685 | } |
| r1293 | r1294 | |
| 727 | 727 | (((prom[promaddr] >> 4) & 1) << MAP7(type1_outmap)); |
| 728 | 728 | |
| 729 | 729 | LOG(3,("%9.7f 6502-PC: %04x decocass_type1_pass_136_r(%02x): $%02x\n", |
| 730 | | |
| 730 | | |
| 731 | 731 | |
| 732 | 732 | latch1 = save; /* latch the data for the next A0 == 0 read */ |
| 733 | 733 | } |
| r1293 | r1294 | |
| 759 | 759 | |
| 760 | 760 | data = (BIT0(data) << 0) | (BIT1(data) << 1) | 0x7c; |
| 761 | 761 | LOG(4,("%9.7f 6502-PC: %04x decocass_type1_latch_27_pass_3_inv_2_r(%02x): $%02x <- (%s %s)\n", |
| 762 | | |
| 762 | | |
| 763 | 763 | (data & 1) ? "OBF" : "-", |
| 764 | 764 | (data & 2) ? "IBF" : "-")); |
| 765 | 765 | } |
| r1293 | r1294 | |
| 807 | 807 | (((latch1 >> MAP7(type1_inmap)) & 1) << MAP7(type1_outmap)); |
| 808 | 808 | |
| 809 | 809 | LOG(3,("%9.7f 6502-PC: %04x decocass_type1_latch_27_pass_3_inv_2_r(%02x): $%02x\n", |
| 810 | | |
| 810 | | |
| 811 | 811 | |
| 812 | 812 | latch1 = save; /* latch the data for the next A0 == 0 read */ |
| 813 | 813 | } |
| r1293 | r1294 | |
| 839 | 839 | |
| 840 | 840 | data = (BIT0(data) << 0) | (BIT1(data) << 1) | 0x7c; |
| 841 | 841 | LOG(4,("%9.7f 6502-PC: %04x decocass_type1_latch_26_pass_5_inv_2_r(%02x): $%02x <- (%s %s)\n", |
| 842 | | |
| 842 | | |
| 843 | 843 | (data & 1) ? "OBF" : "-", |
| 844 | 844 | (data & 2) ? "IBF" : "-")); |
| 845 | 845 | } |
| r1293 | r1294 | |
| 887 | 887 | (((prom[promaddr] >> 4) & 1) << MAP7(type1_outmap)); |
| 888 | 888 | |
| 889 | 889 | LOG(3,("%9.7f 6502-PC: %04x decocass_type1_latch_26_pass_5_inv_2_r(%02x): $%02x\n", |
| 890 | | |
| 890 | | |
| 891 | 891 | |
| 892 | 892 | latch1 = save; /* latch the data for the next A0 == 0 read */ |
| 893 | 893 | } |
| r1293 | r1294 | |
| 921 | 921 | |
| 922 | 922 | data = (BIT0(data) << 0) | (BIT1(data) << 1) | 0x7c; |
| 923 | 923 | LOG(4,("%9.7f 6502-PC: %04x decocass_type1_latch_16_pass_3_inv_1_r(%02x): $%02x <- (%s %s)\n", |
| 924 | | |
| 924 | | |
| 925 | 925 | (data & 1) ? "OBF" : "-", |
| 926 | 926 | (data & 2) ? "IBF" : "-")); |
| 927 | 927 | } |
| r1293 | r1294 | |
| 969 | 969 | (((prom[promaddr] >> 4) & 1) << MAP7(type1_outmap)); |
| 970 | 970 | |
| 971 | 971 | LOG(3,("%9.7f 6502-PC: %04x decocass_type1_latch_16_pass_3_inv_1_r(%02x): $%02x\n", |
| 972 | | |
| 972 | | |
| 973 | 973 | |
| 974 | 974 | latch1 = save; /* latch the data for the next A0 == 0 read */ |
| 975 | 975 | } |
| r1293 | r1294 | |
| 998 | 998 | { |
| 999 | 999 | UINT8 *prom = memory_region(REGION_USER1); |
| 1000 | 1000 | data = prom[256 * type2_d2_latch + type2_promaddr]; |
| 1001 | LOG(3,("%9.7f 6502-PC: %04x decocass_type2_r(%02x): $%02x <- prom[%03x]\n", | |
| 1001 | LOG(3,("%9.7f 6502-PC: %04x decocass_type2_r(%02x): $%02x <- prom[%03x]\n", | |
| 1002 | 1002 | } |
| 1003 | 1003 | else |
| 1004 | 1004 | { |
| r1293 | r1294 | |
| 1012 | 1012 | else |
| 1013 | 1013 | data = offset & 0xff; |
| 1014 | 1014 | |
| 1015 | LOG(3,("%9.7f 6502-PC: %04x decocass_type2_r(%02x): $%02x <- 8041-%s\n", | |
| 1015 | LOG(3,("%9.7f 6502-PC: %04x decocass_type2_r(%02x): $%02x <- 8041-%s\n", | |
| 1016 | 1016 | } |
| 1017 | 1017 | return data; |
| 1018 | 1018 | } |
| r1293 | r1294 | |
| 1023 | 1023 | { |
| 1024 | 1024 | if (1 == (offset & 1)) |
| 1025 | 1025 | { |
| 1026 | LOG(4,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM+D2 latch", | |
| 1026 | LOG(4,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM+D2 latch", | |
| 1027 | 1027 | } |
| 1028 | 1028 | else |
| 1029 | 1029 | { |
| 1030 | 1030 | type2_promaddr = data; |
| 1031 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM addr $%02x\n", | |
| 1031 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM addr $%02x\n", | |
| 1032 | 1032 | return; |
| 1033 | 1033 | } |
| 1034 | 1034 | } |
| 1035 | 1035 | else |
| 1036 | 1036 | { |
| 1037 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s ", | |
| 1037 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s ", | |
| 1038 | 1038 | } |
| 1039 | 1039 | if (1 == (offset & 1)) |
| 1040 | 1040 | { |
| r1293 | r1294 | |
| 1078 | 1078 | { |
| 1079 | 1079 | UINT8 *prom = memory_region(REGION_USER1); |
| 1080 | 1080 | data = prom[type3_ctrs]; |
| 1081 | LOG(3,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x <- prom[$%03x]\n", | |
| 1081 | LOG(3,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x <- prom[$%03x]\n", | |
| 1082 | 1082 | if (++type3_ctrs == 4096) |
| 1083 | 1083 | type3_ctrs = 0; |
| 1084 | 1084 | } |
| r1293 | r1294 | |
| 1087 | 1087 | if (0 == (offset & E5XX_MASK)) |
| 1088 | 1088 | { |
| 1089 | 1089 | data = cpunum_get_reg(2, I8X41_STAT); |
| 1090 | LOG(4,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x <- 8041 STATUS\n", | |
| 1090 | LOG(4,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x <- 8041 STATUS\n", | |
| 1091 | 1091 | } |
| 1092 | 1092 | else |
| 1093 | 1093 | { |
| 1094 | 1094 | data = 0xff; /* open data bus? */ |
| 1095 | LOG(4,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus\n", | |
| 1095 | LOG(4,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus\n", | |
| 1096 | 1096 | } |
| 1097 | 1097 | } |
| 1098 | 1098 | } |
| r1293 | r1294 | |
| 1101 | 1101 | if (1 == type3_pal_19) |
| 1102 | 1102 | { |
| 1103 | 1103 | save = data = 0xff; /* open data bus? */ |
| 1104 | LOG(3,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus", | |
| 1104 | LOG(3,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus", | |
| 1105 | 1105 | } |
| 1106 | 1106 | else |
| 1107 | 1107 | { |
| r1293 | r1294 | |
| 1232 | 1232 | (BIT7(save) << 7); |
| 1233 | 1233 | } |
| 1234 | 1234 | type3_d0_latch = save & 1; |
| 1235 | LOG(3,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- 8041-DATA\n", | |
| 1235 | LOG(3,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- 8041-DATA\n", | |
| 1236 | 1236 | } |
| 1237 | 1237 | else |
| 1238 | 1238 | { |
| r1293 | r1294 | |
| 1246 | 1246 | (BIT5(save) << 5) | |
| 1247 | 1247 | (BIT6(save) << 7) | |
| 1248 | 1248 | (BIT7(save) << 6); |
| 1249 | LOG(3,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", | |
| 1249 | LOG(3,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", | |
| 1250 | 1250 | type3_d0_latch = save & 1; |
| 1251 | 1251 | } |
| 1252 | 1252 | } |
| r1293 | r1294 | |
| 1262 | 1262 | if (1 == type3_pal_19) |
| 1263 | 1263 | { |
| 1264 | 1264 | type3_ctrs = data << 4; |
| 1265 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1265 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1266 | 1266 | return; |
| 1267 | 1267 | } |
| 1268 | 1268 | else |
| r1293 | r1294 | |
| 1274 | 1274 | if (1 == type3_pal_19) |
| 1275 | 1275 | { |
| 1276 | 1276 | /* write nowhere?? */ |
| 1277 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1277 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1278 | 1278 | return; |
| 1279 | 1279 | } |
| 1280 | 1280 | } |
| 1281 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1281 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1282 | 1282 | cpunum_set_reg(2, offset & 1 ? I8X41_CMND : I8X41_DATA, data); |
| 1283 | 1283 | } |
| 1284 | 1284 | |
| r1293 | r1294 | |
| 1303 | 1303 | if (0 == (offset & E5XX_MASK)) |
| 1304 | 1304 | { |
| 1305 | 1305 | data = cpunum_get_reg(2, I8X41_STAT); |
| 1306 | LOG(4,("%9.7f 6502-PC: %04x decocass_type4_r(%02x): $%02x <- 8041 STATUS\n", | |
| 1306 | LOG(4,("%9.7f 6502-PC: %04x decocass_type4_r(%02x): $%02x <- 8041 STATUS\n", | |
| 1307 | 1307 | } |
| 1308 | 1308 | else |
| 1309 | 1309 | { |
| 1310 | 1310 | data = 0xff; /* open data bus? */ |
| 1311 | LOG(4,("%9.7f 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", | |
| 1311 | LOG(4,("%9.7f 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", | |
| 1312 | 1312 | } |
| 1313 | 1313 | } |
| 1314 | 1314 | else |
| r1293 | r1294 | |
| 1318 | 1318 | UINT8 *prom = memory_region(REGION_USER1); |
| 1319 | 1319 | |
| 1320 | 1320 | data = prom[type4_ctrs]; |
| 1321 | LOG(3,("%9.7f 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- PROM[%04x]\n", | |
| 1321 | LOG(3,("%9.7f 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- PROM[%04x]\n", | |
| 1322 | 1322 | type4_ctrs = (type4_ctrs+1) & 0x7fff; |
| 1323 | 1323 | } |
| 1324 | 1324 | else |
| r1293 | r1294 | |
| 1326 | 1326 | if (0 == (offset & E5XX_MASK)) |
| 1327 | 1327 | { |
| 1328 | 1328 | data = cpunum_get_reg(2, I8X41_DATA); |
| 1329 | LOG(3,("%9.7f 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", | |
| 1329 | LOG(3,("%9.7f 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", | |
| 1330 | 1330 | } |
| 1331 | 1331 | else |
| 1332 | 1332 | { |
| 1333 | 1333 | data = 0xff; /* open data bus? */ |
| 1334 | LOG(4,("%9.7f 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", | |
| 1334 | LOG(4,("%9.7f 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", | |
| 1335 | 1335 | } |
| 1336 | 1336 | } |
| 1337 | 1337 | } |
| r1293 | r1294 | |
| 1346 | 1346 | if (1 == type4_latch) |
| 1347 | 1347 | { |
| 1348 | 1348 | type4_ctrs = (type4_ctrs & 0x00ff) | ((data & 0x7f) << 8); |
| 1349 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS MSB (%04x)\n", | |
| 1349 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS MSB (%04x)\n", | |
| 1350 | 1350 | return; |
| 1351 | 1351 | } |
| 1352 | 1352 | else |
| r1293 | r1294 | |
| 1360 | 1360 | if (type4_latch) |
| 1361 | 1361 | { |
| 1362 | 1362 | type4_ctrs = (type4_ctrs & 0xff00) | data; |
| 1363 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS LSB (%04x)\n", | |
| 1363 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS LSB (%04x)\n", | |
| 1364 | 1364 | return; |
| 1365 | 1365 | } |
| 1366 | 1366 | } |
| 1367 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1367 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1368 | 1368 | cpunum_set_reg(2, offset & 1 ? I8X41_CMND : I8X41_DATA, data); |
| 1369 | 1369 | } |
| 1370 | 1370 | |
| r1293 | r1294 | |
| 1386 | 1386 | if (0 == (offset & E5XX_MASK)) |
| 1387 | 1387 | { |
| 1388 | 1388 | data = cpunum_get_reg(2, I8X41_STAT); |
| 1389 | LOG(4,("%9.7f 6502-PC: %04x decocass_type5_r(%02x): $%02x <- 8041 STATUS\n", | |
| 1389 | LOG(4,("%9.7f 6502-PC: %04x decocass_type5_r(%02x): $%02x <- 8041 STATUS\n", | |
| 1390 | 1390 | } |
| 1391 | 1391 | else |
| 1392 | 1392 | { |
| 1393 | 1393 | data = 0xff; /* open data bus? */ |
| 1394 | LOG(4,("%9.7f 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", | |
| 1394 | LOG(4,("%9.7f 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", | |
| 1395 | 1395 | } |
| 1396 | 1396 | } |
| 1397 | 1397 | else |
| r1293 | r1294 | |
| 1399 | 1399 | if (type5_latch) |
| 1400 | 1400 | { |
| 1401 | 1401 | data = 0x55; /* Only a fixed value? It looks like this is all we need to do */ |
| 1402 | LOG(3,("%9.7f 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- fixed value???\n", | |
| 1402 | LOG(3,("%9.7f 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- fixed value???\n", | |
| 1403 | 1403 | } |
| 1404 | 1404 | else |
| 1405 | 1405 | { |
| 1406 | 1406 | if (0 == (offset & E5XX_MASK)) |
| 1407 | 1407 | { |
| 1408 | 1408 | data = cpunum_get_reg(2, I8X41_DATA); |
| 1409 | LOG(3,("%9.7f 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", | |
| 1409 | LOG(3,("%9.7f 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", | |
| 1410 | 1410 | } |
| 1411 | 1411 | else |
| 1412 | 1412 | { |
| 1413 | 1413 | data = 0xff; /* open data bus? */ |
| 1414 | LOG(4,("%9.7f 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", | |
| 1414 | LOG(4,("%9.7f 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", | |
| 1415 | 1415 | } |
| 1416 | 1416 | } |
| 1417 | 1417 | } |
| r1293 | r1294 | |
| 1425 | 1425 | { |
| 1426 | 1426 | if (1 == type5_latch) |
| 1427 | 1427 | { |
| 1428 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1428 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1429 | 1429 | return; |
| 1430 | 1430 | } |
| 1431 | 1431 | else |
| r1293 | r1294 | |
| 1437 | 1437 | if (type5_latch) |
| 1438 | 1438 | { |
| 1439 | 1439 | /* write nowhere?? */ |
| 1440 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1440 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1441 | 1441 | return; |
| 1442 | 1442 | } |
| 1443 | 1443 | } |
| 1444 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1444 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1445 | 1445 | cpunum_set_reg(2, offset & 1 ? I8X41_CMND : I8X41_DATA, data); |
| 1446 | 1446 | } |
| 1447 | 1447 | |
| r1293 | r1294 | |
| 1462 | 1462 | if (0 == (offset & E5XX_MASK)) |
| 1463 | 1463 | { |
| 1464 | 1464 | data = cpunum_get_reg(2, I8X41_STAT); |
| 1465 | LOG(4,("%9.7f 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- 8041 STATUS\n", | |
| 1465 | LOG(4,("%9.7f 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- 8041 STATUS\n", | |
| 1466 | 1466 | } |
| 1467 | 1467 | else |
| 1468 | 1468 | { |
| 1469 | 1469 | data = 0xff; /* open data bus? */ |
| 1470 | LOG(4,("%9.7f 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", | |
| 1470 | LOG(4,("%9.7f 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", | |
| 1471 | 1471 | } |
| 1472 | 1472 | } |
| 1473 | 1473 | else |
| r1293 | r1294 | |
| 1475 | 1475 | if (0 == (offset & E5XX_MASK)) |
| 1476 | 1476 | { |
| 1477 | 1477 | data = cpunum_get_reg(2, I8X41_DATA); |
| 1478 | LOG(3,("%9.7f 6502-PC: %04x decocass_nodong_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", | |
| 1478 | LOG(3,("%9.7f 6502-PC: %04x decocass_nodong_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", | |
| 1479 | 1479 | } |
| 1480 | 1480 | else |
| 1481 | 1481 | { |
| 1482 | 1482 | data = 0xff; /* open data bus? */ |
| 1483 | LOG(4,("%9.7f 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", | |
| 1483 | LOG(4,("%9.7f 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", | |
| 1484 | 1484 | } |
| 1485 | 1485 | } |
| 1486 | 1486 | |
| r1293 | r1294 | |
| 1511 | 1511 | ((1 - tape_present) << 7); /* D7 = cassette present */ |
| 1512 | 1512 | |
| 1513 | 1513 | LOG(4,("%9.7f 6502-PC: %04x decocass_e5xx_r(%02x): $%02x <- STATUS (%s%s%s%s%s%s%s%s)\n", |
| 1514 | | |
| 1514 | | |
| 1515 | 1515 | activecpu_get_previouspc(), |
| 1516 | 1516 | offset, data, |
| 1517 | 1517 | data & 0x01 ? "" : "REQ/", |
| r1293 | r1294 | |
| 1543 | 1543 | |
| 1544 | 1544 | if (0 == (offset & E5XX_MASK)) |
| 1545 | 1545 | { |
| 1546 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1546 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", | |
| 1547 | 1547 | cpunum_set_reg(2, offset & 1 ? I8X41_CMND : I8X41_DATA, data); |
| 1548 | 1548 | #ifdef MAME_DEBUG |
| 1549 | 1549 | decocass_fno(offset, data); |
| r1293 | r1294 | |
| 1551 | 1551 | } |
| 1552 | 1552 | else |
| 1553 | 1553 | { |
| 1554 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> dongle\n", | |
| 1554 | LOG(3,("%9.7f 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> dongle\n", | |
| 1555 | 1555 | } |
| 1556 | 1556 | } |
| 1557 | 1557 | |
| r1293 | r1294 | |
| 1604 | 1604 | decocass_w(A, mem[A]); |
| 1605 | 1605 | /* restart the timer if the tape was playing */ |
| 1606 | 1606 | if (0 != tape_dir) |
| 1607 | | |
| 1607 | | |
| 1608 | 1608 | #endif |
| 1609 | 1609 | } |
| 1610 | 1610 | |
| r1293 | r1294 | |
| 1615 | 1615 | state_save_register_global(tape_dir); |
| 1616 | 1616 | state_save_register_global(tape_speed); |
| 1617 | 1617 | state_save_register_global(tape_time0.seconds); |
| 1618 | state_save_register_global(tape_time0. | |
| 1618 | state_save_register_global(tape_time0.attoseconds); | |
| 1619 | 1619 | state_save_register_global(firsttime); |
| 1620 | 1620 | state_save_register_global(tape_present); |
| 1621 | 1621 | state_save_register_global(tape_blocks); |
| r1293 | r1294 | |
| 1650 | 1650 | * |
| 1651 | 1651 | ***************************************************************************/ |
| 1652 | 1652 | |
| 1653 | void decocass_init_common(void) | |
| 1653 | static void decocass_init_common(void) | |
| 1654 | 1654 | { |
| 1655 | 1655 | UINT8 *image = memory_region(REGION_USER2); |
| 1656 | 1656 | int i, offs; |
| 1657 | 1657 | |
| 1658 | 1658 | tape_dir = 0; |
| 1659 | 1659 | tape_speed = 0; |
| 1660 | tape_timer = | |
| 1660 | tape_timer = | |
| 1661 | 1661 | |
| 1662 | 1662 | firsttime = 1; |
| 1663 | 1663 | tape_present = 1; |
| r1293 | r1294 | |
| 1686 | 1686 | } |
| 1687 | 1687 | |
| 1688 | 1688 | tape_length = tape_blocks * TAPE_CHUNK * 8 * 2 + 2 * (TAPE_LEADER + TAPE_GAP + TAPE_HOLE); |
| 1689 | tape_time0 = | |
| 1689 | tape_time0 = | |
| 1690 | 1690 | LOG(0,("tape: %d blocks\n", tape_blocks)); |
| 1691 | 1691 | tape_bot_eot = 0; |
| 1692 | 1692 | |
| r1293 | r1294 | |
| 1711 | 1711 | |
| 1712 | 1712 | memset(decocass_quadrature_decoder, 0, sizeof(decocass_quadrature_decoder)); |
| 1713 | 1713 | decocass_sound_ack = 0; |
| 1714 | decocass_sound_timer = | |
| 1714 | decocass_sound_timer = | |
| 1715 | 1715 | } |
| 1716 | 1716 | |
| 1717 | 1717 | MACHINE_RESET( decocass ) |
| r1293 | r1294 | |
| 1986 | 1986 | /* remember time */ |
| 1987 | 1987 | tape_time0 = decocass_adjust_tape_time(tape_time0); |
| 1988 | 1988 | |
| 1989 | | |
| 1989 | | |
| 1990 | 1990 | } |
| 1991 | 1991 | |
| 1992 | 1992 | |
| r1293 | r1294 | |
| 1997 | 1997 | if (data != i8041_p1_old) |
| 1998 | 1998 | { |
| 1999 | 1999 | LOG(4,("%9.7f 8041-PC: %03x i8041_p1_w: $%02x (%s%s%s%s%s%s%s%s)\n", |
| 2000 | | |
| 2000 | | |
| 2001 | 2001 | activecpu_get_previouspc(), |
| 2002 | 2002 | data, |
| 2003 | 2003 | data & 0x01 ? "" : "DATA-WRT", |
| r1293 | r1294 | |
| 2017 | 2017 | tape_stop(); |
| 2018 | 2018 | if (0 == (data & 0x10)) |
| 2019 | 2019 | { |
| 2020 | LOG(2,("tape %5.4fs: rewind\n", | |
| 2020 | LOG(2,("tape %5.4fs: rewind\n", | |
| 2021 | 2021 | tape_dir = -1; |
| 2022 | | |
| 2022 | | |
| 2023 | 2023 | set_led_status(0, 1); |
| 2024 | 2024 | } |
| 2025 | 2025 | else |
| 2026 | 2026 | { |
| 2027 | 2027 | tape_dir = 0; |
| 2028 | 2028 | tape_speed = 0; |
| 2029 | LOG(2,("tape %5.4fs: stopped\n", | |
| 2029 | LOG(2,("tape %5.4fs: stopped\n", | |
| 2030 | 2030 | #if TAPE_UI_DISPLAY |
| 2031 | popmessage(" [%05.1fs] ", | |
| 2031 | popmessage(" [%05.1fs] ", | |
| 2032 | 2032 | #endif |
| 2033 | 2033 | set_led_status(0, 0); |
| 2034 | 2034 | } |
| r1293 | r1294 | |
| 2040 | 2040 | tape_stop(); |
| 2041 | 2041 | if (0 == (data & 0x20)) |
| 2042 | 2042 | { |
| 2043 | LOG(2,("tape %5.4fs: forward\n", | |
| 2043 | LOG(2,("tape %5.4fs: forward\n", | |
| 2044 | 2044 | tape_dir = +1; |
| 2045 | | |
| 2045 | | |
| 2046 | 2046 | set_led_status(0, 1); |
| 2047 | 2047 | } |
| 2048 | 2048 | else |
| 2049 | 2049 | { |
| 2050 | 2050 | tape_dir = 0; |
| 2051 | 2051 | tape_speed = 0; |
| 2052 | LOG(2,("tape %5.4fs: stopped\n", | |
| 2052 | LOG(2,("tape %5.4fs: stopped\n", | |
| 2053 | 2053 | #if TAPE_UI_DISPLAY |
| 2054 | popmessage(" [%05.1fs] ", | |
| 2054 | popmessage(" [%05.1fs] ", | |
| 2055 | 2055 | #endif |
| 2056 | 2056 | set_led_status(0, 0); |
| 2057 | 2057 | } |
| r1293 | r1294 | |
| 2067 | 2067 | { |
| 2068 | 2068 | LOG(2,("tape: fast rewind %s\n", (0 == (data & 0x04)) ? "on" : "off")); |
| 2069 | 2069 | tape_dir = (tape_speed) ? -7 : -1; |
| 2070 | | |
| 2070 | | |
| 2071 | 2071 | } |
| 2072 | 2072 | else |
| 2073 | 2073 | if (tape_dir > 0) |
| 2074 | 2074 | { |
| 2075 | 2075 | LOG(2,("tape: fast forward %s\n", (0 == (data & 0x04)) ? "on" : "off")); |
| 2076 | 2076 | tape_dir = (tape_speed) ? +7 : +1; |
| 2077 | | |
| 2077 | | |
| 2078 | 2078 | } |
| 2079 | 2079 | } |
| 2080 | 2080 | |
| r1293 | r1294 | |
| 2089 | 2089 | if (data != i8041_p1_old) |
| 2090 | 2090 | { |
| 2091 | 2091 | LOG(4,("%9.7f 8041-PC: %03x i8041_p1_r: $%02x (%s%s%s%s%s%s%s%s)\n", |
| 2092 | | |
| 2092 | | |
| 2093 | 2093 | activecpu_get_previouspc(), |
| 2094 | 2094 | data, |
| 2095 | 2095 | data & 0x01 ? "" : "DATA-WRT", |
| r1293 | r1294 | |
| 2112 | 2112 | if (data != i8041_p2_old) |
| 2113 | 2113 | { |
| 2114 | 2114 | LOG(4,("%9.7f 8041-PC: %03x i8041_p2_w: $%02x (%s%s%s%s%s%s%s%s)\n", |
| 2115 | | |
| 2115 | | |
| 2116 | 2116 | activecpu_get_previouspc(), |
| 2117 | 2117 | data, |
| 2118 | 2118 | data & 0x01 ? "" : "FNO/", |
| r1293 | r1294 | |
| 2140 | 2140 | if (data != i8041_p2_old) |
| 2141 | 2141 | { |
| 2142 | 2142 | LOG(4,("%9.7f 8041-PC: %03x i8041_p2_r: $%02x (%s%s%s%s%s%s%s%s)\n", |
| 2143 | | |
| 2143 | | |
| 2144 | 2144 | activecpu_get_previouspc(), |
| 2145 | 2145 | data, |
| 2146 | 2146 | data & 0x01 ? "" : "FNO/", |
| r1293 | r1294 | |
|---|---|---|
| 24 | 24 | extern READ8_HANDLER( decocass_input_r ); |
| 25 | 25 | extern int tape_dir; |
| 26 | 26 | extern int tape_speed; |
| 27 | extern mame_time tape_time0; | |
| 28 | extern mame_timer *tape_timer; | |
| 29 | mame_time decocass_adjust_tape_time(mame_time tape_time); | |
| 27 | extern attotime tape_time0; | |
| 28 | extern emu_timer *tape_timer; | |
| 29 | attotime decocass_adjust_tape_time(attotime tape_time); | |
| 30 | 30 | |
| 31 | 31 | extern WRITE8_HANDLER( decocass_reset_w ); |
| 32 | 32 |
| r1293 | r1294 | |
|---|---|---|
| 352 | 352 | |
| 353 | 353 | /*****************************************************************************/ |
| 354 | 354 | |
| 355 | UINT32 nwk_fifo_r(int board) | |
| 355 | static UINT32 nwk_fifo_r(int board) | |
| 356 | 356 | { |
| 357 | 357 | int cpu = (board == 0) ? 2 : 3; |
| 358 | 358 | UINT32 data; |
| r1293 | r1294 | |
| 390 | 390 | return data; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | void nwk_fifo_w(int board, UINT32 data) | |
| 393 | static void nwk_fifo_w(int board, UINT32 data) | |
| 394 | 394 | { |
| 395 | 395 | int cpu = (board == 0) ? 2 : 3; |
| 396 | 396 |
| r1293 | r1294 | |
|---|---|---|
| 35 | 35 | static UINT8 irmb_running; |
| 36 | 36 | |
| 37 | 37 | #if IR_TIMING |
| 38 | static mame_timer *irvg_timer; | |
| 39 | static mame_timer *irmb_timer; | |
| 38 | static emu_timer *irvg_timer; | |
| 39 | static emu_timer *irmb_timer; | |
| 40 | 40 | #endif |
| 41 | 41 | |
| 42 | 42 | static UINT8 *comRAM[2], *mbRAM, *mbROM; |
| r1293 | r1294 | |
| 112 | 112 | else |
| 113 | 113 | logerror("vg start [busy!] "); |
| 114 | 114 | IR_CPU_STATE; |
| 115 | | |
| 115 | | |
| 116 | 116 | #endif |
| 117 | 117 | irvg_running=1; |
| 118 | 118 | } |
| r1293 | r1294 | |
| 185 | 185 | /* set a callback for the next 32-scanline increment */ |
| 186 | 186 | scanline += 32; |
| 187 | 187 | if (scanline >= 256) scanline = 0; |
| 188 | | |
| 188 | | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | static TIMER_CALLBACK( irmb_done_callback ); |
| r1293 | r1294 | |
| 201 | 201 | |
| 202 | 202 | irvg_vblank=0; |
| 203 | 203 | irvg_running = 0; |
| 204 | irvg_timer = | |
| 204 | irvg_timer = | |
| 205 | 205 | irmb_running = 0; |
| 206 | irmb_timer = | |
| 206 | irmb_timer = | |
| 207 | 207 | |
| 208 | 208 | /* set an initial timer to go off on scanline 0 */ |
| 209 | | |
| 209 | | |
| 210 | 210 | |
| 211 | 211 | irobot_rom_banksel_w(0,0); |
| 212 | 212 | irobot_out0_w(0,0); |
| r1293 | r1294 | |
| 850 | 850 | #if IR_TIMING |
| 851 | 851 | if (irmb_running == 0) |
| 852 | 852 | { |
| 853 | | |
| 853 | | |
| 854 | 854 | logerror("mb start "); |
| 855 | 855 | IR_CPU_STATE; |
| 856 | 856 | } |
| r1293 | r1294 | |
| 858 | 858 | { |
| 859 | 859 | logerror("mb start [busy!] "); |
| 860 | 860 | IR_CPU_STATE; |
| 861 | | |
| 861 | | |
| 862 | 862 | } |
| 863 | 863 | #else |
| 864 | 864 | cpunum_set_input_line(0, M6809_FIRQ_LINE, ASSERT_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 41 | 41 | |
| 42 | 42 | static UINT8 leland_gfx_control; |
| 43 | 43 | static UINT8 wcol_enable; |
| 44 | static | |
| 44 | static | |
| 45 | 45 | |
| 46 | 46 | static UINT8 *master_base; |
| 47 | 47 | static UINT8 *slave_base; |
| r1293 | r1294 | |
| 361 | 361 | battery_ram = auto_malloc(LELAND_BATTERY_RAM_SIZE); |
| 362 | 362 | |
| 363 | 363 | /* start scanline interrupts going */ |
| 364 | master_int_timer = | |
| 364 | master_int_timer = | |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | |
| 368 | 368 | MACHINE_RESET( leland ) |
| 369 | 369 | { |
| 370 | | |
| 370 | | |
| 371 | 371 | |
| 372 | 372 | /* reset globals */ |
| 373 | 373 | leland_gfx_control = 0x00; |
| r1293 | r1294 | |
| 414 | 414 | extra_tram = auto_malloc(ATAXX_EXTRA_TRAM_SIZE); |
| 415 | 415 | |
| 416 | 416 | /* start scanline interrupts going */ |
| 417 | master_int_timer = | |
| 417 | master_int_timer = | |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | |
| 421 | 421 | MACHINE_RESET( ataxx ) |
| 422 | 422 | { |
| 423 | 423 | memset(extra_tram, 0, ATAXX_EXTRA_TRAM_SIZE); |
| 424 | | |
| 424 | | |
| 425 | 425 | |
| 426 | 426 | /* initialize the XROM */ |
| 427 | 427 | xrom_length = memory_region_length(REGION_USER1); |
| r1293 | r1294 | |
| 475 | 475 | scanline += 16; |
| 476 | 476 | if (scanline > 248) |
| 477 | 477 | scanline = 8; |
| 478 | | |
| 478 | | |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | |
| r1293 | r1294 | |
| 489 | 489 | cpunum_set_input_line(0, 0, HOLD_LINE); |
| 490 | 490 | |
| 491 | 491 | /* set a timer for the next one */ |
| 492 | | |
| 492 | | |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | |
| r1293 | r1294 | |
| 1274 | 1274 | break; |
| 1275 | 1275 | |
| 1276 | 1276 | case 0x08: /* */ |
| 1277 | | |
| 1277 | | |
| 1278 | 1278 | break; |
| 1279 | 1279 | |
| 1280 | 1280 | default: |
| r1293 | r1294 | |
|---|---|---|
| 49 | 49 | struct pic_state |
| 50 | 50 | { |
| 51 | 51 | UINT16 latch; |
| 52 | | |
| 52 | | |
| 53 | 53 | UINT8 state; |
| 54 | 54 | UINT8 index; |
| 55 | 55 | UINT8 total; |
| r1293 | r1294 | |
| 61 | 61 | UINT8 time_index; |
| 62 | 62 | UINT8 time_just_written; |
| 63 | 63 | UINT16 yearoffs; |
| 64 | | |
| 64 | | |
| 65 | 65 | }; |
| 66 | 66 | |
| 67 | 67 | struct ioasic_state |
| r1293 | r1294 | |
| 265 | 265 | { |
| 266 | 266 | state_save_register_global(pic.latch); |
| 267 | 267 | state_save_register_global(pic.latch_expire_time.seconds); |
| 268 | state_save_register_global(pic.latch_expire_time. | |
| 268 | state_save_register_global(pic.latch_expire_time.attoseconds); | |
| 269 | 269 | state_save_register_global(pic.state); |
| 270 | 270 | state_save_register_global(pic.index); |
| 271 | 271 | state_save_register_global(pic.total); |
| r1293 | r1294 | |
| 287 | 287 | |
| 288 | 288 | pic.yearoffs = yearoffs; |
| 289 | 289 | pic.time_just_written = 0; |
| 290 | pic.time_write_timer = | |
| 290 | pic.time_write_timer = | |
| 291 | 291 | memset(pic.default_nvram, 0xff, sizeof(pic.default_nvram)); |
| 292 | 292 | generate_serial_data(upper); |
| 293 | 293 | } |
| r1293 | r1294 | |
| 306 | 306 | /* if we're still holding the data ready bit high, do it */ |
| 307 | 307 | if (pic.latch & 0xf00) |
| 308 | 308 | { |
| 309 | if ( | |
| 309 | if ( | |
| 310 | 310 | pic.latch &= 0xff; |
| 311 | 311 | else |
| 312 | 312 | pic.latch -= 0x100; |
| r1293 | r1294 | |
| 352 | 352 | |
| 353 | 353 | /* store in the latch, along with a bit to indicate we have data */ |
| 354 | 354 | pic.latch = (data & 0x00f) | 0x480; |
| 355 | pic.latch_expire_time = a | |
| 355 | pic.latch_expire_time = a | |
| 356 | 356 | if (data & 0x10) |
| 357 | 357 | { |
| 358 | 358 | int cmd = pic.state ? (pic.state & 0x0f) : (pic.latch & 0x0f); |
| r1293 | r1294 | |
| 441 | 441 | /* otherwise, flag the time as having just been written for 1/2 second */ |
| 442 | 442 | else |
| 443 | 443 | { |
| 444 | | |
| 444 | | |
| 445 | 445 | pic.time_just_written = 1; |
| 446 | 446 | pic.state = 0; |
| 447 | 447 | } |
| r1293 | r1294 | |
|---|---|---|
| 139 | 139 | return src; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | void kabuki_decode(UINT8 *src,UINT8 *dest_op,UINT8 *dest_data, | |
| 142 | static void kabuki_decode(UINT8 *src,UINT8 *dest_op,UINT8 *dest_data, | |
| 143 | 143 | int base_addr,int length,int swap_key1,int swap_key2,int addr_key,int xor_key) |
| 144 | 144 | { |
| 145 | 145 | int A; |
| r1293 | r1294 | |
|---|---|---|
| 105 | 105 | } trans32T; |
| 106 | 106 | |
| 107 | 107 | // local variables |
| 108 | static | |
| 108 | static | |
| 109 | 109 | static partitionT partitions[MAX_FILTERS]; |
| 110 | 110 | static partitionT *transpart; |
| 111 | 111 | |
| r1293 | r1294 | |
| 198 | 198 | cr3 = (cd_curfad>>16)&0xff; |
| 199 | 199 | cr4 = cd_curfad; |
| 200 | 200 | |
| 201 | | |
| 201 | | |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | // global functions |
| r1293 | r1294 | |
| 273 | 273 | cd_stat = CD_STAT_OPEN; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | sector_timer = mame_timer_alloc(sector_cb); | |
| 277 | mame_timer_adjust(sector_timer, MAME_TIME_IN_HZ(150), 0, time_zero); // 150 sectors / second = 300kBytes/second | |
| 276 | sector_timer = timer_alloc(sector_cb); | |
| 277 | timer_adjust(sector_timer, ATTOTIME_IN_HZ(150), 0, attotime_zero); // 150 sectors / second = 300kBytes/second | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | static blockT *cd_alloc_block(UINT8 *blknum) |
| r1293 | r1294 | |
| 776 | 776 | |
| 777 | 777 | // and do the disc I/O |
| 778 | 778 | // make sure it doesn't come in too early |
| 779 | mame_timer_adjust(sector_timer, time_never, 0, time_never); | |
| 780 | mame_timer_adjust(sector_timer, MAME_TIME_IN_HZ(150), 0, time_zero); // 150 sectors / second = 300kBytes/second | |
| 779 | timer_adjust(sector_timer, attotime_never, 0, attotime_never); | |
| 780 | timer_adjust(sector_timer, ATTOTIME_IN_HZ(150), 0, attotime_zero); // 150 sectors / second = 300kBytes/second | |
| 781 | 781 | break; |
| 782 | 782 | |
| 783 | 783 | case 0x1100: // disk seek |
| r1293 | r1294 | |
| 1285 | 1285 | playtype = 1; |
| 1286 | 1286 | |
| 1287 | 1287 | // and do the disc I/O |
| 1288 | // | |
| 1288 | // | |
| 1289 | 1289 | break; |
| 1290 | 1290 | |
| 1291 | 1291 | case 0x7500: |
| r1293 | r1294 | |
|---|---|---|
| 21 | 21 | { |
| 22 | 22 | UINT8 status; |
| 23 | 23 | UINT8 power; |
| 24 | | |
| 24 | | |
| 25 | 25 | }; |
| 26 | 26 | |
| 27 | 27 | static int active_bit = 0x80; |
| r1293 | r1294 | |
| 53 | 53 | { |
| 54 | 54 | dispenser[i].status = ticketnotdispensed; |
| 55 | 55 | dispenser[i].power = 0x00; |
| 56 | dispenser[i].timer = | |
| 56 | dispenser[i].timer = | |
| 57 | 57 | |
| 58 | 58 | state_save_register_item("ticket", i, dispenser[i].status); |
| 59 | 59 | state_save_register_item("ticket", i, dispenser[i].power); |
| r1293 | r1294 | |
| 102 | 102 | #ifdef DEBUG_TICKET |
| 103 | 103 | logerror("PC: %04X Ticket Power On\n", activecpu_get_pc()); |
| 104 | 104 | #endif |
| 105 | | |
| 105 | | |
| 106 | 106 | dispenser[0].power = 1; |
| 107 | 107 | |
| 108 | 108 | dispenser[0].status = ticketnotdispensed; |
| r1293 | r1294 | |
| 115 | 115 | #ifdef DEBUG_TICKET |
| 116 | 116 | logerror("PC: %04X Ticket Power Off\n", activecpu_get_pc()); |
| 117 | 117 | #endif |
| 118 | | |
| 118 | | |
| 119 | 119 | set_led_status(2,0); |
| 120 | 120 | dispenser[0].power = 0; |
| 121 | 121 | } |
| r1293 | r1294 | |
| 132 | 132 | #ifdef DEBUG_TICKET |
| 133 | 133 | logerror("PC: %04X Ticket Power On\n", activecpu_get_pc()); |
| 134 | 134 | #endif |
| 135 | | |
| 135 | | |
| 136 | 136 | dispenser[1].power = 1; |
| 137 | 137 | |
| 138 | 138 | dispenser[1].status = ticketnotdispensed; |
| r1293 | r1294 | |
| 145 | 145 | #ifdef DEBUG_TICKET |
| 146 | 146 | logerror("PC: %04X Ticket Power Off\n", activecpu_get_pc()); |
| 147 | 147 | #endif |
| 148 | | |
| 148 | | |
| 149 | 149 | set_led_status(2,0); |
| 150 | 150 | dispenser[1].power = 0; |
| 151 | 151 | } |
| r1293 | r1294 | |
| 171 | 171 | #ifdef DEBUG_TICKET |
| 172 | 172 | logerror("Ticket Status Changed to %02X\n", status); |
| 173 | 173 | #endif |
| 174 | | |
| 174 | | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if (dispenser->status == ticketdispensed) |
| r1293 | r1294 | |
|---|---|---|
| 158 | 158 | |
| 159 | 159 | static struct namcoio io[MAX_NAMCOIO]; |
| 160 | 160 | static INT32 nmi_cpu[MAX_06XX]; |
| 161 | static | |
| 161 | static | |
| 162 | 162 | |
| 163 | 163 | static READ8_HANDLER( nop_r ) { return 0x0f; } |
| 164 | 164 | static WRITE8_HANDLER( nop_w ) { } |
| r1293 | r1294 | |
| 182 | 182 | 07: nop |
| 183 | 183 | */ |
| 184 | 184 | |
| 185 | void namcoio_51XX_write(int chip,int data) | |
| 185 | static void namcoio_51XX_write(int chip,int data) | |
| 186 | 186 | { |
| 187 | 187 | data &= 0x07; |
| 188 | 188 | |
| r1293 | r1294 | |
| 282 | 282 | { 0xf, 0xe, 0xd, 0x5, 0xc, 0x9, 0x7, 0x6, 0xb, 0x3, 0xa, 0x4, 0x1, 0x2, 0x0, 0x8 }; |
| 283 | 283 | |
| 284 | 284 | |
| 285 | UINT8 namcoio_51XX_read(int chip) | |
| 285 | static UINT8 namcoio_51XX_read(int chip) | |
| 286 | 286 | { |
| 287 | 287 | #if VERBOSE |
| 288 | 288 | logerror("%04x: custom 51XX read\n",activecpu_get_pc()); |
| r1293 | r1294 | |
| 435 | 435 | /***************************************************************************/ |
| 436 | 436 | |
| 437 | 437 | |
| 438 | UINT8 namcoio_ram[MAX_NAMCOIO * 16]; | |
| 438 | static UINT8 namcoio_ram[MAX_NAMCOIO * 16]; | |
| 439 | 439 | |
| 440 | 440 | #define IORAM_READ(offset) (namcoio_ram[chip * 0x10 + (offset)] & 0x0f) |
| 441 | 441 | #define IORAM_WRITE(offset,data) {namcoio_ram[chip * 0x10 + (offset)] = (data) & 0x0f;} |
| r1293 | r1294 | |
| 794 | 794 | if (chipnum < MAX_NAMCOIO && state != CLEAR_LINE && !io[chipnum].reset) |
| 795 | 795 | { |
| 796 | 796 | /* give the cpu a tiny bit of time to write the command before processing it */ |
| 797 | | |
| 797 | | |
| 798 | 798 | } |
| 799 | 799 | } |
| 800 | 800 | |
| r1293 | r1294 | |
| 876 | 876 | namcoio_init(4*chipnum + 2, type2, intf2); |
| 877 | 877 | namcoio_init(4*chipnum + 3, type3, intf3); |
| 878 | 878 | nmi_cpu[chipnum] = cpu; |
| 879 | nmi_timer[chipnum] = | |
| 879 | nmi_timer[chipnum] = | |
| 880 | 880 | namco_06xx_state_save(chipnum); |
| 881 | 881 | } |
| 882 | 882 | } |
| r1293 | r1294 | |
| 1041 | 1041 | #if VERBOSE |
| 1042 | 1042 | logerror("disabling nmi generate timer\n"); |
| 1043 | 1043 | #endif |
| 1044 | | |
| 1044 | | |
| 1045 | 1045 | } |
| 1046 | 1046 | else |
| 1047 | 1047 | { |
| r1293 | r1294 | |
| 1052 | 1052 | // inputs if a transfer terminates at the wrong time. |
| 1053 | 1053 | // On the other hand, the time cannot be too short otherwise the 54XX will |
| 1054 | 1054 | // not have enough time to process the incoming commands. |
| 1055 | | |
| 1055 | | |
| 1056 | 1056 | |
| 1057 | 1057 | if (customio_command[chip] & 0x10) |
| 1058 | 1058 | { |
| r1293 | r1294 | |
|---|---|---|
| 47 | 47 | READ8_HANDLER( pitnrun_mcu_status_r ) |
| 48 | 48 | { |
| 49 | 49 | /* mcu synchronization */ |
| 50 | cpu_yielduntil_time ( | |
| 50 | cpu_yielduntil_time ( | |
| 51 | 51 | /* bit 0 = the 68705 has read data from the Z80 */ |
| 52 | 52 | /* bit 1 = the 68705 has written data for the Z80 */ |
| 53 | 53 | return ~((zready << 1) | (zaccept << 0)); |
| r1293 | r1294 | |
|---|---|---|
| 700 | 700 | namcos1_active_bank[banknum] = *handler; |
| 701 | 701 | } |
| 702 | 702 | |
| 703 | void namcos1_bankswitch(int cpu, offs_t offset, UINT8 data) | |
| 703 | static void namcos1_bankswitch(int cpu, offs_t offset, UINT8 data) | |
| 704 | 704 | { |
| 705 | 705 | static int chip[16]; |
| 706 | 706 | int bank = (cpu*8) + (( offset >> 9) & 0x07); |
| r1293 | r1294 | |
|---|---|---|
| 584 | 584 | |
| 585 | 585 | |
| 586 | 586 | // Video Interface |
| 587 | UINT32 vi_width; | |
| 587 | static UINT32 vi_width; | |
| 588 | 588 | UINT32 vi_origin; |
| 589 | 589 | UINT32 vi_control; |
| 590 | UINT32 vi_burst, vi_vsync, vi_hsync, vi_leap, vi_hstart, vi_vstart; | |
| 591 | UINT32 vi_intr, vi_vburst, vi_xscale, vi_yscale; | |
| 590 | static UINT32 vi_burst, vi_vsync, vi_hsync, vi_leap, vi_hstart, vi_vstart; | |
| 591 | static UINT32 vi_intr, vi_vburst, vi_xscale, vi_yscale; | |
| 592 | 592 | |
| 593 | 593 | READ32_HANDLER( n64_vi_reg_r ) |
| 594 | 594 | { |
| r1293 | r1294 | |
| 737 | 737 | static int ai_bitrate; |
| 738 | 738 | static UINT32 ai_status = 0; |
| 739 | 739 | |
| 740 | static | |
| 740 | static | |
| 741 | 741 | |
| 742 | 742 | #define SOUNDBUFFER_LENGTH 0x20000 |
| 743 | 743 | #define AUDIO_DMA_DEPTH 2 |
| r1293 | r1294 | |
| 756 | 756 | static void audio_fifo_push(UINT32 address, UINT32 length) |
| 757 | 757 | { |
| 758 | 758 | AUDIO_DMA *current; |
| 759 | | |
| 759 | | |
| 760 | 760 | |
| 761 | 761 | if (audio_fifo_num == AUDIO_DMA_DEPTH) |
| 762 | 762 | { |
| r1293 | r1294 | |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | // adjust the timer |
| 786 | period = scale_up_mame_time(MAME_TIME_IN_HZ(DACRATE_NTSC), (ai_dacrate + 1) * (current->length / 4)); | |
| 787 | mame_timer_adjust(audio_timer, period, 0, time_zero); | |
| 786 | period = attotime_mul(ATTOTIME_IN_HZ(DACRATE_NTSC), (ai_dacrate + 1) * (current->length / 4)); | |
| 787 | timer_adjust(audio_timer, period, 0, attotime_zero); | |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | static void audio_fifo_pop(void) |
| r1293 | r1294 | |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | // Serial Interface |
| 1060 | UINT8 pif_ram[0x40]; | |
| 1061 | UINT8 pif_cmd[0x40]; | |
| 1060 | static UINT8 pif_ram[0x40]; | |
| 1061 | static UINT8 pif_cmd[0x40]; | |
| 1062 | 1062 | UINT32 si_dram_addr = 0; |
| 1063 | 1063 | UINT32 si_pif_addr = 0; |
| 1064 | 1064 | UINT32 si_status = 0; |
| r1293 | r1294 | |
| 1576 | 1576 | cpunum_set_info_ptr(0, CPUINFO_PTR_MIPS3_FASTRAM_BASE, rdram); |
| 1577 | 1577 | cpunum_set_info_int(0, CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0); |
| 1578 | 1578 | |
| 1579 | audio_timer = mame_timer_alloc(audio_timer_callback); | |
| 1580 | mame_timer_adjust(audio_timer, time_never, 0, time_never); | |
| 1579 | audio_timer = timer_alloc(audio_timer_callback); | |
| 1580 | timer_adjust(audio_timer, attotime_never, 0, attotime_never); | |
| 1581 | 1581 | |
| 1582 | 1582 | cpunum_set_input_line(1, INPUT_LINE_HALT, ASSERT_LINE); |
| 1583 | 1583 |
| r1293 | r1294 | |
|---|---|---|
| 108 | 108 | { |
| 109 | 109 | // Do a RST10 |
| 110 | 110 | cpunum_set_input_line_and_vector(0,0,HOLD_LINE,0xd7); |
| 111 | | |
| 111 | | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /* |
| r1293 | r1294 | |
|---|---|---|
| 78 | 78 | |
| 79 | 79 | /* TAITO8741 I8741 emulation */ |
| 80 | 80 | |
| 81 | void taito8741_serial_rx(I8741 *st,UINT8 *data) | |
| 81 | static void taito8741_serial_rx(I8741 *st,UINT8 *data) | |
| 82 | 82 | { |
| 83 | 83 | memcpy(st->rxd,data,8); |
| 84 | 84 | } |
| r1293 | r1294 | |
| 445 | 445 | if( (i8741[num].sts & 0x02) ) |
| 446 | 446 | { |
| 447 | 447 | /* transmit data */ |
| 448 | | |
| 448 | | |
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 |
| r1293 | r1294 | |
|---|---|---|
| 392 | 392 | // Palette request cmd - verified to take around 122242 68000 cycles to complete |
| 393 | 393 | if (current_cmd >= 0x1 && current_cmd < 0x12) |
| 394 | 394 | { |
| 395 | | |
| 395 | | |
| 396 | 396 | } |
| 397 | 397 | // Unknown cmd - verified to take around 105500 68000 cycles to complete |
| 398 | 398 | else if (current_cmd >= 0x81 && current_cmd < 0x92) |
| 399 | 399 | { |
| 400 | | |
| 400 | | |
| 401 | 401 | } |
| 402 | 402 | else |
| 403 | 403 | { |
| r1293 | r1294 | |
|---|---|---|
| 35 | 35 | /* 8253 counter state */ |
| 36 | 36 | struct counter_state |
| 37 | 37 | { |
| 38 | | |
| 38 | | |
| 39 | 39 | UINT8 timer_active; |
| 40 | 40 | INT32 initial; |
| 41 | 41 | INT32 count; |
| r1293 | r1294 | |
| 48 | 48 | |
| 49 | 49 | static struct counter_state counter[3]; |
| 50 | 50 | |
| 51 | static | |
| 51 | static | |
| 52 | 52 | |
| 53 | 53 | /* manually clocked counter 0 states */ |
| 54 | 54 | static UINT8 counter_control; |
| 55 | 55 | static UINT8 counter_0_ff; |
| 56 | static | |
| 56 | static | |
| 57 | 57 | static UINT8 counter_0_timer_active; |
| 58 | 58 | |
| 59 | 59 | /* random number generator states */ |
| r1293 | r1294 | |
| 111 | 111 | { |
| 112 | 112 | /* next interrupt after scanline 256 is scanline 64 */ |
| 113 | 113 | if (param == 256) |
| 114 | | |
| 114 | | |
| 115 | 115 | else |
| 116 | | |
| 116 | | |
| 117 | 117 | |
| 118 | 118 | /* IRQ starts on scanline 0, 64, 128, etc. */ |
| 119 | 119 | cpunum_set_input_line(0, M6809_IRQ_LINE, ASSERT_LINE); |
| 120 | 120 | |
| 121 | 121 | /* it will turn off on the next HBLANK */ |
| 122 | | |
| 122 | | |
| 123 | 123 | |
| 124 | 124 | /* if this is Grudge Match, update the steering */ |
| 125 | 125 | if (grudge_steering_result & 0x80) |
| r1293 | r1294 | |
| 155 | 155 | |
| 156 | 156 | /* reset counters; counter 2's gate is tied high */ |
| 157 | 157 | memset(counter, 0, sizeof(counter)); |
| 158 | counter[1].timer = mame_timer_alloc(counter_callback); | |
| 159 | counter[2].timer = mame_timer_alloc(counter_callback); | |
| 158 | counter[1].timer = timer_alloc(counter_callback); | |
| 159 | counter[2].timer = timer_alloc(counter_callback); | |
| 160 | 160 | counter[2].gate = 1; |
| 161 | 161 | |
| 162 | 162 | /* reset the manual counter 0 clock */ |
| 163 | 163 | counter_control = 0x00; |
| 164 | 164 | counter_0_ff = 0; |
| 165 | counter_0_timer = | |
| 165 | counter_0_timer = | |
| 166 | 166 | counter_0_timer_active = 0; |
| 167 | 167 | |
| 168 | 168 | /* reset the ADC states */ |
| r1293 | r1294 | |
| 191 | 191 | memory_set_bank(2, 0); |
| 192 | 192 | |
| 193 | 193 | /* start a timer to generate interrupts */ |
| 194 | scanline_timer = mame_timer_alloc(interrupt_timer); | |
| 195 | mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_zero); | |
| 194 | scanline_timer = timer_alloc(interrupt_timer); | |
| 195 | timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_zero); | |
| 196 | 196 | |
| 197 | 197 | /* register for saving */ |
| 198 | 198 | for (i = 0; i < 3; i++) |
| r1293 | r1294 | |
| 525 | 525 | |
| 526 | 526 | /* set a timer for 500usec later to actually transmit the data */ |
| 527 | 527 | /* (this is very important for several games, esp Snacks'n Jaxson) */ |
| 528 | | |
| 528 | | |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | |
| r1293 | r1294 | |
| 661 | 661 | /* set a timer to go off and read the value after 50us */ |
| 662 | 662 | /* it's important that we do this for Mini Golf */ |
| 663 | 663 | logerror("adc_select %d\n", offset & 7); |
| 664 | | |
| 664 | | |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | |
| r1293 | r1294 | |
| 683 | 683 | if (counter[which].gate && !counter[which].timer_active) |
| 684 | 684 | { |
| 685 | 685 | counter[which].timer_active = 1; |
| 686 | | |
| 686 | | |
| 687 | 687 | } |
| 688 | 688 | } |
| 689 | 689 | } |
| r1293 | r1294 | |
| 693 | 693 | { |
| 694 | 694 | /* only stop the timer if it exists */ |
| 695 | 695 | if (counter[which].timer_active) |
| 696 | | |
| 696 | | |
| 697 | 697 | counter[which].timer_active = 0; |
| 698 | 698 | } |
| 699 | 699 | |
| r1293 | r1294 | |
| 704 | 704 | if (counter[which].timer_active) |
| 705 | 705 | { |
| 706 | 706 | /* determine how many 2MHz cycles are remaining */ |
| 707 | int count = | |
| 707 | int count = | |
| 708 | 708 | counter[which].count = (count < 0) ? 0 : count; |
| 709 | 709 | } |
| 710 | 710 | } |
| r1293 | r1294 | |
| 932 | 932 | |
| 933 | 933 | /* if there's already a timer, remove it */ |
| 934 | 934 | if (counter_0_timer_active) |
| 935 | | |
| 935 | | |
| 936 | 936 | counter_0_timer_active = 0; |
| 937 | 937 | |
| 938 | 938 | /* find the counter with the maximum frequency */ |
| r1293 | r1294 | |
| 957 | 957 | if (maxfreq > 0.0) |
| 958 | 958 | { |
| 959 | 959 | counter_0_timer_active = 1; |
| 960 | | |
| 960 | | |
| 961 | 961 | } |
| 962 | 962 | } |
| 963 | 963 | |
| r1293 | r1294 | |
| 1006 | 1006 | /* if we gate off, remove the timer */ |
| 1007 | 1007 | else if (counter[0].gate && !(data & 0x02) && counter_0_timer_active) |
| 1008 | 1008 | { |
| 1009 | | |
| 1009 | | |
| 1010 | 1010 | counter_0_timer_active = 0; |
| 1011 | 1011 | } |
| 1012 | 1012 |
| r1293 | r1294 | |
|---|---|---|
| 11 | 11 | #include "video/ppu2c0x.h" |
| 12 | 12 | |
| 13 | 13 | /* Globals */ |
| 14 | int vsnes_gun_controller; | |
| 15 | int vsnes_do_vrom_bank; | |
| 14 | static int vsnes_gun_controller; | |
| 15 | static int vsnes_do_vrom_bank; | |
| 16 | 16 | |
| 17 | 17 | /* Locals */ |
| 18 | 18 | static int input_latch[4]; |
| r0 | r1294 | |
|---|---|---|
| 1 | /////////////////////////////////////////////////////////////////////////// | |
| 2 | // // | |
| 3 | // Electro mechanical meters // | |
| 4 | // // | |
| 5 | // 23-07-2004: Re-Animator // | |
| 6 | // // | |
| 7 | // TODO: - meter ticks if the signal changes from high to low AND the // | |
| 8 | // signal was high for at least 'reacttime' cycles // | |
| 9 | // It should tick if the signal goes from low to high AND stays // | |
| 10 | // high for at least xxx milliseconds // | |
| 11 | // // | |
| 12 | /////////////////////////////////////////////////////////////////////////// | |
| 13 | ||
| 14 | #include "driver.h" | |
| 15 | #include "meters.h" | |
| 16 | ||
| 17 | // local vars ///////////////////////////////////////////////////////////// | |
| 18 | ||
| 19 | static struct | |
| 20 | { | |
| 21 | long timestamp, // time stamp in cycles after which timer will tick | |
| 22 | reacttime, | |
| 23 | count; // mechmeter value | |
| 24 | int state; // state 0/1 | |
| 25 | } meter_info[MAXMECHMETERS]; | |
| 26 | ||
| 27 | ||
| 28 | static int number_mtr; | |
| 29 | ||
| 30 | /////////////////////////////////////////////////////////////////////////// | |
| 31 | ||
| 32 | void Mechmtr_init(int number) | |
| 33 | { | |
| 34 | int i; | |
| 35 | ||
| 36 | if ( number > MAXMECHMETERS ) number = MAXMECHMETERS; | |
| 37 | ||
| 38 | for ( i = 0; i < number; i++ ) | |
| 39 | { | |
| 40 | meter_info[i].reacttime = METERREACTTIME; | |
| 41 | meter_info[i].state = 0; | |
| 42 | meter_info[i].count = 0; | |
| 43 | meter_info[i].timestamp = 0; | |
| 44 | } | |
| 45 | number_mtr = number; | |
| 46 | } | |
| 47 | ||
| 48 | /////////////////////////////////////////////////////////////////////////// | |
| 49 | ||
| 50 | int MechMtr_GetNumberMeters(void) | |
| 51 | { | |
| 52 | return number_mtr; | |
| 53 | } | |
| 54 | ||
| 55 | /////////////////////////////////////////////////////////////////////////// | |
| 56 | ||
| 57 | void MechMtr_Setcount(int id, long count) | |
| 58 | { | |
| 59 | if ( id >= number_mtr ) return; | |
| 60 | ||
| 61 | meter_info[id].count = count; | |
| 62 | } | |
| 63 | ||
| 64 | /////////////////////////////////////////////////////////////////////////// | |
| 65 | ||
| 66 | long MechMtr_Getcount(int id) | |
| 67 | { | |
| 68 | long result = 0; | |
| 69 | ||
| 70 | if ( id < number_mtr ) result = meter_info[id].count; | |
| 71 | ||
| 72 | return result; | |
| 73 | } | |
| 74 | ||
| 75 | /////////////////////////////////////////////////////////////////////////// | |
| 76 | ||
| 77 | void MechMtr_ReactTime(int id, long cycles) | |
| 78 | { | |
| 79 | if ( id >= number_mtr ) return; | |
| 80 | ||
| 81 | meter_info[id].reacttime = cycles; | |
| 82 | } | |
| 83 | ||
| 84 | /////////////////////////////////////////////////////////////////////////// | |
| 85 | ||
| 86 | int Mechmtr_update(int id, long cycles, int state) | |
| 87 | { | |
| 88 | int res = 0; | |
| 89 | ||
| 90 | if ( id >= number_mtr ) return res; | |
| 91 | ||
| 92 | state = state?1:0; | |
| 93 | ||
| 94 | if ( meter_info[id].state != state ) | |
| 95 | { // meter state is changing | |
| 96 | meter_info[id].state = state; | |
| 97 | ||
| 98 | if ( state ) | |
| 99 | { | |
| 100 | meter_info[id].timestamp = cycles + meter_info[id].reacttime; | |
| 101 | } | |
| 102 | else | |
| 103 | { | |
| 104 | if ( cycles > meter_info[id].timestamp ) | |
| 105 | { // meter has been active long enough | |
| 106 | res = 1; | |
| 107 | meter_info[id].count++; | |
| 108 | } | |
| 109 | } | |
| 110 | } | |
| 111 | ||
| 112 | return res; | |
| 113 | } |
| r1293 | r1294 | |
|---|---|---|
| 271 | 271 | INTERRUPT_GEN( qix_vblank_start ) |
| 272 | 272 | { |
| 273 | 273 | pia_3_cb1_w(0, 1); |
| 274 | | |
| 274 | | |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
| r1293 | r1294 | |
| 427 | 427 | cpunum_set_input_line(3, M68705_IRQ_LINE, ASSERT_LINE); |
| 428 | 428 | /* temporarily boost the interleave to sync things up */ |
| 429 | 429 | /* note: I'm using 50 because 30 is not enough for space dungeon at game over */ |
| 430 | cpu_boost_interleave(time_zero, | |
| 430 | cpu_boost_interleave(attotime_zero, | |
| 431 | 431 | } |
| 432 | 432 | else |
| 433 | 433 | cpunum_set_input_line(3, M68705_IRQ_LINE, CLEAR_LINE); |
| r0 | r1294 | |
|---|---|---|
| 1 | /////////////////////////////////////////////////////////////////////////// | |
| 2 | // // | |
| 3 | // Electro mechanical meters // | |
| 4 | // // | |
| 5 | // 23-07-2004: Re-Animator // | |
| 6 | // // | |
| 7 | // TODO: - meter ticks if the signal changes from high to low AND the // | |
| 8 | // signal was high for at least 'reacttime' cycles // | |
| 9 | // It should tick if the signal goes from low to high AND stays // | |
| 10 | // high for at least xxx milliseconds // | |
| 11 | // // | |
| 12 | /////////////////////////////////////////////////////////////////////////// | |
| 13 | ||
| 14 | #ifndef INC_MMTR | |
| 15 | #define INC_MMTR | |
| 16 | ||
| 17 | #define MAXMECHMETERS 8 | |
| 18 | ||
| 19 | #define METERREACTTIME 30000 // number of cycles meter has to be active to tick | |
| 20 | ||
| 21 | void Mechmtr_init( int number); | |
| 22 | ||
| 23 | int MechMtr_GetNumberMeters(void); | |
| 24 | ||
| 25 | void MechMtr_Setcount( int id, long count); | |
| 26 | ||
| 27 | long MechMtr_Getcount( int id); | |
| 28 | ||
| 29 | void MechMtr_ReactTime(int id, long cycles); | |
| 30 | ||
| 31 | int Mechmtr_update( int id, long cycles, int state); // returns 1 if meter ticked | |
| 32 | ||
| 33 | #endif |
| r1293 | r1294 | |
|---|---|---|
| 12 | 12 | // // |
| 13 | 13 | // TODO: add different types of stepper motors if needed // |
| 14 | 14 | // // |
| 15 | // Any fixes for this driver should be forwarded to AGEMAME HQ // | |
| 16 | // (http://www.mameworld.net/agemame/) // | |
| 17 | 15 | /////////////////////////////////////////////////////////////////////////// |
| 18 | 16 | |
| 19 | 17 | #include "driver.h" |
| r1293 | r1294 | |
| 607 | 605 | steppers[id].pattern = 0; |
| 608 | 606 | steppers[id].old_pattern = 0; |
| 609 | 607 | steppers[id].step_pos = 0; |
| 610 | steppers[id].max_steps = 48*2; | |
| 608 | steppers[id].max_steps = (48*2)-1; | |
| 611 | 609 | steppers[id].type = type; |
| 612 | 610 | |
| 613 | 611 | switch ( steppers[id].type ) |
| r1293 | r1294 | |
| 620 | 618 | steppers[id].index_patt = 0x09; |
| 621 | 619 | break; |
| 622 | 620 | case STEPPER_144STEPS_DICE : // STARPOINT 1DCU DICE mechanism |
| 623 | steppers[id].max_steps = 144*2; | |
| 621 | steppers[id].max_steps = (144*2)-1; | |
| 624 | 622 | break; |
| 625 | 623 | } |
| 626 | 624 | state_save_register_item("Stepper", id, steppers[id].index_pos); |
| r1293 | r1294 | |
|---|---|---|
| 37 | 37 | static UINT8 snes_hdma_chnl; /* channels enabled for HDMA */ |
| 38 | 38 | static UINT8 joy1l, joy1h, joy2l, joy2h, joy3l, joy3h, joy4l, joy4h; |
| 39 | 39 | static UINT8 read_ophct = 0, read_opvct = 0; |
| 40 | static mame_timer *snes_scanline_timer; | |
| 41 | static mame_timer *snes_hblank_timer; | |
| 42 | static mame_timer *snes_nmi_timer; | |
| 43 | static mame_timer *snes_hirq_timer; | |
| 40 | static emu_timer *snes_scanline_timer; | |
| 41 | static emu_timer *snes_hblank_timer; | |
| 42 | static emu_timer *snes_nmi_timer; | |
| 43 | static emu_timer *snes_hirq_timer; | |
| 44 | 44 | static UINT16 hblank_offset; |
| 45 | 45 | static UINT16 snes_htmult; /* in 512 wide, we run HTOTAL double and halve it on latching */ |
| 46 | 46 | |
| r1293 | r1294 | |
| 61 | 61 | } joypad[4]; |
| 62 | 62 | |
| 63 | 63 | // quick extern to fix missing header |
| 64 | extern | |
| 64 | extern | |
| 65 | 65 | |
| 66 | 66 | // utility function - latches the H/V counters. Used by IRQ, writes to WRIO, etc. |
| 67 | 67 | static void snes_latch_counters(void) |
| r1293 | r1294 | |
| 81 | 81 | cpunum_set_input_line( 0, G65816_LINE_NMI, HOLD_LINE ); |
| 82 | 82 | |
| 83 | 83 | // don't happen again |
| 84 | | |
| 84 | | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | static void snes_hirq_tick(void) |
| r1293 | r1294 | |
| 93 | 93 | cpunum_set_input_line( 0, G65816_LINE_IRQ, HOLD_LINE ); |
| 94 | 94 | |
| 95 | 95 | // don't happen again |
| 96 | | |
| 96 | | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | static TIMER_CALLBACK( snes_hirq_tick_callback ) |
| r1293 | r1294 | |
| 147 | 147 | } |
| 148 | 148 | else |
| 149 | 149 | { |
| 150 | | |
| 150 | | |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | } |
| r1293 | r1294 | |
| 163 | 163 | if( snes_ram[NMITIMEN] & 0x80 ) /* NMI only signaled if this bit set */ |
| 164 | 164 | { |
| 165 | 165 | // NMI goes off about 12 cycles after this (otherwise Chrono Trigger, NFL QB Club, etc. lock up) |
| 166 | | |
| 166 | | |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| r1293 | r1294 | |
| 228 | 228 | |
| 229 | 229 | cpuintrf_pop_context(); |
| 230 | 230 | |
| 231 | mame_timer_adjust(snes_scanline_timer, time_never, 0, time_never); | |
| 232 | mame_timer_adjust(snes_hblank_timer, video_screen_get_time_until_pos(0, snes_ppu.beam.current_vert, hblank_offset*snes_htmult), 0, time_never); | |
| 231 | timer_adjust(snes_scanline_timer, attotime_never, 0, attotime_never); | |
| 232 | timer_adjust(snes_hblank_timer, video_screen_get_time_until_pos(0, snes_ppu.beam.current_vert, hblank_offset*snes_htmult), 0, attotime_never); | |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /* This is called at the start of hblank *before* the scanline indicated in current_vert! */ |
| r1293 | r1294 | |
| 240 | 240 | snes_ppu.beam.current_vert = video_screen_get_vpos(0); |
| 241 | 241 | |
| 242 | 242 | /* make sure we halt */ |
| 243 | | |
| 243 | | |
| 244 | 244 | |
| 245 | 245 | // we must guarantee the 65816's context for HDMA to work |
| 246 | 246 | cpuintrf_push_context(0); |
| r1293 | r1294 | |
| 272 | 272 | nextscan = 0; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | | |
| 275 | | |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | static void snes_init_ram(void) |
| r1293 | r1294 | |
| 318 | 318 | snes_ram[VMAIN] = 0x80; |
| 319 | 319 | |
| 320 | 320 | /* init timers and stop them */ |
| 321 | snes_scanline_timer = mame_timer_alloc(snes_scanline_tick); | |
| 322 | mame_timer_adjust(snes_scanline_timer, time_never, 0, time_never); | |
| 323 | snes_hblank_timer = mame_timer_alloc(snes_hblank_tick); | |
| 324 | mame_timer_adjust(snes_hblank_timer, time_never, 0, time_never); | |
| 325 | snes_nmi_timer = mame_timer_alloc(snes_nmi_tick); | |
| 326 | mame_timer_adjust(snes_nmi_timer, time_never, 0, time_never); | |
| 327 | snes_hirq_timer = mame_timer_alloc(snes_hirq_tick_callback); | |
| 328 | mame_timer_adjust(snes_hirq_timer, time_never, 0, time_never); | |
| 321 | snes_scanline_timer = timer_alloc(snes_scanline_tick); | |
| 322 | timer_adjust(snes_scanline_timer, attotime_never, 0, attotime_never); | |
| 323 | snes_hblank_timer = timer_alloc(snes_hblank_tick); | |
| 324 | timer_adjust(snes_hblank_timer, attotime_never, 0, attotime_never); | |
| 325 | snes_nmi_timer = timer_alloc(snes_nmi_tick); | |
| 326 | timer_adjust(snes_nmi_timer, attotime_never, 0, attotime_never); | |
| 327 | snes_hirq_timer = timer_alloc(snes_hirq_tick_callback); | |
| 328 | timer_adjust(snes_hirq_timer, attotime_never, 0, attotime_never); | |
| 329 | 329 | |
| 330 | 330 | // SNES hcounter has a 0-339 range. hblank starts at counter 260. |
| 331 | 331 | // clayfighter sets an HIRQ at 260, apparently it wants it to be before hdma kicks off, so we'll delay 2 pixels. |
| 332 | 332 | hblank_offset = 268; |
| 333 | | |
| 333 | | |
| 334 | 334 | |
| 335 | 335 | // check if DSP1 is present (maybe not 100%?) |
| 336 | 336 | has_dsp1 = ((snes_r_bank1(0xffd6) >= 3) && (snes_r_bank1(0xffd6) <= 5)) ? 1 : 0; |
| 337 | 337 | |
| 338 | 338 | // init frame counter so first line is 0 |
| 339 | if( | |
| 339 | if( ATTOSECONDS_TO_HZ(Machine->screen[0].refresh) >= 59 ) | |
| 340 | 340 | { |
| 341 | 341 | snes_ppu.beam.current_vert = SNES_VTOTAL_NTSC; |
| 342 | 342 | } |
| r1293 | r1294 | |
| 379 | 379 | snes_init_ram(); |
| 380 | 380 | |
| 381 | 381 | /* Set STAT78 to NTSC or PAL */ |
| 382 | if( | |
| 382 | if( ATTOSECONDS_TO_HZ(machine->screen[0].refresh) >= 59.0f ) | |
| 383 | 383 | snes_ram[STAT78] = SNES_NTSC; |
| 384 | 384 | else /* if( machine->screen[0].refresh == 50 ) */ |
| 385 | 385 | snes_ram[STAT78] = SNES_PAL; |
| r1293 | r1294 | |
| 962 | 962 | { |
| 963 | 963 | // printf("816: %02x to APU @ %d\n", data, offset&3); |
| 964 | 964 | spc_port_in[offset & 0x3] = data; |
| 965 | cpu_boost_interleave(time_zero, | |
| 965 | cpu_boost_interleave(attotime_zero, | |
| 966 | 966 | return; |
| 967 | 967 | } |
| 968 | 968 |
| r1293 | r1294 | |
|---|---|---|
| 1 | //Any fixes for this driver should be forwarded to AGEMAME HQ (http://www.mameworld.net/agemame/) | |
| 1 | /////////////////////////////////////////////////////////////////////////// | |
| 2 | // // | |
| 3 | // Steppermotor emulation // | |
| 4 | // // | |
| 5 | // Emulates : 48 step motors driven with full step or half step // | |
| 6 | // also emulates the index optic // | |
| 7 | // // | |
| 8 | // 26-01-2007: J. Wallace - Rewritten to make it more flexible // | |
| 9 | // and to allow indices to be set in drivers // | |
| 10 | // 29-12-2006: J. Wallace - Added state save support // | |
| 11 | // 05-03-2004: Re-Animator // | |
| 12 | // // | |
| 13 | // TODO: add different types of stepper motors if needed // | |
| 14 | // // | |
| 15 | /////////////////////////////////////////////////////////////////////////// | |
| 2 | 16 | |
| 17 | ||
| 3 | 18 | #ifndef INC_STEPPERS |
| 4 | 19 | #define INC_STEPPERS |
| 5 | 20 | |
| r1293 | r1294 | |
| 7 | 22 | |
| 8 | 23 | #define STEPPER_48STEP_REEL 0 // STARPOINT RMXXX reel unit |
| 9 | 24 | #define BARCREST_48STEP_REEL 1 // Barcrest bespoke reel unit |
| 10 | #define STEPPER_144STEPS_DICE 2 // STARPOINT 1DCU DICE mechanism - tech sheet available | |
| 25 | #define STEPPER_144STEPS_DICE 2 // STARPOINT 1DCU DICE mechanism - tech sheet available | |
| 11 | 26 | |
| 12 | 27 | void Stepper_init( int id, int type); // init a stepper motor |
| 13 | 28 |
| r1293 | r1294 | |
|---|---|---|
| 134 | 134 | #endif |
| 135 | 135 | timer_call_after_resynch(data,taitosj_mcu_real_data_w); |
| 136 | 136 | /* temporarily boost the interleave to sync things up */ |
| 137 | cpu_boost_interleave(time_zero, | |
| 137 | cpu_boost_interleave(attotime_zero, | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | READ8_HANDLER( taitosj_mcu_status_r ) |
| 141 | 141 | { |
| 142 | 142 | /* temporarily boost the interleave to sync things up */ |
| 143 | cpu_boost_interleave(time_zero, | |
| 143 | cpu_boost_interleave(attotime_zero, | |
| 144 | 144 | |
| 145 | 145 | /* bit 0 = the 68705 has read data from the Z80 */ |
| 146 | 146 | /* bit 1 = the 68705 has written data for the Z80 */ |
| r1293 | r1294 | |
|---|---|---|
| 76 | 76 | |
| 77 | 77 | static autoconfig_device *autoconfig_list; |
| 78 | 78 | static autoconfig_device *cur_autoconfig; |
| 79 | static mame_timer * amiga_irq_timer; | |
| 80 | static mame_timer * amiga_blitter_timer; | |
| 79 | static emu_timer * amiga_irq_timer; | |
| 80 | static emu_timer * amiga_blitter_timer; | |
| 81 | 81 | |
| 82 | 82 | const char *amiga_custom_names[0x100] = |
| 83 | 83 | { |
| r1293 | r1294 | |
| 293 | 293 | cia_config(1, &cia_intf[1]); |
| 294 | 294 | |
| 295 | 295 | /* setup the timers */ |
| 296 | amiga_irq_timer = mame_timer_alloc(amiga_irq_proc); | |
| 297 | amiga_blitter_timer = mame_timer_alloc(amiga_blitter_proc); | |
| 296 | amiga_irq_timer = timer_alloc(amiga_irq_proc); | |
| 297 | amiga_blitter_timer = timer_alloc(amiga_blitter_proc); | |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | |
| r1293 | r1294 | |
| 434 | 434 | static TIMER_CALLBACK( amiga_irq_proc ) |
| 435 | 435 | { |
| 436 | 436 | update_irqs(); |
| 437 | | |
| 437 | | |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | /************************************* |
| r1293 | r1294 | |
| 968 | 968 | amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_BLIT, 0); |
| 969 | 969 | |
| 970 | 970 | /* reset the blitter timer */ |
| 971 | | |
| 971 | | |
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | |
| r1293 | r1294 | |
| 1032 | 1032 | CUSTOM_REG(REG_DMACON) |= 0x4000; |
| 1033 | 1033 | |
| 1034 | 1034 | /* set a timer */ |
| 1035 | | |
| 1035 | | |
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | 1038 | |
| r1293 | r1294 | |
| 1308 | 1308 | if (amiga_intf->serdat_w != NULL) |
| 1309 | 1309 | (*amiga_intf->serdat_w)(data); |
| 1310 | 1310 | CUSTOM_REG(REG_SERDATR) &= ~0x3000; |
| 1311 | | |
| 1311 | | |
| 1312 | 1312 | break; |
| 1313 | 1313 | |
| 1314 | 1314 | case REG_BLTSIZE: |
| r1293 | r1294 | |
| 1402 | 1402 | |
| 1403 | 1403 | /* if 'blitter-nasty' has been turned on and we have a blit pending, reschedule it */ |
| 1404 | 1404 | if ( ( data & 0x400 ) && ( CUSTOM_REG(REG_DMACON) & 0x4000 ) ) |
| 1405 | | |
| 1405 | | |
| 1406 | 1406 | |
| 1407 | 1407 | break; |
| 1408 | 1408 | |
| r1293 | r1294 | |
| 1413 | 1413 | CUSTOM_REG(offset) = data; |
| 1414 | 1414 | |
| 1415 | 1415 | if ( temp & 0x8000 ) /* if we're enabling irq's, delay a bit */ |
| 1416 | | |
| 1416 | | |
| 1417 | 1417 | else /* if we're disabling irq's, process right away */ |
| 1418 | 1418 | update_irqs(); |
| 1419 | 1419 | break; |
| r1293 | r1294 | |
| 1430 | 1430 | CUSTOM_REG(offset) = data; |
| 1431 | 1431 | |
| 1432 | 1432 | if ( temp & 0x8000 ) /* if we're generating irq's, delay a bit */ |
| 1433 | | |
| 1433 | | |
| 1434 | 1434 | else /* if we're clearing irq's, process right away */ |
| 1435 | 1435 | update_irqs(); |
| 1436 | 1436 | break; |
| r1293 | r1294 | |
| 1513 | 1513 | } |
| 1514 | 1514 | |
| 1515 | 1515 | |
| 1516 | ||
| 1516 | ||
| 1517 | 1517 | { |
| 1518 | 1518 | UINT32 divisor = (CUSTOM_REG(REG_SERPER) & 0x7fff) + 1; |
| 1519 | 1519 | UINT32 baud = Machine->drv->cpu[0].clock / 2 / divisor; |
| 1520 | 1520 | UINT32 numbits = 2 + ((CUSTOM_REG(REG_SERPER) & 0x8000) ? 9 : 8); |
| 1521 | return | |
| 1521 | return | |
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 |
| r1293 | r1294 | |
|---|---|---|
| 30 | 30 | /* Timestamp of last INTL4 change. The vector CPU runs for |
| 31 | 31 | the delta between this and now. |
| 32 | 32 | */ |
| 33 | static | |
| 33 | static | |
| 34 | 34 | |
| 35 | 35 | /* State of the priority encoder output */ |
| 36 | 36 | static UINT8 irq_state; |
| r1293 | r1294 | |
| 93 | 93 | static void v_irq4_w(int level) |
| 94 | 94 | { |
| 95 | 95 | update_irq_encoder(INPUT_LINE_IRQ4, level); |
| 96 | vertigo_vproc(MAME_TIME_TO_CYCLES(0, sub_mame_times(mame_timer_get_time(), irq4_time)), level); | |
| 97 | irq4_time = mame_timer_get_time(); | |
| 96 | vertigo_vproc(ATTOTIME_TO_CYCLES(0, attotime_sub(timer_get_time(), irq4_time)), level); | |
| 97 | irq4_time = timer_get_time(); | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | static void v_irq3_w(int level) |
| r1293 | r1294 | |
| 168 | 168 | quickly. Otherwise the main CPU gives up with sound. Boosting |
| 169 | 169 | the interleave for a while helps. */ |
| 170 | 170 | |
| 171 | cpu_boost_interleave(time_zero, | |
| 171 | cpu_boost_interleave(attotime_zero, | |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | WRITE16_HANDLER( vertigo_audio_w ) |
| r1293 | r1294 | |
| 205 | 205 | pit8253_init(1, &pit8254_config); |
| 206 | 206 | vertigo_vproc_init(); |
| 207 | 207 | |
| 208 | irq4_time = | |
| 208 | irq4_time = | |
| 209 | 209 | irq_state = 7; |
| 210 | 210 | |
| 211 | 211 | state_save_register_global(irq_state); |
| 212 | 212 | state_save_register_global(adc_result); |
| 213 | 213 | state_save_register_global(irq4_time.seconds); |
| 214 | state_save_register_global(irq4_time. | |
| 214 | state_save_register_global(irq4_time.attoseconds); | |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 |
| r1293 | r1294 | |
|---|---|---|
| 55 | 55 | #define VERBOSE_DBG 0 /* general debug messages */ |
| 56 | 56 | #if VERBOSE_DBG |
| 57 | 57 | #define DBG_LOG(N,M,A) \ |
| 58 | if(VERBOSE_DBG>=N){ if( M )logerror("%11.6f: %-24s", | |
| 58 | if(VERBOSE_DBG>=N){ if( M )logerror("%11.6f: %-24s", | |
| 59 | 59 | #else |
| 60 | 60 | #define DBG_LOG(n,m,a) |
| 61 | 61 | #endif |
| r1293 | r1294 | |
| 65 | 65 | #if VERBOSE_JOY |
| 66 | 66 | #define LOG(LEVEL,N,M,A) \ |
| 67 | 67 | #define JOY_LOG(N,M,A) \ |
| 68 | if(VERBOSE_JOY>=N){ if( M )logerror("%11.6f: %-24s", | |
| 68 | if(VERBOSE_JOY>=N){ if( M )logerror("%11.6f: %-24s", | |
| 69 | 69 | #else |
| 70 | 70 | #define JOY_LOG(n,m,a) |
| 71 | 71 | #endif |
| r1293 | r1294 | |
| 73 | 73 | #define FDC_DMA 2 |
| 74 | 74 | |
| 75 | 75 | |
| 76 | static | |
| 76 | static | |
| 77 | 77 | |
| 78 | 78 | static TIMER_CALLBACK( pc_keyb_timer ); |
| 79 | 79 | |
| r1293 | r1294 | |
| 503 | 503 | pc_page_offset_mask = 0x0F0000; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | pc_keyboard_timer = | |
| 506 | pc_keyboard_timer = | |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | /* |
| r1293 | r1294 | |
| 534 | 534 | |
| 535 | 535 | void pc_keyb_set_clock(int on) |
| 536 | 536 | { |
| 537 | | |
| 537 | | |
| 538 | 538 | |
| 539 | 539 | on = on ? 1 : 0; |
| 540 | 540 | |
| 541 | 541 | if (pc_keyb.on != on) |
| 542 | 542 | { |
| 543 | 543 | if (on) |
| 544 | | |
| 544 | | |
| 545 | 545 | else |
| 546 | | |
| 546 | | |
| 547 | 547 | |
| 548 | 548 | pc_keyb.on = on; |
| 549 | 549 | } |
| r1293 | r1294 | |
|---|---|---|
| 18 | 18 | CONSTANTS |
| 19 | 19 | ##########################################################################*/ |
| 20 | 20 | |
| 21 | #define SOUND_TIMER_RATE MAME_TIME_IN_USEC(5) | |
| 22 | #define SOUND_TIMER_BOOST MAME_TIME_IN_USEC(100) | |
| 21 | #define SOUND_TIMER_RATE ATTOTIME_IN_USEC(5) | |
| 22 | #define SOUND_TIMER_BOOST ATTOTIME_IN_USEC(100) | |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | |
| r1293 | r1294 | |
| 65 | 65 | ##########################################################################*/ |
| 66 | 66 | |
| 67 | 67 | static atarigen_int_callback update_int_callback; |
| 68 | static | |
| 68 | static | |
| 69 | 69 | |
| 70 | 70 | static UINT8 eeprom_unlocked; |
| 71 | 71 | |
| r1293 | r1294 | |
| 90 | 90 | static UINT32 playfield_latch; |
| 91 | 91 | static UINT32 playfield2_latch; |
| 92 | 92 | |
| 93 | static mame_timer * scanline_timer[ATARIMO_MAX]; | |
| 94 | static mame_timer * atarivc_eof_update_timer[ATARIMO_MAX]; | |
| 93 | static emu_timer * scanline_timer[ATARIMO_MAX]; | |
| 94 | static emu_timer * atarivc_eof_update_timer[ATARIMO_MAX]; | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | |
| r1293 | r1294 | |
| 143 | 143 | |
| 144 | 144 | /* create timers */ |
| 145 | 145 | for (i = 0; i < ATARIMO_MAX; i++) |
| 146 | scanline_timer[i] = | |
| 146 | scanline_timer[i] = | |
| 147 | 147 | |
| 148 | 148 | /* create a timer for scanlines */ |
| 149 | scanline_interrupt_timer = | |
| 149 | scanline_interrupt_timer = | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
| r1293 | r1294 | |
| 170 | 170 | |
| 171 | 171 | void atarigen_scanline_int_set(int scrnum, int scanline) |
| 172 | 172 | { |
| 173 | | |
| 173 | | |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | |
| r1293 | r1294 | |
| 274 | 274 | atarigen_scanline_int_gen(); |
| 275 | 275 | |
| 276 | 276 | /* set a new timer to go off at the same scan line next frame */ |
| 277 | | |
| 277 | | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | |
| r1293 | r1294 | |
| 839 | 839 | |
| 840 | 840 | /* set a timer to go off at scanline 0 */ |
| 841 | 841 | if (scanline_callback != NULL) |
| 842 | | |
| 842 | | |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | |
| r1293 | r1294 | |
| 862 | 862 | scanline += scanlines_per_callback; |
| 863 | 863 | if (scanline >= machine->screen[scrnum].height) |
| 864 | 864 | scanline = 0; |
| 865 | | |
| 865 | | |
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | 868 | |
| r1293 | r1294 | |
| 899 | 899 | tilemap_set_scrollx(atarigen_playfield2_tilemap, 0, atarivc_state.pf1_xscroll); |
| 900 | 900 | tilemap_set_scrolly(atarigen_playfield2_tilemap, 0, atarivc_state.pf1_yscroll); |
| 901 | 901 | } |
| 902 | | |
| 902 | | |
| 903 | 903 | |
| 904 | 904 | /* use this for debugging the video controller values */ |
| 905 | 905 | #if 0 |
| r1293 | r1294 | |
| 936 | 936 | atarivc_state.latch1 = atarivc_state.latch2 = -1; |
| 937 | 937 | actual_vc_latch0 = actual_vc_latch1 = -1; |
| 938 | 938 | |
| 939 | atarivc_eof_update_timer[scrnum] = | |
| 939 | atarivc_eof_update_timer[scrnum] = | |
| 940 | 940 | |
| 941 | 941 | /* start a timer to go off a little before scanline 0 */ |
| 942 | 942 | if (atarivc_eof_data) |
| 943 | | |
| 943 | | |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | |
| r1293 | r1294 | |
| 1297 | 1297 | |
| 1298 | 1298 | /* halt and set a timer to wake up */ |
| 1299 | 1299 | fraction = (double)(hblank - hpos) / (double)Machine->screen[0].width; |
| 1300 | | |
| 1300 | | |
| 1301 | 1301 | cpunum_set_input_line(0, INPUT_LINE_HALT, ASSERT_LINE); |
| 1302 | 1302 | } |
| 1303 | 1303 |
| r1293 | r1294 | |
|---|---|---|
| 665 | 665 | if( IsSystem21()==0 && namcos2_68k_master_C148[NAMCOS2_C148_POSIRQ] ) |
| 666 | 666 | { |
| 667 | 667 | int scanline = GetPosIRQScanline(); |
| 668 | | |
| 668 | | |
| 669 | 669 | } |
| 670 | 670 | cpunum_set_input_line( CPU_MASTER, namcos2_68k_master_C148[NAMCOS2_C148_VBLANKIRQ], HOLD_LINE); |
| 671 | 671 | } |
| r1293 | r1294 | |
| 681 | 681 | if( IsSystem21()==0 && namcos2_68k_slave_C148[NAMCOS2_C148_POSIRQ] ) |
| 682 | 682 | { |
| 683 | 683 | int scanline = GetPosIRQScanline(); |
| 684 | | |
| 684 | | |
| 685 | 685 | } |
| 686 | 686 | cpunum_set_input_line( CPU_SLAVE, namcos2_68k_slave_C148[NAMCOS2_C148_VBLANKIRQ], HOLD_LINE); |
| 687 | 687 | } |
| r1293 | r1294 | |
| 699 | 699 | if( namcos2_68k_gpu_C148[NAMCOS2_C148_POSIRQ] ) |
| 700 | 700 | { |
| 701 | 701 | int scanline = 0x50+0x89; /* HACK for Winning Run */ |
| 702 | | |
| 702 | | |
| 703 | 703 | } |
| 704 | 704 | cpunum_set_input_line( CPU_GPU, namcos2_68k_gpu_C148[NAMCOS2_C148_VBLANKIRQ], HOLD_LINE); |
| 705 | 705 | } |
| r1293 | r1294 | |
|---|---|---|
| 266 | 266 | // The input clock to the 06XX interface chip is 64H, that is |
| 267 | 267 | // 18432000/6/64 = 48kHz, so it makes sense for the irq line to be |
| 268 | 268 | // asserted for one clock cycle ~= 21us. |
| 269 | | |
| 269 | | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | void namco_50xx_write(UINT8 data) |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | ***************************************************************************/ |
| 18 | 18 | |
| 19 | void gaelco2_ROM16_split(int src_reg, int dst_reg, int start, int length, int dest1, int dest2) | |
| 19 | static void gaelco2_ROM16_split(int src_reg, int dst_reg, int start, int length, int dest1, int dest2) | |
| 20 | 20 | { |
| 21 | 21 | int i; |
| 22 | 22 |
| r1293 | r1294 | |
|---|---|---|
| 36 | 36 | /* Main portion of the arithmetic unit emulation. Accessed by AU_R and AU_W */ |
| 37 | 37 | /* Only a few instructions implemented currently */ |
| 38 | 38 | |
| 39 | void MMI_74S516(int ins, UINT16 *data) | |
| 39 | static void MMI_74S516(int ins, UINT16 *data) | |
| 40 | 40 | { |
| 41 | 41 | |
| 42 | 42 | if ((ins!=7) && ((AU_Regs.ins_seq & 0xf)==7)) /* If last instruction was a reading operation, clear sequence. */ |
| r1293 | r1294 | |
|---|---|---|
| 25 | 25 | * |
| 26 | 26 | *************************************/ |
| 27 | 27 | |
| 28 | ||
| 28 | ||
| 29 | 29 | |
| 30 | 30 | UINT8 mcr_cocktail_flip; |
| 31 | 31 | |
| r1293 | r1294 | |
| 50 | 50 | UINT8 control; |
| 51 | 51 | UINT16 latch; |
| 52 | 52 | UINT16 count; |
| 53 | | |
| 53 | | |
| 54 | 54 | UINT8 timer_active; |
| 55 | | |
| 55 | | |
| 56 | 56 | } m6840_state[3]; |
| 57 | 57 | |
| 58 | 58 | /* MCR/68k interrupt states */ |
| r1293 | r1294 | |
| 65 | 65 | |
| 66 | 66 | static UINT8 zwackery_sound_data; |
| 67 | 67 | |
| 68 | static mame_time m6840_counter_periods[3]; | |
| 69 | static mame_time m6840_internal_counter_period; /* 68000 CLK / 10 */ | |
| 68 | static attotime m6840_counter_periods[3]; | |
| 69 | static attotime m6840_internal_counter_period; /* 68000 CLK / 10 */ | |
| 70 | 70 | |
| 71 | static | |
| 71 | static | |
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | |
| r1293 | r1294 | |
| 290 | 290 | z80sio_init(0, &nflfoot_sio_intf); |
| 291 | 291 | |
| 292 | 292 | /* allocate a timer for the IPU watchdog */ |
| 293 | ipu_watchdog_timer = | |
| 293 | ipu_watchdog_timer = | |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | |
| r1293 | r1294 | |
| 319 | 319 | { |
| 320 | 320 | struct counter_state *m6840 = &m6840_state[i]; |
| 321 | 321 | |
| 322 | m6840->timer = | |
| 322 | m6840->timer = | |
| 323 | 323 | |
| 324 | 324 | state_save_register_item("m6840", i, m6840->control); |
| 325 | 325 | state_save_register_item("m6840", i, m6840->latch); |
| r1293 | r1294 | |
| 344 | 344 | int i; |
| 345 | 345 | |
| 346 | 346 | /* reset the 6840's */ |
| 347 | m6840_counter_periods[0] = MAME_TIME_IN_HZ(30); /* clocked by /VBLANK */ | |
| 348 | m6840_counter_periods[1] = time_never; /* grounded */ | |
| 349 | m6840_counter_periods[2] = MAME_TIME_IN_HZ(512 * 30); /* clocked by /HSYNC */ | |
| 347 | m6840_counter_periods[0] = ATTOTIME_IN_HZ(30); /* clocked by /VBLANK */ | |
| 348 | m6840_counter_periods[1] = attotime_never; /* grounded */ | |
| 349 | m6840_counter_periods[2] = ATTOTIME_IN_HZ(512 * 30); /* clocked by /HSYNC */ | |
| 350 | 350 | |
| 351 | 351 | m6840_status = 0x00; |
| 352 | 352 | m6840_status_read_since_int = 0x00; |
| r1293 | r1294 | |
| 358 | 358 | m6840->control = 0x00; |
| 359 | 359 | m6840->latch = 0xffff; |
| 360 | 360 | m6840->count = 0xffff; |
| 361 | | |
| 361 | | |
| 362 | 362 | m6840->timer_active = 0; |
| 363 | 363 | m6840->period = m6840_counter_periods[i]; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | /* initialize the clock */ |
| 367 | m6840_internal_counter_period = | |
| 367 | m6840_internal_counter_period = | |
| 368 | 368 | |
| 369 | 369 | /* reset cocktail flip */ |
| 370 | 370 | mcr_cocktail_flip = 0; |
| r1293 | r1294 | |
| 459 | 459 | /* also set a timer to generate the 493 signal at a specific time before the next VBLANK */ |
| 460 | 460 | /* the timing of this is crucial for Blasted and Tri-Sports, which check the timing of */ |
| 461 | 461 | /* VBLANK and 493 using counter 2 */ |
| 462 | | |
| 462 | | |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | |
| r1293 | r1294 | |
| 499 | 499 | { |
| 500 | 500 | v493_irq_state = 1; |
| 501 | 501 | update_mcr68_interrupts(); |
| 502 | | |
| 502 | | |
| 503 | 503 | logerror("--- (INT1) ---\n"); |
| 504 | 504 | } |
| 505 | 505 | |
| r1293 | r1294 | |
| 620 | 620 | static TIMER_CALLBACK( zwackery_493_callback ) |
| 621 | 621 | { |
| 622 | 622 | pia_2_ca1_w(0, 1); |
| 623 | | |
| 623 | | |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | |
| r1293 | r1294 | |
| 719 | 719 | |
| 720 | 720 | static void reload_count(int counter) |
| 721 | 721 | { |
| 722 | mame_time period; | |
| 723 | mame_time total_period; | |
| 722 | attotime period; | |
| 723 | attotime total_period; | |
| 724 | 724 | int count; |
| 725 | 725 | |
| 726 | 726 | /* copy the latched value in */ |
| r1293 | r1294 | |
| 729 | 729 | /* counter 0 is self-updating if clocked externally */ |
| 730 | 730 | if (counter == 0 && !(m6840_state[counter].control & 0x02)) |
| 731 | 731 | { |
| 732 | | |
| 732 | | |
| 733 | 733 | m6840_state[counter].timer_active = 0; |
| 734 | 734 | return; |
| 735 | 735 | } |
| r1293 | r1294 | |
| 748 | 748 | count = count + 1; |
| 749 | 749 | |
| 750 | 750 | /* set the timer */ |
| 751 | total_period = make_mame_time(0, mame_time_to_subseconds(period) * count); | |
| 752 | LOG(("reload_count(%d): period = %f count = %d\n", counter, mame_time_to_double(period), count)); | |
| 753 | mame_timer_adjust(m6840_state[counter].timer, total_period, (count << 2) + counter, time_zero); | |
| 751 | total_period = attotime_make(0, attotime_to_attoseconds(period) * count); | |
| 752 | LOG(("reload_count(%d): period = %f count = %d\n", counter, attotime_to_double(period), count)); | |
| 753 | timer_adjust(m6840_state[counter].timer, total_period, (count << 2) + counter, attotime_zero); | |
| 754 | 754 | m6840_state[counter].timer_active = 1; |
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | |
| 758 | 758 | static UINT16 compute_counter(int counter) |
| 759 | 759 | { |
| 760 | | |
| 760 | | |
| 761 | 761 | int remaining; |
| 762 | 762 | |
| 763 | 763 | /* if there's no timer, return the count */ |
| r1293 | r1294 | |
| 771 | 771 | period = m6840_counter_periods[counter]; |
| 772 | 772 | |
| 773 | 773 | /* see how many are left */ |
| 774 | remaining = | |
| 774 | remaining = | |
| 775 | 775 | |
| 776 | 776 | /* adjust the count for dual byte mode */ |
| 777 | 777 | if (m6840_state[counter].control & 0x04) |
| r1293 | r1294 | |
| 813 | 813 | { |
| 814 | 814 | for (i = 0; i < 3; i++) |
| 815 | 815 | { |
| 816 | | |
| 816 | | |
| 817 | 817 | m6840_state[i].timer_active = 0; |
| 818 | 818 | } |
| 819 | 819 | } |
| r1293 | r1294 | |
| 1015 | 1015 | { |
| 1016 | 1016 | /* watchdog counter is clocked by 7.3728MHz crystal / 16 */ |
| 1017 | 1017 | /* watchdog is tripped when 14-bit counter overflows => / 32768 = 14.0625Hz*/ |
| 1018 | | |
| 1018 | | |
| 1019 | 1019 | return 0xff; |
| 1020 | 1020 | } |
| 1021 | 1021 |
| r1293 | r1294 | |
|---|---|---|
| 26 | 26 | if it is then it copies the cached data to the user region where code is |
| 27 | 27 | executed from, if its not cached then it gets decrypted to the current |
| 28 | 28 | cache position using the functions in s24_fd1094.c */ |
| 29 | void s24_fd1094_setstate_and_decrypt(int state) | |
| 29 | static void s24_fd1094_setstate_and_decrypt(int state) | |
| 30 | 30 | { |
| 31 | 31 | int i; |
| 32 | 32 | UINT32 addr; |
| r1293 | r1294 | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /* Callback for CMP.L instructions (state change) */ |
| 80 | void s24_fd1094_cmp_callback(UINT32 val, int reg) | |
| 80 | static void s24_fd1094_cmp_callback(UINT32 val, int reg) | |
| 81 | 81 | { |
| 82 | 82 | if (reg == 0 && (val & 0x0000ffff) == 0x0000ffff) // ? |
| 83 | 83 | { |
| r1293 | r1294 | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /* Callback when the s24_fd1094 enters interrupt code */ |
| 89 | int s24_fd1094_int_callback (int irq) | |
| 89 | static int s24_fd1094_int_callback (int irq) | |
| 90 | 90 | { |
| 91 | 91 | s24_fd1094_setstate_and_decrypt(FD1094_STATE_IRQ); |
| 92 | 92 | return (0x60+irq*4)/4; // vector address |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | void s24_fd1094_rte_callback (void) | |
| 95 | static void s24_fd1094_rte_callback (void) | |
| 96 | 96 | { |
| 97 | 97 | s24_fd1094_setstate_and_decrypt(FD1094_STATE_RTE); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | /* KLUDGE, set the initial PC / SP based on table as we can't decrypt them yet */ |
| 102 | void s24_fd1094_kludge_reset_values(void) | |
| 102 | static void s24_fd1094_kludge_reset_values(void) | |
| 103 | 103 | { |
| 104 | 104 | int i; |
| 105 | 105 |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | UINT8 arkanoid_paddle_select; |
| 19 | UINT8 arkanoid_paddle_value; | |
| 19 | static UINT8 arkanoid_paddle_value; | |
| 20 | 20 | |
| 21 | 21 | static UINT8 z80write,fromz80,m68705write,toz80; |
| 22 | 22 | |
| r1293 | r1294 | |
| 62 | 62 | { |
| 63 | 63 | timer_call_after_resynch(data, test); |
| 64 | 64 | /* boost the interleave for a few usecs to make sure it is read successfully */ |
| 65 | cpu_boost_interleave(time_zero, | |
| 65 | cpu_boost_interleave(attotime_zero, | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | READ8_HANDLER( arkanoid_68705_portA_r ) |
| r1293 | r1294 | |
|---|---|---|
| 6 | 6 | static UINT8 K056800_host_reg[8]; |
| 7 | 7 | static UINT8 K056800_sound_reg[8]; |
| 8 | 8 | |
| 9 | static | |
| 9 | static | |
| 10 | 10 | static int K056800_sound_cpu_irq1_enable; |
| 11 | 11 | static void (*K056800_sound_irq_callback)(int); |
| 12 | 12 | |
| r1293 | r1294 | |
| 55 | 55 | |
| 56 | 56 | void K056800_init(void (* irq_callback)(int)) |
| 57 | 57 | { |
| 58 | | |
| 58 | | |
| 59 | 59 | K056800_sound_irq_callback = irq_callback; |
| 60 | 60 | |
| 61 | 61 | memset(K056800_host_reg, 0, sizeof(K056800_host_reg)); |
| 62 | 62 | memset(K056800_sound_reg, 0, sizeof(K056800_sound_reg)); |
| 63 | 63 | |
| 64 | timer_period = | |
| 64 | timer_period = | |
| 65 | 65 | |
| 66 | K056800_sound_cpu_timer = mame_timer_alloc(K056800_sound_cpu_timer_tick); | |
| 67 | mame_timer_adjust(K056800_sound_cpu_timer, timer_period, 0, timer_period); | |
| 66 | K056800_sound_cpu_timer = timer_alloc(K056800_sound_cpu_timer_tick); | |
| 67 | timer_adjust(K056800_sound_cpu_timer, timer_period, 0, timer_period); | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | READ32_HANDLER(K056800_host_r) |
| r1293 | r1294 | |
|---|---|---|
| 417 | 417 | inters_to_words(inter1, inter2, inter3, &beams, &word1, &word2, &word3); |
| 418 | 418 | words_to_sensors(word1, word2, word3, beams, &sensor0, &sensor1, &sensor2, &sensor3); |
| 419 | 419 | |
| 420 | logerror("%15f: Sensor values: %04x %04x %04x %04x\n", | |
| 420 | logerror("%15f: Sensor values: %04x %04x %04x %04x\n", | |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | |
| r1293 | r1294 | |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | /* boost the interleave whenever this is written to */ |
| 521 | cpu_boost_interleave(time_zero, | |
| 521 | cpu_boost_interleave(attotime_zero, | |
| 522 | 522 | |
| 523 | 523 | /* stash the new value */ |
| 524 | 524 | z80_ctrl = data; |
| r1293 | r1294 | |
|---|---|---|
| 104 | 104 | static UINT8 duart_read_data[16]; |
| 105 | 105 | static UINT8 duart_write_data[16]; |
| 106 | 106 | static UINT8 duart_output_port; |
| 107 | static | |
| 107 | static | |
| 108 | 108 | |
| 109 | 109 | static UINT8 last_gsp_shiftreg; |
| 110 | 110 | |
| r1293 | r1294 | |
| 200 | 200 | memset(duart_read_data, 0, sizeof(duart_read_data)); |
| 201 | 201 | memset(duart_write_data, 0, sizeof(duart_write_data)); |
| 202 | 202 | duart_output_port = 0; |
| 203 | duart_timer = | |
| 203 | duart_timer = | |
| 204 | 204 | |
| 205 | 205 | /* reset the ADSP/DSIII/DSIV boards */ |
| 206 | 206 | adsp_halt = 1; |
| r1293 | r1294 | |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | |
| 615 | INLINE | |
| 615 | INLINE | |
| 616 | 616 | { |
| 617 | return | |
| 617 | return | |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | |
| r1293 | r1294 | |
| 628 | 628 | duart_irq_state = (duart_read_data[0x05] & duart_write_data[0x05]) != 0; |
| 629 | 629 | atarigen_update_interrupts(); |
| 630 | 630 | } |
| 631 | | |
| 631 | | |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | |
| r1293 | r1294 | |
| 655 | 655 | case 0x0e: /* Start-Counter Command 3 */ |
| 656 | 656 | { |
| 657 | 657 | int reps = (duart_write_data[0x06] << 8) | duart_write_data[0x07]; |
| 658 | mame_timer_adjust(duart_timer, scale_up_mame_time(duart_clock_period(), reps), 0, time_zero); | |
| 659 | logerror("DUART timer started (period=%f)\n", mame_time_to_double(scale_up_mame_time(duart_clock_period(), reps))); | |
| 658 | timer_adjust(duart_timer, attotime_mul(duart_clock_period(), reps), 0, attotime_zero); | |
| 659 | logerror("DUART timer started (period=%f)\n", attotime_to_double(attotime_mul(duart_clock_period(), reps))); | |
| 660 | 660 | return 0x00ff; |
| 661 | 661 | } |
| 662 | 662 | case 0x0f: /* Stop-Counter Command 3 */ |
| 663 | 663 | { |
| 664 | int reps = mame_time_to_double(scale_up_mame_time(mame_timer_timeleft(duart_timer), duart_clock())); | |
| 665 | mame_timer_adjust(duart_timer, time_never, 0, time_zero); | |
| 664 | int reps = attotime_to_double(attotime_mul(timer_timeleft(duart_timer), duart_clock())); | |
| 665 | timer_adjust(duart_timer, attotime_never, 0, attotime_zero); | |
| 666 | 666 | duart_read_data[0x06] = reps >> 8; |
| 667 | 667 | duart_read_data[0x07] = reps & 0xff; |
| 668 | 668 | logerror("DUART timer stopped (final count=%04X)\n", reps); |
| r1293 | r1294 | |
| 1251 | 1251 | /* it is important that all the CPUs be in sync before we continue, so spin a little */ |
| 1252 | 1252 | /* while to let everyone else catch up */ |
| 1253 | 1253 | cpu_spinuntil_trigger(DS3_TRIGGER); |
| 1254 | cpu_triggertime( | |
| 1254 | cpu_triggertime( | |
| 1255 | 1255 | |
| 1256 | 1256 | return ds3_gdata; |
| 1257 | 1257 | } |
| r1293 | r1294 | |
|---|---|---|
| 132 | 132 | static UINT32 m_p_n_dmabase[ 7 ]; |
| 133 | 133 | static UINT32 m_p_n_dmablockcontrol[ 7 ]; |
| 134 | 134 | static UINT32 m_p_n_dmachannelcontrol[ 7 ]; |
| 135 | static | |
| 135 | static | |
| 136 | 136 | static psx_dma_read_handler m_p_fn_dma_read[ 7 ]; |
| 137 | 137 | static psx_dma_write_handler m_p_fn_dma_write[ 7 ]; |
| 138 | 138 | static UINT32 m_p_n_dma_ticks[ 7 ]; |
| r1293 | r1294 | |
| 142 | 142 | |
| 143 | 143 | static void dma_start_timer( int n_channel, UINT32 n_ticks ) |
| 144 | 144 | { |
| 145 | | |
| 145 | | |
| 146 | 146 | m_p_n_dma_ticks[ n_channel ] = n_ticks; |
| 147 | 147 | m_p_b_dma_running[ n_channel ] = 1; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | static void dma_stop_timer( int n_channel ) |
| 151 | 151 | { |
| 152 | | |
| 152 | | |
| 153 | 153 | m_p_b_dma_running[ n_channel ] = 0; |
| 154 | 154 | } |
| 155 | 155 | |
| r1293 | r1294 | |
| 467 | 467 | |
| 468 | 468 | /* Root Counters */ |
| 469 | 469 | |
| 470 | static | |
| 470 | static | |
| 471 | 471 | static UINT16 m_p_n_root_count[ 3 ]; |
| 472 | 472 | static UINT16 m_p_n_root_mode[ 3 ]; |
| 473 | 473 | static UINT16 m_p_n_root_target[ 3 ]; |
| r1293 | r1294 | |
| 542 | 542 | { |
| 543 | 543 | if( ( m_p_n_root_mode[ n_counter ] & RC_STOP ) != 0 ) |
| 544 | 544 | { |
| 545 | | |
| 545 | | |
| 546 | 546 | } |
| 547 | 547 | else |
| 548 | 548 | { |
| r1293 | r1294 | |
| 556 | 556 | |
| 557 | 557 | n_duration *= root_divider( n_counter ); |
| 558 | 558 | |
| 559 | | |
| 559 | | |
| 560 | 560 | } |
| 561 | 561 | } |
| 562 | 562 | |
| r1293 | r1294 | |
| 668 | 668 | static UINT32 m_p_n_sio_tx_bits[ 2 ]; |
| 669 | 669 | static UINT32 m_p_n_sio_rx_bits[ 2 ]; |
| 670 | 670 | |
| 671 | static | |
| 671 | static | |
| 672 | 672 | static psx_sio_handler m_p_f_sio_handler[ 2 ]; |
| 673 | 673 | |
| 674 | 674 | #define SIO_STATUS_TX_RDY ( 1 << 0 ) |
| r1293 | r1294 | |
| 702 | 702 | |
| 703 | 703 | static void sio_timer_adjust( int n_port ) |
| 704 | 704 | { |
| 705 | | |
| 705 | | |
| 706 | 706 | if( ( m_p_n_sio_status[ n_port ] & SIO_STATUS_TX_EMPTY ) == 0 || m_p_n_sio_tx_bits[ n_port ] != 0 ) |
| 707 | 707 | { |
| 708 | 708 | int n_prescaler; |
| r1293 | r1294 | |
| 725 | 725 | |
| 726 | 726 | if( m_p_n_sio_baud[ n_port ] != 0 && n_prescaler != 0 ) |
| 727 | 727 | { |
| 728 | n_time = | |
| 728 | n_time = | |
| 729 | 729 | verboselog( 2, "sio_timer_adjust( %d ) = %f ( %d x %d )\n", n_port, n_time, n_prescaler, m_p_n_sio_baud[ n_port ] ); |
| 730 | 730 | } |
| 731 | 731 | else |
| 732 | 732 | { |
| 733 | n_time = time_never; | |
| 733 | n_time = attotime_never; | |
| 734 | 734 | verboselog( 0, "sio_timer_adjust( %d ) invalid baud rate ( %d x %d )\n", n_port, n_prescaler, m_p_n_sio_baud[ n_port ] ); |
| 735 | 735 | } |
| 736 | 736 | } |
| 737 | 737 | else |
| 738 | 738 | { |
| 739 | n_time = time_never; | |
| 739 | n_time = attotime_never; | |
| 740 | 740 | verboselog( 2, "sio_timer_adjust( %d ) finished\n", n_port ); |
| 741 | 741 | } |
| 742 | | |
| 742 | | |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | static TIMER_CALLBACK( sio_clock ) |
| r1293 | r1294 | |
| 1563 | 1563 | |
| 1564 | 1564 | for( n = 0; n < 7; n++ ) |
| 1565 | 1565 | { |
| 1566 | m_p_timer_dma[ n ] = | |
| 1566 | m_p_timer_dma[ n ] = | |
| 1567 | 1567 | m_p_fn_dma_read[ n ] = NULL; |
| 1568 | 1568 | m_p_fn_dma_write[ n ] = NULL; |
| 1569 | 1569 | } |
| 1570 | 1570 | |
| 1571 | 1571 | for( n = 0; n < 3; n++ ) |
| 1572 | 1572 | { |
| 1573 | m_p_timer_root[ n ] = | |
| 1573 | m_p_timer_root[ n ] = | |
| 1574 | 1574 | } |
| 1575 | 1575 | |
| 1576 | 1576 | for( n = 0; n < 2; n++ ) |
| 1577 | 1577 | { |
| 1578 | m_p_timer_sio[ n ] = | |
| 1578 | m_p_timer_sio[ n ] = | |
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | 1581 | for( n = 0; n < 256; n++ ) |
| r1293 | r1294 | |
|---|---|---|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | #if 0 |
| 461 | static | |
| 461 | static | |
| 462 | 462 | |
| 463 | 463 | static TIMER_CALLBACK( i8751_callback ) |
| 464 | 464 | { |
| r1293 | r1294 | |
|---|---|---|
| 269 | 269 | 00207FE0 : may serves for relocating code (written as .l) |
| 270 | 270 | */ |
| 271 | 271 | |
| 272 | void calc3_mcu_run(void); | |
| 272 | static void calc3_mcu_run(void); | |
| 273 | 273 | |
| 274 | 274 | static int calc3_mcu_status, calc3_mcu_command_offset; |
| 275 | 275 |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | /* timers */ |
| 19 | static mame_timer *scanline_timer; | |
| 20 | static mame_timer *scan240_timer; | |
| 21 | static mame_timer *scan254_timer; | |
| 19 | static emu_timer *scanline_timer; | |
| 20 | static emu_timer *scan240_timer; | |
| 21 | static emu_timer *scan254_timer; | |
| 22 | 22 | |
| 23 | 23 | /* banking addresses set by the drivers */ |
| 24 | 24 | UINT8 *mayday_protection; |
| r1293 | r1294 | |
| 257 | 257 | /* set a timer for the next update */ |
| 258 | 258 | scanline++; |
| 259 | 259 | if (scanline >= 256) scanline = 0; |
| 260 | | |
| 260 | | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | |
| r1293 | r1294 | |
| 274 | 274 | pia_1_ca1_w(0, 1); |
| 275 | 275 | |
| 276 | 276 | /* set a timer to turn it off once the scanline counter resets */ |
| 277 | | |
| 277 | | |
| 278 | 278 | |
| 279 | 279 | /* set a timer for next frame */ |
| 280 | | |
| 280 | | |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
| r1293 | r1294 | |
| 318 | 318 | ticket_dispenser_init(70, TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH); |
| 319 | 319 | |
| 320 | 320 | /* set a timer to go off every 16 scanlines, to toggle the VA11 line and update the screen */ |
| 321 | scanline_timer = mame_timer_alloc(williams_va11_callback); | |
| 322 | mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_zero); | |
| 321 | scanline_timer = timer_alloc(williams_va11_callback); | |
| 322 | timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_zero); | |
| 323 | 323 | |
| 324 | 324 | /* also set a timer to go off on scanline 240 */ |
| 325 | scan240_timer = mame_timer_alloc(williams_count240_callback); | |
| 326 | mame_timer_adjust(scan240_timer, video_screen_get_time_until_pos(0, 240, 0), 0, time_zero); | |
| 325 | scan240_timer = timer_alloc(williams_count240_callback); | |
| 326 | timer_adjust(scan240_timer, video_screen_get_time_until_pos(0, 240, 0), 0, attotime_zero); | |
| 327 | 327 | |
| 328 | 328 | state_save_register_global(vram_bank); |
| 329 | 329 | } |
| r1293 | r1294 | |
| 360 | 360 | /* set a timer for the next update */ |
| 361 | 361 | scanline++; |
| 362 | 362 | if (scanline >= 256) scanline = 0; |
| 363 | | |
| 363 | | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | |
| r1293 | r1294 | |
| 377 | 377 | pia_0_ca1_w(0, 0); |
| 378 | 378 | |
| 379 | 379 | /* set a timer to turn it off once the scanline counter resets */ |
| 380 | | |
| 380 | | |
| 381 | 381 | |
| 382 | 382 | /* set a timer for next frame */ |
| 383 | | |
| 383 | | |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | |
| r1293 | r1294 | |
| 410 | 410 | williams2_bank_select_w(0, 0); |
| 411 | 411 | |
| 412 | 412 | /* set a timer to go off every 16 scanlines, to toggle the VA11 line and update the screen */ |
| 413 | scanline_timer = mame_timer_alloc(williams2_va11_callback); | |
| 414 | mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_zero); | |
| 413 | scanline_timer = timer_alloc(williams2_va11_callback); | |
| 414 | timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_zero); | |
| 415 | 415 | |
| 416 | 416 | /* also set a timer to go off on scanline 254 */ |
| 417 | scan254_timer = mame_timer_alloc(williams2_endscreen_callback); | |
| 418 | mame_timer_adjust(scan254_timer, video_screen_get_time_until_pos(0, 254, 0), 0, time_zero); | |
| 417 | scan254_timer = timer_alloc(williams2_endscreen_callback); | |
| 418 | timer_adjust(scan254_timer, video_screen_get_time_until_pos(0, 254, 0), 0, attotime_zero); | |
| 419 | 419 | |
| 420 | 420 | state_save_register_global(vram_bank); |
| 421 | 421 | state_save_register_func_postload(williams2_postload); |
| r1293 | r1294 | |
|---|---|---|
| 694 | 694 | { |
| 695 | 695 | // Simulate time for command to execute (exact timing unknown, this is close) |
| 696 | 696 | current_cmd=0xf5; |
| 697 | | |
| 697 | | |
| 698 | 698 | } |
| 699 | 699 | cchip_last_7a=cchip_ram[0x7a]; |
| 700 | 700 | |
| r1293 | r1294 | |
| 747 | 747 | cchip_coins_for_credit[1]=1; |
| 748 | 748 | cchip_credits_for_coin[1]=1; |
| 749 | 749 | |
| 750 | | |
| 750 | | |
| 751 | 751 | } |
| r1293 | r1294 | |
|---|---|---|
| 44 | 44 | #define NB1413M3_TIMER_BASE 20000000 |
| 45 | 45 | static TIMER_CALLBACK( nb1413m3_timer_callback ) |
| 46 | 46 | { |
| 47 | | |
| 47 | | |
| 48 | 48 | |
| 49 | 49 | nb1413m3_74ls193_counter++; |
| 50 | 50 | nb1413m3_74ls193_counter &= 0x0f; |
| r1293 | r1294 | |
|---|---|---|
| 21 | 21 | #include "driver.h" |
| 22 | 22 | |
| 23 | 23 | #define MCU_HACK 0 |
| 24 | #if MCU_HACK | |
| 24 | 25 | |
| 25 | 26 | #define MCU_KEY_TABLE_SIZE 16 |
| 26 | 27 | |
| 27 | 28 | /* These are global */ |
| 28 | 29 | UINT8 *exctsccr_mcu_ram; |
| 29 | 30 | |
| 30 | #if MCU_HACK | |
| 31 | ||
| 32 | 31 | WRITE8_HANDLER( exctsccr_mcu_w ); |
| 33 | 32 | WRITE8_HANDLER( exctsccr_mcu_control_w ); |
| 34 | 33 |
| r1293 | r1294 | |
|---|---|---|
| 2081 | 2081 | if ( ram_adr == 0 && copro_fifoin_num != 0 ) |
| 2082 | 2082 | { |
| 2083 | 2083 | /* spin the main cpu and let the TGP catch up */ |
| 2084 | cpu_spinuntil_time( | |
| 2084 | cpu_spinuntil_time( | |
| 2085 | 2085 | } |
| 2086 | 2086 | |
| 2087 | 2087 | return ram_adr; |
| r1293 | r1294 | |
| 2107 | 2107 | if ( ram_adr == 0 && r == 0xffff ) |
| 2108 | 2108 | { |
| 2109 | 2109 | /* if the TGP is busy, spin some more */ |
| 2110 | cpu_spinuntil_time( | |
| 2110 | cpu_spinuntil_time( | |
| 2111 | 2111 | } |
| 2112 | 2112 | |
| 2113 | 2113 | if ( ram_adr & 0x8000 ) |
| r1293 | r1294 | |
|---|---|---|
| 1119 | 1119 | #if LOG_SLAPSTIC |
| 1120 | 1120 | static void slapstic_log(offs_t offset) |
| 1121 | 1121 | { |
| 1122 | static | |
| 1122 | static | |
| 1123 | 1123 | |
| 1124 | 1124 | if (!slapsticlog) |
| 1125 | 1125 | slapsticlog = fopen("slapstic.log", "w"); |
| 1126 | 1126 | if (slapsticlog) |
| 1127 | 1127 | { |
| 1128 | | |
| 1128 | | |
| 1129 | 1129 | |
| 1130 | if (compare | |
| 1130 | if (attotime_compare( | |
| 1131 | 1131 | fprintf(slapsticlog, "------------------------------------\n"); |
| 1132 | 1132 | last_time = time; |
| 1133 | 1133 |
| r1293 | r1294 | |
|---|---|---|
| 15 | 15 | * |
| 16 | 16 | *************************************/ |
| 17 | 17 | |
| 18 | static | |
| 18 | static | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | static UINT8 vpos_to_vysnc_chain_counter(int vpos) |
| r1293 | r1294 | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | next_vpos = vysnc_chain_counter_to_vpos(next_counter, next_vblank); |
| 84 | | |
| 84 | | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | static void mw8080bw_create_interrupt_timer(void) |
| 89 | 89 | { |
| 90 | interrupt_timer = | |
| 90 | interrupt_timer = | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | static void mw8080bw_start_interrupt_timer(void) |
| 95 | 95 | { |
| 96 | 96 | int vpos = vysnc_chain_counter_to_vpos(MW8080BW_INT_TRIGGER_COUNT_1, MW8080BW_INT_TRIGGER_VBLANK_1); |
| 97 | | |
| 97 | | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 |
| r1293 | r1294 | |
|---|---|---|
| 6781 | 6781 | DRIVER( hardhea2 ) /* (c) 1991 SunA */ |
| 6782 | 6782 | DRIVER( brickzn ) /* (c) 1992 SunA */ |
| 6783 | 6783 | DRIVER( brickzn3 ) /* (c) 1992 SunA */ |
| 6784 | DRIVER( bestbest ) /* (c) 1994 SunA */ | |
| 6784 | 6785 | DRIVER( sunaq ) /* (c) 1994 SunA */ |
| 6785 | 6786 | DRIVER( bssoccer ) /* (c) 1996 SunA */ |
| 6786 | 6787 | DRIVER( uballoon ) /* (c) 1996 SunA */ |
| r1293 | r1294 | |
| 7409 | 7410 | /* JMP Impact Games */ |
| 7410 | 7411 | DRIVER( cluedo ) /* (c) 1995 */ |
| 7411 | 7412 | DRIVER( cluedo2c ) /* (c) 1995 */ |
| 7413 | DRIVER( cluedo2 ) /* (c) 1995 */ | |
| 7412 | 7414 | DRIVER( trivialp ) /* (c) 1996 */ |
| 7413 | 7415 | DRIVER( scrabble ) /* (c) 1997 */ |
| 7414 | 7416 | DRIVER( hngmnjpm ) /* (c) 1998 */ |
| r1293 | r1294 | |
|---|---|---|
| 388 | 388 | WRITE16_HANDLER( amiga_custom_w ); |
| 389 | 389 | |
| 390 | 390 | void amiga_serial_in_w(UINT16 data); |
| 391 | ||
| 391 | ||
| 392 | 392 | |
| 393 | 393 | void amiga_add_autoconfig(amiga_autoconfig_device *device); |
| 394 | 394 | READ16_HANDLER( amiga_autoconfig_r ); |
| r1293 | r1294 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | **************************************************************************/ |
| 6 | 6 | |
| 7 | #define MIDZEUS_VIDEO_CLOCK 66000000 | |
| 7 | 8 | |
| 9 | ||
| 8 | 10 | /*----------- defined in video/midzeus.c -----------*/ |
| 9 | 11 | |
| 10 | 12 | extern UINT32 *zeusbase; |
| r1293 | r1294 | |
|---|---|---|
| 18 | 18 | |
| 19 | 19 | /*----------- defined in machine/mcr.c -----------*/ |
| 20 | 20 | |
| 21 | extern | |
| 21 | extern | |
| 22 | 22 | |
| 23 | 23 | extern struct z80_irq_daisy_chain mcr_daisy_chain[]; |
| 24 | 24 | extern struct z80_irq_daisy_chain mcr_ipu_daisy_chain[]; |
| r1293 | r1294 | |
|---|---|---|
| 107 | 107 | CPUS += TMS32025 |
| 108 | 108 | CPUS += TMS32026 |
| 109 | 109 | CPUS += TMS32031 |
| 110 | CPUS += TMS32032 | |
| 110 | 111 | CPUS += TMS32051 |
| 111 | 112 | CPUS += CCPU |
| 112 | 113 | CPUS += ADSP2100 |
| r1293 | r1294 | |
| 531 | 532 | $(DRIVERS)/powerins.o $(VIDEO)/powerins.o \ |
| 532 | 533 | |
| 533 | 534 | $(MAMEOBJ)/barcrest.a: \ |
| 534 | $(MACHINE)/m | |
| 535 | $(MACHINE)/meters.o \ | |
| 535 | 536 | $(DRIVERS)/mpu4.o \ |
| 536 | 537 | $(MACHINE)/steppers.o \ |
| 537 | 538 |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | UINT8 *nycaptor_scrlram; |
| 18 | 18 | |
| 19 | UINT8 *nycaptor_spriteram; | |
| 19 | static UINT8 *nycaptor_spriteram; | |
| 20 | 20 | extern UINT8 *nycaptor_sharedram; |
| 21 | 21 | extern int nyc_gametype; |
| 22 | 22 |
| r1293 | r1294 | |
|---|---|---|
| 75 | 75 | **************************************************************************/ |
| 76 | 76 | |
| 77 | 77 | UINT8 *omegaf_fg_videoram; |
| 78 | UINT8 *omegaf_bg0_videoram; | |
| 79 | UINT8 *omegaf_bg1_videoram; | |
| 80 | UINT8 *omegaf_bg2_videoram; | |
| 81 | size_t omegaf_fgvideoram_size; | |
| 78 | static UINT8 *omegaf_bg0_videoram; | |
| 79 | static UINT8 *omegaf_bg1_videoram; | |
| 80 | static UINT8 *omegaf_bg2_videoram; | |
| 81 | //size_t omegaf_fgvideoram_size; | |
| 82 | 82 | |
| 83 | 83 | static int omegaf_bg0_bank = 0; |
| 84 | 84 | static int omegaf_bg1_bank = 0; |
| r1293 | r1294 | |
|---|---|---|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | /* signal we're done */ |
| 583 | | |
| 583 | | |
| 584 | 584 | |
| 585 | 585 | profiler_mark(PROFILER_END); |
| 586 | 586 | } |
| r1293 | r1294 | |
| 619 | 619 | /* if this is the last update of the screen, set a timer to clear out the final line */ |
| 620 | 620 | /* (since we update one behind) */ |
| 621 | 621 | if (scanline == machine->screen[0].visarea.max_y) |
| 622 | | |
| 622 | | |
| 623 | 623 | } |
| r1293 | r1294 | |
|---|---|---|
| 21 | 21 | static int vdp1_sprite_log = 0; |
| 22 | 22 | |
| 23 | 23 | UINT32 *stv_vdp1_vram; |
| 24 | UINT32 *stv_vdp1_regs; | |
| 24 | static UINT32 *stv_vdp1_regs; | |
| 25 | 25 | UINT8* stv_vdp1_gfx_decode; |
| 26 | 26 | |
| 27 | 27 | extern UINT32 *stv_scu; |
| 28 | 28 | extern int stv_vblank; |
| 29 | 29 | |
| 30 | UINT16 *stv_framebuffer[2]; | |
| 31 | UINT16 **stv_framebuffer_draw_lines, **stv_framebuffer_display_lines; | |
| 32 | int stv_framebuffer_width; | |
| 33 | int stv_framebuffer_height; | |
| 30 | static UINT16 *stv_framebuffer[2]; | |
| 31 | static UINT16 **stv_framebuffer_draw_lines; | |
| 32 | UINT16 **stv_framebuffer_display_lines; | |
| 33 | static int stv_framebuffer_width; | |
| 34 | static int stv_framebuffer_height; | |
| 34 | 35 | int stv_framebuffer_mode; |
| 35 | 36 | int stv_framebuffer_double_interlace; |
| 36 | int stv_vdp1_fbcr_accessed; | |
| 37 | int stv_vdp1_current_display_framebuffer; | |
| 38 | int stv_vdp1_current_draw_framebuffer; | |
| 39 | int stv_vdp1_clear_framebuffer_on_next_frame; | |
| 40 | rectangle stv_vdp1_system_cliprect; | |
| 41 | rectangle stv_vdp1_user_cliprect; | |
| 37 | static int stv_vdp1_fbcr_accessed; | |
| 38 | static int stv_vdp1_current_display_framebuffer; | |
| 39 | static int stv_vdp1_current_draw_framebuffer; | |
| 40 | static int stv_vdp1_clear_framebuffer_on_next_frame; | |
| 41 | static rectangle stv_vdp1_system_cliprect; | |
| 42 | static rectangle stv_vdp1_user_cliprect; | |
| 42 | 43 | |
| 43 | int stvvdp1_local_x; | |
| 44 | int stvvdp1_local_y; | |
| 44 | static int stvvdp1_local_x; | |
| 45 | static int stvvdp1_local_y; | |
| 45 | 46 | |
| 46 | 47 | struct stv_vdp1_poly_scanline |
| 47 | 48 | { |
| r1293 | r1294 | |
| 184 | 185 | |
| 185 | 186 | |
| 186 | 187 | |
| 187 | void stv_vdp1_process_list(void); | |
| 188 | static void stv_vdp1_process_list(void); | |
| 188 | 189 | |
| 189 | 190 | READ32_HANDLER( stv_vdp1_regs_r ) |
| 190 | 191 | { |
| r1293 | r1294 | |
| 1390 | 1391 | return (INT32)(INT16)v + stvvdp1_local_y; |
| 1391 | 1392 | } |
| 1392 | 1393 | |
| 1393 | void stv_vdp1_draw_line( const rectangle *cliprect) | |
| 1394 | static void stv_vdp1_draw_line( const rectangle *cliprect) | |
| 1394 | 1395 | { |
| 1395 | 1396 | struct spoint q[4]; |
| 1396 | 1397 | |
| r1293 | r1294 | |
| 1409 | 1410 | vdp1_fill_quad(cliprect, 0, 1, q); |
| 1410 | 1411 | } |
| 1411 | 1412 | |
| 1412 | void stv_vdp1_draw_poly_line( const rectangle *cliprect) | |
| 1413 | static void stv_vdp1_draw_poly_line( const rectangle *cliprect) | |
| 1413 | 1414 | { |
| 1414 | 1415 | struct spoint q[4]; |
| 1415 | 1416 | |
| r1293 | r1294 | |
| 1472 | 1473 | |
| 1473 | 1474 | } |
| 1474 | 1475 | |
| 1475 | void stv_vpd1_draw_distorted_sprite(const rectangle *cliprect) | |
| 1476 | static void stv_vpd1_draw_distorted_sprite(const rectangle *cliprect) | |
| 1476 | 1477 | { |
| 1477 | 1478 | struct spoint q[4]; |
| 1478 | 1479 | |
| r1293 | r1294 | |
| 1530 | 1531 | vdp1_fill_quad(cliprect, patterndata, xsize, q); |
| 1531 | 1532 | } |
| 1532 | 1533 | |
| 1533 | void stv_vpd1_draw_scaled_sprite(const rectangle *cliprect) | |
| 1534 | static void stv_vpd1_draw_scaled_sprite(const rectangle *cliprect) | |
| 1534 | 1535 | { |
| 1535 | 1536 | struct spoint q[4]; |
| 1536 | 1537 | |
| r1293 | r1294 | |
| 1678 | 1679 | } |
| 1679 | 1680 | |
| 1680 | 1681 | |
| 1681 | void stv_vpd1_draw_normal_sprite(const rectangle *cliprect, int sprite_type) | |
| 1682 | static void stv_vpd1_draw_normal_sprite(const rectangle *cliprect, int sprite_type) | |
| 1682 | 1683 | { |
| 1683 | 1684 | UINT16 *destline; |
| 1684 | 1685 |
| r1293 | r1294 | |
|---|---|---|
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | ******************************************************************************/ |
| 101 | int nbmj9195_blitter_r(int vram, int offset) | |
| 101 | static int nbmj9195_blitter_r(int vram, int offset) | |
| 102 | 102 | { |
| 103 | 103 | int ret; |
| 104 | 104 | UINT8 *GFXROM = memory_region(REGION_GFX1); |
| r1293 | r1294 | |
| 113 | 113 | return ret; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | void nbmj9195_blitter_w(int vram, int offset, int data) | |
| 116 | static void nbmj9195_blitter_w(int vram, int offset, int data) | |
| 117 | 117 | { |
| 118 | 118 | int new_line; |
| 119 | 119 | |
| r1293 | r1294 | |
| 165 | 165 | nbmj9195_clutsel = data; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | void nbmj9195_clut_w(int vram, int offset, int data) | |
| 168 | static void nbmj9195_clut_w(int vram, int offset, int data) | |
| 169 | 169 | { |
| 170 | 170 | nbmj9195_clut[vram][((nbmj9195_clutsel & 0xff) * 0x10) + (offset & 0x0f)] = data; |
| 171 | 171 | } |
| r1293 | r1294 | |
| 382 | 382 | nb19010_busyflag = 0; |
| 383 | 383 | |
| 384 | 384 | /* 1650ns per count */ |
| 385 | | |
| 385 | | |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /****************************************************************************** |
| r1293 | r1294 | |
|---|---|---|
| 26 | 26 | static UINT8 blitter_page; |
| 27 | 27 | |
| 28 | 28 | #if (!INSTANT_BLIT) |
| 29 | static | |
| 29 | static | |
| 30 | 30 | #endif |
| 31 | 31 | |
| 32 | 32 | |
| r1293 | r1294 | |
| 303 | 303 | profiler_mark(PROFILER_END); |
| 304 | 304 | |
| 305 | 305 | #if (!INSTANT_BLIT) |
| 306 | blitter_busy_until = a | |
| 306 | blitter_busy_until = a | |
| 307 | 307 | #endif |
| 308 | 308 | } |
| 309 | 309 | |
| r1293 | r1294 | |
| 317 | 317 | */ |
| 318 | 318 | UINT16 result = 0xffef | (blitter_page << 4); |
| 319 | 319 | #if (!INSTANT_BLIT) |
| 320 | if ( | |
| 320 | if ( | |
| 321 | 321 | result ^= 6; |
| 322 | 322 | #endif |
| 323 | 323 | return result; |
| r1293 | r1294 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | #include "driver.h" |
| 6 | 6 | |
| 7 | mame_bitmap *thief_page0; | |
| 8 | mame_bitmap *thief_page1; | |
| 7 | static mame_bitmap *thief_page0; | |
| 8 | static mame_bitmap *thief_page1; | |
| 9 | 9 | |
| 10 | 10 | static UINT8 thief_read_mask, thief_write_mask; |
| 11 | 11 | static UINT8 thief_video_control; |
| r1293 | r1294 | |
|---|---|---|
| 804 | 804 | |
| 805 | 805 | /* signal we're done */ |
| 806 | 806 | skipdma: |
| 807 | | |
| 807 | | |
| 808 | 808 | |
| 809 | 809 | profiler_mark(PROFILER_END); |
| 810 | 810 | } |
| r1293 | r1294 | |
|---|---|---|
| 107 | 107 | palette_set_color(Machine,offset,MAKE_RGB(r,g,b)); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | void system1_postload(void) | |
| 110 | static void system1_postload(void) | |
| 111 | 111 | { |
| 112 | 112 | memset(sprite_onscreen_map, 255, 256*256); |
| 113 | 113 | memset(bg_dirtybuffer, 1, 1024); |
| r1293 | r1294 | |
|---|---|---|
| 42 | 42 | /* Variables that driver has access to: */ |
| 43 | 43 | UINT16 *powerins_vram_0, *powerins_vctrl_0; |
| 44 | 44 | UINT16 *powerins_vram_1, *powerins_vctrl_1; |
| 45 | UINT16 *powerins_vregs; | |
| 45 | //UINT16 *powerins_vregs; | |
| 46 | 46 | |
| 47 | 47 | /* Variables only used here: */ |
| 48 | 48 | static tilemap *tilemap_0, *tilemap_1; |
| r1293 | r1294 | |
|---|---|---|
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | ******************************************************************************/ |
| 88 | int niyanpai_blitter_r(int vram, int offset) | |
| 88 | static int niyanpai_blitter_r(int vram, int offset) | |
| 89 | 89 | { |
| 90 | 90 | int ret; |
| 91 | 91 | UINT8 *GFXROM = memory_region(REGION_GFX1); |
| r1293 | r1294 | |
| 100 | 100 | return ret; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | void niyanpai_blitter_w(int vram, int offset, int data) | |
| 103 | static void niyanpai_blitter_w(int vram, int offset, int data) | |
| 104 | 104 | { |
| 105 | 105 | switch (offset) |
| 106 | 106 | { |
| r1293 | r1294 | |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | void niyanpai_clutsel_w(int vram, int data) | |
| 136 | static void niyanpai_clutsel_w(int vram, int data) | |
| 137 | 137 | { |
| 138 | 138 | niyanpai_clutsel[vram] = data; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | void niyanpai_clut_w(int vram, int offset, int data) | |
| 141 | static void niyanpai_clut_w(int vram, int offset, int data) | |
| 142 | 142 | { |
| 143 | 143 | niyanpai_clut[vram][((niyanpai_clutsel[vram] & 0xff) * 0x10) + (offset & 0x0f)] = data; |
| 144 | 144 | } |
| r1293 | r1294 | |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | nb19010_busyflag = 0; |
| 345 | | |
| 345 | | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /****************************************************************************** |
| r1293 | r1294 | |
|---|---|---|
| 86 | 86 | UINT32* stv_vdp2_regs; |
| 87 | 87 | UINT32* stv_vdp2_vram; |
| 88 | 88 | /* this won't be used in the end .. */ |
| 89 | UINT8* stv_vdp2_vram_dirty_8x8x4; | |
| 90 | UINT8* stv_vdp2_vram_dirty_8x8x8; | |
| 89 | static UINT8* stv_vdp2_vram_dirty_8x8x4; | |
| 90 | static UINT8* stv_vdp2_vram_dirty_8x8x8; | |
| 91 | 91 | |
| 92 | 92 | static UINT8* stv_vdp2_gfx_decode; |
| 93 | 93 | extern UINT8* stv_vdp1_gfx_decode; |
| r1293 | r1294 | |
|---|---|---|
| 5 | 5 | #include "namcoic.h" |
| 6 | 6 | #include "namcos2.h" |
| 7 | 7 | |
| 8 | UINT32 *namcofl_spritebank32; | |
| 8 | //UINT32 *namcofl_spritebank32; | |
| 9 | 9 | //UINT32 *namcofl_tilebank32; |
| 10 | 10 | UINT32 *namcofl_mcuram; |
| 11 | 11 |
| r1293 | r1294 | |
|---|---|---|
| 909 | 909 | |
| 910 | 910 | ***************************************************************************/ |
| 911 | 911 | |
| 912 | void hanamai_copylayer(mame_bitmap *bitmap,const rectangle *cliprect,int i) | |
| 912 | static void hanamai_copylayer(mame_bitmap *bitmap,const rectangle *cliprect,int i) | |
| 913 | 913 | { |
| 914 | 914 | int color; |
| 915 | 915 | int scrollx,scrolly; |
| r1293 | r1294 | |
| 974 | 974 | } |
| 975 | 975 | |
| 976 | 976 | |
| 977 | void jantouki_copylayer(mame_bitmap *bitmap,const rectangle *cliprect,int i, int y) | |
| 977 | static void jantouki_copylayer(mame_bitmap *bitmap,const rectangle *cliprect,int i, int y) | |
| 978 | 978 | { |
| 979 | 979 | int color,scrollx,scrolly,palettes,palbank; |
| 980 | 980 | |
| r1293 | r1294 | |
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | |
| 1046 | void mjdialq2_copylayer(mame_bitmap *bitmap,const rectangle *cliprect,int i) | |
| 1046 | static void mjdialq2_copylayer(mame_bitmap *bitmap,const rectangle *cliprect,int i) | |
| 1047 | 1047 | { |
| 1048 | 1048 | int color; |
| 1049 | 1049 | int scrollx,scrolly; |
| r1293 | r1294 | |
|---|---|---|
| 137 | 137 | static rectangle clip_rect, scaled_clip_rect; |
| 138 | 138 | static rectangle clip_save; |
| 139 | 139 | |
| 140 | static | |
| 140 | static | |
| 141 | 141 | |
| 142 | 142 | static UINT8 *grom_base; |
| 143 | 143 | static UINT32 grom_size; |
| r1293 | r1294 | |
| 231 | 231 | /* reset statics */ |
| 232 | 232 | memset(itech32_video, 0, 0x80); |
| 233 | 233 | |
| 234 | scanline_timer = | |
| 234 | scanline_timer = | |
| 235 | 235 | enable_latch[0] = 1; |
| 236 | 236 | enable_latch[1] = (itech32_planes > 1) ? 1 : 0; |
| 237 | 237 | |
| r1293 | r1294 | |
| 478 | 478 | static TIMER_CALLBACK( scanline_interrupt ) |
| 479 | 479 | { |
| 480 | 480 | /* set timer for next frame */ |
| 481 | | |
| 481 | | |
| 482 | 482 | |
| 483 | 483 | /* set the interrupt bit in the status reg */ |
| 484 | 484 | logerror("-------------- (DISPLAY INT @ %d) ----------------\n", video_screen_get_vpos(0)); |
| r1293 | r1294 | |
| 1346 | 1346 | break; |
| 1347 | 1347 | |
| 1348 | 1348 | case 0x2c/2: /* VIDEO_INTSCANLINE */ |
| 1349 | | |
| 1349 | | |
| 1350 | 1350 | break; |
| 1351 | 1351 | |
| 1352 | 1352 | case 0x32/2: /* VIDEO_VTOTAL */ |
| r1293 | r1294 | |
|---|---|---|
| 343 | 343 | Bottom 8 bits per pixel is palettised sprite data, top 8 is |
| 344 | 344 | colour/alpha/priority. |
| 345 | 345 | */ |
| 346 | void deco32_draw_sprite(mame_bitmap *dest,const gfx_element *gfx, | |
| 346 | static void deco32_draw_sprite(mame_bitmap *dest,const gfx_element *gfx, | |
| 347 | 347 | UINT32 code,UINT32 priority,int flipx,int flipy,int sx,int sy, |
| 348 | 348 | const rectangle *clip) |
| 349 | 349 | { |
| r1293 | r1294 | |
|---|---|---|
| 154 | 154 | static int lowbitscroll = 0; |
| 155 | 155 | static int prvscrollx = 0; |
| 156 | 156 | |
| 157 | UINT8 bombsa_ram_page; | |
| 158 | UINT8* bomba_otherram; | |
| 157 | static UINT8 bombsa_ram_page; | |
| 158 | static UINT8* bomba_otherram; | |
| 159 | 159 | |
| 160 | 160 | static int valtric_mosaic=0; |
| 161 | 161 | static mame_bitmap *mosaicbitmap; |
| r1293 | r1294 | |
| 1218 | 1218 | } |
| 1219 | 1219 | } |
| 1220 | 1220 | |
| 1221 | void butasan_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 1221 | static void butasan_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 1222 | 1222 | { |
| 1223 | 1223 | int offs; |
| 1224 | 1224 |
| r1293 | r1294 | |
|---|---|---|
| 5 | 5 | static UINT8 flipscreen; |
| 6 | 6 | static UINT8 ninjakun_xscroll,ninjakun_yscroll; |
| 7 | 7 | |
| 8 | UINT8 ninjakun_io_8000_ctrl[4]; | |
| 8 | static UINT8 ninjakun_io_8000_ctrl[4]; | |
| 9 | 9 | // static UINT8 old_scroll; |
| 10 | 10 | |
| 11 | 11 | /******************************************************************************* |
| r1293 | r1294 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | UINT16 *gaiden_videoram,*gaiden_videoram2,*gaiden_videoram3; |
| 10 | 10 | int gaiden_sprite_sizey; |
| 11 | int raiga_alpha; | |
| 11 | //int raiga_alpha; | |
| 12 | 12 | |
| 13 | 13 | static tilemap *text_layer,*foreground,*background; |
| 14 | 14 | static mame_bitmap *sprite_bitmap, *tile_bitmap_bg, *tile_bitmap_fg; |
| r1293 | r1294 | |
|---|---|---|
| 40 | 40 | static UINT32 K001006_addr[MAX_K001006_CHIPS] = { 0, 0 }; |
| 41 | 41 | static int K001006_device_sel[MAX_K001006_CHIPS] = { 0, 0 }; |
| 42 | 42 | |
| 43 | UINT32 K001006_palette[MAX_K001006_CHIPS][0x800]; | |
| 43 | static UINT32 K001006_palette[MAX_K001006_CHIPS][0x800]; | |
| 44 | 44 | |
| 45 | 45 | static UINT32 K001006_r(int chip, int offset, UINT32 mem_mask) |
| 46 | 46 | { |
| r1293 | r1294 | |
| 154 | 154 | static const int decode_y_zr107[16] = { 0, 8, 32, 40, 4, 12, 36, 44, 64, 72, 96, 104, 68, 76, 100, 108 }; |
| 155 | 155 | |
| 156 | 156 | UINT32 K001005_status = 0; |
| 157 | mame_bitmap *K001005_bitmap[2]; | |
| 158 | mame_bitmap *K001005_zbuffer; | |
| 159 | rectangle K001005_cliprect; | |
| 157 | static mame_bitmap *K001005_bitmap[2]; | |
| 158 | static mame_bitmap *K001005_zbuffer; | |
| 159 | static rectangle K001005_cliprect; | |
| 160 | 160 | |
| 161 | 161 | static void render_polygons(void); |
| 162 | 162 |
| r1293 | r1294 | |
|---|---|---|
| 9 | 9 | UINT16 *legion_cmd; |
| 10 | 10 | static UINT16 armedf_fg_scrollx,armedf_fg_scrolly; |
| 11 | 11 | |
| 12 | UINT16 terraf_scroll_msb; | |
| 12 | static UINT16 terraf_scroll_msb; | |
| 13 | 13 | |
| 14 | 14 | static tilemap *bg_tilemap, *fg_tilemap; |
| 15 | 15 | tilemap *armedf_tx_tilemap; |
| r1293 | r1294 | |
|---|---|---|
| 23 | 23 | |
| 24 | 24 | static mame_bitmap *bg_bits; |
| 25 | 25 | static const UINT8 *color_codes; |
| 26 | static | |
| 26 | static | |
| 27 | 27 | |
| 28 | 28 | static const double cd4049_vl = 1.5/5.0; |
| 29 | 29 | static const double cd4049_vh = 3.5/5.0; |
| r1293 | r1294 | |
| 773 | 773 | counter++; |
| 774 | 774 | scanline = (scanline+1) % VTOTAL; |
| 775 | 775 | /* come back at the next appropriate scanline */ |
| 776 | | |
| 776 | | |
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | static VIDEO_START( dkong_base ) |
| r1293 | r1294 | |
| 820 | 820 | |
| 821 | 821 | bg_bits = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); |
| 822 | 822 | |
| 823 | scanline_timer = mame_timer_alloc(scanline_callback); | |
| 824 | mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_zero); | |
| 823 | scanline_timer = timer_alloc(scanline_callback); | |
| 824 | timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_zero); | |
| 825 | 825 | |
| 826 | 826 | } |
| 827 | 827 | |
| r1293 | r1294 | |
| 837 | 837 | |
| 838 | 838 | bg_bits = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); |
| 839 | 839 | |
| 840 | scanline_timer = mame_timer_alloc(scanline_callback); | |
| 841 | mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_zero); | |
| 840 | scanline_timer = timer_alloc(scanline_callback); | |
| 841 | timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_zero); | |
| 842 | 842 | |
| 843 | 843 | } |
| 844 | 844 |
| r1293 | r1294 | |
|---|---|---|
| 624 | 624 | visarea.min_x = visarea.min_y = 0; |
| 625 | 625 | visarea.max_x = m_n_screenwidth - 1; |
| 626 | 626 | visarea.max_y = m_n_screenheight - 1; |
| 627 | video_screen_configure(0, m_n_screenwidth, m_n_screenheight, &visarea, HZ_TO_ | |
| 627 | video_screen_configure(0, m_n_screenwidth, m_n_screenheight, &visarea, HZ_TO_ATTOSECONDS(refresh)); | |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | static void psx_gpu_init( void ) |
| r1293 | r1294 | |
|---|---|---|
| 38 | 38 | UINT16 kaneko16_disp_enable = 1; // default enabled for games not using it |
| 39 | 39 | |
| 40 | 40 | |
| 41 | tilemap *kaneko16_tmap_0, *kaneko16_tmap_1; | |
| 42 | tilemap *kaneko16_tmap_2, *kaneko16_tmap_3; | |
| 41 | static tilemap *kaneko16_tmap_0, *kaneko16_tmap_1; | |
| 42 | static tilemap *kaneko16_tmap_2, *kaneko16_tmap_3; | |
| 43 | 43 | UINT16 *kaneko16_vram_0, *kaneko16_vram_1, *kaneko16_layers_0_regs; |
| 44 | 44 | UINT16 *kaneko16_vscroll_0, *kaneko16_vscroll_1; |
| 45 | 45 | UINT16 *kaneko16_vram_2, *kaneko16_vram_3, *kaneko16_layers_1_regs; |
| r1293 | r1294 | |
| 801 | 801 | |
| 802 | 802 | ***************************************************************************/ |
| 803 | 803 | |
| 804 | void kaneko16_prepare_first_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 804 | static void kaneko16_prepare_first_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 805 | 805 | { |
| 806 | 806 | /* Set Up FIRST Tilemap chip */ |
| 807 | 807 | int layers_flip_0; |
| r1293 | r1294 | |
| 841 | 841 | |
| 842 | 842 | } |
| 843 | 843 | |
| 844 | void kaneko16_prepare_second_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 844 | static void kaneko16_prepare_second_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 845 | 845 | { |
| 846 | 846 | /* Set Up SECOND Tilemap chip */ |
| 847 | 847 | int layers_flip_1 = 0; |
| r1293 | r1294 | |
| 880 | 880 | } |
| 881 | 881 | } |
| 882 | 882 | |
| 883 | void kaneko16_render_first_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri) | |
| 883 | static void kaneko16_render_first_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri) | |
| 884 | 884 | { |
| 885 | 885 | tilemap_draw_primask(bitmap,cliprect, kaneko16_tmap_0, pri, pri, 0); |
| 886 | 886 | tilemap_draw_primask(bitmap,cliprect, kaneko16_tmap_1, pri, pri, 0); |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | void kaneko16_render_second_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri) | |
| 889 | static void kaneko16_render_second_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri) | |
| 890 | 890 | { |
| 891 | 891 | if (kaneko16_tmap_2) |
| 892 | 892 | { |
| r1293 | r1294 | |
| 895 | 895 | } |
| 896 | 896 | } |
| 897 | 897 | |
| 898 | void kaneko16_render_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 898 | static void kaneko16_render_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 899 | 899 | { |
| 900 | 900 | /* Sprites last (rendered with pdrawgfx, so they can slip |
| 901 | 901 | in between the layers) */ |
| r1293 | r1294 | |
| 913 | 913 | } |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | void kaneko16_render_15bpp_bitmap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 916 | static void kaneko16_render_15bpp_bitmap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 917 | 917 | { |
| 918 | 918 | if (kaneko16_bg15_bitmap) |
| 919 | 919 | { |
| r1293 | r1294 | |
| 937 | 937 | } |
| 938 | 938 | } |
| 939 | 939 | |
| 940 | void kaneko16_fill_bitmap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 940 | static void kaneko16_fill_bitmap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 941 | 941 | { |
| 942 | 942 | if(kaneko16_sprite_type == 1) |
| 943 | 943 | fillbitmap(bitmap,machine->pens[0x7f00],cliprect); |
| r1293 | r1294 | |
| 948 | 948 | fillbitmap(bitmap,machine->pens[0],cliprect); |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | void kaneko16_video_update_common(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 951 | static void kaneko16_video_update_common(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 952 | 952 | { |
| 953 | 953 | int i; |
| 954 | 954 |
| r1293 | r1294 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | #include "driver.h" |
| 16 | 16 | |
| 17 | UINT32 *ms32_fce00000; | |
| 17 | //UINT32 *ms32_fce00000; | |
| 18 | 18 | UINT32 *ms32_roz_ctrl; |
| 19 | 19 | UINT32 *ms32_tx_scroll; |
| 20 | 20 | UINT32 *ms32_bg_scroll; |
| r1293 | r1294 | |
| 28 | 28 | UINT32 *ms32_mainram; |
| 29 | 29 | |
| 30 | 30 | // kirarast, tp2m32, and 47pie2 require the sprites in a different order |
| 31 | int ms32_reverse_sprite_order; | |
| 31 | static int ms32_reverse_sprite_order; | |
| 32 | 32 | |
| 33 | 33 | /********** Tilemaps **********/ |
| 34 | 34 |
| r1293 | r1294 | |
|---|---|---|
| 97 | 97 | extern void start_system18_vdp(void); |
| 98 | 98 | extern READ16_HANDLER( segac2_vdp_r ); |
| 99 | 99 | extern WRITE16_HANDLER( segac2_vdp_w ); |
| 100 | UINT16 sys18_ddcrew_bankregs[0x20]; | |
| 100 | static UINT16 sys18_ddcrew_bankregs[0x20]; | |
| 101 | 101 | |
| 102 | 102 | |
| 103 | 103 | |
| r1293 | r1294 | |
| 132 | 132 | int sys16_fg_priority_mode; |
| 133 | 133 | int sys16_bg_priority_value; |
| 134 | 134 | int sys16_fg_priority_value; |
| 135 | int sys16_18_mode; | |
| 135 | static int sys16_18_mode; | |
| 136 | 136 | int sys16_tilebank_switch; |
| 137 | 137 | int sys16_rowscroll_scroll; |
| 138 | 138 | int shinobl_kludge; |
| r1293 | r1294 | |
|---|---|---|
| 136 | 136 | ##########################################################################*/ |
| 137 | 137 | |
| 138 | 138 | static struct atarimo_data atarimo[ATARIMO_MAX]; |
| 139 | static | |
| 139 | static | |
| 140 | 140 | |
| 141 | 141 | |
| 142 | 142 | /*########################################################################## |
| r1293 | r1294 | |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | static struct atarimo_data atarimo[ATARIMO_MAX]; |
| 247 | static | |
| 247 | static | |
| 248 | 248 | |
| 249 | 249 | /*--------------------------------------------------------------- |
| 250 | 250 | init_savestate: Initialize save states |
| r1293 | r1294 | |
| 323 | 323 | scanline += 64; |
| 324 | 324 | if (scanline >= machine->screen[0].visarea.max_y) |
| 325 | 325 | scanline = 0; |
| 326 | | |
| 326 | | |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /*--------------------------------------------------------------- |
| r1293 | r1294 | |
| 444 | 444 | init_gfxelement(machine, mo, desc->gfxindex); |
| 445 | 445 | |
| 446 | 446 | /* start a timer to update a few times during refresh */ |
| 447 | force_update_timer = mame_timer_alloc(force_update); | |
| 448 | mame_timer_adjust(force_update_timer,video_screen_get_time_until_pos(0, 0, 0), 0, time_zero); | |
| 447 | force_update_timer = timer_alloc(force_update); | |
| 448 | timer_adjust(force_update_timer,video_screen_get_time_until_pos(0, 0, 0), 0, attotime_zero); | |
| 449 | 449 | |
| 450 | 450 | init_savestate(map, mo); |
| 451 | 451 |
| r1293 | r1294 | |
|---|---|---|
| 21 | 21 | INT16 spyhunt_scroll_offset; |
| 22 | 22 | |
| 23 | 23 | UINT8 *spyhunt_alpharam; |
| 24 | size_t spyhunt_alpharam_size; | |
| 24 | //size_t spyhunt_alpharam_size; | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 |
| r1293 | r1294 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| 12 | 12 | |
| 13 | UINT8 *jackal_scrollram, *jackal_videoctrl; | |
| 13 | static UINT8 *jackal_scrollram; | |
| 14 | UINT8 *jackal_videoctrl; | |
| 14 | 15 | |
| 15 | 16 | static tilemap *bg_tilemap; |
| 16 | 17 |
| r1293 | r1294 | |
|---|---|---|
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | | |
| 270 | | |
| 271 | 271 | |
| 272 | 272 | state = 1; |
| 273 | 273 | } |
| r1293 | r1294 | |
|---|---|---|
| 754 | 754 | common_get_PC080SN_fg_tile_info(machine,tileinfo,tile_index,PC080SN_bg_ram[1][1],PC080SN_bg_gfx[1]); |
| 755 | 755 | } |
| 756 | 756 | |
| 757 | tile_get_info_callback PC080SN_get_tile_info[PC080SN_MAX_CHIPS][2] = | |
| 757 | static tile_get_info_callback PC080SN_get_tile_info[PC080SN_MAX_CHIPS][2] = | |
| 758 | 758 | { |
| 759 | 759 | { PC080SN_get_bg_tile_info_0, PC080SN_get_fg_tile_info_0 }, |
| 760 | 760 | { PC080SN_get_bg_tile_info_1, PC080SN_get_fg_tile_info_1 } |
| r1293 | r1294 | |
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | 1017 | |
| 1018 | UINT16 topspeed_get_road_pixel_color(UINT16 pixel,UINT16 color) | |
| 1018 | static UINT16 topspeed_get_road_pixel_color(UINT16 pixel,UINT16 color) | |
| 1019 | 1019 | { |
| 1020 | 1020 | UINT16 road_body_color,off_road_color,pixel_type; |
| 1021 | 1021 | |
| r1293 | r1294 | |
| 1476 | 1476 | }; |
| 1477 | 1477 | |
| 1478 | 1478 | |
| 1479 | void TC0080VCO_set_layer_ptrs(void) | |
| 1479 | static void TC0080VCO_set_layer_ptrs(void) | |
| 1480 | 1480 | { |
| 1481 | 1481 | TC0080VCO_char_ram = TC0080VCO_ram + 0x00000/2; /* continues at +0x10000 */ |
| 1482 | 1482 | TC0080VCO_tx_ram_0 = TC0080VCO_ram + 0x01000/2; |
| r1293 | r1294 | |
| 1495 | 1495 | TC0080VCO_scroll_ram = TC0080VCO_ram + 0x20800/2; |
| 1496 | 1496 | } |
| 1497 | 1497 | |
| 1498 | void TC0080VCO_dirty_chars(void) | |
| 1498 | static void TC0080VCO_dirty_chars(void) | |
| 1499 | 1499 | { |
| 1500 | 1500 | memset(TC0080VCO_char_dirty,1,TC0080VCO_TOTAL_CHARS); |
| 1501 | 1501 | TC0080VCO_chars_dirty = 1; |
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | void TC0080VCO_dirty_tilemaps(void) | |
| 1504 | static void TC0080VCO_dirty_tilemaps(void) | |
| 1505 | 1505 | { |
| 1506 | 1506 | tilemap_mark_all_tiles_dirty(TC0080VCO_tilemap[0]); |
| 1507 | 1507 | tilemap_mark_all_tiles_dirty(TC0080VCO_tilemap[1]); |
| 1508 | 1508 | tilemap_mark_all_tiles_dirty(TC0080VCO_tilemap[2]); |
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | void TC0080VCO_restore_scroll(void) | |
| 1511 | static void TC0080VCO_restore_scroll(void) | |
| 1512 | 1512 | { |
| 1513 | 1513 | TC0080VCO_flipscreen = TC0080VCO_scroll_ram[0] & 0x0c00; |
| 1514 | 1514 | |
| r1293 | r1294 | |
| 2163 | 2163 | |
| 2164 | 2164 | /* This array changes with TC0100SCN_MAX_CHIPS */ |
| 2165 | 2165 | |
| 2166 | tile_get_info_callback TC0100SCN_get_tile_info[TC0100SCN_MAX_CHIPS][3] = | |
| 2166 | static tile_get_info_callback TC0100SCN_get_tile_info[TC0100SCN_MAX_CHIPS][3] = | |
| 2167 | 2167 | { |
| 2168 | 2168 | { TC0100SCN_get_bg_tile_info_0, TC0100SCN_get_fg_tile_info_0, TC0100SCN_get_tx_tile_info_0 }, |
| 2169 | 2169 | { TC0100SCN_get_bg_tile_info_1, TC0100SCN_get_fg_tile_info_1, TC0100SCN_get_tx_tile_info_1 }, |
| r1293 | r1294 | |
| 2211 | 2211 | TC0100SCN_gfxbank = (data & 0x1); |
| 2212 | 2212 | } |
| 2213 | 2213 | |
| 2214 | void TC0100SCN_set_layer_ptrs(int i) | |
| 2214 | static void TC0100SCN_set_layer_ptrs(int i) | |
| 2215 | 2215 | { |
| 2216 | 2216 | if (!TC0100SCN_dblwidth[i]) |
| 2217 | 2217 | { |
| r1293 | r1294 | |
| 2238 | 2238 | /* As we can't pass function calls with params in set...func_postload() calls |
| 2239 | 2239 | in the vh_start, this slightly obnoxious method is used */ |
| 2240 | 2240 | |
| 2241 | void TC0100SCN_dirty_tilemaps(int chip) | |
| 2241 | static void TC0100SCN_dirty_tilemaps(int chip) | |
| 2242 | 2242 | { |
| 2243 | 2243 | tilemap_mark_all_tiles_dirty(TC0100SCN_tilemap[chip][0][TC0100SCN_dblwidth[chip]]); |
| 2244 | 2244 | tilemap_mark_all_tiles_dirty(TC0100SCN_tilemap[chip][1][TC0100SCN_dblwidth[chip]]); |
| 2245 | 2245 | tilemap_mark_all_tiles_dirty(TC0100SCN_tilemap[chip][2][TC0100SCN_dblwidth[chip]]); |
| 2246 | 2246 | } |
| 2247 | 2247 | |
| 2248 | void TC0100SCN_dirty_chars(int chip) | |
| 2248 | static void TC0100SCN_dirty_chars(int chip) | |
| 2249 | 2249 | { |
| 2250 | 2250 | memset(TC0100SCN_char_dirty[chip],1,TC0100SCN_TOTAL_CHARS); |
| 2251 | 2251 | TC0100SCN_chars_dirty[chip] = 1; |
| r1293 | r1294 | |
| 3011 | 3011 | common_get_tc0480tx_tile_info(machine,tileinfo,tile_index,TC0480SCP_tx_ram,TC0480SCP_tx_gfx); |
| 3012 | 3012 | } |
| 3013 | 3013 | |
| 3014 | tile_get_info_callback tc480_get_tile_info[5] = | |
| 3014 | static tile_get_info_callback tc480_get_tile_info[5] = | |
| 3015 | 3015 | { |
| 3016 | 3016 | TC0480SCP_get_bg0_tile_info, TC0480SCP_get_bg1_tile_info, |
| 3017 | 3017 | TC0480SCP_get_bg2_tile_info, TC0480SCP_get_bg3_tile_info, |
| r1293 | r1294 | |
| 3034 | 3034 | 32*8 /* every sprite takes 32 consecutive bytes */ |
| 3035 | 3035 | }; |
| 3036 | 3036 | |
| 3037 | void TC0480SCP_set_layer_ptrs(void) | |
| 3037 | static void TC0480SCP_set_layer_ptrs(void) | |
| 3038 | 3038 | { |
| 3039 | 3039 | if (!TC0480SCP_dblwidth) |
| 3040 | 3040 | { |
| r1293 | r1294 | |
| 3072 | 3072 | } |
| 3073 | 3073 | } |
| 3074 | 3074 | |
| 3075 | void TC0480SCP_dirty_tilemaps(void) | |
| 3075 | static void TC0480SCP_dirty_tilemaps(void) | |
| 3076 | 3076 | { |
| 3077 | 3077 | tilemap_mark_all_tiles_dirty(TC0480SCP_tilemap[0][TC0480SCP_dblwidth]); |
| 3078 | 3078 | tilemap_mark_all_tiles_dirty(TC0480SCP_tilemap[1][TC0480SCP_dblwidth]); |
| r1293 | r1294 | |
| 3081 | 3081 | tilemap_mark_all_tiles_dirty(TC0480SCP_tilemap[4][TC0480SCP_dblwidth]); |
| 3082 | 3082 | } |
| 3083 | 3083 | |
| 3084 | void TC0480SCP_dirty_chars(void) | |
| 3084 | static void TC0480SCP_dirty_chars(void) | |
| 3085 | 3085 | { |
| 3086 | 3086 | memset(TC0480SCP_char_dirty,1,TC0480SCP_TOTAL_CHARS); |
| 3087 | 3087 | TC0480SCP_chars_dirty = 1; |
| r1293 | r1294 | |
| 4682 | 4682 | #define TC0110PCR_RAM_SIZE 0x2000 |
| 4683 | 4683 | |
| 4684 | 4684 | |
| 4685 | void TC0110PCR_restore_colors(int chip) | |
| 4685 | static void TC0110PCR_restore_colors(int chip) | |
| 4686 | 4686 | { |
| 4687 | 4687 | int i,color,r=0,g=0,b=0; |
| 4688 | 4688 |
| r1293 | r1294 | |
|---|---|---|
| 73 | 73 | |
| 74 | 74 | #define TILEMAPS 0 |
| 75 | 75 | |
| 76 | int suna8_text_dim; /* specifies format of text layer */ | |
| 76 | static int suna8_text_dim; /* specifies format of text layer */ | |
| 77 | 77 | |
| 78 | 78 | UINT8 suna8_rombank, suna8_spritebank, suna8_palettebank; |
| 79 | 79 | UINT8 suna8_unknown; |
| r1293 | r1294 | |
|---|---|---|
| 419 | 419 | int cps1_scanline2; |
| 420 | 420 | int cps1_scancalls; |
| 421 | 421 | |
| 422 | #ifdef UNUSED_FUNCTION | |
| 422 | 423 | void cps_setversion(int v) |
| 423 | 424 | { |
| 424 | 425 | cps_version=v; |
| 425 | 426 | } |
| 427 | #endif | |
| 426 | 428 | |
| 427 | 429 | |
| 428 | 430 | static MACHINE_RESET( cps ) |
| r1293 | r1294 | |
|---|---|---|
| 161 | 161 | if (offset == 7) |
| 162 | 162 | { |
| 163 | 163 | do_blit(); |
| 164 | | |
| 164 | | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /* clear the IRQ on offset 0 */ |
| r1293 | r1294 | |
|---|---|---|
| 3 | 3 | #include "driver.h" |
| 4 | 4 | |
| 5 | 5 | extern UINT16 *kickgoal_fgram, *kickgoal_bgram, *kickgoal_bg2ram, *kickgoal_scrram; |
| 6 | tilemap *kickgoal_fgtm, *kickgoal_bgtm, *kickgoal_bg2tm; | |
| 6 | static tilemap *kickgoal_fgtm, *kickgoal_bgtm, *kickgoal_bg2tm; | |
| 7 | 7 | |
| 8 | 8 | /* FG */ |
| 9 | 9 | static TILE_GET_INFO( get_kickgoal_fg_tile_info ) |
| r1293 | r1294 | |
|---|---|---|
| 517 | 517 | blit_in_progress = 1; |
| 518 | 518 | |
| 519 | 519 | /* set a timer to go off when we're done */ |
| 520 | | |
| 520 | | |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | /* debugging */ |
| r1293 | r1294 | |
|---|---|---|
| 102 | 102 | UINT8 galaxian_stars_on; |
| 103 | 103 | static INT32 stars_scrollpos; |
| 104 | 104 | static UINT8 stars_blink_state; |
| 105 | static mame_timer *stars_blink_timer; | |
| 106 | static mame_timer *stars_scroll_timer; | |
| 105 | static emu_timer *stars_blink_timer; | |
| 106 | static emu_timer *stars_scroll_timer; | |
| 107 | 107 | static UINT8 timer_adjusted; |
| 108 | 108 | void galaxian_init_stars(running_machine *machine, int colors_offset); |
| 109 | 109 | static void (*draw_stars)(running_machine *, mame_bitmap *); /* function to call to draw the star layer */ |
| 110 | 110 | static void noop_draw_stars(running_machine *machine, mame_bitmap *bitmap); |
| 111 | 111 | void galaxian_draw_stars(running_machine *machine, mame_bitmap *bitmap); |
| 112 | void scramble_draw_stars(running_machine *machine, mame_bitmap *bitmap); | |
| 112 | static void scramble_draw_stars(running_machine *machine, mame_bitmap *bitmap); | |
| 113 | 113 | static void rescue_draw_stars(running_machine *machine, mame_bitmap *bitmap); |
| 114 | 114 | static void mariner_draw_stars(running_machine *machine, mame_bitmap *bitmap); |
| 115 | 115 | static void jumpbug_draw_stars(running_machine *machine, mame_bitmap *bitmap); |
| r1293 | r1294 | |
| 1731 | 1731 | |
| 1732 | 1732 | galaxian_stars_on = 0; |
| 1733 | 1733 | stars_blink_state = 0; |
| 1734 | stars_blink_timer = mame_timer_alloc(stars_blink_callback); | |
| 1735 | stars_scroll_timer = mame_timer_alloc(stars_scroll_callback); | |
| 1734 | stars_blink_timer = timer_alloc(stars_blink_callback); | |
| 1735 | stars_scroll_timer = timer_alloc(stars_scroll_callback); | |
| 1736 | 1736 | timer_adjusted = 0; |
| 1737 | 1737 | stars_colors_start = colors_offset; |
| 1738 | 1738 | |
| r1293 | r1294 | |
| 2032 | 2032 | |
| 2033 | 2033 | int period_in_ms = 693 * (ra + 2.0 * rb) * c; |
| 2034 | 2034 | |
| 2035 | | |
| 2035 | | |
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | 2038 | |
| r1293 | r1294 | |
| 2046 | 2046 | |
| 2047 | 2047 | static void start_stars_scroll_timer() |
| 2048 | 2048 | { |
| 2049 | | |
| 2049 | | |
| 2050 | 2050 | } |
| 2051 | 2051 | |
| 2052 | 2052 |
| r1293 | r1294 | |
|---|---|---|
| 216 | 216 | return (row*64) + (col&63) + ((col&64)<<6); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | void MB60553_init(int numchips) | |
| 219 | static void MB60553_init(int numchips) | |
| 220 | 220 | { |
| 221 | 221 | int i; |
| 222 | 222 | |
| r1293 | r1294 | |
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | void MB60553_set_pal_base(int numchip, int pal_base) | |
| 234 | static void MB60553_set_pal_base(int numchip, int pal_base) | |
| 235 | 235 | { |
| 236 | 236 | MB60553[numchip].pal_base = pal_base; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | void MB60553_set_gfx_region(int numchip, int gfx_region) | |
| 239 | static void MB60553_set_gfx_region(int numchip, int gfx_region) | |
| 240 | 240 | { |
| 241 | 241 | MB60553[numchip].gfx_region = gfx_region; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /* THIS IS STILL WRONG! */ |
| 245 | void MB60553_draw(running_machine *machine, int numchip, mame_bitmap* screen, const rectangle* cliprect, int priority) | |
| 245 | static void MB60553_draw(running_machine *machine, int numchip, mame_bitmap* screen, const rectangle* cliprect, int priority) | |
| 246 | 246 | { |
| 247 | 247 | int line; |
| 248 | 248 | rectangle clip; |
| r1293 | r1294 | |
| 288 | 288 | |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | tilemap* MB60553_get_tilemap(int numchip) | |
| 291 | static tilemap* MB60553_get_tilemap(int numchip) | |
| 292 | 292 | { |
| 293 | 293 | return MB60553[numchip].tmap; |
| 294 | 294 | } |
| r1293 | r1294 | |
| 495 | 495 | } |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | void CG10103_init(int numchips) | |
| 498 | static void CG10103_init(int numchips) | |
| 499 | 499 | { |
| 500 | 500 | int i; |
| 501 | 501 | |
| r1293 | r1294 | |
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | void CG10103_set_pal_base(int numchip, int pal_base) | |
| 512 | static void CG10103_set_pal_base(int numchip, int pal_base) | |
| 513 | 513 | { |
| 514 | 514 | CG10103[numchip].pal_base = pal_base; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | void CG10103_set_gfx_region(int numchip, int gfx_region) | |
| 517 | static void CG10103_set_gfx_region(int numchip, int gfx_region) | |
| 518 | 518 | { |
| 519 | 519 | CG10103[numchip].gfx_region = gfx_region; |
| 520 | 520 | } |
| r1293 | r1294 | |
|---|---|---|
| 297 | 297 | the tile's sizes to be known at startup - which we don't! |
| 298 | 298 | */ |
| 299 | 299 | |
| 300 | int hyprduel_sprite_xoffs, hyprduel_sprite_yoffs; | |
| 300 | static int hyprduel_sprite_xoffs, hyprduel_sprite_yoffs; | |
| 301 | 301 | |
| 302 | 302 | |
| 303 | 303 | static void alloc_empty_tiles(void) |
| r1293 | r1294 | |
|---|---|---|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
| 144 | void flstory_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri) | |
| 144 | static void flstory_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri) | |
| 145 | 145 | { |
| 146 | 146 | int i; |
| 147 | 147 | |
| r1293 | r1294 | |
| 198 | 198 | return 0; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | void victnine_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 201 | static void victnine_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 202 | 202 | { |
| 203 | 203 | int i; |
| 204 | 204 |
| r1293 | r1294 | |
|---|---|---|
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | /* 3D Rasterizer main data input port */ |
| 1103 | void model2_3d_push( UINT32 input ) | |
| 1103 | static void model2_3d_push( UINT32 input ) | |
| 1104 | 1104 | { |
| 1105 | 1105 | /* see if we have a command in progress */ |
| 1106 | 1106 | if ( raster.cur_command != 0 ) |
| r1293 | r1294 | |
|---|---|---|
| 474 | 474 | update_for_scanline(VIDEO_HEIGHT * 8); |
| 475 | 475 | |
| 476 | 476 | /* set a timer to go off at the top of the frame */ |
| 477 | | |
| 477 | | |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 |
| r1293 | r1294 | |
|---|---|---|
| 186 | 186 | 0x1B3,0x1B4,0x1B5,0x1B6,0x1B7,0x1B8,0x1B9,0x1BA,0x1BB,0x1BC,0x1BD,0x1BE,0x1BF,0x1BF |
| 187 | 187 | }; |
| 188 | 188 | |
| 189 | void lorddgun_calc_gun_scr(int i) | |
| 189 | static void lorddgun_calc_gun_scr(int i) | |
| 190 | 190 | { |
| 191 | 191 | int x = readinputport(5+i) - 0x3c; |
| 192 | 192 | if ( (x < 0) || (x > sizeof(lordgun_gun_x_table)/sizeof(lordgun_gun_x_table[0])) ) |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | UINT8 *tiamc1_spriteram_y; |
| 17 | 17 | UINT8 *tiamc1_spriteram_a; |
| 18 | 18 | UINT8 *tiamc1_spriteram_n; |
| 19 | UINT8 tiamc1_layers_ctrl; | |
| 20 | UINT8 tiamc1_bg_vshift; | |
| 21 | UINT8 tiamc1_bg_hshift; | |
| 19 | static UINT8 tiamc1_layers_ctrl; | |
| 20 | static UINT8 tiamc1_bg_vshift; | |
| 21 | static UINT8 tiamc1_bg_hshift; | |
| 22 | 22 | |
| 23 | 23 | static tilemap *bg_tilemap1, *bg_tilemap2; |
| 24 | 24 | static rgb_t *palette; |
| r1293 | r1294 | |
|---|---|---|
| 304 | 304 | spriteram_size = TOAPLAN1_SPRITERAM_SIZE; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | void toaplan1_set_scrolls(void) | |
| 307 | static void toaplan1_set_scrolls(void) | |
| 308 | 308 | { |
| 309 | 309 | tilemap_set_scrollx(pf1_tilemap,0,(pf1_scrollx >> 7) - (tiles_offsetx - scrollx_offs1)); |
| 310 | 310 | tilemap_set_scrollx(pf2_tilemap,0,(pf2_scrollx >> 7) - (tiles_offsetx - scrollx_offs2)); |
| r1293 | r1294 | |
| 316 | 316 | tilemap_set_scrolly(pf4_tilemap,0,(pf4_scrolly >> 7) - (tiles_offsety - scrolly_offs)); |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | void rallybik_flipscreen(void) | |
| 319 | static void rallybik_flipscreen(void) | |
| 320 | 320 | { |
| 321 | 321 | rallybik_bcu_flipscreen_w(0, bcu_flipscreen, 0); |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | void toaplan1_flipscreen(void) | |
| 324 | static void toaplan1_flipscreen(void) | |
| 325 | 325 | { |
| 326 | 326 | toaplan1_bcu_flipscreen_w(0, bcu_flipscreen, 0); |
| 327 | 327 | } |
| r1293 | r1294 | |
|---|---|---|
| 53 | 53 | /* set a timer to mimic the 555 timer that drives the EDGINT signal */ |
| 54 | 54 | /* the 555 is run in monostable mode with R=56000 and C=1000pF */ |
| 55 | 55 | vblank_latch = 1; |
| 56 | | |
| 56 | | |
| 57 | 57 | |
| 58 | 58 | /* latch the current flip state at the same time */ |
| 59 | 59 | video_flip = video_control & 1; |
| r1293 | r1294 | |
|---|---|---|
| 111 | 111 | tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | void pitnrun_spotlights(void) | |
| 114 | static void pitnrun_spotlights(void) | |
| 115 | 115 | { |
| 116 | 116 | int x,y,i,b,datapix; |
| 117 | 117 | UINT8 *ROM = memory_region(REGION_USER1); |
| r1293 | r1294 | |
|---|---|---|
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | /* set a timer to do this again next frame */ |
| 1181 | | |
| 1181 | | |
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | 1184 | |
| 1185 | void segaic16_tilemap_16b_reset(struct tilemap_info *info) | |
| 1185 | static void segaic16_tilemap_16b_reset(struct tilemap_info *info) | |
| 1186 | 1186 | { |
| 1187 | 1187 | /* set a timer to latch values on scanline 261 */ |
| 1188 | | |
| 1188 | | |
| 1189 | 1189 | } |
| 1190 | 1190 | |
| 1191 | 1191 |
| r1293 | r1294 | |
|---|---|---|
| 65 | 65 | |
| 66 | 66 | ***************************************************************************/ |
| 67 | 67 | |
| 68 | tilemap *esdtilemap_0, *esdtilemap_1, *esdtilemap_1_16x16; | |
| 68 | static tilemap *esdtilemap_0; | |
| 69 | static tilemap *esdtilemap_1; | |
| 70 | tilemap *esdtilemap_1_16x16; | |
| 69 | 71 | |
| 70 | 72 | static TILE_GET_INFO( get_tile_info_0 ) |
| 71 | 73 | { |
| r1293 | r1294 | |
|---|---|---|
| 3 | 3 | |
| 4 | 4 | |
| 5 | 5 | UINT8 *iqblock_bgvideoram; |
| 6 | UINT8 *iqblock_fgscroll; | |
| 6 | //UINT8 *iqblock_fgscroll; | |
| 7 | 7 | UINT8 *iqblock_fgvideoram; |
| 8 | 8 | int iqblock_videoenable; |
| 9 | 9 | int iqblock_video_type; |
| r1293 | r1294 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | |
| 11 | UINT8 *sbasketb_scroll; | |
| 11 | //UINT8 *sbasketb_scroll; | |
| 12 | 12 | UINT8 *sbasketb_palettebank; |
| 13 | 13 | UINT8 *sbasketb_spriteram_select; |
| 14 | 14 |
| r1293 | r1294 | |
|---|---|---|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | /* Refresh processor runs with 6 MHz */ |
| 103 | | |
| 103 | | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 |
| r1293 | r1294 | |
|---|---|---|
| 24 | 24 | static UINT8 vram_mask; |
| 25 | 25 | static UINT8 qix_palettebank; |
| 26 | 26 | static UINT8 leds; |
| 27 | static | |
| 27 | static | |
| 28 | 28 | static UINT8 scanline_latch; |
| 29 | 29 | |
| 30 | 30 | |
| r1293 | r1294 | |
| 84 | 84 | vram_mask = 0xff; |
| 85 | 85 | |
| 86 | 86 | /* allocate a timer */ |
| 87 | scanline_timer = mame_timer_alloc(scanline_callback); | |
| 88 | mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 1, 0), 1, time_zero); | |
| 87 | scanline_timer = timer_alloc(scanline_callback); | |
| 88 | timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 1, 0), 1, attotime_zero); | |
| 89 | 89 | |
| 90 | 90 | /* set up save states */ |
| 91 | 91 | state_save_register_global_pointer(videoram, 256 * 256); |
| r1293 | r1294 | |
| 114 | 114 | scanline += SCANLINE_INCREMENT; |
| 115 | 115 | if (scanline > machine->screen[0].visarea.max_y) |
| 116 | 116 | scanline = SCANLINE_INCREMENT; |
| 117 | | |
| 117 | | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 |
| r1293 | r1294 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | |
| 3 | tilemap *ksayakyu_tilemap; | |
| 4 | tilemap *ksayakyu_textmap; | |
| 3 | static tilemap *ksayakyu_tilemap; | |
| 4 | static tilemap *ksayakyu_textmap; | |
| 5 | 5 | |
| 6 | 6 | static int video_ctrl; |
| 7 | 7 | static int flipscreen; |
| r1293 | r1294 | |
|---|---|---|
| 112 | 112 | UINT16 *atarirle_0_spriteram; |
| 113 | 113 | UINT32 *atarirle_0_spriteram32; |
| 114 | 114 | |
| 115 | UINT16 *atarirle_0_command; | |
| 116 | UINT32 *atarirle_0_command32; | |
| 115 | //UINT16 *atarirle_0_command; | |
| 116 | //UINT32 *atarirle_0_command32; | |
| 117 | 117 | |
| 118 | UINT16 *atarirle_0_table; | |
| 119 | UINT32 *atarirle_0_table32; | |
| 118 | //UINT16 *atarirle_0_table; | |
| 119 | //UINT32 *atarirle_0_table32; | |
| 120 | 120 | |
| 121 | 121 | int atarirle_hilite_index = -1; |
| 122 | 122 |
| r1293 | r1294 | |
|---|---|---|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | void mcatadv_draw_tilemap_part(UINT16* current_scroll, UINT16* current_videoram1, int i, tilemap* current_tilemap, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 159 | static void mcatadv_draw_tilemap_part(UINT16* current_scroll, UINT16* current_videoram1, int i, tilemap* current_tilemap, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 160 | 160 | { |
| 161 | 161 | int flip; |
| 162 | 162 | UINT32 drawline; |
| r1293 | r1294 | |
|---|---|---|
| 180 | 180 | UINT16 *toaplan2_txvideoram16_offs; /* Text layer tile flip and positon ? */ |
| 181 | 181 | UINT16 *toaplan2_txscrollram16; /* Text layer scroll ? */ |
| 182 | 182 | UINT16 *toaplan2_tx_gfxram16; /* Text Layer RAM based tiles */ |
| 183 | UINT16 *raizing_tx_gfxram16; /* Text Layer RAM based tiles (Batrider) */ | |
| 183 | static UINT16 *raizing_tx_gfxram16; /* Text Layer RAM based tiles (Batrider) */ | |
| 184 | 184 | static int toaplan2_overflow_vram; /* Teki Paki VRAM test is bugged. It goes out of range */ |
| 185 | 185 | |
| 186 | 186 | static int toaplan2_scroll_reg[2]; |
| r1293 | r1294 | |
| 559 | 559 | |
| 560 | 560 | ***************************************************************************/ |
| 561 | 561 | |
| 562 | void toaplan2_voffs_w(offs_t offset, UINT16 data, UINT32 mem_mask, int controller) | |
| 562 | static void toaplan2_voffs_w(offs_t offset, UINT16 data, UINT32 mem_mask, int controller) | |
| 563 | 563 | { |
| 564 | 564 | if (data >= 0x1c00) |
| 565 | 565 | logerror("Hmmm, unknown video controller %01x layer being selected (%08x)\n",controller,data); |
| r1293 | r1294 | |
| 718 | 718 | |
| 719 | 719 | |
| 720 | 720 | |
| 721 | int toaplan2_videoram16_r(offs_t offset, int controller) | |
| 721 | static int toaplan2_videoram16_r(offs_t offset, int controller) | |
| 722 | 722 | { |
| 723 | 723 | static UINT16 video_data = 0; |
| 724 | 724 | static offs_t vram_offset; |
| r1293 | r1294 | |
| 764 | 764 | return toaplan2_videoram16_r(offset, 1); |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | void toaplan2_videoram16_w(offs_t offset, UINT16 data, UINT32 mem_mask, int controller) | |
| 767 | static void toaplan2_videoram16_w(offs_t offset, UINT16 data, UINT32 mem_mask, int controller) | |
| 768 | 768 | { |
| 769 | 769 | offs_t vram_offset; |
| 770 | 770 | |
| r1293 | r1294 | |
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | |
| 814 | void toaplan2_scroll_reg_select_w(offs_t offset, UINT16 data, UINT32 mem_mask, int controller) | |
| 814 | static void toaplan2_scroll_reg_select_w(offs_t offset, UINT16 data, UINT32 mem_mask, int controller) | |
| 815 | 815 | { |
| 816 | 816 | if (ACCESSING_LSB) |
| 817 | 817 | { |
| r1293 | r1294 | |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | |
| 839 | void toaplan2_scroll_reg_data_w(offs_t offset, UINT16 data, UINT32 mem_mask, int controller) | |
| 839 | static void toaplan2_scroll_reg_data_w(offs_t offset, UINT16 data, UINT32 mem_mask, int controller) | |
| 840 | 840 | { |
| 841 | 841 | /************************************************************************/ |
| 842 | 842 | /***** layer X and Y flips can be set independantly, so emulate it ******/ |
| r1293 | r1294 | |
|---|---|---|
| 42 | 42 | UINT16 *wecleman_videostatus; |
| 43 | 43 | UINT16 *wecleman_pageram, *wecleman_txtram, *wecleman_roadram; |
| 44 | 44 | size_t wecleman_roadram_size; |
| 45 | int wecleman_bgpage[4], wecleman_fgpage[4], *wecleman_gfx_bank; | |
| 45 | static int wecleman_bgpage[4], wecleman_fgpage[4], *wecleman_gfx_bank; | |
| 46 | 46 | |
| 47 | 47 | /* Variables only used here: */ |
| 48 | 48 | static tilemap *bg_tilemap, *fg_tilemap, *txt_tilemap; |
| r1293 | r1294 | |
| 416 | 416 | [ Frontmost (text) layer + video registers ] |
| 417 | 417 | ------------------------------------------------------------------------*/ |
| 418 | 418 | |
| 419 | TILE_GET_INFO( wecleman_get_txt_tile_info ) | |
| 419 | static TILE_GET_INFO( wecleman_get_txt_tile_info ) | |
| 420 | 420 | { |
| 421 | 421 | int code = wecleman_txtram[tile_index]; |
| 422 | 422 | SET_TILE_INFO(PAGE_GFX, code&0xfff, (code>>5&0x78)+(code>>12), 0); |
| r1293 | r1294 | |
| 462 | 462 | [ Background ] |
| 463 | 463 | ------------------------------------------------------------------------*/ |
| 464 | 464 | |
| 465 | TILE_GET_INFO( wecleman_get_bg_tile_info ) | |
| 465 | static TILE_GET_INFO( wecleman_get_bg_tile_info ) | |
| 466 | 466 | { |
| 467 | 467 | int page = wecleman_bgpage[((tile_index&0x7f)>>6) + ((tile_index>>12)<<1)]; |
| 468 | 468 | int code = wecleman_pageram[(tile_index&0x3f) + ((tile_index>>7&0x1f)<<6) + (page<<11)]; |
| r1293 | r1294 | |
| 474 | 474 | [ Foreground ] |
| 475 | 475 | ------------------------------------------------------------------------*/ |
| 476 | 476 | |
| 477 | TILE_GET_INFO( wecleman_get_fg_tile_info ) | |
| 477 | static TILE_GET_INFO( wecleman_get_fg_tile_info ) | |
| 478 | 478 | { |
| 479 | 479 | int page = wecleman_fgpage[((tile_index&0x7f)>>6) + ((tile_index>>12)<<1)]; |
| 480 | 480 | int code = wecleman_pageram[(tile_index&0x3f) + ((tile_index>>7&0x1f)<<6) + (page<<11)]; |
| r1293 | r1294 | |
|---|---|---|
| 25 | 25 | static UINT8 *pastelg_clut; |
| 26 | 26 | |
| 27 | 27 | |
| 28 | void pastelg_vramflip(void); | |
| 29 | void pastelg_gfxdraw(void); | |
| 28 | static void pastelg_vramflip(void); | |
| 29 | static void pastelg_gfxdraw(void); | |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | /****************************************************************************** |
| r1293 | r1294 | |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | nb1413m3_busyflag = 0; |
| 256 | | |
| 256 | | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /****************************************************************************** |
| r1293 | r1294 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | #include "driver.h" |
| 4 | 4 | |
| 5 | tilemap *freek_tilemap; | |
| 5 | static tilemap *freek_tilemap; | |
| 6 | 6 | UINT8 *freek_videoram; |
| 7 | 7 | |
| 8 | 8 |
| r1293 | r1294 | |
|---|---|---|
| 53 | 53 | static UINT16 playfield_lookup[256]; |
| 54 | 54 | static UINT8 playfield_tile_bank; |
| 55 | 55 | static UINT16 playfield_priority_pens; |
| 56 | static | |
| 56 | static | |
| 57 | 57 | |
| 58 | 58 | /* INT3 tracking */ |
| 59 | 59 | static int next_timer_scanline; |
| 60 | static mame_timer *scanline_timer; | |
| 61 | static mame_timer *int3off_timer; | |
| 60 | static emu_timer *scanline_timer; | |
| 61 | static emu_timer *int3off_timer; | |
| 62 | 62 | |
| 63 | 63 | /* graphics bank tracking */ |
| 64 | 64 | static UINT8 bank_gfx[3][8]; |
| r1293 | r1294 | |
| 201 | 201 | /* reset the statics */ |
| 202 | 202 | atarimo_set_yscroll(0, 256); |
| 203 | 203 | next_timer_scanline = -1; |
| 204 | scanline_timer = mame_timer_alloc(int3_callback); | |
| 205 | int3off_timer = mame_timer_alloc(int3off_callback); | |
| 206 | yscroll_reset_timer = mame_timer_alloc(reset_yscroll_callback); | |
| 204 | scanline_timer = timer_alloc(int3_callback); | |
| 205 | int3off_timer = timer_alloc(int3off_callback); | |
| 206 | yscroll_reset_timer = timer_alloc(reset_yscroll_callback); | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | |
| r1293 | r1294 | |
| 329 | 329 | |
| 330 | 330 | /* but since we've adjusted it, we must reset it to the normal value |
| 331 | 331 | once we hit scanline 0 again */ |
| 332 | | |
| 332 | | |
| 333 | 333 | |
| 334 | 334 | /* update the data */ |
| 335 | 335 | *atarigen_yscroll = newscroll; |
| r1293 | r1294 | |
| 397 | 397 | atarigen_scanline_int_gen(); |
| 398 | 398 | |
| 399 | 399 | /* set a timer to turn it off */ |
| 400 | | |
| 400 | | |
| 401 | 401 | |
| 402 | 402 | /* determine the time of the next one */ |
| 403 | 403 | next_timer_scanline = -1; |
| r1293 | r1294 | |
| 476 | 476 | |
| 477 | 477 | /* set a new one */ |
| 478 | 478 | if (best != -1) |
| 479 | | |
| 479 | | |
| 480 | 480 | else |
| 481 | | |
| 481 | | |
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 |
| r1293 | r1294 | |
|---|---|---|
| 13 | 13 | static UINT16 wgp_piv_ctrl_reg; |
| 14 | 14 | static UINT16 wgp_piv_zoom[3],wgp_piv_scrollx[3],wgp_piv_scrolly[3]; |
| 15 | 15 | UINT16 wgp_rotate_ctrl[8]; |
| 16 | int wgp_piv_xoffs,wgp_piv_yoffs; | |
| 16 | static int wgp_piv_xoffs,wgp_piv_yoffs; | |
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 |
| r1293 | r1294 | |
|---|---|---|
| 150 | 150 | { |
| 151 | 151 | if (p1[x] != 16 && p2[x] != 16) |
| 152 | 152 | { |
| 153 | | |
| 153 | | |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | } |
| r1293 | r1294 | |
|---|---|---|
| 141 | 141 | #include "ui.h" |
| 142 | 142 | #endif |
| 143 | 143 | |
| 144 | int shadow_pen_mask, shadow_pen_shift; | |
| 144 | static int shadow_pen_mask, shadow_pen_shift; | |
| 145 | 145 | |
| 146 | void ssv_drawgfx( mame_bitmap *bitmap, const gfx_element *gfx, | |
| 146 | static void ssv_drawgfx( mame_bitmap *bitmap, const gfx_element *gfx, | |
| 147 | 147 | UINT32 code,UINT32 color,int flipx,int flipy,int x0,int y0, |
| 148 | 148 | const rectangle *cliprect, int shadow ) |
| 149 | 149 | { |
| r1293 | r1294 | |
|---|---|---|
| 276 | 276 | int len = 0x8000; |
| 277 | 277 | int i; |
| 278 | 278 | |
| 279 | buffer = malloc(len); | |
| 279 | buffer = malloc_or_die(len); | |
| 280 | 280 | |
| 281 | assert_always(buffer, "Out of memory"); | |
| 282 | ||
| 283 | 281 | /* expand rom tc2-19.10d */ |
| 284 | 282 | for (i = 0; i < len / 2; i++) |
| 285 | 283 | { |
| r1293 | r1294 | |
| 335 | 333 | UINT8 *dst; |
| 336 | 334 | int i, y; |
| 337 | 335 | |
| 338 | dst = (UINT8 *)malloc(len); | |
| 339 | assert_always(dst, "Out of memory"); | |
| 336 | dst = malloc_or_die(len); | |
| 340 | 337 | |
| 341 | 338 | for (i = 0; i < len / (4*4*16); i++) |
| 342 | 339 | for (y = 0; y < 16; y++) |
| r1293 | r1294 | |
| 391 | 388 | UINT8 *dst; |
| 392 | 389 | int i; |
| 393 | 390 | |
| 394 | dst = (UINT8 *)malloc(len); | |
| 395 | assert_always(dst, "Out of memory"); | |
| 391 | dst = malloc_or_die(len); | |
| 396 | 392 | |
| 397 | 393 | memset(dst, 0, len); |
| 398 | 394 |
| r1293 | r1294 | |
|---|---|---|
| 367 | 367 | the tile's sizes to be known at startup - which we don't! |
| 368 | 368 | */ |
| 369 | 369 | |
| 370 | int metro_sprite_xoffs, metro_sprite_yoffs; | |
| 370 | static int metro_sprite_xoffs, metro_sprite_yoffs; | |
| 371 | 371 | |
| 372 | 372 | |
| 373 | 373 | static void alloc_empty_tiles(void) |
| r1293 | r1294 | |
|---|---|---|
| 124 | 124 | tilemap_set_scrollx(bgbot_tilemap, 0, data ); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | UINT8 angelkds_layer_ctrl; | |
| 127 | static UINT8 angelkds_layer_ctrl; | |
| 128 | 128 | |
| 129 | 129 | WRITE8_HANDLER( angelkds_layer_ctrl_write ) |
| 130 | 130 | { |
| r1293 | r1294 | |
|---|---|---|
| 34 | 34 | static UINT16 page_control; |
| 35 | 35 | static UINT8 video_changed; |
| 36 | 36 | |
| 37 | static | |
| 37 | static | |
| 38 | 38 | static poly_manager *poly; |
| 39 | 39 | |
| 40 | 40 | typedef struct _poly_extra_data poly_extra_data; |
| r1293 | r1294 | |
| 58 | 58 | int scanline = param; |
| 59 | 59 | |
| 60 | 60 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| 61 | | |
| 61 | | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| r1293 | r1294 | |
| 70 | 70 | |
| 71 | 71 | VIDEO_START( midvunit ) |
| 72 | 72 | { |
| 73 | scanline_timer = | |
| 73 | scanline_timer = | |
| 74 | 74 | poly = poly_alloc(4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS); |
| 75 | 75 | add_exit_callback(machine, midvunit_exit); |
| 76 | 76 | } |
| r1293 | r1294 | |
| 436 | 436 | |
| 437 | 437 | /* update the scanline timer */ |
| 438 | 438 | if (offset == 0) |
| 439 | | |
| 439 | | |
| 440 | 440 | |
| 441 | 441 | /* if something changed, update our parameters */ |
| 442 | 442 | if (old != video_regs[offset] && video_regs[6] != 0 && video_regs[11] != 0) |
| r1293 | r1294 | |
| 448 | 448 | visarea.max_x = (video_regs[6] + video_regs[2] - video_regs[5]) % video_regs[6]; |
| 449 | 449 | visarea.min_y = 0; |
| 450 | 450 | visarea.max_y = (video_regs[11] + video_regs[7] - video_regs[10]) % video_regs[11]; |
| 451 | video_screen_configure(0, video_regs[6], video_regs[11], &visarea, HZ_TO_ | |
| 451 | video_screen_configure(0, video_regs[6], video_regs[11], &visarea, HZ_TO_ATTOSECONDS(MIDVUNIT_VIDEO_CLOCK / 2) * video_regs[6] * video_regs[11]); | |
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 |
| r1293 | r1294 | |
|---|---|---|
| 3 | 3 | UINT8 *usg_videoram,*usg_charram; |
| 4 | 4 | |
| 5 | 5 | |
| 6 | tilemap *usg_tilemap; | |
| 6 | static tilemap *usg_tilemap; | |
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 |
| r1293 | r1294 | |
|---|---|---|
| 39 | 39 | ---- ---- --54 ---- ? (Bit 4 used by uballoon) |
| 40 | 40 | ---- ---- ---- 3210 Source Row |
| 41 | 41 | |
| 42 | $10002.w | |
| 42 | $10002.w | |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | [ Sprite's Tiles Format ] |
| r1293 | r1294 | |
| 66 | 66 | if (ACCESSING_LSB) |
| 67 | 67 | { |
| 68 | 68 | flip_screen_set( data & 1 ); |
| 69 | color_bank = data & 4; | |
| 69 | color_bank = ( data & 4 ) >> 2; | |
| 70 | 70 | } |
| 71 | if (data & ~ | |
| 71 | if (data & ~(1|4)) logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", activecpu_get_pc(), data); | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | WRITE16_HANDLER( bestbest_flipscreen_w ) | |
| 75 | { | |
| 76 | if (ACCESSING_LSB) | |
| 77 | { | |
| 78 | flip_screen_set( data & 0x10 ); | |
| 79 | // color_bank = ( data & 0x07 ); | |
| 80 | } | |
| 81 | if (data & ~(0x10)) logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", activecpu_get_pc(), data); | |
| 82 | } | |
| 74 | 83 | |
| 84 | ||
| 75 | 85 | /*************************************************************************** |
| 76 | 86 | |
| 77 | 87 | |
| r1293 | r1294 | |
| 82 | 92 | |
| 83 | 93 | VIDEO_START( suna16 ) |
| 84 | 94 | { |
| 85 | paletteram16 | |
| 95 | paletteram16 | |
| 86 | 96 | } |
| 87 | 97 | |
| 88 | 98 | READ16_HANDLER( suna16_paletteram16_r ) |
| 89 | 99 | { |
| 90 | if (color_bank) return paletteram16_2[offset]; | |
| 91 | else return paletteram16[offset]; | |
| 100 | return paletteram16[offset + color_bank * 256]; | |
| 92 | 101 | } |
| 93 | 102 | |
| 94 | 103 | WRITE16_HANDLER( suna16_paletteram16_w ) |
| 95 | 104 | { |
| 96 | if (color_bank) data = COMBINE_DATA(&paletteram16_2[offset]); | |
| 97 | else data = COMBINE_DATA(&paletteram16[offset]); | |
| 98 | palette_set_color_rgb( Machine, offset + (color_bank ? 0x100 : 0),pal5bit(data >> 0),pal5bit(data >> 5),pal5bit(data >> 10)); | |
| 105 | offset += color_bank * 256; | |
| 106 | data = COMBINE_DATA(&paletteram16[offset]); | |
| 107 | palette_set_color_rgb( Machine, offset, pal5bit(data >> 0),pal5bit(data >> 5),pal5bit(data >> 10)); | |
| 99 | 108 | } |
| 100 | 109 | |
| 101 | 110 | |
| r1293 | r1294 | |
| 107 | 116 | |
| 108 | 117 | ***************************************************************************/ |
| 109 | 118 | |
| 110 | static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 119 | static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT16 *sprites, int gfx) | |
| 111 | 120 | { |
| 112 | 121 | int offs; |
| 113 | 122 | |
| 114 | int max_x = machine->screen[0].width | |
| 123 | int max_x = machine->screen[0].width - 8; | |
| 115 | 124 | int max_y = machine->screen[0].height - 8; |
| 116 | 125 | |
| 117 | 126 | for ( offs = 0xfc00/2; offs < 0x10000/2 ; offs += 4/2 ) |
| r1293 | r1294 | |
| 122 | 131 | int dx, dy; |
| 123 | 132 | int flipx, y0; |
| 124 | 133 | |
| 125 | int y = spriteram16[ offs + 0 + 0x00000 / 2 ]; | |
| 126 | int x = spriteram16[ offs + 1 + 0x00000 / 2 ]; | |
| 127 | int dim = spriteram16[ offs + 0 + 0x10000 / 2 ]; | |
| 134 | int y = sprites[ offs + 0 + 0x00000 / 2 ]; | |
| 135 | int x = sprites[ offs + 1 + 0x00000 / 2 ]; | |
| 136 | int dim = sprites[ offs + 0 + 0x10000 / 2 ]; | |
| 128 | 137 | |
| 129 | 138 | int bank = (x >> 12) & 0xf; |
| 130 | 139 | |
| r1293 | r1294 | |
| 162 | 171 | ((srcx + tile_x) & 0x1f) * 0x20 + |
| 163 | 172 | ((srcy + tile_y) & 0x1f); |
| 164 | 173 | |
| 165 | int tile = spriteram16[ addr + 0x00000 / 2 ]; | |
| 166 | int attr = spriteram16[ addr + 0x10000 / 2 ]; | |
| 174 | int tile = sprites[ addr + 0x00000 / 2 ]; | |
| 175 | int attr = sprites[ addr + 0x10000 / 2 ]; | |
| 167 | 176 | |
| 168 | 177 | int sx = x + dx; |
| 169 | 178 | int sy = (y + dy) & 0xff; |
| r1293 | r1294 | |
| 181 | 190 | tile_flipy = !tile_flipy; |
| 182 | 191 | } |
| 183 | 192 | |
| 184 | drawgfx( bitmap, machine->gfx[ | |
| 193 | drawgfx( bitmap, machine->gfx[gfx], | |
| 185 | 194 | (tile & 0x3fff) + bank*0x4000, |
| 186 | attr + (color_bank | |
| 195 | attr + (color_bank << 4 | |
| 187 | 196 | tile_flipx, tile_flipy, |
| 188 | 197 | sx, sy, |
| 189 | 198 | cliprect,TRANSPARENCY_PEN,15 ); |
| r1293 | r1294 | |
| 211 | 220 | { |
| 212 | 221 | /* Suna Quiz indicates the background is the last pen */ |
| 213 | 222 | fillbitmap(bitmap,machine->pens[0xff],cliprect); |
| 214 | draw_sprites(machine, bitmap, cliprect); | |
| 223 | draw_sprites(machine, bitmap, cliprect, spriteram16, 0); | |
| 215 | 224 | return 0; |
| 216 | 225 | } |
| 226 | ||
| 227 | VIDEO_UPDATE( bestbest ) | |
| 228 | { | |
| 229 | int layers_ctrl = -1; | |
| 230 | ||
| 231 | #ifdef MAME_DEBUG | |
| 232 | if (input_code_pressed(KEYCODE_Z)) | |
| 233 | { int msk = 0; | |
| 234 | if (input_code_pressed(KEYCODE_Q)) msk |= 1; | |
| 235 | if (input_code_pressed(KEYCODE_W)) msk |= 2; | |
| 236 | if (msk != 0) layers_ctrl &= msk; | |
| 237 | } | |
| 238 | #endif | |
| 239 | ||
| 240 | /* Suna Quiz indicates the background is the last pen */ | |
| 241 | fillbitmap(bitmap,machine->pens[0xff],cliprect); | |
| 242 | if (layers_ctrl & 1) draw_sprites(machine, bitmap, cliprect, spriteram16, 0); | |
| 243 | if (layers_ctrl & 2) draw_sprites(machine, bitmap, cliprect, spriteram16_2, 1); | |
| 244 | return 0; | |
| 245 | } |
| r1293 | r1294 | |
|---|---|---|
| 146 | 146 | |
| 147 | 147 | static int is_ntsc(void) |
| 148 | 148 | { |
| 149 | return | |
| 149 | return ATTOSECONDS_TO_HZ(Machine->screen[0].refresh) > 55; | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 |
| r1293 | r1294 | |
|---|---|---|
| 27 | 27 | * |
| 28 | 28 | *************************************/ |
| 29 | 29 | |
| 30 | static | |
| 30 | static | |
| 31 | 31 | static UINT32 playfield_tile_bank[2]; |
| 32 | 32 | static UINT32 videobank; |
| 33 | 33 | static UINT16 *vram; |
| r1293 | r1294 | |
| 133 | 133 | tilemap_set_transparent_pen(atarigen_alpha_tilemap, 0); |
| 134 | 134 | |
| 135 | 135 | /* reset the statics */ |
| 136 | yscroll_reset_timer = | |
| 136 | yscroll_reset_timer = | |
| 137 | 137 | videobank = 0; |
| 138 | 138 | } |
| 139 | 139 | |
| r1293 | r1294 | |
| 190 | 190 | if (!(newscroll & 0x10)) |
| 191 | 191 | tilemap_set_scrolly(atarigen_playfield_tilemap, 0, (newscroll >> 6) - video_screen_get_vpos(0)); |
| 192 | 192 | else |
| 193 | | |
| 193 | | |
| 194 | 194 | |
| 195 | 195 | /* update the playfield banking */ |
| 196 | 196 | if (playfield_tile_bank[1] != (newscroll & 0x0f) * 0x400) |
| r1293 | r1294 | |
|---|---|---|
| 29 | 29 | mjsister_videoram1 = auto_malloc(0x8000); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | void mjsister_plot0(int offset,UINT8 data) | |
| 32 | static void mjsister_plot0(int offset,UINT8 data) | |
| 33 | 33 | { |
| 34 | 34 | int x,y,c1,c2; |
| 35 | 35 | |
| r1293 | r1294 | |
| 43 | 43 | *BITMAP_ADDR16(mjsister_tmpbitmap0, y, x*2+1) = Machine->pens[c2]; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | void mjsister_plot1(int offset,UINT8 data) | |
| 46 | static void mjsister_plot1(int offset,UINT8 data) | |
| 47 | 47 | { |
| 48 | 48 | int x,y,c1,c2; |
| 49 | 49 |
| r1293 | r1294 | |
|---|---|---|
| 190 | 190 | static UINT32 blitter_regs[BLITTER_REGS]; |
| 191 | 191 | static UINT16 gpu_regs[GPU_REGS]; |
| 192 | 192 | |
| 193 | static | |
| 193 | static | |
| 194 | 194 | static UINT8 cpu_irq_state; |
| 195 | 195 | |
| 196 | 196 | static pen_t *pen_table; |
| r1293 | r1294 | |
| 277 | 277 | |
| 278 | 278 | cpu_irq_state |= 1; |
| 279 | 279 | update_cpu_irq(); |
| 280 | | |
| 280 | | |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
| r1293 | r1294 | |
| 302 | 302 | * |
| 303 | 303 | *************************************/ |
| 304 | 304 | |
| 305 | void jaguar_set_palette(UINT16 vmode) | |
| 305 | static void jaguar_set_palette(UINT16 vmode) | |
| 306 | 306 | { |
| 307 | 307 | static const UINT8 red_lookup[256] = |
| 308 | 308 | { |
| r1293 | r1294 | |
| 648 | 648 | { |
| 649 | 649 | case VI: |
| 650 | 650 | scanline = (gpu_regs[VI] - gpu_regs[VBE]) / 2; |
| 651 | | |
| 651 | | |
| 652 | 652 | break; |
| 653 | 653 | |
| 654 | 654 | case INT1: |
| r1293 | r1294 | |
| 734 | 734 | |
| 735 | 735 | pen_table = auto_malloc(65536 * sizeof(pen_t)); |
| 736 | 736 | |
| 737 | vi_timer = | |
| 737 | vi_timer = | |
| 738 | 738 | |
| 739 | 739 | state_save_register_global_pointer(pen_table, 65536); |
| 740 | 740 | state_save_register_global_array(blitter_regs); |
| r1293 | r1294 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | int helifire_flash; |
| 15 | 15 | |
| 16 | static | |
| 16 | static | |
| 17 | 17 | |
| 18 | 18 | static int sheriff_color_mode; |
| 19 | 19 | static int sheriff_color_data; |
| r1293 | r1294 | |
| 65 | 65 | { |
| 66 | 66 | spacefev_red_cannon = 1; |
| 67 | 67 | |
| 68 | | |
| 68 | | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| r1293 | r1294 | |
| 73 | 73 | { |
| 74 | 74 | spacefev_red_cannon = 0; |
| 75 | 75 | |
| 76 | | |
| 76 | | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
| 80 | void helifire_next_line(void) | |
| 80 | static void helifire_next_line(void) | |
| 81 | 81 | { |
| 82 | 82 | helifire_mv++; |
| 83 | 83 | |
| r1293 | r1294 | |
| 106 | 106 | |
| 107 | 107 | VIDEO_START( spacefev ) |
| 108 | 108 | { |
| 109 | cannon_timer = | |
| 109 | cannon_timer = | |
| 110 | 110 | |
| 111 | 111 | flip_screen = 0; |
| 112 | 112 |
| r1293 | r1294 | |
|---|---|---|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | nb1413m3_busyflag = 0; |
| 482 | | |
| 482 | | |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | /****************************************************************************** |
| r1293 | r1294 | |
|---|---|---|
| 64 | 64 | } |
| 65 | 65 | #endif |
| 66 | 66 | |
| 67 | void gcpinbal_core_vh_start (void) | |
| 67 | static void gcpinbal_core_vh_start (void) | |
| 68 | 68 | { |
| 69 | 69 | int xoffs = 0; |
| 70 | 70 | int yoffs = 0; |
| r1293 | r1294 | |
|---|---|---|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
| 113 | void sega_generate_vector_list(void) | |
| 113 | static void sega_generate_vector_list(void) | |
| 114 | 114 | { |
| 115 | 115 | UINT8 *sintable = memory_region(REGION_PROMS); |
| 116 | 116 | double total_time = 1.0 / (double)IRQ_CLOCK; |
| r1293 | r1294 | |
|---|---|---|
| 27 | 27 | static INT32 m62_background_hscroll; |
| 28 | 28 | static INT32 m62_background_vscroll; |
| 29 | 29 | |
| 30 | UINT8 *irem_textram; | |
| 31 | size_t irem_textram_size; | |
| 30 | static UINT8 *irem_textram; | |
| 31 | static size_t irem_textram_size; | |
| 32 | 32 | |
| 33 | 33 | static UINT8 kidniki_background_bank; |
| 34 | 34 | static INT32 kidniki_text_vscroll; |
| r1293 | r1294 | |
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | void m62_start( tile_get_info_callback tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 ) | |
| 367 | static void m62_start( tile_get_info_callback tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 ) | |
| 368 | 368 | { |
| 369 | 369 | m62_background = tilemap_create( tile_get_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, x1, y1, x2, y2 ); |
| 370 | 370 | |
| r1293 | r1294 | |
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | void m62_textlayer( tile_get_info_callback tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 ) | |
| 386 | static void m62_textlayer( tile_get_info_callback tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 ) | |
| 387 | 387 | { |
| 388 | 388 | m62_foreground = tilemap_create( tile_get_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, x1, y1, x2, y2 ); |
| 389 | 389 |
| r1293 | r1294 | |
|---|---|---|
| 47 | 47 | static UINT8 horizontal_feedback; |
| 48 | 48 | |
| 49 | 49 | /* Astrocade video parameters */ |
| 50 | static | |
| 50 | static | |
| 51 | 51 | static UINT8 colors[8]; |
| 52 | 52 | static UINT8 colorsplit; |
| 53 | 53 | static UINT8 bgdata; |
| r1293 | r1294 | |
| 224 | 224 | VIDEO_START( astrocde ) |
| 225 | 225 | { |
| 226 | 226 | /* allocate a per-scanline timer */ |
| 227 | scanline_timer = mame_timer_alloc(scanline_callback); | |
| 228 | mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 1, 0), 1, time_zero); | |
| 227 | scanline_timer = timer_alloc(scanline_callback); | |
| 228 | timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 1, 0), 1, attotime_zero); | |
| 229 | 229 | |
| 230 | 230 | /* register for save states */ |
| 231 | 231 | init_savestate(); |
| r1293 | r1294 | |
| 239 | 239 | VIDEO_START( profpac ) |
| 240 | 240 | { |
| 241 | 241 | /* allocate a per-scanline timer */ |
| 242 | scanline_timer = mame_timer_alloc(scanline_callback); | |
| 243 | mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 1, 0), 1, time_zero); | |
| 242 | scanline_timer = timer_alloc(scanline_callback); | |
| 243 | timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 1, 0), 1, attotime_zero); | |
| 244 | 244 | |
| 245 | 245 | /* allocate videoram */ |
| 246 | 246 | profpac_videoram = auto_malloc(0x4000 * 4 * sizeof(*profpac_videoram)); |
| r1293 | r1294 | |
| 444 | 444 | else |
| 445 | 445 | { |
| 446 | 446 | cpunum_set_input_line_and_vector(0, 0, ASSERT_LINE, interrupt_vector & 0xf0); |
| 447 | | |
| 447 | | |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /* latch the feedback registers */ |
| r1293 | r1294 | |
| 480 | 480 | else |
| 481 | 481 | { |
| 482 | 482 | cpunum_set_input_line_and_vector(0, 0, ASSERT_LINE, interrupt_vector); |
| 483 | | |
| 483 | | |
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | |
| r1293 | r1294 | |
| 492 | 492 | scanline++; |
| 493 | 493 | if (scanline >= machine->screen[0].height) |
| 494 | 494 | scanline = 0; |
| 495 | | |
| 495 | | |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 |
| r1293 | r1294 | |
|---|---|---|
| 7 | 7 | #include "driver.h" |
| 8 | 8 | |
| 9 | 9 | UINT8 *renegade_videoram2; |
| 10 | INT32 renegade_scrollx; | |
| 10 | static INT32 renegade_scrollx; | |
| 11 | 11 | static tilemap *bg_tilemap; |
| 12 | 12 | static tilemap *fg_tilemap; |
| 13 | 13 |
| r1293 | r1294 | |
|---|---|---|
| 542 | 542 | nb1413m3_busyflag = 0; |
| 543 | 543 | |
| 544 | 544 | if (gfxtype == GFXTYPE_8BIT) |
| 545 | | |
| 545 | | |
| 546 | 546 | else |
| 547 | | |
| 547 | | |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 |
| r1293 | r1294 | |
|---|---|---|
| 52 | 52 | title_screen = data & 0x01; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | void psychic5_paletteram_w(int color_offs, int offset, int data) | |
| 55 | static void psychic5_paletteram_w(int color_offs, int offset, int data) | |
| 56 | 56 | { |
| 57 | 57 | int r,g,b,a,val; |
| 58 | 58 |
| r1293 | r1294 | |
|---|---|---|
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | void taito_update_sprites_active_area(void) | |
| 454 | static void taito_update_sprites_active_area(void) | |
| 455 | 455 | { |
| 456 | 456 | int off; |
| 457 | 457 |
| r1293 | r1294 | |
|---|---|---|
| 34 | 34 | UINT8 r,g,b; |
| 35 | 35 | UINT8 x,xp,y,yp; |
| 36 | 36 | UINT8 cmd,cmdlo; |
| 37 | | |
| 37 | | |
| 38 | 38 | UINT8 timer_active; |
| 39 | | |
| 39 | | |
| 40 | 40 | } micro; |
| 41 | 41 | |
| 42 | 42 | |
| r1293 | r1294 | |
| 44 | 44 | /* from what I can tell, this should be divided by 32, not 8 */ |
| 45 | 45 | /* but the interrupt test does some precise timing, and fails */ |
| 46 | 46 | /* if it's not 8 */ |
| 47 | #define MICRO_STATE_CLOCK_PERIOD | |
| 47 | #define MICRO_STATE_CLOCK_PERIOD | |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | /* debugging constants */ |
| r1293 | r1294 | |
| 97 | 97 | update_complete = 0; |
| 98 | 98 | video_control = 0; |
| 99 | 99 | memset(µ, 0, sizeof(micro)); |
| 100 | micro.timer = | |
| 100 | micro.timer = | |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
| r1293 | r1294 | |
| 108 | 108 | * |
| 109 | 109 | *************************************/ |
| 110 | 110 | |
| 111 | void victory_update_irq(void) | |
| 111 | static void victory_update_irq(void) | |
| 112 | 112 | { |
| 113 | 113 | if (vblank_irq || fgcoll || (bgcoll && (video_control & 0x20))) |
| 114 | 114 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| r1293 | r1294 | |
| 221 | 221 | // D5 = 5VIRQ |
| 222 | 222 | // D4 = 5BCIRQ (3B1) |
| 223 | 223 | // D3 = SL256 |
| 224 | if (micro.timer_active && | |
| 224 | if (micro.timer_active && | |
| 225 | 225 | result |= 0x80; |
| 226 | 226 | result |= (~fgcoll & 1) << 6; |
| 227 | 227 | result |= (~vblank_irq & 1) << 5; |
| r1293 | r1294 | |
| 555 | 555 | |
| 556 | 556 | INLINE void count_states(int states) |
| 557 | 557 | { |
| 558 | | |
| 558 | | |
| 559 | 559 | |
| 560 | 560 | if (!micro.timer) |
| 561 | 561 | { |
| 562 | | |
| 562 | | |
| 563 | 563 | micro.timer_active = 1; |
| 564 | 564 | micro.endtime = state_time; |
| 565 | 565 | } |
| 566 | else if ( | |
| 566 | else if ( | |
| 567 | 567 | { |
| 568 | | |
| 568 | | |
| 569 | 569 | micro.timer_active = 1; |
| 570 | 570 | micro.endtime = state_time; |
| 571 | 571 | } |
| 572 | 572 | else |
| 573 | micro.endtime = a | |
| 573 | micro.endtime = a | |
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | |
| r1293 | r1294 | |
| 1180 | 1180 | int fpix = *fg++; |
| 1181 | 1181 | int bpix = bg[(x + scrollx) & 255]; |
| 1182 | 1182 | if (fpix && (bpix & bgcollmask) && count++ < 128) |
| 1183 | | |
| 1183 | | |
| 1184 | 1184 | } |
| 1185 | 1185 | } |
| 1186 | 1186 | } |
| r1293 | r1294 | |
| 1218 | 1218 | int bpix = bg[(x + scrollx) & 255]; |
| 1219 | 1219 | scanline[x] = bpix | (fpix << 3); |
| 1220 | 1220 | if (fpix && (bpix & bgcollmask) && count++ < 128) |
| 1221 | | |
| 1221 | | |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | /* draw the scanline */ |
| r1293 | r1294 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | UINT8 *ladyfrog_scrlram; |
| 16 | 16 | |
| 17 | UINT8 *ladyfrog_spriteram; | |
| 17 | static UINT8 *ladyfrog_spriteram; | |
| 18 | 18 | extern UINT8 *ladyfrog_sharedram; |
| 19 | 19 | |
| 20 | 20 | WRITE8_HANDLER(ladyfrog_spriteram_w) |
| r1293 | r1294 | |
|---|---|---|
| 20 | 20 | UINT8 *taitosj_gfxpointer; |
| 21 | 21 | UINT8 *taitosj_colorbank,*taitosj_video_priority; |
| 22 | 22 | UINT8 *kikstart_scrollram; |
| 23 | UINT8 *taitosj_spritebank; | |
| 23 | static UINT8 *taitosj_spritebank; | |
| 24 | 24 | static UINT8 taitosj_collision_reg[4]; |
| 25 | 25 | static UINT8 *dirtybuffer2,*dirtybuffer3; |
| 26 | 26 | static mame_bitmap *taitosj_tmpbitmap[3]; |
| r1293 | r1294 | |
|---|---|---|
| 23 | 23 | 6*8, 32*8-1 |
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | UINT8 *vigilant_paletteram; | |
| 27 | UINT8 *vigilant_sprite_paletteram; | |
| 26 | //UINT8 *vigilant_paletteram; | |
| 27 | //UINT8 *vigilant_sprite_paletteram; | |
| 28 | 28 | |
| 29 | 29 | static int horiz_scroll_low=0; |
| 30 | 30 | static int horiz_scroll_high=0; |
| r1293 | r1294 | |
|---|---|---|
| 125 | 125 | |
| 126 | 126 | static int xmin, xmax, ymin, ymax; |
| 127 | 127 | static int xcenter, ycenter; |
| 128 | static | |
| 128 | static | |
| 129 | 129 | |
| 130 | 130 | static int flip_x, flip_y; |
| 131 | 131 | |
| r1293 | r1294 | |
| 1200 | 1200 | |
| 1201 | 1201 | /* If halt flag was set, let CPU catch up before we make halt visible */ |
| 1202 | 1202 | if (vg->halt && !(vg->state_latch & 0x10)) |
| 1203 | | |
| 1203 | | |
| 1204 | 1204 | |
| 1205 | 1205 | vg->state_latch = (vg->halt << 4) | (vg->state_latch & 0xf); |
| 1206 | 1206 | cycles += 8; |
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | | |
| 1209 | | |
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | |
| r1293 | r1294 | |
| 1236 | 1236 | |
| 1237 | 1237 | vgc->vggo(vg); |
| 1238 | 1238 | vg_set_halt(0); |
| 1239 | | |
| 1239 | | |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | WRITE16_HANDLER( avgdvg_go_word_w ) |
| r1293 | r1294 | |
| 1286 | 1286 | |
| 1287 | 1287 | flip_x = flip_y = 0; |
| 1288 | 1288 | |
| 1289 | vg_halt_timer = mame_timer_alloc(vg_set_halt_callback); | |
| 1290 | vg_run_timer = mame_timer_alloc(run_state_machine); | |
| 1289 | vg_halt_timer = timer_alloc(vg_set_halt_callback); | |
| 1290 | vg_run_timer = timer_alloc(run_state_machine); | |
| 1291 | 1291 | |
| 1292 | 1292 | /* |
| 1293 | 1293 | * The x and y DACs use 10 bit of the counter values which are in |
| r1293 | r1294 | |
|---|---|---|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | nb1413m3_busyflag = 0; |
| 290 | | |
| 290 | | |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /****************************************************************************** |
| r1293 | r1294 | |
|---|---|---|
| 229 | 229 | |
| 230 | 230 | ***************************************************************************/ |
| 231 | 231 | |
| 232 | int vsgongf_color; | |
| 232 | static int vsgongf_color; | |
| 233 | 233 | |
| 234 | 234 | WRITE8_HANDLER( vsgongf_color_w ) |
| 235 | 235 | { |
| r1293 | r1294 | |
|---|---|---|
| 7 | 7 | UINT16 *namcos2_sprite_ram; |
| 8 | 8 | UINT16 *namcos2_68k_palette_ram; |
| 9 | 9 | size_t namcos2_68k_palette_size; |
| 10 | size_t namcos2_68k_roz_ram_size; | |
| 10 | //size_t namcos2_68k_roz_ram_size; | |
| 11 | 11 | UINT16 *namcos2_68k_roz_ram; |
| 12 | 12 | |
| 13 | 13 | static UINT16 namcos2_68k_roz_ctrl[0x8]; |
| r1293 | r1294 | |
|---|---|---|
| 13 | 13 | UINT8 *route16_videoram1; |
| 14 | 14 | UINT8 *route16_videoram2; |
| 15 | 15 | size_t route16_videoram_size; |
| 16 | int route16_hardware; | |
| 16 | //int route16_hardware; | |
| 17 | 17 | |
| 18 | 18 | static UINT8 flipscreen; |
| 19 | 19 | static UINT8 palette_1; |
| r1293 | r1294 | |
|---|---|---|
| 29 | 29 | static UINT8 palettebank_vis; |
| 30 | 30 | |
| 31 | 31 | /* function prototypes */ |
| 32 | void exidy440_update_firq(void); | |
| 32 | static void exidy440_update_firq(void); | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | |
| r1293 | r1294 | |
| 354 | 354 | |
| 355 | 355 | /* check the collisions bit */ |
| 356 | 356 | if ((palette[2 * pen] & 0x80) && count++ < 128) |
| 357 | | |
| 357 | | |
| 358 | 358 | } |
| 359 | 359 | currx++; |
| 360 | 360 | |
| r1293 | r1294 | |
| 367 | 367 | |
| 368 | 368 | /* check the collisions bit */ |
| 369 | 369 | if ((palette[2 * pen] & 0x80) && count++ < 128) |
| 370 | | |
| 370 | | |
| 371 | 371 | } |
| 372 | 372 | currx++; |
| 373 | 373 | } |
| r1293 | r1294 | |
| 438 | 438 | /* generate an interrupt once/frame for the beam */ |
| 439 | 439 | if (!exidy440_topsecret) |
| 440 | 440 | { |
| 441 | mame_time time; | |
| 442 | subseconds_t increment; | |
| 441 | attotime time; | |
| 442 | attoseconds_t increment; | |
| 443 | 443 | int beamx, beamy; |
| 444 | 444 | int i; |
| 445 | 445 | |
| r1293 | r1294 | |
| 452 | 452 | From this, it appears that they are expecting to get beams over |
| 453 | 453 | a 12 scanline period, and trying to pick roughly the middle one. |
| 454 | 454 | This is how it is implemented. */ |
| 455 | increment = mame_time_to_subseconds(video_screen_get_scan_period(0)); | |
| 456 | time = sub_mame_times(video_screen_get_time_until_pos(0, beamy, beamx), make_mame_time(0, increment * 6)); | |
| 455 | increment = attotime_to_attoseconds(video_screen_get_scan_period(0)); | |
| 456 | time = attotime_sub(video_screen_get_time_until_pos(0, beamy, beamx), attotime_make(0, increment * 6)); | |
| 457 | 457 | for (i = 0; i <= 12; i++) |
| 458 | 458 | { |
| 459 | mame_timer_set(time, beamx, beam_firq_callback); | |
| 460 | time = add_mame_times(time, make_mame_time(0, increment)); | |
| 459 | timer_set(time, beamx, beam_firq_callback); | |
| 460 | time = attotime_add(time, attotime_make(0, increment)); | |
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | } |
| r1293 | r1294 | |
|---|---|---|
| 119 | 119 | if (offset < 0x1000) |
| 120 | 120 | if (atarigen_playfield[offset] & 0x8000) |
| 121 | 121 | { |
| 122 | mame_time period_on; | |
| 123 | mame_time period_off; | |
| 122 | attotime period_on; | |
| 123 | attotime period_off; | |
| 124 | 124 | |
| 125 | 125 | /* fix me - the only thing this IRQ does it tweak the starting MO link */ |
| 126 | 126 | /* unfortunately, it does it too early for the given MOs! */ |
| r1293 | r1294 | |
| 132 | 132 | period_on = video_screen_get_time_until_pos(scrnum, video_screen_get_vpos(scrnum) + 7, machine->screen[scrnum].width * 0.9); |
| 133 | 133 | period_off = video_screen_get_time_until_pos(scrnum, video_screen_get_vpos(scrnum) + 8, machine->screen[scrnum].width * 0.9); |
| 134 | 134 | |
| 135 | mame_timer_set(period_on, 0, irq_on); | |
| 136 | mame_timer_set(period_off, 0, irq_off); | |
| 135 | timer_set(period_on, 0, irq_on); | |
| 136 | timer_set(period_off, 0, irq_off); | |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 |
| r1293 | r1294 | |
|---|---|---|
| 8 | 8 | UINT16 *roundup_r_ram, *roundup_p_ram, *roundup_l_ram; |
| 9 | 9 | UINT16 *cyclwarr_videoram, *cyclwarr_videoram2; |
| 10 | 10 | UINT16* tatsumi_sprite_control_ram; |
| 11 | UINT16* roundup5_vram; | |
| 11 | static UINT16* roundup5_vram; | |
| 12 | 12 | |
| 13 | 13 | /******************************************************************************/ |
| 14 | 14 |
| r1293 | r1294 | |
|---|---|---|
| 2991 | 2991 | } |
| 2992 | 2992 | |
| 2993 | 2993 | |
| 2994 | void K053245_chip_w(int chip,int offset,int data) | |
| 2994 | static void K053245_chip_w(int chip,int offset,int data) | |
| 2995 | 2995 | { |
| 2996 | 2996 | if(offset & 1) |
| 2997 | 2997 | K053245_ram[chip][offset>>1] = (K053245_ram[chip][offset>>1] & 0xff00) | data; |
| r1293 | r1294 | |
| 3021 | 3021 | memcpy(K053245_buffer[chip], K053245_ram[chip], K053245_ramsize[chip]); |
| 3022 | 3022 | } |
| 3023 | 3023 | |
| 3024 | UINT8 K053244_chip_r (int chip, int offset) | |
| 3024 | static UINT8 K053244_chip_r (int chip, int offset) | |
| 3025 | 3025 | { |
| 3026 | 3026 | if ((K053244_regs[chip][5] & 0x10) && offset >= 0x0c && offset < 0x10) |
| 3027 | 3027 | { |
| r1293 | r1294 | |
| 3053 | 3053 | return K053244_chip_r(0,offset); |
| 3054 | 3054 | } |
| 3055 | 3055 | |
| 3056 | void K053244_chip_w(int chip, int offset, int data) | |
| 3056 | static void K053244_chip_w(int chip, int offset, int data) | |
| 3057 | 3057 | { |
| 3058 | 3058 | K053244_regs[chip][offset] = data; |
| 3059 | 3059 | |
| r1293 | r1294 | |
| 4520 | 4520 | static TILE_GET_INFO( K051316_get_tile_info2 ) { K051316_get_tile_info(machine,tileinfo,tile_index,2); } |
| 4521 | 4521 | |
| 4522 | 4522 | |
| 4523 | void K051316_vh_start(running_machine *machine,int chip, int gfx_memory_region,int bpp, | |
| 4523 | static void K051316_vh_start(running_machine *machine,int chip, int gfx_memory_region,int bpp, | |
| 4524 | 4524 | int pen_is_mask,int transparent_pen, |
| 4525 | 4525 | void (*callback)(int *code,int *color,int *flags)) |
| 4526 | 4526 | { |
| r1293 | r1294 | |
| 4637 | 4637 | } |
| 4638 | 4638 | |
| 4639 | 4639 | |
| 4640 | int K051316_r(int chip, int offset) | |
| 4640 | static int K051316_r(int chip, int offset) | |
| 4641 | 4641 | { |
| 4642 | 4642 | return K051316_ram[chip][offset]; |
| 4643 | 4643 | } |
| r1293 | r1294 | |
| 4658 | 4658 | } |
| 4659 | 4659 | |
| 4660 | 4660 | |
| 4661 | void K051316_w(int chip,int offset,int data) | |
| 4661 | static void K051316_w(int chip,int offset,int data) | |
| 4662 | 4662 | { |
| 4663 | 4663 | K051316_ram[chip][offset] = data; |
| 4664 | 4664 | tilemap_mark_tile_dirty(K051316_tilemap[chip],offset & 0x3ff); |
| r1293 | r1294 | |
| 4680 | 4680 | } |
| 4681 | 4681 | |
| 4682 | 4682 | |
| 4683 | int K051316_rom_r(int chip, int offset) | |
| 4683 | static int K051316_rom_r(int chip, int offset) | |
| 4684 | 4684 | { |
| 4685 | 4685 | if ((K051316_ctrlram[chip][0x0e] & 0x01) == 0) |
| 4686 | 4686 | { |
| r1293 | r1294 | |
| 4718 | 4718 | |
| 4719 | 4719 | |
| 4720 | 4720 | |
| 4721 | void K051316_ctrl_w(int chip,int offset,int data) | |
| 4721 | static void K051316_ctrl_w(int chip,int offset,int data) | |
| 4722 | 4722 | { |
| 4723 | 4723 | K051316_ctrlram[chip][offset] = data; |
| 4724 | 4724 | //if (offset >= 0x0c) logerror("%04x: write %02x to 051316 reg %x\n",activecpu_get_pc(),data,offset); |
| r1293 | r1294 | |
| 4751 | 4751 | } |
| 4752 | 4752 | |
| 4753 | 4753 | |
| 4754 | void K051316_zoom_draw(int chip, mame_bitmap *bitmap,const rectangle *cliprect,int flags,UINT32 priority) | |
| 4754 | static void K051316_zoom_draw(int chip, mame_bitmap *bitmap,const rectangle *cliprect,int flags,UINT32 priority) | |
| 4755 | 4755 | { |
| 4756 | 4756 | UINT32 startx,starty; |
| 4757 | 4757 | int incxx,incxy,incyx,incyy; |
| r1293 | r1294 | |
| 5246 | 5246 | static UINT16 K056832_regsb[4]; // 157/832 regs group 2, board dependent |
| 5247 | 5247 | |
| 5248 | 5248 | static UINT8 *K056832_rombase; // pointer to tile gfx data |
| 5249 | UINT16 *K056832_videoram; | |
| 5249 | static UINT16 *K056832_videoram; | |
| 5250 | 5250 | static int K056832_NumGfxBanks; // depends on size of graphics ROMs |
| 5251 | 5251 | static int K056832_CurGfxBank; // cached info for K056832_regs[0x1a] |
| 5252 | 5252 | static int K056832_gfxnum; // graphics element index for unpacked tiles |
| r1293 | r1294 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | size_t gsword_spritexy_size; |
| 11 | 11 | |
| 12 | UINT8 *gsword_scrolly_ram; | |
| 12 | //UINT8 *gsword_scrolly_ram; | |
| 13 | 13 | UINT8 *gsword_spritexy_ram; |
| 14 | 14 | UINT8 *gsword_spritetile_ram; |
| 15 | 15 | UINT8 *gsword_spriteattrib_ram; |
| r1293 | r1294 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | #define CPK_VIDEO_SIZE 0x800 |
| 12 | 12 | |
| 13 | UINT8 * cpk_colorram; | |
| 14 | UINT8 * cpk_videoram; | |
| 15 | UINT8 * cpk_palette; | |
| 16 | UINT8 * cpk_palette2; | |
| 17 | UINT8 * cpk_expram; | |
| 13 | static UINT8 * cpk_colorram; | |
| 14 | static UINT8 * cpk_videoram; | |
| 15 | static UINT8 * cpk_palette; | |
| 16 | static UINT8 * cpk_palette2; | |
| 17 | static UINT8 * cpk_expram; | |
| 18 | 18 | |
| 19 | 19 | static UINT8 * dirtybuffer1; |
| 20 | 20 | static mame_bitmap *tmpbitmap2; |
| r1293 | r1294 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | UINT8 *momoko_bg_scrollx; |
| 14 | 14 | UINT8 *momoko_bg_scrolly; |
| 15 | UINT8 momoko_fg_scrollx; | |
| 16 | UINT8 momoko_fg_scrolly; | |
| 17 | UINT8 momoko_fg_select; | |
| 18 | UINT8 momoko_text_scrolly; | |
| 19 | UINT8 momoko_text_mode; | |
| 20 | UINT8 momoko_bg_select; | |
| 21 | UINT8 momoko_bg_priority; | |
| 22 | UINT8 momoko_bg_mask; | |
| 23 | UINT8 momoko_fg_mask; | |
| 24 | UINT8 momoko_flipscreen; | |
| 15 | static UINT8 momoko_fg_scrollx; | |
| 16 | static UINT8 momoko_fg_scrolly; | |
| 17 | static UINT8 momoko_fg_select; | |
| 18 | static UINT8 momoko_text_scrolly; | |
| 19 | static UINT8 momoko_text_mode; | |
| 20 | static UINT8 momoko_bg_select; | |
| 21 | static UINT8 momoko_bg_priority; | |
| 22 | static UINT8 momoko_bg_mask; | |
| 23 | static UINT8 momoko_fg_mask; | |
| 24 | static UINT8 momoko_flipscreen; | |
| 25 | 25 | |
| 26 | 26 | /****************************************************************************/ |
| 27 | 27 |
| r1293 | r1294 | |
|---|---|---|
| 48 | 48 | { |
| 49 | 49 | timer_value = 0; |
| 50 | 50 | |
| 51 | | |
| 51 | | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 |
| r1293 | r1294 | |
|---|---|---|
| 1067 | 1067 | |
| 1068 | 1068 | static void after(int cycles, void (*function)(running_machine *machine, int), const char *funcname) |
| 1069 | 1069 | { |
| 1070 | | |
| 1070 | | |
| 1071 | 1071 | (void)funcname; |
| 1072 | LOG((" after %3d (%5.1f us) %s\n", cycles, mame_time_to_double(duration) * 1.0e6, funcname)); | |
| 1073 | mame_timer_set(duration, 0, function); | |
| 1072 | LOG((" after %3d (%5.1f us) %s\n", cycles, attotime_to_double(duration) * 1.0e6, funcname)); | |
| 1073 | timer_set(duration, 0, function); | |
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | 1076 | static TIMER_CALLBACK( antic_issue_dli ) |
| r1293 | r1294 | |
|---|---|---|
| 378 | 378 | { |
| 379 | 379 | /* at the end of VBLANK is when automatic sprite rendering happens */ |
| 380 | 380 | if (!state) |
| 381 | | |
| 381 | | |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 |
| r1293 | r1294 | |
|---|---|---|
| 392 | 392 | /* sx and sy is top-left of entire sprite regardless of flip */ |
| 393 | 393 | /* Note that Level 5-4 of sbomberb boss is perfect! (Alpha blended zoomed) as well as S1945II logo */ |
| 394 | 394 | /* pixel is only plotted if z is >= priority_buffer[y][x] */ |
| 395 | void psikyosh_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx, | |
| 395 | static void psikyosh_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx, | |
| 396 | 396 | UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy, |
| 397 | 397 | const rectangle *clip,int transparency,int transparent_color, |
| 398 | 398 | int zoomx, int zoomy, int wide, int high, UINT32 z) |
| r1293 | r1294 | |
|---|---|---|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
| 73 | void pandora_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 73 | static void pandora_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 74 | 74 | { |
| 75 | 75 | |
| 76 | 76 | int sx=0, sy=0, x=0, y=0, offs; |
| r1293 | r1294 | |
|---|---|---|
| 618 | 618 | #if TAPE_UI_DISPLAY |
| 619 | 619 | if (tape_timer) |
| 620 | 620 | { |
| 621 | | |
| 621 | | |
| 622 | 622 | popmessage("%c%c [%05.1fs] %c%c", |
| 623 | 623 | (tape_dir < 0 && tape_speed) ? '<' : ' ', |
| 624 | 624 | (tape_dir < 0) ? '<' : ' ', |
| 625 | | |
| 625 | | |
| 626 | 626 | (tape_dir > 0) ? '>' : ' ', |
| 627 | 627 | (tape_dir > 0 && tape_speed) ? '>' : ' '); |
| 628 | 628 | } |
| r1293 | r1294 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | static UINT8 crtc_register; |
| 27 | 27 | static UINT8 crtc_data[0x10]; |
| 28 | static | |
| 28 | static | |
| 29 | 29 | |
| 30 | 30 | static UINT8 flipscreen_old = -1; |
| 31 | 31 | |
| r1293 | r1294 | |
| 90 | 90 | tilemap_set_transparent_pen(fg_tilemap,15); |
| 91 | 91 | |
| 92 | 92 | /* reset the timer */ |
| 93 | crtc_timer = | |
| 93 | crtc_timer = | |
| 94 | 94 | |
| 95 | 95 | scrollx_ofs = 0x159; |
| 96 | 96 | scrolly_ofs = 0x10; |
| r1293 | r1294 | |
| 129 | 129 | tilemap_set_transparent_pen(fg_tilemap,15); |
| 130 | 130 | |
| 131 | 131 | /* reset the timer */ |
| 132 | crtc_timer = | |
| 132 | crtc_timer = | |
| 133 | 133 | |
| 134 | 134 | scrollx_ofs = 0x159; |
| 135 | 135 | scrolly_ofs = 0x10; |
| r1293 | r1294 | |
| 294 | 294 | { |
| 295 | 295 | cpunum_set_input_line(1, 0, HOLD_LINE); |
| 296 | 296 | if (param != 0) |
| 297 | | |
| 297 | | |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | |
| r1293 | r1294 | |
| 306 | 306 | { |
| 307 | 307 | /* only register we know about.... */ |
| 308 | 308 | case 0x0b: |
| 309 | | |
| 309 | | |
| 310 | 310 | break; |
| 311 | 311 | |
| 312 | 312 | default: |
| r1293 | r1294 | |
|---|---|---|
| 30 | 30 | static UINT8 auto_animation_disabled; |
| 31 | 31 | static UINT8 auto_animation_counter; |
| 32 | 32 | static UINT8 auto_animation_frame_counter; |
| 33 | static | |
| 33 | static | |
| 34 | 34 | |
| 35 | static | |
| 35 | static | |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
| r1293 | r1294 | |
| 250 | 250 | else |
| 251 | 251 | auto_animation_frame_counter = auto_animation_frame_counter - 1; |
| 252 | 252 | |
| 253 | | |
| 253 | | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | |
| 257 | 257 | static void create_auto_animation_timer(void) |
| 258 | 258 | { |
| 259 | auto_animation_timer = | |
| 259 | auto_animation_timer = | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | |
| 263 | 263 | static void start_auto_animation_timer(void) |
| 264 | 264 | { |
| 265 | | |
| 265 | | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | |
| r1293 | r1294 | |
| 672 | 672 | /* let's come back at the beginning of the next line */ |
| 673 | 673 | scanline = (scanline + 1) % NEOGEO_VTOTAL; |
| 674 | 674 | |
| 675 | | |
| 675 | | |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | |
| 679 | 679 | static void create_sprite_line_timer(void) |
| 680 | 680 | { |
| 681 | sprite_line_timer = | |
| 681 | sprite_line_timer = | |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | |
| 685 | 685 | static void start_sprite_line_timer(void) |
| 686 | 686 | { |
| 687 | | |
| 687 | | |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 |
| r1293 | r1294 | |
|---|---|---|
| 73 | 73 | pen_t *colortable_mono; /* monochromatic color table modified at run time */ |
| 74 | 74 | UINT8 *dirtychar; /* an array flagging dirty characters */ |
| 75 | 75 | int chars_are_dirty; /* master flag to check if theres any dirty character */ |
| 76 | mame_timer *scanline_timer; /* scanline timer */ | |
| 77 | mame_timer *hblank_timer; /* hblank period at end of each scanline */ | |
| 78 | mame_timer *nmi_timer; /* NMI timer */ | |
| 76 | emu_timer *scanline_timer; /* scanline timer */ | |
| 77 | emu_timer *hblank_timer; /* hblank period at end of each scanline */ | |
| 78 | emu_timer *nmi_timer; /* NMI timer */ | |
| 79 | 79 | int scanline; /* scanline count */ |
| 80 | 80 | ppu2c0x_scanline_cb scanline_callback_proc; /* optional scanline callback */ |
| 81 | 81 | ppu2c0x_hblank_cb hblank_callback_proc; /* optional hblank callback */ |
| r1293 | r1294 | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /* initialize the scanline handling portion */ |
| 298 | chips[i].scanline_timer = mame_timer_alloc(scanline_callback); | |
| 299 | chips[i].hblank_timer = mame_timer_alloc(hblank_callback); | |
| 300 | chips[i].nmi_timer = mame_timer_alloc(nmi_callback); | |
| 298 | chips[i].scanline_timer = timer_alloc(scanline_callback); | |
| 299 | chips[i].hblank_timer = timer_alloc(hblank_callback); | |
| 300 | chips[i].nmi_timer = timer_alloc(nmi_callback); | |
| 301 | 301 | chips[i].scanline = 0; |
| 302 | 302 | chips[i].scan_scale = 1; |
| 303 | 303 | |
| r1293 | r1294 | |
| 363 | 363 | if (this_ppu->hblank_callback_proc) |
| 364 | 364 | (*this_ppu->hblank_callback_proc) (num, this_ppu->scanline, vblank, blanked); |
| 365 | 365 | |
| 366 | | |
| 366 | | |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | static TIMER_CALLBACK( nmi_callback ) |
| r1293 | r1294 | |
| 375 | 375 | if (intf->nmi_handler[num]) |
| 376 | 376 | (*intf->nmi_handler[num]) (num, ppu_regs); |
| 377 | 377 | |
| 378 | | |
| 378 | | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | static void draw_background(const int num, UINT8 *line_priority ) |
| r1293 | r1294 | |
| 871 | 871 | // a game can read the high bit of $2002 before the NMI is called (potentially resetting the bit |
| 872 | 872 | // via a read from $2002 in the NMI handler). |
| 873 | 873 | // B-Wings is an example game that needs this. |
| 874 | | |
| 874 | | |
| 875 | 875 | } |
| 876 | 876 | } |
| 877 | 877 | |
| r1293 | r1294 | |
| 922 | 922 | next_scanline = 0; |
| 923 | 923 | |
| 924 | 924 | // Call us back when the hblank starts for this scanline |
| 925 | | |
| 925 | | |
| 926 | 926 | |
| 927 | 927 | // trigger again at the start of the next scanline |
| 928 | | |
| 928 | | |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | /************************************* |
| r1293 | r1294 | |
| 950 | 950 | /* set the scan scale (this is for dual monitor vertical setups) */ |
| 951 | 951 | chips[num].scan_scale = scan_scale; |
| 952 | 952 | |
| 953 | | |
| 953 | | |
| 954 | 954 | |
| 955 | 955 | // Call us back when the hblank starts for this scanline |
| 956 | | |
| 956 | | |
| 957 | 957 | |
| 958 | 958 | // Call us back at the start of the next scanline |
| 959 | | |
| 959 | | |
| 960 | 960 | |
| 961 | 961 | /* reset the callbacks */ |
| 962 | 962 | chips[num].scanline_callback_proc = 0; |
| r1293 | r1294 | |
| 1489 | 1489 | this_ppu->mirror_state = mirroring; |
| 1490 | 1490 | } |
| 1491 | 1491 | |
| 1492 | #ifdef UNUSED_FUNCTION | |
| 1492 | 1493 | void ppu2c0x_set_nmi_callback( int num, ppu2c0x_nmi_cb cb ) |
| 1493 | 1494 | { |
| 1494 | 1495 | /* check bounds */ |
| r1293 | r1294 | |
| 1500 | 1501 | |
| 1501 | 1502 | intf->nmi_handler[num] = cb; |
| 1502 | 1503 | } |
| 1504 | #endif | |
| 1503 | 1505 | |
| 1504 | 1506 | void ppu2c0x_set_scanline_callback( int num, ppu2c0x_scanline_cb cb ) |
| 1505 | 1507 | { |
| r1293 | r1294 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | UINT8 *buggychl_scrollv,*buggychl_scrollh; |
| 7 | UINT8 buggychl_sprite_lookup[0x2000]; | |
| 7 | static UINT8 buggychl_sprite_lookup[0x2000]; | |
| 8 | 8 | UINT8 *buggychl_character_ram; |
| 9 | 9 | |
| 10 | 10 | static int *dirtychar; |
| r1293 | r1294 | |
|---|---|---|
| 8 | 8 | static int tilebanks[4]; |
| 9 | 9 | static int spritebanks[4]; |
| 10 | 10 | |
| 11 | void reset_spritebank(void) | |
| 11 | static void reset_spritebank(void) | |
| 12 | 12 | { |
| 13 | 13 | K053244_bankselect(0, spritebank & 7); |
| 14 | 14 | spritebanks[0] = (spritebank << 12) & 0x7000; |
| r1293 | r1294 | |
|---|---|---|
| 569 | 569 | cpunum_set_input_line(3,0,CLEAR_LINE); |
| 570 | 570 | |
| 571 | 571 | /* 2.assert /SINT again after this time */ |
| 572 | | |
| 572 | | |
| 573 | 573 | |
| 574 | 574 | /* 3.clear of /SINT starts sprite drawing circuit */ |
| 575 | 575 | draw_sprite(); |
| r1293 | r1294 | |
|---|---|---|
| 442 | 442 | |
| 443 | 443 | /* if we got one, trigger an interrupt */ |
| 444 | 444 | if ((collision_mask & exidy_collision_mask) && count++ < 128) |
| 445 | | |
| 445 | | |
| 446 | 446 | } |
| 447 | 447 | if (*BITMAP_ADDR16(motion_object_2_vid, sy, sx) != pen0) |
| 448 | 448 | { |
| 449 | 449 | /* check for background collision (M2CHAR) */ |
| 450 | 450 | if (*BITMAP_ADDR16(tmpbitmap, org_2_y + sy, org_2_x + sx) != pen0) |
| 451 | 451 | if ((exidy_collision_mask & 0x08) && count++ < 128) |
| 452 | | |
| 452 | | |
| 453 | 453 | } |
| 454 | 454 | } |
| 455 | 455 | } |
| r1293 | r1294 | |
|---|---|---|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | nb1413m3_busyflag = 0; |
| 229 | | |
| 229 | | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 |
| r1293 | r1294 | |
|---|---|---|
| 15 | 15 | static int layer_colorbase[4], layerpri[3]; |
| 16 | 16 | static int alpha_enabled; |
| 17 | 17 | |
| 18 | #ifdef UNUSED_FUNCTION | |
| 18 | 19 | void moo_set_alpha(int on) |
| 19 | 20 | { |
| 20 | 21 | alpha_enabled = on; |
| 21 | 22 | } |
| 23 | #endif | |
| 22 | 24 | |
| 23 | 25 | static void moo_sprite_callback(int *code, int *color, int *priority_mask) |
| 24 | 26 | { |
| r1293 | r1294 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | /* local variables */ |
| 16 | static | |
| 16 | static | |
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | |
| r1293 | r1294 | |
| 56 | 56 | int beamx, beamy; |
| 57 | 57 | |
| 58 | 58 | /* set a timer to do this again next frame */ |
| 59 | | |
| 59 | | |
| 60 | 60 | |
| 61 | 61 | /* only do work if the palette is flashed */ |
| 62 | 62 | if (!tickee_control[2]) |
| r1293 | r1294 | |
| 64 | 64 | |
| 65 | 65 | /* generate interrupts for player 1's gun */ |
| 66 | 66 | get_crosshair_xy(0, &beamx, &beamy); |
| 67 | mame_timer_set(video_screen_get_time_until_pos(0, beamy, beamx + 50), 0, trigger_gun_interrupt); | |
| 68 | mame_timer_set(video_screen_get_time_until_pos(0, beamy + 1, beamx + 50), 0, clear_gun_interrupt); | |
| 67 | timer_set(video_screen_get_time_until_pos(0, beamy, beamx + 50), 0, trigger_gun_interrupt); | |
| 68 | timer_set(video_screen_get_time_until_pos(0, beamy + 1, beamx + 50), 0, clear_gun_interrupt); | |
| 69 | 69 | |
| 70 | 70 | /* generate interrupts for player 2's gun */ |
| 71 | 71 | get_crosshair_xy(1, &beamx, &beamy); |
| 72 | mame_timer_set(video_screen_get_time_until_pos(0, beamy, beamx + 50), 1, trigger_gun_interrupt); | |
| 73 | mame_timer_set(video_screen_get_time_until_pos(0, beamy + 1, beamx + 50), 1, clear_gun_interrupt); | |
| 72 | timer_set(video_screen_get_time_until_pos(0, beamy, beamx + 50), 1, trigger_gun_interrupt); | |
| 73 | timer_set(video_screen_get_time_until_pos(0, beamy + 1, beamx + 50), 1, clear_gun_interrupt); | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| r1293 | r1294 | |
| 84 | 84 | VIDEO_START( tickee ) |
| 85 | 85 | { |
| 86 | 86 | /* start a timer going on the first scanline of every frame */ |
| 87 | setup_gun_timer = mame_timer_alloc(setup_gun_interrupts); | |
| 88 | mame_timer_adjust(setup_gun_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_zero); | |
| 87 | setup_gun_timer = timer_alloc(setup_gun_interrupts); | |
| 88 | timer_adjust(setup_gun_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_zero); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 |
| r1293 | r1294 | |
|---|---|---|
| 99 | 99 | /* Pixel clock is 26.6666 MHz, we have 0x800 bytes, or 0x400 words |
| 100 | 100 | to copy from spriteram to the buffer. It seems safe to assume 1 |
| 101 | 101 | word can be copied per clock.*/ |
| 102 | | |
| 102 | | |
| 103 | 103 | } |
| 104 | 104 | // logerror("%04x: m92_spritecontrol_w %08x %08x\n",activecpu_get_pc(),offset,data); |
| 105 | 105 | } |
| r1293 | r1294 | |
|---|---|---|
| 4 | 4 | static int homerun_gc_up,homerun_gc_down; |
| 5 | 5 | int homerun_xpa,homerun_xpb,homerun_xpc; |
| 6 | 6 | |
| 7 | tilemap *homerun_tilemap; | |
| 7 | static tilemap *homerun_tilemap; | |
| 8 | 8 | UINT8 *homerun_videoram; |
| 9 | 9 | |
| 10 | 10 | #define half_screen 116 |
| r1293 | r1294 | |
|---|---|---|
| 20 | 20 | static UINT16 vdp_accessaddr[CHIPS]; /* VDP Access Address */ |
| 21 | 21 | static UINT8 vdp_readbuffer[CHIPS]; /* VDP Read Buffer */ |
| 22 | 22 | |
| 23 | UINT8 *segae_vdp_vram[CHIPS]; /* Pointer to VRAM */ | |
| 23 | static UINT8 *segae_vdp_vram[CHIPS]; /* Pointer to VRAM */ | |
| 24 | 24 | static UINT8 *vdp_cram[CHIPS]; /* Pointer to the VDP's CRAM */ |
| 25 | 25 | UINT8 *segae_vdp_regs[CHIPS]; /* Pointer to the VDP's Registers */ |
| 26 | 26 | |
| 27 | UINT8 segae_vdp_vrambank[CHIPS]; /* Current VRAM Bank number (from writes to Port 0xf7) */ | |
| 27 | static UINT8 segae_vdp_vrambank[CHIPS]; /* Current VRAM Bank number (from writes to Port 0xf7) */ | |
| 28 | 28 | |
| 29 | 29 | static UINT8 *cache_bitmap; /* 8bpp bitmap with raw pen values */ |
| 30 | 30 | |
| r1293 | r1294 | |
| 42 | 42 | |
| 43 | 43 | static void draw_tiles_line(UINT8 *dest, int line, UINT8 chip, UINT8 pri); |
| 44 | 44 | static void draw_sprite_line(UINT8 *dest, UINT8 chip, UINT8 line); |
| 45 | void segae_drawscanline(int line, int chips, int blank); | |
| 45 | static void segae_drawscanline(int line, int chips, int blank); | |
| 46 | 46 | |
| 47 | 47 | static void draw_8pix_solid16(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col); |
| 48 | 48 | static void draw_8pix(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col); |
| r1293 | r1294 | |
|---|---|---|
| 273 | 273 | |
| 274 | 274 | /*****************************************************************************/ |
| 275 | 275 | |
| 276 | void m107_screenrefresh(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 276 | static void m107_screenrefresh(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 277 | 277 | { |
| 278 | 278 | if ((~m107_control[0x0b] >> 7) & 1) |
| 279 | 279 | { |
| r1293 | r1294 | |
|---|---|---|
| 679 | 679 | int priorities[16]; |
| 680 | 680 | }; |
| 681 | 681 | |
| 682 | int megasys1_layers_order[16]; | |
| 682 | static int megasys1_layers_order[16]; | |
| 683 | 683 | |
| 684 | 684 | /* |
| 685 | 685 | Layers order encoded as an int like: 0x01234, where |
| r1293 | r1294 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | UINT16 *crshrace_videoram1,*crshrace_videoram2; |
| 7 | UINT16 *crshrace_roz_ctrl1,*crshrace_roz_ctrl2; | |
| 7 | //UINT16 *crshrace_roz_ctrl1,*crshrace_roz_ctrl2; | |
| 8 | 8 | |
| 9 | 9 | static int roz_bank,gfxctrl,flipscreen; |
| 10 | 10 |
| r1293 | r1294 | |
|---|---|---|
| 34 | 34 | #include "kan_pand.h" |
| 35 | 35 | |
| 36 | 36 | UINT8 *airbustr_videoram2, *airbustr_colorram2; |
| 37 | int airbustr_clear_sprites; | |
| 37 | //int airbustr_clear_sprites; | |
| 38 | 38 | static tilemap *bg_tilemap, *fg_tilemap; |
| 39 | 39 | static mame_bitmap *sprites_bitmap; |
| 40 | 40 |
| r1293 | r1294 | |
|---|---|---|
| 32 | 32 | static UINT16 blitter_vidparam[32]; |
| 33 | 33 | |
| 34 | 34 | static mame_bitmap *dstbitmap; |
| 35 | static | |
| 35 | static | |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
| r1293 | r1294 | |
| 70 | 70 | if (blitter_vidparam[0x22/2] <= blitter_vidparam[0x1e/2]) |
| 71 | 71 | { |
| 72 | 72 | int effscan; |
| 73 | | |
| 73 | | |
| 74 | 74 | |
| 75 | 75 | /* compute the effective scanline of the interrupt */ |
| 76 | 76 | effscan = blitter_vidparam[0x22/2] - blitter_vidparam[0x1a/2]; |
| r1293 | r1294 | |
| 79 | 79 | |
| 80 | 80 | /* determine the time; if it's in this scanline, bump to the next frame */ |
| 81 | 81 | time = video_screen_get_time_until_pos(0, effscan, 0); |
| 82 | if (compare_mame_times(time, video_screen_get_scan_period(0)) < 0) | |
| 83 | time = add_mame_times(time, video_screen_get_frame_period(0)); | |
| 84 | mame_timer_adjust(blitter_timer, time, 0, time_zero); | |
| 82 | if (attotime_compare(time, video_screen_get_scan_period(0)) < 0) | |
| 83 | time = attotime_add(time, video_screen_get_frame_period(0)); | |
| 84 | timer_adjust(blitter_timer, time, 0, attotime_zero); | |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| r1293 | r1294 | |
| 111 | 111 | dstbitmap = auto_bitmap_alloc(DSTBITMAP_WIDTH, DSTBITMAP_HEIGHT, machine->screen[0].format); |
| 112 | 112 | |
| 113 | 113 | /* create a timer */ |
| 114 | blitter_timer = | |
| 114 | blitter_timer = | |
| 115 | 115 | |
| 116 | 116 | /* register for saving */ |
| 117 | 117 | state_save_register_global_array(blitter_color); |
| r1293 | r1294 | |
| 162 | 162 | memset(BITMAP_ADDR16(dstbitmap, y % DSTBITMAP_HEIGHT, 0), 0, DSTBITMAP_WIDTH * 2); |
| 163 | 163 | |
| 164 | 164 | /* signal an IRQ when done (timing is just a guess) */ |
| 165 | | |
| 165 | | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
| r1293 | r1294 | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /* signal an IRQ when done (timing is just a guess) */ |
| 219 | | |
| 219 | | |
| 220 | 220 | |
| 221 | 221 | /* these extra parameters are written but they are always zero, so I don't know what they do */ |
| 222 | 222 | if (blitter_xparam[8] != 0 || blitter_xparam[9] != 0 || blitter_xparam[10] != 0 || blitter_xparam[11] != 0 || |
| r1293 | r1294 | |
|---|---|---|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | TILE_GET_INFO( sailormn_get_tile_info_2 ) | |
| 288 | static TILE_GET_INFO( sailormn_get_tile_info_2 ) | |
| 289 | 289 | { |
| 290 | 290 | UINT32 code, color, pri; |
| 291 | 291 | |
| r1293 | r1294 | |
| 1391 | 1391 | } |
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | void cave_tilemap_0_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) | |
| 1394 | static void cave_tilemap_0_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) | |
| 1395 | 1395 | { cave_tilemap_draw( bitmap, cliprect, tilemap_0, cave_vram_0, cave_vctrl_0, flags, priority, priority2 ); } |
| 1396 | void cave_tilemap_1_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) | |
| 1396 | static void cave_tilemap_1_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) | |
| 1397 | 1397 | { cave_tilemap_draw( bitmap, cliprect, tilemap_1, cave_vram_1, cave_vctrl_1, flags, priority, priority2 ); } |
| 1398 | void cave_tilemap_2_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) | |
| 1398 | static void cave_tilemap_2_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) | |
| 1399 | 1399 | { cave_tilemap_draw( bitmap, cliprect, tilemap_2, cave_vram_2, cave_vctrl_2, flags, priority, priority2 ); } |
| 1400 | void cave_tilemap_3_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) | |
| 1400 | static void cave_tilemap_3_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 ) | |
| 1401 | 1401 | { cave_tilemap_draw( bitmap, cliprect, tilemap_3, cave_vram_3, cave_vctrl_3, flags, priority, priority2 ); } |
| 1402 | 1402 | |
| 1403 | 1403 |
| r1293 | r1294 | |
|---|---|---|
| 7 | 7 | #include "driver.h" |
| 8 | 8 | |
| 9 | 9 | |
| 10 | UINT8 *brkthru_scroll; | |
| 10 | //UINT8 *brkthru_scroll; | |
| 11 | 11 | UINT8 *brkthru_videoram; |
| 12 | 12 | size_t brkthru_videoram_size; |
| 13 | 13 | static int bgscroll; |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | static int bg_enable = 1; |
| 17 | 17 | static int sp_overdraw = 0; |
| 18 | 18 | |
| 19 | void mnight_mark_background_dirty(void) | |
| 19 | static void mnight_mark_background_dirty(void) | |
| 20 | 20 | { |
| 21 | 21 | /* set 1024 bytes allocated in VIDEO_START( mnight ) to 'true' */ |
| 22 | 22 | memset(bg_dirtybuffer,1,1024); |
| r1293 | r1294 | |
|---|---|---|
| 14 | 14 | void megaplay_start_video_normal(running_machine *machine); |
| 15 | 15 | void megaplay_update_video_normal(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ); |
| 16 | 16 | |
| 17 | int genesis_screen_number; | |
| 17 | static int genesis_screen_number; | |
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | /****************************************************************************** |
| r1293 | r1294 | |
| 125 | 125 | ******************************************************************************/ |
| 126 | 126 | |
| 127 | 127 | |
| 128 | void start_genesis_vdp(int screen_number) | |
| 128 | static void start_genesis_vdp(int screen_number) | |
| 129 | 129 | { |
| 130 | 130 | static const UINT8 vdp_init[24] = |
| 131 | 131 | { |
| r1293 | r1294 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | static UINT16 videoflags; |
| 31 | 31 | static UINT8 crtc_register; |
| 32 | static | |
| 32 | static | |
| 33 | 33 | static UINT8 bins, gins; |
| 34 | 34 | |
| 35 | 35 | |
| r1293 | r1294 | |
| 78 | 78 | { |
| 79 | 79 | cpunum_set_input_line(0, 1, HOLD_LINE); |
| 80 | 80 | if (param != 0) |
| 81 | | |
| 81 | | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
| r1293 | r1294 | |
| 95 | 95 | memset(rpunch_bitmapram, 0xff, rpunch_bitmapram_size); |
| 96 | 96 | |
| 97 | 97 | /* reset the timer */ |
| 98 | crtc_timer = | |
| 98 | crtc_timer = | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
| r1293 | r1294 | |
| 164 | 164 | { |
| 165 | 165 | /* only register we know about.... */ |
| 166 | 166 | case 0x0b: |
| 167 | | |
| 167 | | |
| 168 | 168 | break; |
| 169 | 169 | |
| 170 | 170 | default: |
| r1293 | r1294 | |
|---|---|---|
| 33 | 33 | |
| 34 | 34 | static mame_bitmap *obj0_bitmap, *river_bitmap, *tree0_bitmap, *tree1_bitmap; |
| 35 | 35 | |
| 36 | static | |
| 36 | static | |
| 37 | 37 | static TIMER_CALLBACK( changela_scanline_callback ); |
| 38 | 38 | |
| 39 | 39 | VIDEO_START( changela ) |
| r1293 | r1294 | |
| 46 | 46 | tree0_bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); |
| 47 | 47 | tree1_bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); |
| 48 | 48 | |
| 49 | changela_scanline_timer = mame_timer_alloc(changela_scanline_callback); | |
| 50 | mame_timer_adjust(changela_scanline_timer, video_screen_get_time_until_pos(0, 30, 0), 30, time_zero); | |
| 49 | changela_scanline_timer = timer_alloc(changela_scanline_callback); | |
| 50 | timer_adjust(changela_scanline_timer, video_screen_get_time_until_pos(0, 30, 0), 30, attotime_zero); | |
| 51 | 51 | |
| 52 | 52 | state_save_register_global(slopeROM_bank); |
| 53 | 53 | state_save_register_global(tree_en); |
| r1293 | r1294 | |
| 737 | 737 | |
| 738 | 738 | sy++; |
| 739 | 739 | if(sy > 256) sy = 30; |
| 740 | | |
| 740 | | |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | VIDEO_UPDATE( changela ) |
| r1293 | r1294 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | /**********************************************************/ |
| 8 | 8 | |
| 9 | void asuka_core_video_start(running_machine *machine, int x_offs,int buffering) | |
| 9 | static void asuka_core_video_start(running_machine *machine, int x_offs,int buffering) | |
| 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); |
| r1293 | r1294 | |
|---|---|---|
| 129 | 129 | |
| 130 | 130 | if (hit_line != 999 && hit_code != 999) |
| 131 | 131 | { |
| 132 | | |
| 132 | | |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 |
| r1293 | r1294 | |
|---|---|---|
| 143 | 143 | bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, |
| 144 | 144 | TILEMAP_TYPE_PEN, 8, 8, 32, 32); |
| 145 | 145 | |
| 146 | | |
| 146 | | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) |
| r1293 | r1294 | |
|---|---|---|
| 87 | 87 | /* |
| 88 | 88 | Globals |
| 89 | 89 | */ |
| 90 | UINT8 bank[4]; | |
| 91 | UINT8 *work_ram; | |
| 92 | UINT8 *video_ram; | |
| 93 | UINT8 h_scroll; | |
| 94 | UINT8 v_scroll; | |
| 95 | UINT8 flip_8; | |
| 96 | UINT8 flip_22; | |
| 90 | static UINT8 bank[4]; | |
| 91 | static UINT8 *work_ram; | |
| 92 | static UINT8 *video_ram; | |
| 93 | static UINT8 h_scroll; | |
| 94 | static UINT8 v_scroll; | |
| 95 | static UINT8 flip_8; | |
| 96 | static UINT8 flip_22; | |
| 97 | 97 | |
| 98 | 98 | /* UART source/sinks */ |
| 99 | UINT8 z80_m6809_line; | |
| 100 | UINT8 m6809_z80_line; | |
| 101 | UINT8 data_r; | |
| 102 | UINT8 data_t; | |
| 99 | static UINT8 z80_m6809_line; | |
| 100 | static UINT8 m6809_z80_line; | |
| 101 | static UINT8 data_r; | |
| 102 | static UINT8 data_t; | |
| 103 | 103 | |
| 104 | int irq_state; | |
| 105 | int acia_irq; | |
| 106 | int vblank_irq; | |
| 107 | int blitter_irq; | |
| 104 | static int irq_state; | |
| 105 | static int acia_irq; | |
| 106 | static int vblank_irq; | |
| 107 | static int blitter_irq; | |
| 108 | 108 | |
| 109 | UINT8 z80_int; | |
| 110 | UINT8 z80_inten; | |
| 109 | static UINT8 z80_int; | |
| 110 | static UINT8 z80_inten; | |
| 111 | 111 | |
| 112 | 112 | /* EM and lamps stuff */ |
| 113 | UINT32 meter_latch; | |
| 114 | UINT32 mux_input; | |
| 115 | UINT32 mux_outputlatch; | |
| 113 | static UINT32 meter_latch; | |
| 114 | static UINT32 mux_input; | |
| 115 | static UINT32 mux_outputlatch; | |
| 116 | 116 | |
| 117 | 117 | /* |
| 118 | 118 | Function prototypes |
| r1293 | r1294 | |
| 190 | 190 | /* |
| 191 | 191 | Blitter state |
| 192 | 192 | */ |
| 193 | struct | |
| 193 | static struct | |
| 194 | 194 | { |
| 195 | 195 | ADDR_REG program; |
| 196 | 196 | |
| r1293 | r1294 | |
| 212 | 212 | /* |
| 213 | 213 | MUSIC Semiconductor TR9C1710 RAMDAC or equivalent |
| 214 | 214 | */ |
| 215 | struct | |
| 215 | static struct | |
| 216 | 216 | { |
| 217 | 217 | UINT8 addr_w; |
| 218 | 218 | UINT8 addr_r; |
| r1293 | r1294 | |
| 290 | 290 | The Flare One blitter is a simpler design with slightly different parameters |
| 291 | 291 | and will require hardware tests to figure everything out correctly. |
| 292 | 292 | */ |
| 293 | void RunBlit(void) | |
| 293 | static void RunBlit(void) | |
| 294 | 294 | { |
| 295 | 295 | #define BLITPRG_READ(x) blitter.x = *(blitter_get_addr(blitter.program.addr++)) |
| 296 | 296 | |
| r1293 | r1294 | |
| 788 | 788 | |
| 789 | 789 | ***************************************************************************/ |
| 790 | 790 | |
| 791 | void command_phase(UINT8 data); | |
| 792 | void exec_w_phase(UINT8 data); | |
| 793 | UINT8 exec_r_phase(void); | |
| 791 | static void command_phase(UINT8 data); | |
| 792 | static void exec_w_phase(UINT8 data); | |
| 793 | //UINT8 exec_r_phase(void); | |
| 794 | 794 | |
| 795 | 795 | /* |
| 796 | 796 | WD37C656C-PL (or equivalent) Floppy Disk Controller |
| r1293 | r1294 | |
| 823 | 823 | SCAN_HIGH_OR_EQUAL = 29 |
| 824 | 824 | }; |
| 825 | 825 | |
| 826 | struct | |
| 826 | static struct | |
| 827 | 827 | { |
| 828 | 828 | UINT8 MSR; |
| 829 | 829 | |
| r1293 | r1294 | |
| 848 | 848 | } fdc; |
| 849 | 849 | |
| 850 | 850 | |
| 851 | void reset_fdc(void) | |
| 851 | static void reset_fdc(void) | |
| 852 | 852 | { |
| 853 | 853 | memset(&fdc, 0, sizeof(fdc)); |
| 854 | 854 | |
| r1293 | r1294 | |
| 958 | 958 | } |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | void command_phase(UINT8 data) | |
| 961 | static void command_phase(UINT8 data) | |
| 962 | 962 | { |
| 963 | 963 | if (fdc.cmd_cnt == 0) |
| 964 | 964 | { |
| r1293 | r1294 | |
| 1039 | 1039 | } |
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | #ifdef UNUSED_FUNCTION | |
| 1042 | 1043 | UINT8 exec_r_phase(void) |
| 1043 | 1044 | { |
| 1044 | 1045 | return 0; |
| 1045 | 1046 | } |
| 1047 | #endif | |
| 1046 | 1048 | |
| 1047 | void exec_w_phase(UINT8 data) | |
| 1049 | static void exec_w_phase(UINT8 data) | |
| 1048 | 1050 | { |
| 1049 | 1051 | } |
| 1050 | 1052 | |
| 1053 | #ifdef UNUSED_FUNCTION | |
| 1051 | 1054 | UINT8 results_phase(void) |
| 1052 | 1055 | { |
| 1053 | 1056 | return 0; |
| 1054 | 1057 | } |
| 1055 | 1058 | |
| 1056 | #ifdef UNUSED_FUNCTION | |
| 1057 | 1059 | WRITE8_HANDLER( fd_op_w ) |
| 1058 | 1060 | { |
| 1059 | 1061 | } |
| r1293 | r1294 | |
| 1224 | 1226 | AM_RANGE(0xf000, 0xf000) AM_WRITE(MWA8_NOP) /* Watchdog */ |
| 1225 | 1227 | ADDRESS_MAP_END |
| 1226 | 1228 | |
| 1227 | INPUT_PORTS_START( bfcobra ) | |
| 1229 | static INPUT_PORTS_START( bfcobra ) | |
| 1228 | 1230 | PORT_START_TAG("STROBE0") |
| 1229 | 1231 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_NAME("Coin: 10p") |
| 1230 | 1232 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_NAME("Coin: 20p") |
| r1293 | r1294 | |
| 1331 | 1333 | /* |
| 1332 | 1334 | Allocate work RAM and video RAM shared by the Z80 and chipset. |
| 1333 | 1335 | */ |
| 1334 | static i | |
| 1336 | static void | |
| 1335 | 1337 | { |
| 1336 | 1338 | /* 768kB work RAM */ |
| 1337 | 1339 | work_ram = auto_malloc(0xC0000); |
| 1338 | 1340 | |
| 1339 | if (!work_ram) | |
| 1340 | goto startfailed; | |
| 1341 | ||
| 1342 | 1341 | /* 128kB video RAM */ |
| 1343 | 1342 | video_ram = auto_malloc(0x20000); |
| 1344 | 1343 | |
| 1345 | if (!video_ram) | |
| 1346 | goto startfailed; | |
| 1347 | ||
| 1348 | 1344 | memset(work_ram, 0, 0xc0000); |
| 1349 | 1345 | memset(video_ram, 0, 0x20000); |
| 1350 | ||
| 1351 | return 0; | |
| 1352 | ||
| 1353 | startfailed: | |
| 1354 | return 1; | |
| 1355 | 1346 | } |
| 1356 | 1347 | |
| 1357 | 1348 | static void z80_acia_irq(int state) |
| r1293 | r1294 | |
| 1419 | 1410 | UINT8 *rom; |
| 1420 | 1411 | UINT8 *tmp; |
| 1421 | 1412 | |
| 1422 | tmp = malloc(0x8000); | |
| 1413 | tmp = malloc_or_die(0x8000); | |
| 1423 | 1414 | rom = memory_region(REGION_CPU2) + 0x8000; |
| 1424 | 1415 | memcpy(tmp, rom, 0x8000); |
| 1425 | 1416 |
| r1293 | r1294 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | static UINT8* mgolf_video_ram; |
| 10 | 10 | |
| 11 | static mame_time time_pushed; | |
| 12 | static mame_time time_released; | |
| 11 | static attotime time_pushed; | |
| 12 | static attotime time_released; | |
| 13 | 13 | |
| 14 | 14 | static UINT8 prev = 0; |
| 15 | 15 | static UINT8 mask = 0; |
| r1293 | r1294 | |
| 78 | 78 | { |
| 79 | 79 | if (val == 0) |
| 80 | 80 | { |
| 81 | time_released = | |
| 81 | time_released = | |
| 82 | 82 | |
| 83 | 83 | if (!mask) |
| 84 | 84 | { |
| r1293 | r1294 | |
| 87 | 87 | } |
| 88 | 88 | else |
| 89 | 89 | { |
| 90 | time_pushed = | |
| 90 | time_pushed = | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | prev = val; |
| r1293 | r1294 | |
| 110 | 110 | scanline = 16; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | | |
| 113 | | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | static double calc_plunger_pos(void) |
| 118 | 118 | { |
| 119 | return ( | |
| 119 | return ( | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | static MACHINE_RESET( mgolf ) |
| 124 | 124 | { |
| 125 | | |
| 125 | | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 |
| r1293 | r1294 | |
|---|---|---|
| 109 | 109 | |
| 110 | 110 | extern UINT32 *mlc_vram, *mlc_clip_ram; |
| 111 | 111 | static UINT32 *mlc_ram, *irq_ram; |
| 112 | static | |
| 112 | static | |
| 113 | 113 | static int mainCpuIsArm=1; |
| 114 | int mlc_raster_table[9][256]; | |
| 114 | static int mlc_raster_table[9][256]; | |
| 115 | 115 | |
| 116 | 116 | /***************************************************************************/ |
| 117 | 117 | |
| r1293 | r1294 | |
| 221 | 221 | return; |
| 222 | 222 | break; |
| 223 | 223 | case 0x14: /* Prepare scanline interrupt */ |
| 224 | | |
| 224 | | |
| 225 | 225 | //logerror("prepare scanline to fire at %d (currently on %d)\n", irq_ram[0x14/4], video_screen_get_vpos(0)); |
| 226 | 226 | return; |
| 227 | 227 | break; |
| r1293 | r1294 | |
| 422 | 422 | |
| 423 | 423 | static MACHINE_RESET( mlc ) |
| 424 | 424 | { |
| 425 | raster_irq_timer = | |
| 425 | raster_irq_timer = | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | static struct YMZ280Binterface ymz280b_intf = |
| r1293 | r1294 | |
|---|---|---|
| 249 | 249 | { |
| 250 | 250 | int PD=(data>>8)&0xff; |
| 251 | 251 | int TCV=program_read_dword_32le(0x01801404); |
| 252 | | |
| 252 | | |
| 253 | 253 | |
| 254 | 254 | if(Timer0ctrl&2) |
| 255 | | |
| 255 | | |
| 256 | 256 | else |
| 257 | | |
| 257 | | |
| 258 | 258 | } |
| 259 | 259 | COMBINE_DATA(&Timer0ctrl); |
| 260 | 260 | } |
| r1293 | r1294 | |
| 277 | 277 | { |
| 278 | 278 | int PD=(data>>8)&0xff; |
| 279 | 279 | int TCV=program_read_dword_32le(0x0180140C); |
| 280 | | |
| 280 | | |
| 281 | 281 | |
| 282 | 282 | if(Timer1ctrl&2) |
| 283 | | |
| 283 | | |
| 284 | 284 | else |
| 285 | | |
| 285 | | |
| 286 | 286 | } |
| 287 | 287 | COMBINE_DATA(&Timer1ctrl); |
| 288 | 288 | } |
| r1293 | r1294 | |
| 305 | 305 | { |
| 306 | 306 | int PD=(data>>8)&0xff; |
| 307 | 307 | int TCV=program_read_dword_32le(0x01801414); |
| 308 | | |
| 308 | | |
| 309 | 309 | |
| 310 | 310 | if(Timer2ctrl&2) |
| 311 | | |
| 311 | | |
| 312 | 312 | else |
| 313 | | |
| 313 | | |
| 314 | 314 | } |
| 315 | 315 | COMBINE_DATA(&Timer2ctrl); |
| 316 | 316 | } |
| r1293 | r1294 | |
| 333 | 333 | { |
| 334 | 334 | int PD=(data>>8)&0xff; |
| 335 | 335 | int TCV=program_read_dword_32le(0x0180141C); |
| 336 | | |
| 336 | | |
| 337 | 337 | |
| 338 | 338 | if(Timer3ctrl&2) |
| 339 | | |
| 339 | | |
| 340 | 340 | else |
| 341 | | |
| 341 | | |
| 342 | 342 | } |
| 343 | 343 | COMBINE_DATA(&Timer3ctrl); |
| 344 | 344 | } |
| r1293 | r1294 | |
| 593 | 593 | Timer2ctrl=0; |
| 594 | 594 | Timer3ctrl=0; |
| 595 | 595 | |
| 596 | Timer0=mame_timer_alloc(Timer0cb); | |
| 597 | mame_timer_adjust(Timer0,time_never,0,time_never); | |
| 596 | Timer0=timer_alloc(Timer0cb); | |
| 597 | timer_adjust(Timer0,attotime_never,0,attotime_never); | |
| 598 | 598 | |
| 599 | Timer1=mame_timer_alloc(Timer1cb); | |
| 600 | mame_timer_adjust(Timer1,time_never,0,time_never); | |
| 599 | Timer1=timer_alloc(Timer1cb); | |
| 600 | timer_adjust(Timer1,attotime_never,0,attotime_never); | |
| 601 | 601 | |
| 602 | Timer2=mame_timer_alloc(Timer2cb); | |
| 603 | mame_timer_adjust(Timer2,time_never,0,time_never); | |
| 602 | Timer2=timer_alloc(Timer2cb); | |
| 603 | timer_adjust(Timer2,attotime_never,0,attotime_never); | |
| 604 | 604 | |
| 605 | Timer3=mame_timer_alloc(Timer3cb); | |
| 606 | mame_timer_adjust(Timer3,time_never,0,time_never); | |
| 605 | Timer3=timer_alloc(Timer3cb); | |
| 606 | timer_adjust(Timer3,attotime_never,0,attotime_never); | |
| 607 | 607 | |
| 608 | 608 | VR0_Snd_Set_Areas(textureram,frameram); |
| 609 | 609 | #ifdef IDLE_LOOP_SPEEDUP |
| r1293 | r1294 | |
|---|---|---|
| 293 | 293 | #define TEMPEST_BUTTONS_P2_TAG ("BUTTONSP2") |
| 294 | 294 | |
| 295 | 295 | |
| 296 | UINT8 tempest_player_select; | |
| 296 | static UINT8 tempest_player_select; | |
| 297 | 297 | |
| 298 | 298 | /************************************* |
| 299 | 299 | * |
| r1293 | r1294 | |
| 584 | 584 | MDRV_CPU_ADD(M6502, MASTER_CLOCK / 8) |
| 585 | 585 | MDRV_CPU_PROGRAM_MAP(main_map, 0) |
| 586 | 586 | MDRV_CPU_PERIODIC_INT(irq0_line_assert, (double)MASTER_CLOCK / 4096 / 12) |
| 587 | MDRV_WATCHDOG_TIME_INIT( | |
| 587 | MDRV_WATCHDOG_TIME_INIT( | |
| 588 | 588 | MDRV_SCREEN_REFRESH_RATE(60) |
| 589 | 589 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| 590 | 590 | MDRV_NVRAM_HANDLER(atari_vg) |
| r1293 | r1294 | |
|---|---|---|
| 462 | 462 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) // output: select read or write shared RAM |
| 463 | 463 | |
| 464 | 464 | PORT_START_TAG("DSW0") |
| 465 | PORT_DIPNAME( 0x05, 0x04, "Mode" ) | |
| 465 | PORT_DIPNAME( 0x05, 0x04, "Mode" ) PORT_DIPLOCATION("DSW-A:1,3") | |
| 466 | 466 | PORT_DIPSETTING( 0x04, "Game, English" ) |
| 467 | 467 | PORT_DIPSETTING( 0x05, "Game, Japanese" ) |
| 468 | 468 | PORT_DIPSETTING( 0x01, "Test (Grid and Inputs)" ) |
| 469 | PORT_DIPSETTING( 0x00, "Test (RAM and Sound)" ) | |
| 470 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) | |
| 469 | PORT_DIPSETTING( 0x00, "Test (RAM and Sound)/Pause" ) | |
| 470 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("DSW-A:2") | |
| 471 | 471 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 472 | 472 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 473 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) | |
| 473 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSW-A:4") | |
| 474 | 474 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 475 | 475 | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 476 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) | |
| 476 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DSW-A:5,6") | |
| 477 | 477 | PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) |
| 478 | 478 | PORT_DIPSETTING( 0x30, DEF_STR( 1C_1C ) ) |
| 479 | 479 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) ) |
| 480 | 480 | PORT_DIPSETTING( 0x20, DEF_STR( 1C_2C ) ) |
| 481 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) | |
| 481 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("DSW-A:7,8") | |
| 482 | 482 | PORT_DIPSETTING( 0x40, DEF_STR( 2C_1C ) ) |
| 483 | 483 | PORT_DIPSETTING( 0xc0, DEF_STR( 1C_1C ) ) |
| 484 | 484 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) ) |
| 485 | 485 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_2C ) ) |
| 486 | 486 | |
| 487 | 487 | PORT_START_TAG("DSW1") |
| 488 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) | |
| 488 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSW-B:1,2") | |
| 489 | 489 | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 490 | 490 | PORT_DIPSETTING( 0x03, DEF_STR( Normal ) ) |
| 491 | 491 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 492 | 492 | PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) ) |
| 493 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) | |
| 493 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("DSW-B:3,4") | |
| 494 | 494 | PORT_DIPSETTING( 0x08, "20K 80K 300K" ) |
| 495 | 495 | PORT_DIPSETTING( 0x0c, "30K 100K 400K" ) |
| 496 | 496 | PORT_DIPSETTING( 0x04, "40K 200K 500K" ) |
| 497 | 497 | PORT_DIPSETTING( 0x00, "50K 250K 500K" ) |
| 498 | 498 | // then more bonus lives at 1M 2M 3M 4M 5M - for all dip switch settings |
| 499 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) | |
| 499 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW-B:5,6") | |
| 500 | 500 | PORT_DIPSETTING( 0x10, "1" ) |
| 501 | 501 | PORT_DIPSETTING( 0x00, "2" ) |
| 502 | 502 | PORT_DIPSETTING( 0x30, "3" ) |
| 503 | 503 | PORT_DIPSETTING( 0x20, "5" ) |
| 504 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) // must be off (see notes) | |
| 505 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 504 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW-B:7") | |
| 505 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) // must be off (see notes) | |
| 506 | 506 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 507 | PORT_DIPNAME( 0x80, 0x80, "ROM Type" ) // will hang on startup if set to wrong type | |
| 508 | PORT_DIPSETTING( 0x80, "IC52=512kb, IC53=none" ) | |
| 507 | PORT_DIPNAME( 0x80, 0x80, "ROM Type" ) PORT_DIPLOCATION("DSW-B:8") | |
| 508 | PORT_DIPSETTING( 0x80, "IC52=512kb, IC53=none" ) // will hang on startup if set to wrong type | |
| 509 | 509 | PORT_DIPSETTING( 0x00, "IC52=256kb, IC53=256kb" ) |
| 510 | 510 | |
| 511 | 511 | PORT_START_TAG("IN1") |
| r1293 | r1294 | |
| 616 | 616 | |
| 617 | 617 | static INPUT_PORTS_START( tokio ) |
| 618 | 618 | PORT_START_TAG("DSW0") |
| 619 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) | |
| 619 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW A:1") | |
| 620 | 620 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 621 | 621 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| 622 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) | |
| 622 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW A:2") | |
| 623 | 623 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 624 | 624 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 625 | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) | |
| 626 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) | |
| 625 | PORT_SERVICE_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW A:3" ) | |
| 626 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW A:4") | |
| 627 | 627 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 628 | 628 | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 629 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) | |
| 629 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW A:5,6") | |
| 630 | 630 | PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) |
| 631 | 631 | PORT_DIPSETTING( 0x30, DEF_STR( 1C_1C ) ) |
| 632 | 632 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) ) |
| 633 | 633 | PORT_DIPSETTING( 0x20, DEF_STR( 1C_2C ) ) |
| 634 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) | |
| 634 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW A:7,8") | |
| 635 | 635 | PORT_DIPSETTING( 0x40, DEF_STR( 2C_1C ) ) |
| 636 | 636 | PORT_DIPSETTING( 0xc0, DEF_STR( 1C_1C ) ) |
| 637 | 637 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) ) |
| 638 | 638 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_2C ) ) |
| 639 | 639 | |
| 640 | 640 | PORT_START_TAG("DSW1") |
| 641 | PORT_DIPNAME( 0x01, 0x0 | |
| 641 | PORT_DIPNAME( 0x01, 0x00, "Enemies" ) PORT_DIPLOCATION("SW B:1") | |
| 642 | 642 | PORT_DIPSETTING( 0x01, "Few (Easy)" ) |
| 643 | 643 | PORT_DIPSETTING( 0x00, "Many (Hard)" ) |
| 644 | PORT_DIPNAME( 0x02, 0x02, "Enemy Shots" ) | |
| 644 | PORT_DIPNAME( 0x02, 0x02, "Enemy Shots" ) PORT_DIPLOCATION("SW B:2") | |
| 645 | 645 | PORT_DIPSETTING( 0x02, "Few (Easy)" ) |
| 646 | 646 | PORT_DIPSETTING( 0x00, "Many (Hard)" ) |
| 647 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) | |
| 647 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW B:3,4") | |
| 648 | 648 | PORT_DIPSETTING( 0x0c, "100K 400K" ) |
| 649 | 649 | PORT_DIPSETTING( 0x08, "200K 400K" ) |
| 650 | 650 | PORT_DIPSETTING( 0x04, "300K 400K" ) |
| 651 | 651 | PORT_DIPSETTING( 0x00, "400K 400K" ) |
| 652 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) | |
| 652 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW B:5,6") | |
| 653 | 653 | PORT_DIPSETTING( 0x30, "3" ) |
| 654 | 654 | PORT_DIPSETTING( 0x20, "4" ) |
| 655 | 655 | PORT_DIPSETTING( 0x10, "5" ) |
| 656 | 656 | PORT_DIPSETTING( 0x00, "99 (Cheat)") // 6 in original version |
| 657 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) | |
| 658 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) ) | |
| 657 | PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW B:7" ) | |
| 658 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW B:8") | |
| 659 | 659 | PORT_DIPSETTING( 0x00, DEF_STR( English ) ) |
| 660 | 660 | PORT_DIPSETTING( 0x80, DEF_STR( Japanese ) ) |
| 661 | 661 | |
| r1293 | r1294 | |
| 746 | 746 | MDRV_CPU_PROGRAM_MAP(tokio_sound_map, 0) // NMIs are triggered by the main CPU, IRQs are triggered by the YM2203 |
| 747 | 747 | |
| 748 | 748 | MDRV_SCREEN_REFRESH_RATE(VSYNC) // 59.185606 Hz |
| 749 | MDRV_SCREEN_VBLANK_TIME( | |
| 749 | MDRV_SCREEN_VBLANK_TIME(A | |
| 750 | 750 | MDRV_INTERLEAVE(100) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs |
| 751 | 751 | |
| 752 | 752 | // video hardware |
| r1293 | r1294 | |
| 789 | 789 | MDRV_CPU_VBLANK_INT(irq0_line_pulse, 1) // comes from the same clock that latches the INT pin on the second Z80 |
| 790 | 790 | |
| 791 | 791 | MDRV_SCREEN_REFRESH_RATE(VSYNC) // 59.185606 Hz |
| 792 | MDRV_SCREEN_VBLANK_TIME( | |
| 792 | MDRV_SCREEN_VBLANK_TIME(A | |
| 793 | 793 | MDRV_INTERLEAVE(100) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs |
| 794 | 794 | |
| 795 | 795 | // video hardware |
| r1293 | r1294 | |
|---|---|---|
| 43 | 43 | #include "machine/mc8123.h" |
| 44 | 44 | #include "sound/2203intf.h" |
| 45 | 45 | |
| 46 | UINT8* chinsan_video; | |
| 47 | UINT8 chinsan_port_select; | |
| 46 | static UINT8* chinsan_video; | |
| 47 | static UINT8 chinsan_port_select; | |
| 48 | 48 | |
| 49 | 49 | static VIDEO_START(chinsan) |
| 50 | 50 | { |
| r1293 | r1294 | |
| 462 | 462 | MDRV_CPU_IO_MAP(chinsan_io,0) |
| 463 | 463 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 464 | 464 | |
| 465 | MDRV_MACHINE_RESET( chinsan ) | |
| 465 | MDRV_MACHINE_RESET( chinsan ) | |
| 466 | 466 | |
| 467 | 467 | /* video hardware */ |
| 468 | 468 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER ) |
| r1293 | r1294 | |
|---|---|---|
| 86 | 86 | #include "driver.h" |
| 87 | 87 | #include "audio/seibu.h" |
| 88 | 88 | |
| 89 | UINT8* cshooter_txram; | |
| 89 | static UINT8* cshooter_txram; | |
| 90 | 90 | static tilemap *cshooter_txtilemap; |
| 91 | 91 | static int coin_stat=0; |
| 92 | 92 | |
| r1293 | r1294 | |
| 195 | 195 | |
| 196 | 196 | /* main cpu */ |
| 197 | 197 | |
| 198 | INTERRUPT_GEN( cshooter_interrupt ) | |
| 198 | static INTERRUPT_GEN( cshooter_interrupt ) | |
| 199 | 199 | { |
| 200 | 200 | if(cpu_getiloops()) |
| 201 | 201 | { |
| r1293 | r1294 | |
|---|---|---|
| 1652 | 1652 | MDRV_CPU_IO_MAP(aerofgt_sound_readport,aerofgt_sound_writeport) |
| 1653 | 1653 | /* IRQs are triggered by the YM2610 */ |
| 1654 | 1654 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1655 | MDRV_SCREEN_VBLANK_TIME( | |
| 1655 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1656 | 1656 | /* wrong but improves sprite-background synchronization */ |
| 1657 | 1657 | |
| 1658 | 1658 | MDRV_MACHINE_RESET(aerofgt) |
| r1293 | r1294 | |
| 1692 | 1692 | MDRV_CPU_IO_MAP(aerofgt_sound_readport,aerofgt_sound_writeport) |
| 1693 | 1693 | /* IRQs are triggered by the YM2610 */ |
| 1694 | 1694 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1695 | MDRV_SCREEN_VBLANK_TIME( | |
| 1695 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1696 | 1696 | /* wrong but improves sprite-background synchronization */ |
| 1697 | 1697 | |
| 1698 | 1698 | MDRV_MACHINE_RESET(aerofgt) |
| r1293 | r1294 | |
| 1730 | 1730 | MDRV_CPU_PROGRAM_MAP(aerfboot_snd_map,0) |
| 1731 | 1731 | |
| 1732 | 1732 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1733 | MDRV_SCREEN_VBLANK_TIME( | |
| 1733 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1734 | 1734 | /* wrong but improves sprite-background synchronization */ |
| 1735 | 1735 | |
| 1736 | 1736 | /* video hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 122 | 122 | scanline = 0; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | | |
| 125 | | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
| 129 | 129 | static MACHINE_RESET( fgoal ) |
| 130 | 130 | { |
| 131 | | |
| 131 | | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 |
| r1293 | r1294 | |
|---|---|---|
| 279 | 279 | MDRV_CPU_PERIODIC_INT(irq5_line_hold, 1) // ??? |
| 280 | 280 | |
| 281 | 281 | MDRV_SCREEN_REFRESH_RATE(60) |
| 282 | MDRV_SCREEN_VBLANK_TIME( | |
| 282 | MDRV_SCREEN_VBLANK_TIME(A | |
| 283 | 283 | |
| 284 | 284 | MDRV_INTERLEAVE(200) |
| 285 | 285 |
| r1293 | r1294 | |
|---|---|---|
| 248 | 248 | MDRV_CPU_VBLANK_INT(mystston_interrupt, 272) |
| 249 | 249 | |
| 250 | 250 | MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0) |
| 251 | MDRV_SCREEN_VBLANK_TIME( | |
| 251 | MDRV_SCREEN_VBLANK_TIME(A | |
| 252 | 252 | |
| 253 | 253 | /* video hardware */ |
| 254 | 254 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 19 | 19 | #include "sound/discrete.h" |
| 20 | 20 | |
| 21 | 21 | static tilemap *hitme_tilemap; |
| 22 | static | |
| 22 | static | |
| 23 | 23 | static UINT8 *hitme_vidram; |
| 24 | 24 | |
| 25 | 25 | |
| r1293 | r1294 | |
| 129 | 129 | static UINT8 read_port_and_t0(int port) |
| 130 | 130 | { |
| 131 | 131 | UINT8 val = readinputport(port); |
| 132 | if ( | |
| 132 | if ( | |
| 133 | 133 | val ^= 0x80; |
| 134 | 134 | return val; |
| 135 | 135 | } |
| r1293 | r1294 | |
| 185 | 185 | */ |
| 186 | 186 | UINT8 raw_game_speed = readinputport(6); |
| 187 | 187 | double resistance = raw_game_speed * 25000 / 100; |
| 188 | mame_time duration = make_mame_time(0, MAX_SUBSECONDS * 0.45 * 6.8e-6 * resistance * (data+1)); | |
| 189 | timeout_time = add_mame_times(mame_timer_get_time(), duration); | |
| 188 | attotime duration = attotime_make(0, ATTOSECONDS_PER_SECOND * 0.45 * 6.8e-6 * resistance * (data+1)); | |
| 189 | timeout_time = attotime_add(timer_get_time(), duration); | |
| 190 | 190 | |
| 191 | 191 | discrete_sound_w(HITME_DOWNCOUNT_VAL, data); |
| 192 | 192 | discrete_sound_w(HITME_OUT0, 1); |
| r1293 | r1294 | |
|---|---|---|
| 125 | 125 | int_delay_kludge = 10; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | INTERRUPT_GEN( senjyo_interrupt ) | |
| 128 | static INTERRUPT_GEN( senjyo_interrupt ) | |
| 129 | 129 | { |
| 130 | 130 | if (int_delay_kludge == 0) cpunum_set_input_line(0, 0, HOLD_LINE); |
| 131 | 131 | else int_delay_kludge--; |
| r1293 | r1294 | |
|---|---|---|
| 79 | 79 | VLM5030_RST( ( data >> 2 ) & 1 ); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | INTERRUPT_GEN( yiear_nmi_interrupt ) | |
| 82 | static INTERRUPT_GEN( yiear_nmi_interrupt ) | |
| 83 | 83 | { |
| 84 | 84 | /* can't use nmi_line_pulse() because interrupt_enable_w() effects it */ |
| 85 | 85 | if (yiear_nmi_enable) cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | static UINT16 *hyperpac_ram; |
| 103 | int sb3_music_is_playing; | |
| 104 | int sb3_music; | |
| 103 | static int sb3_music_is_playing; | |
| 104 | static int sb3_music; | |
| 105 | 105 | |
| 106 | 106 | static INTERRUPT_GEN( snowbros_interrupt ) |
| 107 | 107 | { |
| r1293 | r1294 | |
| 408 | 408 | return 0x0003; |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | void sb3_play_music(int data) | |
| 411 | static void sb3_play_music(int data) | |
| 412 | 412 | { |
| 413 | 413 | /* sample is actually played in interrupt function so it loops */ |
| 414 | 414 | sb3_music = data; |
| r1293 | r1294 | |
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | void sb3_play_sound (int data) | |
| 455 | static void sb3_play_sound (int data) | |
| 456 | 456 | { |
| 457 | 457 | int status = OKIM6295_status_0_r(0); |
| 458 | 458 |
| r1293 | r1294 | |
|---|---|---|
| 111 | 111 | if (irq != 0) |
| 112 | 112 | { |
| 113 | 113 | cpunum_set_input_line(0, irq, ASSERT_LINE); |
| 114 | cpu_boost_interleave(time_zero, | |
| 114 | cpu_boost_interleave(attotime_zero, | |
| 115 | 115 | } |
| 116 | 116 | else |
| 117 | 117 | cpunum_set_input_line(0, 7, CLEAR_LINE); |
| r1293 | r1294 | |
| 150 | 150 | update_main_irqs(); |
| 151 | 151 | |
| 152 | 152 | /* come back in 2 scanlines */ |
| 153 | | |
| 153 | | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | |
| r1293 | r1294 | |
| 205 | 205 | static void xboard_reset(void) |
| 206 | 206 | { |
| 207 | 207 | cpunum_set_input_line(1, INPUT_LINE_RESET, PULSE_LINE); |
| 208 | cpu_boost_interleave(time_zero, | |
| 208 | cpu_boost_interleave(attotime_zero, | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | |
| r1293 | r1294 | |
| 222 | 222 | segaic16_compare_timer_init(1, NULL, NULL); |
| 223 | 223 | |
| 224 | 224 | /* start timers to track interrupts */ |
| 225 | | |
| 225 | | |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | |
| r1293 | r1294 | |
| 461 | 461 | static WRITE16_HANDLER( loffire_sync0_w ) |
| 462 | 462 | { |
| 463 | 463 | COMBINE_DATA(&loffire_sync[offset]); |
| 464 | cpu_boost_interleave(time_zero, | |
| 464 | cpu_boost_interleave(attotime_zero, | |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | |
| r1293 | r1294 | |
| 731 | 731 | PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:3") |
| 732 | 732 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 733 | 733 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 734 | // According to the manual, SWB:4 sets 3 or 4 lives, but it doesn't actually do that. | |
| 735 | // However, it does on Afterburner II. Maybe there's another version of Afterburner | |
| 736 | // that behaves as the manual suggests. | |
| 734 | 737 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:5") |
| 735 | 738 | PORT_DIPSETTING( 0x10, "3" ) |
| 736 | 739 | PORT_DIPSETTING( 0x00, "3x Credits" ) |
| r1293 | r1294 | |
| 772 | 775 | PORT_DIPNAME( 0x04, 0x04, "Throttle Lever" ) PORT_DIPLOCATION("SWB:3") |
| 773 | 776 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 774 | 777 | PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) |
| 775 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:4") | |
| 776 | PORT_DIPSETTING( 0x08, "3" ) | |
| 777 | PORT_DIPSETTING( 0x00, "4" ) | |
| 778 | PORT_DIPNAME( 0x10, 0x00, "Ship Increase" ) PORT_DIPLOCATION("SWB:5") | |
| 779 | PORT_DIPSETTING( 0x10, DEF_STR( No ) ) | |
| 780 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) | |
| 778 | PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:4,5") | |
| 779 | PORT_DIPSETTING( 0x18, "3" ) | |
| 780 | PORT_DIPSETTING( 0x10, "4" ) | |
| 781 | PORT_DIPSETTING( 0x08, "3x Credits" ) | |
| 782 | PORT_DIPSETTING( 0x00, "4x Credits" ) | |
| 781 | 783 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6") |
| 782 | 784 | PORT_DIPSETTING( 0x20, DEF_STR( No ) ) |
| 783 | 785 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| r1293 | r1294 | |
| 1170 | 1172 | MACHINE_DRIVER_END |
| 1171 | 1173 | |
| 1172 | 1174 | |
| 1173 | MACHINE_DRIVER_START( smgp ) | |
| 1175 | static MACHINE_DRIVER_START( smgp ) | |
| 1174 | 1176 | MDRV_IMPORT_FROM(xboard) |
| 1175 | 1177 | |
| 1176 | 1178 | MDRV_CPU_ADD_TAG("comm", Z80, 4000000) |
| r1293 | r1294 | |
|---|---|---|
| 87 | 87 | |
| 88 | 88 | #define oki_time_base 0x08 |
| 89 | 89 | |
| 90 | static | |
| 90 | static | |
| 91 | 91 | |
| 92 | 92 | static int sslam_sound; |
| 93 | 93 | static int sslam_melody; |
| r1293 | r1294 | |
| 259 | 259 | sslam_track = 0; |
| 260 | 260 | sslam_melody = 0; |
| 261 | 261 | sslam_bar = 0; |
| 262 | | |
| 262 | | |
| 263 | 263 | } |
| 264 | 264 | if (pattern) { |
| 265 | 265 | logerror("Changing bar in music track to pattern %02x\n",pattern); |
| r1293 | r1294 | |
| 287 | 287 | OKIM6295_data_0_w(0,0x40); |
| 288 | 288 | OKIM6295_data_0_w(0,(0x80 | data)); |
| 289 | 289 | OKIM6295_data_0_w(0,0x81); |
| 290 | | |
| 290 | | |
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | else { |
| r1293 | r1294 | |
| 307 | 307 | } |
| 308 | 308 | else { /* use above 0x80 to turn off channels */ |
| 309 | 309 | if (track) { |
| 310 | | |
| 310 | | |
| 311 | 311 | sslam_track = 0; |
| 312 | 312 | sslam_melody = 0; |
| 313 | 313 | sslam_bar = 0; |
| r1293 | r1294 | |
| 958 | 958 | state_save_register_global(sslam_bar); |
| 959 | 959 | state_save_register_global(sslam_snd_bank); |
| 960 | 960 | |
| 961 | music_timer = | |
| 961 | music_timer = | |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | 964 | static DRIVER_INIT( powerbls ) |
| r1293 | r1294 | |
|---|---|---|
| 99 | 99 | #include "deco16ic.h" |
| 100 | 100 | |
| 101 | 101 | static UINT32 *simpl156_systemram; |
| 102 | UINT8 *simpl156_default_eeprom; | |
| 102 | static UINT8 *simpl156_default_eeprom; | |
| 103 | 103 | |
| 104 | 104 | extern VIDEO_START( simpl156 ); |
| 105 | 105 | extern VIDEO_UPDATE( simpl156 ); |
| r1293 | r1294 | |
| 486 | 486 | MDRV_CPU_VBLANK_INT(simpl156_vbl_interrupt,1) |
| 487 | 487 | |
| 488 | 488 | MDRV_SCREEN_REFRESH_RATE(58) |
| 489 | MDRV_SCREEN_VBLANK_TIME( | |
| 489 | MDRV_SCREEN_VBLANK_TIME(A | |
| 490 | 490 | MDRV_NVRAM_HANDLER(simpl156) // 93C45 |
| 491 | 491 | |
| 492 | 492 | /* video hardware */ |
| r1293 | r1294 | |
| 1040 | 1040 | |
| 1041 | 1041 | /* some default eeproms */ |
| 1042 | 1042 | |
| 1043 | UINT8 chainrec_eeprom[128] = { | |
| 1043 | static UINT8 chainrec_eeprom[128] = { | |
| 1044 | 1044 | 0x52, 0x54, 0x00, 0x50, 0x00, 0x00, 0x39, 0x11, 0x41, 0x54, 0x00, 0x43, 0x00, 0x50, 0xFF, 0xFF, |
| 1045 | 1045 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 1046 | 1046 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| r1293 | r1294 | |
| 1109 | 1109 | |
| 1110 | 1110 | */ |
| 1111 | 1111 | |
| 1112 | UINT8 osman_eeprom[128] = { | |
| 1112 | static UINT8 osman_eeprom[128] = { | |
| 1113 | 1113 | 0xFF, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 1114 | 1114 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 1115 | 1115 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| r1293 | r1294 | |
| 1119 | 1119 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 1120 | 1120 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF |
| 1121 | 1121 | }; |
| 1122 | UINT8 candance_eeprom[128] = { | |
| 1122 | static UINT8 candance_eeprom[128] = { | |
| 1123 | 1123 | 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 1124 | 1124 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 1125 | 1125 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| r1293 | r1294 | |
| 1129 | 1129 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 1130 | 1130 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF |
| 1131 | 1131 | }; |
| 1132 | UINT8 prtytime_eeprom[128] = { | |
| 1132 | static UINT8 prtytime_eeprom[128] = { | |
| 1133 | 1133 | 0xAF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 1134 | 1134 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 1135 | 1135 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| r1293 | r1294 | |
| 1140 | 1140 | 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFE, 0xFF, 0xFF |
| 1141 | 1141 | }; |
| 1142 | 1142 | |
| 1143 | UINT8 gangonta_eeprom[128] = { | |
| 1143 | static UINT8 gangonta_eeprom[128] = { | |
| 1144 | 1144 | 0x2F, 0xFF, 0x2F, 0xFF, 0xFF, 0xFE, 0xFF, 0xFE, 0xFF, 0xFE, 0xED, 0xCB, 0xFF, 0xFF, 0xFF, 0xFF, |
| 1145 | 1145 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 1146 | 1146 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| r1293 | r1294 | |
| 1154 | 1154 | /* Everything seems more stable if we run the CPU speed x4 and use Idle skips.. maybe it has an internal multipler? */ |
| 1155 | 1155 | static READ32_HANDLER( joemacr_speedup_r ) |
| 1156 | 1156 | { |
| 1157 | if (activecpu_get_pc()==0x284) cpu_spinuntil_time( | |
| 1157 | if (activecpu_get_pc()==0x284) cpu_spinuntil_time( | |
| 1158 | 1158 | return simpl156_systemram[0x18/4]; |
| 1159 | 1159 | } |
| 1160 | 1160 | |
| r1293 | r1294 | |
| 1167 | 1167 | |
| 1168 | 1168 | static READ32_HANDLER( chainrec_speedup_r ) |
| 1169 | 1169 | { |
| 1170 | if (activecpu_get_pc()==0x2d4) cpu_spinuntil_time( | |
| 1170 | if (activecpu_get_pc()==0x2d4) cpu_spinuntil_time( | |
| 1171 | 1171 | return simpl156_systemram[0x18/4]; |
| 1172 | 1172 | } |
| 1173 | 1173 | |
| r1293 | r1294 | |
| 1180 | 1180 | |
| 1181 | 1181 | static READ32_HANDLER( prtytime_speedup_r ) |
| 1182 | 1182 | { |
| 1183 | if (activecpu_get_pc()==0x4f0) cpu_spinuntil_time( | |
| 1183 | if (activecpu_get_pc()==0x4f0) cpu_spinuntil_time( | |
| 1184 | 1184 | return simpl156_systemram[0xae0/4]; |
| 1185 | 1185 | } |
| 1186 | 1186 | |
| r1293 | r1294 | |
| 1201 | 1201 | |
| 1202 | 1202 | static READ32_HANDLER( charlien_speedup_r ) |
| 1203 | 1203 | { |
| 1204 | if (activecpu_get_pc()==0xc8c8) cpu_spinuntil_time( | |
| 1204 | if (activecpu_get_pc()==0xc8c8) cpu_spinuntil_time( | |
| 1205 | 1205 | return simpl156_systemram[0x10/4]; |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| r1293 | r1294 | |
| 1213 | 1213 | |
| 1214 | 1214 | static READ32_HANDLER( osman_speedup_r ) |
| 1215 | 1215 | { |
| 1216 | if (activecpu_get_pc()==0x5974) cpu_spinuntil_time( | |
| 1216 | if (activecpu_get_pc()==0x5974) cpu_spinuntil_time( | |
| 1217 | 1217 | return simpl156_systemram[0x10/4]; |
| 1218 | 1218 | } |
| 1219 | 1219 |
| r1293 | r1294 | |
|---|---|---|
| 333 | 333 | |
| 334 | 334 | // IRQ |
| 335 | 335 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| 336 | | |
| 336 | | |
| 337 | 337 | |
| 338 | 338 | laserdisc_vsync(discinfo); |
| 339 | 339 | } |
| r1293 | r1294 | |
|---|---|---|
| 91 | 91 | static render_texture *overlay_texture; |
| 92 | 92 | static mame_bitmap *last_video_bitmap; |
| 93 | 93 | |
| 94 | static | |
| 94 | static | |
| 95 | 95 | |
| 96 | 96 | /********************************************************/ |
| 97 | 97 | |
| r1293 | r1294 | |
| 251 | 251 | if ( phillips_code & 0x800000 ) |
| 252 | 252 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| 253 | 253 | |
| 254 | | |
| 254 | | |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | static void vdp_interrupt (int state) |
| r1293 | r1294 | |
| 264 | 264 | static MACHINE_START( cliffhgr ) |
| 265 | 265 | { |
| 266 | 266 | discinfo = laserdisc_init(LASERDISC_TYPE_PR8210, get_disk_handle(0), 0); |
| 267 | irq_timer = | |
| 267 | irq_timer = | |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | static MACHINE_RESET( cliffhgr ) |
| 271 | 271 | { |
| 272 | 272 | port_bank = 0; |
| 273 | 273 | phillips_code = 0; |
| 274 | | |
| 274 | | |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /********************************************************/ |
| r1293 | r1294 | |
|---|---|---|
| 717 | 717 | * |
| 718 | 718 | *************************************/ |
| 719 | 719 | |
| 720 | MACHINE_DRIVER_START( artmagic ) | |
| 720 | static MACHINE_DRIVER_START( artmagic ) | |
| 721 | 721 | |
| 722 | 722 | /* basic machine hardware */ |
| 723 | 723 | MDRV_CPU_ADD_TAG("main", M68000, MASTER_CLOCK_25MHz/2) |
| r1293 | r1294 | |
| 751 | 751 | MACHINE_DRIVER_END |
| 752 | 752 | |
| 753 | 753 | |
| 754 | MACHINE_DRIVER_START( stonebal ) | |
| 754 | static MACHINE_DRIVER_START( stonebal ) | |
| 755 | 755 | MDRV_IMPORT_FROM(artmagic) |
| 756 | 756 | |
| 757 | 757 | MDRV_CPU_MODIFY("main") |
| r1293 | r1294 | |
|---|---|---|
| 460 | 460 | |
| 461 | 461 | /* CPU#1 Interrups */ |
| 462 | 462 | #define GALPANI2_INTERRUPTS_NUM 4 |
| 463 | INTERRUPT_GEN( galpani2_interrupt ) | |
| 463 | static INTERRUPT_GEN( galpani2_interrupt ) | |
| 464 | 464 | { |
| 465 | 465 | switch ( cpu_getiloops() ) |
| 466 | 466 | { |
| r1293 | r1294 | |
| 474 | 474 | /* CPU#2 Interrups */ |
| 475 | 475 | /* lev 3,4 & 5 are tested on power up. The rest is rte, but lev 7 */ |
| 476 | 476 | #define GALPANI2_INTERRUPTS_NUM2 3 |
| 477 | INTERRUPT_GEN( galpani2_interrupt2 ) | |
| 477 | static INTERRUPT_GEN( galpani2_interrupt2 ) | |
| 478 | 478 | { |
| 479 | 479 | switch ( cpu_getiloops() ) |
| 480 | 480 | { |
| r1293 | r1294 | |
|---|---|---|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | void K037122_tile_draw(int chip, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 372 | static void K037122_tile_draw(int chip, mame_bitmap *bitmap, const rectangle *cliprect) | |
| 373 | 373 | { |
| 374 | 374 | if (K037122_reg[chip][0xc] & 0x10000) |
| 375 | 375 | { |
| r1293 | r1294 | |
| 970 | 970 | static int jvs_rdata_ptr = 0; |
| 971 | 971 | static int jvs_sdata_ptr = 0; |
| 972 | 972 | |
| 973 | UINT8 jamma_jvs_r(void) | |
| 973 | static UINT8 jamma_jvs_r(void) | |
| 974 | 974 | { |
| 975 | 975 | UINT8 r; |
| 976 | 976 | r = jvs_rdata[jvs_rdata_ptr]; |
| r1293 | r1294 | |
| 979 | 979 | return r; |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | void jamma_jvs_w(UINT8 data) | |
| 982 | static void jamma_jvs_w(UINT8 data) | |
| 983 | 983 | { |
| 984 | 984 | jvs_sdata[jvs_sdata_ptr] = data; |
| 985 | 985 | jvs_sdata_ptr++; |
| r1293 | r1294 | |
| 1034 | 1034 | return outptr; |
| 1035 | 1035 | } |
| 1036 | 1036 | |
| 1037 | void jamma_jvs_cmd_exec(void) | |
| 1037 | static void jamma_jvs_cmd_exec(void) | |
| 1038 | 1038 | { |
| 1039 | 1039 | UINT8 sync, node, byte_num; |
| 1040 | 1040 | UINT8 data[1024], rdata[1024]; |
| r1293 | r1294 | |
|---|---|---|
| 139 | 139 | *************************************/ |
| 140 | 140 | |
| 141 | 141 | static const UINT8 *syncprom; |
| 142 | static | |
| 142 | static | |
| 143 | 143 | |
| 144 | 144 | static UINT8 irq_state; |
| 145 | 145 | static UINT8 *nvram_stage; |
| r1293 | r1294 | |
| 164 | 164 | break; |
| 165 | 165 | |
| 166 | 166 | /* next one at the start of this scanline */ |
| 167 | | |
| 167 | | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
| r1293 | r1294 | |
| 226 | 226 | visarea.max_x = 255; |
| 227 | 227 | visarea.min_y = ccastles_vblank_end; |
| 228 | 228 | visarea.max_y = ccastles_vblank_start - 1; |
| 229 | video_screen_configure(0, 320, 256, &visarea, HZ_TO_ | |
| 229 | video_screen_configure(0, 320, 256, &visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); | |
| 230 | 230 | |
| 231 | 231 | /* configure the ROM banking */ |
| 232 | 232 | memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0xa000, 0x6000); |
| 233 | 233 | |
| 234 | 234 | /* create a timer for IRQs and set up the first callback */ |
| 235 | irq_timer = | |
| 235 | irq_timer = | |
| 236 | 236 | irq_state = 0; |
| 237 | 237 | schedule_next_irq(0); |
| 238 | 238 |
| r1293 | r1294 | |
|---|---|---|
| 78 | 78 | static UINT8 aimpos[2]; |
| 79 | 79 | static UINT8 trackball_old[2]; |
| 80 | 80 | |
| 81 | static | |
| 81 | static | |
| 82 | 82 | static UINT8 master_sound_latch; |
| 83 | 83 | static UINT8 slave_sound_latch; |
| 84 | 84 | static UINT8 sound_control; |
| r1293 | r1294 | |
| 104 | 104 | |
| 105 | 105 | static MACHINE_RESET( exterm ) |
| 106 | 106 | { |
| 107 | sound_nmi_timer = | |
| 107 | sound_nmi_timer = | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| r1293 | r1294 | |
| 256 | 256 | /* rate is controlled by the value written here */ |
| 257 | 257 | /* this value is latched into up-counters, which are clocked at the */ |
| 258 | 258 | /* input clock / 256 */ |
| 259 | mame_time nmi_rate = scale_up_mame_time(MAME_TIME_IN_HZ(4000000), 4096 * (256 - data)); | |
| 260 | mame_timer_adjust(sound_nmi_timer, nmi_rate, 0, nmi_rate); | |
| 259 | attotime nmi_rate = attotime_mul(ATTOTIME_IN_HZ(4000000), 4096 * (256 - data)); | |
| 260 | timer_adjust(sound_nmi_timer, nmi_rate, 0, nmi_rate); | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 |
| r1293 | r1294 | |
|---|---|---|
| 36 | 36 | |
| 37 | 37 | static MACHINE_RESET( dragrace ) |
| 38 | 38 | { |
| 39 | | |
| 39 | | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | static void dragrace_update_misc_flags(void) |
| r1293 | r1294 | |
|---|---|---|
| 39 | 39 | #include "sound/msm5205.h" |
| 40 | 40 | #include "sound/3812intf.h" |
| 41 | 41 | |
| 42 | UINT8* discoboy_ram_part1; | |
| 43 | UINT8* discoboy_ram_part2; | |
| 44 | UINT8* discoboy_ram_part3; | |
| 45 | UINT8* discoboy_ram_part4; | |
| 46 | UINT8* discoboy_ram_att; | |
| 42 | static UINT8* discoboy_ram_part1; | |
| 43 | static UINT8* discoboy_ram_part2; | |
| 44 | static UINT8* discoboy_ram_part3; | |
| 45 | static UINT8* discoboy_ram_part4; | |
| 46 | static UINT8* discoboy_ram_att; | |
| 47 | 47 | |
| 48 | UINT8 discoboy_ram_bank; | |
| 48 | static UINT8 discoboy_ram_bank; | |
| 49 | 49 | static UINT8 port_00; |
| 50 | UINT8 discoboy_gfxbank; | |
| 50 | static UINT8 discoboy_gfxbank; | |
| 51 | 51 | |
| 52 | 52 | static VIDEO_START( discoboy ) |
| 53 | 53 | { |
| r1293 | r1294 | |
| 163 | 163 | return 0; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | #ifdef UNUSED_FUNCTION | |
| 166 | 167 | void discoboy_setrombank(UINT8 data) |
| 167 | 168 | { |
| 168 | 169 | UINT8 *ROM = memory_region(REGION_CPU1); |
| 169 | 170 | data &=0x2f; |
| 170 | 171 | memory_set_bankptr(1, &ROM[0x6000+(data*0x1000)] ); |
| 171 | 172 | } |
| 173 | #endif | |
| 172 | 174 | |
| 173 | 175 | static WRITE8_HANDLER( rambank_select_w ) |
| 174 | 176 | { |
| r1293 | r1294 | |
|---|---|---|
| 112 | 112 | static int dacl_ptr = 0; |
| 113 | 113 | static int dacr_ptr = 0; |
| 114 | 114 | |
| 115 | static | |
| 115 | static | |
| 116 | 116 | static UINT8 ad1847_regs[16]; |
| 117 | 117 | static UINT32 ad1847_sample_counter = 0; |
| 118 | 118 | static UINT32 ad1847_sample_rate; |
| r1293 | r1294 | |
| 642 | 642 | static TIMER_CALLBACK( sound_timer_callback ) |
| 643 | 643 | { |
| 644 | 644 | ad1847_sample_counter = 0; |
| 645 | | |
| 645 | | |
| 646 | 646 | |
| 647 | 647 | dmadac_transfer(0, 1, 0, 1, dacl_ptr, dacl); |
| 648 | 648 | dmadac_transfer(1, 1, 0, 1, dacr_ptr, dacr); |
| r1293 | r1294 | |
| 860 | 860 | dacl = auto_malloc(65536 * sizeof(INT16)); |
| 861 | 861 | dacr = auto_malloc(65536 * sizeof(INT16)); |
| 862 | 862 | |
| 863 | sound_timer = mame_timer_alloc(sound_timer_callback); | |
| 864 | mame_timer_adjust(sound_timer, MAME_TIME_IN_MSEC(10), 0, time_zero); | |
| 863 | sound_timer = timer_alloc(sound_timer_callback); | |
| 864 | timer_adjust(sound_timer, ATTOTIME_IN_MSEC(10), 0, attotime_zero); | |
| 865 | 865 | |
| 866 | 866 | dmadac_enable(0, 2, 1); |
| 867 | 867 | ide_controller_reset(0); |
| r1293 | r1294 | |
|---|---|---|
| 270 | 270 | MDRV_CPU_PERIODIC_INT(orbit_interrupt, 240) |
| 271 | 271 | |
| 272 | 272 | MDRV_SCREEN_REFRESH_RATE(60) /* interlaced */ |
| 273 | MDRV_SCREEN_VBLANK_TIME( | |
| 273 | MDRV_SCREEN_VBLANK_TIME(A | |
| 274 | 274 | MDRV_MACHINE_RESET(orbit) |
| 275 | 275 | |
| 276 | 276 | /* video hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 128 | 128 | static INTERRUPT_GEN( irq4_gen ) |
| 129 | 129 | { |
| 130 | 130 | cpunum_set_input_line(0, R3000_IRQ4, ASSERT_LINE); |
| 131 | | |
| 131 | | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| r1293 | r1294 | |
| 472 | 472 | }; |
| 473 | 473 | |
| 474 | 474 | |
| 475 | MACHINE_DRIVER_START( policetr ) | |
| 475 | static MACHINE_DRIVER_START( policetr ) | |
| 476 | 476 | |
| 477 | 477 | /* basic machine hardware */ |
| 478 | 478 | MDRV_CPU_ADD_TAG("main", R3000BE, MASTER_CLOCK/2) |
| r1293 | r1294 | |
| 504 | 504 | MACHINE_DRIVER_END |
| 505 | 505 | |
| 506 | 506 | |
| 507 | MACHINE_DRIVER_START( sshooter ) | |
| 507 | static MACHINE_DRIVER_START( sshooter ) | |
| 508 | 508 | MDRV_IMPORT_FROM(policetr) |
| 509 | 509 | |
| 510 | 510 | /* basic machine hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 1785 | 1785 | MDRV_CPU_PROGRAM_MAP(spisound_map, 0) |
| 1786 | 1786 | |
| 1787 | 1787 | MDRV_SCREEN_REFRESH_RATE(54) |
| 1788 | MDRV_SCREEN_VBLANK_TIME( | |
| 1788 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1789 | 1789 | MDRV_INTERLEAVE(200) |
| 1790 | 1790 | |
| 1791 | 1791 | MDRV_MACHINE_RESET(spi) |
| r1293 | r1294 | |
| 2099 | 2099 | MDRV_CPU_VBLANK_INT(spi_interrupt, 1) |
| 2100 | 2100 | |
| 2101 | 2101 | MDRV_SCREEN_REFRESH_RATE(54) |
| 2102 | MDRV_SCREEN_VBLANK_TIME( | |
| 2102 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2103 | 2103 | |
| 2104 | 2104 | MDRV_NVRAM_HANDLER(sxx2f) |
| 2105 | 2105 | MDRV_MACHINE_RESET(seibu386) |
| r1293 | r1294 | |
|---|---|---|
| 54 | 54 | #define NVRAM_UNLOCK_SEQ_LEN (ARRAY_LENGTH(nvram_unlock_seq)) |
| 55 | 55 | static UINT16 nvram_write_seq[NVRAM_UNLOCK_SEQ_LEN]; |
| 56 | 56 | static UINT8 nvram_write_enable; |
| 57 | static | |
| 57 | static | |
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | |
| r1293 | r1294 | |
| 146 | 146 | static MACHINE_RESET( amerdart ) |
| 147 | 147 | { |
| 148 | 148 | nvram_write_enable = 0; |
| 149 | nvram_write_timer = | |
| 149 | nvram_write_timer = | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
| r1293 | r1294 | |
| 154 | 154 | { |
| 155 | 155 | tlc34076_reset(6); |
| 156 | 156 | nvram_write_enable = 0; |
| 157 | nvram_write_timer = | |
| 157 | nvram_write_timer = | |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
| r1293 | r1294 | |
| 181 | 181 | if (!memcmp(nvram_unlock_seq, nvram_write_seq, sizeof(nvram_unlock_seq))) |
| 182 | 182 | { |
| 183 | 183 | nvram_write_enable = 1; |
| 184 | | |
| 184 | | |
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
| r1293 | r1294 | |
| 277 | 277 | { |
| 278 | 278 | logerror("%08x:IOP write %04x\n", activecpu_get_pc(), data); |
| 279 | 279 | COMBINE_DATA(&iop_cmd); |
| 280 | | |
| 280 | | |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
| r1293 | r1294 | |
| 314 | 314 | cpunum_set_input_line(1, 0, HOLD_LINE); /* ??? I have no idea who should generate this! */ |
| 315 | 315 | /* the DSP polls the status bit so it isn't strictly */ |
| 316 | 316 | /* necessary to also have an IRQ */ |
| 317 | cpu_boost_interleave(time_zero, | |
| 317 | cpu_boost_interleave(attotime_zero, | |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | |
| r1293 | r1294 | |
| 679 | 679 | * |
| 680 | 680 | *************************************/ |
| 681 | 681 | |
| 682 | MACHINE_DRIVER_START( amerdart ) | |
| 682 | static MACHINE_DRIVER_START( amerdart ) | |
| 683 | 683 | |
| 684 | 684 | /* basic machine hardware */ |
| 685 | 685 | MDRV_CPU_ADD(TMS34010, 40000000/TMS34010_CLOCK_DIVIDER) |
| r1293 | r1294 | |
|---|---|---|
| 339 | 339 | MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) |
| 340 | 340 | |
| 341 | 341 | MDRV_SCREEN_REFRESH_RATE(60) |
| 342 | MDRV_SCREEN_VBLANK_TIME( | |
| 342 | MDRV_SCREEN_VBLANK_TIME(A | |
| 343 | 343 | |
| 344 | 344 | /* video hardware */ |
| 345 | 345 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 30 | 30 | |
| 31 | 31 | static int drmicro_nmi_enable; |
| 32 | 32 | |
| 33 | INTERRUPT_GEN( drmicro_interrupt ) | |
| 33 | static INTERRUPT_GEN( drmicro_interrupt ) | |
| 34 | 34 | { |
| 35 | 35 | if (drmicro_nmi_enable) |
| 36 | 36 | cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 113 | 113 | soundlatch_w(0,data); |
| 114 | 114 | cpunum_set_input_line(1,INPUT_LINE_NMI,PULSE_LINE); |
| 115 | 115 | /* spin for a while to let the Z80 read the command (fixes hanging sound in Regulus) */ |
| 116 | cpu_spinuntil_time( | |
| 116 | cpu_spinuntil_time( | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 |
| r1293 | r1294 | |
|---|---|---|
| 312 | 312 | 8*64, |
| 313 | 313 | }; |
| 314 | 314 | |
| 315 | GFXDECODE_START( culture ) | |
| 315 | static GFXDECODE_START( culture ) | |
| 316 | 316 | GFXDECODE_ENTRY(REGION_GFX1, 0, gfxlayout, 0, 1 ) |
| 317 | 317 | GFXDECODE_ENTRY(REGION_GFX2, 0, gfxlayout, 0, 1 ) |
| 318 | 318 | GFXDECODE_ENTRY(REGION_GFX3, 0, gfxlayout, 0, 1 ) |
| r1293 | r1294 | |
|---|---|---|
| 129 | 129 | static UINT8 speech_strobe_state; |
| 130 | 130 | static UINT8 nvram_enabled; |
| 131 | 131 | |
| 132 | static | |
| 132 | static | |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | /************************************* |
| r1293 | r1294 | |
| 150 | 150 | scanline += 32; |
| 151 | 151 | if (scanline > 256) |
| 152 | 152 | scanline = 32; |
| 153 | | |
| 153 | | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | |
| r1293 | r1294 | |
| 169 | 169 | static MACHINE_START( jedi ) |
| 170 | 170 | { |
| 171 | 171 | /* set a timer to run the interrupts */ |
| 172 | jedi_timer = mame_timer_alloc(generate_interrupt); | |
| 173 | mame_timer_adjust(jedi_timer,video_screen_get_time_until_pos(0, 32, 0), 32, time_zero); | |
| 172 | jedi_timer = timer_alloc(generate_interrupt); | |
| 173 | timer_adjust(jedi_timer,video_screen_get_time_until_pos(0, 32, 0), 32, attotime_zero); | |
| 174 | 174 | |
| 175 | 175 | /* configure the banks */ |
| 176 | 176 | memory_configure_bank(1, 0, 3, memory_region(REGION_CPU1) + 0x10000, 0x4000); |
| r1293 | r1294 | |
|---|---|---|
| 150 | 150 | #include "machine/steppers.h" // stepper motor |
| 151 | 151 | |
| 152 | 152 | #include "machine/bfm_bd1.h" // vfd |
| 153 | #include "machine/m | |
| 153 | #include "machine/meters.h" | |
| 154 | 154 | |
| 155 | 155 | #include "bfm_sc2.lh" |
| 156 | 156 | #include "gldncrwn.lh" |
| r1293 | r1294 | |
| 202 | 202 | static int data_to_uart1; |
| 203 | 203 | static int data_to_uart2; |
| 204 | 204 | static int locked; // hardware lock/unlock status (0=unlocked) |
| 205 | static int timer_enabled; | |
| 205 | static int is_timer_enabled; | |
| 206 | 206 | static int reel_changed; |
| 207 | 207 | static int coin_inhibits; |
| 208 | 208 | static int irq_timer_stat; |
| r1293 | r1294 | |
| 304 | 304 | mmtr_latch = 0; |
| 305 | 305 | triac_latch = 0; |
| 306 | 306 | irq_status = 0; |
| 307 | timer_enabled | |
| 307 | is_timer_enabled | |
| 308 | 308 | coin_inhibits = 0; |
| 309 | 309 | irq_timer_stat = 0; |
| 310 | 310 | expansion_latch = 0; |
| r1293 | r1294 | |
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | if ( timer_enabled ) | |
| 513 | if ( is_timer_enabled ) | |
| 514 | 514 | { |
| 515 | 515 | irq_timer_stat = 0x01; |
| 516 | 516 | irq_status = 0x02; |
| r1293 | r1294 | |
| 608 | 608 | static WRITE8_HANDLER( mmtr_w ) |
| 609 | 609 | { |
| 610 | 610 | int changed = mmtr_latch ^ data; |
| 611 | long cycles = | |
| 611 | long cycles = | |
| 612 | 612 | |
| 613 | 613 | mmtr_latch = data; |
| 614 | 614 | |
| r1293 | r1294 | |
| 899 | 899 | |
| 900 | 900 | static WRITE8_HANDLER( timerirq_w ) |
| 901 | 901 | { |
| 902 | timer_enabled = data & 1; | |
| 902 | is_timer_enabled = data & 1; | |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | /////////////////////////////////////////////////////////////////////////// |
| r1293 | r1294 | |
| 3069 | 3069 | |
| 3070 | 3070 | MDRV_CPU_ADD_TAG("adder2", M6809, 2000000 ) // adder2 board 6809 CPU at 2 Mhz |
| 3071 | 3071 | MDRV_CPU_PROGRAM_MAP(adder2_memmap,0) // setup adder2 board memorymap |
| 3072 | MDRV_CPU_VBLANK_INT(adder2_vbl, 1) | |
| 3072 | MDRV_CPU_VBLANK_INT(adder2_vbl, 1) | |
| 3073 | 3073 | |
| 3074 | 3074 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 3075 | 3075 | MDRV_SOUND_ADD(UPD7759, UPD7759_STANDARD_CLOCK) |
| r1293 | r1294 | |
|---|---|---|
| 454 | 454 | |
| 455 | 455 | static MACHINE_RESET(skns) |
| 456 | 456 | { |
| 457 | mame_timer_pulse(MAME_TIME_IN_MSEC(2), 15, interrupt_callback); | |
| 458 | mame_timer_pulse(MAME_TIME_IN_MSEC(8), 11, interrupt_callback); | |
| 459 | mame_timer_pulse(MAME_TIME_IN_CYCLES(1824, 0), 9, interrupt_callback); | |
| 457 | timer_pulse(ATTOTIME_IN_MSEC(2), 15, interrupt_callback); | |
| 458 | timer_pulse(ATTOTIME_IN_MSEC(8), 11, interrupt_callback); | |
| 459 | timer_pulse(ATTOTIME_IN_CYCLES(1824, 0), 9, interrupt_callback); | |
| 460 | 460 | |
| 461 | 461 | memory_set_bankptr(1,memory_region(REGION_USER1)); |
| 462 | 462 | } |
| r1293 | r1294 | |
|---|---|---|
| 130 | 130 | #include "audio/namcoc7x.h" |
| 131 | 131 | |
| 132 | 132 | |
| 133 | static | |
| 133 | static | |
| 134 | 134 | |
| 135 | 135 | VIDEO_START( namcofl ); |
| 136 | 136 | VIDEO_UPDATE( namcofl ); |
| r1293 | r1294 | |
| 182 | 182 | UINT16 v = paletteram32[offset] >> 16; |
| 183 | 183 | UINT16 triggerscanline=(((v>>8)&0xff)|((v&0xff)<<8))-(32+1); |
| 184 | 184 | |
| 185 | | |
| 185 | | |
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| r1293 | r1294 | |
| 314 | 314 | static TIMER_CALLBACK( network_interrupt_callback ) |
| 315 | 315 | { |
| 316 | 316 | cpunum_set_input_line(0, I960_IRQ0, ASSERT_LINE); |
| 317 | | |
| 317 | | |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | |
| 321 | 321 | static TIMER_CALLBACK( vblank_interrupt_callback ) |
| 322 | 322 | { |
| 323 | 323 | cpunum_set_input_line(0, I960_IRQ2, ASSERT_LINE); |
| 324 | | |
| 324 | | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | |
| r1293 | r1294 | |
| 329 | 329 | { |
| 330 | 330 | video_screen_update_partial(0, video_screen_get_vpos(0)); |
| 331 | 331 | cpunum_set_input_line(0, I960_IRQ1, ASSERT_LINE); |
| 332 | | |
| 332 | | |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | |
| 336 | 336 | static MACHINE_START( namcofl ) |
| 337 | 337 | { |
| 338 | raster_interrupt_timer = | |
| 338 | raster_interrupt_timer = | |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | |
| 342 | 342 | static MACHINE_RESET( namcofl ) |
| 343 | 343 | { |
| 344 | mame_timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 3, 0), 0, network_interrupt_callback); | |
| 345 | mame_timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 1, 0), 0, vblank_interrupt_callback); | |
| 344 | timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 3, 0), 0, network_interrupt_callback); | |
| 345 | timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 1, 0), 0, vblank_interrupt_callback); | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 |
| r1293 | r1294 | |
|---|---|---|
| 94 | 94 | ***************************************************************************/ |
| 95 | 95 | |
| 96 | 96 | UINT8 dynax_blitter_irq; |
| 97 | UINT8 dynax_sound_irq; | |
| 98 | UINT8 dynax_vblank_irq; | |
| 97 | static UINT8 dynax_sound_irq; | |
| 98 | static UINT8 dynax_vblank_irq; | |
| 99 | 99 | |
| 100 | 100 | /* It runs in IM 0, thus needs an opcode on the data bus */ |
| 101 | 101 | void sprtmtch_update_irq(void) |
| r1293 | r1294 | |
| 118 | 118 | sprtmtch_update_irq(); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | INTERRUPT_GEN( sprtmtch_vblank_interrupt ) | |
| 121 | static INTERRUPT_GEN( sprtmtch_vblank_interrupt ) | |
| 122 | 122 | { |
| 123 | 123 | dynax_vblank_irq = 1; |
| 124 | 124 | sprtmtch_update_irq(); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | void sprtmtch_sound_callback(int state) | |
| 127 | static void sprtmtch_sound_callback(int state) | |
| 128 | 128 | { |
| 129 | 129 | dynax_sound_irq = state; |
| 130 | 130 | sprtmtch_update_irq(); |
| r1293 | r1294 | |
| 164 | 164 | jantouki_update_irq(); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | INTERRUPT_GEN( jantouki_vblank_interrupt ) | |
| 167 | static INTERRUPT_GEN( jantouki_vblank_interrupt ) | |
| 168 | 168 | { |
| 169 | 169 | dynax_vblank_irq = 1; |
| 170 | 170 | jantouki_update_irq(); |
| r1293 | r1294 | |
| 175 | 175 | Jantouki - Sound CPU |
| 176 | 176 | ***************************************************************************/ |
| 177 | 177 | |
| 178 | UINT8 dynax_soundlatch_irq; | |
| 179 | UINT8 dynax_sound_vblank_irq; | |
| 178 | static UINT8 dynax_soundlatch_irq; | |
| 179 | static UINT8 dynax_sound_vblank_irq; | |
| 180 | 180 | |
| 181 | void jantouki_sound_update_irq(void) | |
| 181 | static void jantouki_sound_update_irq(void) | |
| 182 | 182 | { |
| 183 | 183 | int irq = ((dynax_sound_irq) ? 0x08 : 0) | |
| 184 | 184 | ((dynax_soundlatch_irq) ? 0x10 : 0) | |
| r1293 | r1294 | |
| 186 | 186 | cpunum_set_input_line_and_vector(1, 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */ |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | INTERRUPT_GEN( jantouki_sound_vblank_interrupt ) | |
| 189 | static INTERRUPT_GEN( jantouki_sound_vblank_interrupt ) | |
| 190 | 190 | { |
| 191 | 191 | dynax_sound_vblank_irq = 1; |
| 192 | 192 | jantouki_sound_update_irq(); |
| r1293 | r1294 | |
| 198 | 198 | jantouki_sound_update_irq(); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | void jantouki_sound_callback(int state) | |
| 201 | static void jantouki_sound_callback(int state) | |
| 202 | 202 | { |
| 203 | 203 | dynax_sound_irq = state; |
| 204 | 204 | jantouki_sound_update_irq(); |
| r1293 | r1294 | |
| 845 | 845 | Jantouki - Main CPU |
| 846 | 846 | ***************************************************************************/ |
| 847 | 847 | |
| 848 | UINT8 dynax_soundlatch_ack; | |
| 849 | UINT8 dynax_soundlatch_full; | |
| 848 | static UINT8 dynax_soundlatch_ack; | |
| 849 | static UINT8 dynax_soundlatch_full; | |
| 850 | 850 | static UINT8 latch; |
| 851 | 851 | |
| 852 | 852 | static READ8_HANDLER( jantouki_soundlatch_ack_r ) |
| r1293 | r1294 | |
| 1151 | 1151 | |
| 1152 | 1152 | static int rombank; |
| 1153 | 1153 | static UINT8 *romptr; |
| 1154 | int tenkai_dswsel, tenkai_ipsel, tenkai_ip; | |
| 1154 | static int tenkai_dswsel, tenkai_ipsel, tenkai_ip; | |
| 1155 | 1155 | static UINT8 tenkai_p5_val; |
| 1156 | 1156 | |
| 1157 | 1157 | static WRITE8_HANDLER( tenkai_ipsel_w ) |
| r1293 | r1294 | |
| 3793 | 3793 | what was it trying to do? |
| 3794 | 3794 | set an irq and clear it before its even taken? */ |
| 3795 | 3795 | |
| 3796 | INTERRUPT_GEN( yarunara_clock_interrupt ) | |
| 3796 | static INTERRUPT_GEN( yarunara_clock_interrupt ) | |
| 3797 | 3797 | { |
| 3798 | 3798 | static int i=0; |
| 3799 | 3799 | i^=1; |
| r1293 | r1294 | |
| 3948 | 3948 | cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0xfa); |
| 3949 | 3949 | } |
| 3950 | 3950 | |
| 3951 | INTERRUPT_GEN( mjelctrn_vblank_interrupt ) | |
| 3951 | static INTERRUPT_GEN( mjelctrn_vblank_interrupt ) | |
| 3952 | 3952 | { |
| 3953 | 3953 | // This is a kludge to avoid losing blitter interrupts |
| 3954 | 3954 | // there should be a vblank ack mechanism |
| r1293 | r1294 | |
| 3982 | 3982 | cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0x42); |
| 3983 | 3983 | } |
| 3984 | 3984 | |
| 3985 | INTERRUPT_GEN( neruton_vblank_interrupt ) | |
| 3985 | static INTERRUPT_GEN( neruton_vblank_interrupt ) | |
| 3986 | 3986 | { |
| 3987 | 3987 | // This is a kludge to avoid losing blitter interrupts |
| 3988 | 3988 | // there should be a vblank ack mechanism |
| r1293 | r1294 | |
| 4011 | 4011 | /* It runs in IM 2, thus needs a vector on the data bus: |
| 4012 | 4012 | 0x42 and 0x44 are very similar, they should be triggered by the blitter |
| 4013 | 4013 | 0x40 is vblank */ |
| 4014 | INTERRUPT_GEN( majxtal7_vblank_interrupt ) | |
| 4014 | static INTERRUPT_GEN( majxtal7_vblank_interrupt ) | |
| 4015 | 4015 | { |
| 4016 | 4016 | // This is a kludge to avoid losing blitter interrupts |
| 4017 | 4017 | // there should be a vblank ack mechanism |
| r1293 | r1294 | |
| 4081 | 4081 | Mahjong Tenkaigen |
| 4082 | 4082 | ***************************************************************************/ |
| 4083 | 4083 | |
| 4084 | INTERRUPT_GEN( tenkai_interrupt ) | |
| 4084 | static INTERRUPT_GEN( tenkai_interrupt ) | |
| 4085 | 4085 | { |
| 4086 | 4086 | switch(cpu_getiloops()) |
| 4087 | 4087 | { |
| r1293 | r1294 | |
|---|---|---|
| 1138 | 1138 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) + ( ( data & 3 ) * 0x800000 ) ); |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | INTERRUPT_GEN( coh1000t_vblank ) | |
| 1141 | static INTERRUPT_GEN( coh1000t_vblank ) | |
| 1142 | 1142 | { |
| 1143 | 1143 | /* kludge: stop dropping into test mode on bootup */ |
| 1144 | 1144 | if( strcmp( Machine->gamedrv->name, "raystorm" ) == 0 ) |
| r1293 | r1294 | |
| 2643 | 2643 | zn_machine_init(); |
| 2644 | 2644 | } |
| 2645 | 2645 | |
| 2646 | INTERRUPT_GEN( coh1002v_vblank ) | |
| 2646 | static INTERRUPT_GEN( coh1002v_vblank ) | |
| 2647 | 2647 | { |
| 2648 | 2648 | /* kludge: to stop dropping into test mode on bootup */ |
| 2649 | 2649 | if(strcmp( Machine->gamedrv->name, "sncwgltd" ) == 0 ) |
| r1293 | r1294 | |
| 2910 | 2910 | return ret; |
| 2911 | 2911 | } |
| 2912 | 2912 | |
| 2913 | ADDRESS_MAP_START( cbaj_z80_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 2913 | static ADDRESS_MAP_START( cbaj_z80_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 2914 | 2914 | AM_RANGE( 0x0000, 0x7fff ) AM_ROM |
| 2915 | 2915 | AM_RANGE( 0x8000, 0xffff ) AM_RAM |
| 2916 | 2916 | ADDRESS_MAP_END |
| 2917 | 2917 | |
| 2918 | ADDRESS_MAP_START( cbaj_z80_port_map, ADDRESS_SPACE_IO, 8) | |
| 2918 | static ADDRESS_MAP_START( cbaj_z80_port_map, ADDRESS_SPACE_IO, 8) | |
| 2919 | 2919 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 2920 | 2920 | AM_RANGE( 0x84, 0x84 ) AM_READWRITE( YMZ280B_status_0_r, YMZ280B_register_0_w ) |
| 2921 | 2921 | AM_RANGE( 0x85, 0x85 ) AM_READWRITE( YMZ280B_status_0_r, YMZ280B_data_0_w ) |
| r1293 | r1294 | |
|---|---|---|
| 73 | 73 | static UINT8* sprite_renderline; |
| 74 | 74 | static UINT8* highpri_renderline; |
| 75 | 75 | static UINT16* video_renderline; |
| 76 | UINT16* megadrive_vdp_palette_lookup; | |
| 77 | UINT16* megadrive_vdp_palette_lookup_shadow; | |
| 78 | UINT16* megadrive_vdp_palette_lookup_highlight; | |
| 76 | static UINT16* megadrive_vdp_palette_lookup; | |
| 77 | static UINT16* megadrive_vdp_palette_lookup_shadow; | |
| 78 | static UINT16* megadrive_vdp_palette_lookup_highlight; | |
| 79 | 79 | static UINT8 oldscreenwidth = 3; |
| 80 | 80 | UINT16* megadrive_ram; |
| 81 | 81 | UINT8 megadrive_vram_fill_pending = 0; |
| 82 | 82 | UINT16 megadrive_vram_fill_length = 0; |
| 83 | 83 | int genesis_scanline_counter = 0; |
| 84 | 84 | int megadrive_sprite_collision = 0; |
| 85 | int megadrive_region_export; | |
| 86 | int megadrive_region_pal; | |
| 87 | int megadrive_max_hposition; | |
| 85 | static int megadrive_region_export; | |
| 86 | static int megadrive_region_pal; | |
| 87 | static int megadrive_max_hposition; | |
| 88 | 88 | |
| 89 | 89 | |
| 90 | static mame_timer* frame_timer; | |
| 91 | static mame_timer* scanline_timer; | |
| 92 | static mame_timer* irq6_on_timer; | |
| 93 | static mame_timer* irq4_on_timer; | |
| 90 | static emu_timer* frame_timer; | |
| 91 | static emu_timer* scanline_timer; | |
| 92 | static emu_timer* irq6_on_timer; | |
| 93 | static emu_timer* irq4_on_timer; | |
| 94 | 94 | static mame_bitmap* render_bitmap; |
| 95 | // | |
| 95 | // | |
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | #ifdef UNUSED_FUNCTION |
| r1293 | r1294 | |
| 136 | 136 | UINT8* z80_prgram; |
| 137 | 137 | } genz80; |
| 138 | 138 | |
| 139 | void megadriv_z80_bank_w(UINT16 data) | |
| 139 | static void megadriv_z80_bank_w(UINT16 data) | |
| 140 | 140 | { |
| 141 | 141 | genz80.z80_bank_partial |= (data & 0x01)<<23; // add new bit to partial address |
| 142 | 142 | genz80.z80_bank_pos++; |
| r1293 | r1294 | |
| 199 | 199 | |
| 200 | 200 | |
| 201 | 201 | |
| 202 | int megadrive_vdp_command_pending; // 2nd half of command pending.. | |
| 203 | UINT16 megadrive_vdp_command_part1; | |
| 204 | UINT16 megadrive_vdp_command_part2; | |
| 205 | UINT8 megadrive_vdp_code; | |
| 206 | UINT16 megadrive_vdp_address; | |
| 207 | UINT16 megadrive_vdp_register[0x20]; | |
| 208 | UINT16* megadrive_vdp_vram; | |
| 209 | UINT16* megadrive_vdp_cram; | |
| 210 | UINT16* megadrive_vdp_vsram; | |
| 202 | static int megadrive_vdp_command_pending; // 2nd half of command pending.. | |
| 203 | static UINT16 megadrive_vdp_command_part1; | |
| 204 | static UINT16 megadrive_vdp_command_part2; | |
| 205 | static UINT8 megadrive_vdp_code; | |
| 206 | static UINT16 megadrive_vdp_address; | |
| 207 | static UINT16 megadrive_vdp_register[0x20]; | |
| 208 | static UINT16* megadrive_vdp_vram; | |
| 209 | static UINT16* megadrive_vdp_cram; | |
| 210 | static UINT16* megadrive_vdp_vsram; | |
| 211 | 211 | /* The VDP keeps a 0x400 byte on-chip cache of the Sprite Attribute Table |
| 212 | 212 | to speed up processing */ |
| 213 | UINT16* megadrive_vdp_internal_sprite_attribute_table; | |
| 213 | static UINT16* megadrive_vdp_internal_sprite_attribute_table; | |
| 214 | 214 | |
| 215 | 215 | /* |
| 216 | 216 | |
| r1293 | r1294 | |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | |
| 404 | void megadriv_vdp_data_port_w(int data) | |
| 404 | static void megadriv_vdp_data_port_w(int data) | |
| 405 | 405 | { |
| 406 | 406 | megadrive_vdp_command_pending = 0; |
| 407 | 407 | |
| r1293 | r1294 | |
| 497 | 497 | |
| 498 | 498 | |
| 499 | 499 | |
| 500 | void megadrive_vdp_set_register(int regnum, UINT8 value) | |
| 500 | static void megadrive_vdp_set_register(int regnum, UINT8 value) | |
| 501 | 501 | { |
| 502 | 502 | megadrive_vdp_register[regnum] = value; |
| 503 | 503 | |
| r1293 | r1294 | |
| 555 | 555 | // mame_printf_debug("%06x Setting VDP Register #%02x to %02x\n",activecpu_get_pc(), regnum,value); |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | void update_megadrive_vdp_code_and_address(void) | |
| 558 | static void update_megadrive_vdp_code_and_address(void) | |
| 559 | 559 | { |
| 560 | 560 | megadrive_vdp_code = ((megadrive_vdp_command_part1 & 0xc000) >> 14) | |
| 561 | 561 | ((megadrive_vdp_command_part2 & 0x00f0) >> 2); |
| r1293 | r1294 | |
| 608 | 608 | |
| 609 | 609 | /* Note, In reality this transfer is NOT instant, the 68k isn't paused |
| 610 | 610 | as the 68k address bus isn't accessed */ |
| 611 | void megadrive_do_insta_vram_copy(UINT32 source, UINT16 length); | |
| 611 | static void megadrive_do_insta_vram_copy(UINT32 source, UINT16 length); | |
| 612 | 612 | |
| 613 | 613 | /* Wani Wani World, James Pond 3, Pirates Gold! */ |
| 614 | 614 | void megadrive_do_insta_vram_copy(UINT32 source, UINT16 length) |
| r1293 | r1294 | |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | /* Instant, but we pause the 68k a bit */ |
| 642 | void megadrive_do_insta_68k_to_vram_dma(UINT32 source,int length) | |
| 642 | static void megadrive_do_insta_68k_to_vram_dma(UINT32 source,int length) | |
| 643 | 643 | { |
| 644 | 644 | int count; |
| 645 | 645 | |
| 646 | 646 | if (length==0x00) length = 0xffff; |
| 647 | 647 | |
| 648 | 648 | /* This is a hack until real DMA timings are implemented */ |
| 649 | cpu_spinuntil_time( | |
| 649 | cpu_spinuntil_time( | |
| 650 | 650 | |
| 651 | 651 | for (count = 0;count<(length>>1);count++) |
| 652 | 652 | { |
| r1293 | r1294 | |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | |
| 669 | void megadrive_do_insta_68k_to_cram_dma(UINT32 source,UINT16 length) | |
| 669 | static void megadrive_do_insta_68k_to_cram_dma(UINT32 source,UINT16 length) | |
| 670 | 670 | { |
| 671 | 671 | int count; |
| 672 | 672 | |
| r1293 | r1294 | |
| 694 | 694 | |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | void megadrive_do_insta_68k_to_vsram_dma(UINT32 source,UINT16 length) | |
| 697 | static void megadrive_do_insta_68k_to_vsram_dma(UINT32 source,UINT16 length) | |
| 698 | 698 | { |
| 699 | 699 | int count; |
| 700 | 700 | |
| r1293 | r1294 | |
| 854 | 854 | } |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | void megadriv_vdp_ctrl_port_w(int data) | |
| 857 | static void megadriv_vdp_ctrl_port_w(int data) | |
| 858 | 858 | { |
| 859 | 859 | // logerror("write to vdp control port %04x\n",data); |
| 860 | 860 | megadrive_vram_fill_pending = 0; // ?? |
| r1293 | r1294 | |
| 958 | 958 | return megadrive_vdp_cram[(megadrive_vdp_address&0x7e)>>1]; |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | UINT16 megadriv_vdp_data_port_r(void) | |
| 961 | static UINT16 megadriv_vdp_data_port_r(void) | |
| 962 | 962 | { |
| 963 | 963 | UINT16 retdata=0; |
| 964 | 964 | |
| r1293 | r1294 | |
| 1075 | 1075 | |
| 1076 | 1076 | |
| 1077 | 1077 | |
| 1078 | UINT16 megadriv_vdp_ctrl_port_r(void) | |
| 1078 | static UINT16 megadriv_vdp_ctrl_port_r(void) | |
| 1079 | 1079 | { |
| 1080 | 1080 | /* Battletoads is very fussy about the vblank flag |
| 1081 | 1081 | it wants it to be 1. in scanline 224 */ |
| r1293 | r1294 | |
| 1241 | 1241 | |
| 1242 | 1242 | |
| 1243 | 1243 | |
| 1244 | UINT16 megadriv_read_hv_counters(void) | |
| 1244 | static UINT16 megadriv_read_hv_counters(void) | |
| 1245 | 1245 | { |
| 1246 | 1246 | /* Bubble and Squeek wants vcount=0xe0 */ |
| 1247 | 1247 | /* Dracula is very sensitive to this */ |
| r1293 | r1294 | |
| 1411 | 1411 | } |
| 1412 | 1412 | } |
| 1413 | 1413 | |
| 1414 | static | |
| 1414 | static | |
| 1415 | 1415 | static int io_stage[2]; |
| 1416 | 1416 | |
| 1417 | 1417 | static TIMER_CALLBACK( io_timeout0_timer_callback ) |
| r1293 | r1294 | |
| 1425 | 1425 | } |
| 1426 | 1426 | |
| 1427 | 1427 | |
| 1428 | void init_megadri6_io(void) | |
| 1428 | static void init_megadri6_io(void) | |
| 1429 | 1429 | { |
| 1430 | io_timeout[0] = | |
| 1430 | io_timeout[0] = | |
| 1431 | 1431 | io_stage[0] = -1; |
| 1432 | 1432 | |
| 1433 | io_timeout[1] = | |
| 1433 | io_timeout[1] = | |
| 1434 | 1434 | io_stage[1] = -1; |
| 1435 | 1435 | |
| 1436 | 1436 | } |
| r1293 | r1294 | |
| 1724 | 1724 | #define UP_BUTTON(player) ( (readinputport(player) & 0x01) >> 0 ) |
| 1725 | 1725 | #define MD_RESET_BUTTON ( (readinputportbytag_safe("RESET",0x00) & 0x01) >> 0 ) |
| 1726 | 1726 | |
| 1727 | UINT8 megadrive_io_data_regs[3]; | |
| 1728 | UINT8 megadrive_io_ctrl_regs[3]; | |
| 1729 | UINT8 megadrive_io_tx_regs[3]; | |
| 1727 | static UINT8 megadrive_io_data_regs[3]; | |
| 1728 | static UINT8 megadrive_io_ctrl_regs[3]; | |
| 1729 | static UINT8 megadrive_io_tx_regs[3]; | |
| 1730 | 1730 | |
| 1731 | void megadrive_init_io(running_machine *machine) | |
| 1731 | static void megadrive_init_io(running_machine *machine) | |
| 1732 | 1732 | { |
| 1733 | 1733 | megadrive_io_data_regs[0] = 0x7f; |
| 1734 | 1734 | megadrive_io_data_regs[1] = 0x7f; |
| r1293 | r1294 | |
| 1748 | 1748 | } |
| 1749 | 1749 | |
| 1750 | 1750 | /************* 6 button version **************************/ |
| 1751 | UINT8 megadrive_io_read_data_port_6button(int portnum) | |
| 1751 | static UINT8 megadrive_io_read_data_port_6button(int portnum) | |
| 1752 | 1752 | { |
| 1753 | 1753 | UINT8 retdata; |
| 1754 | 1754 | |
| r1293 | r1294 | |
| 1822 | 1822 | } |
| 1823 | 1823 | /************* end 6 button version ********************************************/ |
| 1824 | 1824 | |
| 1825 | UINT8 megadrive_io_read_data_port_3button(int portnum) | |
| 1825 | static UINT8 megadrive_io_read_data_port_3button(int portnum) | |
| 1826 | 1826 | { |
| 1827 | 1827 | UINT8 retdata; |
| 1828 | 1828 | |
| r1293 | r1294 | |
| 1924 | 1924 | (LEFT_BUTTON(1) << 0); |
| 1925 | 1925 | } |
| 1926 | 1926 | |
| 1927 | UINT8 megadrive_io_read_ctrl_port(int portnum) | |
| 1927 | static UINT8 megadrive_io_read_ctrl_port(int portnum) | |
| 1928 | 1928 | { |
| 1929 | 1929 | UINT8 retdata; |
| 1930 | 1930 | retdata = megadrive_io_ctrl_regs[portnum]; |
| r1293 | r1294 | |
| 1933 | 1933 | return retdata|(retdata<<8); |
| 1934 | 1934 | } |
| 1935 | 1935 | |
| 1936 | UINT8 megadrive_io_read_tx_port(int portnum) | |
| 1936 | static UINT8 megadrive_io_read_tx_port(int portnum) | |
| 1937 | 1937 | { |
| 1938 | 1938 | UINT8 retdata; |
| 1939 | 1939 | retdata = megadrive_io_tx_regs[portnum]; |
| 1940 | 1940 | return retdata|(retdata<<8); |
| 1941 | 1941 | } |
| 1942 | 1942 | |
| 1943 | UINT8 megadrive_io_read_rx_port(int portnum) | |
| 1943 | static UINT8 megadrive_io_read_rx_port(int portnum) | |
| 1944 | 1944 | { |
| 1945 | 1945 | return 0x00; |
| 1946 | 1946 | } |
| 1947 | 1947 | |
| 1948 | UINT8 megadrive_io_read_sctrl_port(int portnum) | |
| 1948 | static UINT8 megadrive_io_read_sctrl_port(int portnum) | |
| 1949 | 1949 | { |
| 1950 | 1950 | return 0x00; |
| 1951 | 1951 | } |
| r1293 | r1294 | |
| 2017 | 2017 | } |
| 2018 | 2018 | |
| 2019 | 2019 | |
| 2020 | void megadrive_io_write_data_port_3button(int portnum, UINT16 data) | |
| 2020 | static void megadrive_io_write_data_port_3button(int portnum, UINT16 data) | |
| 2021 | 2021 | { |
| 2022 | 2022 | megadrive_io_data_regs[portnum] = data; |
| 2023 | 2023 | //mame_printf_debug("Writing IO Data Register #%d data %04x\n",portnum,data); |
| r1293 | r1294 | |
| 2027 | 2027 | |
| 2028 | 2028 | /******************************6 button version*****************************/ |
| 2029 | 2029 | |
| 2030 | void megadrive_io_write_data_port_6button(int portnum, UINT16 data) | |
| 2030 | static void megadrive_io_write_data_port_6button(int portnum, UINT16 data) | |
| 2031 | 2031 | { |
| 2032 | 2032 | if (megadrive_io_ctrl_regs[portnum]&0x40) |
| 2033 | 2033 | { |
| 2034 | 2034 | if (((megadrive_io_data_regs[portnum]&0x40)==0x00) && ((data&0x40) == 0x40)) |
| 2035 | 2035 | { |
| 2036 | 2036 | io_stage[portnum]++; |
| 2037 | | |
| 2037 | | |
| 2038 | 2038 | } |
| 2039 | 2039 | |
| 2040 | 2040 | } |
| r1293 | r1294 | |
| 2046 | 2046 | |
| 2047 | 2047 | /***************************end 6 button version ****************************/ |
| 2048 | 2048 | |
| 2049 | void megadrive_io_write_ctrl_port(int portnum, UINT16 data) | |
| 2049 | static void megadrive_io_write_ctrl_port(int portnum, UINT16 data) | |
| 2050 | 2050 | { |
| 2051 | 2051 | megadrive_io_ctrl_regs[portnum] = data; |
| 2052 | 2052 | // mame_printf_debug("Setting IO Control Register #%d data %04x\n",portnum,data); |
| 2053 | 2053 | } |
| 2054 | 2054 | |
| 2055 | void megadrive_io_write_tx_port(int portnum, UINT16 data) | |
| 2055 | static void megadrive_io_write_tx_port(int portnum, UINT16 data) | |
| 2056 | 2056 | { |
| 2057 | 2057 | megadrive_io_tx_regs[portnum] = data; |
| 2058 | 2058 | } |
| 2059 | 2059 | |
| 2060 | void megadrive_io_write_rx_port(int portnum, UINT16 data) | |
| 2060 | static void megadrive_io_write_rx_port(int portnum, UINT16 data) | |
| 2061 | 2061 | { |
| 2062 | 2062 | |
| 2063 | 2063 | } |
| 2064 | 2064 | |
| 2065 | void megadrive_io_write_sctrl_port(int portnum, UINT16 data) | |
| 2065 | static void megadrive_io_write_sctrl_port(int portnum, UINT16 data) | |
| 2066 | 2066 | { |
| 2067 | 2067 | |
| 2068 | 2068 | } |
| r1293 | r1294 | |
| 2477 | 2477 | return mame_rand(Machine); |
| 2478 | 2478 | } |
| 2479 | 2479 | |
| 2480 | UINT16 _32x_68k_comms[0x8]; | |
| 2481 | UINT16 _32x_palette[0x400/2]; | |
| 2480 | static UINT16 _32x_68k_comms[0x8]; | |
| 2481 | static UINT16 _32x_palette[0x400/2]; | |
| 2482 | 2482 | |
| 2483 | 2483 | static READ16_HANDLER( _32x_68k_comms_r ) |
| 2484 | 2484 | { |
| r1293 | r1294 | |
| 2572 | 2572 | /****************************************** END 32X related *************************************/ |
| 2573 | 2573 | |
| 2574 | 2574 | |
| 2575 | static | |
| 2575 | static | |
| 2576 | 2576 | |
| 2577 | 2577 | |
| 2578 | 2578 | VIDEO_START(megadriv) |
| r1293 | r1294 | |
| 2622 | 2622 | // int xxx; |
| 2623 | 2623 | /* reference */ |
| 2624 | 2624 | |
| 2625 | // time_elapsed_since_crap = mame_timer_timeelapsed(frame_timer); | |
| 2626 | // xxx = MAME_TIME_TO_CYCLES(0,time_elapsed_since_crap); | |
| 2627 | // mame_printf_debug("update cycles %d, %08x %08x\n",xxx, (UINT32)(time_elapsed_since_crap.subseconds>>32),(UINT32)(time_elapsed_since_crap.subseconds&0xffffffff)); | |
| 2625 | // time_elapsed_since_crap = timer_timeelapsed(frame_timer); | |
| 2626 | // xxx = ATTOTIME_TO_CYCLES(0,time_elapsed_since_crap); | |
| 2627 | // mame_printf_debug("update cycles %d, %08x %08x\n",xxx, (UINT32)(time_elapsed_since_crap.attoseconds>>32),(UINT32)(time_elapsed_since_crap.attoseconds&0xffffffff)); | |
| 2628 | 2628 | |
| 2629 | 2629 | return 0; |
| 2630 | 2630 | } |
| r1293 | r1294 | |
| 2675 | 2675 | |
| 2676 | 2676 | */ |
| 2677 | 2677 | |
| 2678 | void genesis_render_spriteline_to_spritebuffer(int scanline) | |
| 2678 | static void genesis_render_spriteline_to_spritebuffer(int scanline) | |
| 2679 | 2679 | { |
| 2680 | 2680 | int screenwidth; |
| 2681 | 2681 | int maxsprites=0; |
| r1293 | r1294 | |
| 2866 | 2866 | } |
| 2867 | 2867 | |
| 2868 | 2868 | /* Clean up this function (!) */ |
| 2869 | void genesis_render_videoline_to_videobuffer(int scanline) | |
| 2869 | static void genesis_render_videoline_to_videobuffer(int scanline) | |
| 2870 | 2870 | { |
| 2871 | 2871 | UINT16 base_a; |
| 2872 | 2872 | UINT16 base_w=0; |
| r1293 | r1294 | |
| 3879 | 3879 | } |
| 3880 | 3880 | |
| 3881 | 3881 | /* This converts our render buffer to real screen colours */ |
| 3882 | void genesis_render_videobuffer_to_screenbuffer(running_machine *machine, int scanline) | |
| 3882 | static void genesis_render_videobuffer_to_screenbuffer(running_machine *machine, int scanline) | |
| 3883 | 3883 | { |
| 3884 | 3884 | UINT16*lineptr; |
| 3885 | 3885 | int x; |
| r1293 | r1294 | |
| 3934 | 3934 | |
| 3935 | 3935 | } |
| 3936 | 3936 | |
| 3937 | void genesis_render_scanline(running_machine *machine, int scanline) | |
| 3937 | static void genesis_render_scanline(running_machine *machine, int scanline) | |
| 3938 | 3938 | { |
| 3939 | 3939 | //if (MEGADRIVE_REG01_DMA_ENABLE==0) mame_printf_debug("off\n"); |
| 3940 | 3940 | genesis_render_spriteline_to_spritebuffer(genesis_scanline_counter); |
| r1293 | r1294 | |
| 3947 | 3947 | // static int lowest = 99999; |
| 3948 | 3948 | // static int highest = -99999; |
| 3949 | 3949 | |
| 3950 | | |
| 3950 | | |
| 3951 | 3951 | UINT16 value4; |
| 3952 | 3952 | |
| 3953 | time_elapsed_since_scanline_timer = | |
| 3953 | time_elapsed_since_scanline_timer = | |
| 3954 | 3954 | |
| 3955 | if (time_elapsed_since_scanline_timer.s | |
| 3955 | if (time_elapsed_since_scanline_timer.attos | |
| 3956 | 3956 | { |
| 3957 | value4 = (UINT16)(megadrive_max_hposition*((double)(time_elapsed_since_scanline_timer.s | |
| 3957 | value4 = (UINT16)(megadrive_max_hposition*((double)(time_elapsed_since_scanline_timer.attos | |
| 3958 | 3958 | } |
| 3959 | 3959 | else /* in some cases (probably due to rounding errors) we get some stupid results (the odd huge value where the time elapsed is much higher than the scanline time??!).. hopefully by clamping the result to the maximum we limit errors */ |
| 3960 | 3960 | { |
| r1293 | r1294 | |
| 4238 | 4238 | |
| 4239 | 4239 | static int irq4counter = -1; |
| 4240 | 4240 | |
| 4241 | static | |
| 4241 | static | |
| 4242 | 4242 | |
| 4243 | 4243 | static TIMER_CALLBACK( render_timer_callback ) |
| 4244 | 4244 | { |
| r1293 | r1294 | |
| 4267 | 4267 | { |
| 4268 | 4268 | genesis_scanline_counter++; |
| 4269 | 4269 | // mame_printf_debug("scanline %d\n",genesis_scanline_counter); |
| 4270 | mame_timer_adjust(scanline_timer, scale_down_mame_time(MAME_TIME_IN_HZ(megadriv_framerate), megadrive_total_scanlines), 0, time_zero); | |
| 4271 | mame_timer_adjust(render_timer, MAME_TIME_IN_USEC(1), 0, time_zero); | |
| 4270 | timer_adjust(scanline_timer, attotime_div(ATTOTIME_IN_HZ(megadriv_framerate), megadrive_total_scanlines), 0, attotime_zero); | |
| 4271 | timer_adjust(render_timer, ATTOTIME_IN_USEC(1), 0, attotime_zero); | |
| 4272 | 4272 | |
| 4273 | 4273 | if (genesis_scanline_counter==megadrive_irq6_scanline ) |
| 4274 | 4274 | { |
| 4275 | 4275 | // mame_printf_debug("x %d",genesis_scanline_counter); |
| 4276 | | |
| 4276 | | |
| 4277 | 4277 | megadrive_irq6_pending = 1; |
| 4278 | 4278 | megadrive_vblank_flag = 1; |
| 4279 | 4279 | } |
| r1293 | r1294 | |
| 4300 | 4300 | |
| 4301 | 4301 | if (MEGADRIVE_REG0_IRQ4_ENABLE) |
| 4302 | 4302 | { |
| 4303 | | |
| 4303 | | |
| 4304 | 4304 | //mame_printf_debug("irq4 on scanline %d reload %d\n",genesis_scanline_counter,MEGADRIVE_REG0A_HINT_VALUE); |
| 4305 | 4305 | } |
| 4306 | 4306 | } |
| r1293 | r1294 | |
| 4311 | 4311 | else irq4counter=MEGADRIVE_REG0A_HINT_VALUE; |
| 4312 | 4312 | } |
| 4313 | 4313 | |
| 4314 | //if (genesis_scanline_counter==0) | |
| 4314 | //if (genesis_scanline_counter==0) | |
| 4315 | 4315 | |
| 4316 | 4316 | |
| 4317 | 4317 | |
| r1293 | r1294 | |
| 4353 | 4353 | |
| 4354 | 4354 | /*****************************************************************************************/ |
| 4355 | 4355 | |
| 4356 | int hazemdchoice_megadrive_region_export; | |
| 4357 | int hazemdchoice_megadrive_region_pal; | |
| 4358 | int hazemdchoice_megadriv_framerate; | |
| 4356 | static int hazemdchoice_megadrive_region_export; | |
| 4357 | static int hazemdchoice_megadrive_region_pal; | |
| 4358 | static int hazemdchoice_megadriv_framerate; | |
| 4359 | 4359 | |
| 4360 | 4360 | MACHINE_RESET( megadriv ) |
| 4361 | 4361 | { |
| r1293 | r1294 | |
| 4407 | 4407 | |
| 4408 | 4408 | megadrive_init_io(machine); |
| 4409 | 4409 | |
| 4410 | frame_timer = mame_timer_alloc(frame_timer_callback); | |
| 4411 | scanline_timer = mame_timer_alloc(scanline_timer_callback); | |
| 4412 | render_timer = mame_timer_alloc(render_timer_callback); | |
| 4410 | frame_timer = timer_alloc(frame_timer_callback); | |
| 4411 | scanline_timer = timer_alloc(scanline_timer_callback); | |
| 4412 | render_timer = timer_alloc(render_timer_callback); | |
| 4413 | 4413 | |
| 4414 | irq6_on_timer = mame_timer_alloc(irq6_on_callback); | |
| 4415 | irq4_on_timer = mame_timer_alloc(irq4_on_callback); | |
| 4414 | irq6_on_timer = timer_alloc(irq6_on_callback); | |
| 4415 | irq4_on_timer = timer_alloc(irq4_on_callback); | |
| 4416 | 4416 | |
| 4417 | mame_timer_adjust(frame_timer, time_zero, 0, time_zero); | |
| 4418 | mame_timer_adjust(scanline_timer, time_zero, 0, time_zero); | |
| 4417 | timer_adjust(frame_timer, attotime_zero, 0, attotime_zero); | |
| 4418 | timer_adjust(scanline_timer, attotime_zero, 0, attotime_zero); | |
| 4419 | 4419 | |
| 4420 | 4420 | // set_refresh_rate(megadriv_framerate); |
| 4421 | 4421 | cpunum_set_clockscale(0, 0.9950f); /* Fatal Rewind is very fussy... */ |
| r1293 | r1294 | |
| 4428 | 4428 | |
| 4429 | 4429 | void megadriv_stop_scanline_timer(void) |
| 4430 | 4430 | { |
| 4431 | | |
| 4431 | | |
| 4432 | 4432 | } |
| 4433 | 4433 | |
| 4434 | 4434 | /* |
| r1293 | r1294 | |
| 4529 | 4529 | visarea.min_y = 0; |
| 4530 | 4530 | visarea.max_y = megadrive_visible_scanlines-1; |
| 4531 | 4531 | |
| 4532 | video_screen_configure(0, scr_width, megadrive_visible_scanlines, &visarea, HZ_TO_ | |
| 4532 | video_screen_configure(0, scr_width, megadrive_visible_scanlines, &visarea, HZ_TO_ATTOSECONDS(megadriv_framerate)); | |
| 4533 | 4533 | |
| 4534 | 4534 | #if 0 |
| 4535 | 4535 | { |
| r1293 | r1294 | |
| 4578 | 4578 | UINT64 frametime; |
| 4579 | 4579 | |
| 4580 | 4580 | // /* reference */ |
| 4581 | frametime = | |
| 4581 | frametime = | |
| 4582 | 4582 | |
| 4583 | time_elapsed_since_crap = mame_timer_timeelapsed(frame_timer); | |
| 4584 | xxx = MAME_TIME_TO_CYCLES(0,time_elapsed_since_crap); | |
| 4585 | //mame_printf_debug("---------- cycles %d, %08x %08x\n",xxx, (UINT32)(time_elapsed_since_crap.subseconds>>32),(UINT32)(time_elapsed_since_crap.subseconds&0xffffffff)); | |
| 4583 | time_elapsed_since_crap = timer_timeelapsed(frame_timer); | |
| 4584 | xxx = ATTOTIME_TO_CYCLES(0,time_elapsed_since_crap); | |
| 4585 | //mame_printf_debug("---------- cycles %d, %08x %08x\n",xxx, (UINT32)(time_elapsed_since_crap.attoseconds>>32),(UINT32)(time_elapsed_since_crap.attoseconds&0xffffffff)); | |
| 4586 | 4586 | //mame_printf_debug("---------- framet %d, %08x %08x\n",xxx, (UINT32)(frametime>>32),(UINT32)(frametime&0xffffffff)); |
| 4587 | 4587 | } |
| 4588 | 4588 | |
| 4589 | mame_timer_adjust(frame_timer, time_zero, 0, time_zero); | |
| 4590 | mame_timer_adjust(scanline_timer, time_zero, 0, time_zero); | |
| 4589 | timer_adjust(frame_timer, attotime_zero, 0, attotime_zero); | |
| 4590 | timer_adjust(scanline_timer, attotime_zero, 0, attotime_zero); | |
| 4591 | 4591 | |
| 4592 | 4592 | } |
| 4593 | 4593 | |
| r1293 | r1294 | |
| 4694 | 4694 | |
| 4695 | 4695 | |
| 4696 | 4696 | /* Callback when the genesis enters interrupt code */ |
| 4697 | int genesis_int_callback (int irq) | |
| 4697 | static int genesis_int_callback (int irq) | |
| 4698 | 4698 | { |
| 4699 | 4699 | if (irq==4) |
| 4700 | 4700 | { |
| r1293 | r1294 | |
| 4715 | 4715 | return 0; // writeback not allowed |
| 4716 | 4716 | } |
| 4717 | 4717 | |
| 4718 | void megadriv_init_common(running_machine *machine) | |
| 4718 | static void megadriv_init_common(running_machine *machine) | |
| 4719 | 4719 | { |
| 4720 | 4720 | genz80.z80_cpunum = 1; |
| 4721 | 4721 | genz80.z80_prgram = auto_malloc(0x2000); |
| r1293 | r1294 | |
|---|---|---|
| 76 | 76 | |
| 77 | 77 | static UINT16 *galpani3_sprregs, *galpani3_spriteram; |
| 78 | 78 | |
| 79 | INTERRUPT_GEN( galpani3_vblank ) // 2, 3, 5 ? | |
| 79 | static INTERRUPT_GEN( galpani3_vblank ) // 2, 3, 5 ? | |
| 80 | 80 | { |
| 81 | 81 | switch ( cpu_getiloops() ) |
| 82 | 82 | { |
| r1293 | r1294 | |
| 197 | 197 | ***************************************************************************/ |
| 198 | 198 | static UINT16 *mcu_ram, galpani3_mcu_com[4]; |
| 199 | 199 | |
| 200 | void galpani3_mcu_run(void) | |
| 200 | static void galpani3_mcu_run(void) | |
| 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 */ |
| r1293 | r1294 | |
|---|---|---|
| 390 | 390 | { |
| 391 | 391 | static int effx, effy; |
| 392 | 392 | static int lastresult; |
| 393 | static mame_time lasttime; | |
| 394 | mame_time curtime = mame_timer_get_time(); | |
| 393 | static attotime lasttime; | |
| 394 | attotime curtime = timer_get_time(); | |
| 395 | 395 | |
| 396 | if (compare | |
| 396 | if (attotime_compare( | |
| 397 | 397 | { |
| 398 | 398 | int upper, lower; |
| 399 | 399 | int dx, dy; |
| r1293 | r1294 | |
| 429 | 429 | { |
| 430 | 430 | static int effx, effy; |
| 431 | 431 | static int lastresult; |
| 432 | static mame_time lasttime; | |
| 433 | mame_time curtime = mame_timer_get_time(); | |
| 432 | static attotime lasttime; | |
| 433 | attotime curtime = timer_get_time(); | |
| 434 | 434 | |
| 435 | if (compare | |
| 435 | if (attotime_compare( | |
| 436 | 436 | { |
| 437 | 437 | int upper, lower; |
| 438 | 438 | int dx, dy; |
| r1293 | r1294 | |
| 709 | 709 | if (offset == 0) COMBINE_DATA(tms1_boot); |
| 710 | 710 | if (offset == 0x382 && tms_spinning[0]) STOP_TMS_SPINNING(0); |
| 711 | 711 | if (!tms_spinning[0]) |
| 712 | cpu_boost_interleave( | |
| 712 | cpu_boost_interleave( | |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | |
| r1293 | r1294 | |
| 718 | 718 | COMBINE_DATA(&tms2_ram[offset]); |
| 719 | 719 | if (offset == 0x382 && tms_spinning[1]) STOP_TMS_SPINNING(1); |
| 720 | 720 | if (!tms_spinning[1]) |
| 721 | cpu_boost_interleave( | |
| 721 | cpu_boost_interleave( | |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | |
| 725 | 725 | static WRITE32_HANDLER( tms1_trigger_w ) |
| 726 | 726 | { |
| 727 | 727 | COMBINE_DATA(&tms1_ram[offset]); |
| 728 | cpu_boost_interleave( | |
| 728 | cpu_boost_interleave( | |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | |
| 732 | 732 | static WRITE32_HANDLER( tms2_trigger_w ) |
| 733 | 733 | { |
| 734 | 734 | COMBINE_DATA(&tms2_ram[offset]); |
| 735 | cpu_boost_interleave( | |
| 735 | cpu_boost_interleave( | |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 |
| r1293 | r1294 | |
|---|---|---|
| 225 | 225 | MDRV_CPU_VBLANK_INT(irq0_line_assert, 1) |
| 226 | 226 | |
| 227 | 227 | MDRV_SCREEN_REFRESH_RATE(59.39) |
| 228 | MDRV_SCREEN_VBLANK_TIME( | |
| 228 | MDRV_SCREEN_VBLANK_TIME(A | |
| 229 | 229 | |
| 230 | 230 | /* video hardware */ |
| 231 | 231 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 15 | 15 | #include "driver.h" |
| 16 | 16 | #include "sound/ay8910.h" |
| 17 | 17 | |
| 18 | UINT8 mouser_sound_byte; | |
| 19 | UINT8 mouser_nmi_enable; | |
| 18 | static UINT8 mouser_sound_byte; | |
| 19 | static UINT8 mouser_nmi_enable; | |
| 20 | 20 | |
| 21 | 21 | /* From "video/mouser.c" */ |
| 22 | 22 | PALETTE_INIT( mouser ); |
| r1293 | r1294 | |
| 34 | 34 | mouser_nmi_enable = data; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | INTERRUPT_GEN( mouser_nmi_interrupt ) | |
| 37 | static INTERRUPT_GEN( mouser_nmi_interrupt ) | |
| 38 | 38 | { |
| 39 | 39 | if ((mouser_nmi_enable & 1) == 1) |
| 40 | 40 | nmi_line_pulse(); |
| r1293 | r1294 | |
|---|---|---|
| 134 | 134 | extern UINT16 undrfire_rotate_ctrl[8]; |
| 135 | 135 | static int frame_counter=0; |
| 136 | 136 | |
| 137 | UINT32 *undrfire_ram; /* will be read in video for gun target calcs */ | |
| 137 | static UINT32 *undrfire_ram; /* will be read in video for gun target calcs */ | |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | /*********************************************************** |
| r1293 | r1294 | |
| 295 | 295 | static WRITE32_HANDLER( unknown_int_req_w ) |
| 296 | 296 | { |
| 297 | 297 | /* 10000 cycle delay is arbitrary */ |
| 298 | | |
| 298 | | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 |
| r1293 | r1294 | |
|---|---|---|
| 470 | 470 | MDRV_CPU_IO_MAP(readport,writeport) |
| 471 | 471 | |
| 472 | 472 | MDRV_SCREEN_REFRESH_RATE(50) |
| 473 | //MDRV_SCREEN_VBLANK_TIME( | |
| 473 | //MDRV_SCREEN_VBLANK_TIME(A | |
| 474 | 474 | |
| 475 | 475 | /* video hardware */ |
| 476 | 476 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 237 | 237 | |
| 238 | 238 | static UINT32 *deco32_ram; |
| 239 | 239 | static int raster_enable; |
| 240 | static | |
| 240 | static | |
| 241 | 241 | static UINT8 nslasher_sound_irq; |
| 242 | 242 | |
| 243 | 243 | extern void decrypt156(void); |
| r1293 | r1294 | |
| 304 | 304 | case 1: /* Raster IRQ scanline position, only valid for values between 1 & 239 (0 and 240-256 do NOT generate IRQ's) */ |
| 305 | 305 | scanline=(data&0xff); |
| 306 | 306 | if (raster_enable && scanline>0 && scanline<240) |
| 307 | | |
| 307 | | |
| 308 | 308 | else |
| 309 | | |
| 309 | | |
| 310 | 310 | break; |
| 311 | 311 | case 2: /* VBL irq ack */ |
| 312 | 312 | break; |
| r1293 | r1294 | |
| 1859 | 1859 | |
| 1860 | 1860 | static MACHINE_RESET( deco32 ) |
| 1861 | 1861 | { |
| 1862 | raster_irq_timer = | |
| 1862 | raster_irq_timer = | |
| 1863 | 1863 | } |
| 1864 | 1864 | |
| 1865 | 1865 | static INTERRUPT_GEN( deco32_vbl_interrupt ) |
| r1293 | r1294 | |
|---|---|---|
| 23 | 23 | #include "audio/dcs.h" |
| 24 | 24 | |
| 25 | 25 | |
| 26 | #define CPU_CLOCK 60000000 | |
| 27 | ||
| 28 | ||
| 26 | 29 | static UINT32 *ram_base; |
| 27 | 30 | static UINT8 cmos_protected; |
| 28 | 31 | |
| 29 | static | |
| 32 | static | |
| 30 | 33 | |
| 31 | 34 | static UINT32 *tms32031_control; |
| 32 | 35 | |
| r1293 | r1294 | |
| 44 | 47 | |
| 45 | 48 | *(UINT32 *)ram_base *= 2; |
| 46 | 49 | |
| 47 | timer[0] = mame_timer_alloc(NULL); | |
| 48 | timer[1] = mame_timer_alloc(NULL); | |
| 50 | timer[0] = timer_alloc(NULL); | |
| 51 | timer[1] = timer_alloc(NULL); | |
| 49 | 52 | } |
| 50 | 53 | |
| 51 | 54 | |
| r1293 | r1294 | |
| 89 | 92 | { |
| 90 | 93 | /* timer is clocked at 100ns */ |
| 91 | 94 | int which = (offset >> 4) & 1; |
| 92 | INT32 result = | |
| 95 | INT32 result = | |
| 93 | 96 | return result; |
| 94 | 97 | } |
| 95 | 98 | |
| r1293 | r1294 | |
| 114 | 117 | { |
| 115 | 118 | int which = (offset >> 4) & 1; |
| 116 | 119 | if (data & 0x40) |
| 117 | | |
| 120 | | |
| 118 | 121 | } |
| 119 | 122 | else |
| 120 | 123 | logerror("%06X:tms32031_control_w(%02X) = %08X\n", activecpu_get_pc(), offset, data); |
| r1293 | r1294 | |
| 149 | 152 | AM_RANGE(0x000000, 0x03ffff) AM_RAM AM_BASE(&ram_base) |
| 150 | 153 | AM_RANGE(0x400000, 0x41ffff) AM_RAM |
| 151 | 154 | AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(&tms32031_control) |
| 152 | AM_RANGE(0x87fe00, 0x87ffff) AM_RAM | |
| 153 | 155 | AM_RANGE(0x880000, 0x8803ff) AM_READWRITE(zeus_r, zeus_w) AM_BASE(&zeusbase) |
| 154 | 156 | AM_RANGE(0x8d0000, 0x8d0003) AM_READWRITE(unknown_8d0000_r, unknown_8d0000_w) AM_BASE(&unknown_8d0000) |
| 155 | 157 | AM_RANGE(0x990000, 0x99000f) AM_READWRITE(midway_ioasic_r, midway_ioasic_w) |
| r1293 | r1294 | |
| 166 | 168 | AM_RANGE(0x000000, 0x03ffff) AM_RAM AM_BASE(&ram_base) |
| 167 | 169 | AM_RANGE(0x400000, 0x43ffff) AM_RAM |
| 168 | 170 | AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(&tms32031_control) |
| 169 | AM_RANGE(0x87fe00, 0x87ffff) AM_RAM | |
| 170 | 171 | AM_RANGE(0x880000, 0x8801ff) AM_READWRITE(zeus2_r, zeus2_w) AM_BASE(&zeusbase) |
| 171 | 172 | AM_RANGE(0x8d0000, 0x8d0003) AM_READWRITE(unknown_8d0000_r, unknown_8d0000_w) AM_BASE(&unknown_8d0000) |
| 172 | 173 | AM_RANGE(0x990000, 0x99000f) AM_READWRITE(midway_ioasic_r, midway_ioasic_w) |
| r1293 | r1294 | |
| 617 | 618 | * |
| 618 | 619 | *************************************/ |
| 619 | 620 | |
| 620 | MACHINE_DRIVER_START( midzeus ) | |
| 621 | static MACHINE_DRIVER_START( midzeus ) | |
| 621 | 622 | |
| 622 | 623 | /* basic machine hardware */ |
| 623 | MDRV_CPU_ADD_TAG("main", TMS3203 | |
| 624 | MDRV_CPU_ADD_TAG("main", TMS32032, CPU_CLOCK) | |
| 624 | 625 | MDRV_CPU_PROGRAM_MAP(zeus_map,0) |
| 625 | 626 | MDRV_CPU_VBLANK_INT(irq0_line_assert,1) |
| 626 | 627 | |
| r1293 | r1294 | |
| 645 | 646 | MACHINE_DRIVER_END |
| 646 | 647 | |
| 647 | 648 | |
| 648 | MACHINE_DRIVER_START( midzeus2 ) | |
| 649 | static MACHINE_DRIVER_START( midzeus2 ) | |
| 649 | 650 | MDRV_IMPORT_FROM(midzeus) |
| 650 | 651 | |
| 651 | 652 | /* basic machine hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 22 | 22 | |
| 23 | 23 | /* Video Handling */ |
| 24 | 24 | |
| 25 | UINT16 *bestleag_txram,*bestleag_bgram,*bestleag_fgram,*bestleag_vregs; | |
| 25 | static UINT16 *bestleag_txram,*bestleag_bgram,*bestleag_fgram,*bestleag_vregs; | |
| 26 | 26 | static tilemap *tx_tilemap,*bg_tilemap,*fg_tilemap; |
| 27 | 27 | |
| 28 | 28 | static TILE_GET_INFO( get_tx_tile_info ) |
| r1293 | r1294 | |
|---|---|---|
| 426 | 426 | n64_machine_reset(); |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | MACHINE_DRIVER_START( aleck64 ) | |
| 429 | static MACHINE_DRIVER_START( aleck64 ) | |
| 430 | 430 | /* basic machine hardware */ |
| 431 | 431 | MDRV_CPU_ADD(R4600BE, 93750000) |
| 432 | 432 | MDRV_CPU_CONFIG(config) |
| r1293 | r1294 | |
|---|---|---|
| 69 | 69 | static UINT8 *astrof_colorram; |
| 70 | 70 | static UINT8 *tomahawk_protection; |
| 71 | 71 | |
| 72 | static | |
| 72 | static | |
| 73 | 73 | |
| 74 | 74 | static UINT8 *astrof_color; |
| 75 | 75 | static UINT8 astrof_palette_bank; |
| r1293 | r1294 | |
| 99 | 99 | { |
| 100 | 100 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| 101 | 101 | |
| 102 | | |
| 102 | | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | static void create_irq_timer(void) |
| 107 | 107 | { |
| 108 | irq_timer = | |
| 108 | irq_timer = | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | static void start_irq_timer(void) |
| 113 | 113 | { |
| 114 | | |
| 114 | | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 |
| r1293 | r1294 | |
|---|---|---|
| 31 | 31 | static UINT8 portB_in,portB_out,ddrB; |
| 32 | 32 | static UINT8 portC_in,portC_out,ddrC; |
| 33 | 33 | static UINT8 tdr,tcr; |
| 34 | static | |
| 34 | static | |
| 35 | 35 | |
| 36 | 36 | /* Port A: |
| 37 | 37 | 0 (in) DSW |
| r1293 | r1294 | |
| 182 | 182 | if ( (tcr & 0x40) == 0 ) |
| 183 | 183 | { |
| 184 | 184 | int divider; |
| 185 | | |
| 185 | | |
| 186 | 186 | |
| 187 | 187 | if ( !(tcr & 0x20) ) |
| 188 | 188 | { |
| r1293 | r1294 | |
| 201 | 201 | divider = divider * (1 << (tcr & 0x7)); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | period = scale_up_mame_time(MAME_TIME_IN_HZ(3579545), divider); | |
| 205 | mame_timer_adjust( mcu_timer, period, 0, period); | |
| 204 | period = attotime_mul(ATTOTIME_IN_HZ(3579545), divider); | |
| 205 | timer_adjust( mcu_timer, period, 0, period); | |
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| r1293 | r1294 | |
| 212 | 212 | portB_in = portB_out = ddrB = 0; |
| 213 | 213 | portC_in = portC_out = ddrC = 0; |
| 214 | 214 | tdr = tcr = 0; |
| 215 | mcu_timer = | |
| 215 | mcu_timer = | |
| 216 | 216 | |
| 217 | 217 | output_set_lamp_value(0, 0); |
| 218 | 218 | output_set_lamp_value(1, 0); |
| r1293 | r1294 | |
| 434 | 434 | MDRV_CPU_ADD_TAG("main", M6502, FREQ_17_EXACT) |
| 435 | 435 | MDRV_CPU_PROGRAM_MAP(a600xl_mem, 0) |
| 436 | 436 | MDRV_CPU_VBLANK_INT(a800xl_interrupt, TOTAL_LINES_60HZ) |
| 437 | MDRV_SCREEN_VBLANK_TIME( | |
| 437 | MDRV_SCREEN_VBLANK_TIME(A | |
| 438 | 438 | |
| 439 | 439 | MDRV_CPU_ADD(M68705, 3579545/M68705_CLOCK_DIVIDER) |
| 440 | 440 | MDRV_CPU_PROGRAM_MAP(mcu_mem,0) |
| r1293 | r1294 | |
|---|---|---|
| 306 | 306 | *************************************/ |
| 307 | 307 | |
| 308 | 308 | #define SYSTEM_CLOCK 100000000 |
| 309 | #define TIMER_PERIOD | |
| 309 | #define TIMER_PERIOD | |
| 310 | 310 | |
| 311 | 311 | #define MAX_DYNAMIC_ADDRESSES 32 |
| 312 | 312 | |
| r1293 | r1294 | |
| 458 | 458 | static UINT32 pci_ide_regs[0x40]; |
| 459 | 459 | static UINT32 pci_3dfx_regs[0x40]; |
| 460 | 460 | |
| 461 | static | |
| 461 | static | |
| 462 | 462 | |
| 463 | 463 | static UINT8 vblank_state; |
| 464 | 464 | |
| r1293 | r1294 | |
| 576 | 576 | cpunum_set_info_int(0, CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1); |
| 577 | 577 | |
| 578 | 578 | /* allocate timers for the NILE */ |
| 579 | timer[0] = mame_timer_alloc(NULL); | |
| 580 | timer[1] = mame_timer_alloc(NULL); | |
| 581 | timer[2] = mame_timer_alloc(timer_callback); | |
| 582 | timer[3] = mame_timer_alloc(timer_callback); | |
| 579 | timer[0] = timer_alloc(NULL); | |
| 580 | timer[1] = timer_alloc(NULL); | |
| 581 | timer[2] = timer_alloc(timer_callback); | |
| 582 | timer[3] = timer_alloc(timer_callback); | |
| 583 | 583 | |
| 584 | 584 | /* reset dynamic addressing */ |
| 585 | 585 | memset(nile_regs, 0, 0x1000); |
| r1293 | r1294 | |
| 964 | 964 | if (regs[1] & 2) |
| 965 | 965 | logerror("Unexpected value: timer %d is prescaled\n", which); |
| 966 | 966 | if (scale != 0) |
| 967 | | |
| 967 | | |
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | /* trigger the interrupt */ |
| r1293 | r1294 | |
| 1047 | 1047 | { |
| 1048 | 1048 | if (nile_regs[offset] & 2) |
| 1049 | 1049 | logerror("Unexpected value: timer %d is prescaled\n", which); |
| 1050 | result = nile_regs[offset + 1] = | |
| 1050 | result = nile_regs[offset + 1] = | |
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | if (LOG_TIMERS) logerror("%08X:NILE READ: timer %d counter(%03X) = %08X\n", activecpu_get_pc(), which, offset*4, result); |
| r1293 | r1294 | |
| 1177 | 1177 | if (nile_regs[offset] & 2) |
| 1178 | 1178 | logerror("Unexpected value: timer %d is prescaled\n", which); |
| 1179 | 1179 | if (scale != 0) |
| 1180 | mame_timer_adjust(timer[which], scale_up_mame_time(TIMER_PERIOD, scale), which, time_never); | |
| 1181 | if (LOG_TIMERS) logerror("Starting timer %d at a rate of %d Hz\n", which, (int)SUBSECONDS_TO_HZ(scale_up_mame_time(TIMER_PERIOD, nile_regs[offset + 1] + 1).subseconds)); | |
| 1180 | timer_adjust(timer[which], attotime_mul(TIMER_PERIOD, scale), which, attotime_never); | |
| 1181 | if (LOG_TIMERS) logerror("Starting timer %d at a rate of %d Hz\n", which, (int)ATTOSECONDS_TO_HZ(attotime_mul(TIMER_PERIOD, nile_regs[offset + 1] + 1).attoseconds)); | |
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | 1184 | /* timer disabled? */ |
| r1293 | r1294 | |
| 1186 | 1186 | { |
| 1187 | 1187 | if (nile_regs[offset] & 2) |
| 1188 | 1188 | logerror("Unexpected value: timer %d is prescaled\n", which); |
| 1189 | nile_regs[offset + 1] = mame_time_to_double(mame_timer_timeleft(timer[which])) * SYSTEM_CLOCK; | |
| 1190 | mame_timer_adjust(timer[which], time_never, which, time_never); | |
| 1189 | nile_regs[offset + 1] = attotime_to_double(timer_timeleft(timer[which])) * SYSTEM_CLOCK; | |
| 1190 | timer_adjust(timer[which], attotime_never, which, attotime_never); | |
| 1191 | 1191 | } |
| 1192 | 1192 | break; |
| 1193 | 1193 | |
| r1293 | r1294 | |
| 1203 | 1203 | { |
| 1204 | 1204 | if (nile_regs[offset - 1] & 2) |
| 1205 | 1205 | logerror("Unexpected value: timer %d is prescaled\n", which); |
| 1206 | | |
| 1206 | | |
| 1207 | 1207 | } |
| 1208 | 1208 | break; |
| 1209 | 1209 | |
| r1293 | r1294 | |
| 2210 | 2210 | SYSTEM_CLOCK /* system clock rate */ |
| 2211 | 2211 | }; |
| 2212 | 2212 | |
| 2213 | MACHINE_DRIVER_START( vegascore ) | |
| 2213 | static MACHINE_DRIVER_START( vegascore ) | |
| 2214 | 2214 | |
| 2215 | 2215 | /* basic machine hardware */ |
| 2216 | 2216 | MDRV_CPU_ADD_TAG("main", R5000LE, SYSTEM_CLOCK*2) |
| r1293 | r1294 | |
| 2233 | 2233 | MACHINE_DRIVER_END |
| 2234 | 2234 | |
| 2235 | 2235 | |
| 2236 | MACHINE_DRIVER_START( vegas ) | |
| 2236 | static MACHINE_DRIVER_START( vegas ) | |
| 2237 | 2237 | MDRV_IMPORT_FROM(vegascore) |
| 2238 | 2238 | MDRV_IMPORT_FROM(dcs2_audio_2104) |
| 2239 | 2239 | MACHINE_DRIVER_END |
| 2240 | 2240 | |
| 2241 | 2241 | |
| 2242 | MACHINE_DRIVER_START( vegas250 ) | |
| 2242 | static MACHINE_DRIVER_START( vegas250 ) | |
| 2243 | 2243 | MDRV_IMPORT_FROM(vegascore) |
| 2244 | 2244 | MDRV_CPU_REPLACE("main", R5000LE, SYSTEM_CLOCK*2.5) |
| 2245 | 2245 | MDRV_IMPORT_FROM(dcs2_audio_2104) |
| 2246 | 2246 | MACHINE_DRIVER_END |
| 2247 | 2247 | |
| 2248 | 2248 | |
| 2249 | MACHINE_DRIVER_START( vegas32m ) | |
| 2249 | static MACHINE_DRIVER_START( vegas32m ) | |
| 2250 | 2250 | MDRV_IMPORT_FROM(vegascore) |
| 2251 | 2251 | MDRV_CPU_MODIFY("main") |
| 2252 | 2252 | MDRV_CPU_PROGRAM_MAP(vegas_map_32mb,0) |
| r1293 | r1294 | |
| 2254 | 2254 | MACHINE_DRIVER_END |
| 2255 | 2255 | |
| 2256 | 2256 | |
| 2257 | MACHINE_DRIVER_START( vegasban ) | |
| 2257 | static MACHINE_DRIVER_START( vegasban ) | |
| 2258 | 2258 | MDRV_IMPORT_FROM(vegascore) |
| 2259 | 2259 | MDRV_CPU_MODIFY("main") |
| 2260 | 2260 | MDRV_CPU_PROGRAM_MAP(vegas_map_32mb,0) |
| r1293 | r1294 | |
| 2263 | 2263 | MACHINE_DRIVER_END |
| 2264 | 2264 | |
| 2265 | 2265 | |
| 2266 | MACHINE_DRIVER_START( vegasv3 ) | |
| 2266 | static MACHINE_DRIVER_START( vegasv3 ) | |
| 2267 | 2267 | MDRV_IMPORT_FROM(vegas32m) |
| 2268 | 2268 | MDRV_CPU_REPLACE("main", RM7000LE, SYSTEM_CLOCK*2.5) |
| 2269 | 2269 | MDRV_VIDEO_START(vegas_voodoo3) |
| 2270 | 2270 | MACHINE_DRIVER_END |
| 2271 | 2271 | |
| 2272 | 2272 | |
| 2273 | MACHINE_DRIVER_START( denver ) | |
| 2273 | static MACHINE_DRIVER_START( denver ) | |
| 2274 | 2274 | MDRV_IMPORT_FROM(vegascore) |
| 2275 | 2275 | MDRV_CPU_REPLACE("main", RM7000LE, SYSTEM_CLOCK*2.5) |
| 2276 | 2276 | MDRV_CPU_PROGRAM_MAP(vegas_map_32mb,0) |
| r1293 | r1294 | |
|---|---|---|
| 13 | 13 | extern VIDEO_UPDATE( kopunch ); |
| 14 | 14 | |
| 15 | 15 | |
| 16 | INTERRUPT_GEN( kopunch_interrupt ) | |
| 16 | static INTERRUPT_GEN( kopunch_interrupt ) | |
| 17 | 17 | { |
| 18 | 18 | if (cpu_getiloops() == 0) |
| 19 | 19 | { |
| r1293 | r1294 | |
|---|---|---|
| 19 | 19 | extern UINT8 *finalizr_videoram2,*finalizr_colorram2; |
| 20 | 20 | static UINT8 *finalizr_interrupt_enable; |
| 21 | 21 | |
| 22 | int finalizr_T1_line; | |
| 22 | static int finalizr_T1_line; | |
| 23 | 23 | |
| 24 | 24 | PALETTE_INIT( finalizr ); |
| 25 | 25 | VIDEO_START( finalizr ); |
| r1293 | r1294 | |
|---|---|---|
| 39 | 39 | |
| 40 | 40 | static UINT16 *backupram; |
| 41 | 41 | |
| 42 | static | |
| 42 | static | |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | |
| r1293 | r1294 | |
| 80 | 80 | cpunum_set_input_line(0, irq, ASSERT_LINE); |
| 81 | 81 | cpunum_set_input_line(1, irq, ASSERT_LINE); |
| 82 | 82 | cpunum_set_input_line(2, irq, ASSERT_LINE); |
| 83 | cpu_boost_interleave(time_zero, | |
| 83 | cpu_boost_interleave(attotime_zero, | |
| 84 | 84 | } |
| 85 | 85 | else |
| 86 | 86 | { |
| r1293 | r1294 | |
| 163 | 163 | update_main_irqs(); |
| 164 | 164 | |
| 165 | 165 | /* come back at the next appropriate scanline */ |
| 166 | | |
| 166 | | |
| 167 | 167 | |
| 168 | 168 | #if TWEAK_IRQ2_SCANLINE |
| 169 | 169 | if (scanline == 223) |
| r1293 | r1294 | |
| 184 | 184 | |
| 185 | 185 | static MACHINE_RESET( yboard ) |
| 186 | 186 | { |
| 187 | interrupt_timer = mame_timer_alloc(scanline_callback); | |
| 188 | mame_timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, 223, 0), 223, time_zero); | |
| 187 | interrupt_timer = timer_alloc(scanline_callback); | |
| 188 | timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, 223, 0), 223, attotime_zero); | |
| 189 | 189 | |
| 190 | 190 | state_save_register_global_array(misc_io_data); |
| 191 | 191 | state_save_register_global_array(analog_data); |
| r1293 | r1294 | |
|---|---|---|
| 67 | 67 | * |
| 68 | 68 | *************************************/ |
| 69 | 69 | |
| 70 | static mame_timer *interrupt_clear_timer; | |
| 71 | static mame_timer *interrupt_assert_timer; | |
| 70 | static emu_timer *interrupt_clear_timer; | |
| 71 | static emu_timer *interrupt_assert_timer; | |
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | INLINE UINT16 vpos_to_vysnc_chain_counter(int vpos) |
| r1293 | r1294 | |
| 107 | 107 | next_counter = INT_TRIGGER_COUNT_1; |
| 108 | 108 | |
| 109 | 109 | next_vpos = vysnc_chain_counter_to_vpos(next_counter); |
| 110 | mame_timer_adjust(interrupt_assert_timer, video_screen_get_time_until_pos(0, next_vpos, 0), 0, time_zero); | |
| 111 | mame_timer_adjust(interrupt_clear_timer, video_screen_get_time_until_pos(0, vpos + 1, 0), 0, time_zero); | |
| 110 | timer_adjust(interrupt_assert_timer, video_screen_get_time_until_pos(0, next_vpos, 0), 0, attotime_zero); | |
| 111 | timer_adjust(interrupt_clear_timer, video_screen_get_time_until_pos(0, vpos + 1, 0), 0, attotime_zero); | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | static void create_interrupt_timers(void) |
| 116 | 116 | { |
| 117 | interrupt_clear_timer = mame_timer_alloc(interrupt_clear_callback); | |
| 118 | interrupt_assert_timer = mame_timer_alloc(interrupt_assert_callback); | |
| 117 | interrupt_clear_timer = timer_alloc(interrupt_clear_callback); | |
| 118 | interrupt_assert_timer = timer_alloc(interrupt_assert_callback); | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | static void start_interrupt_timers(void) |
| 123 | 123 | { |
| 124 | 124 | int vpos = vysnc_chain_counter_to_vpos(INT_TRIGGER_COUNT_1); |
| 125 | | |
| 125 | | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 |
| r1293 | r1294 | |
|---|---|---|
| 186 | 186 | if (irq != 0) |
| 187 | 187 | { |
| 188 | 188 | cpunum_set_input_line(0, irq, ASSERT_LINE); |
| 189 | cpu_boost_interleave(time_zero, | |
| 189 | cpu_boost_interleave(attotime_zero, | |
| 190 | 190 | } |
| 191 | 191 | else |
| 192 | 192 | cpunum_set_input_line(0, 7, CLEAR_LINE); |
| r1293 | r1294 | |
| 213 | 213 | case 65: |
| 214 | 214 | case 129: |
| 215 | 215 | case 193: |
| 216 | | |
| 216 | | |
| 217 | 217 | next_scanline = scanline + 1; |
| 218 | 218 | break; |
| 219 | 219 | |
| r1293 | r1294 | |
| 244 | 244 | update_main_irqs(); |
| 245 | 245 | |
| 246 | 246 | /* come back at the next targeted scanline */ |
| 247 | | |
| 247 | | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
| r1293 | r1294 | |
| 275 | 275 | cpunum_set_info_fct(0, CPUINFO_PTR_M68K_RESET_CALLBACK, (genf *)outrun_reset); |
| 276 | 276 | |
| 277 | 277 | /* start timers to track interrupts */ |
| 278 | | |
| 278 | | |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | |
| r1293 | r1294 | |
| 854 | 854 | MACHINE_DRIVER_END |
| 855 | 855 | |
| 856 | 856 | |
| 857 | MACHINE_DRIVER_START( outrun ) | |
| 857 | static MACHINE_DRIVER_START( outrun ) | |
| 858 | 858 | MDRV_IMPORT_FROM(outrundx) |
| 859 | 859 | MDRV_NVRAM_HANDLER(outrun) |
| 860 | 860 | MACHINE_DRIVER_END |
| 861 | 861 | |
| 862 | 862 | |
| 863 | MACHINE_DRIVER_START( shangon ) | |
| 863 | static MACHINE_DRIVER_START( shangon ) | |
| 864 | 864 | MDRV_IMPORT_FROM(outrun) |
| 865 | 865 | |
| 866 | 866 | MDRV_SCREEN_MODIFY("main") |
| r1293 | r1294 | |
|---|---|---|
| 818 | 818 | static UINT8 irq_timerb; |
| 819 | 819 | static UINT8 irq_allow0, irq_allow1; |
| 820 | 820 | static int irq_timer_pend0, irq_timer_pend1, irq_yms; |
| 821 | static | |
| 821 | static | |
| 822 | 822 | |
| 823 | 823 | static TIMER_CALLBACK( irq_timer_cb ) |
| 824 | 824 | { |
| r1293 | r1294 | |
| 837 | 837 | irq_allow1 = 0; |
| 838 | 838 | irq_timer_pend0 = 0; |
| 839 | 839 | irq_timer_pend1 = 0; |
| 840 | irq_timer = | |
| 840 | irq_timer = | |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | static void irq_timer_reset(void) |
| r1293 | r1294 | |
| 845 | 845 | int freq = (irq_timerb << 12) | irq_timera; |
| 846 | 846 | freq &= 0x1fff; |
| 847 | 847 | |
| 848 | | |
| 848 | | |
| 849 | 849 | logerror("New timer frequency: %0d [%02x %04x]\n", freq, irq_timerb, irq_timera); |
| 850 | 850 | } |
| 851 | 851 | |
| r1293 | r1294 | |
| 912 | 912 | /* set a timer to generate an irq at the needed point */ |
| 913 | 913 | if (ggground_kludge == 1) |
| 914 | 914 | { |
| 915 | | |
| 915 | | |
| 916 | 916 | ggground_kludge = 0; |
| 917 | 917 | } |
| 918 | 918 | return 1; |
| r1293 | r1294 | |
| 936 | 936 | /* set a timer to generate an irq at the needed point */ |
| 937 | 937 | if (ggground_kludge == 1) |
| 938 | 938 | { |
| 939 | | |
| 939 | | |
| 940 | 940 | ggground_kludge = 0; |
| 941 | 941 | } |
| 942 | 942 | return 1; |
| r1293 | r1294 | |
| 2375 | 2375 | MDRV_CPU_PROGRAM_MAP(system24_cpu2_map, 0) |
| 2376 | 2376 | |
| 2377 | 2377 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2378 | MDRV_SCREEN_VBLANK_TIME( | |
| 2378 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2379 | 2379 | MDRV_INTERLEAVE(4) |
| 2380 | 2380 | |
| 2381 | 2381 | MDRV_MACHINE_RESET(system24) |
| r1293 | r1294 | |
|---|---|---|
| 88 | 88 | * |
| 89 | 89 | *************************************/ |
| 90 | 90 | |
| 91 | static | |
| 91 | static | |
| 92 | 92 | static UINT8 whichport = 0; |
| 93 | 93 | |
| 94 | 94 | |
| r1293 | r1294 | |
| 146 | 146 | scanline = 0; |
| 147 | 147 | |
| 148 | 148 | /* set a timer for it */ |
| 149 | | |
| 149 | | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
| 153 | 153 | static MACHINE_START( foodf ) |
| 154 | 154 | { |
| 155 | 155 | state_save_register_global(whichport); |
| 156 | scanline_timer = | |
| 156 | scanline_timer = | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | static MACHINE_RESET( foodf ) |
| 161 | 161 | { |
| 162 | 162 | atarigen_interrupt_reset(update_interrupts); |
| 163 | | |
| 163 | | |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 |
| r1293 | r1294 | |
|---|---|---|
| 1169 | 1169 | } |
| 1170 | 1170 | } |
| 1171 | 1171 | |
| 1172 | ADDRESS_MAP_START( namcona1_mcu_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 1172 | static ADDRESS_MAP_START( namcona1_mcu_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 1173 | 1173 | AM_RANGE(0x000800, 0x000fff) AM_READWRITE(mcu_mailbox_r, mcu_mailbox_w_mcu) // "Mailslot" communications ports |
| 1174 | 1174 | AM_RANGE(0x001000, 0x001fff) AM_READWRITE(snd_r, snd_w) // C140-alike sound chip |
| 1175 | 1175 | AM_RANGE(0x002000, 0x002fff) AM_READWRITE(na1mcu_shared_r, na1mcu_shared_w) // mirror of first page of shared work RAM |
| r1293 | r1294 | |
| 1295 | 1295 | return (port & bitnum[offset>>1]) ? 0xff : 0x00; |
| 1296 | 1296 | } |
| 1297 | 1297 | |
| 1298 | ADDRESS_MAP_START( namcona1_mcu_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 1298 | static ADDRESS_MAP_START( namcona1_mcu_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 1299 | 1299 | AM_RANGE(M37710_PORT4, M37710_PORT4) AM_READWRITE( port4_r, port4_w ) |
| 1300 | 1300 | AM_RANGE(M37710_PORT5, M37710_PORT5) AM_READWRITE( port5_r, port5_w ) |
| 1301 | 1301 | AM_RANGE(M37710_PORT6, M37710_PORT6) AM_READWRITE( port6_r, port6_w ) |
| r1293 | r1294 | |
| 1304 | 1304 | AM_RANGE(0x10, 0x1f) AM_READ( portana_r ) |
| 1305 | 1305 | ADDRESS_MAP_END |
| 1306 | 1306 | |
| 1307 | INTERRUPT_GEN( namcona1_interrupt ) | |
| 1307 | static INTERRUPT_GEN( namcona1_interrupt ) | |
| 1308 | 1308 | { |
| 1309 | 1309 | int level = cpu_getiloops(); /* 0,1,2,3,4 */ |
| 1310 | 1310 | if( level==0 ) |
| r1293 | r1294 | |
| 1350 | 1350 | MDRV_CPU_ADD(M37710, 50113000/4) |
| 1351 | 1351 | MDRV_CPU_PROGRAM_MAP(namcona1_mcu_map, 0) |
| 1352 | 1352 | MDRV_CPU_IO_MAP( namcona1_mcu_io_map, 0 ) |
| 1353 | MDRV_CPU_VBLANK_INT(mcu_interrupt, 2) | |
| 1353 | MDRV_CPU_VBLANK_INT(mcu_interrupt, 2) | |
| 1354 | 1354 | |
| 1355 | 1355 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1356 | 1356 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) |
| r1293 | r1294 | |
|---|---|---|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | static | |
| 35 | static | |
| 36 | 36 | |
| 37 | 37 | static TIMER_CALLBACK( acefruit_refresh ) |
| 38 | 38 | { |
| r1293 | r1294 | |
| 43 | 43 | |
| 44 | 44 | vpos = ( ( vpos / 8 ) + 1 ) * 8; |
| 45 | 45 | |
| 46 | | |
| 46 | | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | static VIDEO_START( acefruit ) |
| 50 | 50 | { |
| 51 | acefruit_refresh_timer = | |
| 51 | acefruit_refresh_timer = | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | INTERRUPT_GEN( acefruit_vblank ) | |
| 54 | static INTERRUPT_GEN( acefruit_vblank ) | |
| 55 | 55 | { |
| 56 | 56 | cpunum_set_input_line( 0, 0, HOLD_LINE ); |
| 57 | | |
| 57 | | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | static VIDEO_UPDATE( acefruit ) |
| r1293 | r1294 | |
|---|---|---|
| 1896 | 1896 | MDRV_CPU_MODIFY("main") |
| 1897 | 1897 | MDRV_CPU_IO_MAP(herbiedk_io_map, 0) |
| 1898 | 1898 | |
| 1899 | //MDRV_SCREEN_VBLANK_TIME( | |
| 1899 | //MDRV_SCREEN_VBLANK_TIME(A | |
| 1900 | 1900 | MACHINE_DRIVER_END |
| 1901 | 1901 | |
| 1902 | 1902 | static MACHINE_DRIVER_START( spclforc ) |
| r1293 | r1294 | |
|---|---|---|
| 122 | 122 | cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | | |
| 125 | | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
| 129 | 129 | static MACHINE_RESET( sprint4 ) |
| 130 | 130 | { |
| 131 | | |
| 131 | | |
| 132 | 132 | |
| 133 | 133 | memset(steer_FF1, 0, sizeof steer_FF1); |
| 134 | 134 | memset(steer_FF2, 0, sizeof steer_FF2); |
| r1293 | r1294 | |
|---|---|---|
| 266 | 266 | MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) |
| 267 | 267 | |
| 268 | 268 | MDRV_SCREEN_REFRESH_RATE(60) |
| 269 | MDRV_SCREEN_VBLANK_TIME( | |
| 269 | MDRV_SCREEN_VBLANK_TIME(A | |
| 270 | 270 | |
| 271 | 271 | /* video hardware */ |
| 272 | 272 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 337 | 337 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 338 | 338 | |
| 339 | 339 | MDRV_SCREEN_REFRESH_RATE(56.75) |
| 340 | MDRV_SCREEN_VBLANK_TIME( | |
| 340 | MDRV_SCREEN_VBLANK_TIME(A | |
| 341 | 341 | /* the Lode Runner manual (similar but different hardware) */ |
| 342 | 342 | /* talks about 55Hz and 1790ms vblank duration. */ |
| 343 | 343 |
| r1293 | r1294 | |
|---|---|---|
| 15 | 15 | |
| 16 | 16 | /* video */ |
| 17 | 17 | |
| 18 | UINT8 *hanaroku_spriteram1; | |
| 19 | UINT8 *hanaroku_spriteram2; | |
| 20 | UINT8 *hanaroku_spriteram3; | |
| 18 | static UINT8 *hanaroku_spriteram1; | |
| 19 | static UINT8 *hanaroku_spriteram2; | |
| 20 | static UINT8 *hanaroku_spriteram3; | |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | static PALETTE_INIT( hanaroku ) |
| r1293 | r1294 | |
|---|---|---|
| 296 | 296 | metlclsh_irqhandler |
| 297 | 297 | }; |
| 298 | 298 | |
| 299 | INTERRUPT_GEN( metlclsh_interrupt2 ) | |
| 299 | static INTERRUPT_GEN( metlclsh_interrupt2 ) | |
| 300 | 300 | { |
| 301 | 301 | if (cpu_getiloops() == 0) |
| 302 | 302 | return; |
| r1293 | r1294 | |
|---|---|---|
| 2749 | 2749 | Hanafuda Hana Ginga |
| 2750 | 2750 | ***************************************************************************/ |
| 2751 | 2751 | |
| 2752 | UINT8 hginga_rombank; | |
| 2752 | static UINT8 hginga_rombank; | |
| 2753 | 2753 | static WRITE8_HANDLER( hginga_rombank_w ) |
| 2754 | 2754 | { |
| 2755 | 2755 | UINT8 *rom = memory_region(REGION_CPU1); |
| r1293 | r1294 | |
| 2926 | 2926 | Hanafuda Hana Gokou |
| 2927 | 2927 | ***************************************************************************/ |
| 2928 | 2928 | |
| 2929 | UINT8 hgokou_hopper; | |
| 2929 | static UINT8 hgokou_hopper; | |
| 2930 | 2930 | |
| 2931 | 2931 | static UINT8 hgokou_player_r(int player) |
| 2932 | 2932 | { |
| r1293 | r1294 | |
| 3307 | 3307 | return val; |
| 3308 | 3308 | } |
| 3309 | 3309 | |
| 3310 | UINT8 mjflove_irq_cause; | |
| 3310 | static UINT8 mjflove_irq_cause; | |
| 3311 | 3311 | |
| 3312 | 3312 | static READ8_HANDLER( mjflove_blitter_r ) |
| 3313 | 3313 | { |
| r1293 | r1294 | |
| 7058 | 7058 | |
| 7059 | 7059 | /* It runs in IM 2, thus needs a vector on the data bus: |
| 7060 | 7060 | 0xee is vblank */ |
| 7061 | INTERRUPT_GEN( hparadis_irq ) | |
| 7061 | static INTERRUPT_GEN( hparadis_irq ) | |
| 7062 | 7062 | { |
| 7063 | 7063 | cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0xee); |
| 7064 | 7064 | } |
| r1293 | r1294 | |
|---|---|---|
| 1746 | 1746 | ***************************************************************************/ |
| 1747 | 1747 | |
| 1748 | 1748 | #define KANEKO16_INTERRUPTS_NUM 3 |
| 1749 | INTERRUPT_GEN( kaneko16_interrupt ) | |
| 1749 | static INTERRUPT_GEN( kaneko16_interrupt ) | |
| 1750 | 1750 | { |
| 1751 | 1751 | switch ( cpu_getiloops() ) |
| 1752 | 1752 | { |
| r1293 | r1294 | |
| 2082 | 2082 | other: busy loop |
| 2083 | 2083 | */ |
| 2084 | 2084 | #define SHOGWARR_INTERRUPTS_NUM 3 |
| 2085 | INTERRUPT_GEN( shogwarr_interrupt ) | |
| 2085 | static INTERRUPT_GEN( shogwarr_interrupt ) | |
| 2086 | 2086 | { |
| 2087 | 2087 | switch ( cpu_getiloops() ) |
| 2088 | 2088 | { |
| r1293 | r1294 | |
| 2141 | 2141 | have the even and odd pixels swapped. So we use this function to untangle |
| 2142 | 2142 | them and have one single gfxlayout for both tiles and sprites. |
| 2143 | 2143 | */ |
| 2144 | void kaneko16_unscramble_tiles(int region) | |
| 2144 | static void kaneko16_unscramble_tiles(int region) | |
| 2145 | 2145 | { |
| 2146 | 2146 | UINT8 *RAM = memory_region(region); |
| 2147 | 2147 | int size = memory_region_length(region); |
| r1293 | r1294 | |
| 2155 | 2155 | } |
| 2156 | 2156 | } |
| 2157 | 2157 | |
| 2158 | void kaneko16_expand_sample_banks(int region) | |
| 2158 | static void kaneko16_expand_sample_banks(int region) | |
| 2159 | 2159 | { |
| 2160 | 2160 | /* The sample data for the first OKI has an address translator/ |
| 2161 | 2161 | banking register in it that munges the addresses as follows: |
| r1293 | r1294 | |
|---|---|---|
| 275 | 275 | cpunum_set_input_line(1, INPUT_LINE_NMI, ASSERT_LINE); |
| 276 | 276 | |
| 277 | 277 | // give the Z80 time to respond |
| 278 | cpu_spinuntil_time( | |
| 278 | cpu_spinuntil_time( | |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | static READ32_HANDLER( ms32_sound_r ) |
| r1293 | r1294 | |
|---|---|---|
| 252 | 252 | #include "sound/ay8910.h" |
| 253 | 253 | #include "machine/steppers.h" // stepper motor |
| 254 | 254 | #include "machine/roc10937.h" // vfd |
| 255 | #include "machine/m | |
| 255 | #include "machine/meters.h" | |
| 256 | 256 | |
| 257 | 257 | #ifdef MAME_DEBUG |
| 258 | 258 | #define LOG(x)logerror x |
| r1293 | r1294 | |
| 296 | 296 | static int ic23_active; |
| 297 | 297 | static int led_extend; |
| 298 | 298 | static int serial_card_connected; |
| 299 | static | |
| 299 | static | |
| 300 | 300 | static TIMER_CALLBACK( ic24_timeout ); |
| 301 | 301 | |
| 302 | 302 | static int input_strobe; // IC23 74LS138 A = CA2 IC7, B = CA2 IC4, C = CA2 IC8 |
| r1293 | r1294 | |
| 304 | 304 | static UINT8 lamp_data; |
| 305 | 305 | static UINT8 aydata; |
| 306 | 306 | |
| 307 | const UINT8 MPU4_chr_lut[72]; | |
| 308 | UINT8 MPU4_chr_data[72]; | |
| 307 | extern const UINT8 MPU4_chr_lut[72]; | |
| 308 | static UINT8 MPU4_chr_data[72]; | |
| 309 | 309 | static UINT8 led_segs[8]; |
| 310 | 310 | static UINT8 Lamps[128]; // 128 multiplexed lamps |
| 311 | 311 | // 32 multiplexed inputs - but a further 8 possible per AUX. |
| r1293 | r1294 | |
| 603 | 603 | { |
| 604 | 604 | ic23_active=1; |
| 605 | 605 | ic24_output(0); |
| 606 | | |
| 606 | | |
| 607 | 607 | } |
| 608 | 608 | } |
| 609 | 609 | } |
| r1293 | r1294 | |
| 852 | 852 | static WRITE8_HANDLER( pia_ic7_portb_w ) |
| 853 | 853 | { |
| 854 | 854 | int i; |
| 855 | long cycles = | |
| 855 | long cycles = | |
| 856 | 856 | |
| 857 | 857 | // The meters are connected to a voltage drop sensor, where current |
| 858 | 858 | // flowing through them also passes through pin B7, meaning that when |
| r1293 | r1294 | |
| 891 | 891 | { |
| 892 | 892 | // The eighth meter is connected here, because the voltage sensor |
| 893 | 893 | // is on PB7. |
| 894 | long cycles = | |
| 894 | long cycles = | |
| 895 | 895 | if (data) |
| 896 | 896 | { |
| 897 | 897 | pia_set_input_b(4,mmtr_data|0x80); |
| r1293 | r1294 | |
| 1197 | 1197 | pia_config(4,&pia_ic7_intf); |
| 1198 | 1198 | pia_config(5,&pia_ic8_intf); |
| 1199 | 1199 | |
| 1200 | ic24_timer = | |
| 1200 | ic24_timer = | |
| 1201 | 1201 | // setup ptm //////////////////////////////////////////////////////////// |
| 1202 | 1202 | ptm6840_config(0, &ptm_ic2_intf ); |
| 1203 | 1203 | } |
| r1293 | r1294 | |
|---|---|---|
| 417 | 417 | |
| 418 | 418 | |
| 419 | 419 | // It runs in IM 0, thus needs an opcode on the data bus |
| 420 | INTERRUPT_GEN( skylncr_vblank_interrupt ) | |
| 420 | static INTERRUPT_GEN( skylncr_vblank_interrupt ) | |
| 421 | 421 | { |
| 422 | 422 | if (skylncr_nmi_enable) cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); |
| 423 | 423 | } |
| r1293 | r1294 | |
|---|---|---|
| 295 | 295 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 296 | 296 | |
| 297 | 297 | MDRV_SCREEN_REFRESH_RATE(58) |
| 298 | MDRV_SCREEN_VBLANK_TIME( | |
| 298 | MDRV_SCREEN_VBLANK_TIME(A | |
| 299 | 299 | |
| 300 | 300 | /* video hardware */ |
| 301 | 301 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
|---|---|---|
| 210 | 210 | static WRITE8_HANDLER(protection_w) |
| 211 | 211 | { |
| 212 | 212 | timer_call_after_resynch(data, protection_deferred_w); |
| 213 | cpu_boost_interleave(time_zero, | |
| 213 | cpu_boost_interleave(attotime_zero, | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | static ADDRESS_MAP_START( cpu0_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r1293 | r1294 | |
|---|---|---|
| 288 | 288 | MDRV_CPU_PROGRAM_MAP(stadhero_s_readmem,stadhero_s_writemem) |
| 289 | 289 | |
| 290 | 290 | MDRV_SCREEN_REFRESH_RATE(58) |
| 291 | MDRV_SCREEN_VBLANK_TIME( | |
| 291 | MDRV_SCREEN_VBLANK_TIME(A | |
| 292 | 292 | |
| 293 | 293 | /* video hardware */ |
| 294 | 294 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 85 | 85 | { |
| 86 | 86 | // sound_nmi_enabled = 1; |
| 87 | 87 | cpunum_set_input_line(1, INPUT_LINE_NMI, CLEAR_LINE); |
| 88 | | |
| 88 | | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | static ADDRESS_MAP_START( z80_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r1293 | r1294 | |
| 266 | 266 | simpsons_objdma(); |
| 267 | 267 | |
| 268 | 268 | // 32+256us delay at 8MHz dotclock; artificially shortened since actual V-blank length is unknown |
| 269 | | |
| 269 | | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if (K052109_is_IRQ_enabled()) |
| r1293 | r1294 | |
|---|---|---|
| 367 | 367 | MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound) |
| 368 | 368 | |
| 369 | 369 | MDRV_SCREEN_REFRESH_RATE(57.44) |
| 370 | MDRV_SCREEN_VBLANK_TIME( | |
| 370 | MDRV_SCREEN_VBLANK_TIME(A | |
| 371 | 371 | |
| 372 | 372 | /* video hardware */ |
| 373 | 373 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 867 | 867 | |
| 868 | 868 | if ((sr & 0x0700) > 0x0100) |
| 869 | 869 | { |
| 870 | cpu_spinuntil_time( | |
| 870 | cpu_spinuntil_time( | |
| 871 | 871 | return 0; // not ready yet, interrupts disabled |
| 872 | 872 | } |
| 873 | 873 | |
| r1293 | r1294 | |
| 883 | 883 | // signal the 68000 that there's data waiting |
| 884 | 884 | cpunum_set_input_line(1, 2, HOLD_LINE); |
| 885 | 885 | // give the 68k time to reply |
| 886 | cpu_spinuntil_time( | |
| 886 | cpu_spinuntil_time( | |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | static ADDRESS_MAP_START( model1_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| r1293 | r1294 | |
|---|---|---|
| 399 | 399 | MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem) |
| 400 | 400 | |
| 401 | 401 | MDRV_SCREEN_REFRESH_RATE(60) |
| 402 | MDRV_SCREEN_VBLANK_TIME( | |
| 402 | MDRV_SCREEN_VBLANK_TIME(A | |
| 403 | 403 | |
| 404 | 404 | /* video hardware */ |
| 405 | 405 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
| 442 | 442 | MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem) |
| 443 | 443 | |
| 444 | 444 | MDRV_SCREEN_REFRESH_RATE(60) |
| 445 | MDRV_SCREEN_VBLANK_TIME( | |
| 445 | MDRV_SCREEN_VBLANK_TIME(A | |
| 446 | 446 | |
| 447 | 447 | /* video hardware */ |
| 448 | 448 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
|---|---|---|
| 216 | 216 | |
| 217 | 217 | static INTERRUPT_GEN( rastansaga2_interrupt ) |
| 218 | 218 | { |
| 219 | | |
| 219 | | |
| 220 | 220 | cpunum_set_input_line(0, 4, HOLD_LINE); |
| 221 | 221 | } |
| 222 | 222 | |
| r1293 | r1294 | |
| 228 | 228 | |
| 229 | 229 | static INTERRUPT_GEN( crimec_interrupt ) |
| 230 | 230 | { |
| 231 | | |
| 231 | | |
| 232 | 232 | cpunum_set_input_line(0, 5, HOLD_LINE); |
| 233 | 233 | } |
| 234 | 234 | |
| r1293 | r1294 | |
| 240 | 240 | |
| 241 | 241 | static INTERRUPT_GEN( hitice_interrupt ) |
| 242 | 242 | { |
| 243 | | |
| 243 | | |
| 244 | 244 | cpunum_set_input_line(0, 4, HOLD_LINE); |
| 245 | 245 | } |
| 246 | 246 | |
| r1293 | r1294 | |
| 252 | 252 | |
| 253 | 253 | static INTERRUPT_GEN( rambo3_interrupt ) |
| 254 | 254 | { |
| 255 | | |
| 255 | | |
| 256 | 256 | cpunum_set_input_line(0, 6, HOLD_LINE); |
| 257 | 257 | } |
| 258 | 258 | |
| r1293 | r1294 | |
| 264 | 264 | |
| 265 | 265 | static INTERRUPT_GEN( pbobble_interrupt ) |
| 266 | 266 | { |
| 267 | | |
| 267 | | |
| 268 | 268 | cpunum_set_input_line(0, 3, HOLD_LINE); |
| 269 | 269 | } |
| 270 | 270 | |
| r1293 | r1294 | |
| 275 | 275 | |
| 276 | 276 | static INTERRUPT_GEN( viofight_interrupt ) |
| 277 | 277 | { |
| 278 | | |
| 278 | | |
| 279 | 279 | cpunum_set_input_line(0, 4, HOLD_LINE); |
| 280 | 280 | } |
| 281 | 281 | |
| r1293 | r1294 | |
| 286 | 286 | |
| 287 | 287 | static INTERRUPT_GEN( masterw_interrupt ) |
| 288 | 288 | { |
| 289 | | |
| 289 | | |
| 290 | 290 | cpunum_set_input_line(0, 5, HOLD_LINE); |
| 291 | 291 | } |
| 292 | 292 | |
| r1293 | r1294 | |
| 297 | 297 | |
| 298 | 298 | static INTERRUPT_GEN( silentd_interrupt ) |
| 299 | 299 | { |
| 300 | | |
| 300 | | |
| 301 | 301 | cpunum_set_input_line(0, 6, HOLD_LINE); |
| 302 | 302 | } |
| 303 | 303 | |
| r1293 | r1294 | |
| 308 | 308 | |
| 309 | 309 | static INTERRUPT_GEN( selfeena_interrupt ) |
| 310 | 310 | { |
| 311 | | |
| 311 | | |
| 312 | 312 | cpunum_set_input_line(0, 6, HOLD_LINE); |
| 313 | 313 | } |
| 314 | 314 | |
| r1293 | r1294 | |
| 319 | 319 | |
| 320 | 320 | static INTERRUPT_GEN( sbm_interrupt )//5 |
| 321 | 321 | { |
| 322 | | |
| 322 | | |
| 323 | 323 | cpunum_set_input_line(0, 4, HOLD_LINE); |
| 324 | 324 | } |
| 325 | 325 |
| r1293 | r1294 | |
|---|---|---|
| 243 | 243 | |
| 244 | 244 | /* Interrupt Generator */ |
| 245 | 245 | |
| 246 | INTERRUPT_GEN( jackal_interrupt ) | |
| 246 | static INTERRUPT_GEN( jackal_interrupt ) | |
| 247 | 247 | { |
| 248 | 248 | if (irq_enable) |
| 249 | 249 | cpunum_set_input_line(0, 0, HOLD_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 388 | 388 | MDRV_CPU_PROGRAM_MAP(tank8_cpu_map, 0) |
| 389 | 389 | |
| 390 | 390 | MDRV_SCREEN_REFRESH_RATE(60) |
| 391 | MDRV_SCREEN_VBLANK_TIME( | |
| 391 | MDRV_SCREEN_VBLANK_TIME(A | |
| 392 | 392 | MDRV_MACHINE_RESET(tank8) |
| 393 | 393 | |
| 394 | 394 | /* video hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 872 | 872 | static MACHINE_START( maze ) |
| 873 | 873 | { |
| 874 | 874 | /* create astable timer for IC B1 */ |
| 875 | | |
| 875 | | |
| 876 | 876 | |
| 877 | 877 | /* initialize state of Tone Timing FF, IC C1 */ |
| 878 | 878 | maze_tone_timing_state = 0; |
| r1293 | r1294 | |
| 1275 | 1275 | MDRV_CPU_MODIFY("main") |
| 1276 | 1276 | MDRV_CPU_IO_MAP(desertgu_io_map,0) |
| 1277 | 1277 | MDRV_MACHINE_START(desertgu) |
| 1278 | MDRV_WATCHDOG_TIME_INIT( | |
| 1278 | MDRV_WATCHDOG_TIME_INIT( | |
| 1279 | 1279 | |
| 1280 | 1280 | /* audio hardware */ |
| 1281 | 1281 | MDRV_IMPORT_FROM(desertgu_audio) |
| r1293 | r1294 | |
| 1472 | 1472 | MDRV_IMPORT_FROM(mw8080bw_root) |
| 1473 | 1473 | MDRV_CPU_MODIFY("main") |
| 1474 | 1474 | MDRV_CPU_IO_MAP(dplay_io_map,0) |
| 1475 | MDRV_WATCHDOG_TIME_INIT( | |
| 1475 | MDRV_WATCHDOG_TIME_INIT( | |
| 1476 | 1476 | |
| 1477 | 1477 | /* audio hardware */ |
| 1478 | 1478 | MDRV_IMPORT_FROM(dplay_audio) |
| r1293 | r1294 | |
| 1654 | 1654 | MDRV_CPU_MODIFY("main") |
| 1655 | 1655 | MDRV_CPU_IO_MAP(m4_io_map,0) |
| 1656 | 1656 | MDRV_MACHINE_START(m4) |
| 1657 | MDRV_WATCHDOG_TIME_INIT( | |
| 1657 | MDRV_WATCHDOG_TIME_INIT( | |
| 1658 | 1658 | |
| 1659 | 1659 | /* audio hardware */ |
| 1660 | 1660 | MDRV_IMPORT_FROM(m4_audio) |
| r1293 | r1294 | |
| 1828 | 1828 | MDRV_CPU_MODIFY("main") |
| 1829 | 1829 | MDRV_CPU_IO_MAP(clowns_io_map,0) |
| 1830 | 1830 | MDRV_MACHINE_START(clowns) |
| 1831 | MDRV_WATCHDOG_TIME_INIT( | |
| 1831 | MDRV_WATCHDOG_TIME_INIT( | |
| 1832 | 1832 | |
| 1833 | 1833 | /* audio hardware */ |
| 1834 | 1834 | MDRV_IMPORT_FROM(clowns_audio) |
| r1293 | r1294 | |
| 1906 | 1906 | MDRV_IMPORT_FROM(mw8080bw_root) |
| 1907 | 1907 | MDRV_CPU_MODIFY("main") |
| 1908 | 1908 | MDRV_CPU_IO_MAP(shuffle_io_map,0) |
| 1909 | MDRV_WATCHDOG_TIME_INIT( | |
| 1909 | MDRV_WATCHDOG_TIME_INIT( | |
| 1910 | 1910 | |
| 1911 | 1911 | /* audio hardware */ |
| 1912 | 1912 | /* MDRV_IMPORT_FROM(shuffle_audio) */ |
| r1293 | r1294 | |
| 1991 | 1991 | MDRV_CPU_IO_MAP(dogpatch_io_map,0) |
| 1992 | 1992 | /* the watch dog time is unknown, but all other */ |
| 1993 | 1993 | /* Midway boards of the era used the same circuit */ |
| 1994 | MDRV_WATCHDOG_TIME_INIT( | |
| 1994 | MDRV_WATCHDOG_TIME_INIT( | |
| 1995 | 1995 | |
| 1996 | 1996 | /* audio hardware */ |
| 1997 | 1997 | MDRV_IMPORT_FROM(dogpatch_audio) |
| r1293 | r1294 | |
| 2007 | 2007 | *************************************/ |
| 2008 | 2008 | |
| 2009 | 2009 | #define SPCENCTR_STROBE_FREQ (9.00) /* Hz - calculated from the 555 timer */ |
| 2010 | #define SPCENCTR_STROBE_PERIOD | |
| 2010 | #define SPCENCTR_STROBE_PERIOD | |
| 2011 | 2011 | #define SPCENCTR_DUTY_CYCLE (95) /* % */ |
| 2012 | 2012 | |
| 2013 | 2013 | |
| 2014 | static mame_timer *spcenctr_strobe_on_timer; | |
| 2015 | static mame_timer *spcenctr_strobe_off_timer; | |
| 2014 | static emu_timer *spcenctr_strobe_on_timer; | |
| 2015 | static emu_timer *spcenctr_strobe_off_timer; | |
| 2016 | 2016 | static UINT8 spcenctr_strobe_state; |
| 2017 | 2017 | static UINT8 spcenctr_trench_width; |
| 2018 | 2018 | static UINT8 spcenctr_trench_center; |
| r1293 | r1294 | |
| 2026 | 2026 | if (spcenctr_strobe_state) |
| 2027 | 2027 | { |
| 2028 | 2028 | /* multiply by the precentage and divide by 100 to get the ON period */ |
| 2029 | | |
| 2029 | | |
| 2030 | 2030 | |
| 2031 | mame_timer_adjust(spcenctr_strobe_on_timer, time_zero, 1, SPCENCTR_STROBE_PERIOD); | |
| 2032 | mame_timer_adjust(spcenctr_strobe_off_timer, on_period, 0, SPCENCTR_STROBE_PERIOD); | |
| 2031 | timer_adjust(spcenctr_strobe_on_timer, attotime_zero, 1, SPCENCTR_STROBE_PERIOD); | |
| 2032 | timer_adjust(spcenctr_strobe_off_timer, on_period, 0, SPCENCTR_STROBE_PERIOD); | |
| 2033 | 2033 | } |
| 2034 | 2034 | else |
| 2035 | 2035 | { |
| 2036 | mame_timer_adjust(spcenctr_strobe_on_timer, time_never, 0, time_zero); | |
| 2037 | mame_timer_adjust(spcenctr_strobe_off_timer, time_zero, 0, time_zero); | |
| 2036 | timer_adjust(spcenctr_strobe_on_timer, attotime_never, 0, attotime_zero); | |
| 2037 | timer_adjust(spcenctr_strobe_off_timer, attotime_zero, 0, attotime_zero); | |
| 2038 | 2038 | } |
| 2039 | 2039 | } |
| 2040 | 2040 | |
| r1293 | r1294 | |
| 2048 | 2048 | static MACHINE_START( spcenctr ) |
| 2049 | 2049 | { |
| 2050 | 2050 | /* create timers */ |
| 2051 | spcenctr_strobe_on_timer = mame_timer_alloc(spcenctr_strobe_timer_callback); | |
| 2052 | spcenctr_strobe_off_timer = mame_timer_alloc(spcenctr_strobe_timer_callback); | |
| 2051 | spcenctr_strobe_on_timer = timer_alloc(spcenctr_strobe_timer_callback); | |
| 2052 | spcenctr_strobe_off_timer = timer_alloc(spcenctr_strobe_timer_callback); | |
| 2053 | 2053 | |
| 2054 | 2054 | /* setup for save states */ |
| 2055 | 2055 | state_save_register_global(spcenctr_strobe_state); |
| r1293 | r1294 | |
| 2199 | 2199 | MDRV_CPU_MODIFY("main") |
| 2200 | 2200 | MDRV_CPU_IO_MAP(spcenctr_io_map,0) |
| 2201 | 2201 | MDRV_MACHINE_START(spcenctr) |
| 2202 | MDRV_WATCHDOG_TIME_INIT( | |
| 2202 | MDRV_WATCHDOG_TIME_INIT( | |
| 2203 | 2203 | |
| 2204 | 2204 | /* video hardware */ |
| 2205 | 2205 | MDRV_VIDEO_UPDATE(spcenctr) |
| r1293 | r1294 | |
| 2299 | 2299 | MDRV_CPU_MODIFY("main") |
| 2300 | 2300 | MDRV_CPU_IO_MAP(phantom2_io_map,0) |
| 2301 | 2301 | MDRV_MACHINE_START(phantom2) |
| 2302 | MDRV_WATCHDOG_TIME_INIT( | |
| 2302 | MDRV_WATCHDOG_TIME_INIT( | |
| 2303 | 2303 | |
| 2304 | 2304 | /* video hardware */ |
| 2305 | 2305 | MDRV_VIDEO_UPDATE(phantom2) |
| r1293 | r1294 | |
| 2435 | 2435 | MDRV_IMPORT_FROM(mw8080bw_root) |
| 2436 | 2436 | MDRV_CPU_MODIFY("main") |
| 2437 | 2437 | MDRV_CPU_IO_MAP(bowler_io_map,0) |
| 2438 | MDRV_WATCHDOG_TIME_INIT( | |
| 2438 | MDRV_WATCHDOG_TIME_INIT( | |
| 2439 | 2439 | |
| 2440 | 2440 | /* audio hardware */ |
| 2441 | 2441 | MDRV_IMPORT_FROM(bowler_audio) |
| r1293 | r1294 | |
| 2657 | 2657 | MDRV_CPU_MODIFY("main") |
| 2658 | 2658 | MDRV_CPU_IO_MAP(invaders_io_map,0) |
| 2659 | 2659 | MDRV_MACHINE_START(invaders) |
| 2660 | MDRV_WATCHDOG_TIME_INIT( | |
| 2660 | MDRV_WATCHDOG_TIME_INIT( | |
| 2661 | 2661 | |
| 2662 | 2662 | /* video hardware */ |
| 2663 | 2663 | MDRV_VIDEO_UPDATE(invaders) |
| r1293 | r1294 | |
| 2736 | 2736 | MDRV_IMPORT_FROM(mw8080bw_root) |
| 2737 | 2737 | MDRV_CPU_MODIFY("main") |
| 2738 | 2738 | MDRV_CPU_IO_MAP(blueshrk_io_map,0) |
| 2739 | MDRV_WATCHDOG_TIME_INIT( | |
| 2739 | MDRV_WATCHDOG_TIME_INIT( | |
| 2740 | 2740 | |
| 2741 | 2741 | /* audio hardware */ |
| 2742 | 2742 | MDRV_IMPORT_FROM(blueshrk_audio) |
| r1293 | r1294 | |
| 2834 | 2834 | MDRV_IMPORT_FROM(mw8080bw_root) |
| 2835 | 2835 | MDRV_CPU_MODIFY("main") |
| 2836 | 2836 | MDRV_CPU_IO_MAP(invad2ct_io_map,0) |
| 2837 | MDRV_WATCHDOG_TIME_INIT( | |
| 2837 | MDRV_WATCHDOG_TIME_INIT( | |
| 2838 | 2838 | |
| 2839 | 2839 | /* audio hardware */ |
| 2840 | 2840 | MDRV_IMPORT_FROM(invad2ct_audio) |
| r1293 | r1294 | |
|---|---|---|
| 1653 | 1653 | soundirq /* IRQ Line */ |
| 1654 | 1654 | }; |
| 1655 | 1655 | |
| 1656 | INTERRUPT_GEN( brickzn_interrupt ) | |
| 1656 | static INTERRUPT_GEN( brickzn_interrupt ) | |
| 1657 | 1657 | { |
| 1658 | 1658 | if (cpu_getiloops()) cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); |
| 1659 | 1659 | else cpunum_set_input_line(0, 0, HOLD_LINE); |
| r1293 | r1294 | |
| 1724 | 1724 | |
| 1725 | 1725 | /* 1 x 24 MHz crystal */ |
| 1726 | 1726 | |
| 1727 | INTERRUPT_GEN( hardhea2_interrupt ) | |
| 1727 | static INTERRUPT_GEN( hardhea2_interrupt ) | |
| 1728 | 1728 | { |
| 1729 | 1729 | if (cpu_getiloops()) |
| 1730 | 1730 | { |
| r1293 | r1294 | |
|---|---|---|
| 281 | 281 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 282 | 282 | |
| 283 | 283 | MDRV_SCREEN_REFRESH_RATE(58) |
| 284 | MDRV_SCREEN_VBLANK_TIME( | |
| 284 | MDRV_SCREEN_VBLANK_TIME(A | |
| 285 | 285 | |
| 286 | 286 | /* video hardware */ |
| 287 | 287 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
|---|---|---|
| 1303 | 1303 | MDRV_CPU_VBLANK_INT(nmi_line_pulse,16) |
| 1304 | 1304 | |
| 1305 | 1305 | MDRV_SCREEN_REFRESH_RATE(57) |
| 1306 | MDRV_SCREEN_VBLANK_TIME( | |
| 1306 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1307 | 1307 | |
| 1308 | 1308 | /* video hardware */ |
| 1309 | 1309 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 656 | 656 | sndram = memory_region(REGION_SOUND1) + 0x100000; |
| 657 | 657 | |
| 658 | 658 | /* sound irq (CCU? 240Hz) */ |
| 659 | | |
| 659 | | |
| 660 | 660 | |
| 661 | 661 | /* reset the IDE controller */ |
| 662 | 662 | gp2_irq_control = 0; |
| r1293 | r1294 | |
|---|---|---|
| 530 | 530 | INPUT PORTS, DIPs |
| 531 | 531 | ***********************************************************/ |
| 532 | 532 | |
| 533 | #define CPS1_COINAGE_1 \ | |
| 534 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) \ | |
| 533 | #define CPS1_COINAGE_1(diploc) \ | |
| 534 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION(diploc ":1,2,3") \ | |
| 535 | 535 | PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) \ |
| 536 | 536 | PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) \ |
| 537 | 537 | PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) \ |
| r1293 | r1294 | |
| 540 | 540 | PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) \ |
| 541 | 541 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) \ |
| 542 | 542 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_6C ) ) \ |
| 543 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) \ | |
| 543 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION(diploc ":4,5,6") \ | |
| 544 | 544 | PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) \ |
| 545 | 545 | PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) \ |
| 546 | 546 | PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) \ |
| r1293 | r1294 | |
| 550 | 550 | PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) ) \ |
| 551 | 551 | PORT_DIPSETTING( 0x18, DEF_STR( 1C_6C ) ) |
| 552 | 552 | |
| 553 | #define CPS1_COINAGE_2 \ | |
| 554 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) \ | |
| 553 | #define CPS1_COINAGE_2(diploc) \ | |
| 554 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION(diploc ":1,2,3") \ | |
| 555 | 555 | PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) \ |
| 556 | 556 | PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) \ |
| 557 | 557 | PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) \ |
| r1293 | r1294 | |
| 561 | 561 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) \ |
| 562 | 562 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_6C ) ) |
| 563 | 563 | |
| 564 | #define CPS1_COINAGE_3 \ | |
| 565 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) \ | |
| 564 | #define CPS1_COINAGE_3(diploc) \ | |
| 565 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION(diploc ":1,2,3") \ | |
| 566 | 566 | PORT_DIPSETTING( 0x01, DEF_STR( 4C_1C ) ) \ |
| 567 | 567 | PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) \ |
| 568 | 568 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) \ |
| r1293 | r1294 | |
| 571 | 571 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) \ |
| 572 | 572 | PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) \ |
| 573 | 573 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) \ |
| 574 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) \ | |
| 574 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION(diploc ":4,5,6") \ | |
| 575 | 575 | PORT_DIPSETTING( 0x08, DEF_STR( 4C_1C ) ) \ |
| 576 | 576 | PORT_DIPSETTING( 0x10, DEF_STR( 3C_1C ) ) \ |
| 577 | 577 | PORT_DIPSETTING( 0x18, DEF_STR( 2C_1C ) ) \ |
| r1293 | r1294 | |
| 581 | 581 | PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) ) \ |
| 582 | 582 | PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) ) |
| 583 | 583 | |
| 584 | #define CPS1_DIFFICULTY_1 \ | |
| 585 | PORT_DIPNAME( 0x07, 0x04, DEF_STR( Difficulty ) ) \ | |
| 584 | #define CPS1_DIFFICULTY_1(diploc) \ | |
| 585 | PORT_DIPNAME( 0x07, 0x04, DEF_STR( Difficulty ) ) PORT_DIPLOCATION(diploc ":1,2,3") \ | |
| 586 | 586 | PORT_DIPSETTING( 0x07, "1 (Easiest)" ) \ |
| 587 | 587 | PORT_DIPSETTING( 0x06, "2" ) \ |
| 588 | 588 | PORT_DIPSETTING( 0x05, "3" ) \ |
| r1293 | r1294 | |
| 592 | 592 | PORT_DIPSETTING( 0x01, "7" ) \ |
| 593 | 593 | PORT_DIPSETTING( 0x00, "8 (Hardest)" ) |
| 594 | 594 | |
| 595 | #define CPS1_DIFFICULTY_2 \ | |
| 596 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) \ | |
| 595 | #define CPS1_DIFFICULTY_2(diploc) \ | |
| 596 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION(diploc ":1,2,3") \ | |
| 597 | 597 | PORT_DIPSETTING( 0x04, "1 (Easiest)" ) \ |
| 598 | 598 | PORT_DIPSETTING( 0x05, "2" ) \ |
| 599 | 599 | PORT_DIPSETTING( 0x06, "3" ) \ |
| r1293 | r1294 | |
| 615 | 615 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 616 | 616 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 617 | 617 | |
| 618 | PORT_START_TAG("DSWC") | |
| 619 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 620 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 621 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 622 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) // Check code at 0x013c78 | |
| 623 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) // (0x013690 in 'lostwrld') | |
| 624 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 625 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 626 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 627 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 628 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) | |
| 629 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 630 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 631 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 632 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 633 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 634 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) | |
| 635 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 636 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 637 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) | |
| 638 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 639 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 640 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) | |
| 641 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 642 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 618 | PORT_START_TAG("DSWC") // The manual only mentions two DIP switch banks. | |
| 619 | PORT_DIPUNUSED( 0x80, 0x80 ) // Is this port brought out to DIP switches or not? | |
| 620 | PORT_DIPUNKNOWN( 0x40, 0x40 ) // Check code at 0x013c78 (0x013690 in 'lostwrld') | |
| 621 | PORT_DIPUNUSED( 0x20, 0x20 ) | |
| 622 | PORT_DIPUNUSED( 0x10, 0x10 ) | |
| 623 | PORT_DIPUNUSED( 0x08, 0x08 ) | |
| 624 | PORT_DIPUNUSED( 0x04, 0x04 ) | |
| 625 | PORT_DIPUNUSED( 0x02, 0x02 ) | |
| 626 | PORT_DIPUNUSED( 0x01, 0x01 ) | |
| 643 | 627 | |
| 644 | 628 | PORT_START_TAG("DSWB") |
| 645 | PORT_DIPNAME( 0x80, 0x80, "Freeze" ) | |
| 629 | CPS1_DIFFICULTY_1( "DIP-B" ) | |
| 630 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "DIP-B:4" ) | |
| 631 | PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "DIP-B:5" ) | |
| 632 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "DIP-B:6" ) // Check code at 0x00111c (0x00112c in 'lostwrld') | |
| 633 | PORT_SERVICE_DIPLOC( 0x40, IP_ACTIVE_LOW, "DIP-B:7" ) | |
| 634 | PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("DIP-B:8") | |
| 646 | 635 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 647 | 636 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 648 | PORT_SERVICE( 0x40, IP_ACTIVE_LOW ) | |
| 649 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 650 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 651 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 652 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) | |
| 653 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 654 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 655 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) // Check code at 0x00111c | |
| 656 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) // (0x00112c in 'lostwrld') | |
| 657 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 658 | CPS1_DIFFICULTY_1 | |
| 659 | 637 | |
| 660 | 638 | PORT_START_TAG("DSWA") |
| 661 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) | |
| 662 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 663 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 664 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) | |
| 639 | CPS1_COINAGE_1( "DIP-A" ) | |
| 640 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DIP-A:7") | |
| 665 | 641 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 666 | 642 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 667 | CPS1_COINAGE_1 | |
| 643 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("DIP-A:8") | |
| 644 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 645 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 668 | 646 | |
| 669 | 647 | PORT_START_TAG("IN1") |
| 670 | 648 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| r1293 | r1294 | |
| 703 | 681 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 704 | 682 | |
| 705 | 683 | PORT_START_TAG("DSWC") |
| 706 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 707 | PORT_DIPSETTING( 0x80, "Game" ) | |
| 708 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) | |
| 709 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) | |
| 710 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 711 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) | |
| 712 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) // "Demo Sounds" in manual; doesn't work | |
| 713 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 714 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 715 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 716 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 717 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 718 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 719 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 720 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 721 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) | |
| 722 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 723 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 724 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) | |
| 684 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(C):1,2") | |
| 725 | 685 | PORT_DIPSETTING( 0x03, "3" ) |
| 726 | 686 | PORT_DIPSETTING( 0x02, "4" ) |
| 727 | 687 | PORT_DIPSETTING( 0x01, "5" ) |
| 728 | 688 | PORT_DIPSETTING( 0x00, "6" ) |
| 729 | ||
| 730 | PORT_START_TAG("DSWB") | |
| 731 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 732 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 689 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(C):3" ) | |
| 690 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(C):4" ) | |
| 691 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 692 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 733 | 693 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 734 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 735 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 694 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(C):6") | |
| 695 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) // "Demo Sounds" in manual; doesn't work | |
| 736 | 696 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 737 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) ) | |
| 697 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 698 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 699 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) | |
| 700 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 701 | PORT_DIPSETTING( 0x80, "Game" ) | |
| 702 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) | |
| 703 | ||
| 704 | PORT_START_TAG("DSWB") | |
| 705 | CPS1_DIFFICULTY_2( "SW(B)" ) | |
| 706 | PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW(B):4" ) | |
| 707 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW(B):5,6") | |
| 738 | 708 | PORT_DIPSETTING( 0x20, "10K, 30K and every 30K" ) |
| 739 | 709 | PORT_DIPSETTING( 0x10, "20K, 50K and every 70K" ) |
| 740 | 710 | PORT_DIPSETTING( 0x30, "30K, 60K and every 70K" ) |
| 741 | 711 | PORT_DIPSETTING( 0x00, "40K, 70K and every 80K" ) |
| 742 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 743 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 744 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 745 | CPS1_DIFFICULTY_2 | |
| 712 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" ) | |
| 713 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 746 | 714 | |
| 747 | 715 | PORT_START_TAG("DSWA") |
| 748 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Cabinet ) ) | |
| 716 | CPS1_COINAGE_1( "SW(A)" ) | |
| 717 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW(A):7,8") | |
| 749 | 718 | PORT_DIPSETTING( 0xc0, "Upright 1 Player" ) |
| 750 | 719 | PORT_DIPSETTING( 0x80, "Upright 2 Players" ) |
| 751 | // PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) | |
| 752 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) | |
| 753 | CPS1_COINAGE_1 | |
| 720 | // PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) // Manual says these are both valid settings | |
| 721 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) // for 2-player cocktail cabinet | |
| 754 | 722 | |
| 755 | 723 | PORT_START_TAG("IN1") |
| 756 | 724 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| r1293 | r1294 | |
| 785 | 753 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 786 | 754 | |
| 787 | 755 | PORT_START_TAG("DSWC") |
| 788 | PORT_DIPNAME( 0x80, 0x80, "Game Mode" ) | |
| 789 | PORT_DIPSETTING( 0x80, "Game" ) | |
| 790 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) | |
| 791 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) | |
| 792 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 793 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) | |
| 794 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) // "Demo Sounds" in manual; doesn't work | |
| 795 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 796 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 797 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 798 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 799 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 800 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 801 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 802 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 803 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) | |
| 804 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 805 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 806 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) | |
| 756 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(C):1,2") | |
| 807 | 757 | PORT_DIPSETTING( 0x00, "2" ) |
| 808 | 758 | PORT_DIPSETTING( 0x03, "3" ) |
| 809 | 759 | PORT_DIPSETTING( 0x02, "4" ) |
| 810 | 760 | PORT_DIPSETTING( 0x01, "5" ) |
| 811 | ||
| 812 | PORT_START_TAG("DSWB") | |
| 813 | PORT_DIPNAME( 0x80, 0x80, "Freeze" ) | |
| 814 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 761 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(C):3" ) | |
| 762 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(C):4" ) | |
| 763 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 764 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 815 | 765 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 816 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 817 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 766 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(C):6") | |
| 767 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) // "Demo Sounds" in manual; doesn't work | |
| 818 | 768 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 769 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 770 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 771 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) | |
| 772 | PORT_DIPNAME( 0x80, 0x80, "Game Mode" ) PORT_DIPLOCATION("SW(C):8") | |
| 773 | PORT_DIPSETTING( 0x80, "Game" ) | |
| 774 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) | |
| 775 | ||
| 776 | PORT_START_TAG("DSWB") | |
| 819 | 777 | /* Standard Dip Switches */ |
| 820 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 821 | PORT_DIPSETTING( 0x20, "10K, 30K and every 30K" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 822 | PORT_DIPSETTING( 0x10, "20K, 50K and every 70K" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 823 | PORT_DIPSETTING( 0x30, "30K, 60K and every 70K" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 824 | PORT_DIPSETTING( 0x00, "40K, 70K and every 80K" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 825 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 826 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 827 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 828 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 778 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW(B):1,2,3") | |
| 779 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 829 | 780 | PORT_DIPSETTING( 0x04, "1 (Easiest)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 830 | 781 | PORT_DIPSETTING( 0x05, "2" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 831 | 782 | PORT_DIPSETTING( 0x06, "3" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| r1293 | r1294 | |
| 834 | 785 | PORT_DIPSETTING( 0x02, "6" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 835 | 786 | PORT_DIPSETTING( 0x01, "7" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 836 | 787 | PORT_DIPSETTING( 0x00, "8 (Hardest)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 788 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(B):4") | |
| 789 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 790 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 791 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 792 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW(B):5,6") | |
| 793 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 794 | PORT_DIPSETTING( 0x20, "10K, 30K and every 30K" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 795 | PORT_DIPSETTING( 0x10, "20K, 50K and every 70K" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 796 | PORT_DIPSETTING( 0x30, "30K, 60K and every 70K" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 797 | PORT_DIPSETTING( 0x00, "40K, 70K and every 80K" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 837 | 798 | /* Debug Dip Switches */ |
| 838 | PORT_DIPNAME( 0x38, 0x30, "Armor on New Life" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 839 | // PORT_DIPSETTING( 0x38, "Silver Armor" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 840 | PORT_DIPSETTING( 0x18, "Golden Armor" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 841 | PORT_DIPSETTING( 0x30, "Silver Armor" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 842 | PORT_DIPSETTING( 0x28, "None (young man)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 843 | PORT_DIPSETTING( 0x20, "None (old man)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 844 | // PORT_DIPSETTING( 0x10, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 845 | // PORT_DIPSETTING( 0x08, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 846 | // PORT_DIPSETTING( 0x00, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 847 | PORT_DIPNAME( 0x07, 0x07, "Starting Weapon" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 799 | PORT_DIPNAME( 0x07, 0x07, "Starting Weapon" ) PORT_DIPLOCATION("SW(B):1,2,3") | |
| 800 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 848 | 801 | PORT_DIPSETTING( 0x07, "Spear" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 849 | 802 | PORT_DIPSETTING( 0x06, "Knife" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 850 | 803 | PORT_DIPSETTING( 0x05, "Torch" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| r1293 | r1294 | |
| 853 | 806 | PORT_DIPSETTING( 0x02, "Shield" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 854 | 807 | PORT_DIPSETTING( 0x01, "Super Weapon" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 855 | 808 | // PORT_DIPSETTING( 0x00, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 809 | PORT_DIPNAME( 0x38, 0x30, "Armor on New Life" ) PORT_DIPLOCATION("SW(B):4,5,6") | |
| 810 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 811 | // PORT_DIPSETTING( 0x38, "Silver Armor" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 812 | PORT_DIPSETTING( 0x18, "Golden Armor" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 813 | PORT_DIPSETTING( 0x30, "Silver Armor" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 814 | PORT_DIPSETTING( 0x28, "None (young man)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 815 | PORT_DIPSETTING( 0x20, "None (old man)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 816 | // PORT_DIPSETTING( 0x10, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 817 | // PORT_DIPSETTING( 0x08, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 818 | // PORT_DIPSETTING( 0x00, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 856 | 819 | |
| 820 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" ) | |
| 821 | PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("SW(B):8") | |
| 822 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 823 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 824 | ||
| 857 | 825 | PORT_START_TAG("DSWA") |
| 858 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Cabinet ) ) | |
| 859 | PORT_DIPSETTING( 0xc0, "Upright 1 Player" ) | |
| 860 | PORT_DIPSETTING( 0x80, "Upright 2 Players" ) | |
| 861 | // PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) | |
| 862 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) | |
| 863 | 826 | /* Standard Dip Switches */ |
| 864 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 827 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW(A):1,2,3") | |
| 828 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 865 | 829 | PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 866 | PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 867 | PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 868 | PORT_DIPSETTING( 0x38, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 869 | PORT_DIPSETTING( 0x30, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 870 | PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 871 | PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 872 | PORT_DIPSETTING( 0x18, DEF_STR( 1C_6C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 873 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 874 | PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 875 | 830 | PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 876 | 831 | PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 877 | 832 | PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| r1293 | r1294 | |
| 879 | 834 | PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 880 | 835 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 881 | 836 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_6C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 837 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW(A):4,5,6") | |
| 838 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 839 | PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 840 | PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 841 | PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 842 | PORT_DIPSETTING( 0x38, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 843 | PORT_DIPSETTING( 0x30, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 844 | PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 845 | PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 846 | PORT_DIPSETTING( 0x18, DEF_STR( 1C_6C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 882 | 847 | /* Debug Dip Switches */ |
| 883 | PORT_DIPNAME( 0x20, 0x20, "Slow Motion" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 884 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 885 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 886 | PORT_DIPNAME( 0x10, 0x10, "Invulnerability" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 887 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 888 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 889 | PORT_DIPNAME( 0x0f, 0x0f, "Starting Level" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 848 | PORT_DIPNAME( 0x0f, 0x0f, "Starting Level" ) PORT_DIPLOCATION("SW(A):1,2,3,4") | |
| 849 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 890 | 850 | PORT_DIPSETTING( 0x0f, "Level 1 (1st half)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 891 | 851 | PORT_DIPSETTING( 0x0e, "Level 1 (2nd half)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 892 | 852 | PORT_DIPSETTING( 0x0d, "Level 2 (1st half)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| r1293 | r1294 | |
| 903 | 863 | // PORT_DIPSETTING( 0x02, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 904 | 864 | // PORT_DIPSETTING( 0x01, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 905 | 865 | // PORT_DIPSETTING( 0x00, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 866 | PORT_DIPNAME( 0x10, 0x10, "Invulnerability" ) PORT_DIPLOCATION("SW(A):5") | |
| 867 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 868 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 869 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 870 | PORT_DIPNAME( 0x20, 0x20, "Slow Motion" ) PORT_DIPLOCATION("SW(A):6") | |
| 871 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 872 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 873 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 906 | 874 | |
| 875 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW(A):7,8") | |
| 876 | PORT_DIPSETTING( 0xc0, "Upright 1 Player" ) | |
| 877 | PORT_DIPSETTING( 0x80, "Upright 2 Players" ) | |
| 878 | // PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) // Manual says these are both valid settings | |
| 879 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) // for 2-player cocktail cabinet | |
| 880 | ||
| 907 | 881 | PORT_START_TAG("IN1") |
| 908 | 882 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| 909 | 883 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| r1293 | r1294 | |
| 928 | 902 | PORT_INCLUDE(ghouls) |
| 929 | 903 | |
| 930 | 904 | PORT_MODIFY("DSWB") |
| 931 | PORT_DIPNAME( 0x80, 0x80, "Freeze" ) | |
| 932 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 905 | PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("SW(B):8") | |
| 906 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) // This switch isn't documented in the manual | |
| 933 | 907 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 934 | 908 | INPUT_PORTS_END |
| 935 | 909 | |
| r1293 | r1294 | |
| 946 | 920 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 947 | 921 | |
| 948 | 922 | PORT_START_TAG("DSWA") |
| 949 | CPS1_COINAGE_1 | |
| 950 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Cabinet ) ) | |
| 951 | PORT_DIPSETTING( 0xc0, "Upright 1 Player" ) | |
| 923 | CPS1_COINAGE_1( "SW(A)" ) | |
| 924 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW(A):7,8") | |
| 925 | PORT_DIPSETTING( 0xc0, "Upright 1 Player" ) // These switches are not documented in the manual | |
| 952 | 926 | PORT_DIPSETTING( 0x80, "Upright 2 Players" ) |
| 953 | 927 | // PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) |
| 954 | 928 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) |
| 955 | 929 | |
| 956 | 930 | PORT_START_TAG("DSWB") |
| 957 | CPS1_DIFFICULTY_2 | |
| 931 | CPS1_DIFFICULTY_2( "SW(B)" ) | |
| 958 | 932 | /* In 'striderj', bit 3 is stored at 0xff8e77 ($e77,A5) via code at 0x000a2a, |
| 959 | 933 | but this address is never checked again. |
| 960 | 934 | In 'strider' and 'stridrja', this code even doesn't exist ! */ |
| 961 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 962 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 963 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 964 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) ) | |
| 935 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(B):4") | |
| 936 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) // Manual says this is 2c start/1c continue but it | |
| 937 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // doesn't work (see comment above) | |
| 938 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW(B):5,6") | |
| 965 | 939 | PORT_DIPSETTING( 0x30, "20K, 40K then every 60K" ) |
| 966 | 940 | PORT_DIPSETTING( 0x20, "30K, 50K then every 70K" ) |
| 967 | 941 | PORT_DIPSETTING( 0x10, "20K & 60K only" ) |
| 968 | 942 | PORT_DIPSETTING( 0x00, "30K & 60K only" ) |
| 969 | PORT_DIPNAME( 0xc0, 0x80, "Internal Diff. on Life Loss" ) // Check code at 0x00d15a | |
| 970 | PORT_DIPSETTING( 0xc0, "-3" ) | |
| 971 | // PORT_DIPSETTING( 0x40, "-1" ) | |
| 943 | PORT_DIPNAME( 0xc0, 0x80, "Internal Diff. on Life Loss" ) PORT_DIPLOCATION("SW(B):7,8") | |
| 944 | PORT_DIPSETTING( 0xc0, "-3" ) // Check code at 0x00d15a | |
| 945 | // PORT_DIPSETTING( 0x40, "-1" ) // These switches are not documented in the manual | |
| 972 | 946 | PORT_DIPSETTING( 0x00, "-1" ) |
| 973 | 947 | PORT_DIPSETTING( 0x80, "Default" ) |
| 974 | 948 | |
| 975 | 949 | PORT_START_TAG("DSWC") |
| 976 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) | |
| 977 | PORT_DIPSETTING( 0x00, "2" ) // "6" in the "test mode" | |
| 950 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(C):1,2") | |
| 951 | PORT_DIPSETTING( 0x00, "2" ) // "6" in the "test mode" and manual | |
| 978 | 952 | PORT_DIPSETTING( 0x03, "3" ) |
| 979 | 953 | PORT_DIPSETTING( 0x02, "4" ) |
| 980 | 954 | PORT_DIPSETTING( 0x01, "5" ) |
| 981 | PORT_DIPNAME( 0x04, 0x04, "Freeze" ) | |
| 955 | PORT_DIPNAME( 0x04, 0x04, "Freeze" ) PORT_DIPLOCATION("SW(C):3") | |
| 982 | 956 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 983 | 957 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 984 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) ) | |
| 958 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):4") | |
| 985 | 959 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 986 | 960 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 987 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 961 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 988 | 962 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 989 | 963 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 990 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) | |
| 964 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 991 | 965 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 992 | 966 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 993 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) | |
| 967 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 994 | 968 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 995 | 969 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) |
| 996 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 970 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 997 | 971 | PORT_DIPSETTING( 0x80, "Game" ) |
| 998 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) // To enable the "debug" features | |
| 972 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) // To enable the "debug" features | |
| 999 | 973 | |
| 1000 | 974 | PORT_START_TAG("IN1") |
| 1001 | 975 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| r1293 | r1294 | |
| 1030 | 1004 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1031 | 1005 | |
| 1032 | 1006 | PORT_START_TAG("DSWA") |
| 1033 | CPS1_COINAGE_1 | |
| 1034 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Cabinet ) ) | |
| 1035 | PORT_DIPSETTING( 0xc0, "Upright 1 Player" ) | |
| 1036 | PORT_DIPSETTING( 0x80, "Upright 2 Players" ) | |
| 1007 | CPS1_COINAGE_1( "SW(A)" ) | |
| 1008 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW(A):7,8") | |
| 1009 | PORT_DIPSETTING( 0xc0, "Upright 1 Player" ) // These switches are not documented in the | |
| 1010 | PORT_DIPSETTING( 0x80, "Upright 2 Players" ) // manual | |
| 1037 | 1011 | // PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) |
| 1038 | 1012 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) |
| 1039 | 1013 | |
| 1040 | 1014 | PORT_START_TAG("DSWB") |
| 1041 | CPS1_DIFFICULTY_2 | |
| 1015 | CPS1_DIFFICULTY_2( "SW(B)" ) | |
| 1042 | 1016 | /* In 'striderj', bit 3 is stored at 0xff8e77 ($e77,A5) via code at 0x000a2a, |
| 1043 | 1017 | but this address is never checked again. |
| 1044 | 1018 | In 'strider' and 'stridrja', this code even doesn't exist ! */ |
| 1045 | PORT_DIPNAME( 0x08, 0x08, "2 Coins to Start, 1 to Continue" ) | |
| 1046 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 1019 | PORT_DIPNAME( 0x08, 0x08, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(B):4") | |
| 1020 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) // This works in this revision | |
| 1047 | 1021 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1048 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) ) | |
| 1022 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW(B):5,6") | |
| 1049 | 1023 | PORT_DIPSETTING( 0x30, "20K, 40K then every 60K" ) |
| 1050 | 1024 | PORT_DIPSETTING( 0x20, "30K, 50K then every 70K" ) |
| 1051 | 1025 | PORT_DIPSETTING( 0x10, "20K & 60K only" ) |
| 1052 | 1026 | PORT_DIPSETTING( 0x00, "30K & 60K only" ) |
| 1053 | PORT_DIPNAME( 0xc0, 0x80, "Internal Diff. on Life Loss" ) // Check code at 0x00d15a | |
| 1054 | PORT_DIPSETTING( 0xc0, "-3" ) | |
| 1055 | // PORT_DIPSETTING( 0x40, "-1" ) | |
| 1056 | PORT_DIPSETTING( 0x00, "-1" ) | |
| 1027 | PORT_DIPNAME( 0xc0, 0x80, "Internal Diff. on Life Loss" ) PORT_DIPLOCATION("SW(B):7,8") | |
| 1028 | PORT_DIPSETTING( 0xc0, "-3" ) // Check code at 0x00d15a | |
| 1029 | // PORT_DIPSETTING( 0x40, "-1" ) // These switches are not documented in the | |
| 1030 | PORT_DIPSETTING( 0x00, "-1" ) // manual | |
| 1057 | 1031 | PORT_DIPSETTING( 0x80, "Default" ) |
| 1058 | 1032 | |
| 1059 | 1033 | PORT_START_TAG("DSWC") |
| 1060 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) | |
| 1061 | PORT_DIPSETTING( 0x00, "2" ) // "6" in the "test mode" | |
| 1034 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(C):1,2") | |
| 1035 | PORT_DIPSETTING( 0x00, "2" ) // "6" in the "test mode" and manual | |
| 1062 | 1036 | PORT_DIPSETTING( 0x03, "3" ) |
| 1063 | 1037 | PORT_DIPSETTING( 0x02, "4" ) |
| 1064 | 1038 | PORT_DIPSETTING( 0x01, "5" ) |
| 1065 | PORT_DIPNAME( 0x04, 0x04, "Freeze" ) | |
| 1039 | PORT_DIPNAME( 0x04, 0x04, "Freeze" ) PORT_DIPLOCATION("SW(C):3") | |
| 1066 | 1040 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 1067 | 1041 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1068 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) ) | |
| 1042 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):4") | |
| 1069 | 1043 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1070 | 1044 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1071 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 1045 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 1072 | 1046 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1073 | 1047 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1074 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) | |
| 1048 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 1075 | 1049 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1076 | 1050 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 1077 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) | |
| 1051 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 1078 | 1052 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 1079 | 1053 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) |
| 1080 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 1054 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 1081 | 1055 | PORT_DIPSETTING( 0x80, "Game" ) |
| 1082 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) // To enable the "debug" features | |
| 1056 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) // To enable the "debug" features | |
| 1083 | 1057 | |
| 1084 | 1058 | PORT_START_TAG("IN1") |
| 1085 | 1059 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| r1293 | r1294 | |
| 1112 | 1086 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1113 | 1087 | |
| 1114 | 1088 | PORT_START_TAG("DSWC") |
| 1115 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 1116 | PORT_DIPSETTING( 0x80, "Game" ) | |
| 1117 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) | |
| 1118 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) | |
| 1119 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) // "ON" in the "test mode" | |
| 1120 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) // "OFF" in the "test mode" | |
| 1121 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) | |
| 1122 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) // "ON" in the "test mode" | |
| 1123 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) // "OFF" in the "test mode" | |
| 1124 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 1089 | PORT_DIPNAME( 0x01, 0x01, "Freeze" ) PORT_DIPLOCATION("SW(C):1") | |
| 1090 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) // Also affects energy cost - read notes | |
| 1091 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // This switch is not documented in the manual | |
| 1092 | PORT_DIPNAME( 0x02, 0x02, "Turbo Mode" ) PORT_DIPLOCATION("SW(C):2") | |
| 1093 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) // Also affects energy cost - read notes | |
| 1094 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // This switch is not documented in the manual | |
| 1095 | PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW(C):3" ) // This switch is not documented in the manual | |
| 1096 | PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW(C):4" ) // This switch is not documented in the manual | |
| 1097 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 1125 | 1098 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1126 | 1099 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1127 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 1128 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 1129 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1130 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) | |
| 1131 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 1132 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1133 | PORT_DIPNAME( 0x02, 0x02, "Turbo Mode" ) // Also affects energy cost - read notes | |
| 1134 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 1135 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1136 | PORT_DIPNAME( 0x01, 0x01, "Freeze" ) // Also affects energy cost - read notes | |
| 1137 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1138 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1100 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 1101 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) // "ON" in the "test mode" | |
| 1102 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) // "OFF" in the "test mode" | |
| 1103 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 1104 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) // "ON" in the "test mode" | |
| 1105 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) // "OFF" in the "test mode" | |
| 1106 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 1107 | PORT_DIPSETTING( 0x80, "Game" ) | |
| 1108 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) | |
| 1139 | 1109 | |
| 1140 | 1110 | PORT_START_TAG("DSWB") |
| 1141 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1142 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1143 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1144 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 1145 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1146 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1147 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 1148 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1149 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1150 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) | |
| 1151 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 1152 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1153 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 1154 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 1155 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1156 | CPS1_DIFFICULTY_2 | |
| 1111 | CPS1_DIFFICULTY_2( "SW(B)" ) | |
| 1112 | PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW(B):4" ) // These five switches are not documented in the | |
| 1113 | PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW(B):5" ) // manual | |
| 1114 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(B):6" ) | |
| 1115 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" ) | |
| 1116 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 1157 | 1117 | |
| 1158 | 1118 | PORT_START_TAG("DSWA") |
| 1159 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) | |
| 1160 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1161 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1162 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 1163 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1164 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1165 | /* According to the manual, ALL bits 0 to 5 must be ON to have | |
| 1119 | /* According to the manual, ALL switches 1 to 6 must be ON to have | |
| 1166 | 1120 | "2 Coins/1 Credit (1 to continue)" for both coin slots */ |
| 1167 | CPS1_COINAGE_3 | |
| 1121 | CPS1_COINAGE_3( "SW(A)" ) | |
| 1122 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(A):7" ) // This switch is not documented in the manual | |
| 1123 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(A):8") | |
| 1124 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) // This switch is not documented in the manual | |
| 1125 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1168 | 1126 | |
| 1169 | 1127 | PORT_START_TAG("IN1") |
| 1170 | 1128 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| r1293 | r1294 | |
| 1198 | 1156 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1199 | 1157 | |
| 1200 | 1158 | PORT_START_TAG("DSWC") |
| 1201 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 1202 | PORT_DIPSETTING( 0x80, "Game" ) | |
| 1203 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) // To enable the "debug" features | |
| 1204 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) | |
| 1205 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 1206 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) | |
| 1207 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 1208 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 1209 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1210 | 1159 | /* Standard Dip Switches */ |
| 1211 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1212 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1213 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1214 | PORT_DIPNAME( 0x0c, 0x0c, "Vitality" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1215 | PORT_DIPSETTING( 0x00, "2" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1216 | PORT_DIPSETTING( 0x0c, "3" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1217 | PORT_DIPSETTING( 0x08, "4" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1218 | PORT_DIPSETTING( 0x04, "5" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1219 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1220 | PORT_DIPSETTING( 0x02, "1" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1221 | PORT_DIPSETTING( 0x03, "2" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1222 | PORT_DIPSETTING( 0x01, "3" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1223 | PORT_DIPSETTING( 0x00, "4" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1160 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(C):1,2") | |
| 1161 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1162 | PORT_DIPSETTING( 0x02, "1" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1163 | PORT_DIPSETTING( 0x03, "2" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1164 | PORT_DIPSETTING( 0x01, "3" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1165 | PORT_DIPSETTING( 0x00, "4" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1166 | PORT_DIPNAME( 0x0c, 0x0c, "Vitality" ) PORT_DIPLOCATION("SW(C):3,4") | |
| 1167 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1168 | PORT_DIPSETTING( 0x00, "2" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1169 | PORT_DIPSETTING( 0x0c, "3" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1170 | PORT_DIPSETTING( 0x08, "4" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1171 | PORT_DIPSETTING( 0x04, "5" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1224 | 1172 | /* Debug Dip Switches */ |
| 1225 | PORT_DIPNAME( 0x20, 0x20, "Display Debug Infos" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1226 | PORT_DIPSETTING( 0x20, DEF_STR( No ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1227 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1228 | PORT_DIPNAME( 0x08, 0x08, "Invulnerability" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1229 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1173 | PORT_DIPNAME( 0x01, 0x01, "Turbo Mode" ) PORT_DIPLOCATION("SW(C):1") | |
| 1174 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1175 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1230 | 1176 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 1231 | PORT_DIPNAME( 0x04, 0x04, "Slow Motion" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1232 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1177 | PORT_DIPNAME( 0x02, 0x02, "Freeze" ) PORT_DIPLOCATION("SW(C):2") | |
| 1178 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1179 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1233 | 1180 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 1234 | PORT_DIPNAME( 0x02, 0x02, "Freeze" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1235 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1181 | PORT_DIPNAME( 0x04, 0x04, "Slow Motion" ) PORT_DIPLOCATION("SW(C):3") | |
| 1182 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1183 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1236 | 1184 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 1237 | PORT_DIPNAME( 0x01, 0x01, "Turbo Mode" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1238 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1185 | PORT_DIPNAME( 0x08, 0x08, "Invulnerability" ) PORT_DIPLOCATION("SW(C):4") | |
| 1186 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1187 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1239 | 1188 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 1240 | 1189 | |
| 1190 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 1191 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 1192 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1193 | ||
| 1194 | /* Standard Dip Switches */ | |
| 1195 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 1196 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1197 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1198 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1199 | /* Debug Dip Switches */ | |
| 1200 | PORT_DIPNAME( 0x20, 0x20, "Display Debug Infos" ) PORT_DIPLOCATION("SW(C):6") | |
| 1201 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1202 | PORT_DIPSETTING( 0x20, DEF_STR( No ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1203 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1204 | ||
| 1205 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 1206 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 1207 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) | |
| 1208 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 1209 | PORT_DIPSETTING( 0x80, "Game" ) | |
| 1210 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) // To enable the "debug" features | |
| 1211 | ||
| 1241 | 1212 | PORT_START_TAG("DSWB") |
| 1242 | 1213 | /* Standard Dip Switches */ |
| 1243 | PORT_DIPNAME( 0x80, 0x80, "Stage Magic Continue" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1244 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1245 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1246 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1247 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1248 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1249 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1250 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1251 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1252 | PORT_DIPNAME( 0x18, 0x18, "Nando Speed" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1253 | PORT_DIPSETTING( 0x10, "Slow" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1254 | PORT_DIPSETTING( 0x18, DEF_STR( Normal ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1255 | PORT_DIPSETTING( 0x08, "Fast" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1256 | PORT_DIPSETTING( 0x00, "Very Fast" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1257 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1214 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW(B):1,2,3") | |
| 1215 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1258 | 1216 | PORT_DIPSETTING( 0x04, "1 (Easiest)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1259 | PORT_DIPSETTING( 0x05, "2" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1260 | PORT_DIPSETTING( 0x06, "3" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1217 | PORT_DIPSETTING( 0x05, "2" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1218 | PORT_DIPSETTING( 0x06, "3" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1261 | 1219 | PORT_DIPSETTING( 0x07, "4 (Normal)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1262 | PORT_DIPSETTING( 0x03, "5" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1263 | PORT_DIPSETTING( 0x02, "6" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1264 | PORT_DIPSETTING( 0x01, "7" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1220 | PORT_DIPSETTING( 0x03, "5" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1221 | PORT_DIPSETTING( 0x02, "6" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1222 | PORT_DIPSETTING( 0x01, "7" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1265 | 1223 | PORT_DIPSETTING( 0x00, "8 (Hardest)" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1224 | PORT_DIPNAME( 0x18, 0x18, "Nando Speed" ) PORT_DIPLOCATION("SW(B):4,5") | |
| 1225 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1226 | PORT_DIPSETTING( 0x10, "Slow" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1227 | PORT_DIPSETTING( 0x18, DEF_STR( Normal ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1228 | PORT_DIPSETTING( 0x08, "Fast" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1229 | PORT_DIPSETTING( 0x00, "Very Fast" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1230 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(B):6") | |
| 1231 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1232 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1233 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1234 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(B):7") | |
| 1235 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1236 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1237 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1238 | PORT_DIPNAME( 0x80, 0x80, "Stage Magic Continue" ) PORT_DIPLOCATION("SW(B):8") | |
| 1239 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1240 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1241 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1266 | 1242 | /* Debug Dip Switches */ |
| 1267 | PORT_DIPNAME( 0xe0, 0xe0, "Starting Level" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1268 | PORT_DIPSETTING( 0xe0, "Level 1" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1269 | PORT_DIPSETTING( 0xc0, "Level 2" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1270 | PORT_DIPSETTING( 0xa0, "Level 3" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1271 | PORT_DIPSETTING( 0x80, "Level 4" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1272 | PORT_DIPSETTING( 0x60, "Level 5" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1273 | PORT_DIPSETTING( 0x40, "Level 6" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1243 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(B):1") | |
| 1244 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1245 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1246 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1247 | PORT_DIPNAME( 0x1e, 0x1e, "Slow Motion Delay" ) PORT_DIPLOCATION("SW(B):2,3,4,5") | |
| 1248 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1249 | PORT_DIPSETTING( 0x1e, "2 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1250 | PORT_DIPSETTING( 0x1c, "3 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1251 | PORT_DIPSETTING( 0x1a, "4 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1252 | PORT_DIPSETTING( 0x18, "5 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1253 | PORT_DIPSETTING( 0x16, "6 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1254 | PORT_DIPSETTING( 0x14, "7 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1255 | PORT_DIPSETTING( 0x12, "8 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1256 | PORT_DIPSETTING( 0x10, "9 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1257 | PORT_DIPSETTING( 0x0e, "10 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1258 | PORT_DIPSETTING( 0x0c, "11 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1259 | PORT_DIPSETTING( 0x0a, "12 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1260 | PORT_DIPSETTING( 0x08, "13 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1261 | PORT_DIPSETTING( 0x06, "14 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1262 | PORT_DIPSETTING( 0x04, "15 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1263 | PORT_DIPSETTING( 0x02, "16 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1264 | PORT_DIPSETTING( 0x00, "17 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1265 | PORT_DIPNAME( 0xe0, 0xe0, "Starting Level" ) PORT_DIPLOCATION("SW(B):6,7,8") | |
| 1266 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1267 | PORT_DIPSETTING( 0xe0, "Level 1" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1268 | PORT_DIPSETTING( 0xc0, "Level 2" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1269 | PORT_DIPSETTING( 0xa0, "Level 3" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1270 | PORT_DIPSETTING( 0x80, "Level 4" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1271 | PORT_DIPSETTING( 0x60, "Level 5" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1272 | PORT_DIPSETTING( 0x40, "Level 6" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1274 | 1273 | // PORT_DIPSETTING( 0x20, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 1275 | 1274 | // PORT_DIPSETTING( 0x00, "INVALID !" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 1276 | PORT_DIPNAME( 0x1e, 0x1e, "Slow Motion Delay" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1277 | PORT_DIPSETTING( 0x1e, "2 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1278 | PORT_DIPSETTING( 0x1c, "3 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1279 | PORT_DIPSETTING( 0x1a, "4 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1280 | PORT_DIPSETTING( 0x18, "5 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1281 | PORT_DIPSETTING( 0x16, "6 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1282 | PORT_DIPSETTING( 0x14, "7 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1283 | PORT_DIPSETTING( 0x12, "8 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1284 | PORT_DIPSETTING( 0x10, "9 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1285 | PORT_DIPSETTING( 0x0e, "10 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1286 | PORT_DIPSETTING( 0x0c, "11 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1287 | PORT_DIPSETTING( 0x0a, "12 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1288 | PORT_DIPSETTING( 0x08, "13 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1289 | PORT_DIPSETTING( 0x06, "14 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1290 | PORT_DIPSETTING( 0x04, "15 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1291 | PORT_DIPSETTING( 0x02, "16 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1292 | PORT_DIPSETTING( 0x00, "17 Frames" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1293 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1294 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1295 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1296 | 1275 | |
| 1297 | 1276 | PORT_START_TAG("DSWA") |
| 1298 | 1277 | /* Standard Dip Switches */ |
| 1299 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Cabinet ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1300 | PORT_DIPSETTING( 0xc0, "Upright 1 Player" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1301 | PORT_DIPSETTING( 0x80, "Upright 2 Players" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1302 | // PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1303 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1304 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1278 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW(A):1,2,3") | |
| 1279 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1305 | 1280 | PORT_DIPSETTING( 0x01, DEF_STR( 4C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1306 | 1281 | PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1307 | 1282 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| r1293 | r1294 | |
| 1310 | 1285 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1311 | 1286 | PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1312 | 1287 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1313 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1288 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW(A):4,5,6") | |
| 1289 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1314 | 1290 | PORT_DIPSETTING( 0x08, DEF_STR( 4C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1315 | 1291 | PORT_DIPSETTING( 0x10, DEF_STR( 3C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1316 | 1292 | PORT_DIPSETTING( 0x18, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| r1293 | r1294 | |
| 1319 | 1295 | PORT_DIPSETTING( 0x30, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1320 | 1296 | PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1321 | 1297 | PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) |
| 1298 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW(A):7,8") | |
| 1299 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1300 | PORT_DIPSETTING( 0xc0, "Upright 1 Player" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1301 | PORT_DIPSETTING( 0x80, "Upright 2 Players" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1302 | // PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1303 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x80) | |
| 1322 | 1304 | /* Debug Dip Switches */ |
| 1323 | PORT_DIPNAME( 0x80, 0x80, "Maximum magic/sword power" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1324 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1325 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1326 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1327 | PORT_DIPSETTING( 0x40, "Upright 1 Player" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1328 | PORT_DIPSETTING( 0x00, "Upright 2 Players" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1329 | PORT_DIPNAME( 0x3f, 0x3f, DEF_STR( Free_Play ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1330 | PORT_DIPSETTING( 0x3f, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1305 | PORT_DIPNAME( 0x3f, 0x3f, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(A):1,2,3,4,5,6") | |
| 1306 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1307 | PORT_DIPSETTING( 0x3f, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1331 | 1308 | PORT_DIPSETTING( 0x38, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) |
| 1332 | 1309 | /* Other values don't give free play */ |
| 1310 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW(A):7") | |
| 1311 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1312 | PORT_DIPSETTING( 0x40, "Upright 1 Player" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1313 | PORT_DIPSETTING( 0x00, "Upright 2 Players" ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1314 | PORT_DIPNAME( 0x80, 0x80, "Maximum magic/sword power" ) PORT_DIPLOCATION("SW(A):8") | |
| 1315 | PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1316 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1317 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWC",0x80,PORTCOND_EQUALS,0x00) | |
| 1333 | 1318 | |
| 1334 | 1319 | PORT_START_TAG("IN1") |
| 1335 | 1320 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| r1293 | r1294 | |
| 1363 | 1348 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1364 | 1349 | |
| 1365 | 1350 | PORT_START_TAG("DSWA") |
| 1366 | CPS1_COINAGE_3 | |
| 1351 | CPS1_COINAGE_3( "SW(A)" ) | |
| 1367 | 1352 | /* According to the manual, ALL bits 0 to 5 must be ON to have |
| 1368 | 1353 | "2 Coins/1 Credit (1 to continue)" for both coin slots */ |
| 1369 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 1370 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1371 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1372 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1373 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1374 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1354 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(A):7" ) | |
| 1355 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 1375 | 1356 | |
| 1376 | 1357 | PORT_START_TAG("DSWB") |
| 1377 | CPS1_DIFFICULTY_1 | |
| 1378 | PORT_DIPNAME( 0x18, 0x18, "Damage" ) // Check code at 0x006f4e | |
| 1379 | PORT_DIPSETTING( 0x10, "Small" ) | |
| 1358 | CPS1_DIFFICULTY_1( "SW(B)" ) | |
| 1359 | PORT_DIPNAME( 0x18, 0x18, "Damage" ) PORT_DIPLOCATION("SW(B):4,5") | |
| 1360 | PORT_DIPSETTING( 0x10, "Small" ) // Check code at 0x006f4e | |
| 1380 | 1361 | PORT_DIPSETTING( 0x18, DEF_STR( Normal ) ) |
| 1381 | 1362 | PORT_DIPSETTING( 0x08, "Big" ) |
| 1382 | 1363 | PORT_DIPSETTING( 0x00, "Biggest" ) |
| 1383 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 1384 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1385 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1386 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 1387 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1388 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1389 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1390 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1391 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1364 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(B):6" ) | |
| 1365 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" ) | |
| 1366 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 1392 | 1367 | |
| 1393 | 1368 | PORT_START_TAG("DSWC") |
| 1394 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) | |
| 1395 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1396 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1397 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) | |
| 1398 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 1399 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1400 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 1369 | PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW(C):1" ) | |
| 1370 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" ) | |
| 1371 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 1401 | 1372 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 1402 | 1373 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1403 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 1374 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 1404 | 1375 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1405 | 1376 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1406 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 1377 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 1407 | 1378 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1408 | 1379 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1409 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 1380 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 1410 | 1381 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 1411 | 1382 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1412 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 1383 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 1413 | 1384 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 1414 | 1385 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 1415 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 1386 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 1416 | 1387 | PORT_DIPSETTING( 0x80, "Game" ) |
| 1417 | 1388 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 1418 | 1389 | |
| r1293 | r1294 | |
| 1449 | 1420 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1450 | 1421 | |
| 1451 | 1422 | PORT_START_TAG("DSWA") |
| 1452 | CPS1_COINAGE_1 | |
| 1453 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 1423 | CPS1_COINAGE_1( "SW(A)" ) | |
| 1424 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 1454 | 1425 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1455 | 1426 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1456 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1457 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1458 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1427 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 1459 | 1428 | |
| 1460 | 1429 | PORT_START_TAG("DSWB") |
| 1461 | PORT_DIPNAME( 0x07, 0x04, "Difficulty Level 1" ) | |
| 1430 | PORT_DIPNAME( 0x07, 0x04, "Difficulty Level 1" ) PORT_DIPLOCATION("SW(B):1,2,3") | |
| 1462 | 1431 | PORT_DIPSETTING( 0x07, DEF_STR( Easiest ) ) // "01" |
| 1463 | 1432 | PORT_DIPSETTING( 0x06, DEF_STR( Easier ) ) // "02" |
| 1464 | PORT_DIPSETTING( 0x05, DEF_STR( Easy ) ) // "03" | |
| 1433 | PORT_DIPSETTING( 0x05, DEF_STR( Easy ) ) // "03" | |
| 1465 | 1434 | PORT_DIPSETTING( 0x04, DEF_STR( Normal ) ) // "04" |
| 1466 | 1435 | PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) // "05" |
| 1467 | PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) // "06" | |
| 1436 | PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) // "06" | |
| 1468 | 1437 | PORT_DIPSETTING( 0x01, DEF_STR( Harder ) ) // "07" |
| 1469 | 1438 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) // "08" |
| 1470 | PORT_DIPNAME( 0x18, 0x10, "Difficulty Level 2" ) | |
| 1471 | PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) // "01" | |
| 1439 | PORT_DIPNAME( 0x18, 0x10, "Difficulty Level 2" ) PORT_DIPLOCATION("SW(B):4,5") | |
| 1440 | PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) // "01" | |
| 1472 | 1441 | PORT_DIPSETTING( 0x10, DEF_STR( Normal ) ) // "02" |
| 1473 | PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) // "03" | |
| 1442 | PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) // "03" | |
| 1474 | 1443 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) // "04" |
| 1475 | PORT_DIPNAME( 0x60, 0x60, DEF_STR( Bonus_Life ) ) | |
| 1444 | PORT_DIPNAME( 0x60, 0x60, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW(B):6,7") | |
| 1476 | 1445 | PORT_DIPSETTING( 0x60, "100k" ) |
| 1477 | 1446 | PORT_DIPSETTING( 0x40, "200k" ) |
| 1478 | 1447 | PORT_DIPSETTING( 0x20, "100k and every 200k" ) |
| 1479 | 1448 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 1480 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1481 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1482 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1449 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 1483 | 1450 | |
| 1484 | 1451 | PORT_START_TAG("DSWC") |
| 1485 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) | |
| 1452 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(C):1,2") | |
| 1486 | 1453 | PORT_DIPSETTING( 0x00, "1" ) |
| 1487 | 1454 | PORT_DIPSETTING( 0x03, "2" ) |
| 1488 | 1455 | PORT_DIPSETTING( 0x02, "3" ) |
| 1489 | 1456 | PORT_DIPSETTING( 0x01, "4" ) |
| 1490 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 1457 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 1491 | 1458 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 1492 | 1459 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1493 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 1460 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 1494 | 1461 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1495 | 1462 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1496 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 1463 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 1497 | 1464 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1498 | 1465 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1499 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 1466 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 1500 | 1467 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 1501 | 1468 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1502 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 1469 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 1503 | 1470 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 1504 | 1471 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 1505 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 1472 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 1506 | 1473 | PORT_DIPSETTING( 0x80, "Game" ) |
| 1507 | 1474 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 1508 | 1475 | |
| r1293 | r1294 | |
| 1537 | 1504 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1538 | 1505 | |
| 1539 | 1506 | PORT_START_TAG("DSWA") |
| 1540 | CPS1_COINAGE_1 | |
| 1541 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 1507 | CPS1_COINAGE_1( "SW(A)" ) | |
| 1508 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 1542 | 1509 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1543 | 1510 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1544 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1545 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1546 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1511 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 1547 | 1512 | |
| 1548 | 1513 | PORT_START_TAG("DSWB") |
| 1549 | CPS1_DIFFICULTY_1 | |
| 1550 | PORT_DIPNAME( 0x18, 0x18, "Level Up Timer" ) | |
| 1514 | CPS1_DIFFICULTY_1( "SW(B)" ) | |
| 1515 | PORT_DIPNAME( 0x18, 0x18, "Level Up Timer" ) PORT_DIPLOCATION("SW(B):4,5") | |
| 1551 | 1516 | PORT_DIPSETTING( 0x18, "More Slowly" ) |
| 1552 | 1517 | PORT_DIPSETTING( 0x10, "Slowly" ) |
| 1553 | 1518 | PORT_DIPSETTING( 0x08, "Quickly" ) |
| 1554 | 1519 | PORT_DIPSETTING( 0x00, "More Quickly" ) |
| 1555 | PORT_DIPNAME( 0x60, 0x60, "Bullet's Speed" ) | |
| 1520 | PORT_DIPNAME( 0x60, 0x60, "Bullet's Speed" ) PORT_DIPLOCATION("SW(B):6,7") | |
| 1556 | 1521 | PORT_DIPSETTING( 0x60, "Very Slow" ) |
| 1557 | 1522 | PORT_DIPSETTING( 0x40, "Slow" ) |
| 1558 | 1523 | PORT_DIPSETTING( 0x20, "Fast" ) |
| 1559 | 1524 | PORT_DIPSETTING( 0x00, "Very Fast" ) |
| 1560 | PORT_DIPNAME( 0x80, 0x80, "Initial Vitality" ) | |
| 1525 | PORT_DIPNAME( 0x80, 0x80, "Initial Vitality" ) PORT_DIPLOCATION("SW(B):8") | |
| 1561 | 1526 | PORT_DIPSETTING( 0x80, "3 Bars" ) |
| 1562 | 1527 | PORT_DIPSETTING( 0x00, "4 Bars" ) |
| 1563 | 1528 | |
| 1564 | 1529 | PORT_START_TAG("DSWC") |
| 1565 | PORT_DIPNAME( 0x01, 0x01, "Throttle Game Speed" ) // turning this off will break the game | |
| 1566 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1530 | PORT_DIPNAME( 0x01, 0x01, "Throttle Game Speed" ) PORT_DIPLOCATION("SW(C):1") | |
| 1531 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) // turning this off will break the game | |
| 1567 | 1532 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) |
| 1568 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) | |
| 1569 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 1570 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1571 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 1533 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" ) | |
| 1534 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 1572 | 1535 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 1573 | 1536 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1574 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 1537 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 1575 | 1538 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1576 | 1539 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1577 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 1540 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 1578 | 1541 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1579 | 1542 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1580 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 1543 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 1581 | 1544 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 1582 | 1545 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1583 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 1546 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 1584 | 1547 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 1585 | 1548 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 1586 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 1549 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 1587 | 1550 | PORT_DIPSETTING( 0x80, "Game" ) |
| 1588 | 1551 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 1589 | 1552 | |
| r1293 | r1294 | |
| 1618 | 1581 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1619 | 1582 | |
| 1620 | 1583 | PORT_START_TAG("DSWA") |
| 1621 | CPS1_COINAGE_2 | |
| 1622 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 1623 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 1624 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1625 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) | |
| 1626 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 1627 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1628 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 1629 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1630 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1631 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 1584 | CPS1_COINAGE_2( "SW(A)" ) | |
| 1585 | PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW(A):4" ) // These three switches are not documented in | |
| 1586 | PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW(A):5" ) // the manual | |
| 1587 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(A):6" ) | |
| 1588 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 1632 | 1589 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1633 | 1590 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1634 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1635 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1636 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1591 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) // This switch is not documented in the manual | |
| 1637 | 1592 | |
| 1638 | 1593 | PORT_START_TAG("DSWB") |
| 1639 | CPS1_DIFFICULTY_1 | |
| 1640 | PORT_DIPNAME( 0x08, 0x08, "Coin Slots" ) | |
| 1594 | CPS1_DIFFICULTY_1( "SW(B)" ) | |
| 1595 | PORT_DIPNAME( 0x08, 0x08, "Coin Slots" ) PORT_DIPLOCATION("SW(B):4") | |
| 1641 | 1596 | PORT_DIPSETTING( 0x00, "1" ) |
| 1642 | PORT_DIPSETTING( 0x08, "3" ) | |
| 1643 | PORT_DIPNAME( 0x10, 0x10, "Play Mode" ) | |
| 1597 | PORT_DIPSETTING( 0x08, "3" ) // This setting can't be used in two-player mode | |
| 1598 | PORT_DIPNAME( 0x10, 0x10, "Play Mode" ) PORT_DIPLOCATION("SW(B):5") | |
| 1644 | 1599 | PORT_DIPSETTING( 0x00, "2 Players" ) |
| 1645 | 1600 | PORT_DIPSETTING( 0x10, "3 Players" ) |
| 1646 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 1647 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1648 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1649 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 1650 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1651 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1652 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1653 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1654 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1601 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(B):6" ) // These three switches are not documented in | |
| 1602 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" ) // the manual | |
| 1603 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 1655 | 1604 | |
| 1656 | 1605 | PORT_START_TAG("DSWC") |
| 1657 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) | |
| 1658 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1659 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1660 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) | |
| 1661 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 1662 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1663 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) | |
| 1664 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 1665 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1666 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 1606 | PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW(C):1" ) // These three switches are not documented in | |
| 1607 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" ) // the manual | |
| 1608 | PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW(C):3" ) | |
| 1609 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 1667 | 1610 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1668 | 1611 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1669 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 1612 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 1670 | 1613 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1671 | 1614 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1672 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 1615 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 1673 | 1616 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 1674 | 1617 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1675 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 1618 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 1676 | 1619 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 1677 | 1620 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 1678 | PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) | |
| 1621 | PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW(C):8" ) | |
| 1679 | 1622 | |
| 1680 | 1623 | PORT_START_TAG("IN1") |
| 1681 | 1624 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| r1293 | r1294 | |
| 1731 | 1674 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1732 | 1675 | |
| 1733 | 1676 | PORT_START_TAG("DSWA") |
| 1734 | CPS1_COINAGE_1 | |
| 1735 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 1736 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1737 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1738 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1739 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1740 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1677 | CPS1_COINAGE_1( "SW(A)" ) | |
| 1678 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(A):7" ) | |
| 1679 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 1741 | 1680 | |
| 1742 | 1681 | PORT_START_TAG("DSWB") |
| 1743 | CPS1_DIFFICULTY_1 | |
| 1744 | PORT_DIPNAME( 0x38, 0x18, DEF_STR( Lives ) ) | |
| 1745 | // PORT_DIPSETTING( 0x30, "1" ) // 0x38 energy, smallest damage | |
| 1746 | // PORT_DIPSETTING( 0x38, "1" ) // 0x38 energy, small damage | |
| 1747 | // PORT_DIPSETTING( 0x28, "1" ) // 0x38 energy, big damage | |
| 1748 | // PORT_DIPSETTING( 0x20, "1" ) // 0x38 energy, biggest damage | |
| 1749 | PORT_DIPSETTING( 0x10, "1" ) // 0x20 energy, smallest damage | |
| 1750 | PORT_DIPSETTING( 0x18, "2" ) // 0x20 energy, small damage | |
| 1751 | PORT_DIPSETTING( 0x08, "3" ) // 0x20 energy, big damage | |
| 1752 | PORT_DIPSETTING( 0x00, "4" ) // 0x20 energy, biggest damage | |
| 1753 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 1754 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1755 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1756 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1757 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1758 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1682 | CPS1_DIFFICULTY_1( "SW(B)" ) | |
| 1683 | PORT_DIPNAME( 0x38, 0x18, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(B):4,5,6") | |
| 1684 | // PORT_DIPSETTING( 0x30, "1" ) // 0x38 energy, smallest damage | |
| 1685 | // PORT_DIPSETTING( 0x38, "1" ) // 0x38 energy, small damage | |
| 1686 | // PORT_DIPSETTING( 0x28, "1" ) // 0x38 energy, big damage | |
| 1687 | // PORT_DIPSETTING( 0x20, "1" ) // 0x38 energy, biggest damage | |
| 1688 | PORT_DIPSETTING( 0x10, "1" ) // 0x20 energy, smallest damage | |
| 1689 | PORT_DIPSETTING( 0x18, "2" ) // 0x20 energy, small damage | |
| 1690 | PORT_DIPSETTING( 0x08, "3" ) // 0x20 energy, big damage | |
| 1691 | PORT_DIPSETTING( 0x00, "4" ) // 0x20 energy, biggest damage | |
| 1692 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" ) | |
| 1693 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 1759 | 1694 | |
| 1760 | 1695 | PORT_START_TAG("DSWC") |
| 1761 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) | |
| 1762 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1763 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1764 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) | |
| 1765 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 1766 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1767 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 1696 | PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW(C):1" ) | |
| 1697 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" ) | |
| 1698 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 1768 | 1699 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 1769 | 1700 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1770 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 1701 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 1771 | 1702 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1772 | 1703 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1773 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 1704 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 1774 | 1705 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1775 | 1706 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1776 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 1707 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 1777 | 1708 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 1778 | 1709 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1779 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 1710 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 1780 | 1711 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 1781 | 1712 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 1782 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 1713 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 1783 | 1714 | PORT_DIPSETTING( 0x80, "Game" ) |
| 1784 | 1715 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 1785 | 1716 | |
| r1293 | r1294 | |
| 1802 | 1733 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1803 | 1734 | INPUT_PORTS_END |
| 1804 | 1735 | |
| 1805 | /* I guess that bit | |
| 1736 | /* I guess that bit 8 of DSWB was used for debug purpose : | |
| 1806 | 1737 | - code at 0x001094 : move players during "attract mode" |
| 1807 | 1738 | - code at 0x019b62 ('msword' and 'mswordr1'), 0x019bde ('mswordu') or 0x019c26 ('mswordj') : unknown effect |
| 1808 | 1739 | - code at 0x01c322 ('msword' and 'mswordr1'), 0x01c39e ('mswordu') or 0x01c3e0 ('mswordj') : unknown effect |
| r1293 | r1294 | |
| 1819 | 1750 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1820 | 1751 | |
| 1821 | 1752 | PORT_START_TAG("DSWA") |
| 1822 | CPS1_COINAGE_1 | |
| 1823 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 1753 | CPS1_COINAGE_1( "SW(A)" ) | |
| 1754 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 1824 | 1755 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1825 | 1756 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1826 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1827 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1828 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1757 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 1829 | 1758 | |
| 1830 | 1759 | PORT_START_TAG("DSWB") |
| 1831 | PORT_DIPNAME( 0x07, 0x04, "Player's vitality consumption" ) // "Level 1" | |
| 1832 | PORT_DIPSETTING( 0x07, "1 (Easiest)" ) // "Easy 3" (-1 every 28 frames) | |
| 1833 | PORT_DIPSETTING( 0x06, "2" ) // "Easy 2" (-1 every 24 frames) | |
| 1834 | PORT_DIPSETTING( 0x05, "3" ) // "Easy 1" (-1 every 20 frames) | |
| 1835 | PORT_DIPSETTING( 0x04, "4 (Normal)" ) // DEF_STR( Normal ) (-1 every 18 frames) | |
| 1836 | PORT_DIPSETTING( 0x03, "5" ) // "Difficult 1" (-1 every 16 frames) | |
| 1837 | PORT_DIPSETTING( 0x02, "6" ) // "Difficult 2" (-1 every 14 frames) | |
| 1838 | PORT_DIPSETTING( 0x01, "7" ) // "Difficult 3" (-1 every 12 frames) | |
| 1839 | PORT_DIPSETTING( 0x00, "8 (Hardest)" ) // "Difficult 4" (-1 every 8 frames) | |
| 1840 | PORT_DIPNAME( 0x38, 0x38, "Enemy's vitality and attacking power" )// "Level 2" | |
| 1760 | PORT_DIPNAME( 0x07, 0x04, "Player's vitality consumption" ) PORT_DIPLOCATION("SW(B):1,2,3") // "Level 1" | |
| 1761 | PORT_DIPSETTING( 0x07, "1 (Easiest)" ) // "Easy 3" (-1 every 28 frames) | |
| 1762 | PORT_DIPSETTING( 0x06, "2" ) // "Easy 2" (-1 every 24 frames) | |
| 1763 | PORT_DIPSETTING( 0x05, "3" ) // "Easy 1" (-1 every 20 frames) | |
| 1764 | PORT_DIPSETTING( 0x04, "4 (Normal)" ) // DEF_STR( Normal ) (-1 every 18 frames) | |
| 1765 | PORT_DIPSETTING( 0x03, "5" ) // "Difficult 1" (-1 every 16 frames) | |
| 1766 | PORT_DIPSETTING( 0x02, "6" ) // "Difficult 2" (-1 every 14 frames) | |
| 1767 | PORT_DIPSETTING( 0x01, "7" ) // "Difficult 3" (-1 every 12 frames) | |
| 1768 | PORT_DIPSETTING( 0x00, "8 (Hardest)" ) // "Difficult 4" (-1 every 8 frames) | |
| 1769 | PORT_DIPNAME( 0x38, 0x38, "Enemy's vitality and attacking power" ) PORT_DIPLOCATION("SW(B):4,5,6") // "Level 2" | |
| 1841 | 1770 | PORT_DIPSETTING( 0x20, "1 (Easiest)" ) // "Easy 3" |
| 1842 | PORT_DIPSETTING( 0x28, "2" ) // "Easy 2" | |
| 1843 | PORT_DIPSETTING( 0x30, "3" ) // "Easy 1" | |
| 1771 | PORT_DIPSETTING( 0x28, "2" ) // "Easy 2" | |
| 1772 | PORT_DIPSETTING( 0x30, "3" ) // "Easy 1" | |
| 1844 | 1773 | PORT_DIPSETTING( 0x38, "4 (Normal)" ) // DEF_STR( Normal ) |
| 1845 | PORT_DIPSETTING( 0x18, "5" ) // "Difficult 1" | |
| 1846 | PORT_DIPSETTING( 0x10, "6" ) // "Difficult 2" | |
| 1847 | PORT_DIPSETTING( 0x08, "7" ) // "Difficult 3" | |
| 1774 | PORT_DIPSETTING( 0x18, "5" ) // "Difficult 1" | |
| 1775 | PORT_DIPSETTING( 0x10, "6" ) // "Difficult 2" | |
| 1776 | PORT_DIPSETTING( 0x08, "7" ) // "Difficult 3" | |
| 1848 | 1777 | PORT_DIPSETTING( 0x00, "8 (Hardest)" ) // "Difficult 4" |
| 1849 | PORT_DIPNAME( 0x40, 0x00, "Stage Select" ) | |
| 1778 | PORT_DIPNAME( 0x40, 0x00, "Stage Select" ) PORT_DIPLOCATION("SW(B):7") | |
| 1850 | 1779 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1851 | 1780 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1852 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1853 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1854 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1781 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 1855 | 1782 | |
| 1856 | 1783 | PORT_START_TAG("DSWC") |
| 1857 | PORT_DIPNAME( 0x03, 0x03, "Vitality Packs" ) | |
| 1858 | PORT_DIPSETTING( 0x00, "1" ) // 0x0320 | |
| 1859 | PORT_DIPSETTING( 0x03, "2" ) // 0x0640 | |
| 1784 | PORT_DIPNAME( 0x03, 0x03, "Vitality Packs" ) PORT_DIPLOCATION("SW(C):1,2") | |
| 1785 | PORT_DIPSETTING( 0x00, "1" ) // 0x0320 | |
| 1786 | PORT_DIPSETTING( 0x03, "2" ) // 0x0640 | |
| 1860 | 1787 | PORT_DIPSETTING( 0x02, "3 (2 when continue)" ) // 0x0960 (0x0640 when continue) |
| 1861 | 1788 | PORT_DIPSETTING( 0x01, "4 (3 when continue)" ) // 0x0c80 (0x0960 when continue) |
| 1862 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 1789 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 1863 | 1790 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 1864 | 1791 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1865 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 1792 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 1866 | 1793 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1867 | 1794 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1868 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 1795 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 1869 | 1796 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1870 | 1797 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1871 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 1798 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 1872 | 1799 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 1873 | 1800 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1874 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 1801 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 1875 | 1802 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 1876 | 1803 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 1877 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 1804 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 1878 | 1805 | PORT_DIPSETTING( 0x80, "Game" ) |
| 1879 | 1806 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 1880 | 1807 | |
| r1293 | r1294 | |
| 1909 | 1836 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1910 | 1837 | |
| 1911 | 1838 | PORT_START_TAG("DSWA") |
| 1912 | CPS1_COINAGE_1 | |
| 1913 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 1914 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1915 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1916 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1917 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1918 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1839 | CPS1_COINAGE_1( "SW(A)" ) | |
| 1840 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 1841 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) // Overrides all other coinage settings | |
| 1842 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // according to manual | |
| 1843 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) // This switch is not documented | |
| 1919 | 1844 | |
| 1920 | 1845 | PORT_START_TAG("DSWB") |
| 1921 | PORT_DIPNAME( 0x07, 0x04, "Difficulty Level (Enemy's Strength)" ) | |
| 1846 | PORT_DIPNAME( 0x07, 0x04, "Difficulty Level (Enemy's Strength)" ) PORT_DIPLOCATION("SW(B):1,2,3") | |
| 1922 | 1847 | PORT_DIPSETTING( 0x07, "1 (Easiest)" ) |
| 1923 | 1848 | PORT_DIPSETTING( 0x06, "2" ) |
| 1924 | 1849 | PORT_DIPSETTING( 0x05, "3" ) |
| r1293 | r1294 | |
| 1927 | 1852 | PORT_DIPSETTING( 0x02, "6" ) |
| 1928 | 1853 | PORT_DIPSETTING( 0x01, "7" ) |
| 1929 | 1854 | PORT_DIPSETTING( 0x00, "8 (Hardest)" ) |
| 1930 | PORT_DIPNAME( 0x18, 0x18, "Difficulty Level (Player's Strength)" ) | |
| 1855 | PORT_DIPNAME( 0x18, 0x18, "Difficulty Level (Player's Strength)" ) PORT_DIPLOCATION("SW(B):4,5") | |
| 1931 | 1856 | PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) |
| 1932 | 1857 | PORT_DIPSETTING( 0x18, DEF_STR( Normal ) ) |
| 1933 | 1858 | PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) |
| 1934 | 1859 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 1935 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 1936 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1937 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1938 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 1939 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1940 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1941 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 1942 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1943 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1860 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(B):6" ) // This switch is not documented | |
| 1861 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" ) // This switch is not documented | |
| 1862 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) // This switch is not documented | |
| 1944 | 1863 | |
| 1945 | 1864 | PORT_START_TAG("DSWC") |
| 1946 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) | |
| 1947 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1948 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1949 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) | |
| 1950 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 1951 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1952 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 1865 | PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW(C):1" ) // This switch is not documented | |
| 1866 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" ) // This switch is not documented | |
| 1867 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 1953 | 1868 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 1954 | 1869 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1955 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 1870 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 1956 | 1871 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1957 | 1872 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1958 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 1873 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 1959 | 1874 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1960 | 1875 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1961 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 1876 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 1962 | 1877 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 1963 | 1878 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1964 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 1879 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 1965 | 1880 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 1966 | 1881 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 1967 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 1882 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 1968 | 1883 | PORT_DIPSETTING( 0x80, "Game" ) |
| 1969 | 1884 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 1970 | 1885 | |
| r1293 | r1294 | |
| 2000 | 1915 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2001 | 1916 | |
| 2002 | 1917 | PORT_START_TAG("DSWA") |
| 2003 | CPS1_COINAGE_1 | |
| 2004 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 1918 | CPS1_COINAGE_1( "SW(A)" ) | |
| 1919 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 2005 | 1920 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2006 | 1921 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2007 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 2008 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2009 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1922 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 2010 | 1923 | |
| 2011 | 1924 | PORT_START_TAG("DSWB") |
| 2012 | CPS1_DIFFICULTY_1 | |
| 2013 | PORT_DIPNAME( 0x18, 0x18, "Life Bar" ) | |
| 1925 | CPS1_DIFFICULTY_1( "SW(B)" ) | |
| 1926 | PORT_DIPNAME( 0x18, 0x18, "Life Bar" ) PORT_DIPLOCATION("SW(B):4,5") | |
| 2014 | 1927 | PORT_DIPSETTING( 0x00, "Minimun" ) |
| 2015 | 1928 | PORT_DIPSETTING( 0x18, DEF_STR( Medium ) ) |
| 2016 | 1929 | // PORT_DIPSETTING( 0x10, DEF_STR( Medium ) ) |
| 2017 | 1930 | PORT_DIPSETTING( 0x08, "Maximum" ) |
| 2018 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 2019 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2020 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2021 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 2022 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 2023 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2024 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 2025 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2026 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1931 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(B):6" ) | |
| 1932 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" ) | |
| 1933 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 2027 | 1934 | |
| 2028 | 1935 | PORT_START_TAG("DSWC") |
| 2029 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) | |
| 1936 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(C):1,2") | |
| 2030 | 1937 | PORT_DIPSETTING( 0x02, "1" ) |
| 2031 | 1938 | PORT_DIPSETTING( 0x03, "2" ) |
| 2032 | 1939 | PORT_DIPSETTING( 0x01, "3" ) |
| 2033 | 1940 | PORT_DIPSETTING( 0x00, "4" ) |
| 2034 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 1941 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 2035 | 1942 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 2036 | 1943 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2037 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 1944 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 2038 | 1945 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 2039 | 1946 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2040 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 1947 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 2041 | 1948 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2042 | 1949 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2043 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 1950 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 2044 | 1951 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2045 | 1952 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2046 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 1953 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 2047 | 1954 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 2048 | 1955 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 2049 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 1956 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 2050 | 1957 | PORT_DIPSETTING( 0x80, "Game" ) |
| 2051 | 1958 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) // To enable the "debug" features |
| 2052 | 1959 | |
| r1293 | r1294 | |
| 2081 | 1988 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2082 | 1989 | |
| 2083 | 1990 | PORT_START_TAG("DSWA") |
| 2084 | CPS1_COINAGE_1 | |
| 2085 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 1991 | CPS1_COINAGE_1( "SW(A)" ) | |
| 1992 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 2086 | 1993 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2087 | 1994 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2088 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 2089 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2090 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1995 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 2091 | 1996 | |
| 2092 | 1997 | PORT_START_TAG("DSWB") |
| 2093 | CPS1_DIFFICULTY_1 | |
| 2094 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 2095 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 2096 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2097 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) | |
| 2098 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 2099 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2100 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 2101 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2102 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2103 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 2104 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 2105 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2106 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 2107 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2108 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1998 | CPS1_DIFFICULTY_1( "SW(B)" ) | |
| 1999 | PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW(B):4" ) | |
| 2000 | PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW(B):5" ) | |
| 2001 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(B):6" ) | |
| 2002 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" ) | |
| 2003 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 2109 | 2004 | |
| 2110 | 2005 | PORT_START_TAG("DSWC") |
| 2111 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) | |
| 2112 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 2113 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2114 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) | |
| 2115 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 2116 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2117 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 2006 | PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW(C):1" ) | |
| 2007 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" ) | |
| 2008 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 2118 | 2009 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 2119 | 2010 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2120 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 2011 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 2121 | 2012 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 2122 | 2013 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2123 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 2014 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 2124 | 2015 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2125 | 2016 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2126 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 2017 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 2127 | 2018 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2128 | 2019 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2129 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 2020 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 2130 | 2021 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 2131 | 2022 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 2132 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 2023 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 2133 | 2024 | PORT_DIPSETTING( 0x80, "Game" ) |
| 2134 | 2025 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 2135 | 2026 | |
| r1293 | r1294 | |
| 2175 | 2066 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2176 | 2067 | |
| 2177 | 2068 | PORT_START_TAG("DSWA") |
| 2178 | CPS1_COINAGE_1 | |
| 2179 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 2069 | CPS1_COINAGE_1( "SW(A)" ) | |
| 2070 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 2180 | 2071 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2181 | 2072 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2182 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 2183 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2184 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2073 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 2185 | 2074 | |
| 2186 | 2075 | PORT_START_TAG("DSWB") |
| 2187 | CPS1_DIFFICULTY_1 | |
| 2188 | PORT_DIPNAME( 0x08, 0x00, "2 Players Game" ) | |
| 2076 | CPS1_DIFFICULTY_1( "SW(B)" ) | |
| 2077 | PORT_DIPNAME( 0x08, 0x00, "2 Players Game" ) PORT_DIPLOCATION("SW(B):4") | |
| 2189 | 2078 | PORT_DIPSETTING( 0x08, "1 Credit/No Continue" ) |
| 2190 | 2079 | PORT_DIPSETTING( 0x00, "2 Credits/Winner Continue" ) //Winner stays, loser pays, in other words. |
| 2191 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 2192 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 2193 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2194 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 2195 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2196 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2197 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 2198 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 2199 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2200 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 2201 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2202 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2080 | PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW(B):5" ) | |
| 2081 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(B):6" ) | |
| 2082 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" ) | |
| 2083 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 2203 | 2084 | |
| 2204 | 2085 | PORT_START_TAG("DSWC") |
| 2205 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 2206 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 2207 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2208 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 2209 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 2210 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2211 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 2086 | PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW(C):1" ) | |
| 2087 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" ) | |
| 2088 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 2212 | 2089 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 2213 | 2090 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2214 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 2091 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 2215 | 2092 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 2216 | 2093 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2217 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 2094 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 2218 | 2095 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2219 | 2096 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2220 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 2097 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 2221 | 2098 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2222 | 2099 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2223 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 2100 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 2224 | 2101 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 2225 | 2102 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 2226 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 2103 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 2227 | 2104 | PORT_DIPSETTING( 0x80, "Game" ) |
| 2228 | 2105 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 2229 | 2106 | |
| r1293 | r1294 | |
| 2268 | 2145 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2269 | 2146 | |
| 2270 | 2147 | PORT_START_TAG("DSWA") |
| 2271 | CPS1_COINAGE_1 | |
| 2272 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 2273 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 2274 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2148 | CPS1_COINAGE_1( "SW(A)" ) | |
| 2149 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 2150 | PORT_CONDITION("DSWA",0x3f,PORTCOND_NOTEQUALS,0x00) | |
| 2151 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_CONDITION("DSWA",0x3f,PORTCOND_NOTEQUALS,0x00) | |
| 2152 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWA",0x3f,PORTCOND_NOTEQUALS,0x00) | |
| 2153 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(A):7") | |
| 2154 | PORT_CONDITION("DSWA",0x3f,PORTCOND_EQUALS,0x00) | |
| 2155 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_CONDITION("DSWA",0x3f,PORTCOND_EQUALS,0x00) | |
| 2156 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("DSWA",0x3f,PORTCOND_EQUALS,0x00) | |
| 2275 | 2157 | /* Free Play: ALL bits 0 to 7 must be ON ; 4C_1C, 4C_1C, 2 Coins to Start, 1 to Continue ON */ |
| 2276 | PORT_DIPNAME( 0x80, 0x80, "Freeze" ) | |
| 2158 | PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("SW(A):8") | |
| 2277 | 2159 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 2278 | 2160 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2279 | 2161 | |
| 2280 | 2162 | PORT_START_TAG("DSWB") |
| 2281 | PORT_DIPNAME( 0x03, 0x02, "Lives (Midnight Wanderers)" ) | |
| 2163 | PORT_DIPNAME( 0x03, 0x02, "Lives (Midnight Wanderers)" ) PORT_DIPLOCATION("SW(B):1,2") | |
| 2282 | 2164 | PORT_DIPSETTING( 0x03, "1" ) |
| 2283 | 2165 | PORT_DIPSETTING( 0x02, "2" ) |
| 2284 | 2166 | PORT_DIPSETTING( 0x01, "3" ) |
| 2285 | 2167 | PORT_DIPSETTING( 0x00, "5" ) |
| 2286 | PORT_DIPNAME( 0x0c, 0x08, "Difficulty (Midnight Wanderers)" ) | |
| 2168 | PORT_DIPNAME( 0x0c, 0x08, "Difficulty (Midnight Wanderers)" ) PORT_DIPLOCATION("SW(B):3,4") | |
| 2287 | 2169 | PORT_DIPSETTING( 0x0c, DEF_STR( Easy ) ) |
| 2288 | 2170 | PORT_DIPSETTING( 0x08, DEF_STR( Normal ) ) |
| 2289 | 2171 | PORT_DIPSETTING( 0x04, DEF_STR( Hard ) ) |
| 2290 | 2172 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 2291 | PORT_DIPNAME( 0x30, 0x10, "Lives (Chariot)" ) | |
| 2173 | PORT_DIPNAME( 0x30, 0x10, "Lives (Chariot)" ) PORT_DIPLOCATION("SW(B):5,6") | |
| 2292 | 2174 | PORT_DIPSETTING( 0x30, "1" ) |
| 2293 | 2175 | PORT_DIPSETTING( 0x20, "2" ) |
| 2294 | 2176 | PORT_DIPSETTING( 0x10, "3" ) |
| 2295 | 2177 | PORT_DIPSETTING( 0x00, "5" ) |
| 2296 | PORT_DIPNAME( 0xc0, 0x80, "Difficulty (Chariot)" ) | |
| 2178 | PORT_DIPNAME( 0xc0, 0x80, "Difficulty (Chariot)" ) PORT_DIPLOCATION("SW(B):7,8") | |
| 2297 | 2179 | PORT_DIPSETTING( 0xc0, DEF_STR( Easy ) ) |
| 2298 | 2180 | PORT_DIPSETTING( 0x80, DEF_STR( Normal ) ) |
| 2299 | 2181 | PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) |
| 2300 | 2182 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 2301 | 2183 | |
| 2302 | 2184 | PORT_START_TAG("DSWC") |
| 2303 | PORT_DIPNAME( 0x03, 0x01, "Lives (Don't Pull)" ) | |
| 2185 | PORT_DIPNAME( 0x03, 0x01, "Lives (Don't Pull)" ) PORT_DIPLOCATION("SW(C):1,2") | |
| 2304 | 2186 | PORT_DIPSETTING( 0x03, "1" ) |
| 2305 | 2187 | PORT_DIPSETTING( 0x02, "2" ) |
| 2306 | 2188 | PORT_DIPSETTING( 0x01, "3" ) |
| 2307 | 2189 | PORT_DIPSETTING( 0x00, "5" ) |
| 2308 | PORT_DIPNAME( 0x0c, 0x08, "Difficulty (Don't Pull)" ) | |
| 2190 | PORT_DIPNAME( 0x0c, 0x08, "Difficulty (Don't Pull)" ) PORT_DIPLOCATION("SW(C):3,4") | |
| 2309 | 2191 | PORT_DIPSETTING( 0x0c, DEF_STR( Easy ) ) |
| 2310 | 2192 | PORT_DIPSETTING( 0x08, DEF_STR( Normal ) ) |
| 2311 | 2193 | PORT_DIPSETTING( 0x04, DEF_STR( Hard ) ) |
| 2312 | 2194 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 2313 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 2195 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 2314 | 2196 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2315 | 2197 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2316 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 2198 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 2317 | 2199 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2318 | 2200 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2319 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 2201 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 2320 | 2202 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 2321 | 2203 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 2322 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 2204 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 2323 | 2205 | PORT_DIPSETTING( 0x80, "Game" ) |
| 2324 | 2206 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 2325 | 2207 | |
| r1293 | r1294 | |
| 2354 | 2236 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2355 | 2237 | |
| 2356 | 2238 | PORT_START_TAG("DSWA") |
| 2357 | CPS1_COINAGE_2 | |
| 2358 | PORT_DIPNAME( 0x08, 0x08, "Coin Slots" ) | |
| 2239 | CPS1_COINAGE_2( "SW(A)" ) | |
| 2240 | PORT_DIPNAME( 0x08, 0x08, "Coin Slots" ) PORT_DIPLOCATION("SW(A):4") | |
| 2359 | 2241 | PORT_DIPSETTING( 0x00, "1" ) |
| 2360 | 2242 | PORT_DIPSETTING( 0x08, "3" ) |
| 2361 | PORT_DIPNAME( 0x10, 0x10, "Play Mode" ) | |
| 2243 | PORT_DIPNAME( 0x10, 0x10, "Play Mode" ) PORT_DIPLOCATION("SW(A):5") | |
| 2362 | 2244 | PORT_DIPSETTING( 0x00, "2 Players" ) |
| 2363 | 2245 | PORT_DIPSETTING( 0x10, "3 Players" ) |
| 2364 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 2365 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2366 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2367 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 2246 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(A):6" ) | |
| 2247 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 2368 | 2248 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2369 | 2249 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2370 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 2371 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2372 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2250 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 2373 | 2251 | |
| 2374 | 2252 | PORT_START_TAG("DSWB") |
| 2375 | CPS1_DIFFICULTY_1 | |
| 2376 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Lives ) ) | |
| 2253 | CPS1_DIFFICULTY_1( "SW(B)" ) | |
| 2254 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(B):4,5,6") | |
| 2377 | 2255 | PORT_DIPSETTING( 0x30, "1" ) |
| 2378 | 2256 | PORT_DIPSETTING( 0x38, "2" ) |
| 2379 | 2257 | PORT_DIPSETTING( 0x28, "3" ) |
| r1293 | r1294 | |
| 2382 | 2260 | PORT_DIPSETTING( 0x10, "6" ) |
| 2383 | 2261 | PORT_DIPSETTING( 0x08, "7" ) |
| 2384 | 2262 | PORT_DIPSETTING( 0x00, "8" ) |
| 2385 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) ) | |
| 2263 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW(B):7,8") | |
| 2386 | 2264 | PORT_DIPSETTING( 0x80, "80k and every 400k" ) |
| 2387 | 2265 | PORT_DIPSETTING( 0xc0, "100k and every 450k" ) |
| 2388 | 2266 | PORT_DIPSETTING( 0x40, "160k and every 450k" ) |
| 2389 | 2267 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 2390 | 2268 | |
| 2391 | 2269 | PORT_START_TAG("DSWC") |
| 2392 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) | |
| 2393 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 2394 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2395 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) | |
| 2396 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 2397 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2398 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 2270 | PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW(C):1" ) | |
| 2271 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" ) | |
| 2272 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 2399 | 2273 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 2400 | 2274 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2401 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 2275 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 2402 | 2276 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 2403 | 2277 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2404 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 2278 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 2405 | 2279 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2406 | 2280 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2407 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 2281 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 2408 | 2282 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2409 | 2283 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2410 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 2284 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 2411 | 2285 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 2412 | 2286 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 2413 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 2287 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 2414 | 2288 | PORT_DIPSETTING( 0x80, "Game" ) |
| 2415 | 2289 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 2416 | 2290 | |
| r1293 | r1294 | |
| 2446 | 2320 | /* Needs further checking |
| 2447 | 2321 | Same as kod but different "Bonus_life" values */ |
| 2448 | 2322 | static INPUT_PORTS_START( kodj ) |
| 2449 | PORT_START_TAG("IN0") | |
| 2450 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 2451 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 2452 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 2453 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2454 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) | |
| 2455 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) | |
| 2456 | PORT_SERVICE_NO_TOGGLE( 0x40, IP_ACTIVE_LOW ) | |
| 2457 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2323 | PORT_INCLUDE( kod ) | |
| 2458 | 2324 | |
| 2459 | PORT_START_TAG("DSWA") | |
| 2460 | CPS1_COINAGE_2 | |
| 2461 | PORT_DIPNAME( 0x08, 0x08, "Coin Slots" ) | |
| 2462 | PORT_DIPSETTING( 0x00, "1" ) | |
| 2463 | PORT_DIPSETTING( 0x08, "3" ) | |
| 2464 | PORT_DIPNAME( 0x10, 0x10, "Play Mode" ) | |
| 2465 | PORT_DIPSETTING( 0x00, "2 Players" ) | |
| 2466 | PORT_DIPSETTING( 0x10, "3 Players" ) | |
| 2467 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 2468 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2469 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2470 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 2471 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 2472 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2473 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 2474 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2475 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2476 | ||
| 2477 | PORT_START_TAG("DSWB") | |
| 2478 | CPS1_DIFFICULTY_1 | |
| 2479 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Lives ) ) | |
| 2480 | PORT_DIPSETTING( 0x30, "1" ) | |
| 2481 | PORT_DIPSETTING( 0x38, "2" ) | |
| 2482 | PORT_DIPSETTING( 0x28, "3" ) | |
| 2483 | PORT_DIPSETTING( 0x20, "4" ) | |
| 2484 | PORT_DIPSETTING( 0x18, "5" ) | |
| 2485 | PORT_DIPSETTING( 0x10, "6" ) | |
| 2486 | PORT_DIPSETTING( 0x08, "7" ) | |
| 2487 | PORT_DIPSETTING( 0x00, "8" ) | |
| 2488 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) ) | |
| 2325 | PORT_MODIFY("DSWB") | |
| 2326 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW(B):7,8") | |
| 2489 | 2327 | PORT_DIPSETTING( 0x80, "80k and every 400k" ) |
| 2490 | PORT_DIPSETTING( 0xc0, "200k and every 450k" ) | |
| 2491 | 2328 | PORT_DIPSETTING( 0x40, "160k and every 450k" ) |
| 2329 | PORT_DIPSETTING( 0xc0, "200k and every 450k" ) | |
| 2492 | 2330 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 2493 | ||
| 2494 | PORT_START_TAG("DSWC") | |
| 2495 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) | |
| 2496 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 2497 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2498 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) | |
| 2499 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 2500 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2501 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 2502 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 2503 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2504 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 2505 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 2506 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2507 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 2508 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 2509 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2510 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 2511 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2512 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2513 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 2514 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) | |
| 2515 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) | |
| 2516 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 2517 | PORT_DIPSETTING( 0x80, "Game" ) | |
| 2518 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) | |
| 2519 | ||
| 2520 | PORT_START_TAG("IN1") | |
| 2521 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 2522 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 2523 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 2524 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 2525 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 2526 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 2527 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2528 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2529 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 2530 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 2531 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 2532 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 2533 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 2534 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 2535 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2536 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2537 | ||
| 2538 | PORT_START_TAG("IN2") /* Player 3 */ | |
| 2539 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) | |
| 2540 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) | |
| 2541 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) | |
| 2542 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) | |
| 2543 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) | |
| 2544 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) | |
| 2545 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 ) | |
| 2546 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 ) | |
| 2547 | 2331 | INPUT_PORTS_END |
| 2548 | 2332 | |
| 2549 | 2333 | |
| r1293 | r1294 | |
| 2559 | 2343 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2560 | 2344 | |
| 2561 | 2345 | PORT_START_TAG("DSWA") |
| 2562 | CPS1_COINAGE_2 | |
| 2563 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 2564 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 2565 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2566 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) | |
| 2567 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 2568 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2569 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 2570 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2571 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2572 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 2346 | CPS1_COINAGE_2( "SW(A)" ) | |
| 2347 | PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW(A):4" ) // The manual says to leave these three | |
| 2348 | PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW(A):5" ) // switches off. Does turning them on cause | |
| 2349 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(A):6" ) // any "undesirable" behaviour? | |
| 2350 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 2573 | 2351 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2574 | 2352 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2575 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 2576 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2577 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2353 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) // Unused according to manual | |
| 2578 | 2354 | |
| 2579 | 2355 | PORT_START_TAG("DSWB") |
| 2580 | PORT_DIPNAME( 0x07, 0x04, "Difficulty 1" ) | |
| 2356 | PORT_DIPNAME( 0x07, 0x04, "Difficulty 1" ) PORT_DIPLOCATION("SW(B):1,2,3") | |
| 2581 | 2357 | PORT_DIPSETTING( 0x07, "1 (Easiest)" ) |
| 2582 | 2358 | PORT_DIPSETTING( 0x06, "2" ) |
| 2583 | 2359 | PORT_DIPSETTING( 0x05, "3" ) |
| r1293 | r1294 | |
| 2586 | 2362 | PORT_DIPSETTING( 0x02, "6" ) |
| 2587 | 2363 | PORT_DIPSETTING( 0x01, "7" ) |
| 2588 | 2364 | PORT_DIPSETTING( 0x00, "8 (Hardest)" ) |
| 2589 | PORT_DIPNAME( 0x18, 0x10, "Difficulty 2" ) | |
| 2365 | PORT_DIPNAME( 0x18, 0x10, "Difficulty 2" ) PORT_DIPLOCATION("SW(B):4,5") | |
| 2590 | 2366 | PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) |
| 2591 | 2367 | PORT_DIPSETTING( 0x10, DEF_STR( Normal ) ) |
| 2592 | 2368 | PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) |
| 2593 | 2369 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 2594 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 2595 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2596 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2597 | PORT_DIPNAME( 0xc0, 0xc0, "Play Mode" ) | |
| 2370 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(B):6" ) // Manual says to leave this switch off. | |
| 2371 | PORT_DIPNAME( 0xc0, 0xc0, "Play Mode" ) PORT_DIPLOCATION("SW(B):7,8") | |
| 2598 | 2372 | PORT_DIPSETTING( 0x40, "1 Players" ) // Actual setting is 4 players |
| 2599 | 2373 | PORT_DIPSETTING( 0xc0, "2 Players" ) |
| 2600 | 2374 | PORT_DIPSETTING( 0x80, "3 Players" ) |
| 2601 | 2375 | PORT_DIPSETTING( 0x00, "4 Players" ) |
| 2602 | 2376 | |
| 2603 | 2377 | PORT_START_TAG("DSWC") |
| 2604 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) | |
| 2378 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(C):1,2") | |
| 2605 | 2379 | PORT_DIPSETTING( 0x00, "1" ) |
| 2606 | 2380 | PORT_DIPSETTING( 0x03, "2" ) |
| 2607 | 2381 | PORT_DIPSETTING( 0x02, "3" ) |
| 2608 | 2382 | PORT_DIPSETTING( 0x01, "4" ) |
| 2609 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 2383 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 2610 | 2384 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 2611 | 2385 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2612 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 2386 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 2613 | 2387 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 2614 | 2388 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2615 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 2389 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 2616 | 2390 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2617 | 2391 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2618 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 2392 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 2619 | 2393 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2620 | 2394 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2621 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 2395 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 2622 | 2396 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 2623 | 2397 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 2624 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 2398 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 2625 | 2399 | PORT_DIPSETTING( 0x80, "Game" ) |
| 2626 | 2400 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 2627 | 2401 | |
| r1293 | r1294 | |
| 2676 | 2450 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2677 | 2451 | |
| 2678 | 2452 | PORT_START_TAG("DSWA") |
| 2679 | CPS1_COINAGE_2 | |
| 2680 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 2681 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 2682 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2683 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) | |
| 2684 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 2685 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2686 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 2687 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2688 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2689 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 2453 | CPS1_COINAGE_2( "SW(A)" ) | |
| 2454 | PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW(A):4" ) | |
| 2455 | PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW(A):5" ) | |
| 2456 | PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW(A):6" ) | |
| 2457 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 2690 | 2458 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2691 | 2459 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2692 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 2693 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2694 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2460 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 2695 | 2461 | |
| 2696 | 2462 | PORT_START_TAG("DSWB") |
| 2697 | PORT_DIPNAME( 0x07, 0x04, "Enemy's attack frequency" ) | |
| 2463 | PORT_DIPNAME( 0x07, 0x04, "Enemy's attack frequency" ) PORT_DIPLOCATION("SW(B):1,2,3") | |
| 2698 | 2464 | PORT_DIPSETTING( 0x07, "1 (Easiest)" ) |
| 2699 | 2465 | PORT_DIPSETTING( 0x06, "2" ) |
| 2700 | 2466 | PORT_DIPSETTING( 0x05, "3" ) |
| r1293 | r1294 | |
| 2703 | 2469 | PORT_DIPSETTING( 0x02, "6" ) |
| 2704 | 2470 | PORT_DIPSETTING( 0x01, "7" ) |
| 2705 | 2471 | PORT_DIPSETTING( 0x00, "8 (Hardest)" ) |
| 2706 | PORT_DIPNAME( 0x38, 0x38, "Enemy's attack power" ) | |
| 2472 | PORT_DIPNAME( 0x38, 0x38, "Enemy's attack power" ) PORT_DIPLOCATION("SW(B):4,5,6") | |
| 2707 | 2473 | PORT_DIPSETTING( 0x00, "1 (Easiest)" ) |
| 2708 | 2474 | PORT_DIPSETTING( 0x08, "2" ) |
| 2709 | 2475 | PORT_DIPSETTING( 0x10, "3" ) |
| r1293 | r1294 | |
| 2712 | 2478 | PORT_DIPSETTING( 0x28, "6" ) |
| 2713 | 2479 | PORT_DIPSETTING( 0x20, "7" ) |
| 2714 | 2480 | PORT_DIPSETTING( 0x18, "8 (Hardest)" ) |
| 2715 | PORT_DIPNAME( 0x40, 0x40, "Coin Slots" ) | |
| 2481 | PORT_DIPNAME( 0x40, 0x40, "Coin Slots" ) PORT_DIPLOCATION("SW(B):7") | |
| 2716 | 2482 | PORT_DIPSETTING( 0x00, "1" ) |
| 2717 | 2483 | PORT_DIPSETTING( 0x40, "3" ) |
| 2718 | PORT_DIPNAME( 0x80, 0x80, "Play Mode" ) | |
| 2484 | PORT_DIPNAME( 0x80, 0x80, "Play Mode" ) PORT_DIPLOCATION("SW(B):8") | |
| 2719 | 2485 | PORT_DIPSETTING( 0x00, "2 Players" ) |
| 2720 | 2486 | PORT_DIPSETTING( 0x80, "3 Players" ) |
| 2721 | 2487 | |
| 2722 | 2488 | PORT_START_TAG("DSWC") |
| 2723 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) | |
| 2489 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(C):1,2") | |
| 2724 | 2490 | PORT_DIPSETTING( 0x00, "1" ) |
| 2725 | 2491 | PORT_DIPSETTING( 0x03, "2" ) |
| 2726 | 2492 | PORT_DIPSETTING( 0x02, "3" ) |
| 2727 | 2493 | PORT_DIPSETTING( 0x01, "4" ) |
| 2728 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 2494 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 2729 | 2495 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 2730 | 2496 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2731 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 2497 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 2732 | 2498 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 2733 | 2499 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2734 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 2500 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 2735 | 2501 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2736 | 2502 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2737 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 2503 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 2738 | 2504 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2739 | 2505 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2740 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 2506 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 2741 | 2507 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 2742 | 2508 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 2743 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 2509 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 2744 | 2510 | PORT_DIPSETTING( 0x80, "Game" ) |
| 2745 | 2511 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 2746 | 2512 | |
| r1293 | r1294 | |
| 2785 | 2551 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2786 | 2552 | |
| 2787 | 2553 | PORT_START_TAG("DSWA") |
| 2788 | CPS1_COINAGE_1 | |
| 2789 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 2554 | CPS1_COINAGE_1( "SW(A)" ) | |
| 2555 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 2790 | 2556 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2791 | 2557 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2792 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 2793 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2794 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2558 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 2795 | 2559 | |
| 2796 | 2560 | PORT_START_TAG("DSWB") |
| 2797 | CPS1_DIFFICULTY_1 | |
| 2798 | PORT_DIPNAME( 0x18, 0x10, DEF_STR( Bonus_Life ) ) | |
| 2561 | CPS1_DIFFICULTY_1( "SW(B)" ) | |
| 2562 | PORT_DIPNAME( 0x18, 0x10, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW(B):4,5") | |
| 2799 | 2563 | PORT_DIPSETTING( 0x18, "600k and every 1.400k" ) |
| 2800 | 2564 | PORT_DIPSETTING( 0x10, "600k 2.000k and 4500k" ) |
| 2801 | 2565 | PORT_DIPSETTING( 0x08, "1.200k 3.500k" ) |
| 2802 | 2566 | PORT_DIPSETTING( 0x00, "2000k only" ) |
| 2803 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 2804 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2805 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2806 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 2807 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 2808 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2809 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 2810 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 2811 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2567 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(B):6" ) | |
| 2568 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" ) | |
| 2569 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 2812 | 2570 | |
| 2813 | 2571 | PORT_START_TAG("DSWC") |
| 2814 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) | |
| 2572 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(C):1,2") | |
| 2815 | 2573 | PORT_DIPSETTING( 0x02, "1" ) |
| 2816 | 2574 | PORT_DIPSETTING( 0x01, "2" ) |
| 2817 | 2575 | PORT_DIPSETTING( 0x03, "3" ) |
| 2818 | 2576 | PORT_DIPSETTING( 0x00, "4" ) |
| 2819 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 2577 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 2820 | 2578 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 2821 | 2579 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2822 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 2580 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 2823 | 2581 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 2824 | 2582 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2825 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 2583 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 2826 | 2584 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2827 | 2585 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2828 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 2586 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 2829 | 2587 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2830 | 2588 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2831 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) | |
| 2589 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 2832 | 2590 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 2833 | 2591 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 2834 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 2592 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 2835 | 2593 | PORT_DIPSETTING( 0x80, "Game" ) |
| 2836 | 2594 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 2837 | 2595 | |
| r1293 | r1294 | |
| 2867 | 2625 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2868 | 2626 | |
| 2869 | 2627 | PORT_START_TAG("DSWA") |
| 2870 | CPS1_COINAGE_2 | |
| 2871 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 2872 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 2873 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2874 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 2875 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 2876 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2877 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 2878 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2879 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2880 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 2628 | CPS1_COINAGE_2( "SW(A)" ) | |
| 2629 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(A):4" ) | |
| 2630 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(A):5" ) | |
| 2631 | PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW(A):6" ) | |
| 2632 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 2881 | 2633 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2882 | 2634 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2883 | PORT_DIPNAME( 0x80, 0x80, "Extended Test Mode" ) | |
| 2635 | PORT_DIPNAME( 0x80, 0x80, "Extended Test Mode" ) PORT_DIPLOCATION("SW(A):8") | |
| 2884 | 2636 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 2885 | 2637 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2886 | 2638 | |
| 2887 | 2639 | PORT_START_TAG("DSWB") |
| 2888 | PORT_DIPNAME( 0x07, 0x06, DEF_STR( Difficulty ) ) | |
| 2640 | PORT_DIPNAME( 0x07, 0x06, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW(B):1,2,3") | |
| 2889 | 2641 | PORT_DIPSETTING( 0x06, "0" ) |
| 2890 | 2642 | PORT_DIPSETTING( 0x05, "1" ) |
| 2891 | 2643 | PORT_DIPSETTING( 0x04, "2" ) |
| 2892 | 2644 | PORT_DIPSETTING( 0x03, "3" ) |
| 2893 | 2645 | PORT_DIPSETTING( 0x02, "4" ) |
| 2894 | PORT_DIPNAME( 0x18, 0x18, "Extend" ) | |
| 2646 | PORT_DIPNAME( 0x18, 0x18, "Extend" ) PORT_DIPLOCATION("SW(B):4,5") | |
| 2895 | 2647 | PORT_DIPSETTING( 0x18, "N" ) |
| 2896 | 2648 | PORT_DIPSETTING( 0x10, "E" ) |
| 2897 | 2649 | PORT_DIPSETTING( 0x00, "D" ) |
| 2898 | PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Lives ) ) | |
| 2650 | PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(B):6,7,8") | |
| 2899 | 2651 | PORT_DIPSETTING( 0x00, "1" ) |
| 2900 | 2652 | PORT_DIPSETTING( 0x80, "2" ) |
| 2901 | 2653 | PORT_DIPSETTING( 0xe0, "3" ) |
| r1293 | r1294 | |
| 2903 | 2655 | PORT_DIPSETTING( 0xc0, "5" ) |
| 2904 | 2656 | |
| 2905 | 2657 | PORT_START_TAG("DSWC") |
| 2906 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 2907 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 2908 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2909 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 2910 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 2911 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2912 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 2658 | PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW(C):1" ) | |
| 2659 | PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW(C):2" ) | |
| 2660 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 2913 | 2661 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 2914 | 2662 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2915 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 2663 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 2916 | 2664 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 2917 | 2665 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2918 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 2666 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 2919 | 2667 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2920 | 2668 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2921 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 2669 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 2922 | 2670 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 2923 | 2671 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2924 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) | |
| 2672 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 2925 | 2673 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 2926 | 2674 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) |
| 2927 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 2675 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 2928 | 2676 | PORT_DIPSETTING( 0x80, "Game" ) |
| 2929 | 2677 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 2930 | 2678 | |
| r1293 | r1294 | |
| 3175 | 2923 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 3176 | 2924 | |
| 3177 | 2925 | PORT_START_TAG("DSWA") |
| 3178 | CPS1_COINAGE_2 | |
| 3179 | PORT_DIPNAME( 0x08, 0x08, "Coin Slots" ) | |
| 2926 | CPS1_COINAGE_2( "SW(A)" ) | |
| 2927 | PORT_DIPNAME( 0x08, 0x08, "Coin Slots" ) PORT_DIPLOCATION("SW(A):4") | |
| 3180 | 2928 | PORT_DIPSETTING( 0x08, "1" ) |
| 3181 | 2929 | PORT_DIPSETTING( 0x00, "2" ) |
| 3182 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 3183 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 3184 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3185 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 3186 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 3187 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3188 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 3189 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 3190 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3191 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 3192 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 3193 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2930 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(A):5" ) | |
| 2931 | PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW(A):6" ) | |
| 2932 | PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW(A):7" ) | |
| 2933 | PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 3194 | 2934 | |
| 3195 | 2935 | PORT_START_TAG("DSWB") |
| 3196 | CPS1_DIFFICULTY_1 | |
| 3197 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) | |
| 3198 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 3199 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3200 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 3201 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 3202 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3203 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 3204 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 3205 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3206 | PORT_DIPNAME( 0xc0, 0xc0, "Vs Play Mode" ) | |
| 2936 | CPS1_DIFFICULTY_1( "SW(B)" ) | |
| 2937 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(B):4" ) | |
| 2938 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(B):5" ) | |
| 2939 | PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW(B):6" ) | |
| 2940 | PORT_DIPNAME( 0xc0, 0xc0, "Vs Play Mode" ) PORT_DIPLOCATION("SW(B):7,8") | |
| 3207 | 2941 | PORT_DIPSETTING( 0xc0, "1 Game Match" ) |
| 3208 | 2942 | PORT_DIPSETTING( 0x80, "3 Games Match" ) |
| 3209 | 2943 | PORT_DIPSETTING( 0x40, "5 Games Match" ) |
| 3210 | 2944 | PORT_DIPSETTING( 0x00, "7 Games Match" ) |
| 3211 | 2945 | |
| 3212 | 2946 | PORT_START_TAG("DSWC") |
| 3213 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 3214 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 3215 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3216 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 3217 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 3218 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3219 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 3220 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 3221 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3222 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 2947 | PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW(C):1" ) | |
| 2948 | PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW(C):2" ) | |
| 2949 | PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW(C):3" ) | |
| 2950 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 3223 | 2951 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 3224 | 2952 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3225 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 2953 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 3226 | 2954 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 3227 | 2955 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3228 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 2956 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 3229 | 2957 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 3230 | 2958 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3231 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 3232 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 3233 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3234 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 2959 | PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW(C):7" ) | |
| 2960 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 3235 | 2961 | PORT_DIPSETTING( 0x80, "Game" ) |
| 3236 | 2962 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 3237 | 2963 | |
| r1293 | r1294 | |
| 3267 | 2993 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 3268 | 2994 | |
| 3269 | 2995 | PORT_START_TAG("DSWA") |
| 3270 | CPS1_COINAGE_2 | |
| 3271 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 3272 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 3273 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3274 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 3275 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 3276 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3277 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 3278 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 3279 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3280 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 2996 | CPS1_COINAGE_2( "SW(A)" ) | |
| 2997 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(A):4" ) // Manual says these are for coin 2, but they | |
| 2998 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(A):5" ) // coin to setting, but they clearly don't do | |
| 2999 | PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW(A):6" ) // that. | |
| 3000 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 3281 | 3001 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 3282 | 3002 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3283 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 3284 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 3285 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3003 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 3286 | 3004 | |
| 3287 | 3005 | PORT_START_TAG("DSWB") |
| 3288 | PORT_DIPNAME( 0x07, 0x04, DEF_STR( Difficulty ) ) | |
| 3289 | // PORT_DIPSETTING( 0x07, DEF_STR( Easiest ) ) | |
| 3290 | PORT_DIPSETTING( 0x06, DEF_STR( Easiest ) ) | |
| 3006 | PORT_DIPNAME( 0x07, 0x04, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW(B):1,2,3") | |
| 3007 | // PORT_DIPSETTING( 0x07, DEF_STR( Easiest ) ) // Controls overall difficulty | |
| 3008 | PORT_DIPSETTING( 0x06, DEF_STR( Easiest ) ) // Manual documents duplicate settings | |
| 3291 | 3009 | PORT_DIPSETTING( 0x05, DEF_STR( Easy ) ) |
| 3292 | 3010 | PORT_DIPSETTING( 0x04, DEF_STR( Normal ) ) |
| 3293 | 3011 | PORT_DIPSETTING( 0x03, DEF_STR( Hard ) ) |
| 3294 | 3012 | PORT_DIPSETTING( 0x02, DEF_STR( Hardest ) ) |
| 3295 | 3013 | // PORT_DIPSETTING( 0x01, DEF_STR( Hardest ) ) |
| 3296 | 3014 | // PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 3297 | PORT_DIPNAME( 0x18, 0x10, "Wisdom" ) | |
| 3298 | PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) | |
| 3015 | PORT_DIPNAME( 0x18, 0x10, "Wisdom (questions to win game)" ) PORT_DIPLOCATION("SW(B):4,5") | |
| 3016 | PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) // Controls number of needed questions to finish | |
| 3299 | 3017 | PORT_DIPSETTING( 0x10, DEF_STR( Normal ) ) |
| 3300 | 3018 | PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) |
| 3301 | 3019 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 3302 | PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Lives ) ) | |
| 3020 | PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(B):6,7,8") | |
| 3303 | 3021 | PORT_DIPSETTING( 0x60, "1" ) |
| 3304 | 3022 | PORT_DIPSETTING( 0x80, "2" ) |
| 3305 | 3023 | PORT_DIPSETTING( 0xa0, "3" ) |
| 3306 | 3024 | PORT_DIPSETTING( 0xc0, "4" ) |
| 3307 | 3025 | PORT_DIPSETTING( 0xe0, "5" ) |
| 3308 | // PORT_DIPSETTING( 0x40, "1" ) | |
| 3026 | // PORT_DIPSETTING( 0x40, "1" ) // These three settings are not documented | |
| 3309 | 3027 | // PORT_DIPSETTING( 0x20, "1" ) |
| 3310 | 3028 | // PORT_DIPSETTING( 0x00, "1" ) |
| 3311 | 3029 | |
| 3312 | 3030 | PORT_START_TAG("DSWC") |
| 3313 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) | |
| 3314 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 3315 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3316 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) | |
| 3317 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 3318 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3319 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 3031 | PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW(C):1" ) | |
| 3032 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" ) | |
| 3033 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 3320 | 3034 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 3321 | 3035 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3322 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 3036 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 3323 | 3037 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 3324 | 3038 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3325 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 3039 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 3326 | 3040 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 3327 | 3041 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3328 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) | |
| 3042 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 3329 | 3043 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 3330 | 3044 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 3331 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) | |
| 3045 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 3332 | 3046 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 3333 | 3047 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) |
| 3334 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 3048 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 3335 | 3049 | PORT_DIPSETTING( 0x80, "Game" ) |
| 3336 | 3050 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 3337 | 3051 | |
| r1293 | r1294 | |
| 3370 | 3084 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 3371 | 3085 | |
| 3372 | 3086 | PORT_START_TAG("DSWA") |
| 3373 | CPS1_COINAGE_2 | |
| 3374 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 3375 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 3376 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3377 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 3378 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 3379 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3380 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 3381 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 3382 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3383 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 3087 | CPS1_COINAGE_2( "SW(A)" ) | |
| 3088 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(A):4" ) // Manual says these are for coin 2, but they | |
| 3089 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(A):5" ) // coin to setting, but they clearly don't do | |
| 3090 | PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW(A):6" ) // that. | |
| 3091 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 3384 | 3092 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 3385 | 3093 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3386 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 3387 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 3388 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3094 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 3389 | 3095 | |
| 3390 | 3096 | PORT_START_TAG("DSWB") |
| 3391 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) | |
| 3097 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW(B):1,2,3") | |
| 3392 | 3098 | PORT_DIPSETTING( 0x07, "0" ) |
| 3393 | 3099 | PORT_DIPSETTING( 0x06, "1" ) |
| 3394 | 3100 | PORT_DIPSETTING( 0x05, "2" ) |
| r1293 | r1294 | |
| 3397 | 3103 | // PORT_DIPSETTING( 0x02, "4" ) |
| 3398 | 3104 | // PORT_DIPSETTING( 0x01, "4" ) |
| 3399 | 3105 | // PORT_DIPSETTING( 0x00, "4" ) |
| 3400 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 3401 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 3402 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3403 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 3404 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 3405 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3406 | PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Lives ) ) | |
| 3106 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(B):4" ) | |
| 3107 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(B):5" ) | |
| 3108 | PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(B):6,7,8") | |
| 3407 | 3109 | PORT_DIPSETTING( 0xa0, "1" ) |
| 3408 | 3110 | PORT_DIPSETTING( 0xc0, "2" ) |
| 3409 | 3111 | PORT_DIPSETTING( 0xe0, "3" ) |
| r1293 | r1294 | |
| 3414 | 3116 | // PORT_DIPSETTING( 0x60, "3" ) |
| 3415 | 3117 | |
| 3416 | 3118 | PORT_START_TAG("DSWC") |
| 3417 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 3418 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 3419 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3420 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 3421 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 3422 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3423 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 3119 | PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW(C):1" ) | |
| 3120 | PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW(C):2" ) | |
| 3121 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 3424 | 3122 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 3425 | 3123 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3426 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 3124 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 3427 | 3125 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 3428 | 3126 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3429 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 3127 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 3430 | 3128 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 3431 | 3129 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3432 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 3130 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 3433 | 3131 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 3434 | 3132 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3435 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) | |
| 3133 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 3436 | 3134 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 3437 | 3135 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) |
| 3438 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 3136 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 3439 | 3137 | PORT_DIPSETTING( 0x80, "Game" ) |
| 3440 | 3138 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 3441 | 3139 | |
| r1293 | r1294 | |
| 3477 | 3175 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 3478 | 3176 | |
| 3479 | 3177 | PORT_START_TAG("DSWA") |
| 3480 | CPS1_COINAGE_2 | |
| 3481 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 3482 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 3483 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3484 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 3485 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 3486 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3487 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 3488 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 3489 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3490 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) | |
| 3178 | CPS1_COINAGE_2( "SW(A)" ) | |
| 3179 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(A):4" ) | |
| 3180 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(A):5" ) | |
| 3181 | PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW(A):6" ) | |
| 3182 | PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7") | |
| 3491 | 3183 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 3492 | 3184 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3493 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 3494 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 3495 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3185 | PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 3496 | 3186 | |
| 3497 | 3187 | PORT_START_TAG("DSWB") |
| 3498 | CPS1_DIFFICULTY_1 | |
| 3499 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 3500 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 3501 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3502 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 3503 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 3504 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3505 | PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Lives ) ) | |
| 3188 | CPS1_DIFFICULTY_1( "SW(B)" ) | |
| 3189 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(B):4" ) | |
| 3190 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(B):5" ) | |
| 3191 | PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(B):6,7,8") | |
| 3506 | 3192 | PORT_DIPSETTING( 0x60, "1" ) |
| 3507 | 3193 | PORT_DIPSETTING( 0x80, "2" ) |
| 3508 | 3194 | PORT_DIPSETTING( 0xe0, "3" ) |
| r1293 | r1294 | |
| 3513 | 3199 | // PORT_DIPSETTING( 0x00, "?" ) |
| 3514 | 3200 | |
| 3515 | 3201 | PORT_START_TAG("DSWC") |
| 3516 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 3517 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 3518 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3519 | PORT_DIPNAME( 0x02, 0x02, "Infinite Lives (Cheat)") | |
| 3202 | PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW(C):1" ) | |
| 3203 | PORT_DIPNAME( 0x02, 0x02, "Infinite Lives (Cheat)") PORT_DIPLOCATION("SW(C):2") | |
| 3520 | 3204 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 3521 | 3205 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3522 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) | |
| 3206 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3") | |
| 3523 | 3207 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 3524 | 3208 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3525 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) | |
| 3209 | PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4") | |
| 3526 | 3210 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 3527 | 3211 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3528 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) | |
| 3212 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") | |
| 3529 | 3213 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 3530 | 3214 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3531 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 3215 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6") | |
| 3532 | 3216 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 3533 | 3217 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3534 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) | |
| 3218 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7") | |
| 3535 | 3219 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 3536 | 3220 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) |
| 3537 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 3221 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 3538 | 3222 | PORT_DIPSETTING( 0x80, "Game" ) |
| 3539 | 3223 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 3540 | 3224 | |
| r1293 | r1294 | |
| 3618 | 3302 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 3619 | 3303 | |
| 3620 | 3304 | PORT_START_TAG("DSWA") |
| 3621 | PORT_DIPNAME( 0x1f, 0x1f, DEF_STR( Coinage ) ) | |
| 3305 | PORT_DIPNAME( 0x1f, 0x1f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW(A):1,2,3,4,5") | |
| 3622 | 3306 | PORT_DIPSETTING( 0x0f, DEF_STR( 9C_1C ) ) |
| 3623 | 3307 | PORT_DIPSETTING( 0x10, DEF_STR( 8C_1C ) ) |
| 3624 | 3308 | PORT_DIPSETTING( 0x11, DEF_STR( 7C_1C ) ) |
| r1293 | r1294 | |
| 3639 | 3323 | PORT_DIPSETTING( 0x17, DEF_STR( 1C_9C ) ) |
| 3640 | 3324 | PORT_DIPSETTING( 0x0d, DEF_STR( Free_Play ) ) |
| 3641 | 3325 | /* 0x00 to 0x0c 1 Coin/1 Credit */ |
| 3642 | PORT_DIPNAME( 0x60, 0x60, "Coin slots" ) | |
| 3326 | PORT_DIPNAME( 0x60, 0x60, "Coin slots" ) PORT_DIPLOCATION("SW(A):6,7") | |
| 3643 | 3327 | // PORT_DIPSETTING( 0x00, "Invalid" ) |
| 3644 | PORT_DIPSETTING( 0x40, "1, Individual" ) | |
| 3645 | 3328 | PORT_DIPSETTING( 0x20, "1, Common" ) |
| 3646 | 3329 | PORT_DIPSETTING( 0x60, "2, Common" ) |
| 3647 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 3648 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 3649 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3330 | PORT_DIPSETTING( 0x40, "2, Individual" ) | |
| 3331 | PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW(A):8" ) | |
| 3650 | 3332 | |
| 3651 | 3333 | PORT_START_TAG("DSWB") |
| 3652 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) ) | |
| 3334 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW(B):1,2") | |
| 3653 | 3335 | PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) |
| 3654 | 3336 | PORT_DIPSETTING( 0x02, DEF_STR( Normal ) ) |
| 3655 | 3337 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 3656 | 3338 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 3657 | PORT_DIPNAME( 0x0c, 0x0c, "Time" ) | |
| 3339 | PORT_DIPNAME( 0x0c, 0x0c, "Time" ) PORT_DIPLOCATION("SW(B):3,4") | |
| 3658 | 3340 | PORT_DIPSETTING( 0x0c, "100" ) |
| 3659 | 3341 | PORT_DIPSETTING( 0x08, "90" ) |
| 3660 | 3342 | PORT_DIPSETTING( 0x04, "70" ) |
| 3661 | 3343 | PORT_DIPSETTING( 0x00, "60" ) |
| 3662 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 3663 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 3664 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3665 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 3666 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 3667 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3668 | PORT_DIPNAME( 0x40, 0x40, "Voice" ) | |
| 3344 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(B):5" ) | |
| 3345 | PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW(B):6" ) | |
| 3346 | PORT_DIPNAME( 0x40, 0x40, "Voice" ) PORT_DIPLOCATION("SW(B):7") | |
| 3669 | 3347 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 3670 | 3348 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 3671 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 3672 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 3673 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3349 | PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW(B):8" ) | |
| 3674 | 3350 | |
| 3675 | 3351 | PORT_START_TAG("DSWC") |
| 3676 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) | |
| 3352 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):1") | |
| 3677 | 3353 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 3678 | 3354 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3679 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) | |
| 3355 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):2") | |
| 3680 | 3356 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 3681 | 3357 | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) |
| 3682 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Allow_Continue ) ) | |
| 3358 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):3") | |
| 3683 | 3359 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 3684 | 3360 | PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) |
| 3685 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 3686 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 3687 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3688 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 3689 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 3690 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3691 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 3692 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 3693 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3694 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 3695 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 3696 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3697 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 3361 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(C):4" ) | |
| 3362 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(C):5" ) | |
| 3363 | PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW(C):6" ) | |
| 3364 | PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW(C):7" ) | |
| 3365 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8") | |
| 3698 | 3366 | PORT_DIPSETTING( 0x80, "Game" ) |
| 3699 | 3367 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) |
| 3700 | 3368 | |
| r1293 | r1294 | |
| 3720 | 3388 | /* Needs further checking */ |
| 3721 | 3389 | /* Same as 'megaman' but no "Voice" Dip Switch */ |
| 3722 | 3390 | static INPUT_PORTS_START( rockmanj ) |
| 3723 | PORT_START_TAG("IN0") | |
| 3724 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 3725 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 3726 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 3727 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 3728 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) | |
| 3729 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) | |
| 3730 | PORT_SERVICE_NO_TOGGLE( 0x40, IP_ACTIVE_LOW ) | |
| 3731 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 3391 | PORT_INCLUDE(megaman) | |
| 3732 | 3392 | |
| 3733 | PORT_START_TAG("DSWA") | |
| 3734 | PORT_DIPNAME( 0x1f, 0x1f, DEF_STR( Coinage ) ) | |
| 3735 | PORT_DIPSETTING( 0x0f, DEF_STR( 9C_1C ) ) | |
| 3736 | PORT_DIPSETTING( 0x10, DEF_STR( 8C_1C ) ) | |
| 3737 | PORT_DIPSETTING( 0x11, DEF_STR( 7C_1C ) ) | |
| 3738 | PORT_DIPSETTING( 0x12, DEF_STR( 6C_1C ) ) | |
| 3739 | PORT_DIPSETTING( 0x13, DEF_STR( 5C_1C ) ) | |
| 3740 | PORT_DIPSETTING( 0x14, DEF_STR( 4C_1C ) ) | |
| 3741 | PORT_DIPSETTING( 0x15, DEF_STR( 3C_1C ) ) | |
| 3742 | PORT_DIPSETTING( 0x16, DEF_STR( 2C_1C ) ) | |
| 3743 | PORT_DIPSETTING( 0x0e, "2 Coins to Start, 1 to Continue" ) | |
| 3744 | PORT_DIPSETTING( 0x1f, DEF_STR( 1C_1C ) ) | |
| 3745 | PORT_DIPSETTING( 0x1e, DEF_STR( 1C_2C ) ) | |
| 3746 | PORT_DIPSETTING( 0x1d, DEF_STR( 1C_3C ) ) | |
| 3747 | PORT_DIPSETTING( 0x1c, DEF_STR( 1C_4C ) ) | |
| 3748 | PORT_DIPSETTING( 0x1b, DEF_STR( 1C_5C ) ) | |
| 3749 | PORT_DIPSETTING( 0x1a, DEF_STR( 1C_6C ) ) | |
| 3750 | PORT_DIPSETTING( 0x19, DEF_STR( 1C_7C ) ) | |
| 3751 | PORT_DIPSETTING( 0x18, DEF_STR( 1C_8C ) ) | |
| 3752 | PORT_DIPSETTING( 0x17, DEF_STR( 1C_9C ) ) | |
| 3753 | PORT_DIPSETTING( 0x0d, DEF_STR( Free_Play ) ) | |
| 3754 | /* 0x00 to 0x0c 1 Coin/1 Credit */ | |
| 3755 | PORT_DIPNAME( 0x60, 0x60, "Coin slots" ) | |
| 3756 | // PORT_DIPSETTING( 0x00, "Invalid" ) | |
| 3757 | PORT_DIPSETTING( 0x40, "1, Individual" ) | |
| 3758 | PORT_DIPSETTING( 0x20, "1, Common" ) | |
| 3759 | PORT_DIPSETTING( 0x60, "2, Common" ) | |
| 3760 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 3761 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 3762 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3763 | ||
| 3764 | PORT_START_TAG("DSWB") | |
| 3765 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) ) | |
| 3766 | PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) | |
| 3767 | PORT_DIPSETTING( 0x02, DEF_STR( Normal ) ) | |
| 3768 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) | |
| 3769 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) | |
| 3770 | PORT_DIPNAME( 0x0c, 0x0c, "Time" ) | |
| 3771 | PORT_DIPSETTING( 0x0c, "100" ) | |
| 3772 | PORT_DIPSETTING( 0x08, "90" ) | |
| 3773 | PORT_DIPSETTING( 0x04, "70" ) | |
| 3774 | PORT_DIPSETTING( 0x00, "60" ) | |
| 3775 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 3776 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 3777 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3778 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 3779 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 3780 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3781 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 3782 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 3783 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3784 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 3785 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 3786 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3787 | ||
| 3788 | PORT_START_TAG("DSWC") | |
| 3789 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) | |
| 3790 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 3791 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3792 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) | |
| 3793 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 3794 | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) | |
| 3795 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Allow_Continue ) ) | |
| 3796 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 3797 | PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) | |
| 3798 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 3799 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 3800 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3801 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 3802 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 3803 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3804 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 3805 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 3806 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3807 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 3808 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 3809 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 3810 | PORT_DIPNAME( 0x80, 0x80, "Game Mode") | |
| 3811 | PORT_DIPSETTING( 0x80, "Game" ) | |
| 3812 | PORT_DIPSETTING( 0x00, DEF_STR( Test ) ) | |
| 3813 | ||
| 3814 | PORT_START_TAG("IN1") | |
| 3815 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 3816 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 3817 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 3818 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 3819 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 3820 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 3821 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 3822 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 3823 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 3824 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 3825 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 3826 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 3827 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 3828 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 3829 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 3830 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 3393 | PORT_MODIFY("DSWB") | |
| 3394 | PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW(B):7" ) | |
| 3831 | 3395 | INPUT_PORTS_END |
| 3832 | 3396 | |
| 3833 | 3397 | /* |
| r1293 | r1294 | |
| 7856 | 7420 | GAME( 1992, sf2ceua, sf2ce, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (US 920313)", 0 ) |
| 7857 | 7421 | GAME( 1992, sf2ceub, sf2ce, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (US 920513)", 0 ) |
| 7858 | 7422 | GAME( 1992, sf2ceuc, sf2ce, sf2, sf2, cps1, ROT0, "Capcom", "Street Fighter II' - Champion Edition (US 920803)", 0 ) |
| 7859 | GAME( 1992, sf2cej, sf2ce, sf2, sf2 | |
| 7423 | GAME( 1992, sf2cej, sf2ce, sf2, sf2 | |
| 7860 | 7424 | GAME( 1992, sf2rb, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Rainbow set 1)" , 0) // 920322 - based on World version |
| 7861 | 7425 | GAME( 1992, sf2rb2, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Rainbow set 2)" , 0) // 920322 - based on World version |
| 7862 | 7426 | GAME( 1992, sf2red, sf2ce, sf2, sf2, cps1, ROT0, "bootleg","Street Fighter II' - Champion Edition (Red Wave)" , 0) // 920313 - based on World version |
| r1293 | r1294 | |
| 7883 | 7447 | GAME( 1994, qadj, qad, cps1, qadj, cps1, ROT0, "Capcom", "Quiz & Dragons (Japan 940921)", 0 ) |
| 7884 | 7448 | GAME( 1995, qtono2, 0, cps1, qtono2, cps1, ROT0, "Capcom", "Quiz Tonosama no Yabou 2 Zenkoku-ban (Japan 950123)", 0 ) |
| 7885 | 7449 | GAME( 1995, megaman, 0, cps1, megaman, cps1, ROT0, "Capcom", "Mega Man - The Power Battle (CPS1 Asia 951006)", 0 ) |
| 7886 | GAME( 1995, rockmanj, megaman, cps1, m | |
| 7450 | GAME( 1995, rockmanj, megaman, cps1, rockm | |
| 7887 | 7451 | |
| 7888 | 7452 | GAME( 1992, wof, 0, qsound, wof, wof, ROT0, "Capcom", "Warriors of Fate (World 921002)" , 0) // "ETC" |
| 7889 | 7453 | GAME( 1992, wofa, wof, qsound, wof, wof, ROT0, "Capcom", "Sangokushi II (Asia 921005)" , 0) // World "warning" |
| r1293 | r1294 | |
|---|---|---|
| 650 | 650 | 16 /* Output bit is feedback bit */ |
| 651 | 651 | }; |
| 652 | 652 | |
| 653 | DISCRETE_SOUND_START(stinger) | |
| 653 | static DISCRETE_SOUND_START(stinger) | |
| 654 | 654 | |
| 655 | 655 | #define STINGER_SHOT_OUT NODE_90 |
| 656 | 656 | #define STINGER_BOOM_OUT NODE_91 |
| r1293 | r1294 | |
|---|---|---|
| 162 | 162 | static UINT8 analog_ports[4]; |
| 163 | 163 | static UINT8 framenum; |
| 164 | 164 | |
| 165 | static | |
| 165 | static | |
| 166 | 166 | static UINT16 *adsp_control_regs; |
| 167 | 167 | static UINT16 *adsp_fastram_base; |
| 168 | 168 | static UINT8 adsp_ireg; |
| r1293 | r1294 | |
| 197 | 197 | cpunum_set_info_fct(2, CPUINFO_PTR_ADSP2100_TX_HANDLER, (genf *)adsp_tx_callback); |
| 198 | 198 | |
| 199 | 199 | /* allocate a timer for feeding the autobuffer */ |
| 200 | adsp_autobuffer_timer = | |
| 200 | adsp_autobuffer_timer = | |
| 201 | 201 | |
| 202 | 202 | memory_configure_bank(1, 0, 256, memory_region(REGION_USER1), 0x4000); |
| 203 | 203 | memory_set_bank(1, 0); |
| r1293 | r1294 | |
| 527 | 527 | if ((data & 0x0800) == 0) |
| 528 | 528 | { |
| 529 | 529 | dmadac_enable(0, SOUND_CHANNELS, 0); |
| 530 | | |
| 530 | | |
| 531 | 531 | } |
| 532 | 532 | break; |
| 533 | 533 | |
| r1293 | r1294 | |
| 536 | 536 | if ((data & 0x0002) == 0) |
| 537 | 537 | { |
| 538 | 538 | dmadac_enable(0, SOUND_CHANNELS, 0); |
| 539 | | |
| 539 | | |
| 540 | 540 | } |
| 541 | 541 | break; |
| 542 | 542 | |
| r1293 | r1294 | |
| 607 | 607 | /* get the autobuffer registers */ |
| 608 | 608 | int mreg, lreg; |
| 609 | 609 | UINT16 source; |
| 610 | | |
| 610 | | |
| 611 | 611 | |
| 612 | 612 | adsp_ireg = (adsp_control_regs[S1_AUTOBUF_REG] >> 9) & 7; |
| 613 | 613 | mreg = (adsp_control_regs[S1_AUTOBUF_REG] >> 7) & 3; |
| r1293 | r1294 | |
| 632 | 632 | /* calculate how long until we generate an interrupt */ |
| 633 | 633 | |
| 634 | 634 | /* period per each bit sent */ |
| 635 | sample_period = | |
| 635 | sample_period = | |
| 636 | 636 | |
| 637 | 637 | /* now put it down to samples, so we know what the channel frequency has to be */ |
| 638 | sample_period = | |
| 638 | sample_period = | |
| 639 | 639 | |
| 640 | dmadac_set_frequency(0, SOUND_CHANNELS, S | |
| 640 | dmadac_set_frequency(0, SOUND_CHANNELS, ATTOS | |
| 641 | 641 | dmadac_enable(0, SOUND_CHANNELS, 1); |
| 642 | 642 | |
| 643 | 643 | /* fire off a timer wich will hit every half-buffer */ |
| 644 | sample_period = | |
| 644 | sample_period = | |
| 645 | 645 | |
| 646 | | |
| 646 | | |
| 647 | 647 | |
| 648 | 648 | return; |
| 649 | 649 | } |
| r1293 | r1294 | |
| 655 | 655 | dmadac_enable(0, SOUND_CHANNELS, 0); |
| 656 | 656 | |
| 657 | 657 | /* remove timer */ |
| 658 | | |
| 658 | | |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | |
| r1293 | r1294 | |
| 937 | 937 | }; |
| 938 | 938 | |
| 939 | 939 | |
| 940 | MACHINE_DRIVER_START( gaelco3d ) | |
| 940 | static MACHINE_DRIVER_START( gaelco3d ) | |
| 941 | 941 | |
| 942 | 942 | /* basic machine hardware */ |
| 943 | 943 | MDRV_CPU_ADD_TAG("main", M68000, 15000000) |
| r1293 | r1294 | |
| 987 | 987 | MACHINE_DRIVER_END |
| 988 | 988 | |
| 989 | 989 | |
| 990 | MACHINE_DRIVER_START( gaelco3d2 ) | |
| 990 | static MACHINE_DRIVER_START( gaelco3d2 ) | |
| 991 | 991 | MDRV_IMPORT_FROM(gaelco3d) |
| 992 | 992 | |
| 993 | 993 | /* basic machine hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 822 | 822 | static DRIVER_INIT( namcos11 ) |
| 823 | 823 | { |
| 824 | 824 | int n_game; |
| 825 | | |
| 825 | | |
| 826 | 826 | |
| 827 | timer = mame_timer_alloc( mcu_timer ); | |
| 828 | mame_timer_adjust( timer, MAME_TIME_IN_HZ( 600 ), 0, MAME_TIME_IN_HZ( 600 ) ); | |
| 827 | timer = timer_alloc( mcu_timer ); | |
| 828 | timer_adjust( timer, ATTOTIME_IN_HZ( 600 ), 0, ATTOTIME_IN_HZ( 600 ) ); | |
| 829 | 829 | |
| 830 | 830 | psx_driver_init(); |
| 831 | 831 | namcoc7x_on_driver_init(); |
| r1293 | r1294 | |
|---|---|---|
| 501 | 501 | * |
| 502 | 502 | *************************************/ |
| 503 | 503 | |
| 504 | MACHINE_DRIVER_START( gameroom ) | |
| 504 | static MACHINE_DRIVER_START( gameroom ) | |
| 505 | 505 | |
| 506 | 506 | /* basic machine hardware */ |
| 507 | 507 | MDRV_CPU_ADD_TAG("main", TMS34010, 40000000/TMS34010_CLOCK_DIVIDER) |
| r1293 | r1294 | |
| 536 | 536 | MACHINE_DRIVER_END |
| 537 | 537 | |
| 538 | 538 | |
| 539 | MACHINE_DRIVER_START( lethalj ) | |
| 539 | static MACHINE_DRIVER_START( lethalj ) | |
| 540 | 540 | MDRV_IMPORT_FROM( gameroom ) |
| 541 | 541 | |
| 542 | 542 | MDRV_CPU_MODIFY("main") |
| r1293 | r1294 | |
|---|---|---|
| 622 | 622 | machine_start_itech8(machine); |
| 623 | 623 | |
| 624 | 624 | /* we need to update behind the beam as well */ |
| 625 | | |
| 625 | | |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | static MACHINE_RESET( itech8 ) |
| r1293 | r1294 | |
| 674 | 674 | if (scanline >= 256) scanline = 0; |
| 675 | 675 | |
| 676 | 676 | /* set a new timer */ |
| 677 | | |
| 677 | | |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 |
| r1293 | r1294 | |
|---|---|---|
| 176 | 176 | ******************************************************************************/ |
| 177 | 177 | |
| 178 | 178 | |
| 179 | UINT16 *gs_videoram3; | |
| 180 | UINT16 *gs_mixer_regs; | |
| 179 | //UINT16 *gs_videoram3; | |
| 180 | static UINT16 *gs_mixer_regs; | |
| 181 | 181 | |
| 182 | 182 | /* in video */ |
| 183 | 183 | VIDEO_UPDATE( gstriker ); |
| r1293 | r1294 | |
| 446 | 446 | MDRV_CPU_IO_MAP(sound_readport,sound_writeport) |
| 447 | 447 | |
| 448 | 448 | MDRV_SCREEN_REFRESH_RATE(60) |
| 449 | MDRV_SCREEN_VBLANK_TIME( | |
| 449 | MDRV_SCREEN_VBLANK_TIME(A | |
| 450 | 450 | |
| 451 | 451 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_AFTER_VBLANK) |
| 452 | 452 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| r1293 | r1294 | |
|---|---|---|
| 236 | 236 | INTERRUPT_GEN( snk_irq_AB ) |
| 237 | 237 | { |
| 238 | 238 | cpunum_set_input_line(0, 0, HOLD_LINE); |
| 239 | | |
| 239 | | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | INTERRUPT_GEN( snk_irq_BA ) |
| 243 | 243 | { |
| 244 | 244 | cpunum_set_input_line(1, 0, HOLD_LINE); |
| 245 | | |
| 245 | | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | // NMI handshakes between CPUs are determined to be much simpler |
| r1293 | r1294 | |
| 356 | 356 | return snk_sound_register;// | 0x2; /* hack; lets chopper1 play music */ |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | void snk_sound_callback0_w( int state ){ /* ? */ | |
| 359 | static void snk_sound_callback0_w( int state ){ /* ? */ | |
| 360 | 360 | if( state ) snk_sound_register |= 0x01; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | void snk_sound_callback1_w( int state ){ /* ? */ | |
| 363 | static void snk_sound_callback1_w( int state ){ /* ? */ | |
| 364 | 364 | if( state ) snk_sound_register |= 0x02; |
| 365 | 365 | } |
| 366 | 366 | |
| r1293 | r1294 | |
| 1185 | 1185 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 1186 | 1186 | |
| 1187 | 1187 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1188 | MDRV_SCREEN_VBLANK_TIME( | |
| 1188 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1189 | 1189 | MDRV_INTERLEAVE(300) |
| 1190 | 1190 | |
| 1191 | 1191 | /* video hardware */ |
| r1293 | r1294 | |
| 1230 | 1230 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 1231 | 1231 | |
| 1232 | 1232 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1233 | MDRV_SCREEN_VBLANK_TIME( | |
| 1233 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1234 | 1234 | MDRV_INTERLEAVE(300) |
| 1235 | 1235 | |
| 1236 | 1236 | /* video hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 140 | 140 | cpunum_set_input_line(1, INPUT_LINE_RESET, CLEAR_LINE); |
| 141 | 141 | subcpu_resetline = 0; |
| 142 | 142 | if (pc == 0xbb0 || pc == 0x9d30 || pc == 0xb19c) |
| 143 | cpu_spinuntil_time( | |
| 143 | cpu_spinuntil_time( | |
| 144 | 144 | } |
| 145 | 145 | else if (subcpu_resetline == -1) |
| 146 | 146 | { |
| r1293 | r1294 | |
| 185 | 185 | cpunum_set_input_line(1, 2, HOLD_LINE); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | INTERRUPT_GEN( hyprduel_interrupt ) | |
| 188 | static INTERRUPT_GEN( hyprduel_interrupt ) | |
| 189 | 189 | { |
| 190 | 190 | int line = RASTER_LINES - cpu_getiloops(); |
| 191 | 191 | |
| r1293 | r1294 | |
| 196 | 196 | cpunum_set_input_line(0, 2, HOLD_LINE); |
| 197 | 197 | cpunum_set_input_line(1, 1, HOLD_LINE); |
| 198 | 198 | /* the duration is a guess */ |
| 199 | | |
| 199 | | |
| 200 | 200 | rastersplit = 0; |
| 201 | 201 | } else { |
| 202 | 202 | requested_int |= 0x12; /* hsync */ |
| r1293 | r1294 | |
| 285 | 285 | |
| 286 | 286 | ***************************************************************************/ |
| 287 | 287 | |
| 288 | UINT16 *hyprduel_blitter_regs; | |
| 288 | static UINT16 *hyprduel_blitter_regs; | |
| 289 | 289 | |
| 290 | 290 | static TIMER_CALLBACK( hyprduel_blit_done ) |
| 291 | 291 | { |
| r1293 | r1294 | |
| 367 | 367 | another blit. */ |
| 368 | 368 | if (b1 == 0) |
| 369 | 369 | { |
| 370 | | |
| 370 | | |
| 371 | 371 | return; |
| 372 | 372 | } |
| 373 | 373 |
| r1293 | r1294 | |
|---|---|---|
| 347 | 347 | } |
| 348 | 348 | if( scanline < NAMCONB1_VBSTART ) |
| 349 | 349 | { |
| 350 | | |
| 350 | | |
| 351 | 351 | } |
| 352 | 352 | } /* namconb2_interrupt */ |
| 353 | 353 | static INTERRUPT_GEN( namconb1_interrupt ) |
| r1293 | r1294 | |
| 395 | 395 | } |
| 396 | 396 | if( scanline < NAMCONB1_VBSTART ) |
| 397 | 397 | { |
| 398 | | |
| 398 | | |
| 399 | 399 | } |
| 400 | 400 | } /* namconb1_interrupt */ |
| 401 | 401 |
| r1293 | r1294 | |
|---|---|---|
| 40 | 40 | /* not verified */ |
| 41 | 41 | #define CPS1_ROWSCROLL_OFFS 0x20 /* base of row scroll offsets in other RAM */ |
| 42 | 42 | |
| 43 | void fcrash_update_transmasks(void) | |
| 43 | static void fcrash_update_transmasks(void) | |
| 44 | 44 | { |
| 45 | 45 | int i; |
| 46 | 46 | int priority[4]; |
| r1293 | r1294 | |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | void fcrash_render_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect) | |
| 68 | static void fcrash_render_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect) | |
| 69 | 69 | { |
| 70 | 70 | int pos; |
| 71 | 71 | int base=0x50c8/2; // and 10c8/2 for the buffer? |
| r1293 | r1294 | |
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | void fcrash_render_layer(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int layer,int primask) | |
| 95 | static void fcrash_render_layer(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int layer,int primask) | |
| 96 | 96 | { |
| 97 | 97 | switch (layer) |
| 98 | 98 | { |
| r1293 | r1294 | |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | void fcrash_render_high_layer(mame_bitmap *bitmap, const rectangle *cliprect, int layer) | |
| 110 | static void fcrash_render_high_layer(mame_bitmap *bitmap, const rectangle *cliprect, int layer) | |
| 111 | 111 | { |
| 112 | 112 | switch (layer) |
| 113 | 113 | { |
| r1293 | r1294 | |
|---|---|---|
| 336 | 336 | MDRV_CPU_IO_MAP(suprslam_sound_readport,suprslam_sound_writeport) |
| 337 | 337 | |
| 338 | 338 | MDRV_SCREEN_REFRESH_RATE(60) |
| 339 | MDRV_SCREEN_VBLANK_TIME( | |
| 339 | MDRV_SCREEN_VBLANK_TIME(A | |
| 340 | 340 | |
| 341 | 341 | MDRV_GFXDECODE(suprslam) |
| 342 | 342 |
| r1293 | r1294 | |
|---|---|---|
| 84 | 84 | scanline += 32; |
| 85 | 85 | if (scanline >= 256) |
| 86 | 86 | scanline -= 256; |
| 87 | | |
| 87 | | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
| r1293 | r1294 | |
| 109 | 109 | memcpy(slapstic_base, &slapstic_source[current_bank * 0x4000], 0x4000); |
| 110 | 110 | |
| 111 | 111 | /* start interrupts going (32V clocked by 16V) */ |
| 112 | | |
| 112 | | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 |
| r1293 | r1294 | |
|---|---|---|
| 205 | 205 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 206 | 206 | |
| 207 | 207 | MDRV_SCREEN_REFRESH_RATE(57) |
| 208 | MDRV_SCREEN_VBLANK_TIME( | |
| 208 | MDRV_SCREEN_VBLANK_TIME(A | |
| 209 | 209 | /* the Lode Runner manual (similar but different hardware) */ |
| 210 | 210 | /* talks about 55Hz and 1790ms vblank duration. */ |
| 211 | 211 |
| r1293 | r1294 | |
|---|---|---|
| 178 | 178 | INPUT_PORTS_END |
| 179 | 179 | |
| 180 | 180 | |
| 181 | void sangho_common_machine_reset(void) | |
| 181 | static void sangho_common_machine_reset(void) | |
| 182 | 182 | { |
| 183 | 183 | memory_set_bankptr(1,&sangho_ram[0]); |
| 184 | 184 | memory_set_bankptr(2,&sangho_ram[0x4000]); |
| r1293 | r1294 | |
| 211 | 211 | sangho_common_machine_reset(); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | void msx_vdp_interrupt(int i) | |
| 214 | static void msx_vdp_interrupt(int i) | |
| 215 | 215 | { |
| 216 | 216 | cpunum_set_input_line (0, 0, (i ? HOLD_LINE : CLEAR_LINE)); |
| 217 | 217 | } |
| r1293 | r1294 | |
|---|---|---|
| 23 | 23 | extern VIDEO_UPDATE( shaolins ); |
| 24 | 24 | |
| 25 | 25 | |
| 26 | INTERRUPT_GEN( shaolins_interrupt ) | |
| 26 | static INTERRUPT_GEN( shaolins_interrupt ) | |
| 27 | 27 | { |
| 28 | 28 | if (cpu_getiloops() == 0) cpunum_set_input_line(0, 0, HOLD_LINE); |
| 29 | 29 | else if (cpu_getiloops() % 2) |
| r1293 | r1294 | |
|---|---|---|
| 73 | 73 | |
| 74 | 74 | static UINT32 model2_timervals[4], model2_timerorig[4]; |
| 75 | 75 | static int model2_timerrun[4]; |
| 76 | static | |
| 76 | static | |
| 77 | 77 | static int model2_ctrlmode; |
| 78 | 78 | |
| 79 | 79 | static UINT32 *tgp_program; |
| r1293 | r1294 | |
| 176 | 176 | i960_stall(); |
| 177 | 177 | |
| 178 | 178 | /* spin the main cpu and let the TGP catch up */ |
| 179 | cpu_spinuntil_time( | |
| 179 | cpu_spinuntil_time( | |
| 180 | 180 | |
| 181 | 181 | return 0; |
| 182 | 182 | } |
| r1293 | r1294 | |
| 283 | 283 | if (model2_timerrun[offset]) |
| 284 | 284 | { |
| 285 | 285 | // get elapsed time, convert to units of 25 MHz |
| 286 | UINT32 cur = | |
| 286 | UINT32 cur = | |
| 287 | 287 | |
| 288 | 288 | // subtract units from starting value |
| 289 | 289 | model2_timervals[offset] = model2_timerorig[offset] - cur; |
| r1293 | r1294 | |
| 294 | 294 | |
| 295 | 295 | static WRITE32_HANDLER( timers_w ) |
| 296 | 296 | { |
| 297 | | |
| 297 | | |
| 298 | 298 | |
| 299 | 299 | i960_noburst(); |
| 300 | 300 | COMBINE_DATA(&model2_timervals[offset]); |
| 301 | 301 | |
| 302 | 302 | model2_timerorig[offset] = model2_timervals[offset]; |
| 303 | period = scale_up_mame_time(MAME_TIME_IN_HZ(25000000), model2_timerorig[offset]); | |
| 304 | mame_timer_adjust(model2_timers[offset], period, 0, time_zero); | |
| 303 | period = attotime_mul(ATTOTIME_IN_HZ(25000000), model2_timerorig[offset]); | |
| 304 | timer_adjust(model2_timers[offset], period, 0, attotime_zero); | |
| 305 | 305 | model2_timerrun[offset] = 1; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | static void model2_timer_exp(int tnum, int bit) |
| 309 | 309 | { |
| 310 | | |
| 310 | | |
| 311 | 311 | |
| 312 | 312 | model2_intreq |= (1<<bit); |
| 313 | 313 | if (model2_intena & (1<<bit)) |
| r1293 | r1294 | |
| 341 | 341 | |
| 342 | 342 | model2_timerrun[0] = model2_timerrun[1] = model2_timerrun[2] = model2_timerrun[3] = 0; |
| 343 | 343 | |
| 344 | model2_timers[0] = mame_timer_alloc(model2_timer_0_cb); | |
| 345 | model2_timers[1] = mame_timer_alloc(model2_timer_1_cb); | |
| 346 | model2_timers[2] = mame_timer_alloc(model2_timer_2_cb); | |
| 347 | model2_timers[3] = mame_timer_alloc(model2_timer_3_cb); | |
| 344 | model2_timers[0] = timer_alloc(model2_timer_0_cb); | |
| 345 | model2_timers[1] = timer_alloc(model2_timer_1_cb); | |
| 346 | model2_timers[2] = timer_alloc(model2_timer_2_cb); | |
| 347 | model2_timers[3] = timer_alloc(model2_timer_3_cb); | |
| 348 | 348 | |
| 349 | mame_timer_adjust(model2_timers[0], time_never, 0, time_never); | |
| 350 | mame_timer_adjust(model2_timers[1], time_never, 0, time_never); | |
| 351 | mame_timer_adjust(model2_timers[2], time_never, 0, time_never); | |
| 352 | mame_timer_adjust(model2_timers[3], time_never, 0, time_never); | |
| 349 | timer_adjust(model2_timers[0], attotime_never, 0, attotime_never); | |
| 350 | timer_adjust(model2_timers[1], attotime_never, 0, attotime_never); | |
| 351 | timer_adjust(model2_timers[2], attotime_never, 0, attotime_never); | |
| 352 | timer_adjust(model2_timers[3], attotime_never, 0, attotime_never); | |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | static MACHINE_RESET(model2o) |
| r1293 | r1294 | |
| 658 | 658 | { |
| 659 | 659 | logerror("Boot geo, %d dwords\n", model2_geocnt); |
| 660 | 660 | cpunum_set_input_line(3, INPUT_LINE_HALT, CLEAR_LINE); |
| 661 | //cpu_spinuntil_time( | |
| 661 | //cpu_spinuntil_time( | |
| 662 | 662 | } |
| 663 | 663 | } |
| 664 | 664 | |
| r1293 | r1294 | |
| 898 | 898 | |
| 899 | 899 | if ((sr & 0x0700) > 0x0100) |
| 900 | 900 | { |
| 901 | cpu_spinuntil_time( | |
| 901 | cpu_spinuntil_time( | |
| 902 | 902 | return 0; // not ready yet, interrupts disabled |
| 903 | 903 | } |
| 904 | 904 | |
| r1293 | r1294 | |
| 909 | 909 | { |
| 910 | 910 | while (!snd_68k_ready_r()) |
| 911 | 911 | { |
| 912 | cpu_spinuntil_time( | |
| 912 | cpu_spinuntil_time( | |
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | to_68k = data; |
| r1293 | r1294 | |
| 917 | 917 | cpunum_set_input_line(1, 2, HOLD_LINE); |
| 918 | 918 | |
| 919 | 919 | // give the 68k time to notice |
| 920 | cpu_spinuntil_time( | |
| 920 | cpu_spinuntil_time( | |
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | static READ32_HANDLER( model2_serial_r ) |
| r1293 | r1294 | |
| 945 | 945 | SCSP_MidiIn(0, data&0xff, 0); |
| 946 | 946 | |
| 947 | 947 | // give the 68k time to notice |
| 948 | cpu_spinuntil_time( | |
| 948 | cpu_spinuntil_time( | |
| 949 | 949 | } |
| 950 | 950 | } |
| 951 | 951 |
| r1293 | r1294 | |
|---|---|---|
| 348 | 348 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 349 | 349 | |
| 350 | 350 | MDRV_SCREEN_REFRESH_RATE(60) |
| 351 | MDRV_SCREEN_VBLANK_TIME( | |
| 351 | MDRV_SCREEN_VBLANK_TIME(A | |
| 352 | 352 | MDRV_MACHINE_RESET(sshangha) /* init machine */ |
| 353 | 353 | |
| 354 | 354 | /* video hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 63 | 63 | /* Need to check for a coin on the interrupt, */ |
| 64 | 64 | /* This will reset the cpu */ |
| 65 | 65 | |
| 66 | INTERRUPT_GEN( blockade_interrupt ) | |
| 66 | static INTERRUPT_GEN( blockade_interrupt ) | |
| 67 | 67 | { |
| 68 | 68 | cpunum_resume(0, SUSPEND_ANY_REASON); |
| 69 | 69 |
| r1293 | r1294 | |
|---|---|---|
| 573 | 573 | |
| 574 | 574 | |
| 575 | 575 | static int readpaddle; |
| 576 | int cps2networkpresent; | |
| 576 | static int cps2networkpresent; | |
| 577 | 577 | |
| 578 | 578 | static INTERRUPT_GEN( cps2_interrupt ) |
| 579 | 579 | { |
| r1293 | r1294 | |
| 1361 | 1361 | MDRV_CPU_PERIODIC_INT(irq0_line_hold, 251) /* 251 is good (see 'mercy mercy mercy'section of sgemf attract mode for accurate sound sync */ |
| 1362 | 1362 | |
| 1363 | 1363 | MDRV_SCREEN_REFRESH_RATE(59.633333) |
| 1364 | MDRV_SCREEN_VBLANK_TIME( | |
| 1364 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1365 | 1365 | // MDRV_INTERLEAVE(262) /* 262 scanlines, for raster effects */ |
| 1366 | 1366 | |
| 1367 | 1367 | MDRV_NVRAM_HANDLER(cps2) |
| r1293 | r1294 | |
|---|---|---|
| 281 | 281 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 282 | 282 | |
| 283 | 283 | MDRV_SCREEN_REFRESH_RATE(60) |
| 284 | MDRV_SCREEN_VBLANK_TIME( | |
| 284 | MDRV_SCREEN_VBLANK_TIME(A | |
| 285 | 285 | |
| 286 | 286 | /* video hardware */ |
| 287 | 287 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
|---|---|---|
| 280 | 280 | MDRV_CPU_IO_MAP(tiamc1_readport,tiamc1_writeport) |
| 281 | 281 | |
| 282 | 282 | MDRV_SCREEN_REFRESH_RATE(50) |
| 283 | MDRV_SCREEN_VBLANK_TIME( | |
| 283 | MDRV_SCREEN_VBLANK_TIME(A | |
| 284 | 284 | MDRV_CPU_VBLANK_INT(irq1_line_hold,1) |
| 285 | 285 | |
| 286 | 286 | MDRV_MACHINE_RESET(tiamc1) |
| r1293 | r1294 | |
|---|---|---|
| 306 | 306 | { |
| 307 | 307 | soundlatch_w(0,data); |
| 308 | 308 | cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE); |
| 309 | cpu_boost_interleave(time_zero, | |
| 309 | cpu_boost_interleave(attotime_zero, | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | |
| r1293 | r1294 | |
| 527 | 527 | PORT_INCLUDE(astrob) |
| 528 | 528 | |
| 529 | 529 | PORT_MODIFY("D3D2") |
| 530 | PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives )) | |
| 530 | PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives )) PORT_DIPLOCATION("SW1:8,7") | |
| 531 | 531 | PORT_DIPSETTING( 0x00, "2" ) |
| 532 | 532 | PORT_DIPSETTING( 0x01, "3" ) |
| 533 | 533 | //PORT_DIPSETTING( 0x02, "3" ) |
| r1293 | r1294 | |
| 539 | 539 | PORT_INCLUDE(astrob) |
| 540 | 540 | |
| 541 | 541 | PORT_MODIFY("D3D2") |
| 542 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown )) | |
| 542 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown )) PORT_DIPLOCATION("SW1:5") | |
| 543 | 543 | PORT_DIPSETTING( 0x08, DEF_STR( Off )) |
| 544 | 544 | PORT_DIPSETTING( 0x00, DEF_STR( On )) |
| 545 | 545 | INPUT_PORTS_END |
| r1293 | r1294 | |
| 599 | 599 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| 600 | 600 | */ |
| 601 | 601 | PORT_MODIFY("D3D2") |
| 602 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives )) | |
| 602 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives )) PORT_DIPLOCATION("SW1:8,7") | |
| 603 | 603 | PORT_DIPSETTING( 0x00, "3" ) |
| 604 | 604 | PORT_DIPSETTING( 0x02, "4" ) |
| 605 | 605 | PORT_DIPSETTING( 0x01, "5" ) |
| 606 | 606 | PORT_DIPSETTING( 0x03, "6" ) |
| 607 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet )) | |
| 607 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:6") | |
| 608 | 608 | PORT_DIPSETTING( 0x04, DEF_STR( Upright )) |
| 609 | 609 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail )) |
| 610 | PORT_DIPNAME( 0x18, 0x00, DEF_STR( Bonus_Life )) | |
| 610 | PORT_DIPNAME( 0x18, 0x00, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW1:5,4") | |
| 611 | 611 | PORT_DIPSETTING( 0x00, "20000" ) |
| 612 | 612 | PORT_DIPSETTING( 0x10, "40000" ) |
| 613 | 613 | PORT_DIPSETTING( 0x08, "60000" ) |
| 614 | 614 | PORT_DIPSETTING( 0x18, "80000" ) |
| 615 | PORT_DIPNAME( 0x80, 0x80, "Infinite Lives (Cheat)") | |
| 615 | PORT_DIPNAME( 0x80, 0x80, "Infinite Lives (Cheat)") PORT_DIPLOCATION("SW1:1") | |
| 616 | 616 | PORT_DIPSETTING( 0x80, DEF_STR( Off )) |
| 617 | 617 | PORT_DIPSETTING( 0x00, DEF_STR( On )) |
| 618 | 618 | |
| r1293 | r1294 | |
| 688 | 688 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY |
| 689 | 689 | |
| 690 | 690 | PORT_MODIFY("D3D2") |
| 691 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet )) | |
| 691 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:8") | |
| 692 | 692 | PORT_DIPSETTING( 0x00, DEF_STR( Upright )) |
| 693 | 693 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail )) |
| 694 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds )) | |
| 694 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds )) PORT_DIPLOCATION("SW1:7") | |
| 695 | 695 | PORT_DIPSETTING( 0x00, DEF_STR( Off )) |
| 696 | 696 | PORT_DIPSETTING( 0x02, DEF_STR( On )) |
| 697 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives )) | |
| 697 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives )) PORT_DIPLOCATION("SW1:6,5") | |
| 698 | 698 | PORT_DIPSETTING( 0x00, "3" ) |
| 699 | 699 | PORT_DIPSETTING( 0x08, "4" ) |
| 700 | 700 | PORT_DIPSETTING( 0x04, "5" ) |
| r1293 | r1294 | |
|---|---|---|
| 293 | 293 | |
| 294 | 294 | |
| 295 | 295 | |
| 296 | void HD63484_command_w(UINT16 cmd) | |
| 296 | static void HD63484_command_w(UINT16 cmd) | |
| 297 | 297 | { |
| 298 | 298 | int len; |
| 299 | 299 |
| r1293 | r1294 | |
|---|---|---|
| 359 | 359 | { |
| 360 | 360 | // sound_nmi_enabled = 1; |
| 361 | 361 | cpunum_set_input_line(1, INPUT_LINE_NMI, CLEAR_LINE); |
| 362 | | |
| 362 | | |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 |
| r1293 | r1294 | |
|---|---|---|
| 5 | 5 | driver by Phil Bennett |
| 6 | 6 | |
| 7 | 7 | Games supported: |
| 8 | * Cluedo ( | |
| 8 | * Cluedo (3 sets) | |
| 9 | 9 | * Hangman |
| 10 | 10 | * Scrabble |
| 11 | 11 | * Trivial Pursuit |
| r1293 | r1294 | |
| 15 | 15 | * Snakes and Ladders |
| 16 | 16 | |
| 17 | 17 | Known issues: |
| 18 | * I/O documentation for lamps, reels, meters etc is incomplete. | |
| 19 | * DUART emulation is very simplistic. | |
| 18 | * I/O documentation for lamps, reels, meters etc is possibly incorrect. | |
| 19 | * DUART emulation is very simplistic, in progress. | |
| 20 | 20 | * Digital volume control is not emulated. |
| 21 | 21 | |
| 22 | 22 | **************************************************************************** |
| r1293 | r1294 | |
| 33 | 33 | 400000-403FFF R/W xxxxxxxx xxxxxxxx Program RAM (battery-backed) |
| 34 | 34 | 480000-48001F R/W -------- xxxxxxxx MC68681 DUART 1 |
| 35 | 35 | 480020-480033 R -------- xxxxxxxx Inputs |
| 36 | 480060-480067 R/W -------- xxxxxxxx D71055C? | |
| 36 | 480041 R -xxxxxxx xxxxxxxx Reel optos | |
| 37 | 480060-480067 R/W -------- xxxxxxxx D71055C? PPI? | |
| 37 | 38 | 480080-480081 W -------- xxxxxxxx uPD7559 communications |
| 38 | 39 | 480082-480083 W -------- xxxxxxxx Sound control |
| 39 | 40 | -------- -------x (uPD7759 reset) |
| r1293 | r1294 | |
| 76 | 77 | #include "cpu/tms34010/34010ops.h" |
| 77 | 78 | #include "sound/upd7759.h" |
| 78 | 79 | #include "jpmimpct.h" |
| 80 | #include "machine/meters.h" | |
| 79 | 81 | |
| 80 | ||
| 81 | 82 | /************************************* |
| 82 | 83 | * |
| 83 | 84 | * Statics |
| r1293 | r1294 | |
| 88 | 89 | static UINT8 duart_1_irq; |
| 89 | 90 | static UINT8 touch_cnt; |
| 90 | 91 | static UINT8 touch_data[3]; |
| 91 | static | |
| 92 | static | |
| 92 | 93 | |
| 94 | static int lamp_strobe; | |
| 95 | static UINT8 Lamps[256]; | |
| 93 | 96 | static TIMER_CALLBACK( duart_1_timer_event ); |
| 94 | 97 | |
| 95 | 98 | |
| r1293 | r1294 | |
| 133 | 136 | |
| 134 | 137 | UINT8 IVR; |
| 135 | 138 | UINT8 IP; |
| 139 | UINT8 OP; | |
| 140 | UINT8 OPR; | |
| 136 | 141 | UINT8 OPCR; |
| 137 | 142 | } duart_1;//, duart_2; |
| 138 | 143 | |
| r1293 | r1294 | |
| 169 | 174 | { |
| 170 | 175 | memset(&duart_1, 0, sizeof(duart_1)); |
| 171 | 176 | |
| 172 | duart_1_timer = | |
| 177 | duart_1_timer = | |
| 173 | 178 | |
| 174 | 179 | /* Reset states */ |
| 175 | 180 | duart_1_irq = tms_irq = 0; |
| 176 | 181 | touch_cnt = 0; |
| 177 | 182 | |
| 183 | // duart_1.IVR=0x0f; | |
| 178 | 184 | state_save_register_global(tms_irq); |
| 179 | 185 | state_save_register_global(duart_1_irq); |
| 180 | 186 | state_save_register_global(touch_cnt); |
| r1293 | r1294 | |
| 236 | 242 | { |
| 237 | 243 | duart_1.tc = 0; |
| 238 | 244 | duart_1.ISR |= 0x08; |
| 245 | ||
| 239 | 246 | duart_1_irq = 1; |
| 240 | 247 | update_irqs(); |
| 241 | 248 | } |
| r1293 | r1294 | |
| 243 | 250 | static READ16_HANDLER( duart_1_r ) |
| 244 | 251 | { |
| 245 | 252 | UINT16 val = 0xffff; |
| 246 | ||
| 247 | 253 | switch (offset) |
| 248 | 254 | { |
| 249 | 255 | case 0x1: |
| r1293 | r1294 | |
| 252 | 258 | val = 0x04; |
| 253 | 259 | break; |
| 254 | 260 | } |
| 261 | case 0x2: | |
| 262 | { | |
| 263 | val = 0x00; | |
| 264 | break; | |
| 265 | } | |
| 266 | case 0x3: | |
| 267 | { | |
| 268 | val = duart_1.RBA; | |
| 269 | duart_1.ISR &= ~0x02; | |
| 270 | duart_1.SRA &= ~0x03; | |
| 271 | break; | |
| 272 | } | |
| 273 | case 0x4: | |
| 274 | { | |
| 275 | val = duart_1.IPCR; | |
| 276 | duart_1.ISR &= ~0x80; | |
| 277 | break; | |
| 278 | } | |
| 255 | 279 | case 0x5: |
| 256 | 280 | { |
| 257 | 281 | val = duart_1.ISR; |
| r1293 | r1294 | |
| 270 | 294 | } |
| 271 | 295 | case 0xe: |
| 272 | 296 | { |
| 273 | mame_time rate = scale_up_mame_time(MAME_TIME_IN_HZ(MC68681_1_CLOCK), 16 * duart_1.CT); | |
| 274 | mame_timer_adjust(duart_1_timer, rate, 0, rate); | |
| 297 | attotime rate = attotime_mul(ATTOTIME_IN_HZ(MC68681_1_CLOCK), 16 * duart_1.CT); | |
| 298 | timer_adjust(duart_1_timer, rate, 0, rate); | |
| 275 | 299 | break; |
| 276 | 300 | } |
| 277 | 301 | case 0xf: |
| r1293 | r1294 | |
| 288 | 312 | |
| 289 | 313 | static WRITE16_HANDLER( duart_1_w ) |
| 290 | 314 | { |
| 315 | int old_val; | |
| 291 | 316 | switch (offset) |
| 292 | 317 | { |
| 318 | case 0x1: | |
| 319 | { | |
| 320 | duart_1.CSRA = data; | |
| 321 | break; | |
| 322 | } | |
| 293 | 323 | case 0x3: |
| 294 | 324 | { |
| 295 | 325 | //mame_printf_debug("%c", data); |
| r1293 | r1294 | |
| 326 | 356 | //mame_printf_debug("%c",data); |
| 327 | 357 | break; |
| 328 | 358 | } |
| 359 | case 0xc: | |
| 360 | { | |
| 361 | duart_1.IVR = data; | |
| 362 | break; | |
| 363 | } | |
| 364 | case 0xd: | |
| 365 | { | |
| 366 | duart_1.OPCR = data; | |
| 367 | break; | |
| 368 | } | |
| 329 | 369 | case 0xe: |
| 330 | 370 | { |
| 371 | old_val = duart_1.OPR; | |
| 372 | duart_1.OPR = duart_1.OPR | data; | |
| 373 | duart_1.OP = ~duart_1.OPR; | |
| 331 | 374 | /* Output port bit set */ |
| 332 | 375 | break; |
| 333 | 376 | } |
| 334 | 377 | case 0xf: |
| 335 | 378 | { |
| 379 | old_val = duart_1.OPR; | |
| 380 | duart_1.OPR = duart_1.OPR &~data; | |
| 381 | duart_1.OP = ~duart_1.OPR; | |
| 336 | 382 | /* Output port bit reset */ |
| 337 | 383 | break; |
| 338 | 384 | } |
| r1293 | r1294 | |
| 483 | 529 | return 0xffff; |
| 484 | 530 | } |
| 485 | 531 | |
| 486 | ||
| 487 | 532 | /************************************* |
| 488 | 533 | * |
| 489 | 534 | * Mysterious stuff |
| r1293 | r1294 | |
| 499 | 544 | { |
| 500 | 545 | } |
| 501 | 546 | |
| 547 | static void jpm_draw_lamps(int data, int lamp_strobe) | |
| 548 | { | |
| 549 | int i; | |
| 550 | for (i=0; i<16; i++) | |
| 551 | { | |
| 552 | Lamps[16*(lamp_strobe+i)] = data & 1; | |
| 553 | output_set_lamp_value((16*lamp_strobe)+i, (Lamps[(16*lamp_strobe)+i])); | |
| 554 | data = data >> 1; | |
| 555 | } | |
| 556 | } | |
| 502 | 557 | |
| 558 | static READ16_HANDLER( jpmio_r ) | |
| 559 | { | |
| 560 | return 0xffff; | |
| 561 | } | |
| 562 | ||
| 563 | static WRITE16_HANDLER( jpmio_w ) | |
| 564 | { | |
| 565 | long cycles = ATTOTIME_TO_CYCLES(0, timer_get_time() ); | |
| 566 | switch (offset) | |
| 567 | { | |
| 568 | case 0x02: | |
| 569 | { | |
| 570 | //reel 1 | |
| 571 | break; | |
| 572 | } | |
| 573 | case 0x04: | |
| 574 | { | |
| 575 | //reel 2 | |
| 576 | break; | |
| 577 | } | |
| 578 | case 0x06: | |
| 579 | { | |
| 580 | if ( data & 0x10 ) | |
| 581 | { // PAYEN ? | |
| 582 | if ( data & 0xf ) | |
| 583 | { | |
| 584 | // slide = 1; | |
| 585 | } | |
| 586 | else | |
| 587 | { | |
| 588 | // slide = 0; | |
| 589 | } | |
| 590 | } | |
| 591 | else | |
| 592 | // slide = 0; | |
| 593 | Mechmtr_update(0, cycles, data >> 10); | |
| 594 | duart_1.IP &= ~0x10; | |
| 595 | break; | |
| 596 | } | |
| 597 | ||
| 598 | case 0x08: | |
| 599 | { | |
| 600 | jpm_draw_lamps(data, lamp_strobe); | |
| 601 | break; | |
| 602 | } | |
| 603 | ||
| 604 | case 0x0b: | |
| 605 | { | |
| 606 | output_set_digit_value(lamp_strobe,data); | |
| 607 | break; | |
| 608 | } | |
| 609 | case 0x0f: | |
| 610 | { | |
| 611 | if (data & 0x10) | |
| 612 | { | |
| 613 | lamp_strobe = (data +1) & 0x0f; | |
| 614 | } | |
| 615 | break; | |
| 616 | } | |
| 617 | } | |
| 618 | } | |
| 619 | ||
| 503 | 620 | /************************************* |
| 504 | 621 | * |
| 505 | 622 | * Main CPU memory handlers |
| r1293 | r1294 | |
| 512 | 629 | AM_RANGE(0x00480000, 0x0048001f) AM_READWRITE(duart_1_r, duart_1_w) |
| 513 | 630 | AM_RANGE(0x00480020, 0x00480033) AM_READ(inputs1_r) |
| 514 | 631 | AM_RANGE(0x00480034, 0x00480035) AM_READ(unk_r) |
| 515 | AM_RANGE(0x00480060, 0x00480067) AM_READWRITE(unk_r, unk_w) | |
| 516 | AM_RANGE(0x004800a0, 0x004800af) AM_READWRITE(unk_r, unk_w) | |
| 632 | AM_RANGE(0x00480060, 0x00480067) AM_READWRITE(unk_r, unk_w)//PPI | |
| 633 | AM_RANGE(0x004800a0, 0x004800af) AM_READWRITE(jpmio_r, jpmio_w) | |
| 517 | 634 | AM_RANGE(0x004800e0, 0x004800e1) AM_WRITE(unk_w) |
| 518 | 635 | AM_RANGE(0x004801dc, 0x004801dd) AM_READ(unk_r) |
| 519 | 636 | AM_RANGE(0x004801de, 0x004801df) AM_READ(unk_r) |
| r1293 | r1294 | |
| 689 | 806 | * |
| 690 | 807 | *************************************/ |
| 691 | 808 | |
| 692 | void jpmimpct_tms_irq(int state) | |
| 809 | static void jpmimpct_tms_irq(int state) | |
| 693 | 810 | { |
| 694 | 811 | tms_irq = state; |
| 695 | 812 | update_irqs(); |
| r1293 | r1294 | |
| 795 | 912 | ROM_LOAD( "1214.bin", 0x000000, 0x80000, CRC(fe43aeae) SHA1(017a471af5766ef41fa46982c02941fb4fc35174) ) |
| 796 | 913 | ROM_END |
| 797 | 914 | |
| 915 | ROM_START( cluedo2 ) | |
| 916 | ROM_REGION( 0x1000000, REGION_CPU1, 0 ) | |
| 917 | ROM_LOAD16_BYTE( "clu21.bin", 0x000000, 0x080000, CRC(b1aa0103)SHA1(52d10a428710cd04313a2638fc3c23fb9d0ab6db)) | |
| 918 | ROM_LOAD16_BYTE( "clu22.bin", 0x000001, 0x080000, CRC(90d8dd28)SHA1(3124a8313c6b362176283e145c4af27f5deac683)) | |
| 919 | ROM_LOAD16_BYTE( "clu23.bin", 0x100000, 0x080000, CRC(196bd993)SHA1(50920441707fc6cae9d36961d92ce213e53c4238)) | |
| 920 | ROM_LOAD16_BYTE( "clu24.bin", 0x100001, 0x080000, CRC(3f5c1259)SHA1(dfdbb66a81716a0ced7510e277f6f321516f57af)) | |
| 921 | ||
| 922 | ROM_LOAD16_BYTE( "6977.bin", 0xc00000, 0x080000, CRC(6030dfc1) SHA1(8746909b0b7f7eb99cf5388ac85db6addb6deee3) ) | |
| 923 | ROM_LOAD16_BYTE( "6978.bin", 0xc00001, 0x080000, CRC(21e30e06) SHA1(4e97baa9e39663b662dd202bbaf34be0e29930de) ) | |
| 924 | ROM_LOAD16_BYTE( "6979.bin", 0xd00000, 0x080000, CRC(5575162a) SHA1(27f7b5f4ee7d95319b03e2414a25d5b1a6c54fc7) ) | |
| 925 | ROM_LOAD16_BYTE( "6980.bin", 0xd00001, 0x080000, CRC(968224df) SHA1(726c278622681206a7f34bafe1b5bb4421232cc4) ) | |
| 926 | ROM_LOAD16_BYTE( "6981.bin", 0xe00000, 0x080000, CRC(2ad3ee20) SHA1(9370dab84a255864f40254772199211884d8557b) ) | |
| 927 | ROM_LOAD16_BYTE( "6982.bin", 0xe00001, 0x080000, CRC(7478e91b) SHA1(158b473b46aeccf011669cb58dc3a1596370d8f1) ) | |
| 928 | ROM_FILL( 0xf00000, 0x100000, 0xff ) | |
| 929 | ||
| 930 | ROM_REGION16_LE( 0x200000, REGION_USER1, 0 ) | |
| 931 | ROM_LOAD16_BYTE( "clugrb1", 0x000000, 0x80000, CRC(176ae2df) SHA1(135fd2640c255e5321b1a6ba35f72fa2ba8f04b8) ) | |
| 932 | ROM_LOAD16_BYTE( "clugrb2", 0x000001, 0x80000, CRC(06ab2f78) SHA1(4325fd9096e73956310e97e244c7fe1ee8d27f5c) ) | |
| 933 | ROM_COPY( REGION_USER1, 0x000000, 0x100000, 0x100000 ) | |
| 934 | ||
| 935 | ROM_REGION( 0x80000, REGION_SOUND1, 0 ) | |
| 936 | ROM_LOAD( "clue2as1.bin", 0x000000, 0x80000, CRC(16b2bc45) SHA1(56963f5d63b5a091b89b96f4ca9327010006c024) ) | |
| 937 | ROM_END | |
| 938 | ||
| 798 | 939 | ROM_START( trivialp ) |
| 799 | 940 | ROM_REGION( 0x1000000, REGION_CPU1, 0 ) |
| 800 | 941 | ROM_LOAD16_BYTE( "1422.bin", 0x000000, 0x080000, CRC(5e39c946) SHA1(bae7f572a32e90d716813271f03e7868be603086) ) |
| r1293 | r1294 | |
| 882 | 1023 | |
| 883 | 1024 | GAME( 1995, cluedo, 0, jpmimpct, cluedo, 0, ROT0, "JPM", "Cluedo (prod. 2D)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| 884 | 1025 | GAME( 1995, cluedo2c, cluedo, jpmimpct, cluedo, 0, ROT0, "JPM", "Cluedo (prod. 2C)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| 1026 | GAME( 1995, cluedo2, cluedo, jpmimpct, cluedo, 0, ROT0, "JPM", "Cluedo (prod. 2)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 885 | 1027 | GAME( 1996, trivialp, 0, jpmimpct, trivialp, 0, ROT0, "JPM", "Trivial Pursuit (prod. 1D)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| 886 | 1028 | GAME( 1997, scrabble, 0, jpmimpct, scrabble, 0, ROT0, "JPM", "Scrabble (rev. F)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| 887 | 1029 | GAME( 1998, hngmnjpm, 0, jpmimpct, hngmnjpm, 0, ROT0, "JPM", "Hangman (JPM)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| 888 |
| r1293 | r1294 | |
|---|---|---|
| 1371 | 1371 | MDRV_CPU_ADD(H83002, 14745600 ) /* verified 14.7456 MHz */ |
| 1372 | 1372 | MDRV_CPU_PROGRAM_MAP( s12h8rwmap, 0 ) |
| 1373 | 1373 | MDRV_CPU_IO_MAP( s12h8iomap, 0 ) |
| 1374 | MDRV_CPU_VBLANK_INT( irq1_line_pulse, 1 ) | |
| 1374 | MDRV_CPU_VBLANK_INT( irq1_line_pulse, 1 ) | |
| 1375 | 1375 | |
| 1376 | 1376 | MDRV_SCREEN_REFRESH_RATE( 60 ) |
| 1377 | 1377 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| r1293 | r1294 | |
|---|---|---|
| 68 | 68 | speech_rom_bit = 0; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | int ad2083_speech_rom_read_bit(void) | |
| 71 | static int ad2083_speech_rom_read_bit(void) | |
| 72 | 72 | { |
| 73 | 73 | UINT8 *ROM = memory_region(REGION_SOUND1); |
| 74 | 74 | int bit; |
| r1293 | r1294 | |
| 552 | 552 | AM_RANGE(0xd800, 0xd800) AM_READ(monsterz_prot_r) |
| 553 | 553 | ADDRESS_MAP_END |
| 554 | 554 | |
| 555 | ADDRESS_MAP_START( monsterz_sound_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 555 | static ADDRESS_MAP_START( monsterz_sound_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 556 | 556 | AM_RANGE(0x04, 0x04) AM_READ(monsterz_sound_status_r) |
| 557 | 557 | AM_RANGE(0x10, 0x10) AM_WRITE(AY8910_control_port_0_w) |
| 558 | 558 | AM_RANGE(0x20, 0x20) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w) |
| r1293 | r1294 | |
| 2467 | 2467 | MDRV_CPU_IO_MAP(hunchbks_readport,0) |
| 2468 | 2468 | MDRV_CPU_VBLANK_INT(hunchbks_vh_interrupt,1) |
| 2469 | 2469 | |
| 2470 | MDRV_SCREEN_VBLANK_TIME( | |
| 2470 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2471 | 2471 | |
| 2472 | 2472 | /* video hardware */ |
| 2473 | 2473 | MDRV_PALETTE_LENGTH(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets */ |
| r1293 | r1294 | |
|---|---|---|
| 3 | 3 | #include "driver.h" |
| 4 | 4 | #include "sound/dac.h" |
| 5 | 5 | |
| 6 | UINT8 *mogura_tileram; | |
| 7 | UINT8* mogura_gfxram; | |
| 6 | static UINT8 *mogura_tileram; | |
| 7 | static UINT8* mogura_gfxram; | |
| 8 | 8 | static tilemap *mogura_tilemap; |
| 9 | 9 | |
| 10 | 10 | static PALETTE_INIT( mogura ) |
| r1293 | r1294 | |
|---|---|---|
| 44 | 44 | static UINT8 last_shift_data; /* 7-bit latch @ 7C */ |
| 45 | 45 | static UINT8 intercept; /* J-K flip-flop @ 6B */ |
| 46 | 46 | |
| 47 | static mame_timer *irq_timer; | |
| 48 | static mame_timer *nmi_timer; | |
| 47 | static emu_timer *irq_timer; | |
| 48 | static emu_timer *nmi_timer; | |
| 49 | 49 | static UINT8 irq_enabled; /* J-K flip-flop @ 3D */ |
| 50 | 50 | static UINT8 nmi_enabled; /* flip-flop made out of 2 NAND gates @ 1D */ |
| 51 | 51 | |
| r1293 | r1294 | |
| 164 | 164 | next_v256 = irq_trigger_v256s[next_irq_number]; |
| 165 | 165 | |
| 166 | 166 | next_vpos = vysnc_chain_counter_to_vpos(next_counter, next_v256); |
| 167 | | |
| 167 | | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | static void create_irq_timer(void) |
| 172 | 172 | { |
| 173 | irq_timer = | |
| 173 | irq_timer = | |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | |
| 177 | 177 | static void start_irq_timer(void) |
| 178 | 178 | { |
| 179 | 179 | int vpos = vysnc_chain_counter_to_vpos(irq_trigger_counts[0], irq_trigger_v256s[0]); |
| 180 | | |
| 180 | | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | |
| r1293 | r1294 | |
| 241 | 241 | next_v256 = nmi_trigger_v256s[next_nmi_number]; |
| 242 | 242 | |
| 243 | 243 | next_vpos = vysnc_chain_counter_to_vpos(next_counter, next_v256); |
| 244 | | |
| 244 | | |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | |
| 248 | 248 | static void create_nmi_timer(void) |
| 249 | 249 | { |
| 250 | nmi_timer = | |
| 250 | nmi_timer = | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
| 254 | 254 | static void start_nmi_timer(void) |
| 255 | 255 | { |
| 256 | 256 | int vpos = vysnc_chain_counter_to_vpos(nmi_trigger_counts[0], nmi_trigger_v256s[0]); |
| 257 | | |
| 257 | | |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 |
| r1293 | r1294 | |
|---|---|---|
| 175 | 175 | |
| 176 | 176 | /* in Gridiron, the sound CPU goes in a tight loop after the self test, */ |
| 177 | 177 | /* probably waiting to be reset by a watchdog */ |
| 178 | if (activecpu_get_pc() == 0x08bc) | |
| 178 | if (activecpu_get_pc() == 0x08bc) | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
| r1293 | r1294 | |
| 208 | 208 | MSM5205_reset_w(0,data ? 0 : 1); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | void tehkanwc_adpcm_int (int data) | |
| 211 | static void tehkanwc_adpcm_int (int data) | |
| 212 | 212 | { |
| 213 | 213 | static int toggle; |
| 214 | 214 |
| r1293 | r1294 | |
|---|---|---|
| 135 | 135 | |
| 136 | 136 | ********************************************************************/ |
| 137 | 137 | |
| 138 | INTERRUPT_GEN( bionicc_interrupt ) | |
| 138 | static INTERRUPT_GEN( bionicc_interrupt ) | |
| 139 | 139 | { |
| 140 | 140 | if (cpu_getiloops() == 0) |
| 141 | 141 | cpunum_set_input_line(0, 2, HOLD_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | //AT |
| 169 | void spy_collision(void) | |
| 169 | static void spy_collision(void) | |
| 170 | 170 | { |
| 171 | 171 | #define MAX_SPRITES 64 |
| 172 | 172 | #define DEF_NEAR_PLANE 0x6400 |
| r1293 | r1294 | |
|---|---|---|
| 71 | 71 | { |
| 72 | 72 | soundlatch_w(0,data & 0xff); |
| 73 | 73 | cpunum_set_input_line(1,0,ASSERT_LINE); // Generate an IRQ |
| 74 | cpu_spinuntil_time( | |
| 74 | cpu_spinuntil_time( | |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 |
| r1293 | r1294 | |
|---|---|---|
| 364 | 364 | #include "machine/53c810.h" |
| 365 | 365 | #include "sound/scsp.h" |
| 366 | 366 | |
| 367 | int model3_irq_enable; | |
| 367 | static int model3_irq_enable; | |
| 368 | 368 | int model3_irq_state; |
| 369 | 369 | int model3_step; |
| 370 | 370 | UINT32 *model3_vrom; |
| r1293 | r1294 | |
| 1312 | 1312 | SCSP_MidiIn(0, (data>>56)&0xff, 0); |
| 1313 | 1313 | |
| 1314 | 1314 | // give the 68k time to notice |
| 1315 | cpu_spinuntil_time( | |
| 1315 | cpu_spinuntil_time( | |
| 1316 | 1316 | } |
| 1317 | 1317 | } |
| 1318 | 1318 |
| r1293 | r1294 | |
|---|---|---|
| 297 | 297 | static UINT8 *pointram; |
| 298 | 298 | static int pointram_idx; |
| 299 | 299 | |
| 300 | UINT16 *namcos21_dspram16; | |
| 301 | UINT16 *namcos21_spritepos; | |
| 300 | static UINT16 *namcos21_dspram16; | |
| 301 | //UINT16 *namcos21_spritepos; | |
| 302 | 302 | |
| 303 | 303 | /* private data */ |
| 304 | 304 | static UINT16 *mpDataROM; |
| r1293 | r1294 | |
| 683 | 683 | return 1; |
| 684 | 684 | } /* dsp_port8_r */ |
| 685 | 685 | |
| 686 | int namcos21_irq_enable; | |
| 686 | static int namcos21_irq_enable; | |
| 687 | 687 | |
| 688 | 688 | static WRITE16_HANDLER( dsp_port8_w ) |
| 689 | 689 | { /* IRQ-enable? */ |
| r1293 | r1294 | |
|---|---|---|
| 335 | 335 | } |
| 336 | 336 | #endif |
| 337 | 337 | |
| 338 | //static | |
| 338 | //static | |
| 339 | 339 | static WRITE32_HANDLER( arm7_latch_arm_w ) |
| 340 | 340 | { |
| 341 | 341 | if (PGMARM7LOGERROR) logerror("ARM7: Latch write: %08x (%08x) (%06x)\n", data, mem_mask, activecpu_get_pc() ); |
| 342 | 342 | COMBINE_DATA(&arm7_latch); |
| 343 | 343 | |
| 344 | 344 | #ifdef PGMARM7SPEEDHACK |
| 345 | // cpu_boost_interleave(time_zero, | |
| 345 | // cpu_boost_interleave(attotime_zero, | |
| 346 | 346 | if (data!=0xaa) cpu_spinuntil_trigger(1000); |
| 347 | 347 | cpu_trigger(1002); |
| 348 | 348 | #else |
| 349 | cpu_boost_interleave(time_zero, MAME_TIME_IN_USEC(100)); | |
| 350 | cpu_spinuntil_time(MAME_TIME_IN_CYCLES(100, 0)); | |
| 349 | cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100)); | |
| 350 | cpu_spinuntil_time(ATTOTIME_IN_CYCLES(100, 0)); | |
| 351 | 351 | #endif |
| 352 | 352 | } |
| 353 | 353 | |
| r1293 | r1294 | |
| 376 | 376 | |
| 377 | 377 | #ifdef PGMARM7SPEEDHACK |
| 378 | 378 | cpu_trigger(1000); |
| 379 | | |
| 379 | | |
| 380 | 380 | cpu_spinuntil_trigger(1002); |
| 381 | 381 | #else |
| 382 | 382 | cpunum_set_input_line(2, ARM7_FIRQ_LINE, PULSE_LINE); |
| 383 | cpu_boost_interleave(time_zero, MAME_TIME_IN_USEC(200)); | |
| 384 | cpu_spinuntil_time(MAME_TIME_IN_CYCLES(200, 2)); // give the arm time to respond (just boosting the interleave doesn't help | |
| 383 | cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(200)); | |
| 384 | cpu_spinuntil_time(ATTOTIME_IN_CYCLES(200, 2)); // give the arm time to respond (just boosting the interleave doesn't help | |
| 385 | 385 | #endif |
| 386 | 386 | } |
| 387 | 387 | |
| r1293 | r1294 | |
| 727 | 727 | |
| 728 | 728 | /* Kov Superheroes */ |
| 729 | 729 | |
| 730 | UINT16 kovsh_highlatch, kovsh_lowlatch; | |
| 730 | static UINT16 kovsh_highlatch, kovsh_lowlatch; | |
| 731 | 731 | |
| 732 | 732 | static READ32_HANDLER( kovsh_arm7_protlatch_r ) |
| 733 | 733 | { |
| r1293 | r1294 | |
| 748 | 748 | kovsh_lowlatch = data; |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | // cpu_boost_interleave(time_zero, MAME_TIME_IN_USEC(100)); | |
| 752 | // cpu_spinuntil_time(MAME_TIME_IN_CYCLES(100, 0)); | |
| 751 | // cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100)); | |
| 752 | // cpu_spinuntil_time(ATTOTIME_IN_CYCLES(100, 0)); | |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | static READ16_HANDLER( kovsh_68k_protlatch_r ) |
| 756 | 756 | { |
| 757 | //cpu_boost_interleave(time_zero, MAME_TIME_IN_USEC(200)); | |
| 758 | cpu_spinuntil_time(MAME_TIME_IN_CYCLES(600, 0)); | |
| 757 | //cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(200)); | |
| 758 | cpu_spinuntil_time(ATTOTIME_IN_CYCLES(600, 0)); | |
| 759 | 759 | |
| 760 | 760 | switch (offset) |
| 761 | 761 | { |
| r1293 | r1294 | |
| 2102 | 2102 | |
| 2103 | 2103 | /* ddp2 rubbish */ |
| 2104 | 2104 | |
| 2105 | UINT16 *ddp2_protram; | |
| 2105 | static UINT16 *ddp2_protram; | |
| 2106 | 2106 | static int ddp2_asic27_0xd10000 = 0; |
| 2107 | 2107 | |
| 2108 | 2108 | static WRITE16_HANDLER ( ddp2_asic27_0xd10000_w ) |
| r1293 | r1294 | |
|---|---|---|
| 182 | 182 | * |
| 183 | 183 | *************************************/ |
| 184 | 184 | |
| 185 | static | |
| 185 | static | |
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | |
| r1293 | r1294 | |
| 281 | 281 | /* Kaos sits in a tight loop polling the VIA irq flags register, but that register is |
| 282 | 282 | cleared by the irq handler. Therefore, I wait a bit before triggering the irq to |
| 283 | 283 | leave time for the program to see the flag change. */ |
| 284 | | |
| 284 | | |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | |
| r1293 | r1294 | |
| 311 | 311 | via_0_ca1_w(0, (UINT8)param); |
| 312 | 312 | |
| 313 | 313 | if (param) |
| 314 | | |
| 314 | | |
| 315 | 315 | else |
| 316 | | |
| 316 | | |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | |
| 320 | 320 | static void create_via_0_timer(void) |
| 321 | 321 | { |
| 322 | via_0_ca1_timer = | |
| 322 | via_0_ca1_timer = | |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | |
| 326 | 326 | static void start_via_0_timer(void) |
| 327 | 327 | { |
| 328 | | |
| 328 | | |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 |
| r1293 | r1294 | |
|---|---|---|
| 129 | 129 | video_screen_update_partial(0, scanline - 1); |
| 130 | 130 | scanline += 32; |
| 131 | 131 | if (scanline > 240) scanline = 32; |
| 132 | | |
| 132 | | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
| 136 | 136 | static MACHINE_RESET( capbowl ) |
| 137 | 137 | { |
| 138 | | |
| 138 | | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 |
| r1293 | r1294 | |
|---|---|---|
| 249 | 249 | static INTERRUPT_GEN( irq0_start ) |
| 250 | 250 | { |
| 251 | 251 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| 252 | | |
| 252 | | |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | |
| r1293 | r1294 | |
| 392 | 392 | UINT32 r26 = activecpu_get_reg(MIPS3_R26) - *kinst_speedup; |
| 393 | 393 | if (r26 < r3) |
| 394 | 394 | { |
| 395 | | |
| 395 | | |
| 396 | 396 | cpu_spinuntil_int(); |
| 397 | 397 | } |
| 398 | 398 | } |
| r1293 | r1294 | |
| 650 | 650 | }; |
| 651 | 651 | |
| 652 | 652 | |
| 653 | MACHINE_DRIVER_START( kinst ) | |
| 653 | static MACHINE_DRIVER_START( kinst ) | |
| 654 | 654 | |
| 655 | 655 | /* basic machine hardware */ |
| 656 | 656 | MDRV_CPU_ADD(R4600LE, MASTER_CLOCK*2) |
| r1293 | r1294 | |
|---|---|---|
| 156 | 156 | update_interrupts(); |
| 157 | 157 | |
| 158 | 158 | /* set the timer for the next one */ |
| 159 | | |
| 159 | | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
| r1293 | r1294 | |
| 172 | 172 | memcpy(ram_base, rom_base, 0x40); |
| 173 | 173 | |
| 174 | 174 | /* compute the timing of the HBLANK interrupt and set the first timer */ |
| 175 | hblank_offset = mame_time_to_double(video_screen_get_scan_period(0)) * ((455. - 336. - 25.) / 455.); | |
| 176 | mame_timer_set(double_to_mame_time(mame_time_to_double(video_screen_get_time_until_pos(0, 0, 0)) - hblank_offset), 0, scanline_callback); | |
| 175 | hblank_offset = attotime_to_double(video_screen_get_scan_period(0)) * ((455. - 336. - 25.) / 455.); | |
| 176 | timer_set(double_to_attotime(attotime_to_double(video_screen_get_time_until_pos(0, 0, 0)) - hblank_offset), 0, scanline_callback); | |
| 177 | 177 | |
| 178 | 178 | /* reset IRQs */ |
| 179 | 179 | irq_line_state = CLEAR_LINE; |
| r1293 | r1294 | |
|---|---|---|
| 392 | 392 | // GFXDECODE_ENTRY( 0, 0, charlayout, 0, 16*4 ) |
| 393 | 393 | GFXDECODE_END |
| 394 | 394 | |
| 395 | INTERRUPT_GEN(st0016_int) | |
| 395 | static INTERRUPT_GEN(st0016_int) | |
| 396 | 396 | { |
| 397 | 397 | if(!cpu_getiloops()) |
| 398 | 398 | cpunum_set_input_line(0,0,HOLD_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 374 | 374 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 375 | 375 | |
| 376 | 376 | MDRV_SCREEN_REFRESH_RATE(58) |
| 377 | MDRV_SCREEN_VBLANK_TIME( | |
| 377 | MDRV_SCREEN_VBLANK_TIME(A | |
| 378 | 378 | |
| 379 | 379 | /* video hardware */ |
| 380 | 380 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 23 | 23 | #include "driver.h" |
| 24 | 24 | #include "sound/ay8910.h" |
| 25 | 25 | |
| 26 | UINT8 *skyarmy_videoram; | |
| 27 | UINT8 *skyarmy_colorram; | |
| 28 | UINT8 *skyarmy_scrollram; | |
| 26 | static UINT8 *skyarmy_videoram; | |
| 27 | static UINT8 *skyarmy_colorram; | |
| 28 | static UINT8 *skyarmy_scrollram; | |
| 29 | 29 | static tilemap* skyarmy_tilemap; |
| 30 | 30 | |
| 31 | 31 | static TILE_GET_INFO( get_skyarmy_tile_info ) |
| r1293 | r1294 | |
|---|---|---|
| 1 | 1 | #define XE_DEBUG 0 |
| 2 | 2 | #define XE_SKIPIDLE 1 |
| 3 | #define XE_DMADELAY | |
| 3 | #define XE_DMADELAY | |
| 4 | 4 | |
| 5 | 5 | /*************************************************************************** |
| 6 | 6 | |
| r1293 | r1294 | |
| 82 | 82 | static int init_eeprom_count; |
| 83 | 83 | static INT32 cur_sound_region, xexex_strip0x1a; |
| 84 | 84 | static int suspension_active, resume_trigger; |
| 85 | static | |
| 85 | static | |
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | static struct EEPROM_interface eeprom_interface = |
| r1293 | r1294 | |
| 331 | 331 | xexex_objdma(0); |
| 332 | 332 | |
| 333 | 333 | // schedule DMA end interrupt |
| 334 | | |
| 334 | | |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | // IRQ 4 is the V-blank interrupt. It controls color, sound and |
| r1293 | r1294 | |
| 484 | 484 | /* audio CPU */ |
| 485 | 485 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 486 | 486 | |
| 487 | MDRV_INTERLEAVE(32) | |
| 487 | MDRV_INTERLEAVE(32) | |
| 488 | 488 | MDRV_SCREEN_REFRESH_RATE(60) |
| 489 | 489 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| 490 | 490 | |
| r1293 | r1294 | |
| 633 | 633 | |
| 634 | 634 | resume_trigger = 1000; |
| 635 | 635 | |
| 636 | dmadelay_timer = | |
| 636 | dmadelay_timer = | |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 |
| r1293 | r1294 | |
|---|---|---|
| 62 | 62 | /* the interrupt occurs on the HBLANK of the 6th scanline following */ |
| 63 | 63 | if (check < &atarigen_alpha[0x7c0] && (*check & 0x8000)) |
| 64 | 64 | { |
| 65 | mame_time period = video_screen_get_time_until_pos(scrnum, video_screen_get_vpos(scrnum) + 6, machine->screen[scrnum].width * 0.9); | |
| 66 | mame_timer_set(period, 0, irq_gen); | |
| 65 | attotime period = video_screen_get_time_until_pos(scrnum, video_screen_get_vpos(scrnum) + 6, machine->screen[scrnum].width * 0.9); | |
| 66 | timer_set(period, 0, irq_gen); | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /* update the playfield and motion objects */ |
| r1293 | r1294 | |
|---|---|---|
| 377 | 377 | MDRV_CPU_PERIODIC_INT( irq2_line_hold, 480 ) |
| 378 | 378 | |
| 379 | 379 | MDRV_SCREEN_REFRESH_RATE( 60 ) |
| 380 | MDRV_SCREEN_VBLANK_TIME( | |
| 380 | MDRV_SCREEN_VBLANK_TIME(A | |
| 381 | 381 | |
| 382 | 382 | MDRV_MACHINE_START( konamigq ) |
| 383 | 383 | MDRV_MACHINE_RESET( konamigq ) |
| r1293 | r1294 | |
|---|---|---|
| 153 | 153 | return mrflea_status^0x01; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | INTERRUPT_GEN( mrflea_io_interrupt ){ | |
| 156 | static INTERRUPT_GEN( mrflea_io_interrupt ){ | |
| 157 | 157 | if( cpu_getiloops()==0 || (mrflea_status&0x08) ) |
| 158 | 158 | cpunum_set_input_line(1, 0, HOLD_LINE); |
| 159 | 159 | } |
| r1293 | r1294 | |
|---|---|---|
| 345 | 345 | #define DMA_XOR(a) ((a) ^ 2) |
| 346 | 346 | #endif |
| 347 | 347 | |
| 348 | int cps3_use_fastboot; | |
| 348 | static int cps3_use_fastboot; | |
| 349 | 349 | |
| 350 | 350 | static UINT32* decrypted_bios; |
| 351 | 351 | static UINT32* decrypted_gamerom; |
| 352 | 352 | static UINT32 cram_gfxflash_bank; |
| 353 | UINT32* cps3_nops; | |
| 353 | static UINT32* cps3_nops; | |
| 354 | 354 | |
| 355 | 355 | static UINT32* tilemap20_regs_base; |
| 356 | 356 | static UINT32* tilemap30_regs_base; |
| 357 | 357 | static UINT32* tilemap40_regs_base; |
| 358 | 358 | static UINT32* tilemap50_regs_base; |
| 359 | 359 | |
| 360 | UINT32* cps3_0xc0000000_ram; | |
| 361 | UINT32* cps3_0xc0000000_ram_decrypted; | |
| 360 | static UINT32* cps3_0xc0000000_ram; | |
| 361 | static UINT32* cps3_0xc0000000_ram_decrypted; | |
| 362 | 362 | |
| 363 | UINT32* cps3_char_ram; | |
| 363 | static UINT32* cps3_char_ram; | |
| 364 | 364 | |
| 365 | UINT32* cps3_spriteram; | |
| 366 | UINT32* cps3_eeprom; | |
| 367 | UINT32* cps3_fullscreenzoom; | |
| 365 | static UINT32* cps3_spriteram; | |
| 366 | static UINT32* cps3_eeprom; | |
| 367 | static UINT32* cps3_fullscreenzoom; | |
| 368 | 368 | |
| 369 | 369 | UINT32 cps3_ss_pal_base = 0; |
| 370 | UINT32* cps3_colourram; | |
| 371 | UINT32 cps3_unk_vidregs[0x20/4]; | |
| 370 | static UINT32* cps3_colourram; | |
| 371 | static UINT32 cps3_unk_vidregs[0x20/4]; | |
| 372 | 372 | UINT32 cps3_ss_bank_base = 0; |
| 373 | 373 | |
| 374 | UINT32 cps3_screenwidth; | |
| 375 | cdrom_file* cps3_cd; | |
| 374 | static UINT32 cps3_screenwidth; | |
| 375 | //cdrom_file* cps3_cd; | |
| 376 | 376 | |
| 377 | UINT32* cps3_mame_colours;//[0x20000]; // actual values to write to 32-bit bitmap | |
| 377 | static UINT32* cps3_mame_colours;//[0x20000]; // actual values to write to 32-bit bitmap | |
| 378 | 378 | |
| 379 | 379 | static mame_bitmap *renderbuffer_bitmap; |
| 380 | 380 | static rectangle renderbuffer_clip; |
| r1293 | r1294 | |
| 686 | 686 | { 0 } // end of table |
| 687 | 687 | }; |
| 688 | 688 | |
| 689 | void cps3_decrypt_bios(void) | |
| 689 | static void cps3_decrypt_bios(void) | |
| 690 | 690 | { |
| 691 | 691 | int i; |
| 692 | 692 | UINT32 *coderegion = (UINT32*)memory_region(REGION_USER1); |
| r1293 | r1294 | |
| 804 | 804 | 64*8 |
| 805 | 805 | }; |
| 806 | 806 | |
| 807 | UINT32* cps3_ss_ram; | |
| 808 | UINT8* cps3_ss_ram_dirty; | |
| 809 | int cps3_ss_ram_is_dirty; | |
| 807 | static UINT32* cps3_ss_ram; | |
| 808 | static UINT8* cps3_ss_ram_dirty; | |
| 809 | static int cps3_ss_ram_is_dirty; | |
| 810 | 810 | |
| 811 | UINT8* cps3_char_ram_dirty; | |
| 812 | int cps3_char_ram_is_dirty; | |
| 811 | static UINT8* cps3_char_ram_dirty; | |
| 812 | static int cps3_char_ram_is_dirty; | |
| 813 | 813 | |
| 814 | void cps3_set_mame_colours( int colournum, UINT16 data, UINT32 fadeval ) | |
| 814 | static void cps3_set_mame_colours( int colournum, UINT16 data, UINT32 fadeval ) | |
| 815 | 815 | { |
| 816 | 816 | int r,g,b; |
| 817 | 817 | UINT16* dst = (UINT16*)cps3_colourram; |
| r1293 | r1294 | |
| 940 | 940 | |
| 941 | 941 | // the 0x400 bit in the tilemap regs is "draw it upside-down" (bios tilemap during flashing, otherwise capcom logo is flipped) |
| 942 | 942 | |
| 943 | void cps3_draw_tilemapsprite_line(int tmnum, int drawline, mame_bitmap *bitmap, const rectangle *cliprect ) | |
| 943 | static void cps3_draw_tilemapsprite_line(int tmnum, int drawline, mame_bitmap *bitmap, const rectangle *cliprect ) | |
| 944 | 944 | { |
| 945 | 945 | UINT32* tmapregs[4] = { tilemap20_regs_base, tilemap30_regs_base, tilemap40_regs_base, tilemap50_regs_base }; |
| 946 | 946 | UINT32* regs; |
| r1293 | r1294 | |
| 1576 | 1576 | |
| 1577 | 1577 | |
| 1578 | 1578 | |
| 1579 | UINT32 cps3_flashmain_r(int base, UINT32 offset, UINT32 mem_mask) | |
| 1579 | static UINT32 cps3_flashmain_r(int base, UINT32 offset, UINT32 mem_mask) | |
| 1580 | 1580 | { |
| 1581 | 1581 | UINT32 result = 0; |
| 1582 | 1582 | |
| r1293 | r1294 | |
| 1609 | 1609 | /* In certain situations (SH2 DMA?) the reads must bypass the encryption device, |
| 1610 | 1610 | this is used when checking the flash roms, and performing rom tests. Without |
| 1611 | 1611 | modification to the SH2 core this requires PC based hacks to work correctly */ |
| 1612 | UINT32 cps3_bios_test_hack; | |
| 1613 | UINT32 cps3_game_test_hack; | |
| 1612 | static UINT32 cps3_bios_test_hack; | |
| 1613 | static UINT32 cps3_game_test_hack; | |
| 1614 | 1614 | |
| 1615 | 1615 | struct cps3_test_hacks |
| 1616 | 1616 | { |
| r1293 | r1294 | |
| 1690 | 1690 | return retvalue; |
| 1691 | 1691 | } |
| 1692 | 1692 | |
| 1693 | void cps3_flashmain_w(int base, UINT32 offset, UINT32 data, UINT32 mem_mask) | |
| 1693 | static void cps3_flashmain_w(int base, UINT32 offset, UINT32 data, UINT32 mem_mask) | |
| 1694 | 1694 | { |
| 1695 | 1695 | int command; |
| 1696 | 1696 | if (!(mem_mask & 0xff000000)) // Flash 1 |
| r1293 | r1294 | |
| 1858 | 1858 | |
| 1859 | 1859 | /* EEPROM access is a little odd, I think it accesses eeprom through some kind of |
| 1860 | 1860 | additional interface, as these writes aren't normal for the type of eeprom we have */ |
| 1861 | UINT16 cps3_current_eeprom_read; | |
| 1861 | static UINT16 cps3_current_eeprom_read; | |
| 1862 | 1862 | |
| 1863 | 1863 | static READ32_HANDLER( cps3_eeprom_r ) |
| 1864 | 1864 | { |
| r1293 | r1294 | |
| 2089 | 2089 | } |
| 2090 | 2090 | } |
| 2091 | 2091 | |
| 2092 | void cps3_do_char_dma( UINT32 real_source, UINT32 real_destination, UINT32 real_length ) | |
| 2092 | static void cps3_do_char_dma( UINT32 real_source, UINT32 real_destination, UINT32 real_length ) | |
| 2093 | 2093 | { |
| 2094 | 2094 | UINT8* sourcedata = (UINT8*)memory_region(REGION_USER5); |
| 2095 | 2095 | int length_remaining; |
| r1293 | r1294 | |
| 2176 | 2176 | } |
| 2177 | 2177 | } |
| 2178 | 2178 | |
| 2179 | void cps3_do_alt_char_dma( UINT32 src, UINT32 real_dest, UINT32 real_length ) | |
| 2179 | static void cps3_do_alt_char_dma( UINT32 src, UINT32 real_dest, UINT32 real_length ) | |
| 2180 | 2180 | { |
| 2181 | 2181 | UINT8* px = (UINT8*)memory_region(REGION_USER5); |
| 2182 | 2182 | UINT32 start = real_dest; |
| r1293 | r1294 | |
| 2217 | 2217 | } |
| 2218 | 2218 | } |
| 2219 | 2219 | |
| 2220 | void cps3_process_character_dma(UINT32 address) | |
| 2220 | static void cps3_process_character_dma(UINT32 address) | |
| 2221 | 2221 | { |
| 2222 | 2222 | int i; |
| 2223 | 2223 | |
| r1293 | r1294 | |
| 2351 | 2351 | } |
| 2352 | 2352 | } |
| 2353 | 2353 | |
| 2354 | UINT32* cps3_mainram; | |
| 2354 | static UINT32* cps3_mainram; | |
| 2355 | 2355 | |
| 2356 | 2356 | /* there are more unknown writes, but you get the idea */ |
| 2357 | 2357 | static ADDRESS_MAP_START( cps3_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| r1293 | r1294 | |
| 2484 | 2484 | }; |
| 2485 | 2485 | |
| 2486 | 2486 | |
| 2487 | static | |
| 2487 | static | |
| 2488 | 2488 | |
| 2489 | 2489 | static TIMER_CALLBACK( fastboot_timer_callback ) |
| 2490 | 2490 | { |
| r1293 | r1294 | |
| 2515 | 2515 | |
| 2516 | 2516 | if (cps3_use_fastboot) |
| 2517 | 2517 | { |
| 2518 | fastboot_timer = | |
| 2518 | fastboot_timer = | |
| 2519 | 2519 | // printf("reset\n"); |
| 2520 | | |
| 2520 | | |
| 2521 | 2521 | } |
| 2522 | 2522 | } |
| 2523 | 2523 | |
| r1293 | r1294 | |
| 3022 | 3022 | ROM_END |
| 3023 | 3023 | |
| 3024 | 3024 | /* Idle loop skipping speedups */ |
| 3025 | UINT32 cps3_speedup_ram_address; | |
| 3026 | UINT32 cps3_speedup_code_address; | |
| 3025 | static UINT32 cps3_speedup_ram_address; | |
| 3026 | static UINT32 cps3_speedup_code_address; | |
| 3027 | 3027 | |
| 3028 | 3028 | struct cps3_speedups |
| 3029 | 3029 | { |
| r1293 | r1294 | |
|---|---|---|
| 299 | 299 | |
| 300 | 300 | ***************************************************************************/ |
| 301 | 301 | |
| 302 | void glass_ROM16_split(int src_reg, int dst_reg, int start, int length, int dest1, int dest2) | |
| 302 | static void glass_ROM16_split(int src_reg, int dst_reg, int start, int length, int dest1, int dest2) | |
| 303 | 303 | { |
| 304 | 304 | int i; |
| 305 | 305 |
| r1293 | r1294 | |
|---|---|---|
| 575 | 575 | static void toaplan2_vblank_irq(int irq_line) |
| 576 | 576 | { |
| 577 | 577 | /* the IRQ appears to fire at line 0xe6 */ |
| 578 | | |
| 578 | | |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | static INTERRUPT_GEN( toaplan2_vblank_irq1 ) { toaplan2_vblank_irq(1); } |
| r1293 | r1294 | |
|---|---|---|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | void *mjkjidai_adpcm_start (int clock, const struct CustomSound_interface *config) | |
| 76 | static void *mjkjidai_adpcm_start (int clock, const struct CustomSound_interface *config) | |
| 77 | 77 | { |
| 78 | 78 | struct mjkjidai_adpcm_state *state = &mjkjidai_adpcm; |
| 79 | 79 | state->playing = 0; |
| r1293 | r1294 | |
|---|---|---|
| 219 | 219 | ***************************************************************************/ |
| 220 | 220 | static UINT16 *mcu_ram, jchan_mcu_com[4]; |
| 221 | 221 | |
| 222 | void jchan_mcu_run(void) | |
| 222 | static void jchan_mcu_run(void) | |
| 223 | 223 | { |
| 224 | 224 | UINT16 mcu_command = mcu_ram[0x0010/2]; /* command nb */ |
| 225 | 225 | UINT16 mcu_offset = mcu_ram[0x0012/2] / 2; /* offset in shared RAM where MCU will write */ |
| r1293 | r1294 | |
| 398 | 398 | |
| 399 | 399 | static UINT16 *jchan_spriteram; |
| 400 | 400 | |
| 401 | INTERRUPT_GEN( jchan_vblank ) | |
| 401 | static INTERRUPT_GEN( jchan_vblank ) | |
| 402 | 402 | { |
| 403 | 403 | if (!cpu_getiloops()) |
| 404 | 404 | cpunum_set_input_line(0, 1, HOLD_LINE); |
| r1293 | r1294 | |
| 532 | 532 | buffered_spriteram32[offset]=(jchan_spriteram[offset*2+1]<<16) | (jchan_spriteram[offset*2]); |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | UINT16* jchan_sprregs; | |
| 535 | static UINT16* jchan_sprregs; | |
| 536 | 536 | |
| 537 | 537 | static WRITE16_HANDLER( jchan_suprnova_sprite32regs_w ) |
| 538 | 538 | { |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | extern UINT16 *gaelco_videoram; |
| 17 | 17 | extern UINT16 *gaelco_spriteram; |
| 18 | 18 | extern tilemap *gaelco_tilemap[2]; |
| 19 | UINT16 *gaelco_screen; | |
| 19 | static UINT16 *gaelco_screen; | |
| 20 | 20 | |
| 21 | 21 | /* from video/gaelco.c */ |
| 22 | 22 | WRITE16_HANDLER( gaelco_vram_w ); |
| r1293 | r1294 | |
|---|---|---|
| 1271 | 1271 | |
| 1272 | 1272 | ROM_END |
| 1273 | 1273 | |
| 1274 | void wecleman_unpack_sprites(void) | |
| 1274 | static void wecleman_unpack_sprites(void) | |
| 1275 | 1275 | { |
| 1276 | 1276 | const int region = REGION_GFX1; // sprites |
| 1277 | 1277 | |
| r1293 | r1294 | |
| 1399 | 1399 | in a ROM module definition. This routine unpacks each sprite nibble |
| 1400 | 1400 | into a byte, doubling the memory consumption. */ |
| 1401 | 1401 | |
| 1402 | void hotchase_sprite_decode( int num16_banks, int bank_size ) | |
| 1402 | static void hotchase_sprite_decode( int num16_banks, int bank_size ) | |
| 1403 | 1403 | { |
| 1404 | 1404 | UINT8 *base, *temp; |
| 1405 | 1405 | int i; |
| r1293 | r1294 | |
|---|---|---|
| 165 | 165 | return 0; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | INTERRUPT_GEN( dderby_interrupt ) | |
| 168 | static INTERRUPT_GEN( dderby_interrupt ) | |
| 169 | 169 | { |
| 170 | 170 | // cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0x8); // almost certainly wrong? |
| 171 | 171 | // cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0x10); // almost certainly wrong? |
| r1293 | r1294 | |
|---|---|---|
| 215 | 215 | *************************************/ |
| 216 | 216 | |
| 217 | 217 | #define SYSTEM_CLOCK 50000000 |
| 218 | #define TIMER_PERIOD | |
| 218 | #define TIMER_PERIOD | |
| 219 | 219 | |
| 220 | 220 | /* various board configurations */ |
| 221 | 221 | #define PHOENIX_CONFIG (0) |
| r1293 | r1294 | |
| 381 | 381 | |
| 382 | 382 | struct galileo_timer |
| 383 | 383 | { |
| 384 | | |
| 384 | | |
| 385 | 385 | UINT32 count; |
| 386 | 386 | UINT8 active; |
| 387 | 387 | }; |
| r1293 | r1294 | |
| 541 | 541 | cpunum_set_info_int(0, CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1); |
| 542 | 542 | |
| 543 | 543 | /* allocate timers for the galileo */ |
| 544 | galileo.timer[0].timer = mame_timer_alloc(galileo_timer_callback); | |
| 545 | galileo.timer[1].timer = mame_timer_alloc(galileo_timer_callback); | |
| 546 | galileo.timer[2].timer = mame_timer_alloc(galileo_timer_callback); | |
| 547 | galileo.timer[3].timer = mame_timer_alloc(galileo_timer_callback); | |
| 544 | galileo.timer[0].timer = timer_alloc(galileo_timer_callback); | |
| 545 | galileo.timer[1].timer = timer_alloc(galileo_timer_callback); | |
| 546 | galileo.timer[2].timer = timer_alloc(galileo_timer_callback); | |
| 547 | galileo.timer[3].timer = timer_alloc(galileo_timer_callback); | |
| 548 | 548 | galileo.dma_active = -1; |
| 549 | 549 | |
| 550 | 550 | vblank_irq_num = 0; |
| r1293 | r1294 | |
| 915 | 915 | |
| 916 | 916 | /* if we're a timer, adjust the timer to fire again */ |
| 917 | 917 | if (galileo.reg[GREG_TIMER_CONTROL] & (2 << (2 * which))) |
| 918 | | |
| 918 | | |
| 919 | 919 | else |
| 920 | 920 | timer->active = timer->count = 0; |
| 921 | 921 | |
| r1293 | r1294 | |
| 1095 | 1095 | result = timer->count; |
| 1096 | 1096 | if (timer->active) |
| 1097 | 1097 | { |
| 1098 | UINT32 elapsed = | |
| 1098 | UINT32 elapsed = | |
| 1099 | 1099 | result = (result > elapsed) ? (result - elapsed) : 0; |
| 1100 | 1100 | } |
| 1101 | 1101 | |
| r1293 | r1294 | |
| 1226 | 1226 | if (which != 0) |
| 1227 | 1227 | timer->count &= 0xffffff; |
| 1228 | 1228 | } |
| 1229 | | |
| 1229 | | |
| 1230 | 1230 | if (LOG_TIMERS) |
| 1231 | logerror("Adjusted timer to fire in %f secs\n", | |
| 1231 | logerror("Adjusted timer to fire in %f secs\n", | |
| 1232 | 1232 | } |
| 1233 | 1233 | else if (timer->active && !(data & mask)) |
| 1234 | 1234 | { |
| 1235 | UINT32 elapsed = | |
| 1235 | UINT32 elapsed = | |
| 1236 | 1236 | timer->active = 0; |
| 1237 | 1237 | timer->count = (timer->count > elapsed) ? (timer->count - elapsed) : 0; |
| 1238 | | |
| 1238 | | |
| 1239 | 1239 | if (LOG_TIMERS) |
| 1240 | 1240 | logerror("Disabled timer\n"); |
| 1241 | 1241 | } |
| r1293 | r1294 | |
| 2454 | 2454 | SYSTEM_CLOCK /* system clock rate */ |
| 2455 | 2455 | }; |
| 2456 | 2456 | |
| 2457 | MACHINE_DRIVER_START( seattle_common ) | |
| 2457 | static MACHINE_DRIVER_START( seattle_common ) | |
| 2458 | 2458 | |
| 2459 | 2459 | /* basic machine hardware */ |
| 2460 | 2460 | MDRV_CPU_ADD_TAG("main", R5000LE, SYSTEM_CLOCK*3) |
| r1293 | r1294 | |
| 2479 | 2479 | MACHINE_DRIVER_END |
| 2480 | 2480 | |
| 2481 | 2481 | |
| 2482 | MACHINE_DRIVER_START( phoenixsa ) | |
| 2482 | static MACHINE_DRIVER_START( phoenixsa ) | |
| 2483 | 2483 | MDRV_IMPORT_FROM(seattle_common) |
| 2484 | 2484 | MDRV_CPU_REPLACE("main", R4700LE, SYSTEM_CLOCK*2) |
| 2485 | 2485 | MDRV_IMPORT_FROM(dcs2_audio_2115) |
| 2486 | 2486 | MACHINE_DRIVER_END |
| 2487 | 2487 | |
| 2488 | 2488 | |
| 2489 | MACHINE_DRIVER_START( seattle150 ) | |
| 2489 | static MACHINE_DRIVER_START( seattle150 ) | |
| 2490 | 2490 | MDRV_IMPORT_FROM(seattle_common) |
| 2491 | 2491 | MDRV_CPU_REPLACE("main", R5000LE, SYSTEM_CLOCK*3) |
| 2492 | 2492 | MDRV_IMPORT_FROM(dcs2_audio_2115) |
| 2493 | 2493 | MACHINE_DRIVER_END |
| 2494 | 2494 | |
| 2495 | 2495 | |
| 2496 | MACHINE_DRIVER_START( seattle200 ) | |
| 2496 | static MACHINE_DRIVER_START( seattle200 ) | |
| 2497 | 2497 | MDRV_IMPORT_FROM(seattle_common) |
| 2498 | 2498 | MDRV_CPU_REPLACE("main", R5000LE, SYSTEM_CLOCK*4) |
| 2499 | 2499 | MDRV_IMPORT_FROM(dcs2_audio_2115) |
| 2500 | 2500 | MACHINE_DRIVER_END |
| 2501 | 2501 | |
| 2502 | 2502 | |
| 2503 | MACHINE_DRIVER_START( flagstaff ) | |
| 2503 | static MACHINE_DRIVER_START( flagstaff ) | |
| 2504 | 2504 | MDRV_IMPORT_FROM(seattle_common) |
| 2505 | 2505 | MDRV_CPU_REPLACE("main", R5000LE, SYSTEM_CLOCK*4) |
| 2506 | 2506 | MDRV_VIDEO_START(flagstaff) |
| r1293 | r1294 | |
|---|---|---|
| 55 | 55 | cpu_triggerint(1); |
| 56 | 56 | |
| 57 | 57 | /* use a timer to make long transfers faster */ |
| 58 | | |
| 58 | | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 |
| r1293 | r1294 | |
|---|---|---|
| 38 | 38 | #include "rocknms.lh" |
| 39 | 39 | |
| 40 | 40 | UINT16 tetrisp2_systemregs[0x10]; |
| 41 | UINT16 rocknms_sub_systemregs[0x10]; | |
| 41 | static UINT16 rocknms_sub_systemregs[0x10]; | |
| 42 | 42 | |
| 43 | UINT16 rockn_protectdata; | |
| 44 | UINT16 rockn_adpcmbank; | |
| 45 | UINT16 rockn_soundvolume; | |
| 43 | static UINT16 rockn_protectdata; | |
| 44 | static UINT16 rockn_adpcmbank; | |
| 45 | static UINT16 rockn_soundvolume; | |
| 46 | 46 | |
| 47 | static mame_timer *rockn_timer_l4; | |
| 48 | static mame_timer *rockn_timer_sub_l4; | |
| 47 | static emu_timer *rockn_timer_l4; | |
| 48 | static emu_timer *rockn_timer_sub_l4; | |
| 49 | 49 | |
| 50 | 50 | /* Variables defined in video: */ |
| 51 | 51 | |
| r1293 | r1294 | |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | #define ROCKN_TIMER_BASE | |
| 105 | #define ROCKN_TIMER_BASE | |
| 106 | 106 | |
| 107 | 107 | static WRITE16_HANDLER( rockn_systemregs_w ) |
| 108 | 108 | { |
| r1293 | r1294 | |
| 111 | 111 | tetrisp2_systemregs[offset] = data; |
| 112 | 112 | if (offset == 0x0c) |
| 113 | 113 | { |
| 114 | mame_time timer = scale_up_mame_time(ROCKN_TIMER_BASE, 4096 - data); | |
| 115 | mame_timer_adjust(rockn_timer_l4, timer, 0, timer); | |
| 114 | attotime timer = attotime_mul(ROCKN_TIMER_BASE, 4096 - data); | |
| 115 | timer_adjust(rockn_timer_l4, timer, 0, timer); | |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | } |
| r1293 | r1294 | |
| 125 | 125 | rocknms_sub_systemregs[offset] = data; |
| 126 | 126 | if (offset == 0x0c) |
| 127 | 127 | { |
| 128 | mame_time timer = scale_up_mame_time(ROCKN_TIMER_BASE, 4096 - data); | |
| 129 | mame_timer_adjust(rockn_timer_sub_l4, timer, 0, timer); | |
| 128 | attotime timer = attotime_mul(ROCKN_TIMER_BASE, 4096 - data); | |
| 129 | timer_adjust(rockn_timer_sub_l4, timer, 0, timer); | |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | } |
| r1293 | r1294 | |
| 1024 | 1024 | |
| 1025 | 1025 | static void init_rockn_timer(running_machine *machine) |
| 1026 | 1026 | { |
| 1027 | mame_timer_pulse(MAME_TIME_IN_MSEC(32), 0, rockn_timer_level1_callback); | |
| 1028 | rockn_timer_l4 = mame_timer_alloc(rockn_timer_level4_callback); | |
| 1027 | timer_pulse(ATTOTIME_IN_MSEC(32), 0, rockn_timer_level1_callback); | |
| 1028 | rockn_timer_l4 = timer_alloc(rockn_timer_level4_callback); | |
| 1029 | 1029 | |
| 1030 | 1030 | state_save_register_global_array(tetrisp2_systemregs); |
| 1031 | 1031 | state_save_register_global_array(rocknms_sub_systemregs); |
| r1293 | r1294 | |
| 1056 | 1056 | { |
| 1057 | 1057 | init_rockn_timer(machine); |
| 1058 | 1058 | |
| 1059 | mame_timer_pulse(MAME_TIME_IN_MSEC(32), 0, rockn_timer_sub_level1_callback); | |
| 1060 | rockn_timer_sub_l4 = mame_timer_alloc(rockn_timer_sub_level4_callback); | |
| 1059 | timer_pulse(ATTOTIME_IN_MSEC(32), 0, rockn_timer_sub_level1_callback); | |
| 1060 | rockn_timer_sub_l4 = timer_alloc(rockn_timer_sub_level4_callback); | |
| 1061 | 1061 | |
| 1062 | 1062 | rockn_protectdata = 3; |
| 1063 | 1063 |
| r1293 | r1294 | |
|---|---|---|
| 57 | 57 | { |
| 58 | 58 | if (mask[i] != 0) |
| 59 | 59 | { |
| 60 | | |
| 60 | | |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| r1293 | r1294 | |
| 71 | 71 | scanline = 0; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | | |
| 74 | | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
| r1293 | r1294 | |
| 89 | 89 | |
| 90 | 90 | static MACHINE_RESET( boxer ) |
| 91 | 91 | { |
| 92 | | |
| 92 | | |
| 93 | 93 | |
| 94 | 94 | pot_latch = 0; |
| 95 | 95 | } |
| r1293 | r1294 | |
|---|---|---|
| 74 | 74 | scanline += SCANLINE_UPDATE_CHUNK; |
| 75 | 75 | if (scanline >= machine->screen[0].height) |
| 76 | 76 | scanline = 32; |
| 77 | | |
| 77 | | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | static MACHINE_RESET( starfire ) |
| 82 | 82 | { |
| 83 | | |
| 83 | | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 |
| r1293 | r1294 | |
|---|---|---|
| 1 | /* | |
| 1 | /* | |
| 2 | 2 | |
| 3 | ||
| 3 | -= Touch Master Games =- | |
| 4 | 4 | |
| 5 | Main CPU: 68000 | |
| 6 | Sound Chip: OKI6295 | |
| 5 | driver by Luca Elia (l.elia@tin.it) | |
| 7 | 6 | |
| 8 | Protection (some sets): DS1225a? | |
| 9 | 7 | |
| 10 | According to readme's TM3k might not be protected. | |
| 8 | CPU: 68000 | |
| 9 | Video: Blitter, double framebuffer | |
| 10 | Sound: OKI6295 | |
| 11 | Input: Pressure sensitive touch screen | |
| 12 | Other: Dallas NVRAM + optional RTC | |
| 11 | 13 | |
| 12 | GFX might be some kind of blitter device, with memory mapped framebuffer? | |
| 13 | 14 | |
| 14 | ||
| 15 | To Do: | |
| 15 | 16 | |
| 17 | - Proper touchscreen controller emulation. Currently it's flakey and | |
| 18 | tends to stop registering user input (try coining up in that case) | |
| 19 | - Protection in tm4k | |
| 20 | - Coin optics | |
| 21 | - RTC emulation (there's code to check the upper bytes of NVRAM to see if | |
| 22 | the real time clock is present, and to only use it in that case) | |
| 23 | ||
| 24 | ||
| 25 | ***************************************************************************/ | |
| 26 | ||
| 16 | 27 | #include "driver.h" |
| 17 | 28 | #include "sound/okim6295.h" |
| 18 | 29 | |
| 19 | static VIDEO_START( tmaster ) | |
| 30 | /*************************************************************************** | |
| 31 | ||
| 32 | Sound | |
| 33 | ||
| 34 | ***************************************************************************/ | |
| 35 | ||
| 36 | int okibank; | |
| 37 | static WRITE16_HANDLER( tmaster_oki_bank_w ) | |
| 20 | 38 | { |
| 39 | if (ACCESSING_MSB) | |
| 40 | { | |
| 41 | // data & 0x0800? | |
| 42 | okibank = ((data >> 8) & 3); | |
| 43 | OKIM6295_set_bank_base(0, okibank * 0x40000); | |
| 44 | } | |
| 45 | ||
| 46 | if (ACCESSING_LSB) | |
| 47 | { | |
| 48 | // data & 0x0002? | |
| 49 | } | |
| 21 | 50 | } |
| 22 | 51 | |
| 23 | static VIDEO_UPDATE( tmaster ) | |
| 52 | /*************************************************************************** | |
| 53 | ||
| 54 | Touch Screen Controller - PRELIMINARY | |
| 55 | ||
| 56 | ***************************************************************************/ | |
| 57 | ||
| 58 | int touchscreen; | |
| 59 | ||
| 60 | void show_touchscreen(void) | |
| 24 | 61 | { |
| 25 | return 0; | |
| 62 | #ifdef MAME_DEBUG | |
| 63 | popmessage("% d] %03x %03x - %d",touchscreen,readinputportbytag("TSCREEN_X")&0x1ff,readinputportbytag("TSCREEN_Y"),okibank); | |
| 64 | #endif | |
| 26 | 65 | } |
| 27 | 66 | |
| 28 | static RE | |
| 67 | static WRITE | |
| 29 | 68 | { |
| 30 | return mame_rand(Machine); | |
| 69 | if (ACCESSING_LSB && data == 0x05) | |
| 70 | { | |
| 71 | touchscreen = 0; | |
| 72 | show_touchscreen(); | |
| 73 | } | |
| 31 | 74 | } |
| 32 | 75 | |
| 33 | static | |
| 76 | static | |
| 34 | 77 | { |
| 78 | if (touchscreen != -1) | |
| 79 | touchscreen++; | |
| 80 | if (touchscreen == 6) | |
| 81 | touchscreen = -1; | |
| 82 | show_touchscreen(); | |
| 35 | 83 | |
| 84 | return 0; | |
| 36 | 85 | } |
| 37 | 86 | |
| 38 | static | |
| 87 | static | |
| 39 | 88 | { |
| 40 | ||
| 89 | switch (touchscreen) | |
| 90 | { | |
| 91 | case -1: return 0xf1; | |
| 92 | } | |
| 93 | return 0x01; | |
| 41 | 94 | } |
| 42 | 95 | |
| 43 | static | |
| 96 | static | |
| 44 | 97 | { |
| 98 | UINT16 val = 0; | |
| 45 | 99 | |
| 100 | int press1 = readinputportbytag("TSCREEN_X") & 0x4000; | |
| 101 | int press2 = readinputportbytag("TSCREEN_X") & 0x8000; | |
| 102 | if (press1) press2 = 1; | |
| 103 | ||
| 104 | switch (touchscreen) | |
| 105 | { | |
| 106 | case 1: val = press1 ? 0 : 1<<6; break; // press | |
| 107 | case 2: val = readinputportbytag("TSCREEN_X") & 0x003; break; | |
| 108 | case 3: val = (readinputportbytag("TSCREEN_X") >> 2) & 0x7f; break; | |
| 109 | case 4: val = 0; break; | |
| 110 | case 5: val = ((readinputportbytag("TSCREEN_Y")^0xff) >> 1) & 0x7f; break; | |
| 111 | ||
| 112 | default: | |
| 113 | return 0; | |
| 114 | } | |
| 115 | return val | (press2 ? 0x80 : 0); // away : hover | |
| 46 | 116 | } |
| 47 | 117 | |
| 48 | static WRITE16_HANDLER( tmaster_unk_0x500010_w ) | |
| 118 | static READ16_HANDLER( tmaster_tscreen_y_hi_r ) { return 0x01; } | |
| 119 | static READ16_HANDLER( tmaster_tscreen_y_lo_r ) { return 0x00; } | |
| 120 | ||
| 121 | ||
| 122 | ||
| 123 | /*************************************************************************** | |
| 124 | ||
| 125 | Video & Blitter | |
| 126 | ||
| 127 | ***************************************************************************/ | |
| 128 | ||
| 129 | static mame_bitmap *tmaster_bitmap[2]; | |
| 130 | UINT16 *tmaster_regs; | |
| 131 | UINT16 tmaster_color; | |
| 132 | UINT16 tmaster_addr; | |
| 133 | ||
| 134 | static VIDEO_START( tmaster ) | |
| 49 | 135 | { |
| 136 | int i; | |
| 137 | for (i = 0; i < 2; i++) | |
| 138 | tmaster_bitmap[i] = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format); | |
| 139 | } | |
| 50 | 140 | |
| 141 | static VIDEO_UPDATE( tmaster ) | |
| 142 | { | |
| 143 | // double buffering | |
| 144 | copybitmap(bitmap,tmaster_bitmap[(tmaster_regs[0x02/2]>>8)&1],0,0,0,0,&machine->screen[0].visarea,TRANSPARENCY_NONE,0); | |
| 145 | ||
| 146 | show_touchscreen(); | |
| 147 | return 0; | |
| 51 | 148 | } |
| 52 | 149 | |
| 53 | static WRITE16_HANDLER( tmaster_ | |
| 150 | static WRITE16_HANDLER( tmaster_color | |
| 54 | 151 | { |
| 152 | COMBINE_DATA( &tmaster_color ); | |
| 153 | if (tmaster_color & ~7) | |
| 154 | logerror("%06x: color %04x\n", activecpu_get_pc(), tmaster_color); | |
| 155 | } | |
| 55 | 156 | |
| 157 | static WRITE16_HANDLER( tmaster_addr_w ) | |
| 158 | { | |
| 159 | COMBINE_DATA( &tmaster_addr ); | |
| 56 | 160 | } |
| 57 | 161 | |
| 58 | static | |
| 162 | static void | |
| 59 | 163 | { |
| 164 | int x,y,x0,x1,y0,y1,dx,dy,flipx,flipy,sx,sy,sw,sh, addr, mode, dest; | |
| 60 | 165 | |
| 166 | UINT8 *gfxdata = memory_region( REGION_GFX1 ); | |
| 167 | size_t size = memory_region_length( REGION_GFX1 ); | |
| 168 | ||
| 169 | UINT16 data; | |
| 170 | ||
| 171 | mame_bitmap *bitmap; | |
| 172 | ||
| 173 | dest = (tmaster_regs[0x02/2] >> 8) & 1; | |
| 174 | sw = tmaster_regs[0x04/2]; | |
| 175 | sx = tmaster_regs[0x06/2]; | |
| 176 | sh = tmaster_regs[0x08/2] + 1; | |
| 177 | sy = tmaster_regs[0x0a/2]; | |
| 178 | addr = ( tmaster_regs[0x0c/2] & 0xff) | | |
| 179 | ((tmaster_regs[0x0e/2] & 0x1ff) << 8) | (tmaster_addr << 17); | |
| 180 | mode = tmaster_regs[0x10/2]; | |
| 181 | ||
| 182 | dest ^= (mode >> 6) & 1; | |
| 183 | bitmap = tmaster_bitmap[dest]; | |
| 184 | ||
| 185 | addr <<= 1; | |
| 186 | ||
| 187 | #if 0 | |
| 188 | logerror("%06x: blit w %03x, h %02x, x %03x, y %02x, addr %06x, mode %02x\n", activecpu_get_pc(), | |
| 189 | sw,sh,sx,sy, addr, mode | |
| 190 | ); | |
| 191 | #endif | |
| 192 | ||
| 193 | flipx = mode & 1; | |
| 194 | flipy = mode & 2; | |
| 195 | ||
| 196 | if (flipx) { x0 = sw-1; x1 = -1; dx = -1; sx -= sw-1; } | |
| 197 | else { x0 = 0; x1 = sw; dx = +1; } | |
| 198 | ||
| 199 | if (flipy) { y0 = sh-1; y1 = -1; dy = -1; sy -= sh-1; } | |
| 200 | else { y0 = 0; y1 = sh; dy = +1; } | |
| 201 | ||
| 202 | switch (mode & 0x20) | |
| 203 | { | |
| 204 | case 0x00: // blit with transparency | |
| 205 | if (addr > (size - sw*sh)) | |
| 206 | { | |
| 207 | logerror("%06x: blit error, addr %06x out of bounds\n", activecpu_get_pc(),addr); | |
| 208 | return; | |
| 209 | } | |
| 210 | ||
| 211 | for (y = y0; y != y1; y += dy) | |
| 212 | { | |
| 213 | for (x = x0; x != x1; x += dx) | |
| 214 | { | |
| 215 | data = gfxdata[addr++]; | |
| 216 | ||
| 217 | if ((data != 0xff) && (sx + x >= 0) && (sx + x < 400) && (sy + y >= 0) && (sy + y < 256)) | |
| 218 | *BITMAP_ADDR16(bitmap, sy + y, sx + x) = data + ((tmaster_color & 7) << 8); | |
| 219 | } | |
| 220 | } | |
| 221 | break; | |
| 222 | ||
| 223 | case 0x20: // solid fill | |
| 224 | data = tmaster_addr & 0xff; | |
| 225 | for (y = y0; y != y1; y += dy) | |
| 226 | { | |
| 227 | for (x = x0; x != x1; x += dx) | |
| 228 | { | |
| 229 | if ((sx + x >= 0) && (sx + x < 400) && (sy + y >= 0) && (sy + y < 256)) | |
| 230 | *BITMAP_ADDR16(bitmap, sy + y, sx + x) = data + ((tmaster_color & 7) << 8); | |
| 231 | } | |
| 232 | } | |
| 233 | break; | |
| 234 | ||
| 235 | } | |
| 61 | 236 | } |
| 62 | 237 | |
| 63 | ||
| 238 | ||
| 64 | 239 | { |
| 240 | COMBINE_DATA( tmaster_regs + offset ); | |
| 241 | switch (offset*2) | |
| 242 | { | |
| 243 | case 0x0e: | |
| 244 | tmaster_draw(); | |
| 245 | cpunum_set_input_line(0, 2, HOLD_LINE); | |
| 246 | break; | |
| 247 | } | |
| 248 | } | |
| 65 | 249 | |
| 250 | static READ16_HANDLER( tmaster_blitter_r ) | |
| 251 | { | |
| 252 | return 0x0000; // bit 7 = 1 -> blitter busy | |
| 66 | 253 | } |
| 67 | 254 | |
| 68 | static READ16_HANDLER( tmaster_unk_0x500010_r ) | |
| 255 | /*************************************************************************** | |
| 256 | ||
| 257 | Memory Maps | |
| 258 | ||
| 259 | ***************************************************************************/ | |
| 260 | ||
| 261 | static READ16_HANDLER( tmaster_coins_r ) | |
| 69 | 262 | { |
| 70 | return mame_rand(Machine); | |
| 263 | return readinputportbytag("COIN")|(mame_rand(Machine)&0x0800); | |
| 71 | 264 | } |
| 72 | 265 | |
| 73 | static ADDRESS_MAP_START( tmaster_readmem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 74 | AM_RANGE(0x000000, 0x1fffff) AM_READ(MRA16_ROM) | |
| 75 | AM_RANGE(0x200000, 0x27ffff) AM_READ(MRA16_RAM) | |
| 266 | static ADDRESS_MAP_START( tmaster_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 267 | AM_RANGE( 0x000000, 0x1fffff ) AM_ROM | |
| 268 | AM_RANGE( 0x200000, 0x27ffff ) AM_RAM | |
| 269 | AM_RANGE( 0x280000, 0x28ffff ) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size) | |
| 76 | 270 | |
| 77 | AM_RANGE(0x300010, 0x300011) AM_READ(tmaster_ | |
| 271 | AM_RANGE( 0x300010, 0x300011 ) AM_READ( tmaster_coins_ | |
| 78 | 272 | |
| 79 | AM_RANGE(0x500010, 0x500011) AM_READ(tmaster_unk_0x500010_r) | |
| 273 | AM_RANGE( 0x300022, 0x300023 ) AM_READ ( tmaster_tscreen_x_hi_r ) | |
| 274 | AM_RANGE( 0x300024, 0x300025 ) AM_WRITE( tmaster_tscreen_reset_w ) | |
| 275 | AM_RANGE( 0x300026, 0x300027 ) AM_READ ( tmaster_tscreen_x_lo_r ) | |
| 276 | AM_RANGE( 0x300028, 0x300029 ) AM_READ ( tmaster_tscreen_next_r ) | |
| 277 | AM_RANGE( 0x300032, 0x300033 ) AM_READ ( tmaster_tscreen_y_hi_r ) | |
| 278 | AM_RANGE( 0x300036, 0x300037 ) AM_READ ( tmaster_tscreen_y_lo_r ) | |
| 80 | 279 | |
| 81 | AM_RANGE(0x | |
| 280 | AM_RANGE( 0x300040 | |
| 82 | 281 | |
| 83 | A | |
| 282 | AM_RANGE( 0x300070, 0x300071 ) AM_WRITE( tmaster_addr_w ) | |
| 84 | 283 | |
| 85 | static ADDRESS_MAP_START( tmaster_writemem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 86 | AM_RANGE(0x000000, 0x1fffff) AM_WRITE(MWA16_ROM) | |
| 87 | AM_RANGE(0x200000, 0x27ffff) AM_WRITE(MWA16_RAM) | |
| 284 | AM_RANGE( 0x500000, 0x500011 ) AM_WRITE( tmaster_blitter_w ) AM_BASE( &tmaster_regs ) | |
| 285 | AM_RANGE( 0x500010, 0x500011 ) AM_READ ( tmaster_blitter_r ) | |
| 88 | 286 | |
| 89 | AM_RANGE(0x300020, 0x300021) AM_WRITE(tmaster_unk_0x300020_w) | |
| 90 | AM_RANGE(0x300040, 0x300041) AM_WRITE(tmaster_unk_0x300040_w) | |
| 91 | AM_RANGE(0x300070, 0x300071) AM_WRITE(tmaster_unk_0x300070_w) | |
| 287 | AM_RANGE( 0x580000, 0x580001 ) AM_WRITE(MWA16_NOP) // often | |
| 92 | 288 | |
| 93 | /* blitter writes? */ | |
| 94 | AM_RANGE(0x500000, 0x50000f) AM_WRITE(tmaster_unk_0x500000_range_w) | |
| 95 | AM_RANGE(0x500010, 0x500011) AM_WRITE(tmaster_unk_0x500010_w) | |
| 96 | AM_RANGE(0x500020, 0x500021) AM_WRITE(tmaster_unk_0x500020_w) | |
| 289 | AM_RANGE( 0x600000, 0x600fff ) AM_READWRITE( MRA16_RAM, paletteram16_xBBBBBGGGGGRRRRR_word_w ) AM_BASE(&paletteram16) // looks like palettes, maybe | |
| 97 | 290 | |
| 98 | AM_RANGE(0x | |
| 291 | AM_RANGE( 0x | |
| 99 | 292 | |
| 100 | AM_RANGE(0x600000, 0x600fff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16) // looks like palettes, maybe | |
| 101 | ||
| 102 | AM_RANGE(0x800010, 0x800011) AM_WRITE(tmaster_unk_0x800010_w) | |
| 293 | AM_RANGE( 0x800010, 0x800011 ) AM_WRITE( tmaster_color_w ) | |
| 103 | 294 | ADDRESS_MAP_END |
| 104 | 295 | |
| 105 | 296 | |
| 297 | /*************************************************************************** | |
| 106 | 298 | |
| 107 | static INPUT_PORTS_START( tmaster ) | |
| 108 | PORT_START | |
| 109 | PORT_DIPNAME( 0x0001, 0x0001, "DSW" ) | |
| 110 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 111 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 112 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) | |
| 113 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 114 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 115 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) | |
| 116 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 117 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 118 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) | |
| 119 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 120 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 121 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) | |
| 122 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) | |
| 123 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 124 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) | |
| 125 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) | |
| 126 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 127 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) | |
| 128 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 129 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 130 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) | |
| 131 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 132 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 133 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) | |
| 134 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) | |
| 135 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 136 | PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) | |
| 137 | PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) | |
| 138 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 139 | PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) | |
| 140 | PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) | |
| 141 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 142 | PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) | |
| 143 | PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) | |
| 144 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 145 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) | |
| 146 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) | |
| 147 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 148 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) | |
| 149 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) | |
| 150 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 151 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) | |
| 152 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 153 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 154 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) | |
| 155 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 156 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 299 | Input Ports | |
| 300 | ||
| 301 | ***************************************************************************/ | |
| 302 | ||
| 303 | INPUT_PORTS_START( tmaster ) | |
| 304 | PORT_START_TAG("TSCREEN_X") | |
| 305 | PORT_BIT( 0x01ff, 0x100, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1, 0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(3) PORT_PLAYER(1) | |
| 306 | PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_IMPULSE(5) // press | |
| 307 | PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) // hover | |
| 308 | ||
| 309 | PORT_START_TAG("TSCREEN_Y") | |
| 310 | PORT_BIT( 0x0ff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1, 0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(3) PORT_PLAYER(1) | |
| 311 | ||
| 312 | PORT_START_TAG("COIN") // IN3 | |
| 313 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) // m. coin 1 (coin optics?) | |
| 314 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(4) // m. coin 2 (coin optics?) | |
| 315 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(6) // dbv input (coin optics?) | |
| 316 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 317 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_COIN1 ) // (service coin?) | |
| 318 | PORT_SERVICE_NO_TOGGLE( 0x0020, IP_ACTIVE_LOW ) | |
| 319 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 ) // calibrate | |
| 320 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 321 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 322 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 323 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 324 | PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) | |
| 325 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_COIN1 ) // e. coin 1 | |
| 326 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_COIN2 ) // e. coin 2 | |
| 327 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN3 ) // e. coin 3 | |
| 328 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN4 ) // e. coin 4 | |
| 157 | 329 | INPUT_PORTS_END |
| 158 | 330 | |
| 159 | 331 | |
| 160 | /* Gfx are not tile based...*/ | |
| 161 | static const gfx_layout tmaster_layout = | |
| 162 | { | |
| 163 | 8,8, | |
| 164 | RGN_FRAC(1,1), | |
| 165 | 4, | |
| 166 | { 0,1,2,3 }, | |
| 167 | { 0,4,8,12,16,20,24,28 }, | |
| 168 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, | |
| 169 | 8*32 | |
| 170 | }; | |
| 332 | /*************************************************************************** | |
| 171 | 333 | |
| 172 | static GFXDECODE_START( tmaster ) | |
| 173 | GFXDECODE_ENTRY( REGION_GFX1, 0, tmaster_layout, 0x300, 2 ) | |
| 174 | GFXDECODE_ENTRY( REGION_GFX2, 0, tmaster_layout, 0x300, 2 ) | |
| 175 | GFXDECODE_ENTRY( REGION_GFX3, 0, tmaster_layout, 0x300, 2 ) | |
| 176 | GFXDECODE_END | |
| 334 | Machine Drivers | |
| 177 | 335 | |
| 178 | static INTERRUPT_GEN( tmaster_interrupt ) | |
| 336 | ***************************************************************************/ | |
| 337 | ||
| 338 | static MACHINE_RESET( tmaster ) | |
| 179 | 339 | { |
| 180 | | |
| 340 | | |
| 181 | 341 | } |
| 182 | 342 | |
| 183 | static MACHINE_DRIVER_START( tmaster ) | |
| 184 | MDRV_CPU_ADD_TAG("main", M68000, 12000000) // or 6mhz? | |
| 185 | MDRV_CPU_PROGRAM_MAP(tmaster_readmem,tmaster_writemem) | |
| 186 | MDRV_CPU_VBLANK_INT(tmaster_interrupt,3) // ?? | |
| 187 | /* irqs 1,2,3 look valid */ | |
| 343 | static INTERRUPT_GEN( tm3k_interrupt ) | |
| 344 | { | |
| 345 | switch (cpu_getiloops()) | |
| 346 | { | |
| 347 | case 0: cpunum_set_input_line(0, 2, HOLD_LINE); break; | |
| 348 | case 1: cpunum_set_input_line(0, 3, HOLD_LINE); break; | |
| 188 | 349 | |
| 350 | case 2: | |
| 351 | case 3: | |
| 352 | case 4: | |
| 353 | case 5: | |
| 354 | case 6: cpunum_set_input_line_and_vector(0, 4, HOLD_LINE, 0x100/4); break; // touch screen controller | |
| 355 | ||
| 356 | default: cpunum_set_input_line(0, 1, HOLD_LINE); break; | |
| 357 | } | |
| 358 | } | |
| 359 | ||
| 360 | static MACHINE_DRIVER_START( tm3k ) | |
| 361 | MDRV_CPU_ADD_TAG("main", M68000, 12000000) | |
| 362 | MDRV_CPU_PROGRAM_MAP(tmaster_map,0) | |
| 363 | MDRV_CPU_VBLANK_INT(tm3k_interrupt,2+5+20) // ?? | |
| 364 | ||
| 189 | 365 | MDRV_SCREEN_REFRESH_RATE(60) |
| 190 | 366 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| 191 | 367 | |
| 192 | MDRV_GFXDECODE(tmaster) | |
| 368 | MDRV_MACHINE_RESET(tmaster) | |
| 369 | MDRV_NVRAM_HANDLER(generic_0fill) | |
| 193 | 370 | |
| 194 | 371 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 195 | 372 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 196 | MDRV_SCREEN_SIZE(64*8, 32*8) | |
| 197 | MDRV_SCREEN_VISIBLE_AREA(8*8, 48*8-1, 2*8, 30*8-1) | |
| 373 | MDRV_SCREEN_SIZE(400, 256) | |
| 374 | MDRV_SCREEN_VISIBLE_AREA(0, 400-1, 0, 256-1) | |
| 198 | 375 | MDRV_PALETTE_LENGTH(0x800) |
| 199 | 376 | |
| 200 | 377 | MDRV_VIDEO_START(tmaster) |
| 201 | 378 | MDRV_VIDEO_UPDATE(tmaster) |
| 202 | 379 | |
| 203 | MDRV_SPEAKER_STANDARD_ | |
| 380 | MDRV_SPEAKER_STANDARD_M | |
| 204 | 381 | |
| 205 | MDRV_SOUND_ADD(OKIM6295, | |
| 382 | MDRV_SOUND_ADD_TAG("OKI",OKIM6295, | |
| 206 | 383 | MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified |
| 207 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.47) | |
| 208 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.47) | |
| 384 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 209 | 385 | MACHINE_DRIVER_END |
| 210 | 386 | |
| 211 | /* | |
| 387 | ||
| 388 | static INTERRUPT_GEN( tm_interrupt ) | |
| 389 | { | |
| 390 | switch (cpu_getiloops()) | |
| 391 | { | |
| 392 | case 0: cpunum_set_input_line(0, 2, HOLD_LINE); break; | |
| 393 | case 1: cpunum_set_input_line(0, 3, HOLD_LINE); break; | |
| 394 | case 2: cpunum_set_input_line_and_vector(0, 4, HOLD_LINE, 0x100/4); break; // touch screen controller | |
| 395 | default: cpunum_set_input_line(0, 1, HOLD_LINE); break; | |
| 396 | } | |
| 397 | } | |
| 398 | ||
| 399 | static MACHINE_DRIVER_START( tm ) | |
| 400 | MDRV_IMPORT_FROM(tm3k) | |
| 401 | MDRV_CPU_MODIFY("main") | |
| 402 | MDRV_CPU_VBLANK_INT(tm_interrupt,3+20) // ?? | |
| 403 | ||
| 404 | MDRV_SOUND_REPLACE("OKI",OKIM6295, 1122000) | |
| 405 | MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified | |
| 406 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 407 | MACHINE_DRIVER_END | |
| 408 | ||
| 409 | ||
| 410 | /*************************************************************************** | |
| 411 | ||
| 412 | ROMs Loading | |
| 413 | ||
| 414 | ***************************************************************************/ | |
| 415 | ||
| 416 | /*************************************************************************** | |
| 417 | ||
| 212 | 418 | Touch Master |
| 213 | 419 | 1996, Midway |
| 214 | 420 | |
| r1293 | r1294 | |
| 222 | 428 | Xlinx XC3042a |
| 223 | 429 | |
| 224 | 430 | Dumped by ANY |
| 225 | */ | |
| 226 | 431 | |
| 432 | ***************************************************************************/ | |
| 433 | ||
| 227 | 434 | ROM_START( tm ) |
| 228 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* 68000 Code */ | |
| 435 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) // 68000 Code | |
| 436 | ROM_LOAD16_BYTE( "tmaster.u51", 0x000000, 0x080000, CRC(edaa5874) SHA1(48b99bc7f5a6453def265967ca7d8eefdf9dc97b) ) | |
| 229 | 437 | ROM_LOAD16_BYTE( "tmaster.u52", 0x000001, 0x080000, CRC(e9fd30fc) SHA1(d91ea05d5f574603883336729fb9df705688945d) ) |
| 230 | ROM_LOAD16_BYTE( "tmaster.u51", 0x000000, 0x080000, CRC(edaa5874) SHA1(48b99bc7f5a6453def265967ca7d8eefdf9dc97b) ) | |
| 231 | 438 | |
| 232 | ROM_REGION( 0x100000, REGION_SOUND1, 0 ) /* Samples */ | |
| 233 | ROM_LOAD( "tmaster.u8", 0x00000, 0x080000, CRC(f39ad4cf) SHA1(9bcb9a5dd3636d6541eeb3e737c7253ab0ed4e8d) ) | |
| 439 | ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_ERASE ) // Blitter gfx | |
| 440 | ROM_LOAD16_BYTE( "tmaster.u38", 0x100000, 0x080000, CRC(68885ef6) SHA1(010602b59c33c3e490491a296ddaf8952e315b83) ) | |
| 441 | ROM_LOAD16_BYTE( "tmaster.u36", 0x100001, 0x080000, CRC(204096ec) SHA1(9239923b7eedb6003c63ef2e8ff224edee657bbc) ) | |
| 442 | // unused gap | |
| 443 | ROM_LOAD16_BYTE( "tmaster.u39", 0x300000, 0x080000, CRC(cbb716cb) SHA1(4e8d8f6cbfb25a8161ff8fe7505d6b209650dd2b) ) | |
| 444 | ROM_LOAD16_BYTE( "tmaster.u37", 0x300001, 0x080000, CRC(e0b6a9f7) SHA1(7e057ca87833c682e5be03668469259bbdefbf20) ) | |
| 234 | 445 | |
| 235 | ROM_REGION( 0x200000, REGION_GFX1, 0 ) | |
| 236 | ROM_LOAD16_BYTE( "tmaster.u36", 0x000000, 0x080000, CRC(204096ec) SHA1(9239923b7eedb6003c63ef2e8ff224edee657bbc) ) | |
| 237 | ROM_LOAD16_BYTE( "tmaster.u38", 0x000001, 0x080000, CRC(68885ef6) SHA1(010602b59c33c3e490491a296ddaf8952e315b83) ) | |
| 446 | ROM_REGION( 0x100000, REGION_SOUND1, 0 ) // Samples | |
| 447 | ROM_LOAD( "tmaster.u8", 0x40000, 0x040000, CRC(f39ad4cf) SHA1(9bcb9a5dd3636d6541eeb3e737c7253ab0ed4e8d) ) | |
| 448 | ROM_CONTINUE( 0xc0000, 0x040000 ) | |
| 449 | ROM_END | |
| 238 | 450 | |
| 239 | ROM_REGION( 0x200000, REGION_GFX2, 0 ) | |
| 240 | ROM_LOAD16_BYTE( "tmaster.u37", 0x000000, 0x080000, CRC(e0b6a9f7) SHA1(7e057ca87833c682e5be03668469259bbdefbf20) ) | |
| 241 | ROM_LOAD16_BYTE( "tmaster.u39", 0x000001, 0x080000, CRC(cbb716cb) SHA1(4e8d8f6cbfb25a8161ff8fe7505d6b209650dd2b) ) | |
| 451 | /*************************************************************************** | |
| 242 | 452 | |
| 243 | ROM_REGION( 0x200000, REGION_GFX3, ROMREGION_ERASEFF ) | |
| 244 | ROM_END | |
| 245 | ||
| 246 | /* | |
| 247 | 453 | Touchmaster 3000 |
| 248 | 454 | by Midway |
| 249 | 455 | touchscreen game |
| r1293 | r1294 | |
| 267 | 473 | J12 (NOT INCLUDED) N/A Security Key(not required for this Version) |
| 268 | 474 | ----------------------------------------------------------------------------------- |
| 269 | 475 | |
| 476 | SCN68681c1n40 | |
| 477 | xc3042A www.xilinx.com | |
| 270 | 478 | |
| 271 | The TOUCHMASTER 3000 is a bar top game, with many different kinds of games in it | |
| 272 | including strip poker and Adult content (cool!). It does use a touchscreen but | |
| 273 | I'm sure a EMU can make this Transition to a mouse pointer. | |
| 479 | ***************************************************************************/ | |
| 274 | 480 | |
| 275 | CPU- SCN68681c1n40 | |
| 276 | sound processor-xc3042A www.xilinx.com | |
| 277 | */ | |
| 278 | ||
| 279 | 481 | ROM_START( tm3k ) |
| 280 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) / | |
| 482 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) // 68000 Code | |
| 281 | 483 | ROM_LOAD16_BYTE( "tm3k_u52.bin", 0x000001, 0x100000, CRC(8c6a0db7) SHA1(6b0eae60ea471cd8c4001749ac2677d8d4532567) ) |
| 282 | 484 | ROM_LOAD16_BYTE( "tm3k_u51.bin", 0x000000, 0x100000, CRC(c9522279) SHA1(e613b791f831271722f05b7e96c35519fa9fc174) ) |
| 283 | 485 | |
| 284 | ROM_REGION( 0x100000, REGION_SOUND1, 0 ) /* Samples */ | |
| 486 | ROM_REGION( 0x600000, REGION_GFX1, 0 ) // Blitter gfx | |
| 487 | ROM_LOAD16_BYTE( "tm3k_u38.bin", 0x000000, 0x100000, CRC(a6683899) SHA1(d05024390917cdb1871d030996da8e1eb6460918) ) | |
| 488 | ROM_LOAD16_BYTE( "tm3k_u36.bin", 0x000001, 0x100000, CRC(7bde520d) SHA1(77750b689e2f0d47804042456e54bbd9c28deeac) ) | |
| 489 | ROM_LOAD16_BYTE( "tm3k_u39.bin", 0x200000, 0x100000, CRC(206b56a6) SHA1(09e5e05bffd0a09abd24d668e2c59b56f2c79134) ) | |
| 490 | ROM_LOAD16_BYTE( "tm3k_u37.bin", 0x200001, 0x100000, CRC(18f50eb3) SHA1(a7c9d3b24b5fd110380ec87d9200d55cad473efc) ) | |
| 491 | ROM_LOAD16_BYTE( "tm3k_u41.bin", 0x400000, 0x100000, BAD_DUMP CRC(74a36bca) SHA1(7ad594daa156dea40a25b390f26c2fd0550e66ff) ) | |
| 492 | ROM_LOAD16_BYTE( "tm3k_u40.bin", 0x400001, 0x100000, CRC(353df7ca) SHA1(d6c5d5449af6b6a3acee219778583904c5b554b4) ) | |
| 493 | ||
| 494 | ROM_REGION( 0x100000, REGION_SOUND1, 0 ) // Samples | |
| 285 | 495 | ROM_LOAD( "tm3k_u8.bin", 0x00000, 0x100000, CRC(d0ae33c1) SHA1(a079def9a086a091fcc4493a44fec756d2470415) ) |
| 496 | ROM_END | |
| 286 | 497 | |
| 287 | ROM_REGION( 0x200000, REGION_GFX1, 0 ) | |
| 288 | ROM_LOAD16_BYTE( "tm3k_u36.bin", 0x000000, 0x100000, CRC(7bde520d) SHA1(77750b689e2f0d47804042456e54bbd9c28deeac) ) | |
| 289 | ROM_LOAD16_BYTE( "tm3k_u38.bin", 0x000001, 0x100000, CRC(a6683899) SHA1(d05024390917cdb1871d030996da8e1eb6460918) ) | |
| 498 | /*************************************************************************** | |
| 290 | 499 | |
| 291 | ROM_REGION( 0x200000, REGION_GFX2, 0 ) | |
| 292 | ROM_LOAD16_BYTE( "tm3k_u37.bin", 0x000000, 0x100000, CRC(18f50eb3) SHA1(a7c9d3b24b5fd110380ec87d9200d55cad473efc) ) | |
| 293 | ROM_LOAD16_BYTE( "tm3k_u39.bin", 0x000001, 0x100000, CRC(206b56a6) SHA1(09e5e05bffd0a09abd24d668e2c59b56f2c79134) ) | |
| 294 | ||
| 295 | ROM_REGION( 0x200000, REGION_GFX3, 0 ) | |
| 296 | ROM_LOAD16_BYTE( "tm3k_u40.bin", 0x000000, 0x100000, CRC(353df7ca) SHA1(d6c5d5449af6b6a3acee219778583904c5b554b4) ) | |
| 297 | ROM_LOAD16_BYTE( "tm3k_u41.bin", 0x000001, 0x100000, CRC(74a36bca) SHA1(7ad594daa156dea40a25b390f26c2fd0550e66ff) ) | |
| 298 | ROM_END | |
| 299 | ||
| 300 | /* | |
| 301 | 500 | Touchmaster 4000 |
| 302 | 501 | by Midway |
| 303 | 502 | touchscreen game |
| r1293 | r1294 | |
| 321 | 520 | J12 (NOT INCLUDED) N/A Security Key(required for this Version) |
| 322 | 521 | ----------------------------------------------------------------------------------- |
| 323 | 522 | |
| 523 | SCN68681c1n40 | |
| 524 | xc3042A www.xilinx.com | |
| 324 | 525 | |
| 325 | The TOUCHMASTER 4000 is a bar top game, with many different kinds of games in it | |
| 326 | including strip poker and Adult content (cool!). It does use a touchscreen but | |
| 327 | I'm sure a EMU can make this Transition to a mouse pointer. | |
| 526 | ***************************************************************************/ | |
| 328 | 527 | |
| 329 | CPU- SCN68681c1n40 | |
| 330 | sound processor-xc3042A www.xilinx.com | |
| 331 | */ | |
| 332 | ||
| 333 | 528 | ROM_START( tm4k ) |
| 334 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* 68000 Code */ | |
| 529 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) // 68000 Code | |
| 530 | ROM_LOAD16_BYTE( "tm4k_u51.bin", 0x000000, 0x100000, CRC(3d8d7848) SHA1(31638f23cdd5e6cfbb2270e953f84fe1bd437950) ) | |
| 335 | 531 | ROM_LOAD16_BYTE( "tm4k_u52.bin", 0x000001, 0x100000, CRC(6d412871) SHA1(ae27c7723b292daf6682c53bafac22e4a3cd1ece) ) |
| 336 | ROM_LOAD16_BYTE( "tm4k_u51.bin", 0x000000, 0x100000, CRC(3d8d7848) SHA1(31638f23cdd5e6cfbb2270e953f84fe1bd437950) ) | |
| 337 | 532 | |
| 338 | ROM_REGION( 0x100000, REGION_SOUND1, 0 ) /* Samples */ | |
| 533 | ROM_REGION( 0x600000, REGION_GFX1, 0 ) // Blitter gfx | |
| 534 | ROM_LOAD16_BYTE( "tm4k_u38.bin", 0x000000, 0x100000, CRC(a6683899) SHA1(d05024390917cdb1871d030996da8e1eb6460918) ) | |
| 535 | ROM_LOAD16_BYTE( "tm4k_u36.bin", 0x000001, 0x100000, CRC(7bde520d) SHA1(77750b689e2f0d47804042456e54bbd9c28deeac) ) | |
| 536 | ROM_LOAD16_BYTE( "tm4k_u39.bin", 0x200000, 0x100000, CRC(bac88cfb) SHA1(26ed169296b890c5f5b50c418c15299355a6592f) ) | |
| 537 | ROM_LOAD16_BYTE( "tm4k_u37.bin", 0x200001, 0x100000, CRC(bf49fafa) SHA1(b400667bf654dc9cd01a85c8b99670459400fd60) ) | |
| 538 | ROM_LOAD16_BYTE( "tm4k_u41.bin", 0x400000, 0x100000, CRC(e97edb1e) SHA1(75510676cf1692ad03efd4ccd57d25af1cc8ef2a) ) | |
| 539 | ROM_LOAD16_BYTE( "tm4k_u40.bin", 0x400001, 0x100000, CRC(f6771a09) SHA1(74f71d5e910006c83a38170f24aa811c38a3e020) ) | |
| 540 | ||
| 541 | ROM_REGION( 0x100000, REGION_SOUND1, 0 ) // Samples | |
| 339 | 542 | ROM_LOAD( "tm4k_u8.bin", 0x00000, 0x100000, CRC(48c3782b) SHA1(bfe105ddbde8bbbd84665dfdd565d6d41926834a) ) |
| 543 | ROM_END | |
| 340 | 544 | |
| 341 | ROM_REGION( 0x200000, REGION_GFX1, 0 ) /* these match tm3k */ | |
| 342 | ROM_LOAD16_BYTE( "tm4k_u36.bin", 0x000000, 0x100000, CRC(7bde520d) SHA1(77750b689e2f0d47804042456e54bbd9c28deeac) ) | |
| 343 | ROM_LOAD16_BYTE( "tm4k_u38.bin", 0x000001, 0x100000, CRC(a6683899) SHA1(d05024390917cdb1871d030996da8e1eb6460918) ) | |
| 545 | static DRIVER_INIT( tm3k ) | |
| 546 | { | |
| 547 | // try this if you need to calibrate | |
| 548 | #if 0 | |
| 549 | UINT16 *ROM = (UINT16 *)memory_region( REGION_CPU1 ); | |
| 550 | // tscreen test | |
| 551 | ROM[0x75e3c/2] = 0x4ef9; | |
| 552 | ROM[0x75e3e/2] = 0x0007; | |
| 553 | ROM[0x75e40/2] = 0x5e4a; | |
| 344 | 554 | |
| 345 | ROM_REGION( 0x200000, REGION_GFX2, 0 ) | |
| 346 | ROM_LOAD16_BYTE( "tm4k_u37.bin", 0x000000, 0x100000, CRC(bf49fafa) SHA1(b400667bf654dc9cd01a85c8b99670459400fd60) ) | |
| 347 | ROM_LOAD16_BYTE( "tm4k_u39.bin", 0x000001, 0x100000, CRC(bac88cfb) SHA1(26ed169296b890c5f5b50c418c15299355a6592f) ) | |
| 555 | // tscreen test | |
| 556 | ROM[0x765ca/2] = 0x7001; | |
| 557 | #endif | |
| 558 | } | |
| 348 | 559 | |
| 349 | ROM_REGION( 0x200000, REGION_GFX3, 0 ) | |
| 350 | ROM_LOAD16_BYTE( "tm4k_u40.bin", 0x000000, 0x100000, CRC(f6771a09) SHA1(74f71d5e910006c83a38170f24aa811c38a3e020) ) | |
| 351 | ROM_LOAD16_BYTE( "tm4k_u41.bin", 0x000001, 0x100000, CRC(e97edb1e) SHA1(75510676cf1692ad03efd4ccd57d25af1cc8ef2a) ) | |
| 352 | ROM_END | |
| 560 | static DRIVER_INIT( tm4k ) | |
| 561 | { | |
| 562 | UINT16 *ROM = (UINT16 *)memory_region( REGION_CPU1 ); | |
| 353 | 563 | |
| 354 | GAME( 1996, tm, 0, tmaster, tmaster, 0, ROT0, "Midway", "Touchmaster", GAME_NOT_WORKING ) | |
| 355 | GAME( 1997, tm3k, 0, tmaster, tmaster, 0, ROT0, "Midway", "Touchmaster 3000 (v5.01)", GAME_NOT_WORKING ) | |
| 356 | GAME( 1998, tm4k, 0, tmaster, tmaster, 0, ROT0, "Midway", "Touchmaster 4000 (v6.02)", GAME_NOT_WORKING ) | |
| 564 | // protection | |
| 565 | ROM[0x83476/2] = 0x4e75; | |
| 566 | ||
| 567 | ROM[0x8342C/2] = 0x601a; | |
| 568 | ROM[0x8346C/2] = 0x6002; | |
| 569 | } | |
| 570 | ||
| 571 | GAME( 1996, tm, 0, tm, tmaster, 0, ROT0, "Midway", "Touchmaster", GAME_NOT_WORKING ) | |
| 572 | GAME( 1997, tm3k, 0, tm3k, tmaster, tm3k, ROT0, "Midway", "Touchmaster 3000 (v5.01)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS) | |
| 573 | GAME( 1998, tm4k, 0, tm3k, tmaster, tm4k, ROT0, "Midway", "Touchmaster 4000 (v6.02)", GAME_NOT_WORKING ) |
| r1293 | r1294 | |
|---|---|---|
| 523 | 523 | |
| 524 | 524 | Within $20 vblanks the motor must reach the target. */ |
| 525 | 525 | |
| 526 | ||
| 526 | ||
| 527 | 527 | { |
| 528 | 528 | COMBINE_DATA( &scudhamm_motor_command ); |
| 529 | 529 | } |
| r1293 | r1294 | |
| 534 | 534 | return readinputport(1); |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | ||
| 538 | 537 | /* |
| 539 | 538 | I don't know how many leds are there, but each bit in the buttons input |
| 540 | 539 | port (coins, tilt, buttons, select etc.) triggers the corresponding bit |
| r1293 | r1294 | |
| 1723 | 1722 | |
| 1724 | 1723 | /* CPU # 1 */ |
| 1725 | 1724 | #define CISCHEAT_INTERRUPT_NUM 3 |
| 1726 | INTERRUPT_GEN( cischeat_interrupt ) | |
| 1725 | static INTERRUPT_GEN( cischeat_interrupt ) | |
| 1727 | 1726 | { |
| 1728 | 1727 | if (cpu_getiloops()==0) |
| 1729 | 1728 | cpunum_set_input_line(0, 4, HOLD_LINE); /* Once */ |
| r1293 | r1294 | |
| 1877 | 1876 | 4] == 3 |
| 1878 | 1877 | */ |
| 1879 | 1878 | #define INTERRUPT_NUM_SCUDHAMM 30 |
| 1880 | INTERRUPT_GEN( interrupt_scudhamm ) | |
| 1879 | static INTERRUPT_GEN( interrupt_scudhamm ) | |
| 1881 | 1880 | { |
| 1882 | 1881 | switch ( cpu_getiloops() ) |
| 1883 | 1882 | { |
| r1293 | r1294 | |
| 1928 | 1927 | Arm Champs II |
| 1929 | 1928 | **************************************************************************/ |
| 1930 | 1929 | |
| 1931 | INTERRUPT_GEN( interrupt_armchmp2) | |
| 1930 | static INTERRUPT_GEN( interrupt_armchmp2) | |
| 1932 | 1931 | { |
| 1933 | 1932 | switch ( cpu_getiloops() ) |
| 1934 | 1933 | { |
| r1293 | r1294 | |
| 1967 | 1966 | |
| 1968 | 1967 | We need to untangle it |
| 1969 | 1968 | */ |
| 1970 | void cischeat_untangle_sprites(int region) | |
| 1969 | static void cischeat_untangle_sprites(int region) | |
| 1971 | 1970 | { |
| 1972 | 1971 | UINT8 *src = memory_region(region); |
| 1973 | 1972 | const UINT8 *end = memory_region(region) + memory_region_length(region); |
| r1293 | r1294 | |
|---|---|---|
| 1183 | 1183 | { /* SUBCPU enable on System 22 (guessed, but too early crashes Rave Racer so it's a good test) */ |
| 1184 | 1184 | if (data == 0xff00) |
| 1185 | 1185 | { |
| 1186 | | |
| 1186 | | |
| 1187 | 1187 | } |
| 1188 | 1188 | } |
| 1189 | 1189 | } |
| r1293 | r1294 | |
| 1822 | 1822 | MDRV_CPU_ADD(M37710, SS22_MASTER_CLOCK/3) |
| 1823 | 1823 | MDRV_CPU_PROGRAM_MAP(mcu_program, 0) |
| 1824 | 1824 | MDRV_CPU_IO_MAP( mcu_io, 0 ) |
| 1825 | MDRV_CPU_VBLANK_INT(mcu_interrupt, 3) | |
| 1825 | MDRV_CPU_VBLANK_INT(mcu_interrupt, 3) | |
| 1826 | 1826 | |
| 1827 | 1827 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1828 | 1828 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) |
| r1293 | r1294 | |
|---|---|---|
| 52 | 52 | { |
| 53 | 53 | if (potsense[i] != 0) |
| 54 | 54 | { |
| 55 | | |
| 55 | | |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | scanline += 0x40; |
| 60 | 60 | scanline &= 0xff; |
| 61 | 61 | |
| 62 | | |
| 62 | | |
| 63 | 63 | |
| 64 | 64 | flyball_potsense = 0; |
| 65 | 65 | flyball_potmask = 0; |
| r1293 | r1294 | |
| 77 | 77 | for (i = 0; i < 0x1000; i++) |
| 78 | 78 | rombase[i] = ROM[i ^ 0x1ff]; |
| 79 | 79 | |
| 80 | | |
| 80 | | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 |
| r1293 | r1294 | |
|---|---|---|
| 42 | 42 | Interrupts are still used, but they are related to coin |
| 43 | 43 | slots. Left slot generates an IRQ, Right slot a NMI. |
| 44 | 44 | */ |
| 45 | INTERRUPT_GEN( redclash_interrupt ) | |
| 45 | static INTERRUPT_GEN( redclash_interrupt ) | |
| 46 | 46 | { |
| 47 | 47 | if (readinputport(4) & 1) /* Left Coin */ |
| 48 | 48 | cpunum_set_input_line(0,0,ASSERT_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 95 | 95 | cpunum_set_input_line(0, INPUT_LINE_RESET, PULSE_LINE); |
| 96 | 96 | |
| 97 | 97 | /* simulate the coin switch being closed for a while */ |
| 98 | | |
| 98 | | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | last_coin_input = coin_input; |
| r1293 | r1294 | |
| 125 | 125 | static int timer_started; |
| 126 | 126 | static UINT32 timer_value; |
| 127 | 127 | |
| 128 | #define TIMER_HALF_PERIOD | |
| 128 | #define TIMER_HALF_PERIOD | |
| 129 | 129 | |
| 130 | 130 | |
| 131 | 131 | static int get_vcounter(void) |
| r1293 | r1294 | |
| 174 | 174 | { |
| 175 | 175 | timer_started = 1; |
| 176 | 176 | |
| 177 | | |
| 177 | | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | return timer_value; |
| r1293 | r1294 | |
|---|---|---|
| 177 | 177 | |
| 178 | 178 | /* binary counter (1.4MHz update) */ |
| 179 | 179 | static UINT8 sasuke_counter; |
| 180 | static | |
| 180 | static | |
| 181 | 181 | |
| 182 | 182 | static TIMER_CALLBACK( sasuke_update_counter ) |
| 183 | 183 | { |
| r1293 | r1294 | |
| 188 | 188 | { |
| 189 | 189 | sasuke_counter = 0; |
| 190 | 190 | |
| 191 | sasuke_timer = mame_timer_alloc(sasuke_update_counter); | |
| 192 | mame_timer_adjust(sasuke_timer, time_zero, 0, MAME_TIME_IN_HZ(11289000/8)); // 1.4 MHz | |
| 191 | sasuke_timer = timer_alloc(sasuke_update_counter); | |
| 192 | timer_adjust(sasuke_timer, attotime_zero, 0, ATTOTIME_IN_HZ(11289000/8)); // 1.4 MHz | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 |
| r1293 | r1294 | |
|---|---|---|
| 433 | 433 | static UINT8 dsw_select, control_select; |
| 434 | 434 | static UINT8 *rambase; |
| 435 | 435 | |
| 436 | static | |
| 436 | static | |
| 437 | 437 | |
| 438 | 438 | |
| 439 | 439 | /************************************* |
| r1293 | r1294 | |
| 455 | 455 | if (scanline >= 256) |
| 456 | 456 | scanline = 0; |
| 457 | 457 | |
| 458 | | |
| 458 | | |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | |
| r1293 | r1294 | |
| 469 | 469 | |
| 470 | 470 | static MACHINE_RESET( centiped ) |
| 471 | 471 | { |
| 472 | interrupt_timer = mame_timer_alloc(generate_interrupt); | |
| 473 | mame_timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_zero); | |
| 472 | interrupt_timer = timer_alloc(generate_interrupt); | |
| 473 | timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_zero); | |
| 474 | 474 | cpunum_set_input_line(0, 0, CLEAR_LINE); |
| 475 | 475 | dsw_select = 0; |
| 476 | 476 | control_select = 0; |
| r1293 | r1294 | |
|---|---|---|
| 135 | 135 | static UINT8 joystick_type; |
| 136 | 136 | static UINT8 trackball_type; |
| 137 | 137 | |
| 138 | static | |
| 138 | static | |
| 139 | 139 | static UINT8 joystick_int; |
| 140 | 140 | static UINT8 joystick_int_enable; |
| 141 | 141 | static UINT8 joystick_value; |
| r1293 | r1294 | |
| 186 | 186 | |
| 187 | 187 | /* reset the joystick parameters */ |
| 188 | 188 | joystick_value = 0; |
| 189 | joystick_timer = | |
| 189 | joystick_timer = | |
| 190 | 190 | joystick_int = 0; |
| 191 | 191 | joystick_int_enable = 0; |
| 192 | 192 | } |
| r1293 | r1294 | |
| 228 | 228 | |
| 229 | 229 | /* clear any existing interrupt and set a timer for a new one */ |
| 230 | 230 | joystick_int = 0; |
| 231 | | |
| 231 | | |
| 232 | 232 | atarigen_update_interrupts(); |
| 233 | 233 | |
| 234 | 234 | return joystick_value; |
| r1293 | r1294 | |
|---|---|---|
| 488 | 488 | |
| 489 | 489 | static INTERRUPT_GEN( wgp_cpub_interrupt ) |
| 490 | 490 | { |
| 491 | | |
| 491 | | |
| 492 | 492 | cpunum_set_input_line(2, 4, HOLD_LINE); |
| 493 | 493 | } |
| 494 | 494 | |
| r1293 | r1294 | |
| 611 | 611 | hardware has got the next a/d conversion ready. We set a token |
| 612 | 612 | delay of 10000 cycles although our inputs are always ready. */ |
| 613 | 613 | |
| 614 | | |
| 614 | | |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 |
| r1293 | r1294 | |
|---|---|---|
| 316 | 316 | #include "sound/2610intf.h" |
| 317 | 317 | |
| 318 | 318 | UINT16 *welltris_spriteram; |
| 319 | size_t welltris_spriteram_size; | |
| 319 | //size_t welltris_spriteram_size; | |
| 320 | 320 | UINT16 *welltris_pixelram; |
| 321 | 321 | UINT16 *welltris_charvideoram; |
| 322 | 322 |
| r1293 | r1294 | |
|---|---|---|
| 117 | 117 | collision_reset = 0; |
| 118 | 118 | collision_index = 0; |
| 119 | 119 | |
| 120 | | |
| 120 | | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 |
| r1293 | r1294 | |
|---|---|---|
| 77 | 77 | #include "driver.h" |
| 78 | 78 | #include "sound/ay8910.h" |
| 79 | 79 | |
| 80 | tilemap *pturn_fgmap,*pturn_bgmap; | |
| 80 | static tilemap *pturn_fgmap,*pturn_bgmap; | |
| 81 | 81 | static int bgbank=0; |
| 82 | 82 | static int fgbank=0; |
| 83 | 83 | static int bgpalette=0; |
| r1293 | r1294 | |
|---|---|---|
| 235 | 235 | MDRV_CPU_VBLANK_INT(irq0_line_hold,16) |
| 236 | 236 | |
| 237 | 237 | MDRV_SCREEN_REFRESH_RATE(57) |
| 238 | MDRV_SCREEN_VBLANK_TIME( | |
| 238 | MDRV_SCREEN_VBLANK_TIME(A | |
| 239 | 239 | |
| 240 | 240 | /* video hardware */ |
| 241 | 241 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 268 | 268 | MDRV_CPU_VBLANK_INT(irq0_line_hold,16) |
| 269 | 269 | |
| 270 | 270 | MDRV_SCREEN_REFRESH_RATE(57) |
| 271 | MDRV_SCREEN_VBLANK_TIME( | |
| 271 | MDRV_SCREEN_VBLANK_TIME(A | |
| 272 | 272 | |
| 273 | 273 | /* video hardware */ |
| 274 | 274 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 936 | 936 | MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem) |
| 937 | 937 | |
| 938 | 938 | MDRV_SCREEN_REFRESH_RATE(57.41) |
| 939 | MDRV_SCREEN_VBLANK_TIME( | |
| 939 | MDRV_SCREEN_VBLANK_TIME(A | |
| 940 | 940 | |
| 941 | 941 | /* video hardware */ |
| 942 | 942 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 979 | 979 | MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem) |
| 980 | 980 | |
| 981 | 981 | MDRV_SCREEN_REFRESH_RATE(57.41) |
| 982 | MDRV_SCREEN_VBLANK_TIME( | |
| 982 | MDRV_SCREEN_VBLANK_TIME(A | |
| 983 | 983 | |
| 984 | 984 | /* video hardware */ |
| 985 | 985 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 1022 | 1022 | MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem) |
| 1023 | 1023 | |
| 1024 | 1024 | MDRV_SCREEN_REFRESH_RATE(57.41) |
| 1025 | MDRV_SCREEN_VBLANK_TIME( | |
| 1025 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1026 | 1026 | |
| 1027 | 1027 | /* video hardware */ |
| 1028 | 1028 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 1068 | 1068 | MDRV_CPU_PROGRAM_MAP(robocop_sub_readmem,robocop_sub_writemem) |
| 1069 | 1069 | |
| 1070 | 1070 | MDRV_SCREEN_REFRESH_RATE(57.41) |
| 1071 | MDRV_SCREEN_VBLANK_TIME( | |
| 1071 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1072 | 1072 | MDRV_INTERLEAVE(50) /* Interleave between HuC6280 & 68000 */ |
| 1073 | 1073 | |
| 1074 | 1074 | /* video hardware */ |
| r1293 | r1294 | |
| 1112 | 1112 | MDRV_CPU_PROGRAM_MAP(dec0_s_readmem,dec0_s_writemem) |
| 1113 | 1113 | |
| 1114 | 1114 | MDRV_SCREEN_REFRESH_RATE(57.41) |
| 1115 | MDRV_SCREEN_VBLANK_TIME( | |
| 1115 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1116 | 1116 | |
| 1117 | 1117 | /* video hardware */ |
| 1118 | 1118 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 1158 | 1158 | MDRV_CPU_PROGRAM_MAP(hippodrm_sub_readmem,hippodrm_sub_writemem) |
| 1159 | 1159 | |
| 1160 | 1160 | MDRV_SCREEN_REFRESH_RATE(57.41) |
| 1161 | MDRV_SCREEN_VBLANK_TIME( | |
| 1161 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1162 | 1162 | MDRV_INTERLEAVE(5) /* Interleave between H6280 & 68000 */ |
| 1163 | 1163 | |
| 1164 | 1164 | /* video hardware */ |
| r1293 | r1294 | |
| 1202 | 1202 | MDRV_CPU_PROGRAM_MAP(slyspy_s_readmem,slyspy_s_writemem) |
| 1203 | 1203 | |
| 1204 | 1204 | MDRV_SCREEN_REFRESH_RATE(57.41) |
| 1205 | MDRV_SCREEN_VBLANK_TIME( | |
| 1205 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1206 | 1206 | |
| 1207 | 1207 | /* video hardware */ |
| 1208 | 1208 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 1245 | 1245 | MDRV_CPU_PROGRAM_MAP(midres_s_readmem,midres_s_writemem) |
| 1246 | 1246 | |
| 1247 | 1247 | MDRV_SCREEN_REFRESH_RATE(57.41) |
| 1248 | MDRV_SCREEN_VBLANK_TIME( | |
| 1248 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1249 | 1249 | |
| 1250 | 1250 | /* video hardware */ |
| 1251 | 1251 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 204 | 204 | cpunum_set_input_line(0, 0, (requested_int & irq_enable)? ASSERT_LINE : CLEAR_LINE); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | int ssv_irq_callback(int level) | |
| 207 | static int ssv_irq_callback(int level) | |
| 208 | 208 | { |
| 209 | 209 | int i; |
| 210 | 210 | for ( i = 0; i <= 7; i++ ) |
| r1293 | r1294 | |
| 251 | 251 | |
| 252 | 252 | static int interrupt_ultrax; |
| 253 | 253 | |
| 254 | INTERRUPT_GEN( ssv_interrupt ) | |
| 254 | static INTERRUPT_GEN( ssv_interrupt ) | |
| 255 | 255 | { |
| 256 | 256 | if (cpu_getiloops()) |
| 257 | 257 | { |
| r1293 | r1294 | |
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | INTERRUPT_GEN( gdfs_interrupt ) | |
| 271 | static INTERRUPT_GEN( gdfs_interrupt ) | |
| 272 | 272 | { |
| 273 | 273 | if (cpu_getiloops()) |
| 274 | 274 | { |
| r1293 | r1294 | |
| 2694 | 2694 | |
| 2695 | 2695 | ***************************************************************************/ |
| 2696 | 2696 | |
| 2697 | void init_ssv(void) | |
| 2697 | static void init_ssv(void) | |
| 2698 | 2698 | { |
| 2699 | 2699 | int i; |
| 2700 | 2700 | for (i = 0; i < 16; i++) |
| r1293 | r1294 | |
| 2708 | 2708 | eaglshot_dirty = 0; |
| 2709 | 2709 | } |
| 2710 | 2710 | |
| 2711 | void init_ssv_hypreac2(void) | |
| 2711 | static void init_ssv_hypreac2(void) | |
| 2712 | 2712 | { |
| 2713 | 2713 | int i; |
| 2714 | 2714 |
| r1293 | r1294 | |
|---|---|---|
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | /* For games that supply an *IRQ Vector* on the data bus */ |
| 189 | int metro_irq_callback(int int_level) | |
| 189 | static int metro_irq_callback(int int_level) | |
| 190 | 190 | { |
| 191 | 191 | // logerror("CPU #0 PC %06X: irq callback returns %04X\n",activecpu_get_pc(),metro_irq_vectors[int_level]); |
| 192 | 192 | return metro_irq_vectors[int_level]&0xff; |
| r1293 | r1294 | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | |
| 223 | INTERRUPT_GEN( metro_interrupt ) | |
| 223 | static INTERRUPT_GEN( metro_interrupt ) | |
| 224 | 224 | { |
| 225 | 225 | switch ( cpu_getiloops() ) |
| 226 | 226 | { |
| r1293 | r1294 | |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /* Lev 1. Lev 2 seems sound related */ |
| 240 | INTERRUPT_GEN( bangball_interrupt ) | |
| 240 | static INTERRUPT_GEN( bangball_interrupt ) | |
| 241 | 241 | { |
| 242 | 242 | requested_int[0] = 1; // set scroll regs if a flag is set |
| 243 | 243 | requested_int[4] = 1; // clear that flag |
| r1293 | r1294 | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /* lev 2-7 (lev 1 seems sound related) */ |
| 254 | INTERRUPT_GEN( karatour_interrupt ) | |
| 254 | static INTERRUPT_GEN( karatour_interrupt ) | |
| 255 | 255 | { |
| 256 | 256 | switch ( cpu_getiloops() ) |
| 257 | 257 | { |
| r1293 | r1294 | |
| 259 | 259 | requested_int[0] = 1; |
| 260 | 260 | requested_int[5] = 1; // write the scroll registers |
| 261 | 261 | /* the duration is a guess */ |
| 262 | | |
| 262 | | |
| 263 | 263 | update_irq_state(); |
| 264 | 264 | break; |
| 265 | 265 | |
| r1293 | r1294 | |
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | static | |
| 273 | static | |
| 274 | 274 | |
| 275 | 275 | static TIMER_CALLBACK( mouja_irq_callback ) |
| 276 | 276 | { |
| r1293 | r1294 | |
| 281 | 281 | static WRITE16_HANDLER( mouja_irq_timer_ctrl_w ) |
| 282 | 282 | { |
| 283 | 283 | double freq = 58.0 + (0xff - (data & 0xff)) / 2.2; /* 0xff=58Hz, 0x80=116Hz? */ |
| 284 | | |
| 284 | | |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | INTERRUPT_GEN( mouja_interrupt ) | |
| 287 | static INTERRUPT_GEN( mouja_interrupt ) | |
| 288 | 288 | { |
| 289 | 289 | requested_int[1] = 1; |
| 290 | 290 | update_irq_state(); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
| 294 | INTERRUPT_GEN( gakusai_interrupt ) | |
| 294 | static INTERRUPT_GEN( gakusai_interrupt ) | |
| 295 | 295 | { |
| 296 | 296 | switch ( cpu_getiloops() ) |
| 297 | 297 | { |
| r1293 | r1294 | |
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | INTERRUPT_GEN( dokyusei_interrupt ) | |
| 305 | static INTERRUPT_GEN( dokyusei_interrupt ) | |
| 306 | 306 | { |
| 307 | 307 | switch ( cpu_getiloops() ) |
| 308 | 308 | { |
| r1293 | r1294 | |
| 672 | 672 | |
| 673 | 673 | ***************************************************************************/ |
| 674 | 674 | |
| 675 | UINT16 *metro_blitter_regs; | |
| 675 | static UINT16 *metro_blitter_regs; | |
| 676 | 676 | |
| 677 | 677 | static TIMER_CALLBACK( metro_blit_done ) |
| 678 | 678 | { |
| r1293 | r1294 | |
| 754 | 754 | another blit. */ |
| 755 | 755 | if (b1 == 0) |
| 756 | 756 | { |
| 757 | | |
| 757 | | |
| 758 | 758 | return; |
| 759 | 759 | } |
| 760 | 760 | |
| r1293 | r1294 | |
| 1381 | 1381 | |
| 1382 | 1382 | static int gakusai_oki_bank_lo, gakusai_oki_bank_hi; |
| 1383 | 1383 | |
| 1384 | void gakusai_oki_bank_set(void) | |
| 1384 | static void gakusai_oki_bank_set(void) | |
| 1385 | 1385 | { |
| 1386 | 1386 | int bank = (gakusai_oki_bank_lo & 7) + (gakusai_oki_bank_hi & 1) * 8; |
| 1387 | 1387 | OKIM6295_set_bank_base(0, bank * 0x40000); |
| r1293 | r1294 | |
| 4667 | 4667 | { |
| 4668 | 4668 | metro_common(); |
| 4669 | 4669 | irq_line = -1; /* split interrupt handlers */ |
| 4670 | mouja_irq_timer = | |
| 4670 | mouja_irq_timer = | |
| 4671 | 4671 | } |
| 4672 | 4672 | |
| 4673 | 4673 | static DRIVER_INIT( gakusai ) |
| r1293 | r1294 | |
|---|---|---|
| 118 | 118 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 119 | 119 | INPUT_PORTS_END |
| 120 | 120 | |
| 121 | INTERRUPT_GEN( laserbas_interrupt ) | |
| 121 | static INTERRUPT_GEN( laserbas_interrupt ) | |
| 122 | 122 | { |
| 123 | 123 | if(video_screen_get_vblank(0)) |
| 124 | 124 | cpunum_set_input_line(0, 0, HOLD_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 41 | 41 | static UINT16 last_port0; |
| 42 | 42 | static UINT8 shifter_state; |
| 43 | 43 | |
| 44 | static | |
| 44 | static | |
| 45 | 45 | static double timer_rate; |
| 46 | 46 | |
| 47 | 47 | static UINT32 *tms32031_control; |
| r1293 | r1294 | |
| 63 | 63 | |
| 64 | 64 | memcpy(ram_base, memory_region(REGION_USER1), 0x20000*4); |
| 65 | 65 | |
| 66 | timer[0] = mame_timer_alloc(NULL); | |
| 67 | timer[1] = mame_timer_alloc(NULL); | |
| 66 | timer[0] = timer_alloc(NULL); | |
| 67 | timer[1] = timer_alloc(NULL); | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
| r1293 | r1294 | |
| 75 | 75 | |
| 76 | 76 | memcpy(ram_base, memory_region(REGION_USER1), 0x20000*4); |
| 77 | 77 | |
| 78 | timer[0] = mame_timer_alloc(NULL); | |
| 79 | timer[1] = mame_timer_alloc(NULL); | |
| 78 | timer[0] = timer_alloc(NULL); | |
| 79 | timer[1] = timer_alloc(NULL); | |
| 80 | 80 | |
| 81 | 81 | ide_controller_reset(0); |
| 82 | 82 | } |
| r1293 | r1294 | |
| 154 | 154 | if (which < 0 || which > 2) |
| 155 | 155 | logerror("adc_w: unexpected which = %02X\n", which + 4); |
| 156 | 156 | adc_data = readinputport(3 + which); |
| 157 | | |
| 157 | | |
| 158 | 158 | } |
| 159 | 159 | else |
| 160 | 160 | logerror("adc_w without enabling writes!\n"); |
| r1293 | r1294 | |
| 255 | 255 | { |
| 256 | 256 | /* timer is clocked at 100ns */ |
| 257 | 257 | int which = (offset >> 4) & 1; |
| 258 | INT32 result = | |
| 258 | INT32 result = | |
| 259 | 259 | // logerror("%06X:tms32031_control_r(%02X) = %08X\n", activecpu_get_pc(), offset, result); |
| 260 | 260 | return result; |
| 261 | 261 | } |
| r1293 | r1294 | |
| 282 | 282 | int which = (offset >> 4) & 1; |
| 283 | 283 | // logerror("%06X:tms32031_control_w(%02X) = %08X\n", activecpu_get_pc(), offset, data); |
| 284 | 284 | if (data & 0x40) |
| 285 | | |
| 285 | | |
| 286 | 286 | |
| 287 | 287 | /* bit 0x200 selects internal clocking, which is 1/2 the main CPU clock rate */ |
| 288 | 288 | if (data & 0x200) |
| r1293 | r1294 | |
| 988 | 988 | * |
| 989 | 989 | *************************************/ |
| 990 | 990 | |
| 991 | MACHINE_DRIVER_START( midvcommon ) | |
| 991 | static MACHINE_DRIVER_START( midvcommon ) | |
| 992 | 992 | |
| 993 | 993 | /* basic machine hardware */ |
| 994 | 994 | MDRV_CPU_ADD_TAG("main", TMS32031, CPU_CLOCK) |
| r1293 | r1294 | |
| 1010 | 1010 | MACHINE_DRIVER_END |
| 1011 | 1011 | |
| 1012 | 1012 | |
| 1013 | MACHINE_DRIVER_START( midvunit ) | |
| 1013 | static MACHINE_DRIVER_START( midvunit ) | |
| 1014 | 1014 | MDRV_IMPORT_FROM(midvcommon) |
| 1015 | 1015 | |
| 1016 | 1016 | /* sound hardware */ |
| r1293 | r1294 | |
| 1018 | 1018 | MACHINE_DRIVER_END |
| 1019 | 1019 | |
| 1020 | 1020 | |
| 1021 | MACHINE_DRIVER_START( midvplus ) | |
| 1021 | static MACHINE_DRIVER_START( midvplus ) | |
| 1022 | 1022 | MDRV_IMPORT_FROM(midvcommon) |
| 1023 | 1023 | |
| 1024 | 1024 | /* basic machine hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 296 | 296 | MDRV_CPU_ADD(H83002, 16384000 ) |
| 297 | 297 | MDRV_CPU_PROGRAM_MAP( nd1h8rwmap, 0 ) |
| 298 | 298 | MDRV_CPU_IO_MAP( nd1h8iomap, 0 ) |
| 299 | MDRV_CPU_VBLANK_INT( mcu_interrupt, 1 ) | |
| 299 | MDRV_CPU_VBLANK_INT( mcu_interrupt, 1 ) | |
| 300 | 300 | |
| 301 | 301 | MDRV_SCREEN_REFRESH_RATE(60.0) |
| 302 | 302 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) |
| r1293 | r1294 | |
|---|---|---|
| 9 | 9 | Sound: YM2151 + DAC x 4 |
| 10 | 10 | |
| 11 | 11 | |
| 12 | --------------------------------------------------------------------------- | |
| 13 | Year + Game By Hardware | |
| 14 | --------------------------------------------------------------------------- | |
| 15 | 94 Suna Quiz 6000 SunA 68000 + Z80 x 2 + YM2151 + DAC x 2 | |
| 16 | 96 Ultra Balloon SunA 68000 + Z80 x 2 + YM2151 + DAC x 2 | |
| 17 | 96 Back Street Soccer SunA 68000 + Z80 x 3 + YM2151 + DAC x 4 | |
| 18 | --------------------------------------------------------------------------- | |
| 12 | ------------------------------------------------------------------------------------------- | |
| 13 | Year + Game By Board Hardware | |
| 14 | ------------------------------------------------------------------------------------------- | |
| 15 | 94 Best Of Best SunA KRB-0026 68000 + Z80 x 2 + YM3526 + DAC x 4 + AY-8910 | |
| 16 | 94 Suna Quiz 6000 Academy SunA KRB-0027A 68000 + Z80 x 2 + YM2151 + DAC x 2 | |
| 17 | 96 Ultra Balloon SunA 68000 + Z80 x 2 + YM2151 + DAC x 2 | |
| 18 | 96 Back Street Soccer SunA 68000 + Z80 x 3 + YM2151 + DAC x 4 | |
| 19 | ------------------------------------------------------------------------------------------- | |
| 19 | 20 | |
| 20 | 21 | |
| 21 | 22 | ***************************************************************************/ |
| r1293 | r1294 | |
| 23 | 24 | #include "driver.h" |
| 24 | 25 | #include "sound/dac.h" |
| 25 | 26 | #include "sound/2151intf.h" |
| 27 | #include "sound/ay8910.h" | |
| 28 | #include "sound/3812intf.h" | |
| 26 | 29 | |
| 27 | 30 | /* Variables and functions defined in video: */ |
| 28 | 31 | |
| 29 | 32 | WRITE16_HANDLER( suna16_flipscreen_w ); |
| 33 | WRITE16_HANDLER( bestbest_flipscreen_w ); | |
| 30 | 34 | |
| 31 | 35 | READ16_HANDLER ( suna16_paletteram16_r ); |
| 32 | 36 | WRITE16_HANDLER( suna16_paletteram16_w ); |
| 33 | 37 | |
| 34 | 38 | VIDEO_START( suna16 ); |
| 35 | 39 | VIDEO_UPDATE( suna16 ); |
| 40 | VIDEO_UPDATE( bestbest ); | |
| 36 | 41 | |
| 37 | 42 | |
| 38 | 43 | /*************************************************************************** |
| r1293 | r1294 | |
| 79 | 84 | } |
| 80 | 85 | |
| 81 | 86 | |
| 87 | static WRITE16_HANDLER( bestbest_coin_w ) | |
| 88 | { | |
| 89 | if (ACCESSING_LSB) | |
| 90 | { | |
| 91 | coin_counter_w(0, data & 0x04); | |
| 92 | } | |
| 93 | if (data & ~0x04) logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", activecpu_get_pc(), data); | |
| 94 | } | |
| 95 | ||
| 96 | ||
| 82 | 97 | /*************************************************************************** |
| 83 | 98 | Back Street Soccer |
| 84 | 99 | ***************************************************************************/ |
| r1293 | r1294 | |
| 100 | 115 | static ADDRESS_MAP_START( bssoccer_writemem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 101 | 116 | AM_RANGE(0x000000, 0x1fffff) AM_WRITE(MWA16_ROM ) // ROM |
| 102 | 117 | AM_RANGE(0x200000, 0x203fff) AM_WRITE(MWA16_RAM ) // RAM |
| 103 | AM_RANGE(0x400000, 0x4001ff) AM_WRITE(suna16_paletteram16_w | |
| 118 | AM_RANGE(0x400000, 0x4001ff) AM_WRITE(suna16_paletteram16_w | |
| 104 | 119 | AM_RANGE(0x400200, 0x400fff) AM_WRITE(MWA16_RAM ) // |
| 105 | 120 | AM_RANGE(0x600000, 0x61ffff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16 ) // Sprites |
| 106 | 121 | AM_RANGE(0xa00000, 0xa00001) AM_WRITE(suna16_soundlatch_w ) // To Sound CPU |
| r1293 | r1294 | |
| 136 | 151 | static ADDRESS_MAP_START( uballoon_writemem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 137 | 152 | AM_RANGE(0x000000, 0x0fffff) AM_WRITE(MWA16_ROM ) // ROM |
| 138 | 153 | AM_RANGE(0x800000, 0x803fff) AM_WRITE(MWA16_RAM ) // RAM |
| 139 | AM_RANGE(0x200000, 0x2001ff) AM_WRITE(suna16_paletteram16_w) | |
| 154 | AM_RANGE(0x200000, 0x2001ff) AM_WRITE(suna16_paletteram16_w ) | |
| 140 | 155 | AM_RANGE(0x200200, 0x200fff) AM_WRITE(MWA16_RAM ) // |
| 141 | 156 | AM_RANGE(0x400000, 0x41ffff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16 ) // Sprites |
| 142 | 157 | AM_RANGE(0x5c0000, 0x5dffff) AM_WRITE(uballoon_spriteram16_w ) // Sprites (Mirror?) |
| r1293 | r1294 | |
| 148 | 163 | AM_RANGE(0xa00000, 0xa0ffff) AM_WRITE(MWA16_NOP ) // Protection |
| 149 | 164 | ADDRESS_MAP_END |
| 150 | 165 | |
| 166 | ||
| 151 | 167 | /*************************************************************************** |
| 152 | | |
| 168 | | |
| 153 | 169 | ***************************************************************************/ |
| 154 | 170 | |
| 155 | 171 | static ADDRESS_MAP_START( sunaq_readmem, ADDRESS_SPACE_PROGRAM, 16 ) |
| r1293 | r1294 | |
| 168 | 184 | AM_RANGE(0x000000, 0x0fffff) AM_WRITE(MWA16_ROM ) // ROM |
| 169 | 185 | AM_RANGE(0x500000, 0x500001) AM_WRITE(suna16_soundlatch_w ) // To Sound CPU |
| 170 | 186 | AM_RANGE(0x500002, 0x500003) AM_WRITE(suna16_flipscreen_w ) // Flip Screen |
| 171 | AM_RANGE(0x540000, 0x5401ff) AM_WRITE(suna16_paletteram16_w | |
| 187 | AM_RANGE(0x540000, 0x5401ff) AM_WRITE(suna16_paletteram16_w | |
| 172 | 188 | AM_RANGE(0x540200, 0x540fff) AM_WRITE(MWA16_RAM ) // RAM |
| 173 | 189 | AM_RANGE(0x580000, 0x583fff) AM_WRITE(MWA16_RAM ) // RAM |
| 174 | 190 | AM_RANGE(0x5c0000, 0x5dffff) AM_WRITE(uballoon_spriteram16_w) AM_BASE(&spriteram16 ) // Sprites |
| 175 | 191 | ADDRESS_MAP_END |
| 176 | 192 | |
| 193 | ||
| 177 | 194 | /*************************************************************************** |
| 195 | Best Of Best | |
| 196 | ***************************************************************************/ | |
| 178 | 197 | |
| 198 | static UINT16 prot; | |
| 179 | 199 | |
| 200 | static READ16_HANDLER( bestbest_prot_r ) | |
| 201 | { | |
| 202 | return prot; | |
| 203 | } | |
| 204 | ||
| 205 | static WRITE16_HANDLER( bestbest_prot_w ) | |
| 206 | { | |
| 207 | if (ACCESSING_LSB) | |
| 208 | { | |
| 209 | switch (data & 0xff) | |
| 210 | { | |
| 211 | case 0x00: prot = prot ^ 0x0009; break; | |
| 212 | case 0x08: prot = prot ^ 0x0002; break; | |
| 213 | case 0x0c: prot = prot ^ 0x0003; break; | |
| 214 | // default: logerror("CPU#0 PC %06X - Unknown protection value: %04X\n", activecpu_get_pc(), data); | |
| 215 | } | |
| 216 | } | |
| 217 | } | |
| 218 | ||
| 219 | ||
| 220 | static ADDRESS_MAP_START( bestbest_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 221 | AM_RANGE( 0x000000, 0x03ffff ) AM_ROM AM_MIRROR(0xc0000) // ROM | |
| 222 | AM_RANGE( 0x200000, 0x2fffff ) AM_ROM AM_REGION(REGION_USER1, 0) // ROM | |
| 223 | AM_RANGE( 0x500000, 0x500001 ) AM_READWRITE( input_port_0_word_r, suna16_soundlatch_w ) // P1 + Coins, To Sound CPU | |
| 224 | AM_RANGE( 0x500002, 0x500003 ) AM_READWRITE( input_port_1_word_r, bestbest_flipscreen_w ) // P2 + Coins, Flip Screen | |
| 225 | AM_RANGE( 0x500004, 0x500005 ) AM_READWRITE( input_port_2_word_r, bestbest_coin_w ) // Coin Counter | |
| 226 | AM_RANGE( 0x500008, 0x500009 ) AM_WRITE( bestbest_prot_w ) // Protection | |
| 227 | AM_RANGE( 0x500018, 0x500019 ) AM_READ ( bestbest_prot_r ) // | |
| 228 | AM_RANGE( 0x540000, 0x540fff ) AM_READWRITE( suna16_paletteram16_r, suna16_paletteram16_w ) // Banked(?) Palette | |
| 229 | AM_RANGE( 0x541000, 0x54ffff ) AM_RAM // | |
| 230 | AM_RANGE( 0x580000, 0x58ffff ) AM_RAM // RAM | |
| 231 | AM_RANGE( 0x5c0000, 0x5dffff ) AM_RAM AM_BASE( &spriteram16 ) // Sprites (Chip 1) | |
| 232 | AM_RANGE( 0x5e0000, 0x5fffff ) AM_RAM AM_BASE( &spriteram16_2 ) // Sprites (Chip 2) | |
| 233 | ADDRESS_MAP_END | |
| 234 | ||
| 235 | ||
| 236 | /*************************************************************************** | |
| 237 | ||
| 238 | ||
| 180 | 239 | Z80 #1 |
| 181 | 240 | |
| 182 | 241 | Plays the music (YM2151) and controls the 2 Z80s in charge |
| r1293 | r1294 | |
| 225 | 284 | ADDRESS_MAP_END |
| 226 | 285 | |
| 227 | 286 | /*************************************************************************** |
| 228 | | |
| 287 | | |
| 229 | 288 | ***************************************************************************/ |
| 230 | 289 | |
| 231 | 290 | static ADDRESS_MAP_START( sunaq_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r1293 | r1294 | |
| 244 | 303 | ADDRESS_MAP_END |
| 245 | 304 | |
| 246 | 305 | /*************************************************************************** |
| 306 | Best Of Best | |
| 307 | ***************************************************************************/ | |
| 247 | 308 | |
| 309 | static ADDRESS_MAP_START( bestbest_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 310 | AM_RANGE( 0x0000, 0xbfff ) AM_ROM // ROM | |
| 311 | AM_RANGE( 0xc000, 0xc000 ) AM_WRITE( YM3526_control_port_0_w ) // YM3526 | |
| 312 | AM_RANGE( 0xc001, 0xc001 ) AM_WRITE( YM3526_write_port_0_w ) // | |
| 313 | AM_RANGE( 0xc002, 0xc002 ) AM_WRITE( AY8910_control_port_0_w ) // AY8910 | |
| 314 | AM_RANGE( 0xc003, 0xc003 ) AM_WRITE( AY8910_write_port_0_w ) // | |
| 315 | AM_RANGE( 0xe000, 0xe7ff ) AM_RAM // RAM | |
| 316 | AM_RANGE( 0xf000, 0xf000 ) AM_WRITE( soundlatch2_w ) // To PCM Z80 | |
| 317 | AM_RANGE( 0xf800, 0xf800 ) AM_READ ( soundlatch_r ) // From Main CPU | |
| 318 | ADDRESS_MAP_END | |
| 248 | 319 | |
| 320 | /*************************************************************************** | |
| 321 | ||
| 322 | ||
| 249 | 323 | Z80 #2 & #3 |
| 250 | 324 | |
| 251 | 325 | Dumb PCM samples players (e.g they don't even have RAM!) |
| r1293 | r1294 | |
| 371 | 445 | |
| 372 | 446 | |
| 373 | 447 | /*************************************************************************** |
| 448 | Best Of Best | |
| 449 | ***************************************************************************/ | |
| 374 | 450 | |
| 451 | static ADDRESS_MAP_START( bestbest_pcm_1_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 452 | AM_RANGE(0x0000, 0xffff) AM_ROM | |
| 453 | ADDRESS_MAP_END | |
| 375 | 454 | |
| 455 | static ADDRESS_MAP_START( bestbest_pcm_1_iomap, ADDRESS_SPACE_IO, 8 ) | |
| 456 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 457 | AM_RANGE(0x00, 0x00) AM_READ (soundlatch2_r ) // From The Sound Z80 | |
| 458 | AM_RANGE(0x00, 0x01) AM_WRITE(bssoccer_DAC_1_w ) // 2 x DAC | |
| 459 | AM_RANGE(0x02, 0x03) AM_WRITE(bssoccer_DAC_2_w ) // 2 x DAC | |
| 460 | ADDRESS_MAP_END | |
| 461 | ||
| 462 | /*************************************************************************** | |
| 463 | ||
| 464 | ||
| 376 | 465 | Input Ports |
| 377 | 466 | |
| 378 | 467 | |
| r1293 | r1294 | |
| 568 | 657 | INPUT_PORTS_END |
| 569 | 658 | |
| 570 | 659 | /*************************************************************************** |
| 571 | | |
| 660 | | |
| 572 | 661 | ***************************************************************************/ |
| 573 | 662 | |
| 574 | 663 | static INPUT_PORTS_START( sunaq ) |
| r1293 | r1294 | |
| 620 | 709 | INPUT_PORTS_END |
| 621 | 710 | |
| 622 | 711 | /*************************************************************************** |
| 712 | Best Of Best | |
| 713 | ***************************************************************************/ | |
| 623 | 714 | |
| 715 | static INPUT_PORTS_START( bestbest ) | |
| 716 | PORT_START // IN0 - 500000.w - Player 1 | |
| 717 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) | |
| 718 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) | |
| 719 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) | |
| 720 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) | |
| 721 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 722 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 723 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 724 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 725 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 726 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) | |
| 727 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) | |
| 728 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) | |
| 729 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 730 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 731 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START1 ) | |
| 732 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 624 | 733 | |
| 734 | PORT_START // IN1 - 500002.w - Player 2 | |
| 735 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) | |
| 736 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) | |
| 737 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) | |
| 738 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) | |
| 739 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 740 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 741 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 742 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 743 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 744 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) | |
| 745 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) | |
| 746 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) | |
| 747 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 748 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 749 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START2 ) | |
| 750 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 751 | ||
| 752 | PORT_START // IN2 - 500004.w - DSW x 2 | |
| 753 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) ) | |
| 754 | PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) ) | |
| 755 | PORT_DIPSETTING( 0x0001, DEF_STR( 4C_1C ) ) | |
| 756 | PORT_DIPSETTING( 0x0002, DEF_STR( 3C_1C ) ) | |
| 757 | PORT_DIPSETTING( 0x0003, DEF_STR( 2C_1C ) ) | |
| 758 | PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) | |
| 759 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) | |
| 760 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) | |
| 761 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) | |
| 762 | PORT_DIPNAME( 0x0018, 0x0010, DEF_STR( Difficulty ) ) | |
| 763 | PORT_DIPSETTING( 0x0018, DEF_STR( Easy ) ) | |
| 764 | PORT_DIPSETTING( 0x0010, DEF_STR( Normal ) ) | |
| 765 | PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) ) | |
| 766 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 767 | PORT_DIPNAME( 0x0020, 0x0020, "Display Combos" ) | |
| 768 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 769 | PORT_DIPSETTING( 0x0020, DEF_STR( On ) ) | |
| 770 | PORT_SERVICE( 0x0040, IP_ACTIVE_LOW ) | |
| 771 | PORT_DIPNAME( 0x0080, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 772 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 773 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 774 | ||
| 775 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) | |
| 776 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) | |
| 777 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 778 | PORT_DIPNAME( 0x0600, 0x0400, "Play Time" ) | |
| 779 | PORT_DIPSETTING( 0x0600, "1:10" ) | |
| 780 | PORT_DIPSETTING( 0x0400, "1:20" ) | |
| 781 | PORT_DIPSETTING( 0x0200, "1:30" ) | |
| 782 | PORT_DIPSETTING( 0x0000, "1:40" ) | |
| 783 | PORT_DIPUNUSED( 0x0800, 0x0800 ) | |
| 784 | PORT_DIPUNUSED( 0x1000, 0x1000 ) | |
| 785 | PORT_DIPUNUSED( 0x2000, 0x2000 ) | |
| 786 | PORT_DIPUNUSED( 0x4000, 0x4000 ) | |
| 787 | PORT_DIPUNUSED( 0x8000, 0x8000 ) | |
| 788 | INPUT_PORTS_END | |
| 789 | ||
| 790 | /*************************************************************************** | |
| 791 | ||
| 792 | ||
| 625 | 793 | Graphics Layouts |
| 626 | 794 | |
| 627 | 795 | |
| r1293 | r1294 | |
| 644 | 812 | GFXDECODE_ENTRY( REGION_GFX1, 0, layout_8x8x4, 0, 16*2 ) // [0] Sprites |
| 645 | 813 | GFXDECODE_END |
| 646 | 814 | |
| 815 | // Two sprites chips | |
| 816 | static GFXDECODE_START( bestbest ) | |
| 817 | GFXDECODE_ENTRY( REGION_GFX1, 0, layout_8x8x4, 0, 256*8/16 ) // [0] Sprites (Chip 1) | |
| 818 | GFXDECODE_ENTRY( REGION_GFX2, 0, layout_8x8x4, 0, 256*8/16 ) // [1] Sprites (Chip 2) | |
| 819 | GFXDECODE_END | |
| 647 | 820 | |
| 648 | 821 | |
| 649 | 822 | |
| r1293 | r1294 | |
| 660 | 833 | Back Street Soccer |
| 661 | 834 | ***************************************************************************/ |
| 662 | 835 | |
| 663 | INTERRUPT_GEN( bssoccer_interrupt ) | |
| 836 | static INTERRUPT_GEN( bssoccer_interrupt ) | |
| 664 | 837 | { |
| 665 | 838 | switch (cpu_getiloops()) |
| 666 | 839 | { |
| r1293 | r1294 | |
| 779 | 952 | MACHINE_DRIVER_END |
| 780 | 953 | |
| 781 | 954 | /*************************************************************************** |
| 782 | | |
| 955 | | |
| 783 | 956 | ***************************************************************************/ |
| 784 | 957 | |
| 785 | 958 | static MACHINE_DRIVER_START( sunaq ) |
| r1293 | r1294 | |
| 829 | 1002 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.50) |
| 830 | 1003 | MACHINE_DRIVER_END |
| 831 | 1004 | |
| 1005 | /*************************************************************************** | |
| 1006 | Best Of Best | |
| 1007 | ***************************************************************************/ | |
| 832 | 1008 | |
| 1009 | static void bestbest_ym3526_irqhandler(int state) | |
| 1010 | { | |
| 1011 | cpunum_set_input_line(1, INPUT_LINE_IRQ0, state); | |
| 1012 | } | |
| 1013 | ||
| 1014 | static struct YM3526interface bestbest_ym3526_interface = | |
| 1015 | { | |
| 1016 | bestbest_ym3526_irqhandler | |
| 1017 | }; | |
| 1018 | ||
| 1019 | static WRITE8_HANDLER( bestbest_ay8910_port_a_w ) | |
| 1020 | { | |
| 1021 | // ? | |
| 1022 | } | |
| 1023 | ||
| 1024 | static struct AY8910interface bestbest_ay8910_interface = | |
| 1025 | { | |
| 1026 | 0, 0, | |
| 1027 | bestbest_ay8910_port_a_w, 0 | |
| 1028 | }; | |
| 1029 | ||
| 1030 | static MACHINE_DRIVER_START( bestbest ) | |
| 1031 | /* basic machine hardware */ | |
| 1032 | MDRV_CPU_ADD(M68000, 24000000/4) | |
| 1033 | MDRV_CPU_PROGRAM_MAP(bestbest_map,0) | |
| 1034 | MDRV_CPU_VBLANK_INT(bssoccer_interrupt,2) | |
| 1035 | ||
| 1036 | MDRV_CPU_ADD(Z80, 24000000/4) | |
| 1037 | MDRV_CPU_PROGRAM_MAP(bestbest_sound_map,0) | |
| 1038 | ||
| 1039 | MDRV_CPU_ADD(Z80, 24000000/4) | |
| 1040 | MDRV_CPU_PROGRAM_MAP(bestbest_pcm_1_map,0) | |
| 1041 | MDRV_CPU_IO_MAP(bestbest_pcm_1_iomap,0) | |
| 1042 | ||
| 1043 | /* 2nd PCM Z80 missing */ | |
| 1044 | ||
| 1045 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 1046 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) | |
| 1047 | MDRV_INTERLEAVE(100) | |
| 1048 | ||
| 1049 | /* video hardware */ | |
| 1050 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) | |
| 1051 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 1052 | MDRV_SCREEN_SIZE(256, 256) | |
| 1053 | MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0+16, 256-16-1) | |
| 1054 | MDRV_GFXDECODE(bestbest) | |
| 1055 | MDRV_PALETTE_LENGTH(256*8) | |
| 1056 | ||
| 1057 | MDRV_VIDEO_START(suna16) | |
| 1058 | MDRV_VIDEO_UPDATE(bestbest) | |
| 1059 | ||
| 1060 | /* sound hardware */ | |
| 1061 | MDRV_SPEAKER_STANDARD_STEREO("left", "right") | |
| 1062 | ||
| 1063 | MDRV_SOUND_ADD(AY8910, 24000000/16) | |
| 1064 | MDRV_SOUND_CONFIG(bestbest_ay8910_interface) | |
| 1065 | MDRV_SOUND_ROUTE(0, "left", 1.0) | |
| 1066 | MDRV_SOUND_ROUTE(1, "right", 1.0) | |
| 1067 | ||
| 1068 | MDRV_SOUND_ADD(YM3526, 24000000/8) | |
| 1069 | MDRV_SOUND_CONFIG(bestbest_ym3526_interface) | |
| 1070 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0) | |
| 1071 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) | |
| 1072 | ||
| 1073 | MDRV_SOUND_ADD(DAC, 0) | |
| 1074 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.40) | |
| 1075 | ||
| 1076 | MDRV_SOUND_ADD(DAC, 0) | |
| 1077 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.40) | |
| 1078 | ||
| 1079 | MDRV_SOUND_ADD(DAC, 0) | |
| 1080 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.40) | |
| 1081 | ||
| 1082 | MDRV_SOUND_ADD(DAC, 0) | |
| 1083 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.40) | |
| 1084 | MACHINE_DRIVER_END | |
| 1085 | ||
| 833 | 1086 | /*************************************************************************** |
| 834 | 1087 | |
| 835 | 1088 | |
| r1293 | r1294 | |
| 935 | 1188 | { |
| 936 | 1189 | UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1); |
| 937 | 1190 | |
| 938 | / | |
| 1191 | // Patch out the protection checks | |
| 939 | 1192 | RAM[0x0113c/2] = 0x4e71; // bne $646 |
| 940 | 1193 | RAM[0x0113e/2] = 0x4e71; // "" |
| 941 | 1194 | RAM[0x01784/2] = 0x600c; // beq $1792 |
| r1293 | r1294 | |
| 945 | 1198 | } |
| 946 | 1199 | |
| 947 | 1200 | /*************************************************************************** |
| 948 | | |
| 1201 | | |
| 949 | 1202 | |
| 950 | 1203 | KRB-0027A mainboard |
| 951 | 1204 | |
| r1293 | r1294 | |
| 983 | 1236 | |
| 984 | 1237 | /*************************************************************************** |
| 985 | 1238 | |
| 1239 | Best Of Best | |
| 1240 | Suna, 1994 | |
| 986 | 1241 | |
| 1242 | PCB Layout | |
| 1243 | ---------- | |
| 1244 | ||
| 1245 | KRB-0026 | |
| 1246 | SUNA ELECTRONICS IND CO., LTD. | |
| 1247 | |------------------------------------------------------------| | |
| 1248 | |VOL AY3-8910 Z80B 5.BIN | | |
| 1249 | |UPD1242H 6.BIN Z80B 6116 68000 | | |
| 1250 | | LM324 24MHz YM3526 | | |
| 1251 | | LM324 | | |
| 1252 | | YM3014 82S129.5 4.BIN 2.BIN | | |
| 1253 | | 82S129.6|-------| | | |
| 1254 | | 62256 |UNKNOWN| 3.BIN 1.BIN | | |
| 1255 | | |PLCC84 | | | |
| 1256 | | 62256 | | 62256 62256 | | |
| 1257 | | |-------| | | |
| 1258 | |J | | |
| 1259 | |A |-------| | | |
| 1260 | |M DSW2(8) |ACTEL | | | |
| 1261 | |M |A1020B | | | |
| 1262 | |A |PLCC84 | | | |
| 1263 | | DSW1(8) 62256 |-------| 62256 | | |
| 1264 | | | | |
| 1265 | | 6116 62256 62256 | | |
| 1266 | | 6116 | | |
| 1267 | | 6116 62256 62256 | | |
| 1268 | | 6116 |-------------------------------| | |
| 1269 | | 6116 | 18.BIN 17.BIN 10.BIN| | |
| 1270 | | 6116 | 16.BIN 13.BIN 9.BIN| | |
| 1271 | |CN1 6116 | 15.BIN 12.BIN 8.BIN| | |
| 1272 | | 6116 | 14.BIN 11.BIN 7.BIN| | |
| 1273 | |----------------------------|-------------------------------| | |
| 1274 | Notes: | |
| 1275 | 68000 - clock 6.000MHz [24/4] | |
| 1276 | Z80B - clock 6.000MHz [24/4] for both | |
| 1277 | YM3526 - clock 3.000MHz [24/8] | |
| 1278 | AY3-8910 - clock 1.500MHz [24/16] | |
| 1279 | 6116 - 2kx8 SRAM | |
| 1280 | 62256 - 32kx8 SRAM | |
| 1281 | CN1 - Connector for extra controls | |
| 1282 | VSync - 60Hz | |
| 1283 | HSync - 15.68kHz | |
| 1284 | ||
| 1285 | ROMs 7-18 located on a plug-in daughterboard | |
| 1286 | Both PROMs are identical | |
| 1287 | ||
| 1288 | ***************************************************************************/ | |
| 1289 | ||
| 1290 | ROM_START( bestbest ) | |
| 1291 | ROM_REGION( 0x40000, REGION_CPU1, 0 ) /* 68000 Code */ | |
| 1292 | // V13.0 1993,3,25-11,29 KIM.H.T M=1:KDS=9 | |
| 1293 | ROM_LOAD16_BYTE( "4.bin", 0x00000, 0x20000, CRC(06741994) SHA1(e872e9e9d02360dda9c9b6df8e6424b0f3e18c1f) ) // 1xxxxxxxxxxxxxxxx = 0xFF | |
| 1294 | ROM_LOAD16_BYTE( "2.bin", 0x00001, 0x20000, CRC(42843dec) SHA1(3705661a9740b3499297424e340da9a3606873fb) ) // 1xxxxxxxxxxxxxxxx = 0xFF | |
| 1295 | ||
| 1296 | ROM_REGION16_BE( 0x100000, REGION_USER1, 0 ) /* 68000 Data */ | |
| 1297 | ROM_LOAD16_BYTE( "3.bin", 0x00000, 0x80000, CRC(e2bb8f26) SHA1(d73bbe034718c77774dede61e751a9ae2d29118a) ) | |
| 1298 | ROM_LOAD16_BYTE( "1.bin", 0x00001, 0x80000, CRC(d365e20a) SHA1(29706d6e422e71c7dad51a3369683a6539f72b54) ) | |
| 1299 | ||
| 1300 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* Z80 #1 - Music */ | |
| 1301 | ROM_LOAD( "5.bin", 0x00000, 0x10000, CRC(bb9265e6) SHA1(424eceac4fd48c9a99653ece2f3fcbc8b37569cf) ) // BEST OF BEST V10 XILINX PROGRAM 3020 1994,1,17 | |
| 1302 | ||
| 1303 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* Z80 #2 - PCM */ | |
| 1304 | ROM_LOAD( "6.bin", 0x00000, 0x10000, CRC(dd445f6b) SHA1(658417d72c003f25db273e3c731838317ed1876c) ) | |
| 1305 | ||
| 1306 | /* There's no Z80 #3 - PCM */ | |
| 1307 | ||
| 1308 | ROM_REGION( 0x200000, REGION_GFX1, ROMREGION_DISPOSE | ROMREGION_INVERT ) /* Sprites (Chip 1) */ | |
| 1309 | ROM_LOAD( "9.bin", 0x000000, 0x80000, CRC(b11994ea) SHA1(4ff2250a9dbb2e575982e2ffcad7686347368b5b) ) | |
| 1310 | ROM_LOAD( "10.bin", 0x080000, 0x80000, CRC(37b41ef5) SHA1(dd4500663537ffad369ee9415c56df90221bed23) ) | |
| 1311 | ROM_LOAD( "7.bin", 0x100000, 0x80000, CRC(16188b73) SHA1(1e67f9b100614466e2ff1169f25c90e34a2e7db9) ) | |
| 1312 | ROM_LOAD( "8.bin", 0x180000, 0x80000, CRC(765ce06b) SHA1(6cc6d7c27b49eedd58104c50e4887f86bff9357c) ) | |
| 1313 | ||
| 1314 | ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE | ROMREGION_INVERT ) /* Sprites (Chip 2) */ | |
| 1315 | ROM_LOAD( "16.bin", 0x000000, 0x80000, CRC(dc46cdea) SHA1(d601f5464894223ce8459093ae53006155a3e680) ) | |
| 1316 | ROM_LOAD( "17.bin", 0x080000, 0x80000, CRC(c6fadd57) SHA1(ce9bc4d7a288feebdd19de09d00bec8489346878) ) | |
| 1317 | ROM_LOAD( "13.bin", 0x100000, 0x80000, CRC(23283ac4) SHA1(f7aa00f203b17b590f1c43990f3f1c4aba7ba0ad) ) | |
| 1318 | ROM_LOAD( "18.bin", 0x180000, 0x80000, CRC(674c4609) SHA1(f1de78c01d26dfb1174203415ccf3c771398d163) ) | |
| 1319 | ||
| 1320 | ROM_LOAD( "14.bin", 0x200000, 0x80000, CRC(c210fb53) SHA1(3d5a763bffaef922a77c95131b1e41f0f90629a5) ) | |
| 1321 | ROM_LOAD( "15.bin", 0x280000, 0x80000, CRC(3b1166c7) SHA1(7f2a0c9131fcf39dd67047b6e697c4076ca37b19) ) | |
| 1322 | ROM_LOAD( "11.bin", 0x300000, 0x80000, CRC(323eebc3) SHA1(0e82b583273c9ba5252f7a108538ae58edf39a03) ) | |
| 1323 | ROM_LOAD( "12.bin", 0x380000, 0x80000, CRC(ca7c8176) SHA1(1ec99db3e0840b4647d6ccdf6fda118fa9ad4f42) ) | |
| 1324 | ||
| 1325 | ROM_REGION( 0x200, REGION_PROMS, 0 ) // ? | |
| 1326 | ROM_LOAD( "82s129.5", 0x000, 0x100, CRC(10bfcebb) SHA1(ae8708db7d3a8984f16e876867ecdbb4445e3378) ) // FIXED BITS (0000xx0x0000xxxx) | |
| 1327 | ROM_LOAD( "82s129.6", 0x100, 0x100, CRC(10bfcebb) SHA1(ae8708db7d3a8984f16e876867ecdbb4445e3378) ) // identical to 82s129.5 | |
| 1328 | ROM_END | |
| 1329 | ||
| 1330 | ||
| 1331 | /*************************************************************************** | |
| 1332 | ||
| 1333 | ||
| 987 | 1334 | Games Drivers |
| 988 | 1335 | |
| 989 | 1336 | |
| 990 | 1337 | ***************************************************************************/ |
| 991 | 1338 | |
| 1339 | GAME( 1994, bestbest, 0, bestbest, bestbest, 0, ROT0, "SunA", "Best Of Best", 0 ) | |
| 1340 | GAME( 1994, sunaq, 0, sunaq, sunaq, 0, ROT0, "SunA", "SunA Quiz 6000 Academy (940620-6)", 0 ) // Date/Version on-screen is 940620-6, but in the program rom it's 1994,6,30 K.H.T V6.00 | |
| 992 | 1341 | GAME( 1996, bssoccer, 0, bssoccer, bssoccer, 0, ROT0, "SunA", "Back Street Soccer", 0 ) |
| 993 | 1342 | GAME( 1996, uballoon, 0, uballoon, uballoon, uballoon, ROT0, "SunA", "Ultra Balloon", 0 ) |
| 994 | // Date/Version on-screen is 940620-6, but in the program rom it's 1994,6,30 K.H.T V6.00 | |
| 995 | GAME( 1994, sunaq, 0, sunaq, sunaq, 0, ROT0, "SunA", "SunA Quiz 6000 Academy (940620-6)", 0 ) |
| r1293 | r1294 | |
|---|---|---|
| 60 | 60 | |
| 61 | 61 | #include "driver.h" |
| 62 | 62 | |
| 63 | UINT16 littlerb_vdp_address_low; | |
| 64 | UINT16 littlerb_vdp_address_high; | |
| 65 | UINT16 littlerb_vdp_writemode; | |
| 66 | UINT32 littlerb_write_address; | |
| 63 | static UINT16 littlerb_vdp_address_low; | |
| 64 | static UINT16 littlerb_vdp_address_high; | |
| 65 | static UINT16 littlerb_vdp_writemode; | |
| 66 | static UINT32 littlerb_write_address; | |
| 67 | 67 | |
| 68 | void littlerb_recalc_regs(void) | |
| 68 | static void littlerb_recalc_regs(void) | |
| 69 | 69 | { |
| 70 | 70 | littlerb_vdp_address_low = littlerb_write_address&0xffff; |
| 71 | 71 | littlerb_vdp_address_high = (littlerb_write_address>>16)&0xffff; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | UINT16* littlerb_region1; | |
| 75 | UINT16* littlerb_region2; | |
| 76 | UINT16* littlerb_region3; | |
| 77 | UINT16* littlerb_region4; | |
| 74 | static UINT16* littlerb_region1; | |
| 75 | static UINT16* littlerb_region2; | |
| 76 | static UINT16* littlerb_region3; | |
| 77 | static UINT16* littlerb_region4; | |
| 78 | 78 | |
| 79 | 79 | |
| 80 | void littlerb_data_write(UINT16 data) | |
| 80 | static void littlerb_data_write(UINT16 data) | |
| 81 | 81 | { |
| 82 | 82 | UINT32 addr = littlerb_write_address>>4; // is this right? should we shift? |
| 83 | 83 | |
| r1293 | r1294 | |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | |
| 136 | void littlerb_recalc_address(void) | |
| 136 | static void littlerb_recalc_address(void) | |
| 137 | 137 | { |
| 138 | 138 | littlerb_write_address = littlerb_vdp_address_low | littlerb_vdp_address_high<<16; |
| 139 | 139 | } |
| r1293 | r1294 | |
|---|---|---|
| 133 | 133 | static UINT8 extend_board_irq_enable; |
| 134 | 134 | static UINT8 extend_board_irq_active; |
| 135 | 135 | |
| 136 | static | |
| 136 | static | |
| 137 | 137 | |
| 138 | 138 | static GCU_REGS gcu[2]; |
| 139 | 139 | |
| r1293 | r1294 | |
| 2283 | 2283 | static void init_keyboard(void) |
| 2284 | 2284 | { |
| 2285 | 2285 | // set keyboard timer |
| 2286 | keyboard_timer = mame_timer_alloc(keyboard_timer_callback); | |
| 2287 | mame_timer_adjust(keyboard_timer, MAME_TIME_IN_MSEC(10), 0, MAME_TIME_IN_MSEC(10)); | |
| 2286 | keyboard_timer = timer_alloc(keyboard_timer_callback); | |
| 2287 | timer_adjust(keyboard_timer, ATTOTIME_IN_MSEC(10), 0, ATTOTIME_IN_MSEC(10)); | |
| 2288 | 2288 | } |
| 2289 | 2289 | |
| 2290 | 2290 | static DRIVER_INIT(kbm) |
| r1293 | r1294 | |
|---|---|---|
| 22 | 22 | |
| 23 | 23 | static UINT8 input_port_select; |
| 24 | 24 | static UINT8 analog_port_val; |
| 25 | static mame_timer *analog_timer_1; | |
| 26 | static mame_timer *analog_timer_2; | |
| 25 | static emu_timer *analog_timer_1; | |
| 26 | static emu_timer *analog_timer_2; | |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | |
| r1293 | r1294 | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | static | |
| 94 | static | |
| 95 | 95 | { |
| 96 | 96 | /* the 58 comes from the length of the loop used to |
| 97 | 97 | read the analog position */ |
| 98 | return | |
| 98 | return | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
| r1293 | r1294 | |
| 107 | 107 | |
| 108 | 108 | analog_port_val = 0xff; |
| 109 | 109 | |
| 110 | mame_timer_adjust(analog_timer_1, compute_duration(readinputportbytag("AN1")), 0x02, time_zero); | |
| 111 | mame_timer_adjust(analog_timer_2, compute_duration(readinputportbytag("AN2")), 0x01, time_zero); | |
| 110 | timer_adjust(analog_timer_1, compute_duration(readinputportbytag("AN1")), 0x02, attotime_zero); | |
| 111 | timer_adjust(analog_timer_2, compute_duration(readinputportbytag("AN2")), 0x01, attotime_zero); | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
| r1293 | r1294 | |
| 120 | 120 | |
| 121 | 121 | static void create_analog_timers(void) |
| 122 | 122 | { |
| 123 | analog_timer_1 = mame_timer_alloc(reset_analog_bit); | |
| 124 | analog_timer_2 = mame_timer_alloc(reset_analog_bit); | |
| 123 | analog_timer_1 = timer_alloc(reset_analog_bit); | |
| 124 | analog_timer_2 = timer_alloc(reset_analog_bit); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 |
| r1293 | r1294 | |
|---|---|---|
| 279 | 279 | MDRV_CPU_VBLANK_INT(nmi_line_pulse,16) /* IRQs are triggered by the main CPU */ |
| 280 | 280 | |
| 281 | 281 | MDRV_SCREEN_REFRESH_RATE(57) |
| 282 | MDRV_SCREEN_VBLANK_TIME( | |
| 282 | MDRV_SCREEN_VBLANK_TIME(A | |
| 283 | 283 | |
| 284 | 284 | /* video hardware */ |
| 285 | 285 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | |
| 128 | int bagman_speech_rom_read_bit(void) | |
| 128 | static int bagman_speech_rom_read_bit(void) | |
| 129 | 129 | { |
| 130 | 130 | UINT8 *ROM = memory_region(REGION_SOUND1); |
| 131 | 131 | int bit_no = (ls259_buf[0]<<2) | (ls259_buf[1]<<1) | (ls259_buf[2]<<0); |
| r1293 | r1294 | |
|---|---|---|
| 852 | 852 | REGION_SOUND1 |
| 853 | 853 | }; |
| 854 | 854 | |
| 855 | MACHINE_DRIVER_START( s23 ) | |
| 855 | static MACHINE_DRIVER_START( s23 ) | |
| 856 | 856 | |
| 857 | 857 | /* basic machine hardware */ |
| 858 | 858 | MDRV_CPU_ADD(R4650BE, 166000000) |
| r1293 | r1294 | |
| 862 | 862 | MDRV_CPU_ADD(H83002, 14745600 ) |
| 863 | 863 | MDRV_CPU_PROGRAM_MAP( s23h8rwmap, 0 ) |
| 864 | 864 | MDRV_CPU_IO_MAP( s23h8iomap, 0 ) |
| 865 | MDRV_CPU_VBLANK_INT( irq1_line_pulse, 1 ) | |
| 865 | MDRV_CPU_VBLANK_INT( irq1_line_pulse, 1 ) | |
| 866 | 866 | |
| 867 | 867 | MDRV_SCREEN_REFRESH_RATE(60) |
| 868 | 868 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| r1293 | r1294 | |
| 889 | 889 | MDRV_SOUND_ROUTE(3, "left", 1.00) |
| 890 | 890 | MACHINE_DRIVER_END |
| 891 | 891 | |
| 892 | MACHINE_DRIVER_START( ss23 ) | |
| 892 | static MACHINE_DRIVER_START( ss23 ) | |
| 893 | 893 | |
| 894 | 894 | /* basic machine hardware */ |
| 895 | 895 | MDRV_CPU_ADD(R4650BE, 166000000) |
| r1293 | r1294 | |
| 900 | 900 | MDRV_CPU_ADD(H83002, 14745600 ) |
| 901 | 901 | MDRV_CPU_PROGRAM_MAP( s23h8rwmap, 0 ) |
| 902 | 902 | MDRV_CPU_IO_MAP( s23h8iomap, 0 ) |
| 903 | MDRV_CPU_VBLANK_INT( irq1_line_pulse, 1 ) | |
| 903 | MDRV_CPU_VBLANK_INT( irq1_line_pulse, 1 ) | |
| 904 | 904 | |
| 905 | 905 | MDRV_SCREEN_REFRESH_RATE(60) |
| 906 | 906 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| r1293 | r1294 | |
|---|---|---|
| 39 | 39 | DAC_data_w(0,DACROM[(dac_bank * 0x10000 + dac_adr++) & 0x1ffff]); |
| 40 | 40 | |
| 41 | 41 | if (((dac_adr & 0xff00 ) >> 8) != dac_adr_e ) |
| 42 | | |
| 42 | | |
| 43 | 43 | else |
| 44 | 44 | dac_busy = 0; |
| 45 | 45 | } |
| r1293 | r1294 | |
|---|---|---|
| 238 | 238 | static INT16 *sampledata[8]; |
| 239 | 239 | static int samplelen[8]; |
| 240 | 240 | |
| 241 | void ninjakd2_init_samples(void) | |
| 241 | static void ninjakd2_init_samples(void) | |
| 242 | 242 | { |
| 243 | 243 | int i,n; |
| 244 | 244 | UINT8 *source = memory_region(REGION_SOUND1); |
| r1293 | r1294 | |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | |
| 258 | INTERRUPT_GEN( ninjakd2_interrupt ) | |
| 258 | static INTERRUPT_GEN( ninjakd2_interrupt ) | |
| 259 | 259 | { |
| 260 | 260 | cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0xd7); /* RST 10h */ |
| 261 | 261 | } |
| r1293 | r1294 | |
| 481 | 481 | MDRV_CPU_IO_MAP(ninjakd2_sound_io,0) |
| 482 | 482 | |
| 483 | 483 | MDRV_SCREEN_REFRESH_RATE(60) |
| 484 | MDRV_SCREEN_VBLANK_TIME( | |
| 484 | MDRV_SCREEN_VBLANK_TIME(A | |
| 485 | 485 | |
| 486 | 486 | /* video hardware */ |
| 487 | 487 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 117 | 117 | * |
| 118 | 118 | *************************************/ |
| 119 | 119 | |
| 120 | static | |
| 120 | static | |
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | static TIMER_CALLBACK( interrupt_callback ) |
| r1293 | r1294 | |
| 135 | 135 | else |
| 136 | 136 | next_vpos = SPACEFB_INT_TRIGGER_COUNT_1; |
| 137 | 137 | |
| 138 | | |
| 138 | | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | |
| 142 | 142 | static void create_interrupt_timer(void) |
| 143 | 143 | { |
| 144 | interrupt_timer = | |
| 144 | interrupt_timer = | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | static void start_interrupt_timer(void) |
| 149 | 149 | { |
| 150 | | |
| 150 | | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 |
| r1293 | r1294 | |
|---|---|---|
| 173 | 173 | static ADDRESS_MAP_START( cd32_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 174 | 174 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 175 | 175 | AM_RANGE(0x000000, 0x1fffff) AM_RAMBANK(1) AM_BASE(&amiga_chip_ram32) AM_SIZE(&amiga_chip_ram_size) |
| 176 | AM_RANGE(0x800000, 0x800003) AM_READ( dipswitch_r ) | |
| 176 | AM_RANGE(0x800000, 0x800003) AM_READ( dipswitch_r ) | |
| 177 | 177 | AM_RANGE(0xb80000, 0xb8003f) AM_READWRITE(amiga_akiko32_r, amiga_akiko32_w) |
| 178 | AM_RANGE(0xbfa000, 0xbfa003) AM_WRITE(aga_overlay_w) | |
| 178 | AM_RANGE(0xbfa000, 0xbfa003) AM_WRITE(aga_overlay_w) | |
| 179 | 179 | AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia32_r, amiga_cia32_w) |
| 180 | 180 | AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(amiga_custom32_r, amiga_custom32_w) AM_BASE((UINT32**)&amiga_custom_regs) |
| 181 | 181 | AM_RANGE(0xe00000, 0xe7ffff) AM_ROM AM_REGION(REGION_USER1, 0x80000) /* CD32 Extended ROM */ |
| r1293 | r1294 | |
| 271 | 271 | MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 312) |
| 272 | 272 | |
| 273 | 273 | MDRV_SCREEN_REFRESH_RATE(59.997) |
| 274 | MDRV_SCREEN_VBLANK_TIME( | |
| 274 | MDRV_SCREEN_VBLANK_TIME(A | |
| 275 | 275 | |
| 276 | 276 | MDRV_MACHINE_RESET(amiga) |
| 277 | 277 | MDRV_NVRAM_HANDLER(cd32) |
| r1293 | r1294 | |
|---|---|---|
| 537 | 537 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 538 | 538 | INPUT_PORTS_END |
| 539 | 539 | |
| 540 | static mame_timer* frame_timer; | |
| 541 | static mame_timer* scanline_timer; | |
| 540 | static emu_timer* frame_timer; | |
| 541 | static emu_timer* scanline_timer; | |
| 542 | 542 | |
| 543 | 543 | static TIMER_CALLBACK( frame_timer_callback ) |
| 544 | 544 | { |
| r1293 | r1294 | |
| 548 | 548 | static int scanline_counter = 0; |
| 549 | 549 | static int total_scanlines = 262; |
| 550 | 550 | |
| 551 | void render_background_to_render_buffer(int scanline) | |
| 551 | static void render_background_to_render_buffer(int scanline) | |
| 552 | 552 | { |
| 553 | 553 | int x; |
| 554 | 554 | UINT16 yscroll = (wheelfir_blitdata[0xb]&0x00ff) | (wheelfir_blitdata[0x8]&0x0080) << 1; |
| r1293 | r1294 | |
| 575 | 575 | { |
| 576 | 576 | scanline_counter++; |
| 577 | 577 | cpunum_set_input_line(0, 5, HOLD_LINE); // raster IRQ, changes scroll values for road |
| 578 | | |
| 578 | | |
| 579 | 579 | |
| 580 | 580 | if (scanline_counter<256) |
| 581 | 581 | { |
| r1293 | r1294 | |
| 606 | 606 | scanline_counter = -1; |
| 607 | 607 | fillbitmap(wheelfir_tmp_bitmap[0], 0,&machine->screen[0].visarea); |
| 608 | 608 | |
| 609 | mame_timer_adjust(frame_timer, time_zero, 0, time_zero); | |
| 610 | mame_timer_adjust(scanline_timer, time_zero, 0, time_zero); | |
| 609 | timer_adjust(frame_timer, attotime_zero, 0, attotime_zero); | |
| 610 | timer_adjust(scanline_timer, attotime_zero, 0, attotime_zero); | |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | static MACHINE_RESET(wheelfir) |
| 614 | 614 | { |
| 615 | frame_timer = mame_timer_alloc(frame_timer_callback); | |
| 616 | scanline_timer = mame_timer_alloc(scanline_timer_callback); | |
| 617 | mame_timer_adjust(frame_timer, time_zero, 0, time_zero); | |
| 618 | mame_timer_adjust(scanline_timer, time_zero, 0, time_zero); | |
| 615 | frame_timer = timer_alloc(frame_timer_callback); | |
| 616 | scanline_timer = timer_alloc(scanline_timer_callback); | |
| 617 | timer_adjust(frame_timer, attotime_zero, 0, attotime_zero); | |
| 618 | timer_adjust(scanline_timer, attotime_zero, 0, attotime_zero); | |
| 619 | 619 | scanline_counter = -1; |
| 620 | 620 | } |
| 621 | 621 |
| r1293 | r1294 | |
|---|---|---|
| 351 | 351 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 352 | 352 | |
| 353 | 353 | MDRV_SCREEN_REFRESH_RATE(58) |
| 354 | MDRV_SCREEN_VBLANK_TIME( | |
| 354 | MDRV_SCREEN_VBLANK_TIME(A | |
| 355 | 355 | |
| 356 | 356 | /* video hardware */ |
| 357 | 357 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
|---|---|---|
| 470 | 470 | return 0; |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | INTERRUPT_GEN( bballoon_interrupt ) | |
| 473 | static INTERRUPT_GEN( bballoon_interrupt ) | |
| 474 | 474 | { |
| 475 | 475 | if(irq_en) |
| 476 | 476 | cpunum_set_input_line(0, ARM7_IRQ_LINE, PULSE_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 301 | 301 | |
| 302 | 302 | // Palette: HMC HM86171 VGA 256 colour RAMDAC |
| 303 | 303 | |
| 304 | int dunhuang_paloffs; | |
| 304 | static int dunhuang_paloffs; | |
| 305 | 305 | static WRITE8_HANDLER( dunhuang_paloffs_w ) { dunhuang_paloffs = data * 3; } |
| 306 | 306 | static WRITE8_HANDLER( dunhuang_paldata_w ) |
| 307 | 307 | { |
| r1293 | r1294 | |
| 441 | 441 | |
| 442 | 442 | static INPUT_PORTS_START( dunhuang ) |
| 443 | 443 | PORT_START // IN0 - DSW1 |
| 444 | PORT_DIPNAME( 0x0f, 0x0f, "Main Game Chance (%)" ) | |
| 444 | PORT_DIPNAME( 0x0f, 0x0f, "Main Game Chance (%)" ) PORT_DIPLOCATION("SW1:1,2,3,4") | |
| 445 | 445 | PORT_DIPSETTING( 0x00, "78" ) |
| 446 | 446 | PORT_DIPSETTING( 0x01, "80" ) |
| 447 | 447 | PORT_DIPSETTING( 0x02, "81" ) |
| r1293 | r1294 | |
| 458 | 458 | PORT_DIPSETTING( 0x0d, "96" ) |
| 459 | 459 | PORT_DIPSETTING( 0x0e, "97" ) |
| 460 | 460 | PORT_DIPSETTING( 0x0f, "98" ) |
| 461 | PORT_DIPNAME( 0x30, 0x30, "Main Game Rate" ) | |
| 461 | PORT_DIPNAME( 0x30, 0x30, "Main Game Rate" ) PORT_DIPLOCATION("SW1:5,6") | |
| 462 | 462 | PORT_DIPSETTING( 0x30, "A" ) |
| 463 | 463 | PORT_DIPSETTING( 0x20, "B" ) |
| 464 | 464 | PORT_DIPSETTING( 0x10, "C" ) |
| 465 | 465 | PORT_DIPSETTING( 0x00, "D" ) |
| 466 | PORT_DIPNAME( 0x40, 0x40, "Input Tokens" ) | |
| 466 | PORT_DIPNAME( 0x40, 0x40, "Input Tokens" ) PORT_DIPLOCATION("SW1:7") | |
| 467 | 467 | PORT_DIPSETTING( 0x40, "Keys" ) |
| 468 | 468 | PORT_DIPSETTING( 0x00, "Coins" ) |
| 469 | PORT_DIPNAME( 0x80, 0x80, "Output Tokens" ) | |
| 469 | PORT_DIPNAME( 0x80, 0x80, "Output Tokens" ) PORT_DIPLOCATION("SW1:8") | |
| 470 | 470 | PORT_DIPSETTING( 0x80, "Keys" ) |
| 471 | 471 | PORT_DIPSETTING( 0x00, "Payout" ) |
| 472 | 472 | |
| 473 | 473 | PORT_START // IN1 - DSW2 |
| 474 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 475 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 476 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 477 | PORT_DIPNAME( 0x06, 0x06, "Credits Per Coin" ) | |
| 474 | PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW2:1" ) | |
| 475 | PORT_DIPNAME( 0x06, 0x06, "Credits Per Coin" ) PORT_DIPLOCATION("SW2:2,3") | |
| 478 | 476 | PORT_DIPSETTING( 0x06, "1" ) |
| 479 | 477 | PORT_DIPSETTING( 0x04, "2" ) |
| 480 | 478 | PORT_DIPSETTING( 0x02, "5" ) |
| 481 | 479 | PORT_DIPSETTING( 0x00, "20" ) |
| 482 | PORT_DIPNAME( 0x18, 0x18, "Credits Per Key-In" ) | |
| 480 | PORT_DIPNAME( 0x18, 0x18, "Credits Per Key-In" ) PORT_DIPLOCATION("SW2:4,5") | |
| 483 | 481 | PORT_DIPSETTING( 0x18, "1" ) |
| 484 | 482 | PORT_DIPSETTING( 0x10, "10" ) |
| 485 | 483 | PORT_DIPSETTING( 0x08, "50" ) |
| 486 | 484 | PORT_DIPSETTING( 0x00, "100" ) |
| 487 | PORT_DIPNAME( 0x20, 0x20, "Credits Per Key-Out" ) | |
| 485 | PORT_DIPNAME( 0x20, 0x20, "Credits Per Key-Out" ) PORT_DIPLOCATION("SW2:6") | |
| 488 | 486 | PORT_DIPSETTING( 0x20, "1" ) |
| 489 | 487 | PORT_DIPSETTING( 0x00, "100" ) |
| 490 | PORT_DIPNAME( 0xc0, 0xc0, "Max Credits" ) | |
| 488 | PORT_DIPNAME( 0xc0, 0xc0, "Max Credits" ) PORT_DIPLOCATION("SW2:7,8") | |
| 491 | 489 | PORT_DIPSETTING( 0x00, "300" ) |
| 492 | 490 | PORT_DIPSETTING( 0x40, "500" ) |
| 493 | 491 | PORT_DIPSETTING( 0x80, "1000" ) |
| 494 | 492 | PORT_DIPSETTING( 0xc0, "3000" ) |
| 495 | 493 | |
| 496 | 494 | PORT_START // IN2 - DSW3 |
| 497 | PORT_DIPNAME( 0x03, 0x03, "Min Bet" ) | |
| 495 | PORT_DIPNAME( 0x03, 0x03, "Min Bet" ) PORT_DIPLOCATION("SW3:1,2") | |
| 498 | 496 | PORT_DIPSETTING( 0x03, "1" ) |
| 499 | 497 | PORT_DIPSETTING( 0x02, "2" ) |
| 500 | 498 | PORT_DIPSETTING( 0x01, "3" ) |
| 501 | 499 | PORT_DIPSETTING( 0x00, "5" ) |
| 502 | PORT_DIPNAME( 0x0c, 0x0c, "Max Bet" ) | |
| 500 | PORT_DIPNAME( 0x0c, 0x0c, "Max Bet" ) PORT_DIPLOCATION("SW3:3,4") | |
| 503 | 501 | PORT_DIPSETTING( 0x0c, "1" ) |
| 504 | 502 | PORT_DIPSETTING( 0x08, "5" ) |
| 505 | 503 | PORT_DIPSETTING( 0x04, "10" ) |
| 506 | 504 | PORT_DIPSETTING( 0x00, "20" ) |
| 507 | PORT_DIPNAME( 0x30, 0x30, "Renso Bonus Time" ) | |
| 505 | PORT_DIPNAME( 0x30, 0x30, "Renso Bonus Time" ) PORT_DIPLOCATION("SW3:5,6") | |
| 508 | 506 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 509 | 507 | PORT_DIPSETTING( 0x10, "3" ) |
| 510 | 508 | PORT_DIPSETTING( 0x20, "5" ) |
| 511 | 509 | PORT_DIPSETTING( 0x30, "6" ) |
| 512 | PORT_DIPNAME( 0xc0, 0xc0, "DonDen Times" ) | |
| 510 | PORT_DIPNAME( 0xc0, 0xc0, "DonDen Times" ) PORT_DIPLOCATION("SW3:7,8") | |
| 513 | 511 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 514 | 512 | PORT_DIPSETTING( 0x40, "3" ) |
| 515 | 513 | PORT_DIPSETTING( 0x80, "5" ) |
| 516 | 514 | PORT_DIPSETTING( 0xc0, "6" ) |
| 517 | 515 | |
| 518 | 516 | PORT_START // IN3 - DSW4 |
| 519 | PORT_DIPNAME( 0x07, 0x07, "Credits Limit" ) | |
| 517 | PORT_DIPNAME( 0x07, 0x07, "Credits Limit" ) PORT_DIPLOCATION("SW4:1,2,3") | |
| 520 | 518 | PORT_DIPSETTING( 0x07, "2k" ) |
| 521 | 519 | PORT_DIPSETTING( 0x06, "3k" ) |
| 522 | 520 | PORT_DIPSETTING( 0x05, "5k" ) |
| r1293 | r1294 | |
| 525 | 523 | PORT_DIPSETTING( 0x02, "30k" ) |
| 526 | 524 | PORT_DIPSETTING( 0x01, "50k" ) |
| 527 | 525 | PORT_DIPSETTING( 0x00, "100k" ) |
| 528 | PORT_DIPNAME( 0x38, 0x38, "Service-In Limit" ) | |
| 526 | PORT_DIPNAME( 0x38, 0x38, "Service-In Limit" ) PORT_DIPLOCATION("SW4:4,5,6") | |
| 529 | 527 | PORT_DIPSETTING( 0x00, "20k" ) |
| 530 | 528 | PORT_DIPSETTING( 0x08, "30k" ) |
| 531 | 529 | PORT_DIPSETTING( 0x10, "40k" ) |
| r1293 | r1294 | |
| 534 | 532 | PORT_DIPSETTING( 0x28, "100k" ) |
| 535 | 533 | PORT_DIPSETTING( 0x30, "200k" ) |
| 536 | 534 | PORT_DIPSETTING( 0x38, "990k" ) |
| 537 | PORT_DIPNAME( 0x40, 0x40, "Hu Type" ) | |
| 535 | PORT_DIPNAME( 0x40, 0x40, "Hu Type" ) PORT_DIPLOCATION("SW4:7") | |
| 538 | 536 | PORT_DIPSETTING( 0x40, "Topple" ) |
| 539 | 537 | PORT_DIPSETTING( 0x00, "Non-Topple" ) |
| 540 | PORT_DIPNAME( 0x80, 0x80, "Double Up" ) | |
| 538 | PORT_DIPNAME( 0x80, 0x80, "Double Up" ) PORT_DIPLOCATION("SW4:8") | |
| 541 | 539 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 542 | 540 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 543 | 541 | |
| 544 | 542 | PORT_START // IN4 - DSW5 |
| 545 | PORT_DIPNAME( 0x03, 0x03, "Douple Up Chance (%)" ) | |
| 543 | PORT_DIPNAME( 0x03, 0x03, "Douple Up Chance (%)" ) PORT_DIPLOCATION("SW5:1,2") | |
| 546 | 544 | PORT_DIPSETTING( 0x00, "50" ) |
| 547 | 545 | PORT_DIPSETTING( 0x01, "60" ) |
| 548 | 546 | PORT_DIPSETTING( 0x02, "70" ) |
| 549 | 547 | PORT_DIPSETTING( 0x03, "80" ) |
| 550 | PORT_DIPNAME( 0x04, 0x04, "Chinese Word" ) | |
| 548 | PORT_DIPNAME( 0x04, 0x04, "Chinese Word" ) PORT_DIPLOCATION("SW5:3") | |
| 551 | 549 | PORT_DIPSETTING( 0x04, "3..6" ) |
| 552 | 550 | PORT_DIPSETTING( 0x00, "5..10" ) |
| 553 | PORT_DIPNAME( 0x08, 0x08, "Big Odds Times" ) | |
| 551 | PORT_DIPNAME( 0x08, 0x08, "Big Odds Times" ) PORT_DIPLOCATION("SW5:4") | |
| 554 | 552 | PORT_DIPSETTING( 0x00, "3" ) |
| 555 | 553 | PORT_DIPSETTING( 0x08, "5" ) |
| 556 | PORT_DIPNAME( 0x30, 0x30, "Hu Test Times" ) | |
| 554 | PORT_DIPNAME( 0x30, 0x30, "Hu Test Times" ) PORT_DIPLOCATION("SW5:5,6") | |
| 557 | 555 | PORT_DIPSETTING( 0x30, DEF_STR( None ) ) |
| 558 | 556 | PORT_DIPSETTING( 0x00, "5" ) |
| 559 | 557 | PORT_DIPSETTING( 0x10, "6" ) |
| 560 | 558 | PORT_DIPSETTING( 0x20, "8" ) |
| 561 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) | |
| 559 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW5:7") | |
| 562 | 560 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 563 | 561 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 564 | PORT_DIPNAME( 0x80, 0x80, "Computer Strength" ) | |
| 562 | PORT_DIPNAME( 0x80, 0x80, "Computer Strength" ) PORT_DIPLOCATION("SW5:8") | |
| 565 | 563 | PORT_DIPSETTING( 0x80, "Strong" ) |
| 566 | 564 | PORT_DIPSETTING( 0x00, "Weak" ) |
| 567 | 565 | |
| 568 | 566 | PORT_START // IN5 - SERVICE |
| 569 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3 ) // clear (during boot) | |
| 570 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE2 ) // book | |
| 571 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) // test (in game: dips, during boot: service mode) | |
| 572 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) // hopper sensor | |
| 573 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE4 ) // payout | |
| 567 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3 ) // clear (during boot) | |
| 568 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE2 ) // book | |
| 569 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) // test (in game: dips, during boot: service mode) | |
| 570 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) // hopper sensor | |
| 571 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE4 ) // payout | |
| 574 | 572 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) // "coin jam" otherwise |
| 575 | 573 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 576 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) // 0 = tiles block transferrer busy | |
| 574 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) // 0 = tiles block transferrer busy | |
| 577 | 575 | |
| 578 | 576 | PORT_START // IN6 - P1 |
| 579 | 577 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) |
| r1293 | r1294 | |
| 590 | 588 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) |
| 591 | 589 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J ) |
| 592 | 590 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) |
| 593 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_R | |
| 591 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) // tin | |
| 594 | 592 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) |
| 595 | 593 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 596 | 594 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r1293 | r1294 | |
| 599 | 597 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) |
| 600 | 598 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) |
| 601 | 599 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) |
| 602 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) // eat | |
| 603 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) // hu | |
| 600 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) // eat | |
| 601 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) // hu | |
| 604 | 602 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 605 | 603 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 606 | 604 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r1293 | r1294 | |
| 609 | 607 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) |
| 610 | 608 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) |
| 611 | 609 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L ) |
| 612 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) | |
| 610 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) // pon | |
| 613 | 611 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 614 | 612 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 615 | 613 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r1293 | r1294 | |
| 679 | 677 | |
| 680 | 678 | MDRV_SCREEN_REFRESH_RATE(60) |
| 681 | 679 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| 682 | MDRV_WATCHDOG_TIME_INIT( | |
| 680 | MDRV_WATCHDOG_TIME_INIT( | |
| 683 | 681 | |
| 684 | 682 | /* video hardware */ |
| 685 | 683 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER ) |
| r1293 | r1294 | |
|---|---|---|
| 273 | 273 | MDRV_CPU_IO_MAP(sound_cpu_io,0) |
| 274 | 274 | |
| 275 | 275 | MDRV_SCREEN_REFRESH_RATE(60) |
| 276 | MDRV_SCREEN_VBLANK_TIME( | |
| 276 | MDRV_SCREEN_VBLANK_TIME(A | |
| 277 | 277 | |
| 278 | 278 | /* video hardware */ |
| 279 | 279 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 185 | 185 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 186 | 186 | |
| 187 | 187 | MDRV_SCREEN_REFRESH_RATE(60) |
| 188 | MDRV_SCREEN_VBLANK_TIME( | |
| 188 | MDRV_SCREEN_VBLANK_TIME(A | |
| 189 | 189 | |
| 190 | 190 | /* video hardware */ |
| 191 | 191 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_AFTER_VBLANK) |
| r1293 | r1294 | |
|---|---|---|
| 527 | 527 | MDRV_CPU_VBLANK_INT(nmi_line_pulse,16) |
| 528 | 528 | |
| 529 | 529 | MDRV_SCREEN_REFRESH_RATE(60) |
| 530 | MDRV_SCREEN_VBLANK_TIME( | |
| 530 | MDRV_SCREEN_VBLANK_TIME(A | |
| 531 | 531 | MDRV_INTERLEAVE(200) |
| 532 | 532 | |
| 533 | 533 | /* video hardware */ |
| r1293 | r1294 | |
| 597 | 597 | MDRV_CPU_VBLANK_INT(nmi_line_pulse,16) |
| 598 | 598 | |
| 599 | 599 | MDRV_SCREEN_REFRESH_RATE(60) |
| 600 | MDRV_SCREEN_VBLANK_TIME( | |
| 600 | MDRV_SCREEN_VBLANK_TIME(A | |
| 601 | 601 | MDRV_INTERLEAVE(200) |
| 602 | 602 | |
| 603 | 603 | /* video hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | int cvs_speech_rom_read_bit(void) | |
| 185 | static int cvs_speech_rom_read_bit(void) | |
| 186 | 186 | { |
| 187 | 187 | UINT8 *ROM = memory_region(REGION_SOUND1); |
| 188 | 188 | int bit; |
| r1293 | r1294 | |
| 381 | 381 | MDRV_CPU_IO_MAP(cvs_cpu2_io,0) |
| 382 | 382 | |
| 383 | 383 | MDRV_SCREEN_REFRESH_RATE(60) |
| 384 | MDRV_SCREEN_VBLANK_TIME( | |
| 384 | MDRV_SCREEN_VBLANK_TIME(A | |
| 385 | 385 | |
| 386 | 386 | /* video hardware */ |
| 387 | 387 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 1416 | 1416 | * |
| 1417 | 1417 | *************************************/ |
| 1418 | 1418 | |
| 1419 | void turbo_rom_decode(void) | |
| 1419 | static void turbo_rom_decode(void) | |
| 1420 | 1420 | { |
| 1421 | 1421 | /* |
| 1422 | 1422 | * The table is arranged this way (second half is mirror image of first) |
| r1293 | r1294 | |
|---|---|---|
| 1238 | 1238 | timer(uPD71054) struct |
| 1239 | 1239 | ------------------------------*/ |
| 1240 | 1240 | static struct st_chip { |
| 1241 | | |
| 1241 | | |
| 1242 | 1242 | UINT16 max[3]; // Max counter |
| 1243 | 1243 | UINT16 write_select; // Max counter write select |
| 1244 | 1244 | UINT8 reg[4]; // |
| r1293 | r1294 | |
| 1247 | 1247 | /*------------------------------ |
| 1248 | 1248 | uppdate timer |
| 1249 | 1249 | ------------------------------*/ |
| 1250 | void uPD71054_update_timer( int no ) | |
| 1250 | static void uPD71054_update_timer( int no ) | |
| 1251 | 1251 | { |
| 1252 | 1252 | UINT16 max = uPD71054.max[no]&0xffff; |
| 1253 | 1253 | |
| 1254 | 1254 | if( max != 0 ) { |
| 1255 | mame_time period = scale_up_mame_time(MAME_TIME_IN_HZ(Machine->drv->cpu[0].clock), 16 * max); | |
| 1256 | mame_timer_adjust( uPD71054.timer[no], period, no, time_zero ); | |
| 1255 | attotime period = attotime_mul(ATTOTIME_IN_HZ(Machine->drv->cpu[0].clock), 16 * max); | |
| 1256 | timer_adjust( uPD71054.timer[no], period, no, attotime_zero ); | |
| 1257 | 1257 | } else { |
| 1258 | | |
| 1258 | | |
| 1259 | 1259 | logerror( "CPU #0 PC %06X: uPD71054 error, timer %d duration is 0\n", |
| 1260 | 1260 | activecpu_get_pc(), no ); |
| 1261 | 1261 | } |
| r1293 | r1294 | |
| 1277 | 1277 | /*------------------------------ |
| 1278 | 1278 | initialize |
| 1279 | 1279 | ------------------------------*/ |
| 1280 | void uPD71054_timer_init( void ) | |
| 1280 | static void uPD71054_timer_init( void ) | |
| 1281 | 1281 | { |
| 1282 | 1282 | int no; |
| 1283 | 1283 | |
| r1293 | r1294 | |
| 1287 | 1287 | uPD71054.max[no] = 0xffff; |
| 1288 | 1288 | } |
| 1289 | 1289 | for( no = 0; no < USED_TIMER_NUM; no++ ) { |
| 1290 | uPD71054.timer[no] = | |
| 1290 | uPD71054.timer[no] = | |
| 1291 | 1291 | } |
| 1292 | 1292 | } |
| 1293 | 1293 | |
| r1293 | r1294 | |
| 1609 | 1609 | { |
| 1610 | 1610 | soundlatch_word_w(0,data,mem_mask); |
| 1611 | 1611 | cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE); |
| 1612 | cpu_spinuntil_time( | |
| 1612 | cpu_spinuntil_time( | |
| 1613 | 1613 | } |
| 1614 | 1614 | } |
| 1615 | 1615 | |
| r1293 | r1294 | |
| 2489 | 2489 | Pro Mahjong Kiwame |
| 2490 | 2490 | ***************************************************************************/ |
| 2491 | 2491 | |
| 2492 | UINT16 *kiwame_nvram; | |
| 2492 | static UINT16 *kiwame_nvram; | |
| 2493 | 2493 | |
| 2494 | 2494 | static READ16_HANDLER( kiwame_nvram_r ) |
| 2495 | 2495 | { |
| r1293 | r1294 | |
| 2840 | 2840 | static WRITE8_HANDLER( calibr50_soundlatch2_w ) |
| 2841 | 2841 | { |
| 2842 | 2842 | soundlatch2_w(0,data); |
| 2843 | cpu_spinuntil_time( | |
| 2843 | cpu_spinuntil_time( | |
| 2844 | 2844 | } |
| 2845 | 2845 | |
| 2846 | 2846 | static ADDRESS_MAP_START( calibr50_sub_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r1293 | r1294 | |
| 6533 | 6533 | */ |
| 6534 | 6534 | |
| 6535 | 6535 | #define calibr50_INTERRUPTS_NUM (4+1) |
| 6536 | INTERRUPT_GEN( calibr50_interrupt ) | |
| 6536 | static INTERRUPT_GEN( calibr50_interrupt ) | |
| 6537 | 6537 | { |
| 6538 | 6538 | switch (cpu_getiloops()) |
| 6539 | 6539 | { |
| r1293 | r1294 | |
| 8858 | 8858 | |
| 8859 | 8859 | |
| 8860 | 8860 | /* Protection? NVRAM is handled writing commands here */ |
| 8861 | UINT16 downtown_protection[0x200/2]; | |
| 8861 | static UINT16 downtown_protection[0x200/2]; | |
| 8862 | 8862 | static READ16_HANDLER( downtown_protection_r ) |
| 8863 | 8863 | { |
| 8864 | 8864 | int job = downtown_protection[0xf8/2] & 0xff; |
| r1293 | r1294 | |
|---|---|---|
| 155 | 155 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) |
| 156 | 156 | MDRV_CPU_VBLANK_INT(truco_interrupt,1) |
| 157 | 157 | |
| 158 | MDRV_MACHINE_RESET(truco) | |
| 158 | MDRV_MACHINE_RESET(truco) | |
| 159 | 159 | |
| 160 | 160 | /* video hardware */ |
| 161 | 161 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 220 | 220 | /* Kaos sits in a tight loop polling the VIA irq flags register, but that register is |
| 221 | 221 | cleared by the irq handler. Therefore, I wait a bit before triggering the irq to |
| 222 | 222 | leave time for the program to see the flag change. */ |
| 223 | | |
| 223 | | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 |
| r1293 | r1294 | |
|---|---|---|
| 234 | 234 | static INT16 *sampledata[MAX_SAMPLES]; |
| 235 | 235 | static int samplesize[MAX_SAMPLES]; |
| 236 | 236 | |
| 237 | void kageki_init_samples(void) | |
| 237 | static void kageki_init_samples(void) | |
| 238 | 238 | { |
| 239 | 239 | UINT8 *scan, *src; |
| 240 | 240 | INT16 *dest; |
| r1293 | r1294 | |
|---|---|---|
| 822 | 822 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 823 | 823 | |
| 824 | 824 | MDRV_SCREEN_REFRESH_RATE(58) |
| 825 | MDRV_SCREEN_VBLANK_TIME( | |
| 825 | MDRV_SCREEN_VBLANK_TIME(A | |
| 826 | 826 | |
| 827 | 827 | /* video hardware */ |
| 828 | 828 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
| 865 | 865 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 866 | 866 | |
| 867 | 867 | MDRV_SCREEN_REFRESH_RATE(58) |
| 868 | MDRV_SCREEN_VBLANK_TIME( | |
| 868 | MDRV_SCREEN_VBLANK_TIME(A | |
| 869 | 869 | |
| 870 | 870 | /* video hardware */ |
| 871 | 871 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM ) |
| r1293 | r1294 | |
| 908 | 908 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 909 | 909 | |
| 910 | 910 | MDRV_SCREEN_REFRESH_RATE(58) |
| 911 | MDRV_SCREEN_VBLANK_TIME( | |
| 911 | MDRV_SCREEN_VBLANK_TIME(A | |
| 912 | 912 | |
| 913 | 913 | /* video hardware */ |
| 914 | 914 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM ) |
| r1293 | r1294 | |
| 951 | 951 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 952 | 952 | |
| 953 | 953 | MDRV_SCREEN_REFRESH_RATE(58) |
| 954 | MDRV_SCREEN_VBLANK_TIME( | |
| 954 | MDRV_SCREEN_VBLANK_TIME(A | |
| 955 | 955 | |
| 956 | 956 | /* video hardware */ |
| 957 | 957 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
|---|---|---|
| 19 | 19 | extern VIDEO_UPDATE( higemaru ); |
| 20 | 20 | |
| 21 | 21 | |
| 22 | INTERRUPT_GEN( higemaru_interrupt ) | |
| 22 | static INTERRUPT_GEN( higemaru_interrupt ) | |
| 23 | 23 | { |
| 24 | 24 | if (cpu_getiloops() == 0) |
| 25 | 25 | cpunum_set_input_line_and_vector(0,0,HOLD_LINE,0xcf); /* RST 08h */ |
| r1293 | r1294 | |
|---|---|---|
| 681 | 681 | GFXDECODE_ENTRY( REGION_GFX2, 0, bglayout, 0x0000, 64 ) |
| 682 | 682 | GFXDECODE_END |
| 683 | 683 | |
| 684 | MACHINE_DRIVER_START( plygonet ) | |
| 684 | static MACHINE_DRIVER_START( plygonet ) | |
| 685 | 685 | MDRV_CPU_ADD(M68EC020, 16000000) /* 16 MHz (xtal is 32.0 MHz) */ |
| 686 | 686 | MDRV_CPU_PROGRAM_MAP(polygonet_map, 0) |
| 687 | 687 | MDRV_CPU_VBLANK_INT(polygonet_interrupt, 2) |
| r1293 | r1294 | |
|---|---|---|
| 1076 | 1076 | irq_handler |
| 1077 | 1077 | }; |
| 1078 | 1078 | |
| 1079 | INTERRUPT_GEN( interrupt_afega ) | |
| 1079 | static INTERRUPT_GEN( interrupt_afega ) | |
| 1080 | 1080 | { |
| 1081 | 1081 | switch ( cpu_getiloops() ) |
| 1082 | 1082 | { |
| r1293 | r1294 | |
| 1212 | 1212 | MACHINE_DRIVER_END |
| 1213 | 1213 | |
| 1214 | 1214 | |
| 1215 | INTERRUPT_GEN( interrupt_twinactn ) | |
| 1215 | static INTERRUPT_GEN( interrupt_twinactn ) | |
| 1216 | 1216 | { |
| 1217 | 1217 | switch ( cpu_getiloops() ) |
| 1218 | 1218 | { |
| r1293 | r1294 | |
|---|---|---|
| 480 | 480 | static MACHINE_DRIVER_START( naomi ) |
| 481 | 481 | /* basic machine hardware */ |
| 482 | 482 | MDRV_CPU_ADD_TAG("main", SH4, CPU_CLOCK) // SH4!!! |
| 483 | MDRV_CPU_CONFIG(sh4cpu_config) | |
| 483 | MDRV_CPU_CONFIG(sh4cpu_config) | |
| 484 | 484 | MDRV_CPU_PROGRAM_MAP(naomi_map,0) |
| 485 | 485 | |
| 486 | 486 | MDRV_CPU_ADD_TAG("sound", ARM7, 45000000) |
| r1293 | r1294 | |
|---|---|---|
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | |
| 94 | INTERRUPT_GEN( nemesis_interrupt ) | |
| 94 | static INTERRUPT_GEN( nemesis_interrupt ) | |
| 95 | 95 | { |
| 96 | 96 | if (irq_on) |
| 97 | 97 | cpunum_set_input_line(0, 1, HOLD_LINE); |
| r1293 | r1294 | |
| 108 | 108 | |
| 109 | 109 | static int gx400_irq1_cnt; |
| 110 | 110 | |
| 111 | INTERRUPT_GEN( konamigt_interrupt ) | |
| 111 | static INTERRUPT_GEN( konamigt_interrupt ) | |
| 112 | 112 | { |
| 113 | 113 | if (cpu_getiloops() == 0) |
| 114 | 114 | { |
| r1293 | r1294 | |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | INTERRUPT_GEN( gx400_interrupt ) | |
| 123 | static INTERRUPT_GEN( gx400_interrupt ) | |
| 124 | 124 | { |
| 125 | 125 | switch (cpu_getiloops()) |
| 126 | 126 | { |
| r1293 | r1294 | |
| 177 | 177 | |
| 178 | 178 | |
| 179 | 179 | |
| 180 | INTERRUPT_GEN( salamand_interrupt ) | |
| 180 | static INTERRUPT_GEN( salamand_interrupt ) | |
| 181 | 181 | { |
| 182 | 182 | if (irq_on) |
| 183 | 183 | cpunum_set_input_line(0, 1, HOLD_LINE); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | INTERRUPT_GEN( blkpnthr_interrupt ) | |
| 186 | static INTERRUPT_GEN( blkpnthr_interrupt ) | |
| 187 | 187 | { |
| 188 | 188 | if (irq_on) |
| 189 | 189 | cpunum_set_input_line(0, 2, HOLD_LINE); |
| r1293 | r1294 | |
| 2247 | 2247 | MDRV_CPU_PROGRAM_MAP(sal_sound_readmem,sal_sound_writemem) |
| 2248 | 2248 | |
| 2249 | 2249 | MDRV_SCREEN_REFRESH_RATE((18432000.0/4)/(288*264)) /* 60.606060 Hz */ |
| 2250 | MDRV_SCREEN_VBLANK_TIME( | |
| 2250 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2251 | 2251 | |
| 2252 | 2252 | MDRV_MACHINE_RESET(nemesis) |
| 2253 | 2253 |
| r1293 | r1294 | |
|---|---|---|
| 209 | 209 | // MDRV_CPU_VBLANK_INT(nmi_line_pulse,16) |
| 210 | 210 | |
| 211 | 211 | MDRV_SCREEN_REFRESH_RATE(57) |
| 212 | MDRV_SCREEN_VBLANK_TIME( | |
| 212 | MDRV_SCREEN_VBLANK_TIME(A | |
| 213 | 213 | |
| 214 | 214 | /* video hardware */ |
| 215 | 215 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 26 | 26 | static UINT8 LS74_q = 0; |
| 27 | 27 | static UINT8 gain_control = 0; |
| 28 | 28 | |
| 29 | static | |
| 29 | static | |
| 30 | 30 | |
| 31 | 31 | static WRITE16_HANDLER( magmax_sound_w ) |
| 32 | 32 | { |
| r1293 | r1294 | |
| 68 | 68 | scanline += 128; |
| 69 | 69 | scanline &= 255; |
| 70 | 70 | |
| 71 | | |
| 71 | | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | static MACHINE_START( magmax ) |
| 75 | 75 | { |
| 76 | 76 | /* Create interrupt timer */ |
| 77 | interrupt_timer = | |
| 77 | interrupt_timer = | |
| 78 | 78 | |
| 79 | 79 | /* Set up save state */ |
| 80 | 80 | state_save_register_global(sound_latch); |
| r1293 | r1294 | |
| 85 | 85 | |
| 86 | 86 | static MACHINE_RESET( magmax ) |
| 87 | 87 | { |
| 88 | | |
| 88 | | |
| 89 | 89 | |
| 90 | 90 | #if 0 |
| 91 | 91 | { |
| r1293 | r1294 | |
|---|---|---|
| 251 | 251 | |
| 252 | 252 | UINT32* stv_workram_l; |
| 253 | 253 | UINT32* stv_workram_h; |
| 254 | UINT32* stv_backupram; | |
| 254 | static UINT32* stv_backupram; | |
| 255 | 255 | extern UINT32* stv_scu; |
| 256 | 256 | static UINT32* ioga; |
| 257 | 257 | static UINT16* scsp_regs; |
| r1293 | r1294 | |
| 292 | 292 | |
| 293 | 293 | |
| 294 | 294 | int minit_boost,sinit_boost; |
| 295 | ||
| 295 | ||
| 296 | 296 | |
| 297 | 297 | static int scanline; |
| 298 | 298 | |
| r1293 | r1294 | |
| 2049 | 2049 | static WRITE32_HANDLER( minit_w ) |
| 2050 | 2050 | { |
| 2051 | 2051 | logerror("cpu #%d (PC=%08X) MINIT write = %08x\n",cpu_getactivecpu(), activecpu_get_pc(),data); |
| 2052 | cpu_boost_interleave(minit_boost_timeslice, | |
| 2052 | cpu_boost_interleave(minit_boost_timeslice, | |
| 2053 | 2053 | cpu_trigger(1000); |
| 2054 | 2054 | cpunum_set_info_int(1, CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE); |
| 2055 | 2055 | } |
| r1293 | r1294 | |
| 2057 | 2057 | static WRITE32_HANDLER( sinit_w ) |
| 2058 | 2058 | { |
| 2059 | 2059 | logerror("cpu #%d (PC=%08X) SINIT write = %08x\n",cpu_getactivecpu(), activecpu_get_pc(),data); |
| 2060 | cpu_boost_interleave(sinit_boost_timeslice, | |
| 2060 | cpu_boost_interleave(sinit_boost_timeslice, | |
| 2061 | 2061 | cpunum_set_info_int(0, CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE); |
| 2062 | 2062 | } |
| 2063 | 2063 | |
| r1293 | r1294 | |
| 2499 | 2499 | /* amount of time to boost interleave for on MINIT / SINIT, needed for communication to work */ |
| 2500 | 2500 | minit_boost = 400; |
| 2501 | 2501 | sinit_boost = 400; |
| 2502 | minit_boost_timeslice = time_zero; | |
| 2503 | sinit_boost_timeslice = time_zero; | |
| 2502 | minit_boost_timeslice = attotime_zero; | |
| 2503 | sinit_boost_timeslice = attotime_zero; | |
| 2504 | 2504 | |
| 2505 | 2505 | smpc_ram = auto_malloc (0x80); |
| 2506 | 2506 | stv_scu = auto_malloc (0x100); |
| r1293 | r1294 | |
| 2743 | 2743 | MDRV_CPU_PROGRAM_MAP(sound_mem, 0) |
| 2744 | 2744 | |
| 2745 | 2745 | MDRV_SCREEN_REFRESH_RATE(60) |
| 2746 | MDRV_SCREEN_VBLANK_TIME( | |
| 2746 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2747 | 2747 | |
| 2748 | 2748 | MDRV_MACHINE_START(stv) |
| 2749 | 2749 | MDRV_MACHINE_RESET(stv) |
| r1293 | r1294 | |
|---|---|---|
| 230 | 230 | |
| 231 | 231 | /* MEGATECH specific */ |
| 232 | 232 | |
| 233 | UINT8 mt_cart_select_reg; | |
| 233 | static UINT8 mt_cart_select_reg; | |
| 234 | 234 | |
| 235 | 235 | static READ8_HANDLER( megatech_instr_r ) |
| 236 | 236 | { |
| r1293 | r1294 | |
| 268 | 268 | printf("unmapped z80 write %04x\n",offset); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | UINT8* sms_mainram; | |
| 272 | UINT8* sms_rom; | |
| 271 | static UINT8* sms_mainram; | |
| 272 | static UINT8* sms_rom; | |
| 273 | 273 | |
| 274 | 274 | |
| 275 | 275 | static WRITE8_HANDLER( mt_sms_standard_rom_bank_w ) |
| r1293 | r1294 | |
| 314 | 314 | |
| 315 | 315 | |
| 316 | 316 | |
| 317 | void megatech_set_genz80_as_sms_standard_ports(void) | |
| 317 | static void megatech_set_genz80_as_sms_standard_ports(void) | |
| 318 | 318 | { |
| 319 | 319 | /* INIT THE PORTS *********************************************************************************************/ |
| 320 | 320 | memory_install_read8_handler (1, ADDRESS_SPACE_IO, 0x0000, 0xffff, 0, 0, z80_unmapped_port_r); |
| r1293 | r1294 | |
| 339 | 339 | memory_install_read8_handler (1, ADDRESS_SPACE_IO, 0xdf, 0xdf, 0, 0, megatech_sms_ioport_dd_r); // adams family |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | void megatech_set_genz80_as_sms_standard_map(void) | |
| 342 | static void megatech_set_genz80_as_sms_standard_map(void) | |
| 343 | 343 | { |
| 344 | 344 | /* INIT THE MEMMAP / BANKING *********************************************************************************/ |
| 345 | 345 | |
| r1293 | r1294 | |
| 372 | 372 | |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | void megatech_select_game(int gameno) | |
| 375 | static void megatech_select_game(int gameno) | |
| 376 | 376 | { |
| 377 | 377 | UINT8* game_region; |
| 378 | 378 | UINT8* bios_region; |
| r1293 | r1294 | |
| 603 | 603 | init_for_megadrive(); // create an sms vdp too, for comptibility mode |
| 604 | 604 | video_start_megadriv(Machine); |
| 605 | 605 | } |
| 606 | //time_never | |
| 606 | //attotime_never | |
| 607 | 607 | static VIDEO_UPDATE(mtnew) |
| 608 | 608 | { |
| 609 | 609 | if (screen ==0) |
| r1293 | r1294 | |
|---|---|---|
| 367 | 367 | |
| 368 | 368 | ***************************************************************************/ |
| 369 | 369 | |
| 370 | void grtwall_decrypt(void) | |
| 370 | static void grtwall_decrypt(void) | |
| 371 | 371 | { |
| 372 | 372 | int i; |
| 373 | 373 | UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); |
| r1293 | r1294 | |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | |
| 394 | void lhb_decrypt(void) | |
| 394 | static void lhb_decrypt(void) | |
| 395 | 395 | { |
| 396 | 396 | int i; |
| 397 | 397 | UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); |
| r1293 | r1294 | |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | |
| 419 | void chindrag_decrypt(void) | |
| 419 | static void chindrag_decrypt(void) | |
| 420 | 420 | { |
| 421 | 421 | int i; |
| 422 | 422 | UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); |
| r1293 | r1294 | |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | |
| 448 | void drgnwrld_decrypt(void) | |
| 448 | static void drgnwrld_decrypt(void) | |
| 449 | 449 | { |
| 450 | 450 | int i; |
| 451 | 451 | UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); |
| r1293 | r1294 | |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | |
| 477 | void chmplst2_decrypt(void) | |
| 477 | static void chmplst2_decrypt(void) | |
| 478 | 478 | { |
| 479 | 479 | int i,j; |
| 480 | 480 | int rom_size = 0x80000; |
| r1293 | r1294 | |
| 506 | 506 | |
| 507 | 507 | |
| 508 | 508 | |
| 509 | void vbowlj_decrypt(void) | |
| 509 | static void vbowlj_decrypt(void) | |
| 510 | 510 | { |
| 511 | 511 | int i; |
| 512 | 512 | UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); |
| r1293 | r1294 | |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | // To do: |
| 543 | #ifdef UNUSED_FUNCTION | |
| 543 | 544 | void vbowl_decrypt(void) |
| 544 | 545 | { |
| 545 | 546 | int i; |
| r1293 | r1294 | |
| 563 | 564 | |
| 564 | 565 | // vbowlj_decrypt(); |
| 565 | 566 | } |
| 567 | #endif | |
| 566 | 568 | |
| 567 | 569 | |
| 568 | 570 | /*************************************************************************** |
| r1293 | r1294 | |
| 572 | 574 | ***************************************************************************/ |
| 573 | 575 | |
| 574 | 576 | |
| 575 | void chmplst2_decrypt_gfx(void) | |
| 577 | static void chmplst2_decrypt_gfx(void) | |
| 576 | 578 | { |
| 577 | 579 | int i; |
| 578 | 580 | unsigned rom_size = 0x200000; |
| r1293 | r1294 | |
| 587 | 589 | free(result_data); |
| 588 | 590 | } |
| 589 | 591 | |
| 590 | void chindrag_gfx_decrypt(void) | |
| 592 | static void chindrag_gfx_decrypt(void) | |
| 591 | 593 | { |
| 592 | 594 | int i; |
| 593 | 595 | unsigned rom_size = 0x400000; |
| r1293 | r1294 | |
|---|---|---|
| 270 | 270 | MDRV_CPU_VBLANK_INT(bishi_interrupt, 2) |
| 271 | 271 | |
| 272 | 272 | MDRV_SCREEN_REFRESH_RATE(60) |
| 273 | MDRV_SCREEN_VBLANK_TIME( | |
| 273 | MDRV_SCREEN_VBLANK_TIME(A | |
| 274 | 274 | |
| 275 | 275 | MDRV_MACHINE_START(bishi) |
| 276 | 276 | MDRV_MACHINE_RESET(bishi) |
| r1293 | r1294 | |
|---|---|---|
| 513 | 513 | GFXDECODE_END |
| 514 | 514 | |
| 515 | 515 | |
| 516 | UINT8 suplup_default_nvram[128] = { | |
| 516 | static UINT8 suplup_default_nvram[128] = { | |
| 517 | 517 | 0xE8, 0xFE, 0xFF, 0xFF, 0x10, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x96, 0x2D, 0xB4, 0x80, 0x00, |
| 518 | 518 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 519 | 519 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| r1293 | r1294 | |
| 524 | 524 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0xAA |
| 525 | 525 | }; |
| 526 | 526 | |
| 527 | UINT8 misncrft_default_nvram[128] = { | |
| 527 | static UINT8 misncrft_default_nvram[128] = { | |
| 528 | 528 | 0x67, 0xBE, 0x00, 0x01, 0x80, 0xFE, 0x04, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 529 | 529 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 530 | 530 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| r1293 | r1294 | |
| 535 | 535 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0xAA |
| 536 | 536 | }; |
| 537 | 537 | |
| 538 | NVRAM_HANDLER( 93C46_vamphalf ) | |
| 538 | static NVRAM_HANDLER( 93C46_vamphalf ) | |
| 539 | 539 | { |
| 540 | 540 | if (read_or_write) |
| 541 | 541 | EEPROM_save(file); |
| r1293 | r1294 | |
|---|---|---|
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | static laserdisc_info *discinfo; |
| 30 | static | |
| 30 | static | |
| 31 | 31 | static UINT8 serial_timer_active; |
| 32 | 32 | static UINT16 input_select; |
| 33 | 33 | |
| r1293 | r1294 | |
| 145 | 145 | static MACHINE_START( alg ) |
| 146 | 146 | { |
| 147 | 147 | discinfo = laserdisc_init(LASERDISC_TYPE_LDP1450, get_disk_handle(0), 1); |
| 148 | serial_timer = | |
| 148 | serial_timer = | |
| 149 | 149 | serial_timer_active = FALSE; |
| 150 | 150 | } |
| 151 | 151 | |
| r1293 | r1294 | |
| 177 | 177 | |
| 178 | 178 | /* if there's more to come, set another timer */ |
| 179 | 179 | if (laserdisc_line_r(discinfo, LASERDISC_LINE_DATA_AVAIL) == ASSERT_LINE) |
| 180 | | |
| 180 | | |
| 181 | 181 | else |
| 182 | 182 | serial_timer_active = FALSE; |
| 183 | 183 | } |
| r1293 | r1294 | |
| 191 | 191 | /* if we have data available, set a timer to read it */ |
| 192 | 192 | if (!serial_timer_active && laserdisc_line_r(discinfo, LASERDISC_LINE_DATA_AVAIL) == ASSERT_LINE) |
| 193 | 193 | { |
| 194 | | |
| 194 | | |
| 195 | 195 | serial_timer_active = TRUE; |
| 196 | 196 | } |
| 197 | 197 | } |
| r1293 | r1294 | |
| 205 | 205 | /* if we have data available, set a timer to read it */ |
| 206 | 206 | if (!serial_timer_active && laserdisc_line_r(discinfo, LASERDISC_LINE_DATA_AVAIL) == ASSERT_LINE) |
| 207 | 207 | { |
| 208 | | |
| 208 | | |
| 209 | 209 | serial_timer_active = TRUE; |
| 210 | 210 | } |
| 211 | 211 | } |
| r1293 | r1294 | |
| 457 | 457 | MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262) |
| 458 | 458 | |
| 459 | 459 | MDRV_SCREEN_REFRESH_RATE(59.97) |
| 460 | MDRV_SCREEN_VBLANK_TIME( | |
| 460 | MDRV_SCREEN_VBLANK_TIME(A | |
| 461 | 461 | |
| 462 | 462 | MDRV_MACHINE_START(alg) |
| 463 | 463 | MDRV_MACHINE_RESET(alg) |
| r1293 | r1294 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | #include "driver.h" |
| 27 | 27 | |
| 28 | UINT8 *galaxia_video; | |
| 28 | static UINT8 *galaxia_video; | |
| 29 | 29 | |
| 30 | 30 | static VIDEO_START( galaxia ) |
| 31 | 31 | { |
| r1293 | r1294 | |
|---|---|---|
| 119 | 119 | { |
| 120 | 120 | /* next interrupt after scanline 256 is scanline 64 */ |
| 121 | 121 | if (param == 256) |
| 122 | | |
| 122 | | |
| 123 | 123 | else |
| 124 | | |
| 124 | | |
| 125 | 125 | |
| 126 | 126 | /* IRQ starts on scanline 0, 64, 128, etc. */ |
| 127 | 127 | cpunum_set_input_line(0, M6809_IRQ_LINE, ASSERT_LINE); |
| 128 | 128 | |
| 129 | 129 | /* it will turn off on the next HBLANK */ |
| 130 | | |
| 130 | | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
| r1293 | r1294 | |
| 140 | 140 | static TIMER_CALLBACK( firq_timer ) |
| 141 | 141 | { |
| 142 | 142 | /* same time next frame */ |
| 143 | | |
| 143 | | |
| 144 | 144 | |
| 145 | 145 | /* IRQ starts on scanline FIRQ_SCANLINE? */ |
| 146 | 146 | cpunum_set_input_line(0, M6809_FIRQ_LINE, ASSERT_LINE); |
| 147 | 147 | |
| 148 | 148 | /* it will turn off on the next HBLANK */ |
| 149 | | |
| 149 | | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
| 153 | 153 | static MACHINE_RESET( gridlee ) |
| 154 | 154 | { |
| 155 | 155 | /* start timers to generate interrupts */ |
| 156 | mame_timer_set(video_screen_get_time_until_pos(0, 0, 0), 0, irq_timer); | |
| 157 | mame_timer_set(video_screen_get_time_until_pos(0, FIRQ_SCANLINE, 0), 0, firq_timer); | |
| 156 | timer_set(video_screen_get_time_until_pos(0, 0, 0), 0, irq_timer); | |
| 157 | timer_set(video_screen_get_time_until_pos(0, FIRQ_SCANLINE, 0), 0, firq_timer); | |
| 158 | 158 | |
| 159 | 159 | /* create the polynomial tables */ |
| 160 | 160 | poly17_init(); |
| r1293 | r1294 | |
|---|---|---|
| 82 | 82 | |
| 83 | 83 | DAC_data_w( 0, rom[dac_address+cur_dac_address_index] ); |
| 84 | 84 | |
| 85 | | |
| 85 | | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r1293 | r1294 | |
|---|---|---|
| 64 | 64 | { |
| 65 | 65 | /* Unsure of actual sequence */ |
| 66 | 66 | |
| 67 | mame_timer_set(MAME_TIME_IN_CYCLES(500,0),0, gcpinbal_interrupt1); | |
| 68 | // mame_timer_set(MAME_TIME_IN_CYCLES(1000,0),0, gcpinbal_interrupt3); | |
| 67 | timer_set(ATTOTIME_IN_CYCLES(500,0),0, gcpinbal_interrupt1); | |
| 68 | // timer_set(ATTOTIME_IN_CYCLES(1000,0),0, gcpinbal_interrupt3); | |
| 69 | 69 | cpunum_set_input_line(0, 4, HOLD_LINE); |
| 70 | 70 | } |
| 71 | 71 |
| r1293 | r1294 | |
|---|---|---|
| 294 | 294 | MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262) |
| 295 | 295 | |
| 296 | 296 | MDRV_SCREEN_REFRESH_RATE(59.997) |
| 297 | MDRV_SCREEN_VBLANK_TIME( | |
| 297 | MDRV_SCREEN_VBLANK_TIME(A | |
| 298 | 298 | |
| 299 | 299 | MDRV_MACHINE_RESET(amiga) |
| 300 | 300 | MDRV_NVRAM_HANDLER(generic_0fill) |
| r1293 | r1294 | |
|---|---|---|
| 451 | 451 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) /* P1.21 */ |
| 452 | 452 | |
| 453 | 453 | PORT_START_TAG("D3D2") |
| 454 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown )) PORT_DIPLOCATION("SW1:8") | |
| 455 | PORT_DIPSETTING( 0x01, DEF_STR( Off )) | |
| 456 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 457 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown )) PORT_DIPLOCATION("SW1:7") | |
| 458 | PORT_DIPSETTING( 0x02, DEF_STR( Off )) | |
| 459 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 460 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown )) PORT_DIPLOCATION("SW1:6") | |
| 461 | PORT_DIPSETTING( 0x04, DEF_STR( Off )) | |
| 462 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 463 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown )) PORT_DIPLOCATION("SW1:5") | |
| 464 | PORT_DIPSETTING( 0x08, DEF_STR( Off )) | |
| 465 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 466 | PORT_DIPNAME( 0x10, 0x01, DEF_STR( Unknown )) PORT_DIPLOCATION("SW1:4") | |
| 467 | PORT_DIPSETTING( 0x01, DEF_STR( Off )) | |
| 468 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 469 | PORT_DIPNAME( 0x20, 0x02, DEF_STR( Unknown )) PORT_DIPLOCATION("SW1:3") | |
| 470 | PORT_DIPSETTING( 0x02, DEF_STR( Off )) | |
| 471 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 472 | PORT_DIPNAME( 0x40, 0x04, DEF_STR( Unknown )) PORT_DIPLOCATION("SW1:2") | |
| 473 | PORT_DIPSETTING( 0x04, DEF_STR( Off )) | |
| 474 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 475 | PORT_DIPNAME( 0x80, 0x08, DEF_STR( Unknown )) PORT_DIPLOCATION("SW1:1") | |
| 476 | PORT_DIPSETTING( 0x08, DEF_STR( Off )) | |
| 477 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 454 | PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW1:8" ) | |
| 455 | PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW1:7" ) | |
| 456 | PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW1:6" ) | |
| 457 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW1:5" ) | |
| 458 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x01, "SW1:4" ) | |
| 459 | PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x02, "SW1:3" ) | |
| 460 | PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x04, "SW1:2" ) | |
| 461 | PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x08, "SW1:1" ) | |
| 478 | 462 | |
| 479 | 463 | PORT_START_TAG("D1D0") |
| 480 | 464 | PORT_DIPNAME( 0x0f, 0x03, DEF_STR( Coin_A )) PORT_DIPLOCATION("SW2:8,7,6,5") |
| r1293 | r1294 | |
| 549 | 533 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 550 | 534 | |
| 551 | 535 | PORT_MODIFY("D3D2") |
| 552 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:1") | |
| 553 | PORT_DIPSETTING( 0x01, DEF_STR( Upright )) | |
| 536 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:8") | |
| 537 | PORT_DIPSETTING( 0x01, DEF_STR( Upright )) // This switch is not documented in the manual | |
| 554 | 538 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail )) |
| 555 | PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Lives )) PORT_DIPLOCATION("SW1:3,4") | |
| 539 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW1:7" ) // Unused according to manual | |
| 540 | PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Lives )) PORT_DIPLOCATION("SW1:6,5") | |
| 556 | 541 | PORT_DIPSETTING( 0x04, "3" ) |
| 557 | 542 | PORT_DIPSETTING( 0x08, "4" ) |
| 558 | 543 | PORT_DIPSETTING( 0x0c, "5" ) |
| 559 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) PORT_DIPLOCATION("SW1:5,6") | |
| 560 | PORT_DIPSETTING( 0x00, DEF_STR( Easy )) | |
| 561 | PORT_DIPSETTING( 0x10, DEF_STR( Normal )) | |
| 544 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) PORT_DIPLOCATION("SW1:4,3") | |
| 545 | PORT_DIPSETTING( 0x00, DEF_STR( Easy )) // This option is not documented in the manual | |
| 546 | PORT_DIPSETTING( 0x10, DEF_STR( Medium )) | |
| 562 | 547 | PORT_DIPSETTING( 0x20, DEF_STR( Hard )) |
| 563 | PORT_DIPSETTING( 0x30, DEF_STR( Very_Hard )) | |
| 564 | PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW1:7,8") | |
| 548 | PORT_DIPSETTING( 0x30, DEF_STR( Hardest )) | |
| 549 | PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW1:2,1") | |
| 565 | 550 | PORT_DIPSETTING( 0xc0, DEF_STR( None )) |
| 566 | 551 | PORT_DIPSETTING( 0x80, "10000" ) |
| 567 | 552 | PORT_DIPSETTING( 0x40, "20000" ) |
| r1293 | r1294 | |
| 611 | 596 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) |
| 612 | 597 | |
| 613 | 598 | PORT_MODIFY("D3D2") |
| 614 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:1") | |
| 615 | PORT_DIPSETTING( 0x01, DEF_STR( Upright )) | |
| 599 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:8") | |
| 600 | PORT_DIPSETTING( 0x01, DEF_STR( Upright )) // This switch is not documented in the manual | |
| 616 | 601 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail )) |
| 617 | PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Lives )) PORT_DIPLOCATION("SW1:3,4") | |
| 602 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW1:7" ) // This switch is not documented in the manual | |
| 603 | PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Lives )) PORT_DIPLOCATION("SW1:6,5") | |
| 618 | 604 | PORT_DIPSETTING( 0x04, "3" ) |
| 619 | 605 | PORT_DIPSETTING( 0x08, "4" ) |
| 620 | 606 | PORT_DIPSETTING( 0x0c, "5" ) |
| 621 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) PORT_DIPLOCATION("SW1:5,6") | |
| 622 | PORT_DIPSETTING( 0x00, DEF_STR( Easy )) | |
| 623 | PORT_DIPSETTING( 0x10, DEF_STR( Normal )) | |
| 607 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) PORT_DIPLOCATION("SW1:4,3") | |
| 608 | PORT_DIPSETTING( 0x00, DEF_STR( Easy )) // This option is not documented in the manual | |
| 609 | PORT_DIPSETTING( 0x10, DEF_STR( Medium )) | |
| 624 | 610 | PORT_DIPSETTING( 0x20, DEF_STR( Hard )) |
| 625 | PORT_DIPSETTING( 0x30, DEF_STR( Very_Hard )) | |
| 626 | PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW1:7,8") | |
| 611 | PORT_DIPSETTING( 0x30, DEF_STR( Hardest )) | |
| 612 | PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW1:2,1") | |
| 627 | 613 | PORT_DIPSETTING( 0xc0, DEF_STR( None )) |
| 628 | 614 | PORT_DIPSETTING( 0x80, "10000" ) |
| 629 | 615 | PORT_DIPSETTING( 0x40, "20000" ) |
| 630 | 616 | PORT_DIPSETTING( 0x00, "30000" ) |
| 631 | 617 | |
| 632 | 618 | PORT_MODIFY("D1D0") |
| 633 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown )) PORT_DIPLOCATION("SW2:1") | |
| 634 | PORT_DIPSETTING( 0x01, DEF_STR( Off )) | |
| 635 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 636 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown )) PORT_DIPLOCATION("SW2:2") | |
| 637 | PORT_DIPSETTING( 0x02, DEF_STR( Off )) | |
| 638 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 639 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown )) PORT_DIPLOCATION("SW2:3") | |
| 640 | PORT_DIPSETTING( 0x04, DEF_STR( Off )) | |
| 641 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 642 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown )) PORT_DIPLOCATION("SW2:4") | |
| 643 | PORT_DIPSETTING( 0x08, DEF_STR( Off )) | |
| 644 | PORT_DIPSETTING( 0x00, DEF_STR( On )) | |
| 645 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown )) PORT_DIPLOCATION("SW2:5") | |
| 646 | PORT_DIPSETTING( 0x00, DEF_STR( Off )) | |
| 647 | PORT_DIPSETTING( 0x10, DEF_STR( On )) | |
| 648 | PORT_DIPNAME( 0xe0, 0x00, DEF_STR( Coin_A )) PORT_DIPLOCATION("SW2:6,7,8") | |
| 619 | PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW2:8" ) | |
| 620 | PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW2:7" ) | |
| 621 | PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW2:6" ) | |
| 622 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW2:5" ) | |
| 623 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW2:4" ) | |
| 624 | PORT_DIPNAME( 0xe0, 0x00, DEF_STR( Coin_A )) PORT_DIPLOCATION("SW2:3,2,1") | |
| 649 | 625 | PORT_DIPSETTING( 0xe0, DEF_STR( 8C_1C )) |
| 650 | 626 | PORT_DIPSETTING( 0xc0, DEF_STR( 7C_1C )) |
| 651 | 627 | PORT_DIPSETTING( 0xa0, DEF_STR( 6C_1C )) |
| r1293 | r1294 | |
| 686 | 662 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 687 | 663 | |
| 688 | 664 | PORT_MODIFY("D3D2") |
| 689 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) | |
| 665 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:8") | |
| 690 | 666 | PORT_DIPSETTING( 0x01, DEF_STR( Upright )) |
| 691 | 667 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail )) |
| 692 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds )) | |
| 668 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds )) PORT_DIPLOCATION("SW1:7") | |
| 693 | 669 | PORT_DIPSETTING( 0x02, DEF_STR( Off )) |
| 694 | 670 | PORT_DIPSETTING( 0x00, DEF_STR( On )) |
| 695 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives )) | |
| 671 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives )) PORT_DIPLOCATION("SW1:6,5") | |
| 696 | 672 | PORT_DIPSETTING( 0x00, "2" ) |
| 697 | 673 | PORT_DIPSETTING( 0x04, "3" ) |
| 698 | 674 | PORT_DIPSETTING( 0x08, "4" ) |
| 699 | 675 | PORT_DIPSETTING( 0x0c, "5" ) |
| 700 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) | |
| 676 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) PORT_DIPLOCATION("SW1:4,3") | |
| 701 | 677 | PORT_DIPSETTING( 0x00, DEF_STR( Easy )) |
| 702 | PORT_DIPSETTING( 0x10, DEF_STR( | |
| 678 | PORT_DIPSETTING( 0x10, DEF_STR( Medium | |
| 703 | 679 | PORT_DIPSETTING( 0x20, DEF_STR( Hard )) |
| 704 | PORT_DIPSETTING( 0x30, DEF_STR( Very_Hard )) | |
| 705 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW1:7,8") | |
| 680 | PORT_DIPSETTING( 0x30, DEF_STR( Hardest )) | |
| 681 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW1:2,1") | |
| 706 | 682 | PORT_DIPSETTING( 0x00, "10000" ) |
| 707 | 683 | PORT_DIPSETTING( 0x40, "20000" ) |
| 708 | 684 | PORT_DIPSETTING( 0x80, "30000" ) |
| r1293 | r1294 | |
| 720 | 696 | PORT_INCLUDE( g80v_generic ) |
| 721 | 697 | |
| 722 | 698 | PORT_MODIFY("D3D2") |
| 723 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) | |
| 699 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:8") | |
| 724 | 700 | PORT_DIPSETTING( 0x01, DEF_STR( Upright )) |
| 725 | 701 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail )) |
| 726 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds )) | |
| 702 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds )) PORT_DIPLOCATION("SW1:7") | |
| 727 | 703 | PORT_DIPSETTING( 0x02, DEF_STR( Off )) |
| 728 | 704 | PORT_DIPSETTING( 0x00, DEF_STR( On )) |
| 729 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives )) | |
| 705 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives )) PORT_DIPLOCATION("SW1:6,5") | |
| 730 | 706 | PORT_DIPSETTING( 0x00, "2" ) |
| 731 | 707 | PORT_DIPSETTING( 0x04, "3" ) |
| 732 | 708 | PORT_DIPSETTING( 0x08, "4" ) |
| 733 | 709 | PORT_DIPSETTING( 0x0c, "5" ) |
| 734 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) | |
| 710 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) PORT_DIPLOCATION("SW1:4,3") | |
| 735 | 711 | PORT_DIPSETTING( 0x00, DEF_STR( Easy )) |
| 736 | PORT_DIPSETTING( 0x10, DEF_STR( | |
| 712 | PORT_DIPSETTING( 0x10, DEF_STR( Medium | |
| 737 | 713 | PORT_DIPSETTING( 0x20, DEF_STR( Hard )) |
| 738 | PORT_DIPSETTING( 0x30, DEF_STR( Very_Hard )) | |
| 739 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW1:7,8") | |
| 740 | PORT_DIPSETTING( 0x00, DEF_STR( None )) | |
| 714 | PORT_DIPSETTING( 0x30, DEF_STR( Hardest )) | |
| 715 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW1:2,1") | |
| 716 | PORT_DIPSETTING( 0x00, DEF_STR( None )) // These switches are not documented in the manual | |
| 741 | 717 | PORT_DIPSETTING( 0xc0, "10000" ) |
| 742 | 718 | PORT_DIPSETTING( 0x80, "20000" ) |
| 743 | 719 | PORT_DIPSETTING( 0x40, "30000" ) |
| r1293 | r1294 | |
| 757 | 733 | PORT_INCLUDE( g80v_generic ) |
| 758 | 734 | |
| 759 | 735 | PORT_MODIFY("D3D2") |
| 760 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) | |
| 736 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:8") | |
| 761 | 737 | PORT_DIPSETTING( 0x01, DEF_STR( Upright )) |
| 762 | 738 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail )) |
| 763 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds )) PORT_DIPLOCATION("SW1:2") | |
| 764 | PORT_DIPSETTING( 0x02, DEF_STR( Off )) | |
| 739 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds )) PORT_DIPLOCATION("SW1:7") | |
| 740 | PORT_DIPSETTING( 0x02, DEF_STR( Off )) // This switch isn't documented in the manual | |
| 765 | 741 | PORT_DIPSETTING( 0x00, DEF_STR( On )) |
| 766 | PORT_DIPNAME( 0x0c, 0x0c, "Number of Ships" ) | |
| 742 | PORT_DIPNAME( 0x0c, 0x0c, "Number of Ships" ) PORT_DIPLOCATION("SW1:6,5") | |
| 767 | 743 | PORT_DIPSETTING( 0x00, "2" ) |
| 768 | 744 | PORT_DIPSETTING( 0x04, "4" ) |
| 769 | 745 | PORT_DIPSETTING( 0x08, "6" ) |
| 770 | 746 | PORT_DIPSETTING( 0x0c, "8" ) |
| 771 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) | |
| 747 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) PORT_DIPLOCATION("SW1:4,3") | |
| 772 | 748 | PORT_DIPSETTING( 0x00, DEF_STR( Easy )) |
| 773 | 749 | PORT_DIPSETTING( 0x10, DEF_STR( Normal )) |
| 774 | PORT_DIPSETTING( 0x20, DEF_STR( Hard )) | |
| 750 | PORT_DIPSETTING( 0x20, DEF_STR( Hard )) // This option isn't documented in the manual | |
| 775 | 751 | PORT_DIPSETTING( 0x30, DEF_STR( Very_Hard )) |
| 776 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Bonus_Life )) | |
| 752 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW1:2,1") | |
| 777 | 753 | PORT_DIPSETTING( 0x00, DEF_STR( None )) |
| 778 | 754 | PORT_DIPSETTING( 0xc0, "10000" ) |
| 779 | 755 | PORT_DIPSETTING( 0x80, "20000" ) |
| r1293 | r1294 | |
| 794 | 770 | PORT_INCLUDE( g80v_generic ) |
| 795 | 771 | |
| 796 | 772 | PORT_MODIFY("D3D2") |
| 797 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:1") | |
| 798 | PORT_DIPSETTING( 0x01, DEF_STR( Upright )) | |
| 773 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:8") | |
| 774 | PORT_DIPSETTING( 0x01, DEF_STR( Upright )) // This switch isn't documented in the manual | |
| 799 | 775 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail )) |
| 800 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds )) | |
| 776 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds )) PORT_DIPLOCATION("SW1:7") | |
| 801 | 777 | PORT_DIPSETTING( 0x02, DEF_STR( Off )) |
| 802 | 778 | PORT_DIPSETTING( 0x00, DEF_STR( On )) |
| 803 | PORT_DIPNAME( 0x0c, 0x0c, "Photon Torpedoes" ) | |
| 779 | PORT_DIPNAME( 0x0c, 0x0c, "Photon Torpedoes" ) PORT_DIPLOCATION("SW1:6,5") | |
| 804 | 780 | PORT_DIPSETTING( 0x00, "1" ) |
| 805 | 781 | PORT_DIPSETTING( 0x04, "2" ) |
| 806 | 782 | PORT_DIPSETTING( 0x08, "3" ) |
| 807 | 783 | PORT_DIPSETTING( 0x0c, "4" ) |
| 808 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) | |
| 784 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty )) PORT_DIPLOCATION("SW1:4,3") | |
| 809 | 785 | PORT_DIPSETTING( 0x00, DEF_STR( Easy )) |
| 810 | PORT_DIPSETTING( 0x10, DEF_STR( | |
| 786 | PORT_DIPSETTING( 0x10, DEF_STR( Medium | |
| 811 | 787 | PORT_DIPSETTING( 0x20, DEF_STR( Hard )) |
| 812 | 788 | PORT_DIPSETTING( 0x30, "Tournament" ) |
| 813 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Bonus_Life )) | |
| 789 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW1:2,1") | |
| 814 | 790 | PORT_DIPSETTING( 0x00, "10000" ) |
| 815 | 791 | PORT_DIPSETTING( 0x40, "20000" ) |
| 816 | 792 | PORT_DIPSETTING( 0x80, "30000" ) |
| r1293 | r1294 | |
|---|---|---|
| 79 | 79 | #include "sound/okim6295.h" |
| 80 | 80 | #include "sound/es8712.h" |
| 81 | 81 | |
| 82 | UINT16 *vmetal_texttileram; | |
| 83 | UINT16 *vmetal_mid1tileram; | |
| 84 | UINT16 *vmetal_mid2tileram; | |
| 85 | UINT16 *vmetal_tlookup; | |
| 86 | UINT16 *vmetal_videoregs; | |
| 82 | static UINT16 *vmetal_texttileram; | |
| 83 | static UINT16 *vmetal_mid1tileram; | |
| 84 | static UINT16 *vmetal_mid2tileram; | |
| 85 | static UINT16 *vmetal_tlookup; | |
| 86 | static UINT16 *vmetal_videoregs; | |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | static tilemap *vmetal_texttilemap; |
| r1293 | r1294 | |
|---|---|---|
| 42 | 42 | #define MASTER_CLOCK 32000000 |
| 43 | 43 | |
| 44 | 44 | |
| 45 | UINT32*dreamwld_bg_videoram; | |
| 46 | UINT32*dreamwld_bg2_videoram; | |
| 47 | UINT32*dreamwld_bg_scroll; | |
| 48 | int dreamwld_tilebank[2], dreamwld_tilebankold[2]; | |
| 45 | static UINT32*dreamwld_bg_videoram; | |
| 46 | static UINT32*dreamwld_bg2_videoram; | |
| 47 | static UINT32*dreamwld_bg_scroll; | |
| 48 | static int dreamwld_tilebank[2], dreamwld_tilebankold[2]; | |
| 49 | 49 | |
| 50 | 50 | static tilemap *dreamwld_bg_tilemap; |
| 51 | 51 | static tilemap *dreamwld_bg2_tilemap; |
| r1293 | r1294 | |
|---|---|---|
| 174 | 174 | /* so let's resync every time they are changed to avoid deadlocks */ |
| 175 | 175 | if ((offset == 0x003d || offset == 0x003e) |
| 176 | 176 | && xain_sharedram[offset] != data) |
| 177 | cpu_boost_interleave(time_zero, | |
| 177 | cpu_boost_interleave(attotime_zero, | |
| 178 | 178 | xain_sharedram[offset] = data; |
| 179 | 179 | } |
| 180 | 180 |
| r1293 | r1294 | |
|---|---|---|
| 181 | 181 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 182 | 182 | |
| 183 | 183 | MDRV_SCREEN_REFRESH_RATE(5000000.0/312/262) |
| 184 | MDRV_SCREEN_VBLANK_TIME( | |
| 184 | MDRV_SCREEN_VBLANK_TIME(A | |
| 185 | 185 | |
| 186 | 186 | /* video hardware */ |
| 187 | 187 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 1366 | 1366 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 1367 | 1367 | |
| 1368 | 1368 | MDRV_SCREEN_REFRESH_RATE(55) |
| 1369 | MDRV_SCREEN_VBLANK_TIME( | |
| 1369 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1370 | 1370 | |
| 1371 | 1371 | /* video hardware */ |
| 1372 | 1372 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 428 | 428 | MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1) |
| 429 | 429 | |
| 430 | 430 | MDRV_SCREEN_REFRESH_RATE(58) |
| 431 | MDRV_SCREEN_VBLANK_TIME( | |
| 431 | MDRV_SCREEN_VBLANK_TIME(A | |
| 432 | 432 | MDRV_NVRAM_HANDLER(93C46) |
| 433 | 433 | |
| 434 | 434 | /* video hardware */ |
| r1293 | r1294 | |
| 464 | 464 | MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1) |
| 465 | 465 | |
| 466 | 466 | MDRV_SCREEN_REFRESH_RATE(58) |
| 467 | MDRV_SCREEN_VBLANK_TIME( | |
| 467 | MDRV_SCREEN_VBLANK_TIME(A | |
| 468 | 468 | MDRV_NVRAM_HANDLER(93C46) |
| 469 | 469 | |
| 470 | 470 | /* video hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 128 | 128 | I8275_COMMAND_LOAD_CURSOR_LENGTH=2, |
| 129 | 129 | I8275_COMMAND_PRESET_LENGTH=0 |
| 130 | 130 | }; |
| 131 | int i8275Command; | |
| 132 | int i8275HorizontalCharactersRow; | |
| 133 | int i8275CommandSeqCnt; | |
| 134 | int i8275SpacedRows; | |
| 135 | int i8275VerticalRows; | |
| 136 | int i8275VerticalRetraceRows; | |
| 137 | int i8275Underline; | |
| 138 | int i8275Lines; | |
| 139 | int i8275LineCounterMode; | |
| 140 | int i8275FieldAttributeMode; | |
| 141 | int i8275CursorFormat; | |
| 142 | int i8275HorizontalRetrace; | |
| 131 | static int i8275Command; | |
| 132 | static int i8275HorizontalCharactersRow; | |
| 133 | static int i8275CommandSeqCnt; | |
| 134 | static int i8275SpacedRows; | |
| 135 | static int i8275VerticalRows; | |
| 136 | static int i8275VerticalRetraceRows; | |
| 137 | static int i8275Underline; | |
| 138 | static int i8275Lines; | |
| 139 | static int i8275LineCounterMode; | |
| 140 | static int i8275FieldAttributeMode; | |
| 141 | static int i8275CursorFormat; | |
| 142 | static int i8275HorizontalRetrace; | |
| 143 | 143 | |
| 144 | 144 | static WRITE8_HANDLER (i8275_preg_w) //param reg |
| 145 | 145 | { |
| r1293 | r1294 | |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | #define NUM_LINES 25 |
| 543 | INTERRUPT_GEN( dwarfd_interrupt ) | |
| 543 | static INTERRUPT_GEN( dwarfd_interrupt ) | |
| 544 | 544 | { |
| 545 | 545 | if(cpu_getiloops() < NUM_LINES) |
| 546 | 546 | { |
| r1293 | r1294 | |
|---|---|---|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | void *renegade_adpcm_start(int clock, const struct CustomSound_interface *config) | |
| 167 | static void *renegade_adpcm_start(int clock, const struct CustomSound_interface *config) | |
| 168 | 168 | { |
| 169 | 169 | struct renegade_adpcm_state *state = &renegade_adpcm; |
| 170 | 170 | state->playing = 0; |
| r1293 | r1294 | |
|---|---|---|
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | INTERRUPT_GEN( psychic5_interrupt ) | |
| 361 | static INTERRUPT_GEN( psychic5_interrupt ) | |
| 362 | 362 | { |
| 363 | 363 | if (cpu_getiloops() == 0) |
| 364 | 364 | cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0xd7); /* RST 10h */ |
| r1293 | r1294 | |
|---|---|---|
| 430 | 430 | The ADC60808 clock is 512kHz. Conversion takes between 0 and 8 clock |
| 431 | 431 | cycles, so would end in a maximum of 15.625us. We'll use 10. */ |
| 432 | 432 | |
| 433 | | |
| 433 | | |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 |
| r1293 | r1294 | |
|---|---|---|
| 311 | 311 | |
| 312 | 312 | |
| 313 | 313 | /* Modified by Takahiro Nogi. 1999/09/27 */ |
| 314 | INTERRUPT_GEN( ginganin_sound_interrupt ) | |
| 314 | static INTERRUPT_GEN( ginganin_sound_interrupt ) | |
| 315 | 315 | { |
| 316 | 316 | /* MC6840 Emulation by Takahiro Nogi. 1999/09/27 |
| 317 | 317 | (This routine hasn't been completed yet.) */ |
| r1293 | r1294 | |
|---|---|---|
| 187 | 187 | |
| 188 | 188 | static INTERRUPT_GEN( slapshot_interrupt ) |
| 189 | 189 | { |
| 190 | | |
| 190 | | |
| 191 | 191 | cpunum_set_input_line(0,5,HOLD_LINE); |
| 192 | 192 | } |
| 193 | 193 |
| r1293 | r1294 | |
|---|---|---|
| 161 | 161 | |
| 162 | 162 | static void startTimer(void) |
| 163 | 163 | { |
| 164 | | |
| 164 | | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | static WRITE32_HANDLER(T1GO_w) |
| r1293 | r1294 | |
|---|---|---|
| 44 | 44 | #include "sound/okim6295.h" |
| 45 | 45 | |
| 46 | 46 | static int cninja_scanline, cninja_irq_mask; |
| 47 | static | |
| 47 | static | |
| 48 | 48 | static UINT16 *cninja_ram; |
| 49 | 49 | |
| 50 | 50 | /**********************************************************************************/ |
| r1293 | r1294 | |
| 77 | 77 | deco16_raster_display_list[deco16_raster_display_position++]=deco16_pf34_control[4]&0xffff; |
| 78 | 78 | |
| 79 | 79 | cpunum_set_input_line(0, (cninja_irq_mask&0x10) ? 3 : 4, ASSERT_LINE); |
| 80 | | |
| 80 | | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | static READ16_HANDLER( cninja_irq_r ) |
| r1293 | r1294 | |
| 113 | 113 | case 1: /* Raster IRQ scanline position, only valid for values between 1 & 239 (0 and 240-256 do NOT generate IRQ's) */ |
| 114 | 114 | cninja_scanline=data&0xff; |
| 115 | 115 | if ((cninja_irq_mask&0x2)==0 && cninja_scanline>0 && cninja_scanline<240) |
| 116 | | |
| 116 | | |
| 117 | 117 | else |
| 118 | | |
| 118 | | |
| 119 | 119 | return; |
| 120 | 120 | |
| 121 | 121 | case 2: /* VBL irq ack */ |
| r1293 | r1294 | |
| 825 | 825 | |
| 826 | 826 | static MACHINE_RESET( cninja ) |
| 827 | 827 | { |
| 828 | raster_irq_timer = | |
| 828 | raster_irq_timer = | |
| 829 | 829 | cninja_scanline=0; |
| 830 | 830 | cninja_irq_mask=0; |
| 831 | 831 | } |
| r1293 | r1294 | |
|---|---|---|
| 353 | 353 | MDRV_CPU_VBLANK_INT(irq6_line_hold,1) |
| 354 | 354 | |
| 355 | 355 | MDRV_SCREEN_REFRESH_RATE(58) |
| 356 | MDRV_SCREEN_VBLANK_TIME( | |
| 356 | MDRV_SCREEN_VBLANK_TIME(A | |
| 357 | 357 | |
| 358 | 358 | /* video hardware */ |
| 359 | 359 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 261 | 261 | |
| 262 | 262 | static const UINT8 *writeprom; |
| 263 | 263 | |
| 264 | static mame_timer *irq_timer; | |
| 265 | static mame_timer *cpu_timer; | |
| 264 | static emu_timer *irq_timer; | |
| 265 | static emu_timer *cpu_timer; | |
| 266 | 266 | |
| 267 | 267 | static UINT8 irq_state; |
| 268 | 268 | static UINT8 ctrld; |
| r1293 | r1294 | |
| 305 | 305 | curv = ((curv + 32) & 0xff) & ~0x10; |
| 306 | 306 | |
| 307 | 307 | /* next one at the start of this scanline */ |
| 308 | | |
| 308 | | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | |
| r1293 | r1294 | |
| 351 | 351 | |
| 352 | 352 | /* scanline for the next run */ |
| 353 | 353 | curv ^= 224; |
| 354 | | |
| 354 | | |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | |
| r1293 | r1294 | |
| 391 | 391 | opcode_base = opcode_arg_base = videoram; |
| 392 | 392 | |
| 393 | 393 | /* create a timer to speed/slow the CPU */ |
| 394 | cpu_timer = mame_timer_alloc(adjust_cpu_speed); | |
| 395 | mame_timer_adjust(cpu_timer, video_screen_get_time_until_pos(0, v_to_scanline(0), 0), 0, time_zero); | |
| 394 | cpu_timer = timer_alloc(adjust_cpu_speed); | |
| 395 | timer_adjust(cpu_timer, video_screen_get_time_until_pos(0, v_to_scanline(0), 0), 0, attotime_zero); | |
| 396 | 396 | |
| 397 | 397 | /* create a timer for IRQs and set up the first callback */ |
| 398 | irq_timer = | |
| 398 | irq_timer = | |
| 399 | 399 | irq_state = 0; |
| 400 | 400 | schedule_next_irq(-32); |
| 401 | 401 |
| r1293 | r1294 | |
|---|---|---|
| 911 | 911 | MDRV_CPU_VBLANK_INT(irq0_line_hold,2) /* tripool needs 2 or the palette is broken */ |
| 912 | 912 | MACHINE_DRIVER_END |
| 913 | 913 | |
| 914 | INTERRUPT_GEN( joinem_interrupts ) | |
| 914 | static INTERRUPT_GEN( joinem_interrupts ) | |
| 915 | 915 | { |
| 916 | 916 | if(cpu_getiloops() > 0) |
| 917 | 917 | { |
| r1293 | r1294 | |
|---|---|---|
| 327 | 327 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 328 | 328 | |
| 329 | 329 | MDRV_SCREEN_REFRESH_RATE(58) |
| 330 | MDRV_SCREEN_VBLANK_TIME( | |
| 330 | MDRV_SCREEN_VBLANK_TIME(A | |
| 331 | 331 | |
| 332 | 332 | /* video hardware */ |
| 333 | 333 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 396 | 396 | |
| 397 | 397 | /******************************************************************************/ |
| 398 | 398 | |
| 399 | #if TUMBLEP_HACK | |
| 399 | 400 | void tumblep_patch_code(UINT16 offset) |
| 400 | 401 | { |
| 401 | 402 | /* A hack which enables all Dip Switches effects */ |
| r1293 | r1294 | |
| 403 | 404 | RAM[(offset + 0)/2] = 0x0240; |
| 404 | 405 | RAM[(offset + 2)/2] = 0xffff; // andi.w #$f3ff, D0 |
| 405 | 406 | } |
| 407 | #endif | |
| 406 | 408 | |
| 407 | 409 | static DRIVER_INIT( tumblep ) |
| 408 | 410 | { |
| r1293 | r1294 | |
|---|---|---|
| 245 | 245 | MDRV_WATCHDOG_VBLANK_INIT(8) |
| 246 | 246 | |
| 247 | 247 | MDRV_SCREEN_REFRESH_RATE(60) |
| 248 | MDRV_SCREEN_VBLANK_TIME( | |
| 248 | MDRV_SCREEN_VBLANK_TIME(A | |
| 249 | 249 | |
| 250 | 250 | /* video hardware */ |
| 251 | 251 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 54 | 54 | extern UINT16 *splash_spriteram; |
| 55 | 55 | extern UINT16 *splash_pixelram; |
| 56 | 56 | extern UINT16 *roldfrog_bitmap_mode; |
| 57 | UINT16 *roldfrog_protdata; | |
| 57 | static UINT16 *roldfrog_protdata; | |
| 58 | 58 | |
| 59 | 59 | extern int splash_bitmap_type; |
| 60 | 60 | extern int splash_sprite_attr2_shift; |
| r1293 | r1294 | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // give the z80 time to see it |
| 84 | cpu_spinuntil_time( | |
| 84 | cpu_spinuntil_time( | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | static ADDRESS_MAP_START( splash_readmem, ADDRESS_SPACE_PROGRAM, 16 ) |
| r1293 | r1294 | |
|---|---|---|
| 660 | 660 | ROM[0x044A/2] = 0x4E71; |
| 661 | 661 | ROM[0x04bc/2] = 0x0000; |
| 662 | 662 | ROM[0x302c/2] = 0x60a4; |
| 663 | | |
| 663 | | |
| 664 | 664 | gametype=0; |
| 665 | 665 | } |
| 666 | 666 | |
| r1293 | r1294 | |
| 682 | 682 | ROM[0x04822/2] = 0x4E71; |
| 683 | 683 | ROM[0x04862/2] = 0x4E71; |
| 684 | 684 | |
| 685 | | |
| 685 | | |
| 686 | 686 | gametype=1; |
| 687 | 687 | |
| 688 | 688 | } |
| r1293 | r1294 | |
|---|---|---|
| 107 | 107 | |
| 108 | 108 | /* timer handling */ |
| 109 | 109 | static TIMER_CALLBACK( timer_callback ); |
| 110 | static | |
| 110 | static | |
| 111 | 111 | static WRITE8_HANDLER( polyplay_start_timer2 ); |
| 112 | 112 | static WRITE8_HANDLER( polyplay_sound_channel ); |
| 113 | 113 | |
| r1293 | r1294 | |
| 133 | 133 | polyplay_set_channel2(0); |
| 134 | 134 | polyplay_play_channel2(0); |
| 135 | 135 | |
| 136 | polyplay_timer = | |
| 136 | polyplay_timer = | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| r1293 | r1294 | |
| 248 | 248 | static WRITE8_HANDLER( polyplay_start_timer2 ) |
| 249 | 249 | { |
| 250 | 250 | if (data == 0x03) |
| 251 | | |
| 251 | | |
| 252 | 252 | |
| 253 | 253 | if (data == 0xb5) |
| 254 | | |
| 254 | | |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | static READ8_HANDLER( polyplay_random_read ) |
| r1293 | r1294 | |
|---|---|---|
| 66 | 66 | static int TS, z80_int = 0; |
| 67 | 67 | |
| 68 | 68 | UINT16 *tx1_vram; |
| 69 | UINT16 *tx1_object_ram; | |
| 69 | static UINT16 *tx1_object_ram; | |
| 70 | 70 | |
| 71 | 71 | UINT16 *buggyboy_vram; /* Tile RAM (three monitor) */ |
| 72 | 72 | UINT16 *buggyb1_vram; /* Tile RAM (single monitor) */ |
| 73 | 73 | static UINT8 *z80_ram; /* Main 8086/Z80 shared RAM */ |
| 74 | 74 | UINT16 *bb_objram; |
| 75 | 75 | UINT16 *bb_sky; /* Sky register */ |
| 76 | UINT16 *bb_rcram; | |
| 76 | static UINT16 *bb_rcram; | |
| 77 | 77 | |
| 78 | size_t tx1_objectram_size; | |
| 78 | static size_t tx1_objectram_size; | |
| 79 | 79 | size_t bb_objectram_size; |
| 80 | size_t bb_rcram_size; | |
| 80 | static size_t bb_rcram_size; | |
| 81 | 81 | |
| 82 | 82 | tilemap *tx1_tilemap; |
| 83 | 83 | tilemap *buggyboy_tilemap; |
| r1293 | r1294 | |
| 904 | 904 | MDRV_CPU_ADD(I8086,5000000 ) |
| 905 | 905 | MDRV_CPU_PROGRAM_MAP(tx1_master,0) |
| 906 | 906 | MDRV_CPU_PERIODIC_INT(main_irq, 46 ) /* To do: measure HD46505 CUDISP output rate */ |
| 907 | //MDRV_WATCHDOG_TIME_INIT( | |
| 907 | //MDRV_WATCHDOG_TIME_INIT( | |
| 908 | 908 | |
| 909 | 909 | MDRV_CPU_ADD(I8086,5000000 ) |
| 910 | 910 | MDRV_CPU_PROGRAM_MAP(tx1_slave,0) |
| r1293 | r1294 | |
| 957 | 957 | MDRV_CPU_ADD(I8086,5000000 ) |
| 958 | 958 | MDRV_CPU_PROGRAM_MAP(buggyboy_master,0) |
| 959 | 959 | MDRV_CPU_PERIODIC_INT(main_irq, 46 ) /* To do: measure HD46505 CUDISP output rate */ |
| 960 | //MDRV_WATCHDOG_TIME_INIT( | |
| 960 | //MDRV_WATCHDOG_TIME_INIT( | |
| 961 | 961 | |
| 962 | 962 | MDRV_CPU_ADD(I8086,5000000 ) |
| 963 | 963 | MDRV_CPU_PROGRAM_MAP(buggyboy_slave,0) |
| r1293 | r1294 | |
| 1020 | 1020 | MDRV_CPU_ADD(I8086,5000000 ) |
| 1021 | 1021 | MDRV_CPU_PROGRAM_MAP(buggyb1_master,0) |
| 1022 | 1022 | MDRV_CPU_PERIODIC_INT(main_irq, 46 ) /* To do: measure HD46505 CUDISP output rate */ |
| 1023 | //MDRV_WATCHDOG_TIME_INIT( | |
| 1023 | //MDRV_WATCHDOG_TIME_INIT( | |
| 1024 | 1024 | |
| 1025 | 1025 | MDRV_CPU_ADD(I8086,5000000 ) |
| 1026 | 1026 | MDRV_CPU_PROGRAM_MAP(buggyboy_slave,0) |
| r1293 | r1294 | |
|---|---|---|
| 343 | 343 | AM_RANGE(COP400_PORT_G, COP400_PORT_G) AM_READWRITE(cop_g_read,cop_g_write) |
| 344 | 344 | AM_RANGE(COP400_PORT_D, COP400_PORT_D) AM_WRITE(cop_d_write) |
| 345 | 345 | AM_RANGE(COP400_PORT_SK, COP400_PORT_SK) AM_WRITE(cop_sk_write) |
| 346 | AM_RANGE(COP400_PORT_SIO,COP400_PORT_SIO) AM_READ | |
| 346 | AM_RANGE(COP400_PORT_SIO,COP400_PORT_SIO) AM_READ_POR | |
| 347 | 347 | ADDRESS_MAP_END /* This is also very wrong. The keyboard interface needs to |
| 348 | 348 | be understood much better than what I have here */ |
| 349 | 349 | |
| r1293 | r1294 | |
| 463 | 463 | MDRV_MACHINE_START(thayers) |
| 464 | 464 | |
| 465 | 465 | /* io device cpu */ |
| 466 | MDRV_CPU_ADD(COP420, SCHEMATIC_CLOCK/2/8) | |
| 466 | MDRV_CPU_ADD(COP420, SCHEMATIC_CLOCK/2/8) | |
| 467 | 467 | MDRV_CPU_PROGRAM_MAP(copmem,0) |
| 468 | 468 | MDRV_CPU_IO_MAP(copio,0) |
| 469 | 469 |
| r1293 | r1294 | |
|---|---|---|
| 566 | 566 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 567 | 567 | |
| 568 | 568 | MDRV_SCREEN_REFRESH_RATE(60) |
| 569 | MDRV_SCREEN_VBLANK_TIME( | |
| 569 | MDRV_SCREEN_VBLANK_TIME(A | |
| 570 | 570 | MDRV_INTERLEAVE(140) /* 140 CPU slices per frame */ |
| 571 | 571 | |
| 572 | 572 | /* video hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 74 | 74 | #include "sound/okim6295.h" |
| 75 | 75 | |
| 76 | 76 | static UINT16 *cyclwarr_cpua_ram, *cyclwarr_cpub_ram; |
| 77 | UINT16 *tatsumi_c_ram, *apache3_g_ram; | |
| 77 | static UINT16 *tatsumi_c_ram, *apache3_g_ram; | |
| 78 | 78 | UINT16 *roundup5_d0000_ram, *roundup5_e0000_ram; |
| 79 | 79 | UINT8 *tatsumi_rom_sprite_lookup1, *tatsumi_rom_sprite_lookup2; |
| 80 | 80 | UINT8 *tatsumi_rom_clut0, *tatsumi_rom_clut1; |
| 81 | 81 | UINT16 *roundup5_unknown0, *roundup5_unknown1, *roundup5_unknown2; |
| 82 | UINT8 *apache3_bg_ram; | |
| 82 | static UINT8 *apache3_bg_ram; | |
| 83 | 83 | |
| 84 | 84 | /***************************************************************************/ |
| 85 | 85 |
| r1293 | r1294 | |
|---|---|---|
| 382 | 382 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 383 | 383 | |
| 384 | 384 | MDRV_SCREEN_REFRESH_RATE(58) |
| 385 | MDRV_SCREEN_VBLANK_TIME( | |
| 385 | MDRV_SCREEN_VBLANK_TIME(A | |
| 386 | 386 | |
| 387 | 387 | /* video hardware */ |
| 388 | 388 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_BEFORE_VBLANK) |
| r1293 | r1294 | |
| 421 | 421 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 422 | 422 | |
| 423 | 423 | MDRV_SCREEN_REFRESH_RATE(58) |
| 424 | MDRV_SCREEN_VBLANK_TIME( | |
| 424 | MDRV_SCREEN_VBLANK_TIME(A | |
| 425 | 425 | |
| 426 | 426 | /* video hardware */ |
| 427 | 427 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_BEFORE_VBLANK) |
| r1293 | r1294 | |
|---|---|---|
| 73 | 73 | extern UINT8 *segae_vdp_regs[]; /* pointer to vdp's registers */ |
| 74 | 74 | |
| 75 | 75 | // Interrupt handler - from drivers/segasyse.c |
| 76 | INTERRUPT_GEN (megaplay_bios_irq) | |
| 76 | static INTERRUPT_GEN (megaplay_bios_irq) | |
| 77 | 77 | { |
| 78 | 78 | int sline; |
| 79 | 79 | sline = 261 - cpu_getiloops(); |
| r1293 | r1294 | |
| 852 | 852 | ROM_END |
| 853 | 853 | |
| 854 | 854 | |
| 855 | void megplay_stat(void) | |
| 855 | static void megplay_stat(void) | |
| 856 | 856 | { |
| 857 | 857 | UINT8 *src = memory_region(REGION_CPU3); |
| 858 | 858 | UINT8 *instruction_rom = memory_region(REGION_USER1); |
| r1293 | r1294 | |
|---|---|---|
| 3665 | 3665 | } |
| 3666 | 3666 | |
| 3667 | 3667 | |
| 3668 | UINT32 *rddsp32_speedup; | |
| 3669 | offs_t rddsp32_speedup_pc; | |
| 3668 | static UINT32 *rddsp32_speedup; | |
| 3669 | static offs_t rddsp32_speedup_pc; | |
| 3670 | 3670 | static READ32_HANDLER( rddsp32_speedup_r ) |
| 3671 | 3671 | { |
| 3672 | 3672 | if (activecpu_get_pc() == rddsp32_speedup_pc && (*rddsp32_speedup >> 16) == 0) |
| r1293 | r1294 | |
|---|---|---|
| 346 | 346 | MDRV_CPU_VBLANK_INT( psx_vblank, 1 ) |
| 347 | 347 | |
| 348 | 348 | MDRV_SCREEN_REFRESH_RATE( 60 ) |
| 349 | MDRV_SCREEN_VBLANK_TIME( | |
| 349 | MDRV_SCREEN_VBLANK_TIME(A | |
| 350 | 350 | |
| 351 | 351 | MDRV_MACHINE_RESET( konamigv ) |
| 352 | 352 | MDRV_NVRAM_HANDLER(konamigv_93C46) |
| r1293 | r1294 | |
|---|---|---|
| 395 | 395 | MACHINE_DRIVER_END |
| 396 | 396 | |
| 397 | 397 | |
| 398 | MACHINE_DRIVER_START( crgolfhi ) | |
| 398 | static MACHINE_DRIVER_START( crgolfhi ) | |
| 399 | 399 | MDRV_IMPORT_FROM(crgolf) |
| 400 | 400 | |
| 401 | 401 | MDRV_SOUND_ADD(MSM5205, 384000) |
| r1293 | r1294 | |
|---|---|---|
| 438 | 438 | #include "sound/msm5205.h" |
| 439 | 439 | |
| 440 | 440 | /* RAM areas */ |
| 441 | UINT8* mastboy_tileram; | |
| 442 | UINT8* mastboy_vram; | |
| 443 | UINT8* mastboy_colram; | |
| 444 | UINT8* mastboy_workram; | |
| 441 | static UINT8* mastboy_tileram; | |
| 442 | static UINT8* mastboy_vram; | |
| 443 | static UINT8* mastboy_colram; | |
| 444 | static UINT8* mastboy_workram; | |
| 445 | 445 | |
| 446 | 446 | /* Bank Control */ |
| 447 | UINT8 mastboy_bank; | |
| 447 | static UINT8 mastboy_bank; | |
| 448 | 448 | |
| 449 | 449 | /* General */ |
| 450 | int mastboy_irq0_ack; | |
| 451 | int mastboy_backupram_enabled; | |
| 450 | static int mastboy_irq0_ack; | |
| 451 | static int mastboy_backupram_enabled; | |
| 452 | 452 | |
| 453 | 453 | /* MSM5205 */ |
| 454 | int mastboy_m5205_next; | |
| 455 | int mastboy_m5205_part; | |
| 456 | int mastboy_m5205_sambit0, mastboy_m5205_sambit1; | |
| 454 | static int mastboy_m5205_next; | |
| 455 | static int mastboy_m5205_part; | |
| 456 | static int mastboy_m5205_sambit0, mastboy_m5205_sambit1; | |
| 457 | 457 | |
| 458 | 458 | /* VIDEO EMULATION */ |
| 459 | 459 | |
| r1293 | r1294 | |
| 658 | 658 | if ((data&1)==1) cpunum_set_input_line(0,0, CLEAR_LINE); |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | INTERRUPT_GEN( mastboy_interrupt ) | |
| 661 | static INTERRUPT_GEN( mastboy_interrupt ) | |
| 662 | 662 | { |
| 663 | 663 | if ((mastboy_irq0_ack&1)==1) |
| 664 | 664 | { |
| r1293 | r1294 | |
|---|---|---|
| 307 | 307 | static INTERRUPT_GEN( topspeed_interrupt ) |
| 308 | 308 | { |
| 309 | 309 | /* Unsure how many int6's per frame */ |
| 310 | | |
| 310 | | |
| 311 | 311 | cpunum_set_input_line(0, 5, HOLD_LINE); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | static INTERRUPT_GEN( topspeed_cpub_interrupt ) |
| 315 | 315 | { |
| 316 | 316 | /* Unsure how many int6's per frame */ |
| 317 | | |
| 317 | | |
| 318 | 318 | cpunum_set_input_line(2, 5, HOLD_LINE); |
| 319 | 319 | } |
| 320 | 320 |
| r1293 | r1294 | |
|---|---|---|
| 250 | 250 | mame_printf_debug("sysreg_w: %08X, %08X, %08X\n", offset, data, mem_mask); |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | double adc0838_callback(int input) | |
| 253 | static double adc0838_callback(int input) | |
| 254 | 254 | { |
| 255 | 255 | switch (input) |
| 256 | 256 | { |
| r1293 | r1294 | |
|---|---|---|
| 573 | 573 | GEN_VDP = 3 // Genesis VDP running in SMS2 Mode |
| 574 | 574 | }; |
| 575 | 575 | |
| 576 | int sms_vdp_null_irq_callback(int status) | |
| 576 | static int sms_vdp_null_irq_callback(int status) | |
| 577 | 577 | { |
| 578 | 578 | return -1; |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | int sms_vdp_cpu0_irq_callback(int status) | |
| 581 | static int sms_vdp_cpu0_irq_callback(int status) | |
| 582 | 582 | { |
| 583 | 583 | if (status==1) |
| 584 | 584 | { |
| r1293 | r1294 | |
| 592 | 592 | return 0; |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | int sms_vdp_cpu1_irq_callback(int status) | |
| 595 | static int sms_vdp_cpu1_irq_callback(int status) | |
| 596 | 596 | { |
| 597 | 597 | if (status==1) |
| 598 | 598 | { |
| r1293 | r1294 | |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | 609 | |
| 610 | int sms_vdp_cpu2_irq_callback(int status) | |
| 610 | static int sms_vdp_cpu2_irq_callback(int status) | |
| 611 | 611 | { |
| 612 | 612 | if (status==1) |
| 613 | 613 | { |
| r1293 | r1294 | |
| 661 | 661 | int sms_scanline_counter; |
| 662 | 662 | int sms_total_scanlines; |
| 663 | 663 | int sms_framerate; |
| 664 | | |
| 664 | | |
| 665 | 665 | UINT16* cram_mamecolours; // for use on RGB_DIRECT screen |
| 666 | 666 | int (*set_irq)(int state); |
| 667 | 667 | |
| r1293 | r1294 | |
| 729 | 729 | chip->writemode = 0; |
| 730 | 730 | chip->r_bitmap = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format); |
| 731 | 731 | |
| 732 | chip->sms_scanline_timer = | |
| 732 | chip->sms_scanline_timer = | |
| 733 | 733 | |
| 734 | 734 | return chip; |
| 735 | 735 | } |
| r1293 | r1294 | |
| 737 | 737 | /* stop timer and clear ram.. used on megatech when we switch between genesis and sms mode */ |
| 738 | 738 | void segae_md_sms_stop_scanline_timer(void) |
| 739 | 739 | { |
| 740 | | |
| 740 | | |
| 741 | 741 | memset(md_sms_vdp->vram,0x00,0x4000); |
| 742 | 742 | } |
| 743 | 743 | |
| r1293 | r1294 | |
| 1056 | 1056 | } |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | void sms_render_spriteline(int scanline, struct sms_vdp* chip) | |
| 1059 | static void sms_render_spriteline(int scanline, struct sms_vdp* chip) | |
| 1060 | 1060 | { |
| 1061 | 1061 | int spritenum; |
| 1062 | 1062 | int height = 8; |
| r1293 | r1294 | |
| 1177 | 1177 | } |
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | void sms_render_tileline(int scanline, struct sms_vdp* chip) | |
| 1180 | static void sms_render_tileline(int scanline, struct sms_vdp* chip) | |
| 1181 | 1181 | { |
| 1182 | 1182 | int column = 0; |
| 1183 | 1183 | int count = 32; |
| r1293 | r1294 | |
| 1230 | 1230 | |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | void sms_copy_to_renderbuffer(int scanline, struct sms_vdp* chip) | |
| 1233 | static void sms_copy_to_renderbuffer(int scanline, struct sms_vdp* chip) | |
| 1234 | 1234 | { |
| 1235 | 1235 | int x; |
| 1236 | 1236 | UINT16* lineptr = BITMAP_ADDR16(chip->r_bitmap, scanline, 0); |
| r1293 | r1294 | |
| 1271 | 1271 | |
| 1272 | 1272 | } |
| 1273 | 1273 | |
| 1274 | void sms_draw_scanline(int scanline, struct sms_vdp* chip) | |
| 1274 | static void sms_draw_scanline(int scanline, struct sms_vdp* chip) | |
| 1275 | 1275 | { |
| 1276 | 1276 | |
| 1277 | 1277 | if (scanline>=0 && scanline<sms_mode_table[chip->screen_mode].sms2_height) |
| r1293 | r1294 | |
| 1304 | 1304 | if (chip->sms_scanline_counter<(chip->sms_total_scanlines-1)) |
| 1305 | 1305 | { |
| 1306 | 1306 | chip->sms_scanline_counter++; |
| 1307 | | |
| 1307 | | |
| 1308 | 1308 | |
| 1309 | 1309 | if (chip->sms_scanline_counter>sms_mode_table[chip->screen_mode].sms2_height) |
| 1310 | 1310 | { |
| r1293 | r1294 | |
| 1451 | 1451 | visarea.min_y = 0; |
| 1452 | 1452 | visarea.max_y = sms_mode_table[chip->screen_mode].sms2_height-1; |
| 1453 | 1453 | |
| 1454 | if (chip->chip_id==3) video_screen_configure(0, 256, 256, &visarea, HZ_TO_ | |
| 1454 | if (chip->chip_id==3) video_screen_configure(0, 256, 256, &visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate)); | |
| 1455 | 1455 | |
| 1456 | 1456 | } |
| 1457 | 1457 | else /* 160x144 */ |
| r1293 | r1294 | |
| 1469 | 1469 | |
| 1470 | 1470 | chip->sms_scanline_counter = -1; |
| 1471 | 1471 | chip->yscroll = chip->regs[0x9]; // this can't change mid-frame |
| 1472 | | |
| 1472 | | |
| 1473 | 1473 | } |
| 1474 | 1474 | |
| 1475 | 1475 | #ifdef UNUSED_FUNCTION |
| r1293 | r1294 | |
| 1491 | 1491 | #ifdef UNUSED_FUNCTION |
| 1492 | 1492 | MACHINE_RESET(sms) |
| 1493 | 1493 | { |
| 1494 | | |
| 1494 | | |
| 1495 | 1495 | } |
| 1496 | 1496 | #endif |
| 1497 | 1497 | |
| r1293 | r1294 | |
| 1949 | 1949 | |
| 1950 | 1950 | static MACHINE_RESET(systeme) |
| 1951 | 1951 | { |
| 1952 | mame_timer_adjust_ptr(vdp1->sms_scanline_timer, time_zero, time_zero); | |
| 1953 | mame_timer_adjust_ptr(vdp2->sms_scanline_timer, time_zero, time_zero); | |
| 1952 | timer_adjust_ptr(vdp1->sms_scanline_timer, attotime_zero, attotime_zero); | |
| 1953 | timer_adjust_ptr(vdp2->sms_scanline_timer, attotime_zero, attotime_zero); | |
| 1954 | 1954 | } |
| 1955 | 1955 | |
| 1956 | 1956 | MACHINE_RESET(megatech_md_sms) |
| 1957 | 1957 | { |
| 1958 | | |
| 1958 | | |
| 1959 | 1959 | } |
| 1960 | 1960 | |
| 1961 | 1961 | MACHINE_RESET(megatech_bios) |
| 1962 | 1962 | { |
| 1963 | | |
| 1963 | | |
| 1964 | 1964 | } |
| 1965 | 1965 | |
| 1966 | 1966 | static VIDEO_EOF(systeme) |
| r1293 | r1294 | |
| 2050 | 2050 | } |
| 2051 | 2051 | |
| 2052 | 2052 | |
| 2053 | MACHINE_DRIVER_START( systeme ) | |
| 2053 | static MACHINE_DRIVER_START( systeme ) | |
| 2054 | 2054 | MDRV_CPU_ADD_TAG("z80", Z80, 10738600/2) /* correct for hangonjr, and astroflash/transformer at least */ |
| 2055 | 2055 | MDRV_CPU_PROGRAM_MAP(systeme_readmem,systeme_writemem) |
| 2056 | 2056 | MDRV_CPU_IO_MAP(sms_readport,sms_writeport) |
| r1293 | r1294 | |
|---|---|---|
| 450 | 450 | #define ATAPI_DATA_SIZE ( 64 * 1024 ) |
| 451 | 451 | |
| 452 | 452 | static UINT8 *atapi_regs; |
| 453 | static | |
| 453 | static | |
| 454 | 454 | static SCSIInstance *inserted_cdrom; |
| 455 | 455 | static SCSIInstance *available_cdroms[ 2 ]; |
| 456 | 456 | static UINT8 *atapi_data; |
| r1293 | r1294 | |
| 463 | 463 | int i, n_this; |
| 464 | 464 | UINT8 sector_buffer[ 4096 ]; |
| 465 | 465 | |
| 466 | | |
| 466 | | |
| 467 | 467 | |
| 468 | 468 | // verboselog( 2, "atapi_xfer_end( %d ) atapi_xferlen = %d, atapi_xfermod=%d\n", x, atapi_xfermod, atapi_xferlen ); |
| 469 | 469 | |
| r1293 | r1294 | |
| 508 | 508 | atapi_regs[ATAPI_REG_COUNTLOW] = atapi_xferlen & 0xff; |
| 509 | 509 | atapi_regs[ATAPI_REG_COUNTHIGH] = (atapi_xferlen>>8)&0xff; |
| 510 | 510 | |
| 511 | | |
| 511 | | |
| 512 | 512 | } |
| 513 | 513 | else |
| 514 | 514 | { |
| r1293 | r1294 | |
| 734 | 734 | |
| 735 | 735 | case 0x45: // PLAY |
| 736 | 736 | atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_BSY; |
| 737 | | |
| 737 | | |
| 738 | 738 | break; |
| 739 | 739 | } |
| 740 | 740 | |
| r1293 | r1294 | |
| 892 | 892 | atapi_data_len = 0; |
| 893 | 893 | atapi_cdata_wait = 0; |
| 894 | 894 | |
| 895 | atapi_timer = mame_timer_alloc( atapi_xfer_end ); | |
| 896 | mame_timer_adjust(atapi_timer, time_never, 0, time_never); | |
| 895 | atapi_timer = timer_alloc( atapi_xfer_end ); | |
| 896 | timer_adjust(atapi_timer, attotime_never, 0, attotime_never); | |
| 897 | 897 | |
| 898 | 898 | for( i = 0; i < 2; i++ ) |
| 899 | 899 | { |
| r1293 | r1294 | |
| 959 | 959 | verboselog( 2, "atapi_xfer_end: %d %d\n", atapi_xferlen, atapi_xfermod ); |
| 960 | 960 | |
| 961 | 961 | // set a transfer complete timer (Note: CYCLES_PER_SECTOR can't be lower than 2000 or the BIOS ends up "out of order") |
| 962 | | |
| 962 | | |
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | static UINT32 m_n_security_control; |
| r1293 | r1294 | |
| 1096 | 1096 | |
| 1097 | 1097 | /* Root Counters */ |
| 1098 | 1098 | |
| 1099 | static | |
| 1099 | static | |
| 1100 | 1100 | static UINT16 m_p_n_root_count[ 3 ]; |
| 1101 | 1101 | static UINT16 m_p_n_root_mode[ 3 ]; |
| 1102 | 1102 | static UINT16 m_p_n_root_target[ 3 ]; |
| r1293 | r1294 | |
| 1171 | 1171 | { |
| 1172 | 1172 | if( ( m_p_n_root_mode[ n_counter ] & RC_STOP ) != 0 ) |
| 1173 | 1173 | { |
| 1174 | | |
| 1174 | | |
| 1175 | 1175 | } |
| 1176 | 1176 | else |
| 1177 | 1177 | { |
| r1293 | r1294 | |
| 1185 | 1185 | |
| 1186 | 1186 | n_duration *= root_divider( n_counter ); |
| 1187 | 1187 | |
| 1188 | | |
| 1188 | | |
| 1189 | 1189 | } |
| 1190 | 1190 | } |
| 1191 | 1191 | |
| r1293 | r1294 | |
| 1483 | 1483 | |
| 1484 | 1484 | for (i = 0; i < 3; i++) |
| 1485 | 1485 | { |
| 1486 | m_p_timer_root[i] = | |
| 1486 | m_p_timer_root[i] = | |
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | 1489 | timekeeper_init( 0, TIMEKEEPER_M48T58, memory_region( REGION_USER11 ) ); |
| r1293 | r1294 | |
| 2716 | 2716 | MDRV_CPU_VBLANK_INT( sys573_vblank, 1 ) |
| 2717 | 2717 | |
| 2718 | 2718 | MDRV_SCREEN_REFRESH_RATE( 60 ) |
| 2719 | MDRV_SCREEN_VBLANK_TIME( | |
| 2719 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2720 | 2720 | |
| 2721 | 2721 | MDRV_MACHINE_RESET( konami573 ) |
| 2722 | 2722 | MDRV_NVRAM_HANDLER( konami573 ) |
| r1293 | r1294 | |
|---|---|---|
| 52 | 52 | * |
| 53 | 53 | *************************************/ |
| 54 | 54 | |
| 55 | #define TIME_4V | |
| 55 | #define TIME_4V | |
| 56 | 56 | |
| 57 | 57 | static UINT8 *sbrkout_sound; |
| 58 | 58 | |
| r1293 | r1294 | |
| 77 | 77 | |
| 78 | 78 | static MACHINE_RESET( sbrkout ) |
| 79 | 79 | { |
| 80 | | |
| 80 | | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 |
| r1293 | r1294 | |
|---|---|---|
| 543 | 543 | * Input ports * |
| 544 | 544 | *************************/ |
| 545 | 545 | |
| 546 | INPUT_PORTS_START( ampoker2 ) | |
| 546 | static INPUT_PORTS_START( ampoker2 ) | |
| 547 | 547 | PORT_START_TAG("IN0") |
| 548 | 548 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 549 | 549 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| r1293 | r1294 | |
| 628 | 628 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Clear Credits") PORT_CODE(KEYCODE_4) |
| 629 | 629 | INPUT_PORTS_END |
| 630 | 630 | |
| 631 | INPUT_PORTS_START( ampkr95 ) | |
| 631 | static INPUT_PORTS_START( ampkr95 ) | |
| 632 | 632 | PORT_START_TAG("IN0") |
| 633 | 633 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 634 | 634 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| r1293 | r1294 | |
| 713 | 713 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Clear Credits") PORT_CODE(KEYCODE_4) |
| 714 | 714 | INPUT_PORTS_END |
| 715 | 715 | |
| 716 | INPUT_PORTS_START( sigmapkr ) | |
| 716 | static INPUT_PORTS_START( sigmapkr ) | |
| 717 | 717 | PORT_START_TAG("IN0") |
| 718 | 718 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 719 | 719 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| r1293 | r1294 | |
| 860 | 860 | MDRV_CPU_PROGRAM_MAP(ampoker2_map, 0) |
| 861 | 861 | MDRV_CPU_IO_MAP(ampoker2_io_map, 0) |
| 862 | 862 | MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 1536) |
| 863 | MDRV_WATCHDOG_TIME_INIT( | |
| 863 | MDRV_WATCHDOG_TIME_INIT( | |
| 864 | 864 | //MDRV_WATCHDOG_VBLANK_INIT(8) |
| 865 | 865 | MDRV_SCREEN_REFRESH_RATE(60) |
| 866 | 866 | /* if VBLANK is used, the watchdog timer stop to work. |
| r1293 | r1294 | |
|---|---|---|
| 1321 | 1321 | mcr68_common_init(MCR_CHIP_SQUEAK_DELUXE, 0, 0); |
| 1322 | 1322 | |
| 1323 | 1323 | /* Zwackery doesn't care too much about this value; currently taken from Blasted */ |
| 1324 | mcr68_timing_factor = | |
| 1324 | mcr68_timing_factor = | |
| 1325 | 1325 | } |
| 1326 | 1326 | |
| 1327 | 1327 | |
| r1293 | r1294 | |
| 1330 | 1330 | mcr68_common_init(MCR_SOUNDS_GOOD, 0, 0); |
| 1331 | 1331 | |
| 1332 | 1332 | /* Xenophobe doesn't care too much about this value; currently taken from Blasted */ |
| 1333 | mcr68_timing_factor = | |
| 1333 | mcr68_timing_factor = | |
| 1334 | 1334 | |
| 1335 | 1335 | /* install control port handler */ |
| 1336 | 1336 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, xenophobe_control_w); |
| r1293 | r1294 | |
| 1342 | 1342 | mcr68_common_init(MCR_TURBO_CHIP_SQUEAK | MCR_SOUNDS_GOOD, 0, -6); |
| 1343 | 1343 | |
| 1344 | 1344 | /* Spy Hunter 2 doesn't care too much about this value; currently taken from Blasted */ |
| 1345 | mcr68_timing_factor = | |
| 1345 | mcr68_timing_factor = | |
| 1346 | 1346 | |
| 1347 | 1347 | /* analog port handling is a bit tricky */ |
| 1348 | 1348 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, spyhunt2_control_w); |
| r1293 | r1294 | |
| 1358 | 1358 | /* Blasted checks the timing of VBLANK relative to the 493 interrupt */ |
| 1359 | 1359 | /* VBLANK is required to come within 220-256 E clocks (i.e., 2200-2560 CPU clocks) */ |
| 1360 | 1360 | /* after the 493; we also allow 16 E clocks for latency */ |
| 1361 | mcr68_timing_factor = | |
| 1361 | mcr68_timing_factor = | |
| 1362 | 1362 | |
| 1363 | 1363 | /* handle control writes */ |
| 1364 | 1364 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, blasted_control_w); |
| r1293 | r1294 | |
| 1374 | 1374 | mcr68_common_init(MCR_WILLIAMS_SOUND, 16, 0); |
| 1375 | 1375 | |
| 1376 | 1376 | /* Arch Rivals doesn't care too much about this value; currently taken from Blasted */ |
| 1377 | mcr68_timing_factor = | |
| 1377 | mcr68_timing_factor = | |
| 1378 | 1378 | |
| 1379 | 1379 | /* handle control writes */ |
| 1380 | 1380 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, archrivl_control_w); |
| r1293 | r1294 | |
| 1393 | 1393 | mcr68_common_init(MCR_WILLIAMS_SOUND, 16, 0); |
| 1394 | 1394 | |
| 1395 | 1395 | /* Pigskin doesn't care too much about this value; currently taken from Tri-Sports */ |
| 1396 | mcr68_timing_factor = | |
| 1396 | mcr68_timing_factor = | |
| 1397 | 1397 | |
| 1398 | 1398 | state_save_register_global_array(protection_data); |
| 1399 | 1399 | } |
| r1293 | r1294 | |
| 1406 | 1406 | /* Tri-Sports checks the timing of VBLANK relative to the 493 interrupt */ |
| 1407 | 1407 | /* VBLANK is required to come within 87-119 E clocks (i.e., 870-1190 CPU clocks) */ |
| 1408 | 1408 | /* after the 493 */ |
| 1409 | mcr68_timing_factor = | |
| 1409 | mcr68_timing_factor = | |
| 1410 | 1410 | } |
| 1411 | 1411 | |
| 1412 | 1412 |
| r1293 | r1294 | |
|---|---|---|
| 255 | 255 | GFXDECODE_END |
| 256 | 256 | |
| 257 | 257 | |
| 258 | INTERRUPT_GEN( pbaction_interrupt ) | |
| 258 | static INTERRUPT_GEN( pbaction_interrupt ) | |
| 259 | 259 | { |
| 260 | 260 | cpunum_set_input_line_and_vector(1, 0, HOLD_LINE, 0x02); /* the CPU is in Interrupt Mode 2 */ |
| 261 | 261 | } |
| r1293 | r1294 | |
|---|---|---|
| 308 | 308 | calculate_collisions(); |
| 309 | 309 | |
| 310 | 310 | /* 100 cycle delay is arbitrary */ |
| 311 | | |
| 311 | | |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | thunderx_1f98_data = data; |
| r1293 | r1294 | |
|---|---|---|
| 248 | 248 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 249 | 249 | |
| 250 | 250 | PORT_START_TAG("DSW") |
| 251 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) | |
| 251 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:!1,!2") | |
| 252 | 252 | PORT_DIPSETTING( 0x00, "3" ) |
| 253 | 253 | PORT_DIPSETTING( 0x01, "4" ) |
| 254 | 254 | PORT_DIPSETTING( 0x02, "5" ) |
| 255 | 255 | PORT_DIPSETTING( 0x03, "6" ) |
| 256 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) ) | |
| 256 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:!3,!4") | |
| 257 | 257 | PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) ) |
| 258 | 258 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) |
| 259 | 259 | PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) |
| 260 | 260 | PORT_DIPSETTING( 0x0c, DEF_STR( 1C_3C ) ) |
| 261 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) ) | |
| 261 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:!5,!6") | |
| 262 | 262 | PORT_DIPSETTING( 0x00, "20k only" ) |
| 263 | 263 | PORT_DIPSETTING( 0x10, "30k only" ) |
| 264 | 264 | PORT_DIPSETTING( 0x20, "40k only" ) |
| 265 | 265 | PORT_DIPSETTING( 0x30, DEF_STR( None ) ) |
| 266 | PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Difficulty ) ) | |
| 266 | PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:!7,!8") | |
| 267 | 267 | PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) |
| 268 | 268 | PORT_DIPSETTING( 0x80, DEF_STR( Medium ) ) |
| 269 | 269 | PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) |
| r1293 | r1294 | |
| 282 | 282 | PORT_INCLUDE( mario ) |
| 283 | 283 | |
| 284 | 284 | PORT_MODIFY( "DSW" ) |
| 285 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) | |
| 285 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:!1,!2") | |
| 286 | 286 | PORT_DIPSETTING( 0x00, "3" ) |
| 287 | 287 | PORT_DIPSETTING( 0x01, "4" ) |
| 288 | 288 | PORT_DIPSETTING( 0x02, "5" ) |
| 289 | 289 | PORT_DIPSETTING( 0x03, "6" ) |
| 290 | PORT_DIPNAME( 0x1c, 0x00, DEF_STR( Coinage ) ) | |
| 290 | PORT_DIPNAME( 0x1c, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:!3,!4,!5") | |
| 291 | 291 | PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) |
| 292 | 292 | PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) |
| 293 | 293 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) |
| r1293 | r1294 | |
| 296 | 296 | PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) ) |
| 297 | 297 | PORT_DIPSETTING( 0x14, DEF_STR( 1C_5C ) ) |
| 298 | 298 | PORT_DIPSETTING( 0x1c, DEF_STR( 1C_6C ) ) |
| 299 | PORT_DIPNAME( 0x20, 0x20, "2 Players Game" ) | |
| 299 | PORT_DIPNAME( 0x20, 0x20, "2 Players Game" ) PORT_DIPLOCATION("SW1:!6") | |
| 300 | 300 | PORT_DIPSETTING( 0x00, "1 Credit" ) |
| 301 | 301 | PORT_DIPSETTING( 0x20, "2 Credits" ) |
| 302 | PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Bonus_Life ) ) | |
| 302 | PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:!7,!8") | |
| 303 | 303 | PORT_DIPSETTING( 0x00, "20k 50k 30k+" ) |
| 304 | 304 | PORT_DIPSETTING( 0x40, "30k 60k 30k+" ) |
| 305 | 305 | PORT_DIPSETTING( 0x80, "40k 70k 30k+" ) |
| r1293 | r1294 | |
| 310 | 310 | PORT_INCLUDE( marioo ) |
| 311 | 311 | |
| 312 | 312 | PORT_MODIFY( "DSW" ) |
| 313 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) ) | |
| 313 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:!5,!6") | |
| 314 | 314 | PORT_DIPSETTING( 0x00, "20k 40k 20k+" ) |
| 315 | 315 | PORT_DIPSETTING( 0x10, "30k 50k 20k+" ) |
| 316 | 316 | PORT_DIPSETTING( 0x20, "40k 60k 20k+" ) |
| r1293 | r1294 | |
|---|---|---|
| 530 | 530 | MDRV_CPU_VBLANK_INT(irq0_line_hold,4) |
| 531 | 531 | |
| 532 | 532 | MDRV_SCREEN_REFRESH_RATE(60) |
| 533 | MDRV_SCREEN_VBLANK_TIME( | |
| 533 | MDRV_SCREEN_VBLANK_TIME(A | |
| 534 | 534 | |
| 535 | 535 | /* video hardware */ |
| 536 | 536 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 184 | 184 | |
| 185 | 185 | /* Default Eeprom for the parent.. otherwise it will always complain first boot */ |
| 186 | 186 | /* its easy to init but this saves me a bit of time.. */ |
| 187 | UINT8 lethalen_default_eeprom[48] = { | |
| 187 | static UINT8 lethalen_default_eeprom[48] = { | |
| 188 | 188 | 0x02, 0x1E, 0x00, 0x00, 0x39, 0x31, 0x39, 0x31, 0x55, 0x45, 0x77, 0x00, 0x00, 0x00, 0x00, 0x01, |
| 189 | 189 | 0x02, 0x01, 0x00, 0x03, 0x05, 0x01, 0x01, 0x02, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 190 | 190 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF |
| r1293 | r1294 | |
|---|---|---|
| 15 | 15 | #include "videopin.lh" |
| 16 | 16 | #include "sound/discrete.h" |
| 17 | 17 | |
| 18 | static mame_time time_pushed; | |
| 19 | static mame_time time_released; | |
| 18 | static attotime time_pushed; | |
| 19 | static attotime time_released; | |
| 20 | 20 | |
| 21 | 21 | static UINT8 prev = 0; |
| 22 | 22 | static UINT8 mask = 0; |
| r1293 | r1294 | |
| 33 | 33 | { |
| 34 | 34 | if (val == 0) |
| 35 | 35 | { |
| 36 | time_released = | |
| 36 | time_released = | |
| 37 | 37 | |
| 38 | 38 | if (!mask) |
| 39 | 39 | { |
| r1293 | r1294 | |
| 42 | 42 | } |
| 43 | 43 | else |
| 44 | 44 | { |
| 45 | time_pushed = | |
| 45 | time_pushed = | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | prev = val; |
| r1293 | r1294 | |
| 65 | 65 | scanline = 32; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | | |
| 68 | | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | static MACHINE_RESET( videopin ) |
| 73 | 73 | { |
| 74 | | |
| 74 | | |
| 75 | 75 | |
| 76 | 76 | /* both output latches are cleared on reset */ |
| 77 | 77 | |
| r1293 | r1294 | |
| 82 | 82 | |
| 83 | 83 | static double calc_plunger_pos(void) |
| 84 | 84 | { |
| 85 | return ( | |
| 85 | return ( | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 |
| r1293 | r1294 | |
|---|---|---|
| 215 | 215 | |
| 216 | 216 | ***************************************************************************/ |
| 217 | 217 | |
| 218 | INTERRUPT_GEN( naughtyb_interrupt ) | |
| 218 | static INTERRUPT_GEN( naughtyb_interrupt ) | |
| 219 | 219 | { |
| 220 | 220 | if (readinputport(3) & 1) |
| 221 | 221 | cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 41 | 41 | scanline = 16; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | | |
| 44 | | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | static MACHINE_RESET( runaway ) |
| 49 | 49 | { |
| 50 | | |
| 50 | | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 |
| r1293 | r1294 | |
|---|---|---|
| 180 | 180 | cpu_interrupt_enable(1,0); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | INTERRUPT_GEN( toypop_main_interrupt ) | |
| 183 | static INTERRUPT_GEN( toypop_main_interrupt ) | |
| 184 | 184 | { |
| 185 | 185 | irq0_line_assert(); // this also checks if irq is enabled - IMPORTANT! |
| 186 | 186 | // so don't replace with cpunum_set_input_line(0, 0, ASSERT_LINE); |
| r1293 | r1294 | |
| 226 | 226 | timer_call_after_resynch(0, disable_interrupts); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | INTERRUPT_GEN( toypop_m68000_interrupt ) | |
| 229 | static INTERRUPT_GEN( toypop_m68000_interrupt ) | |
| 230 | 230 | { |
| 231 | 231 | if (interrupt_enable_68k) |
| 232 | 232 | cpunum_set_input_line(2, 6, HOLD_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 307 | 307 | extern WRITE16_HANDLER( wlstar_tilebank_w ); |
| 308 | 308 | |
| 309 | 309 | extern UINT16 *tumblepb_pf1_data,*tumblepb_pf2_data; |
| 310 | UINT16* tumblepb_mainram; | |
| 310 | static UINT16* tumblepb_mainram; | |
| 311 | 311 | UINT16* jumppop_control; |
| 312 | 312 | UINT16* suprtrio_control; |
| 313 | 313 | |
| r1293 | r1294 | |
| 439 | 439 | |
| 440 | 440 | |
| 441 | 441 | |
| 442 | int tumblep_music_command; | |
| 443 | int tumblep_music_bank; | |
| 444 | int tumbleb2_music_is_playing; | |
| 442 | static int tumblep_music_command; | |
| 443 | static int tumblep_music_bank; | |
| 444 | static int tumbleb2_music_is_playing; | |
| 445 | 445 | |
| 446 | void tumbleb2_playmusic(void) | |
| 446 | static void tumbleb2_playmusic(void) | |
| 447 | 447 | { |
| 448 | 448 | int status = OKIM6295_status_0_r(0); |
| 449 | 449 | |
| r1293 | r1294 | |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | |
| 461 | INTERRUPT_GEN( tumbleb2_interrupt ) | |
| 461 | static INTERRUPT_GEN( tumbleb2_interrupt ) | |
| 462 | 462 | { |
| 463 | 463 | cpunum_set_input_line(0, 6, HOLD_LINE); |
| 464 | 464 | tumbleb2_playmusic(); |
| r1293 | r1294 | |
| 485 | 485 | }; |
| 486 | 486 | |
| 487 | 487 | /* we use channels 1,2,3 for sound effects, and channel 4 for music */ |
| 488 | void tumbleb2_set_music_bank(int bank) | |
| 488 | static void tumbleb2_set_music_bank(int bank) | |
| 489 | 489 | { |
| 490 | 490 | UINT8 *oki = memory_region(REGION_SOUND1); |
| 491 | 491 | memcpy(&oki[0x38000], &oki[0x80000+0x38000+0x8000*bank],0x8000); |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | void tumbleb2_play_sound (int data) | |
| 494 | static void tumbleb2_play_sound (int data) | |
| 495 | 495 | { |
| 496 | 496 | int status = OKIM6295_status_0_r(0); |
| 497 | 497 | |
| r1293 | r1294 | |
| 524 | 524 | // bank 7 = how to play? |
| 525 | 525 | // bank 8 = boss??? |
| 526 | 526 | |
| 527 | void process_tumbleb2_music_command(int data) | |
| 527 | static void process_tumbleb2_music_command(int data) | |
| 528 | 528 | { |
| 529 | 529 | int status = OKIM6295_status_0_r(0); |
| 530 | 530 | |
| r1293 | r1294 | |
| 852 | 852 | { |
| 853 | 853 | soundlatch_w(0,data & 0xff); |
| 854 | 854 | // needed for Super Trio which reads the sound with polling |
| 855 | // cpu_spinuntil_time(MAME_TIME_IN_USEC(100)); | |
| 856 | cpu_boost_interleave(time_zero, MAME_TIME_IN_USEC(20)); | |
| 855 | // cpu_spinuntil_time(ATTOTIME_IN_USEC(100)); | |
| 856 | cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(20)); | |
| 857 | 857 | |
| 858 | 858 | } |
| 859 | 859 | } |
| r1293 | r1294 | |
| 2034 | 2034 | MDRV_CPU_VBLANK_INT(irq6_line_hold,1) |
| 2035 | 2035 | |
| 2036 | 2036 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2037 | MDRV_SCREEN_VBLANK_TIME( | |
| 2037 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2038 | 2038 | |
| 2039 | 2039 | /* video hardware */ |
| 2040 | 2040 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 2064 | 2064 | MDRV_CPU_VBLANK_INT(tumbleb2_interrupt,1) |
| 2065 | 2065 | |
| 2066 | 2066 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2067 | MDRV_SCREEN_VBLANK_TIME( | |
| 2067 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2068 | 2068 | |
| 2069 | 2069 | /* video hardware */ |
| 2070 | 2070 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 2097 | 2097 | MDRV_CPU_PROGRAM_MAP(jumpkids_sound_map,0) |
| 2098 | 2098 | |
| 2099 | 2099 | MDRV_SCREEN_REFRESH_RATE(60) |
| 2100 | MDRV_SCREEN_VBLANK_TIME( | |
| 2100 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2101 | 2101 | |
| 2102 | 2102 | /* video hardware */ |
| 2103 | 2103 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 2125 | 2125 | MDRV_CPU_VBLANK_INT(irq6_line_hold,1) |
| 2126 | 2126 | |
| 2127 | 2127 | MDRV_SCREEN_REFRESH_RATE(60) |
| 2128 | MDRV_SCREEN_VBLANK_TIME( | |
| 2128 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2129 | 2129 | |
| 2130 | 2130 | /* video hardware */ |
| 2131 | 2131 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 2188 | 2188 | MDRV_CPU_PROGRAM_MAP(semicom_sound_readmem,semicom_sound_writemem) |
| 2189 | 2189 | |
| 2190 | 2190 | MDRV_SCREEN_REFRESH_RATE(60) |
| 2191 | MDRV_SCREEN_VBLANK_TIME( | |
| 2191 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2192 | 2192 | |
| 2193 | 2193 | MDRV_MACHINE_RESET ( htchctch ) |
| 2194 | 2194 | |
| r1293 | r1294 | |
| 2217 | 2217 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0) |
| 2218 | 2218 | MACHINE_DRIVER_END |
| 2219 | 2219 | |
| 2220 | MACHINE_DRIVER_START( cookbib ) | |
| 2220 | static MACHINE_DRIVER_START( cookbib ) | |
| 2221 | 2221 | MDRV_IMPORT_FROM(htchctch) |
| 2222 | 2222 | MDRV_VIDEO_UPDATE( semicom_altoffsets ) |
| 2223 | 2223 | MACHINE_DRIVER_END |
| 2224 | 2224 | |
| 2225 | MACHINE_DRIVER_START( bcstory ) | |
| 2225 | static MACHINE_DRIVER_START( bcstory ) | |
| 2226 | 2226 | MDRV_IMPORT_FROM(htchctch) |
| 2227 | 2227 | MDRV_VIDEO_UPDATE( bcstory ) |
| 2228 | 2228 | |
| r1293 | r1294 | |
| 2232 | 2232 | MDRV_SOUND_ROUTE(1, "right", 0.10) |
| 2233 | 2233 | MACHINE_DRIVER_END |
| 2234 | 2234 | |
| 2235 | MACHINE_DRIVER_START( semibase ) | |
| 2235 | static MACHINE_DRIVER_START( semibase ) | |
| 2236 | 2236 | MDRV_IMPORT_FROM(bcstory) |
| 2237 | 2237 | MDRV_VIDEO_UPDATE(semibase ) |
| 2238 | 2238 | MACHINE_DRIVER_END |
| 2239 | 2239 | |
| 2240 | MACHINE_DRIVER_START( sdfight ) | |
| 2240 | static MACHINE_DRIVER_START( sdfight ) | |
| 2241 | 2241 | MDRV_IMPORT_FROM(bcstory) |
| 2242 | 2242 | MDRV_VIDEO_START(sdfight) |
| 2243 | 2243 | MDRV_VIDEO_UPDATE(sdfight) |
| 2244 | 2244 | MACHINE_DRIVER_END |
| 2245 | 2245 | |
| 2246 | 2246 | |
| 2247 | MACHINE_DRIVER_START( metlsavr ) | |
| 2247 | static MACHINE_DRIVER_START( metlsavr ) | |
| 2248 | 2248 | MDRV_IMPORT_FROM(cookbib) |
| 2249 | 2249 | |
| 2250 | 2250 | MDRV_SOUND_REPLACE("ym2151", YM2151, 3427190) |
| r1293 | r1294 | |
| 2266 | 2266 | MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 1953) /* measured */ |
| 2267 | 2267 | |
| 2268 | 2268 | MDRV_SCREEN_REFRESH_RATE(60) |
| 2269 | MDRV_SCREEN_VBLANK_TIME( | |
| 2269 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2270 | 2270 | |
| 2271 | 2271 | /* video hardware */ |
| 2272 | 2272 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 2303 | 2303 | MDRV_CPU_PROGRAM_MAP(semicom_sound_readmem,semicom_sound_writemem) |
| 2304 | 2304 | |
| 2305 | 2305 | MDRV_SCREEN_REFRESH_RATE(60) |
| 2306 | MDRV_SCREEN_VBLANK_TIME( | |
| 2306 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2307 | 2307 | |
| 2308 | 2308 | /* video hardware */ |
| 2309 | 2309 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 2333 | 2333 | MDRV_CPU_VBLANK_INT(tumbleb2_interrupt,1) |
| 2334 | 2334 | |
| 2335 | 2335 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2336 | MDRV_SCREEN_VBLANK_TIME( | |
| 2336 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2337 | 2337 | |
| 2338 | 2338 | /* video hardware */ |
| 2339 | 2339 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 3279 | 3279 | |
| 3280 | 3280 | /******************************************************************************/ |
| 3281 | 3281 | |
| 3282 | #if TUMBLEP_HACK | |
| 3282 | 3283 | void tumblepb_patch_code(UINT16 offset) |
| 3283 | 3284 | { |
| 3284 | 3285 | /* A hack which enables all Dip Switches effects */ |
| r1293 | r1294 | |
| 3286 | 3287 | RAM[(offset + 0)/2] = 0x0240; |
| 3287 | 3288 | RAM[(offset + 2)/2] = 0xffff; // andi.w #$f3ff, D0 |
| 3288 | 3289 | } |
| 3290 | #endif | |
| 3289 | 3291 | |
| 3290 | 3292 | |
| 3291 | 3293 | static void tumblepb_gfx1_rearrange(void) |
| r1293 | r1294 | |
|---|---|---|
| 53 | 53 | #define DRMATH_MONITOR_DISPLAY 0 |
| 54 | 54 | #endif |
| 55 | 55 | |
| 56 | UINT16 *micro3d_sprite_vram; | |
| 56 | static UINT16 *micro3d_sprite_vram; | |
| 57 | 57 | static UINT16 *m68681_base; |
| 58 | 58 | static UINT16 *m68901_base; |
| 59 | 59 | |
| r1293 | r1294 | |
| 395 | 395 | m68901_int_gen(GPIP4); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | void micro3d_vblank(void) | |
| 398 | static void micro3d_vblank(void) | |
| 399 | 399 | { |
| 400 | 400 | m68901_int_gen(GPIP7); |
| 401 | 401 | } |
| r1293 | r1294 | |
| 405 | 405 | |
| 406 | 406 | static TIMER_CALLBACK( timera_int ) |
| 407 | 407 | { |
| 408 | // mame_timer_set(scale_up_mame_time(MAME_TIME_IN_HZ(M68901_CLK), ((m68901_base[0xf]>>8) & 0xff) * 200),0,timera_int); // Set the timer again. | |
| 409 | mame_timer_set(MAME_TIME_IN_USEC(1000),0,timera_int); // Set the timer again. | |
| 408 | // timer_set(attotime_mul(ATTOTIME_IN_HZ(M68901_CLK), ((m68901_base[0xf]>>8) & 0xff) * 200),0,timera_int); // Set the timer again. | |
| 409 | timer_set(ATTOTIME_IN_USEC(1000),0,timera_int); // Set the timer again. | |
| 410 | 410 | m68901_int_gen(TMRA); // Fire an interrupt. |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | #ifdef UNUSED_FUNCTION |
| 414 | 414 | static TIMER_CALLBACK( timerb_int ) |
| 415 | 415 | { |
| 416 | | |
| 416 | | |
| 417 | 417 | m68901_int_gen(TMRB); // Fire an interrupt. |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | static TIMER_CALLBACK( timerc_int ) |
| 421 | 421 | { |
| 422 | | |
| 422 | | |
| 423 | 423 | m68901_int_gen(TMRC); // Fire an interrupt. |
| 424 | 424 | } |
| 425 | 425 | #endif |
| 426 | 426 | |
| 427 | 427 | static TIMER_CALLBACK( timerd_int ) |
| 428 | 428 | { |
| 429 | | |
| 429 | | |
| 430 | 430 | m68901_int_gen(TMRD); // Fire an interrupt. |
| 431 | 431 | } |
| 432 | 432 | |
| r1293 | r1294 | |
| 473 | 473 | break; |
| 474 | 474 | |
| 475 | 475 | case 0x0f: mame_printf_debug("Timer A Data:%4x\n",value); // Timer A Data Register |
| 476 | | |
| 476 | | |
| 477 | 477 | break; |
| 478 | 478 | |
| 479 | 479 | case 0x10: mame_printf_debug("Timer B Data:%4x\n",value); // Timer B Data Register |
| 480 | // | |
| 480 | // | |
| 481 | 481 | break; |
| 482 | 482 | |
| 483 | 483 | case 0x11: mame_printf_debug("Timer C Data:%4x\n",value); // Timer C Data Register |
| 484 | // | |
| 484 | // | |
| 485 | 485 | break; |
| 486 | 486 | |
| 487 | 487 | case 0x12: mame_printf_debug("Timer D Data:%4x\n",value); |
| 488 | | |
| 488 | | |
| 489 | 489 | break; |
| 490 | 490 | |
| 491 | 491 | } |
| r1293 | r1294 | |
|---|---|---|
| 61 | 61 | cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | | |
| 64 | | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | static MACHINE_RESET( ultratnk ) |
| 69 | 69 | { |
| 70 | | |
| 70 | | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 |
| r1293 | r1294 | |
|---|---|---|
| 26 | 26 | #include "sound/ay8910.h" |
| 27 | 27 | |
| 28 | 28 | |
| 29 | UINT8 *tugboat_ram,*tugboat_score; | |
| 29 | static UINT8 *tugboat_ram; | |
| 30 | //UINT8 *tugboat_score; | |
| 30 | 31 | |
| 31 | 32 | |
| 32 | 33 | static UINT8 hd46505_0_reg[18],hd46505_1_reg[18]; |
| r1293 | r1294 | |
| 167 | 168 | static TIMER_CALLBACK( interrupt_gen ) |
| 168 | 169 | { |
| 169 | 170 | cpunum_set_input_line(0, 0, HOLD_LINE); |
| 170 | | |
| 171 | | |
| 171 | 172 | } |
| 172 | 173 | |
| 173 | 174 | static MACHINE_START( tugboat ) |
| r1293 | r1294 | |
| 179 | 180 | static MACHINE_RESET( tugboat ) |
| 180 | 181 | { |
| 181 | 182 | pia_reset(); |
| 182 | | |
| 183 | | |
| 183 | 184 | } |
| 184 | 185 | |
| 185 | 186 |
| r1293 | r1294 | |
|---|---|---|
| 69 | 69 | |
| 70 | 70 | static INTERRUPT_GEN( gunbustr_interrupt ) |
| 71 | 71 | { |
| 72 | | |
| 72 | | |
| 73 | 73 | cpunum_set_input_line(0, 4, HOLD_LINE); |
| 74 | 74 | } |
| 75 | 75 | |
| r1293 | r1294 | |
| 181 | 181 | static WRITE32_HANDLER( gunbustr_gun_w ) |
| 182 | 182 | { |
| 183 | 183 | /* 10000 cycle delay is arbitrary */ |
| 184 | | |
| 184 | | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 |
| r1293 | r1294 | |
|---|---|---|
| 806 | 806 | //static UINT16 *motor_ram; |
| 807 | 807 | |
| 808 | 808 | static size_t taitoz_sharedram_size; |
| 809 | UINT16 *taitoz_sharedram; /* read externally to draw Spacegun crosshair */ | |
| 809 | static UINT16 *taitoz_sharedram; /* read externally to draw Spacegun crosshair */ | |
| 810 | 810 | |
| 811 | 811 | static READ16_HANDLER( sharedram_r ) |
| 812 | 812 | { |
| r1293 | r1294 | |
| 911 | 911 | sci_int6 = !sci_int6; |
| 912 | 912 | |
| 913 | 913 | if (sci_int6) |
| 914 | | |
| 914 | | |
| 915 | 915 | cpunum_set_input_line(0, 4, HOLD_LINE); |
| 916 | 916 | } |
| 917 | 917 | |
| r1293 | r1294 | |
| 926 | 926 | dblaxle_int6 = !dblaxle_int6; |
| 927 | 927 | |
| 928 | 928 | if (dblaxle_int6) |
| 929 | | |
| 929 | | |
| 930 | 930 | |
| 931 | 931 | cpunum_set_input_line(0, 4, HOLD_LINE); |
| 932 | 932 | } |
| r1293 | r1294 | |
| 934 | 934 | static INTERRUPT_GEN( dblaxle_cpub_interrupt ) |
| 935 | 935 | { |
| 936 | 936 | // Unsure how many int6's per frame |
| 937 | | |
| 937 | | |
| 938 | 938 | cpunum_set_input_line(2, 4, HOLD_LINE); |
| 939 | 939 | } |
| 940 | 940 | |
| r1293 | r1294 | |
| 1175 | 1175 | but we don't want CPUA to have an int6 before int4 is over (?) |
| 1176 | 1176 | */ |
| 1177 | 1177 | |
| 1178 | | |
| 1178 | | |
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | 1181 | |
| r1293 | r1294 | |
| 1258 | 1258 | Four lightgun interrupts happen before the collected coords |
| 1259 | 1259 | are moved to shared ram where CPUA can use them. */ |
| 1260 | 1260 | |
| 1261 | | |
| 1261 | | |
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | 1264 | |
| r1293 | r1294 | |
| 2906 | 2906 | MDRV_VIDEO_UPDATE(chasehq) |
| 2907 | 2907 | |
| 2908 | 2908 | /* sound hardware */ |
| 2909 | MDRV_SPEAKER_ADD("front", 0.0, 0.0, 0.7); | |
| 2910 | MDRV_SPEAKER_ADD("rear", 0.0, 0.0, 1.3); | |
| 2909 | MDRV_SPEAKER_ADD("front", 0.0, 0.0, 0.7) | |
| 2910 | MDRV_SPEAKER_ADD("rear", 0.0, 0.0, 1.3) | |
| 2911 | 2911 | |
| 2912 | 2912 | MDRV_SOUND_ADD(YM2610, 16000000/2) |
| 2913 | 2913 | MDRV_SOUND_CONFIG(ym2610_interface) |
| r1293 | r1294 | |
| 3081 | 3081 | MDRV_VIDEO_UPDATE(chasehq) |
| 3082 | 3082 | |
| 3083 | 3083 | /* sound hardware */ |
| 3084 | MDRV_SPEAKER_ADD("front", 0.0, 0.0, 0.7); | |
| 3085 | MDRV_SPEAKER_ADD("rear", 0.0, 0.0, 1.3); | |
| 3084 | MDRV_SPEAKER_ADD("front", 0.0, 0.0, 0.7) | |
| 3085 | MDRV_SPEAKER_ADD("rear", 0.0, 0.0, 1.3) | |
| 3086 | 3086 | |
| 3087 | 3087 | MDRV_SOUND_ADD(YM2610, 16000000/2) |
| 3088 | 3088 | MDRV_SOUND_CONFIG(ym2610_interface) |
| r1293 | r1294 | |
|---|---|---|
| 132 | 132 | /* pbillian sample playback */ |
| 133 | 133 | static INT16 *samplebuf; |
| 134 | 134 | |
| 135 | void pbillian_sh_start(void) | |
| 135 | static void pbillian_sh_start(void) | |
| 136 | 136 | { |
| 137 | 137 | UINT8 *src = memory_region(REGION_SOUND1); |
| 138 | 138 | int i; |
| r1293 | r1294 | |
| 345 | 345 | from_z80 = param; |
| 346 | 346 | from_mcu_pending = 0; |
| 347 | 347 | cpunum_set_input_line(1, 0, HOLD_LINE); |
| 348 | cpu_boost_interleave(time_zero, | |
| 348 | cpu_boost_interleave(attotime_zero, | |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | static TIMER_CALLBACK( delayed_mcu_z80_w ) |
| r1293 | r1294 | |
|---|---|---|
| 474 | 474 | { |
| 475 | 475 | /* if a command is still pending, and we haven't maxed out our timer, set a new one */ |
| 476 | 476 | if (gpu_command_pending && param < 1000) |
| 477 | | |
| 477 | | |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | |
| r1293 | r1294 | |
| 984 | 984 | }; |
| 985 | 985 | |
| 986 | 986 | |
| 987 | MACHINE_DRIVER_START( cojagr3k ) | |
| 987 | static MACHINE_DRIVER_START( cojagr3k ) | |
| 988 | 988 | |
| 989 | 989 | /* basic machine hardware */ |
| 990 | 990 | MDRV_CPU_ADD(R3000BE, 66000000/2) |
| r1293 | r1294 | |
| 1025 | 1025 | MACHINE_DRIVER_END |
| 1026 | 1026 | |
| 1027 | 1027 | |
| 1028 | MACHINE_DRIVER_START( r3knarrow ) | |
| 1028 | static MACHINE_DRIVER_START( r3knarrow ) | |
| 1029 | 1029 | MDRV_IMPORT_FROM(cojagr3k) |
| 1030 | 1030 | |
| 1031 | 1031 | /* video hardware */ |
| r1293 | r1294 | |
| 1033 | 1033 | MACHINE_DRIVER_END |
| 1034 | 1034 | |
| 1035 | 1035 | |
| 1036 | MACHINE_DRIVER_START( cojag68k ) | |
| 1036 | static MACHINE_DRIVER_START( cojag68k ) | |
| 1037 | 1037 | |
| 1038 | 1038 | /* basic machine hardware */ |
| 1039 | 1039 | MDRV_CPU_ADD(M68EC020, 50000000/2) |
| r1293 | r1294 | |
|---|---|---|
| 180 | 180 | |
| 181 | 181 | |
| 182 | 182 | |
| 183 | UINT16* pntnpuzl_3a0000ram; | |
| 184 | UINT16* pntnpuzl_bank; | |
| 183 | static UINT16* pntnpuzl_3a0000ram; | |
| 184 | static UINT16* pntnpuzl_bank; | |
| 185 | 185 | /* vid */ |
| 186 | 186 | static VIDEO_START( pntnpuzl ) |
| 187 | 187 | { |
| r1293 | r1294 | |
| 409 | 409 | ADDRESS_MAP_END |
| 410 | 410 | |
| 411 | 411 | |
| 412 | INTERRUPT_GEN( pntnpuzl_irq ) | |
| 412 | static INTERRUPT_GEN( pntnpuzl_irq ) | |
| 413 | 413 | { |
| 414 | 414 | if (readinputport(0) & 0x02) /* coin */ |
| 415 | 415 | cpunum_set_input_line(0, 1, PULSE_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 1 | 1 | #define JOE_DEBUG 0 |
| 2 | #define JOE_DMADELAY a | |
| 2 | #define JOE_DMADELAY a | |
| 3 | 3 | |
| 4 | 4 | /*************************************************************************** |
| 5 | 5 | |
| r1293 | r1294 | |
| 50 | 50 | static UINT16 *gijoe_workram; |
| 51 | 51 | static UINT16 cur_control2; |
| 52 | 52 | static int init_eeprom_count; |
| 53 | static | |
| 53 | static | |
| 54 | 54 | |
| 55 | 55 | static struct EEPROM_interface eeprom_interface = |
| 56 | 56 | { |
| r1293 | r1294 | |
| 172 | 172 | gijoe_objdma(); |
| 173 | 173 | |
| 174 | 174 | // 42.7us(clr) + 341.3us(xfer) delay at 6Mhz dotclock |
| 175 | | |
| 175 | | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | // trigger V-blank interrupt |
| r1293 | r1294 | |
| 207 | 207 | { |
| 208 | 208 | state_save_register_global(cur_control2); |
| 209 | 209 | |
| 210 | dmadelay_timer = | |
| 210 | dmadelay_timer = | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 |
| r1293 | r1294 | |
|---|---|---|
| 29 | 29 | extern void fghtbskt_sh_start(void); |
| 30 | 30 | extern WRITE8_HANDLER( fghtbskt_samples_w ); |
| 31 | 31 | |
| 32 | UINT8 *wilytowr_videoram2, *wilytowr_scrollram; | |
| 32 | static UINT8 *wilytowr_videoram2, *wilytowr_scrollram; | |
| 33 | 33 | |
| 34 | 34 | static int pal_bank, fg_flag, sy_offset; |
| 35 | 35 |
| r1293 | r1294 | |
|---|---|---|
| 302 | 302 | * |
| 303 | 303 | *************************************/ |
| 304 | 304 | |
| 305 | INTERRUPT_GEN( looping_interrupt ) | |
| 305 | static INTERRUPT_GEN( looping_interrupt ) | |
| 306 | 306 | { |
| 307 | 307 | cpunum_set_input_line_and_vector(0, 0, ASSERT_LINE, 4); |
| 308 | 308 | } |
| r1293 | r1294 | |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | |
| 332 | void looping_spcint(int state) | |
| 332 | static void looping_spcint(int state) | |
| 333 | 333 | { |
| 334 | 334 | cpunum_set_input_line_and_vector(1, 0, state, 6); |
| 335 | 335 | } |
| r1293 | r1294 | |
|---|---|---|
| 348 | 348 | |
| 349 | 349 | /* V60 interrupt controller */ |
| 350 | 350 | static UINT8 v60_irq_control[0x10]; |
| 351 | static | |
| 351 | static | |
| 352 | 352 | |
| 353 | 353 | /* sound interrupt controller */ |
| 354 | 354 | static UINT8 sound_irq_control[4]; |
| r1293 | r1294 | |
| 392 | 392 | memset(v60_irq_control, 0xff, sizeof(v60_irq_control)); |
| 393 | 393 | |
| 394 | 394 | /* allocate timers */ |
| 395 | v60_irq_timer[0] = mame_timer_alloc(signal_v60_irq_callback); | |
| 396 | v60_irq_timer[1] = mame_timer_alloc(signal_v60_irq_callback); | |
| 395 | v60_irq_timer[0] = timer_alloc(signal_v60_irq_callback); | |
| 396 | v60_irq_timer[1] = timer_alloc(signal_v60_irq_callback); | |
| 397 | 397 | |
| 398 | 398 | /* clear IRQ lines */ |
| 399 | 399 | cpunum_set_input_line(0, 0, CLEAR_LINE); |
| r1293 | r1294 | |
| 480 | 480 | duration = v60_irq_control[8] + ((v60_irq_control[9] << 8) & 0xf00); |
| 481 | 481 | if (duration) |
| 482 | 482 | { |
| 483 | mame_time period = make_mame_time(0, mame_time_to_subseconds(MAME_TIME_IN_HZ(TIMER_0_CLOCK)) * duration); | |
| 484 | mame_timer_adjust(v60_irq_timer[0], period, MAIN_IRQ_TIMER0, time_never); | |
| 483 | attotime period = attotime_make(0, attotime_to_attoseconds(ATTOTIME_IN_HZ(TIMER_0_CLOCK)) * duration); | |
| 484 | timer_adjust(v60_irq_timer[0], period, MAIN_IRQ_TIMER0, attotime_never); | |
| 485 | 485 | } |
| 486 | 486 | break; |
| 487 | 487 | |
| r1293 | r1294 | |
| 491 | 491 | duration = v60_irq_control[10] + ((v60_irq_control[11] << 8) & 0xf00); |
| 492 | 492 | if (duration) |
| 493 | 493 | { |
| 494 | mame_time period = make_mame_time(0, mame_time_to_subseconds(MAME_TIME_IN_HZ(TIMER_1_CLOCK)) * duration); | |
| 495 | mame_timer_adjust(v60_irq_timer[1], period, MAIN_IRQ_TIMER1, time_never); | |
| 494 | attotime period = attotime_make(0, attotime_to_attoseconds(ATTOTIME_IN_HZ(TIMER_1_CLOCK)) * duration); | |
| 495 | timer_adjust(v60_irq_timer[1], period, MAIN_IRQ_TIMER1, attotime_never); | |
| 496 | 496 | } |
| 497 | 497 | break; |
| 498 | 498 | |
| r1293 | r1294 | |
| 571 | 571 | { |
| 572 | 572 | signal_v60_irq(MAIN_IRQ_VBSTART); |
| 573 | 573 | system32_set_vblank(1); |
| 574 | | |
| 574 | | |
| 575 | 575 | if (system32_prot_vblank) |
| 576 | 576 | (*system32_prot_vblank)(); |
| 577 | 577 | } |
| r1293 | r1294 | |
|---|---|---|
| 70 | 70 | static VIDEO_UPDATE( darkhors ); |
| 71 | 71 | |
| 72 | 72 | static tilemap *darkhors_tmap, *darkhors_tmap2; |
| 73 | UINT32 *darkhors_tmapram, *darkhors_tmapscroll; | |
| 74 | UINT32 *darkhors_tmapram2, *darkhors_tmapscroll2; | |
| 73 | static UINT32 *darkhors_tmapram, *darkhors_tmapscroll; | |
| 74 | static UINT32 *darkhors_tmapram2, *darkhors_tmapscroll2; | |
| 75 | 75 | |
| 76 | 76 | static TILE_GET_INFO( get_tile_info_0 ) |
| 77 | 77 | { |
| r1293 | r1294 | |
|---|---|---|
| 411 | 411 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 412 | 412 | |
| 413 | 413 | MDRV_SCREEN_REFRESH_RATE(57) |
| 414 | MDRV_SCREEN_VBLANK_TIME( | |
| 414 | MDRV_SCREEN_VBLANK_TIME(A | |
| 415 | 415 | /* the Lode Runner manual (similar but different hardware) */ |
| 416 | 416 | /* talks about 55Hz and 1790ms vblank duration. */ |
| 417 | 417 | |
| r1293 | r1294 | |
| 442 | 442 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 443 | 443 | |
| 444 | 444 | MDRV_SCREEN_REFRESH_RATE(57) |
| 445 | MDRV_SCREEN_VBLANK_TIME( | |
| 445 | MDRV_SCREEN_VBLANK_TIME(A | |
| 446 | 446 | /* the Lode Runner manual (similar but different hardware) */ |
| 447 | 447 | /* talks about 55Hz and 1790ms vblank duration. */ |
| 448 | 448 |
| r1293 | r1294 | |
|---|---|---|
| 293 | 293 | MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262) |
| 294 | 294 | |
| 295 | 295 | MDRV_SCREEN_REFRESH_RATE(59.997) |
| 296 | MDRV_SCREEN_VBLANK_TIME( | |
| 296 | MDRV_SCREEN_VBLANK_TIME(A | |
| 297 | 297 | |
| 298 | 298 | MDRV_MACHINE_RESET(amiga) |
| 299 | 299 | MDRV_NVRAM_HANDLER(generic_0fill) |
| r1293 | r1294 | |
|---|---|---|
| 243 | 243 | int equites_flip; |
| 244 | 244 | |
| 245 | 245 | // Splendor Blast Hardware |
| 246 | int splndrbt_flip; | |
| 246 | static int splndrbt_flip; | |
| 247 | 247 | |
| 248 | 248 | /******************************************************************************/ |
| 249 | 249 | // Local Functions |
| r1293 | r1294 | |
| 691 | 691 | MDRV_CPU_VBLANK_INT(equites_interrupt, 2) |
| 692 | 692 | |
| 693 | 693 | MDRV_SCREEN_REFRESH_RATE(60) |
| 694 | MDRV_SCREEN_VBLANK_TIME( | |
| 694 | MDRV_SCREEN_VBLANK_TIME(A | |
| 695 | 695 | |
| 696 | 696 | /* video hardware */ |
| 697 | 697 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_UPDATE_AFTER_VBLANK) |
| r1293 | r1294 | |
| 718 | 718 | MDRV_CPU_VBLANK_INT(splndrbt_interrupt, 2) |
| 719 | 719 | |
| 720 | 720 | MDRV_SCREEN_REFRESH_RATE(60) |
| 721 | MDRV_SCREEN_VBLANK_TIME( | |
| 721 | MDRV_SCREEN_VBLANK_TIME(A | |
| 722 | 722 | MDRV_MACHINE_RESET(splndrbt) |
| 723 | 723 | |
| 724 | 724 | /* video hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 274 | 274 | { |
| 275 | 275 | // IRQ |
| 276 | 276 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| 277 | | |
| 277 | | |
| 278 | 278 | |
| 279 | 279 | laserdisc_vsync(discinfo); |
| 280 | 280 | } |
| r1293 | r1294 | |
|---|---|---|
| 6753 | 6753 | static DRIVER_INIT( svcpcb ) |
| 6754 | 6754 | { |
| 6755 | 6755 | /* start a timer that will check the BIOS select DIP every second */ |
| 6756 | | |
| 6756 | | |
| 6757 | 6757 | svcpcb_bios_timer_callback(machine, 0); |
| 6758 | 6758 | |
| 6759 | 6759 | svcchaos_px_decrypt(); |
| r1293 | r1294 | |
|---|---|---|
| 391 | 391 | MDRV_CPU_IO_MAP(decocass_mcu_portmap,0) |
| 392 | 392 | |
| 393 | 393 | MDRV_SCREEN_REFRESH_RATE(57) |
| 394 | MDRV_SCREEN_VBLANK_TIME( | |
| 394 | MDRV_SCREEN_VBLANK_TIME(A | |
| 395 | 395 | MDRV_INTERLEAVE(7) /* interleave CPUs */ |
| 396 | 396 | |
| 397 | 397 | MDRV_MACHINE_RESET(decocass) |
| r1293 | r1294 | |
|---|---|---|
| 937 | 937 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 938 | 938 | MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 480) |
| 939 | 939 | |
| 940 | MDRV_INTERLEAVE(32) | |
| 940 | MDRV_INTERLEAVE(32) | |
| 941 | 941 | MDRV_SCREEN_REFRESH_RATE(60) |
| 942 | MDRV_SCREEN_VBLANK_TIME( | |
| 942 | MDRV_SCREEN_VBLANK_TIME(A | |
| 943 | 943 | |
| 944 | 944 | MDRV_NVRAM_HANDLER(mystwarr) |
| 945 | 945 | MDRV_MACHINE_START(mystwarr) |
| r1293 | r1294 | |
| 978 | 978 | MDRV_CPU_MODIFY("main") |
| 979 | 979 | MDRV_CPU_PROGRAM_MAP(vsreadmem,vswritemem) |
| 980 | 980 | MDRV_CPU_VBLANK_INT(metamrph_interrupt, 40) |
| 981 | MDRV_SCREEN_VBLANK_TIME( | |
| 981 | MDRV_SCREEN_VBLANK_TIME(A | |
| 982 | 982 | |
| 983 | 983 | /* video hardware */ |
| 984 | 984 | MDRV_VIDEO_START(viostorm) |
| r1293 | r1294 | |
| 996 | 996 | MDRV_CPU_MODIFY("main") |
| 997 | 997 | MDRV_CPU_PROGRAM_MAP(mmreadmem,mmwritemem) |
| 998 | 998 | MDRV_CPU_VBLANK_INT(metamrph_interrupt, 40) |
| 999 | MDRV_SCREEN_VBLANK_TIME( | |
| 999 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1000 | 1000 | |
| 1001 | 1001 | /* video hardware */ |
| 1002 | 1002 | MDRV_VIDEO_START(metamrph) |
| r1293 | r1294 | |
| 1014 | 1014 | MDRV_CPU_MODIFY("main") |
| 1015 | 1015 | MDRV_CPU_PROGRAM_MAP(dddreadmem, dddwritemem) |
| 1016 | 1016 | MDRV_CPU_VBLANK_INT(ddd_interrupt, 1) |
| 1017 | MDRV_SCREEN_VBLANK_TIME( | |
| 1017 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1018 | 1018 | |
| 1019 | 1019 | MDRV_GFXDECODE(dadandrn) |
| 1020 | 1020 | |
| r1293 | r1294 | |
| 1034 | 1034 | MDRV_CPU_MODIFY("main") |
| 1035 | 1035 | MDRV_CPU_PROGRAM_MAP(gaiareadmem,gaiawritemem) |
| 1036 | 1036 | MDRV_CPU_VBLANK_INT(ddd_interrupt, 1) |
| 1037 | MDRV_SCREEN_VBLANK_TIME( | |
| 1037 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1038 | 1038 | |
| 1039 | 1039 | MDRV_GFXDECODE(gaiapols) |
| 1040 | 1040 | |
| r1293 | r1294 | |
| 1056 | 1056 | MDRV_CPU_MODIFY("main") |
| 1057 | 1057 | MDRV_CPU_PROGRAM_MAP(mcreadmem,mcwritemem) |
| 1058 | 1058 | MDRV_CPU_VBLANK_INT(mchamp_interrupt, 2) |
| 1059 | MDRV_SCREEN_VBLANK_TIME( | |
| 1059 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1060 | 1060 | |
| 1061 | 1061 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_HAS_SHADOWS | VIDEO_HAS_HIGHLIGHTS | VIDEO_UPDATE_BEFORE_VBLANK) |
| 1062 | 1062 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| r1293 | r1294 | |
|---|---|---|
| 318 | 318 | if (sndti_exists(SOUND_BEEP, 0)) |
| 319 | 319 | { |
| 320 | 320 | beep_set_state(0, 1); |
| 321 | beep_set_frequency(0, S | |
| 321 | beep_set_frequency(0, ATTOS | |
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| r1293 | r1294 | |
| 844 | 844 | MDRV_CPU_IO_MAP(dleuro_io_map,0) |
| 845 | 845 | MDRV_CPU_VBLANK_INT(vblank_callback, 1) |
| 846 | 846 | |
| 847 | MDRV_WATCHDOG_TIME_INIT( | |
| 847 | MDRV_WATCHDOG_TIME_INIT( | |
| 848 | 848 | |
| 849 | 849 | MDRV_MACHINE_START(dleuro) |
| 850 | 850 | MDRV_MACHINE_RESET(dlair) |
| r1293 | r1294 | |
|---|---|---|
| 212 | 212 | |
| 213 | 213 | static int game_id, blitter_busy, collision_count, stars_enabled, bgcolor, ffcount, ffhead, fftail; |
| 214 | 214 | static int mVectorType, sndnmi_mask, firq_level; |
| 215 | static | |
| 215 | static | |
| 216 | 216 | |
| 217 | 217 | static offs_t halleys_collision_detection; |
| 218 | 218 | |
| r1293 | r1294 | |
| 1006 | 1006 | else |
| 1007 | 1007 | { |
| 1008 | 1008 | blitter_busy = 1; |
| 1009 | | |
| 1009 | | |
| 1010 | 1010 | } |
| 1011 | 1011 | } |
| 1012 | 1012 | } |
| r1293 | r1294 | |
| 2228 | 2228 | |
| 2229 | 2229 | init_common(); |
| 2230 | 2230 | |
| 2231 | blitter_reset_timer = | |
| 2231 | blitter_reset_timer = | |
| 2232 | 2232 | } |
| 2233 | 2233 | |
| 2234 | 2234 |
| r1293 | r1294 | |
|---|---|---|
| 216 | 216 | static void PS7500_startTimer0(void); |
| 217 | 217 | static void PS7500_startTimer1(void); |
| 218 | 218 | |
| 219 | static mame_timer *PS7500timer0; | |
| 220 | static mame_timer *PS7500timer1; | |
| 219 | static emu_timer *PS7500timer0; | |
| 220 | static emu_timer *PS7500timer1; | |
| 221 | 221 | |
| 222 | 222 | |
| 223 | 223 | static VIDEO_UPDATE(ssfindo) |
| r1293 | r1294 | |
| 267 | 267 | int val=((PS7500_IO[T0low]&0xff)|((PS7500_IO[T0high]&0xff)<<8))>>1; |
| 268 | 268 | |
| 269 | 269 | if(val==0) |
| 270 | | |
| 270 | | |
| 271 | 271 | else |
| 272 | | |
| 272 | | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | static TIMER_CALLBACK( PS7500_Timer1_callback ) |
| r1293 | r1294 | |
| 285 | 285 | { |
| 286 | 286 | int val=((PS7500_IO[T1low]&0xff)|((PS7500_IO[T1high]&0xff)<<8))>>1; |
| 287 | 287 | if(val==0) |
| 288 | | |
| 288 | | |
| 289 | 289 | else |
| 290 | | |
| 290 | | |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | static INTERRUPT_GEN( ssfindo_interrupt ) |
| r1293 | r1294 | |
| 304 | 304 | PS7500_IO[IOCR] = 0x3f; |
| 305 | 305 | PS7500_IO[VIDCR] = 0; |
| 306 | 306 | |
| 307 | mame_timer_adjust( PS7500timer0, time_never, 0, time_never); | |
| 308 | mame_timer_adjust( PS7500timer1, time_never, 0, time_never); | |
| 307 | timer_adjust( PS7500timer0, attotime_never, 0, attotime_never); | |
| 308 | timer_adjust( PS7500timer1, attotime_never, 0, attotime_never); | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | static READ32_HANDLER(PS7500_IO_r) |
| r1293 | r1294 | |
| 705 | 705 | static DRIVER_INIT(ssfindo) |
| 706 | 706 | { |
| 707 | 707 | flashType=0; |
| 708 | PS7500timer0 = mame_timer_alloc(PS7500_Timer0_callback); | |
| 709 | PS7500timer1 = mame_timer_alloc(PS7500_Timer1_callback); | |
| 708 | PS7500timer0 = timer_alloc(PS7500_Timer0_callback); | |
| 709 | PS7500timer1 = timer_alloc(PS7500_Timer1_callback); | |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | static DRIVER_INIT(ppcar) |
| 713 | 713 | { |
| 714 | 714 | flashType=1; |
| 715 | PS7500timer0 = mame_timer_alloc(PS7500_Timer0_callback); | |
| 716 | PS7500timer1 = mame_timer_alloc(PS7500_Timer1_callback); | |
| 715 | PS7500timer0 = timer_alloc(PS7500_Timer0_callback); | |
| 716 | PS7500timer1 = timer_alloc(PS7500_Timer1_callback); | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | GAME( 1999, ssfindo, 0, ssfindo, ssfindo, ssfindo, ROT0, "Icarus", "See See Find Out", GAME_NO_SOUND ) |
| r1293 | r1294 | |
|---|---|---|
| 99 | 99 | scanline = 0; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | | |
| 102 | | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
| r1293 | r1294 | |
| 223 | 223 | |
| 224 | 224 | static MACHINE_RESET( firetrk ) |
| 225 | 225 | { |
| 226 | | |
| 226 | | |
| 227 | 227 | |
| 228 | 228 | if (GAME_IS_MONTECARLO) |
| 229 | 229 | { |
| r1293 | r1294 | |
|---|---|---|
| 91 | 91 | * NVRAM Handlers * |
| 92 | 92 | ******************/ |
| 93 | 93 | |
| 94 | NVRAM_HANDLER( peplus ) | |
| 94 | static NVRAM_HANDLER( peplus ) | |
| 95 | 95 | { |
| 96 | 96 | if (read_or_write) |
| 97 | 97 | { |
| r1293 | r1294 | |
|---|---|---|
| 189 | 189 | static void assert_irq(void) |
| 190 | 190 | { |
| 191 | 191 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| 192 | | |
| 192 | | |
| 193 | 193 | /* Timing here is an educated GUESS, Z80 /INT must stay high so the irq |
| 194 | 194 | fires no less than TWICE per frame, else game doesn't work right. |
| 195 | 195 | 6000000 / 56.747 = 105732.4616 cycles per frame, we'll call it A |
| r1293 | r1294 | |
|---|---|---|
| 421 | 421 | */ |
| 422 | 422 | cpunum_set_input_line(2, INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE); |
| 423 | 423 | cpunum_set_input_line(2, 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE); |
| 424 | cpu_boost_interleave(time_zero, | |
| 424 | cpu_boost_interleave(attotime_zero, | |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 |
| r1293 | r1294 | |
|---|---|---|
| 104 | 104 | static UINT32 vblank_interrupt_pending; |
| 105 | 105 | static UINT32 display_position_interrupt_pending; |
| 106 | 106 | static UINT32 irq3_pending; |
| 107 | static mame_timer *display_position_interrupt_timer; | |
| 108 | static mame_timer *display_position_vblank_timer; | |
| 109 | static mame_timer *vblank_interrupt_timer; | |
| 107 | static emu_timer *display_position_interrupt_timer; | |
| 108 | static emu_timer *display_position_vblank_timer; | |
| 109 | static emu_timer *vblank_interrupt_timer; | |
| 110 | 110 | |
| 111 | 111 | static UINT8 controller_select; |
| 112 | 112 | |
| r1293 | r1294 | |
| 159 | 159 | { |
| 160 | 160 | if ((display_counter + 1) != 0) |
| 161 | 161 | { |
| 162 | | |
| 162 | | |
| 163 | 163 | if (LOG_VIDEO_SYSTEM) logerror("adjust_display_position_interrupt_timer current y: %02x current x: %02x target y: %x target x: %x\n", video_screen_get_vpos(0), video_screen_get_hpos(0), (display_counter + 1) / NEOGEO_HTOTAL, (display_counter + 1) % NEOGEO_HTOTAL); |
| 164 | 164 | |
| 165 | | |
| 165 | | |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
| r1293 | r1294 | |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /* set timer for next screen */ |
| 253 | | |
| 253 | | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | |
| r1293 | r1294 | |
| 266 | 266 | update_interrupts(); |
| 267 | 267 | |
| 268 | 268 | /* set timer for next screen */ |
| 269 | | |
| 269 | | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | |
| 273 | 273 | static void create_interrupt_timers(void) |
| 274 | 274 | { |
| 275 | display_position_interrupt_timer = mame_timer_alloc(display_position_interrupt_callback); | |
| 276 | display_position_vblank_timer = mame_timer_alloc(display_position_vblank_callback); | |
| 277 | vblank_interrupt_timer = mame_timer_alloc(vblank_interrupt_callback); | |
| 275 | display_position_interrupt_timer = timer_alloc(display_position_interrupt_callback); | |
| 276 | display_position_vblank_timer = timer_alloc(display_position_vblank_callback); | |
| 277 | vblank_interrupt_timer = timer_alloc(vblank_interrupt_callback); | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | |
| 281 | 281 | static void start_interrupt_timers(void) |
| 282 | 282 | { |
| 283 | mame_timer_adjust(vblank_interrupt_timer, video_screen_get_time_until_pos(0, NEOGEO_VBSTART, 0), 0, time_zero); | |
| 284 | mame_timer_adjust(display_position_vblank_timer, video_screen_get_time_until_pos(0, NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS), 0, time_zero); | |
| 283 | timer_adjust(vblank_interrupt_timer, video_screen_get_time_until_pos(0, NEOGEO_VBSTART, 0), 0, attotime_zero); | |
| 284 | timer_adjust(display_position_vblank_timer, video_screen_get_time_until_pos(0, NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS), 0, attotime_zero); | |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | |
| r1293 | r1294 | |
| 566 | 566 | audio_cpu_assert_nmi(); |
| 567 | 567 | |
| 568 | 568 | /* boost the interleave to let the audio CPU read the command */ |
| 569 | cpu_boost_interleave(time_zero, | |
| 569 | cpu_boost_interleave(attotime_zero, | |
| 570 | 570 | |
| 571 | 571 | if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", activecpu_get_pc(), data, mem_mask); |
| 572 | 572 | } |
| r1293 | r1294 | |
| 1230 | 1230 | MDRV_CPU_PROGRAM_MAP(audio_map,0) |
| 1231 | 1231 | MDRV_CPU_IO_MAP(auido_io_map,0) |
| 1232 | 1232 | |
| 1233 | MDRV_WATCHDOG_TIME_INIT( | |
| 1233 | MDRV_WATCHDOG_TIME_INIT( | |
| 1234 | 1234 | |
| 1235 | 1235 | MDRV_MACHINE_START(neogeo) |
| 1236 | 1236 | MDRV_MACHINE_RESET(neogeo) |
| r1293 | r1294 | |
|---|---|---|
| 131 | 131 | WRITE32_HANDLER( konamigx_t1_psacmap_w ); |
| 132 | 132 | WRITE32_HANDLER( konamigx_t4_psacmap_w ); |
| 133 | 133 | |
| 134 | int konamigx_cfgport; | |
| 134 | static int konamigx_cfgport; | |
| 135 | 135 | |
| 136 | 136 | static UINT32 *gx_workram; /* workram pointer for ESC protection fun */ |
| 137 | 137 | static UINT16 *gx_sndram; |
| 138 | 138 | static int gx_rdport1_3, gx_syncen; |
| 139 | 139 | |
| 140 | static | |
| 140 | static | |
| 141 | 141 | |
| 142 | 142 | /**********************************************************************************/ |
| 143 | 143 | /* |
| r1293 | r1294 | |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | // simulate DMA delay |
| 685 | | |
| 685 | | |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | |
| r1293 | r1294 | |
| 864 | 864 | adc083x_cs_write( 0, ( data >> 26 ) & 1 ); |
| 865 | 865 | } |
| 866 | 866 | |
| 867 | double adc0834_callback( int input ) | |
| 867 | static double adc0834_callback( int input ) | |
| 868 | 868 | { |
| 869 | 869 | switch( input ) |
| 870 | 870 | { |
| r1293 | r1294 | |
| 1322 | 1322 | MDRV_CPU_PROGRAM_MAP(gxsndmap, 0) |
| 1323 | 1323 | MDRV_CPU_PERIODIC_INT(irq2_line_hold, 480) |
| 1324 | 1324 | |
| 1325 | MDRV_INTERLEAVE(32) | |
| 1325 | MDRV_INTERLEAVE(32) | |
| 1326 | 1326 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1327 | MDRV_SCREEN_VBLANK_TIME( | |
| 1327 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1328 | 1328 | |
| 1329 | 1329 | MDRV_MACHINE_START(konamigx) |
| 1330 | 1330 | MDRV_MACHINE_RESET(konamigx) |
| r1293 | r1294 | |
| 3526 | 3526 | snd020_hack = 0; |
| 3527 | 3527 | resume_trigger = 0; |
| 3528 | 3528 | |
| 3529 | dmadelay_timer = | |
| 3529 | dmadelay_timer = | |
| 3530 | 3530 | |
| 3531 | 3531 | i = match = 0; |
| 3532 | 3532 | while ((gameDefs[i].cfgport != -1) && (!match)) |
| r1293 | r1294 | |
|---|---|---|
| 65 | 65 | /* Default NVram, we seem to need one or statriv2 crashes during attract |
| 66 | 66 | attempting to display an unterminated message */ |
| 67 | 67 | |
| 68 | UINT8 statriv2_default_eeprom[256] = { | |
| 68 | static UINT8 statriv2_default_eeprom[256] = { | |
| 69 | 69 | 0x24,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 70 | 70 | 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x11,0x00, |
| 71 | 71 | 0x00,0x00,0x00,0x00,0x01,0x02,0x01,0x05,0x00,0x00,0x11,0x49,0x41,0x41,0x00,0x00, |
| r1293 | r1294 | |
| 84 | 84 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
| 85 | 85 | }; |
| 86 | 86 | |
| 87 | UINT8 quaquiz2_default_eeprom[256] = { | |
| 87 | static UINT8 quaquiz2_default_eeprom[256] = { | |
| 88 | 88 | 0x6f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 89 | 89 | 0x00,0x00,0x02,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0xa5,0x6e,0x03,0xff, |
| 90 | 90 | 0x50,0x03,0xff,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| r1293 | r1294 | |
| 103 | 103 | 0x20,0x49,0x49,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
| 104 | 104 | }; |
| 105 | 105 | |
| 106 | UINT8 *statriv2_videoram; | |
| 106 | static UINT8 *statriv2_videoram; | |
| 107 | 107 | static tilemap* statriv2_tilemap; |
| 108 | 108 | |
| 109 | 109 | /* Video Related, move to video later */ |
| r1293 | r1294 | |
|---|---|---|
| 45 | 45 | #include "sound/ay8910.h" |
| 46 | 46 | #include "video/crtc6845.h" |
| 47 | 47 | |
| 48 | UINT8* carrera_tileram; | |
| 48 | static UINT8* carrera_tileram; | |
| 49 | 49 | |
| 50 | 50 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 51 | 51 | AM_RANGE(0x0000, 0x4fff) AM_READ(MRA8_ROM) |
| r1293 | r1294 | |
|---|---|---|
| 120 | 120 | static TIMER_CALLBACK( shared_sync_callback ) |
| 121 | 121 | { |
| 122 | 122 | if (--param) |
| 123 | | |
| 123 | | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 |
| r1293 | r1294 | |
|---|---|---|
| 122 | 122 | { |
| 123 | 123 | // sound_nmi_enabled = 1; |
| 124 | 124 | cpunum_set_input_line(1, INPUT_LINE_NMI, CLEAR_LINE); |
| 125 | | |
| 125 | | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /********************************************/ |
| r1293 | r1294 | |
|---|---|---|
| 231 | 231 | /* unknown. always write 0 */ |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | static | |
| 234 | static | |
| 235 | 235 | |
| 236 | 236 | static READ8_HANDLER ( combasc_YM2203_status_port_0_r ) |
| 237 | 237 | { |
| r1293 | r1294 | |
| 243 | 243 | if (boost) |
| 244 | 244 | { |
| 245 | 245 | boost = 0; |
| 246 | | |
| 246 | | |
| 247 | 247 | } |
| 248 | 248 | else if (status & 2) |
| 249 | 249 | { |
| 250 | 250 | boost = 1; |
| 251 | | |
| 251 | | |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| r1293 | r1294 | |
| 904 | 904 | |
| 905 | 905 | static void combasc_init_common(void) |
| 906 | 906 | { |
| 907 | combasc_interleave_timer = | |
| 907 | combasc_interleave_timer = | |
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | static DRIVER_INIT( combasct ) |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | extern int stv_enable_slave_sh2; |
| 17 | 17 | |
| 18 | 18 | extern int minit_boost,sinit_boost; |
| 19 | extern | |
| 19 | extern | |
| 20 | 20 | |
| 21 | 21 | DRIVER_INIT ( stv ); |
| 22 | 22 | |
| r1293 | r1294 | |
| 203 | 203 | static READ32_HANDLER( shienryu_slave_speedup_r ) |
| 204 | 204 | { |
| 205 | 205 | if (activecpu_get_pc()==0x06004410) |
| 206 | cpu_spinuntil_time( | |
| 206 | cpu_spinuntil_time( | |
| 207 | 207 | |
| 208 | 208 | return stv_workram_h[0x0ae8e4/4]; |
| 209 | 209 | } |
| r1293 | r1294 | |
| 255 | 255 | driver_init_stv(machine); |
| 256 | 256 | |
| 257 | 257 | minit_boost = sinit_boost = 0; |
| 258 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 258 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 259 | 259 | |
| 260 | 260 | } |
| 261 | 261 | |
| r1293 | r1294 | |
| 321 | 321 | |
| 322 | 322 | static READ32_HANDLER( puyosun_speedup_r ) |
| 323 | 323 | { |
| 324 | if (activecpu_get_pc()==0x6021CF2) cpu_spinuntil_time( | |
| 324 | if (activecpu_get_pc()==0x6021CF2) cpu_spinuntil_time( | |
| 325 | 325 | |
| 326 | 326 | |
| 327 | 327 | return stv_workram_h[0x0ffc10/4]; |
| r1293 | r1294 | |
| 342 | 342 | driver_init_ic13(machine); |
| 343 | 343 | |
| 344 | 344 | minit_boost = sinit_boost = 0; |
| 345 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 345 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /* mausuke |
| r1293 | r1294 | |
| 357 | 357 | |
| 358 | 358 | static READ32_HANDLER( mausuke_speedup_r ) |
| 359 | 359 | { |
| 360 | if (activecpu_get_pc()==0x060461A2) cpu_spinuntil_time( | |
| 360 | if (activecpu_get_pc()==0x060461A2) cpu_spinuntil_time( | |
| 361 | 361 | |
| 362 | 362 | return stv_workram_h[0x0ffc10/4]; |
| 363 | 363 | } |
| r1293 | r1294 | |
| 369 | 369 | driver_init_ic13(machine); |
| 370 | 370 | |
| 371 | 371 | minit_boost = sinit_boost = 0; |
| 372 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 372 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | static READ32_HANDLER( cottonbm_speedup_r ) |
| 376 | 376 | { |
| 377 | if (activecpu_get_pc()==0x06030EE4) cpu_spinuntil_time( | |
| 377 | if (activecpu_get_pc()==0x06030EE4) cpu_spinuntil_time( | |
| 378 | 378 | |
| 379 | 379 | return stv_workram_h[0x0ffc10/4]; |
| 380 | 380 | } |
| r1293 | r1294 | |
| 406 | 406 | |
| 407 | 407 | driver_init_stv(machine); |
| 408 | 408 | |
| 409 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 409 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | static READ32_HANDLER( cotton2_speedup_r ) |
| 413 | 413 | { |
| 414 | if (activecpu_get_pc()==0x06031c7c) cpu_spinuntil_time( | |
| 414 | if (activecpu_get_pc()==0x06031c7c) cpu_spinuntil_time( | |
| 415 | 415 | |
| 416 | 416 | return stv_workram_h[0x0ffc10/4]; |
| 417 | 417 | } |
| r1293 | r1294 | |
| 442 | 442 | |
| 443 | 443 | driver_init_stv(machine); |
| 444 | 444 | |
| 445 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 445 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | static int dnmtdeka_pending_commands; |
| 449 | 449 | |
| 450 | 450 | static READ32_HANDLER( dnmtdeka_speedup_r ) |
| 451 | 451 | { |
| 452 | if (activecpu_get_pc()==0x6027c92) cpu_spinuntil_int();//cpu_spinuntil_time( | |
| 452 | if (activecpu_get_pc()==0x6027c92) cpu_spinuntil_int();//cpu_spinuntil_time( | |
| 453 | 453 | return stv_workram_h[0x0985a0/4]; |
| 454 | 454 | } |
| 455 | 455 | |
| r1293 | r1294 | |
| 575 | 575 | |
| 576 | 576 | static READ32_HANDLER( fhboxers_speedup_r ) |
| 577 | 577 | { |
| 578 | if (activecpu_get_pc()==0x060041c4) cpu_spinuntil_time( | |
| 578 | if (activecpu_get_pc()==0x060041c4) cpu_spinuntil_time( | |
| 579 | 579 | |
| 580 | 580 | return stv_workram_h[0x00420c/4]; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | static READ32_HANDLER( fhboxers_speedup2_r ) |
| 584 | 584 | { |
| 585 | if (activecpu_get_pc()==0x0600bb0c) cpu_spinuntil_time( | |
| 585 | if (activecpu_get_pc()==0x0600bb0c) cpu_spinuntil_time( | |
| 586 | 586 | |
| 587 | 587 | |
| 588 | 588 | return stv_workram_h[0x090740/4]; |
| r1293 | r1294 | |
| 692 | 692 | driver_init_stv(machine); |
| 693 | 693 | |
| 694 | 694 | minit_boost = sinit_boost = 0; |
| 695 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 695 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | /* danchih hangs on the title screen without this hack .. */ |
| r1293 | r1294 | |
| 732 | 732 | |
| 733 | 733 | static READ32_HANDLER( danchih_speedup_r ) |
| 734 | 734 | { |
| 735 | if (activecpu_get_pc()==0x06028c90) cpu_spinuntil_time( | |
| 735 | if (activecpu_get_pc()==0x06028c90) cpu_spinuntil_time( | |
| 736 | 736 | return stv_workram_h[0x0ffc10/4]; |
| 737 | 737 | } |
| 738 | 738 | |
| r1293 | r1294 | |
| 753 | 753 | |
| 754 | 754 | driver_init_stv(machine); |
| 755 | 755 | |
| 756 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 756 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 757 | 757 | |
| 758 | 758 | } |
| 759 | 759 | |
| r1293 | r1294 | |
| 787 | 787 | static READ32_HANDLER( astrass_speedup_r ) |
| 788 | 788 | { |
| 789 | 789 | if(activecpu_get_pc() == 0x0605b9dc ) |
| 790 | cpu_spinuntil_time( | |
| 790 | cpu_spinuntil_time( | |
| 791 | 791 | |
| 792 | 792 | return stv_workram_h[0x8e4d8/4]; |
| 793 | 793 | } |
| r1293 | r1294 | |
| 857 | 857 | |
| 858 | 858 | driver_init_ic13(machine); |
| 859 | 859 | |
| 860 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 860 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | static READ32_HANDLER(sandor_speedup_r) |
| r1293 | r1294 | |
| 886 | 886 | memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x06075a2c, 0x06075a2f, 0, 0, sandor_speedup2_r ); |
| 887 | 887 | cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf *)sandor_slave_speedup); |
| 888 | 888 | driver_init_ic13(machine); |
| 889 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 889 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 890 | 890 | |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | static READ32_HANDLER(grdforce_speedup_r) |
| 894 | 894 | { |
| 895 | if ( activecpu_get_pc() == 0x06041E34 ) cpu_spinuntil_time( | |
| 895 | if ( activecpu_get_pc() == 0x06041E34 ) cpu_spinuntil_time( | |
| 896 | 896 | return stv_workram_h[0x000ffc10/4]; |
| 897 | 897 | } |
| 898 | 898 | |
| r1293 | r1294 | |
| 910 | 910 | { |
| 911 | 911 | logerror("cpu1 skip %08x %08x\n",stv_workram_h[0x0ffc44/4],stv_workram_h[0x0ffc48/4]); |
| 912 | 912 | |
| 913 | //cpu_spinuntil_time( | |
| 913 | //cpu_spinuntil_time( | |
| 914 | 914 | cpunum_spinuntil_trigger(1, 1000); |
| 915 | 915 | } |
| 916 | 916 | } |
| r1293 | r1294 | |
| 934 | 934 | |
| 935 | 935 | driver_init_stv(machine); |
| 936 | 936 | |
| 937 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 937 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 | static READ32_HANDLER( batmanfr_speedup_r ) |
| r1293 | r1294 | |
| 962 | 962 | driver_init_stv(machine); |
| 963 | 963 | |
| 964 | 964 | minit_boost = sinit_boost = 0; |
| 965 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 965 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | static void colmns97_slave_speedup( UINT32 data ) |
| r1293 | r1294 | |
| 989 | 989 | |
| 990 | 990 | static READ32_HANDLER(winterht_speedup_r) |
| 991 | 991 | { |
| 992 | if ( activecpu_get_pc() == 0x06098aec ) cpu_spinuntil_time( | |
| 992 | if ( activecpu_get_pc() == 0x06098aec ) cpu_spinuntil_time( | |
| 993 | 993 | return stv_workram_h[0x000ffc10/4]; |
| 994 | 994 | } |
| 995 | 995 | |
| r1293 | r1294 | |
| 1008 | 1008 | |
| 1009 | 1009 | driver_init_ic13(machine); |
| 1010 | 1010 | |
| 1011 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1011 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | static READ32_HANDLER(seabass_speedup_r) |
| 1015 | 1015 | { |
| 1016 | if ( activecpu_get_pc() == 0x0602cbfc ) cpu_spinuntil_time( | |
| 1016 | if ( activecpu_get_pc() == 0x0602cbfc ) cpu_spinuntil_time( | |
| 1017 | 1017 | return stv_workram_h[0x000ffc10/4]; |
| 1018 | 1018 | } |
| 1019 | 1019 | |
| r1293 | r1294 | |
| 1033 | 1033 | |
| 1034 | 1034 | driver_init_ic13(machine); |
| 1035 | 1035 | |
| 1036 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1036 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | static void vfremix_slave_speedup( UINT32 data ) |
| r1293 | r1294 | |
| 1056 | 1056 | |
| 1057 | 1057 | driver_init_ic13(machine); |
| 1058 | 1058 | |
| 1059 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1059 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | |
| r1293 | r1294 | |
| 1081 | 1081 | |
| 1082 | 1082 | driver_init_ic13(machine); |
| 1083 | 1083 | |
| 1084 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1084 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | static READ32_HANDLER(othellos_speedup_r) |
| 1088 | 1088 | { |
| 1089 | if ( activecpu_get_pc() == 0x0602bcc0 ) cpu_spinuntil_time( | |
| 1089 | if ( activecpu_get_pc() == 0x0602bcc0 ) cpu_spinuntil_time( | |
| 1090 | 1090 | return stv_workram_h[0x000ffc10/4]; |
| 1091 | 1091 | } |
| 1092 | 1092 | |
| r1293 | r1294 | |
| 1108 | 1108 | |
| 1109 | 1109 | driver_init_stv(machine); |
| 1110 | 1110 | |
| 1111 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1111 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1112 | 1112 | |
| 1113 | 1113 | } |
| 1114 | 1114 | |
| r1293 | r1294 | |
| 1125 | 1125 | |
| 1126 | 1126 | driver_init_ic13(machine); |
| 1127 | 1127 | |
| 1128 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1128 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | 1131 | static READ32_HANDLER(gaxeduel_speedup_r) |
| r1293 | r1294 | |
| 1172 | 1172 | cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)sokyugrt_slave_speedup ); |
| 1173 | 1173 | memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x060788cc, 0x060788cf, 0, 0, sokyugrt_speedup_r); |
| 1174 | 1174 | driver_init_ic13(machine); |
| 1175 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1175 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1176 | 1176 | |
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | 1179 | static READ32_HANDLER( znpwfv_speedup_r ) |
| 1180 | 1180 | { |
| 1181 | if (activecpu_get_pc()==0x6012ec4) cpu_spinuntil_time( | |
| 1181 | if (activecpu_get_pc()==0x6012ec4) cpu_spinuntil_time( | |
| 1182 | 1182 | return stv_workram_h[0x0ffc10/4]; |
| 1183 | 1183 | } |
| 1184 | 1184 | |
| r1293 | r1294 | |
| 1206 | 1206 | memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, znpwfv_speedup_r ); |
| 1207 | 1207 | |
| 1208 | 1208 | driver_init_ic13(machine); |
| 1209 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1209 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | static READ32_HANDLER( twcup98_speedup_r ) |
| 1213 | 1213 | { |
| 1214 | if (activecpu_get_pc()==0x605ede0) cpu_spinuntil_time( | |
| 1214 | if (activecpu_get_pc()==0x605ede0) cpu_spinuntil_time( | |
| 1215 | 1215 | return stv_workram_h[0x0ffc10/4]; |
| 1216 | 1216 | } |
| 1217 | 1217 | |
| r1293 | r1294 | |
| 1230 | 1230 | driver_init_ic13(machine); |
| 1231 | 1231 | install_standard_protection(); |
| 1232 | 1232 | |
| 1233 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1233 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1234 | 1234 | } |
| 1235 | 1235 | |
| 1236 | 1236 | static READ32_HANDLER( smleague_speedup_r ) |
| 1237 | 1237 | { |
| 1238 | if (activecpu_get_pc()==0x6063bf6) cpu_spinuntil_time( | |
| 1238 | if (activecpu_get_pc()==0x6063bf6) cpu_spinuntil_time( | |
| 1239 | 1239 | return stv_workram_h[0x0ffc10/4]; |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| r1293 | r1294 | |
| 1253 | 1253 | |
| 1254 | 1254 | driver_init_ic13(machine); |
| 1255 | 1255 | |
| 1256 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1256 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | 1259 | static READ32_HANDLER( finlarch_speedup_r ) |
| r1293 | r1294 | |
| 1273 | 1273 | |
| 1274 | 1274 | static READ32_HANDLER( maruchan_speedup_r ) |
| 1275 | 1275 | { |
| 1276 | if (activecpu_get_pc()==0x06012a54) cpu_spinuntil_time( | |
| 1276 | if (activecpu_get_pc()==0x06012a54) cpu_spinuntil_time( | |
| 1277 | 1277 | return stv_workram_h[0x0ffc10/4]; |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| r1293 | r1294 | |
| 1300 | 1300 | |
| 1301 | 1301 | driver_init_ic13(machine); |
| 1302 | 1302 | |
| 1303 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1303 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | 1306 | static READ32_HANDLER( pblbeach_speedup_r ) |
| r1293 | r1294 | |
| 1334 | 1334 | |
| 1335 | 1335 | static READ32_HANDLER( elandore_speedup_r ) |
| 1336 | 1336 | { |
| 1337 | if (activecpu_get_pc()==0x0604eac2) cpu_spinuntil_time( | |
| 1337 | if (activecpu_get_pc()==0x0604eac2) cpu_spinuntil_time( | |
| 1338 | 1338 | return stv_workram_h[0x0ffc10/4]; |
| 1339 | 1339 | } |
| 1340 | 1340 | |
| r1293 | r1294 | |
| 1357 | 1357 | memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, elandore_speedup_r ); |
| 1358 | 1358 | cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf *)elandore_slave_speedup); |
| 1359 | 1359 | driver_init_stv(machine); |
| 1360 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1360 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1361 | 1361 | |
| 1362 | 1362 | } |
| 1363 | 1363 | |
| 1364 | 1364 | static READ32_HANDLER( rsgun_speedup_r ) |
| 1365 | 1365 | { |
| 1366 | if (activecpu_get_pc()==0x06034d06) cpu_spinuntil_time( | |
| 1366 | if (activecpu_get_pc()==0x06034d06) cpu_spinuntil_time( | |
| 1367 | 1367 | return stv_workram_h[0x0ffc10/4]; |
| 1368 | 1368 | } |
| 1369 | 1369 | |
| r1293 | r1294 | |
| 1387 | 1387 | |
| 1388 | 1388 | driver_init_stv(machine); |
| 1389 | 1389 | |
| 1390 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1390 | minit_boost_timeslice = sinit_boost_timeslice = | |
| 1391 | 1391 | |
| 1392 | 1392 | } |
| 1393 | 1393 |
| r1293 | r1294 | |
|---|---|---|
| 44 | 44 | #include "driver.h" |
| 45 | 45 | #include "sound/okim6295.h" |
| 46 | 46 | |
| 47 | UINT8 *egghunt_bgram; | |
| 48 | UINT8 *egghunt_atram; | |
| 49 | UINT8 *egghunt_spram; | |
| 50 | UINT8 egghunt_vidram_bank; | |
| 47 | static UINT8 *egghunt_bgram; | |
| 48 | static UINT8 *egghunt_atram; | |
| 49 | static UINT8 *egghunt_spram; | |
| 50 | static UINT8 egghunt_vidram_bank; | |
| 51 | 51 | |
| 52 | 52 | static tilemap *bg_tilemap; |
| 53 | 53 | static UINT8 egghunt_okibanking; |
| r1293 | r1294 | |
|---|---|---|
| 800 | 800 | |
| 801 | 801 | static INTERRUPT_GEN( taitof2_interrupt ) |
| 802 | 802 | { |
| 803 | | |
| 803 | | |
| 804 | 804 | cpunum_set_input_line(0, 5, HOLD_LINE); |
| 805 | 805 | } |
| 806 | 806 |
| r1293 | r1294 | |
|---|---|---|
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | INTERRUPT_GEN( gottlieb_interrupt ) | |
| 384 | static INTERRUPT_GEN( gottlieb_interrupt ) | |
| 385 | 385 | { |
| 386 | 386 | if (access_time > 0) { |
| 387 | 387 | access_time--; |
| r1293 | r1294 | |
| 444 | 444 | ADDRESS_MAP_END |
| 445 | 445 | |
| 446 | 446 | |
| 447 | ADDRESS_MAP_START( gottlieb_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 447 | static ADDRESS_MAP_START( gottlieb_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 448 | 448 | AM_RANGE(0x0000, 0x01ff) AM_READ(riot_ram_r) |
| 449 | 449 | AM_RANGE(0x0200, 0x03ff) AM_READ(gottlieb_riot_r) |
| 450 | 450 | AM_RANGE(0x6000, 0x7fff) AM_READ(MRA8_ROM) |
| r1293 | r1294 | |
| 454 | 454 | AM_RANGE(0xe000, 0xffff) AM_READ(MRA8_ROM) |
| 455 | 455 | ADDRESS_MAP_END |
| 456 | 456 | |
| 457 | ADDRESS_MAP_START( gottlieb_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 457 | static ADDRESS_MAP_START( gottlieb_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 458 | 458 | AM_RANGE(0x0000, 0x01ff) AM_WRITE(riot_ram_w) AM_BASE(&riot_ram) |
| 459 | 459 | AM_RANGE(0x0200, 0x03ff) AM_WRITE(gottlieb_riot_w) |
| 460 | 460 | AM_RANGE(0x1000, 0x1000) AM_WRITE(DAC_0_data_w) |
| r1293 | r1294 | |
| 477 | 477 | AM_RANGE(0xe000, 0xffff) AM_READ(MRA8_ROM) |
| 478 | 478 | ADDRESS_MAP_END |
| 479 | 479 | |
| 480 | ADDRESS_MAP_START( stooges_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 480 | static ADDRESS_MAP_START( stooges_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 481 | 481 | AM_RANGE(0x0000, 0x03ff) AM_WRITE(MWA8_RAM) |
| 482 | 482 | AM_RANGE(0x4000, 0x4001) AM_WRITE(DAC_0_data_w) |
| 483 | 483 | AM_RANGE(0xe000, 0xffff) AM_WRITE(MWA8_ROM) |
| r1293 | r1294 | |
| 491 | 491 | AM_RANGE(0xc000, 0xffff) AM_READ(MRA8_ROM) |
| 492 | 492 | ADDRESS_MAP_END |
| 493 | 493 | |
| 494 | ADDRESS_MAP_START( stooges_sound2_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 494 | static ADDRESS_MAP_START( stooges_sound2_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 495 | 495 | AM_RANGE(0x0000, 0x03ff) AM_WRITE(MWA8_RAM) |
| 496 | 496 | AM_RANGE(0x2000, 0x2000) AM_WRITE(stooges_sp0250_latch_w) /* speech chip. The game sends strings */ |
| 497 | 497 | /* of 15 bytes (clocked by 4000). The chip also */ |
| r1293 | r1294 | |
| 1555 | 1555 | MDRV_CPU_PROGRAM_MAP(gottlieb_sound_readmem,gottlieb_sound_writemem) |
| 1556 | 1556 | /* NMIs are triggered by the Votrax SC-01 */ |
| 1557 | 1557 | MDRV_SCREEN_REFRESH_RATE(61) |
| 1558 | MDRV_SCREEN_VBLANK_TIME( | |
| 1558 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1559 | 1559 | |
| 1560 | 1560 | MDRV_MACHINE_RESET(gottlieb) |
| 1561 | 1561 | MDRV_NVRAM_HANDLER(generic_1fill) |
| r1293 | r1294 | |
| 1636 | 1636 | MDRV_CPU_PROGRAM_MAP(stooges_sound2_readmem,stooges_sound2_writemem) |
| 1637 | 1637 | |
| 1638 | 1638 | MDRV_SCREEN_REFRESH_RATE(61) |
| 1639 | MDRV_SCREEN_VBLANK_TIME( | |
| 1639 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1640 | 1640 | |
| 1641 | 1641 | MDRV_MACHINE_RESET(gottlieb) |
| 1642 | 1642 | MDRV_NVRAM_HANDLER(generic_1fill) |
| r1293 | r1294 | |
|---|---|---|
| 130 | 130 | latch1_full = 1; |
| 131 | 131 | soundlatch_w(0, data & 0xff); |
| 132 | 132 | cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE); |
| 133 | cpu_spinuntil_time( | |
| 133 | cpu_spinuntil_time( | |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 |
| r1293 | r1294 | |
|---|---|---|
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | /* VIDEO GOODS */ |
| 62 | void gpworld_draw_tiles(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect) | |
| 62 | static void gpworld_draw_tiles(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect) | |
| 63 | 63 | { |
| 64 | 64 | UINT8 characterX, characterY; |
| 65 | 65 | |
| r1293 | r1294 | |
| 93 | 93 | *BITMAP_ADDR32(bitmap, y, x) = color; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | void gpworld_draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect) | |
| 96 | static void gpworld_draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect) | |
| 97 | 97 | { |
| 98 | 98 | const int SPR_Y_TOP = 0; |
| 99 | 99 | const int SPR_Y_BOTTOM = 1; |
| r1293 | r1294 | |
| 408 | 408 | |
| 409 | 409 | /* The time the IRQ line stays high is set just long enough to happen after the NMI - hacky? */ |
| 410 | 410 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| 411 | | |
| 411 | | |
| 412 | 412 | |
| 413 | 413 | laserdisc_vsync(discinfo); |
| 414 | 414 | } |
| r1293 | r1294 | |
|---|---|---|
| 1003 | 1003 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 1004 | 1004 | |
| 1005 | 1005 | MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0) |
| 1006 | MDRV_SCREEN_VBLANK_TIME( | |
| 1006 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1007 | 1007 | MDRV_INTERLEAVE(1000) /* heavy interleaving to sync up sprite<->main cpu's */ |
| 1008 | 1008 | |
| 1009 | 1009 | MDRV_MACHINE_START(ddragon) |
| r1293 | r1294 | |
| 1055 | 1055 | MDRV_CPU_PROGRAM_MAP(mcu_readmem,mcu_writemem) |
| 1056 | 1056 | |
| 1057 | 1057 | MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0) |
| 1058 | MDRV_SCREEN_VBLANK_TIME( | |
| 1058 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1059 | 1059 | MDRV_INTERLEAVE(1000) /* heavy interleaving to sync up sprite<->main cpu's */ |
| 1060 | 1060 | |
| 1061 | 1061 | MDRV_MACHINE_RESET(ddragon) |
| r1293 | r1294 | |
| 1103 | 1103 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 1104 | 1104 | |
| 1105 | 1105 | MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0) |
| 1106 | MDRV_SCREEN_VBLANK_TIME( | |
| 1106 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1107 | 1107 | MDRV_INTERLEAVE(100) /* heavy interleaving to sync up sprite<->main cpu's */ |
| 1108 | 1108 | |
| 1109 | 1109 | MDRV_MACHINE_START(ddragon) |
| r1293 | r1294 | |
| 1153 | 1153 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 1154 | 1154 | |
| 1155 | 1155 | MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0) |
| 1156 | MDRV_SCREEN_VBLANK_TIME( | |
| 1156 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1157 | 1157 | MDRV_INTERLEAVE(100) /* heavy interleaving to sync up sprite<->main cpu's */ |
| 1158 | 1158 | |
| 1159 | 1159 | MDRV_MACHINE_START(ddragon) |
| r1293 | r1294 | |
| 1203 | 1203 | MDRV_CPU_PROGRAM_MAP(dd2_sound_readmem,dd2_sound_writemem) |
| 1204 | 1204 | |
| 1205 | 1205 | MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0) |
| 1206 | MDRV_SCREEN_VBLANK_TIME( | |
| 1206 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1207 | 1207 | MDRV_INTERLEAVE(100) /* heavy interleaving to sync up sprite<->main cpu's */ |
| 1208 | 1208 | |
| 1209 | 1209 | MDRV_MACHINE_RESET(ddragon2) |
| r1293 | r1294 | |
| 1244 | 1244 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 1245 | 1245 | |
| 1246 | 1246 | MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0) |
| 1247 | MDRV_SCREEN_VBLANK_TIME( | |
| 1247 | MDRV_SCREEN_VBLANK_TIME(A | |
| 1248 | 1248 | |
| 1249 | 1249 | /* video hardware */ |
| 1250 | 1250 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER ) |
| r1293 | r1294 | |
|---|---|---|
| 127 | 127 | static WRITE8_HANDLER( sound_arm_nmi_w ) |
| 128 | 128 | { |
| 129 | 129 | cpunum_set_input_line(1, INPUT_LINE_NMI, CLEAR_LINE); |
| 130 | | |
| 130 | | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | static WRITE16_HANDLER( sound_irq_w ) |
| r1293 | r1294 | |
|---|---|---|
| 111 | 111 | static UINT8 ls74 = 0; |
| 112 | 112 | static UINT8 ls377 = 0; |
| 113 | 113 | |
| 114 | static | |
| 114 | static | |
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | static int curr_scanline=0; |
| r1293 | r1294 | |
| 328 | 328 | if (scanline>=264) |
| 329 | 329 | scanline=0; |
| 330 | 330 | |
| 331 | | |
| 331 | | |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | |
| r1293 | r1294 | |
| 352 | 352 | static MACHINE_START( tubep ) |
| 353 | 353 | { |
| 354 | 354 | /* Create interrupt timer */ |
| 355 | interrupt_timer = | |
| 355 | interrupt_timer = | |
| 356 | 356 | |
| 357 | 357 | tubep_setup_save_state(); |
| 358 | 358 | } |
| r1293 | r1294 | |
| 360 | 360 | |
| 361 | 361 | static MACHINE_RESET( tubep ) |
| 362 | 362 | { |
| 363 | | |
| 363 | | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | |
| r1293 | r1294 | |
| 509 | 509 | if (scanline>=264) |
| 510 | 510 | scanline=0; |
| 511 | 511 | |
| 512 | | |
| 512 | | |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | |
| 516 | 516 | static MACHINE_START( rjammer ) |
| 517 | 517 | { |
| 518 | 518 | /* Create interrupt timer */ |
| 519 | interrupt_timer = | |
| 519 | interrupt_timer = | |
| 520 | 520 | |
| 521 | 521 | tubep_setup_save_state(); |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | static MACHINE_RESET( rjammer ) |
| 525 | 525 | { |
| 526 | | |
| 526 | | |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 |
| r1293 | r1294 | |
|---|---|---|
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | static tilemap *ppmast93_fg_tilemap, *ppmast93_bg_tilemap; |
| 135 | UINT8 *ppmast93_fgram, *ppmast93_bgram; | |
| 135 | static UINT8 *ppmast93_fgram, *ppmast93_bgram; | |
| 136 | 136 | |
| 137 | 137 | static WRITE8_HANDLER( ppmast93_fgram_w ) |
| 138 | 138 | { |
| r1293 | r1294 | |
|---|---|---|
| 564 | 564 | /********************************************************************************/ |
| 565 | 565 | |
| 566 | 566 | |
| 567 | ADDRESS_MAP_START( mrokumei_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 567 | static ADDRESS_MAP_START( mrokumei_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 568 | 568 | AM_RANGE(0x0000, 0x3fff) AM_READ(MRA8_RAM) /* videoram */ |
| 569 | 569 | AM_RANGE(0x4000, 0x5fff) AM_READ(MRA8_RAM) |
| 570 | 570 | AM_RANGE(0x6000, 0x6fff) AM_READ(MRA8_RAM) /* work ram */ |
| r1293 | r1294 | |
| 578 | 578 | AM_RANGE(0x8000, 0xffff) AM_READ(MRA8_ROM) |
| 579 | 579 | ADDRESS_MAP_END |
| 580 | 580 | |
| 581 | ADDRESS_MAP_START( mrokumei_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 581 | static ADDRESS_MAP_START( mrokumei_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 582 | 582 | AM_RANGE(0x0000, 0x3fff) AM_WRITE(mrokumei_videoram_w) AM_BASE(&videoram) |
| 583 | 583 | AM_RANGE(0x4000, 0x5fff) AM_WRITE(MWA8_RAM) |
| 584 | 584 | AM_RANGE(0x6000, 0x6fff) AM_WRITE(MWA8_RAM) |
| r1293 | r1294 | |
| 594 | 594 | AM_RANGE(0x8000, 0xffff) AM_WRITE(MWA8_ROM) |
| 595 | 595 | ADDRESS_MAP_END |
| 596 | 596 | |
| 597 | ADDRESS_MAP_START( mrokumei_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 597 | static ADDRESS_MAP_START( mrokumei_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 598 | 598 | AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM) |
| 599 | 599 | ADDRESS_MAP_END |
| 600 | 600 | |
| 601 | ADDRESS_MAP_START( mrokumei_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 601 | static ADDRESS_MAP_START( mrokumei_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 602 | 602 | AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM) |
| 603 | 603 | AM_RANGE(0xfffc, 0xfffd) AM_WRITE(MWA8_NOP) /* stack writes happen here, but there's no RAM */ |
| 604 | 604 | AM_RANGE(0x8080, 0x8080) AM_WRITE(mrokumei_sound_bank_w) |
| r1293 | r1294 | |
| 614 | 614 | |
| 615 | 615 | /********************************************************************************/ |
| 616 | 616 | |
| 617 | ADDRESS_MAP_START( reikaids_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 617 | static ADDRESS_MAP_START( reikaids_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 618 | 618 | AM_RANGE(0x0000, 0x3fff) AM_READ(MRA8_RAM) /* videoram */ |
| 619 | 619 | AM_RANGE(0x4000, 0x5fff) AM_READ(MRA8_RAM) |
| 620 | 620 | AM_RANGE(0x6000, 0x6fff) AM_READ(MRA8_RAM) /* work ram */ |
| r1293 | r1294 | |
| 626 | 626 | AM_RANGE(0xc000, 0xffff) AM_READ(MRA8_ROM) |
| 627 | 627 | ADDRESS_MAP_END |
| 628 | 628 | |
| 629 | ADDRESS_MAP_START( reikaids_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 629 | static ADDRESS_MAP_START( reikaids_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 630 | 630 | AM_RANGE(0x0000, 0x3fff) AM_WRITE(reikaids_videoram_w) AM_BASE(&videoram) |
| 631 | 631 | AM_RANGE(0x4000, 0x5fff) AM_WRITE(MWA8_RAM) |
| 632 | 632 | AM_RANGE(0x6000, 0x6fff) AM_WRITE(MWA8_RAM) |
| r1293 | r1294 | |
| 666 | 666 | /**************************************************************************/ |
| 667 | 667 | |
| 668 | 668 | |
| 669 | ADDRESS_MAP_START( pteacher_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 669 | static ADDRESS_MAP_START( pteacher_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 670 | 670 | AM_RANGE(0x0000, 0x3fff) AM_READ(MRA8_RAM) |
| 671 | 671 | AM_RANGE(0x4000, 0x5fff) AM_READ(MRA8_RAM) |
| 672 | 672 | AM_RANGE(0x6000, 0x6fff) AM_READ(MRA8_RAM) /* work ram */ |
| r1293 | r1294 | |
| 677 | 677 | AM_RANGE(0xc000, 0xffff) AM_READ(MRA8_ROM) |
| 678 | 678 | ADDRESS_MAP_END |
| 679 | 679 | |
| 680 | ADDRESS_MAP_START( pteacher_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 680 | static ADDRESS_MAP_START( pteacher_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 681 | 681 | AM_RANGE(0x0000, 0x3fff) AM_WRITE(pteacher_videoram_w) AM_BASE(&videoram) |
| 682 | 682 | AM_RANGE(0x4000, 0x5eff) AM_WRITE(MWA8_RAM) |
| 683 | 683 | AM_RANGE(0x5f00, 0x5fff) AM_WRITE(MWA8_RAM) |
| r1293 | r1294 | |
|---|---|---|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | INTERRUPT_GEN( xxmissio_interrupt_m ) | |
| 79 | static INTERRUPT_GEN( xxmissio_interrupt_m ) | |
| 80 | 80 | { |
| 81 | 81 | xxmissio_status &= ~0x20; |
| 82 | 82 | cpunum_set_input_line(0, 0, HOLD_LINE); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | INTERRUPT_GEN( xxmissio_interrupt_s ) | |
| 85 | static INTERRUPT_GEN( xxmissio_interrupt_s ) | |
| 86 | 86 | { |
| 87 | 87 | xxmissio_status &= ~0x10; |
| 88 | 88 | cpunum_set_input_line(1, 0, HOLD_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 642 | 642 | |
| 643 | 643 | |
| 644 | 644 | /* preliminary dma code, dma is used to copy program code -> ram */ |
| 645 | int hng_dma_start,hng_dma_dst,hng_dma_len; | |
| 646 | void hng64_do_dma (void) | |
| 645 | static int hng_dma_start,hng_dma_dst,hng_dma_len; | |
| 646 | static void hng64_do_dma (void) | |
| 647 | 647 | { |
| 648 | 648 | logerror("Performing DMA Start %08x Len %08x Dst %08x\n",hng_dma_start, hng_dma_len, hng_dma_dst); |
| 649 | 649 | |
| r1293 | r1294 | |
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | 1450 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| 1451 | | |
| 1451 | | |
| 1452 | 1452 | } |
| 1453 | 1453 | |
| 1454 | 1454 | |
| r1293 | r1294 | |
| 1512 | 1512 | } |
| 1513 | 1513 | |
| 1514 | 1514 | |
| 1515 | MACHINE_DRIVER_START( hng64 ) | |
| 1515 | static MACHINE_DRIVER_START( hng64 ) | |
| 1516 | 1516 | /* basic machine hardware */ |
| 1517 | 1517 | MDRV_CPU_ADD(R4600BE, MASTER_CLOCK) // actually R4300 |
| 1518 | 1518 | MDRV_CPU_CONFIG(config) |
| r1293 | r1294 | |
|---|---|---|
| 281 | 281 | sndpending = 1; |
| 282 | 282 | cpunum_set_input_line(1,2,HOLD_LINE); |
| 283 | 283 | /* spin for a while to let the sound CPU read the command */ |
| 284 | cpu_spinuntil_time( | |
| 284 | cpu_spinuntil_time( | |
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 |
| r1293 | r1294 | |
|---|---|---|
| 178 | 178 | moo_objdma(game_type); |
| 179 | 179 | |
| 180 | 180 | // schedule DMA end interrupt (delay shortened to catch up with V-blank) |
| 181 | | |
| 181 | | |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // trigger V-blank interrupt |
| r1293 | r1294 | |
| 191 | 191 | moo_objdma(game_type); |
| 192 | 192 | |
| 193 | 193 | // schedule DMA end interrupt (delay shortened to catch up with V-blank) |
| 194 | | |
| 194 | | |
| 195 | 195 | |
| 196 | 196 | // trigger V-blank interrupt |
| 197 | 197 | cpunum_set_input_line(0, 5, HOLD_LINE); |
| r1293 | r1294 | |
| 635 | 635 | MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) |
| 636 | 636 | |
| 637 | 637 | MDRV_SCREEN_REFRESH_RATE(60) |
| 638 | MDRV_SCREEN_VBLANK_TIME( | |
| 638 | MDRV_SCREEN_VBLANK_TIME(A | |
| 639 | 639 | |
| 640 | 640 | MDRV_MACHINE_START(moo) |
| 641 | 641 | MDRV_MACHINE_RESET(moo) |
| r1293 | r1294 | |
| 674 | 674 | MDRV_CPU_VBLANK_INT(moobl_interrupt, 1) |
| 675 | 675 | |
| 676 | 676 | MDRV_SCREEN_REFRESH_RATE(60) |
| 677 | MDRV_SCREEN_VBLANK_TIME( | |
| 677 | MDRV_SCREEN_VBLANK_TIME(A | |
| 678 | 678 | |
| 679 | 679 | MDRV_MACHINE_START(moo) |
| 680 | 680 | MDRV_MACHINE_RESET(moo) |
| r1293 | r1294 | |
|---|---|---|
| 167 | 167 | ADDRESS_MAP_END |
| 168 | 168 | |
| 169 | 169 | |
| 170 | INTERRUPT_GEN( skychut_interrupt ) | |
| 170 | static INTERRUPT_GEN( skychut_interrupt ) | |
| 171 | 171 | { |
| 172 | 172 | if (readinputport(2) & 1) /* Left Coin */ |
| 173 | 173 | cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 221 | 221 | { |
| 222 | 222 | /* One interrupt per input port (4 per frame, though only 2 used). |
| 223 | 223 | 1000 cycle delay is arbitrary */ |
| 224 | | |
| 224 | | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | static WRITE32_HANDLER( rotate_control_w ) /* only a guess that it's rotation */ |
| r1293 | r1294 | |
|---|---|---|
| 35 | 35 | static UINT8 ldv1000_output_latch; |
| 36 | 36 | |
| 37 | 37 | /* VIDEO GOODS */ |
| 38 | void astron_draw_characters(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect) | |
| 38 | static void astron_draw_characters(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect) | |
| 39 | 39 | { |
| 40 | 40 | UINT8 characterX, characterY; |
| 41 | 41 | |
| r1293 | r1294 | |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | void astron_draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect) | |
| 53 | static void astron_draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect) | |
| 54 | 54 | { |
| 55 | 55 | /* Heisted from Daphne */ |
| 56 | 56 | const UINT8 SPR_Y_TOP = 0; |
| r1293 | r1294 | |
|---|---|---|
| 108 | 108 | seibu_main_word_w(4,data,mem_mask); |
| 109 | 109 | |
| 110 | 110 | /* spin for a while to let the Z80 read the command, otherwise coins "stick" */ |
| 111 | cpu_spinuntil_time( | |
| 111 | cpu_spinuntil_time( | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | static WRITE16_HANDLER( cabalbl_sound_irq_trigger_word_w ) |
| r1293 | r1294 | |
|---|---|---|
| 680 | 680 | { |
| 681 | 681 | cdp1869_configure(&destryer_CDP1869_interface); |
| 682 | 682 | |
| 683 | | |
| 683 | | |
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | static const CDP1869_interface draco_CDP1869_interface = |
| r1293 | r1294 | |
| 699 | 699 | |
| 700 | 700 | cdp1869_configure(&draco_CDP1869_interface); |
| 701 | 701 | |
| 702 | | |
| 702 | | |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | /* ROMs */ |
| r1293 | r1294 | |
|---|---|---|
| 301 | 301 | * |
| 302 | 302 | *************************************/ |
| 303 | 303 | |
| 304 | MACHINE_DRIVER_START( tickee ) | |
| 304 | static MACHINE_DRIVER_START( tickee ) | |
| 305 | 305 | |
| 306 | 306 | /* basic machine hardware */ |
| 307 | 307 | MDRV_CPU_ADD_TAG("main", TMS34010, 40000000/TMS34010_CLOCK_DIVIDER) |
| r1293 | r1294 | |
| 335 | 335 | MACHINE_DRIVER_END |
| 336 | 336 | |
| 337 | 337 | |
| 338 | MACHINE_DRIVER_START( ghoshunt ) | |
| 338 | static MACHINE_DRIVER_START( ghoshunt ) | |
| 339 | 339 | MDRV_IMPORT_FROM(tickee) |
| 340 | 340 | |
| 341 | 341 | /* basic machine hardware */ |
| r1293 | r1294 | |
|---|---|---|
| 34 | 34 | soundlatch_w(0,data); |
| 35 | 35 | cpunum_set_input_line(1,INPUT_LINE_NMI,PULSE_LINE); |
| 36 | 36 | /* spin for a while to let the Z80 read the command (fixes hanging sound in Regulus) */ |
| 37 | cpu_spinuntil_time( | |
| 37 | cpu_spinuntil_time( | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
| r1293 | r1294 | |
| 193 | 193 | MDRV_CPU_VBLANK_INT(irq0_line_hold,4) /* NMIs are caused by the main CPU */ |
| 194 | 194 | |
| 195 | 195 | MDRV_SCREEN_REFRESH_RATE(60) |
| 196 | MDRV_SCREEN_VBLANK_TIME( | |
| 196 | MDRV_SCREEN_VBLANK_TIME(A | |
| 197 | 197 | |
| 198 | 198 | /* video hardware */ |
| 199 | 199 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 198 | 198 | static UINT8 irqvector; |
| 199 | 199 | static UINT16 sound_status; |
| 200 | 200 | static UINT32 bankaddress; |
| 201 | static | |
| 201 | static | |
| 202 | 202 | |
| 203 | 203 | static UINT8 m92_irq_vectorbase; |
| 204 | 204 | |
| r1293 | r1294 | |
| 225 | 225 | state_save_register_global(bankaddress); |
| 226 | 226 | state_save_register_func_postload(set_m92_bank); |
| 227 | 227 | |
| 228 | scanline_timer = | |
| 228 | scanline_timer = | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | static MACHINE_RESET( m92 ) |
| 232 | 232 | { |
| 233 | | |
| 233 | | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /*****************************************************************************/ |
| r1293 | r1294 | |
| 256 | 256 | /* adjust for next scanline */ |
| 257 | 257 | if (++scanline >= machine->screen[0].height) |
| 258 | 258 | scanline = 0; |
| 259 | | |
| 259 | | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /*****************************************************************************/ |
| r1293 | r1294 | |
|---|---|---|
| 244 | 244 | { |
| 245 | 245 | cpunum_set_input_line(1, INPUT_LINE_NMI, CLEAR_LINE ); |
| 246 | 246 | |
| 247 | | |
| 247 | | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | static WRITE8_HANDLER( z80_irq_w ) |
| r1293 | r1294 | |
|---|---|---|
| 49 | 49 | |
| 50 | 50 | /* PCB supports two dials, but cab has only got one */ |
| 51 | 51 | |
| 52 | mame_timer_set(video_screen_get_time_until_pos(0, readinputport(3), 0), 0, destroyr_dial_callback); | |
| 53 | mame_timer_set(video_screen_get_time_until_pos(0, 0, 0), 0, destroyr_frame_callback); | |
| 52 | timer_set(video_screen_get_time_until_pos(0, readinputport(3), 0), 0, destroyr_dial_callback); | |
| 53 | timer_set(video_screen_get_time_until_pos(0, 0, 0), 0, destroyr_frame_callback); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | static MACHINE_RESET( destroyr ) |
| 58 | 58 | { |
| 59 | | |
| 59 | | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 |
| r1293 | r1294 | |
|---|---|---|
| 1080 | 1080 | static MACHINE_RESET( atomicp ) |
| 1081 | 1081 | { |
| 1082 | 1082 | machine_reset_system16b(machine); |
| 1083 | | |
| 1083 | | |
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 |
| r1293 | r1294 | |
|---|---|---|
| 514 | 514 | MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) |
| 515 | 515 | |
| 516 | 516 | MDRV_SCREEN_REFRESH_RATE(60) |
| 517 | MDRV_SCREEN_VBLANK_TIME( | |
| 517 | MDRV_SCREEN_VBLANK_TIME(A | |
| 518 | 518 | |
| 519 | 519 | MDRV_MACHINE_RESET(marineb) |
| 520 | 520 |
| r1293 | r1294 | |
|---|---|---|
| 37 | 37 | #include "sound/3812intf.h" |
| 38 | 38 | #include "sound/okim6295.h" |
| 39 | 39 | |
| 40 | static | |
| 40 | static | |
| 41 | 41 | |
| 42 | 42 | /* Variables defined in video: */ |
| 43 | 43 | |
| r1293 | r1294 | |
| 69 | 69 | UINT16 new_data = COMBINE_DATA(&fuuki16_vregs[offset]); |
| 70 | 70 | if ((offset == 0x1c/2) && old_data != new_data) |
| 71 | 71 | { |
| 72 | | |
| 72 | | |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| r1293 | r1294 | |
| 79 | 79 | { |
| 80 | 80 | soundlatch_w(0,data & 0xff); |
| 81 | 81 | cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE); |
| 82 | // cpu_spinuntil_time(MAME_TIME_IN_USEC(50)); // Allow the other CPU to reply | |
| 83 | cpu_boost_interleave(time_zero, MAME_TIME_IN_USEC(50)); // Fixes glitching in rasters | |
| 82 | // cpu_spinuntil_time(ATTOTIME_IN_USEC(50)); // Allow the other CPU to reply | |
| 83 | cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(50)); // Fixes glitching in rasters | |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| r1293 | r1294 | |
| 524 | 524 | static TIMER_CALLBACK( level_1_interrupt_callback ) |
| 525 | 525 | { |
| 526 | 526 | cpunum_set_input_line(0, 1, PULSE_LINE); |
| 527 | | |
| 527 | | |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | |
| 531 | 531 | static TIMER_CALLBACK( vblank_interrupt_callback ) |
| 532 | 532 | { |
| 533 | 533 | cpunum_set_input_line(0, 3, PULSE_LINE); // VBlank IRQ |
| 534 | | |
| 534 | | |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | |
| r1293 | r1294 | |
| 539 | 539 | { |
| 540 | 540 | cpunum_set_input_line(0, 5, PULSE_LINE); // Raster Line IRQ |
| 541 | 541 | video_screen_update_partial(0, video_screen_get_vpos(0)); |
| 542 | | |
| 542 | | |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | |
| 546 | 546 | static MACHINE_START( fuuki16 ) |
| 547 | 547 | { |
| 548 | raster_interrupt_timer = | |
| 548 | raster_interrupt_timer = | |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | |
| 552 | 552 | static MACHINE_RESET( fuuki16 ) |
| 553 | 553 | { |
| 554 | mame_timer_set(video_screen_get_time_until_pos(0, 248, 0), 0, level_1_interrupt_callback); | |
| 555 | mame_timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 1, 0), 0, vblank_interrupt_callback); | |
| 556 | mame_timer_adjust(raster_interrupt_timer, video_screen_get_time_until_pos(0, 0, machine->screen[0].visarea.max_x + 1), 0, time_zero); | |
| 554 | timer_set(video_screen_get_time_until_pos(0, 248, 0), 0, level_1_interrupt_callback); | |
| 555 | timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 1, 0), 0, vblank_interrupt_callback); | |
| 556 | timer_adjust(raster_interrupt_timer, video_screen_get_time_until_pos(0, 0, machine->screen[0].visarea.max_x + 1), 0, attotime_zero); | |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 |
| r1293 | r1294 | |
|---|---|---|
| 275 | 275 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 276 | 276 | |
| 277 | 277 | MDRV_SCREEN_REFRESH_RATE(57) |
| 278 | MDRV_SCREEN_VBLANK_TIME( | |
| 278 | MDRV_SCREEN_VBLANK_TIME(A | |
| 279 | 279 | |
| 280 | 280 | /* video hardware */ |
| 281 | 281 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 310 | 310 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 311 | 311 | |
| 312 | 312 | MDRV_SCREEN_REFRESH_RATE(57) |
| 313 | MDRV_SCREEN_VBLANK_TIME( | |
| 313 | MDRV_SCREEN_VBLANK_TIME(A | |
| 314 | 314 | |
| 315 | 315 | /* video hardware */ |
| 316 | 316 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 344 | 344 | MDRV_CPU_VBLANK_INT(irq0_line_hold,2) |
| 345 | 345 | |
| 346 | 346 | MDRV_SCREEN_REFRESH_RATE(57) |
| 347 | MDRV_SCREEN_VBLANK_TIME( | |
| 347 | MDRV_SCREEN_VBLANK_TIME(A | |
| 348 | 348 | |
| 349 | 349 | /* video hardware */ |
| 350 | 350 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
| 378 | 378 | //MDRV_CPU_VBLANK_INT(ripcord_interrupt,1) //AT |
| 379 | 379 | |
| 380 | 380 | MDRV_SCREEN_REFRESH_RATE(57) |
| 381 | MDRV_SCREEN_VBLANK_TIME( | |
| 381 | MDRV_SCREEN_VBLANK_TIME(A | |
| 382 | 382 | |
| 383 | 383 | /* video hardware */ |
| 384 | 384 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 327 | 327 | MDRV_CPU_IO_MAP(readport,0) |
| 328 | 328 | |
| 329 | 329 | MDRV_SCREEN_REFRESH_RATE(55) |
| 330 | MDRV_SCREEN_VBLANK_TIME( | |
| 330 | MDRV_SCREEN_VBLANK_TIME(A | |
| 331 | 331 | |
| 332 | 332 | /* video hardware */ |
| 333 | 333 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 25 | 25 | static UINT16* pkscramble_bgtilemap_ram; |
| 26 | 26 | |
| 27 | 27 | static tilemap *fg_tilemap, *md_tilemap, *bg_tilemap; |
| 28 | static | |
| 28 | static | |
| 29 | 29 | |
| 30 | 30 | static WRITE16_HANDLER( pkscramble_fgtilemap_w ) |
| 31 | 31 | { |
| r1293 | r1294 | |
| 212 | 212 | { |
| 213 | 213 | if (out&0x2000) |
| 214 | 214 | cpunum_set_input_line(0, 1, ASSERT_LINE); |
| 215 | | |
| 215 | | |
| 216 | 216 | interrupt_line_active = 1; |
| 217 | 217 | } |
| 218 | 218 | else |
| 219 | 219 | { |
| 220 | 220 | if (interrupt_line_active) |
| 221 | 221 | cpunum_set_input_line(0, 1, CLEAR_LINE); |
| 222 | | |
| 222 | | |
| 223 | 223 | interrupt_line_active = 0; |
| 224 | 224 | } |
| 225 | 225 | } |
| r1293 | r1294 | |
| 274 | 274 | { |
| 275 | 275 | out = 0; |
| 276 | 276 | interrupt_line_active=0; |
| 277 | scanline_timer = mame_timer_alloc(scanline_callback); | |
| 278 | mame_timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, interrupt_scanline, 0), interrupt_scanline, time_zero); | |
| 277 | scanline_timer = timer_alloc(scanline_callback); | |
| 278 | timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, interrupt_scanline, 0), interrupt_scanline, attotime_zero); | |
| 279 | 279 | |
| 280 | 280 | state_save_register_global(out); |
| 281 | 281 | state_save_register_global(interrupt_line_active); |
| r1293 | r1294 | |
|---|---|---|
| 393 | 393 | static INTERRUPT_GEN( f3_interrupt2 ) |
| 394 | 394 | { |
| 395 | 395 | cpunum_set_input_line(0, 2, HOLD_LINE); // vblank |
| 396 | | |
| 396 | | |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | static MACHINE_RESET( f3 ) |
| r1293 | r1294 | |
| 446 | 446 | TAITO_F3_SOUND_SYSTEM_CPU(16000000) |
| 447 | 447 | |
| 448 | 448 | MDRV_SCREEN_REFRESH_RATE(58.97) |
| 449 | MDRV_SCREEN_VBLANK_TIME( | |
| 449 | MDRV_SCREEN_VBLANK_TIME(A | |
| 450 | 450 | |
| 451 | 451 | MDRV_MACHINE_START(f3) |
| 452 | 452 | MDRV_MACHINE_RESET(f3) |
| r1293 | r1294 | |
|---|---|---|
| 72 | 72 | |
| 73 | 73 | static const int interrupt_lines[INTERRUPTS_PER_FRAME] = { 0x00, 0x80 }; |
| 74 | 74 | |
| 75 | static | |
| 75 | static | |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | static TIMER_CALLBACK( interrupt_callback ) |
| r1293 | r1294 | |
| 87 | 87 | next_interrupt_number = (interrupt_number + 1) % INTERRUPTS_PER_FRAME; |
| 88 | 88 | next_vpos = interrupt_lines[next_interrupt_number]; |
| 89 | 89 | |
| 90 | | |
| 90 | | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | static void create_interrupt_timer(void) |
| 95 | 95 | { |
| 96 | interrupt_timer = | |
| 96 | interrupt_timer = | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | static void start_interrupt_timer(void) |
| 101 | 101 | { |
| 102 | 102 | int vpos = interrupt_lines[0]; |
| 103 | | |
| 103 | | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 |
| r1293 | r1294 | |
|---|---|---|
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | |
| 30 | static | |
| 30 | static | |
| 31 | 31 | static UINT8 m107_irq_vectorbase; |
| 32 | 32 | |
| 33 | 33 | static TIMER_CALLBACK( m107_scanline_interrupt ); |
| r1293 | r1294 | |
| 45 | 45 | |
| 46 | 46 | static MACHINE_START( m107 ) |
| 47 | 47 | { |
| 48 | scanline_timer = | |
| 48 | scanline_timer = | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | static MACHINE_RESET( m107 ) |
| 52 | 52 | { |
| 53 | | |
| 53 | | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /*****************************************************************************/ |
| r1293 | r1294 | |
| 76 | 76 | /* adjust for next scanline */ |
| 77 | 77 | if (++scanline >= machine->screen[0].height) |
| 78 | 78 | scanline = 0; |
| 79 | | |
| 79 | | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 |
| r1293 | r1294 | |
|---|---|---|
| 726 | 726 | ROM_END |
| 727 | 727 | |
| 728 | 728 | |
| 729 | #ifdef UNUSED_FUNCTION | |
| 729 | 730 | void crshrace_patch_code(UINT16 offset) |
| 730 | 731 | { |
| 731 | 732 | /* A hack which shows 3 player mode in code which is disabled */ |
| r1293 | r1294 | |
| 734 | 735 | RAM[(offset + 2)/2] = 0x4e71; |
| 735 | 736 | RAM[(offset + 4)/2] = 0x4e71; |
| 736 | 737 | } |
| 738 | #endif | |
| 737 | 739 | |
| 738 | 740 | |
| 739 | 741 | static DRIVER_INIT( crshrace ) |
| r1293 | r1294 | |
|---|---|---|
| 20 | 20 | #include "driver.h" |
| 21 | 21 | #include "sound/custom.h" |
| 22 | 22 | |
| 23 | UINT8 *clshroad_sharedram; | |
| 23 | static UINT8 *clshroad_sharedram; | |
| 24 | 24 | |
| 25 | 25 | /* Variables & functions defined in video: */ |
| 26 | 26 |
| r1293 | r1294 | |
|---|---|---|
| 355 | 355 | #define VBSTART (224) /*(224+16)*/ |
| 356 | 356 | |
| 357 | 357 | |
| 358 | UINT8 cannonb_bit_to_read; | |
| 358 | static UINT8 cannonb_bit_to_read; | |
| 359 | 359 | |
| 360 | 360 | |
| 361 | 361 | /************************************* |
| r1293 | r1294 | |
|---|---|---|
| 58 | 58 | //**************************************************************************** |
| 59 | 59 | // Interrupt Handlers |
| 60 | 60 | |
| 61 | INTERRUPT_GEN ( bwp1_interrupt ) | |
| 61 | static INTERRUPT_GEN ( bwp1_interrupt ) | |
| 62 | 62 | { |
| 63 | 63 | static int coin = 0; |
| 64 | 64 | UINT8 latch_data; |
| r1293 | r1294 | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | INTERRUPT_GEN ( bwp3_interrupt ) { if (!bwp3_nmimask) cpunum_set_input_line(2, INPUT_LINE_NMI, ASSERT_LINE); } | |
| 93 | static INTERRUPT_GEN ( bwp3_interrupt ) { if (!bwp3_nmimask) cpunum_set_input_line(2, INPUT_LINE_NMI, ASSERT_LINE); } | |
| 94 | 94 | |
| 95 | 95 | //**************************************************************************** |
| 96 | 96 | // Memory and I/O Handlers |
| r1293 | r1294 | |
| 404 | 404 | MDRV_CPU_PERIODIC_INT(bwp3_interrupt, 1000) |
| 405 | 405 | |
| 406 | 406 | MDRV_SCREEN_REFRESH_RATE(60) |
| 407 | MDRV_SCREEN_VBLANK_TIME( | |
| 407 | MDRV_SCREEN_VBLANK_TIME(A | |
| 408 | 408 | MDRV_INTERLEAVE(300) // high enough? |
| 409 | 409 | |
| 410 | 410 | MDRV_MACHINE_RESET(bwing) |
| r1293 | r1294 | |
|---|---|---|
| 702 | 702 | Machine driver |
| 703 | 703 | ***************************************************************************/ |
| 704 | 704 | |
| 705 | INTERRUPT_GEN(srmp6_interrupt) | |
| 705 | static INTERRUPT_GEN(srmp6_interrupt) | |
| 706 | 706 | { |
| 707 | 707 | if(!cpu_getiloops()) |
| 708 | 708 | { |
| r1293 | r1294 | |
|---|---|---|
| 64 | 64 | scanline = 16; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | | |
| 67 | | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | static MACHINE_RESET( cball ) |
| 72 | 72 | { |
| 73 | | |
| 73 | | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 |
| r1293 | r1294 | |
|---|---|---|
| 123 | 123 | /* Called once/frame to generate the VBLANK interrupt */ |
| 124 | 124 | static INTERRUPT_GEN( cave_interrupt ) |
| 125 | 125 | { |
| 126 | mame_timer_set(MAME_TIME_IN_USEC(17376-time_vblank_irq), 0, cave_vblank_start); | |
| 127 | mame_timer_set(MAME_TIME_IN_USEC(17376-time_vblank_irq + 2000), 0, cave_vblank_end); | |
| 126 | timer_set(ATTOTIME_IN_USEC(17376-time_vblank_irq), 0, cave_vblank_start); | |
| 127 | timer_set(ATTOTIME_IN_USEC(17376-time_vblank_irq + 2000), 0, cave_vblank_end); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /* Called by the YMZ280B to set the IRQ state */ |
| r1293 | r1294 | |
| 222 | 222 | // sound_flag2 = 1; |
| 223 | 223 | soundlatch_word_w(offset,data,mem_mask); |
| 224 | 224 | cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE); |
| 225 | cpu_spinuntil_time( | |
| 225 | cpu_spinuntil_time( | |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /* Sound CPU: read the low 8 bits of the 16 bit sound latch */ |
| r1293 | r1294 | |
| 4177 | 4177 | |
| 4178 | 4178 | /* Tiles are 6 bit, 4 bits stored in one rom, 2 bits in the other. |
| 4179 | 4179 | Expand the 2 bit part into a 4 bit layout, so we can decode it */ |
| 4180 | void sailormn_unpack_tiles( const int region ) | |
| 4180 | static void sailormn_unpack_tiles( const int region ) | |
| 4181 | 4181 | { |
| 4182 | 4182 | UINT8 *src = memory_region(region) + (memory_region_length(region)/4)*3 - 1; |
| 4183 | 4183 | UINT8 *dst = memory_region(region) + (memory_region_length(region)/4)*4 - 2; |
| r1293 | r1294 | |
|---|---|---|
| 51 | 51 | #include "sound/3812intf.h" |
| 52 | 52 | |
| 53 | 53 | |
| 54 | UINT8 *brkthru_nmi_enable; /* needs to be tracked down */ | |
| 54 | //UINT8 *brkthru_nmi_enable; /* needs to be tracked down */ | |
| 55 | 55 | extern UINT8 *brkthru_videoram; |
| 56 | 56 | extern size_t brkthru_videoram_size; |
| 57 | 57 | |
| r1293 | r1294 | |
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | |
| 161 | INTERRUPT_GEN( brkthru_interrupt ) | |
| 161 | static INTERRUPT_GEN( brkthru_interrupt ) | |
| 162 | 162 | { |
| 163 | 163 | if (cpu_getiloops() == 0) |
| 164 | 164 | { |
| r1293 | r1294 | |
|---|---|---|
| 152 | 152 | #include "sound/262intf.h" |
| 153 | 153 | #include "sound/ymf278b.h" |
| 154 | 154 | |
| 155 | static | |
| 155 | static | |
| 156 | 156 | static UINT8 fuuki32_shared_ram[16]; |
| 157 | 157 | |
| 158 | 158 | // Described in src/video/fuuki32.c |
| r1293 | r1294 | |
| 249 | 249 | COMBINE_DATA(&fuuki32_vregs[offset]); |
| 250 | 250 | if (offset == 0x1c/4) |
| 251 | 251 | { |
| 252 | | |
| 252 | | |
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | } |
| r1293 | r1294 | |
| 539 | 539 | static TIMER_CALLBACK( level_1_interrupt_callback ) |
| 540 | 540 | { |
| 541 | 541 | cpunum_set_input_line(0, 1, PULSE_LINE); |
| 542 | | |
| 542 | | |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | |
| 546 | 546 | static TIMER_CALLBACK( vblank_interrupt_callback ) |
| 547 | 547 | { |
| 548 | 548 | cpunum_set_input_line(0, 3, PULSE_LINE); // VBlank IRQ |
| 549 | | |
| 549 | | |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | |
| r1293 | r1294 | |
| 554 | 554 | { |
| 555 | 555 | cpunum_set_input_line(0, 5, PULSE_LINE); // Raster Line IRQ |
| 556 | 556 | video_screen_update_partial(0, video_screen_get_vpos(0)); |
| 557 | | |
| 557 | | |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | |
| 561 | 561 | static MACHINE_START( fuuki32 ) |
| 562 | 562 | { |
| 563 | raster_interrupt_timer = | |
| 563 | raster_interrupt_timer = | |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | |
| 567 | 567 | static MACHINE_RESET( fuuki32 ) |
| 568 | 568 | { |
| 569 | mame_timer_set(video_screen_get_time_until_pos(0, 248, 0), 0, level_1_interrupt_callback); | |
| 570 | mame_timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 1, 0), 0, vblank_interrupt_callback); | |
| 571 | mame_timer_adjust(raster_interrupt_timer, video_screen_get_time_until_pos(0, 0, machine->screen[0].visarea.max_x + 1), 0, time_zero); | |
| 569 | timer_set(video_screen_get_time_until_pos(0, 248, 0), 0, level_1_interrupt_callback); | |
| 570 | timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 1, 0), 0, vblank_interrupt_callback); | |
| 571 | timer_adjust(raster_interrupt_timer, video_screen_get_time_until_pos(0, 0, machine->screen[0].visarea.max_x + 1), 0, attotime_zero); | |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 |
| r1293 | r1294 | |
|---|---|---|
| 2093 | 2093 | MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,dec8_s_writemem) |
| 2094 | 2094 | /* NMIs are caused by the main CPU */ |
| 2095 | 2095 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2096 | MDRV_SCREEN_VBLANK_TIME( | |
| 2096 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2097 | 2097 | |
| 2098 | 2098 | /* video hardware */ |
| 2099 | 2099 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
| 2132 | 2132 | MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,dec8_s_writemem) |
| 2133 | 2133 | /* NMIs are caused by the main CPU */ |
| 2134 | 2134 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2135 | MDRV_SCREEN_VBLANK_TIME( | |
| 2135 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2136 | 2136 | |
| 2137 | 2137 | /* video hardware */ |
| 2138 | 2138 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
| 2173 | 2173 | MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,dec8_s_writemem) |
| 2174 | 2174 | /* NMIs are caused by the main CPU */ |
| 2175 | 2175 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2176 | MDRV_SCREEN_VBLANK_TIME( | |
| 2176 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2177 | 2177 | |
| 2178 | 2178 | /* video hardware */ |
| 2179 | 2179 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
| 2212 | 2212 | MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,oscar_s_writemem) |
| 2213 | 2213 | /* NMIs are caused by the main CPU */ |
| 2214 | 2214 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2215 | MDRV_SCREEN_VBLANK_TIME( | |
| 2215 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2216 | 2216 | |
| 2217 | 2217 | /* video hardware */ |
| 2218 | 2218 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
| 2255 | 2255 | MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,oscar_s_writemem) |
| 2256 | 2256 | /* NMIs are caused by the main CPU */ |
| 2257 | 2257 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2258 | MDRV_SCREEN_VBLANK_TIME( | |
| 2258 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2259 | 2259 | MDRV_INTERLEAVE(40) /* 40 CPU slices per frame */ |
| 2260 | 2260 | |
| 2261 | 2261 | /* video hardware */ |
| r1293 | r1294 | |
| 2297 | 2297 | MDRV_CPU_PROGRAM_MAP(ym3526_s_readmem,ym3526_s_writemem) |
| 2298 | 2298 | /* NMIs are caused by the main CPU */ |
| 2299 | 2299 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2300 | MDRV_SCREEN_VBLANK_TIME( | |
| 2300 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2301 | 2301 | MDRV_INTERLEAVE(200) |
| 2302 | 2302 | |
| 2303 | 2303 | /* video hardware */ |
| r1293 | r1294 | |
| 2339 | 2339 | MDRV_CPU_PROGRAM_MAP(ym3526_s_readmem,ym3526_s_writemem) |
| 2340 | 2340 | /* NMIs are caused by the main CPU */ |
| 2341 | 2341 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2342 | MDRV_SCREEN_VBLANK_TIME( | |
| 2342 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2343 | 2343 | MDRV_INTERLEAVE(80) |
| 2344 | 2344 | |
| 2345 | 2345 | /* video hardware */ |
| r1293 | r1294 | |
| 2382 | 2382 | MDRV_CPU_PROGRAM_MAP(csilver_s_readmem,csilver_s_writemem) |
| 2383 | 2383 | /* NMIs are caused by the main CPU */ |
| 2384 | 2384 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2385 | MDRV_SCREEN_VBLANK_TIME( | |
| 2385 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2386 | 2386 | MDRV_INTERLEAVE(100) |
| 2387 | 2387 | |
| 2388 | 2388 | /* video hardware */ |
| r1293 | r1294 | |
| 2426 | 2426 | MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,oscar_s_writemem) |
| 2427 | 2427 | /* NMIs are caused by the main CPU */ |
| 2428 | 2428 | MDRV_SCREEN_REFRESH_RATE(58) |
| 2429 | MDRV_SCREEN_VBLANK_TIME( | |
| 2429 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2430 | 2430 | |
| 2431 | 2431 | /* video hardware */ |
| 2432 | 2432 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM) |
| r1293 | r1294 | |
|---|---|---|
| 34 | 34 | main_cpu_num = 0; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | INTERRUPT_GEN( mnight_interrupt ) | |
| 37 | static INTERRUPT_GEN( mnight_interrupt ) | |
| 38 | 38 | { |
| 39 | 39 | cpunum_set_input_line_and_vector(0,0,HOLD_LINE,0xd7); /* RST 10h */ |
| 40 | 40 | } |
| r1293 | r1294 | |
| 351 | 351 | MDRV_CPU_VBLANK_INT(irq0_line_hold,2) |
| 352 | 352 | |
| 353 | 353 | MDRV_SCREEN_REFRESH_RATE(60) |
| 354 | MDRV_SCREEN_VBLANK_TIME( | |
| 354 | MDRV_SCREEN_VBLANK_TIME(A | |
| 355 | 355 | MDRV_INTERLEAVE(10) |
| 356 | 356 | |
| 357 | 357 | MDRV_MACHINE_RESET(mnight) |
| r1293 | r1294 | |
|---|---|---|
| 104 | 104 | AM_RANGE(0x4000, 0xffff) AM_ROM |
| 105 | 105 | ADDRESS_MAP_END |
| 106 | 106 | |
| 107 | INTERRUPT_GEN( battlane_cpu1_interrupt ) | |
| 107 | static INTERRUPT_GEN( battlane_cpu1_interrupt ) | |
| 108 | 108 | { |
| 109 | 109 | /* See note in battlane_cpu_command_w */ |
| 110 | 110 |
| r1293 | r1294 | |
|---|---|---|
| 28 | 28 | static UINT8 scanline_int; /* INT4 - programmable */ |
| 29 | 29 | static UINT8 vblank_int; /* INT6 - on every VBLANK */ |
| 30 | 30 | |
| 31 | static | |
| 31 | static | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | static int z80running; |
| r1293 | r1294 | |
| 103 | 103 | { |
| 104 | 104 | scanline_int = 1; |
| 105 | 105 | update_interrupts(); |
| 106 | | |
| 106 | | |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /* advance to the next scanline */ |
| r1293 | r1294 | |
| 114 | 114 | scanline = 0; |
| 115 | 115 | |
| 116 | 116 | /* set a timer */ |
| 117 | | |
| 117 | | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
| r1293 | r1294 | |
| 134 | 134 | update_interrupts(); |
| 135 | 135 | |
| 136 | 136 | /* set a timer to turn it off */ |
| 137 | | |
| 137 | | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
| r1293 | r1294 | |
| 172 | 172 | logerror("Machine init\n"); |
| 173 | 173 | |
| 174 | 174 | /* set the first scanline 0 timer to go off */ |
| 175 | scan_timer = mame_timer_alloc(vdp_reload_counter); | |
| 176 | mame_timer_adjust(scan_timer, video_screen_get_time_until_pos(0, 0, 320), 0, time_zero); | |
| 175 | scan_timer = timer_alloc(vdp_reload_counter); | |
| 176 | timer_adjust(scan_timer, video_screen_get_time_until_pos(0, 0, 320), 0, attotime_zero); | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 |
| r1293 | r1294 | |
|---|---|---|
| 112 | 112 | static UINT8 *nvram_stage; |
| 113 | 113 | static const UINT8 *syncprom; |
| 114 | 114 | static UINT8 irq_state; |
| 115 | static | |
| 115 | static | |
| 116 | 116 | |
| 117 | 117 | int cloud9_vblank_start; |
| 118 | 118 | int cloud9_vblank_end; |
| r1293 | r1294 | |
| 131 | 131 | curscanline = (curscanline + 64) & 255; |
| 132 | 132 | |
| 133 | 133 | /* next one at the start of this scanline */ |
| 134 | | |
| 134 | | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
| r1293 | r1294 | |
| 193 | 193 | visarea.max_x = 255; |
| 194 | 194 | visarea.min_y = cloud9_vblank_end + 1; |
| 195 | 195 | visarea.max_y = cloud9_vblank_start; |
| 196 | video_screen_configure(0, 320, 256, &visarea, HZ_TO_ | |
| 196 | video_screen_configure(0, 320, 256, &visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); | |
| 197 | 197 | |
| 198 | 198 | /* create a timer for IRQs and set up the first callback */ |
| 199 | irq_timer = | |
| 199 | irq_timer = | |
| 200 | 200 | irq_state = 0; |
| 201 | 201 | schedule_next_irq(0-64); |
| 202 | 202 |
| r1293 | r1294 | |
|---|---|---|
| 200 | 200 | MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) |
| 201 | 201 | |
| 202 | 202 | MDRV_SCREEN_REFRESH_RATE(57) |
| 203 | MDRV_SCREEN_VBLANK_TIME( | |
| 203 | MDRV_SCREEN_VBLANK_TIME(A | |
| 204 | 204 | /* accurate frequency, measured on a Moon Patrol board, is 56.75Hz. |
| 205 | 205 | the Lode Runner manual (similar but different hardware) |
| 206 | 206 | talks about 55Hz and 1790ms vblank duration. */ |
| r1293 | r1294 | |
|---|---|---|
| 95 | 95 | static UINT32 *rabbit_spriteregs; |
| 96 | 96 | static UINT32 *rabbit_blitterregs; |
| 97 | 97 | static mame_bitmap *rabbit_sprite_bitmap; |
| 98 | rectangle rabbit_sprite_clip; | |
| 98 | static rectangle rabbit_sprite_clip; | |
| 99 | 99 | |
| 100 | 100 | static int rabbit_vblirqlevel, rabbit_bltirqlevel, rabbit_banking; |
| 101 | 101 | |
| 102 | UINT32 *rabbit_tilemap_ram[4]; | |
| 102 | static UINT32 *rabbit_tilemap_ram[4]; | |
| 103 | 103 | |
| 104 | UINT32 *rabbit_spriteram; | |
| 104 | static UINT32 *rabbit_spriteram; | |
| 105 | 105 | static tilemap *rabbit_tilemap[4]; |
| 106 | 106 | |
| 107 | 107 | /* call with tilesize = 0 for 8x8 or 1 for 16x16 */ |
| r1293 | r1294 | |
| 612 | 612 | cpunum_set_input_line(0, rabbit_bltirqlevel, HOLD_LINE); |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | void rabbit_do_blit(void) | |
| 615 | static void rabbit_do_blit(void) | |
| 616 | 616 | { |
| 617 | 617 | UINT8 *blt_data = memory_region(REGION_USER1); |
| 618 | 618 | int blt_source = (rabbit_blitterregs[0]&0x000fffff)>>0; |
| r1293 | r1294 | |
| 656 | 656 | if (!blt_amount) |
| 657 | 657 | { |
| 658 | 658 | if(BLITLOG) mame_printf_debug("end of blit list\n"); |
| 659 | | |
| 659 | | |
| 660 | 660 | return; |
| 661 | 661 | } |
| 662 | 662 |
| r1293 | r1294 | |
|---|---|---|
| 239 | 239 | cpunum_set_input_line(0, 5, HOLD_LINE); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | INTERRUPT_GEN( cadash_interrupt ) | |
| 242 | static INTERRUPT_GEN( cadash_interrupt ) | |
| 243 | 243 | { |
| 244 | | |
| 244 | | |
| 245 | 245 | cpunum_set_input_line(0, 4, HOLD_LINE); /* interrupt vector 4 */ |
| 246 | 246 | } |
| 247 | 247 |
| r1293 | r1294 | |
|---|---|---|
| 23 | 23 | #include "deco16ic.h" |
| 24 | 24 | #include "rendlay.h" |
| 25 | 25 | |
| 26 | UINT32 *backfire_spriteram32_1; | |
| 27 | UINT32 *backfire_spriteram32_2; | |
| 28 | UINT32 *backfire_mainram; | |
| 29 | mame_bitmap * backfire_left; | |
| 30 | mame_bitmap * backfire_right; | |
| 26 | static UINT32 *backfire_spriteram32_1; | |
| 27 | static UINT32 *backfire_spriteram32_2; | |
| 28 | static UINT32 *backfire_mainram; | |
| 29 | static mame_bitmap * backfire_left; | |
| 30 | static mame_bitmap * backfire_right; | |
| 31 | 31 | |
| 32 | 32 | //UINT32 *backfire_180010, *backfire_188010; |
| 33 | UINT32 *backfire_left_priority, *backfire_right_priority; | |
| 33 | static UINT32 *backfire_left_priority, *backfire_right_priority; | |
| 34 | 34 | |
| 35 | 35 | /* I'm using the functions in deco16ic.c ... same chips, why duplicate code? */ |
| 36 | 36 | |
| r1293 | r1294 | |
| 491 | 491 | MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1) |
| 492 | 492 | |
| 493 | 493 | MDRV_SCREEN_REFRESH_RATE(58) |
| 494 | MDRV_SCREEN_VBLANK_TIME( | |
| 494 | MDRV_SCREEN_VBLANK_TIME(A | |
| 495 | 495 | MDRV_NVRAM_HANDLER(93C46) |
| 496 | 496 | |
| 497 | 497 | /* video hardware */ |
| r1293 | r1294 | |
| 678 | 678 | { |
| 679 | 679 | // mame_printf_debug( "%08x\n",activecpu_get_pc()); |
| 680 | 680 | |
| 681 | if (activecpu_get_pc()==0xce44) cpu_spinuntil_time(MAME_TIME_IN_USEC(400)); // backfire | |
| 682 | if (activecpu_get_pc()==0xcee4) cpu_spinuntil_time(MAME_TIME_IN_USEC(400)); // backfira | |
| 681 | if (activecpu_get_pc()==0xce44) cpu_spinuntil_time(ATTOTIME_IN_USEC(400)); // backfire | |
| 682 | if (activecpu_get_pc()==0xcee4) cpu_spinuntil_time(ATTOTIME_IN_USEC(400)); // backfira | |
| 683 | 683 | |
| 684 | 684 | return backfire_mainram[0x18/4]; |
| 685 | 685 | } |
| r1293 | r1294 | |
|---|---|---|
| 67 | 67 | static WRITE8_HANDLER( sound_arm_nmi_w ) |
| 68 | 68 | { |
| 69 | 69 | cpunum_set_input_line(1, INPUT_LINE_NMI, CLEAR_LINE); |
| 70 | | |
| 70 | | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | static READ8_HANDLER( pip_r ) |
| r1293 | r1294 | |
|---|---|---|
| 382 | 382 | MDRV_CPU_ADD(M6809, MASTER_CLOCK / 8) |
| 383 | 383 | MDRV_CPU_PROGRAM_MAP(main_map,0) |
| 384 | 384 | MDRV_CPU_PERIODIC_INT(irq0_line_assert, (double)MASTER_CLOCK / 4096 / 12) |
| 385 | MDRV_WATCHDOG_TIME_INIT( | |
| 385 | MDRV_WATCHDOG_TIME_INIT( | |
| 386 | 386 | |
| 387 | 387 | MDRV_CPU_ADD(M6809, MASTER_CLOCK / 8) |
| 388 | 388 | /* audio CPU */ |
| r1293 | r1294 | |
|---|---|---|
| 47 | 47 | scanline = 0; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | | |
| 50 | | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | static MACHINE_RESET( wolfpack ) |
| 55 | 55 | { |
| 56 | | |
| 56 | | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 |
| r1293 | r1294 | |
|---|---|---|
| 174 | 174 | AM_RANGE(0x2000, 0x3fff) AM_WRITE(MWA8_ROM) |
| 175 | 175 | ADDRESS_MAP_END |
| 176 | 176 | |
| 177 | INTERRUPT_GEN( tankbatt_interrupt ) | |
| 177 | static INTERRUPT_GEN( tankbatt_interrupt ) | |
| 178 | 178 | { |
| 179 | 179 | if ((readinputport (0) & 0x60) == 0) cpunum_set_input_line(0,0,HOLD_LINE); |
| 180 | 180 | else if (tankbatt_nmi_enable) cpunum_set_input_line(0,INPUT_LINE_NMI,PULSE_LINE); |
| r1293 | r1294 | |
|---|---|---|
| 192 | 192 | |
| 193 | 193 | static TIMER_CALLBACK( boost_interleave ) |
| 194 | 194 | { |
| 195 | cpu_boost_interleave(time_zero, | |
| 195 | cpu_boost_interleave(attotime_zero, | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | #include "driver.h" |
| 17 | 17 | #include "sound/ay8910.h" |
| 18 | 18 | |
| 19 | UINT8 *ltcasino_tile_num_ram, *ltcasino_tile_atr_ram; | |
| 19 | static UINT8 *ltcasino_tile_num_ram, *ltcasino_tile_atr_ram; | |
| 20 | 20 | |
| 21 | tilemap *ltcasino_tilemap; | |
| 21 | static tilemap *ltcasino_tilemap; | |
| 22 | 22 | |
| 23 | 23 | /* Video */ |
| 24 | 24 |
| r1293 | r1294 | |
|---|---|---|
| 85 | 85 | |
| 86 | 86 | /* end video */ |
| 87 | 87 | |
| 88 | UINT32* sysh1_workram_h; | |
| 89 | UINT16* sysh1_soundram; | |
| 88 | static UINT32* sysh1_workram_h; | |
| 89 | //UINT16* sysh1_soundram; | |
| 90 | 90 | |
| 91 | 91 | // what's wrong: |
| 92 | 92 | // |
| r1293 | r1294 | |
|---|---|---|
| 35 | 35 | PALETTE_INIT(darkmist); |
| 36 | 36 | |
| 37 | 37 | UINT8 * darkmist_scroll; |
| 38 | UINT8 * darkmist_workram; | |
| 38 | static UINT8 * darkmist_workram; | |
| 39 | 39 | |
| 40 | 40 | int darkmist_hw; |
| 41 | 41 | |
| r1293 | r1294 | |
| 236 | 236 | GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0, 16*4 ) |
| 237 | 237 | GFXDECODE_END |
| 238 | 238 | |
| 239 | INTERRUPT_GEN( darkmist_interrupt ) | |
| 239 | static INTERRUPT_GEN( darkmist_interrupt ) | |
| 240 | 240 | { |
| 241 | 241 | if(cpu_getiloops()) |
| 242 | 242 | { |
| r1293 | r1294 | |
|---|---|---|
| 44 | 44 | extern VIDEO_UPDATE( exctsccr ); |
| 45 | 45 | |
| 46 | 46 | /* from machine */ |
| 47 | #if MCU_HACK | |
| 47 | 48 | extern UINT8 *exctsccr_mcu_ram; |
| 48 | 49 | extern WRITE8_HANDLER( exctsccr_mcu_w ); |
| 49 | 50 | extern WRITE8_HANDLER( exctsccr_mcu_control_w ); |
| 50 | 51 | extern WRITE8_HANDLER( exctscc2_mcu_control_w ); |
| 52 | #endif | |
| 51 | 53 | |
| 52 | 54 | |
| 53 | 55 | static WRITE8_HANDLER( exctsccr_DAC_data_w ) |
| r1293 | r1294 | |
| 108 | 110 | static UINT8 *mcu_shared_ram; |
| 109 | 111 | static WRITE8_HANDLER( cexctsccr_mcu_halt_w ) |
| 110 | 112 | { |
| 113 | #if MCU_HACK | |
| 114 | exctsccr_mcu_control_w(offset,data&1); | |
| 115 | #else | |
| 111 | 116 | const int *p; |
| 112 | 117 | |
| 113 | 118 | data &= 1; |
| 114 | #if MCU_HACK | |
| 115 | exctsccr_mcu_control_w(offset,data); | |
| 116 | extern UINT8 *exctsccr_mcu_ram; | |
| 117 | #else | |
| 118 | 119 | cpunum_set_input_line(2, INPUT_LINE_HALT, data ? ASSERT_LINE : CLEAR_LINE); |
| 119 | 120 | if( (p=mcu_patch_data) != NULL) |
| 120 | 121 | { |
| r1293 | r1294 | |
| 129 | 130 | p++; |
| 130 | 131 | } |
| 131 | 132 | } |
| 133 | #endif | |
| 132 | 134 | } |
| 133 | #endif | |
| 134 | 135 | |
| 135 | 136 | /*************************************************************************** |
| 136 | 137 |
| r1293 | r1294 | |
|---|---|---|
| 355 | 355 | MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262) |
| 356 | 356 | |
| 357 | 357 | MDRV_SCREEN_REFRESH_RATE(59.997) |
| 358 | MDRV_SCREEN_VBLANK_TIME( | |
| 358 | MDRV_SCREEN_VBLANK_TIME(A | |
| 359 | 359 | |
| 360 | 360 | MDRV_MACHINE_RESET(mquake) |
| 361 | 361 | MDRV_NVRAM_HANDLER(generic_0fill) |
| r1293 | r1294 | |
|---|---|---|
| 154 | 154 | |
| 155 | 155 | static MACHINE_RESET( nitedrvr ) |
| 156 | 156 | { |
| 157 | | |
| 157 | | |
| 158 | 158 | nitedrvr_register_machine_vars(); |
| 159 | 159 | } |
| 160 | 160 |
| r1293 | r1294 | |
|---|---|---|
| 1442 | 1442 | // set absolute mode |
| 1443 | 1443 | result = dinput_set_dword_property(devinfo->dinput.device, DIPROP_AXISMODE, 0, DIPH_DEVICE, DIPROPAXISMODE_ABS); |
| 1444 | 1444 | if (result != DI_OK) |
| 1445 | { | |
| 1446 | mame_printf_error("DirectInput: Unable to set absolute mode for joystick %d (%s)\n", generic_device_index(joystick_list, devinfo), devinfo->name); | |
| 1447 | goto error; | |
| 1448 | } | |
| 1445 | mame_printf_warning("DirectInput: Unable to set absolute mode for joystick %d (%s)\n", generic_device_index(joystick_list, devinfo), devinfo->name); | |
| 1449 | 1446 | |
| 1450 | 1447 | // turn off deadzone; we do our own calculations |
| 1451 | 1448 | result = dinput_set_dword_property(devinfo->dinput.device, DIPROP_DEADZONE, 0, DIPH_DEVICE, 0); |
| r1293 | r1294 | |
| 1527 | 1524 | |
| 1528 | 1525 | exit: |
| 1529 | 1526 | return DIENUM_CONTINUE; |
| 1530 | ||
| 1531 | error: | |
| 1532 | if (devinfo != NULL) | |
| 1533 | dinput_device_release(devinfo); | |
| 1534 | goto exit; | |
| 1535 | 1527 | } |
| 1536 | 1528 | |
| 1537 | 1529 |
| r1293 | r1294 | |
|---|---|---|
| 1303 | 1303 | // use those as the target for now |
| 1304 | 1304 | einfo.target_width = einfo.minimum_width * MAX(1, video_config.prescale); |
| 1305 | 1305 | einfo.target_height = einfo.minimum_height * MAX(1, video_config.prescale); |
| 1306 | einfo.target_refresh = | |
| 1306 | einfo.target_refresh = ATTOSECONDS_TO_HZ(Machine->screen[0].refresh); | |
| 1307 | 1307 | |
| 1308 | 1308 | // if we're not stretching, allow some slop on the minimum since we can handle it |
| 1309 | 1309 | if (!video_config.hwstretch) |
| r1293 | r1294 | |
|---|---|---|
| 174 | 174 | divide and return the 32 bit quotient |
| 175 | 175 | -------------------------------------------------*/ |
| 176 | 176 | |
| 177 | /* TBD */ | |
| 177 | #ifndef PTR64 | |
| 178 | #define div_64x32 _div_64x32 | |
| 179 | INLINE INT32 _div_64x32(INT64 a, INT32 b) | |
| 180 | { | |
| 181 | INT32 result; | |
| 182 | INT32 alow = a; | |
| 183 | INT32 ahigh = a >> 32; | |
| 178 | 184 | |
| 185 | __asm | |
| 186 | { | |
| 187 | mov eax,alow | |
| 188 | mov edx,ahigh | |
| 189 | idiv b | |
| 190 | mov result,eax | |
| 191 | } | |
| 179 | 192 | |
| 193 | return result; | |
| 194 | } | |
| 195 | #endif | |
| 196 | ||
| 197 | ||
| 180 | 198 | /*------------------------------------------------- |
| 181 | 199 | divu_64x32 - perform an unsigned 64 bit x 32 bit |
| 182 | 200 | divide and return the 32 bit quotient |
| 183 | 201 | -------------------------------------------------*/ |
| 184 | 202 | |
| 185 | /* TBD */ | |
| 203 | #ifndef PTR64 | |
| 204 | #define divu_64x32 _divu_64x32 | |
| 205 | INLINE UINT32 _divu_64x32(UINT64 a, UINT32 b) | |
| 206 | { | |
| 207 | UINT32 result; | |
| 208 | UINT32 alow = a; | |
| 209 | UINT32 ahigh = a >> 32; | |
| 186 | 210 | |
| 211 | __asm | |
| 212 | { | |
| 213 | mov eax,alow | |
| 214 | mov edx,ahigh | |
| 215 | div b | |
| 216 | mov result,eax | |
| 217 | } | |
| 187 | 218 | |
| 219 | return result; | |
| 220 | } | |
| 221 | #endif | |
| 222 | ||
| 223 | ||
| 188 | 224 | /*------------------------------------------------- |
| 225 | div_64x32_rem - perform a signed 64 bit x 32 | |
| 226 | bit divide and return the 32 bit quotient and | |
| 227 | 32 bit remainder | |
| 228 | -------------------------------------------------*/ | |
| 229 | ||
| 230 | #ifndef PTR64 | |
| 231 | #define div_64x32_rem _div_64x32_rem | |
| 232 | INLINE INT32 _div_64x32_rem(INT64 a, INT32 b, INT32 *remainder) | |
| 233 | { | |
| 234 | INT32 result; | |
| 235 | INT32 alow = a; | |
| 236 | INT32 ahigh = a >> 32; | |
| 237 | INT32 rem; | |
| 238 | ||
| 239 | __asm | |
| 240 | { | |
| 241 | mov eax,alow | |
| 242 | mov edx,ahigh | |
| 243 | idiv b | |
| 244 | mov result,eax | |
| 245 | mov rem,edx | |
| 246 | } | |
| 247 | ||
| 248 | *remainder = rem; | |
| 249 | return result; | |
| 250 | } | |
| 251 | #endif | |
| 252 | ||
| 253 | ||
| 254 | /*------------------------------------------------- | |
| 255 | divu_64x32_rem - perform an unsigned 64 bit x | |
| 256 | 32 bit divide and return the 32 bit quotient | |
| 257 | and 32 bit remainder | |
| 258 | -------------------------------------------------*/ | |
| 259 | ||
| 260 | #ifndef PTR64 | |
| 261 | #define divu_64x32_rem _divu_64x32_rem | |
| 262 | INLINE UINT32 _divu_64x32_rem(UINT64 a, UINT32 b, UINT32 *remainder) | |
| 263 | { | |
| 264 | UINT32 result; | |
| 265 | UINT32 alow = a; | |
| 266 | UINT32 ahigh = a >> 32; | |
| 267 | UINT32 rem; | |
| 268 | ||
| 269 | __asm | |
| 270 | { | |
| 271 | mov eax,alow | |
| 272 | mov edx,ahigh | |
| 273 | div b | |
| 274 | mov result,eax | |
| 275 | mov rem,edx | |
| 276 | } | |
| 277 | ||
| 278 | *remainder = rem; | |
| 279 | return result; | |
| 280 | } | |
| 281 | #endif | |
| 282 | ||
| 283 | ||
| 284 | /*------------------------------------------------- | |
| 189 | 285 | div_32x32_shift - perform a signed divide of |
| 190 | 286 | two 32 bit values, shifting the first before |
| 191 | 287 | division, and returning the 32 bit quotient |
| r1293 | r1294 | |
| 223 | 319 | #define divu_32x32_shift _divu_32x32_shift |
| 224 | 320 | INLINE UINT32 _divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) |
| 225 | 321 | { |
| 226 | INT32 result; | |
| 322 | UINT32 result; | |
| 227 | 323 | |
| 228 | 324 | __asm |
| 229 | 325 | { |
| r1293 | r1294 | |
| 246 | 342 | divide and return the 32 bit remainder |
| 247 | 343 | -------------------------------------------------*/ |
| 248 | 344 | |
| 249 | /* TBD */ | |
| 345 | #ifndef PTR64 | |
| 346 | #define mod_64x32 _mod_64x32 | |
| 347 | INLINE INT32 _mod_64x32(INT64 a, INT32 b) | |
| 348 | { | |
| 349 | INT32 result; | |
| 350 | INT32 alow = a; | |
| 351 | INT32 ahigh = a >> 32; | |
| 250 | 352 | |
| 353 | __asm | |
| 354 | { | |
| 355 | mov eax,alow | |
| 356 | mov edx,ahigh | |
| 357 | idiv b | |
| 358 | mov result,edx | |
| 359 | } | |
| 251 | 360 | |
| 361 | return result; | |
| 362 | } | |
| 363 | #endif | |
| 364 | ||
| 365 | ||
| 252 | 366 | /*------------------------------------------------- |
| 253 | 367 | modu_64x32 - perform an unsigned 64 bit x 32 bit |
| 254 | 368 | divide and return the 32 bit remainder |
| 255 | 369 | -------------------------------------------------*/ |
| 256 | 370 | |
| 257 | /* TBD */ | |
| 371 | #ifndef PTR64 | |
| 372 | #define modu_64x32 _modu_64x32 | |
| 373 | INLINE UINT32 _modu_64x32(UINT64 a, UINT32 b) | |
| 374 | { | |
| 375 | UINT32 result; | |
| 376 | UINT32 alow = a; | |
| 377 | UINT32 ahigh = a >> 32; | |
| 258 | 378 | |
| 379 | __asm | |
| 380 | { | |
| 381 | mov eax,alow | |
| 382 | mov edx,ahigh | |
| 383 | div b | |
| 384 | mov result,edx | |
| 385 | } | |
| 259 | 386 | |
| 387 | return result; | |
| 388 | } | |
| 389 | #endif | |
| 390 | ||
| 391 | ||
| 260 | 392 | /*------------------------------------------------- |
| 261 | 393 | recip_approx - compute an approximate floating |
| 262 | 394 | point reciprocal |
| r1293 | r1294 | |
| 408 | 540 | -------------------------------------------------*/ |
| 409 | 541 | |
| 410 | 542 | #define atomic_increment32 _atomic_increment32 |
| 411 | INLINE INT32 _atomic_increment32(INT32 volatile *ptr | |
| 543 | INLINE INT32 _atomic_increment32(INT32 volatile *ptr | |
| 412 | 544 | { |
| 413 | 545 | return _InterlockedIncrement(ptr); |
| 414 | 546 | } |
| r1293 | r1294 | |
| 421 | 553 | -------------------------------------------------*/ |
| 422 | 554 | |
| 423 | 555 | #define atomic_decrement32 _atomic_decrement32 |
| 424 | INLINE INT32 _atomic_decrement32(INT32 volatile *ptr | |
| 556 | INLINE INT32 _atomic_decrement32(INT32 volatile *ptr | |
| 425 | 557 | { |
| 426 | 558 | return _InterlockedDecrement(ptr); |
| 427 | 559 | } |
| r1293 | r1294 | |
|---|---|---|
| 706 | 706 | d3d->presentation.MultiSampleType = D3DMULTISAMPLE_NONE; |
| 707 | 707 | d3d->presentation.SwapEffect = D3DSWAPEFFECT_DISCARD; |
| 708 | 708 | d3d->presentation.hDeviceWindow = window->hwnd; |
| 709 | d3d->presentation.Windowed = | |
| 709 | d3d->presentation.Windowed = | |
| 710 | 710 | d3d->presentation.EnableAutoDepthStencil = FALSE; |
| 711 | 711 | d3d->presentation.AutoDepthStencilFormat = D3DFMT_D16; |
| 712 | 712 | d3d->presentation.Flags = 0; |
| r1293 | r1294 | |
| 1198 | 1198 | |
| 1199 | 1199 | static void pick_best_mode(win_window_info *window) |
| 1200 | 1200 | { |
| 1201 | double target_refresh = | |
| 1201 | double target_refresh = ATTOSECONDS_TO_HZ(Machine->screen[0].refresh); | |
| 1202 | 1202 | INT32 target_width, target_height; |
| 1203 | 1203 | d3d_info *d3d = window->drawdata; |
| 1204 | 1204 | INT32 minwidth, minheight; |
| r1293 | r1294 | |
|---|---|---|
| 666 | 666 | sprintf(buf,"%d x %d (V) %f Hz", |
| 667 | 667 | drv.screen[0].defstate.visarea.max_y - drv.screen[0].defstate.visarea.min_y + 1, |
| 668 | 668 | drv.screen[0].defstate.visarea.max_x - drv.screen[0].defstate.visarea.min_x + 1, |
| 669 | | |
| 669 | ATTOSECONDS_TO_HZ(drv.screen[0].defstate.refresh)); | |
| 670 | 670 | else |
| 671 | 671 | sprintf(buf,"%d x %d (H) %f Hz", |
| 672 | 672 | drv.screen[0].defstate.visarea.max_x - drv.screen[0].defstate.visarea.min_x + 1, |
| 673 | 673 | drv.screen[0].defstate.visarea.max_y - drv.screen[0].defstate.visarea.min_y + 1, |
| 674 | | |
| 674 | ATTOSECONDS_TO_HZ(drv.screen[0].defstate.refresh)); | |
| 675 | 675 | } |
| 676 | 676 | return buf; |
| 677 | 677 | } |
| r1293 | r1294 | |
|---|---|---|
| 63 | 63 | static int break_on_interrupt_cpunum; |
| 64 | 64 | static int break_on_interrupt_irqline; |
| 65 | 65 | static int break_on_time; |
| 66 | static | |
| 66 | static | |
| 67 | 67 | static int memory_modified; |
| 68 | 68 | static int memory_hook_cpunum; |
| 69 | 69 | |
| r1293 | r1294 | |
| 430 | 430 | execution_state = EXECUTION_STATE_RUNNING; |
| 431 | 431 | debug_cpuinfo[cpu_getactivecpu()].temp_breakpoint_pc = ~0; |
| 432 | 432 | break_on_time = 1; |
| 433 | break_on_time_target = add_mame_times( | |
| 434 | mame_timer_get_time(), | |
| 435 | make_mame_time(milliseconds / 1000, (milliseconds % 1000) * (MAX_SUBSECONDS / 1000))); | |
| 433 | break_on_time_target = attotime_add( | |
| 434 | timer_get_time(), | |
| 435 | attotime_make(milliseconds / 1000, (milliseconds % 1000) * (ATTOSECONDS_PER_SECOND / 1000))); | |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | |
| r1293 | r1294 | |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | /* see if we hit a target time */ |
| 749 | if (break_on_time && | |
| 749 | if (break_on_time && | |
| 750 | 750 | { |
| 751 | debug_console_printf("Stopped at time interval %.1g\n", | |
| 751 | debug_console_printf("Stopped at time interval %.1g\n", | |
| 752 | 752 | break_on_time = 0; |
| 753 | 753 | execution_state = EXECUTION_STATE_STOPPED; |
| 754 | 754 | } |
| r1293 | r1294 | |
|---|---|---|
| 28 | 28 | UINT16 h8TCNT0, h8TCNT1, h8TCNT2, h8TCNT3, h8TCNT4; |
| 29 | 29 | UINT8 h8TSTR; |
| 30 | 30 | |
| 31 | | |
| 31 | | |
| 32 | 32 | |
| 33 | 33 | int cpu_number; |
| 34 | 34 |
| r1293 | r1294 | |
|---|---|---|
| 34 | 34 | |
| 35 | 35 | static TIMER_CALLBACK( h8itu_timer_0_cb ) |
| 36 | 36 | { |
| 37 | | |
| 37 | | |
| 38 | 38 | h8.h8TCNT0 = 0; |
| 39 | 39 | h8.per_regs[TSR0] |= 4; |
| 40 | 40 | // interrupt on overflow ? |
| r1293 | r1294 | |
| 46 | 46 | |
| 47 | 47 | static TIMER_CALLBACK( h8itu_timer_1_cb ) |
| 48 | 48 | { |
| 49 | | |
| 49 | | |
| 50 | 50 | h8.h8TCNT1 = 0; |
| 51 | 51 | h8.per_regs[TSR1] |= 4; |
| 52 | 52 | // interrupt on overflow ? |
| r1293 | r1294 | |
| 58 | 58 | |
| 59 | 59 | static TIMER_CALLBACK( h8itu_timer_2_cb ) |
| 60 | 60 | { |
| 61 | | |
| 61 | | |
| 62 | 62 | h8.h8TCNT2 = 0; |
| 63 | 63 | h8.per_regs[TSR2] |= 4; |
| 64 | 64 | // interrupt on overflow ? |
| r1293 | r1294 | |
| 70 | 70 | |
| 71 | 71 | static TIMER_CALLBACK( h8itu_timer_3_cb ) |
| 72 | 72 | { |
| 73 | | |
| 73 | | |
| 74 | 74 | h8.h8TCNT3 = 0; |
| 75 | 75 | h8.per_regs[TSR3] |= 4; |
| 76 | 76 | // interrupt on overflow ? |
| r1293 | r1294 | |
| 82 | 82 | |
| 83 | 83 | static TIMER_CALLBACK( h8itu_timer_4_cb ) |
| 84 | 84 | { |
| 85 | | |
| 85 | | |
| 86 | 86 | h8.h8TCNT4 = 0; |
| 87 | 87 | h8.per_regs[TSR4] |= 4; |
| 88 | 88 | // interrupt on overflow ? |
| r1293 | r1294 | |
| 96 | 96 | { |
| 97 | 97 | int ourTCR = 0; |
| 98 | 98 | int ourTVAL = 0; |
| 99 | | |
| 99 | | |
| 100 | 100 | static const int tscales[4] = { 1, 2, 4, 8 }; |
| 101 | 101 | |
| 102 | 102 | switch (tnum) |
| r1293 | r1294 | |
| 123 | 123 | break; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | period = | |
| 126 | period = | |
| 127 | 127 | |
| 128 | 128 | if (ourTCR & 4) |
| 129 | 129 | { |
| 130 | 130 | logerror("H8/3002: Timer %d is using an external clock. Unsupported!\n", tnum); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | | |
| 133 | | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | static void h8_itu_sync_timers(int tnum) |
| 137 | 137 | { |
| 138 | 138 | int ourTCR = 0; |
| 139 | | |
| 139 | | |
| 140 | 140 | UINT16 ratio; |
| 141 | 141 | static const int tscales[4] = { 1, 2, 4, 8 }; |
| 142 | 142 | |
| r1293 | r1294 | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // get the time per unit |
| 163 | cycle_time = scale_up_mame_time(MAME_TIME_IN_HZ(cpunum_get_clock(h8.cpu_number)), tscales[ourTCR & 3]); | |
| 164 | cur = mame_timer_timeelapsed(h8.timer[tnum]); | |
| 163 | cycle_time = attotime_mul(ATTOTIME_IN_HZ(cpunum_get_clock(h8.cpu_number)), tscales[ourTCR & 3]); | |
| 164 | cur = timer_timeelapsed(h8.timer[tnum]); | |
| 165 | 165 | |
| 166 | ratio = | |
| 166 | ratio = | |
| 167 | 167 | |
| 168 | 168 | switch (tnum) |
| 169 | 169 | { |
| r1293 | r1294 | |
| 484 | 484 | |
| 485 | 485 | void h8_itu_init(void) |
| 486 | 486 | { |
| 487 | h8.timer[0] = mame_timer_alloc(h8itu_timer_0_cb); | |
| 488 | h8.timer[1] = mame_timer_alloc(h8itu_timer_1_cb); | |
| 489 | h8.timer[2] = mame_timer_alloc(h8itu_timer_2_cb); | |
| 490 | h8.timer[3] = mame_timer_alloc(h8itu_timer_3_cb); | |
| 491 | h8.timer[4] = mame_timer_alloc(h8itu_timer_4_cb); | |
| 487 | h8.timer[0] = timer_alloc(h8itu_timer_0_cb); | |
| 488 | h8.timer[1] = timer_alloc(h8itu_timer_1_cb); | |
| 489 | h8.timer[2] = timer_alloc(h8itu_timer_2_cb); | |
| 490 | h8.timer[3] = timer_alloc(h8itu_timer_3_cb); | |
| 491 | h8.timer[4] = timer_alloc(h8itu_timer_4_cb); | |
| 492 | 492 | |
| 493 | 493 | h8_itu_reset(); |
| 494 | 494 | |
| r1293 | r1294 | |
| 498 | 498 | void h8_itu_reset(void) |
| 499 | 499 | { |
| 500 | 500 | // stop all the timers |
| 501 | mame_timer_adjust(h8.timer[0], time_never, 0, time_zero); | |
| 502 | mame_timer_adjust(h8.timer[1], time_never, 0, time_zero); | |
| 503 | mame_timer_adjust(h8.timer[2], time_never, 0, time_zero); | |
| 504 | mame_timer_adjust(h8.timer[3], time_never, 0, time_zero); | |
| 505 | mame_timer_adjust(h8.timer[4], time_never, 0, time_zero); | |
| 501 | timer_adjust(h8.timer[0], attotime_never, 0, attotime_zero); | |
| 502 | timer_adjust(h8.timer[1], attotime_never, 0, attotime_zero); | |
| 503 | timer_adjust(h8.timer[2], attotime_never, 0, attotime_zero); | |
| 504 | timer_adjust(h8.timer[3], attotime_never, 0, attotime_zero); | |
| 505 | timer_adjust(h8.timer[4], attotime_never, 0, attotime_zero); | |
| 506 | 506 | } |
| r1293 | r1294 | |
|---|---|---|
| 548 | 548 | remove section in brackets and uncomment line below. |
| 549 | 549 | Speed Freak should run nice and smooth, with no flickering. */ |
| 550 | 550 | { |
| 551 | mame_time scantime, abstime; | |
| 552 | extern mame_timer *refresh_timer; | |
| 553 | scantime = mame_timer_starttime(refresh_timer); | |
| 554 | abstime = mame_timer_get_time(); | |
| 555 | while (compare_mame_times(abstime, scantime) >= 0) | |
| 556 | scantime = add_mame_times(scantime, video_screen_get_frame_period(ccpu.scrnum)); | |
| 557 | cpu_spinuntil_time(sub_mame_times(scantime, abstime)); | |
| 551 | attotime scantime, abstime; | |
| 552 | extern emu_timer *refresh_timer; | |
| 553 | scantime = timer_starttime(refresh_timer); | |
| 554 | abstime = timer_get_time(); | |
| 555 | while (attotime_compare(abstime, scantime) >= 0) | |
| 556 | scantime = attotime_add(scantime, video_screen_get_frame_period(ccpu.scrnum)); | |
| 557 | cpu_spinuntil_time(attotime_sub(scantime, abstime)); | |
| 558 | 558 | } |
| 559 | 559 | /* cpu_spinuntil_time(video_screen_get_time_until_pos(ccpu.scrnum, Machine->screen[ccpu.scrnum].visarea.max_y + 1, 0)); */ |
| 560 | 560 | NEXT_ACC_A(); CYCLES(1); |
| r1293 | r1294 | |
|---|---|---|
| 65 | 65 | UINT8 reset_deferred; |
| 66 | 66 | int (*irq_callback)(int irqline); |
| 67 | 67 | const tms34010_config *config; |
| 68 | | |
| 68 | | |
| 69 | 69 | |
| 70 | 70 | /* A registers 0-15 map to regs[0]-regs[15] */ |
| 71 | 71 | /* B registers 0-15 map to regs[30]-regs[15] */ |
| r1293 | r1294 | |
| 616 | 616 | screen_to_cpu[config->scrnum] = index; |
| 617 | 617 | |
| 618 | 618 | /* allocate a scanline timer and set it to go off at the start */ |
| 619 | state.scantimer = mame_timer_alloc(scanline_callback); | |
| 620 | mame_timer_adjust(state.scantimer, time_zero, index, time_zero); | |
| 619 | state.scantimer = timer_alloc(scanline_callback); | |
| 620 | timer_adjust(state.scantimer, attotime_zero, index, attotime_zero); | |
| 621 | 621 | |
| 622 | 622 | /* allocate the shiftreg */ |
| 623 | 623 | state.shiftreg = auto_malloc(SHIFTREG_SIZE); |
| r1293 | r1294 | |
| 640 | 640 | static void tms34010_reset(void) |
| 641 | 641 | { |
| 642 | 642 | const tms34010_config *config; |
| 643 | | |
| 643 | | |
| 644 | 644 | int (*save_irqcallback)(int); |
| 645 | 645 | UINT16 *shiftreg; |
| 646 | 646 | |
| r1293 | r1294 | |
| 963 | 963 | int htotal = SMART_IOREG(HTOTAL); |
| 964 | 964 | if (htotal > 0 && vtotal > 0) |
| 965 | 965 | { |
| 966 | s | |
| 966 | attos | |
| 967 | 967 | int width = (htotal + 1) * state.config->pixperclock; |
| 968 | 968 | int height = vtotal + 1; |
| 969 | 969 | rectangle visarea; |
| r1293 | r1294 | |
| 984 | 984 | } |
| 985 | 985 | |
| 986 | 986 | LOG(("Configuring screen: HTOTAL=%3d BLANK=%3d-%3d VTOTAL=%3d BLANK=%3d-%3d refresh=%f\n", |
| 987 | htotal, SMART_IOREG(HEBLNK), SMART_IOREG(HSBLNK), vtotal, veblnk, vsblnk, | |
| 987 | htotal, SMART_IOREG(HEBLNK), SMART_IOREG(HSBLNK), vtotal, veblnk, vsblnk, ATTOSECONDS_TO_HZ(refresh))); | |
| 988 | 988 | |
| 989 | 989 | /* interlaced timing not supported */ |
| 990 | 990 | if ((SMART_IOREG(DPYCTL) & 0x4000) == 0) |
| r1293 | r1294 | |
| 1029 | 1029 | if (vcount > vtotal) |
| 1030 | 1030 | vcount = 0; |
| 1031 | 1031 | |
| 1032 | /* note that we add !master (0 or 1) as a | |
| 1032 | /* note that we add !master (0 or 1) as a attoseconds value; this makes no practical difference */ | |
| 1033 | 1033 | /* but helps ensure that masters are updated first before slaves */ |
| 1034 | | |
| 1034 | | |
| 1035 | 1035 | |
| 1036 | 1036 | /* restore the context */ |
| 1037 | 1037 | cpuintrf_pop_context(); |
| r1293 | r1294 | |
| 1460 | 1460 | /* have an IRQ handler. For this reason, we return it signalled a bit early in order */ |
| 1461 | 1461 | /* to make it past these loops. */ |
| 1462 | 1462 | if (SMART_IOREG(VCOUNT) + 1 == SMART_IOREG(DPYINT) && |
| 1463 | | |
| 1463 | | |
| 1464 | 1464 | result |= TMS34010_DI; |
| 1465 | 1465 | return result; |
| 1466 | 1466 | } |
| r1293 | r1294 | |
|---|---|---|
| 66 | 66 | ***************************************************************************/ |
| 67 | 67 | |
| 68 | 68 | extern void tms32031_get_info(UINT32 state, cpuinfo *info); |
| 69 | extern void tms32032_get_info(UINT32 state, cpuinfo *info); | |
| 69 | 70 | |
| 70 | 71 | #endif /* _TMS32031_H */ |
| r1293 | r1294 | |
|---|---|---|
| 641 | 641 | * Internal memory map |
| 642 | 642 | **************************************************************************/ |
| 643 | 643 | |
| 644 | static ADDRESS_MAP_START( internal, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 644 | static ADDRESS_MAP_START( internal_32031, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 645 | 645 | AM_RANGE(0x809800, 0x809fff) AM_RAM |
| 646 | 646 | ADDRESS_MAP_END |
| 647 | 647 | |
| 648 | static ADDRESS_MAP_START( internal_32032, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 649 | AM_RANGE(0x87fe00, 0x87ffff) AM_RAM | |
| 650 | ADDRESS_MAP_END | |
| 648 | 651 | |
| 652 | ||
| 649 | 653 | /************************************************************************** |
| 650 | 654 | * Generic get_info |
| 651 | 655 | **************************************************************************/ |
| r1293 | r1294 | |
| 745 | 749 | case CPUINFO_PTR_DISASSEMBLE: info->disassemble = tms32031_dasm; break; |
| 746 | 750 | #endif /* MAME_DEBUG */ |
| 747 | 751 | case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &tms32031_icount; break; |
| 748 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_internal; break; | |
| 752 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_internal_32031; break; | |
| 749 | 753 | |
| 750 | 754 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 751 | 755 | case CPUINFO_STR_NAME: strcpy(info->s, "TMS32031"); break; |
| r1293 | r1294 | |
| 809 | 813 | case CPUINFO_STR_REGISTER + TMS32031_RC: sprintf(info->s, " RC:%08X", tms32031.r[TMR_RC].i32[0]); break; |
| 810 | 814 | } |
| 811 | 815 | } |
| 816 | ||
| 817 | void tms32032_get_info(UINT32 state, cpuinfo *info) | |
| 818 | { | |
| 819 | switch (state) | |
| 820 | { | |
| 821 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 822 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_internal_32032; break; | |
| 823 | ||
| 824 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 825 | case CPUINFO_STR_NAME: strcpy(info->s, "TMS32032"); break; | |
| 826 | ||
| 827 | default: tms32031_get_info(state, info); break; | |
| 828 | } | |
| 829 | } |
| r1293 | r1294 | |
|---|---|---|
| 1516 | 1516 | #------------------------------------------------- |
| 1517 | 1517 | |
| 1518 | 1518 | CPUDEFS += -DHAS_TMS32031=$(if $(filter TMS32031,$(CPUS)),1,0) |
| 1519 | CPUDEFS += -DHAS_TMS32032=$(if $(filter TMS32032,$(CPUS)),1,0) | |
| 1519 | 1520 | |
| 1520 | ifneq ($(filter TMS32031,$(CPUS)),) | |
| 1521 | ifneq ($(filter TMS32031 TMS32032,$(CPUS)),) | |
| 1521 | 1522 | OBJDIRS += $(CPUOBJ)/tms32031 |
| 1522 | 1523 | CPUOBJS += $(CPUOBJ)/tms32031/tms32031.o |
| 1523 | 1524 | DBGOBJS += $(CPUOBJ)/tms32031/dis32031.o |
| r1293 | r1294 | |
|---|---|---|
| 271 | 271 | int cpunum = param; |
| 272 | 272 | |
| 273 | 273 | cpuintrf_push_context(cpunum); |
| 274 | | |
| 274 | | |
| 275 | 275 | |
| 276 | 276 | m37710i_cpu.m37710_regs[m37710_irq_levels[12]] |= 0x04; |
| 277 | 277 | m37710_set_irq_line(M37710_LINE_TIMERA0, PULSE_LINE); |
| r1293 | r1294 | |
| 284 | 284 | int cpunum = param; |
| 285 | 285 | |
| 286 | 286 | cpuintrf_push_context(cpunum); |
| 287 | | |
| 287 | | |
| 288 | 288 | |
| 289 | 289 | m37710i_cpu.m37710_regs[m37710_irq_levels[11]] |= 0x04; |
| 290 | 290 | m37710_set_irq_line(M37710_LINE_TIMERA1, PULSE_LINE); |
| r1293 | r1294 | |
| 297 | 297 | int cpunum = param; |
| 298 | 298 | |
| 299 | 299 | cpuintrf_push_context(cpunum); |
| 300 | | |
| 300 | | |
| 301 | 301 | |
| 302 | 302 | m37710i_cpu.m37710_regs[m37710_irq_levels[10]] |= 0x04; |
| 303 | 303 | m37710_set_irq_line(M37710_LINE_TIMERA2, PULSE_LINE); |
| r1293 | r1294 | |
| 310 | 310 | int cpunum = param; |
| 311 | 311 | |
| 312 | 312 | cpuintrf_push_context(cpunum); |
| 313 | | |
| 313 | | |
| 314 | 314 | |
| 315 | 315 | m37710i_cpu.m37710_regs[m37710_irq_levels[9]] |= 0x04; |
| 316 | 316 | m37710_set_irq_line(M37710_LINE_TIMERA3, PULSE_LINE); |
| r1293 | r1294 | |
| 323 | 323 | int cpunum = param; |
| 324 | 324 | |
| 325 | 325 | cpuintrf_push_context(cpunum); |
| 326 | | |
| 326 | | |
| 327 | 327 | |
| 328 | 328 | m37710i_cpu.m37710_regs[m37710_irq_levels[8]] |= 0x04; |
| 329 | 329 | m37710_set_irq_line(M37710_LINE_TIMERA4, PULSE_LINE); |
| r1293 | r1294 | |
| 336 | 336 | int cpunum = param; |
| 337 | 337 | |
| 338 | 338 | cpuintrf_push_context(cpunum); |
| 339 | | |
| 339 | | |
| 340 | 340 | |
| 341 | 341 | m37710i_cpu.m37710_regs[m37710_irq_levels[7]] |= 0x04; |
| 342 | 342 | m37710_set_irq_line(M37710_LINE_TIMERB0, PULSE_LINE); |
| r1293 | r1294 | |
| 349 | 349 | int cpunum = param; |
| 350 | 350 | |
| 351 | 351 | cpuintrf_push_context(cpunum); |
| 352 | | |
| 352 | | |
| 353 | 353 | |
| 354 | 354 | m37710i_cpu.m37710_regs[m37710_irq_levels[6]] |= 0x04; |
| 355 | 355 | m37710_set_irq_line(M37710_LINE_TIMERB1, PULSE_LINE); |
| r1293 | r1294 | |
| 362 | 362 | int cpunum = param; |
| 363 | 363 | |
| 364 | 364 | cpuintrf_push_context(cpunum); |
| 365 | | |
| 365 | | |
| 366 | 366 | |
| 367 | 367 | m37710i_cpu.m37710_regs[m37710_irq_levels[5]] |= 0x04; |
| 368 | 368 | m37710_set_irq_line(M37710_LINE_TIMERB2, PULSE_LINE); |
| r1293 | r1294 | |
| 405 | 405 | int cpunum = cpu_getactivecpu(); |
| 406 | 406 | int tval; |
| 407 | 407 | static const int tcr[8] = { 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d }; |
| 408 | | |
| 408 | | |
| 409 | 409 | static const int tscales[4] = { 2, 16, 64, 512 }; |
| 410 | 410 | |
| 411 | 411 | // check if enabled |
| r1293 | r1294 | |
| 425 | 425 | switch (m37710i_cpu.m37710_regs[0x56+timer] & 0x3) |
| 426 | 426 | { |
| 427 | 427 | case 0: // timer mode |
| 428 | time = scale_up_mame_time(MAME_TIME_IN_HZ(16000000), tscales[m37710i_cpu.m37710_regs[tcr[timer]]>>6]); | |
| 429 | time = scale_up_mame_time(time, tval + 1); | |
| 428 | time = attotime_mul(ATTOTIME_IN_HZ(16000000), tscales[m37710i_cpu.m37710_regs[tcr[timer]]>>6]); | |
| 429 | time = attotime_mul(time, tval + 1); | |
| 430 | 430 | |
| 431 | 431 | #if M37710_DEBUG |
| 432 | mame_printf_debug("Timer %d in timer mode, %f Hz\n", timer, 1.0 / | |
| 432 | mame_printf_debug("Timer %d in timer mode, %f Hz\n", timer, 1.0 / | |
| 433 | 433 | #endif |
| 434 | 434 | |
| 435 | | |
| 435 | | |
| 436 | 436 | m37710i_cpu.reload[timer] = time; |
| 437 | 437 | break; |
| 438 | 438 | |
| r1293 | r1294 | |
| 460 | 460 | switch (m37710i_cpu.m37710_regs[0x56+timer] & 0x3) |
| 461 | 461 | { |
| 462 | 462 | case 0: // timer mode |
| 463 | time = scale_up_mame_time(MAME_TIME_IN_HZ(16000000), tscales[m37710i_cpu.m37710_regs[tcr[timer]]>>6]); | |
| 464 | time = scale_up_mame_time(time, tval + 1); | |
| 463 | time = attotime_mul(ATTOTIME_IN_HZ(16000000), tscales[m37710i_cpu.m37710_regs[tcr[timer]]>>6]); | |
| 464 | time = attotime_mul(time, tval + 1); | |
| 465 | 465 | |
| 466 | 466 | #if M37710_DEBUG |
| 467 | mame_printf_debug("Timer %d in timer mode, %f Hz\n", timer, 1.0 / | |
| 467 | mame_printf_debug("Timer %d in timer mode, %f Hz\n", timer, 1.0 / | |
| 468 | 468 | #endif |
| 469 | 469 | |
| 470 | | |
| 470 | | |
| 471 | 471 | m37710i_cpu.reload[timer] = time; |
| 472 | 472 | break; |
| 473 | 473 | |
| r1293 | r1294 | |
| 1047 | 1047 | { |
| 1048 | 1048 | INT_ACK = irqcallback; |
| 1049 | 1049 | |
| 1050 | m37710i_cpu.timers[0] = mame_timer_alloc(m37710_timer_a0_cb); | |
| 1051 | m37710i_cpu.timers[1] = mame_timer_alloc(m37710_timer_a1_cb); | |
| 1052 | m37710i_cpu.timers[2] = mame_timer_alloc(m37710_timer_a2_cb); | |
| 1053 | m37710i_cpu.timers[3] = mame_timer_alloc(m37710_timer_a3_cb); | |
| 1054 | m37710i_cpu.timers[4] = mame_timer_alloc(m37710_timer_a4_cb); | |
| 1055 | m37710i_cpu.timers[5] = mame_timer_alloc(m37710_timer_b0_cb); | |
| 1056 | m37710i_cpu.timers[6] = mame_timer_alloc(m37710_timer_b1_cb); | |
| 1057 | m37710i_cpu.timers[7] = mame_timer_alloc(m37710_timer_b2_cb); | |
| 1050 | m37710i_cpu.timers[0] = timer_alloc(m37710_timer_a0_cb); | |
| 1051 | m37710i_cpu.timers[1] = timer_alloc(m37710_timer_a1_cb); | |
| 1052 | m37710i_cpu.timers[2] = timer_alloc(m37710_timer_a2_cb); | |
| 1053 | m37710i_cpu.timers[3] = timer_alloc(m37710_timer_a3_cb); | |
| 1054 | m37710i_cpu.timers[4] = timer_alloc(m37710_timer_a4_cb); | |
| 1055 | m37710i_cpu.timers[5] = timer_alloc(m37710_timer_b0_cb); | |
| 1056 | m37710i_cpu.timers[6] = timer_alloc(m37710_timer_b1_cb); | |
| 1057 | m37710i_cpu.timers[7] = timer_alloc(m37710_timer_b2_cb); | |
| 1058 | 1058 | |
| 1059 | 1059 | state_save_register_item("M377xx", index, m37710i_cpu.a); |
| 1060 | 1060 | state_save_register_item("M377xx", index, m37710i_cpu.b); |
| r1293 | r1294 | |
| 1089 | 1089 | state_save_register_item("M377xx", index, m37710i_cpu.stopped); |
| 1090 | 1090 | state_save_register_item_array("M377xx", index, m37710i_cpu.m37710_regs); |
| 1091 | 1091 | state_save_register_item("M377xx", index, m37710i_cpu.reload[0].seconds); |
| 1092 | state_save_register_item("M377xx", index, m37710i_cpu.reload[0]. | |
| 1092 | state_save_register_item("M377xx", index, m37710i_cpu.reload[0].attoseconds); | |
| 1093 | 1093 | state_save_register_item("M377xx", index, m37710i_cpu.reload[1].seconds); |
| 1094 | state_save_register_item("M377xx", index, m37710i_cpu.reload[1]. | |
| 1094 | state_save_register_item("M377xx", index, m37710i_cpu.reload[1].attoseconds); | |
| 1095 | 1095 | state_save_register_item("M377xx", index, m37710i_cpu.reload[2].seconds); |
| 1096 | state_save_register_item("M377xx", index, m37710i_cpu.reload[2]. | |
| 1096 | state_save_register_item("M377xx", index, m37710i_cpu.reload[2].attoseconds); | |
| 1097 | 1097 | state_save_register_item("M377xx", index, m37710i_cpu.reload[3].seconds); |
| 1098 | state_save_register_item("M377xx", index, m37710i_cpu.reload[3]. | |
| 1098 | state_save_register_item("M377xx", index, m37710i_cpu.reload[3].attoseconds); | |
| 1099 | 1099 | state_save_register_item("M377xx", index, m37710i_cpu.reload[4].seconds); |
| 1100 | state_save_register_item("M377xx", index, m37710i_cpu.reload[4]. | |
| 1100 | state_save_register_item("M377xx", index, m37710i_cpu.reload[4].attoseconds); | |
| 1101 | 1101 | state_save_register_item("M377xx", index, m37710i_cpu.reload[5].seconds); |
| 1102 | state_save_register_item("M377xx", index, m37710i_cpu.reload[5]. | |
| 1102 | state_save_register_item("M377xx", index, m37710i_cpu.reload[5].attoseconds); | |
| 1103 | 1103 | state_save_register_item("M377xx", index, m37710i_cpu.reload[6].seconds); |
| 1104 | state_save_register_item("M377xx", index, m37710i_cpu.reload[6]. | |
| 1104 | state_save_register_item("M377xx", index, m37710i_cpu.reload[6].attoseconds); | |
| 1105 | 1105 | state_save_register_item("M377xx", index, m37710i_cpu.reload[7].seconds); |
| 1106 | state_save_register_item("M377xx", index, m37710i_cpu.reload[7]. | |
| 1106 | state_save_register_item("M377xx", index, m37710i_cpu.reload[7].attoseconds); | |
| 1107 | 1107 | |
| 1108 | 1108 | state_save_register_func_postload(m37710_restore_state); |
| 1109 | 1109 | } |
| r1293 | r1294 | |
|---|---|---|
| 105 | 105 | |
| 106 | 106 | // on-board peripheral stuff |
| 107 | 107 | UINT8 m37710_regs[128]; |
| 108 | mame_time reload[8]; | |
| 109 | mame_timer *timers[8]; | |
| 108 | attotime reload[8]; | |
| 109 | emu_timer *timers[8]; | |
| 110 | 110 | } m37710i_cpu_struct; |
| 111 | 111 | |
| 112 | 112 | extern m37710i_cpu_struct m37710i_cpu; |
| r1293 | r1294 | |
|---|---|---|
| 94 | 94 | static void sc61860_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 95 | 95 | { |
| 96 | 96 | sc61860.config = (SC61860_CONFIG *) config; |
| 97 | | |
| 97 | | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | static void sc61860_get_context (void *dst) |
| r1293 | r1294 | |
|---|---|---|
| 1033 | 1033 | /* Maybe this isn't needed? */ |
| 1034 | 1034 | if (!memtest3_hack) |
| 1035 | 1035 | { |
| 1036 | cpu_boost_interleave(time_zero, | |
| 1036 | cpu_boost_interleave(attotime_zero, | |
| 1037 | 1037 | memtest3_hack++; |
| 1038 | 1038 | } |
| 1039 | 1039 | } |
| r1293 | r1294 | |
|---|---|---|
| 21 | 21 | UINT32 ixbase,iybase; |
| 22 | 22 | |
| 23 | 23 | // Timers: 4 x 8-bit + 1 x 16-bit |
| 24 | | |
| 24 | | |
| 25 | 25 | UINT8 timer_value[4]; |
| 26 | 26 | UINT16 timer4_value; |
| 27 | | |
| 27 | | |
| 28 | 28 | |
| 29 | 29 | } t90_Regs; |
| 30 | 30 | |
| r1293 | r1294 | |
| 2305 | 2305 | void t90_start_timer(int i) |
| 2306 | 2306 | { |
| 2307 | 2307 | int prescaler; |
| 2308 | | |
| 2308 | | |
| 2309 | 2309 | |
| 2310 | 2310 | T90.timer_value[i] = 0; |
| 2311 | 2311 | |
| r1293 | r1294 | |
| 2342 | 2342 | } |
| 2343 | 2343 | |
| 2344 | 2344 | |
| 2345 | period = | |
| 2345 | period = | |
| 2346 | 2346 | |
| 2347 | | |
| 2347 | | |
| 2348 | 2348 | |
| 2349 | logerror("%04X: CPU Timer %d started at %lf Hz\n", activecpu_get_pc(), i, 1.0 / | |
| 2349 | logerror("%04X: CPU Timer %d started at %lf Hz\n", activecpu_get_pc(), i, 1.0 / | |
| 2350 | 2350 | } |
| 2351 | 2351 | |
| 2352 | 2352 | void t90_start_timer4(void) |
| 2353 | 2353 | { |
| 2354 | 2354 | int prescaler; |
| 2355 | | |
| 2355 | | |
| 2356 | 2356 | |
| 2357 | 2357 | T90.timer4_value = 0; |
| 2358 | 2358 | |
| r1293 | r1294 | |
| 2364 | 2364 | return; |
| 2365 | 2365 | } |
| 2366 | 2366 | |
| 2367 | period = | |
| 2367 | period = | |
| 2368 | 2368 | |
| 2369 | | |
| 2369 | | |
| 2370 | 2370 | |
| 2371 | logerror("%04X: CPU Timer 4 started at %lf Hz\n", activecpu_get_pc(), 1.0 / | |
| 2371 | logerror("%04X: CPU Timer 4 started at %lf Hz\n", activecpu_get_pc(), 1.0 / | |
| 2372 | 2372 | } |
| 2373 | 2373 | |
| 2374 | 2374 | |
| 2375 | 2375 | void t90_stop_timer(int i) |
| 2376 | 2376 | { |
| 2377 | | |
| 2377 | | |
| 2378 | 2378 | logerror("%04X: CPU Timer %d stopped\n", activecpu_get_pc(), i); |
| 2379 | 2379 | } |
| 2380 | 2380 | |
| r1293 | r1294 | |
| 2652 | 2652 | memset(&T90, 0, sizeof(T90)); |
| 2653 | 2653 | T90.irq_callback = irqcallback; |
| 2654 | 2654 | |
| 2655 | T90.timer_period = | |
| 2655 | T90.timer_period = | |
| 2656 | 2656 | |
| 2657 | 2657 | // Reset registers to their initial values |
| 2658 | 2658 | |
| r1293 | r1294 | |
| 2662 | 2662 | // Timers |
| 2663 | 2663 | |
| 2664 | 2664 | for (i = 0; i < 4; i++) |
| 2665 | T90.timer[i] = | |
| 2665 | T90.timer[i] = | |
| 2666 | 2666 | |
| 2667 | T90.timer[4] = | |
| 2667 | T90.timer[4] = | |
| 2668 | 2668 | } |
| 2669 | 2669 | |
| 2670 | 2670 | static ADDRESS_MAP_START(tmp90840_mem, ADDRESS_SPACE_PROGRAM, 8) |
| r1293 | r1294 | |
|---|---|---|
| 146 | 146 | UINT8 sptc; |
| 147 | 147 | UINT8 sprb; |
| 148 | 148 | UINT8 sptb; |
| 149 | mame_timer *rx_timer; | |
| 150 | mame_timer *tx_timer; | |
| 149 | emu_timer *rx_timer; | |
| 150 | emu_timer *tx_timer; | |
| 151 | 151 | } SPU_REGS; |
| 152 | 152 | |
| 153 | 153 | typedef union { |
| r1293 | r1294 | |
| 921 | 921 | // !!! why is rfci here !!! |
| 922 | 922 | optable19[51] = ppc_rfci; |
| 923 | 923 | |
| 924 | ppc.spu.rx_timer = mame_timer_alloc(ppc403_spu_rx_callback); | |
| 925 | ppc.spu.tx_timer = mame_timer_alloc(ppc403_spu_tx_callback); | |
| 924 | ppc.spu.rx_timer = timer_alloc(ppc403_spu_rx_callback); | |
| 925 | ppc.spu.tx_timer = timer_alloc(ppc403_spu_tx_callback); | |
| 926 | 926 | |
| 927 | 927 | ppc.read8 = ppc403_read8; |
| 928 | 928 | ppc.read16 = ppc403_read16; |
| r1293 | r1294 | |
|---|---|---|
| 177 | 177 | UINT8 sptc; |
| 178 | 178 | UINT8 sprb; |
| 179 | 179 | UINT8 sptb; |
| 180 | mame_timer *rx_timer; | |
| 181 | mame_timer *tx_timer; | |
| 180 | emu_timer *rx_timer; | |
| 181 | emu_timer *tx_timer; | |
| 182 | 182 | } SPU_REGS; |
| 183 | 183 | |
| 184 | 184 | typedef union { |
| r1293 | r1294 | |
| 1074 | 1074 | optable31[163] = recompile_wrteei; |
| 1075 | 1075 | optable19[51] = recompile_rfci; |
| 1076 | 1076 | |
| 1077 | ppc.spu.rx_timer = mame_timer_alloc(ppc403_spu_rx_callback); | |
| 1078 | ppc.spu.tx_timer = mame_timer_alloc(ppc403_spu_tx_callback); | |
| 1077 | ppc.spu.rx_timer = timer_alloc(ppc403_spu_rx_callback); | |
| 1078 | ppc.spu.tx_timer = timer_alloc(ppc403_spu_tx_callback); | |
| 1079 | 1079 | |
| 1080 | 1080 | ppc.is603 = 0; |
| 1081 | 1081 | ppc.is602 = 0; |
| r1293 | r1294 | |
|---|---|---|
| 150 | 150 | int internal_irq_level; |
| 151 | 151 | int internal_irq_vector; |
| 152 | 152 | |
| 153 | mame_timer *timer; | |
| 154 | mame_timer *dma_timer[2]; | |
| 153 | emu_timer *timer; | |
| 154 | emu_timer *dma_timer[2]; | |
| 155 | 155 | int dma_timer_active[2]; |
| 156 | 156 | |
| 157 | 157 | int is_slave, cpu_number; |
| r1293 | r1294 | |
| 2411 | 2411 | int max_delta = 0xfffff; |
| 2412 | 2412 | UINT16 frc; |
| 2413 | 2413 | |
| 2414 | | |
| 2414 | | |
| 2415 | 2415 | |
| 2416 | 2416 | frc = sh2.frc; |
| 2417 | 2417 | if(!(sh2.m[4] & OCFA)) { |
| r1293 | r1294 | |
| 2437 | 2437 | if(divider) { |
| 2438 | 2438 | max_delta <<= divider; |
| 2439 | 2439 | sh2.frc_base = cpunum_gettotalcycles(sh2.cpu_number); |
| 2440 | | |
| 2440 | | |
| 2441 | 2441 | } else { |
| 2442 | 2442 | logerror("SH2.%d: Timer event in %d cycles of external clock", sh2.cpu_number, max_delta); |
| 2443 | 2443 | } |
| r1293 | r1294 | |
| 2557 | 2557 | LOG(("SH2: DMA %d start %x, %x, %x, %04x, %d, %d, %d\n", dma, src, dst, count, sh2.m[0x63+4*dma], incs, incd, size)); |
| 2558 | 2558 | |
| 2559 | 2559 | sh2.dma_timer_active[dma] = 1; |
| 2560 | | |
| 2560 | | |
| 2561 | 2561 | |
| 2562 | 2562 | src &= AM; |
| 2563 | 2563 | dst &= AM; |
| r1293 | r1294 | |
| 2636 | 2636 | if(sh2.dma_timer_active[dma]) |
| 2637 | 2637 | { |
| 2638 | 2638 | logerror("SH2: DMA %d cancelled in-flight", dma); |
| 2639 | | |
| 2639 | | |
| 2640 | 2640 | sh2.dma_timer_active[dma] = 0; |
| 2641 | 2641 | } |
| 2642 | 2642 | } |
| r1293 | r1294 | |
| 2933 | 2933 | { |
| 2934 | 2934 | const struct sh2_config *conf = config; |
| 2935 | 2935 | |
| 2936 | sh2.timer = mame_timer_alloc(sh2_timer_callback); | |
| 2937 | mame_timer_adjust(sh2.timer, time_never, 0, time_zero); | |
| 2936 | sh2.timer = timer_alloc(sh2_timer_callback); | |
| 2937 | timer_adjust(sh2.timer, attotime_never, 0, attotime_zero); | |
| 2938 | 2938 | |
| 2939 | sh2.dma_timer[0] = mame_timer_alloc(sh2_dmac_callback); | |
| 2940 | mame_timer_adjust(sh2.dma_timer[0], time_never, 0, time_zero); | |
| 2939 | sh2.dma_timer[0] = timer_alloc(sh2_dmac_callback); | |
| 2940 | timer_adjust(sh2.dma_timer[0], attotime_never, 0, attotime_zero); | |
| 2941 | 2941 | |
| 2942 | sh2.dma_timer[1] = mame_timer_alloc(sh2_dmac_callback); | |
| 2943 | mame_timer_adjust(sh2.dma_timer[1], time_never, 0, time_zero); | |
| 2942 | sh2.dma_timer[1] = timer_alloc(sh2_dmac_callback); | |
| 2943 | timer_adjust(sh2.dma_timer[1], attotime_never, 0, attotime_zero); | |
| 2944 | 2944 | |
| 2945 | 2945 | sh2.m = auto_malloc(0x200); |
| 2946 | 2946 |
| r1293 | r1294 | |
|---|---|---|
| 73 | 73 | int internal_irq_level; |
| 74 | 74 | int internal_irq_vector; |
| 75 | 75 | |
| 76 | mame_timer *dma_timer[4]; | |
| 77 | mame_timer *refresh_timer; | |
| 78 | mame_timer *rtc_timer; | |
| 79 | mame_timer *timer0; | |
| 80 | mame_timer *timer1; | |
| 81 | mame_timer *timer2; | |
| 76 | emu_timer *dma_timer[4]; | |
| 77 | emu_timer *refresh_timer; | |
| 78 | emu_timer *rtc_timer; | |
| 79 | emu_timer *timer0; | |
| 80 | emu_timer *timer1; | |
| 81 | emu_timer *timer2; | |
| 82 | 82 | UINT32 refresh_timer_base; |
| 83 | 83 | int dma_timer_active[2]; |
| 84 | 84 | |
| r1293 | r1294 | |
| 3050 | 3050 | static void sh4_reset(void) |
| 3051 | 3051 | { |
| 3052 | 3052 | void *tsaved[4]; |
| 3053 | | |
| 3053 | | |
| 3054 | 3054 | UINT32 *m; |
| 3055 | 3055 | int cpunum; |
| 3056 | 3056 | int save_is_slave; |
| r1293 | r1294 | |
| 3100 | 3100 | sh4_default_exception_priorities(); |
| 3101 | 3101 | memset(sh4.exception_requesting, 0, sizeof(sh4.exception_requesting)); |
| 3102 | 3102 | |
| 3103 | | |
| 3103 | | |
| 3104 | 3104 | sh4.m[RCR2] = 0x09; |
| 3105 | 3105 | sh4.m[TCOR0] = 0xffffffff; |
| 3106 | 3106 | sh4.m[TCNT0] = 0xffffffff; |
| r1293 | r1294 | |
| 3192 | 3192 | memcpy(&sh4, src, sizeof(SH4)); |
| 3193 | 3193 | } |
| 3194 | 3194 | |
| 3195 | static UINT32 compute_ticks_refresh_timer( | |
| 3195 | static UINT32 compute_ticks_refresh_timer( | |
| 3196 | 3196 | { |
| 3197 | 3197 | // elapsed:total = x : ticks |
| 3198 | 3198 | // x=elapsed*tics/total -> x=elapsed*(double)100000000/rtcnt_div[(sh4.m[RTCSR] >> 3) & 7] |
| 3199 | 3199 | // ticks/total=ticks / ((rtcnt_div[(sh4.m[RTCSR] >> 3) & 7] * ticks) / 100000000)=1/((rtcnt_div[(sh4.m[RTCSR] >> 3) & 7] / 100000000)=100000000/rtcnt_div[(sh4.m[RTCSR] >> 3) & 7] |
| 3200 | return base + (UINT32)(( | |
| 3200 | return base + (UINT32)(( | |
| 3201 | 3201 | } |
| 3202 | 3202 | |
| 3203 | 3203 | static void sh4_refresh_timer_recompute(void) |
| r1293 | r1294 | |
| 3210 | 3210 | if (ticks < 0) |
| 3211 | 3211 | ticks = 256 + ticks; |
| 3212 | 3212 | //((double)rtcnt_div[(sh4.m[RTCSR] >> 3) & 7] / (double)100000000)*ticks |
| 3213 | | |
| 3213 | | |
| 3214 | 3214 | sh4.refresh_timer_base = sh4.m[RTCNT]; |
| 3215 | 3215 | } |
| 3216 | 3216 | |
| 3217 | 3217 | /*------------------------------------------------- |
| 3218 | sh4_scale_up_mame_time - multiply a | |
| 3218 | sh4_scale_up_mame_time - multiply a | |
| 3219 | 3219 | a (constant+1) where 0 <= constant < 2^32 |
| 3220 | 3220 | -------------------------------------------------*/ |
| 3221 | 3221 | |
| 3222 | INLINE | |
| 3222 | INLINE | |
| 3223 | 3223 | { |
| 3224 | UINT32 subseclo, subsechi; | |
| 3225 | UINT64 templo, temphi; | |
| 3226 | UINT64 factor; | |
| 3227 | mame_time result; | |
| 3228 | ||
| 3229 | /* if one of the items is time_never, return time_never */ | |
| 3230 | if (_time1.seconds >= MAX_SECONDS) | |
| 3231 | return time_never; | |
| 3232 | ||
| 3233 | /* 0 times anything is zero */ | |
| 3234 | 3224 | if (factor1 == 0) |
| 3235 | return time_zero; | |
| 3236 | ||
| 3237 | factor=factor1; | |
| 3238 | factor++; | |
| 3239 | ||
| 3240 | /* break subseconds into lower and upper halves */ | |
| 3241 | subseclo = (UINT32)(_time1.subseconds % MAX_SUBSECONDS_SQRT); | |
| 3242 | subsechi = (UINT32)(_time1.subseconds / MAX_SUBSECONDS_SQRT); | |
| 3243 | ||
| 3244 | /* get a 64-bit product for each one */ | |
| 3245 | templo = (UINT64)subseclo * (UINT64)factor; | |
| 3246 | temphi = (UINT64)subsechi * (UINT64)factor; | |
| 3247 | ||
| 3248 | /* separate out the low and carry into the high */ | |
| 3249 | subseclo = templo % MAX_SUBSECONDS_SQRT; | |
| 3250 | temphi += templo / MAX_SUBSECONDS_SQRT; | |
| 3251 | subsechi = temphi % MAX_SUBSECONDS_SQRT; | |
| 3252 | ||
| 3253 | /* assemble the two parts into final subseconds and carry into seconds */ | |
| 3254 | result.subseconds = (subseconds_t)subseclo + MAX_SUBSECONDS_SQRT * (subseconds_t)subsechi; | |
| 3255 | result.seconds = _time1.seconds * factor + temphi / MAX_SUBSECONDS_SQRT; | |
| 3256 | ||
| 3257 | /* max out at never time */ | |
| 3258 | if (result.seconds >= MAX_SECONDS) | |
| 3259 | return time_never; | |
| 3260 | ||
| 3261 | return result; | |
| 3225 | return attotime_zero; | |
| 3226 | return attotime_mul(_time1, factor1 + 1); | |
| 3262 | 3227 | } |
| 3263 | 3228 | |
| 3264 | static UINT32 compute_ticks_timer( | |
| 3229 | static UINT32 compute_ticks_timer( | |
| 3265 | 3230 | { |
| 3266 | 3231 | double ret; |
| 3267 | 3232 | |
| 3268 | ret=(( | |
| 3233 | ret=(( | |
| 3269 | 3234 | return (UINT32)ret; |
| 3270 | 3235 | } |
| 3271 | 3236 | |
| r1293 | r1294 | |
| 3274 | 3239 | double ticks; |
| 3275 | 3240 | |
| 3276 | 3241 | ticks = sh4.m[TCNT0]; |
| 3277 | | |
| 3242 | | |
| 3278 | 3243 | } |
| 3279 | 3244 | |
| 3280 | 3245 | static void sh4_timer1_recompute(void) |
| r1293 | r1294 | |
| 3282 | 3247 | double ticks; |
| 3283 | 3248 | |
| 3284 | 3249 | ticks = sh4.m[TCNT1]; |
| 3285 | | |
| 3250 | | |
| 3286 | 3251 | } |
| 3287 | 3252 | |
| 3288 | 3253 | static void sh4_timer2_recompute(void) |
| r1293 | r1294 | |
| 3290 | 3255 | double ticks; |
| 3291 | 3256 | |
| 3292 | 3257 | ticks = sh4.m[TCNT2]; |
| 3293 | | |
| 3258 | | |
| 3294 | 3259 | } |
| 3295 | 3260 | |
| 3296 | 3261 | static TIMER_CALLBACK( sh4_refresh_timer_callback ) |
| r1293 | r1294 | |
| 3409 | 3374 | int cpunum = param; |
| 3410 | 3375 | |
| 3411 | 3376 | cpuintrf_push_context(cpunum); |
| 3412 | | |
| 3377 | | |
| 3413 | 3378 | sh4.m[R64CNT] = (sh4.m[R64CNT]+1) & 0x7f; |
| 3414 | 3379 | if (sh4.m[R64CNT] == 64) |
| 3415 | 3380 | { |
| r1293 | r1294 | |
| 3521 | 3486 | if (timermode == 1) |
| 3522 | 3487 | { |
| 3523 | 3488 | sh4.dma_timer_active[channel] = 1; |
| 3524 | | |
| 3489 | | |
| 3525 | 3490 | } |
| 3526 | 3491 | else if (timermode == 2) |
| 3527 | 3492 | { |
| 3528 | 3493 | sh4.dma_timer_active[channel] = 1; |
| 3529 | | |
| 3494 | | |
| 3530 | 3495 | } |
| 3531 | 3496 | |
| 3532 | 3497 | src &= AM; |
| r1293 | r1294 | |
| 3669 | 3634 | if (sh4.dma_timer_active[channel]) |
| 3670 | 3635 | { |
| 3671 | 3636 | logerror("SH4: DMA %d cancelled in-flight but all data transferred", channel); |
| 3672 | | |
| 3637 | | |
| 3673 | 3638 | sh4.dma_timer_active[channel] = 0; |
| 3674 | 3639 | } |
| 3675 | 3640 | } |
| r1293 | r1294 | |
| 3685 | 3650 | if (sh4.dma_timer_active[s]) |
| 3686 | 3651 | { |
| 3687 | 3652 | logerror("SH4: DMA %d cancelled due to NMI but all data transferred", s); |
| 3688 | | |
| 3653 | | |
| 3689 | 3654 | sh4.dma_timer_active[s] = 0; |
| 3690 | 3655 | } |
| 3691 | 3656 | } |
| r1293 | r1294 | |
| 3711 | 3676 | } |
| 3712 | 3677 | else |
| 3713 | 3678 | { |
| 3714 | | |
| 3679 | | |
| 3715 | 3680 | } |
| 3716 | 3681 | break; |
| 3717 | 3682 | |
| r1293 | r1294 | |
| 3757 | 3722 | } |
| 3758 | 3723 | if ((sh4.m[RCR2] & 8) && (~old & 8)) |
| 3759 | 3724 | { // 0 -> 1 |
| 3760 | | |
| 3725 | | |
| 3761 | 3726 | } |
| 3762 | 3727 | else if (~(sh4.m[RCR2]) & 8) |
| 3763 | 3728 | { // 0 |
| 3764 | | |
| 3729 | | |
| 3765 | 3730 | } |
| 3766 | 3731 | break; |
| 3767 | 3732 | |
| r1293 | r1294 | |
| 3770 | 3735 | if (old & 1) |
| 3771 | 3736 | sh4.m[TCNT0] = compute_ticks_timer(sh4.timer0, sh4.pm_clock, tcnt_div[sh4.m[TCR0] & 7]); |
| 3772 | 3737 | if ((sh4.m[TSTR] & 1) == 0) { |
| 3773 | | |
| 3738 | | |
| 3774 | 3739 | } else |
| 3775 | 3740 | sh4_timer0_recompute(); |
| 3776 | 3741 | |
| 3777 | 3742 | if (old & 2) |
| 3778 | 3743 | sh4.m[TCNT1] = compute_ticks_timer(sh4.timer1, sh4.pm_clock, tcnt_div[sh4.m[TCR1] & 7]); |
| 3779 | 3744 | if ((sh4.m[TSTR] & 2) == 0) { |
| 3780 | | |
| 3745 | | |
| 3781 | 3746 | } else |
| 3782 | 3747 | sh4_timer1_recompute(); |
| 3783 | 3748 | |
| 3784 | 3749 | if (old & 4) |
| 3785 | 3750 | sh4.m[TCNT2] = compute_ticks_timer(sh4.timer2, sh4.pm_clock, tcnt_div[sh4.m[TCR2] & 7]); |
| 3786 | 3751 | if ((sh4.m[TSTR] & 4) == 0) { |
| 3787 | | |
| 3752 | | |
| 3788 | 3753 | } else |
| 3789 | 3754 | sh4_timer2_recompute(); |
| 3790 | 3755 | break; |
| r1293 | r1294 | |
| 4156 | 4121 | { |
| 4157 | 4122 | const struct sh4_config *conf = config; |
| 4158 | 4123 | |
| 4159 | sh4.timer0 = mame_timer_alloc(sh4_timer0_callback); | |
| 4160 | mame_timer_adjust(sh4.timer0, time_never, 0, time_zero); | |
| 4161 | sh4.timer1 = mame_timer_alloc(sh4_timer1_callback); | |
| 4162 | mame_timer_adjust(sh4.timer1, time_never, 0, time_zero); | |
| 4163 | sh4.timer2 = mame_timer_alloc(sh4_timer2_callback); | |
| 4164 | mame_timer_adjust(sh4.timer2, time_never, 0, time_zero); | |
| 4124 | sh4.timer0 = timer_alloc(sh4_timer0_callback); | |
| 4125 | timer_adjust(sh4.timer0, attotime_never, 0, attotime_zero); | |
| 4126 | sh4.timer1 = timer_alloc(sh4_timer1_callback); | |
| 4127 | timer_adjust(sh4.timer1, attotime_never, 0, attotime_zero); | |
| 4128 | sh4.timer2 = timer_alloc(sh4_timer2_callback); | |
| 4129 | timer_adjust(sh4.timer2, attotime_never, 0, attotime_zero); | |
| 4165 | 4130 | |
| 4166 | sh4.dma_timer[0] = mame_timer_alloc(sh4_dmac_callback); | |
| 4167 | mame_timer_adjust(sh4.dma_timer[0], time_never, 0, time_zero); | |
| 4168 | sh4.dma_timer[1] = mame_timer_alloc(sh4_dmac_callback); | |
| 4169 | mame_timer_adjust(sh4.dma_timer[1], time_never, 0, time_zero); | |
| 4170 | sh4.dma_timer[2] = mame_timer_alloc(sh4_dmac_callback); | |
| 4171 | mame_timer_adjust(sh4.dma_timer[2], time_never, 0, time_zero); | |
| 4172 | sh4.dma_timer[3] = mame_timer_alloc(sh4_dmac_callback); | |
| 4173 | mame_timer_adjust(sh4.dma_timer[3], time_never, 0, time_zero); | |
| 4131 | sh4.dma_timer[0] = timer_alloc(sh4_dmac_callback); | |
| 4132 | timer_adjust(sh4.dma_timer[0], attotime_never, 0, attotime_zero); | |
| 4133 | sh4.dma_timer[1] = timer_alloc(sh4_dmac_callback); | |
| 4134 | timer_adjust(sh4.dma_timer[1], attotime_never, 0, attotime_zero); | |
| 4135 | sh4.dma_timer[2] = timer_alloc(sh4_dmac_callback); | |
| 4136 | timer_adjust(sh4.dma_timer[2], attotime_never, 0, attotime_zero); | |
| 4137 | sh4.dma_timer[3] = timer_alloc(sh4_dmac_callback); | |
| 4138 | timer_adjust(sh4.dma_timer[3], attotime_never, 0, attotime_zero); | |
| 4174 | 4139 | |
| 4175 | sh4.refresh_timer = mame_timer_alloc(sh4_refresh_timer_callback); | |
| 4176 | mame_timer_adjust(sh4.refresh_timer, time_never, 0, time_zero); | |
| 4140 | sh4.refresh_timer = timer_alloc(sh4_refresh_timer_callback); | |
| 4141 | timer_adjust(sh4.refresh_timer, attotime_never, 0, attotime_zero); | |
| 4177 | 4142 | sh4.refresh_timer_base = 0; |
| 4178 | 4143 | |
| 4179 | sh4.rtc_timer = mame_timer_alloc(sh4_rtc_timer_callback); | |
| 4180 | mame_timer_adjust(sh4.rtc_timer, time_never, 0, time_zero); | |
| 4144 | sh4.rtc_timer = timer_alloc(sh4_rtc_timer_callback); | |
| 4145 | timer_adjust(sh4.rtc_timer, attotime_never, 0, attotime_zero); | |
| 4181 | 4146 | |
| 4182 | 4147 | sh4.m = auto_malloc(16384*4); |
| 4183 | 4148 |
| r1293 | r1294 | |
|---|---|---|
| 193 | 193 | UINT32 system_clock; |
| 194 | 194 | UINT32 cpu_clock; |
| 195 | 195 | UINT64 count_zero_time; |
| 196 | | |
| 196 | | |
| 197 | 197 | |
| 198 | 198 | /* memory accesses */ |
| 199 | 199 | UINT8 bigendian; |
| r1293 | r1294 | |
|---|---|---|
| 118 | 118 | mips->tlb_table = auto_malloc(sizeof(mips->tlb_table[0]) * (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT))); |
| 119 | 119 | |
| 120 | 120 | /* allocate a timer for the compare interrupt */ |
| 121 | mips->compare_int_timer = | |
| 121 | mips->compare_int_timer = | |
| 122 | 122 | |
| 123 | 123 | /* reset the state */ |
| 124 | 124 | mips3com_reset(mips); |
| r1293 | r1294 | |
| 179 | 179 | UINT32 count = (activecpu_gettotalcycles64() - mips->count_zero_time) / 2; |
| 180 | 180 | UINT32 compare = mips->cpr[0][COP0_Compare]; |
| 181 | 181 | UINT32 cyclesleft = compare - count; |
| 182 | | |
| 182 | | |
| 183 | 183 | |
| 184 | 184 | /* due to accuracy issues, don't bother setting timers unless they're for less than 100msec */ |
| 185 | if (compare_mame_times(newtime, MAME_TIME_IN_MSEC(100)) < 0) | |
| 186 | mame_timer_adjust(mips->compare_int_timer, newtime, cpu_getactivecpu(), time_zero); | |
| 185 | if (attotime_compare(newtime, ATTOTIME_IN_MSEC(100)) < 0) | |
| 186 | timer_adjust(mips->compare_int_timer, newtime, cpu_getactivecpu(), attotime_zero); | |
| 187 | 187 | } |
| 188 | 188 | else |
| 189 | | |
| 189 | | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 |
| r1293 | r1294 | |
|---|---|---|
| 34 | 34 | int priority_line; /* inverted level*/ |
| 35 | 35 | int external_interrupt_line;/* inverted level */ |
| 36 | 36 | |
| 37 | | |
| 37 | | |
| 38 | 38 | } f3853= { { 0 } }; |
| 39 | 39 | #define INTERRUPT_VECTOR(external) (external?f3853.low|(f3853.high<<8)|0x80 \ |
| 40 | 40 | :(f3853.low|(f3853.high<<8))&~0x80) |
| r1293 | r1294 | |
| 56 | 56 | |
| 57 | 57 | static void f3853_timer_start(UINT8 value) |
| 58 | 58 | { |
| 59 | | |
| 59 | | |
| 60 | 60 | |
| 61 | | |
| 61 | | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | static TIMER_CALLBACK( f3853_timer_callback ) |
| r1293 | r1294 | |
| 90 | 90 | |
| 91 | 91 | f3853.priority_line=FALSE; |
| 92 | 92 | f3853.external_interrupt_line=TRUE; |
| 93 | f3853.timer = | |
| 93 | f3853.timer = | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | void f3853_reset(void) |
| r1293 | r1294 | |
|---|---|---|
| 469 | 469 | UINT8 decrementer_enabled; |
| 470 | 470 | UINT16 decrementer_interval; |
| 471 | 471 | UINT16 decrementer_count; /* used in event counter mode*/ |
| 472 | | |
| 472 | | |
| 473 | 473 | #endif |
| 474 | 474 | |
| 475 | 475 | #if (TMS99XX_MODEL == TMS9995_ID) |
| r1293 | r1294 | |
| 929 | 929 | /* read decrementer */ |
| 930 | 930 | if (I.decrementer_enabled && !(I.flag & 1)) |
| 931 | 931 | /* timer mode, timer enabled */ |
| 932 | return ceil( | |
| 932 | return ceil( | |
| 933 | 933 | else |
| 934 | 934 | /* event counter mode or timer mode, timer disabled */ |
| 935 | 935 | return I.decrementer_count; |
| r1293 | r1294 | |
| 993 | 993 | |
| 994 | 994 | if (I.decrementer_enabled && !(I.flag & 1)) |
| 995 | 995 | /* timer mode, timer enabled */ |
| 996 | value = ceil( | |
| 996 | value = ceil( | |
| 997 | 997 | else |
| 998 | 998 | /* event counter mode or timer mode, timer disabled */ |
| 999 | 999 | value = I.decrementer_count; |
| r1293 | r1294 | |
| 1284 | 1284 | I.irq_callback = irqcallback; |
| 1285 | 1285 | |
| 1286 | 1286 | #if (TMS99XX_MODEL == TMS9995_ID) |
| 1287 | I.timer = | |
| 1287 | I.timer = | |
| 1288 | 1288 | #endif |
| 1289 | 1289 | |
| 1290 | 1290 | I.idle_callback = param ? param->idle_callback : NULL; |
| r1293 | r1294 | |
| 1816 | 1816 | */ |
| 1817 | 1817 | static void reset_decrementer(void) |
| 1818 | 1818 | { |
| 1819 | | |
| 1819 | | |
| 1820 | 1820 | |
| 1821 | 1821 | /* reload count */ |
| 1822 | 1822 | I.decrementer_count = I.decrementer_interval; |
| r1293 | r1294 | |
| 1826 | 1826 | |
| 1827 | 1827 | if (I.decrementer_enabled && ! (I.flag & 1)) |
| 1828 | 1828 | { /* timer */ |
| 1829 | mame_time period = MAME_TIME_IN_CYCLES(I.decrementer_interval * 16L, cpu_getactivecpu()); | |
| 1830 | mame_timer_adjust(I.timer, period, 0, period); | |
| 1829 | attotime period = ATTOTIME_IN_CYCLES(I.decrementer_interval * 16L, cpu_getactivecpu()); | |
| 1830 | timer_adjust(I.timer, period, 0, period); | |
| 1831 | 1831 | } |
| 1832 | 1832 | } |
| 1833 | 1833 |
| r1293 | r1294 | |
|---|---|---|
| 143 | 143 | /* 680x registers */ |
| 144 | 144 | static m6800_Regs m6800; |
| 145 | 145 | |
| 146 | static mame_timer *m6800_rx_timer; | |
| 147 | static mame_timer *m6800_tx_timer; | |
| 146 | static emu_timer *m6800_rx_timer; | |
| 147 | static emu_timer *m6800_tx_timer; | |
| 148 | 148 | |
| 149 | 149 | #define m6801 m6800 |
| 150 | 150 | #define m6802 m6800 |
| r1293 | r1294 | |
| 887 | 887 | |
| 888 | 888 | m6800.trcsr = M6800_TRCSR_TDRE; |
| 889 | 889 | m6800.rmcr = 0; |
| 890 | if (m6800_rx_timer) mame_timer_enable(m6800_rx_timer, 0); | |
| 891 | if (m6800_tx_timer) mame_timer_enable(m6800_tx_timer, 0); | |
| 890 | if (m6800_rx_timer) timer_enable(m6800_rx_timer, 0); | |
| 891 | if (m6800_tx_timer) timer_enable(m6800_tx_timer, 0); | |
| 892 | 892 | m6800.txstate = M6800_TX_STATE_INIT; |
| 893 | 893 | m6800.txbits = m6800.rxbits = 0; |
| 894 | 894 | m6800.trcsr_read = 0; |
| r1293 | r1294 | |
| 1274 | 1274 | m6800.irq_callback = irqcallback; |
| 1275 | 1275 | |
| 1276 | 1276 | m6800.clock = clock; |
| 1277 | m6800_rx_timer = mame_timer_alloc(m6800_rx_tick); | |
| 1278 | m6800_tx_timer = mame_timer_alloc(m6800_tx_tick); | |
| 1277 | m6800_rx_timer = timer_alloc(m6800_rx_tick); | |
| 1278 | m6800_tx_timer = timer_alloc(m6800_tx_tick); | |
| 1279 | 1279 | |
| 1280 | 1280 | state_register("m6801", index); |
| 1281 | 1281 | } |
| r1293 | r1294 | |
| 1307 | 1307 | m6800.irq_callback = irqcallback; |
| 1308 | 1308 | |
| 1309 | 1309 | m6800.clock = clock; |
| 1310 | m6800_rx_timer = mame_timer_alloc(m6800_rx_tick); | |
| 1311 | m6800_tx_timer = mame_timer_alloc(m6800_tx_tick); | |
| 1310 | m6800_rx_timer = timer_alloc(m6800_rx_tick); | |
| 1311 | m6800_tx_timer = timer_alloc(m6800_tx_tick); | |
| 1312 | 1312 | |
| 1313 | 1313 | state_register("m6803", index); |
| 1314 | 1314 | } |
| r1293 | r1294 | |
| 1650 | 1650 | m6800.irq_callback = irqcallback; |
| 1651 | 1651 | |
| 1652 | 1652 | m6800.clock = clock; |
| 1653 | m6800_rx_timer = mame_timer_alloc(m6800_rx_tick); | |
| 1654 | m6800_tx_timer = mame_timer_alloc(m6800_tx_tick); | |
| 1653 | m6800_rx_timer = timer_alloc(m6800_rx_tick); | |
| 1654 | m6800_tx_timer = timer_alloc(m6800_tx_tick); | |
| 1655 | 1655 | |
| 1656 | 1656 | state_register("hd63701", index); |
| 1657 | 1657 | } |
| r1293 | r1294 | |
| 2520 | 2520 | { |
| 2521 | 2521 | case 0: |
| 2522 | 2522 | case 3: // not implemented |
| 2523 | mame_timer_enable(m6800_rx_timer, 0); | |
| 2524 | mame_timer_enable(m6800_tx_timer, 0); | |
| 2523 | timer_enable(m6800_rx_timer, 0); | |
| 2524 | timer_enable(m6800_tx_timer, 0); | |
| 2525 | 2525 | break; |
| 2526 | 2526 | |
| 2527 | 2527 | case 1: |
| r1293 | r1294 | |
| 2529 | 2529 | { |
| 2530 | 2530 | int divisor = M6800_RMCR_SS[m6800.rmcr & M6800_RMCR_SS_MASK]; |
| 2531 | 2531 | |
| 2532 | mame_timer_adjust(m6800_rx_timer, time_zero, cpu_getactivecpu(), MAME_TIME_IN_HZ(m6800.clock / divisor)); | |
| 2533 | mame_timer_adjust(m6800_tx_timer, time_zero, cpu_getactivecpu(), MAME_TIME_IN_HZ(m6800.clock / divisor)); | |
| 2532 | timer_adjust(m6800_rx_timer, attotime_zero, cpu_getactivecpu(), ATTOTIME_IN_HZ(m6800.clock / divisor)); | |
| 2533 | timer_adjust(m6800_tx_timer, attotime_zero, cpu_getactivecpu(), ATTOTIME_IN_HZ(m6800.clock / divisor)); | |
| 2534 | 2534 | } |
| 2535 | 2535 | break; |
| 2536 | 2536 | } |
| r1293 | r1294 | |
|---|---|---|
| 94 | 94 | UINT32 bufalloc; /* allocated size of output buffer, in samples */ |
| 95 | 95 | |
| 96 | 96 | /* resampling information */ |
| 97 | s | |
| 97 | attos | |
| 98 | 98 | INT16 gain; /* gain to apply to this input */ |
| 99 | 99 | }; |
| 100 | 100 | |
| r1293 | r1294 | |
| 125 | 125 | UINT32 new_sample_rate; /* newly-set sample rate for the stream */ |
| 126 | 126 | |
| 127 | 127 | /* timing information */ |
| 128 | s | |
| 128 | attos | |
| 129 | 129 | INT32 max_samples_per_update; /* maximum samples per update */ |
| 130 | 130 | |
| 131 | 131 | /* input information */ |
| r1293 | r1294 | |
| 159 | 159 | sound_stream ** stream_tailptr; /* pointer to pointer to last stream */ |
| 160 | 160 | void * current_tag; /* current tag to assign to new streams */ |
| 161 | 161 | int stream_index; /* index of the current stream */ |
| 162 | subseconds_t update_subseconds; /* subseconds between global updates */ | |
| 163 | mame_time last_update; /* last update time */ | |
| 162 | attoseconds_t update_attoseconds; /* attoseconds between global updates */ | |
| 163 | attotime last_update; /* last update time */ | |
| 164 | 164 | }; |
| 165 | 165 | |
| 166 | 166 | |
| r1293 | r1294 | |
| 187 | 187 | time to a sample index in a given stream |
| 188 | 188 | -------------------------------------------------*/ |
| 189 | 189 | |
| 190 | INLINE INT32 time_to_sampindex(const streams_private *strdata, const sound_stream *stream, | |
| 190 | INLINE INT32 time_to_sampindex(const streams_private *strdata, const sound_stream *stream, | |
| 191 | 191 | { |
| 192 | 192 | /* determine the number of samples since the start of this second */ |
| 193 | INT32 sample = (INT32)(time.s | |
| 193 | INT32 sample = (INT32)(time.attos | |
| 194 | 194 | |
| 195 | 195 | /* if we're ahead of the last update, then adjust upwards */ |
| 196 | 196 | if (time.seconds > strdata->last_update.seconds) |
| r1293 | r1294 | |
| 218 | 218 | streams_init - initialize the streams engine |
| 219 | 219 | -------------------------------------------------*/ |
| 220 | 220 | |
| 221 | void streams_init(running_machine *machine, s | |
| 221 | void streams_init(running_machine *machine, attos | |
| 222 | 222 | { |
| 223 | 223 | streams_private *strdata; |
| 224 | 224 | |
| r1293 | r1294 | |
| 228 | 228 | |
| 229 | 229 | /* reset globals */ |
| 230 | 230 | strdata->stream_tailptr = &strdata->stream_head; |
| 231 | strdata->update_s | |
| 231 | strdata->update_attos | |
| 232 | 232 | |
| 233 | 233 | /* set the global pointer */ |
| 234 | 234 | machine->streams_data = strdata; |
| 235 | 235 | |
| 236 | 236 | /* register global states */ |
| 237 | 237 | state_save_register_global(strdata->last_update.seconds); |
| 238 | state_save_register_global(strdata->last_update. | |
| 238 | state_save_register_global(strdata->last_update.attoseconds); | |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | |
| r1293 | r1294 | |
| 247 | 247 | void streams_update(running_machine *machine) |
| 248 | 248 | { |
| 249 | 249 | streams_private *strdata = machine->streams_data; |
| 250 | | |
| 250 | | |
| 251 | 251 | int second_tick = FALSE; |
| 252 | 252 | sound_stream *stream; |
| 253 | 253 | |
| r1293 | r1294 | |
| 466 | 466 | void stream_update(sound_stream *stream) |
| 467 | 467 | { |
| 468 | 468 | streams_private *strdata = Machine->streams_data; |
| 469 | INT32 update_sampindex = time_to_sampindex(strdata, stream, | |
| 469 | INT32 update_sampindex = time_to_sampindex(strdata, stream, | |
| 470 | 470 | |
| 471 | 471 | /* generate samples to get us up to the appropriate time */ |
| 472 | 472 | assert(stream->output_sampindex - stream->output_base_sampindex >= 0); |
| r1293 | r1294 | |
| 597 | 597 | memset(stream->output[outputnum].buffer, 0, stream->output_bufalloc * sizeof(stream->output[outputnum].buffer[0])); |
| 598 | 598 | |
| 599 | 599 | /* recompute the sample indexes to make sense */ |
| 600 | stream->output_sampindex = strdata->last_update.s | |
| 600 | stream->output_sampindex = strdata->last_update.attos | |
| 601 | 601 | stream->output_update_sampindex = stream->output_sampindex; |
| 602 | 602 | stream->output_base_sampindex = stream->output_sampindex - stream->max_samples_per_update; |
| 603 | 603 | } |
| r1293 | r1294 | |
| 673 | 673 | int inputnum; |
| 674 | 674 | |
| 675 | 675 | /* recompute the timing parameters */ |
| 676 | stream->subseconds_per_sample = MAX_SUBSECONDS / stream->sample_rate; | |
| 677 | stream->max_samples_per_update = (strdata->update_subseconds + stream->subseconds_per_sample - 1) / stream->subseconds_per_sample; | |
| 676 | stream->attoseconds_per_sample = ATTOSECONDS_PER_SECOND / stream->sample_rate; | |
| 677 | stream->max_samples_per_update = (strdata->update_attoseconds + stream->attoseconds_per_sample - 1) / stream->attoseconds_per_sample; | |
| 678 | 678 | |
| 679 | 679 | /* update resample and output buffer sizes */ |
| 680 | 680 | allocate_resample_buffers(strdata, stream); |
| r1293 | r1294 | |
| 689 | 689 | if (input->source != NULL) |
| 690 | 690 | { |
| 691 | 691 | sound_stream *input_stream = input->source->owner; |
| 692 | subseconds_t new_subsecs_per_sample = MAX_SUBSECONDS / input_stream->sample_rate; | |
| 693 | subseconds_t latency; | |
| 692 | attoseconds_t new_attosecs_per_sample = ATTOSECONDS_PER_SECOND / input_stream->sample_rate; | |
| 693 | attoseconds_t latency; | |
| 694 | 694 | |
| 695 | 695 | /* okay, we have a new sample rate; recompute the latency to be the maximum |
| 696 | 696 | sample period between us and our input */ |
| 697 | latency = MAX(new_s | |
| 697 | latency = MAX(new_attos | |
| 698 | 698 | |
| 699 | 699 | /* if the input stream's sample rate is lower, we will use linear interpolation */ |
| 700 | 700 | /* this requires an extra sample from the source */ |
| 701 | 701 | if (input_stream->sample_rate < stream->sample_rate) |
| 702 | latency += new_ | |
| 702 | latency += new_attosecs_per_sample; | |
| 703 | 703 | |
| 704 | 704 | /* if our sample rates match exactly, we don't need any latency */ |
| 705 | 705 | else if (input_stream->sample_rate == stream->sample_rate) |
| r1293 | r1294 | |
| 707 | 707 | |
| 708 | 708 | /* we generally don't want to tweak the latency, so we just keep the greatest |
| 709 | 709 | one we've computed thus far */ |
| 710 | input->latency_subseconds = MAX(input->latency_subseconds, latency); | |
| 711 | assert(input->latency_subseconds < strdata->update_subseconds); | |
| 710 | input->latency_attoseconds = MAX(input->latency_attoseconds, latency); | |
| 711 | assert(input->latency_attoseconds < strdata->update_attoseconds); | |
| 712 | 712 | } |
| 713 | 713 | } |
| 714 | 714 | } |
| r1293 | r1294 | |
| 776 | 776 | sound_stream *input_stream; |
| 777 | 777 | stream_sample_t *source; |
| 778 | 778 | stream_sample_t sample; |
| 779 | | |
| 779 | attoseconds_t basetime; | |
| 780 | 780 | INT32 basesample; |
| 781 | 781 | UINT32 basefrac; |
| 782 | 782 | UINT32 step; |
| r1293 | r1294 | |
| 795 | 795 | |
| 796 | 796 | /* determine the time at which the current sample begins, accounting for the |
| 797 | 797 | latency we calculated between the input and output streams */ |
| 798 | basetime = stream->output_sampindex * stream->s | |
| 798 | basetime = stream->output_sampindex * stream->attos | |
| 799 | 799 | |
| 800 | 800 | /* now convert that time into a sample in the input stream */ |
| 801 | 801 | if (basetime >= 0) |
| 802 | basesample = basetime / input_stream-> | |
| 802 | basesample = basetime / input_stream->attoseconds_per_sample; | |
| 803 | 803 | else |
| 804 | basesample = -(-basetime / input_stream-> | |
| 804 | basesample = -(-basetime / input_stream->attoseconds_per_sample) - 1; | |
| 805 | 805 | |
| 806 | 806 | /* compute a source pointer to the first sample */ |
| 807 | 807 | assert(basesample >= input_stream->output_base_sampindex); |
| 808 | 808 | source = output->buffer + (basesample - input_stream->output_base_sampindex); |
| 809 | 809 | |
| 810 | 810 | /* determine the current fraction of a sample */ |
| 811 | basefrac = (basetime - basesample * input_stream->s | |
| 811 | basefrac = (basetime - basesample * input_stream->attos | |
| 812 | 812 | assert(basefrac >= 0); |
| 813 | 813 | assert(basefrac < FRAC_ONE); |
| 814 | 814 |
| r1293 | r1294 | |
|---|---|---|
| 29 | 29 | FUNCTION PROTOTYPES |
| 30 | 30 | ***************************************************************************/ |
| 31 | 31 | |
| 32 | void streams_init(running_machine *machine, | |
| 32 | void streams_init(running_machine *machine, attoseconds_t update_subseconds); | |
| 33 | 33 | void streams_set_tag(running_machine *machine, void *streamtag); |
| 34 | 34 | void streams_update(running_machine *machine); |
| 35 | 35 |
| r1293 | r1294 | |
|---|---|---|
| 228 | 228 | |
| 229 | 229 | |
| 230 | 230 | /*------------------------------------------------- |
| 231 | div_64x32_rem - perform a signed 64 bit x 32 | |
| 232 | bit divide and return the 32 bit quotient and | |
| 233 | 32 bit remainder | |
| 234 | -------------------------------------------------*/ | |
| 235 | ||
| 236 | #ifndef __x86_64__ | |
| 237 | #define div_64x32_rem _div_64x32_rem | |
| 238 | INLINE INT32 _div_64x32_rem(INT64 dividend, INT32 divisor, INT32 *remainder) | |
| 239 | { | |
| 240 | INT32 quotient; | |
| 241 | ||
| 242 | __asm__ ( | |
| 243 | " idivl %[divisor] ;" | |
| 244 | : [result] "=a" (quotient) /* Quotient ends up in eax */ | |
| 245 | , [remainder] "=d" (*remainder) /* Remainder ends up in edx */ | |
| 246 | : [dividend] "A" (dividend) /* 'dividend' in edx:eax */ | |
| 247 | , [divisor] "rm" (divisor) /* 'divisor' in register or memory */ | |
| 248 | : "%cc" /* Clobbers condition codes */ | |
| 249 | ); | |
| 250 | ||
| 251 | return quotient; | |
| 252 | } | |
| 253 | #endif | |
| 254 | ||
| 255 | ||
| 256 | /*------------------------------------------------- | |
| 257 | divu_64x32_rem - perform an unsigned 64 bit x | |
| 258 | 32 bit divide and return the 32 bit quotient | |
| 259 | and 32 bit remainder | |
| 260 | -------------------------------------------------*/ | |
| 261 | ||
| 262 | #ifndef __x86_64__ | |
| 263 | #define divu_64x32_rem _divu_64x32_rem | |
| 264 | INLINE UINT32 _divu_64x32_rem(UINT64 dividend, UINT32 divisor, UINT32 *remainder) | |
| 265 | { | |
| 266 | UINT32 quotient; | |
| 267 | ||
| 268 | __asm__ ( | |
| 269 | " divl %[divisor] ;" | |
| 270 | : [result] "=a" (quotient) /* Quotient ends up in eax */ | |
| 271 | , [remainder] "=d" (*remainder) /* Remainder ends up in edx */ | |
| 272 | : [dividend] "A" (dividend) /* 'dividend' in edx:eax */ | |
| 273 | , [divisor] "rm" (divisor) /* 'divisor' in register or memory */ | |
| 274 | : "%cc" /* Clobbers condition codes */ | |
| 275 | ); | |
| 276 | ||
| 277 | return quotient; | |
| 278 | } | |
| 279 | #endif | |
| 280 | ||
| 281 | ||
| 282 | /*------------------------------------------------- | |
| 231 | 283 | div_32x32_shift - perform a signed divide of |
| 232 | 284 | two 32 bit values, shifting the first before |
| 233 | 285 | division, and returning the 32 bit quotient |
| r1293 | r1294 | |
|---|---|---|
| 262 | 262 | return addr; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | UINT8 cdp1869_read_pageram(UINT16 addr) | |
| 265 | static UINT8 cdp1869_read_pageram(UINT16 addr) | |
| 266 | 266 | { |
| 267 | 267 | if (addr >= cdp1869.pramsize) |
| 268 | 268 | { |
| r1293 | r1294 | |
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | #ifdef UNUSED_FUNCTION | |
| 277 | 278 | UINT8 cdp1869_read_charram(UINT16 addr) |
| 278 | 279 | { |
| 279 | 280 | if (addr >= cdp1869.cramsize) |
| r1293 | r1294 | |
| 285 | 286 | return cdp1869.cram[addr]; |
| 286 | 287 | } |
| 287 | 288 | } |
| 289 | #endif | |
| 288 | 290 | |
| 289 | 291 | WRITE8_HANDLER ( cdp1869_charram_w ) |
| 290 | 292 | { |
| r1293 | r1294 | |
|---|---|---|
| 33 | 33 | UINT8 * latchram; |
| 34 | 34 | UINT8 latchdata; |
| 35 | 35 | UINT8 * shiftreg; |
| 36 | | |
| 36 | | |
| 37 | 37 | struct tms34061_interface intf; |
| 38 | 38 | }; |
| 39 | 39 | |
| r1293 | r1294 | |
| 117 | 117 | tms34061.regs[TMS34061_VERCOUNTER] = 0x0000; |
| 118 | 118 | |
| 119 | 119 | /* start vertical interrupt timer */ |
| 120 | tms34061.timer = | |
| 120 | tms34061.timer = | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | |
| r1293 | r1294 | |
| 145 | 145 | static TIMER_CALLBACK( tms34061_interrupt ) |
| 146 | 146 | { |
| 147 | 147 | /* set timer for next frame */ |
| 148 | | |
| 148 | | |
| 149 | 149 | |
| 150 | 150 | /* set the interrupt bit in the status reg */ |
| 151 | 151 | tms34061.regs[TMS34061_STATUS] |= 1; |
| r1293 | r1294 | |
| 191 | 191 | if (scanline < 0) |
| 192 | 192 | scanline += tms34061.regs[TMS34061_VERTOTAL]; |
| 193 | 193 | |
| 194 | | |
| 194 | | |
| 195 | 195 | break; |
| 196 | 196 | |
| 197 | 197 | /* XY offset: set the X and Y masks */ |
| r1293 | r1294 | |
|---|---|---|
| 197 | 197 | static void init_tmu_shared(tmu_shared_state *s); |
| 198 | 198 | static void init_tmu(voodoo_state *v, tmu_state *t, int type, voodoo_reg *reg, void *memory, int tmem); |
| 199 | 199 | static void soft_reset(voodoo_state *v); |
| 200 | static void check_stalled_cpu(voodoo_state *v, mame_time current_time); | |
| 201 | static void flush_fifos(voodoo_state *v, mame_time current_time); | |
| 200 | static void check_stalled_cpu(voodoo_state *v, attotime current_time); | |
| 201 | static void flush_fifos(voodoo_state *v, attotime current_time); | |
| 202 | 202 | static TIMER_CALLBACK_PTR( stall_cpu_callback ); |
| 203 | static void stall_cpu(voodoo_state *v, int state, | |
| 203 | static void stall_cpu(voodoo_state *v, int state, | |
| 204 | 204 | static TIMER_CALLBACK_PTR( vblank_callback ); |
| 205 | 205 | static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data); |
| 206 | 206 | static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask, int forcefront); |
| r1293 | r1294 | |
| 368 | 368 | v->index = which; |
| 369 | 369 | v->type = type; |
| 370 | 370 | v->chipmask = 0x01; |
| 371 | v->s | |
| 371 | v->attos | |
| 372 | 372 | v->trigger = 51324 + which; |
| 373 | 373 | |
| 374 | 374 | /* build the rasterizer table */ |
| r1293 | r1294 | |
| 380 | 380 | v->pci.fifo.size = 64*2; |
| 381 | 381 | v->pci.fifo.in = v->pci.fifo.out = 0; |
| 382 | 382 | v->pci.stall_state = NOT_STALLED; |
| 383 | v->pci.continue_timer = | |
| 383 | v->pci.continue_timer = | |
| 384 | 384 | |
| 385 | 385 | /* allocate memory */ |
| 386 | 386 | if (type <= VOODOO_2) |
| r1293 | r1294 | |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | /* allocate a VBLANK timer */ |
| 806 | f->vblank_timer = | |
| 806 | f->vblank_timer = | |
| 807 | 807 | f->vblank = FALSE; |
| 808 | 808 | |
| 809 | 809 | /* initialize the memory FIFO */ |
| r1293 | r1294 | |
| 944 | 944 | int threadnum; |
| 945 | 945 | |
| 946 | 946 | /* accumulate/reset statistics from all units */ |
| 947 | for (threadnum = 0; threadnum < | |
| 947 | for (threadnum = 0; threadnum < WORK_MAX_ | |
| 948 | 948 | { |
| 949 | 949 | if (accumulate) |
| 950 | 950 | accumulate_statistics(v, &v->thread_stats[threadnum]); |
| r1293 | r1294 | |
| 1013 | 1013 | /* reset the last_op_time to now and start processing the next command */ |
| 1014 | 1014 | if (v->pci.op_pending) |
| 1015 | 1015 | { |
| 1016 | v->pci.op_end_time = | |
| 1016 | v->pci.op_end_time = | |
| 1017 | 1017 | flush_fifos(v, v->pci.op_end_time); |
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | 1020 | /* we may be able to unstall now */ |
| 1021 | 1021 | if (v->pci.stall_state != NOT_STALLED) |
| 1022 | check_stalled_cpu(v, | |
| 1022 | check_stalled_cpu(v, | |
| 1023 | 1023 | |
| 1024 | 1024 | /* periodically log rasterizer info */ |
| 1025 | 1025 | v->stats.swaps++; |
| r1293 | r1294 | |
| 1082 | 1082 | |
| 1083 | 1083 | static void adjust_vblank_timer(voodoo_state *v) |
| 1084 | 1084 | { |
| 1085 | | |
| 1085 | | |
| 1086 | 1086 | |
| 1087 | 1087 | /* if zero, adjust to next frame, otherwise we may get stuck in an infinite loop */ |
| 1088 | if (compare | |
| 1088 | if (attotime_compare | |
| 1089 | 1089 | vblank_period = video_screen_get_frame_period(v->scrnum); |
| 1090 | | |
| 1090 | | |
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | |
| r1293 | r1294 | |
| 1117 | 1117 | if (v->pci.op_pending) |
| 1118 | 1118 | { |
| 1119 | 1119 | if (LOG_VBLANK_SWAP) logerror("---- vblank flush begin\n"); |
| 1120 | flush_fifos(v, | |
| 1120 | flush_fifos(v, | |
| 1121 | 1121 | if (LOG_VBLANK_SWAP) logerror("---- vblank flush end\n"); |
| 1122 | 1122 | } |
| 1123 | 1123 | |
| r1293 | r1294 | |
| 1135 | 1135 | swap_buffers(v); |
| 1136 | 1136 | |
| 1137 | 1137 | /* set a timer for the next off state */ |
| 1138 | | |
| 1138 | | |
| 1139 | 1139 | |
| 1140 | 1140 | /* set internal state and call the client */ |
| 1141 | 1141 | v->fbi.vblank = TRUE; |
| r1293 | r1294 | |
| 2121 | 2121 | if (cycles > 0) |
| 2122 | 2122 | { |
| 2123 | 2123 | v->pci.op_pending = TRUE; |
| 2124 | v->pci.op_end_time = add_s | |
| 2124 | v->pci.op_end_time = attotime_add_attos | |
| 2125 | 2125 | |
| 2126 | 2126 | if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", v->index, |
| 2127 | mame_timer_get_time().seconds, (UINT32)(mame_timer_get_time().subseconds >> 32), (UINT32)mame_timer_get_time().subseconds, | |
| 2128 | v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.subseconds >> 32), (UINT32)v->pci.op_end_time.subseconds); | |
| 2127 | timer_get_time().seconds, (UINT32)(timer_get_time().attoseconds >> 32), (UINT32)timer_get_time().attoseconds, | |
| 2128 | v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds); | |
| 2129 | 2129 | } |
| 2130 | 2130 | } |
| 2131 | 2131 | } |
| r1293 | r1294 | |
| 2141 | 2141 | |
| 2142 | 2142 | static TIMER_CALLBACK_PTR( stall_cpu_callback ) |
| 2143 | 2143 | { |
| 2144 | check_stalled_cpu(param, | |
| 2144 | check_stalled_cpu(param, | |
| 2145 | 2145 | } |
| 2146 | 2146 | |
| 2147 | 2147 | |
| 2148 | static void check_stalled_cpu(voodoo_state *v, | |
| 2148 | static void check_stalled_cpu(voodoo_state *v, | |
| 2149 | 2149 | { |
| 2150 | 2150 | int resume = FALSE; |
| 2151 | 2151 | |
| r1293 | r1294 | |
| 2194 | 2194 | /* if not, set a timer for the next one */ |
| 2195 | 2195 | else |
| 2196 | 2196 | { |
| 2197 | | |
| 2197 | | |
| 2198 | 2198 | } |
| 2199 | 2199 | } |
| 2200 | 2200 | |
| 2201 | 2201 | |
| 2202 | static void stall_cpu(voodoo_state *v, int state, | |
| 2202 | static void stall_cpu(voodoo_state *v, int state, | |
| 2203 | 2203 | { |
| 2204 | 2204 | /* sanity check */ |
| 2205 | 2205 | if (!v->pci.op_pending) fatalerror("FIFOs not empty, no op pending!"); |
| r1293 | r1294 | |
| 2215 | 2215 | cpu_spinuntil_trigger(v->trigger); |
| 2216 | 2216 | |
| 2217 | 2217 | /* set a timer to clear the stall */ |
| 2218 | | |
| 2218 | | |
| 2219 | 2219 | } |
| 2220 | 2220 | |
| 2221 | 2221 | |
| r1293 | r1294 | |
| 2612 | 2612 | int hbp = (v->reg[backPorch].u & 0xff) + 2; |
| 2613 | 2613 | int vbp = (v->reg[backPorch].u >> 16) & 0xff; |
| 2614 | 2614 | screen_state *state = &Machine->screen[v->scrnum]; |
| 2615 | subseconds_t stdperiod, medperiod, vgaperiod; | |
| 2616 | subseconds_t stddiff, meddiff, vgadiff; | |
| 2615 | attoseconds_t stdperiod, medperiod, vgaperiod; | |
| 2616 | attoseconds_t stddiff, meddiff, vgadiff; | |
| 2617 | 2617 | rectangle visarea; |
| 2618 | 2618 | |
| 2619 | 2619 | /* create a new visarea */ |
| r1293 | r1294 | |
| 2627 | 2627 | visarea.max_y = MIN(visarea.max_y, vtotal - 1); |
| 2628 | 2628 | |
| 2629 | 2629 | /* compute the new period for standard res, medium res, and VGA res */ |
| 2630 | stdperiod = HZ_TO_SUBSECONDS(15750) * vtotal; | |
| 2631 | medperiod = HZ_TO_SUBSECONDS(25000) * vtotal; | |
| 2632 | vgaperiod = HZ_TO_SUBSECONDS(31500) * vtotal; | |
| 2630 | stdperiod = HZ_TO_ATTOSECONDS(15750) * vtotal; | |
| 2631 | medperiod = HZ_TO_ATTOSECONDS(25000) * vtotal; | |
| 2632 | vgaperiod = HZ_TO_ATTOSECONDS(31500) * vtotal; | |
| 2633 | 2633 | |
| 2634 | 2634 | /* compute a diff against the current refresh period */ |
| 2635 | 2635 | stddiff = stdperiod - state->refresh; |
| r1293 | r1294 | |
| 2647 | 2647 | if (stddiff < meddiff && stddiff < vgadiff) |
| 2648 | 2648 | { |
| 2649 | 2649 | video_screen_configure(v->scrnum, htotal, vtotal, &visarea, stdperiod); |
| 2650 | mame_printf_debug("Standard resolution, %f Hz\n", | |
| 2650 | mame_printf_debug("Standard resolution, %f Hz\n", ATTOSECONDS_TO_HZ(stdperiod)); | |
| 2651 | 2651 | } |
| 2652 | 2652 | else if (meddiff < vgadiff) |
| 2653 | 2653 | { |
| 2654 | 2654 | video_screen_configure(v->scrnum, htotal, vtotal, &visarea, medperiod); |
| 2655 | mame_printf_debug("Medium resolution, %f Hz\n", | |
| 2655 | mame_printf_debug("Medium resolution, %f Hz\n", ATTOSECONDS_TO_HZ(medperiod)); | |
| 2656 | 2656 | } |
| 2657 | 2657 | else |
| 2658 | 2658 | { |
| 2659 | 2659 | video_screen_configure(v->scrnum, htotal, vtotal, &visarea, vgaperiod); |
| 2660 | mame_printf_debug("VGA resolution, %f Hz\n", | |
| 2660 | mame_printf_debug("VGA resolution, %f Hz\n", ATTOSECONDS_TO_HZ(vgaperiod)); | |
| 2661 | 2661 | } |
| 2662 | 2662 | |
| 2663 | 2663 | /* configure the new framebuffer info */ |
| r1293 | r1294 | |
| 2957 | 2957 | UINT32 destmax, depthmax; |
| 2958 | 2958 | int sr[2], sg[2], sb[2], sa[2], sw[2]; |
| 2959 | 2959 | int x, y, scry, mask; |
| 2960 | int pix | |
| 2960 | int pix | |
| 2961 | 2961 | |
| 2962 | 2962 | /* statistics */ |
| 2963 | 2963 | v->stats.lfb_writes++; |
| r1293 | r1294 | |
| 3205 | 3205 | COMPUTE_DITHER_POINTERS(v->reg[fbzMode].u, y); |
| 3206 | 3206 | |
| 3207 | 3207 | /* loop over up to two pixels */ |
| 3208 | for (pix | |
| 3208 | for (pix | |
| 3209 | 3209 | { |
| 3210 | 3210 | /* make sure we care about this pixel */ |
| 3211 | 3211 | if (mask & 0x0f) |
| r1293 | r1294 | |
| 3214 | 3214 | if ((mask & LFB_RGB_PRESENT) && bufoffs < destmax) |
| 3215 | 3215 | { |
| 3216 | 3216 | /* apply dithering and write to the screen */ |
| 3217 | APPLY_DITHER(v->reg[fbzMode].u, x, dither_lookup, sr[pixel], sg[pixel], sb[pixel]); | |
| 3218 | dest[bufoffs] = (sr[pixel] << 11) | (sg[pixel] << 5) | sb[pixel]; | |
| 3217 | APPLY_DITHER(v->reg[fbzMode].u, x, dither_lookup, sr[pix], sg[pix], sb[pix]); | |
| 3218 | dest[bufoffs] = (sr[pix] << 11) | (sg[pix] << 5) | sb[pix]; | |
| 3219 | 3219 | } |
| 3220 | 3220 | |
| 3221 | 3221 | /* make sure we have an aux buffer to write to */ |
| r1293 | r1294 | |
| 3223 | 3223 | { |
| 3224 | 3224 | /* write to the alpha buffer */ |
| 3225 | 3225 | if ((mask & LFB_ALPHA_PRESENT) && FBZMODE_ENABLE_ALPHA_PLANES(v->reg[fbzMode].u)) |
| 3226 | depth[bufoffs] = sa[pix | |
| 3226 | depth[bufoffs] = sa[pix | |
| 3227 | 3227 | |
| 3228 | 3228 | /* write to the depth buffer */ |
| 3229 | 3229 | if ((mask & (LFB_DEPTH_PRESENT | LFB_DEPTH_PRESENT_MSW)) && !FBZMODE_ENABLE_ALPHA_PLANES(v->reg[fbzMode].u)) |
| 3230 | depth[bufoffs] = sw[pix | |
| 3230 | depth[bufoffs] = sw[pix | |
| 3231 | 3231 | } |
| 3232 | 3232 | |
| 3233 | 3233 | /* track pixel writes to the frame buffer regardless of mask */ |
| r1293 | r1294 | |
| 3262 | 3262 | COMPUTE_DITHER_POINTERS(v->reg[fbzMode].u, y); |
| 3263 | 3263 | |
| 3264 | 3264 | /* loop over up to two pixels */ |
| 3265 | for (pix | |
| 3265 | for (pix | |
| 3266 | 3266 | { |
| 3267 | 3267 | /* make sure we care about this pixel */ |
| 3268 | 3268 | if (mask & 0x0f) |
| 3269 | 3269 | { |
| 3270 | 3270 | stats_block *stats = &v->fbi.lfb_stats; |
| 3271 | INT64 iterw = sw[pixel] << (30-16); | |
| 3272 | INT32 iterz = sw[pixel] << 12; | |
| 3271 | INT64 iterw = sw[pix] << (30-16); | |
| 3272 | INT32 iterz = sw[pix] << 12; | |
| 3273 | 3273 | rgb_union color; |
| 3274 | 3274 | |
| 3275 | 3275 | /* apply clipping */ |
| r1293 | r1294 | |
| 3290 | 3290 | PIXEL_PIPELINE_BEGIN(v, stats, x, y, v->reg[fbzColorPath].u, v->reg[fbzMode].u, iterz, iterw); |
| 3291 | 3291 | |
| 3292 | 3292 | /* use the RGBA we stashed above */ |
| 3293 | color.rgb.r = r = sr[pixel]; | |
| 3294 | color.rgb.g = g = sg[pixel]; | |
| 3295 | color.rgb.b = b = sb[pixel]; | |
| 3296 | color.rgb.a = a = sa[pixel]; | |
| 3293 | color.rgb.r = r = sr[pix]; | |
| 3294 | color.rgb.g = g = sg[pix]; | |
| 3295 | color.rgb.b = b = sb[pix]; | |
| 3296 | color.rgb.a = a = sa[pix]; | |
| 3297 | 3297 | |
| 3298 | 3298 | /* apply chroma key, alpha mask, and alpha testing */ |
| 3299 | 3299 | APPLY_CHROMAKEY(v, stats, v->reg[fbzMode].u, color); |
| r1293 | r1294 | |
| 3446 | 3446 | * |
| 3447 | 3447 | *************************************/ |
| 3448 | 3448 | |
| 3449 | static void flush_fifos(voodoo_state *v, | |
| 3449 | static void flush_fifos(voodoo_state *v, | |
| 3450 | 3450 | { |
| 3451 | 3451 | static UINT8 in_flush; |
| 3452 | 3452 | |
| r1293 | r1294 | |
| 3458 | 3458 | if (!v->pci.op_pending) fatalerror("flush_fifos called with no pending operation"); |
| 3459 | 3459 | |
| 3460 | 3460 | if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:flush_fifos start -- pending=%d.%08X%08X cur=%d.%08X%08X\n", v->index, |
| 3461 | v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.subseconds >> 32), (UINT32)v->pci.op_end_time.subseconds, | |
| 3462 | current_time.seconds, (UINT32)(current_time.subseconds >> 32), (UINT32)current_time.subseconds); | |
| 3461 | v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds, | |
| 3462 | current_time.seconds, (UINT32)(current_time.attoseconds >> 32), (UINT32)current_time.attoseconds); | |
| 3463 | 3463 | |
| 3464 | 3464 | /* loop while we still have cycles to burn */ |
| 3465 | while (compare | |
| 3465 | while (attotime_compare | |
| 3466 | 3466 | { |
| 3467 | 3467 | INT32 extra_cycles = 0; |
| 3468 | 3468 | INT32 cycles; |
| r1293 | r1294 | |
| 3553 | 3553 | cycles += extra_cycles; |
| 3554 | 3554 | |
| 3555 | 3555 | /* account for those cycles */ |
| 3556 | v->pci.op_end_time = add_s | |
| 3556 | v->pci.op_end_time = attotime_add_attos | |
| 3557 | 3557 | |
| 3558 | 3558 | if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:update -- pending=%d.%08X%08X cur=%d.%08X%08X\n", v->index, |
| 3559 | v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.subseconds >> 32), (UINT32)v->pci.op_end_time.subseconds, | |
| 3560 | current_time.seconds, (UINT32)(current_time.subseconds >> 32), (UINT32)current_time.subseconds); | |
| 3559 | v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds, | |
| 3560 | current_time.seconds, (UINT32)(current_time.attoseconds >> 32), (UINT32)current_time.attoseconds); | |
| 3561 | 3561 | } |
| 3562 | 3562 | |
| 3563 | 3563 | if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:flush_fifos end -- pending command complete at %d.%08X%08X\n", v->index, |
| 3564 | v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.s | |
| 3564 | v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attos | |
| 3565 | 3565 | |
| 3566 | 3566 | in_flush = FALSE; |
| 3567 | 3567 | } |
| r1293 | r1294 | |
| 3587 | 3587 | |
| 3588 | 3588 | /* if we have something pending, flush the FIFOs up to the current time */ |
| 3589 | 3589 | if (v->pci.op_pending) |
| 3590 | flush_fifos(v, | |
| 3590 | flush_fifos(v, | |
| 3591 | 3591 | |
| 3592 | 3592 | /* special handling for registers */ |
| 3593 | 3593 | if ((offset & 0xc00000/4) == 0) |
| r1293 | r1294 | |
| 3667 | 3667 | if (cycles) |
| 3668 | 3668 | { |
| 3669 | 3669 | v->pci.op_pending = TRUE; |
| 3670 | v->pci.op_end_time = add_s | |
| 3670 | v->pci.op_end_time = attotime_add_attos | |
| 3671 | 3671 | |
| 3672 | 3672 | if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", v->index, |
| 3673 | mame_timer_get_time().seconds, (UINT32)(mame_timer_get_time().subseconds >> 32), (UINT32)mame_timer_get_time().subseconds, | |
| 3674 | v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.subseconds >> 32), (UINT32)v->pci.op_end_time.subseconds); | |
| 3673 | timer_get_time().seconds, (UINT32)(timer_get_time().attoseconds >> 32), (UINT32)timer_get_time().attoseconds, | |
| 3674 | v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds); | |
| 3675 | 3675 | } |
| 3676 | 3676 | profiler_mark(PROFILER_END); |
| 3677 | 3677 | return; |
| r1293 | r1294 | |
| 3720 | 3720 | fifo_items(&v->fbi.fifo) >= 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(v->reg[fbiInit0].u)) |
| 3721 | 3721 | { |
| 3722 | 3722 | if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit memory FIFO HWM -- stalling\n", v->index); |
| 3723 | stall_cpu(v, STALLED_UNTIL_FIFO_LWM, | |
| 3723 | stall_cpu(v, STALLED_UNTIL_FIFO_LWM, | |
| 3724 | 3724 | } |
| 3725 | 3725 | } |
| 3726 | 3726 | |
| r1293 | r1294 | |
| 3729 | 3729 | fifo_space(&v->pci.fifo) <= 2 * FBIINIT0_PCI_FIFO_LWM(v->reg[fbiInit0].u)) |
| 3730 | 3730 | { |
| 3731 | 3731 | if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit PCI FIFO free LWM -- stalling\n", v->index); |
| 3732 | stall_cpu(v, STALLED_UNTIL_FIFO_LWM, | |
| 3732 | stall_cpu(v, STALLED_UNTIL_FIFO_LWM, | |
| 3733 | 3733 | } |
| 3734 | 3734 | |
| 3735 | 3735 | /* if we weren't ready, and this is a non-FIFO access, stall until the FIFOs are clear */ |
| 3736 | 3736 | if (stall) |
| 3737 | 3737 | { |
| 3738 | 3738 | if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w wrote non-FIFO register -- stalling until clear\n", v->index); |
| 3739 | stall_cpu(v, STALLED_UNTIL_FIFO_EMPTY, | |
| 3739 | stall_cpu(v, STALLED_UNTIL_FIFO_EMPTY, | |
| 3740 | 3740 | } |
| 3741 | 3741 | |
| 3742 | 3742 | profiler_mark(PROFILER_END); |
| r1293 | r1294 | |
| 4009 | 4009 | { |
| 4010 | 4010 | /* if we have something pending, flush the FIFOs up to the current time */ |
| 4011 | 4011 | if (v->pci.op_pending) |
| 4012 | flush_fifos(v, | |
| 4012 | flush_fifos(v, | |
| 4013 | 4013 | |
| 4014 | 4014 | /* target the appropriate location */ |
| 4015 | 4015 | if (!(offset & (0xc00000/4))) |
| r1293 | r1294 | |
| 4095 | 4095 | |
| 4096 | 4096 | /* if we have something pending, flush the FIFOs up to the current time */ |
| 4097 | 4097 | if (v->pci.op_pending) |
| 4098 | flush_fifos(v, | |
| 4098 | flush_fifos(v, | |
| 4099 | 4099 | |
| 4100 | 4100 | if (offset < 0x80000/4) |
| 4101 | 4101 | result = banshee_io_r(v, offset, mem_mask); |
| r1293 | r1294 | |
| 4128 | 4128 | |
| 4129 | 4129 | /* if we have something pending, flush the FIFOs up to the current time */ |
| 4130 | 4130 | if (v->pci.op_pending) |
| 4131 | flush_fifos(v, | |
| 4131 | flush_fifos(v, | |
| 4132 | 4132 | |
| 4133 | 4133 | if (offset < v->fbi.lfb_base) |
| 4134 | 4134 | { |
| r1293 | r1294 | |
| 4384 | 4384 | { |
| 4385 | 4385 | /* if we have something pending, flush the FIFOs up to the current time */ |
| 4386 | 4386 | if (v->pci.op_pending) |
| 4387 | flush_fifos(v, | |
| 4387 | flush_fifos(v, | |
| 4388 | 4388 | |
| 4389 | 4389 | if (offset < 0x80000/4) |
| 4390 | 4390 | banshee_io_w(v, offset, data, mem_mask); |
| r1293 | r1294 | |
| 4416 | 4416 | |
| 4417 | 4417 | /* if we have something pending, flush the FIFOs up to the current time */ |
| 4418 | 4418 | if (v->pci.op_pending) |
| 4419 | flush_fifos(v, | |
| 4419 | flush_fifos(v, | |
| 4420 | 4420 | |
| 4421 | 4421 | if (offset < v->fbi.lfb_base) |
| 4422 | 4422 | { |
| r1293 | r1294 | |
|---|---|---|
| 12 | 12 | #ifndef __RGBVMX__ |
| 13 | 13 | #define __RGBVMX__ |
| 14 | 14 | |
| 15 | #include <altivec.h> | |
| 15 | 16 | |
| 17 | ||
| 16 | 18 | /*************************************************************************** |
| 17 | 19 | TYPE DEFINITIONS |
| 18 | 20 | ***************************************************************************/ |
| r1293 | r1294 | |
| 60 | 62 | |
| 61 | 63 | INLINE void rgb_to_rgbint(rgbint *rgb, rgb_t color) |
| 62 | 64 | { |
| 63 | vector signed char temp = vec_perm(vec_lde(0, &color), vec_splat_s32(0), vec_lvsl(0, &color)); | |
| 65 | vector signed char temp = (vector signed char)vec_perm((vector signed int)vec_lde(0, &color), vec_splat_s32(0), vec_lvsl(0, &color)); | |
| 64 | 66 | *rgb = vec_mergeh((vector signed char)vec_splat_s32(0), temp); |
| 65 | 67 | } |
| 66 | 68 | |
| r1293 | r1294 | |
| 72 | 74 | |
| 73 | 75 | INLINE void rgba_to_rgbaint(rgbaint *rgb, rgb_t color) |
| 74 | 76 | { |
| 75 | vector signed char temp = vec_perm(vec_lde(0, &color), vec_splat_s32(0), vec_lvsl(0, &color)); | |
| 77 | vector signed char temp = (vector signed char)vec_perm((vector signed int)vec_lde(0, &color), vec_splat_s32(0), vec_lvsl(0, &color)); | |
| 76 | 78 | *rgb = vec_mergeh((vector signed char)vec_splat_s32(0), temp); |
| 77 | 79 | } |
| 78 | 80 | |
| r1293 | r1294 | |
| 84 | 86 | |
| 85 | 87 | INLINE rgb_t rgbint_to_rgb(const rgbint *color) |
| 86 | 88 | { |
| 87 | vector signed int temp = vec_splat((vector signed int)vec_packsu(*color, *color), 0); | |
| 89 | vector unsigned int temp = vec_splat((vector unsigned int)vec_packsu(*color, *color), 0); | |
| 88 | 90 | rgb_t result; |
| 89 | 91 | vec_ste(temp, 0, &result); |
| 90 | 92 | return result; |
| r1293 | r1294 | |
| 98 | 100 | |
| 99 | 101 | INLINE rgb_t rgbaint_to_rgba(const rgbaint *color) |
| 100 | 102 | { |
| 101 | vector signed int temp = vec_splat((vector signed int)vec_packsu(*color, *color), 0); | |
| 103 | vector unsigned int temp = vec_splat((vector unsigned int)vec_packsu(*color, *color), 0); | |
| 102 | 104 | rgb_t result; |
| 103 | 105 | vec_ste(temp, 0, &result); |
| 104 | 106 | return result; |
| r1293 | r1294 | |
| 113 | 115 | |
| 114 | 116 | INLINE rgb_t rgbint_to_rgb_clamp(const rgbint *color) |
| 115 | 117 | { |
| 116 | vector signed int temp = vec_splat((vector signed int)vec_packsu(*color, *color), 0); | |
| 118 | vector unsigned int temp = vec_splat((vector unsigned int)vec_packsu(*color, *color), 0); | |
| 117 | 119 | rgb_t result; |
| 118 | 120 | vec_ste(temp, 0, &result); |
| 119 | 121 | return result; |
| r1293 | r1294 | |
| 128 | 130 | |
| 129 | 131 | INLINE rgb_t rgbaint_to_rgba_clamp(const rgbaint *color) |
| 130 | 132 | { |
| 131 | vector signed int temp = vec_splat((vector signed int)vec_packsu(*color, *color), 0); | |
| 133 | vector unsigned int temp = vec_splat((vector unsigned int)vec_packsu(*color, *color), 0); | |
| 132 | 134 | rgb_t result; |
| 133 | 135 | vec_ste(temp, 0, &result); |
| 134 | 136 | return result; |
| r1293 | r1294 | |
| 359 | 361 | |
| 360 | 362 | INLINE void rgbint_blend(rgbint *color1, const rgbint *color2, UINT8 color1scale) |
| 361 | 363 | { |
| 364 | vector signed int temp; | |
| 362 | 365 | *color1 = vec_mergeh(*color1, *color2); |
| 363 | vector signed int temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale], vec_splat_s32(0)); | |
| 364 | temp = vec_sr(temp, vec_splat_s32(8)); | |
| 366 | temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale], vec_splat_s32(0)); | |
| 367 | temp = (vector signed int)vec_sr(temp, vec_splat_u32(8)); | |
| 365 | 368 | *color1 = vec_packs(temp, temp); |
| 366 | 369 | } |
| 367 | 370 | |
| r1293 | r1294 | |
| 373 | 376 | |
| 374 | 377 | INLINE void rgbaint_blend(rgbaint *color1, const rgbaint *color2, UINT8 color1scale) |
| 375 | 378 | { |
| 379 | vector signed int temp; | |
| 376 | 380 | *color1 = vec_mergeh(*color1, *color2); |
| 377 | vector signed int temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale], vec_splat_s32(0)); | |
| 378 | temp = vec_sr(temp, vec_splat_s32(8)); | |
| 381 | temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale], vec_splat_s32(0)); | |
| 382 | temp = (vector signed int)vec_sr(temp, vec_splat_u32(8)); | |
| 379 | 383 | *color1 = vec_packs(temp, temp); |
| 380 | 384 | } |
| 381 | 385 | |
| r1293 | r1294 | |
| 390 | 394 | { |
| 391 | 395 | rgbint splatmap = vec_splat((rgbint)vec_lvsl(0, &colorscale), 0); |
| 392 | 396 | rgbint vecscale = vec_lde(0, &colorscale); |
| 393 | vecscale = vec_perm(vecscale, vecscale, splatmap); | |
| 394 | *color = vec_mergeh(*color, vec_splat_s32(0)); | |
| 395 | vector signed int temp = vec_msum(*color, vecscale, vec_splat_s32(0)); | |
| 396 | temp = vec_sr(temp, vec_splat_s32(8)); | |
| 397 | vector signed int temp; | |
| 398 | vecscale = (rgbint)vec_perm(vecscale, vecscale, (vector unsigned char)splatmap); | |
| 399 | *color = (rgbint)vec_mergeh(*color, (rgbint)vec_splat_s32(0)); | |
| 400 | temp = vec_msum(*color, vecscale, vec_splat_s32(0)); | |
| 401 | temp = (vector signed int)vec_sr(temp, vec_splat_u32(8)); | |
| 397 | 402 | *color = vec_min(vec_packs(temp, temp), rgbvmx_statics.maxbyte); |
| 398 | 403 | } |
| 399 | 404 | |
| r1293 | r1294 | |
| 408 | 413 | { |
| 409 | 414 | rgbaint splatmap = vec_splat((rgbaint)vec_lvsl(0, &colorscale), 0); |
| 410 | 415 | rgbaint vecscale = vec_lde(0, &colorscale); |
| 411 | vecscale = vec_perm(vecscale, vecscale, splatmap); | |
| 412 | *color = vec_mergeh(*color, vec_splat_s32(0)); | |
| 413 | vector signed int temp = vec_msum(*color, vecscale, vec_splat_s32(0)); | |
| 414 | temp = vec_sr(temp, vec_splat_s32(8)); | |
| 416 | vector signed int temp; | |
| 417 | vecscale = (rgbaint)vec_perm(vecscale, vecscale, (vector unsigned char)splatmap); | |
| 418 | *color = (rgbaint)vec_mergeh(*color, (rgbaint)vec_splat_s32(0)); | |
| 419 | temp = vec_msum(*color, vecscale, vec_splat_s32(0)); | |
| 420 | temp = (vector signed int)vec_sr(temp, vec_splat_u32(8)); | |
| 415 | 421 | *color = vec_min(vec_packs(temp, temp), rgbvmx_statics.maxbyte); |
| 416 | 422 | } |
| 417 | 423 | |
| r1293 | r1294 | |
| 423 | 429 | |
| 424 | 430 | INLINE rgb_t rgb_bilinear_filter(rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v) |
| 425 | 431 | { |
| 426 | rgbint color00 = vec_perm(vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00)); | |
| 427 | rgbint color01 = vec_perm(vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01)); | |
| 428 | rgbint color10 = vec_perm(vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10)); | |
| 429 | rgbint color11 = vec_perm(vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11)); | |
| 432 | rgb_t result; | |
| 433 | rgbint color00 = (rgbint)vec_perm((vector signed int)vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00)); | |
| 434 | rgbint color01 = (rgbint)vec_perm((vector signed int)vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01)); | |
| 435 | rgbint color10 = (rgbint)vec_perm((vector signed int)vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10)); | |
| 436 | rgbint color11 = (rgbint)vec_perm((vector signed int)vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11)); | |
| 430 | 437 | |
| 431 | 438 | /* interleave color01 and color00 at the byte level */ |
| 432 | 439 | color01 = vec_mergeh((vector signed char)color01, (vector signed char)color00); |
| r1293 | r1294 | |
| 435 | 442 | color11 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11); |
| 436 | 443 | color01 = vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); |
| 437 | 444 | color11 = vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); |
| 438 | color01 = vec_sr((vector signed int)color01, vec_splat_s32(1)); | |
| 439 | color11 = vec_sl((vector signed int)color11, vec_splat_s32(15)); | |
| 445 | color01 = (rgbint)vec_sr((vector signed int)color01, vec_splat_u32(1)); | |
| 446 | color11 = (rgbint)vec_sl((vector signed int)color11, vec_splat_u32(15)); | |
| 440 | 447 | color01 = vec_max(color01, color11); |
| 441 | 448 | color01 = vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0)); |
| 442 | color01 = vec_sr((vector signed int)color01, vec_splat_ | |
| 449 | color01 = (rgbint)vec_sr((vector signed int)color01, vec_splat_u32(15)); | |
| 443 | 450 | color01 = vec_packs((vector signed int)color01, (vector signed int)color01); |
| 444 | 451 | color01 = vec_packsu(color01, color01); |
| 445 | rgb_t result; | |
| 446 | vec_ste((vector signed int)color01, 0, &result); | |
| 452 | vec_ste((vector unsigned int)color01, 0, &result); | |
| 447 | 453 | return result; |
| 448 | 454 | } |
| 449 | 455 | |
| r1293 | r1294 | |
| 455 | 461 | |
| 456 | 462 | INLINE rgb_t rgba_bilinear_filter(rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v) |
| 457 | 463 | { |
| 458 | rgbaint color00 = vec_perm(vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00)); | |
| 459 | rgbaint color01 = vec_perm(vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01)); | |
| 460 | rgbaint color10 = vec_perm(vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10)); | |
| 461 | rgbaint color11 = vec_perm(vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11)); | |
| 464 | rgb_t result; | |
| 465 | rgbaint color00 = (rgbaint)vec_perm((vector signed int)vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00)); | |
| 466 | rgbaint color01 = (rgbaint)vec_perm((vector signed int)vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01)); | |
| 467 | rgbaint color10 = (rgbaint)vec_perm((vector signed int)vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10)); | |
| 468 | rgbaint color11 = (rgbaint)vec_perm((vector signed int)vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11)); | |
| 462 | 469 | |
| 463 | 470 | /* interleave color01 and color00 at the byte level */ |
| 464 | 471 | color01 = vec_mergeh((vector signed char)color01, (vector signed char)color00); |
| r1293 | r1294 | |
| 467 | 474 | color11 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11); |
| 468 | 475 | color01 = vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); |
| 469 | 476 | color11 = vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); |
| 470 | color01 = vec_sr((vector signed int)color01, vec_splat_s32(1)); | |
| 471 | color11 = vec_sl((vector signed int)color11, vec_splat_s32(15)); | |
| 477 | color01 = (rgbaint)vec_sr((vector signed int)color01, vec_splat_u32(1)); | |
| 478 | color11 = (rgbaint)vec_sl((vector signed int)color11, vec_splat_u32(15)); | |
| 472 | 479 | color01 = vec_max(color01, color11); |
| 473 | 480 | color01 = vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0)); |
| 474 | color01 = vec_sr((vector signed int)color01, vec_splat_ | |
| 481 | color01 = (rgbaint)vec_sr((vector signed int)color01, vec_splat_u32(15)); | |
| 475 | 482 | color01 = vec_packs((vector signed int)color01, (vector signed int)color01); |
| 476 | 483 | color01 = vec_packsu(color01, color01); |
| 477 | rgb_t result; | |
| 478 | vec_ste((vector signed int)color01, 0, &result); | |
| 484 | vec_ste((vector unsigned int)color01, 0, &result); | |
| 479 | 485 | return result; |
| 480 | 486 | } |
| 481 | 487 | |
| r1293 | r1294 | |
| 487 | 493 | |
| 488 | 494 | INLINE void rgbint_bilinear_filter(rgbint *color, rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v) |
| 489 | 495 | { |
| 490 | rgbaint color00 = vec_perm(vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00)); | |
| 491 | rgbaint color01 = vec_perm(vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01)); | |
| 492 | rgbaint color10 = vec_perm(vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10)); | |
| 493 | rgbaint color11 = vec_perm(vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11)); | |
| 496 | rgbint color00 = (rgbint)vec_perm((vector signed int)vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00)); | |
| 497 | rgbint color01 = (rgbint)vec_perm((vector signed int)vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01)); | |
| 498 | rgbint color10 = (rgbint)vec_perm((vector signed int)vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10)); | |
| 499 | rgbint color11 = (rgbint)vec_perm((vector signed int)vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11)); | |
| 494 | 500 | |
| 495 | 501 | /* interleave color01 and color00 at the byte level */ |
| 496 | 502 | color01 = vec_mergeh((vector signed char)color01, (vector signed char)color00); |
| r1293 | r1294 | |
| 499 | 505 | color11 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11); |
| 500 | 506 | color01 = vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); |
| 501 | 507 | color11 = vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); |
| 502 | color01 = vec_sr((vector signed int)color01, vec_splat_s32(1)); | |
| 503 | color11 = vec_sl((vector signed int)color11, vec_splat_s32(15)); | |
| 508 | color01 = (rgbint)vec_sr((vector signed int)color01, vec_splat_u32(1)); | |
| 509 | color11 = (rgbint)vec_sl((vector signed int)color11, vec_splat_u32(15)); | |
| 504 | 510 | color01 = vec_max(color01, color11); |
| 505 | 511 | color01 = vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0)); |
| 506 | color01 = vec_sr((vector signed int)color01, vec_splat_ | |
| 512 | color01 = (rgbint)vec_sr((vector signed int)color01, vec_splat_u32(15)); | |
| 507 | 513 | *color = vec_packs((vector signed int)color01, (vector signed int)color01); |
| 508 | 514 | } |
| 509 | 515 | |
| r1293 | r1294 | |
| 515 | 521 | |
| 516 | 522 | INLINE void rgbaint_bilinear_filter(rgbaint *color, rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v) |
| 517 | 523 | { |
| 518 | rgbaint color00 = vec_perm(vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00)); | |
| 519 | rgbaint color01 = vec_perm(vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01)); | |
| 520 | rgbaint color10 = vec_perm(vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10)); | |
| 521 | rgbaint color11 = vec_perm(vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11)); | |
| 524 | rgbaint color00 = (rgbaint)vec_perm((vector signed int)vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00)); | |
| 525 | rgbaint color01 = (rgbaint)vec_perm((vector signed int)vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01)); | |
| 526 | rgbaint color10 = (rgbaint)vec_perm((vector signed int)vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10)); | |
| 527 | rgbaint color11 = (rgbaint)vec_perm((vector signed int)vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11)); | |
| 522 | 528 | |
| 523 | 529 | /* interleave color01 and color00 at the byte level */ |
| 524 | 530 | color01 = vec_mergeh((vector signed char)color01, (vector signed char)color00); |
| r1293 | r1294 | |
| 527 | 533 | color11 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11); |
| 528 | 534 | color01 = vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); |
| 529 | 535 | color11 = vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); |
| 530 | color01 = vec_sr((vector signed int)color01, vec_splat_s32(1)); | |
| 531 | color11 = vec_sl((vector signed int)color11, vec_splat_s32(15)); | |
| 536 | color01 = (rgbaint)vec_sr((vector signed int)color01, vec_splat_u32(1)); | |
| 537 | color11 = (rgbaint)vec_sl((vector signed int)color11, vec_splat_u32(15)); | |
| 532 | 538 | color01 = vec_max(color01, color11); |
| 533 | 539 | color01 = vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0)); |
| 534 | color01 = vec_sr((vector signed int)color01, vec_splat_ | |
| 540 | color01 = (rgbaint)vec_sr((vector signed int)color01, vec_splat_u32(15)); | |
| 535 | 541 | *color = vec_packs((vector signed int)color01, (vector signed int)color01); |
| 536 | 542 | } |
| 537 | 543 |
| r1293 | r1294 | |
|---|---|---|
| 1434 | 1434 | UINT8 stall_state; /* state of the system if we're stalled */ |
| 1435 | 1435 | void (*stall_callback)(int); /* callback for stalling/unstalling */ |
| 1436 | 1436 | UINT8 op_pending; /* true if an operation is pending */ |
| 1437 | mame_time op_end_time; /* time when the pending operation ends */ | |
| 1438 | mame_timer *continue_timer; /* timer to use to continue processing */ | |
| 1437 | attotime op_end_time; /* time when the pending operation ends */ | |
| 1438 | emu_timer *continue_timer; /* timer to use to continue processing */ | |
| 1439 | 1439 | UINT32 fifo_mem[64*2]; /* memory backing the PCI FIFO */ |
| 1440 | 1440 | }; |
| 1441 | 1441 | |
| r1293 | r1294 | |
| 1549 | 1549 | UINT32 tile_height; /* height of video tiles */ |
| 1550 | 1550 | UINT32 x_tiles; /* number of tiles in the X direction */ |
| 1551 | 1551 | |
| 1552 | | |
| 1552 | | |
| 1553 | 1553 | UINT8 vblank; /* VBLANK state */ |
| 1554 | 1554 | UINT8 vblank_count; /* number of VBLANKs since last swap */ |
| 1555 | 1555 | UINT8 vblank_swap_pending; /* a swap is pending, waiting for a vblank */ |
| r1293 | r1294 | |
| 1675 | 1675 | UINT8 type; /* type of system */ |
| 1676 | 1676 | UINT8 chipmask; /* mask for which chips are available */ |
| 1677 | 1677 | UINT32 freq; /* operating frequency */ |
| 1678 | s | |
| 1678 | attos | |
| 1679 | 1679 | UINT32 extra_cycles; /* extra cycles not yet accounted for */ |
| 1680 | 1680 | int trigger; /* trigger used for stalling */ |
| 1681 | 1681 |
| r1293 | r1294 | |
|---|---|---|
| 35 | 35 | UINT16 cursor; |
| 36 | 36 | UINT16 light_pen; |
| 37 | 37 | |
| 38 | | |
| 38 | | |
| 39 | 39 | |
| 40 | 40 | /* saved screen parameters so we don't call |
| 41 | 41 | video_screen_configure() unneccessarily. |
| r1293 | r1294 | |
| 98 | 98 | /* create the timer if the user is interested in getting display enable |
| 99 | 99 | notifications */ |
| 100 | 100 | if (intf->display_enable_changed) |
| 101 | chip->display_enable_changed_timer = | |
| 101 | chip->display_enable_changed_timer = | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
| r1293 | r1294 | |
| 250 | 250 | { |
| 251 | 251 | rectangle visarea; |
| 252 | 252 | |
| 253 | s | |
| 253 | attos | |
| 254 | 254 | |
| 255 | 255 | visarea.min_x = 0; |
| 256 | 256 | visarea.min_y = 0; |
| r1293 | r1294 | |
| 258 | 258 | visarea.max_y = max_y; |
| 259 | 259 | |
| 260 | 260 | if (LOG) logerror("CRTC6845 config screen: HTOTAL: %x VTOTAL: %x MAX_X: %x MAX_Y: %x FPS: %f\n", |
| 261 | horiz_total, vert_total, max_x, max_y, 1 / | |
| 261 | horiz_total, vert_total, max_x, max_y, 1 / ATTOSECONDS_TO_DOUBLE(refresh)); | |
| 262 | 262 | |
| 263 | 263 | video_screen_configure(chip->intf->scrnum, horiz_total, vert_total, &visarea, refresh); |
| 264 | 264 | |
| r1293 | r1294 | |
| 291 | 291 | { |
| 292 | 292 | INT16 next_y; |
| 293 | 293 | UINT16 next_x; |
| 294 | | |
| 294 | | |
| 295 | 295 | |
| 296 | 296 | if (chip->has_valid_parameters && (chip->display_enable_changed_timer != 0)) |
| 297 | 297 | { |
| r1293 | r1294 | |
| 332 | 332 | if (next_y != -1) |
| 333 | 333 | duration = video_screen_get_time_until_pos(chip->intf->scrnum, next_y, next_x); |
| 334 | 334 | else |
| 335 | duration = time_never; | |
| 335 | duration = attotime_never; | |
| 336 | 336 | |
| 337 | | |
| 337 | | |
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 |
| r1293 | r1294 | |
|---|---|---|
| 705 | 705 | fprintf(out, " height=\"%d\"", dy); |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | fprintf(out, " refresh=\"%f\"", | |
| 708 | fprintf(out, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(driver.screen[scrnum].defstate.refresh)); | |
| 709 | 709 | |
| 710 | 710 | fprintf(out, " />\n"); |
| 711 | 711 | } |
| r1293 | r1294 | |
|---|---|---|
| 148 | 148 | extern const options_entry mame_core_options[]; |
| 149 | 149 | |
| 150 | 150 | |
| 151 | ||
| 151 | 152 | /*************************************************************************** |
| 152 | 153 | FUNCTION PROTOTYPES |
| 153 | 154 | ***************************************************************************/ |
| r1293 | r1294 | |
|---|---|---|
| 1191 | 1191 | char *bufptr = buf; |
| 1192 | 1192 | UINT32 selected = 0; |
| 1193 | 1193 | int ctrnum; |
| 1194 | | |
| 1194 | | |
| 1195 | 1195 | |
| 1196 | 1196 | /* show total time first */ |
| 1197 | total_time = | |
| 1197 | total_time = | |
| 1198 | 1198 | if (total_time.seconds >= 60 * 60) |
| 1199 | 1199 | bufptr += sprintf(bufptr, "%s: %d:%02d:%02d\n\n", ui_getstring(UI_totaltime), total_time.seconds / (60*60), (total_time.seconds / 60) % 60, total_time.seconds % 60); |
| 1200 | 1200 | else |
| r1293 | r1294 | |
|---|---|---|
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | /*------------------------------------------------- |
| 150 | div_64x32_rem - perform a signed 64 bit x 32 | |
| 151 | bit divide and return the 32 bit quotient and | |
| 152 | 32 bit remainder | |
| 153 | -------------------------------------------------*/ | |
| 154 | ||
| 155 | #ifndef div_64x32_rem | |
| 156 | INLINE INT32 div_64x32_rem(INT64 a, INT32 b, INT32 *remainder) | |
| 157 | { | |
| 158 | *remainder = a % (INT64)b; | |
| 159 | return a / (INT64)b; | |
| 160 | } | |
| 161 | #endif | |
| 162 | ||
| 163 | ||
| 164 | /*------------------------------------------------- | |
| 165 | divu_64x32_rem - perform an unsigned 64 bit x | |
| 166 | 32 bit divide and return the 32 bit quotient | |
| 167 | and 32 bit remainder | |
| 168 | -------------------------------------------------*/ | |
| 169 | ||
| 170 | #ifndef divu_64x32_rem | |
| 171 | INLINE UINT32 divu_64x32_rem(UINT64 a, UINT32 b, UINT32 *remainder) | |
| 172 | { | |
| 173 | *remainder = a % (UINT64)b; | |
| 174 | return a / (UINT64)b; | |
| 175 | } | |
| 176 | #endif | |
| 177 | ||
| 178 | ||
| 179 | /*------------------------------------------------- | |
| 150 | 180 | div_32x32_shift - perform a signed divide of |
| 151 | 181 | two 32 bit values, shifting the first before |
| 152 | 182 | division, and returning the 32 bit quotient |
| r1293 | r1294 | |
|---|---|---|
| 36 | 36 | CONSTANTS |
| 37 | 37 | ***************************************************************************/ |
| 38 | 38 | |
| 39 | #define SUBSECONDS_PER_SPEED_UPDATE ( | |
| 39 | #define SUBSECONDS_PER_SPEED_UPDATE ( | |
| 40 | 40 | #define PAUSED_REFRESH_RATE 30 |
| 41 | 41 | |
| 42 | 42 | |
| r1293 | r1294 | |
| 62 | 62 | INT32 last_partial_scan; /* scanline of last partial update */ |
| 63 | 63 | |
| 64 | 64 | /* screen timing */ |
| 65 | subseconds_t scantime; /* subseconds per scanline */ | |
| 66 | subseconds_t pixeltime; /* subseconds per pixel */ | |
| 67 | mame_time vblank_time; /* time of last VBLANK start */ | |
| 68 | mame_timer * scanline0_timer; /* scanline 0 timer */ | |
| 65 | attoseconds_t scantime; /* attoseconds per scanline */ | |
| 66 | attoseconds_t pixeltime; /* attoseconds per pixel */ | |
| 67 | attotime vblank_time; /* time of last VBLANK start */ | |
| 68 | emu_timer * scanline0_timer; /* scanline 0 timer */ | |
| 69 | 69 | |
| 70 | 70 | /* movie recording */ |
| 71 | 71 | mame_file * movie_file; /* handle to the open movie file */ |
| r1293 | r1294 | |
| 97 | 97 | { |
| 98 | 98 | /* throttling calculations */ |
| 99 | 99 | osd_ticks_t throttle_last_ticks;/* osd_ticks the last call to throttle */ |
| 100 | mame_time throttle_realtime; /* real time the last call to throttle */ | |
| 101 | mame_time throttle_emutime; /* emulated time the last call to throttle */ | |
| 100 | attotime throttle_realtime; /* real time the last call to throttle */ | |
| 101 | attotime throttle_emutime; /* emulated time the last call to throttle */ | |
| 102 | 102 | UINT32 throttle_history; /* history of frames where we were fast enough */ |
| 103 | 103 | |
| 104 | 104 | /* dynamic speed computation */ |
| 105 | 105 | osd_ticks_t speed_last_realtime;/* real time at the last speed calculation */ |
| 106 | | |
| 106 | | |
| 107 | 107 | double speed_percent; /* most recent speed percentage */ |
| 108 | 108 | UINT32 partial_updates_this_frame;/* partial update counter this frame */ |
| 109 | 109 | |
| 110 | 110 | /* overall speed computation */ |
| 111 | 111 | UINT32 overall_real_seconds;/* accumulated real seconds at normal speed */ |
| 112 | 112 | osd_ticks_t overall_real_ticks; /* accumulated real ticks at normal speed */ |
| 113 | | |
| 113 | | |
| 114 | 114 | UINT32 overall_valid_counter;/* number of consecutive valid time periods */ |
| 115 | 115 | |
| 116 | 116 | /* configuration */ |
| r1293 | r1294 | |
| 177 | 177 | static int finish_screen_updates(running_machine *machine); |
| 178 | 178 | |
| 179 | 179 | /* throttling/frameskipping/performance */ |
| 180 | static void update_throttle( | |
| 180 | static void update_throttle( | |
| 181 | 181 | static osd_ticks_t throttle_until_ticks(osd_ticks_t target_ticks); |
| 182 | 182 | static void update_frameskip(void); |
| 183 | static void recompute_speed( | |
| 183 | static void recompute_speed( | |
| 184 | 184 | |
| 185 | 185 | /* screen snapshots */ |
| 186 | 186 | static mame_bitmap *get_snapshot_bitmap(running_machine *machine, int scrnum); |
| r1293 | r1294 | |
| 301 | 301 | internal_screen_info *info = &viddata->scrinfo[scrnum]; |
| 302 | 302 | |
| 303 | 303 | /* allocate a timer to reset partial updates */ |
| 304 | info->scanline0_timer = | |
| 304 | info->scanline0_timer = | |
| 305 | 305 | |
| 306 | 306 | /* make pointers back to the config and state */ |
| 307 | 307 | info->config = &machine->drv->screen[scrnum]; |
| r1293 | r1294 | |
| 321 | 321 | render_container_set_yscale(container, info->config->yscale); |
| 322 | 322 | |
| 323 | 323 | /* reset VBLANK timing */ |
| 324 | info->vblank_time = sub_s | |
| 324 | info->vblank_time = attotime_sub_attos | |
| 325 | 325 | |
| 326 | 326 | /* register for save states */ |
| 327 | 327 | state_save_register_item("video", scrnum, info->vblank_time.seconds); |
| 328 | state_save_register_item("video", scrnum, info->vblank_time. | |
| 328 | state_save_register_item("video", scrnum, info->vblank_time.attoseconds); | |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /* create spriteram buffers if necessary */ |
| r1293 | r1294 | |
| 415 | 415 | { |
| 416 | 416 | osd_ticks_t tps = osd_ticks_per_second(); |
| 417 | 417 | double final_real_time = (double)global.overall_real_seconds + (double)global.overall_real_ticks / (double)tps; |
| 418 | double final_emu_time = mame_time_to_double(global.overall_emutime); | |
| 419 | mame_printf_info("Average speed: %.2f%% (%d seconds)\n", 100 * final_emu_time / final_real_time, add_subseconds_to_mame_time(global.overall_emutime, MAX_SUBSECONDS / 2).seconds); | |
| 418 | double final_emu_time = attotime_to_double(global.overall_emutime); | |
| 419 | mame_printf_info("Average speed: %.2f%% (%d seconds)\n", 100 * final_emu_time / final_real_time, attotime_add_attoseconds(global.overall_emutime, ATTOSECONDS_PER_SECOND / 2).seconds); | |
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | |
| r1293 | r1294 | |
| 429 | 429 | void video_vblank_start(running_machine *machine) |
| 430 | 430 | { |
| 431 | 431 | video_private *viddata = machine->video_data; |
| 432 | | |
| 432 | | |
| 433 | 433 | int scrnum; |
| 434 | 434 | |
| 435 | 435 | /* kludge: we get called at time 0 to reset, but at that point, |
| 436 | 436 | the time of last VBLANK is actually -vblank_duration */ |
| 437 | if (curtime.seconds == 0 && curtime.subseconds == 0) | |
| 438 | curtime = sub_subseconds_from_mame_time(time_zero, machine->screen[0].vblank); | |
| 437 | if (curtime.seconds == 0 && curtime.attoseconds == 0) | |
| 438 | curtime = attotime_sub_attoseconds(attotime_zero, machine->screen[0].vblank); | |
| 439 | 439 | |
| 440 | 440 | /* reset VBLANK timers for each screen -- fix me */ |
| 441 | 441 | for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++) |
| r1293 | r1294 | |
| 647 | 647 | of a screen |
| 648 | 648 | -------------------------------------------------*/ |
| 649 | 649 | |
| 650 | void video_screen_configure(int scrnum, int width, int height, const rectangle *visarea, | |
| 650 | void video_screen_configure(int scrnum, int width, int height, const rectangle *visarea, attoseconds_t refresh) | |
| 651 | 651 | { |
| 652 | 652 | video_private *viddata = Machine->video_data; |
| 653 | 653 | internal_screen_info *info = &viddata->scrinfo[scrnum]; |
| r1293 | r1294 | |
| 727 | 727 | float minrefresh = render_get_max_update_rate(); |
| 728 | 728 | if (minrefresh != 0) |
| 729 | 729 | { |
| 730 | UINT32 target_speed = floor(minrefresh * 100.0 / | |
| 730 | UINT32 target_speed = floor(minrefresh * 100.0 / ATTOSECONDS_TO_HZ(refresh)); | |
| 731 | 731 | target_speed = MIN(target_speed, global.original_speed); |
| 732 | 732 | if (target_speed != global.speed) |
| 733 | 733 | { |
| r1293 | r1294 | |
| 743 | 743 | /* if we are on scanline 0 already, reset the update timer immediately */ |
| 744 | 744 | /* otherwise, defer until the next scanline 0 */ |
| 745 | 745 | if (video_screen_get_vpos(scrnum) == 0) |
| 746 | | |
| 746 | | |
| 747 | 747 | else |
| 748 | | |
| 748 | | |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | |
| r1293 | r1294 | |
| 867 | 867 | int video_screen_get_vpos(int scrnum) |
| 868 | 868 | { |
| 869 | 869 | internal_screen_info *info = get_screen_info(Machine, scrnum); |
| 870 | s | |
| 870 | attos | |
| 871 | 871 | int vpos; |
| 872 | 872 | |
| 873 | 873 | /* round to the nearest pixel */ |
| r1293 | r1294 | |
| 890 | 890 | int video_screen_get_hpos(int scrnum) |
| 891 | 891 | { |
| 892 | 892 | internal_screen_info *info = get_screen_info(Machine, scrnum); |
| 893 | s | |
| 893 | attos | |
| 894 | 894 | int vpos; |
| 895 | 895 | |
| 896 | 896 | /* round to the nearest pixel */ |
| r1293 | r1294 | |
| 939 | 939 | at the given hpos,vpos |
| 940 | 940 | -------------------------------------------------*/ |
| 941 | 941 | |
| 942 | ||
| 942 | ||
| 943 | 943 | { |
| 944 | 944 | internal_screen_info *info = get_screen_info(Machine, scrnum); |
| 945 | subseconds_t curdelta = mame_time_to_subseconds(sub_mame_times(mame_timer_get_time(), info->vblank_time)); | |
| 946 | subseconds_t targetdelta; | |
| 945 | attoseconds_t curdelta = attotime_to_attoseconds(attotime_sub(timer_get_time(), info->vblank_time)); | |
| 946 | attoseconds_t targetdelta; | |
| 947 | 947 | |
| 948 | 948 | /* since we measure time relative to VBLANK, compute the scanline offset from VBLANK */ |
| 949 | 949 | vpos += info->state->height - (info->state->visarea.max_y + 1); |
| 950 | 950 | vpos %= info->state->height; |
| 951 | 951 | |
| 952 | 952 | /* compute the delta for the given X,Y position */ |
| 953 | targetdelta = (s | |
| 953 | targetdelta = (attos | |
| 954 | 954 | |
| 955 | 955 | /* if we're past that time (within 1/2 of a pixel), head to the next frame */ |
| 956 | 956 | if (targetdelta <= curdelta + info->pixeltime / 2) |
| r1293 | r1294 | |
| 959 | 959 | targetdelta += info->state->refresh; |
| 960 | 960 | |
| 961 | 961 | /* return the difference */ |
| 962 | return | |
| 962 | return | |
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | |
| r1293 | r1294 | |
| 969 | 969 | scanline |
| 970 | 970 | -------------------------------------------------*/ |
| 971 | 971 | |
| 972 | ||
| 972 | ||
| 973 | 973 | { |
| 974 | 974 | internal_screen_info *info = get_screen_info(Machine, scrnum); |
| 975 | return | |
| 975 | return | |
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | |
| r1293 | r1294 | |
| 982 | 982 | complete frame |
| 983 | 983 | -------------------------------------------------*/ |
| 984 | 984 | |
| 985 | ||
| 985 | ||
| 986 | 986 | { |
| 987 | return | |
| 987 | return | |
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | |
| r1293 | r1294 | |
| 1007 | 1007 | viddata->scrinfo[scrnum].last_partial_scan = 0; |
| 1008 | 1008 | global.partial_updates_this_frame = 0; |
| 1009 | 1009 | |
| 1010 | | |
| 1010 | | |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | |
| r1293 | r1294 | |
| 1019 | 1019 | |
| 1020 | 1020 | void video_frame_update(void) |
| 1021 | 1021 | { |
| 1022 | | |
| 1022 | | |
| 1023 | 1023 | int skipped_it = global.skipping_this_frame; |
| 1024 | 1024 | int phase = mame_get_phase(Machine); |
| 1025 | 1025 | |
| r1293 | r1294 | |
| 1311 | 1311 | natural speed |
| 1312 | 1312 | -------------------------------------------------*/ |
| 1313 | 1313 | |
| 1314 | static void update_throttle( | |
| 1314 | static void update_throttle( | |
| 1315 | 1315 | { |
| 1316 | 1316 | /* |
| 1317 | 1317 | |
| r1293 | r1294 | |
| 1357 | 1357 | 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, |
| 1358 | 1358 | 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, 4,5,5,6,5,6,6,7, 5,6,6,7,6,7,7,8 |
| 1359 | 1359 | }; |
| 1360 | subseconds_t real_delta_subseconds; | |
| 1361 | subseconds_t emu_delta_subseconds; | |
| 1362 | subseconds_t real_is_ahead_subseconds; | |
| 1363 | subseconds_t subseconds_per_tick; | |
| 1360 | attoseconds_t real_delta_attoseconds; | |
| 1361 | attoseconds_t emu_delta_attoseconds; | |
| 1362 | attoseconds_t real_is_ahead_attoseconds; | |
| 1363 | attoseconds_t attoseconds_per_tick; | |
| 1364 | 1364 | osd_ticks_t ticks_per_second; |
| 1365 | 1365 | osd_ticks_t target_ticks; |
| 1366 | 1366 | osd_ticks_t diff_ticks; |
| r1293 | r1294 | |
| 1369 | 1369 | if (global.speed != 0 && global.speed != 100) |
| 1370 | 1370 | { |
| 1371 | 1371 | /* multiply emutime by 100 */ |
| 1372 | emutime = | |
| 1372 | emutime = | |
| 1373 | 1373 | |
| 1374 | 1374 | /* divide emutime by the global speed factor */ |
| 1375 | emutime.subseconds /= global.speed; | |
| 1376 | emutime.subseconds += (emutime.seconds % global.speed) * (MAX_SUBSECONDS / global.speed); | |
| 1375 | emutime.attoseconds /= global.speed; | |
| 1376 | emutime.attoseconds += (emutime.seconds % global.speed) * (ATTOSECONDS_PER_SECOND / global.speed); | |
| 1377 | 1377 | emutime.seconds /= global.speed; |
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | 1380 | /* compute conversion factors up front */ |
| 1381 | 1381 | ticks_per_second = osd_ticks_per_second(); |
| 1382 | s | |
| 1382 | attos | |
| 1383 | 1383 | |
| 1384 | 1384 | /* if we're paused, emutime will not advance; instead, we subtract a fixed |
| 1385 | 1385 | amount of time (1/60th of a second) from the emulated time that was passed in, |
| r1293 | r1294 | |
| 1388 | 1388 | ago, and was in sync in both real and emulated time */ |
| 1389 | 1389 | if (mame_is_paused(Machine)) |
| 1390 | 1390 | { |
| 1391 | global.throttle_emutime = sub_s | |
| 1391 | global.throttle_emutime = attotime_sub_attos | |
| 1392 | 1392 | global.throttle_realtime = global.throttle_emutime; |
| 1393 | 1393 | } |
| 1394 | 1394 | |
| r1293 | r1294 | |
| 1396 | 1396 | reported value from our current value; this should be a small value somewhere |
| 1397 | 1397 | between 0 and 1/10th of a second ... anything outside of this range is obviously |
| 1398 | 1398 | wrong and requires a resync */ |
| 1399 | emu_delta_subseconds = mame_time_to_subseconds(sub_mame_times(emutime, global.throttle_emutime)); | |
| 1400 | if (emu_delta_subseconds < 0 || emu_delta_subseconds > MAX_SUBSECONDS / 10) | |
| 1399 | emu_delta_attoseconds = attotime_to_attoseconds(attotime_sub(emutime, global.throttle_emutime)); | |
| 1400 | if (emu_delta_attoseconds < 0 || emu_delta_attoseconds > ATTOSECONDS_PER_SECOND / 10) | |
| 1401 | 1401 | { |
| 1402 | 1402 | if (LOG_THROTTLE) |
| 1403 | logerror("Resync due to weird emutime delta: | |
| 1403 | logerror("Resync due to weird emutime delta: | |
| 1404 | 1404 | goto resync; |
| 1405 | 1405 | } |
| 1406 | 1406 | |
| r1293 | r1294 | |
| 1419 | 1419 | goto resync; |
| 1420 | 1420 | } |
| 1421 | 1421 | |
| 1422 | /* convert this value into subseconds for easier comparison */ | |
| 1423 | real_delta_subseconds = diff_ticks * subseconds_per_tick; | |
| 1422 | /* convert this value into attoseconds for easier comparison */ | |
| 1423 | real_delta_attoseconds = diff_ticks * attoseconds_per_tick; | |
| 1424 | 1424 | |
| 1425 | 1425 | /* now update our real and emulated timers with the current values */ |
| 1426 | 1426 | global.throttle_emutime = emutime; |
| 1427 | global.throttle_realtime = add_s | |
| 1427 | global.throttle_realtime = attotime_add_attos | |
| 1428 | 1428 | |
| 1429 | 1429 | /* keep a history of whether or not emulated time beat real time over the last few |
| 1430 | 1430 | updates; this can be used for future heuristics */ |
| 1431 | global.throttle_history = (global.throttle_history << 1) | (emu_delta_s | |
| 1431 | global.throttle_history = (global.throttle_history << 1) | (emu_delta_attos | |
| 1432 | 1432 | |
| 1433 | 1433 | /* determine how far ahead real time is versus emulated time; note that we use the |
| 1434 | 1434 | accumulated times for this instead of the deltas for the current update because |
| 1435 | 1435 | we want to track time over a longer duration than a single update */ |
| 1436 | real_is_ahead_s | |
| 1436 | real_is_ahead_attos | |
| 1437 | 1437 | |
| 1438 | 1438 | /* if we're more than 1/10th of a second out, or if we are behind at all and emulation |
| 1439 | 1439 | is taking longer than the real frame, we just need to resync */ |
| 1440 | if (real_is_ahead_subseconds < -MAX_SUBSECONDS / 10 || | |
| 1441 | (real_is_ahead_subseconds < 0 && popcount[global.throttle_history & 0xff] < 6)) | |
| 1440 | if (real_is_ahead_attoseconds < -ATTOSECONDS_PER_SECOND / 10 || | |
| 1441 | (real_is_ahead_attoseconds < 0 && popcount[global.throttle_history & 0xff] < 6)) | |
| 1442 | 1442 | { |
| 1443 | 1443 | if (LOG_THROTTLE) |
| 1444 | logerror("Resync due to being behind: | |
| 1444 | logerror("Resync due to being behind: | |
| 1445 | 1445 | goto resync; |
| 1446 | 1446 | } |
| 1447 | 1447 | |
| 1448 | 1448 | /* if we're behind, it's time to just get out */ |
| 1449 | if (real_is_ahead_ | |
| 1449 | if (real_is_ahead_attoseconds < 0) | |
| 1450 | 1450 | return; |
| 1451 | 1451 | |
| 1452 | 1452 | /* compute the target real time, in ticks, where we want to be */ |
| 1453 | target_ticks = global.throttle_last_ticks + real_is_ahead_s | |
| 1453 | target_ticks = global.throttle_last_ticks + real_is_ahead_attos | |
| 1454 | 1454 | |
| 1455 | 1455 | /* throttle until we read the target, and update real time to match the final time */ |
| 1456 | 1456 | diff_ticks = throttle_until_ticks(target_ticks) - global.throttle_last_ticks; |
| 1457 | 1457 | global.throttle_last_ticks += diff_ticks; |
| 1458 | global.throttle_realtime = add_s | |
| 1458 | global.throttle_realtime = attotime_add_attos | |
| 1459 | 1459 | return; |
| 1460 | 1460 | |
| 1461 | 1461 | resync: |
| r1293 | r1294 | |
| 1583 | 1583 | if we did not skip a frame |
| 1584 | 1584 | -------------------------------------------------*/ |
| 1585 | 1585 | |
| 1586 | static void recompute_speed( | |
| 1586 | static void recompute_speed( | |
| 1587 | 1587 | { |
| 1588 | | |
| 1588 | attoseconds_t delta_emutime; | |
| 1589 | 1589 | |
| 1590 | 1590 | /* if we don't have a starting time yet, or if we're paused, reset our starting point */ |
| 1591 | 1591 | if (global.speed_last_realtime == 0 || mame_is_paused(Machine)) |
| r1293 | r1294 | |
| 1595 | 1595 | } |
| 1596 | 1596 | |
| 1597 | 1597 | /* if it has been more than the update interval, update the time */ |
| 1598 | delta_emutime = | |
| 1598 | delta_emutime = | |
| 1599 | 1599 | if (delta_emutime > SUBSECONDS_PER_SPEED_UPDATE) |
| 1600 | 1600 | { |
| 1601 | 1601 | osd_ticks_t realtime = osd_ticks(); |
| 1602 | 1602 | osd_ticks_t delta_realtime = realtime - global.speed_last_realtime; |
| 1603 | 1603 | osd_ticks_t tps = osd_ticks_per_second(); |
| 1604 | 1604 | |
| 1605 | /* convert from ticks to subseconds */ | |
| 1606 | global.speed_percent = (double)delta_emutime * (double)tps / ((double)delta_realtime * (double)MAX_SUBSECONDS); | |
| 1605 | /* convert from ticks to attoseconds */ | |
| 1606 | global.speed_percent = (double)delta_emutime * (double)tps / ((double)delta_realtime * (double)ATTOSECONDS_PER_SECOND); | |
| 1607 | 1607 | |
| 1608 | 1608 | /* remember the last times */ |
| 1609 | 1609 | global.speed_last_realtime = realtime; |
| r1293 | r1294 | |
| 1624 | 1624 | global.overall_real_ticks -= tps; |
| 1625 | 1625 | global.overall_real_seconds++; |
| 1626 | 1626 | } |
| 1627 | global.overall_emutime = add_s | |
| 1627 | global.overall_emutime = attotime_add_attos | |
| 1628 | 1628 | } |
| 1629 | 1629 | } |
| 1630 | 1630 | |
| r1293 | r1294 | |
| 1890 | 1890 | png_add_text(&pnginfo, "System", text); |
| 1891 | 1891 | |
| 1892 | 1892 | /* start the capture */ |
| 1893 | error = mng_capture_start(mame_core_file(info->movie_file), bitmap, | |
| 1893 | error = mng_capture_start(mame_core_file(info->movie_file), bitmap, ATTOSECONDS_TO_HZ(viddata->scrinfo[scrnum].state->refresh)); | |
| 1894 | 1894 | if (error != PNGERR_NONE) |
| 1895 | 1895 | { |
| 1896 | 1896 | png_free(&pnginfo); |
| r1293 | r1294 | |
|---|---|---|
| 45 | 45 | int width, height; /* total width/height (HTOTAL, VTOTAL) */ |
| 46 | 46 | rectangle visarea; /* visible area (HBLANK end/start, VBLANK end/start) */ |
| 47 | 47 | UINT8 oldstyle_vblank_supplied; /* MDRV_SCREEN_VBLANK_TIME macro used */ |
| 48 | subseconds_t refresh; /* refresh period */ | |
| 49 | subseconds_t vblank; /* duration of a VBLANK */ | |
| 48 | attoseconds_t refresh; /* refresh period */ | |
| 49 | attoseconds_t vblank; /* duration of a VBLANK */ | |
| 50 | 50 | bitmap_format format; /* bitmap format */ |
| 51 | 51 | }; |
| 52 | 52 | |
| r1293 | r1294 | |
| 84 | 84 | /* ----- screen management ----- */ |
| 85 | 85 | |
| 86 | 86 | /* set the resolution of a screen */ |
| 87 | void video_screen_configure(int scrnum, int width, int height, const rectangle *visarea, | |
| 87 | void video_screen_configure(int scrnum, int width, int height, const rectangle *visarea, attoseconds_t refresh); | |
| 88 | 88 | |
| 89 | 89 | /* set the visible area of a screen; this is a subset of video_screen_configure */ |
| 90 | 90 | void video_screen_set_visarea(int scrnum, int min_x, int max_x, int min_y, int max_y); |
| r1293 | r1294 | |
| 101 | 101 | int video_screen_get_hblank(int scrnum); |
| 102 | 102 | |
| 103 | 103 | /* return the time when the beam will reach a particular H,V position */ |
| 104 | ||
| 104 | ||
| 105 | 105 | |
| 106 | 106 | /* return the amount of time the beam takes to draw one scan line */ |
| 107 | ||
| 107 | ||
| 108 | 108 | |
| 109 | 109 | /* return the amount of time the beam takes to draw one complete frame */ |
| 110 | ||
| 110 | ||
| 111 | 111 | |
| 112 | 112 | /* returns whether a given screen exists */ |
| 113 | 113 | int video_screen_exists(int scrnum); |
| r1293 | r1294 | |
|---|---|---|
| 36 | 36 | #------------------------------------------------- |
| 37 | 37 | |
| 38 | 38 | EMUOBJS = \ |
| 39 | $(EMUOBJ)/attotime.o \ | |
| 39 | 40 | $(EMUOBJ)/audit.o \ |
| 40 | 41 | $(EMUOBJ)/cheat.o \ |
| 41 | 42 | $(EMUOBJ)/clifront.o \ |
| r1293 | r1294 | |
|---|---|---|
| 142 | 142 | UINT8 exit_pending; |
| 143 | 143 | const game_driver *new_driver_pending; |
| 144 | 144 | astring * saveload_pending_file; |
| 145 | | |
| 145 | | |
| 146 | 146 | mame_file * logfile; |
| 147 | 147 | |
| 148 | 148 | /* callbacks */ |
| r1293 | r1294 | |
| 154 | 154 | |
| 155 | 155 | /* load/save */ |
| 156 | 156 | void (*saveload_schedule_callback)(running_machine *); |
| 157 | | |
| 157 | | |
| 158 | 158 | |
| 159 | 159 | /* array of memory regions */ |
| 160 | 160 | region_info mem_region[MAX_MEMORY_REGIONS]; |
| r1293 | r1294 | |
| 640 | 640 | { |
| 641 | 641 | mame_private *mame = machine->mame_data; |
| 642 | 642 | |
| 643 | | |
| 643 | | |
| 644 | 644 | |
| 645 | 645 | /* we can't be paused since the timer needs to fire */ |
| 646 | 646 | mame_pause(machine, FALSE); |
| r1293 | r1294 | |
| 684 | 684 | |
| 685 | 685 | /* note the start time and set a timer for the next timeslice to actually schedule it */ |
| 686 | 686 | mame->saveload_schedule_callback = handle_save; |
| 687 | mame->saveload_schedule_time = | |
| 687 | mame->saveload_schedule_time = | |
| 688 | 688 | |
| 689 | 689 | /* we can't be paused since we need to clear out anonymous timers */ |
| 690 | 690 | mame_pause(machine, FALSE); |
| r1293 | r1294 | |
| 707 | 707 | |
| 708 | 708 | /* note the start time and set a timer for the next timeslice to actually schedule it */ |
| 709 | 709 | mame->saveload_schedule_callback = handle_load; |
| 710 | mame->saveload_schedule_time = | |
| 710 | mame->saveload_schedule_time = | |
| 711 | 711 | |
| 712 | 712 | /* we can't be paused since we need to clear out anonymous timers */ |
| 713 | 713 | mame_pause(machine, FALSE); |
| r1293 | r1294 | |
| 1506 | 1506 | /* initialize the timers and allocate a soft_reset timer */ |
| 1507 | 1507 | /* this must be done before cpu_init so that CPU's can allocate timers */ |
| 1508 | 1508 | timer_init(machine); |
| 1509 | mame->soft_reset_timer = | |
| 1509 | mame->soft_reset_timer = | |
| 1510 | 1510 | |
| 1511 | 1511 | /* init the osd layer */ |
| 1512 | 1512 | osd_init(machine); |
| r1293 | r1294 | |
| 1616 | 1616 | |
| 1617 | 1617 | /* set the global time to the current time */ |
| 1618 | 1618 | /* this allows 0-time queued callbacks to run before any CPUs execute */ |
| 1619 | | |
| 1619 | | |
| 1620 | 1620 | } |
| 1621 | 1621 | |
| 1622 | 1622 | |
| r1293 | r1294 | |
| 1679 | 1679 | if (timer_count_anonymous() > 0) |
| 1680 | 1680 | { |
| 1681 | 1681 | /* if more than a second has passed, we're probably screwed */ |
| 1682 | if ( | |
| 1682 | if ( | |
| 1683 | 1683 | { |
| 1684 | 1684 | popmessage("Unable to save due to pending anonymous timers. See error.log for details."); |
| 1685 | 1685 | goto cancel; |
| r1293 | r1294 | |
| 1765 | 1765 | if (timer_count_anonymous() > 0) |
| 1766 | 1766 | { |
| 1767 | 1767 | /* if more than a second has passed, we're probably screwed */ |
| 1768 | if ( | |
| 1768 | if ( | |
| 1769 | 1769 | { |
| 1770 | 1770 | popmessage("Unable to load due to pending anonymous timers. See error.log for details."); |
| 1771 | 1771 | goto cancel; |
| r1293 | r1294 | |
| 1885 | 1885 | void mame_get_current_datetime(running_machine *machine, mame_system_time *systime) |
| 1886 | 1886 | { |
| 1887 | 1887 | mame_private *mame = machine->mame_data; |
| 1888 | fill_systime(systime, mame->base_time + | |
| 1888 | fill_systime(systime, mame->base_time + | |
| 1889 | 1889 | } |
| r1293 | r1294 | |
|---|---|---|
| 213 | 213 | |
| 214 | 214 | void timekeeper_init( int chip, int type, UINT8 *data ) |
| 215 | 215 | { |
| 216 | mame_timer *timer; | |
| 217 | mame_time duration; | |
| 216 | emu_timer *timer; | |
| 217 | attotime duration; | |
| 218 | 218 | mame_system_time systime; |
| 219 | 219 | struct timekeeper_chip *c; |
| 220 | 220 | |
| r1293 | r1294 | |
| 300 | 300 | state_save_register_item( "timekeeper", chip, c->century ); |
| 301 | 301 | state_save_register_item_pointer( "timekeeper", chip, c->data, c->size ); |
| 302 | 302 | |
| 303 | timer = mame_timer_alloc_ptr( timekeeper_tick, c ); | |
| 304 | duration = MAME_TIME_IN_SEC(1); | |
| 305 | mame_timer_adjust_ptr( timer, duration, duration ); | |
| 303 | timer = timer_alloc_ptr( timekeeper_tick, c ); | |
| 304 | duration = ATTOTIME_IN_SEC(1); | |
| 305 | timer_adjust_ptr( timer, duration, duration ); | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | static void timekeeper_nvram( int chip, mame_file *file, int read_or_write ) |
| r1293 | r1294 | |
|---|---|---|
| 22 | 22 | |
| 23 | 23 | // scsihd_exec_command |
| 24 | 24 | |
| 25 | int scsihd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) | |
| 25 | static int scsihd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) | |
| 26 | 26 | { |
| 27 | 27 | UINT8 *command; |
| 28 | 28 | int commandLength; |
| r1293 | r1294 | |
|---|---|---|
| 54 | 54 | UINT16 count; |
| 55 | 55 | UINT8 mode; |
| 56 | 56 | UINT8 irq; |
| 57 | | |
| 57 | | |
| 58 | 58 | cia_state * cia; |
| 59 | 59 | }; |
| 60 | 60 | |
| r1293 | r1294 | |
| 171 | 171 | for (t = 0; t < (sizeof(cia->timer) / sizeof(cia->timer[0])); t++) |
| 172 | 172 | { |
| 173 | 173 | cia_timer *timer = &cia->timer[t]; |
| 174 | timer->timer = | |
| 174 | timer->timer = | |
| 175 | 175 | timer->cia = cia; |
| 176 | 176 | timer->irq = 0x01 << t; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /* setup TOD timer, if appropriate */ |
| 180 | 180 | if (intf->tod_clock) |
| 181 | | |
| 181 | | |
| 182 | 182 | |
| 183 | 183 | /* special case; for the first CIA, set up an exit handler to clear things out */ |
| 184 | 184 | if (which == 0) |
| r1293 | r1294 | |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | |
| 295 | static int is_timer_active( | |
| 295 | static int is_timer_active( | |
| 296 | 296 | { |
| 297 | mame_time t = mame_timer_firetime(timer); | |
| 298 | return compare_mame_times(t, time_never) != 0; | |
| 297 | attotime t = timer_firetime(timer); | |
| 298 | return attotime_compare(t, attotime_never) != 0; | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | |
| 302 | /* updates the count and | |
| 302 | /* updates the count and | |
| 303 | 303 | static void cia_timer_update(cia_timer *timer, INT32 new_count) |
| 304 | 304 | { |
| 305 | 305 | int which = timer - timer->cia->timer; |
| r1293 | r1294 | |
| 310 | 310 | /* update the timer count, if necessary */ |
| 311 | 311 | if ((new_count == -1) && is_timer_active(timer->timer)) |
| 312 | 312 | { |
| 313 | UINT16 current_count = | |
| 313 | UINT16 current_count = | |
| 314 | 314 | timer->count = timer->count - MIN(timer->count, current_count); |
| 315 | 315 | } |
| 316 | 316 | |
| r1293 | r1294 | |
| 322 | 322 | if ((timer->mode & 0x01) && ((timer->mode & (which ? 0x60 : 0x20)) == 0x00)) |
| 323 | 323 | { |
| 324 | 324 | /* timer is on and is connected to clock */ |
| 325 | mame_time period = scale_up_mame_time(MAME_TIME_IN_HZ(timer->cia->clock), (timer->count ? timer->count : 0x10000)); | |
| 326 | mame_timer_adjust_ptr(timer->timer, period, time_zero); | |
| 325 | attotime period = attotime_mul(ATTOTIME_IN_HZ(timer->cia->clock), (timer->count ? timer->count : 0x10000)); | |
| 326 | timer_adjust_ptr(timer->timer, period, attotime_zero); | |
| 327 | 327 | } |
| 328 | 328 | else |
| 329 | 329 | { |
| 330 | 330 | /* timer is off or not connected to clock */ |
| 331 | | |
| 331 | | |
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 |
| r1293 | r1294 | |
|---|---|---|
| 24 | 24 | UINT8 A; /* pin 1/9 */ |
| 25 | 25 | UINT8 B; /* pin 2/10 */ |
| 26 | 26 | UINT8 clear; /* pin 3/11 */ |
| 27 | | |
| 27 | | |
| 28 | 28 | }; |
| 29 | 29 | |
| 30 | 30 | static TTL74123_state chips[MAX_TTL74123]; |
| 31 | 31 | |
| 32 | 32 | |
| 33 | static | |
| 33 | static | |
| 34 | 34 | { |
| 35 | 35 | double duration; |
| 36 | 36 | |
| r1293 | r1294 | |
| 54 | 54 | break; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | return double_to_ | |
| 57 | return double_to_ | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | static int timer_running(TTL74123_state *chip) |
| 62 | 62 | { |
| 63 | return (compare_mame_times(mame_timer_timeleft(chip->timer), time_zero) > 0) && | |
| 64 | (compare_mame_times(mame_timer_timeleft(chip->timer), time_never) != 0); | |
| 63 | return (attotime_compare(timer_timeleft(chip->timer), attotime_zero) > 0) && | |
| 64 | (attotime_compare(timer_timeleft(chip->timer), attotime_never) != 0); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| r1293 | r1294 | |
| 96 | 96 | |
| 97 | 97 | chip->intf = intf; |
| 98 | 98 | chip->which = which; |
| 99 | chip->timer = | |
| 99 | chip->timer = | |
| 100 | 100 | |
| 101 | 101 | /* start with the defaults */ |
| 102 | 102 | chip->A = intf->A; |
| r1293 | r1294 | |
| 120 | 120 | |
| 121 | 121 | static void start_pulse(TTL74123_state *chip) |
| 122 | 122 | { |
| 123 | | |
| 123 | | |
| 124 | 124 | |
| 125 | 125 | if (timer_running(chip)) |
| 126 | 126 | { |
| 127 | 127 | /* retriggering, but not if we are called to quickly */ |
| 128 | | |
| 128 | | |
| 129 | 129 | |
| 130 | if ( | |
| 130 | if ( | |
| 131 | 131 | { |
| 132 | | |
| 132 | | |
| 133 | 133 | |
| 134 | if (LOG) logerror("74123 #%d: Retriggering pulse. Duration: %f\n", chip->which, | |
| 134 | if (LOG) logerror("74123 #%d: Retriggering pulse. Duration: %f\n", chip->which, | |
| 135 | 135 | } |
| 136 | 136 | else |
| 137 | 137 | { |
| r1293 | r1294 | |
| 141 | 141 | else |
| 142 | 142 | { |
| 143 | 143 | /* starting */ |
| 144 | | |
| 144 | | |
| 145 | 145 | |
| 146 | 146 | set_output(chip); |
| 147 | 147 | |
| 148 | if (LOG) logerror("74123 #%d: Starting pulse. Duration: %f\n", chip->which, | |
| 148 | if (LOG) logerror("74123 #%d: Starting pulse. Duration: %f\n", chip->which, | |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| r1293 | r1294 | |
| 181 | 181 | /* clear the output if A=LO, B=HI and falling edge on clear */ |
| 182 | 182 | if (!data && chip->clear && chip->B && !chip->A && !chip->clear) |
| 183 | 183 | { |
| 184 | | |
| 184 | | |
| 185 | 185 | |
| 186 | 186 | if (LOG) logerror("74123 #%d: Cleared\n", which); |
| 187 | 187 | } |
| r1293 | r1294 | |
|---|---|---|
| 84 | 84 | enum serial_state rx_state; |
| 85 | 85 | enum serial_state tx_state; |
| 86 | 86 | |
| 87 | mame_timer *rx_timer; | |
| 88 | mame_timer *tx_timer; | |
| 87 | emu_timer *rx_timer; | |
| 88 | emu_timer *tx_timer; | |
| 89 | 89 | |
| 90 | 90 | void (*int_callback)(int param); |
| 91 | 91 | } acia_6850; |
| r1293 | r1294 | |
| 168 | 168 | acia_p->cts_pin = intf->cts_pin; |
| 169 | 169 | acia_p->rts_pin = intf->rts_pin; |
| 170 | 170 | acia_p->dcd_pin = intf->dcd_pin; |
| 171 | acia_p->rx_timer = mame_timer_alloc(receive_event); | |
| 172 | acia_p->tx_timer = mame_timer_alloc(transmit_event); | |
| 171 | acia_p->rx_timer = timer_alloc(receive_event); | |
| 172 | acia_p->tx_timer = timer_alloc(transmit_event); | |
| 173 | 173 | acia_p->int_callback = intf->int_callback; |
| 174 | 174 | acia_p->first_reset = 1; |
| 175 | 175 | acia_p->status_read = 0; |
| 176 | 176 | acia_p->brk = 0; |
| 177 | 177 | |
| 178 | mame_timer_reset(acia_p->rx_timer, time_never); | |
| 179 | mame_timer_reset(acia_p->tx_timer, time_never); | |
| 178 | timer_reset(acia_p->rx_timer, attotime_never); | |
| 179 | timer_reset(acia_p->tx_timer, attotime_never); | |
| 180 | 180 | |
| 181 | 181 | state_save_register_item("acia6850", which, acia_p->ctrl); |
| 182 | 182 | state_save_register_item("acia6850", which, acia_p->status); |
| r1293 | r1294 | |
| 204 | 204 | /* |
| 205 | 205 | Read Status Register |
| 206 | 206 | */ |
| 207 | UINT8 acia6850_stat_r(int which) | |
| 207 | static UINT8 acia6850_stat_r(int which) | |
| 208 | 208 | { |
| 209 | 209 | acia_6850 *acia_p = &acia[which]; |
| 210 | 210 | |
| r1293 | r1294 | |
| 216 | 216 | /* |
| 217 | 217 | Write Control Register |
| 218 | 218 | */ |
| 219 | void acia6850_ctrl_w(int which, UINT8 data) | |
| 219 | static void acia6850_ctrl_w(int which, UINT8 data) | |
| 220 | 220 | { |
| 221 | 221 | acia_6850 *acia_p = &acia[which]; |
| 222 | 222 | |
| r1293 | r1294 | |
| 297 | 297 | |
| 298 | 298 | if (!acia_p->reset) |
| 299 | 299 | { |
| 300 | mame_time rx_period = scale_up_mame_time(MAME_TIME_IN_HZ(acia_p->rx_clock), acia_p->divide); | |
| 301 | mame_time tx_period = scale_up_mame_time(MAME_TIME_IN_HZ(acia_p->tx_clock), acia_p->divide); | |
| 302 | mame_timer_adjust(acia_p->rx_timer, rx_period, which, rx_period); | |
| 303 | mame_timer_adjust(acia_p->tx_timer, tx_period, which, tx_period); | |
| 300 | attotime rx_period = attotime_mul(ATTOTIME_IN_HZ(acia_p->rx_clock), acia_p->divide); | |
| 301 | attotime tx_period = attotime_mul(ATTOTIME_IN_HZ(acia_p->tx_clock), acia_p->divide); | |
| 302 | timer_adjust(acia_p->rx_timer, rx_period, which, rx_period); | |
| 303 | timer_adjust(acia_p->tx_timer, tx_period, which, tx_period); | |
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | void acia6850_check_interrupts(int which) | |
| 307 | static void acia6850_check_interrupts(int which) | |
| 308 | 308 | { |
| 309 | 309 | acia_6850 *acia_p = &acia[which]; |
| 310 | 310 | |
| r1293 | r1294 | |
| 334 | 334 | /* |
| 335 | 335 | Write transmit register |
| 336 | 336 | */ |
| 337 | void acia6850_data_w(int which, UINT8 data) | |
| 337 | static void acia6850_data_w(int which, UINT8 data) | |
| 338 | 338 | { |
| 339 | 339 | acia_6850 *acia_p = &acia[which]; |
| 340 | 340 | |
| r1293 | r1294 | |
| 353 | 353 | /* |
| 354 | 354 | Read character |
| 355 | 355 | */ |
| 356 | UINT8 acia6850_data_r(int which) | |
| 356 | static UINT8 acia6850_data_r(int which) | |
| 357 | 357 | { |
| 358 | 358 | acia_6850 *acia_p = &acia[which]; |
| 359 | 359 |
| r1293 | r1294 | |
|---|---|---|
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "machine/mb3773.h" |
| 11 | 11 | |
| 12 | static | |
| 12 | static | |
| 13 | 13 | static UINT8 ck = 0; |
| 14 | 14 | |
| 15 | 15 | static TIMER_CALLBACK( watchdog_timeout ) |
| r1293 | r1294 | |
| 19 | 19 | |
| 20 | 20 | static void reset_timer( void ) |
| 21 | 21 | { |
| 22 | | |
| 22 | | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | void mb3773_set_ck( UINT8 new_ck ) |
| r1293 | r1294 | |
| 33 | 33 | |
| 34 | 34 | void mb3773_init( void ) |
| 35 | 35 | { |
| 36 | watchdog_timer = | |
| 36 | watchdog_timer = | |
| 37 | 37 | reset_timer(); |
| 38 | 38 | state_save_register_global( ck ); |
| 39 | 39 | } |
| r1293 | r1294 | |
|---|---|---|
| 43 | 43 | |
| 44 | 44 | #define IDE_DISK_SECTOR_SIZE 512 |
| 45 | 45 | |
| 46 | #define MINIMUM_COMMAND_TIME ( | |
| 46 | #define MINIMUM_COMMAND_TIME ( | |
| 47 | 47 | |
| 48 | #define TIME_PER_SECTOR (MAME_TIME_IN_USEC(100)) | |
| 49 | #define TIME_PER_ROTATION (MAME_TIME_IN_HZ(5400/60)) | |
| 50 | #define TIME_SECURITY_ERROR (MAME_TIME_IN_MSEC(1000)) | |
| 48 | #define TIME_PER_SECTOR (ATTOTIME_IN_USEC(100)) | |
| 49 | #define TIME_PER_ROTATION (ATTOTIME_IN_HZ(5400/60)) | |
| 50 | #define TIME_SECURITY_ERROR (ATTOTIME_IN_MSEC(1000)) | |
| 51 | 51 | |
| 52 | #define TIME_SEEK_MULTISECTOR (MAME_TIME_IN_MSEC(13)) | |
| 53 | #define TIME_NO_SEEK_MULTISECTOR (MAME_TIME_IN_NSEC(16300)) | |
| 52 | #define TIME_SEEK_MULTISECTOR (ATTOTIME_IN_MSEC(13)) | |
| 53 | #define TIME_NO_SEEK_MULTISECTOR (ATTOTIME_IN_NSEC(16300)) | |
| 54 | 54 | |
| 55 | 55 | #define IDE_STATUS_ERROR 0x01 |
| 56 | 56 | #define IDE_STATUS_HIT_INDEX 0x02 |
| r1293 | r1294 | |
| 159 | 159 | |
| 160 | 160 | struct ide_interface *intf; |
| 161 | 161 | hard_disk_file * disk; |
| 162 | mame_timer * last_status_timer; | |
| 163 | mame_timer * reset_timer; | |
| 162 | emu_timer * last_status_timer; | |
| 163 | emu_timer * reset_timer; | |
| 164 | 164 | |
| 165 | 165 | UINT8 master_password_enable; |
| 166 | 166 | UINT8 user_password_enable; |
| r1293 | r1294 | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | |
| 257 | INLINE void signal_delayed_interrupt(struct ide_state *ide, | |
| 257 | INLINE void signal_delayed_interrupt(struct ide_state *ide, | |
| 258 | 258 | { |
| 259 | 259 | /* clear buffer ready and set the busy flag */ |
| 260 | 260 | ide->status &= ~IDE_STATUS_BUFFER_READY; |
| r1293 | r1294 | |
| 262 | 262 | |
| 263 | 263 | /* set a timer */ |
| 264 | 264 | if (buffer_ready) |
| 265 | | |
| 265 | | |
| 266 | 266 | else |
| 267 | | |
| 267 | | |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | |
| r1293 | r1294 | |
| 328 | 328 | ide_build_features(ide); |
| 329 | 329 | |
| 330 | 330 | /* create a timer for timing status */ |
| 331 | ide->last_status_timer = mame_timer_alloc(NULL); | |
| 332 | ide->reset_timer = mame_timer_alloc_ptr(reset_callback, ide); | |
| 331 | ide->last_status_timer = timer_alloc(NULL); | |
| 332 | ide->reset_timer = timer_alloc_ptr(reset_callback, ide); | |
| 333 | 333 | |
| 334 | 334 | /* register ide status */ |
| 335 | 335 | state_save_register_item("ide", which, ide->adapter_control); |
| r1293 | r1294 | |
| 752 | 752 | ide->status &= ~IDE_STATUS_DRIVE_READY; |
| 753 | 753 | |
| 754 | 754 | /* just set a timer and mark ourselves error */ |
| 755 | | |
| 755 | | |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | |
| r1293 | r1294 | |
| 919 | 919 | if (ide->command == IDE_COMMAND_READ_MULTIPLE_BLOCK) |
| 920 | 920 | { |
| 921 | 921 | int new_lba = lba_address(ide); |
| 922 | | |
| 922 | | |
| 923 | 923 | |
| 924 | 924 | if (new_lba == ide->cur_lba || new_lba == ide->cur_lba + 1) |
| 925 | 925 | seek_time = TIME_NO_SEEK_MULTISECTOR; |
| r1293 | r1294 | |
| 927 | 927 | seek_time = TIME_SEEK_MULTISECTOR; |
| 928 | 928 | |
| 929 | 929 | ide->cur_lba = new_lba; |
| 930 | | |
| 930 | | |
| 931 | 931 | } |
| 932 | 932 | else |
| 933 | | |
| 933 | | |
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | |
| r1293 | r1294 | |
| 946 | 946 | read_sector_done(ide); |
| 947 | 947 | else |
| 948 | 948 | /* just set a timer */ |
| 949 | | |
| 949 | | |
| 950 | 950 | } |
| 951 | 951 | else |
| 952 | 952 | /* just set a timer */ |
| 953 | | |
| 953 | | |
| 954 | 954 | } |
| 955 | 955 | |
| 956 | 956 | |
| r1293 | r1294 | |
| 983 | 983 | else |
| 984 | 984 | { |
| 985 | 985 | /* set a timer to do the write */ |
| 986 | | |
| 986 | | |
| 987 | 987 | } |
| 988 | 988 | } |
| 989 | 989 | else |
| 990 | 990 | { |
| 991 | 991 | /* set a timer to do the write */ |
| 992 | | |
| 992 | | |
| 993 | 993 | } |
| 994 | 994 | } |
| 995 | 995 | |
| r1293 | r1294 | |
| 1394 | 1394 | /* return the current status but don't clear interrupts */ |
| 1395 | 1395 | case IDE_ADDR_STATUS_CONTROL: |
| 1396 | 1396 | result = ide->status; |
| 1397 | if ( | |
| 1397 | if ( | |
| 1398 | 1398 | { |
| 1399 | 1399 | result |= IDE_STATUS_HIT_INDEX; |
| 1400 | | |
| 1400 | | |
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | 1403 | /* clear interrutps only when reading the real status */ |
| r1293 | r1294 | |
| 1563 | 1563 | { |
| 1564 | 1564 | ide->status |= IDE_STATUS_BUSY; |
| 1565 | 1565 | ide->status &= ~IDE_STATUS_DRIVE_READY; |
| 1566 | | |
| 1566 | | |
| 1567 | 1567 | } |
| 1568 | 1568 | break; |
| 1569 | 1569 | } |
| r1293 | r1294 | |
|---|---|---|
| 34 | 34 | |
| 35 | 35 | int timer_irq_enable; |
| 36 | 36 | int timer_irq; |
| 37 | | |
| 37 | | |
| 38 | 38 | |
| 39 | 39 | int clock; |
| 40 | 40 | }; |
| r1293 | r1294 | |
| 45 | 45 | |
| 46 | 46 | INLINE void r6532_set_timer(int which, UINT8 count) |
| 47 | 47 | { |
| 48 | | |
| 48 | | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| r1293 | r1294 | |
| 155 | 155 | |
| 156 | 156 | INLINE UINT8 r6532_read_timer(int which) |
| 157 | 157 | { |
| 158 | int timer_cycles_left = ( | |
| 158 | int timer_cycles_left = ( | |
| 159 | 159 | if ( timer_cycles_left >= 0) |
| 160 | 160 | { |
| 161 | 161 | timer_cycles_left = timer_cycles_left >> r6532[which].shift; |
| r1293 | r1294 | |
| 194 | 194 | |
| 195 | 195 | INLINE UINT8 r6532_read_irq_flags(int which) |
| 196 | 196 | { |
| 197 | int timer_cycles_left = ( | |
| 197 | int timer_cycles_left = ( | |
| 198 | 198 | int res = 0; |
| 199 | 199 | |
| 200 | 200 | if ( timer_cycles_left < 0 ) |
| r1293 | r1294 | |
| 286 | 286 | |
| 287 | 287 | r6532[which].shift = 10; |
| 288 | 288 | |
| 289 | r6532[which].counter_timer = | |
| 289 | r6532[which].counter_timer = | |
| 290 | 290 | |
| 291 | 291 | r6532_set_timer( which, 0xFF ); |
| 292 | 292 |
| r1293 | r1294 | |
|---|---|---|
| 62 | 62 | UINT8 ier; |
| 63 | 63 | UINT8 ifr; |
| 64 | 64 | |
| 65 | mame_timer *t1; | |
| 66 | mame_time time1; | |
| 65 | emu_timer *t1; | |
| 66 | attotime time1; | |
| 67 | 67 | UINT8 t1_active; |
| 68 | mame_timer *t2; | |
| 69 | mame_time time2; | |
| 68 | emu_timer *t2; | |
| 69 | attotime time2; | |
| 70 | 70 | UINT8 t2_active; |
| 71 | 71 | UINT8 shift_counter; |
| 72 | 72 | |
| r1293 | r1294 | |
| 162 | 162 | via[which].t1lh = 0xb5; /* ports are not written by kernel! */ |
| 163 | 163 | via[which].t2ll = 0xff; /* taken from vice */ |
| 164 | 164 | via[which].t2lh = 0xff; |
| 165 | via[which].time2 = via[which].time1 = | |
| 165 | via[which].time2 = via[which].time1 = | |
| 166 | 166 | |
| 167 | 167 | /* Default clock is from CPU1 */ |
| 168 | 168 | via_set_clock (which, Machine->drv->cpu[0].clock); |
| r1293 | r1294 | |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | |
| 215 | INLINE | |
| 215 | INLINE | |
| 216 | 216 | { |
| 217 | return | |
| 217 | return | |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | |
| 221 | INLINE UINT32 v_time_to_cycles(struct via6522 *v, | |
| 221 | INLINE UINT32 v_time_to_cycles(struct via6522 *v, | |
| 222 | 222 | { |
| 223 | return | |
| 223 | return | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
| r1293 | r1294 | |
| 251 | 251 | v->shift_counter = (v->shift_counter + 1) % 8; |
| 252 | 252 | |
| 253 | 253 | if (v->shift_counter) |
| 254 | | |
| 254 | | |
| 255 | 255 | else |
| 256 | 256 | { |
| 257 | 257 | if (!(v->ifr & INT_SR)) |
| r1293 | r1294 | |
| 310 | 310 | { |
| 311 | 311 | if (T1_SET_PB7(v->acr)) |
| 312 | 312 | v->out_b ^= 0x80; |
| 313 | | |
| 313 | | |
| 314 | 314 | } |
| 315 | 315 | else |
| 316 | 316 | { |
| 317 | 317 | if (T1_SET_PB7(v->acr)) |
| 318 | 318 | v->out_b |= 0x80; |
| 319 | 319 | v->t1_active = 0; |
| 320 | v->time1 = | |
| 320 | v->time1 = | |
| 321 | 321 | } |
| 322 | 322 | if (v->ddr_b) |
| 323 | 323 | { |
| r1293 | r1294 | |
| 339 | 339 | struct via6522 *v = via + which; |
| 340 | 340 | |
| 341 | 341 | v->t2_active = 0; |
| 342 | v->time2 = | |
| 342 | v->time2 = | |
| 343 | 343 | |
| 344 | 344 | if (!(v->ifr & INT_T2)) |
| 345 | 345 | via_set_int (which, INT_T2); |
| r1293 | r1294 | |
| 365 | 365 | v.time2 = via[i].time2; |
| 366 | 366 | v.clock = via[i].clock; |
| 367 | 367 | |
| 368 | v.t1 = | |
| 368 | v.t1 = | |
| 369 | 369 | v.t1_active = 0; |
| 370 | v.t2 = | |
| 370 | v.t2 = | |
| 371 | 371 | v.t2_active = 0; |
| 372 | 372 | |
| 373 | 373 | via[i] = v; |
| r1293 | r1294 | |
| 463 | 463 | case VIA_T1CL: |
| 464 | 464 | via_clear_int (which, INT_T1); |
| 465 | 465 | if (v->t1_active) |
| 466 | val = v_time_to_cycles(v, | |
| 466 | val = v_time_to_cycles(v, | |
| 467 | 467 | else |
| 468 | 468 | { |
| 469 | 469 | if ( T1_CONTINUOUS(v->acr) ) |
| 470 | val = (TIMER1_VALUE(v) - (v_time_to_cycles(v, | |
| 470 | val = (TIMER1_VALUE(v) - (v_time_to_cycles(v, | |
| 471 | 471 | else |
| 472 | val = (0x10000 - (v_time_to_cycles(v, | |
| 472 | val = (0x10000 - (v_time_to_cycles(v, | |
| 473 | 473 | } |
| 474 | 474 | break; |
| 475 | 475 | |
| 476 | 476 | case VIA_T1CH: |
| 477 | 477 | if (v->t1_active) |
| 478 | val = v_time_to_cycles(v, | |
| 478 | val = v_time_to_cycles(v, | |
| 479 | 479 | else |
| 480 | 480 | { |
| 481 | 481 | if ( T1_CONTINUOUS(v->acr) ) |
| 482 | val = (TIMER1_VALUE(v)- (v_time_to_cycles(v, | |
| 482 | val = (TIMER1_VALUE(v)- (v_time_to_cycles(v, | |
| 483 | 483 | else |
| 484 | val = (0x10000- (v_time_to_cycles(v, | |
| 484 | val = (0x10000- (v_time_to_cycles(v, | |
| 485 | 485 | } |
| 486 | 486 | break; |
| 487 | 487 | |
| r1293 | r1294 | |
| 496 | 496 | case VIA_T2CL: |
| 497 | 497 | via_clear_int (which, INT_T2); |
| 498 | 498 | if (v->t2_active) |
| 499 | val = v_time_to_cycles(v, | |
| 499 | val = v_time_to_cycles(v, | |
| 500 | 500 | else |
| 501 | 501 | { |
| 502 | 502 | if (T2_COUNT_PB6(v->acr)) |
| 503 | 503 | val = v->t2cl; |
| 504 | 504 | else |
| 505 | val = (0x10000- (v_time_to_cycles(v, | |
| 505 | val = (0x10000- (v_time_to_cycles(v, | |
| 506 | 506 | } |
| 507 | 507 | break; |
| 508 | 508 | |
| 509 | 509 | case VIA_T2CH: |
| 510 | 510 | if (v->t2_active) |
| 511 | val = v_time_to_cycles(v, | |
| 511 | val = v_time_to_cycles(v, | |
| 512 | 512 | else |
| 513 | 513 | { |
| 514 | 514 | if (T2_COUNT_PB6(v->acr)) |
| 515 | 515 | val = v->t2ch; |
| 516 | 516 | else |
| 517 | val = (0x10000- (v_time_to_cycles(v, | |
| 517 | val = (0x10000- (v_time_to_cycles(v, | |
| 518 | 518 | } |
| 519 | 519 | break; |
| 520 | 520 | |
| r1293 | r1294 | |
| 524 | 524 | if (SO_O2_CONTROL(v->acr)) |
| 525 | 525 | { |
| 526 | 526 | v->shift_counter=0; |
| 527 | | |
| 527 | | |
| 528 | 528 | } |
| 529 | 529 | break; |
| 530 | 530 | |
| r1293 | r1294 | |
| 723 | 723 | logerror("6522VIA chip %d: Port B is being written to but has no handler. PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data); |
| 724 | 724 | } |
| 725 | 725 | } |
| 726 | | |
| 726 | | |
| 727 | 727 | v->t1_active = 1; |
| 728 | 728 | break; |
| 729 | 729 | |
| r1293 | r1294 | |
| 739 | 739 | |
| 740 | 740 | if (!T2_COUNT_PB6(v->acr)) |
| 741 | 741 | { |
| 742 | | |
| 742 | | |
| 743 | 743 | v->t2_active = 1; |
| 744 | 744 | } |
| 745 | 745 | else |
| 746 | 746 | { |
| 747 | v->time2 = | |
| 747 | v->time2 = | |
| 748 | 748 | } |
| 749 | 749 | break; |
| 750 | 750 | |
| r1293 | r1294 | |
| 754 | 754 | via_clear_int(which, INT_SR); |
| 755 | 755 | if (SO_O2_CONTROL(v->acr)) |
| 756 | 756 | { |
| 757 | | |
| 757 | | |
| 758 | 758 | } |
| 759 | 759 | break; |
| 760 | 760 | |
| r1293 | r1294 | |
| 804 | 804 | } |
| 805 | 805 | if (T1_CONTINUOUS(data)) |
| 806 | 806 | { |
| 807 | | |
| 807 | | |
| 808 | 808 | v->t1_active = 1; |
| 809 | 809 | } |
| 810 | 810 | break; |
| r1293 | r1294 | |
|---|---|---|
| 185 | 185 | UINT8 busphase; |
| 186 | 186 | UINT8 identify; |
| 187 | 187 | int read_pending; |
| 188 | | |
| 188 | | |
| 189 | 189 | } _wd33c93_data; |
| 190 | 190 | |
| 191 | 191 | /* local instance of controller data */ |
| r1293 | r1294 | |
| 237 | 237 | static void wd33c93_complete_immediate( int status ) |
| 238 | 238 | { |
| 239 | 239 | /* reset our timer */ |
| 240 | | |
| 240 | | |
| 241 | 241 | |
| 242 | 242 | /* set the new status */ |
| 243 | 243 | scsi_data.regs[WD_SCSI_STATUS] = status & 0xff; |
| r1293 | r1294 | |
| 286 | 286 | static void wd33c93_complete_cmd( UINT8 status ) |
| 287 | 287 | { |
| 288 | 288 | /* fire off a timer to complete the command */ |
| 289 | | |
| 289 | | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /* command handlers */ |
| r1293 | r1294 | |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /* queue up a service request out in the future */ |
| 354 | | |
| 354 | | |
| 355 | 355 | } |
| 356 | 356 | else |
| 357 | 357 | { |
| r1293 | r1294 | |
| 423 | 423 | scsi_data.busphase = PHS_MESS_IN; |
| 424 | 424 | |
| 425 | 425 | /* queue up a service request out in the future */ |
| 426 | | |
| 426 | | |
| 427 | 427 | } |
| 428 | 428 | } |
| 429 | 429 | else |
| r1293 | r1294 | |
| 453 | 453 | scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_CIP; |
| 454 | 454 | |
| 455 | 455 | /* the command will be completed once the data is transferred */ |
| 456 | | |
| 456 | | |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /* Command handlers */ |
| r1293 | r1294 | |
| 802 | 802 | } |
| 803 | 803 | |
| 804 | 804 | /* allocate a timer for commands */ |
| 805 | scsi_data.cmd_timer = | |
| 805 | scsi_data.cmd_timer = | |
| 806 | 806 | |
| 807 | 807 | scsi_data.temp_input = auto_malloc( TEMP_INPUT_LEN ); |
| 808 | 808 |
| r1293 | r1294 | |
|---|---|---|
| 91 | 91 | #define STOP_SPEED INT_TO_FRAC(0) /* no movement */ |
| 92 | 92 | #define PLAY_SPEED INT_TO_FRAC(1) /* regular playback speed */ |
| 93 | 93 | |
| 94 | #define GENERIC_SPINUP_TIME (make_mame_time(3, 0)) | |
| 95 | #define GENERIC_LOAD_TIME (make_mame_time(10, 0)) | |
| 94 | #define GENERIC_SPINUP_TIME (attotime_make(3, 0)) | |
| 95 | #define GENERIC_LOAD_TIME (attotime_make(10, 0)) | |
| 96 | 96 | #define GENERIC_RESET_SPEED INT_TO_FRAC(5000) |
| 97 | 97 | |
| 98 | 98 | /* Pioneer PR-7820 specific states */ |
| r1293 | r1294 | |
| 161 | 161 | { |
| 162 | 162 | UINT8 mode; /* current mode */ |
| 163 | 163 | UINT16 commandtriplet[3]; /* current command triplet */ |
| 164 | | |
| 164 | | |
| 165 | 165 | UINT8 commandbits; /* command bit count */ |
| 166 | 166 | UINT8 seekstate; /* state of the seek command */ |
| 167 | 167 | }; |
| r1293 | r1294 | |
| 251 | 251 | UINT8 video; /* video state: bit 0 = on/off */ |
| 252 | 252 | UINT8 audio; /* audio state: bit 0 = audio 1, bit 1 = audio 2 */ |
| 253 | 253 | UINT8 display; /* display state: bit 0 = on/off */ |
| 254 | | |
| 254 | | |
| 255 | 255 | |
| 256 | 256 | /* deferred states */ |
| 257 | | |
| 257 | | |
| 258 | 258 | UINT8 postholdstate; /* state to switch into after holding */ |
| 259 | 259 | INT32 postholdfracspeed; /* speed after the hold */ |
| 260 | 260 | |
| r1293 | r1294 | |
| 533 | 533 | INLINE void set_state(laserdisc_info *info, laserdisc_state state, INT32 fracspeed, INT32 targetframe) |
| 534 | 534 | { |
| 535 | 535 | info->holdfinished.seconds = 0; |
| 536 | info->holdfinished. | |
| 536 | info->holdfinished.attoseconds = 0; | |
| 537 | 537 | info->state = state; |
| 538 | 538 | info->curfracspeed = fracspeed; |
| 539 | 539 | info->targetframe = targetframe; |
| r1293 | r1294 | |
| 545 | 545 | a playback state to follow |
| 546 | 546 | -------------------------------------------------*/ |
| 547 | 547 | |
| 548 | INLINE void set_hold_state(laserdisc_info *info, | |
| 548 | INLINE void set_hold_state(laserdisc_info *info, | |
| 549 | 549 | { |
| 550 | info->holdfinished = a | |
| 550 | info->holdfinished = a | |
| 551 | 551 | info->postholdstate = state; |
| 552 | 552 | info->postholdfracspeed = fracspeed; |
| 553 | 553 | } |
| r1293 | r1294 | |
| 832 | 832 | UINT8 hittarget; |
| 833 | 833 | |
| 834 | 834 | /* remember the time */ |
| 835 | info->lastvsynctime = | |
| 835 | info->lastvsynctime = | |
| 836 | 836 | |
| 837 | 837 | /* if we're holding, stay in this state until finished */ |
| 838 | if (info->holdfinished.seconds != 0 || info->holdfinished. | |
| 838 | if (info->holdfinished.seconds != 0 || info->holdfinished.attoseconds != 0) | |
| 839 | 839 | { |
| 840 | if (compare | |
| 840 | if (attotime_compare | |
| 841 | 841 | return; |
| 842 | 842 | info->state = info->postholdstate; |
| 843 | 843 | info->curfracspeed = info->postholdfracspeed; |
| 844 | 844 | info->holdfinished.seconds = 0; |
| 845 | info->holdfinished. | |
| 845 | info->holdfinished.attoseconds = 0; | |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | /* wait for previous read and decode to finish */ |
| r1293 | r1294 | |
| 1798 | 1798 | INT32 prevspeed = info->curfracspeed; |
| 1799 | 1799 | set_state(info, LASERDISC_STOPPED, STOP_SPEED, NULL_TARGET_FRAME); |
| 1800 | 1800 | if (info->parameter != -1) |
| 1801 | set_hold_state(info, double_to_ | |
| 1801 | set_hold_state(info, double_to_ | |
| 1802 | 1802 | } |
| 1803 | 1803 | break; |
| 1804 | 1804 | |
| r1293 | r1294 | |
| 1960 | 1960 | info->audio = AUDIO_CH1_ENABLE | AUDIO_CH2_ENABLE; |
| 1961 | 1961 | info->display = 0; |
| 1962 | 1962 | pr8210->mode = PR8210_MODE_GET_1ST; |
| 1963 | pr8210->commandtime = | |
| 1963 | pr8210->commandtime = | |
| 1964 | 1964 | pr8210->commandbits = 0; |
| 1965 | 1965 | memset( pr8210->commandtriplet, 0, 3*sizeof(UINT16) ); |
| 1966 | 1966 | pr8210->seekstate = 0; |
| r1293 | r1294 | |
| 2165 | 2165 | if ( data == ASSERT_LINE ) |
| 2166 | 2166 | { |
| 2167 | 2167 | /* get the time difference from the last assert */ |
| 2168 | | |
| 2168 | | |
| 2169 | 2169 | |
| 2170 | 2170 | /* and update our internal command time */ |
| 2171 | pr8210->commandtime = | |
| 2171 | pr8210->commandtime = | |
| 2172 | 2172 | |
| 2173 | 2173 | #if 0 |
| 2174 | 2174 | { |
| 2175 | int usecdiff = (int)(delta.s | |
| 2175 | int usecdiff = (int)(delta.attos | |
| 2176 | 2176 | |
| 2177 | 2177 | printf( "bitdelta = %d\n", usecdiff ); |
| 2178 | 2178 | } |
| 2179 | 2179 | #endif |
| 2180 | 2180 | |
| 2181 | 2181 | /* if the delay is less than 3 msec, we're receiving data */ |
| 2182 | if ( delta.s | |
| 2182 | if ( delta.attos | |
| 2183 | 2183 | { |
| 2184 | 2184 | /* 0 bit delta is 1.05 msec, 1 bit delta is 2.11 msec */ |
| 2185 | int longpulse = ( delta.s | |
| 2185 | int longpulse = ( delta.attos | |
| 2186 | 2186 | pr8210->commandtriplet[pr8210->mode] <<= 1; |
| 2187 | 2187 | pr8210->commandtriplet[pr8210->mode] |= longpulse; |
| 2188 | 2188 | |
| r1293 | r1294 | |
| 2508 | 2508 | INT32 prevspeed = info->curfracspeed; |
| 2509 | 2509 | set_state(info, LASERDISC_STOPPED, STOP_SPEED, NULL_TARGET_FRAME); |
| 2510 | 2510 | if (info->parameter != -1) |
| 2511 | set_hold_state(info, double_to_ | |
| 2511 | set_hold_state(info, double_to_ | |
| 2512 | 2512 | } |
| 2513 | 2513 | break; |
| 2514 | 2514 | |
| r1293 | r1294 | |
| 2569 | 2569 | { |
| 2570 | 2570 | /* the status strobe is asserted (active low) 500-650usec after VSYNC */ |
| 2571 | 2571 | /* for a duration of 26usec; we pick 600-626usec */ |
| 2572 | mame_time delta = sub_mame_times(mame_timer_get_time(), info->lastvsynctime); | |
| 2573 | if (delta.subseconds >= MAME_TIME_IN_USEC(600).subseconds && | |
| 2574 | delta.subseconds < MAME_TIME_IN_USEC(626).subseconds) | |
| 2572 | attotime delta = attotime_sub(timer_get_time(), info->lastvsynctime); | |
| 2573 | if (delta.attoseconds >= ATTOTIME_IN_USEC(600).attoseconds && | |
| 2574 | delta.attoseconds < ATTOTIME_IN_USEC(626).attoseconds) | |
| 2575 | 2575 | return ASSERT_LINE; |
| 2576 | 2576 | |
| 2577 | 2577 | return CLEAR_LINE; |
| r1293 | r1294 | |
| 2588 | 2588 | /* the command strobe is asserted (active low) 54 or 84usec after the status */ |
| 2589 | 2589 | /* strobe for a duration of 25usec; we pick 600+84 = 684-709usec */ |
| 2590 | 2590 | /* for a duration of 26usec; we pick 600-626usec */ |
| 2591 | mame_time delta = sub_mame_times(mame_timer_get_time(), info->lastvsynctime); | |
| 2592 | if (delta.subseconds >= MAME_TIME_IN_USEC(684).subseconds && | |
| 2593 | delta.subseconds < MAME_TIME_IN_USEC(709).subseconds) | |
| 2591 | attotime delta = attotime_sub(timer_get_time(), info->lastvsynctime); | |
| 2592 | if (delta.attoseconds >= ATTOTIME_IN_USEC(684).attoseconds && | |
| 2593 | delta.attoseconds < ATTOTIME_IN_USEC(709).attoseconds) | |
| 2594 | 2594 | return ASSERT_LINE; |
| 2595 | 2595 | |
| 2596 | 2596 | return CLEAR_LINE; |
| r1293 | r1294 | |
|---|---|---|
| 32 | 32 | |
| 33 | 33 | struct pic8259 |
| 34 | 34 | { |
| 35 | | |
| 35 | | |
| 36 | 36 | void (*set_int_line)(int which, int interrupt); |
| 37 | 37 | |
| 38 | 38 | pic8259_state_t state; |
| r1293 | r1294 | |
| 81 | 81 | |
| 82 | 82 | for (i = 0; i < count; i++) |
| 83 | 83 | { |
| 84 | pic[i].timer = | |
| 84 | pic[i].timer = | |
| 85 | 85 | pic[i].set_int_line = set_int_line; |
| 86 | 86 | } |
| 87 | 87 | |
| r1293 | r1294 | |
| 128 | 128 | |
| 129 | 129 | static void pic8259_set_timer(int which) |
| 130 | 130 | { |
| 131 | | |
| 131 | | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 |
| r1293 | r1294 | |
|---|---|---|
| 42 | 42 | INT32 flash_master_lock; |
| 43 | 43 | int device_id; |
| 44 | 44 | int maker_id; |
| 45 | | |
| 45 | | |
| 46 | 46 | void *flash_memory; |
| 47 | 47 | }; |
| 48 | 48 | |
| r1293 | r1294 | |
| 131 | 131 | c->status = 0x80; |
| 132 | 132 | c->flash_mode = FM_NORMAL; |
| 133 | 133 | c->flash_master_lock = 0; |
| 134 | c->timer = | |
| 134 | c->timer = | |
| 135 | 135 | c->flash_memory = data; |
| 136 | 136 | |
| 137 | 137 | state_save_register_item( "intelfsh", chip, c->status ); |
| r1293 | r1294 | |
| 335 | 335 | c->status = 1 << 3; |
| 336 | 336 | c->flash_mode = FM_ERASEAMD4; |
| 337 | 337 | |
| 338 | | |
| 338 | | |
| 339 | 339 | } |
| 340 | 340 | else if( ( data & 0xff ) == 0x30 ) |
| 341 | 341 | { |
| r1293 | r1294 | |
| 360 | 360 | c->status = 1 << 3; |
| 361 | 361 | c->flash_mode = FM_ERASEAMD4; |
| 362 | 362 | |
| 363 | | |
| 363 | | |
| 364 | 364 | } |
| 365 | 365 | else |
| 366 | 366 | { |
| r1293 | r1294 | |
| 429 | 429 | c->status = 0x00; |
| 430 | 430 | c->flash_mode = FM_READSTATUS; |
| 431 | 431 | |
| 432 | | |
| 432 | | |
| 433 | 433 | break; |
| 434 | 434 | } |
| 435 | 435 | else |
| r1293 | r1294 | |
|---|---|---|
| 42 | 42 | int rx; |
| 43 | 43 | int tx; |
| 44 | 44 | UINT8 *data; |
| 45 | mame_timer *timer; | |
| 46 | mame_timer *reset_timer; | |
| 47 | mame_time t_samp; | |
| 48 | mame_time t_rdv; | |
| 49 | mame_time t_rstl; | |
| 50 | mame_time t_pdh; | |
| 51 | mame_time t_pdl; | |
| 45 | emu_timer *timer; | |
| 46 | emu_timer *reset_timer; | |
| 47 | attotime t_samp; | |
| 48 | attotime t_rdv; | |
| 49 | attotime t_rstl; | |
| 50 | attotime t_pdh; | |
| 51 | attotime t_pdl; | |
| 52 | 52 | }; |
| 53 | 53 | |
| 54 | 54 | #define SIZE_DATA ( 8 ) |
| r1293 | r1294 | |
| 72 | 72 | verboselog( 1, "ds2401_reset(%d)\n", which ); |
| 73 | 73 | |
| 74 | 74 | c->state = STATE_RESET; |
| 75 | | |
| 75 | | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | static TIMER_CALLBACK( ds2401_tick ) |
| r1293 | r1294 | |
| 86 | 86 | verboselog( 2, "ds2401_tick(%d) state_reset1 %d\n", which, c->rx ); |
| 87 | 87 | c->tx = 0; |
| 88 | 88 | c->state = STATE_RESET2; |
| 89 | | |
| 89 | | |
| 90 | 90 | break; |
| 91 | 91 | case STATE_RESET2: |
| 92 | 92 | verboselog( 2, "ds2401_tick(%d) state_reset2 %d\n", which, c->rx ); |
| r1293 | r1294 | |
| 154 | 154 | c->rx = 1; |
| 155 | 155 | c->tx = 1; |
| 156 | 156 | c->data = data; |
| 157 | c->t_samp = MAME_TIME_IN_USEC( 15 ); | |
| 158 | c->t_rdv = MAME_TIME_IN_USEC( 15 ); | |
| 159 | c->t_rstl = MAME_TIME_IN_USEC( 480 ); | |
| 160 | c->t_pdh = MAME_TIME_IN_USEC( 15 ); | |
| 161 | c->t_pdl = MAME_TIME_IN_USEC( 60 ); | |
| 157 | c->t_samp = ATTOTIME_IN_USEC( 15 ); | |
| 158 | c->t_rdv = ATTOTIME_IN_USEC( 15 ); | |
| 159 | c->t_rstl = ATTOTIME_IN_USEC( 480 ); | |
| 160 | c->t_pdh = ATTOTIME_IN_USEC( 15 ); | |
| 161 | c->t_pdl = ATTOTIME_IN_USEC( 60 ); | |
| 162 | 162 | |
| 163 | 163 | state_save_register_item( "ds2401", which, c->state ); |
| 164 | 164 | state_save_register_item( "ds2401", which, c->bit ); |
| r1293 | r1294 | |
| 168 | 168 | state_save_register_item( "ds2401", which, c->tx ); |
| 169 | 169 | state_save_register_item_pointer( "ds2401", which, data, SIZE_DATA ); |
| 170 | 170 | |
| 171 | c->timer = mame_timer_alloc( ds2401_tick ); | |
| 172 | c->reset_timer = mame_timer_alloc( ds2401_reset ); | |
| 171 | c->timer = timer_alloc( ds2401_tick ); | |
| 172 | c->reset_timer = timer_alloc( ds2401_reset ); | |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | void ds2401_write( int which, int data ) |
| r1293 | r1294 | |
| 186 | 186 | break; |
| 187 | 187 | case STATE_COMMAND: |
| 188 | 188 | verboselog( 2, "ds2401_write(%d) state_command\n", which ); |
| 189 | | |
| 189 | | |
| 190 | 190 | break; |
| 191 | 191 | case STATE_READROM: |
| 192 | 192 | if( c->bit == 0 ) |
| r1293 | r1294 | |
| 203 | 203 | c->byte++; |
| 204 | 204 | } |
| 205 | 205 | verboselog( 2, "ds2401_write(%d) state_readrom %d\n", which, c->tx ); |
| 206 | | |
| 206 | | |
| 207 | 207 | break; |
| 208 | 208 | default: |
| 209 | 209 | verboselog( 0, "ds2401_write(%d) state not handled: %d\n", which, c->state ); |
| 210 | 210 | break; |
| 211 | 211 | } |
| 212 | | |
| 212 | | |
| 213 | 213 | } |
| 214 | 214 | else if( data == 1 && c->rx == 0 ) |
| 215 | 215 | { |
| r1293 | r1294 | |
| 217 | 217 | { |
| 218 | 218 | case STATE_RESET: |
| 219 | 219 | c->state = STATE_RESET1; |
| 220 | | |
| 220 | | |
| 221 | 221 | break; |
| 222 | 222 | } |
| 223 | | |
| 223 | | |
| 224 | 224 | } |
| 225 | 225 | c->rx = data; |
| 226 | 226 | } |
| r1293 | r1294 | |
|---|---|---|
| 79 | 79 | int external_clock[3]; |
| 80 | 80 | |
| 81 | 81 | // each PTM has 3 timers |
| 82 | | |
| 82 | | |
| 83 | 83 | |
| 84 | 84 | UINT16 latch[3]; |
| 85 | 85 | UINT16 counter[3]; |
| r1293 | r1294 | |
| 164 | 164 | |
| 165 | 165 | /* store the result */ |
| 166 | 166 | currptr->counter[counter] = (msb << 8) | lsb; |
| 167 | | |
| 167 | | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /* word mode */ |
| 171 | 171 | else |
| 172 | 172 | { |
| 173 | | |
| 173 | | |
| 174 | 174 | int word = currptr->counter[counter]; |
| 175 | 175 | |
| 176 | 176 | /* count the clocks */ |
| r1293 | r1294 | |
| 188 | 188 | |
| 189 | 189 | /* store the result */ |
| 190 | 190 | currptr->counter[counter] = word; |
| 191 | duration = scale_up_mame_time(MAME_TIME_IN_HZ(clock), currptr->counter[counter]); | |
| 192 | if (counter == 2) duration = scale_up_mame_time(duration, currptr->t3_divisor); | |
| 193 | mame_timer_adjust(currptr->timer[counter], duration, which, time_zero); | |
| 191 | duration = attotime_mul(ATTOTIME_IN_HZ(clock), currptr->counter[counter]); | |
| 192 | if (counter == 2) duration = attotime_mul(duration, currptr->t3_divisor); | |
| 193 | timer_adjust(currptr->timer[counter], duration, which, attotime_zero); | |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| r1293 | r1294 | |
| 246 | 246 | PLOG(("MC6840 #%d: %d external clock freq %d \n", which,counter,clock)); |
| 247 | 247 | } |
| 248 | 248 | /* see how many are left */ |
| 249 | remaining = | |
| 249 | remaining = | |
| 250 | 250 | |
| 251 | 251 | /* adjust the count for dual byte mode */ |
| 252 | 252 | if (currptr->control_reg[counter] & 0x04) |
| r1293 | r1294 | |
| 270 | 270 | { |
| 271 | 271 | int clock; |
| 272 | 272 | int count; |
| 273 | | |
| 273 | | |
| 274 | 274 | ptm6840 *currptr = ptm + which; |
| 275 | 275 | |
| 276 | 276 | /* copy the latched value in */ |
| r1293 | r1294 | |
| 306 | 306 | /* set the timer */ |
| 307 | 307 | PLOG(("MC6840 #%d: reload_count(%d): clock = %d count = %d\n", which, idx, clock, count)); |
| 308 | 308 | |
| 309 | duration = scale_up_mame_time(MAME_TIME_IN_HZ(clock), count); | |
| 310 | if (idx == 2) duration = scale_up_mame_time(duration, currptr->t3_divisor); | |
| 311 | mame_timer_adjust(currptr->timer[idx], duration, which, time_zero); | |
| 312 | PLOG(("MC6840 #%d: reload_count(%d): output = %lf\n", which, idx, mame_time_to_double(duration))); | |
| 309 | duration = attotime_mul(ATTOTIME_IN_HZ(clock), count); | |
| 310 | if (idx == 2) duration = attotime_mul(duration, currptr->t3_divisor); | |
| 311 | timer_adjust(currptr->timer[idx], duration, which, attotime_zero); | |
| 312 | PLOG(("MC6840 #%d: reload_count(%d): output = %lf\n", which, idx, attotime_to_double(duration))); | |
| 313 | 313 | |
| 314 | 314 | if (!currptr->control_reg[idx] & 0x02) |
| 315 | 315 | { |
| 316 | 316 | if (!currptr->intf->external_clock[idx]) |
| 317 | 317 | { |
| 318 | 318 | currptr->enabled[idx] = 0; |
| 319 | | |
| 319 | | |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | else |
| 323 | 323 | { |
| 324 | 324 | currptr->enabled[idx] = 1; |
| 325 | | |
| 325 | | |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
| r1293 | r1294 | |
| 355 | 355 | } |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | ptm[which].timer[0] = mame_timer_alloc(ptm6840_t1_timeout); | |
| 359 | ptm[which].timer[1] = mame_timer_alloc(ptm6840_t2_timeout); | |
| 360 | ptm[which].timer[2] = mame_timer_alloc(ptm6840_t3_timeout); | |
| 358 | ptm[which].timer[0] = timer_alloc(ptm6840_t1_timeout); | |
| 359 | ptm[which].timer[1] = timer_alloc(ptm6840_t2_timeout); | |
| 360 | ptm[which].timer[2] = timer_alloc(ptm6840_t3_timeout); | |
| 361 | 361 | |
| 362 | 362 | for (i = 0; i < 3; i++) |
| 363 | | |
| 363 | | |
| 364 | 364 | |
| 365 | 365 | state_save_register_item("6840ptm", which, currptr->lsb_buffer); |
| 366 | 366 | state_save_register_item("6840ptm", which, currptr->msb_buffer); |
| r1293 | r1294 | |
| 521 | 521 | PLOG(("MC6840 #%d : Timer reset\n",which)); |
| 522 | 522 | for (i = 0; i < 3; i++) |
| 523 | 523 | { |
| 524 | | |
| 524 | | |
| 525 | 525 | currptr->enabled[i]=0; |
| 526 | 526 | } |
| 527 | 527 | } |
| r1293 | r1294 | |
|---|---|---|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | |
| 305 | void pd4990a_serial_control(UINT8 data) | |
| 305 | static void pd4990a_serial_control(UINT8 data) | |
| 306 | 306 | { |
| 307 | 307 | //Check for command end |
| 308 | 308 | if(command_line && !(data&END_BIT)) //end of command |
| r1293 | r1294 | |
|---|---|---|
| 159 | 159 | case 3: // reset SCSI bus |
| 160 | 160 | scsi_regs[REG_INTSTATE] = 4; // command sent OK |
| 161 | 161 | xfer_state = 0; |
| 162 | | |
| 162 | | |
| 163 | 163 | break; |
| 164 | 164 | case 0x42: // select with ATN steps |
| 165 | | |
| 165 | | |
| 166 | 166 | if ((fifo[1] == 0) || (fifo[1] == 0x48) || (fifo[1] == 0x4b)) |
| 167 | 167 | { |
| 168 | 168 | scsi_regs[REG_INTSTATE] = 6; |
| r1293 | r1294 | |
| 192 | 192 | case 0x10: // information transfer (must not change xfer_state) |
| 193 | 193 | case 0x11: // second phase of information transfer |
| 194 | 194 | case 0x12: // message accepted |
| 195 | | |
| 195 | | |
| 196 | 196 | scsi_regs[REG_INTSTATE] = 6; // command sent OK |
| 197 | 197 | break; |
| 198 | 198 | default: |
| r1293 | r1294 | |
|---|---|---|
| 47 | 47 | int tx_fifo_read_ptr; |
| 48 | 48 | int tx_fifo_write_ptr; |
| 49 | 49 | int tx_fifo_num; |
| 50 | | |
| 50 | | |
| 51 | 51 | } PC16552D_CHANNEL; |
| 52 | 52 | |
| 53 | 53 | typedef struct |
| r1293 | r1294 | |
| 152 | 152 | ch->pending_interrupt |= IRQ_TX_HOLDING_REG_EMPTY; |
| 153 | 153 | check_interrupts(chip, channel); |
| 154 | 154 | |
| 155 | | |
| 155 | | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | static void duart_push_tx_fifo(int chip, int channel, UINT8 data) |
| 159 | 159 | { |
| 160 | | |
| 160 | | |
| 161 | 161 | PC16552D_CHANNEL *ch = &duart[chip].ch[channel]; |
| 162 | 162 | |
| 163 | 163 | ch->tx_fifo_num++; |
| 164 | 164 | |
| 165 | period = | |
| 165 | period = | |
| 166 | 166 | |
| 167 | | |
| 167 | | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | #ifdef UNUSED_FUNCTION |
| r1293 | r1294 | |
| 394 | 394 | duart[chip].ch[1].pending_interrupt = 0; |
| 395 | 395 | |
| 396 | 396 | // allocate transmit timers |
| 397 | duart[chip].ch[0].tx_fifo_timer = mame_timer_alloc(tx_fifo_timer_callback); | |
| 398 | mame_timer_adjust(duart[chip].ch[0].tx_fifo_timer, time_never, (chip * 2) + 0, time_never); | |
| 397 | duart[chip].ch[0].tx_fifo_timer = timer_alloc(tx_fifo_timer_callback); | |
| 398 | timer_adjust(duart[chip].ch[0].tx_fifo_timer, attotime_never, (chip * 2) + 0, attotime_never); | |
| 399 | 399 | |
| 400 | duart[chip].ch[1].tx_fifo_timer = mame_timer_alloc(tx_fifo_timer_callback); | |
| 401 | mame_timer_adjust(duart[chip].ch[1].tx_fifo_timer, time_never, (chip * 2) + 1, time_never); | |
| 400 | duart[chip].ch[1].tx_fifo_timer = timer_alloc(tx_fifo_timer_callback); | |
| 401 | timer_adjust(duart[chip].ch[1].tx_fifo_timer, attotime_never, (chip * 2) + 1, attotime_never); | |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | void pc16552d_rx_data(int chip, int channel, UINT8 data) |
| r1293 | r1294 | |
|---|---|---|
| 280 | 280 | kbdc8042.inport = 0xa0; |
| 281 | 281 | at_8042_set_outport(0xfe, 1); |
| 282 | 282 | |
| 283 | | |
| 283 | | |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | static void at_8042_receive(int data) |
| r1293 | r1294 | |
| 522 | 522 | break; |
| 523 | 523 | case 0xaa: /* selftest */ |
| 524 | 524 | if (Machine->drv->cpu[0].type == CPU_I486) |
| 525 | | |
| 525 | | |
| 526 | 526 | else |
| 527 | 527 | at_8042_receive(0x55); |
| 528 | 528 | break; |
| r1293 | r1294 | |
|---|---|---|
| 25 | 25 | struct dma8237 |
| 26 | 26 | { |
| 27 | 27 | const struct dma8237_interface *intf; |
| 28 | mame_timer *timer; | |
| 29 | mame_timer *msbflip_timer; | |
| 28 | emu_timer *timer; | |
| 29 | emu_timer *msbflip_timer; | |
| 30 | 30 | |
| 31 | 31 | struct |
| 32 | 32 | { |
| r1293 | r1294 | |
| 75 | 75 | for (which = 0; which < dma_count; which++) |
| 76 | 76 | { |
| 77 | 77 | dma[which].status = 0x0F; |
| 78 | dma[which].timer = mame_timer_alloc(dma8237_timerproc); | |
| 79 | dma[which].msbflip_timer = mame_timer_alloc(dma8237_msbflip_timerproc); | |
| 78 | dma[which].timer = timer_alloc(dma8237_timerproc); | |
| 79 | dma[which].msbflip_timer = timer_alloc(dma8237_msbflip_timerproc); | |
| 80 | 80 | dma[which].eop = 1; |
| 81 | 81 | } |
| 82 | 82 | return 0; |
| r1293 | r1294 | |
| 195 | 195 | dma[which].status |= 0x10 << channel; |
| 196 | 196 | dma[which].status &= ~(0x01 << channel); |
| 197 | 197 | |
| 198 | mame_timer_adjust(dma[which].timer, | |
| 199 | time_zero, | |
| 198 | timer_adjust(dma[which].timer, | |
| 199 | attotime_zero, | |
| 200 | 200 | which * 4 + channel, |
| 201 | double_to_ | |
| 201 | double_to_ | |
| 202 | 202 | } |
| 203 | 203 | else |
| 204 | 204 | { |
| 205 | 205 | /* no transfers active right now */ |
| 206 | | |
| 206 | | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /* set the halt line */ |
| r1293 | r1294 | |
| 236 | 236 | |
| 237 | 237 | static void prepare_msb_flip(int which) |
| 238 | 238 | { |
| 239 | | |
| 239 | | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 |
| r1293 | r1294 | |
|---|---|---|
| 170 | 170 | int inbuf; /* input buffer */ |
| 171 | 171 | int outbuf; /* output buffer */ |
| 172 | 172 | UINT8 int_on_next_rx; /* interrupt on next rx? */ |
| 173 | | |
| 173 | | |
| 174 | 174 | UINT8 receive_buffer[16]; /* buffer for incoming data */ |
| 175 | 175 | UINT8 receive_inptr; /* index of data coming in */ |
| 176 | 176 | UINT8 receive_outptr; /* index of data going out */ |
| r1293 | r1294 | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | |
| 275 | INLINE | |
| 275 | INLINE | |
| 276 | 276 | { |
| 277 | 277 | /* fix me -- should compute properly and include data, stop, parity bits */ |
| 278 | return | |
| 278 | return | |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | |
| r1293 | r1294 | |
| 296 | 296 | |
| 297 | 297 | memset(sio, 0, sizeof(*sio)); |
| 298 | 298 | |
| 299 | sio->chan[0].receive_timer = mame_timer_alloc(serial_callback); | |
| 300 | sio->chan[1].receive_timer = mame_timer_alloc(serial_callback); | |
| 299 | sio->chan[0].receive_timer = timer_alloc(serial_callback); | |
| 300 | sio->chan[1].receive_timer = timer_alloc(serial_callback); | |
| 301 | 301 | |
| 302 | 302 | sio->irq_cb = intf->irq_cb; |
| 303 | 303 | sio->dtr_changed_cb = intf->dtr_changed_cb; |
| r1293 | r1294 | |
| 316 | 316 | |
| 317 | 317 | static void reset_channel(z80sio *sio, int ch) |
| 318 | 318 | { |
| 319 | | |
| 319 | | |
| 320 | 320 | sio_channel *chan = &sio->chan[ch]; |
| 321 | 321 | |
| 322 | 322 | chan->status[0] = SIO_RR0_TX_BUFFER_EMPTY; |
| r1293 | r1294 | |
| 333 | 333 | interrupt_check(sio); |
| 334 | 334 | |
| 335 | 335 | /* start the receive timer running */ |
| 336 | | |
| 336 | | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 |
| r1293 | r1294 | |
|---|---|---|
| 14 | 14 | UINT16 *tmp68301_regs; |
| 15 | 15 | |
| 16 | 16 | static UINT8 tmp68301_IE[3]; // 3 External Interrupt Lines |
| 17 | static | |
| 17 | static | |
| 18 | 18 | |
| 19 | 19 | static int tmp68301_irq_vector[8]; |
| 20 | 20 | |
| 21 | void tmp68301_update_timer( int i ); | |
| 21 | static void tmp68301_update_timer( int i ); | |
| 22 | 22 | |
| 23 | int tmp68301_irq_callback(int int_level) | |
| 23 | static int tmp68301_irq_callback(int int_level) | |
| 24 | 24 | { |
| 25 | 25 | int vector = tmp68301_irq_vector[int_level]; |
| 26 | 26 | // logerror("CPU #0 PC %06X: irq callback returns %04X for level %x\n",activecpu_get_pc(),vector,int_level); |
| r1293 | r1294 | |
| 68 | 68 | UINT16 MAX2 = tmp68301_regs[(0x206 + i * 0x20)/2]; |
| 69 | 69 | |
| 70 | 70 | int max = 0; |
| 71 | | |
| 71 | | |
| 72 | 72 | |
| 73 | | |
| 73 | | |
| 74 | 74 | |
| 75 | 75 | // timers 1&2 only |
| 76 | 76 | switch( (TCR & 0x0030)>>4 ) // MR2..1 |
| r1293 | r1294 | |
| 90 | 90 | { |
| 91 | 91 | int scale = (TCR & 0x3c00)>>10; // P4..1 |
| 92 | 92 | if (scale > 8) scale = 8; |
| 93 | duration = | |
| 93 | duration = | |
| 94 | 94 | } |
| 95 | 95 | break; |
| 96 | 96 | } |
| r1293 | r1294 | |
| 99 | 99 | |
| 100 | 100 | if (!(TCR & 0x0002)) // CS |
| 101 | 101 | { |
| 102 | if (compare_mame_times(duration, time_zero)) | |
| 103 | mame_timer_adjust(tmp68301_timer[i],duration,i,time_zero); | |
| 102 | if (attotime_compare(duration, attotime_zero)) | |
| 103 | timer_adjust(tmp68301_timer[i],duration,i,attotime_zero); | |
| 104 | 104 | else |
| 105 | 105 | logerror("CPU #0 PC %06X: TMP68301 error, timer %d duration is 0\n",activecpu_get_pc(),i); |
| 106 | 106 | } |
| r1293 | r1294 | |
| 110 | 110 | { |
| 111 | 111 | int i; |
| 112 | 112 | for (i = 0; i < 3; i++) |
| 113 | tmp68301_timer[i] = | |
| 113 | tmp68301_timer[i] = | |
| 114 | 114 | |
| 115 | 115 | for (i = 0; i < 3; i++) |
| 116 | 116 | tmp68301_IE[i] = 0; |
| r1293 | r1294 | |
|---|---|---|
| 81 | 81 | { |
| 82 | 82 | UINT8 vector; /* interrupt vector */ |
| 83 | 83 | UINT32 clock; /* system clock */ |
| 84 | mame_time period16; /* 16/system clock */ | |
| 85 | mame_time period256; /* 256/system clock */ | |
| 84 | attotime period16; /* 16/system clock */ | |
| 85 | attotime period256; /* 256/system clock */ | |
| 86 | 86 | void (*intr)(int which); /* interrupt callback */ |
| 87 | 87 | write8_handler zc[4]; /* zero crossing callbacks */ |
| 88 | 88 | UINT8 notimer; /* no timer masks */ |
| r1293 | r1294 | |
| 90 | 90 | UINT16 tconst[4]; /* time constant */ |
| 91 | 91 | UINT16 down[4]; /* down counter (clock mode only) */ |
| 92 | 92 | UINT8 extclk[4]; /* current signal from the external clock */ |
| 93 | | |
| 93 | | |
| 94 | 94 | UINT8 int_state[4]; /* interrupt status (for daisy chain) */ |
| 95 | 95 | }; |
| 96 | 96 | |
| r1293 | r1294 | |
| 158 | 158 | memset(ctc, 0, sizeof(*ctc)); |
| 159 | 159 | |
| 160 | 160 | ctc->clock = intf->baseclock; |
| 161 | ctc->period16 = scale_up_mame_time(MAME_TIME_IN_HZ(intf->baseclock), 16); | |
| 162 | ctc->period256 = scale_up_mame_time(MAME_TIME_IN_HZ(intf->baseclock), 256); | |
| 161 | ctc->period16 = attotime_mul(ATTOTIME_IN_HZ(intf->baseclock), 16); | |
| 162 | ctc->period256 = attotime_mul(ATTOTIME_IN_HZ(intf->baseclock), 256); | |
| 163 | 163 | ctc->notimer = intf->notimer; |
| 164 | 164 | ctc->intr = intf->intr; |
| 165 | ctc->timer[0] = mame_timer_alloc(timercallback); | |
| 166 | ctc->timer[1] = mame_timer_alloc(timercallback); | |
| 167 | ctc->timer[2] = mame_timer_alloc(timercallback); | |
| 168 | ctc->timer[3] = mame_timer_alloc(timercallback); | |
| 165 | ctc->timer[0] = timer_alloc(timercallback); | |
| 166 | ctc->timer[1] = timer_alloc(timercallback); | |
| 167 | ctc->timer[2] = timer_alloc(timercallback); | |
| 168 | ctc->timer[3] = timer_alloc(timercallback); | |
| 169 | 169 | ctc->zc[0] = intf->zc0; |
| 170 | 170 | ctc->zc[1] = intf->zc1; |
| 171 | 171 | ctc->zc[2] = intf->zc2; |
| r1293 | r1294 | |
| 191 | 191 | { |
| 192 | 192 | ctc->mode[i] = RESET_ACTIVE; |
| 193 | 193 | ctc->tconst[i] = 0x100; |
| 194 | | |
| 194 | | |
| 195 | 195 | ctc->int_state[i] = 0; |
| 196 | 196 | } |
| 197 | 197 | interrupt_check(which); |
| r1293 | r1294 | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | |
| 202 | ||
| 202 | ||
| 203 | 203 | { |
| 204 | 204 | z80ctc *ctc = ctcs + which; |
| 205 | | |
| 205 | | |
| 206 | 206 | |
| 207 | 207 | /* if reset active, no period */ |
| 208 | 208 | if ((ctc->mode[ch] & RESET) == RESET_ACTIVE) |
| 209 | return time_zero; | |
| 209 | return attotime_zero; | |
| 210 | 210 | |
| 211 | 211 | /* if counter mode, no real period */ |
| 212 | 212 | if ((ctc->mode[ch] & MODE) == MODE_COUNTER) |
| 213 | 213 | { |
| 214 | 214 | logerror("CTC %d is CounterMode : Can't calculate period\n", ch ); |
| 215 | return time_zero; | |
| 215 | return attotime_zero; | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /* compute the period */ |
| 219 | 219 | period = ((ctc->mode[ch] & PRESCALER) == PRESCALER_16) ? ctc->period16 : ctc->period256; |
| 220 | return | |
| 220 | return | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | |
| r1293 | r1294 | |
| 256 | 256 | { |
| 257 | 257 | if (!(ctc->notimer & (1<<ch))) |
| 258 | 258 | { |
| 259 | mame_time period = ((mode & PRESCALER) == PRESCALER_16) ? ctc->period16 : ctc->period256; | |
| 260 | period = scale_up_mame_time(period, ctc->tconst[ch]); | |
| 259 | attotime period = ((mode & PRESCALER) == PRESCALER_16) ? ctc->period16 : ctc->period256; | |
| 260 | period = attotime_mul(period, ctc->tconst[ch]); | |
| 261 | 261 | |
| 262 | | |
| 262 | | |
| 263 | 263 | } |
| 264 | 264 | else |
| 265 | | |
| 265 | | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /* else set the bit indicating that we're waiting for the appropriate trigger */ |
| r1293 | r1294 | |
| 301 | 301 | /* if we're being reset, clear out any pending timers for this channel */ |
| 302 | 302 | if ((data & RESET) == RESET_ACTIVE) |
| 303 | 303 | { |
| 304 | | |
| 304 | | |
| 305 | 305 | /* note that we don't clear the interrupt state here! */ |
| 306 | 306 | } |
| 307 | 307 | |
| r1293 | r1294 | |
| 330 | 330 | /* else compute the down counter value */ |
| 331 | 331 | else |
| 332 | 332 | { |
| 333 | | |
| 333 | | |
| 334 | 334 | |
| 335 | VPRINTF(("CTC clock %f\n",S | |
| 335 | VPRINTF(("CTC clock %f\n",ATTOS | |
| 336 | 336 | |
| 337 | 337 | if (ctc->timer[ch]) |
| 338 | return ((int)( | |
| 338 | return ((int)( | |
| 339 | 339 | else |
| 340 | 340 | return 0; |
| 341 | 341 | } |
| r1293 | r1294 | |
| 372 | 372 | |
| 373 | 373 | if (!(ctc->notimer & (1<<ch))) |
| 374 | 374 | { |
| 375 | mame_time period = ((ctc->mode[ch] & PRESCALER) == PRESCALER_16) ? ctc->period16 : ctc->period256; | |
| 376 | period = scale_up_mame_time(period, ctc->tconst[ch]); | |
| 375 | attotime period = ((ctc->mode[ch] & PRESCALER) == PRESCALER_16) ? ctc->period16 : ctc->period256; | |
| 376 | period = attotime_mul(period, ctc->tconst[ch]); | |
| 377 | 377 | |
| 378 | | |
| 378 | | |
| 379 | 379 | } |
| 380 | 380 | else |
| 381 | | |
| 381 | | |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | /* we're no longer waiting */ |
| r1293 | r1294 | |
|---|---|---|
| 56 | 56 | void (*output_callback)(int); /* callback function for when output changes */ |
| 57 | 57 | void (*freq_callback)(double); /* callback function for when output frequency changes */ |
| 58 | 58 | |
| 59 | | |
| 59 | | |
| 60 | 60 | |
| 61 | mame_timer *outputtimer; /* MAME timer for output change callback */ | |
| 62 | mame_timer *freqtimer; /* MAME timer for output frequency change callback */ | |
| 61 | emu_timer *outputtimer; /* MAME timer for output change callback */ | |
| 62 | emu_timer *freqtimer; /* MAME timer for output frequency change callback */ | |
| 63 | 63 | |
| 64 | 64 | UINT16 value; /* current counter value ("CE" in Intel docs) */ |
| 65 | 65 | UINT16 latch; /* latched counter value ("OL" in Intel docs) */ |
| r1293 | r1294 | |
| 223 | 223 | |
| 224 | 224 | if (timer->clockin == 0 || cycles == CYCLES_NEVER) |
| 225 | 225 | { |
| 226 | | |
| 226 | | |
| 227 | 227 | } |
| 228 | 228 | else |
| 229 | 229 | { |
| 230 | | |
| 230 | | |
| 231 | 231 | } |
| 232 | 232 | timer->cycles_to_freq = cycles; |
| 233 | 233 | } |
| r1293 | r1294 | |
| 615 | 615 | timer->cycles_to_output = cycles_to_output; |
| 616 | 616 | if (cycles_to_output == CYCLES_NEVER || timer->clockin == 0) |
| 617 | 617 | { |
| 618 | | |
| 618 | | |
| 619 | 619 | } |
| 620 | 620 | else |
| 621 | 621 | { |
| 622 | mame_timer_reset(timer->outputtimer, | |
| 623 | double_to_mame_time(cycles_to_output / timer->clockin)); | |
| 622 | timer_reset(timer->outputtimer, | |
| 623 | double_to_attotime(cycles_to_output / timer->clockin)); | |
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | 626 | |
| r1293 | r1294 | |
| 677 | 677 | { |
| 678 | 678 | /* With the 82C54's maximum clockin of 10MHz, 64 bits is nearly 60,000 |
| 679 | 679 | years of time. Should be enough for now. */ |
| 680 | mame_time now = mame_timer_get_time(); | |
| 681 | mame_time elapsed_time = sub_mame_times(now,timer->last_updated); | |
| 682 | INT64 elapsed_cycles = mame_time_to_double(elapsed_time) * timer->clockin; | |
| 680 | attotime now = timer_get_time(); | |
| 681 | attotime elapsed_time = attotime_sub(now,timer->last_updated); | |
| 682 | INT64 elapsed_cycles = attotime_to_double(elapsed_time) * timer->clockin; | |
| 683 | 683 | |
| 684 | timer->last_updated = a | |
| 684 | timer->last_updated = a | |
| 685 | 685 | |
| 686 | 686 | simulate(timer,elapsed_cycles); |
| 687 | 687 | } |
| r1293 | r1294 | |
| 712 | 712 | timer->null_count = 1; |
| 713 | 713 | timer->cycles_to_output = timer->cycles_to_freq = CYCLES_NEVER; |
| 714 | 714 | |
| 715 | timer->last_updated = | |
| 715 | timer->last_updated = | |
| 716 | 716 | |
| 717 | 717 | update(timer); |
| 718 | 718 | } |
| r1293 | r1294 | |
| 731 | 731 | |
| 732 | 732 | t = cycles / timer->clockin; |
| 733 | 733 | |
| 734 | timer->last_updated = a | |
| 734 | timer->last_updated = a | |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | |
| r1293 | r1294 | |
| 747 | 747 | |
| 748 | 748 | t = cycles / timer->clockin; |
| 749 | 749 | |
| 750 | timer->last_updated = a | |
| 750 | timer->last_updated = a | |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | |
| r1293 | r1294 | |
| 781 | 781 | timer->outputtimer = NULL; |
| 782 | 782 | else |
| 783 | 783 | { |
| 784 | timer->outputtimer = mame_timer_alloc(outputcallback); | |
| 785 | mame_timer_adjust(timer->outputtimer, time_never, i | (timerno<<4), time_zero); | |
| 784 | timer->outputtimer = timer_alloc(outputcallback); | |
| 785 | timer_adjust(timer->outputtimer, attotime_never, i | (timerno<<4), attotime_zero); | |
| 786 | 786 | } |
| 787 | 787 | if (timer->freq_callback == NULL) |
| 788 | 788 | timer->freqtimer = NULL; |
| 789 | 789 | else |
| 790 | 790 | { |
| 791 | timer->freqtimer = mame_timer_alloc(freqcallback); | |
| 792 | mame_timer_adjust(timer->freqtimer, time_never, i | (timerno<<4), time_zero); | |
| 791 | timer->freqtimer = timer_alloc(freqcallback); | |
| 792 | timer_adjust(timer->freqtimer, attotime_never, i | (timerno<<4), attotime_zero); | |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | /* set up state save values */ |
| r1293 | r1294 | |
| 812 | 812 | state_save_register_item("pit8253", n, timer->cycles_to_freq); |
| 813 | 813 | state_save_register_item("pit8253", n, timer->freq_count); |
| 814 | 814 | state_save_register_item("pit8253", n, timer->last_updated.seconds); |
| 815 | state_save_register_item("pit8253", n, timer->last_updated. | |
| 815 | state_save_register_item("pit8253", n, timer->last_updated.attoseconds); | |
| 816 | 816 | ++n; |
| 817 | 817 | } |
| 818 | 818 | pit8253_reset(i); |
| r1293 | r1294 | |
|---|---|---|
| 287 | 287 | struct tm ref_tm; |
| 288 | 288 | time_t ref_time; |
| 289 | 289 | time_t current_time; |
| 290 | | |
| 290 | | |
| 291 | 291 | |
| 292 | 292 | memset( &ref_tm, 0, sizeof( ref_tm ) ); |
| 293 | 293 | ref_tm.tm_year = ref_year - 1900; |
| r1293 | r1294 | |
| 305 | 305 | ds2404.rtc[ 3 ] = ( current_time >> 16 ) & 0xff; |
| 306 | 306 | ds2404.rtc[ 4 ] = ( current_time >> 24 ) & 0xff; |
| 307 | 307 | |
| 308 | timer = mame_timer_alloc( DS2404_tick ); | |
| 309 | mame_timer_adjust( timer, MAME_TIME_IN_HZ( 256 ), 0, MAME_TIME_IN_HZ( 256 ) ); | |
| 308 | timer = timer_alloc( DS2404_tick ); | |
| 309 | timer_adjust( timer, ATTOTIME_IN_HZ( 256 ), 0, ATTOTIME_IN_HZ( 256 ) ); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | void DS2404_load(mame_file *file) |
| r1293 | r1294 | |
|---|---|---|
| 42 | 42 | |
| 43 | 43 | void z80ctc_init(int which, z80ctc_interface *intf); |
| 44 | 44 | void z80ctc_reset(int which); |
| 45 | ||
| 45 | ||
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 |
| r1293 | r1294 | |
|---|---|---|
| 90 | 90 | UINT16 eindex; |
| 91 | 91 | UINT8 edata[0x2000]; |
| 92 | 92 | |
| 93 | | |
| 93 | | |
| 94 | 94 | }; |
| 95 | 95 | |
| 96 | 96 | static struct mc146818_chip *mc146818; |
| r1293 | r1294 | |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | mc146818->last_refresh = | |
| 193 | mc146818->last_refresh = | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
| r1293 | r1294 | |
| 200 | 200 | mc146818 = auto_malloc(sizeof(*mc146818)); |
| 201 | 201 | memset(mc146818, 0, sizeof(*mc146818)); |
| 202 | 202 | mc146818->type = type; |
| 203 | mc146818->last_refresh = mame_timer_get_time(); | |
| 204 | mame_timer_pulse(MAME_TIME_IN_HZ(1), 0, mc146818_timer); | |
| 203 | mc146818->last_refresh = timer_get_time(); | |
| 204 | timer_pulse(ATTOTIME_IN_HZ(1), 0, mc146818_timer); | |
| 205 | 205 | mc146818_set_base_datetime(); |
| 206 | 206 | } |
| 207 | 207 | |
| r1293 | r1294 | |
| 316 | 316 | switch (mc146818->index % MC146818_DATA_SIZE) { |
| 317 | 317 | case 0xa: |
| 318 | 318 | data = mc146818->data[mc146818->index % MC146818_DATA_SIZE]; |
| 319 | if (compare | |
| 319 | if (attotime_compare( | |
| 320 | 320 | data |= 0x80; |
| 321 | 321 | #if 0 |
| 322 | 322 | /* for pc1512 bios realtime clock test */ |
| r1293 | r1294 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | /* Delay between the beginning (UIP asserted) and the end (UIP cleared and |
| 27 | 27 | update interrupt asserted) of the update cycle */ |
| 28 | #define UPDATE_CYCLE_TIME | |
| 28 | #define UPDATE_CYCLE_TIME | |
| 29 | 29 | /* Delay between the assertion of UIP and the effective start of the update |
| 30 | 30 | cycle */ |
| 31 | /*#define UPDATE_CYCLE_DELAY | |
| 31 | /*#define UPDATE_CYCLE_DELAY | |
| 32 | 32 | |
| 33 | 33 | static struct |
| 34 | 34 | { |
| r1293 | r1294 | |
| 42 | 42 | int cur_xram_page; |
| 43 | 43 | |
| 44 | 44 | /* update timer: called every second */ |
| 45 | | |
| 45 | | |
| 46 | 46 | |
| 47 | 47 | /* SQW timer: called every periodic clock half-period */ |
| 48 | | |
| 48 | | |
| 49 | 49 | int SQW_internal_state; |
| 50 | 50 | |
| 51 | 51 | /* callback called when interrupt pin state changes (may be NULL) */ |
| r1293 | r1294 | |
| 316 | 316 | |
| 317 | 317 | rtc.xram = xram; |
| 318 | 318 | |
| 319 | rtc.update_timer = mame_timer_alloc(rtc_begin_update_callback); | |
| 320 | mame_timer_adjust(rtc.update_timer, MAME_TIME_IN_SEC(1), 0, MAME_TIME_IN_SEC(1)); | |
| 321 | rtc.SQW_timer = mame_timer_alloc(rtc_SQW_callback); | |
| 319 | rtc.update_timer = timer_alloc(rtc_begin_update_callback); | |
| 320 | timer_adjust(rtc.update_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1)); | |
| 321 | rtc.SQW_timer = timer_alloc(rtc_SQW_callback); | |
| 322 | 322 | rtc.interrupt_callback = interrupt_callback; |
| 323 | 323 | } |
| 324 | 324 | |
| r1293 | r1294 | |
| 404 | 404 | { |
| 405 | 405 | if (data & reg_A_RS) |
| 406 | 406 | { |
| 407 | mame_time period = MAME_TIME_IN_HZ(SQW_freq_table[data & reg_A_RS]); | |
| 408 | mame_time half_period = scale_down_mame_time(period, 2); | |
| 409 | mame_time elapsed = mame_timer_timeelapsed(rtc.update_timer); | |
| 407 | attotime period = ATTOTIME_IN_HZ(SQW_freq_table[data & reg_A_RS]); | |
| 408 | attotime half_period = attotime_div(period, 2); | |
| 409 | attotime elapsed = timer_timeelapsed(rtc.update_timer); | |
| 410 | 410 | |
| 411 | if (compare_mame_times(half_period, elapsed) > 0) | |
| 412 | mame_timer_adjust(rtc.SQW_timer, sub_mame_times(half_period, elapsed), 0, time_never); | |
| 411 | if (attotime_compare(half_period, elapsed) > 0) | |
| 412 | timer_adjust(rtc.SQW_timer, attotime_sub(half_period, elapsed), 0, attotime_never); | |
| 413 | 413 | else |
| 414 | | |
| 414 | | |
| 415 | 415 | } |
| 416 | 416 | else |
| 417 | 417 | { |
| 418 | 418 | rtc.SQW_internal_state = 0; /* right??? */ |
| 419 | 419 | |
| 420 | 420 | /* Stop the divider used for SQW and periodic interrupts. */ |
| 421 | | |
| 421 | | |
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | /* The UIP bit is read-only */ |
| r1293 | r1294 | |
| 477 | 477 | */ |
| 478 | 478 | static TIMER_CALLBACK( rtc_SQW_callback ) |
| 479 | 479 | { |
| 480 | | |
| 480 | | |
| 481 | 481 | |
| 482 | 482 | rtc.SQW_internal_state = ! rtc.SQW_internal_state; |
| 483 | 483 | if (! rtc.SQW_internal_state) |
| r1293 | r1294 | |
| 487 | 487 | field_interrupts(); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | half_period = scale_down_mame_time(MAME_TIME_IN_HZ(SQW_freq_table[rtc.regs[reg_A] & reg_A_RS]), 2); | |
| 491 | mame_timer_adjust(rtc.SQW_timer, half_period, 0, time_never); | |
| 490 | half_period = attotime_div(ATTOTIME_IN_HZ(SQW_freq_table[rtc.regs[reg_A] & reg_A_RS]), 2); | |
| 491 | timer_adjust(rtc.SQW_timer, half_period, 0, attotime_never); | |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | /* |
| r1293 | r1294 | |
| 501 | 501 | rtc.regs[reg_A] |= reg_A_UIP; |
| 502 | 502 | |
| 503 | 503 | /* schedule end of update cycle */ |
| 504 | | |
| 504 | | |
| 505 | 505 | } |
| 506 | 506 | } |
| 507 | 507 |
| r0 | r1294 | |
|---|---|---|
| 1 | /*************************************************************************** | |
| 2 | ||
| 3 | attotime.c | |
| 4 | ||
| 5 | Support functions for working with attotime data. | |
| 6 | ||
| 7 | Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. | |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 9 | ||
| 10 | ***************************************************************************/ | |
| 11 | ||
| 12 | #include "mamecore.h" | |
| 13 | #include "attotime.h" | |
| 14 | #include "eminline.h" | |
| 15 | ||
| 16 | ||
| 17 | /*************************************************************************** | |
| 18 | GLOBAL VARIABLES | |
| 19 | ***************************************************************************/ | |
| 20 | ||
| 21 | const attotime attotime_zero = STATIC_ATTOTIME_IN_SEC(0); | |
| 22 | const attotime attotime_never = STATIC_ATTOTIME_IN_SEC(ATTOTIME_MAX_SECONDS); | |
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | /*************************************************************************** | |
| 27 | CONVERSION HELPERS | |
| 28 | ***************************************************************************/ | |
| 29 | ||
| 30 | /*------------------------------------------------- | |
| 31 | attotime_to_attoseconds - convert a attotime | |
| 32 | to attoseconds, clamping to maximum positive/ | |
| 33 | negative values | |
| 34 | -------------------------------------------------*/ | |
| 35 | ||
| 36 | attoseconds_t attotime_to_attoseconds(attotime _time) | |
| 37 | { | |
| 38 | /* positive values between 0 and 1 second */ | |
| 39 | if (_time.seconds == 0) | |
| 40 | return _time.attoseconds; | |
| 41 | ||
| 42 | /* negative values between -1 and 0 seconds */ | |
| 43 | else if (_time.seconds == -1) | |
| 44 | return _time.attoseconds - ATTOSECONDS_PER_SECOND; | |
| 45 | ||
| 46 | /* out-of-range positive values */ | |
| 47 | else if (_time.seconds > 0) | |
| 48 | return ATTOSECONDS_PER_SECOND; | |
| 49 | ||
| 50 | /* out-of-range negative values */ | |
| 51 | else | |
| 52 | return -ATTOSECONDS_PER_SECOND; | |
| 53 | } | |
| 54 | ||
| 55 | ||
| 56 | ||
| 57 | /*************************************************************************** | |
| 58 | CORE MATH FUNCTIONS | |
| 59 | ***************************************************************************/ | |
| 60 | ||
| 61 | /*------------------------------------------------- | |
| 62 | attotime_add - add two attotimes | |
| 63 | -------------------------------------------------*/ | |
| 64 | ||
| 65 | attotime attotime_add(attotime _time1, attotime _time2) | |
| 66 | { | |
| 67 | attotime result; | |
| 68 | ||
| 69 | /* if one of the items is attotime_never, return attotime_never */ | |
| 70 | if (_time1.seconds >= ATTOTIME_MAX_SECONDS || _time2.seconds >= ATTOTIME_MAX_SECONDS) | |
| 71 | return attotime_never; | |
| 72 | ||
| 73 | /* add the seconds and attoseconds */ | |
| 74 | result.attoseconds = _time1.attoseconds + _time2.attoseconds; | |
| 75 | result.seconds = _time1.seconds + _time2.seconds; | |
| 76 | ||
| 77 | /* normalize and return */ | |
| 78 | if (result.attoseconds >= ATTOSECONDS_PER_SECOND) | |
| 79 | { | |
| 80 | result.attoseconds -= ATTOSECONDS_PER_SECOND; | |
| 81 | result.seconds++; | |
| 82 | } | |
| 83 | ||
| 84 | /* overflow */ | |
| 85 | if (result.seconds >= ATTOTIME_MAX_SECONDS) | |
| 86 | return attotime_never; | |
| 87 | return result; | |
| 88 | } | |
| 89 | ||
| 90 | ||
| 91 | /*------------------------------------------------- | |
| 92 | attotime_add_attoseconds - add attoseconds | |
| 93 | to a attotime | |
| 94 | -------------------------------------------------*/ | |
| 95 | ||
| 96 | attotime attotime_add_attoseconds(attotime _time1, attoseconds_t _attoseconds) | |
| 97 | { | |
| 98 | attotime result; | |
| 99 | ||
| 100 | /* if one of the items is attotime_never, return attotime_never */ | |
| 101 | if (_time1.seconds >= ATTOTIME_MAX_SECONDS) | |
| 102 | return attotime_never; | |
| 103 | ||
| 104 | /* add the seconds and attoseconds */ | |
| 105 | result.attoseconds = _time1.attoseconds + _attoseconds; | |
| 106 | result.seconds = _time1.seconds; | |
| 107 | ||
| 108 | /* normalize and return */ | |
| 109 | if (result.attoseconds >= ATTOSECONDS_PER_SECOND) | |
| 110 | { | |
| 111 | result.attoseconds -= ATTOSECONDS_PER_SECOND; | |
| 112 | result.seconds++; | |
| 113 | } | |
| 114 | ||
| 115 | /* overflow */ | |
| 116 | if (result.seconds >= ATTOTIME_MAX_SECONDS) | |
| 117 | return attotime_never; | |
| 118 | return result; | |
| 119 | } | |
| 120 | ||
| 121 | ||
| 122 | /*------------------------------------------------- | |
| 123 | attotime_sub - subtract two attotimes | |
| 124 | -------------------------------------------------*/ | |
| 125 | ||
| 126 | attotime attotime_sub(attotime _time1, attotime _time2) | |
| 127 | { | |
| 128 | attotime result; | |
| 129 | ||
| 130 | /* if time1 is attotime_never, return attotime_never */ | |
| 131 | if (_time1.seconds >= ATTOTIME_MAX_SECONDS) | |
| 132 | return attotime_never; | |
| 133 | ||
| 134 | /* add the seconds and attoseconds */ | |
| 135 | result.attoseconds = _time1.attoseconds - _time2.attoseconds; | |
| 136 | result.seconds = _time1.seconds - _time2.seconds; | |
| 137 | ||
| 138 | /* normalize and return */ | |
| 139 | if (result.attoseconds < 0) | |
| 140 | { | |
| 141 | result.attoseconds += ATTOSECONDS_PER_SECOND; | |
| 142 | result.seconds--; | |
| 143 | } | |
| 144 | return result; | |
| 145 | } | |
| 146 | ||
| 147 | ||
| 148 | /*------------------------------------------------- | |
| 149 | attotime_sub_attoseconds - subtract | |
| 150 | attoseconds from a attotime | |
| 151 | -------------------------------------------------*/ | |
| 152 | ||
| 153 | attotime attotime_sub_attoseconds(attotime _time1, attoseconds_t _attoseconds) | |
| 154 | { | |
| 155 | attotime result; | |
| 156 | ||
| 157 | /* if time1 is attotime_never, return attotime_never */ | |
| 158 | if (_time1.seconds >= ATTOTIME_MAX_SECONDS) | |
| 159 | return attotime_never; | |
| 160 | ||
| 161 | /* add the seconds and attoseconds */ | |
| 162 | result.attoseconds = _time1.attoseconds - _attoseconds; | |
| 163 | result.seconds = _time1.seconds; | |
| 164 | ||
| 165 | /* normalize and return */ | |
| 166 | if (result.attoseconds < 0) | |
| 167 | { | |
| 168 | result.attoseconds += ATTOSECONDS_PER_SECOND; | |
| 169 | result.seconds--; | |
| 170 | } | |
| 171 | return result; | |
| 172 | } | |
| 173 | ||
| 174 | ||
| 175 | /*------------------------------------------------- | |
| 176 | attotime_mul - multiply an attotime by | |
| 177 | a constant | |
| 178 | -------------------------------------------------*/ | |
| 179 | ||
| 180 | attotime attotime_mul(attotime _time1, UINT32 factor) | |
| 181 | { | |
| 182 | INT32 attolo, attohi, reslo, reshi; | |
| 183 | INT64 temp; | |
| 184 | ||
| 185 | /* if one of the items is attotime_never, return attotime_never */ | |
| 186 | if (_time1.seconds >= ATTOTIME_MAX_SECONDS) | |
| 187 | return attotime_never; | |
| 188 | ||
| 189 | /* 0 times anything is zero */ | |
| 190 | if (factor == 0) | |
| 191 | return attotime_zero; | |
| 192 | ||
| 193 | /* split attoseconds into upper and lower halves which fit into 32 bits */ | |
| 194 | attohi = div_64x32_rem(_time1.attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); | |
| 195 | ||
| 196 | /* scale the lower half, then split into high/low parts */ | |
| 197 | temp = mul_32x32(attolo, factor); | |
| 198 | temp = div_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reslo); | |
| 199 | ||
| 200 | /* scale the upper half, then split into high/low parts */ | |
| 201 | temp += mul_32x32(attohi, factor); | |
| 202 | temp = div_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reshi); | |
| 203 | ||
| 204 | /* scale the seconds */ | |
| 205 | temp += mul_32x32(_time1.seconds, factor); | |
| 206 | if (temp >= ATTOTIME_MAX_SECONDS) | |
| 207 | return attotime_never; | |
| 208 | ||
| 209 | /* build the result */ | |
| 210 | return attotime_make(temp, (attoseconds_t)reslo + mul_32x32(reshi, ATTOSECONDS_PER_SECOND_SQRT)); | |
| 211 | } | |
| 212 | ||
| 213 | ||
| 214 | /*------------------------------------------------- | |
| 215 | attotime_div - divide an attotime by | |
| 216 | a constant | |
| 217 | -------------------------------------------------*/ | |
| 218 | ||
| 219 | attotime attotime_div(attotime _time1, UINT32 factor) | |
| 220 | { | |
| 221 | INT32 attolo, attohi, reshi, reslo, remainder; | |
| 222 | attotime result; | |
| 223 | INT64 temp; | |
| 224 | ||
| 225 | /* if one of the items is attotime_never, return attotime_never */ | |
| 226 | if (_time1.seconds >= ATTOTIME_MAX_SECONDS) | |
| 227 | return attotime_never; | |
| 228 | ||
| 229 | /* ignore divide by zero */ | |
| 230 | if (factor == 0) | |
| 231 | return _time1; | |
| 232 | ||
| 233 | /* split attoseconds into upper and lower halves which fit into 32 bits */ | |
| 234 | attohi = div_64x32_rem(_time1.attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); | |
| 235 | ||
| 236 | /* divide the seconds and get the remainder */ | |
| 237 | result.seconds = div_64x32_rem(_time1.seconds, factor, &remainder); | |
| 238 | ||
| 239 | /* combine the upper half of attoseconds with the remainder and divide that */ | |
| 240 | temp = (INT64)attohi + mul_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); | |
| 241 | reshi = div_64x32_rem(temp, factor, &remainder); | |
| 242 | ||
| 243 | /* combine the lower half of attoseconds with the remainder and divide that */ | |
| 244 | temp = attolo + mul_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); | |
| 245 | reslo = div_64x32_rem(temp, factor, &remainder); | |
| 246 | ||
| 247 | /* round based on the remainder */ | |
| 248 | result.attoseconds = (attoseconds_t)reslo + mul_32x32(reshi, ATTOSECONDS_PER_SECOND_SQRT); | |
| 249 | if (remainder >= factor / 2) | |
| 250 | if (++result.attoseconds >= ATTOSECONDS_PER_SECOND) | |
| 251 | { | |
| 252 | result.attoseconds = 0; | |
| 253 | result.seconds++; | |
| 254 | } | |
| 255 | return result; | |
| 256 | } | |
| 257 | ||
| 258 | ||
| 259 | /*------------------------------------------------- | |
| 260 | attotime_compare - compare two attotimes | |
| 261 | -------------------------------------------------*/ | |
| 262 | ||
| 263 | int attotime_compare(attotime _time1, attotime _time2) | |
| 264 | { | |
| 265 | if (_time1.seconds > _time2.seconds) | |
| 266 | return 1; | |
| 267 | if (_time1.seconds < _time2.seconds) | |
| 268 | return -1; | |
| 269 | if (_time1.attoseconds > _time2.attoseconds) | |
| 270 | return 1; | |
| 271 | if (_time1.attoseconds < _time2.attoseconds) | |
| 272 | return -1; | |
| 273 | return 0; | |
| 274 | } | |
| 275 | ||
| 276 | ||
| 277 | ||
| 278 | /*************************************************************************** | |
| 279 | MISC UTILITIES | |
| 280 | ***************************************************************************/ | |
| 281 | ||
| 282 | /*------------------------------------------------- | |
| 283 | attotime_compare - return a temporary | |
| 284 | printable string describing an attotime | |
| 285 | -------------------------------------------------*/ | |
| 286 | ||
| 287 | const char *attotime_string(attotime _time, int precision) | |
| 288 | { | |
| 289 | static char buffers[8][30]; | |
| 290 | static int nextbuf; | |
| 291 | char *buffer = &buffers[nextbuf++ % 8][0]; | |
| 292 | ||
| 293 | /* case 1: we want no precision; seconds only */ | |
| 294 | if (precision == 0) | |
| 295 | sprintf(buffer, "%d", _time.seconds); | |
| 296 | ||
| 297 | /* case 2: we want 9 or fewer digits of precision */ | |
| 298 | else if (precision <= 9) | |
| 299 | { | |
| 300 | INT32 upper = _time.attoseconds / ATTOSECONDS_PER_SECOND_SQRT; | |
| 301 | sprintf(buffer, "%d.%0*d", _time.seconds, precision, upper); | |
| 302 | } | |
| 303 | ||
| 304 | /* case 3: more than 9 digits of precision */ | |
| 305 | else | |
| 306 | { | |
| 307 | INT32 lower; | |
| 308 | INT32 upper = div_64x32_rem(_time.attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &lower); | |
| 309 | sprintf(buffer, "%d.%09d%0*d", _time.seconds, upper, precision - 9, lower); | |
| 310 | } | |
| 311 | return buffer; | |
| 312 | } |
| r1293 | r1294 | |
|---|---|---|
| 96 | 96 | void tms32025_get_info(UINT32 state, cpuinfo *info); |
| 97 | 97 | void tms32026_get_info(UINT32 state, cpuinfo *info); |
| 98 | 98 | void tms32031_get_info(UINT32 state, cpuinfo *info); |
| 99 | void tms32032_get_info(UINT32 state, cpuinfo *info); | |
| 99 | 100 | void tms32051_get_info(UINT32 state, cpuinfo *info); |
| 100 | 101 | void ccpu_get_info(UINT32 state, cpuinfo *info); |
| 101 | 102 | void adsp2100_get_info(UINT32 state, cpuinfo *info); |
| r1293 | r1294 | |
| 496 | 497 | #if (HAS_TMS32031) |
| 497 | 498 | { CPU_TMS32031, tms32031_get_info }, |
| 498 | 499 | #endif |
| 500 | #if (HAS_TMS32032) | |
| 501 | { CPU_TMS32032, tms32032_get_info }, | |
| 502 | #endif | |
| 499 | 503 | #if (HAS_TMS32051) |
| 500 | 504 | { CPU_TMS32051, tms32051_get_info }, |
| 501 | 505 | #endif |
| r0 | r1294 | |
|---|---|---|
| 1 | /*************************************************************************** | |
| 2 | ||
| 3 | attotime.h | |
| 4 | ||
| 5 | Support functions for working with attotime data. | |
| 6 | ||
| 7 | Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. | |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 9 | ||
| 10 | **************************************************************************** | |
| 11 | ||
| 12 | Attotime is an attosecond-accurate timing system implemented as | |
| 13 | 96-bit integers. | |
| 14 | ||
| 15 | 1 second = 1e0 seconds | |
| 16 | 1 millisecond = 1e-3 seconds | |
| 17 | 1 microsecond = 1e-6 seconds | |
| 18 | 1 nanosecond = 1e-9 seconds | |
| 19 | 1 picosecond = 1e-12 seconds | |
| 20 | 1 femtosecond = 1e-15 seconds | |
| 21 | 1 attosecond = 1e-18 seconds | |
| 22 | ||
| 23 | This may seem insanely accurate, but it has its uses when multiple | |
| 24 | clocks in the system are run by independent crystals. It is also | |
| 25 | useful to compute the attotime for something small, say 1 clock tick, | |
| 26 | and still have it be accurate and useful for scaling. | |
| 27 | ||
| 28 | Attotime consists of a 32-bit seconds count and a 64-bit attoseconds | |
| 29 | count. Because the lower bits are kept as attoseconds and not as a | |
| 30 | full 64-bit value, there is headroom to make some operations simpler. | |
| 31 | ||
| 32 | ***************************************************************************/ | |
| 33 | ||
| 34 | #pragma once | |
| 35 | ||
| 36 | #ifndef __ATTOTIME_H__ | |
| 37 | #define __ATTOTIME_H__ | |
| 38 | ||
| 39 | #include "mamecore.h" | |
| 40 | #include <math.h> | |
| 41 | ||
| 42 | ||
| 43 | /*************************************************************************** | |
| 44 | CONSTANTS | |
| 45 | ***************************************************************************/ | |
| 46 | ||
| 47 | #define ATTOSECONDS_PER_SECOND_SQRT ((attoseconds_t)1000000000) | |
| 48 | #define ATTOSECONDS_PER_SECOND (ATTOSECONDS_PER_SECOND_SQRT * ATTOSECONDS_PER_SECOND_SQRT) | |
| 49 | #define ATTOSECONDS_PER_MILLISECOND (ATTOSECONDS_PER_SECOND / 1000) | |
| 50 | #define ATTOSECONDS_PER_MICROSECOND (ATTOSECONDS_PER_SECOND / 1000000) | |
| 51 | #define ATTOSECONDS_PER_NANOSECOND (ATTOSECONDS_PER_SECOND / 1000000000) | |
| 52 | ||
| 53 | #define ATTOTIME_MAX_SECONDS ((seconds_t)1000000000) | |
| 54 | ||
| 55 | ||
| 56 | ||
| 57 | /*************************************************************************** | |
| 58 | MACROS | |
| 59 | ***************************************************************************/ | |
| 60 | ||
| 61 | /* convert between a double and attoseconds */ | |
| 62 | #define ATTOSECONDS_TO_DOUBLE(x) ((double)(x) * 1e-18) | |
| 63 | #define DOUBLE_TO_ATTOSECONDS(x) ((attoseconds_t)((x) * 1e18)) | |
| 64 | ||
| 65 | /* convert between hertz (as a double) and attoseconds */ | |
| 66 | #define ATTOSECONDS_TO_HZ(x) ((double)ATTOSECONDS_PER_SECOND / (double)(x)) | |
| 67 | #define HZ_TO_ATTOSECONDS(x) ((attoseconds_t)(ATTOSECONDS_PER_SECOND / (x))) | |
| 68 | ||
| 69 | /* macros for converting other seconds types to attoseconds */ | |
| 70 | #define ATTOSECONDS_IN_SEC(x) ((x) * ATTOSECONDS_PER_SECOND) | |
| 71 | #define ATTOSECONDS_IN_MSEC(x) ((x) * ATTOSECONDS_PER_MILLISECOND) | |
| 72 | #define ATTOSECONDS_IN_USEC(x) ((x) * ATTOSECONDS_PER_MICROSECOND) | |
| 73 | #define ATTOSECONDS_IN_NSEC(x) ((x) * ATTOSECONDS_PER_NANOSECOND) | |
| 74 | ||
| 75 | /* macros for building attotimes from other types at runtime */ | |
| 76 | #define ATTOTIME_IN_HZ(hz) attotime_make(0, HZ_TO_ATTOSECONDS(hz)) | |
| 77 | #define ATTOTIME_IN_SEC(s) attotime_make((s) / 1, (s) % 1 /* mod here errors on doubles, which is intended */) | |
| 78 | #define ATTOTIME_IN_MSEC(ms) attotime_make((ms) / 1000, ATTOSECONDS_IN_MSEC((ms) % 1000)) | |
| 79 | #define ATTOTIME_IN_USEC(us) attotime_make((us) / 1000000, ATTOSECONDS_IN_USEC((us) % 1000000)) | |
| 80 | #define ATTOTIME_IN_NSEC(ns) attotime_make((ns) / 1000000000, ATTOSECONDS_IN_NSEC((ns) % 1000000000)) | |
| 81 | ||
| 82 | /* macros for building attotimes from other types at compile time */ | |
| 83 | #define STATIC_ATTOTIME_IN_HZ(hz) { 0, HZ_TO_ATTOSECONDS(hz) } | |
| 84 | #define STATIC_ATTOTIME_IN_SEC(s) { (s) / 1, (s) % 1 /* mod here errors on doubles, which is intended */ } | |
| 85 | #define STATIC_ATTOTIME_IN_MSEC(ms) { (ms) / 1000, ATTOSECONDS_IN_MSEC((ms) % 1000) } | |
| 86 | #define STATIC_ATTOTIME_IN_USEC(us) { (us) / 1000000, ATTOSECONDS_IN_USEC((us) % 1000000) } | |
| 87 | #define STATIC_ATTOTIME_IN_NSEC(ns) { (ns) / 1000000000, ATTOSECONDS_IN_NSEC((ns) % 1000000000) } | |
| 88 | ||
| 89 | ||
| 90 | #define USEC_TO_ATTOSECONDS(us) ((attoseconds_t)((us) * ATTOSECONDS_PER_MICROSECOND)) | |
| 91 | ||
| 92 | ||
| 93 | ||
| 94 | /*************************************************************************** | |
| 95 | TYPE DEFINITIONS | |
| 96 | ***************************************************************************/ | |
| 97 | ||
| 98 | /* core components of the attotime structure */ | |
| 99 | typedef INT64 attoseconds_t; | |
| 100 | typedef INT32 seconds_t; | |
| 101 | ||
| 102 | ||
| 103 | /* the attotime structure itself */ | |
| 104 | typedef struct _attotime attotime; | |
| 105 | struct _attotime | |
| 106 | { | |
| 107 | seconds_t seconds; | |
| 108 | attoseconds_t attoseconds; | |
| 109 | }; | |
| 110 | ||
| 111 | ||
| 112 | ||
| 113 | /*************************************************************************** | |
| 114 | GLOBAL VARIABLES | |
| 115 | ***************************************************************************/ | |
| 116 | ||
| 117 | /* constant times for zero and never */ | |
| 118 | extern const attotime attotime_zero; | |
| 119 | extern const attotime attotime_never; | |
| 120 | ||
| 121 | ||
| 122 | ||
| 123 | /*************************************************************************** | |
| 124 | FUNCTION PROTOTYPES | |
| 125 | ***************************************************************************/ | |
| 126 | ||
| 127 | /* ----- conversion helpers ----- */ | |
| 128 | ||
| 129 | /* convert an attotime to attoseconds, clamping to maximum positive/negative values */ | |
| 130 | attoseconds_t attotime_to_attoseconds(attotime _time); | |
| 131 | ||
| 132 | ||
| 133 | /* ----- core math functions ----- */ | |
| 134 | ||
| 135 | /* add two attotimes */ | |
| 136 | attotime attotime_add(attotime _time1, attotime _time2); | |
| 137 | ||
| 138 | /* add attoseconds to an attotime */ | |
| 139 | attotime attotime_add_attoseconds(attotime _time1, attoseconds_t _attoseconds); | |
| 140 | ||
| 141 | /* subtract two attotimes */ | |
| 142 | attotime attotime_sub(attotime _time1, attotime _time2); | |
| 143 | ||
| 144 | /* subtract attoseconds from an attotime */ | |
| 145 | attotime attotime_sub_attoseconds(attotime _time1, attoseconds_t _attoseconds); | |
| 146 | ||
| 147 | /* multiply an attotime by a constant */ | |
| 148 | attotime attotime_mul(attotime _time1, UINT32 factor); | |
| 149 | ||
| 150 | /* divide an attotime by a constant */ | |
| 151 | attotime attotime_div(attotime _time1, UINT32 factor); | |
| 152 | ||
| 153 | /* compare two attotimes */ | |
| 154 | int attotime_compare(attotime _time1, attotime _time2); | |
| 155 | ||
| 156 | ||
| 157 | /* ----- misc utilities ----- */ | |
| 158 | ||
| 159 | /* return a temporary printable string describing an attotime */ | |
| 160 | const char *attotime_string(attotime _time, int precision); | |
| 161 | ||
| 162 | ||
| 163 | ||
| 164 | /*************************************************************************** | |
| 165 | INLINE FUNCTIONS | |
| 166 | ***************************************************************************/ | |
| 167 | ||
| 168 | /*------------------------------------------------- | |
| 169 | attotime_make - assemble an attotime from | |
| 170 | seconds and attoseconds components | |
| 171 | -------------------------------------------------*/ | |
| 172 | ||
| 173 | INLINE attotime attotime_make(seconds_t _secs, attoseconds_t _subsecs) | |
| 174 | { | |
| 175 | attotime result; | |
| 176 | result.seconds = _secs; | |
| 177 | result.attoseconds = _subsecs; | |
| 178 | return result; | |
| 179 | } | |
| 180 | ||
| 181 | ||
| 182 | /*------------------------------------------------- | |
| 183 | attotime_to_double - convert from attotime | |
| 184 | to double | |
| 185 | -------------------------------------------------*/ | |
| 186 | ||
| 187 | INLINE double attotime_to_double(attotime _time) | |
| 188 | { | |
| 189 | return (double)_time.seconds + ATTOSECONDS_TO_DOUBLE(_time.attoseconds); | |
| 190 | } | |
| 191 | ||
| 192 | ||
| 193 | /*------------------------------------------------- | |
| 194 | double_to_attotime - convert from double to | |
| 195 | attotime | |
| 196 | -------------------------------------------------*/ | |
| 197 | ||
| 198 | INLINE attotime double_to_attotime(double _time) | |
| 199 | { | |
| 200 | attotime result; | |
| 201 | ||
| 202 | /* set seconds to the integral part */ | |
| 203 | result.seconds = floor(_time); | |
| 204 | ||
| 205 | /* set attoseconds to the fractional part */ | |
| 206 | _time -= (double)result.seconds; | |
| 207 | result.attoseconds = DOUBLE_TO_ATTOSECONDS(_time); | |
| 208 | return result; | |
| 209 | } | |
| 210 | ||
| 211 | ||
| 212 | #endif /* __ATTOTIME_H__ */ |
| r1293 | r1294 | |
|---|---|---|
| 92 | 92 | INT32 iloops; /* number of interrupts remaining this frame */ |
| 93 | 93 | |
| 94 | 94 | UINT64 totalcycles; /* total CPU cycles executed */ |
| 95 | | |
| 95 | | |
| 96 | 96 | INT32 clock; /* current active clock */ |
| 97 | 97 | double clockscale; /* current active clock scale factor */ |
| 98 | 98 | |
| r1293 | r1294 | |
| 101 | 101 | void * vblankint_timer; /* reference to elapsed time counter */ |
| 102 | 102 | |
| 103 | 103 | void * timedint_timer; /* reference to this CPU's timer */ |
| 104 | | |
| 104 | | |
| 105 | 105 | }; |
| 106 | 106 | |
| 107 | 107 | |
| r1293 | r1294 | |
| 129 | 129 | * |
| 130 | 130 | *************************************/ |
| 131 | 131 | |
| 132 | static | |
| 132 | static | |
| 133 | 133 | static INT32 vblank_countdown; |
| 134 | 134 | static INT32 vblank_multiplier; |
| 135 | static | |
| 135 | static | |
| 136 | 136 | |
| 137 | static | |
| 137 | static | |
| 138 | 138 | |
| 139 | mame_timer *refresh_timer; /* temporarily made non-static (for ccpu) */ | |
| 140 | static mame_time refresh_period; | |
| 139 | emu_timer *refresh_timer; /* temporarily made non-static (for ccpu) */ | |
| 140 | static attotime refresh_period; | |
| 141 | 141 | |
| 142 | static mame_timer *timeslice_timer; | |
| 143 | static mame_time timeslice_period; | |
| 142 | static emu_timer *timeslice_timer; | |
| 143 | static attotime timeslice_period; | |
| 144 | 144 | |
| 145 | static mame_timer *interleave_boost_timer; | |
| 146 | static mame_timer *interleave_boost_timer_end; | |
| 147 | static mame_time perfect_interleave; | |
| 145 | static emu_timer *interleave_boost_timer; | |
| 146 | static emu_timer *interleave_boost_timer_end; | |
| 147 | static attotime perfect_interleave; | |
| 148 | 148 | |
| 149 | static | |
| 149 | static | |
| 150 | 150 | |
| 151 | 151 | |
| 152 | 152 | |
| r1293 | r1294 | |
| 202 | 202 | machine->screen[0].vblank = (machine->screen[0].refresh / machine->screen[0].height) * (machine->screen[0].height - (machine->screen[0].visarea.max_y + 1 - machine->screen[0].visarea.min_y)); |
| 203 | 203 | |
| 204 | 204 | /* allocate vblank and refresh timers, and compute the initial timing */ |
| 205 | vblank_timer = mame_timer_alloc(cpu_vblankcallback); | |
| 206 | refresh_timer = mame_timer_alloc(NULL); | |
| 205 | vblank_timer = timer_alloc(cpu_vblankcallback); | |
| 206 | refresh_timer = timer_alloc(NULL); | |
| 207 | 207 | cpu_compute_vblank_timing(); |
| 208 | 208 | |
| 209 | 209 | /* loop over all our CPUs */ |
| r1293 | r1294 | |
| 221 | 221 | cpu[cpunum].suspend = SUSPEND_REASON_RESET; |
| 222 | 222 | cpu[cpunum].clock = machine->drv->cpu[cpunum].clock; |
| 223 | 223 | cpu[cpunum].clockscale = 1.0; |
| 224 | cpu[cpunum].localtime = time_zero; | |
| 224 | cpu[cpunum].localtime = attotime_zero; | |
| 225 | 225 | |
| 226 | 226 | /* compute the cycle times */ |
| 227 | 227 | cycles_per_second[cpunum] = cpu[cpunum].clockscale * cpu[cpunum].clock; |
| 228 | s | |
| 228 | attos | |
| 229 | 229 | |
| 230 | 230 | /* register some of our variables for later */ |
| 231 | 231 | state_save_register_item("cpu", cpunum, cpu[cpunum].suspend); |
| r1293 | r1294 | |
| 238 | 238 | |
| 239 | 239 | state_save_register_item("cpu", cpunum, cpu[cpunum].totalcycles); |
| 240 | 240 | state_save_register_item("cpu", cpunum, cpu[cpunum].localtime.seconds); |
| 241 | state_save_register_item("cpu", cpunum, cpu[cpunum].localtime. | |
| 241 | state_save_register_item("cpu", cpunum, cpu[cpunum].localtime.attoseconds); | |
| 242 | 242 | state_save_register_item("cpu", cpunum, cpu[cpunum].clock); |
| 243 | 243 | state_save_register_item("cpu", cpunum, cpu[cpunum].clockscale); |
| 244 | 244 | |
| r1293 | r1294 | |
| 368 | 368 | /* Start a vblank based watchdog. */ |
| 369 | 369 | watchdog_counter = Machine->drv->watchdog_vblank_count; |
| 370 | 370 | } |
| 371 | else if (compare | |
| 371 | else if (attotime_compare | |
| 372 | 372 | { |
| 373 | 373 | /* Start a time based watchdog. */ |
| 374 | 374 | if (alloc_new) |
| 375 | watchdog_timer = mame_timer_alloc(watchdog_callback); | |
| 376 | mame_timer_adjust(watchdog_timer, Machine->drv->watchdog_time, 0, time_zero); | |
| 375 | watchdog_timer = timer_alloc(watchdog_callback); | |
| 376 | timer_adjust(watchdog_timer, Machine->drv->watchdog_time, 0, attotime_zero); | |
| 377 | 377 | watchdog_counter = WATCHDOG_IS_TIMER_BASED; |
| 378 | 378 | } |
| 379 | 379 | else if (watchdog_counter == WATCHDOG_IS_INVALID) |
| r1293 | r1294 | |
| 394 | 394 | * The 3 seconds delay is targeted at qzshowby, which otherwise |
| 395 | 395 | * would reset at the start of a game. |
| 396 | 396 | */ |
| 397 | watchdog_counter = 3 * | |
| 397 | watchdog_counter = 3 * ATTOSECONDS_TO_HZ(Machine->screen[0].refresh); | |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | } |
| r1293 | r1294 | |
| 411 | 411 | { |
| 412 | 412 | if (watchdog_counter == WATCHDOG_IS_TIMER_BASED) |
| 413 | 413 | { |
| 414 | | |
| 414 | | |
| 415 | 415 | } |
| 416 | 416 | else |
| 417 | 417 | { |
| r1293 | r1294 | |
| 466 | 466 | |
| 467 | 467 | void cpuexec_timeslice(void) |
| 468 | 468 | { |
| 469 | mame_time target = mame_timer_next_fire_time(); | |
| 470 | mame_time base = mame_timer_get_time(); | |
| 469 | attotime target = timer_next_fire_time(); | |
| 470 | attotime base = timer_get_time(); | |
| 471 | 471 | int cpunum, ran; |
| 472 | 472 | |
| 473 | 473 | LOG(("------------------\n")); |
| 474 | LOG(("cpu_timeslice: target = % | |
| 474 | LOG(("cpu_timeslice: target = %s | |
| 475 | 475 | |
| 476 | 476 | /* process any pending suspends */ |
| 477 | 477 | for (cpunum = 0; Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++) |
| r1293 | r1294 | |
| 489 | 489 | if (!cpu[cpunum].suspend) |
| 490 | 490 | { |
| 491 | 491 | /* compute how long to run */ |
| 492 | cycles_running = | |
| 492 | cycles_running = | |
| 493 | 493 | LOG((" cpu %d: %d cycles\n", cpunum, cycles_running)); |
| 494 | 494 | |
| 495 | 495 | /* run for the requested number of cycles */ |
| r1293 | r1294 | |
| 512 | 512 | |
| 513 | 513 | /* account for these cycles */ |
| 514 | 514 | cpu[cpunum].totalcycles += ran; |
| 515 | cpu[cpunum].localtime = add_mame_times(cpu[cpunum].localtime, MAME_TIME_IN_CYCLES(ran, cpunum)); | |
| 516 | LOG((" %d ran, %d total, time = %.9f\n", ran, (INT32)cpu[cpunum].totalcycles, mame_time_to_double(cpu[cpunum].localtime))); | |
| 515 | cpu[cpunum].localtime = attotime_add(cpu[cpunum].localtime, ATTOTIME_IN_CYCLES(ran, cpunum)); | |
| 516 | LOG((" %d ran, %d total, time = %s\n", ran, (INT32)cpu[cpunum].totalcycles, attotime_string(cpu[cpunum].localtime, 9))); | |
| 517 | 517 | |
| 518 | 518 | /* if the new local CPU time is less than our target, move the target up */ |
| 519 | if (compare | |
| 519 | if (attotime_compare | |
| 520 | 520 | { |
| 521 | if (compare | |
| 521 | if (attotime_compare | |
| 522 | 522 | target = cpu[cpunum].localtime; |
| 523 | 523 | else |
| 524 | 524 | target = base; |
| r1293 | r1294 | |
| 532 | 532 | for (cpunum = 0; Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++) |
| 533 | 533 | { |
| 534 | 534 | /* if we're suspended and counting, process */ |
| 535 | if (cpu[cpunum].suspend && cpu[cpunum].eatcycles && compare | |
| 535 | if (cpu[cpunum].suspend && cpu[cpunum].eatcycles && attotime_compare | |
| 536 | 536 | { |
| 537 | 537 | /* compute how long to run */ |
| 538 | cycles_running = | |
| 538 | cycles_running = | |
| 539 | 539 | LOG((" cpu %d: %d cycles (suspended)\n", cpunum, cycles_running)); |
| 540 | 540 | |
| 541 | 541 | cpu[cpunum].totalcycles += cycles_running; |
| 542 | cpu[cpunum].localtime = add_mame_times(cpu[cpunum].localtime, MAME_TIME_IN_CYCLES(cycles_running, cpunum)); | |
| 543 | LOG((" %d skipped, %d total, time = %.9f\n", cycles_running, (INT32)cpu[cpunum].totalcycles, mame_time_to_double(cpu[cpunum].localtime))); | |
| 542 | cpu[cpunum].localtime = attotime_add(cpu[cpunum].localtime, ATTOTIME_IN_CYCLES(cycles_running, cpunum)); | |
| 543 | LOG((" %d skipped, %d total, time = %s\n", cycles_running, (INT32)cpu[cpunum].totalcycles, attotime_string(cpu[cpunum].localtime, 9))); | |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | /* update the suspend state */ |
| r1293 | r1294 | |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | /* update the global time */ |
| 554 | | |
| 554 | | |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | |
| r1293 | r1294 | |
| 587 | 587 | * |
| 588 | 588 | *************************************/ |
| 589 | 589 | |
| 590 | ||
| 590 | ||
| 591 | 591 | { |
| 592 | | |
| 592 | | |
| 593 | 593 | |
| 594 | 594 | VERIFY_CPUNUM(cpunum_get_localtime); |
| 595 | 595 | |
| r1293 | r1294 | |
| 598 | 598 | if (cpunum == cpu_getexecutingcpu()) |
| 599 | 599 | { |
| 600 | 600 | int cycles = cycles_currently_ran(); |
| 601 | result = a | |
| 601 | result = a | |
| 602 | 602 | } |
| 603 | 603 | return result; |
| 604 | 604 | } |
| r1293 | r1294 | |
| 687 | 687 | |
| 688 | 688 | cpu[cpunum].clock = clock; |
| 689 | 689 | cycles_per_second[cpunum] = (double)clock * cpu[cpunum].clockscale; |
| 690 | s | |
| 690 | attos | |
| 691 | 691 | |
| 692 | 692 | /* re-compute the perfect interleave factor */ |
| 693 | 693 | compute_perfect_interleave(); |
| r1293 | r1294 | |
| 695 | 695 | |
| 696 | 696 | |
| 697 | 697 | |
| 698 | void cpunum_set_clock_period(int cpunum, | |
| 698 | void cpunum_set_clock_period(int cpunum, attoseconds_t clock_period) | |
| 699 | 699 | { |
| 700 | 700 | VERIFY_CPUNUM(cpunum_set_clock); |
| 701 | 701 | |
| 702 | cpu[cpunum].clock = MAX_SUBSECONDS / clock_period; | |
| 703 | cycles_per_second[cpunum] = (double) (MAX_SUBSECONDS / clock_period) * cpu[cpunum].clockscale; | |
| 704 | subseconds_per_cycle[cpunum] = clock_period; | |
| 702 | cpu[cpunum].clock = ATTOSECONDS_PER_SECOND / clock_period; | |
| 703 | cycles_per_second[cpunum] = (double) (ATTOSECONDS_PER_SECOND / clock_period) * cpu[cpunum].clockscale; | |
| 704 | attoseconds_per_cycle[cpunum] = clock_period; | |
| 705 | 705 | |
| 706 | 706 | /* re-compute the perfect interleave factor */ |
| 707 | 707 | compute_perfect_interleave(); |
| r1293 | r1294 | |
| 737 | 737 | |
| 738 | 738 | cpu[cpunum].clockscale = clockscale; |
| 739 | 739 | cycles_per_second[cpunum] = (double)cpu[cpunum].clock * clockscale; |
| 740 | s | |
| 740 | attos | |
| 741 | 741 | |
| 742 | 742 | /* re-compute the perfect interleave factor */ |
| 743 | 743 | compute_perfect_interleave(); |
| r1293 | r1294 | |
| 752 | 752 | * |
| 753 | 753 | *************************************/ |
| 754 | 754 | |
| 755 | void cpu_boost_interleave( | |
| 755 | void cpu_boost_interleave( | |
| 756 | 756 | { |
| 757 | 757 | /* if you pass 0 for the timeslice_time, it means pick something reasonable */ |
| 758 | if (compare | |
| 758 | if (attotime_compare | |
| 759 | 759 | timeslice_time = perfect_interleave; |
| 760 | 760 | |
| 761 | LOG(("cpu_boost_interleave(% | |
| 761 | LOG(("cpu_boost_interleave(%s | |
| 762 | 762 | |
| 763 | 763 | /* adjust the interleave timer */ |
| 764 | | |
| 764 | | |
| 765 | 765 | |
| 766 | 766 | /* adjust the end timer, but only if we are going to extend it */ |
| 767 | if (!mame_timer_enabled(interleave_boost_timer_end) || compare_mame_times(mame_timer_timeleft(interleave_boost_timer_end), boost_duration) < 0) | |
| 768 | mame_timer_adjust(interleave_boost_timer_end, boost_duration, 0, time_never); | |
| 767 | if (!timer_enabled(interleave_boost_timer_end) || attotime_compare(timer_timeleft(interleave_boost_timer_end), boost_duration) < 0) | |
| 768 | timer_adjust(interleave_boost_timer_end, boost_duration, 0, attotime_never); | |
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | |
| r1293 | r1294 | |
| 875 | 875 | |
| 876 | 876 | int cpu_scalebyfcount(int value) |
| 877 | 877 | { |
| 878 | | |
| 878 | | |
| 879 | 879 | int result; |
| 880 | 880 | |
| 881 | 881 | /* shift off some bits to ensure no overflow */ |
| 882 | 882 | if (value < 65536) |
| 883 | result = value * (refresh_elapsed.s | |
| 883 | result = value * (refresh_elapsed.attos | |
| 884 | 884 | else |
| 885 | result = value * (refresh_elapsed.s | |
| 885 | result = value * (refresh_elapsed.attos | |
| 886 | 886 | if (value >= 0) |
| 887 | 887 | return (result < value) ? result : value; |
| 888 | 888 | else |
| r1293 | r1294 | |
| 904 | 904 | |
| 905 | 905 | void cpu_compute_vblank_timing(void) |
| 906 | 906 | { |
| 907 | refresh_period = | |
| 907 | refresh_period = | |
| 908 | 908 | |
| 909 | 909 | /* recompute the vblank period */ |
| 910 | vblank_period = make_mame_time(0, Machine->screen[0].refresh / (vblank_multiplier ? vblank_multiplier : 1)); | |
| 911 | if (vblank_timer != NULL && mame_timer_enable(vblank_timer, FALSE)) | |
| 910 | vblank_period = attotime_make(0, Machine->screen[0].refresh / (vblank_multiplier ? vblank_multiplier : 1)); | |
| 911 | if (vblank_timer != NULL && timer_enable(vblank_timer, FALSE)) | |
| 912 | 912 | { |
| 913 | mame_time remaining = mame_timer_timeleft(vblank_timer); | |
| 914 | if (remaining.seconds == 0 && remaining.subseconds == 0) | |
| 913 | attotime remaining = timer_timeleft(vblank_timer); | |
| 914 | if (remaining.seconds == 0 && remaining.attoseconds == 0) | |
| 915 | 915 | remaining = vblank_period; |
| 916 | | |
| 916 | | |
| 917 | 917 | } |
| 918 | 918 | |
| 919 | LOG(("cpu_compute_vblank_timing: refresh=% | |
| 919 | LOG(("cpu_compute_vblank_timing: refresh=%s | |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | |
| r1293 | r1294 | |
| 996 | 996 | } |
| 997 | 997 | |
| 998 | 998 | |
| 999 | void cpu_triggertime( | |
| 999 | void cpu_triggertime( | |
| 1000 | 1000 | { |
| 1001 | | |
| 1001 | | |
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | |
| r1293 | r1294 | |
| 1110 | 1110 | * |
| 1111 | 1111 | *************************************/ |
| 1112 | 1112 | |
| 1113 | void cpu_spinuntil_time( | |
| 1113 | void cpu_spinuntil_time( | |
| 1114 | 1114 | { |
| 1115 | 1115 | static int timetrig = 0; |
| 1116 | 1116 | |
| r1293 | r1294 | |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | 1122 | |
| 1123 | void cpu_yielduntil_time( | |
| 1123 | void cpu_yielduntil_time( | |
| 1124 | 1124 | { |
| 1125 | 1125 | static int timetrig = 0; |
| 1126 | 1126 | |
| r1293 | r1294 | |
| 1210 | 1210 | static TIMER_CALLBACK( cpu_firstvblankcallback ) |
| 1211 | 1211 | { |
| 1212 | 1212 | /* now that we're synced up, pulse from here on out */ |
| 1213 | | |
| 1213 | | |
| 1214 | 1214 | |
| 1215 | 1215 | /* but we need to call the standard routine as well */ |
| 1216 | 1216 | cpu_vblankcallback(machine, param); |
| r1293 | r1294 | |
| 1257 | 1257 | |
| 1258 | 1258 | /* reset the countdown and timer */ |
| 1259 | 1259 | cpu[cpunum].vblankint_countdown = cpu[cpunum].vblankint_multiplier; |
| 1260 | | |
| 1260 | | |
| 1261 | 1261 | } |
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | 1264 | /* else reset the VBLANK timer if this is going to be a real VBLANK */ |
| 1265 | 1265 | else if (vblank_countdown == 1) |
| 1266 | | |
| 1266 | | |
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | 1269 | /* is it a real VBLANK? */ |
| r1293 | r1294 | |
| 1274 | 1274 | video_frame_update(); |
| 1275 | 1275 | |
| 1276 | 1276 | /* Set the timer to update the screen */ |
| 1277 | | |
| 1277 | | |
| 1278 | 1278 | |
| 1279 | 1279 | /* reset the globals */ |
| 1280 | 1280 | cpu_vblankreset(); |
| r1293 | r1294 | |
| 1311 | 1311 | current_frame++; |
| 1312 | 1312 | |
| 1313 | 1313 | /* reset the refresh timer */ |
| 1314 | | |
| 1314 | | |
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | |
| r1293 | r1294 | |
| 1358 | 1358 | |
| 1359 | 1359 | static TIMER_CALLBACK( end_interleave_boost ) |
| 1360 | 1360 | { |
| 1361 | | |
| 1361 | | |
| 1362 | 1362 | LOG(("end_interleave_boost\n")); |
| 1363 | 1363 | } |
| 1364 | 1364 | |
| r1293 | r1294 | |
| 1373 | 1373 | |
| 1374 | 1374 | static void compute_perfect_interleave(void) |
| 1375 | 1375 | { |
| 1376 | s | |
| 1376 | attos | |
| 1377 | 1377 | int cpunum; |
| 1378 | 1378 | |
| 1379 | 1379 | /* start with a huge time factor and find the 2nd smallest cycle time */ |
| 1380 | perfect_interleave = time_zero; | |
| 1381 | perfect_interleave.subseconds = MAX_SUBSECONDS - 1; | |
| 1380 | perfect_interleave = attotime_zero; | |
| 1381 | perfect_interleave.attoseconds = ATTOSECONDS_PER_SECOND - 1; | |
| 1382 | 1382 | for (cpunum = 1; Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++) |
| 1383 | 1383 | { |
| 1384 | 1384 | /* find the 2nd smallest cycle interval */ |
| 1385 | if ( | |
| 1385 | if (attoseconds_per_cycle[cpunum] < smallest) | |
| 1386 | 1386 | { |
| 1387 | perfect_interleave.subseconds = smallest; | |
| 1388 | smallest = subseconds_per_cycle[cpunum]; | |
| 1387 | perfect_interleave.attoseconds = smallest; | |
| 1388 | smallest = attoseconds_per_cycle[cpunum]; | |
| 1389 | 1389 | } |
| 1390 | else if (subseconds_per_cycle[cpunum] < perfect_interleave.subseconds) | |
| 1391 | perfect_interleave.subseconds = subseconds_per_cycle[cpunum]; | |
| 1390 | else if (attoseconds_per_cycle[cpunum] < perfect_interleave.attoseconds) | |
| 1391 | perfect_interleave.attoseconds = attoseconds_per_cycle[cpunum]; | |
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | 1394 | /* adjust the final value */ |
| 1395 | if (perfect_interleave.subseconds == MAX_SUBSECONDS - 1) | |
| 1396 | perfect_interleave.subseconds = subseconds_per_cycle[0]; | |
| 1395 | if (perfect_interleave.attoseconds == ATTOSECONDS_PER_SECOND - 1) | |
| 1396 | perfect_interleave.attoseconds = attoseconds_per_cycle[0]; | |
| 1397 | 1397 | |
| 1398 | LOG(("Perfect interleave = % | |
| 1398 | LOG(("Perfect interleave = %s | |
| 1399 | 1399 | } |
| 1400 | 1400 | |
| 1401 | 1401 | |
| r1293 | r1294 | |
| 1408 | 1408 | |
| 1409 | 1409 | static void cpu_inittimers(running_machine *machine) |
| 1410 | 1410 | { |
| 1411 | | |
| 1411 | | |
| 1412 | 1412 | int cpunum, max, ipf; |
| 1413 | 1413 | |
| 1414 | 1414 | /* allocate a dummy timer at the minimum frequency to break things up */ |
| 1415 | 1415 | ipf = machine->drv->cpu_slices_per_frame; |
| 1416 | 1416 | if (ipf <= 0) |
| 1417 | 1417 | ipf = 1; |
| 1418 | timeslice_period = make_mame_time(0, machine->screen[0].refresh / ipf); | |
| 1419 | timeslice_timer = mame_timer_alloc(cpu_timeslicecallback); | |
| 1420 | mame_timer_adjust(timeslice_timer, timeslice_period, 0, timeslice_period); | |
| 1418 | timeslice_period = attotime_make(0, machine->screen[0].refresh / ipf); | |
| 1419 | timeslice_timer = timer_alloc(cpu_timeslicecallback); | |
| 1420 | timer_adjust(timeslice_timer, timeslice_period, 0, timeslice_period); | |
| 1421 | 1421 | |
| 1422 | 1422 | /* allocate timers to handle interleave boosts */ |
| 1423 | interleave_boost_timer = mame_timer_alloc(NULL); | |
| 1424 | interleave_boost_timer_end = mame_timer_alloc(end_interleave_boost); | |
| 1423 | interleave_boost_timer = timer_alloc(NULL); | |
| 1424 | interleave_boost_timer_end = timer_alloc(end_interleave_boost); | |
| 1425 | 1425 | |
| 1426 | 1426 | /* |
| 1427 | 1427 | * The following code finds all the CPUs that are interrupting in sync with the VBLANK |
| r1293 | r1294 | |
| 1464 | 1464 | } |
| 1465 | 1465 | |
| 1466 | 1466 | /* allocate a vblank timer at the frame rate * the LCD number of interrupts per frame */ |
| 1467 | vblank_period = | |
| 1467 | vblank_period = | |
| 1468 | 1468 | vblank_countdown = vblank_multiplier; |
| 1469 | 1469 | |
| 1470 | 1470 | /* allocate an update timer that will be used to time the actual screen updates */ |
| 1471 | update_timer = | |
| 1471 | update_timer = | |
| 1472 | 1472 | |
| 1473 | 1473 | /* |
| 1474 | 1474 | * The following code creates individual timers for each CPU whose interrupts are not |
| r1293 | r1294 | |
| 1483 | 1483 | /* compute the average number of cycles per interrupt */ |
| 1484 | 1484 | if (ipf <= 0) |
| 1485 | 1485 | ipf = 1; |
| 1486 | cpu[cpunum].vblankint_timer = | |
| 1486 | cpu[cpunum].vblankint_timer = | |
| 1487 | 1487 | |
| 1488 | 1488 | /* see if we need to allocate a CPU timer */ |
| 1489 | 1489 | if (machine->drv->cpu[cpunum].timed_interrupt_period != 0) |
| 1490 | 1490 | { |
| 1491 | cpu[cpunum].timedint_period = make_mame_time(0, machine->drv->cpu[cpunum].timed_interrupt_period); | |
| 1492 | cpu[cpunum].timedint_timer = mame_timer_alloc(cpu_timedintcallback); | |
| 1493 | mame_timer_adjust(cpu[cpunum].timedint_timer, cpu[cpunum].timedint_period, cpunum, cpu[cpunum].timedint_period); | |
| 1491 | cpu[cpunum].timedint_period = attotime_make(0, machine->drv->cpu[cpunum].timed_interrupt_period); | |
| 1492 | cpu[cpunum].timedint_timer = timer_alloc(cpu_timedintcallback); | |
| 1493 | timer_adjust(cpu[cpunum].timedint_timer, cpu[cpunum].timedint_period, cpunum, cpu[cpunum].timedint_period); | |
| 1494 | 1494 | } |
| 1495 | 1495 | } |
| 1496 | 1496 | |
| 1497 | 1497 | /* note that since we start the first frame on the refresh, we can't pulse starting |
| 1498 | 1498 | immediately; instead, we back up one VBLANK period, and inch forward until we hit |
| 1499 | 1499 | positive time. That time will be the time of the first VBLANK timer callback */ |
| 1500 | first_time = sub_subseconds_from_mame_time(vblank_period, machine->screen[0].vblank); | |
| 1501 | while (compare_mame_times(first_time, time_zero) < 0) | |
| 1500 | first_time = attotime_sub_attoseconds(vblank_period, machine->screen[0].vblank); | |
| 1501 | while (attotime_compare(first_time, attotime_zero) < 0) | |
| 1502 | 1502 | { |
| 1503 | 1503 | cpu_vblankcallback(machine, -1); |
| 1504 | first_time = a | |
| 1504 | first_time = a | |
| 1505 | 1505 | } |
| 1506 | | |
| 1506 | | |
| 1507 | 1507 | |
| 1508 | 1508 | /* reset the refresh timer to get ourself back in sync */ |
| 1509 | | |
| 1509 | | |
| 1510 | 1510 | } |
| 1511 | 1511 |
| r1293 | r1294 | |
|---|---|---|
| 100 | 100 | CPU_TMS32025, |
| 101 | 101 | CPU_TMS32026, |
| 102 | 102 | CPU_TMS32031, |
| 103 | CPU_TMS32032, | |
| 103 | 104 | CPU_TMS32051, |
| 104 | 105 | CPU_CCPU, |
| 105 | 106 | CPU_ADSP2100, |
| r1293 | r1294 | |
| 224 | 225 | void (*vblank_interrupt)(void); /* for interrupts tied to VBLANK */ |
| 225 | 226 | int vblank_interrupts_per_frame;/* usually 1 */ |
| 226 | 227 | void (*timed_interrupt)(void); /* for interrupts not tied to VBLANK */ |
| 227 | | |
| 228 | attoseconds_t timed_interrupt_period; /* period for periodic interrupts */ | |
| 228 | 229 | void * reset_param; /* parameter for cpu_reset */ |
| 229 | 230 | const char *tag; |
| 230 | 231 | }; |
| r1293 | r1294 | |
| 306 | 307 | void activecpu_abort_timeslice(void); |
| 307 | 308 | |
| 308 | 309 | /* Returns the current local time for a CPU */ |
| 309 | ||
| 310 | ||
| 310 | 311 | |
| 311 | 312 | /* Returns the current CPU's unscaled running clock speed */ |
| 312 | 313 | /* If you want to know the current effective running clock |
| r1293 | r1294 | |
| 315 | 316 | |
| 316 | 317 | /* Sets the current CPU's clock speed and then adjusts for scaling */ |
| 317 | 318 | void cpunum_set_clock(int cpunum, int clock); |
| 318 | void cpunum_set_clock_period(int cpunum, | |
| 319 | void cpunum_set_clock_period(int cpunum, attoseconds_t clock_period); | |
| 319 | 320 | |
| 320 | 321 | /* Returns the current scaling factor for a CPU's clock speed */ |
| 321 | 322 | double cpunum_get_clockscale(int cpunum); |
| r1293 | r1294 | |
| 324 | 325 | void cpunum_set_clockscale(int cpunum, double clockscale); |
| 325 | 326 | |
| 326 | 327 | /* Temporarily boosts the interleave factor */ |
| 327 | void cpu_boost_interleave( | |
| 328 | void cpu_boost_interleave( | |
| 328 | 329 | |
| 329 | 330 | |
| 330 | 331 | |
| r1293 | r1294 | |
| 382 | 383 | void cpu_trigger(int trigger); |
| 383 | 384 | |
| 384 | 385 | /* generate a trigger after a specific period of time */ |
| 385 | void cpu_triggertime( | |
| 386 | void cpu_triggertime( | |
| 386 | 387 | |
| 387 | 388 | /* generate a trigger corresponding to an interrupt on the given CPU */ |
| 388 | 389 | void cpu_triggerint(int cpunum); |
| r1293 | r1294 | |
| 409 | 410 | void cpu_yield(void); |
| 410 | 411 | |
| 411 | 412 | /* burn CPU cycles for a specific period of time */ |
| 412 | void cpu_spinuntil_time( | |
| 413 | void cpu_spinuntil_time( | |
| 413 | 414 | |
| 414 | 415 | /* yield our timeslice for a specific period of time */ |
| 415 | void cpu_yielduntil_time( | |
| 416 | void cpu_yielduntil_time( | |
| 416 | 417 | |
| 417 | 418 | |
| 418 | 419 |
| r1293 | r1294 | |
|---|---|---|
| 1858 | 1858 | #ifdef LOG_CYM_FILE |
| 1859 | 1859 | cymfile = fopen("2413_.cym","wb"); |
| 1860 | 1860 | if (cymfile) |
| 1861 | | |
| 1861 | | |
| 1862 | 1862 | else |
| 1863 | 1863 | logerror("Could not create file 2413_.cym\n"); |
| 1864 | 1864 | #endif |
| r1293 | r1294 | |
|---|---|---|
| 20 | 20 | struct ym2612_info |
| 21 | 21 | { |
| 22 | 22 | sound_stream * stream; |
| 23 | | |
| 23 | | |
| 24 | 24 | void * chip; |
| 25 | 25 | const struct YM2612interface *intf; |
| 26 | 26 | }; |
| r1293 | r1294 | |
| 51 | 51 | struct ym2612_info *info = param; |
| 52 | 52 | if( count == 0 ) |
| 53 | 53 | { /* Reset FM Timer */ |
| 54 | | |
| 54 | | |
| 55 | 55 | } |
| 56 | 56 | else |
| 57 | 57 | { /* Start FM Timer */ |
| 58 | mame_time period = scale_up_mame_time(MAME_TIME_IN_HZ(clock), count); | |
| 59 | if (!mame_timer_enable(info->timer[c], 1)) | |
| 60 | mame_timer_adjust_ptr(info->timer[c], period, time_zero); | |
| 58 | attotime period = attotime_mul(ATTOTIME_IN_HZ(clock), count); | |
| 59 | if (!timer_enable(info->timer[c], 1)) | |
| 60 | timer_adjust_ptr(info->timer[c], period, attotime_zero); | |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| r1293 | r1294 | |
| 99 | 99 | |
| 100 | 100 | /* FM init */ |
| 101 | 101 | /* Timer Handler set */ |
| 102 | info->timer[0] = mame_timer_alloc_ptr(timer_callback_2612_0, info); | |
| 103 | info->timer[1] = mame_timer_alloc_ptr(timer_callback_2612_1, info); | |
| 102 | info->timer[0] = timer_alloc_ptr(timer_callback_2612_0, info); | |
| 103 | info->timer[1] = timer_alloc_ptr(timer_callback_2612_1, info); | |
| 104 | 104 | |
| 105 | 105 | /* stream system initialize */ |
| 106 | 106 | info->stream = stream_create(0,2,rate,info,ym2612_stream_update); |
| r1293 | r1294 | |
|---|---|---|
| 473 | 473 | // One or more of the registers must be the timer period |
| 474 | 474 | // And anyway, this particular frequency is probably wrong |
| 475 | 475 | // 480 hz is TRUSTED by gokuparo disco stage - the looping sample doesn't line up otherwise |
| 476 | | |
| 476 | | |
| 477 | 477 | |
| 478 | 478 | info->stream = stream_create(0, 2, clock, info, K054539_update); |
| 479 | 479 |
| r1293 | r1294 | |
|---|---|---|
| 36 | 36 | sound_stream * stream; /* number of stream system */ |
| 37 | 37 | INT32 index; |
| 38 | 38 | INT32 clock; /* clock rate */ |
| 39 | | |
| 39 | | |
| 40 | 40 | INT32 data; /* next adpcm data */ |
| 41 | 41 | INT32 vclk; /* vclk signal (external mode) */ |
| 42 | 42 | INT32 reset; /* reset pin signal */ |
| r1293 | r1294 | |
| 184 | 184 | |
| 185 | 185 | /* stream system initialize */ |
| 186 | 186 | voice->stream = stream_create(0,1,clock,voice,MSM5205_update); |
| 187 | voice->timer = | |
| 187 | voice->timer = | |
| 188 | 188 | |
| 189 | 189 | /* initialize */ |
| 190 | 190 | msm5205_reset(voice); |
| r1293 | r1294 | |
| 268 | 268 | /* timer set */ |
| 269 | 269 | if( prescaler ) |
| 270 | 270 | { |
| 271 | mame_time period = scale_up_mame_time(MAME_TIME_IN_HZ(voice->clock), prescaler); | |
| 272 | mame_timer_adjust_ptr(voice->timer, period, period); | |
| 271 | attotime period = attotime_mul(ATTOTIME_IN_HZ(voice->clock), prescaler); | |
| 272 | timer_adjust_ptr(voice->timer, period, period); | |
| 273 | 273 | } |
| 274 | 274 | else |
| 275 | | |
| 275 | | |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | if( voice->bitwidth != bitwidth ) |
| r1293 | r1294 | |
|---|---|---|
| 29 | 29 | struct ym3812_info |
| 30 | 30 | { |
| 31 | 31 | sound_stream * stream; |
| 32 | | |
| 32 | | |
| 33 | 33 | void * chip; |
| 34 | 34 | const struct YM3812interface *intf; |
| 35 | 35 | }; |
| r1293 | r1294 | |
| 51 | 51 | YM3812TimerOver(info->chip,1); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | static void TimerHandler_3812(void *param,int c, | |
| 54 | static void TimerHandler_3812(void *param,int c, | |
| 55 | 55 | { |
| 56 | 56 | struct ym3812_info *info = param; |
| 57 | if( compare | |
| 57 | if( attotime_compare | |
| 58 | 58 | { /* Reset FM Timer */ |
| 59 | | |
| 59 | | |
| 60 | 60 | } |
| 61 | 61 | else |
| 62 | 62 | { /* Start FM Timer */ |
| 63 | | |
| 63 | | |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| r1293 | r1294 | |
| 101 | 101 | YM3812SetIRQHandler (info->chip, IRQHandler_3812, info); |
| 102 | 102 | YM3812SetUpdateHandler(info->chip, _stream_update_3812, info); |
| 103 | 103 | |
| 104 | info->timer[0] = mame_timer_alloc_ptr(timer_callback_3812_0, info); | |
| 105 | info->timer[1] = mame_timer_alloc_ptr(timer_callback_3812_1, info); | |
| 104 | info->timer[0] = timer_alloc_ptr(timer_callback_3812_0, info); | |
| 105 | info->timer[1] = timer_alloc_ptr(timer_callback_3812_1, info); | |
| 106 | 106 | |
| 107 | 107 | return info; |
| 108 | 108 | } |
| r1293 | r1294 | |
| 196 | 196 | struct ym3526_info |
| 197 | 197 | { |
| 198 | 198 | sound_stream * stream; |
| 199 | | |
| 199 | | |
| 200 | 200 | void * chip; |
| 201 | 201 | const struct YM3526interface *intf; |
| 202 | 202 | }; |
| r1293 | r1294 | |
| 220 | 220 | YM3526TimerOver(info->chip,1); |
| 221 | 221 | } |
| 222 | 222 | /* TimerHandler from fm.c */ |
| 223 | static void TimerHandler_3526(void *param,int c, | |
| 223 | static void TimerHandler_3526(void *param,int c, | |
| 224 | 224 | { |
| 225 | 225 | struct ym3526_info *info = param; |
| 226 | if( compare | |
| 226 | if( attotime_compare | |
| 227 | 227 | { /* Reset FM Timer */ |
| 228 | | |
| 228 | | |
| 229 | 229 | } |
| 230 | 230 | else |
| 231 | 231 | { /* Start FM Timer */ |
| 232 | | |
| 232 | | |
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
| r1293 | r1294 | |
| 269 | 269 | YM3526SetIRQHandler (info->chip, IRQHandler_3526, info); |
| 270 | 270 | YM3526SetUpdateHandler(info->chip, _stream_update_3526, info); |
| 271 | 271 | |
| 272 | info->timer[0] = mame_timer_alloc_ptr(timer_callback_3526_0, info); | |
| 273 | info->timer[1] = mame_timer_alloc_ptr(timer_callback_3526_1, info); | |
| 272 | info->timer[0] = timer_alloc_ptr(timer_callback_3526_0, info); | |
| 273 | info->timer[1] = timer_alloc_ptr(timer_callback_3526_1, info); | |
| 274 | 274 | |
| 275 | 275 | return info; |
| 276 | 276 | } |
| r1293 | r1294 | |
| 364 | 364 | struct y8950_info |
| 365 | 365 | { |
| 366 | 366 | sound_stream * stream; |
| 367 | | |
| 367 | | |
| 368 | 368 | void * chip; |
| 369 | 369 | const struct Y8950interface *intf; |
| 370 | 370 | int index; |
| r1293 | r1294 | |
| 385 | 385 | struct y8950_info *info = param; |
| 386 | 386 | Y8950TimerOver(info->chip,1); |
| 387 | 387 | } |
| 388 | static void TimerHandler_8950(void *param,int c, | |
| 388 | static void TimerHandler_8950(void *param,int c, | |
| 389 | 389 | { |
| 390 | 390 | struct y8950_info *info = param; |
| 391 | if( compare | |
| 391 | if( attotime_compare | |
| 392 | 392 | { /* Reset FM Timer */ |
| 393 | | |
| 393 | | |
| 394 | 394 | } |
| 395 | 395 | else |
| 396 | 396 | { /* Start FM Timer */ |
| 397 | | |
| 397 | | |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
| r1293 | r1294 | |
| 475 | 475 | Y8950SetIRQHandler (info->chip, IRQHandler_8950, info); |
| 476 | 476 | Y8950SetUpdateHandler(info->chip, _stream_update_8950, info); |
| 477 | 477 | |
| 478 | info->timer[0] = mame_timer_alloc_ptr(timer_callback_8950_0, info); | |
| 479 | info->timer[1] = mame_timer_alloc_ptr(timer_callback_8950_1, info); | |
| 478 | info->timer[0] = timer_alloc_ptr(timer_callback_8950_0, info); | |
| 479 | info->timer[1] = timer_alloc_ptr(timer_callback_8950_1, info); | |
| 480 | 480 | |
| 481 | 481 | return info; |
| 482 | 482 | } |
| r1293 | r1294 | |
|---|---|---|
| 199 | 199 | struct YMZ280BVoice *voice = &chip->voice[j]; |
| 200 | 200 | update_step(chip, voice); |
| 201 | 201 | if(voice->irq_schedule) |
| 202 | | |
| 202 | | |
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
| r1293 | r1294 | |
| 575 | 575 | voice->playing = 0; |
| 576 | 576 | |
| 577 | 577 | /* set update_irq_state_timer. IRQ is signaled on next CPU execution. */ |
| 578 | | |
| 578 | | |
| 579 | 579 | voice->irq_schedule = 1; |
| 580 | 580 | } |
| 581 | 581 | } |
| r1293 | r1294 | |
|---|---|---|
| 256 | 256 | int clock; /* master clock (Hz) */ |
| 257 | 257 | int rate; /* sampling rate (Hz) */ |
| 258 | 258 | double freqbase; /* frequency base */ |
| 259 | | |
| 259 | | |
| 260 | 260 | } OPL3; |
| 261 | 261 | |
| 262 | 262 | |
| r1293 | r1294 | |
| 1299 | 1299 | /* logerror("YMF262: freqbase=%f\n", chip->freqbase); */ |
| 1300 | 1300 | |
| 1301 | 1301 | /* Timer base time */ |
| 1302 | chip->TimerBase = | |
| 1302 | chip->TimerBase = | |
| 1303 | 1303 | |
| 1304 | 1304 | /* make fnumber -> increment counter table */ |
| 1305 | 1305 | for( i=0 ; i < 1024 ; i++ ) |
| r1293 | r1294 | |
| 1726 | 1726 | /* timer 2 */ |
| 1727 | 1727 | if(chip->st[1] != st2) |
| 1728 | 1728 | { |
| 1729 | | |
| 1729 | | |
| 1730 | 1730 | chip->st[1] = st2; |
| 1731 | 1731 | if (chip->timer_handler) (chip->timer_handler)(chip->TimerParam,1,period); |
| 1732 | 1732 | } |
| 1733 | 1733 | /* timer 1 */ |
| 1734 | 1734 | if(chip->st[0] != st1) |
| 1735 | 1735 | { |
| 1736 | | |
| 1736 | | |
| 1737 | 1737 | chip->st[0] = st1; |
| 1738 | 1738 | if (chip->timer_handler) (chip->timer_handler)(chip->TimerParam,0,period); |
| 1739 | 1739 | } |
| r1293 | r1294 | |
| 2255 | 2255 | #ifdef LOG_CYM_FILE |
| 2256 | 2256 | cymfile = fopen("ymf262_.cym","wb"); |
| 2257 | 2257 | if (cymfile) |
| 2258 | | |
| 2258 | | |
| 2259 | 2259 | else |
| 2260 | 2260 | logerror("Could not create ymf262_.cym file\n"); |
| 2261 | 2261 | #endif |
| r1293 | r1294 | |
| 2450 | 2450 | OPL3_STATUS_SET(chip,0x40); |
| 2451 | 2451 | } |
| 2452 | 2452 | /* reload timer */ |
| 2453 | if (chip->timer_handler) (chip->timer_handler)(chip->TimerParam,c, | |
| 2453 | if (chip->timer_handler) (chip->timer_handler)(chip->TimerParam,c, | |
| 2454 | 2454 | return chip->status>>7; |
| 2455 | 2455 | } |
| 2456 | 2456 |
| r1293 | r1294 | |
|---|---|---|
| 25 | 25 | #endif |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | typedef void (*OPL3_TIMERHANDLER)(void *param,int timer, | |
| 28 | typedef void (*OPL3_TIMERHANDLER)(void *param,int timer, | |
| 29 | 29 | typedef void (*OPL3_IRQHANDLER)(void *param,int irq); |
| 30 | 30 | typedef void (*OPL3_UPDATEHANDLER)(void *param,int min_interval_us); |
| 31 | 31 |
| r1293 | r1294 | |
|---|---|---|
| 153 | 153 | /* internal clock to output sample rate mapping */ |
| 154 | 154 | UINT32 pos; /* current output sample position */ |
| 155 | 155 | UINT32 step; /* step value per output sample */ |
| 156 | mame_time clock_period; /* clock period */ | |
| 157 | mame_timer *timer; /* timer */ | |
| 156 | attotime clock_period; /* clock period */ | |
| 157 | emu_timer *timer; /* timer */ | |
| 158 | 158 | |
| 159 | 159 | /* I/O lines */ |
| 160 | 160 | UINT8 fifo_in; /* last data written to the sound chip */ |
| r1293 | r1294 | |
| 540 | 540 | |
| 541 | 541 | /* set a timer to go off when that is done */ |
| 542 | 542 | if (chip->state != STATE_IDLE) |
| 543 | | |
| 543 | | |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | |
| r1293 | r1294 | |
| 575 | 575 | |
| 576 | 576 | /* turn off any timer */ |
| 577 | 577 | if (chip->timer) |
| 578 | | |
| 578 | | |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | |
| r1293 | r1294 | |
| 634 | 634 | chip->step = 4 * FRAC_ONE; |
| 635 | 635 | |
| 636 | 636 | /* compute the clock period */ |
| 637 | chip->clock_period = | |
| 637 | chip->clock_period = | |
| 638 | 638 | |
| 639 | 639 | /* set the intial state */ |
| 640 | 640 | chip->state = STATE_IDLE; |
| r1293 | r1294 | |
| 643 | 643 | if (intf->region != 0) |
| 644 | 644 | chip->rom = chip->rombase = memory_region(intf->region); |
| 645 | 645 | else |
| 646 | chip->timer = | |
| 646 | chip->timer = | |
| 647 | 647 | |
| 648 | 648 | /* set the DRQ callback */ |
| 649 | 649 | chip->drqcallback = intf->drqcallback; |
| r1293 | r1294 | |
| 702 | 702 | |
| 703 | 703 | /* for slave mode, start the timer going */ |
| 704 | 704 | if (chip->timer) |
| 705 | | |
| 705 | | |
| 706 | 706 | } |
| 707 | 707 | } |
| 708 | 708 |
| r1293 | r1294 | |
|---|---|---|
| 100 | 100 | INT8 status; |
| 101 | 101 | INT8 enable; |
| 102 | 102 | |
| 103 | | |
| 103 | | |
| 104 | 104 | |
| 105 | 105 | INT8 reg0, reg1, reg2, reg3, pcmreg, timerreg; |
| 106 | 106 | UINT32 ext_address; |
| r1293 | r1294 | |
| 1386 | 1386 | { |
| 1387 | 1387 | int slotnum; |
| 1388 | 1388 | YMF271Group *group; |
| 1389 | | |
| 1389 | | |
| 1390 | 1390 | |
| 1391 | 1391 | slotnum = fm_tab[chip->timerreg & 0xf]; |
| 1392 | 1392 | group = &chip->groups[slotnum]; |
| r1293 | r1294 | |
| 1447 | 1447 | if (chip->irq_callback) chip->irq_callback(0); |
| 1448 | 1448 | |
| 1449 | 1449 | //period = (double)(256.0 - chip->timerAVal ) * ( 384.0 * 4.0 / (double)CLOCK); |
| 1450 | period = | |
| 1450 | period = | |
| 1451 | 1451 | |
| 1452 | | |
| 1452 | | |
| 1453 | 1453 | } |
| 1454 | 1454 | if (data & 0x20) |
| 1455 | 1455 | { // timer B reset |
| r1293 | r1294 | |
| 1458 | 1458 | |
| 1459 | 1459 | if (chip->irq_callback) chip->irq_callback(0); |
| 1460 | 1460 | |
| 1461 | period = | |
| 1461 | period = | |
| 1462 | 1462 | |
| 1463 | | |
| 1463 | | |
| 1464 | 1464 | } |
| 1465 | 1465 | |
| 1466 | 1466 | break; |
| r1293 | r1294 | |
| 1719 | 1719 | |
| 1720 | 1720 | static void ymf271_init(YMF271Chip *chip, UINT8 *rom, void (*cb)(int), read8_handler ext_read, write8_handler ext_write) |
| 1721 | 1721 | { |
| 1722 | chip->timA = mame_timer_alloc_ptr(ymf271_timer_a_tick, chip); | |
| 1723 | chip->timB = mame_timer_alloc_ptr(ymf271_timer_b_tick, chip); | |
| 1722 | chip->timA = timer_alloc_ptr(ymf271_timer_a_tick, chip); | |
| 1723 | chip->timB = timer_alloc_ptr(ymf271_timer_b_tick, chip); | |
| 1724 | 1724 | |
| 1725 | 1725 | chip->rom = rom; |
| 1726 | 1726 | chip->irq_callback = cb; |
| r1293 | r1294 | |
|---|---|---|
| 13 | 13 | * For more details read mame.txt that comes with MAME. |
| 14 | 14 | * |
| 15 | 15 | * 4.51: |
| 16 | * - changed to use the | |
| 16 | * - changed to use the | |
| 17 | 17 | * 4.5: |
| 18 | 18 | * - changed the 9/17 bit polynomial formulas such that the values |
| 19 | 19 | * required for the Tempest Pokey protection will be found. |
| r1293 | r1294 | |
| 195 | 195 | UINT32 r17; /* rand17 index */ |
| 196 | 196 | UINT32 clockmult; /* clock multiplier */ |
| 197 | 197 | sound_stream * channel; /* streams channel */ |
| 198 | mame_timer *timer[3]; /* timers for channel 1,2 and 4 events */ | |
| 199 | mame_time timer_period[3]; /* computed periods for these timers */ | |
| 198 | emu_timer *timer[3]; /* timers for channel 1,2 and 4 events */ | |
| 199 | attotime timer_period[3]; /* computed periods for these timers */ | |
| 200 | 200 | int timer_param[3]; /* computed parameters for these timers */ |
| 201 | mame_timer *rtimer; /* timer for calculating the random offset */ | |
| 202 | mame_timer *ptimer[8]; /* pot timers */ | |
| 201 | emu_timer *rtimer; /* timer for calculating the random offset */ | |
| 202 | emu_timer *ptimer[8]; /* pot timers */ | |
| 203 | 203 | read8_handler pot_r[8]; |
| 204 | 204 | read8_handler allpot_r; |
| 205 | 205 | read8_handler serin_r; |
| r1293 | r1294 | |
| 219 | 219 | UINT8 SKSTAT; /* SKSTAT (R/D20F) */ |
| 220 | 220 | UINT8 SKCTL; /* SKCTL (W/D20F) */ |
| 221 | 221 | struct POKEYinterface intf; |
| 222 | mame_time clock_period; | |
| 223 | mame_time ad_time_fast; | |
| 224 | mame_time ad_time_slow; | |
| 222 | attotime clock_period; | |
| 223 | attotime ad_time_fast; | |
| 224 | attotime ad_time_slow; | |
| 225 | 225 | int index; |
| 226 | 226 | |
| 227 | 227 | UINT8 poly4[0x0f]; |
| r1293 | r1294 | |
| 495 | 495 | PROCESS_SAMPLE(chip); \ |
| 496 | 496 | } \ |
| 497 | 497 | } \ |
| 498 | | |
| 498 | | |
| 499 | 499 | |
| 500 | 500 | #else /* no HEAVY_MACRO_USAGE */ |
| 501 | 501 | /* |
| r1293 | r1294 | |
| 546 | 546 | PROCESS_CHANNEL(chip,channel); \ |
| 547 | 547 | } \ |
| 548 | 548 | } \ |
| 549 | | |
| 549 | | |
| 550 | 550 | |
| 551 | 551 | #endif |
| 552 | 552 | |
| r1293 | r1294 | |
| 612 | 612 | state_save_register_item("pokey", index, chip->r17); |
| 613 | 613 | state_save_register_item("pokey", index, chip->clockmult); |
| 614 | 614 | state_save_register_item("pokey", index, chip->timer_period[0].seconds); |
| 615 | state_save_register_item("pokey", index, chip->timer_period[0]. | |
| 615 | state_save_register_item("pokey", index, chip->timer_period[0].attoseconds); | |
| 616 | 616 | state_save_register_item("pokey", index, chip->timer_period[1].seconds); |
| 617 | state_save_register_item("pokey", index, chip->timer_period[1]. | |
| 617 | state_save_register_item("pokey", index, chip->timer_period[1].attoseconds); | |
| 618 | 618 | state_save_register_item("pokey", index, chip->timer_period[2].seconds); |
| 619 | state_save_register_item("pokey", index, chip->timer_period[2]. | |
| 619 | state_save_register_item("pokey", index, chip->timer_period[2].attoseconds); | |
| 620 | 620 | state_save_register_item_array("pokey", index, chip->timer_param); |
| 621 | 621 | state_save_register_item_array("pokey", index, chip->AUDF); |
| 622 | 622 | state_save_register_item_array("pokey", index, chip->AUDC); |
| r1293 | r1294 | |
| 644 | 644 | |
| 645 | 645 | if (config) |
| 646 | 646 | memcpy(&chip->intf, config, sizeof(struct POKEYinterface)); |
| 647 | chip->clock_period = | |
| 647 | chip->clock_period = | |
| 648 | 648 | chip->index = sndindex; |
| 649 | 649 | |
| 650 | 650 | /* calculate the A/D times |
| r1293 | r1294 | |
| 654 | 654 | * In quick mode (SK_PADDLE set) the conversion is done very fast |
| 655 | 655 | * (takes two scanlines) but the result is not as accurate. |
| 656 | 656 | */ |
| 657 | chip->ad_time_fast = scale_down_mame_time(scale_up_mame_time(MAME_TIME_IN_NSEC(64000*2/228), FREQ_17_EXACT), clock); | |
| 658 | chip->ad_time_slow = scale_down_mame_time(scale_up_mame_time(MAME_TIME_IN_NSEC(64000 ), FREQ_17_EXACT), clock); | |
| 657 | chip->ad_time_fast = attotime_div(attotime_mul(ATTOTIME_IN_NSEC(64000*2/228), FREQ_17_EXACT), clock); | |
| 658 | chip->ad_time_slow = attotime_div(attotime_mul(ATTOTIME_IN_NSEC(64000 ), FREQ_17_EXACT), clock); | |
| 659 | 659 | |
| 660 | 660 | /* initialize the poly counters */ |
| 661 | 661 | poly_init(chip->poly4, 4, 3, 1, 0x00004); |
| r1293 | r1294 | |
| 675 | 675 | chip->clockmult = DIV_64; |
| 676 | 676 | chip->KBCODE = 0x09; /* Atari 800 'no key' */ |
| 677 | 677 | chip->SKCTL = SK_RESET; /* let the RNG run after reset */ |
| 678 | chip->rtimer = | |
| 678 | chip->rtimer = | |
| 679 | 679 | |
| 680 | chip->timer[0] = mame_timer_alloc_ptr(pokey_timer_expire_1, chip); | |
| 681 | chip->timer[1] = mame_timer_alloc_ptr(pokey_timer_expire_2, chip); | |
| 682 | chip->timer[2] = mame_timer_alloc_ptr(pokey_timer_expire_4, chip); | |
| 680 | chip->timer[0] = timer_alloc_ptr(pokey_timer_expire_1, chip); | |
| 681 | chip->timer[1] = timer_alloc_ptr(pokey_timer_expire_2, chip); | |
| 682 | chip->timer[2] = timer_alloc_ptr(pokey_timer_expire_4, chip); | |
| 683 | 683 | |
| 684 | chip->ptimer[0] = mame_timer_alloc_ptr(pokey_pot_trigger_0, chip); | |
| 685 | chip->ptimer[1] = mame_timer_alloc_ptr(pokey_pot_trigger_1, chip); | |
| 686 | chip->ptimer[2] = mame_timer_alloc_ptr(pokey_pot_trigger_2, chip); | |
| 687 | chip->ptimer[3] = mame_timer_alloc_ptr(pokey_pot_trigger_3, chip); | |
| 688 | chip->ptimer[4] = mame_timer_alloc_ptr(pokey_pot_trigger_4, chip); | |
| 689 | chip->ptimer[5] = mame_timer_alloc_ptr(pokey_pot_trigger_5, chip); | |
| 690 | chip->ptimer[6] = mame_timer_alloc_ptr(pokey_pot_trigger_6, chip); | |
| 691 | chip->ptimer[7] = mame_timer_alloc_ptr(pokey_pot_trigger_7, chip); | |
| 684 | chip->ptimer[0] = timer_alloc_ptr(pokey_pot_trigger_0, chip); | |
| 685 | chip->ptimer[1] = timer_alloc_ptr(pokey_pot_trigger_1, chip); | |
| 686 | chip->ptimer[2] = timer_alloc_ptr(pokey_pot_trigger_2, chip); | |
| 687 | chip->ptimer[3] = timer_alloc_ptr(pokey_pot_trigger_3, chip); | |
| 688 | chip->ptimer[4] = timer_alloc_ptr(pokey_pot_trigger_4, chip); | |
| 689 | chip->ptimer[5] = timer_alloc_ptr(pokey_pot_trigger_5, chip); | |
| 690 | chip->ptimer[6] = timer_alloc_ptr(pokey_pot_trigger_6, chip); | |
| 691 | chip->ptimer[7] = timer_alloc_ptr(pokey_pot_trigger_7, chip); | |
| 692 | 692 | |
| 693 | 693 | chip->pot_r[0] = chip->intf.pot_r[0]; |
| 694 | 694 | chip->pot_r[1] = chip->intf.pot_r[1]; |
| r1293 | r1294 | |
| 832 | 832 | |
| 833 | 833 | static void pokey_pot_trigger_common(struct POKEYregisters *p, int pot) |
| 834 | 834 | { |
| 835 | LOG(("POKEY #%p POT%d triggers after %dus\n", p, pot, (int)(1000000 * | |
| 835 | LOG(("POKEY #%p POT%d triggers after %dus\n", p, pot, (int)(1000000 * | |
| 836 | 836 | p->ALLPOT &= ~(1 << pot); /* set the enabled timer irq status bits */ |
| 837 | 837 | } |
| 838 | 838 | |
| r1293 | r1294 | |
| 870 | 870 | |
| 871 | 871 | /* final value */ |
| 872 | 872 | p->POTx[pot] = r; |
| 873 | | |
| 873 | | |
| 874 | 874 | } |
| 875 | 875 | } |
| 876 | 876 | } |
| r1293 | r1294 | |
| 904 | 904 | */ |
| 905 | 905 | if( p->ALLPOT & (1 << pot) ) |
| 906 | 906 | { |
| 907 | data = | |
| 907 | data = | |
| 908 | 908 | LOG(("POKEY #%d read POT%d (interpolated) $%02x\n", chip, pot, data)); |
| 909 | 909 | } |
| 910 | 910 | else |
| r1293 | r1294 | |
| 954 | 954 | ****************************************************************/ |
| 955 | 955 | if( p->SKCTL & SK_RESET ) |
| 956 | 956 | { |
| 957 | adjust = | |
| 957 | adjust = | |
| 958 | 958 | p->r9 = (p->r9 + adjust) % 0x001ff; |
| 959 | 959 | p->r17 = (p->r17 + adjust) % 0x1ffff; |
| 960 | 960 | } |
| r1293 | r1294 | |
| 976 | 976 | LOG_RAND(("POKEY #%d adjust %u rand17[$%05x]: $%02x\n", chip, adjust, p->r17, p->RANDOM)); |
| 977 | 977 | } |
| 978 | 978 | if (adjust > 0) |
| 979 | | |
| 979 | | |
| 980 | 980 | data = p->RANDOM ^ 0xff; |
| 981 | 981 | break; |
| 982 | 982 | |
| r1293 | r1294 | |
| 1137 | 1137 | /* first remove any existing timers */ |
| 1138 | 1138 | LOG_TIMER(("POKEY #%d STIMER $%02x\n", chip, data)); |
| 1139 | 1139 | |
| 1140 | mame_timer_adjust_ptr(p->timer[TIMER1], time_never, time_zero); | |
| 1141 | mame_timer_adjust_ptr(p->timer[TIMER2], time_never, time_zero); | |
| 1142 | mame_timer_adjust_ptr(p->timer[TIMER4], time_never, time_zero); | |
| 1140 | timer_adjust_ptr(p->timer[TIMER1], attotime_never, attotime_zero); | |
| 1141 | timer_adjust_ptr(p->timer[TIMER2], attotime_never, attotime_zero); | |
| 1142 | timer_adjust_ptr(p->timer[TIMER4], attotime_never, attotime_zero); | |
| 1143 | 1143 | |
| 1144 | 1144 | /* reset all counters to zero (side effect) */ |
| 1145 | 1145 | p->polyadjust = 0; |
| r1293 | r1294 | |
| 1155 | 1155 | { |
| 1156 | 1156 | LOG_TIMER(("POKEY #%d timer1+2 after %d clocks\n", chip, p->divisor[CHAN2])); |
| 1157 | 1157 | /* set timer #1 _and_ #2 event after timer_div clocks of joined CHAN1+CHAN2 */ |
| 1158 | p->timer_period[TIMER2] = | |
| 1158 | p->timer_period[TIMER2] = | |
| 1159 | 1159 | p->timer_param[TIMER2] = (chip<<3)|IRQ_TIMR2|IRQ_TIMR1; |
| 1160 | | |
| 1160 | | |
| 1161 | 1161 | } |
| 1162 | 1162 | } |
| 1163 | 1163 | else |
| r1293 | r1294 | |
| 1166 | 1166 | { |
| 1167 | 1167 | LOG_TIMER(("POKEY #%d timer1 after %d clocks\n", chip, p->divisor[CHAN1])); |
| 1168 | 1168 | /* set timer #1 event after timer_div clocks of CHAN1 */ |
| 1169 | p->timer_period[TIMER1] = | |
| 1169 | p->timer_period[TIMER1] = | |
| 1170 | 1170 | p->timer_param[TIMER1] = (chip<<3)|IRQ_TIMR1; |
| 1171 | | |
| 1171 | | |
| 1172 | 1172 | } |
| 1173 | 1173 | |
| 1174 | 1174 | if( p->divisor[CHAN2] > 4 ) |
| 1175 | 1175 | { |
| 1176 | 1176 | LOG_TIMER(("POKEY #%d timer2 after %d clocks\n", chip, p->divisor[CHAN2])); |
| 1177 | 1177 | /* set timer #2 event after timer_div clocks of CHAN2 */ |
| 1178 | p->timer_period[TIMER2] = | |
| 1178 | p->timer_period[TIMER2] = | |
| 1179 | 1179 | p->timer_param[TIMER2] = (chip<<3)|IRQ_TIMR2; |
| 1180 | | |
| 1180 | | |
| 1181 | 1181 | } |
| 1182 | 1182 | } |
| 1183 | 1183 | |
| r1293 | r1294 | |
| 1192 | 1192 | { |
| 1193 | 1193 | LOG_TIMER(("POKEY #%d timer4 after %d clocks\n", chip, p->divisor[CHAN4])); |
| 1194 | 1194 | /* set timer #4 event after timer_div clocks of CHAN4 */ |
| 1195 | p->timer_period[TIMER4] = | |
| 1195 | p->timer_period[TIMER4] = | |
| 1196 | 1196 | p->timer_param[TIMER4] = (chip<<3)|IRQ_TIMR4; |
| 1197 | | |
| 1197 | | |
| 1198 | 1198 | } |
| 1199 | 1199 | } |
| 1200 | 1200 | } |
| r1293 | r1294 | |
| 1204 | 1204 | { |
| 1205 | 1205 | LOG_TIMER(("POKEY #%d timer4 after %d clocks\n", chip, p->divisor[CHAN4])); |
| 1206 | 1206 | /* set timer #4 event after timer_div clocks of CHAN4 */ |
| 1207 | p->timer_period[TIMER4] = | |
| 1207 | p->timer_period[TIMER4] = | |
| 1208 | 1208 | p->timer_param[TIMER4] = (chip<<3)|IRQ_TIMR4; |
| 1209 | | |
| 1209 | | |
| 1210 | 1210 | } |
| 1211 | 1211 | } |
| 1212 | 1212 | |
| 1213 | mame_timer_enable(p->timer[TIMER1], p->IRQEN & IRQ_TIMR1); | |
| 1214 | mame_timer_enable(p->timer[TIMER2], p->IRQEN & IRQ_TIMR2); | |
| 1215 | mame_timer_enable(p->timer[TIMER4], p->IRQEN & IRQ_TIMR4); | |
| 1213 | timer_enable(p->timer[TIMER1], p->IRQEN & IRQ_TIMR1); | |
| 1214 | timer_enable(p->timer[TIMER2], p->IRQEN & IRQ_TIMR2); | |
| 1215 | timer_enable(p->timer[TIMER4], p->IRQEN & IRQ_TIMR4); | |
| 1216 | 1216 | break; |
| 1217 | 1217 | |
| 1218 | 1218 | case SKREST_C: |
| r1293 | r1294 | |
| 1236 | 1236 | * loaders from Ballblazer and Escape from Fractalus |
| 1237 | 1237 | * The real times are unknown |
| 1238 | 1238 | */ |
| 1239 | | |
| 1239 | | |
| 1240 | 1240 | /* 10 bits (assumption 1 start, 8 data and 1 stop bit) take how long? */ |
| 1241 | | |
| 1241 | | |
| 1242 | 1242 | break; |
| 1243 | 1243 | |
| 1244 | 1244 | case IRQEN_C: |
| r1293 | r1294 | |
| 1255 | 1255 | /* enable/disable timers now to avoid unneeded |
| 1256 | 1256 | breaking of the CPU cores for masked timers */ |
| 1257 | 1257 | if( p->timer[TIMER1] && ((p->IRQEN^data) & IRQ_TIMR1) ) |
| 1258 | | |
| 1258 | | |
| 1259 | 1259 | if( p->timer[TIMER2] && ((p->IRQEN^data) & IRQ_TIMR2) ) |
| 1260 | | |
| 1260 | | |
| 1261 | 1261 | if( p->timer[TIMER4] && ((p->IRQEN^data) & IRQ_TIMR4) ) |
| 1262 | | |
| 1262 | | |
| 1263 | 1263 | } |
| 1264 | 1264 | /* store irq enable */ |
| 1265 | 1265 | p->IRQEN = data; |
| r1293 | r1294 | |
| 1303 | 1303 | if( new_val < p->counter[CHAN1] ) |
| 1304 | 1304 | p->counter[CHAN1] = new_val; |
| 1305 | 1305 | if( p->interrupt_cb && p->timer[TIMER1] ) |
| 1306 | | |
| 1306 | | |
| 1307 | 1307 | p->audible[CHAN1] = !( |
| 1308 | 1308 | (p->AUDC[CHAN1] & VOLUME_ONLY) || |
| 1309 | 1309 | (p->AUDC[CHAN1] & VOLUME_MASK) == 0 || |
| r1293 | r1294 | |
| 1339 | 1339 | if( new_val < p->counter[CHAN2] ) |
| 1340 | 1340 | p->counter[CHAN2] = new_val; |
| 1341 | 1341 | if( p->interrupt_cb && p->timer[TIMER2] ) |
| 1342 | | |
| 1342 | | |
| 1343 | 1343 | p->audible[CHAN2] = !( |
| 1344 | 1344 | (p->AUDC[CHAN2] & VOLUME_ONLY) || |
| 1345 | 1345 | (p->AUDC[CHAN2] & VOLUME_MASK) == 0 || |
| r1293 | r1294 | |
| 1404 | 1404 | if( new_val < p->counter[CHAN4] ) |
| 1405 | 1405 | p->counter[CHAN4] = new_val; |
| 1406 | 1406 | if( p->interrupt_cb && p->timer[TIMER4] ) |
| 1407 | | |
| 1407 | | |
| 1408 | 1408 | p->audible[CHAN4] = !( |
| 1409 | 1409 | (p->AUDC[CHAN4] & VOLUME_ONLY) || |
| 1410 | 1410 | (p->AUDC[CHAN4] & VOLUME_MASK) == 0 || |
| r1293 | r1294 | |
| 1452 | 1452 | void pokey1_serin_ready(int after) |
| 1453 | 1453 | { |
| 1454 | 1454 | struct POKEYregisters *p = sndti_token(SOUND_POKEY, 0); |
| 1455 | | |
| 1455 | | |
| 1456 | 1456 | } |
| 1457 | 1457 | |
| 1458 | 1458 | void pokey2_serin_ready(int after) |
| 1459 | 1459 | { |
| 1460 | 1460 | struct POKEYregisters *p = sndti_token(SOUND_POKEY, 1); |
| 1461 | | |
| 1461 | | |
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | void pokey3_serin_ready(int after) |
| 1465 | 1465 | { |
| 1466 | 1466 | struct POKEYregisters *p = sndti_token(SOUND_POKEY, 2); |
| 1467 | | |
| 1467 | | |
| 1468 | 1468 | } |
| 1469 | 1469 | |
| 1470 | 1470 | void pokey4_serin_ready(int after) |
| 1471 | 1471 | { |
| 1472 | 1472 | struct POKEYregisters *p = sndti_token(SOUND_POKEY, 3); |
| 1473 | | |
| 1473 | | |
| 1474 | 1474 | } |
| 1475 | 1475 | |
| 1476 | 1476 | void pokey_break_w(int chip, int shift) |
| r1293 | r1294 | |
|---|---|---|
| 200 | 200 | sp->RNG = 1; |
| 201 | 201 | sp->drq = intf->drq_callback; |
| 202 | 202 | sp->drq(ASSERT_LINE); |
| 203 | | |
| 203 | | |
| 204 | 204 | |
| 205 | 205 | sp->stream = stream_create(0, 1, clock / CLOCK_DIVIDER, sp, sp0250_update); |
| 206 | 206 |
| r1293 | r1294 | |
|---|---|---|
| 121 | 121 | |
| 122 | 122 | #ifdef USE_MAME_TIMERS |
| 123 | 123 | /* ASG 980324 -- added for tracking timers */ |
| 124 | mame_timer *timer_A; | |
| 125 | mame_timer *timer_B; | |
| 126 | mame_time timer_A_time[1024]; /* timer A times for MAME */ | |
| 127 | mame_time timer_B_time[256]; /* timer B times for MAME */ | |
| 124 | emu_timer *timer_A; | |
| 125 | emu_timer *timer_B; | |
| 126 | attotime timer_A_time[1024]; /* timer A times for MAME */ | |
| 127 | attotime timer_B_time[256]; /* timer B times for MAME */ | |
| 128 | 128 | int irqlinestate; |
| 129 | 129 | #else |
| 130 | 130 | UINT8 tim_A; /* timer A enable (0-disabled) */ |
| r1293 | r1294 | |
| 592 | 592 | int i,j; |
| 593 | 593 | double mult,phaseinc,Hz; |
| 594 | 594 | double scaler; |
| 595 | | |
| 595 | | |
| 596 | 596 | |
| 597 | 597 | scaler = ( (double)chip->clock / 64.0 ) / ( (double)chip->sampfreq ); |
| 598 | 598 | /*logerror("scaler = %20.15f\n", scaler);*/ |
| r1293 | r1294 | |
| 697 | 697 | for (i=0; i<1024; i++) |
| 698 | 698 | { |
| 699 | 699 | /* ASG 980324: changed to compute both tim_A_tab and timer_A_time */ |
| 700 | pom= | |
| 700 | pom= | |
| 701 | 701 | #ifdef USE_MAME_TIMERS |
| 702 | 702 | chip->timer_A_time[i] = pom; |
| 703 | 703 | #else |
| 704 | chip->tim_A_tab[i] = | |
| 704 | chip->tim_A_tab[i] = | |
| 705 | 705 | #endif |
| 706 | 706 | } |
| 707 | 707 | for (i=0; i<256; i++) |
| 708 | 708 | { |
| 709 | 709 | /* ASG 980324: changed to compute both tim_B_tab and timer_B_time */ |
| 710 | pom= | |
| 710 | pom= | |
| 711 | 711 | #ifdef USE_MAME_TIMERS |
| 712 | 712 | chip->timer_B_time[i] = pom; |
| 713 | 713 | #else |
| 714 | chip->tim_B_tab[i] = | |
| 714 | chip->tim_B_tab[i] = | |
| 715 | 715 | #endif |
| 716 | 716 | } |
| 717 | 717 | |
| r1293 | r1294 | |
| 826 | 826 | static TIMER_CALLBACK_PTR( timer_callback_a ) |
| 827 | 827 | { |
| 828 | 828 | YM2151 *chip = param; |
| 829 | | |
| 829 | | |
| 830 | 830 | chip->timer_A_index_old = chip->timer_A_index; |
| 831 | 831 | if (chip->irq_enable & 0x04) |
| 832 | 832 | { |
| 833 | 833 | chip->status |= 1; |
| 834 | | |
| 834 | | |
| 835 | 835 | } |
| 836 | 836 | if (chip->irq_enable & 0x80) |
| 837 | 837 | chip->csm_req = 2; /* request KEY ON / KEY OFF sequence */ |
| r1293 | r1294 | |
| 839 | 839 | static TIMER_CALLBACK_PTR( timer_callback_b ) |
| 840 | 840 | { |
| 841 | 841 | YM2151 *chip = param; |
| 842 | | |
| 842 | | |
| 843 | 843 | chip->timer_B_index_old = chip->timer_B_index; |
| 844 | 844 | if (chip->irq_enable & 0x08) |
| 845 | 845 | { |
| 846 | 846 | chip->status |= 2; |
| 847 | | |
| 847 | | |
| 848 | 848 | } |
| 849 | 849 | } |
| 850 | 850 | #if 0 |
| r1293 | r1294 | |
| 1056 | 1056 | #if 0 |
| 1057 | 1057 | /* There is no info on what YM2151 really does when busy flag is set */ |
| 1058 | 1058 | if ( chip->status & 0x80 ) return; |
| 1059 | | |
| 1059 | | |
| 1060 | 1060 | chip->status |= 0x80; /* set busy flag for 64 chip clock cycles */ |
| 1061 | 1061 | #endif |
| 1062 | 1062 | |
| r1293 | r1294 | |
| 1107 | 1107 | { |
| 1108 | 1108 | #ifdef USE_MAME_TIMERS |
| 1109 | 1109 | chip->status &= ~1; |
| 1110 | | |
| 1110 | | |
| 1111 | 1111 | #else |
| 1112 | 1112 | int oldstate = chip->status & 3; |
| 1113 | 1113 | chip->status &= ~1; |
| r1293 | r1294 | |
| 1119 | 1119 | { |
| 1120 | 1120 | #ifdef USE_MAME_TIMERS |
| 1121 | 1121 | chip->status &= ~2; |
| 1122 | | |
| 1122 | | |
| 1123 | 1123 | #else |
| 1124 | 1124 | int oldstate = chip->status & 3; |
| 1125 | 1125 | chip->status &= ~2; |
| r1293 | r1294 | |
| 1131 | 1131 | #ifdef USE_MAME_TIMERS |
| 1132 | 1132 | /* ASG 980324: added a real timer */ |
| 1133 | 1133 | /* start timer _only_ if it wasn't already started (it will reload time value next round) */ |
| 1134 | if (! | |
| 1134 | if (! | |
| 1135 | 1135 | { |
| 1136 | | |
| 1136 | | |
| 1137 | 1137 | chip->timer_B_index_old = chip->timer_B_index; |
| 1138 | 1138 | } |
| 1139 | 1139 | #else |
| r1293 | r1294 | |
| 1146 | 1146 | }else{ /* stop timer B */ |
| 1147 | 1147 | #ifdef USE_MAME_TIMERS |
| 1148 | 1148 | /* ASG 980324: added a real timer */ |
| 1149 | | |
| 1149 | | |
| 1150 | 1150 | #else |
| 1151 | 1151 | chip->tim_B = 0; |
| 1152 | 1152 | #endif |
| r1293 | r1294 | |
| 1156 | 1156 | #ifdef USE_MAME_TIMERS |
| 1157 | 1157 | /* ASG 980324: added a real timer */ |
| 1158 | 1158 | /* start timer _only_ if it wasn't already started (it will reload time value next round) */ |
| 1159 | if (! | |
| 1159 | if (! | |
| 1160 | 1160 | { |
| 1161 | | |
| 1161 | | |
| 1162 | 1162 | chip->timer_A_index_old = chip->timer_A_index; |
| 1163 | 1163 | } |
| 1164 | 1164 | #else |
| r1293 | r1294 | |
| 1171 | 1171 | }else{ /* stop timer A */ |
| 1172 | 1172 | #ifdef USE_MAME_TIMERS |
| 1173 | 1173 | /* ASG 980324: added a real timer */ |
| 1174 | | |
| 1174 | | |
| 1175 | 1175 | #else |
| 1176 | 1176 | chip->tim_A = 0; |
| 1177 | 1177 | #endif |
| r1293 | r1294 | |
| 1542 | 1542 | |
| 1543 | 1543 | #ifdef USE_MAME_TIMERS |
| 1544 | 1544 | /* this must be done _before_ a call to YM2151ResetChip() */ |
| 1545 | PSG->timer_A = mame_timer_alloc_ptr(timer_callback_a, PSG); | |
| 1546 | PSG->timer_B = mame_timer_alloc_ptr(timer_callback_b, PSG); | |
| 1545 | PSG->timer_A = timer_alloc_ptr(timer_callback_a, PSG); | |
| 1546 | PSG->timer_B = timer_alloc_ptr(timer_callback_b, PSG); | |
| 1547 | 1547 | #else |
| 1548 | 1548 | PSG->tim_A = 0; |
| 1549 | 1549 | PSG->tim_B = 0; |
| r1293 | r1294 | |
| 1554 | 1554 | #ifdef LOG_CYM_FILE |
| 1555 | 1555 | cymfile = fopen("2151_.cym","wb"); |
| 1556 | 1556 | if (cymfile) |
| 1557 | | |
| 1557 | | |
| 1558 | 1558 | else |
| 1559 | 1559 | logerror("Could not create file 2151_.cym\n"); |
| 1560 | 1560 | #endif |
| r1293 | r1294 | |
| 1626 | 1626 | chip->irq_enable = 0; |
| 1627 | 1627 | #ifdef USE_MAME_TIMERS |
| 1628 | 1628 | /* ASG 980324 -- reset the timers before writing to the registers */ |
| 1629 | mame_timer_enable(chip->timer_A, 0); | |
| 1630 | mame_timer_enable(chip->timer_B, 0); | |
| 1629 | timer_enable(chip->timer_A, 0); | |
| 1630 | timer_enable(chip->timer_B, 0); | |
| 1631 | 1631 | #else |
| 1632 | 1632 | chip->tim_A = 0; |
| 1633 | 1633 | chip->tim_B = 0; |
| r1293 | r1294 | |
|---|---|---|
| 205 | 205 | int TimCnt[3]; |
| 206 | 206 | |
| 207 | 207 | // timers |
| 208 | | |
| 208 | | |
| 209 | 209 | |
| 210 | 210 | // DMA stuff |
| 211 | 211 | UINT32 scsp_dmea; |
| r1293 | r1294 | |
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | SCSP->timerA = mame_timer_alloc_ptr(timerA_cb, SCSP); | |
| 528 | SCSP->timerB = mame_timer_alloc_ptr(timerB_cb, SCSP); | |
| 529 | SCSP->timerC = mame_timer_alloc_ptr(timerC_cb, SCSP); | |
| 527 | SCSP->timerA = timer_alloc_ptr(timerA_cb, SCSP); | |
| 528 | SCSP->timerB = timer_alloc_ptr(timerB_cb, SCSP); | |
| 529 | SCSP->timerC = timer_alloc_ptr(timerC_cb, SCSP); | |
| 530 | 530 | |
| 531 | 531 | for(i=0;i<0x400;++i) |
| 532 | 532 | { |
| r1293 | r1294 | |
| 720 | 720 | time = (44100 / SCSP->TimPris[0]) / (255-(SCSP->udata.data[0x18/2]&0xff)); |
| 721 | 721 | if (time) |
| 722 | 722 | { |
| 723 | | |
| 723 | | |
| 724 | 724 | } |
| 725 | 725 | } |
| 726 | 726 | } |
| r1293 | r1294 | |
| 739 | 739 | time = (44100 / SCSP->TimPris[1]) / (255-(SCSP->udata.data[0x1A/2]&0xff)); |
| 740 | 740 | if (time) |
| 741 | 741 | { |
| 742 | | |
| 742 | | |
| 743 | 743 | } |
| 744 | 744 | } |
| 745 | 745 | } |
| r1293 | r1294 | |
| 758 | 758 | time = (44100 / SCSP->TimPris[2]) / (255-(SCSP->udata.data[0x1C/2]&0xff)); |
| 759 | 759 | if (time) |
| 760 | 760 | { |
| 761 | | |
| 761 | | |
| 762 | 762 | } |
| 763 | 763 | } |
| 764 | 764 | } |
| r1293 | r1294 | |
|---|---|---|
| 21 | 21 | struct ym2610_info |
| 22 | 22 | { |
| 23 | 23 | sound_stream * stream; |
| 24 | | |
| 24 | | |
| 25 | 25 | void * chip; |
| 26 | 26 | void * psg; |
| 27 | 27 | const struct YM2610interface *intf; |
| r1293 | r1294 | |
| 86 | 86 | struct ym2610_info *info = param; |
| 87 | 87 | if( count == 0 ) |
| 88 | 88 | { /* Reset FM Timer */ |
| 89 | | |
| 89 | | |
| 90 | 90 | } |
| 91 | 91 | else |
| 92 | 92 | { /* Start FM Timer */ |
| 93 | | |
| 93 | | |
| 94 | 94 | |
| 95 | if (!mame_timer_enable(info->timer[c], 1)) | |
| 96 | mame_timer_adjust_ptr(info->timer[c], period, time_zero); | |
| 95 | if (!timer_enable(info->timer[c], 1)) | |
| 96 | timer_adjust_ptr(info->timer[c], period, attotime_zero); | |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| r1293 | r1294 | |
| 138 | 138 | if (!info->psg) return NULL; |
| 139 | 139 | |
| 140 | 140 | /* Timer Handler set */ |
| 141 | info->timer[0] = mame_timer_alloc_ptr(timer_callback_0, info); | |
| 142 | info->timer[1] = mame_timer_alloc_ptr(timer_callback_1, info); | |
| 141 | info->timer[0] = timer_alloc_ptr(timer_callback_0, info); | |
| 142 | info->timer[1] = timer_alloc_ptr(timer_callback_1, info); | |
| 143 | 143 | |
| 144 | 144 | /* stream system initialize */ |
| 145 | 145 | info->stream = stream_create(0,2,rate,info,ym2610_stream_update); |
| r1293 | r1294 | |
| 190 | 190 | if (!info->psg) return NULL; |
| 191 | 191 | |
| 192 | 192 | /* Timer Handler set */ |
| 193 | info->timer[0] =mame_timer_alloc_ptr(timer_callback_0, info); | |
| 194 | info->timer[1] =mame_timer_alloc_ptr(timer_callback_1, info); | |
| 193 | info->timer[0] =timer_alloc_ptr(timer_callback_0, info); | |
| 194 | info->timer[1] =timer_alloc_ptr(timer_callback_1, info); | |
| 195 | 195 | |
| 196 | 196 | /* stream system initialize */ |
| 197 | 197 | info->stream = stream_create(0,2,rate,info,ym2610b_stream_update); |
| r1293 | r1294 | |
|---|---|---|
| 317 | 317 | UINT32 clock; /* master clock (Hz) */ |
| 318 | 318 | UINT32 rate; /* sampling rate (Hz) */ |
| 319 | 319 | double freqbase; /* frequency base */ |
| 320 | | |
| 320 | | |
| 321 | 321 | } FM_OPL; |
| 322 | 322 | |
| 323 | 323 | |
| r1293 | r1294 | |
| 1272 | 1272 | /*logerror("freqbase=%f\n", OPL->freqbase);*/ |
| 1273 | 1273 | |
| 1274 | 1274 | /* Timer base time */ |
| 1275 | OPL->TimerBase = | |
| 1275 | OPL->TimerBase = | |
| 1276 | 1276 | |
| 1277 | 1277 | /* make fnumber -> increment counter table */ |
| 1278 | 1278 | for( i=0 ; i < 1024 ; i++ ) |
| r1293 | r1294 | |
| 1501 | 1501 | /* timer 2 */ |
| 1502 | 1502 | if(OPL->st[1] != st2) |
| 1503 | 1503 | { |
| 1504 | | |
| 1504 | | |
| 1505 | 1505 | OPL->st[1] = st2; |
| 1506 | 1506 | if (OPL->timer_handler) (OPL->timer_handler)(OPL->TimerParam,1,period); |
| 1507 | 1507 | } |
| 1508 | 1508 | /* timer 1 */ |
| 1509 | 1509 | if(OPL->st[0] != st1) |
| 1510 | 1510 | { |
| 1511 | | |
| 1511 | | |
| 1512 | 1512 | OPL->st[0] = st1; |
| 1513 | 1513 | if (OPL->timer_handler) (OPL->timer_handler)(OPL->TimerParam,0,period); |
| 1514 | 1514 | } |
| r1293 | r1294 | |
| 1749 | 1749 | #ifdef LOG_CYM_FILE |
| 1750 | 1750 | cymfile = fopen("3812_.cym","wb"); |
| 1751 | 1751 | if (cymfile) |
| 1752 | | |
| 1752 | | |
| 1753 | 1753 | else |
| 1754 | 1754 | logerror("Could not create file 3812_.cym\n"); |
| 1755 | 1755 | #endif |
| r1293 | r1294 | |
| 2160 | 2160 | } |
| 2161 | 2161 | } |
| 2162 | 2162 | /* reload timer */ |
| 2163 | if (OPL->timer_handler) (OPL->timer_handler)(OPL->TimerParam,c, | |
| 2163 | if (OPL->timer_handler) (OPL->timer_handler)(OPL->TimerParam,c, | |
| 2164 | 2164 | return OPL->status>>7; |
| 2165 | 2165 | } |
| 2166 | 2166 |
| r1293 | r1294 | |
|---|---|---|
| 30 | 30 | #endif |
| 31 | 31 | */ |
| 32 | 32 | |
| 33 | typedef void (*OPL_TIMERHANDLER)(void *param,int timer, | |
| 33 | typedef void (*OPL_TIMERHANDLER)(void *param,int timer, | |
| 34 | 34 | typedef void (*OPL_IRQHANDLER)(void *param,int irq); |
| 35 | 35 | typedef void (*OPL_UPDATEHANDLER)(void *param,int min_interval_us); |
| 36 | 36 | typedef void (*OPL_PORTHANDLER_W)(void *param,unsigned char data); |
| r1293 | r1294 | |
|---|---|---|
| 55 | 55 | |
| 56 | 56 | struct { |
| 57 | 57 | UINT8 scale, preset; |
| 58 | | |
| 58 | | |
| 59 | 59 | UINT64 period; /* in nsec */ |
| 60 | 60 | } timer[2]; |
| 61 | 61 | |
| r1293 | r1294 | |
| 195 | 195 | if(chip->timer[timer].period != period) { |
| 196 | 196 | chip->timer[timer].period = period; |
| 197 | 197 | if(period) |
| 198 | | |
| 198 | | |
| 199 | 199 | else |
| 200 | | |
| 200 | | |
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| r1293 | r1294 | |
| 458 | 458 | chip->intf = config; |
| 459 | 459 | chip->index = sndindex; |
| 460 | 460 | chip->rom = memory_region(chip->intf->region); |
| 461 | chip->timer[0].timer = mame_timer_alloc_ptr(timer_cb_0, chip); | |
| 462 | chip->timer[1].timer = mame_timer_alloc_ptr(timer_cb_1, chip); | |
| 461 | chip->timer[0].timer = timer_alloc_ptr(timer_cb_0, chip); | |
| 462 | chip->timer[1].timer = timer_alloc_ptr(timer_cb_1, chip); | |
| 463 | 463 | chip->ulaw = auto_malloc(256*sizeof(INT16)); |
| 464 | 464 | chip->stream = stream_create(0, 2, 33075, chip, update); |
| 465 | 465 | |
| r1293 | r1294 | |
| 532 | 532 | chip->irq_en = 0; |
| 533 | 533 | chip->irq_pend = 0; |
| 534 | 534 | memset(chip->voice, 0, sizeof(chip->voice)); |
| 535 | mame_timer_adjust_ptr(chip->timer[0].timer, time_never, time_zero); | |
| 536 | mame_timer_adjust_ptr(chip->timer[1].timer, time_never, time_zero); | |
| 535 | timer_adjust_ptr(chip->timer[0].timer, attotime_never, attotime_zero); | |
| 536 | timer_adjust_ptr(chip->timer[1].timer, attotime_never, attotime_zero); | |
| 537 | 537 | chip->timer[0].period = 0; |
| 538 | 538 | chip->timer[1].period = 0; |
| 539 | 539 | recalc_irq(chip); |
| r1293 | r1294 | |
|---|---|---|
| 852 | 852 | } |
| 853 | 853 | INLINE void FM_BUSY_SET(FM_ST *ST,int busyclock ) |
| 854 | 854 | { |
| 855 | TIME_TYPE expiry_period = MULTIPLY_TIME_BY_INT( | |
| 855 | TIME_TYPE expiry_period = MULTIPLY_TIME_BY_INT( | |
| 856 | 856 | ST->busy_expiry_time = ADD_TIMES(FM_GET_TIME_NOW(), expiry_period); |
| 857 | 857 | } |
| 858 | 858 | #else |
| r1293 | r1294 | |
| 1627 | 1627 | { |
| 1628 | 1628 | #if FM_BUSY_FLAG_SUPPORT |
| 1629 | 1629 | state_save_register_item(state_name, num, ST->busy_expiry_time.seconds ); |
| 1630 | state_save_register_item(state_name, num, ST->busy_expiry_time. | |
| 1630 | state_save_register_item(state_name, num, ST->busy_expiry_time.attoseconds ); | |
| 1631 | 1631 | #endif |
| 1632 | 1632 | state_save_register_item(state_name, num, ST->address ); |
| 1633 | 1633 | state_save_register_item(state_name, num, ST->irq ); |
| r1293 | r1294 | |
|---|---|---|
| 36 | 36 | /* --- external callback funstions for realtime update --- */ |
| 37 | 37 | |
| 38 | 38 | #if FM_BUSY_FLAG_SUPPORT |
| 39 | #define TIME_TYPE mame_time | |
| 40 | #define UNDEFINED_TIME time_zero | |
| 41 | #define FM_GET_TIME_NOW() mame_timer_get_time() | |
| 42 | #define ADD_TIMES(t1, t2) add_mame_times((t1), (t2)) | |
| 43 | #define COMPARE_TIMES(t1, t2) compare_mame_times((t1), (t2)) | |
| 44 | #define MULTIPLY_TIME_BY_INT(t,i) scale_up_mame_time(t, i) | |
| 39 | #define TIME_TYPE attotime | |
| 40 | #define UNDEFINED_TIME attotime_zero | |
| 41 | #define FM_GET_TIME_NOW() timer_get_time() | |
| 42 | #define ADD_TIMES(t1, t2) attotime_add((t1), (t2)) | |
| 43 | #define COMPARE_TIMES(t1, t2) attotime_compare((t1), (t2)) | |
| 44 | #define MULTIPLY_TIME_BY_INT(t,i) attotime_mul(t, i) | |
| 45 | 45 | #endif |
| 46 | 46 | |
| 47 | 47 | #if BUILD_YM2203 |
| r1293 | r1294 | |
|---|---|---|
| 20 | 20 | struct ym2608_info |
| 21 | 21 | { |
| 22 | 22 | sound_stream * stream; |
| 23 | | |
| 23 | | |
| 24 | 24 | void * chip; |
| 25 | 25 | void * psg; |
| 26 | 26 | const struct YM2608interface *intf; |
| r1293 | r1294 | |
| 86 | 86 | struct ym2608_info *info = param; |
| 87 | 87 | if( count == 0 ) |
| 88 | 88 | { /* Reset FM Timer */ |
| 89 | | |
| 89 | | |
| 90 | 90 | } |
| 91 | 91 | else |
| 92 | 92 | { /* Start FM Timer */ |
| 93 | mame_time period = scale_up_mame_time(MAME_TIME_IN_HZ(clock), count); | |
| 94 | if (!mame_timer_enable(info->timer[c], 1)) | |
| 95 | mame_timer_adjust_ptr(info->timer[c], period, time_zero); | |
| 93 | attotime period = attotime_mul(ATTOTIME_IN_HZ(clock), count); | |
| 94 | if (!timer_enable(info->timer[c], 1)) | |
| 95 | timer_adjust_ptr(info->timer[c], period, attotime_zero); | |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| r1293 | r1294 | |
| 135 | 135 | if (!info->psg) return NULL; |
| 136 | 136 | |
| 137 | 137 | /* Timer Handler set */ |
| 138 | info->timer[0] = mame_timer_alloc_ptr(timer_callback_2608_0, info); | |
| 139 | info->timer[1] = mame_timer_alloc_ptr(timer_callback_2608_1, info); | |
| 138 | info->timer[0] = timer_alloc_ptr(timer_callback_2608_0, info); | |
| 139 | info->timer[1] = timer_alloc_ptr(timer_callback_2608_1, info); | |
| 140 | 140 | |
| 141 | 141 | /* stream system initialize */ |
| 142 | 142 | info->stream = stream_create(0,2,rate,info,ym2608_stream_update); |
| r1293 | r1294 | |
|---|---|---|
| 113 | 113 | INT32 pcm_l, pcm_r; |
| 114 | 114 | |
| 115 | 115 | UINT8 timer_a_count, timer_b_count, enable, current_irq; |
| 116 | | |
| 116 | | |
| 117 | 117 | int irq_line; |
| 118 | 118 | |
| 119 | 119 | UINT8 port_A, port_B, port_C; |
| r1293 | r1294 | |
| 376 | 376 | { |
| 377 | 377 | if(chip->enable & 1) |
| 378 | 378 | { |
| 379 | | |
| 379 | | |
| 380 | 380 | |
| 381 | 381 | if (chip->clock != YMF278B_STD_CLOCK) |
| 382 | period = | |
| 382 | period = | |
| 383 | 383 | |
| 384 | | |
| 384 | | |
| 385 | 385 | } |
| 386 | 386 | else |
| 387 | | |
| 387 | | |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | static void ymf278b_timer_b_reset(YMF278BChip *chip) |
| 391 | 391 | { |
| 392 | 392 | if(chip->enable & 2) |
| 393 | 393 | { |
| 394 | | |
| 394 | | |
| 395 | 395 | |
| 396 | 396 | if (chip->clock != YMF278B_STD_CLOCK) |
| 397 | period = | |
| 397 | period = | |
| 398 | 398 | |
| 399 | | |
| 399 | | |
| 400 | 400 | } |
| 401 | 401 | else |
| 402 | | |
| 402 | | |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | static void ymf278b_A_w(YMF278BChip *chip, UINT8 reg, UINT8 data) |
| r1293 | r1294 | |
| 670 | 670 | { |
| 671 | 671 | chip->rom = rom; |
| 672 | 672 | chip->irq_callback = cb; |
| 673 | chip->timer_a = mame_timer_alloc_ptr(ymf278b_timer_a_tick, chip); | |
| 674 | chip->timer_b = mame_timer_alloc_ptr(ymf278b_timer_b_tick, chip); | |
| 673 | chip->timer_a = timer_alloc_ptr(ymf278b_timer_a_tick, chip); | |
| 674 | chip->timer_b = timer_alloc_ptr(ymf278b_timer_b_tick, chip); | |
| 675 | 675 | chip->irq_line = CLEAR_LINE; |
| 676 | 676 | chip->clock = clock; |
| 677 | 677 |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | struct ym2151_info |
| 17 | 17 | { |
| 18 | 18 | sound_stream * stream; |
| 19 | | |
| 19 | | |
| 20 | 20 | void * chip; |
| 21 | 21 | const struct YM2151interface *intf; |
| 22 | 22 | }; |
| r1293 | r1294 | |
|---|---|---|
| 222 | 222 | |
| 223 | 223 | /* setup SH1 timer if necessary */ |
| 224 | 224 | if ( ic->intf->irq ) |
| 225 | | |
| 225 | | |
| 226 | 226 | |
| 227 | 227 | return ic; |
| 228 | 228 | } |
| r1293 | r1294 | |
|---|---|---|
| 8 | 8 | struct ym2203_info |
| 9 | 9 | { |
| 10 | 10 | sound_stream * stream; |
| 11 | | |
| 11 | | |
| 12 | 12 | void * chip; |
| 13 | 13 | void * psg; |
| 14 | 14 | const struct YM2203interface *intf; |
| r1293 | r1294 | |
| 80 | 80 | struct ym2203_info *info = param; |
| 81 | 81 | if( count == 0 ) |
| 82 | 82 | { /* Reset FM Timer */ |
| 83 | | |
| 83 | | |
| 84 | 84 | } |
| 85 | 85 | else |
| 86 | 86 | { /* Start FM Timer */ |
| 87 | mame_time period = scale_up_mame_time(MAME_TIME_IN_HZ(clock), count); | |
| 88 | if (!mame_timer_enable(info->timer[c], 1)) | |
| 89 | mame_timer_adjust_ptr(info->timer[c], period, time_zero); | |
| 87 | attotime period = attotime_mul(ATTOTIME_IN_HZ(clock), count); | |
| 88 | if (!timer_enable(info->timer[c], 1)) | |
| 89 | timer_adjust_ptr(info->timer[c], period, attotime_zero); | |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| r1293 | r1294 | |
| 119 | 119 | if (!info->psg) return NULL; |
| 120 | 120 | |
| 121 | 121 | /* Timer Handler set */ |
| 122 | info->timer[0] = mame_timer_alloc_ptr(timer_callback_2203_0, info); | |
| 123 | info->timer[1] = mame_timer_alloc_ptr(timer_callback_2203_1, info); | |
| 122 | info->timer[0] = timer_alloc_ptr(timer_callback_2203_0, info); | |
| 123 | info->timer[1] = timer_alloc_ptr(timer_callback_2203_1, info); | |
| 124 | 124 | |
| 125 | 125 | /* stream system initialize */ |
| 126 | 126 | info->stream = stream_create(0,1,rate,info,ym2203_stream_update); |
| r1293 | r1294 | |
|---|---|---|
| 55 | 55 | |
| 56 | 56 | UINT32 accumulator; |
| 57 | 57 | UINT8 irqpend; |
| 58 | | |
| 58 | | |
| 59 | 59 | } ES5503Osc; |
| 60 | 60 | |
| 61 | 61 | typedef struct |
| r1293 | r1294 | |
| 262 | 262 | chip->oscillators[osc].irqpend = 0; |
| 263 | 263 | chip->oscillators[osc].accumulator = 0; |
| 264 | 264 | |
| 265 | chip->oscillators[osc].timer = | |
| 265 | chip->oscillators[osc].timer = | |
| 266 | 266 | chip->oscillators[osc].chip = (void *)chip; |
| 267 | 267 | } |
| 268 | 268 | |
| r1293 | r1294 | |
| 436 | 436 | int resshift = resshifts[chip->oscillators[osc].resolution] - chip->oscillators[osc].wavetblsize; |
| 437 | 437 | UINT32 sizemask = accmasks[chip->oscillators[osc].wavetblsize]; |
| 438 | 438 | UINT32 ramptr, altram; |
| 439 | | |
| 439 | | |
| 440 | 440 | |
| 441 | 441 | run = 1; |
| 442 | 442 | length = 0; |
| r1293 | r1294 | |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | // ok, we run for this long |
| 461 | period = | |
| 461 | period = | |
| 462 | 462 | |
| 463 | | |
| 463 | | |
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | 466 | else if (!(chip->oscillators[osc].control & 1) && (data&1)) |
| 467 | 467 | { |
| 468 | 468 | // key off |
| 469 | | |
| 469 | | |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | chip->oscillators[osc].control = data; |
| r1293 | r1294 | |
|---|---|---|
| 676 | 676 | memset(info, 0, sizeof(*info)); |
| 677 | 677 | |
| 678 | 678 | /* Initialize global variables */ |
| 679 | info->samps_per_sync = rate / | |
| 679 | info->samps_per_sync = rate / ATTOSECONDS_TO_HZ(Machine->screen[0].refresh); | |
| 680 | 680 | info->buffer_size = info->samps_per_sync; |
| 681 | info->real_rate = info->samps_per_sync * | |
| 681 | info->real_rate = info->samps_per_sync * ATTOSECONDS_TO_HZ(Machine->screen[0].refresh); | |
| 682 | 682 | info->apu_incsize = (float) (clock / (float) info->real_rate); |
| 683 | 683 | |
| 684 | 684 | /* Use initializer calls */ |
| r1293 | r1294 | |
|---|---|---|
| 14 | 14 | struct ymf262_info |
| 15 | 15 | { |
| 16 | 16 | sound_stream * stream; |
| 17 | | |
| 17 | | |
| 18 | 18 | void * chip; |
| 19 | 19 | const struct YMF262interface *intf; |
| 20 | 20 | }; |
| r1293 | r1294 | |
| 40 | 40 | YMF262TimerOver(info->chip, 1); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | static void timer_handler_262(void *param,int timer, | |
| 43 | static void timer_handler_262(void *param,int timer, | |
| 44 | 44 | { |
| 45 | 45 | struct ymf262_info *info = param; |
| 46 | if( compare | |
| 46 | if( attotime_compare | |
| 47 | 47 | { /* Reset FM Timer */ |
| 48 | | |
| 48 | | |
| 49 | 49 | } |
| 50 | 50 | else |
| 51 | 51 | { /* Start FM Timer */ |
| 52 | | |
| 52 | | |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| r1293 | r1294 | |
| 89 | 89 | YMF262SetIRQHandler (info->chip, IRQHandler_262, info); |
| 90 | 90 | YMF262SetUpdateHandler(info->chip, _stream_update, info); |
| 91 | 91 | |
| 92 | info->timer[0] = mame_timer_alloc_ptr(timer_callback_262_0, info); | |
| 93 | info->timer[1] = mame_timer_alloc_ptr(timer_callback_262_1, info); | |
| 92 | info->timer[0] = timer_alloc_ptr(timer_callback_262_0, info); | |
| 93 | info->timer[1] = timer_alloc_ptr(timer_callback_262_1, info); | |
| 94 | 94 | |
| 95 | 95 | return info; |
| 96 | 96 | } |
| r1293 | r1294 | |
|---|---|---|
| 1147 | 1147 | Machine->screen[0].visarea.max_x - Machine->screen[0].visarea.min_x + 1, |
| 1148 | 1148 | Machine->screen[0].visarea.max_y - Machine->screen[0].visarea.min_y + 1, |
| 1149 | 1149 | (Machine->gamedrv->flags & ORIENTATION_SWAP_XY) ? "V" : "H", |
| 1150 | | |
| 1150 | ATTOSECONDS_TO_HZ(Machine->screen[0].refresh)); | |
| 1151 | 1151 | return bufptr - buffer; |
| 1152 | 1152 | } |
| 1153 | 1153 | |
| r1293 | r1294 | |
| 1748 | 1748 | |
| 1749 | 1749 | static INT32 slider_refresh(INT32 newval, char *buffer, int arg) |
| 1750 | 1750 | { |
| 1751 | double defrefresh = | |
| 1751 | double defrefresh = ATTOSECONDS_TO_HZ(Machine->drv->screen[arg].defstate.refresh); | |
| 1752 | 1752 | double refresh; |
| 1753 | 1753 | |
| 1754 | 1754 | if (buffer != NULL) |
| 1755 | 1755 | { |
| 1756 | 1756 | screen_state *state = &Machine->screen[arg]; |
| 1757 | video_screen_configure(arg, state->width, state->height, &state->visarea, HZ_TO_SUBSECONDS(defrefresh + (double)newval * 0.001)); | |
| 1758 | sprintf(buffer, "Screen %d %s %.3f", arg, ui_getstring(UI_refresh_rate), SUBSECONDS_TO_HZ(Machine->screen[arg].refresh)); | |
| 1757 | video_screen_configure(arg, state->width, state->height, &state->visarea, HZ_TO_ATTOSECONDS(defrefresh + (double)newval * 0.001)); | |
| 1758 | sprintf(buffer, "Screen %d %s %.3f", arg, ui_getstring(UI_refresh_rate), ATTOSECONDS_TO_HZ(Machine->screen[arg].refresh)); | |
| 1759 | 1759 | } |
| 1760 | refresh = | |
| 1760 | refresh = ATTOSECONDS_TO_HZ(Machine->screen[arg].refresh); | |
| 1761 | 1761 | return floor((refresh - defrefresh) * 1000.0f + 0.5f); |
| 1762 | 1762 | } |
| 1763 | 1763 |
| r1293 | r1294 | |
|---|---|---|
| 173 | 173 | } |
| 174 | 174 | if (computed || showdelay[i]) |
| 175 | 175 | { |
| 176 | if (computed) showdelay[i] = | |
| 176 | if (computed) showdelay[i] = ATTOSECONDS_TO_HZ(Machine->screen[0].refresh); | |
| 177 | 177 | showdelay[i]--; |
| 178 | 178 | |
| 179 | 179 | if (i < PROFILER_PROFILER) |
| r1293 | r1294 | |
|---|---|---|
| 37 | 37 | ***************************************************************************/ |
| 38 | 38 | |
| 39 | 39 | #define MAX_MIXER_CHANNELS 100 |
| 40 | #define SOUND_UPDATE_FREQUENCY | |
| 40 | #define SOUND_UPDATE_FREQUENCY | |
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | |
| r1293 | r1294 | |
| 91 | 91 | GLOBAL VARIABLES |
| 92 | 92 | ***************************************************************************/ |
| 93 | 93 | |
| 94 | static | |
| 94 | static | |
| 95 | 95 | |
| 96 | 96 | static int totalsnd; |
| 97 | 97 | static sound_info sound[MAX_SOUND]; |
| r1293 | r1294 | |
| 176 | 176 | |
| 177 | 177 | void sound_init(running_machine *machine) |
| 178 | 178 | { |
| 179 | | |
| 179 | | |
| 180 | 180 | const char *filename; |
| 181 | 181 | |
| 182 | 182 | /* handle -nosound */ |
| r1293 | r1294 | |
| 194 | 194 | finalmix = auto_malloc(Machine->sample_rate * sizeof(*finalmix)); |
| 195 | 195 | |
| 196 | 196 | /* allocate a global timer for sound timing */ |
| 197 | sound_update_timer = mame_timer_alloc(sound_update); | |
| 198 | mame_timer_adjust(sound_update_timer, update_frequency, 0, update_frequency); | |
| 197 | sound_update_timer = timer_alloc(sound_update); | |
| 198 | timer_adjust(sound_update_timer, update_frequency, 0, update_frequency); | |
| 199 | 199 | |
| 200 | 200 | /* initialize the streams engine */ |
| 201 | 201 | VPRINTF(("streams_init\n")); |
| 202 | streams_init(machine, update_frequency. | |
| 202 | streams_init(machine, update_frequency.attoseconds); | |
| 203 | 203 | |
| 204 | 204 | /* now start up the sound chips and tag their streams */ |
| 205 | 205 | VPRINTF(("start_sound_chips\n")); |
| r1293 | r1294 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | /* initialize the tag on the first screen */ |
| 53 | 53 | memset(output, 0, sizeof(*output)); |
| 54 | output->watchdog_time = time_zero; | |
| 54 | output->watchdog_time = attotime_zero; | |
| 55 | 55 | |
| 56 | 56 | /* keeping this function allows us to pre-init the driver before constructing it */ |
| 57 | 57 | (*constructor)(output); |
| r1293 | r1294 | |
| 62 | 62 | |
| 63 | 63 | /* if no screens, set a dummy refresh for the main screen */ |
| 64 | 64 | if (output->screen[0].tag == NULL) |
| 65 | output->screen[0].defstate.refresh = HZ_TO_ | |
| 65 | output->screen[0].defstate.refresh = HZ_TO_ATTOSECONDS(60); | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 |
| r1293 | r1294 | |
|---|---|---|
| 109 | 109 | */ |
| 110 | 110 | |
| 111 | 111 | /* The default is to have no VBLANK timing -- this is historical, and a bad idea */ |
| 112 | #define DEFAULT_60HZ_VBLANK_DURATION USEC_TO_SUBSECONDS(0) | |
| 113 | #define DEFAULT_30HZ_VBLANK_DURATION USEC_TO_SUBSECONDS(0) | |
| 112 | #define DEFAULT_60HZ_VBLANK_DURATION ATTOSECONDS_IN_USEC(0) | |
| 113 | #define DEFAULT_30HZ_VBLANK_DURATION ATTOSECONDS_IN_USEC(0) | |
| 114 | 114 | |
| 115 | 115 | /* If you use IPT_VBLANK, you need a duration different from 0 */ |
| 116 | #define DEFAULT_REAL_60HZ_VBLANK_DURATION USEC_TO_SUBSECONDS(2500) | |
| 117 | #define DEFAULT_REAL_30HZ_VBLANK_DURATION USEC_TO_SUBSECONDS(2500) | |
| 116 | #define DEFAULT_REAL_60HZ_VBLANK_DURATION ATTOSECONDS_IN_USEC(2500) | |
| 117 | #define DEFAULT_REAL_30HZ_VBLANK_DURATION ATTOSECONDS_IN_USEC(2500) | |
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | |
| r1293 | r1294 | |
| 184 | 184 | cpu_config cpu[MAX_CPU]; /* array of CPUs in the system */ |
| 185 | 185 | UINT32 cpu_slices_per_frame; /* number of times to interleave execution per frame */ |
| 186 | 186 | INT32 watchdog_vblank_count; /* number of VBLANKs until the watchdog kills us */ |
| 187 | | |
| 187 | | |
| 188 | 188 | |
| 189 | 189 | void (*machine_start)(running_machine *machine); /* one-time machine start callback */ |
| 190 | 190 | void (*machine_reset)(running_machine *machine); /* machine reset callback */ |
| r1293 | r1294 | |
| 328 | 328 | if (cpu) \ |
| 329 | 329 | { \ |
| 330 | 330 | cpu->timed_interrupt = func; \ |
| 331 | cpu->timed_interrupt_period = HZ_TO_ | |
| 331 | cpu->timed_interrupt_period = HZ_TO_ATTOSECONDS(rate); \ | |
| 332 | 332 | } \ |
| 333 | 333 | |
| 334 | 334 | |
| r1293 | r1294 | |
| 408 | 408 | screen->defstate.format = (_format); \ |
| 409 | 409 | |
| 410 | 410 | #define MDRV_SCREEN_RAW_PARAMS(pixclock, htotal, hbend, hbstart, vtotal, vbend, vbstart) \ |
| 411 | screen->defstate.refresh = HZ_TO_ | |
| 411 | screen->defstate.refresh = HZ_TO_ATTOSECONDS(pixclock) * (htotal) * (vtotal); \ | |
| 412 | 412 | screen->defstate.vblank = (screen->defstate.refresh / (vtotal)) * ((vtotal) - ((vbstart) - (vbend))); \ |
| 413 | 413 | screen->defstate.width = (htotal); \ |
| 414 | 414 | screen->defstate.height = (vtotal); \ |
| r1293 | r1294 | |
| 418 | 418 | screen->defstate.visarea.max_y = (vbstart) - 1; \ |
| 419 | 419 | |
| 420 | 420 | #define MDRV_SCREEN_REFRESH_RATE(rate) \ |
| 421 | screen->defstate.refresh = HZ_TO_ | |
| 421 | screen->defstate.refresh = HZ_TO_ATTOSECONDS(rate); \ | |
| 422 | 422 | |
| 423 | 423 | #define MDRV_SCREEN_VBLANK_TIME(time) \ |
| 424 | screen->defstate.vblank = time; \ | |
| 424 | screen->defstate.vblank = time; \ | |
| 425 | 425 | screen->defstate.oldstyle_vblank_supplied = 1; \ |
| 426 | 426 | |
| 427 | 427 | #define MDRV_SCREEN_SIZE(_width, _height) \ |
| r1293 | r1294 | |
|---|---|---|
| 42 | 42 | TYPE DEFINITIONS |
| 43 | 43 | ***************************************************************************/ |
| 44 | 44 | |
| 45 | /* in timer.h: typedef struct _mame_timer mame_timer; */ | |
| 46 | struct _mame_timer | |
| 45 | /* in timer.h: typedef struct _emu_timer emu_timer; */ | |
| 46 | struct _emu_timer | |
| 47 | 47 | { |
| 48 | mame_timer * next; | |
| 49 | mame_timer * prev; | |
| 48 | emu_timer * next; | |
| 49 | emu_timer * prev; | |
| 50 | 50 | void (*callback)(running_machine *, int); |
| 51 | 51 | void (*callback_ptr)(running_machine *, void *); |
| 52 | 52 | int callback_param; |
| r1293 | r1294 | |
| 57 | 57 | UINT8 enabled; |
| 58 | 58 | UINT8 temporary; |
| 59 | 59 | UINT8 ptr; |
| 60 | mame_time period; | |
| 61 | mame_time start; | |
| 62 | mame_time expire; | |
| 60 | attotime period; | |
| 61 | attotime start; | |
| 62 | attotime expire; | |
| 63 | 63 | }; |
| 64 | 64 | |
| 65 | 65 | |
| r1293 | r1294 | |
| 69 | 69 | ***************************************************************************/ |
| 70 | 70 | |
| 71 | 71 | /* conversion constants */ |
| 72 | s | |
| 72 | attos | |
| 73 | 73 | UINT32 cycles_per_second[MAX_CPU]; |
| 74 | 74 | |
| 75 | 75 | /* list of active timers */ |
| 76 | static mame_timer timers[MAX_TIMERS]; | |
| 77 | static mame_timer *timer_head; | |
| 78 | static mame_timer *timer_free_head; | |
| 79 | static mame_timer *timer_free_tail; | |
| 76 | static emu_timer timers[MAX_TIMERS]; | |
| 77 | static emu_timer *timer_head; | |
| 78 | static emu_timer *timer_free_head; | |
| 79 | static emu_timer *timer_free_tail; | |
| 80 | 80 | |
| 81 | 81 | /* other internal states */ |
| 82 | static mame_time global_basetime; | |
| 83 | static mame_timer *callback_timer; | |
| 82 | static attotime global_basetime; | |
| 83 | static emu_timer *callback_timer; | |
| 84 | 84 | static int callback_timer_modified; |
| 85 | static | |
| 85 | static | |
| 86 | 86 | |
| 87 | /* other constant times */ | |
| 88 | mame_time time_zero; | |
| 89 | mame_time time_never; | |
| 90 | 87 | |
| 91 | 88 | |
| 92 | ||
| 93 | 89 | /*************************************************************************** |
| 94 | 90 | FUNCTION PROTOTYPES |
| 95 | 91 | ***************************************************************************/ |
| 96 | 92 | |
| 97 | 93 | static void timer_postload(void); |
| 98 | 94 | static void timer_logtimers(void); |
| 99 | static void timer_remove( | |
| 95 | static void timer_remove( | |
| 100 | 96 | |
| 101 | 97 | |
| 102 | 98 | |
| r1293 | r1294 | |
| 108 | 104 | get_current_time - return the current time |
| 109 | 105 | -------------------------------------------------*/ |
| 110 | 106 | |
| 111 | INLINE | |
| 107 | INLINE | |
| 112 | 108 | { |
| 113 | 109 | int activecpu; |
| 114 | 110 | |
| r1293 | r1294 | |
| 130 | 126 | timer_new - allocate a new timer |
| 131 | 127 | -------------------------------------------------*/ |
| 132 | 128 | |
| 133 | INLINE | |
| 129 | INLINE | |
| 134 | 130 | { |
| 135 | | |
| 131 | | |
| 136 | 132 | |
| 137 | 133 | /* remove an empty entry */ |
| 138 | 134 | if (!timer_free_head) |
| r1293 | r1294 | |
| 154 | 150 | the list at the appropriate location |
| 155 | 151 | -------------------------------------------------*/ |
| 156 | 152 | |
| 157 | INLINE void timer_list_insert( | |
| 153 | INLINE void timer_list_insert( | |
| 158 | 154 | { |
| 159 | mame_time expire = timer->enabled ? timer->expire : time_never; | |
| 160 | mame_timer *t, *lt = NULL; | |
| 155 | attotime expire = timer->enabled ? timer->expire : attotime_never; | |
| 156 | emu_timer *t, *lt = NULL; | |
| 161 | 157 | |
| 162 | 158 | /* sanity checks for the debug build */ |
| 163 | 159 | #ifdef MAME_DEBUG |
| r1293 | r1294 | |
| 179 | 175 | for (t = timer_head; t; lt = t, t = t->next) |
| 180 | 176 | { |
| 181 | 177 | /* if the current list entry expires after us, we should be inserted before it */ |
| 182 | if (compare | |
| 178 | if (attotime_compare | |
| 183 | 179 | { |
| 184 | 180 | /* link the new guy in before the current list entry */ |
| 185 | 181 | timer->prev = t->prev; |
| r1293 | r1294 | |
| 209 | 205 | linked list |
| 210 | 206 | -------------------------------------------------*/ |
| 211 | 207 | |
| 212 | INLINE void timer_list_remove( | |
| 208 | INLINE void timer_list_remove( | |
| 213 | 209 | { |
| 214 | 210 | /* sanity checks for the debug build */ |
| 215 | 211 | #ifdef MAME_DEBUG |
| 216 | 212 | { |
| 217 | | |
| 213 | | |
| 218 | 214 | |
| 219 | 215 | /* loop over the timer list */ |
| 220 | 216 | for (t = timer_head; t && t != timer; t = t->next) ; |
| r1293 | r1294 | |
| 246 | 242 | { |
| 247 | 243 | int i; |
| 248 | 244 | |
| 249 | /* init the constant times */ | |
| 250 | time_zero.seconds = time_zero.subseconds = 0; | |
| 251 | time_never.seconds = MAX_SECONDS; | |
| 252 | time_never.subseconds = MAX_SUBSECONDS - 1; | |
| 253 | ||
| 254 | 245 | /* we need to wait until the first call to timer_cyclestorun before using real CPU times */ |
| 255 | global_basetime = time_zero; | |
| 246 | global_basetime = attotime_zero; | |
| 256 | 247 | callback_timer = NULL; |
| 257 | 248 | callback_timer_modified = FALSE; |
| 258 | 249 | |
| 259 | 250 | /* register with the save state system */ |
| 260 | 251 | state_save_push_tag(0); |
| 261 | 252 | state_save_register_item("timer", 0, global_basetime.seconds); |
| 262 | state_save_register_item("timer", 0, global_basetime. | |
| 253 | state_save_register_item("timer", 0, global_basetime.attoseconds); | |
| 263 | 254 | state_save_register_func_postload(timer_postload); |
| 264 | 255 | state_save_pop_tag(); |
| 265 | 256 | |
| r1293 | r1294 | |
| 293 | 284 | ***************************************************************************/ |
| 294 | 285 | |
| 295 | 286 | /*------------------------------------------------- |
| 296 | | |
| 287 | | |
| 297 | 288 | time when the next timer will fire |
| 298 | 289 | -------------------------------------------------*/ |
| 299 | 290 | |
| 300 | ||
| 291 | ||
| 301 | 292 | { |
| 302 | 293 | return timer_head->expire; |
| 303 | 294 | } |
| r1293 | r1294 | |
| 308 | 299 | time; this is also where we fire the timers |
| 309 | 300 | -------------------------------------------------*/ |
| 310 | 301 | |
| 311 | void | |
| 302 | void | |
| 312 | 303 | { |
| 313 | | |
| 304 | | |
| 314 | 305 | |
| 315 | 306 | /* set the new global offset */ |
| 316 | 307 | global_basetime = newbase; |
| 317 | 308 | |
| 318 | LOG((" | |
| 309 | LOG((" | |
| 319 | 310 | |
| 320 | 311 | /* now process any timers that are overdue */ |
| 321 | while (compare | |
| 312 | while (attotime_compare | |
| 322 | 313 | { |
| 323 | 314 | int was_enabled = timer_head->enabled; |
| 324 | 315 | |
| 325 | 316 | /* if this is a one-shot timer, disable it now */ |
| 326 | 317 | timer = timer_head; |
| 327 | if (compare | |
| 318 | if (attotime_compare | |
| 328 | 319 | timer->enabled = FALSE; |
| 329 | 320 | |
| 330 | 321 | /* set the global state of which callback we're in */ |
| r1293 | r1294 | |
| 337 | 328 | { |
| 338 | 329 | if (!timer->ptr && timer->callback) |
| 339 | 330 | { |
| 340 | LOG(("Timer %s:%d[%s] fired (expire=% | |
| 331 | LOG(("Timer %s:%d[%s] fired (expire=%s | |
| 341 | 332 | profiler_mark(PROFILER_TIMER_CALLBACK); |
| 342 | 333 | (*timer->callback)(Machine, timer->callback_param); |
| 343 | 334 | profiler_mark(PROFILER_END); |
| 344 | 335 | } |
| 345 | 336 | else if (timer->ptr && timer->callback_ptr) |
| 346 | 337 | { |
| 347 | LOG(("Timer %s:%d[%s] fired (expire=% | |
| 338 | LOG(("Timer %s:%d[%s] fired (expire=%s | |
| 348 | 339 | profiler_mark(PROFILER_TIMER_CALLBACK); |
| 349 | 340 | (*timer->callback_ptr)(Machine, timer->callback_ptr_param); |
| 350 | 341 | profiler_mark(PROFILER_END); |
| r1293 | r1294 | |
| 365 | 356 | else |
| 366 | 357 | { |
| 367 | 358 | timer->start = timer->expire; |
| 368 | timer->expire = a | |
| 359 | timer->expire = a | |
| 369 | 360 | |
| 370 | 361 | timer_list_remove(timer); |
| 371 | 362 | timer_list_insert(timer); |
| r1293 | r1294 | |
| 385 | 376 | the save state system |
| 386 | 377 | -------------------------------------------------*/ |
| 387 | 378 | |
| 388 | static void timer_register_save( | |
| 379 | static void timer_register_save( | |
| 389 | 380 | { |
| 390 | 381 | char buf[256]; |
| 391 | 382 | int count = 0; |
| 392 | | |
| 383 | | |
| 393 | 384 | |
| 394 | 385 | /* find other timers that match our func name */ |
| 395 | 386 | for (t = timer_head; t; t = t->next) |
| r1293 | r1294 | |
| 404 | 395 | state_save_register_item(buf, count, timer->callback_param); |
| 405 | 396 | state_save_register_item(buf, count, timer->enabled); |
| 406 | 397 | state_save_register_item(buf, count, timer->period.seconds); |
| 407 | state_save_register_item(buf, count, timer->period. | |
| 398 | state_save_register_item(buf, count, timer->period.attoseconds); | |
| 408 | 399 | state_save_register_item(buf, count, timer->start.seconds); |
| 409 | state_save_register_item(buf, count, timer->start. | |
| 400 | state_save_register_item(buf, count, timer->start.attoseconds); | |
| 410 | 401 | state_save_register_item(buf, count, timer->expire.seconds); |
| 411 | state_save_register_item(buf, count, timer->expire. | |
| 402 | state_save_register_item(buf, count, timer->expire.attoseconds); | |
| 412 | 403 | state_save_pop_tag(); |
| 413 | 404 | } |
| 414 | 405 | |
| r1293 | r1294 | |
| 419 | 410 | |
| 420 | 411 | static void timer_postload(void) |
| 421 | 412 | { |
| 422 | mame_timer *privlist = NULL; | |
| 423 | mame_timer *t; | |
| 413 | emu_timer *privlist = NULL; | |
| 414 | emu_timer *t; | |
| 424 | 415 | |
| 425 | 416 | /* remove all timers and make a private list */ |
| 426 | 417 | while (timer_head) |
| r1293 | r1294 | |
| 457 | 448 | |
| 458 | 449 | int timer_count_anonymous(void) |
| 459 | 450 | { |
| 460 | | |
| 451 | | |
| 461 | 452 | int count = 0; |
| 462 | 453 | |
| 463 | 454 | logerror("timer_count_anonymous:\n"); |
| r1293 | r1294 | |
| 483 | 474 | isn't primed yet |
| 484 | 475 | -------------------------------------------------*/ |
| 485 | 476 | |
| 486 | INLINE | |
| 477 | INLINE | |
| 487 | 478 | { |
| 488 | mame_time time = get_current_time(); | |
| 489 | mame_timer *timer = timer_new(); | |
| 479 | attotime time = get_current_time(); | |
| 480 | emu_timer *timer = timer_new(); | |
| 490 | 481 | |
| 491 | 482 | /* fill in the record */ |
| 492 | 483 | timer->callback = callback; |
| r1293 | r1294 | |
| 496 | 487 | timer->enabled = FALSE; |
| 497 | 488 | timer->temporary = temp; |
| 498 | 489 | timer->ptr = (callback_ptr != NULL); |
| 499 | timer->period = time_zero; | |
| 490 | timer->period = attotime_zero; | |
| 500 | 491 | timer->file = file; |
| 501 | 492 | timer->line = line; |
| 502 | 493 | timer->func = func; |
| 503 | 494 | |
| 504 | 495 | /* compute the time of the next firing and insert into the list */ |
| 505 | 496 | timer->start = time; |
| 506 | timer->expire = time_never; | |
| 497 | timer->expire = attotime_never; | |
| 507 | 498 | timer_list_insert(timer); |
| 508 | 499 | |
| 509 | 500 | /* if we're not temporary, register ourselve with the save state system */ |
| r1293 | r1294 | |
| 517 | 508 | return timer; |
| 518 | 509 | } |
| 519 | 510 | |
| 520 | ||
| 511 | ||
| 521 | 512 | { |
| 522 | return _ | |
| 513 | return _ | |
| 523 | 514 | } |
| 524 | 515 | |
| 525 | ||
| 516 | ||
| 526 | 517 | { |
| 527 | return _ | |
| 518 | return _ | |
| 528 | 519 | } |
| 529 | 520 | |
| 530 | 521 | |
| r1293 | r1294 | |
| 533 | 524 | system |
| 534 | 525 | -------------------------------------------------*/ |
| 535 | 526 | |
| 536 | static void timer_remove( | |
| 527 | static void timer_remove( | |
| 537 | 528 | { |
| 538 | 529 | /* if this is a callback timer, note that */ |
| 539 | 530 | if (which == callback_timer) |
| r1293 | r1294 | |
| 563 | 554 | fire periodically |
| 564 | 555 | -------------------------------------------------*/ |
| 565 | 556 | |
| 566 | INLINE void | |
| 557 | INLINE void | |
| 567 | 558 | { |
| 568 | | |
| 559 | | |
| 569 | 560 | |
| 570 | 561 | /* if this is the callback timer, mark it modified */ |
| 571 | 562 | if (which == callback_timer) |
| r1293 | r1294 | |
| 577 | 568 | |
| 578 | 569 | /* clamp negative times to 0 */ |
| 579 | 570 | if (duration.seconds < 0) |
| 580 | duration = time_zero; | |
| 571 | duration = attotime_zero; | |
| 581 | 572 | |
| 582 | 573 | /* set the start and expire times */ |
| 583 | 574 | which->start = time; |
| 584 | which->expire = a | |
| 575 | which->expire = a | |
| 585 | 576 | which->period = period; |
| 586 | 577 | |
| 587 | 578 | /* remove and re-insert the timer in its new order */ |
| r1293 | r1294 | |
| 589 | 580 | timer_list_insert(which); |
| 590 | 581 | |
| 591 | 582 | /* if this was inserted as the head, abort the current timeslice and resync */ |
| 592 | LOG(("timer_adjust %s.%s:%d to expire @ % | |
| 583 | LOG(("timer_adjust %s.%s:%d to expire @ %s | |
| 593 | 584 | if (which == timer_head && cpu_getexecutingcpu() >= 0) |
| 594 | 585 | activecpu_abort_timeslice(); |
| 595 | 586 | } |
| 596 | 587 | |
| 597 | void | |
| 588 | void | |
| 598 | 589 | { |
| 599 | 590 | if (which->ptr) |
| 600 | fatalerror("mame_timer_adjust called on a ptr timer!"); | |
| 601 | mame_timer_adjust_common(which, duration, param, period); | |
| 591 | fatalerror("timer_adjust called on a ptr timer!"); | |
| 592 | timer_adjust_common(which, duration, param, period); | |
| 602 | 593 | } |
| 603 | 594 | |
| 604 | void | |
| 595 | void | |
| 605 | 596 | { |
| 606 | 597 | if (!which->ptr) |
| 607 | fatalerror("mame_timer_adjust_ptr called on a non-ptr timer!"); | |
| 608 | mame_timer_adjust_common(which, duration, 0, period); | |
| 598 | fatalerror("timer_adjust_ptr called on a non-ptr timer!"); | |
| 599 | timer_adjust_common(which, duration, 0, period); | |
| 609 | 600 | } |
| 610 | 601 | |
| 611 | 602 | |
| r1293 | r1294 | |
| 620 | 611 | period |
| 621 | 612 | -------------------------------------------------*/ |
| 622 | 613 | |
| 623 | void _ | |
| 614 | void _ | |
| 624 | 615 | { |
| 625 | | |
| 616 | | |
| 626 | 617 | |
| 627 | 618 | /* adjust to our liking */ |
| 628 | | |
| 619 | | |
| 629 | 620 | } |
| 630 | 621 | |
| 631 | void _ | |
| 622 | void _ | |
| 632 | 623 | { |
| 633 | | |
| 624 | | |
| 634 | 625 | |
| 635 | 626 | /* adjust to our liking */ |
| 636 | | |
| 627 | | |
| 637 | 628 | } |
| 638 | 629 | |
| 639 | 630 | |
| r1293 | r1294 | |
| 642 | 633 | calls the callback after the given duration |
| 643 | 634 | -------------------------------------------------*/ |
| 644 | 635 | |
| 645 | void _ | |
| 636 | void _ | |
| 646 | 637 | { |
| 647 | | |
| 638 | | |
| 648 | 639 | |
| 649 | 640 | /* adjust to our liking */ |
| 650 | | |
| 641 | | |
| 651 | 642 | } |
| 652 | 643 | |
| 653 | void _ | |
| 644 | void _ | |
| 654 | 645 | { |
| 655 | | |
| 646 | | |
| 656 | 647 | |
| 657 | 648 | /* adjust to our liking */ |
| 658 | | |
| 649 | | |
| 659 | 650 | } |
| 660 | 651 | |
| 661 | 652 | |
| r1293 | r1294 | |
| 668 | 659 | timer_reset - reset the timing on a timer |
| 669 | 660 | -------------------------------------------------*/ |
| 670 | 661 | |
| 671 | void | |
| 662 | void | |
| 672 | 663 | { |
| 673 | 664 | /* adjust the timer */ |
| 674 | 665 | if (!which->ptr) |
| 675 | | |
| 666 | | |
| 676 | 667 | else |
| 677 | | |
| 668 | | |
| 678 | 669 | } |
| 679 | 670 | |
| 680 | 671 | |
| r1293 | r1294 | |
| 682 | 673 | timer_enable - enable/disable a timer |
| 683 | 674 | -------------------------------------------------*/ |
| 684 | 675 | |
| 685 | int | |
| 676 | int | |
| 686 | 677 | { |
| 687 | 678 | int old; |
| 688 | 679 | |
| r1293 | r1294 | |
| 703 | 694 | enabled |
| 704 | 695 | -------------------------------------------------*/ |
| 705 | 696 | |
| 706 | int | |
| 697 | int | |
| 707 | 698 | { |
| 708 | 699 | return which->enabled; |
| 709 | 700 | } |
| r1293 | r1294 | |
| 715 | 706 | parameter of a timer |
| 716 | 707 | -------------------------------------------------*/ |
| 717 | 708 | |
| 718 | int | |
| 709 | int | |
| 719 | 710 | { |
| 720 | 711 | return which->callback_param; |
| 721 | 712 | } |
| 722 | 713 | |
| 723 | 714 | |
| 724 | void * | |
| 715 | void * | |
| 725 | 716 | { |
| 726 | 717 | return which->callback_ptr_param; |
| 727 | 718 | } |
| 728 | 719 | |
| 729 | 720 | |
| 721 | ||
| 730 | 722 | /*************************************************************************** |
| 731 | 723 | TIMING FUNCTIONS |
| 732 | 724 | ***************************************************************************/ |
| r1293 | r1294 | |
| 736 | 728 | last trigger |
| 737 | 729 | -------------------------------------------------*/ |
| 738 | 730 | |
| 739 | ||
| 731 | ||
| 740 | 732 | { |
| 741 | return | |
| 733 | return | |
| 742 | 734 | } |
| 743 | 735 | |
| 744 | 736 | |
| r1293 | r1294 | |
| 747 | 739 | next trigger |
| 748 | 740 | -------------------------------------------------*/ |
| 749 | 741 | |
| 750 | ||
| 742 | ||
| 751 | 743 | { |
| 752 | return | |
| 744 | return | |
| 753 | 745 | } |
| 754 | 746 | |
| 755 | 747 | |
| r1293 | r1294 | |
| 757 | 749 | timer_get_time - return the current time |
| 758 | 750 | -------------------------------------------------*/ |
| 759 | 751 | |
| 760 | ||
| 752 | ||
| 761 | 753 | { |
| 762 | 754 | return get_current_time(); |
| 763 | 755 | } |
| r1293 | r1294 | |
| 768 | 760 | timer started counting |
| 769 | 761 | -------------------------------------------------*/ |
| 770 | 762 | |
| 771 | ||
| 763 | ||
| 772 | 764 | { |
| 773 | 765 | return which->start; |
| 774 | 766 | } |
| r1293 | r1294 | |
| 779 | 771 | timer will fire next |
| 780 | 772 | -------------------------------------------------*/ |
| 781 | 773 | |
| 782 | ||
| 774 | ||
| 783 | 775 | { |
| 784 | 776 | return which->expire; |
| 785 | 777 | } |
| r1293 | r1294 | |
| 796 | 788 | |
| 797 | 789 | static void timer_logtimers(void) |
| 798 | 790 | { |
| 799 | | |
| 791 | | |
| 800 | 792 | |
| 801 | 793 | logerror("===============\n"); |
| 802 | 794 | logerror("TIMER LOG START\n"); |
| r1293 | r1294 | |
| 805 | 797 | logerror("Enqueued timers:\n"); |
| 806 | 798 | for (t = timer_head; t; t = t->next) |
| 807 | 799 | logerror(" Start=%15.6f Exp=%15.6f Per=%15.6f Ena=%d Tmp=%d (%s:%d[%s])\n", |
| 808 | | |
| 800 | | |
| 809 | 801 | |
| 810 | 802 | logerror("Free timers:\n"); |
| 811 | 803 | for (t = timer_free_head; t; t = t->next) |
| 812 | 804 | logerror(" Start=%15.6f Exp=%15.6f Per=%15.6f Ena=%d Tmp=%d (%s:%d[%s])\n", |
| 813 | | |
| 805 | | |
| 814 | 806 | |
| 815 | 807 | logerror("==============\n"); |
| 816 | 808 | logerror("TIMER LOG STOP\n"); |
| r1293 | r1294 | |
|---|---|---|
| 532 | 532 | GLOBAL VARIABLES |
| 533 | 533 | ***************************************************************************/ |
| 534 | 534 | |
| 535 | static | |
| 535 | static | |
| 536 | 536 | |
| 537 | 537 | static CheatEntry * cheatList = NULL; |
| 538 | 538 | static INT32 cheatListLength = 0; |
| r1293 | r1294 | |
| 1500 | 1500 | /* ----- initialize string table ----- */ |
| 1501 | 1501 | InitStringTable(); |
| 1502 | 1502 | |
| 1503 | periodic_timer = mame_timer_alloc(cheat_periodic); | |
| 1504 | mame_timer_adjust(periodic_timer, make_mame_time(0, Machine->screen[0].refresh), 0, make_mame_time(0, Machine->screen[0].refresh)); | |
| 1503 | periodic_timer = timer_alloc(cheat_periodic); | |
| 1504 | timer_adjust(periodic_timer, attotime_make(0, Machine->screen[0].refresh), 0, attotime_make(0, Machine->screen[0].refresh)); | |
| 1505 | 1505 | |
| 1506 | 1506 | add_exit_callback(machine, cheat_exit); |
| 1507 | 1507 | } |
| r1293 | r1294 | |
| 9434 | 9434 | |
| 9435 | 9435 | refresh /= 65536.0; |
| 9436 | 9436 | |
| 9437 | video_screen_configure(0, state->width, state->height, &state->visarea, HZ_TO_ | |
| 9437 | video_screen_configure(0, state->width, state->height, &state->visarea, HZ_TO_ATTOSECONDS(refresh)); | |
| 9438 | 9438 | } |
| 9439 | 9439 | break; |
| 9440 | 9440 | } |
| r1293 | r1294 | |
| 11406 | 11406 | /* ----- keep if one shot + restore prevous value + delay !=0 ----- */ |
| 11407 | 11407 | cheat_periodicOperation(action); |
| 11408 | 11408 | |
| 11409 | if(action->frameTimer >= (parameter * | |
| 11409 | if(action->frameTimer >= (parameter * ATTOSECONDS_TO_HZ(Machine->screen[0].refresh))) | |
| 11410 | 11410 | { |
| 11411 | 11411 | action->frameTimer = 0; |
| 11412 | 11412 | |
| r1293 | r1294 | |
| 11418 | 11418 | else |
| 11419 | 11419 | { |
| 11420 | 11420 | /* ----- otherwise, delay ----- */ |
| 11421 | if(action->frameTimer >= (parameter * | |
| 11421 | if(action->frameTimer >= (parameter * ATTOSECONDS_TO_HZ(Machine->screen[0].refresh))) | |
| 11422 | 11422 | { |
| 11423 | 11423 | action->frameTimer = 0; |
| 11424 | 11424 | |
| r1293 | r1294 | |
| 11457 | 11457 | |
| 11458 | 11458 | if(currentValue != action->lastValue) |
| 11459 | 11459 | { |
| 11460 | action->frameTimer = parameter * | |
| 11460 | action->frameTimer = parameter * ATTOSECONDS_TO_HZ(Machine->screen[0].refresh); | |
| 11461 | 11461 | |
| 11462 | 11462 | action->flags |= kActionFlag_WasModified; |
| 11463 | 11463 | } |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | #define __TIMER_H__ |
| 17 | 17 | |
| 18 | 18 | #include "mamecore.h" |
| 19 | #include | |
| 19 | #include " | |
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | /*************************************************************************** |
| 23 | CONSTANTS | |
| 24 | ***************************************************************************/ | |
| 25 | ||
| 26 | /* subseconds are tracked in attosecond (10^-18) increments */ | |
| 27 | #define MAX_SUBSECONDS_SQRT ((subseconds_t)1000000000) | |
| 28 | #define MAX_SUBSECONDS (MAX_SUBSECONDS_SQRT * MAX_SUBSECONDS_SQRT) | |
| 29 | #define MAX_SECONDS ((seconds_t)1000000000) | |
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | /*************************************************************************** | |
| 34 | 23 | MACROS |
| 35 | 24 | ***************************************************************************/ |
| 36 | 25 | |
| 37 | /* convert between a double and subseconds */ | |
| 38 | #define SUBSECONDS_TO_DOUBLE(x) ((double)(x) * (1.0 / (double)MAX_SUBSECONDS)) | |
| 39 | #define DOUBLE_TO_SUBSECONDS(x) ((subseconds_t)((x) * (double)MAX_SUBSECONDS)) | |
| 40 | #define USEC_TO_SUBSECONDS(us) ((subseconds_t)((us) * (MAX_SUBSECONDS / 1000000))) | |
| 26 | /* convert cycles on a given CPU to/from attotime */ | |
| 27 | #define ATTOTIME_TO_CYCLES(cpu,t) ((t).seconds * cycles_per_second[cpu] + (t).attoseconds / attoseconds_per_cycle[cpu]) | |
| 28 | #define ATTOTIME_IN_CYCLES(c,cpu) (attotime_make((c) / cycles_per_second[cpu], (c) * attoseconds_per_cycle[cpu])) | |
| 41 | 29 | |
| 42 | /* hertz to subseconds macros */ | |
| 43 | #define SUBSECONDS_TO_HZ(x) ((double)MAX_SUBSECONDS / (double)(x)) | |
| 44 | #define HZ_TO_SUBSECONDS(x) (MAX_SUBSECONDS / (x)) | |
| 45 | ||
| 46 | /* convert cycles on a given CPU to/from mame_time */ | |
| 47 | #define MAME_TIME_TO_CYCLES(cpu,t) ((t).seconds * cycles_per_second[cpu] + (t).subseconds / subseconds_per_cycle[cpu]) | |
| 48 | #define MAME_TIME_IN_CYCLES(c,cpu) (make_mame_time((c) / cycles_per_second[cpu], (c) * subseconds_per_cycle[cpu])) | |
| 49 | ||
| 50 | /* useful macros for describing mame_times */ | |
| 51 | #define MAME_TIME_IN_HZ(hz) make_mame_time(0, MAX_SUBSECONDS / (hz)) | |
| 52 | #define MAME_TIME_IN_SEC(s) make_mame_time((s) / 1, (s) % 1 /* mod here errors on doubles, which is intended */) | |
| 53 | #define MAME_TIME_IN_MSEC(ms) make_mame_time((ms) / 1000, ((ms) % 1000) * (MAX_SUBSECONDS / 1000)) | |
| 54 | #define MAME_TIME_IN_USEC(us) make_mame_time((us) / 1000000, ((us) % 1000000) * (MAX_SUBSECONDS / 1000000)) | |
| 55 | #define MAME_TIME_IN_NSEC(ns) make_mame_time((ns) / 1000000000, ((ns) % 1000000000) * (MAX_SUBSECONDS / 1000000000)) | |
| 56 | ||
| 57 | 30 | /* macro for the RC time constant on a 74LS123 with C > 1000pF */ |
| 58 | 31 | /* R is in ohms, C is in farads */ |
| 59 | 32 | #define TIME_OF_74LS123(r,c) (0.45 * (double)(r) * (double)(c)) |
| 60 | 33 | |
| 61 | 34 | /* macros for the RC time constant on a 555 timer IC */ |
| 62 | 35 | /* R is in ohms, C is in farads */ |
| 63 | #define PERIOD_OF_555_MONOSTABLE(r,c) MAME_TIME_IN_NSEC((subseconds_t)(1100000000 * (double)(r) * (double)(c))) | |
| 64 | #define PERIOD_OF_555_ASTABLE(r1,r2,c) MAME_TIME_IN_NSEC((subseconds_t)( 693000000 * ((double)(r1) + 2.0 * (double)(r2)) * (double)(c))) | |
| 36 | #define PERIOD_OF_555_MONOSTABLE(r,c) ATTOTIME_IN_NSEC((attoseconds_t)(1100000000 * (double)(r) * (double)(c))) | |
| 37 | #define PERIOD_OF_555_ASTABLE(r1,r2,c) ATTOTIME_IN_NSEC((attoseconds_t)( 693000000 * ((double)(r1) + 2.0 * (double)(r2)) * (double)(c))) | |
| 65 | 38 | |
| 66 | 39 | /* macros that map all allocations to provide file/line/functions to the callee */ |
| 67 | #define mame_timer_alloc(c) _mame_timer_alloc(c, __FILE__, __LINE__, #c) | |
| 68 | #define mame_timer_alloc_ptr(c,p) _mame_timer_alloc_ptr(c, p, __FILE__, __LINE__, #c) | |
| 69 | #define mame_timer_pulse(e,p,c) _mame_timer_pulse(e, p, c, __FILE__, __LINE__, #c) | |
| 70 | #define mame_timer_pulse_ptr(e,p,c) _mame_timer_pulse_ptr(e, p, c, __FILE__, __LINE__, #c) | |
| 71 | #define mame_timer_set(d,p,c) _mame_timer_set(d, p, c, __FILE__, __LINE__, #c) | |
| 72 | #define mame_timer_set_ptr(d,p,c) _mame_timer_set_ptr(d, p, c, __FILE__, __LINE__, #c) | |
| 40 | #define timer_alloc(c) _timer_alloc(c, __FILE__, __LINE__, #c) | |
| 41 | #define timer_alloc_ptr(c,p) _timer_alloc_ptr(c, p, __FILE__, __LINE__, #c) | |
| 42 | #define timer_pulse(e,p,c) _timer_pulse(e, p, c, __FILE__, __LINE__, #c) | |
| 43 | #define timer_pulse_ptr(e,p,c) _timer_pulse_ptr(e, p, c, __FILE__, __LINE__, #c) | |
| 44 | #define timer_set(d,p,c) _timer_set(d, p, c, __FILE__, __LINE__, #c) | |
| 45 | #define timer_set_ptr(d,p,c) _timer_set_ptr(d, p, c, __FILE__, __LINE__, #c) | |
| 73 | 46 | |
| 74 | 47 | /* macros for a timer callback functions */ |
| 75 | 48 | #define TIMER_CALLBACK(name) void name(running_machine *machine, int param) |
| r1293 | r1294 | |
| 82 | 55 | ***************************************************************************/ |
| 83 | 56 | |
| 84 | 57 | /* opaque type for representing a timer */ |
| 85 | typedef struct _ | |
| 58 | typedef struct _ | |
| 86 | 59 | |
| 87 | /* these core types describe a 96-bit time value */ | |
| 88 | typedef INT64 subseconds_t; | |
| 89 | typedef INT32 seconds_t; | |
| 90 | 60 | |
| 91 | typedef struct _mame_time mame_time; | |
| 92 | struct _mame_time | |
| 93 | { | |
| 94 | seconds_t seconds; | |
| 95 | subseconds_t subseconds; | |
| 96 | }; | |
| 97 | 61 | |
| 98 | ||
| 99 | ||
| 100 | 62 | /*************************************************************************** |
| 101 | 63 | GLOBAL VARIABLES |
| 102 | 64 | ***************************************************************************/ |
| 103 | 65 | |
| 104 | /* constant times for zero and never */ | |
| 105 | extern mame_time time_zero; | |
| 106 | extern mame_time time_never; | |
| 107 | ||
| 108 | 66 | /* arrays containing mappings between CPU cycle times and timer values */ |
| 109 | extern s | |
| 67 | extern attos | |
| 110 | 68 | extern UINT32 cycles_per_second[]; |
| 111 | 69 | |
| 112 | 70 | |
| r1293 | r1294 | |
| 115 | 73 | FUNCTION PROTOTYPES |
| 116 | 74 | ***************************************************************************/ |
| 117 | 75 | |
| 118 | void timer_init(running_machine *machine); | |
| 119 | void timer_destructor(void *ptr, size_t size); | |
| 120 | int timer_count_anonymous(void); | |
| 121 | 76 | |
| 122 | mame_time mame_timer_next_fire_time(void); | |
| 123 | void mame_timer_set_global_time(mame_time newbase); | |
| 124 | mame_timer *_mame_timer_alloc(void (*callback)(running_machine *, int), const char *file, int line, const char *func); | |
| 125 | mame_timer *_mame_timer_alloc_ptr(void (*callback)(running_machine *, void *), void *param, const char *file, int line, const char *func); | |
| 126 | void mame_timer_adjust(mame_timer *which, mame_time duration, INT32 param, mame_time period); | |
| 127 | void mame_timer_adjust_ptr(mame_timer *which, mame_time duration, mame_time period); | |
| 128 | void _mame_timer_pulse(mame_time period, INT32 param, void (*callback)(running_machine *, int), const char *file, int line, const char *func); | |
| 129 | void _mame_timer_pulse_ptr(mame_time period, void *param, void (*callback)(running_machine *, void *), const char *file, int line, const char *func); | |
| 130 | void _mame_timer_set(mame_time duration, INT32 param, void (*callback)(running_machine *, int), const char *file, int line, const char *func); | |
| 131 | void _mame_timer_set_ptr(mame_time duration, void *param, void (*callback)(running_machine *, void *), const char *file, int line, const char *func); | |
| 132 | void mame_timer_reset(mame_timer *which, mame_time duration); | |
| 133 | int mame_timer_enable(mame_timer *which, int enable); | |
| 134 | int mame_timer_enabled(mame_timer *which); | |
| 135 | int mame_timer_get_param(mame_timer *which); | |
| 136 | void *mame_timer_get_param_ptr(mame_timer *which); | |
| 137 | mame_time mame_timer_timeelapsed(mame_timer *which); | |
| 138 | mame_time mame_timer_timeleft(mame_timer *which); | |
| 139 | mame_time mame_timer_get_time(void); | |
| 140 | mame_time mame_timer_starttime(mame_timer *which); | |
| 141 | mame_time mame_timer_firetime(mame_timer *which); | |
| 77 | /* ----- initialization ----- */ | |
| 142 | 78 | |
| 79 | /* initialize the timer system */ | |
| 80 | void timer_init(running_machine *machine); | |
| 143 | 81 | |
| 82 | /* destruct a timer from a pool callback */ | |
| 83 | void timer_destructor(void *ptr, size_t size); | |
| 144 | 84 | |
| 145 | /*************************************************************************** | |
| 146 | INLINE FUNCTIONS | |
| 147 | ***************************************************************************/ | |
| 148 | 85 | |
| 149 | /*------------------------------------------------- | |
| 150 | make_mame_time - assemble a mame_time from | |
| 151 | seconds and subseconds components | |
| 152 | -------------------------------------------------*/ | |
| 153 | 86 | |
| 154 | INLINE mame_time make_mame_time(seconds_t _secs, subseconds_t _subsecs) | |
| 155 | { | |
| 156 | mame_time result; | |
| 157 | result.seconds = _secs; | |
| 158 | result.subseconds = _subsecs; | |
| 159 | return result; | |
| 160 | } | |
| 87 | /* ----- scheduling helpers ----- */ | |
| 161 | 88 | |
| 89 | /* return the time when the next timer will fire */ | |
| 90 | attotime timer_next_fire_time(void); | |
| 162 | 91 | |
| 163 | /*------------------------------------------------- | |
| 164 | mame_time_to_subseconds - convert a mame_time | |
| 165 | to subseconds, clamping to maximum positive/ | |
| 166 | negative values | |
| 167 | -------------------------------------------------*/ | |
| 92 | /* adjust the global time; this is also where we fire the timers */ | |
| 93 | void timer_set_global_time(attotime newbase); | |
| 168 | 94 | |
| 169 | INLINE subseconds_t mame_time_to_subseconds(mame_time _time) | |
| 170 | { | |
| 171 | /* positive values between 0 and 1 second */ | |
| 172 | if (_time.seconds == 0) | |
| 173 | return _time.subseconds; | |
| 174 | 95 | |
| 175 | /* negative values between -1 and 0 seconds */ | |
| 176 | else if (_time.seconds == -1) | |
| 177 | return _time.subseconds - MAX_SUBSECONDS; | |
| 178 | 96 | |
| 179 | /* out-of-range positive values */ | |
| 180 | else if (_time.seconds > 0) | |
| 181 | return MAX_SUBSECONDS; | |
| 97 | /* ----- save/restore helpers ----- */ | |
| 182 | 98 | |
| 183 | /* out-of-range negative values */ | |
| 184 | else | |
| 185 | return -MAX_SUBSECONDS; | |
| 186 | } | |
| 99 | /* count the number of anonymous (non-saveable) timers */ | |
| 100 | int timer_count_anonymous(void); | |
| 187 | 101 | |
| 188 | 102 | |
| 189 | /*------------------------------------------------- | |
| 190 | mame_time_to_double - convert from mame_time | |
| 191 | to double | |
| 192 | -------------------------------------------------*/ | |
| 193 | 103 | |
| 194 | INLINE double mame_time_to_double(mame_time _time) | |
| 195 | { | |
| 196 | return (double)_time.seconds + SUBSECONDS_TO_DOUBLE(_time.subseconds); | |
| 197 | } | |
| 104 | /* ----- core timer management ----- */ | |
| 198 | 105 | |
| 106 | /* allocate a permament timer that isn't primed yet */ | |
| 107 | emu_timer *_timer_alloc(void (*callback)(running_machine *, int), const char *file, int line, const char *func); | |
| 108 | emu_timer *_timer_alloc_ptr(void (*callback)(running_machine *, void *), void *param, const char *file, int line, const char *func); | |
| 199 | 109 | |
| 200 | /*------------------------------------------------- | |
| 201 | double_to_mame_time - convert from double to | |
| 202 | mame_time | |
| 203 | -------------------------------------------------*/ | |
| 110 | /* adjust the time when this timer will fire, and whether or not it will fire periodically */ | |
| 111 | void timer_adjust(emu_timer *which, attotime duration, INT32 param, attotime period); | |
| 112 | void timer_adjust_ptr(emu_timer *which, attotime duration, attotime period); | |
| 204 | 113 | |
| 205 | INLINE mame_time double_to_mame_time(double _time) | |
| 206 | { | |
| 207 | mame_time abstime; | |
| 208 | 114 | |
| 209 | /* set seconds to the integral part */ | |
| 210 | abstime.seconds = floor(_time); | |
| 211 | 115 | |
| 212 | /* set subseconds to the fractional part */ | |
| 213 | _time -= (double)abstime.seconds; | |
| 214 | abstime.subseconds = DOUBLE_TO_SUBSECONDS(_time); | |
| 215 | return abstime; | |
| 216 | } | |
| 116 | /* ----- anonymous timer management ----- */ | |
| 217 | 117 | |
| 118 | /* allocate a pulse timer, which repeatedly calls the callback using the given period */ | |
| 119 | void _timer_pulse(attotime period, INT32 param, void (*callback)(running_machine *, int), const char *file, int line, const char *func); | |
| 120 | void _timer_pulse_ptr(attotime period, void *param, void (*callback)(running_machine *, void *), const char *file, int line, const char *func); | |
| 218 | 121 | |
| 219 | /*------------------------------------------------- | |
| 220 | add_mame_times - add two mame_times | |
| 221 | -------------------------------------------------*/ | |
| 122 | /* allocate a one-shot timer, which calls the callback after the given duration */ | |
| 123 | void _timer_set(attotime duration, INT32 param, void (*callback)(running_machine *, int), const char *file, int line, const char *func); | |
| 124 | void _timer_set_ptr(attotime duration, void *param, void (*callback)(running_machine *, void *), const char *file, int line, const char *func); | |
| 222 | 125 | |
| 223 | INLINE mame_time add_mame_times(mame_time _time1, mame_time _time2) | |
| 224 | { | |
| 225 | mame_time result; | |
| 226 | 126 | |
| 227 | /* if one of the items is time_never, return time_never */ | |
| 228 | if (_time1.seconds >= MAX_SECONDS || _time2.seconds >= MAX_SECONDS) | |
| 229 | return time_never; | |
| 230 | 127 | |
| 231 | /* add the seconds and subseconds */ | |
| 232 | result.subseconds = _time1.subseconds + _time2.subseconds; | |
| 233 | result.seconds = _time1.seconds + _time2.seconds; | |
| 128 | /* ----- miscellaneous controls ----- */ | |
| 234 | 129 | |
| 235 | /* normalize and return */ | |
| 236 | if (result.subseconds >= MAX_SUBSECONDS) | |
| 237 | { | |
| 238 | result.subseconds -= MAX_SUBSECONDS; | |
| 239 | result.seconds++; | |
| 240 | } | |
| 241 | return result; | |
| 242 | } | |
| 130 | /* reset the timing on a timer */ | |
| 131 | void timer_reset(emu_timer *which, attotime duration); | |
| 243 | 132 | |
| 133 | /* enable/disable a timer */ | |
| 134 | int timer_enable(emu_timer *which, int enable); | |
| 244 | 135 | |
| 245 | /*------------------------------------------------- | |
| 246 | add_subseconds_to_mame_time - add subseconds | |
| 247 | to a mame_time | |
| 248 | -------------------------------------------------*/ | |
| 136 | /* determine if a timer is enabled */ | |
| 137 | int timer_enabled(emu_timer *which); | |
| 249 | 138 | |
| 250 | INLINE mame_time add_subseconds_to_mame_time(mame_time _time1, subseconds_t _subseconds) | |
| 251 | { | |
| 252 | mame_time result; | |
| 139 | /* returns the callback parameter of a timer */ | |
| 140 | int timer_get_param(emu_timer *which); | |
| 141 | void *timer_get_param_ptr(emu_timer *which); | |
| 253 | 142 | |
| 254 | /* if one of the items is time_never, return time_never */ | |
| 255 | if (_time1.seconds >= MAX_SECONDS) | |
| 256 | return time_never; | |
| 257 | 143 | |
| 258 | /* add the seconds and subseconds */ | |
| 259 | result.subseconds = _time1.subseconds + _subseconds; | |
| 260 | result.seconds = _time1.seconds; | |
| 261 | 144 | |
| 262 | /* normalize and return */ | |
| 263 | if (result.subseconds >= MAX_SUBSECONDS) | |
| 264 | { | |
| 265 | result.subseconds -= MAX_SUBSECONDS; | |
| 266 | result.seconds++; | |
| 267 | } | |
| 268 | return result; | |
| 269 | } | |
| 145 | /* ----- timing functions ----- */ | |
| 270 | 146 | |
| 147 | /* return the time since the last trigger */ | |
| 148 | attotime timer_timeelapsed(emu_timer *which); | |
| 271 | 149 | |
| 272 | /*------------------------------------------------- | |
| 273 | sub_mame_times - subtract two mame_times | |
| 274 | -------------------------------------------------*/ | |
| 150 | /* return the time until the next trigger */ | |
| 151 | attotime timer_timeleft(emu_timer *which); | |
| 275 | 152 | |
| 276 | INLINE mame_time sub_mame_times(mame_time _time1, mame_time _time2) | |
| 277 | { | |
| 278 | mame_time result; | |
| 153 | /* return the current time */ | |
| 154 | attotime timer_get_time(void); | |
| 279 | 155 | |
| 280 | /* if time1 is time_never, return time_never */ | |
| 281 | if (_time1.seconds >= MAX_SECONDS) | |
| 282 | return time_never; | |
| 156 | /* return the time when this timer started counting */ | |
| 157 | attotime timer_starttime(emu_timer *which); | |
| 283 | 158 | |
| 284 | /* add the seconds and subseconds */ | |
| 285 | result.subseconds = _time1.subseconds - _time2.subseconds; | |
| 286 | result.seconds = _time1.seconds - _time2.seconds; | |
| 159 | /* return the time when this timer will fire next */ | |
| 160 | attotime timer_firetime(emu_timer *which); | |
| 287 | 161 | |
| 288 | /* normalize and return */ | |
| 289 | if (result.subseconds < 0) | |
| 290 | { | |
| 291 | result.subseconds += MAX_SUBSECONDS; | |
| 292 | result.seconds--; | |
| 293 | } | |
| 294 | return result; | |
| 295 | } | |
| 296 | 162 | |
| 297 | 163 | |
| 298 | /*------------------------------------------------- | |
| 299 | sub_subseconds_from_mame_time - subtract | |
| 300 | subseconds from a mame_time | |
| 301 | -------------------------------------------------*/ | |
| 302 | 164 | |
| 303 | INLINE mame_time sub_subseconds_from_mame_time(mame_time _time1, subseconds_t _subseconds) | |
| 304 | { | |
| 305 | mame_time result; | |
| 165 | /*************************************************************************** | |
| 166 | INLINE FUNCTIONS | |
| 167 | ***************************************************************************/ | |
| 306 | 168 | |
| 307 | /* if time1 is time_never, return time_never */ | |
| 308 | if (_time1.seconds >= MAX_SECONDS) | |
| 309 | return time_never; | |
| 310 | ||
| 311 | /* add the seconds and subseconds */ | |
| 312 | result.subseconds = _time1.subseconds - _subseconds; | |
| 313 | result.seconds = _time1.seconds; | |
| 314 | ||
| 315 | /* normalize and return */ | |
| 316 | if (result.subseconds < 0) | |
| 317 | { | |
| 318 | result.subseconds += MAX_SUBSECONDS; | |
| 319 | result.seconds--; | |
| 320 | } | |
| 321 | return result; | |
| 322 | } | |
| 323 | ||
| 324 | ||
| 325 | 169 | /*------------------------------------------------- |
| 326 | scale_up_mame_time - multiply a mame_time by | |
| 327 | a constant | |
| 328 | -------------------------------------------------*/ | |
| 329 | ||
| 330 | INLINE mame_time scale_up_mame_time(mame_time _time1, UINT32 factor) | |
| 331 | { | |
| 332 | UINT32 subseclo, subsechi; | |
| 333 | UINT64 templo, temphi; | |
| 334 | mame_time result; | |
| 335 | ||
| 336 | /* if one of the items is time_never, return time_never */ | |
| 337 | if (_time1.seconds >= MAX_SECONDS) | |
| 338 | return time_never; | |
| 339 | ||
| 340 | /* 0 times anything is zero */ | |
| 341 | if (factor == 0) | |
| 342 | return time_zero; | |
| 343 | ||
| 344 | /* break subseconds into lower and upper halves */ | |
| 345 | subseclo = (UINT32)(_time1.subseconds % MAX_SUBSECONDS_SQRT); | |
| 346 | subsechi = (UINT32)(_time1.subseconds / MAX_SUBSECONDS_SQRT); | |
| 347 | ||
| 348 | /* get a 64-bit product for each one */ | |
| 349 | templo = (UINT64)subseclo * (UINT64)factor; | |
| 350 | temphi = (UINT64)subsechi * (UINT64)factor; | |
| 351 | ||
| 352 | /* separate out the low and carry into the high */ | |
| 353 | subseclo = templo % MAX_SUBSECONDS_SQRT; | |
| 354 | temphi += templo / MAX_SUBSECONDS_SQRT; | |
| 355 | subsechi = temphi % MAX_SUBSECONDS_SQRT; | |
| 356 | ||
| 357 | /* assemble the two parts into final subseconds and carry into seconds */ | |
| 358 | result.subseconds = (subseconds_t)subseclo + MAX_SUBSECONDS_SQRT * (subseconds_t)subsechi; | |
| 359 | result.seconds = _time1.seconds * factor + temphi / MAX_SUBSECONDS_SQRT; | |
| 360 | ||
| 361 | /* max out at never time */ | |
| 362 | if (result.seconds >= MAX_SECONDS) | |
| 363 | return time_never; | |
| 364 | ||
| 365 | return result; | |
| 366 | } | |
| 367 | ||
| 368 | ||
| 369 | /*------------------------------------------------- | |
| 370 | scale_down_mame_time - divide a mame_time by | |
| 371 | a constant | |
| 372 | -------------------------------------------------*/ | |
| 373 | ||
| 374 | INLINE mame_time scale_down_mame_time(mame_time _time1, UINT32 factor) | |
| 375 | { | |
| 376 | mame_time result; | |
| 377 | int shift_count; | |
| 378 | int carry; | |
| 379 | ||
| 380 | /* if one of the items is time_never, return time_never */ | |
| 381 | if (_time1.seconds >= MAX_SECONDS) | |
| 382 | return time_never; | |
| 383 | ||
| 384 | result.seconds = _time1.seconds / factor; | |
| 385 | carry = _time1.seconds - (result.seconds * factor); | |
| 386 | ||
| 387 | /* shift the subseconds to the right by log2 of the factor, so it won't overflow */ | |
| 388 | shift_count = (log(carry) / log(2)) + 1; | |
| 389 | result.subseconds = (((carry * (MAX_SUBSECONDS >> shift_count)) + (_time1.subseconds >> shift_count)) / factor) << shift_count; | |
| 390 | ||
| 391 | return result; | |
| 392 | } | |
| 393 | ||
| 394 | ||
| 395 | /*------------------------------------------------- | |
| 396 | compare_mame_times - compare two mame_times | |
| 397 | -------------------------------------------------*/ | |
| 398 | ||
| 399 | INLINE int compare_mame_times(mame_time _time1, mame_time _time2) | |
| 400 | { | |
| 401 | if (_time1.seconds > _time2.seconds) | |
| 402 | return 1; | |
| 403 | if (_time1.seconds < _time2.seconds) | |
| 404 | return -1; | |
| 405 | if (_time1.subseconds > _time2.subseconds) | |
| 406 | return 1; | |
| 407 | if (_time1.subseconds < _time2.subseconds) | |
| 408 | return -1; | |
| 409 | return 0; | |
| 410 | } | |
| 411 | ||
| 412 | ||
| 413 | /*------------------------------------------------- | |
| 414 | 170 | timer_call_after_resynch - synchs the CPUs |
| 415 | 171 | and calls the callback immediately |
| 416 | 172 | -------------------------------------------------*/ |
| 417 | 173 | |
| 418 | 174 | INLINE void timer_call_after_resynch(INT32 param, void (*callback)(running_machine *, int)) |
| 419 | 175 | { |
| 420 | | |
| 176 | | |
| 421 | 177 | } |
| 422 | 178 | |
| 423 | ||
| 424 | 179 | INLINE void timer_call_after_resynch_ptr(void *param, void (*callback)(running_machine *, void *)) |
| 425 | 180 | { |
| 426 | | |
| 181 | | |
| 427 | 182 | } |
| 428 | 183 | |
| 429 | 184 |
| r1293 | r1294 | |
|---|---|---|
| 216 | 216 | static int validate_inlines(void) |
| 217 | 217 | { |
| 218 | 218 | #undef rand |
| 219 | int test1 = rand() | (rand() << 15); | |
| 220 | int test2 = rand() | (rand() << 15); | |
| 219 | UINT64 testu64a = rand() + (rand() << 15) + ((UINT64)rand() << 30) + ((UINT64)rand() << 45) + 1; | |
| 220 | INT64 testi64a = rand() + (rand() << 15) + ((INT64)rand() << 30) + ((INT64)rand() << 45) + 1; | |
| 221 | #ifdef PTR64 | |
| 222 | INT64 testi64b = rand() + (rand() << 15) + ((INT64)rand() << 30) + ((INT64)rand() << 45) + 1; | |
| 223 | #endif | |
| 224 | UINT32 testu32a = rand() + (rand() << 15) + 1; | |
| 225 | UINT32 testu32b = rand() + (rand() << 15) + 1; | |
| 226 | INT32 testi32a = rand() + (rand() << 15) + 1; | |
| 227 | INT32 testi32b = rand() + (rand() << 15) + 1; | |
| 228 | INT32 resulti32, expectedi32; | |
| 229 | UINT32 resultu32, expectedu32; | |
| 230 | INT64 resulti64, expectedi64; | |
| 231 | UINT64 resultu64, expectedu64; | |
| 232 | INT32 remainder, expremainder; | |
| 233 | UINT32 uremainder, expuremainder; | |
| 221 | 234 | int error = FALSE; |
| 222 | 235 | |
| 223 | if (mul_32x32(test1, test2) != (INT64)(INT32)test1 * (INT64)(INT32)test2) { mame_printf_error("Error testing mul_32x32\n"); error = TRUE; } | |
| 224 | if (mulu_32x32(test1, test2) != (UINT64)(UINT32)test1 * (UINT64)(UINT32)test2) { mame_printf_error("Error testing mulu_32x32\n"); error = TRUE; } | |
| 225 | if (mul_32x32_hi(test1, test2) != ((INT64)(INT32)test1 * (INT64)(INT32)test2) >> 32) { mame_printf_error("Error testing mul_32x32_hi\n"); error = TRUE; } | |
| 226 | if (mulu_32x32_hi(test1, test2) != ((UINT64)(UINT32)test1 * (UINT64)(UINT32)test2) >> 32) { mame_printf_error("Error testing mulu_32x32_hi\n"); error = TRUE; } | |
| 227 | if (mul_32x32_shift(test1, test2, 7) != (INT32)(((INT64)test1 * (INT64)test2) >> 7)) { mame_printf_error("Error testing mul_32x32_shift\n"); error = TRUE; } | |
| 228 | if (mulu_32x32_shift(test1, test2, 7) != (UINT32)(((UINT64)(UINT32)test1 * (UINT64)(UINT32)test2) >> 7)) { mame_printf_error("Error testing mulu_32x32_shift\n"); error = TRUE; } | |
| 229 | if (fabs(recip_approx(100.0) - 0.01) > 0.0001) { mame_printf_error("Error testing recip_approx\n"); error = TRUE; } | |
| 230 | test1 = (test1 & 0x0000ffff) | 0x400000; | |
| 231 | if (count_leading_zeros(test1) != 9) { mame_printf_error("Error testing count_leading_zeros\n"); error = TRUE; } | |
| 232 | test1 = (test1 | 0xffff0000) & ~0x400000; | |
| 233 | if (count_leading_ones(test1) != 9) { mame_printf_error("Error testing count_leading_ones\n"); error = TRUE; } | |
| 234 | test2 = test1; | |
| 235 | if (compare_exchange32(&test1, test2, 1000) != test2) { mame_printf_error("Error testing compare_exchange32\n"); error = TRUE; } | |
| 236 | if (atomic_exchange32(&test1, test2) != 1000) { mame_printf_error("Error testing atomic_exchange32\n"); error = TRUE; } | |
| 237 | if (atomic_add32(&test1, 45) != test2 + 45) { mame_printf_error("Error testing atomic_add32\n"); error = TRUE; } | |
| 236 | resulti64 = mul_32x32(testi32a, testi32b); | |
| 237 | expectedi64 = (INT64)testi32a * (INT64)testi32b; | |
| 238 | if (resulti64 != expectedi64) | |
| 239 | { mame_printf_error("Error testing mul_32x32 (%08X x %08X) = %08X%08X (expected %08X%08X)\n", testi32a, testi32b, (UINT32)(resulti64 >> 32), (UINT32)resulti64, (UINT32)(expectedi64 >> 32), (UINT32)expectedi64); error = TRUE; } | |
| 238 | 240 | |
| 241 | resultu64 = mulu_32x32(testu32a, testu32b); | |
| 242 | expectedu64 = (UINT64)testu32a * (UINT64)testu32b; | |
| 243 | if (resultu64 != expectedu64) | |
| 244 | { mame_printf_error("Error testing mulu_32x32 (%08X x %08X) = %08X%08X (expected %08X%08X)\n", testu32a, testu32b, (UINT32)(resultu64 >> 32), (UINT32)resultu64, (UINT32)(expectedu64 >> 32), (UINT32)expectedu64); error = TRUE; } | |
| 245 | ||
| 246 | resulti32 = mul_32x32_hi(testi32a, testi32b); | |
| 247 | expectedi32 = ((INT64)testi32a * (INT64)testi32b) >> 32; | |
| 248 | if (resulti32 != expectedi32) | |
| 249 | { mame_printf_error("Error testing mul_32x32_hi (%08X x %08X) = %08X (expected %08X)\n", testi32a, testi32b, resulti32, expectedi32); error = TRUE; } | |
| 250 | ||
| 251 | resultu32 = mulu_32x32_hi(testu32a, testu32b); | |
| 252 | expectedu32 = ((INT64)testu32a * (INT64)testu32b) >> 32; | |
| 253 | if (resultu32 != expectedu32) | |
| 254 | { mame_printf_error("Error testing mulu_32x32_hi (%08X x %08X) = %08X (expected %08X)\n", testu32a, testu32b, resultu32, expectedu32); error = TRUE; } | |
| 255 | ||
| 256 | resulti32 = mul_32x32_shift(testi32a, testi32b, 7); | |
| 257 | expectedi32 = ((INT64)testi32a * (INT64)testi32b) >> 7; | |
| 258 | if (resulti32 != expectedi32) | |
| 259 | { mame_printf_error("Error testing mul_32x32_shift (%08X x %08X) >> 7 = %08X (expected %08X)\n", testi32a, testi32b, resulti32, expectedi32); error = TRUE; } | |
| 260 | ||
| 261 | resultu32 = mulu_32x32_shift(testu32a, testu32b, 7); | |
| 262 | expectedu32 = ((INT64)testu32a * (INT64)testu32b) >> 7; | |
| 263 | if (resultu32 != expectedu32) | |
| 264 | { mame_printf_error("Error testing mulu_32x32_shift (%08X x %08X) >> 7 = %08X (expected %08X)\n", testu32a, testu32b, resultu32, expectedu32); error = TRUE; } | |
| 265 | ||
| 266 | while ((INT64)testi32a * (INT64)0x7fffffff < testi64a) | |
| 267 | testi64a /= 2; | |
| 268 | while ((UINT64)testu32a * (UINT64)0xffffffff < testu64a) | |
| 269 | testu64a /= 2; | |
| 270 | ||
| 271 | resulti32 = div_64x32(testi64a, testi32a); | |
| 272 | expectedi32 = testi64a / (INT64)testi32a; | |
| 273 | if (resulti32 != expectedi32) | |
| 274 | { mame_printf_error("Error testing div_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", (UINT32)(testi64a >> 32), (UINT32)testi64a, testi32a, resulti32, expectedi32); error = TRUE; } | |
| 275 | ||
| 276 | resultu32 = divu_64x32(testu64a, testu32a); | |
| 277 | expectedu32 = testu64a / (UINT64)testu32a; | |
| 278 | if (resultu32 != expectedu32) | |
| 279 | { mame_printf_error("Error testing divu_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", (UINT32)(testu64a >> 32), (UINT32)testu64a, testu32a, resultu32, expectedu32); error = TRUE; } | |
| 280 | ||
| 281 | resulti32 = div_64x32_rem(testi64a, testi32a, &remainder); | |
| 282 | expectedi32 = testi64a / (INT64)testi32a; | |
| 283 | expremainder = testi64a % (INT64)testi32a; | |
| 284 | if (resulti32 != expectedi32 || remainder != expremainder) | |
| 285 | { mame_printf_error("Error testing div_64x32_rem (%08X%08X / %08X) = %08X,%08X (expected %08X,%08X)\n", (UINT32)(testi64a >> 32), (UINT32)testi64a, testi32a, resulti32, remainder, expectedi32, expremainder); error = TRUE; } | |
| 286 | ||
| 287 | resultu32 = divu_64x32_rem(testu64a, testu32a, &uremainder); | |
| 288 | expectedu32 = testu64a / (UINT64)testu32a; | |
| 289 | expuremainder = testu64a % (UINT64)testu32a; | |
| 290 | if (resultu32 != expectedu32 || uremainder != expuremainder) | |
| 291 | { mame_printf_error("Error testing divu_64x32_rem (%08X%08X / %08X) = %08X,%08X (expected %08X,%08X)\n", (UINT32)(testu64a >> 32), (UINT32)testu64a, testu32a, resultu32, uremainder, expectedu32, expuremainder); error = TRUE; } | |
| 292 | ||
| 293 | resulti32 = mod_64x32(testi64a, testi32a); | |
| 294 | expectedi32 = testi64a % (INT64)testi32a; | |
| 295 | if (resulti32 != expectedi32) | |
| 296 | { mame_printf_error("Error testing mod_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", (UINT32)(testi64a >> 32), (UINT32)testi64a, testi32a, resulti32, expectedi32); error = TRUE; } | |
| 297 | ||
| 298 | resultu32 = modu_64x32(testu64a, testu32a); | |
| 299 | expectedu32 = testu64a % (UINT64)testu32a; | |
| 300 | if (resultu32 != expectedu32) | |
| 301 | { mame_printf_error("Error testing modu_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", (UINT32)(testu64a >> 32), (UINT32)testu64a, testu32a, resultu32, expectedu32); error = TRUE; } | |
| 302 | ||
| 303 | while ((INT64)testi32a * (INT64)0x7fffffff < ((INT32)testi64a << 3)) | |
| 304 | testi64a /= 2; | |
| 305 | while ((UINT64)testu32a * (UINT64)0xffffffff < ((UINT32)testu64a << 3)) | |
| 306 | testu64a /= 2; | |
| 307 | ||
| 308 | resulti32 = div_32x32_shift((INT32)testi64a, testi32a, 3); | |
| 309 | expectedi32 = ((INT64)(INT32)testi64a << 3) / (INT64)testi32a; | |
| 310 | if (resulti32 != expectedi32) | |
| 311 | { mame_printf_error("Error testing div_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", (INT32)testi64a, testi32a, resulti32, expectedi32); error = TRUE; } | |
| 312 | ||
| 313 | resultu32 = divu_32x32_shift((UINT32)testu64a, testu32a, 3); | |
| 314 | expectedu32 = ((UINT64)(UINT32)testu64a << 3) / (UINT64)testu32a; | |
| 315 | if (resultu32 != expectedu32) | |
| 316 | { mame_printf_error("Error testing divu_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", (UINT32)testu64a, testu32a, resultu32, expectedu32); error = TRUE; } | |
| 317 | ||
| 318 | if (fabs(recip_approx(100.0) - 0.01) > 0.0001) | |
| 319 | { mame_printf_error("Error testing recip_approx\n"); error = TRUE; } | |
| 320 | ||
| 321 | testi32a = (testi32a & 0x0000ffff) | 0x400000; | |
| 322 | if (count_leading_zeros(testi32a) != 9) | |
| 323 | { mame_printf_error("Error testing count_leading_zeros\n"); error = TRUE; } | |
| 324 | testi32a = (testi32a | 0xffff0000) & ~0x400000; | |
| 325 | if (count_leading_ones(testi32a) != 9) | |
| 326 | { mame_printf_error("Error testing count_leading_ones\n"); error = TRUE; } | |
| 327 | ||
| 328 | testi32b = testi32a; | |
| 329 | if (compare_exchange32(&testi32a, testi32b, 1000) != testi32b || testi32a != 1000) | |
| 330 | { mame_printf_error("Error testing compare_exchange32\n"); error = TRUE; } | |
| 331 | #ifdef PTR64 | |
| 332 | testi64b = testi64a; | |
| 333 | if (compare_exchange64(&testi64a, testi64b, 1000) != testi64b || testi64a != 1000) | |
| 334 | { mame_printf_error("Error testing compare_exchange64\n"); error = TRUE; } | |
| 335 | #endif | |
| 336 | if (atomic_exchange32(&testi32a, testi32b) != 1000) | |
| 337 | { mame_printf_error("Error testing atomic_exchange32\n"); error = TRUE; } | |
| 338 | if (atomic_add32(&testi32a, 45) != testi32b + 45) | |
| 339 | { mame_printf_error("Error testing atomic_add32\n"); error = TRUE; } | |
| 340 | if (atomic_increment32(&testi32a) != testi32b + 46) | |
| 341 | { mame_printf_error("Error testing atomic_increment32\n"); error = TRUE; } | |
| 342 | if (atomic_decrement32(&testi32a) != testi32b + 45) | |
| 343 | { mame_printf_error("Error testing atomic_decrement32\n"); error = TRUE; } | |
| 344 | ||
| 239 | 345 | return error; |
| 240 | 346 | } |
| 241 | 347 |
| r1293 | r1294 | |
|---|---|---|
| 69 | 69 | double cur_time; |
| 70 | 70 | double new_position; |
| 71 | 71 | |
| 72 | cur_time = | |
| 72 | cur_time = | |
| 73 | 73 | tag = get_cassimg(cassette); |
| 74 | 74 | |
| 75 | 75 | if (cassette_is_motor_on(cassette) && tag->cassette) |
| r1293 | r1294 | |
| 180 | 180 | position = tag->position; |
| 181 | 181 | |
| 182 | 182 | if (cassette_is_motor_on(cassette)) |
| 183 | position += | |
| 183 | position += | |
| 184 | 184 | return position; |
| 185 | 185 | } |
| 186 | 186 | |
| r1293 | r1294 | |
| 294 | 294 | |
| 295 | 295 | /* reset the position */ |
| 296 | 296 | tag->position = 0.0; |
| 297 | tag->position_time = | |
| 297 | tag->position_time = | |
| 298 | 298 | |
| 299 | 299 | return INIT_PASS; |
| 300 | 300 |
| r1293 | r1294 | |
|---|---|---|
| 44 | 44 | pDrive->flags = 0; |
| 45 | 45 | pDrive->index_pulse_callback = NULL; |
| 46 | 46 | pDrive->ready_state_change_callback = NULL; |
| 47 | pDrive->index_timer = | |
| 47 | pDrive->index_timer = | |
| 48 | 48 | pDrive->index = 0; |
| 49 | 49 | |
| 50 | 50 | /* all drives are double-sided 80 track - can be overriden in driver! */ |
| r1293 | r1294 | |
| 75 | 75 | if (pDrive->index) |
| 76 | 76 | { |
| 77 | 77 | pDrive->index = 0; |
| 78 | | |
| 78 | | |
| 79 | 79 | } |
| 80 | 80 | else |
| 81 | 81 | { |
| 82 | 82 | pDrive->index = 1; |
| 83 | | |
| 83 | | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | if (pDrive->index_pulse_callback) |
| r1293 | r1294 | |
| 214 | 214 | else |
| 215 | 215 | { |
| 216 | 216 | /* on->off */ |
| 217 | | |
| 217 | | |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | } |
| r1293 | r1294 | |
|---|---|---|
| 348 | 348 | break; |
| 349 | 349 | case 0x0e: /* Tachometer */ |
| 350 | 350 | /* (time in seconds) / (60 sec/minute) * (rounds/minute) * (60 pulses) * (2 pulse phases) */ |
| 351 | result = ((int) ( | |
| 351 | result = ((int) ( | |
| 352 | 352 | break; |
| 353 | 353 | case 0x0f: /* Drive installed: 0=drive connected, 1=drive not connected */ |
| 354 | 354 | result = 0; |
| r1293 | r1294 | |
|---|---|---|
| 47 | 47 | bi->last_pulse_time = 0.0; |
| 48 | 48 | bi->recorded_pulses = 0; |
| 49 | 49 | bi->value = config->initial_value; |
| 50 | bi->timeout_timer = | |
| 50 | bi->timeout_timer = | |
| 51 | 51 | bi->over_threshhold = 1; |
| 52 | 52 | |
| 53 | 53 | bitbangers[id] = bi; |
| r1293 | r1294 | |
| 118 | 118 | { |
| 119 | 119 | int id = param; |
| 120 | 120 | struct bitbanger_info *bi = bitbangers[id]; |
| 121 | bitbanger_addpulse(id, bi, | |
| 121 | bitbanger_addpulse(id, bi, | |
| 122 | 122 | bi->over_threshhold = 1; |
| 123 | 123 | bi->recorded_pulses = 0; |
| 124 | 124 | } |
| r1293 | r1294 | |
| 138 | 138 | /* only meaningful if we change */ |
| 139 | 139 | if (bi->value != value) |
| 140 | 140 | { |
| 141 | current_time = | |
| 141 | current_time = | |
| 142 | 142 | pulse_width = current_time - bi->last_pulse_time; |
| 143 | 143 | |
| 144 | 144 | assert(pulse_width >= 0); |
| r1293 | r1294 | |
| 152 | 152 | bi->over_threshhold = 0; |
| 153 | 153 | |
| 154 | 154 | /* update timeout timer */ |
| 155 | | |
| 155 | | |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 |
| r1293 | r1294 | |
|---|---|---|
| 293 | 293 | else if ( offset == 8 ) |
| 294 | 294 | return to7_5p14_select; |
| 295 | 295 | else |
| 296 | logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", | |
| 296 | logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", | |
| 297 | 297 | return 0; |
| 298 | 298 | } |
| 299 | 299 | |
| r1293 | r1294 | |
| 317 | 317 | case 4: drive = 2; side = 0; break; |
| 318 | 318 | case 5: drive = 3; side = 1; break; |
| 319 | 319 | default: |
| 320 | logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", | |
| 320 | logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", | |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | dens = (data & 0x80) ? DEN_FM_LO : DEN_MFM_LO; |
| r1293 | r1294 | |
| 332 | 332 | wd17xx_set_drive( drive ); |
| 333 | 333 | wd17xx_set_side( side ); |
| 334 | 334 | LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n", |
| 335 | | |
| 335 | | |
| 336 | 336 | data, drive, side, (dens == DEN_FM_LO) ? "FM" : "MFM" )); |
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | else |
| 340 | 340 | logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n", |
| 341 | | |
| 341 | | |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | |
| r1293 | r1294 | |
| 390 | 390 | else if ( offset >= 8 && offset <= 9 ) |
| 391 | 391 | return to7_5p14sd_select; |
| 392 | 392 | else |
| 393 | logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", | |
| 393 | logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", | |
| 394 | 394 | return 0; |
| 395 | 395 | } |
| 396 | 396 | |
| r1293 | r1294 | |
| 434 | 434 | mc6843_set_drive( drive ); |
| 435 | 435 | mc6843_set_side( side ); |
| 436 | 436 | LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n", |
| 437 | | |
| 437 | | |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 | else |
| 441 | 441 | logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n", |
| 442 | | |
| 442 | | |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | |
| r1293 | r1294 | |
| 552 | 552 | to7qdd->data_size = 0; |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | VLOG(( "%f to7_qdd_pulse_cb: state=%i\n", | |
| 555 | VLOG(( "%f to7_qdd_pulse_cb: state=%i\n", | |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | |
| r1293 | r1294 | |
| 616 | 616 | data = to7qdd->data[ to7qdd->data_idx ]; |
| 617 | 617 | |
| 618 | 618 | VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n", |
| 619 | | |
| 619 | | |
| 620 | 620 | to7qdd->data_idx, to7qdd->data_size, data )); |
| 621 | 621 | |
| 622 | 622 | to7qdd->data_idx++; |
| r1293 | r1294 | |
| 657 | 657 | to7qdd->data_idx++; |
| 658 | 658 | |
| 659 | 659 | VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n", |
| 660 | | |
| 660 | | |
| 661 | 661 | to7qdd->start_idx, to7qdd->data_idx )); |
| 662 | 662 | |
| 663 | 663 | /* end of tentative id field */ |
| r1293 | r1294 | |
| 671 | 671 | UINT8 filler = 0xff; |
| 672 | 672 | |
| 673 | 673 | LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n", |
| 674 | | |
| 674 | | |
| 675 | 675 | |
| 676 | 676 | floppy_drive_format_sector( to7_qdd_image(), |
| 677 | 677 | 0, sector, 0, 0, sector, 128, filler ); |
| r1293 | r1294 | |
| 700 | 700 | int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ]; |
| 701 | 701 | |
| 702 | 702 | LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n", |
| 703 | | |
| 703 | | |
| 704 | 704 | |
| 705 | 705 | floppy_drive_write_sector_data( to7_qdd_image(), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 ); |
| 706 | 706 | } |
| r1293 | r1294 | |
| 722 | 722 | case 0: /* MC6852 status */ |
| 723 | 723 | to7_qdd_stat_update(); |
| 724 | 724 | VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n", |
| 725 | | |
| 725 | | |
| 726 | 726 | to7qdd->status & QDD_S_IRQ ? 1 : 0, |
| 727 | 727 | to7qdd->status & QDD_S_PE ? 1 : 0, |
| 728 | 728 | to7qdd->status & QDD_S_OVR ? 1 : 0, |
| r1293 | r1294 | |
| 745 | 745 | data |= 0x40; /* disk present */ |
| 746 | 746 | if ( to7qdd->index_pulse ) |
| 747 | 747 | data |= 0x80; /* disk start */ |
| 748 | VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", | |
| 748 | VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", | |
| 749 | 749 | return data; |
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | default: |
| 753 | logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", | |
| 753 | logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", | |
| 754 | 754 | return 0; |
| 755 | 755 | } |
| 756 | 756 | } |
| r1293 | r1294 | |
| 772 | 772 | to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data & (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 ); |
| 773 | 773 | to7_qdd_stat_update(); |
| 774 | 774 | VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n", |
| 775 | | |
| 775 | | |
| 776 | 776 | data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-', |
| 777 | 777 | data & QDD_C1_STRIPSYNC ? "strip-sync " : "", |
| 778 | 778 | data & QDD_C1_CLRSYNC ? "clear-sync " : "", |
| r1293 | r1294 | |
| 796 | 796 | parity = par[ (data >> 3) & 7 ]; |
| 797 | 797 | to7_qdd_stat_update(); |
| 798 | 798 | VLOG(( "%f $%04x to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n", |
| 799 | | |
| 799 | | |
| 800 | 800 | bits, parname[ parity ], data & QDD_C2_BLEN ? 1 : 2, |
| 801 | 801 | data & QDD_C2_TSYNC ? "sync" : "ff", |
| 802 | 802 | data & QDD_C2_EIE ? "irq-err" : "" )); |
| r1293 | r1294 | |
| 814 | 814 | to7qdd->status &= ~QDD_S_NCTS; |
| 815 | 815 | to7_qdd_stat_update(); |
| 816 | 816 | VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n", |
| 817 | | |
| 817 | | |
| 818 | 818 | data & QDD_C3_CLRTUF ? "clr-tuf " : "", |
| 819 | 819 | data & QDD_C3_CLRCTS ? "clr-cts " : "", |
| 820 | 820 | data & QDD_C3_SYNCLEN ? 1 : 2, |
| r1293 | r1294 | |
| 826 | 826 | break; |
| 827 | 827 | |
| 828 | 828 | case 3: /* MC6852 data out => does not seem to be used */ |
| 829 | VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", | |
| 829 | VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", | |
| 830 | 830 | break; |
| 831 | 831 | |
| 832 | 832 | } |
| r1293 | r1294 | |
| 834 | 834 | |
| 835 | 835 | case 8: /* set drive */ |
| 836 | 836 | to7qdd->drive = data; |
| 837 | VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", | |
| 837 | VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", | |
| 838 | 838 | break; |
| 839 | 839 | |
| 840 | 840 | case 12: /* motor pulse ? */ |
| 841 | 841 | thom_floppy_active( 0 ); |
| 842 | VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", | |
| 842 | VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", | |
| 843 | 843 | break; |
| 844 | 844 | |
| 845 | 845 | default: |
| 846 | logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", | |
| 846 | logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", | |
| 847 | 847 | } |
| 848 | 848 | } |
| 849 | 849 | |
| r1293 | r1294 | |
| 951 | 951 | } * thmfc1; |
| 952 | 952 | |
| 953 | 953 | |
| 954 | static | |
| 954 | static | |
| 955 | 955 | |
| 956 | 956 | |
| 957 | 957 | |
| r1293 | r1294 | |
| 994 | 994 | thmfc1->data_raw_idx = 0; |
| 995 | 995 | } |
| 996 | 996 | |
| 997 | VLOG(( "%f thmfc_floppy_index_pulse_cb: state=%i\n", | |
| 997 | VLOG(( "%f thmfc_floppy_index_pulse_cb: state=%i\n", | |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | |
| r1293 | r1294 | |
| 1039 | 1039 | static TIMER_CALLBACK( thmfc_floppy_cmd_complete_cb ) |
| 1040 | 1040 | { |
| 1041 | 1041 | LOG (( "%f thmfc_floppy_cmd_complete_cb: cmd=%i off=%i/%i/%i\n", |
| 1042 | | |
| 1042 | | |
| 1043 | 1043 | thmfc1->data_finish - 1, thmfc1->data_size - 1 )); |
| 1044 | 1044 | |
| 1045 | 1045 | if ( thmfc1->op == THMFC1_OP_WRITE_SECT ) |
| r1293 | r1294 | |
| 1052 | 1052 | thmfc1->stat0 |= THMFC1_STAT0_FINISHED; |
| 1053 | 1053 | thmfc1->data_idx = 0; |
| 1054 | 1054 | thmfc1->data_size = 0; |
| 1055 | | |
| 1055 | | |
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | 1058 | |
| r1293 | r1294 | |
| 1063 | 1063 | UINT8 data = thmfc1->data[ thmfc1->data_idx ]; |
| 1064 | 1064 | |
| 1065 | 1065 | VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n", |
| 1066 | | |
| 1066 | | |
| 1067 | 1067 | thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1, |
| 1068 | 1068 | data )); |
| 1069 | 1069 | |
| r1293 | r1294 | |
| 1106 | 1106 | data = thmfc1->data[ thmfc1->data_raw_idx ]; |
| 1107 | 1107 | |
| 1108 | 1108 | VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n", |
| 1109 | | |
| 1109 | | |
| 1110 | 1110 | thmfc1->data_raw_idx, thmfc1->data_raw_size, data )); |
| 1111 | 1111 | |
| 1112 | 1112 | thmfc1->data_raw_idx++; |
| r1293 | r1294 | |
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n", |
| 1147 | | |
| 1147 | | |
| 1148 | 1148 | thmfc1->data_idx,thmfc1->data_raw_idx )); |
| 1149 | 1149 | |
| 1150 | 1150 | if ( thmfc1->data_raw_idx == thmfc1->data_idx + 3 && |
| r1293 | r1294 | |
| 1156 | 1156 | int sector = (int) thmfc1->data[ thmfc1->data_idx ] * 256 + (int) thmfc1->data[ thmfc1->data_idx + 1 ]; |
| 1157 | 1157 | UINT8 filler = 0xff; |
| 1158 | 1158 | |
| 1159 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", | |
| 1159 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", | |
| 1160 | 1160 | |
| 1161 | 1161 | floppy_drive_format_sector( thmfc_floppy_image(), 0, sector, 0, 0, sector, 128, filler ); |
| 1162 | 1162 | thmfc1->data_idx = 0; |
| r1293 | r1294 | |
| 1185 | 1185 | (int) thmfc1->data[ i + 2 ]; |
| 1186 | 1186 | |
| 1187 | 1187 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n", |
| 1188 | | |
| 1188 | | |
| 1189 | 1189 | |
| 1190 | 1190 | floppy_drive_write_sector_data( img, 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 ); |
| 1191 | 1191 | } |
| r1293 | r1294 | |
| 1199 | 1199 | else |
| 1200 | 1200 | { |
| 1201 | 1201 | thmfc1->data_raw_idx++; |
| 1202 | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", | |
| 1202 | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", | |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | 1205 | } |
| r1293 | r1294 | |
| 1210 | 1210 | static void thmfc_floppy_write_byte ( UINT8 data ) |
| 1211 | 1211 | { |
| 1212 | 1212 | VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n", |
| 1213 | | |
| 1213 | | |
| 1214 | 1214 | thmfc1->data_idx, thmfc1->data_size - 1, data )); |
| 1215 | 1215 | |
| 1216 | 1216 | thmfc1->data_raw_size = 0; |
| r1293 | r1294 | |
| 1224 | 1224 | /* intelligent formatting */ |
| 1225 | 1225 | static void thmfc_floppy_format_byte ( UINT8 data ) |
| 1226 | 1226 | { |
| 1227 | VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", | |
| 1227 | VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", | |
| 1228 | 1228 | |
| 1229 | 1229 | thmfc1->data_raw_size = 0; |
| 1230 | 1230 | |
| r1293 | r1294 | |
| 1264 | 1264 | |
| 1265 | 1265 | case 0: /* STAT0 */ |
| 1266 | 1266 | thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL; |
| 1267 | VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", | |
| 1267 | VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", | |
| 1268 | 1268 | return thmfc1->stat0; |
| 1269 | 1269 | |
| 1270 | 1270 | case 1: /* STAT1 */ |
| r1293 | r1294 | |
| 1295 | 1295 | data |= 0x10; |
| 1296 | 1296 | if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED ) |
| 1297 | 1297 | data |= 0x04; |
| 1298 | VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", | |
| 1298 | VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", | |
| 1299 | 1299 | return data; |
| 1300 | 1300 | } |
| 1301 | 1301 | |
| r1293 | r1294 | |
| 1313 | 1313 | { |
| 1314 | 1314 | /* undocumented => emulate TO7 QDD controller ? */ |
| 1315 | 1315 | UINT8 data = thmfc1->ipl << 7; |
| 1316 | VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", | |
| 1316 | VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", | |
| 1317 | 1317 | return data; |
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | 1320 | default: |
| 1321 | logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", | |
| 1321 | logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", | |
| 1322 | 1322 | return 0; |
| 1323 | 1323 | } |
| 1324 | 1324 | } |
| r1293 | r1294 | |
| 1338 | 1338 | thom_floppy_set_density( dens ); |
| 1339 | 1339 | thmfc1->formatting = (data >> 2) & 1; |
| 1340 | 1340 | LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n", |
| 1341 | | |
| 1341 | | |
| 1342 | 1342 | (dens == DEN_FM_LO) ? "MF" : "MFM", |
| 1343 | 1343 | wsync, (data >> 3) & 1, |
| 1344 | 1344 | thmfc1->formatting, data & 3 )); |
| 1345 | 1345 | |
| 1346 | 1346 | /* abort previous command, if any */ |
| 1347 | 1347 | thmfc1->op = THMFC1_OP_RESET; |
| 1348 | | |
| 1348 | | |
| 1349 | 1349 | |
| 1350 | 1350 | switch ( data & 3 ) |
| 1351 | 1351 | { |
| r1293 | r1294 | |
| 1364 | 1364 | thmfc1->data_finish = thmfc1->sector_size + 3; |
| 1365 | 1365 | thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP; |
| 1366 | 1366 | thmfc1->op = THMFC1_OP_WRITE_SECT; |
| 1367 | | |
| 1367 | | |
| 1368 | 1368 | } |
| 1369 | 1369 | break; |
| 1370 | 1370 | |
| r1293 | r1294 | |
| 1380 | 1380 | thmfc1->data_idx = 1; |
| 1381 | 1381 | thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP; |
| 1382 | 1382 | thmfc1->op = THMFC1_OP_READ_ADDR; |
| 1383 | | |
| 1383 | | |
| 1384 | 1384 | } |
| 1385 | 1385 | break; |
| 1386 | 1386 | |
| r1293 | r1294 | |
| 1396 | 1396 | thmfc1->data_idx = 1; |
| 1397 | 1397 | thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP; |
| 1398 | 1398 | thmfc1->op = THMFC1_OP_READ_SECT; |
| 1399 | | |
| 1399 | | |
| 1400 | 1400 | } |
| 1401 | 1401 | break; |
| 1402 | 1402 | } |
| r1293 | r1294 | |
| 1428 | 1428 | } |
| 1429 | 1429 | |
| 1430 | 1430 | LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n", |
| 1431 | | |
| 1431 | | |
| 1432 | 1432 | thmfc1->sector_size, (data >> 1) & 7, thmfc1->side )); |
| 1433 | 1433 | break; |
| 1434 | 1434 | |
| r1293 | r1294 | |
| 1456 | 1456 | thom_floppy_active( 0 ); |
| 1457 | 1457 | |
| 1458 | 1458 | LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n", |
| 1459 | | |
| 1459 | | |
| 1460 | 1460 | thmfc1->drive, seek, motor )); |
| 1461 | 1461 | |
| 1462 | 1462 | if ( seek ) |
| r1293 | r1294 | |
| 1486 | 1486 | { |
| 1487 | 1487 | /* TODO: implement other forms of raw track writing */ |
| 1488 | 1488 | LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n", |
| 1489 | | |
| 1489 | | |
| 1490 | 1490 | } |
| 1491 | 1491 | break; |
| 1492 | 1492 | |
| r1293 | r1294 | |
| 1494 | 1494 | case 4: /* WCLK (unemulated) */ |
| 1495 | 1495 | /* clock configuration: FF for data, 0A for synchro */ |
| 1496 | 1496 | LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n", |
| 1497 | | |
| 1497 | | |
| 1498 | 1498 | (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" )); |
| 1499 | 1499 | break; |
| 1500 | 1500 | |
| 1501 | 1501 | case 5: /* WSECT */ |
| 1502 | 1502 | thmfc1->sector = data; |
| 1503 | 1503 | LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n", |
| 1504 | | |
| 1504 | | |
| 1505 | 1505 | break; |
| 1506 | 1506 | |
| 1507 | 1507 | case 6: /* WTRCK */ |
| 1508 | 1508 | thmfc1->track = data; |
| 1509 | 1509 | LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n", |
| 1510 | | |
| 1510 | | |
| 1511 | 1511 | floppy_drive_get_current_track( thmfc_floppy_image() ) )); |
| 1512 | 1512 | break; |
| 1513 | 1513 | |
| 1514 | 1514 | case 7: /* WCELL */ |
| 1515 | 1515 | /* precompensation (unemulated) */ |
| 1516 | 1516 | LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n", |
| 1517 | | |
| 1517 | | |
| 1518 | 1518 | break; |
| 1519 | 1519 | |
| 1520 | 1520 | default: |
| 1521 | 1521 | logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n", |
| 1522 | | |
| 1522 | | |
| 1523 | 1523 | } |
| 1524 | 1524 | } |
| 1525 | 1525 | |
| r1293 | r1294 | |
| 1553 | 1553 | thmfc1->data_raw_size = 0; |
| 1554 | 1554 | thmfc1->data_crc = 0; |
| 1555 | 1555 | thmfc1->wsync = 0; |
| 1556 | | |
| 1556 | | |
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | 1559 | |
| r1293 | r1294 | |
| 1565 | 1565 | thmfc1 = auto_malloc( sizeof( *thmfc1 ) ); |
| 1566 | 1566 | assert( thmfc1 ); |
| 1567 | 1567 | |
| 1568 | thmfc_floppy_cmd = | |
| 1568 | thmfc_floppy_cmd = | |
| 1569 | 1569 | |
| 1570 | 1570 | state_save_register_global( thmfc1->op ); |
| 1571 | 1571 | state_save_register_global( thmfc1->sector ); |
| r1293 | r1294 | |
| 1603 | 1603 | |
| 1604 | 1604 | static TIMER_CALLBACK( ans4 ) |
| 1605 | 1605 | { |
| 1606 | LOG(( "%f ans4\n", | |
| 1606 | LOG(( "%f ans4\n", | |
| 1607 | 1607 | mc6854_set_cts( 0 ); |
| 1608 | 1608 | } |
| 1609 | 1609 | |
| 1610 | 1610 | static TIMER_CALLBACK( ans3 ) |
| 1611 | 1611 | { |
| 1612 | LOG(( "%f ans3\n", | |
| 1612 | LOG(( "%f ans3\n", | |
| 1613 | 1613 | mc6854_set_cts( 1 ); |
| 1614 | | |
| 1614 | | |
| 1615 | 1615 | } |
| 1616 | 1616 | |
| 1617 | 1617 | static TIMER_CALLBACK( ans2 ) |
| 1618 | 1618 | { |
| 1619 | LOG(( "%f ans2\n", | |
| 1619 | LOG(( "%f ans2\n", | |
| 1620 | 1620 | mc6854_set_cts( 0 ); |
| 1621 | | |
| 1621 | | |
| 1622 | 1622 | } |
| 1623 | 1623 | |
| 1624 | 1624 | static TIMER_CALLBACK( ans ) |
| 1625 | 1625 | { |
| 1626 | LOG(( "%f ans\n", | |
| 1626 | LOG(( "%f ans\n", | |
| 1627 | 1627 | mc6854_set_cts( 1 ); |
| 1628 | | |
| 1628 | | |
| 1629 | 1629 | } |
| 1630 | 1630 | /* consigne DKBOOT |
| 1631 | 1631 | |
| r1293 | r1294 | |
| 1659 | 1659 | static void to7_network_got_frame( UINT8* data, int length ) |
| 1660 | 1660 | { |
| 1661 | 1661 | int i; |
| 1662 | LOG(( "%f to7_network_got_frame:", | |
| 1662 | LOG(( "%f to7_network_got_frame:", | |
| 1663 | 1663 | for ( i = 0; i < length; i++ ) |
| 1664 | 1664 | LOG(( " $%02X", data[i] )); |
| 1665 | 1665 | LOG(( "\n" )); |
| r1293 | r1294 | |
| 1667 | 1667 | if ( data[1] == 0xff ) |
| 1668 | 1668 | { |
| 1669 | 1669 | LOG(( "to7_network_got_frame: %i phones %i\n", data[2], data[0] )); |
| 1670 | | |
| 1670 | | |
| 1671 | 1671 | mc6854_set_cts( 0 ); |
| 1672 | 1672 | } |
| 1673 | 1673 | else if ( ! data[1] ) |
| r1293 | r1294 | |
| 1721 | 1721 | { |
| 1722 | 1722 | /* network ID of the computer */ |
| 1723 | 1723 | UINT8 id = readinputport( THOM_INPUT_FCONFIG ) >> 3; |
| 1724 | VLOG(( "%f $%04x to7_network_r: read id $%02X\n", | |
| 1724 | VLOG(( "%f $%04x to7_network_r: read id $%02X\n", | |
| 1725 | 1725 | return id; |
| 1726 | 1726 | } |
| 1727 | 1727 | |
| 1728 | logerror( "%f $%04x to7_network_r: invalid read offset %i\n", | |
| 1728 | logerror( "%f $%04x to7_network_r: invalid read offset %i\n", | |
| 1729 | 1729 | return 0; |
| 1730 | 1730 | } |
| 1731 | 1731 | |
| r1293 | r1294 | |
| 1738 | 1738 | else |
| 1739 | 1739 | { |
| 1740 | 1740 | logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n", |
| 1741 | | |
| 1741 | | |
| 1742 | 1742 | } |
| 1743 | 1743 | } |
| 1744 | 1744 |
| r1293 | r1294 | |
|---|---|---|
| 63 | 63 | |
| 64 | 64 | delay = device_get_info_double(&si->dev->devclass, DEVINFO_FLOAT_SNAPSHOT_DELAY); |
| 65 | 65 | |
| 66 | | |
| 66 | | |
| 67 | 67 | return INIT_PASS; |
| 68 | 68 | } |
| 69 | 69 |
| r1293 | r1294 | |
|---|---|---|
| 56 | 56 | messtest_command_type_t command_type; |
| 57 | 57 | union |
| 58 | 58 | { |
| 59 | | |
| 59 | | |
| 60 | 60 | struct |
| 61 | 61 | { |
| 62 | 62 | const char *input_chars; |
| 63 | | |
| 63 | | |
| 64 | 64 | } input_args; |
| 65 | 65 | struct |
| 66 | 66 | { |
| r1293 | r1294 | |
| 93 | 93 | const char *name; |
| 94 | 94 | const char *bios; |
| 95 | 95 | const char *driver; |
| 96 | | |
| 96 | | |
| 97 | 97 | struct messtest_command *commands; |
| 98 | 98 | |
| 99 | 99 | /* options */ |
| r1293 | r1294 | |
| 129 | 129 | |
| 130 | 130 | static messtest_running_state_t state; |
| 131 | 131 | static int had_failure; |
| 132 | static mame_time wait_target; | |
| 133 | static mame_time final_time; | |
| 132 | static attotime wait_target; | |
| 133 | static attotime final_time; | |
| 134 | 134 | static const struct messtest_command *current_command; |
| 135 | 135 | static int test_flags; |
| 136 | 136 | static int screenshot_num; |
| r1293 | r1294 | |
| 362 | 362 | if (had_failure) |
| 363 | 363 | { |
| 364 | 364 | report_message(MSG_FAILURE, "Test failed (real time %.2f; emu time %.2f [%i%%])", |
| 365 | real_run_time, | |
| 365 | real_run_time, | |
| 366 | 366 | rc = MESSTEST_RESULT_RUNTIMEFAILURE; |
| 367 | 367 | } |
| 368 | 368 | else |
| 369 | 369 | { |
| 370 | 370 | report_message(MSG_INFO, "Test succeeded (real time %.2f; emu time %.2f [%i%%])", |
| 371 | real_run_time, | |
| 371 | real_run_time, | |
| 372 | 372 | rc = MESSTEST_RESULT_SUCCESS; |
| 373 | 373 | } |
| 374 | 374 | break; |
| r1293 | r1294 | |
| 492 | 492 | |
| 493 | 493 | static void command_wait(void) |
| 494 | 494 | { |
| 495 | | |
| 495 | | |
| 496 | 496 | |
| 497 | 497 | if (state == STATE_READY) |
| 498 | 498 | { |
| 499 | 499 | /* beginning a wait command */ |
| 500 | wait_target = a | |
| 500 | wait_target = a | |
| 501 | 501 | state = STATE_INCOMMAND; |
| 502 | 502 | } |
| 503 | 503 | else |
| 504 | 504 | { |
| 505 | 505 | /* during a wait command */ |
| 506 | state = (compare | |
| 506 | state = (attotime_compare | |
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | 509 | |
| r1293 | r1294 | |
| 536 | 536 | static void command_rawinput(void) |
| 537 | 537 | { |
| 538 | 538 | int parts; |
| 539 | | |
| 539 | | |
| 540 | 540 | static const char *position; |
| 541 | 541 | #if 0 |
| 542 | 542 | int i; |
| 543 | double rate = | |
| 543 | double rate = | |
| 544 | 544 | const char *s; |
| 545 | 545 | char buf[256]; |
| 546 | 546 | #endif |
| r1293 | r1294 | |
| 553 | 553 | wait_target = current_time; |
| 554 | 554 | state = STATE_INCOMMAND; |
| 555 | 555 | } |
| 556 | else if (compare | |
| 556 | else if (attotime_compare | |
| 557 | 557 | { |
| 558 | 558 | #if 0 |
| 559 | 559 | do |
| r1293 | r1294 | |
| 944 | 944 | { |
| 945 | 945 | /* at the end of our test */ |
| 946 | 946 | state = STATE_DONE; |
| 947 | final_time = | |
| 947 | final_time = | |
| 948 | 948 | mame_schedule_exit(Machine); |
| 949 | 949 | } |
| 950 | 950 | |
| r1293 | r1294 | |
| 980 | 980 | void osd_update(int skip_redraw) |
| 981 | 981 | { |
| 982 | 982 | int i; |
| 983 | mame_time time_limit; | |
| 984 | mame_time current_time; | |
| 983 | attotime time_limit; | |
| 984 | attotime current_time; | |
| 985 | 985 | int cpunum; |
| 986 | 986 | |
| 987 | 987 | render_target_get_primitives(target); |
| r1293 | r1294 | |
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | /* have we hit the time limit? */ |
| 1004 | current_time = mame_timer_get_time(); | |
| 1005 | time_limit = (compare_mame_times(current_testcase.time_limit, time_zero) != 0) ? current_testcase.time_limit | |
| 1006 | : MAME_TIME_IN_SEC(600); | |
| 1007 | if (compare_mame_times(current_time, time_limit) > 0) | |
| 1004 | current_time = timer_get_time(); | |
| 1005 | time_limit = (attotime_compare(current_testcase.time_limit, attotime_zero) != 0) ? current_testcase.time_limit | |
| 1006 | : ATTOTIME_IN_SEC(600); | |
| 1007 | if (attotime_compare(current_time, time_limit) > 0) | |
| 1008 | 1008 | { |
| 1009 | 1009 | state = STATE_ABORTED; |
| 1010 | 1010 | report_message(MSG_FAILURE, "Time limit of %.2f seconds exceeded", time_limit); |
| r1293 | r1294 | |
| 1158 | 1158 | { |
| 1159 | 1159 | /* <input> - inputs natural keyboard data into a system */ |
| 1160 | 1160 | xml_attribute_node *attr_node; |
| 1161 | | |
| 1161 | | |
| 1162 | 1162 | |
| 1163 | 1163 | memset(&new_command, 0, sizeof(new_command)); |
| 1164 | 1164 | new_command.command_type = MESSTEST_COMMAND_INPUT; |
| 1165 | 1165 | attr_node = xml_get_attribute(node, "rate"); |
| 1166 | rate = attr_node ? parse_time(attr_node->value) : | |
| 1166 | rate = attr_node ? parse_time(attr_node->value) : | |
| 1167 | 1167 | new_command.u.input_args.rate = rate; |
| 1168 | 1168 | new_command.u.input_args.input_chars = node->value; |
| 1169 | 1169 |
| r1293 | r1294 | |
|---|---|---|
| 609 | 609 | /* if ((msgtype == MSG_FAILURE) && (state != STATE_ABORTED)) |
| 610 | 610 | { |
| 611 | 611 | state = STATE_ABORTED; |
| 612 | final_time = | |
| 612 | final_time = | |
| 613 | 613 | if (final_time > 0.0) |
| 614 | 614 | dump_screenshot(); |
| 615 | 615 | } |
| r1293 | r1294 | |
|---|---|---|
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | |
| 88 | ||
| 88 | ||
| 89 | 89 | { |
| 90 | 90 | double d = atof(s); |
| 91 | return double_to_ | |
| 91 | return double_to_ | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 |
| r1293 | r1294 | |
|---|---|---|
| 66 | 66 | int memory_region_from_string(const char *region_name); |
| 67 | 67 | const char *memory_region_to_string(int region); |
| 68 | 68 | const char *find_attribute(const char **attributes, const char *seek_attribute); |
| 69 | ||
| 69 | ||
| 70 | 70 | offs_t parse_offset(const char *s); |
| 71 | 71 | |
| 72 | 72 | /* reporting */ |
| r1293 | r1294 | |
|---|---|---|
| 110 | 110 | UINT16 last_pitch, pitch; /* pitch of sawtooth signal, in Hz */ |
| 111 | 111 | UINT8 noise; |
| 112 | 112 | |
| 113 | | |
| 113 | | |
| 114 | 114 | |
| 115 | 115 | } mea8000; |
| 116 | 116 | |
| r1293 | r1294 | |
| 133 | 133 | #define SUPERSAMPLING 8 |
| 134 | 134 | |
| 135 | 135 | /* actual output pediod */ |
| 136 | #define SAMPLING | |
| 136 | #define SAMPLING | |
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | |
| r1293 | r1294 | |
| 457 | 457 | static void mea8000_start_frame( void ) |
| 458 | 458 | { |
| 459 | 459 | /* enter or stay in active mode */ |
| 460 | | |
| 460 | | |
| 461 | 461 | mea8000.framepos = 0; |
| 462 | 462 | } |
| 463 | 463 | |
| r1293 | r1294 | |
| 466 | 466 | static void mea8000_stop_frame( void ) |
| 467 | 467 | { |
| 468 | 468 | /* enter stop mode */ |
| 469 | | |
| 469 | | |
| 470 | 470 | mea8000.state = MEA8000_STOPPED; |
| 471 | 471 | DAC_signed_data_16_w(mea8000.channel, 0); |
| 472 | 472 | } |
| r1293 | r1294 | |
| 502 | 502 | if (mea8000.bufpos == 4) |
| 503 | 503 | { |
| 504 | 504 | /* we have a successor */ |
| 505 | LOG(( "%f mea8000_timer_expire: new frame\n", | |
| 505 | LOG(( "%f mea8000_timer_expire: new frame\n", | |
| 506 | 506 | mea8000_decode_frame(); |
| 507 | 507 | mea8000_start_frame(); |
| 508 | 508 | } |
| 509 | 509 | else if (mea8000.cont) |
| 510 | 510 | { |
| 511 | 511 | /* repeat mode */ |
| 512 | LOG(( "%f mea8000_timer_expire: repeat frame\n", | |
| 512 | LOG(( "%f mea8000_timer_expire: repeat frame\n", | |
| 513 | 513 | mea8000_start_frame(); |
| 514 | 514 | } |
| 515 | 515 | /* slow stop */ |
| 516 | 516 | else if (mea8000.state == MEA8000_STARTED) |
| 517 | 517 | { |
| 518 | 518 | mea8000.ampl = 0; |
| 519 | LOG(( "%f mea8000_timer_expire: fade frame\n", | |
| 519 | LOG(( "%f mea8000_timer_expire: fade frame\n", | |
| 520 | 520 | mea8000_start_frame(); |
| 521 | 521 | mea8000.state = MEA8000_SLOWING; |
| 522 | 522 | } |
| 523 | 523 | else if (mea8000.state == MEA8000_SLOWING) |
| 524 | 524 | { |
| 525 | LOG(( "%f mea8000_timer_expire: stop frame\n", | |
| 525 | LOG(( "%f mea8000_timer_expire: stop frame\n", | |
| 526 | 526 | mea8000_stop_frame(); |
| 527 | 527 | } |
| 528 | 528 | mea8000_update_req(); |
| r1293 | r1294 | |
| 530 | 530 | else |
| 531 | 531 | { |
| 532 | 532 | /* continue frame */ |
| 533 | | |
| 533 | | |
| 534 | 534 | } |
| 535 | 535 | } |
| 536 | 536 | |
| r1293 | r1294 | |
| 549 | 549 | case 1: |
| 550 | 550 | /* ready to accept next frame */ |
| 551 | 551 | #if 0 |
| 552 | LOG(( "$%04x %f: mea8000_r ready=%i\n", activecpu_get_previouspc(), | |
| 552 | LOG(( "$%04x %f: mea8000_r ready=%i\n", activecpu_get_previouspc(), | |
| 553 | 553 | #endif |
| 554 | 554 | return mea8000_accept_byte() << 7; |
| 555 | 555 | |
| r1293 | r1294 | |
| 569 | 569 | { |
| 570 | 570 | /* got pitch byte before first frame */ |
| 571 | 571 | mea8000.pitch = 2 * data; |
| 572 | LOG(( "$%04x %f: mea8000_w pitch %i\n", activecpu_get_previouspc(), | |
| 572 | LOG(( "$%04x %f: mea8000_w pitch %i\n", activecpu_get_previouspc(), | |
| 573 | 573 | mea8000.state = MEA8000_WAIT_FIRST; |
| 574 | 574 | mea8000.bufpos = 0; |
| 575 | 575 | } |
| 576 | 576 | else if (mea8000.bufpos == 4) |
| 577 | 577 | { |
| 578 | 578 | /* overflow */ |
| 579 | LOG(( "$%04x %f: mea8000_w data overflow %02X\n", activecpu_get_previouspc(), | |
| 579 | LOG(( "$%04x %f: mea8000_w data overflow %02X\n", activecpu_get_previouspc(), | |
| 580 | 580 | } |
| 581 | 581 | else |
| 582 | 582 | { |
| 583 | 583 | /* enqueue frame byte */ |
| 584 | LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", activecpu_get_previouspc(), | |
| 584 | LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", activecpu_get_previouspc(), | |
| 585 | 585 | data, mea8000.bufpos )); |
| 586 | 586 | mea8000.buf[mea8000.bufpos] = data; |
| 587 | 587 | mea8000.bufpos++; |
| r1293 | r1294 | |
| 615 | 615 | mea8000_stop_frame(); |
| 616 | 616 | |
| 617 | 617 | LOG(( "$%04x %f: mea8000_w command %02X stop=%i cont=%i roe=%i\n", |
| 618 | activecpu_get_previouspc(), | |
| 618 | activecpu_get_previouspc(), | |
| 619 | 619 | stop, mea8000.cont, mea8000.roe )); |
| 620 | 620 | |
| 621 | 621 | mea8000_update_req(); |
| r1293 | r1294 | |
| 637 | 637 | { |
| 638 | 638 | int i; |
| 639 | 639 | LOG (( "mea8000_reset\n" )); |
| 640 | | |
| 640 | | |
| 641 | 641 | mea8000.phi = 0; |
| 642 | 642 | mea8000.cont = 0; |
| 643 | 643 | mea8000.roe = 0; |
| r1293 | r1294 | |
| 663 | 663 | mea8000_init_tables(); |
| 664 | 664 | mea8000.channel = channel; |
| 665 | 665 | mea8000.req_out_func = req_out_func; |
| 666 | mea8000.timer = | |
| 666 | mea8000.timer = | |
| 667 | 667 | |
| 668 | 668 | state_save_register_item( "mea8000", 0, mea8000.state ); |
| 669 | 669 | state_save_register_item_array( "mea8000", 0, mea8000.buf ); |
| r1293 | r1294 | |
|---|---|---|
| 167 | 167 | dave.one_khz_state = 0; |
| 168 | 168 | dave.fifty_hz_count = DAVE_FIFTY_HZ_COUNTER_RELOAD; |
| 169 | 169 | dave.one_hz_count = DAVE_ONE_HZ_COUNTER_RELOAD; |
| 170 | | |
| 170 | | |
| 171 | 171 | |
| 172 | 172 | for (i=0; i<3; i++) |
| 173 | 173 | { |
| r1293 | r1294 | |
|---|---|---|
| 101 | 101 | void c364_speech_init(void) |
| 102 | 102 | { |
| 103 | 103 | memset(&speech, 0, sizeof(speech)); |
| 104 | speech.timer = | |
| 104 | speech.timer = | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | WRITE8_HANDLER(c364_speech_w) |
| r1293 | r1294 | |
| 117 | 117 | speech.playing=FALSE; |
| 118 | 118 | break; |
| 119 | 119 | case 1: /* start */ |
| 120 | | |
| 120 | | |
| 121 | 121 | speech.playing=TRUE; |
| 122 | 122 | speech.endOfSample=FALSE; |
| 123 | 123 | speech.sampleindex=0; |
| r1293 | r1294 | |
| 125 | 125 | case 2: |
| 126 | 126 | speech.endOfSample=FALSE; |
| 127 | 127 | /*speech.busy=FALSE; */ |
| 128 | | |
| 128 | | |
| 129 | 129 | speech.playing=FALSE; |
| 130 | 130 | break; |
| 131 | 131 | case 5: /* set rate (in next nibble) */ |
| r1293 | r1294 | |
|---|---|---|
| 219 | 219 | |
| 220 | 220 | void lynx_audio_write(int offset, UINT8 data) |
| 221 | 221 | { |
| 222 | // logerror("%.6f audio write %.2x %.2x\n", | |
| 222 | // logerror("%.6f audio write %.2x %.2x\n", | |
| 223 | 223 | LYNX_AUDIO *channel=lynx_audio+((offset>>3)&3); |
| 224 | 224 | stream_update(mixer_channel); |
| 225 | 225 | switch (offset) { |
| r1293 | r1294 | |
|---|---|---|
| 22 | 22 | |
| 23 | 23 | WRITE8_HANDLER( svision_sounddma_w ) |
| 24 | 24 | { |
| 25 | logerror("%.6f svision snddma write %04x %02x\n", | |
| 25 | logerror("%.6f svision snddma write %04x %02x\n", | |
| 26 | 26 | svision_dma.reg[offset] = data; |
| 27 | 27 | switch (offset) |
| 28 | 28 | { |
| r1293 | r1294 | |
| 51 | 51 | |
| 52 | 52 | WRITE8_HANDLER( svision_noise_w ) |
| 53 | 53 | { |
| 54 | // logerror("%.6f svision noise write %04x %02x\n", | |
| 54 | // logerror("%.6f svision noise write %04x %02x\n", | |
| 55 | 55 | svision_noise.reg[offset]=data; |
| 56 | 56 | switch (offset) |
| 57 | 57 | { |
| r1293 | r1294 | |
|---|---|---|
| 561 | 561 | goto done; |
| 562 | 562 | |
| 563 | 563 | /* do we need to reset the CPU? */ |
| 564 | if (( | |
| 564 | if (( | |
| 565 | 565 | mame_schedule_hard_reset(Machine); |
| 566 | 566 | |
| 567 | 567 | /* determine open plan */ |
| r1293 | r1294 | |
|---|---|---|
| 32 | 32 | { \ |
| 33 | 33 | if(LEVEL>=N) { \ |
| 34 | 34 | if( M ) \ |
| 35 | logerror("%11.6f: %-24s", | |
| 35 | logerror("%11.6f: %-24s", | |
| 36 | 36 | logerror A; \ |
| 37 | 37 | } \ |
| 38 | 38 | } |
| r1293 | r1294 | |
|---|---|---|
| 19 | 19 | void zx_ula_bkgnd(int color); |
| 20 | 20 | int zx_ula_r(int offs, int region); |
| 21 | 21 | |
| 22 | extern | |
| 22 | extern | |
| 23 | 23 | extern int ula_irq_active; |
| 24 | 24 | extern int ula_nmi_active; |
| 25 | 25 | extern int ula_frame_vsync; |
| r1293 | r1294 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | #define COCO_CPU_SPEED_HZ 894886 /* 0.894886 MHz */ |
| 16 | 16 | #define COCO_FRAMES_PER_SECOND (COCO_CPU_SPEED_HZ / 57.0 / 263) |
| 17 | #define COCO_CPU_SPEED ( | |
| 17 | #define COCO_CPU_SPEED ( | |
| 18 | 18 | #define COCO_TIMER_CMPCARRIER (COCO_CPU_SPEED * 0.25) |
| 19 | 19 | |
| 20 | 20 | /* ----------------------------------------------------------------------- * |
| r1293 | r1294 | |
|---|---|---|
| 17 | 17 | extern UINT32 vectrex_beam_color; |
| 18 | 18 | extern unsigned char vectrex_via_out[2]; |
| 19 | 19 | extern double imager_freq; |
| 20 | extern | |
| 20 | extern | |
| 21 | 21 | extern int vectrex_lightpen_port; |
| 22 | 22 | extern UINT8 *vectrex_ram_base; |
| 23 | 23 | extern size_t vectrex_ram_size; |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | void apple1_vh_dsp_w (int data); |
| 18 | 18 | void apple1_vh_dsp_clr (void); |
| 19 | ||
| 19 | ||
| 20 | 20 | |
| 21 | 21 | extern int apple1_vh_clrscrn_pressed; |
| 22 | 22 |
| r1293 | r1294 | |
|---|---|---|
| 46 | 46 | int forme; /* i am selected */ |
| 47 | 47 | int last; /* last byte to be sent */ |
| 48 | 48 | int broadcast; /* sent to all */ |
| 49 | | |
| 49 | | |
| 50 | 50 | } |
| 51 | 51 | serial; |
| 52 | 52 | struct |
| r1293 | r1294 | |
|---|---|---|
| 22 | 22 | #include "includes/zx.h" |
| 23 | 23 | #include "sound/dac.h" |
| 24 | 24 | |
| 25 | mame_timer *ula_nmi = NULL; | |
| 26 | mame_timer *ula_irq = NULL; | |
| 25 | emu_timer *ula_nmi = NULL; | |
| 26 | emu_timer *ula_irq = NULL; | |
| 27 | 27 | int ula_nmi_active, ula_irq_active; |
| 28 | 28 | int ula_frame_vsync = 0; |
| 29 | 29 | int ula_scancode_count = 0; |
| r1293 | r1294 | |
| 145 | 145 | y = video_screen_get_vpos(0); |
| 146 | 146 | |
| 147 | 147 | cycles = 4 * (64 - (rreg & 63)); |
| 148 | | |
| 148 | | |
| 149 | 149 | ula_irq_active = 1; |
| 150 | 150 | scanline = BITMAP_ADDR16(bitmap, y, 0); |
| 151 | 151 | |
| r1293 | r1294 | |
| 185 | 185 | |
| 186 | 186 | VIDEO_START( zx ) |
| 187 | 187 | { |
| 188 | ula_nmi = | |
| 188 | ula_nmi = | |
| 189 | 189 | ula_irq_active = 0; |
| 190 | 190 | video_start_generic_bitmapped(machine); |
| 191 | 191 | } |
| r1293 | r1294 | |
|---|---|---|
| 257 | 257 | case 6: /*lightpen horicontal */ |
| 258 | 258 | case 7: /*lightpen vertical */ |
| 259 | 259 | if (LIGHTPEN_BUTTON |
| 260 | && (( | |
| 260 | && (( | |
| 261 | 261 | { |
| 262 | 262 | /* only 1 update each frame */ |
| 263 | 263 | /* and diode must recognize light */ |
| r1293 | r1294 | |
| 266 | 266 | vic6560[6] = VIC6560_X_VALUE; |
| 267 | 267 | vic6560[7] = VIC6560_Y_VALUE; |
| 268 | 268 | } |
| 269 | lightpenreadtime = | |
| 269 | lightpenreadtime = | |
| 270 | 270 | } |
| 271 | 271 | val = vic6560[offset]; |
| 272 | 272 | break; |
| r1293 | r1294 | |
|---|---|---|
| 237 | 237 | else |
| 238 | 238 | vdt[unit].cursor_address_mask = 0x7ff; /* 2 kb of RAM */ |
| 239 | 239 | |
| 240 | | |
| 240 | | |
| 241 | 241 | |
| 242 | 242 | /* set up cursor blink clock. 2Hz frequency -> .25s half-period. */ |
| 243 | /*vdt[unit].blink_clock =*/ | |
| 243 | /*vdt[unit].blink_clock =*/ | |
| 244 | 244 | |
| 245 | 245 | /* alloc beep timer */ |
| 246 | vdt[unit].beep_timer = | |
| 246 | vdt[unit].beep_timer = | |
| 247 | 247 | |
| 248 | 248 | return 0; |
| 249 | 249 | } |
| r1293 | r1294 | |
| 444 | 444 | /* beep enable strobe - not tested */ |
| 445 | 445 | beep_set_state(unit, 1); |
| 446 | 446 | |
| 447 | | |
| 447 | | |
| 448 | 448 | break; |
| 449 | 449 | |
| 450 | 450 | case 0xf: |
| r1293 | r1294 | |
|---|---|---|
| 89 | 89 | int mode_irq; |
| 90 | 90 | int delayed_line_irq; |
| 91 | 91 | struct layer_struct layer[2]; |
| 92 | | |
| 92 | | |
| 93 | 93 | } gb_lcd; |
| 94 | 94 | |
| 95 | 95 | void (*update_scanline)(void); |
| r1293 | r1294 | |
| 320 | 320 | /* Make sure we're in mode 3 */ |
| 321 | 321 | if ( ( LCDSTAT & 0x03 ) == 0x03 ) { |
| 322 | 322 | /* Calculate number of pixels to render based on time still left on the timer */ |
| 323 | UINT32 cycles_to_go = | |
| 323 | UINT32 cycles_to_go = | |
| 324 | 324 | int l = 0; |
| 325 | 325 | |
| 326 | 326 | if ( gb_lcd.start_x == 0 ) { |
| r1293 | r1294 | |
| 603 | 603 | |
| 604 | 604 | if ( ( LCDSTAT & 0x03 ) == 0x03 ) { |
| 605 | 605 | /* Calcuate number of pixels to render based on time still left on the timer */ |
| 606 | UINT32 cycles_to_go = | |
| 606 | UINT32 cycles_to_go = | |
| 607 | 607 | int l = 0; |
| 608 | 608 | |
| 609 | 609 | if ( gb_lcd.start_x == 0 ) { |
| r1293 | r1294 | |
| 866 | 866 | |
| 867 | 867 | if ( ( LCDSTAT & 0x03 ) == 0x03 ) { |
| 868 | 868 | /* Calcuate number of pixels to render based on time still left on the timer */ |
| 869 | UINT32 cycles_to_go = | |
| 869 | UINT32 cycles_to_go = | |
| 870 | 870 | int l = 0; |
| 871 | 871 | |
| 872 | 872 | if ( gb_lcd.start_x == 0 ) { |
| r1293 | r1294 | |
| 1049 | 1049 | /* set the scanline update function */ |
| 1050 | 1050 | update_scanline = gb_update_scanline; |
| 1051 | 1051 | |
| 1052 | gb_lcd.lcd_timer = mame_timer_alloc( gb_lcd_timer_proc ); | |
| 1053 | mame_timer_adjust( gb_lcd.lcd_timer, MAME_TIME_IN_CYCLES(456,0), 0, time_never ); | |
| 1052 | gb_lcd.lcd_timer = timer_alloc( gb_lcd_timer_proc ); | |
| 1053 | timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(456,0), 0, attotime_never ); | |
| 1054 | 1054 | } |
| 1055 | 1055 | |
| 1056 | 1056 | void sgb_video_init( void ) { |
| r1293 | r1294 | |
| 1178 | 1178 | /* Check for HBLANK DMA */ |
| 1179 | 1179 | if( gbc_hdma_enabled ) |
| 1180 | 1180 | gbc_hdma(0x10); |
| 1181 | | |
| 1181 | | |
| 1182 | 1182 | break; |
| 1183 | 1183 | case GB_LCD_STATE_LYXX_M0_PRE_INC: /* Just before incrementing the line counter go to mode 2 internally */ |
| 1184 | 1184 | if ( CURLINE < 143 ) { |
| r1293 | r1294 | |
| 1190 | 1190 | } |
| 1191 | 1191 | } |
| 1192 | 1192 | } |
| 1193 | | |
| 1193 | | |
| 1194 | 1194 | break; |
| 1195 | 1195 | case GB_LCD_STATE_LYXX_M0_INC: /* Increment LY, stay in M0 for 4 more cycles */ |
| 1196 | 1196 | gb_increment_scanline(); |
| r1293 | r1294 | |
| 1203 | 1203 | LCDSTAT &= 0xFB; |
| 1204 | 1204 | /* Check if we're going into VBlank next */ |
| 1205 | 1205 | if ( CURLINE == 144 ) { |
| 1206 | | |
| 1206 | | |
| 1207 | 1207 | } else { |
| 1208 | 1208 | /* Internally switch to mode 2 */ |
| 1209 | 1209 | gb_lcd.mode = 2; |
| r1293 | r1294 | |
| 1215 | 1215 | } else { |
| 1216 | 1216 | gb_lcd.mode_irq = 0; |
| 1217 | 1217 | } |
| 1218 | | |
| 1218 | | |
| 1219 | 1219 | } |
| 1220 | 1220 | break; |
| 1221 | 1221 | case GB_LCD_STATE_LY00_M2: /* Switch to mode 2 on line #0 */ |
| r1293 | r1294 | |
| 1227 | 1227 | cpunum_set_input_line( 0, LCD_INT, HOLD_LINE ); |
| 1228 | 1228 | } |
| 1229 | 1229 | /* Mode 2 lasts approximately 80 clock cycles */ |
| 1230 | | |
| 1230 | | |
| 1231 | 1231 | break; |
| 1232 | 1232 | case GB_LCD_STATE_LYXX_M2: /* Switch to mode 2 */ |
| 1233 | 1233 | /* Update STAT register to the correct state */ |
| r1293 | r1294 | |
| 1242 | 1242 | LCDSTAT |= 0x04; |
| 1243 | 1243 | } |
| 1244 | 1244 | /* Mode 2 last for approximately 80 clock cycles */ |
| 1245 | | |
| 1245 | | |
| 1246 | 1246 | break; |
| 1247 | 1247 | case GB_LCD_STATE_LYXX_M3: /* Switch to mode 3 */ |
| 1248 | 1248 | gb_select_sprites(); |
| r1293 | r1294 | |
| 1250 | 1250 | gb_lcd.mode = 3; |
| 1251 | 1251 | LCDSTAT = (LCDSTAT & 0xFC) | 0x03; |
| 1252 | 1252 | /* Mode 3 lasts for approximately 172+#sprites*10 clock cycles */ |
| 1253 | | |
| 1253 | | |
| 1254 | 1254 | gb_lcd.start_x = 0; |
| 1255 | 1255 | break; |
| 1256 | 1256 | case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ |
| r1293 | r1294 | |
| 1269 | 1269 | if ( CURLINE == CMPLINE ) { |
| 1270 | 1270 | LCDSTAT |= 0x04; |
| 1271 | 1271 | } |
| 1272 | | |
| 1272 | | |
| 1273 | 1273 | break; |
| 1274 | 1274 | case GB_LCD_STATE_LY9X_M1_INC: /* Increment scanline counter */ |
| 1275 | 1275 | gb_increment_scanline(); |
| r1293 | r1294 | |
| 1281 | 1281 | /* Reset LY==LYC STAT bit */ |
| 1282 | 1282 | LCDSTAT &= 0xFB; |
| 1283 | 1283 | if ( gb_lcd.current_line == 153 ) { |
| 1284 | | |
| 1284 | | |
| 1285 | 1285 | } else { |
| 1286 | | |
| 1286 | | |
| 1287 | 1287 | } |
| 1288 | 1288 | break; |
| 1289 | 1289 | case GB_LCD_STATE_LY00_M1: /* we stay in VBlank but current line counter should already be incremented */ |
| r1293 | r1294 | |
| 1304 | 1304 | // cpunum_set_input_line( 0, LCD_INT, HOLD_LINE ); |
| 1305 | 1305 | // } |
| 1306 | 1306 | LCDSTAT &= 0xFB; |
| 1307 | | |
| 1307 | | |
| 1308 | 1308 | break; |
| 1309 | 1309 | case GB_LCD_STATE_LY00_M1_1: |
| 1310 | 1310 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.line_irq ) { |
| 1311 | 1311 | cpunum_set_input_line( 0, LCD_INT, HOLD_LINE ); |
| 1312 | 1312 | } |
| 1313 | | |
| 1313 | | |
| 1314 | 1314 | break; |
| 1315 | 1315 | case GB_LCD_STATE_LY00_M1_2: /* Rest of line #0 during VBlank */ |
| 1316 | 1316 | if ( gb_lcd.delayed_line_irq && gb_lcd.line_irq ) { |
| r1293 | r1294 | |
| 1319 | 1319 | if ( CURLINE == CMPLINE ) { |
| 1320 | 1320 | LCDSTAT |= 0x04; |
| 1321 | 1321 | } |
| 1322 | | |
| 1322 | | |
| 1323 | 1323 | break; |
| 1324 | 1324 | case GB_LCD_STATE_LY00_M0: /* The STAT register seems to go to 0 for about 4 cycles */ |
| 1325 | 1325 | /* Set Mode 0 lcdstat */ |
| 1326 | 1326 | gb_lcd.mode = 0; |
| 1327 | 1327 | LCDSTAT = ( LCDSTAT & 0xFC ); |
| 1328 | | |
| 1328 | | |
| 1329 | 1329 | break; |
| 1330 | 1330 | } |
| 1331 | 1331 | } else { |
| r1293 | r1294 | |
| 1333 | 1333 | if ( gb_lcd.current_line < 144 ) { |
| 1334 | 1334 | update_scanline(); |
| 1335 | 1335 | } |
| 1336 | | |
| 1336 | | |
| 1337 | 1337 | } |
| 1338 | 1338 | } |
| 1339 | 1339 | |
| r1293 | r1294 | |
| 1352 | 1352 | cpunum_set_input_line( 0, LCD_INT, HOLD_LINE ); |
| 1353 | 1353 | } |
| 1354 | 1354 | } |
| 1355 | | |
| 1355 | | |
| 1356 | 1356 | } |
| 1357 | 1357 | |
| 1358 | 1358 | /* Make sure the video information is up to date */ |
| 1359 | 1359 | void gb_video_up_to_date( void ) { |
| 1360 | | |
| 1360 | | |
| 1361 | 1361 | } |
| 1362 | 1362 | |
| 1363 | 1363 | READ8_HANDLER( gb_video_r ) { |
| 1364 | 1364 | // if ( 0 && activecpu_get_pc() > 0x100 ) { |
| 1365 | // logerror("LCDSTAT/LY read, cycles left is %d\n", (int) | |
| 1365 | // logerror("LCDSTAT/LY read, cycles left is %d\n", (int) | |
| 1366 | 1366 | // } |
| 1367 | 1367 | gb_video_up_to_date(); |
| 1368 | 1368 | return gb_vid_regs[offset]; |
| r1293 | r1294 | |
|---|---|---|
| 254 | 254 | int (*get_columns)(void); |
| 255 | 255 | int (*get_sync_columns)(void); |
| 256 | 256 | |
| 257 | | |
| 257 | | |
| 258 | 258 | int retrace; |
| 259 | 259 | } monitor; |
| 260 | 260 | |
| r1293 | r1294 | |
| 670 | 670 | int clock=vga.monitor.get_clock(); |
| 671 | 671 | int lines=vga.monitor.get_lines(); |
| 672 | 672 | int columns=vga.monitor.get_columns(); |
| 673 | int diff = ( | |
| 673 | int diff = ( | |
| 674 | 674 | %(lines*columns); |
| 675 | 675 | if (diff<columns*vga.monitor.get_sync_lines()) data|=8; |
| 676 | 676 | diff=diff/lines; |
| r1293 | r1294 | |
| 680 | 680 | if (vga.monitor.retrace) |
| 681 | 681 | { |
| 682 | 682 | data |= 1; |
| 683 | if (compare | |
| 683 | if (attotime_compare( | |
| 684 | 684 | { |
| 685 | 685 | data |= 8; |
| 686 | 686 | vga.monitor.retrace=0; |
| r1293 | r1294 | |
| 688 | 688 | } |
| 689 | 689 | else |
| 690 | 690 | { |
| 691 | if (compare | |
| 691 | if (attotime_compare( | |
| 692 | 692 | vga.monitor.retrace=1; |
| 693 | vga.monitor.start_time= | |
| 693 | vga.monitor.start_time= | |
| 694 | 694 | } |
| 695 | 695 | #else |
| 696 | 696 | // not working with ps2m30 |
| r1293 | r1294 | |
| 945 | 945 | vga_cpu_interface(); |
| 946 | 946 | |
| 947 | 947 | if (vga.sequencer.index == 0) |
| 948 | vga.monitor.start_time = | |
| 948 | vga.monitor.start_time = | |
| 949 | 949 | } |
| 950 | 950 | break; |
| 951 | 951 | case 6: |
| r1293 | r1294 | |
| 1180 | 1180 | vga.monitor.get_columns = ega_get_crtc_columns; |
| 1181 | 1181 | vga.monitor.get_sync_lines = vga_get_crtc_sync_lines; |
| 1182 | 1182 | vga.monitor.get_sync_columns = vga_get_crtc_sync_columns; |
| 1183 | | |
| 1183 | | |
| 1184 | 1184 | pc_video_start(NULL, pc_ega_choosevideomode, 0); |
| 1185 | 1185 | } |
| 1186 | 1186 | |
| r1293 | r1294 | |
| 1195 | 1195 | vga.monitor.get_columns=vga_get_crtc_columns; |
| 1196 | 1196 | vga.monitor.get_sync_lines=vga_get_crtc_sync_lines; |
| 1197 | 1197 | vga.monitor.get_sync_columns=vga_get_crtc_sync_columns; |
| 1198 | | |
| 1198 | | |
| 1199 | 1199 | pc_video_start(NULL, pc_vga_choosevideomode, 0); |
| 1200 | 1200 | } |
| 1201 | 1201 |
| r1293 | r1294 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | #if VERBOSE |
| 19 | 19 | #define LOG(N,M,A) \ |
| 20 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 20 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 21 | 21 | #else |
| 22 | 22 | #define LOG(N,M,A) |
| 23 | 23 | #endif |
| r1293 | r1294 | |
|---|---|---|
| 44 | 44 | static int x_center, y_center, x_max, y_max; |
| 45 | 45 | static int x_int, y_int; /* X, Y integrators IC LF347*/ |
| 46 | 46 | static int lightpen_down=0, pen_x, pen_y; /* Lightpen position */ |
| 47 | static | |
| 47 | static | |
| 48 | 48 | static int blank; |
| 49 | 49 | |
| 50 | 50 | /* Analog signals: 0 : X-axis sample and hold IC LF347 |
| r1293 | r1294 | |
| 94 | 94 | newpoint->y = y; |
| 95 | 95 | newpoint->col = color; |
| 96 | 96 | newpoint->intensity = intensity; |
| 97 | newpoint->time = | |
| 97 | newpoint->time = | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /********************************************************************* |
| r1293 | r1294 | |
| 166 | 166 | vectrex_configuration(); |
| 167 | 167 | lightpen_show(); |
| 168 | 168 | |
| 169 | starttime = | |
| 169 | starttime = | |
| 170 | 170 | if (starttime < 0) starttime = 0; |
| 171 | 171 | i = vectrex_point_index; |
| 172 | 172 | |
| r1293 | r1294 | |
| 206 | 206 | { |
| 207 | 207 | if (last_point) |
| 208 | 208 | vector_add_point_function (last_point_x, last_point_y, vectrex_beam_color, |
| 209 | MIN((int)(last_point_z*(( | |
| 209 | MIN((int)(last_point_z*(( | |
| 210 | 210 | last_point = 0; |
| 211 | 211 | |
| 212 | 212 | x_int=x_center+(analog_sig[ASIG_ZR]*INT_PER_CLOCK); |
| r1293 | r1294 | |
| 221 | 221 | last_point_x = x_int; |
| 222 | 222 | last_point_y = y_int; |
| 223 | 223 | last_point_z = analog_sig[ASIG_Z] > 0? (int)(analog_sig[ASIG_Z] * z_factor): 0; |
| 224 | last_point_starttime = | |
| 224 | last_point_starttime = | |
| 225 | 225 | last_point = 1; |
| 226 | 226 | } |
| 227 | 227 | } |
| r1293 | r1294 | |
| 238 | 238 | * black (a move). */ |
| 239 | 239 | if (last_point && (!blank || !z)) |
| 240 | 240 | vector_add_point_function(last_point_x, last_point_y, vectrex_beam_color, |
| 241 | MIN((int)(last_point_z*(( | |
| 241 | MIN((int)(last_point_z*(( | |
| 242 | 242 | last_point = 0; |
| 243 | 243 | |
| 244 | 244 | x_int += (int)(length * (analog_sig[ASIG_X] - analog_sig[ASIG_ZR])); |
| r1293 | r1294 | |
| 269 | 269 | |
| 270 | 270 | imager_freq = 1; |
| 271 | 271 | |
| 272 | imager_timer = mame_timer_alloc(vectrex_imager_right_eye); | |
| 273 | mame_timer_adjust(imager_timer, MAME_TIME_IN_HZ(imager_freq), 2, MAME_TIME_IN_HZ(imager_freq)); | |
| 272 | imager_timer = timer_alloc(vectrex_imager_right_eye); | |
| 273 | timer_adjust(imager_timer, ATTOTIME_IN_HZ(imager_freq), 2, ATTOTIME_IN_HZ(imager_freq)); | |
| 274 | 274 | |
| 275 | lp_t = | |
| 275 | lp_t = | |
| 276 | 276 | |
| 277 | 277 | video_start_vector(machine); |
| 278 | 278 | } |
| r1293 | r1294 | |
| 296 | 296 | if ((vectrex_via_out[PORTB] & 0x80)) |
| 297 | 297 | { |
| 298 | 298 | /* RAMP was inactive before */ |
| 299 | start_time = | |
| 299 | start_time = | |
| 300 | 300 | |
| 301 | 301 | if (lightpen_down) |
| 302 | 302 | { |
| r1293 | r1294 | |
| 329 | 329 | +(double)(pen_y-y_int)*(pen_y-y_int); |
| 330 | 330 | d2=b2-ab*ab/a2; |
| 331 | 331 | if (d2<2e10 && analog_sig[ASIG_Z]*blank>0) |
| 332 | | |
| 332 | | |
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | } |
| r1293 | r1294 | |
| 338 | 338 | /* MUX has been enabled */ |
| 339 | 339 | /* This is a rare case used by some new games */ |
| 340 | 340 | { |
| 341 | double time_now = | |
| 341 | double time_now = | |
| 342 | 342 | vectrex_solid_line(time_now-start_time, blank); |
| 343 | 343 | start_time = time_now; |
| 344 | 344 | } |
| r1293 | r1294 | |
| 349 | 349 | if (!(vectrex_via_out[PORTB] & 0x80)) |
| 350 | 350 | { |
| 351 | 351 | /* RAMP was active before - we can draw the line */ |
| 352 | vectrex_solid_line( | |
| 352 | vectrex_solid_line( | |
| 353 | 353 | /* Cancel running timer, line already finished */ |
| 354 | 354 | if (lightpen_down) |
| 355 | | |
| 355 | | |
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | |
| r1293 | r1294 | |
| 385 | 385 | * Draw the vector with the current settings |
| 386 | 386 | * before updating the signals. |
| 387 | 387 | */ |
| 388 | time_now = | |
| 388 | time_now = | |
| 389 | 389 | vectrex_solid_line(time_now - start_time, blank); |
| 390 | 390 | start_time = time_now; |
| 391 | 391 | } |
| r1293 | r1294 | |
| 422 | 422 | /* RAMP active |
| 423 | 423 | * Take MAX because RAMP is slower than BLANK |
| 424 | 424 | */ |
| 425 | time_now = MAX( | |
| 425 | time_now = MAX( | |
| 426 | 426 | vectrex_solid_line(time_now - start_time, blank); |
| 427 | 427 | start_time = time_now; |
| 428 | 428 | } |
| r1293 | r1294 | |
|---|---|---|
| 18 | 18 | |
| 19 | 19 | UINT16 *printerRAM; |
| 20 | 20 | |
| 21 | static | |
| 21 | static | |
| 22 | 22 | static int printer_level; |
| 23 | 23 | |
| 24 | 24 | |
| r1293 | r1294 | |
| 95 | 95 | if (!data) |
| 96 | 96 | { |
| 97 | 97 | aim65_printer_cr(); |
| 98 | | |
| 98 | | |
| 99 | 99 | via_0_cb1_w(0, 0); |
| 100 | 100 | printer_level = 1; |
| 101 | 101 | } |
| 102 | 102 | else |
| 103 | | |
| 103 | | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
| r1293 | r1294 | |
| 122 | 122 | |
| 123 | 123 | VIDEO_START( aim65 ) |
| 124 | 124 | { |
| 125 | print_timer = | |
| 125 | print_timer = | |
| 126 | 126 | |
| 127 | 127 | /* |
| 128 | 128 | videoram_size = 600 * 10 * 2; |
| r1293 | r1294 | |
|---|---|---|
| 116 | 116 | void (*custom_prepare_scanline)(int scanline); |
| 117 | 117 | |
| 118 | 118 | /* timers */ |
| 119 | mame_timer *fs_rise_timer; | |
| 120 | mame_timer *fs_fall_timer; | |
| 121 | mame_timer *hs_rise_timer; | |
| 122 | mame_timer *hs_fall_timer; | |
| 119 | emu_timer *fs_rise_timer; | |
| 120 | emu_timer *fs_fall_timer; | |
| 121 | emu_timer *hs_rise_timer; | |
| 122 | emu_timer *hs_fall_timer; | |
| 123 | 123 | |
| 124 | 124 | /* things that vary according to chip version */ |
| 125 | subseconds_t clock_period; | |
| 126 | subseconds_t scanline_period; | |
| 127 | subseconds_t field_sync_period; | |
| 128 | subseconds_t horizontal_sync_period; | |
| 129 | subseconds_t vblank_period; | |
| 125 | attoseconds_t clock_period; | |
| 126 | attoseconds_t scanline_period; | |
| 127 | attoseconds_t field_sync_period; | |
| 128 | attoseconds_t horizontal_sync_period; | |
| 129 | attoseconds_t vblank_period; | |
| 130 | 130 | int top_border_scanlines; |
| 131 | 131 | int display_scanlines; |
| 132 | 132 | int bottom_border_scanlines; |
| r1293 | r1294 | |
| 1043 | 1043 | |
| 1044 | 1044 | |
| 1045 | 1045 | |
| 1046 | static const char *mame_time_string(mame_time t) | |
| 1047 | { | |
| 1048 | static char return_buffer[32]; | |
| 1049 | char subseconds_buffer[24]; | |
| 1050 | char *s; | |
| 1051 | char c; | |
| 1052 | subseconds_t subseconds; | |
| 1053 | subseconds_t max_subseconds; | |
| 1054 | ||
| 1055 | s = subseconds_buffer + sizeof(subseconds_buffer); | |
| 1056 | *(--s) = '\0'; | |
| 1057 | ||
| 1058 | subseconds = t.subseconds; | |
| 1059 | max_subseconds = MAX_SUBSECONDS; | |
| 1060 | ||
| 1061 | while(max_subseconds > 1) | |
| 1062 | { | |
| 1063 | c = (subseconds % 10) + '0'; | |
| 1064 | if ((c != '0') || s[1]) | |
| 1065 | *(--s) = c; | |
| 1066 | subseconds /= 10; | |
| 1067 | max_subseconds /= 10; | |
| 1068 | } | |
| 1069 | ||
| 1070 | if (*s == '\0') | |
| 1071 | *(--s) = '0'; | |
| 1072 | ||
| 1073 | snprintf(return_buffer, sizeof(return_buffer), "%u.%s", t.seconds, s); | |
| 1074 | return return_buffer; | |
| 1075 | } | |
| 1076 | ||
| 1077 | ||
| 1078 | ||
| 1079 | 1046 | static int attr_index_from_attribute(UINT8 attr) |
| 1080 | 1047 | { |
| 1081 | 1048 | int result; |
| r1293 | r1294 | |
| 1466 | 1433 | static int get_scanline(void) |
| 1467 | 1434 | { |
| 1468 | 1435 | int result; |
| 1469 | | |
| 1436 | | |
| 1470 | 1437 | |
| 1471 | 1438 | /* get the time since last field sync */ |
| 1472 | duration = sub_mame_times( | |
| 1473 | mame_timer_starttime(m6847->hs_rise_timer), | |
| 1474 | mame_timer_starttime(m6847->fs_rise_timer)); | |
| 1439 | duration = attotime_sub( | |
| 1440 | timer_starttime(m6847->hs_rise_timer), | |
| 1441 | timer_starttime(m6847->fs_rise_timer)); | |
| 1475 | 1442 | assert_always(duration.seconds == 0, "get_scanline(): duration exceeds one second"); |
| 1476 | 1443 | |
| 1477 | if (duration. | |
| 1444 | if (duration.attoseconds < m6847->vblank_period) | |
| 1478 | 1445 | { |
| 1479 | 1446 | result = -1; /* vblank */ |
| 1480 | 1447 | } |
| 1481 | 1448 | else |
| 1482 | 1449 | { |
| 1483 | result = (duration. | |
| 1450 | result = (duration.attoseconds - m6847->vblank_period) | |
| 1484 | 1451 | / m6847->scanline_period; |
| 1485 | 1452 | } |
| 1486 | 1453 | return result; |
| r1293 | r1294 | |
| 1490 | 1457 | #ifdef MAME_DEBUG |
| 1491 | 1458 | static int get_beamx(void) |
| 1492 | 1459 | { |
| 1493 | | |
| 1460 | | |
| 1494 | 1461 | int result; |
| 1495 | 1462 | |
| 1496 | scanline_time = | |
| 1463 | scanline_time = | |
| 1497 | 1464 | if (scanline_time.seconds != 0) |
| 1498 | 1465 | return 0; |
| 1499 | 1466 | assert(scanline_time.subseconds < m6847->scanline_period); |
| r1293 | r1294 | |
| 1610 | 1577 | |
| 1611 | 1578 | int m6847_get_horizontal_sync(void) |
| 1612 | 1579 | { |
| 1613 | mame_time fire_time = mame_timer_firetime(m6847->hs_fall_timer); | |
| 1614 | return compare_mame_times(fire_time, mame_timer_get_time()) > 0; | |
| 1580 | attotime fire_time = timer_firetime(m6847->hs_fall_timer); | |
| 1581 | return attotime_compare(fire_time, timer_get_time()) > 0; | |
| 1615 | 1582 | } |
| 1616 | 1583 | |
| 1617 | 1584 | |
| 1618 | 1585 | |
| 1619 | 1586 | static void set_horizontal_sync(void) |
| 1620 | 1587 | { |
| 1621 | mame_time fire_time = mame_timer_firetime(m6847->hs_fall_timer); | |
| 1622 | int horizontal_sync = compare_mame_times(fire_time, mame_timer_get_time()) > 0; | |
| 1588 | attotime fire_time = timer_firetime(m6847->hs_fall_timer); | |
| 1589 | int horizontal_sync = attotime_compare(fire_time, timer_get_time()) > 0; | |
| 1623 | 1590 | if (m6847->horizontal_sync_callback) |
| 1624 | 1591 | m6847->horizontal_sync_callback(!horizontal_sync); |
| 1625 | 1592 | } |
| r1293 | r1294 | |
| 1628 | 1595 | |
| 1629 | 1596 | int m6847_get_field_sync(void) |
| 1630 | 1597 | { |
| 1631 | mame_time fire_time = mame_timer_firetime(m6847->fs_fall_timer); | |
| 1632 | return compare_mame_times(fire_time, mame_timer_get_time()) > 0; | |
| 1598 | attotime fire_time = timer_firetime(m6847->fs_fall_timer); | |
| 1599 | return attotime_compare(fire_time, timer_get_time()) > 0; | |
| 1633 | 1600 | } |
| 1634 | 1601 | |
| 1635 | 1602 | |
| 1636 | 1603 | |
| 1637 | 1604 | static void set_field_sync(void) |
| 1638 | 1605 | { |
| 1639 | mame_time fire_time = mame_timer_firetime(m6847->fs_fall_timer); | |
| 1640 | int field_sync = compare_mame_times(fire_time, mame_timer_get_time()) > 0; | |
| 1606 | attotime fire_time = timer_firetime(m6847->fs_fall_timer); | |
| 1607 | int field_sync = attotime_compare(fire_time, timer_get_time()) > 0; | |
| 1641 | 1608 | if (m6847->field_sync_callback) |
| 1642 | 1609 | m6847->field_sync_callback(field_sync); |
| 1643 | 1610 | } |
| r1293 | r1294 | |
| 1653 | 1620 | static TIMER_CALLBACK(hs_fall) |
| 1654 | 1621 | { |
| 1655 | 1622 | if (LOG_HS) |
| 1656 | logerror("hs_fall(): time=%g\n", | |
| 1623 | logerror("hs_fall(): time=%g\n", | |
| 1657 | 1624 | |
| 1658 | 1625 | set_horizontal_sync(); |
| 1659 | 1626 | } |
| r1293 | r1294 | |
| 1661 | 1628 | static TIMER_CALLBACK(hs_rise) |
| 1662 | 1629 | { |
| 1663 | 1630 | if (LOG_HS) |
| 1664 | logerror("hs_rise(): time=%g\n", | |
| 1631 | logerror("hs_rise(): time=%g\n", | |
| 1665 | 1632 | |
| 1666 | mame_timer_adjust(m6847->hs_rise_timer, | |
| 1667 | make_mame_time(0, m6847->scanline_period), | |
| 1668 | 0, time_never); | |
| 1669 | mame_timer_adjust(m6847->hs_fall_timer, | |
| 1670 | make_mame_time(0, m6847->horizontal_sync_period), | |
| 1671 | 0, time_never); | |
| 1633 | timer_adjust(m6847->hs_rise_timer, | |
| 1634 | attotime_make(0, m6847->scanline_period), | |
| 1635 | 0, attotime_never); | |
| 1636 | timer_adjust(m6847->hs_fall_timer, | |
| 1637 | attotime_make(0, m6847->horizontal_sync_period), | |
| 1638 | 0, attotime_never); | |
| 1672 | 1639 | |
| 1673 | 1640 | set_horizontal_sync(); |
| 1674 | 1641 | prepare_scanline(0); |
| r1293 | r1294 | |
| 1677 | 1644 | static TIMER_CALLBACK(fs_fall) |
| 1678 | 1645 | { |
| 1679 | 1646 | if (LOG_FS) |
| 1680 | logerror("fs_fall(): time=%g scanline=%d\n", | |
| 1647 | logerror("fs_fall(): time=%g scanline=%d\n", | |
| 1681 | 1648 | |
| 1682 | 1649 | set_field_sync(); |
| 1683 | 1650 | } |
| r1293 | r1294 | |
| 1685 | 1652 | static TIMER_CALLBACK(fs_rise) |
| 1686 | 1653 | { |
| 1687 | 1654 | if (LOG_FS) |
| 1688 | logerror("fs_rise(): time=%g scanline=%d\n", | |
| 1655 | logerror("fs_rise(): time=%g scanline=%d\n", | |
| 1689 | 1656 | |
| 1690 | 1657 | /* adjust field sync falling edge timer */ |
| 1691 | mame_timer_adjust(m6847->fs_fall_timer, | |
| 1692 | make_mame_time(0, m6847->field_sync_period), | |
| 1693 | 0, time_never); | |
| 1658 | timer_adjust(m6847->fs_fall_timer, | |
| 1659 | attotime_make(0, m6847->field_sync_period), | |
| 1660 | 0, attotime_never); | |
| 1694 | 1661 | |
| 1695 | 1662 | /* adjust horizontal sync rising timer */ |
| 1696 | | |
| 1663 | | |
| 1697 | 1664 | |
| 1698 | 1665 | /* this is a hook for the CoCo 3 code to extend this stuff */ |
| 1699 | 1666 | if (m6847->new_frame_callback) |
| r1293 | r1294 | |
| 1842 | 1809 | { |
| 1843 | 1810 | const m6847_variant *v; |
| 1844 | 1811 | UINT32 frequency; |
| 1845 | | |
| 1812 | attoseconds_t period, frame_period, cpu0_clock_period = 0; | |
| 1846 | 1813 | double total_scanlines; |
| 1847 | 1814 | int portnum; |
| 1848 | 1815 | |
| r1293 | r1294 | |
| 1884 | 1851 | } |
| 1885 | 1852 | |
| 1886 | 1853 | /* allocate timers */ |
| 1887 | m6847->fs_rise_timer = mame_timer_alloc(fs_rise); | |
| 1888 | m6847->fs_fall_timer = mame_timer_alloc(fs_fall); | |
| 1889 | m6847->hs_rise_timer = mame_timer_alloc(hs_rise); | |
| 1890 | m6847->hs_fall_timer = mame_timer_alloc(hs_fall); | |
| 1854 | m6847->fs_rise_timer = timer_alloc(fs_rise); | |
| 1855 | m6847->fs_fall_timer = timer_alloc(fs_fall); | |
| 1856 | m6847->hs_rise_timer = timer_alloc(hs_rise); | |
| 1857 | m6847->hs_fall_timer = timer_alloc(hs_fall); | |
| 1891 | 1858 | |
| 1892 | 1859 | /* setup dimensions */ |
| 1893 | 1860 | m6847->top_border_scanlines = v->top_border_scanlines; |
| r1293 | r1294 | |
| 1898 | 1865 | frequency = v->frames_per_second |
| 1899 | 1866 | * ((UINT32) (v->scanlines_per_frame * FACTOR_SCANLINES_PER_FRAME)) |
| 1900 | 1867 | * ((UINT32) (v->clocks_per_scanline * FACTOR_CLOCKS_PER_SCANLINE)); |
| 1901 | period = MAX_ | |
| 1868 | period = ATTOTIME_MAX_ | |
| 1902 | 1869 | |
| 1903 | 1870 | /* choose CPU clock, if specified */ |
| 1904 | 1871 | if (cfg->cpu0_timing_factor > 0) |
| r1293 | r1294 | |
| 1922 | 1889 | /* setup timing */ |
| 1923 | 1890 | frame_period = period * |
| 1924 | 1891 | (UINT32) (v->clocks_per_scanline * total_scanlines * GROSS_FACTOR); |
| 1925 | | |
| 1892 | | |
| 1926 | 1893 | |
| 1927 | 1894 | /* setup save states */ |
| 1928 | 1895 | state_save_register_func_postload(set_field_sync); |
| r1293 | r1294 | |
| 1941 | 1908 | if (LOG_STATS) |
| 1942 | 1909 | { |
| 1943 | 1910 | logerror("m6847_init():\n"); |
| 1944 | logerror("\tclock: %30s sec\n", | |
| 1911 | logerror("\tclock: %30s sec\n", | |
| 1945 | 1912 | if (cpu0_clock_period > 0) |
| 1946 | logerror("\tCPU0 clock: %30s sec\n", mame_time_string(make_mame_time(0, cpu0_clock_period))); | |
| 1947 | logerror("\tscanline: %30s sec\n", mame_time_string(make_mame_time(0, m6847->scanline_period))); | |
| 1948 | logerror("\tfield sync: %30s sec\n", mame_time_string(make_mame_time(0, m6847->field_sync_period))); | |
| 1949 | logerror("\thorz sync: %30s sec\n", mame_time_string(make_mame_time(0, m6847->horizontal_sync_period))); | |
| 1950 | logerror("\tvblank: %30s sec\n", mame_time_string(make_mame_time(0, m6847->vblank_period))); | |
| 1951 | logerror("\tframe: %30s sec\n", mame_time_string(make_mame_time(0, frame_period))); | |
| 1913 | logerror("\tCPU0 clock: %30s sec\n", attotime_string(attotime_make(0, cpu0_clock_period), 6)); | |
| 1914 | logerror("\tscanline: %30s sec\n", attotime_string(attotime_make(0, m6847->scanline_period), 6)); | |
| 1915 | logerror("\tfield sync: %30s sec\n", attotime_string(attotime_make(0, m6847->field_sync_period), 6)); | |
| 1916 | logerror("\thorz sync: %30s sec\n", attotime_string(attotime_make(0, m6847->horizontal_sync_period), 6)); | |
| 1917 | logerror("\tvblank: %30s sec\n", attotime_string(attotime_make(0, m6847->vblank_period), 6)); | |
| 1918 | logerror("\tframe: %30s sec\n", attotime_string(attotime_make(0, frame_period), 6)); | |
| 1952 | 1919 | logerror("\n"); |
| 1953 | 1920 | } |
| 1954 | 1921 | |
| r1293 | r1294 | |
| 2011 | 1978 | * |
| 2012 | 1979 | *************************************/ |
| 2013 | 1980 | |
| 2014 | static UINT64 divide_mame_time( | |
| 1981 | static UINT64 divide_mame_time( | |
| 2015 | 1982 | { |
| 2016 | 1983 | /* TODO: it should not be necessary to use floating point here */ |
| 2017 | double dividend_dbl = mame_time_to_double(dividend); | |
| 2018 | double divisor_dbl = mame_time_to_double(divisor); | |
| 1984 | double dividend_dbl = attotime_to_double(dividend); | |
| 1985 | double divisor_dbl = attotime_to_double(divisor); | |
| 2019 | 1986 | return (UINT64) (dividend_dbl / divisor_dbl); |
| 2020 | 1987 | } |
| 2021 | 1988 | |
| 2022 | 1989 | |
| 2023 | 1990 | |
| 2024 | static | |
| 1991 | static | |
| 2025 | 1992 | { |
| 2026 | /* TODO: it should not be necessary to use floating point here */ | |
| 2027 | double d = mame_time_to_double(time); | |
| 1993 | attotime result; | |
| 2028 | 1994 | |
| 2029 | #if defined(_MSC_VER) && (_MSC_VER <= 1200) | |
| 2030 | /* casting unsigned __int64 to double is not supported on VC6 or before */ | |
| 2031 | d *= (INT64) factor; | |
| 2032 | #else | |
| 2033 | d *= factor; | |
| 2034 | #endif | |
| 2035 | ||
| 2036 | return double_to_mame_time(d); | |
| 2037 | } | |
| 2038 | ||
| 2039 | ||
| 2040 | ||
| 2041 | static mame_time interval(m6847_timing_type timing) | |
| 2042 | { | |
| 2043 | mame_time result; | |
| 2044 | ||
| 2045 | 1995 | switch(timing) |
| 2046 | 1996 | { |
| 2047 | 1997 | case M6847_CLOCK: |
| 2048 | result = | |
| 1998 | result = | |
| 2049 | 1999 | break; |
| 2050 | 2000 | case M6847_HSYNC: |
| 2051 | result = | |
| 2001 | result = | |
| 2052 | 2002 | break; |
| 2053 | 2003 | default: |
| 2054 | 2004 | fatalerror("invalid timing type"); |
| r1293 | r1294 | |
| 2061 | 2011 | |
| 2062 | 2012 | UINT64 m6847_time(m6847_timing_type timing) |
| 2063 | 2013 | { |
| 2064 | mame_time current_time = mame_timer_get_time(); | |
| 2065 | mame_time divisor = interval(timing); | |
| 2014 | attotime current_time = timer_get_time(); | |
| 2015 | attotime divisor = interval(timing); | |
| 2066 | 2016 | return divide_mame_time(current_time, divisor); |
| 2067 | 2017 | } |
| 2068 | 2018 | |
| 2069 | 2019 | |
| 2070 | 2020 | |
| 2071 | ||
| 2021 | ||
| 2072 | 2022 | { |
| 2073 | mame_time target_mame_time, current_time; | |
| 2074 | target_mame_time = multiply_mame_time(interval(timing), target_time); | |
| 2075 | current_time = mame_timer_get_time(); | |
| 2023 | attotime target_mame_time, current_time; | |
| 2024 | target_mame_time = attotime_mul(interval(timing), target_time); | |
| 2025 | current_time = timer_get_time(); | |
| 2076 | 2026 | |
| 2077 | if (compare | |
| 2027 | if (attotime_compare | |
| 2078 | 2028 | fatalerror("m6847_time_until(): cannot target past times"); |
| 2079 | 2029 | |
| 2080 | return | |
| 2030 | return | |
| 2081 | 2031 | } |
| 2082 | 2032 | |
| 2083 | 2033 | |
| 2084 | 2034 | |
| 2085 | ||
| 2035 | ||
| 2086 | 2036 | { |
| 2087 | return | |
| 2037 | return | |
| 2088 | 2038 | (13 /* FIXME */ + scanline)); |
| 2089 | 2039 | } |
| 2090 | 2040 |
| r1293 | r1294 | |
|---|---|---|
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | |
| 106 | static | |
| 106 | static | |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | |
| r1293 | r1294 | |
| 111 | 111 | INLINE unsigned thom_video_elapsed ( void ) |
| 112 | 112 | { |
| 113 | 113 | unsigned u; |
| 114 | mame_time elapsed = mame_timer_timeelapsed( thom_video_timer ); | |
| 115 | u = scale_up_mame_time( elapsed, 1000000 ).seconds; | |
| 114 | attotime elapsed = timer_timeelapsed( thom_video_timer ); | |
| 115 | u = attotime_mul( elapsed, 1000000 ).seconds; | |
| 116 | 116 | if ( u >= 19968 ) |
| 117 | 117 | u = 19968; |
| 118 | 118 | return u; |
| r1293 | r1294 | |
| 206 | 206 | |
| 207 | 207 | |
| 208 | 208 | /* called thom_lightpen_nb times */ |
| 209 | static | |
| 209 | static | |
| 210 | 210 | |
| 211 | 211 | |
| 212 | 212 | /* lightpen callback function to call from timer */ |
| r1293 | r1294 | |
| 216 | 216 | |
| 217 | 217 | void thom_set_lightpen_callback ( int nb, void (*cb) ( int step ) ) |
| 218 | 218 | { |
| 219 | LOG (( "%f thom_set_lightpen_callback called\n", | |
| 219 | LOG (( "%f thom_set_lightpen_callback called\n", | |
| 220 | 220 | thom_lightpen_nb = nb; |
| 221 | 221 | thom_lightpen_cb = cb; |
| 222 | 222 | } |
| r1293 | r1294 | |
| 229 | 229 | thom_lightpen_cb( step ); |
| 230 | 230 | |
| 231 | 231 | if ( step < thom_lightpen_nb ) |
| 232 | | |
| 232 | | |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | |
| r1293 | r1294 | |
| 258 | 258 | |
| 259 | 259 | UINT8* thom_vram; /* pointer to video memory */ |
| 260 | 260 | |
| 261 | static | |
| 261 | static | |
| 262 | 262 | |
| 263 | 263 | static UINT16 thom_last_pal[16]; /* palette at last scanline start */ |
| 264 | 264 | static UINT16 thom_pal[16]; /* current palette */ |
| r1293 | r1294 | |
| 829 | 829 | |
| 830 | 830 | /* prepare for next scanline */ |
| 831 | 831 | if ( y == 199 ) |
| 832 | | |
| 832 | | |
| 833 | 833 | else |
| 834 | 834 | { |
| 835 | 835 | |
| r1293 | r1294 | |
| 854 | 854 | thom_pal_changed = 0; |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | | |
| 857 | | |
| 858 | 858 | } |
| 859 | 859 | } |
| 860 | 860 | |
| r1293 | r1294 | |
| 920 | 920 | rectangle lrect = { 0, xbleft - 1, 0, 0 }; |
| 921 | 921 | rectangle rrect = { xbright, xright - 1, 0, 0 }; |
| 922 | 922 | |
| 923 | LOG (( "%f thom: video update called\n", | |
| 923 | LOG (( "%f thom: video update called\n", | |
| 924 | 924 | |
| 925 | 925 | /* upper border */ |
| 926 | 926 | for ( y = 0; y < THOM_BORDER_HEIGHT - thom_bheight; y++ ) |
| r1293 | r1294 | |
| 1016 | 1016 | |
| 1017 | 1017 | |
| 1018 | 1018 | |
| 1019 | static | |
| 1019 | static | |
| 1020 | 1020 | |
| 1021 | 1021 | static void (*thom_init_cb) ( int ); |
| 1022 | 1022 | |
| r1293 | r1294 | |
| 1032 | 1032 | static TIMER_CALLBACK( thom_set_init ) |
| 1033 | 1033 | { |
| 1034 | 1034 | int init = param; |
| 1035 | LOG (( "%f thom_set_init: %i, at line %i col %i\n", | |
| 1035 | LOG (( "%f thom_set_init: %i, at line %i col %i\n", | |
| 1036 | 1036 | |
| 1037 | 1037 | if ( thom_init_cb ) |
| 1038 | 1038 | thom_init_cb( init ); |
| 1039 | 1039 | if ( ! init ) |
| 1040 | | |
| 1040 | | |
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | /* call this at the very begining of each new frame */ |
| r1293 | r1294 | |
| 1048 | 1048 | UINT16 b = 0; |
| 1049 | 1049 | struct thom_vsignal l = thom_get_lightpen_vsignal( 0, -1, 0 ); |
| 1050 | 1050 | |
| 1051 | LOG (( "%f thom: video eof called\n", | |
| 1051 | LOG (( "%f thom: video eof called\n", | |
| 1052 | 1052 | |
| 1053 | 1053 | /* floppy indicator count */ |
| 1054 | 1054 | if ( thom_floppy_wcount ) |
| r1293 | r1294 | |
| 1075 | 1075 | thom_vstate_dirty = 0; |
| 1076 | 1076 | |
| 1077 | 1077 | /* schedule first init signal */ |
| 1078 | | |
| 1078 | | |
| 1079 | 1079 | |
| 1080 | 1080 | /* schedule first lightpen signal */ |
| 1081 | 1081 | l.line &= ~1; /* hack (avoid lock in MO6 palette selection) */ |
| 1082 | mame_timer_adjust( thom_lightpen_timer, | |
| 1083 | MAME_TIME_IN_USEC( 64 * ( THOM_BORDER_HEIGHT + l.line - 2 ) + 16 ), | |
| 1084 | 0, time_zero ); | |
| 1082 | timer_adjust( thom_lightpen_timer, | |
| 1083 | ATTOTIME_IN_USEC( 64 * ( THOM_BORDER_HEIGHT + l.line - 2 ) + 16 ), | |
| 1084 | 0, attotime_zero ); | |
| 1085 | 1085 | |
| 1086 | 1086 | /* schedule first active-area scanline call-back */ |
| 1087 | mame_timer_adjust( thom_scanline_timer, MAME_TIME_IN_USEC( 64 * THOM_BORDER_HEIGHT + 7), | |
| 1088 | -1, time_zero ); | |
| 1087 | timer_adjust( thom_scanline_timer, ATTOTIME_IN_USEC( 64 * THOM_BORDER_HEIGHT + 7), | |
| 1088 | -1, attotime_zero ); | |
| 1089 | 1089 | |
| 1090 | 1090 | /* reset video frame time */ |
| 1091 | | |
| 1091 | | |
| 1092 | 1092 | |
| 1093 | 1093 | /* update screen size according to user options */ |
| 1094 | 1094 | if ( thom_update_screen_size() ) |
| r1293 | r1294 | |
| 1162 | 1162 | state_save_register_global( thom_floppy_rcount ); |
| 1163 | 1163 | output_set_value( "floppy", 0 ); |
| 1164 | 1164 | |
| 1165 | thom_video_timer = | |
| 1165 | thom_video_timer = | |
| 1166 | 1166 | |
| 1167 | thom_scanline_timer = | |
| 1167 | thom_scanline_timer = | |
| 1168 | 1168 | |
| 1169 | 1169 | thom_lightpen_nb = 0; |
| 1170 | 1170 | thom_lightpen_cb = NULL; |
| 1171 | thom_lightpen_timer = | |
| 1171 | thom_lightpen_timer = | |
| 1172 | 1172 | state_save_register_global( thom_lightpen_nb ); |
| 1173 | 1173 | |
| 1174 | 1174 | thom_init_cb = NULL; |
| 1175 | thom_init_timer = | |
| 1175 | thom_init_timer = | |
| 1176 | 1176 | |
| 1177 | 1177 | video_eof_thom(machine); |
| 1178 | 1178 |
| r1293 | r1294 | |
|---|---|---|
| 77 | 77 | |
| 78 | 78 | /* timing functions */ |
| 79 | 79 | UINT64 m6847_time(m6847_timing_type timing); |
| 80 | ||
| 80 | ||
| 81 | 81 | |
| 82 | 82 | /* CoCo 3 hooks */ |
| 83 | ||
| 83 | ||
| 84 | 84 | |
| 85 | 85 | INPUT_PORTS_EXTERN( m6847_artifacting ); |
| 86 | 86 |
| r1293 | r1294 | |
|---|---|---|
| 1 | 1 | #include "abc80.h" |
| 2 | 2 | |
| 3 | 3 | static tilemap *tx_tilemap; |
| 4 | static | |
| 4 | static | |
| 5 | 5 | static int abc80_blink; |
| 6 | 6 | static int abc80_bank; |
| 7 | 7 | static int abc80_row; |
| r1293 | r1294 | |
| 61 | 61 | |
| 62 | 62 | VIDEO_START( abc80 ) |
| 63 | 63 | { |
| 64 | abc80_blink_timer = mame_timer_alloc(abc80_blink_tick); | |
| 65 | mame_timer_adjust(abc80_blink_timer, time_zero, 0, MAME_TIME_IN_HZ(ABC80_XTAL/2/6/64/312/16)); | |
| 64 | abc80_blink_timer = timer_alloc(abc80_blink_tick); | |
| 65 | timer_adjust(abc80_blink_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC80_XTAL/2/6/64/312/16)); | |
| 66 | 66 | |
| 67 | 67 | tx_tilemap = tilemap_create(abc80_get_tile_info, abc80_tilemap_scan, |
| 68 | 68 | TILEMAP_TYPE_PEN, 6, 10, 40, 24); |
| r1293 | r1294 | |
|---|---|---|
| 33 | 33 | |
| 34 | 34 | extern struct x68k_system sys; |
| 35 | 35 | |
| 36 | extern mame_timer* scanline_timer; | |
| 37 | extern mame_timer* raster_irq; | |
| 38 | extern mame_timer* vblank_irq; | |
| 36 | extern emu_timer* scanline_timer; | |
| 37 | extern emu_timer* raster_irq; | |
| 38 | extern emu_timer* vblank_irq; | |
| 39 | 39 | |
| 40 | 40 | UINT16* gvram; // Graphic VRAM |
| 41 | 41 | UINT16* tvram; // Text VRAM |
| r1293 | r1294 | |
| 174 | 174 | sys.crtc.hshift = (sys.crtc.width - sys.crtc.visible_width) / 2; |
| 175 | 175 | sys.crtc.vshift = (sys.crtc.height - sys.crtc.visible_height) / 2; |
| 176 | 176 | |
| 177 | video_screen_configure(0,sys.crtc.video_width,sys.crtc.video_height,&rect,HZ_TO_ | |
| 177 | video_screen_configure(0,sys.crtc.video_width,sys.crtc.video_height,&rect,HZ_TO_ATTOSECONDS(55.45)); | |
| 178 | 178 | logerror("video_screen_configure(0,%i,%i,[%i,%i,%i,%i],55.45)\n",sys.crtc.video_width,sys.crtc.video_height,rect.min_x,rect.min_y,rect.max_x,rect.max_y); |
| 179 | 179 | // x68k_scanline = video_screen_get_vpos(0); |
| 180 | 180 | if(sys.crtc.reg[4] != 0) |
| 181 | 181 | { |
| 182 | // scantime = MAME_TIME_IN_HZ(55.45) / sys.crtc.reg[4]; | |
| 183 | // mame_timer_adjust(scanline_timer,time_zero,0,scantime); | |
| 182 | // scantime = ATTOTIME_IN_HZ(55.45) / sys.crtc.reg[4]; | |
| 183 | // timer_adjust(scanline_timer,attotime_zero,0,scantime); | |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | TIMER_CALLBACK(x68k_hsync) |
| 188 | 188 | { |
| 189 | 189 | int state = param; |
| 190 | mame_time irq_time = video_screen_get_scan_period(0); | |
| 191 | mame_time hsync_time = MAME_TIME_IN_CYCLES(0,32); | |
| 190 | attotime irq_time = video_screen_get_scan_period(0); | |
| 191 | attotime hsync_time = ATTOTIME_IN_CYCLES(0,32); | |
| 192 | 192 | |
| 193 | 193 | sys.crtc.hblank = state; |
| 194 | 194 | if(state == 1) |
| 195 | 195 | { |
| 196 | 196 | // mfp_trigger_irq(MFP_IRQ_GPIP7); // HSync |
| 197 | | |
| 197 | | |
| 198 | 198 | } |
| 199 | 199 | if(state == 0) |
| 200 | 200 | { |
| 201 | double time_to_irq = mame_time_to_double(irq_time) - mame_time_to_double(hsync_time); | |
| 202 | mame_timer_adjust(scanline_timer,double_to_mame_time(time_to_irq),1,time_never); | |
| 201 | double time_to_irq = attotime_to_double(irq_time) - attotime_to_double(hsync_time); | |
| 202 | timer_adjust(scanline_timer,double_to_attotime(time_to_irq),1,attotime_never); | |
| 203 | 203 | if(!(sys.mfp.gpio & 0x40)) // if GPIP6 is active, clear it |
| 204 | 204 | sys.mfp.gpio |= 0x40; |
| 205 | 205 | } |
| r1293 | r1294 | |
| 209 | 209 | TIMER_CALLBACK(x68k_crtc_raster_irq) |
| 210 | 210 | { |
| 211 | 211 | int scan = param; |
| 212 | | |
| 212 | | |
| 213 | 213 | // mfp_trigger_irq(MFP_IRQ_GPIP6); |
| 214 | 214 | sys.mfp.gpio &= ~0x40; // GPIP6 |
| 215 | 215 | if((readinputportbytag("options") & 0x01)) |
| r1293 | r1294 | |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | irq_time = video_screen_get_time_until_pos(0,scan,2); |
| 221 | if(mame_time_to_double(irq_time) > 0) | |
| 222 | mame_timer_adjust(raster_irq,irq_time,scan,time_never); | |
| 221 | if(attotime_to_double(irq_time) > 0) | |
| 222 | timer_adjust(raster_irq,irq_time,scan,attotime_never); | |
| 223 | 223 | logerror("GPIP6: Raster triggered at line %i (%i)\n",scan,video_screen_get_vpos(0)); |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | TIMER_CALLBACK(x68k_crtc_vblank_irq) |
| 227 | 227 | { |
| 228 | 228 | int val = param; |
| 229 | | |
| 229 | | |
| 230 | 230 | int vblank_line; |
| 231 | 231 | |
| 232 | 232 | if(val == 1) // VBlank on |
| r1293 | r1294 | |
| 239 | 239 | irq_time = video_screen_get_time_until_pos(0,vblank_line / 2,2); |
| 240 | 240 | else |
| 241 | 241 | irq_time = video_screen_get_time_until_pos(0,vblank_line,2); |
| 242 | | |
| 242 | | |
| 243 | 243 | logerror("CRTC: VBlank on\n"); |
| 244 | 244 | } |
| 245 | 245 | if(val == 0) // VBlank off |
| r1293 | r1294 | |
| 250 | 250 | irq_time = video_screen_get_time_until_pos(0,vblank_line / 2,2); |
| 251 | 251 | else |
| 252 | 252 | irq_time = video_screen_get_time_until_pos(0,vblank_line,2); |
| 253 | | |
| 253 | | |
| 254 | 254 | logerror("CRTC: VBlank off\n"); |
| 255 | 255 | } |
| 256 | 256 | } |
| r1293 | r1294 | |
| 273 | 273 | x68k_crtc_refresh_mode(); |
| 274 | 274 | break; |
| 275 | 275 | case 9: // CRTC raster IRQ (GPIP6) |
| 276 | | |
| 276 | | |
| 277 | 277 | if(sys.crtc.height == 256) // adjust to visible area |
| 278 | 278 | { |
| 279 | 279 | data = data / 2; |
| r1293 | r1294 | |
| 289 | 289 | } |
| 290 | 290 | if(data <= sys.crtc.video_height) |
| 291 | 291 | { |
| 292 | | |
| 292 | | |
| 293 | 293 | irq_time = video_screen_get_time_until_pos(0,data - 1,2); |
| 294 | 294 | |
| 295 | if(mame_time_to_double(irq_time) > 0) | |
| 296 | mame_timer_adjust(raster_irq,irq_time,data - 1,time_never); | |
| 297 | logerror("CRTC: Time until next raster IRQ = %f\n",mame_time_to_double(irq_time)); | |
| 295 | if(attotime_to_double(irq_time) > 0) | |
| 296 | timer_adjust(raster_irq,irq_time,data - 1,attotime_never); | |
| 297 | logerror("CRTC: Time until next raster IRQ = %f\n",attotime_to_double(irq_time)); | |
| 298 | 298 | } |
| 299 | 299 | logerror("CRTC: Write to raster IRQ register - %i\n",data); |
| 300 | 300 | break; |
| r1293 | r1294 | |
| 341 | 341 | if(data & 0x08) // text screen raster copy |
| 342 | 342 | { |
| 343 | 343 | x68k_crtc_text_copy((sys.crtc.reg[22] & 0xff00) >> 8,(sys.crtc.reg[22] & 0x00ff)); |
| 344 | | |
| 344 | | |
| 345 | 345 | } |
| 346 | 346 | if(data & 0x02) // high-speed graphic screen clear |
| 347 | 347 | { |
| r1293 | r1294 | |
| 367 | 367 | { |
| 368 | 368 | fillbitmap(x68k_gfx_3_bitmap_16,0,&rect); |
| 369 | 369 | } |
| 370 | | |
| 370 | | |
| 371 | 371 | // popmessage("CRTC: High-speed gfx screen clear [0x%02x]",sys.crtc.reg[21] & 0x0f); |
| 372 | 372 | } |
| 373 | 373 | break; |
| r1293 | r1294 | |
| 882 | 882 | tilemap_set_transparent_pen(x68k_bg0_16,0); |
| 883 | 883 | tilemap_set_transparent_pen(x68k_bg1_16,0); |
| 884 | 884 | |
| 885 | // | |
| 885 | // | |
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | VIDEO_UPDATE( x68000 ) |
| r1293 | r1294 | |
|---|---|---|
| 111 | 111 | pItem = EventList_GetFirstItem(); |
| 112 | 112 | set_last_border_color ( pItem[NumItems-1].Event_Data ); |
| 113 | 113 | EventList_Reset(); |
| 114 | EventList_SetOffsetStartTime ( | |
| 114 | EventList_SetOffsetStartTime ( | |
| 115 | 115 | logerror ("Event log reset in callback fn.\n"); |
| 116 | 116 | } |
| 117 | 117 | } |
| r1293 | r1294 | |
| 138 | 138 | pItem = EventList_GetFirstItem(); |
| 139 | 139 | set_last_border_color ( pItem[NumItems-1].Event_Data ); |
| 140 | 140 | EventList_Reset(); |
| 141 | EventList_SetOffsetStartTime ( | |
| 141 | EventList_SetOffsetStartTime ( | |
| 142 | 142 | logerror ("Event log reset in callback fn.\n"); |
| 143 | 143 | } |
| 144 | 144 | } |
| r1293 | r1294 | |
|---|---|---|
| 32 | 32 | int h, v; |
| 33 | 33 | } shifter; |
| 34 | 34 | |
| 35 | static mame_timer *atarist_glue_timer; | |
| 36 | static mame_timer *atarist_shifter_timer; | |
| 35 | static emu_timer *atarist_glue_timer; | |
| 36 | static emu_timer *atarist_shifter_timer; | |
| 37 | 37 | static mame_bitmap *atarist_bitmap; |
| 38 | 38 | |
| 39 | 39 | static TIMER_CALLBACK(atarist_shifter_tick) |
| r1293 | r1294 | |
| 375 | 375 | UINT32 srcbuf; |
| 376 | 376 | } blitter; |
| 377 | 377 | |
| 378 | static | |
| 378 | static | |
| 379 | 379 | |
| 380 | 380 | static void atarist_blitter_source(void) |
| 381 | 381 | { |
| r1293 | r1294 | |
| 681 | 681 | if ((data >> 8) & ATARIST_BLITTER_CTRL_BUSY) |
| 682 | 682 | { |
| 683 | 683 | int nops = BLITTER_NOPS[blitter.op][blitter.hop]; // each NOP takes 4 cycles |
| 684 | | |
| 684 | | |
| 685 | 685 | } |
| 686 | 686 | } |
| 687 | 687 | } |
| r1293 | r1294 | |
| 695 | 695 | |
| 696 | 696 | VIDEO_START( atarist ) |
| 697 | 697 | { |
| 698 | atarist_shifter_timer = mame_timer_alloc(atarist_shifter_tick); | |
| 699 | atarist_glue_timer = mame_timer_alloc(atarist_glue_tick); | |
| 700 | blitter_timer = mame_timer_alloc(atarist_blitter_tick); | |
| 698 | atarist_shifter_timer = timer_alloc(atarist_shifter_tick); | |
| 699 | atarist_glue_timer = timer_alloc(atarist_glue_tick); | |
| 700 | blitter_timer = timer_alloc(atarist_blitter_tick); | |
| 701 | 701 | |
| 702 | mame_timer_adjust(atarist_glue_timer, video_screen_get_time_until_pos(0,0,4), 0, MAME_TIME_IN_HZ(Y2/16)); // 500 ns | |
| 703 | mame_timer_adjust(atarist_shifter_timer, video_screen_get_time_until_pos(0,0,0), 0, MAME_TIME_IN_HZ(Y2/4)); // 125 ns | |
| 702 | timer_adjust(atarist_glue_timer, video_screen_get_time_until_pos(0,0,4), 0, ATTOTIME_IN_HZ(Y2/16)); // 500 ns | |
| 703 | timer_adjust(atarist_shifter_timer, video_screen_get_time_until_pos(0,0,0), 0, ATTOTIME_IN_HZ(Y2/4)); // 125 ns | |
| 704 | 704 | |
| 705 | 705 | atarist_bitmap = auto_bitmap_alloc(Machine->screen[0].width, Machine->screen[0].height, Machine->screen[0].format); |
| 706 | 706 |
| r1293 | r1294 | |
|---|---|---|
| 341 | 341 | |
| 342 | 342 | /* Assume all other routines have processed their data from the list */ |
| 343 | 343 | EventList_Reset(); |
| 344 | EventList_SetOffsetStartTime ( | |
| 344 | EventList_SetOffsetStartTime ( | |
| 345 | 345 | } |
| r1293 | r1294 | |
|---|---|---|
| 49 | 49 | |
| 50 | 50 | #if VERBOSE |
| 51 | 51 | #define DBG_LOG(N,M,A) \ |
| 52 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 52 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 53 | 53 | #else |
| 54 | 54 | #define DBG_LOG(N,M,A) |
| 55 | 55 | #endif |
| r1293 | r1294 | |
| 135 | 135 | |
| 136 | 136 | crtc = auto_malloc(sizeof(struct mscrtc6845)); |
| 137 | 137 | memset(crtc, 0, sizeof(*crtc)); |
| 138 | crtc->cursor_time = | |
| 138 | crtc->cursor_time = | |
| 139 | 139 | crtc->config = *config; |
| 140 | 140 | mscrtc6845 = crtc; |
| 141 | 141 | |
| r1293 | r1294 | |
| 179 | 179 | double neu, ftime; |
| 180 | 180 | struct mscrtc6845_cursor cursor; |
| 181 | 181 | |
| 182 | neu = | |
| 182 | neu = | |
| 183 | 183 | |
| 184 | 184 | if (mscrtc6845_clocks_in_frame(crtc) == 0.0) |
| 185 | 185 | return; |
| r1293 | r1294 | |
|---|---|---|
| 68 | 68 | /* initialise flash timer */ |
| 69 | 69 | vh_state.flash_count = 0; |
| 70 | 70 | vh_state.flash_state = 0; |
| 71 | | |
| 71 | | |
| 72 | 72 | /* mode */ |
| 73 | 73 | oric_vh_update_attribute((1<<3)|(1<<4)); |
| 74 | 74 | } |
| r1293 | r1294 | |
|---|---|---|
| 786 | 786 | if (LIGHTPEN_BUTTON) |
| 787 | 787 | { |
| 788 | 788 | /* lightpen timer starten */ |
| 789 | | |
| 789 | | |
| 790 | 790 | } |
| 791 | 791 | //state_display(vic2.bitmap); |
| 792 | 792 | } |
| r1293 | r1294 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | static const int ZX8301_COLOR_MODE4[] = { 0, 2, 4, 7 }; |
| 14 | 14 | |
| 15 | static | |
| 15 | static | |
| 16 | 16 | |
| 17 | 17 | static TIMER_CALLBACK(zx8301_flash_tick) |
| 18 | 18 | { |
| r1293 | r1294 | |
| 110 | 110 | |
| 111 | 111 | VIDEO_START( zx8301 ) |
| 112 | 112 | { |
| 113 | zx8301_flash_timer = mame_timer_alloc(zx8301_flash_tick); | |
| 114 | mame_timer_adjust(zx8301_flash_timer, MAME_TIME_IN_HZ(2), 0, MAME_TIME_IN_HZ(2)); | |
| 113 | zx8301_flash_timer = timer_alloc(zx8301_flash_tick); | |
| 114 | timer_adjust(zx8301_flash_timer, ATTOTIME_IN_HZ(2), 0, ATTOTIME_IN_HZ(2)); | |
| 115 | 115 | |
| 116 | 116 | state_save_register_global(zx8301.dispoff); |
| 117 | 117 | state_save_register_global(zx8301.mode8); |
| r1293 | r1294 | |
|---|---|---|
| 176 | 176 | signal in response to a video display write. This signal indicates |
| 177 | 177 | the display has completed the write and is ready to accept another |
| 178 | 178 | write. */ |
| 179 | ||
| 179 | ||
| 180 | 180 | { |
| 181 | 181 | int cursor_x, cursor_y; |
| 182 | 182 | int cursor_scanline; |
| 183 | double scanline_period = | |
| 183 | double scanline_period = | |
| 184 | 184 | double cursor_hfrac; |
| 185 | 185 | |
| 186 | 186 | /* The video hardware refreshes the screen by reading the |
| r1293 | r1294 | |
| 208 | 208 | double current_hfrac = video_screen_get_hpos(0) / |
| 209 | 209 | Machine->screen[0].width; |
| 210 | 210 | if (current_hfrac < cursor_hfrac) |
| 211 | return double_to_ | |
| 211 | return double_to_ | |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | return double_to_mame_time( | |
| 215 | mame_time_to_double(video_screen_get_time_until_pos(0, cursor_scanline, 0)) + | |
| 214 | return double_to_attotime( | |
| 215 | attotime_to_double(video_screen_get_time_until_pos(0, cursor_scanline, 0)) + | |
| 216 | 216 | scanline_period * cursor_hfrac); |
| 217 | 217 | } |
| 218 | 218 | |
| r1293 | r1294 | |
| 228 | 228 | number of one-third-cycles elapsed, then checking the result |
| 229 | 229 | modulo 3. */ |
| 230 | 230 | |
| 231 | if (((int) ( | |
| 231 | if (((int) ( | |
| 232 | 232 | new_blink_on = 1; |
| 233 | 233 | else |
| 234 | 234 | new_blink_on = 0; |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | #if VERBOSE_MDA |
| 18 | 18 | #define MDA_LOG(N,M,A) \ |
| 19 | if(VERBOSE_MDA>=N){ if( M )logerror("%11.6f: %-24s", | |
| 19 | if(VERBOSE_MDA>=N){ if( M )logerror("%11.6f: %-24s", | |
| 20 | 20 | #else |
| 21 | 21 | #define MDA_LOG(n,m,a) |
| 22 | 22 | #endif |
| r1293 | r1294 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | #if VERBOSE |
| 27 | 27 | #define DBG_LOG(N,M,A) \ |
| 28 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 28 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 29 | 29 | logerror A; } |
| 30 | 30 | #else |
| 31 | 31 | #define DBG_LOG(N,M,A) |
| r1293 | r1294 | |
| 386 | 386 | static void vdc8563_time(void) |
| 387 | 387 | { |
| 388 | 388 | double neu, ftime; |
| 389 | neu= | |
| 389 | neu= | |
| 390 | 390 | |
| 391 | 391 | if (vdc8563_clocks_in_frame()==0.0) return; |
| 392 | 392 | ftime=16*vdc8563_clocks_in_frame()/2000000.0; |
| r1293 | r1294 | |
|---|---|---|
| 67 | 67 | UINT32 composite_palette[64]; |
| 68 | 68 | UINT32 rgb_palette[64]; |
| 69 | 69 | UINT8 fontdata[128][8]; |
| 70 | | |
| 70 | | |
| 71 | 71 | |
| 72 | 72 | /* CoCo 3 palette status */ |
| 73 | 73 | UINT8 palette_ram[16]; |
| r1293 | r1294 | |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | /* set up GIME field sync */ |
| 514 | | |
| 514 | | |
| 515 | 515 | m6847_scanline_time(gime_field_sync), |
| 516 | 516 | 0, |
| 517 | time_never); | |
| 517 | attotime_never); | |
| 518 | 518 | |
| 519 | 519 | return video->legacy_video; |
| 520 | 520 | } |
| r1293 | r1294 | |
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | /* GIME field sync timer */ |
| 814 | video->gime_fs_timer = | |
| 814 | video->gime_fs_timer = | |
| 815 | 815 | |
| 816 | 816 | /* initialize the CoCo video code */ |
| 817 | 817 | memset(&cfg, 0, sizeof(cfg)); |
| r1293 | r1294 | |
|---|---|---|
| 106 | 106 | int *line_buffer; |
| 107 | 107 | int current_palette[32]; |
| 108 | 108 | void (*int_callback)(int); |
| 109 | | |
| 109 | | |
| 110 | 110 | } smsvdp; |
| 111 | 111 | |
| 112 | 112 | static TIMER_CALLBACK(smsvdp_display_callback); |
| r1293 | r1294 | |
| 210 | 210 | |
| 211 | 211 | set_display_settings(); |
| 212 | 212 | |
| 213 | smsvdp.smsvdp_display_timer = mame_timer_alloc( smsvdp_display_callback ); | |
| 214 | mame_timer_adjust( smsvdp.smsvdp_display_timer, video_screen_get_time_until_pos( 0, 0, 0 ), 0, video_screen_get_scan_period( 0 ) ); | |
| 213 | smsvdp.smsvdp_display_timer = timer_alloc( smsvdp_display_callback ); | |
| 214 | timer_adjust( smsvdp.smsvdp_display_timer, video_screen_get_time_until_pos( 0, 0, 0 ), 0, video_screen_get_scan_period( 0 ) ); | |
| 215 | 215 | return 0; |
| 216 | 216 | } |
| 217 | 217 | |
| r1293 | r1294 | |
| 255 | 255 | smsvdp.status |= STATUS_HINT; |
| 256 | 256 | if ( smsvdp.reg[0x00] & 0x10 ) { |
| 257 | 257 | /* Delay triggering of interrupt to allow software to read the status bit before the irq */ |
| 258 | | |
| 258 | | |
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
| r1293 | r1294 | |
| 264 | 264 | smsvdp.status |= STATUS_VINT; |
| 265 | 265 | if ( smsvdp.reg[0x01] & 0x20 ) { |
| 266 | 266 | /* Delay triggering of interrupt to allow software to read the status bit before the irq */ |
| 267 | | |
| 267 | | |
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | if ( video_skip_this_frame() ) { |
| r1293 | r1294 | |
| 299 | 299 | smsvdp.status |= STATUS_HINT; |
| 300 | 300 | if ( smsvdp.reg[0x00] & 0x10 ) { |
| 301 | 301 | /* Delay triggering of interrupt to allow software to read the status bit before the irq */ |
| 302 | | |
| 302 | | |
| 303 | 303 | } |
| 304 | 304 | } else { |
| 305 | 305 | smsvdp.line_counter -= 1; |
| r1293 | r1294 | |
|---|---|---|
| 61 | 61 | |
| 62 | 62 | #if VERBOSE_CGA |
| 63 | 63 | #define CGA_LOG(N,M,A) \ |
| 64 | if(VERBOSE_CGA>=N){ if( M )logerror("%11.6f: %-24s", | |
| 64 | if(VERBOSE_CGA>=N){ if( M )logerror("%11.6f: %-24s", | |
| 65 | 65 | #else |
| 66 | 66 | #define CGA_LOG(n,m,a) |
| 67 | 67 | #endif |
| r1293 | r1294 | |
| 276 | 276 | state_save_register_item("pccga", 0, cga.status); |
| 277 | 277 | state_save_register_item("pccga", 0, cga.plantronics); |
| 278 | 278 | |
| 279 | | |
| 279 | | |
| 280 | 280 | return 0; |
| 281 | 281 | } |
| 282 | 282 |
| r1293 | r1294 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | static mame_bitmap *cdptmpbitmap; |
| 7 | 7 | |
| 8 | static mame_timer *cdp1864_int_timer; | |
| 9 | static mame_timer *cdp1864_efx_timer; | |
| 10 | static mame_timer *cdp1864_dma_timer; | |
| 8 | static emu_timer *cdp1864_int_timer; | |
| 9 | static emu_timer *cdp1864_efx_timer; | |
| 10 | static emu_timer *cdp1864_dma_timer; | |
| 11 | 11 | |
| 12 | 12 | typedef struct |
| 13 | 13 | { |
| r1293 | r1294 | |
| 38 | 38 | cdp1864.dmaptr = 0; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | | |
| 41 | | |
| 42 | 42 | } |
| 43 | 43 | else |
| 44 | 44 | { |
| r1293 | r1294 | |
| 47 | 47 | cpunum_set_input_line(0, CDP1802_INPUT_LINE_INT, CLEAR_LINE); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | | |
| 50 | | |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| r1293 | r1294 | |
| 59 | 59 | { |
| 60 | 60 | case CDP1864_SCANLINE_EFX_TOP_START: |
| 61 | 61 | cdp1864_efx = ASSERT_LINE; |
| 62 | | |
| 62 | | |
| 63 | 63 | break; |
| 64 | 64 | |
| 65 | 65 | case CDP1864_SCANLINE_EFX_TOP_END: |
| 66 | 66 | cdp1864_efx = CLEAR_LINE; |
| 67 | | |
| 67 | | |
| 68 | 68 | break; |
| 69 | 69 | |
| 70 | 70 | case CDP1864_SCANLINE_EFX_BOTTOM_START: |
| 71 | 71 | cdp1864_efx = ASSERT_LINE; |
| 72 | | |
| 72 | | |
| 73 | 73 | break; |
| 74 | 74 | |
| 75 | 75 | case CDP1864_SCANLINE_EFX_BOTTOM_END: |
| 76 | 76 | cdp1864_efx = CLEAR_LINE; |
| 77 | | |
| 77 | | |
| 78 | 78 | break; |
| 79 | 79 | } |
| 80 | 80 | } |
| r1293 | r1294 | |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | | |
| 96 | | |
| 97 | 97 | |
| 98 | 98 | cdp1864.dmaout = 0; |
| 99 | 99 | } |
| r1293 | r1294 | |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | | |
| 110 | | |
| 111 | 111 | |
| 112 | 112 | cdp1864.dmaout = 1; |
| 113 | 113 | } |
| r1293 | r1294 | |
| 178 | 178 | |
| 179 | 179 | MACHINE_RESET( cdp1864 ) |
| 180 | 180 | { |
| 181 | mame_timer_adjust(cdp1864_int_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_INT_START, 0), 0, time_zero); | |
| 182 | mame_timer_adjust(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_TOP_START, 0), 0, time_zero); | |
| 183 | mame_timer_adjust(cdp1864_dma_timer, MAME_TIME_IN_CYCLES(CDP1864_CYCLES_DMA_START, 0), 0, time_zero); | |
| 181 | timer_adjust(cdp1864_int_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_INT_START, 0), 0, attotime_zero); | |
| 182 | timer_adjust(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_TOP_START, 0), 0, attotime_zero); | |
| 183 | timer_adjust(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_START, 0), 0, attotime_zero); | |
| 184 | 184 | |
| 185 | 185 | cdp1864.disp = 0; |
| 186 | 186 | cdp1864.dmaout = 0; |
| r1293 | r1294 | |
| 196 | 196 | |
| 197 | 197 | VIDEO_START( cdp1864 ) |
| 198 | 198 | { |
| 199 | cdp1864_int_timer = mame_timer_alloc(cdp1864_int_tick); | |
| 200 | cdp1864_efx_timer = mame_timer_alloc(cdp1864_efx_tick); | |
| 201 | cdp1864_dma_timer = mame_timer_alloc(cdp1864_dma_tick); | |
| 199 | cdp1864_int_timer = timer_alloc(cdp1864_int_tick); | |
| 200 | cdp1864_efx_timer = timer_alloc(cdp1864_efx_tick); | |
| 201 | cdp1864_dma_timer = timer_alloc(cdp1864_dma_tick); | |
| 202 | 202 | |
| 203 | 203 | /* allocate the temporary bitmap */ |
| 204 | 204 | cdptmpbitmap = auto_bitmap_alloc(Machine->screen[0].width, Machine->screen[0].height, Machine->screen[0].format); |
| r1293 | r1294 | |
|---|---|---|
| 1319 | 1319 | if (LIGHTPEN_BUTTON) |
| 1320 | 1320 | { |
| 1321 | 1321 | /* lightpen timer starten */ |
| 1322 | | |
| 1322 | | |
| 1323 | 1323 | } |
| 1324 | 1324 | } |
| 1325 | 1325 | if (vic2.rasterline == C64_2_RASTERLINE (RASTERLINE)) |
| r1293 | r1294 | |
|---|---|---|
| 152 | 152 | |
| 153 | 153 | static UINT8 collision[8]; /* only 7 used but easier to index */ |
| 154 | 154 | static int line; |
| 155 | static | |
| 155 | static | |
| 156 | 156 | static UINT32 o2_snd_shift[2]; |
| 157 | 157 | static UINT8 x_beam_pos; |
| 158 | 158 | static UINT8 y_beam_pos; |
| r1293 | r1294 | |
| 176 | 176 | INLINE int get_horiz_clock_beam_pos( void ) |
| 177 | 177 | { |
| 178 | 178 | int h; |
| 179 | h = | |
| 179 | h = | |
| 180 | 180 | |
| 181 | 181 | return h; |
| 182 | 182 | } |
| r1293 | r1294 | |
| 184 | 184 | INLINE int get_horiz_clock( void ) |
| 185 | 185 | { |
| 186 | 186 | int h; |
| 187 | h = | |
| 187 | h = | |
| 188 | 188 | |
| 189 | 189 | return h; |
| 190 | 190 | } |
| r1293 | r1294 | |
| 317 | 317 | |
| 318 | 318 | INTERRUPT_GEN( odyssey2_line ) |
| 319 | 319 | { |
| 320 | line_time = | |
| 320 | line_time = | |
| 321 | 321 | line = (line + 1) % 262; |
| 322 | 322 | |
| 323 | 323 | switch (line) |
| r1293 | r1294 | |
|---|---|---|
| 790 | 790 | { |
| 791 | 791 | if (m6845_vsync_clear_timer!=NULL) |
| 792 | 792 | { |
| 793 | | |
| 793 | | |
| 794 | 794 | m6845_vsync_clear_timer = NULL; |
| 795 | 795 | } |
| 796 | 796 | } |
| r1293 | r1294 | |
| 808 | 808 | |
| 809 | 809 | if (crtc_cycles_to_vsync_start!=-1) |
| 810 | 810 | { |
| 811 | m6845_vsync_set_timer = | |
| 811 | m6845_vsync_set_timer = | |
| 812 | 812 | } |
| 813 | 813 | } |
| 814 | 814 | |
| r1293 | r1294 | |
| 824 | 824 | |
| 825 | 825 | if (crtc_cycles_to_vsync_end!=-1) |
| 826 | 826 | { |
| 827 | m6845_vsync_clear_timer = | |
| 827 | m6845_vsync_clear_timer = | |
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | |
| r1293 | r1294 | |
| 847 | 847 | m6845_set_new_vsync_set_time(m6845_cycles_per_frame()-m6845_vsync_length_in_cycles()); |
| 848 | 848 | |
| 849 | 849 | /* prevent timer from being free'd and don't let it trigger again */ |
| 850 | | |
| 850 | | |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | /* called when vsync is set */ |
| r1293 | r1294 | |
| 868 | 868 | m6845_set_new_vsync_clear_time(m6845_vsync_length_in_cycles()); |
| 869 | 869 | |
| 870 | 870 | /* prevent timer from being free'd and don't let it trigger again */ |
| 871 | | |
| 871 | | |
| 872 | 872 | } |
| 873 | 873 | static void m6845_recalc_cycles_to_vsync_end(void) |
| 874 | 874 | { |
| r1293 | r1294 | |
|---|---|---|
| 465 | 465 | int new_flash; |
| 466 | 466 | UINT32 new_a2; |
| 467 | 467 | |
| 468 | new_flash = ( | |
| 468 | new_flash = ( | |
| 469 | 469 | if (flash != new_flash) |
| 470 | 470 | { |
| 471 | 471 | flash = new_flash; |
| r1293 | r1294 | |
|---|---|---|
| 378 | 378 | #define TIMER2 (TIMER2HELPER?TIMER2HELPER:0x10000) |
| 379 | 379 | #define TIMER3 (TIMER3HELPER?TIMER3HELPER:0x10000) |
| 380 | 380 | |
| 381 | static | |
| 381 | static | |
| 382 | 382 | { |
| 383 | 383 | double d = (double)(cycles)/TED7360_CLOCK; |
| 384 | return double_to_ | |
| 384 | return double_to_ | |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | static int TEDTIME_TO_CYCLES( | |
| 387 | static int TEDTIME_TO_CYCLES( | |
| 388 | 388 | { |
| 389 | double d = | |
| 389 | double d = | |
| 390 | 390 | return (int)((d)*TED7360_CLOCK); |
| 391 | 391 | } |
| 392 | 392 | |
| r1293 | r1294 | |
| 493 | 493 | |
| 494 | 494 | static int lines; |
| 495 | 495 | static int timer1_active, timer2_active, timer3_active; |
| 496 | static | |
| 496 | static | |
| 497 | 497 | static int cursor1 = FALSE; |
| 498 | 498 | static read8_handler vic_dma_read; |
| 499 | 499 | static read8_handler vic_dma_read_rom; |
| r1293 | r1294 | |
| 534 | 534 | lines = TED7360_LINES; |
| 535 | 535 | chargenaddr = bitmapaddr = videoaddr = 0; |
| 536 | 536 | timer1_active = timer2_active = timer3_active = 0; |
| 537 | timer1 = mame_timer_alloc(ted7360_timer_timeout); | |
| 538 | timer2 = mame_timer_alloc(ted7360_timer_timeout); | |
| 539 | timer3 = mame_timer_alloc(ted7360_timer_timeout); | |
| 537 | timer1 = timer_alloc(ted7360_timer_timeout); | |
| 538 | timer2 = timer_alloc(ted7360_timer_timeout); | |
| 539 | timer3 = timer_alloc(ted7360_timer_timeout); | |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | void ted7360_set_dma (read8_handler dma_read, |
| r1293 | r1294 | |
| 576 | 576 | |
| 577 | 577 | static int ted7360_rastercolumn (void) |
| 578 | 578 | { |
| 579 | return (int) (( | |
| 579 | return (int) (( | |
| 580 | 580 | * TED7360_VRETRACERATE * lines * 57 * 8 + 0.5); |
| 581 | 581 | } |
| 582 | 582 | |
| r1293 | r1294 | |
| 588 | 588 | { |
| 589 | 589 | case 1: |
| 590 | 590 | // prooved by digisound of several intros like eoroidpro |
| 591 | | |
| 591 | | |
| 592 | 592 | timer1_active = 1; |
| 593 | 593 | ted7360_set_interrupt (8); |
| 594 | 594 | break; |
| 595 | 595 | case 2: |
| 596 | | |
| 596 | | |
| 597 | 597 | timer2_active = 1; |
| 598 | 598 | ted7360_set_interrupt (0x10); |
| 599 | 599 | break; |
| 600 | 600 | case 3: |
| 601 | | |
| 601 | | |
| 602 | 602 | timer3_active = 1; |
| 603 | 603 | ted7360_set_interrupt (0x40); |
| 604 | 604 | break; |
| r1293 | r1294 | |
| 644 | 644 | ted7360[offset] = data; |
| 645 | 645 | if (timer1_active) |
| 646 | 646 | { |
| 647 | ted7360[1] = TEDTIME_TO_CYCLES (mame_timer_timeleft (timer1)) >> 8; | |
| 648 | mame_timer_reset(timer1, time_never); | |
| 647 | ted7360[1] = TEDTIME_TO_CYCLES (timer_timeleft (timer1)) >> 8; | |
| 648 | timer_reset(timer1, attotime_never); | |
| 649 | 649 | timer1_active = 0; |
| 650 | 650 | } |
| 651 | 651 | break; |
| 652 | 652 | case 1: /* start timer 1 */ |
| 653 | 653 | ted7360[offset] = data; |
| 654 | | |
| 654 | | |
| 655 | 655 | timer1_active = 1; |
| 656 | 656 | break; |
| 657 | 657 | case 2: /* stop timer 2 */ |
| 658 | 658 | ted7360[offset] = data; |
| 659 | 659 | if (timer2_active) |
| 660 | 660 | { |
| 661 | ted7360[3] = TEDTIME_TO_CYCLES (mame_timer_timeleft (timer2)) >> 8; | |
| 662 | mame_timer_reset(timer2, time_never); | |
| 661 | ted7360[3] = TEDTIME_TO_CYCLES (timer_timeleft (timer2)) >> 8; | |
| 662 | timer_reset(timer2, attotime_never); | |
| 663 | 663 | timer2_active = 0; |
| 664 | 664 | } |
| 665 | 665 | break; |
| 666 | 666 | case 3: /* start timer 2 */ |
| 667 | 667 | ted7360[offset] = data; |
| 668 | | |
| 668 | | |
| 669 | 669 | timer2_active = 1; |
| 670 | 670 | break; |
| 671 | 671 | case 4: /* stop timer 3 */ |
| 672 | 672 | ted7360[offset] = data; |
| 673 | 673 | if (timer3_active) |
| 674 | 674 | { |
| 675 | ted7360[5] = TEDTIME_TO_CYCLES (mame_timer_timeleft (timer3)) >> 8; | |
| 676 | mame_timer_reset(timer3, time_never); | |
| 675 | ted7360[5] = TEDTIME_TO_CYCLES (timer_timeleft (timer3)) >> 8; | |
| 676 | timer_reset(timer3, attotime_never); | |
| 677 | 677 | timer3_active = 0; |
| 678 | 678 | } |
| 679 | 679 | break; |
| 680 | 680 | case 5: /* start timer 3 */ |
| 681 | 681 | ted7360[offset] = data; |
| 682 | | |
| 682 | | |
| 683 | 683 | timer3_active = 1; |
| 684 | 684 | break; |
| 685 | 685 | case 6: |
| r1293 | r1294 | |
| 858 | 858 | { |
| 859 | 859 | case 0: |
| 860 | 860 | if (timer1) |
| 861 | val = TEDTIME_TO_CYCLES ( | |
| 861 | val = TEDTIME_TO_CYCLES ( | |
| 862 | 862 | else |
| 863 | 863 | val = ted7360[offset]; |
| 864 | 864 | break; |
| 865 | 865 | case 1: |
| 866 | 866 | if (timer1) |
| 867 | val = TEDTIME_TO_CYCLES ( | |
| 867 | val = TEDTIME_TO_CYCLES ( | |
| 868 | 868 | else |
| 869 | 869 | val = ted7360[offset]; |
| 870 | 870 | break; |
| 871 | 871 | case 2: |
| 872 | 872 | if (timer2) |
| 873 | val = TEDTIME_TO_CYCLES ( | |
| 873 | val = TEDTIME_TO_CYCLES ( | |
| 874 | 874 | else |
| 875 | 875 | val = ted7360[offset]; |
| 876 | 876 | break; |
| 877 | 877 | case 3: |
| 878 | 878 | if (timer2) |
| 879 | val = TEDTIME_TO_CYCLES ( | |
| 879 | val = TEDTIME_TO_CYCLES ( | |
| 880 | 880 | else |
| 881 | 881 | val = ted7360[offset]; |
| 882 | 882 | break; |
| 883 | 883 | case 4: |
| 884 | 884 | if (timer3) |
| 885 | val = TEDTIME_TO_CYCLES ( | |
| 885 | val = TEDTIME_TO_CYCLES ( | |
| 886 | 886 | else |
| 887 | 887 | val = ted7360[offset]; |
| 888 | 888 | break; |
| 889 | 889 | case 5: |
| 890 | 890 | if (timer3) |
| 891 | val = TEDTIME_TO_CYCLES ( | |
| 891 | val = TEDTIME_TO_CYCLES ( | |
| 892 | 892 | else |
| 893 | 893 | val = ted7360[offset]; |
| 894 | 894 | break; |
| r1293 | r1294 | |
| 1210 | 1210 | INTERRUPT_GEN( ted7360_raster_interrupt ) |
| 1211 | 1211 | { |
| 1212 | 1212 | rasterline++; |
| 1213 | rastertime = | |
| 1213 | rastertime = | |
| 1214 | 1214 | if (rasterline >= lines) |
| 1215 | 1215 | { |
| 1216 | 1216 | rasterline = 0; |
| r1293 | r1294 | |
|---|---|---|
| 240 | 240 | |
| 241 | 241 | MACHINE_DRIVER_START( vh_saa5050 ) |
| 242 | 242 | MDRV_SCREEN_REFRESH_RATE(50) |
| 243 | MDRV_SCREEN_VBLANK_TIME( | |
| 243 | MDRV_SCREEN_VBLANK_TIME(A | |
| 244 | 244 | MDRV_INTERLEAVE(1) |
| 245 | 245 | |
| 246 | 246 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| r1293 | r1294 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | static mame_bitmap *cdptmpbitmap; |
| 7 | 7 | |
| 8 | static mame_timer *cdp1861_int_timer; | |
| 9 | static mame_timer *cdp1861_efx_timer; | |
| 10 | static mame_timer *cdp1861_dma_timer; | |
| 8 | static emu_timer *cdp1861_int_timer; | |
| 9 | static emu_timer *cdp1861_efx_timer; | |
| 10 | static emu_timer *cdp1861_dma_timer; | |
| 11 | 11 | |
| 12 | 12 | typedef struct |
| 13 | 13 | { |
| r1293 | r1294 | |
| 30 | 30 | cpunum_set_input_line(0, CDP1802_INPUT_LINE_INT, HOLD_LINE); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | | |
| 33 | | |
| 34 | 34 | } |
| 35 | 35 | else |
| 36 | 36 | { |
| r1293 | r1294 | |
| 39 | 39 | cpunum_set_input_line(0, CDP1802_INPUT_LINE_INT, CLEAR_LINE); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | | |
| 42 | | |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| r1293 | r1294 | |
| 51 | 51 | { |
| 52 | 52 | case CDP1861_SCANLINE_EFX_TOP_START: |
| 53 | 53 | cdp1861_efx = ASSERT_LINE; |
| 54 | | |
| 54 | | |
| 55 | 55 | break; |
| 56 | 56 | |
| 57 | 57 | case CDP1861_SCANLINE_EFX_TOP_END: |
| 58 | 58 | cdp1861_efx = CLEAR_LINE; |
| 59 | | |
| 59 | | |
| 60 | 60 | break; |
| 61 | 61 | |
| 62 | 62 | case CDP1861_SCANLINE_EFX_BOTTOM_START: |
| 63 | 63 | cdp1861_efx = ASSERT_LINE; |
| 64 | | |
| 64 | | |
| 65 | 65 | break; |
| 66 | 66 | |
| 67 | 67 | case CDP1861_SCANLINE_EFX_BOTTOM_END: |
| 68 | 68 | cdp1861_efx = CLEAR_LINE; |
| 69 | | |
| 69 | | |
| 70 | 70 | break; |
| 71 | 71 | } |
| 72 | 72 | } |
| r1293 | r1294 | |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | | |
| 88 | | |
| 89 | 89 | |
| 90 | 90 | cdp1861.dmaout = 0; |
| 91 | 91 | } |
| r1293 | r1294 | |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | | |
| 102 | | |
| 103 | 103 | |
| 104 | 104 | cdp1861.dmaout = 1; |
| 105 | 105 | } |
| r1293 | r1294 | |
| 121 | 121 | |
| 122 | 122 | MACHINE_RESET( cdp1861 ) |
| 123 | 123 | { |
| 124 | mame_timer_adjust(cdp1861_int_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_INT_START, 0), 0, time_zero); | |
| 125 | mame_timer_adjust(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_TOP_START, 0), 0, time_zero); | |
| 126 | mame_timer_adjust(cdp1861_dma_timer, MAME_TIME_IN_CYCLES(CDP1861_CYCLES_DMA_START, 0), 0, time_zero); | |
| 124 | timer_adjust(cdp1861_int_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_INT_START, 0), 0, attotime_zero); | |
| 125 | timer_adjust(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_TOP_START, 0), 0, attotime_zero); | |
| 126 | timer_adjust(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_START, 0), 0, attotime_zero); | |
| 127 | 127 | |
| 128 | 128 | cdp1861.disp = 0; |
| 129 | 129 | cdp1861.dmaout = 0; |
| r1293 | r1294 | |
| 149 | 149 | |
| 150 | 150 | VIDEO_START( cdp1861 ) |
| 151 | 151 | { |
| 152 | cdp1861_int_timer = mame_timer_alloc(cdp1861_int_tick); | |
| 153 | cdp1861_efx_timer = mame_timer_alloc(cdp1861_efx_tick); | |
| 154 | cdp1861_dma_timer = mame_timer_alloc(cdp1861_dma_tick); | |
| 152 | cdp1861_int_timer = timer_alloc(cdp1861_int_tick); | |
| 153 | cdp1861_efx_timer = timer_alloc(cdp1861_efx_tick); | |
| 154 | cdp1861_dma_timer = timer_alloc(cdp1861_dma_tick); | |
| 155 | 155 | |
| 156 | 156 | /* allocate the temporary bitmap */ |
| 157 | 157 | cdptmpbitmap = auto_bitmap_alloc(Machine->screen[0].width, Machine->screen[0].height, Machine->screen[0].format); |
| r1293 | r1294 | |
|---|---|---|
| 110 | 110 | /* set new blink state - record blink state in event list */ |
| 111 | 111 | void kc85_video_set_blink_state(int data) |
| 112 | 112 | { |
| 113 | EventList_AddItemOffset(KC85_VIDEO_EVENT_SET_BLINK_STATE, ((data & 0x01)<<7), | |
| 113 | EventList_AddItemOffset(KC85_VIDEO_EVENT_SET_BLINK_STATE, ((data & 0x01)<<7), | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| r1293 | r1294 | |
| 551 | 551 | /* process remainder */ |
| 552 | 552 | kc85_common_vh_process_lines(&video_update, cycles_remaining_in_frame); |
| 553 | 553 | EventList_Reset(); |
| 554 | EventList_SetOffsetStartTime ( | |
| 554 | EventList_SetOffsetStartTime ( | |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | |
| r1293 | r1294 | |
| 574 | 574 | { |
| 575 | 575 | pItem = EventList_GetFirstItem(); |
| 576 | 576 | EventList_Reset(); |
| 577 | EventList_SetOffsetStartTime ( | |
| 577 | EventList_SetOffsetStartTime ( | |
| 578 | 578 | logerror ("Event log reset in callback fn.\n"); |
| 579 | 579 | } |
| 580 | 580 | } |
| r1293 | r1294 | |
|---|---|---|
| 561 | 561 | |
| 562 | 562 | static mess_input_code *codes; |
| 563 | 563 | static key_buffer *keybuffer; |
| 564 | static | |
| 564 | static | |
| 565 | 565 | static int (*queue_chars)(const unicode_char *text, size_t text_len); |
| 566 | 566 | static int (*accept_char)(unicode_char ch); |
| 567 | 567 | static int (*charqueue_empty)(void); |
| 568 | static | |
| 568 | static | |
| 569 | 569 | |
| 570 | 570 | static TIMER_CALLBACK(inputx_timerproc); |
| 571 | 571 | |
| r1293 | r1294 | |
| 582 | 582 | |
| 583 | 583 | static void setup_keybuffer(void) |
| 584 | 584 | { |
| 585 | inputx_timer = | |
| 585 | inputx_timer = | |
| 586 | 586 | keybuffer = auto_malloc(sizeof(key_buffer)); |
| 587 | 587 | memset(keybuffer, 0, sizeof(*keybuffer)); |
| 588 | 588 | } |
| r1293 | r1294 | |
| 733 | 733 | |
| 734 | 734 | |
| 735 | 735 | |
| 736 | static | |
| 736 | static | |
| 737 | 737 | { |
| 738 | | |
| 738 | attoseconds_t delay = 0; | |
| 739 | 739 | |
| 740 | if ( | |
| 740 | if ( | |
| 741 | 741 | return current_rate; |
| 742 | 742 | |
| 743 | 743 | if (queue_chars) |
| 744 | 744 | { |
| 745 | 745 | /* systems with queue_chars can afford a much smaller delay */ |
| 746 | delay = DOUBLE_TO_ | |
| 746 | delay = DOUBLE_TO_ATTOSECONDS(0.01); | |
| 747 | 747 | } |
| 748 | 748 | else |
| 749 | 749 | { |
| 750 | 750 | switch(ch) { |
| 751 | 751 | case '\r': |
| 752 | delay = DOUBLE_TO_ | |
| 752 | delay = DOUBLE_TO_ATTOSECONDS(0.2); | |
| 753 | 753 | break; |
| 754 | 754 | |
| 755 | 755 | default: |
| 756 | delay = DOUBLE_TO_ | |
| 756 | delay = DOUBLE_TO_ATTOSECONDS(0.05); | |
| 757 | 757 | break; |
| 758 | 758 | } |
| 759 | 759 | } |
| 760 | return | |
| 760 | return | |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | |
| r1293 | r1294 | |
| 771 | 771 | /* need to start up the timer? */ |
| 772 | 772 | if (keybuf->begin_pos == keybuf->end_pos) |
| 773 | 773 | { |
| 774 | | |
| 774 | | |
| 775 | 775 | keybuf->status_keydown = 0; |
| 776 | 776 | } |
| 777 | 777 | |
| r1293 | r1294 | |
| 790 | 790 | |
| 791 | 791 | |
| 792 | 792 | |
| 793 | void inputx_postn_rate(const unicode_char *text, size_t text_len, | |
| 793 | void inputx_postn_rate(const unicode_char *text, size_t text_len, | |
| 794 | 794 | { |
| 795 | 795 | int last_cr = 0; |
| 796 | 796 | unicode_char ch; |
| r1293 | r1294 | |
| 852 | 852 | static TIMER_CALLBACK(inputx_timerproc) |
| 853 | 853 | { |
| 854 | 854 | key_buffer *keybuf; |
| 855 | | |
| 855 | | |
| 856 | 856 | |
| 857 | 857 | keybuf = get_buffer(); |
| 858 | 858 | |
| r1293 | r1294 | |
| 864 | 864 | keybuf->begin_pos++; |
| 865 | 865 | keybuf->begin_pos %= sizeof(keybuf->buffer) / sizeof(keybuf->buffer[0]); |
| 866 | 866 | |
| 867 | if ( | |
| 867 | if ( | |
| 868 | 868 | break; |
| 869 | 869 | } |
| 870 | 870 | } |
| r1293 | r1294 | |
| 887 | 887 | if (keybuf->begin_pos != keybuf->end_pos) |
| 888 | 888 | { |
| 889 | 889 | delay = choose_delay(keybuf->buffer[keybuf->begin_pos]); |
| 890 | | |
| 890 | | |
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | |
| r1293 | r1294 | |
| 1008 | 1008 | |
| 1009 | 1009 | ***************************************************************************/ |
| 1010 | 1010 | |
| 1011 | void inputx_postn_coded_rate(const char *text, size_t text_len, | |
| 1011 | void inputx_postn_coded_rate(const char *text, size_t text_len, | |
| 1012 | 1012 | { |
| 1013 | 1013 | size_t i, j, key_len, increment; |
| 1014 | 1014 | unicode_char ch; |
| r1293 | r1294 | |
| 1087 | 1087 | |
| 1088 | 1088 | void inputx_postn(const unicode_char *text, size_t text_len) |
| 1089 | 1089 | { |
| 1090 | inputx_postn_rate(text, text_len, | |
| 1090 | inputx_postn_rate(text, text_len, | |
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | |
| 1094 | 1094 | |
| 1095 | void inputx_post_rate(const unicode_char *text, | |
| 1095 | void inputx_post_rate(const unicode_char *text, | |
| 1096 | 1096 | { |
| 1097 | 1097 | size_t len = 0; |
| 1098 | 1098 | while(text[len]) |
| r1293 | r1294 | |
| 1104 | 1104 | |
| 1105 | 1105 | void inputx_post(const unicode_char *text) |
| 1106 | 1106 | { |
| 1107 | inputx_post_rate(text, | |
| 1107 | inputx_post_rate(text, | |
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | 1110 | |
| 1111 | 1111 | |
| 1112 | void inputx_postc_rate(unicode_char ch, | |
| 1112 | void inputx_postc_rate(unicode_char ch, | |
| 1113 | 1113 | { |
| 1114 | 1114 | inputx_postn_rate(&ch, 1, rate); |
| 1115 | 1115 | } |
| r1293 | r1294 | |
| 1118 | 1118 | |
| 1119 | 1119 | void inputx_postc(unicode_char ch) |
| 1120 | 1120 | { |
| 1121 | inputx_postc_rate(ch, | |
| 1121 | inputx_postc_rate(ch, | |
| 1122 | 1122 | } |
| 1123 | 1123 | |
| 1124 | 1124 | |
| 1125 | 1125 | |
| 1126 | void inputx_postn_utf16_rate(const utf16_char *text, size_t text_len, | |
| 1126 | void inputx_postn_utf16_rate(const utf16_char *text, size_t text_len, | |
| 1127 | 1127 | { |
| 1128 | 1128 | size_t len = 0; |
| 1129 | 1129 | unicode_char c; |
| r1293 | r1294 | |
| 1180 | 1180 | |
| 1181 | 1181 | void inputx_postn_utf16(const utf16_char *text, size_t text_len) |
| 1182 | 1182 | { |
| 1183 | inputx_postn_utf16_rate(text, text_len, | |
| 1183 | inputx_postn_utf16_rate(text, text_len, | |
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | |
| 1187 | 1187 | |
| 1188 | void inputx_post_utf16_rate(const utf16_char *text, | |
| 1188 | void inputx_post_utf16_rate(const utf16_char *text, | |
| 1189 | 1189 | { |
| 1190 | 1190 | size_t len = 0; |
| 1191 | 1191 | while(text[len]) |
| r1293 | r1294 | |
| 1197 | 1197 | |
| 1198 | 1198 | void inputx_post_utf16(const utf16_char *text) |
| 1199 | 1199 | { |
| 1200 | inputx_post_utf16_rate(text, | |
| 1200 | inputx_post_utf16_rate(text, | |
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | |
| 1204 | 1204 | |
| 1205 | void inputx_postn_utf8_rate(const char *text, size_t text_len, | |
| 1205 | void inputx_postn_utf8_rate(const char *text, size_t text_len, | |
| 1206 | 1206 | { |
| 1207 | 1207 | size_t len = 0; |
| 1208 | 1208 | unicode_char buf[256]; |
| r1293 | r1294 | |
| 1234 | 1234 | |
| 1235 | 1235 | void inputx_postn_utf8(const char *text, size_t text_len) |
| 1236 | 1236 | { |
| 1237 | inputx_postn_utf8_rate(text, text_len, | |
| 1237 | inputx_postn_utf8_rate(text, text_len, | |
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | 1240 | |
| 1241 | 1241 | |
| 1242 | void inputx_post_utf8_rate(const char *text, | |
| 1242 | void inputx_post_utf8_rate(const char *text, | |
| 1243 | 1243 | { |
| 1244 | 1244 | inputx_postn_utf8_rate(text, strlen(text), rate); |
| 1245 | 1245 | } |
| r1293 | r1294 | |
| 1248 | 1248 | |
| 1249 | 1249 | void inputx_post_utf8(const char *text) |
| 1250 | 1250 | { |
| 1251 | inputx_post_utf8_rate(text, | |
| 1251 | inputx_post_utf8_rate(text, | |
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | 1254 | |
| r1293 | r1294 | |
| 1260 | 1260 | |
| 1261 | 1261 | |
| 1262 | 1262 | |
| 1263 | void inputx_post_coded_rate(const char *text, | |
| 1263 | void inputx_post_coded_rate(const char *text, | |
| 1264 | 1264 | { |
| 1265 | 1265 | inputx_postn_coded_rate(text, strlen(text), rate); |
| 1266 | 1266 | } |
| r1293 | r1294 | |
| 1269 | 1269 | |
| 1270 | 1270 | void inputx_postn_coded(const char *text, size_t text_len) |
| 1271 | 1271 | { |
| 1272 | inputx_postn_coded_rate(text, text_len, | |
| 1272 | inputx_postn_coded_rate(text, text_len, | |
| 1273 | 1273 | } |
| 1274 | 1274 | |
| 1275 | 1275 |
| r1293 | r1294 | |
|---|---|---|
| 101 | 101 | |
| 102 | 102 | /* various posting functions; can be called from FEs */ |
| 103 | 103 | void inputx_post(const unicode_char *text); |
| 104 | void inputx_post_rate(const unicode_char *text, | |
| 104 | void inputx_post_rate(const unicode_char *text, | |
| 105 | 105 | void inputx_postc(unicode_char ch); |
| 106 | void inputx_postc_rate(unicode_char ch, | |
| 106 | void inputx_postc_rate(unicode_char ch, | |
| 107 | 107 | void inputx_postn(const unicode_char *text, size_t text_len); |
| 108 | void inputx_postn_rate(const unicode_char *text, size_t text_len, | |
| 108 | void inputx_postn_rate(const unicode_char *text, size_t text_len, | |
| 109 | 109 | void inputx_post_utf16(const utf16_char *text); |
| 110 | void inputx_post_utf16_rate(const utf16_char *text, | |
| 110 | void inputx_post_utf16_rate(const utf16_char *text, | |
| 111 | 111 | void inputx_postn_utf16(const utf16_char *text, size_t text_len); |
| 112 | void inputx_postn_utf16_rate(const utf16_char *text, size_t text_len, | |
| 112 | void inputx_postn_utf16_rate(const utf16_char *text, size_t text_len, | |
| 113 | 113 | void inputx_post_utf8(const char *text); |
| 114 | void inputx_post_utf8_rate(const char *text, | |
| 114 | void inputx_post_utf8_rate(const char *text, | |
| 115 | 115 | void inputx_postn_utf8(const char *text, size_t text_len); |
| 116 | void inputx_postn_utf8_rate(const char *text, size_t text_len, | |
| 116 | void inputx_postn_utf8_rate(const char *text, size_t text_len, | |
| 117 | 117 | void inputx_post_coded(const char *text); |
| 118 | void inputx_post_coded_rate(const char *text, | |
| 118 | void inputx_post_coded_rate(const char *text, | |
| 119 | 119 | void inputx_postn_coded(const char *text, size_t text_len); |
| 120 | void inputx_postn_coded_rate(const char *text, size_t text_len, | |
| 120 | void inputx_postn_coded_rate(const char *text, size_t text_len, | |
| 121 | 121 | |
| 122 | 122 | /* miscellaneous functions */ |
| 123 | 123 | int input_classify_port(const input_port_entry *in); |
| r1293 | r1294 | |
|---|---|---|
| 259 | 259 | |
| 260 | 260 | /* Set up RTC timer */ |
| 261 | 261 | if ( rtc.present ) { |
| 262 | | |
| 262 | | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | } |
| r1293 | r1294 | |
|---|---|---|
| 72 | 72 | { |
| 73 | 73 | if ((offset & 2) == 0) |
| 74 | 74 | { |
| 75 | | |
| 75 | | |
| 76 | 76 | |
| 77 | 77 | LOG_ZX81_IOW("ULA NMIs off"); |
| 78 | 78 | } |
| 79 | 79 | else if ((offset & 1) == 0) |
| 80 | 80 | { |
| 81 | | |
| 81 | | |
| 82 | 82 | |
| 83 | 83 | LOG_ZX81_IOW("ULA NMIs on"); |
| 84 | 84 | |
| r1293 | r1294 | |
| 145 | 145 | if ((cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) < -0.75) && zx_tape_bit) |
| 146 | 146 | { |
| 147 | 147 | zx_tape_bit = 0x00; |
| 148 | | |
| 148 | | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | data &= ~zx_tape_bit; |
| r1293 | r1294 | |
| 209 | 209 | if ((cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) < -0.75) && zx_tape_bit) |
| 210 | 210 | { |
| 211 | 211 | zx_tape_bit = 0x00; |
| 212 | | |
| 212 | | |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | data &= ~zx_tape_bit; |
| r1293 | r1294 | |
|---|---|---|
| 88 | 88 | int rby; /* 1-bit reader binary mode flip-flop */ |
| 89 | 89 | int rcp; /* 1-bit reader "need a completion pulse" flip-flop */ |
| 90 | 90 | |
| 91 | | |
| 91 | | |
| 92 | 92 | } tape_reader_t; |
| 93 | 93 | |
| 94 | 94 | static tape_reader_t tape_reader; |
| r1293 | r1294 | |
| 99 | 99 | { |
| 100 | 100 | mess_image *fd; /* file descriptor of tape image */ |
| 101 | 101 | |
| 102 | | |
| 102 | | |
| 103 | 103 | } tape_puncher_t; |
| 104 | 104 | |
| 105 | 105 | static tape_puncher_t tape_puncher; |
| r1293 | r1294 | |
| 112 | 112 | |
| 113 | 113 | int tb; /* typewriter buffer */ |
| 114 | 114 | |
| 115 | | |
| 115 | | |
| 116 | 116 | } typewriter_t; |
| 117 | 117 | |
| 118 | 118 | static typewriter_t typewriter; |
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | /* crt display timer */ |
| 122 | static | |
| 122 | static | |
| 123 | 123 | |
| 124 | 124 | /* light pen config */ |
| 125 | 125 | static lightpen_t lightpen; |
| r1293 | r1294 | |
| 138 | 138 | |
| 139 | 139 | int dba; |
| 140 | 140 | |
| 141 | mame_timer *rotation_timer; /* timer called each time dc is 0 */ | |
| 142 | mame_timer *il_timer; /* timer called each time dc is il */ | |
| 141 | emu_timer *rotation_timer; /* timer called each time dc is 0 */ | |
| 142 | emu_timer *il_timer; /* timer called each time dc is il */ | |
| 143 | 143 | } parallel_drum_t; |
| 144 | 144 | |
| 145 | 145 | static parallel_drum_t parallel_drum; |
| 146 | 146 | |
| 147 | #define PARALLEL_DRUM_WORD_TIME MAME_TIME_IN_NSEC(8500) | |
| 148 | #define PARALLEL_DRUM_ROTATION_TIME MAME_TIME_IN_NSEC(8500*4096) | |
| 147 | #define PARALLEL_DRUM_WORD_TIME ATTOTIME_IN_NSEC(8500) | |
| 148 | #define PARALLEL_DRUM_ROTATION_TIME ATTOTIME_IN_NSEC(8500*4096) | |
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | static OPBASE_HANDLER(setOPbasefunc) |
| r1293 | r1294 | |
| 164 | 164 | pdp1_reset_param.hw_mul_div = (config >> pdp1_config_hw_mul_div_bit) & pdp1_config_hw_mul_div_mask; |
| 165 | 165 | pdp1_reset_param.type_20_sbs = (config >> pdp1_config_type_20_sbs_bit) & pdp1_config_type_20_sbs_mask; |
| 166 | 166 | |
| 167 | tape_reader.timer = mame_timer_alloc(reader_callback); | |
| 168 | tape_puncher.timer = mame_timer_alloc(puncher_callback); | |
| 169 | typewriter.tyo_timer = mame_timer_alloc(tyo_callback); | |
| 170 | dpy_timer = mame_timer_alloc(dpy_callback); | |
| 167 | tape_reader.timer = timer_alloc(reader_callback); | |
| 168 | tape_puncher.timer = timer_alloc(puncher_callback); | |
| 169 | typewriter.tyo_timer = timer_alloc(tyo_callback); | |
| 170 | dpy_timer = timer_alloc(dpy_callback); | |
| 171 | 171 | |
| 172 | 172 | /* reset device state */ |
| 173 | 173 | tape_reader.rcl = tape_reader.rc = 0; |
| r1293 | r1294 | |
| 400 | 400 | /* restart reader IO when necessary */ |
| 401 | 401 | /* note that this function may be called before pdp1_init_machine, therefore |
| 402 | 402 | before tape_reader.timer is allocated. It does not matter, as the clutch is never |
| 403 | down at power-up, but we must not call | |
| 403 | down at power-up, but we must not call | |
| 404 | 404 | if (tape_reader.timer) |
| 405 | 405 | { |
| 406 | 406 | if (tape_reader.motor_on && tape_reader.rcl) |
| 407 | 407 | { |
| 408 | 408 | /* delay is approximately 1/400s */ |
| 409 | | |
| 409 | | |
| 410 | 410 | } |
| 411 | 411 | else |
| 412 | 412 | { |
| 413 | | |
| 413 | | |
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | break; |
| r1293 | r1294 | |
| 438 | 438 | tape_reader.motor_on = 0; |
| 439 | 439 | |
| 440 | 440 | if (tape_reader.timer) |
| 441 | | |
| 441 | | |
| 442 | 442 | break; |
| 443 | 443 | |
| 444 | 444 | case 1: |
| r1293 | r1294 | |
| 481 | 481 | |
| 482 | 482 | if (LOG_IOT_OVERLAP) |
| 483 | 483 | { |
| 484 | if ( | |
| 484 | if ( | |
| 485 | 485 | logerror("Error: overlapped perforated tape reads (Read-in mode, RPA/RPB instruction)\n"); |
| 486 | 486 | } |
| 487 | 487 | /* set up delay if tape is advancing */ |
| 488 | 488 | if (tape_reader.motor_on && tape_reader.rcl) |
| 489 | 489 | { |
| 490 | 490 | /* delay is approximately 1/400s */ |
| 491 | | |
| 491 | | |
| 492 | 492 | } |
| 493 | 493 | else |
| 494 | 494 | { |
| 495 | | |
| 495 | | |
| 496 | 496 | } |
| 497 | 497 | } |
| 498 | 498 | |
| r1293 | r1294 | |
| 541 | 541 | |
| 542 | 542 | if (tape_reader.motor_on && tape_reader.rcl) |
| 543 | 543 | /* delay is approximately 1/400s */ |
| 544 | | |
| 544 | | |
| 545 | 545 | else |
| 546 | | |
| 546 | | |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | /* |
| r1293 | r1294 | |
| 675 | 675 | /* delay is approximately 1/63.3 second */ |
| 676 | 676 | if (LOG_IOT_OVERLAP) |
| 677 | 677 | { |
| 678 | if ( | |
| 678 | if ( | |
| 679 | 679 | logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpunum_get_reg(0, PDP1_PC)); |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | | |
| 682 | | |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | /* |
| r1293 | r1294 | |
| 703 | 703 | /* delay is approximately 1/63.3 second */ |
| 704 | 704 | if (LOG_IOT_OVERLAP) |
| 705 | 705 | { |
| 706 | if ( | |
| 706 | if ( | |
| 707 | 707 | logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpunum_get_reg(0, PDP1_PC)); |
| 708 | 708 | } |
| 709 | | |
| 709 | | |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | |
| r1293 | r1294 | |
| 891 | 891 | } |
| 892 | 892 | if (LOG_IOT_OVERLAP) |
| 893 | 893 | { |
| 894 | if ( | |
| 894 | if ( | |
| 895 | 895 | logerror("Error: overlapped TYO instruction: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpunum_get_reg(0, PDP1_PC)); |
| 896 | 896 | } |
| 897 | 897 | |
| 898 | | |
| 898 | | |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | /* |
| r1293 | r1294 | |
| 1004 | 1004 | { |
| 1005 | 1005 | /* note that overlap detection is incomplete: it will only work if both DPY |
| 1006 | 1006 | instructions require a completion pulse */ |
| 1007 | if ( | |
| 1007 | if ( | |
| 1008 | 1008 | logerror("Error: overlapped DPY instruction: mb=0%06o, pc=0%06o\n", (unsigned) mb, (unsigned) cpunum_get_reg(0, PDP1_PC)); |
| 1009 | 1009 | } |
| 1010 | | |
| 1010 | | |
| 1011 | 1011 | } |
| 1012 | 1012 | } |
| 1013 | 1013 | |
| r1293 | r1294 | |
| 1019 | 1019 | |
| 1020 | 1020 | static void parallel_drum_set_il(int il) |
| 1021 | 1021 | { |
| 1022 | | |
| 1022 | | |
| 1023 | 1023 | |
| 1024 | 1024 | parallel_drum.il = il; |
| 1025 | 1025 | |
| 1026 | il_phase = sub_mame_times(scale_up_mame_time(PARALLEL_DRUM_WORD_TIME, il), mame_timer_timeelapsed(parallel_drum.rotation_timer)); | |
| 1027 | if (compare_mame_times(il_phase, time_zero) < 0) | |
| 1028 | il_phase = add_mame_times(il_phase, PARALLEL_DRUM_ROTATION_TIME); | |
| 1029 | mame_timer_adjust(parallel_drum.il_timer, il_phase, 0, PARALLEL_DRUM_ROTATION_TIME); | |
| 1026 | il_phase = attotime_sub(attotime_mul(PARALLEL_DRUM_WORD_TIME, il), timer_timeelapsed(parallel_drum.rotation_timer)); | |
| 1027 | if (attotime_compare(il_phase, attotime_zero) < 0) | |
| 1028 | il_phase = attotime_add(il_phase, PARALLEL_DRUM_ROTATION_TIME); | |
| 1029 | timer_adjust(parallel_drum.il_timer, il_phase, 0, PARALLEL_DRUM_ROTATION_TIME); | |
| 1030 | 1030 | } |
| 1031 | 1031 | |
| 1032 | 1032 | #ifdef UNUSED_FUNCTION |
| r1293 | r1294 | |
| 1041 | 1041 | |
| 1042 | 1042 | static void parallel_drum_init(void) |
| 1043 | 1043 | { |
| 1044 | parallel_drum.rotation_timer = mame_timer_alloc(NULL); | |
| 1045 | mame_timer_adjust(parallel_drum.rotation_timer, PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME); | |
| 1044 | parallel_drum.rotation_timer = timer_alloc(NULL); | |
| 1045 | timer_adjust(parallel_drum.rotation_timer, PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME); | |
| 1046 | 1046 | |
| 1047 | parallel_drum.il_timer = | |
| 1047 | parallel_drum.il_timer = | |
| 1048 | 1048 | parallel_drum_set_il(0); |
| 1049 | 1049 | } |
| 1050 | 1050 | #endif |
| r1293 | r1294 | |
| 1116 | 1116 | |
| 1117 | 1117 | void iot_dcc(int op2, int nac, int mb, int *io, int ac) |
| 1118 | 1118 | { |
| 1119 | | |
| 1119 | | |
| 1120 | 1120 | int dc; |
| 1121 | 1121 | |
| 1122 | 1122 | parallel_drum.rfb = ((*io) & 0370000) >> 12; |
| r1293 | r1294 | |
| 1128 | 1128 | /* clear status bit 5... */ |
| 1129 | 1129 | |
| 1130 | 1130 | /* do transfer */ |
| 1131 | delay = | |
| 1131 | delay = | |
| 1132 | 1132 | dc = parallel_drum.il; |
| 1133 | 1133 | do |
| 1134 | 1134 | { |
| r1293 | r1294 | |
| 1146 | 1146 | parallel_drum.wcl = (parallel_drum.wcl+1) & 0177777/*0007777???*/; |
| 1147 | 1147 | dc = (dc+1) & 07777; |
| 1148 | 1148 | if (parallel_drum.wc) |
| 1149 | delay = a | |
| 1149 | delay = a | |
| 1150 | 1150 | } while (parallel_drum.wc); |
| 1151 | activecpu_adjust_icount(- | |
| 1151 | activecpu_adjust_icount(- | |
| 1152 | 1152 | /* if no error, skip */ |
| 1153 | 1153 | cpunum_set_reg(0, PDP1_PC, cpunum_get_reg(0, PDP1_PC)+1); |
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | 1156 | void iot_dra(int op2, int nac, int mb, int *io, int ac) |
| 1157 | 1157 | { |
| 1158 | (*io) = scale_up_mame_time( | |
| 1159 | mame_timer_timeelapsed(parallel_drum.rotation_timer), | |
| 1160 | MAX_SUBSECONDS / (PARALLEL_DRUM_WORD_TIME.subseconds)).seconds & 0007777; | |
| 1158 | (*io) = attotime_mul( | |
| 1159 | timer_timeelapsed(parallel_drum.rotation_timer), | |
| 1160 | ATTOTIME_MAX_SECONDS / (attotime_to_attoseconds(PARALLEL_DRUM_WORD_TIME))).seconds & 0007777; | |
| 1161 | 1161 | |
| 1162 | 1162 | /* set parity error and timing error... */ |
| 1163 | 1163 | } |
| r1293 | r1294 | |
| 1232 | 1232 | { |
| 1233 | 1233 | tape_reader.rcl = tape_reader.rc = 0; |
| 1234 | 1234 | if (tape_reader.timer) |
| 1235 | | |
| 1235 | | |
| 1236 | 1236 | |
| 1237 | 1237 | if (tape_puncher.timer) |
| 1238 | | |
| 1238 | | |
| 1239 | 1239 | |
| 1240 | 1240 | if (typewriter.tyo_timer) |
| 1241 | | |
| 1241 | | |
| 1242 | 1242 | |
| 1243 | 1243 | if (dpy_timer) |
| 1244 | | |
| 1244 | | |
| 1245 | 1245 | |
| 1246 | 1246 | io_status = io_st_tyo | io_st_ptp; |
| 1247 | 1247 | } |
| r1293 | r1294 | |
|---|---|---|
| 109 | 109 | |
| 110 | 110 | int command; |
| 111 | 111 | |
| 112 | mame_timer *seek_timer; | |
| 113 | mame_timer *timer; | |
| 112 | emu_timer *seek_timer; | |
| 113 | emu_timer *timer; | |
| 114 | 114 | int timer_type; |
| 115 | 115 | |
| 116 | | |
| 116 | | |
| 117 | 117 | } NEC765; |
| 118 | 118 | |
| 119 | 119 | //static void nec765_setup_data_request(unsigned char Data); |
| r1293 | r1294 | |
| 313 | 313 | /* seek complete */ |
| 314 | 314 | nec765_seek_complete(); |
| 315 | 315 | |
| 316 | | |
| 316 | | |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | static TIMER_CALLBACK(nec765_timer_callback) |
| r1293 | r1294 | |
| 329 | 329 | if (!(fdc.nec765_flags & NEC765_DMA_MODE)) |
| 330 | 330 | { |
| 331 | 331 | /* for pcw */ |
| 332 | | |
| 332 | | |
| 333 | 333 | } |
| 334 | 334 | else |
| 335 | 335 | { |
| r1293 | r1294 | |
| 361 | 361 | |
| 362 | 362 | nec765_set_data_request(); |
| 363 | 363 | |
| 364 | | |
| 364 | | |
| 365 | 365 | } |
| 366 | 366 | else if (fdc.timer_type == 4) |
| 367 | 367 | { |
| r1293 | r1294 | |
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | | |
| 383 | | |
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | |
| r1293 | r1294 | |
| 390 | 390 | effectively disabled by reading the data before the NMI int can be set. |
| 391 | 391 | */ |
| 392 | 392 | |
| 393 | static void nec765_setup_timed_generic(int timer_type, | |
| 393 | static void nec765_setup_timed_generic(int timer_type, | |
| 394 | 394 | { |
| 395 | 395 | fdc.timer_type = timer_type; |
| 396 | 396 | |
| 397 | 397 | if (!(fdc.nec765_flags & NEC765_DMA_MODE)) |
| 398 | 398 | { |
| 399 | | |
| 399 | | |
| 400 | 400 | } |
| 401 | 401 | else |
| 402 | 402 | { |
| 403 | 403 | nec765_timer_callback(Machine, fdc.timer_type); |
| 404 | | |
| 404 | | |
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | |
| r1293 | r1294 | |
| 409 | 409 | static void nec765_setup_timed_data_request(int bytes) |
| 410 | 410 | { |
| 411 | 411 | /* setup timer to trigger in NEC765_DATA_RATE us */ |
| 412 | nec765_setup_timed_generic(0, | |
| 412 | nec765_setup_timed_generic(0, | |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | /* setup result data request */ |
| 416 | 416 | static void nec765_setup_timed_result_data_request(void) |
| 417 | 417 | { |
| 418 | nec765_setup_timed_generic(2, | |
| 418 | nec765_setup_timed_generic(2, | |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | |
| r1293 | r1294 | |
| 423 | 423 | static void nec765_setup_timed_int(int signed_tracks) |
| 424 | 424 | { |
| 425 | 425 | /* setup timer to signal after seek time is complete */ |
| 426 | | |
| 426 | | |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | static void nec765_seek_setup(int is_recalibrate) |
| r1293 | r1294 | |
| 673 | 673 | int i; |
| 674 | 674 | |
| 675 | 675 | fdc.version = version; |
| 676 | fdc.timer = mame_timer_alloc(nec765_timer_callback); | |
| 677 | fdc.seek_timer = mame_timer_alloc(nec765_seek_timer_callback); | |
| 678 | fdc.command_timer = mame_timer_alloc(nec765_continue_command); | |
| 676 | fdc.timer = timer_alloc(nec765_timer_callback); | |
| 677 | fdc.seek_timer = timer_alloc(nec765_seek_timer_callback); | |
| 678 | fdc.command_timer = timer_alloc(nec765_continue_command); | |
| 679 | 679 | memset(&nec765_iface, 0, sizeof(nec765_interface)); |
| 680 | 680 | |
| 681 | 681 | if (iface) |
| r1293 | r1294 | |
| 719 | 719 | { |
| 720 | 720 | if (fdc.timer_type==0) |
| 721 | 721 | { |
| 722 | | |
| 722 | | |
| 723 | 723 | |
| 724 | 724 | |
| 725 | 725 | } |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | #ifdef NO_END_OF_CYLINDER |
| 729 | | |
| 729 | | |
| 730 | 730 | #else |
| 731 | 731 | nec765_update_state(); |
| 732 | 732 | #endif |
| r1293 | r1294 | |
| 1599 | 1599 | |
| 1600 | 1600 | if ((fdc.nec765_transfer_bytes_remaining==0) || (fdc.nec765_flags & NEC765_TC)) |
| 1601 | 1601 | { |
| 1602 | | |
| 1602 | | |
| 1603 | 1603 | } |
| 1604 | 1604 | else |
| 1605 | 1605 | { |
| r1293 | r1294 | |
| 1667 | 1667 | |
| 1668 | 1668 | if ((fdc.nec765_transfer_bytes_remaining == 0) || (fdc.nec765_flags & NEC765_TC)) |
| 1669 | 1669 | { |
| 1670 | | |
| 1670 | | |
| 1671 | 1671 | } |
| 1672 | 1672 | else |
| 1673 | 1673 | { |
| r1293 | r1294 | |
|---|---|---|
| 35 | 35 | |
| 36 | 36 | void pc1401_outc(int data) |
| 37 | 37 | { |
| 38 | logerror("%g outc %.2x\n", | |
| 38 | logerror("%g outc %.2x\n", | |
| 39 | 39 | pc1401_portc=data; |
| 40 | 40 | } |
| 41 | 41 | |
| r1293 | r1294 | |
| 292 | 292 | #endif |
| 293 | 293 | for (i=0; i<128; i++) gfx[i]=i; |
| 294 | 294 | |
| 295 | | |
| 295 | | |
| 296 | 296 | |
| 297 | 297 | if (RAM10K) |
| 298 | 298 | { |
| r1293 | r1294 | |
|---|---|---|
| 146 | 146 | static INT8 apple2gs_mouse_dx; |
| 147 | 147 | static INT8 apple2gs_mouse_dy; |
| 148 | 148 | static mess_image *apple2gs_cur_slot6_image; |
| 149 | static | |
| 149 | static | |
| 150 | 150 | |
| 151 | 151 | |
| 152 | 152 | /* ----------------------------------------------------------------------- |
| r1293 | r1294 | |
| 178 | 178 | seconds_t current_interval; |
| 179 | 179 | |
| 180 | 180 | /* update clock_curtime */ |
| 181 | current_interval = | |
| 181 | current_interval = | |
| 182 | 182 | clock_curtime += current_interval - clock_curtime_interval; |
| 183 | 183 | clock_curtime_interval = current_interval; |
| 184 | 184 | |
| r1293 | r1294 | |
| 830 | 830 | apple2_interrupt(); |
| 831 | 831 | } |
| 832 | 832 | |
| 833 | | |
| 833 | | |
| 834 | 834 | |
| 835 | 835 | cpuintrf_pop_context(); |
| 836 | 836 | } |
| r1293 | r1294 | |
| 1717 | 1717 | |
| 1718 | 1718 | MACHINE_RESET( apple2gs ) |
| 1719 | 1719 | { |
| 1720 | apple2gs_scanline_timer = mame_timer_alloc(apple2gs_scanline_tick); | |
| 1721 | mame_timer_adjust(apple2gs_scanline_timer, time_never, 0, time_never); | |
| 1720 | apple2gs_scanline_timer = timer_alloc(apple2gs_scanline_tick); | |
| 1721 | timer_adjust(apple2gs_scanline_timer, attotime_never, 0, attotime_never); | |
| 1722 | 1722 | |
| 1723 | 1723 | // fire on scanline zero |
| 1724 | | |
| 1724 | | |
| 1725 | 1725 | } |
| 1726 | 1726 | |
| 1727 | 1727 | MACHINE_START( apple2gs ) |
| r1293 | r1294 | |
|---|---|---|
| 83 | 83 | }; |
| 84 | 84 | |
| 85 | 85 | static int iwm_mode; /* 0-31 */ |
| 86 | static | |
| 86 | static | |
| 87 | 87 | static struct applefdc_interface iwm_intf; |
| 88 | 88 | |
| 89 | 89 | static TIMER_CALLBACK(iwm_turnmotor_onoff); |
| r1293 | r1294 | |
| 101 | 101 | { |
| 102 | 102 | applefdc_lines = 0; |
| 103 | 103 | iwm_mode = 0x1f; /* default value needed by Lisa 2 - no, I don't know if it is true */ |
| 104 | motor_timer = | |
| 104 | motor_timer = | |
| 105 | 105 | if (intf) |
| 106 | 106 | iwm_intf = *intf; |
| 107 | 107 | else |
| r1293 | r1294 | |
| 308 | 308 | { |
| 309 | 309 | case 0x08: |
| 310 | 310 | /* Turn off motor */ |
| 311 | mame_timer_adjust(motor_timer, | |
| 312 | (iwm_mode & IWM_MODE_MOTOROFFDELAY) ? time_zero : MAME_TIME_IN_SEC(1), | |
| 311 | timer_adjust(motor_timer, | |
| 312 | (iwm_mode & IWM_MODE_MOTOROFFDELAY) ? attotime_zero : ATTOTIME_IN_SEC(1), | |
| 313 | 313 | 0, |
| 314 | time_zero); | |
| 314 | attotime_zero); | |
| 315 | 315 | break; |
| 316 | 316 | |
| 317 | 317 | case 0x09: |
| 318 | 318 | /* Turn on motor */ |
| 319 | | |
| 319 | | |
| 320 | 320 | break; |
| 321 | 321 | |
| 322 | 322 | case 0x0A: |
| r1293 | r1294 | |
|---|---|---|
| 450 | 450 | hp48_card1=memory_region(REGION_CPU1)+0x140000; |
| 451 | 451 | hp48_card2=memory_region(REGION_CPU1)+0x180000; |
| 452 | 452 | |
| 453 | | |
| 453 | | |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | DRIVER_INIT( hp48g ) |
| r1293 | r1294 | |
| 470 | 470 | hp48_card1=memory_region(REGION_CPU1)+0x140000; |
| 471 | 471 | hp48_card2=memory_region(REGION_CPU1)+0x180000; |
| 472 | 472 | |
| 473 | | |
| 473 | | |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | MACHINE_RESET( hp48 ) |
| r1293 | r1294 | |
|---|---|---|
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | #define LOG(LEVEL,N,M,A) \ |
| 21 | if( M )logerror("%11.6f: %-24s", | |
| 21 | if( M )logerror("%11.6f: %-24s", | |
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | //#define VERBOSE_COM 0 |
| r1293 | r1294 | |
| 316 | 316 | case 5: |
| 317 | 317 | |
| 318 | 318 | #if 0 |
| 319 | if (uart[n].send.active && ( | |
| 319 | if (uart[n].send.active && ( | |
| 320 | 320 | { |
| 321 | 321 | // currently polling is enough for pc1512 |
| 322 | 322 | uart[n].lsr |= 0x40; /* set TSRE */ |
| r1293 | r1294 | |
|---|---|---|
| 137 | 137 | ppi8255_init(&dai_ppi82555_intf); |
| 138 | 138 | pit8253_init(1, &dai_pit8253_intf); |
| 139 | 139 | |
| 140 | | |
| 140 | | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /*************************************************************************** |
| r1293 | r1294 | |
|---|---|---|
| 294 | 294 | |
| 295 | 295 | UINT16 status; |
| 296 | 296 | |
| 297 | | |
| 297 | | |
| 298 | 298 | int head,track,sector; |
| 299 | 299 | } c65_fdc= { 0 }; |
| 300 | 300 | |
| r1293 | r1294 | |
| 311 | 311 | { |
| 312 | 312 | switch (c65_fdc.state) { |
| 313 | 313 | case FDC_CMD_MOTOR_SPIN_UP: |
| 314 | if ( | |
| 314 | if ( | |
| 315 | 315 | c65_fdc.state=0; |
| 316 | 316 | c65_fdc.status&=~FDC_BUSY; |
| 317 | 317 | } |
| r1293 | r1294 | |
| 333 | 333 | case 0x20: // wait for motor spin up |
| 334 | 334 | c65_fdc.status&=~(FDC_IRQ|FDC_LOST|FDC_CRC|FDC_RNF); |
| 335 | 335 | c65_fdc.status|=FDC_BUSY; |
| 336 | c65_fdc.time= | |
| 336 | c65_fdc.time= | |
| 337 | 337 | c65_fdc.state=FDC_CMD_MOTOR_SPIN_UP; |
| 338 | 338 | break; |
| 339 | 339 | case 0: // cancel |
| r1293 | r1294 | |
|---|---|---|
| 65 | 65 | #endif |
| 66 | 66 | |
| 67 | 67 | static TIMER_CALLBACK(mac_scanline_tick); |
| 68 | static | |
| 68 | static | |
| 69 | 69 | static int scan_keyboard(void); |
| 70 | 70 | static TIMER_CALLBACK(inquiry_timeout_func); |
| 71 | 71 | static void keyboard_receive(int val); |
| r1293 | r1294 | |
| 267 | 267 | static int kbd_comm; |
| 268 | 268 | static int kbd_receive; |
| 269 | 269 | /* timer which is used to time out inquiry */ |
| 270 | static | |
| 270 | static | |
| 271 | 271 | |
| 272 | 272 | static int kbd_shift_reg; |
| 273 | 273 | static int kbd_shift_count; |
| r1293 | r1294 | |
| 445 | 445 | if (kbd_comm == TRUE) |
| 446 | 446 | { |
| 447 | 447 | kbd_shift_reg = data; |
| 448 | | |
| 448 | | |
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | |
| r1293 | r1294 | |
| 456 | 456 | /* Mac pulls CB2 down to initiate communication */ |
| 457 | 457 | kbd_comm = TRUE; |
| 458 | 458 | kbd_receive = TRUE; |
| 459 | | |
| 459 | | |
| 460 | 460 | } |
| 461 | 461 | if (kbd_comm == TRUE && kbd_receive == TRUE) |
| 462 | 462 | { |
| r1293 | r1294 | |
| 491 | 491 | if (keyboard_reply == 0x7B) |
| 492 | 492 | { |
| 493 | 493 | /* if NULL, wait until key pressed or timeout */ |
| 494 | mame_timer_adjust(inquiry_timeout, | |
| 495 | make_mame_time(0, DOUBLE_TO_SUBSECONDS(0.25)), | |
| 496 | 0, time_zero); | |
| 494 | timer_adjust(inquiry_timeout, | |
| 495 | attotime_make(0, DOUBLE_TO_ATTOSECONDS(0.25)), | |
| 496 | 0, attotime_zero); | |
| 497 | 497 | } |
| 498 | 498 | break; |
| 499 | 499 | |
| r1293 | r1294 | |
| 1327 | 1327 | mac_set_sound_buffer(0); |
| 1328 | 1328 | |
| 1329 | 1329 | if (mac_model == MODEL_MAC_SE) |
| 1330 | | |
| 1330 | | |
| 1331 | 1331 | |
| 1332 | mac_scanline_timer = mame_timer_alloc(mac_scanline_tick); | |
| 1333 | mame_timer_adjust(mac_scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_never); | |
| 1332 | mac_scanline_timer = timer_alloc(mac_scanline_tick); | |
| 1333 | timer_adjust(mac_scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_never); | |
| 1334 | 1334 | } |
| 1335 | 1335 | |
| 1336 | 1336 | |
| r1293 | r1294 | |
| 1365 | 1365 | /* setup keyboard */ |
| 1366 | 1366 | keyboard_init(); |
| 1367 | 1367 | |
| 1368 | inquiry_timeout = | |
| 1368 | inquiry_timeout = | |
| 1369 | 1369 | |
| 1370 | 1370 | cpuintrf_set_dasm_override(0, mac_dasm_override); |
| 1371 | 1371 | |
| r1293 | r1294 | |
| 1435 | 1435 | |
| 1436 | 1436 | logerror("keyboard enquiry successful, keycode %X\n", keycode); |
| 1437 | 1437 | |
| 1438 | | |
| 1438 | | |
| 1439 | 1439 | kbd_shift_out(keycode); |
| 1440 | 1440 | } |
| 1441 | 1441 | } |
| r1293 | r1294 | |
| 1474 | 1474 | if (!(scanline % 10)) |
| 1475 | 1475 | mouse_callback(); |
| 1476 | 1476 | |
| 1477 | | |
| 1477 | | |
| 1478 | 1478 | |
| 1479 | 1479 | cpuintrf_pop_context(); |
| 1480 | 1480 | } |
| r1293 | r1294 | |
|---|---|---|
| 45 | 45 | int bits; |
| 46 | 46 | UINT8 data_recv_index, data_recv[50]; |
| 47 | 47 | UINT8 mode, pos; |
| 48 | | |
| 48 | | |
| 49 | 49 | } PCF8593; |
| 50 | 50 | |
| 51 | 51 | static PCF8593 rtc; |
| r1293 | r1294 | |
| 56 | 56 | memset( &rtc, 0, sizeof( rtc)); |
| 57 | 57 | rtc.size = 16; |
| 58 | 58 | rtc.data = malloc( rtc.size); |
| 59 | rtc.timer = mame_timer_alloc( pcf8593_timer_callback ); | |
| 60 | mame_timer_adjust( rtc.timer, MAME_TIME_IN_SEC(1), 0, MAME_TIME_IN_SEC(1)); | |
| 59 | rtc.timer = timer_alloc( pcf8593_timer_callback ); | |
| 60 | timer_adjust( rtc.timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1)); | |
| 61 | 61 | pcf8593_reset(); |
| 62 | 62 | } |
| 63 | 63 |
| r1293 | r1294 | |
|---|---|---|
| 240 | 240 | tpi6525[1].a.output=cbmb_keyboard_line_select_a; |
| 241 | 241 | tpi6525[1].b.output=cbmb_keyboard_line_select_b; |
| 242 | 242 | tpi6525[1].c.output=cbmb_keyboard_line_select_c; |
| 243 | | |
| 243 | | |
| 244 | 244 | |
| 245 | 245 | cbm500 = 0; |
| 246 | 246 | cbm700 = 0; |
| r1293 | r1294 | |
|---|---|---|
| 61 | 61 | { |
| 62 | 62 | memcpy(&i8271.fdc_interface, iface, sizeof(i8271_interface)); |
| 63 | 63 | } |
| 64 | i8271.data_timer = mame_timer_alloc(i8271_data_timer_callback); | |
| 65 | i8271.command_complete_timer = mame_timer_alloc(i8271_timed_command_complete_callback); | |
| 64 | i8271.data_timer = timer_alloc(i8271_data_timer_callback); | |
| 65 | i8271.command_complete_timer = timer_alloc(i8271_timed_command_complete_callback); | |
| 66 | 66 | i8271.drive = 0; |
| 67 | 67 | i8271.pExecutionPhaseData = temp_buffer; |
| 68 | 68 | |
| r1293 | r1294 | |
| 138 | 138 | i8271_data_request(); |
| 139 | 139 | |
| 140 | 140 | /* stop it */ |
| 141 | | |
| 141 | | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /* setup a timed data request - data request will be triggered in a few usecs time */ |
| r1293 | r1294 | |
| 150 | 150 | usecs = 64; |
| 151 | 151 | |
| 152 | 152 | /* set timers */ |
| 153 | mame_timer_reset(i8271.command_complete_timer, time_never); | |
| 154 | mame_timer_adjust(i8271.data_timer, MAME_TIME_IN_USEC(usecs), 0, time_zero); | |
| 153 | timer_reset(i8271.command_complete_timer, attotime_never); | |
| 154 | timer_adjust(i8271.data_timer, ATTOTIME_IN_USEC(usecs), 0, attotime_zero); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | |
| r1293 | r1294 | |
| 160 | 160 | i8271_command_complete(1,1); |
| 161 | 161 | |
| 162 | 162 | /* stop it, but don't allow it to be free'd */ |
| 163 | | |
| 163 | | |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /* setup a irq to occur 128us later - in reality this would be much later, because the int would |
| r1293 | r1294 | |
| 174 | 174 | usecs = 64*2; |
| 175 | 175 | |
| 176 | 176 | /* set timers */ |
| 177 | mame_timer_reset(i8271.data_timer, time_never); | |
| 178 | mame_timer_adjust(i8271.command_complete_timer, MAME_TIME_IN_USEC(usecs), 0, time_zero); | |
| 177 | timer_reset(i8271.data_timer, attotime_never); | |
| 178 | timer_adjust(i8271.command_complete_timer, ATTOTIME_IN_USEC(usecs), 0, attotime_zero); | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | void i8271_reset() |
| r1293 | r1294 | |
| 186 | 186 | i8271.ParameterCount = 0; |
| 187 | 187 | |
| 188 | 188 | /* if timer is active remove */ |
| 189 | mame_timer_reset(i8271.command_complete_timer, time_never); | |
| 190 | mame_timer_reset(i8271.data_timer, time_never); | |
| 189 | timer_reset(i8271.command_complete_timer, attotime_never); | |
| 190 | timer_reset(i8271.data_timer, attotime_never); | |
| 191 | 191 | |
| 192 | 192 | /* clear irq */ |
| 193 | 193 | i8271_set_irq_state(0); |
| r1293 | r1294 | |
|---|---|---|
| 160 | 160 | |
| 161 | 161 | MACHINE_START( pc1350 ) |
| 162 | 162 | { |
| 163 | | |
| 163 | | |
| 164 | 164 | |
| 165 | 165 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x6fff, 0, 0, MRA8_BANK1); |
| 166 | 166 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x6fff, 0, 0, MWA8_BANK1); |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | struct TIMERS { |
| 17 | 17 | UINT8 seconds_running; /* Seconds timer running */ |
| 18 | 18 | UINT32 seconds_counter; /* Seconds timer counter */ |
| 19 | | |
| 19 | | |
| 20 | 20 | UINT8 hz256_running; /* 256Hz timer running */ |
| 21 | 21 | UINT8 hz256_counter; /* 256Hz timer counter */ |
| 22 | | |
| 22 | | |
| 23 | 23 | UINT8 timers_enabled; /* Timers 1 to 3 enabled */ |
| 24 | 24 | UINT16 timer1_counter; |
| 25 | | |
| 25 | | |
| 26 | 26 | UINT16 timer2_counter; |
| 27 | | |
| 27 | | |
| 28 | 28 | UINT16 timer3_counter; |
| 29 | | |
| 29 | | |
| 30 | 30 | }; |
| 31 | 31 | |
| 32 | 32 | UINT8 pokemini_hwreg[0x100]; |
| r1293 | r1294 | |
| 93 | 93 | memset( &vdp, 0, sizeof(vdp) ); |
| 94 | 94 | memset( &timers, 0, sizeof(timers) ); |
| 95 | 95 | memset( pokemini_hwreg, 0, sizeof(pokemini_hwreg) ); |
| 96 | timers.seconds_timer = mame_timer_alloc( pokemini_seconds_timer_callback ); | |
| 97 | timers.hz256_timer = mame_timer_alloc( pokemini_256hz_timer_callback ); | |
| 98 | timers.timer1_timer = mame_timer_alloc( pokemini_timer1_callback ); | |
| 99 | timers.timer2_timer = mame_timer_alloc( pokemini_timer2_callback ); | |
| 100 | timers.timer3_timer = mame_timer_alloc( pokemini_timer3_callback ); | |
| 96 | timers.seconds_timer = timer_alloc( pokemini_seconds_timer_callback ); | |
| 97 | timers.hz256_timer = timer_alloc( pokemini_256hz_timer_callback ); | |
| 98 | timers.timer1_timer = timer_alloc( pokemini_timer1_callback ); | |
| 99 | timers.timer2_timer = timer_alloc( pokemini_timer2_callback ); | |
| 100 | timers.timer3_timer = timer_alloc( pokemini_timer3_callback ); | |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | WRITE8_HANDLER( pokemini_hwreg_w ) { |
| r1293 | r1294 | |
| 123 | 123 | */ |
| 124 | 124 | if ( data & 0x01 ) { /* enable timer */ |
| 125 | 125 | if ( ! timers.seconds_running ) { |
| 126 | | |
| 126 | | |
| 127 | 127 | timers.seconds_running = 1; |
| 128 | 128 | } |
| 129 | 129 | } else { /* pause timer */ |
| 130 | 130 | if ( timers.seconds_running ) { |
| 131 | | |
| 131 | | |
| 132 | 132 | timers.seconds_running = 0; |
| 133 | 133 | } |
| 134 | 134 | } |
| r1293 | r1294 | |
| 169 | 169 | Bit 4-7 R/W Unused |
| 170 | 170 | */ |
| 171 | 171 | if ( ( data & 0x07 ) != ( pokemini_hwreg[0x18] & 0x07 ) ) { |
| 172 | | |
| 172 | | |
| 173 | 173 | } |
| 174 | 174 | if ( ( data & 0x08 ) && timers.timers_enabled ) { |
| 175 | | |
| 175 | | |
| 176 | 176 | } else { |
| 177 | | |
| 177 | | |
| 178 | 178 | } |
| 179 | 179 | break; |
| 180 | 180 | case 0x19: /* Timers 1 to 3 enabler |
| r1293 | r1294 | |
| 187 | 187 | timers.timers_enabled = ( data & 0x20 ) ? 1 : 0; |
| 188 | 188 | if ( timers.timers_enabled ) { |
| 189 | 189 | if ( pokemini_hwreg[0x18] & 0x08 ) { |
| 190 | | |
| 190 | | |
| 191 | 191 | } |
| 192 | 192 | if ( pokemini_hwreg[0x1A] & 0x08 ) { |
| 193 | | |
| 193 | | |
| 194 | 194 | } |
| 195 | 195 | if ( pokemini_hwreg[0x1C] & 0x08 ) { |
| 196 | | |
| 196 | | |
| 197 | 197 | } |
| 198 | 198 | } else { |
| 199 | mame_timer_enable( timers.timer1_timer, 0 ); | |
| 200 | mame_timer_enable( timers.timer2_timer, 0 ); | |
| 201 | mame_timer_enable( timers.timer3_timer, 0 ); | |
| 199 | timer_enable( timers.timer1_timer, 0 ); | |
| 200 | timer_enable( timers.timer2_timer, 0 ); | |
| 201 | timer_enable( timers.timer3_timer, 0 ); | |
| 202 | 202 | } |
| 203 | 203 | break; |
| 204 | 204 | case 0x1A: /* Timer 2 pre-scale + enable |
| r1293 | r1294 | |
| 214 | 214 | Bit 4-7 Unused |
| 215 | 215 | */ |
| 216 | 216 | if ( ( data & 0x07 ) != ( pokemini_hwreg[0x1A] & 0x07 ) ) { |
| 217 | | |
| 217 | | |
| 218 | 218 | } |
| 219 | 219 | if ( ( data & 0x08 ) && timers.timers_enabled ) { |
| 220 | | |
| 220 | | |
| 221 | 221 | } else { |
| 222 | | |
| 222 | | |
| 223 | 223 | } |
| 224 | 224 | break; |
| 225 | 225 | case 0x1C: /* Timer 3 pre-scale + enable |
| r1293 | r1294 | |
| 235 | 235 | Bit 4-7 Unused |
| 236 | 236 | */ |
| 237 | 237 | if ( ( data & 0x07 ) != ( pokemini_hwreg[0x1C] & 0x07 ) ) { |
| 238 | | |
| 238 | | |
| 239 | 239 | } |
| 240 | 240 | if ( ( data & 0x08 ) && timers.timers_enabled ) { |
| 241 | | |
| 241 | | |
| 242 | 242 | } else { |
| 243 | | |
| 243 | | |
| 244 | 244 | } |
| 245 | 245 | break; |
| 246 | 246 | case 0x20: /* Event #1-#8 primary enable |
| r1293 | r1294 | |
| 412 | 412 | */ |
| 413 | 413 | if ( data & 0x01 ) { /* enable timer */ |
| 414 | 414 | if ( ! timers.hz256_running ) { |
| 415 | | |
| 415 | | |
| 416 | 416 | timers.hz256_running = 1; |
| 417 | 417 | } |
| 418 | 418 | } else { /* pause timer */ |
| 419 | 419 | if ( timers.hz256_running ) { |
| 420 | | |
| 420 | | |
| 421 | 421 | timers.hz256_running = 0; |
| 422 | 422 | } |
| 423 | 423 | } |
| r1293 | r1294 | |
|---|---|---|
| 71 | 71 | |
| 72 | 72 | struct rp5c15 rtc; |
| 73 | 73 | |
| 74 | ||
| 74 | ||
| 75 | 75 | |
| 76 | 76 | TIMER_CALLBACK(rtc_alarm_pulse) |
| 77 | 77 | { |
| r1293 | r1294 | |
| 135 | 135 | rtc.test = 0x00; |
| 136 | 136 | rtc.pulse_count = 0; |
| 137 | 137 | |
| 138 | rtc_timer = mame_timer_alloc(rtc_alarm_pulse); | |
| 139 | mame_timer_adjust(rtc_timer, time_zero, 0, MAME_TIME_IN_HZ(32)); | |
| 138 | rtc_timer = timer_alloc(rtc_alarm_pulse); | |
| 139 | timer_adjust(rtc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(32)); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | int rp5c15_read(int offset, UINT16 mem_mask) |
| r1293 | r1294 | |
|---|---|---|
| 104 | 104 | static UINT8 *coco_rom; |
| 105 | 105 | static int dclg_state, dclg_output_h, dclg_output_v, dclg_timer; |
| 106 | 106 | static UINT8 (*update_keyboard)(void); |
| 107 | static mame_timer *update_keyboard_timer; | |
| 108 | static mame_timer *mux_sel1_timer; | |
| 109 | static mame_timer *mux_sel2_timer; | |
| 107 | static emu_timer *update_keyboard_timer; | |
| 108 | static emu_timer *mux_sel1_timer; | |
| 109 | static emu_timer *mux_sel2_timer; | |
| 110 | 110 | static UINT8 mux_sel1, mux_sel2; |
| 111 | 111 | |
| 112 | 112 | static WRITE8_HANDLER ( d_pia1_pb_w ); |
| r1293 | r1294 | |
| 380 | 380 | }; |
| 381 | 381 | |
| 382 | 382 | static coco_cartridge *coco_cart; |
| 383 | static mame_timer *cart_timer; | |
| 384 | static mame_timer *nmi_timer; | |
| 385 | static mame_timer *halt_timer; | |
| 383 | static emu_timer *cart_timer; | |
| 384 | static emu_timer *nmi_timer; | |
| 385 | static emu_timer *halt_timer; | |
| 386 | 386 | |
| 387 | 387 | |
| 388 | 388 | |
| r1293 | r1294 | |
| 875 | 875 | { |
| 876 | 876 | cpunum_set_input_line(0, INPUT_LINE_HALT, halt_line); |
| 877 | 877 | if (halt_line == CLEAR_LINE) |
| 878 | | |
| 878 | | |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | |
| r1293 | r1294 | |
| 982 | 982 | ***************************************************************************/ |
| 983 | 983 | |
| 984 | 984 | static int coco_hiresjoy_ca = 1; |
| 985 | static mame_time coco_hiresjoy_xtransitiontime; | |
| 986 | static mame_time coco_hiresjoy_ytransitiontime; | |
| 985 | static attotime coco_hiresjoy_xtransitiontime; | |
| 986 | static attotime coco_hiresjoy_ytransitiontime; | |
| 987 | 987 | |
| 988 | static | |
| 988 | static | |
| 989 | 989 | { |
| 990 | 990 | double val; |
| 991 | 991 | |
| r1293 | r1294 | |
| 1002 | 1002 | val = val * 4160.0 + 592.0; |
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | return a | |
| 1005 | return a | |
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | static void coco_hiresjoy_w(int data) |
| r1293 | r1294 | |
| 1016 | 1016 | else if (data && !coco_hiresjoy_ca) |
| 1017 | 1017 | { |
| 1018 | 1018 | /* Lo to hi */ |
| 1019 | coco_hiresjoy_ytransitiontime = time_zero; | |
| 1020 | coco_hiresjoy_ytransitiontime = time_zero; | |
| 1019 | coco_hiresjoy_ytransitiontime = attotime_zero; | |
| 1020 | coco_hiresjoy_ytransitiontime = attotime_zero; | |
| 1021 | 1021 | } |
| 1022 | 1022 | coco_hiresjoy_ca = data; |
| 1023 | 1023 | (*update_keyboard)(); |
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | static int coco_hiresjoy_readone( | |
| 1026 | static int coco_hiresjoy_readone( | |
| 1027 | 1027 | { |
| 1028 | return | |
| 1028 | return | |
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | static int coco_hiresjoy_rx(void) |
| r1293 | r1294 | |
| 1188 | 1188 | |
| 1189 | 1189 | static WRITE8_HANDLER ( d_pia0_ca2_w ) |
| 1190 | 1190 | { |
| 1191 | | |
| 1191 | | |
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | 1194 | static TIMER_CALLBACK(coco_update_sel1_timerproc) |
| r1293 | r1294 | |
| 1200 | 1200 | |
| 1201 | 1201 | static WRITE8_HANDLER ( d_pia0_cb2_w ) |
| 1202 | 1202 | { |
| 1203 | | |
| 1203 | | |
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | static TIMER_CALLBACK(coco_update_sel2_timerproc) |
| r1293 | r1294 | |
| 1211 | 1211 | } |
| 1212 | 1212 | |
| 1213 | 1213 | |
| 1214 | static | |
| 1214 | static | |
| 1215 | 1215 | { |
| 1216 | mame_time result; | |
| 1217 | mame_time now = mame_timer_get_time(); | |
| 1216 | attotime result; | |
| 1217 | attotime now = timer_get_time(); | |
| 1218 | 1218 | |
| 1219 | if (compare_mame_times(absolute_time, now) > 0) | |
| 1220 | result = sub_mame_times(absolute_time, now); | |
| 1219 | if (attotime_compare(absolute_time, now) > 0) | |
| 1220 | result = attotime_sub(absolute_time, now); | |
| 1221 | 1221 | else |
| 1222 | result = time_never; | |
| 1222 | result = attotime_never; | |
| 1223 | 1223 | return result; |
| 1224 | 1224 | } |
| 1225 | 1225 | |
| r1293 | r1294 | |
| 1231 | 1231 | int joyval; |
| 1232 | 1232 | static const int joy_rat_table[] = {15, 24, 42, 33 }; |
| 1233 | 1233 | static const int dclg_table[] = {0, 14, 30, 49 }; |
| 1234 | | |
| 1234 | | |
| 1235 | 1235 | UINT8 pia0_pb; |
| 1236 | 1236 | UINT8 dac = pia_get_output_a(1) & 0xFC; |
| 1237 | 1237 | int joystick_axis, joystick; |
| r1293 | r1294 | |
| 1306 | 1306 | break; |
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | if( compare | |
| 1309 | if( attotime_compare | |
| 1310 | 1310 | { |
| 1311 | 1311 | /* schedule lightgun events */ |
| 1312 | | |
| 1312 | | |
| 1313 | 1313 | } |
| 1314 | 1314 | else |
| 1315 | 1315 | { |
| 1316 | 1316 | /* schedule hires joystick events */ |
| 1317 | mame_time xtrans = get_relative_time(coco_hiresjoy_xtransitiontime); | |
| 1318 | mame_time ytrans = get_relative_time(coco_hiresjoy_ytransitiontime); | |
| 1317 | attotime xtrans = get_relative_time(coco_hiresjoy_xtransitiontime); | |
| 1318 | attotime ytrans = get_relative_time(coco_hiresjoy_ytransitiontime); | |
| 1319 | 1319 | |
| 1320 | mame_timer_reset(update_keyboard_timer, | |
| 1321 | (compare_mame_times(xtrans, ytrans) > 0) ? ytrans : xtrans); | |
| 1320 | timer_reset(update_keyboard_timer, | |
| 1321 | (attotime_compare(xtrans, ytrans) > 0) ? ytrans : xtrans); | |
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | /* sample joystick buttons */ |
| r1293 | r1294 | |
| 2002 | 2002 | FAQ agrees with this |
| 2003 | 2003 | ***************************************************************************/ |
| 2004 | 2004 | |
| 2005 | static | |
| 2005 | static | |
| 2006 | 2006 | |
| 2007 | 2007 | static void coco3_timer_reset(void) |
| 2008 | 2008 | { |
| r1293 | r1294 | |
| 2010 | 2010 | UINT64 current_time; |
| 2011 | 2011 | UINT16 timer_value; |
| 2012 | 2012 | m6847_timing_type timing; |
| 2013 | | |
| 2013 | | |
| 2014 | 2014 | |
| 2015 | 2015 | /* value is from 0-4095 */ |
| 2016 | 2016 | timer_value = ((coco3_gimereg[4] & 0x0F) * 0x100) | coco3_gimereg[5]; |
| r1293 | r1294 | |
| 2032 | 2032 | /* calculate the time */ |
| 2033 | 2033 | target_time = m6847_time_until(timing, current_time + timer_value); |
| 2034 | 2034 | if (LOG_TIMER) |
| 2035 | logerror("coco3_reset_timer(): target_time=%g\n", | |
| 2035 | logerror("coco3_reset_timer(): target_time=%g\n", | |
| 2036 | 2036 | |
| 2037 | 2037 | /* and adjust the timer */ |
| 2038 | | |
| 2038 | | |
| 2039 | 2039 | } |
| 2040 | 2040 | else |
| 2041 | 2041 | { |
| 2042 | 2042 | /* timer is shut off */ |
| 2043 | | |
| 2043 | | |
| 2044 | 2044 | if (LOG_TIMER) |
| 2045 | 2045 | logerror("coco3_reset_timer(): timer is off\n"); |
| 2046 | 2046 | } |
| r1293 | r1294 | |
| 2060 | 2060 | |
| 2061 | 2061 | static void coco3_timer_init(void) |
| 2062 | 2062 | { |
| 2063 | coco3_gime_timer = | |
| 2063 | coco3_gime_timer = | |
| 2064 | 2064 | } |
| 2065 | 2065 | |
| 2066 | 2066 | |
| r1293 | r1294 | |
| 2573 | 2573 | |
| 2574 | 2574 | /* special code for Q state */ |
| 2575 | 2575 | if ((data == 0x02) || (data == 0x03) || (data == 0x04)) |
| 2576 | | |
| 2576 | | |
| 2577 | 2577 | } |
| 2578 | 2578 | |
| 2579 | 2579 | |
| r1293 | r1294 | |
| 2627 | 2627 | switch(line) |
| 2628 | 2628 | { |
| 2629 | 2629 | case COCOCART_LINE_CART: |
| 2630 | | |
| 2630 | | |
| 2631 | 2631 | break; |
| 2632 | 2632 | |
| 2633 | 2633 | case COCOCART_LINE_NMI: |
| 2634 | | |
| 2634 | | |
| 2635 | 2635 | break; |
| 2636 | 2636 | |
| 2637 | 2637 | case COCOCART_LINE_HALT: |
| 2638 | | |
| 2638 | | |
| 2639 | 2639 | break; |
| 2640 | 2640 | } |
| 2641 | 2641 | } |
| r1293 | r1294 | |
| 2696 | 2696 | { |
| 2697 | 2697 | /* if the cartridge CART line is set to Q, trigger another round of pulses */ |
| 2698 | 2698 | if ((coco_cart != NULL) && (cococart_get_line(coco_cart, COCOCART_LINE_CART) == COCOCART_LINE_VALUE_Q)) |
| 2699 | | |
| 2699 | | |
| 2700 | 2700 | } |
| 2701 | 2701 | |
| 2702 | 2702 | |
| r1293 | r1294 | |
| 2745 | 2745 | |
| 2746 | 2746 | /* clear static variables */ |
| 2747 | 2747 | coco_hiresjoy_ca = 1; |
| 2748 | coco_hiresjoy_xtransitiontime = time_zero; | |
| 2749 | coco_hiresjoy_ytransitiontime = time_zero; | |
| 2748 | coco_hiresjoy_xtransitiontime = attotime_zero; | |
| 2749 | coco_hiresjoy_ytransitiontime = attotime_zero; | |
| 2750 | 2750 | |
| 2751 | 2751 | /* set up function pointers */ |
| 2752 | 2752 | update_keyboard = coco_update_keyboard; |
| 2753 | 2753 | recalc_interrupts = init->recalc_interrupts_; |
| 2754 | 2754 | |
| 2755 | 2755 | /* this timer is used to schedule keyboard updating */ |
| 2756 | update_keyboard_timer = | |
| 2756 | update_keyboard_timer = | |
| 2757 | 2757 | |
| 2758 | 2758 | /* these are the timers to delay the MUX switching */ |
| 2759 | mux_sel1_timer = mame_timer_alloc(coco_update_sel1_timerproc); | |
| 2760 | mux_sel2_timer = mame_timer_alloc(coco_update_sel2_timerproc); | |
| 2759 | mux_sel1_timer = timer_alloc(coco_update_sel1_timerproc); | |
| 2760 | mux_sel2_timer = timer_alloc(coco_update_sel2_timerproc); | |
| 2761 | 2761 | |
| 2762 | 2762 | /* setup ROM */ |
| 2763 | 2763 | coco_rom = memory_region(REGION_CPU1); |
| r1293 | r1294 | |
| 2777 | 2777 | pia_reset(); |
| 2778 | 2778 | |
| 2779 | 2779 | /* cartridge line timers */ |
| 2780 | cart_timer = mame_timer_alloc(init->cart_timer_proc); | |
| 2781 | nmi_timer = mame_timer_alloc(nmi_timer_proc); | |
| 2782 | halt_timer = mame_timer_alloc(halt_timer_proc); | |
| 2780 | cart_timer = timer_alloc(init->cart_timer_proc); | |
| 2781 | nmi_timer = timer_alloc(nmi_timer_proc); | |
| 2782 | halt_timer = timer_alloc(halt_timer_proc); | |
| 2783 | 2783 | |
| 2784 | 2784 | /* determine which cartridge hardware we should be using */ |
| 2785 | 2785 | cart_image = cartslot_image(); |
| r1293 | r1294 | |
|---|---|---|
| 69 | 69 | UINT32 wtc; /* Word Transfer Count Register (RW) */ |
| 70 | 70 | UINT32 acr; /* Address Count Register (RW) */ |
| 71 | 71 | UINT16 dawr; /* DACK Width Register (W) */ |
| 72 | | |
| 72 | | |
| 73 | 73 | } _dmac_data; |
| 74 | 74 | |
| 75 | 75 | static _dmac_data dmac_data; |
| r1293 | r1294 | |
| 115 | 115 | if ( dmac_data.wtc > 0 ) |
| 116 | 116 | { |
| 117 | 117 | matsucd_read_next_block(); |
| 118 | | |
| 118 | | |
| 119 | 119 | } |
| 120 | 120 | else |
| 121 | 121 | { |
| r1293 | r1294 | |
| 224 | 224 | case 0x70: /* DMA start strobe */ |
| 225 | 225 | { |
| 226 | 226 | LOG( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() ); |
| 227 | | |
| 227 | | |
| 228 | 228 | } |
| 229 | 229 | break; |
| 230 | 230 | |
| 231 | 231 | case 0x71: /* DMA stop strobe */ |
| 232 | 232 | { |
| 233 | 233 | LOG( "DMAC: PC=%08x - DMA Stop Strobe\n", activecpu_get_pc() ); |
| 234 | | |
| 234 | | |
| 235 | 235 | } |
| 236 | 236 | break; |
| 237 | 237 | |
| r1293 | r1294 | |
| 350 | 350 | case 0x70: /* DMA start strobe */ |
| 351 | 351 | { |
| 352 | 352 | LOG( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() ); |
| 353 | | |
| 353 | | |
| 354 | 354 | } |
| 355 | 355 | break; |
| 356 | 356 | |
| 357 | 357 | case 0x71: /* DMA stop strobe */ |
| 358 | 358 | { |
| 359 | 359 | LOG( "DMAC: PC=%08x - DMA Stop Strobe\n", activecpu_get_pc() ); |
| 360 | | |
| 360 | | |
| 361 | 361 | } |
| 362 | 362 | break; |
| 363 | 363 | |
| r1293 | r1294 | |
| 447 | 447 | matsucd_enable_w( data & 2 ); /* write to the /ENABLE signal */ |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | static | |
| 450 | static | |
| 451 | 451 | |
| 452 | 452 | static TIMER_CALLBACK(tp6525_delayed_irq) |
| 453 | 453 | { |
| r1293 | r1294 | |
| 459 | 459 | } |
| 460 | 460 | else |
| 461 | 461 | { |
| 462 | | |
| 462 | | |
| 463 | 463 | } |
| 464 | 464 | } |
| 465 | 465 | |
| r1293 | r1294 | |
| 476 | 476 | else |
| 477 | 477 | { |
| 478 | 478 | /* we *have to* deliver the irq, so if we can't, delay it and try again later */ |
| 479 | | |
| 479 | | |
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | } |
| r1293 | r1294 | |
| 507 | 507 | /* initialize the dmac */ |
| 508 | 508 | memset( &dmac_data, 0, sizeof( dmac_data ) ); |
| 509 | 509 | |
| 510 | dmac_data.dma_timer = mame_timer_alloc(dmac_dma_proc); | |
| 511 | tp6525_delayed_timer = mame_timer_alloc(tp6525_delayed_irq); | |
| 510 | dmac_data.dma_timer = timer_alloc(dmac_dma_proc); | |
| 511 | tp6525_delayed_timer = timer_alloc(tp6525_delayed_irq); | |
| 512 | 512 | |
| 513 | 513 | /* initialize the 6525 TPI */ |
| 514 | 514 | tpi6525_0_reset(); |
| r1293 | r1294 | |
|---|---|---|
| 52 | 52 | #define FLAG 0x7e |
| 53 | 53 | /* flag value, as defined by HDLC protocol: 01111110 */ |
| 54 | 54 | |
| 55 | #define BIT_LENGTH | |
| 55 | #define BIT_LENGTH | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | |
| r1293 | r1294 | |
| 75 | 75 | UINT8 tstate; |
| 76 | 76 | UINT16 tfifo[FIFO_SIZE]; /* X x 8-bit FIFO + full & last marker bits */ |
| 77 | 77 | UINT8 tones; /* counter for zero-insertion */ |
| 78 | | |
| 78 | | |
| 79 | 79 | |
| 80 | 80 | /* receive state */ |
| 81 | 81 | UINT8 rstate; |
| r1293 | r1294 | |
| 229 | 229 | /* MC6854 fills bit queue */ |
| 230 | 230 | static void mc6854_send_bits( UINT32 data, int len, int zi ) |
| 231 | 231 | { |
| 232 | | |
| 232 | | |
| 233 | 233 | int i; |
| 234 | 234 | if ( zi ) |
| 235 | 235 | { |
| r1293 | r1294 | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /* schedule when to ask the MC6854 for more bits */ |
| 269 | expire = mame_timer_timeleft( mc6854->ttimer ); | |
| 270 | if ( ! compare_mame_times( expire, time_never ) ) | |
| 271 | expire = time_zero; | |
| 272 | mame_timer_reset( mc6854->ttimer, add_mame_times(expire, scale_up_mame_time(BIT_LENGTH, len)) ); | |
| 269 | expire = timer_timeleft( mc6854->ttimer ); | |
| 270 | if ( ! attotime_compare( expire, attotime_never ) ) | |
| 271 | expire = attotime_zero; | |
| 272 | timer_reset( mc6854->ttimer, attotime_add(expire, attotime_mul(BIT_LENGTH, len)) ); | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | |
| r1293 | r1294 | |
| 292 | 292 | if ( i >= 0 ) |
| 293 | 293 | mc6854->tfifo[ i ] = data | 0x100; |
| 294 | 294 | else |
| 295 | logerror( "%f mc6854_tfifo_push: FIFO overrun\n", | |
| 295 | logerror( "%f mc6854_tfifo_push: FIFO overrun\n", | |
| 296 | 296 | |
| 297 | 297 | /* start frame, if needed */ |
| 298 | 298 | if ( ! mc6854->tstate ) |
| 299 | 299 | { |
| 300 | LOG(( "%f mc6854_tfifo_push: start frame\n", | |
| 300 | LOG(( "%f mc6854_tfifo_push: start frame\n", | |
| 301 | 301 | mc6854->tstate = 2; |
| 302 | 302 | mc6854_send_bits( FLAG, 8, 0 ); |
| 303 | 303 | } |
| r1293 | r1294 | |
| 347 | 347 | case 2: /* 8-bit address field */ |
| 348 | 348 | if ( ( data & 1 ) || ( ! AEX ) ) |
| 349 | 349 | mc6854->tstate = 3; |
| 350 | LOG(( "%f mc6854_tfifo_cb: address field $%02X\n", | |
| 350 | LOG(( "%f mc6854_tfifo_cb: address field $%02X\n", | |
| 351 | 351 | break; |
| 352 | 352 | |
| 353 | 353 | case 3: /* 8-bit control field */ |
| r1293 | r1294 | |
| 357 | 357 | mc6854->tstate = 5; |
| 358 | 358 | else |
| 359 | 359 | mc6854->tstate = 6; |
| 360 | LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", | |
| 360 | LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", | |
| 361 | 361 | break; |
| 362 | 362 | |
| 363 | 363 | case 4: /* 8-bit extended control field (optional) */ |
| r1293 | r1294 | |
| 365 | 365 | mc6854->tstate = 5; |
| 366 | 366 | else |
| 367 | 367 | mc6854->tstate = 6; |
| 368 | LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", | |
| 368 | LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", | |
| 369 | 369 | break; |
| 370 | 370 | |
| 371 | 371 | case 5: /* 8-bit logical control (optional) */ |
| 372 | 372 | if ( ! ( data & 0x80 ) ) |
| 373 | 373 | mc6854->tstate = 6; |
| 374 | LOG(( "%f mc6854_tfifo_cb: logical control field $%02X\n", | |
| 374 | LOG(( "%f mc6854_tfifo_cb: logical control field $%02X\n", | |
| 375 | 375 | break; |
| 376 | 376 | |
| 377 | 377 | case 6: /* variable-length data */ |
| 378 | 378 | blen = TWL; |
| 379 | LOG(( "%f mc6854_tfifo_cb: data field $%02X, %i bits\n", | |
| 379 | LOG(( "%f mc6854_tfifo_cb: data field $%02X, %i bits\n", | |
| 380 | 380 | break; |
| 381 | 381 | |
| 382 | 382 | default: |
| 383 | LOG(( "%f mc6854_tfifo_cb: state=%i\n", | |
| 383 | LOG(( "%f mc6854_tfifo_cb: state=%i\n", | |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | if ( mc6854->flen < MAX_FRAME_LENGTH ) |
| r1293 | r1294 | |
| 393 | 393 | else |
| 394 | 394 | { |
| 395 | 395 | /* data underrun => abort */ |
| 396 | logerror( "%f mc6854_tfifo_cb: FIFO underrun\n", | |
| 396 | logerror( "%f mc6854_tfifo_cb: FIFO underrun\n", | |
| 397 | 397 | mc6854->sr1 |= TU; |
| 398 | 398 | mc6854->tstate = 0; |
| 399 | 399 | mc6854_send_bits( 0xffff, ABTEX ? 16 : 8, 0 ); |
| r1293 | r1294 | |
| 405 | 405 | { |
| 406 | 406 | int len = mc6854->flen; |
| 407 | 407 | |
| 408 | LOG(( "%f mc6854_tfifo_cb: end frame\n", | |
| 408 | LOG(( "%f mc6854_tfifo_cb: end frame\n", | |
| 409 | 409 | mc6854_send_bits( 0xdeadbeef, 16, 1 ); /* send check-sum: TODO */ |
| 410 | 410 | mc6854_send_bits( FLAG, 8, 0 ); /* send closing flag */ |
| 411 | 411 | |
| 412 | 412 | if ( mc6854->tfifo[ FIFO_SIZE - 1 ] & 0x100 ) |
| 413 | 413 | { |
| 414 | 414 | /* re-open frame asap */ |
| 415 | LOG(( "%f mc6854_tfifo_cb: start frame\n", | |
| 415 | LOG(( "%f mc6854_tfifo_cb: start frame\n", | |
| 416 | 416 | if ( TWOINTER ) |
| 417 | 417 | mc6854_send_bits( FLAG, 8, 0 ); |
| 418 | 418 | } |
| r1293 | r1294 | |
| 432 | 432 | memset( mc6854->tfifo, 0, sizeof( mc6854->tfifo ) ); |
| 433 | 433 | mc6854->tstate = 0; |
| 434 | 434 | mc6854->flen = 0; |
| 435 | | |
| 435 | | |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | |
| r1293 | r1294 | |
| 457 | 457 | mc6854->rstate = 3; |
| 458 | 458 | else |
| 459 | 459 | mc6854->rstate = 2; |
| 460 | LOG(( "%f mc6854_rfifo_push: address field $%02X\n", | |
| 460 | LOG(( "%f mc6854_rfifo_push: address field $%02X\n", | |
| 461 | 461 | data |= 0x400; /* address marker */ |
| 462 | 462 | break; |
| 463 | 463 | |
| r1293 | r1294 | |
| 468 | 468 | mc6854->rstate = 5; |
| 469 | 469 | else |
| 470 | 470 | mc6854->rstate = 6; |
| 471 | LOG(( "%f mc6854_rfifo_push: control field $%02X\n", | |
| 471 | LOG(( "%f mc6854_rfifo_push: control field $%02X\n", | |
| 472 | 472 | break; |
| 473 | 473 | |
| 474 | 474 | case 4: /* 8-bit extended control field (optional) */ |
| r1293 | r1294 | |
| 476 | 476 | mc6854->rstate = 5; |
| 477 | 477 | else |
| 478 | 478 | mc6854->rstate = 6; |
| 479 | LOG(( "%f mc6854_rfifo_push: control field $%02X\n", | |
| 479 | LOG(( "%f mc6854_rfifo_push: control field $%02X\n", | |
| 480 | 480 | break; |
| 481 | 481 | |
| 482 | 482 | case 5: /* 8-bit logical control (optional) */ |
| 483 | 483 | if ( ! ( data & 0x80 ) ) |
| 484 | 484 | mc6854->rstate = 6; |
| 485 | LOG(( "%f mc6854_rfifo_push: logical control field $%02X\n", | |
| 485 | LOG(( "%f mc6854_rfifo_push: logical control field $%02X\n", | |
| 486 | 486 | break; |
| 487 | 487 | |
| 488 | 488 | case 6: /* variable-length data */ |
| 489 | 489 | blen = RWL; |
| 490 | 490 | data >>= 8 - blen; |
| 491 | LOG(( "%f mc6854_rfifo_push: data field $%02X, %i bits\n", | |
| 491 | LOG(( "%f mc6854_rfifo_push: data field $%02X, %i bits\n", | |
| 492 | 492 | break; |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | /* no further FIFO fill until FV is cleared! */ |
| 496 | 496 | if ( mc6854->sr2 & FV ) |
| 497 | 497 | { |
| 498 | LOG(( "%f mc6854_rfifo_push: field not pushed\n", | |
| 498 | LOG(( "%f mc6854_rfifo_push: field not pushed\n", | |
| 499 | 499 | return; |
| 500 | 500 | } |
| 501 | 501 | |
| r1293 | r1294 | |
| 515 | 515 | /* FIFO full */ |
| 516 | 516 | mc6854->sr2 |= OVRN; |
| 517 | 517 | mc6854->rfifo[ 0 ] = data; |
| 518 | logerror( "%f mc6854_rfifo_push: FIFO overrun\n", | |
| 518 | logerror( "%f mc6854_rfifo_push: FIFO overrun\n", | |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | mc6854->rsize -= blen; |
| r1293 | r1294 | |
| 592 | 592 | { |
| 593 | 593 | /* only in-frame abort */ |
| 594 | 594 | mc6854->sr2 |= RABT; |
| 595 | LOG(( "%f mc6854_receive_bit: abort\n", | |
| 595 | LOG(( "%f mc6854_receive_bit: abort\n", | |
| 596 | 596 | } |
| 597 | 597 | } |
| 598 | 598 | else |
| r1293 | r1294 | |
| 622 | 622 | if ( mc6854->rsize >= fieldlen + 24 ) /* last field */ |
| 623 | 623 | mc6854_rfifo_push( mc6854->rreg ); |
| 624 | 624 | mc6854_rfifo_terminate(); |
| 625 | LOG(( "%f mc6854_receive_bit: end of frame\n", | |
| 625 | LOG(( "%f mc6854_receive_bit: end of frame\n", | |
| 626 | 626 | } |
| 627 | 627 | mc6854->rones = 0; |
| 628 | 628 | mc6854->rstate = 1; |
| r1293 | r1294 | |
| 783 | 783 | case 0: /* status register 1 */ |
| 784 | 784 | mc6854_update_sr1(); |
| 785 | 785 | LOG(( "%f $%04x mc6854_r: get SR1=$%02X (rda=%i,s2rq=%i,fd=%i,cts=%i,tu=%i,tdra=%i,irq=%i)\n", |
| 786 | | |
| 786 | | |
| 787 | 787 | ( mc6854->sr1 & RDA) ? 1 : 0, ( mc6854->sr1 & S2RQ) ? 1 : 0, |
| 788 | 788 | ( mc6854->sr1 & FD ) ? 1 : 0, ( mc6854->sr1 & CTS ) ? 1 : 0, |
| 789 | 789 | ( mc6854->sr1 & TU ) ? 1 : 0, ( mc6854->sr1 & TDRA) ? 1 : 0, |
| r1293 | r1294 | |
| 793 | 793 | case 1: /* status register 2 */ |
| 794 | 794 | mc6854_update_sr2(); |
| 795 | 795 | LOG(( "%f $%04x mc6854_r: get SR2=$%02X (ap=%i,fv=%i,ridle=%i,rabt=%i,err=%i,dcd=%i,ovrn=%i,rda2=%i)\n", |
| 796 | | |
| 796 | | |
| 797 | 797 | ( mc6854->sr2 & AP ) ? 1 : 0, ( mc6854->sr2 & FV ) ? 1 : 0, |
| 798 | 798 | ( mc6854->sr2 & RIDLE) ? 1 : 0, ( mc6854->sr2 & RABT) ? 1 : 0, |
| 799 | 799 | ( mc6854->sr2 & ERR ) ? 1 : 0, ( mc6854->sr2 & DCD ) ? 1 : 0, |
| r1293 | r1294 | |
| 805 | 805 | { |
| 806 | 806 | UINT8 data = mc6854_rfifo_pop(); |
| 807 | 807 | LOG(( "%f $%04x mc6854_r: get data $%02X\n", |
| 808 | | |
| 808 | | |
| 809 | 809 | return data; |
| 810 | 810 | } |
| 811 | 811 | |
| r1293 | r1294 | |
| 825 | 825 | case 0: /* control register 1 */ |
| 826 | 826 | mc6854->cr1 = data; |
| 827 | 827 | LOG(( "%f $%04x mc6854_w: set CR1=$%02X (ac=%i,irq=%c%c,%sreset=%c%c)\n", |
| 828 | | |
| 828 | | |
| 829 | 829 | AC ? 1 : 0, |
| 830 | 830 | RIE ? 'r' : '-', TIE ? 't' : '-', |
| 831 | 831 | DISCONTINUE ? "discontinue," : "", |
| r1293 | r1294 | |
| 862 | 862 | /* control register 3 */ |
| 863 | 863 | mc6854->cr3 = data; |
| 864 | 864 | LOG(( "%f $%04x mc6854_w: set CR3=$%02X (lcf=%i,aex=%i,idl=%i,fdse=%i,loop=%i,tst=%i,dtr=%i)\n", |
| 865 | | |
| 865 | | |
| 866 | 866 | LCF ? (CEX ? 16 : 8) : 0, AEX ? 1 : 0, |
| 867 | 867 | IDL0 ? 0 : 1, FDSE ? 1 : 0, LOOP ? 1 : 0, |
| 868 | 868 | TST ? 1 : 0, DTR ? 1 : 0 |
| r1293 | r1294 | |
| 881 | 881 | /* control register 2 */ |
| 882 | 882 | mc6854->cr2 = data; |
| 883 | 883 | LOG(( "%f $%04x mc6854_w: set CR2=$%02X (pse=%i,bytes=%i,fmidle=%i,%s,tlast=%i,clr=%c%c,rts=%i)\n", |
| 884 | | |
| 884 | | |
| 885 | 885 | PSE ? 1 : 0, TWOBYTES ? 2 : 1, FMIDLE ? 1 : 0, |
| 886 | 886 | FCTDRA ? "fc" : "tdra", TLAST ? 1 : 0, |
| 887 | 887 | data & 0x20 ? 'r' : '-', data & 0x40 ? 't' : '-', |
| r1293 | r1294 | |
| 912 | 912 | break; |
| 913 | 913 | |
| 914 | 914 | case 2: /* transmitter data: continue data */ |
| 915 | LOG(( "%f $%04xmc6854_w: push data=$%02X\n", | |
| 915 | LOG(( "%f $%04xmc6854_w: push data=$%02X\n", | |
| 916 | 916 | mc6854_tfifo_push( data ); |
| 917 | 917 | break; |
| 918 | 918 | |
| r1293 | r1294 | |
| 921 | 921 | { |
| 922 | 922 | /* control register 4 */ |
| 923 | 923 | mc6854->cr4 = data; |
| 924 | LOG(( "%f $%04x mc6854_w: set CR4=$%02X (interframe=%i,tlen=%i,rlen=%i,%s%s)\n", | |
| 924 | LOG(( "%f $%04x mc6854_w: set CR4=$%02X (interframe=%i,tlen=%i,rlen=%i,%s%s)\n", | |
| 925 | 925 | TWOINTER ? 2 : 1, |
| 926 | 926 | TWL, RWL, |
| 927 | 927 | ABT ? ( ABTEX ? "abort-ext," : "abort,") : "", |
| r1293 | r1294 | |
| 936 | 936 | else |
| 937 | 937 | { |
| 938 | 938 | /* transmitter data: last data */ |
| 939 | LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", | |
| 939 | LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", | |
| 940 | 940 | mc6854_tfifo_push( data ); |
| 941 | 941 | mc6854_tfifo_terminate(); |
| 942 | 942 | } |
| r1293 | r1294 | |
| 980 | 980 | mc6854 = auto_malloc( sizeof( * mc6854 ) ); |
| 981 | 981 | assert( mc6854 ); |
| 982 | 982 | mc6854->iface = iface; |
| 983 | mc6854->ttimer = | |
| 983 | mc6854->ttimer = | |
| 984 | 984 | state_save_register_item( "mc6854", 0, mc6854->cr1 ); |
| 985 | 985 | state_save_register_item( "mc6854", 0, mc6854->cr2 ); |
| 986 | 986 | state_save_register_item( "mc6854", 0, mc6854->cr3 ); |
| r1293 | r1294 | |
|---|---|---|
| 297 | 297 | memset(&rtc.interface, 0, sizeof(struct tc8521_interface)); |
| 298 | 298 | if (intf) |
| 299 | 299 | memcpy(&rtc.interface, intf, sizeof(struct tc8521_interface)); |
| 300 | | |
| 300 | | |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | READ8_HANDLER(tc8521_r) |
| r1293 | r1294 | |
|---|---|---|
| 111 | 111 | UINT8 gb_timer_shift; |
| 112 | 112 | /* Serial I/O related */ |
| 113 | 113 | static UINT32 SIOCount; /* Serial I/O counter */ |
| 114 | ||
| 114 | ||
| 115 | 115 | |
| 116 | 116 | /* |
| 117 | 117 | Prototypes |
| r1293 | r1294 | |
| 233 | 233 | gb_sound_w( 0x16, 0x00 ); /* Initialize sound hardware */ |
| 234 | 234 | |
| 235 | 235 | /* Allocate the serial timer, and disable it */ |
| 236 | gb_serial_timer = mame_timer_alloc( gb_serial_timer_proc ); | |
| 237 | mame_timer_enable( gb_serial_timer, 0 ); | |
| 236 | gb_serial_timer = timer_alloc( gb_serial_timer_proc ); | |
| 237 | timer_enable( gb_serial_timer, 0 ); | |
| 238 | 238 | |
| 239 | 239 | } |
| 240 | 240 | |
| r1293 | r1294 | |
| 670 | 670 | case 0x81: /* enabled & internal clock */ |
| 671 | 671 | SIODATA = 0xFF; |
| 672 | 672 | SIOCount = 8; |
| 673 | mame_timer_adjust( gb_serial_timer, MAME_TIME_IN_CYCLES( 512, 0 ), 0, MAME_TIME_IN_CYCLES( 512, 0 ) ); | |
| 674 | mame_timer_enable( gb_serial_timer, 1 ); | |
| 673 | timer_adjust( gb_serial_timer, ATTOTIME_IN_CYCLES( 512, 0 ), 0, ATTOTIME_IN_CYCLES( 512, 0 ) ); | |
| 674 | timer_enable( gb_serial_timer, 1 ); | |
| 675 | 675 | break; |
| 676 | 676 | } |
| 677 | 677 | break; |
| r1293 | r1294 | |
| 1726 | 1726 | /* If all bits done, stop timer and trigger interrupt */ |
| 1727 | 1727 | if ( ! SIOCount ) { |
| 1728 | 1728 | SIOCONT &= 0x7F; |
| 1729 | | |
| 1729 | | |
| 1730 | 1730 | cpunum_set_input_line(0, SIO_INT, HOLD_LINE); |
| 1731 | 1731 | } |
| 1732 | 1732 | } |
| r1293 | r1294 | |
|---|---|---|
| 24 | 24 | UINT8 irqen; /* IRQ enabled ? */ |
| 25 | 25 | UINT8 state; /* current timer state (bit 7) */ |
| 26 | 26 | double clock; /* 100000/1(,8,64,1024) */ |
| 27 | | |
| 27 | | |
| 28 | 28 | } |
| 29 | 29 | M6530; |
| 30 | 30 | |
| r1293 | r1294 | |
| 598 | 598 | |
| 599 | 599 | static void set_chip_clock(int chip, int data) |
| 600 | 600 | { |
| 601 | | |
| 601 | | |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | MACHINE_RESET( kim1 ) |
| r1293 | r1294 | |
| 624 | 624 | m6530[0].dria = 0xff; |
| 625 | 625 | m6530[0].drib = 0xff; |
| 626 | 626 | m6530[0].clock = (double) 1000000 / 1; |
| 627 | m6530[0].timer = | |
| 627 | m6530[0].timer = | |
| 628 | 628 | set_chip_clock(0, 255); |
| 629 | 629 | |
| 630 | 630 | m6530[1].dria = 0xff; |
| 631 | 631 | m6530[1].drib = 0xff; |
| 632 | 632 | m6530[1].clock = (double) 1000000 / 1; |
| 633 | m6530[1].timer = | |
| 633 | m6530[1].timer = | |
| 634 | 634 | set_chip_clock(1, 255); |
| 635 | 635 | } |
| 636 | 636 | |
| r1293 | r1294 | |
| 757 | 757 | break; |
| 758 | 758 | case 0x04: |
| 759 | 759 | case 0x0c: /* Timer count read (not supported?) */ |
| 760 | data = | |
| 760 | data = | |
| 761 | 761 | m6530[chip].irqen = (offset & 8) ? 1 : 0; |
| 762 | 762 | logerror("m6530(%d) TIMR read : $%02x%s\n", chip, data, (offset & 8) ? " (IRQ)" : ""); |
| 763 | 763 | break; |
| 764 | 764 | case 0x05: |
| 765 | 765 | case 0x0d: /* Timer count read (not supported?) */ |
| 766 | data = | |
| 766 | data = | |
| 767 | 767 | m6530[chip].irqen = (offset & 8) ? 1 : 0; |
| 768 | 768 | logerror("m6530(%d) TIMR read : $%02x%s\n", chip, data, (offset & 8) ? " (IRQ)" : ""); |
| 769 | 769 | break; |
| 770 | 770 | case 0x06: |
| 771 | 771 | case 0x0e: /* Timer count read */ |
| 772 | data = | |
| 772 | data = | |
| 773 | 773 | m6530[chip].irqen = (offset & 8) ? 1 : 0; |
| 774 | 774 | logerror("m6530(%d) TIMR read : $%02x%s\n", chip, data, (offset & 8) ? " (IRQ)" : ""); |
| 775 | 775 | break; |
| r1293 | r1294 | |
|---|---|---|
| 151 | 151 | if (uPD7002_status&0x08) |
| 152 | 152 | { |
| 153 | 153 | // 12 bit conversion takes 10ms |
| 154 | | |
| 154 | | |
| 155 | 155 | } else { |
| 156 | 156 | // 8 bit conversion takes 4ms |
| 157 | | |
| 157 | | |
| 158 | 158 | } |
| 159 | 159 | break; |
| 160 | 160 |
| r1293 | r1294 | |
|---|---|---|
| 370 | 370 | |
| 371 | 371 | DVENA = 0; |
| 372 | 372 | motor_on = 0; |
| 373 | motor_on_timer = | |
| 373 | motor_on_timer = | |
| 374 | 374 | |
| 375 | 375 | ti99_peb_set_card_handlers(0x1100, & fdc_handlers); |
| 376 | 376 | |
| r1293 | r1294 | |
| 484 | 484 | { /* on rising edge, set DVENA for 4.23s */ |
| 485 | 485 | DVENA = 1; |
| 486 | 486 | fdc_handle_hold(); |
| 487 | | |
| 487 | | |
| 488 | 488 | } |
| 489 | 489 | motor_on = data; |
| 490 | 490 | break; |
| r1293 | r1294 | |
| 635 | 635 | |
| 636 | 636 | DVENA = 0; |
| 637 | 637 | motor_on = 0; |
| 638 | motor_on_timer = | |
| 638 | motor_on_timer = | |
| 639 | 639 | |
| 640 | 640 | ti99_peb_set_card_handlers(0x1100, & ccfdc_handlers); |
| 641 | 641 | |
| r1293 | r1294 | |
| 696 | 696 | { /* on rising edge, set DVENA for 4.23s */ |
| 697 | 697 | DVENA = 1; |
| 698 | 698 | fdc_handle_hold(); |
| 699 | | |
| 699 | | |
| 700 | 700 | } |
| 701 | 701 | motor_on = data; |
| 702 | 702 | break; |
| r1293 | r1294 | |
| 854 | 854 | |
| 855 | 855 | DVENA = 0; |
| 856 | 856 | motor_on = 0; |
| 857 | motor_on_timer = | |
| 857 | motor_on_timer = | |
| 858 | 858 | |
| 859 | 859 | ti99_peb_set_card_handlers(0x1100, & bwg_handlers); |
| 860 | 860 | |
| r1293 | r1294 | |
| 917 | 917 | { /* on rising edge, set DVENA for 4.23s */ |
| 918 | 918 | DVENA = 1; |
| 919 | 919 | fdc_handle_hold(); |
| 920 | | |
| 920 | | |
| 921 | 921 | } |
| 922 | 922 | motor_on = data; |
| 923 | 923 | break; |
| r1293 | r1294 | |
| 1248 | 1248 | |
| 1249 | 1249 | DVENA = 0; |
| 1250 | 1250 | motor_on = 0; |
| 1251 | motor_on_timer = | |
| 1251 | motor_on_timer = | |
| 1252 | 1252 | |
| 1253 | 1253 | ti99_peb_set_card_handlers(0x1100, & hfdc_handlers); |
| 1254 | 1254 | |
| r1293 | r1294 | |
| 1331 | 1331 | { |
| 1332 | 1332 | DVENA = 1; |
| 1333 | 1333 | fdc_handle_hold(); |
| 1334 | | |
| 1334 | | |
| 1335 | 1335 | } |
| 1336 | 1336 | motor_on = data; |
| 1337 | 1337 | break; |
| r1293 | r1294 | |
|---|---|---|
| 69 | 69 | UINT8 toggle_bit; |
| 70 | 70 | UINT8 programming_buffer[SECTOR_SIZE]; |
| 71 | 71 | int programming_last_offset; |
| 72 | | |
| 72 | | |
| 73 | 73 | } at29c040a[MAX_AT29C040A]; |
| 74 | 74 | |
| 75 | 75 | |
| r1293 | r1294 | |
| 90 | 90 | /* programming cycle start */ |
| 91 | 91 | at29c040a[id].s_pgm = s_pgm_3; |
| 92 | 92 | /* max delay 10ms, typical delay 5 to 7 ms */ |
| 93 | | |
| 93 | | |
| 94 | 94 | break; |
| 95 | 95 | |
| 96 | 96 | case s_pgm_3: |
| r1293 | r1294 | |
| 130 | 130 | */ |
| 131 | 131 | void at29c040a_init(int id) |
| 132 | 132 | { |
| 133 | at29c040a[id].programming_timer = | |
| 133 | at29c040a[id].programming_timer = | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /* |
| r1293 | r1294 | |
| 215 | 215 | at29c040a[id].s_pgm = s_pgm_0; |
| 216 | 216 | at29c040a[id].s_enabling_sdb = FALSE; |
| 217 | 217 | at29c040a[id].s_disabling_sdb = FALSE; |
| 218 | | |
| 218 | | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | |
| r1293 | r1294 | |
| 250 | 250 | { /* data polling starts the programming cycle (right???) */ |
| 251 | 251 | at29c040a[id].s_pgm = s_pgm_3; |
| 252 | 252 | /* max delay 10ms, typical delay 5 to 7 ms */ |
| 253 | | |
| 253 | | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | reply = at29c040a[id].toggle_bit; |
| r1293 | r1294 | |
| 318 | 318 | at29c040a[id].s_pgm = s_pgm_0; |
| 319 | 319 | at29c040a[id].s_enabling_sdb = FALSE; |
| 320 | 320 | at29c040a[id].s_disabling_sdb = FALSE; |
| 321 | | |
| 321 | | |
| 322 | 322 | |
| 323 | 323 | /* process command */ |
| 324 | 324 | switch (data) |
| r1293 | r1294 | |
| 344 | 344 | at29c040a[id].s_pgm = s_pgm_1; |
| 345 | 345 | at29c040a[id].s_disabling_sdb = TRUE; |
| 346 | 346 | /* set command timeout (right???) */ |
| 347 | // | |
| 347 | // | |
| 348 | 348 | } |
| 349 | 349 | break; |
| 350 | 350 | |
| r1293 | r1294 | |
| 364 | 364 | at29c040a[id].s_pgm = s_pgm_1; |
| 365 | 365 | at29c040a[id].s_enabling_sdb = TRUE; |
| 366 | 366 | /* set command timeout (right???) */ |
| 367 | // | |
| 367 | // | |
| 368 | 368 | break; |
| 369 | 369 | |
| 370 | 370 | case 0xf0: |
| r1293 | r1294 | |
| 393 | 393 | at29c040a[id].s_pgm = s_pgm_0; |
| 394 | 394 | at29c040a[id].s_enabling_sdb = FALSE; |
| 395 | 395 | at29c040a[id].s_disabling_sdb = FALSE; |
| 396 | | |
| 396 | | |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | if (((at29c040a[id].s_pgm == s_pgm_0) && ! at29c040a[id].s_sdp) |
| r1293 | r1294 | |
| 419 | 419 | /* write data to programming buffer */ |
| 420 | 420 | at29c040a[id].programming_buffer[offset & 0xff] = data; |
| 421 | 421 | at29c040a[id].programming_last_offset = offset; |
| 422 | | |
| 422 | | |
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 |
| r1293 | r1294 | |
|---|---|---|
| 52 | 52 | UINT8 *cartridge = NULL; |
| 53 | 53 | UINT8 *dummy_bank = NULL; |
| 54 | 54 | |
| 55 | static | |
| 55 | static | |
| 56 | 56 | GAMECOM_DMA gamecom_dma; |
| 57 | 57 | GAMECOM_TIMER gamecom_timer[2]; |
| 58 | 58 | |
| r1293 | r1294 | |
| 77 | 77 | |
| 78 | 78 | /* should possibly go in a DRIVER_INIT piece? */ |
| 79 | 79 | if ( gamecom_clock_timer == NULL ) { |
| 80 | gamecom_clock_timer = | |
| 80 | gamecom_clock_timer = | |
| 81 | 81 | } |
| 82 | 82 | /* intialize the empty dummy bank */ |
| 83 | 83 | if ( dummy_bank == NULL ) { |
| r1293 | r1294 | |
| 327 | 327 | /* timer run */ |
| 328 | 328 | if ( data & 0x40 ) { |
| 329 | 329 | /* timer resolution 1 minute */ |
| 330 | | |
| 330 | | |
| 331 | 331 | } else { |
| 332 | 332 | /* TImer resolution 1 second */ |
| 333 | | |
| 333 | | |
| 334 | 334 | } |
| 335 | 335 | } else { |
| 336 | 336 | /* disable timer reset */ |
| 337 | | |
| 337 | | |
| 338 | 338 | data &= 0xC0; |
| 339 | 339 | } |
| 340 | 340 | break; |
| r1293 | r1294 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | #if VERBOSE |
| 21 | 21 | #define LOG(N,M,A) \ |
| 22 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 22 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 23 | 23 | #else |
| 24 | 24 | #define LOG(N,M,A) |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | 27 | typedef UINT32 data_t; |
| 28 | 28 | |
| 29 | static | |
| 29 | static | |
| 30 | 30 | static UINT8 ne556_out[2] = {0,}; /* NE556 current output status */ |
| 31 | 31 | |
| 32 | 32 | static UINT8 mz700_motor_on = 0; /* cassette motor key (play key) */ |
| r1293 | r1294 | |
| 89 | 89 | |
| 90 | 90 | MACHINE_RESET(mz700) |
| 91 | 91 | { |
| 92 | ne556_timer[0] = mame_timer_alloc(ne556_callback); | |
| 93 | mame_timer_adjust(ne556_timer[0], MAME_TIME_IN_HZ(1.5), 0, MAME_TIME_IN_HZ(1.5)); | |
| 94 | /*mame_timer_pulse(MAME_TIME_IN_HZ(1.5), 0, ne556_callback)*/ | |
| 95 | ne556_timer[1] = mame_timer_alloc(ne556_callback); | |
| 96 | mame_timer_adjust(ne556_timer[1], MAME_TIME_IN_HZ(34.5), 1, MAME_TIME_IN_HZ(34.5)); | |
| 97 | /*mame_timer_pulse(MAME_TIME_IN_HZ(34.5), 1, ne556_callback)*/ | |
| 92 | ne556_timer[0] = timer_alloc(ne556_callback); | |
| 93 | timer_adjust(ne556_timer[0], ATTOTIME_IN_HZ(1.5), 0, ATTOTIME_IN_HZ(1.5)); | |
| 94 | /*timer_pulse(ATTOTIME_IN_HZ(1.5), 0, ne556_callback)*/ | |
| 95 | ne556_timer[1] = timer_alloc(ne556_callback); | |
| 96 | timer_adjust(ne556_timer[1], ATTOTIME_IN_HZ(34.5), 1, ATTOTIME_IN_HZ(34.5)); | |
| 97 | /*timer_pulse(ATTOTIME_IN_HZ(34.5), 1, ne556_callback)*/ | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
| r1293 | r1294 | |
| 190 | 190 | LOG(2,"mz700_pio_port_b_w",("%02X\n", data)); |
| 191 | 191 | |
| 192 | 192 | /* enable/disable NE556 cursor flash timer */ |
| 193 | | |
| 193 | | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | static WRITE8_HANDLER ( pio_port_c_w ) |
| r1293 | r1294 | |
|---|---|---|
| 84 | 84 | void ti990_hold_load(void) |
| 85 | 85 | { |
| 86 | 86 | cpunum_set_input_line(0, INPUT_LINE_NMI, ASSERT_LINE); |
| 87 | | |
| 87 | | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /* |
| r1293 | r1294 | |
|---|---|---|
| 118 | 118 | serial_devices[id].data_form.word_length = num_data_bits; |
| 119 | 119 | serial_devices[id].data_form.stop_bit_count = stop_bit_count; |
| 120 | 120 | serial_devices[id].data_form.parity = parity_code; |
| 121 | serial_devices[id].timer = | |
| 121 | serial_devices[id].timer = | |
| 122 | 122 | |
| 123 | 123 | serial_connection_init(&serial_devices[id].connection); |
| 124 | 124 | serial_connection_set_in_callback(&serial_devices[id].connection, serial_device_in_callback); |
| r1293 | r1294 | |
| 205 | 205 | if (state) |
| 206 | 206 | { |
| 207 | 207 | /* start timer */ |
| 208 | | |
| 208 | | |
| 209 | 209 | } |
| 210 | 210 | else |
| 211 | 211 | { |
| 212 | 212 | /* remove timer */ |
| 213 | | |
| 213 | | |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 |
| r1293 | r1294 | |
|---|---|---|
| 24 | 24 | UINT32 vectrex_beam_color = VC_WHITE; /* the color of the vectrex beam */ |
| 25 | 25 | int vectrex_imager_status = 0; /* 0 = off, 1 = right eye, 2 = left eye */ |
| 26 | 26 | double imager_freq; |
| 27 | ||
| 27 | ||
| 28 | 28 | int vectrex_lightpen_port=0; |
| 29 | 29 | UINT8 *vectrex_ram_base; |
| 30 | 30 | size_t vectrex_ram_size; |
| r1293 | r1294 | |
| 238 | 238 | { |
| 239 | 239 | vectrex_imager_status = param; |
| 240 | 240 | coffset = param>1?3:0; |
| 241 | mame_timer_set (double_to_mame_time(rtime * vectrex_imager_angles[0]), imager_colors[coffset+2], vectrex_imager_change_color); | |
| 242 | mame_timer_set (double_to_mame_time(rtime * vectrex_imager_angles[1]), imager_colors[coffset+1], vectrex_imager_change_color); | |
| 243 | mame_timer_set (double_to_mame_time(rtime * vectrex_imager_angles[2]), imager_colors[coffset], vectrex_imager_change_color); | |
| 241 | timer_set (double_to_attotime(rtime * vectrex_imager_angles[0]), imager_colors[coffset+2], vectrex_imager_change_color); | |
| 242 | timer_set (double_to_attotime(rtime * vectrex_imager_angles[1]), imager_colors[coffset+1], vectrex_imager_change_color); | |
| 243 | timer_set (double_to_attotime(rtime * vectrex_imager_angles[2]), imager_colors[coffset], vectrex_imager_change_color); | |
| 244 | 244 | |
| 245 | 245 | if (param == 2) |
| 246 | 246 | { |
| 247 | | |
| 247 | | |
| 248 | 248 | |
| 249 | 249 | /* Index hole sensor is connected to IO7 which triggers also CA1 of VIA */ |
| 250 | 250 | via_0_ca1_w (0, 1); |
| r1293 | r1294 | |
| 269 | 269 | if (!mcontrol && mcontrol ^ state) |
| 270 | 270 | { |
| 271 | 271 | state = mcontrol; |
| 272 | tmp = | |
| 272 | tmp = | |
| 273 | 273 | wavel = tmp - sl; |
| 274 | 274 | sl = tmp; |
| 275 | 275 | |
| r1293 | r1294 | |
| 286 | 286 | |
| 287 | 287 | if (imager_freq > 1) |
| 288 | 288 | { |
| 289 | mame_timer_adjust (imager_timer, | |
| 290 | double_to_mame_time(MIN(1.0/imager_freq, mame_time_to_double(mame_timer_timeleft(imager_timer)))), | |
| 289 | timer_adjust (imager_timer, | |
| 290 | double_to_attotime(MIN(1.0/imager_freq, attotime_to_double(timer_timeleft(imager_timer)))), | |
| 291 | 291 | 2, |
| 292 | | |
| 292 | | |
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | if (mcontrol && mcontrol ^ state) |
| 297 | 297 | { |
| 298 | 298 | state = mcontrol; |
| 299 | pwl = | |
| 299 | pwl = | |
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 |
| r1293 | r1294 | |
|---|---|---|
| 78 | 78 | |
| 79 | 79 | static int mapper_warning; |
| 80 | 80 | |
| 81 | static | |
| 81 | static | |
| 82 | 82 | |
| 83 | 83 | static TIMER_CALLBACK(nes_irq_callback) |
| 84 | 84 | { |
| 85 | 85 | cpunum_set_input_line (0, M6502_IRQ_LINE, HOLD_LINE); |
| 86 | | |
| 86 | | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | WRITE8_HANDLER( nes_low_mapper_w ) |
| r1293 | r1294 | |
| 640 | 640 | { |
| 641 | 641 | logerror("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, video_screen_get_vpos(0), video_screen_get_hpos(0)); |
| 642 | 642 | cpunum_set_input_line (0, M6502_IRQ_LINE, HOLD_LINE); |
| 643 | // | |
| 643 | // | |
| 644 | 644 | } |
| 645 | 645 | } |
| 646 | 646 | } |
| r1293 | r1294 | |
| 4213 | 4213 | ppu2c0x_set_hblank_callback (0, mapper ? mapper->mmc_hblank : NULL); |
| 4214 | 4214 | |
| 4215 | 4215 | if (!nes_irq_timer) |
| 4216 | nes_irq_timer = | |
| 4216 | nes_irq_timer = | |
| 4217 | 4217 | |
| 4218 | 4218 | mapper_warning = 0; |
| 4219 | 4219 | /* 8k mask */ |
| r1293 | r1294 | |
|---|---|---|
| 10 | 10 | #include "memconv.h" |
| 11 | 11 | |
| 12 | 12 | #define LOG(LEVEL,N,M,A) \ |
| 13 | if( M )logerror("%11.6f: %-24s", | |
| 13 | if( M )logerror("%11.6f: %-24s", | |
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | #define VERBOSE_LPT 1 |
| r1293 | r1294 | |
|---|---|---|
| 9 | 9 | #include "pc_joy.h" |
| 10 | 10 | #include "memconv.h" |
| 11 | 11 | |
| 12 | static | |
| 12 | static | |
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | READ8_HANDLER ( pc_JOY_r ) |
| 16 | 16 | { |
| 17 | 17 | UINT8 data = 0; |
| 18 | 18 | int delta; |
| 19 | | |
| 19 | | |
| 20 | 20 | int joystick_port = port_tag_to_index("pc_joy"); |
| 21 | 21 | |
| 22 | 22 | if (joystick_port >= 0) |
| r1293 | r1294 | |
| 24 | 24 | data = readinputport(joystick_port + 0) ^ 0xf0; |
| 25 | 25 | |
| 26 | 26 | /* timer overflow? */ |
| 27 | if (compare | |
| 27 | if (attotime_compare( | |
| 28 | 28 | { |
| 29 | 29 | /* do nothing */ |
| 30 | 30 | } |
| 31 | 31 | else |
| 32 | 32 | { |
| 33 | delta = | |
| 33 | delta = | |
| 34 | 34 | if (readinputport(joystick_port + 1) < delta) data &= ~0x01; |
| 35 | 35 | if (readinputport(joystick_port + 2) < delta) data &= ~0x02; |
| 36 | 36 | if (readinputport(joystick_port + 3) < delta) data &= ~0x04; |
| r1293 | r1294 | |
| 44 | 44 | |
| 45 | 45 | WRITE8_HANDLER ( pc_JOY_w ) |
| 46 | 46 | { |
| 47 | JOY_time = | |
| 47 | JOY_time = | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 |
| r1293 | r1294 | |
|---|---|---|
| 579 | 579 | tme=vc1541_times[vc1541->frequency>>5]*8*2; |
| 580 | 580 | if (vc1541->motor) |
| 581 | 581 | { |
| 582 | if (mame_time_to_double(mame_timer_timeelapsed(vc1541->timer)) > 1.0e29) | |
| 583 | mame_timer_reset(vc1541->timer, time_never); | |
| 582 | if (attotime_to_double(timer_timeelapsed(vc1541->timer)) > 1.0e29) | |
| 583 | timer_reset(vc1541->timer, attotime_never); | |
| 584 | 584 | else |
| 585 | | |
| 585 | | |
| 586 | 586 | } |
| 587 | 587 | else |
| 588 | 588 | { |
| 589 | | |
| 589 | | |
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | 592 | old=data; |
| r1293 | r1294 | |
| 634 | 634 | |
| 635 | 635 | logerror("floppy image %s loaded\n", image_filename(image)); |
| 636 | 636 | |
| 637 | vc1541->timer = | |
| 637 | vc1541->timer = | |
| 638 | 638 | return INIT_PASS; |
| 639 | 639 | } |
| 640 | 640 | |
| r1293 | r1294 | |
| 642 | 642 | { |
| 643 | 643 | /* writeback of image data */ |
| 644 | 644 | vc1541->d64.data = NULL; |
| 645 | | |
| 645 | | |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | int vc1541_config (int id, int mode, VC1541_CONFIG *config) |
| r1293 | r1294 | |
| 873 | 873 | tme=vc1541_times[vc1541->frequency>>5]*8*2; |
| 874 | 874 | if (vc1541->motor) |
| 875 | 875 | { |
| 876 | if (mame_time_to_double(mame_timer_timeelapsed(vc1541->timer)) > 1.0e29) | |
| 877 | mame_timer_reset(vc1541->timer, time_never); | |
| 876 | if (attotime_to_double(timer_timeelapsed(vc1541->timer)) > 1.0e29) | |
| 877 | timer_reset(vc1541->timer, attotime_never); | |
| 878 | 878 | else |
| 879 | | |
| 879 | | |
| 880 | 880 | } |
| 881 | 881 | else |
| 882 | 882 | { |
| 883 | | |
| 883 | | |
| 884 | 884 | } |
| 885 | 885 | } |
| 886 | 886 | old=data; |
| r1293 | r1294 | |
| 956 | 956 | |
| 957 | 957 | /* time should be small enough to allow quitting of the irq |
| 958 | 958 | line before the next interrupt is triggered */ |
| 959 | vc1541->drive.c1551.timer = mame_timer_alloc(c1551_timer); | |
| 960 | mame_timer_adjust(vc1541->drive.c1551.timer, time_zero, 0, MAME_TIME_IN_HZ(60)); | |
| 959 | vc1541->drive.c1551.timer = timer_alloc(c1551_timer); | |
| 960 | timer_adjust(vc1541->drive.c1551.timer, attotime_zero, 0, ATTOTIME_IN_HZ(60)); | |
| 961 | 961 | return 0; |
| 962 | 962 | } |
| 963 | 963 |
| r1293 | r1294 | |
|---|---|---|
| 58 | 58 | UINT8 timer_started; |
| 59 | 59 | |
| 60 | 60 | /* timers */ |
| 61 | mame_timer *interval; /* interval programmable timer */ | |
| 62 | mame_timer *one_shot; /* 1-us x factor one-shot timer */ | |
| 61 | emu_timer *interval; /* interval programmable timer */ | |
| 62 | emu_timer *one_shot; /* 1-us x factor one-shot timer */ | |
| 63 | 63 | |
| 64 | 64 | } mc6846; |
| 65 | 65 | |
| r1293 | r1294 | |
| 92 | 92 | { |
| 93 | 93 | if ( mc6846.timer_started ) |
| 94 | 94 | { |
| 95 | mame_time delay = mame_timer_timeleft( mc6846.interval ); | |
| 96 | return MAME_TIME_TO_CYCLES( mc6846.iface->cpunum, delay ) / FACTOR; | |
| 95 | attotime delay = timer_timeleft( mc6846.interval ); | |
| 96 | return ATTOTIME_TO_CYCLES( mc6846.iface->cpunum, delay ) / FACTOR; | |
| 97 | 97 | } |
| 98 | 98 | else |
| 99 | 99 | return mc6846.preset; |
| r1293 | r1294 | |
| 113 | 113 | if ( old_cif != cif ) |
| 114 | 114 | { |
| 115 | 115 | LOG (( "%f: mc6846 interrupt %i (time=%i cp1=%i cp2=%i)\n", |
| 116 | | |
| 116 | | |
| 117 | 117 | mc6846.csr & 1, (mc6846.csr >> 1 ) & 1, (mc6846.csr >> 2 ) & 1 )); |
| 118 | 118 | old_cif = cif; |
| 119 | 119 | } |
| r1293 | r1294 | |
| 139 | 139 | static int old_cto; |
| 140 | 140 | if ( cto != old_cto ) |
| 141 | 141 | { |
| 142 | LOG (( "%f: mc6846 CTO set to %i\n", | |
| 142 | LOG (( "%f: mc6846 CTO set to %i\n", | |
| 143 | 143 | old_cto = cto; |
| 144 | 144 | } |
| 145 | 145 | if ( mc6846.iface->out_cto_func ) |
| r1293 | r1294 | |
| 151 | 151 | INLINE void mc6846_timer_launch ( void ) |
| 152 | 152 | { |
| 153 | 153 | int delay = FACTOR * (mc6846.preset+1); |
| 154 | LOG (( "%f: mc6846 timer launch called, mode=%i, preset=%i (x%i)\n", | |
| 154 | LOG (( "%f: mc6846 timer launch called, mode=%i, preset=%i (x%i)\n", | |
| 155 | 155 | |
| 156 | 156 | if ( ! (mc6846.tcr & 2) ) |
| 157 | 157 | { |
| r1293 | r1294 | |
| 168 | 168 | |
| 169 | 169 | case 0x20: /* single-shot */ |
| 170 | 170 | mc6846.cto = 0; |
| 171 | | |
| 171 | | |
| 172 | 172 | break; |
| 173 | 173 | |
| 174 | 174 | case 0x30: /* cascaded single-shot */ |
| r1293 | r1294 | |
| 176 | 176 | |
| 177 | 177 | default: |
| 178 | 178 | logerror( "mc6846 timer mode %i not implemented\n", MODE ); |
| 179 | | |
| 179 | | |
| 180 | 180 | mc6846.timer_started = 0; |
| 181 | 181 | return; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | | |
| 184 | | |
| 185 | 185 | mc6846.timer_started = 1; |
| 186 | 186 | |
| 187 | 187 | mc6846.csr &= ~1; |
| r1293 | r1294 | |
| 197 | 197 | { |
| 198 | 198 | int delay = FACTOR * (mc6846.latch+1); |
| 199 | 199 | |
| 200 | LOG (( "%f: mc6846 timer expire called, mode=%i, latch=%i (x%i)\n", | |
| 200 | LOG (( "%f: mc6846 timer expire called, mode=%i, latch=%i (x%i)\n", | |
| 201 | 201 | |
| 202 | 202 | /* latch => counter */ |
| 203 | 203 | mc6846.preset = mc6846.latch; |
| r1293 | r1294 | |
| 222 | 222 | |
| 223 | 223 | default: |
| 224 | 224 | logerror( "mc6846 timer mode %i not implemented\n", MODE ); |
| 225 | | |
| 225 | | |
| 226 | 226 | mc6846.timer_started = 0; |
| 227 | 227 | return; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | | |
| 230 | | |
| 231 | 231 | |
| 232 | 232 | mc6846.csr |= 1; |
| 233 | 233 | mc6846_update_cto(); |
| r1293 | r1294 | |
| 238 | 238 | |
| 239 | 239 | static TIMER_CALLBACK(mc6846_timer_one_shot) |
| 240 | 240 | { |
| 241 | LOG (( "%f: mc6846 timer one shot called\n", | |
| 241 | LOG (( "%f: mc6846 timer one shot called\n", | |
| 242 | 242 | |
| 243 | 243 | /* 1 micro second after one-shot launch, we put cto to high */ |
| 244 | 244 | mc6846.cto = 1; |
| r1293 | r1294 | |
| 258 | 258 | case 0: |
| 259 | 259 | case 4: |
| 260 | 260 | LOG (( "$%04x %f: mc6846 CSR read $%02X intr=%i (timer=%i, cp1=%i, cp2=%i)\n", |
| 261 | activecpu_get_previouspc(), | |
| 261 | activecpu_get_previouspc(), | |
| 262 | 262 | mc6846.csr, (mc6846.csr >> 7) & 1, |
| 263 | 263 | mc6846.csr & 1, (mc6846.csr >> 1) & 1, (mc6846.csr >> 2) & 1 )); |
| 264 | 264 | mc6846.csr0_to_be_cleared = mc6846.csr & 1; |
| r1293 | r1294 | |
| 267 | 267 | return mc6846.csr; |
| 268 | 268 | |
| 269 | 269 | case 1: |
| 270 | LOG (( "$%04x %f: mc6846 PCR read $%02X\n", activecpu_get_previouspc(), | |
| 270 | LOG (( "$%04x %f: mc6846 PCR read $%02X\n", activecpu_get_previouspc(), | |
| 271 | 271 | return mc6846.pcr; |
| 272 | 272 | |
| 273 | 273 | case 2: |
| 274 | LOG (( "$%04x %f: mc6846 DDR read $%02X\n", activecpu_get_previouspc(), | |
| 274 | LOG (( "$%04x %f: mc6846 DDR read $%02X\n", activecpu_get_previouspc(), | |
| 275 | 275 | return mc6846.ddr; |
| 276 | 276 | |
| 277 | 277 | case 3: |
| 278 | LOG (( "$%04x %f: mc6846 PORT read $%02X\n", activecpu_get_previouspc(), | |
| 278 | LOG (( "$%04x %f: mc6846 PORT read $%02X\n", activecpu_get_previouspc(), | |
| 279 | 279 | if ( ! (mc6846.pcr & 0x80) ) |
| 280 | 280 | { |
| 281 | 281 | if ( mc6846.csr1_to_be_cleared ) |
| r1293 | r1294 | |
| 289 | 289 | return PORT; |
| 290 | 290 | |
| 291 | 291 | case 5: |
| 292 | LOG (( "$%04x %f: mc6846 TCR read $%02X\n",activecpu_get_previouspc(), | |
| 292 | LOG (( "$%04x %f: mc6846 TCR read $%02X\n",activecpu_get_previouspc(), | |
| 293 | 293 | return mc6846.tcr; |
| 294 | 294 | |
| 295 | 295 | case 6: |
| 296 | LOG (( "$%04x %f: mc6846 COUNTER hi read $%02X\n", activecpu_get_previouspc(), | |
| 296 | LOG (( "$%04x %f: mc6846 COUNTER hi read $%02X\n", activecpu_get_previouspc(), | |
| 297 | 297 | if ( mc6846.csr0_to_be_cleared ) |
| 298 | 298 | { |
| 299 | 299 | mc6846.csr &= ~1; |
| r1293 | r1294 | |
| 303 | 303 | return mc6846_counter() >> 8; |
| 304 | 304 | |
| 305 | 305 | case 7: |
| 306 | LOG (( "$%04x %f: mc6846 COUNTER low read $%02X\n", activecpu_get_previouspc(), | |
| 306 | LOG (( "$%04x %f: mc6846 COUNTER low read $%02X\n", activecpu_get_previouspc(), | |
| 307 | 307 | if ( mc6846.csr0_to_be_cleared ) |
| 308 | 308 | { |
| 309 | 309 | mc6846.csr &= ~1; |
| r1293 | r1294 | |
| 343 | 343 | "latcged,pos-edge", "latcged,pos-edge,intr" |
| 344 | 344 | }; |
| 345 | 345 | LOG (( "$%04x %f: mc6846 PCR write $%02X reset=%i cp2=%s cp1=%s\n", |
| 346 | activecpu_get_previouspc(), | |
| 346 | activecpu_get_previouspc(), | |
| 347 | 347 | (data >> 7) & 1, cp2[ (data >> 3) & 7 ], cp1[ data & 7 ] )); |
| 348 | 348 | #endif |
| 349 | 349 | } |
| r1293 | r1294 | |
| 371 | 371 | break; |
| 372 | 372 | |
| 373 | 373 | case 2: |
| 374 | LOG (( "$%04x %f: mc6846 DDR write $%02X\n", activecpu_get_previouspc(), | |
| 374 | LOG (( "$%04x %f: mc6846 DDR write $%02X\n", activecpu_get_previouspc(), | |
| 375 | 375 | if ( ! (mc6846.pcr & 0x80) ) |
| 376 | 376 | { |
| 377 | 377 | mc6846.ddr = data; |
| r1293 | r1294 | |
| 381 | 381 | break; |
| 382 | 382 | |
| 383 | 383 | case 3: |
| 384 | LOG (( "$%04x %f: mc6846 PORT write $%02X (mask=$%02X)\n", activecpu_get_previouspc(), | |
| 384 | LOG (( "$%04x %f: mc6846 PORT write $%02X (mask=$%02X)\n", activecpu_get_previouspc(), | |
| 385 | 385 | if ( ! (mc6846.pcr & 0x80) ) |
| 386 | 386 | { |
| 387 | 387 | mc6846.pdr = data; |
| r1293 | r1294 | |
| 390 | 390 | if ( mc6846.csr1_to_be_cleared && (mc6846.csr & 2) ) |
| 391 | 391 | { |
| 392 | 392 | mc6846.csr &= ~2; |
| 393 | LOG (( "$%04x %f: mc6846 CP1 intr reset\n", activecpu_get_previouspc(), | |
| 393 | LOG (( "$%04x %f: mc6846 CP1 intr reset\n", activecpu_get_previouspc(), | |
| 394 | 394 | } |
| 395 | 395 | if ( mc6846.csr2_to_be_cleared && (mc6846.csr & 4) ) |
| 396 | 396 | { |
| 397 | 397 | mc6846.csr &= ~4; |
| 398 | LOG (( "$%04x %f: mc6846 CP2 intr reset\n", activecpu_get_previouspc(), | |
| 398 | LOG (( "$%04x %f: mc6846 CP2 intr reset\n", activecpu_get_previouspc(), | |
| 399 | 399 | } |
| 400 | 400 | mc6846.csr1_to_be_cleared = 0; |
| 401 | 401 | mc6846.csr2_to_be_cleared = 0; |
| r1293 | r1294 | |
| 412 | 412 | "freq-cmp", "freq-cmp", "pulse-cmp", "pulse-cmp" |
| 413 | 413 | }; |
| 414 | 414 | LOG (( "$%04x %f: mc6846 TCR write $%02X reset=%i clock=%s scale=%i mode=%s out=%s\n", |
| 415 | activecpu_get_previouspc(), | |
| 415 | activecpu_get_previouspc(), | |
| 416 | 416 | (data >> 7) & 1, (data & 0x40) ? "extern" : "sys", |
| 417 | 417 | (data & 0x40) ? 1 : 8, mode[ (data >> 1) & 7 ], |
| 418 | 418 | (data & 1) ? "enabled" : "0" )); |
| r1293 | r1294 | |
| 426 | 426 | if ( MODE != 0x30 ) |
| 427 | 427 | mc6846.cto = 0; |
| 428 | 428 | mc6846_update_cto(); |
| 429 | mame_timer_reset( mc6846.interval, time_never ); | |
| 430 | mame_timer_reset( mc6846.one_shot, time_never ); | |
| 429 | timer_reset( mc6846.interval, attotime_never ); | |
| 430 | timer_reset( mc6846.one_shot, attotime_never ); | |
| 431 | 431 | mc6846.timer_started = 0; |
| 432 | 432 | } |
| 433 | 433 | else |
| r1293 | r1294 | |
| 446 | 446 | |
| 447 | 447 | case 7: |
| 448 | 448 | mc6846.latch = ( ((UINT16) mc6846.time_MSB) << 8 ) + data; |
| 449 | LOG (( "$%04x %f: mc6846 COUNT write %i\n", activecpu_get_previouspc(), | |
| 449 | LOG (( "$%04x %f: mc6846 COUNT write %i\n", activecpu_get_previouspc(), | |
| 450 | 450 | if (!(mc6846.tcr & 0x38)) |
| 451 | 451 | { |
| 452 | 452 | /* timer initialization */ |
| r1293 | r1294 | |
| 478 | 478 | if ( data == mc6846.cp1 ) |
| 479 | 479 | return; |
| 480 | 480 | mc6846.cp1 = data; |
| 481 | LOG (( "%f: mc6846 input CP1 set to %i\n", | |
| 481 | LOG (( "%f: mc6846 input CP1 set to %i\n", | |
| 482 | 482 | if (( data && (mc6846.pcr & 2)) || (!data && !(mc6846.pcr & 2))) |
| 483 | 483 | { |
| 484 | 484 | mc6846.csr |= 2; |
| r1293 | r1294 | |
| 492 | 492 | if ( data == mc6846.cp2 ) |
| 493 | 493 | return; |
| 494 | 494 | mc6846.cp2 = data; |
| 495 | LOG (( "%f: mc6846 input CP2 set to %i\n", | |
| 495 | LOG (( "%f: mc6846 input CP2 set to %i\n", | |
| 496 | 496 | if (mc6846.pcr & 0x20) |
| 497 | 497 | { |
| 498 | 498 | if (( data && (mc6846.pcr & 0x10)) || (!data && !(mc6846.pcr & 0x10))) |
| r1293 | r1294 | |
| 560 | 560 | mc6846.csr1_to_be_cleared = 0; |
| 561 | 561 | mc6846.csr2_to_be_cleared = 0; |
| 562 | 562 | mc6846.timer_started = 0; |
| 563 | mame_timer_reset( mc6846.interval, time_never ); | |
| 564 | mame_timer_reset( mc6846.one_shot, time_never ); | |
| 563 | timer_reset( mc6846.interval, attotime_never ); | |
| 564 | timer_reset( mc6846.one_shot, attotime_never ); | |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | |
| r1293 | r1294 | |
| 571 | 571 | void mc6846_config ( const mc6846_interface* iface ) |
| 572 | 572 | { |
| 573 | 573 | mc6846.iface = iface; |
| 574 | mc6846.interval = mame_timer_alloc( mc6846_timer_expire ); | |
| 575 | mc6846.one_shot = mame_timer_alloc( mc6846_timer_one_shot ); | |
| 574 | mc6846.interval = timer_alloc( mc6846_timer_expire ); | |
| 575 | mc6846.one_shot = timer_alloc( mc6846_timer_one_shot ); | |
| 576 | 576 | |
| 577 | 577 | state_save_register_item( "mc6846", 0, mc6846.csr ); |
| 578 | 578 | state_save_register_item( "mc6846", 0, mc6846.pcr ); |
| r1293 | r1294 | |
|---|---|---|
| 73 | 73 | |
| 74 | 74 | #if VERBOSE_IRQ |
| 75 | 75 | if ( !old && thom_irq ) |
| 76 | logerror( "%f thom_set_irq: irq line up %i\n", | |
| 76 | logerror( "%f thom_set_irq: irq line up %i\n", | |
| 77 | 77 | if ( old && !thom_irq ) |
| 78 | logerror( "%f thom_set_irq: irq line down %i\n", | |
| 78 | logerror( "%f thom_set_irq: irq line down %i\n", | |
| 79 | 79 | #endif |
| 80 | 80 | |
| 81 | 81 | cpunum_set_input_line( 0, M6809_IRQ_LINE, thom_irq ? ASSERT_LINE : CLEAR_LINE ); |
| r1293 | r1294 | |
| 97 | 97 | |
| 98 | 98 | #if VERBOSE_IRQ |
| 99 | 99 | if ( !old && thom_firq ) |
| 100 | logerror( "%f thom_set_firq: firq line up %i\n", | |
| 100 | logerror( "%f thom_set_firq: firq line up %i\n", | |
| 101 | 101 | if ( old && !thom_firq ) |
| 102 | logerror( "%f thom_set_firq: firq line down %i\n", | |
| 102 | logerror( "%f thom_set_firq: firq line down %i\n", | |
| 103 | 103 | #endif |
| 104 | 104 | |
| 105 | 105 | cpunum_set_input_line( 0, M6809_FIRQ_LINE, thom_firq ? ASSERT_LINE : CLEAR_LINE ); |
| r1293 | r1294 | |
| 427 | 427 | return; |
| 428 | 428 | |
| 429 | 429 | #if VERBOSE_VIDEO |
| 430 | logerror( "%f to7_lightpen_cb: step=%i\n", | |
| 430 | logerror( "%f to7_lightpen_cb: step=%i\n", | |
| 431 | 431 | #endif |
| 432 | 432 | |
| 433 | 433 | pia_set_input_cb1( THOM_PIA_SYS, 1 ); |
| r1293 | r1294 | |
| 446 | 446 | /* INIT signal wired to system PIA 6821 */ |
| 447 | 447 | |
| 448 | 448 | #if VERBOSE_VIDEO |
| 449 | logerror( "%f to7_set_init: init=%i\n", | |
| 449 | logerror( "%f to7_set_init: init=%i\n", | |
| 450 | 450 | #endif |
| 451 | 451 | |
| 452 | 452 | pia_set_input_ca1( THOM_PIA_SYS, init ); |
| r1293 | r1294 | |
| 559 | 559 | { |
| 560 | 560 | /* acknowledge from centronics printer to PIA */ |
| 561 | 561 | int ack = (data & CENTRONICS_ACKNOWLEDGE) ? 1 : 0; |
| 562 | LOG (( "%f to7_io_ack: CENTRONICS new state $%02X (ack=%i)\n", | |
| 562 | LOG (( "%f to7_io_ack: CENTRONICS new state $%02X (ack=%i)\n", | |
| 563 | 563 | pia_set_input_cb1( THOM_PIA_IO, ack ); |
| 564 | 564 | } |
| 565 | 565 | |
| r1293 | r1294 | |
| 571 | 571 | int dtr = ( data & 2 ) ? 1 : 0; |
| 572 | 572 | |
| 573 | 573 | #if VERBOSE_IO |
| 574 | logerror( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n", activecpu_get_previouspc(), | |
| 574 | logerror( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n", activecpu_get_previouspc(), | |
| 575 | 575 | #endif |
| 576 | 576 | |
| 577 | 577 | if ( dtr ) |
| r1293 | r1294 | |
| 597 | 597 | cts = ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) ? 1 : 0; |
| 598 | 598 | |
| 599 | 599 | #if VERBOSE_IO |
| 600 | logerror( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", activecpu_get_previouspc(), | |
| 600 | logerror( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", activecpu_get_previouspc(), | |
| 601 | 601 | #endif |
| 602 | 602 | |
| 603 | 603 | return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0); |
| r1293 | r1294 | |
| 610 | 610 | /* set 8-bit data */ |
| 611 | 611 | |
| 612 | 612 | #if VERBOSE_IO |
| 613 | logerror( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", activecpu_get_previouspc(), | |
| 613 | logerror( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", activecpu_get_previouspc(), | |
| 614 | 614 | #endif |
| 615 | 615 | |
| 616 | 616 | centronics_write_data( 0, data ); |
| r1293 | r1294 | |
| 623 | 623 | /* send STROBE to printer */ |
| 624 | 624 | |
| 625 | 625 | #if VERBOSE_IO |
| 626 | logerror( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", activecpu_get_previouspc(), | |
| 626 | logerror( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", activecpu_get_previouspc(), | |
| 627 | 627 | #endif |
| 628 | 628 | |
| 629 | 629 | centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE ); |
| r1293 | r1294 | |
| 637 | 637 | to7_io_line.input_state = state; |
| 638 | 638 | |
| 639 | 639 | #if VERBOSE_IO |
| 640 | logerror( "%f to7_io_in_callback: cts=%i dsr=%i rd=%i\n", | |
| 640 | logerror( "%f to7_io_in_callback: cts=%i dsr=%i rd=%i\n", | |
| 641 | 641 | #endif |
| 642 | 642 | |
| 643 | 643 | } |
| r1293 | r1294 | |
| 838 | 838 | |
| 839 | 839 | |
| 840 | 840 | |
| 841 | #define TO7_GAME_POLL_PERIOD | |
| 841 | #define TO7_GAME_POLL_PERIOD | |
| 842 | 842 | |
| 843 | 843 | |
| 844 | 844 | |
| 845 | 845 | /* calls to7_game_update_cb periodically */ |
| 846 | static | |
| 846 | static | |
| 847 | 847 | |
| 848 | 848 | static UINT8 to7_game_sound; |
| 849 | 849 | static UINT8 to7_game_mute; |
| r1293 | r1294 | |
| 1008 | 1008 | { |
| 1009 | 1009 | LOG (( "to7_game_init called\n" )); |
| 1010 | 1010 | pia_config( THOM_PIA_GAME, &to7_game ); |
| 1011 | to7_game_timer = mame_timer_alloc( to7_game_update_cb ); | |
| 1012 | mame_timer_adjust( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD ); | |
| 1011 | to7_game_timer = timer_alloc( to7_game_update_cb ); | |
| 1012 | timer_adjust( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD ); | |
| 1013 | 1013 | state_save_register_global( to7_game_sound ); |
| 1014 | 1014 | state_save_register_global( to7_game_mute ); |
| 1015 | 1015 | } |
| r1293 | r1294 | |
| 1116 | 1116 | /* bit 7: interrupt */ |
| 1117 | 1117 | #if VERBOSE_MIDI |
| 1118 | 1118 | logerror( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n", |
| 1119 | activecpu_get_previouspc(), | |
| 1119 | activecpu_get_previouspc(), | |
| 1120 | 1120 | (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0, |
| 1121 | 1121 | (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0, |
| 1122 | 1122 | (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0, |
| r1293 | r1294 | |
| 1136 | 1136 | to7_midi_overrun = 0; |
| 1137 | 1137 | #if VERBOSE_MIDI |
| 1138 | 1138 | logerror( "$%04x %f to7_midi_r: read data $%02X\n", |
| 1139 | activecpu_get_previouspc(), | |
| 1139 | activecpu_get_previouspc(), | |
| 1140 | 1140 | #endif |
| 1141 | 1141 | to7_midi_update_irq(); |
| 1142 | 1142 | return data; |
| r1293 | r1294 | |
| 1165 | 1165 | { |
| 1166 | 1166 | /* reset */ |
| 1167 | 1167 | #if VERBOSE_MIDI |
| 1168 | logerror( "$%04x %f to7_midi_w: reset (data=$%02X)\n", activecpu_get_previouspc(), | |
| 1168 | logerror( "$%04x %f to7_midi_w: reset (data=$%02X)\n", activecpu_get_previouspc(), | |
| 1169 | 1169 | #endif |
| 1170 | 1170 | to7_midi_overrun = 0; |
| 1171 | 1171 | to7_midi_status = 2; |
| r1293 | r1294 | |
| 1184 | 1184 | static int stop[8] = { 2,2,1,1,2,1,1,1 }; |
| 1185 | 1185 | static char parity[8] = { 'e','o','e','o','-','-','e','o' }; |
| 1186 | 1186 | logerror( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n", |
| 1187 | activecpu_get_previouspc(), | |
| 1187 | activecpu_get_previouspc(), | |
| 1188 | 1188 | data, |
| 1189 | 1189 | bits[ (data >> 2) & 7 ], |
| 1190 | 1190 | stop[ (data >> 2) & 7 ], |
| r1293 | r1294 | |
| 1200 | 1200 | |
| 1201 | 1201 | case 1: /* output data */ |
| 1202 | 1202 | #if VERBOSE_MIDI |
| 1203 | logerror( "$%04x %f to7_midi_w: write data $%02X\n", activecpu_get_previouspc(), | |
| 1203 | logerror( "$%04x %f to7_midi_w: write data $%02X\n", activecpu_get_previouspc(), | |
| 1204 | 1204 | #endif |
| 1205 | 1205 | if ( data == 0x55 ) |
| 1206 | 1206 | /* cable-detect: shortcut */ |
| r1293 | r1294 | |
| 1628 | 1628 | |
| 1629 | 1629 | |
| 1630 | 1630 | |
| 1631 | static | |
| 1631 | static | |
| 1632 | 1632 | |
| 1633 | 1633 | |
| 1634 | 1634 | |
| r1293 | r1294 | |
| 1644 | 1644 | static void mo5_init_timer(void) |
| 1645 | 1645 | { |
| 1646 | 1646 | /* time is a faster than 50 Hz to match video framerate */ |
| 1647 | | |
| 1647 | | |
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | 1650 | |
| r1293 | r1294 | |
| 1930 | 1930 | to7_modem_init(); |
| 1931 | 1931 | to7_midi_init(); |
| 1932 | 1932 | to7_rf57932_init(); |
| 1933 | mo5_periodic_timer = | |
| 1933 | mo5_periodic_timer = | |
| 1934 | 1934 | mea8000_config( THOM_SOUND_SPEECH, NULL ); |
| 1935 | 1935 | |
| 1936 | 1936 | /* memory */ |
| r1293 | r1294 | |
| 1969 | 1969 | |
| 1970 | 1970 | WRITE8_HANDLER ( to9_ieee_w ) |
| 1971 | 1971 | { |
| 1972 | logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", activecpu_get_previouspc(), | |
| 1972 | logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", activecpu_get_previouspc(), | |
| 1973 | 1973 | } |
| 1974 | 1974 | |
| 1975 | 1975 | |
| 1976 | 1976 | |
| 1977 | 1977 | READ8_HANDLER ( to9_ieee_r ) |
| 1978 | 1978 | { |
| 1979 | logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", activecpu_get_previouspc(), | |
| 1979 | logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", activecpu_get_previouspc(), | |
| 1980 | 1980 | return 0; |
| 1981 | 1981 | } |
| 1982 | 1982 | |
| r1293 | r1294 | |
| 2103 | 2103 | WRITE8_HANDLER ( to9_vreg_w ) |
| 2104 | 2104 | { |
| 2105 | 2105 | #if VERBOSE_VIDEO |
| 2106 | logerror( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", activecpu_get_previouspc(), | |
| 2106 | logerror( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", activecpu_get_previouspc(), | |
| 2107 | 2107 | #endif |
| 2108 | 2108 | |
| 2109 | 2109 | switch ( offset ) |
| r1293 | r1294 | |
| 2297 | 2297 | |
| 2298 | 2298 | |
| 2299 | 2299 | /* normal mode: polling interval */ |
| 2300 | #define TO9_KBD_POLL_PERIOD | |
| 2300 | #define TO9_KBD_POLL_PERIOD | |
| 2301 | 2301 | |
| 2302 | 2302 | /* peripherial mode: time between two bytes, and after last byte */ |
| 2303 | #define TO9_KBD_BYTE_SPACE MAME_TIME_IN_USEC( 300 ) | |
| 2304 | #define TO9_KBD_END_SPACE MAME_TIME_IN_USEC( 9100 ) | |
| 2303 | #define TO9_KBD_BYTE_SPACE ATTOTIME_IN_USEC( 300 ) | |
| 2304 | #define TO9_KBD_END_SPACE ATTOTIME_IN_USEC( 9100 ) | |
| 2305 | 2305 | |
| 2306 | 2306 | /* first and subsequent repeat periods, in TO9_KBD_POLL_PERIOD units */ |
| 2307 | 2307 | #define TO9_KBD_REPEAT_DELAY 80 /* 800 ms */ |
| r1293 | r1294 | |
| 2325 | 2325 | static UINT8 to9_kbd_caps; /* caps-lock */ |
| 2326 | 2326 | static UINT8 to9_kbd_pad; /* keypad outputs special codes */ |
| 2327 | 2327 | |
| 2328 | static | |
| 2328 | static | |
| 2329 | 2329 | |
| 2330 | 2330 | |
| 2331 | 2331 | |
| r1293 | r1294 | |
| 2386 | 2386 | /* bit 7: interrupt */ |
| 2387 | 2387 | #if VERBOSE_KBD |
| 2388 | 2388 | logerror( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n", |
| 2389 | activecpu_get_previouspc(), | |
| 2389 | activecpu_get_previouspc(), | |
| 2390 | 2390 | (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0, |
| 2391 | 2391 | (to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0, |
| 2392 | 2392 | (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0, |
| r1293 | r1294 | |
| 2403 | 2403 | to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF); |
| 2404 | 2404 | to9_kbd_overrun = 0; |
| 2405 | 2405 | #if VERBOSE_KBD |
| 2406 | logerror( "$%04x %f to9_kbd_r: read data $%02X\n", activecpu_get_previouspc(), | |
| 2406 | logerror( "$%04x %f to9_kbd_r: read data $%02X\n", activecpu_get_previouspc(), | |
| 2407 | 2407 | #endif |
| 2408 | 2408 | to9_kbd_update_irq(); |
| 2409 | 2409 | return to9_kbd_in; |
| r1293 | r1294 | |
| 2432 | 2432 | to9_kbd_status = ACIA_6850_TDRE; |
| 2433 | 2433 | to9_kbd_intr = 0; |
| 2434 | 2434 | #if VERBOSE_KBD |
| 2435 | logerror( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", activecpu_get_previouspc(), | |
| 2435 | logerror( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", activecpu_get_previouspc(), | |
| 2436 | 2436 | #endif |
| 2437 | 2437 | } |
| 2438 | 2438 | else |
| r1293 | r1294 | |
| 2447 | 2447 | to9_kbd_intr = data >> 5; |
| 2448 | 2448 | #if VERBOSE_KBD |
| 2449 | 2449 | logerror( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n", |
| 2450 | activecpu_get_previouspc(), | |
| 2450 | activecpu_get_previouspc(), | |
| 2451 | 2451 | data, to9_kbd_parity, to9_kbd_intr >> 2, |
| 2452 | 2452 | (to9_kbd_intr & 3) ? 1 : 0 ); |
| 2453 | 2453 | #endif |
| r1293 | r1294 | |
| 2479 | 2479 | case 0xFE: to9_kbd_periph = 0; break; |
| 2480 | 2480 | |
| 2481 | 2481 | default: |
| 2482 | logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", activecpu_get_previouspc(), | |
| 2482 | logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", activecpu_get_previouspc(), | |
| 2483 | 2483 | } |
| 2484 | 2484 | |
| 2485 | 2485 | thom_set_caps_led( ! to9_kbd_caps ); |
| 2486 | 2486 | |
| 2487 | 2487 | LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n", |
| 2488 | activecpu_get_previouspc(), | |
| 2488 | activecpu_get_previouspc(), | |
| 2489 | 2489 | to9_kbd_caps, to9_kbd_pad, to9_kbd_periph )); |
| 2490 | 2490 | |
| 2491 | 2491 | break; |
| r1293 | r1294 | |
| 2508 | 2508 | /* overrun will be set when the current valid byte is read */ |
| 2509 | 2509 | to9_kbd_overrun = 1; |
| 2510 | 2510 | #if VERBOSE_KBD |
| 2511 | logerror( "%f to9_kbd_send: overrun => drop data=$%02X, parity=%i\n", | |
| 2511 | logerror( "%f to9_kbd_send: overrun => drop data=$%02X, parity=%i\n", | |
| 2512 | 2512 | #endif |
| 2513 | 2513 | } |
| 2514 | 2514 | else |
| r1293 | r1294 | |
| 2521 | 2521 | else |
| 2522 | 2522 | to9_kbd_status |= ACIA_6850_PE; /* parity error */ |
| 2523 | 2523 | #if VERBOSE_KBD |
| 2524 | logerror( "%f to9_kbd_send: data=$%02X, parity=%i, status=$%02X\n", | |
| 2524 | logerror( "%f to9_kbd_send: data=$%02X, parity=%i, status=$%02X\n", | |
| 2525 | 2525 | #endif |
| 2526 | 2526 | } |
| 2527 | 2527 | to9_kbd_update_irq(); |
| r1293 | r1294 | |
| 2701 | 2701 | } |
| 2702 | 2702 | |
| 2703 | 2703 | to9_kbd_byte_count = ( to9_kbd_byte_count + 1 ) & 3; |
| 2704 | | |
| 2704 | | |
| 2705 | 2705 | } |
| 2706 | 2706 | else |
| 2707 | 2707 | { |
| r1293 | r1294 | |
| 2709 | 2709 | /* keyboard mode: send a byte only if a key is down */ |
| 2710 | 2710 | if ( key ) |
| 2711 | 2711 | to9_kbd_send( key, 0 ); |
| 2712 | | |
| 2712 | | |
| 2713 | 2713 | } |
| 2714 | 2714 | } |
| 2715 | 2715 | |
| r1293 | r1294 | |
| 2729 | 2729 | to9_kbd_key_count = 0; |
| 2730 | 2730 | to9_kbd_last_key = 0xff; |
| 2731 | 2731 | to9_kbd_update_irq(); |
| 2732 | | |
| 2732 | | |
| 2733 | 2733 | } |
| 2734 | 2734 | |
| 2735 | 2735 | |
| r1293 | r1294 | |
| 2737 | 2737 | static void to9_kbd_init ( void ) |
| 2738 | 2738 | { |
| 2739 | 2739 | LOG(( "to9_kbd_init called\n" )); |
| 2740 | to9_kbd_timer = | |
| 2740 | to9_kbd_timer = | |
| 2741 | 2741 | state_save_register_global( to9_kbd_parity ); |
| 2742 | 2742 | state_save_register_global( to9_kbd_intr ); |
| 2743 | 2743 | state_save_register_global( to9_kbd_in ); |
| r1293 | r1294 | |
| 2770 | 2770 | |
| 2771 | 2771 | #if VERBOSE_IO |
| 2772 | 2772 | logerror( "$%04x %f to9_update_centronics: data=$%02X strobe=%i\n", |
| 2773 | activecpu_get_previouspc(), | |
| 2773 | activecpu_get_previouspc(), | |
| 2774 | 2774 | (b & 2) ? 1 : 0 ); |
| 2775 | 2775 | #endif |
| 2776 | 2776 | } |
| r1293 | r1294 | |
| 2959 | 2959 | |
| 2960 | 2960 | |
| 2961 | 2961 | /* polling interval */ |
| 2962 | #define TO8_KBD_POLL_PERIOD | |
| 2962 | #define TO8_KBD_POLL_PERIOD | |
| 2963 | 2963 | |
| 2964 | 2964 | /* first and subsequent repeat periods, in TO8_KBD_POLL_PERIOD units */ |
| 2965 | 2965 | #define TO8_KBD_REPEAT_DELAY 800 /* 800 ms */ |
| 2966 | 2966 | #define TO8_KBD_REPEAT_PERIOD 70 /* 70 ms */ |
| 2967 | 2967 | |
| 2968 | 2968 | /* timeout waiting for CPU */ |
| 2969 | #define TO8_KBD_TIMEOUT | |
| 2969 | #define TO8_KBD_TIMEOUT | |
| 2970 | 2970 | |
| 2971 | 2971 | |
| 2972 | 2972 | |
| r1293 | r1294 | |
| 2978 | 2978 | static UINT32 to8_kbd_key_count; /* keypress time (for repetition) */ |
| 2979 | 2979 | static UINT8 to8_kbd_caps; /* caps lock */ |
| 2980 | 2980 | |
| 2981 | static mame_timer* to8_kbd_timer; /* bit-send */ | |
| 2982 | static mame_timer* to8_kbd_signal; /* signal from CPU */ | |
| 2981 | static emu_timer* to8_kbd_timer; /* bit-send */ | |
| 2982 | static emu_timer* to8_kbd_signal; /* signal from CPU */ | |
| 2983 | 2983 | |
| 2984 | 2984 | |
| 2985 | 2985 | |
| r1293 | r1294 | |
| 3083 | 3083 | /* keyboard automaton */ |
| 3084 | 3084 | static TIMER_CALLBACK(to8_kbd_timer_cb) |
| 3085 | 3085 | { |
| 3086 | | |
| 3086 | | |
| 3087 | 3087 | |
| 3088 | 3088 | #if VERBOSE_KBD |
| 3089 | logerror( "%f to8_kbd_timer_cb: step=%i ack=%i data=$%03X\n", | |
| 3089 | logerror( "%f to8_kbd_timer_cb: step=%i ack=%i data=$%03X\n", | |
| 3090 | 3090 | #endif |
| 3091 | 3091 | |
| 3092 | 3092 | if( ! to8_kbd_step ) |
| r1293 | r1294 | |
| 3110 | 3110 | #endif |
| 3111 | 3111 | to8_kbd_data = k; |
| 3112 | 3112 | to8_kbd_step = 1; |
| 3113 | d = | |
| 3113 | d = | |
| 3114 | 3114 | } |
| 3115 | 3115 | } |
| 3116 | 3116 | else if ( to8_kbd_step == 255 ) |
| r1293 | r1294 | |
| 3140 | 3140 | { |
| 3141 | 3141 | /* send silence between bits */ |
| 3142 | 3142 | mc6846_set_input_cp1( 0 ); |
| 3143 | d = | |
| 3143 | d = | |
| 3144 | 3144 | to8_kbd_step++; |
| 3145 | 3145 | } |
| 3146 | 3146 | else |
| r1293 | r1294 | |
| 3149 | 3149 | int bpos = 8 - ( (to8_kbd_step - 100) / 2); |
| 3150 | 3150 | int bit = (to8_kbd_data >> bpos) & 1; |
| 3151 | 3151 | mc6846_set_input_cp1( 1 ); |
| 3152 | d = | |
| 3152 | d = | |
| 3153 | 3153 | to8_kbd_step++; |
| 3154 | 3154 | } |
| 3155 | | |
| 3155 | | |
| 3156 | 3156 | } |
| 3157 | 3157 | |
| 3158 | 3158 | |
| r1293 | r1294 | |
| 3166 | 3166 | |
| 3167 | 3167 | if ( data ) |
| 3168 | 3168 | { |
| 3169 | double len = | |
| 3169 | double len = | |
| 3170 | 3170 | #if VERBOSE_KBD |
| 3171 | logerror( "%f to8_kbd_set_ack: CPU end ack, len=%f\n", | |
| 3171 | logerror( "%f to8_kbd_set_ack: CPU end ack, len=%f\n", | |
| 3172 | 3172 | #endif |
| 3173 | 3173 | if ( to8_kbd_data == 0xfff ) |
| 3174 | 3174 | { |
| 3175 | 3175 | /* end signal from CPU */ |
| 3176 | 3176 | if ( len >= 0.6 && len <= 0.8 ) |
| 3177 | 3177 | { |
| 3178 | LOG (( "%f to8_kbd_set_ack: INIT signal\n", | |
| 3178 | LOG (( "%f to8_kbd_set_ack: INIT signal\n", | |
| 3179 | 3179 | to8_kbd_last_key = 0xff; |
| 3180 | 3180 | to8_kbd_key_count = 0; |
| 3181 | 3181 | to8_kbd_caps = 1; |
| 3182 | 3182 | /* send back signal: TODO returned codes ? */ |
| 3183 | 3183 | to8_kbd_data = 0; |
| 3184 | 3184 | to8_kbd_step = 0; |
| 3185 | | |
| 3185 | | |
| 3186 | 3186 | } |
| 3187 | 3187 | else |
| 3188 | 3188 | { |
| 3189 | 3189 | to8_kbd_step = 0; |
| 3190 | | |
| 3190 | | |
| 3191 | 3191 | if ( len >= 1.2 && len <= 1.4 ) |
| 3192 | 3192 | { |
| 3193 | LOG (( "%f to8_kbd_set_ack: CAPS on signal\n", | |
| 3193 | LOG (( "%f to8_kbd_set_ack: CAPS on signal\n", | |
| 3194 | 3194 | to8_kbd_caps = 1; |
| 3195 | 3195 | } |
| 3196 | 3196 | else if ( len >= 1.8 && len <= 2.0 ) |
| 3197 | 3197 | { |
| 3198 | LOG (( "%f to8_kbd_set_ack: CAPS off signal\n", | |
| 3198 | LOG (( "%f to8_kbd_set_ack: CAPS off signal\n", | |
| 3199 | 3199 | to8_kbd_caps = 0; |
| 3200 | 3200 | } |
| 3201 | 3201 | } |
| r1293 | r1294 | |
| 3205 | 3205 | { |
| 3206 | 3206 | /* end key transmission */ |
| 3207 | 3207 | to8_kbd_step = 0; |
| 3208 | | |
| 3208 | | |
| 3209 | 3209 | } |
| 3210 | 3210 | } |
| 3211 | 3211 | |
| r1293 | r1294 | |
| 3215 | 3215 | { |
| 3216 | 3216 | /* CPU accepts key */ |
| 3217 | 3217 | to8_kbd_step = 99; |
| 3218 | | |
| 3218 | | |
| 3219 | 3219 | } |
| 3220 | 3220 | else |
| 3221 | 3221 | { |
| 3222 | 3222 | /* start signal from CPU */ |
| 3223 | 3223 | to8_kbd_data = 0xfff; |
| 3224 | 3224 | to8_kbd_step = 91; |
| 3225 | mame_timer_adjust( to8_kbd_timer, MAME_TIME_IN_USEC( 400 ), 0, time_never ); | |
| 3226 | mame_timer_adjust( to8_kbd_signal, time_never, 0, time_never ); | |
| 3225 | timer_adjust( to8_kbd_timer, ATTOTIME_IN_USEC( 400 ), 0, attotime_never ); | |
| 3226 | timer_adjust( to8_kbd_signal, attotime_never, 0, attotime_never ); | |
| 3227 | 3227 | } |
| 3228 | 3228 | #if VERBOSE_KBD |
| 3229 | logerror( "%f to8_kbd_set_ack: CPU ack, data=$%03X\n", | |
| 3229 | logerror( "%f to8_kbd_set_ack: CPU ack, data=$%03X\n", | |
| 3230 | 3230 | #endif |
| 3231 | 3231 | } |
| 3232 | 3232 | } |
| r1293 | r1294 | |
| 3249 | 3249 | |
| 3250 | 3250 | static void to8_kbd_init ( void ) |
| 3251 | 3251 | { |
| 3252 | to8_kbd_timer = mame_timer_alloc( to8_kbd_timer_cb ); | |
| 3253 | to8_kbd_signal = mame_timer_alloc( NULL ); | |
| 3252 | to8_kbd_timer = timer_alloc( to8_kbd_timer_cb ); | |
| 3253 | to8_kbd_signal = timer_alloc( NULL ); | |
| 3254 | 3254 | state_save_register_global( to8_kbd_ack ); |
| 3255 | 3255 | state_save_register_global( to8_kbd_data ); |
| 3256 | 3256 | state_save_register_global( to8_kbd_step ); |
| r1293 | r1294 | |
| 3543 | 3543 | |
| 3544 | 3544 | #if VERBOSE_VIDEO |
| 3545 | 3545 | logerror( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", |
| 3546 | activecpu_get_previouspc(), | |
| 3546 | activecpu_get_previouspc(), | |
| 3547 | 3547 | offset, 0xe7e4 + offset, res, to7_lightpen ); |
| 3548 | 3548 | #endif |
| 3549 | 3549 | |
| r1293 | r1294 | |
| 3556 | 3556 | { |
| 3557 | 3557 | #if VERBOSE_VIDEO |
| 3558 | 3558 | logerror( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n", |
| 3559 | activecpu_get_previouspc(), | |
| 3559 | activecpu_get_previouspc(), | |
| 3560 | 3560 | offset, 0xe7e4 + offset, data ); |
| 3561 | 3561 | #endif |
| 3562 | 3562 | |
| r1293 | r1294 | |
| 3639 | 3639 | { |
| 3640 | 3640 | #if VERBOSE_VIDEO |
| 3641 | 3641 | logerror( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n", |
| 3642 | activecpu_get_previouspc(), | |
| 3642 | activecpu_get_previouspc(), | |
| 3643 | 3643 | offset, 0xe7da + offset, data ); |
| 3644 | 3644 | #endif |
| 3645 | 3645 | |
| r1293 | r1294 | |
| 3697 | 3697 | int ktest = to8_kbd_ktest (); |
| 3698 | 3698 | |
| 3699 | 3699 | #if VERBOSE_KBD |
| 3700 | logerror( "$%04x %f: to8_sys_porta_in ktest=%i\n", activecpu_get_previouspc(), | |
| 3700 | logerror( "$%04x %f: to8_sys_porta_in ktest=%i\n", activecpu_get_previouspc(), | |
| 3701 | 3701 | #endif |
| 3702 | 3702 | |
| 3703 | 3703 | return ktest; |
| r1293 | r1294 | |
| 4218 | 4218 | static WRITE8_HANDLER ( mo6_game_porta_out ) |
| 4219 | 4219 | { |
| 4220 | 4220 | /* centronics data */ |
| 4221 | LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", activecpu_get_previouspc(), | |
| 4221 | LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", activecpu_get_previouspc(), | |
| 4222 | 4222 | centronics_write_data( 0, data ); |
| 4223 | 4223 | } |
| 4224 | 4224 | |
| r1293 | r1294 | |
| 4228 | 4228 | { |
| 4229 | 4229 | int dtr = ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) ? 0 : 1; |
| 4230 | 4230 | /* note: printer busy signal replaces button */ |
| 4231 | LOG (( "$%04x %f mo6_game_cb1_in: CENTRONICS get dtr=%i\n", activecpu_get_previouspc(), | |
| 4231 | LOG (( "$%04x %f mo6_game_cb1_in: CENTRONICS get dtr=%i\n", activecpu_get_previouspc(), | |
| 4232 | 4232 | return dtr; |
| 4233 | 4233 | } |
| 4234 | 4234 | |
| r1293 | r1294 | |
| 4237 | 4237 | static WRITE8_HANDLER ( mo6_game_cb2_out ) |
| 4238 | 4238 | { |
| 4239 | 4239 | /* centronics strobe */ |
| 4240 | LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", activecpu_get_previouspc(), | |
| 4240 | LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", activecpu_get_previouspc(), | |
| 4241 | 4241 | centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0, |
| 4242 | 4242 | CENTRONICS_STROBE ); |
| 4243 | 4243 | } |
| r1293 | r1294 | |
| 4278 | 4278 | { |
| 4279 | 4279 | LOG (( "mo6_game_init called\n" )); |
| 4280 | 4280 | pia_config( THOM_PIA_GAME, &mo6_game ); |
| 4281 | to7_game_timer = mame_timer_alloc( mo6_game_update_cb ); | |
| 4282 | mame_timer_adjust( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD ); | |
| 4281 | to7_game_timer = timer_alloc( mo6_game_update_cb ); | |
| 4282 | timer_adjust( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD ); | |
| 4283 | 4283 | state_save_register_global( to7_game_sound ); |
| 4284 | 4284 | state_save_register_global( to7_game_mute ); |
| 4285 | 4285 | } |
| r1293 | r1294 | |
| 4423 | 4423 | |
| 4424 | 4424 | #if VERBOSE_VIDEO |
| 4425 | 4425 | logerror( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", |
| 4426 | activecpu_get_previouspc(), | |
| 4426 | activecpu_get_previouspc(), | |
| 4427 | 4427 | offset, 0xa7e4 + offset, res, to7_lightpen ); |
| 4428 | 4428 | #endif |
| 4429 | 4429 | |
| r1293 | r1294 | |
| 4436 | 4436 | { |
| 4437 | 4437 | #if VERBOSE_VIDEO |
| 4438 | 4438 | logerror( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n", |
| 4439 | activecpu_get_previouspc(), | |
| 4439 | activecpu_get_previouspc(), | |
| 4440 | 4440 | offset, 0xa7e4 + offset, data ); |
| 4441 | 4441 | #endif |
| 4442 | 4442 | |
| r1293 | r1294 | |
| 4505 | 4505 | { |
| 4506 | 4506 | #if VERBOSE_VIDEO |
| 4507 | 4507 | logerror( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n", |
| 4508 | activecpu_get_previouspc(), | |
| 4508 | activecpu_get_previouspc(), | |
| 4509 | 4509 | offset, 0xa7da + offset, data ); |
| 4510 | 4510 | #endif |
| 4511 | 4511 | |
| r1293 | r1294 | |
| 4607 | 4607 | to7_modem_init(); |
| 4608 | 4608 | to7_midi_init(); |
| 4609 | 4609 | to7_rf57932_init(); |
| 4610 | mo5_periodic_timer = | |
| 4610 | mo5_periodic_timer = | |
| 4611 | 4611 | mea8000_config( THOM_SOUND_SPEECH, NULL ); |
| 4612 | 4612 | |
| 4613 | 4613 | /* memory */ |
| r1293 | r1294 | |
| 4660 | 4660 | if ( to7_controller_type ) |
| 4661 | 4661 | return to7_floppy_r ( offset ); |
| 4662 | 4662 | |
| 4663 | logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", activecpu_get_previouspc(), | |
| 4663 | logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", activecpu_get_previouspc(), | |
| 4664 | 4664 | |
| 4665 | 4665 | if ( to7_controller_type ) |
| 4666 | 4666 | return to7_floppy_r ( offset ); |
| r1293 | r1294 | |
| 4676 | 4676 | to7_floppy_w ( offset, data ); |
| 4677 | 4677 | else |
| 4678 | 4678 | logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n", |
| 4679 | activecpu_get_previouspc(), | |
| 4679 | activecpu_get_previouspc(), | |
| 4680 | 4680 | } |
| 4681 | 4681 | |
| 4682 | 4682 | |
| r1293 | r1294 | |
| 4704 | 4704 | return 0x80; |
| 4705 | 4705 | |
| 4706 | 4706 | default: |
| 4707 | logerror( "$%04x %f mo5nr_prn_r: unhandled read from reg %i\n", activecpu_get_previouspc(), | |
| 4707 | logerror( "$%04x %f mo5nr_prn_r: unhandled read from reg %i\n", activecpu_get_previouspc(), | |
| 4708 | 4708 | return 0; |
| 4709 | 4709 | } |
| 4710 | 4710 | } |
| r1293 | r1294 | |
| 4726 | 4726 | break; |
| 4727 | 4727 | |
| 4728 | 4728 | default: |
| 4729 | logerror( "$%04x %f mo5nr_prn_w: unhandled to reg %i (data=$%02X)\n", activecpu_get_previouspc(), | |
| 4729 | logerror( "$%04x %f mo5nr_prn_w: unhandled to reg %i (data=$%02X)\n", activecpu_get_previouspc(), | |
| 4730 | 4730 | } |
| 4731 | 4731 | } |
| 4732 | 4732 | |
| r1293 | r1294 | |
| 4792 | 4792 | { |
| 4793 | 4793 | LOG (( "mo5nr_game_init called\n" )); |
| 4794 | 4794 | pia_config( THOM_PIA_GAME, &mo5nr_game ); |
| 4795 | to7_game_timer = mame_timer_alloc( mo6_game_update_cb ); | |
| 4796 | mame_timer_adjust( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD ); | |
| 4795 | to7_game_timer = timer_alloc( mo6_game_update_cb ); | |
| 4796 | timer_adjust( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD ); | |
| 4797 | 4797 | state_save_register_global( to7_game_sound ); |
| 4798 | 4798 | state_save_register_global( to7_game_mute ); |
| 4799 | 4799 | } |
| r1293 | r1294 | |
| 4874 | 4874 | to7_modem_init(); |
| 4875 | 4875 | to7_midi_init(); |
| 4876 | 4876 | to7_rf57932_init(); |
| 4877 | mo5_periodic_timer = | |
| 4877 | mo5_periodic_timer = | |
| 4878 | 4878 | mea8000_config( THOM_SOUND_SPEECH, NULL ); |
| 4879 | 4879 | |
| 4880 | 4880 | /* memory */ |
| r1293 | r1294 | |
|---|---|---|
| 644 | 644 | |
| 645 | 645 | case 0x7: /* send mouse command */ |
| 646 | 646 | if (immediate & 0x8) |
| 647 | | |
| 647 | | |
| 648 | 648 | else |
| 649 | | |
| 649 | | |
| 650 | 650 | break; |
| 651 | 651 | } |
| 652 | 652 | } |
| r1293 | r1294 | |
| 689 | 689 | COPS_Ready = TRUE; |
| 690 | 690 | |
| 691 | 691 | /* impulsion width : +/- 20us */ |
| 692 | | |
| 692 | | |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | static void reset_COPS(void) |
| r1293 | r1294 | |
| 704 | 704 | for (i=0; i<8; i++) |
| 705 | 705 | key_matrix[i] = 0; |
| 706 | 706 | |
| 707 | | |
| 707 | | |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | static void unplug_keyboard(void) |
| r1293 | r1294 | |
| 753 | 753 | COPS_Ready = FALSE; |
| 754 | 754 | |
| 755 | 755 | /* read command every ms (don't know the real value) */ |
| 756 | | |
| 756 | | |
| 757 | 757 | |
| 758 | 758 | reset_COPS(); |
| 759 | 759 | } |
| r1293 | r1294 | |
| 1122 | 1122 | |
| 1123 | 1123 | MACHINE_RESET( lisa ) |
| 1124 | 1124 | { |
| 1125 | mouse_timer = | |
| 1125 | mouse_timer = | |
| 1126 | 1126 | |
| 1127 | 1127 | lisa_ram_ptr = memory_region(REGION_CPU1) + RAM_OFFSET; |
| 1128 | 1128 | lisa_rom_ptr = memory_region(REGION_CPU1) + ROM_OFFSET; |
| r1293 | r1294 | |
|---|---|---|
| 72 | 72 | |
| 73 | 73 | int everon; |
| 74 | 74 | int memory_accesses; |
| 75 | | |
| 75 | | |
| 76 | 76 | } blitter; |
| 77 | 77 | |
| 78 | 78 | UINT8 *lynx_mem_0000; |
| r1293 | r1294 | |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | if (0) |
| 613 | | |
| 613 | | |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | static void lynx_divide(void) |
| r1293 | r1294 | |
| 672 | 672 | data=1; // must not be 0 for correct power up |
| 673 | 673 | break; |
| 674 | 674 | case 0x92: |
| 675 | if (!compare | |
| 675 | if (!attotime_compare | |
| 676 | 676 | { |
| 677 | if ( | |
| 677 | if ( | |
| 678 | 678 | { |
| 679 | 679 | suzy.u.data[offset]&=~1; //blitter finished |
| 680 | blitter.time = time_zero; | |
| 680 | blitter.time = attotime_zero; | |
| 681 | 681 | } |
| 682 | 682 | } |
| 683 | 683 | data=suzy.u.data[offset]; |
| r1293 | r1294 | |
| 744 | 744 | case 0x63: lynx_divide();break; |
| 745 | 745 | case 0x91: |
| 746 | 746 | if (data&1) { |
| 747 | blitter.time= | |
| 747 | blitter.time= | |
| 748 | 748 | lynx_blitter(); |
| 749 | 749 | } |
| 750 | 750 | // logerror("suzy write %.2x %.2x\n",offset,data); |
| r1293 | r1294 | |
| 820 | 820 | static void lynx_timer_init(int which) |
| 821 | 821 | { |
| 822 | 822 | memset( &lynx_timer[which], 0, sizeof(LYNX_TIMER) ); |
| 823 | lynx_timer[which].timer = | |
| 823 | lynx_timer[which].timer = | |
| 824 | 824 | lynx_timer[which].settime = 0.0; |
| 825 | 825 | } |
| 826 | 826 | |
| r1293 | r1294 | |
| 916 | 916 | else |
| 917 | 917 | { |
| 918 | 918 | if ( lynx_timer[which].timer_active ) |
| 919 | data = (UINT8) ( lynx_timer[which].bakup - | |
| 919 | data = (UINT8) ( lynx_timer[which].bakup - | |
| 920 | 920 | } |
| 921 | 921 | break; |
| 922 | 922 | |
| r1293 | r1294 | |
| 938 | 938 | break; |
| 939 | 939 | case 1: |
| 940 | 940 | lynx_timer[which].cntrl1 = data; |
| 941 | | |
| 941 | | |
| 942 | 942 | lynx_timer[which].timer_active = 0; |
| 943 | 943 | if ( ( lynx_timer[which].cntrl1 & 0x08 ) ) |
| 944 | 944 | { |
| 945 | 945 | if ( ( lynx_timer[which].cntrl1 & 7 ) != 7 ) |
| 946 | 946 | { |
| 947 | | |
| 947 | | |
| 948 | 948 | if ( lynx_timer[which].cntrl1 & 0x10 ) |
| 949 | | |
| 949 | | |
| 950 | 950 | else |
| 951 | | |
| 951 | | |
| 952 | 952 | lynx_timer[which].timer_active = 1; |
| 953 | 953 | } |
| 954 | 954 | } |
| r1293 | r1294 | |
| 983 | 983 | if (uart.buffer_loaded) { |
| 984 | 984 | uart.data_to_send=uart.buffer; |
| 985 | 985 | uart.buffer_loaded=FALSE; |
| 986 | | |
| 986 | | |
| 987 | 987 | } else { |
| 988 | 988 | uart.sending=FALSE; |
| 989 | 989 | } |
| r1293 | r1294 | |
| 1025 | 1025 | } else { |
| 1026 | 1026 | uart.sending=TRUE; |
| 1027 | 1027 | uart.data_to_send=data; |
| 1028 | | |
| 1028 | | |
| 1029 | 1029 | } |
| 1030 | 1030 | break; |
| 1031 | 1031 | } |
| r1293 | r1294 | |
|---|---|---|
| 32 | 32 | |
| 33 | 33 | static UINT8 pmd85_model; |
| 34 | 34 | |
| 35 | static | |
| 35 | static | |
| 36 | 36 | |
| 37 | 37 | static void pmd851_update_memory (void) |
| 38 | 38 | { |
| r1293 | r1294 | |
| 784 | 784 | |
| 785 | 785 | msm8251_init(&pmd85_msm8251_interface); |
| 786 | 786 | |
| 787 | pmd85_cassette_timer = mame_timer_alloc(pmd85_cassette_timer_callback); | |
| 788 | mame_timer_adjust(pmd85_cassette_timer, time_zero, 0, MAME_TIME_IN_HZ(2400)); | |
| 787 | pmd85_cassette_timer = timer_alloc(pmd85_cassette_timer_callback); | |
| 788 | timer_adjust(pmd85_cassette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(2400)); | |
| 789 | 789 | |
| 790 | 790 | serial_connection_init(&pmd85_cassette_serial_connection); |
| 791 | 791 | serial_connection_set_in_callback(&pmd85_cassette_serial_connection, pmd85_cassette_write); |
| r1293 | r1294 | |
|---|---|---|
| 66 | 66 | |
| 67 | 67 | UINT8 irqen; /* IRQ enabled ? */ |
| 68 | 68 | enum { Delay1, Delay8, Delay64, Delay1024, TimerShot } state; |
| 69 | | |
| 69 | | |
| 70 | 70 | int irq; |
| 71 | | |
| 71 | | |
| 72 | 72 | } RRIOT; |
| 73 | 73 | |
| 74 | 74 | static RRIOT rriot[MAX_RRIOTS]= { {0} }; |
| r1293 | r1294 | |
| 79 | 79 | { |
| 80 | 80 | memset(&rriot[nr], 0, sizeof(rriot[nr])); |
| 81 | 81 | rriot[nr].config = config; |
| 82 | rriot[nr].timer = | |
| 82 | rriot[nr].timer = | |
| 83 | 83 | |
| 84 | 84 | LOG("RRIOT - successfully initialised\n"); |
| 85 | 85 | } |
| r1293 | r1294 | |
| 134 | 134 | case 0: /* Timer count read */ |
| 135 | 135 | switch (rriot[chip].state) { |
| 136 | 136 | case Delay1: |
| 137 | data = | |
| 137 | data = | |
| 138 | 138 | break; |
| 139 | 139 | case Delay8: |
| 140 | data = | |
| 140 | data = | |
| 141 | 141 | break; |
| 142 | 142 | case Delay64: |
| 143 | data = | |
| 143 | data = | |
| 144 | 144 | break; |
| 145 | 145 | case Delay1024: |
| 146 | data = | |
| 146 | data = | |
| 147 | 147 | break; |
| 148 | 148 | case TimerShot: |
| 149 | data=255- | |
| 149 | data=255- | |
| 150 | 150 | if (data <0 ) data=0; |
| 151 | 151 | break; |
| 152 | 152 | } |
| r1293 | r1294 | |
| 174 | 174 | LOG(("rriot(%d) timer expired\n", chip)); |
| 175 | 175 | rriot[chip].irq=1; |
| 176 | 176 | rriot[chip].state=TimerShot; |
| 177 | rriot[chip].shottime= | |
| 177 | rriot[chip].shottime= | |
| 178 | 178 | if( rriot[chip].irqen ) /* with IRQ? */ |
| 179 | 179 | { |
| 180 | 180 | if( rriot[chip].config->irq_callback ) |
| r1293 | r1294 | |
| 221 | 221 | switch (offset&3) { |
| 222 | 222 | case 0: /* Timer 1 start */ |
| 223 | 223 | LOG(("rriot(%d) TMR1 write: $%02x%s\n", chip, data, (char*)((offset & 8) ? " (IRQ)":" "))); |
| 224 | | |
| 224 | | |
| 225 | 225 | rriot[chip].state=Delay1; |
| 226 | 226 | break; |
| 227 | 227 | case 1: /* Timer 8 start */ |
| 228 | 228 | LOG(("rriot(%d) TMR8 write: $%02x%s\n", chip, data, (char*)((offset & 8) ? " (IRQ)":" "))); |
| 229 | | |
| 229 | | |
| 230 | 230 | rriot[chip].state=Delay8; |
| 231 | 231 | break; |
| 232 | 232 | case 2: /* Timer 64 start */ |
| 233 | 233 | LOG(("rriot(%d) TMR64 write: $%02x%s\n", chip, data, (char*)((offset & 8) ? " (IRQ)":" "))); |
| 234 | 234 | // LOG(("rriot(%d) TMR64 write: time is $%f\n", chip, (double)(64.0 * (data + 1) / rriot[chip].clock))); |
| 235 | | |
| 235 | | |
| 236 | 236 | rriot[chip].state=Delay64; |
| 237 | 237 | break; |
| 238 | 238 | case 3: /* Timer 1024 start */ |
| 239 | 239 | LOG(("rriot(%d) TMR1K write: $%02x%s\n", chip, data, (char*)((offset & 8) ? " (IRQ)":" "))); |
| 240 | | |
| 240 | | |
| 241 | 241 | rriot[chip].state=Delay1024; |
| 242 | 242 | break; |
| 243 | 243 | } |
| r1293 | r1294 | |
|---|---|---|
| 371 | 371 | { |
| 372 | 372 | /* Weirdly enough, we are always seeing some problems even though |
| 373 | 373 | everything is working fine. */ |
| 374 | /* | |
| 374 | /* | |
| 375 | 375 | logerror("ti99/4a speech says aaargh!\n"); |
| 376 | 376 | logerror("(time to ready: %f -> %d)\n", time_to_ready, (int) ceil(3000000*time_to_ready));*/ |
| 377 | 377 | } |
| r1293 | r1294 | |
| 393 | 393 | complex. */ |
| 394 | 394 | if (! tms5220_ready_r()) |
| 395 | 395 | { |
| 396 | mame_time time_to_ready = double_to_mame_time(tms5220_time_to_ready()); | |
| 397 | int cycles_to_ready = ceil(MAME_TIME_TO_CYCLES(0, time_to_ready)); | |
| 396 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready()); | |
| 397 | int cycles_to_ready = ceil(ATTOTIME_TO_CYCLES(0, time_to_ready)); | |
| 398 | 398 | |
| 399 | logerror("time to ready: %f -> %d\n", | |
| 399 | logerror("time to ready: %f -> %d\n", | |
| 400 | 400 | |
| 401 | 401 | activecpu_adjust_icount(-cycles_to_ready); |
| 402 | | |
| 402 | | |
| 403 | 403 | } |
| 404 | 404 | #endif |
| 405 | 405 |
| r1293 | r1294 | |
|---|---|---|
| 27 | 27 | int rcl; /* 1-bit reader clutch */ |
| 28 | 28 | int rc; /* 2-bit reader counter */ |
| 29 | 29 | |
| 30 | | |
| 30 | | |
| 31 | 31 | } tape_reader_t; |
| 32 | 32 | |
| 33 | 33 | static tape_reader_t tape_reader; |
| r1293 | r1294 | |
| 38 | 38 | { |
| 39 | 39 | mess_image *fd; /* file descriptor of tape image */ |
| 40 | 40 | |
| 41 | | |
| 41 | | |
| 42 | 42 | } tape_puncher_t; |
| 43 | 43 | |
| 44 | 44 | static tape_puncher_t tape_puncher; |
| r1293 | r1294 | |
| 49 | 49 | { |
| 50 | 50 | mess_image *fd; /* file descriptor of output image */ |
| 51 | 51 | |
| 52 | | |
| 52 | | |
| 53 | 53 | } typewriter_t; |
| 54 | 54 | |
| 55 | 55 | static typewriter_t typewriter; |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | /* crt display timer */ |
| 59 | static | |
| 59 | static | |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | /* magnetic tape unit registers */ |
| r1293 | r1294 | |
| 126 | 126 | |
| 127 | 127 | int long_parity; |
| 128 | 128 | |
| 129 | | |
| 129 | | |
| 130 | 130 | } magtape_t; |
| 131 | 131 | |
| 132 | 132 | static magtape_t magtape; |
| r1293 | r1294 | |
| 166 | 166 | { |
| 167 | 167 | memory_set_opbase_handler(0, setOPbasefunc);; |
| 168 | 168 | |
| 169 | tape_reader.timer = mame_timer_alloc(reader_callback); | |
| 170 | tape_puncher.timer = mame_timer_alloc(puncher_callback); | |
| 171 | typewriter.prt_timer = mame_timer_alloc(prt_callback); | |
| 172 | dis_timer = mame_timer_alloc(dis_callback); | |
| 169 | tape_reader.timer = timer_alloc(reader_callback); | |
| 170 | tape_puncher.timer = timer_alloc(puncher_callback); | |
| 171 | typewriter.prt_timer = timer_alloc(prt_callback); | |
| 172 | dis_timer = timer_alloc(dis_callback); | |
| 173 | 173 | |
| 174 | 174 | add_reset_callback(machine, tx0_machine_reset); |
| 175 | 175 | add_exit_callback(machine, tx0_machine_stop); |
| r1293 | r1294 | |
| 226 | 226 | /* restart reader IO when necessary */ |
| 227 | 227 | /* note that this function may be called before tx0_init_machine, therefore |
| 228 | 228 | before tape_reader.timer is allocated. It does not matter, as the clutch is never |
| 229 | down at power-up, but we must not call | |
| 229 | down at power-up, but we must not call | |
| 230 | 230 | if (tape_reader.timer) |
| 231 | 231 | { |
| 232 | 232 | if (tape_reader.motor_on && tape_reader.rcl) |
| 233 | 233 | { |
| 234 | 234 | /* delay is approximately 1/400s */ |
| 235 | | |
| 235 | | |
| 236 | 236 | } |
| 237 | 237 | else |
| 238 | 238 | { |
| 239 | | |
| 239 | | |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | break; |
| r1293 | r1294 | |
| 264 | 264 | tape_reader.motor_on = 0; |
| 265 | 265 | |
| 266 | 266 | if (tape_reader.timer) |
| 267 | | |
| 267 | | |
| 268 | 268 | break; |
| 269 | 269 | |
| 270 | 270 | case 1: |
| r1293 | r1294 | |
| 306 | 306 | if (tape_reader.motor_on && tape_reader.rcl) |
| 307 | 307 | { |
| 308 | 308 | /* delay is approximately 1/400s */ |
| 309 | | |
| 309 | | |
| 310 | 310 | } |
| 311 | 311 | else |
| 312 | 312 | { |
| 313 | | |
| 313 | | |
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | |
| r1293 | r1294 | |
| 357 | 357 | |
| 358 | 358 | if (tape_reader.motor_on && tape_reader.rcl) |
| 359 | 359 | /* delay is approximately 1/400s */ |
| 360 | | |
| 360 | | |
| 361 | 361 | else |
| 362 | | |
| 362 | | |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /* |
| r1293 | r1294 | |
| 398 | 398 | /* shuffle and punch 6-bit word */ |
| 399 | 399 | tape_write(((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5)); |
| 400 | 400 | |
| 401 | | |
| 401 | | |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | /* |
| r1293 | r1294 | |
| 413 | 413 | /* shuffle and punch 6-bit word */ |
| 414 | 414 | tape_write(((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5) | 0100); |
| 415 | 415 | |
| 416 | | |
| 416 | | |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | |
| r1293 | r1294 | |
| 472 | 472 | ch = ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5); |
| 473 | 473 | typewriter_out(ch); |
| 474 | 474 | |
| 475 | | |
| 475 | | |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | |
| r1293 | r1294 | |
| 498 | 498 | y = ac & 0777; |
| 499 | 499 | tx0_plot(x, y); |
| 500 | 500 | |
| 501 | | |
| 501 | | |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | |
| r1293 | r1294 | |
| 514 | 514 | |
| 515 | 515 | static void schedule_select(void) |
| 516 | 516 | { |
| 517 | | |
| 517 | | |
| 518 | 518 | |
| 519 | 519 | switch (magtape.command) |
| 520 | 520 | { |
| 521 | 521 | case 0: /* backspace */ |
| 522 | delay = | |
| 522 | delay = | |
| 523 | 523 | break; |
| 524 | 524 | case 1: /* read */ |
| 525 | delay = | |
| 525 | delay = | |
| 526 | 526 | break; |
| 527 | 527 | case 2: /* rewind */ |
| 528 | delay = | |
| 528 | delay = | |
| 529 | 529 | break; |
| 530 | 530 | case 3: /* write */ |
| 531 | delay = | |
| 531 | delay = | |
| 532 | 532 | break; |
| 533 | 533 | } |
| 534 | | |
| 534 | | |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | static void schedule_unselect(void) |
| 538 | 538 | { |
| 539 | | |
| 539 | | |
| 540 | 540 | |
| 541 | 541 | switch (magtape.command) |
| 542 | 542 | { |
| 543 | 543 | case 0: /* backspace */ |
| 544 | delay = | |
| 544 | delay = | |
| 545 | 545 | break; |
| 546 | 546 | case 1: /* read */ |
| 547 | delay = | |
| 547 | delay = | |
| 548 | 548 | break; |
| 549 | 549 | case 2: /* rewind */ |
| 550 | delay = | |
| 550 | delay = | |
| 551 | 551 | break; |
| 552 | 552 | case 3: /* write */ |
| 553 | delay = | |
| 553 | delay = | |
| 554 | 554 | break; |
| 555 | 555 | } |
| 556 | | |
| 556 | | |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | DEVICE_INIT( tx0_magtape ) |
| r1293 | r1294 | |
| 574 | 574 | |
| 575 | 575 | /* restart IO when necessary */ |
| 576 | 576 | /* note that this function may be called before tx0_init_machine, therefore |
| 577 | before magtape.timer is allocated. We must not call | |
| 577 | before magtape.timer is allocated. We must not call | |
| 578 | 578 | NULL parameter! */ |
| 579 | 579 | if (magtape.timer) |
| 580 | 580 | { |
| r1293 | r1294 | |
| 593 | 593 | { |
| 594 | 594 | if (magtape.state == MTS_SELECTING) |
| 595 | 595 | /* I/O has not actually started, we can cancel the selection */ |
| 596 | | |
| 596 | | |
| 597 | 597 | if ((magtape.state == MTS_SELECTED) || ((magtape.state == MTS_SELECTING) && (magtape.command == 2))) |
| 598 | 598 | { /* unit has become unavailable */ |
| 599 | 599 | magtape.state = MTS_UNSELECTING; |
| r1293 | r1294 | |
| 783 | 783 | break; |
| 784 | 784 | } |
| 785 | 785 | if (magtape.state != MTS_UNSELECTING) |
| 786 | | |
| 786 | | |
| 787 | 787 | } |
| 788 | 788 | break; |
| 789 | 789 | |
| r1293 | r1294 | |
| 942 | 942 | break; |
| 943 | 943 | } |
| 944 | 944 | if (magtape.state != MTS_UNSELECTING) |
| 945 | | |
| 945 | | |
| 946 | 946 | } |
| 947 | 947 | break; |
| 948 | 948 | |
| 949 | 949 | case 2: /* rewind */ |
| 950 | 950 | magtape.state = MTS_UNSELECTING; |
| 951 | 951 | /* we rewind at 10*read speed (I don't know the real value) */ |
| 952 | | |
| 952 | | |
| 953 | 953 | //schedule_unselect(); |
| 954 | 954 | image_fseek(magtape.img, 0, SEEK_END); |
| 955 | 955 | magtape.irg_pos = MTIRGP_END; |
| r1293 | r1294 | |
| 1037 | 1037 | image_unload(magtape.img); |
| 1038 | 1038 | } |
| 1039 | 1039 | else |
| 1040 | | |
| 1040 | | |
| 1041 | 1041 | } |
| 1042 | 1042 | break; |
| 1043 | 1043 | } |
| r1293 | r1294 | |
| 1053 | 1053 | { |
| 1054 | 1054 | if (0) |
| 1055 | 1055 | magtape_callback(0); |
| 1056 | | |
| 1056 | | |
| 1057 | 1057 | } |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| r1293 | r1294 | |
| 1095 | 1095 | { |
| 1096 | 1096 | tape_reader.rcl = tape_reader.rc = 0; |
| 1097 | 1097 | if (tape_reader.timer) |
| 1098 | | |
| 1098 | | |
| 1099 | 1099 | |
| 1100 | 1100 | if (tape_puncher.timer) |
| 1101 | | |
| 1101 | | |
| 1102 | 1102 | |
| 1103 | 1103 | if (typewriter.prt_timer) |
| 1104 | | |
| 1104 | | |
| 1105 | 1105 | |
| 1106 | 1106 | if (dis_timer) |
| 1107 | | |
| 1107 | | |
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | 1110 |
| r1293 | r1294 | |
|---|---|---|
| 49 | 49 | ti->cur_val = -1; |
| 50 | 50 | ti->off_speed = off_speed; |
| 51 | 51 | ti->on_speed = on_speed; |
| 52 | | |
| 52 | | |
| 53 | 53 | return 0; |
| 54 | 54 | } |
| r1293 | r1294 | |
|---|---|---|
| 226 | 226 | memory_set_bankptr(3, memory_region(REGION_CPU1) + 0x010000); |
| 227 | 227 | memory_set_bankptr(4, memory_region(REGION_CPU1) + 0x010000); |
| 228 | 228 | |
| 229 | /* | |
| 229 | /* | |
| 230 | 230 | |
| 231 | 231 | /*memset(mess_ram, 0, sizeof(unsigned char)*0xffff);*/ |
| 232 | 232 | } |
| r1293 | r1294 | |
|---|---|---|
| 316 | 316 | |
| 317 | 317 | /* We poll the keyboard periodically to scan the keys. This is |
| 318 | 318 | actually consistent with how the AY-3600 keyboard controller works. */ |
| 319 | | |
| 319 | | |
| 320 | 320 | |
| 321 | 321 | /* Set Caps Lock light to ON, since that's how we default it. */ |
| 322 | 322 | set_led_status(1,1); |
| r1293 | r1294 | |
|---|---|---|
| 175 | 175 | interrupt_mask_reg=0xf8; |
| 176 | 176 | interrupt_trig_reg=0x0; |
| 177 | 177 | cpunum_set_irq_callback(0,pc8801_interupt_callback); |
| 178 | | |
| 178 | | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | WRITE8_HANDLER(pc88sr_outport_30) |
| r1293 | r1294 | |
|---|---|---|
| 197 | 197 | { |
| 198 | 198 | int i; |
| 199 | 199 | |
| 200 | tms9901[which].timer = | |
| 200 | tms9901[which].timer = | |
| 201 | 201 | |
| 202 | 202 | tms9901[which].supported_int_mask = param->supported_int_mask; |
| 203 | 203 | |
| r1293 | r1294 | |
| 223 | 223 | { |
| 224 | 224 | if (tms9901[which].timer) |
| 225 | 225 | { |
| 226 | | |
| 226 | | |
| 227 | 227 | tms9901[which].timer = NULL; |
| 228 | 228 | } |
| 229 | 229 | } |
| r1293 | r1294 | |
| 328 | 328 | { |
| 329 | 329 | if (tms9901[which].clockinvl) |
| 330 | 330 | { /* reset clock interval */ |
| 331 | | |
| 331 | | |
| 332 | 332 | } |
| 333 | 333 | else |
| 334 | 334 | { /* clock interval == 0 -> no timer */ |
| 335 | | |
| 335 | | |
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
| r1293 | r1294 | |
| 452 | 452 | /* we are switching to clock mode: latch the current value of |
| 453 | 453 | the decrementer register */ |
| 454 | 454 | if (tms9901[which].clockinvl) |
| 455 | tms9901[which].latchedtimer = ceil( | |
| 455 | tms9901[which].latchedtimer = ceil( | |
| 456 | 456 | else |
| 457 | 457 | tms9901[which].latchedtimer = 0; /* timer inactive... */ |
| 458 | 458 | } |
| r1293 | r1294 | |
|---|---|---|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | /* pet clock */ |
| 455 | | |
| 455 | | |
| 456 | 456 | |
| 457 | 457 | via_config(0, &pet_via); |
| 458 | 458 | pia_config(1, &pet_pia1); |
| r1293 | r1294 | |
|---|---|---|
| 1101 | 1101 | oric_irqs = 0; |
| 1102 | 1102 | oric_ram_0x0c000 = NULL; |
| 1103 | 1103 | |
| 1104 | | |
| 1104 | | |
| 1105 | 1105 | |
| 1106 | 1106 | via_reset(); |
| 1107 | 1107 | via_config(0, &oric_6522_interface); |
| r1293 | r1294 | |
|---|---|---|
| 225 | 225 | UINT8 data[0x10]; |
| 226 | 226 | int reg; |
| 227 | 227 | int state; |
| 228 | | |
| 228 | | |
| 229 | 229 | } europc_rtc; |
| 230 | 230 | |
| 231 | 231 | void europc_rtc_set_time(void) |
| r1293 | r1294 | |
| 277 | 277 | memset(&europc_rtc,0,sizeof(europc_rtc)); |
| 278 | 278 | europc_rtc.data[0xf]=1; |
| 279 | 279 | |
| 280 | europc_rtc.timer = mame_timer_alloc(europc_rtc_timer); | |
| 281 | mame_timer_adjust(europc_rtc.timer, time_zero, 0, make_mame_time(1, 0)); | |
| 280 | europc_rtc.timer = timer_alloc(europc_rtc_timer); | |
| 281 | timer_adjust(europc_rtc.timer, attotime_zero, 0, attotime_make(1, 0)); | |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | READ8_HANDLER( europc_rtc_r ) |
| r1293 | r1294 | |
|---|---|---|
| 88 | 88 | memset(&acia, 0, sizeof(struct acia6551)); |
| 89 | 89 | /* transmit data reg is empty */ |
| 90 | 90 | acia.status_register |= (1<<4); |
| 91 | acia.timer = | |
| 91 | acia.timer = | |
| 92 | 92 | |
| 93 | 93 | serial_connection_init(&acia.connection); |
| 94 | 94 | serial_connection_set_in_callback(&acia.connection, acia_6551_in_callback); |
| r1293 | r1294 | |
| 359 | 359 | rate = data & 0x07; |
| 360 | 360 | |
| 361 | 361 | /* baud rate changed? */ |
| 362 | | |
| 362 | | |
| 363 | 363 | |
| 364 | 364 | if (rate==0) |
| 365 | 365 | { |
| r1293 | r1294 | |
| 465 | 465 | break; |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | | |
| 468 | | |
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 |
| r1293 | r1294 | |
|---|---|---|
| 251 | 251 | via_reset(); |
| 252 | 252 | |
| 253 | 253 | timer_state = 0; |
| 254 | | |
| 254 | | |
| 255 | 255 | |
| 256 | 256 | memory_set_opbase_handler(0,atom_opbase_handler); |
| 257 | 257 | } |
| r1293 | r1294 | |
|---|---|---|
| 187 | 187 | void pc1403_outc(int data) |
| 188 | 188 | { |
| 189 | 189 | pc1403_portc=data; |
| 190 | logerror("%g pc %.4x outc %.2x\n", | |
| 190 | logerror("%g pc %.4x outc %.2x\n", | |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
| r1293 | r1294 | |
| 236 | 236 | |
| 237 | 237 | for (i=0; i<128; i++) gfx[i]=i; |
| 238 | 238 | |
| 239 | | |
| 239 | | |
| 240 | 240 | |
| 241 | 241 | memory_set_bankptr(1, memory_region(REGION_USER1)); |
| 242 | 242 | if (RAM32K) |
| r1293 | r1294 | |
|---|---|---|
| 13 | 13 | #include "devices/cassette.h" |
| 14 | 14 | |
| 15 | 15 | ULA ula; |
| 16 | ||
| 16 | ||
| 17 | 17 | |
| 18 | 18 | static mess_image *cassette_device_image( void ) { |
| 19 | 19 | return image_from_devtype_and_index( IO_CASSETTE, 0 ); |
| r1293 | r1294 | |
| 28 | 28 | ula.high_tone_set = 0; |
| 29 | 29 | ula.bit_count = 0; |
| 30 | 30 | ula.tape_running = 1; |
| 31 | | |
| 31 | | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | static void electron_tape_stop( void ) { |
| 35 | 35 | ula.tape_running = 0; |
| 36 | | |
| 36 | | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | #define TAPE_LOW 0x00; |
| r1293 | r1294 | |
| 292 | 292 | |
| 293 | 293 | ula.interrupt_status = 0x82; |
| 294 | 294 | ula.interrupt_control = 0x00; |
| 295 | mame_timer_set( time_zero, 0, setup_beep ); | |
| 296 | electron_tape_timer = mame_timer_alloc( electron_tape_timer_handler ); | |
| 295 | timer_set( attotime_zero, 0, setup_beep ); | |
| 296 | electron_tape_timer = timer_alloc( electron_tape_timer_handler ); | |
| 297 | 297 | add_reset_callback(machine, electron_reset); |
| 298 | 298 | } |
| 299 | 299 |
| r1293 | r1294 | |
|---|---|---|
| 105 | 105 | { |
| 106 | 106 | if (drive->index_timer!=NULL) |
| 107 | 107 | { |
| 108 | | |
| 108 | | |
| 109 | 109 | drive->index_timer = NULL; |
| 110 | 110 | } |
| 111 | 111 | } |
| r1293 | r1294 | |
| 137 | 137 | /* shut off timer */ |
| 138 | 138 | if (drive->index_timer!=NULL) |
| 139 | 139 | { |
| 140 | | |
| 140 | | |
| 141 | 141 | drive->index_timer = NULL; |
| 142 | 142 | } |
| 143 | 143 | |
| r1293 | r1294 | |
| 147 | 147 | /* this is not quite correct. if the motor is stopped in the middle |
| 148 | 148 | of the track, the next index pulse will occur in half a track time, from |
| 149 | 149 | there after it will occur every 300hz */ |
| 150 | drive->index_timer = | |
| 150 | drive->index_timer = | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | drive->motor_state = motor; |
| r1293 | r1294 | |
|---|---|---|
| 92 | 92 | static int status[MAX_BOARD]; /* drive status */ |
| 93 | 93 | static int error[MAX_BOARD]; /* error code */ |
| 94 | 94 | static int dip[MAX_BOARD]; /* dip switches */ |
| 95 | static | |
| 95 | static | |
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | static int data_cnt = 0; /* data count */ |
| r1293 | r1294 | |
| 178 | 178 | status[i] = 0; |
| 179 | 179 | error[i] = 0; |
| 180 | 180 | dip[i] = 0xff; |
| 181 | timer[i] = | |
| 181 | timer[i] = | |
| 182 | 182 | if (!timer[i]) |
| 183 | 183 | return -1; |
| 184 | 184 | } |
| r1293 | r1294 | |
| 633 | 633 | status[n] |= STA_INPUT; |
| 634 | 634 | |
| 635 | 635 | assert(timer[n]); |
| 636 | | |
| 636 | | |
| 637 | 637 | } |
| 638 | 638 | } |
| 639 | 639 | } |
| r1293 | r1294 | |
|---|---|---|
| 11 | 11 | UINT8 data; |
| 12 | 12 | UINT8 control; |
| 13 | 13 | double time_; |
| 14 | | |
| 14 | | |
| 15 | 15 | |
| 16 | 16 | /* These bytes are used in the timer callback. When the timer callback |
| 17 | 17 | is executed, the control value is updated with the new data. The mask |
| r1293 | r1294 | |
| 37 | 37 | { |
| 38 | 38 | CENTRONICS *This=cent+nr; |
| 39 | 39 | This->config=config; |
| 40 | This->timer = | |
| 40 | This->timer = | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | void centronics_write_data(int nr, UINT8 data) |
| r1293 | r1294 | |
| 72 | 72 | { |
| 73 | 73 | This->new_control_mask = CENTRONICS_ACKNOWLEDGE; |
| 74 | 74 | This->new_control_data = 0; |
| 75 | | |
| 75 | | |
| 76 | 76 | } |
| 77 | 77 | /* phase 3: end */ |
| 78 | 78 | else if ( This->control & CENTRONICS_NOT_BUSY ) |
| 79 | 79 | { |
| 80 | | |
| 80 | | |
| 81 | 81 | } |
| 82 | 82 | /* phase 1: schedule not busy & ack */ |
| 83 | 83 | else |
| 84 | 84 | { |
| 85 | 85 | This->new_control_mask = CENTRONICS_NOT_BUSY | CENTRONICS_ACKNOWLEDGE; |
| 86 | 86 | This->new_control_data = CENTRONICS_NOT_BUSY | CENTRONICS_ACKNOWLEDGE; |
| 87 | | |
| 87 | | |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| r1293 | r1294 | |
| 102 | 102 | /* schedule busy */ |
| 103 | 103 | This->new_control_mask = CENTRONICS_NOT_BUSY; |
| 104 | 104 | This->new_control_data = 0; |
| 105 | | |
| 105 | | |
| 106 | 106 | |
| 107 | 107 | /* output */ |
| 108 | 108 | printer_output(image_from_devtype_and_index(IO_PRINTER, nr), This->data); |
| r1293 | r1294 | |
|---|---|---|
| 165 | 165 | |
| 166 | 166 | A 120-Hz poll rate seems to be fast enough to ensure no |
| 167 | 167 | keystrokes are missed. */ |
| 168 | | |
| 168 | | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | |
| r1293 | r1294 | |
| 371 | 371 | /* The keyboard will pulse its strobe line when a key is |
| 372 | 372 | pressed. A 10-usec pulse is typical. */ |
| 373 | 373 | pia_set_input_ca1(0, 1); |
| 374 | | |
| 374 | | |
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
| r1293 | r1294 | |
| 414 | 414 | write. Thus the write delay depends on the cursor position and |
| 415 | 415 | where the display is in the refresh cycle. */ |
| 416 | 416 | if (!data) |
| 417 | | |
| 417 | | |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | static TIMER_CALLBACK(apple1_dsp_ready_start) |
| r1293 | r1294 | |
| 424 | 424 | input CB1. The end of this pulse will tell the PIA that the |
| 425 | 425 | display is ready for another write. */ |
| 426 | 426 | pia_set_input_cb1(0, 0); |
| 427 | | |
| 427 | | |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | static TIMER_CALLBACK(apple1_dsp_ready_end) |
| r1293 | r1294 | |
|---|---|---|
| 72 | 72 | UINT8 index_pulse; |
| 73 | 73 | |
| 74 | 74 | /* trigger delayed actions (bottom halves) */ |
| 75 | | |
| 75 | | |
| 76 | 76 | |
| 77 | 77 | } * mc6843; |
| 78 | 78 | |
| r1293 | r1294 | |
| 90 | 90 | #define CMD_FFR 0xa /* free format read */ |
| 91 | 91 | |
| 92 | 92 | /* coarse delays */ |
| 93 | #define DELAY_SEEK MAME_TIME_IN_USEC( 100 ) /* track seek time */ | |
| 94 | #define DELAY_ADDR MAME_TIME_IN_USEC( 100 ) /* search-address time */ | |
| 93 | #define DELAY_SEEK ATTOTIME_IN_USEC( 100 ) /* track seek time */ | |
| 94 | #define DELAY_ADDR ATTOTIME_IN_USEC( 100 ) /* search-address time */ | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | |
| r1293 | r1294 | |
| 209 | 209 | floppy_drive_seek( img, -1 ); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | LOG(( "%f mc6843_finish_STZ: actual=%i\n", | |
| 212 | LOG(( "%f mc6843_finish_STZ: actual=%i\n", | |
| 213 | 213 | |
| 214 | 214 | /* update state */ |
| 215 | 215 | mc6843->CTAR = 0; |
| r1293 | r1294 | |
| 232 | 232 | /* seek to track */ |
| 233 | 233 | floppy_drive_seek( img, mc6843->GCR - mc6843->CTAR ); |
| 234 | 234 | |
| 235 | LOG(( "%f mc6843_finish_SEK: from %i to %i (actual=%i)\n", | |
| 235 | LOG(( "%f mc6843_finish_SEK: from %i to %i (actual=%i)\n", | |
| 236 | 236 | |
| 237 | 237 | /* update state */ |
| 238 | 238 | mc6843->CTAR = mc6843->GCR; |
| r1293 | r1294 | |
| 254 | 254 | if ( ( ! floppy_drive_get_next_id( img, mc6843->side, id ) ) || ( id->flags & ID_FLAG_CRC_ERROR_IN_ID_FIELD ) || ( id->N != 0 ) ) |
| 255 | 255 | { |
| 256 | 256 | /* read address error */ |
| 257 | LOG(( "%f mc6843_address_search: get_next_id failed\n", | |
| 257 | LOG(( "%f mc6843_address_search: get_next_id failed\n", | |
| 258 | 258 | mc6843->STRB |= 0x0a; /* set CRC error & Sector Address Undetected */ |
| 259 | 259 | mc6843_cmd_end(); |
| 260 | 260 | return 0; |
| r1293 | r1294 | |
| 263 | 263 | if ( id->C != mc6843->LTAR ) |
| 264 | 264 | { |
| 265 | 265 | /* track mismatch */ |
| 266 | LOG(( "%f mc6843_address_search: track mismatch: logical=%i real=%i\n", | |
| 266 | LOG(( "%f mc6843_address_search: track mismatch: logical=%i real=%i\n", | |
| 267 | 267 | mc6843->data[0] = id->C; /* make the track number available to the CPU */ |
| 268 | 268 | mc6843->STRA |= 0x20; /* set Track Not Equal */ |
| 269 | 269 | mc6843_cmd_end(); |
| r1293 | r1294 | |
| 273 | 273 | if ( id->R == mc6843->SAR ) |
| 274 | 274 | { |
| 275 | 275 | /* found! */ |
| 276 | LOG(( "%f mc6843_address_search: sector %i found on track %i\n", | |
| 276 | LOG(( "%f mc6843_address_search: sector %i found on track %i\n", | |
| 277 | 277 | if ( ! (mc6843->CMR & 0x20) ) |
| 278 | 278 | { |
| 279 | 279 | mc6843->ISR |= 0x04; /* if no DMA, set Status Sense */ |
| r1293 | r1294 | |
| 287 | 287 | if ( r >= 4 ) |
| 288 | 288 | { |
| 289 | 289 | /* time-out after 3 full revolutions */ |
| 290 | LOG(( "%f mc6843_address_search: no sector %i found after 3 revolutions\n", | |
| 290 | LOG(( "%f mc6843_address_search: no sector %i found after 3 revolutions\n", | |
| 291 | 291 | mc6843->STRB |= 0x08; /* set Sector Address Undetected */ |
| 292 | 292 | mc6843_cmd_end(); |
| 293 | 293 | return 0; |
| r1293 | r1294 | |
| 308 | 308 | |
| 309 | 309 | if ( id->flags & ID_FLAG_CRC_ERROR_IN_DATA_FIELD ) |
| 310 | 310 | { |
| 311 | LOG(( "%f mc6843_address_search_read: data CRC error\n", | |
| 311 | LOG(( "%f mc6843_address_search_read: data CRC error\n", | |
| 312 | 312 | mc6843->STRB |= 0x06; /* set CRC error & Data Mark Undetected */ |
| 313 | 313 | mc6843_cmd_end(); |
| 314 | 314 | return 0; |
| r1293 | r1294 | |
| 316 | 316 | |
| 317 | 317 | if ( id->flags & ID_FLAG_DELETED_DATA ) |
| 318 | 318 | { |
| 319 | LOG(( "%f mc6843_address_search_read: deleted data\n", | |
| 319 | LOG(( "%f mc6843_address_search_read: deleted data\n", | |
| 320 | 320 | mc6843->STRA |= 0x02; /* set Delete Data Mark Detected */ |
| 321 | 321 | } |
| 322 | 322 | |
| r1293 | r1294 | |
| 381 | 381 | { |
| 382 | 382 | int cmd = mc6843->CMR & 0x0f; |
| 383 | 383 | |
| 384 | LOG(( "%f mc6843_cont: timer called for cmd=%s(%i)\n", | |
| 384 | LOG(( "%f mc6843_cont: timer called for cmd=%s(%i)\n", | |
| 385 | 385 | |
| 386 | | |
| 386 | | |
| 387 | 387 | |
| 388 | 388 | switch ( cmd ) |
| 389 | 389 | { |
| r1293 | r1294 | |
| 415 | 415 | int cmd = mc6843->CMR & 0x0f; |
| 416 | 416 | |
| 417 | 417 | LOG(( "%f $%04x mc6843_r: data input cmd=%s(%i), pos=%i/%i, GCR=%i, ", |
| 418 | | |
| 418 | | |
| 419 | 419 | mc6843_cmd[cmd], cmd, mc6843->data_idx, |
| 420 | 420 | mc6843->data_size, mc6843->GCR )); |
| 421 | 421 | |
| r1293 | r1294 | |
| 451 | 451 | } |
| 452 | 452 | else |
| 453 | 453 | { |
| 454 | | |
| 454 | | |
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | else |
| r1293 | r1294 | |
| 479 | 479 | case 1: /* Current-Track Address Register (CTAR) */ |
| 480 | 480 | data = mc6843->CTAR; |
| 481 | 481 | LOG(( "%f $%04x mc6843_r: read CTAR %i (actual=%i)\n", |
| 482 | | |
| 482 | | |
| 483 | 483 | floppy_drive_get_current_track( mc6843_floppy_image() ) )); |
| 484 | 484 | break; |
| 485 | 485 | |
| 486 | 486 | case 2: /* Interrupt Status Register (ISR) */ |
| 487 | 487 | data = mc6843->ISR; |
| 488 | 488 | LOG(( "%f $%04x mc6843_r: read ISR %02X: cmd=%scomplete settle=%scomplete sense-rq=%i STRB=%i\n", |
| 489 | | |
| 489 | | |
| 490 | 490 | (data & 1) ? "" : "not-" , (data & 2) ? "" : "not-", |
| 491 | 491 | (data >> 2) & 1, (data >> 3) & 1 )); |
| 492 | 492 | |
| r1293 | r1294 | |
| 512 | 512 | |
| 513 | 513 | data = mc6843->STRA; |
| 514 | 514 | LOG(( "%f $%04x mc6843_r: read STRA %02X: data-rq=%i del-dta=%i ready=%i t0=%i wp=%i trk-dif=%i idx=%i busy=%i\n", |
| 515 | | |
| 515 | | |
| 516 | 516 | data & 1, (data >> 1) & 1, (data >> 2) & 1, (data >> 3) & 1, |
| 517 | 517 | (data >> 4) & 1, (data >> 5) & 1, (data >> 6) & 1, (data >> 7) & 1 )); |
| 518 | 518 | break; |
| r1293 | r1294 | |
| 521 | 521 | case 4: /* Status Register B (STRB) */ |
| 522 | 522 | data = mc6843->STRB; |
| 523 | 523 | LOG(( "%f $%04x mc6843_r: read STRB %02X: data-err=%i CRC-err=%i dta--mrk-err=%i sect-mrk-err=%i seek-err=%i fi=%i wr-err=%i hard-err=%i\n", |
| 524 | | |
| 524 | | |
| 525 | 525 | data & 1, (data >> 1) & 1, (data >> 2) & 1, (data >> 3) & 1, |
| 526 | 526 | (data >> 4) & 1, (data >> 5) & 1, (data >> 6) & 1, (data >> 7) & 1 )); |
| 527 | 527 | |
| r1293 | r1294 | |
| 533 | 533 | case 7: /* Logical-Track Address Register (LTAR) */ |
| 534 | 534 | data = mc6843->LTAR; |
| 535 | 535 | LOG(( "%f $%04x mc6843_r: read LTAR %i (actual=%i)\n", |
| 536 | | |
| 536 | | |
| 537 | 537 | floppy_drive_get_current_track( mc6843_floppy_image() ) )); |
| 538 | 538 | break; |
| 539 | 539 | |
| r1293 | r1294 | |
| 554 | 554 | int FWF = (mc6843->CMR >> 4) & 1; |
| 555 | 555 | |
| 556 | 556 | LOG(( "%f $%04x mc6843_w: data output cmd=%s(%i), pos=%i/%i, GCR=%i, data=%02X\n", |
| 557 | | |
| 557 | | |
| 558 | 558 | mc6843_cmd[cmd], cmd, mc6843->data_idx, |
| 559 | 559 | mc6843->data_size, mc6843->GCR, data )); |
| 560 | 560 | |
| r1293 | r1294 | |
| 571 | 571 | /* end of sector write */ |
| 572 | 572 | mess_image* img = mc6843_floppy_image(); |
| 573 | 573 | |
| 574 | LOG(( "%f $%04x mc6843_w: write sector %i\n", | |
| 574 | LOG(( "%f $%04x mc6843_w: write sector %i\n", | |
| 575 | 575 | |
| 576 | 576 | floppy_drive_write_sector_data( |
| 577 | 577 | img, mc6843->side, mc6843->data_id, |
| r1293 | r1294 | |
| 596 | 596 | } |
| 597 | 597 | else |
| 598 | 598 | { |
| 599 | | |
| 599 | | |
| 600 | 600 | } |
| 601 | 601 | } |
| 602 | 602 | else |
| r1293 | r1294 | |
| 635 | 635 | UINT8 track = mc6843->data[1]; |
| 636 | 636 | UINT8 sector = mc6843->data[3]; |
| 637 | 637 | UINT8 filler = 0xe5; /* standard Thomson filler */ |
| 638 | LOG(( "%f $%04x mc6843_w: address id detected track=%i sector=%i\n", | |
| 638 | LOG(( "%f $%04x mc6843_w: address id detected track=%i sector=%i\n", | |
| 639 | 639 | floppy_drive_format_sector( img, mc6843->side, sector, track, 0, sector, 0, filler ); |
| 640 | 640 | } |
| 641 | 641 | else |
| r1293 | r1294 | |
| 665 | 665 | case 1: /* Current-Track Address Register (CTAR) */ |
| 666 | 666 | mc6843->CTAR = data & 0x7f; |
| 667 | 667 | LOG(( "%f $%04x mc6843_w: set CTAR to %i %02X (actual=%i) \n", |
| 668 | | |
| 668 | | |
| 669 | 669 | floppy_drive_get_current_track( mc6843_floppy_image() ) )); |
| 670 | 670 | break; |
| 671 | 671 | |
| r1293 | r1294 | |
| 674 | 674 | int cmd = data & 15; |
| 675 | 675 | |
| 676 | 676 | LOG(( "%f $%04x mc6843_w: set CMR to $%02X: cmd=%s(%i) FWF=%i DMA=%i ISR3-intr=%i fun-intr=%i\n", |
| 677 | | |
| 677 | | |
| 678 | 678 | data, mc6843_cmd[cmd], cmd, (data >> 4) & 1, (data >> 5) & 1, |
| 679 | 679 | (data >> 6) & 1, (data >> 7) & 1 )); |
| 680 | 680 | |
| r1293 | r1294 | |
| 697 | 697 | mc6843->STRA |= 0x80; /* set Busy */ |
| 698 | 698 | mc6843->STRA &= ~0x22; /* clear Track Not Equal & Delete Data Mark Detected */ |
| 699 | 699 | mc6843->STRB &= ~0x04; /* clear Data Mark Undetected */ |
| 700 | | |
| 700 | | |
| 701 | 701 | break; |
| 702 | 702 | case CMD_STZ: |
| 703 | 703 | case CMD_SEK: |
| 704 | 704 | mc6843->STRA |= 0x80; /* set Busy */ |
| 705 | | |
| 705 | | |
| 706 | 706 | break; |
| 707 | 707 | case CMD_FFW: |
| 708 | 708 | case CMD_FFR: |
| r1293 | r1294 | |
| 721 | 721 | |
| 722 | 722 | /* assume CLK freq = 1MHz (IBM 3740 compatibility) */ |
| 723 | 723 | LOG(( "%f $%04x mc6843_w: set SUR to $%02X: head settling time=%fms, track-to-track seek time=%f\n", |
| 724 | | |
| 724 | | |
| 725 | 725 | data, 4.096 * (data & 15), 1.024 * ((data >> 4) & 15) )); |
| 726 | 726 | break; |
| 727 | 727 | |
| 728 | 728 | case 4: /* Sector Address Register (SAR) */ |
| 729 | 729 | mc6843->SAR = data & 0x1f; |
| 730 | LOG(( "%f $%04x mc6843_w: set SAR to %i (%02X)\n", | |
| 730 | LOG(( "%f $%04x mc6843_w: set SAR to %i (%02X)\n", | |
| 731 | 731 | break; |
| 732 | 732 | |
| 733 | 733 | case 5: /* General Count Register (GCR) */ |
| 734 | 734 | mc6843->GCR = data & 0x7f; |
| 735 | LOG(( "%f $%04x mc6843_w: set GCR to %i (%02X)\n", | |
| 735 | LOG(( "%f $%04x mc6843_w: set GCR to %i (%02X)\n", | |
| 736 | 736 | break; |
| 737 | 737 | |
| 738 | 738 | case 6: /* CRC Control Register (CCR) */ |
| 739 | 739 | mc6843->CCR = data & 3; |
| 740 | 740 | LOG(( "%f $%04x mc6843_w: set CCR to %02X: CRC=%s shift=%i\n", |
| 741 | | |
| 741 | | |
| 742 | 742 | (data & 1) ? "enabled" : "disabled", (data >> 1) & 1 )); |
| 743 | 743 | break; |
| 744 | 744 | |
| 745 | 745 | case 7: /* Logical-Track Address Register (LTAR) */ |
| 746 | 746 | mc6843->LTAR = data & 0x7f; |
| 747 | 747 | LOG(( "%f $%04x mc6843_w: set LTAR to %i %02X (actual=%i)\n", |
| 748 | | |
| 748 | | |
| 749 | 749 | floppy_drive_get_current_track( mc6843_floppy_image() ) )); |
| 750 | 750 | break; |
| 751 | 751 | |
| r1293 | r1294 | |
| 785 | 785 | |
| 786 | 786 | mc6843->data_size = 0; |
| 787 | 787 | mc6843->data_idx = 0; |
| 788 | | |
| 788 | | |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | 791 | |
| r1293 | r1294 | |
| 801 | 801 | assert( mc6843 ); |
| 802 | 802 | memset( mc6843, 0, sizeof( * mc6843 ) ); |
| 803 | 803 | mc6843->iface = iface; |
| 804 | mc6843->timer_cont = | |
| 804 | mc6843->timer_cont = | |
| 805 | 805 | |
| 806 | 806 | state_save_register_item( "mc6843", 0, mc6843->CTAR ); |
| 807 | 807 | state_save_register_item( "mc6843", 0, mc6843->CMR ); |
| r1293 | r1294 | |
|---|---|---|
| 71 | 71 | int_ctl_dly = 0x7 /* 0 no interrupt, 1 = .1 second, 2=.5, 3=1, 4=5, 5=10, 6=30, 7=60 */ |
| 72 | 72 | }; |
| 73 | 73 | |
| 74 | static | |
| 74 | static | |
| 75 | 75 | { |
| 76 | 76 | switch(val) |
| 77 | 77 | { |
| 78 | case 0: return MAME_TIME_IN_MSEC(0); | |
| 79 | case 1: return MAME_TIME_IN_MSEC(100); | |
| 80 | case 2: return MAME_TIME_IN_MSEC(500); | |
| 81 | case 3: return MAME_TIME_IN_SEC(1); | |
| 82 | case 4: return MAME_TIME_IN_SEC(5); | |
| 83 | case 5: return MAME_TIME_IN_SEC(10); | |
| 84 | case 6: return MAME_TIME_IN_SEC(30); | |
| 85 | case 7: return MAME_TIME_IN_SEC(60); | |
| 78 | case 0: return ATTOTIME_IN_MSEC(0); | |
| 79 | case 1: return ATTOTIME_IN_MSEC(100); | |
| 80 | case 2: return ATTOTIME_IN_MSEC(500); | |
| 81 | case 3: return ATTOTIME_IN_SEC(1); | |
| 82 | case 4: return ATTOTIME_IN_SEC(5); | |
| 83 | case 5: return ATTOTIME_IN_SEC(10); | |
| 84 | case 6: return ATTOTIME_IN_SEC(30); | |
| 85 | case 7: return ATTOTIME_IN_SEC(60); | |
| 86 | 86 | default: fatalerror("out of range"); |
| 87 | 87 | } |
| 88 | 88 | }; |
| r1293 | r1294 | |
| 92 | 92 | { |
| 93 | 93 | memset(&rtc[which], 0, sizeof(rtc[which])); |
| 94 | 94 | |
| 95 | mame_timer_pulse(MAME_TIME_IN_MSEC(100), which, increment_rtc); | |
| 96 | rtc[which].interrupt_timer = mame_timer_alloc(rtc_interrupt_callback); | |
| 95 | timer_pulse(ATTOTIME_IN_MSEC(100), which, increment_rtc); | |
| 96 | rtc[which].interrupt_timer = timer_alloc(rtc_interrupt_callback); | |
| 97 | 97 | |
| 98 | 98 | { |
| 99 | 99 | mame_system_time systime; |
| r1293 | r1294 | |
| 239 | 239 | case 0x0: /* Control Register (test mode and interrupt not emulated) */ |
| 240 | 240 | if ((! (rtc[which].control & ctl_intstop)) && (data & ctl_intstop)) |
| 241 | 241 | /* interrupt stop */ |
| 242 | | |
| 242 | | |
| 243 | 243 | else if ((rtc[which].control & ctl_intstop) && (! (data & ctl_intstop))) |
| 244 | 244 | { |
| 245 | 245 | /* interrupt run */ |
| 246 | | |
| 246 | | |
| 247 | 247 | |
| 248 | | |
| 248 | | |
| 249 | 249 | } |
| 250 | 250 | if (data & ctl_clkstop) |
| 251 | 251 | /* stopping the clock clears the tenth counter */ |
| r1293 | r1294 | |
| 316 | 316 | if (! (rtc[which].control & ctl_intstop)) |
| 317 | 317 | { |
| 318 | 318 | /* interrupt run */ |
| 319 | | |
| 319 | | |
| 320 | 320 | |
| 321 | | |
| 321 | | |
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | else |
| r1293 | r1294 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | #if VERBOSE_DBG |
| 13 | 13 | #define DBG_LOG(N,M,A) \ |
| 14 | if(VERBOSE_DBG>=N){ if( M )logerror("%11.6f: %-24s", | |
| 14 | if(VERBOSE_DBG>=N){ if( M )logerror("%11.6f: %-24s", | |
| 15 | 15 | #else |
| 16 | 16 | #define DBG_LOG(n,m,a) |
| 17 | 17 | #endif |
| 18 | 18 | |
| 19 | 19 | #if VERBOSE_PIO |
| 20 | 20 | #define PIO_LOG(N,M,A) \ |
| 21 | if(VERBOSE_PIO>=N){ if( M )logerror("%11.6f: %-24s", | |
| 21 | if(VERBOSE_PIO>=N){ if( M )logerror("%11.6f: %-24s", | |
| 22 | 22 | #else |
| 23 | 23 | #define PIO_LOG(n,m,a) |
| 24 | 24 | #endif |
| r1293 | r1294 | |
| 198 | 198 | // will do more when I have a program supporting it |
| 199 | 199 | static struct { |
| 200 | 200 | int data[0x18]; |
| 201 | | |
| 201 | | |
| 202 | 202 | } pc_rtc; |
| 203 | 203 | |
| 204 | 204 | static TIMER_CALLBACK(pc_rtc_timer) |
| r1293 | r1294 | |
| 227 | 227 | void pc_rtc_init(void) |
| 228 | 228 | { |
| 229 | 229 | memset(&pc_rtc,0,sizeof(pc_rtc)); |
| 230 | pc_rtc.timer = mame_timer_alloc(pc_rtc_timer); | |
| 231 | mame_timer_adjust(pc_rtc.timer, time_zero, 0, make_mame_time(1, 0)); | |
| 230 | pc_rtc.timer = timer_alloc(pc_rtc_timer); | |
| 231 | timer_adjust(pc_rtc.timer, attotime_zero, 0, attotime_make(1, 0)); | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | READ8_HANDLER( pc_rtc_r ) |
| r1293 | r1294 | |
|---|---|---|
| 45 | 45 | |
| 46 | 46 | UINT16 ier, ipr, isr, imr; |
| 47 | 47 | UINT8 vr; |
| 48 | | |
| 48 | | |
| 49 | 49 | |
| 50 | 50 | UINT8 tacr, tbcr, tcdcr; |
| 51 | 51 | UINT8 tdr[MFP68901_MAX_TIMERS]; |
| 52 | 52 | UINT8 tmc[MFP68901_MAX_TIMERS]; |
| 53 | 53 | int to[MFP68901_MAX_TIMERS]; |
| 54 | 54 | int ti[MFP68901_MAX_TIMERS]; |
| 55 | | |
| 55 | | |
| 56 | 56 | |
| 57 | 57 | UINT8 ucr; |
| 58 | 58 | UINT8 udr; |
| r1293 | r1294 | |
| 64 | 64 | int rx_state, tx_state, xmit_state; |
| 65 | 65 | int rxtx_word, rxtx_start, rxtx_stop; |
| 66 | 66 | |
| 67 | | |
| 67 | | |
| 68 | 68 | } mfp_68901; |
| 69 | 69 | |
| 70 | 70 | static mfp_68901 mfp[MAX_MFP]; |
| r1293 | r1294 | |
| 632 | 632 | { |
| 633 | 633 | case MFP68901_TCR_TIMER_STOPPED: |
| 634 | 634 | logerror("MFP68901 #%u Timer A Stopped\n", which); |
| 635 | | |
| 635 | | |
| 636 | 636 | break; |
| 637 | 637 | |
| 638 | 638 | case MFP68901_TCR_TIMER_DELAY_4: |
| r1293 | r1294 | |
| 645 | 645 | { |
| 646 | 646 | int divisor = PRESCALER[mfp_p->tacr & 0x07]; |
| 647 | 647 | logerror("MFP68901 #%u Timer A Delay Mode : %u Prescale\n", which, divisor); |
| 648 | | |
| 648 | | |
| 649 | 649 | } |
| 650 | 650 | break; |
| 651 | 651 | |
| 652 | 652 | case MFP68901_TCR_TIMER_EVENT: |
| 653 | 653 | logerror("MFP68901 #%u Timer A Event Count Mode\n", which); |
| 654 | | |
| 654 | | |
| 655 | 655 | break; |
| 656 | 656 | |
| 657 | 657 | case MFP68901_TCR_TIMER_PULSE_4: |
| r1293 | r1294 | |
| 664 | 664 | { |
| 665 | 665 | int divisor = PRESCALER[mfp_p->tacr & 0x07]; |
| 666 | 666 | logerror("MFP68901 #%u Timer A Pulse Width Mode : %u Prescale\n", which, divisor); |
| 667 | mame_timer_adjust(mfp_p->timer[MFP68901_TIMER_A], time_never, which, MAME_TIME_IN_HZ(mfp_p->intf->timer_clock / divisor)); | |
| 668 | mame_timer_enable(mfp_p->timer[MFP68901_TIMER_A], 0); | |
| 667 | timer_adjust(mfp_p->timer[MFP68901_TIMER_A], attotime_never, which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor)); | |
| 668 | timer_enable(mfp_p->timer[MFP68901_TIMER_A], 0); | |
| 669 | 669 | } |
| 670 | 670 | break; |
| 671 | 671 | } |
| r1293 | r1294 | |
| 690 | 690 | { |
| 691 | 691 | case MFP68901_TCR_TIMER_STOPPED: |
| 692 | 692 | logerror("MFP68901 #%u Timer B Stopped\n", which); |
| 693 | | |
| 693 | | |
| 694 | 694 | break; |
| 695 | 695 | |
| 696 | 696 | case MFP68901_TCR_TIMER_DELAY_4: |
| r1293 | r1294 | |
| 703 | 703 | { |
| 704 | 704 | int divisor = PRESCALER[mfp_p->tbcr & 0x07]; |
| 705 | 705 | logerror("MFP68901 #%u Timer B Delay Mode : %u Prescale\n", which, divisor); |
| 706 | | |
| 706 | | |
| 707 | 707 | } |
| 708 | 708 | break; |
| 709 | 709 | |
| 710 | 710 | case MFP68901_TCR_TIMER_EVENT: |
| 711 | 711 | logerror("MFP68901 #%u Timer B Event Count Mode\n", which); |
| 712 | | |
| 712 | | |
| 713 | 713 | break; |
| 714 | 714 | |
| 715 | 715 | case MFP68901_TCR_TIMER_PULSE_4: |
| r1293 | r1294 | |
| 722 | 722 | { |
| 723 | 723 | int divisor = PRESCALER[mfp_p->tbcr & 0x07]; |
| 724 | 724 | logerror("MFP68901 #%u Timer B Pulse Width Mode : %u Prescale\n", which, DIVISOR); |
| 725 | mame_timer_adjust(mfp_p->timer[MFP68901_TIMER_B], time_never, which, MAME_TIME_IN_HZ(mfp_p->intf->timer_clock / divisor)); | |
| 726 | mame_timer_enable(mfp_p->timer[MFP68901_TIMER_B], 0); | |
| 725 | timer_adjust(mfp_p->timer[MFP68901_TIMER_B], attotime_never, which, ATTOTIME_IN_HZ(mfp_p->intf->timer_clock / divisor)); | |
| 726 | timer_enable(mfp_p->timer[MFP68901_TIMER_B], 0); | |
| 727 | 727 | } |
| 728 | 728 | break; |
| 729 | 729 | } |
| r1293 | r1294 | |
| 748 | 748 | { |
| 749 | 749 | case MFP68901_TCR_TIMER_STOPPED: |
| 750 | 750 | logerror("MFP68901 #%u Timer D Stopped\n", which); |
| 751 | | |
| 751 | | |
| 752 | 752 | break; |
| 753 | 753 | |
| 754 | 754 | case MFP68901_TCR_TIMER_DELAY_4: |
| r1293 | r1294 | |
| 761 | 761 | { |
| 762 | 762 | int divisor = PRESCALER[mfp_p->tcdcr & 0x07]; |
| 763 | 763 | logerror("MFP68901 #%u Timer D Delay Mode : %u Prescale\n", which, divisor); |
| 764 | | |
| 764 | | |
| 765 | 765 | } |
| 766 | 766 | break; |
| 767 | 767 | } |
| r1293 | r1294 | |
| 770 | 770 | { |
| 771 | 771 | case MFP68901_TCR_TIMER_STOPPED: |
| 772 | 772 | logerror("MFP68901 #%u Timer C Stopped\n", which); |
| 773 | | |
| 773 | | |
| 774 | 774 | break; |
| 775 | 775 | |
| 776 | 776 | case MFP68901_TCR_TIMER_DELAY_4: |
| r1293 | r1294 | |
| 783 | 783 | { |
| 784 | 784 | int divisor = PRESCALER[(mfp_p->tcdcr >> 4) & 0x07]; |
| 785 | 785 | logerror("MFP68901 #%u Timer C Delay Mode : %u Prescale\n", which, divisor); |
| 786 | | |
| 786 | | |
| 787 | 787 | } |
| 788 | 788 | break; |
| 789 | 789 | } |
| r1293 | r1294 | |
| 794 | 794 | |
| 795 | 795 | mfp_p->tdr[MFP68901_TIMER_A] = data; |
| 796 | 796 | |
| 797 | if (! | |
| 797 | if (! | |
| 798 | 798 | { |
| 799 | 799 | mfp_p->tmc[MFP68901_TIMER_A] = data; |
| 800 | 800 | } |
| r1293 | r1294 | |
| 805 | 805 | |
| 806 | 806 | mfp_p->tdr[MFP68901_TIMER_B] = data; |
| 807 | 807 | |
| 808 | if (! | |
| 808 | if (! | |
| 809 | 809 | { |
| 810 | 810 | mfp_p->tmc[MFP68901_TIMER_B] = data; |
| 811 | 811 | } |
| r1293 | r1294 | |
| 816 | 816 | |
| 817 | 817 | mfp_p->tdr[MFP68901_TIMER_C] = data; |
| 818 | 818 | |
| 819 | if (! | |
| 819 | if (! | |
| 820 | 820 | { |
| 821 | 821 | mfp_p->tmc[MFP68901_TIMER_C] = data; |
| 822 | 822 | } |
| r1293 | r1294 | |
| 827 | 827 | |
| 828 | 828 | mfp_p->tdr[MFP68901_TIMER_D] = data; |
| 829 | 829 | |
| 830 | if (! | |
| 830 | if (! | |
| 831 | 831 | { |
| 832 | 832 | mfp_p->tmc[MFP68901_TIMER_D] = data; |
| 833 | 833 | } |
| r1293 | r1294 | |
| 988 | 988 | { |
| 989 | 989 | if (mfp_p->intf->rx_clock == MFP68901_LOOPBACK_TIMER[index]) |
| 990 | 990 | { |
| 991 | | |
| 991 | | |
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | if (mfp_p->intf->tx_clock == MFP68901_LOOPBACK_TIMER[index]) |
| 995 | 995 | { |
| 996 | | |
| 996 | | |
| 997 | 997 | } |
| 998 | 998 | } |
| 999 | 999 | |
| r1293 | r1294 | |
| 1040 | 1040 | case MFP68901_TCR_TIMER_PULSE_64: |
| 1041 | 1041 | case MFP68901_TCR_TIMER_PULSE_100: |
| 1042 | 1042 | case MFP68901_TCR_TIMER_PULSE_200: |
| 1043 | | |
| 1043 | | |
| 1044 | 1044 | |
| 1045 | 1045 | if (((mfp_p->ti[index] ^ aer) == 0) && ((value ^ aer) == 1)) |
| 1046 | 1046 | { |
| r1293 | r1294 | |
| 1150 | 1150 | |
| 1151 | 1151 | mfp_p->intf = intf; |
| 1152 | 1152 | |
| 1153 | mfp_p->timer[MFP68901_TIMER_A] = mame_timer_alloc(timer_a); | |
| 1154 | mfp_p->timer[MFP68901_TIMER_B] = mame_timer_alloc(timer_b); | |
| 1155 | mfp_p->timer[MFP68901_TIMER_C] = mame_timer_alloc(timer_c); | |
| 1156 | mfp_p->timer[MFP68901_TIMER_D] = mame_timer_alloc(timer_d); | |
| 1153 | mfp_p->timer[MFP68901_TIMER_A] = timer_alloc(timer_a); | |
| 1154 | mfp_p->timer[MFP68901_TIMER_B] = timer_alloc(timer_b); | |
| 1155 | mfp_p->timer[MFP68901_TIMER_C] = timer_alloc(timer_c); | |
| 1156 | mfp_p->timer[MFP68901_TIMER_D] = timer_alloc(timer_d); | |
| 1157 | 1157 | |
| 1158 | mfp_p->rx_timer = | |
| 1158 | mfp_p->rx_timer = | |
| 1159 | 1159 | |
| 1160 | 1160 | if (mfp_p->intf->rx_clock > 0) |
| 1161 | 1161 | { |
| 1162 | | |
| 1162 | | |
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | mfp_p->tx_timer = | |
| 1165 | mfp_p->tx_timer = | |
| 1166 | 1166 | |
| 1167 | 1167 | if (mfp_p->intf->tx_clock > 0) |
| 1168 | 1168 | { |
| 1169 | | |
| 1169 | | |
| 1170 | 1170 | } |
| 1171 | 1171 | |
| 1172 | mfp_p->irq_timer = mame_timer_alloc(mfp68901_tick); | |
| 1173 | mame_timer_adjust(mfp_p->irq_timer, time_zero, which, MAME_TIME_IN_HZ(mfp_p->intf->chip_clock / 4)); | |
| 1172 | mfp_p->irq_timer = timer_alloc(mfp68901_tick); | |
| 1173 | timer_adjust(mfp_p->irq_timer, attotime_zero, which, ATTOTIME_IN_HZ(mfp_p->intf->chip_clock / 4)); | |
| 1174 | 1174 | |
| 1175 | 1175 | state_save_register_item("mfp68901", which, mfp_p->gpip); |
| 1176 | 1176 | state_save_register_item("mfp68901", which, mfp_p->aer); |
| r1293 | r1294 | |
|---|---|---|
| 676 | 676 | #endif |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | static int vc1541_time_greater(CBM_Drive * vc1541, | |
| 679 | static int vc1541_time_greater(CBM_Drive * vc1541, | |
| 680 | 680 | { |
| 681 | return compare_mame_times( | |
| 682 | sub_mame_times(mame_timer_get_time (), vc1541->i.serial.time), | |
| 681 | return attotime_compare( | |
| 682 | attotime_sub(timer_get_time (), vc1541->i.serial.time), | |
| 683 | 683 | threshold) > 0; |
| 684 | 684 | } |
| 685 | 685 | |
| r1293 | r1294 | |
| 719 | 719 | vc1541->i.serial.state = 100; |
| 720 | 720 | vc1541->i.serial.last = 0; |
| 721 | 721 | vc1541->i.serial.value = 0; |
| 722 | vc1541->i.serial.time = | |
| 722 | vc1541->i.serial.time = | |
| 723 | 723 | break; |
| 724 | 724 | } |
| 725 | 725 | break; |
| r1293 | r1294 | |
| 731 | 731 | vc1541->i.serial.state = 100; |
| 732 | 732 | vc1541->i.serial.last = 0; |
| 733 | 733 | vc1541->i.serial.value = 0; |
| 734 | vc1541->i.serial.time = | |
| 734 | vc1541->i.serial.time = | |
| 735 | 735 | break; |
| 736 | 736 | } |
| 737 | 737 | break; |
| r1293 | r1294 | |
| 843 | 843 | { |
| 844 | 844 | cbm_command (vc1541); |
| 845 | 845 | } |
| 846 | vc1541->i.serial.time = | |
| 846 | vc1541->i.serial.time = | |
| 847 | 847 | vc1541->i.serial.data = 0; |
| 848 | 848 | break; |
| 849 | 849 | } |
| r1293 | r1294 | |
| 873 | 873 | } |
| 874 | 874 | if (cbm_serial.clock[0]) |
| 875 | 875 | { |
| 876 | vc1541->i.serial.time = | |
| 876 | vc1541->i.serial.time = | |
| 877 | 877 | vc1541->i.serial.broadcast = !cbm_serial.atn[0]; |
| 878 | 878 | vc1541->i.serial.data = 1; |
| 879 | 879 | vc1541->i.serial.value = 0; |
| r1293 | r1294 | |
| 891 | 891 | vc1541->i.serial.data = 1; |
| 892 | 892 | break; |
| 893 | 893 | } |
| 894 | if (vc1541_time_greater(vc1541, | |
| 894 | if (vc1541_time_greater(vc1541, | |
| 895 | 895 | { |
| 896 | 896 | vc1541->i.serial.data = 0; |
| 897 | 897 | vc1541->i.serial.last = 1; |
| 898 | 898 | vc1541->i.serial.state++; |
| 899 | vc1541->i.serial.time = | |
| 899 | vc1541->i.serial.time = | |
| 900 | 900 | break; |
| 901 | 901 | } |
| 902 | 902 | break; |
| 903 | 903 | case 119: |
| 904 | if (vc1541_time_greater(vc1541, | |
| 904 | if (vc1541_time_greater(vc1541, | |
| 905 | 905 | { |
| 906 | 906 | vc1541->i.serial.value = 0; |
| 907 | 907 | vc1541->i.serial.data = 1; |
| r1293 | r1294 | |
| 911 | 911 | break; |
| 912 | 912 | |
| 913 | 913 | case 130: /* last byte of talk */ |
| 914 | if (vc1541_time_greater(vc1541, | |
| 914 | if (vc1541_time_greater(vc1541, | |
| 915 | 915 | { |
| 916 | 916 | vc1541->i.serial.data = 1; |
| 917 | 917 | vc1541->i.serial.state = 0; |
| r1293 | r1294 | |
| 937 | 937 | if (cbm_serial.atn[0]) |
| 938 | 938 | { |
| 939 | 939 | vc1541->i.serial.state++; |
| 940 | vc1541->i.serial.time = | |
| 940 | vc1541->i.serial.time = | |
| 941 | 941 | break; |
| 942 | 942 | } |
| 943 | 943 | break; |
| 944 | 944 | case 151: |
| 945 | if (vc1541_time_greater(vc1541, | |
| 945 | if (vc1541_time_greater(vc1541, | |
| 946 | 946 | { |
| 947 | 947 | vc1541->i.serial.state++; |
| 948 | 948 | vc1541->i.serial.clock = 0; |
| 949 | vc1541->i.serial.time = | |
| 949 | vc1541->i.serial.time = | |
| 950 | 950 | break; |
| 951 | 951 | } |
| 952 | 952 | break; |
| 953 | 953 | case 152: |
| 954 | if (vc1541_time_greater(vc1541, | |
| 954 | if (vc1541_time_greater(vc1541, | |
| 955 | 955 | { |
| 956 | 956 | vc1541->i.serial.state++; |
| 957 | 957 | vc1541->i.serial.clock = 1; |
| r1293 | r1294 | |
| 969 | 969 | if (cbm_serial.atn[0]) |
| 970 | 970 | { |
| 971 | 971 | vc1541->i.serial.state = 0; |
| 972 | vc1541->i.serial.time = | |
| 972 | vc1541->i.serial.time = | |
| 973 | 973 | break; |
| 974 | 974 | } |
| 975 | 975 | break; |
| r1293 | r1294 | |
| 979 | 979 | { |
| 980 | 980 | vc1541->i.serial.state++; |
| 981 | 981 | vc1541->i.serial.clock = 0; |
| 982 | vc1541->i.serial.time = | |
| 982 | vc1541->i.serial.time = | |
| 983 | 983 | break; |
| 984 | 984 | } |
| 985 | 985 | break; |
| 986 | 986 | case 201: |
| 987 | if (vc1541_time_greater(vc1541, | |
| 987 | if (vc1541_time_greater(vc1541, | |
| 988 | 988 | { |
| 989 | 989 | vc1541->i.serial.clock = 1; |
| 990 | 990 | vc1541->i.serial.data = 1; |
| r1293 | r1294 | |
| 1007 | 1007 | vc1541->i.serial.clock = 0; |
| 1008 | 1008 | vc1541->i.serial.data = (vc1541->i.serial.value & 1) ? 1 : 0; |
| 1009 | 1009 | vc1541->i.serial.state++; |
| 1010 | vc1541->i.serial.time = | |
| 1010 | vc1541->i.serial.time = | |
| 1011 | 1011 | break; |
| 1012 | 1012 | } |
| 1013 | 1013 | break; |
| r1293 | r1294 | |
| 1019 | 1019 | vc1541->i.serial.clock = 1; |
| 1020 | 1020 | break; |
| 1021 | 1021 | } |
| 1022 | if (vc1541_time_greater(vc1541, | |
| 1022 | if (vc1541_time_greater(vc1541, | |
| 1023 | 1023 | { |
| 1024 | 1024 | vc1541->i.serial.clock = 1; |
| 1025 | 1025 | vc1541->i.serial.state++; |
| 1026 | vc1541->i.serial.time = | |
| 1026 | vc1541->i.serial.time = | |
| 1027 | 1027 | break; |
| 1028 | 1028 | } |
| 1029 | 1029 | break; |
| r1293 | r1294 | |
| 1041 | 1041 | vc1541->i.serial.clock = 1; |
| 1042 | 1042 | break; |
| 1043 | 1043 | } |
| 1044 | if (vc1541_time_greater(vc1541, | |
| 1044 | if (vc1541_time_greater(vc1541, | |
| 1045 | 1045 | { |
| 1046 | 1046 | vc1541->i.serial.clock = 1; |
| 1047 | 1047 | vc1541->i.serial.state++; |
| 1048 | vc1541->i.serial.time = | |
| 1048 | vc1541->i.serial.time = | |
| 1049 | 1049 | break; |
| 1050 | 1050 | } |
| 1051 | 1051 | break; |
| r1293 | r1294 | |
| 1057 | 1057 | vc1541->i.serial.clock = 1; |
| 1058 | 1058 | break; |
| 1059 | 1059 | } |
| 1060 | if (vc1541_time_greater(vc1541, | |
| 1060 | if (vc1541_time_greater(vc1541, | |
| 1061 | 1061 | { |
| 1062 | 1062 | vc1541->i.serial.data = vc1541->i.serial.value & 2 ? 1 : 0; |
| 1063 | 1063 | vc1541->i.serial.clock = 0; |
| 1064 | 1064 | vc1541->i.serial.state++; |
| 1065 | vc1541->i.serial.time = | |
| 1065 | vc1541->i.serial.time = | |
| 1066 | 1066 | break; |
| 1067 | 1067 | } |
| 1068 | 1068 | break; |
| r1293 | r1294 | |
| 1074 | 1074 | vc1541->i.serial.clock = 1; |
| 1075 | 1075 | break; |
| 1076 | 1076 | } |
| 1077 | if (vc1541_time_greater(vc1541, | |
| 1077 | if (vc1541_time_greater(vc1541, | |
| 1078 | 1078 | { |
| 1079 | 1079 | vc1541->i.serial.data = vc1541->i.serial.value & 4 ? 1 : 0; |
| 1080 | 1080 | vc1541->i.serial.clock = 0; |
| 1081 | 1081 | vc1541->i.serial.state++; |
| 1082 | vc1541->i.serial.time = | |
| 1082 | vc1541->i.serial.time = | |
| 1083 | 1083 | break; |
| 1084 | 1084 | } |
| 1085 | 1085 | break; |
| r1293 | r1294 | |
| 1091 | 1091 | vc1541->i.serial.clock = 1; |
| 1092 | 1092 | break; |
| 1093 | 1093 | } |
| 1094 | if (vc1541_time_greater(vc1541, | |
| 1094 | if (vc1541_time_greater(vc1541, | |
| 1095 | 1095 | { |
| 1096 | 1096 | vc1541->i.serial.data = vc1541->i.serial.value & 8 ? 1 : 0; |
| 1097 | 1097 | vc1541->i.serial.clock = 0; |
| 1098 | 1098 | vc1541->i.serial.state++; |
| 1099 | vc1541->i.serial.time = | |
| 1099 | vc1541->i.serial.time = | |
| 1100 | 1100 | break; |
| 1101 | 1101 | } |
| 1102 | 1102 | break; |
| r1293 | r1294 | |
| 1108 | 1108 | vc1541->i.serial.clock = 1; |
| 1109 | 1109 | break; |
| 1110 | 1110 | } |
| 1111 | if (vc1541_time_greater(vc1541, | |
| 1111 | if (vc1541_time_greater(vc1541, | |
| 1112 | 1112 | { |
| 1113 | 1113 | vc1541->i.serial.data = vc1541->i.serial.value & 0x10 ? 1 : 0; |
| 1114 | 1114 | vc1541->i.serial.clock = 0; |
| 1115 | 1115 | vc1541->i.serial.state++; |
| 1116 | vc1541->i.serial.time = | |
| 1116 | vc1541->i.serial.time = | |
| 1117 | 1117 | break; |
| 1118 | 1118 | } |
| 1119 | 1119 | break; |
| r1293 | r1294 | |
| 1125 | 1125 | vc1541->i.serial.clock = 1; |
| 1126 | 1126 | break; |
| 1127 | 1127 | } |
| 1128 | if (vc1541_time_greater(vc1541, | |
| 1128 | if (vc1541_time_greater(vc1541, | |
| 1129 | 1129 | { |
| 1130 | 1130 | vc1541->i.serial.data = vc1541->i.serial.value & 0x20 ? 1 : 0; |
| 1131 | 1131 | vc1541->i.serial.clock = 0; |
| 1132 | 1132 | vc1541->i.serial.state++; |
| 1133 | vc1541->i.serial.time = | |
| 1133 | vc1541->i.serial.time = | |
| 1134 | 1134 | break; |
| 1135 | 1135 | } |
| 1136 | 1136 | break; |
| r1293 | r1294 | |
| 1142 | 1142 | vc1541->i.serial.clock = 1; |
| 1143 | 1143 | break; |
| 1144 | 1144 | } |
| 1145 | if (vc1541_time_greater(vc1541, | |
| 1145 | if (vc1541_time_greater(vc1541, | |
| 1146 | 1146 | { |
| 1147 | 1147 | vc1541->i.serial.data = vc1541->i.serial.value & 0x40 ? 1 : 0; |
| 1148 | 1148 | vc1541->i.serial.clock = 0; |
| 1149 | 1149 | vc1541->i.serial.state++; |
| 1150 | vc1541->i.serial.time = | |
| 1150 | vc1541->i.serial.time = | |
| 1151 | 1151 | break; |
| 1152 | 1152 | } |
| 1153 | 1153 | break; |
| r1293 | r1294 | |
| 1159 | 1159 | vc1541->i.serial.clock = 1; |
| 1160 | 1160 | break; |
| 1161 | 1161 | } |
| 1162 | if (vc1541_time_greater(vc1541, | |
| 1162 | if (vc1541_time_greater(vc1541, | |
| 1163 | 1163 | { |
| 1164 | 1164 | vc1541->i.serial.data = vc1541->i.serial.value & 0x80 ? 1 : 0; |
| 1165 | 1165 | vc1541->i.serial.clock = 0; |
| 1166 | 1166 | vc1541->i.serial.state++; |
| 1167 | vc1541->i.serial.time = | |
| 1167 | vc1541->i.serial.time = | |
| 1168 | 1168 | break; |
| 1169 | 1169 | } |
| 1170 | 1170 | break; |
| r1293 | r1294 | |
| 1176 | 1176 | vc1541->i.serial.clock = 1; |
| 1177 | 1177 | break; |
| 1178 | 1178 | } |
| 1179 | if (vc1541_time_greater(vc1541, | |
| 1179 | if (vc1541_time_greater(vc1541, | |
| 1180 | 1180 | { |
| 1181 | 1181 | DBG_LOG (1, "vc1541", ("%.2x written\n", vc1541->i.serial.value)); |
| 1182 | 1182 | vc1541->i.serial.data = 1; |
| 1183 | 1183 | vc1541->i.serial.clock = 0; |
| 1184 | 1184 | vc1541->i.serial.state++; |
| 1185 | vc1541->i.serial.time = | |
| 1185 | vc1541->i.serial.time = | |
| 1186 | 1186 | break; |
| 1187 | 1187 | } |
| 1188 | 1188 | break; |
| r1293 | r1294 | |
| 1197 | 1197 | if (!cbm_serial.data[0]) |
| 1198 | 1198 | { |
| 1199 | 1199 | vc1541->i.serial.state++; |
| 1200 | vc1541->i.serial.time = | |
| 1200 | vc1541->i.serial.time = | |
| 1201 | 1201 | break; |
| 1202 | 1202 | } |
| 1203 | 1203 | break; |
| r1293 | r1294 | |
| 1221 | 1221 | vc1541->i.serial.state = 320; |
| 1222 | 1222 | break; |
| 1223 | 1223 | } |
| 1224 | if (vc1541_time_greater(vc1541, | |
| 1224 | if (vc1541_time_greater(vc1541, | |
| 1225 | 1225 | { |
| 1226 | 1226 | vc1541->pos++; |
| 1227 | 1227 | vc1541->i.serial.clock = 1; |
| r1293 | r1294 | |
| 1237 | 1237 | vc1541->i.serial.clock = 1; |
| 1238 | 1238 | break; |
| 1239 | 1239 | } |
| 1240 | if (vc1541_time_greater(vc1541, | |
| 1240 | if (vc1541_time_greater(vc1541, | |
| 1241 | 1241 | { |
| 1242 | 1242 | vc1541->i.serial.clock = 1; |
| 1243 | 1243 | vc1541->i.serial.state++; |
| r1293 | r1294 | |
|---|---|---|
| 45 | 45 | int tracklen; |
| 46 | 46 | UINT8 mfm[MAX_MFM_TRACK_LEN]; |
| 47 | 47 | int cached; |
| 48 | mame_timer *rev_timer; | |
| 49 | mame_timer *sync_timer; | |
| 50 | mame_timer *dma_timer; | |
| 48 | emu_timer *rev_timer; | |
| 49 | emu_timer *sync_timer; | |
| 50 | emu_timer *dma_timer; | |
| 51 | 51 | int rev_timer_started; |
| 52 | 52 | int pos; |
| 53 | 53 | int len; |
| r1293 | r1294 | |
| 74 | 74 | fdc_status[id].dir = 0; |
| 75 | 75 | fdc_status[id].wprot = 1; |
| 76 | 76 | fdc_status[id].cyl = 0; |
| 77 | fdc_status[id].rev_timer = mame_timer_alloc(fdc_rev_proc); | |
| 78 | fdc_status[id].dma_timer = mame_timer_alloc(fdc_dma_proc); | |
| 79 | fdc_status[id].sync_timer = mame_timer_alloc(fdc_sync_proc); | |
| 77 | fdc_status[id].rev_timer = timer_alloc(fdc_rev_proc); | |
| 78 | fdc_status[id].dma_timer = timer_alloc(fdc_dma_proc); | |
| 79 | fdc_status[id].sync_timer = timer_alloc(fdc_sync_proc); | |
| 80 | 80 | fdc_status[id].rev_timer_started = 0; |
| 81 | 81 | fdc_status[id].cached = -1; |
| 82 | 82 | fdc_status[id].pos = 0; |
| r1293 | r1294 | |
| 149 | 149 | fdc_status[id].cached = -1; |
| 150 | 150 | fdc_status[id].motor_on = 0; |
| 151 | 151 | fdc_status[id].rev_timer_started = 0; |
| 152 | mame_timer_reset( fdc_status[id].rev_timer, time_never ); | |
| 153 | mame_timer_reset( fdc_status[id].sync_timer, time_never ); | |
| 154 | mame_timer_reset( fdc_status[id].dma_timer, time_never ); | |
| 152 | timer_reset( fdc_status[id].rev_timer, attotime_never ); | |
| 153 | timer_reset( fdc_status[id].sync_timer, attotime_never ); | |
| 154 | timer_reset( fdc_status[id].dma_timer, attotime_never ); | |
| 155 | 155 | fdc_rdy = 0; |
| 156 | 156 | |
| 157 | 157 | check_extended_image( id ); |
| r1293 | r1294 | |
| 168 | 168 | fdc_status[id].cached = -1; |
| 169 | 169 | fdc_status[id].motor_on = 0; |
| 170 | 170 | fdc_status[id].rev_timer_started = 0; |
| 171 | mame_timer_reset( fdc_status[id].rev_timer, time_never ); | |
| 172 | mame_timer_reset( fdc_status[id].sync_timer, time_never ); | |
| 173 | mame_timer_reset( fdc_status[id].dma_timer, time_never ); | |
| 171 | timer_reset( fdc_status[id].rev_timer, attotime_never ); | |
| 172 | timer_reset( fdc_status[id].sync_timer, attotime_never ); | |
| 173 | timer_reset( fdc_status[id].dma_timer, attotime_never ); | |
| 174 | 174 | fdc_rdy = 0; |
| 175 | 175 | } |
| 176 | 176 | |
| r1293 | r1294 | |
| 186 | 186 | return 0; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | elapsed = | |
| 189 | elapsed = | |
| 190 | 190 | speed = ( CUSTOM_REG(REG_ADKCON) & 0x100 ) ? 2 : 4; |
| 191 | 191 | |
| 192 | bytes = elapsed / | |
| 192 | bytes = elapsed / | |
| 193 | 193 | pos = bytes % ( fdc_status[drive].tracklen ); |
| 194 | 194 | |
| 195 | 195 | return pos; |
| r1293 | r1294 | |
| 275 | 275 | time = ONE_SECTOR_BYTES; |
| 276 | 276 | time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4; |
| 277 | 277 | time *= 8; |
| 278 | | |
| 278 | | |
| 279 | 279 | return; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | bail: |
| 283 | | |
| 283 | | |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | static TIMER_CALLBACK(fdc_dma_proc) |
| r1293 | r1294 | |
| 352 | 352 | time = len_words * 2; |
| 353 | 353 | time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4; |
| 354 | 354 | time *= 8; |
| 355 | | |
| 355 | | |
| 356 | 356 | return; |
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | bail: |
| 361 | | |
| 361 | | |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | void amiga_fdc_setup_dma( void ) { |
| r1293 | r1294 | |
| 423 | 423 | time += len_words * 2; |
| 424 | 424 | time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4; |
| 425 | 425 | time *= 8; |
| 426 | | |
| 426 | | |
| 427 | 427 | |
| 428 | 428 | return; |
| 429 | 429 | |
| 430 | 430 | bail: |
| 431 | | |
| 431 | | |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | static void setup_fdc_buffer( int drive ) |
| r1293 | r1294 | |
| 599 | 599 | /* Issue a index pulse when a disk revolution completes */ |
| 600 | 600 | cia_issue_index(1); |
| 601 | 601 | |
| 602 | | |
| 602 | | |
| 603 | 603 | fdc_status[drive].rev_timer_started = 1; |
| 604 | 604 | |
| 605 | 605 | if ( fdc_status[drive].is_ext_image == 0 ) |
| r1293 | r1294 | |
| 608 | 608 | time = GAP_TRACK_BYTES + 6; |
| 609 | 609 | time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4; |
| 610 | 610 | time *= 8; |
| 611 | | |
| 611 | | |
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | |
| r1293 | r1294 | |
| 620 | 620 | return; |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | | |
| 623 | | |
| 624 | 624 | fdc_status[drive].rev_timer_started = 1; |
| 625 | 625 | } |
| 626 | 626 | |
| r1293 | r1294 | |
| 630 | 630 | return; |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | | |
| 633 | | |
| 634 | 634 | fdc_status[drive].rev_timer_started = 0; |
| 635 | mame_timer_reset( fdc_status[drive].dma_timer, time_never ); | |
| 636 | mame_timer_reset( fdc_status[drive].sync_timer, time_never ); | |
| 635 | timer_reset( fdc_status[drive].dma_timer, attotime_never ); | |
| 636 | timer_reset( fdc_status[drive].sync_timer, attotime_never ); | |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | static void fdc_setup_leds( int drive ) { |
| r1293 | r1294 | |
|---|---|---|
| 149 | 149 | int inbuf; /* input buffer */ |
| 150 | 150 | int outbuf; /* output buffer */ |
| 151 | 151 | UINT8 int_on_next_rx; /* interrupt on next rx? */ |
| 152 | | |
| 152 | | |
| 153 | 153 | UINT8 receive_buffer[16]; /* buffer for incoming data */ |
| 154 | 154 | UINT8 receive_inptr; /* index of data coming in */ |
| 155 | 155 | UINT8 receive_outptr; /* index of data going out */ |
| r1293 | r1294 | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
| 254 | INLINE | |
| 254 | INLINE | |
| 255 | 255 | { |
| 256 | 256 | /* fix me -- should compute properly and include data, stop, parity bits */ |
| 257 | return | |
| 257 | return | |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
| r1293 | r1294 | |
| 275 | 275 | |
| 276 | 276 | memset(dart, 0, sizeof(*dart)); |
| 277 | 277 | |
| 278 | dart->chan[0].receive_timer = mame_timer_alloc(serial_callback); | |
| 279 | dart->chan[1].receive_timer = mame_timer_alloc(serial_callback); | |
| 278 | dart->chan[0].receive_timer = timer_alloc(serial_callback); | |
| 279 | dart->chan[1].receive_timer = timer_alloc(serial_callback); | |
| 280 | 280 | |
| 281 | 281 | dart->irq_cb = intf->irq_cb; |
| 282 | 282 | dart->dtr_changed_cb = intf->dtr_changed_cb; |
| r1293 | r1294 | |
| 295 | 295 | |
| 296 | 296 | static void reset_channel(z80dart *dart, int ch) |
| 297 | 297 | { |
| 298 | | |
| 298 | | |
| 299 | 299 | dart_channel *chan = &dart->chan[ch]; |
| 300 | 300 | |
| 301 | 301 | chan->status[0] = DART_RR0_TX_BUFFER_EMPTY; |
| r1293 | r1294 | |
| 312 | 312 | interrupt_check(dart); |
| 313 | 313 | |
| 314 | 314 | /* start the receive timer running */ |
| 315 | | |
| 315 | | |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | |
| r1293 | r1294 | |
| 579 | 579 | void z80dart_set_cts(int which, int ch, int state) |
| 580 | 580 | { |
| 581 | 581 | /* operate deferred */ |
| 582 | | |
| 582 | | |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | |
| r1293 | r1294 | |
| 591 | 591 | void z80dart_set_dcd(int which, int ch, int state) |
| 592 | 592 | { |
| 593 | 593 | /* operate deferred */ |
| 594 | | |
| 594 | | |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | |
| r1293 | r1294 | |
| 603 | 603 | void z80dart_set_ri(int which, int state) |
| 604 | 604 | { |
| 605 | 605 | /* operate deferred */ |
| 606 | | |
| 606 | | |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | 609 |
| r1293 | r1294 | |
|---|---|---|
| 16 | 16 | static UINT8 *key_buf = NULL; |
| 17 | 17 | static int key_buf_pos = 0; |
| 18 | 18 | static int key_cur_pos = 0; |
| 19 | static | |
| 19 | static | |
| 20 | 20 | |
| 21 | 21 | static void kbd_sendscancode( UINT8 scancode ) |
| 22 | 22 | { |
| r1293 | r1294 | |
| 49 | 49 | /* if we still have more data, schedule another update */ |
| 50 | 50 | if ( key_buf_pos != key_cur_pos ) |
| 51 | 51 | { |
| 52 | | |
| 52 | | |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| r1293 | r1294 | |
| 89 | 89 | /* if the buffer was empty and we have new data, start a timer to send the keystrokes */ |
| 90 | 90 | if ( key_buf_was_empty && ( key_buf_pos != key_cur_pos ) ) |
| 91 | 91 | { |
| 92 | | |
| 92 | | |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } |
| r1293 | r1294 | |
| 112 | 112 | key_buf = auto_malloc( KEYBOARD_BUFFER_SIZE ); |
| 113 | 113 | key_buf_pos = 0; |
| 114 | 114 | key_cur_pos = 0; |
| 115 | kbd_timer = mame_timer_alloc(kbd_update_callback); | |
| 116 | mame_timer_reset( kbd_timer, time_never ); | |
| 115 | kbd_timer = timer_alloc(kbd_update_callback); | |
| 116 | timer_reset( kbd_timer, attotime_never ); | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /*********************************************************************************************/ |
| r1293 | r1294 | |
|---|---|---|
| 50 | 50 | void (*stch_cb)( int level ); /* Status changed callback */ |
| 51 | 51 | void (*scor_cb)( int level ); /* Subcode ready callback */ |
| 52 | 52 | cdrom_file *cdrom; |
| 53 | | |
| 53 | | |
| 54 | 54 | } matsucd; |
| 55 | 55 | |
| 56 | 56 | static matsucd cd; |
| r1293 | r1294 | |
| 66 | 66 | |
| 67 | 67 | cd.cdrom = mess_cd_get_cdrom_file_by_number(0); |
| 68 | 68 | |
| 69 | cd.frame_timer = | |
| 69 | cd.frame_timer = | |
| 70 | 70 | |
| 71 | 71 | cd.stch_signal = 1; |
| 72 | 72 | } |
| r1293 | r1294 | |
| 139 | 139 | if (cddanum != -1) |
| 140 | 140 | { |
| 141 | 141 | cdda_stop_audio(cddanum); |
| 142 | | |
| 142 | | |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
| r1293 | r1294 | |
| 149 | 149 | if (cddanum != -1) |
| 150 | 150 | { |
| 151 | 151 | cdda_start_audio(cddanum, lba, num_blocks); |
| 152 | | |
| 152 | | |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| r1293 | r1294 | |
| 162 | 162 | |
| 163 | 163 | if ( pause ) |
| 164 | 164 | { |
| 165 | | |
| 165 | | |
| 166 | 166 | } |
| 167 | 167 | else |
| 168 | 168 | { |
| 169 | | |
| 169 | | |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | } |
| r1293 | r1294 | |
| 270 | 270 | if ( cd.stch_signal != 0 ) |
| 271 | 271 | { |
| 272 | 272 | update_status_changed( 0 ); |
| 273 | | |
| 273 | | |
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | } |
| r1293 | r1294 | |
| 296 | 296 | |
| 297 | 297 | newstatus |= MATSU_STATUS_PLAYING; |
| 298 | 298 | |
| 299 | | |
| 299 | | |
| 300 | 300 | } |
| 301 | 301 | else |
| 302 | 302 | { |
| r1293 | r1294 | |
|---|---|---|
| 30 | 30 | static UINT8 microtan_keypad_column; |
| 31 | 31 | static UINT8 microtan_keyboard_ascii; |
| 32 | 32 | |
| 33 | static | |
| 33 | static | |
| 34 | 34 | |
| 35 | 35 | static int via_0_irq_line = CLEAR_LINE; |
| 36 | 36 | static int via_1_irq_line = CLEAR_LINE; |
| r1293 | r1294 | |
| 434 | 434 | break; |
| 435 | 435 | case 1: /* BFF1: write delayed NMI */ |
| 436 | 436 | LOG(("microtan_bff1_w: %d <- %02x (delayed NMI)\n", offset, data)); |
| 437 | | |
| 437 | | |
| 438 | 438 | break; |
| 439 | 439 | case 2: /* BFF2: write keypad column write (what is this meant for?) */ |
| 440 | 440 | LOG(("microtan_bff2_w: %d <- %02x (keypad column)\n", offset, data)); |
| r1293 | r1294 | |
| 965 | 965 | |
| 966 | 966 | acia_6551_init(); |
| 967 | 967 | |
| 968 | microtan_timer = | |
| 968 | microtan_timer = | |
| 969 | 969 | } |
| r1293 | r1294 | |
|---|---|---|
| 311 | 311 | |
| 312 | 312 | WRITE16_HANDLER( intv_ram16_w ) |
| 313 | 313 | { |
| 314 | //logerror("%g: WRITING TO GRAM offset = %d\n", | |
| 314 | //logerror("%g: WRITING TO GRAM offset = %d\n", | |
| 315 | 315 | //logerror("ram16_w(%x) = %x\n",offset,data); |
| 316 | 316 | intv_ram16[offset] = data&0xffff; |
| 317 | 317 | } |
| r1293 | r1294 | |
| 434 | 434 | { |
| 435 | 435 | cpunum_set_input_line(0, CP1610_INT_INTRM, ASSERT_LINE); |
| 436 | 436 | sr1_int_pending = 1; |
| 437 | | |
| 437 | | |
| 438 | 438 | stic_screenrefresh(); |
| 439 | 439 | } |
| 440 | 440 |
| r1293 | r1294 | |
|---|---|---|
| 100 | 100 | |
| 101 | 101 | /* trigger NMI irq */ |
| 102 | 102 | amiga_ar1_spurious = 0; |
| 103 | | |
| 103 | | |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| r1293 | r1294 | |
| 117 | 117 | { |
| 118 | 118 | /* trigger an NMI or spurious irq */ |
| 119 | 119 | amiga_ar1_spurious = (offset == 0x60/2) ? 0 : 1; |
| 120 | | |
| 120 | | |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 |
| r1293 | r1294 | |
|---|---|---|
| 136 | 136 | tms9902[which].brk_callback = param->brk_callback; |
| 137 | 137 | tms9902[which].xmit_callback = param->xmit_callback; |
| 138 | 138 | |
| 139 | tms9902[which].timer = | |
| 139 | tms9902[which].timer = | |
| 140 | 140 | |
| 141 | 141 | reset(which); |
| 142 | 142 | } |
| r1293 | r1294 | |
| 146 | 146 | { |
| 147 | 147 | if (tms9902[which].timer) |
| 148 | 148 | { |
| 149 | | |
| 149 | | |
| 150 | 150 | tms9902[which].timer = NULL; |
| 151 | 151 | } |
| 152 | 152 | } |
| r1293 | r1294 | |
| 281 | 281 | { |
| 282 | 282 | if (tms9902[which].TMR) |
| 283 | 283 | { /* reset clock interval */ |
| 284 | mame_timer_adjust(tms9902[which].timer, | |
| 285 | double_to_mame_time((double) tms9902[which].TMR / (tms9902[which].clock_rate / ((tms9902[which].CLK4M) ? 4. : 3.) / 64.)), | |
| 284 | timer_adjust(tms9902[which].timer, | |
| 285 | double_to_attotime((double) tms9902[which].TMR / (tms9902[which].clock_rate / ((tms9902[which].CLK4M) ? 4. : 3.) / 64.)), | |
| 286 | 286 | which, |
| 287 | double_to_ | |
| 287 | double_to_ | |
| 288 | 288 | } |
| 289 | 289 | else |
| 290 | 290 | { /* clock interval == 0 -> no timer */ |
| 291 | | |
| 291 | | |
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 |
| r1293 | r1294 | |
|---|---|---|
| 37 | 37 | /* video related */ |
| 38 | 38 | UINT8 new_start_x; |
| 39 | 39 | UINT8 new_start_y; |
| 40 | | |
| 40 | | |
| 41 | 41 | UINT8 *charrom; |
| 42 | 42 | UINT8 charline; |
| 43 | 43 | UINT8 start_y; |
| r1293 | r1294 | |
| 356 | 356 | beep_set_state( 0, 0 ); |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | | |
| 359 | | |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /* |
| r1293 | r1294 | |
| 432 | 432 | |
| 433 | 433 | memset( mess_ram + 0x10000, 0xFF, 0x1000 ); |
| 434 | 434 | |
| 435 | osborne1.video_timer = mame_timer_alloc( osborne1_video_callback ); | |
| 436 | mame_timer_adjust( osborne1.video_timer, video_screen_get_time_until_pos( 0, 1, 0 ), 0, time_never ); | |
| 435 | osborne1.video_timer = timer_alloc( osborne1_video_callback ); | |
| 436 | timer_adjust( osborne1.video_timer, video_screen_get_time_until_pos( 0, 1, 0 ), 0, attotime_never ); | |
| 437 | 437 | pia_1_ca1_w( 0, 0 ); |
| 438 | 438 | |
| 439 | | |
| 439 | | |
| 440 | 440 | |
| 441 | 441 | memory_set_opbase_handler( 0, osborne1_opbase ); |
| 442 | 442 | } |
| r1293 | r1294 | |
|---|---|---|
| 34 | 34 | UINT8 sms_input_port1; |
| 35 | 35 | |
| 36 | 36 | /* Data needed for Rapid Fire Unit support */ |
| 37 | ||
| 37 | ||
| 38 | 38 | UINT8 rapid_fire_state_1; |
| 39 | 39 | UINT8 rapid_fire_state_2; |
| 40 | 40 | |
| r1293 | r1294 | |
| 955 | 955 | |
| 956 | 956 | rapid_fire_state_1 = 0; |
| 957 | 957 | rapid_fire_state_2 = 0; |
| 958 | rapid_fire_timer = mame_timer_alloc( rapid_fire_callback ); | |
| 959 | mame_timer_adjust( rapid_fire_timer, MAME_TIME_IN_HZ(10), 0, MAME_TIME_IN_HZ(10) ); | |
| 958 | rapid_fire_timer = timer_alloc( rapid_fire_callback ); | |
| 959 | timer_adjust( rapid_fire_timer, ATTOTIME_IN_HZ(10), 0, ATTOTIME_IN_HZ(10) ); | |
| 960 | 960 | |
| 961 | 961 | last_paddle_read_time = 0; |
| 962 | 962 | paddle_read_state = 0; |
| r1293 | r1294 | |
|---|---|---|
| 174 | 174 | |
| 175 | 175 | UINT8 ddam; /* ddam of sector found - used when reading */ |
| 176 | 176 | UINT8 sector_data_id; |
| 177 | | |
| 177 | | |
| 178 | 178 | int data_direction; |
| 179 | 179 | |
| 180 | 180 | UINT8 ipl; /* index pulse */ |
| r1293 | r1294 | |
| 245 | 245 | static void wd17xx_set_data_request(void); |
| 246 | 246 | static void wd17xx_timed_data_request(void); |
| 247 | 247 | static void wd17xx_set_irq(wd17xx_info *); |
| 248 | static | |
| 248 | static | |
| 249 | 249 | |
| 250 | 250 | /* one wd controlling multiple drives */ |
| 251 | 251 | static wd17xx_info wd; |
| r1293 | r1294 | |
| 304 | 304 | { |
| 305 | 305 | wd17xx_info *info = (wd17xx_info *) param; |
| 306 | 306 | wd17xx_set_irq(info); |
| 307 | | |
| 307 | | |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | |
| 311 | 311 | |
| 312 | static void wd17xx_set_busy(wd17xx_info *w, | |
| 312 | static void wd17xx_set_busy(wd17xx_info *w, | |
| 313 | 313 | { |
| 314 | 314 | w->status |= STA_1_BUSY; |
| 315 | | |
| 315 | | |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | |
| r1293 | r1294 | |
| 361 | 361 | /* when command completes set irq */ |
| 362 | 362 | wd17xx_set_irq(w); |
| 363 | 363 | #endif |
| 364 | wd17xx_set_busy(w, | |
| 364 | wd17xx_set_busy(w, | |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | |
| r1293 | r1294 | |
| 397 | 397 | wd.callback_param = param; |
| 398 | 398 | // wd.status_ipl = STA_1_IPL; |
| 399 | 399 | wd.density = DEN_MFM_LO; |
| 400 | busy_timer = mame_timer_alloc_ptr(wd17xx_busy_callback, &wd); | |
| 401 | wd.timer = mame_timer_alloc(wd17xx_misc_timer_callback); | |
| 402 | wd.timer_rs = mame_timer_alloc(wd17xx_read_sector_callback); | |
| 403 | wd.timer_ws = mame_timer_alloc(wd17xx_write_sector_callback); | |
| 400 | busy_timer = timer_alloc_ptr(wd17xx_busy_callback, &wd); | |
| 401 | wd.timer = timer_alloc(wd17xx_misc_timer_callback); | |
| 402 | wd.timer_rs = timer_alloc(wd17xx_read_sector_callback); | |
| 403 | wd.timer_ws = timer_alloc(wd17xx_write_sector_callback); | |
| 404 | 404 | |
| 405 | 405 | wd17xx_reset(); |
| 406 | 406 | } |
| r1293 | r1294 | |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | /* stop it, but don't allow it to be free'd */ |
| 808 | | |
| 808 | | |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | |
| r1293 | r1294 | |
| 830 | 830 | usecs *= delay; |
| 831 | 831 | |
| 832 | 832 | /* set new timer */ |
| 833 | | |
| 833 | | |
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | |
| r1293 | r1294 | |
| 947 | 947 | wd17xx_read_sector(w); |
| 948 | 948 | |
| 949 | 949 | /* stop it, but don't allow it to be free'd */ |
| 950 | | |
| 950 | | |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | |
| r1293 | r1294 | |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | /* stop it, but don't allow it to be free'd */ |
| 1001 | | |
| 1001 | | |
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | |
| r1293 | r1294 | |
| 1012 | 1012 | usecs = floppy_drive_get_datarate_in_us(w->density); |
| 1013 | 1013 | |
| 1014 | 1014 | /* set new timer */ |
| 1015 | | |
| 1015 | | |
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | 1018 | |
| r1293 | r1294 | |
| 1026 | 1026 | usecs = 40; /* How long should we wait? How about 40 micro seconds? */ |
| 1027 | 1027 | |
| 1028 | 1028 | /* set new timer */ |
| 1029 | | |
| 1029 | | |
| 1030 | 1030 | } |
| 1031 | 1031 | |
| 1032 | 1032 | |
| r1293 | r1294 | |
| 1040 | 1040 | usecs = 40; /* How long should we wait? How about 40 micro seconds? */ |
| 1041 | 1041 | |
| 1042 | 1042 | /* set new timer */ |
| 1043 | | |
| 1043 | | |
| 1044 | 1044 | } |
| 1045 | 1045 | |
| 1046 | 1046 | |
| r1293 | r1294 | |
| 1419 | 1419 | #if 0 |
| 1420 | 1420 | wd17xx_set_irq(w); |
| 1421 | 1421 | #endif |
| 1422 | wd17xx_set_busy(w, | |
| 1422 | wd17xx_set_busy(w, | |
| 1423 | 1423 | |
| 1424 | 1424 | } |
| 1425 | 1425 | |
| r1293 | r1294 | |
| 1441 | 1441 | #if 0 |
| 1442 | 1442 | wd17xx_set_irq(w); |
| 1443 | 1443 | #endif |
| 1444 | wd17xx_set_busy(w, | |
| 1444 | wd17xx_set_busy(w, | |
| 1445 | 1445 | |
| 1446 | 1446 | |
| 1447 | 1447 | } |
| r1293 | r1294 | |
| 1463 | 1463 | #if 0 |
| 1464 | 1464 | wd17xx_set_irq(w); |
| 1465 | 1465 | #endif |
| 1466 | wd17xx_set_busy(w, | |
| 1466 | wd17xx_set_busy(w, | |
| 1467 | 1467 | |
| 1468 | 1468 | } |
| 1469 | 1469 | |
| r1293 | r1294 | |
| 1486 | 1486 | #if 0 |
| 1487 | 1487 | wd17xx_set_irq(w); |
| 1488 | 1488 | #endif |
| 1489 | wd17xx_set_busy(w, | |
| 1489 | wd17xx_set_busy(w, | |
| 1490 | 1490 | } |
| 1491 | 1491 | |
| 1492 | 1492 | // if (w->busy_count==0) |
| r1293 | r1294 | |
|---|---|---|
| 21 | 21 | UINT8 queue[256]; |
| 22 | 22 | UINT8 head, tail, mb; |
| 23 | 23 | |
| 24 | | |
| 24 | | |
| 25 | 25 | |
| 26 | 26 | } pc_mouse; |
| 27 | 27 | |
| r1293 | r1294 | |
| 30 | 30 | void pc_mouse_initialise(void) |
| 31 | 31 | { |
| 32 | 32 | pc_mouse.head = pc_mouse.tail = 0; |
| 33 | pc_mouse.timer = | |
| 33 | pc_mouse.timer = | |
| 34 | 34 | pc_mouse.inputs=UART8250_HANDSHAKE_IN_DSR|UART8250_HANDSHAKE_IN_CTS; |
| 35 | 35 | if (pc_mouse.serial_port!=-1) |
| 36 | 36 | uart8250_handshake_in(pc_mouse.serial_port, pc_mouse.inputs); |
| r1293 | r1294 | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /* start a timer to scan the mouse input */ |
| 232 | | |
| 232 | | |
| 233 | 233 | } |
| 234 | 234 | else |
| 235 | 235 | { |
| 236 | 236 | /* CTS just went to 0 */ |
| 237 | | |
| 237 | | |
| 238 | 238 | pc_mouse.head = pc_mouse.tail = 0; |
| 239 | 239 | } |
| 240 | 240 | } |
| r1293 | r1294 | |
|---|---|---|
| 282 | 282 | if (cas_size) |
| 283 | 283 | { |
| 284 | 284 | LOG(("trs80_init_machine: schedule cas_copy_callback (%d)\n", cas_size)); |
| 285 | | |
| 285 | | |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 |
| r1293 | r1294 | |
|---|---|---|
| 67 | 67 | { |
| 68 | 68 | UINT8 data = p1; |
| 69 | 69 | |
| 70 | logerror("%.9f p1 read %.2x\n", | |
| 70 | logerror("%.9f p1 read %.2x\n", | |
| 71 | 71 | return data; |
| 72 | 72 | } |
| 73 | 73 | |
| r1293 | r1294 | |
| 78 | 78 | /* ROM is mirrored so this will be OK for all sizes 2k/4k/8k */ |
| 79 | 79 | memory_set_bankptr(1, memory_region(REGION_USER1) + (0x800 * (p1 & 0x03))); |
| 80 | 80 | |
| 81 | logerror("%.6f p1 written %.2x\n", | |
| 81 | logerror("%.6f p1 written %.2x\n", | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | READ8_HANDLER( odyssey2_getp2 ) |
| r1293 | r1294 | |
| 109 | 109 | else |
| 110 | 110 | p2 = p2 | 0xF0; |
| 111 | 111 | |
| 112 | logerror("%.6f p2 read %.2x\n", | |
| 112 | logerror("%.6f p2 read %.2x\n", | |
| 113 | 113 | return p2; |
| 114 | 114 | } |
| 115 | 115 | |
| r1293 | r1294 | |
| 117 | 117 | { |
| 118 | 118 | p2 = data; |
| 119 | 119 | |
| 120 | logerror("%.6f p2 written %.2x\n", | |
| 120 | logerror("%.6f p2 written %.2x\n", | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | READ8_HANDLER( odyssey2_getbus ) |
| r1293 | r1294 | |
| 130 | 130 | if ((p2 & P2_KEYBOARD_SELECT_MASK) == 0) |
| 131 | 131 | data &= readinputport(7); /* read joystick 2 */ |
| 132 | 132 | |
| 133 | logerror("%.6f bus read %.2x\n", | |
| 133 | logerror("%.6f bus read %.2x\n", | |
| 134 | 134 | return data; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | WRITE8_HANDLER( odyssey2_putbus ) |
| 138 | 138 | { |
| 139 | logerror("%.6f bus written %.2x\n", | |
| 139 | logerror("%.6f bus written %.2x\n", | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /////////////////////////////////// |
| r1293 | r1294 | |
|---|---|---|
| 1029 | 1029 | break; |
| 1030 | 1030 | case 0x04: |
| 1031 | 1031 | /* X Joystick 1 axis */ |
| 1032 | result = | |
| 1032 | result = | |
| 1033 | 1033 | break; |
| 1034 | 1034 | case 0x05: |
| 1035 | 1035 | /* Y Joystick 1 axis */ |
| 1036 | result = | |
| 1036 | result = | |
| 1037 | 1037 | break; |
| 1038 | 1038 | case 0x06: |
| 1039 | 1039 | /* X Joystick 2 axis */ |
| 1040 | result = | |
| 1040 | result = | |
| 1041 | 1041 | break; |
| 1042 | 1042 | case 0x07: |
| 1043 | 1043 | /* Y Joystick 2 axis */ |
| 1044 | result = | |
| 1044 | result = | |
| 1045 | 1045 | break; |
| 1046 | 1046 | default: |
| 1047 | 1047 | /* c060 Empty Cassette head read |
| r1293 | r1294 | |
| 1061 | 1061 | |
| 1062 | 1062 | READ8_HANDLER ( apple2_c07x_r ) |
| 1063 | 1063 | { |
| 1064 | double x_calibration = mame_time_to_double(MAME_TIME_IN_USEC(12)); | |
| 1065 | double y_calibration = mame_time_to_double(MAME_TIME_IN_USEC(13)); | |
| 1064 | double x_calibration = attotime_to_double(ATTOTIME_IN_USEC(12)); | |
| 1065 | double y_calibration = attotime_to_double(ATTOTIME_IN_USEC(13)); | |
| 1066 | 1066 | |
| 1067 | 1067 | if (offset == 0) |
| 1068 | 1068 | { |
| 1069 | joystick_x1_time = mame_time_to_double(mame_timer_get_time()) + x_calibration * readinputportbytag("joystick_1_x"); | |
| 1070 | joystick_y1_time = mame_time_to_double(mame_timer_get_time()) + y_calibration * readinputportbytag("joystick_1_y"); | |
| 1071 | joystick_x2_time = mame_time_to_double(mame_timer_get_time()) + x_calibration * readinputportbytag("joystick_2_x"); | |
| 1072 | joystick_y2_time = mame_time_to_double(mame_timer_get_time()) + y_calibration * readinputportbytag("joystick_2_y"); | |
| 1069 | joystick_x1_time = attotime_to_double(timer_get_time()) + x_calibration * readinputportbytag("joystick_1_x"); | |
| 1070 | joystick_y1_time = attotime_to_double(timer_get_time()) + y_calibration * readinputportbytag("joystick_1_y"); | |
| 1071 | joystick_x2_time = attotime_to_double(timer_get_time()) + x_calibration * readinputportbytag("joystick_2_x"); | |
| 1072 | joystick_y2_time = attotime_to_double(timer_get_time()) + y_calibration * readinputportbytag("joystick_2_y"); | |
| 1073 | 1073 | } |
| 1074 | 1074 | return 0; |
| 1075 | 1075 | } |
| r1293 | r1294 | |
|---|---|---|
| 193 | 193 | |
| 194 | 194 | ti_calculator_model = TI_81; |
| 195 | 195 | |
| 196 | | |
| 196 | | |
| 197 | 197 | |
| 198 | 198 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, MWA8_ROM); |
| 199 | 199 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, MWA8_ROM); |
| r1293 | r1294 | |
| 223 | 223 | |
| 224 | 224 | ti_calculator_model = TI_85; |
| 225 | 225 | |
| 226 | | |
| 226 | | |
| 227 | 227 | |
| 228 | 228 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, MWA8_ROM); |
| 229 | 229 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, MWA8_ROM); |
| r1293 | r1294 | |
| 267 | 267 | |
| 268 | 268 | ti_calculator_model = TI_86; |
| 269 | 269 | |
| 270 | | |
| 270 | | |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | add_reset_callback(machine, ti85_reset_serial); |
| r1293 | r1294 | |
|---|---|---|
| 21 | 21 | dmac.intf = intf; |
| 22 | 22 | for(x=0;x<4;x++) |
| 23 | 23 | { |
| 24 | dmac.timer[x] = | |
| 24 | dmac.timer[x] = | |
| 25 | 25 | dmac.reg[x].niv = 0x0f; // defaults? |
| 26 | 26 | dmac.reg[x].eiv = 0x0f; |
| 27 | 27 | } |
| r1293 | r1294 | |
| 205 | 205 | if((dmac.reg[channel].dcr & 0xc0) == 0x00) // Burst transfer |
| 206 | 206 | { |
| 207 | 207 | cpunum_set_input_line(dmac.intf->cpu,INPUT_LINE_HALT,ASSERT_LINE); |
| 208 | | |
| 208 | | |
| 209 | 209 | } |
| 210 | 210 | else |
| 211 | | |
| 211 | | |
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | dmac.transfer_size[channel] = dmac.reg[channel].mtc; |
| r1293 | r1294 | |
| 224 | 224 | void dma_transfer_abort(int channel) |
| 225 | 225 | { |
| 226 | 226 | logerror("DMA#%i: Transfer aborted\n",channel); |
| 227 | | |
| 227 | | |
| 228 | 228 | dmac.in_progress[channel] = 0; |
| 229 | 229 | dmac.reg[channel].mtc = dmac.transfer_size[channel]; |
| 230 | 230 | dmac.reg[channel].csr |= 0xe0; // channel operation complete, block transfer complete |
| r1293 | r1294 | |
| 234 | 234 | void dma_transfer_halt(int channel) |
| 235 | 235 | { |
| 236 | 236 | dmac.halted[channel] = 1; |
| 237 | | |
| 237 | | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | void dma_transfer_continue(int channel) |
| r1293 | r1294 | |
| 242 | 242 | if(dmac.halted[channel] != 0) |
| 243 | 243 | { |
| 244 | 244 | dmac.halted[channel] = 0; |
| 245 | | |
| 245 | | |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
| r1293 | r1294 | |
| 361 | 361 | dmac.reg[x].mtc = program_read_word(dmac.reg[x].bar+4); |
| 362 | 362 | return; |
| 363 | 363 | } |
| 364 | | |
| 364 | | |
| 365 | 365 | dmac.in_progress[x] = 0; |
| 366 | 366 | dmac.reg[x].mtc = dmac.transfer_size[x]; |
| 367 | 367 | dmac.reg[x].csr |= 0xe0; // channel operation complete, block transfer complete |
| r1293 | r1294 | |
|---|---|---|
| 38 | 38 | unsigned char bfc; // [39] Base Function Code (R/W) |
| 39 | 39 | unsigned char gcr; // [3f] General Control Register (R/W) |
| 40 | 40 | } reg[4]; |
| 41 | | |
| 41 | | |
| 42 | 42 | int in_progress[4]; // if a channel is in use |
| 43 | 43 | int transfer_size[4]; |
| 44 | 44 | int halted[4]; // non-zero if a channel has been halted, and can be continued later. |
| r1293 | r1294 | |
|---|---|---|
| 71 | 71 | UINT8 *subcode_buffer; |
| 72 | 72 | cdrom_file *cd; |
| 73 | 73 | const cdrom_toc* toc; |
| 74 | mame_timer *data_timer; | |
| 75 | mame_timer *adpcm_dma_timer; | |
| 74 | emu_timer *data_timer; | |
| 75 | emu_timer *adpcm_dma_timer; | |
| 76 | 76 | } pce_cd; |
| 77 | 77 | |
| 78 | 78 | /* MSM5205 ADPCM decoder definition */ |
| r1293 | r1294 | |
| 358 | 358 | if ( frame_count == 0 ) { |
| 359 | 359 | pce_cd_reply_status_byte( SCSI_STATUS_OK ); |
| 360 | 360 | } else { |
| 361 | | |
| 361 | | |
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | |
| r1293 | r1294 | |
| 790 | 790 | /* We are done, disable the timer */ |
| 791 | 791 | logerror("Last frame read from CD\n"); |
| 792 | 792 | pce_cd.data_transferred = 1; |
| 793 | | |
| 793 | | |
| 794 | 794 | } else { |
| 795 | 795 | pce_cd.data_transferred = 0; |
| 796 | 796 | } |
| r1293 | r1294 | |
| 834 | 834 | pce_cd.end_frame = pce_cd.last_frame; |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | pce_cd.data_timer = mame_timer_alloc( pce_cd_data_timer_callback ); | |
| 838 | mame_timer_adjust( pce_cd.data_timer, time_never, 0, time_never ); | |
| 839 | pce_cd.adpcm_dma_timer = mame_timer_alloc( pce_cd_adpcm_dma_timer_callback ); | |
| 840 | mame_timer_adjust( pce_cd.adpcm_dma_timer, time_never, 0, time_never ); | |
| 837 | pce_cd.data_timer = timer_alloc( pce_cd_data_timer_callback ); | |
| 838 | timer_adjust( pce_cd.data_timer, attotime_never, 0, attotime_never ); | |
| 839 | pce_cd.adpcm_dma_timer = timer_alloc( pce_cd_adpcm_dma_timer_callback ); | |
| 840 | timer_adjust( pce_cd.adpcm_dma_timer, attotime_never, 0, attotime_never ); | |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | WRITE8_HANDLER( pce_cd_bram_w ) { |
| r1293 | r1294 | |
| 891 | 891 | case 0x0B: /* ADPCM DMA control */ |
| 892 | 892 | if ( ! ( pce_cd.regs[0x0B] & 0x02 ) && ( data & 0x02 ) ) { |
| 893 | 893 | /* Start CD to ADPCM transfer */ |
| 894 | | |
| 894 | | |
| 895 | 895 | } |
| 896 | 896 | if ( ( pce_cd.regs[0x0B] & 0x02 ) && ! ( data & 0x02 ) ) { |
| 897 | 897 | /* Stop CD to ADPCM transfer (?) */ |
| 898 | | |
| 898 | | |
| 899 | 899 | } |
| 900 | 900 | break; |
| 901 | 901 | case 0x0C: /* ADPCM status */ |
| r1293 | r1294 | |
| 944 | 944 | if ( pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && ! pce_cd.scsi_CD ) { |
| 945 | 945 | if ( pce_cd.scsi_IO ) { |
| 946 | 946 | pce_cd.scsi_ACK = 1; |
| 947 | | |
| 947 | | |
| 948 | 948 | } |
| 949 | 949 | } |
| 950 | 950 | return data; |
| r1293 | r1294 | |
|---|---|---|
| 1203 | 1203 | { |
| 1204 | 1204 | /* Weirdly enough, we are always seeing some problems even though |
| 1205 | 1205 | everything is working fine. */ |
| 1206 | | |
| 1206 | | |
| 1207 | 1207 | logerror("ti99/4a speech says aaargh!\n"); |
| 1208 | 1208 | logerror("(time to ready: %f -> %d)\n", time_to_ready, (int) ceil(3000000*time_to_ready)); |
| 1209 | 1209 | } |
| r1293 | r1294 | |
| 1225 | 1225 | complex. */ |
| 1226 | 1226 | if (! tms5220_ready_r()) |
| 1227 | 1227 | { |
| 1228 | mame_time time_to_ready = double_to_mame_time(tms5220_time_to_ready()); | |
| 1229 | int cycles_to_ready = ceil(MAME_TIME_TO_CYCLES(0, time_to_ready)); | |
| 1228 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready()); | |
| 1229 | int cycles_to_ready = ceil(ATTOTIME_TO_CYCLES(0, time_to_ready)); | |
| 1230 | 1230 | |
| 1231 | logerror("time to ready: %f -> %d\n", | |
| 1231 | logerror("time to ready: %f -> %d\n", | |
| 1232 | 1232 | |
| 1233 | 1233 | activecpu_adjust_icount(-cycles_to_ready); |
| 1234 | | |
| 1234 | | |
| 1235 | 1235 | } |
| 1236 | 1236 | #endif |
| 1237 | 1237 | |
| r1293 | r1294 | |
| 1586 | 1586 | complex. */ |
| 1587 | 1587 | if (! tms5220_ready_r()) |
| 1588 | 1588 | { |
| 1589 | mame_time time_to_ready = double_to_mame_time(tms5220_time_to_ready()); | |
| 1590 | double d = ceil(MAME_TIME_TO_CYCLES(0, time_to_ready)); | |
| 1589 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready()); | |
| 1590 | double d = ceil(ATTOTIME_TO_CYCLES(0, time_to_ready)); | |
| 1591 | 1591 | int cycles_to_ready = ((int) (d + 3)) & ~3; |
| 1592 | 1592 | |
| 1593 | logerror("time to ready: %f -> %d\n", | |
| 1593 | logerror("time to ready: %f -> %d\n", | |
| 1594 | 1594 | , (int) cycles_to_ready); |
| 1595 | 1595 | |
| 1596 | 1596 | activecpu_adjust_icount(-cycles_to_ready); |
| 1597 | | |
| 1597 | | |
| 1598 | 1598 | } |
| 1599 | 1599 | |
| 1600 | 1600 | tms5220_data_w(offset, data); |
| r1293 | r1294 | |
| 1742 | 1742 | of next message is not requested for either, so we need to decide on |
| 1743 | 1743 | our own when we can post a new event. Currently, we wait for 1000us |
| 1744 | 1744 | after the DSR acknowledges the second nybble. */ |
| 1745 | | |
| 1745 | | |
| 1746 | 1746 | } |
| 1747 | 1747 | |
| 1748 | 1748 | if (handset_buflen == 0) |
| r1293 | r1294 | |
| 1762 | 1762 | handset_ack = data; |
| 1763 | 1763 | if (data == handset_clock) |
| 1764 | 1764 | /* I don't know what the real delay is, but 30us apears to be enough */ |
| 1765 | | |
| 1765 | | |
| 1766 | 1766 | } |
| 1767 | 1767 | } |
| 1768 | 1768 |
| r1293 | r1294 | |
|---|---|---|
| 156 | 156 | UINT8 *gfx = memory_region(REGION_GFX1); |
| 157 | 157 | for (i=0; i<128; i++) gfx[i]=i; |
| 158 | 158 | |
| 159 | | |
| 159 | | |
| 160 | 160 | |
| 161 | 161 | // c600 b800 b000 a000 8000 tested |
| 162 | 162 | // 4 kb memory feedback 512 bytes too few??? |
| r1293 | r1294 | |
|---|---|---|
| 89 | 89 | |
| 90 | 90 | /* internal timers */ |
| 91 | 91 | UINT8 timer_counter[5]; |
| 92 | | |
| 92 | | |
| 93 | 93 | double clock_rate; |
| 94 | 94 | } tms5501_t; |
| 95 | 95 | |
| r1293 | r1294 | |
| 195 | 195 | { |
| 196 | 196 | if (tms5501[which].timer_counter[timer]) |
| 197 | 197 | { /* reset clock interval */ |
| 198 | | |
| 198 | | |
| 199 | 199 | } |
| 200 | 200 | else |
| 201 | 201 | { /* clock interval == 0 -> no timer */ |
| r1293 | r1294 | |
| 207 | 207 | case 3: tms5501_timer_3_decrementer_callback(Machine, which); break; |
| 208 | 208 | case 4: tms5501_timer_4_decrementer_callback(Machine, which); break; |
| 209 | 209 | } |
| 210 | | |
| 210 | | |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| r1293 | r1294 | |
| 223 | 223 | for (i=0; i<5; i++) |
| 224 | 224 | { |
| 225 | 225 | tms5501[which].timer_counter[i] = 0; |
| 226 | | |
| 226 | | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | LOG_TMS5501(which, "Reset", 0); |
| r1293 | r1294 | |
| 232 | 232 | void tms5501_init (int which, const tms5501_init_param *param) |
| 233 | 233 | { |
| 234 | 234 | tms5501[which].clock_rate = param->clock_rate; |
| 235 | tms5501[which].timer[0] = mame_timer_alloc(tms5501_timer_0_decrementer_callback); | |
| 236 | tms5501[which].timer[1] = mame_timer_alloc(tms5501_timer_1_decrementer_callback); | |
| 237 | tms5501[which].timer[2] = mame_timer_alloc(tms5501_timer_2_decrementer_callback); | |
| 238 | tms5501[which].timer[3] = mame_timer_alloc(tms5501_timer_3_decrementer_callback); | |
| 239 | tms5501[which].timer[4] = mame_timer_alloc(tms5501_timer_4_decrementer_callback); | |
| 235 | tms5501[which].timer[0] = timer_alloc(tms5501_timer_0_decrementer_callback); | |
| 236 | tms5501[which].timer[1] = timer_alloc(tms5501_timer_1_decrementer_callback); | |
| 237 | tms5501[which].timer[2] = timer_alloc(tms5501_timer_2_decrementer_callback); | |
| 238 | tms5501[which].timer[3] = timer_alloc(tms5501_timer_3_decrementer_callback); | |
| 239 | tms5501[which].timer[4] = timer_alloc(tms5501_timer_4_decrementer_callback); | |
| 240 | 240 | |
| 241 | 241 | tms5501[which].pio_read_callback = param->pio_read_callback; |
| 242 | 242 | tms5501[which].pio_write_callback = param->pio_write_callback; |
| r1293 | r1294 | |
| 267 | 267 | { |
| 268 | 268 | if (tms5501[which].timer[i]) |
| 269 | 269 | { |
| 270 | | |
| 270 | | |
| 271 | 271 | tms5501[which].timer[i] = NULL; |
| 272 | 272 | } |
| 273 | 273 | } |
| r1293 | r1294 | |
|---|---|---|
| 568 | 568 | nMC_DMAGIO64Addr = 0; |
| 569 | 569 | nMC_DMAMode = 0; |
| 570 | 570 | nMC_DMAZoomByteCnt = 0; |
| 571 | tMC_UpdateTimer = mame_timer_alloc( mc_update ); | |
| 572 | mame_timer_adjust( tMC_UpdateTimer, MAME_TIME_IN_HZ(10000), 0, MAME_TIME_IN_HZ(10000) ); | |
| 571 | tMC_UpdateTimer = timer_alloc( mc_update ); | |
| 572 | timer_adjust( tMC_UpdateTimer, ATTOTIME_IN_HZ(10000), 0, ATTOTIME_IN_HZ(10000) ); | |
| 573 | 573 | |
| 574 | 574 | // if Indigo2, ID appropriately |
| 575 | 575 | if (!strcmp(Machine->gamedrv->name, "ip244415")) |
| r1293 | r1294 | |
|---|---|---|
| 41 | 41 | struct |
| 42 | 42 | { |
| 43 | 43 | int state; |
| 44 | | |
| 44 | | |
| 45 | 45 | int pos; |
| 46 | 46 | struct GameSample *sample; |
| 47 | 47 | mess_image *img; |
| r1293 | r1294 | |
| 51 | 51 | struct |
| 52 | 52 | { |
| 53 | 53 | int state; |
| 54 | mame_timer *prg_timer; | |
| 55 | mame_timer *timer; | |
| 54 | emu_timer *prg_timer; | |
| 55 | emu_timer *timer; | |
| 56 | 56 | int pos; |
| 57 | 57 | |
| 58 | 58 | #define VC20_SHORT (176e-6) |
| r1293 | r1294 | |
| 61 | 61 | #define C16_SHORT (246e-6) /* messured */ |
| 62 | 62 | #define C16_MIDDLE (483e-6) |
| 63 | 63 | #define C16_LONG (965e-6) |
| 64 | #define PCM_SHORT (double_to_mame_time(prg.c16?C16_SHORT:VC20_SHORT)) | |
| 65 | #define PCM_MIDDLE (double_to_mame_time(prg.c16?C16_MIDDLE:VC20_MIDDLE)) | |
| 66 | #define PCM_LONG (double_to_mame_time(prg.c16?C16_LONG:VC20_LONG)) | |
| 64 | #define PCM_SHORT (double_to_attotime(prg.c16?C16_SHORT:VC20_SHORT)) | |
| 65 | #define PCM_MIDDLE (double_to_attotime(prg.c16?C16_MIDDLE:VC20_MIDDLE)) | |
| 66 | #define PCM_LONG (double_to_attotime(prg.c16?C16_LONG:VC20_LONG)) | |
| 67 | 67 | int c16; |
| 68 | 68 | UINT8 *prg; |
| 69 | 69 | int length; |
| r1293 | r1294 | |
| 71 | 71 | int prgdata; |
| 72 | 72 | char name[16]; /*name for cbm */ |
| 73 | 73 | UINT8 chksum; |
| 74 | | |
| 74 | | |
| 75 | 75 | mess_image *img; |
| 76 | 76 | } prg; |
| 77 | 77 | |
| r1293 | r1294 | |
| 233 | 233 | if (tape.motor && tape.play) |
| 234 | 234 | { |
| 235 | 235 | wav.state = 3; |
| 236 | | |
| 236 | | |
| 237 | 237 | break; |
| 238 | 238 | } |
| 239 | 239 | if (tape.motor && tape.record) |
| r1293 | r1294 | |
| 249 | 249 | tape.play = 0; |
| 250 | 250 | tape.record = 0; |
| 251 | 251 | DAC_data_w (0, 0); |
| 252 | | |
| 252 | | |
| 253 | 253 | break; |
| 254 | 254 | } |
| 255 | 255 | if (!tape.motor || !tape.play) |
| 256 | 256 | { |
| 257 | 257 | wav.state = 2; |
| 258 | | |
| 258 | | |
| 259 | 259 | DAC_data_w (0, 0); |
| 260 | 260 | break; |
| 261 | 261 | } |
| r1293 | r1294 | |
| 360 | 360 | if (tape.motor && tape.play) |
| 361 | 361 | { |
| 362 | 362 | prg.state = 3; |
| 363 | | |
| 363 | | |
| 364 | 364 | break; |
| 365 | 365 | } |
| 366 | 366 | if (tape.motor && tape.record) |
| r1293 | r1294 | |
| 376 | 376 | tape.play = 0; |
| 377 | 377 | tape.record = 0; |
| 378 | 378 | DAC_data_w (0, 0); |
| 379 | | |
| 379 | | |
| 380 | 380 | break; |
| 381 | 381 | } |
| 382 | 382 | if (!tape.motor || !tape.play) |
| 383 | 383 | { |
| 384 | 384 | prg.state = 2; |
| 385 | | |
| 385 | | |
| 386 | 386 | DAC_data_w (0, 0); |
| 387 | 387 | break; |
| 388 | 388 | } |
| r1293 | r1294 | |
| 451 | 451 | |
| 452 | 452 | if (old != data) |
| 453 | 453 | { |
| 454 | double neu = | |
| 454 | double neu = | |
| 455 | 455 | int diff = (neu - time) * 1000000; |
| 456 | 456 | |
| 457 | 457 | count++; |
| r1293 | r1294 | |
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | 529 | old = data; |
| 530 | time = | |
| 530 | time = | |
| 531 | 531 | } |
| 532 | 532 | #endif |
| 533 | 533 | if (tape.noise) |
| r1293 | r1294 | |
| 541 | 541 | case 0: |
| 542 | 542 | if (bit) |
| 543 | 543 | { |
| 544 | | |
| 544 | | |
| 545 | 545 | prg.statebit = 2; |
| 546 | 546 | } |
| 547 | 547 | else |
| 548 | 548 | { |
| 549 | 549 | prg.statebit++; |
| 550 | | |
| 550 | | |
| 551 | 551 | } |
| 552 | 552 | break; |
| 553 | 553 | case 1: |
| 554 | | |
| 554 | | |
| 555 | 555 | prg.statebit = 0; |
| 556 | 556 | break; |
| 557 | 557 | case 2: |
| 558 | | |
| 558 | | |
| 559 | 559 | prg.statebit = 0; |
| 560 | 560 | break; |
| 561 | 561 | } |
| r1293 | r1294 | |
| 578 | 578 | switch (prg.statebyte) |
| 579 | 579 | { |
| 580 | 580 | case 0: |
| 581 | | |
| 581 | | |
| 582 | 582 | prg.statebyte++; |
| 583 | 583 | break; |
| 584 | 584 | case 1: |
| 585 | | |
| 585 | | |
| 586 | 586 | prg.statebyte++; |
| 587 | 587 | bit = 1; |
| 588 | 588 | parity = 0; |
| r1293 | r1294 | |
| 684 | 684 | prg.pos = (9 + 192 + 1) * 2 + (9 + prg.length - 2 + 1) * 2; |
| 685 | 685 | i = 0; |
| 686 | 686 | prg.stateblock++; |
| 687 | | |
| 687 | | |
| 688 | 688 | break; |
| 689 | 689 | case 1: |
| 690 | 690 | i++; |
| 691 | 691 | if (i < 12000 /*27136 */ ) |
| 692 | 692 | { /* this time is not so important */ |
| 693 | | |
| 693 | | |
| 694 | 694 | break; |
| 695 | 695 | } |
| 696 | 696 | /* writing countdown $89 ... $80 */ |
| r1293 | r1294 | |
| 709 | 709 | vc20_tape_prgheader (); |
| 710 | 710 | break; |
| 711 | 711 | case 3: |
| 712 | | |
| 712 | | |
| 713 | 713 | prg.stateblock++; |
| 714 | 714 | i = 0; |
| 715 | 715 | break; |
| r1293 | r1294 | |
| 717 | 717 | if (i < 80) |
| 718 | 718 | { |
| 719 | 719 | i++; |
| 720 | | |
| 720 | | |
| 721 | 721 | break; |
| 722 | 722 | } |
| 723 | 723 | /* writing countdown $09 ... $00 */ |
| r1293 | r1294 | |
| 736 | 736 | vc20_tape_prgheader (); |
| 737 | 737 | break; |
| 738 | 738 | case 6: |
| 739 | | |
| 739 | | |
| 740 | 740 | prg.stateblock++; |
| 741 | 741 | i = 0; |
| 742 | 742 | break; |
| r1293 | r1294 | |
| 744 | 744 | if (i < 80) |
| 745 | 745 | { |
| 746 | 746 | i++; |
| 747 | | |
| 747 | | |
| 748 | 748 | break; |
| 749 | 749 | } |
| 750 | 750 | i = 0; |
| 751 | 751 | prg.stateblock++; |
| 752 | | |
| 752 | | |
| 753 | 753 | break; |
| 754 | 754 | case 8: |
| 755 | 755 | if (i < 3000 /*5376 */ ) |
| 756 | 756 | { |
| 757 | 757 | i++; |
| 758 | | |
| 758 | | |
| 759 | 759 | break; |
| 760 | 760 | } |
| 761 | 761 | prg.prgdata = 0x89; |
| r1293 | r1294 | |
| 789 | 789 | prg.stateblock++; |
| 790 | 790 | break; |
| 791 | 791 | case 11: |
| 792 | | |
| 792 | | |
| 793 | 793 | prg.stateblock++; |
| 794 | 794 | i = 0; |
| 795 | 795 | break; |
| r1293 | r1294 | |
| 797 | 797 | if (i < 80) |
| 798 | 798 | { |
| 799 | 799 | i++; |
| 800 | | |
| 800 | | |
| 801 | 801 | break; |
| 802 | 802 | } |
| 803 | 803 | /* writing countdown $09 ... $00 */ |
| r1293 | r1294 | |
| 832 | 832 | prg.stateblock++; |
| 833 | 833 | break; |
| 834 | 834 | case 15: |
| 835 | | |
| 835 | | |
| 836 | 836 | prg.stateblock++; |
| 837 | 837 | i = 0; |
| 838 | 838 | break; |
| r1293 | r1294 | |
| 840 | 840 | if (i < 80) |
| 841 | 841 | { |
| 842 | 842 | i++; |
| 843 | | |
| 843 | | |
| 844 | 844 | break; |
| 845 | 845 | } |
| 846 | 846 | prg.stateblock = 0; |
| r1293 | r1294 | |
| 856 | 856 | if (tape.noise) |
| 857 | 857 | DAC_data_w (0, 0); |
| 858 | 858 | tape.data = 1; |
| 859 | | |
| 859 | | |
| 860 | 860 | } |
| 861 | 861 | else |
| 862 | 862 | { |
| r1293 | r1294 | |
| 902 | 902 | tape.data = 0; |
| 903 | 903 | #endif |
| 904 | 904 | prg.c16 = 0; |
| 905 | wav.timer = mame_timer_alloc(vc20_wav_timer); | |
| 906 | prg.prg_timer = mame_timer_alloc(vc20_prg_timer); | |
| 905 | wav.timer = timer_alloc(vc20_wav_timer); | |
| 906 | prg.prg_timer = timer_alloc(vc20_prg_timer); | |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | void c16_tape_open (void) |
| r1293 | r1294 | |
|---|---|---|
| 1386 | 1386 | static int len2=0; |
| 1387 | 1387 | static int len3=0; |
| 1388 | 1388 | |
| 1389 | ||
| 1389 | ||
| 1390 | 1390 | |
| 1391 | 1391 | static TIMER_CALLBACK(bbc_tape_timer_cb) |
| 1392 | 1392 | { |
| r1293 | r1294 | |
| 1453 | 1453 | if (status) |
| 1454 | 1454 | { |
| 1455 | 1455 | cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0),CASSETTE_MOTOR_ENABLED ,CASSETTE_MASK_MOTOR); |
| 1456 | | |
| 1456 | | |
| 1457 | 1457 | } else { |
| 1458 | 1458 | cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); |
| 1459 | | |
| 1459 | | |
| 1460 | 1460 | MC6850_Reset(wav_len); |
| 1461 | 1461 | len0=0; |
| 1462 | 1462 | len1=0; |
| r1293 | r1294 | |
| 2091 | 2091 | DRIVER_INIT( bbc ) |
| 2092 | 2092 | { |
| 2093 | 2093 | bbc_Master=0; |
| 2094 | bbc_tape_timer = | |
| 2094 | bbc_tape_timer = | |
| 2095 | 2095 | } |
| 2096 | 2096 | DRIVER_INIT( bbcm ) |
| 2097 | 2097 | { |
| 2098 | 2098 | bbc_Master=1; |
| 2099 | bbc_tape_timer = | |
| 2099 | bbc_tape_timer = | |
| 2100 | 2100 | mc146818_init(MC146818_STANDARD); |
| 2101 | 2101 | } |
| 2102 | 2102 |
| r1293 | r1294 | |
|---|---|---|
| 53 | 53 | UINT16 maxA; |
| 54 | 54 | UINT16 maxB; |
| 55 | 55 | UINT16 count; |
| 56 | mame_timer * int_timer; | |
| 57 | mame_timer * time_timer; | |
| 56 | emu_timer * int_timer; | |
| 57 | emu_timer * time_timer; | |
| 58 | 58 | UINT8 time_timer_active; |
| 59 | | |
| 59 | | |
| 60 | 60 | }; |
| 61 | 61 | |
| 62 | 62 | struct dma_state |
| r1293 | r1294 | |
| 66 | 66 | UINT16 count; |
| 67 | 67 | UINT16 control; |
| 68 | 68 | UINT8 finished; |
| 69 | | |
| 69 | | |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | 72 | struct intr_state |
| r1293 | r1294 | |
| 567 | 567 | static int int_callback(int line) |
| 568 | 568 | { |
| 569 | 569 | if (LOG_INTERRUPTS) |
| 570 | logerror("(%f) **** Acknowledged interrupt vector %02X\n", | |
| 570 | logerror("(%f) **** Acknowledged interrupt vector %02X\n", | |
| 571 | 571 | |
| 572 | 572 | /* clear the interrupt */ |
| 573 | 573 | activecpu_set_input_line(0, CLEAR_LINE); |
| r1293 | r1294 | |
| 682 | 682 | i186.intr.pending = 1; |
| 683 | 683 | cpu_trigger(CPU_RESUME_TRIGGER); |
| 684 | 684 | if (LOG_OPTIMIZATION) logerror(" - trigger due to interrupt pending\n"); |
| 685 | if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", | |
| 685 | if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", | |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | |
| r1293 | r1294 | |
| 707 | 707 | case 0x0f: i186.intr.in_service &= ~0x80; break; |
| 708 | 708 | default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", activecpu_get_pc(), data & 0x1f); |
| 709 | 709 | } |
| 710 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", | |
| 710 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", | |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | /* non-specific case */ |
| r1293 | r1294 | |
| 720 | 720 | if ((i186.intr.timer & 7) == i && (i186.intr.in_service & 0x01)) |
| 721 | 721 | { |
| 722 | 722 | i186.intr.in_service &= ~0x01; |
| 723 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", | |
| 723 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", | |
| 724 | 724 | return; |
| 725 | 725 | } |
| 726 | 726 | |
| r1293 | r1294 | |
| 729 | 729 | if ((i186.intr.dma[j] & 7) == i && (i186.intr.in_service & (0x04 << j))) |
| 730 | 730 | { |
| 731 | 731 | i186.intr.in_service &= ~(0x04 << j); |
| 732 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", | |
| 732 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", | |
| 733 | 733 | return; |
| 734 | 734 | } |
| 735 | 735 | |
| r1293 | r1294 | |
| 738 | 738 | if ((i186.intr.ext[j] & 7) == i && (i186.intr.in_service & (0x10 << j))) |
| 739 | 739 | { |
| 740 | 740 | i186.intr.in_service &= ~(0x10 << j); |
| 741 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", | |
| 741 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", | |
| 742 | 742 | return; |
| 743 | 743 | } |
| 744 | 744 | } |
| r1293 | r1294 | |
| 774 | 774 | if (t->control & 0x0001) |
| 775 | 775 | { |
| 776 | 776 | int count = t->maxA ? t->maxA : 0x10000; |
| 777 | | |
| 777 | | |
| 778 | 778 | if (LOG_TIMER) logerror(" Repriming interrupt\n"); |
| 779 | 779 | } |
| 780 | 780 | else |
| 781 | | |
| 781 | | |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | |
| r1293 | r1294 | |
| 789 | 789 | /* if we have a timing timer running, adjust the count */ |
| 790 | 790 | if (t->time_timer_active) |
| 791 | 791 | { |
| 792 | mame_time current_time = mame_timer_timeelapsed(t->time_timer); | |
| 793 | int net_clocks = scale_up_mame_time(sub_mame_times(current_time, t->last_time), 2000000).seconds; | |
| 792 | attotime current_time = timer_timeelapsed(t->time_timer); | |
| 793 | int net_clocks = attotime_mul(attotime_sub(current_time, t->last_time), 2000000).seconds; | |
| 794 | 794 | t->last_time = current_time; |
| 795 | 795 | |
| 796 | 796 | /* set the max count bit if we passed the max */ |
| r1293 | r1294 | |
| 889 | 889 | internal_timer_sync(which); |
| 890 | 890 | |
| 891 | 891 | /* nuke the timer and force the interrupt timer to be recomputed */ |
| 892 | | |
| 892 | | |
| 893 | 893 | t->time_timer_active = 0; |
| 894 | 894 | update_int_timer = 1; |
| 895 | 895 | } |
| r1293 | r1294 | |
| 898 | 898 | else if ((diff & 0x8000) && (new_control & 0x8000)) |
| 899 | 899 | { |
| 900 | 900 | /* start the timing */ |
| 901 | | |
| 901 | | |
| 902 | 902 | t->time_timer_active = 1; |
| 903 | 903 | update_int_timer = 1; |
| 904 | 904 | } |
| r1293 | r1294 | |
| 923 | 923 | int diff = t->maxA - t->count; |
| 924 | 924 | if (diff <= 0) |
| 925 | 925 | diff += 0x10000; |
| 926 | | |
| 926 | | |
| 927 | 927 | if (LOG_TIMER) logerror("Set interrupt timer for %d\n", which); |
| 928 | 928 | } |
| 929 | 929 | else |
| 930 | 930 | { |
| 931 | | |
| 931 | | |
| 932 | 932 | } |
| 933 | 933 | } |
| 934 | 934 | } |
| r1293 | r1294 | |
| 1010 | 1010 | if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest); |
| 1011 | 1011 | |
| 1012 | 1012 | d->finished = 0; |
| 1013 | /* mame_timer_adjust(d->finish_timer, | |
| 1014 | MAME_TIME_IN_HZ(dac[dacnum].frequency) * (double)count, which, 0);*/ | |
| 1013 | /* timer_adjust(d->finish_timer, | |
| 1014 | ATTOTIME_IN_HZ(dac[dacnum].frequency) * (double)count, which, 0);*/ | |
| 1015 | 1015 | } |
| 1016 | 1016 | } |
| 1017 | 1017 | |
| r1293 | r1294 | |
| 1519 | 1519 | void compis_cpu_init(void) |
| 1520 | 1520 | { |
| 1521 | 1521 | /* create timers here so they stick around */ |
| 1522 | i186.timer[0].int_timer = mame_timer_alloc(internal_timer_int); | |
| 1523 | i186.timer[1].int_timer = mame_timer_alloc(internal_timer_int); | |
| 1524 | i186.timer[2].int_timer = mame_timer_alloc(internal_timer_int); | |
| 1525 | i186.timer[0].time_timer = mame_timer_alloc(NULL); | |
| 1526 | i186.timer[1].time_timer = mame_timer_alloc(NULL); | |
| 1527 | i186.timer[2].time_timer = mame_timer_alloc(NULL); | |
| 1528 | i186.dma[0].finish_timer = mame_timer_alloc(dma_timer_callback); | |
| 1529 | i186.dma[1].finish_timer = mame_timer_alloc(dma_timer_callback); | |
| 1522 | i186.timer[0].int_timer = timer_alloc(internal_timer_int); | |
| 1523 | i186.timer[1].int_timer = timer_alloc(internal_timer_int); | |
| 1524 | i186.timer[2].int_timer = timer_alloc(internal_timer_int); | |
| 1525 | i186.timer[0].time_timer = timer_alloc(NULL); | |
| 1526 | i186.timer[1].time_timer = timer_alloc(NULL); | |
| 1527 | i186.timer[2].time_timer = timer_alloc(NULL); | |
| 1528 | i186.dma[0].finish_timer = timer_alloc(dma_timer_callback); | |
| 1529 | i186.dma[1].finish_timer = timer_alloc(dma_timer_callback); | |
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | /*-------------------------------------------------------------------------*/ |
| r1293 | r1294 | |
|---|---|---|
| 231 | 231 | |
| 232 | 232 | static void kc_disc_interface_init(void) |
| 233 | 233 | { |
| 234 | | |
| 234 | | |
| 235 | 235 | |
| 236 | 236 | nec765_init(&kc_fdc_interface,NEC765A); |
| 237 | 237 | |
| r1293 | r1294 | |
| 382 | 382 | */ |
| 383 | 383 | |
| 384 | 384 | |
| 385 | #define KC_CASSETTE_TIMER_FREQUENCY | |
| 385 | #define KC_CASSETTE_TIMER_FREQUENCY | |
| 386 | 386 | |
| 387 | 387 | /* this timer is used to update the cassette */ |
| 388 | static | |
| 388 | static | |
| 389 | 389 | /* this is the current state of the cassette motor */ |
| 390 | 390 | static int kc_cassette_motor_state; |
| 391 | 391 | /* ardy output from pio */ |
| r1293 | r1294 | |
| 410 | 410 | |
| 411 | 411 | static void kc_cassette_init(void) |
| 412 | 412 | { |
| 413 | kc_cassette_timer = | |
| 413 | kc_cassette_timer = | |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | static void kc_cassette_set_motor(int motor_state) |
| r1293 | r1294 | |
| 426 | 426 | if (motor_state) |
| 427 | 427 | { |
| 428 | 428 | /* start timer */ |
| 429 | | |
| 429 | | |
| 430 | 430 | } |
| 431 | 431 | else |
| 432 | 432 | { |
| 433 | 433 | /* stop timer */ |
| 434 | | |
| 434 | | |
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | |
| r1293 | r1294 | |
| 902 | 902 | keyboard_data.head = (keyboard_data.tail = 0); |
| 903 | 903 | |
| 904 | 904 | /* 50hz is just a arbitrary value - used to put scan-codes into the queue for transmitting */ |
| 905 | | |
| 905 | | |
| 906 | 906 | |
| 907 | 907 | /* timer to transmit pulses to kc base unit */ |
| 908 | | |
| 908 | | |
| 909 | 909 | |
| 910 | 910 | /* kc keyboard is not transmitting */ |
| 911 | 911 | keyboard_data.transmit_state = KC_KEYBOARD_TRANSMIT_IDLE; |
| r1293 | r1294 | |
| 1891 | 1891 | kc85_50hz_state = 0; |
| 1892 | 1892 | kc85_15khz_state = 0; |
| 1893 | 1893 | kc85_15khz_count = 0; |
| 1894 | mame_timer_pulse(MAME_TIME_IN_HZ(15625), 0, kc85_15khz_timer_callback); | |
| 1895 | mame_timer_set(time_zero, 0, kc85_reset_timer_callback); | |
| 1894 | timer_pulse(ATTOTIME_IN_HZ(15625), 0, kc85_15khz_timer_callback); | |
| 1895 | timer_set(attotime_zero, 0, kc85_reset_timer_callback); | |
| 1896 | 1896 | kc85_module_system_init(); |
| 1897 | 1897 | } |
| 1898 | 1898 |
| r1293 | r1294 | |
|---|---|---|
| 108 | 108 | // Timing-related values |
| 109 | 109 | UINT16 last_cylinder; // Last cylinder accessed - for calculating seek times |
| 110 | 110 | UINT32 delay; // Delay in microseconds for callback |
| 111 | | |
| 111 | | |
| 112 | 112 | |
| 113 | 113 | // |
| 114 | 114 | // Union below represents both an input and output buffer and interpretations of it |
| r1293 | r1294 | |
| 1391 | 1391 | // |
| 1392 | 1392 | // Set up timers for command completion and timeout from host |
| 1393 | 1393 | // |
| 1394 | mame_timer_set(MAME_TIME_IN_USEC(c->delay), CALLBACK_CTH_MODE, corvus_hdc_callback); | |
| 1395 | mame_timer_enable(c->timeout_timer, 0); // We've received enough data, disable the timeout timer | |
| 1394 | timer_set(ATTOTIME_IN_USEC(c->delay), CALLBACK_CTH_MODE, corvus_hdc_callback); | |
| 1395 | timer_enable(c->timeout_timer, 0); // We've received enough data, disable the timeout timer | |
| 1396 | 1396 | |
| 1397 | 1397 | c->delay = 0; // Reset delay for next function |
| 1398 | 1398 | } |
| r1293 | r1294 | |
| 1458 | 1458 | assert(0); |
| 1459 | 1459 | } |
| 1460 | 1460 | if(function != CALLBACK_SAME_MODE) { |
| 1461 | | |
| 1461 | | |
| 1462 | 1462 | } |
| 1463 | 1463 | } |
| 1464 | 1464 | |
| r1293 | r1294 | |
| 1496 | 1496 | c->xmit_bytes = 0; // We don't have anything to say to the host |
| 1497 | 1497 | c->recv_bytes = 0; // We aren't waiting on additional data from the host |
| 1498 | 1498 | |
| 1499 | c->timeout_timer = mame_timer_alloc(corvus_hdc_callback); // Set up a timer to handle the four-second host-to-controller timeout | |
| 1500 | mame_timer_adjust(c->timeout_timer, MAME_TIME_IN_SEC(4), CALLBACK_TIMEOUT, time_zero); | |
| 1501 | mame_timer_enable(c->timeout_timer, 0); // Start this timer out disabled | |
| 1499 | c->timeout_timer = timer_alloc(corvus_hdc_callback); // Set up a timer to handle the four-second host-to-controller timeout | |
| 1500 | timer_adjust(c->timeout_timer, ATTOTIME_IN_SEC(4), CALLBACK_TIMEOUT, attotime_zero); | |
| 1501 | timer_enable(c->timeout_timer, 0); // Start this timer out disabled | |
| 1502 | 1502 | |
| 1503 | 1503 | #if VERBOSE |
| 1504 | 1504 | logerror("corvus_hdc_init: Attached to drive image: H:%d, C:%d, S:%d\n", info->heads, info->cylinders, info->sectors); |
| r1293 | r1294 | |
| 1670 | 1670 | c->xmit_bytes = 0; // We don't have anything more to say |
| 1671 | 1671 | c->recv_bytes = 0; // No active commands |
| 1672 | 1672 | |
| 1673 | | |
| 1673 | | |
| 1674 | 1674 | |
| 1675 | 1675 | // c->status &= ~(CONTROLLER_DIRECTION | CONTROLLER_BUSY); // Put us in Idle, Host-to-Controller mode |
| 1676 | 1676 | } else { |
| 1677 | 1677 | // |
| 1678 | 1678 | // Not finished with this packet. Insert an interbyte delay and then let the host continue |
| 1679 | 1679 | // |
| 1680 | | |
| 1680 | | |
| 1681 | 1681 | } |
| 1682 | 1682 | |
| 1683 | 1683 | return result; |
| r1293 | r1294 | |
| 1724 | 1724 | logerror("corvus_hdc_data_w: Received a byte with c->offset == 0. Processing as command: 0x%2.2x\n", data); |
| 1725 | 1725 | #endif |
| 1726 | 1726 | invalid_command_flag = parse_hdc_command(data); |
| 1727 | mame_timer_reset(c->timeout_timer, (MAME_TIME_IN_SEC(4))); | |
| 1728 | mame_timer_enable(c->timeout_timer, 1); // Start our four-second timer | |
| 1727 | timer_reset(c->timeout_timer, (ATTOTIME_IN_SEC(4))); | |
| 1728 | timer_enable(c->timeout_timer, 1); // Start our four-second timer | |
| 1729 | 1729 | } else if(c->offset == 1 && c->awaiting_modifier) { // Second byte of a packet |
| 1730 | 1730 | #if VERBOSE |
| 1731 | 1731 | logerror("corvus_hdc_data_w: Received a byte while awaiting modifier with c->offset == 0. Processing as modifier: 0x%2.2x\n", data); |
| r1293 | r1294 | |
| 1750 | 1750 | // |
| 1751 | 1751 | // Reset the four-second timer since we received some data |
| 1752 | 1752 | // |
| 1753 | | |
| 1753 | | |
| 1754 | 1754 | |
| 1755 | 1755 | // |
| 1756 | 1756 | // Make the controller busy for a few microseconds while the command is processed |
| 1757 | 1757 | // |
| 1758 | 1758 | c->status |= CONTROLLER_BUSY; |
| 1759 | | |
| 1759 | | |
| 1760 | 1760 | } |
| 1761 | 1761 | } |
| r1293 | r1294 | |
|---|---|---|
| 7 | 7 | |
| 8 | 8 | #if VERBOSE |
| 9 | 9 | #define LOG(N,M,A) \ |
| 10 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 10 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 11 | 11 | #else |
| 12 | 12 | #define LOG(N,M,A) |
| 13 | 13 | #endif |
| r1293 | r1294 | |
|---|---|---|
| 225 | 225 | physical_track = 0; |
| 226 | 226 | if ( physical_track >= 80 ) |
| 227 | 227 | physical_track = 79; |
| 228 | LOG(( "%f thom_floppy_seek: dev=%li track=%i\n", | |
| 228 | LOG(( "%f thom_floppy_seek: dev=%li track=%i\n", | |
| 229 | 229 | d->cur_track = physical_track; |
| 230 | 230 | } |
| 231 | 231 |
| r1293 | r1294 | |
|---|---|---|
| 117 | 117 | if ( bitpos >= to7_k7_bitsize ) |
| 118 | 118 | bitpos = to7_k7_bitsize -1; |
| 119 | 119 | VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n", |
| 120 | activecpu_get_previouspc(), | |
| 120 | activecpu_get_previouspc(), | |
| 121 | 121 | to7_k7_bits[ bitpos ] )); |
| 122 | 122 | return to7_k7_bits[ bitpos ]; |
| 123 | 123 | } |
| r1293 | r1294 | |
| 138 | 138 | } |
| 139 | 139 | k = ( chg >= 13 ) ? 1 : 0; |
| 140 | 140 | VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n", |
| 141 | activecpu_get_previouspc(), | |
| 141 | activecpu_get_previouspc(), | |
| 142 | 142 | k, chg )); |
| 143 | 143 | return k; |
| 144 | 144 | } |
| r1293 | r1294 | |
| 166 | 166 | double pos = cassette_get_position(img); |
| 167 | 167 | |
| 168 | 168 | LOG (( "$%04x %f to7_set_cassette_motor: cassette motor %s bitpos=%i\n", |
| 169 | activecpu_get_previouspc(), | |
| 169 | activecpu_get_previouspc(), | |
| 170 | 170 | (int) (pos / TO7_BIT_LENGTH) )); |
| 171 | 171 | |
| 172 | 172 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) |
| r1293 | r1294 | |
| 216 | 216 | hbit = hbit >= 0; |
| 217 | 217 | |
| 218 | 218 | VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n", |
| 219 | activecpu_get_previouspc(), | |
| 219 | activecpu_get_previouspc(), | |
| 220 | 220 | (int) (pos / MO5_HBIT_LENGTH), hbit )); |
| 221 | 221 | return hbit; |
| 222 | 222 | } |
| r1293 | r1294 | |
| 241 | 241 | double pos = cassette_get_position(img); |
| 242 | 242 | |
| 243 | 243 | LOG (( "$%04x %f mo5_set_cassette_motor: cassette motor %s hbitpos=%i\n", |
| 244 | activecpu_get_previouspc(), | |
| 244 | activecpu_get_previouspc(), | |
| 245 | 245 | (int) (pos / MO5_HBIT_LENGTH) )); |
| 246 | 246 | |
| 247 | 247 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) |
| r1293 | r1294 | |
|---|---|---|
| 86 | 86 | #CPUS += TMS32025 |
| 87 | 87 | #CPUS += TMS32026 |
| 88 | 88 | #CPUS += TMS32031 |
| 89 | #CPUS += TMS32032 | |
| 89 | 90 | #CPUS += TMS32051 |
| 90 | 91 | #CPUS += CCPU |
| 91 | 92 | #CPUS += ADSP2100 |
| r1293 | r1294 | |
|---|---|---|
| 278 | 278 | // turn on power led |
| 279 | 279 | set_led_status(0, 1); |
| 280 | 280 | |
| 281 | | |
| 281 | | |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /* System Drivers */ |
| r1293 | r1294 | |
|---|---|---|
| 401 | 401 | MDRV_CPU_PROGRAM_MAP(zx80_map, 0) |
| 402 | 402 | MDRV_CPU_IO_MAP(zx80_io_map, 0) |
| 403 | 403 | MDRV_SCREEN_REFRESH_RATE(ZX81_PAL_FRAMES_PER_SECOND) |
| 404 | MDRV_SCREEN_VBLANK_TIME( | |
| 404 | MDRV_SCREEN_VBLANK_TIME(A | |
| 405 | 405 | |
| 406 | 406 | MDRV_MACHINE_RESET(zx80) |
| 407 | 407 |
| r1293 | r1294 | |
|---|---|---|
| 333 | 333 | MDRV_CPU_PROGRAM_MAP(dgnbeta_map,0) |
| 334 | 334 | |
| 335 | 335 | MDRV_SCREEN_REFRESH_RATE(DGNBETA_FRAMES_PER_SECOND) |
| 336 | MDRV_SCREEN_VBLANK_TIME( | |
| 336 | MDRV_SCREEN_VBLANK_TIME(A | |
| 337 | 337 | |
| 338 | 338 | MDRV_MACHINE_START( dgnbeta ) |
| 339 | 339 |
| r1293 | r1294 | |
|---|---|---|
| 74 | 74 | MDRV_CPU_ADD_TAG("main", M68000, 7833600) /* 7.8336 Mhz */ |
| 75 | 75 | MDRV_CPU_PROGRAM_MAP(mac512ke_map, 0) |
| 76 | 76 | MDRV_SCREEN_REFRESH_RATE(60.15) |
| 77 | MDRV_SCREEN_VBLANK_TIME( | |
| 77 | MDRV_SCREEN_VBLANK_TIME(A | |
| 78 | 78 | MDRV_INTERLEAVE(1) |
| 79 | 79 | |
| 80 | 80 | MDRV_MACHINE_RESET( mac ) |
| r1293 | r1294 | |
|---|---|---|
| 705 | 705 | static MACHINE_DRIVER_START( atari_common_nodac ) |
| 706 | 706 | /* basic machine hardware */ |
| 707 | 707 | MDRV_CPU_ADD_TAG("main", M6510, FREQ_17_EXACT) |
| 708 | MDRV_SCREEN_VBLANK_TIME( | |
| 708 | MDRV_SCREEN_VBLANK_TIME(A | |
| 709 | 709 | |
| 710 | 710 | /* video hardware */ |
| 711 | 711 | MDRV_VIDEO_ATTRIBUTES( VIDEO_TYPE_RASTER ) |
| r1293 | r1294 | |
|---|---|---|
| 114 | 114 | |
| 115 | 115 | /* the serial clock is generated by the nc hardware and connected to the msm8251 |
| 116 | 116 | receive clock and transmit clock inputs */ |
| 117 | static | |
| 117 | static | |
| 118 | 118 | |
| 119 | 119 | static void nc_printer_update(int); |
| 120 | 120 | |
| r1293 | r1294 | |
| 122 | 122 | |
| 123 | 123 | static char nc_memory_config[4]; |
| 124 | 124 | unsigned long nc_display_memory_start; |
| 125 | static | |
| 125 | static | |
| 126 | 126 | |
| 127 | 127 | static int nc_membank_rom_mask; |
| 128 | 128 | static int nc_membank_internal_ram_mask; |
| r1293 | r1294 | |
| 324 | 324 | nc_update_interrupts(); |
| 325 | 325 | |
| 326 | 326 | /* don't trigger again, but don't free it */ |
| 327 | | |
| 327 | | |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | |
| r1293 | r1294 | |
| 600 | 600 | nc_update_interrupts(); |
| 601 | 601 | |
| 602 | 602 | /* keyboard timer */ |
| 603 | nc_keyboard_timer = mame_timer_alloc(nc_keyboard_timer_callback); | |
| 604 | mame_timer_adjust(nc_keyboard_timer, MAME_TIME_IN_MSEC(10), 0, time_zero); | |
| 603 | nc_keyboard_timer = timer_alloc(nc_keyboard_timer_callback); | |
| 604 | timer_adjust(nc_keyboard_timer, ATTOTIME_IN_MSEC(10), 0, attotime_zero); | |
| 605 | 605 | |
| 606 | 606 | /* dummy timer */ |
| 607 | | |
| 607 | | |
| 608 | 608 | |
| 609 | 609 | /* serial timer */ |
| 610 | nc_serial_timer = | |
| 610 | nc_serial_timer = | |
| 611 | 611 | |
| 612 | 612 | /* at reset set to 0x0ff */ |
| 613 | 613 | nc_uart_control = 0x0ff; |
| r1293 | r1294 | |
| 665 | 665 | if ((data & (1<<3))!=0) |
| 666 | 666 | { |
| 667 | 667 | /* set timer to occur again */ |
| 668 | | |
| 668 | | |
| 669 | 669 | |
| 670 | 670 | nc_update_interrupts(); |
| 671 | 671 | } |
| r1293 | r1294 | |
| 682 | 682 | ) |
| 683 | 683 | { |
| 684 | 684 | /* set timer to occur again */ |
| 685 | | |
| 685 | | |
| 686 | 686 | } |
| 687 | 687 | #endif |
| 688 | 688 | nc_irq_status &=~data; |
| r1293 | r1294 | |
| 704 | 704 | nc_irq_status &= ~(1<<3); |
| 705 | 705 | |
| 706 | 706 | /* set timer to occur again */ |
| 707 | | |
| 707 | | |
| 708 | 708 | |
| 709 | 709 | nc_update_interrupts(); |
| 710 | 710 | } |
| r1293 | r1294 | |
| 815 | 815 | } |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | | |
| 818 | | |
| 819 | 819 | |
| 820 | 820 | nc_uart_control = data; |
| 821 | 821 | } |
| r1293 | r1294 | |
|---|---|---|
| 617 | 617 | clear_keyboard_buffer(); |
| 618 | 618 | |
| 619 | 619 | memset(&memory_region(REGION_CPU1)[0x0000], 0xFF, 0x20000); /* Initializing RAM */ |
| 620 | | |
| 620 | | |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | static MACHINE_DRIVER_START( adam ) |
| r1293 | r1294 | |
|---|---|---|
| 287 | 287 | // the number of cycles in each scanline for the PPU scanline timer. Since the PPU has 20 vblank scanlines + 2 |
| 288 | 288 | // non-rendering scanlines, we compensate. This ends up being 2500 cycles for the non-rendering portion, 2273 |
| 289 | 289 | // cycles for the actual vblank period. |
| 290 | MDRV_SCREEN_VBLANK_TIME( | |
| 290 | MDRV_SCREEN_VBLANK_TIME(A | |
| 291 | 291 | |
| 292 | 292 | MDRV_MACHINE_START( nes ) |
| 293 | 293 | |
| r1293 | r1294 | |
| 315 | 315 | /* basic machine hardware */ |
| 316 | 316 | MDRV_CPU_REPLACE("main", N2A03, PAL_CLOCK) |
| 317 | 317 | MDRV_SCREEN_REFRESH_RATE(53.355) |
| 318 | MDRV_SCREEN_VBLANK_TIME( | |
| 318 | MDRV_SCREEN_VBLANK_TIME(A | |
| 319 | 319 | |
| 320 | 320 | MDRV_VIDEO_START(nes_pal) |
| 321 | 321 |
| r1293 | r1294 | |
|---|---|---|
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | static MACHINE_START( mk1 ) { |
| 161 | | |
| 161 | | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | static MACHINE_DRIVER_START( mk1 ) |
| r1293 | r1294 | |
|---|---|---|
| 278 | 278 | { |
| 279 | 279 | memset(mess_ram, 0x0ff, mess_ram_size); |
| 280 | 280 | |
| 281 | | |
| 281 | | |
| 282 | 282 | |
| 283 | 283 | blink_reset(); |
| 284 | 284 |
| r1293 | r1294 | |
|---|---|---|
| 1351 | 1351 | pcw16_interrupt_counter = 0; |
| 1352 | 1352 | |
| 1353 | 1353 | /* video ints */ |
| 1354 | | |
| 1354 | | |
| 1355 | 1355 | /* rtc timer */ |
| 1356 | | |
| 1356 | | |
| 1357 | 1357 | /* keyboard timer */ |
| 1358 | | |
| 1358 | | |
| 1359 | 1359 | |
| 1360 | 1360 | |
| 1361 | 1361 | pc_fdc_init(&pcw16_fdc_interface); |
| r1293 | r1294 | |
|---|---|---|
| 509 | 509 | key_selector=0; |
| 510 | 510 | irq_flag=0; |
| 511 | 511 | lcd_shift_counter=3; |
| 512 | | |
| 512 | | |
| 513 | 513 | beep_set_frequency(0, 44); |
| 514 | 514 | } |
| 515 | 515 | |
| r1293 | r1294 | |
| 518 | 518 | { |
| 519 | 519 | lcd_shift_counter=3; |
| 520 | 520 | |
| 521 | | |
| 521 | | |
| 522 | 522 | beep_set_frequency(0, 44); |
| 523 | 523 | } |
| 524 | 524 |
| r1293 | r1294 | |
|---|---|---|
| 74 | 74 | |
| 75 | 75 | #if VERBOSE |
| 76 | 76 | #define LOG(N,M,A) \ |
| 77 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 77 | if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s", | |
| 78 | 78 | #else |
| 79 | 79 | #define LOG(N,M,A) |
| 80 | 80 | #endif |
| r1293 | r1294 | |
|---|---|---|
| 53 | 53 | static int segment; |
| 54 | 54 | |
| 55 | 55 | static void *displayena_timer; |
| 56 | #define displayena_duration | |
| 56 | #define displayena_duration | |
| 57 | 57 | static UINT8 segment_state[10]; |
| 58 | 58 | static UINT8 old_segment_state[10]; |
| 59 | 59 | static UINT8 LED_state; |
| r1293 | r1294 | |
| 185 | 185 | |
| 186 | 186 | static mess_image *rs232_fp; |
| 187 | 187 | static UINT8 rs232_rts; |
| 188 | static | |
| 188 | static | |
| 189 | 189 | |
| 190 | 190 | static MACHINE_RESET( tm990_189 ) |
| 191 | 191 | { |
| 192 | displayena_timer = | |
| 192 | displayena_timer = | |
| 193 | 193 | |
| 194 | 194 | hold_load(); |
| 195 | 195 | |
| r1293 | r1294 | |
| 216 | 216 | |
| 217 | 217 | static MACHINE_RESET( tm990_189_v ) |
| 218 | 218 | { |
| 219 | displayena_timer = | |
| 219 | displayena_timer = | |
| 220 | 220 | |
| 221 | joy1x_timer = mame_timer_alloc(NULL); | |
| 222 | joy1y_timer = mame_timer_alloc(NULL); | |
| 223 | joy2x_timer = mame_timer_alloc(NULL); | |
| 224 | joy2y_timer = mame_timer_alloc(NULL); | |
| 221 | joy1x_timer = timer_alloc(NULL); | |
| 222 | joy1y_timer = timer_alloc(NULL); | |
| 223 | joy2x_timer = timer_alloc(NULL); | |
| 224 | joy2y_timer = timer_alloc(NULL); | |
| 225 | 225 | |
| 226 | 226 | hold_load(); |
| 227 | 227 | |
| r1293 | r1294 | |
| 357 | 357 | { |
| 358 | 358 | load_state = TRUE; |
| 359 | 359 | field_interrupts(); |
| 360 | | |
| 360 | | |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /* |
| r1293 | r1294 | |
| 417 | 417 | else |
| 418 | 418 | { |
| 419 | 419 | segment &= ~ (1 << (offset-4)); |
| 420 | if (( | |
| 420 | if (( | |
| 421 | 421 | draw_digit(); |
| 422 | 422 | } |
| 423 | 423 | } |
| r1293 | r1294 | |
| 426 | 426 | { |
| 427 | 427 | if ((!data) && (digitsel < 10)) |
| 428 | 428 | { |
| 429 | | |
| 429 | | |
| 430 | 430 | draw_digit(); |
| 431 | 431 | } |
| 432 | 432 | } |
| r1293 | r1294 | |
| 477 | 477 | rs232_fp = image; |
| 478 | 478 | |
| 479 | 479 | tms9902_set_dsr(id, 1); |
| 480 | rs232_input_timer = mame_timer_alloc(rs232_input_callback); | |
| 481 | mame_timer_adjust(rs232_input_timer, time_zero, 0, MAME_TIME_IN_MSEC(10)); | |
| 480 | rs232_input_timer = timer_alloc(rs232_input_callback); | |
| 481 | timer_adjust(rs232_input_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(10)); | |
| 482 | 482 | |
| 483 | 483 | return INIT_PASS; |
| 484 | 484 | } |
| r1293 | r1294 | |
| 497 | 497 | |
| 498 | 498 | tms9902_set_dsr(id, 0); |
| 499 | 499 | |
| 500 | | |
| 500 | | |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | static void rts_callback(int which, int RTS) |
| r1293 | r1294 | |
| 615 | 615 | int reply = readinputport(9); |
| 616 | 616 | |
| 617 | 617 | |
| 618 | if ( | |
| 618 | if ( | |
| 619 | 619 | reply |= 0x01; |
| 620 | 620 | |
| 621 | if ( | |
| 621 | if ( | |
| 622 | 622 | reply |= 0x02; |
| 623 | 623 | |
| 624 | if ( | |
| 624 | if ( | |
| 625 | 625 | reply |= 0x08; |
| 626 | 626 | |
| 627 | if ( | |
| 627 | if ( | |
| 628 | 628 | reply |= 0x10; |
| 629 | 629 | |
| 630 | 630 | return reply; |
| r1293 | r1294 | |
| 632 | 632 | |
| 633 | 633 | static WRITE8_HANDLER(video_joy_w) |
| 634 | 634 | { |
| 635 | mame_timer_reset(joy1x_timer, MAME_TIME_IN_USEC(readinputport(10)*28+28)); | |
| 636 | mame_timer_reset(joy1y_timer, MAME_TIME_IN_USEC(readinputport(11)*28+28)); | |
| 637 | mame_timer_reset(joy2x_timer, MAME_TIME_IN_USEC(readinputport(12)*28+28)); | |
| 638 | mame_timer_reset(joy2y_timer, MAME_TIME_IN_USEC(readinputport(13)*28+28)); | |
| 635 | timer_reset(joy1x_timer, ATTOTIME_IN_USEC(readinputport(10)*28+28)); | |
| 636 | timer_reset(joy1y_timer, ATTOTIME_IN_USEC(readinputport(11)*28+28)); | |
| 637 | timer_reset(joy2x_timer, ATTOTIME_IN_USEC(readinputport(12)*28+28)); | |
| 638 | timer_reset(joy2y_timer, ATTOTIME_IN_USEC(readinputport(13)*28+28)); | |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 |
| r1293 | r1294 | |
|---|---|---|
| 82 | 82 | #include "machine/abcbus.h" |
| 83 | 83 | #include "video/abc80.h" |
| 84 | 84 | |
| 85 | static | |
| 85 | static | |
| 86 | 86 | |
| 87 | 87 | /* Read/Write Handlers */ |
| 88 | 88 | |
| r1293 | r1294 | |
| 441 | 441 | { |
| 442 | 442 | state_save_register_global(keylatch); |
| 443 | 443 | |
| 444 | abc80_keyboard_timer = mame_timer_alloc(abc80_keyboard_tick); | |
| 445 | mame_timer_adjust(abc80_keyboard_timer, time_zero, 0, MAME_TIME_IN_USEC(2500)); | |
| 444 | abc80_keyboard_timer = timer_alloc(abc80_keyboard_tick); | |
| 445 | timer_adjust(abc80_keyboard_timer, attotime_zero, 0, ATTOTIME_IN_USEC(2500)); | |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /* Machine Drivers */ |
| r1293 | r1294 | |
|---|---|---|
| 168 | 168 | extern tilemap* x68k_bg0_16; // two 64x64 tilemaps, 16x16 characters |
| 169 | 169 | extern tilemap* x68k_bg1_16; |
| 170 | 170 | |
| 171 | mame_timer* kb_timer; | |
| 172 | //mame_timer* mfp_timer[4]; | |
| 173 | //mame_timer* mfp_irq; | |
| 174 | mame_timer* scanline_timer; | |
| 175 | mame_timer* raster_irq; | |
| 176 | mame_timer* vblank_irq; | |
| 177 | mame_timer* mouse_timer; // to set off the mouse interrupts via the SCC | |
| 171 | emu_timer* kb_timer; | |
| 172 | //emu_timer* mfp_timer[4]; | |
| 173 | //emu_timer* mfp_irq; | |
| 174 | emu_timer* scanline_timer; | |
| 175 | emu_timer* raster_irq; | |
| 176 | emu_timer* vblank_irq; | |
| 177 | emu_timer* mouse_timer; // to set off the mouse interrupts via the SCC | |
| 178 | 178 | |
| 179 | 179 | // MFP is clocked at 4MHz, so at /4 prescaler the timer is triggered after 1us (4 cycles) |
| 180 | 180 | // No longer necessary with the new MFP core |
| 181 | /*static | |
| 181 | /*static | |
| 182 | 182 | { |
| 183 | 183 | switch(val) |
| 184 | 184 | { |
| 185 | case 0: return MAME_TIME_IN_NSEC(0); | |
| 186 | case 1: return MAME_TIME_IN_NSEC(1000); | |
| 187 | case 2: return MAME_TIME_IN_NSEC(2500); | |
| 188 | case 3: return MAME_TIME_IN_NSEC(4000); | |
| 189 | case 4: return MAME_TIME_IN_NSEC(12500); | |
| 190 | case 5: return MAME_TIME_IN_NSEC(16000); | |
| 191 | case 6: return MAME_TIME_IN_NSEC(25000); | |
| 192 | case 7: return MAME_TIME_IN_NSEC(50000); | |
| 185 | case 0: return ATTOTIME_IN_NSEC(0); | |
| 186 | case 1: return ATTOTIME_IN_NSEC(1000); | |
| 187 | case 2: return ATTOTIME_IN_NSEC(2500); | |
| 188 | case 3: return ATTOTIME_IN_NSEC(4000); | |
| 189 | case 4: return ATTOTIME_IN_NSEC(12500); | |
| 190 | case 5: return ATTOTIME_IN_NSEC(16000); | |
| 191 | case 6: return ATTOTIME_IN_NSEC(25000); | |
| 192 | case 7: return ATTOTIME_IN_NSEC(50000); | |
| 193 | 193 | default: |
| 194 | 194 | fatalerror("out of range"); |
| 195 | 195 | } |
| r1293 | r1294 | |
| 205 | 205 | sys.mfp.irqline = 6; // MFP is connected to 68000 IRQ line 6 |
| 206 | 206 | sys.mfp.current_irq = -1; // No current interrupt |
| 207 | 207 | |
| 208 | /* mfp_timer[0] = mame_timer_alloc(mfp_timer_a_callback); | |
| 209 | mfp_timer[1] = mame_timer_alloc(mfp_timer_b_callback); | |
| 210 | mfp_timer[2] = mame_timer_alloc(mfp_timer_c_callback); | |
| 211 | mfp_timer[3] = mame_timer_alloc(mfp_timer_d_callback); | |
| 212 | mfp_irq = mame_timer_alloc(mfp_update_irq); | |
| 213 | mame_timer_adjust(mfp_irq, time_zero, 0, MAME_TIME_IN_USEC(32)); | |
| 208 | /* mfp_timer[0] = timer_alloc(mfp_timer_a_callback); | |
| 209 | mfp_timer[1] = timer_alloc(mfp_timer_b_callback); | |
| 210 | mfp_timer[2] = timer_alloc(mfp_timer_c_callback); | |
| 211 | mfp_timer[3] = timer_alloc(mfp_timer_d_callback); | |
| 212 | mfp_irq = timer_alloc(mfp_update_irq); | |
| 213 | timer_adjust(mfp_irq, attotime_zero, 0, ATTOTIME_IN_USEC(32)); | |
| 214 | 214 | */ |
| 215 | 215 | } |
| 216 | 216 | /* |
| r1293 | r1294 | |
| 331 | 331 | { |
| 332 | 332 | if((data & 0x07) == 0x0000) |
| 333 | 333 | { // Timer stop |
| 334 | | |
| 334 | | |
| 335 | 335 | logerror("MFP: Timer #%i stopped. \n",timer); |
| 336 | 336 | return; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | mame_timer_adjust(mfp_timer[timer], time_zero, 0, prescale(data & 0x07)); | |
| 340 | logerror("MFP: Timer #%i set to %2.1fus\n",timer, mame_time_to_double(prescale(data & 0x07)) * 1000000); | |
| 339 | timer_adjust(mfp_timer[timer], attotime_zero, 0, prescale(data & 0x07)); | |
| 340 | logerror("MFP: Timer #%i set to %2.1fus\n",timer, attotime_to_double(prescale(data & 0x07)) * 1000000); | |
| 341 | 341 | |
| 342 | 342 | } |
| 343 | 343 | */ |
| r1293 | r1294 | |
| 1329 | 1329 | offset *= 2; |
| 1330 | 1330 | if(ACCESSING_LSB) |
| 1331 | 1331 | offset++; |
| 1332 | | |
| 1332 | | |
| 1333 | 1333 | // cpunum_set_input_line_and_vector(0,2,ASSERT_LINE,current_vector[2]); |
| 1334 | 1334 | } |
| 1335 | 1335 | return 0xffff; |
| r1293 | r1294 | |
| 1345 | 1345 | offset *= 2; |
| 1346 | 1346 | if(ACCESSING_LSB) |
| 1347 | 1347 | offset++; |
| 1348 | | |
| 1348 | | |
| 1349 | 1349 | // cpunum_set_input_line_and_vector(0,2,ASSERT_LINE,current_vector[2]); |
| 1350 | 1350 | } |
| 1351 | 1351 | } |
| r1293 | r1294 | |
| 1853 | 1853 | |
| 1854 | 1854 | int drive; |
| 1855 | 1855 | UINT8* romdata = memory_region(REGION_USER2); |
| 1856 | | |
| 1856 | | |
| 1857 | 1857 | |
| 1858 | 1858 | memset(mess_ram,0,mess_ram_size); |
| 1859 | 1859 | memcpy(mess_ram,romdata,8); |
| r1293 | r1294 | |
| 1890 | 1890 | // start VBlank timer |
| 1891 | 1891 | sys.crtc.vblank = 1; |
| 1892 | 1892 | irq_time = video_screen_get_time_until_pos(0,sys.crtc.reg[6],2); |
| 1893 | | |
| 1893 | | |
| 1894 | 1894 | |
| 1895 | 1895 | // start HBlank timer |
| 1896 | | |
| 1896 | | |
| 1897 | 1897 | |
| 1898 | 1898 | sys.mfp.gpio = 0xfb; |
| 1899 | 1899 | } |
| r1293 | r1294 | |
| 1916 | 1916 | memory_set_bankptr(4,generic_nvram16); // so that code in SRAM is executable, there is an option for booting from SRAM |
| 1917 | 1917 | |
| 1918 | 1918 | // start keyboard timer |
| 1919 | | |
| 1919 | | |
| 1920 | 1920 | |
| 1921 | 1921 | // start mouse timer |
| 1922 | | |
| 1922 | | |
| 1923 | 1923 | sys.mouse.inputtype = 0; |
| 1924 | 1924 | } |
| 1925 | 1925 | |
| r1293 | r1294 | |
| 1963 | 1963 | // init keyboard |
| 1964 | 1964 | sys.keyboard.delay = 500; // 3*100+200 |
| 1965 | 1965 | sys.keyboard.repeat = 110; // 4^2*5+30 |
| 1966 | kb_timer = mame_timer_alloc(x68k_keyboard_poll); | |
| 1967 | scanline_timer = mame_timer_alloc(x68k_hsync); | |
| 1968 | raster_irq = mame_timer_alloc(x68k_crtc_raster_irq); | |
| 1969 | vblank_irq = mame_timer_alloc(x68k_crtc_vblank_irq); | |
| 1970 | mouse_timer = mame_timer_alloc(x68k_scc_ack); | |
| 1966 | kb_timer = timer_alloc(x68k_keyboard_poll); | |
| 1967 | scanline_timer = timer_alloc(x68k_hsync); | |
| 1968 | raster_irq = timer_alloc(x68k_crtc_raster_irq); | |
| 1969 | vblank_irq = timer_alloc(x68k_crtc_vblank_irq); | |
| 1970 | mouse_timer = timer_alloc(x68k_scc_ack); | |
| 1971 | 1971 | } |
| 1972 | 1972 | |
| 1973 | 1973 |
| r1293 | r1294 | |
|---|---|---|
| 193 | 193 | if ((Changed & 0x07)!=0) |
| 194 | 194 | { |
| 195 | 195 | /* yes - send event */ |
| 196 | EventList_AddItemOffset(0x0fe, data & 0x07, | |
| 196 | EventList_AddItemOffset(0x0fe, data & 0x07, | |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | if ((Changed & (1<<4))!=0) |
| r1293 | r1294 | |
|---|---|---|
| 72 | 72 | keyboard_scan(); |
| 73 | 73 | /* enable ROM in base >0000, and re-enable RAM shortly thereafter */ |
| 74 | 74 | memory_set_bankptr(1, memory_region(REGION_CPU1) + 0xC000); |
| 75 | | |
| 75 | | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | static VIDEO_START( super80 ) |
| r1293 | r1294 | |
|---|---|---|
| 469 | 469 | |
| 470 | 470 | static const int DMASOUND_RATE[] = { Y2/640/8, Y2/640/4, Y2/640/2, Y2/640 }; |
| 471 | 471 | |
| 472 | static | |
| 472 | static | |
| 473 | 473 | |
| 474 | 474 | static void atariste_dmasound_set_state(int state) |
| 475 | 475 | { |
| r1293 | r1294 | |
| 529 | 529 | } |
| 530 | 530 | else |
| 531 | 531 | { |
| 532 | | |
| 532 | | |
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | } |
| r1293 | r1294 | |
| 598 | 598 | if (!dmasound.active) |
| 599 | 599 | { |
| 600 | 600 | atariste_dmasound_set_state(1); |
| 601 | | |
| 601 | | |
| 602 | 602 | } |
| 603 | 603 | } |
| 604 | 604 | else |
| 605 | 605 | { |
| 606 | 606 | atariste_dmasound_set_state(0); |
| 607 | | |
| 607 | | |
| 608 | 608 | } |
| 609 | 609 | } |
| 610 | 610 | |
| r1293 | r1294 | |
| 663 | 663 | int shift; |
| 664 | 664 | } mwire; |
| 665 | 665 | |
| 666 | static | |
| 666 | static | |
| 667 | 667 | |
| 668 | 668 | static void atariste_microwire_shift(void) |
| 669 | 669 | { |
| r1293 | r1294 | |
| 698 | 698 | atariste_microwire_shift(); |
| 699 | 699 | lmc1992_enable_w(1); |
| 700 | 700 | mwire.shift = 0; |
| 701 | | |
| 701 | | |
| 702 | 702 | break; |
| 703 | 703 | } |
| 704 | 704 | } |
| r1293 | r1294 | |
| 710 | 710 | |
| 711 | 711 | static WRITE16_HANDLER( atariste_microwire_data_w ) |
| 712 | 712 | { |
| 713 | if (! | |
| 713 | if (! | |
| 714 | 714 | { |
| 715 | 715 | mwire.data = data; |
| 716 | | |
| 716 | | |
| 717 | 717 | } |
| 718 | 718 | } |
| 719 | 719 | |
| r1293 | r1294 | |
| 724 | 724 | |
| 725 | 725 | static WRITE16_HANDLER( atariste_microwire_mask_w ) |
| 726 | 726 | { |
| 727 | if (! | |
| 727 | if (! | |
| 728 | 728 | { |
| 729 | 729 | mwire.mask = data; |
| 730 | 730 | } |
| r1293 | r1294 | |
| 1597 | 1597 | |
| 1598 | 1598 | cpunum_set_irq_callback(0, atarist_int_ack); |
| 1599 | 1599 | |
| 1600 | dmasound_timer = mame_timer_alloc(atariste_dmasound_tick); | |
| 1601 | microwire_timer = mame_timer_alloc(atariste_microwire_tick); | |
| 1600 | dmasound_timer = timer_alloc(atariste_dmasound_tick); | |
| 1601 | microwire_timer = timer_alloc(atariste_microwire_tick); | |
| 1602 | 1602 | } |
| 1603 | 1603 | |
| 1604 | 1604 | static MACHINE_START( megaste ) |
| r1293 | r1294 | |
|---|---|---|
| 1131 | 1131 | return; |
| 1132 | 1132 | } |
| 1133 | 1133 | } |
| 1134 | | |
| 1134 | | |
| 1135 | 1135 | } |
| 1136 | 1136 | } |
| 1137 | 1137 | |
| r1293 | r1294 | |
| 1201 | 1201 | verboselog( 0, " FIFO End: Rowe %04x\n", ( data & PBUS_CTRL_FIFO_END ) >> 24 ); |
| 1202 | 1202 | if( ( data & PBUS_CTRL_DMASTART ) || ( data & PBUS_CTRL_LOAD_EN ) ) |
| 1203 | 1203 | { |
| 1204 | | |
| 1204 | | |
| 1205 | 1205 | nPBUS_DMA_Active = 1; |
| 1206 | 1206 | } |
| 1207 | 1207 | return; |
| r1293 | r1294 | |
| 1234 | 1234 | { |
| 1235 | 1235 | mc_update(machine, 0); |
| 1236 | 1236 | |
| 1237 | | |
| 1237 | | |
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | 1240 | static MACHINE_RESET( ip225015 ) |
| r1293 | r1294 | |
| 1246 | 1246 | RTC_REGISTERB = 0x08; |
| 1247 | 1247 | RTC_REGISTERD = 0x80; |
| 1248 | 1248 | |
| 1249 | | |
| 1249 | | |
| 1250 | 1250 | |
| 1251 | 1251 | // set up low RAM mirror |
| 1252 | 1252 | memory_set_bankptr(1, ip22_mainram); |
| r1293 | r1294 | |
|---|---|---|
| 123 | 123 | static WRITE8_HANDLER(exidy_fe_port_w); |
| 124 | 124 | |
| 125 | 125 | /* timer for exidy serial chip transmit and receive */ |
| 126 | static | |
| 126 | static | |
| 127 | 127 | |
| 128 | 128 | static TIMER_CALLBACK(exidy_serial_timer_callback) |
| 129 | 129 | { |
| r1293 | r1294 | |
| 257 | 257 | |
| 258 | 258 | static MACHINE_START( exidy ) |
| 259 | 259 | { |
| 260 | serial_timer = mame_timer_alloc(exidy_serial_timer_callback); | |
| 261 | cassette_timer = mame_timer_alloc(exidy_cassette_timer_callback); | |
| 260 | serial_timer = timer_alloc(exidy_serial_timer_callback); | |
| 261 | cassette_timer = timer_alloc(exidy_cassette_timer_callback); | |
| 262 | 262 | |
| 263 | 263 | wd17xx_init(WD_TYPE_179X, NULL, NULL); |
| 264 | 264 | } |
| r1293 | r1294 | |
| 278 | 278 | |
| 279 | 279 | exidy_fe_port_w(0,0); |
| 280 | 280 | |
| 281 | | |
| 281 | | |
| 282 | 282 | |
| 283 | 283 | floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80); |
| 284 | 284 | |
| r1293 | r1294 | |
| 307 | 307 | |
| 308 | 308 | exidy_fe_port_w(0,0); |
| 309 | 309 | |
| 310 | | |
| 310 | | |
| 311 | 311 | |
| 312 | 312 | floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80); |
| 313 | 313 | } |
| r1293 | r1294 | |
| 466 | 466 | /* both are now off */ |
| 467 | 467 | |
| 468 | 468 | /* stop timer */ |
| 469 | | |
| 469 | | |
| 470 | 470 | } |
| 471 | 471 | else |
| 472 | 472 | { |
| r1293 | r1294 | |
| 478 | 478 | cassette_clock_state = 0; |
| 479 | 479 | /* start timer */ |
| 480 | 480 | /* the correct baud rate should be being used here (see bit 6 below) */ |
| 481 | | |
| 481 | | |
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 | } |
| r1293 | r1294 | |
| 515 | 515 | baud_rate = 1200; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | | |
| 518 | | |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | exidy_fe = data; |
| r1293 | r1294 | |
| 792 | 792 | MDRV_CPU_PROGRAM_MAP(exidy_mem, 0) |
| 793 | 793 | MDRV_CPU_IO_MAP(exidy_io, 0) |
| 794 | 794 | MDRV_SCREEN_REFRESH_RATE(50) |
| 795 | MDRV_SCREEN_VBLANK_TIME( | |
| 795 | MDRV_SCREEN_VBLANK_TIME(A | |
| 796 | 796 | MDRV_INTERLEAVE(1) |
| 797 | 797 | |
| 798 | 798 | MDRV_MACHINE_START( exidy ) |
| r1293 | r1294 | |
|---|---|---|
| 102 | 102 | UINT8 latch_64; |
| 103 | 103 | UINT8 dlc; |
| 104 | 104 | UINT8 shift_reg; |
| 105 | | |
| 105 | | |
| 106 | 106 | } dpc; |
| 107 | 107 | |
| 108 | 108 | static UINT8* extra_RAM; |
| r1293 | r1294 | |
| 1372 | 1372 | if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) { |
| 1373 | 1373 | if ( supported_screen_heights[i] != current_screen_height ) { |
| 1374 | 1374 | current_screen_height = supported_screen_heights[i]; |
| 1375 | // video_screen_configure( 0, 228, current_screen_height, &visarea[i], HZ_TO_ | |
| 1375 | // video_screen_configure( 0, 228, current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_NTSC ) * 228 * current_screen_height ); | |
| 1376 | 1376 | } |
| 1377 | 1377 | } |
| 1378 | 1378 | } |
| r1293 | r1294 | |
| 1385 | 1385 | if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) { |
| 1386 | 1386 | if ( supported_screen_heights[i] != current_screen_height ) { |
| 1387 | 1387 | current_screen_height = supported_screen_heights[i]; |
| 1388 | // video_screen_configure( 0, 228, current_screen_height, &visarea[i], HZ_TO_ | |
| 1388 | // video_screen_configure( 0, 228, current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_PAL ) * 228 * current_screen_height ); | |
| 1389 | 1389 | } |
| 1390 | 1390 | } |
| 1391 | 1391 | } |
| r1293 | r1294 | |
| 1741 | 1741 | dpc.df[data_fetcher].music_mode = 0; |
| 1742 | 1742 | } |
| 1743 | 1743 | } |
| 1744 | dpc.oscillator = mame_timer_alloc( modeDPC_timer_callback ); | |
| 1745 | mame_timer_adjust( dpc.oscillator, MAME_TIME_IN_HZ(42000), 0, MAME_TIME_IN_HZ(42000) ); | |
| 1744 | dpc.oscillator = timer_alloc( modeDPC_timer_callback ); | |
| 1745 | timer_adjust( dpc.oscillator, ATTOTIME_IN_HZ(42000), 0, ATTOTIME_IN_HZ(42000) ); | |
| 1746 | 1746 | break; |
| 1747 | 1747 | |
| 1748 | 1748 | case mode32in1: |
| r1293 | r1294 | |
|---|---|---|
| 400 | 400 | |
| 401 | 401 | static DRIVER_INIT( studio2 ) |
| 402 | 402 | { |
| 403 | mame_timer_set(time_zero, 0, setup_beep); | |
| 404 | mame_timer_set(MAME_TIME_IN_MSEC(200), 0, set_cpu_mode); | |
| 403 | timer_set(attotime_zero, 0, setup_beep); | |
| 404 | timer_set(ATTOTIME_IN_MSEC(200), 0, set_cpu_mode); | |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | static int mpt02_colorram_r(UINT16 addr) |
| r1293 | r1294 | |
| 426 | 426 | |
| 427 | 427 | static DRIVER_INIT( mpt02 ) |
| 428 | 428 | { |
| 429 | | |
| 429 | | |
| 430 | 430 | cdp1864_configure(&mpt02_CDP1864_interface); |
| 431 | 431 | } |
| 432 | 432 |
| r1293 | r1294 | |
|---|---|---|
| 776 | 776 | roller_ram_offset = 0; |
| 777 | 777 | |
| 778 | 778 | /* timer interrupt */ |
| 779 | | |
| 779 | | |
| 780 | 780 | |
| 781 | | |
| 781 | | |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 |
| r1293 | r1294 | |
|---|---|---|
| 94 | 94 | |
| 95 | 95 | static MACHINE_START( mk2 ) |
| 96 | 96 | { |
| 97 | | |
| 97 | | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | static MACHINE_RESET( mk2 ) |
| r1293 | r1294 | |
|---|---|---|
| 228 | 228 | { |
| 229 | 229 | cpunum_set_input_line_vector(0, 0, 0xff); |
| 230 | 230 | memset(&memory_region(REGION_CPU1)[0x6000], 0xff, 0x400); // initialize RAM |
| 231 | | |
| 231 | | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | static MACHINE_DRIVER_START( coleco ) |
| r1293 | r1294 | |
|---|---|---|
| 1862 | 1862 | static WRITE32_HANDLER( minit_w ) |
| 1863 | 1863 | { |
| 1864 | 1864 | logerror("cpu #%d (PC=%08X) MINIT write = %08x\n",cpu_getactivecpu(), activecpu_get_pc(),data); |
| 1865 | cpu_boost_interleave(double_to_ | |
| 1865 | cpu_boost_interleave(double_to_ | |
| 1866 | 1866 | cpu_trigger(1000); |
| 1867 | 1867 | cpunum_set_info_int(1, CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE); |
| 1868 | 1868 | } |
| r1293 | r1294 | |
| 1870 | 1870 | static WRITE32_HANDLER( sinit_w ) |
| 1871 | 1871 | { |
| 1872 | 1872 | logerror("cpu #%d (PC=%08X) SINIT write = %08x\n",cpu_getactivecpu(), activecpu_get_pc(),data); |
| 1873 | cpu_boost_interleave(double_to_ | |
| 1873 | cpu_boost_interleave(double_to_ | |
| 1874 | 1874 | cpunum_set_info_int(0, CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE); |
| 1875 | 1875 | } |
| 1876 | 1876 | |
| r1293 | r1294 | |
| 2288 | 2288 | MDRV_CPU_PROGRAM_MAP(sound_mem, 0) |
| 2289 | 2289 | |
| 2290 | 2290 | MDRV_SCREEN_REFRESH_RATE(60) |
| 2291 | MDRV_SCREEN_VBLANK_TIME( | |
| 2291 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2292 | 2292 | |
| 2293 | 2293 | MDRV_MACHINE_START(saturn) |
| 2294 | 2294 | MDRV_MACHINE_RESET(saturn) |
| r1293 | r1294 | |
|---|---|---|
| 81 | 81 | int mdrdw, mdselck, mdseld, erase, raw1, raw2; |
| 82 | 82 | } zx8302; |
| 83 | 83 | |
| 84 | static | |
| 84 | static | |
| 85 | 85 | |
| 86 | 86 | static void zx8302_interrupt(UINT8 line) |
| 87 | 87 | { |
| r1293 | r1294 | |
| 200 | 200 | } |
| 201 | 201 | */ |
| 202 | 202 | |
| 203 | mame_timer_adjust(zx8302_txd_timer, time_zero, 0, MAME_TIME_IN_HZ(baud)); | |
| 204 | mame_timer_adjust(zx8302_ipc_timer, time_zero, 0, MAME_TIME_IN_HZ(baudx4)); | |
| 203 | timer_adjust(zx8302_txd_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud)); | |
| 204 | timer_adjust(zx8302_ipc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baudx4)); | |
| 205 | 205 | |
| 206 | 206 | //logerror("ZX8302 Baud Rate : %u\n", baud); |
| 207 | 207 | } |
| r1293 | r1294 | |
| 664 | 664 | zx8302.comctl = 1; |
| 665 | 665 | zx8302.comdata = 1; |
| 666 | 666 | |
| 667 | zx8302_txd_timer = mame_timer_alloc(zx8302_txd_tick); | |
| 668 | zx8302_ipc_timer = mame_timer_alloc(zx8302_ipc_tick); | |
| 669 | zx8302_rtc_timer = mame_timer_alloc(zx8302_rtc_tick); | |
| 667 | zx8302_txd_timer = timer_alloc(zx8302_txd_tick); | |
| 668 | zx8302_ipc_timer = timer_alloc(zx8302_ipc_tick); | |
| 669 | zx8302_rtc_timer = timer_alloc(zx8302_rtc_tick); | |
| 670 | 670 | |
| 671 | | |
| 671 | | |
| 672 | 672 | |
| 673 | 673 | zx8302.ctr = time(NULL) + 283996800; |
| 674 | 674 |
| r1293 | r1294 | |
|---|---|---|
| 191 | 191 | MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262) |
| 192 | 192 | |
| 193 | 193 | MDRV_SCREEN_REFRESH_RATE(59.997) |
| 194 | MDRV_SCREEN_VBLANK_TIME( | |
| 194 | MDRV_SCREEN_VBLANK_TIME(A | |
| 195 | 195 | |
| 196 | 196 | MDRV_MACHINE_RESET( amiga ) |
| 197 | 197 |
| r1293 | r1294 | |
|---|---|---|
| 242 | 242 | are visible, and each character time is 7 dot times; a dot time |
| 243 | 243 | is 2 cycles of the fundamental 14.31818 MHz oscillator. The |
| 244 | 244 | total blanking time is about 4450 microseconds. */ |
| 245 | MDRV_SCREEN_VBLANK_TIME( | |
| 245 | MDRV_SCREEN_VBLANK_TIME(A | |
| 246 | 246 | MDRV_INTERLEAVE(1) |
| 247 | 247 | |
| 248 | 248 | MDRV_MACHINE_RESET( apple1 ) |
| r1293 | r1294 | |
|---|---|---|
| 84 | 84 | #include "machine/abcbus.h" |
| 85 | 85 | #include "video/abc80x.h" |
| 86 | 86 | |
| 87 | static | |
| 87 | static | |
| 88 | 88 | |
| 89 | 89 | /* Read/Write Handlers */ |
| 90 | 90 | |
| r1293 | r1294 | |
| 651 | 651 | state_save_register_global(abc77_keylatch); |
| 652 | 652 | state_save_register_global(abc77_clock); |
| 653 | 653 | |
| 654 | abc800_ctc_timer = mame_timer_alloc(abc800_ctc_tick); | |
| 655 | mame_timer_adjust(abc800_ctc_timer, time_zero, 0, MAME_TIME_IN_HZ(ABC800_X01/2/2/2)); | |
| 654 | abc800_ctc_timer = timer_alloc(abc800_ctc_tick); | |
| 655 | timer_adjust(abc800_ctc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC800_X01/2/2/2)); | |
| 656 | 656 | |
| 657 | 657 | z80ctc_init(0, &abc800_ctc_intf); |
| 658 | 658 | z80sio_init(0, &abc800_sio_intf); |
| r1293 | r1294 | |
|---|---|---|
| 283 | 283 | // enable power led |
| 284 | 284 | set_led_status(2, 1); |
| 285 | 285 | |
| 286 | | |
| 286 | | |
| 287 | 287 | |
| 288 | 288 | cdp1864_configure(&tmc2000e_CDP1864_interface); |
| 289 | 289 | } |
| r1293 | r1294 | |
|---|---|---|
| 420 | 420 | |
| 421 | 421 | static DRIVER_INIT( tmc1800 ) |
| 422 | 422 | { |
| 423 | | |
| 423 | | |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | static DRIVER_INIT( tmc2000 ) |
| 427 | 427 | { |
| 428 | | |
| 428 | | |
| 429 | 429 | cdp1864_configure(&tmc2000_CDP1864_interface); |
| 430 | 430 | } |
| 431 | 431 |
| r1293 | r1294 | |
|---|---|---|
| 357 | 357 | sn76489_ready = 0; |
| 358 | 358 | |
| 359 | 359 | // wait 32 cycles of 2 MHz to synchronize CPU and SN76489 |
| 360 | | |
| 360 | | |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | static WRITE8_HANDLER( pia_cb2_w ) |
| r1293 | r1294 | |
|---|---|---|
| 1453 | 1453 | /* the einstein keyboard can generate a interrupt */ |
| 1454 | 1454 | /* the int is actually clocked at the system clock 4Mhz, but this would be too fast for our |
| 1455 | 1455 | driver. So we update at 50Hz and hope this is good enough. */ |
| 1456 | | |
| 1456 | | |
| 1457 | 1457 | |
| 1458 | 1458 | /* the input to channel 0 and 1 of the ctc is a 2mhz clock */ |
| 1459 | 1459 | einstein_ctc_trigger = 0; |
| 1460 | | |
| 1460 | | |
| 1461 | 1461 | |
| 1462 | 1462 | centronics_config(0, einstein_cent_config); |
| 1463 | 1463 | /* assumption: select is tied low */ |
| r1293 | r1294 | |
|---|---|---|
| 209 | 209 | io_state = IOS_NOP; |
| 210 | 210 | break; |
| 211 | 211 | case IOS_RESET: |
| 212 | | |
| 212 | | |
| 213 | 213 | break; |
| 214 | 214 | case IOS_STSPEECH1: |
| 215 | 215 | io_state = IOS_STSPEECH2; |
| r1293 | r1294 | |
|---|---|---|
| 183 | 183 | static MACHINE_START( mephisto ) |
| 184 | 184 | { |
| 185 | 185 | lcd_shift_counter=3; |
| 186 | // mame_timer_pulse(MAME_TIME_IN_HZ(60), 0, update_leds); | |
| 187 | mame_timer_pulse(MAME_TIME_IN_HZ(600), 0, update_nmi); | |
| 186 | // timer_pulse(ATTOTIME_IN_HZ(60), 0, update_leds); | |
| 187 | timer_pulse(ATTOTIME_IN_HZ(600), 0, update_nmi); | |
| 188 | 188 | // cpunum_set_input_line(0, M65C02_IRQ_LINE,CLEAR_LINE); |
| 189 | 189 | //beep_set_frequency(0, 4000); |
| 190 | 190 | } |
| r1293 | r1294 | |
|---|---|---|
| 1798 | 1798 | The CRTC generates a memory address using it's MA and RA signal outputs |
| 1799 | 1799 | The Gate-Array fetches two bytes for each address*/ |
| 1800 | 1800 | |
| 1801 | // mame_timer_pulse(MAME_TIME_IN_USEC(AMSTRAD_US_PER_SCANLINE), 0, amstrad_vh_execute_crtc_cycles); | |
| 1802 | mame_timer_pulse(MAME_TIME_IN_USEC(1), 0, amstrad_vh_execute_crtc_cycles_callback); | |
| 1801 | // timer_pulse(ATTOTIME_IN_USEC(AMSTRAD_US_PER_SCANLINE), 0, amstrad_vh_execute_crtc_cycles); | |
| 1802 | timer_pulse(ATTOTIME_IN_USEC(1), 0, amstrad_vh_execute_crtc_cycles_callback); | |
| 1803 | 1803 | |
| 1804 | 1804 | /* The opcode timing in the Amstrad is different to the opcode |
| 1805 | 1805 | timing in the core for the Z80 CPU. |
| r1293 | r1294 | |
| 2287 | 2287 | |
| 2288 | 2288 | MDRV_SCREEN_REFRESH_RATE(AMSTRAD_FPS) |
| 2289 | 2289 | MDRV_INTERLEAVE(1) |
| 2290 | MDRV_SCREEN_VBLANK_TIME( | |
| 2290 | MDRV_SCREEN_VBLANK_TIME(A | |
| 2291 | 2291 | |
| 2292 | 2292 | MDRV_MACHINE_RESET( amstrad ) |
| 2293 | 2293 |
| r1293 | r1294 | |
|---|---|---|
| 83 | 83 | static UINT32 a310_timercnt[4], a310_timerout[4]; |
| 84 | 84 | static UINT32 a310_sndstart, a310_sndend, a310_sndcur; |
| 85 | 85 | |
| 86 | static | |
| 86 | static | |
| 87 | 87 | |
| 88 | 88 | VIDEO_START( a310 ) |
| 89 | 89 | { |
| r1293 | r1294 | |
| 139 | 139 | a310_request_irq_a(A310_IRQA_VBL); |
| 140 | 140 | |
| 141 | 141 | // set up for next vbl |
| 142 | | |
| 142 | | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | static void a310_set_timer(int tmr) |
| r1293 | r1294 | |
| 148 | 148 | |
| 149 | 149 | // logerror("IOC: starting timer %d, %d ticks, freq %f Hz\n", tmr, a310_timercnt[tmr], freq); |
| 150 | 150 | |
| 151 | | |
| 151 | | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // param |
| r1293 | r1294 | |
| 216 | 216 | a310_pagesize = 0; |
| 217 | 217 | wd17xx_init(WD_TYPE_1772, a310_wd177x_callback, NULL); |
| 218 | 218 | |
| 219 | vbl_timer = mame_timer_alloc(a310_vblank); | |
| 220 | mame_timer_adjust(vbl_timer, time_never, 0, time_never); | |
| 219 | vbl_timer = timer_alloc(a310_vblank); | |
| 220 | timer_adjust(vbl_timer, attotime_never, 0, attotime_never); | |
| 221 | 221 | |
| 222 | timer[0] = mame_timer_alloc(a310_timer); | |
| 223 | timer[1] = mame_timer_alloc(a310_timer); | |
| 224 | timer[2] = mame_timer_alloc(a310_timer); | |
| 225 | timer[3] = mame_timer_alloc(a310_timer); | |
| 226 | mame_timer_adjust(timer[0], time_never, 0, time_never); | |
| 227 | mame_timer_adjust(timer[1], time_never, 0, time_never); | |
| 228 | mame_timer_adjust(timer[2], time_never, 0, time_never); | |
| 229 | mame_timer_adjust(timer[3], time_never, 0, time_never); | |
| 222 | timer[0] = timer_alloc(a310_timer); | |
| 223 | timer[1] = timer_alloc(a310_timer); | |
| 224 | timer[2] = timer_alloc(a310_timer); | |
| 225 | timer[3] = timer_alloc(a310_timer); | |
| 226 | timer_adjust(timer[0], attotime_never, 0, attotime_never); | |
| 227 | timer_adjust(timer[1], attotime_never, 0, attotime_never); | |
| 228 | timer_adjust(timer[2], attotime_never, 0, attotime_never); | |
| 229 | timer_adjust(timer[3], attotime_never, 0, attotime_never); | |
| 230 | 230 | |
| 231 | snd_timer = mame_timer_alloc(a310_audio_tick); | |
| 232 | mame_timer_adjust(snd_timer, time_never, 0, time_never); | |
| 231 | snd_timer = timer_alloc(a310_audio_tick); | |
| 232 | timer_adjust(snd_timer, attotime_never, 0, attotime_never); | |
| 233 | 233 | |
| 234 | 234 | // reset the DAC to centerline |
| 235 | 235 | DAC_signed_data_w(0, 0x80); |
| r1293 | r1294 | |
| 371 | 371 | { |
| 372 | 372 | double time; |
| 373 | 373 | |
| 374 | time = | |
| 374 | time = | |
| 375 | 375 | time *= 2000000.0; // find out how many 2 MHz ticks have gone by |
| 376 | 376 | a310_timerout[tmr] = a310_timercnt[tmr] - (UINT32)time; |
| 377 | 377 | } |
| r1293 | r1294 | |
| 600 | 600 | video_screen_configure(0, a310_vidregs[0x80], a310_vidregs[0xa0], &visarea, Machine->screen[0].refresh); |
| 601 | 601 | |
| 602 | 602 | // slightly hacky: fire off a VBL right now. the BIOS doesn't wait long enough otherwise. |
| 603 | | |
| 603 | | |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | a310_vidregs[reg] = val>>12; |
| r1293 | r1294 | |
| 647 | 647 | |
| 648 | 648 | a310_sndcur = a310_sndstart; |
| 649 | 649 | |
| 650 | | |
| 650 | | |
| 651 | 651 | } |
| 652 | 652 | else |
| 653 | 653 | { |
| 654 | | |
| 654 | | |
| 655 | 655 | DAC_signed_data_w(0, 0x80); |
| 656 | 656 | } |
| 657 | 657 | break; |
| r1293 | r1294 | |
|---|---|---|
| 453 | 453 | { |
| 454 | 454 | /* a timer used to check status of pen */ |
| 455 | 455 | /* an interrupt is generated when the pen is pressed to the screen */ |
| 456 | | |
| 456 | | |
| 457 | 457 | |
| 458 | 458 | add_reset_callback(machine, avigo_machine_reset); |
| 459 | 459 | } |
| r1293 | r1294 | |
|---|---|---|
| 186 | 186 | if( !m_pad[ n_port ].b_ack ) |
| 187 | 187 | { |
| 188 | 188 | m_pad[ n_port ].b_ack = 1; |
| 189 | | |
| 189 | | |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | } |
| r1293 | r1294 | |
| 299 | 299 | if( b_ack ) |
| 300 | 300 | { |
| 301 | 301 | m_pad[ n_port ].b_ack = 0; |
| 302 | | |
| 302 | | |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 |
| r1293 | r1294 | |
|---|---|---|
| 87 | 87 | static TIMER_CALLBACK(tape_interrupt_handler); |
| 88 | 88 | |
| 89 | 89 | static char tape_interrupt_enable; |
| 90 | static | |
| 90 | static | |
| 91 | 91 | |
| 92 | 92 | /* parallel interface state */ |
| 93 | 93 | static UINT8 printer_data; |
| r1293 | r1294 | |
| 102 | 102 | |
| 103 | 103 | static DRIVER_INIT(tutor) |
| 104 | 104 | { |
| 105 | tape_interrupt_timer = | |
| 105 | tape_interrupt_timer = | |
| 106 | 106 | |
| 107 | 107 | memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1) + basic_base, 0); |
| 108 | 108 | memory_configure_bank(1, 1, 1, memory_region(REGION_CPU1) + cartridge_base, 0); |
| r1293 | r1294 | |
| 289 | 289 | { |
| 290 | 290 | tape_interrupt_enable = ! data; |
| 291 | 291 | if (tape_interrupt_enable) |
| 292 | | |
| 292 | | |
| 293 | 293 | else |
| 294 | 294 | { |
| 295 | | |
| 295 | | |
| 296 | 296 | cpunum_set_input_line(0, 1, CLEAR_LINE); |
| 297 | 297 | } |
| 298 | 298 | } |
| r1293 | r1294 | |
|---|---|---|
| 31 | 31 | |
| 32 | 32 | struct |
| 33 | 33 | { |
| 34 | | |
| 34 | | |
| 35 | 35 | int timer_shot; |
| 36 | 36 | } svision; |
| 37 | 37 | |
| r1293 | r1294 | |
| 40 | 40 | int state; |
| 41 | 41 | int on, clock, data; |
| 42 | 42 | UINT8 input; |
| 43 | | |
| 43 | | |
| 44 | 44 | } svision_pet; |
| 45 | 45 | |
| 46 | 46 | struct |
| r1293 | r1294 | |
| 86 | 86 | static TIMER_CALLBACK(svision_timer) |
| 87 | 87 | { |
| 88 | 88 | svision.timer_shot = TRUE; |
| 89 | | |
| 89 | | |
| 90 | 90 | svision_irq(); |
| 91 | 91 | } |
| 92 | 92 | |
| r1293 | r1294 | |
| 125 | 125 | svision_irq(); |
| 126 | 126 | break; |
| 127 | 127 | default: |
| 128 | logerror("%.6f svision read %04x %02x\n", | |
| 128 | logerror("%.6f svision read %04x %02x\n", | |
| 129 | 129 | break; |
| 130 | 130 | } |
| 131 | 131 | |
| r1293 | r1294 | |
| 145 | 145 | case 3: |
| 146 | 146 | break; |
| 147 | 147 | case 0x26: /* bits 5,6 memory management for a000? */ |
| 148 | logerror("%.6f svision write %04x %02x\n", | |
| 148 | logerror("%.6f svision write %04x %02x\n", | |
| 149 | 149 | memory_set_bankptr(1, memory_region(REGION_USER1) + ((svision_reg[0x26] & 0xe0) << 9)); |
| 150 | 150 | svision_irq(); |
| 151 | 151 | break; |
| r1293 | r1294 | |
| 157 | 157 | delay = 16384; |
| 158 | 158 | else |
| 159 | 159 | delay = 256; |
| 160 | mame_timer_enable(svision.timer1, TRUE); | |
| 161 | mame_timer_reset(svision.timer1, MAME_TIME_IN_CYCLES(value * delay, 0)); | |
| 160 | timer_enable(svision.timer1, TRUE); | |
| 161 | timer_reset(svision.timer1, ATTOTIME_IN_CYCLES(value * delay, 0)); | |
| 162 | 162 | break; |
| 163 | 163 | case 0x10: case 0x11: case 0x12: case 0x13: |
| 164 | 164 | svision_soundport_w(svision_channel + 0, offset & 3, data); |
| r1293 | r1294 | |
| 173 | 173 | svision_noise_w(offset - 0x28, data); |
| 174 | 174 | break; |
| 175 | 175 | default: |
| 176 | logerror("%.6f svision write %04x %02x\n", | |
| 176 | logerror("%.6f svision write %04x %02x\n", | |
| 177 | 177 | break; |
| 178 | 178 | } |
| 179 | 179 | } |
| r1293 | r1294 | |
| 432 | 432 | |
| 433 | 433 | static DRIVER_INIT( svision ) |
| 434 | 434 | { |
| 435 | svision.timer1 = | |
| 435 | svision.timer1 = | |
| 436 | 436 | svision_pet.on = FALSE; |
| 437 | 437 | memory_set_bankptr(2, memory_region(REGION_USER1) + 0x1c000); |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | static DRIVER_INIT( svisions ) |
| 441 | 441 | { |
| 442 | svision.timer1 = | |
| 442 | svision.timer1 = | |
| 443 | 443 | memory_set_bankptr(2, memory_region(REGION_USER1) + 0x1c000); |
| 444 | svision.timer1 = | |
| 444 | svision.timer1 = | |
| 445 | 445 | svision_pet.on = TRUE; |
| 446 | svision_pet.timer = mame_timer_alloc(svision_pet_timer); | |
| 447 | mame_timer_pulse(scale_up_mame_time(MAME_TIME_IN_SEC(8), 256/Machine->drv->cpu[0].clock), 0, svision_pet_timer); | |
| 446 | svision_pet.timer = timer_alloc(svision_pet_timer); | |
| 447 | timer_pulse(attotime_mul(ATTOTIME_IN_SEC(8), 256/Machine->drv->cpu[0].clock), 0, svision_pet_timer); | |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | static MACHINE_RESET( svision ) |
| r1293 | r1294 | |
|---|---|---|
| 728 | 728 | MDRV_CPU_VBLANK_INT(bbcb_vsync, 1) /* screen refresh interrupts */ |
| 729 | 729 | MDRV_CPU_PERIODIC_INT(bbcb_keyscan, 1000) /* scan keyboard */ |
| 730 | 730 | MDRV_SCREEN_REFRESH_RATE(50) |
| 731 | MDRV_SCREEN_VBLANK_TIME( | |
| 731 | MDRV_SCREEN_VBLANK_TIME(A | |
| 732 | 732 | MDRV_INTERLEAVE(1) |
| 733 | 733 | |
| 734 | 734 | MDRV_MACHINE_START( bbca ) |
| r1293 | r1294 | |
| 792 | 792 | MDRV_CPU_VBLANK_INT(bbcb_vsync, 1) /* screen refresh interrupts */ |
| 793 | 793 | MDRV_CPU_PERIODIC_INT(bbcm_keyscan, 1000) /* scan keyboard */ |
| 794 | 794 | MDRV_SCREEN_REFRESH_RATE(50) |
| 795 | MDRV_SCREEN_VBLANK_TIME( | |
| 795 | MDRV_SCREEN_VBLANK_TIME(A | |
| 796 | 796 | MDRV_INTERLEAVE(1) |
| 797 | 797 | |
| 798 | 798 | MDRV_MACHINE_START( bbcm ) |
| r1293 | r1294 | |
|---|---|---|
| 1 | 0.12 | |
| 1 | 0.12 | |
| 2 | 2 | |
| 3 | 3 | New System Drivers Supported (in no particular order): |
| 4 | 4 | ------------------------------------------------------ |
| r1293 | r1294 | |
|---|---|---|
| 1 | 0.12 | |
| 1 | 0.121 | |
| 2 | 2 | ----- |
| 3 | 3 | |
| 4 | 4 | |
| 5 | 5 | MAMETesters Bugs Fixed |
| 6 | 6 | ---------------------- |
| 7 | dunhuang0120u3gra [Vas Crabb] | |
| 7 | 8 | |
| 8 | 9 | |
| 10 | ||
| 9 | 11 | Source Changes |
| 10 | 12 | -------------- |
| 11 | Added "native" architecture option to the makefile. Use this to have | |
| 12 | gcc automatically pick the most appropriate architecture based on | |
| 13 | the system that it is compiling on. [Christophe Jaillet] | |
| 13 | Updated DIP locations in the following drivers: [Vas Crabb] | |
| 14 | - bublbobl.c: bublbobl, tokio | |
| 15 | - cps1.c: all games | |
| 16 | - dunhuang.c: dunhuang | |
| 17 | - mario.c: marked all as active high (confirmed from manuals) | |
| 18 | - segag80r.c: astrob2, astrob1, spaceod and pignewt | |
| 19 | - segag80v.c: all games, fixed switch ordering | |
| 14 | 20 | |
| 15 | Hooked up the KL5C80 communications CPU to the HNG64 BIOS and emulated | |
| 16 | some of its features. [Andrew Gardner, Justin Kerk] | |
| 21 | Made more functions static to reduce namespace pollution. | |
| 22 | [Atari Ace] | |
| 17 | 23 | |
| 18 | Fixed a few pointer truncation bugs in the Windows 64-bit code. | |
| 19 | Enabled warnings for 64-bit pointer truncations. Merged the x86 and | |
| 20 | x64 manifests. [Atari Ace] | |
| 24 | Improvements to the Touchmaster driver, still labelled not working. | |
| 25 | You can actually play tm and tm3k, but sometimes you have to reset | |
| 26 | because they stop registering the touchscreen input. tm4k is | |
| 27 | protected and hence totally unplayable. [Luca Elia] | |
| 21 | 28 | |
| 22 | Changed 6821 PIA logging so that it only logs core messages once. | |
| 23 | [Tim Lindner] | |
| 29 | Fixed compilation problems with altivec accelerators. [Vas Crabb] | |
| 24 | 30 | |
| 25 | Updates to various NeoGeo ROMsets. Some ROM names updated to match | |
| 26 | verified names from chip labels. A lot of "older" sets have been | |
| 27 | redumped to investigate the "64k m1/s1 issue" (also the m1 | |
| 28 | "overdumps"). Result was, ALL m1 ARE at least 128kx8; ALL s1 ARE | |
| 29 | 128kx8. The old m1 "overdumps" were incomplete dumps. In addition, | |
| 30 | it has been discovered that all "p-roms" do have a minimum size of | |
| 31 | 4mbit. A number of sets have been restored to their "original" | |
| 32 | state, and a number of others have been marked as bad dumps where | |
| 33 | appropriate. Specific changes include: [Johnboy] | |
| 34 | - bjourney: readded 128k m1 from Mame v0.34b5 | |
| 35 | - bstars: fully redumped, added correct m1 | |
| 36 | - bstars2: fully redumped, added correct m1 | |
| 37 | - goalx3: readded 128k m1 from Mame v0.34b5 | |
| 38 | - janshin: readded 128k m1 from Mame v0.34b5 | |
| 39 | - joyjoy: added correct m1 | |
| 40 | - legendos: readded 128k m1 from Mame v0.34b5 | |
| 41 | - maglord: fully redumped, added correct m1 | |
| 42 | - mutnat: partially redumped, added correct m1 | |
| 43 | - nam1975: fully redumped, added correct m1/s1 | |
| 44 | - ncombata: fully redumped, renamed set to ncombath | |
| 45 | - neomrdo: readded 128k s1 from Mame v0.34b5 | |
| 46 | - pbobblen: readded 128k m1 from Mame v0.34b5 | |
| 47 | - puzzledp: readded 128k s1 from Mame v0.34b5 | |
| 48 | - ridhero: fully redumped, added correct s1 | |
| 49 | - socbrawl: readded 128k s1 from Mame v0.34b5 | |
| 50 | - ssideki2: fully redumped | |
| 51 | - strhoop: readded 128k m1 from Mame v0.34b5 | |
| 52 | - svc: removed MVS tag, only one version exists (AES/MVS/PCB) | |
| 53 | - svcboot: removed MVS tag | |
| 54 | - tws96: readded 128k m1 from Mame v0.34b5 | |
| 55 | - viewpoin: readded 128k m1/s1 from Mame v0.34b5 | |
| 56 | - wh2j: partially redumped, renamed to wh2jh, is verified AES version | |
| 57 | - wh2j: fully redumped, is verified MVS version | |
| 58 | - wh1h: fully redumped, is verified AES version | |
| 59 | - wh1ha: renamed from wh1h to wh1ha | |
| 31 | Fixed bug in Voodoo statistics accumulation. [Atari Ace] | |
| 60 | 32 | |
| 61 | Made several more traditional optimizations to the voodoo emulations, | |
| 62 | gaining a few percent improvement. [Aaron Giles] | |
| 33 | Reverted to old behavior where even with -switchres disabled, | |
| 34 | MAME will use exclusive mode when rendering with Direct3D. This | |
| 35 | means some of the switching to/from fullscreen mode problems will | |
| 36 | come back, but should prevent confusion over poor performance by | |
| 37 | default. [Aaron Giles] | |
| 63 | 38 | |
| 64 | Further tweaked the work code to appropriately check for work items | |
| 65 | versus checking for the number of outstanding items. [Aaron Giles] | |
| 39 | Made it a non-fatal error if we are unable to change a joystick to | |
| 40 | absolute mode in the Windows input code. Some drivers apparently | |
| 41 | freak out about this. [Aaron Giles] | |
| 66 | 42 | |
| 67 | Simplified some of the model2 rendering code. [Aaron Giles] | |
| 43 | Defined a couple more inline functions: div_64x32_rem and the | |
| 44 | unsigned equivalent divu_64x32_rem. Added inline implementations | |
| 45 | for GCC x86 and MSVC. [Aaron Giles, Vas Crabb] | |
| 68 | 46 | |
| 69 | Moved a number of files from mame/machine and mame/video to | |
| 70 | emu/machine and emu/video. In general, files that emulate a common | |
| 71 | industry standard chip (as opposed to custom, manufacturer-specific | |
| 72 | chips) were moved. Further moves may happen in the future to | |
| 73 | isolate common system-level components (such as amiga, snes, etc.). | |
| 74 | [Aaron Giles, Curt Coder] | |
| 47 | Cleaned up timer interfaces. Created new module attotime which manages | |
| 48 | a new structure type attotime, equivalent to the old mame_time. All | |
| 49 | time math functions are now implemented in attotime and have been | |
| 50 | removed from timer.h. The following search/replace over the code has | |
| 51 | been made: | |
| 75 | 52 | |
| 53 | mame_time -> attotime | |
| 54 | subseconds_t -> attoseconds_t | |
| 55 | time_zero -> attotime_zero | |
| 56 | time_never -> attotime_never | |
| 57 | ||
| 58 | make_mame_make -> attotime_make | |
| 59 | mame_time_to_subseconds-> attotime_to_attoseconds | |
| 60 | mame_time_to_double -> attotime_to_double | |
| 61 | double_to_mame_time -> double_to_attotime | |
| 62 | add_mame_times -> attotime_add | |
| 63 | add_subseconds_to_mame_time -> attotime_add_subseconds | |
| 64 | sub_mame_times -> attotime_sub | |
| 65 | sub_subseconds_from_mame_time -> attotime_sub_subseconds | |
| 66 | scale_up_mame_time -> attotime_mul | |
| 67 | scale_down_mame_time -> attotime_div | |
| 68 | compare_mame_times -> attotime_compare | |
| 76 | 69 | |
| 70 | SUBSECONDS_TO_DOUBLE -> ATTOSECONDS_TO_DOUBLE | |
| 71 | DOUBLE_TO_SUBSECONDS -> DOUBLE_TO_ATTOSECONDS | |
| 72 | USEC_TO_SUBSECONDS -> ATTOSECONDS_IN_USEC | |
| 73 | SUBSECONDS_TO_HZ -> ATTOSECONDS_TO_HZ | |
| 74 | HZ_TO_SUBSECONDS -> HZ_TO_ATTOSECONDS | |
| 75 | MAME_TIME_IN_HZ -> ATTOTIME_IN_HZ | |
| 76 | MAME_TIME_IN_SEC -> ATTOTIME_IN_SEC | |
| 77 | MAME_TIME_IN_MSEC -> ATTOTIME_IN_MSEC | |
| 78 | MAME_TIME_IN_USEC -> ATTOTIME_IN_USEC | |
| 79 | MAME_TIME_IN_NSEC -> ATTOTIME_IN_NSEC | |
| 80 | MAME_TIME_TO_CYCLES -> ATTOTIME_TO_CYCLES | |
| 81 | MAME_TIME_IN_CYCLES -> ATTOTIME_IN_CYCLES | |
| 82 | ||
| 83 | In addition, all the mame_timer_* functions have been renamed back to | |
| 84 | their original names timer_*, so it is timer_set() instead of | |
| 85 | mame_timer_set() once again. The mame_timer object itself has been | |
| 86 | renamed to emu_timer. | |
| 77 | 87 | |
| 88 | ||
| 89 | ||
| 78 | 90 | New games added or promoted from NOT_WORKING status |
| 79 | 91 | --------------------------------------------------- |
| 80 | ||
| 92 | B | |
| 81 | 93 | |
| 82 | 94 | |
| 83 | 95 | |
| 84 | 96 | New clones added |
| 85 | 97 | ---------------- |
| 86 | World Heroes (set 3) [Johnboy] | |
| 87 | World Heroes 2 Jet (set 2) [Johnboy] | |
| 88 | Nightmare in the Dark (bootleg) [Johnboy] | |
| 98 | Cluedo (prod. 2) [James Wallace] | |
| 89 | 99 | |
| 90 | 100 | |
| 91 | 101 | |
| 92 | 0.1 | |
| 102 | 0.120u4 | |
| 93 | 103 | ------- |
| 94 | 104 | |
| 95 | NOTE TO OSD PORTERS: The work interfaces have changed again. Please | |
| 96 | read details below. The updated interfaces remove functionality, so | |
| 97 | in the end it should be simpler(!) to port. | |
| 98 | 105 | |
| 99 | ||
| 100 | ||
| 101 | 106 | MAMETesters Bugs Fixed |
| 102 | 107 | ---------------------- |
| 103 | parodius0111u3gra [Mike Green] | |
| 104 | ghostb0105u4gra [Mike Green] | |
| 105 | seibuspisingle099u9yel [couriersud] | |
| 106 | futspy0114gra [Mike Green] | |
| 107 | finalizr0102u5gra [Mike Green] | |
| 108 | gijoe0114gra [Mike Green] | |
| 109 | playch10_0109gre [Mike Green] | |
| 108 | gradius4_0120u3yel [Aaron Giles] | |
| 109 | vegas.c0120u3yel [Aaron Giles] | |
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | Source Changes |
| 114 | 114 | -------------- |
| 115 | Moved Hayaoshi Quiz Ouza Ketteisen to its own driver. [David Haywood] | |
| 115 | Made some minor changes in the inline code. The result of | |
| 116 | atomic_add32 isn't used a lot of the time, so the final addition was | |
| 117 | brought out to allow it to be optimized away. Removed the unnecessary | |
| 118 | delta argument from atomic_increment32 and atomic_decrement32 in | |
| 119 | eminline.h, and added implementations. Changed the condition for | |
| 120 | using rgbsse.h to include 32-bit platforms with SSE enabled. | |
| 121 | [Vas Crabb] | |
| 116 | 122 | |
| 117 | Added coin counters to cabal bootleg and hooked up the 2 sample player | |
| 118 | CPUs in cabal bootleg. It seems there still are some problems, because | |
| 119 | the coin up music is played during the game. [Pierpaolo Prazzoli] | |
| 123 | Did a major clean-up of the input ports in ssv.c. Brought out the | |
| 124 | common joystick, mahjong and quiz input setups, and then used | |
| 125 | PORT_INCLUDE to pull them in when needed. Also brought out the | |
| 126 | common coinage settings, to avoid needless repetition. [Vas Crabb] | |
| 120 | 127 | |
| 121 | More improvements to the Vs. Janshi Brandnew Stars driver. | |
| 122 | [David Haywood] | |
| 128 | Analyzed all driver interfaces (DRIVER_INIT, READ8_HANDLER, etc.) to | |
| 129 | determine which ones should be made static and properly tagged them | |
| 130 | all to reduce global namespace pollution. Some cases turned out to be | |
| 131 | dead code, which was also properly tagged. [Atari Ace] | |
| 123 | 132 | |
| 124 | More SCSP improvements: [El Semi] | |
| 125 | - Fixed endianness issue on 8-bit samples and added interpolation | |
| 126 | - Disabled modulation attempt (should fix the crash problems) | |
| 127 | - Tweeked pitch calculation | |
| 133 | Updated the Tube Panic driver, fixing the background scroll-in (it's | |
| 134 | smooth again now). The problem was caused by wrong synchronization | |
| 135 | between main and slave CPUs. Also modified the video driver to be | |
| 136 | scanline accurate and implemented more accurate interrupt handling. | |
| 137 | [Jarek Burczynski] | |
| 128 | 138 | |
| 129 | Added the repeat count register (reg 0x34) access and immediate value | |
| 130 | load to the MB86233 core (needed by Pilot kids). [El Semi] | |
| 139 | Altered TTL low high levels in res_net.c. This will broaden the color | |
| 140 | range a bit. Since the results are normalized, there is only a limited | |
| 141 | effect visible. [couriersud] | |
| 131 | 142 | |
| 132 | Cleaned up the inputs, and fixed flipscreen in dynax.c. [Luca Elia] | |
| 143 | Cleaned up inputs and added dip locations in ms32.c. Also fixed dips | |
| 144 | in "47pie2" and "akiss". [Sonikos] | |
| 133 | 145 | |
| 134 | Fixed several issues in seibuspi.c: [couriersud] | |
| 135 | - added sound to rdft2us | |
| 136 | - added coin-handling to single board games | |
| 137 | - fix interrupt handling | |
| 138 | - for rfjetus, adds a hack to enable Test-Switch to enter testmode | |
| 139 | if no nvram exists | |
| 146 | Fixed bug that caused incorrect input to be read if multiple inputs | |
| 147 | were mapped to the same mouse input under Windows. [Nathan Woods] | |
| 140 | 148 | |
| 141 | Fixed several issues in the i386 core: [couriersud] | |
| 142 | - the INTR-line for i386 is a "level" line; changed interrupt | |
| 143 | handling to trigger on asserted line | |
| 144 | - in 32bit mode, determine trap/interrupt from gate-header | |
| 145 | - interrupt line is read during two bus cycles. Adjust CYCLES | |
| 146 | accordingly. | |
| 149 | Fixed a bug in the i8051 core that improperly fired the Timer2 | |
| 150 | interrupt when it wasn't enabled. [Jim Stolis] | |
| 147 | 151 | |
| 148 | Added coin DIP switches and "teleport hole" DIP switch to crushs. | |
| 149 | [sonikos] | |
| 152 | Updates to the peplus driver: [Jim Stolis] | |
| 153 | * Added lightpen support | |
| 154 | * Added PE+ Superboard support | |
| 155 | * Added ABC coin optics support | |
| 156 | * Added full I2C eeprom support | |
| 157 | * Added NVRAM support | |
| 158 | * Corrected door closure issues | |
| 159 | * Removed most memory hacks | |
| 160 | * Consolidated machines and inputs | |
| 161 | * New layout for pepp0158 | |
| 150 | 162 | |
| 151 | Bug fixes for the z80gb cpu core: [Wilbert Pol] | |
| 152 | - Fixed cycle count for taking an interrupt | |
| 153 | - Fixed cycle count for BIT X,(HL) instructions | |
| 154 | - Fixed flags in RRCA instruction | |
| 155 | - Fixed DAA instruction | |
| 156 | - Fixed flags in ADD SP,n8 instruction | |
| 157 | - Fixed flags in LD HL,SP+n8 instruction | |
| 163 | Split up the MPU4 driver into a core and driver set up a la NeoGeo. | |
| 164 | Also made some timer fixes, and added some new ROMs added. | |
| 165 | [James Wallace] | |
| 158 | 166 | |
| 159 | Fixed the linking issues when specifying MSVC_BUILD=1 and DEBUG=1. | |
| 160 | [Oliver Stoneberg] | |
| 167 | Fixed problems introduced when the junofrst blitter code was | |
| 168 | simplified. [Chris Hardy] | |
| 161 | 169 | |
| 162 | Fixed a compile error on architectures where "char" is unsigned | |
| 163 | (notably some PowerPC configurations). [Bill Blake] | |
| 170 | American Poker II major rewrite: [Roberto Fresca] | |
| 171 | - Properly dervied clocks from crystals | |
| 172 | - Reworked TILE_GET_INFO to handle the proper tiles/color codes. | |
| 173 | - Fixed interrupts (NMI). | |
| 174 | - Corrected AY8910 frequency to 1.5 MHz to match the real thing. | |
| 175 | - Arranged the AY8910 volume in all games avoiding clips. | |
| 176 | - Corrected the screen visible area. | |
| 177 | - Added NVRAM support. | |
| 178 | - Reworked the memory map, mapping all the hardware I/O ports. | |
| 179 | - Reworked the Inputs for all sets. | |
| 180 | - Added implementation of Operator and Supervisor Keys. | |
| 181 | - Fixed some timing troubles. | |
| 182 | - Added partial DIP switch support with diplocations to all sets. | |
| 183 | - Removed the hack in DRIVER_INIT. | |
| 184 | - Hooked write handlers for output ports. | |
| 185 | - Added watchdog routines. | |
| 186 | - Dumped, hooked, wired and decoded the color PROM in all sets. | |
| 187 | - Modified the refresh rate according to hardware measurements. | |
| 188 | - Wired the lamps for all sets. Created their respective layouts. | |
| 189 | - Splitted the driver to driver/video. | |
| 190 | - Other minor fixes. | |
| 164 | 191 | |
| 165 | Added two more filters to the headon crash sound. Now, only the | |
| 166 | envelopes for the crash sound filters are missing. [couriersud] | |
| 192 | SCSP fixes: [kingshriek] | |
| 193 | * Fixed DECAY1 envelope state to not exit immediately | |
| 194 | * Improved support for LPSLNK and SBCTL | |
| 195 | * Fixed panning calculation bug | |
| 196 | * Fixed case where key-rate scaling is off | |
| 167 | 197 | |
| 168 | Loverboy input fixes: [wolf676] | |
| 169 | - added and verified all DSW | |
| 170 | - added and verified Button1 for both players | |
| 198 | Added support for indicating that DIP switches are reversed in the | |
| 199 | DIP locations view. [Vas Crabb] | |
| 171 | 200 | |
| 172 | Added color PROMs for Cannon Ball. [Rob Walmsley] | |
| 201 | Added DIP locations for Midway Tron and the Nintendo Donkey Kong | |
| 202 | series (dkong.c). [Vas Crabb] | |
| 173 | 203 | |
| 174 | Fixed several out-of-bounds array accesses in the code. [Andi] | |
| 204 | Added an Altivec/VMX implementation of the RGB utilities for our | |
| 205 | friends with G4, G5 and POWER5 CPUs (rgbvmx.h) and added | |
| 206 | rgbint_bilinear_filter and rgbaint_bilinear_filter to rgbsse.h (based | |
| 207 | on rgb_bilinear_filter/rgba_bilinear_filter) for completeness, as | |
| 208 | these functions exist in rgbgen.h. [Vas Crabb] | |
| 175 | 209 | |
| 176 | Fixed mask rom test in prmrsocr. [Pierpaolo Prazzoli] | |
| 177 | ||
| 178 | Fixed 64-bit DRC bug that broke kinst in the previous release. | |
| 210 | Updated model2.c, taitojc.c, and gticlub.c to use the new polygon | |
| 211 | routines. Deprecated the old poly.c and renamed polynew.* to poly.*. | |
| 179 | 212 | [Aaron Giles] |
| 180 | 213 | |
| 181 | Added code to detect potential hotspots in the 64-bit DRC. Added | |
| 182 | hotspots to all the seattle.c games and several of the vegas.c games. | |
| 214 | Unified poly.c callbacks so that tri and quad callbacks work the | |
| 215 | same way. [Aaron Giles] | |
| 216 | ||
| 217 | Fixed display of floating point TMS32031 registers in the debugger. | |
| 183 | 218 | [Aaron Giles] |
| 184 | 219 | |
| 185 | Simplified the osd_work implementation. Removed the concept of shared | |
| 186 | work items. Added new function osd_work_item_queue_multiple() which | |
| 187 | allows efficient queueing of large numbers of work items. Changed | |
| 188 | previous osd_work_item_queue() function into an inline that calls the | |
| 189 | new function. [Aaron Giles] | |
| 220 | Fixed TMS32031 ABSF opcode to work as documented and not produce a | |
| 221 | proper negative. [Aaron Giles] | |
| 190 | 222 | |
| 191 | Updated Voodoo code to use the new work functions. It now queues | |
| 192 | small scanline chunks as independent items rather than using shared | |
| 193 | items. Updated code to also copy some parameters to allow for greater | |
| 194 | overlapping of emulation and rendering. [Aaron Giles] | |
| 195 | 223 | |
| 196 | For Windows work functions, added new scalable lock implementation | |
| 197 | that hopefully has better performance characteristics when scaling | |
| 198 | above 2 CPUs. [Aaron Giles] | |
| 199 | 224 | |
| 200 | For Windows work functions, added statistics gathering code. This is | |
| 201 | on by default for the moment to help point to problems that might be | |
| 202 | encountered with this version. [Aaron Giles] | |
| 203 | ||
| 204 | ||
| 205 | ||
| 206 | 225 | New games added or promoted from NOT_WORKING status |
| 207 | 226 | --------------------------------------------------- |
| 208 | Jongkyo [David Haywood, Nicola Salmoria] | |
| 209 | Hayaoshi Quiz Grand Champion Taikai [David Haywood] | |
| 210 | Hayaoshi Quiz Nettou Namahousou [David Haywood] | |
| 211 | Super Real Mahjong Part 1 (Japan) [David Haywood] | |
| 212 | Hana wo Yaraneba! (Japan) [Luca Elia] | |
| 213 | Hanafuda Hana Tengoku (Japan) [Luca Elia] | |
| 214 | 227 | Player's Edge Plus (PP0516) Double Bonus Poker [Jim Stolis] |
| 228 | Player's Edge Plus (PP0158) 4 of a Kind Bonus Poker [Jim Stolis] | |
| 229 | Player's Edge Plus (PP0188) Standard Draw Poker [Jim Stolis] | |
| 230 | Player's Edge Plus (Set038) Set Chip [Jim Stolis] | |
| 231 | Player's Edge Plus (BE0014) Blackjack [Jim Stolis] | |
| 232 | Player's Edge Plus (KE1012) Keno [Jim Stolis] | |
| 233 | Player's Edge Plus (PS0615) Video Slots [Jim Stolis] | |
| 234 | Player's Edge Plus (PS0716) Video Slots [Jim Stolis] | |
| 235 | Player's Edge Plus (XP000019) Deuces Wild Poker [Jim Stolis] | |
| 236 | Player's Edge Plus (XS000006) Triple Triple Diamond Slots [Jim Stolis] | |
| 237 | MPU4 Unit Test [James Wallace] | |
| 238 | Sigma Poker [Roberto Fresca] | |
| 215 | 239 | |
| 216 | 240 | |
| 217 | 241 | |
| 218 | 242 | New clones added |
| 219 | 243 | ---------------- |
| 220 | Toride II Adauchi Gaiden (Japan) [David Haywood] | |
| 221 | Pang (bootleg, set 3) [David Haywood] | |
| 222 | Super Bobble Bobble (set 1) [David Haywood] | |
| 223 | Airwolf (US) [David Haywood] | |
| 224 | Golden Tee '97 Tournament (v2.43) [Brian Troha] | |
| 244 | Slipstream (950515 HISPANIC) [Guru] | |
| 245 | Kick and Run (US) [Brian Troha] | |
| 246 | American Poker 95 [Roberto Fresca] | |
| 247 | Poker De Win [Roberto Fresca] | |
| 225 | 248 | |
| 226 | 249 | |
| 227 | 250 | |
| 228 | 251 | New games marked as GAME_NOT_WORKING |
| 229 | 252 | ------------------------------------ |
| 230 | GTI Poker [David Haywood] | |
| 231 | Poker? (IGS) [David Haywood] | |
| 232 | Hanajingi [Luca Elia] | |
| 233 | GP World [Andrew Gardner] | |
| 253 | Vegas Poker (Prototype) [James Wallace] | |
| 254 | Sigma Poker 2000 [Roberto Fresca] | |
| 234 | 255 | |
| 235 | 256 | |
| 236 | 257 | |
| 237 | 0.1 | |
| 258 | 0.120u3 | |
| 238 | 259 | ------- |
| 239 | 260 | |
| 240 | IMPORTANT NOTE FOR OSD PORTERS: This build requires a pair of new | |
| 241 | primitives in the OSD synchronization module, as well as some extended | |
| 242 | functionality in the work item management. See below for details. | |
| 243 | 261 | |
| 244 | ||
| 245 | ||
| 246 | 262 | MAMETesters Bugs Fixed |
| 247 | 263 | ---------------------- |
| 248 | cabal0119u2ora [David Haywood] | |
| 264 | neodriv0117u3red [Hairu] | |
| 265 | kof10th0120u2yel [Robbbert] | |
| 266 | 6800basedgames0120u2red [Curt Coder] | |
| 267 | mpatrol0120u2yel [Curt Coder] | |
| 249 | 268 | |
| 250 | 269 | |
| 251 | 270 | |
| 252 | 271 | Source Changes |
| 253 | 272 | -------------- |
| 254 | Fixed Cabal (joystick) submission from previous release. | |
| 255 | [David Haywood] | |
| 273 | Cleaned up the inline assembly for both x86 and PPC, enabled the | |
| 274 | mul32 family assembly stuff on 32-bit x86, and fixed some compiler | |
| 275 | warnings on 64-bit GCC. In addition: [Vas Crabb] | |
| 276 | * Provided single-precision reciprocal approximation code for | |
| 277 | PowerPC and x86 with SSE2. | |
| 278 | * Filled in all other TBD functions in eigccx86.h for completeness. | |
| 279 | * Conditionalised some code in eigccppc.h so that it isn't used | |
| 280 | when the compiler has 64-bit instructions available. | |
| 256 | 281 | |
| 257 | Made a few improvements to dealem (well you can see the game now..) | |
| 258 | [David Haywood] | |
| 282 | Added static qualifiers and renamed symbols in MAME in an effort | |
| 283 | to further tidy up the global namespace. Generally generic names were | |
| 284 | targeted and some symbols that were both static and extern. Some | |
| 285 | specifics: [Atari Ace] | |
| 286 | * K053247_ram was made static throughout and the existing | |
| 287 | K053247_export_config was used to obtain the value in xmen.c. | |
| 288 | * The enums DS1991_STATE and DSP_TYPE were unused and were therefore | |
| 289 | removed. | |
| 290 | * Dead code in cps3.c and thayers.c was discovered and commented out. | |
| 259 | 291 | |
| 260 | ||
| 292 | Ma | |
| 261 | 293 | |
| 262 | Changed parameters to read/write handlers from "address" to an | |
| 263 | unmodified "original_address" parameter (having the passed parameter | |
| 264 | being unmodified makes it easier to determine the original value while | |
| 265 | debugging). [Nathan Woods] | |
| 294 | Obsoleted the GAMEB macro, which is no longer necessary. [Atari Ace] | |
| 266 | 295 | |
| 267 | Fixed c | |
| 296 | Fixed ca | |
| 268 | 297 | |
| 269 | Changed the following x86 instructions to read/write an entire word | |
| 270 | rather than two separate bytes: [Philip Bennett] | |
| 271 | - mov_axdisp | |
| 272 | - mov_dispax | |
| 273 | - stosw (8086 only) | |
| 274 | - rep stosw (8086 only) | |
| 275 | Also tweaked handling of x86 WAIT instruction. | |
| 298 | Some build-related improvements to the sound cores: [Atari Ace] | |
| 299 | * The SCSP dependency on mame/drivers/stv.c was removed allowing it | |
| 300 | to built independent of the driver. | |
| 301 | * The WAVE dependency on MESS code was made explicit, so it can be | |
| 302 | built independentally of MESS. | |
| 303 | * VOTRAX can now be built independentally of SAMPLES. | |
| 304 | * The YM2612 core now can be built without including the YM3438 core. | |
| 305 | * Unnecessary uses of BUILD_ and HAS_ macros have been removed. | |
| 306 | * BUILD_ instead of HAS_ macros are used in 3812intf.c for | |
| 307 | consistency with the other fm cores. | |
| 276 | 308 | |
| 277 | ||
| 309 | Added | |
| 278 | 310 | |
| 279 | Cleaned up the include file usage in the code: [Atari Ace] | |
| 280 | - Removed dead prototypes | |
| 281 | - Added missing self-#includes | |
| 282 | - Added missing source comments in mame/includes | |
| 283 | - Migrated the few #include "driver.h" lines from driver header | |
| 284 | files to source files (which is the common idiom). | |
| 285 | - Eliminated #include "mame.h", "osdcore.h" et cetera from driver | |
| 286 | files where #include "driver.h" would suffice. | |
| 287 | - Removed unused srmp6.h and 9900stat.h | |
| 311 | Corrected some errors in the SH4 core and implemented store queues | |
| 312 | and the basics of DMA. Added a call to simulate dma transfers with | |
| 313 | external devices. [Samuele Zannoli] | |
| 288 | 314 | |
| 289 | Added the rom loading for the various 5*XX roms, which are dumped but | |
| 290 | not yet hooked up. [David Haywood] | |
| 291 | ||
| 292 | Fixed error messages output from option.c. [Christophe Jaillet] | |
| 293 | ||
| 294 | gstream driver update: [Pierpaolo Prazzoli] | |
| 295 | - Changed to use a default nvram handler | |
| 296 | - Checked the inputs | |
| 297 | - Aligned the sprites | |
| 298 | - Added some comments about oki banking | |
| 299 | ||
| 300 | Major Sega Model 2 rewrite: [Ernesto Corvi] | |
| 301 | - Decoupled the geometry engine code from the hardware rasterizer. | |
| 302 | At this point, we could add emulation of the geometry DSPs for | |
| 303 | the 2B and 2C models, and hook them directly to the rasterizer. | |
| 304 | For the original and 2A models, an HLE geometry engine is provided | |
| 305 | (currently in use for all models). | |
| 306 | - Full Geometry Engine simulation, including support for specular, | |
| 307 | multiple centers and dual polygon RAM. | |
| 308 | - Support for all textured/transparent/checkered rendering modes. | |
| 309 | - Improved texel/luma modulation | |
| 310 | - Improved viewport clipping | |
| 311 | - Improved z clipping | |
| 312 | - Extensive notes and documentation. | |
| 313 | - Greatly improved near Z-Clipping, still not perfect though. | |
| 314 | - Improved perspective-correct texturing for large textures. | |
| 315 | - Improved Z-Sorting | |
| 316 | ||
| 317 | Changed Machine to machine in several places where feasible. | |
| 318 | [Atari Ace] | |
| 319 | ||
| 320 | Added decryption of Jongkyo. [Nicola Salmoria] | |
| 321 | ||
| 322 | The OSD layer is now required to supply to additional synchronization | |
| 323 | primitives: osd_compare_exchange32() and osd_compare_exchange64(). | |
| 324 | These primitives should implement an atomic compare and exchange of | |
| 325 | 32-bit and 64-bit values, respectively. Added implementations of these | |
| 326 | functions to the Windows OSD layer. [Aaron Giles] | |
| 327 | ||
| 328 | Defined two new inline functions that are built on the new OSD | |
| 329 | primitives: osd_compare_exchange_ptr(), which performs an atomic | |
| 330 | compare/exchange on a pointer of the appropriate size, and | |
| 331 | osd_sync_add() which atomically adds a value to a location in memory. | |
| 315 | Expanded polynew.c to support quad rendering. Converted midvunit.c | |
| 316 | over to using the new quad rendering, which fixes a number of | |
| 317 | rendering issues that have plagued the driver since the start. | |
| 332 | 318 | [Aaron Giles] |
| 333 | 319 | |
| 334 | Changed implementation of OSD work queues that are created with the | |
| 335 | WORK_QUEUE_FLAG_MULTI hint. Such queues now create n-1 threads, where | |
| 336 | n in the number of logical processors in the system. This allows the | |
| 337 | main thread to continue accomplishing things while other threads | |
| 338 | process the work. If the main thread subsequently calls | |
| 339 | osd_work_queue_wait(), it will then dynamically "jump in" and help | |
| 340 | the other threads complete all the work items. [Aaron Giles] | |
| 320 | Added Z-clipping logic to polynew.c. Converted namcos22 over to using | |
| 321 | that code. Simplified namcos22 significantly, working in quads | |
| 322 | throughout the lower-level pipeline and then handing the results off | |
| 323 | to polynew.c. [Aaron Giles] | |
| 341 | 324 | |
| 342 | Added new work item flag WORK_ITEM_FLAG_SHARED. When specified on a | |
| 343 | work item that is queued to a work queue created with the | |
| 344 | WORK_QUEUE_FLAG_MULTI hint, it means that all threads will be | |
| 345 | dispatched to process the one work item, instead of the first thread | |
| 346 | removing it. These "shared" work items are only considered complete | |
| 347 | when all processing threads have returned. [Aaron Giles] | |
| 325 | Updated model3.c to use the new poly code, and changed much of the | |
| 326 | low-level implementation to make things easier. [Aaron Giles] | |
| 348 | 327 | |
| 349 | Added support for controlling multithreading behavior through an | |
| 350 | environment variable OSDPROCESSORS. To override the default behavior, | |
| 351 | set OSDPROCESSORS equal to the number of logical processors you wish | |
| 352 | the OSD layer to pretend you have. [Aaron Giles] | |
| 328 | Defined a couple of new functions in eminline.h: atomic_increment32 | |
| 329 | and atomic_decrement32. [Aaron Giles] | |
| 353 | 330 | |
| 354 | Changed the 3dfx Voodoo emulation code to take advantage of the new | |
| 355 | threading mechanisms above. It now creates a work queue with the | |
| 356 | WORK_QUEUE_FLAG_MULTI flag set, and uses shared work items to spread | |
| 357 | rasterization work across multiple processors. Note that this support | |
| 358 | should be considered experimental; under some circumstances it is | |
| 359 | known to deadlock. If you encounter problems, set OSDPROCESSORS to 1 | |
| 360 | to effectively produce the previous behavior. [Aaron Giles] | |
| 361 | 331 | |
| 362 | Added "top 20" dedicated rasterizers for all the Seattle games and | |
| 363 | Gauntlet Legends/Dark Legacy. These improve rasterization performance | |
| 364 | by another 10-20%. [Aaron Giles] | |
| 365 | 332 | |
| 366 | Fixed several more bugs in the 64-bit MIPS recompiler. It is now | |
| 367 | capable of running the Seattle games and the 3D Gauntlets. | |
| 368 | [Aaron Giles] | |
| 369 | ||
| 370 | ||
| 371 | ||
| 372 | 333 | New games added or promoted from NOT_WORKING status |
| 373 | 334 | --------------------------------------------------- |
| 374 | Super Hana Paradise [Luca Elia] | |
| 375 | Hanafuda Hana Gokou [Luca Elia] | |
| 376 | Mahjong Tian Jiang Shen Bing [Pierpaolo Prazzoli] | |
| 335 | Every Second Counts [Philip Bennett] | |
| 336 | Treble Top [Philip Bennett] | |
| 337 | Quizvaders [Philip Bennett] | |
| 377 | 338 | |
| 378 | 339 | |
| 379 | 340 | |
| 380 | 341 | New clones added |
| 381 | 342 | ---------------- |
| 382 | Nekketsu Koukou Dodgeball Bu (Japan) [David Haywood, Team Japump!] | |
| 383 | Puzzle Game Rong Rong (Japan) [Luca Elia] | |
| 384 | Legend of Hero Tonma (Japan) [David Haywood] | |
| 385 | Legend of Hero Tonma (bootleg, set 2) [David Haywood] | |
| 386 | IQ-Block (V127M, V113FR) [Pierpaolo Prazzoli] | |
| 387 | Cabal (Alpha Trading) [David Haywood] | |
| 388 | Puzzle & Action: Tant-R (Japan) (bootleg set 3) [David Haywood] | |
| 389 | Shinobi (Datsu bootleg) [David Haywood] | |
| 390 | Shinobi (Star bootleg, System 16A) [David Haywood] | |
| 391 | Crack Down (World, FD1094 317-0058-04c) [Arzeno Fabrice, Chris Hardy] | |
| 392 | Super Pang (World 900914, bootleg) [David Haywood] | |
| 393 | Pang (bootleg, set 2) [David Haywood] | |
| 394 | Tehkan World Cup (set 2, bootleg?) [David Haywood] | |
| 395 | DJ Boy (set 2) [David Haywood] | |
| 396 | Hunchback (set 2) [David Haywood] | |
| 397 | Double Dragon (bootleg with M6803) [David Haywood] | |
| 398 | Cannon Ball (Pacman Hardware) [David Haywood] | |
| 343 | Extermination (Japan) [Corrado Tomaselli] | |
| 344 | Gang Busters (set 2) [Patrik Styrnell] | |
| 345 | Trog (rev LA5 03/29/91) [icronnya77] | |
| 399 | 346 | |
| 400 | 347 | |
| 401 | 348 | |
| 402 | 349 | New games marked as GAME_NOT_WORKING |
| 403 | 350 | ------------------------------------ |
| 404 | Jongkyo [David Haywood, Nicola Salmoria] | |
| 405 | Vs. Janshi Brandnew Stars [David Haywood] | |
| 351 | Inquizitor [Philip Bennett] | |
| 406 | 352 | |
| 407 | 353 | |
| 408 | 354 | |
| 409 | 0.1 | |
| 355 | 0.120u2 | |
| 410 | 356 | ------- |
| 411 | 357 | |
| 412 | 358 | |
| 413 | 359 | MAMETesters Bugs Fixed |
| 414 | 360 | ---------------------- |
| 415 | model2c_crx0119u1red [R. Belmont] | |
| 361 | hornet0120u1red [Ville Linde] | |
| 362 | srmp6_0120u1ora [Aaron Giles] | |
| 416 | 363 | |
| 417 | 364 | |
| 418 | 365 | |
| 419 | 366 | Source Changes |
| 420 | 367 | -------------- |
| 421 | Changed gfx_decode structures so that they are defined abstractly | |
| 422 | by macros rather than directly specifying the structures. Added | |
| 423 | new macros GFXDECODE_START/GFXDECODE_ENTRY/GFXDECODE_END to | |
| 424 | describe the gfx_decode information. Converted all drivers over to | |
| 425 | using the new macros. [Atari Ace] | |
| 368 | Rewrote ACIA6850 implementation. [Curt Coder] | |
| 426 | 369 | |
| 427 | Fixed NMI handling in h6280 CPU core. [Wilbert Pol] | |
| 370 | Did a complete overhaul of the Mad Alien driver. [Stefan Jokish] | |
| 371 | - merged memory maps and added mirror addresses | |
| 372 | - doubled sound chip frequency | |
| 373 | - implemented IRQ acknowledge for the sound CPU | |
| 374 | - added stub functions for missing discrete sounds | |
| 375 | - re-implemented tilemaps (now the tunnel walls scroll into view) | |
| 376 | - hooked up 6845 CRT controller | |
| 377 | - made several fixes related to color handling | |
| 378 | - cleaned up inputs and added dip switch locations | |
| 379 | - raised main CPU speed (guesswork) | |
| 380 | - added save state support | |
| 428 | 381 | |
| 429 | Fixed vaportra to use an ASSERT/CLEAR mechanism instead of PULSE_LINE | |
| 430 | for interrupt signally. [Wilbert Pol] | |
| 382 | Repaired the IC24 timer behaviour to fix some of Deal 'Em's bugs, | |
| 383 | and also added inputs. [James Wallace] | |
| 431 | 384 | |
| 432 | Cleaned up input ports in sg1000a.c. Added DIP switch for the coins | |
| 433 | in dokidoki and service switch. Added DIP switch for flip screen in | |
| 434 | psychic5. [sonikos] | |
| 385 | Added save state support to skykid. [Mike Haaland] | |
| 435 | 386 | |
| 436 | Cleans up the input port for macrossp.c driver and adds dip | |
| 437 | locations. [Brian Troha] | |
| 387 | Fixed tiny.mak based on new source reorg. [Tiago Pierezan Camargo] | |
| 438 | 388 | |
| 439 | Adds dip locations and changes the Japanese inputs into | |
| 440 | PORT_INCLUDE and PORT_MODIFY. [Brian Troha] | |
| 389 | Added support for CR-589 firmware to the System 573 driver. Made | |
| 390 | substantial changes to the SCSI support, making it require fewer | |
| 391 | hacks, and allowing one device to be derived from another. Also | |
| 392 | added save state support. [smf] | |
| 441 | 393 | |
| 442 | Added macros to clean up definitions of the discrete sound | |
| 443 | interfaces. At the same time, made them all const. [Atari Ace] | |
| 394 | Added SCI support to M6803/HD63701. [Curt Coder] | |
| 444 | 395 | |
| 445 | ||
| 396 | Fixed | |
| 446 | 397 | |
| 447 | More srmp6 improvements. [686] | |
| 398 | Switched model1 lookup functions to be index based rather than | |
| 399 | requiring a linear scan. [Atari Ace] | |
| 448 | 400 | |
| 449 | Two small Model 2 fixes: [Ernesto Corvi] | |
| 450 | - fixed triangle parser; all objects should be structurally | |
| 451 | correct now | |
| 452 | - fixed normal transform to not use the translation vectors | |
| 401 | Added generic I2C bus memory support. Hooked up to the cubocd32 | |
| 402 | driver. [smf] | |
| 453 | 403 | |
| 454 | Cleaned up code to make code and data static where possible and | |
| 455 | remove some dead code. [Atari Ace] | |
| 404 | Cleaned up inline assembly support: [Aaron Giles] | |
| 405 | * moved all inlinable functions into new module eminline.h | |
| 406 | * defined a number of new inline functions, including: | |
| 407 | - 32x32 -> 64 bit multiply | |
| 408 | - fast approximate floating point reciprocal | |
| 409 | * removed old inline definitions from osinline.h, osd_cpu.h, etc. | |
| 410 | * eminline.h contains C implementations of everything | |
| 411 | * new module eigccx86.h contains GCC-compatible x86/64 versions | |
| 412 | * new module eigccppc.h contains GCC-compatible PowerPC versions | |
| 413 | * eminline.h automatically detects GCC environments and includes | |
| 414 | appropriate file | |
| 415 | * osinline.h now only used in non-GCC environments | |
| 416 | * updated osd/windows/osinline.h to contain MSVC-compatible versions | |
| 456 | 417 | |
| 457 | SCSP improvements: [R. Belmont, ElSemi] | |
| 458 | - fixed issue with changing the pitch of an active voice set to | |
| 459 | backwards or bidirectional loop | |
| 460 | - removed fake reverb | |
| 461 | - fixed internal DSP to operate properly | |
| 462 | - rewrote timers and interrupt handling | |
| 463 | - fixed operation when 2 SCSPs are present | |
| 418 | Added NORM implementation to the TMS32031 core. [Aaron Giles] | |
| 464 | 419 | |
| 465 | Fixed sound in almost all SCSP-equipped Model 2 games. [R. Belmont] | |
| 420 | Created new rgbutil module which consists of inline functions for | |
| 421 | common RGB manipulation. This module can be accelerated with SSE2 or | |
| 422 | other SIMD operations. By default, only 64-bit Intel builds make use | |
| 423 | of SSE, since it can be assumed on those platforms. Reimplemented the | |
| 424 | namcos22 rasterizer in terms of these inline functions. Also updated | |
| 425 | the gaelco3d rasterizer to use this module for faster bilinear | |
| 426 | filtering. [Aaron Giles] | |
| 466 | 427 | |
| 467 | Added sound hardware and fixed sound ROM loading in Model 3 games. | |
| 468 | [R. Belmont] | |
| 469 | ||
| 470 | Created an options_output_diff_ini_file() API, which is similar to | |
| 471 | options_output_ini_file(), but only outputs the options which are | |
| 472 | different than a base core_options. Changed INI outputting (and | |
| 473 | hence the -cc option) to omit headers that do not contain any | |
| 474 | options. [Nathan Woods] | |
| 475 | ||
| 476 | Hooked up sound in discoboy. [Tomasz Slanina] | |
| 477 | ||
| 478 | Renamed old gfx_decode structure to gfx_decode_entry in order to | |
| 479 | catch remaining/new drivers that aren't using the new macros. | |
| 428 | Made some progress on the Midway Zeus-based system. The 3d command | |
| 429 | stream is now parsed and the format is partially understood, enough to | |
| 430 | display some polygons but with incorrect textures in Mortal Kombat 4. | |
| 480 | 431 | [Aaron Giles] |
| 481 | 432 | |
| 482 | Changed profiler so that it is independently selected versus the | |
| 483 | debug build. Built with MAME_PROFILER=1 to enable the profiler on | |
| 484 | a non-debug build. [Aaron Giles] | |
| 485 | 433 | |
| 486 | Fixed MIPS3 disassembly of j/jal instructions. [Aaron Giles] | |
| 487 | 434 | |
| 488 | Switched MIPS3 64-bit DRC over to new system that is more aggressive | |
| 489 | about register allocation and mapping. Sadly, there is little to no | |
| 490 | obvious performance benefit, but the resulting code is better | |
| 491 | organized. [Aaron Giles] | |
| 492 | ||
| 493 | Fixed nasty x86emit bug involving 16-bit opcodes on 64-bit systems. | |
| 494 | [Aaron Giles] | |
| 495 | ||
| 496 | Created new generic x86/x64 logging system x86log, and updated both | |
| 497 | MIPS3 DRC cores to use it. [Aaron Giles] | |
| 498 | ||
| 499 | Created new generic DRC frontend management. Future work involves | |
| 500 | retooling the MIPS3 frontend around this new architecture. | |
| 501 | [Aaron Giles] | |
| 502 | ||
| 503 | ||
| 504 | ||
| 505 | 435 | New games added or promoted from NOT_WORKING status |
| 506 | 436 | --------------------------------------------------- |
| 507 | Loverboy [David Haywood] | |
| 508 | Mahjong Shinkirou Deja Vu (Japan) [Luca Elia] | |
| 509 | Final Godori (Korea, version 2.20.5915) [Pierpaolo Prazzoli] | |
| 510 | Jibun wo Migaku cultures School Mahjon Hen [Pierpaolo Prazzoli] | |
| 511 | Mahjong Fantastic Love (Japan) [Luca Elia] | |
| 512 | Domino Block [Tomasz Slanina, David Haywood] | |
| 437 | Konami CD-ROM Drive Updater (700A04) [smf] | |
| 438 | Vs. Janshi Brandnew Stars [sonikos] | |
| 513 | 439 | |
| 514 | 440 | |
| 515 | 441 | |
| 516 | 442 | New clones added |
| 517 | 443 | ---------------- |
| 518 | Fighter's History (Japan ver 42-03) [Team Japump!] | |
| 519 | Janyou Part II (ver 7.03, July 1 1983) [Team Japump!] | |
| 444 | Eco Fighters (USA 940215) [Nicola Salmoria, Razoola] | |
| 520 | 445 | |
| 521 | 446 | |
| 522 | 447 | |
| 523 | 448 | New games marked as GAME_NOT_WORKING |
| 524 | 449 | ------------------------------------ |
| 525 | Jan Oh [Luca Elia] | |
| 526 | Mahjong Vegas (Japan) [Luca Elia] | |
| 527 | Esh's Aurunmilla [Andrew Gardner] | |
| 528 | Mirage Youjuu Mahjongden (Japan) [Team Japump!] | |
| 450 | Time Machine v2.0 [James Wallace] | |
| 451 | Jet Wave [Ville Linde, Guru] | |
| 529 | 452 | |
| 530 | 453 | |
| 531 | 454 | |
| 532 | 0.1 | |
| 455 | 0.120u1 | |
| 533 | 456 | ------- |
| 534 | 457 | |
| 535 | 458 | |
| 536 | 459 | MAMETesters Bugs Fixed |
| 537 | 460 | ---------------------- |
| 538 | createconfig+debug0119yel [Nathan Woods] | |
| 539 | jrpacman0119gre [Aaron Giles] | |
| 461 | ikki0120yel [robiza] | |
| 462 | buckrog0118u2yel [couriersud] | |
| 540 | 463 | |
| 541 | 464 | |
| 542 | 465 | |
| 543 | 466 | Source Changes |
| 544 | 467 | -------------- |
| 545 | Fixed crash/display corruption in System C2 and System 18 games. | |
| 546 | [David Haywood] | |
| 468 | Documented information about the various Cannonball sets. | |
| 469 | [stephh] | |
| 547 | 470 | |
| 548 | Synchronized the MB86233 core with ElSemi's, fixing a few bugs | |
| 549 | along the way. [Ernesto Corvi] | |
| 471 | Hooked up the roz layer, fg layer and sprites to f1gpb. Still | |
| 472 | missing some video offsets, oki banking and sprites priority. | |
| 473 | [Pierpaolo Prazzoli] | |
| 550 | 474 | |
| 551 | Fixed synchronization code in the Model 2 driver. [Ernesto Corvi] | |
| 475 | Updates for the dominob.c driver: [stephh] | |
| 476 | - fixed dip switches | |
| 477 | - fixed inputs | |
| 478 | - added a couple of notes | |
| 552 | 479 | |
| 553 | Fixed SCALER, SCALERL, and ATANRL opcodes in the i960 core. | |
| 554 | [Ernesto Corvi] | |
| 480 | Updated peplus driver and related components: [Jim Stolis] | |
| 481 | - added internal layouts for the games | |
| 482 | - fixed several i8051 issues... | |
| 483 | * Fixed a bug with some opcodes having the wrong cycle counts | |
| 484 | * Fixed a bug where determining the proper timer mode | |
| 485 | * Fixed a bug where determining the proper serial transmit mode | |
| 486 | * Added support for split timer mode | |
| 555 | 487 | |
| 556 | Updates to the gdrawpkr driver: [Roberto Fresca] | |
| 557 | - Added sound support to "El Grande - 5 Card Draw". | |
| 558 | - All CPU and sound clocks derived from #defined crystal values. | |
| 559 | - Some minor input cleanups. | |
| 488 | Improved multiprocessor Voodoo performance by reducing contention | |
| 489 | during rendering. Extended the system to allow for more overlap | |
| 490 | between rendering and emulation. [couriersud, Aaron Giles] | |
| 560 | 491 | |
| 561 | ARM7 core fixes: [R. Belmont] | |
| 562 | - Fixed unaligned reads/writes (again) | |
| 563 | - Fixed minimum instruction bytes to account for Thumb mode | |
| 564 | - Fixed missing dependency in ARM7 build rule | |
| 565 | - Fixed Thumb mode ASR instruction | |
| 492 | Fixed a crash in the input system when you configure joypads and | |
| 493 | then unplug them and press Esc on the system info screen. | |
| 494 | [R. Belmont] | |
| 566 | 495 | |
| 567 | Added newly-dumped BIOS ROMs and preliminary emulation of the SPU | |
| 568 | board in Pop'n Music 7 to the Firebeat driver. [Ville Linde] | |
| 496 | Defined strict types for CPU and sound chips. Removed unnecessary | |
| 497 | cpu_ prefix from several structure members. [Atari Ace] | |
| 569 | 498 | |
| 570 | Cleaned up input ports in the taito_z.c driver. [Brian Troha] | |
| 499 | Fixed the m4510 cpu core from not updating the instruction cycle | |
| 500 | counter. [Wilbert Pol] | |
| 571 | 501 | |
| 572 | Updated the sources to support removing -wno-unused-function. Dead | |
| 573 | code has been identified with #ifdef UNUSED_FUNCTION to allow for | |
| 574 | further analysis and potential future removal. [Atari Ace] | |
| 502 | Fixed memory access for m6509 instructions 91 and b1. [Wilbert Pol] | |
| 575 | 503 | |
| 576 | Fixed a number of issues in the h6280 CPU core: [Wilbert Pol] | |
| 577 | - Taking of interrupts is delayed to respect a pending instruction | |
| 578 | already in the instruction pipeline. | |
| 579 | - Added 1 cycle for decimal mode ADC and SBC instructions. | |
| 580 | - Changed cycle counts for CSH and CSL instructions to 3. | |
| 581 | - Added T flag support to the SBC instruction. | |
| 582 | - Fixed ADC T flag to set the Z flag based on the value read. | |
| 583 | - Added 3 cycle penalty to ADC, AND, EOR, ORA, and SBC instructions | |
| 584 | when the T flag is set. | |
| 585 | - Fixed cycle count and support for 65536 byte blocks for the TAI, | |
| 586 | TDD, TIA, TII, and TIN instructions. | |
| 587 | - Fixed RDWORD macro in the disassembler. | |
| 588 | - Fixed setting of N and V flags in the TST instructions. | |
| 589 | - Removed unneeded debug_mmr code. | |
| 590 | - Fixed TSB and TRB instructions. | |
| 591 | - Added 1 delay when accessing the VDC or VCE areas. | |
| 592 | - Implemented low and high speed cpu modes. | |
| 504 | Changed osdcore.h to include osinline.h and allow for external | |
| 505 | inline definitions of synchronization primitives. Also added a new | |
| 506 | work queue hint WORK_QUEUE_FLAG_HIGH_FREQ which indicates that we | |
| 507 | should spin aggressively waiting for new items. | |
| 508 | [couriersud, Vas Crabb] | |
| 593 | 509 | |
| 594 | Moved srmp5 (Super Real Mahjong P5) to separate driver (from | |
| 595 | st0016.c). Preliminary video hw emulation. Not playable, no sound. | |
| 596 | [Tomasz Slanina] | |
| 510 | Enabled common linker warnings in the makefile. [Oliver Stoneberg] | |
| 597 | 511 | |
| 598 | Fixed DIP switches in the mario driver. [stephh] | |
| 512 | Fixed a corner case in the SCSP involving timers which are polled | |
| 513 | with their IRQ enable shut off. [R. Belmont] | |
| 599 | 514 | |
| 600 | Major Namco System 21 update. Changes include: [Phil Stroffolino] | |
| 601 | - corrections to eprom handling (affects Namco System2 as well) | |
| 602 | - scroll fix for sprite emulation in namcoic.c | |
| 603 | - working Starblade, Cybersled, Solvalou with full 3d | |
| 604 | - graphics should be 100% except for the depth cueing tables, which | |
| 605 | are internal and need to be reconstructed | |
| 606 | - Air Combat is improved, but is locking up in 118s because of | |
| 607 | incomplete watchdog emulation | |
| 608 | - Winning Run hardware is not yet working in this update | |
| 515 | Namco System 21 update: [Phil Stroffolino] | |
| 516 | - namconb1 sprites no longer broken | |
| 517 | - fixed missing 3d gfx in Cybersled | |
| 518 | - gradient colors in starblade | |
| 519 | - more accurate depth cueing | |
| 520 | - fixed crash in 2nd stage of Starblade | |
| 521 | - fixed lockups in Air Combat and Solvalou | |
| 522 | - fixes to sprite priority (see Solvalou mountain range) | |
| 523 | - hooked up translucency (palette shift) effect | |
| 609 | 524 | |
| 610 | Fixed regression in undoukai caused by the REGION_CPU1 decoupling | |
| 611 | from RAM. [Pierpaolo Prazzoli] | |
| 612 | ||
| 613 | SCSP fixes: [R. Belmont] | |
| 614 | * Fix writes to the hole in the SCSP address space (0x430 to 0x5ff) | |
| 615 | to not trash global registers | |
| 616 | * Fixed SCSP DMA to not read random memory for its' registers | |
| 617 | ||
| 618 | Added minimal built-in layout for showing the lamps in Video Pinball. | |
| 619 | [Mr. Do!] | |
| 620 | ||
| 621 | Big Model 2 update. There's so much stuff improved, I'm just going to | |
| 622 | list what's not working: [Ernesto Corvi, El Semi] | |
| 623 | - There's still a glitch on the triangle parser somewhere. | |
| 624 | Noticeable on the Sega logo in motoraid, the selection arrow in | |
| 625 | dynamcop's player select screen and many other games. It might be | |
| 626 | the culprit of the road in daytona looking wacky. | |
| 627 | - There's a problem with the z clipping. Some tri's close to the | |
| 628 | camera are clipped before they should. Some others should be | |
| 629 | clipped but are not, and are blocking the viewport for a frame | |
| 630 | or two. | |
| 631 | - Sub-windows are not implemented yet. Visible on dynacop's mission | |
| 632 | select, Sega Rally car select, and others. | |
| 633 | - Most decal textures flicker on and off between frames. Maybe a z | |
| 634 | coordinate float resolution issue after projection? | |
| 635 | - Textures wrap by default. They should only wrap when the | |
| 636 | appropriate flag is set only. Not sure what to do when we're not | |
| 637 | wrapping. | |
| 638 | ||
| 639 | Improvements to the Z180 core: [Pierpaolo Prazzoli] | |
| 640 | - added the 2 Programmable Reload Timers | |
| 641 | - fixed the Internal I/O Registers remapping | |
| 642 | - added logical -> physical memory translation | |
| 643 | - disabled loops hack | |
| 644 | - removed "extra icount" | |
| 645 | - changed interrupts handling. Now they're checked as in Z80 core | |
| 646 | - simplified RETN and EI opcodes | |
| 647 | - fixed PRT interrupts | |
| 648 | - cleared both interrupts flip flops when taking any irq | |
| 649 | - added _IFF2 = _IFF1; just before _IFF1 = 0; when taking an NMI | |
| 650 | ||
| 651 | Removed kludge in 20pacgal which is no longer necessary with proper | |
| 652 | Z180 emulation. Sound now works as well. [Pierpaolo Prazzoli] | |
| 653 | ||
| 654 | Fixed some Dip Switches and added some extra notes to othunder.c | |
| 655 | driver. Also added some notes to opwolf.c driver. [stephh] | |
| 656 | ||
| 657 | Began moving the MegaTech/MegaPlay drivers over to the new Genesis | |
| 658 | core code. [David Haywood] | |
| 659 | ||
| 660 | Identified a number of additional new opcodes for Risky Challenge/ | |
| 661 | Gussun. [robiza] | |
| 662 | ||
| 663 | Fixed Voodoo video timing according to the manual, including blanking | |
| 664 | periods and vsync interrupts. This makes Carnevil and some other games | |
| 665 | run once again at their proper speed. [Aaron Giles] | |
| 666 | ||
| 667 | Updated Voodoo drawing code to track changes to the front buffer and | |
| 668 | allow skipping unrendered frames for more even framerates. | |
| 525 | Changed Model 2 rendering to use pre-clipped Z values for sorting. | |
| 669 | 526 | [Aaron Giles] |
| 670 | 527 | |
| 671 | Fixed hang when attempting to move windows with the debugger active | |
| 672 | and multithreading enabled. [Aaron Giles] | |
| 673 | ||
| 674 | Added preliminary attempt at a new x64 dynamic recompiler for the | |
| 675 | MIPS 3/4 CPUs. The current version works enough to run a few basic | |
| 676 | games (kinst, carnevil), but many others fail. Furthermore, this | |
| 677 | version is already being supplanted by a more advanced version that | |
| 678 | does register allocation and constant folding. For now it is disabled | |
| 679 | by default. [Aaron Giles] | |
| 680 | ||
| 681 | Fixed a few more 64-bit disassembler problems in i386dasm.c. Also | |
| 682 | fixed several 64-bit errors in the code generators in x86emit.h. | |
| 528 | Properly identified bill inputs in Midway Y-unit driver games. | |
| 683 | 529 | [Aaron Giles] |
| 684 | 530 | |
| 685 | Added support in the debugger memory view for 8-byte chunk sizes. | |
| 686 | Fixed long-standing bug that failed to show unmapped logical addresses | |
| 687 | as asterisks. Also added new menu items to the Windows debugger to | |
| 688 | support viewing logical or physical memory. [Aaron Giles] | |
| 531 | Added more instrumentation and added some extra paranoia to the | |
| 532 | winwork code. [Aaron Giles] | |
| 689 | 533 | |
| 690 | Removed limitation that tilemap tile widths must be divisible by | |
| 691 | 2, except in the 4bpp case, where an assert now catches this case. | |
| 534 | Fixed some incorrect code in the ADSP2100 external flag handling. | |
| 692 | 535 | [Aaron Giles] |
| 693 | 536 | |
| 694 | Experimentally changed full screen behavior when using Direct3D so | |
| 695 | that if -switchres is NOT enabled, then we don't create a fullscreen | |
| 696 | Direct3D device. This minimizes large graphics card transitions (in | |
| 697 | particular it does not disable glass in Vista) when you go full | |
| 698 | screen. If you want the old behavior, run with -switchres and specify | |
| 699 | a -resolution parameter equal to your desktop screen size. | |
| 700 | [Aaron Giles] | |
| 537 | Created new module polynew.c which combines triangle setup, | |
| 538 | rasterization, and Voodoo-like multiprocessor support. Coverted | |
| 539 | Gaelco3D, Midway V-Unit, Namco System 22, and Voodoo drivers over | |
| 540 | to the new system. [Aaron Giles] | |
| 701 | 541 | |
| 542 | Added threadid parameter to work item callbacks. This allows for | |
| 543 | keeping per-thread information by the callbacks. [Aaron Giles] | |
| 702 | 544 | |
| 703 | 545 | |
| 546 | ||
| 704 | 547 | New games added or promoted from NOT_WORKING status |
| 705 | 548 | --------------------------------------------------- |
| 706 | Deer Hunting USA [Luca Elia] | |
| 707 | Turkey Hunting USA [Luca Elia] | |
| 708 | Wing Shooting Championship [Luca Elia] | |
| 709 | Trophy Hunting - Bear & Moose [Luca Elia] | |
| 710 | Panel & Variety Akamaru Q Jousyou Dont-R [Team Japump] | |
| 711 | Cyber Sled [Phil Stroffolino] | |
| 712 | Solvalou [Phil Stroffolino] | |
| 713 | Super Real Mahjong P6 (Japan) [686] | |
| 714 | Ippatsu Gyakuten [BET] (Japan) [Luca Elia] | |
| 715 | Joryuu Syougi Kyoushitsu (Japan) [Luca Elia] | |
| 716 | Mazin Wars / Mazin Saga (Mega Play) [David Haywood] | |
| 717 | Grand Slam (Mega Play) [David Haywood] | |
| 549 | Mahjong Hot Gimmick Integral (Japan) [Guru, David Haywood] | |
| 550 | Tottemo E Jong [David Haywood, Team Japump!] | |
| 551 | Good E Jong -Kachinuki Mahjong Syoukin Oh!!- | |
| 552 | [David Haywood, Team Japump!] | |
| 553 | Teraburst [icronnya77, Ville Linde] | |
| 718 | 554 | |
| 719 | 555 | |
| 720 | 556 | |
| 721 | 557 | New clones added |
| 722 | 558 | ---------------- |
| 723 | Scramble (bootleg) [David Haywood] | |
| 724 | Alien Storm (bootleg, set 2) [David Haywood] | |
| 725 | Zero Team Selection [David Haywood] | |
| 726 | Passing Shot (Japan, 4 Players, System 16A, FD1094 317-0071) | |
| 727 | [Arzeno Fabrice, ShinobiZ, Gerald Coy] | |
| 728 | Pound for Pound (Japan) [Team Japump] | |
| 729 | Big Event Golf (Japan) [Team Japump] | |
| 730 | Special Criminal Investigation (Japan) [Team Japump] | |
| 731 | Royal Mahjong (Japan, v1.13) [Team Japump] | |
| 732 | Cyber Sled (Japan) [Brian Troha] | |
| 733 | Crowns Golf (new set) [Arzeno Fabrice] | |
| 734 | Don Den Lover Vol. 1 - Shiro Kuro Tsukeyo! (Japan) [Team Jampump] | |
| 735 | Mario Bros. (US, set 2) [stephh] | |
| 736 | Puzznic (Italy) [Corrado Tomaselli] | |
| 737 | Don Den Lover Vol. 1 (Korea, bootleg) [David Haywood] | |
| 738 | Boomer Rang'r / Genesis (set 2) [Team Japump] | |
| 739 | Narazumono Sentai Bloody Wolf (Japan) [Team Japump] | |
| 740 | Open Mahjong [BET] (Japan) [Team Japump] | |
| 559 | Tube Panic (bootleg) [sonikos] | |
| 560 | Player's Edge Plus (PP0188) Standard Draw Poker [Jim Stolis] | |
| 561 | Player's Edge Plus (Set038) Set Chip [Jim Stolis] | |
| 562 | Mortal Kombat 4 (set 2) [icronnya77] | |
| 563 | Meteor [Andreas] | |
| 741 | 564 | |
| 742 | 565 | |
| 743 | 566 | |
| 744 | 567 | New games marked as GAME_NOT_WORKING |
| 745 | 568 | ------------------------------------ |
| 746 | Laser Grand Prix [Andrew Gardner] | |
| 747 | Saloon (France, encrypted) [Roberto Fresca] | |
| 748 | Mahjong Cafe Doll (Japan) [Team Japump] | |
| 569 | GameCristal [f205v, R. Belmont] |
| Previous | 15994 Revisions | Next |