| Previous | 15994 Revisions | Next |
| r4136 Thursday 15th January, 2009 at 11:55:32 UTC by Nathan Woods |
|---|
| Updated to MAME 0.129u1 core |
| [docs] | messnew.txt |
| [src/emu] | deprecat.h drawgfx.c drawgfx.h drawgfxm.h* emu.mak emupal.h mame.c mame.h mconfig.c mconfig.h memory.c memory.h profiler.c sndintrf.c sndintrf.h sound.c tilemap.c tilemap.h uigfx.c video.c video.h |
| [src/emu/cpu] | cpu.mak |
| [src/emu/cpu/alph8201] | alph8201.h |
| [src/emu/cpu/arm] | arm.c |
| [src/emu/cpu/arm7] | arm7core.c arm7core.h |
| [src/emu/cpu/cop400] | cop400.c* cop400.h cop400op.c* |
| [src/emu/cpu/dsp56k] | dsp56dsm.c dsp56mem.c dsp56ops.c |
| [src/emu/cpu/esrip] | esrip.c |
| [src/emu/cpu/g65816] | g65816cm.h g65816ds.c |
| [src/emu/cpu/h6280] | h6280.c |
| [src/emu/cpu/h83002] | h8_8.c |
| [src/emu/cpu/hd6309] | 6309ops.c |
| [src/emu/cpu/i860] | i860.c i860.h i860dec.c* i860dis.c* |
| [src/emu/cpu/m37710] | m37710.c m37710cm.h m37710op.h m7700ds.c |
| [src/emu/cpu/mb86233] | mb86233.c |
| [src/emu/cpu/mb88xx] | mb88xx.h |
| [src/emu/cpu/mcs51] | mcs51dasm.c |
| [src/emu/cpu/pic16c5x] | pic16c5x.c |
| [src/emu/cpu/se3208] | se3208.c se3208dis.c |
| [src/emu/cpu/sh2] | sh2drc.c sh2fe.c |
| [src/emu/cpu/sm8500] | sm8500.c |
| [src/emu/cpu/spc700] | spc700.c spc700.h spc700ds.c |
| [src/emu/cpu/tms32010] | tms32010.c |
| [src/emu/cpu/tms32025] | tms32025.c |
| [src/emu/cpu/tms34010] | 34010ops.h |
| [src/emu/cpu/tms9900] | 9900dasm.c |
| [src/emu/cpu/v60] | am1.c |
| [src/emu/debug] | debugcpu.c |
| [src/emu/machine] | 6821new.c* 6821new.h* 6821pia.c f3853.c |
| [src/emu/sound] | 2151intf.h 2203intf.h 2413intf.h 2608intf.h 2610intf.h 2612intf.h 262intf.h 3812intf.c 3812intf.h 5110intf.c 5110intf.h 5220intf.c 5220intf.h aica.c aica.h astrocde.h ay8910.c ay8910.h beep.h bsmt2000.h c140.h c352.h c6280.h cdda.h cdp1869.h cem3394.c cem3394.h custom.h dac.h digitalk.c* digitalk.h* discrete.c discrete.h dmadac.h es5503.c es5503.h es5506.c es5506.h es8712.h flt_rc.h flt_vol.h fm.h gaelco.h hc55516.c hc55516.h ics2115.c ics2115.h iremga20.c iremga20.h k005289.h k007232.h k051649.h k053260.c k053260.h k054539.h msm5205.c msm5205.h msm5232.h multipcm.h n63701x.h namco.h namco52.h nes_apu.h nile.h okim6258.h okim6295.c okim6295.h okim6376.c* okim6376.h* pokey.c pokey.h psx.h qsound.h rf5c400.h rf5c68.h s14001a.c s14001a.h saa1099.h samples.h scsp.c scsp.h segapcm.h sid6581.h sn76477.h sn76496.c sn76496.h snkwave.h sound.mak sp0250.h sp0256.h speaker.h st0016.h tiaintf.h tms3615.h tms36xx.h upd7759.h vlm5030.h votrax.h vrender0.h wave.c wave.h x1_010.h ym2151.c ymf262.c ymf271.c ymf271.h ymf278b.c ymf278b.h ymz280b.c ymz280b.h |
| [src/emu/video] | mc6845.c voodoo.c |
| [src/lib/util] | bitmap.c bitmap.h palette.c palette.h |
| [src/mame] | mame.mak mamedriv.c |
| [src/mame/audio] | 8080bw.c atarijsa.c cyberbal.c snes.c taitosnd.c tx1.c |
| [src/mame/drivers] | 2mindril.c 3super8.c* 8080bw.c 86lions.c* ace.c acefruit.c actfancr.c adp.c aeroboto.c aerofgt.c airbustr.c ajax.c aleck64.c alpha68k.c ambush.c ampoker2.c amspdwy.c angelkds.c appoooh.c aquarium.c arabian.c arcadecl.c atarig1.c baraduke.c bbusters.c bingoc.c bnstars.c brasil.c btime.c buster.c* caswin.c cb2001.c cchasm.c centiped.c cham24.c coinmstr.c cowrace.c cps1.c cps3.c cubocd32.c cvs.c cyberbal.c deco32.c deco_mlc.c deshoros.c dynax.c esripsys.c fastfred.c firebeat.c gal3.c galaxian.c galdrvr.c galpani3.c gamecstl.c gcpinbal.c genesis.c goldstar.c goodejan.c gticlub.c highvdeo.c* hng64.c hornet.c hyperspt.c igs009.c igs017.c igs_ncs.c* ilpag.c jackpool.c jangou.c janshi.c jantotsu.c jchan.c kaneko16.c konamigx.c lemmings.c lethal.c limenko.c luckgrln.c madalien.c magicfly.c mastboy.c mediagx.c megadriv.h megasys1.c mil4000.c mitchell.c mlanding.c model3.c mogura.c mpoker.c mpu4drvr.c msisaac.c multigam.c namcoic.c namcona1.c namconb1.c namcos12.c namcos22.c namcos23.c naomi.c nemesis.c neogeo.c nwk-tr.c parentj.c pastelg.c pcxt.c* peplus.c plygonet.c polyplay.c punchout.c qix.c queen.c re900.c relief.c rungun.c sbasketb.c scramble.c segac2.c seibuspi.c sengokmj.c sfbonus.c* sfkick.c skykid.c skylncr.c slotcarn.c sms.c* spaceg.c spool99.c srmp6.c ssfindo.c ssv.c st0016.c stv.c suprnova.c taito_b.c taito_l.c taitojc.c taitowlf.c tarzan.c thepit.c tiamc1.c trvmadns.c turbo.c vcombat.c williams.c xyonix.c zac2650.c zn.c zr107.c |
| [src/mame/includes] | 8080bw.h ajax.h balsente.h deco16ic.h esripsys.h madalien.h megasys1.h polyplay.h segas24.h snes.h stv.h suprnova.h tiamc1.h tmnt.h williams.h wrally.h |
| [src/mame/machine] | ajax.c amiga.c atarigen.c balsente.c gaplus.c kaneko16.c konamigx.c konamigx.h midyunit.c namcoio.c nb1413m3.c segas24.c segas32.c seicop.c snes.c snesdsp1.c snesdsp2.c snesobc1.c stvcd.c tnzs.c toaplan1.c vsnes.c williams.c |
| [src/mame/video] | 8080bw.c 88games.c aeroboto.c aerofgt.c airbustr.c ajax.c aliens.c alpha68k.c angelkds.c appoooh.c arabian.c asterix.c atari.c atarimo.c atarisy1.c balsente.c battlera.c bbusters.c beathead.c blockhl.c boogwing.c bottom9.c btime.c buggychl.c bwing.c chqflag.c circus.c cischeat.c cninja.c crimfght.c cvs.c dassault.c dday.c deco16ic.c deco32.c deco_mlc.c decocass.c equites.c esripsys.c exerion.c exidy440.c f1gp.c gaelco2.c gaiden.c gbusters.c goldstar.c goodejan.c gottlieb.c gradius3.c grchamp.c gridlee.c gticlub.c hyprduel.c irobot.c itech32.c jalblend.c kan_pand.c kaneko16.c konamigx.c konamiic.c konamiic.h lemmings.c lethal.c m10.c m58.c macrossp.c madalien.c magmax.c mainevt.c mainsnk.c mcr.c mcr68.c metro.c model1.c model2.c moo.c ms32.c mystwarr.c namcona1.c namcos1.c namcos2.c namcos22.c namcos86.c nemesis.c parodius.c phoenix.c plygonet.c polepos.c policetr.c polyplay.c ppu2c0x.c psikyosh.c psx.c qix.c rallyx.c realbrk.c relief.c rockola.c rohga.c rollerg.c rungun.c segag80r.c segaic24.c segaic24.h segas18.c segas24.c segasyse.c seibuspi.c sengokmj.c shangha3.c skyraid.c snes.c snk.c snk68.c spbactn.c spy.c ssv.c st0016.c stvvdp1.c stvvdp2.c suprnova.c surpratk.c tail2nos.c taito_b.c taito_f2.c taito_f3.c taito_l.c taitoic.c taitojc.c taitosj.c tatsumi.c tceptor.c tecmo16.c thunderx.c tiamc1.c tmnt.c toaplan1.c toaplan2.c toypop.c tryout.c tunhunt.c twincobr.c ultraman.c usgames.c victory.c wecleman.c wrally.c xexex.c xmen.c ygv608.c zac2650.c |
| [src/mess] | mess.mak |
| [src/mess/drivers] | a2600.c a310.c a7800.c advision.c amiga.c amstrad.c apexc.c apogee.c apple2.c apple2gs.c at.c atari.c atom.c bbc.c bebox.c bk.c c128.c c64.c cgenie.c coco.c comx35.c cybiko.c dai.c dc.c electron.c exidy.c galaxy.c gamepock.c geneve.c hp48.c ip20.c ip22.c jaguar.c jupiter.c kc.c kim1.c lisa.c lviv.c mbee.c mc10.c mekd2.c microtan.c mikro80.c mikrosha.c msx.c mz700.c mz80.c n64.c ondra.c orao.c oric.c orion.c osborne1.c p2000t.c partner.c pc.c pc8801.c pce.c pecom.c pmd85.c primo.c radio86.c special.c spectrum.c ssystem3.c super80.c svi318.c sym1.c ti85.c ti990_10.c ti99_4p.c ti99_4x.c ti99_8.c tm990189.c tmc600.c trs80.c tutor.c ut88.c vc20.c vector06.c vectrex.c vtech1.c vtech2.c zx.c |
| [src/mess/machine] | apple2gs.c apple3.c c64.c cdp1871.c lisa.c osborne1.c |
| [src/mess/video] | 733_asr.c amstrad.c avigo.c mbee.c pdp1.c spectrum.c ted7360.c thomson.c tx0.c vdc8563.c x68k.c |
| [src/osd/winui] | properties.c treeview.c |
| r4135 | r4136 | |
|---|---|---|
| 200 | 200 | |
| 201 | 201 | /***** DSP_Reset *****/ |
| 202 | 202 | |
| 203 | void DSP_Reset /* Reset emulated DSP */ | |
| 203 | static void DSP_Reset /* Reset emulated DSP */ | |
| 204 | 204 | ( void ) |
| 205 | 205 | { |
| 206 | 206 | int i; |
| r4135 | r4136 | |
| 235 | 235 | |
| 236 | 236 | /***** DSP_Update *****/ |
| 237 | 237 | |
| 238 | void DSP_Update /* Mix one sample of audio */ | |
| 238 | static void DSP_Update /* Mix one sample of audio */ | |
| 239 | 239 | ( |
| 240 | 240 | short * sound_ptr /* Pointer to mix audio into */ |
| 241 | 241 | ) |
| r4135 | r4136 | |
|---|---|---|
| 5 | 5 | ****************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | #include "sound/dac.h" | |
| 9 | #include "sound/2151intf.h" | |
| 8 | 10 | #include "machine/atarigen.h" |
| 9 | #include "sound/dac.h" | |
| 10 | 11 | #include "includes/cyberbal.h" |
| 11 | 12 | |
| 12 | 13 |
| r4135 | r4136 | |
|---|---|---|
| 124 | 124 | has_tms5220 = has_oki6295 = has_pokey = has_ym2151 = 0; |
| 125 | 125 | for (i = 0; i < MAX_SOUND; i++) |
| 126 | 126 | { |
| 127 | switch (machine->config->sound[i].type) | |
| 128 | { | |
| 129 | case SOUND_TMS5220: | |
| 130 | has_tms5220 = 1; | |
| 131 | break; | |
| 132 | case SOUND_OKIM6295: | |
| 133 | has_oki6295 = 1; | |
| 134 | break; | |
| 135 | case SOUND_POKEY: | |
| 136 | has_pokey = 1; | |
| 137 | break; | |
| 138 | case SOUND_YM2151: | |
| 139 | has_ym2151 = 1; | |
| 140 | break; | |
| 141 | default: | |
| 142 | break; | |
| 143 | } | |
| 127 | sound_type type = machine->config->sound[i].type; | |
| 128 | if (type == SOUND_TMS5220) | |
| 129 | has_tms5220 = 1; | |
| 130 | if (type == SOUND_OKIM6295) | |
| 131 | has_oki6295 = 1; | |
| 132 | if (type == SOUND_POKEY) | |
| 133 | has_pokey = 1; | |
| 134 | if (type == SOUND_YM2151) | |
| 135 | has_ym2151 = 1; | |
| 144 | 136 | } |
| 145 | 137 | |
| 146 | 138 | /* install POKEY memory handlers */ |
| r4135 | r4136 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | 8 | #include "streams.h" |
| 9 | #include "sound/ay8910.h" | |
| 10 | #include "sound/custom.h" | |
| 11 | #include "video/resnet.h" | |
| 9 | 12 | #include "includes/tx1.h" |
| 10 | #include "video/resnet.h" | |
| 11 | #include "sound/custom.h" | |
| 12 | 13 | |
| 13 | 14 | |
| 14 | 15 | /************************************* |
| r4135 | r4136 | |
|---|---|---|
| 119 | 119 | case 0x00: // mode #0 |
| 120 | 120 | //logerror("taitosnd: Master cpu read portdata %01x\n", tc0140syt.masterdata[0]); |
| 121 | 121 | return tc0140syt.masterdata[tc0140syt.mainmode ++]; |
| 122 | break; | |
| 123 | 122 | |
| 124 | 123 | case 0x01: // mode #1 |
| 125 | 124 | //logerror("taitosnd: Master cpu receives 0/1 : %01x%01x\n", tc0140syt.masterdata[1],tc0140syt.masterdata[0]); |
| 126 | 125 | tc0140syt.status &= ~TC0140SYT_PORT01_FULL_MASTER; |
| 127 | 126 | return tc0140syt.masterdata[tc0140syt.mainmode ++]; |
| 128 | break; | |
| 129 | 127 | |
| 130 | 128 | case 0x02: // mode #2 |
| 131 | 129 | //logerror("taitosnd: Master cpu read masterdata %01x\n", tc0140syt.masterdata[2]); |
| 132 | 130 | return tc0140syt.masterdata[tc0140syt.mainmode ++]; |
| 133 | break; | |
| 134 | 131 | |
| 135 | 132 | case 0x03: // mode #3 |
| 136 | 133 | //logerror("taitosnd: Master cpu receives 2/3 : %01x%01x\n", tc0140syt.masterdata[3],tc0140syt.masterdata[2]); |
| 137 | 134 | tc0140syt.status &= ~TC0140SYT_PORT23_FULL_MASTER; |
| 138 | 135 | return tc0140syt.masterdata[tc0140syt.mainmode ++]; |
| 139 | break; | |
| 140 | 136 | |
| 141 | 137 | case 0x04: // port status |
| 142 | 138 | //logerror("tc0140syt : Master cpu read status : %02x\n", tc0140syt.status); |
| 143 | 139 | return tc0140syt.status; |
| 144 | break; | |
| 145 | 140 | |
| 146 | 141 | default: |
| 147 | 142 | logerror("tc0140syt : Master cpu read in mode [%02x]\n", tc0140syt.mainmode); |
| r4135 | r4136 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | static emu_timer *schaser_effect_555_timer; |
| 13 | 13 | static attotime schaser_effect_555_time_remain; |
| 14 | static INT32 schaser_effect_555_time_remain_savable; | |
| 14 | 15 | static int schaser_effect_555_is_low; |
| 15 | 16 | static int schaser_explosion; |
| 16 | static UINT8 port_1_last = 0; | |
| 17 | static UINT8 port_2_last = 0; | |
| 18 | static UINT8 port_3_last = 0; | |
| 17 | static UINT8 port_1_last_extra = 0; | |
| 18 | static UINT8 port_2_last_extra = 0; | |
| 19 | static UINT8 port_3_last_extra = 0; | |
| 19 | 20 | |
| 21 | /*******************************************************/ | |
| 22 | /* */ | |
| 23 | /* Global state registration */ | |
| 24 | /* */ | |
| 25 | /*******************************************************/ | |
| 20 | 26 | |
| 27 | MACHINE_START( extra_8080bw_sh ) | |
| 28 | { | |
| 29 | state_save_register_global(machine, port_1_last_extra); | |
| 30 | state_save_register_global(machine, port_2_last_extra); | |
| 31 | state_save_register_global(machine, port_3_last_extra); | |
| 32 | } | |
| 33 | ||
| 21 | 34 | /*******************************************************/ |
| 22 | 35 | /* */ |
| 23 | 36 | /* Midway "Space Invaders Part II" */ |
| r4135 | r4136 | |
| 26 | 39 | |
| 27 | 40 | WRITE8_HANDLER( invadpt2_sh_port_1_w ) |
| 28 | 41 | { |
| 29 | UINT8 rising_bits = data & ~port_1_last; | |
| 42 | UINT8 rising_bits = data & ~port_1_last_extra; | |
| 30 | 43 | |
| 31 | 44 | sn76477_enable_w(0, !(data & 0x01)); /* SAUCER SOUND */ |
| 32 | 45 | |
| r4135 | r4136 | |
| 39 | 52 | |
| 40 | 53 | sound_global_enable(data & 0x20); |
| 41 | 54 | |
| 42 | port_1_last = data; | |
| 55 | port_1_last_extra = data; | |
| 43 | 56 | |
| 44 | 57 | } |
| 45 | 58 | |
| r4135 | r4136 | |
| 52 | 65 | D2 = 82K |
| 53 | 66 | D3 = 100K */ |
| 54 | 67 | |
| 55 | UINT8 rising_bits = data & ~port_2_last; | |
| 68 | UINT8 rising_bits = data & ~port_2_last_extra; | |
| 56 | 69 | |
| 57 | 70 | if (rising_bits & 0x01) sample_start_n(0, 4, 3, 0); /* FLEET */ |
| 58 | 71 | if (rising_bits & 0x02) sample_start_n(0, 4, 4, 0); /* FLEET */ |
| r4135 | r4136 | |
| 62 | 75 | |
| 63 | 76 | c8080bw_flip_screen_w(space, data & 0x20); |
| 64 | 77 | |
| 65 | port_2_last = data; | |
| 78 | port_2_last_extra = data; | |
| 66 | 79 | } |
| 67 | 80 | |
| 68 | 81 | |
| r4135 | r4136 | |
| 74 | 87 | |
| 75 | 88 | WRITE8_HANDLER( spcewars_sh_port_w ) |
| 76 | 89 | { |
| 77 | UINT8 rising_bits = data & ~port_1_last; | |
| 90 | UINT8 rising_bits = data & ~port_1_last_extra; | |
| 78 | 91 | |
| 79 | 92 | sn76477_enable_w(0, !(data & 0x01)); /* Saucer Sound */ |
| 80 | 93 | |
| r4135 | r4136 | |
| 84 | 97 | |
| 85 | 98 | speaker_level_w(0, (data & 0x10) ? 1 : 0); /* Various bitstream tunes */ |
| 86 | 99 | |
| 87 | port_1_last = data; | |
| 100 | port_1_last_extra = data; | |
| 88 | 101 | } |
| 89 | 102 | |
| 90 | 103 | |
| r4135 | r4136 | |
| 117 | 130 | |
| 118 | 131 | WRITE8_HANDLER( lrescue_sh_port_1_w ) |
| 119 | 132 | { |
| 120 | UINT8 rising_bits = data & ~port_1_last; | |
| 133 | UINT8 rising_bits = data & ~port_1_last_extra; | |
| 121 | 134 | |
| 122 | 135 | if (rising_bits & 0x01) sample_start(0, 3, 0); /* Thrust */ |
| 123 | 136 | if (rising_bits & 0x02) sample_start(1, 2, 0); /* Shot Sound */ |
| r4135 | r4136 | |
| 129 | 142 | |
| 130 | 143 | c8080bw_screen_red_w(data & 0x04); |
| 131 | 144 | |
| 132 | port_1_last = data; | |
| 145 | port_1_last_extra = data; | |
| 133 | 146 | } |
| 134 | 147 | |
| 135 | 148 | WRITE8_HANDLER( lrescue_sh_port_2_w ) |
| 136 | 149 | { |
| 137 | UINT8 rising_bits = data & ~port_2_last; | |
| 150 | UINT8 rising_bits = data & ~port_2_last_extra; | |
| 138 | 151 | |
| 139 | 152 | if (rising_bits & 0x01) sample_start(1, 8, 0); /* Footstep high tone */ |
| 140 | 153 | if (rising_bits & 0x02) sample_start(1, 7, 0); /* Footstep low tone */ |
| r4135 | r4136 | |
| 143 | 156 | speaker_level_w(0, (data & 0x08) ? 1 : 0); /* Bitstream tunes - endlevel and bonus1 */ |
| 144 | 157 | |
| 145 | 158 | if (rising_bits & 0x10) sample_start(3, 6, 0); /* Shooting Star and Rescue Ship sounds */ |
| 146 | if (~data & 0x10 && port_2_last & 0x10) sample_stop (3); /* This makes the rescue ship sound beep on and off */ | |
| 159 | if (~data & 0x10 && port_2_last_extra & 0x10) sample_stop (3); /* This makes the rescue ship sound beep on and off */ | |
| 147 | 160 | |
| 148 | 161 | c8080bw_flip_screen_w(space, data & 0x20); |
| 149 | 162 | |
| 150 | port_2_last = data; | |
| 163 | port_2_last_extra = data; | |
| 151 | 164 | } |
| 152 | 165 | |
| 153 | 166 | |
| r4135 | r4136 | |
| 173 | 186 | |
| 174 | 187 | WRITE8_HANDLER( ballbomb_sh_port_1_w ) |
| 175 | 188 | { |
| 176 | UINT8 rising_bits = data & ~port_1_last; | |
| 189 | UINT8 rising_bits = data & ~port_1_last_extra; | |
| 177 | 190 | |
| 178 | 191 | if (rising_bits & 0x01) sample_start(1, 2, 0); /* Hit a balloon */ |
| 179 | 192 | if (rising_bits & 0x02) sample_start(2, 0, 0); /* Shot Sound */ |
| r4135 | r4136 | |
| 185 | 198 | |
| 186 | 199 | c8080bw_screen_red_w(data & 0x04); |
| 187 | 200 | |
| 188 | port_1_last = data; | |
| 201 | port_1_last_extra = data; | |
| 189 | 202 | } |
| 190 | 203 | |
| 191 | 204 | WRITE8_HANDLER( ballbomb_sh_port_2_w ) |
| 192 | 205 | { |
| 193 | UINT8 rising_bits = data & ~port_2_last; | |
| 206 | UINT8 rising_bits = data & ~port_2_last_extra; | |
| 194 | 207 | |
| 195 | 208 | if (data & 0x01) sample_start(0, 7, 0); /* Indicates plane will drop bombs */ |
| 196 | 209 | if (data & 0x04) sample_start(0, 4, 0); /* Plane is dropping new balloons at start of level */ |
| r4135 | r4136 | |
| 198 | 211 | |
| 199 | 212 | c8080bw_flip_screen_w(space, data & 0x20); |
| 200 | 213 | |
| 201 | port_2_last = data; | |
| 214 | port_2_last_extra = data; | |
| 202 | 215 | } |
| 203 | 216 | |
| 204 | 217 | |
| r4135 | r4136 | |
| 249 | 262 | { |
| 250 | 263 | /* bit 4 occurs every 5.25 seconds during gameplay */ |
| 251 | 264 | |
| 252 | UINT8 rising_bits = data & ~port_1_last; | |
| 265 | UINT8 rising_bits = data & ~port_1_last_extra; | |
| 253 | 266 | |
| 254 | 267 | if (rising_bits & 0x01) sample_start(1, 7, 0); /* Death */ |
| 255 | 268 | if (rising_bits & 0x02) sample_start(0, 1, 0); /* Shot Sound */ |
| r4135 | r4136 | |
| 260 | 273 | |
| 261 | 274 | c8080bw_screen_red_w(data & 0x01); |
| 262 | 275 | |
| 263 | port_1_last = data; | |
| 276 | port_1_last_extra = data; | |
| 264 | 277 | } |
| 265 | 278 | |
| 266 | 279 | WRITE8_HANDLER( indianbt_sh_port_2_w ) |
| 267 | 280 | { |
| 268 | UINT8 rising_bits = data & ~port_2_last; | |
| 281 | UINT8 rising_bits = data & ~port_2_last_extra; | |
| 269 | 282 | |
| 270 | 283 | if (rising_bits & 0x01) sample_start(4, 0, 0); /* Bird dropped an egg, Lasso used */ |
| 271 | 284 | if (rising_bits & 0x02) sample_start(4, 2, 0); /* Egg hatches, egg shot */ |
| 272 | 285 | if (rising_bits & 0x08) sample_start(5, 0, 0); /* Grabber, Lasso caught something */ |
| 273 | 286 | if (rising_bits & 0x10) sample_start(3, 7, 0); /* Lasso sound */ |
| 274 | 287 | |
| 275 | port_2_last = data; | |
| 288 | port_2_last_extra = data; | |
| 276 | 289 | } |
| 277 | 290 | |
| 278 | 291 | WRITE8_HANDLER( indianbt_sh_port_3_w ) |
| r4135 | r4136 | |
| 783 | 796 | bit 4 - Effect Sound C (SX4) |
| 784 | 797 | bit 5 - Explosion (SX5) */ |
| 785 | 798 | |
| 799 | //printf( "schaser_sh_port_1_w: %02x\n", data ); | |
| 786 | 800 | discrete_sound_w(space, SCHASER_DOT_EN, data & 0x01); |
| 787 | 801 | discrete_sound_w(space, SCHASER_DOT_SEL, data & 0x02); |
| 788 | 802 | |
| r4135 | r4136 | |
| 815 | 829 | if (!schaser_effect_555_is_low) |
| 816 | 830 | { |
| 817 | 831 | schaser_effect_555_time_remain = timer_timeleft(schaser_effect_555_timer); |
| 832 | schaser_effect_555_time_remain_savable = attotime_to_double(schaser_effect_555_time_remain); | |
| 818 | 833 | timer_adjust_oneshot(schaser_effect_555_timer, attotime_never, 0); |
| 819 | 834 | } |
| 820 | 835 | } |
| r4135 | r4136 | |
| 844 | 859 | bit 4 - Field Control B (SX10) |
| 845 | 860 | bit 5 - Flip Screen */ |
| 846 | 861 | |
| 862 | printf( "schaser_sh_port_2_w: %02x\n", data ); | |
| 863 | ||
| 847 | 864 | discrete_sound_w(space, SCHASER_MUSIC_BIT, data & 0x01); |
| 848 | 865 | |
| 849 | 866 | discrete_sound_w(space, SCHASER_SND_EN, data & 0x02); |
| r4135 | r4136 | |
| 854 | 871 | schaser_background_control_w(data & 0x18); |
| 855 | 872 | |
| 856 | 873 | c8080bw_flip_screen_w(space, data & 0x20); |
| 874 | ||
| 875 | port_2_last_extra = data; | |
| 857 | 876 | } |
| 858 | 877 | |
| 859 | 878 | |
| r4135 | r4136 | |
| 864 | 883 | /* Toggle 555 output */ |
| 865 | 884 | schaser_effect_555_is_low = !schaser_effect_555_is_low; |
| 866 | 885 | schaser_effect_555_time_remain = attotime_zero; |
| 886 | schaser_effect_555_time_remain_savable = attotime_to_double(schaser_effect_555_time_remain); | |
| 867 | 887 | |
| 868 | 888 | if (schaser_effect_555_is_low) |
| 869 | 889 | new_time = attotime_div(PERIOD_OF_555_ASTABLE(0, RES_K(20), CAP_U(1)), 2); |
| r4135 | r4136 | |
| 880 | 900 | } |
| 881 | 901 | |
| 882 | 902 | |
| 903 | static STATE_POSTLOAD( schaser_reinit_555_time_remain ) | |
| 904 | { | |
| 905 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 906 | schaser_effect_555_time_remain = double_to_attotime(schaser_effect_555_time_remain_savable); | |
| 907 | schaser_sh_port_2_w(space, 0, port_2_last_extra); | |
| 908 | } | |
| 909 | ||
| 910 | ||
| 883 | 911 | MACHINE_START( schaser ) |
| 884 | 912 | { |
| 885 | 913 | schaser_effect_555_timer = timer_alloc(machine, schaser_effect_555_cb, NULL); |
| 886 | 914 | |
| 915 | state_save_register_global(machine, schaser_explosion); | |
| 916 | state_save_register_global(machine, schaser_effect_555_is_low); | |
| 917 | state_save_register_global(machine, schaser_effect_555_time_remain_savable); | |
| 918 | state_save_register_global(machine, port_2_last_extra); | |
| 919 | state_save_register_postload(machine, schaser_reinit_555_time_remain, NULL); | |
| 920 | ||
| 921 | MACHINE_START_CALL(extra_8080bw_vh); | |
| 887 | 922 | MACHINE_START_CALL(mw8080bw); |
| 888 | 923 | } |
| 889 | 924 | |
| r4135 | r4136 | |
| 896 | 931 | schaser_sh_port_1_w(space, 0, 0); |
| 897 | 932 | schaser_sh_port_2_w(space, 0, 0); |
| 898 | 933 | schaser_effect_555_time_remain = attotime_zero; |
| 934 | schaser_effect_555_time_remain_savable = attotime_to_double(schaser_effect_555_time_remain); | |
| 899 | 935 | |
| 900 | 936 | MACHINE_RESET_CALL(mw8080bw); |
| 901 | 937 | } |
| r4135 | r4136 | |
| 909 | 945 | |
| 910 | 946 | WRITE8_HANDLER( rollingc_sh_port_w ) |
| 911 | 947 | { |
| 912 | UINT8 rising_bits = data & ~port_3_last; | |
| 948 | UINT8 rising_bits = data & ~port_3_last_extra; | |
| 913 | 949 | |
| 914 | 950 | if (rising_bits & 0x02) sample_start(4, 0, 0); /* Steering */ |
| 915 | 951 | if (rising_bits & 0x04) sample_start(0, 1, 0); /* Collision */ |
| 916 | 952 | if (rising_bits & 0x10) sample_start(1, 8, 0); /* Computer car is starting to move */ |
| 917 | 953 | |
| 918 | port_3_last = data; | |
| 954 | port_3_last_extra = data; | |
| 919 | 955 | } |
| 920 | 956 | |
| 921 | 957 | |
| r4135 | r4136 | |
| 975 | 1011 | |
| 976 | 1012 | WRITE8_HANDLER( lupin3_sh_port_1_w ) |
| 977 | 1013 | { |
| 978 | UINT8 rising_bits = data & ~port_1_last; | |
| 1014 | UINT8 rising_bits = data & ~port_1_last_extra; | |
| 979 | 1015 | |
| 980 | 1016 | if (rising_bits & 0x01) sample_start(0, 6, 0); /* Walking, get money */ |
| 981 | 1017 | |
| r4135 | r4136 | |
| 985 | 1021 | if (rising_bits & 0x08) sample_start(0, 1, 0); /* Jail */ |
| 986 | 1022 | if (rising_bits & 0x10) sample_start(3, 8, 0); /* Bonus Man */ |
| 987 | 1023 | |
| 988 | port_1_last = data; | |
| 1024 | port_1_last_extra = data; | |
| 989 | 1025 | } |
| 990 | 1026 | |
| 991 | 1027 | WRITE8_HANDLER( lupin3_sh_port_2_w ) |
| 992 | 1028 | { |
| 993 | UINT8 rising_bits = data & ~port_2_last; | |
| 1029 | UINT8 rising_bits = data & ~port_2_last_extra; | |
| 994 | 1030 | |
| 995 | 1031 | if (rising_bits & 0x01) sample_start(0, 3, 0); /* Lands on top of building, wife kicks man */ |
| 996 | 1032 | if (rising_bits & 0x02) sample_start(1, 2, 0); /* deposit money, start intermission, end game */ |
| r4135 | r4136 | |
| 1000 | 1036 | |
| 1001 | 1037 | c8080bw_flip_screen_w(space, data & 0x20); |
| 1002 | 1038 | |
| 1003 | port_2_last = data; | |
| 1039 | port_2_last_extra = data; | |
| 1004 | 1040 | } |
| 1005 | 1041 | |
| 1006 | 1042 | |
| r4135 | r4136 | |
| 1016 | 1052 | bit 3 = 1st speedup |
| 1017 | 1053 | Death is a stream of ff's with some fe's thrown in */ |
| 1018 | 1054 | |
| 1019 | UINT8 rising_bits = data & ~port_1_last; | |
| 1055 | UINT8 rising_bits = data & ~port_1_last_extra; | |
| 1020 | 1056 | |
| 1021 | 1057 | if (rising_bits & 0x02) sample_start(1, 6, 0); /* Ran over a dot */ |
| 1022 | 1058 | if (rising_bits & 0x10) sample_start(0, 1, 0); /* Death */ |
| 1023 | 1059 | |
| 1024 | port_1_last = data; | |
| 1060 | port_1_last_extra = data; | |
| 1025 | 1061 | } |
| 1026 | 1062 | |
| 1027 | 1063 | WRITE8_HANDLER( schasrcv_sh_port_2_w ) |
| r4135 | r4136 | |
| 1041 | 1077 | |
| 1042 | 1078 | WRITE8_HANDLER( yosakdon_sh_port_1_w ) |
| 1043 | 1079 | { |
| 1044 | UINT8 rising_bits = data & ~port_1_last; | |
| 1080 | UINT8 rising_bits = data & ~port_1_last_extra; | |
| 1045 | 1081 | |
| 1046 | 1082 | if (rising_bits & 0x01) sample_start(0, 3, 0); /* Game Over */ |
| 1047 | 1083 | if (rising_bits & 0x02) sample_start(2, 0, 0); /* Bird dead */ |
| r4135 | r4136 | |
| 1051 | 1087 | |
| 1052 | 1088 | sound_global_enable(data & 0x20); |
| 1053 | 1089 | |
| 1054 | port_1_last = data; | |
| 1090 | port_1_last_extra = data; | |
| 1055 | 1091 | } |
| 1056 | 1092 | |
| 1057 | 1093 | WRITE8_HANDLER( yosakdon_sh_port_2_w ) |
| 1058 | 1094 | { |
| 1059 | UINT8 rising_bits = data & ~port_2_last; | |
| 1095 | UINT8 rising_bits = data & ~port_2_last_extra; | |
| 1060 | 1096 | |
| 1061 | 1097 | if (rising_bits & 0x01) sample_start(1, 6, 0); /* Ready? , Game Over */ |
| 1062 | 1098 | if (rising_bits & 0x04) sample_start(3, 7, 0); /* Big bird dead */ |
| r4135 | r4136 | |
| 1067 | 1103 | |
| 1068 | 1104 | c8080bw_flip_screen_w(space, data & 0x20); |
| 1069 | 1105 | |
| 1070 | port_2_last = data; | |
| 1106 | port_2_last_extra = data; | |
| 1071 | 1107 | } |
| 1072 | 1108 | |
| 1073 | 1109 | |
| r4135 | r4136 | |
| 1080 | 1116 | { |
| 1081 | 1117 | /* bit 3 is high while you are alive and playing */ |
| 1082 | 1118 | |
| 1083 | UINT8 rising_bits = data & ~port_1_last; | |
| 1119 | UINT8 rising_bits = data & ~port_1_last_extra; | |
| 1084 | 1120 | |
| 1085 | 1121 | if (rising_bits & 0x01) sample_start(4, 4, 0); /* Fleet move */ |
| 1086 | 1122 | if (rising_bits & 0x02) sample_start(5, 8, 0); /* Extra Tank */ |
| 1087 | 1123 | |
| 1088 | 1124 | sn76477_enable_w(0, data & 0x04 ? 0:1); /* UFO */ |
| 1089 | 1125 | |
| 1090 | port_1_last = data; | |
| 1126 | port_1_last_extra = data; | |
| 1091 | 1127 | } |
| 1092 | 1128 | |
| 1093 | 1129 | WRITE8_HANDLER( shuttlei_sh_port_2_w ) |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | ***************************************************************************/ |
| 12 | 12 | |
| 13 | int DSP2_waiting_for_command = 0; | |
| 14 | int DSP2_command = 0; | |
| 15 | int DSP2_in_count = 0, DSP2_in_index = 0; | |
| 16 | int DSP2_out_count = 0, DSP2_out_index = 0; | |
| 13 | static int DSP2_waiting_for_command = 0; | |
| 14 | static int DSP2_command = 0; | |
| 15 | static int DSP2_in_count = 0, DSP2_in_index = 0; | |
| 16 | static int DSP2_out_count = 0, DSP2_out_index = 0; | |
| 17 | 17 | |
| 18 | UINT8 DSP2_parameters[512] = {0}; | |
| 19 | UINT8 DSP2_output[512] = {0}; | |
| 18 | static UINT8 DSP2_parameters[512] = {0}; | |
| 19 | static UINT8 DSP2_output[512] = {0}; | |
| 20 | 20 | |
| 21 | UINT8 DSP2_op05transparent = 0; | |
| 22 | int DSP2_op05haslen = 0; | |
| 23 | int DSP2_op05len = 0; | |
| 24 | int DSP2_op06haslen = 0; | |
| 25 | int DSP2_op06len = 0; | |
| 26 | UINT16 DSP2_op09word1 = 0; | |
| 27 | UINT16 DSP2_op09word2 = 0; | |
| 28 | int DSP2_op0dhaslen = 0; | |
| 29 | int DSP2_op0doutlen = 0; | |
| 30 | int DSP2_op0dinlen = 0; | |
| 21 | static UINT8 DSP2_op05transparent = 0; | |
| 22 | static int DSP2_op05haslen = 0; | |
| 23 | static int DSP2_op05len = 0; | |
| 24 | static int DSP2_op06haslen = 0; | |
| 25 | static int DSP2_op06len = 0; | |
| 26 | static UINT16 DSP2_op09word1 = 0; | |
| 27 | static UINT16 DSP2_op09word2 = 0; | |
| 28 | static int DSP2_op0dhaslen = 0; | |
| 29 | static int DSP2_op0doutlen = 0; | |
| 30 | static int DSP2_op0dinlen = 0; | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | //convert bitmap to bitplane tile |
| 34 | void DSP2_op01( void ) | |
| 34 | static void DSP2_op01( void ) | |
| 35 | 35 | { |
| 36 | 36 | //op01 size is always 32 bytes input and output |
| 37 | 37 | //the hardware does strange things if you vary the size |
| r4135 | r4136 | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | //set transparent color |
| 92 | void DSP2_op03( void ) | |
| 92 | static void DSP2_op03( void ) | |
| 93 | 93 | { |
| 94 | 94 | DSP2_op05transparent = DSP2_parameters[0]; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | //replace bitmap using transparent color |
| 98 | void DSP2_op05( void ) | |
| 98 | static void DSP2_op05( void ) | |
| 99 | 99 | { |
| 100 | 100 | UINT8 color; |
| 101 | 101 | // Overlay bitmap with transparency. |
| r4135 | r4136 | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | //scale bitmap |
| 173 | void DSP2_op0d( void ) | |
| 173 | static void DSP2_op0d( void ) | |
| 174 | 174 | { |
| 175 | 175 | // Bit accurate hardware algorithm - uses fixed point math |
| 176 | 176 | // This should match the DSP2 Op0D output exactly |
| r4135 | r4136 | |
| 239 | 239 | DSP2_op0dinlen = 0; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | UINT8 DSP2_read( void ) | |
| 242 | static UINT8 DSP2_read( void ) | |
| 243 | 243 | { |
| 244 | 244 | UINT8 r = 0xff; |
| 245 | 245 | if (DSP2_out_count) |
| r4135 | r4136 | |
| 252 | 252 | return r; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | void DSP2_write(UINT8 data) | |
| 255 | static void DSP2_write(UINT8 data) | |
| 256 | 256 | { |
| 257 | 257 | if(DSP2_waiting_for_command) |
| 258 | 258 | { |
| r4135 | r4136 | |
|---|---|---|
| 242 | 242 | logerror("error, unknown mcu command\n"); |
| 243 | 243 | /* should not happen */ |
| 244 | 244 | return 0xff; |
| 245 | break; | |
| 246 | 245 | } |
| 247 | 246 | } |
| 248 | 247 | else |
| r4135 | r4136 | |
| 370 | 369 | logerror("error, unknown mcu command\n"); |
| 371 | 370 | /* should not happen */ |
| 372 | 371 | return 0xff; |
| 373 | break; | |
| 374 | 372 | } |
| 375 | 373 | } |
| 376 | 374 | else |
| r4135 | r4136 | |
| 573 | 571 | case MCU_TNZS: |
| 574 | 572 | case MCU_CHUKATAI: |
| 575 | 573 | return mcu_tnzs_r(space,offset); |
| 576 | break; | |
| 577 | 574 | case MCU_ARKANOID: |
| 578 | 575 | return mcu_arknoid2_r(space,offset); |
| 579 | break; | |
| 580 | 576 | case MCU_EXTRMATN: |
| 581 | 577 | case MCU_DRTOPPEL: |
| 582 | 578 | case MCU_PLUMPOP: |
| 583 | 579 | return mcu_extrmatn_r(space,offset); |
| 584 | break; | |
| 585 | 580 | default: |
| 586 | 581 | return 0xff; |
| 587 | break; | |
| 588 | 582 | } |
| 589 | 583 | } |
| 590 | 584 |
| r4135 | r4136 | |
|---|---|---|
| 164 | 164 | switch (term2_analog_select) |
| 165 | 165 | { |
| 166 | 166 | default: |
| 167 | case 0: return input_port_read(space->machine, "STICK0_X"); break; | |
| 168 | case 1: return input_port_read(space->machine, "STICK0_Y"); break; | |
| 169 | case 2: return input_port_read(space->machine, "STICK1_X"); break; | |
| 170 | case 3: return input_port_read(space->machine, "STICK1_Y"); break; | |
| 167 | case 0: return input_port_read(space->machine, "STICK0_X"); | |
| 168 | case 1: return input_port_read(space->machine, "STICK0_Y"); | |
| 169 | case 2: return input_port_read(space->machine, "STICK1_X"); | |
| 170 | case 3: return input_port_read(space->machine, "STICK1_Y"); | |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 |
| r4135 | r4136 | |
|---|---|---|
| 165 | 165 | case 2: |
| 166 | 166 | case 3: |
| 167 | 167 | return 0; |
| 168 | break; | |
| 169 | 168 | } |
| 170 | 169 | } |
| 171 | 170 | |
| r4135 | r4136 | |
| 212 | 211 | return; |
| 213 | 212 | logerror("brival_protection_w: UNKNOWN WRITE: offset %x value %x\n", offset, data); |
| 214 | 213 | return; |
| 215 | break; | |
| 216 | 214 | } |
| 217 | 215 | |
| 218 | 216 | memcpy(ret, &ROM[protAddress[curProtType][0]], 16); |
| r4135 | r4136 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | #include "includes/snes.h" |
| 14 | 14 | |
| 15 | int obc1_address; | |
| 16 | int obc1_offset; | |
| 17 | int obc1_shift; | |
| 15 | static int obc1_address; | |
| 16 | static int obc1_offset; | |
| 17 | static int obc1_shift; | |
| 18 | 18 | |
| 19 | READ8_HANDLER( obc1_read ) | |
| 19 | static READ8_HANDLER( obc1_read ) | |
| 20 | 20 | { |
| 21 | 21 | UINT16 address = offset & 0x1fff; |
| 22 | 22 | UINT8 value; |
| r4135 | r4136 | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | WRITE8_HANDLER( obc1_write ) | |
| 55 | static WRITE8_HANDLER( obc1_write ) | |
| 56 | 56 | { |
| 57 | 57 | UINT16 address = offset & 0x1fff; |
| 58 | 58 | UINT8 temp; |
| r4135 | r4136 | |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | void obc1_init( void ) | |
| 101 | static void obc1_init( void ) | |
| 102 | 102 | { |
| 103 | 103 | obc1_offset = (snes_ram[0x1ff5] & 0x01) ? 0x1800 : 0x1c00; |
| 104 | 104 | obc1_address = (snes_ram[0x1ff6] & 0x7f); |
| r4135 | r4136 | |
|---|---|---|
| 34 | 34 | void system24temp_sys16_io_set_callbacks(UINT8 (*io_r)(running_machine *machine, int port), |
| 35 | 35 | void (*io_w)(running_machine *machine, int port, UINT8 data), |
| 36 | 36 | void (*cnt_w)(const address_space *space, UINT8 data), |
| 37 | READ16_HANDLER ((*iod_r)), | |
| 38 | WRITE16_HANDLER((*iod_w))) | |
| 37 | read16_space_func iod_r, | |
| 38 | write16_space_func iod_w) | |
| 39 | 39 | { |
| 40 | 40 | system24temp_sys16_io_io_r = io_r; |
| 41 | 41 | system24temp_sys16_io_io_w = io_w; |
| r4135 | r4136 | |
|---|---|---|
| 211 | 211 | bitmap_t *dst_bitmap, bitmap_t *src_bitmap, |
| 212 | 212 | const rectangle *dst_cliprect, const rectangle *src_cliprect, |
| 213 | 213 | UINT32 _startx,UINT32 _starty,int _incxx,int _incxy,int _incyx,int _incyy, |
| 214 | int tilebpp, int blend, int clip ) | |
| 214 | int tilebpp, int blend, int alpha, int clip ) | |
| 215 | 215 | { |
| 216 | 216 | static const int colormask[8]={1,3,7,0xf,0x1f,0x3f,0x7f,0xff}; |
| 217 | 217 | |
| r4135 | r4136 | |
| 288 | 288 | if (!(pixel & cmask)) |
| 289 | 289 | continue; |
| 290 | 290 | |
| 291 | dst_ptr[ecx] = alpha_blend32(pal_base[pixel], dst_ptr[ecx]); | |
| 291 | dst_ptr[ecx] = alpha_blend_r32(pal_base[pixel], dst_ptr[ecx], alpha); | |
| 292 | 292 | } |
| 293 | 293 | while (++ecx); |
| 294 | 294 | |
| r4135 | r4136 | |
| 361 | 361 | static void K053936GP_zoom_draw(running_machine *machine, |
| 362 | 362 | int chip, UINT16 *ctrl, UINT16 *linectrl, |
| 363 | 363 | bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, |
| 364 | int tilebpp, int blend) | |
| 364 | int tilebpp, int blend, int alpha) | |
| 365 | 365 | { |
| 366 | 366 | bitmap_t *src_bitmap; |
| 367 | 367 | rectangle *src_cliprect; |
| r4135 | r4136 | |
| 401 | 401 | K053936GP_copyroz32clip(machine, |
| 402 | 402 | bitmap, src_bitmap, &my_clip, src_cliprect, |
| 403 | 403 | startx<<5, starty<<5, incxx<<5, incxy<<5, 0, 0, |
| 404 | tilebpp, blend, clip); | |
| 404 | tilebpp, blend, alpha, clip); | |
| 405 | 405 | y++; |
| 406 | 406 | } |
| 407 | 407 | } |
| r4135 | r4136 | |
| 426 | 426 | K053936GP_copyroz32clip(machine, |
| 427 | 427 | bitmap, src_bitmap, cliprect, src_cliprect, |
| 428 | 428 | startx<<5, starty<<5, incxx<<5, incxy<<5, incyx<<5, incyy<<5, |
| 429 | tilebpp, blend, clip); | |
| 429 | tilebpp, blend, alpha, clip); | |
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | void K053936GP_0_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, |
| 434 | tilemap *tmap, int tilebpp, int blend) | |
| 434 | tilemap *tmap, int tilebpp, int blend, int alpha) | |
| 435 | 435 | { |
| 436 | K053936GP_zoom_draw(machine, 0,K053936_0_ctrl,K053936_0_linectrl,bitmap,cliprect,tmap,tilebpp,blend); | |
| 436 | K053936GP_zoom_draw(machine, 0,K053936_0_ctrl,K053936_0_linectrl,bitmap,cliprect,tmap,tilebpp,blend,alpha); | |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | void K053936GP_1_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, |
| 440 | tilemap *tmap, int tilebpp, int blend) | |
| 440 | tilemap *tmap, int tilebpp, int blend, int alpha) | |
| 441 | 441 | { |
| 442 | K053936GP_zoom_draw(machine, 1,K053936_1_ctrl,K053936_1_linectrl,bitmap,cliprect,tmap,tilebpp,blend); | |
| 442 | K053936GP_zoom_draw(machine, 1,K053936_1_ctrl,K053936_1_linectrl,bitmap,cliprect,tmap,tilebpp,blend,alpha); | |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | |
| r4135 | r4136 | |
| 471 | 471 | #define FPENT 0 |
| 472 | 472 | |
| 473 | 473 | // inner loop |
| 474 | UINT8 *src_ptr; | |
| 474 | const UINT8 *src_ptr; | |
| 475 | 475 | int src_x; |
| 476 | 476 | int eax, ecx; |
| 477 | 477 | int src_fx, src_fdx; |
| r4135 | r4136 | |
| 485 | 485 | |
| 486 | 486 | // outter loop |
| 487 | 487 | int src_fby, src_fdy, src_fbx; |
| 488 | UINT8 *src_base; | |
| 488 | const UINT8 *src_base; | |
| 489 | 489 | int dst_w, dst_h; |
| 490 | 490 | |
| 491 | 491 | // one-time |
| r4135 | r4136 | |
| 524 | 524 | src_pitch = 16; |
| 525 | 525 | src_fw = 16; |
| 526 | 526 | src_fh = 16; |
| 527 | src_base = gfx | |
| 527 | src_base = gfx_element_get_data | |
| 528 | 528 | |
| 529 | 529 | pal_base = machine->pens + gfx->color_base + (color % gfx->total_colors) * granularity; |
| 530 | 530 | shd_base = machine->shadow_table; |
| r4135 | r4136 | |
| 691 | 691 | if (!eax || ozbuf_ptr[ecx] < z8) continue; |
| 692 | 692 | ozbuf_ptr[ecx] = z8; |
| 693 | 693 | |
| 694 | dst_ptr[ecx] = alpha_blend32(pal_base[eax], dst_ptr[ecx]); | |
| 694 | dst_ptr[ecx] = alpha_blend_r32(pal_base[eax], dst_ptr[ecx], alpha); | |
| 695 | 695 | } |
| 696 | 696 | while (++ecx); |
| 697 | 697 | |
| r4135 | r4136 | |
| 717 | 717 | if (!eax || eax >= shdpen || ozbuf_ptr[ecx] < z8) continue; |
| 718 | 718 | ozbuf_ptr[ecx] = z8; |
| 719 | 719 | |
| 720 | dst_ptr[ecx] = alpha_blend32(pal_base[eax], dst_ptr[ecx]); | |
| 720 | dst_ptr[ecx] = alpha_blend_r32(pal_base[eax], dst_ptr[ecx], alpha); | |
| 721 | 721 | } |
| 722 | 722 | while (++ecx); |
| 723 | 723 | |
| r4135 | r4136 | |
| 838 | 838 | if (!eax || ozbuf_ptr[ecx] < z8) continue; |
| 839 | 839 | ozbuf_ptr[ecx] = z8; |
| 840 | 840 | |
| 841 | dst_ptr[ecx] = alpha_blend32(pal_base[eax], dst_ptr[ecx]); | |
| 841 | dst_ptr[ecx] = alpha_blend_r32(pal_base[eax], dst_ptr[ecx], alpha); | |
| 842 | 842 | } |
| 843 | 843 | while (++ecx); |
| 844 | 844 | |
| r4135 | r4136 | |
| 858 | 858 | if (!eax || eax >= shdpen || ozbuf_ptr[ecx] < z8) continue; |
| 859 | 859 | ozbuf_ptr[ecx] = z8; |
| 860 | 860 | |
| 861 | dst_ptr[ecx] = alpha_blend32(pal_base[eax], dst_ptr[ecx]); | |
| 861 | dst_ptr[ecx] = alpha_blend_r32(pal_base[eax], dst_ptr[ecx], alpha); | |
| 862 | 862 | } |
| 863 | 863 | while (++ecx); |
| 864 | 864 | |
| r4135 | r4136 | |
| 1603 | 1603 | temp4 = K054338_set_alpha_level(temp2); |
| 1604 | 1604 | |
| 1605 | 1605 | if (temp4 <= 0) continue; |
| 1606 | if (temp4 < 255) k = TILEMAP_DRAW_ALPHA; | |
| 1606 | if (temp4 < 255) k = TILEMAP_DRAW_ALPHA(temp4); | |
| 1607 | 1607 | } |
| 1608 | 1608 | |
| 1609 | if (mixerflags & 1<<(code+12)) k |= | |
| 1609 | if (mixerflags & 1<<(code+12)) k |= K056382_DRAW_FLAG_FORCE_XYSCROLL | |
| 1610 | 1610 | |
| 1611 | 1611 | K056832_tilemap_draw(machine, bitmap, cliprect, code, k, 0); |
| 1612 | 1612 | } |
| r4135 | r4136 | |
| 1615 | 1615 | case -4: |
| 1616 | 1616 | if (disp & K55_INP_SUB1) |
| 1617 | 1617 | { |
| 1618 | int alpha = 255; | |
| 1618 | 1619 | if (j == GXMIX_BLEND_NONE) { temp1 = 0xff; temp2 = temp3 = 0; } else |
| 1619 | 1620 | if (j == GXMIX_BLEND_FORCE) { temp1 = 0x00; temp2 = mixerflags>>24; temp3 = 3; } |
| 1620 | 1621 | else |
| r4135 | r4136 | |
| 1626 | 1627 | |
| 1627 | 1628 | if (temp1!=0xff && temp2 /*&& temp3==3*/) |
| 1628 | 1629 | { |
| 1629 | temp4 = K054338_set_alpha_level(temp2); | |
| 1630 | alpha = temp4 = K054338_set_alpha_level(temp2); | |
| 1630 | 1631 | |
| 1631 | 1632 | if (temp4 <= 0) continue; |
| 1632 | 1633 | if (temp4 < 255) k = (j == GXMIX_BLEND_FAST) ? ~parity : 1; |
| r4135 | r4136 | |
| 1635 | 1636 | l = sub1flags & 0xf; |
| 1636 | 1637 | |
| 1637 | 1638 | if (offs == -2) |
| 1638 | K053936GP_0_zoom_draw(machine, bitmap, cliprect, sub1, l, k); | |
| 1639 | K053936GP_0_zoom_draw(machine, bitmap, cliprect, sub1, l, k, alpha); | |
| 1639 | 1640 | else |
| 1640 | 1641 | K053250_draw(machine, bitmap, cliprect, 0, vcblk[4]<<l, 0, 0); |
| 1641 | 1642 | } |
| r4135 | r4136 | |
| 1644 | 1645 | case -5: |
| 1645 | 1646 | if (disp & K55_INP_SUB2) |
| 1646 | 1647 | { |
| 1648 | int alpha = 255; | |
| 1647 | 1649 | if (j == GXMIX_BLEND_NONE) { temp1 = 0xff; temp2 = temp3 = 0; } else |
| 1648 | 1650 | if (j == GXMIX_BLEND_FORCE) { temp1 = 0x00; temp2 = mixerflags>>26; temp3 = 3; } |
| 1649 | 1651 | else |
| r4135 | r4136 | |
| 1655 | 1657 | |
| 1656 | 1658 | if (temp1!=0xff && temp2 /*&& temp3==3*/) |
| 1657 | 1659 | { |
| 1658 | temp4 = K054338_set_alpha_level(temp2); | |
| 1660 | alpha = temp4 = K054338_set_alpha_level(temp2); | |
| 1659 | 1661 | |
| 1660 | 1662 | if (temp4 <= 0) continue; |
| 1661 | 1663 | if (temp4 < 255) k = (j == GXMIX_BLEND_FAST) ? ~parity : 1; |
| r4135 | r4136 | |
| 1664 | 1666 | l = sub2flags & 0xf; |
| 1665 | 1667 | |
| 1666 | 1668 | if (offs == -3) |
| 1667 | K053936GP_1_zoom_draw(machine, bitmap, cliprect, sub2, l, k); | |
| 1669 | K053936GP_1_zoom_draw(machine, bitmap, cliprect, sub2, l, k, alpha); | |
| 1668 | 1670 | else |
| 1669 | 1671 | K053250_draw(machine, bitmap, cliprect, 1, vcblk[5]<<l, 0, 0); |
| 1670 | 1672 | } |
| r4135 | r4136 | |
|---|---|---|
| 7 | 7 | #include "cpu/z80/z80.h" |
| 8 | 8 | #include "cpu/m68000/m68000.h" |
| 9 | 9 | #include "cpu/tms32010/tms32010.h" |
| 10 | #include "sound/3812intf.h" | |
| 10 | 11 | #include "includes/toaplan1.h" |
| 11 | 12 | |
| 12 | 13 | #define CLEAR 0 |
| r4135 | r4136 | |
|---|---|---|
| 21 | 21 | void K053936GP_set_offset(int chip, int xoffs, int yoffs); |
| 22 | 22 | void K053936GP_clip_enable(int chip, int status); |
| 23 | 23 | void K053936GP_set_cliprect(int chip, int minx, int maxx, int miny, int maxy); |
| 24 | void K053936GP_0_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend); | |
| 25 | void K053936GP_1_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend); | |
| 24 | void K053936GP_0_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend, int alpha); | |
| 25 | void K053936GP_1_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend, int alpha); | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 |
| r4135 | r4136 | |
|---|---|---|
| 383 | 383 | // CDROM_LOG(("%s:RW HIRQ: %04x\n", cpuexec_describe_context(Machine), rv)) |
| 384 | 384 | |
| 385 | 385 | return rv; |
| 386 | break; | |
| 387 | 386 | |
| 388 | 387 | case 0x000c: |
| 389 | 388 | case 0x000e: |
| 390 | 389 | CDROM_LOG(("RW HIRM: %04x\n", hirqmask)) |
| 391 | 390 | return hirqmask; |
| 392 | break; | |
| 393 | 391 | |
| 394 | 392 | case 0x0018: |
| 395 | 393 | case 0x001a: |
| 396 | 394 | // CDROM_LOG(("RW CR1: %04x\n", cr1)) |
| 397 | 395 | return cr1; |
| 398 | break; | |
| 399 | 396 | |
| 400 | 397 | case 0x001c: |
| 401 | 398 | case 0x001e: |
| 402 | 399 | // CDROM_LOG(("RW CR2: %04x\n", cr2)) |
| 403 | 400 | return cr2; |
| 404 | break; | |
| 405 | 401 | |
| 406 | 402 | case 0x0020: |
| 407 | 403 | case 0x0022: |
| 408 | 404 | // CDROM_LOG(("RW CR3: %04x\n", cr3)) |
| 409 | 405 | return cr3; |
| 410 | break; | |
| 411 | 406 | |
| 412 | 407 | case 0x0024: |
| 413 | 408 | case 0x0026: |
| 414 | 409 | // CDROM_LOG(("RW CR4: %04x\n", cr4)) |
| 415 | 410 | return cr4; |
| 416 | break; | |
| 417 | 411 | |
| 418 | 412 | case 0x8000: |
| 419 | 413 | rv = 0xffff; |
| r4135 | r4136 | |
| 450 | 444 | } |
| 451 | 445 | |
| 452 | 446 | return rv; |
| 453 | break; | |
| 454 | 447 | |
| 455 | 448 | default: |
| 456 | 449 | CDROM_LOG(("%s:CD: RW %08x\n", cpuexec_describe_context(machine), addr)) |
| 457 | 450 | return 0xffff; |
| 458 | break; | |
| 459 | 451 | } |
| 460 | 452 | |
| 461 | 453 | } |
| r4135 | r4136 | |
| 526 | 518 | } |
| 527 | 519 | |
| 528 | 520 | return rv; |
| 529 | break; | |
| 530 | 521 | |
| 531 | 522 | default: |
| 532 | 523 | CDROM_LOG(("%s:CD: RL %08x\n", cpuexec_describe_context(machine), addr)) |
| 533 | 524 | return 0xffff; |
| 534 | break; | |
| 535 | 525 | } |
| 536 | 526 | } |
| 537 | 527 | |
| r4135 | r4136 | |
| 566 | 556 | case 0x0022: |
| 567 | 557 | // CDROM_LOG(("WW CR3: %04x\n", data)) |
| 568 | 558 | cr3 = data; |
| 569 | | |
| 559 | | |
| 570 | 560 | case 0x0024: |
| 571 | 561 | case 0x0026: |
| 572 | 562 | // CDROM_LOG(("WW CR4: %04x\n", data)) |
| r4135 | r4136 | |
| 1348 | 1338 | case 0x90026: |
| 1349 | 1339 | rv = cd_readWord(offset); |
| 1350 | 1340 | return rv<<16; |
| 1351 | break; | |
| 1352 | 1341 | |
| 1353 | 1342 | case 0x98000: |
| 1354 | 1343 | case 0x18000: |
| r4135 | r4136 | |
|---|---|---|
| 967 | 967 | |
| 968 | 968 | switch (customio_command[chip] & 0xf) |
| 969 | 969 | { |
| 970 | case 0x1: return namco_06xx_data_read(machine, 4*chip + 0); break; | |
| 971 | case 0x2: return namco_06xx_data_read(machine, 4*chip + 1); break; | |
| 972 | case 0x4: return namco_06xx_data_read(machine, 4*chip + 2); break; | |
| 973 | case 0x8: return namco_06xx_data_read(machine, 4*chip + 3); break; | |
| 970 | case 0x1: return namco_06xx_data_read(machine, 4*chip + 0); | |
| 971 | case 0x2: return namco_06xx_data_read(machine, 4*chip + 1); | |
| 972 | case 0x4: return namco_06xx_data_read(machine, 4*chip + 2); | |
| 973 | case 0x8: return namco_06xx_data_read(machine, 4*chip + 3); | |
| 974 | 974 | default: |
| 975 | 975 | logerror("%s: 06XX #%d read in unsupported mode %02x\n",cpuexec_describe_context(machine),chip,customio_command[chip]); |
| 976 | 976 | return 0xff; |
| r4135 | r4136 | |
|---|---|---|
| 36 | 36 | { |
| 37 | 37 | case 0: |
| 38 | 38 | return input_port_read(space->machine, "IN2"); /* cabinet & test mode */ |
| 39 | break; | |
| 40 | 39 | case 1: |
| 41 | 40 | return (mode == 2) ? gaplus_customio_3[offset] : 0x0f; |
| 42 | break; | |
| 43 | 41 | case 2: |
| 44 | 42 | return (mode == 2) ? 0x0f : 0x0e; |
| 45 | break; | |
| 46 | 43 | case 3: |
| 47 | 44 | return (mode == 2) ? gaplus_customio_3[offset] : 0x01; |
| 48 | break; | |
| 49 | 45 | default: |
| 50 | 46 | return gaplus_customio_3[offset]; |
| 51 | 47 | } |
| r4135 | r4136 | |
|---|---|---|
| 83 | 83 | |
| 84 | 84 | /* noise generator states */ |
| 85 | 85 | static UINT32 noise_position[6]; |
| 86 | static const device_config *cem_device[6]; | |
| 86 | 87 | |
| 87 | 88 | /* game-specific states */ |
| 88 | 89 | static UINT8 nstocker_bits; |
| r4135 | r4136 | |
| 182 | 183 | |
| 183 | 184 | /* reset the noise generator */ |
| 184 | 185 | memset(noise_position, 0, sizeof(noise_position)); |
| 186 | memset(cem_device, 0, sizeof(cem_device)); | |
| 185 | 187 | |
| 186 | 188 | /* point the banks to bank 0 */ |
| 187 | 189 | numbanks = (memory_region_length(machine, "main") > 0x40000) ? 16 : 8; |
| r4135 | r4136 | |
| 279 | 281 | } |
| 280 | 282 | |
| 281 | 283 | |
| 282 | void balsente_noise_gen( | |
| 284 | void balsente_noise_gen(const device_config *device, int count, short *buffer) | |
| 283 | 285 | { |
| 286 | int chip; | |
| 287 | UINT32 step, noise_counter; | |
| 288 | ||
| 289 | /* find the chip we are referring to */ | |
| 290 | for (chip = 0; chip < ARRAY_LENGTH(cem_device); chip++) | |
| 291 | { | |
| 292 | if (device == cem_device[chip]) | |
| 293 | break; | |
| 294 | else if (cem_device[chip] == NULL) | |
| 295 | { | |
| 296 | cem_device[chip] = device; | |
| 297 | break; | |
| 298 | } | |
| 299 | } | |
| 300 | assert(chip < ARRAY_LENGTH(cem_device)); | |
| 301 | ||
| 284 | 302 | /* noise generator runs at 100kHz */ |
| 285 | UINT32 step = (100000 << 14) / CEM3394_SAMPLE_RATE; | |
| 286 | UINT32 noise_counter = noise_position[chip]; | |
| 303 | step = (100000 << 14) / CEM3394_SAMPLE_RATE; | |
| 304 | noise_counter = noise_position[chip]; | |
| 287 | 305 | |
| 288 | 306 | while (count--) |
| 289 | 307 | { |
| r4135 | r4136 | |
|---|---|---|
| 1000 | 1000 | { |
| 1001 | 1001 | case 9: |
| 1002 | 1002 | return 0x6F; |
| 1003 | break; | |
| 1004 | 1003 | |
| 1005 | 1004 | case 14: |
| 1006 | 1005 | return 0x94; |
| 1007 | break; | |
| 1008 | 1006 | |
| 1009 | 1007 | default: |
| 1010 | 1008 | return 0xB4; |
| 1011 | break; | |
| 1012 | 1009 | } |
| 1013 | 1010 | } |
| 1014 | 1011 | } |
| r4135 | r4136 | |
|---|---|---|
| 514 | 514 | return snes_ram[offset]; |
| 515 | 515 | case RDIO: /* Programmable I/O port - echos back what's written to WRIO */ |
| 516 | 516 | return snes_ram[WRIO]; |
| 517 | break; | |
| 518 | 517 | case RDDIVL: /* Quotient of divide result (low) */ |
| 519 | 518 | case RDDIVH: /* Quotient of divide result (high) */ |
| 520 | 519 | case RDMPYL: /* Product/Remainder of mult/div result (low) */ |
| r4135 | r4136 | |
|---|---|---|
| 1221 | 1221 | |
| 1222 | 1222 | case REG_DENISEID: |
| 1223 | 1223 | return CUSTOM_REG(REG_DENISEID); |
| 1224 | break; | |
| 1225 | 1224 | } |
| 1226 | 1225 | |
| 1227 | 1226 | if (LOG_CUSTOM) |
| r4135 | r4136 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "cpu/m6502/m6502.h" | |
| 12 | #include "sound/2151intf.h" | |
| 13 | #include "sound/2413intf.h" | |
| 14 | #include "sound/5220intf.h" | |
| 15 | #include "sound/okim6295.h" | |
| 16 | #include "sound/pokey.h" | |
| 17 | #include "slapstic.h" | |
| 11 | 18 | #include "atarigen.h" |
| 12 | #include "slapstic.h" | |
| 13 | #include "cpu/m6502/m6502.h" | |
| 14 | 19 | |
| 15 | 20 | |
| 16 | 21 | |
| r4135 | r4136 | |
| 1605 | 1610 | { |
| 1606 | 1611 | gfx_element *gx0 = machine->gfx[gfx0]; |
| 1607 | 1612 | gfx_element *gx1 = machine->gfx[gfx1]; |
| 1613 | UINT8 *srcdata, *dest; | |
| 1608 | 1614 | int c, x, y; |
| 1609 | 1615 | |
| 1616 | /* allocate memory for the assembled data */ | |
| 1617 | srcdata = auto_malloc(gx0->total_elements * gx0->width * gx0->height); | |
| 1618 | ||
| 1610 | 1619 | /* loop over elements */ |
| 1620 | dest = srcdata; | |
| 1611 | 1621 | for (c = 0; c < gx0->total_elements; c++) |
| 1612 | 1622 | { |
| 1613 | UINT8 *c0base = gx0->gfxdata + gx0->char_modulo * c; | |
| 1614 | UINT8 *c1base = gx1->gfxdata + gx1->char_modulo * c; | |
| 1615 | UINT32 usage = 0; | |
| 1623 | const UINT8 *c0base = gfx_element_get_data(gx0, c); | |
| 1624 | const UINT8 *c1base = gfx_element_get_data(gx1, c); | |
| 1616 | 1625 | |
| 1617 | 1626 | /* loop over height */ |
| 1618 | 1627 | for (y = 0; y < gx0->height; y++) |
| 1619 | 1628 | { |
| 1620 | UINT8 *c0 = c0base, *c1 = c1base; | |
| 1629 | const UINT8 *c0 = c0base; | |
| 1630 | const UINT8 *c1 = c1base; | |
| 1621 | 1631 | |
| 1622 | for (x = 0; x < gx0->width; x++, c0++, c1++) | |
| 1623 | { | |
| 1624 | *c0 = (*c0 & mask0) | (*c1 & mask1); | |
| 1625 | usage |= 1 << *c0; | |
| 1626 | } | |
| 1632 | for (x = 0; x < gx0->width; x++) | |
| 1633 | *dest++ = (*c0++ & mask0) | (*c1++ & mask1); | |
| 1627 | 1634 | c0base += gx0->line_modulo; |
| 1628 | 1635 | c1base += gx1->line_modulo; |
| 1629 | if (gx0->pen_usage) | |
| 1630 | gx0->pen_usage[c] = usage; | |
| 1631 | 1636 | } |
| 1632 | 1637 | } |
| 1633 | 1638 | |
| 1634 | 1639 | /* free the second graphics element */ |
| 1635 | f | |
| 1640 | gfx_element_free(gx1); | |
| 1636 | 1641 | machine->gfx[gfx1] = NULL; |
| 1642 | ||
| 1643 | /* create a simple target layout */ | |
| 1644 | gx0->layout.planes = 8; | |
| 1645 | for (x = 0; x < 8; x++) | |
| 1646 | gx0->layout.planeoffset[x] = x; | |
| 1647 | for (x = 0; x < gx0->width; x++) | |
| 1648 | gx0->layout.xoffset[x] = 8 * x; | |
| 1649 | for (y = 0; y < gx0->height; y++) | |
| 1650 | gx0->layout.yoffset[y] = 8 * y * gx0->width; | |
| 1651 | gx0->layout.charincrement = 8 * gx0->width * gx0->height; | |
| 1652 | ||
| 1653 | /* make the assembled data our new source data */ | |
| 1654 | gfx_element_set_source(gx0, srcdata); | |
| 1637 | 1655 | } |
| 1638 | 1656 | |
| 1639 | 1657 |
| r4135 | r4136 | |
|---|---|---|
| 121 | 121 | |
| 122 | 122 | ////////////////////////////////////////////////////////////////// |
| 123 | 123 | |
| 124 | UINT8 DSP1_getSr(void) | |
| 124 | static UINT8 DSP1_getSr(void) | |
| 125 | 125 | { |
| 126 | 126 | mSrLowByteAccess = ~mSrLowByteAccess; |
| 127 | 127 | if (mSrLowByteAccess) |
| r4135 | r4136 | |
| 136 | 136 | |
| 137 | 137 | ////////////////////////////////////////////////////////////////// |
| 138 | 138 | |
| 139 | UINT8 DSP1_getDr(void) | |
| 139 | static UINT8 DSP1_getDr(void) | |
| 140 | 140 | { |
| 141 | 141 | UINT8 oDr; |
| 142 | 142 | |
| r4135 | r4136 | |
| 146 | 146 | |
| 147 | 147 | ////////////////////////////////////////////////////////////////// |
| 148 | 148 | |
| 149 | void DSP1_setDr(UINT8 iDr) | |
| 149 | static void DSP1_setDr(UINT8 iDr) | |
| 150 | 150 | { |
| 151 | 151 | DSP1_fsmStep(0, &iDr); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | ////////////////////////////////////////////////////////////////// |
| 155 | 155 | |
| 156 | void DSP1_reset(running_machine *machine) | |
| 156 | static void DSP1_reset(running_machine *machine) | |
| 157 | 157 | { |
| 158 | 158 | UINT32 i; |
| 159 | 159 | UINT8 *dspin = memory_region(machine, "user6"); |
| r4135 | r4136 | |
|---|---|---|
| 330 | 330 | |
| 331 | 331 | case 0x00ff: |
| 332 | 332 | { |
| 333 | static UINT16 shogwarr_snip_[] = { | |
| 333 | static const UINT16 shogwarr_snip_[] = { | |
| 334 | 334 | 0x48E7,0xFFFE, // movem.l D0-D7/A0-A6, -(A7) |
| 335 | 335 | |
| 336 | 336 | 0x3039,0x00A8,0x0000, // move.w $a80000.l, D0 |
| r4135 | r4136 | |
| 567 | 567 | */ |
| 568 | 568 | |
| 569 | 569 | |
| 570 | static UINT8 toybox_mcu_decryption_table[0x100] = { | |
| 570 | static const UINT8 toybox_mcu_decryption_table[0x100] = { | |
| 571 | 571 | 0x7b,0x82,0xf0,0xbc,0x7f,0x1d,0xa2,0xc5,0x2a,0xfa,0x55,0xee,0x1a,0xd0,0x59,0x76, |
| 572 | 572 | 0x5e,0x75,0x79,0x16,0xa5,0xf6,0x84,0xed,0x0f,0x2e,0xf2,0x36,0x61,0xac,0xcd,0xab, |
| 573 | 573 | 0x01,0x3b,0x01,0x87,0x73,0xab,0xce,0x5d,0xd4,0x1d,0x68,0x2a,0x35,0xea,0x13,0x27, |
| r4135 | r4136 | |
| 587 | 587 | }; |
| 588 | 588 | |
| 589 | 589 | |
| 590 | static UINT8 toybox_mcu_decryption_table_alt[0x100] = { | |
| 590 | static const UINT8 toybox_mcu_decryption_table_alt[0x100] = { | |
| 591 | 591 | 0x26,0x17,0xb9,0xcf,0x1a,0xf5,0x14,0x1e,0x0c,0x35,0xb3,0x66,0xa0,0x17,0xe9,0xe4, |
| 592 | 592 | 0x90,0xf6,0xd5,0x35,0xac,0x95,0x49,0x43,0x64,0x0c,0x03,0x75,0x4d,0xda,0xb6,0xdf, |
| 593 | 593 | 0x06,0xcf,0x83,0x9e,0x35,0x2c,0x71,0x2a,0xab,0xcc,0x65,0xd4,0x1f,0xb0,0x88,0x3c, |
| r4135 | r4136 | |
|---|---|---|
| 8 | 8 | #include "audio/williams.h" |
| 9 | 9 | #include "cpu/m6800/m6800.h" |
| 10 | 10 | #include "cpu/m6809/m6809.h" |
| 11 | #include "machine/6821 | |
| 11 | #include "machine/6821new.h" | |
| 12 | 12 | #include "machine/ticket.h" |
| 13 | 13 | #include "williams.h" |
| 14 | 14 | #include "sound/dac.h" |
| r4135 | r4136 | |
| 31 | 31 | static UINT16 joust2_current_sound_data; |
| 32 | 32 | |
| 33 | 33 | /* older-Williams routines */ |
| 34 | static void williams_main_irq(running_machine *machine, int state); | |
| 35 | static void williams_main_firq(running_machine *machine, int state); | |
| 36 | static void williams_snd_irq(running_machine *machine, int state); | |
| 37 | static WRITE8_HANDLER( williams_snd_cmd_w ); | |
| 38 | static WRITE8_HANDLER( playball_snd_cmd_w ); | |
| 34 | static void williams_main_irq(const device_config *device, int state); | |
| 35 | static void williams_main_firq(const device_config *device, int state); | |
| 36 | static void williams_snd_irq(const device_config *device, int state); | |
| 37 | static WRITE8_DEVICE_HANDLER( williams_snd_cmd_w ); | |
| 38 | static WRITE8_DEVICE_HANDLER( playball_snd_cmd_w ); | |
| 39 | 39 | |
| 40 | 40 | /* input port mapping */ |
| 41 | 41 | static UINT8 port_select; |
| 42 | static WRITE8_HANDLER( williams_port_select_w ); | |
| 43 | static READ8_HANDLER( williams_input_port_49way_0_5_r ); | |
| 44 | static READ8_HANDLER( williams_49way_port_0_r ); | |
| 42 | static WRITE8_DEVICE_HANDLER( williams_port_select_w ); | |
| 43 | static READ8_DEVICE_HANDLER( williams_input_port_49way_0_5_r ); | |
| 44 | static READ8_DEVICE_HANDLER( williams_49way_port_0_r ); | |
| 45 | 45 | |
| 46 | 46 | /* newer-Williams routines */ |
| 47 | static WRITE8_HANDLER( williams2_snd_cmd_w ); | |
| 48 | static void mysticm_main_irq(running_machine *machine, int state); | |
| 49 | static void tshoot_main_irq(running_machine *machine, int state); | |
| 47 | static WRITE8_DEVICE_HANDLER( williams2_snd_cmd_w ); | |
| 48 | static void mysticm_main_irq(const device_config *device, int state); | |
| 49 | static void tshoot_main_irq(const device_config *device, int state); | |
| 50 | 50 | |
| 51 | 51 | /* Lotto Fun-specific code */ |
| 52 | static READ8_HANDLER( lottofun_input_port_0_r ); | |
| 52 | static READ8_DEVICE_HANDLER( lottofun_input_port_0_r ); | |
| 53 | 53 | |
| 54 | 54 | /* Turkey Shoot-specific code */ |
| 55 | static READ8_HANDLER( tshoot_input_port_0_3_r ); | |
| 56 | static WRITE8_HANDLER( tshoot_lamp_w ); | |
| 57 | static WRITE8_HANDLER( tshoot_maxvol_w ); | |
| 55 | static READ8_DEVICE_HANDLER( tshoot_input_port_0_3_r ); | |
| 56 | static WRITE8_DEVICE_HANDLER( tshoot_lamp_w ); | |
| 57 | static WRITE8_DEVICE_HANDLER( tshoot_maxvol_w ); | |
| 58 | 58 | |
| 59 | 59 | /* Joust 2-specific code */ |
| 60 | static WRITE8_HANDLER( joust2_snd_cmd_w ); | |
| 61 | static WRITE8_HANDLER( joust2_pia_3_cb1_w ); | |
| 60 | static WRITE8_DEVICE_HANDLER( joust2_snd_cmd_w ); | |
| 61 | static WRITE8_DEVICE_HANDLER( joust2_pia_3_cb1_w ); | |
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | /************************************* |
| 66 | 66 | * |
| 67 | * Trampoline functions | |
| 68 | * | |
| 69 | *************************************/ | |
| 70 | ||
| 71 | static READ8_DEVICE_HANDLER( input_port_0_device_r ) { return input_port_read_direct(input_port_by_index(device->machine->portconfig, 0)); } | |
| 72 | static READ8_DEVICE_HANDLER( input_port_1_device_r ) { return input_port_read_direct(input_port_by_index(device->machine->portconfig, 1)); } | |
| 73 | static READ8_DEVICE_HANDLER( input_port_2_device_r ) { return input_port_read_direct(input_port_by_index(device->machine->portconfig, 2)); } | |
| 74 | static READ8_DEVICE_HANDLER( input_port_3_device_r ) { return input_port_read_direct(input_port_by_index(device->machine->portconfig, 3)); } | |
| 75 | static READ8_DEVICE_HANDLER( input_port_4_device_r ) { return input_port_read_direct(input_port_by_index(device->machine->portconfig, 4)); } | |
| 76 | ||
| 77 | static WRITE8_DEVICE_HANDLER( williams_dac_data_w ) | |
| 78 | { | |
| 79 | const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 80 | dac_0_data_w(space, offset, data); | |
| 81 | } | |
| 82 | ||
| 83 | static WRITE8_DEVICE_HANDLER( williams_ticket_dispenser_w ) | |
| 84 | { | |
| 85 | const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 86 | ticket_dispenser_w(space, offset, data); | |
| 87 | } | |
| 88 | ||
| 89 | static WRITE8_DEVICE_HANDLER( williams_hc55516_0_digit_w ) | |
| 90 | { | |
| 91 | const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 92 | hc55516_0_digit_w(space, offset, data); | |
| 93 | } | |
| 94 | ||
| 95 | static WRITE8_DEVICE_HANDLER( williams_hc55516_0_clock_w ) | |
| 96 | { | |
| 97 | const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 98 | hc55516_0_clock_w(space, offset, data); | |
| 99 | } | |
| 100 | ||
| 101 | static WRITE8_DEVICE_HANDLER( pia_1_portb_w ) | |
| 102 | { | |
| 103 | const device_config *pia_1 = devtag_get_device(device->machine, PIA6821, "pia_1"); | |
| 104 | pia_portb_w(pia_1, offset, data); | |
| 105 | } | |
| 106 | ||
| 107 | static WRITE8_DEVICE_HANDLER( pia_1_cb1_w ) | |
| 108 | { | |
| 109 | const device_config *pia_1 = devtag_get_device(device->machine, PIA6821, "pia_1"); | |
| 110 | pia_cb1_w(pia_1, offset, data); | |
| 111 | } | |
| 112 | ||
| 113 | static WRITE8_DEVICE_HANDLER( pia_2_ca1_w ) | |
| 114 | { | |
| 115 | const device_config *pia_2 = devtag_get_device(device->machine, PIA6821, "pia_2"); | |
| 116 | pia_ca1_w(pia_2, offset, data); | |
| 117 | } | |
| 118 | ||
| 119 | /************************************* | |
| 120 | * | |
| 67 | 121 | * Generic old-Williams PIA interfaces |
| 68 | 122 | * |
| 69 | 123 | *************************************/ |
| r4135 | r4136 | |
| 71 | 125 | /* Generic PIA 0, maps to input ports 0 and 1 */ |
| 72 | 126 | const pia6821_interface williams_pia_0_intf = |
| 73 | 127 | { |
| 74 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_0_r, input_port_1_r, 0, 0, 0, 0, | |
| 128 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_0_device_r, input_port_1_device_r, 0, 0, 0, 0, | |
| 75 | 129 | /*outputs: A/B,CA/B2 */ 0, 0, 0, 0, |
| 76 | 130 | /*irqs : A/B */ 0, 0 |
| 77 | 131 | }; |
| r4135 | r4136 | |
| 81 | 135 | /* muxing done in williams_mux_r */ |
| 82 | 136 | const pia6821_interface williams_muxed_pia_0_intf = |
| 83 | 137 | { |
| 84 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_0_r, input_port_1_r, 0, 0, 0, 0, | |
| 138 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_0_device_r, input_port_1_device_r, 0, 0, 0, 0, | |
| 85 | 139 | /*outputs: A/B,CA/B2 */ 0, 0, 0, williams_port_select_w, |
| 86 | 140 | /*irqs : A/B */ 0, 0 |
| 87 | 141 | }; |
| r4135 | r4136 | |
| 89 | 143 | /* Generic 49-way joystick PIA 0 for Sinistar/Blaster */ |
| 90 | 144 | const pia6821_interface williams_49way_pia_0_intf = |
| 91 | 145 | { |
| 92 | /*inputs : A/B,CA/B1,CA/B2 */ williams_49way_port_0_r, input_port_1_r, 0, 0, 0, 0, | |
| 146 | /*inputs : A/B,CA/B1,CA/B2 */ williams_49way_port_0_r, input_port_1_device_r, 0, 0, 0, 0, | |
| 93 | 147 | /*outputs: A/B,CA/B2 */ 0, 0, 0, 0, |
| 94 | 148 | /*irqs : A/B */ 0, 0 |
| 95 | 149 | }; |
| r4135 | r4136 | |
| 97 | 151 | /* Muxing 49-way joystick PIA 0 for Blaster kit */ |
| 98 | 152 | const pia6821_interface williams_49way_muxed_pia_0_intf = |
| 99 | 153 | { |
| 100 | /*inputs : A/B,CA/B1,CA/B2 */ williams_input_port_49way_0_5_r, input_port_1_r, 0, 0, 0, 0, | |
| 154 | /*inputs : A/B,CA/B1,CA/B2 */ williams_input_port_49way_0_5_r, input_port_1_device_r, 0, 0, 0, 0, | |
| 101 | 155 | /*outputs: A/B,CA/B2 */ 0, 0, 0, williams_port_select_w, |
| 102 | 156 | /*irqs : A/B */ 0, 0 |
| 103 | 157 | }; |
| r4135 | r4136 | |
| 105 | 159 | /* Generic PIA 1, maps to input port 2, sound command out, and IRQs */ |
| 106 | 160 | const pia6821_interface williams_pia_1_intf = |
| 107 | 161 | { |
| 108 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_r, 0, 0, 0, 0, 0, | |
| 162 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_device_r, 0, 0, 0, 0, 0, | |
| 109 | 163 | /*outputs: A/B,CA/B2 */ 0, williams_snd_cmd_w, 0, 0, |
| 110 | 164 | /*irqs : A/B */ williams_main_irq, williams_main_irq |
| 111 | 165 | }; |
| r4135 | r4136 | |
| 114 | 168 | const pia6821_interface williams_snd_pia_intf = |
| 115 | 169 | { |
| 116 | 170 | /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, |
| 117 | /*outputs: A/B,CA/B2 */ dac | |
| 171 | /*outputs: A/B,CA/B2 */ williams_dac | |
| 118 | 172 | /*irqs : A/B */ williams_snd_irq, williams_snd_irq |
| 119 | 173 | }; |
| 120 | 174 | |
| r4135 | r4136 | |
| 129 | 183 | /* Special PIA 0 for Lotto Fun, to handle the controls and ticket dispenser */ |
| 130 | 184 | const pia6821_interface lottofun_pia_0_intf = |
| 131 | 185 | { |
| 132 | /*inputs : A/B,CA/B1,CA/B2 */ lottofun_input_port_0_r, input_port_1_r, 0, 0, 0, 0, | |
| 133 | /*outputs: A/B,CA/B2 */ 0, ticket_dispenser_w, 0, 0, | |
| 186 | /*inputs : A/B,CA/B1,CA/B2 */ lottofun_input_port_0_r, input_port_1_device_r, 0, 0, 0, 0, | |
| 187 | /*outputs: A/B,CA/B2 */ 0, williams_ticket_dispenser_w, 0, 0, | |
| 134 | 188 | /*irqs : A/B */ 0, 0 |
| 135 | 189 | }; |
| 136 | 190 | |
| r4135 | r4136 | |
| 138 | 192 | const pia6821_interface sinistar_snd_pia_intf = |
| 139 | 193 | { |
| 140 | 194 | /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, |
| 141 | /*outputs: A/B,CA/B2 */ dac_ | |
| 195 | /*outputs: A/B,CA/B2 */ williams_dac_ | |
| 142 | 196 | /*irqs : A/B */ williams_snd_irq, williams_snd_irq |
| 143 | 197 | }; |
| 144 | 198 | |
| 145 | 199 | /* Special PIA 1 for PlayBall, doesn't set the high bits on sound commands */ |
| 146 | 200 | const pia6821_interface playball_pia_1_intf = |
| 147 | 201 | { |
| 148 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_r, 0, 0, 0, 0, 0, | |
| 202 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_device_r, 0, 0, 0, 0, 0, | |
| 149 | 203 | /*outputs: A/B,CA/B2 */ 0, playball_snd_cmd_w, 0, 0, |
| 150 | 204 | /*irqs : A/B */ williams_main_irq, williams_main_irq |
| 151 | 205 | }; |
| r4135 | r4136 | |
| 153 | 207 | /* extra PIA 3 for Speed Ball */ |
| 154 | 208 | const pia6821_interface spdball_pia_3_intf = |
| 155 | 209 | { |
| 156 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_3_r, input_port_4_r, 0, 0, 0, 0, | |
| 210 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_3_device_r, input_port_4_device_r, 0, 0, 0, 0, | |
| 157 | 211 | /*outputs: A/B,CA/B2 */ 0, 0, 0, 0, |
| 158 | 212 | /*irqs : A/B */ 0, 0 |
| 159 | 213 | }; |
| r4135 | r4136 | |
| 169 | 223 | /* Generic muxing PIA 0, maps to input ports 0/3 and 1; port select is CA2 */ |
| 170 | 224 | const pia6821_interface williams2_muxed_pia_0_intf = |
| 171 | 225 | { |
| 172 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_0_r, input_port_1_r, 0, 0, 0, 0, | |
| 226 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_0_device_r, input_port_1_device_r, 0, 0, 0, 0, | |
| 173 | 227 | /*outputs: A/B,CA/B2 */ 0, 0, williams_port_select_w, 0, |
| 174 | 228 | /*irqs : A/B */ 0, 0 |
| 175 | 229 | }; |
| r4135 | r4136 | |
| 177 | 231 | /* Generic PIA 1, maps to input port 2, sound command out, and IRQs */ |
| 178 | 232 | const pia6821_interface williams2_pia_1_intf = |
| 179 | 233 | { |
| 180 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_r, 0, 0, 0, 0, 0, | |
| 234 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_device_r, 0, 0, 0, 0, 0, | |
| 181 | 235 | /*outputs: A/B,CA/B2 */ 0, williams2_snd_cmd_w, 0, pia_2_ca1_w, |
| 182 | 236 | /*irqs : A/B */ williams_main_irq, williams_main_irq |
| 183 | 237 | }; |
| r4135 | r4136 | |
| 186 | 240 | const pia6821_interface williams2_snd_pia_intf = |
| 187 | 241 | { |
| 188 | 242 | /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, |
| 189 | /*outputs: A/B,CA/B2 */ pia_1_portb_w, dac | |
| 243 | /*outputs: A/B,CA/B2 */ pia_1_portb_w, williams_dac | |
| 190 | 244 | /*irqs : A/B */ williams_snd_irq, williams_snd_irq |
| 191 | 245 | }; |
| 192 | 246 | |
| r4135 | r4136 | |
| 201 | 255 | /* Mystic Marathon PIA 0 */ |
| 202 | 256 | const pia6821_interface mysticm_pia_0_intf = |
| 203 | 257 | { |
| 204 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_0_r, input_port_1_r, 0, 0, 0, 0, | |
| 258 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_0_device_r, input_port_1_device_r, 0, 0, 0, 0, | |
| 205 | 259 | /*outputs: A/B,CA/B2 */ 0, 0, 0, 0, |
| 206 | 260 | /*irqs : A/B */ williams_main_firq, mysticm_main_irq |
| 207 | 261 | }; |
| r4135 | r4136 | |
| 209 | 263 | /* Mystic Marathon PIA 1 */ |
| 210 | 264 | const pia6821_interface mysticm_pia_1_intf = |
| 211 | 265 | { |
| 212 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_r, 0, 0, 0, 0, 0, | |
| 266 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_device_r, 0, 0, 0, 0, 0, | |
| 213 | 267 | /*outputs: A/B,CA/B2 */ 0, williams2_snd_cmd_w, 0, pia_2_ca1_w, |
| 214 | 268 | /*irqs : A/B */ mysticm_main_irq, mysticm_main_irq |
| 215 | 269 | }; |
| r4135 | r4136 | |
| 217 | 271 | /* Turkey Shoot PIA 0 */ |
| 218 | 272 | const pia6821_interface tshoot_pia_0_intf = |
| 219 | 273 | { |
| 220 | /*inputs : A/B,CA/B1,CA/B2 */ tshoot_input_port_0_3_r, input_port_1_r, 0, 0, 0, 0, | |
| 274 | /*inputs : A/B,CA/B1,CA/B2 */ tshoot_input_port_0_3_r, input_port_1_device_r, 0, 0, 0, 0, | |
| 221 | 275 | /*outputs: A/B,CA/B2 */ 0, tshoot_lamp_w, williams_port_select_w, 0, |
| 222 | 276 | /*irqs : A/B */ tshoot_main_irq, tshoot_main_irq |
| 223 | 277 | }; |
| r4135 | r4136 | |
| 225 | 279 | /* Turkey Shoot PIA 1 */ |
| 226 | 280 | const pia6821_interface tshoot_pia_1_intf = |
| 227 | 281 | { |
| 228 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_r, 0, 0, 0, 0, 0, | |
| 282 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_device_r, 0, 0, 0, 0, 0, | |
| 229 | 283 | /*outputs: A/B,CA/B2 */ 0, williams2_snd_cmd_w, 0, pia_2_ca1_w, |
| 230 | 284 | /*irqs : A/B */ tshoot_main_irq, tshoot_main_irq |
| 231 | 285 | }; |
| r4135 | r4136 | |
| 234 | 288 | const pia6821_interface tshoot_snd_pia_intf = |
| 235 | 289 | { |
| 236 | 290 | /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, |
| 237 | /*outputs: A/B,CA/B2 */ pia_1_portb_w, dac | |
| 291 | /*outputs: A/B,CA/B2 */ pia_1_portb_w, williams_dac | |
| 238 | 292 | /*irqs : A/B */ williams_snd_irq, williams_snd_irq |
| 239 | 293 | }; |
| 240 | 294 | |
| 241 | 295 | /* Joust 2 PIA 1 */ |
| 242 | 296 | const pia6821_interface joust2_pia_1_intf = |
| 243 | 297 | { |
| 244 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_r, 0, 0, 0, 0, 0, | |
| 298 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_2_device_r, 0, 0, 0, 0, 0, | |
| 245 | 299 | /*outputs: A/B,CA/B2 */ 0, joust2_snd_cmd_w, joust2_pia_3_cb1_w, pia_2_ca1_w, |
| 246 | 300 | /*irqs : A/B */ williams_main_irq, williams_main_irq |
| 247 | 301 | }; |
| 248 | 302 | |
| 303 | /* Joust 2 PIA 3 */ | |
| 304 | const pia6821_interface joust2_pia_3_intf = | |
| 305 | { | |
| 306 | 0, | |
| 307 | }; | |
| 249 | 308 | |
| 250 | 309 | |
| 251 | 310 | /************************************* |
| r4135 | r4136 | |
| 256 | 315 | |
| 257 | 316 | static TIMER_CALLBACK( williams_va11_callback ) |
| 258 | 317 | { |
| 259 | const | |
| 318 | const | |
| 260 | 319 | int scanline = param; |
| 261 | 320 | |
| 262 | 321 | /* the IRQ signal comes into CB1, and is set to VA11 */ |
| 263 | pia_ | |
| 322 | pia_ | |
| 264 | 323 | |
| 265 | 324 | /* set a timer for the next update */ |
| 266 | 325 | scanline += 0x20; |
| r4135 | r4136 | |
| 271 | 330 | |
| 272 | 331 | static TIMER_CALLBACK( williams_count240_off_callback ) |
| 273 | 332 | { |
| 274 | const | |
| 333 | const | |
| 275 | 334 | |
| 276 | 335 | /* the COUNT240 signal comes into CA1, and is set to the logical AND of VA10-VA13 */ |
| 277 | pia_ | |
| 336 | pia_ | |
| 278 | 337 | } |
| 279 | 338 | |
| 280 | 339 | |
| 281 | 340 | static TIMER_CALLBACK( williams_count240_callback ) |
| 282 | 341 | { |
| 283 | const | |
| 342 | const | |
| 284 | 343 | |
| 285 | 344 | /* the COUNT240 signal comes into CA1, and is set to the logical AND of VA10-VA13 */ |
| 286 | pia_ | |
| 345 | pia_ | |
| 287 | 346 | |
| 288 | 347 | /* set a timer to turn it off once the scanline counter resets */ |
| 289 | 348 | timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, williams_count240_off_callback); |
| r4135 | r4136 | |
| 293 | 352 | } |
| 294 | 353 | |
| 295 | 354 | |
| 296 | static void williams_main_irq( | |
| 355 | static void williams_main_irq(const device_ | |
| 297 | 356 | { |
| 298 | int combined_state = pia_get_irq_a(1) | pia_get_irq_b(1); | |
| 357 | const device_config *pia_1 = devtag_get_device(device->machine, PIA6821, "pia_1"); | |
| 358 | int combined_state = pianew_get_irq_a(pia_1) | pianew_get_irq_b(pia_1); | |
| 299 | 359 | |
| 300 | 360 | /* IRQ to the main CPU */ |
| 301 | cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); | |
| 361 | cpu_set_input_line(device->machine->cpu[0], M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); | |
| 302 | 362 | } |
| 303 | 363 | |
| 304 | 364 | |
| 305 | static void williams_main_firq( | |
| 365 | static void williams_main_firq(const device_ | |
| 306 | 366 | { |
| 307 | 367 | /* FIRQ to the main CPU */ |
| 308 | cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE); | |
| 368 | cpu_set_input_line(device->machine->cpu[0], M6809_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE); | |
| 309 | 369 | } |
| 310 | 370 | |
| 311 | 371 | |
| 312 | static void williams_snd_irq( | |
| 372 | static void williams_snd_irq(const device_ | |
| 313 | 373 | { |
| 314 | int combined_state = pia_get_irq_a(2) | pia_get_irq_b(2); | |
| 374 | const device_config *pia_2 = devtag_get_device(device->machine, PIA6821, "pia_2"); | |
| 375 | int combined_state = pianew_get_irq_a(pia_2) | pianew_get_irq_b(pia_2); | |
| 315 | 376 | |
| 316 | 377 | /* IRQ to the sound CPU */ |
| 317 | cpu_set_input_line(machine->cpu[1], M6800_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); | |
| 378 | cpu_set_input_line(device->machine->cpu[1], M6800_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); | |
| 318 | 379 | } |
| 319 | 380 | |
| 320 | 381 | |
| r4135 | r4136 | |
| 325 | 386 | * |
| 326 | 387 | *************************************/ |
| 327 | 388 | |
| 328 | static void mysticm_main_irq( | |
| 389 | static void mysticm_main_irq(const device_ | |
| 329 | 390 | { |
| 330 | int combined_state = pia_get_irq_b(0) | pia_get_irq_a(1) | pia_get_irq_b(1); | |
| 391 | const device_config *pia_0 = devtag_get_device(device->machine, PIA6821, "pia_0"); | |
| 392 | const device_config *pia_1 = devtag_get_device(device->machine, PIA6821, "pia_1"); | |
| 393 | int combined_state = pianew_get_irq_b(pia_0) | pianew_get_irq_a(pia_1) | pianew_get_irq_b(pia_1); | |
| 331 | 394 | |
| 332 | 395 | /* IRQ to the main CPU */ |
| 333 | cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); | |
| 396 | cpu_set_input_line(device->machine->cpu[0], M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); | |
| 334 | 397 | } |
| 335 | 398 | |
| 336 | 399 | |
| 337 | static void tshoot_main_irq( | |
| 400 | static void tshoot_main_irq(const device_ | |
| 338 | 401 | { |
| 339 | int combined_state = pia_get_irq_a(0) | pia_get_irq_b(0) | pia_get_irq_a(1) | pia_get_irq_b(1); | |
| 402 | const device_config *pia_0 = devtag_get_device(device->machine, PIA6821, "pia_0"); | |
| 403 | const device_config *pia_1 = devtag_get_device(device->machine, PIA6821, "pia_1"); | |
| 404 | int combined_state = pianew_get_irq_a(pia_0) | pianew_get_irq_b(pia_0) | pianew_get_irq_a(pia_1) | pianew_get_irq_b(pia_1); | |
| 340 | 405 | |
| 341 | 406 | /* IRQ to the main CPU */ |
| 342 | cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); | |
| 407 | cpu_set_input_line(device->machine->cpu[0], M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); | |
| 343 | 408 | } |
| 344 | 409 | |
| 345 | 410 | |
| r4135 | r4136 | |
| 352 | 417 | |
| 353 | 418 | static MACHINE_RESET( williams_common ) |
| 354 | 419 | { |
| 355 | /* reset the PIAs */ | |
| 356 | pia_reset(); | |
| 357 | ||
| 358 | 420 | /* reset the ticket dispenser (Lotto Fun) */ |
| 359 | 421 | ticket_dispenser_init(machine, 70, TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH); |
| 360 | 422 | |
| r4135 | r4136 | |
| 389 | 451 | |
| 390 | 452 | static TIMER_CALLBACK( williams2_va11_callback ) |
| 391 | 453 | { |
| 392 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 454 | const device_config *pia_0 = devtag_get_device(machine, PIA6821, "pia_0"); | |
| 455 | const device_config *pia_1 = devtag_get_device(machine, PIA6821, "pia_1"); | |
| 393 | 456 | int scanline = param; |
| 394 | 457 | |
| 395 | 458 | /* the IRQ signal comes into CB1, and is set to VA11 */ |
| 396 | pia_0_cb1_w(space, 0, scanline & 0x20); | |
| 397 | pia_1_ca1_w(space, 0, scanline & 0x20); | |
| 459 | pia_cb1_w(pia_0, 0, scanline & 0x20); | |
| 460 | pia_ca1_w(pia_1, 0, scanline & 0x20); | |
| 398 | 461 | |
| 399 | 462 | /* set a timer for the next update */ |
| 400 | 463 | scanline += 0x20; |
| r4135 | r4136 | |
| 405 | 468 | |
| 406 | 469 | static TIMER_CALLBACK( williams2_endscreen_off_callback ) |
| 407 | 470 | { |
| 408 | const | |
| 471 | const | |
| 409 | 472 | |
| 410 | 473 | /* the /ENDSCREEN signal comes into CA1 */ |
| 411 | pia_ | |
| 474 | pia_ | |
| 412 | 475 | } |
| 413 | 476 | |
| 414 | 477 | |
| 415 | 478 | static TIMER_CALLBACK( williams2_endscreen_callback ) |
| 416 | 479 | { |
| 417 | const | |
| 480 | const | |
| 418 | 481 | |
| 419 | 482 | /* the /ENDSCREEN signal comes into CA1 */ |
| 420 | pia_ | |
| 483 | pia_ | |
| 421 | 484 | |
| 422 | 485 | /* set a timer to turn it off once the scanline counter resets */ |
| 423 | 486 | timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, 8, 0), NULL, 0, williams2_endscreen_off_callback); |
| r4135 | r4136 | |
| 445 | 508 | { |
| 446 | 509 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 447 | 510 | |
| 448 | /* reset the PIAs */ | |
| 449 | pia_reset(); | |
| 450 | ||
| 451 | 511 | /* configure memory banks */ |
| 452 | 512 | memory_configure_bank(machine, 1, 0, 1, williams_videoram, 0); |
| 453 | 513 | memory_configure_bank(machine, 1, 1, 4, memory_region(machine, "main") + 0x10000, 0x10000); |
| r4135 | r4136 | |
| 529 | 589 | |
| 530 | 590 | static TIMER_CALLBACK( williams_deferred_snd_cmd_w ) |
| 531 | 591 | { |
| 532 | const address_space *space = ptr; | |
| 533 | pia_2_portb_w(space, 0, param); | |
| 534 | pia_2_cb1_w(space, 0, (param == 0xff) ? 0 : 1); | |
| 592 | const device_config *pia_2 = devtag_get_device(machine, PIA6821, "pia_2"); | |
| 593 | ||
| 594 | pia_portb_w(pia_2, 0, param); | |
| 595 | pia_cb1_w(pia_2, 0, (param == 0xff) ? 0 : 1); | |
| 535 | 596 | } |
| 536 | 597 | |
| 537 | WRITE8_HANDLER( williams_snd_cmd_w ) | |
| 598 | WRITE8_DEVICE_HANDLER( williams_snd_cmd_w ) | |
| 538 | 599 | { |
| 539 | 600 | /* the high two bits are set externally, and should be 1 */ |
| 540 | timer_call_after_resynch( | |
| 601 | timer_call_after_resynch(device->machine, NULL | |
| 541 | 602 | } |
| 542 | 603 | |
| 543 | WRITE8_HANDLER( playball_snd_cmd_w ) | |
| 604 | WRITE8_DEVICE_HANDLER( playball_snd_cmd_w ) | |
| 544 | 605 | { |
| 545 | timer_call_after_resynch( | |
| 606 | timer_call_after_resynch(device->machine, NULL | |
| 546 | 607 | } |
| 547 | 608 | |
| 548 | 609 | |
| 549 | 610 | static TIMER_CALLBACK( williams2_deferred_snd_cmd_w ) |
| 550 | 611 | { |
| 551 | const address_space *space = ptr; | |
| 552 | pia_2_porta_w(space, 0, param); | |
| 612 | const device_config *pia_2 = devtag_get_device(machine, PIA6821, "pia_2"); | |
| 613 | ||
| 614 | pia_porta_w(pia_2, 0, param); | |
| 553 | 615 | } |
| 554 | 616 | |
| 555 | static WRITE8_HANDLER( williams2_snd_cmd_w ) | |
| 617 | static WRITE8_DEVICE_HANDLER( williams2_snd_cmd_w ) | |
| 556 | 618 | { |
| 557 | timer_call_after_resynch( | |
| 619 | timer_call_after_resynch(device->machine, NULL | |
| 558 | 620 | } |
| 559 | 621 | |
| 560 | 622 | |
| r4135 | r4136 | |
| 565 | 627 | * |
| 566 | 628 | *************************************/ |
| 567 | 629 | |
| 568 | WRITE8_HANDLER( williams_port_select_w ) | |
| 630 | WRITE8_DEVICE_HANDLER( williams_port_select_w ) | |
| 569 | 631 | { |
| 570 | 632 | port_select = data; |
| 571 | 633 | } |
| r4135 | r4136 | |
| 605 | 667 | * 1000 = right/down full |
| 606 | 668 | */ |
| 607 | 669 | |
| 608 | READ8_HANDLER( williams_49way_port_0_r ) | |
| 670 | READ8_DEVICE_HANDLER( williams_49way_port_0_r ) | |
| 609 | 671 | { |
| 610 | 672 | static const UINT8 translate49[7] = { 0x0, 0x4, 0x6, 0x7, 0xb, 0x9, 0x8 }; |
| 611 | return (translate49[input_port_read( | |
| 673 | return (translate49[input_port_read(device->machine, "49WAYX") >> 4] << 4) | translate49[input_port_read(device->machine, "49WAYY") >> 4]; | |
| 612 | 674 | } |
| 613 | 675 | |
| 614 | 676 | |
| 615 | READ8_HANDLER( williams_input_port_49way_0_5_r ) | |
| 677 | READ8_DEVICE_HANDLER( williams_input_port_49way_0_5_r ) | |
| 616 | 678 | { |
| 617 | 679 | if (port_select) |
| 618 | return williams_49way_port_0_r( | |
| 680 | return williams_49way_port_0_r(device, 0); | |
| 619 | 681 | else |
| 620 | return input_port_read( | |
| 682 | return input_port_read(device->machine, "IN3"); | |
| 621 | 683 | } |
| 622 | 684 | |
| 623 | 685 | |
| r4135 | r4136 | |
| 866 | 928 | * |
| 867 | 929 | *************************************/ |
| 868 | 930 | |
| 869 | static READ8_HANDLER( lottofun_input_port_0_r ) | |
| 931 | static READ8_DEVICE_HANDLER( lottofun_input_port_0_r ) | |
| 870 | 932 | { |
| 933 | const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 934 | ||
| 871 | 935 | /* merge in the ticket dispenser status */ |
| 872 | return input_port_read( | |
| 936 | return input_port_read(device->machine, "IN0") | ticket_dispenser_r(space,offset); | |
| 873 | 937 | } |
| 874 | 938 | |
| 875 | 939 | |
| r4135 | r4136 | |
| 880 | 944 | * |
| 881 | 945 | *************************************/ |
| 882 | 946 | |
| 883 | static READ8_HANDLER( tshoot_input_port_0_3_r ) | |
| 947 | static READ8_DEVICE_HANDLER( tshoot_input_port_0_3_r ) | |
| 884 | 948 | { |
| 885 | 949 | /* merge in the gun inputs with the standard data */ |
| 886 | int data = input_port_read( | |
| 950 | int data = input_port_read(device->machine, "IN0"); | |
| 887 | 951 | int gun = (data & 0x3f) ^ ((data & 0x3f) >> 1); |
| 888 | 952 | return (data & 0xc0) | gun; |
| 889 | 953 | |
| 954 | // FIXME: this code is never reached | |
| 890 | 955 | return 0; |
| 891 | 956 | } |
| 892 | 957 | |
| 893 | 958 | |
| 894 | static WRITE8_HANDLER( tshoot_maxvol_w ) | |
| 959 | static WRITE8_DEVICE_HANDLER( tshoot_maxvol_w ) | |
| 895 | 960 | { |
| 896 | 961 | /* something to do with the sound volume */ |
| 897 | logerror("tshoot maxvol = %d ( | |
| 962 | logerror("tshoot maxvol = %d ( | |
| 898 | 963 | } |
| 899 | 964 | |
| 900 | 965 | |
| 901 | static WRITE8_HANDLER( tshoot_lamp_w ) | |
| 966 | static WRITE8_DEVICE_HANDLER( tshoot_lamp_w ) | |
| 902 | 967 | { |
| 903 | 968 | /* set the grenade lamp */ |
| 904 | 969 | set_led_status(0,data & 0x04); |
| r4135 | r4136 | |
| 939 | 1004 | |
| 940 | 1005 | MACHINE_RESET( joust2 ) |
| 941 | 1006 | { |
| 1007 | const device_config *pia_3 = devtag_get_device(machine, PIA6821, "pia_3"); | |
| 1008 | ||
| 942 | 1009 | /* standard init */ |
| 943 | 1010 | MACHINE_RESET_CALL(williams2); |
| 944 | pia_ | |
| 1011 | pia_ | |
| 945 | 1012 | state_save_register_global(machine, joust2_current_sound_data); |
| 946 | 1013 | } |
| 947 | 1014 | |
| 948 | 1015 | |
| 949 | 1016 | static TIMER_CALLBACK( joust2_deferred_snd_cmd_w ) |
| 950 | 1017 | { |
| 951 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 952 | pia_2_porta_w(space, 0, param & 0xff); | |
| 1018 | const device_config *pia_2 = devtag_get_device(machine, PIA6821, "pia_2"); | |
| 1019 | pia_porta_w(pia_2, 0, param & 0xff); | |
| 953 | 1020 | } |
| 954 | 1021 | |
| 955 | 1022 | |
| 956 | static WRITE8_HANDLER( joust2_pia_3_cb1_w ) | |
| 1023 | static WRITE8_DEVICE_HANDLER( joust2_pia_3_cb1_w ) | |
| 957 | 1024 | { |
| 1025 | const device_config *pia_3 = devtag_get_device(device->machine, PIA6821, "pia_3"); | |
| 1026 | ||
| 958 | 1027 | joust2_current_sound_data = (joust2_current_sound_data & ~0x100) | ((data << 8) & 0x100); |
| 959 | pia_ | |
| 1028 | pia_ | |
| 960 | 1029 | } |
| 961 | 1030 | |
| 962 | 1031 | |
| 963 | static WRITE8_HANDLER( joust2_snd_cmd_w ) | |
| 1032 | static WRITE8_DEVICE_HANDLER( joust2_snd_cmd_w ) | |
| 964 | 1033 | { |
| 965 | 1034 | joust2_current_sound_data = (joust2_current_sound_data & ~0xff) | (data & 0xff); |
| 966 | williams_cvsd_data_w(space->machine, joust2_current_sound_data); | |
| 967 | timer_call_after_resynch(space->machine, NULL, joust2_current_sound_data, joust2_deferred_snd_cmd_w); | |
| 1035 | williams_cvsd_data_w(device->machine, joust2_current_sound_data); | |
| 1036 | timer_call_after_resynch(device->machine, NULL, joust2_current_sound_data, joust2_deferred_snd_cmd_w); | |
| 968 | 1037 | } |
| r4135 | r4136 | |
|---|---|---|
| 432 | 432 | case NB1413M3_PAIRSNB: |
| 433 | 433 | case NB1413M3_PAIRSTEN: |
| 434 | 434 | return input_port_read(space->machine, "P1"); |
| 435 | break; | |
| 436 | 435 | default: |
| 437 | 436 | switch ((nb1413m3_inputport ^ 0xff) & 0x1f) |
| 438 | 437 | { |
| r4135 | r4136 | |
| 482 | 481 | case NB1413M3_PAIRSNB: |
| 483 | 482 | case NB1413M3_PAIRSTEN: |
| 484 | 483 | return input_port_read(space->machine, "P2"); |
| 485 | break; | |
| 486 | 484 | default: |
| 487 | 485 | switch ((nb1413m3_inputport ^ 0xff) & 0x1f) |
| 488 | 486 | { |
| r4135 | r4136 | |
| 516 | 514 | case NB1413M3_FINALBNY: |
| 517 | 515 | case NB1413M3_MMSIKAKU: |
| 518 | 516 | return ((nb1413m3_outcoin_flag & 0x01) << 1); |
| 519 | break; | |
| 520 | 517 | default: |
| 521 | 518 | return 0xff; |
| 522 | break; | |
| 523 | 519 | } |
| 524 | 520 | } |
| 525 | 521 | |
| r4135 | r4136 | |
| 530 | 526 | case NB1413M3_KANATUEN: |
| 531 | 527 | case NB1413M3_KYUHITO: |
| 532 | 528 | return input_port_read(space->machine, "DSWB"); |
| 533 | break; | |
| 534 | 529 | case NB1413M3_TAIWANMB: |
| 535 | 530 | return ((input_port_read(space->machine, "DSWA") & 0xf0) | ((input_port_read(space->machine, "DSWB") & 0xf0) >> 4)); |
| 536 | break; | |
| 537 | 531 | case NB1413M3_OTONANO: |
| 538 | 532 | case NB1413M3_MJCAMERA: |
| 539 | 533 | case NB1413M3_IDHIMITU: |
| 540 | 534 | case NB1413M3_KAGUYA2: |
| 541 | 535 | return (((input_port_read(space->machine, "DSWA") & 0x0f) << 4) | (input_port_read(space->machine, "DSWB") & 0x0f)); |
| 542 | break; | |
| 543 | 536 | case NB1413M3_SCANDAL: |
| 544 | 537 | case NB1413M3_SCANDALM: |
| 545 | 538 | case NB1413M3_MJFOCUSM: |
| r4135 | r4136 | |
| 551 | 544 | case NB1413M3_TOKIMBSJ: |
| 552 | 545 | case NB1413M3_TOKYOGAL: |
| 553 | 546 | return ((input_port_read(space->machine, "DSWA") & 0x0f) | ((input_port_read(space->machine, "DSWB") & 0x0f) << 4)); |
| 554 | break; | |
| 555 | 547 | case NB1413M3_TRIPLEW1: |
| 556 | 548 | case NB1413M3_NTOPSTAR: |
| 557 | 549 | case NB1413M3_PSTADIUM: |
| r4135 | r4136 | |
| 565 | 557 | ((input_port_read(space->machine, "DSWB") & 0x10) >> 2) | ((input_port_read(space->machine, "DSWB") & 0x40) >> 3) | |
| 566 | 558 | ((input_port_read(space->machine, "DSWA") & 0x01) << 4) | ((input_port_read(space->machine, "DSWA") & 0x04) << 3) | |
| 567 | 559 | ((input_port_read(space->machine, "DSWA") & 0x10) << 2) | ((input_port_read(space->machine, "DSWA") & 0x40) << 1)); |
| 568 | break; | |
| 569 | 560 | default: |
| 570 | 561 | return input_port_read(space->machine, "DSWA"); |
| 571 | break; | |
| 572 | 562 | } |
| 573 | 563 | } |
| 574 | 564 | |
| r4135 | r4136 | |
| 579 | 569 | case NB1413M3_KANATUEN: |
| 580 | 570 | case NB1413M3_KYUHITO: |
| 581 | 571 | return input_port_read(space->machine, "DSWA"); |
| 582 | break; | |
| 583 | 572 | case NB1413M3_TAIWANMB: |
| 584 | 573 | return (((input_port_read(space->machine, "DSWA") & 0x0f) << 4) | (input_port_read(space->machine, "DSWB") & 0x0f)); |
| 585 | break; | |
| 586 | 574 | case NB1413M3_OTONANO: |
| 587 | 575 | case NB1413M3_MJCAMERA: |
| 588 | 576 | case NB1413M3_IDHIMITU: |
| 589 | 577 | case NB1413M3_KAGUYA2: |
| 590 | 578 | return ((input_port_read(space->machine, "DSWA") & 0xf0) | ((input_port_read(space->machine, "DSWB") & 0xf0) >> 4)); |
| 591 | break; | |
| 592 | 579 | case NB1413M3_SCANDAL: |
| 593 | 580 | case NB1413M3_SCANDALM: |
| 594 | 581 | case NB1413M3_MJFOCUSM: |
| r4135 | r4136 | |
| 600 | 587 | case NB1413M3_TOKIMBSJ: |
| 601 | 588 | case NB1413M3_TOKYOGAL: |
| 602 | 589 | return (((input_port_read(space->machine, "DSWA") & 0xf0) >> 4) | (input_port_read(space->machine, "DSWB") & 0xf0)); |
| 603 | break; | |
| 604 | 590 | case NB1413M3_TRIPLEW1: |
| 605 | 591 | case NB1413M3_NTOPSTAR: |
| 606 | 592 | case NB1413M3_PSTADIUM: |
| r4135 | r4136 | |
| 614 | 600 | ((input_port_read(space->machine, "DSWB") & 0x20) >> 3) | ((input_port_read(space->machine, "DSWB") & 0x80) >> 4) | |
| 615 | 601 | ((input_port_read(space->machine, "DSWA") & 0x02) << 3) | ((input_port_read(space->machine, "DSWA") & 0x08) << 2) | |
| 616 | 602 | ((input_port_read(space->machine, "DSWA") & 0x20) << 1) | ((input_port_read(space->machine, "DSWA") & 0x80) << 0)); |
| 617 | break; | |
| 618 | 603 | default: |
| 619 | 604 | return input_port_read(space->machine, "DSWB"); |
| 620 | break; | |
| 621 | 605 | } |
| 622 | 606 | } |
| 623 | 607 |
| r4135 | r4136 | |
|---|---|---|
| 1125 | 1125 | default: |
| 1126 | 1126 | seibu_cop_log("%06x: COPX unhandled read returning %04x from offset %04x\n", cpu_get_pc(space->cpu), retvalue, offset*2); |
| 1127 | 1127 | return retvalue; |
| 1128 | break; | |
| 1129 | 1128 | |
| 1130 | 1129 | /* BCD protection reads */ |
| 1131 | 1130 | case (0x190/2): { return ((prot_bcd[0] & 0x0000ffff) >> 0 ) + 0x3030; } |
| r4135 | r4136 | |
| 1292 | 1291 | { |
| 1293 | 1292 | default: |
| 1294 | 1293 | return generic_cop_r(space, offset, mem_mask); |
| 1295 | break; | |
| 1296 | 1294 | |
| 1297 | 1295 | /********************************************************************* |
| 1298 | 1296 | 400-5ff - Protection reads |
| r4135 | r4136 | |
| 1319 | 1317 | case (0x344/2): return input_port_read(space->machine, "PLAYERS12"); |
| 1320 | 1318 | case (0x348/2): return input_port_read(space->machine, "PLAYERS34"); |
| 1321 | 1319 | case (0x34c/2): return input_port_read(space->machine, "SYSTEM"); |
| 1322 | ||
| 1323 | 1320 | } |
| 1324 | 1321 | } |
| 1325 | 1322 | |
| r4135 | r4136 | |
| 1412 | 1409 | { |
| 1413 | 1410 | default: |
| 1414 | 1411 | return generic_cop_r(space, offset, mem_mask); |
| 1415 | break; | |
| 1416 | 1412 | |
| 1417 | 1413 | //case (0x07e/2): |
| 1418 | 1414 | //case (0x1b0/2): |
| r4135 | r4136 | |
| 1565 | 1561 | { |
| 1566 | 1562 | default: |
| 1567 | 1563 | return generic_cop_r(space, offset, mem_mask); |
| 1568 | break; | |
| 1569 | 1564 | |
| 1570 | 1565 | /* Non-protection reads */ |
| 1571 | 1566 | case (0x308/2): return seibu_main_word_r(space,2,0xffff); |
| r4135 | r4136 | |
| 1615 | 1610 | { |
| 1616 | 1611 | default: |
| 1617 | 1612 | return generic_cop_r(space, offset, mem_mask); |
| 1618 | break; | |
| 1619 | 1613 | |
| 1620 | 1614 | /* Non-protection reads */ |
| 1621 | 1615 | |
| r4135 | r4136 | |
| 1675 | 1669 | { |
| 1676 | 1670 | default: |
| 1677 | 1671 | return generic_cop_r(space, offset, mem_mask); |
| 1678 | break; | |
| 1679 | 1672 | |
| 1680 | 1673 | /*hit protection*/ |
| 1681 | 1674 | case (0x180/2): { return xy_check; } |
| 1682 | 1675 | |
| 1683 | 1676 | case (0x1b0/2): |
| 1684 | 1677 | return 2; |
| 1678 | // FIXME: this code is never reached | |
| 1685 | 1679 | /*check if the DMA has been finished*/ |
| 1686 | 1680 | if(dma_status == 1) |
| 1687 | 1681 | { |
| r4135 | r4136 | |
| 1882 | 1876 | { |
| 1883 | 1877 | default: |
| 1884 | 1878 | return generic_cop_r(space, offset, mem_mask); |
| 1885 | break; | |
| 1886 | 1879 | |
| 1887 | 1880 | /********************************************************************* |
| 1888 | 1881 | 400-5ff - Protection reads |
| r4135 | r4136 | |
| 1984 | 1977 | { |
| 1985 | 1978 | default: |
| 1986 | 1979 | return generic_cop_r(space, offset, mem_mask); |
| 1987 | break; | |
| 1988 | 1980 | |
| 1989 | 1981 | case (0x340/2): return input_port_read(space->machine, "DSWA") | (input_port_read(space->machine, "DSWB") << 8); |
| 1990 | 1982 | case (0x344/2): return input_port_read(space->machine, "P1") | (input_port_read(space->machine, "P2") << 8); |
| r4135 | r4136 | |
|---|---|---|
| 197 | 197 | memory_set_bankptr(space->machine, 1,&RAM[bankaddress]); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | MACHINE_START( ajax ) | |
| 201 | { | |
| 202 | state_save_register_global(machine, firq_enable); | |
| 203 | } | |
| 200 | 204 | |
| 201 | 205 | MACHINE_RESET( ajax ) |
| 202 | 206 | { |
| r4135 | r4136 | |
|---|---|---|
| 415 | 415 | /* Jangou Night *//* (c) 1983 */ |
| 416 | 416 | DRIVER( jngolady ) /* (c) 1984 */ |
| 417 | 417 | DRIVER( cntrygrl ) /* (c) 1984 Royal Denshi */ |
| 418 | DRIVER( luckygrl ) /* (c) 1984 Wing? */ | |
| 418 | 419 | DRIVER( nightgal ) /* (c) 1984 */ |
| 419 | 420 | DRIVER( ngtbunny ) /* (c) 1984 */ |
| 420 | 421 | DRIVER( royalngt ) /* (c) 1984 Royal Denshi */ |
| r4135 | r4136 | |
| 1857 | 1858 | DRIVER( ashura ) /* C43 (c) 1990 Taito Corporation (Japan) */ |
| 1858 | 1859 | DRIVER( ashurau ) /* C43 (c) 1990 Taito America Corporation (US) */ |
| 1859 | 1860 | DRIVER( hitice ) /* C59 (c) 1990 Williams (US) */ |
| 1861 | DRIVER( hiticej ) /* C59 (c) 1990 Midway/Taito Corporation (Japan) */ | |
| 1860 | 1862 | DRIVER( sbm ) /* C69 (c) 1990 Taito Corporation (Japan) */ |
| 1861 | 1863 | DRIVER( selfeena ) /* ??? (c) 1991 East Technology */ |
| 1862 | 1864 | DRIVER( silentd ) /* ??? (c) 1992 Taito Corporation Japan (World) */ |
| r4135 | r4136 | |
| 4964 | 4966 | DRIVER( tbyahhoo ) /* GX424 (c) 1995 (Japan) */ |
| 4965 | 4967 | DRIVER( tkmmpzdm ) /* GX515 (c) 1995 (Japan) */ |
| 4966 | 4968 | DRIVER( salmndr2 ) /* GX521 (c) 1996 (Japan) */ |
| 4969 | DRIVER( salmnd2a ) /* GX521 (c) 1996 (Asia) */ | |
| 4967 | 4970 | DRIVER( sexyparo ) /* GX533 (c) 1996 (Japan) */ |
| 4968 | 4971 | DRIVER( daiskiss ) /* GX535 (c) 1996 (Japan) */ |
| 4969 | 4972 | DRIVER( tokkae ) /* GX615 (c) 1996 (Japan) */ |
| r4135 | r4136 | |
| 7490 | 7493 | DRIVER( slqz2 ) /* (c) 1998 */ |
| 7491 | 7494 | DRIVER( sdmg2 ) /* (c) 1997 */ |
| 7492 | 7495 | |
| 7496 | DRIVER( igs_ncs ) /* (c) 2000 */ | |
| 7497 | ||
| 7493 | 7498 | DRIVER( bigd2 ) /* (c) 2000 */ |
| 7494 | 7499 | DRIVER( sdwx ) /* (c) 2002 */ |
| 7495 | 7500 | DRIVER( sddz ) /* (c) 200? */ |
| r4135 | r4136 | |
| 8212 | 8217 | DRIVER( sidewndr ) /* (c) 1981? ACE */ |
| 8213 | 8218 | DRIVER( spellbnd ) /* (c) 1981? ACE */ |
| 8214 | 8219 | DRIVER( starspnr ) /* (c) 1982? ACE */ |
| 8220 | DRIVER( acefruit ) /* (c) 1982? ACE */ | |
| 8215 | 8221 | DRIVER( attckufo ) /* (c) 1980 Ryoto Electric Co. */ |
| 8216 | 8222 | DRIVER( fortecar ) |
| 8217 | 8223 | DRIVER( jackpool ) /* (c) 1997 Electronic Projects */ |
| r4135 | r4136 | |
| 8221 | 8227 | DRIVER( quizmstr ) /* (c) 1985 Coinmaster */ |
| 8222 | 8228 | DRIVER( trailblz ) /* (c) 1987 Coinmaster */ |
| 8223 | 8229 | DRIVER( supnudg2 ) /* (c) 1989 Coinmaster */ |
| 8230 | DRIVER( pokeroul ) /* (c) 1990 Coinmaster */ | |
| 8224 | 8231 | DRIVER( fruit ) /* (c) 1987? Coinmaster? */ |
| 8225 | 8232 | DRIVER( egghunt ) /* (c) 1995 Invi Image */ |
| 8226 | 8233 | DRIVER( magic10 ) /* (c) 1995 A.W.P. Games */ |
| r4135 | r4136 | |
| 8366 | 8373 | DRIVER( destryea ) /* (c) 1981 Cidelsa */ |
| 8367 | 8374 | DRIVER( draco ) /* (c) 1981 Cidelsa */ |
| 8368 | 8375 | DRIVER( rockduck ) /* (c) 1983 Datel SAS */ |
| 8369 | DRIVER( tetriunk ) | |
| 8370 | DRIVER( smstrv ) /* (c) 1984 SMS MFG CORP */ | |
| 8376 | DRIVER( tetriskr ) /* (c) 1988? bootleg */ | |
| 8377 | DRIVER( trvhang ) /* (c) 1984 SMS MFG CORP */ | |
| 8378 | DRIVER( trvhanga ) /* (c) 1984 SMS MFG CORP */ | |
| 8379 | DRIVER( sureshot ) /* (c) 1985 SMS MFG CORP */ | |
| 8371 | 8380 | DRIVER( skylncr ) /* (c) 1995 Bordun International */ |
| 8372 | 8381 | DRIVER( butrfly ) /* (c) 1995 Bordun International */ |
| 8373 | 8382 | DRIVER( madzoo ) /* (c) 1995 Bordun International */ |
| r4135 | r4136 | |
| 8416 | 8425 | DRIVER( pexp0112 ) /* (c) 1995 IGT - International Gaming Technology */ |
| 8417 | 8426 | DRIVER( pexs0006 ) /* (c) 1997 IGT - International Gaming Technology */ |
| 8418 | 8427 | DRIVER( pexmp006 ) /* (c) 1997 IGT - International Gaming Technology */ |
| 8428 | DRIVER( pexmp017 ) /* (c) 1997 IGT - International Gaming Technology */ | |
| 8419 | 8429 | DRIVER( mirage ) /* (c) 1994 Mitchell */ |
| 8420 | 8430 | DRIVER( dominob ) /* (c) 1990 Wonwoo Systems */ |
| 8421 | 8431 | DRIVER( jongkyo ) /* (c) 1985 Kiwako */ |
| r4135 | r4136 | |
| 8426 | 8436 | DRIVER( blazlaz ) /* (c) 1989 Hudson Soft */ |
| 8427 | 8437 | DRIVER( paranoia ) /* (c) 1990 Naxat Soft */ |
| 8428 | 8438 | DRIVER( vcombat ) /* (c) 1993 VR8 Inc. */ |
| 8429 | DRIVER( shadfgtr ) /* (c) 1989 | |
| 8439 | DRIVER( shadfgtr ) /* (c) 1989 DUTECH Inc. */ | |
| 8430 | 8440 | DRIVER( blackt96 ) /* (c) 1996 D.G.R.M. of Korea */ |
| 8431 | 8441 | DRIVER( magictg ) /* (c) 199? Acclaim */ |
| 8432 | 8442 | DRIVER( magictga ) /* (c) 199? Acclaim */ |
| r4135 | r4136 | |
| 8473 | 8483 | DRIVER( brasil ) /* (c) 2000 unknown */ |
| 8474 | 8484 | DRIVER( fashion ) /* (c) 2000 unknown */ |
| 8475 | 8485 | |
| 8486 | /* V30-based italian gambling games */ | |
| 8487 | DRIVER( tour4000 ) /* (c) 2000 High Video */ | |
| 8488 | DRIVER( cfever40 ) /* (c) 2000 High Video */ | |
| 8489 | DRIVER( cfever50 ) /* (c) 2000 High Video */ | |
| 8490 | DRIVER( tour4010 ) /* (c) 2000 High Video */ | |
| 8491 | DRIVER( cfever51 ) /* (c) 2000 High Video */ | |
| 8492 | DRIVER( cfever61 ) /* (c) 2000 High Video */ | |
| 8493 | DRIVER( cfever1k ) /* (c) 2000 High Video */ | |
| 8494 | DRIVER( girotutt ) /* (c) 2000 High Video */ | |
| 8495 | ||
| 8476 | 8496 | /* M68k based italian gambling games */ |
| 8477 | 8497 | DRIVER( ilpag ) /* (c) 19?? unknown */ |
| 8478 | 8498 | DRIVER( mil4000 ) /* (c) 2000 Sure Milano */ |
| r4135 | r4136 | |
| 8487 | 8507 | DRIVER( showhanc ) /* (c) 1999? Astro Corp. */ |
| 8488 | 8508 | |
| 8489 | 8509 | /* Dyna */ |
| 8490 | DRIVER( cb2001 ) /* (c) Dyna */ | |
| 8491 | DRIVER( ncb3 ) /* (c) 199? Dyna/bootleg? */ | |
| 8492 | DRIVER( cb3a ) /* (c) 199? Dyna/bootleg? */ | |
| 8493 | DRIVER( cb3 ) /* (c) 199? Dyna/bootleg? */ | |
| 8510 | DRIVER( cb2001 ) /* (c) 2001 Dyna Electronics */ | |
| 8511 | DRIVER( ncb3 ) /* (c) 199? Dyna Electronics */ | |
| 8512 | DRIVER( cb3a ) /* (c) 199? Dyna Electronics */ | |
| 8513 | DRIVER( cb3 ) /* (c) 199? Dyna Electronics */ | |
| 8494 | 8514 | DRIVER( cmv801 ) /* (c) 198? Corsica */ |
| 8495 | DRIVER( cmv4 ) /* (c) 1992 Dyna */ | |
| 8496 | DRIVER( cmaster ) /* (c) 1991 Dyna */ | |
| 8497 | DRIVER( cm2v841 ) /* (c) 198? Dyna Electronics */ | |
| 8498 | DRIVER( cm2841a ) /* (c) 198? Dyna Electronics */ | |
| 8499 | DRIVER( cmast91 ) /* (c) 1991 Dyna */ | |
| 8515 | DRIVER( cmv4 ) /* (c) 1992 Dyna Electronics */ | |
| 8516 | DRIVER( cmv4a ) /* (c) 1992 Dyna Electronics */ | |
| 8517 | DRIVER( cmaster ) /* (c) 1991 Dyna Electronics */ | |
| 8518 | DRIVER( cmasterb ) /* (c) 1991 Dyna Electronics */ | |
| 8519 | DRIVER( cmasterc ) /* (c) 1991 Dyna Electronics */ | |
| 8520 | DRIVER( cmast91 ) /* (c) 1991 Dyna Electronics */ | |
| 8500 | 8521 | |
| 8501 | 8522 | /* STG? */ |
| 8502 | 8523 | DRIVER ( queen ) |
| 8503 | 8524 | |
| 8504 | 8525 | /* Aristocrat */ |
| 8505 | DRIVER ( caswin ) | |
| 8526 | DRIVER ( 86lions ) /* (c) 1985? */ | |
| 8527 | DRIVER ( caswin ) /* (c) 1985 */ | |
| 8506 | 8528 | |
| 8507 | 8529 | /* Eagle */ |
| 8508 | 8530 | DRIVER ( janshi ) |
| r4135 | r4136 | |
| 8515 | 8537 | DRIVER( lucky8a ) /* (c) 1989 Wing Co. Ltd */ |
| 8516 | 8538 | DRIVER( luckgrln ) /* (c) 1991 Wing Co. Ltd */ |
| 8517 | 8539 | |
| 8540 | DRIVER( schery98 ) /* (c) 1998 Amcoe */ | |
| 8541 | DRIVER( schery97 ) /* (c) 1998 Amcoe */ | |
| 8542 | DRIVER( sfbonus ) /* (c) 199? Amcoe */ | |
| 8543 | DRIVER( ladylinr ) /* (c) 198? TAB Austria */ | |
| 8544 | DRIVER( kkojnoli ) /* 198? south korean hack */ | |
| 8545 | DRIVER( mtonic ) /* 198? (c) Tonic */ | |
| 8546 | ||
| 8547 | DRIVER( 3super8 ) /* unknown */ | |
| 8548 | DRIVER( buster ) /* (c) 1987 Marian Electronics Ltd. */ | |
| 8549 | DRIVER( spielbud ) /* (c) 1985 ADP */ | |
| 8550 | ||
| 8518 | 8551 | #endif /* DRIVER_RECURSIVE */ |
| r4135 | r4136 | |
|---|---|---|
| 81 | 81 | extern UINT32* stv_vdp2_vram; |
| 82 | 82 | extern UINT32* stv_vdp2_cram; |
| 83 | 83 | |
| 84 | UINT8 stv_get_vblank(running_machine *machine); | |
| 85 | ||
| 84 | 86 | WRITE32_HANDLER ( stv_vdp2_vram_w ); |
| 85 | 87 | READ32_HANDLER ( stv_vdp2_vram_r ); |
| 86 | 88 |
| r4135 | r4136 | |
|---|---|---|
| 40 | 40 | void deco16_pdrawgfx(running_machine *machine, |
| 41 | 41 | bitmap_t *dest,const gfx_element *gfx, |
| 42 | 42 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 43 | const rectangle *clip,int transparen | |
| 43 | const rectangle *clip,int transparen | |
| 44 | 44 | |
| 45 | 45 | tilemap *deco16_get_tilemap(int pf, int size); |
| 46 | 46 |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /*----------- defined in video/suprnova.c -----------*/ |
| 11 | 11 | |
| 12 | extern int suprnova_alt_enable_sprites; | |
| 13 | ||
| 12 | 14 | void skns_sprite_kludge(int x, int y); |
| 13 | 15 | void skns_draw_sprites( |
| 14 | running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, | |
| 15 | UINT32* spriteram_source, size_t spriteram_size, | |
| 16 | UINT8* gfx_source, size_t gfx_length, | |
| 17 | UINT32* sprite_regs ); | |
| 16 | running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, | |
| 17 | UINT32* spriteram_source, size_t spriteram_size, | |
| 18 | UINT8* gfx_source, size_t gfx_length, | |
| 19 | UINT32* sprite_regs ); | |
| 18 | 20 | |
| 19 | 21 | WRITE32_HANDLER ( skns_tilemapA_w ); |
| 20 | 22 | WRITE32_HANDLER ( skns_tilemapB_w ); |
| r4135 | r4136 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | /*----------- defined in audio/8080bw.c -----------*/ |
| 23 | 23 | |
| 24 | MACHINE_START( extra_8080bw_sh ); | |
| 25 | ||
| 24 | 26 | WRITE8_HANDLER( invadpt2_sh_port_1_w ); |
| 25 | 27 | WRITE8_HANDLER( invadpt2_sh_port_2_w ); |
| 26 | 28 | |
| r4135 | r4136 | |
| 68 | 70 | WRITE8_HANDLER( shuttlei_sh_port_1_w ); |
| 69 | 71 | WRITE8_HANDLER( shuttlei_sh_port_2_w ); |
| 70 | 72 | |
| 71 | ||
| 72 | 73 | /*----------- defined in video/8080bw.c -----------*/ |
| 73 | 74 | |
| 74 | 75 | extern UINT8 *c8080bw_colorram; |
| 75 | 76 | |
| 77 | MACHINE_START( extra_8080bw_vh ); | |
| 78 | ||
| 76 | 79 | void c8080bw_flip_screen_w(const address_space *space, int data); |
| 77 | 80 | void c8080bw_screen_red_w(int data); |
| 78 | 81 | void schaser_background_control_w(int data); |
| r4135 | r4136 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | MACHINE_RESET( balsente ); |
| 31 | 31 | |
| 32 | void balsente_noise_gen( | |
| 32 | void balsente_noise_gen(const device_config *device, int count, short *buffer); | |
| 33 | 33 | |
| 34 | 34 | WRITE8_HANDLER( balsente_random_reset_w ); |
| 35 | 35 | READ8_HANDLER( balsente_random_num_r ); |
| r4135 | r4136 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | /* TODO */ |
| 8 | 8 | #define ESRIPSYS_PIXEL_CLOCK (XTAL_25MHz / 2) |
| 9 | #define ESRIPSYS_HTOTAL (512 + 141) | |
| 9 | #define ESRIPSYS_HTOTAL (512 + 141 + 2) | |
| 10 | 10 | #define ESRIPSYS_HBLANK_START (512) |
| 11 | 11 | #define ESRIPSYS_HBLANK_END (0) |
| 12 | 12 | #define ESRIPSYS_VTOTAL (384 + 20) |
| r4135 | r4136 | |
| 26 | 26 | |
| 27 | 27 | /*----------- defined in video/esripsys.c -----------*/ |
| 28 | 28 | |
| 29 | extern int esripsys_hblank; | |
| 29 | 30 | extern UINT8 *esripsys_pal_ram; |
| 30 | 31 | extern int esripsys_frame_vbl; |
| 31 | 32 | extern int esripsys__12sel; |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | extern UINT8 *polyplay_characterram; |
| 15 | 15 | |
| 16 | 16 | PALETTE_INIT( polyplay ); |
| 17 | VIDEO_START( polyplay ); | |
| 17 | 18 | VIDEO_UPDATE( polyplay ); |
| 18 | 19 | WRITE8_HANDLER( polyplay_characterram_w ); |
| r4135 | r4136 | |
|---|---|---|
| 26 | 26 | |
| 27 | 27 | MACHINE_DRIVER_EXTERN( madalien_video ); |
| 28 | 28 | |
| 29 | WRITE8_HANDLER( madalien_videoram_w ); | |
| 30 | WRITE8_HANDLER( madalien_charram_w ); | |
| 29 | 31 | |
| 32 | ||
| 30 | 33 | /*----------- defined in audio/madalien.c -----------*/ |
| 31 | 34 | |
| 32 | 35 | DISCRETE_SOUND_EXTERN( madalien ); |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | void system24temp_sys16_io_set_callbacks(UINT8 (*io_r)(running_machine *machine, int port), |
| 15 | 15 | void (*io_w)(running_machine *machine, int port, UINT8 data), |
| 16 | 16 | void (*cnt_w)(const address_space *space, UINT8 data), |
| 17 | READ16_HANDLER ((*iod_r)), | |
| 18 | WRITE16_HANDLER((*iod_w))); | |
| 17 | read16_space_func iod_r, | |
| 18 | write16_space_func iod_w); | |
| 19 | 19 | READ16_HANDLER ( system24temp_sys16_io_r ); |
| 20 | 20 | WRITE16_HANDLER( system24temp_sys16_io_w ); |
| 21 | 21 | READ32_HANDLER ( system24temp_sys16_io_dword_r ); |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | /*----------- defined in video/tiamc1.c -----------*/ |
| 12 | 12 | |
| 13 | extern UINT8 *tiamc1_charram; | |
| 14 | extern UINT8 *tiamc1_tileram; | |
| 15 | extern UINT8 *tiamc1_spriteram_x; | |
| 16 | extern UINT8 *tiamc1_spriteram_y; | |
| 17 | extern UINT8 *tiamc1_spriteram_n; | |
| 18 | extern UINT8 *tiamc1_spriteram_a; | |
| 19 | ||
| 20 | 13 | PALETTE_INIT( tiamc1 ); |
| 21 | 14 | VIDEO_START( tiamc1 ); |
| 22 | 15 | VIDEO_UPDATE( tiamc1 ); |
| r4135 | r4136 | |
|---|---|---|
| 7 | 7 | WRITE16_HANDLER( blswhstl_700300_w ); |
| 8 | 8 | READ16_HANDLER( glfgreat_rom_r ); |
| 9 | 9 | WRITE16_HANDLER( glfgreat_122000_w ); |
| 10 | WRITE16_HANDLER( ssriders_eeprom_w ); | |
| 10 | 11 | WRITE16_HANDLER( ssriders_1c0300_w ); |
| 11 | 12 | WRITE16_HANDLER( prmrsocr_122000_w ); |
| 12 | 13 | WRITE16_HANDLER( tmnt_priority_w ); |
| r4135 | r4136 | |
|---|---|---|
| 553 | 553 | /* All other writes should store the value in the addressed register as |
| 554 | 554 | expected. */ |
| 555 | 555 | |
| 556 | /*========== PROCEDURES ==========*/ | |
| 557 | ||
| 558 | void DSP_Reset /* Reset emulated DSP */ | |
| 559 | ( void ); | |
| 560 | ||
| 561 | void DSP_Update /* Mix one sample of audio */ | |
| 562 | ( | |
| 563 | short * sound_ptr /* Pointer to mix audio into */ | |
| 564 | ); | |
| 565 | ||
| 566 | 556 | /*----------- defined in video/snes.c -----------*/ |
| 567 | 557 | |
| 568 | 558 | extern struct SNES_PPU_STRUCT snes_ppu; |
| r4135 | r4136 | |
|---|---|---|
| 8 | 8 | This file contains definitions used across multiple megasys1 |
| 9 | 9 | and non megasys1 Jaleco games: |
| 10 | 10 | |
| 11 | * Input ports | |
| 12 | 11 | * Scrolling layers handling |
| 13 | 12 | * Code decryption handling |
| 14 | 13 | |
| r4135 | r4136 | |
| 17 | 16 | |
| 18 | 17 | /*************************************************************************** |
| 19 | 18 | |
| 20 | Input Ports | |
| 21 | ||
| 22 | ***************************************************************************/ | |
| 23 | ||
| 24 | ||
| 25 | #define COINS \ | |
| 26 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )\ | |
| 27 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )\ | |
| 28 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )\ | |
| 29 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )\ | |
| 30 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )\ | |
| 31 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )\ | |
| 32 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN1 )\ | |
| 33 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN2 )\ | |
| 34 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 35 | ||
| 36 | #define JOY_4BUTTONS(_flag_) \ | |
| 37 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 38 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 39 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 40 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 41 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(_flag_)\ | |
| 42 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(_flag_)\ | |
| 43 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(_flag_)\ | |
| 44 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_PLAYER(_flag_) | |
| 45 | ||
| 46 | #define JOY_3BUTTONS(_flag_) \ | |
| 47 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 48 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 49 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 50 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 51 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(_flag_)\ | |
| 52 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(_flag_)\ | |
| 53 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(_flag_)\ | |
| 54 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN) | |
| 55 | ||
| 56 | #define JOY_2BUTTONS(_flag_) \ | |
| 57 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 58 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 59 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 60 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(_flag_)\ | |
| 61 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(_flag_)\ | |
| 62 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(_flag_)\ | |
| 63 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN) \ | |
| 64 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN) | |
| 65 | ||
| 66 | #define RESERVE \ | |
| 67 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Reserve 1P */\ | |
| 68 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )\ | |
| 69 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )\ | |
| 70 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )\ | |
| 71 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Reserve 2P */\ | |
| 72 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )\ | |
| 73 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )\ | |
| 74 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 75 | ||
| 76 | /* Coinage DSWs */ | |
| 77 | // 1] 01-41 02-31 03-21 07-11 06-12 05-13 04-14 00-FC * 2 | |
| 78 | // 2] 04-31 02-21 07-11 03-12 05-13 01-14 06-15 00-FC | |
| 79 | // 00-41 20-31 10-21 38-11 18-12 28-13 08-14 30-15 | |
| 80 | ||
| 81 | ||
| 82 | #define COINAGE_6BITS \ | |
| 83 | PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) )\ | |
| 84 | PORT_DIPSETTING( 0x0400, DEF_STR( 3C_1C ) )\ | |
| 85 | PORT_DIPSETTING( 0x0200, DEF_STR( 2C_1C ) )\ | |
| 86 | PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) )\ | |
| 87 | PORT_DIPSETTING( 0x0300, DEF_STR( 1C_2C ) )\ | |
| 88 | PORT_DIPSETTING( 0x0500, DEF_STR( 1C_3C ) )\ | |
| 89 | PORT_DIPSETTING( 0x0100, DEF_STR( 1C_4C ) )\ | |
| 90 | PORT_DIPSETTING( 0x0600, DEF_STR( 1C_5C ) )\ | |
| 91 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )\ | |
| 92 | PORT_DIPNAME( 0x3800, 0x3800, DEF_STR( Coin_B ) )\ | |
| 93 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) )\ | |
| 94 | PORT_DIPSETTING( 0x2000, DEF_STR( 3C_1C ) )\ | |
| 95 | PORT_DIPSETTING( 0x1000, DEF_STR( 2C_1C ) )\ | |
| 96 | PORT_DIPSETTING( 0x3800, DEF_STR( 1C_1C ) )\ | |
| 97 | PORT_DIPSETTING( 0x1800, DEF_STR( 1C_2C ) )\ | |
| 98 | PORT_DIPSETTING( 0x2800, DEF_STR( 1C_3C ) )\ | |
| 99 | PORT_DIPSETTING( 0x0800, DEF_STR( 1C_4C ) )\ | |
| 100 | PORT_DIPSETTING( 0x3000, DEF_STR( 1C_5C ) )\ | |
| 101 | ||
| 102 | #define COINAGE_6BITS_2 \ | |
| 103 | PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) )\ | |
| 104 | PORT_DIPSETTING( 0x0100, DEF_STR( 4C_1C ) )\ | |
| 105 | PORT_DIPSETTING( 0x0200, DEF_STR( 3C_1C ) )\ | |
| 106 | PORT_DIPSETTING( 0x0300, DEF_STR( 2C_1C ) )\ | |
| 107 | PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) )\ | |
| 108 | PORT_DIPSETTING( 0x0600, DEF_STR( 1C_2C ) )\ | |
| 109 | PORT_DIPSETTING( 0x0500, DEF_STR( 1C_3C ) )\ | |
| 110 | PORT_DIPSETTING( 0x0400, DEF_STR( 1C_4C ) )\ | |
| 111 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )\ | |
| 112 | PORT_DIPNAME( 0x3800, 0x3800, DEF_STR( Coin_B ) )\ | |
| 113 | PORT_DIPSETTING( 0x0800, DEF_STR( 4C_1C ) )\ | |
| 114 | PORT_DIPSETTING( 0x1000, DEF_STR( 3C_1C ) )\ | |
| 115 | PORT_DIPSETTING( 0x1800, DEF_STR( 2C_1C ) )\ | |
| 116 | PORT_DIPSETTING( 0x3800, DEF_STR( 1C_1C ) )\ | |
| 117 | PORT_DIPSETTING( 0x3000, DEF_STR( 1C_2C ) )\ | |
| 118 | PORT_DIPSETTING( 0x2800, DEF_STR( 1C_3C ) )\ | |
| 119 | PORT_DIPSETTING( 0x2000, DEF_STR( 1C_4C ) )\ | |
| 120 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )\ | |
| 121 | ||
| 122 | #define COINAGE_8BITS \ | |
| 123 | PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) )\ | |
| 124 | PORT_DIPSETTING( 0x0007, DEF_STR( 4C_1C ) )\ | |
| 125 | PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) )\ | |
| 126 | PORT_DIPSETTING( 0x0009, DEF_STR( 2C_1C ) )\ | |
| 127 | PORT_DIPSETTING( 0x000f, DEF_STR( 1C_1C ) )\ | |
| 128 | /* PORT_DIPSETTING( 0x0005, DEF_STR( 1C_1C ) )*/\ | |
| 129 | /* PORT_DIPSETTING( 0x0004, DEF_STR( 1C_1C ) )*/\ | |
| 130 | /* PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) )*/\ | |
| 131 | /* PORT_DIPSETTING( 0x0002, DEF_STR( 1C_1C ) )*/\ | |
| 132 | /* PORT_DIPSETTING( 0x0001, DEF_STR( 1C_1C ) )*/\ | |
| 133 | PORT_DIPSETTING( 0x0006, DEF_STR( 2C_3C ) )\ | |
| 134 | PORT_DIPSETTING( 0x000e, DEF_STR( 1C_2C ) )\ | |
| 135 | PORT_DIPSETTING( 0x000d, DEF_STR( 1C_3C ) )\ | |
| 136 | PORT_DIPSETTING( 0x000c, DEF_STR( 1C_4C ) )\ | |
| 137 | PORT_DIPSETTING( 0x000b, DEF_STR( 1C_5C ) )\ | |
| 138 | PORT_DIPSETTING( 0x000a, DEF_STR( 1C_6C ) )\ | |
| 139 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )\ | |
| 140 | PORT_DIPNAME( 0x00f0, 0x00f0, DEF_STR( Coin_B ) )\ | |
| 141 | PORT_DIPSETTING( 0x0070, DEF_STR( 4C_1C ) )\ | |
| 142 | PORT_DIPSETTING( 0x0080, DEF_STR( 3C_1C ) )\ | |
| 143 | PORT_DIPSETTING( 0x0090, DEF_STR( 2C_1C ) )\ | |
| 144 | PORT_DIPSETTING( 0x00f0, DEF_STR( 1C_1C ) )\ | |
| 145 | /* PORT_DIPSETTING( 0x0050, DEF_STR( 1C_1C ) )*/\ | |
| 146 | /* PORT_DIPSETTING( 0x0040, DEF_STR( 1C_1C ) )*/\ | |
| 147 | /* PORT_DIPSETTING( 0x0030, DEF_STR( 1C_1C ) )*/\ | |
| 148 | /* PORT_DIPSETTING( 0x0020, DEF_STR( 1C_1C ) )*/\ | |
| 149 | /* PORT_DIPSETTING( 0x0010, DEF_STR( 1C_1C ) )*/\ | |
| 150 | PORT_DIPSETTING( 0x0060, DEF_STR( 2C_3C ) )\ | |
| 151 | PORT_DIPSETTING( 0x00e0, DEF_STR( 1C_2C ) )\ | |
| 152 | PORT_DIPSETTING( 0x00d0, DEF_STR( 1C_3C ) )\ | |
| 153 | PORT_DIPSETTING( 0x00c0, DEF_STR( 1C_4C ) )\ | |
| 154 | PORT_DIPSETTING( 0x00b0, DEF_STR( 1C_5C ) )\ | |
| 155 | PORT_DIPSETTING( 0x00a0, DEF_STR( 1C_6C ) )\ | |
| 156 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 157 | ||
| 158 | ||
| 159 | /*************************************************************************** | |
| 160 | ||
| 161 | 19 | Scrolling Layers Handling |
| 162 | 20 | |
| 163 | 21 | ***************************************************************************/ |
| r4135 | r4136 | |
|---|---|---|
| 5 | 5 | **************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | |
| 8 | #include "machine/6821 | |
| 8 | #include "machine/6821new.h" | |
| 9 | 9 | |
| 10 | 10 | /*----------- defined in drivers/williams.c -----------*/ |
| 11 | 11 | |
| r4135 | r4136 | |
| 40 | 40 | extern const pia6821_interface tshoot_pia_1_intf; |
| 41 | 41 | extern const pia6821_interface tshoot_snd_pia_intf; |
| 42 | 42 | extern const pia6821_interface joust2_pia_1_intf; |
| 43 | extern const pia6821_interface joust2_pia_3_intf; | |
| 43 | 44 | |
| 44 | 45 | /* initialization */ |
| 45 | 46 | MACHINE_RESET( defender ); |
| r4135 | r4136 | |
|---|---|---|
| 1 | 1 | /*----------- defined in machine/wrally.c -----------*/ |
| 2 | 2 | |
| 3 | DRIVER_INIT( wrally ); | |
| 4 | MACHINE_RESET( wrally ); | |
| 5 | ||
| 6 | 3 | WRITE16_HANDLER( wrally_vram_w ); |
| 7 | 4 | WRITE16_HANDLER( wrally_flipscreen_w ); |
| 8 | 5 | WRITE16_HANDLER( OKIM6295_bankswitch_w ); |
| r4135 | r4136 | |
|---|---|---|
| 3 | 3 | WRITE8_HANDLER( ajax_bankswitch_2_w ); |
| 4 | 4 | READ8_HANDLER( ajax_ls138_f10_r ); |
| 5 | 5 | WRITE8_HANDLER( ajax_ls138_f10_w ); |
| 6 | MACHINE_START( ajax ); | |
| 6 | 7 | MACHINE_RESET( ajax ); |
| 7 | 8 | INTERRUPT_GEN( ajax_interrupt ); |
| 8 | 9 |
| r4135 | r4136 | |
|---|---|---|
| 178 | 178 | CPUS += ALPHA8201 |
| 179 | 179 | CPUS += ALPHA8301 |
| 180 | 180 | CPUS += CDP1802 |
| 181 | CPUS += COP401 | |
| 182 | CPUS += COP410 | |
| 183 | CPUS += COP411 | |
| 184 | CPUS += COP402 | |
| 185 | CPUS += COP420 | |
| 186 | CPUS += COP421 | |
| 187 | CPUS += COP422 | |
| 188 | CPUS += COP404 | |
| 189 | CPUS += COP424 | |
| 190 | CPUS += COP425 | |
| 191 | CPUS += COP426 | |
| 192 | CPUS += COP444 | |
| 193 | CPUS += COP445 | |
| 181 | CPUS += COP400 | |
| 194 | 182 | CPUS += TLCS90 |
| 195 | 183 | CPUS += MB8841 |
| 196 | 184 | CPUS += MB8842 |
| r4135 | r4136 | |
| 274 | 262 | SOUNDS += MSM5232 |
| 275 | 263 | SOUNDS += OKIM6258 |
| 276 | 264 | SOUNDS += OKIM6295 |
| 265 | SOUNDS += OKIM6376 | |
| 277 | 266 | SOUNDS += UPD7759 |
| 278 | 267 | SOUNDS += HC55516 |
| 279 | 268 | SOUNDS += K005289 |
| r4135 | r4136 | |
| 314 | 303 | #SOUNDS += SID6581 |
| 315 | 304 | #SOUNDS += SID8580 |
| 316 | 305 | SOUNDS += SP0256 |
| 306 | SOUNDS += DIGITALKER | |
| 317 | 307 | |
| 318 | 308 | |
| 319 | 309 | #------------------------------------------------- |
| r4135 | r4136 | |
| 328 | 318 | $(MAMEOBJ)/alliedl.a \ |
| 329 | 319 | $(MAMEOBJ)/alpha.a \ |
| 330 | 320 | $(MAMEOBJ)/amiga.a \ |
| 321 | $(MAMEOBJ)/aristocr.a \ | |
| 331 | 322 | $(MAMEOBJ)/atari.a \ |
| 332 | 323 | $(MAMEOBJ)/atlus.a \ |
| 333 | 324 | $(MAMEOBJ)/barcrest.a \ |
| r4135 | r4136 | |
| 461 | 452 | $(DRIVERS)/mquake.o \ |
| 462 | 453 | $(DRIVERS)/upscope.o \ |
| 463 | 454 | |
| 455 | $(MAMEOBJ)/aristocr.a: \ | |
| 456 | $(DRIVERS)/86lions.o \ | |
| 457 | $(DRIVERS)/caswin.o \ | |
| 458 | ||
| 464 | 459 | $(MAMEOBJ)/atari.a: \ |
| 465 | 460 | $(DRIVERS)/atarigx2.o $(VIDEO)/atarigx2.o \ |
| 466 | 461 | $(DRIVERS)/arcadecl.o $(VIDEO)/arcadecl.o \ |
| r4135 | r4136 | |
| 764 | 759 | $(DRIVERS)/igs017.o \ |
| 765 | 760 | $(DRIVERS)/igs_m027.o \ |
| 766 | 761 | $(DRIVERS)/igs_m68.o \ |
| 762 | $(DRIVERS)/igs_ncs.o \ | |
| 767 | 763 | $(DRIVERS)/iqblock.o $(VIDEO)/iqblock.o \ |
| 768 | 764 | $(DRIVERS)/lordgun.o $(VIDEO)/lordgun.o \ |
| 769 | 765 | $(DRIVERS)/pgm.o $(VIDEO)/pgm.o \ |
| r4135 | r4136 | |
| 1522 | 1518 | $(DRIVERS)/39in1.o \ |
| 1523 | 1519 | $(DRIVERS)/1945kiii.o \ |
| 1524 | 1520 | $(DRIVERS)/2mindril.o \ |
| 1521 | $(DRIVERS)/3super8.o \ | |
| 1525 | 1522 | $(DRIVERS)/4enraya.o $(VIDEO)/4enraya.o \ |
| 1526 | 1523 | $(DRIVERS)/4roses.o \ |
| 1527 | 1524 | $(DRIVERS)/acefruit.o \ |
| r4135 | r4136 | |
| 1536 | 1533 | $(DRIVERS)/beaminv.o \ |
| 1537 | 1534 | $(DRIVERS)/blackt96.o \ |
| 1538 | 1535 | $(DRIVERS)/brasil.o \ |
| 1536 | $(DRIVERS)/buster.o \ | |
| 1539 | 1537 | $(DRIVERS)/calomega.o $(VIDEO)/calomega.o \ |
| 1540 | 1538 | $(DRIVERS)/carrera.o \ |
| 1541 | $(DRIVERS)/caswin.o \ | |
| 1542 | 1539 | $(DRIVERS)/cave.o $(VIDEO)/cave.o \ |
| 1543 | 1540 | $(DRIVERS)/cidelsa.o $(VIDEO)/cidelsa.o \ |
| 1544 | 1541 | $(DRIVERS)/coinmstr.o \ |
| r4135 | r4136 | |
| 1564 | 1561 | $(DRIVERS)/esh.o \ |
| 1565 | 1562 | $(DRIVERS)/esripsys.o $(VIDEO)/esripsys.o \ |
| 1566 | 1563 | $(DRIVERS)/ettrivia.o \ |
| 1567 | $(DRIVERS)/filetto.o \ | |
| 1568 | 1564 | $(DRIVERS)/flower.o $(AUDIO)/flower.o $(VIDEO)/flower.o \ |
| 1569 | 1565 | $(DRIVERS)/fortecar.o \ |
| 1570 | 1566 | $(DRIVERS)/freekick.o $(VIDEO)/freekick.o \ |
| r4135 | r4136 | |
| 1581 | 1577 | $(DRIVERS)/gumbo.o $(VIDEO)/gumbo.o \ |
| 1582 | 1578 | $(DRIVERS)/gunpey.o \ |
| 1583 | 1579 | $(DRIVERS)/hexa.o $(VIDEO)/hexa.o \ |
| 1580 | $(DRIVERS)/highvdeo.o \ | |
| 1584 | 1581 | $(DRIVERS)/homedata.o $(VIDEO)/homedata.o \ |
| 1585 | 1582 | $(DRIVERS)/hotblock.o \ |
| 1586 | 1583 | $(DRIVERS)/ilpag.o \ |
| r4135 | r4136 | |
| 1627 | 1624 | $(DRIVERS)/pangofun.o \ |
| 1628 | 1625 | $(DRIVERS)/pasha2.o \ |
| 1629 | 1626 | $(DRIVERS)/pass.o $(VIDEO)/pass.o \ |
| 1627 | $(DRIVERS)/pcxt.o \ | |
| 1630 | 1628 | $(DRIVERS)/peplus.o \ |
| 1631 | 1629 | $(DRIVERS)/pipeline.o \ |
| 1632 | 1630 | $(DRIVERS)/pkscram.o \ |
| r4135 | r4136 | |
| 1644 | 1642 | $(DRIVERS)/skylncr.o \ |
| 1645 | 1643 | $(DRIVERS)/sliver.o \ |
| 1646 | 1644 | $(DRIVERS)/slotcarn.o \ |
| 1647 | $(DRIVERS)/sms | |
| 1645 | $(DRIVERS)/sms | |
| 1648 | 1646 | $(DRIVERS)/snookr10.o $(VIDEO)/snookr10.o \ |
| 1649 | 1647 | $(DRIVERS)/spool99.o \ |
| 1650 | 1648 | $(DRIVERS)/sprcros2.o $(VIDEO)/sprcros2.o \ |
| r4135 | r4136 | |
| 1657 | 1655 | $(DRIVERS)/tattack.o \ |
| 1658 | 1656 | $(DRIVERS)/taxidrvr.o $(VIDEO)/taxidrvr.o \ |
| 1659 | 1657 | $(DRIVERS)/tcl.o \ |
| 1660 | $(DRIVERS)/tetriunk.o \ | |
| 1661 | 1658 | $(DRIVERS)/thayers.o \ |
| 1662 | 1659 | $(DRIVERS)/thedeep.o $(VIDEO)/thedeep.o \ |
| 1663 | 1660 | $(DRIVERS)/tiamc1.o $(VIDEO)/tiamc1.o $(AUDIO)/tiamc1.o \ |
| r4135 | r4136 | |
| 1677 | 1674 | $(DRIVERS)/xyonix.o $(VIDEO)/xyonix.o \ |
| 1678 | 1675 | $(DRIVERS)/hikaru.o \ |
| 1679 | 1676 | $(DRIVERS)/cb2001.o \ |
| 1677 | $(DRIVERS)/sfbonus.o \ | |
| 1680 | 1678 | |
| 1681 | 1679 | #------------------------------------------------- |
| 1682 | 1680 | # layout dependencies |
| r4135 | r4136 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | VIDEO_START( mlc ) |
| 22 | 22 | { |
| 23 | alpha_set_level(0x80); | |
| 24 | ||
| 25 | 23 | if (machine->gfx[0]->color_granularity==16) |
| 26 | 24 | colour_mask=0x7f; |
| 27 | 25 | else if (machine->gfx[0]->color_granularity==32) |
| r4135 | r4136 | |
| 65 | 63 | static void mlc_drawgfxzoom(running_machine *machine, |
| 66 | 64 | bitmap_t *dest_bmp,const gfx_element *gfx, |
| 67 | 65 | UINT32 code1,UINT32 code2, UINT32 color,int flipx,int flipy,int sx,int sy, |
| 68 | const rectangle *clip,int transparency,int transparent_color,int use8bpp, | |
| 69 | int scalex, int scaley) | |
| 66 | const rectangle *clip,int transparent_color,int use8bpp, | |
| 67 | int scalex, int scaley,int alpha) | |
| 70 | 68 | { |
| 71 | 69 | rectangle myclip; |
| 72 | 70 | |
| r4135 | r4136 | |
| 99 | 97 | if( gfx ) |
| 100 | 98 | { |
| 101 | 99 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 102 | int source_base1 = (code1 % gfx->total_elements) * gfx->height; | |
| 103 | int source_base2 = (code2 % gfx->total_elements) * gfx->height; | |
| 100 | const UINT8 *code_base1 = gfx_element_get_data(gfx, code1 % gfx->total_elements); | |
| 101 | const UINT8 *code_base2 = gfx_element_get_data(gfx, code2 % gfx->total_elements); | |
| 104 | 102 | |
| 105 | 103 | int sprite_screen_height = (scaley*gfx->height+(sy&0xffff))>>16; |
| 106 | 104 | int sprite_screen_width = (scalex*gfx->width+(sx&0xffff))>>16; |
| r4135 | r4136 | |
| 172 | 170 | int y; |
| 173 | 171 | |
| 174 | 172 | /* case 1: TRANSPARENCY_PEN */ |
| 175 | if ( | |
| 173 | if ( | |
| 176 | 174 | { |
| 177 | 175 | { |
| 178 | 176 | for( y=sy; y<ey; y++ ) |
| 179 | 177 | { |
| 180 | UINT8 *source1 = gfx->gfxdata + (source_base1+(y_index>>16)) * gfx->line_modulo; | |
| 181 | UINT8 *source2 = gfx->gfxdata + (source_base2+(y_index>>16)) * gfx->line_modulo; | |
| 178 | const UINT8 *source1 = code_base1 + (y_index>>16) * gfx->line_modulo; | |
| 179 | const UINT8 *source2 = code_base2 + (y_index>>16) * gfx->line_modulo; | |
| 182 | 180 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 183 | 181 | |
| 184 | 182 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 199 | 197 | } |
| 200 | 198 | } |
| 201 | 199 | |
| 202 | /* case 6: TRANSPARENCY_ALPHA */ | |
| 203 | if (transparency == TRANSPARENCY_ALPHA) | |
| 200 | /* case 6: alpha blended */ | |
| 201 | else | |
| 204 | 202 | { |
| 205 | 203 | { |
| 206 | 204 | for( y=sy; y<ey; y++ ) |
| 207 | 205 | { |
| 208 | UINT8 *source = | |
| 206 | const UINT8 *source = | |
| 209 | 207 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 210 | 208 | |
| 211 | 209 | int x, x_index = x_index_base; |
| 212 | 210 | for( x=sx; x<ex; x++ ) |
| 213 | 211 | { |
| 214 | 212 | int c = source[x_index>>16]; |
| 215 | if( c != transparent_color ) dest[x] = alpha_blend32(dest[x], 0); //pal[c]); | |
| 213 | if( c != transparent_color ) dest[x] = alpha_blend_r32(dest[x], 0, alpha); //pal[c]); | |
| 216 | 214 | x_index += dx; |
| 217 | 215 | } |
| 218 | 216 | |
| r4135 | r4136 | |
| 237 | 235 | int sprite2=0,indx2=0,use8bppMode=0; |
| 238 | 236 | int yscale,xscale; |
| 239 | 237 | int ybase,yinc; |
| 240 | int | |
| 238 | int | |
| 241 | 239 | int useIndicesInRom=0; |
| 242 | 240 | int hibits=0; |
| 243 | 241 | int tileFormat=0; |
| r4135 | r4136 | |
| 325 | 323 | |
| 326 | 324 | /* Any colours out of range (for the bpp value) trigger 'shadow' mode */ |
| 327 | 325 | if (color & (colour_mask+1)) |
| 328 | | |
| 326 | | |
| 329 | 327 | else |
| 330 | | |
| 328 | | |
| 331 | 329 | color&=colour_mask; |
| 332 | 330 | |
| 333 | 331 | /* If this bit is set, combine this block with the next one */ |
| r4135 | r4136 | |
| 491 | 489 | /*rasterMode ? temp_bitmap : */bitmap,machine->gfx[0], |
| 492 | 490 | tile,tile2, |
| 493 | 491 | color + colorOffset,fx,fy,xbase,ybase, |
| 494 | &user_clip,trans,0, | |
| 495 | use8bppMode,(xscale<<8),(yscale<<8)); | |
| 492 | &user_clip,0, | |
| 493 | use8bppMode,(xscale<<8),(yscale<<8),alpha); | |
| 496 | 494 | |
| 497 | 495 | sprite++; |
| 498 | 496 | sprite2++; |
| r4135 | r4136 | |
|---|---|---|
| 251 | 251 | } |
| 252 | 252 | scalex = (1<<16); |
| 253 | 253 | |
| 254 | copyrozbitmap( | |
| 255 | bitmap,tmpbitmap, | |
| 254 | copyrozbitmap_trans( | |
| 255 | bitmap,cliprect,tmpbitmap, | |
| 256 | 256 | -x0*scalex,/* startx */ |
| 257 | 257 | -y0*scaley,/* starty */ |
| 258 | 258 | scalex,/* incxx */ |
| 259 | 259 | 0,0,/* incxy,incyx */ |
| 260 | 260 | scaley,/* incyy */ |
| 261 | 261 | 0, /* no wraparound */ |
| 262 | cliprect, | |
| 263 | TRANSPARENCY_PEN,0, | |
| 264 | 0 /* priority */ | |
| 262 | 0 | |
| 265 | 263 | ); |
| 266 | 264 | } |
| 267 | 265 |
| r4135 | r4136 | |
|---|---|---|
| 140 | 140 | break; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | decodechar(space->machine->gfx[2],(offset-0x400/64)&0x7f,tryout_vram_gfx); | |
| 144 | tilemap_mark_all_tiles_dirty(bg_tilemap); | |
| 143 | gfx_element_mark_dirty(space->machine->gfx[2], (offset-0x400/64)&0x7f); | |
| 145 | 144 | } |
| 146 | 145 | |
| 147 | 146 | WRITE8_HANDLER( tryout_vram_bankswitch_w ) |
| r4135 | r4136 | |
| 179 | 178 | tryout_vram=auto_malloc(8 * 0x800); |
| 180 | 179 | tryout_vram_gfx=auto_malloc(0x6000); |
| 181 | 180 | |
| 181 | gfx_element_set_source(machine->gfx[2], tryout_vram_gfx); | |
| 182 | ||
| 182 | 183 | tilemap_set_transparent_pen(fg_tilemap,0); |
| 183 | 184 | } |
| 184 | 185 |
| r4135 | r4136 | |
|---|---|---|
| 97 | 97 | assert(ttl_gfx_index != MAX_GFX_ELEMENTS); |
| 98 | 98 | |
| 99 | 99 | // decode the ttl layer's gfx |
| 100 | machine->gfx[ttl_gfx_index] = allocgfx(machine, &charlayout); | |
| 101 | decodegfx(machine->gfx[ttl_gfx_index], memory_region(machine, "gfx3"), 0, machine->gfx[ttl_gfx_index]->total_elements); | |
| 100 | machine->gfx[ttl_gfx_index] = gfx_element_alloc(machine, &charlayout, memory_region(machine, "gfx3"), machine->config->total_colors / 16, 0); | |
| 102 | 101 | |
| 103 | machine->gfx[ttl_gfx_index]->total_colors = machine->config->total_colors / 16; | |
| 104 | ||
| 105 | 102 | // create the tilemap |
| 106 | 103 | ttl_tilemap = tilemap_create(machine, ttl_get_tile_info, tilemap_scan_rows, 8, 8, 64, 32); |
| 107 | 104 |
| r4135 | r4136 | |
|---|---|---|
| 95 | 95 | |
| 96 | 96 | ***************************************************************************/ |
| 97 | 97 | |
| 98 | static void aerofgt_register_state_globals(running_machine *machine) | |
| 99 | { | |
| 100 | state_save_register_global_array(machine, gfxbank); | |
| 101 | state_save_register_global(machine, bg1scrollx); | |
| 102 | state_save_register_global(machine, bg1scrolly); | |
| 103 | state_save_register_global(machine, bg2scrollx); | |
| 104 | state_save_register_global(machine, bg2scrolly); | |
| 105 | state_save_register_global(machine, charpalettebank); | |
| 106 | state_save_register_global(machine, spritepalettebank); | |
| 107 | } | |
| 108 | ||
| 98 | 109 | VIDEO_START( pspikes ) |
| 99 | 110 | { |
| 100 | 111 | bg1_tilemap = tilemap_create(machine, get_pspikes_tile_info,tilemap_scan_rows,8,8,64,32); |
| 101 | 112 | /* no bg2 in this game */ |
| 102 | 113 | |
| 103 | 114 | sprite_gfx = 1; |
| 115 | ||
| 116 | aerofgt_register_state_globals(machine); | |
| 117 | state_save_register_global(machine, spikes91_lookup); | |
| 104 | 118 | } |
| 105 | 119 | |
| 106 | 120 | |
| r4135 | r4136 | |
| 114 | 128 | spritepalettebank = 0; |
| 115 | 129 | |
| 116 | 130 | sprite_gfx = 2; |
| 131 | ||
| 132 | aerofgt_register_state_globals(machine); | |
| 117 | 133 | } |
| 118 | 134 | |
| 119 | 135 | VIDEO_START( spinlbrk ) |
| r4135 | r4136 | |
| 140 | 156 | aerofgt_spriteram1 = aerofgt_spriteram2 + aerofgt_spriteram2_size/2; |
| 141 | 157 | aerofgt_spriteram1_size = 0x4000; |
| 142 | 158 | for (i = 0;i < aerofgt_spriteram1_size/2;i++) |
| 159 | { | |
| 143 | 160 | aerofgt_spriteram1[i] = i; |
| 161 | } | |
| 162 | ||
| 163 | aerofgt_register_state_globals(machine); | |
| 144 | 164 | } |
| 145 | 165 | |
| 146 | 166 | VIDEO_START( turbofrc ) |
| r4135 | r4136 | |
| 153 | 173 | spritepalettebank = 0; |
| 154 | 174 | |
| 155 | 175 | sprite_gfx = 2; |
| 176 | ||
| 177 | aerofgt_register_state_globals(machine); | |
| 156 | 178 | } |
| 157 | 179 | |
| 158 | 180 | VIDEO_START( wbbc97 ) |
| r4135 | r4136 | |
| 163 | 185 | tilemap_set_transparent_pen(bg1_tilemap,15); |
| 164 | 186 | |
| 165 | 187 | sprite_gfx = 1; |
| 188 | ||
| 189 | aerofgt_register_state_globals(machine); | |
| 190 | ||
| 191 | state_save_register_global(machine, wbbc97_bitmap_enable); | |
| 166 | 192 | } |
| 167 | 193 | |
| 168 | 194 | /*************************************************************************** |
| r4135 | r4136 | |
|---|---|---|
| 6 | 6 | UINT8 *mainsnk_bgram; |
| 7 | 7 | |
| 8 | 8 | |
| 9 | static UINT32 bg_tile_offset; | |
| 9 | 10 | |
| 11 | ||
| 10 | 12 | static TILEMAP_MAPPER( marvins_tx_scan_cols ) |
| 11 | 13 | { |
| 12 | 14 | // tilemap is 36x28, the central part is from the first RAM page and the |
| r4135 | r4136 | |
| 33 | 35 | |
| 34 | 36 | SET_TILE_INFO( |
| 35 | 37 | 0, |
| 36 | code, | |
| 38 | bg_tile_offset + code, | |
| 37 | 39 | 0, |
| 38 | 40 | 0); |
| 39 | 41 | } |
| r4135 | r4136 | |
| 67 | 69 | else if (space->machine->gfx[0]->total_elements == 0x800) // canvas |
| 68 | 70 | bank = ((data & 0x40) >> 6) | ((data & 0x30) >> 3); |
| 69 | 71 | |
| 70 | tilemap_set_pen_data_offset(bg_tilemap, (bank << 8) * space->machine->gfx[0]->char_modulo); | |
| 72 | if (bg_tile_offset != (bank << 8)) | |
| 73 | { | |
| 74 | bg_tile_offset = bank << 8; | |
| 75 | tilemap_mark_all_tiles_dirty(bg_tilemap); | |
| 76 | } | |
| 71 | 77 | } |
| 72 | 78 | |
| 73 | 79 | WRITE8_HANDLER( mainsnk_fgram_w ) |
| r4135 | r4136 | |
|---|---|---|
| 882 | 882 | cos_theta = (double)ygv608.dx / (double)0x10000; |
| 883 | 883 | |
| 884 | 884 | if( ygv608.regs.s.zron ) |
| 885 | copyrozbitmap( bitmap, work_bitmap, | |
| 885 | copyrozbitmap( bitmap, cliprect, work_bitmap, | |
| 886 | 886 | ( visarea->min_x << 16 ) + |
| 887 | 887 | ygv608.ax + 0x10000 * r * |
| 888 | 888 | ( -sin( alpha ) * cos_theta + cos( alpha ) * sin_theta ), |
| 889 | 889 | ( visarea->min_y << 16 ) + |
| 890 | 890 | ygv608.ay + 0x10000 * r * |
| 891 | 891 | ( cos( alpha ) * cos_theta + sin( alpha ) * sin_theta ), |
| 892 | ygv608.dx, ygv608.dxy, ygv608.dyx, ygv608.dy, 0, | |
| 893 | cliprect, | |
| 894 | TRANSPARENCY_NONE, 0, 0 ); | |
| 892 | ygv608.dx, ygv608.dxy, ygv608.dyx, ygv608.dy, 0); | |
| 895 | 893 | else |
| 896 | 894 | #endif |
| 897 | 895 | copybitmap( bitmap, work_bitmap, 0, 0, 0, 0, cliprect); |
| r4135 | r4136 | |
| 909 | 907 | |
| 910 | 908 | #ifdef _ENABLE_ROTATE_ZOOM |
| 911 | 909 | if( ygv608.regs.s.zron ) |
| 912 | copyrozbitmap( bitmap, work_bitmap, | |
| 910 | copyrozbitmap_trans( bitmap, cliprect, work_bitmap, | |
| 913 | 911 | ygv608.ax, // + ( visarea->min_x << 16 ), |
| 914 | 912 | ygv608.ay, // + ( visarea->min_y << 16 ), |
| 915 | 913 | ygv608.dx, ygv608.dxy, ygv608.dyx, ygv608.dy, 0, |
| 916 | cliprect, | |
| 917 | TRANSPARENCY_PEN, 0, 0 ); | |
| 914 | 0 ); | |
| 918 | 915 | else |
| 919 | 916 | #endif |
| 920 | 917 | copybitmap_trans( bitmap, work_bitmap, 0, 0, 0, 0, cliprect, 0 ); |
| r4135 | r4136 | |
| 1046 | 1043 | if (ygv608.regs.s.r2 & r2_saar) |
| 1047 | 1044 | ygv608.regs.s.saa++; |
| 1048 | 1045 | return (data << 8); |
| 1049 | break; | |
| 1050 | 1046 | |
| 1051 | 1047 | case 0x02: /* P#2 - scroll data port */ |
| 1052 | 1048 | data = ygv608.scroll_data_table[(ygv608.regs.s.r2 & r2_b_a) >> 4][ygv608.regs.s.sca]; |
| r4135 | r4136 | |
| 1058 | 1054 | ygv608.regs.s.r2 ^= r2_b_a; |
| 1059 | 1055 | } |
| 1060 | 1056 | return( data << 8 ); |
| 1061 | break; | |
| 1062 | 1057 | |
| 1063 | 1058 | case 0x03: /* P#3 - color palette data port */ |
| 1064 | 1059 | data = ygv608.colour_palette[ygv608.regs.s.cc][p3_state]; |
| r4135 | r4136 | |
| 1069 | 1064 | ygv608.regs.s.cc++; |
| 1070 | 1065 | } |
| 1071 | 1066 | return( data << 8 ); |
| 1072 | break; | |
| 1073 | 1067 | |
| 1074 | 1068 | case 0x04: /* P#4 - register data port */ |
| 1075 | 1069 | { |
| r4135 | r4136 | |
|---|---|---|
| 25 | 25 | UINT32 *stv_vdp1_vram; |
| 26 | 26 | static UINT32 *stv_vdp1_regs; |
| 27 | 27 | UINT8* stv_vdp1_gfx_decode; |
| 28 | extern UINT8 get_vblank(running_machine *machine); | |
| 29 | 28 | |
| 30 | 29 | static UINT16 *stv_framebuffer[2]; |
| 31 | 30 | static UINT16 **stv_framebuffer_draw_lines; |
| r4135 | r4136 | |
| 294 | 293 | else |
| 295 | 294 | { |
| 296 | 295 | if ( vdp1_sprite_log ) logerror( "VDP1: Access to register TVMR = %1X\n", STV_VDP1_TVMR ); |
| 297 | if ( STV_VDP1_VBE && get_vblank(space->machine) ) | |
| 296 | if ( STV_VDP1_VBE && stv_get_vblank(space->machine) ) | |
| 298 | 297 | { |
| 299 | 298 | stv_vdp1_clear_framebuffer_on_next_frame = 1; |
| 300 | 299 | } |
| r4135 | r4136 | |
|---|---|---|
| 338 | 338 | { |
| 339 | 339 | int shift = 8 * (offset & 1); |
| 340 | 340 | switch (offset/2) { |
| 341 | case 0: return twincobr_txram_r(space,0,0xffff) >> shift; break; | |
| 342 | case 1: return twincobr_bgram_r(space,0,0xffff) >> shift; break; | |
| 343 | case 2: return twincobr_fgram_r(space,0,0xffff) >> shift; break; | |
| 341 | case 0: return twincobr_txram_r(space,0,0xffff) >> shift; | |
| 342 | case 1: return twincobr_bgram_r(space,0,0xffff) >> shift; | |
| 343 | case 2: return twincobr_fgram_r(space,0,0xffff) >> shift; | |
| 344 | 344 | } |
| 345 | 345 | return 0; |
| 346 | 346 | } |
| r4135 | r4136 | |
|---|---|---|
| 217 | 217 | converted_gfx[offs * 4 + 1] = p3; |
| 218 | 218 | converted_gfx[offs * 4 + 0] = p4; |
| 219 | 219 | } |
| 220 | ||
| 221 | state_save_register_global_pointer(machine, main_bitmap, BITMAP_WIDTH * BITMAP_HEIGHT); | |
| 222 | state_save_register_global_pointer(machine, converted_gfx, 0x8000 * 2); | |
| 223 | state_save_register_global(machine, arabian_video_control); | |
| 224 | state_save_register_global(machine, arabian_flip_screen); | |
| 220 | 225 | } |
| 221 | 226 | |
| 222 | 227 | |
| r4135 | r4136 | |
| 381 | 386 | { |
| 382 | 387 | /* non-flipped case */ |
| 383 | 388 | if (!arabian_flip_screen) |
| 384 | draw_scanline8(bitmap, 0, y, BITMAP_WIDTH, &main_bitmap[y * BITMAP_WIDTH], pens | |
| 389 | draw_scanline8(bitmap, 0, y, BITMAP_WIDTH, &main_bitmap[y * BITMAP_WIDTH], pens | |
| 385 | 390 | |
| 386 | 391 | /* flipped case */ |
| 387 | 392 | else |
| r4135 | r4136 | |
| 390 | 395 | int x; |
| 391 | 396 | for (x = 0; x < BITMAP_WIDTH; x++) |
| 392 | 397 | scanline[BITMAP_WIDTH - 1 - x] = main_bitmap[y * BITMAP_WIDTH + x]; |
| 393 | draw_scanline8(bitmap, 0, BITMAP_HEIGHT - 1 - y, BITMAP_WIDTH, scanline, pens | |
| 398 | draw_scanline8(bitmap, 0, BITMAP_HEIGHT - 1 - y, BITMAP_WIDTH, scanline, pens | |
| 394 | 399 | } |
| 395 | 400 | } |
| 396 | 401 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 366 | 366 | |
| 367 | 367 | /* render all the scanlines from the dstbitmap to MAME's bitmap */ |
| 368 | 368 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) |
| 369 | draw_scanline8(bitmap, cliprect->min_x, y, width, &dstbitmap[DSTBITMAP_WIDTH * y + cliprect->min_x], NULL | |
| 369 | draw_scanline8(bitmap, cliprect->min_x, y, width, &dstbitmap[DSTBITMAP_WIDTH * y + cliprect->min_x], NULL | |
| 370 | 370 | |
| 371 | 371 | return 0; |
| 372 | 372 | } |
| r4135 | r4136 | |
|---|---|---|
| 235 | 235 | static void draw_blend_gfx(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy) |
| 236 | 236 | { |
| 237 | 237 | const pen_t *pens = &machine->pens[gfx->color_base]; |
| 238 | UINT8 *dp; | |
| 238 | const UINT8 *dp; | |
| 239 | 239 | int i, j; |
| 240 | 240 | int x1, x2; |
| 241 | 241 | int y1, y2; |
| r4135 | r4136 | |
| 314 | 314 | code &= 0xffff; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | dp = gfx | |
| 317 | dp = gfx_element_get_data( | |
| 318 | 318 | |
| 319 | 319 | // draw |
| 320 | 320 | for (j=y1; j <= y2; j++) |
| r4135 | r4136 | |
|---|---|---|
| 108 | 108 | |
| 109 | 109 | UINT32* stv_vdp2_regs; |
| 110 | 110 | UINT32* stv_vdp2_vram; |
| 111 | /* this won't be used in the end .. */ | |
| 112 | static UINT8* stv_vdp2_vram_dirty_8x8x4; | |
| 113 | static UINT8* stv_vdp2_vram_dirty_8x8x8; | |
| 114 | 111 | |
| 115 | 112 | static UINT8* stv_vdp2_gfx_decode; |
| 116 | 113 | |
| 117 | 114 | static int stv_vdp2_render_rbg0; |
| 118 | int stv_hblank,stv_vblank,stv_odd; | |
| 119 | int horz_res,vert_res; | |
| 115 | int stv_hblank,stv_vblank; | |
| 116 | static int stv_odd; | |
| 117 | static int horz_res,vert_res; | |
| 120 | 118 | |
| 121 | 119 | UINT32* stv_vdp2_cram; |
| 122 | 120 | |
| 123 | 121 | static void stv_vdp2_dynamic_res_change(running_machine *machine); |
| 124 | UINT8 get_vblank(running_machine *machine); | |
| 125 | UINT8 get_hblank(running_machine *machine); | |
| 126 | int get_vblank_duration(running_machine *machine); | |
| 122 | static UINT8 get_hblank(running_machine *machine); | |
| 123 | static int get_vblank_duration(running_machine *machine); | |
| 127 | 124 | //int get_hblank_duration(running_machine *machine); //<- when we know that... |
| 128 | UINT8 get_odd_bit(running_machine *machine); | |
| 125 | static UINT8 get_odd_bit(running_machine *machine); | |
| 129 | 126 | |
| 130 | 127 | static void refresh_palette_data(running_machine *machine); |
| 131 | 128 | static int stv_vdp2_window_process(int x,int y); |
| r4135 | r4136 | |
| 138 | 135 | { |
| 139 | 136 | STV_TRANSPARENCY_NONE = TRANSPARENCY_NONE, |
| 140 | 137 | STV_TRANSPARENCY_PEN = TRANSPARENCY_PEN, |
| 141 | STV_TRANSPARENCY_ALPHA = TRANSPARENCY_ALPHA, | |
| 142 | STV_TRANSPARENCY_ADD_BLEND = TRANSPARENCY_MODES | |
| 138 | STV_TRANSPARENCY_ADD_BLEND = TRANSPARENCY_MODES, | |
| 139 | STV_TRANSPARENCY_ALPHA = TRANSPARENCY_MODES + 1 | |
| 143 | 140 | }; |
| 144 | 141 | |
| 145 | 142 | #if DEBUG_MODE |
| r4135 | r4136 | |
| 2072 | 2069 | UINT8 transparency; |
| 2073 | 2070 | UINT8 colour_calculation_enabled; |
| 2074 | 2071 | UINT8 colour_depth; |
| 2072 | UINT8 alpha; | |
| 2075 | 2073 | UINT8 tile_size; |
| 2076 | 2074 | UINT8 bitmap_enable; |
| 2077 | 2075 | UINT8 bitmap_size; |
| r4135 | r4136 | |
| 2398 | 2396 | bitmap_t *dest_bmp,const gfx_element *gfx, |
| 2399 | 2397 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 2400 | 2398 | const rectangle *clip,int transparency,int transparent_color,int scalex, int scaley, |
| 2401 | int sprite_screen_width, int sprite_screen_height) | |
| 2399 | int sprite_screen_width, int sprite_screen_height, int alpha) | |
| 2402 | 2400 | { |
| 2403 | 2401 | rectangle myclip; |
| 2404 | 2402 | |
| r4135 | r4136 | |
| 2452 | 2450 | if( gfx ) |
| 2453 | 2451 | { |
| 2454 | 2452 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 2455 | UINT8 *source_base = gfx | |
| 2453 | const UINT8 *source_base = gfx_element_get_data | |
| 2456 | 2454 | |
| 2457 | 2455 | //int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; |
| 2458 | 2456 | //int sprite_screen_width = (scalex*gfx->width+0x8000)>>16; |
| r4135 | r4136 | |
| 2529 | 2527 | { |
| 2530 | 2528 | for( y=sy; y<ey; y++ ) |
| 2531 | 2529 | { |
| 2532 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2530 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2533 | 2531 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 2534 | 2532 | |
| 2535 | 2533 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 2546 | 2544 | { |
| 2547 | 2545 | for( y=sy; y<ey; y++ ) |
| 2548 | 2546 | { |
| 2549 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2547 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2550 | 2548 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 2551 | 2549 | |
| 2552 | 2550 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 2568 | 2566 | { |
| 2569 | 2567 | for( y=sy; y<ey; y++ ) |
| 2570 | 2568 | { |
| 2571 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2569 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2572 | 2570 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 2573 | 2571 | |
| 2574 | 2572 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 2586 | 2584 | { |
| 2587 | 2585 | for( y=sy; y<ey; y++ ) |
| 2588 | 2586 | { |
| 2589 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2587 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2590 | 2588 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 2591 | 2589 | |
| 2592 | 2590 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 2602 | 2600 | } |
| 2603 | 2601 | } |
| 2604 | 2602 | |
| 2605 | /* case 6: TRANSPARENCY_ALPHA */ | |
| 2606 | if (transparency == TRANSPARENCY_ALPHA) | |
| 2603 | /* case 6: STV_TRANSPARENCY_ALPHA */ | |
| 2604 | if (transparency == STV_TRANSPARENCY_ALPHA) | |
| 2607 | 2605 | { |
| 2608 | 2606 | for( y=sy; y<ey; y++ ) |
| 2609 | 2607 | { |
| 2610 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2608 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2611 | 2609 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 2612 | 2610 | |
| 2613 | 2611 | int x, x_index = x_index_base; |
| 2614 | 2612 | for( x=sx; x<ex; x++ ) |
| 2615 | 2613 | { |
| 2616 | 2614 | int c = source[x_index>>16]; |
| 2617 | if( c != transparent_color ) dest[x] = alpha_blend16(dest[x], pal[c]); | |
| 2615 | if( c != transparent_color ) dest[x] = alpha_blend_r16(dest[x], pal[c], alpha); | |
| 2618 | 2616 | x_index += dx; |
| 2619 | 2617 | } |
| 2620 | 2618 | |
| r4135 | r4136 | |
| 2629 | 2627 | { |
| 2630 | 2628 | for( y=sy; y<ey; y++ ) |
| 2631 | 2629 | { |
| 2632 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2630 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2633 | 2631 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 2634 | 2632 | |
| 2635 | 2633 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 2647 | 2645 | { |
| 2648 | 2646 | for( y=sy; y<ey; y++ ) |
| 2649 | 2647 | { |
| 2650 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2648 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2651 | 2649 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 2652 | 2650 | |
| 2653 | 2651 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 2729 | 2727 | } |
| 2730 | 2728 | |
| 2731 | 2729 | static void stv_vdp2_drawgfx_rgb555( bitmap_t *dest_bmp, UINT32 code, int flipx, int flipy, |
| 2732 | int sx, int sy, const rectangle *clip, int transparency) | |
| 2730 | int sx, int sy, const rectangle *clip, int transparency, int alpha) | |
| 2733 | 2731 | { |
| 2734 | 2732 | rectangle myclip; |
| 2735 | 2733 | UINT8* gfxdata; |
| r4135 | r4136 | |
| 2817 | 2815 | |
| 2818 | 2816 | for( y=sy; y<ey; y++ ) |
| 2819 | 2817 | { |
| 2820 | UINT8 *source = gfxdata + (y_index>>16)*16; | |
| 2818 | const UINT8 *source = gfxdata + (y_index>>16)*16; | |
| 2821 | 2819 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 2822 | 2820 | UINT16 data; |
| 2823 | 2821 | |
| r4135 | r4136 | |
| 2836 | 2834 | if(stv2_current_tilemap.fade_control & 1) |
| 2837 | 2835 | stv_vdp2_compute_color_offset_RGB555(&r,&g,&b,stv2_current_tilemap.fade_control & 2); |
| 2838 | 2836 | |
| 2839 | if ( transparency == TRANSPARENCY_ALPHA ) | |
| 2840 | dest[x] = alpha_blend16( dest[x], b | g << 5 | r << 10 ); | |
| 2837 | if ( transparency == STV_TRANSPARENCY_ALPHA ) | |
| 2838 | dest[x] = alpha_blend_r16( dest[x], b | g << 5 | r << 10, alpha ); | |
| 2841 | 2839 | else |
| 2842 | 2840 | dest[x] = b | g << 5 | r << 10; |
| 2843 | 2841 | } |
| r4135 | r4136 | |
| 2937 | 2935 | if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) |
| 2938 | 2936 | *BITMAP_ADDR16(bitmap, ycnt, xcnt+1) = machine->pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; |
| 2939 | 2937 | else |
| 2940 | *BITMAP_ADDR16(bitmap, ycnt, xcnt+1) = alpha_blend16(*BITMAP_ADDR16(bitmap, ycnt, xcnt+1), machine->pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]); | |
| 2938 | *BITMAP_ADDR16(bitmap, ycnt, xcnt+1) = alpha_blend_r16(*BITMAP_ADDR16(bitmap, ycnt, xcnt+1), machine->pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); | |
| 2941 | 2939 | } |
| 2942 | 2940 | } |
| 2943 | 2941 | tw = stv_vdp2_window_process(xcnt,ycnt); |
| r4135 | r4136 | |
| 2950 | 2948 | if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) |
| 2951 | 2949 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = machine->pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; |
| 2952 | 2950 | else |
| 2953 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]); | |
| 2951 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend_r16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); | |
| 2954 | 2952 | } |
| 2955 | 2953 | } |
| 2956 | 2954 | gfxdata++; |
| r4135 | r4136 | |
| 2982 | 2980 | if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) |
| 2983 | 2981 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; |
| 2984 | 2982 | else |
| 2985 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]); | |
| 2983 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend_r16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); | |
| 2986 | 2984 | } |
| 2987 | 2985 | } |
| 2988 | 2986 | if ( (gfxdata + xs) >= gfxdatahigh ) |
| r4135 | r4136 | |
| 3025 | 3023 | if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) |
| 3026 | 3024 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; |
| 3027 | 3025 | else |
| 3028 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]); | |
| 3026 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend_r16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); | |
| 3029 | 3027 | } |
| 3030 | 3028 | } |
| 3031 | 3029 | |
| r4135 | r4136 | |
| 3050 | 3048 | if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) |
| 3051 | 3049 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = machine->pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset]; |
| 3052 | 3050 | else |
| 3053 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset]); | |
| 3051 | *BITMAP_ADDR16(bitmap, ycnt, xcnt) = alpha_blend_r16(*BITMAP_ADDR16(bitmap, ycnt, xcnt), machine->pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset], stv2_current_tilemap.alpha); | |
| 3054 | 3052 | } |
| 3055 | 3053 | } |
| 3056 | 3054 | |
| r4135 | r4136 | |
| 3094 | 3092 | if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) |
| 3095 | 3093 | destline[xcnt] = b | g << 5 | r << 10; |
| 3096 | 3094 | else |
| 3097 | destline[xcnt] = alpha_blend16( destline[xcnt], b | g << 5 | r << 10 ); | |
| 3095 | destline[xcnt] = alpha_blend_r16( destline[xcnt], b | g << 5 | r << 10, stv2_current_tilemap.alpha ); | |
| 3098 | 3096 | } |
| 3099 | 3097 | |
| 3100 | 3098 | if ( (gfxdata + 2*xs) >= gfxdatahigh ) gfxdata = gfxdatalow; |
| r4135 | r4136 | |
| 3134 | 3132 | if(t_pen) |
| 3135 | 3133 | { |
| 3136 | 3134 | if ( stv2_current_tilemap.colour_calculation_enabled == 1 ) |
| 3137 | destline[xcnt] = alpha_blend16( destline[xcnt], b | g << 5 | r << 10 ); | |
| 3135 | destline[xcnt] = alpha_blend_r16( destline[xcnt], b | g << 5 | r << 10, stv2_current_tilemap.alpha ); | |
| 3138 | 3136 | else |
| 3139 | 3137 | destline[xcnt] = b | g << 5 | r << 10; |
| 3140 | 3138 | } |
| r4135 | r4136 | |
| 3397 | 3395 | } |
| 3398 | 3396 | else |
| 3399 | 3397 | { |
| 3400 | stv2_current_tilemap.transparency = TRANSPARENCY_ALPHA; | |
| 3398 | stv2_current_tilemap.transparency = STV_TRANSPARENCY_ALPHA; | |
| 3401 | 3399 | } |
| 3402 | 3400 | } |
| 3403 | 3401 | |
| r4135 | r4136 | |
| 3606 | 3604 | |
| 3607 | 3605 | for (x = 0; x<mptiles_x; x++) { |
| 3608 | 3606 | int xpageoffs; |
| 3607 | int tilecodespacing = 1; | |
| 3609 | 3608 | |
| 3610 | 3609 | if ( x == 0 ) |
| 3611 | 3610 | { |
| r4135 | r4136 | |
| 3686 | 3685 | |
| 3687 | 3686 | if (stv2_current_tilemap.colour_depth == 1) |
| 3688 | 3687 | { |
| 3689 | UINT8 gfx_mem_offset = (tilecode & 0x1) ? 0x20 : 0x0; | |
| 3690 | ||
| 3691 | tilecode = tilecode >> 1; | |
| 3692 | 3688 | gfx = 2; |
| 3693 | 3689 | pal = pal >>4; |
| 3694 | ||
| 3695 | /* do a bit of tile decoding */ | |
| 3696 | tilecode &=0x3fff; | |
| 3697 | if (stv2_current_tilemap.tile_size==1) | |
| 3698 | { /* we're treating 16x16 tiles as 4 8x8's atm */ | |
| 3699 | if (stv_vdp2_vram_dirty_8x8x8[tilecode] == 1) { stv_vdp2_vram_dirty_8x8x8[tilecode] = 0; decodechar(machine->gfx[2], tilecode, stv_vdp2_gfx_decode + gfx_mem_offset); }; | |
| 3700 | if (stv_vdp2_vram_dirty_8x8x8[tilecode+1] == 1) { stv_vdp2_vram_dirty_8x8x8[tilecode+1] = 0; decodechar(machine->gfx[2], tilecode+1, stv_vdp2_gfx_decode + gfx_mem_offset); }; | |
| 3701 | if (stv_vdp2_vram_dirty_8x8x8[tilecode+2] == 1) { stv_vdp2_vram_dirty_8x8x8[tilecode+2] = 0; decodechar(machine->gfx[2], tilecode+2, stv_vdp2_gfx_decode + gfx_mem_offset); }; | |
| 3702 | if (stv_vdp2_vram_dirty_8x8x8[tilecode+3] == 1) { stv_vdp2_vram_dirty_8x8x8[tilecode+3] = 0; decodechar(machine->gfx[2], tilecode+3, stv_vdp2_gfx_decode + gfx_mem_offset); }; | |
| 3703 | } | |
| 3704 | else | |
| 3705 | { | |
| 3706 | if (stv_vdp2_vram_dirty_8x8x8[tilecode] == 1) { stv_vdp2_vram_dirty_8x8x8[tilecode] = 0; decodechar(machine->gfx[2], tilecode, stv_vdp2_gfx_decode + gfx_mem_offset); }; | |
| 3707 | } | |
| 3708 | ||
| 3690 | tilecode &=0x7fff; | |
| 3691 | if (tilecode == 0x7fff) tilecode--; /* prevents crash but unsure what should happen; wrapping? */ | |
| 3692 | tilecodespacing = 2; | |
| 3709 | 3693 | } |
| 3710 | 3694 | else if (stv2_current_tilemap.colour_depth == 0) |
| 3711 | 3695 | { |
| 3712 | 3696 | gfx = 0; |
| 3713 | ||
| 3714 | /* do a bit of tile decoding */ | |
| 3715 | 3697 | tilecode &=0x7fff; |
| 3716 | if (stv2_current_tilemap.tile_size==1) | |
| 3717 | { /* we're treating 16x16 tiles as 4 8x8's atm */ | |
| 3718 | if (stv_vdp2_vram_dirty_8x8x4[tilecode] == 1) { stv_vdp2_vram_dirty_8x8x4[tilecode] = 0; decodechar(machine->gfx[0], tilecode, stv_vdp2_gfx_decode); }; | |
| 3719 | if (stv_vdp2_vram_dirty_8x8x4[tilecode+1] == 1) { stv_vdp2_vram_dirty_8x8x4[tilecode+1] = 0; decodechar(machine->gfx[0], tilecode+1, stv_vdp2_gfx_decode); }; | |
| 3720 | if (stv_vdp2_vram_dirty_8x8x4[tilecode+2] == 1) { stv_vdp2_vram_dirty_8x8x4[tilecode+2] = 0; decodechar(machine->gfx[0], tilecode+2, stv_vdp2_gfx_decode); }; | |
| 3721 | if (stv_vdp2_vram_dirty_8x8x4[tilecode+3] == 1) { stv_vdp2_vram_dirty_8x8x4[tilecode+3] = 0; decodechar(machine->gfx[0], tilecode+3, stv_vdp2_gfx_decode); }; | |
| 3722 | } | |
| 3723 | else | |
| 3724 | { | |
| 3725 | if (stv_vdp2_vram_dirty_8x8x4[tilecode] == 1) { stv_vdp2_vram_dirty_8x8x4[tilecode] = 0; decodechar(machine->gfx[0], tilecode, stv_vdp2_gfx_decode); }; | |
| 3726 | } | |
| 3698 | tilecodespacing = 1; | |
| 3727 | 3699 | } |
| 3728 | 3700 | /* TILES ARE NOW DECODED */ |
| 3729 | 3701 | |
| r4135 | r4136 | |
| 3739 | 3711 | if (stv2_current_tilemap.tile_size==1) |
| 3740 | 3712 | { |
| 3741 | 3713 | /* normal */ |
| 3742 | stv_vdp2_drawgfxzoom(machine,bitmap,machine->gfx[gfx],tilecode+0+(flipyx&1)+(flipyx&2),pal,flipyx&1,flipyx&2,drawxpos >> 16, drawypos >> 16,cliprect,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y); | |
| 3743 | stv_vdp2_drawgfxzoom(machine,bitmap,machine->gfx[gfx],tilecode+1-(flipyx&1)+(flipyx&2),pal,flipyx&1,flipyx&2,(drawxpos+tilesizex) >> 16,drawypos >> 16,cliprect,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y); | |
| 3744 | stv_vdp2_drawgfxzoom(machine,bitmap,machine->gfx[gfx],tilecode+2+(flipyx&1)-(flipyx&2),pal,flipyx&1,flipyx&2,drawxpos >> 16,(drawypos+tilesizey) >> 16,cliprect,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y1(tilesizey)); | |
| 3745 | stv_vdp2_drawgfxzoom(machine,bitmap,machine->gfx[gfx],tilecode+3-(flipyx&1)-(flipyx&2),pal,flipyx&1,flipyx&2,(drawxpos+tilesizex)>> 16,(drawypos+tilesizey) >> 16,cliprect,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y1(tilesizey)); | |
| 3714 | stv_vdp2_drawgfxzoom(machine,bitmap,machine->gfx[gfx],tilecode+(0+(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos >> 16, drawypos >> 16,cliprect,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y,stv2_current_tilemap.alpha); | |
| 3715 | stv_vdp2_drawgfxzoom(machine,bitmap,machine->gfx[gfx],tilecode+(1-(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,(drawxpos+tilesizex) >> 16,drawypos >> 16,cliprect,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y,stv2_current_tilemap.alpha); | |
| 3716 | stv_vdp2_drawgfxzoom(machine,bitmap,machine->gfx[gfx],tilecode+(2+(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos >> 16,(drawypos+tilesizey) >> 16,cliprect,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y1(tilesizey),stv2_current_tilemap.alpha); | |
| 3717 | stv_vdp2_drawgfxzoom(machine,bitmap,machine->gfx[gfx],tilecode+(3-(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,(drawxpos+tilesizex)>> 16,(drawypos+tilesizey) >> 16,cliprect,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y1(tilesizey),stv2_current_tilemap.alpha); | |
| 3746 | 3718 | |
| 3747 | 3719 | } |
| 3748 | 3720 | else |
| 3749 | 3721 | { |
| 3750 | stv_vdp2_drawgfxzoom(machine,bitmap,machine->gfx[gfx],tilecode,pal,flipyx&1,flipyx&2, drawxpos >> 16, drawypos >> 16,cliprect,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X,SCR_TILESIZE_Y); | |
| 3722 | stv_vdp2_drawgfxzoom(machine,bitmap,machine->gfx[gfx],tilecode,pal,flipyx&1,flipyx&2, drawxpos >> 16, drawypos >> 16,cliprect,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X,SCR_TILESIZE_Y,stv2_current_tilemap.alpha); | |
| 3751 | 3723 | } |
| 3752 | 3724 | } |
| 3753 | 3725 | else |
| r4135 | r4136 | |
| 3760 | 3732 | if ( stv2_current_tilemap.colour_depth == 3 ) |
| 3761 | 3733 | { |
| 3762 | 3734 | /* normal */ |
| 3763 | stv_vdp2_drawgfx_rgb555(bitmap,tilecode+(0+(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos, drawypos,cliprect,stv2_current_tilemap.transparency); | |
| 3764 | stv_vdp2_drawgfx_rgb555(bitmap,tilecode+(1-(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos,cliprect,stv2_current_tilemap.transparency); | |
| 3765 | stv_vdp2_drawgfx_rgb555(bitmap,tilecode+(2+(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos,drawypos+8,cliprect,stv2_current_tilemap.transparency); | |
| 3766 | stv_vdp2_drawgfx_rgb555(bitmap,tilecode+(3-(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,cliprect,stv2_current_tilemap.transparency); | |
| 3735 | stv_vdp2_drawgfx_rgb555(bitmap,tilecode+(0+(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos, drawypos,cliprect,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); | |
| 3736 | stv_vdp2_drawgfx_rgb555(bitmap,tilecode+(1-(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos,cliprect,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); | |
| 3737 | stv_vdp2_drawgfx_rgb555(bitmap,tilecode+(2+(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos,drawypos+8,cliprect,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); | |
| 3738 | stv_vdp2_drawgfx_rgb555(bitmap,tilecode+(3-(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,cliprect,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); | |
| 3767 | 3739 | |
| 3768 | 3740 | } |
| 3741 | else if (stv2_current_tilemap.transparency == STV_TRANSPARENCY_ALPHA) | |
| 3742 | { | |
| 3743 | /* alpha */ | |
| 3744 | drawgfx_alpha(bitmap,cliprect,machine->gfx[gfx],tilecode+(0+(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos, drawypos,0,stv2_current_tilemap.alpha); | |
| 3745 | drawgfx_alpha(bitmap,cliprect,machine->gfx[gfx],tilecode+(1-(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos,0,stv2_current_tilemap.alpha); | |
| 3746 | drawgfx_alpha(bitmap,cliprect,machine->gfx[gfx],tilecode+(2+(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos,drawypos+8,0,stv2_current_tilemap.alpha); | |
| 3747 | drawgfx_alpha(bitmap,cliprect,machine->gfx[gfx],tilecode+(3-(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,0,stv2_current_tilemap.alpha); | |
| 3748 | ||
| 3749 | } | |
| 3769 | 3750 | else |
| 3770 | 3751 | { |
| 3771 | 3752 | /* normal */ |
| 3772 | drawgfx(bitmap,machine->gfx[gfx],tilecode+0+(flipyx&1)+(flipyx&2),pal,flipyx&1,flipyx&2,drawxpos, drawypos,cliprect,stv2_current_tilemap.transparency,0); | |
| 3773 | drawgfx(bitmap,machine->gfx[gfx],tilecode+1-(flipyx&1)+(flipyx&2),pal,flipyx&1,flipyx&2,drawxpos+8,drawypos,cliprect,stv2_current_tilemap.transparency,0); | |
| 3774 | drawgfx(bitmap,machine->gfx[gfx],tilecode+2+(flipyx&1)-(flipyx&2),pal,flipyx&1,flipyx&2,drawxpos,drawypos+8,cliprect,stv2_current_tilemap.transparency,0); | |
| 3775 | drawgfx(bitmap,machine->gfx[gfx],tilecode+3-(flipyx&1)-(flipyx&2),pal,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,cliprect,stv2_current_tilemap.transparency,0); | |
| 3753 | drawgfx(bitmap,machine->gfx[gfx],tilecode+(0+(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos, drawypos,cliprect,stv2_current_tilemap.transparency,0); | |
| 3754 | drawgfx(bitmap,machine->gfx[gfx],tilecode+(1-(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos,cliprect,stv2_current_tilemap.transparency,0); | |
| 3755 | drawgfx(bitmap,machine->gfx[gfx],tilecode+(2+(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos,drawypos+8,cliprect,stv2_current_tilemap.transparency,0); | |
| 3756 | drawgfx(bitmap,machine->gfx[gfx],tilecode+(3-(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,cliprect,stv2_current_tilemap.transparency,0); | |
| 3776 | 3757 | |
| 3777 | 3758 | } |
| 3778 | 3759 | } |
| r4135 | r4136 | |
| 3780 | 3761 | { |
| 3781 | 3762 | if ( stv2_current_tilemap.colour_depth == 3 ) |
| 3782 | 3763 | { |
| 3783 | stv_vdp2_drawgfx_rgb555(bitmap,tilecode,flipyx&1,flipyx&2,drawxpos,drawypos,cliprect,stv2_current_tilemap.transparency); | |
| 3764 | stv_vdp2_drawgfx_rgb555(bitmap,tilecode,flipyx&1,flipyx&2,drawxpos,drawypos,cliprect,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); | |
| 3784 | 3765 | } |
| 3785 | 3766 | else |
| 3786 | 3767 | { |
| 3787 | drawgfx(bitmap,machine->gfx[gfx],tilecode,pal,flipyx&1,flipyx&2, drawxpos, drawypos,cliprect,stv2_current_tilemap.transparency,0); | |
| 3768 | if (stv2_current_tilemap.transparency == STV_TRANSPARENCY_ALPHA) | |
| 3769 | drawgfx_alpha(bitmap,cliprect,machine->gfx[gfx],tilecode,pal,flipyx&1,flipyx&2, drawxpos, drawypos,0,stv2_current_tilemap.alpha); | |
| 3770 | else | |
| 3771 | drawgfx(bitmap,machine->gfx[gfx],tilecode,pal,flipyx&1,flipyx&2, drawxpos, drawypos,cliprect,stv2_current_tilemap.transparency,0); | |
| 3788 | 3772 | } |
| 3789 | 3773 | } |
| 3790 | 3774 | drawxpos = olddrawxpos; |
| r4135 | r4136 | |
| 4142 | 4126 | } |
| 4143 | 4127 | else |
| 4144 | 4128 | { |
| 4145 | stv2_current_tilemap.transparency = TRANSPARENCY_ALPHA; | |
| 4129 | stv2_current_tilemap.transparency = STV_TRANSPARENCY_ALPHA; | |
| 4146 | 4130 | } |
| 4147 | 4131 | } |
| 4148 | 4132 | |
| r4135 | r4136 | |
| 4287 | 4271 | case TRANSPARENCY_NONE: |
| 4288 | 4272 | line[hcnt] = pix; |
| 4289 | 4273 | break; |
| 4290 | case TRANSPARENCY_ALPHA: | |
| 4291 | if ( pix != 0x000 ) line[hcnt] = alpha_blend16( line[hcnt], pix ); | |
| 4274 | case STV_TRANSPARENCY_ALPHA: | |
| 4275 | if ( pix != 0x000 ) line[hcnt] = alpha_blend_r16( line[hcnt], pix, stv2_current_tilemap.alpha ); | |
| 4292 | 4276 | break; |
| 4293 | 4277 | case STV_TRANSPARENCY_ADD_BLEND: |
| 4294 | 4278 | if ( pix != 0x0000 ) line[hcnt] = stv_add_blend( line[hcnt], pix ); |
| r4135 | r4136 | |
| 4379 | 4363 | case TRANSPARENCY_NONE: |
| 4380 | 4364 | line[hcnt] = pix; |
| 4381 | 4365 | break; |
| 4382 | case TRANSPARENCY_ALPHA: | |
| 4383 | if ( pix != 0x000 ) line[hcnt] = alpha_blend16( line[hcnt], pix ); | |
| 4366 | case STV_TRANSPARENCY_ALPHA: | |
| 4367 | if ( pix != 0x000 ) line[hcnt] = alpha_blend_r16( line[hcnt], pix, stv2_current_tilemap.alpha ); | |
| 4384 | 4368 | break; |
| 4385 | 4369 | case STV_TRANSPARENCY_ADD_BLEND: |
| 4386 | 4370 | if ( pix != 0x0000 ) line[hcnt] = stv_add_blend( line[hcnt], pix ); |
| r4135 | r4136 | |
| 4415 | 4399 | if ( STV_VDP2_N0CCEN ) |
| 4416 | 4400 | { |
| 4417 | 4401 | stv2_current_tilemap.colour_calculation_enabled = 1; |
| 4418 | | |
| 4402 | | |
| 4419 | 4403 | } |
| 4420 | 4404 | else |
| 4421 | 4405 | { |
| r4135 | r4136 | |
| 4505 | 4489 | if ( STV_VDP2_N1CCEN ) |
| 4506 | 4490 | { |
| 4507 | 4491 | stv2_current_tilemap.colour_calculation_enabled = 1; |
| 4508 | | |
| 4492 | | |
| 4509 | 4493 | } |
| 4510 | 4494 | else |
| 4511 | 4495 | { |
| r4135 | r4136 | |
| 4602 | 4586 | if ( STV_VDP2_N2CCEN ) |
| 4603 | 4587 | { |
| 4604 | 4588 | stv2_current_tilemap.colour_calculation_enabled = 1; |
| 4605 | | |
| 4589 | | |
| 4606 | 4590 | } |
| 4607 | 4591 | else |
| 4608 | 4592 | { |
| r4135 | r4136 | |
| 4702 | 4686 | if ( STV_VDP2_N3CCEN ) |
| 4703 | 4687 | { |
| 4704 | 4688 | stv2_current_tilemap.colour_calculation_enabled = 1; |
| 4705 | | |
| 4689 | | |
| 4706 | 4690 | } |
| 4707 | 4691 | else |
| 4708 | 4692 | { |
| r4135 | r4136 | |
| 4932 | 4916 | stv2_current_tilemap.colour_calculation_enabled = colour_calculation_enabled; |
| 4933 | 4917 | if ( colour_calculation_enabled ) |
| 4934 | 4918 | { |
| 4935 | stv2_current_tilemap.transparency = TRANSPARENCY_ALPHA; | |
| 4919 | stv2_current_tilemap.transparency = STV_TRANSPARENCY_ALPHA; | |
| 4936 | 4920 | } |
| 4937 | 4921 | |
| 4938 | 4922 | mycliprect.min_x = cliprect->min_x; |
| r4135 | r4136 | |
| 4980 | 4964 | if ( STV_VDP2_R0CCEN ) |
| 4981 | 4965 | { |
| 4982 | 4966 | stv2_current_tilemap.colour_calculation_enabled = 1; |
| 4983 | | |
| 4967 | | |
| 4984 | 4968 | } |
| 4985 | 4969 | else |
| 4986 | 4970 | { |
| r4135 | r4136 | |
| 5111 | 5095 | stv_vdp2_vram_decode[offset*4+2] = (data & 0x0000ff00) >> 8; |
| 5112 | 5096 | stv_vdp2_vram_decode[offset*4+3] = (data & 0x000000ff) >> 0; |
| 5113 | 5097 | |
| 5114 | stv_vdp2_vram_dirty_8x8x4[offset/8] = 1; | |
| 5115 | stv_vdp2_vram_dirty_8x8x8[offset/16] = 1; | |
| 5098 | gfx_element_mark_dirty(space->machine->gfx[0], offset/8); | |
| 5099 | gfx_element_mark_dirty(space->machine->gfx[1], offset/8); | |
| 5100 | gfx_element_mark_dirty(space->machine->gfx[2], offset/8); | |
| 5101 | gfx_element_mark_dirty(space->machine->gfx[3], offset/8); | |
| 5116 | 5102 | |
| 5103 | /* 8-bit tiles overlap, so this affects the previous one as well */ | |
| 5104 | if (offset/8 != 0) | |
| 5105 | { | |
| 5106 | gfx_element_mark_dirty(space->machine->gfx[2], offset/8 - 1); | |
| 5107 | gfx_element_mark_dirty(space->machine->gfx[3], offset/8 - 1); | |
| 5108 | } | |
| 5109 | ||
| 5117 | 5110 | if ( stv_rbg_cache_data.watch_vdp2_vram_writes ) |
| 5118 | 5111 | { |
| 5119 | 5112 | if ( stv_rbg_cache_data.watch_vdp2_vram_writes & STV_VDP2_RBG_ROTATION_PARAMETER_A ) |
| r4135 | r4136 | |
| 5272 | 5265 | } |
| 5273 | 5266 | } |
| 5274 | 5267 | |
| 5275 | UINT8 get_hblank(running_machine *machine) | |
| 5268 | static UINT8 get_hblank(running_machine *machine) | |
| 5276 | 5269 | { |
| 5277 | 5270 | static int cur_h; |
| 5278 | 5271 | |
| r4135 | r4136 | |
| 5288 | 5281 | //int get_hblank_duration(running_machine *machine) |
| 5289 | 5282 | //... |
| 5290 | 5283 | |
| 5291 | UINT8 get_vblank(running_machine *machine) | |
| 5284 | UINT8 stv_get_vblank(running_machine *machine) | |
| 5292 | 5285 | { |
| 5293 | 5286 | static int cur_v; |
| 5294 | 5287 | rectangle visarea = *video_screen_get_visible_area(machine->primary_screen); |
| r4135 | r4136 | |
| 5301 | 5294 | } |
| 5302 | 5295 | |
| 5303 | 5296 | /*some vblank lines measurements (according to Charles MacDonald)*/ |
| 5304 | int get_vblank_duration(running_machine *machine) | |
| 5297 | static int get_vblank_duration(running_machine *machine) | |
| 5305 | 5298 | { |
| 5306 | 5299 | if(STV_VDP2_HRES & 4) |
| 5307 | 5300 | { |
| r4135 | r4136 | |
| 5323 | 5316 | return 0; |
| 5324 | 5317 | } |
| 5325 | 5318 | |
| 5326 | UINT8 get_odd_bit(running_machine *machine) | |
| 5319 | static UINT8 get_odd_bit(running_machine *machine) | |
| 5327 | 5320 | { |
| 5328 | 5321 | static int cur_v; |
| 5329 | 5322 | cur_v = video_screen_get_vpos(machine->primary_screen); |
| r4135 | r4136 | |
| 5346 | 5339 | case 0x4/4: |
| 5347 | 5340 | { |
| 5348 | 5341 | /*Screen Status Register*/ |
| 5349 | stv_vblank = get_vblank(space->machine); | |
| 5342 | stv_vblank = stv_get_vblank(space->machine); | |
| 5350 | 5343 | stv_hblank = get_hblank(space->machine); |
| 5351 | 5344 | stv_odd = get_odd_bit(space->machine); |
| 5352 | 5345 | |
| r4135 | r4136 | |
| 5379 | 5372 | stv_vdp2_vram_decode[offset*4+1] = (data & 0x00ff0000) >> 16; |
| 5380 | 5373 | stv_vdp2_vram_decode[offset*4+2] = (data & 0x0000ff00) >> 8; |
| 5381 | 5374 | stv_vdp2_vram_decode[offset*4+3] = (data & 0x000000ff) >> 0; |
| 5382 | ||
| 5383 | stv_vdp2_vram_dirty_8x8x4[offset/8] = 1; | |
| 5384 | stv_vdp2_vram_dirty_8x8x8[offset/16] = 1; | |
| 5385 | 5375 | } |
| 5386 | 5376 | |
| 5387 | 5377 | memset( &stv_rbg_cache_data, 0, sizeof(stv_rbg_cache_data)); |
| r4135 | r4136 | |
| 5397 | 5387 | stv_vdp2_vram = auto_malloc ( 0x100000 ); // actually we only need half of it since we don't emulate extra 4mbit ram cart. |
| 5398 | 5388 | stv_vdp2_cram = auto_malloc ( 0x080000 ); |
| 5399 | 5389 | stv_vdp2_gfx_decode = auto_malloc ( 0x100000 ); |
| 5400 | stv_vdp2_vram_dirty_8x8x4 = auto_malloc ( 0x100000 ); | |
| 5401 | stv_vdp2_vram_dirty_8x8x8 = auto_malloc ( 0x100000 ); | |
| 5402 | 5390 | |
| 5403 | 5391 | memset(stv_vdp2_regs, 0, 0x040000); |
| 5404 | 5392 | memset(stv_vdp2_vram, 0, 0x100000); |
| r4135 | r4136 | |
| 5429 | 5417 | debug.l_en = 0xff; |
| 5430 | 5418 | debug.error = 0xffffffff; |
| 5431 | 5419 | debug.roz = 0; |
| 5420 | gfx_element_set_source(machine->gfx[0], stv_vdp2_gfx_decode); | |
| 5421 | gfx_element_set_source(machine->gfx[1], stv_vdp2_gfx_decode); | |
| 5422 | gfx_element_set_source(machine->gfx[2], stv_vdp2_gfx_decode); | |
| 5423 | gfx_element_set_source(machine->gfx[3], stv_vdp2_gfx_decode); | |
| 5424 | gfx_element_set_source(machine->gfx[4], stv_vdp1_gfx_decode); | |
| 5425 | gfx_element_set_source(machine->gfx[5], stv_vdp1_gfx_decode); | |
| 5426 | gfx_element_set_source(machine->gfx[6], stv_vdp1_gfx_decode); | |
| 5427 | gfx_element_set_source(machine->gfx[7], stv_vdp1_gfx_decode); | |
| 5432 | 5428 | } |
| 5433 | 5429 | |
| 5434 | 5430 | /*TODO: frame_period should be different for every kind of resolution (needs tests on actual boards)*/ |
| r4135 | r4136 | |
| 6295 | 6291 | |
| 6296 | 6292 | for (tilecode = 0;tilecode<0x8000;tilecode++) |
| 6297 | 6293 | { |
| 6298 | | |
| 6294 | gfx_el | |
| 6299 | 6295 | } |
| 6300 | 6296 | |
| 6301 | 6297 | for (tilecode = 0;tilecode<0x2000;tilecode++) |
| 6302 | 6298 | { |
| 6303 | | |
| 6299 | gfx_el | |
| 6304 | 6300 | } |
| 6305 | 6301 | |
| 6306 | 6302 | for (tilecode = 0;tilecode<0x4000;tilecode++) |
| 6307 | 6303 | { |
| 6308 | | |
| 6304 | gfx_el | |
| 6309 | 6305 | } |
| 6310 | 6306 | |
| 6311 | 6307 | for (tilecode = 0;tilecode<0x1000;tilecode++) |
| 6312 | 6308 | { |
| 6313 | | |
| 6309 | gfx_el | |
| 6314 | 6310 | } |
| 6315 | 6311 | |
| 6316 | 6312 | /* vdp 1 ... doesn't have to be tile based */ |
| 6317 | 6313 | |
| 6318 | 6314 | for (tilecode = 0;tilecode<0x8000;tilecode++) |
| 6319 | 6315 | { |
| 6320 | | |
| 6316 | gfx_el | |
| 6321 | 6317 | } |
| 6322 | 6318 | for (tilecode = 0;tilecode<0x2000;tilecode++) |
| 6323 | 6319 | { |
| 6324 | | |
| 6320 | gfx_el | |
| 6325 | 6321 | } |
| 6326 | 6322 | for (tilecode = 0;tilecode<0x4000;tilecode++) |
| 6327 | 6323 | { |
| 6328 | | |
| 6324 | gfx_el | |
| 6329 | 6325 | } |
| 6330 | 6326 | for (tilecode = 0;tilecode<0x1000;tilecode++) |
| 6331 | 6327 | { |
| 6332 | | |
| 6328 | gfx_el | |
| 6333 | 6329 | } |
| 6334 | 6330 | } |
| 6335 | 6331 |
| r4135 | r4136 | |
|---|---|---|
| 127 | 127 | |
| 128 | 128 | // This ignores the alpha values atm. |
| 129 | 129 | static int spc_changed=0, v3_changed=0, palette_updated=0; |
| 130 | int suprnova_alt_enable_background, suprnova_alt_enable_sprites; | |
| 130 | static int suprnova_alt_enable_background; | |
| 131 | int suprnova_alt_enable_sprites; | |
| 131 | 132 | |
| 132 | 133 | WRITE32_HANDLER ( skns_pal_regs_w ) |
| 133 | 134 | { |
| r4135 | r4136 | |
| 991 | 992 | |
| 992 | 993 | VIDEO_UPDATE(skns) |
| 993 | 994 | { |
| 994 | int i, offset; | |
| 995 | ||
| 996 | UINT8 *btiles; | |
| 997 | ||
| 998 | ||
| 999 | 995 | palette_update(screen->machine); |
| 1000 | 996 | |
| 1001 | btiles = memory_region (screen->machine, "gfx3"); | |
| 1002 | ||
| 1003 | // if (!(skns_v3_regs[0x0c/4] & 0x0100)); // if tilemap b is in 8bpp mode | |
| 1004 | { | |
| 1005 | if (skns_v3t_somedirty) | |
| 1006 | { | |
| 1007 | skns_v3t_somedirty = 0; | |
| 1008 | ||
| 1009 | /* check if & where that tile is used in the tilemap */ | |
| 1010 | for (offset=0;offset<0x4000/4;offset++) | |
| 1011 | { | |
| 1012 | int code = ((skns_tilemapB_ram[offset] & 0x001fffff) >> 0 ); | |
| 1013 | if (skns_v3t_dirty[code&0x3ff]) | |
| 1014 | tilemap_mark_tile_dirty(skns_tilemap_B,offset); | |
| 1015 | } | |
| 1016 | ||
| 1017 | for (i = 0; i < 0x0400; i++) | |
| 1018 | { | |
| 1019 | if (skns_v3t_dirty[i] == 1) | |
| 1020 | { | |
| 1021 | decodechar(screen->machine->gfx[1], i, (UINT8*)btiles); | |
| 1022 | ||
| 1023 | skns_v3t_dirty[i] = 0; | |
| 1024 | } | |
| 1025 | } | |
| 1026 | } | |
| 1027 | } | |
| 1028 | ||
| 1029 | // if (skns_v3_regs[0x0c/4] & 0x0100); // if tilemap b is in 4bpp mode | |
| 1030 | { | |
| 1031 | if (skns_v3t_4bpp_somedirty) | |
| 1032 | { | |
| 1033 | skns_v3t_4bpp_somedirty = 0; | |
| 1034 | ||
| 1035 | /* check if & where that tile is used in the tilemap */ | |
| 1036 | for (offset=0;offset<0x4000/4;offset++) | |
| 1037 | { | |
| 1038 | int code = ((skns_tilemapB_ram[offset] & 0x001fffff) >> 0 ); | |
| 1039 | if (skns_v3t_4bppdirty[code&0x7ff]) | |
| 1040 | tilemap_mark_tile_dirty(skns_tilemap_B,offset); | |
| 1041 | } | |
| 1042 | ||
| 1043 | for (i = 0; i < 0x0800; i++) | |
| 1044 | { | |
| 1045 | if (skns_v3t_4bppdirty[i] == 1) | |
| 1046 | { | |
| 1047 | decodechar(screen->machine->gfx[3], i, (UINT8*)btiles); | |
| 1048 | ||
| 1049 | skns_v3t_4bppdirty[i] = 0; | |
| 1050 | } | |
| 1051 | } | |
| 1052 | } | |
| 1053 | } | |
| 1054 | ||
| 1055 | 997 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); |
| 1056 | 998 | bitmap_fill(tilemap_bitmap_lower, NULL, 0); |
| 1057 | 999 | bitmap_fill(tilemap_bitmapflags_lower, NULL, 0); |
| r4135 | r4136 | |
|---|---|---|
| 227 | 227 | |
| 228 | 228 | /* draw scanlines from the VRAM directly */ |
| 229 | 229 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) |
| 230 | draw_scanline8(bitmap, 0, y, 256, &local_videoram[(y - BALSENTE_VBEND) * 256], pens | |
| 230 | draw_scanline8(bitmap, 0, y, 256, &local_videoram[(y - BALSENTE_VBEND) * 256], pens | |
| 231 | 231 | |
| 232 | 232 | /* draw the sprite images */ |
| 233 | 233 | for (i = 0; i < 40; i++) |
| r4135 | r4136 | |
|---|---|---|
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | 1477 | /* draw from the buffer */ |
| 1478 | draw_scanline16(bitmap, cliprect->min_x, y, cliprect->max_x - cliprect->min_x + 1, &scanline[cliprect->min_x], NULL | |
| 1478 | draw_scanline16(bitmap, cliprect->min_x, y, cliprect->max_x - cliprect->min_x + 1, &scanline[cliprect->min_x], NULL | |
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | 1481 | /* otherwise, draw directly from VRAM */ |
| 1482 | 1482 | else |
| 1483 | draw_scanline16(bitmap, cliprect->min_x, y, cliprect->max_x - cliprect->min_x + 1, &src1[cliprect->min_x], NULL | |
| 1483 | draw_scanline16(bitmap, cliprect->min_x, y, cliprect->max_x - cliprect->min_x + 1, &src1[cliprect->min_x], NULL | |
| 1484 | 1484 | } |
| 1485 | 1485 | return 0; |
| 1486 | 1486 | } |
| r4135 | r4136 | |
|---|---|---|
| 284 | 284 | for (offs = 0x400 - 4; offs >= 0; offs -=4) |
| 285 | 285 | { |
| 286 | 286 | int x,y,sprite,colour,multi,fx,fy,inc,flash,mult,pri=0; |
| 287 | int | |
| 287 | int | |
| 288 | 288 | |
| 289 | 289 | sprite = spritedata[offs+1] & 0xffff; |
| 290 | 290 | |
| r4135 | r4136 | |
| 292 | 292 | flash=y&0x1000; |
| 293 | 293 | if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; |
| 294 | 294 | |
| 295 | trans=TRANSPARENCY_PEN; | |
| 296 | 295 | x = spritedata[offs+2]; |
| 297 | 296 | colour = (x >>9) & colourmask; |
| 298 | 297 | |
| r4135 | r4136 | |
| 332 | 331 | colour, |
| 333 | 332 | fx,fy, |
| 334 | 333 | x,y + mult * multi, |
| 335 | cliprect, | |
| 334 | cliprect, | |
| 336 | 335 | |
| 337 | 336 | multi--; |
| 338 | 337 | } |
| r4135 | r4136 | |
| 348 | 347 | UINT32 code,UINT32 priority,int flipx,int flipy,int sx,int sy, |
| 349 | 348 | const rectangle *clip) |
| 350 | 349 | { |
| 350 | const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements); | |
| 351 | 351 | int ox,oy,cx,cy; |
| 352 | 352 | int x_index,y_index,x,y; |
| 353 | 353 | |
| 354 | int source_base = (code % gfx->total_elements) * gfx->height; | |
| 355 | ||
| 356 | 354 | /* check bounds */ |
| 357 | 355 | ox = sx; |
| 358 | 356 | oy = sy; |
| r4135 | r4136 | |
| 371 | 369 | |
| 372 | 370 | for( y=0; y<16-cy; y++ ) |
| 373 | 371 | { |
| 374 | UINT8 *source = | |
| 372 | const UINT8 *source = | |
| 375 | 373 | UINT16 *destb = BITMAP_ADDR16(dest, sy, 0); |
| 376 | 374 | |
| 377 | 375 | if (flipx) { source+=15-(sx-ox); x_index=-1; } else { x_index=1; source+=(sx-ox); } |
| r4135 | r4136 | |
| 458 | 456 | INLINE void dragngun_drawgfxzoom( running_machine *machine, |
| 459 | 457 | bitmap_t *dest_bmp,const gfx_element *gfx, |
| 460 | 458 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 461 | const rectangle *clip,int transparency,int transparent_color, | |
| 462 | int scalex, int scaley,bitmap_t *pri_buffer,UINT32 pri_mask, int sprite_screen_width, int sprite_screen_height ) | |
| 459 | const rectangle *clip,int transparent_color, | |
| 460 | int scalex, int scaley,bitmap_t *pri_buffer,UINT32 pri_mask, int sprite_screen_width, int sprite_screen_height, UINT8 alpha ) | |
| 463 | 461 | { |
| 464 | 462 | rectangle myclip; |
| 465 | 463 | |
| r4135 | r4136 | |
| 492 | 490 | if( gfx ) |
| 493 | 491 | { |
| 494 | 492 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 495 | | |
| 493 | const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements) | |
| 496 | 494 | |
| 497 | 495 | if (sprite_screen_width && sprite_screen_height) |
| 498 | 496 | { |
| r4135 | r4136 | |
| 558 | 556 | int y; |
| 559 | 557 | |
| 560 | 558 | /* case 1: TRANSPARENCY_PEN */ |
| 561 | if ( | |
| 559 | if ( | |
| 562 | 560 | { |
| 563 | 561 | if (pri_buffer) |
| 564 | 562 | { |
| 565 | 563 | for( y=sy; y<ey; y++ ) |
| 566 | 564 | { |
| 567 | UINT8 *source = | |
| 565 | const UINT8 *source = | |
| 568 | 566 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 569 | 567 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); |
| 570 | 568 | |
| r4135 | r4136 | |
| 588 | 586 | { |
| 589 | 587 | for( y=sy; y<ey; y++ ) |
| 590 | 588 | { |
| 591 | UINT8 *source = | |
| 589 | const UINT8 *source = | |
| 592 | 590 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 593 | 591 | |
| 594 | 592 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 604 | 602 | } |
| 605 | 603 | } |
| 606 | 604 | |
| 607 | /* case 6: TRANSPARENCY_ALPHA */ | |
| 608 | if (transparency == TRANSPARENCY_ALPHA) | |
| 605 | /* alpha-blended */ | |
| 606 | else | |
| 609 | 607 | { |
| 610 | 608 | if (pri_buffer) |
| 611 | 609 | { |
| 612 | 610 | for( y=sy; y<ey; y++ ) |
| 613 | 611 | { |
| 614 | UINT8 *source = | |
| 612 | const UINT8 *source = | |
| 615 | 613 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 616 | 614 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); |
| 617 | 615 | |
| r4135 | r4136 | |
| 622 | 620 | if( c != transparent_color ) |
| 623 | 621 | { |
| 624 | 622 | if (((1 << pri[x]) & pri_mask) == 0) |
| 625 | dest[x] = alpha_blend32(dest[x], pal[c]); | |
| 623 | dest[x] = alpha_blend_r32(dest[x], pal[c], alpha); | |
| 626 | 624 | pri[x] = 31; |
| 627 | 625 | } |
| 628 | 626 | x_index += dx; |
| r4135 | r4136 | |
| 635 | 633 | { |
| 636 | 634 | for( y=sy; y<ey; y++ ) |
| 637 | 635 | { |
| 638 | UINT8 *source = | |
| 636 | const UINT8 *source = | |
| 639 | 637 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 640 | 638 | |
| 641 | 639 | int x, x_index = x_index_base; |
| 642 | 640 | for( x=sx; x<ex; x++ ) |
| 643 | 641 | { |
| 644 | 642 | int c = source[x_index>>16]; |
| 645 | if( c != transparent_color ) dest[x] = alpha_blend32(dest[x], pal[c]); | |
| 643 | if( c != transparent_color ) dest[x] = alpha_blend_r32(dest[x], pal[c], alpha); | |
| 646 | 644 | x_index += dx; |
| 647 | 645 | } |
| 648 | 646 | |
| r4135 | r4136 | |
| 713 | 711 | |
| 714 | 712 | for (offs = 0;offs < 0x800;offs += 8) |
| 715 | 713 | { |
| 716 | int sx,sy,colour,fx,fy,w,h,x,y,bx,by, | |
| 714 | int sx,sy,colour,fx,fy,w,h,x,y,bx,by, | |
| 717 | 715 | int zoomx,zoomy; |
| 718 | 716 | int xpos,ypos; |
| 719 | 717 | |
| r4135 | r4136 | |
| 743 | 741 | colour = spritedata[offs+6]&0x1f; |
| 744 | 742 | |
| 745 | 743 | if (spritedata[offs+6]&0x80) |
| 746 | | |
| 744 | | |
| 747 | 745 | else |
| 748 | | |
| 746 | | |
| 749 | 747 | |
| 750 | 748 | fx = spritedata[offs+4]&0x8000; |
| 751 | 749 | fy = spritedata[offs+5]&0x8000; |
| r4135 | r4136 | |
| 808 | 806 | colour, |
| 809 | 807 | fx,fy, |
| 810 | 808 | xpos>>16,ypos>>16, |
| 811 | cliprect,trans,15,zoomx,zoomy,NULL,0, | |
| 812 | ((xpos+(zoomx<<4))>>16) - (xpos>>16), ((ypos+(zoomy<<4))>>16) - (ypos>>16) ); | |
| 809 | cliprect,15,zoomx,zoomy,NULL,0, | |
| 810 | ((xpos+(zoomx<<4))>>16) - (xpos>>16), ((ypos+(zoomy<<4))>>16) - (ypos>>16), alpha ); | |
| 813 | 811 | else |
| 814 | drawgfx(bitmap,machine->gfx[bank], | |
| 812 | drawgfx_alpha(bitmap,cliprect,machine->gfx[bank], | |
| 815 | 813 | sprite, |
| 816 | 814 | colour, |
| 817 | 815 | fx,fy, |
| 818 | 816 | xpos>>16,ypos>>16, |
| 819 | | |
| 817 | 15,al | |
| 820 | 818 | |
| 821 | 819 | if (fx) |
| 822 | 820 | xpos-=zoomx<<4; |
| r4135 | r4136 | |
| 1006 | 1004 | |
| 1007 | 1005 | deco32_pf2_colourbank=deco32_pf4_colourbank=0; |
| 1008 | 1006 | |
| 1009 | alpha_set_level(0x80); | |
| 1010 | 1007 | state_save_register_global(machine, dragngun_sprite_ctrl); |
| 1011 | 1008 | has_ace_ram=0; |
| 1012 | 1009 | } |
| r4135 | r4136 | |
| 1030 | 1027 | |
| 1031 | 1028 | deco32_pf2_colourbank=deco32_pf4_colourbank=0; |
| 1032 | 1029 | |
| 1033 | alpha_set_level(0x80); | |
| 1034 | 1030 | state_save_register_global(machine, dragngun_sprite_ctrl); |
| 1035 | 1031 | has_ace_ram=0; |
| 1036 | 1032 | } |
| r4135 | r4136 | |
| 1061 | 1057 | deco32_pf2_colourbank=16; |
| 1062 | 1058 | deco32_pf4_colourbank=16; |
| 1063 | 1059 | state_save_register_global(machine, deco32_pri); |
| 1064 | alpha_set_level(0x80); | |
| 1065 | 1060 | has_ace_ram=1; |
| 1066 | 1061 | } |
| 1067 | 1062 | |
| r4135 | r4136 | |
| 1483 | 1478 | Pri 2 - |
| 1484 | 1479 | Pri 3 - |
| 1485 | 1480 | */ |
| 1486 | alpha_set_level(0x80); | |
| 1487 | 1481 | |
| 1488 | 1482 | /* Alpha values are tied to ACE ram... */ |
| 1489 | 1483 | //int alpha=((deco32_ace_ram[0x0 + (((priColAlphaPal1&0xf0)>>4)/2)]) * 8)-1; |
| 1490 | 1484 | //if (alpha<0) |
| 1491 | 1485 | // alpha=0; |
| 1492 | //alpha_set_level(255-alpha); | |
| 1493 | 1486 | |
| 1494 | 1487 | /* I don't really understand how object ACE ram is really hooked up, |
| 1495 | 1488 | the only obvious place in Night Slashers is the stagecoach in level 2 */ |
| r4135 | r4136 | |
| 1497 | 1490 | if (pri1==0 && (((priColAlphaPal0&0xff)==0 || ((pri0&0x3)!=0 && (pri0&0x3)!=1 && (pri0&0x3)!=2)))) |
| 1498 | 1491 | { |
| 1499 | 1492 | if ((deco32_pri&1)==0 || ((deco32_pri&1)==1 && tilemapPri[x]<4) || ((deco32_pri&1)==1 && mixAlphaTilemap)) |
| 1500 | destLine[x]=alpha_blend32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)]); | |
| 1493 | destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)], 0x80); | |
| 1501 | 1494 | } |
| 1502 | 1495 | else if (pri1==1 && ((priColAlphaPal0&0xff)==0 || ((pri0&0x3)!=0 && (pri0&0x3)!=1 && (pri0&0x3)!=2))) |
| 1503 | destLine[x]=alpha_blend32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)]); | |
| 1496 | destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)], 0x80); | |
| 1504 | 1497 | else if (pri1==2)// TOdo |
| 1505 | destLine[x]=alpha_blend32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)]); | |
| 1498 | destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)], 0x80); | |
| 1506 | 1499 | else if (pri1==3)// TOdo |
| 1507 | destLine[x]=alpha_blend32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)]); | |
| 1500 | destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)], 0x80); | |
| 1508 | 1501 | } |
| 1509 | 1502 | else |
| 1510 | 1503 | { |
| r4135 | r4136 | |
| 1538 | 1531 | int alpha=((deco32_ace_ram[0x17 + (((p&0xf0)>>4)/2)]) * 8)-1; |
| 1539 | 1532 | if (alpha<0) |
| 1540 | 1533 | alpha=0; |
| 1541 | alpha_set_level(255-alpha); | |
| 1542 | 1534 | |
| 1543 | destLine[x]=alpha_blend32(destLine[x], pal2[p]); | |
| 1535 | destLine[x]=alpha_blend_r32(destLine[x], pal2[p], 255-alpha); | |
| 1544 | 1536 | } |
| 1545 | 1537 | } |
| 1546 | 1538 | } |
| r4135 | r4136 | |
| 1594 | 1586 | bitmap_fill(sprite0_mix_bitmap,cliprect,0); |
| 1595 | 1587 | bitmap_fill(sprite1_mix_bitmap,cliprect,0); |
| 1596 | 1588 | bitmap_fill(priority_bitmap,cliprect,0); |
| 1597 | bitmap_fill(tilemap_alpha_bitmap,cliprect,0); | |
| 1598 | 1589 | if ((deco32_pf34_control[5]&0x8000)==0) |
| 1599 | 1590 | bitmap_fill(bitmap,cliprect,screen->machine->pens[0x200]); |
| 1600 | 1591 | |
| r4135 | r4136 | |
| 1603 | 1594 | nslasher_draw_sprites(screen->machine,sprite1_mix_bitmap,cliprect,buffered_spriteram32_2,4); |
| 1604 | 1595 | |
| 1605 | 1596 | /* Render alpha-blended tilemap to seperate buffer for proper mixing */ |
| 1606 | if (alphaTilemap) | |
| 1607 | bitmap_fill(tilemap_alpha_bitmap,cliprect,0); | |
| 1597 | bitmap_fill(tilemap_alpha_bitmap,cliprect,0); | |
| 1608 | 1598 | |
| 1609 | 1599 | /* Draw playfields & sprites */ |
| 1610 | 1600 | if (deco32_pri&2) |
| r4135 | r4136 | |
|---|---|---|
| 283 | 283 | int code = (codeflip & 0x3f) + (change >> 2); |
| 284 | 284 | int yflip = (codeflip & 0x80) ? 0x0f : 0x00; |
| 285 | 285 | int xflip = (codeflip & 0x40) ? 0x0f : 0x00; |
| 286 | const UINT8 *src = gfx | |
| 286 | const UINT8 *src = gfx_element_get_data( | |
| 287 | 287 | |
| 288 | 288 | /* the third byte is: color in bits 0-2 */ |
| 289 | 289 | int color = (state->spriteram[0x42 + (dataoffs & ~0x20)] & 0x07) << 2; |
| r4135 | r4136 | |
| 327 | 327 | int dy = sy + ~y; |
| 328 | 328 | int color = (state->spriteram[0x01 + dataoffs] & 0x07) << 2; |
| 329 | 329 | int code = state->videoram[hprime | ((dy & 0xf8) << 2)] + change; |
| 330 | const UINT8 *src = gfx | |
| 330 | const UINT8 *src = gfx_element_get_data( | |
| 331 | 331 | int x; |
| 332 | 332 | |
| 333 | 333 | /* draw 8 pixels */ |
| r4135 | r4136 | |
|---|---|---|
| 3 | 3 | static tilemap *bg_tilemap, *tx_tilemap; |
| 4 | 4 | UINT16 *goodejan_bgvram,*goodejan_txvram; |
| 5 | 5 | static UINT16 goodejan_layer_en; |
| 6 | static UINT16 goodejan_gfx_bank; | |
| 6 | 7 | |
| 7 | 8 | WRITE16_HANDLER( goodejan_bgvram_w ) |
| 8 | 9 | { |
| r4135 | r4136 | |
| 23 | 24 | goodejan_layer_en = data; |
| 24 | 25 | } |
| 25 | 26 | |
| 27 | /*Not from the Seibu CRTC,it's an external ROM banking.*/ | |
| 28 | WRITE16_HANDLER( goodejan_gfxbank_w ) | |
| 29 | { | |
| 30 | goodejan_gfx_bank = (data & 0x100)>>8; | |
| 31 | tilemap_mark_all_tiles_dirty(bg_tilemap); | |
| 32 | } | |
| 33 | ||
| 26 | 34 | static TILE_GET_INFO( goodejan_bg_tile_info ) |
| 27 | 35 | { |
| 28 | 36 | int tile = goodejan_bgvram[tile_index]&0x0fff; |
| 29 | 37 | int color = (goodejan_bgvram[tile_index]&0xf000)>>12; |
| 30 | 38 | |
| 31 | // WRONG! | |
| 32 | tile|= (goodejan_bgvram[tile_index]&0x8000)>>3; | |
| 39 | tile|= goodejan_gfx_bank<<12; | |
| 33 | 40 | // if ((goodejan_bgvram[tile_index]&0x8000)==0x0000) tile+=0x1000; |
| 34 | 41 | |
| 35 | 42 | SET_TILE_INFO(1, tile, color, 0); |
| r4135 | r4136 | |
|---|---|---|
| 361 | 361 | int sx = xpos + 8 * (flipx ? (sizex - 1 - col) : col); |
| 362 | 362 | int sy = ypos + 8 * (flipy ? (sizey - 1 - row) : row); |
| 363 | 363 | |
| 364 | pdrawgfx(bitmap, gfx, | |
| 364 | pdrawgfx_transpen_raw(bitmap, cliprect, gfx, | |
| 365 | 365 | number + layout[row][col], |
| 366 | 366 | gfx->color_base + color * gfx->color_granularity, |
| 367 | 367 | flipx, flipy, |
| 368 | 368 | sx, sy, |
| 369 | cliprect, TRANSPARENCY_PEN_RAW, 0, | |
| 370 | priority_mask); | |
| 369 | priority_bitmap, priority_mask, 0); | |
| 371 | 370 | } |
| 372 | 371 | } |
| 373 | 372 | } |
| r4135 | r4136 | |
| 462 | 461 | int sx = xpos + 8 * (flipx ? (sizex - 1 - col) : col); |
| 463 | 462 | int sy = ypos + 8 * (flipy ? (sizey - 1 - row) : row); |
| 464 | 463 | |
| 465 | pdrawgfx(bitmap_sp, gfx, | |
| 464 | pdrawgfx_transpen_raw(bitmap_sp, cliprect, gfx, | |
| 466 | 465 | number + layout[row][col], |
| 467 | 466 | gfx->color_base + color * gfx->color_granularity, |
| 468 | 467 | flipx, flipy, |
| 469 | 468 | sx, sy, |
| 470 | cliprect, TRANSPARENCY_PEN_RAW, 0, | |
| 471 | priority_mask); | |
| 469 | priority_bitmap, priority_mask, 0); | |
| 472 | 470 | } |
| 473 | 471 | } |
| 474 | 472 | } |
| r4135 | r4136 | |
| 483 | 481 | int sx = xpos + 8 * (flipx ? (sizex - 1 - col) : col); |
| 484 | 482 | int sy = ypos + 8 * (flipy ? (sizey - 1 - row) : row); |
| 485 | 483 | |
| 486 | pdrawgfx(bitmap, gfx, | |
| 484 | pdrawgfx_transpen_raw(bitmap, cliprect, gfx, | |
| 487 | 485 | number + layout[row][col], |
| 488 | 486 | gfx->color_base + color * gfx->color_granularity, |
| 489 | 487 | flipx, flipy, |
| 490 | 488 | sx, sy, |
| 491 | cliprect, TRANSPARENCY_PEN_RAW, 0, | |
| 492 | priority_mask); | |
| 489 | priority_bitmap, priority_mask, 0); | |
| 493 | 490 | } |
| 494 | 491 | } |
| 495 | 492 | } |
| r4135 | r4136 | |
| 541 | 538 | else |
| 542 | 539 | priority_mask = 0; |
| 543 | 540 | |
| 544 | pdrawgfx(bitmap,machine->gfx[3], | |
| 541 | pdrawgfx_transpen_raw(bitmap,cliprect,machine->gfx[3], | |
| 545 | 542 | code, |
| 546 | 543 | machine->gfx[3]->color_base + color * machine->gfx[3]->color_granularity, |
| 547 | 544 | flipx,flipy,x,y, |
| 548 | cliprect, | |
| 549 | TRANSPARENCY_PEN_RAW,15, | |
| 550 | priority_mask); | |
| 545 | priority_bitmap, priority_mask,15); | |
| 551 | 546 | |
| 552 | 547 | /* wrap x*/ |
| 553 | pdrawgfx(bitmap,machine->gfx[3], | |
| 548 | pdrawgfx_transpen_raw(bitmap,cliprect,machine->gfx[3], | |
| 554 | 549 | code, |
| 555 | 550 | machine->gfx[3]->color_base + color * machine->gfx[3]->color_granularity, |
| 556 | 551 | flipx,flipy,x-512,y, |
| 557 | cliprect, | |
| 558 | TRANSPARENCY_PEN_RAW,15, | |
| 559 | priority_mask); | |
| 552 | priority_bitmap, priority_mask,15); | |
| 560 | 553 | |
| 561 | 554 | } |
| 562 | 555 | } |
| r4135 | r4136 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | // defined in drivers/nwk-tr.c |
| 21 | 21 | int K001604_vh_start(running_machine *machine, int chip); |
| 22 | void K001604_tile_update(running_machine *machine, int chip); | |
| 23 | 22 | void K001604_draw_front_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect); |
| 24 | 23 | void K001604_draw_back_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect); |
| 25 | 24 | |
| r4135 | r4136 | |
| 989 | 988 | |
| 990 | 989 | VIDEO_UPDATE( gticlub ) |
| 991 | 990 | { |
| 992 | K001604_tile_update(screen->machine, 0); | |
| 993 | 991 | K001604_draw_back_layer(0, bitmap, cliprect); |
| 994 | 992 | |
| 995 | 993 | K001005_draw(bitmap, cliprect); |
| r4135 | r4136 | |
|---|---|---|
| 19 | 19 | //UINT16 *namcona1_pixmap; |
| 20 | 20 | |
| 21 | 21 | /* private variables */ |
| 22 | static char *dirtychar; | |
| 23 | static char dirtygfx; | |
| 24 | 22 | static UINT16 *shaperam; |
| 25 | 23 | static UINT16 *cgram; |
| 26 | 24 | static tilemap *roz_tilemap; |
| 27 | 25 | static int roz_palette; |
| 28 | static int roz_dirty; | |
| 29 | 26 | static tilemap *bg_tilemap[NAMCONA1_NUM_TILEMAPS]; |
| 30 | 27 | static int tilemap_palette_bank[NAMCONA1_NUM_TILEMAPS]; |
| 31 | 28 | static int palette_is_dirty; |
| r4135 | r4136 | |
| 139 | 136 | } |
| 140 | 137 | else if( offset<0xa000/2 ) |
| 141 | 138 | { |
| 142 | r | |
| 139 | tilemap_mark | |
| 143 | 140 | } |
| 144 | 141 | } /* namcona1_videoram_w */ |
| 145 | 142 | |
| r4135 | r4136 | |
| 262 | 259 | old_word = shaperam[offset]; |
| 263 | 260 | COMBINE_DATA( &shaperam[offset] ); |
| 264 | 261 | if( shaperam[offset]!=old_word ) |
| 265 | { | |
| 266 | dirtygfx = 1; | |
| 267 | dirtychar[offset/4] = 1; | |
| 268 | } | |
| 262 | gfx_element_mark_dirty(space->machine->gfx[2], offset/4); | |
| 269 | 263 | } |
| 270 | 264 | } |
| 271 | 265 | else if( type == 0x02 ) |
| r4135 | r4136 | |
| 274 | 268 | COMBINE_DATA( &cgram[offset] ); |
| 275 | 269 | if( cgram[offset]!=old_word ) |
| 276 | 270 | { |
| 277 | dirtygfx = 1; | |
| 278 | dirtychar[offset/0x20] = 1; | |
| 271 | gfx_element_mark_dirty(space->machine->gfx[0], offset/0x20); | |
| 272 | gfx_element_mark_dirty(space->machine->gfx[1], offset/0x20); | |
| 279 | 273 | } |
| 280 | 274 | } |
| 281 | 275 | } /* namcona1_gfxram_w */ |
| 282 | 276 | |
| 283 | 277 | static void UpdateGfx(running_machine *machine) |
| 284 | 278 | { |
| 285 | const UINT16 *pSource = videoram16; | |
| 286 | int page; | |
| 287 | int i; | |
| 288 | ||
| 289 | if( dirtygfx ) | |
| 290 | { | |
| 291 | for( page = 0; page<NAMCONA1_NUM_TILEMAPS; page++ ) | |
| 292 | { | |
| 293 | for( i=0; i<0x1000; i++ ) | |
| 294 | { | |
| 295 | if( dirtychar[*pSource++ & 0xfff] ) | |
| 296 | { | |
| 297 | tilemap_mark_tile_dirty( bg_tilemap[page], i ); | |
| 298 | } | |
| 299 | } | |
| 300 | } | |
| 301 | ||
| 302 | for( i=0; i<0x1000; i++ ) | |
| 303 | { | |
| 304 | if( dirtychar[*pSource++ & 0xfff] ) | |
| 305 | { | |
| 306 | roz_dirty = 1; | |
| 307 | break; | |
| 308 | } | |
| 309 | } | |
| 310 | ||
| 311 | for( i = 0;i <0x1000; i++ ) | |
| 312 | { | |
| 313 | if( dirtychar[i] ) | |
| 314 | { | |
| 315 | dirtychar[i] = 0; | |
| 316 | decodechar(machine->gfx[0],i,(UINT8 *)cgram); | |
| 317 | decodechar(machine->gfx[1],i,(UINT8 *)cgram); | |
| 318 | decodechar(machine->gfx[2],i,(UINT8 *)shaperam); | |
| 319 | } | |
| 320 | } | |
| 321 | dirtygfx = 0; | |
| 322 | } | |
| 323 | 279 | } /* UpdateGfx */ |
| 324 | 280 | |
| 325 | 281 | VIDEO_START( namcona1 ) |
| 326 | 282 | { |
| 327 | 283 | static const tile_get_info_func get_info[4] = { tilemap_get_info0, tilemap_get_info1, tilemap_get_info2, tilemap_get_info3 }; |
| 328 | 284 | int i; |
| 329 | gfx_element *gfx0,*gfx1,*gfx2; | |
| 330 | 285 | |
| 331 | 286 | roz_tilemap = tilemap_create( machine, roz_get_info, tilemap_scan_rows, 8,8,64,64 ); |
| 332 | 287 | roz_palette = -1; |
| r4135 | r4136 | |
| 339 | 294 | |
| 340 | 295 | shaperam = auto_malloc( 0x2000*4 ); |
| 341 | 296 | cgram = auto_malloc( 0x1000*0x40 ); |
| 342 | dirtychar = auto_malloc( 0x1000 ); | |
| 343 | 297 | |
| 344 | gfx0 = allocgfx( machine, &cg_layout_8bpp ); | |
| 345 | gfx0->total_colors = machine->config->total_colors/256; | |
| 346 | machine->gfx[0] = gfx0; | |
| 298 | machine->gfx[0] = gfx_element_alloc( machine, &cg_layout_8bpp, (UINT8 *)cgram, machine->config->total_colors/256, 0 ); | |
| 299 | machine->gfx[1] = gfx_element_alloc( machine, &cg_layout_4bpp, (UINT8 *)cgram, machine->config->total_colors/16, 0 ); | |
| 300 | machine->gfx[2] = gfx_element_alloc( machine, &shape_layout, (UINT8 *)shaperam, machine->config->total_colors/2, 0 ); | |
| 347 | 301 | |
| 348 | gfx1 = allocgfx( machine, &cg_layout_4bpp ); | |
| 349 | gfx1->total_colors = machine->config->total_colors/16; | |
| 350 | machine->gfx[1] = gfx1; | |
| 351 | ||
| 352 | gfx2 = allocgfx( machine, &shape_layout ); | |
| 353 | gfx2->total_colors = machine->config->total_colors/2; | |
| 354 | machine->gfx[2] = gfx2; | |
| 355 | 302 | } /* namcona1_vh_start */ |
| 356 | 303 | |
| 357 | 304 | /*************************************************************************/ |
| r4135 | r4136 | |
| 372 | 319 | const gfx_element *mask = machine->gfx[2]; |
| 373 | 320 | |
| 374 | 321 | int pal_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors); |
| 375 | UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo; | |
| 376 | UINT8 *mask_base = mask->gfxdata + (code % mask->total_elements) * mask->char_modulo; | |
| 322 | const UINT8 *source_base = gfx_element_get_data(gfx, (code % gfx->total_elements)); | |
| 323 | const UINT8 *mask_base = gfx_element_get_data(mask, (code % mask->total_elements)); | |
| 377 | 324 | |
| 378 | 325 | int sprite_screen_height = ((1<<16)*gfx->height+0x8000)>>16; |
| 379 | 326 | int sprite_screen_width = ((1<<16)*gfx->width+0x8000)>>16; |
| r4135 | r4136 | |
| 443 | 390 | |
| 444 | 391 | for( y=sy; y<ey; y++ ) |
| 445 | 392 | { |
| 446 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 447 | UINT8 *mask_addr = mask_base + (y_index>>16) * mask->line_modulo; | |
| 393 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 394 | const UINT8 *mask_addr = mask_base + (y_index>>16) * mask->line_modulo; | |
| 448 | 395 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 449 | 396 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0); |
| 450 | 397 | |
| r4135 | r4136 | |
| 714 | 661 | int color = namcona1_vreg[0xba/2]&0xf; |
| 715 | 662 | if( color != roz_palette ) |
| 716 | 663 | { |
| 717 | r | |
| 664 | tilemap_mark | |
| 718 | 665 | roz_palette = color; |
| 719 | 666 | } |
| 720 | 667 | } |
| 721 | 668 | |
| 722 | if( roz_dirty ) | |
| 723 | { | |
| 724 | tilemap_mark_all_tiles_dirty( roz_tilemap ); | |
| 725 | roz_dirty = 0; | |
| 726 | } | |
| 727 | ||
| 728 | 669 | bitmap_fill( priority_bitmap,cliprect ,0); |
| 729 | 670 | |
| 730 | 671 | bitmap_fill( bitmap, cliprect , 0xff); /* background color? */ |
| r4135 | r4136 | |
|---|---|---|
| 145 | 145 | tilemap_set_transparent_pen(fg_tilemap,0); |
| 146 | 146 | tilemap_set_scrolldy(fg_tilemap,8,8); |
| 147 | 147 | tilemap_set_scrolldy(bg_tilemap,8,8); |
| 148 | ||
| 149 | state_save_register_global(machine, scroll_x); | |
| 150 | state_save_register_global(machine, priority); | |
| 148 | 151 | } |
| 149 | 152 | |
| 150 | 153 | WRITE8_HANDLER( appoooh_scroll_w ) |
| r4135 | r4136 | |
|---|---|---|
| 143 | 143 | { |
| 144 | 144 | bitmap_fill(bitmap, cliprect, 0); |
| 145 | 145 | |
| 146 | draw_terrain(screen->machine, helper, cliprect); | |
| 147 | draw_sprites(screen->machine, helper, cliprect); | |
| 148 | draw_missiles(screen->machine, helper, cliprect); | |
| 146 | draw_terrain(screen->machine, helper, NULL); | |
| 147 | draw_sprites(screen->machine, helper, NULL); | |
| 148 | draw_missiles(screen->machine, helper, NULL); | |
| 149 | 149 | draw_trapezoid(screen->machine, bitmap, helper); |
| 150 | 150 | draw_text(screen->machine, bitmap, cliprect); |
| 151 | 151 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 537 | 537 | } |
| 538 | 538 | p_n_interleave[ n_x ] = m_p_p_vram[ n_yi ][ n_xi ]; |
| 539 | 539 | } |
| 540 | draw_scanline16( bitmap, 0, n_y, width, p_n_interleave, machine->pens | |
| 540 | draw_scanline16( bitmap, 0, n_y, width, p_n_interleave, machine->pens | |
| 541 | 541 | } |
| 542 | 542 | } |
| 543 | 543 | return m_debug.b_texture; |
| r4135 | r4136 | |
| 922 | 922 | n_line = n_lines; |
| 923 | 923 | while( n_line > 0 ) |
| 924 | 924 | { |
| 925 | draw_scanline16( bitmap, n_x + n_left, n_y + n_top, n_columns, m_p_p_vram[ n_y + m_n_displaystarty ] + n_x + n_displaystartx, NULL | |
| 925 | draw_scanline16( bitmap, n_x + n_left, n_y + n_top, n_columns, m_p_p_vram[ n_y + m_n_displaystarty ] + n_x + n_displaystartx, NULL | |
| 926 | 926 | n_y++; |
| 927 | 927 | n_line--; |
| 928 | 928 | } |
| r4135 | r4136 | |
|---|---|---|
| 81 | 81 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,2); |
| 82 | 82 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,4); |
| 83 | 83 | |
| 84 | K051960_sprites_draw(bitmap,cliprect,-1,-1); | |
| 84 | K051960_sprites_draw(screen->machine,bitmap,cliprect,-1,-1); | |
| 85 | 85 | return 0; |
| 86 | 86 | } |
| r4135 | r4136 | |
|---|---|---|
| 86 | 86 | if (k88games_priority) |
| 87 | 87 | { |
| 88 | 88 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],TILEMAP_DRAW_OPAQUE,0); |
| 89 | K051960_sprites_draw(bitmap,cliprect,1,1); | |
| 89 | K051960_sprites_draw(screen->machine,bitmap,cliprect,1,1); | |
| 90 | 90 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,0); |
| 91 | 91 | tilemap_draw(bitmap,cliprect,K052109_tilemap[1],0,0); |
| 92 | K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 92 | K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 93 | 93 | K051316_zoom_draw_0(bitmap,cliprect,0,0); |
| 94 | 94 | } |
| 95 | 95 | else |
| 96 | 96 | { |
| 97 | 97 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],TILEMAP_DRAW_OPAQUE,0); |
| 98 | 98 | K051316_zoom_draw_0(bitmap,cliprect,0,0); |
| 99 | K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 99 | K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 100 | 100 | tilemap_draw(bitmap,cliprect,K052109_tilemap[1],0,0); |
| 101 | K051960_sprites_draw(bitmap,cliprect,1,1); | |
| 101 | K051960_sprites_draw(screen->machine,bitmap,cliprect,1,1); | |
| 102 | 102 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,0); |
| 103 | 103 | } |
| 104 | 104 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 437 | 437 | const rectangle *clip,int priority) |
| 438 | 438 | { |
| 439 | 439 | pen_t pen_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors); |
| 440 | UINT8 *source_base = gfx | |
| 440 | const UINT8 *source_base = gfx_element_get_data | |
| 441 | 441 | |
| 442 | 442 | int sprite_screen_height = ((1<<16)*gfx->height+0x8000)>>16; |
| 443 | 443 | int sprite_screen_width = ((1<<16)*gfx->width+0x8000)>>16; |
| r4135 | r4136 | |
| 507 | 507 | |
| 508 | 508 | for( y=sy; y<ey; y++ ) |
| 509 | 509 | { |
| 510 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 510 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 511 | 511 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 512 | 512 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0); |
| 513 | 513 |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | |
| 13 | UINT8 *goldstar_video1, *goldstar_video2, *goldstar_video3; | |
| 14 | size_t goldstar_video_size; | |
| 13 | //UINT8 *goldstar_video1, *goldstar_video2, *goldstar_video3; | |
| 14 | //size_t goldstar_video_size; | |
| 15 | 15 | UINT8 *goldstar_reel1_scroll, *goldstar_reel2_scroll, *goldstar_reel3_scroll; |
| 16 | 16 | |
| 17 | 17 | static int bgcolor; |
| r4135 | r4136 | |
| 173 | 173 | static const rectangle visible2 = { 0*8, (14+48)*8-1, 12*8, (12+7)*8-1 }; |
| 174 | 174 | static const rectangle visible3 = { 0*8, (14+48)*8-1, 20*8, (20+7)*8-1 }; |
| 175 | 175 | |
| 176 | static const rectangle cm91_visible1 = { 0*8, (14+48)*8-1, 4*8, (4+7)*8-1 }; /* same start for reel1 */ | |
| 177 | static const rectangle cm91_visible2 = { 0*8, (14+48)*8-1, 11*8, (12+7)*8-1 }; /* 4 pixels less for reel2 */ | |
| 178 | static const rectangle cm91_visible3 = { 0*8, (14+48)*8-1, 19*8, (19+7)*8-1 }; /* 8 pixels less for reel3 */ | |
| 176 | 179 | |
| 180 | ||
| 177 | 181 | VIDEO_UPDATE( goldstar ) |
| 178 | 182 | { |
| 179 | 183 | int i; |
| r4135 | r4136 | |
| 195 | 199 | |
| 196 | 200 | return 0; |
| 197 | 201 | } |
| 202 | ||
| 203 | VIDEO_UPDATE( cmast91 ) | |
| 204 | { | |
| 205 | int i; | |
| 206 | ||
| 207 | bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); | |
| 208 | ||
| 209 | for (i= 0;i < 64;i++) | |
| 210 | { | |
| 211 | tilemap_set_scrolly(goldstar_reel1_tilemap, i, goldstar_reel1_scroll[i]); | |
| 212 | tilemap_set_scrolly(goldstar_reel2_tilemap, i, goldstar_reel2_scroll[i]); | |
| 213 | tilemap_set_scrolly(goldstar_reel3_tilemap, i, goldstar_reel3_scroll[i]); | |
| 214 | } | |
| 215 | ||
| 216 | tilemap_draw(bitmap, &cm91_visible1, goldstar_reel1_tilemap, 0, 0); | |
| 217 | tilemap_draw(bitmap, &cm91_visible2, goldstar_reel2_tilemap, 0, 0); | |
| 218 | tilemap_draw(bitmap, &cm91_visible3, goldstar_reel3_tilemap, 0, 0); | |
| 219 | ||
| 220 | tilemap_draw(bitmap, cliprect, goldstar_fg_tilemap, 0, 0); | |
| 221 | ||
| 222 | return 0; | |
| 223 | } |
| r4135 | r4136 | |
|---|---|---|
| 283 | 283 | int xsize, ysize, xzoom, yzoom; |
| 284 | 284 | int code, attr, color, size, pri, pri_mask, trans; |
| 285 | 285 | gfx_element *gfx = machine->gfx[0]; |
| 286 | gfx_element mygfx = *gfx; | |
| 287 | 286 | |
| 288 | 287 | UINT32 *source = sprram_top; |
| 289 | 288 | const UINT32 *finish = sprram_top + (sprram_size - 0x20) / 4; |
| r4135 | r4136 | |
| 346 | 345 | flipy = !flipy; |
| 347 | 346 | } |
| 348 | 347 | |
| 349 | /* change GfxElement parameters to draw only the needed part of the 256x256 tile */ | |
| 350 | mygfx.width = xsize; | |
| 351 | mygfx.height = ysize; | |
| 352 | mygfx.gfxdata = gfx->gfxdata + tx + ty * gfx->line_modulo; | |
| 353 | ||
| 354 | 348 | #if 0 |
| 355 | 349 | if (input_code_pressed(KEYCODE_A) && (pri & 8)) color = rand(); |
| 356 | 350 | if (input_code_pressed(KEYCODE_S) && (pri & 4)) color = rand(); |
| r4135 | r4136 | |
| 368 | 362 | else |
| 369 | 363 | pri_mask = 0xfe; |
| 370 | 364 | |
| 371 | pdrawgfxzoom(bitmap, &mygfx, | |
| 365 | gfx_element_set_source_clip(gfx, tx, xsize, ty, ysize); | |
| 366 | pdrawgfxzoom(bitmap, gfx, | |
| 372 | 367 | code, |
| 373 | 368 | color, |
| 374 | 369 | flipx, flipy, |
| r4135 | r4136 | |
|---|---|---|
| 90 | 90 | int x = sx + 8 * (flipx ? (size - 1 - col) : col); |
| 91 | 91 | int y = sy + 8 * (flipy ? (size - 1 - row) : row); |
| 92 | 92 | |
| 93 | drawgfx(bitmap, machine->gfx[2], | |
| 93 | drawgfx_transpen_raw(bitmap, cliprect, machine->gfx[2], | |
| 94 | 94 | code + layout[row][col], |
| 95 | 95 | machine->gfx[2]->color_base + color * machine->gfx[2]->color_granularity, |
| 96 | 96 | flipx, flipy, |
| 97 | 97 | x, y, |
| 98 | | |
| 98 | | |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| r4135 | r4136 | |
| 133 | 133 | |
| 134 | 134 | color = ((attr & 0x00f0) >> 4) | 0x80; |
| 135 | 135 | |
| 136 | drawgfx(tile_bitmap_bg, screen->machine->gfx[1], | |
| 136 | drawgfx_transpen_raw(tile_bitmap_bg, cliprect, screen->machine->gfx[1], | |
| 137 | 137 | code, |
| 138 | 138 | screen->machine->gfx[1]->color_base + color * screen->machine->gfx[1]->color_granularity, |
| 139 | 139 | 0, 0, |
| 140 | 140 | 16 * sx, 8 * sy, |
| 141 | | |
| 141 | | |
| 142 | 142 | |
| 143 | 143 | sx++; |
| 144 | 144 | if (sx > 63) |
| r4135 | r4136 | |
| 160 | 160 | |
| 161 | 161 | color = ((attr & 0x00f0) >> 4) | 0x80; |
| 162 | 162 | |
| 163 | drawgfx(tile_bitmap_bg, screen->machine->gfx[1], | |
| 163 | drawgfx_transpen_raw(tile_bitmap_bg, cliprect, screen->machine->gfx[1], | |
| 164 | 164 | code, |
| 165 | 165 | screen->machine->gfx[1]->color_base + color * screen->machine->gfx[1]->color_granularity, |
| 166 | 166 | 0, 0, |
| 167 | 167 | 16 * sx, 8 * sy, |
| 168 | | |
| 168 | | |
| 169 | 169 | |
| 170 | 170 | sx++; |
| 171 | 171 | if (sx > 63) |
| r4135 | r4136 | |
| 194 | 194 | else |
| 195 | 195 | color |= 0x0080; |
| 196 | 196 | |
| 197 | drawgfx(tile_bitmap_fg, screen->machine->gfx[0], | |
| 197 | drawgfx_transpen_raw(tile_bitmap_fg, cliprect, screen->machine->gfx[0], | |
| 198 | 198 | code, |
| 199 | 199 | screen->machine->gfx[0]->color_base + color * screen->machine->gfx[0]->color_granularity, |
| 200 | 200 | 0, 0, |
| 201 | 201 | 16 * sx, 8 * sy, |
| 202 | | |
| 202 | | |
| 203 | 203 | |
| 204 | 204 | sx++; |
| 205 | 205 | if (sx > 63) |
| r4135 | r4136 | |
|---|---|---|
| 862 | 862 | continue; |
| 863 | 863 | |
| 864 | 864 | /* draw the sprite */ |
| 865 | drawgfx(bitmap, gfx, code, color, hflip, vflip, sx, sy | |
| 865 | drawgfx_transpen_raw(bitmap, cliprect, gfx, code, color, hflip, vflip, sx, sy | |
| 866 | 866 | rendered = 1; |
| 867 | 867 | |
| 868 | 868 | /* mark the grid dirty */ |
| r4135 | r4136 | |
| 899 | 899 | continue; |
| 900 | 900 | |
| 901 | 901 | /* draw the sprite */ |
| 902 | drawgfx(bitmap, gfx, code, color, hflip, vflip, sx, sy | |
| 902 | drawgfx_transpen_raw(bitmap, cliprect, gfx, code, color, hflip, vflip, sx, sy | |
| 903 | 903 | rendered = 1; |
| 904 | 904 | |
| 905 | 905 | /* mark the grid dirty */ |
| r4135 | r4136 | |
|---|---|---|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | /* draw the scanline */ |
| 426 | draw_scanline16(bitmap, 0, y, 256, &scanline[xscroll], NULL | |
| 426 | draw_scanline16(bitmap, 0, y, 256, &scanline[xscroll], NULL | |
| 427 | 427 | } |
| 428 | 428 | } |
| 429 | 429 | |
| r4135 | r4136 | |
| 432 | 432 | int sizex,int sizey) |
| 433 | 433 | { |
| 434 | 434 | const gfx_element *gfx = machine->gfx[big ? 3 : 2]; |
| 435 | UINT8 *gfxdata = gfx | |
| 435 | const UINT8 *gfxdata = gfx_element_get_data | |
| 436 | 436 | UINT8 *scaling_rom = memory_region(machine, "gfx6"); |
| 437 | 437 | UINT32 transmask = colortable_get_transpen_mask(machine->colortable, gfx, color, 0x1f); |
| 438 | 438 | int coloroffs = gfx->color_base + color * gfx->color_granularity; |
| r4135 | r4136 | |
| 451 | 451 | int xx = sx & 0x3ff; |
| 452 | 452 | int siz = 0; |
| 453 | 453 | int offs = 0; |
| 454 | UINT8 *src; | |
| 454 | const UINT8 *src; | |
| 455 | 455 | |
| 456 | 456 | if (!big) dy >>= 1; |
| 457 | 457 | src = gfxdata + dy * gfx->line_modulo; |
| r4135 | r4136 | |
|---|---|---|
| 1460 | 1460 | |
| 1461 | 1461 | VIDEO_UPDATE(model1) |
| 1462 | 1462 | { |
| 1463 | sys24_tile_update(screen->machine); | |
| 1464 | 1463 | #if 0 |
| 1465 | 1464 | { |
| 1466 | 1465 | int mod = 0; |
| r4135 | r4136 | |
|---|---|---|
| 430 | 430 | |
| 431 | 431 | if ( zoomx || zoomy ) |
| 432 | 432 | { |
| 433 | drawgfxzoom (bitmap,machine->gfx[1], | |
| 433 | drawgfxzoom_transpen_raw (bitmap,cliprect,machine->gfx[1], | |
| 434 | 434 | code, |
| 435 | 435 | color, |
| 436 | 436 | flipx,flipy, |
| 437 | 437 | x,y, |
| 438 | cliprect, | |
| 439 | TRANSPARENCY_PEN_RAW,0,(zx << 16) / 16,(zy << 16) / 16); | |
| 438 | (zx << 16) / 16,(zy << 16) / 16,0); | |
| 440 | 439 | } |
| 441 | 440 | else |
| 442 | 441 | { |
| 443 | drawgfx (bitmap,machine->gfx[1], | |
| 442 | drawgfx_transpen_raw (bitmap,cliprect,machine->gfx[1], | |
| 444 | 443 | code, |
| 445 | 444 | color, |
| 446 | 445 | flipx,flipy, |
| 447 | 446 | x,y, |
| 448 | cliprect, | |
| 449 | TRANSPARENCY_PEN_RAW,0); | |
| 447 | 0); | |
| 450 | 448 | } |
| 451 | 449 | } |
| 452 | 450 | } |
| r4135 | r4136 | |
|---|---|---|
| 533 | 533 | ***************************************************************************/ |
| 534 | 534 | |
| 535 | 535 | #include "driver.h" |
| 536 | #include "drawgfxm.h" | |
| 536 | 537 | #include "taitoic.h" |
| 537 | 538 | |
| 538 | 539 | #define TOPSPEED_ROAD_COLORS |
| r4135 | r4136 | |
| 1344 | 1345 | |
| 1345 | 1346 | static tilemap *TC0080VCO_tilemap[3]; |
| 1346 | 1347 | |
| 1347 | static UINT8 *TC0080VCO_char_dirty; | |
| 1348 | static int TC0080VCO_chars_dirty; | |
| 1349 | 1348 | static int TC0080VCO_bg_gfx,TC0080VCO_tx_gfx; |
| 1350 | 1349 | static int TC0080VCO_bg_xoffs,TC0080VCO_bg_yoffs; |
| 1351 | 1350 | static int TC0080VCO_bg_flip_yoffs; |
| r4135 | r4136 | |
| 1479 | 1478 | TC0080VCO_scroll_ram = TC0080VCO_ram + 0x20800/2; |
| 1480 | 1479 | } |
| 1481 | 1480 | |
| 1482 | static void TC0080VCO_dirty_chars(void) | |
| 1483 | { | |
| 1484 | memset(TC0080VCO_char_dirty,1,TC0080VCO_TOTAL_CHARS); | |
| 1485 | TC0080VCO_chars_dirty = 1; | |
| 1486 | } | |
| 1487 | ||
| 1488 | 1481 | static void TC0080VCO_restore_scroll(void) |
| 1489 | 1482 | { |
| 1490 | 1483 | TC0080VCO_flipscreen = TC0080VCO_scroll_ram[0] & 0x0c00; |
| r4135 | r4136 | |
| 1503 | 1496 | static STATE_POSTLOAD( TC0080VCO_postload ) |
| 1504 | 1497 | { |
| 1505 | 1498 | TC0080VCO_set_layer_ptrs(); |
| 1506 | TC0080VCO_dirty_chars(); | |
| 1507 | 1499 | TC0080VCO_restore_scroll(); |
| 1508 | 1500 | } |
| 1509 | 1501 | |
| r4135 | r4136 | |
| 1540 | 1532 | /* Perform extra initialisations for text layer */ |
| 1541 | 1533 | { |
| 1542 | 1534 | TC0080VCO_tilemap[2] = tilemap_create(machine, TC0080VCO_get_tx_tile_info,tilemap_scan_rows,8,8,64,64); |
| 1543 | TC0080VCO_char_dirty = auto_malloc(TC0080VCO_TOTAL_CHARS); | |
| 1544 | 1535 | |
| 1545 | TC0080VCO_dirty_chars(); | |
| 1546 | ||
| 1547 | 1536 | /* find first empty slot to decode gfx */ |
| 1548 | 1537 | for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) |
| 1549 | 1538 | if (machine->gfx[gfx_index] == 0) |
| r4135 | r4136 | |
| 1551 | 1540 | assert(gfx_index != MAX_GFX_ELEMENTS); |
| 1552 | 1541 | |
| 1553 | 1542 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 1554 | machine->gfx[gfx_index] = allocgfx(machine, &TC0080VCO_charlayout); | |
| 1555 | ||
| 1556 | /* set the color information */ | |
| 1557 | machine->gfx[gfx_index]->total_colors = 64; // is this correct ? | |
| 1543 | machine->gfx[gfx_index] = gfx_element_alloc(machine, &TC0080VCO_charlayout, (UINT8 *)TC0080VCO_char_ram, 64, 0); | |
| 1558 | 1544 | TC0080VCO_tx_gfx = gfx_index; |
| 1559 | 1545 | |
| 1560 | 1546 | tilemap_set_scrolldx(TC0080VCO_tilemap[2],0,0); |
| r4135 | r4136 | |
| 1612 | 1598 | |
| 1613 | 1599 | if (offset < 0x1000/2) |
| 1614 | 1600 | { |
| 1615 | TC0080VCO_char_dirty[offset / 8] = 1; | |
| 1616 | TC0080VCO_chars_dirty = 1; | |
| 1601 | gfx_element_mark_dirty(space->machine->gfx[TC0080VCO_tx_gfx], offset / 8); | |
| 1617 | 1602 | #if 0 |
| 1618 | 1603 | if (!TC0080VCO_has_tx) |
| 1619 | 1604 | { |
| r4135 | r4136 | |
| 1644 | 1629 | |
| 1645 | 1630 | else if (offset < 0x11000/2) |
| 1646 | 1631 | { |
| 1647 | TC0080VCO_char_dirty[(offset - 0x10000/2) / 8] = 1; | |
| 1648 | TC0080VCO_chars_dirty = 1; | |
| 1632 | gfx_element_mark_dirty(space->machine->gfx[TC0080VCO_tx_gfx], (offset - 0x10000/2) / 8); | |
| 1649 | 1633 | #if 0 |
| 1650 | 1634 | if (!TC0080VCO_has_tx) |
| 1651 | 1635 | { |
| r4135 | r4136 | |
| 1700 | 1684 | tilemap_set_scrolly(TC0080VCO_tilemap[1],0, TC0080VCO_bg1_scrolly); |
| 1701 | 1685 | tilemap_set_scrollx(TC0080VCO_tilemap[2],0,0); /* no scroll (maybe) */ |
| 1702 | 1686 | tilemap_set_scrolly(TC0080VCO_tilemap[2],0,0); |
| 1703 | ||
| 1704 | /* Decode any characters that have changed */ | |
| 1705 | ||
| 1706 | if (TC0080VCO_chars_dirty) | |
| 1707 | { | |
| 1708 | int tile_index; | |
| 1709 | ||
| 1710 | for (tile_index = 0;tile_index < 64*64;tile_index++) | |
| 1711 | { | |
| 1712 | int attr = TC0080VCO_tx_ram_0[tile_index >> 1]; | |
| 1713 | ||
| 1714 | /* should this be reversed in flipscreen ?? */ | |
| 1715 | if (tile_index & 1) /* each word has 2 chars */ | |
| 1716 | { | |
| 1717 | attr = (attr &0xff); | |
| 1718 | } | |
| 1719 | else | |
| 1720 | { | |
| 1721 | attr = (attr &0xff00) >> 8; | |
| 1722 | } | |
| 1723 | ||
| 1724 | if (TC0080VCO_char_dirty[attr]) | |
| 1725 | tilemap_mark_tile_dirty(TC0080VCO_tilemap[2],tile_index); | |
| 1726 | } | |
| 1727 | ||
| 1728 | for (j = 0;j < TC0080VCO_TOTAL_CHARS;j++) | |
| 1729 | { | |
| 1730 | if (TC0080VCO_char_dirty[j]) | |
| 1731 | decodechar(machine->gfx[TC0080VCO_tx_gfx],j, | |
| 1732 | (UINT8 *)TC0080VCO_char_ram); | |
| 1733 | TC0080VCO_char_dirty[j] = 0; | |
| 1734 | } | |
| 1735 | TC0080VCO_chars_dirty = 0; | |
| 1736 | } | |
| 1737 | 1687 | } |
| 1738 | 1688 | |
| 1739 | 1689 | |
| r4135 | r4136 | |
| 1893 | 1843 | } |
| 1894 | 1844 | |
| 1895 | 1845 | |
| 1846 | #define PIXEL_OP_COPY_TRANS0_SET_PRIORITY(DEST, PRIORITY, SOURCE) \ | |
| 1847 | do \ | |
| 1848 | { \ | |
| 1849 | UINT32 srcdata = (SOURCE); \ | |
| 1850 | if (srcdata != 0) \ | |
| 1851 | { \ | |
| 1852 | (DEST) = SOURCE; \ | |
| 1853 | (PRIORITY) = privalue; \ | |
| 1854 | } \ | |
| 1855 | } \ | |
| 1856 | while (0) \ | |
| 1857 | ||
| 1896 | 1858 | static void TC0080VCO_bg1_tilemap_draw(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority) |
| 1897 | 1859 | { |
| 1898 | 1860 | UINT8 layer=1; |
| r4135 | r4136 | |
| 1959 | 1921 | - (max_y + min_y) * (zy-0x10000); |
| 1960 | 1922 | } |
| 1961 | 1923 | |
| 1962 | copyrozbitmap(bitmap,srcbitmap, | |
| 1963 | sx, sy, | |
| 1964 | zx, 0, 0, zy, | |
| 1965 | 0, /* why no wraparound ?? */ | |
| 1966 | cliprect, | |
| 1967 | TRANSPARENCY_PEN, 0, priority); | |
| 1924 | { | |
| 1925 | bitmap_t *dest = bitmap; | |
| 1926 | bitmap_t *src = srcbitmap; | |
| 1927 | INT32 startx = sx; | |
| 1928 | INT32 starty = sy; | |
| 1929 | INT32 incxx = zx; | |
| 1930 | INT32 incxy = 0; | |
| 1931 | INT32 incyx = 0; | |
| 1932 | INT32 incyy = zy; | |
| 1933 | int wraparound = 0; | |
| 1934 | UINT32 privalue = priority; | |
| 1935 | bitmap_t *priority = priority_bitmap; | |
| 1936 | ||
| 1937 | if (dest->bpp == 16) | |
| 1938 | COPYROZBITMAP_CORE(UINT16, PIXEL_OP_COPY_TRANS0_SET_PRIORITY, UINT8); | |
| 1939 | else | |
| 1940 | COPYROZBITMAP_CORE(UINT32, PIXEL_OP_COPY_TRANS0_SET_PRIORITY, UINT8); | |
| 1941 | } | |
| 1968 | 1942 | } |
| 1969 | 1943 | } |
| 1970 | 1944 | |
| r4135 | r4136 | |
| 2025 | 1999 | static tilemap *TC0100SCN_tilemap[TC0100SCN_MAX_CHIPS][3][2]; |
| 2026 | 2000 | static rectangle TC0100SCN_cliprect[TC0100SCN_MAX_CHIPS]; |
| 2027 | 2001 | |
| 2028 | static char *TC0100SCN_char_dirty[TC0100SCN_MAX_CHIPS]; | |
| 2029 | static int TC0100SCN_chars_dirty[TC0100SCN_MAX_CHIPS]; | |
| 2030 | 2002 | static int TC0100SCN_bg_gfx[TC0100SCN_MAX_CHIPS],TC0100SCN_tx_gfx[TC0100SCN_MAX_CHIPS]; |
| 2031 | 2003 | static int TC0100SCN_bg_col_mult,TC0100SCN_bg_tilemask,TC0100SCN_tx_col_mult; |
| 2032 | 2004 | static INT32 TC0100SCN_gfxbank,TC0100SCN_chip_colbank[3],TC0100SCN_colbank[3]; |
| r4135 | r4136 | |
| 2226 | 2198 | tilemap_mark_all_tiles_dirty(TC0100SCN_tilemap[chip][2][TC0100SCN_dblwidth[chip]]); |
| 2227 | 2199 | } |
| 2228 | 2200 | |
| 2229 | static void TC0100SCN_dirty_chars(int chip) | |
| 2230 | { | |
| 2231 | memset(TC0100SCN_char_dirty[chip],1,TC0100SCN_TOTAL_CHARS); | |
| 2232 | TC0100SCN_chars_dirty[chip] = 1; | |
| 2233 | } | |
| 2234 | ||
| 2235 | 2201 | static void TC0100SCN_restore_scroll(int chip) |
| 2236 | 2202 | { |
| 2237 | 2203 | int flip; |
| r4135 | r4136 | |
| 2261 | 2227 | int chip = (FPTR)param; |
| 2262 | 2228 | |
| 2263 | 2229 | TC0100SCN_set_layer_ptrs(chip); |
| 2264 | TC0100SCN_dirty_chars(chip); | |
| 2265 | 2230 | TC0100SCN_restore_scroll(chip); |
| 2266 | 2231 | } |
| 2267 | 2232 | |
| r4135 | r4136 | |
| 2304 | 2269 | TC0100SCN_cliprect[i] = myclip; |
| 2305 | 2270 | |
| 2306 | 2271 | TC0100SCN_ram[i] = auto_malloc(TC0100SCN_RAM_SIZE); |
| 2307 | TC0100SCN_char_dirty[i] = auto_malloc(TC0100SCN_TOTAL_CHARS); | |
| 2308 | 2272 | |
| 2309 | 2273 | TC0100SCN_set_layer_ptrs(i); |
| 2310 | TC0100SCN_dirty_chars(i); | |
| 2311 | 2274 | memset(TC0100SCN_ram[i],0,TC0100SCN_RAM_SIZE); |
| 2312 | 2275 | |
| 2313 | 2276 | { |
| r4135 | r4136 | |
| 2325 | 2288 | assert(gfx_index != MAX_GFX_ELEMENTS); |
| 2326 | 2289 | |
| 2327 | 2290 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 2328 | machine->gfx[gfx_index] = allocgfx(machine, &TC0100SCN_charlayout); | |
| 2329 | ||
| 2330 | /* set the color information */ | |
| 2331 | machine->gfx[gfx_index]->total_colors = 64; | |
| 2332 | ||
| 2291 | machine->gfx[gfx_index] = gfx_element_alloc(machine, &TC0100SCN_charlayout, (UINT8 *)TC0100SCN_char_ram[i], 64, 0); | |
| 2333 | 2292 | TC0100SCN_tx_gfx[i] = gfx_index; |
| 2334 | 2293 | |
| 2335 | 2294 | /* use the given gfx set for bg tiles; 2nd/3rd chips will |
| r4135 | r4136 | |
| 2431 | 2390 | return TC0100SCN_ram[2][offset]; |
| 2432 | 2391 | } |
| 2433 | 2392 | |
| 2434 | static void TC0100SCN_word_w(int chip,offs_t offset,UINT16 data,UINT32 mem_mask) | |
| 2393 | static void TC0100SCN_word_w(const address_space *space,int chip,offs_t offset,UINT16 data,UINT32 mem_mask) | |
| 2435 | 2394 | { |
| 2436 | 2395 | COMBINE_DATA(&TC0100SCN_ram[chip][offset]); |
| 2437 | 2396 | if (!TC0100SCN_dblwidth[chip]) |
| r4135 | r4136 | |
| 2441 | 2400 | else if (offset < 0x3000) |
| 2442 | 2401 | tilemap_mark_tile_dirty(TC0100SCN_tilemap[chip][2][0],(offset & 0x0fff)); |
| 2443 | 2402 | else if (offset < 0x3800) |
| 2444 | { | |
| 2445 | TC0100SCN_char_dirty[chip][(offset - 0x3000) / 8] = 1; | |
| 2446 | TC0100SCN_chars_dirty[chip] = 1; | |
| 2447 | } | |
| 2403 | gfx_element_mark_dirty(space->machine->gfx[TC0100SCN_tx_gfx[chip]], (offset - 0x3000) / 8); | |
| 2448 | 2404 | else if (offset >= 0x4000 && offset < 0x6000) |
| 2449 | 2405 | tilemap_mark_tile_dirty(TC0100SCN_tilemap[chip][1][0],(offset & 0x1fff) / 2); |
| 2450 | 2406 | } |
| r4135 | r4136 | |
| 2455 | 2411 | else if (offset >= 0x4000 && offset < 0x8000) |
| 2456 | 2412 | tilemap_mark_tile_dirty(TC0100SCN_tilemap[chip][1][1],(offset & 0x3fff) / 2); |
| 2457 | 2413 | else if (offset >= 0x8800 && offset < 0x9000) |
| 2458 | { | |
| 2459 | TC0100SCN_char_dirty[chip][(offset - 0x8800) / 8] = 1; | |
| 2460 | TC0100SCN_chars_dirty[chip] = 1; | |
| 2461 | } | |
| 2414 | gfx_element_mark_dirty(space->machine->gfx[TC0100SCN_tx_gfx[chip]], (offset - 0x8800) / 8); | |
| 2462 | 2415 | else if (offset >= 0x9000) |
| 2463 | 2416 | tilemap_mark_tile_dirty(TC0100SCN_tilemap[chip][2][1],(offset & 0x0fff)); |
| 2464 | 2417 | } |
| r4135 | r4136 | |
| 2466 | 2419 | |
| 2467 | 2420 | WRITE16_HANDLER( TC0100SCN_word_0_w ) |
| 2468 | 2421 | { |
| 2469 | TC0100SCN_word_w(0,offset,data,mem_mask); | |
| 2422 | TC0100SCN_word_w(space,0,offset,data,mem_mask); | |
| 2470 | 2423 | } |
| 2471 | 2424 | |
| 2472 | 2425 | WRITE16_HANDLER( TC0100SCN_word_1_w ) |
| 2473 | 2426 | { |
| 2474 | TC0100SCN_word_w(1,offset,data,mem_mask); | |
| 2427 | TC0100SCN_word_w(space,1,offset,data,mem_mask); | |
| 2475 | 2428 | } |
| 2476 | 2429 | |
| 2477 | 2430 | WRITE16_HANDLER( TC0100SCN_word_2_w ) |
| 2478 | 2431 | { |
| 2479 | TC0100SCN_word_w(2,offset,data,mem_mask); | |
| 2432 | TC0100SCN_word_w(space,2,offset,data,mem_mask); | |
| 2480 | 2433 | } |
| 2481 | 2434 | |
| 2482 | 2435 | WRITE16_HANDLER( TC0100SCN_dual_screen_w ) |
| r4135 | r4136 | |
| 2509 | 2462 | } |
| 2510 | 2463 | |
| 2511 | 2464 | |
| 2512 | static void TC0100SCN_ctrl_word_w(int chip,offs_t offset,UINT16 data,UINT32 mem_mask) | |
| 2465 | static void TC0100SCN_ctrl_word_w(const address_space *space,int chip,offs_t offset,UINT16 data,UINT32 mem_mask) | |
| 2513 | 2466 | { |
| 2514 | 2467 | COMBINE_DATA(&TC0100SCN_ctrl[chip][offset]); |
| 2515 | 2468 | |
| r4135 | r4136 | |
| 2555 | 2508 | |
| 2556 | 2509 | /* and ensure full redraw of the tilemaps */ |
| 2557 | 2510 | TC0100SCN_dirty_tilemaps(chip); |
| 2511 | ||
| 2512 | /* reset the pointer to the text characters (and dirty them all) */ | |
| 2513 | gfx_element_set_source(space->machine->gfx[TC0100SCN_tx_gfx[chip]], (UINT8 *)TC0100SCN_char_ram[chip]); | |
| 2558 | 2514 | } |
| 2559 | 2515 | |
| 2560 | 2516 | break; |
| r4135 | r4136 | |
| 2578 | 2534 | |
| 2579 | 2535 | WRITE16_HANDLER( TC0100SCN_ctrl_word_0_w ) |
| 2580 | 2536 | { |
| 2581 | TC0100SCN_ctrl_word_w(0,offset,data,mem_mask); | |
| 2537 | TC0100SCN_ctrl_word_w(space,0,offset,data,mem_mask); | |
| 2582 | 2538 | } |
| 2583 | 2539 | |
| 2584 | 2540 | WRITE16_HANDLER( TC0100SCN_ctrl_word_1_w ) |
| 2585 | 2541 | { |
| 2586 | TC0100SCN_ctrl_word_w(1,offset,data,mem_mask); | |
| 2542 | TC0100SCN_ctrl_word_w(space,1,offset,data,mem_mask); | |
| 2587 | 2543 | } |
| 2588 | 2544 | |
| 2589 | 2545 | WRITE16_HANDLER( TC0100SCN_ctrl_word_2_w ) |
| 2590 | 2546 | { |
| 2591 | TC0100SCN_ctrl_word_w(2,offset,data,mem_mask); | |
| 2547 | TC0100SCN_ctrl_word_w(space,2,offset,data,mem_mask); | |
| 2592 | 2548 | } |
| 2593 | 2549 | |
| 2594 | 2550 | |
| r4135 | r4136 | |
| 2599 | 2555 | |
| 2600 | 2556 | WRITE32_HANDLER( TC0100SCN_ctrl_long_w ) |
| 2601 | 2557 | { |
| 2602 | if (ACCESSING_BITS_16_31) TC0100SCN_ctrl_word_w(0,offset*2,data>>16,mem_mask>>16); | |
| 2603 | if (ACCESSING_BITS_0_15) TC0100SCN_ctrl_word_w(0,(offset*2)+1,data&0xffff,mem_mask&0xffff); | |
| 2558 | if (ACCESSING_BITS_16_31) TC0100SCN_ctrl_word_w(space,0,offset*2,data>>16,mem_mask>>16); | |
| 2559 | if (ACCESSING_BITS_0_15) TC0100SCN_ctrl_word_w(space,0,(offset*2)+1,data&0xffff,mem_mask&0xffff); | |
| 2604 | 2560 | } |
| 2605 | 2561 | |
| 2606 | 2562 | READ32_HANDLER( TC0100SCN_long_r ) |
| r4135 | r4136 | |
| 2650 | 2606 | tilemap_set_scrollx(TC0100SCN_tilemap[chip][1][TC0100SCN_dblwidth[chip]], |
| 2651 | 2607 | (j + TC0100SCN_fgscrolly[chip]) & 0x1ff, |
| 2652 | 2608 | TC0100SCN_fgscrollx[chip] - TC0100SCN_fgscroll_ram[chip][j]); |
| 2653 | ||
| 2654 | /* Decode any characters that have changed */ | |
| 2655 | if (TC0100SCN_chars_dirty[chip]) | |
| 2656 | { | |
| 2657 | int tile_index; | |
| 2658 | ||
| 2659 | ||
| 2660 | for (tile_index = 0;tile_index < 64*64;tile_index++) | |
| 2661 | { | |
| 2662 | int attr = TC0100SCN_tx_ram[chip][tile_index]; | |
| 2663 | if (TC0100SCN_char_dirty[chip][attr & 0xff]) | |
| 2664 | tilemap_mark_tile_dirty(TC0100SCN_tilemap[chip][2][TC0100SCN_dblwidth[chip]],tile_index); | |
| 2665 | } | |
| 2666 | ||
| 2667 | for (j = 0;j < TC0100SCN_TOTAL_CHARS;j++) | |
| 2668 | { | |
| 2669 | if (TC0100SCN_char_dirty[chip][j]) | |
| 2670 | decodechar(machine->gfx[TC0100SCN_tx_gfx[chip]],j, | |
| 2671 | (UINT8 *)TC0100SCN_char_ram[chip]); | |
| 2672 | TC0100SCN_char_dirty[chip][j] = 0; | |
| 2673 | } | |
| 2674 | TC0100SCN_chars_dirty[chip] = 0; | |
| 2675 | } | |
| 2676 | 2609 | } |
| 2677 | 2610 | } |
| 2678 | 2611 | |
| r4135 | r4136 | |
| 2947 | 2880 | |
| 2948 | 2881 | /* We keep two tilemaps for each of the 5 actual tilemaps: one at standard width, one double */ |
| 2949 | 2882 | static tilemap *TC0480SCP_tilemap[5][2]; |
| 2950 | static char *TC0480SCP_char_dirty; | |
| 2951 | static int TC0480SCP_chars_dirty; | |
| 2952 | 2883 | static int TC0480SCP_bg_gfx,TC0480SCP_tx_gfx; |
| 2953 | 2884 | static INT32 TC0480SCP_tile_colbase,TC0480SCP_dblwidth; |
| 2954 | 2885 | static int TC0480SCP_x_offs,TC0480SCP_y_offs; |
| r4135 | r4136 | |
| 3072 | 3003 | tilemap_mark_all_tiles_dirty(TC0480SCP_tilemap[4][TC0480SCP_dblwidth]); |
| 3073 | 3004 | } |
| 3074 | 3005 | |
| 3075 | static void TC0480SCP_dirty_chars(void) | |
| 3076 | { | |
| 3077 | memset(TC0480SCP_char_dirty,1,TC0480SCP_TOTAL_CHARS); | |
| 3078 | TC0480SCP_chars_dirty = 1; | |
| 3079 | } | |
| 3080 | ||
| 3081 | 3006 | static void TC0480SCP_restore_scroll(void) |
| 3082 | 3007 | { |
| 3083 | 3008 | int reg; |
| r4135 | r4136 | |
| 3144 | 3069 | static STATE_POSTLOAD( TC0480SCP_postload ) |
| 3145 | 3070 | { |
| 3146 | 3071 | TC0480SCP_set_layer_ptrs(); |
| 3147 | TC0480SCP_dirty_chars(); | |
| 3148 | 3072 | TC0480SCP_restore_scroll(); |
| 3149 | 3073 | } |
| 3150 | 3074 | |
| r4135 | r4136 | |
| 3176 | 3100 | TC0480SCP_tilemap[4][1] = tilemap_create(machine, tc480_get_tile_info[4],tilemap_scan_rows,8,8,64,64); |
| 3177 | 3101 | |
| 3178 | 3102 | TC0480SCP_ram = auto_malloc(TC0480SCP_RAM_SIZE); |
| 3179 | TC0480SCP_char_dirty = auto_malloc(TC0480SCP_TOTAL_CHARS); | |
| 3180 | 3103 | |
| 3181 | 3104 | TC0480SCP_set_layer_ptrs(); |
| 3182 | TC0480SCP_dirty_chars(); | |
| 3183 | 3105 | memset(TC0480SCP_ram,0,TC0480SCP_RAM_SIZE); |
| 3184 | 3106 | |
| 3185 | 3107 | state_save_register_global_pointer(machine, TC0480SCP_ram, TC0480SCP_RAM_SIZE/2); |
| r4135 | r4136 | |
| 3194 | 3116 | assert(gfx_index != MAX_GFX_ELEMENTS); |
| 3195 | 3117 | |
| 3196 | 3118 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 3197 | machine->gfx[gfx_index] = allocgfx(machine, &TC0480SCP_charlayout); | |
| 3198 | ||
| 3199 | /* set the color information */ | |
| 3200 | machine->gfx[gfx_index]->total_colors = 64; | |
| 3201 | ||
| 3119 | machine->gfx[gfx_index] = gfx_element_alloc(machine, &TC0480SCP_charlayout, (UINT8 *)TC0480SCP_char_ram, 64, 0); | |
| 3202 | 3120 | TC0480SCP_tx_gfx = gfx_index; |
| 3203 | 3121 | |
| 3204 | 3122 | /* use the given gfx set for bg tiles */ |
| r4135 | r4136 | |
| 3308 | 3226 | return TC0480SCP_ram[offset]; |
| 3309 | 3227 | } |
| 3310 | 3228 | |
| 3311 | static void TC0480SCP_word_write(offs_t offset,UINT16 data,UINT32 mem_mask) | |
| 3229 | static void TC0480SCP_word_write(const address_space *space,offs_t offset,UINT16 data,UINT32 mem_mask) | |
| 3312 | 3230 | { |
| 3313 | 3231 | COMBINE_DATA(&TC0480SCP_ram[offset]); |
| 3314 | 3232 | |
| r4135 | r4136 | |
| 3329 | 3247 | } |
| 3330 | 3248 | else if (offset <= 0x7fff) |
| 3331 | 3249 | { |
| 3332 | TC0480SCP_char_dirty[(offset - 0x7000) / 16] = 1; | |
| 3333 | TC0480SCP_chars_dirty = 1; | |
| 3250 | gfx_element_mark_dirty(space->machine->gfx[TC0480SCP_tx_gfx], (offset - 0x7000) / 16); | |
| 3334 | 3251 | } |
| 3335 | 3252 | } |
| 3336 | 3253 | else |
| r4135 | r4136 | |
| 3350 | 3267 | } |
| 3351 | 3268 | else if (offset <= 0x7fff) |
| 3352 | 3269 | { |
| 3353 | TC0480SCP_char_dirty[(offset - 0x7000) / 16] = 1; | |
| 3354 | TC0480SCP_chars_dirty = 1; | |
| 3270 | gfx_element_mark_dirty(space->machine->gfx[TC0480SCP_tx_gfx], (offset - 0x7000) / 16); | |
| 3355 | 3271 | } |
| 3356 | 3272 | } |
| 3357 | 3273 | } |
| 3358 | 3274 | |
| 3359 | 3275 | WRITE16_HANDLER( TC0480SCP_word_w ) |
| 3360 | 3276 | { |
| 3361 | TC0480SCP_word_write(offset,data,mem_mask); | |
| 3277 | TC0480SCP_word_write(space,offset,data,mem_mask); | |
| 3362 | 3278 | } |
| 3363 | 3279 | |
| 3364 | 3280 | READ16_HANDLER( TC0480SCP_ctrl_word_r ) |
| r4135 | r4136 | |
| 3523 | 3439 | } |
| 3524 | 3440 | } |
| 3525 | 3441 | } |
| 3526 | ||
| 3527 | /* Decode any characters that have changed */ | |
| 3528 | if (TC0480SCP_chars_dirty) | |
| 3529 | { | |
| 3530 | int tile_index; | |
| 3531 | ||
| 3532 | for (tile_index = 0;tile_index < 64*64;tile_index++) | |
| 3533 | { | |
| 3534 | int attr = TC0480SCP_tx_ram[tile_index]; | |
| 3535 | if (TC0480SCP_char_dirty[attr & 0xff]) | |
| 3536 | tilemap_mark_tile_dirty(TC0480SCP_tilemap[4][TC0480SCP_dblwidth],tile_index); | |
| 3537 | } | |
| 3538 | ||
| 3539 | for (j = 0;j < TC0480SCP_TOTAL_CHARS;j++) | |
| 3540 | { | |
| 3541 | if (TC0480SCP_char_dirty[j]) | |
| 3542 | decodechar(machine->gfx[TC0480SCP_tx_gfx],j, | |
| 3543 | (UINT8 *)TC0480SCP_char_ram); | |
| 3544 | TC0480SCP_char_dirty[j] = 0; | |
| 3545 | } | |
| 3546 | TC0480SCP_chars_dirty = 0; | |
| 3547 | } | |
| 3548 | 3442 | } |
| 3549 | 3443 | |
| 3550 | 3444 |
| r4135 | r4136 | |
|---|---|---|
| 267 | 267 | const UINT8 *source = &spriteram[0x0800-0x20]; /* the last is NOT a sprite */ |
| 268 | 268 | const UINT8 *finish = &spriteram[0]; |
| 269 | 269 | gfx_element *gfx = machine->gfx[2]; |
| 270 | gfx_element mygfx = *gfx; | |
| 271 | 270 | |
| 272 | 271 | int sprite_xoffs = spriteram[0x07f5] + ((spriteram[0x07f4] & 1) << 8); |
| 273 | 272 | int sprite_yoffs = spriteram[0x07f7]; |
| r4135 | r4136 | |
| 310 | 309 | |
| 311 | 310 | sy++; /* sprites are buffered and delayed by one scanline */ |
| 312 | 311 | |
| 313 | /* change GfxElement parameters to draw only the needed part of the 32x32 tile */ | |
| 314 | mygfx.width = sizex; | |
| 315 | mygfx.height = sizey; | |
| 316 | mygfx.gfxdata = gfx->gfxdata + tx + ty * gfx->line_modulo; | |
| 317 | ||
| 318 | pdrawgfx( bitmap, &mygfx, | |
| 312 | gfx_element_set_source_clip(gfx, tx, sizex, ty, sizey); | |
| 313 | pdrawgfx( bitmap, gfx, | |
| 319 | 314 | sprite, |
| 320 | 315 | color, |
| 321 | 316 | flipx,flipy, |
| r4135 | r4136 | |
|---|---|---|
| 26 | 26 | static UINT8 bnj_scroll2 = 0; |
| 27 | 27 | static bitmap_t *background_bitmap; |
| 28 | 28 | |
| 29 | static UINT8 *sprite_dirty, *char_dirty; | |
| 30 | ||
| 31 | 29 | /*************************************************************************** |
| 32 | 30 | |
| 33 | 31 | Burger Time doesn't have a color PROM. It uses RAM to dynamically |
| r4135 | r4136 | |
| 141 | 139 | bnj_scroll2 = 0; |
| 142 | 140 | btime_palette = 0; |
| 143 | 141 | |
| 144 | sprite_dirty = auto_malloc(256 * sizeof(*sprite_dirty)); | |
| 145 | memset(sprite_dirty, 1, 256 * sizeof(*sprite_dirty)); | |
| 146 | ||
| 147 | char_dirty = auto_malloc(1024 * sizeof(*char_dirty)); | |
| 148 | memset(char_dirty, 1, 1024 * sizeof(*char_dirty)); | |
| 142 | if (machine->gfx[0]->srcdata == NULL) | |
| 143 | gfx_element_set_source(machine->gfx[0], deco_charram); | |
| 144 | if (machine->gfx[1]->srcdata == NULL) | |
| 145 | gfx_element_set_source(machine->gfx[1], deco_charram); | |
| 149 | 146 | } |
| 150 | 147 | |
| 151 | 148 | |
| r4135 | r4136 | |
| 242 | 239 | offset &= 0x1fff; |
| 243 | 240 | |
| 244 | 241 | /* dirty sprite */ |
| 245 | | |
| 242 | gfx_ | |
| 246 | 243 | |
| 247 | 244 | /* diry char */ |
| 248 | | |
| 245 | gfx_element_mark_dirty(space->machine->gfx[0], offset >> 3) | |
| 249 | 246 | } |
| 250 | 247 | |
| 251 | 248 | WRITE8_HANDLER( bnj_background_w ) |
| r4135 | r4136 | |
| 431 | 428 | } |
| 432 | 429 | |
| 433 | 430 | |
| 434 | static void decode_modified(running_machine *machine, UINT8 *sprite_ram, int interleave) | |
| 435 | { | |
| 436 | int i,offs; | |
| 437 | ||
| 438 | ||
| 439 | /* decode dirty characters */ | |
| 440 | for (offs = btime_videoram_size - 1;offs >= 0;offs--) | |
| 441 | { | |
| 442 | int code; | |
| 443 | ||
| 444 | code = btime_videoram[offs] + 256 * (btime_colorram[offs] & 3); | |
| 445 | ||
| 446 | if (char_dirty[code]) | |
| 447 | { | |
| 448 | decodechar(machine->gfx[0],code,deco_charram); | |
| 449 | ||
| 450 | char_dirty[code] = 0; | |
| 451 | } | |
| 452 | } | |
| 453 | ||
| 454 | /* decode dirty sprites */ | |
| 455 | for (i = 0, offs = 0;i < 8; i++, offs += 4*interleave) | |
| 456 | { | |
| 457 | int code; | |
| 458 | ||
| 459 | code = sprite_ram[offs + interleave]; | |
| 460 | ||
| 461 | if (sprite_dirty[code]) | |
| 462 | { | |
| 463 | decodechar(machine->gfx[1],code,deco_charram); | |
| 464 | ||
| 465 | sprite_dirty[code] = 0; | |
| 466 | } | |
| 467 | } | |
| 468 | } | |
| 469 | ||
| 470 | ||
| 471 | 431 | VIDEO_UPDATE( btime ) |
| 472 | 432 | { |
| 473 | 433 | if (bnj_scroll1 & 0x10) |
| r4135 | r4136 | |
| 620 | 580 | |
| 621 | 581 | VIDEO_UPDATE( disco ) |
| 622 | 582 | { |
| 623 | decode_modified(screen->machine, spriteram, 1); | |
| 624 | 583 | draw_chars(screen->machine, bitmap, cliprect, TRANSPARENCY_NONE, btime_palette, -1); |
| 625 | 584 | draw_sprites(screen->machine, bitmap, cliprect, btime_palette, 0, 0, spriteram, 1); |
| 626 | 585 | |
| r4135 | r4136 | |
| 630 | 589 | |
| 631 | 590 | VIDEO_UPDATE( progolf ) |
| 632 | 591 | { |
| 633 | decode_modified(screen->machine, spriteram, 1); | |
| 634 | 592 | draw_chars(screen->machine, bitmap, cliprect, TRANSPARENCY_NONE, /*btime_palette*/0, -1); |
| 635 | 593 | // draw_sprites(screen->machine, bitmap, cliprect, 0/*btime_palette*/, 0, 0, spriteram, 1); |
| 636 | 594 |
| r4135 | r4136 | |
|---|---|---|
| 108 | 108 | |
| 109 | 109 | INLINE const UINT8 *get_source_ptr(gfx_element *gfx, UINT32 sprite, int dx, int dy, int block) |
| 110 | 110 | { |
| 111 | int | |
| 111 | int | |
| 112 | 112 | |
| 113 | 113 | /* Get a tile index from the x,y position in the block */ |
| 114 | 114 | switch (block) |
| r4135 | r4136 | |
| 141 | 141 | break; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | source_base=((sprite+code) % gfx->total_elements) * 16; | |
| 145 | return gfx->gfxdata + ((source_base+(dy%16)) * gfx->line_modulo); | |
| 144 | return gfx_element_get_data(gfx, (sprite+code) % gfx->total_elements) + ((dy%16) * gfx->line_modulo); | |
| 146 | 145 | } |
| 147 | 146 | |
| 148 | 147 | static void bbusters_draw_block(running_machine *machine, bitmap_t *dest,int x,int y,int size,int flipx,int flipy,UINT32 sprite,int color,int bank,int block) |
| r4135 | r4136 | |
|---|---|---|
| 33 | 33 | static int sp16_scrollx, sp16_scrolly, sp32_scrollx, sp32_scrolly; |
| 34 | 34 | static UINT8 sprite_split_point; |
| 35 | 35 | static int num_sprites, yscroll_mask; |
| 36 | static UINT32 bg_tile_offset; | |
| 37 | static UINT32 tx_tile_offset; | |
| 36 | 38 | |
| 37 | 39 | static UINT8 empty_tile[16*16]; |
| 40 | static UINT8 drawmode_table[16]; | |
| 38 | 41 | |
| 39 | 42 | /**************************************************************************************/ |
| 40 | 43 | |
| r4135 | r4136 | |
| 87 | 90 | int code = snk_tx_videoram[tile_index]; |
| 88 | 91 | int color = code >> 5; |
| 89 | 92 | SET_TILE_INFO(0, |
| 90 | code, | |
| 93 | tx_tile_offset + code, | |
| 91 | 94 | color, |
| 92 | 95 | tile_index & 0x400 ? TILE_FORCE_LAYER0 : 0); |
| 93 | 96 | } |
| r4135 | r4136 | |
| 96 | 99 | { |
| 97 | 100 | int code = snk_tx_videoram[tile_index]; |
| 98 | 101 | SET_TILE_INFO(0, |
| 99 | code, | |
| 102 | tx_tile_offset + code, | |
| 100 | 103 | 0, |
| 101 | 104 | tile_index & 0x400 ? TILE_FORCE_LAYER0 : 0); |
| 102 | 105 | } |
| r4135 | r4136 | |
| 105 | 108 | { |
| 106 | 109 | int code = snk_tx_videoram[tile_index]; |
| 107 | 110 | SET_TILE_INFO(0, |
| 108 | code, | |
| 111 | tx_tile_offset + code, | |
| 109 | 112 | 0, |
| 110 | 113 | 0); |
| 111 | 114 | } |
| r4135 | r4136 | |
| 134 | 137 | { |
| 135 | 138 | int code = snk_bg_videoram[tile_index]; |
| 136 | 139 | SET_TILE_INFO(1, |
| 137 | code, | |
| 140 | bg_tile_offset + code, | |
| 138 | 141 | 0, |
| 139 | 142 | 0); |
| 140 | 143 | } |
| r4135 | r4136 | |
| 189 | 192 | fatalerror("driver should use VIDEO_HAS_SHADOWS"); |
| 190 | 193 | |
| 191 | 194 | /* prepare shadow draw table */ |
| 192 | for(i = 0; i <= 5; i++) gfx_drawmode_table[i] = DRAWMODE_SOURCE; | |
| 193 | gfx_drawmode_table[6] = DRAWMODE_SHADOW; | |
| 194 | gfx_drawmode_table[7] = DRAWMODE_NONE; | |
| 195 | for(i = 0; i <= 5; i++) drawmode_table[i] = DRAWMODE_SOURCE; | |
| 196 | drawmode_table[6] = (machine->config->video_attributes & VIDEO_HAS_SHADOWS) ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; | |
| 197 | drawmode_table[7] = DRAWMODE_NONE; | |
| 195 | 198 | |
| 196 | 199 | for (i = 0x000;i < 0x400;i++) |
| 197 | 200 | machine->shadow_table[i] = i | 0x200; |
| r4135 | r4136 | |
| 205 | 208 | fatalerror("driver should use VIDEO_HAS_SHADOWS"); |
| 206 | 209 | |
| 207 | 210 | /* prepare shadow draw table */ |
| 208 | for(i = 0; i <= 13; i++) gfx_drawmode_table[i] = DRAWMODE_SOURCE; | |
| 209 | gfx_drawmode_table[14] = DRAWMODE_SHADOW; | |
| 210 | gfx_drawmode_table[15] = DRAWMODE_NONE; | |
| 211 | for(i = 0; i <= 13; i++) drawmode_table[i] = DRAWMODE_SOURCE; | |
| 212 | drawmode_table[14] = DRAWMODE_SHADOW; | |
| 213 | drawmode_table[15] = DRAWMODE_NONE; | |
| 211 | 214 | |
| 212 | 215 | /* all palette entries are not affected by shadow sprites... */ |
| 213 | 216 | for (i = 0x000;i < 0x400;i++) |
| r4135 | r4136 | |
| 235 | 238 | |
| 236 | 239 | tilemap_set_scrolldx(bg_tilemap, 15, 31); |
| 237 | 240 | tilemap_set_scrolldy(bg_tilemap, 8, -32); |
| 241 | ||
| 242 | tx_tile_offset = 0; | |
| 238 | 243 | } |
| 239 | 244 | |
| 240 | 245 | VIDEO_START( jcross ) |
| r4135 | r4136 | |
| 252 | 257 | |
| 253 | 258 | num_sprites = 25; |
| 254 | 259 | yscroll_mask = 0x1ff; |
| 260 | bg_tile_offset = 0; | |
| 261 | tx_tile_offset = 0; | |
| 255 | 262 | } |
| 256 | 263 | |
| 257 | 264 | VIDEO_START( sgladiat ) |
| r4135 | r4136 | |
| 269 | 276 | |
| 270 | 277 | num_sprites = 25; |
| 271 | 278 | yscroll_mask = 0x0ff; |
| 279 | bg_tile_offset = 0; | |
| 280 | tx_tile_offset = 0; | |
| 272 | 281 | } |
| 273 | 282 | |
| 274 | 283 | VIDEO_START( hal21 ) |
| r4135 | r4136 | |
| 307 | 316 | |
| 308 | 317 | num_sprites = 50; |
| 309 | 318 | yscroll_mask = 0x1ff; |
| 319 | tx_tile_offset = 0; | |
| 310 | 320 | } |
| 311 | 321 | |
| 312 | 322 | VIDEO_START( ikari ) |
| r4135 | r4136 | |
| 321 | 331 | |
| 322 | 332 | tilemap_set_scrolldx(bg_tilemap, 15, 24); |
| 323 | 333 | tilemap_set_scrolldy(bg_tilemap, 8, -32); |
| 334 | ||
| 335 | tx_tile_offset = 0; | |
| 324 | 336 | } |
| 325 | 337 | |
| 326 | 338 | VIDEO_START( gwar ) |
| 327 | 339 | { |
| 340 | int i; | |
| 341 | ||
| 342 | /* prepare drawmode table */ | |
| 343 | for(i = 0; i <= 14; i++) drawmode_table[i] = DRAWMODE_SOURCE; | |
| 344 | drawmode_table[15] = DRAWMODE_NONE; | |
| 345 | ||
| 328 | 346 | memset(empty_tile,0xf,sizeof(empty_tile)); |
| 329 | 347 | |
| 330 | 348 | tx_tilemap = tilemap_create(machine, gwar_get_tx_tile_info, tilemap_scan_cols, 8, 8, 50, 32); |
| r4135 | r4136 | |
| 334 | 352 | |
| 335 | 353 | tilemap_set_scrolldx(bg_tilemap, 16, 143); |
| 336 | 354 | tilemap_set_scrolldy(bg_tilemap, 0, -32); |
| 355 | ||
| 356 | tx_tile_offset = 0; | |
| 337 | 357 | } |
| 338 | 358 | |
| 339 | 359 | VIDEO_START( tdfever ) |
| 340 | 360 | { |
| 361 | VIDEO_START_CALL(gwar); | |
| 341 | 362 | VIDEO_START_CALL(snk_4bpp_shadow); |
| 342 | ||
| 343 | VIDEO_START_CALL(gwar); | |
| 344 | 363 | } |
| 345 | 364 | |
| 346 | 365 | /**************************************************************************************/ |
| r4135 | r4136 | |
| 443 | 462 | flip_screen_set(space->machine, data & 0x80); |
| 444 | 463 | |
| 445 | 464 | tilemap_set_palette_offset(bg_tilemap, ((data & 0xf) ^ 8) << 4); |
| 446 | tilemap_set_pen_data_offset(bg_tilemap, ((data & 0x20) << 3) * space->machine->gfx[1]->char_modulo); | |
| 465 | if (bg_tile_offset != ((data & 0x20) << 3)) | |
| 466 | { | |
| 467 | bg_tile_offset = (data & 0x20) << 3; | |
| 468 | tilemap_mark_all_tiles_dirty(bg_tilemap); | |
| 469 | } | |
| 447 | 470 | |
| 448 | 471 | // other bits unknown |
| 449 | 472 | } |
| r4135 | r4136 | |
| 507 | 530 | |
| 508 | 531 | flip_screen_set(space->machine, data & 0x80); |
| 509 | 532 | |
| 510 | tilemap_set_pen_data_offset(tx_tilemap, ((data & 0x40) << 2) * space->machine->gfx[0]->char_modulo); | |
| 533 | if (tx_tile_offset != ((data & 0x40) << 2)) | |
| 534 | { | |
| 535 | tx_tile_offset = (data & 0x40) << 2; | |
| 536 | tilemap_mark_all_tiles_dirty(tx_tilemap); | |
| 537 | } | |
| 511 | 538 | |
| 512 | 539 | bg_scrolly = (bg_scrolly & 0xff) | ((data & 0x10) << 4); |
| 513 | 540 | sp16_scrolly = (sp16_scrolly & 0xff) | ((data & 0x08) << 5); |
| r4135 | r4136 | |
| 518 | 545 | WRITE8_HANDLER( aso_bg_bank_w ) |
| 519 | 546 | { |
| 520 | 547 | tilemap_set_palette_offset(bg_tilemap, ((data & 0xf) ^ 8) << 4); |
| 521 | tilemap_set_pen_data_offset(bg_tilemap, ((data & 0x30) << 4) * space->machine->gfx[1]->char_modulo); | |
| 548 | if (bg_tile_offset != ((data & 0x30) << 4)) | |
| 549 | { | |
| 550 | bg_tile_offset = (data & 0x30) << 4; | |
| 551 | tilemap_mark_all_tiles_dirty(bg_tilemap); | |
| 552 | } | |
| 522 | 553 | } |
| 523 | 554 | |
| 524 | 555 | WRITE8_HANDLER( ikari_bg_scroll_msb_w ) |
| r4135 | r4136 | |
| 549 | 580 | popmessage("attrs %02x contact MAMEDEV", data); |
| 550 | 581 | |
| 551 | 582 | tilemap_set_palette_offset(tx_tilemap, (data & 0x01) << 4); |
| 552 | tilemap_set_pen_data_offset(tx_tilemap, ((data & 0x10) << 4) * space->machine->gfx[0]->char_modulo); | |
| 583 | if (tx_tile_offset != ((data & 0x10) << 4)) | |
| 584 | { | |
| 585 | tx_tile_offset = (data & 0x10) << 4; | |
| 586 | tilemap_mark_all_tiles_dirty(tx_tilemap); | |
| 587 | } | |
| 553 | 588 | } |
| 554 | 589 | |
| 555 | 590 | WRITE8_HANDLER( gwar_tx_bank_w ) |
| 556 | 591 | { |
| 557 | 592 | tilemap_set_palette_offset(tx_tilemap, (data & 0xf) << 4); |
| 558 | tilemap_set_pen_data_offset(tx_tilemap, ((data & 0x30) << 4) * space->machine->gfx[0]->char_modulo); | |
| 593 | if (tx_tile_offset != ((data & 0x30) << 4)) | |
| 594 | { | |
| 595 | tx_tile_offset = (data & 0x30) << 4; | |
| 596 | tilemap_mark_all_tiles_dirty(tx_tilemap); | |
| 597 | } | |
| 559 | 598 | } |
| 560 | 599 | |
| 561 | 600 | WRITE8_HANDLER( gwar_videoattrs_w ) |
| r4135 | r4136 | |
| 640 | 679 | if (sx > 512-16) sx -= 512; |
| 641 | 680 | if (sy > 256-16) sy -= 256; |
| 642 | 681 | |
| 643 | drawgfx( | |
| 682 | drawgfx_transtable( | |
| 644 | 683 | tile_number, |
| 645 | 684 | color, |
| 646 | 685 | flipx, flipy, |
| 647 | 686 | sx, sy, |
| 648 | | |
| 687 | d | |
| 649 | 688 | |
| 650 | 689 | source+=4; |
| 651 | 690 | } |
| r4135 | r4136 | |
| 705 | 744 | if (sx > 512-size) sx -= 512; |
| 706 | 745 | if (sy > (yscroll_mask+1)-size) sy -= (yscroll_mask+1); |
| 707 | 746 | |
| 708 | drawgfx(bitmap,gfx, | |
| 747 | drawgfx_transtable(bitmap,cliprect,gfx, | |
| 709 | 748 | tile_number, |
| 710 | 749 | color, |
| 711 | 750 | xflip,yflip, |
| 712 | 751 | sx,sy, |
| 713 | | |
| 752 | d | |
| 714 | 753 | } |
| 715 | 754 | } |
| 716 | 755 | |
| r4135 | r4136 | |
| 751 | 790 | if (sx > 512-size) sx -= 512; |
| 752 | 791 | if (sy > 512-size) sy -= 512; |
| 753 | 792 | |
| 754 | drawgfx(bitmap,gfx, | |
| 793 | drawgfx_transtable(bitmap,cliprect,gfx, | |
| 755 | 794 | tile_number, |
| 756 | 795 | color, |
| 757 | 796 | 0,0, |
| 758 | 797 | sx,sy, |
| 759 | | |
| 798 | d | |
| 760 | 799 | } |
| 761 | 800 | } |
| 762 | 801 | |
| r4135 | r4136 | |
| 791 | 830 | { |
| 792 | 831 | const gfx_element *gfx = machine->gfx[gfxnum]; |
| 793 | 832 | const int size = gfx->width; |
| 794 | int tile_number, attributes, sx, sy, color | |
| 833 | int tile_number, attributes, sx, sy, color | |
| 795 | 834 | int which; |
| 796 | 835 | int flipx, flipy; |
| 797 | 836 | |
| 798 | pen_mode = (machine->config->video_attributes & VIDEO_HAS_SHADOWS) ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN; | |
| 799 | ||
| 800 | 837 | for(which = from*4; which < to*4; which+=4) |
| 801 | 838 | { |
| 802 | 839 | tile_number = source[which+1]; |
| r4135 | r4136 | |
| 838 | 875 | if (sx > 512-size) sx -= 512; |
| 839 | 876 | if (sy > 512-size) sy -= 512; |
| 840 | 877 | |
| 841 | drawgfx(bitmap,gfx, | |
| 878 | drawgfx_transtable(bitmap,cliprect,gfx, | |
| 842 | 879 | tile_number, |
| 843 | 880 | color, |
| 844 | 881 | flipx,flipy, |
| 845 | 882 | sx,sy, |
| 846 | | |
| 883 | d | |
| 847 | 884 | } |
| 848 | 885 | } |
| 849 | 886 |
| r4135 | r4136 | |
|---|---|---|
| 417 | 417 | for ( ; src >= end; src -= 8/2 ) |
| 418 | 418 | { |
| 419 | 419 | int x,y, attr,code,color,flipx,flipy, zoom, curr_pri,width,height; |
| 420 | gfx_element gfx; | |
| 420 | 421 | UINT8 *gfxdata; |
| 421 | 422 | |
| 422 | 423 | /* Exponential zoom table extracted from daitoride */ |
| r4135 | r4136 | |
| 468 | 469 | |
| 469 | 470 | if (color == 0xf) /* 8bpp */ |
| 470 | 471 | { |
| 471 | /* prepare GfxElement on the fly */ | |
| 472 | gfx_element gfx; | |
| 473 | gfx.machine = machine; | |
| 474 | gfx.width = width; | |
| 475 | gfx.height = height; | |
| 476 | gfx.total_elements = 1; | |
| 477 | gfx.color_depth = 256; | |
| 478 | gfx.color_granularity = 256; | |
| 479 | gfx.color_base = 0; | |
| 480 | gfx.total_colors = 0x20; | |
| 481 | gfx.pen_usage = NULL; | |
| 482 | gfx.gfxdata = gfxdata; | |
| 483 | gfx.line_modulo = width; | |
| 484 | gfx.char_modulo = 0; /* doesn't matter */ | |
| 485 | gfx.flags = 0; | |
| 486 | gfx.machine = machine; | |
| 487 | ||
| 488 | 472 | /* Bounds checking */ |
| 489 | 473 | if ( (gfxdata + width * height - 1) >= gfx_max ) |
| 490 | 474 | continue; |
| 491 | 475 | |
| 476 | gfx_element_build_temporary(&gfx, machine, gfxdata, width, height, width, 0, 256, 0); | |
| 477 | ||
| 492 | 478 | pdrawgfxzoom( bitmap,&gfx, |
| 493 | 479 | 0, |
| 494 | 480 | color_start >> 4, |
| r4135 | r4136 | |
| 500 | 486 | } |
| 501 | 487 | else |
| 502 | 488 | { |
| 503 | /* prepare GfxElement on the fly */ | |
| 504 | gfx_element gfx; | |
| 505 | gfx.machine = machine; | |
| 506 | gfx.width = width; | |
| 507 | gfx.height = height; | |
| 508 | gfx.total_elements = 1; | |
| 509 | gfx.color_depth = 16; | |
| 510 | gfx.color_granularity = 16; | |
| 511 | gfx.color_base = 0; | |
| 512 | gfx.total_colors = 0x200; | |
| 513 | gfx.pen_usage = NULL; | |
| 514 | gfx.gfxdata = gfxdata; | |
| 515 | gfx.line_modulo = width/2; | |
| 516 | gfx.char_modulo = 0; /* doesn't matter */ | |
| 517 | gfx.flags = GFX_ELEMENT_PACKED; | |
| 518 | gfx.machine = machine; | |
| 519 | ||
| 520 | 489 | /* Bounds checking */ |
| 521 | 490 | if ( (gfxdata + width/2 * height - 1) >= gfx_max ) |
| 522 | 491 | continue; |
| 523 | 492 | |
| 493 | gfx_element_build_temporary(&gfx, machine, gfxdata, width, height, width/2, 0, 16, GFX_ELEMENT_PACKED); | |
| 494 | ||
| 524 | 495 | pdrawgfxzoom( bitmap,&gfx, |
| 525 | 496 | 0, |
| 526 | 497 | (color ^ 0x0f) + color_start, |
| r4135 | r4136 | |
|---|---|---|
| 2734 | 2734 | { |
| 2735 | 2735 | logerror("--- frame ---\n"); |
| 2736 | 2736 | |
| 2737 | sys24_tile_update(screen->machine); | |
| 2738 | 2737 | bitmap_fill(bitmap, cliprect, screen->machine->pens[0]); |
| 2739 | 2738 | bitmap_fill(sys24_bitmap, cliprect, 0); |
| 2740 | 2739 |
| r4135 | r4136 | |
|---|---|---|
| 81 | 81 | |
| 82 | 82 | static UINT16 *sys24_char_ram, *sys24_tile_ram; |
| 83 | 83 | static UINT16 sys24_tile_mask; |
| 84 | static UINT8 *sys24_char_dirtymap; | |
| 85 | static int sys24_char_dirty, sys24_char_gfx_index; | |
| 84 | static int sys24_char_gfx_index; | |
| 86 | 85 | static tilemap *sys24_tile_layer[4]; |
| 87 | 86 | |
| 88 | 87 | #ifdef LSB_FIRST |
| r4135 | r4136 | |
| 135 | 134 | SET_TILE_INFO(sys24_char_gfx_index, val & sys24_tile_mask, (val >> 7) & 0xff, 0); |
| 136 | 135 | } |
| 137 | 136 | |
| 138 | static STATE_POSTLOAD( sys24_tile_dirtyall ) | |
| 139 | { | |
| 140 | memset(sys24_char_dirtymap, 1, SYS24_TILES); | |
| 141 | sys24_char_dirty = 1; | |
| 142 | } | |
| 143 | ||
| 144 | 137 | void sys24_tile_vh_start(running_machine *machine, UINT16 tile_mask) |
| 145 | 138 | { |
| 146 | 139 | sys24_tile_mask = tile_mask; |
| r4135 | r4136 | |
| 154 | 147 | |
| 155 | 148 | sys24_tile_ram = auto_malloc(0x10000); |
| 156 | 149 | |
| 157 | sys24_char_dirtymap = auto_malloc(SYS24_TILES); | |
| 158 | ||
| 159 | 150 | sys24_tile_layer[0] = tilemap_create(machine, sys24_tile_info_0s, tilemap_scan_rows, 8, 8, 64, 64); |
| 160 | 151 | sys24_tile_layer[1] = tilemap_create(machine, sys24_tile_info_0w, tilemap_scan_rows, 8, 8, 64, 64); |
| 161 | 152 | sys24_tile_layer[2] = tilemap_create(machine, sys24_tile_info_1s, tilemap_scan_rows, 8, 8, 64, 64); |
| r4135 | r4136 | |
| 168 | 159 | |
| 169 | 160 | memset(sys24_char_ram, 0, 0x80000); |
| 170 | 161 | memset(sys24_tile_ram, 0, 0x10000); |
| 171 | memset(sys24_char_dirtymap, 1, SYS24_TILES); | |
| 172 | sys24_char_dirty = 1; | |
| 173 | 162 | |
| 174 | machine->gfx[sys24_char_gfx_index] = alloc | |
| 163 | machine->gfx[sys24_char_gfx_index] = gfx_element_alloc | |
| 175 | 164 | |
| 176 | machine->gfx[sys24_char_gfx_index]->total_colors = machine->config->total_colors / 16; | |
| 177 | ||
| 178 | 165 | state_save_register_global_pointer(machine, sys24_tile_ram, 0x10000/2); |
| 179 | 166 | state_save_register_global_pointer(machine, sys24_char_ram, 0x80000/2); |
| 180 | state_save_register_postload(machine, sys24_tile_dirtyall, NULL); | |
| 181 | 167 | } |
| 182 | 168 | |
| 183 | void sys24_tile_update(running_machine *machine) | |
| 184 | { | |
| 185 | if(sys24_char_dirty) { | |
| 186 | int i; | |
| 187 | for(i=0; i<SYS24_TILES; i++) { | |
| 188 | if(sys24_char_dirtymap[i]) { | |
| 189 | sys24_char_dirtymap[i] = 0; | |
| 190 | decodechar(machine->gfx[sys24_char_gfx_index], i, (UINT8 *)sys24_char_ram); | |
| 191 | } | |
| 192 | } | |
| 193 | tilemap_mark_all_tiles_dirty(sys24_tile_layer[0]); | |
| 194 | tilemap_mark_all_tiles_dirty(sys24_tile_layer[1]); | |
| 195 | tilemap_mark_all_tiles_dirty(sys24_tile_layer[2]); | |
| 196 | tilemap_mark_all_tiles_dirty(sys24_tile_layer[3]); | |
| 197 | sys24_char_dirty = 0; | |
| 198 | } | |
| 199 | } | |
| 200 | ||
| 201 | 169 | static void sys24_tile_draw_rect(running_machine *machine, bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask, |
| 202 | 170 | UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2) |
| 203 | 171 | { |
| r4135 | r4136 | |
| 604 | 572 | UINT16 old = sys24_char_ram[offset]; |
| 605 | 573 | COMBINE_DATA(sys24_char_ram + offset); |
| 606 | 574 | if(old != sys24_char_ram[offset]) { |
| 607 | sys24_char_dirtymap[offset / 16] = 1; | |
| 608 | sys24_char_dirty = 1; | |
| 575 | gfx_element_mark_dirty(space->machine->gfx[sys24_char_gfx_index], offset / 16); | |
| 609 | 576 | } |
| 610 | 577 | } |
| 611 | 578 |
| r4135 | r4136 | |
|---|---|---|
| 12 | 12 | // Tilemaps |
| 13 | 13 | // System24 |
| 14 | 14 | void sys24_tile_vh_start(running_machine *machine, UINT16 tile_mask); |
| 15 | void sys24_tile_update(running_machine *machine); | |
| 16 | 15 | void sys24_tile_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, int pri, int flags); |
| 17 | 16 | |
| 18 | 17 | READ16_HANDLER(sys24_tile_r); |
| r4135 | r4136 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | UINT16 *lemmings_pixel_0_data,*lemmings_pixel_1_data,*lemmings_vram_data,*lemmings_control_data; |
| 19 | 19 | static UINT16 *sprite_triple_buffer_0,*sprite_triple_buffer_1; |
| 20 | static UINT8 *vram_buffer | |
| 20 | static UINT8 *vram_buffer | |
| 21 | 21 | static bitmap_t *bitmap0; |
| 22 | 22 | static tilemap *vram_tilemap; |
| 23 | 23 | |
| r4135 | r4136 | |
| 97 | 97 | vram_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_cols,8,8,64,32); |
| 98 | 98 | |
| 99 | 99 | vram_buffer = (UINT8*)auto_malloc(2048*64); /* 64 bytes per VRAM character */ |
| 100 | vram_dirty = (UINT8*)auto_malloc(2048); | |
| 101 | 100 | sprite_triple_buffer_0 = (UINT16*)auto_malloc(0x800); |
| 102 | 101 | sprite_triple_buffer_1 = (UINT16*)auto_malloc(0x800); |
| 103 | 102 | |
| 104 | 103 | tilemap_set_transparent_pen(vram_tilemap,0); |
| 105 | 104 | bitmap_fill(bitmap0,0,0x100); |
| 105 | ||
| 106 | gfx_element_set_source(machine->gfx[2], vram_buffer); | |
| 106 | 107 | } |
| 107 | 108 | |
| 108 | 109 | VIDEO_EOF( lemmings ) |
| r4135 | r4136 | |
| 148 | 149 | |
| 149 | 150 | /* Copy pixel to buffer for easier decoding later */ |
| 150 | 151 | tile=((sx/8)*32)+(sy/8); |
| 151 | | |
| 152 | gfx_element_mark_dirty(space->machine->gfx[2], tile) | |
| 152 | 153 | vram_buffer[(tile*64) + ((sx&7)) + ((sy&7)*8)]=(src>>8)&0xf; |
| 153 | 154 | |
| 154 | 155 | sx+=1; /* Update both pixels in the word */ |
| r4135 | r4136 | |
| 163 | 164 | |
| 164 | 165 | VIDEO_UPDATE( lemmings ) |
| 165 | 166 | { |
| 166 | int x1=-lemmings_control_data[0],x0=-lemmings_control_data[2], | |
| 167 | int x1=-lemmings_control_data[0],x0=-lemmings_control_data[2], | |
| 167 | 168 | rectangle rect; |
| 168 | 169 | rect.max_y=cliprect->max_y; |
| 169 | 170 | rect.min_y=cliprect->min_y; |
| 170 | 171 | |
| 171 | /* Decode any characters that have changed in vram */ | |
| 172 | for (i=0; i<2048; i++) { | |
| 173 | if (vram_dirty[i]) { | |
| 174 | decodechar(screen->machine->gfx[2],i,vram_buffer); | |
| 175 | tilemap_mark_tile_dirty(vram_tilemap,i); | |
| 176 | vram_dirty[i]=0; | |
| 177 | } | |
| 178 | } | |
| 179 | ||
| 180 | 172 | bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); |
| 181 | 173 | draw_sprites(screen->machine,bitmap,cliprect,sprite_triple_buffer_1,1,0x0000); |
| 182 | 174 |
| r4135 | r4136 | |
|---|---|---|
| 11 | 11 | #include "includes/tiamc1.h" |
| 12 | 12 | |
| 13 | 13 | |
| 14 | UINT8 *tiamc1_tileram; | |
| 15 | UINT8 *tiamc1_charram; | |
| 16 | UINT8 *tiamc1_spriteram_x; | |
| 17 | UINT8 *tiamc1_spriteram_y; | |
| 18 | UINT8 *tiamc1_spriteram_a; | |
| 19 | UINT8 *tiamc1_spriteram_n; | |
| 14 | static UINT8 *tiamc1_tileram; | |
| 15 | static UINT8 *tiamc1_charram; | |
| 16 | static UINT8 *tiamc1_spriteram_x; | |
| 17 | static UINT8 *tiamc1_spriteram_y; | |
| 18 | static UINT8 *tiamc1_spriteram_a; | |
| 19 | static UINT8 *tiamc1_spriteram_n; | |
| 20 | 20 | static UINT8 tiamc1_layers_ctrl; |
| 21 | 21 | static UINT8 tiamc1_bg_vshift; |
| 22 | 22 | static UINT8 tiamc1_bg_hshift; |
| r4135 | r4136 | |
| 35 | 35 | if(!(tiamc1_layers_ctrl & 16)) |
| 36 | 36 | tiamc1_charram[offset + 0x1800] = data; |
| 37 | 37 | |
| 38 | if((tiamc1_layers_ctrl & 30) ^ 0xff) | |
| 39 | tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); | |
| 38 | if ((tiamc1_layers_ctrl & (16|8|4|2)) != (16|8|4|2)) | |
| 39 | gfx_element_mark_dirty(space->machine->gfx[0], (offset / 8) & 0xff); | |
| 40 | 40 | |
| 41 | 41 | if(!(tiamc1_layers_ctrl & 1)) { |
| 42 | 42 | tiamc1_tileram[offset] = data; |
| 43 | if (offset >= 1024) | |
| 44 | tilemap_mark_tile_dirty(bg_tilemap1, offset); | |
| 43 | if (offset < 1024) | |
| 44 | tilemap_mark_tile_dirty(bg_tilemap1, offset & 0x3ff); | |
| 45 | 45 | else |
| 46 | tilemap_mark_tile_dirty(bg_tilemap2, offset); | |
| 46 | tilemap_mark_tile_dirty(bg_tilemap2, offset & 0x3ff); | |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| r4135 | r4136 | |
| 122 | 122 | |
| 123 | 123 | static TILE_GET_INFO( get_bg1_tile_info ) |
| 124 | 124 | { |
| 125 | int code = tiamc1_tileram[tile_index]; | |
| 126 | ||
| 127 | decodechar(machine->gfx[0], code, tiamc1_charram); | |
| 128 | ||
| 129 | SET_TILE_INFO(0, code, 0, 0); | |
| 125 | SET_TILE_INFO(0, tiamc1_tileram[tile_index], 0, 0); | |
| 130 | 126 | } |
| 131 | 127 | |
| 132 | 128 | static TILE_GET_INFO( get_bg2_tile_info ) |
| 133 | 129 | { |
| 134 | int code = tiamc1_tileram[tile_index + 1024]; | |
| 135 | ||
| 136 | decodechar(machine->gfx[0], code, tiamc1_charram); | |
| 137 | ||
| 138 | SET_TILE_INFO(0, code, 0, 0); | |
| 130 | SET_TILE_INFO(0, tiamc1_tileram[tile_index + 1024], 0, 0); | |
| 139 | 131 | } |
| 140 | 132 | |
| 141 | 133 | VIDEO_START( tiamc1 ) |
| 142 | 134 | { |
| 135 | UINT8 *video_ram; | |
| 136 | ||
| 137 | video_ram = auto_malloc(0x3040); | |
| 138 | memset(video_ram, 0, 0x3040); | |
| 139 | ||
| 140 | tiamc1_charram = video_ram + 0x0800; /* Ram is banked */ | |
| 141 | tiamc1_tileram = video_ram + 0x0000; | |
| 142 | ||
| 143 | tiamc1_spriteram_y = video_ram + 0x3000; | |
| 144 | tiamc1_spriteram_x = video_ram + 0x3010; | |
| 145 | tiamc1_spriteram_n = video_ram + 0x3020; | |
| 146 | tiamc1_spriteram_a = video_ram + 0x3030; | |
| 147 | ||
| 148 | state_save_register_global_pointer(machine, video_ram, 0x3040); | |
| 149 | ||
| 143 | 150 | bg_tilemap1 = tilemap_create(machine, get_bg1_tile_info, tilemap_scan_rows, |
| 144 | 151 | 8, 8, 32, 32); |
| 145 | 152 | |
| r4135 | r4136 | |
| 152 | 159 | state_save_register_global(machine, tiamc1_layers_ctrl); |
| 153 | 160 | state_save_register_global(machine, tiamc1_bg_vshift); |
| 154 | 161 | state_save_register_global(machine, tiamc1_bg_hshift); |
| 162 | ||
| 163 | gfx_element_set_source(machine->gfx[0], tiamc1_charram); | |
| 155 | 164 | } |
| 156 | 165 | |
| 157 | 166 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| r4135 | r4136 | |
|---|---|---|
| 948 | 948 | const rectangle *clip,int priority) |
| 949 | 949 | { |
| 950 | 950 | int pal_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors); |
| 951 | UINT8 *source_base = gfx | |
| 951 | const UINT8 *source_base = gfx_element_get_data | |
| 952 | 952 | |
| 953 | 953 | int sprite_screen_height = ((1<<16)*gfx->height+0x8000)>>16; |
| 954 | 954 | int sprite_screen_width = ((1<<16)*gfx->width+0x8000)>>16; |
| r4135 | r4136 | |
| 1018 | 1018 | |
| 1019 | 1019 | for( y=sy; y<ey; y++ ) |
| 1020 | 1020 | { |
| 1021 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1021 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1022 | 1022 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 1023 | 1023 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0); |
| 1024 | 1024 |
| r4135 | r4136 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | static double rweights[3], gweights[3], bweights[2]; |
| 15 | 15 | |
| 16 | static UINT8 *dirtychar; | |
| 17 | 16 | static UINT8 video_control; |
| 18 | 17 | static UINT8 video_flip; |
| 19 | 18 | static UINT8 vblank_latch; |
| r4135 | r4136 | |
| 209 | 208 | 3, rg_resistances, gweights, 220, 0, |
| 210 | 209 | 2, b_resistances, bweights, 220, 0); |
| 211 | 210 | |
| 212 | /* allocate paletteram */ | |
| 213 | dirtychar = auto_malloc(256); | |
| 214 | memset(dirtychar, 1, 256); | |
| 211 | gfx_element_set_source(machine->gfx[0], &videoram[0x800]); | |
| 215 | 212 | |
| 216 | 213 | /* allocate paletteram */ |
| 217 | 214 | paletteram = auto_malloc(0x80); |
| r4135 | r4136 | |
| 288 | 285 | |
| 289 | 286 | /* track which characters are dirty */ |
| 290 | 287 | if (offset & 0x800) |
| 291 | dirtyc | |
| 288 | gfx_element_mark_dirty(space->machine->gfx[0], (offset & 0x7ff) / 8) | |
| 292 | 289 | } |
| 293 | 290 | |
| 294 | 291 | |
| r4135 | r4136 | |
| 658 | 655 | int offs = effy * 32 + (x ^ flipmask); |
| 659 | 656 | UINT8 tile = videoram[offs]; |
| 660 | 657 | |
| 661 | /* if the tile is dirty, decode it */ | |
| 662 | if (dirtychar[tile]) | |
| 663 | { | |
| 664 | decodechar(machine->gfx[0], tile, &videoram[0x800]); | |
| 665 | dirtychar[tile] = 0; | |
| 666 | } | |
| 667 | ||
| 668 | 658 | /* draw the tile */ |
| 669 | 659 | drawgfx(bitmap, machine->gfx[0], tile, tile >> 4, video_flip, video_flip, x*8, y*8, cliprect, TRANSPARENCY_PENS, transparent_pens[tile >> 4]); |
| 670 | 660 | } |
| r4135 | r4136 | |
|---|---|---|
| 590 | 590 | K052109_tilemap_update(); |
| 591 | 591 | |
| 592 | 592 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],TILEMAP_DRAW_OPAQUE,0); |
| 593 | if ((priorityflag & 1) == 1) K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 593 | if ((priorityflag & 1) == 1) K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 594 | 594 | tilemap_draw(bitmap,cliprect,K052109_tilemap[1],0,0); |
| 595 | if ((priorityflag & 1) == 0) K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 595 | if ((priorityflag & 1) == 0) K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 596 | 596 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,0); |
| 597 | 597 | return 0; |
| 598 | 598 | } |
| r4135 | r4136 | |
| 602 | 602 | K052109_tilemap_update(); |
| 603 | 603 | |
| 604 | 604 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],TILEMAP_DRAW_OPAQUE,0); |
| 605 | if ((priorityflag & 1) == 1) K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 605 | if ((priorityflag & 1) == 1) K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 606 | 606 | tilemap_draw(bitmap,cliprect,K052109_tilemap[1],0,0); |
| 607 | if ((priorityflag & 1) == 0) K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 607 | if ((priorityflag & 1) == 0) K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 608 | 608 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,0); |
| 609 | 609 | return 0; |
| 610 | 610 | } |
| r4135 | r4136 | |
| 634 | 634 | tilemap_draw(bitmap,cliprect,K052109_tilemap[sorted_layer[1]],0,2); |
| 635 | 635 | tilemap_draw(bitmap,cliprect,K052109_tilemap[sorted_layer[2]],0,4); |
| 636 | 636 | |
| 637 | K051960_sprites_draw(bitmap,cliprect,-1,-1); | |
| 637 | K051960_sprites_draw(screen->machine,bitmap,cliprect,-1,-1); | |
| 638 | 638 | return 0; |
| 639 | 639 | } |
| 640 | 640 | |
| r4135 | r4136 | |
| 664 | 664 | tilemap_draw(bitmap,cliprect,K052109_tilemap[sorted_layer[1]],0,2); |
| 665 | 665 | tilemap_draw(bitmap,cliprect,K052109_tilemap[sorted_layer[2]],0,4); |
| 666 | 666 | |
| 667 | K053245_sprites_draw(0, bitmap,cliprect); | |
| 667 | K053245_sprites_draw(screen->machine, 0, bitmap,cliprect); | |
| 668 | 668 | return 0; |
| 669 | 669 | } |
| 670 | 670 | |
| r4135 | r4136 | |
| 724 | 724 | glfgreat_pixel = *BITMAP_ADDR16(bitmap,0x80,0x105); |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | K053245_sprites_draw(0, bitmap,cliprect); | |
| 727 | K053245_sprites_draw(screen->machine, 0, bitmap,cliprect); | |
| 728 | 728 | return 0; |
| 729 | 729 | } |
| 730 | 730 | |
| r4135 | r4136 | |
| 804 | 804 | tilemap_draw(bitmap,cliprect,K052109_tilemap[sorted_layer[1]],0,2); |
| 805 | 805 | tilemap_draw(bitmap,cliprect,K052109_tilemap[sorted_layer[2]],0,4); |
| 806 | 806 | |
| 807 | K051960_sprites_draw(bitmap,cliprect,-1,-1); | |
| 807 | K051960_sprites_draw(screen->machine,bitmap,cliprect,-1,-1); | |
| 808 | 808 | return 0; |
| 809 | 809 | } |
| 810 | 810 |
| r4135 | r4136 | |
|---|---|---|
| 22 | 22 | |
| 23 | 23 | static int taitojc_gfx_index; |
| 24 | 24 | |
| 25 | static UINT8 *taitojc_dirty_map; | |
| 26 | 25 | static UINT32 *taitojc_char_ram; |
| 27 | 26 | static UINT32 *taitojc_tile_ram; |
| 28 | static int taitojc_char_dirty; | |
| 29 | 27 | static tilemap *taitojc_tilemap; |
| 30 | 28 | |
| 31 | 29 | static poly_manager *poly; |
| r4135 | r4136 | |
| 51 | 49 | SET_TILE_INFO(taitojc_gfx_index, tile, color, 0); |
| 52 | 50 | } |
| 53 | 51 | |
| 54 | static void taitojc_tile_update(running_machine *machine) | |
| 55 | { | |
| 56 | int i; | |
| 57 | if (taitojc_char_dirty) | |
| 58 | { | |
| 59 | for (i=0; i < TAITOJC_NUM_TILES; i++) | |
| 60 | { | |
| 61 | if (taitojc_dirty_map[i]) | |
| 62 | { | |
| 63 | taitojc_dirty_map[i] = 0; | |
| 64 | decodechar(machine->gfx[taitojc_gfx_index], i, (UINT8 *)taitojc_char_ram); | |
| 65 | } | |
| 66 | } | |
| 67 | tilemap_mark_all_tiles_dirty(taitojc_tilemap); | |
| 68 | taitojc_char_dirty = 0; | |
| 69 | } | |
| 70 | } | |
| 71 | ||
| 72 | 52 | READ32_HANDLER(taitojc_tile_r) |
| 73 | 53 | { |
| 74 | 54 | return taitojc_tile_ram[offset]; |
| r4135 | r4136 | |
| 88 | 68 | WRITE32_HANDLER(taitojc_char_w) |
| 89 | 69 | { |
| 90 | 70 | COMBINE_DATA(taitojc_char_ram + offset); |
| 91 | taitojc_dirty_map[offset/32] = 1; | |
| 92 | taitojc_char_dirty = 1; | |
| 71 | gfx_element_mark_dirty(space->machine->gfx[taitojc_gfx_index], offset/32); | |
| 93 | 72 | } |
| 94 | 73 | |
| 95 | 74 | // Object data format: |
| r4135 | r4136 | |
| 196 | 175 | { |
| 197 | 176 | int width, height; |
| 198 | 177 | |
| 199 | taitojc_char_dirty = 1; | |
| 200 | ||
| 201 | 178 | poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS); |
| 202 | 179 | add_exit_callback(machine, taitojc_exit); |
| 203 | 180 | |
| r4135 | r4136 | |
| 209 | 186 | assert(taitojc_gfx_index != MAX_GFX_ELEMENTS); |
| 210 | 187 | |
| 211 | 188 | taitojc_tilemap = tilemap_create(machine, taitojc_tile_info, tilemap_scan_rows, 16, 16, 64, 64); |
| 212 | taitojc_dirty_map = auto_malloc(TAITOJC_NUM_TILES); | |
| 213 | 189 | |
| 214 | 190 | tilemap_set_transparent_pen(taitojc_tilemap, 0); |
| 215 | 191 | |
| r4135 | r4136 | |
| 220 | 196 | memset(taitojc_tile_ram, 0, 0x4000); |
| 221 | 197 | |
| 222 | 198 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 223 | machine->gfx[taitojc_gfx_index] = alloc | |
| 199 | machine->gfx[taitojc_gfx_index] = gfx_element_alloc | |
| 224 | 200 | |
| 225 | /* set the color information */ | |
| 226 | machine->gfx[taitojc_gfx_index]->total_colors = machine->config->total_colors / 16; | |
| 227 | ||
| 228 | 201 | taitojc_texture = auto_malloc(0x400000); |
| 229 | 202 | |
| 230 | 203 | framebuffer = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| r4135 | r4136 | |
| 280 | 253 | } |
| 281 | 254 | } |
| 282 | 255 | |
| 283 | taitojc_tile_update(screen->machine); | |
| 284 | 256 | tilemap_draw(bitmap, cliprect, taitojc_tilemap, 0,0); |
| 285 | 257 | |
| 286 | 258 | #if 0 |
| r4135 | r4136 | |
|---|---|---|
| 76 | 76 | { |
| 77 | 77 | tilemap_draw(bitmap,cliprect,K052109_tilemap[1],TILEMAP_DRAW_OPAQUE,1); |
| 78 | 78 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,2); |
| 79 | K051960_sprites_draw(bitmap,cliprect,-1,-1); | |
| 79 | K051960_sprites_draw(screen->machine,bitmap,cliprect,-1,-1); | |
| 80 | 80 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,0); |
| 81 | 81 | } |
| 82 | 82 |
| r4135 | r4136 | |
|---|---|---|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /* then draw it */ |
| 209 | draw_scanline16(bitmap, cliprect->min_x, y, cliprect->max_x - cliprect->min_x + 1, &scanline[cliprect->min_x], NULL | |
| 209 | draw_scanline16(bitmap, cliprect->min_x, y, cliprect->max_x - cliprect->min_x + 1, &scanline[cliprect->min_x], NULL | |
| 210 | 210 | } |
| 211 | 211 | return 0; |
| 212 | 212 | } |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | static INT32 st0016_spr_bank,st0016_spr2_bank,st0016_pal_bank,st0016_char_bank; |
| 16 | 16 | static int spr_dx,spr_dy; |
| 17 | static UINT8 *chardirty; | |
| 18 | 17 | |
| 19 | 18 | static UINT8 st0016_vregs[0xc0]; |
| 20 | 19 | static int st0016_ramgfx; |
| r4135 | r4136 | |
| 115 | 114 | WRITE8_HANDLER(st0016_character_ram_w) |
| 116 | 115 | { |
| 117 | 116 | st0016_charram[ST0016_CHAR_BANK_SIZE*st0016_char_bank+offset]=data; |
| 118 | | |
| 117 | gfx_element_mark_dirty(space->machine->gfx[st0016_ramgfx], st0016_char_bank) | |
| 119 | 118 | } |
| 120 | 119 | |
| 121 | 120 | READ8_HANDLER(st0016_vregs_r) |
| r4135 | r4136 | |
| 353 | 352 | int yloop,xloop; |
| 354 | 353 | int ypos, xpos; |
| 355 | 354 | int tileno; |
| 356 | UINT8 *srcgfx; | |
| 355 | const UINT8 *srcgfx; | |
| 357 | 356 | int gfxoffs; |
| 358 | 357 | ypos = sy+y0*8+spr_dy; |
| 359 | 358 | xpos = sx+x0*8+spr_dx; |
| 360 | 359 | tileno = (code+i0++)&ST0016_CHAR_BANK_MASK ; |
| 361 | 360 | |
| 362 | if (chardirty[tileno]) | |
| 363 | { | |
| 364 | chardirty[tileno] = 0; | |
| 365 | decodechar(gfx, tileno, (UINT8 *) st0016_charram); | |
| 366 | } | |
| 367 | ||
| 368 | 361 | gfxoffs = 0; |
| 369 | srcgfx= gfx | |
| 362 | srcgfx= gfx_element_get_data | |
| 370 | 363 | |
| 371 | 364 | for (yloop=0; yloop<8; yloop++) |
| 372 | 365 | { |
| r4135 | r4136 | |
| 424 | 417 | } |
| 425 | 418 | } |
| 426 | 419 | |
| 427 | static STATE_POSTLOAD( st0016_postload ) | |
| 428 | { | |
| 429 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 430 | 420 | |
| 431 | st0016_rom_bank_w(space,0,st0016_rom_bank); | |
| 432 | memset(chardirty, 1, ST0016_MAX_CHAR_BANK); | |
| 433 | } | |
| 434 | ||
| 435 | ||
| 436 | 421 | void st0016_save_init(running_machine *machine) |
| 437 | 422 | { |
| 438 | 423 | state_save_register_global(machine, st0016_spr_bank); |
| r4135 | r4136 | |
| 444 | 429 | state_save_register_global_pointer(machine, st0016_charram, ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE); |
| 445 | 430 | state_save_register_global_pointer(machine, st0016_paletteram, ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE); |
| 446 | 431 | state_save_register_global_pointer(machine, st0016_spriteram, ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE); |
| 447 | state_save_register_postload(machine, st0016_postload, NULL); | |
| 448 | 432 | } |
| 449 | 433 | |
| 450 | 434 | |
| r4135 | r4136 | |
| 463 | 447 | assert(gfx_index != MAX_GFX_ELEMENTS); |
| 464 | 448 | |
| 465 | 449 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 466 | machine->gfx[gfx_index] = allocgfx(machine, &charlayout); | |
| 467 | chardirty = auto_malloc(ST0016_MAX_CHAR_BANK); | |
| 468 | memset(chardirty, 1, ST0016_MAX_CHAR_BANK); | |
| 469 | ||
| 470 | /* set the color information */ | |
| 471 | machine->gfx[gfx_index]->color_base = 0; | |
| 472 | machine->gfx[gfx_index]->total_colors = 0x40; | |
| 450 | machine->gfx[gfx_index] = gfx_element_alloc(machine, &charlayout, (UINT8 *) st0016_charram, 0x40, 0); | |
| 473 | 451 | st0016_ramgfx = gfx_index; |
| 474 | 452 | |
| 475 | 453 | spr_dx=0; |
| r4135 | r4136 | |
| 531 | 509 | flipx=st0016_spriteram[i+3]&0x80; |
| 532 | 510 | flipy=st0016_spriteram[i+3]&0x40; |
| 533 | 511 | |
| 534 | if (chardirty[code]) | |
| 535 | { | |
| 536 | chardirty[code] = 0; | |
| 537 | decodechar(gfx, code, (UINT8 *) st0016_charram); | |
| 538 | } | |
| 539 | ||
| 540 | 512 | if(priority) |
| 541 | 513 | { |
| 542 | 514 | drawgfx(bitmap,gfx, |
| r4135 | r4136 | |
| 551 | 523 | UINT16 *destline; |
| 552 | 524 | int yloop,xloop; |
| 553 | 525 | int ypos, xpos; |
| 554 | UINT8 *srcgfx; | |
| 526 | const UINT8 *srcgfx; | |
| 555 | 527 | int gfxoffs; |
| 556 | 528 | ypos = y*8+spr_dy;//+((st0016_vregs[j+2]==0xaf)?0x50:0);//hack for mayjinsen title screen |
| 557 | 529 | xpos = x*8+spr_dx; |
| 558 | 530 | gfxoffs = 0; |
| 559 | srcgfx= gfx | |
| 531 | srcgfx= gfx_element_get_data | |
| 560 | 532 | |
| 561 | 533 | for (yloop=0; yloop<8; yloop++) |
| 562 | 534 | { |
| r4135 | r4136 | |
|---|---|---|
| 327 | 327 | static MC6845_UPDATE_ROW( update_row ) |
| 328 | 328 | { |
| 329 | 329 | qix_state *state = device->machine->driver_data; |
| 330 | UINT32 *dest = BITMAP_ADDR32(bitmap, y, 0); | |
| 330 | 331 | UINT16 x; |
| 331 | UINT8 scanline[256]; | |
| 332 | 332 | |
| 333 | 333 | pen_t *pens = (pen_t *)param; |
| 334 | 334 | |
| r4135 | r4136 | |
| 337 | 337 | offs_t offs_xor = state->flip ? 0xffff : 0; |
| 338 | 338 | |
| 339 | 339 | for (x = 0; x < x_count * 8; x++) |
| 340 | scanline[x] = state->videoram[(offs + x) ^ offs_xor]; | |
| 341 | ||
| 342 | draw_scanline8(bitmap, 0, y, x_count * 8, scanline, pens, -1); | |
| 340 | dest[x] = pens[state->videoram[(offs + x) ^ offs_xor]]; | |
| 343 | 341 | } |
| 344 | 342 | |
| 345 | 343 |
| r4135 | r4136 | |
|---|---|---|
| 134 | 134 | |
| 135 | 135 | if (alpha > 0) |
| 136 | 136 | { |
| 137 | K056832_tilemap_draw(screen->machine, bitmap, cliprect, 1, | |
| 137 | K056832_tilemap_draw(screen->machine, bitmap, cliprect, 1, | |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 |
| r4135 | r4136 | |
|---|---|---|
| 1941 | 1941 | addr = tileaddr + (jj * bpl * 16 * 32); |
| 1942 | 1942 | for( kk = 0; kk < 8; kk++ ) |
| 1943 | 1943 | { |
| 1944 | UINT32 *destline = BITMAP_ADDR32(bitmap, jj * 8 + kk, 0); | |
| 1945 | ||
| 1944 | 1946 | /* Clear buffers */ |
| 1945 | 1947 | memset( scanlines[MAINSCREEN].buffer, 0, SNES_SCR_WIDTH * 2 ); |
| 1946 | 1948 | memset( scanlines[MAINSCREEN].zbuf, 0, SNES_SCR_WIDTH * 2 ); |
| r4135 | r4136 | |
| 1960 | 1962 | } |
| 1961 | 1963 | addr += (bpl * 16); |
| 1962 | 1964 | } |
| 1963 | draw_scanline16( bitmap, 0, jj * 8 + kk, SNES_SCR_WIDTH * 2, scanlines[MAINSCREEN].buffer, machine->pens, 200 ); | |
| 1965 | for (ii = 0; ii < SNES_SCR_WIDTH * 2; ii++) | |
| 1966 | { | |
| 1967 | int pixdata = scanlines[MAINSCREEN].buffer[ii]; | |
| 1968 | if (pixdata != 200) | |
| 1969 | destline[ii] = machine->pens[pixdata]; | |
| 1970 | } | |
| 1964 | 1971 | addr -= (32 * (bpl * 16)) - 2; |
| 1965 | 1972 | } |
| 1966 | 1973 | } |
| r4135 | r4136 | |
| 2142 | 2149 | { |
| 2143 | 2150 | static UINT32 tmaddr = 0; |
| 2144 | 2151 | static INT8 tmbg = 0; |
| 2152 | UINT32 *destline = BITMAP_ADDR32(bitmap, curline, 0); | |
| 2145 | 2153 | if( curline == 0 ) |
| 2146 | 2154 | { |
| 2147 | 2155 | if( adjust & 0x1 ) tmaddr += 2; |
| r4135 | r4136 | |
| 2159 | 2167 | for( ii = 0; ii < SNES_SCR_WIDTH; ii++ ) |
| 2160 | 2168 | scanlines[MAINSCREEN].buffer[ii] = machine->pens[0]; |
| 2161 | 2169 | snes_dbg_draw_maps(bitmap, tmaddr, dm, curline, tmbg ); |
| 2162 | draw_scanline16( bitmap, 0, curline, SNES_SCR_WIDTH, scanlines[MAINSCREEN].buffer, machine->pens, 200 ); | |
| 2170 | for (ii = 0; ii < SNES_SCR_WIDTH; ii++) | |
| 2171 | { | |
| 2172 | int pixdata = scanlines[MAINSCREEN].buffer[ii]; | |
| 2173 | if (pixdata != 200) | |
| 2174 | destline[ii] = machine->pens[pixdata]; | |
| 2175 | } | |
| 2163 | 2176 | return 1; |
| 2164 | 2177 | } |
| 2165 | 2178 | } |
| 2166 | 2179 | |
| 2167 | 2180 | /* Draw some useful information about the back/fixed colours and current bg mode etc. */ |
| 2168 | *BITMAP_ADDR16(bitmap, curline, SNES_DBG_HORZ_POS - 26) = machine->pens[dbg_mode_colours[(snes_ram[CGWSEL] & 0xc0) >> 6]]; | |
| 2169 | *BITMAP_ADDR16(bitmap, curline, SNES_DBG_HORZ_POS - 24) = machine->pens[dbg_mode_colours[(snes_ram[CGWSEL] & 0x30) >> 4]]; | |
| 2170 | *BITMAP_ADDR16(bitmap, curline, SNES_DBG_HORZ_POS - 22) = machine->pens[dbg_mode_colours[snes_ram[BGMODE] & 0x7]]; | |
| 2171 | *BITMAP_ADDR16(bitmap, curline, SNES_DBG_HORZ_POS - 12) = machine->pens[32767]; | |
| 2172 | *BITMAP_ADDR16(bitmap, curline, SNES_DBG_HORZ_POS - 2 ) = machine->pens[32767]; | |
| 2181 | *BITMAP_ADDR32(bitmap, curline, SNES_DBG_HORZ_POS - 26) = machine->pens[dbg_mode_colours[(snes_ram[CGWSEL] & 0xc0) >> 6]]; | |
| 2182 | *BITMAP_ADDR32(bitmap, curline, SNES_DBG_HORZ_POS - 24) = machine->pens[dbg_mode_colours[(snes_ram[CGWSEL] & 0x30) >> 4]]; | |
| 2183 | *BITMAP_ADDR32(bitmap, curline, SNES_DBG_HORZ_POS - 22) = machine->pens[dbg_mode_colours[snes_ram[BGMODE] & 0x7]]; | |
| 2184 | *BITMAP_ADDR32(bitmap, curline, SNES_DBG_HORZ_POS - 12) = machine->pens[32767]; | |
| 2185 | *BITMAP_ADDR32(bitmap, curline, SNES_DBG_HORZ_POS - 2 ) = machine->pens[32767]; | |
| 2173 | 2186 | for( ii = 0; ii < 5; ii++ ) |
| 2174 | 2187 | { |
| 2175 | *BITMAP_ADDR16(bitmap, curline, SNES_DBG_HORZ_POS - 19 + ii) = snes_cgram[0]; | |
| 2176 | *BITMAP_ADDR16(bitmap, curline, SNES_DBG_HORZ_POS - 9 + ii) = snes_cgram[FIXED_COLOUR]; | |
| 2188 | *BITMAP_ADDR32(bitmap, curline, SNES_DBG_HORZ_POS - 19 + ii) = snes_cgram[0]; | |
| 2189 | *BITMAP_ADDR32(bitmap, curline, SNES_DBG_HORZ_POS - 9 + ii) = snes_cgram[FIXED_COLOUR]; | |
| 2177 | 2190 | } |
| 2178 | 2191 | /* Draw window positions */ |
| 2179 | 2192 | scanlines[MAINSCREEN].buffer[snes_ram[WH0]] = machine->pens[dbg_mode_colours[0]]; |
| r4135 | r4136 | |
|---|---|---|
| 146 | 146 | |
| 147 | 147 | #include "driver.h" |
| 148 | 148 | #include "cpu/m68000/m68000.h" |
| 149 | #include "sound/3812intf.h" | |
| 149 | 150 | #include "includes/toaplan2.h" |
| 150 | 151 | |
| 151 | 152 | |
| r4135 | r4136 | |
| 558 | 559 | toaplan2_vram_alloc(0); |
| 559 | 560 | truxton2_create_tilemaps_0(machine); |
| 560 | 561 | |
| 562 | if (machine->gfx[2]->srcdata == NULL) | |
| 563 | gfx_element_set_source(machine->gfx[2], (UINT8 *)toaplan2_tx_gfxram16); | |
| 564 | ||
| 561 | 565 | if(!strcmp(machine->gamedrv->name,"fixeighb")) |
| 562 | 566 | { |
| 563 | 567 | xoffset[0]=-26; |
| r4135 | r4136 | |
| 595 | 599 | memset(raizing_tx_gfxram16,0,RAIZING_TX_GFXRAM_SIZE); |
| 596 | 600 | state_save_register_global_pointer(machine, raizing_tx_gfxram16, RAIZING_TX_GFXRAM_SIZE/2); |
| 597 | 601 | |
| 602 | gfx_element_set_source(machine->gfx[2], (UINT8 *)raizing_tx_gfxram16); | |
| 603 | ||
| 598 | 604 | toaplan2_vram_alloc(0); |
| 599 | 605 | spriteram16_n[0] = spriteram16_new[0]; |
| 600 | 606 | |
| r4135 | r4136 | |
| 702 | 708 | /*** Dynamic GFX decoding for Truxton 2 / FixEight ***/ |
| 703 | 709 | |
| 704 | 710 | UINT16 oldword = toaplan2_tx_gfxram16[offset]; |
| 705 | UINT8 *toaplan2_tx_gfxram = (UINT8 *)(toaplan2_tx_gfxram16); | |
| 706 | 711 | |
| 707 | 712 | if (oldword != data) |
| 708 | 713 | { |
| 709 | 714 | int code = offset/32; |
| 710 | 715 | COMBINE_DATA(&toaplan2_tx_gfxram16[offset]); |
| 711 | decodechar(space->machine->gfx[2], code, toaplan2_tx_gfxram); | |
| 712 | ||
| 713 | tilemap_mark_all_tiles_dirty(tx_tilemap); | |
| 716 | gfx_element_mark_dirty(space->machine->gfx[2], code); | |
| 714 | 717 | } |
| 715 | 718 | } |
| 716 | 719 | |
| r4135 | r4136 | |
| 738 | 741 | /*** Only done once during start-up ***/ |
| 739 | 742 | |
| 740 | 743 | int code; |
| 741 | UINT8 *raizing_tx_gfxram = (UINT8 *)raizing_tx_gfxram16; | |
| 742 | 744 | UINT16 *dest = (UINT16 *)raizing_tx_gfxram16; |
| 743 | 745 | |
| 744 | 746 | memcpy(dest, toaplan2_txvideoram16, toaplan2_tx_vram_size); |
| r4135 | r4136 | |
| 749 | 751 | dest += (toaplan2_tx_offs_vram_size/2); |
| 750 | 752 | memcpy(dest, toaplan2_txscrollram16, toaplan2_tx_scroll_vram_size); |
| 751 | 753 | |
| 752 | /* Decode text characters */ | |
| 754 | /* Decode text characters; force them to update immediately */ | |
| 753 | 755 | for (code = 0; code < 1024; code++) |
| 754 | decodechar (space->machine->gfx[2], code, raizing_tx_gfxram); | |
| 755 | tilemap_mark_all_tiles_dirty(tx_tilemap); | |
| 756 | gfx_element_decode(space->machine->gfx[2], code); | |
| 756 | 757 | } |
| 757 | 758 | |
| 758 | 759 | WRITE16_HANDLER( batrider_objectbank_w ) |
| r4135 | r4136 | |
|---|---|---|
| 585 | 585 | }; |
| 586 | 586 | |
| 587 | 587 | |
| 588 | UINT8 *src_ptr; | |
| 588 | const UINT8 *src_ptr; | |
| 589 | 589 | const pen_t *pal_ptr, *rgb_ptr; |
| 590 | 590 | |
| 591 | 591 | int scrollx, sy, sx; |
| r4135 | r4136 | |
| 614 | 614 | else if (priority == 0x04) |
| 615 | 615 | { |
| 616 | 616 | // draw road |
| 617 | UINT8 *src_base = machine->gfx[1]->gfxdata; | |
| 618 | 617 | pen_t road_rgb[48]; |
| 619 | 618 | |
| 620 | 619 | for (i=0; i<48; i++) |
| r4135 | r4136 | |
| 633 | 632 | if ((road>>8) != 0x04) continue; |
| 634 | 633 | road &= YMASK; |
| 635 | 634 | |
| 636 | src_ptr = src_base + (road << 9); | |
| 635 | src_ptr = gfx_element_get_data(machine->gfx[1], (road << 3)); | |
| 636 | gfx_element_get_data(machine->gfx[1], (road << 3) + 1); | |
| 637 | gfx_element_get_data(machine->gfx[1], (road << 3) + 2); | |
| 638 | gfx_element_get_data(machine->gfx[1], (road << 3) + 3); | |
| 639 | gfx_element_get_data(machine->gfx[1], (road << 3) + 4); | |
| 640 | gfx_element_get_data(machine->gfx[1], (road << 3) + 5); | |
| 641 | gfx_element_get_data(machine->gfx[1], (road << 3) + 6); | |
| 642 | gfx_element_get_data(machine->gfx[1], (road << 3) + 7); | |
| 637 | 643 | mdy = ((road * MIDCURB_DY) >> 8) * bitmap->rowpixels; |
| 638 | 644 | tdy = ((road * TOPCURB_DY) >> 8) * bitmap->rowpixels; |
| 639 | 645 | |
| r4135 | r4136 | |
| 680 | 686 | int tmw_l2, int tmh_l2, // tilemap width and height in log(2) |
| 681 | 687 | int alpha, int pal_offset ) // alpha(0-3f), # of color codes to shift |
| 682 | 688 | { |
| 683 | UINT8 | |
| 689 | const UINT8 | |
| 684 | 690 | UINT16 *tmap_ptr; |
| 685 | 691 | UINT32 *dst_base, *dst_ptr; |
| 686 | 692 | const pen_t *pal_base, *pal_ptr; |
| r4135 | r4136 | |
| 706 | 712 | tmskipy = scrolly / tileh; |
| 707 | 713 | dy = -(scrolly & (tileh-1)); |
| 708 | 714 | |
| 709 | src_base = gfx->gfxdata; | |
| 710 | ||
| 711 | 715 | dst_base = BITMAP_ADDR32(bitmap, y0+dy, x0+dx); |
| 712 | 716 | |
| 713 | 717 | pal_base = machine->pens + pal_offset * gfx->color_granularity; |
| r4135 | r4136 | |
| 730 | 734 | // Wec Le Mans specific: decodes tile color in EAX |
| 731 | 735 | UINT16 tile_color = ((tiledata >> 5) & 0x78) + (tiledata >> 12); |
| 732 | 736 | |
| 733 | src_ptr = | |
| 737 | src_ptr = gfx_ | |
| 734 | 738 | pal_ptr = pal_base + tile_color * gfx->color_granularity; |
| 735 | 739 | dst_ptr = dst_base + j * tilew; |
| 736 | 740 |
| r4135 | r4136 | |
|---|---|---|
| 15 | 15 | |
| 16 | 16 | /******************************************************************************/ |
| 17 | 17 | |
| 18 | VIDEO_START( alpha68k_common_vh ) | |
| 19 | { | |
| 20 | state_save_register_global(machine, flipscreen); | |
| 21 | } | |
| 22 | ||
| 18 | 23 | void alpha68k_flipscreen_w(int flip) |
| 19 | 24 | { |
| 20 | 25 | flipscreen = flip; |
| r4135 | r4136 | |
| 71 | 76 | fix_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_cols,8,8,32,32); |
| 72 | 77 | |
| 73 | 78 | tilemap_set_transparent_pen(fix_tilemap,0); |
| 79 | ||
| 80 | state_save_register_global(machine, bank_base); | |
| 81 | ||
| 82 | VIDEO_START_CALL(alpha68k_common_vh); | |
| 74 | 83 | } |
| 75 | 84 | |
| 76 | 85 | /******************************************************************************/ |
| 86 | ||
| 77 | 87 | //AT |
| 78 | 88 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int j, int s, int e) |
| 79 | 89 | { |
| r4135 | r4136 | |
|---|---|---|
| 60 | 60 | |
| 61 | 61 | static int cischeat_ip_select; |
| 62 | 62 | static int shift_ret = 1; |
| 63 | static UINT8 drawmode_table[16]; | |
| 63 | 64 | |
| 64 | 65 | #ifdef MAME_DEBUG |
| 65 | 66 | static int debugsprites; // For debug purposes |
| r4135 | r4136 | |
| 129 | 130 | { |
| 130 | 131 | int i; |
| 131 | 132 | for (i = 0;i < 16;i++) |
| 132 | | |
| 133 | | |
| 133 | 134 | |
| 134 | gfx_drawmode_table[ 0] = DRAWMODE_SHADOW; | |
| 135 | gfx_drawmode_table[15] = DRAWMODE_NONE; | |
| 135 | drawmode_table[ 0] = DRAWMODE_SHADOW; | |
| 136 | drawmode_table[15] = DRAWMODE_NONE; | |
| 136 | 137 | } |
| 137 | 138 | |
| 138 | 139 | /************************************************************************** |
| r4135 | r4136 | |
| 923 | 924 | if (flipy) { ystart = ynum-1; yend = -1; yinc = -1; } |
| 924 | 925 | else { ystart = 0; yend = ynum; yinc = +1; } |
| 925 | 926 | |
| 927 | drawmode_table[ 0] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; | |
| 928 | ||
| 926 | 929 | for (y = ystart; y != yend; y += yinc) |
| 927 | 930 | { |
| 928 | 931 | for (x = xstart; x != xend; x += xinc) |
| 929 | 932 | { |
| 930 | drawgfxzoom(bitmap,machine->gfx[3], | |
| 933 | drawgfxzoom_transtable(bitmap,cliprect,machine->gfx[3], | |
| 931 | 934 | code++, |
| 932 | 935 | color, |
| 933 | 936 | flipx,flipy, |
| 934 | 937 | (sx + x * xdim) / 0x10000, (sy + y * ydim) / 0x10000, |
| 935 | cliprect, | |
| 936 | shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,15, | |
| 937 | xscale, yscale ); | |
| 938 | xscale, yscale, drawmode_table, machine->shadow_table); | |
| 938 | 939 | } |
| 939 | 940 | } |
| 940 | 941 | #ifdef MAME_DEBUG |
| r4135 | r4136 | |
| 1077 | 1078 | if (flipy) { ystart = ynum-1; yend = -1; yinc = -1; } |
| 1078 | 1079 | else { ystart = 0; yend = ynum; yinc = +1; } |
| 1079 | 1080 | |
| 1081 | drawmode_table[ 0] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; | |
| 1082 | ||
| 1080 | 1083 | for (y = ystart; y != yend; y += yinc) |
| 1081 | 1084 | { |
| 1082 | 1085 | for (x = xstart; x != xend; x += xinc) |
| 1083 | 1086 | { |
| 1084 | drawgfxzoom(bitmap,machine->gfx[3], | |
| 1087 | drawgfxzoom_transtable(bitmap,cliprect,machine->gfx[3], | |
| 1085 | 1088 | code++, |
| 1086 | 1089 | color, |
| 1087 | 1090 | flipx,flipy, |
| 1088 | 1091 | (sx + x * xdim) / 0x10000, (sy + y * ydim) / 0x10000, |
| 1089 | cliprect, | |
| 1090 | shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,15, | |
| 1091 | xscale, yscale ); | |
| 1092 | xscale, yscale, drawmode_table, machine->shadow_table); | |
| 1092 | 1093 | } |
| 1093 | 1094 | } |
| 1094 | 1095 | #ifdef MAME_DEBUG |
| r4135 | r4136 | |
|---|---|---|
| 558 | 558 | mydrawgfxzoom( |
| 559 | 559 | bitmap_t *dest_bmp,const gfx_element *gfx, |
| 560 | 560 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 561 | const rectangle *clip, | |
| 561 | const rectangle *clip, | |
| 562 | 562 | int scalex, int scaley, int z, int prioverchar, int alpha ) |
| 563 | 563 | { |
| 564 | 564 | int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; |
| r4135 | r4136 | |
| 597 | 597 | extra->prioverchar = prioverchar; |
| 598 | 598 | extra->line_modulo = gfx->line_modulo; |
| 599 | 599 | extra->pens = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 600 | extra->source = gfx | |
| 600 | extra->source = gfx_element_get_data | |
| 601 | 601 | #ifdef RENDER_AS_QUADS |
| 602 | 602 | poly_render_quad_fan(poly, dest_bmp, clip, renderscanline_sprite, 2, 4, &vert[0]); |
| 603 | 603 | #else |
| r4135 | r4136 | |
| 671 | 671 | flipx, flipy, |
| 672 | 672 | sx, sy, |
| 673 | 673 | &clip, |
| 674 | TRANSPARENCY_ALPHA, 0xff, | |
| 675 | 674 | (width<<16)/32, |
| 676 | 675 | (height<<16)/32, |
| 677 | 676 | zc, pri, 0xff - translucency ); |
| r4135 | r4136 | |
| 1063 | 1062 | |
| 1064 | 1063 | UINT32 *namcos22_tilemapattr; |
| 1065 | 1064 | |
| 1066 | static int cgsomethingisdirty; | |
| 1067 | static UINT8 *cgdirty; | |
| 1068 | 1065 | static UINT8 *dirtypal; |
| 1069 | 1066 | |
| 1070 | 1067 | READ32_HANDLER( namcos22_czram_r ) |
| r4135 | r4136 | |
| 1538 | 1535 | static void |
| 1539 | 1536 | DrawTranslucentCharacters( bitmap_t *bitmap, const rectangle *cliprect ) |
| 1540 | 1537 | { |
| 1541 | alpha_set_level( 0xff-mixer.text_translucency ); /* ? */ | |
| 1542 | tilemap_draw( bitmap, cliprect, bgtilemap, TILEMAP_DRAW_ALPHA|1, 0 ); | |
| 1538 | UINT8 alpha = 0xff-mixer.text_translucency; /* ? */ | |
| 1539 | tilemap_draw( bitmap, cliprect, bgtilemap, TILEMAP_DRAW_ALPHA(alpha)|1, 0 ); | |
| 1543 | 1540 | } |
| 1544 | 1541 | |
| 1545 | 1542 | static void DrawCharacterLayer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) |
| 1546 | 1543 | { |
| 1547 | unsigned i; | |
| 1548 | 1544 | INT32 dx = namcos22_tilemapattr[0]>>16; |
| 1549 | 1545 | INT32 dy = namcos22_tilemapattr[0]&0xffff; |
| 1550 | 1546 | /** |
| r4135 | r4136 | |
| 1552 | 1548 | * namcos22_tilemapattr[0x8/4] == 0x01ff0000 |
| 1553 | 1549 | * namcos22_tilemapattr[0xe/4] == ? |
| 1554 | 1550 | */ |
| 1555 | if( cgsomethingisdirty ) | |
| 1556 | { | |
| 1557 | for( i=0; i<64*64; i+=2 ) | |
| 1558 | { | |
| 1559 | UINT32 data = namcos22_textram[i/2]; | |
| 1560 | if( cgdirty[(data>>16)&0x3ff] ) | |
| 1561 | { | |
| 1562 | tilemap_mark_tile_dirty( bgtilemap,i ); | |
| 1563 | } | |
| 1564 | if( cgdirty[data&0x3ff] ) | |
| 1565 | { | |
| 1566 | tilemap_mark_tile_dirty( bgtilemap,i+1 ); | |
| 1567 | } | |
| 1568 | } | |
| 1569 | ||
| 1570 | for( i=0; i<NUM_CG_CHARS; i++ ) | |
| 1571 | { | |
| 1572 | if( cgdirty[i] ) | |
| 1573 | { | |
| 1574 | decodechar( machine->gfx[GFX_CHAR],i,(UINT8 *)namcos22_cgram ); | |
| 1575 | cgdirty[i] = 0; | |
| 1576 | } | |
| 1577 | } | |
| 1578 | cgsomethingisdirty = 0; | |
| 1579 | } | |
| 1580 | ||
| 1581 | 1551 | bitmap_fill(priority_bitmap,cliprect,0); |
| 1582 | 1552 | tilemap_set_scrollx( bgtilemap,0, (dx-0x35c)&0x3ff ); |
| 1583 | 1553 | tilemap_set_scrolly( bgtilemap,0, dy&0x3ff ); |
| r4135 | r4136 | |
| 2192 | 2162 | WRITE32_HANDLER( namcos22_cgram_w ) |
| 2193 | 2163 | { |
| 2194 | 2164 | COMBINE_DATA( &namcos22_cgram[offset] ); |
| 2195 | cgdirty[offset/32] = 1; | |
| 2196 | cgsomethingisdirty = 1; | |
| 2165 | gfx_element_mark_dirty(space->machine->gfx[GFX_CHAR],offset/32); | |
| 2197 | 2166 | } |
| 2198 | 2167 | |
| 2199 | 2168 | READ32_HANDLER( namcos22_gamma_r ) |
| r4135 | r4136 | |
| 2230 | 2199 | |
| 2231 | 2200 | static VIDEO_START( common ) |
| 2232 | 2201 | { |
| 2202 | int code; | |
| 2203 | ||
| 2233 | 2204 | bgtilemap = tilemap_create( machine, TextTilemapGetInfo,tilemap_scan_rows,16,16,64,64 ); |
| 2234 | 2205 | tilemap_set_transparent_pen( bgtilemap, 0xf ); |
| 2235 | 2206 | |
| 2236 | 2207 | mbDSPisActive = 0; |
| 2237 | 2208 | memset( namcos22_polygonram, 0xcc, 0x20000 ); |
| 2238 | 2209 | |
| 2210 | for (code = 0; code < machine->gfx[GFX_TEXTURE_TILE]->total_elements; code++) | |
| 2211 | gfx_element_decode(machine->gfx[GFX_TEXTURE_TILE], code); | |
| 2239 | 2212 | Prepare3dTexture(memory_region(machine, "textilemap"), machine->gfx[GFX_TEXTURE_TILE]->gfxdata ); |
| 2240 | 2213 | dirtypal = auto_malloc(NAMCOS22_PALETTE_SIZE/4); |
| 2241 | cgdirty = auto_malloc( 0x400 ); | |
| 2242 | 2214 | mPtRomSize = memory_region_length(machine, "pointrom")/3; |
| 2243 | 2215 | mpPolyL = memory_region(machine, "pointrom"); |
| 2244 | 2216 | mpPolyM = mpPolyL + mPtRomSize; |
| r4135 | r4136 | |
| 2251 | 2223 | #endif |
| 2252 | 2224 | add_reset_callback(machine, namcos22_reset); |
| 2253 | 2225 | add_exit_callback(machine, namcos22_exit); |
| 2226 | ||
| 2227 | gfx_element_set_source(machine->gfx[GFX_CHAR], (UINT8 *)namcos22_cgram); | |
| 2254 | 2228 | } |
| 2255 | 2229 | |
| 2256 | 2230 | VIDEO_START( namcos22 ) |
| r4135 | r4136 | |
|---|---|---|
| 107 | 107 | if (rockola_charram[offset] != data) |
| 108 | 108 | { |
| 109 | 109 | rockola_charram[offset] = data; |
| 110 | | |
| 110 | gfx_element_mark_ | |
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
| r4135 | r4136 | |
| 171 | 171 | int code = rockola_videoram2[tile_index]; |
| 172 | 172 | int color = colorram[tile_index] & 0x07; |
| 173 | 173 | |
| 174 | decodechar(machine->gfx[0], code, rockola_charram); | |
| 175 | ||
| 176 | 174 | SET_TILE_INFO(0, code, color, 0); |
| 177 | 175 | } |
| 178 | 176 | |
| r4135 | r4136 | |
| 182 | 180 | fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); |
| 183 | 181 | |
| 184 | 182 | tilemap_set_transparent_pen(fg_tilemap, 0); |
| 183 | ||
| 184 | gfx_element_set_source(machine->gfx[0], rockola_charram); | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | VIDEO_UPDATE( rockola ) |
| r4135 | r4136 | |
| 291 | 291 | int code = rockola_videoram2[tile_index]; |
| 292 | 292 | int color = colorram[tile_index] & 0x03; |
| 293 | 293 | |
| 294 | decodechar(machine->gfx[0], code, rockola_charram); | |
| 295 | ||
| 296 | 294 | SET_TILE_INFO(0, code, color, 0); |
| 297 | 295 | } |
| 298 | 296 | |
| r4135 | r4136 | |
| 302 | 300 | fg_tilemap = tilemap_create(machine, satansat_get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); |
| 303 | 301 | |
| 304 | 302 | tilemap_set_transparent_pen(fg_tilemap, 0); |
| 303 | ||
| 304 | gfx_element_set_source(machine->gfx[0], rockola_charram); | |
| 305 | 305 | } |
| r4135 | r4136 | |
|---|---|---|
| 630 | 630 | |
| 631 | 631 | static int get_bank(running_machine *machine, UINT8 prom1, UINT8 prom2, int bpp) |
| 632 | 632 | { |
| 633 | const UINT8 *srcdata; | |
| 633 | 634 | int bank_index, gfx_index; |
| 634 | 635 | |
| 635 | 636 | /* determine the bank index */ |
| r4135 | r4136 | |
| 668 | 669 | assert(gfx_index != MAX_GFX_ELEMENTS); |
| 669 | 670 | |
| 670 | 671 | /* decode the graphics */ |
| 672 | srcdata = &memory_region(machine, "tiles")[0x80000 * (bank_index - 1)]; | |
| 671 | 673 | switch (bpp) |
| 672 | 674 | { |
| 673 | 675 | case 4: |
| 674 | machine->gfx[gfx_index] = alloc | |
| 676 | machine->gfx[gfx_index] = gfx_element_alloc | |
| 675 | 677 | break; |
| 676 | 678 | |
| 677 | 679 | case 5: |
| 678 | machine->gfx[gfx_index] = alloc | |
| 680 | machine->gfx[gfx_index] = gfx_element_alloc | |
| 679 | 681 | break; |
| 680 | 682 | |
| 681 | 683 | case 6: |
| 682 | machine->gfx[gfx_index] = alloc | |
| 684 | machine->gfx[gfx_index] = gfx_element_alloc | |
| 683 | 685 | break; |
| 684 | 686 | |
| 685 | 687 | default: |
| 686 | 688 | fatalerror("Unsupported bpp"); |
| 687 | 689 | } |
| 688 | decodegfx(machine->gfx[gfx_index], &memory_region(machine, "tiles")[0x80000 * (bank_index - 1)], 0, machine->gfx[gfx_index]->total_elements); | |
| 689 | 690 | |
| 690 | 691 | /* set the color information */ |
| 691 | machine->gfx[gfx_index]->color_base = 256; | |
| 692 | 692 | machine->gfx[gfx_index]->color_granularity = 8; |
| 693 | machine->gfx[gfx_index]->total_colors = 0x40; | |
| 694 | 693 | bank_color_shift[gfx_index] = bpp - 3; |
| 695 | 694 | |
| 696 | 695 | /* set the entry and return it */ |
| r4135 | r4136 | |
|---|---|---|
| 147 | 147 | UINT32 code,UINT32 color,int flipx,int flipy,int x0,int y0, |
| 148 | 148 | const rectangle *cliprect, int shadow ) |
| 149 | 149 | { |
| 150 | UINT8 *source, *addr, pen; | |
| 150 | const UINT8 *addr, *source; | |
| 151 | UINT8 pen; | |
| 151 | 152 | UINT16 *dest; |
| 152 | 153 | int sx, x1, dx; |
| 153 | 154 | int sy, y1, dy; |
| 154 | 155 | |
| 155 | addr = (code % gfx->total_elements) | |
| 156 | addr = gfx_element_get_data(gfx, code % gfx->total_elements) | |
| 156 | 157 | color = gfx->color_granularity * (color % gfx->total_colors); |
| 157 | 158 | |
| 158 | 159 | if ( flipx ) { x1 = x0-1; x0 += gfx->width-1; dx = -1; } |
| r4135 | r4136 | |
| 202 | 203 | VIDEO_START_CALL(ssv); |
| 203 | 204 | |
| 204 | 205 | eaglshot_gfxram = (UINT16*)auto_malloc(16 * 0x40000); |
| 205 | eaglshot_dirty_tile = (char*)auto_malloc(16 * 0x40000 / (16*8)); | |
| 206 | ||
| 207 | gfx_element_set_source(machine->gfx[0], (UINT8 *)eaglshot_gfxram); | |
| 208 | gfx_element_set_source(machine->gfx[1], (UINT8 *)eaglshot_gfxram); | |
| 206 | 209 | } |
| 207 | 210 | |
| 208 | 211 | static tilemap *gdfs_tmap; |
| r4135 | r4136 | |
| 223 | 226 | { |
| 224 | 227 | VIDEO_START_CALL(ssv); |
| 225 | 228 | |
| 226 | machine->gfx[2]->color_granularity = 64; /* 256 colour sprites with palette selectable on 64 colour boundaries */ | |
| 227 | ||
| 228 | 229 | eaglshot_gfxram = (UINT16*)auto_malloc(4 * 0x100000); |
| 229 | eaglshot_dirty_tile = (char*)auto_malloc(4 * 0x100000 / (16*8)); | |
| 230 | 230 | |
| 231 | machine->gfx[2]->color_granularity = 64; /* 256 colour sprites with palette selectable on 64 colour boundaries */ | |
| 232 | gfx_element_set_source(machine->gfx[2], (UINT8 *)eaglshot_gfxram); | |
| 233 | ||
| 231 | 234 | gdfs_tmap = tilemap_create( machine, get_tile_info_0, tilemap_scan_rows, |
| 232 | 235 | 16,16, 0x100,0x100 ); |
| 233 | 236 | |
| r4135 | r4136 | |
| 245 | 248 | int ssv_tilemap_offsx, ssv_tilemap_offsy; |
| 246 | 249 | |
| 247 | 250 | UINT16 *eaglshot_gfxram, *gdfs_tmapram, *gdfs_tmapscroll; |
| 248 | char eaglshot_dirty, *eaglshot_dirty_tile; | |
| 249 | 251 | |
| 250 | 252 | /*************************************************************************** |
| 251 | 253 | |
| r4135 | r4136 | |
| 917 | 919 | |
| 918 | 920 | VIDEO_UPDATE( eaglshot ) |
| 919 | 921 | { |
| 920 | int tile; | |
| 921 | ||
| 922 | // Decode tiles from ram | |
| 923 | if (eaglshot_dirty) | |
| 924 | { | |
| 925 | eaglshot_dirty = 0; | |
| 926 | ||
| 927 | for (tile = 0; tile < (16 * 0x40000 / (16*8)); tile++) | |
| 928 | { | |
| 929 | if (eaglshot_dirty_tile[tile]) | |
| 930 | { | |
| 931 | eaglshot_dirty_tile[tile] = 0; | |
| 932 | ||
| 933 | decodechar(screen->machine->gfx[0], tile, (UINT8 *)eaglshot_gfxram); | |
| 934 | decodechar(screen->machine->gfx[1], tile, (UINT8 *)eaglshot_gfxram); | |
| 935 | } | |
| 936 | } | |
| 937 | } | |
| 938 | ||
| 939 | VIDEO_UPDATE_CALL(ssv); | |
| 940 | return 0; | |
| 922 | return VIDEO_UPDATE_CALL(ssv); | |
| 941 | 923 | } |
| 942 | 924 | |
| 943 | 925 | /* |
| r4135 | r4136 | |
| 1105 | 1087 | |
| 1106 | 1088 | VIDEO_UPDATE( gdfs ) |
| 1107 | 1089 | { |
| 1108 | int | |
| 1090 | int | |
| 1109 | 1091 | |
| 1110 | 1092 | VIDEO_UPDATE_CALL(ssv); |
| 1111 | 1093 | |
| 1112 | // Decode zooming sprites tiles from ram | |
| 1113 | if (eaglshot_dirty) | |
| 1114 | { | |
| 1115 | eaglshot_dirty = 0; | |
| 1116 | ||
| 1117 | for (tile = 0; tile < (4 * 0x100000 / (16*8)); tile++) | |
| 1118 | { | |
| 1119 | if (eaglshot_dirty_tile[tile]) | |
| 1120 | { | |
| 1121 | eaglshot_dirty_tile[tile] = 0; | |
| 1122 | ||
| 1123 | decodechar(screen->machine->gfx[2], tile, (UINT8 *)eaglshot_gfxram); | |
| 1124 | } | |
| 1125 | } | |
| 1126 | } | |
| 1127 | ||
| 1128 | 1094 | for (pri = 0; pri <= 0xf; pri++) |
| 1129 | 1095 | gdfs_draw_zooming_sprites(screen->machine, bitmap, cliprect, pri); |
| 1130 | 1096 |
| r4135 | r4136 | |
|---|---|---|
| 276 | 276 | free(buffer); |
| 277 | 277 | |
| 278 | 278 | /* decode the graphics */ |
| 279 | machine->gfx[gfx_index] = allocgfx(machine, &bg_layout); | |
| 280 | decodegfx(machine->gfx[gfx_index], memory_region(machine, region), 0, machine->gfx[gfx_index]->total_elements); | |
| 281 | ||
| 282 | /* set the color information */ | |
| 283 | machine->gfx[gfx_index]->color_base = 2048; | |
| 284 | machine->gfx[gfx_index]->total_colors = 64; | |
| 279 | machine->gfx[gfx_index] = gfx_element_alloc(machine, &bg_layout, memory_region(machine, region), 64, 2048); | |
| 285 | 280 | } |
| 286 | 281 | |
| 287 | 282 | static void decode_sprite(running_machine *machine, int gfx_index, const gfx_layout *layout, const void *data) |
| 288 | 283 | { |
| 289 | 284 | /* decode the graphics */ |
| 290 | machine->gfx[gfx_index] = allocgfx(machine, layout); | |
| 291 | decodegfx(machine->gfx[gfx_index], data, 0, machine->gfx[gfx_index]->total_elements); | |
| 292 | ||
| 293 | /* set the color information */ | |
| 294 | machine->gfx[gfx_index]->color_base = 1024; | |
| 295 | machine->gfx[gfx_index]->total_colors = 64; | |
| 285 | machine->gfx[gfx_index] = gfx_element_alloc(machine, layout, data, 64, 1024); | |
| 296 | 286 | } |
| 297 | 287 | |
| 298 | 288 | // fix sprite order |
| r4135 | r4136 | |
| 320 | 310 | UINT8 *dst; |
| 321 | 311 | int i, y; |
| 322 | 312 | |
| 323 | dst = malloc | |
| 313 | dst = auto_malloc | |
| 324 | 314 | |
| 325 | 315 | for (i = 0; i < len / (4*4*16); i++) |
| 326 | 316 | for (y = 0; y < 16; y++) |
| r4135 | r4136 | |
| 340 | 330 | } |
| 341 | 331 | |
| 342 | 332 | decode_sprite(machine, sprite16, &spr16_layout, dst); |
| 343 | ||
| 344 | free(dst); | |
| 345 | 333 | } |
| 346 | 334 | |
| 347 | 335 | // fix sprite order |
| r4135 | r4136 | |
| 375 | 363 | UINT8 *dst; |
| 376 | 364 | int i; |
| 377 | 365 | |
| 378 | dst = malloc | |
| 366 | dst = auto_malloc | |
| 379 | 367 | |
| 380 | 368 | memset(dst, 0, len); |
| 381 | 369 | |
| r4135 | r4136 | |
| 391 | 379 | } |
| 392 | 380 | |
| 393 | 381 | decode_sprite(machine, sprite32, &spr32_layout, dst); |
| 394 | ||
| 395 | free(dst); | |
| 396 | 382 | } |
| 397 | 383 | |
| 398 | 384 | VIDEO_START( tceptor ) |
| r4135 | r4136 | |
|---|---|---|
| 621 | 621 | |
| 622 | 622 | for (i=0; i<0x20; i++) |
| 623 | 623 | { |
| 624 | gfx_element gfx; | |
| 625 | ||
| 624 | 626 | if (!(metro_videoregs[0x02/2] & 0x8000)) |
| 625 | 627 | { |
| 626 | 628 | src = spriteram16 + (sprites - 1) * (8/2); |
| r4135 | r4136 | |
| 689 | 691 | |
| 690 | 692 | if (support_8bpp && color == 0xf) /* 8bpp */ |
| 691 | 693 | { |
| 692 | /* prepare GfxElement on the fly */ | |
| 693 | gfx_element gfx; | |
| 694 | gfx.machine = machine; | |
| 695 | gfx.width = width; | |
| 696 | gfx.height = height; | |
| 697 | gfx.total_elements = 1; | |
| 698 | gfx.color_depth = 256; | |
| 699 | gfx.color_granularity = 256; | |
| 700 | gfx.color_base = 0; | |
| 701 | gfx.total_colors = 0x20; | |
| 702 | gfx.pen_usage = NULL; | |
| 703 | gfx.gfxdata = gfxdata; | |
| 704 | gfx.line_modulo = width; | |
| 705 | gfx.char_modulo = 0; /* doesn't matter */ | |
| 706 | gfx.flags = 0; | |
| 707 | gfx.machine = machine; | |
| 708 | ||
| 709 | 694 | /* Bounds checking */ |
| 710 | 695 | if ( (gfxdata + width * height - 1) >= gfx_max ) |
| 711 | 696 | continue; |
| 712 | 697 | |
| 698 | gfx_element_build_temporary(&gfx, machine, gfxdata, width, height, width, 0, 256, 0); | |
| 699 | ||
| 713 | 700 | pdrawgfxzoom( bitmap,&gfx, |
| 714 | 701 | 0, |
| 715 | 702 | color_start >> 4, |
| r4135 | r4136 | |
| 721 | 708 | } |
| 722 | 709 | else |
| 723 | 710 | { |
| 724 | /* prepare GfxElement on the fly */ | |
| 725 | gfx_element gfx; | |
| 726 | gfx.machine = machine; | |
| 727 | gfx.width = width; | |
| 728 | gfx.height = height; | |
| 729 | gfx.total_elements = 1; | |
| 730 | gfx.color_depth = 16; | |
| 731 | gfx.color_granularity = 16; | |
| 732 | gfx.color_base = 0; | |
| 733 | gfx.total_colors = 0x200; | |
| 734 | gfx.pen_usage = NULL; | |
| 735 | gfx.gfxdata = gfxdata; | |
| 736 | gfx.line_modulo = width/2; | |
| 737 | gfx.char_modulo = 0; /* doesn't matter */ | |
| 738 | gfx.flags = GFX_ELEMENT_PACKED; | |
| 739 | gfx.machine = machine; | |
| 740 | ||
| 741 | 711 | /* Bounds checking */ |
| 742 | 712 | if ( (gfxdata + width/2 * height - 1) >= gfx_max ) |
| 743 | 713 | continue; |
| 744 | 714 | |
| 715 | gfx_element_build_temporary(&gfx, machine, gfxdata, width, height, width/2, 0, 16, GFX_ELEMENT_PACKED); | |
| 716 | ||
| 745 | 717 | pdrawgfxzoom( bitmap,&gfx, |
| 746 | 718 | 0, |
| 747 | 719 | color + color_start, |
| r4135 | r4136 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | UINT8 *angelkds_txvideoram, *angelkds_bgbotvideoram, *angelkds_bgtopvideoram; |
| 15 | 15 | |
| 16 | static int angelkds_txbank; | |
| 17 | static int angelkds_bgbotbank; | |
| 18 | static int angelkds_bgtopbank; | |
| 19 | ||
| 16 | 20 | /*** Text Layer Tilemap |
| 17 | 21 | |
| 18 | 22 | */ |
| 19 | 23 | |
| 20 | static int angelkds_txbank; | |
| 21 | ||
| 22 | ||
| 23 | 24 | static TILE_GET_INFO( get_tx_tile_info ) |
| 24 | 25 | { |
| 25 | 26 | int tileno; |
| r4135 | r4136 | |
| 50 | 51 | |
| 51 | 52 | */ |
| 52 | 53 | |
| 53 | static int angelkds_bgtopbank; | |
| 54 | ||
| 55 | ||
| 56 | 54 | static TILE_GET_INFO( get_bgtop_tile_info ) |
| 57 | 55 | { |
| 58 | 56 | int tileno; |
| r4135 | r4136 | |
| 89 | 87 | |
| 90 | 88 | */ |
| 91 | 89 | |
| 92 | static int angelkds_bgbotbank; | |
| 93 | ||
| 94 | 90 | static TILE_GET_INFO( get_bgbot_tile_info ) |
| 95 | 91 | { |
| 96 | 92 | int tileno; |
| r4135 | r4136 | |
| 271 | 267 | |
| 272 | 268 | bgtop_tilemap = tilemap_create(machine, get_bgtop_tile_info,tilemap_scan_rows, 8, 8,32,32); |
| 273 | 269 | tilemap_set_transparent_pen(bgtop_tilemap,15); |
| 270 | ||
| 271 | state_save_register_global(machine, angelkds_txbank); | |
| 272 | state_save_register_global(machine, angelkds_bgbotbank); | |
| 273 | state_save_register_global(machine, angelkds_bgtopbank); | |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /* enable bits are uncertain */ |
| r4135 | r4136 | |
|---|---|---|
| 49 | 49 | VIDEO_START(usgames) |
| 50 | 50 | { |
| 51 | 51 | usgames_tilemap = tilemap_create(machine, get_usgames_tile_info,tilemap_scan_rows, 8, 8,64,32); |
| 52 | gfx_element_set_source(machine->gfx[0], usgames_charram); | |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | |
| r4135 | r4136 | |
| 61 | 62 | WRITE8_HANDLER( usgames_charram_w ) |
| 62 | 63 | { |
| 63 | 64 | usgames_charram[offset] = data; |
| 64 | ||
| 65 | decodechar(space->machine->gfx[0], offset/8, usgames_charram); | |
| 66 | ||
| 67 | tilemap_mark_all_tiles_dirty(usgames_tilemap); | |
| 65 | gfx_element_mark_dirty(space->machine->gfx[0], offset/8); | |
| 68 | 66 | } |
| 69 | 67 | |
| 70 | 68 |
| r4135 | r4136 | |
|---|---|---|
| 94 | 94 | tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[1]],0,2); |
| 95 | 95 | tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[2]],0,4); |
| 96 | 96 | |
| 97 | K053245_sprites_draw(0,bitmap,cliprect); | |
| 97 | K053245_sprites_draw(screen->machine,0,bitmap,cliprect); | |
| 98 | 98 | return 0; |
| 99 | 99 | } |
| r4135 | r4136 | |
|---|---|---|
| 75 | 75 | { |
| 76 | 76 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 77 | 77 | const UINT8 *alpha = &jal_blend_table[gfx->color_granularity * (color % gfx->total_colors)]; |
| 78 | UINT8 *source_base = gfx | |
| 78 | const UINT8 *source_base = gfx_element_get_data | |
| 79 | 79 | int x_index_base, y_index, sx, sy, ex, ey; |
| 80 | 80 | int xinc, yinc; |
| 81 | 81 | |
| r4135 | r4136 | |
| 128 | 128 | /* taken from case 7: TRANSPARENCY_ALPHARANGE */ |
| 129 | 129 | for (y = sy; y < ey; y++) |
| 130 | 130 | { |
| 131 | UINT8 *source = source_base + y_index*gfx->line_modulo; | |
| 131 | const UINT8 *source = source_base + y_index*gfx->line_modulo; | |
| 132 | 132 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 133 | 133 | int x_index = x_index_base; |
| 134 | 134 | for (x = sx; x < ex; x++) |
| r4135 | r4136 | |
| 159 | 159 | /* taken from case 7: TRANSPARENCY_ALPHARANGE */ |
| 160 | 160 | for (y = sy; y < ey; y++) |
| 161 | 161 | { |
| 162 | UINT8 *source = source_base + y_index*gfx->line_modulo; | |
| 162 | const UINT8 *source = source_base + y_index*gfx->line_modulo; | |
| 163 | 163 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 164 | 164 | int x_index = x_index_base; |
| 165 | 165 | for (x = sx; x < ex; x++) |
| r4135 | r4136 | |
|---|---|---|
| 208 | 208 | VIDEO_UPDATE( cvs ) |
| 209 | 209 | { |
| 210 | 210 | static const int ram_based_char_start_indices[] = { 0xe0, 0xc0, 0x100, 0x80 }; |
| 211 | int code; | |
| 212 | 211 | offs_t offs; |
| 213 | 212 | int scroll[8]; |
| 214 | 213 | UINT8 character_banking_mode; |
| r4135 | r4136 | |
| 223 | 222 | |
| 224 | 223 | character_banking_mode = cvs_get_character_banking_mode(); |
| 225 | 224 | |
| 226 | /* ROM based tiles first */ | |
| 227 | for (code = 0; code < ram_based_char_start_indices[character_banking_mode]; code++) | |
| 228 | decodechar(screen->machine->gfx[0], code, memory_region(screen->machine, "gfx1")); | |
| 229 | ||
| 230 | /* now the RAM based ones */ | |
| 231 | for (; code < 0x100; code++) | |
| 232 | decodechar(screen->machine->gfx[0], code, cvs_character_ram); | |
| 233 | ||
| 234 | 225 | /* draw the background */ |
| 235 | 226 | for (offs = 0; offs < 0x0400; offs++) |
| 236 | 227 | { |
| r4135 | r4136 | |
| 242 | 233 | UINT8 x = offs << 3; |
| 243 | 234 | UINT8 y = offs >> 5 << 3; |
| 244 | 235 | |
| 245 | drawgfx(background_bitmap, screen->machine->gfx[0], | |
| 236 | int gfxnum = (code < ram_based_char_start_indices[character_banking_mode]) ? 0 : 1; | |
| 237 | ||
| 238 | drawgfx(background_bitmap, screen->machine->gfx[gfxnum], | |
| 246 | 239 | code, color, |
| 247 | 240 | 0, 0, |
| 248 | 241 | x, y, |
| r4135 | r4136 | |
| 259 | 252 | collision_color = 0x102; |
| 260 | 253 | } |
| 261 | 254 | |
| 262 | drawgfx(cvs_collision_background, screen->machine->gfx[ | |
| 255 | drawgfx(cvs_collision_background, screen->machine->gfx[gfxnum], | |
| 263 | 256 | code, collision_color, |
| 264 | 257 | 0, 0, |
| 265 | 258 | x, y, |
| r4135 | r4136 | |
|---|---|---|
| 46 | 46 | deco16_set_tilemap_bank_callback(3,wizdfire_bank_callback); |
| 47 | 47 | |
| 48 | 48 | deco16_pf1_rowscroll=deco16_pf2_rowscroll=0; |
| 49 | ||
| 50 | alpha_set_level(0x80); | |
| 51 | 49 | } |
| 52 | 50 | |
| 53 | 51 | VIDEO_START( nitrobal ) |
| r4135 | r4136 | |
| 63 | 61 | deco16_set_tilemap_colour_mask(2,0); |
| 64 | 62 | deco16_set_tilemap_colour_base(3,0); |
| 65 | 63 | deco16_set_tilemap_colour_mask(3,0); |
| 66 | ||
| 67 | alpha_set_level(0x80); | |
| 68 | 64 | } |
| 69 | 65 | |
| 70 | 66 | /******************************************************************************/ |
| r4135 | r4136 | |
| 153 | 149 | for (offs = 0;offs < 0x400;offs += 4) |
| 154 | 150 | { |
| 155 | 151 | int x,y,sprite,colour,multi,fx,fy,inc,flash,mult; |
| 156 | int | |
| 152 | int | |
| 157 | 153 | |
| 158 | 154 | sprite = spriteptr[offs+1]; |
| 159 | 155 | if (!sprite) continue; |
| r4135 | r4136 | |
| 194 | 190 | colour = (x >> 9) &0x1f; |
| 195 | 191 | |
| 196 | 192 | if (bank==4 && colour&0x10) { |
| 197 | | |
| 193 | | |
| 198 | 194 | colour&=0xf; |
| 199 | 195 | } |
| 200 | 196 | |
| r4135 | r4136 | |
| 231 | 227 | |
| 232 | 228 | while (multi >= 0) |
| 233 | 229 | { |
| 234 | drawgfx(bitmap,machine->gfx[bank], | |
| 230 | drawgfx_alpha(bitmap,cliprect,machine->gfx[bank], | |
| 235 | 231 | sprite - multi * inc, |
| 236 | 232 | colour, |
| 237 | 233 | fx,fy, |
| 238 | 234 | x,y + mult * multi, |
| 239 | | |
| 235 | 0,al | |
| 240 | 236 | |
| 241 | 237 | multi--; |
| 242 | 238 | } |
| r4135 | r4136 | |
| 283 | 279 | while (offs!=end) |
| 284 | 280 | { |
| 285 | 281 | int x,y,sprite,colour,fx,fy,w,h,sx,sy,x_mult,y_mult,tilemap_pri,sprite_pri; |
| 286 | int | |
| 282 | int | |
| 287 | 283 | |
| 288 | 284 | sprite = spriteptr[offs+3]; |
| 289 | 285 | if (!sprite) { |
| r4135 | r4136 | |
| 387 | 383 | } |
| 388 | 384 | |
| 389 | 385 | if (gfxbank==4 && colour&0x10) { |
| 390 | | |
| 386 | | |
| 391 | 387 | colour&=0xf; |
| 392 | 388 | } |
| 393 | 389 | |
| r4135 | r4136 | |
| 426 | 422 | colour, |
| 427 | 423 | fx,fy, |
| 428 | 424 | sx + x_mult * (w-x),sy + y_mult * (h-y), |
| 429 | cliprect, | |
| 425 | cliprect, | |
| 430 | 426 | } |
| 431 | 427 | } |
| 432 | 428 | |
| r4135 | r4136 | |
| 509 | 505 | wizdfire_draw_sprites(screen->machine,bitmap,cliprect,buffered_spriteram16,3,3); |
| 510 | 506 | |
| 511 | 507 | if ((deco16_priority&0x1f)==0x1f) /* Wizdfire has bit 0x40 always set, Dark Seal 2 doesn't?! */ |
| 512 | deco16_tilemap_3_draw(screen,bitmap,cliprect,TILEMAP_DRAW_ALPHA,0); | |
| 508 | deco16_tilemap_3_draw(screen,bitmap,cliprect,TILEMAP_DRAW_ALPHA(0x80),0); | |
| 513 | 509 | else |
| 514 | 510 | deco16_tilemap_3_draw(screen,bitmap,cliprect,0,0); |
| 515 | 511 |
| r4135 | r4136 | |
|---|---|---|
| 72 | 72 | assert(ttl_gfx_index != MAX_GFX_ELEMENTS); |
| 73 | 73 | |
| 74 | 74 | // decode the ttl layer's gfx |
| 75 | machine->gfx[ttl_gfx_index] = allocgfx(machine, &charlayout); | |
| 76 | decodegfx(machine->gfx[ttl_gfx_index], memory_region(machine, "gfx1"), 0, machine->gfx[ttl_gfx_index]->total_elements); | |
| 75 | machine->gfx[ttl_gfx_index] = gfx_element_alloc(machine, &charlayout, memory_region(machine, "gfx1"), machine->config->total_colors / 16, 0); | |
| 77 | 76 | |
| 78 | machine->gfx[ttl_gfx_index]->total_colors = machine->config->total_colors / 16; | |
| 79 | ||
| 80 | 77 | // create the tilemap |
| 81 | 78 | ttl_tilemap = tilemap_create(machine, ttl_get_tile_info, plygonet_scan, 8, 8, 64, 32); |
| 82 | 79 |
| r4135 | r4136 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | static tilemap *background, *foreground; |
| 26 | 26 | |
| 27 | static UINT8 *blank_characterdata; /* pseudo character */ | |
| 28 | ||
| 29 | /* gfxram dirty flags */ | |
| 30 | ||
| 31 | /* we should be able to draw sprite gfx directly without caching to GfxElements */ | |
| 32 | ||
| 33 | static UINT8 *sprite_dirty[8]; | |
| 34 | ||
| 35 | 27 | static const struct |
| 36 | 28 | { |
| 37 | 29 | UINT8 width; |
| r4135 | r4136 | |
| 44 | 36 | { 8, 8, 0 }, { 16, 8, 6 }, { 8, 16, 3 }, { 16, 16, 1 } |
| 45 | 37 | }; |
| 46 | 38 | |
| 39 | static UINT8 blank_tile[8*8]; | |
| 40 | ||
| 47 | 41 | static TILE_GET_INFO( get_bg_tile_info ) |
| 48 | 42 | { |
| 49 | 43 | int code,color,flags; |
| r4135 | r4136 | |
| 57 | 51 | if (code & 0xf800) { |
| 58 | 52 | SET_TILE_INFO( 0, code&0x7ff, color&0x7f, flags ); |
| 59 | 53 | } else { |
| 60 | SET_TILE_INFO( 0, 0x800, 0x00, 0 ); | |
| 54 | SET_TILE_INFO( 0, 0, 0x00, 0 ); | |
| 55 | tileinfo->pen_data = blank_tile; | |
| 61 | 56 | } |
| 62 | 57 | tileinfo->category = (code & 0x1000)>>12; |
| 63 | 58 | } |
| r4135 | r4136 | |
| 75 | 70 | if (code & 0xf800) { |
| 76 | 71 | SET_TILE_INFO( 0, code&0x7ff, color&0x7f, flags ); |
| 77 | 72 | } else { |
| 78 | SET_TILE_INFO( 0, 0x800, 0x00, 0 ); | |
| 73 | SET_TILE_INFO( 0, 0, 0x00, 0 ); | |
| 74 | tileinfo->pen_data = blank_tile; | |
| 79 | 75 | } |
| 80 | 76 | tileinfo->category = (code & 0x1000)>>12; |
| 81 | 77 | } |
| r4135 | r4136 | |
| 199 | 195 | { |
| 200 | 196 | int w = sprite_data[i].width; |
| 201 | 197 | int h = sprite_data[i].height; |
| 202 | sprite_dirty | |
| 198 | gfx_element_mark_dirty(space->machine->gfx[sprite_data[i].char_type], offset * 4 / (w * h)) | |
| 203 | 199 | } |
| 204 | 200 | } |
| 205 | 201 | } |
| r4135 | r4136 | |
| 208 | 204 | /* claim a palette dirty array */ |
| 209 | 205 | VIDEO_START( nemesis ) |
| 210 | 206 | { |
| 211 | int i; | |
| 212 | 207 | spriteram_words = spriteram_size / 2; |
| 213 | 208 | |
| 214 | 209 | background = tilemap_create(machine, |
| r4135 | r4136 | |
| 222 | 217 | tilemap_set_scroll_rows( background, 256 ); |
| 223 | 218 | tilemap_set_scroll_rows( foreground, 256 ); |
| 224 | 219 | |
| 225 | for (i=0; i<8; i++) | |
| 226 | { | |
| 227 | int w = sprite_data[i].width; | |
| 228 | int h = sprite_data[i].height; | |
| 229 | int size = 0x20000 / (w * h); | |
| 230 | sprite_dirty[i] = auto_malloc(size); | |
| 231 | memset(sprite_dirty[i], 1, size); | |
| 232 | } | |
| 233 | ||
| 234 | 220 | memset(nemesis_characterram,0,nemesis_characterram_size); |
| 235 | 221 | |
| 222 | gfx_element_set_source(machine->gfx[0], (UINT8 *)nemesis_characterram); | |
| 223 | gfx_element_set_source(machine->gfx[1], (UINT8 *)nemesis_characterram); | |
| 224 | gfx_element_set_source(machine->gfx[2], (UINT8 *)nemesis_characterram); | |
| 225 | gfx_element_set_source(machine->gfx[3], (UINT8 *)nemesis_characterram); | |
| 226 | gfx_element_set_source(machine->gfx[4], (UINT8 *)nemesis_characterram); | |
| 227 | gfx_element_set_source(machine->gfx[5], (UINT8 *)nemesis_characterram); | |
| 228 | gfx_element_set_source(machine->gfx[6], (UINT8 *)nemesis_characterram); | |
| 229 | gfx_element_set_source(machine->gfx[7], (UINT8 *)nemesis_characterram); | |
| 236 | 230 | |
| 237 | blank_characterdata = auto_malloc(32*8/8*(2048+1)); | |
| 238 | memset(blank_characterdata,0x00,32*8/8*(2048+1)); | |
| 239 | decodechar(machine->gfx[0],0x800,(UINT8 *)blank_characterdata); | |
| 240 | ||
| 241 | 231 | flipscreen = 0; |
| 242 | 232 | tilemap_flip = 0; |
| 243 | 233 | } |
| r4135 | r4136 | |
| 329 | 319 | |
| 330 | 320 | /******************************************************************************/ |
| 331 | 321 | |
| 332 | static void update_gfx(running_machine *machine) | |
| 333 | { | |
| 334 | int offs,code; | |
| 335 | int bAnyDirty; | |
| 336 | ||
| 337 | bAnyDirty = 0; | |
| 338 | for (offs = spriteram_words - 1;offs >= 0;offs --) | |
| 339 | { | |
| 340 | if (sprite_dirty[4][offs]) | |
| 341 | { | |
| 342 | decodechar(machine->gfx[0],offs,(UINT8 *)nemesis_characterram); | |
| 343 | bAnyDirty = 1; | |
| 344 | sprite_dirty[4][offs] = 0; | |
| 345 | } | |
| 346 | } | |
| 347 | if( bAnyDirty ) | |
| 348 | { | |
| 349 | tilemap_mark_all_tiles_dirty( background ); | |
| 350 | tilemap_mark_all_tiles_dirty( foreground ); | |
| 351 | } | |
| 352 | ||
| 353 | for (offs = 0;offs < spriteram_words;offs += 8) | |
| 354 | { | |
| 355 | int char_type; | |
| 356 | int zoom; | |
| 357 | ||
| 358 | zoom = spriteram16[offs+2] & 0xff; | |
| 359 | if (!(spriteram16[offs+2] & 0xff00) && ((spriteram16[offs+3] & 0xff00) != 0xff00)) | |
| 360 | code = spriteram16[offs+3] + ((spriteram16[offs+4] & 0xc0) << 2); | |
| 361 | else | |
| 362 | code = (spriteram16[offs+3] & 0xff) + ((spriteram16[offs+4] & 0xc0) << 2); | |
| 363 | ||
| 364 | if (zoom != 0xFF || code!=0) | |
| 365 | { | |
| 366 | int size = spriteram16[offs+1]; | |
| 367 | int idx = (size >> 3) & 7; | |
| 368 | int w, h; | |
| 369 | ||
| 370 | w = sprite_data[idx].width; | |
| 371 | h = sprite_data[idx].height; | |
| 372 | code = code * 8 * 16 / (w * h); | |
| 373 | char_type = sprite_data[idx].char_type; | |
| 374 | if (sprite_dirty[idx][code] == 1) | |
| 375 | { | |
| 376 | decodechar(machine->gfx[char_type],code,(UINT8 *)nemesis_characterram); | |
| 377 | sprite_dirty[idx][code] = 0; | |
| 378 | } | |
| 379 | } | |
| 380 | } | |
| 381 | } | |
| 382 | ||
| 383 | /******************************************************************************/ | |
| 384 | ||
| 385 | 322 | VIDEO_UPDATE( nemesis ) |
| 386 | 323 | { |
| 387 | 324 | int offs; |
| 388 | 325 | |
| 389 | update_gfx(screen->machine); | |
| 390 | ||
| 391 | 326 | bitmap_fill(priority_bitmap,cliprect,0); |
| 392 | 327 | bitmap_fill(bitmap,cliprect,0); |
| 393 | 328 | |
| r4135 | r4136 | |
| 415 | 350 | int offs; |
| 416 | 351 | rectangle clip; |
| 417 | 352 | |
| 418 | update_gfx(screen->machine); | |
| 419 | ||
| 420 | 353 | bitmap_fill(priority_bitmap,cliprect,0); |
| 421 | 354 | bitmap_fill(bitmap,cliprect,0); |
| 422 | 355 |
| r4135 | r4136 | |
|---|---|---|
| 167 | 167 | UINT16 line_data_flip_x[256]; |
| 168 | 168 | for (i=0; i<256; i++) |
| 169 | 169 | line_data_flip_x[i] = line_data[255-i]; |
| 170 | draw_scanline16(bitmap, 0, 255-v, 256, line_data_flip_x, NULL | |
| 170 | draw_scanline16(bitmap, 0, 255-v, 256, line_data_flip_x, NULL | |
| 171 | 171 | } |
| 172 | 172 | else |
| 173 | draw_scanline16(bitmap, 0, v, 256, line_data, NULL | |
| 173 | draw_scanline16(bitmap, 0, v, 256, line_data, NULL | |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 |
| r4135 | r4136 | |
|---|---|---|
| 838 | 838 | void deco16_pdrawgfx(running_machine *machine, |
| 839 | 839 | bitmap_t *dest,const gfx_element *gfx, |
| 840 | 840 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 841 | const rectangle *clip,int transparen | |
| 841 | const rectangle *clip,int transparen | |
| 842 | 842 | { |
| 843 | 843 | int ox,oy,cx,cy; |
| 844 | 844 | int x_index,y_index,x,y; |
| 845 | 845 | |
| 846 | 846 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 847 | | |
| 847 | const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements) | |
| 848 | 848 | |
| 849 | 849 | /* check bounds */ |
| 850 | 850 | ox = sx; |
| r4135 | r4136 | |
| 864 | 864 | |
| 865 | 865 | for( y=0; y<16-cy; y++ ) |
| 866 | 866 | { |
| 867 | UINT8 *source = | |
| 867 | const UINT8 *source = | |
| 868 | 868 | UINT32 *destb = BITMAP_ADDR32(dest, sy, 0); |
| 869 | 869 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, sy, 0); |
| 870 | 870 | UINT8 *spri = BITMAP_ADDR8(sprite_priority_bitmap, sy, 0); |
| r4135 | r4136 | |
| 879 | 879 | if( c != transparent_color && x >= 0 && x < 320 ) |
| 880 | 880 | { |
| 881 | 881 | if (pri_mask>pri[x] && sprite_mask>spri[x]) { |
| 882 | if (transparency == TRANSPARENCY_ALPHA) | |
| 883 | destb[x] = alpha_blend32(destb[x], pal[c]); | |
| 882 | if (alpha != 0xff) | |
| 883 | destb[x] = alpha_blend_r32(destb[x], pal[c], alpha); | |
| 884 | 884 | else |
| 885 | 885 | destb[x] = pal[c]; |
| 886 | 886 | if (write_pri) |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | palette entry number is NOT changed; therefore, the sprite pixels that are |
| 17 | 17 | covered by the bullet just change bank. This is emulated by first drawing the |
| 18 | 18 | bullets normally, then drawing the sprites (with pdrawgfx so they are not |
| 19 | drawn over high priority tiles), then drawing the pullets again in | |
| 20 | TRANSPARENCY_PEN_TABLE mode, so that bullets not covered by sprites remain | |
| 19 | drawn over high priority tiles), then drawing the pullets again with | |
| 20 | drawgfx_transtable mode, so that bullets not covered by sprites remain | |
| 21 | 21 | the same while the others alter the sprite color. |
| 22 | 22 | |
| 23 | 23 | |
| r4135 | r4136 | |
| 50 | 50 | }; |
| 51 | 51 | static struct star stars[MAX_STARS]; |
| 52 | 52 | static int total_stars; |
| 53 | static UINT8 drawmode_table[4]; | |
| 53 | 54 | |
| 54 | 55 | |
| 55 | 56 | /*************************************************************************** |
| r4135 | r4136 | |
| 356 | 357 | machine->shadow_table[i] = i; |
| 357 | 358 | |
| 358 | 359 | for (i = 0;i < 3;i++) |
| 359 | | |
| 360 | | |
| 360 | 361 | |
| 361 | | |
| 362 | | |
| 362 | 363 | } |
| 363 | 364 | |
| 364 | 365 | |
| r4135 | r4136 | |
| 383 | 384 | machine->shadow_table[i] = i; |
| 384 | 385 | |
| 385 | 386 | for (i = 0;i < 3;i++) |
| 386 | | |
| 387 | | |
| 387 | 388 | |
| 388 | | |
| 389 | | |
| 389 | 390 | |
| 390 | 391 | calculate_star_field(); |
| 391 | 392 | } |
| r4135 | r4136 | |
| 419 | 420 | machine->shadow_table[i] = i; |
| 420 | 421 | |
| 421 | 422 | for (i = 0;i < 3;i++) |
| 422 | | |
| 423 | | |
| 423 | 424 | |
| 424 | | |
| 425 | | |
| 425 | 426 | |
| 426 | 427 | calculate_star_field(); |
| 427 | 428 | } |
| r4135 | r4136 | |
| 456 | 457 | machine->shadow_table[i] = i; |
| 457 | 458 | |
| 458 | 459 | for (i = 0;i < 3;i++) |
| 459 | | |
| 460 | | |
| 460 | 461 | |
| 461 | | |
| 462 | | |
| 462 | 463 | |
| 463 | 464 | calculate_star_field(); |
| 464 | 465 | } |
| r4135 | r4136 | |
| 575 | 576 | } |
| 576 | 577 | } |
| 577 | 578 | |
| 578 | static void rallyx_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transp | |
| 579 | static void rallyx_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transp | |
| 579 | 580 | { |
| 580 | 581 | int offs; |
| 581 | 582 | |
| r4135 | r4136 | |
| 587 | 588 | y = 253 - rallyx_radary[offs]; |
| 588 | 589 | if (flip_screen_get(machine)) x -= 3; |
| 589 | 590 | |
| 590 | drawgfx(bitmap,machine->gfx[2], | |
| 591 | ((rallyx_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07, | |
| 592 | 0, | |
| 593 | 0,0, | |
| 594 | x,y, | |
| 595 | cliprect,transparency,3); | |
| 591 | if (transpen) | |
| 592 | drawgfx_transpen(bitmap,cliprect,machine->gfx[2], | |
| 593 | ((rallyx_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07, | |
| 594 | 0, | |
| 595 | 0,0, | |
| 596 | x,y, | |
| 597 | 3); | |
| 598 | else | |
| 599 | drawgfx_transtable(bitmap,cliprect,machine->gfx[2], | |
| 600 | ((rallyx_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07, | |
| 601 | 0, | |
| 602 | 0,0, | |
| 603 | x,y, | |
| 604 | drawmode_table,machine->shadow_table); | |
| 596 | 605 | } |
| 597 | 606 | } |
| 598 | 607 | |
| 599 | static void jungler_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transp | |
| 608 | static void jungler_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transp | |
| 600 | 609 | { |
| 601 | 610 | int offs; |
| 602 | 611 | |
| r4135 | r4136 | |
| 607 | 616 | x = rallyx_radarx[offs] + ((~rallyx_radarattr[offs & 0x0f] & 0x08) << 5); |
| 608 | 617 | y = 253 - rallyx_radary[offs]; |
| 609 | 618 | |
| 610 | drawgfx(bitmap,machine->gfx[2], | |
| 611 | (rallyx_radarattr[offs & 0x0f] & 0x07) ^ 0x07, | |
| 612 | 0, | |
| 613 | 0,0, | |
| 614 | x,y, | |
| 615 | cliprect,transparency,3); | |
| 619 | if (transpen) | |
| 620 | drawgfx_transpen(bitmap,cliprect,machine->gfx[2], | |
| 621 | (rallyx_radarattr[offs & 0x0f] & 0x07) ^ 0x07, | |
| 622 | 0, | |
| 623 | 0,0, | |
| 624 | x,y, | |
| 625 | 3); | |
| 626 | else | |
| 627 | drawgfx_transtable(bitmap,cliprect,machine->gfx[2], | |
| 628 | (rallyx_radarattr[offs & 0x0f] & 0x07) ^ 0x07, | |
| 629 | 0, | |
| 630 | 0,0, | |
| 631 | x,y, | |
| 632 | drawmode_table,machine->shadow_table); | |
| 616 | 633 | } |
| 617 | 634 | } |
| 618 | 635 | |
| 619 | static void locomotn_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transp | |
| 636 | static void locomotn_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transp | |
| 620 | 637 | { |
| 621 | 638 | int offs; |
| 622 | 639 | |
| r4135 | r4136 | |
| 635 | 652 | x = rallyx_radarx[offs] + ((~rallyx_radarattr[offs & 0x0f] & 0x08) << 5); |
| 636 | 653 | y = 252 - rallyx_radary[offs]; |
| 637 | 654 | |
| 638 | drawgfx(bitmap,machine->gfx[2], | |
| 639 | (rallyx_radarattr[offs & 0x0f] & 0x07) ^ 0x07, | |
| 640 | 0, | |
| 641 | 0,0, | |
| 642 | x,y, | |
| 643 | cliprect,transparency,3); | |
| 655 | if (transpen) | |
| 656 | drawgfx_transpen(bitmap,cliprect,machine->gfx[2], | |
| 657 | (rallyx_radarattr[offs & 0x0f] & 0x07) ^ 0x07, | |
| 658 | 0, | |
| 659 | 0,0, | |
| 660 | x,y, | |
| 661 | 3); | |
| 662 | else | |
| 663 | drawgfx_transtable(bitmap,cliprect,machine->gfx[2], | |
| 664 | (rallyx_radarattr[offs & 0x0f] & 0x07) ^ 0x07, | |
| 665 | 0, | |
| 666 | 0,0, | |
| 667 | x,y, | |
| 668 | drawmode_table,machine->shadow_table); | |
| 644 | 669 | } |
| 645 | 670 | } |
| 646 | 671 | |
| r4135 | r4136 | |
| 669 | 694 | tilemap_draw(bitmap,&bg_clip,bg_tilemap,1,1); |
| 670 | 695 | tilemap_draw(bitmap,&fg_clip,fg_tilemap,1,1); |
| 671 | 696 | |
| 672 | rallyx_draw_bullets(screen->machine, bitmap,cliprect,TRANSPARENCY_PEN); | |
| 673 | rallyx_draw_sprites(screen->machine, bitmap,cliprect,1); | |
| 674 | rallyx_draw_bullets(screen->machine, bitmap,cliprect,TRANSPARENCY_PEN_TABLE); | |
| 697 | rallyx_draw_bullets(screen->machine,bitmap,cliprect,TRUE); | |
| 698 | rallyx_draw_sprites(screen->machine,bitmap,cliprect,1); | |
| 699 | rallyx_draw_bullets(screen->machine,bitmap,cliprect,FALSE); | |
| 675 | 700 | |
| 676 | 701 | return 0; |
| 677 | 702 | } |
| r4135 | r4136 | |
| 702 | 727 | tilemap_draw(bitmap,&bg_clip,bg_tilemap,1,0); |
| 703 | 728 | tilemap_draw(bitmap,&fg_clip,fg_tilemap,1,0); |
| 704 | 729 | |
| 705 | jungler_draw_bullets(screen->machine, bitmap,cliprect,TRANSPARENCY_PEN); | |
| 706 | rallyx_draw_sprites(screen->machine, bitmap,cliprect,0); | |
| 707 | jungler_draw_bullets(screen->machine, bitmap,cliprect,TRANSPARENCY_PEN_TABLE); | |
| 730 | jungler_draw_bullets(screen->machine,bitmap,cliprect,TRUE); | |
| 731 | rallyx_draw_sprites(screen->machine,bitmap,cliprect,0); | |
| 732 | jungler_draw_bullets(screen->machine,bitmap,cliprect,FALSE); | |
| 708 | 733 | |
| 709 | 734 | if (stars_enable) |
| 710 | 735 | draw_stars(screen->machine, bitmap, cliprect); |
| r4135 | r4136 | |
| 746 | 771 | tilemap_draw(bitmap,&bg_clip,bg_tilemap,1,1); |
| 747 | 772 | tilemap_draw(bitmap,&fg_clip,fg_tilemap,1,1); |
| 748 | 773 | |
| 749 | locomotn_draw_bullets(screen->machine, bitmap,cliprect,TRANSPARENCY_PEN); | |
| 750 | locomotn_draw_sprites(screen->machine, bitmap,cliprect,0); | |
| 751 | locomotn_draw_bullets(screen->machine, bitmap,cliprect,TRANSPARENCY_PEN_TABLE); | |
| 774 | locomotn_draw_bullets(screen->machine,bitmap,cliprect,TRUE); | |
| 775 | locomotn_draw_sprites(screen->machine,bitmap,cliprect,0); | |
| 776 | locomotn_draw_bullets(screen->machine,bitmap,cliprect,FALSE); | |
| 752 | 777 | |
| 753 | 778 | if (stars_enable) |
| 754 | 779 | draw_stars(screen->machine, bitmap, cliprect); |
| r4135 | r4136 | |
|---|---|---|
| 160 | 160 | { |
| 161 | 161 | /* non-flipped: draw directly from the bitmap */ |
| 162 | 162 | if (!gridlee_cocktail_flip) |
| 163 | draw_scanline8(bitmap, 0, y, 256, &local_videoram[(y - BALSENTE_VBEND) * 256], pens + 16 | |
| 163 | draw_scanline8(bitmap, 0, y, 256, &local_videoram[(y - BALSENTE_VBEND) * 256], pens + 16 | |
| 164 | 164 | |
| 165 | 165 | /* flipped: x-flip the scanline into a temp buffer and draw that */ |
| 166 | 166 | else |
| r4135 | r4136 | |
| 171 | 171 | |
| 172 | 172 | for (xx = 0; xx < 256; xx++) |
| 173 | 173 | temp[xx] = local_videoram[srcy * 256 + 255 - xx]; |
| 174 | draw_scanline8(bitmap, 0, y, 256, temp, pens + 16 | |
| 174 | draw_scanline8(bitmap, 0, y, 256, temp, pens + 16 | |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 |
| r4135 | r4136 | |
|---|---|---|
| 62 | 62 | tilemap_draw(bitmap,cliprect,K052109_tilemap[1],0,1); |
| 63 | 63 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,2); |
| 64 | 64 | |
| 65 | K051960_sprites_draw(bitmap,cliprect,0,-1); // draw sprites with pdrawgfx | |
| 65 | K051960_sprites_draw(screen->machine,bitmap,cliprect,0,-1); // draw sprites with pdrawgfx | |
| 66 | 66 | return 0; |
| 67 | 67 | } |
| r4135 | r4136 | |
|---|---|---|
| 222 | 222 | rectangle spritetile_clip; |
| 223 | 223 | spritetile_clip.min_x = 0; |
| 224 | 224 | spritetile_clip.min_y = 0; |
| 225 | spritetile_clip.max_x = 32; | |
| 226 | spritetile_clip.max_y = 32; | |
| 225 | spritetile_clip.max_x = 31; | |
| 226 | spritetile_clip.max_y = 31; | |
| 227 | 227 | |
| 228 | 228 | for ( offs = 0x3000/2; offs < 0x3600/2; offs += 2/2 ) |
| 229 | 229 | { |
| r4135 | r4136 | |
| 314 | 314 | switch( rot ) |
| 315 | 315 | { |
| 316 | 316 | case 0x10: // rot 90 |
| 317 | copyrozbitmap( tmpbitmap1, tmpbitmap0, | |
| 317 | copyrozbitmap_trans( tmpbitmap1, NULL, tmpbitmap0, | |
| 318 | 318 | (UINT32)0<<16, |
| 319 | 319 | (UINT32)16<<16, |
| 320 | 320 | 0 << 16, |
| 321 | 321 | -1 << 16, |
| 322 | 322 | 1 << 16, |
| 323 | 323 | 0 << 16, |
| 324 | 0, | |
| 324 | 0, | |
| 325 | 325 | |
| 326 | 326 | currx = (sx - (y+1) * ydim) / 0x10000; |
| 327 | 327 | curry = (sy + x * xdim) / 0x10000; |
| r4135 | r4136 | |
| 330 | 330 | break; |
| 331 | 331 | |
| 332 | 332 | case 0x20: // rot 180 |
| 333 | copyrozbitmap( tmpbitmap1, tmpbitmap0, | |
| 333 | copyrozbitmap_trans( tmpbitmap1, NULL, tmpbitmap0, | |
| 334 | 334 | (UINT32)16<<16, |
| 335 | 335 | (UINT32)16<<16, |
| 336 | 336 | -1 << 16, |
| 337 | 337 | 0 << 16, |
| 338 | 338 | 0 << 16, |
| 339 | 339 | -1 << 16, |
| 340 | 0, | |
| 340 | 0, | |
| 341 | 341 | |
| 342 | 342 | currx = (sx - (x+1) * xdim) / 0x10000; |
| 343 | 343 | curry = (sy - (y+1) * ydim) / 0x10000; |
| r4135 | r4136 | |
| 346 | 346 | break; |
| 347 | 347 | |
| 348 | 348 | case 0x30: // rot 270 |
| 349 | copyrozbitmap( tmpbitmap1, tmpbitmap0, | |
| 349 | copyrozbitmap_trans( tmpbitmap1, NULL, tmpbitmap0, | |
| 350 | 350 | (UINT32)16<<16, |
| 351 | 351 | (UINT32)0<<16, |
| 352 | 352 | 0 << 16, |
| 353 | 353 | 1 << 16, |
| 354 | 354 | -1 << 16, |
| 355 | 355 | 0 << 16, |
| 356 | 0, | |
| 356 | 0, | |
| 357 | 357 | |
| 358 | 358 | currx = (sx + y * ydim) / 0x10000; |
| 359 | 359 | curry = (sy - (x+1) * xdim) / 0x10000; |
| r4135 | r4136 | |
|---|---|---|
| 84 | 84 | bitmap_fill(bitmap,cliprect,layer_colorbase[1]); |
| 85 | 85 | // if (bottom9_video_enable) |
| 86 | 86 | { |
| 87 | K051960_sprites_draw(bitmap,cliprect,1,1); | |
| 87 | K051960_sprites_draw(screen->machine,bitmap,cliprect,1,1); | |
| 88 | 88 | K051316_zoom_draw_0(bitmap,cliprect,0,0); |
| 89 | K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 89 | K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 90 | 90 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,0); |
| 91 | 91 | /* note that priority 3 is opposite to the basic layer priority! */ |
| 92 | 92 | /* (it IS used, but hopefully has no effect) */ |
| 93 | K051960_sprites_draw(bitmap,cliprect,2,3); | |
| 93 | K051960_sprites_draw(screen->machine,bitmap,cliprect,2,3); | |
| 94 | 94 | tilemap_draw(bitmap,cliprect,K052109_tilemap[1],0,0); |
| 95 | 95 | } |
| 96 | 96 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | static int HuC6270_registers[20]; |
| 15 | 15 | static int VDC_register,vram_ptr; |
| 16 | static UINT8 *HuC6270_vram,* | |
| 16 | static UINT8 *HuC6270_vram,* | |
| 17 | 17 | static bitmap_t *tile_bitmap,*front_bitmap; |
| 18 | static UINT32 tile_dirtyseq; | |
| 18 | 19 | |
| 19 | 20 | static int current_scanline,inc_value; |
| 20 | 21 | static int irq_enable,rcr_enable,sb_enable,bb_enable,bldwolf_vblank; |
| 21 | 22 | |
| 23 | static UINT8 blank_tile[32]; | |
| 22 | 24 | |
| 23 | 25 | |
| 24 | 26 | /******************************************************************************/ |
| r4135 | r4136 | |
| 26 | 28 | VIDEO_START( battlera ) |
| 27 | 29 | { |
| 28 | 30 | HuC6270_vram=auto_malloc(0x20000); |
| 29 | tile_dirty=auto_malloc(0x1000); | |
| 30 | sprite_dirty=auto_malloc(0x400); | |
| 31 | 31 | vram_dirty=auto_malloc(0x1000); |
| 32 | 32 | |
| 33 | 33 | memset(HuC6270_vram,0,0x20000); |
| 34 | memset(tile_dirty,1,0x1000); | |
| 35 | memset(sprite_dirty,1,0x400); | |
| 36 | 34 | memset(vram_dirty,1,0x1000); |
| 37 | 35 | |
| 38 | 36 | tile_bitmap=auto_bitmap_alloc(512,512,video_screen_get_format(machine->primary_screen)); |
| r4135 | r4136 | |
| 42 | 40 | inc_value=1; |
| 43 | 41 | current_scanline=0; |
| 44 | 42 | irq_enable=rcr_enable=sb_enable=bb_enable=0; |
| 43 | ||
| 44 | gfx_element_set_source(machine->gfx[0], HuC6270_vram); | |
| 45 | gfx_element_set_source(machine->gfx[1], HuC6270_vram); | |
| 46 | gfx_element_set_source(machine->gfx[2], blank_tile); | |
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | /******************************************************************************/ |
| r4135 | r4136 | |
| 133 | 135 | case 2: /* VRAM */ |
| 134 | 136 | if (HuC6270_vram[(HuC6270_registers[0]<<1)|1]!=data) { |
| 135 | 137 | HuC6270_vram[(HuC6270_registers[0]<<1)|1]=data; |
| 136 | tile_dirty[HuC6270_registers[0]>>4]=1; | |
| 137 | sprite_dirty[HuC6270_registers[0]>>6]=1; | |
| 138 | gfx_element_mark_dirty(space->machine->gfx[0], HuC6270_registers[0]>>4); | |
| 139 | gfx_element_mark_dirty(space->machine->gfx[1], HuC6270_registers[0]>>6); | |
| 138 | 140 | } |
| 139 | 141 | if (HuC6270_registers[0]<0x1000) vram_dirty[HuC6270_registers[0]]=1; |
| 140 | 142 | return; |
| r4135 | r4136 | |
| 193 | 195 | case 2: /* VWR - VRAM */ |
| 194 | 196 | if (HuC6270_vram[(HuC6270_registers[0]<<1)|0]!=data) { |
| 195 | 197 | HuC6270_vram[(HuC6270_registers[0]<<1)|0]=data; |
| 196 | tile_dirty[HuC6270_registers[0]>>4]=1; | |
| 197 | sprite_dirty[HuC6270_registers[0]>>6]=1; | |
| 198 | gfx_element_mark_dirty(space->machine->gfx[0], HuC6270_registers[0]>>4); | |
| 199 | gfx_element_mark_dirty(space->machine->gfx[1], HuC6270_registers[0]>>6); | |
| 198 | 200 | if (HuC6270_registers[0]<0x1000) vram_dirty[HuC6270_registers[0]]=1; |
| 199 | 201 | } |
| 200 | 202 | HuC6270_registers[0]+=inc_value; |
| r4135 | r4136 | |
| 313 | 315 | { |
| 314 | 316 | int offs,code,scrollx,scrolly,mx,my; |
| 315 | 317 | |
| 316 | /* Dynamically decode chars if dirty */ | |
| 317 | for (code = 0x0000;code < 0x1000;code++) | |
| 318 | if (tile_dirty[code]) | |
| 319 | decodechar(screen->machine->gfx[0],code,HuC6270_vram); | |
| 318 | /* if any tiles changed, redraw the VRAM */ | |
| 319 | if (screen->machine->gfx[0]->dirtyseq != tile_dirtyseq) | |
| 320 | { | |
| 321 | tile_dirtyseq = screen->machine->gfx[0]->dirtyseq; | |
| 322 | memset(vram_dirty, 1, 0x1000); | |
| 323 | } | |
| 320 | 324 | |
| 321 | /* Dynamically decode sprites if dirty */ | |
| 322 | for (code = 0x0000;code < 0x400;code++) | |
| 323 | if (sprite_dirty[code]) | |
| 324 | decodechar(screen->machine->gfx[1],code,HuC6270_vram); | |
| 325 | ||
| 326 | /* NB: If first 0x1000 byte is always tilemap, no need to decode the first batch of tiles/sprites */ | |
| 327 | ||
| 328 | 325 | mx=-1; |
| 329 | 326 | my=0; |
| 330 | 327 | for (offs = 0x0000;offs < 0x2000;offs += 2) |
| r4135 | r4136 | |
| 334 | 331 | code=HuC6270_vram[offs+1] + ((HuC6270_vram[offs] & 0x0f) << 8); |
| 335 | 332 | |
| 336 | 333 | /* If this tile was changed OR tilemap was changed, redraw */ |
| 337 | if ( | |
| 334 | if ( | |
| 338 | 335 | vram_dirty[offs/2]=0; |
| 339 | 336 | drawgfx(tile_bitmap,screen->machine->gfx[0], |
| 340 | 337 | code, |
| r4135 | r4136 | |
| 357 | 354 | } |
| 358 | 355 | } |
| 359 | 356 | |
| 360 | /* Nothing dirty after a screen refresh */ | |
| 361 | for (code = 0x0000;code < 0x1000;code++) | |
| 362 | tile_dirty[code]=0; | |
| 363 | for (code = 0x0000;code < 0x400;code++) | |
| 364 | sprite_dirty[code]=0; | |
| 365 | ||
| 366 | 357 | /* Render bitmap */ |
| 367 | 358 | scrollx=-HuC6270_registers[7]; |
| 368 | 359 | scrolly=-HuC6270_registers[8]+cliprect->min_y-1; |
| r4135 | r4136 | |
|---|---|---|
| 52 | 52 | static UINT8 *tilemap_maskdata; |
| 53 | 53 | static int copy_sprites; |
| 54 | 54 | |
| 55 | static UINT8 drawmode_table[16]; | |
| 55 | 56 | |
| 56 | 57 | |
| 57 | 58 | |
| 59 | ||
| 58 | 60 | /*************************************************************************** |
| 59 | 61 | |
| 60 | 62 | Callbacks for the TileMap code |
| r4135 | r4136 | |
| 126 | 128 | state_save_register_global_array(machine, namcos1_playfield_control); |
| 127 | 129 | |
| 128 | 130 | /* set table for sprite color == 0x7f */ |
| 129 | for (i = 0;i <= 15;i++) | |
| 130 | gfx_drawmode_table[i] = DRAWMODE_SHADOW; | |
| 131 | for (i = 0;i < 15;i++) | |
| 132 | drawmode_table[i] = DRAWMODE_SHADOW; | |
| 133 | drawmode_table[15] = DRAWMODE_NONE; | |
| 131 | 134 | |
| 132 | 135 | /* clear paletteram */ |
| 133 | 136 | memset(namcos1_paletteram, 0, 0x8000); |
| r4135 | r4136 | |
| 278 | 281 | const UINT8 *source = &spriteram[0x0800-0x20]; /* the last is NOT a sprite */ |
| 279 | 282 | const UINT8 *finish = &spriteram[0]; |
| 280 | 283 | gfx_element *gfx = machine->gfx[1]; |
| 281 | gfx_element mygfx = *gfx; | |
| 282 | 284 | |
| 283 | 285 | int sprite_xoffs = spriteram[0x07f5] + ((spriteram[0x07f4] & 1) << 8); |
| 284 | 286 | int sprite_yoffs = spriteram[0x07f7]; |
| r4135 | r4136 | |
| 318 | 320 | |
| 319 | 321 | sy++; /* sprites are buffered and delayed by one scanline */ |
| 320 | 322 | |
| 321 | /* change GfxElement parameters to draw only the needed part of the 32x32 tile */ | |
| 322 | mygfx.width = sizex; | |
| 323 | mygfx.height = sizey; | |
| 324 | mygfx.gfxdata = gfx->gfxdata + tx + ty * gfx->line_modulo; | |
| 323 | gfx_element_set_source_clip(gfx, tx, sizex, ty, sizey); | |
| 324 | if (color != 0x7f) | |
| 325 | pdrawgfx_transpen( bitmap, cliprect, gfx, | |
| 326 | sprite, | |
| 327 | color, | |
| 328 | flipx,flipy, | |
| 329 | sx & 0x1ff, | |
| 330 | ((sy + 16) & 0xff) - 16, | |
| 331 | priority_bitmap, pri_mask, | |
| 332 | 0xf); | |
| 333 | else | |
| 334 | pdrawgfx_transtable( bitmap, cliprect, gfx, | |
| 335 | sprite, | |
| 336 | color, | |
| 337 | flipx,flipy, | |
| 338 | sx & 0x1ff, | |
| 339 | ((sy + 16) & 0xff) - 16, | |
| 340 | priority_bitmap, pri_mask, | |
| 341 | drawmode_table, machine->shadow_table); | |
| 325 | 342 | |
| 326 | pdrawgfx( bitmap, &mygfx, | |
| 327 | sprite, | |
| 328 | color, | |
| 329 | flipx,flipy, | |
| 330 | sx & 0x1ff, | |
| 331 | ((sy + 16) & 0xff) - 16, | |
| 332 | cliprect,(color != 0x7f) ? TRANSPARENCY_PEN : TRANSPARENCY_PEN_TABLE,0xf, pri_mask); | |
| 333 | ||
| 334 | 343 | source -= 0x10; |
| 335 | 344 | } |
| 336 | 345 | } |
| r4135 | r4136 | |
|---|---|---|
| 99 | 99 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,4); /* high priority part of layer */ |
| 100 | 100 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,8); |
| 101 | 101 | |
| 102 | K051960_sprites_draw(bitmap,cliprect,-1,-1); | |
| 102 | K051960_sprites_draw(screen->machine,bitmap,cliprect,-1,-1); | |
| 103 | 103 | return 0; |
| 104 | 104 | } |
| 105 | 105 | |
| r4135 | r4136 | |
| 109 | 109 | |
| 110 | 110 | tilemap_draw(bitmap,cliprect,K052109_tilemap[1],TILEMAP_DRAW_OPAQUE,0); |
| 111 | 111 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,0); |
| 112 | K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 112 | K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 113 | 113 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,0); |
| 114 | 114 | return 0; |
| 115 | 115 | } |
| r4135 | r4136 | |
|---|---|---|
| 22 | 22 | static UINT8 schaser_background_disable; |
| 23 | 23 | static UINT8 schaser_background_select; |
| 24 | 24 | |
| 25 | MACHINE_START( extra_8080bw_vh ) | |
| 26 | { | |
| 27 | state_save_register_global(machine, c8080bw_flip_screen); | |
| 28 | state_save_register_global(machine, color_map); | |
| 29 | state_save_register_global(machine, screen_red); | |
| 25 | 30 | |
| 31 | // These two only belong to schaser, but for simplicity's sake let's waste | |
| 32 | // two bytes in other drivers' .sta files. | |
| 33 | state_save_register_global(machine, schaser_background_disable); | |
| 34 | state_save_register_global(machine, schaser_background_select); | |
| 35 | } | |
| 26 | 36 | |
| 27 | 37 | void c8080bw_flip_screen_w(const address_space *space, int data) |
| 28 | 38 | { |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | static int charbank,charpalette,video_enable; |
| 11 | 11 | static UINT16 *zoomdata; |
| 12 | static int dirtygfx; | |
| 13 | static UINT8 *dirtychar; | |
| 14 | 12 | |
| 15 | 13 | #define TOTAL_CHARS 0x400 |
| 16 | 14 | |
| r4135 | r4136 | |
| 56 | 54 | |
| 57 | 55 | K051316_vh_start_0(machine,"gfx3",-4,TRUE,0,zoom_callback); |
| 58 | 56 | |
| 59 | dirtychar = auto_malloc(TOTAL_CHARS); | |
| 60 | memset(dirtychar,1,TOTAL_CHARS); | |
| 61 | ||
| 62 | 57 | tilemap_set_transparent_pen(bg_tilemap,15); |
| 63 | 58 | |
| 64 | 59 | K051316_wraparound_enable(0,1); |
| r4135 | r4136 | |
| 90 | 85 | int oldword = zoomdata[offset]; |
| 91 | 86 | COMBINE_DATA(&zoomdata[offset]); |
| 92 | 87 | if (oldword != zoomdata[offset]) |
| 93 | { | |
| 94 | dirtygfx = 1; | |
| 95 | dirtychar[offset / 64] = 1; | |
| 96 | } | |
| 88 | gfx_element_mark_dirty(space->machine->gfx[2], offset / 64); | |
| 97 | 89 | } |
| 98 | 90 | |
| 99 | 91 | WRITE16_HANDLER( tail2nos_gfxbank_w ) |
| r4135 | r4136 | |
| 164 | 156 | |
| 165 | 157 | VIDEO_UPDATE( tail2nos ) |
| 166 | 158 | { |
| 167 | if (dirtygfx) | |
| 168 | { | |
| 169 | int i; | |
| 170 | ||
| 171 | dirtygfx = 0; | |
| 172 | ||
| 173 | for (i = 0;i < TOTAL_CHARS;i++) | |
| 174 | { | |
| 175 | if (dirtychar[i]) | |
| 176 | { | |
| 177 | dirtychar[i] = 0; | |
| 178 | decodechar(screen->machine->gfx[2],i,(UINT8 *)zoomdata); | |
| 179 | } | |
| 180 | } | |
| 181 | ||
| 182 | tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); | |
| 183 | } | |
| 184 | ||
| 185 | ||
| 186 | 159 | if (video_enable) |
| 187 | 160 | { |
| 188 | 161 | K051316_zoom_draw_0(bitmap,cliprect,0,0); |
| r4135 | r4136 | |
|---|---|---|
| 1113 | 1113 | /* blend the bitmaps and do collision detection */ |
| 1114 | 1114 | for (y = 0; y < 256; y++) |
| 1115 | 1115 | { |
| 1116 | UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0); | |
| 1116 | 1117 | UINT8 sy = scrolly + y; |
| 1117 | 1118 | UINT8 *fg = &fgbitmap[y * 256]; |
| 1118 | 1119 | UINT8 *bg = &bgbitmap[sy * 256]; |
| 1119 | UINT8 scanline[256]; | |
| 1120 | 1120 | |
| 1121 | 1121 | /* do the blending */ |
| 1122 | 1122 | for (x = 0; x < 256; x++) |
| r4135 | r4136 | |
| 1127 | 1127 | if (fpix && (bpix & bgcollmask) && count++ < 128) |
| 1128 | 1128 | timer_set(screen->machine, video_screen_get_time_until_pos(screen, y, x), NULL, x | (y << 8), bgcoll_irq_callback); |
| 1129 | 1129 | } |
| 1130 | ||
| 1131 | /* draw the scanline */ | |
| 1132 | draw_scanline8(bitmap, 0, y, 256, scanline, NULL, -1); | |
| 1133 | 1130 | } |
| 1134 | 1131 | |
| 1135 | 1132 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 93 | 93 | deco16_set_tilemap_colour_base(1,0x30); |
| 94 | 94 | deco16_set_tilemap_colour_base(2,0x20); |
| 95 | 95 | deco16_set_tilemap_colour_base(3,0x40); |
| 96 | ||
| 97 | alpha_set_level(0x80); | |
| 98 | 96 | } |
| 99 | 97 | |
| 100 | 98 | /******************************************************************************/ |
| r4135 | r4136 | |
| 325 | 323 | while (offs!=end) |
| 326 | 324 | { |
| 327 | 325 | int x,y,sprite,colour,fx,fy,w,h,sx,sy,x_mult,y_mult; |
| 328 | int | |
| 326 | int | |
| 329 | 327 | |
| 330 | 328 | sprite = spriteptr[offs+3]; |
| 331 | 329 | if (!sprite) { |
| r4135 | r4136 | |
| 347 | 345 | colour = (spriteptr[offs+2] >>0) & 0x1f; |
| 348 | 346 | |
| 349 | 347 | if (gfxbank==4) { /* Seems to be always alpha'd */ |
| 350 | | |
| 348 | | |
| 351 | 349 | colour&=0xf; |
| 352 | 350 | } |
| 353 | 351 | |
| r4135 | r4136 | |
| 380 | 378 | |
| 381 | 379 | for (x=0; x<w; x++) { |
| 382 | 380 | for (y=0; y<h; y++) { |
| 383 | pdrawgfx(bitmap,machine->gfx[gfxbank], | |
| 381 | pdrawgfx_alpha(bitmap,cliprect,machine->gfx[gfxbank], | |
| 384 | 382 | sprite + y + h * x, |
| 385 | 383 | colour, |
| 386 | 384 | fx,fy, |
| 387 | 385 | sx + x_mult * (w-x),sy + y_mult * (h-y), |
| 388 | cliprect,trans,0,0); | |
| 386 | priority_bitmap,0, | |
| 387 | 0,alpha); | |
| 389 | 388 | } |
| 390 | 389 | } |
| 391 | 390 |
| r4135 | r4136 | |
|---|---|---|
| 36 | 36 | static bitmap_t *sprite_sprite_collbitmap1,*sprite_sprite_collbitmap2; |
| 37 | 37 | static bitmap_t *sprite_layer_collbitmap1; |
| 38 | 38 | static bitmap_t *sprite_layer_collbitmap2[3]; |
| 39 | static UINT8 dirtycharacter1[256],dirtycharacter2[256]; | |
| 40 | static UINT8 dirtysprite1[64],dirtysprite2[64]; | |
| 41 | 39 | |
| 42 | 40 | static const int layer_enable_mask[3] = { 0x10, 0x20, 0x40 }; |
| 43 | 41 | |
| r4135 | r4136 | |
| 154 | 152 | } |
| 155 | 153 | } |
| 156 | 154 | |
| 157 | ||
| 158 | static STATE_POSTLOAD( taitosj_postload ) | |
| 159 | { | |
| 160 | memset(dirtycharacter1, 1, sizeof(dirtycharacter1)); | |
| 161 | memset(dirtycharacter2, 1, sizeof(dirtycharacter2)); | |
| 162 | memset(dirtysprite1, 1, sizeof(dirtysprite1)); | |
| 163 | memset(dirtysprite2, 1, sizeof(dirtysprite2)); | |
| 164 | } | |
| 165 | ||
| 166 | 155 | /*************************************************************************** |
| 167 | 156 | |
| 168 | 157 | Start the video hardware emulation. |
| r4135 | r4136 | |
| 214 | 203 | sprite_sprite_collbitmap1 = auto_bitmap_alloc(32,32,video_screen_get_format(machine->primary_screen)); |
| 215 | 204 | sprite_sprite_collbitmap2 = auto_bitmap_alloc(32,32,video_screen_get_format(machine->primary_screen)); |
| 216 | 205 | |
| 217 | memset(dirtycharacter1, 1, sizeof(dirtycharacter1)); | |
| 218 | memset(dirtycharacter2, 1, sizeof(dirtycharacter2)); | |
| 219 | memset(dirtysprite1, 1, sizeof(dirtysprite1)); | |
| 220 | memset(dirtysprite2, 1, sizeof(dirtysprite2)); | |
| 206 | gfx_element_set_source(machine->gfx[0], taitosj_characterram); | |
| 207 | gfx_element_set_source(machine->gfx[1], taitosj_characterram); | |
| 208 | gfx_element_set_source(machine->gfx[2], taitosj_characterram + 0x1800); | |
| 209 | gfx_element_set_source(machine->gfx[3], taitosj_characterram + 0x1800); | |
| 221 | 210 | |
| 222 | 211 | compute_draw_order(machine); |
| 223 | ||
| 224 | state_save_register_postload(machine, taitosj_postload, NULL); | |
| 225 | 212 | } |
| 226 | 213 | |
| 227 | 214 | |
| r4135 | r4136 | |
| 253 | 240 | { |
| 254 | 241 | if (offset < 0x1800) |
| 255 | 242 | { |
| 256 | dirtycharacter1[(offset / 8) & 0xff] = 1; | |
| 257 | dirtysprite1[(offset / 32) & 0x3f] = 1; | |
| 243 | gfx_element_mark_dirty(space->machine->gfx[0], (offset / 8) & 0xff); | |
| 244 | gfx_element_mark_dirty(space->machine->gfx[1], (offset / 32) & 0x3f); | |
| 258 | 245 | } |
| 259 | 246 | else |
| 260 | 247 | { |
| 261 | dirtycharacter2[(offset / 8) & 0xff] = 1; | |
| 262 | dirtysprite2[(offset / 32) & 0x3f] = 1; | |
| 248 | gfx_element_mark_dirty(space->machine->gfx[2], (offset / 8) & 0xff); | |
| 249 | gfx_element_mark_dirty(space->machine->gfx[3], (offset / 32) & 0x3f); | |
| 263 | 250 | } |
| 264 | 251 | |
| 265 | 252 | taitosj_characterram[offset] = data; |
| r4135 | r4136 | |
| 537 | 524 | } |
| 538 | 525 | |
| 539 | 526 | |
| 540 | static void decode_modified(running_machine *machine) | |
| 541 | { | |
| 542 | offs_t offs; | |
| 543 | ||
| 544 | /* decode modified characters */ | |
| 545 | for (offs = 0;offs < 256;offs++) | |
| 546 | { | |
| 547 | if (dirtycharacter1[offs] == 1) | |
| 548 | { | |
| 549 | decodechar(machine->gfx[0], offs, taitosj_characterram); | |
| 550 | dirtycharacter1[offs] = 0; | |
| 551 | } | |
| 552 | ||
| 553 | if (dirtycharacter2[offs] == 1) | |
| 554 | { | |
| 555 | decodechar(machine->gfx[2], offs, taitosj_characterram + 0x1800); | |
| 556 | dirtycharacter2[offs] = 0; | |
| 557 | } | |
| 558 | } | |
| 559 | ||
| 560 | /* decode modified sprites */ | |
| 561 | for (offs = 0;offs < 64;offs++) | |
| 562 | { | |
| 563 | if (dirtysprite1[offs] == 1) | |
| 564 | { | |
| 565 | decodechar(machine->gfx[1], offs, taitosj_characterram); | |
| 566 | dirtysprite1[offs] = 0; | |
| 567 | } | |
| 568 | ||
| 569 | if (dirtysprite2[offs] == 1) | |
| 570 | { | |
| 571 | decodechar(machine->gfx[3], offs, taitosj_characterram + 0x1800); | |
| 572 | dirtysprite2[offs] = 0; | |
| 573 | } | |
| 574 | } | |
| 575 | } | |
| 576 | ||
| 577 | ||
| 578 | 527 | static void draw_layers(running_machine *machine) |
| 579 | 528 | { |
| 580 | 529 | offs_t offs; |
| r4135 | r4136 | |
| 802 | 751 | |
| 803 | 752 | set_pens(machine); |
| 804 | 753 | |
| 805 | decode_modified(machine); | |
| 806 | ||
| 807 | 754 | draw_layers(machine); |
| 808 | 755 | |
| 809 | 756 | calculate_sprite_areas(machine, sprites_on, sprite_areas); |
| r4135 | r4136 | |
|---|---|---|
| 8 | 8 | #include "cpu/m6809/m6809.h" |
| 9 | 9 | #include "esripsys.h" |
| 10 | 10 | |
| 11 | typedef struct _pixel_ | |
| 11 | ||
| 12 | /************************************* | |
| 13 | * | |
| 14 | * Statics | |
| 15 | * | |
| 16 | *************************************/ | |
| 17 | ||
| 18 | struct | |
| 12 | 19 | { |
| 13 | UINT8 colour; | |
| 14 | UINT8 intensity; | |
| 15 | UINT8 priority; | |
| 16 | } pixel; | |
| 20 | UINT8 *colour_buf; | |
| 21 | UINT8 *intensity_buf; | |
| 22 | UINT8 *priority_buf; | |
| 23 | } line_buffer[2]; | |
| 17 | 24 | |
| 18 | 25 | static emu_timer *hblank_end_timer; |
| 19 | 26 | static emu_timer *hblank_start_timer; |
| 20 | 27 | |
| 21 | 28 | static UINT8 *fig_scale_table; |
| 22 | 29 | static UINT8 *scale_table; |
| 23 | static pixel *line_buffer_1; | |
| 24 | static pixel *line_buffer_2; | |
| 25 | 30 | |
| 26 | static int vcount; | |
| 27 | 31 | static int video_firq; |
| 28 | 32 | static UINT8 bg_intensity; |
| 29 | 33 | |
| 34 | ||
| 35 | /************************************* | |
| 36 | * | |
| 37 | * Globals | |
| 38 | * | |
| 39 | *************************************/ | |
| 40 | ||
| 41 | int esripsys_hblank; | |
| 30 | 42 | int esripsys_video_firq_en; |
| 31 | 43 | int esripsys_frame_vbl; |
| 32 | 44 | int esripsys__12sel; |
| r4135 | r4136 | |
| 41 | 53 | |
| 42 | 54 | static TIMER_CALLBACK( hblank_start_callback ) |
| 43 | 55 | { |
| 44 | int v = v | |
| 56 | int v = video_screen_get_vpos(machine->primary_screen); | |
| 45 | 57 | |
| 46 | 58 | if (video_firq) |
| 47 | 59 | { |
| r4135 | r4136 | |
| 49 | 61 | cpu_set_input_line(machine->cpu[ESRIPSYS_GAME_CPU], M6809_FIRQ_LINE, CLEAR_LINE); |
| 50 | 62 | } |
| 51 | 63 | |
| 52 | if (!(vcount % 6) && vcount && esripsys_video_firq_en && vcount < ESRIPSYS_VBLANK_START) | |
| 64 | /* Not sure if this is totally accurate - I couldn't find the circuit that generates the FIRQs! */ | |
| 65 | if (!(v % 6) && v && esripsys_video_firq_en && v < ESRIPSYS_VBLANK_START) | |
| 53 | 66 | { |
| 54 | 67 | video_firq = 1; |
| 55 | 68 | cpu_set_input_line(machine->cpu[ESRIPSYS_GAME_CPU], M6809_FIRQ_LINE, ASSERT_LINE); |
| 56 | 69 | } |
| 57 | 70 | |
| 58 | 71 | /* Adjust for next scanline */ |
| 59 | if (++vcount >= ESRIPSYS_VTOTAL) | |
| 60 | vcount = 0; | |
| 72 | if (++v >= ESRIPSYS_VTOTAL) | |
| 73 | v = 0; | |
| 61 | 74 | |
| 62 | 75 | /* Set end of HBLANK timer */ |
| 63 | timer_adjust_oneshot(hblank_end_timer, video_screen_get_time_until_pos(machine->primary_screen, v, ESRIPSYS_HTOTAL-1), v); | |
| 76 | timer_adjust_oneshot(hblank_end_timer, video_screen_get_time_until_pos(machine->primary_screen, v, ESRIPSYS_HBLANK_END), v); | |
| 77 | esripsys_hblank = 0; | |
| 64 | 78 | } |
| 65 | 79 | |
| 66 | 80 | static TIMER_CALLBACK( hblank_end_callback ) |
| 67 | 81 | { |
| 68 | video_screen_ | |
| 82 | int v = video_screen_g | |
| 69 | 83 | |
| 84 | if (v > 0) | |
| 85 | video_screen_update_partial(machine->primary_screen, v - 1); | |
| 86 | ||
| 70 | 87 | esripsys__12sel ^= 1; |
| 71 | timer_adjust_oneshot(hblank_start_timer, video_screen_get_time_until_pos(machine->primary_screen, vcount, ESRIPSYS_HBLANK_START), 0); | |
| 88 | timer_adjust_oneshot(hblank_start_timer, video_screen_get_time_until_pos(machine->primary_screen, v, ESRIPSYS_HBLANK_START), 0); | |
| 89 | ||
| 90 | esripsys_hblank = 1; | |
| 72 | 91 | } |
| 73 | 92 | |
| 74 | 93 | VIDEO_START( esripsys ) |
| r4135 | r4136 | |
| 76 | 95 | int i; |
| 77 | 96 | |
| 78 | 97 | /* Allocate memory for the two 512-pixel line buffers */ |
| 79 | line_buffer_1 = auto_malloc(512 * sizeof(pixel)); | |
| 80 | line_buffer_2 = auto_malloc(512 * sizeof(pixel)); | |
| 98 | line_buffer[0].colour_buf = auto_malloc(512); | |
| 99 | line_buffer[0].intensity_buf = auto_malloc(512); | |
| 100 | line_buffer[0].priority_buf = auto_malloc(512); | |
| 81 | 101 | |
| 102 | line_buffer[1].colour_buf = auto_malloc(512); | |
| 103 | line_buffer[1].intensity_buf = auto_malloc(512); | |
| 104 | line_buffer[1].priority_buf = auto_malloc(512); | |
| 105 | ||
| 82 | 106 | /* Create and initialise the HBLANK timers */ |
| 83 | 107 | hblank_start_timer = timer_alloc(machine, hblank_start_callback, NULL); |
| 84 | 108 | hblank_end_timer = timer_alloc(machine, hblank_end_callback, NULL); |
| r4135 | r4136 | |
| 140 | 164 | fig_scale_table[i * 64 + scale] = scaled_pixels - 1; |
| 141 | 165 | } |
| 142 | 166 | } |
| 167 | ||
| 168 | /* Register stuff for state saving */ | |
| 169 | state_save_register_global_pointer(machine, line_buffer[0].colour_buf, 512); | |
| 170 | state_save_register_global_pointer(machine, line_buffer[0].intensity_buf, 512); | |
| 171 | state_save_register_global_pointer(machine, line_buffer[0].priority_buf, 512); | |
| 172 | ||
| 173 | state_save_register_global_pointer(machine, line_buffer[1].colour_buf, 512); | |
| 174 | state_save_register_global_pointer(machine, line_buffer[1].intensity_buf, 512); | |
| 175 | state_save_register_global_pointer(machine, line_buffer[1].priority_buf, 512); | |
| 176 | ||
| 177 | state_save_register_global(machine, video_firq); | |
| 178 | state_save_register_global(machine, bg_intensity); | |
| 179 | state_save_register_global(machine, esripsys_hblank); | |
| 180 | state_save_register_global(machine, esripsys_video_firq_en); | |
| 181 | state_save_register_global(machine, esripsys_frame_vbl); | |
| 182 | state_save_register_global(machine, esripsys__12sel); | |
| 143 | 183 | } |
| 144 | 184 | |
| 145 | 185 | VIDEO_UPDATE( esripsys ) |
| 146 | 186 | { |
| 147 | int x; | |
| 148 | int y; | |
| 149 | pixel *src; | |
| 187 | int x, y; | |
| 150 | 188 | |
| 151 | /* Select line buffer to scan out */ | |
| 152 | if (esripsys__12sel) | |
| 153 | src = line_buffer_2; | |
| 154 | else | |
| 155 | src = line_buffer_1; | |
| 189 | UINT8 *colour_buf = line_buffer[esripsys__12sel ? 0 : 1].colour_buf; | |
| 190 | UINT8 *intensity_buf = line_buffer[esripsys__12sel ? 0 : 1].intensity_buf; | |
| 191 | UINT8 *priority_buf = line_buffer[esripsys__12sel ? 0 : 1].priority_buf; | |
| 156 | 192 | |
| 157 | 193 | for (y = cliprect->min_y; y <= cliprect->max_y; ++y) |
| 158 | 194 | { |
| 159 | UINT32 *dest = BITMAP_ADDR32(bitmap, y, | |
| 195 | UINT32 *dest = BITMAP_ADDR32(bitmap, y, cliprect->min_x); | |
| 160 | 196 | |
| 161 | for (x = | |
| 197 | for (x = 0 | |
| 162 | 198 | { |
| 163 | int idx = | |
| 199 | int idx = | |
| 164 | 200 | int r = (esripsys_pal_ram[idx] & 0xf); |
| 165 | 201 | int g = (esripsys_pal_ram[256 + idx] & 0xf); |
| 166 | 202 | int b = (esripsys_pal_ram[512 + idx] & 0xf); |
| 167 | int i = | |
| 203 | int i = | |
| 168 | 204 | |
| 169 | 205 | *dest++ = MAKE_RGB(r*i, g*i, b*i); |
| 170 | 206 | |
| 171 | 207 | /* Clear the line buffer as we scan out */ |
| 172 | src[x].colour = 0xff; | |
| 173 | src[x].intensity = bg_intensity; | |
| 174 | src[x].priority = 0; | |
| 208 | colour_buf[x] = 0xff; | |
| 209 | intensity_buf[x] = bg_intensity; | |
| 210 | priority_buf[x] = 0; | |
| 175 | 211 | } |
| 176 | 212 | } |
| 177 | 213 | |
| r4135 | r4136 | |
| 186 | 222 | /* Draw graphics to a line buffer */ |
| 187 | 223 | int esripsys_draw(running_machine *machine, int l, int r, int fig, int attr, int addr, int col, int x_scale, int line_latch) |
| 188 | 224 | { |
| 189 | pixel *dst; | |
| 225 | UINT8 *colour_buf = line_buffer[esripsys__12sel ? 1 : 0].colour_buf; | |
| 226 | UINT8 *intensity_buf = line_buffer[esripsys__12sel ? 1 : 0].intensity_buf; | |
| 227 | UINT8 *priority_buf = line_buffer[esripsys__12sel ? 1 : 0].priority_buf; | |
| 228 | ||
| 190 | 229 | UINT8 pri = attr & 0xff; |
| 191 | 230 | UINT8 iny = (attr >> 8) & 0xf; |
| 192 | 231 | UINT8 pal = col << 4; |
| r4135 | r4136 | |
| 198 | 237 | if (xs_typ) |
| 199 | 238 | fig = fig_scale_table[fig * 64 + xs_val]; |
| 200 | 239 | |
| 201 | if (esripsys__12sel) | |
| 202 | dst = line_buffer_1; | |
| 203 | else | |
| 204 | dst = line_buffer_2; | |
| 205 | ||
| 206 | 240 | /* 8bpp case */ |
| 207 | 241 | if (attr & 0x8000) |
| 208 | 242 | { |
| r4135 | r4136 | |
| 230 | 264 | UINT8 pix1 = rom_l[rom_addr]; |
| 231 | 265 | UINT8 pix2 = rom_r[rom_addr]; |
| 232 | 266 | |
| 233 | if ( | |
| 267 | if ( | |
| 234 | 268 | { |
| 235 | if ((pri > | |
| 269 | if ((pri > | |
| 236 | 270 | { |
| 237 | dst[lpos].colour = pix1; | |
| 238 | dst[lpos].priority = pri; | |
| 239 | dst[lpos].intensity = iny; | |
| 271 | colour_buf[lpos] = pix1; | |
| 272 | priority_buf[lpos] = pri; | |
| 273 | intensity_buf[lpos] = iny; | |
| 240 | 274 | } |
| 241 | 275 | } |
| 242 | 276 | |
| 243 | if ( | |
| 277 | if ( | |
| 244 | 278 | { |
| 245 | if ((pri > | |
| 279 | if ((pri > | |
| 246 | 280 | { |
| 247 | dst[rpos].colour = pix2; | |
| 248 | dst[rpos].priority = pri; | |
| 249 | dst[rpos].intensity = iny; | |
| 281 | colour_buf[rpos] = pix2; | |
| 282 | priority_buf[rpos] = pri; | |
| 283 | intensity_buf[rpos] = iny; | |
| 250 | 284 | } |
| 251 | 285 | } |
| 252 | 286 | |
| r4135 | r4136 | |
| 307 | 341 | px1 = (px8 >> 4) & 0xf; |
| 308 | 342 | } |
| 309 | 343 | |
| 310 | if ( | |
| 344 | if ( | |
| 311 | 345 | { |
| 312 | if ( | |
| 346 | if ( | |
| 313 | 347 | { |
| 314 | dst[lpos].colour = pal | px1; | |
| 315 | dst[lpos].priority = pri; | |
| 316 | dst[lpos].intensity = iny; | |
| 348 | colour_buf[lpos] = pal | px1; | |
| 349 | priority_buf[lpos] = pri; | |
| 350 | intensity_buf[lpos] = iny; | |
| 317 | 351 | } |
| 318 | 352 | } |
| 319 | 353 | |
| 320 | if ( | |
| 354 | if ( | |
| 321 | 355 | { |
| 322 | if (pri > | |
| 356 | if (pri > | |
| 323 | 357 | { |
| 324 | dst[rpos].colour = pal | px2; | |
| 325 | dst[rpos].priority = pri; | |
| 326 | dst[rpos].intensity = iny; | |
| 358 | colour_buf[rpos] = pal | px2; | |
| 359 | priority_buf[rpos] = pri; | |
| 360 | intensity_buf[rpos] = iny; | |
| 327 | 361 | } |
| 328 | 362 | } |
| 329 | 363 |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | size_t f1gp_spr1cgram_size,f1gp_spr2cgram_size; |
| 11 | 11 | |
| 12 | 12 | static UINT16 *zoomdata; |
| 13 | static int dirtygfx,flipscreen,gfxctrl; | |
| 14 | static UINT8 *dirtychar; | |
| 13 | static int flipscreen,gfxctrl; | |
| 15 | 14 | |
| 16 | 15 | #define TOTAL_CHARS 0x800 |
| 17 | 16 | |
| r4135 | r4136 | |
| 63 | 62 | |
| 64 | 63 | tilemap_set_transparent_pen(fg_tilemap,0xff); |
| 65 | 64 | |
| 66 | dirtychar = auto_malloc(TOTAL_CHARS); | |
| 67 | memset(dirtychar,1,TOTAL_CHARS); | |
| 68 | ||
| 69 | 65 | zoomdata = (UINT16 *)memory_region(machine, "gfx4"); |
| 66 | gfx_element_set_source(machine->gfx[3], (UINT8 *)zoomdata); | |
| 70 | 67 | } |
| 71 | 68 | |
| 72 | 69 | VIDEO_START( f1gpb ) |
| r4135 | r4136 | |
| 76 | 73 | |
| 77 | 74 | tilemap_set_transparent_pen(fg_tilemap,0xff); |
| 78 | 75 | |
| 79 | dirtychar = auto_malloc(TOTAL_CHARS); | |
| 80 | memset(dirtychar,1,TOTAL_CHARS); | |
| 81 | ||
| 82 | 76 | zoomdata = (UINT16 *)memory_region(machine, "gfx4"); |
| 77 | gfx_element_set_source(machine->gfx[3], (UINT8 *)zoomdata); | |
| 83 | 78 | } |
| 84 | 79 | |
| 85 | 80 | VIDEO_START( f1gp2 ) |
| r4135 | r4136 | |
| 95 | 90 | |
| 96 | 91 | tilemap_set_scrolldx(fg_tilemap,-80,0); |
| 97 | 92 | tilemap_set_scrolldy(fg_tilemap,-26,0); |
| 98 | ||
| 99 | dirtychar = auto_malloc(TOTAL_CHARS); | |
| 100 | memset(dirtychar,1,TOTAL_CHARS); | |
| 101 | ||
| 102 | zoomdata = (UINT16 *)memory_region(machine, "gfx4"); | |
| 103 | 93 | } |
| 104 | 94 | |
| 105 | 95 | |
| r4135 | r4136 | |
| 116 | 106 | |
| 117 | 107 | WRITE16_HANDLER( f1gp_zoomdata_w ) |
| 118 | 108 | { |
| 119 | int oldword = zoomdata[offset]; | |
| 120 | 109 | COMBINE_DATA(&zoomdata[offset]); |
| 121 | if (oldword != zoomdata[offset]) | |
| 122 | { | |
| 123 | dirtygfx = 1; | |
| 124 | dirtychar[offset / 64] = 1; | |
| 125 | } | |
| 110 | gfx_element_mark_dirty(space->machine->gfx[3], offset / 64); | |
| 126 | 111 | } |
| 127 | 112 | |
| 128 | 113 | READ16_HANDLER( f1gp_rozvideoram_r ) |
| r4135 | r4136 | |
| 330 | 315 | |
| 331 | 316 | VIDEO_UPDATE( f1gp ) |
| 332 | 317 | { |
| 333 | if (dirtygfx) | |
| 334 | { | |
| 335 | int i; | |
| 336 | ||
| 337 | dirtygfx = 0; | |
| 338 | ||
| 339 | for (i = 0;i < TOTAL_CHARS;i++) | |
| 340 | { | |
| 341 | if (dirtychar[i]) | |
| 342 | { | |
| 343 | dirtychar[i] = 0; | |
| 344 | decodechar(screen->machine->gfx[3],i,(UINT8 *)zoomdata); | |
| 345 | } | |
| 346 | } | |
| 347 | ||
| 348 | tilemap_mark_all_tiles_dirty(roz_tilemap); | |
| 349 | } | |
| 350 | ||
| 351 | ||
| 352 | ||
| 353 | 318 | bitmap_fill(priority_bitmap, cliprect, 0); |
| 354 | 319 | |
| 355 | 320 | K053936_0_zoom_draw(bitmap,cliprect,roz_tilemap,0,0); |
| r4135 | r4136 | |
| 375 | 340 | UINT32 startx,starty; |
| 376 | 341 | int incxx,incxy,incyx,incyy; |
| 377 | 342 | |
| 378 | if (dirtygfx) | |
| 379 | { | |
| 380 | int i; | |
| 381 | ||
| 382 | dirtygfx = 0; | |
| 383 | ||
| 384 | for (i = 0;i < TOTAL_CHARS;i++) | |
| 385 | { | |
| 386 | if (dirtychar[i]) | |
| 387 | { | |
| 388 | dirtychar[i] = 0; | |
| 389 | decodechar(screen->machine->gfx[3],i,(UINT8 *)zoomdata); | |
| 390 | } | |
| 391 | } | |
| 392 | ||
| 393 | tilemap_mark_all_tiles_dirty(roz_tilemap); | |
| 394 | } | |
| 395 | ||
| 396 | 343 | incxy = (INT16)f1gpb_rozregs[1]; |
| 397 | 344 | incyx = -incxy; |
| 398 | 345 | incxx = incyy = (INT16)f1gpb_rozregs[3]; |
| r4135 | r4136 | |
|---|---|---|
| 294 | 294 | { |
| 295 | 295 | int i; |
| 296 | 296 | /* set table for sprite color == 0x0f */ |
| 297 | for(i = 0;i <= 253;i++) | |
| 298 | { | |
| 299 | gfx_drawmode_table[i] = DRAWMODE_SOURCE; | |
| 300 | } | |
| 301 | gfx_drawmode_table[254] = DRAWMODE_SHADOW; | |
| 302 | gfx_drawmode_table[255] = DRAWMODE_NONE; | |
| 303 | 297 | for( i = 0; i<16*256; i++ ) |
| 304 | 298 | { |
| 305 | 299 | machine->shadow_table[i] = i+0x2000; |
| r4135 | r4136 | |
| 334 | 328 | clip->min_y = GetPaletteRegister(2) - 0x21; |
| 335 | 329 | clip->max_y = GetPaletteRegister(3) - 0x21 - 1; |
| 336 | 330 | /* intersect with master clip rectangle */ |
| 337 | if( clip->min_x < cliprect->min_x ){ clip->min_x = cliprect->min_x; } | |
| 338 | if( clip->min_y < cliprect->min_y ){ clip->min_y = cliprect->min_y; } | |
| 339 | if( clip->max_x > cliprect->max_x ){ clip->max_x = cliprect->max_x; } | |
| 340 | if( clip->max_y > cliprect->max_y ){ clip->max_y = cliprect->max_y; } | |
| 331 | sect_rect(clip, cliprect); | |
| 341 | 332 | } /* ApplyClip */ |
| 342 | 333 | |
| 343 | 334 | VIDEO_UPDATE( namcos2_default ) |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | UINT8 *polyplay_characterram; |
| 17 | static UINT8 dirtycharacter[256]; | |
| 18 | 17 | |
| 19 | 18 | |
| 20 | 19 | |
| r4135 | r4136 | |
| 38 | 37 | { |
| 39 | 38 | if (polyplay_characterram[offset] != data) |
| 40 | 39 | { |
| 41 | dirtyc | |
| 40 | gfx_element_mark_dirty(space->ma | |
| 42 | 41 | |
| 43 | 42 | polyplay_characterram[offset] = data; |
| 44 | 43 | } |
| 45 | 44 | } |
| 46 | 45 | |
| 46 | VIDEO_START( polyplay ) | |
| 47 | { | |
| 48 | gfx_element_set_source(machine->gfx[1], polyplay_characterram); | |
| 49 | } | |
| 47 | 50 | |
| 51 | ||
| 48 | 52 | VIDEO_UPDATE( polyplay ) |
| 49 | 53 | { |
| 50 | 54 | offs_t offs; |
| r4135 | r4136 | |
| 56 | 60 | int sy = offs >> 6 << 3; |
| 57 | 61 | UINT8 code = videoram[offs]; |
| 58 | 62 | |
| 59 | if (dirtycharacter[code]) | |
| 60 | { | |
| 61 | decodechar(screen->machine->gfx[1], code & 0x7f, polyplay_characterram); | |
| 62 | ||
| 63 | dirtycharacter[code] = 0; | |
| 64 | } | |
| 65 | ||
| 66 | 63 | drawgfx(bitmap,screen->machine->gfx[(code >> 7) & 0x01], |
| 67 | 64 | code, 0, 0, 0, sx, sy, |
| 68 | 65 | cliprect, TRANSPARENCY_NONE, 0); |
| r4135 | r4136 | |
|---|---|---|
| 420 | 420 | sy -= (VBSTART - VBEND); |
| 421 | 421 | |
| 422 | 422 | /* draw line */ |
| 423 | draw_scanline8(bitmap, 0, y, (HBSTART - HBEND), &local_videoram[sy * 512], NULL | |
| 423 | draw_scanline8(bitmap, 0, y, (HBSTART - HBEND), &local_videoram[sy * 512], NULL | |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | /* draw the sprites */ |
| r4135 | r4136 | |
|---|---|---|
| 20 | 20 | { |
| 21 | 21 | for (offs = 0x800-4;offs >= 0; offs -= 4) |
| 22 | 22 | { |
| 23 | int | |
| 23 | int | |
| 24 | 24 | |
| 25 | 25 | /* Draw the main spritebank after the other one */ |
| 26 | 26 | if (bank==0) |
| r4135 | r4136 | |
| 41 | 41 | |
| 42 | 42 | /* Alpha on chip 2 only */ |
| 43 | 43 | if (bank==1 && x&0xc000) |
| 44 | | |
| 44 | | |
| 45 | 45 | |
| 46 | 46 | y = spritebase[offs]; |
| 47 | 47 | flash=y&0x1000; |
| r4135 | r4136 | |
| 134 | 134 | colour, |
| 135 | 135 | fx,fy, |
| 136 | 136 | x,y + mult * multi, |
| 137 | cliprect, | |
| 137 | cliprect, | |
| 138 | 138 | |
| 139 | 139 | multi--; |
| 140 | 140 | } |
| r4135 | r4136 | |
| 157 | 157 | deco16_set_tilemap_bank_callback(1,dassault_bank_callback); |
| 158 | 158 | deco16_set_tilemap_bank_callback(2,dassault_bank_callback); |
| 159 | 159 | deco16_set_tilemap_bank_callback(3,dassault_bank_callback); |
| 160 | ||
| 161 | alpha_set_level(0x80); | |
| 162 | 160 | } |
| 163 | 161 | |
| 164 | 162 | /******************************************************************************/ |
| r4135 | r4136 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | offset=offset%0xc000; |
| 50 | 50 | |
| 51 | | |
| 51 | gfx_el | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| r4135 | r4136 | |
| 207 | 207 | |
| 208 | 208 | memset(shadow_pen_array, 0, 8192); |
| 209 | 209 | tilemap_set_transparent_pen(tx_layer,0); |
| 210 | ||
| 211 | gfx_element_set_source(machine->gfx[1], (UINT8 *)roundup5_vram); | |
| 210 | 212 | } |
| 211 | 213 | |
| 212 | 214 | VIDEO_START( cyclwarr ) |
| r4135 | r4136 | |
| 271 | 273 | { |
| 272 | 274 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 273 | 275 | const UINT8 *shadow_pens = shadow_pen_array + (gfx->color_granularity * (color % gfx->total_colors)); |
| 274 | | |
| 276 | const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements) | |
| 275 | 277 | |
| 276 | 278 | int block_size = 8 * scalex; |
| 277 | 279 | int sprite_screen_height = ((ssy&0xffff)+block_size)>>16; |
| r4135 | r4136 | |
| 397 | 399 | int x, x_index = x_index_base; |
| 398 | 400 | for( x=sx; x<ex; x++ ) |
| 399 | 401 | { |
| 400 | UINT8 *source = | |
| 402 | const UINT8 *source = | |
| 401 | 403 | int c = source[(cx >> 16)]; |
| 402 | 404 | if( c != transparent_color ) |
| 403 | 405 | { |
| r4135 | r4136 | |
| 421 | 423 | { |
| 422 | 424 | for( y=sy; y<ey; y++ ) |
| 423 | 425 | { |
| 424 | UINT8 *source = | |
| 426 | const UINT8 *source = | |
| 425 | 427 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 426 | 428 | UINT8 *priority_dest = BITMAP_ADDR8(dest_bmp, y, 0); |
| 427 | 429 |
| r4135 | r4136 | |
|---|---|---|
| 1212 | 1212 | |
| 1213 | 1213 | memcpy(&gl, layout, sizeof(gl)); |
| 1214 | 1214 | gl.total = total; |
| 1215 | machine->gfx[gfx_index] = allocgfx(machine, &gl); | |
| 1216 | decodegfx(machine->gfx[gfx_index], data, 0, machine->gfx[gfx_index]->total_elements); | |
| 1217 | ||
| 1218 | /* set the color information */ | |
| 1219 | machine->gfx[gfx_index]->total_colors = machine->config->total_colors / (1 << bpp); | |
| 1215 | machine->gfx[gfx_index] = gfx_element_alloc(machine, &gl, data, machine->config->total_colors >> bpp, 0); | |
| 1220 | 1216 | } |
| 1221 | 1217 | |
| 1222 | 1218 | |
| r4135 | r4136 | |
| 2477 | 2473 | void K051960_vh_start(running_machine *machine,const char *gfx_memory_region,int plane_order, |
| 2478 | 2474 | void (*callback)(int *code,int *color,int *priority,int *shadow)) |
| 2479 | 2475 | { |
| 2480 | int gfx_index | |
| 2476 | int gfx_index | |
| 2481 | 2477 | UINT32 total; |
| 2482 | 2478 | static const gfx_layout spritelayout = |
| 2483 | 2479 | { |
| r4135 | r4136 | |
| 2548 | 2544 | if (VERBOSE && !(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) |
| 2549 | 2545 | popmessage("driver should use VIDEO_HAS_SHADOWS"); |
| 2550 | 2546 | |
| 2551 | /* prepare shadow draw table */ | |
| 2552 | gfx_drawmode_table[0] = DRAWMODE_NONE; | |
| 2553 | for (i = 1;i < 15;i++) | |
| 2554 | gfx_drawmode_table[i] = DRAWMODE_SOURCE; | |
| 2555 | gfx_drawmode_table[15] = DRAWMODE_SHADOW; | |
| 2556 | ||
| 2557 | 2547 | K051960_dx = K051960_dy = 0; |
| 2558 | 2548 | |
| 2559 | 2549 | K051960_memory_region = gfx_memory_region; |
| r4135 | r4136 | |
| 2730 | 2720 | * Note that Aliens also uses the shadow bit to select the second sprite bank. |
| 2731 | 2721 | */ |
| 2732 | 2722 | |
| 2733 | void K051960_sprites_draw(bitmap_t *bitmap,const rectangle *cliprect,int min_priority,int max_priority) | |
| 2723 | void K051960_sprites_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int min_priority,int max_priority) | |
| 2734 | 2724 | { |
| 2735 | 2725 | #define NUM_SPRITES 128 |
| 2736 | 2726 | int offs,pri_code; |
| 2737 | 2727 | int sortedlist[NUM_SPRITES]; |
| 2728 | UINT8 drawmode_table[256]; | |
| 2738 | 2729 | |
| 2730 | memset(drawmode_table, DRAWMODE_SOURCE, sizeof(drawmode_table)); | |
| 2731 | drawmode_table[0] = DRAWMODE_NONE; | |
| 2732 | ||
| 2739 | 2733 | for (offs = 0;offs < NUM_SPRITES;offs++) |
| 2740 | 2734 | sortedlist[offs] = -1; |
| 2741 | 2735 | |
| r4135 | r4136 | |
| 2812 | 2806 | flipy = !flipy; |
| 2813 | 2807 | } |
| 2814 | 2808 | |
| 2809 | drawmode_table[K051960_gfx->color_granularity-1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; | |
| 2810 | ||
| 2815 | 2811 | if (zoomx == 0x10000 && zoomy == 0x10000) |
| 2816 | 2812 | { |
| 2817 | 2813 | int sx,sy; |
| r4135 | r4136 | |
| 2831 | 2827 | else c += yoffset[y]; |
| 2832 | 2828 | |
| 2833 | 2829 | if (max_priority == -1) |
| 2834 | pdrawgfx(bitmap,K051960_gfx, | |
| 2830 | pdrawgfx_transtable(bitmap,cliprect,K051960_gfx, | |
| 2835 | 2831 | c, |
| 2836 | 2832 | color, |
| 2837 | 2833 | flipx,flipy, |
| 2838 | 2834 | sx & 0x1ff,sy, |
| 2839 | cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0,pri); | |
| 2835 | priority_bitmap,pri, | |
| 2836 | drawmode_table,machine->shadow_table); | |
| 2840 | 2837 | else |
| 2841 | drawgfx(bitmap,K051960_gfx, | |
| 2838 | drawgfx_transtable(bitmap,cliprect,K051960_gfx, | |
| 2842 | 2839 | c, |
| 2843 | 2840 | color, |
| 2844 | 2841 | flipx,flipy, |
| 2845 | 2842 | sx & 0x1ff,sy, |
| 2846 | | |
| 2843 | d | |
| 2847 | 2844 | } |
| 2848 | 2845 | } |
| 2849 | 2846 | } |
| r4135 | r4136 | |
| 2868 | 2865 | else c += yoffset[y]; |
| 2869 | 2866 | |
| 2870 | 2867 | if (max_priority == -1) |
| 2871 | pdrawgfxzoom(bitmap,K051960_gfx, | |
| 2868 | pdrawgfxzoom_transtable(bitmap,cliprect,K051960_gfx, | |
| 2872 | 2869 | c, |
| 2873 | 2870 | color, |
| 2874 | 2871 | flipx,flipy, |
| 2875 | 2872 | sx & 0x1ff,sy, |
| 2876 | cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0, | |
| 2877 | (zw << 16) / 16,(zh << 16) / 16,pri); | |
| 2873 | (zw << 16) / 16,(zh << 16) / 16, | |
| 2874 | priority_bitmap,pri, | |
| 2875 | drawmode_table,machine->shadow_table); | |
| 2878 | 2876 | else |
| 2879 | drawgfxzoom(bitmap,K051960_gfx, | |
| 2877 | drawgfxzoom_transtable(bitmap,cliprect,K051960_gfx, | |
| 2880 | 2878 | c, |
| 2881 | 2879 | color, |
| 2882 | 2880 | flipx,flipy, |
| 2883 | 2881 | sx & 0x1ff,sy, |
| 2884 | cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0, | |
| 2885 | (zw << 16) / 16,(zh << 16) / 16); | |
| 2882 | (zw << 16) / 16,(zh << 16) / 16, | |
| 2883 | drawmode_table,machine->shadow_table); | |
| 2886 | 2884 | } |
| 2887 | 2885 | } |
| 2888 | 2886 | } |
| r4135 | r4136 | |
| 2999 | 2997 | void K053245_vh_start(running_machine *machine,int chip, const char *gfx_memory_region,int plane_order, |
| 3000 | 2998 | void (*callback)(int *code,int *color,int *priority)) |
| 3001 | 2999 | { |
| 3002 | int gfx_index | |
| 3000 | int gfx_index | |
| 3003 | 3001 | UINT32 total; |
| 3004 | 3002 | static const gfx_layout spritelayout = |
| 3005 | 3003 | { |
| r4135 | r4136 | |
| 3042 | 3040 | popmessage("driver should use VIDEO_HAS_SHADOWS"); |
| 3043 | 3041 | |
| 3044 | 3042 | |
| 3045 | /* prepare shadow draw table */ | |
| 3046 | gfx_drawmode_table[0] = DRAWMODE_NONE; | |
| 3047 | for (i = 1;i < 15;i++) | |
| 3048 | gfx_drawmode_table[i] = DRAWMODE_SOURCE; | |
| 3049 | gfx_drawmode_table[15] = DRAWMODE_SHADOW; | |
| 3050 | 3043 | K05324x_z_rejection = -1; |
| 3051 | 3044 | K053245_memory_region[chip] = gfx_memory_region; |
| 3052 | 3045 | K053245_gfx[chip] = machine->gfx[gfx_index]; |
| r4135 | r4136 | |
| 3244 | 3237 | * The rest of the sprite remains normal. |
| 3245 | 3238 | */ |
| 3246 | 3239 | |
| 3247 | void K053245_sprites_draw(int chip, bitmap_t *bitmap,const rectangle *cliprect) //* | |
| 3240 | void K053245_sprites_draw(running_machine *machine, int chip, bitmap_t *bitmap,const rectangle *cliprect) //* | |
| 3248 | 3241 | { |
| 3249 | 3242 | #define NUM_SPRITES 128 |
| 3250 | 3243 | int offs,pri_code,i; |
| 3251 | 3244 | int sortedlist[NUM_SPRITES]; |
| 3252 | 3245 | int flipscreenX, flipscreenY, spriteoffsX, spriteoffsY; |
| 3246 | UINT8 drawmode_table[256]; | |
| 3253 | 3247 | |
| 3248 | memset(drawmode_table, DRAWMODE_SOURCE, sizeof(drawmode_table)); | |
| 3249 | drawmode_table[0] = DRAWMODE_NONE; | |
| 3250 | ||
| 3254 | 3251 | flipscreenX = K053244_regs[chip][5] & 0x01; |
| 3255 | 3252 | flipscreenY = K053244_regs[chip][5] & 0x02; |
| 3256 | 3253 | spriteoffsX = (K053244_regs[chip][0] << 8) | K053244_regs[chip][1]; |
| r4135 | r4136 | |
| 3372 | 3369 | ox -= (zoomx * w) >> 13; |
| 3373 | 3370 | oy -= (zoomy * h) >> 13; |
| 3374 | 3371 | |
| 3372 | drawmode_table[K053245_gfx[chip]->color_granularity-1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; | |
| 3373 | ||
| 3375 | 3374 | for (y = 0;y < h;y++) |
| 3376 | 3375 | { |
| 3377 | 3376 | int sx,sy,zw,zh; |
| r4135 | r4136 | |
| 3434 | 3433 | |
| 3435 | 3434 | if (zoomx == 0x10000 && zoomy == 0x10000) |
| 3436 | 3435 | { |
| 3437 | pdrawgfx(bitmap,K053245_gfx[chip], | |
| 3436 | pdrawgfx_transtable(bitmap,cliprect,K053245_gfx[chip], | |
| 3438 | 3437 | c, |
| 3439 | 3438 | color, |
| 3440 | 3439 | fx,fy, |
| 3441 | 3440 | sx,sy, |
| 3442 | cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0,pri); | |
| 3441 | priority_bitmap,pri, | |
| 3442 | drawmode_table,machine->shadow_table); | |
| 3443 | 3443 | } |
| 3444 | 3444 | else |
| 3445 | 3445 | { |
| 3446 | pdrawgfxzoom(bitmap,K053245_gfx[chip], | |
| 3446 | pdrawgfxzoom_transtable(bitmap,cliprect,K053245_gfx[chip], | |
| 3447 | 3447 | c, |
| 3448 | 3448 | color, |
| 3449 | 3449 | fx,fy, |
| 3450 | 3450 | sx,sy, |
| 3451 | cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0, | |
| 3452 | (zw << 16) / 16,(zh << 16) / 16,pri); | |
| 3451 | (zw << 16) / 16,(zh << 16) / 16, | |
| 3452 | priority_bitmap,pri, | |
| 3453 | drawmode_table,machine->shadow_table); | |
| 3453 | 3454 | |
| 3454 | 3455 | } |
| 3455 | 3456 | } |
| r4135 | r4136 | |
| 3479 | 3480 | int offs,pri_code,i; |
| 3480 | 3481 | int sortedlist[NUM_SPRITES]; |
| 3481 | 3482 | int flipscreenX, flipscreenY, spriteoffsX, spriteoffsY; |
| 3483 | UINT8 drawmode_table[256]; | |
| 3482 | 3484 | |
| 3485 | memset(drawmode_table, DRAWMODE_SOURCE, sizeof(drawmode_table)); | |
| 3486 | drawmode_table[0] = DRAWMODE_NONE; | |
| 3487 | ||
| 3483 | 3488 | flipscreenX = K053244_regs[chip][5] & 0x01; |
| 3484 | 3489 | flipscreenY = K053244_regs[chip][5] & 0x02; |
| 3485 | 3490 | spriteoffsX = (K053244_regs[chip][0] << 8) | K053244_regs[chip][1]; |
| r4135 | r4136 | |
| 3601 | 3606 | ox -= (zoomx * w) >> 13; |
| 3602 | 3607 | oy -= (zoomy * h) >> 13; |
| 3603 | 3608 | |
| 3609 | drawmode_table[machine->gfx[0]->color_granularity-1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; | |
| 3610 | ||
| 3604 | 3611 | for (y = 0;y < h;y++) |
| 3605 | 3612 | { |
| 3606 | 3613 | int sx,sy,zw,zh; |
| r4135 | r4136 | |
| 3663 | 3670 | |
| 3664 | 3671 | if (zoomx == 0x10000 && zoomy == 0x10000) |
| 3665 | 3672 | { |
| 3666 | pdrawgfx(bitmap,machine->gfx[0], /* hardcoded to 0 (decoded 6bpp gfx) for le */ | |
| 3673 | pdrawgfx_transtable(bitmap,cliprect,machine->gfx[0], /* hardcoded to 0 (decoded 6bpp gfx) for le */ | |
| 3667 | 3674 | c, |
| 3668 | 3675 | color, |
| 3669 | 3676 | fx,fy, |
| 3670 | 3677 | sx,sy, |
| 3671 | cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0,pri); | |
| 3678 | priority_bitmap,pri, | |
| 3679 | drawmode_table,machine->shadow_table); | |
| 3672 | 3680 | } |
| 3673 | 3681 | else |
| 3674 | 3682 | { |
| 3675 | pdrawgfxzoom(bitmap,machine->gfx[0], /* hardcoded to 0 (decoded 6bpp gfx) for le */ | |
| 3683 | pdrawgfxzoom_transtable(bitmap,cliprect,machine->gfx[0], /* hardcoded to 0 (decoded 6bpp gfx) for le */ | |
| 3676 | 3684 | c, |
| 3677 | 3685 | color, |
| 3678 | 3686 | fx,fy, |
| 3679 | 3687 | sx,sy, |
| 3680 | cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0, | |
| 3681 | (zw << 16) / 16,(zh << 16) / 16,pri); | |
| 3688 | (zw << 16) / 16,(zh << 16) / 16, | |
| 3689 | priority_bitmap,pri, | |
| 3690 | drawmode_table,machine->shadow_table); | |
| 3682 | 3691 | |
| 3683 | 3692 | } |
| 3684 | 3693 | } |
| r4135 | r4136 | |
| 3747 | 3756 | void K053247_vh_start(running_machine *machine, const char *gfx_memory_region, int dx, int dy, int plane_order, |
| 3748 | 3757 | void (*callback)(int *code,int *color,int *priority)) |
| 3749 | 3758 | { |
| 3750 | int gfx_index | |
| 3759 | int gfx_index | |
| 3751 | 3760 | UINT32 total; |
| 3752 | 3761 | static const gfx_layout spritelayout = |
| 3753 | 3762 | { |
| r4135 | r4136 | |
| 3795 | 3804 | } |
| 3796 | 3805 | } |
| 3797 | 3806 | |
| 3798 | /* prepare shadow draw table */ | |
| 3799 | gfx_drawmode_table[0] = DRAWMODE_NONE; | |
| 3800 | for (i = 1;i < 15;i++) | |
| 3801 | gfx_drawmode_table[i] = DRAWMODE_SOURCE; | |
| 3802 | gfx_drawmode_table[15] = DRAWMODE_SHADOW; | |
| 3803 | ||
| 3804 | 3807 | K053247_dx = dx; |
| 3805 | 3808 | K053247_dy = dy; |
| 3806 | 3809 | K053247_wraparound = 1; |
| r4135 | r4136 | |
| 3871 | 3874 | 16*16*6 |
| 3872 | 3875 | }; |
| 3873 | 3876 | UINT8 *s1, *s2, *d; |
| 3874 | long i | |
| 3877 | long i | |
| 3875 | 3878 | UINT16 *K055673_rom; |
| 3876 | 3879 | int size4; |
| 3877 | 3880 | |
| r4135 | r4136 | |
| 3930 | 3933 | if (VERBOSE && !(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) |
| 3931 | 3934 | popmessage("driver should use VIDEO_HAS_SHADOWS"); |
| 3932 | 3935 | |
| 3933 | /* prepare shadow draw table */ | |
| 3934 | c = machine->gfx[gfx_index]->color_granularity-1; | |
| 3935 | gfx_drawmode_table[0] = DRAWMODE_NONE; | |
| 3936 | for (i = 1;i < c;i++) | |
| 3937 | gfx_drawmode_table[i] = DRAWMODE_SOURCE; | |
| 3938 | gfx_drawmode_table[c] = DRAWMODE_SHADOW; | |
| 3939 | ||
| 3940 | 3936 | K053247_dx = dx; |
| 3941 | 3937 | K053247_dy = dy; |
| 3942 | 3938 | K053247_wraparound = 1; |
| r4135 | r4136 | |
| 4035 | 4031 | { |
| 4036 | 4032 | case 0: // 20k / 36u |
| 4037 | 4033 | return ROM[romofs+2]; |
| 4038 | break; | |
| 4039 | 4034 | case 1: // 17k / 36y |
| 4040 | 4035 | return ROM[romofs+3]; |
| 4041 | break; | |
| 4042 | 4036 | case 2: // 10k / 32y |
| 4043 | 4037 | case 3: |
| 4044 | 4038 | romofs /= 2; |
| 4045 | return ROM8[romofs+1]; | |
| 4046 | break; | |
| 4039 | return ROM8[romofs+1]; | |
| 4047 | 4040 | case 4: // 22k / 34u |
| 4048 | 4041 | return ROM[romofs]; |
| 4049 | break; | |
| 4050 | 4042 | case 5: // 19k / 34y |
| 4051 | 4043 | return ROM[romofs+1]; |
| 4052 | break; | |
| 4053 | 4044 | case 6: // 12k / 29y |
| 4054 | 4045 | case 7: |
| 4055 | 4046 | romofs /= 2; |
| 4056 | return ROM8[romofs]; | |
| 4057 | break; | |
| 4047 | return ROM8[romofs]; | |
| 4058 | 4048 | default: |
| 4059 | 4049 | LOG(("55673_rom_word_r: Unknown read offset %x\n", offset)); |
| 4060 | 4050 | break; |
| r4135 | r4136 | |
| 4077 | 4067 | { |
| 4078 | 4068 | case 0: |
| 4079 | 4069 | return ROM[romofs+3]; |
| 4080 | break; | |
| 4081 | 4070 | case 1: |
| 4082 | 4071 | return ROM[romofs+4]; |
| 4083 | break; | |
| 4084 | 4072 | case 2: |
| 4085 | 4073 | case 3: |
| 4086 | return ROM[romofs+5]; | |
| 4087 | break; | |
| 4074 | return ROM[romofs+5]; | |
| 4088 | 4075 | case 4: |
| 4089 | 4076 | return ROM[romofs]; |
| 4090 | break; | |
| 4091 | 4077 | case 5: |
| 4092 | 4078 | return ROM[romofs+1]; |
| 4093 | break; | |
| 4094 | 4079 | case 6: |
| 4095 | 4080 | case 7: |
| 4096 | return ROM[romofs+2]; | |
| 4097 | break; | |
| 4081 | return ROM[romofs+2]; | |
| 4098 | 4082 | default: |
| 4099 | 4083 | LOG(("55673_rom_word_r: Unknown read offset %x (PC=%x)\n", offset, cpu_get_pc(space->cpu))); |
| 4100 | 4084 | break; |
| r4135 | r4136 | |
| 4221 | 4205 | int offx = (short)((K053246_regs[0] << 8) | K053246_regs[1]); |
| 4222 | 4206 | int offy = (short)((K053246_regs[2] << 8) | K053246_regs[3]); |
| 4223 | 4207 | |
| 4224 | int solidpens = K053247_gfx->color_granularity - 1; | |
| 4225 | 4208 | int screen_width = video_screen_get_width(machine->primary_screen); |
| 4209 | UINT8 drawmode_table[256]; | |
| 4210 | UINT8 shadowmode_table[256]; | |
| 4211 | UINT8 *whichtable; | |
| 4226 | 4212 | |
| 4213 | memset(drawmode_table, DRAWMODE_SOURCE, sizeof(drawmode_table)); | |
| 4214 | drawmode_table[0] = DRAWMODE_NONE; | |
| 4215 | memset(shadowmode_table, DRAWMODE_SHADOW, sizeof(shadowmode_table)); | |
| 4216 | shadowmode_table[0] = DRAWMODE_NONE; | |
| 4217 | ||
| 4227 | 4218 | /* |
| 4228 | 4219 | safeguard older drivers missing any of the following video attributes: |
| 4229 | 4220 | |
| r4135 | r4136 | |
| 4393 | 4384 | if (mirrorx) flipx = 0; // documented and confirmed |
| 4394 | 4385 | mirrory = shadow & 0x8000; |
| 4395 | 4386 | |
| 4387 | whichtable = drawmode_table; | |
| 4396 | 4388 | if (color == -1) |
| 4397 | 4389 | { |
| 4398 | 4390 | // drop the entire sprite to shadow unconditionally |
| 4399 | 4391 | if (shdmask < 0) continue; |
| 4400 | 4392 | color = 0; |
| 4401 | 4393 | shadow = -1; |
| 4402 | | |
| 4394 | whichtab | |
| 4403 | 4395 | palette_set_shadow_mode(machine, 0); |
| 4404 | 4396 | } |
| 4405 | 4397 | else |
| r4135 | r4136 | |
| 4448 | 4440 | ox -= (zoomx * w) >> 13; |
| 4449 | 4441 | oy -= (zoomy * h) >> 13; |
| 4450 | 4442 | |
| 4443 | drawmode_table[K053247_gfx->color_granularity-1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; | |
| 4444 | ||
| 4451 | 4445 | for (y = 0;y < h;y++) |
| 4452 | 4446 | { |
| 4453 | 4447 | int sx,sy,zw,zh; |
| r4135 | r4136 | |
| 4505 | 4499 | |
| 4506 | 4500 | if (nozoom) |
| 4507 | 4501 | { |
| 4508 | pdrawgfx(bitmap,K053247_gfx, | |
| 4502 | pdrawgfx_transtable(bitmap,cliprect,K053247_gfx, | |
| 4509 | 4503 | c, |
| 4510 | 4504 | color, |
| 4511 | 4505 | fx,fy, |
| 4512 | 4506 | sx,sy, |
| 4513 | cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0,primask); | |
| 4507 | priority_bitmap,primask, | |
| 4508 | whichtable,machine->shadow_table); | |
| 4514 | 4509 | } |
| 4515 | 4510 | else |
| 4516 | 4511 | { |
| 4517 | pdrawgfxzoom(bitmap,K053247_gfx, | |
| 4512 | pdrawgfxzoom_transtable(bitmap,cliprect,K053247_gfx, | |
| 4518 | 4513 | c, |
| 4519 | 4514 | color, |
| 4520 | 4515 | fx,fy, |
| 4521 | 4516 | sx,sy, |
| 4522 | cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0, | |
| 4523 | (zw << 16) >> 4,(zh << 16) >> 4,primask); | |
| 4517 | (zw << 16) >> 4,(zh << 16) >> 4, | |
| 4518 | priority_bitmap,primask, | |
| 4519 | whichtable,machine->shadow_table); | |
| 4524 | 4520 | } |
| 4525 | 4521 | |
| 4526 | 4522 | if (mirrory && h == 1) /* Simpsons shadows */ |
| 4527 | 4523 | { |
| 4528 | 4524 | if (nozoom) |
| 4529 | 4525 | { |
| 4530 | pdrawgfx(bitmap,K053247_gfx, | |
| 4526 | pdrawgfx_transtable(bitmap,cliprect,K053247_gfx, | |
| 4531 | 4527 | c, |
| 4532 | 4528 | color, |
| 4533 | 4529 | fx,!fy, |
| 4534 | 4530 | sx,sy, |
| 4535 | cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0,primask); | |
| 4531 | priority_bitmap,primask, | |
| 4532 | whichtable,machine->shadow_table); | |
| 4536 | 4533 | } |
| 4537 | 4534 | else |
| 4538 | 4535 | { |
| 4539 | pdrawgfxzoom(bitmap,K053247_gfx, | |
| 4536 | pdrawgfxzoom_transtable(bitmap,cliprect,K053247_gfx, | |
| 4540 | 4537 | c, |
| 4541 | 4538 | color, |
| 4542 | 4539 | fx,!fy, |
| 4543 | 4540 | sx,sy, |
| 4544 | cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0, | |
| 4545 | (zw << 16) >> 4,(zh << 16) >> 4,primask); | |
| 4541 | (zw << 16) >> 4,(zh << 16) >> 4, | |
| 4542 | priority_bitmap,primask, | |
| 4543 | whichtable,machine->shadow_table); | |
| 4546 | 4544 | } |
| 4547 | 4545 | } |
| 4548 | 4546 | } // end of X loop |
| 4549 | 4547 | } // end of Y loop |
| 4550 | 4548 | |
| 4551 | // reset drawmode_table | |
| 4552 | if (shadow == -1) for (temp=1; temp<solidpens; temp++) gfx_drawmode_table[temp] = DRAWMODE_SOURCE; | |
| 4553 | ||
| 4554 | 4549 | } // end of sprite-list loop |
| 4555 | 4550 | #undef NUM_SPRITES |
| 4556 | 4551 | } |
| r4135 | r4136 | |
| 6488 | 6483 | |
| 6489 | 6484 | UINT8 code_transparent, code_opaque; |
| 6490 | 6485 | const pen_t *pal_ptr; |
| 6491 | const UINT8 *src_ | |
| 6486 | const UINT8 *src_ | |
| 6492 | 6487 | UINT8 *xpr_ptr; |
| 6493 | 6488 | UINT16 *dst_ptr; |
| 6494 | 6489 | UINT16 pen, basepen; |
| r4135 | r4136 | |
| 6509 | 6504 | pixmap = K056832_pixmap[page]; |
| 6510 | 6505 | pal_ptr = machine->pens; |
| 6511 | 6506 | src_gfx = machine->gfx[K056832_gfxnum]; |
| 6512 | src_base = src_gfx->gfxdata; | |
| 6513 | 6507 | src_pitch = src_gfx->line_modulo; |
| 6514 | 6508 | src_modulo = src_gfx->char_modulo; |
| 6515 | 6509 | dst_pitch = pixmap->rowpixels; |
| r4135 | r4136 | |
| 6561 | 6555 | return(0); |
| 6562 | 6556 | } |
| 6563 | 6557 | |
| 6564 | void K056832_tilemap_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, | |
| 6558 | void K056832_tilemap_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, UINT32 flags, UINT32 priority) | |
| 6565 | 6559 | { |
| 6566 | 6560 | static int last_colorbase[K056832_PAGE_COUNT]; |
| 6567 | 6561 | |
| r4135 | r4136 | |
| 6620 | 6614 | } else corr = 0; |
| 6621 | 6615 | corr -= K056832_LayerOffset[layer][0]; |
| 6622 | 6616 | |
| 6623 | if (scrollmode == 0 && (flags & | |
| 6617 | if (scrollmode == 0 && (flags & K056382_DRAW_FLAG_FORCE_XYSCROLL | |
| 6624 | 6618 | { |
| 6625 | 6619 | scrollmode = 3; |
| 6626 | flags &= ~ | |
| 6620 | flags &= ~K056382_DRAW_FLAG_FORCE_XYSCROLL | |
| 6627 | 6621 | } |
| 6628 | 6622 | |
| 6629 | 6623 | switch( scrollmode ) |
| r4135 | r4136 | |
| 6844 | 6838 | |
| 6845 | 6839 | } // end of function |
| 6846 | 6840 | |
| 6847 | void K056832_tilemap_draw_dj(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, | |
| 6841 | void K056832_tilemap_draw_dj(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, UINT32 flags, UINT32 priority) //* | |
| 6848 | 6842 | { |
| 6849 | 6843 | static int last_colorbase[K056832_PAGE_COUNT]; |
| 6850 | 6844 | |
| r4135 | r4136 | |
| 6899 | 6893 | } else corr = 0; |
| 6900 | 6894 | corr -= K056832_LayerOffset[layer][0]; |
| 6901 | 6895 | |
| 6902 | if (scrollmode == 0 && (flags & | |
| 6896 | if (scrollmode == 0 && (flags & K056382_DRAW_FLAG_FORCE_XYSCROLL | |
| 6903 | 6897 | { |
| 6904 | 6898 | scrollmode = 3; |
| 6905 | flags &= ~ | |
| 6899 | flags &= ~K056382_DRAW_FLAG_FORCE_XYSCROLL | |
| 6906 | 6900 | } |
| 6907 | 6901 | |
| 6908 | 6902 | switch( scrollmode ) |
| r4135 | r4136 | |
| 7409 | 7403 | |
| 7410 | 7404 | if (pblend <= 0 || pblend > 3) |
| 7411 | 7405 | { |
| 7412 | alpha_set_level(255); | |
| 7413 | 7406 | return(255); |
| 7414 | 7407 | } |
| 7415 | 7408 | |
| r4135 | r4136 | |
| 7424 | 7417 | if (!(mixset & 0x20)) |
| 7425 | 7418 | { |
| 7426 | 7419 | mixlv = mixlv<<3 | mixlv>>2; |
| 7427 | alpha_set_level(mixlv); // source x alpha/255 + target x (255-alpha)/255 | |
| 7428 | 7420 | } |
| 7429 | 7421 | else |
| 7430 | 7422 | { |
| r4135 | r4136 | |
| 7440 | 7432 | // DUMMY |
| 7441 | 7433 | if (mixlv && mixlv<0x1f) mixlv = 0x10; |
| 7442 | 7434 | mixlv = mixlv<<3 | mixlv>>2; |
| 7443 | alpha_set_level(mixlv); | |
| 7444 | 7435 | |
| 7445 | 7436 | if (VERBOSE) |
| 7446 | 7437 | popmessage("MIXSET%1d %s addition mode: %02x",pblend,(mixpri)?"dst":"src",mixset&0x1f); |
| r4135 | r4136 | |
|---|---|---|
| 57 | 57 | /* sprite priority 3 = disable */ |
| 58 | 58 | if (gbusters_priority) |
| 59 | 59 | { |
| 60 | // K051960_sprites_draw(bitmap,cliprect,1,1); /* are these used? */ | |
| 60 | // K051960_sprites_draw(screen->machine,bitmap,cliprect,1,1); /* are these used? */ | |
| 61 | 61 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],TILEMAP_DRAW_OPAQUE,0); |
| 62 | K051960_sprites_draw(bitmap,cliprect,2,2); | |
| 62 | K051960_sprites_draw(screen->machine,bitmap,cliprect,2,2); | |
| 63 | 63 | tilemap_draw(bitmap,cliprect,K052109_tilemap[1],0,0); |
| 64 | K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 64 | K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 65 | 65 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,0); |
| 66 | 66 | } |
| 67 | 67 | else |
| 68 | 68 | { |
| 69 | // K051960_sprites_draw(bitmap,cliprect,1,1); /* are these used? */ | |
| 69 | // K051960_sprites_draw(screen->machine,bitmap,cliprect,1,1); /* are these used? */ | |
| 70 | 70 | tilemap_draw(bitmap,cliprect,K052109_tilemap[1],TILEMAP_DRAW_OPAQUE,0); |
| 71 | K051960_sprites_draw(bitmap,cliprect,2,2); | |
| 71 | K051960_sprites_draw(screen->machine,bitmap,cliprect,2,2); | |
| 72 | 72 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,0); |
| 73 | K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 73 | K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 74 | 74 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,0); |
| 75 | 75 | } |
| 76 | 76 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 104 | 104 | WRITE8_HANDLER( K051937_w ); |
| 105 | 105 | READ16_HANDLER( K051937_word_r ); |
| 106 | 106 | WRITE16_HANDLER( K051937_word_w ); |
| 107 | void K051960_sprites_draw(bitmap_t *bitmap,const rectangle *cliprect,int min_priority,int max_priority); | |
| 107 | void K051960_sprites_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int min_priority,int max_priority); | |
| 108 | 108 | int K051960_is_IRQ_enabled(void); |
| 109 | 109 | int K051960_is_NMI_enabled(void); |
| 110 | 110 | void K051960_set_sprite_offsets(int dx, int dy); |
| r4135 | r4136 | |
| 129 | 129 | READ16_HANDLER( K053244_word_r ); |
| 130 | 130 | WRITE16_HANDLER( K053244_word_w ); |
| 131 | 131 | void K053244_bankselect(int chip, int bank); /* used by TMNT2, Asterix and Premier Soccer for ROM testing */ |
| 132 | void K053245_sprites_draw(int chip, bitmap_t *bitmap,const rectangle *cliprect); | |
| 132 | void K053245_sprites_draw(running_machine *machine, int chip, bitmap_t *bitmap,const rectangle *cliprect); | |
| 133 | 133 | void K053245_sprites_draw_lethal(running_machine *machine, int chip, bitmap_t *bitmap,const rectangle *cliprect); /* for lethal enforcers */ |
| 134 | 134 | void K053245_clear_buffer(int chip); |
| 135 | 135 | void K053245_set_SpriteOffset(int chip,int offsx, int offsy); |
| r4135 | r4136 | |
| 254 | 254 | |
| 255 | 255 | void K056832_SetExtLinescroll(void); /* Lethal Enforcers */ |
| 256 | 256 | |
| 257 | #define K056382_DRAW_FLAG_FORCE_XYSCROLL 0x00800000 | |
| 258 | ||
| 257 | 259 | void K056832_vh_start(running_machine *machine, const char *gfx_memory_region, int bpp, int big, |
| 258 | 260 | int (*scrolld)[4][2], |
| 259 | 261 | void (*callback)(int layer, int *code, int *color, int *flags), |
| r4135 | r4136 | |
| 284 | 286 | WRITE8_HANDLER( K056832_b_w ); |
| 285 | 287 | void K056832_mark_plane_dirty(int num); |
| 286 | 288 | void K056832_MarkAllTilemapsDirty(void); |
| 287 | void K056832_tilemap_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int num, int flags, UINT32 priority); | |
| 288 | void K056832_tilemap_draw_dj(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, int flags, UINT32 priority); | |
| 289 | void K056832_tilemap_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int num, UINT32 flags, UINT32 priority); | |
| 290 | void K056832_tilemap_draw_dj(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, UINT32 flags, UINT32 priority); | |
| 289 | 291 | void K056832_set_LayerAssociation(int status); |
| 290 | 292 | int K056832_get_LayerAssociation(void); |
| 291 | 293 | void K056832_set_LayerOffset(int layer, int offsx, int offsy); |
| r4135 | r4136 | |
|---|---|---|
| 19 | 19 | static int sprite_flip_axis; |
| 20 | 20 | static tilemap *fg_tilemap; |
| 21 | 21 | static int flipscreen; |
| 22 | static UINT32 fg_tile_offset; | |
| 22 | 23 | |
| 23 | 24 | /*************************************************************************** |
| 24 | 25 | |
| r4135 | r4136 | |
| 28 | 29 | |
| 29 | 30 | static TILE_GET_INFO( get_pow_tile_info ) |
| 30 | 31 | { |
| 31 | int tile = (pow_fg_videoram[2*tile_index] & 0xff); | |
| 32 | int tile = fg_tile_offset + (pow_fg_videoram[2*tile_index] & 0xff); | |
| 32 | 33 | int color = pow_fg_videoram[2*tile_index+1] & 0x07; |
| 33 | 34 | |
| 34 | 35 | SET_TILE_INFO(0, tile, color, 0); |
| r4135 | r4136 | |
| 63 | 64 | VIDEO_START( pow ) |
| 64 | 65 | { |
| 65 | 66 | fg_tilemap = tilemap_create(machine, get_pow_tile_info,tilemap_scan_cols,8,8,32,32); |
| 67 | fg_tile_offset = 0; | |
| 66 | 68 | |
| 67 | 69 | common_video_start(machine); |
| 68 | 70 | } |
| r4135 | r4136 | |
| 139 | 141 | |
| 140 | 142 | sprite_flip_axis = data & 0x04; // for streetsm? though might not be present on this board |
| 141 | 143 | |
| 142 | tilemap_set_pen_data_offset(fg_tilemap, ((data & 0x70) << 4) * space->machine->gfx[0]->char_modulo); | |
| 144 | if (fg_tile_offset != ((data & 0x70) << 4)) | |
| 145 | { | |
| 146 | fg_tile_offset = (data & 0x70) << 4; | |
| 147 | tilemap_mark_all_tiles_dirty(fg_tilemap); | |
| 148 | } | |
| 143 | 149 | } |
| 144 | 150 | } |
| 145 | 151 |
| r4135 | r4136 | |
|---|---|---|
| 127 | 127 | SET_TILE_INFO(0, madalien_videoram[tile_index], 0, 0); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | WRITE8_HANDLER( madalien_videoram_w ) | |
| 131 | { | |
| 132 | madalien_videoram[offset] = data; | |
| 133 | tilemap_mark_tile_dirty(tilemap_fg, offset); | |
| 134 | } | |
| 130 | 135 | |
| 136 | ||
| 131 | 137 | static VIDEO_START( madalien ) |
| 132 | 138 | { |
| 133 | 139 | int i; |
| r4135 | r4136 | |
| 160 | 166 | |
| 161 | 167 | headlight_bitmap = auto_bitmap_alloc(128, 128, BITMAP_FORMAT_INDEXED16); |
| 162 | 168 | |
| 169 | gfx_element_set_source(machine->gfx[0], madalien_charram); | |
| 170 | ||
| 163 | 171 | drawgfx(headlight_bitmap, machine->gfx[2], 0, 0, 0, 0, 0x00, 0x00, NULL, TRANSPARENCY_NONE, 0); |
| 164 | 172 | drawgfx(headlight_bitmap, machine->gfx[2], 0, 0, 0, 1, 0x00, 0x40, NULL, TRANSPARENCY_NONE, 0); |
| 165 | 173 | } |
| r4135 | r4136 | |
| 240 | 248 | |
| 241 | 249 | static void draw_foreground(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int flip) |
| 242 | 250 | { |
| 243 | int i; | |
| 244 | ||
| 245 | for (i = 0; i < 256; i++) | |
| 246 | decodechar(machine->gfx[0], i, madalien_charram); | |
| 247 | ||
| 248 | tilemap_mark_all_tiles_dirty(tilemap_fg); | |
| 249 | 251 | tilemap_set_flip(tilemap_fg, flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); |
| 250 | 252 | tilemap_draw(bitmap, cliprect, tilemap_fg, 0, 0); |
| 251 | 253 | } |
| 252 | 254 | |
| 253 | 255 | |
| 256 | WRITE8_HANDLER( madalien_charram_w ) | |
| 257 | { | |
| 258 | madalien_charram[offset] = data; | |
| 259 | gfx_element_mark_dirty(space->machine->gfx[0], (offset/8) & 0xff); | |
| 260 | } | |
| 261 | ||
| 262 | ||
| 254 | 263 | static VIDEO_UPDATE( madalien ) |
| 255 | 264 | { |
| 256 | 265 | int flip = BIT(input_port_read(screen->machine, "DSW"), 6) && BIT(*madalien_video_control, 0); |
| r4135 | r4136 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | tilemap_set_scroll_rows(bg_tilemap,64); |
| 50 | 50 | |
| 51 | state_save_register_global(machine, aeroboto_charbank); | |
| 52 | state_save_register_global(machine, aeroboto_starsoff); | |
| 53 | ||
| 51 | 54 | #if STARS_LAYOUT |
| 52 | 55 | { |
| 53 | 56 | UINT8 *rom, *temp; |
| r4135 | r4136 | |
|---|---|---|
| 73 | 73 | const UINT8 *colordatabase = (const UINT8 *)memory_region(machine, "gfx3"); |
| 74 | 74 | gfx_element *gfx0 = machine->gfx[0]; |
| 75 | 75 | gfx_element *gfx2 = machine->gfx[2]; |
| 76 | UINT8 *srcdata0, *dest0; | |
| 77 | UINT8 *srcdata2, *dest2; | |
| 76 | 78 | int code, y, x; |
| 77 | 79 | |
| 78 | 80 | /* initialize the background tilemap */ |
| r4135 | r4136 | |
| 82 | 84 | fg_tilemap = tilemap_create(machine, zwackery_get_fg_tile_info, tilemap_scan_rows, 16,16, 32,32); |
| 83 | 85 | tilemap_set_transparent_pen(fg_tilemap, 0); |
| 84 | 86 | |
| 87 | /* allocate memory for the assembled gfx data */ | |
| 88 | srcdata0 = auto_malloc(gfx0->total_elements * gfx0->width * gfx0->height); | |
| 89 | srcdata2 = auto_malloc(gfx2->total_elements * gfx2->width * gfx2->height); | |
| 90 | ||
| 85 | 91 | /* "colorize" each code */ |
| 92 | dest0 = srcdata0; | |
| 93 | dest2 = srcdata2; | |
| 86 | 94 | for (code = 0; code < gfx0->total_elements; code++) |
| 87 | 95 | { |
| 88 | 96 | const UINT8 *coldata = colordatabase + code * 32; |
| 89 | UINT8 *gfxdata0 = gfx0->gfxdata + code * gfx0->char_modulo; | |
| 90 | UINT8 *gfxdata2 = gfx2->gfxdata + code * gfx2->char_modulo; | |
| 97 | const UINT8 *gfxdata0 = gfx_element_get_data(gfx0, code); | |
| 98 | const UINT8 *gfxdata2 = gfx_element_get_data(gfx2, code); | |
| 91 | 99 | |
| 92 | 100 | /* assume 16 rows */ |
| 93 | 101 | for (y = 0; y < 16; y++) |
| 94 | 102 | { |
| 95 | UINT8 *gd0 = gfxdata0; | |
| 96 | UINT8 *gd2 = gfxdata2; | |
| 103 | const UINT8 *gd0 = gfxdata0; | |
| 104 | const UINT8 *gd2 = gfxdata2; | |
| 97 | 105 | |
| 98 | 106 | /* 16 columns */ |
| 99 | 107 | for (x = 0; x < 16; x++, gd0++, gd2++) |
| r4135 | r4136 | |
| 104 | 112 | int tp0, tp1; |
| 105 | 113 | |
| 106 | 114 | /* every 4 pixels gets its own foreground/background colors */ |
| 107 | * | |
| 115 | * | |
| 108 | 116 | |
| 109 | 117 | /* for gfx 2, we convert all low-priority pens to 0 */ |
| 110 | 118 | tp0 = (pen0 & 0x80) ? pen0 : 0; |
| 111 | 119 | tp1 = (pen1 & 0x80) ? pen1 : 0; |
| 112 | * | |
| 120 | * | |
| 113 | 121 | } |
| 114 | 122 | |
| 115 | 123 | /* advance */ |
| r4135 | r4136 | |
| 117 | 125 | gfxdata2 += gfx2->line_modulo; |
| 118 | 126 | } |
| 119 | 127 | } |
| 128 | ||
| 129 | /* create a simple target layout */ | |
| 130 | gfx0->layout.planes = gfx2->layout.planes = 8; | |
| 131 | for (x = 0; x < 8; x++) | |
| 132 | gfx0->layout.planeoffset[x] = gfx2->layout.planeoffset[x] = x; | |
| 133 | for (x = 0; x < gfx0->width; x++) | |
| 134 | gfx0->layout.xoffset[x] = gfx2->layout.xoffset[x] = 8 * x; | |
| 135 | for (y = 0; y < gfx0->height; y++) | |
| 136 | gfx0->layout.yoffset[y] = gfx2->layout.yoffset[y] = 8 * y * gfx0->width; | |
| 137 | gfx0->layout.charincrement = gfx2->layout.charincrement = 8 * gfx0->width * gfx0->height; | |
| 138 | ||
| 139 | /* make the assembled data our new source data */ | |
| 140 | gfx_element_set_source(gfx0, srcdata0); | |
| 141 | gfx_element_set_source(gfx2, srcdata2); | |
| 120 | 142 | } |
| 121 | 143 | |
| 122 | 144 |
| r4135 | r4136 | |
|---|---|---|
| 86 | 86 | } |
| 87 | 87 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,4); |
| 88 | 88 | |
| 89 | K051960_sprites_draw(bitmap,cliprect,-1,-1); | |
| 89 | K051960_sprites_draw(screen->machine,bitmap,cliprect,-1,-1); | |
| 90 | 90 | return 0; |
| 91 | 91 | } |
| r4135 | r4136 | |
|---|---|---|
| 124 | 124 | tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[1]],0,2); |
| 125 | 125 | tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[2]],0,4); |
| 126 | 126 | |
| 127 | pdrawgfx_shadow_lowpri = 1; /* fix shadows of boulders in front of feet */ | |
| 127 | /* this isn't supported anymore and it is unsure if still needed; keeping here for reference | |
| 128 | pdrawgfx_shadow_lowpri = 1; fix shadows of boulders in front of feet */ | |
| 128 | 129 | K053247_sprites_draw(screen->machine, bitmap,cliprect); |
| 129 | 130 | return 0; |
| 130 | 131 | } |
| r4135 | r4136 | |
| 250 | 251 | tilemap_draw(renderbitmap,&cliprect,K052109_tilemap[layer[1]],0,2); |
| 251 | 252 | tilemap_draw(renderbitmap,&cliprect,K052109_tilemap[layer[2]],0,4); |
| 252 | 253 | |
| 253 | pdrawgfx_shadow_lowpri = 1; /* fix shadows of boulders in front of feet */ | |
| 254 | /* this isn't supported anymore and it is unsure if still needed; keeping here for reference | |
| 255 | pdrawgfx_shadow_lowpri = 1; fix shadows of boulders in front of feet */ | |
| 254 | 256 | K053247_sprites_draw(machine, renderbitmap,&cliprect); |
| 255 | 257 | |
| 256 | 258 | } |
| r4135 | r4136 | |
|---|---|---|
| 45 | 45 | |
| 46 | 46 | VIDEO_START(lethalen) |
| 47 | 47 | { |
| 48 | int i; | |
| 49 | ||
| 50 | 48 | K053251_vh_start(machine); |
| 51 | 49 | |
| 52 | 50 | K056832_vh_start(machine, "gfx1", K056832_BPP_8LE, 1, NULL, lethalen_tile_callback, 0); |
| 53 | 51 | |
| 54 | 52 | K053245_vh_start(machine, 0, "gfx3",NORMAL_PLANE_ORDER, lethalen_sprite_callback); |
| 55 | 53 | |
| 56 | /* the default drawmode table is no good for 6bpp, create a new one */ | |
| 57 | gfx_drawmode_table[0] = DRAWMODE_NONE; | |
| 58 | for (i = 1;i < 64;i++) | |
| 59 | gfx_drawmode_table[i] = DRAWMODE_SOURCE; | |
| 60 | ||
| 61 | gfx_drawmode_table[63] = DRAWMODE_SHADOW; | |
| 62 | ||
| 63 | 54 | // this game uses external linescroll RAM |
| 64 | 55 | K056832_SetExtLinescroll(); |
| 65 | 56 |
| r4135 | r4136 | |
|---|---|---|
| 411 | 411 | sx = 256 - (xpos + 8*(!flipx?(sizex-1-x):x) + 8); |
| 412 | 412 | sy = 256 - (ypos + 8*(!flipy?(sizey-1-y):y) + 8); |
| 413 | 413 | } |
| 414 | pdrawgfx(bitmap,machine->gfx[2], | |
| 414 | pdrawgfx_transpen_raw(bitmap,cliprect,machine->gfx[2], | |
| 415 | 415 | code + layout[y][x], |
| 416 | 416 | machine->gfx[2]->color_base + color * machine->gfx[2]->color_granularity, |
| 417 | 417 | flipx,flipy, |
| 418 | 418 | sx,sy, |
| 419 | cliprect,TRANSPARENCY_PEN_RAW,0, | |
| 420 | priority_mask); | |
| 419 | priority_bitmap, priority_mask,0); | |
| 421 | 420 | |
| 422 | 421 | /* wrap around x */ |
| 423 | pdrawgfx(bitmap,machine->gfx[2], | |
| 422 | pdrawgfx_transpen_raw(bitmap,cliprect,machine->gfx[2], | |
| 424 | 423 | code + layout[y][x], |
| 425 | 424 | machine->gfx[2]->color_base + color * machine->gfx[2]->color_granularity, |
| 426 | 425 | flipx,flipy, |
| 427 | 426 | sx-512,sy, |
| 428 | cliprect,TRANSPARENCY_PEN_RAW,0, | |
| 429 | priority_mask); | |
| 427 | priority_bitmap, priority_mask,0); | |
| 430 | 428 | |
| 431 | 429 | /* wrap around x */ |
| 432 | pdrawgfx(bitmap,machine->gfx[2], | |
| 430 | pdrawgfx_transpen_raw(bitmap,cliprect,machine->gfx[2], | |
| 433 | 431 | code + layout[y][x], |
| 434 | 432 | machine->gfx[2]->color_base + color * machine->gfx[2]->color_granularity, |
| 435 | 433 | flipx,flipy, |
| 436 | 434 | sx+512,sy, |
| 437 | cliprect,TRANSPARENCY_PEN_RAW,0, | |
| 438 | priority_mask); | |
| 435 | priority_bitmap, priority_mask,0); | |
| 439 | 436 | } |
| 440 | 437 | } |
| 441 | 438 | } |
| r4135 | r4136 | |
| 457 | 454 | sx = 256 - (xpos + 8*(!flipx?(sizex-1-x):x) + 8); |
| 458 | 455 | sy = 256 - (ypos + 8*(!flipy?(sizey-1-y):y) + 8); |
| 459 | 456 | } |
| 460 | pdrawgfx(bitmap,machine->gfx[2], | |
| 457 | pdrawgfx_transpen_raw(bitmap,cliprect,machine->gfx[2], | |
| 461 | 458 | code + layout[y][x], |
| 462 | 459 | machine->gfx[2]->color_base + color * machine->gfx[2]->color_granularity, |
| 463 | 460 | flipx,flipy, |
| 464 | 461 | sx,sy, |
| 465 | cliprect,TRANSPARENCY_PEN_RAW,0, | |
| 466 | priority_mask); | |
| 462 | priority_bitmap, priority_mask,0); | |
| 467 | 463 | |
| 468 | 464 | /* wrap around x */ |
| 469 | pdrawgfx(bitmap,machine->gfx[2], | |
| 465 | pdrawgfx_transpen_raw(bitmap,cliprect,machine->gfx[2], | |
| 470 | 466 | code + layout[y][x], |
| 471 | 467 | machine->gfx[2]->color_base + color * machine->gfx[2]->color_granularity, |
| 472 | 468 | flipx,flipy, |
| 473 | 469 | sx-512,sy, |
| 474 | cliprect,TRANSPARENCY_PEN_RAW,0, | |
| 475 | priority_mask); | |
| 470 | priority_bitmap, priority_mask,0); | |
| 476 | 471 | |
| 477 | 472 | /* wrap around x */ |
| 478 | pdrawgfx(bitmap,machine->gfx[2], | |
| 473 | pdrawgfx_transpen_raw(bitmap,cliprect,machine->gfx[2], | |
| 479 | 474 | code + layout[y][x], |
| 480 | 475 | machine->gfx[2]->color_base + color * machine->gfx[2]->color_granularity, |
| 481 | 476 | flipx,flipy, |
| 482 | 477 | sx+512,sy, |
| 483 | cliprect,TRANSPARENCY_PEN_RAW,0, | |
| 484 | priority_mask); | |
| 478 | priority_bitmap, priority_mask,0); | |
| 485 | 479 | } |
| 486 | 480 | } |
| 487 | 481 | } |
| r4135 | r4136 | |
|---|---|---|
| 175 | 175 | static void draw_background(bitmap_t *bitmap) |
| 176 | 176 | { |
| 177 | 177 | int offs, x, y; |
| 178 | UINT16 scanline[288]; | |
| 179 | 178 | pen_t pen_base = 0x300 + 0x10*palettebank; |
| 180 | 179 | |
| 181 | 180 | // copy the background image from RAM (0x190200-0x19FDFF) to bitmap |
| r4135 | r4136 | |
| 184 | 183 | offs = 0xFDFE/2; |
| 185 | 184 | for (y = 0; y < 224; y++) |
| 186 | 185 | { |
| 186 | UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0); | |
| 187 | 187 | for (x = 0; x < 288; x+=2) |
| 188 | 188 | { |
| 189 | 189 | UINT16 data = toypop_bg_image[offs]; |
| r4135 | r4136 | |
| 191 | 191 | scanline[x+1] = pen_base | (data >> 8); |
| 192 | 192 | offs--; |
| 193 | 193 | } |
| 194 | draw_scanline16(bitmap, 0, y, 288, scanline, NULL, -1); | |
| 195 | 194 | } |
| 196 | 195 | } |
| 197 | 196 | else |
| r4135 | r4136 | |
| 199 | 198 | offs = 0x200/2; |
| 200 | 199 | for (y = 0; y < 224; y++) |
| 201 | 200 | { |
| 201 | UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0); | |
| 202 | 202 | for (x = 0; x < 288; x+=2) |
| 203 | 203 | { |
| 204 | 204 | UINT16 data = toypop_bg_image[offs]; |
| r4135 | r4136 | |
| 206 | 206 | scanline[x+1] = pen_base | (data & 0x0f); |
| 207 | 207 | offs++; |
| 208 | 208 | } |
| 209 | draw_scanline16(bitmap, 0, y, 288, scanline, NULL, -1); | |
| 210 | 209 | } |
| 211 | 210 | } |
| 212 | 211 | } |
| r4135 | r4136 | |
|---|---|---|
| 327 | 327 | case 0x20: |
| 328 | 328 | /* Bit 3 is 0 */ |
| 329 | 329 | return 0; |
| 330 | break; | |
| 331 | 330 | case 0x0c: |
| 332 | 331 | case 0x30: |
| 333 | 332 | /* Bit 3 is 1 */ |
| 334 | 333 | return 1; |
| 335 | break; | |
| 336 | 334 | default: |
| 337 | 335 | logerror("%s:Unknown protection question %02X\n", cpuexec_describe_context(field->port->machine), pleiads_protection_question); |
| 338 | 336 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| 12 | #include "sound/ay8910.h" | |
| 12 | 13 | |
| 13 | 14 | |
| 14 | 15 | UINT8 *dday_bgvideoram; |
| r4135 | r4136 | |
|---|---|---|
| 1051 | 1051 | dst[2] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16; |
| 1052 | 1052 | dst[3] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16; |
| 1053 | 1053 | |
| 1054 | draw_scanline8(tmpbitmap, 12, y, sizeof(scanline), (const UINT8 *) scanline, NULL | |
| 1054 | draw_scanline8(tmpbitmap, 12, y, MIN(tmpbitmap->width - 12, sizeof(scanline)), (const UINT8 *) scanline, NULL | |
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | static int cycle(running_machine *machine) |
| r4135 | r4136 | |
|---|---|---|
| 92 | 92 | #include "driver.h" |
| 93 | 93 | #include "profiler.h" |
| 94 | 94 | #include "psikyosh.h" |
| 95 | #include "drawgfxm.h" | |
| 95 | 96 | |
| 96 | 97 | /* Needed for psikyosh_drawgfxzoom */ |
| 97 | 98 | static bitmap_t *zoom_bitmap, *z_bitmap; |
| 99 | static UINT8 alphatable[256]; | |
| 98 | 100 | |
| 99 | 101 | /* Psikyo PS6406B */ |
| 100 | 102 | /* --- BACKGROUNDS --- */ |
| 101 | 103 | |
| 104 | #define PIXEL_OP_REMAP_TRANS0_ALPHATABLE32(DEST, PRIORITY, SOURCE) \ | |
| 105 | do \ | |
| 106 | { \ | |
| 107 | UINT32 srcdata = (SOURCE); \ | |
| 108 | if (srcdata != 0) \ | |
| 109 | (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alphatable[srcdata]); \ | |
| 110 | } \ | |
| 111 | while (0) \ | |
| 112 | ||
| 113 | void drawgfx_alphatable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 114 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 115 | int fixedalpha) | |
| 116 | { | |
| 117 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 118 | ||
| 119 | const pen_t *paldata; | |
| 120 | ||
| 121 | /* if we have a fixed alpha, call the standard drawgfx_alpha */ | |
| 122 | if (fixedalpha >= 0) | |
| 123 | { | |
| 124 | drawgfx_alpha(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, 0, fixedalpha); | |
| 125 | return; | |
| 126 | } | |
| 127 | ||
| 128 | assert(dest != NULL); | |
| 129 | assert(dest->bpp == 32); | |
| 130 | assert(gfx != NULL); | |
| 131 | assert(alphatable != NULL); | |
| 132 | ||
| 133 | /* get final code and color, and grab lookup tables */ | |
| 134 | code %= gfx->total_elements; | |
| 135 | color %= gfx->total_colors; | |
| 136 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 137 | ||
| 138 | /* early out if completely transparent */ | |
| 139 | if (gfx->pen_usage != NULL && (gfx->pen_usage[code] & ~(1 << 0)) == 0) | |
| 140 | return; | |
| 141 | ||
| 142 | /* render based on dest bitmap depth */ | |
| 143 | DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANS0_ALPHATABLE32, NO_PRIORITY); | |
| 144 | } | |
| 145 | ||
| 146 | ||
| 102 | 147 | /* 'Normal' layers, no line/columnscroll. No per-line effects */ |
| 103 | 148 | static void draw_bglayer(running_machine *machine, int layer, bitmap_t *bitmap, const rectangle *cliprect ) |
| 104 | 149 | { |
| 105 | 150 | gfx_element *gfx; |
| 106 | 151 | int offs=0, sx, sy; |
| 107 | int scrollx, scrolly, bank, alpha, alphamap, | |
| 152 | int scrollx, scrolly, bank, alpha, alphamap, | |
| 108 | 153 | |
| 109 | 154 | if ( BG_TYPE(layer) == BG_NORMAL_ALT ) |
| 110 | 155 | { |
| r4135 | r4136 | |
| 130 | 175 | width = BG_LARGE(layer) ? 0x200 : 0x100; |
| 131 | 176 | |
| 132 | 177 | if(alphamap) { /* alpha values are per-pen */ |
| 133 | trans = TRANSPARENCY_ALPHARANGE; | |
| 134 | } else if(alpha) { | |
| 135 | trans = TRANSPARENCY_ALPHA; | |
| 178 | alpha = -1; | |
| 179 | } else { | |
| 136 | 180 | alpha = ((0x3f-alpha)*0xff)/0x3f; /* 0x3f-0x00 maps to 0x00-0xff */ |
| 137 | alpha_set_level(alpha); | |
| 138 | } else { | |
| 139 | trans = TRANSPARENCY_PEN; | |
| 140 | 181 | } |
| 141 | 182 | |
| 142 | 183 | if((bank>=0x0c) && (bank<=0x1f)) /* shouldn't happen, 20 banks of 0x800 bytes */ |
| r4135 | r4136 | |
| 150 | 191 | tileno = (psikyosh_bgram[(bank*0x800)/4 + offs - 0x4000/4] & 0x0007ffff); /* seems to take into account spriteram, hence -0x4000 */ |
| 151 | 192 | colour = (psikyosh_bgram[(bank*0x800)/4 + offs - 0x4000/4] & 0xff000000) >> 24; |
| 152 | 193 | |
| 153 | drawgfx(bitmap,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1)), | |
| 194 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1)),al | |
| 154 | 195 | if(scrollx) |
| 155 | drawgfx(bitmap,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1)), | |
| 196 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1)),al | |
| 156 | 197 | if(scrolly) |
| 157 | drawgfx(bitmap,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1))-width, | |
| 198 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1))-width,al | |
| 158 | 199 | if(scrollx && scrolly) |
| 159 | drawgfx(bitmap,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1))-width, | |
| 200 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1))-width,al | |
| 160 | 201 | |
| 161 | 202 | offs++; |
| 162 | 203 | } |
| r4135 | r4136 | |
| 170 | 211 | { |
| 171 | 212 | gfx_element *gfx; |
| 172 | 213 | int offs, sx, sy; |
| 173 | int scrollx, scrolly, bank, size, width, scrollbank, | |
| 214 | int scrollx, scrolly, bank, size, width, scrollbank, | |
| 174 | 215 | |
| 175 | 216 | scrollbank = BG_TYPE(layer); /* Scroll bank appears to be same as layer type */ |
| 176 | 217 | |
| r4135 | r4136 | |
| 186 | 227 | scrolly = (psikyosh_bgram[(scrollbank*0x800)/4 - 0x4000/4] & 0x03ff0000) >> 16; |
| 187 | 228 | |
| 188 | 229 | if(alphamap) { /* alpha values are per-pen */ |
| 189 | trans = TRANSPARENCY_ALPHARANGE; | |
| 190 | } else if(alpha) { | |
| 191 | trans = TRANSPARENCY_ALPHA; | |
| 230 | alpha = -1; | |
| 231 | } else { | |
| 192 | 232 | alpha = ((0x3f-alpha)*0xff)/0x3f; /* 0x3f-0x00 maps to 0x00-0xff */ |
| 193 | alpha_set_level(alpha); | |
| 194 | } else { | |
| 195 | trans = TRANSPARENCY_PEN; | |
| 196 | 233 | } |
| 197 | 234 | |
| 198 | 235 | |
| r4135 | r4136 | |
| 205 | 242 | tileno = (psikyosh_bgram[(bank*0x800)/4 + offs - 0x4000/4] & 0x0007ffff); /* seems to take into account spriteram, hence -0x4000 */ |
| 206 | 243 | colour = (psikyosh_bgram[(bank*0x800)/4 + offs - 0x4000/4] & 0xff000000) >> 24; |
| 207 | 244 | |
| 208 | drawgfx(bitmap,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1)), | |
| 245 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1)),al | |
| 209 | 246 | if(scrollx) |
| 210 | drawgfx(bitmap,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1)), | |
| 247 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1)),al | |
| 211 | 248 | if(scrolly) |
| 212 | drawgfx(bitmap,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1))-width, | |
| 249 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1))-width,al | |
| 213 | 250 | if(scrollx && scrolly) |
| 214 | drawgfx(bitmap,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1))-width, | |
| 251 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1))-width,al | |
| 215 | 252 | |
| 216 | 253 | offs++; |
| 217 | 254 | }}} |
| r4135 | r4136 | |
| 224 | 261 | scrolly = (psikyosh_bgram[(scrollbank*0x800)/4 - 0x4000/4 + 0x20/4] & 0x03ff0000) >> 16; |
| 225 | 262 | |
| 226 | 263 | if(alphamap) { /* alpha values are per-pen */ |
| 227 | trans = TRANSPARENCY_ALPHARANGE; | |
| 228 | } else if(alpha) { | |
| 229 | trans = TRANSPARENCY_ALPHA; | |
| 264 | alpha = -1; | |
| 265 | } else { | |
| 230 | 266 | alpha = ((0x3f-alpha)*0xff)/0x3f; /* 0x3f-0x00 maps to 0x00-0xff */ |
| 231 | alpha_set_level(alpha); | |
| 232 | } else { | |
| 233 | trans = TRANSPARENCY_PEN; | |
| 234 | 267 | } |
| 235 | 268 | |
| 236 | 269 | if((bank>=0x0c) && (bank<=0x1f)) { /* shouldn't happen, 20 banks of 0x800 bytes */ |
| r4135 | r4136 | |
| 242 | 275 | tileno = (psikyosh_bgram[(bank*0x800)/4 + offs - 0x4000/4] & 0x0007ffff); /* seems to take into account spriteram, hence -0x4000 */ |
| 243 | 276 | colour = (psikyosh_bgram[(bank*0x800)/4 + offs - 0x4000/4] & 0xff000000) >> 24; |
| 244 | 277 | |
| 245 | drawgfx(bitmap,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1)), | |
| 278 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1)),al | |
| 246 | 279 | if(scrollx) |
| 247 | drawgfx(bitmap,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1)), | |
| 280 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1)),al | |
| 248 | 281 | if(scrolly) |
| 249 | drawgfx(bitmap,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1))-width, | |
| 282 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1))-width,al | |
| 250 | 283 | if(scrollx && scrolly) |
| 251 | drawgfx(bitmap,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1))-width, | |
| 284 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1))-width,al | |
| 252 | 285 | |
| 253 | 286 | offs++; |
| 254 | 287 | }}} |
| r4135 | r4136 | |
| 260 | 293 | { |
| 261 | 294 | gfx_element *gfx; |
| 262 | 295 | int offs, sx, sy; |
| 263 | int scrollx, scrolly, bank, alpha, alphamap, | |
| 296 | int scrollx, scrolly, bank, alpha, alphamap, | |
| 264 | 297 | |
| 265 | 298 | scrollbank = BG_TYPE(layer); /* Scroll bank appears to be same as layer type */ |
| 266 | 299 | |
| r4135 | r4136 | |
| 280 | 313 | width = BG_LARGE(layer) ? 0x200 : 0x100; |
| 281 | 314 | |
| 282 | 315 | if(alphamap) { /* alpha values are per-pen */ |
| 283 | trans = TRANSPARENCY_ALPHARANGE; | |
| 284 | } else if(alpha) { | |
| 285 | trans = TRANSPARENCY_ALPHA; | |
| 316 | alpha = -1; | |
| 317 | } else { | |
| 286 | 318 | alpha = ((0x3f-alpha)*0xff)/0x3f; /* 0x3f-0x00 maps to 0x00-0xff */ |
| 287 | alpha_set_level(alpha); | |
| 288 | } else { | |
| 289 | trans = TRANSPARENCY_PEN; | |
| 290 | 319 | } |
| 291 | 320 | |
| 292 | 321 | if((bank>=0x0c) && (bank<=0x1f)) /* shouldn't happen, 20 banks of 0x800 bytes */ |
| r4135 | r4136 | |
| 315 | 344 | |
| 316 | 345 | // drawgfx(zoom_bitmap,gfx,tileno,colour,0,0,(16*sx)&0x1ff,((16*sy)&(width-1)),NULL,TRANSPARENCY_PEN,0); |
| 317 | 346 | |
| 318 | drawgfx(bitmap,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1)), | |
| 347 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1)),al | |
| 319 | 348 | if(scrollx) |
| 320 | drawgfx(bitmap,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1)), | |
| 349 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1)),al | |
| 321 | 350 | if(scrolly) |
| 322 | drawgfx(bitmap,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1))-width, | |
| 351 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,(16*sx+scrollx)&0x1ff,((16*sy+scrolly)&(width-1))-width,al | |
| 323 | 352 | if(scrollx && scrolly) |
| 324 | drawgfx(bitmap,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1))-width, | |
| 353 | drawgfx_alphatable(bitmap,cliprect,gfx,tileno,colour,0,0,((16*sx+scrollx)&0x1ff)-0x200,((16*sy+scrolly)&(width-1))-width,al | |
| 325 | 354 | |
| 326 | 355 | offs++; |
| 327 | 356 | } |
| r4135 | r4136 | |
| 395 | 424 | static void psikyosh_drawgfxzoom( running_machine *machine, |
| 396 | 425 | bitmap_t *dest_bmp,const gfx_element *gfx, |
| 397 | 426 | UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy, |
| 398 | const rectangle *clip,int | |
| 427 | const rectangle *clip,int | |
| 399 | 428 | int zoomx, int zoomy, int wide, int high, UINT32 z) |
| 400 | 429 | { |
| 401 | 430 | rectangle myclip; /* Clip to screen boundaries */ |
| r4135 | r4136 | |
| 406 | 435 | |
| 407 | 436 | profiler_mark(PROFILER_DRAWGFX); |
| 408 | 437 | |
| 409 | assert(transparency == TRANSPARENCY_PEN || transparency == TRANSPARENCY_ALPHA || transparency == TRANSPARENCY_ALPHARANGE); | |
| 410 | 438 | assert(dest_bmp->bpp == 32); |
| 411 | 439 | |
| 412 | 440 | /* KW 991012 -- Added code to force clip to bitmap boundary */ |
| r4135 | r4136 | |
| 444 | 472 | for (xtile = xstart; xtile != xend; xtile += xinc ) |
| 445 | 473 | { |
| 446 | 474 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 447 | | |
| 475 | const UINT8 *code_base = gfx_element_get_data(gfx, (code + code_offset++) % gfx->total_elements) | |
| 448 | 476 | |
| 449 | 477 | int x_index_base, y_index, sx, sy, ex, ey; |
| 450 | 478 | |
| r4135 | r4136 | |
| 494 | 522 | int y; |
| 495 | 523 | |
| 496 | 524 | /* case 1: TRANSPARENCY_PEN */ |
| 497 | if ( | |
| 525 | if ( | |
| 498 | 526 | { |
| 499 | 527 | if( z > 0 ) |
| 500 | 528 | { |
| 501 | UINT8 *source = | |
| 529 | const UINT8 *source = | |
| 502 | 530 | UINT32 *dest = (UINT32 *)dest_bmp->base + sy*dest_bmp->rowpixels + sx; |
| 503 | 531 | UINT16 *pri = (UINT16 *)z_bitmap->base + sy*z_bitmap->rowpixels + sx; |
| 504 | 532 | int src_modulo = yinc*gfx->line_modulo - xinc*(ex-sx); |
| r4135 | r4136 | |
| 512 | 540 | if(z >= *pri) |
| 513 | 541 | { |
| 514 | 542 | int c = *source; |
| 515 | if( c != | |
| 543 | if( c != 0 | |
| 516 | 544 | { |
| 517 | 545 | *dest = pal[c]; |
| 518 | 546 | *pri = z; |
| r4135 | r4136 | |
| 529 | 557 | } |
| 530 | 558 | else |
| 531 | 559 | { |
| 532 | UINT8 *source = | |
| 560 | const UINT8 *source = | |
| 533 | 561 | UINT32 *dest = (UINT32 *)dest_bmp->base + sy*dest_bmp->rowpixels + sx; |
| 534 | 562 | int src_modulo = yinc*gfx->line_modulo - xinc*(ex-sx); |
| 535 | 563 | int dst_modulo = dest_bmp->rowpixels - (ex-sx); |
| r4135 | r4136 | |
| 540 | 568 | for( x=sx; x<ex; x++ ) |
| 541 | 569 | { |
| 542 | 570 | int c = *source; |
| 543 | if( c != | |
| 571 | if( c != 0 | |
| 544 | 572 | |
| 545 | 573 | dest++; |
| 546 | 574 | source += xinc; |
| r4135 | r4136 | |
| 551 | 579 | } |
| 552 | 580 | } |
| 553 | 581 | |
| 554 | /* case 6: TRANSPARENCY_ALPHA */ | |
| 555 | if (transparency == TRANSPARENCY_ALPHA) | |
| 582 | /* case 6: alpha-blended */ | |
| 583 | else if (alpha >= 0) | |
| 556 | 584 | { |
| 557 | 585 | if ( z > 0 ) |
| 558 | 586 | { |
| 559 | UINT8 *source = | |
| 587 | const UINT8 *source = | |
| 560 | 588 | UINT32 *dest = (UINT32 *)dest_bmp->base + sy*dest_bmp->rowpixels + sx; |
| 561 | 589 | UINT16 *pri = (UINT16 *)z_bitmap->base + sy*z_bitmap->rowpixels + sx; |
| 562 | 590 | int src_modulo = yinc*gfx->line_modulo - xinc*(ex-sx); |
| r4135 | r4136 | |
| 570 | 598 | if(z >= *pri) |
| 571 | 599 | { |
| 572 | 600 | int c = *source; |
| 573 | if( c != | |
| 601 | if( c != 0 | |
| 574 | 602 | { |
| 575 | *dest = alpha_blend32(*dest, pal[c]); | |
| 603 | *dest = alpha_blend_r32(*dest, pal[c], alpha); | |
| 576 | 604 | *pri = z; |
| 577 | 605 | } |
| 578 | 606 | } |
| r4135 | r4136 | |
| 587 | 615 | } |
| 588 | 616 | else |
| 589 | 617 | { |
| 590 | UINT8 *source = | |
| 618 | const UINT8 *source = | |
| 591 | 619 | UINT32 *dest = (UINT32 *)dest_bmp->base + sy*dest_bmp->rowpixels + sx; |
| 592 | 620 | int src_modulo = yinc*gfx->line_modulo - xinc*(ex-sx); |
| 593 | 621 | int dst_modulo = dest_bmp->rowpixels - (ex-sx); |
| r4135 | r4136 | |
| 598 | 626 | for( x=sx; x<ex; x++ ) |
| 599 | 627 | { |
| 600 | 628 | int c = *source; |
| 601 | if( c != | |
| 629 | if( c != 0 | |
| 602 | 630 | |
| 603 | 631 | dest++; |
| 604 | 632 | source += xinc; |
| r4135 | r4136 | |
| 611 | 639 | |
| 612 | 640 | /* pjp 31/5/02 */ |
| 613 | 641 | /* case 7: TRANSPARENCY_ALPHARANGE */ |
| 614 | | |
| 642 | el | |
| 615 | 643 | { |
| 616 | 644 | if ( z > 0 ) |
| 617 | 645 | { |
| 618 | UINT8 *source = | |
| 646 | const UINT8 *source = | |
| 619 | 647 | UINT32 *dest = (UINT32 *)dest_bmp->base + sy*dest_bmp->rowpixels + sx; |
| 620 | 648 | UINT16 *pri = (UINT16 *)z_bitmap->base + sy*z_bitmap->rowpixels + sx; |
| 621 | 649 | int src_modulo = yinc*gfx->line_modulo - xinc*(ex-sx); |
| r4135 | r4136 | |
| 629 | 657 | if(z >= *pri) |
| 630 | 658 | { |
| 631 | 659 | int c = *source; |
| 632 | if( c != | |
| 660 | if( c != 0 | |
| 633 | 661 | { |
| 634 | if( | |
| 662 | if( | |
| 635 | 663 | *dest = pal[c]; |
| 636 | 664 | else |
| 637 | *dest = alpha_blend_r32(*dest, pal[c], | |
| 665 | *dest = alpha_blend_r32(*dest, pal[c], | |
| 638 | 666 | |
| 639 | 667 | *pri = z; |
| 640 | 668 | } |
| r4135 | r4136 | |
| 650 | 678 | } |
| 651 | 679 | else |
| 652 | 680 | { |
| 653 | UINT8 *source = | |
| 681 | const UINT8 *source = | |
| 654 | 682 | UINT32 *dest = (UINT32 *)dest_bmp->base + sy*dest_bmp->rowpixels + sx; |
| 655 | 683 | int src_modulo = yinc*gfx->line_modulo - xinc*(ex-sx); |
| 656 | 684 | int dst_modulo = dest_bmp->rowpixels - (ex-sx); |
| r4135 | r4136 | |
| 661 | 689 | for( x=sx; x<ex; x++ ) |
| 662 | 690 | { |
| 663 | 691 | int c = *source; |
| 664 | if( c != | |
| 692 | if( c != 0 | |
| 665 | 693 | { |
| 666 | if( | |
| 694 | if( | |
| 667 | 695 | *dest = pal[c]; |
| 668 | 696 | else |
| 669 | *dest = alpha_blend_r32(*dest, pal[c], | |
| 697 | *dest = alpha_blend_r32(*dest, pal[c], | |
| 670 | 698 | } |
| 671 | 699 | dest++; |
| 672 | 700 | source += xinc; |
| r4135 | r4136 | |
| 690 | 718 | { |
| 691 | 719 | for(xtile=0; xtile<wide; xtile++) |
| 692 | 720 | { |
| 693 | | |
| 721 | const UINT8 *code_base = gfx_element_get_data(gfx, (code + code_offset++) % gfx->total_elements) | |
| 694 | 722 | for( ypixel=0; ypixel<gfx->height; ypixel++ ) |
| 695 | 723 | { |
| 696 | UINT8 *source = | |
| 724 | const UINT8 *source = | |
| 697 | 725 | UINT8 *dest = BITMAP_ADDR8(zoom_bitmap, ypixel + ytile*gfx->height, 0); |
| 698 | 726 | |
| 699 | 727 | for( xpixel=0; xpixel<gfx->width; xpixel++ ) |
| r4135 | r4136 | |
| 766 | 794 | |
| 767 | 795 | /* case 1: TRANSPARENCY_PEN */ |
| 768 | 796 | /* Note: adjusted to >>10 and draws from zoom_bitmap not gfx */ |
| 769 | if ( | |
| 797 | if ( | |
| 770 | 798 | { |
| 771 | 799 | if( z > 0 ) |
| 772 | 800 | { |
| r4135 | r4136 | |
| 782 | 810 | if(z >= pri[x]) |
| 783 | 811 | { |
| 784 | 812 | int c = source[x_index>>10]; |
| 785 | if( c != | |
| 813 | if( c != 0 | |
| 786 | 814 | { |
| 787 | 815 | dest[x] = pal[c]; |
| 788 | 816 | pri[x] = z; |
| r4135 | r4136 | |
| 805 | 833 | for( x=sx; x<ex; x++ ) |
| 806 | 834 | { |
| 807 | 835 | int c = source[x_index>>10]; |
| 808 | if( c != | |
| 836 | if( c != 0 | |
| 809 | 837 | x_index += dx; |
| 810 | 838 | } |
| 811 | 839 | |
| r4135 | r4136 | |
| 814 | 842 | } |
| 815 | 843 | } |
| 816 | 844 | |
| 817 | /* case 6: TRANSPARENCY_ALPHA */ | |
| 818 | if (transparency == TRANSPARENCY_ALPHA) | |
| 845 | /* case 6: alpha-blended */ | |
| 846 | else if (alpha >= 0) | |
| 819 | 847 | { |
| 820 | 848 | if( z > 0 ) |
| 821 | 849 | { |
| r4135 | r4136 | |
| 831 | 859 | if(z >= pri[x]) |
| 832 | 860 | { |
| 833 | 861 | int c = source[x_index>>10]; |
| 834 | if( c != | |
| 862 | if( c != 0 | |
| 835 | 863 | { |
| 836 | dest[x] = alpha_blend32(dest[x], pal[c]); | |
| 864 | dest[x] = alpha_blend_r32(dest[x], pal[c], alpha); | |
| 837 | 865 | pri[x] = z; |
| 838 | 866 | } |
| 839 | 867 | } |
| r4135 | r4136 | |
| 854 | 882 | for( x=sx; x<ex; x++ ) |
| 855 | 883 | { |
| 856 | 884 | int c = source[x_index>>10]; |
| 857 | if( c != | |
| 885 | if( c != 0 | |
| 858 | 886 | x_index += dx; |
| 859 | 887 | } |
| 860 | 888 | |
| r4135 | r4136 | |
| 864 | 892 | } |
| 865 | 893 | |
| 866 | 894 | /* case 7: TRANSPARENCY_ALPHARANGE */ |
| 867 | | |
| 895 | el | |
| 868 | 896 | { |
| 869 | 897 | if( z > 0 ) |
| 870 | 898 | { |
| r4135 | r4136 | |
| 880 | 908 | if(z >= pri[x]) |
| 881 | 909 | { |
| 882 | 910 | int c = source[x_index>>10]; |
| 883 | if( c != | |
| 911 | if( c != 0 | |
| 884 | 912 | { |
| 885 | if( | |
| 913 | if( | |
| 886 | 914 | dest[x] = pal[c]; |
| 887 | 915 | else |
| 888 | dest[x] = alpha_blend_r32(dest[x], pal[c], | |
| 916 | dest[x] = alpha_blend_r32(dest[x], pal[c], | |
| 889 | 917 | |
| 890 | 918 | pri[x] = z; |
| 891 | 919 | } |
| r4135 | r4136 | |
| 907 | 935 | for( x=sx; x<ex; x++ ) |
| 908 | 936 | { |
| 909 | 937 | int c = source[x_index>>10]; |
| 910 | if( c != | |
| 938 | if( c != 0 | |
| 911 | 939 | { |
| 912 | if( | |
| 940 | if( | |
| 913 | 941 | dest[x] = pal[c]; |
| 914 | 942 | else |
| 915 | dest[x] = alpha_blend_r32(dest[x], pal[c], | |
| 943 | dest[x] = alpha_blend_r32(dest[x], pal[c], | |
| 916 | 944 | } |
| 917 | 945 | x_index += dx; |
| 918 | 946 | } |
| r4135 | r4136 | |
| 972 | 1000 | while( listcntr < listlen ) |
| 973 | 1001 | { |
| 974 | 1002 | UINT32 listdat, sprnum, xpos, ypos, high, wide, flpx, flpy, zoomx, zoomy, tnum, colr, dpth; |
| 975 | UINT32 pri, alpha, alphamap, trans; | |
| 1003 | UINT32 pri, alphamap; | |
| 1004 | int alpha; | |
| 976 | 1005 | |
| 977 | 1006 | listdat = list[BYTE_XOR_BE(listcntr)]; |
| 978 | 1007 | sprnum = (listdat & 0x03ff) * 4; |
| r4135 | r4136 | |
| 1009 | 1038 | gfx = dpth ? machine->gfx[1] : machine->gfx[0]; |
| 1010 | 1039 | |
| 1011 | 1040 | if(alphamap) { /* alpha values are per-pen */ |
| 1012 | trans = TRANSPARENCY_ALPHARANGE; | |
| 1013 | } else if(alpha) { | |
| 1041 | alpha = -1; | |
| 1042 | } else { | |
| 1014 | 1043 | alpha = ((0x3f-alpha)*0xff)/0x3f; /* 0x3f-0x00 maps to 0x00-0xff */ |
| 1015 | trans = TRANSPARENCY_ALPHA; | |
| 1016 | alpha_set_level(alpha); | |
| 1017 | } else { | |
| 1018 | trans = TRANSPARENCY_PEN; | |
| 1019 | 1044 | } |
| 1020 | 1045 | |
| 1021 | 1046 | /* start drawing */ |
| 1022 | 1047 | if( zoom_table[BYTE_XOR_BE(zoomy)] && zoom_table[BYTE_XOR_BE(zoomx)] ) /* Avoid division-by-zero when table contains 0 (Uninitialised/Bug) */ |
| 1023 | 1048 | { |
| 1024 | psikyosh_drawgfxzoom(machine, bitmap,gfx,tnum,colr,flpx,flpy,xpos,ypos,cliprect, | |
| 1049 | psikyosh_drawgfxzoom(machine, bitmap,gfx,tnum,colr,flpx,flpy,xpos,ypos,cliprect, | |
| 1025 | 1050 | (UINT32)zoom_table[BYTE_XOR_BE(zoomx)], (UINT32)zoom_table[BYTE_XOR_BE(zoomy)], wide, high, listcntr); |
| 1026 | 1051 | |
| 1027 | 1052 | #if 0 |
| r4135 | r4136 | |
| 1066 | 1091 | { /* Pens 0xc0-0xff have a gradient of alpha values associated with them */ |
| 1067 | 1092 | int i; |
| 1068 | 1093 | for (i=0; i<0xc0; i++) |
| 1069 | | |
| 1094 | | |
| 1070 | 1095 | for (i=0; i<0x40; i++) { |
| 1071 | 1096 | int alpha = ((0x3f-i)*0xff)/0x3f; |
| 1072 | | |
| 1097 | | |
| 1073 | 1098 | } |
| 1074 | 1099 | } |
| 1075 | 1100 |
| r4135 | r4136 | |
|---|---|---|
| 171 | 171 | |
| 172 | 172 | pandora_sprites_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 173 | 173 | pandora_clear_bitmap = 1; |
| 174 | ||
| 175 | state_save_register_global(machine, pandora_clear_bitmap); | |
| 176 | state_save_register_global_pointer(machine, pandora_spriteram, 0x1000); | |
| 177 | state_save_register_global_bitmap(machine, pandora_sprites_bitmap); | |
| 174 | 178 | } |
| 175 | 179 | |
| 176 | 180 |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | for (offs = 0x400-4;offs >= 0;offs -= 4) |
| 10 | 10 | { |
| 11 | 11 | int x,y,sprite,colour,multi,fx,fy,inc,flash,mult,pri=0,spri=0; |
| 12 | int | |
| 12 | int | |
| 13 | 13 | |
| 14 | 14 | sprite = spriteram_base[offs+1]; |
| 15 | 15 | if (!sprite) continue; |
| r4135 | r4136 | |
| 38 | 38 | |
| 39 | 39 | // Transparency |
| 40 | 40 | if (spriteram_base[offs+2]&0x2000) |
| 41 | | |
| 41 | | |
| 42 | 42 | |
| 43 | 43 | if (deco16_priority==0x2) |
| 44 | 44 | { |
| 45 | 45 | // Additional sprite alpha in this mode |
| 46 | 46 | if (spriteram_base[offs+2]&0x8000) |
| 47 | | |
| 47 | | |
| 48 | 48 | |
| 49 | 49 | // Sprite vs playfield |
| 50 | 50 | if ((spriteram_base[offs+2]&0xc000)==0xc000) |
| r4135 | r4136 | |
| 123 | 123 | colour, |
| 124 | 124 | fx,fy, |
| 125 | 125 | x,y + mult * multi, |
| 126 | cliprect, | |
| 126 | cliprect, | |
| 127 | 127 | |
| 128 | 128 | multi--; |
| 129 | 129 | } |
| r4135 | r4136 | |
| 152 | 152 | deco16_set_tilemap_bank_callback(3,boogwing_bank_callback2); |
| 153 | 153 | deco16_set_tilemap_colour_base(1,0); |
| 154 | 154 | deco16_set_tilemap_transparency_mask(1, 0x1f); // 5bpp graphics |
| 155 | ||
| 156 | alpha_set_level(0x80); | |
| 157 | 155 | } |
| 158 | 156 | |
| 159 | 157 | VIDEO_UPDATE(boogwing) |
| r4135 | r4136 | |
| 187 | 185 | |
| 188 | 186 | // This mode uses playfield 3 to shadow sprites & playfield 2 (instead of |
| 189 | 187 | // regular alpha-blending, the destination is inverted). Not yet implemented. |
| 190 | // deco16_tilemap_3_draw(screen,bitmap,cliprect,TILEMAP_DRAW_ALPHA,32); | |
| 188 | // deco16_tilemap_3_draw(screen,bitmap,cliprect,TILEMAP_DRAW_ALPHA(0x80),32); | |
| 191 | 189 | } |
| 192 | 190 | else |
| 193 | 191 | { |
| r4135 | r4136 | |
|---|---|---|
| 351 | 351 | |
| 352 | 352 | // const UINT8 * const xromline = xrom + (scalex << 4); |
| 353 | 353 | const UINT8 * const yromline = yrom + (scaley << 4) + (15 - scaley); |
| 354 | const UINT8* const srcgfx = gfx | |
| 354 | const UINT8* const srcgfx = gfx_element_get_data(gfx, | |
| 355 | 355 | const pen_t *paldata = &machine->pens[gfx->color_base + gfx->color_granularity * color]; |
| 356 | 356 | int x,yy; |
| 357 | 357 |
| r4135 | r4136 | |
|---|---|---|
| 8 | 8 | UINT16 *gradius3_gfxram; |
| 9 | 9 | int gradius3_priority; |
| 10 | 10 | static int layer_colorbase[3],sprite_colorbase; |
| 11 | static int dirtygfx; | |
| 12 | static UINT8 *dirtychar; | |
| 13 | 11 | |
| 14 | 12 | |
| 15 | 13 | |
| r4135 | r4136 | |
| 77 | 75 | /* re-decode the sprites because the ROMs are connected to the custom IC differently |
| 78 | 76 | from how they are connected to the CPU. */ |
| 79 | 77 | for (i = 0;i < TOTAL_SPRITES;i++) |
| 80 | | |
| 78 | gfx_el | |
| 81 | 79 | |
| 82 | dirtychar = auto_malloc(TOTAL_CHARS); | |
| 83 | memset(dirtychar,1,TOTAL_CHARS); | |
| 80 | gfx_element_set_source(machine->gfx[0], (UINT8 *)gradius3_gfxram); | |
| 84 | 81 | } |
| 85 | 82 | |
| 86 | 83 | |
| r4135 | r4136 | |
| 103 | 100 | int oldword = gradius3_gfxram[offset]; |
| 104 | 101 | COMBINE_DATA(&gradius3_gfxram[offset]); |
| 105 | 102 | if (oldword != gradius3_gfxram[offset]) |
| 106 | { | |
| 107 | dirtygfx = 1; | |
| 108 | dirtychar[offset / 16] = 1; | |
| 109 | } | |
| 103 | gfx_element_mark_dirty(space->machine->gfx[0], offset / 16); | |
| 110 | 104 | } |
| 111 | 105 | |
| 112 | 106 | |
| r4135 | r4136 | |
| 125 | 119 | K052109_w(space,0x1d80,0x10); |
| 126 | 120 | K052109_w(space,0x1f00,0x32); |
| 127 | 121 | |
| 128 | if (dirtygfx) | |
| 129 | { | |
| 130 | int i; | |
| 131 | ||
| 132 | dirtygfx = 0; | |
| 133 | ||
| 134 | for (i = 0;i < TOTAL_CHARS;i++) | |
| 135 | { | |
| 136 | if (dirtychar[i]) | |
| 137 | { | |
| 138 | dirtychar[i] = 0; | |
| 139 | decodechar(screen->machine->gfx[0],i,(UINT8 *)gradius3_gfxram); | |
| 140 | } | |
| 141 | } | |
| 142 | ||
| 143 | tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); | |
| 144 | } | |
| 145 | ||
| 146 | 122 | K052109_tilemap_update(); |
| 147 | 123 | |
| 148 | 124 | bitmap_fill(priority_bitmap,cliprect,0); |
| r4135 | r4136 | |
| 159 | 135 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,4); |
| 160 | 136 | } |
| 161 | 137 | |
| 162 | K051960_sprites_draw(bitmap,cliprect,-1,-1); | |
| 138 | K051960_sprites_draw(screen->machine,bitmap,cliprect,-1,-1); | |
| 163 | 139 | return 0; |
| 164 | 140 | } |
| r4135 | r4136 | |
|---|---|---|
| 35 | 35 | |
| 36 | 36 | static tilemap *fg_tilemap, *bg_tilemap_l, *bg_tilemap_r; |
| 37 | 37 | |
| 38 | static char *sprite_dirty; | |
| 39 | static char *char_dirty; | |
| 40 | static char *tile_dirty; | |
| 41 | static char object_dirty; | |
| 42 | ||
| 43 | 38 | static rectangle bg_tilemap_l_clip; |
| 44 | 39 | static rectangle bg_tilemap_r_clip; |
| 45 | 40 | |
| r4135 | r4136 | |
| 215 | 210 | { |
| 216 | 211 | decocass_charram[offset] = data; |
| 217 | 212 | /* dirty sprite */ |
| 218 | | |
| 213 | gfx_ | |
| 219 | 214 | /* dirty char */ |
| 220 | | |
| 215 | gfx_element_mark_dirty(space->machine->gfx[0], (offset >> 3) & 1023) | |
| 221 | 216 | } |
| 222 | 217 | |
| 223 | 218 | |
| r4135 | r4136 | |
| 245 | 240 | { |
| 246 | 241 | decocass_tileram[offset] = data; |
| 247 | 242 | /* dirty tile (64 bytes per tile) */ |
| 248 | | |
| 243 | gfx_element_mark_dirty(space->machine->gfx[2], (offset / 64) & 15) | |
| 249 | 244 | /* first 1KB of tile RAM is shared with tilemap RAM */ |
| 250 | 245 | if (offset < decocass_bgvideoram_size) |
| 251 | 246 | mark_bg_tile_dirty( offset ); |
| r4135 | r4136 | |
| 255 | 250 | { |
| 256 | 251 | decocass_objectram[offset] = data; |
| 257 | 252 | /* dirty the object */ |
| 258 | object_dirty = 1; | |
| 253 | gfx_element_mark_dirty(space->machine->gfx[3], 0); | |
| 254 | gfx_element_mark_dirty(space->machine->gfx[3], 1); | |
| 259 | 255 | } |
| 260 | 256 | |
| 261 | 257 | WRITE8_HANDLER( decocass_bgvideoram_w ) |
| r4135 | r4136 | |
| 497 | 493 | } |
| 498 | 494 | |
| 499 | 495 | |
| 500 | static void decode_modified(running_machine* machine, UINT8 *sprite_ram, int interleave) | |
| 501 | { | |
| 502 | int i,offs; | |
| 503 | ||
| 504 | /* decode dirty characters */ | |
| 505 | for (offs = decocass_fgvideoram_size - 1;offs >= 0;offs--) | |
| 506 | { | |
| 507 | int code; | |
| 508 | ||
| 509 | code = decocass_fgvideoram[offs] + 256 * (decocass_colorram[offs] & 3); | |
| 510 | ||
| 511 | switch (char_dirty[code]) | |
| 512 | { | |
| 513 | case 1: | |
| 514 | decodechar(machine->gfx[0],code,decocass_charram); | |
| 515 | char_dirty[code] = 2; | |
| 516 | /* fall through */ | |
| 517 | case 2: | |
| 518 | tilemap_mark_tile_dirty(fg_tilemap, offs); | |
| 519 | break; | |
| 520 | default: | |
| 521 | break; | |
| 522 | } | |
| 523 | } | |
| 524 | ||
| 525 | for (i = 0; i < 1024; i++) | |
| 526 | { | |
| 527 | if (char_dirty[i] == 2) | |
| 528 | char_dirty[i] = 0; | |
| 529 | } | |
| 530 | ||
| 531 | /* decode dirty sprites */ | |
| 532 | for (i = 0, offs = 0;i < 8; i++, offs += 4*interleave) | |
| 533 | { | |
| 534 | int code; | |
| 535 | ||
| 536 | code = sprite_ram[offs + interleave]; | |
| 537 | if (sprite_dirty[code]) | |
| 538 | { | |
| 539 | sprite_dirty[code] = 0; | |
| 540 | ||
| 541 | decodechar(machine->gfx[1],code,decocass_charram); | |
| 542 | } | |
| 543 | } | |
| 544 | ||
| 545 | /* decode dirty tiles */ | |
| 546 | for (offs = 0; offs < decocass_bgvideoram_size; offs++) | |
| 547 | { | |
| 548 | int code = (decocass_tileram[offs] >> 4) & 15; | |
| 549 | ||
| 550 | if (tile_dirty[code]) | |
| 551 | { | |
| 552 | tile_dirty[code] = 0; | |
| 553 | ||
| 554 | decodechar(machine->gfx[2],code,decocass_tileram); | |
| 555 | ||
| 556 | /* mark all visible tiles dirty */ | |
| 557 | for (i = offs; i < decocass_bgvideoram_size; i++) | |
| 558 | if (code == ((decocass_tileram[i] >> 4) & 15)) | |
| 559 | mark_bg_tile_dirty(i); | |
| 560 | } | |
| 561 | } | |
| 562 | ||
| 563 | /* decode object if it is dirty */ | |
| 564 | if (object_dirty) | |
| 565 | { | |
| 566 | decodechar(machine->gfx[3], 0, decocass_objectram); | |
| 567 | decodechar(machine->gfx[3], 1, decocass_objectram); | |
| 568 | object_dirty = 0; | |
| 569 | } | |
| 570 | } | |
| 571 | ||
| 572 | 496 | VIDEO_START( decocass ) |
| 573 | 497 | { |
| 574 | sprite_dirty = auto_malloc(256); | |
| 575 | char_dirty = auto_malloc(1024); | |
| 576 | tile_dirty = auto_malloc(16); | |
| 577 | ||
| 578 | 498 | bg_tilemap_l = tilemap_create( machine, get_bg_l_tile_info, bgvideoram_scan_cols, 16, 16, 32, 32 ); |
| 579 | 499 | bg_tilemap_r = tilemap_create( machine, get_bg_r_tile_info, bgvideoram_scan_cols, 16, 16, 32, 32 ); |
| 580 | 500 | fg_tilemap = tilemap_create( machine, get_fg_tile_info, fgvideoram_scan_cols, 8, 8, 32, 32 ); |
| r4135 | r4136 | |
| 584 | 504 | tilemap_set_transparent_pen( fg_tilemap, 0 ); |
| 585 | 505 | |
| 586 | 506 | bg_tilemap_l_clip = *video_screen_get_visible_area(machine->primary_screen); |
| 587 | bg_tilemap_l_clip.max_y = 256 / 2; | |
| 507 | bg_tilemap_l_clip.max_y = 256 / 2 - 1; | |
| 588 | 508 | |
| 589 | 509 | bg_tilemap_r_clip = *video_screen_get_visible_area(machine->primary_screen); |
| 590 | 510 | bg_tilemap_r_clip.min_y = 256 / 2; |
| r4135 | r4136 | |
| 592 | 512 | /* background videroam bits D0-D3 are shared with the tileram */ |
| 593 | 513 | decocass_bgvideoram = decocass_tileram; |
| 594 | 514 | decocass_bgvideoram_size = 0x0400; /* d000-d3ff */ |
| 515 | ||
| 516 | gfx_element_set_source(machine->gfx[0], decocass_charram); | |
| 517 | gfx_element_set_source(machine->gfx[1], decocass_charram); | |
| 518 | gfx_element_set_source(machine->gfx[2], decocass_tileram); | |
| 519 | gfx_element_set_source(machine->gfx[3], decocass_objectram); | |
| 595 | 520 | } |
| 596 | 521 | |
| 597 | 522 | VIDEO_UPDATE( decocass ) |
| r4135 | r4136 | |
| 629 | 554 | |
| 630 | 555 | bitmap_fill( bitmap, cliprect , 0); |
| 631 | 556 | |
| 632 | decode_modified(screen->machine, decocass_fgvideoram, 0x20 ); | |
| 633 | ||
| 634 | 557 | scrolly_l = back_vl_shift; |
| 635 | 558 | scrolly_r = 256 - back_vr_shift; |
| 636 | 559 |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | static int sprite_colorbase, sub1_colorbase, last_psac_colorbase, gametype; |
| 15 | 15 | static int roz_enable, roz_rombank; |
| 16 | 16 | static tilemap *ult_936_tilemap; |
| 17 | static char *orig_roms; | |
| 18 | 17 | |
| 19 | // do some trickery since we know the graphics decode doesn't touch the source data again | |
| 20 | // and we want the original data | |
| 21 | static void mystwarr_save_orig_tiles(running_machine *machine) | |
| 18 | // create a decoding buffer to hold decodable tiles so that the ROM test will pass by | |
| 19 | // reading the original raw data | |
| 20 | static void mystwarr_decode_tiles(running_machine *machine) | |
| 22 | 21 | { |
| 23 | 22 | UINT8 *s = memory_region(machine, "gfx1"); |
| 24 | 23 | int len = memory_region_length(machine, "gfx1"); |
| 25 | 24 | UINT8 *pFinish = s+len-3; |
| 25 | UINT8 *d, *decoded; | |
| 26 | int gfxnum; | |
| 26 | 27 | |
| 27 | orig_roms = malloc_or_die(len); | |
| 28 | memcpy(orig_roms, s, len); | |
| 28 | for (gfxnum = 0; gfxnum < ARRAY_LENGTH(machine->gfx); gfxnum++) | |
| 29 | if (machine->gfx[gfxnum] != NULL && machine->gfx[gfxnum]->srcdata == s) | |
| 30 | break; | |
| 31 | assert(gfxnum != ARRAY_LENGTH(machine->gfx)); | |
| 29 | 32 | |
| 33 | decoded = auto_malloc(len); | |
| 34 | d = decoded; | |
| 35 | ||
| 30 | 36 | // now convert the data into a drawable format so we can decode it |
| 31 | 37 | while (s < pFinish) |
| 32 | 38 | { |
| r4135 | r4136 | |
| 43 | 49 | int d3 = ((s[0]&0x10)<<3)|((s[0]&0x01)<<6)|((s[1]&0x10)<<1)|((s[1]&0x01)<<4)| |
| 44 | 50 | ((s[2]&0x10)>>1)|((s[2]&0x01)<<2)|((s[3]&0x10)>>3)|((s[3]&0x01) ); |
| 45 | 51 | |
| 46 | s[0] = d3; | |
| 47 | s[1] = d1; | |
| 48 | s[2] = d2; | |
| 49 | s[3] = d0; | |
| 52 | d[0] = d3; | |
| 53 | d[1] = d1; | |
| 54 | d[2] = d2; | |
| 55 | d[3] = d0; | |
| 56 | d[4] = s[4]; | |
| 50 | 57 | |
| 51 | 58 | s += 5; |
| 59 | d += 5; | |
| 52 | 60 | } |
| 53 | } | |
| 54 | 61 | |
| 55 | static void mystwarr_rest_orig_tiles(running_machine *machine) | |
| 56 | { | |
| 57 | UINT8 *s = memory_region(machine, "gfx1"); | |
| 58 | int len = memory_region_length(machine, "gfx1"); | |
| 59 | ||
| 60 | // restore the original data so the ROM test can pass | |
| 61 | memcpy(s, orig_roms, len); | |
| 62 | free(orig_roms); | |
| 62 | gfx_element_set_source(machine->gfx[gfxnum], decoded); | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
| r4135 | r4136 | |
| 164 | 164 | |
| 165 | 165 | gametype = 0; |
| 166 | 166 | |
| 167 | mystwarr_save_orig_tiles(machine); | |
| 168 | ||
| 169 | 167 | K056832_vh_start(machine, "gfx1", K056832_BPP_5, 0, NULL, game4bpp_tile_callback, 0); |
| 170 | 168 | |
| 171 | mystwarr_ | |
| 169 | mystwarr_dec | |
| 172 | 170 | |
| 173 | 171 | K055673_vh_start(machine, "gfx2", 1, -61, -22, gaiapols_sprite_callback); // stage2 brick walls |
| 174 | 172 | |
| r4135 | r4136 | |
| 206 | 204 | |
| 207 | 205 | gametype = 1; |
| 208 | 206 | |
| 209 | mystwarr_save_orig_tiles(machine); | |
| 210 | ||
| 211 | 207 | K056832_vh_start(machine, "gfx1", K056832_BPP_5, 0, NULL, game5bpp_tile_callback, 0); |
| 212 | 208 | |
| 213 | mystwarr_ | |
| 209 | mystwarr_dec | |
| 214 | 210 | |
| 215 | 211 | K055673_vh_start(machine, "gfx2", 0, -42, -22, gaiapols_sprite_callback); |
| 216 | 212 | |
| r4135 | r4136 | |
| 237 | 233 | |
| 238 | 234 | gametype = 0; |
| 239 | 235 | |
| 240 | mystwarr_save_orig_tiles(machine); | |
| 241 | ||
| 242 | 236 | K056832_vh_start(machine, "gfx1", K056832_BPP_5, 0, NULL, mystwarr_tile_callback, 0); |
| 243 | 237 | |
| 244 | mystwarr_ | |
| 238 | mystwarr_dec | |
| 245 | 239 | |
| 246 | 240 | K055673_vh_start(machine, "gfx2", 0, -48, -24, mystwarr_sprite_callback); |
| 247 | 241 | |
| r4135 | r4136 | |
| 265 | 259 | K054338_vh_start(machine); |
| 266 | 260 | K053250_vh_start(machine, 1, &rgn_250); |
| 267 | 261 | |
| 268 | mystwarr_save_orig_tiles(machine); | |
| 269 | ||
| 270 | 262 | K056832_vh_start(machine, "gfx1", K056832_BPP_5, 0, NULL, game4bpp_tile_callback, 0); |
| 271 | 263 | |
| 272 | mystwarr_ | |
| 264 | mystwarr_dec | |
| 273 | 265 | |
| 274 | 266 | K055673_vh_start(machine, "gfx2", 1, -51, -22, metamrph_sprite_callback); |
| 275 | 267 | |
| r4135 | r4136 | |
| 291 | 283 | K055555_vh_start(machine); |
| 292 | 284 | K054338_vh_start(machine); |
| 293 | 285 | |
| 294 | mystwarr_save_orig_tiles(machine); | |
| 295 | ||
| 296 | 286 | K056832_vh_start(machine, "gfx1", K056832_BPP_5, 0, NULL, game4bpp_tile_callback, 0); |
| 297 | 287 | |
| 298 | mystwarr_ | |
| 288 | mystwarr_dec | |
| 299 | 289 | |
| 300 | 290 | K055673_vh_start(machine, "gfx2", 1, -62, -23, metamrph_sprite_callback); |
| 301 | 291 | |
| r4135 | r4136 | |
| 314 | 304 | K055555_vh_start(machine); |
| 315 | 305 | K054338_vh_start(machine); |
| 316 | 306 | |
| 317 | mystwarr_save_orig_tiles(machine); | |
| 318 | ||
| 319 | 307 | K056832_vh_start(machine, "gfx1", K056832_BPP_5, 0, NULL, game5bpp_tile_callback, 0); |
| 320 | 308 | |
| 321 | mystwarr_ | |
| 309 | mystwarr_dec | |
| 322 | 310 | |
| 323 | 311 | K055673_vh_start(machine, "gfx2", 0, -58, -23, martchmp_sprite_callback); |
| 324 | 312 |
| r4135 | r4136 | |
|---|---|---|
| 353 | 353 | |
| 354 | 354 | /* copy the polygon bitmap */ |
| 355 | 355 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) |
| 356 | draw_scanline8(bitmap, 0, y, BITMAP_WIDTH, &bitmap_base[y * BITMAP_WIDTH], NULL | |
| 356 | draw_scanline8(bitmap, 0, y, BITMAP_WIDTH, &bitmap_base[y * BITMAP_WIDTH], NULL | |
| 357 | 357 | |
| 358 | 358 | /* redraw the non-zero characters in the alpha layer */ |
| 359 | 359 | for (y = offs = 0; y < 32; y++) |
| r4135 | r4136 | |
|---|---|---|
| 31 | 31 | return 0; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | sys24_tile_update(screen->machine); | |
| 35 | ||
| 36 | 34 | bitmap_fill(priority_bitmap, 0, 0); |
| 37 | 35 | bitmap_fill(bitmap, cliprect, 0); |
| 38 | 36 |
| r4135 | r4136 | |
|---|---|---|
| 296 | 296 | { |
| 297 | 297 | K056832_vh_start(machine, "gfx1", K056832_BPP_6, 1, NULL, konamigx_type2_tile_callback, 0); |
| 298 | 298 | |
| 299 | if (!strcmp(machine->gamedrv->name,"salmndr2")) | |
| 299 | if (!strcmp(machine->gamedrv->name,"salmndr2") || !strcmp(machine->gamedrv->name,"salmnd2a")) | |
| 300 | 300 | { |
| 301 | 301 | K055673_vh_start(machine, "gfx2", K055673_LAYOUT_GX6, -48, -23, konamigx_salmndr2_sprite_callback); |
| 302 | 302 |
| r4135 | r4136 | |
|---|---|---|
| 128 | 128 | { |
| 129 | 129 | K051316_zoom_draw_2(bitmap,cliprect,0,0); |
| 130 | 130 | K051316_zoom_draw_1(bitmap,cliprect,0,0); |
| 131 | K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 131 | K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 132 | 132 | K051316_zoom_draw_0(bitmap,cliprect,0,0); |
| 133 | K051960_sprites_draw(bitmap,cliprect,1,1); | |
| 133 | K051960_sprites_draw(screen->machine,bitmap,cliprect,1,1); | |
| 134 | 134 | return 0; |
| 135 | 135 | } |
| r4135 | r4136 | |
|---|---|---|
| 93 | 93 | tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[1]],0,2); |
| 94 | 94 | tilemap_draw(bitmap,cliprect,K052109_tilemap[layer[2]],0,4); |
| 95 | 95 | |
| 96 | K053245_sprites_draw(0,bitmap,cliprect); | |
| 96 | K053245_sprites_draw(screen->machine,0,bitmap,cliprect); | |
| 97 | 97 | return 0; |
| 98 | 98 | } |
| r4135 | r4136 | |
|---|---|---|
| 72 | 72 | UINT8 *spriteram; /* sprite ram */ |
| 73 | 73 | pen_t *colortable; /* color table modified at run time */ |
| 74 | 74 | pen_t *colortable_mono; /* monochromatic color table modified at run time */ |
| 75 | UINT8 *dirtychar; /* an array flagging dirty characters */ | |
| 76 | int chars_are_dirty; /* master flag to check if theres any dirty character */ | |
| 77 | 75 | emu_timer *scanline_timer; /* scanline timer */ |
| 78 | 76 | emu_timer *hblank_timer; /* hblank period at end of each scanline */ |
| 79 | 77 | emu_timer *nmi_timer; /* NMI timer */ |
| r4135 | r4136 | |
| 310 | 308 | chips[i].videomem = auto_malloc( VIDEOMEM_SIZE ); |
| 311 | 309 | chips[i].videoram = auto_malloc( VIDEOMEM_SIZE ); |
| 312 | 310 | chips[i].spriteram = auto_malloc( SPRITERAM_SIZE ); |
| 313 | chips[i].dirtychar = auto_malloc( CHARGEN_NUM_CHARS ); | |
| 314 | 311 | chips[i].colortable = auto_malloc( sizeof( default_colortable ) ); |
| 315 | 312 | chips[i].colortable_mono = auto_malloc( sizeof( default_colortable_mono ) ); |
| 316 | 313 | |
| r4135 | r4136 | |
| 320 | 317 | memset( chips[i].spriteram, 0, SPRITERAM_SIZE ); |
| 321 | 318 | memset( chips[i].videoram_banks_indices, 0xff, sizeof(chips[i].videoram_banks_indices) ); |
| 322 | 319 | |
| 323 | /* set all characters dirty */ | |
| 324 | memset( chips[i].dirtychar, 1, CHARGEN_NUM_CHARS ); | |
| 325 | ||
| 326 | 320 | if ( intf->vram_enabled[i] ) |
| 327 | 321 | { |
| 328 | 322 | chips[i].has_videoram = 1; |
| r4135 | r4136 | |
| 362 | 356 | |
| 363 | 357 | memcpy(&gl, &ppu_charlayout, sizeof(gl)); |
| 364 | 358 | gl.total = total; |
| 365 | machine->gfx[intf->gfx_layout_number[i]] = allocgfx( machine, &gl ); | |
| 366 | decodegfx( machine->gfx[intf->gfx_layout_number[i]], src, 0, machine->gfx[intf->gfx_layout_number[i]]->total_elements ); | |
| 367 | machine->gfx[intf->gfx_layout_number[i]]->total_colors = 8; | |
| 359 | machine->gfx[intf->gfx_layout_number[i]] = gfx_element_alloc( machine, &gl, src, 8, 0 ); | |
| 368 | 360 | } |
| 369 | 361 | |
| 370 | 362 | /* setup our videomem handlers based on mirroring */ |
| r4135 | r4136 | |
| 412 | 404 | const int total_elements = chips[num].machine->gfx[gfx_bank]->total_elements; |
| 413 | 405 | const int *nes_vram = &chips[num].nes_vram[0]; |
| 414 | 406 | const int tile_page = chips[num].tile_page; |
| 415 | const int char_modulo = chips[num].machine->gfx[gfx_bank]->char_modulo; | |
| 416 | 407 | const int line_modulo = chips[num].machine->gfx[gfx_bank]->line_modulo; |
| 417 | UINT8 *gfx_data = chips[num].machine->gfx[gfx_bank]->gfxdata; | |
| 418 | 408 | UINT8 **ppu_page = chips[num].ppu_page; |
| 419 | 409 | int start_x = ( chips[num].x_fine ^ 0x07 ) - 7; |
| 420 | 410 | UINT16 back_pen; |
| r4135 | r4136 | |
| 493 | 483 | if(start_x < VISIBLE_SCREEN_WIDTH ) |
| 494 | 484 | { |
| 495 | 485 | paldata = &color_table[ 4 * ( ( ( color_byte >> color_bits ) & 0x03 ) ) ]; |
| 496 | start = ( index2 % total_elements ) * char_modulo + scroll_y_fine * line_modulo; | |
| 497 | sd = &gfx_data[start]; | |
| 486 | start = scroll_y_fine * line_modulo; | |
| 487 | sd = gfx_element_get_data(chips[num].machine->gfx[gfx_bank], index2 % total_elements) + start; | |
| 498 | 488 | |
| 499 | 489 | /* render the pixel */ |
| 500 | 490 | for( i = 0; i < 8; i++ ) |
| r4135 | r4136 | |
| 548 | 538 | const int gfx_bank = intf->gfx_layout_number[num]; |
| 549 | 539 | const int total_elements = chips[num].machine->gfx[gfx_bank]->total_elements; |
| 550 | 540 | const int sprite_page = chips[num].sprite_page; |
| 551 | const int char_modulo = chips[num].machine->gfx[gfx_bank]->char_modulo; | |
| 552 | 541 | const int line_modulo = chips[num].machine->gfx[gfx_bank]->line_modulo; |
| 553 | 542 | const UINT8 *sprite_ram = chips[num].spriteram; |
| 554 | 543 | pen_t *color_table = chips[num].colortable; |
| 555 | UINT8 *gfx_data = chips[num].machine->gfx[gfx_bank]->gfxdata; | |
| 556 | 544 | int *ppu_regs = &chips[num].regs[0]; |
| 557 | 545 | |
| 558 | 546 | int spriteXPos, spriteYPos, spriteIndex; |
| r4135 | r4136 | |
| 637 | 625 | sprite_line = ( size - 1 ) - sprite_line; |
| 638 | 626 | |
| 639 | 627 | paldata = &color_table[4 * color]; |
| 640 | start = ( index1 % total_elements ) * char_modulo + sprite_line * line_modulo; | |
| 641 | sd = &gfx_data[start]; | |
| 628 | start = sprite_line * line_modulo; | |
| 629 | sd = gfx_element_get_data(chips[num].machine->gfx[gfx_bank], index1 % total_elements) + start; | |
| 630 | if (size > 8) | |
| 631 | gfx_element_get_data(chips[num].machine->gfx[gfx_bank], (index1 + 1) % total_elements); | |
| 642 | 632 | |
| 643 | 633 | if ( pri ) |
| 644 | 634 | { |
| r4135 | r4136 | |
| 859 | 849 | int num = param; |
| 860 | 850 | ppu2c0x_chip* this_ppu = &chips[num]; |
| 861 | 851 | int *ppu_regs = &chips[num].regs[0]; |
| 862 | int i; | |
| 863 | 852 | int blanked = ( ppu_regs[PPU_CONTROL1] & ( PPU_CONTROL1_BACKGROUND | PPU_CONTROL1_SPRITES ) ) == 0; |
| 864 | 853 | int vblank = ((this_ppu->scanline >= PPU_VBLANK_FIRST_SCANLINE-1) && (this_ppu->scanline < this_ppu->scanlines_per_frame-1)) ? 1 : 0; |
| 865 | 854 | int next_scanline; |
| r4135 | r4136 | |
| 894 | 883 | } |
| 895 | 884 | } |
| 896 | 885 | |
| 897 | /* decode any dirty chars if we're using vram */ | |
| 898 | ||
| 899 | /* first, check the master dirty char flag */ | |
| 900 | if ( (!this_ppu->has_videorom || this_ppu->has_videoram) && this_ppu->chars_are_dirty ) | |
| 901 | { | |
| 902 | /* cache some values */ | |
| 903 | UINT8 *dirtyarray = this_ppu->dirtychar; | |
| 904 | UINT8 *vram = this_ppu->videomem; | |
| 905 | gfx_element *gfx = chips[num].machine->gfx[intf->gfx_layout_number[num]]; | |
| 906 | ||
| 907 | /* then iterate and decode */ | |
| 908 | for( i = 0; i < CHARGEN_NUM_CHARS; i++ ) | |
| 909 | { | |
| 910 | if ( dirtyarray[i] ) | |
| 911 | { | |
| 912 | decodechar( gfx, i, vram ); | |
| 913 | dirtyarray[i] = 0; | |
| 914 | } | |
| 915 | } | |
| 916 | ||
| 917 | this_ppu->chars_are_dirty = 0; | |
| 918 | } | |
| 919 | ||
| 920 | 886 | if ( this_ppu->scanline == this_ppu->scanlines_per_frame - 1 ) |
| 921 | 887 | { |
| 922 | 888 | logerror("vlbank ending\n"); |
| r4135 | r4136 | |
| 996 | 962 | chips[num].tile_page = 0; |
| 997 | 963 | chips[num].sprite_page = 0; |
| 998 | 964 | chips[num].back_color = 0; |
| 999 | chips[num].chars_are_dirty = 1; | |
| 1000 | 965 | |
| 1001 | 966 | /* initialize the color tables */ |
| 1002 | 967 | { |
| r4135 | r4136 | |
| 1244 | 1209 | /* store the data */ |
| 1245 | 1210 | this_ppu->videomem[tempAddr] = data; |
| 1246 | 1211 | |
| 1247 | /* setup the master dirty switch */ | |
| 1248 | this_ppu->chars_are_dirty = 1; | |
| 1249 | ||
| 1250 | 1212 | /* mark the char dirty */ |
| 1251 | this_ppu-> | |
| 1213 | gfx_element_mark_dirty(this_ppu->ma | |
| 1252 | 1214 | } |
| 1253 | 1215 | } |
| 1254 | 1216 | |
| r4135 | r4136 | |
| 1397 | 1359 | { |
| 1398 | 1360 | for ( i = start_page; i < start_page + num_pages; i++ ) |
| 1399 | 1361 | { |
| 1362 | int elemnum; | |
| 1363 | ||
| 1400 | 1364 | if ( chips[num].videoram_banks_indices[i] != -1 ) |
| 1401 | 1365 | { |
| 1402 | 1366 | memcpy( &chips[num].videoram[chips[num].videoram_banks_indices[i]*0x400], &chips[num].videomem[i*0x400], 0x400); |
| 1403 | 1367 | } |
| 1404 | 1368 | chips[num].videoram_banks_indices[i] = -1; |
| 1405 | memset( &chips[num].dirtychar[start_page*0x400 >> 4], 1, (num_pages*0x400 >> 4)); | |
| 1369 | for (elemnum = 0; elemnum < (num_pages*0x400 >> 4); elemnum++) | |
| 1370 | gfx_element_mark_dirty(chips[num].machine->gfx[intf->gfx_layout_number[num]], (start_page*0x400 >> 4) + elemnum); | |
| 1406 | 1371 | } |
| 1407 | chips[num].chars_are_dirty = 1; | |
| 1408 | 1372 | } |
| 1409 | 1373 | else |
| 1410 | 1374 | { |
| r4135 | r4136 | |
| 1447 | 1411 | |
| 1448 | 1412 | for ( i = start_page; i < start_page + num_pages; i++ ) |
| 1449 | 1413 | { |
| 1414 | int elemnum; | |
| 1450 | 1415 | if ( chips[num].videoram_banks_indices[i] != -1 ) |
| 1451 | 1416 | { |
| 1452 | 1417 | memcpy( &chips[num].videoram[chips[num].videoram_banks_indices[i]*0x400], &chips[num].videomem[i*0x400], 0x400); |
| 1453 | 1418 | } |
| 1454 | 1419 | chips[num].videoram_banks_indices[i] = (bank * bank_size * 16)/0x400 + (i - start_page); |
| 1455 | memset( &chips[num].dirtychar[start_page*0x400 >> 4], 1, (num_pages*0x400 >> 4)); | |
| 1420 | for (elemnum = 0; elemnum < (num_pages*0x400 >> 4); elemnum++) | |
| 1421 | gfx_element_mark_dirty(chips[num].machine->gfx[intf->gfx_layout_number[num]], (start_page*0x400 >> 4) + elemnum); | |
| 1456 | 1422 | } |
| 1457 | chips[num].chars_are_dirty = 1; | |
| 1458 | 1423 | |
| 1459 | 1424 | { |
| 1460 | 1425 | int vram_start = start_page * 0x400; |
| r4135 | r4136 | |
|---|---|---|
| 8 | 8 | static UINT8 buggychl_sprite_lookup[0x2000]; |
| 9 | 9 | UINT8 *buggychl_character_ram; |
| 10 | 10 | |
| 11 | static int *dirtychar; | |
| 12 | ||
| 13 | 11 | static bitmap_t *tmpbitmap1,*tmpbitmap2; |
| 14 | 12 | static int sl_bank,bg_on,sky_on,sprite_color_base,bg_scrollx; |
| 15 | 13 | |
| r4135 | r4136 | |
| 29 | 27 | |
| 30 | 28 | VIDEO_START( buggychl ) |
| 31 | 29 | { |
| 32 | dirtychar = auto_malloc(256 * sizeof(*dirtychar)); | |
| 33 | 30 | tmpbitmap1 = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 34 | 31 | tmpbitmap2 = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 35 | 32 | |
| 36 | | |
| 33 | gfx_element_set_sour | |
| 37 | 34 | } |
| 38 | 35 | |
| 39 | 36 | |
| r4135 | r4136 | |
| 43 | 40 | if (buggychl_character_ram[offset] != data) |
| 44 | 41 | { |
| 45 | 42 | buggychl_character_ram[offset] = data; |
| 46 | ||
| 47 | dirtychar[(offset / 8) & 0xff] = 1; | |
| 43 | gfx_element_mark_dirty(space->machine->gfx[0], (offset / 8) & 0xff); | |
| 48 | 44 | } |
| 49 | 45 | } |
| 50 | 46 | |
| r4135 | r4136 | |
| 210 | 206 | code = 8 * (lookup[pos] | ((lookup[pos+1] & 0x07) << 8)); |
| 211 | 207 | realflipy = (lookup[pos+1] & 0x80) ? !flipy : flipy; |
| 212 | 208 | code += (realflipy ? (charline ^ 7) : charline); |
| 213 | pendata = machine->gfx[1] | |
| 209 | pendata = gfx_element_get_data(machine->gfx[1], | |
| 214 | 210 | |
| 215 | 211 | for (x = 0;x < 16;x++) |
| 216 | 212 | { |
| r4135 | r4136 | |
| 239 | 235 | |
| 240 | 236 | VIDEO_UPDATE( buggychl ) |
| 241 | 237 | { |
| 242 | int code; | |
| 243 | ||
| 244 | ||
| 245 | 238 | if (sky_on) |
| 246 | 239 | draw_sky(bitmap, cliprect); |
| 247 | 240 | else |
| 248 | 241 | bitmap_fill(bitmap,cliprect,0); |
| 249 | 242 | |
| 250 | /* decode modified characters */ | |
| 251 | for (code = 0;code < 256;code++) | |
| 252 | if (dirtychar[code]) | |
| 253 | decodechar(screen->machine->gfx[0],code,buggychl_character_ram); | |
| 254 | ||
| 255 | 243 | if (bg_on) |
| 256 | 244 | draw_bg(screen->machine, bitmap, cliprect); |
| 257 | 245 | |
| r4135 | r4136 | |
| 259 | 247 | |
| 260 | 248 | draw_fg(screen->machine, bitmap, cliprect); |
| 261 | 249 | |
| 262 | for (code = 0;code < 256;code++) | |
| 263 | dirtychar[code] = 0; | |
| 264 | 250 | return 0; |
| 265 | 251 | } |
| r4135 | r4136 | |
|---|---|---|
| 372 | 372 | const rectangle *clip,int scalex, int scaley) |
| 373 | 373 | { |
| 374 | 374 | int pal_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors); |
| 375 | UINT8 *source_base = gfx | |
| 375 | const UINT8 *source_base = gfx_element_get_data | |
| 376 | 376 | |
| 377 | 377 | int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; |
| 378 | 378 | int sprite_screen_width = (scalex*gfx->width+0x8000)>>16; |
| r4135 | r4136 | |
| 445 | 445 | |
| 446 | 446 | for( y=sy; y<ey; y++ ) |
| 447 | 447 | { |
| 448 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 448 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 449 | 449 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 450 | 450 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0); |
| 451 | 451 |
| r4135 | r4136 | |
|---|---|---|
| 122 | 122 | if (gottlieb_charram[offset] != data) |
| 123 | 123 | { |
| 124 | 124 | gottlieb_charram[offset] = data; |
| 125 | decodechar(space->machine->gfx[0], offset / 32, gottlieb_charram); | |
| 126 | tilemap_mark_all_tiles_dirty(bg_tilemap); | |
| 125 | gfx_element_mark_dirty(space->machine->gfx[0], offset / 32); | |
| 127 | 126 | } |
| 128 | 127 | } |
| 129 | 128 | |
| r4135 | r4136 | |
| 163 | 162 | tilemap_set_transparent_pen(bg_tilemap, 0); |
| 164 | 163 | tilemap_set_scrolldx(bg_tilemap, 0, 318 - 256); |
| 165 | 164 | |
| 165 | gfx_element_set_source(machine->gfx[0], gottlieb_charram); | |
| 166 | ||
| 166 | 167 | /* save some state */ |
| 167 | 168 | state_save_register_global(machine, background_priority); |
| 168 | 169 | state_save_register_global(machine, spritebank); |
| r4135 | r4136 | |
|---|---|---|
| 123 | 123 | K056832_tilemap_draw(screen->machine, bitmap, cliprect, layer[1], 0, 2); |
| 124 | 124 | K056832_tilemap_draw(screen->machine, bitmap, cliprect, layer[2], 0, 4); |
| 125 | 125 | |
| 126 | pdrawgfx_shadow_lowpri = 1; /* fix shadows in front of feet */ | |
| 127 | K053245_sprites_draw(0, bitmap, cliprect); | |
| 126 | /* this isn't supported anymore and it is unsure if still needed; keeping here for reference | |
| 127 | pdrawgfx_shadow_lowpri = 1; fix shadows in front of feet */ | |
| 128 | K053245_sprites_draw(screen->machine, 0, bitmap, cliprect); | |
| 128 | 129 | |
| 129 | 130 | K056832_tilemap_draw(screen->machine, bitmap, cliprect, 2, 0, 0); |
| 130 | 131 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 166 | 166 | machine->gfx[1]->color_granularity=64; |
| 167 | 167 | machine->gfx[2]->color_granularity=64; |
| 168 | 168 | machine->gfx[3]->color_granularity=64; |
| 169 | ||
| 170 | alpha_set_level(0x80); /* guess */ | |
| 171 | 169 | } |
| 172 | 170 | |
| 173 | 171 | |
| r4135 | r4136 | |
| 209 | 207 | int flipx = (source[2] & 0x40000000) >> 30; |
| 210 | 208 | int flipy = (source[2] & 0x80000000) >> 31; |
| 211 | 209 | |
| 212 | int | |
| 210 | int | |
| 213 | 211 | |
| 214 | 212 | int loopno = 0; |
| 215 | 213 | |
| r4135 | r4136 | |
| 245 | 243 | for (ycnt = 0; ycnt <= high; ycnt++) { |
| 246 | 244 | xoffset = 0; |
| 247 | 245 | for (xcnt = 0; xcnt <= wide; xcnt++) { |
| 248 | drawgfxzoom(bitmap,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset, | |
| 246 | drawgfxzoom_alpha(bitmap,cliprect,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset, | |
| 249 | 247 | |
| 250 | 248 | xoffset += ((xzoom*16 + (1<<7)) >> 8); |
| 251 | 249 | loopno++; |
| r4135 | r4136 | |
| 257 | 255 | for (ycnt = high; ycnt >= 0; ycnt--) { |
| 258 | 256 | xoffset = 0; |
| 259 | 257 | for (xcnt = 0; xcnt <= wide; xcnt++) { |
| 260 | drawgfxzoom(bitmap,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset, | |
| 258 | drawgfxzoom_alpha(bitmap,cliprect,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset, | |
| 261 | 259 | |
| 262 | 260 | xoffset += ((xzoom*16 + (1<<7)) >> 8); |
| 263 | 261 | loopno++; |
| r4135 | r4136 | |
| 271 | 269 | for (ycnt = 0; ycnt <= high; ycnt++) { |
| 272 | 270 | xoffset = ((wide*xzoom*16) >> 8); |
| 273 | 271 | for (xcnt = wide; xcnt >= 0; xcnt--) { |
| 274 | drawgfxzoom(bitmap,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset, | |
| 272 | drawgfxzoom_alpha(bitmap,cliprect,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset, | |
| 275 | 273 | |
| 276 | 274 | xoffset -= ((xzoom*16 + (1<<7)) >> 8); |
| 277 | 275 | loopno++; |
| r4135 | r4136 | |
| 283 | 281 | for (ycnt = high; ycnt >= 0; ycnt--) { |
| 284 | 282 | xoffset = ((wide*xzoom*16) >> 8); |
| 285 | 283 | for (xcnt = wide; xcnt >=0 ; xcnt--) { |
| 286 | drawgfxzoom(bitmap,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset, | |
| 284 | drawgfxzoom_alpha(bitmap,cliprect,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset, | |
| 287 | 285 | |
| 288 | 286 | xoffset -= ((xzoom*16 + (1<<7)) >> 8); |
| 289 | 287 | loopno++; |
| r4135 | r4136 | |
|---|---|---|
| 160 | 160 | alpha = (alpha_enabled) ? K054338_set_alpha_level(1) : 255; |
| 161 | 161 | |
| 162 | 162 | if (alpha > 0) |
| 163 | K056832_tilemap_draw(screen->machine, bitmap, cliprect, layers[2], | |
| 163 | K056832_tilemap_draw(screen->machine, bitmap, cliprect, layers[2], | |
| 164 | 164 | |
| 165 | 165 | K053247_sprites_draw(screen->machine, bitmap,cliprect); |
| 166 | 166 |
| r4135 | r4136 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | static TILE_GET_INFO( get_bg18_tile_info ) |
| 26 | 26 | { |
| 27 | int attr = taitol_rambanks[2*tile_index+0x4000+1]; | |
| 28 | int code = taitol_rambanks[2*tile_index+0x4000] | |
| 27 | int attr = taitol_rambanks[2*tile_index+0x8000+1]; | |
| 28 | int code = taitol_rambanks[2*tile_index+0x8000] | |
| 29 | 29 | | ((attr & 0x03) << 8) |
| 30 | 30 | | ((bankc[(attr & 0xc) >> 2]) << 10) |
| 31 | 31 | | (horshoes_gfxbank << 12); |
| r4135 | r4136 | |
| 39 | 39 | |
| 40 | 40 | static TILE_GET_INFO( get_bg19_tile_info ) |
| 41 | 41 | { |
| 42 | int attr = taitol_rambanks[2*tile_index+0x5000+1]; | |
| 43 | int code = taitol_rambanks[2*tile_index+0x5000] | |
| 42 | int attr = taitol_rambanks[2*tile_index+0x9000+1]; | |
| 43 | int code = taitol_rambanks[2*tile_index+0x9000] | |
| 44 | 44 | | ((attr & 0x03) << 8) |
| 45 | 45 | | ((bankc[(attr & 0xc) >> 2]) << 10) |
| 46 | 46 | | (horshoes_gfxbank << 12); |
| r4135 | r4136 | |
| 54 | 54 | |
| 55 | 55 | static TILE_GET_INFO( get_ch1a_tile_info ) |
| 56 | 56 | { |
| 57 | int attr = taitol_rambanks[2*tile_index+0x6000+1]; | |
| 58 | int code = taitol_rambanks[2*tile_index+0x6000]|((attr&0x01)<<8)|((attr&0x04)<<7); | |
| 57 | int attr = taitol_rambanks[2*tile_index+0xa000+1]; | |
| 58 | int code = taitol_rambanks[2*tile_index+0xa000]|((attr&0x01)<<8)|((attr&0x04)<<7); | |
| 59 | 59 | |
| 60 | 60 | SET_TILE_INFO( |
| 61 | 61 | 2, |
| r4135 | r4136 | |
| 158 | 158 | return cur_ctrl; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | INLINE void taitol_chardef(running_machine *machine, int num, int offset) | |
| 162 | { | |
| 163 | decodechar(machine->gfx[2], num, taitol_rambanks + offset); | |
| 164 | tilemap_mark_all_tiles_dirty(ch1a_tilemap); | |
| 165 | } | |
| 166 | ||
| 167 | 161 | void taitol_chardef14_m(running_machine *machine, int offset) |
| 168 | 162 | { |
| 169 | | |
| 163 | gfx_element_m | |
| 170 | 164 | } |
| 171 | 165 | |
| 172 | 166 | void taitol_chardef15_m(running_machine *machine, int offset) |
| 173 | 167 | { |
| 174 | | |
| 168 | gfx_element_m | |
| 175 | 169 | } |
| 176 | 170 | |
| 177 | 171 | void taitol_chardef16_m(running_machine *machine, int offset) |
| 178 | 172 | { |
| 179 | | |
| 173 | gfx_element_m | |
| 180 | 174 | } |
| 181 | 175 | |
| 182 | 176 | void taitol_chardef17_m(running_machine *machine, int offset) |
| 183 | 177 | { |
| 184 | | |
| 178 | gfx_element_m | |
| 185 | 179 | } |
| 186 | 180 | |
| 187 | 181 | void taitol_chardef1c_m(running_machine *machine, int offset) |
| 188 | 182 | { |
| 189 | | |
| 183 | gfx_element_m | |
| 190 | 184 | } |
| 191 | 185 | |
| 192 | 186 | void taitol_chardef1d_m(running_machine *machine, int offset) |
| 193 | 187 | { |
| 194 | | |
| 188 | gfx_element_m | |
| 195 | 189 | } |
| 196 | 190 | |
| 197 | 191 | void taitol_chardef1e_m(running_machine *machine, int offset) |
| 198 | 192 | { |
| 199 | | |
| 193 | gfx_element_m | |
| 200 | 194 | } |
| 201 | 195 | |
| 202 | 196 | void taitol_chardef1f_m(running_machine *machine, int offset) |
| 203 | 197 | { |
| 204 | | |
| 198 | gfx_element_m | |
| 205 | 199 | } |
| 206 | 200 | |
| 207 | 201 | void taitol_bg18_m(running_machine *machine, int offset) |
| r4135 | r4136 | |
| 299 | 293 | int dx,dy; |
| 300 | 294 | |
| 301 | 295 | |
| 302 | dx = taitol_rambanks[0x | |
| 296 | dx = taitol_rambanks[0xb3f4]|(taitol_rambanks[0xb3f5]<<8); | |
| 303 | 297 | if (flipscreen) |
| 304 | 298 | dx = ((dx & 0xfffc) | ((dx - 3) & 0x0003)) ^ 0xf; |
| 305 | dy = taitol_rambanks[0x | |
| 299 | dy = taitol_rambanks[0xb3f6]; | |
| 306 | 300 | tilemap_set_scrollx(bg18_tilemap,0,-dx); |
| 307 | 301 | tilemap_set_scrolly(bg18_tilemap,0,-dy); |
| 308 | 302 | |
| 309 | dx = taitol_rambanks[0x | |
| 303 | dx = taitol_rambanks[0xb3fc]|(taitol_rambanks[0xb3fd]<<8); | |
| 310 | 304 | if (flipscreen) |
| 311 | 305 | dx = ((dx & 0xfffc) | ((dx - 3) & 0x0003)) ^ 0xf; |
| 312 | dy = taitol_rambanks[0x | |
| 306 | dy = taitol_rambanks[0xb3fe]; | |
| 313 | 307 | tilemap_set_scrollx(bg19_tilemap,0,-dx); |
| 314 | 308 | tilemap_set_scrolly(bg19_tilemap,0,-dy); |
| 315 | 309 | |
| r4135 | r4136 | |
| 337 | 331 | |
| 338 | 332 | VIDEO_EOF( taitol ) |
| 339 | 333 | { |
| 340 | UINT8 *spriteram = taitol_rambanks + 0x | |
| 334 | UINT8 *spriteram = taitol_rambanks + 0xb000; | |
| 341 | 335 | |
| 342 | 336 | memcpy(buff_spriteram,spriteram,SPRITERAM_SIZE); |
| 343 | 337 | } |
| r4135 | r4136 | |
|---|---|---|
| 293 | 293 | |
| 294 | 294 | clip.min_y += visarea->min_y + yoffs; |
| 295 | 295 | clip.max_y += visarea->max_y + yoffs; |
| 296 | sect_rect(&clip, cliprect); | |
| 296 | 297 | |
| 297 | 298 | copybitmap(bitmap, scroll_panel_bitmap, flip_screen_get(machine), flip_screen_get(machine), |
| 298 | 299 | sx, visarea->min_y + yoffs, &clip); |
| r4135 | r4136 | |
|---|---|---|
| 198 | 198 | static void ripcord_draw_skydiver(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 199 | 199 | { |
| 200 | 200 | const gfx_element *gfx; |
| 201 | UINT8 *src_lineptr, *src_pixptr; | |
| 201 | const UINT8 *src_lineptr, *src_pixptr; | |
| 202 | 202 | UINT16 *dst_lineptr, *dst_lineend; |
| 203 | 203 | UINT32 code; |
| 204 | 204 | int sx, sy; |
| r4135 | r4136 | |
| 216 | 216 | edx = 1; |
| 217 | 217 | |
| 218 | 218 | gfx = machine->gfx[1]; |
| 219 | src_lineptr = gfx | |
| 219 | src_lineptr = gfx_element_get_data( | |
| 220 | 220 | src_pitch = gfx->line_modulo; |
| 221 | 221 | dst_pitch = bitmap->rowpixels; |
| 222 | 222 |
| r4135 | r4136 | |
|---|---|---|
| 35 | 35 | else return CollisionSprite; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | WRITE8_HANDLER( zac_s2636_w ) | |
| 39 | { | |
| 40 | zac2650_s2636_0_ram[offset] = data; | |
| 41 | gfx_element_mark_dirty(space->machine->gfx[1], offset/8); | |
| 42 | gfx_element_mark_dirty(space->machine->gfx[2], offset/8); | |
| 43 | } | |
| 44 | ||
| 38 | 45 | READ8_HANDLER( tinvader_port_0_r ) |
| 39 | 46 | { |
| 40 | 47 | return input_port_read(space->machine, "1E80") - CollisionBackground; |
| r4135 | r4136 | |
| 137 | 144 | |
| 138 | 145 | spritebitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 139 | 146 | tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 147 | ||
| 148 | gfx_element_set_source(machine->gfx[1], zac2650_s2636_0_ram); | |
| 149 | gfx_element_set_source(machine->gfx[2], zac2650_s2636_0_ram); | |
| 140 | 150 | } |
| 141 | 151 | |
| 142 | 152 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap) |
| r4135 | r4136 | |
| 170 | 180 | int by = (zac2650_s2636_0_ram[offs+12] * 3) + 3; |
| 171 | 181 | int x,y; |
| 172 | 182 | |
| 173 | /* 16x8 version */ | |
| 174 | decodechar(machine->gfx[1],spriteno,zac2650_s2636_0_ram); | |
| 175 | ||
| 176 | /* 16x16 version */ | |
| 177 | decodechar(machine->gfx[2],spriteno,zac2650_s2636_0_ram); | |
| 178 | ||
| 179 | 183 | /* Sprite->Background collision detection */ |
| 180 | 184 | drawgfx(bitmap,machine->gfx[expand], |
| 181 | 185 | spriteno, |
| r4135 | r4136 | |
|---|---|---|
| 70 | 70 | static UINT16 gfxlist_addr; |
| 71 | 71 | static bitmap_t *rawbitmap; |
| 72 | 72 | |
| 73 | static UINT8 drawmode_table[16]; | |
| 73 | 74 | |
| 74 | 75 | |
| 75 | 76 | VIDEO_START( shangha3 ) |
| 76 | 77 | { |
| 78 | int i; | |
| 79 | ||
| 77 | 80 | rawbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 78 | 81 | |
| 82 | for (i = 0;i < 14;i++) | |
| 83 | drawmode_table[i] = DRAWMODE_SOURCE; | |
| 84 | drawmode_table[14] = shangha3_do_shadows ? DRAWMODE_SHADOW : DRAWMODE_NONE; | |
| 85 | drawmode_table[15] = DRAWMODE_NONE; | |
| 86 | ||
| 79 | 87 | if (shangha3_do_shadows) |
| 80 | 88 | { |
| 81 | int i; | |
| 82 | ||
| 83 | 89 | /* Prepare the shadow table */ |
| 84 | for (i = 0;i < 14;i++) | |
| 85 | gfx_drawmode_table[i] = DRAWMODE_SOURCE; | |
| 86 | gfx_drawmode_table[14] = DRAWMODE_SHADOW; | |
| 87 | 90 | for (i = 0;i < 128;i++) |
| 88 | 91 | machine->shadow_table[i] = i+128; |
| 89 | 92 | } |
| r4135 | r4136 | |
| 154 | 157 | myclip.max_x = sx + sizex; |
| 155 | 158 | myclip.min_y = sy; |
| 156 | 159 | myclip.max_y = sy + sizey; |
| 160 | sect_rect(&myclip, &rawbitmap->cliprect); | |
| 157 | 161 | |
| 158 | 162 | if (shangha3_ram[offs+4] & 0x08) /* tilemap */ |
| 159 | 163 | { |
| r4135 | r4136 | |
| 225 | 229 | int w; |
| 226 | 230 | |
| 227 | 231 | if (zoomx <= 1 && zoomy <= 1) |
| 228 | drawgfxzoom(rawbitmap,space->machine->gfx[0], | |
| 232 | drawgfxzoom_transtable(rawbitmap,&myclip,space->machine->gfx[0], | |
| 229 | 233 | code, |
| 230 | 234 | color, |
| 231 | 235 | flipx,flipy, |
| 232 | 236 | sx,sy, |
| 233 | &myclip,shangha3_do_shadows ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,15, | |
| 234 | 0x1000000,0x1000000); | |
| 237 | 0x1000000,0x1000000, | |
| 238 | drawmode_table,space->machine->shadow_table); | |
| 235 | 239 | else |
| 236 | 240 | { |
| 237 | 241 | w = (sizex+15)/16; |
| 238 | 242 | |
| 239 | 243 | for (x = 0;x < w;x++) |
| 240 | 244 | { |
| 241 | drawgfxzoom(rawbitmap,space->machine->gfx[0], | |
| 245 | drawgfxzoom_transtable(rawbitmap,&myclip,space->machine->gfx[0], | |
| 242 | 246 | code, |
| 243 | 247 | color, |
| 244 | 248 | flipx,flipy, |
| 245 | 249 | sx + 16*x,sy, |
| 246 | &myclip,shangha3_do_shadows ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,15, | |
| 247 | (0x200-zoomx)*0x100,(0x200-zoomy)*0x100); | |
| 250 | (0x200-zoomx)*0x100,(0x200-zoomy)*0x100, | |
| 251 | drawmode_table,space->machine->shadow_table); | |
| 248 | 252 | |
| 249 | 253 | if ((code & 0x000f) == 0x0f) |
| 250 | 254 | code = (code + 0x100) & 0xfff0; |
| r4135 | r4136 | |
|---|---|---|
| 82 | 82 | 0 /* callback routine for special entries */ |
| 83 | 83 | }; |
| 84 | 84 | |
| 85 | /* blend the MO graphics */ | |
| 86 | atarigen_blend_gfx(machine, 1, 2, 0x0f, 0x10); | |
| 85 | /* MOs are 5bpp but with a 4-bit color granularity */ | |
| 86 | machine->gfx[1]->color_granularity = 16; | |
| 87 | 87 | |
| 88 | 88 | /* initialize the playfield */ |
| 89 | 89 | atarigen_playfield_tilemap = tilemap_create(machine, get_playfield_tile_info, tilemap_scan_cols, 8,8, 64,64); |
| r4135 | r4136 | |
|---|---|---|
| 215 | 215 | static tilemap *pf1_tilemap,*pf2_tilemap,*pf3_tilemap,*pf4_tilemap; |
| 216 | 216 | static tilemap *pixel_layer,*vram_layer; |
| 217 | 217 | static UINT32 *spriteram32_buffered; |
| 218 | static int vram_dirty[256]; | |
| 219 | static int pivot_changed,vram_changed; | |
| 220 | 218 | static UINT32 f3_control_0[8]; |
| 221 | 219 | static UINT32 f3_control_1[8]; |
| 222 | 220 | static int flipscreen; |
| 223 | 221 | static UINT8 sprite_extra_planes; |
| 224 | 222 | static UINT8 sprite_pen_mask; |
| 225 | 223 | |
| 226 | static UINT8 *pivot_dirty; | |
| 227 | ||
| 228 | 224 | static UINT32 *f3_pf_data_1,*f3_pf_data_2,*f3_pf_data_3,*f3_pf_data_4; |
| 229 | 225 | |
| 230 | 226 | UINT32 *f3_vram,*f3_line_ram; |
| r4135 | r4136 | |
| 599 | 595 | VIDEO_START( f3 ) |
| 600 | 596 | { |
| 601 | 597 | const struct F3config *pCFG=&f3_config_table[0]; |
| 602 | int | |
| 598 | int | |
| 603 | 599 | |
| 604 | 600 | f3_alpha_level_2as=127; |
| 605 | 601 | f3_alpha_level_2ad=127; |
| r4135 | r4136 | |
| 622 | 618 | |
| 623 | 619 | spritelist=0; |
| 624 | 620 | spriteram32_buffered=0; |
| 625 | pivot_dirty=0; | |
| 626 | 621 | pf_line_inf=0; |
| 627 | 622 | pri_alp_bitmap=0; |
| 628 | 623 | tile_opaque_sp=0; |
| r4135 | r4136 | |
| 674 | 669 | sprite_end = spritelist; |
| 675 | 670 | vram_layer = tilemap_create(machine, get_tile_info_vram,tilemap_scan_rows,8,8,64,64); |
| 676 | 671 | pixel_layer = tilemap_create(machine, get_tile_info_pixel,tilemap_scan_cols,8,8,64,32); |
| 677 | pivot_dirty = (UINT8 *)auto_malloc(2048); | |
| 678 | 672 | pf_line_inf = auto_malloc(5 * sizeof(struct f3_playfield_line_inf)); |
| 679 | 673 | sa_line_inf = auto_malloc(1 * sizeof(struct f3_spritealpha_line_inf)); |
| 680 | 674 | width = video_screen_get_width(machine->primary_screen); |
| r4135 | r4136 | |
| 703 | 697 | state_save_register_global_array(machine, f3_control_0); |
| 704 | 698 | state_save_register_global_array(machine, f3_control_1); |
| 705 | 699 | |
| 706 | for (tile = 0;tile < 256;tile++) | |
| 707 | vram_dirty[tile]=1; | |
| 708 | for (tile = 0;tile < 2048;tile++) | |
| 709 | pivot_dirty[tile]=1; | |
| 700 | gfx_element_set_source(machine->gfx[0], (UINT8 *)f3_vram); | |
| 701 | gfx_element_set_source(machine->gfx[3], (UINT8 *)f3_pivot_ram); | |
| 710 | 702 | |
| 711 | 703 | f3_skip_this_frame=0; |
| 712 | 704 | |
| r4135 | r4136 | |
| 722 | 714 | { |
| 723 | 715 | int x,y; |
| 724 | 716 | int chk_trans_or_opa=0; |
| 725 | UINT8 *dp = | |
| 717 | const UINT8 *dp = | |
| 726 | 718 | for (y = 0;y < sprite_gfx->height;y++) |
| 727 | 719 | { |
| 728 | 720 | for (x = 0;x < sprite_gfx->width;x++) |
| r4135 | r4136 | |
| 751 | 743 | { |
| 752 | 744 | int chk_trans_or_opa=0; |
| 753 | 745 | UINT8 extra_mask = ((extra_planes << 4) | 0x0f); |
| 754 | UINT8 *dp = | |
| 746 | const UINT8 *dp = | |
| 755 | 747 | |
| 756 | 748 | for (y = 0;y < pf_gfx->height;y++) |
| 757 | 749 | { |
| r4135 | r4136 | |
| 819 | 811 | WRITE32_HANDLER( f3_vram_w ) |
| 820 | 812 | { |
| 821 | 813 | COMBINE_DATA(&f3_vram[offset]); |
| 822 | vram_dirty[offset/8]=1; | |
| 823 | vram_changed=1; | |
| 814 | gfx_element_mark_dirty(space->machine->gfx[0], offset/8); | |
| 824 | 815 | } |
| 825 | 816 | |
| 826 | 817 | WRITE32_HANDLER( f3_pivot_w ) |
| 827 | 818 | { |
| 828 | 819 | COMBINE_DATA(&f3_pivot_ram[offset]); |
| 829 | pivot_dirty[offset/8]=1; | |
| 830 | pivot_changed=1; | |
| 820 | gfx_element_mark_dirty(space->machine->gfx[3], offset/8); | |
| 831 | 821 | } |
| 832 | 822 | |
| 833 | 823 | WRITE32_HANDLER( f3_lineram_w ) |
| r4135 | r4136 | |
| 2668 | 2658 | if( gfx ) |
| 2669 | 2659 | { |
| 2670 | 2660 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 2671 | | |
| 2661 | const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements) | |
| 2672 | 2662 | |
| 2673 | 2663 | { |
| 2674 | 2664 | /* compute sprite increment per screen pixel */ |
| r4135 | r4136 | |
| 2734 | 2724 | { |
| 2735 | 2725 | int y=ey-sy; |
| 2736 | 2726 | int x=(ex-sx-1)|(tile_opaque_sp[code % gfx->total_elements]<<4); |
| 2737 | UINT8 *source0 = | |
| 2727 | const UINT8 *source0 = | |
| 2738 | 2728 | UINT32 *dest0 = BITMAP_ADDR32(dest_bmp, sy, sx); |
| 2739 | 2729 | UINT8 *pri0 = BITMAP_ADDR8(pri_alp_bitmap, sy, sx); |
| 2740 | 2730 | int yadv = dest_bmp->rowpixels; |
| 2741 | 2731 | dy=dy*16; |
| 2742 | 2732 | while(1) |
| 2743 | 2733 | { |
| 2744 | UINT8 *source = source0; | |
| 2734 | const UINT8 *source = source0; | |
| 2745 | 2735 | UINT32 *dest = dest0; |
| 2746 | 2736 | UINT8 *pri = pri0; |
| 2747 | 2737 | |
| r4135 | r4136 | |
| 2833 | 2823 | if( gfx ) |
| 2834 | 2824 | { |
| 2835 | 2825 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 2836 | | |
| 2826 | const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements) | |
| 2837 | 2827 | |
| 2838 | 2828 | { |
| 2839 | 2829 | /* compute sprite increment per screen pixel */ |
| r4135 | r4136 | |
| 2900 | 2890 | int y; |
| 2901 | 2891 | for( y=sy; y<ey; y++ ) |
| 2902 | 2892 | { |
| 2903 | UINT8 *source = | |
| 2893 | const UINT8 *source = | |
| 2904 | 2894 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 2905 | 2895 | UINT8 *pri = BITMAP_ADDR8(pri_alp_bitmap, y, 0); |
| 2906 | 2896 | |
| r4135 | r4136 | |
| 3248 | 3238 | VIDEO_UPDATE( f3 ) |
| 3249 | 3239 | { |
| 3250 | 3240 | UINT32 sy_fix[5],sx_fix[5]; |
| 3251 | int tile; | |
| 3252 | 3241 | |
| 3253 | 3242 | f3_skip_this_frame=0; |
| 3254 | 3243 | tilemap_set_flip(ALL_TILEMAPS,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); |
| 3255 | 3244 | |
| 3256 | /* Dynamically decode VRAM chars if dirty */ | |
| 3257 | if (vram_changed) | |
| 3258 | for (tile = 0;tile < 256;tile++) | |
| 3259 | if (vram_dirty[tile]) { | |
| 3260 | decodechar(screen->machine->gfx[0],tile,(UINT8 *)f3_vram); | |
| 3261 | tilemap_mark_all_tiles_dirty(vram_layer); // TODO | |
| 3262 | //tilemap_mark_tile_dirty(vram_layer,tile); | |
| 3263 | vram_dirty[tile]=0; | |
| 3264 | } | |
| 3265 | ||
| 3266 | /* Decode chars & mark tilemap dirty */ | |
| 3267 | if (pivot_changed) | |
| 3268 | for (tile = 0;tile < 2048;tile++) | |
| 3269 | if (pivot_dirty[tile]) { | |
| 3270 | decodechar(screen->machine->gfx[3],tile,(UINT8 *)f3_pivot_ram); | |
| 3271 | tilemap_mark_tile_dirty(pixel_layer,tile); | |
| 3272 | pivot_dirty[tile]=0; | |
| 3273 | } | |
| 3274 | pivot_changed=vram_changed=0; | |
| 3275 | ||
| 3276 | 3245 | /* Setup scroll */ |
| 3277 | 3246 | sy_fix[0]=((f3_control_0[2]&0xffff0000)>> 7) + (1<<16); |
| 3278 | 3247 | sy_fix[1]=((f3_control_0[2]&0x0000ffff)<< 9) + (1<<16); |
| r4135 | r4136 | |
|---|---|---|
| 392 | 392 | } else { /* last palette entry is reserved for shadows and highlights */ |
| 393 | 393 | |
| 394 | 394 | /* get a pointer to the current sprite's gfx data */ |
| 395 | UINT8 *gfx_src = gfx | |
| 395 | const UINT8 *gfx_src = gfx_element_get_data | |
| 396 | 396 | |
| 397 | 397 | for (py = 0; py < gfx->height; py++){ |
| 398 | 398 | /* get a pointer to the current line in the screen bitmap */ |
| r4135 | r4136 | |
|---|---|---|
| 275 | 275 | for (y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff) |
| 276 | 276 | if (sy >= cliprect->min_y && sy <= cliprect->max_y) |
| 277 | 277 | { |
| 278 | UINT8 *src = gfx | |
| 278 | const UINT8 *src = gfx_element_get_data( | |
| 279 | 279 | UINT16 *dst = BITMAP_ADDR16(bitmap, sy, 0); |
| 280 | 280 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, sy, 0); |
| 281 | 281 | |
| r4135 | r4136 | |
| 345 | 345 | for (y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff) |
| 346 | 346 | if (sy >= 2 && sy >= cliprect->min_y && sy <= cliprect->max_y) |
| 347 | 347 | { |
| 348 | UINT8 *src = gfx | |
| 348 | const UINT8 *src = gfx_element_get_data( | |
| 349 | 349 | UINT16 *dst = BITMAP_ADDR16(bitmap, sy, 0); |
| 350 | 350 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, sy, 0); |
| 351 | 351 |
| r4135 | r4136 | |
|---|---|---|
| 74 | 74 | segae_drawscanline(screen->machine, i-16,0,0); |
| 75 | 75 | |
| 76 | 76 | for (i = miny;i <= maxy;i++) |
| 77 | draw_scanline8(bitmap,32,i,256,&cache_bitmap[(i-16) * (16+256+16) +24],&screen->machine->pens[palette_base],0); | |
| 77 | { | |
| 78 | UINT16 *dest = BITMAP_ADDR16(bitmap, i, 32); | |
| 79 | int x; | |
| 80 | for (x = 0; x < 256; x++) | |
| 81 | dest[x] = screen->machine->pens[palette_base + cache_bitmap[(i-16) * (16+256+16) + 24 + x]]; | |
| 82 | } | |
| 78 | 83 | |
| 79 | 84 | return 0; |
| 80 | 85 | } |
| r4135 | r4136 | |
|---|---|---|
| 119 | 119 | fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 16, 16, 32, 32); |
| 120 | 120 | |
| 121 | 121 | sprites_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 122 | state_save_register_global_bitmap(machine, sprites_bitmap); | |
| 122 | 123 | tilemap_set_transparent_pen(fg_tilemap, 0); |
| 123 | 124 | pandora_start(machine,1,0,0); |
| 124 | 125 |
| r4135 | r4136 | |
|---|---|---|
| 79 | 79 | bitmap_fill(bitmap,cliprect,0); |
| 80 | 80 | |
| 81 | 81 | K051316_zoom_draw_1(bitmap,cliprect,TILEMAP_DRAW_LAYER1,0); |
| 82 | K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 82 | K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 83 | 83 | K051316_zoom_draw_1(bitmap,cliprect,TILEMAP_DRAW_LAYER0,0); |
| 84 | K051960_sprites_draw(bitmap,cliprect,1,1); | |
| 84 | K051960_sprites_draw(screen->machine,bitmap,cliprect,1,1); | |
| 85 | 85 | K051316_zoom_draw_0(bitmap,cliprect,0,0); |
| 86 | 86 | return 0; |
| 87 | 87 | } |
| r4135 | r4136 | |
|---|---|---|
| 81 | 81 | |
| 82 | 82 | tilemap_mark_tile_dirty(scrollmap[offset>>12], offset & 0xfff); |
| 83 | 83 | } |
| 84 | else | |
| 85 | { | |
| 86 | if (offset < 0x1000) | |
| 87 | gfx_element_mark_dirty(fgfx, offset/32); | |
| 88 | else | |
| 89 | gfx_element_mark_dirty(bgfx, offset/32); | |
| 90 | } | |
| 84 | 91 | |
| 85 | 92 | (srbase[srbank])[offset] = data; |
| 86 | 93 | } |
| r4135 | r4136 | |
| 88 | 95 | |
| 89 | 96 | WRITE8_HANDLER( bwing_scrollreg_w ) |
| 90 | 97 | { |
| 91 | static unsigned bp_ready=0; | |
| 92 | unsigned i; | |
| 93 | UINT8 *src; | |
| 94 | ||
| 95 | 98 | sreg[offset] = data; |
| 96 | 99 | |
| 97 | 100 | switch (offset) |
| r4135 | r4136 | |
| 103 | 106 | mapmask = data; |
| 104 | 107 | srbank = data >> 6; |
| 105 | 108 | |
| 106 | if (srbank) bp_ready |= 1<<(srbank-1) & 7; | |
| 107 | ||
| 108 | if (bp_ready == 7 && !srbank) | |
| 109 | { | |
| 110 | src = srbase[1]; | |
| 111 | for (i=0; i<BW_NTILES; i++) decodechar(fgfx, i, src); | |
| 112 | ||
| 113 | src += 0x1000; | |
| 114 | for (i=0; i<BW_NTILES; i++) decodechar(bgfx, i, src); | |
| 115 | ||
| 116 | bp_ready = 0; | |
| 117 | } | |
| 118 | ||
| 119 | 109 | #if BW_DEBUG |
| 120 | 110 | logerror("(%s)%04x: w=%02x a=%04x f=%d\n", space->cpu->tag, cpu_get_pc(space->cpu),data,0x1b00+offset,video_screen_get_frame_number(space->machine->primary_screen)); |
| 121 | 111 | #endif |
| r4135 | r4136 | |
| 164 | 154 | // Initializations |
| 165 | 155 | |
| 166 | 156 | #define BW_SET_TILE_INFO(GFX, CODE, COLOR) { \ |
| 167 | tileinfo->pen_data = | |
| 157 | tileinfo->pen_data = | |
| 168 | 158 | tileinfo->palette_base = GFX->color_base + ((COLOR) << 3); \ |
| 169 | 159 | } |
| 170 | 160 | |
| r4135 | r4136 | |
| 215 | 205 | for (i=0; i<8; i++) sreg[i] = 0; |
| 216 | 206 | |
| 217 | 207 | fgfx = machine->gfx[2]; |
| 208 | gfx_element_set_source(fgfx, srbase[1]); | |
| 218 | 209 | bgfx = machine->gfx[3]; |
| 210 | gfx_element_set_source(bgfx, srbase[1] + 0x1000); | |
| 219 | 211 | |
| 220 | 212 | dwptr = fgfx->pen_usage; |
| 221 | 213 | if (dwptr) |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | static tilemap *bg_tilemap,*md_tilemap,*fg_tilemap,*tx_tilemap; |
| 10 | 10 | UINT16 *sengokmj_bgvram,*sengokmj_mdvram,*sengokmj_fgvram,*sengokmj_txvram; |
| 11 | 11 | static UINT16 sengokmj_layer_en; |
| 12 | static UINT16 sengokmj_scrolly; | |
| 12 | 13 | |
| 13 | 14 | WRITE16_HANDLER( sengokmj_bgvram_w ) |
| 14 | 15 | { |
| r4135 | r4136 | |
| 41 | 42 | sengokmj_layer_en = data; |
| 42 | 43 | } |
| 43 | 44 | |
| 45 | WRITE16_HANDLER( sengokmj_bg_scrolly_w ) | |
| 46 | { | |
| 47 | sengokmj_scrolly = data; | |
| 48 | } | |
| 49 | ||
| 44 | 50 | static TILE_GET_INFO( sengoku_bg_tile_info ) |
| 45 | 51 | { |
| 46 | 52 | int tile = sengokmj_bgvram[tile_index]; |
| r4135 | r4136 | |
| 113 | 119 | |
| 114 | 120 | VIDEO_START( sengokmj ) |
| 115 | 121 | { |
| 116 | bg_tilemap = tilemap_create(machine, sengoku_bg_tile_info,tilemap_scan_rows,16,16,32,16); | |
| 117 | md_tilemap = tilemap_create(machine, sengoku_md_tile_info,tilemap_scan_rows,16,16,32,16); | |
| 118 | fg_tilemap = tilemap_create(machine, sengoku_fg_tile_info,tilemap_scan_rows,16,16,32,16); | |
| 122 | bg_tilemap = tilemap_create(machine, sengoku_bg_tile_info,tilemap_scan_rows,16,16,32,32); | |
| 123 | md_tilemap = tilemap_create(machine, sengoku_md_tile_info,tilemap_scan_rows,16,16,32,32); | |
| 124 | fg_tilemap = tilemap_create(machine, sengoku_fg_tile_info,tilemap_scan_rows,16,16,32,32); | |
| 119 | 125 | tx_tilemap = tilemap_create(machine, sengoku_tx_tile_info,tilemap_scan_rows, 8, 8,64,32); |
| 120 | 126 | |
| 121 | 127 | tilemap_set_transparent_pen(md_tilemap,15); |
| r4135 | r4136 | |
| 126 | 132 | VIDEO_UPDATE( sengokmj ) |
| 127 | 133 | { |
| 128 | 134 | bitmap_fill(bitmap, cliprect, screen->machine->pens[0x7ff]); //black pen |
| 135 | tilemap_set_scrolly( bg_tilemap,0, sengokmj_scrolly ); | |
| 129 | 136 | |
| 130 | if(!(sengokmj_layer_en & 1)) | |
| 131 | tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); | |
| 132 | draw_sprites(screen->machine, bitmap,cliprect, 2); | |
| 133 | draw_sprites(screen->machine, bitmap,cliprect, 1); | |
| 134 | if(!(sengokmj_layer_en & 2)) | |
| 135 | tilemap_draw(bitmap,cliprect,md_tilemap,0,0); | |
| 136 | if(!(sengokmj_layer_en & 4)) | |
| 137 | tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); | |
| 138 | draw_sprites(screen->machine, bitmap,cliprect, 0); | |
| 139 | draw_sprites(screen->machine, bitmap,cliprect, 3); | |
| 140 | if(!(sengokmj_layer_en & 8)) | |
| 141 | tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); | |
| 137 | if(!(sengokmj_layer_en & 1)) { tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); } | |
| 138 | if(!(sengokmj_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 2); } | |
| 139 | if(!(sengokmj_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 1); } | |
| 140 | if(!(sengokmj_layer_en & 2)) { tilemap_draw(bitmap,cliprect,md_tilemap,0,0); } | |
| 141 | if(!(sengokmj_layer_en & 4)) { tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); } | |
| 142 | if(!(sengokmj_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 0); } | |
| 143 | if(!(sengokmj_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 3); } | |
| 144 | if(!(sengokmj_layer_en & 8)) { tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); } | |
| 142 | 145 | |
| 143 | 146 | // popmessage("%04x",sengokmj_layer_en); |
| 144 | 147 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 77 | 77 | K052109_tilemap_update(); |
| 78 | 78 | |
| 79 | 79 | tilemap_draw(bitmap,cliprect,K052109_tilemap[1],TILEMAP_DRAW_OPAQUE,0); |
| 80 | K051960_sprites_draw(bitmap,cliprect,2,2); | |
| 80 | K051960_sprites_draw(screen->machine,bitmap,cliprect,2,2); | |
| 81 | 81 | tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,0); |
| 82 | K051960_sprites_draw(bitmap,cliprect,1,1); | |
| 82 | K051960_sprites_draw(screen->machine,bitmap,cliprect,1,1); | |
| 83 | 83 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,0); |
| 84 | K051960_sprites_draw(bitmap,cliprect,0,0); | |
| 84 | K051960_sprites_draw(screen->machine,bitmap,cliprect,0,0); | |
| 85 | 85 | return 0; |
| 86 | 86 | } |
| r4135 | r4136 | |
|---|---|---|
| 71 | 71 | bitmap_fill(priority_bitmap,cliprect,0); |
| 72 | 72 | bitmap_fill(bitmap,cliprect,16 * bg_colorbase); |
| 73 | 73 | K051316_zoom_draw_0(bitmap,cliprect,0,1); |
| 74 | K053245_sprites_draw(0,bitmap,cliprect); | |
| 74 | K053245_sprites_draw(screen->machine,0,bitmap,cliprect); | |
| 75 | 75 | return 0; |
| 76 | 76 | } |
| r4135 | r4136 | |
|---|---|---|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | /* draw the scanline */ |
| 346 | draw_scanline16(bitmap, cliprect->min_x, y, cliprect->max_x - cliprect->min_x + 1, &scanline[cliprect->min_x], NULL | |
| 346 | draw_scanline16(bitmap, cliprect->min_x, y, cliprect->max_x - cliprect->min_x + 1, &scanline[cliprect->min_x], NULL | |
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 |
| r4135 | r4136 | |
|---|---|---|
| 137 | 137 | cliprect,TRANSPARENCY_PEN,0); |
| 138 | 138 | } else { |
| 139 | 139 | /* get a pointer to the current sprite's gfx data */ |
| 140 | UINT8 *gfx_src = gfx | |
| 140 | const UINT8 *gfx_src = gfx_element_get_data | |
| 141 | 141 | |
| 142 | 142 | for (py = 0; py < gfx->height; py++){ |
| 143 | 143 | /* get a pointer to the current line in the screen bitmap */ |
| r4135 | r4136 | |
|---|---|---|
| 218 | 218 | |
| 219 | 219 | /* draw background opaquely first, not setting any priorities */ |
| 220 | 220 | segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0 | TILEMAP_DRAW_OPAQUE, 0x00); |
| 221 | { | |
| 222 | int x,y; | |
| 223 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 224 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 225 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("0: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 226 | } | |
| 227 | 221 | segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1 | TILEMAP_DRAW_OPAQUE, 0x00); |
| 228 | { | |
| 229 | int x,y; | |
| 230 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 231 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 232 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("1: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 233 | } | |
| 234 | 222 | if (vdp_enable && vdplayer == 0) draw_vdp(bitmap, cliprect, vdppri); |
| 235 | { | |
| 236 | int x,y; | |
| 237 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 238 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 239 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("2: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 240 | } | |
| 241 | 223 | |
| 242 | 224 | /* draw background again to draw non-transparent pixels over the VDP and set the priority */ |
| 243 | 225 | segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); |
| 244 | { | |
| 245 | int x,y; | |
| 246 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 247 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 248 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("3: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 249 | } | |
| 250 | 226 | segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); |
| 251 | { | |
| 252 | int x,y; | |
| 253 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 254 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 255 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("4: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 256 | } | |
| 257 | 227 | if (vdp_enable && vdplayer == 1) draw_vdp(bitmap, cliprect, vdppri); |
| 258 | { | |
| 259 | int x,y; | |
| 260 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 261 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 262 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("5: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 263 | } | |
| 264 | 228 | |
| 265 | 229 | /* draw foreground */ |
| 266 | 230 | segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); |
| 267 | { | |
| 268 | int x,y; | |
| 269 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 270 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 271 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("6: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 272 | } | |
| 273 | 231 | segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); |
| 274 | { | |
| 275 | int x,y; | |
| 276 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 277 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 278 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("7: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 279 | } | |
| 280 | 232 | if (vdp_enable && vdplayer == 2) draw_vdp(bitmap, cliprect, vdppri); |
| 281 | { | |
| 282 | int x,y; | |
| 283 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 284 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 285 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("8: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 286 | } | |
| 287 | 233 | |
| 288 | 234 | /* text layer */ |
| 289 | 235 | segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); |
| 290 | { | |
| 291 | int x,y; | |
| 292 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 293 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 294 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("9: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 295 | } | |
| 296 | 236 | segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); |
| 297 | { | |
| 298 | int x,y; | |
| 299 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 300 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 301 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("A: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 302 | } | |
| 303 | 237 | if (vdp_enable && vdplayer == 3) draw_vdp(bitmap, cliprect, vdppri); |
| 304 | { | |
| 305 | int x,y; | |
| 306 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 307 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 308 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("B: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 309 | } | |
| 310 | 238 | |
| 311 | 239 | /* draw the sprites */ |
| 312 | 240 | segaic16_sprites_draw(screen, bitmap, cliprect, 0); |
| 313 | { | |
| 314 | int x,y; | |
| 315 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) | |
| 316 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) | |
| 317 | if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("C: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x)); | |
| 318 | } | |
| 319 | 241 | |
| 320 | 242 | #if DEBUG_VDP |
| 321 | 243 | if (vdp_enable && input_code_pressed(KEYCODE_V)) |
| r4135 | r4136 | |
|---|---|---|
| 79 | 79 | K052109_vh_start(machine,"gfx1",NORMAL_PLANE_ORDER,tile_callback); |
| 80 | 80 | K051960_vh_start(machine,"gfx2",NORMAL_PLANE_ORDER,sprite_callback); |
| 81 | 81 | K051316_vh_start_0(machine,"gfx3",7,FALSE,0,zoom_callback); |
| 82 | state_save_register_global(machine, ajax_priority); | |
| 82 | 83 | } |
| 83 | 84 | |
| 84 | 85 | |
| r4135 | r4136 | |
| 111 | 112 | } |
| 112 | 113 | tilemap_draw(bitmap,cliprect,K052109_tilemap[0],0,8); |
| 113 | 114 | |
| 114 | K051960_sprites_draw(bitmap,cliprect,-1,-1); | |
| 115 | K051960_sprites_draw(screen->machine,bitmap,cliprect,-1,-1); | |
| 115 | 116 | return 0; |
| 116 | 117 | } |
| r4135 | r4136 | |
|---|---|---|
| 69 | 69 | if (state->chargen[offset] != data) |
| 70 | 70 | { |
| 71 | 71 | state->chargen[offset] = data; |
| 72 | /* not very effective ... dirty would be better */ | |
| 73 | decodechar(space->machine->gfx[0],offset >> 3,state->chargen); | |
| 72 | gfx_element_mark_dirty(space->machine->gfx[0],offset >> 3); | |
| 74 | 73 | } |
| 75 | 74 | } |
| 76 | 75 | |
| r4135 | r4136 | |
| 88 | 87 | |
| 89 | 88 | VIDEO_START( m10 ) |
| 90 | 89 | { |
| 91 | | |
| 90 | | |
| 92 | 91 | int i; |
| 93 | 92 | |
| 94 | 93 | for (i=0;i<32*8;i++) |
| r4135 | r4136 | |
| 99 | 98 | tilemap_set_scrolldx(tx_tilemap, 0, 62); |
| 100 | 99 | tilemap_set_scrolldy(tx_tilemap, 0, 0); |
| 101 | 100 | |
| 102 | back_gfx = allocgfx(machine, &backlayout); | |
| 103 | back_gfx->total_colors = 8; | |
| 101 | back_gfx = gfx_element_alloc(machine, &backlayout, state->chargen, 8, 0); | |
| 104 | 102 | |
| 105 | 103 | machine->gfx[1] = back_gfx; |
| 106 | 104 | return ; |
| r4135 | r4136 | |
| 110 | 108 | { |
| 111 | 109 | m10_state *state = machine->driver_data; |
| 112 | 110 | |
| 113 | machine->gfx[0] = allocgfx(machine, &charlayout); | |
| 114 | machine->gfx[0]->total_colors = 8; | |
| 111 | machine->gfx[0] = gfx_element_alloc(machine, &charlayout, state->chargen, 8, 0); | |
| 115 | 112 | |
| 116 | decodegfx(machine->gfx[0], state->chargen,0,256); | |
| 117 | ||
| 118 | 113 | tx_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan,8,8,32,32); |
| 119 | 114 | tilemap_set_scrolldx(tx_tilemap, 0, 116); |
| 120 | 115 | tilemap_set_scrolldy(tx_tilemap, 0, 0); |
| r4135 | r4136 | |
| 137 | 132 | |
| 138 | 133 | bitmap_fill(bitmap,cliprect,0); |
| 139 | 134 | |
| 140 | decodegfx(back_gfx, state->chargen,0,4); | |
| 141 | 135 | for (i=0;i<4;i++) |
| 142 | 136 | if (state->flip) |
| 143 | 137 | drawgfx(bitmap, back_gfx, i, color[i], 1, 1, 31*8 - xpos[i], 6, cliprect, 0, 0); |
| r4135 | r4136 | |
|---|---|---|
| 303 | 303 | case 0: |
| 304 | 304 | default: |
| 305 | 305 | return input_port_read(space->machine, portnames[offset]); |
| 306 | break; | |
| 307 | 306 | case 1: /* Mahjong games */ |
| 308 | 307 | if (offset) return mahjong_input_r(space, offset-1); |
| 309 | 308 | else return input_port_read(space->machine, "IN0"); |
| r4135 | r4136 | |
|---|---|---|
| 214 | 214 | case 0x10: /* IRQ ack. Value written doesn't matter */ |
| 215 | 215 | cpu_set_input_line(space->machine->cpu[0], mainCpuIsArm ? ARM_IRQ_LINE : 1, CLEAR_LINE); |
| 216 | 216 | return; |
| 217 | break; | |
| 218 | 217 | case 0x14: /* Prepare scanline interrupt */ |
| 219 | 218 | timer_adjust_oneshot(raster_irq_timer,video_screen_get_time_until_pos(space->machine->primary_screen, irq_ram[0x14/4], 0),0); |
| 220 | 219 | //logerror("prepare scanline to fire at %d (currently on %d)\n", irq_ram[0x14/4], video_screen_get_vpos(space->machine->primary_screen)); |
| 221 | 220 | return; |
| 222 | break; | |
| 223 | 221 | case 0x18: |
| 224 | 222 | case 0x1c: |
| 225 | 223 | case 0x20: |
| r4135 | r4136 | |
|---|---|---|
| 100 | 100 | data = input_port_read(space->machine, "P1") & input_port_read(space->machine, "P3"); |
| 101 | 101 | return(data<<8 | data); |
| 102 | 102 | } |
| 103 | break; | |
| 104 | 103 | |
| 105 | 104 | case 0x02/2: |
| 106 | 105 | if (input_port_read(space->machine, "DSW") & 0x20) |
| r4135 | r4136 | |
| 110 | 109 | data = input_port_read(space->machine, "P2") & input_port_read(space->machine, "P4"); |
| 111 | 110 | return(data<<8 | data); |
| 112 | 111 | } |
| 113 | break; | |
| 114 | 112 | |
| 115 | 113 | case 0x04/2: |
| 116 | 114 | /* |
| r4135 | r4136 | |
| 119 | 117 | bit9 : joysticks layout(auto detect???) |
| 120 | 118 | */ |
| 121 | 119 | return input_port_read(space->machine, "SYSTEM"); |
| 122 | break; | |
| 123 | 120 | |
| 124 | 121 | case 0x06/2: |
| 125 | 122 | if (ACCESSING_BITS_0_7) |
| r4135 | r4136 | |
| 133 | 130 | } |
| 134 | 131 | } |
| 135 | 132 | return((rng_sysreg[0x06/2] & 0xff00) | data); |
| 136 | break; | |
| 137 | 133 | } |
| 138 | 134 | |
| 139 | 135 | return(rng_sysreg[offset]); |
| r0 | r4136 | |
|---|---|---|
| 1 | /* Skill Fruit Bonus | |
| 2 | -- (unknown) encrypted CPU | |
| 3 | -- 16-bit (program appears interleaved) | |
| 4 | */ | |
| 5 | ||
| 6 | #include "driver.h" | |
| 7 | #include "cpu/m68000/m68000.h" | |
| 8 | #include "sound/okim6295.h" | |
| 9 | ||
| 10 | ||
| 11 | static ADDRESS_MAP_START( sfbonus_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 12 | AM_RANGE(0x000000, 0x07ffff) AM_ROM | |
| 13 | ADDRESS_MAP_END | |
| 14 | ||
| 15 | VIDEO_START(sfbonus) | |
| 16 | { | |
| 17 | ||
| 18 | } | |
| 19 | ||
| 20 | VIDEO_UPDATE(sfbonus) | |
| 21 | { | |
| 22 | return 0; | |
| 23 | } | |
| 24 | ||
| 25 | static INPUT_PORTS_START( sfbonus ) | |
| 26 | INPUT_PORTS_END | |
| 27 | ||
| 28 | static const gfx_layout sfbonus_layout = | |
| 29 | { | |
| 30 | 8,8, | |
| 31 | RGN_FRAC(1,1), | |
| 32 | 8, | |
| 33 | { 0,1,2,3,4,5,6,7 }, | |
| 34 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, | |
| 35 | { 0*64,1*64,2*64,3*64,4*64,5*64,6*64,7*64 }, | |
| 36 | 8*64 | |
| 37 | }; | |
| 38 | ||
| 39 | ||
| 40 | static GFXDECODE_START( sfbonus ) | |
| 41 | GFXDECODE_ENTRY( "gfx1", 0, sfbonus_layout, 0x0, 2 ) | |
| 42 | GFXDECODE_ENTRY( "gfx2", 0, sfbonus_layout, 0x0, 2 ) | |
| 43 | GFXDECODE_ENTRY( "gfx3", 0, sfbonus_layout, 0x0, 2 ) | |
| 44 | GFXDECODE_END | |
| 45 | ||
| 46 | ||
| 47 | static MACHINE_DRIVER_START( sfbonus ) | |
| 48 | MDRV_CPU_ADD("main", M68000, 16000000) // unknown CPU | |
| 49 | MDRV_CPU_PROGRAM_MAP(0,sfbonus_map) | |
| 50 | ||
| 51 | MDRV_GFXDECODE(sfbonus) | |
| 52 | ||
| 53 | MDRV_SCREEN_ADD("main", RASTER) | |
| 54 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 55 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 56 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 57 | MDRV_SCREEN_SIZE(64*8, 32*8) | |
| 58 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1) | |
| 59 | ||
| 60 | MDRV_PALETTE_LENGTH(0x100) | |
| 61 | ||
| 62 | MDRV_VIDEO_START(sfbonus) | |
| 63 | MDRV_VIDEO_UPDATE(sfbonus) | |
| 64 | ||
| 65 | // MDRV_SPEAKER_STANDARD_STEREO("left", "right") | |
| 66 | // MDRV_SOUND_ADD("oki", OKIM6295, 1000000) | |
| 67 | // MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified | |
| 68 | // MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.47) | |
| 69 | // MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.47) | |
| 70 | MACHINE_DRIVER_END | |
| 71 | ||
| 72 | ROM_START( sfbonus ) | |
| 73 | ROM_REGION( 0x80000, "main", 0 ) /* 68000 Code */ | |
| 74 | ROM_LOAD16_BYTE( "skfb16.bin", 0x00001, 0x40000, CRC(bfd53646) SHA1(bd58f8c6d5386649a6fc0f4bac46d1b6cd6248b1) ) | |
| 75 | ROM_LOAD16_BYTE( "skfb17.bin", 0x00000, 0x40000, CRC(e28ede82) SHA1(f320c4c9c30ec280ee2437d1ad4d2b6270580916) ) | |
| 76 | ||
| 77 | ROM_REGION( 0x040000, "oki", 0 ) /* Samples */ | |
| 78 | ROM_LOAD( "skfbrom2.bin", 0x00000, 0x20000, CRC(3823a36e) SHA1(4136e380b63546b9490033ad26d776f326eb9290) ) | |
| 79 | ||
| 80 | ROM_REGION( 0x100000, "gfx1", 0 ) | |
| 81 | ROM_LOAD16_BYTE( "skfbrom3.bin", 0x00000, 0x80000, CRC(36119517) SHA1(241bb256ab3ba595dcb0c81fd2e60ed35dd7c197) ) | |
| 82 | ROM_LOAD16_BYTE( "skfbrom4.bin", 0x00001, 0x80000, CRC(a655bac1) SHA1(0faea01c09409f9182f08370dcc0b466a799f17f) ) | |
| 83 | ||
| 84 | ROM_REGION( 0x100000, "gfx2", 0 ) | |
| 85 | ROM_LOAD16_BYTE( "skfbrom5.bin", 0x00000, 0x80000, CRC(752e6e3b) SHA1(46c3a1bbbf1a2afe36fa5333b6e74459e17e9bae) ) | |
| 86 | ROM_LOAD16_BYTE( "skfbrom6.bin", 0x00001, 0x80000, CRC(30df6b6a) SHA1(7a180fa8ee64b9efb0321baffad72f0a9485d568) ) | |
| 87 | ||
| 88 | ROM_REGION( 0x100000, "gfx3", 0 ) | |
| 89 | // these are the same as gfx 2 up to a point, after which they change | |
| 90 | // maybe different tiles for odd / even tilemap columns, like cps1.c | |
| 91 | ROM_LOAD16_BYTE( "skfbrom5a.bin", 0x00000, 0x80000, CRC(ed07a635) SHA1(a31ee06d8cb78c43affa9d899e9cec87a0875934) ) | |
| 92 | ROM_LOAD16_BYTE( "skfbrom6a.bin", 0x00001, 0x80000, CRC(b9a39e5a) SHA1(cb875db25d8bccf48542bd6dbecc474b1205563b) ) | |
| 93 | ROM_END | |
| 94 | ||
| 95 | GAME( 199?, sfbonus, 0, sfbonus, sfbonus, 0, ROT0, "Amcoe", "Skill Fruit Bonus", GAME_NOT_WORKING|GAME_NO_SOUND ) |
| r4135 | r4136 | |
|---|---|---|
| 115 | 115 | memory_set_bankptr(space->machine, 1,rom + (data & 0x03) * 0x8000); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | static MACHINE_START( aerofgt ) | |
| 119 | { | |
| 120 | state_save_register_global(machine, pending_command); | |
| 121 | } | |
| 122 | ||
| 118 | 123 | static MACHINE_RESET( aerofgt ) |
| 119 | 124 | { |
| 120 | 125 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| r4135 | r4136 | |
| 1296 | 1301 | MDRV_CPU_IO_MAP(turbofrc_sound_portmap,0) |
| 1297 | 1302 | /* IRQs are triggered by the YM2610 */ |
| 1298 | 1303 | |
| 1304 | MDRV_MACHINE_START(aerofgt) | |
| 1299 | 1305 | MDRV_MACHINE_RESET(aerofgt) |
| 1300 | 1306 | |
| 1301 | 1307 | /* video hardware */ |
| r4135 | r4136 | |
| 1422 | 1428 | MDRV_CPU_IO_MAP(turbofrc_sound_portmap,0) |
| 1423 | 1429 | /* IRQs are triggered by the YM2610 */ |
| 1424 | 1430 | |
| 1431 | MDRV_MACHINE_START(aerofgt) | |
| 1425 | 1432 | MDRV_MACHINE_RESET(aerofgt) |
| 1426 | 1433 | |
| 1427 | 1434 | /* video hardware */ |
| r4135 | r4136 | |
| 1460 | 1467 | MDRV_CPU_IO_MAP(turbofrc_sound_portmap,0) |
| 1461 | 1468 | /* IRQs are triggered by the YM2610 */ |
| 1462 | 1469 | |
| 1470 | MDRV_MACHINE_START(aerofgt) | |
| 1463 | 1471 | MDRV_MACHINE_RESET(aerofgt) |
| 1464 | 1472 | |
| 1465 | 1473 | /* video hardware */ |
| r4135 | r4136 | |
| 1498 | 1506 | MDRV_CPU_IO_MAP(turbofrc_sound_portmap,0) |
| 1499 | 1507 | /* IRQs are triggered by the YM2610 */ |
| 1500 | 1508 | |
| 1509 | MDRV_MACHINE_START(aerofgt) | |
| 1501 | 1510 | MDRV_MACHINE_RESET(aerofgt) |
| 1502 | 1511 | |
| 1503 | 1512 | /* video hardware */ |
| r4135 | r4136 | |
| 1536 | 1545 | MDRV_CPU_IO_MAP(aerofgt_sound_portmap,0) |
| 1537 | 1546 | /* IRQs are triggered by the YM2610 */ |
| 1538 | 1547 | |
| 1548 | MDRV_MACHINE_START(aerofgt) | |
| 1539 | 1549 | MDRV_MACHINE_RESET(aerofgt) |
| 1540 | 1550 | |
| 1541 | 1551 | /* video hardware */ |
| r4135 | r4136 | |
| 1575 | 1585 | MDRV_CPU_IO_MAP(aerofgt_sound_portmap,0) |
| 1576 | 1586 | /* IRQs are triggered by the YM2610 */ |
| 1577 | 1587 | |
| 1588 | MDRV_MACHINE_START(aerofgt) | |
| 1578 | 1589 | MDRV_MACHINE_RESET(aerofgt) |
| 1579 | 1590 | |
| 1580 | 1591 | /* video hardware */ |
| r4135 | r4136 | |
| 1674 | 1685 | MDRV_CPU_PROGRAM_MAP(wbbc97_sound_map,0) |
| 1675 | 1686 | /* IRQs are triggered by the YM3812 */ |
| 1676 | 1687 | |
| 1688 | MDRV_MACHINE_START(aerofgt) | |
| 1689 | ||
| 1677 | 1690 | /* video hardware */ |
| 1678 | 1691 | MDRV_SCREEN_ADD("main", RASTER) |
| 1679 | 1692 | MDRV_SCREEN_REFRESH_RATE(60) |
| r4135 | r4136 | |
| 2407 | 2420 | ROM_END |
| 2408 | 2421 | |
| 2409 | 2422 | |
| 2410 | GAME( 1990, spinlbrk, 0, spinlbrk, spinlbrk, 0, ROT0, "V-System Co.", "Spinal Breakers (World)", GAME_NO_COCKTAIL ) | |
| 2411 | GAME( 1990, spinlbru, spinlbrk, spinlbrk, spinlbru, 0, ROT0, "V-System Co.", "Spinal Breakers (US)", GAME_NO_COCKTAIL ) | |
| 2412 | GAME( 1990, spinlbrj, spinlbrk, spinlbrk, spinlbrk, 0, ROT0, "V-System Co.", "Spinal Breakers (Japan)", GAME_NO_COCKTAIL ) | |
| 2413 | GAME( 1991, pspikes, 0, pspikes, pspikes, 0, ROT0, "Video System Co.", "Power Spikes (World)", GAME_NO_COCKTAIL ) | |
| 2414 | GAME( 1991, pspikesk, pspikes, pspikes, pspikes, 0, ROT0, "Video System Co.", "Power Spikes (Korea)", GAME_NO_COCKTAIL ) | |
| 2415 | GAME( 1991, svolly91, pspikes, pspikes, pspikes, 0, ROT0, "Video System Co.", "Super Volley '91 (Japan)", GAME_NO_COCKTAIL ) | |
| 2416 | GAME( 1991, pspikesb, pspikes, pspikesb, pspikesb, 0, ROT0, "bootleg", "Power Spikes (bootleg)", GAME_NO_COCKTAIL ) | |
| 2417 | GAME( 1991, spikes91, pspikes, spikes91, pspikes, 0, ROT0, "bootleg", "1991 Spikes (Italian bootleg)", GAME_NO_SOUND | GAME_NO_COCKTAIL ) | |
| 2418 | GAME( 1991, pspikesc, pspikes, pspikesc, pspikesc, 0, ROT0, "bootleg", "Power Spikes (China)", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND ) | |
| 2419 | GAME( 1991, karatblz, 0, karatblz, karatblz, 0, ROT0, "Video System Co.", "Karate Blazers (World)", GAME_NO_COCKTAIL ) | |
| 2420 | GAME( 1991, karatblu, karatblz, karatblz, karatblz, 0, ROT0, "Video System Co.", "Karate Blazers (US)", GAME_NO_COCKTAIL ) | |
| 2421 | GAME( 1991, karatblj, karatblz, karatblz, karatblz, 0, ROT0, "Video System Co.", "Karate Blazers (Japan)", GAME_NO_COCKTAIL ) | |
| 2422 | GAME( 1991, turbofrc, 0, turbofrc, turbofrc, 0, ROT270, "Video System Co.", "Turbo Force", GAME_NO_COCKTAIL ) | |
| 2423 | GAME( 1992, aerofgt, 0, aerofgt, aerofgt, 0, ROT270, "Video System Co.", "Aero Fighters", GAME_NO_COCKTAIL ) | |
| 2424 | GAME( 1992, aerofgtb, aerofgt, aerofgtb, aerofgtb, 0, ROT270, "Video System Co.", "Aero Fighters (Turbo Force hardware set 1)", GAME_NO_COCKTAIL ) | |
| 2425 | GAME( 1992, aerofgtc, aerofgt, aerofgtb, aerofgtb, 0, ROT270, "Video System Co.", "Aero Fighters (Turbo Force hardware set 2)", GAME_NO_COCKTAIL ) | |
| 2426 | GAME( 1992, sonicwi, aerofgt, aerofgtb, aerofgtb, 0, ROT270, "Video System Co.", "Sonic Wings (Japan)", GAME_NO_COCKTAIL ) | |
| 2427 | GAME( 1992, aerfboot, aerofgt, aerfboot, aerofgtb, 0, ROT270, "bootleg", "Aero Fighters (bootleg set 1)", GAME_NO_COCKTAIL | GAME_NO_SOUND ) | |
| 2428 | GAME( 1992, aerfboo2, aerofgt, aerfboo2, aerofgtb, 0, ROT270, "bootleg", "Aero Fighters (bootleg set 2)", GAME_NO_COCKTAIL | GAME_NO_SOUND ) | |
| 2429 | GAME( 1997, wbbc97, 0, wbbc97, wbbc97, 0, ROT0, "Comad", "Beach Festival World Championship 1997", GAME_NO_COCKTAIL ) | |
| 2423 | GAME( 1990, spinlbrk, 0, spinlbrk, spinlbrk, 0, ROT0, "V-System Co.", "Spinal Breakers (World)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2424 | GAME( 1990, spinlbru, spinlbrk, spinlbrk, spinlbru, 0, ROT0, "V-System Co.", "Spinal Breakers (US)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2425 | GAME( 1990, spinlbrj, spinlbrk, spinlbrk, spinlbrk, 0, ROT0, "V-System Co.", "Spinal Breakers (Japan)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2426 | GAME( 1991, pspikes, 0, pspikes, pspikes, 0, ROT0, "Video System Co.", "Power Spikes (World)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2427 | GAME( 1991, pspikesk, pspikes, pspikes, pspikes, 0, ROT0, "Video System Co.", "Power Spikes (Korea)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2428 | GAME( 1991, svolly91, pspikes, pspikes, pspikes, 0, ROT0, "Video System Co.", "Super Volley '91 (Japan)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2429 | GAME( 1991, pspikesb, pspikes, pspikesb, pspikesb, 0, ROT0, "bootleg", "Power Spikes (bootleg)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2430 | GAME( 1991, spikes91, pspikes, spikes91, pspikes, 0, ROT0, "bootleg", "1991 Spikes (Italian bootleg)", GAME_SUPPORTS_SAVE | GAME_NO_SOUND | GAME_NO_COCKTAIL ) | |
| 2431 | GAME( 1991, pspikesc, pspikes, pspikesc, pspikesc, 0, ROT0, "bootleg", "Power Spikes (China)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND ) | |
| 2432 | GAME( 1991, karatblz, 0, karatblz, karatblz, 0, ROT0, "Video System Co.", "Karate Blazers (World)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2433 | GAME( 1991, karatblu, karatblz, karatblz, karatblz, 0, ROT0, "Video System Co.", "Karate Blazers (US)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2434 | GAME( 1991, karatblj, karatblz, karatblz, karatblz, 0, ROT0, "Video System Co.", "Karate Blazers (Japan)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2435 | GAME( 1991, turbofrc, 0, turbofrc, turbofrc, 0, ROT270, "Video System Co.", "Turbo Force", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2436 | GAME( 1992, aerofgt, 0, aerofgt, aerofgt, 0, ROT270, "Video System Co.", "Aero Fighters", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2437 | GAME( 1992, aerofgtb, aerofgt, aerofgtb, aerofgtb, 0, ROT270, "Video System Co.", "Aero Fighters (Turbo Force hardware set 1)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2438 | GAME( 1992, aerofgtc, aerofgt, aerofgtb, aerofgtb, 0, ROT270, "Video System Co.", "Aero Fighters (Turbo Force hardware set 2)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2439 | GAME( 1992, sonicwi, aerofgt, aerofgtb, aerofgtb, 0, ROT270, "Video System Co.", "Sonic Wings (Japan)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 2440 | GAME( 1992, aerfboot, aerofgt, aerfboot, aerofgtb, 0, ROT270, "bootleg", "Aero Fighters (bootleg set 1)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL | GAME_NO_SOUND ) | |
| 2441 | GAME( 1992, aerfboo2, aerofgt, aerfboo2, aerofgtb, 0, ROT270, "bootleg", "Aero Fighters (bootleg set 2)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL | GAME_NO_SOUND ) | |
| 2442 | GAME( 1997, wbbc97, 0, wbbc97, wbbc97, 0, ROT0, "Comad", "Beach Festival World Championship 1997", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) |
| r4135 | r4136 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | x | |
| 3 | 3 | Coinmaster trivia games |
| 4 | 4 | |
| 5 | 5 | preliminary driver by Pierpaolo Prazzoli |
| 6 | 6 | |
| 7 | 7 | TODO: |
| 8 | - finish video emulation (colors, missing banking bits) | |
| 9 | - where is palette ? | |
| 8 | - is there extra colour info in attr3 for suprnudge 2 and pokeroul? | |
| 9 | - is there colour intensity control? | |
| 10 | 10 | - finish inputs |
| 11 | 11 | - finish question roms reading |
| 12 | 12 | - hook up all the PIAs |
| r4135 | r4136 | |
| 29 | 29 | #include "sound/ay8910.h" |
| 30 | 30 | |
| 31 | 31 | |
| 32 | static UINT8 *attr_ram1, *attr_ram2; | |
| 32 | static UINT8 *attr_ram1, *attr_ram2, *attr_ram3; | |
| 33 | 33 | static tilemap *bg_tilemap; |
| 34 | 34 | |
| 35 | 35 | static UINT8 question_adr[4]; |
| r4135 | r4136 | |
| 42 | 42 | tilemap_mark_tile_dirty(bg_tilemap,offset - 0x0240); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | ||
| 46 | static void coinmstr_set_pal(running_machine *machine, UINT32 paldat, int col) | |
| 47 | { | |
| 48 | col = col *4; | |
| 49 | ||
| 50 | { | |
| 51 | int r0, r1, r2, r3; | |
| 52 | int g0, g1, g2, g3; | |
| 53 | int b0, b1, b2, b3; | |
| 54 | ||
| 55 | r0 = (paldat & 0x1000) >> 12 ; | |
| 56 | g0 = (paldat & 0x0800) >> 11 ; | |
| 57 | b0 = (paldat & 0x0400) >> 10 ; | |
| 58 | r1 = (paldat & 0x0200) >> 9 ; | |
| 59 | g1 = (paldat & 0x0100) >> 8 ; | |
| 60 | b1 = (paldat & 0x0080) >> 7 ; | |
| 61 | ||
| 62 | r2 = (paldat & 0x0020) >> 5 ; | |
| 63 | g2 = (paldat & 0x0010) >> 4 ; | |
| 64 | b2 = (paldat & 0x0008) >> 3 ; | |
| 65 | r3 = (paldat & 0x0004) >> 2 ; | |
| 66 | g3 = (paldat & 0x0002) >> 1 ; | |
| 67 | b3 = (paldat & 0x0001) >> 0 ; | |
| 68 | ||
| 69 | ||
| 70 | palette_set_color_rgb(machine, col+0, (b0 * 255) << 5, (g0 * 255) << 5, (r0 * 255) << 5); | |
| 71 | palette_set_color_rgb(machine, col+2, (b1 * 255) << 5, (g1 * 255) << 5, (r1 * 255) << 5); | |
| 72 | palette_set_color_rgb(machine, col+1, (b2 * 255) << 5, (g2 * 255) << 5, (r2 * 255) << 5); | |
| 73 | palette_set_color_rgb(machine, col+3, (b3 * 255) << 5, (g3 * 255) << 5, (r3 * 255) << 5); | |
| 74 | ||
| 75 | } | |
| 76 | } | |
| 77 | ||
| 78 | ||
| 45 | 79 | static WRITE8_HANDLER( quizmstr_attr1_w ) |
| 46 | 80 | { |
| 47 | 81 | attr_ram1[offset] = data; |
| 48 | 82 | |
| 49 | 83 | if(offset >= 0x0240) |
| 50 | tilemap_mark_tile_dirty(bg_tilemap,offset - 0x0240); | |
| 84 | { | |
| 85 | // the later games also use attr3 for something.. | |
| 86 | UINT32 paldata = (attr_ram1[offset] & 0x7f) | ((attr_ram2[offset] & 0x7f) << 7); | |
| 87 | tilemap_mark_tile_dirty(bg_tilemap, offset - 0x0240); | |
| 88 | ||
| 89 | coinmstr_set_pal(space->machine, paldata, offset - 0x240); | |
| 90 | ||
| 91 | } | |
| 51 | 92 | } |
| 52 | 93 | |
| 53 | 94 | static WRITE8_HANDLER( quizmstr_attr2_w ) |
| r4135 | r4136 | |
| 55 | 96 | attr_ram2[offset] = data; |
| 56 | 97 | |
| 57 | 98 | if(offset >= 0x0240) |
| 58 | tilemap_mark_tile_dirty(bg_tilemap,offset - 0x0240); | |
| 99 | { | |
| 100 | // the later games also use attr3 for something.. | |
| 101 | UINT32 paldata = (attr_ram1[offset] & 0x7f) | ((attr_ram2[offset] & 0x7f) << 7); | |
| 102 | tilemap_mark_tile_dirty(bg_tilemap, offset - 0x0240); | |
| 103 | ||
| 104 | coinmstr_set_pal(space->machine, paldata, offset - 0x240); | |
| 105 | ||
| 106 | } | |
| 59 | 107 | } |
| 60 | 108 | |
| 109 | static WRITE8_HANDLER( quizmstr_attr3_w ) | |
| 110 | { | |
| 111 | attr_ram3[offset] = data; | |
| 112 | ||
| 113 | if(offset >= 0x0240) | |
| 114 | tilemap_mark_tile_dirty(bg_tilemap, offset - 0x0240); | |
| 115 | ||
| 116 | } | |
| 117 | ||
| 118 | ||
| 61 | 119 | static READ8_HANDLER( question_r ) |
| 62 | 120 | { |
| 63 | 121 | int address; |
| r4135 | r4136 | |
| 116 | 174 | question_adr[offset] = data; |
| 117 | 175 | } |
| 118 | 176 | |
| 177 | static READ8_HANDLER( ff_r ) | |
| 178 | { | |
| 179 | return 0xff; | |
| 180 | } | |
| 181 | ||
| 119 | 182 | // Common memory map |
| 120 | 183 | |
| 121 | 184 | static ADDRESS_MAP_START( coinmstr_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 122 | 185 | AM_RANGE(0x0000, 0xbfff) AM_ROM |
| 123 | AM_RANGE(0xc000, 0xdfff) AM_RAM | |
| 186 | AM_RANGE(0xc000, 0xdfff) AM_RAM | |
| 124 | 187 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(quizmstr_bg_w) AM_BASE(&videoram) |
| 125 | 188 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(quizmstr_attr1_w) AM_BASE(&attr_ram1) |
| 126 | 189 | AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(quizmstr_attr2_w) AM_BASE(&attr_ram2) |
| 127 | AM_RANGE(0xf800, 0xffff) AM_RAM | |
| 190 | AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(qu | |
| 128 | 191 | ADDRESS_MAP_END |
| 129 | 192 | |
| 130 | 193 | // Different I/O mappping for every game |
| r4135 | r4136 | |
| 182 | 245 | AM_RANGE(0xc0, 0xc3) AM_WRITENOP |
| 183 | 246 | ADDRESS_MAP_END |
| 184 | 247 | |
| 248 | static ADDRESS_MAP_START( pokeroul_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 249 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 250 | AM_RANGE(0x40, 0x40) AM_DEVWRITE(H46505, "crtc", mc6845_address_w) | |
| 251 | AM_RANGE(0x41, 0x41) AM_DEVWRITE(H46505, "crtc", mc6845_register_w) | |
| 252 | AM_RANGE(0x48, 0x48) AM_WRITE(ay8910_control_port_0_w) | |
| 253 | AM_RANGE(0x49, 0x49) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w) | |
| 254 | AM_RANGE(0x58, 0x5b) AM_READWRITE(pia_0_r, pia_0_w) /* confirmed */ | |
| 255 | AM_RANGE(0x68, 0x6b) AM_READWRITE(pia_1_r, pia_1_w) /* confirmed */ | |
| 256 | AM_RANGE(0x78, 0x7b) AM_READWRITE(pia_2_r, pia_2_w) /* confirmed */ | |
| 257 | AM_RANGE(0xc0, 0xc1) AM_READ(ff_r) /* needed to boot */ | |
| 258 | ADDRESS_MAP_END | |
| 259 | ||
| 260 | ||
| 185 | 261 | static INPUT_PORTS_START( quizmstr ) |
| 186 | 262 | PORT_START("IN0") |
| 187 | 263 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r4135 | r4136 | |
| 508 | 584 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 509 | 585 | INPUT_PORTS_END |
| 510 | 586 | |
| 587 | static INPUT_PORTS_START( pokeroul ) | |
| 588 | PORT_START("IN0") | |
| 589 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Cancel / Collect") PORT_CODE(KEYCODE_N) | |
| 590 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 1 & 5 (auto?)") PORT_CODE(KEYCODE_Z) | |
| 591 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Hold 2 / Bet / Half Gamble / Previous Hand") PORT_CODE(KEYCODE_X) | |
| 592 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Deal / Draw / Gamble") PORT_CODE(KEYCODE_1) | |
| 593 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Auto Hold") PORT_CODE(KEYCODE_M) | |
| 594 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Short Term Meters") PORT_TOGGLE PORT_CODE(KEYCODE_0) | |
| 595 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Refill Mode") PORT_TOGGLE PORT_CODE(KEYCODE_9) | |
| 596 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-8") PORT_CODE(KEYCODE_S) | |
| 597 | ||
| 598 | PORT_START("IN1") | |
| 599 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE (2) | |
| 600 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE (2) | |
| 601 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 602 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 603 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 604 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 605 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 606 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 607 | ||
| 608 | PORT_START("IN2") | |
| 609 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 610 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 611 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 612 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 613 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 614 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 615 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 616 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 617 | ||
| 618 | PORT_START("IN3") | |
| 619 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 620 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 621 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 622 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 623 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 624 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 625 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 626 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 627 | ||
| 628 | PORT_START("DSW1") | |
| 629 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 630 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 631 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 632 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 633 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 634 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 635 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 636 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 637 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 638 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 639 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 640 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 641 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 642 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 643 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 644 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 645 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 646 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 647 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 648 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 649 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 650 | PORT_DIPNAME( 0x80, 0x80, "Factory Install Switch" ) | |
| 651 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 652 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 653 | INPUT_PORTS_END | |
| 654 | ||
| 511 | 655 | static const gfx_layout charlayout = |
| 512 | 656 | { |
| 513 | 657 | 8,8, |
| r4135 | r4136 | |
| 523 | 667 | GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 32 ) |
| 524 | 668 | GFXDECODE_END |
| 525 | 669 | |
| 670 | ||
| 526 | 671 | static TILE_GET_INFO( get_bg_tile_info ) |
| 527 | 672 | { |
| 528 | 673 | int tile = videoram[tile_index + 0x0240]; |
| 529 | int color = | |
| 674 | int color = tile_index; | |
| 530 | 675 | |
| 531 | 676 | tile |= (attr_ram1[tile_index + 0x0240] & 0x80) << 1; |
| 532 | 677 | tile |= (attr_ram2[tile_index + 0x0240] & 0x80) << 2; |
| 533 | 678 | |
| 534 | SET_TILE_INFO(0,tile,color,0); | |
| 679 | tile |= (attr_ram3[tile_index + 0x0240] & 0x03) << (6+4); | |
| 680 | ||
| 681 | SET_TILE_INFO(0, tile, color, 0); | |
| 535 | 682 | } |
| 536 | 683 | |
| 537 | 684 | static VIDEO_START( coinmstr ) |
| 538 | 685 | { |
| 539 | bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows, 8, 8, 46, | |
| 686 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 46, 32); | |
| 540 | 687 | } |
| 541 | 688 | |
| 542 | 689 | static VIDEO_UPDATE( coinmstr ) |
| 543 | 690 | { |
| 544 | tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); | |
| 691 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 545 | 692 | return 0; |
| 546 | 693 | } |
| 547 | 694 | |
| r4135 | r4136 | |
| 596 | 743 | /*irqs : A/B */ 0, 0 |
| 597 | 744 | }; |
| 598 | 745 | |
| 746 | ||
| 747 | /* PIA 0 */ | |
| 748 | static const pia6821_interface pokeroul_pia_0_intf = | |
| 749 | { | |
| 750 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_0_r, 0, 0, 0, 0, 0, | |
| 751 | /*outputs: A/B,CA/B2 */ 0, 0, 0, 0, | |
| 752 | /*irqs : A/B */ 0, 0 | |
| 753 | }; | |
| 754 | ||
| 755 | /* PIA 1 */ | |
| 756 | static const pia6821_interface pokeroul_pia_1_intf = | |
| 757 | { | |
| 758 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_1_r, input_port_2_r, 0, 0, 0, 0, | |
| 759 | /*outputs: A/B,CA/B2 */ 0, 0, 0, 0, | |
| 760 | /*irqs : A/B */ 0, 0 | |
| 761 | }; | |
| 762 | ||
| 763 | /* PIA 2 */ | |
| 764 | static const pia6821_interface pokeroul_pia_2_intf = | |
| 765 | { | |
| 766 | /*inputs : A/B,CA/B1,CA/B2 */ input_port_3_r, 0, 0, 0, 0, 0, | |
| 767 | /*outputs: A/B,CA/B2 */ 0, 0, 0, 0, | |
| 768 | /*irqs : A/B */ 0, 0 | |
| 769 | }; | |
| 770 | ||
| 771 | ||
| 599 | 772 | static MACHINE_START( quizmstr ) |
| 600 | 773 | { |
| 601 | 774 | pia_config(machine, 0, &quizmstr_pia_0_intf); |
| r4135 | r4136 | |
| 620 | 793 | pia_reset(); |
| 621 | 794 | } |
| 622 | 795 | |
| 796 | static MACHINE_START( pokeroul ) | |
| 797 | { | |
| 798 | pia_config(machine, 0, &pokeroul_pia_0_intf); | |
| 799 | pia_config(machine, 1, &pokeroul_pia_1_intf); | |
| 800 | pia_config(machine, 2, &pokeroul_pia_2_intf); | |
| 801 | } | |
| 802 | ||
| 803 | static MACHINE_RESET( pokeroul ) | |
| 804 | { | |
| 805 | pia_reset(); | |
| 806 | } | |
| 807 | ||
| 623 | 808 | static const ay8910_interface ay8912_interface = |
| 624 | 809 | { |
| 625 | 810 | AY8910_LEGACY_OUTPUT, |
| r4135 | r4136 | |
| 657 | 842 | MDRV_SCREEN_VISIBLE_AREA(0*8, 46*8-1, 0*8, 32*8-1) |
| 658 | 843 | |
| 659 | 844 | MDRV_GFXDECODE(coinmstr) |
| 660 | MDRV_PALETTE_LENGTH( | |
| 845 | MDRV_PALETTE_LENGTH(4 | |
| 661 | 846 | |
| 662 | 847 | MDRV_VIDEO_START(coinmstr) |
| 663 | 848 | MDRV_VIDEO_UPDATE(coinmstr) |
| r4135 | r4136 | |
| 699 | 884 | MDRV_MACHINE_RESET(quizmstr) |
| 700 | 885 | MACHINE_DRIVER_END |
| 701 | 886 | |
| 887 | static MACHINE_DRIVER_START( pokeroul ) | |
| 888 | MDRV_IMPORT_FROM(coinmstr) | |
| 889 | MDRV_CPU_MODIFY("cpu") | |
| 890 | MDRV_CPU_IO_MAP(pokeroul_io_map,0) | |
| 891 | ||
| 892 | MDRV_MACHINE_START(pokeroul) | |
| 893 | MDRV_MACHINE_RESET(pokeroul) | |
| 894 | MACHINE_DRIVER_END | |
| 895 | ||
| 702 | 896 | /* |
| 703 | 897 | |
| 704 | 898 | Quizmaster |
| r4135 | r4136 | |
| 796 | 990 | ROM_LOAD( "u4.bin", 0x8000, 0x8000, CRC(0551e859) SHA1(b71640097cc75b78f3013f0e77de328bf1a205b1) ) |
| 797 | 991 | |
| 798 | 992 | ROM_REGION( 0x10000, "gfx1", ROMREGION_DISPOSE ) |
| 799 | ROM_LOAD( "u23.bin", 0x0000, 0x8000, CRC(726a48ac) SHA1(cd17840067294812edf5bfa88d71fc967388df8e) ) | |
| 800 | ROM_LOAD( "u25.bin", 0x8000, 0x8000, CRC(1f7cef5e) SHA1(3abc31d400a0f5dc29c70d8aac42fd6302290cc9) ) | |
| 993 | ROM_LOAD( "u25.bin", 0x0000, 0x8000, CRC(1f7cef5e) SHA1(3abc31d400a0f5dc29c70d8aac42fd6302290cc9) ) | |
| 994 | ROM_LOAD( "u23.bin", 0x8000, 0x8000, CRC(726a48ac) SHA1(cd17840067294812edf5bfa88d71fc967388df8e) ) | |
| 801 | 995 | |
| 802 | 996 | ROM_REGION( 0xa0000, "user1", 0 ) /* Question roms */ |
| 803 | 997 | ROM_LOAD( "q1.bin", 0x00000, 0x8000, CRC(245d679a) SHA1(2d3fbed8c1b3d0bffe7f3bd9088e0a5d207654c7) ) |
| r4135 | r4136 | |
| 822 | 1016 | ROM_LOAD( "q20.bin", 0x98000, 0x8000, CRC(0845b450) SHA1(c373839ee1ad983e2df41cb22f625c14972372b0) ) |
| 823 | 1017 | ROM_END |
| 824 | 1018 | |
| 1019 | /* | |
| 1020 | ||
| 1021 | Poker Roulette (c) 1990 Coinmaster | |
| 1022 | ||
| 1023 | ||
| 1024 | Hardware notes: | |
| 1025 | ||
| 1026 | CPU: 1x z80 | |
| 1027 | RAM: 2x 6264 | |
| 1028 | I/O: 3x 6821 PIAs | |
| 1029 | CRTC: 1x 6845 | |
| 1030 | SND: 1x ay-3-8912 | |
| 1031 | Xtal: 1x 14MHz. | |
| 1032 | ||
| 1033 | ||
| 1034 | Dev notes: | |
| 1035 | ||
| 1036 | 2x gfx banks, switched by bit4 of attr RAM. | |
| 1037 | ||
| 1038 | */ | |
| 1039 | ||
| 1040 | ROM_START( pokeroul ) | |
| 1041 | ROM_REGION( 0x10000, "cpu", 0 ) | |
| 1042 | ROM_LOAD( "poker1.ic3", 0x0000, 0x8000, CRC(bfe78d09) SHA1(7cc0f57714ff808a41ce20027a283e5dff60f752) ) | |
| 1043 | ROM_LOAD( "poker2.ic4", 0x8000, 0x8000, CRC(34c1b55c) SHA1(fa562d230a57dce3fff176c21c86b461a02749f6) ) | |
| 1044 | ||
| 1045 | ROM_REGION( 0x10000, "gfx1", 0 ) | |
| 1046 | ROM_LOAD( "027c1.00_e14.7.88.ic25", 0x0000, 0x8000, CRC(719f9879) SHA1(122e2689a21a22713f938e3bf6cfb72c60fb9a16) ) | |
| 1047 | ROM_LOAD( "027c1.01_e14.7.88.ic23", 0x8000, 0x8000, CRC(71e5a2fc) SHA1(c28efcea1cf6c9872e70ff191932e3cdb5618917) ) | |
| 1048 | ROM_END | |
| 1049 | ||
| 1050 | ||
| 825 | 1051 | static DRIVER_INIT( coinmstr ) |
| 826 | 1052 | { |
| 827 | 1053 | UINT8 *rom = memory_region(machine, "user1"); |
| r4135 | r4136 | |
| 841 | 1067 | } |
| 842 | 1068 | |
| 843 | 1069 | |
| 844 | GAME( 1985, quizmstr, 0, quizmstr, quizmstr, coinmstr, ROT0, "Loewen Spielautomaten", "Quizmaster (German)", GAME_WRONG_COLORS | GAME_UNEMULATED_PROTECTION ) | |
| 845 | GAME( 1987, trailblz, 0, trailblz, trailblz, coinmstr, ROT0, "Coinmaster", "Trail Blazer", GAME_WRONG_COLORS | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) // or Trail Blazer 2 ? | |
| 846 | GAME( 1989, supnudg2, 0, supnudg2, supnudg2, coinmstr, ROT0, "Coinmaster", "Super Nudger II (Version 5.21)", GAME_WRONG_COLORS | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 1070 | GAME( 1985, quizmstr, 0, quizmstr, quizmstr, coinmstr, ROT0, "Loewen Spielautomaten", "Quizmaster (German)", GAME_UNEMULATED_PROTECTION ) | |
| 1071 | GAME( 1987, trailblz, 0, trailblz, trailblz, coinmstr, ROT0, "Coinmaster", "Trail Blazer", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) // or Trail Blazer 2 ? | |
| 1072 | GAME( 1989, supnudg2, 0, supnudg2, supnudg2, coinmstr, ROT0, "Coinmaster", "Super Nudger II (Version 5.21)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) | |
| 1073 | GAME( 1990, pokeroul, 0, pokeroul, pokeroul, 0, ROT0, "Coinmaster", "Poker Roulette (Version 8.22)", GAME_NOT_WORKING ) |
| r4135 | r4136 | |
|---|---|---|
| 107 | 107 | 0); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | VIDEO_START(spool99) | |
| 110 | static VIDEO_START(spool99) | |
| 111 | 111 | { |
| 112 | 112 | sc0_tilemap = tilemap_create(machine, get_spool99_tile_info,tilemap_scan_rows,8,8,64,32); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | VIDEO_UPDATE(spool99) | |
| 115 | static VIDEO_UPDATE(spool99) | |
| 116 | 116 | { |
| 117 | 117 | tilemap_draw(bitmap,cliprect,sc0_tilemap,0,0); |
| 118 | 118 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 361 | 361 | * |
| 362 | 362 | *************************************/ |
| 363 | 363 | |
| 364 | static MACHINE_START( arabian ) | |
| 365 | { | |
| 366 | state_save_register_global(machine, custom_cpu_reset); | |
| 367 | state_save_register_global(machine, custom_cpu_busy); | |
| 368 | } | |
| 369 | ||
| 364 | 370 | static MACHINE_DRIVER_START( arabian ) |
| 365 | 371 | |
| 366 | 372 | /* basic machine hardware */ |
| r4135 | r4136 | |
| 369 | 375 | MDRV_CPU_IO_MAP(main_io_map,0) |
| 370 | 376 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| 371 | 377 | |
| 378 | MDRV_MACHINE_START(arabian) | |
| 379 | ||
| 372 | 380 | /* video hardware */ |
| 373 | 381 | MDRV_SCREEN_ADD("main", RASTER) |
| 374 | 382 | MDRV_SCREEN_REFRESH_RATE(60) |
| r4135 | r4136 | |
| 449 | 457 | * |
| 450 | 458 | *************************************/ |
| 451 | 459 | |
| 452 | GAME( 1983, arabian, 0, arabian, arabian, arabian, ROT270, "Sun Electronics", "Arabian", 0 ) | |
| 453 | GAME( 1983, arabiana, arabian, arabian, arabiana, arabian, ROT270, "[Sun Electronics] (Atari license)", "Arabian (Atari)", 0 ) | |
| 460 | GAME( 1983, arabian, 0, arabian, arabian, arabian, ROT270, "Sun Electronics", "Arabian", GAME_SUPPORTS_SAVE ) | |
| 461 | GAME( 1983, arabiana, arabian, arabian, arabiana, arabian, ROT270, "[Sun Electronics] (Atari license)", "Arabian (Atari)", GAME_SUPPORTS_SAVE ) |
| r4135 | r4136 | |
|---|---|---|
| 332 | 332 | |
| 333 | 333 | static UINT32 *K037122_tile_ram[MAX_K037122_CHIPS]; |
| 334 | 334 | static UINT32 *K037122_char_ram[MAX_K037122_CHIPS]; |
| 335 | static UINT8 *K037122_dirty_map[MAX_K037122_CHIPS]; | |
| 336 | static int K037122_gfx_index[MAX_K037122_CHIPS], K037122_char_dirty[MAX_K037122_CHIPS]; | |
| 335 | static int K037122_gfx_index[MAX_K037122_CHIPS]; | |
| 337 | 336 | static tilemap *K037122_layer[MAX_K037122_CHIPS][2]; |
| 338 | 337 | static UINT32 *K037122_reg[MAX_K037122_CHIPS]; |
| 339 | 338 | |
| r4135 | r4136 | |
| 410 | 409 | SET_TILE_INFO(K037122_gfx_index[1], tile, color, flags); |
| 411 | 410 | } |
| 412 | 411 | |
| 413 | static STATE_POSTLOAD( K037122_postload ) | |
| 414 | { | |
| 415 | int chip = (FPTR)param; | |
| 416 | K037122_char_dirty[chip] = 1; | |
| 417 | memset(K037122_dirty_map[chip], 1, K037122_NUM_TILES); | |
| 418 | } | |
| 419 | ||
| 420 | 412 | static int K037122_vh_start(running_machine *machine, int chip) |
| 421 | 413 | { |
| 422 | 414 | for(K037122_gfx_index[chip] = 0; K037122_gfx_index[chip] < MAX_GFX_ELEMENTS; K037122_gfx_index[chip]++) |
| r4135 | r4136 | |
| 429 | 421 | |
| 430 | 422 | K037122_tile_ram[chip] = auto_malloc(0x20000); |
| 431 | 423 | |
| 432 | K037122_dirty_map[chip] = auto_malloc(K037122_NUM_TILES); | |
| 433 | ||
| 434 | 424 | K037122_reg[chip] = auto_malloc(0x400); |
| 435 | 425 | |
| 436 | 426 | if (chip == 0) |
| r4135 | r4136 | |
| 449 | 439 | |
| 450 | 440 | memset(K037122_char_ram[chip], 0, 0x200000); |
| 451 | 441 | memset(K037122_tile_ram[chip], 0, 0x20000); |
| 452 | memset(K037122_dirty_map[chip], 0, K037122_NUM_TILES); | |
| 453 | 442 | memset(K037122_reg[chip], 0, 0x400); |
| 454 | 443 | |
| 455 | machine->gfx[K037122_gfx_index[chip]] = allocgfx(machine, &K037122_char_layout); | |
| 456 | decodegfx(machine->gfx[K037122_gfx_index[chip]], (UINT8*)K037122_char_ram[chip], 0, machine->gfx[K037122_gfx_index[chip]]->total_elements); | |
| 444 | machine->gfx[K037122_gfx_index[chip]] = gfx_element_alloc(machine, &K037122_char_layout, (UINT8*)K037122_char_ram[chip], machine->config->total_colors / 16, 0); | |
| 457 | 445 | |
| 458 | machine->gfx[K037122_gfx_index[chip]]->total_colors = machine->config->total_colors / 16; | |
| 459 | ||
| 460 | 446 | state_save_register_item_pointer(machine, "K037122", NULL, chip, K037122_reg[chip], 0x400/sizeof(K037122_reg[chip][0])); |
| 461 | 447 | state_save_register_item_pointer(machine, "K037122", NULL, chip, K037122_char_ram[chip], 0x200000/sizeof(K037122_char_ram[chip][0])); |
| 462 | 448 | state_save_register_item_pointer(machine, "K037122", NULL, chip, K037122_tile_ram[chip], 0x20000/sizeof(K037122_tile_ram[chip][0])); |
| 463 | state_save_register_postload(machine, K037122_postload, (void *)(FPTR)chip); | |
| 464 | 449 | |
| 465 | 450 | return 0; |
| 466 | 451 | } |
| 467 | 452 | |
| 468 | static void K037122_tile_update(running_machine *machine, int chip) | |
| 469 | { | |
| 470 | if (K037122_char_dirty[chip]) | |
| 471 | { | |
| 472 | int i; | |
| 473 | for (i=0; i < K037122_NUM_TILES; i++) | |
| 474 | { | |
| 475 | if (K037122_dirty_map[chip][i]) | |
| 476 | { | |
| 477 | K037122_dirty_map[chip][i] = 0; | |
| 478 | decodechar(machine->gfx[K037122_gfx_index[chip]], i, (UINT8 *)K037122_char_ram[chip]); | |
| 479 | } | |
| 480 | } | |
| 481 | tilemap_mark_all_tiles_dirty(K037122_layer[chip][0]); | |
| 482 | tilemap_mark_all_tiles_dirty(K037122_layer[chip][1]); | |
| 483 | K037122_char_dirty[chip] = 0; | |
| 484 | } | |
| 485 | } | |
| 486 | ||
| 487 | 453 | static void K037122_tile_draw(running_machine *machine, int chip, bitmap_t *bitmap, const rectangle *cliprect) |
| 488 | 454 | { |
| 489 | 455 | const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen); |
| r4135 | r4136 | |
| 576 | 542 | addr = offset + (bank * (0x40000/4)); |
| 577 | 543 | |
| 578 | 544 | COMBINE_DATA(K037122_char_ram[chip] + addr); |
| 579 | K037122_dirty_map[chip][addr / 32] = 1; | |
| 580 | K037122_char_dirty[chip] = 1; | |
| 545 | gfx_element_mark_dirty(space->machine->gfx[K037122_gfx_index[chip]], addr / 32); | |
| 581 | 546 | } |
| 582 | 547 | |
| 583 | 548 | static READ32_HANDLER(K037122_reg_r) |
| r4135 | r4136 | |
| 629 | 594 | |
| 630 | 595 | voodoo_update(voodoo, bitmap, cliprect); |
| 631 | 596 | |
| 632 | K037122_tile_update(screen->machine, 0); | |
| 633 | 597 | K037122_tile_draw(screen->machine, 0, bitmap, cliprect); |
| 634 | 598 | |
| 635 | 599 | draw_7segment_led(bitmap, 3, 3, led_reg0); |
| r4135 | r4136 | |
| 645 | 609 | voodoo_update(voodoo, bitmap, cliprect); |
| 646 | 610 | |
| 647 | 611 | /* TODO: tilemaps per screen */ |
| 648 | K037122_tile_update(screen->machine, 0); | |
| 649 | 612 | K037122_tile_draw(screen->machine, 0, bitmap, cliprect); |
| 650 | 613 | } |
| 651 | 614 | else if (strcmp(screen->tag, "right") == 0) |
| r4135 | r4136 | |
| 654 | 617 | voodoo_update(voodoo, bitmap, cliprect); |
| 655 | 618 | |
| 656 | 619 | /* TODO: tilemaps per screen */ |
| 657 | K037122_tile_update(screen->machine, 1); | |
| 658 | 620 | K037122_tile_draw(screen->machine, 1, bitmap, cliprect); |
| 659 | 621 | } |
| 660 | 622 |
| r0 | r4136 | |
|---|---|---|
| 1 | /******************************************************************************************* | |
| 2 | ||
| 3 | 86 Lions (c) 1985 Aristocrat | |
| 4 | ||
| 5 | driver by Chris Hardy,Angelo Salese & Roberto Fresca | |
| 6 | ||
| 7 | ||
| 8 | NOTES: | |
| 9 | ||
| 10 | - 2 graphics ROMS by each R, G, B. | |
| 11 | - 6 bit buffer, goes to 2 resistors each to 3 transistors... 32 colors. | |
| 12 | - CRTC is using 4 pixels by memory address. | |
| 13 | - Xtal and crtc CLK are accurate. | |
| 14 | - Seems to be 1 DSW bank tied to VIA, and another to ay8910. | |
| 15 | ||
| 16 | TODO: | |
| 17 | - Understand inputs / via mapping properly; | |
| 18 | - Finish the mc6845 conversion; | |
| 19 | - Colors? This shoudn't use a color prom. | |
| 20 | ||
| 21 | *******************************************************************************************/ | |
| 22 | ||
| 23 | #define MAIN_CLOCK XTAL_12MHz /* guess */ | |
| 24 | ||
| 25 | #include "driver.h" | |
| 26 | #include "cpu/m6809/m6809.h" | |
| 27 | #include "video/mc6845.h" | |
| 28 | #include "sound/ay8910.h" | |
| 29 | #include "machine/6522via.h" | |
| 30 | ||
| 31 | static UINT8 *lions_vram; | |
| 32 | ||
| 33 | VIDEO_START(lions) | |
| 34 | { | |
| 35 | } | |
| 36 | ||
| 37 | VIDEO_UPDATE(lions) | |
| 38 | { | |
| 39 | const gfx_element *gfx = screen->machine->gfx[0]; | |
| 40 | int count = 0; | |
| 41 | ||
| 42 | int y,x; | |
| 43 | ||
| 44 | for (y=0;y<27;y++) | |
| 45 | { | |
| 46 | for (x=0;x<38;x++) | |
| 47 | { | |
| 48 | int tile = lions_vram[count+1]|lions_vram[count]<<8; | |
| 49 | tile&=0x1ff; | |
| 50 | //int colour = tile>>12; | |
| 51 | drawgfx(bitmap,gfx,tile,0,0,0,x*8,y*8,cliprect,TRANSPARENCY_NONE,0); | |
| 52 | ||
| 53 | count+=2; | |
| 54 | } | |
| 55 | } | |
| 56 | return 0; | |
| 57 | } | |
| 58 | ||
| 59 | ||
| 60 | /********************** | |
| 61 | * | |
| 62 | * End of Video Hardware | |
| 63 | * | |
| 64 | **********************/ | |
| 65 | ||
| 66 | static READ8_HANDLER( test_r ) | |
| 67 | { | |
| 68 | return mame_rand(space->machine); | |
| 69 | } | |
| 70 | ||
| 71 | ||
| 72 | static READ8_HANDLER(lions_via_r) | |
| 73 | { | |
| 74 | const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0"); | |
| 75 | return via_r(via_0, offset); | |
| 76 | } | |
| 77 | ||
| 78 | static WRITE8_HANDLER(lions_via_w) | |
| 79 | { | |
| 80 | const device_config *via_0 = device_list_find_by_tag(space->machine->config->devicelist, VIA6522, "via6522_0"); | |
| 81 | via_w(via_0, offset, data); | |
| 82 | } | |
| 83 | ||
| 84 | ||
| 85 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 86 | AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&lions_vram) | |
| 87 | AM_RANGE(0x0800, 0x0fff) AM_RAM | |
| 88 | AM_RANGE(0x1800, 0x1800) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w) | |
| 89 | AM_RANGE(0x1801, 0x1801) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w) | |
| 90 | AM_RANGE(0x5000, 0x500f) AM_READWRITE(lions_via_r, lions_via_w) | |
| 91 | AM_RANGE(0x5300, 0x5300) AM_READ(test_r)//AM_READ_PORT("IN0") | |
| 92 | AM_RANGE(0x5382, 0x5382) AM_WRITE(ay8910_write_port_0_w) | |
| 93 | AM_RANGE(0x5383, 0x5383) AM_WRITE(ay8910_control_port_0_w) | |
| 94 | AM_RANGE(0xe000, 0xffff) AM_ROM | |
| 95 | ADDRESS_MAP_END | |
| 96 | ||
| 97 | static INPUT_PORTS_START( lions ) | |
| 98 | ||
| 99 | PORT_START("IN0") | |
| 100 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-1") PORT_CODE(KEYCODE_1) | |
| 101 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-2") PORT_CODE(KEYCODE_2) | |
| 102 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-3") PORT_CODE(KEYCODE_3) | |
| 103 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-4") PORT_CODE(KEYCODE_4) | |
| 104 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-5") PORT_CODE(KEYCODE_5) | |
| 105 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-6") PORT_CODE(KEYCODE_6) | |
| 106 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-7") PORT_CODE(KEYCODE_7) | |
| 107 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-8") PORT_CODE(KEYCODE_8) | |
| 108 | ||
| 109 | PORT_START("IN1") | |
| 110 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-1") PORT_CODE(KEYCODE_Q) | |
| 111 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-2") PORT_CODE(KEYCODE_W) | |
| 112 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-3") PORT_CODE(KEYCODE_E) | |
| 113 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-4") PORT_CODE(KEYCODE_R) | |
| 114 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-5") PORT_CODE(KEYCODE_T) | |
| 115 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-6") PORT_CODE(KEYCODE_Y) | |
| 116 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-7") PORT_CODE(KEYCODE_U) | |
| 117 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-8") PORT_CODE(KEYCODE_I) | |
| 118 | ||
| 119 | PORT_START("IN2") | |
| 120 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-1") PORT_CODE(KEYCODE_A) | |
| 121 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-2") PORT_CODE(KEYCODE_S) | |
| 122 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-3") PORT_CODE(KEYCODE_D) | |
| 123 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-4") PORT_CODE(KEYCODE_F) | |
| 124 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-5") PORT_CODE(KEYCODE_G) | |
| 125 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-6") PORT_CODE(KEYCODE_H) | |
| 126 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-7") PORT_CODE(KEYCODE_J) | |
| 127 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0-8") PORT_CODE(KEYCODE_K) | |
| 128 | ||
| 129 | PORT_START("IN3") | |
| 130 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-1") PORT_CODE(KEYCODE_Z) | |
| 131 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-2") PORT_CODE(KEYCODE_X) | |
| 132 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-3") PORT_CODE(KEYCODE_C) | |
| 133 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-4") PORT_CODE(KEYCODE_V) | |
| 134 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-5") PORT_CODE(KEYCODE_B) | |
| 135 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-6") PORT_CODE(KEYCODE_N) | |
| 136 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-7") PORT_CODE(KEYCODE_M) | |
| 137 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1-8") PORT_CODE(KEYCODE_L) | |
| 138 | ||
| 139 | // PORT_START("DSW1") | |
| 140 | // PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 141 | // PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 142 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 143 | // PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 144 | // PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 145 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 146 | // PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 147 | // PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 148 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 149 | // PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 150 | // PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 151 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 152 | // PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 153 | // PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 154 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 155 | // PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 156 | // PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 157 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 158 | // PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 159 | // PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 160 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 161 | // PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 162 | // PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 163 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 164 | ||
| 165 | // PORT_START("DSW2") | |
| 166 | // PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 167 | // PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 168 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 169 | // PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 170 | // PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 171 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 172 | // PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 173 | // PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 174 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 175 | // PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 176 | // PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 177 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 178 | // PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 179 | // PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 180 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 181 | // PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 182 | // PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 183 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 184 | // PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 185 | // PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 186 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 187 | // PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 188 | // PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 189 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 190 | INPUT_PORTS_END | |
| 191 | ||
| 192 | ||
| 193 | static const gfx_layout layout8x8x3 = | |
| 194 | { | |
| 195 | 8,8, | |
| 196 | RGN_FRAC(1,3), | |
| 197 | 3, | |
| 198 | { | |
| 199 | RGN_FRAC(0,3), | |
| 200 | RGN_FRAC(1,3), | |
| 201 | RGN_FRAC(2,3), | |
| 202 | }, | |
| 203 | { STEP8(0,1) }, | |
| 204 | { STEP8(0,8) }, | |
| 205 | 8*8 | |
| 206 | }; | |
| 207 | ||
| 208 | static GFXDECODE_START( lions ) | |
| 209 | GFXDECODE_ENTRY( "gfx1", 0, layout8x8x3, 0, 1 ) | |
| 210 | GFXDECODE_ENTRY( "gfx2", 0, layout8x8x3, 0, 1 ) | |
| 211 | GFXDECODE_END | |
| 212 | ||
| 213 | static const ay8910_interface ay8910_config = | |
| 214 | { | |
| 215 | AY8910_LEGACY_OUTPUT, | |
| 216 | AY8910_DEFAULT_LOADS, | |
| 217 | input_port_2_r, /* DSW? */ | |
| 218 | input_port_3_r, /* DSW? */ | |
| 219 | NULL, | |
| 220 | NULL | |
| 221 | }; | |
| 222 | ||
| 223 | //static READ8_DEVICE_HANDLER( input_a ) | |
| 224 | //{ | |
| 225 | //return input_port_read(machine, "IN0"); | |
| 226 | // return mame_rand(device->machine); | |
| 227 | //return 0xff; | |
| 228 | //} | |
| 229 | ||
| 230 | //static READ8_DEVICE_HANDLER( input_b ) | |
| 231 | //{ | |
| 232 | //return input_port_read(machine, "IN1"); | |
| 233 | // return mame_rand(device->machine); | |
| 234 | //return 0xff; | |
| 235 | //} | |
| 236 | ||
| 237 | static READ8_DEVICE_HANDLER( input_ca1 ) | |
| 238 | { | |
| 239 | // return mame_rand(device->machine); | |
| 240 | return 0x00; | |
| 241 | } | |
| 242 | ||
| 243 | static READ8_DEVICE_HANDLER( input_cb1 ) | |
| 244 | { | |
| 245 | // return mame_rand(device->machine); | |
| 246 | return 0x00; | |
| 247 | } | |
| 248 | ||
| 249 | static READ8_DEVICE_HANDLER( input_ca2 ) | |
| 250 | { | |
| 251 | // return mame_rand(device->machine); | |
| 252 | ||
| 253 | return 0x00; | |
| 254 | } | |
| 255 | ||
| 256 | static READ8_DEVICE_HANDLER( input_cb2 ) | |
| 257 | { | |
| 258 | // return mame_rand(device->machine); | |
| 259 | ||
| 260 | return 0x00; | |
| 261 | } | |
| 262 | ||
| 263 | static WRITE8_DEVICE_HANDLER( output_a ) | |
| 264 | { | |
| 265 | popmessage("VIA outa: %02X", data); | |
| 266 | // ... | |
| 267 | } | |
| 268 | ||
| 269 | static WRITE8_DEVICE_HANDLER( output_b ) | |
| 270 | { | |
| 271 | popmessage("VIA outb: %02X", data); | |
| 272 | // ... | |
| 273 | } | |
| 274 | ||
| 275 | ||
| 276 | static WRITE8_DEVICE_HANDLER( output_ca1 ) | |
| 277 | { | |
| 278 | // ... | |
| 279 | } | |
| 280 | ||
| 281 | static WRITE8_DEVICE_HANDLER( output_cb1 ) | |
| 282 | { | |
| 283 | // ... | |
| 284 | } | |
| 285 | ||
| 286 | static WRITE8_DEVICE_HANDLER( output_ca2 ) | |
| 287 | { | |
| 288 | // ... | |
| 289 | } | |
| 290 | ||
| 291 | static WRITE8_DEVICE_HANDLER( output_cb2 ) | |
| 292 | { | |
| 293 | // ... | |
| 294 | } | |
| 295 | ||
| 296 | static void via_irq(const device_config *device, int state) | |
| 297 | { | |
| 298 | cpu_set_input_line(device->machine->cpu[0], M6809_FIRQ_LINE, state); | |
| 299 | } | |
| 300 | ||
| 301 | static const via6522_interface via_interface = | |
| 302 | { | |
| 303 | /*inputs : A/B */ DEVICE8_PORT("IN0"), DEVICE8_PORT("IN1"), | |
| 304 | /*inputs : CA/B1,CA/B2 */ input_ca1, input_cb1, input_ca2, input_cb2, | |
| 305 | /*outputs: A/B */ output_a, output_b, | |
| 306 | /*outputs: CA/B1,CA/B2 */ output_ca1, output_cb1, output_ca2, output_cb2, | |
| 307 | /*irq */ via_irq | |
| 308 | }; | |
| 309 | ||
| 310 | static INTERRUPT_GEN( lions_irq ) | |
| 311 | { | |
| 312 | } | |
| 313 | ||
| 314 | static const mc6845_interface mc6845_intf = | |
| 315 | { | |
| 316 | /* in fact is a mc6845 driving 4 pixels by memory address. | |
| 317 | that's why the big horizontal parameters */ | |
| 318 | ||
| 319 | "main", /* screen we are acting on */ | |
| 320 | 4, /* number of pixels per video memory address */ | |
| 321 | NULL, /* before pixel update callback */ | |
| 322 | NULL, /* row update callback */ | |
| 323 | NULL, /* after pixel update callback */ | |
| 324 | NULL, /* callback for display state changes */ | |
| 325 | NULL, /* HSYNC callback */ | |
| 326 | NULL /* VSYNC callback */ | |
| 327 | }; | |
| 328 | ||
| 329 | static MACHINE_DRIVER_START( lions ) | |
| 330 | /* basic machine hardware */ | |
| 331 | MDRV_CPU_ADD("main", M6809, MAIN_CLOCK/4) /* 3 MHz.(guess) */ | |
| 332 | MDRV_CPU_PROGRAM_MAP(readmem,0) | |
| 333 | MDRV_CPU_VBLANK_INT("main", lions_irq ) | |
| 334 | ||
| 335 | /* video hardware */ | |
| 336 | MDRV_SCREEN_ADD("main", RASTER) | |
| 337 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 338 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 339 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 340 | MDRV_SCREEN_SIZE(304, 256) | |
| 341 | MDRV_SCREEN_VISIBLE_AREA(0, 304-1, 0, 216-1) /* from the crtc registers... updated by crtc */ | |
| 342 | ||
| 343 | MDRV_GFXDECODE(lions) | |
| 344 | MDRV_PALETTE_LENGTH(8) | |
| 345 | ||
| 346 | MDRV_VIDEO_START(lions) | |
| 347 | MDRV_VIDEO_UPDATE(lions) | |
| 348 | ||
| 349 | MDRV_VIA6522_ADD("via6522_0", MAIN_CLOCK/12, via_interface) /* 1 MHz.(only 1 or 2 MHz.are valid) */ | |
| 350 | ||
| 351 | MDRV_MC6845_ADD("crtc", MC6845, MAIN_CLOCK/8, mc6845_intf) /* 1.5 MHz.(logical guess to get a decent 59.6374 Hz.) */ | |
| 352 | ||
| 353 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 354 | ||
| 355 | MDRV_SOUND_ADD("ay", AY8910, MAIN_CLOCK/8) /* 1.5 MHz.(guess) */ | |
| 356 | MDRV_SOUND_CONFIG(ay8910_config) | |
| 357 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) | |
| 358 | MACHINE_DRIVER_END | |
| 359 | ||
| 360 | ||
| 361 | ROM_START( 86lions ) | |
| 362 | ROM_REGION( 0x10000, "main", 0 ) | |
| 363 | ROM_LOAD( "lion_std.u9", 0xe000, 0x2000, CRC(994842b0) SHA1(72fc31c577ee70b07ce9a4f2e864fe113d32affe) ) | |
| 364 | ||
| 365 | ROM_REGION( 0x3000, "gfx1", 0 ) | |
| 366 | ROM_LOAD( "rd0.u13", 0x00000, 0x1000, CRC(38c57504) SHA1(cc3ac1df644abc4586fc9f0e88531ba146b86b48) ) | |
| 367 | ROM_LOAD( "gn0.u10", 0x01000, 0x1000, CRC(80dce6f4) SHA1(bf953eba9cb270297b0d0efffe15b926e94dfbe7) ) | |
| 368 | ROM_LOAD( "bl0.u8", 0x02000, 0x1000, CRC(00ef4724) SHA1(714fafd035e2befbb35c6d00df52845745e58a93) ) | |
| 369 | ||
| 370 | ROM_REGION( 0x3000, "gfx2", 0 ) | |
| 371 | ROM_LOAD( "rd1.u12", 0x00000, 0x1000, CRC(350dd017) SHA1(ba273d4231e7e4c44922898cf5a70e8b1d6e2f9d) ) | |
| 372 | ROM_LOAD( "gn1.u11", 0x01000, 0x1000, CRC(80dce6f4) SHA1(bf953eba9cb270297b0d0efffe15b926e94dfbe7) ) | |
| 373 | ROM_LOAD( "bl1.u9", 0x02000, 0x1000, CRC(675e164a) SHA1(99346ca70bfe673b31d71dc6b3bbc3b8f961e87f) ) | |
| 374 | ||
| 375 | // ROM_REGION( 0x20, "proms", 0 ) | |
| 376 | // ROM_LOAD( "prom.x", 0x00, 0x20, NO_DUMP ) | |
| 377 | ROM_END | |
| 378 | ||
| 379 | ||
| 380 | GAME( 1985, 86lions, 0, lions, lions, 0, ROT0, "Aristocrat", "86 Lions", GAME_WRONG_COLORS | GAME_NOT_WORKING ) |
| r4135 | r4136 | |
|---|---|---|
| 181 | 181 | static void draw_char(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const gfx_element *gfx, int ch, int att, int x, int y) |
| 182 | 182 | { |
| 183 | 183 | int i,j; |
| 184 | UINT8 *dp; | |
| 184 | const UINT8 *dp; | |
| 185 | 185 | int index = 0; |
| 186 | dp = gfx | |
| 186 | dp = gfx_element_get_data( | |
| 187 | 187 | |
| 188 | 188 | for (j=y; j < y+8; j++) |
| 189 | 189 | { |
| r4135 | r4136 | |
|---|---|---|
| 294 | 294 | ROM_LOAD( "14.bpr", 0x0300, 0x0100, CRC(622a8ce7) SHA1(6834f67874251f2ef3a33aec893311f5d10e496f) ) /* They don't look like color PROMs */ |
| 295 | 295 | ROM_END |
| 296 | 296 | |
| 297 | GAME( 1983, ambush, 0, ambush, ambush, 0, ROT0, "Nippon Amuse Co-Ltd", "Ambush", 0 ) | |
| 298 | GAME( 1983, ambushv, ambush, ambush, ambush, 0, ROT0, "Volt Elec co-ltd", "Ambush (Volt Elec co-ltd)", 0 ) | |
| 299 | GAME( 1983, ambusht, ambush, ambush, ambusht, 0, ROT0, "Tecfri", "Ambush (Tecfri)", 0 ) | |
| 297 | GAME( 1983, ambush, 0, ambush, ambush, 0, ROT0, "Nippon Amuse Co-Ltd", "Ambush", GAME_SUPPORTS_SAVE ) | |
| 298 | GAME( 1983, ambushv, ambush, ambush, ambush, 0, ROT0, "Volt Elec co-ltd", "Ambush (Volt Elec co-ltd)", GAME_SUPPORTS_SAVE ) | |
| 299 | GAME( 1983, ambusht, ambush, ambush, ambusht, 0, ROT0, "Tecfri", "Ambush (Tecfri)", GAME_SUPPORTS_SAVE ) |
| r4135 | r4136 | |
|---|---|---|
| 1050 | 1050 | AM_RANGE(0x8000, 0xffff) AM_ROMBANK(4) |
| 1051 | 1051 | ADDRESS_MAP_END |
| 1052 | 1052 | |
| 1053 | static READ8_HANDLER( flashrom_read ) | |
| 1053 | static READ8_DEVICE_HANDLER( flashrom_read ) | |
| 1054 | 1054 | { |
| 1055 | 1055 | logerror("Flash Read: %08X\n", offset); |
| 1056 | 1056 | if( offset < 0x100000 ) |
| r4135 | r4136 | |
| 1064 | 1064 | return 0; |
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | static WRITE8_HANDLER( flashrom_write ) | |
| 1067 | static WRITE8_DEVICE_HANDLER( flashrom_write ) | |
| 1068 | 1068 | { |
| 1069 | 1069 | logerror("Flash Write: %08X, %02X\n", offset, data); |
| 1070 | 1070 | if( offset < 0x100000 ) |
| r4135 | r4136 | |
|---|---|---|
| 195 | 195 | UINT32 *skns_palette_ram; |
| 196 | 196 | UINT32 *skns_pal_regs, *skns_v3_regs, *skns_spc_regs; |
| 197 | 197 | |
| 198 | UINT32 skns_v3t_dirty[0x4000]; // allocate this elsewhere? | |
| 199 | UINT32 skns_v3t_4bppdirty[0x8000]; // allocate this elsewhere? | |
| 200 | int skns_v3t_somedirty,skns_v3t_4bpp_somedirty; | |
| 201 | ||
| 202 | 198 | static UINT32 *skns_v3t_ram, *skns_main_ram, *skns_cache_ram; |
| 203 | 199 | |
| 204 | 200 | /* hit.c */ |
| r4135 | r4136 | |
| 755 | 751 | |
| 756 | 752 | COMBINE_DATA(&skns_v3t_ram[offset]); |
| 757 | 753 | |
| 758 | skns_v3t_dirty[offset/0x40] = 1; | |
| 759 | skns_v3t_somedirty = 1; | |
| 760 | skns_v3t_4bppdirty[offset/0x20] = 1; | |
| 761 | skns_v3t_4bpp_somedirty = 1; | |
| 754 | gfx_element_mark_dirty(space->machine->gfx[1], offset/0x40); | |
| 755 | gfx_element_mark_dirty(space->machine->gfx[3], offset/0x20); | |
| 762 | 756 | |
| 763 | 757 | data = skns_v3t_ram[offset]; |
| 764 | 758 | // i think we need to swap around to decode .. endian issues? |
| r4135 | r4136 | |
|---|---|---|
| 140 | 140 | MDRV_VIDEO_UPDATE(luckgrln) |
| 141 | 141 | MACHINE_DRIVER_END |
| 142 | 142 | |
| 143 | DRIVER_INIT( luckgrln ) | |
| 143 | static DRIVER_INIT( luckgrln ) | |
| 144 | 144 | { |
| 145 | 145 | int i; |
| 146 | 146 | UINT8 x,v; |
| r4135 | r4136 | |
|---|---|---|
| 665 | 665 | { |
| 666 | 666 | dynax_flipscreen_w(space,0,(data&2)?1:0); |
| 667 | 667 | } |
| 668 | static WRITE8_HANDLER( yarunara_flipscreen_inv_w ) | |
| 669 | { | |
| 670 | dynax_flipscreen_w(space,0,(data&2)?0:1); | |
| 671 | } | |
| 668 | 672 | |
| 669 | 673 | static WRITE8_HANDLER( yarunara_blit_romregion_w ) |
| 670 | 674 | { |
| r4135 | r4136 | |
| 1414 | 1418 | AM_RANGE( 0x10050, 0x10050 ) AM_WRITE( tenkai_priority_w ) // layer priority and enable |
| 1415 | 1419 | AM_RANGE( 0x10054, 0x10054 ) AM_WRITE( dynax_blit_backpen_w ) // Background Color |
| 1416 | 1420 | AM_RANGE( 0x10058, 0x10058 ) AM_WRITE( tenkai_blit_romregion_w ) // Blitter ROM bank |
| 1417 | AM_RANGE( 0x10060, 0x10060 ) AM_WRITE( yarunara_flipscreen_w | |
| 1421 | AM_RANGE( 0x10060, 0x10060 ) AM_WRITE( yarunara_flipscreen_inv_w | |
| 1418 | 1422 | AM_RANGE( 0x10064, 0x10064 ) AM_WRITE( yarunara_layer_half_w ) // half of the interleaved layer to write to |
| 1419 | 1423 | AM_RANGE( 0x10068, 0x10068 ) AM_WRITE( yarunara_layer_half2_w ) // |
| 1420 | 1424 | AM_RANGE( 0x1006c, 0x1006c ) AM_WRITE( tenkai_6c_w ) // ? |
| r4135 | r4136 | |
| 4166 | 4170 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 4167 | 4171 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 4168 | 4172 | MDRV_SCREEN_SIZE(512, 256) |
| 4169 | MDRV_SCREEN_VISIBLE_AREA( | |
| 4173 | MDRV_SCREEN_VISIBLE_AREA(4, 512-1, 4, 255-8-4) // hide first 4 horizontal pixels (see scroll of gal 4 in test mode) | |
| 4170 | 4174 | |
| 4171 | 4175 | MDRV_PALETTE_LENGTH(16*256) |
| 4172 | 4176 | |
| r4135 | r4136 | |
| 5685 | 5689 | // Note by Whistler: |
| 5686 | 5690 | // It appears that the first half of lzc-01.u6 in tenkaibb (as well as the same data in other bootleg versions) |
| 5687 | 5691 | // does not exist _anywhere_ in this rom dump, and in this way some girls won't show correctly (such as the 3rd one) |
| 5688 | ROM_REGION( 0x80000, "gfx1", 0 ) // blitter data | |
| 5689 | ROM_LOAD( "taicom01.15b", 0x000000, 0x80000, CRC(39e4e6f3) SHA1(5b543a5933446091d7cfd519d5a6f23047d8a9f2) ) | |
| 5692 | ROM_REGION( 0x100000, "gfx1", 0 ) // blitter data | |
| 5693 | ROM_LOAD( "tydg002.u8", 0x000000, 0x80000, NO_DUMP CRC(b0f08a20) SHA1(5f7083d5caadd77594eaf46efa11a8756cefcf7d) ) | |
| 5694 | ROM_LOAD( "taicom01.15b", 0x080000, 0x80000, CRC(39e4e6f3) SHA1(5b543a5933446091d7cfd519d5a6f23047d8a9f2) ) // either this was dumped half size, or the above rom was missing from the pcb | |
| 5690 | 5695 | |
| 5691 | 5696 | ROM_REGION( 0x100000, "gfx2", 0 ) // blitter data |
| 5692 | 5697 | ROM_LOAD( "taicom02.11b", 0x000000, 0x80000, CRC(aae8cfb7) SHA1(736c6148aa6e7b22ca19615a27e9a10d41778aa7) ) |
| r4135 | r4136 | |
| 5741 | 5746 | |
| 5742 | 5747 | ROM_START( tenkai2b ) |
| 5743 | 5748 | ROM_REGION( 0x50000, "main", 0 ) |
| 5749 | ROM_LOAD( "mc0.u11", 0x00000, 0x40000, CRC(8488a3ab) SHA1(f367a2dcc65410929db595b3c442d310d50a4940) ) | |
| 5750 | ROM_RELOAD( 0x10000, 0x40000 ) | |
| 5751 | // tenkai internal rom is incompatible with the code of this set | |
| 5744 | 5752 | ROM_LOAD( "tmp91p640n-10.5b", 0x00000, 0x04000, NO_DUMP ) |
| 5745 | ROM_LOAD( "mc0.u11", 0x10000, 0x40000, CRC(8488a3ab) SHA1(f367a2dcc65410929db595b3c442d310d50a4940) ) | |
| 5746 | 5753 | |
| 5747 | 5754 | ROM_REGION( 0x100000, "gfx1", 0 ) // blitter data |
| 5748 | 5755 | ROM_LOAD( "mc1.u8", 0x000000, 0x100000, CRC(786698e3) SHA1(9ddf4e31f454fb3c7969b1433771e95a976de741) ) |
| r4135 | r4136 | |
| 5873 | 5880 | ROM_REGION( 0x50000, "main", 0 ) |
| 5874 | 5881 | ROM_LOAD( "rom.u15", 0x00000, 0x40000, CRC(7b877721) SHA1(41bba10ffb3d72af84d6577d4785225fe1ecc640) ) |
| 5875 | 5882 | ROM_RELOAD( 0x10000, 0x40000 ) |
| 5883 | // it doesn't need the internal rom from tenkai | |
| 5876 | 5884 | |
| 5877 | 5885 | ROM_REGION( 0x100000, "gfx1", 0 ) // blitter data |
| 5878 | ROM_LOAD( "rom.u13", 0x00000, 0x80000, CRC(68cb730a) SHA1(7ce90e34fa51d50a7668ac1c5ccbc18bebe8ad84) ) | |
| 5879 | ROM_LOAD( "rom.u12", 0x80000, 0x80000, CRC(39e4e6f3) SHA1(5b543a5933446091d7cfd519d5a6f23047d8a9f2) ) | |
| 5886 | ROM_LOAD( "tydg002.u8", 0x00000, 0x80000, NO_DUMP CRC(b0f08a20) SHA1(5f7083d5caadd77594eaf46efa11a8756cefcf7d) ) | |
| 5887 | ROM_LOAD( "rom.u12", 0x80000, 0x80000, CRC(39e4e6f3) SHA1(5b543a5933446091d7cfd519d5a6f23047d8a9f2) ) | |
| 5880 | 5888 | |
| 5881 | ROM_REGION( 0x100000, "gfx2", ROMREGION_ERASEFF ) // blitter data | |
| 5882 | ||
| 5883 | ROM_LOAD( "rom.u13", 0x80000, 0x80000, CRC(68cb730a) SHA1(7ce90e34fa51d50a7668ac1c5ccbc18bebe8ad84) )//ok | |
| 5889 | ROM_REGION( 0x100000, "gfx2", 0 ) // blitter data | |
| 5890 | ROM_LOAD( "taicom02.11b", 0x00000, 0x80000, NO_DUMP CRC(aae8cfb7) SHA1(736c6148aa6e7b22ca19615a27e9a10d41778aa7) ) | |
| 5891 | ROM_LOAD( "rom.u13", 0x80000, 0x80000, CRC(68cb730a) SHA1(7ce90e34fa51d50a7668ac1c5ccbc18bebe8ad84) ) | |
| 5884 | 5892 | ROM_END |
| 5885 | 5893 | |
| 5886 | 5894 | /*************************************************************************** |
| r4135 | r4136 | |
| 5951 | 5959 | ***************************************************************************/ |
| 5952 | 5960 | |
| 5953 | 5961 | ROM_START( tenkaid ) |
| 5954 | ROM_REGION( 0x50000, "main", 0 ) | |
| 5962 | ROM_REGION( 0x90000, "main", 0 ) | |
| 5963 | ROM_LOAD( "tydg001.u11", 0x00000, 0x40000, CRC(4ffa543c) SHA1(ab6ec7bd735358643f5186c6c983fa8b599fe84b) ) | |
| 5964 | ROM_RELOAD( 0x10000, 0x40000 ) | |
| 5965 | ROM_RELOAD( 0x50000, 0x40000 ) | |
| 5966 | // tenkai internal rom is incompatible with the code of this set | |
| 5955 | 5967 | ROM_LOAD( "tmp91p640n-10.5b", 0x00000, 0x04000, NO_DUMP ) |
| 5956 | ROM_LOAD( "tydg001.u11", 0x10000, 0x40000, CRC(4ffa543c) SHA1(ab6ec7bd735358643f5186c6c983fa8b599fe84b) ) | |
| 5957 | 5968 | |
| 5958 | ROM_REGION( 0x200000, "gfx1", 0 ) // blitter data | |
| 5959 | ROM_LOAD( "tydg002.u8", 0x000000, 0x80000, CRC(b0f08a20) SHA1(5f7083d5caadd77594eaf46efa11a8756cefcf7d) ) | |
| 5960 | ROM_LOAD( "tydg005.u19", 0x080000, 0x80000, CRC(39e4e6f3) SHA1(5b543a5933446091d7cfd519d5a6f23047d8a9f2) ) | |
| 5961 | ROM_LOAD( "tydg003.u6", 0x100000, 0x80000, CRC(60717d91) SHA1(85dbb510d33b36d2255b740ccc4917216dd21497) ) | |
| 5962 | ROM_LOAD( "tydg004.u21", 0x180000, 0x80000, CRC(b7d49d04) SHA1(756c35bbe207b5bfc6e05d6da99a7ad5a3453506) ) | |
| 5969 | ROM_REGION( 0x100000, "gfx1", 0 ) // blitter data | |
| 5970 | ROM_LOAD( "tydg002.u8", 0x00000, 0x80000, CRC(b0f08a20) SHA1(5f7083d5caadd77594eaf46efa11a8756cefcf7d) ) | |
| 5971 | ROM_LOAD( "tydg003.u6", 0x80000, 0x80000, CRC(60717d91) SHA1(85dbb510d33b36d2255b740ccc4917216dd21497) ) | |
| 5972 | ||
| 5973 | ROM_REGION( 0x100000, "gfx2", 0 ) // blitter data | |
| 5974 | ROM_LOAD( "tydg004.u21", 0x00000, 0x80000, CRC(b7d49d04) SHA1(756c35bbe207b5bfc6e05d6da99a7ad5a3453506) ) | |
| 5975 | ROM_LOAD( "tydg005.u19", 0x80000, 0x80000, CRC(39e4e6f3) SHA1(5b543a5933446091d7cfd519d5a6f23047d8a9f2) ) | |
| 5963 | 5976 | ROM_END |
| 5964 | 5977 | |
| 5965 | 5978 | /*************************************************************************** |
| r4135 | r4136 | |
| 5979 | 5992 | |
| 5980 | 5993 | ROM_START( tenkaie ) |
| 5981 | 5994 | ROM_REGION( 0x50000, "main", 0 ) |
| 5982 | ROM_LOAD( "tmp91p640n-10.5b", 0x00000, 0x04000, NO_DUMP ) | |
| 5983 | ROM_LOAD( "epr-a01.rom", 0x10000, 0x40000, CRC(a35e54db) SHA1(247c856e19989fb834e8ed135393927bbd9c0277) ) | |
| 5995 | ROM_LOAD( "epr-a01.rom", 0x00000, 0x40000, CRC(a35e54db) SHA1(247c856e19989fb834e8ed135393927bbd9c0277) ) | |
| 5996 | ROM_RELOAD( 0x10000, 0x40000 ) | |
| 5997 | ROM_LOAD( "tmp91p640n-10.5b", 0x00000, 0x04000, NO_DUMP CRC(509f1c97) SHA1(08557bea2e924053fd5bc9de5e306f3ecf8e98e6) ) | |
| 5984 | 5998 | |
| 5985 | 5999 | ROM_REGION( 0x100000, "gfx1", 0 ) // blitter data |
| 5986 | 6000 | ROM_LOAD( "lzc-01.rom", 0x000000, 0x100000, CRC(786698e3) SHA1(9ddf4e31f454fb3c7969b1433771e95a976de741) ) |
| r4135 | r4136 | |
| 5989 | 6003 | ROM_LOAD( "lzc-02.rom", 0x000000, 0x100000, CRC(90a19443) SHA1(8f593c00e39dd5acc76b058591019d117967a17b) ) |
| 5990 | 6004 | ROM_END |
| 5991 | 6005 | |
| 6006 | ||
| 5992 | 6007 | /*************************************************************************** |
| 5993 | 6008 | |
| 5994 | 6009 | Mahjong Comic Gekijou Vol.1 |
| r4135 | r4136 | |
| 6242 | 6257 | GAME( 1990, neruton, 0, neruton, neruton, mjelct3, ROT180, "Dynax / Yukiyoshi Tokoro", "Mahjong Neruton Haikujiradan (Japan)", GAME_IMPERFECT_GRAPHICS ) |
| 6243 | 6258 | GAME( 1991, hanayara, 0, yarunara, hanayara, 0, ROT180, "Dynax", "Hana wo Yaraneba! (Japan)", 0 ) |
| 6244 | 6259 | GAME( 1991, mjcomv1, 0, yarunara, yarunara, 0, ROT180, "Dynax", "Mahjong Comic Gekijou Vol.1 (Japan)", 0 ) |
| 6245 | GAME( 1991, tenkai, 0, tenkai, tenkai, 0, ROT180, "Dynax", "Mahjong Tenkaigen", GAME_NOT_WORKING ) | |
| 6246 | GAME( 1991, tenkai2b, tenkai, tenkai, tenkai, 0, ROT180, "Dynax", "Mahjong Tenkaigen Part 2 (bootleg)", GAME_NOT_WORKING ) | |
| 6247 | GAME( 1991, tenkaibb, tenkai, tenkai, tenkai, 0, ROT180, "Dynax", "Mahjong Tenkaigen (bootleg b)", 0 ) | |
| 6248 | GAME( 1991, tenkaicb, tenkai, tenkai, tenkai, 0, ROT180, "Dynax", "Mahjong Tenkaigen (bootleg c)", GAME_NOT_WORKING ) | |
| 6249 | GAME( 1991, tenkaid, tenkai, tenkai, tenkai, 0, ROT180, "Dynax", "Mahjong Tenkaigen (set 1)", GAME_NOT_WORKING ) | |
| 6250 | GAME( 1991, tenkaie, tenkai, tenkai, tenkai, 0, ROT180, "Dynax", "Mahjong Tenkaigen (set 2)", GAME_NOT_WORKING ) | |
| 6260 | GAME( 1991, tenkai, 0, tenkai, tenkai, 0, ROT0, "Dynax", "Mahjong Tenkaigen", 0 ) | |
| 6261 | GAME( 1991, tenkai2b, tenkai, tenkai, tenkai, 0, ROT0, "Dynax", "Mahjong Tenkaigen Part 2 (bootleg)", GAME_NOT_WORKING ) | |
| 6262 | GAME( 1991, tenkaibb, tenkai, tenkai, tenkai, 0, ROT0, "Dynax", "Mahjong Tenkaigen (bootleg b)", 0 ) | |
| 6263 | GAME( 1991, tenkaicb, tenkai, tenkai, tenkai, 0, ROT0, "Dynax", "Mahjong Tenkaigen (bootleg c)", 0 ) | |
| 6264 | GAME( 1991, tenkaid, tenkai, tenkai, tenkai, 0, ROT0, "Dynax", "Mahjong Tenkaigen (set 1)", GAME_NOT_WORKING ) | |
| 6265 | GAME( 1991, tenkaie, tenkai, tenkai, tenkai, 0, ROT0, "Dynax", "Mahjong Tenkaigen (set 2)", 0 ) | |
| 6251 | 6266 | GAME( 1992, htengoku, 0, htengoku, htengoku, 0, ROT180, "Dynax", "Hanafuda Hana Tengoku (Japan)", 0 ) |
| 6252 | 6267 | GAME( 1994, mjreach, 0, tenkai, mjreach, mjreach, ROT0, "Dynax", "Mahjong Reach (bootleg)", 0 ) |
| 6253 | 6268 | GAME( 1995, shpeng, 0, sprtmtch, sprtmtch, 0, ROT0, "WSAC Systems?", "Sea Hunter Penguin", GAME_WRONG_COLORS ) // not a dynax board. proms? |
| r4135 | r4136 | |
|---|---|---|
| 1955 | 1955 | case 0x7f: // first drive check |
| 1956 | 1956 | case 0x1c: // second drive check (causes HDD detected) |
| 1957 | 1957 | return 1; // return error |
| 1958 | break; | |
| 1959 | 1958 | } |
| 1960 | 1959 | |
| 1961 | 1960 | return 4; // return OK |
| 1962 | break; | |
| 1963 | 1961 | } |
| 1964 | 1962 | |
| 1965 | 1963 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | |
| 124 | extern int suprnova_alt_enable_sprites; | |
| 125 | ||
| 126 | 124 | static VIDEO_START(galpani3) |
| 127 | 125 | { |
| 128 | 126 | /* so we can use suprnova.c */ |
| r4135 | r4136 | |
| 535 | 533 | |
| 536 | 534 | // might be blitter regs? - there are 3, probably GRAP2 chips |
| 537 | 535 | |
| 538 | READ16_HANDLER( galpani3_regs1_r ) | |
| 536 | static READ16_HANDLER( galpani3_regs1_r ) | |
| 539 | 537 | { |
| 540 | 538 | switch (offset) |
| 541 | 539 | { |
| r4135 | r4136 | |
| 560 | 558 | } |
| 561 | 559 | |
| 562 | 560 | |
| 563 | READ16_HANDLER( galpani3_regs2_r ) | |
| 561 | static READ16_HANDLER( galpani3_regs2_r ) | |
| 564 | 562 | { |
| 565 | 563 | switch (offset) |
| 566 | 564 | { |
| r4135 | r4136 | |
| 585 | 583 | } |
| 586 | 584 | |
| 587 | 585 | |
| 588 | READ16_HANDLER( galpani3_regs3_r ) | |
| 586 | static READ16_HANDLER( galpani3_regs3_r ) | |
| 589 | 587 | { |
| 590 | 588 | switch (offset) |
| 591 | 589 | { |
| r4135 | r4136 | |
| 610 | 608 | } |
| 611 | 609 | |
| 612 | 610 | |
| 613 | UINT16 galpani3_regs1_address_regs[0x20]; | |
| 614 | UINT16 galpani3_regs2_address_regs[0x20]; | |
| 615 | UINT16 galpani3_regs3_address_regs[0x20]; | |
| 611 | static UINT16 galpani3_regs1_address_regs[0x20]; | |
| 612 | static UINT16 galpani3_regs2_address_regs[0x20]; | |
| 613 | static UINT16 galpani3_regs3_address_regs[0x20]; | |
| 616 | 614 | |
| 617 | void gp3_do_rle(UINT32 address, UINT16*framebuffer, UINT8* rledata) | |
| 615 | static void gp3_do_rle(UINT32 address, UINT16*framebuffer, UINT8* rledata) | |
| 618 | 616 | { |
| 619 | 617 | int rle_count = 0; |
| 620 | 618 | int normal_count = 0; |
| r4135 | r4136 | |
| 664 | 662 | |
| 665 | 663 | } |
| 666 | 664 | |
| 667 | WRITE16_HANDLER( galpani3_regs1_address_w ) | |
| 665 | static WRITE16_HANDLER( galpani3_regs1_address_w ) | |
| 668 | 666 | { |
| 669 | 667 | logerror("galpani3_regs1_address_w %04x\n",data); |
| 670 | 668 | COMBINE_DATA(&galpani3_regs1_address_regs[offset]); |
| 671 | 669 | } |
| 672 | 670 | |
| 673 | WRITE16_HANDLER( galpani3_regs1_go_w ) | |
| 671 | static WRITE16_HANDLER( galpani3_regs1_go_w ) | |
| 674 | 672 | { |
| 675 | 673 | UINT32 address = galpani3_regs1_address_regs[1]| (galpani3_regs1_address_regs[0]<<16); |
| 676 | 674 | UINT8* rledata = memory_region(space->machine,"gfx2"); |
| r4135 | r4136 | |
| 680 | 678 | } |
| 681 | 679 | |
| 682 | 680 | |
| 683 | WRITE16_HANDLER( galpani3_regs2_address_w ) | |
| 681 | static WRITE16_HANDLER( galpani3_regs2_address_w ) | |
| 684 | 682 | { |
| 685 | 683 | logerror("galpani3_regs2_address_w %04x\n",data); |
| 686 | 684 | COMBINE_DATA(&galpani3_regs2_address_regs[offset]); |
| 687 | 685 | } |
| 688 | 686 | |
| 689 | WRITE16_HANDLER( galpani3_regs2_go_w ) | |
| 687 | static WRITE16_HANDLER( galpani3_regs2_go_w ) | |
| 690 | 688 | { |
| 691 | 689 | UINT32 address = galpani3_regs2_address_regs[1]| (galpani3_regs2_address_regs[0]<<16); |
| 692 | 690 | UINT8* rledata = memory_region(space->machine,"gfx2"); |
| r4135 | r4136 | |
| 700 | 698 | |
| 701 | 699 | |
| 702 | 700 | |
| 703 | WRITE16_HANDLER( galpani3_regs3_address_w ) | |
| 701 | static WRITE16_HANDLER( galpani3_regs3_address_w ) | |
| 704 | 702 | { |
| 705 | 703 | logerror("galpani3_regs3_address_w %04x\n",data); |
| 706 | 704 | COMBINE_DATA(&galpani3_regs3_address_regs[offset]); |
| 707 | 705 | } |
| 708 | 706 | |
| 709 | WRITE16_HANDLER( galpani3_regs3_go_w ) | |
| 707 | static WRITE16_HANDLER( galpani3_regs3_go_w ) | |
| 710 | 708 | { |
| 711 | 709 | UINT32 address = galpani3_regs3_address_regs[1]| (galpani3_regs3_address_regs[0]<<16); |
| 712 | 710 | UINT8* rledata = memory_region(space->machine,"gfx2"); |
| r4135 | r4136 | |
|---|---|---|
| 15 | 15 | MACHINE_DRIVER_EXTERN(megadpal); |
| 16 | 16 | MACHINE_DRIVER_EXTERN(megdsvp); |
| 17 | 17 | MACHINE_DRIVER_EXTERN( genesis_32x ); |
| 18 | MACHINE_DRIVER_EXTERN( genesis_32x_pal ); | |
| 18 | 19 | MACHINE_DRIVER_EXTERN( genesis_scd ); |
| 19 | 20 | MACHINE_DRIVER_EXTERN( genesis_32x_scd ); |
| 20 | 21 |
| r4135 | r4136 | |
|---|---|---|
| 24 | 24 | #include "driver.h" |
| 25 | 25 | #include "cpu/nec/nec.h" |
| 26 | 26 | #include "cpu/i86/i86.h" |
| 27 | #include "sound/okim6376.h" | |
| 27 | 28 | #include "fashion.lh" |
| 28 | 29 | |
| 29 | 30 | static UINT16 *blit_ram; |
| 30 | 31 | |
| 31 | VIDEO_START(brasil) | |
| 32 | static VIDEO_START(brasil) | |
| 32 | 33 | { |
| 33 | 34 | |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | VIDEO_UPDATE(brasil) | |
| 37 | static VIDEO_UPDATE(brasil) | |
| 37 | 38 | { |
| 38 | 39 | int x,y,count; |
| 39 | 40 | |
| r4135 | r4136 | |
| 63 | 64 | return 0; |
| 64 | 65 | } |
| 65 | 66 | |
| 66 | VIDEO_UPDATE(vidpokr2) | |
| 67 | static VIDEO_UPDATE(vidpokr2) | |
| 67 | 68 | { |
| 68 | 69 | int x,y,count; |
| 69 | 70 | |
| r4135 | r4136 | |
| 275 | 276 | |
| 276 | 277 | static WRITE16_HANDLER( write3_w ) |
| 277 | 278 | { |
| 278 | t3 = data; | |
| 279 | if (t3 != data) { | |
| 280 | t3 = data; | |
| 281 | okim6376_data_0_lsb_w(space, 0, t3, mem_mask); | |
| 282 | okim6376_data_0_lsb_w(space, 0, (1 << 4), mem_mask); | |
| 283 | } | |
| 279 | 284 | // popmessage("%04x %04x",t1,t3); |
| 280 | 285 | } |
| 281 | 286 | |
| r4135 | r4136 | |
| 588 | 593 | MDRV_VIDEO_START(brasil) |
| 589 | 594 | MDRV_VIDEO_UPDATE(brasil) |
| 590 | 595 | |
| 596 | /* sound hardware */ | |
| 597 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 598 | ||
| 591 | 599 | //OkiM6376 |
| 600 | MDRV_SOUND_ADD("samples", OKIM6376, XTAL_12MHz/2/2) | |
| 601 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 602 | ||
| 592 | 603 | MACHINE_DRIVER_END |
| 593 | 604 | |
| 594 | 605 | |
| r4135 | r4136 | |
| 610 | 621 | MDRV_VIDEO_START(brasil) |
| 611 | 622 | MDRV_VIDEO_UPDATE(vidpokr2) |
| 612 | 623 | |
| 624 | /* sound hardware */ | |
| 625 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 626 | ||
| 613 | 627 | //OkiM6376 |
| 628 | MDRV_SOUND_ADD("samples", OKIM6376, XTAL_12MHz/2/2) | |
| 629 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 630 | ||
| 614 | 631 | MACHINE_DRIVER_END |
| 615 | 632 | |
| 616 | 633 | /* |
| r4135 | r4136 | |
| 650 | 667 | ROM_COPY( "user1", 0x0c0000, 0x000000, 0x40000 ) |
| 651 | 668 | |
| 652 | 669 | ROM_REGION( 0x080000, "samples", 0 ) /* M6376 Samples */ |
| 653 | ROM_LOAD( "mc3 | |
| 670 | ROM_LOAD( "mc31.ic15", 0x00000, 0x40000, CRC(8 | |
| 654 | 671 | ROM_END |
| 655 | 672 | |
| 656 | 673 | /* |
| r4135 | r4136 | |
| 709 | 726 | memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0002, 0x0003, 0, 0, fashion_write2_w ); |
| 710 | 727 | } |
| 711 | 728 | |
| 712 | GAMEL( 19??, newmcard, 0, vidpokr2, brasil, 0, ROT0, "New High Video?", "New Magic Card", GAME_NO_SOUND, layout_fashion ) | |
| 713 | GAMEL( 2000, brasil, 0, brasil, brasil, 0, ROT0, "New High Video?", "Bra$il (Version 3)", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND, layout_fashion ) | |
| 714 | GAMEL( 2000, fashion, brasil, brasil, fashion, fashion, ROT0, "New High Video?", "Fashion (Version 2.14)", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND, layout_fashion ) | |
| 729 | GAMEL( 19??, newmcard, 0, vidpokr2, brasil, 0, ROT0, "New High Video?", "New Magic Card", 0, layout_fashion ) | |
| 730 | GAMEL( 2000, brasil, 0, brasil, brasil, 0, ROT0, "New High Video?", "Bra$il (Version 3)", GAME_IMPERFECT_GRAPHICS, layout_fashion ) | |
| 731 | GAMEL( 2000, fashion, brasil, brasil, fashion, fashion, ROT0, "New High Video?", "Fashion (Version 2.14)", GAME_IMPERFECT_GRAPHICS, layout_fashion ) |
| r4135 | r4136 | |
|---|---|---|
| 410 | 410 | { |
| 411 | 411 | /* Ports 0-3 are read, but seem unused */ |
| 412 | 412 | switch (dragngun_lightgun_port) { |
| 413 | case 4: return input_port_read(space->machine, "LIGHT0_X"); break; | |
| 414 | case 5: return input_port_read(space->machine, "LIGHT1_X"); break; | |
| 415 | case 6: return input_port_read(space->machine, "LIGHT0_Y"); break; | |
| 416 | case 7: return input_port_read(space->machine, "LIGHT1_Y"); break; | |
| 413 | case 4: return input_port_read(space->machine, "LIGHT0_X"); | |
| 414 | case 5: return input_port_read(space->machine, "LIGHT1_X"); | |
| 415 | case 6: return input_port_read(space->machine, "LIGHT0_Y"); | |
| 416 | case 7: return input_port_read(space->machine, "LIGHT1_Y"); | |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | // logerror("Illegal lightgun port %d read \n",dragngun_lightgun_port); |
| r4135 | r4136 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | ToDo: |
| 11 | BG Banking is wrong. | |
| 12 | 11 | Inputs are imperfect (missing dips) |
| 13 | Sprite glitches in intro | |
| 12 | Some sprite flickers on attract mode | |
| 13 | totmejan: Are the "dots" behind the girls in attract mode correct? | |
| 14 | 14 | |
| 15 | ||
| 16 | 15 | PCB Layout |
| 17 | 16 | |
| 18 | 17 | |---------------------------------------------------------------| |
| r4135 | r4136 | |
| 69 | 68 | WRITE16_HANDLER( goodejan_bg_scrollx_w ); |
| 70 | 69 | WRITE16_HANDLER( goodejan_bg_scrolly_w ); |
| 71 | 70 | WRITE16_HANDLER( goodejan_layer_en_w ); |
| 71 | WRITE16_HANDLER( goodejan_gfxbank_w ); | |
| 72 | 72 | |
| 73 | 73 | VIDEO_START( goodejan ); |
| 74 | 74 | VIDEO_UPDATE( goodejan ); |
| r4135 | r4136 | |
| 106 | 106 | ADDRESS_MAP_END |
| 107 | 107 | |
| 108 | 108 | /*totmejan CRT is at 8000-804f,goodejan is at 8040-807f(808f but not tested)*/ |
| 109 | static ADDRESS_MAP_START( goodejan_io_map, ADDRESS_SPACE_IO, 16 ) | |
| 110 | AM_RANGE(0x801c, 0x801d) AM_WRITE(goodejan_layer_en_w ) | |
| 111 | ||
| 112 | AM_RANGE(0x805c, 0x805d) AM_WRITE(goodejan_layer_en_w ) | |
| 113 | AM_RANGE(0x8060, 0x8061) AM_WRITE(goodejan_bg_scrollx_w ) | |
| 114 | AM_RANGE(0x8062, 0x8063) AM_WRITE(goodejan_bg_scrolly_w ) | |
| 115 | ||
| 109 | static ADDRESS_MAP_START( common_io_map, ADDRESS_SPACE_IO, 16 ) | |
| 110 | AM_RANGE(0x9000, 0x9001) AM_WRITE(goodejan_gfxbank_w) | |
| 111 | AM_RANGE(0x8020, 0x8023) AM_WRITENOP | |
| 112 | AM_RANGE(0xb000, 0xb003) AM_WRITENOP | |
| 116 | 113 | AM_RANGE(0xb004, 0xb005) AM_WRITE(mahjong_panel_w) |
| 117 | 114 | |
| 118 | 115 | AM_RANGE(0xc000, 0xc001) AM_READ_PORT("DSW1") |
| 119 | 116 | AM_RANGE(0xc002, 0xc003) AM_READ(mahjong_panel_r) |
| 120 | 117 | AM_RANGE(0xc004, 0xc005) AM_READ_PORT("DSW2") // maybe it's a seibu_main_word mirror? |
| 121 | // AM_RANGE(0xc004, 0xc005) AM_READ(random_reading) | |
| 122 | ||
| 123 | 118 | AM_RANGE(0xd000, 0xd00f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w) |
| 124 | 119 | ADDRESS_MAP_END |
| 125 | 120 | |
| 121 | static ADDRESS_MAP_START( totmejan_io_map, ADDRESS_SPACE_IO, 16 ) | |
| 122 | AM_RANGE(0x801c, 0x801d) AM_WRITE(goodejan_layer_en_w ) | |
| 123 | ADDRESS_MAP_END | |
| 124 | ||
| 125 | static ADDRESS_MAP_START( goodejan_io_map, ADDRESS_SPACE_IO, 16 ) | |
| 126 | AM_RANGE(0x805c, 0x805d) AM_WRITE(goodejan_layer_en_w ) | |
| 127 | AM_RANGE(0x8060, 0x8061) AM_WRITE(goodejan_bg_scrollx_w ) | |
| 128 | AM_RANGE(0x8062, 0x8063) AM_WRITE(goodejan_bg_scrolly_w ) | |
| 129 | ADDRESS_MAP_END | |
| 130 | ||
| 126 | 131 | static INPUT_PORTS_START( goodejan ) |
| 127 | 132 | SEIBU_COIN_INPUTS /* coin inputs read through sound cpu */ |
| 128 | 133 | |
| r4135 | r4136 | |
| 326 | 331 | /* basic machine hardware */ |
| 327 | 332 | MDRV_CPU_ADD("main", V30, GOODEJAN_MHZ2/2) |
| 328 | 333 | MDRV_CPU_PROGRAM_MAP(goodejan_map,0) |
| 329 | MDRV_CPU_IO_MAP(goodejan_io_map | |
| 334 | MDRV_CPU_IO_MAP(common_io_map,goodejan_io_map | |
| 330 | 335 | MDRV_CPU_VBLANK_INT_HACK(goodejan_interrupt,2) |
| 331 | 336 | |
| 332 | 337 | SEIBU_SOUND_SYSTEM_CPU(GOODEJAN_MHZ1/2) |
| r4135 | r4136 | |
| 351 | 356 | SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(GOODEJAN_MHZ1/2,GOODEJAN_MHZ2/16) |
| 352 | 357 | MACHINE_DRIVER_END |
| 353 | 358 | |
| 359 | static MACHINE_DRIVER_START( totmejan ) | |
| 360 | MDRV_IMPORT_FROM( goodejan ) | |
| 361 | MDRV_CPU_MODIFY("main") | |
| 362 | MDRV_CPU_IO_MAP(common_io_map,totmejan_io_map) | |
| 363 | MACHINE_DRIVER_END | |
| 364 | ||
| 354 | 365 | ROM_START( totmejan ) |
| 355 | 366 | ROM_REGION( 0x100000, "main", 0 ) /* V30 code */ |
| 356 | 367 | ROM_LOAD16_BYTE( "1.022", 0xc0000, 0x20000, CRC(63c3c54f) SHA1(3116b73b848a1f7391a47b994951ba1af92ba298) ) |
| r4135 | r4136 | |
| 393 | 404 | ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) ) |
| 394 | 405 | |
| 395 | 406 | ROM_REGION( 0x100000, "gfx2", ROMREGION_DISPOSE ) |
| 396 | ROM_LOAD( "e_jan2scr.064", 0x080000, 0x080000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) ) | |
| 397 | ROM_CONTINUE( 0x000000, 0x080000 ) | |
| 407 | ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) ) | |
| 398 | 408 | |
| 399 | 409 | ROM_REGION( 0x080000, "gfx3", ROMREGION_DISPOSE ) |
| 400 | 410 | ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) ) |
| r4135 | r4136 | |
| 421 | 431 | ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) ) |
| 422 | 432 | |
| 423 | 433 | ROM_REGION( 0x100000, "gfx2", ROMREGION_DISPOSE ) |
| 424 | ROM_LOAD( "e_jan2scr.064", 0x080000, 0x080000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) ) | |
| 425 | ROM_CONTINUE( 0x000000, 0x080000 ) | |
| 434 | ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) ) | |
| 426 | 435 | |
| 427 | 436 | ROM_REGION( 0x080000, "gfx3", ROMREGION_DISPOSE ) |
| 428 | 437 | ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) ) |
| r4135 | r4136 | |
| 434 | 443 | ROM_LOAD( "fmj08.083", 0x000, 0x100, CRC(9657b7ad) SHA1(e9b469c2b3534593f7fe0ea19cbbf93b55957e42) ) |
| 435 | 444 | ROM_END |
| 436 | 445 | |
| 437 | GAME( 1991, totmejan, 0, | |
| 446 | GAME( 1991, totmejan, 0, totmejan, goodejan, 0, ROT0, "Seibu (distributed by Tecmo)", "Tottemo E Jong", GAME_IMPERFECT_GRAPHICS ) | |
| 438 | 447 | GAME( 1991, goodejan, 0, goodejan, goodejan, 0, ROT0, "Seibu (distributed by Tecmo)", "Good E Jong -Kachinuki Mahjong Syoukin Oh!!- (set 1)", GAME_IMPERFECT_GRAPHICS ) |
| 439 | 448 | GAME( 1991, goodejaa, goodejan, goodejan, goodejan, 0, ROT0, "Seibu (distributed by Tecmo)", "Good E Jong -Kachinuki Mahjong Syoukin Oh!!- (set 2)", GAME_IMPERFECT_GRAPHICS ) |
| r4135 | r4136 | |
|---|---|---|
| 166 | 166 | */ |
| 167 | 167 | |
| 168 | 168 | #include "driver.h" |
| 169 | #include "streams.h" | |
| 169 | 170 | #include "cpu/rsp/rsp.h" |
| 170 | 171 | #include "cpu/mips/mips3.h" |
| 171 | #include "streams.h" | |
| 172 | 172 | #include "sound/custom.h" |
| 173 | #include "sound/dmadac.h" | |
| 173 | 174 | #include "includes/n64.h" |
| 174 | 175 | |
| 175 | 176 | static READ32_HANDLER( aleck_dips_r ) |
| r4135 | r4136 | |
|---|---|---|
| 118 | 118 | static UINT16 imago_sprites_address; |
| 119 | 119 | static UINT8 imago_sprites_bank = 0; |
| 120 | 120 | |
| 121 | static MACHINE_START( imago ) | |
| 122 | { | |
| 123 | gfx_element_set_source(machine->gfx[1], imago_sprites); | |
| 124 | } | |
| 125 | ||
| 121 | 126 | static WRITE8_HANDLER( imago_dma_irq_w ) |
| 122 | 127 | { |
| 123 | 128 | cpu_set_input_line(space->machine->cpu[0], 0, data & 1 ? ASSERT_LINE : CLEAR_LINE); |
| r4135 | r4136 | |
| 142 | 147 | sprites_data = rom[imago_sprites_address + 0x2000*2 + imago_sprites_bank * 0x1000]; |
| 143 | 148 | imago_sprites[offset + 0x800*2] = sprites_data; |
| 144 | 149 | |
| 145 | | |
| 150 | gfx_el | |
| 146 | 151 | } |
| 147 | 152 | |
| 148 | 153 | static READ8_HANDLER( imago_sprites_offset_r ) |
| r4135 | r4136 | |
| 666 | 671 | MDRV_CPU_MODIFY("main") |
| 667 | 672 | MDRV_CPU_PROGRAM_MAP(imago_map,0) |
| 668 | 673 | |
| 674 | MDRV_MACHINE_START(imago) | |
| 675 | ||
| 669 | 676 | /* video hardware */ |
| 670 | 677 | MDRV_PALETTE_LENGTH(256+64+2) /* 256 for characters, 64 for the stars and 2 for the web */ |
| 671 | 678 | MDRV_GFXDECODE(imago) |
| r4135 | r4136 | |
|---|---|---|
| 180 | 180 | return memory_read_byte(space, 0xd7c1); |
| 181 | 181 | |
| 182 | 182 | return prot_mem[offset]; |
| 183 | break; | |
| 184 | 183 | |
| 185 | 184 | case 0x01: |
| 186 | 185 | if ( prot_mode_sel == 0x08 ) /* PC = 0x0b6a */ |
| r4135 | r4136 | |
| 236 | 235 | return 0x00; |
| 237 | 236 | case 0x0d: |
| 238 | 237 | return prot_mode_sel; |
| 239 | break; | |
| 240 | 238 | } |
| 241 | 239 | |
| 242 | 240 | logerror("Read from unknown protection? port %02x ( selector = %02x )\n", offset, prot_mode_sel ); |
| r4135 | r4136 | |
| 260 | 258 | |
| 261 | 259 | prot_mem[offset] = data; |
| 262 | 260 | return; |
| 263 | break; | |
| 264 | 261 | |
| 265 | 262 | case 0x02: |
| 266 | 263 | if ( prot_mode_sel == 0x09 ) { /* PC = 0x20f7, 0x22d7 */ |
| r4135 | r4136 | |
| 294 | 291 | case 0x0d: /* PC = all over the code */ |
| 295 | 292 | prot_mode_sel = data; |
| 296 | 293 | return; |
| 294 | ||
| 297 | 295 | case 0x0f: |
| 298 | 296 | prot_mem[offset] = data; |
| 299 | 297 | return; |
| r4135 | r4136 | |
|---|---|---|
| 75 | 75 | { |
| 76 | 76 | switch( cowrace_38c2 ) |
| 77 | 77 | { |
| 78 | case 0x02: return 0x03; break; | |
| 79 | case 0x04: return 0x00; break; | |
| 78 | case 0x02: return 0x03; | |
| 79 | case 0x04: return 0x00; | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | return 0xff; |
| r4135 | r4136 | |
|---|---|---|
| 133 | 133 | 0); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | VIDEO_START(mil4000) | |
| 136 | static VIDEO_START(mil4000) | |
| 137 | 137 | { |
| 138 | 138 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 139 | 139 | int i; |
| r4135 | r4136 | |
| 152 | 152 | tilemap_set_transparent_pen(sc3_tilemap,0); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | VIDEO_UPDATE(mil4000) | |
| 155 | static VIDEO_UPDATE(mil4000) | |
| 156 | 156 | { |
| 157 | 157 | tilemap_draw(bitmap,cliprect,sc0_tilemap,0,0); |
| 158 | 158 | tilemap_draw(bitmap,cliprect,sc1_tilemap,0,0); |
| r4135 | r4136 | |
|---|---|---|
| 236 | 236 | UINT8 gticlub_led_reg1; |
| 237 | 237 | |
| 238 | 238 | int K001604_vh_start(running_machine *machine, int chip); |
| 239 | void K001604_tile_update(running_machine *machine, int chip); | |
| 240 | 239 | void K001604_draw_front_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect); |
| 241 | 240 | void K001604_draw_back_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect); |
| 242 | 241 | READ32_HANDLER(K001604_tile_r); |
| r4135 | r4136 | |
| 280 | 279 | { |
| 281 | 280 | const device_config *voodoo = device_list_find_by_tag(screen->machine->config->devicelist, VOODOO_GRAPHICS, "voodoo0"); |
| 282 | 281 | |
| 283 | K001604_tile_update(screen->machine, 0); | |
| 284 | 282 | // K001604_draw_back_layer(bitmap, cliprect); |
| 285 | 283 | |
| 286 | 284 | voodoo_update(voodoo, bitmap, cliprect); |
| r4135 | r4136 | |
| 291 | 289 | { |
| 292 | 290 | const device_config *voodoo = device_list_find_by_tag(screen->machine->config->devicelist, VOODOO_GRAPHICS, "voodoo1"); |
| 293 | 291 | |
| 294 | K001604_tile_update(screen->machine, 1); | |
| 295 | 292 | // K001604_draw_back_layer(bitmap, cliprect); |
| 296 | 293 | |
| 297 | 294 | voodoo_update(voodoo, bitmap, cliprect); |
| r4135 | r4136 | |
|---|---|---|
| 49 | 49 | static UINT16 *blit_romaddr,*blit_attr1_ram,*blit_dst_ram_loword,*blit_attr2_ram,*blit_dst_ram_hiword; |
| 50 | 50 | static UINT8 *blit_buffer; |
| 51 | 51 | |
| 52 | VIDEO_START(ilpag) | |
| 52 | static VIDEO_START(ilpag) | |
| 53 | 53 | { |
| 54 | 54 | blit_buffer = auto_malloc(512*512*4); //just to be sure,number is wrong |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | VIDEO_UPDATE(ilpag) | |
| 57 | static VIDEO_UPDATE(ilpag) | |
| 58 | 58 | { |
| 59 | 59 | int x,y; |
| 60 | 60 | // static int counter = 0; |
| r4135 | r4136 | |
|---|---|---|
| 885 | 885 | { |
| 886 | 886 | case 0x40: |
| 887 | 887 | return input_port_read(space->machine, "P1"); |
| 888 | break; | |
| 889 | 888 | |
| 890 | 889 | case 0x60: |
| 891 | 890 | return input_port_read(space->machine, "P2"); |
| 892 | break; | |
| 893 | 891 | |
| 894 | 892 | case 0x20: |
| 895 | 893 | return input_port_read(space->machine, "DSW"); |
| 896 | break; | |
| 897 | 894 | |
| 898 | 895 | case 0x00: |
| 899 | 896 | return input_port_read(space->machine, "P4"); |
| 900 | break; | |
| 901 | 897 | } |
| 902 | 898 | |
| 903 | 899 | return 0xff; |
| r4135 | r4136 | |
|---|---|---|
| 90 | 90 | |
| 91 | 91 | for( x = 0; x < 16; x++ ) |
| 92 | 92 | { |
| 93 | int sprite = ( spriteram[ ( spriteindex / 64 ) % 6 ] & 0xf ) ^ 0xf; | |
| 94 | const UINT8 *gfxdata = gfx_element_get_data(gfx, sprite); | |
| 95 | ||
| 93 | 96 | for( y = 0; y < 8; y++ ) |
| 94 | 97 | { |
| 95 | 98 | UINT16 *dst = BITMAP_ADDR16( bitmap, y + ( row * 8 ), x + ( col * 16 ) ); |
| 96 | int sprite = ( spriteram[ ( spriteindex / 64 ) % 6 ] & 0xf ) ^ 0xf; | |
| 97 | *( dst ) = *( gfx->gfxdata + ( sprite * gfx->char_modulo ) + ( ( spriterow + y ) * gfx->line_modulo ) + ( ( spriteindex % 64 ) >> 1 ) ); | |
| 99 | *( dst ) = *( gfxdata + ( ( spriterow + y ) * gfx->line_modulo ) + ( ( spriteindex % 64 ) >> 1 ) ); | |
| 98 | 100 | } |
| 99 | 101 | |
| 100 | 102 | spriteindex += spritesize; |
| r4135 | r4136 | |
| 683 | 685 | ROM_LOAD( "16-1-101.b11", 0x0200, 0x0100, NO_DUMP ) |
| 684 | 686 | ROM_END |
| 685 | 687 | |
| 688 | /* no information about this one */ | |
| 689 | ROM_START( acefruit ) | |
| 690 | ROM_REGION( 0x10000, "main", 0 ) | |
| 691 | ROM_LOAD( "vp-h9.bin", 0x00e000, 0x0800, CRC(f595daf7) SHA1(be5abd34fd06f73cd80f5b15902d158e33705c8f) ) | |
| 692 | ROM_CONTINUE( 0x000000, 0x0800 ) | |
| 693 | ROM_LOAD( "vp-h10.bin", 0x00e800, 0x0800, CRC(b0539100) SHA1(763f31f72f55c3322b24e127b37130d37daa5216) ) | |
| 694 | ROM_CONTINUE( 0x000800, 0x0800 ) | |
| 695 | ROM_LOAD( "vp-h11.bin", 0x00f000, 0x0800, CRC(fa176072) SHA1(18203278bb9c505f07390f7b95ecf9ab6d7b7122) ) | |
| 696 | ROM_CONTINUE( 0x001000, 0x0800 ) | |
| 697 | ||
| 698 | ROM_REGION( 0x2000, "gfx1", ROMREGION_DISPOSE ) /* 8k for graphics */ | |
| 699 | ROM_LOAD( "vp-h5.bin", 0x000000, 0x000800, CRC(dfffe063) SHA1(1b860323fe93b7d010fa35167769555a6bd4a49c) ) | |
| 700 | ROM_LOAD( "vp-h6.bin", 0x000800, 0x000800, CRC(355203b8) SHA1(959f3599a24293f392e8b10061c39d3244f34c05) ) | |
| 701 | ROM_LOAD( "vp-h7.bin", 0x001000, 0x000800, CRC(7784de8a) SHA1(40851724c9b7ef26964462b5e97ad943df4d56e2) ) | |
| 702 | ROM_LOAD( "vp-h8.bin", 0x001800, 0x000800, CRC(d587e541) SHA1(902b6c4673b8b989d034d60d3c47f2499f100ba2) ) | |
| 703 | ||
| 704 | /* there were no proms in the set */ | |
| 705 | ROM_REGION( 0x300, "proms", 0 ) | |
| 706 | ROM_LOAD( "16-1-101.b9", 0x0000, 0x0100, NO_DUMP ) | |
| 707 | ROM_LOAD( "16-1-101.b10", 0x0100, 0x0100, NO_DUMP ) | |
| 708 | ROM_LOAD( "16-1-101.b11", 0x0200, 0x0100, NO_DUMP ) | |
| 709 | ROM_END | |
| 710 | ||
| 711 | ||
| 686 | 712 | GAMEL( 1981?, sidewndr, 0, acefruit, sidewndr, sidewndr, ROT270, "ACE", "Sidewinder", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND, layout_sidewndr ) |
| 687 | 713 | GAMEL( 1981?, spellbnd, sidewndr, acefruit, spellbnd, 0, ROT270, "ACE", "Spellbound", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND, layout_sidewndr ) |
| 688 | 714 | GAME ( 1982?, starspnr, 0, acefruit, starspnr, 0, ROT270, "ACE", "Starspinner (Dutch/Nederlands)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 715 | // inputs need fixing on this one, no idea what it's called either | |
| 716 | GAME ( 1982?, acefruit, 0, acefruit, spellbnd, 0, ROT270, "ACE", "Unknown ACE Fruits Game", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| r4135 | r4136 | |
|---|---|---|
| 54 | 54 | #include "sound/msm5205.h" |
| 55 | 55 | #include "sound/sn76496.h" |
| 56 | 56 | |
| 57 | static UINT8 *adpcmptr = 0; | |
| 58 | static int appoooh_adpcm_data; | |
| 57 | static UINT32 appoooh_adpcm_data; | |
| 58 | static UINT32 appoooh_adpcm_address = 0xffffffff; | |
| 59 | 59 | |
| 60 | 60 | static void appoooh_adpcm_int(const device_config *device) |
| 61 | 61 | { |
| 62 | if( | |
| 62 | if( | |
| 63 | 63 | { |
| 64 | if( | |
| 64 | if( | |
| 65 | 65 | { |
| 66 | appoooh_adpcm_data = *adpcmptr++; | |
| 67 | msm5205_data_w(0,appoooh_adpcm_data >> 4); | |
| 68 | if(appoooh_adpcm_data==0x70) | |
| 66 | UINT8 *RAM = memory_region(device->machine, "adpcm"); | |
| 67 | appoooh_adpcm_data = RAM[appoooh_adpcm_address++]; | |
| 68 | msm5205_data_w(0, appoooh_adpcm_data >> 4); | |
| 69 | if(appoooh_adpcm_data == 0x70) | |
| 69 | 70 | { |
| 70 | ||
| 71 | appoooh_adpcm_address = 0xffffffff; | |
| 71 | 72 | msm5205_reset_w(0,1); |
| 72 | 73 | } |
| 73 | }else{ | |
| 74 | } | |
| 75 | else | |
| 76 | { | |
| 74 | 77 | msm5205_data_w(0,appoooh_adpcm_data & 0x0f ); |
| 75 | appoooh_adpcm_data =-1; | |
| 78 | appoooh_adpcm_data = -1; | |
| 76 | 79 | } |
| 77 | 80 | } |
| 78 | 81 | } |
| 79 | 82 | /* adpcm address write */ |
| 80 | 83 | static WRITE8_HANDLER( appoooh_adpcm_w ) |
| 81 | 84 | { |
| 82 | UINT8 *RAM = memory_region(space->machine, "adpcm"); | |
| 83 | adpcmptr = &RAM[data*256]; | |
| 85 | appoooh_adpcm_address = data << 8; | |
| 84 | 86 | msm5205_reset_w(0,0); |
| 85 | appoooh_adpcm_data= | |
| 87 | appoooh_adpcm_data = 0xffffffff; | |
| 86 | 88 | } |
| 87 | 89 | |
| 88 | 90 | |
| r4135 | r4136 | |
| 211 | 213 | |
| 212 | 214 | |
| 213 | 215 | |
| 216 | static MACHINE_START( appoooh ) | |
| 217 | { | |
| 218 | state_save_register_global(machine, appoooh_adpcm_data); | |
| 219 | state_save_register_global(machine, appoooh_adpcm_address); | |
| 220 | } | |
| 221 | ||
| 222 | ||
| 223 | ||
| 214 | 224 | static MACHINE_DRIVER_START( appoooh ) |
| 215 | 225 | |
| 216 | 226 | /* basic machine hardware */ |
| r4135 | r4136 | |
| 219 | 229 | MDRV_CPU_IO_MAP(main_portmap,0) |
| 220 | 230 | MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) |
| 221 | 231 | |
| 232 | MDRV_MACHINE_START(appoooh) | |
| 233 | ||
| 222 | 234 | /* video hardware */ |
| 223 | 235 | MDRV_SCREEN_ADD("main", RASTER) |
| 224 | 236 | MDRV_SCREEN_REFRESH_RATE(60) |
| r4135 | r4136 | |
| 421 | 433 | MDRV_CPU_IO_MAP(main_portmap,0) |
| 422 | 434 | MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) |
| 423 | 435 | |
| 436 | MDRV_MACHINE_START(appoooh) | |
| 437 | ||
| 424 | 438 | /* video hardware */ |
| 425 | 439 | MDRV_SCREEN_ADD("main", RASTER) |
| 426 | 440 | MDRV_SCREEN_REFRESH_RATE(60) |
| r4135 | r4136 | |
| 560 | 574 | } |
| 561 | 575 | |
| 562 | 576 | |
| 563 | GAME( 1984, appoooh, 0, appoooh, appoooh, 0, ROT0, "[Sanritsu] Sega", "Appoooh", 0 ) | |
| 564 | GAME( 1986, robowres, 0, robowres, robowres, robowres, ROT0, "Sega", "Robo Wres 2001", 0 ) | |
| 565 | GAME( 1986, robowrb, robowres, robowres, robowres, robowrb, ROT0, "bootleg", "Robo Wres 2001 (bootleg)", 0 ) | |
| 577 | GAME( 1984, appoooh, 0, appoooh, appoooh, 0, ROT0, "[Sanritsu] Sega", "Appoooh", GAME_SUPPORTS_SAVE ) | |
| 578 | GAME( 1986, robowres, 0, robowres, robowres, robowres, ROT0, "Sega", "Robo Wres 2001", GAME_SUPPORTS_SAVE ) | |
| 579 | GAME( 1986, robowrb, robowres, robowres, robowres, robowrb, ROT0, "bootleg", "Robo Wres 2001 (bootleg)", GAME_SUPPORTS_SAVE ) |
| r4135 | r4136 | |
|---|---|---|
| 605 | 605 | { |
| 606 | 606 | case 0x0000: // 'Both Sides' = 270deg Wheel |
| 607 | 607 | return (input_port_read(space->machine, "WHEEL0")); |
| 608 | break; | |
| 609 | ||
| 610 | 608 | case 0x1000: // '1P Side' = 360' Wheel |
| 611 | 609 | return (input_port_read(space->machine, "WHEEL1")); |
| 612 | break; | |
| 613 | 610 | default: |
| 614 | 611 | return (0); |
| 615 | break; | |
| 616 | } | |
| 612 | } | |
| 617 | 613 | } |
| 618 | 614 | |
| 619 | 615 | static WRITE16_HANDLER( gtmr_oki_0_bank_w ) |
| r4135 | r4136 | |
| 719 | 715 | { |
| 720 | 716 | case 0x0000: // 270' A. Wheel |
| 721 | 717 | return (input_port_read(space->machine, "WHEEL0")); |
| 722 | break; | |
| 723 | 718 | case 0x1000: // 270' D. Wheel |
| 724 | 719 | return (input_port_read(space->machine, "WHEEL1") << 8); |
| 725 | break; | |
| 726 | 720 | case 0x0800: // 360' Wheel |
| 727 | 721 | return (input_port_read(space->machine, "WHEEL2") << 8); |
| 728 | break; | |
| 729 | 722 | default: |
| 730 | 723 | logerror("gtmr2_wheel_r : read at %06x with joystick\n", cpu_get_pc(space->cpu)); |
| 731 | 724 | return (~0); |
| 732 | break; | |
| 733 | 725 | } |
| 734 | 726 | } |
| 735 | 727 |
| r4135 | r4136 | |
|---|---|---|
| 43 | 43 | Controls Set2 is using reels stop buttons from Controls Set1. |
| 44 | 44 | |
| 45 | 45 | |
| 46 | * Cherry Master V4 (set 2) | |
| 47 | ||
| 48 | This set is supposed to be a kind of "stealth". | |
| 49 | The game is hidden into a Tetris game and could be triggered/switched | |
| 50 | in some way. Seems that it was designed for locations/countries where | |
| 51 | gambling games are/were not allowed. | |
| 52 | ||
| 53 | The game is booting as Cherry Master V4 instead of Tetris ATM... | |
| 54 | ||
| 55 | Even when the gambling game is working properly, the game is flagged | |
| 56 | as NOT_WORKING till can figure out how can switch between games. | |
| 57 | ||
| 58 | ||
| 59 | * Kkoj Noli | |
| 60 | ||
| 61 | kkuj nol-i / kkoj noli (better romanization). | |
| 62 | ||
| 63 | kkuj = stab/kill | |
| 64 | nol-i = bees | |
| 65 | ||
| 66 | The little red box at bottom of the title translates as "South Korea" | |
| 67 | ||
| 68 | Seems to be a hack of Lucky 8 Lines. | |
| 69 | ||
| 70 | - Child'ish graphics. | |
| 71 | - For Amusement only... There is no payout/keyout line accessed. | |
| 72 | - No stats or service mode. | |
| 73 | - No NVRAM. | |
| 74 | - Two sets of player's controls, as lucky8. | |
| 75 | - No ay8910, so no extra ports. | |
| 76 | - Only 1 DIP switches bank. | |
| 77 | ||
| 78 | Nominated for the *WORST* hacked gambling game EVER! | |
| 79 | ||
| 80 | ||
| 46 | 81 | ***************************************************************************/ |
| 47 | 82 | |
| 83 | ||
| 84 | #define MASTER_CLOCK XTAL_12MHz | |
| 85 | #define CPU_CLOCK MASTER_CLOCK / 4 | |
| 86 | #define PSG_CLOCK MASTER_CLOCK / 4 | |
| 87 | #define AY_CLOCK MASTER_CLOCK / 8 | |
| 88 | #define OKI_CLOCK 1056000 /* unverified resonator */ | |
| 89 | ||
| 48 | 90 | #include "driver.h" |
| 49 | 91 | #include "cpu/z80/z80.h" |
| 50 | 92 | #include "sound/ay8910.h" |
| r4135 | r4136 | |
| 73 | 115 | VIDEO_START( goldstar ); |
| 74 | 116 | VIDEO_START( cherrym ); |
| 75 | 117 | VIDEO_UPDATE( goldstar ); |
| 118 | VIDEO_UPDATE( cmast91 ); | |
| 76 | 119 | |
| 77 | 120 | static UINT8 *nvram; |
| 78 | 121 | static size_t nvram_size; |
| r4135 | r4136 | |
| 219 | 262 | static ADDRESS_MAP_START( cm_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 220 | 263 | AM_RANGE(0x0000, 0xbfff) AM_ROM AM_WRITENOP |
| 221 | 264 | |
| 265 | AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE(&nvram) AM_SIZE(&nvram_size) | |
| 266 | ||
| 222 | 267 | AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_WRITE(goldstar_fg_vidram_w) AM_BASE(&videoram) |
| 223 | 268 | AM_RANGE(0xe800, 0xefff) AM_RAM AM_WRITE(goldstar_fg_atrram_w) AM_BASE(&colorram) |
| 224 | 269 | |
| 225 | AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE(&nvram) AM_SIZE(&nvram_size) | |
| 226 | ||
| 227 | 270 | AM_RANGE(0xf000, 0xf1ff) AM_RAM AM_WRITE( goldstar_reel1_ram_w ) AM_BASE(&goldstar_reel1_ram) |
| 228 | 271 | AM_RANGE(0xf200, 0xf3ff) AM_RAM AM_WRITE( goldstar_reel2_ram_w ) AM_BASE(&goldstar_reel2_ram) |
| 229 | 272 | AM_RANGE(0xf400, 0xf5ff) AM_RAM AM_WRITE( goldstar_reel3_ram_w ) AM_BASE(&goldstar_reel3_ram) |
| r4135 | r4136 | |
| 242 | 285 | AM_RANGE(0x01, 0x01) AM_READ(ay8910_read_port_0_r) |
| 243 | 286 | AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_write_port_0_w) |
| 244 | 287 | AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_control_port_0_w) |
| 245 | AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(PPI8255, "cm_ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */ | |
| 246 | AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(PPI8255, "cm_ppi8255_1", ppi8255_r, ppi8255_w) /* DIP switches */ | |
| 288 | AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */ | |
| 289 | AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* DIP switches */ | |
| 247 | 290 | AM_RANGE(0x10, 0x10) AM_WRITE (cm_outport0_w) /* output port */ |
| 248 | 291 | AM_RANGE(0x11, 0x11) AM_WRITENOP |
| 249 | 292 | AM_RANGE(0x12, 0x12) AM_WRITE (cm_outport1_w) /* output port */ |
| r4135 | r4136 | |
| 251 | 294 | ADDRESS_MAP_END |
| 252 | 295 | |
| 253 | 296 | |
| 254 | static READ8_HANDLER( cm91_r ) | |
| 255 | { | |
| 256 | return 0xff; | |
| 257 | } | |
| 258 | ||
| 259 | 297 | static ADDRESS_MAP_START( cmast91_portmap, ADDRESS_SPACE_IO, 8 ) |
| 260 | 298 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 261 | AM_RANGE(0x02, 0x02) AM_READ(cm91_r) | |
| 299 | AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */ | |
| 300 | AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* DIP switches */ | |
| 262 | 301 | AM_RANGE(0x21, 0x21) AM_READ(ay8910_read_port_0_r) |
| 263 | 302 | AM_RANGE(0x22, 0x22) AM_WRITE(ay8910_write_port_0_w) |
| 264 | 303 | AM_RANGE(0x23, 0x23) AM_WRITE(ay8910_control_port_0_w) |
| r4135 | r4136 | |
| 292 | 331 | ADDRESS_MAP_END |
| 293 | 332 | |
| 294 | 333 | |
| 334 | static ADDRESS_MAP_START( kkojnoli_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 335 | AM_RANGE(0x0000, 0x7fff) AM_ROM | |
| 336 | AM_RANGE(0x8000, 0x87ff) AM_RAM /* definitelly no NVRAM */ | |
| 337 | AM_RANGE(0x8800, 0x8fff) AM_RAM AM_WRITE(goldstar_fg_vidram_w) AM_BASE(&videoram) | |
| 338 | AM_RANGE(0x9000, 0x97ff) AM_RAM AM_WRITE(goldstar_fg_atrram_w) AM_BASE(&colorram) | |
| 339 | AM_RANGE(0x9800, 0x99ff) AM_RAM AM_WRITE(goldstar_reel1_ram_w) AM_BASE(&goldstar_reel1_ram) | |
| 340 | AM_RANGE(0xa000, 0xa1ff) AM_RAM AM_WRITE(goldstar_reel2_ram_w) AM_BASE(&goldstar_reel2_ram) | |
| 341 | AM_RANGE(0xa800, 0xa9ff) AM_RAM AM_WRITE(goldstar_reel3_ram_w) AM_BASE(&goldstar_reel3_ram) | |
| 342 | AM_RANGE(0xb040, 0xb07f) AM_RAM AM_BASE(&goldstar_reel1_scroll) | |
| 343 | AM_RANGE(0xb080, 0xb0bf) AM_RAM AM_BASE(&goldstar_reel2_scroll) | |
| 344 | AM_RANGE(0xb100, 0xb17f) AM_RAM AM_BASE(&goldstar_reel3_scroll) | |
| 345 | ||
| 346 | AM_RANGE(0xb800, 0xb803) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */ | |
| 347 | AM_RANGE(0xb810, 0xb813) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* Input Ports */ | |
| 348 | AM_RANGE(0xb820, 0xb823) AM_DEVREADWRITE(PPI8255, "ppi8255_2", ppi8255_r, ppi8255_w) /* Input Port */ | |
| 349 | AM_RANGE(0xb830, 0xb830) AM_WRITENOP /* no ay8910 */ | |
| 350 | AM_RANGE(0xb840, 0xb840) AM_WRITENOP /* no ay8910 */ | |
| 351 | AM_RANGE(0xb850, 0xb850) AM_WRITE(lucky8_outport_w) | |
| 352 | AM_RANGE(0xb870, 0xb870) AM_WRITE(sn76496_0_w) /* sound */ | |
| 353 | AM_RANGE(0xf800, 0xffff) AM_RAM | |
| 354 | ADDRESS_MAP_END | |
| 355 | ||
| 356 | ||
| 357 | //static WRITE8_HANDLER( ladylinr_outport_w ) | |
| 358 | //{ | |
| 359 | /* LAMPS (b840)... | |
| 360 | ||
| 361 | .... ...x | |
| 362 | .... ..x. | |
| 363 | .... .x.. | |
| 364 | .... x... BET | |
| 365 | ...x .... SMALL/INFO | |
| 366 | ..x. .... START | |
| 367 | .x.. .... | |
| 368 | x... .... | |
| 369 | */ | |
| 370 | // popmessage("Output: %02X", data); | |
| 371 | //} | |
| 372 | ||
| 373 | static ADDRESS_MAP_START( ladylinr_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 374 | AM_RANGE(0x0000, 0x7fff) AM_ROM | |
| 375 | AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&nvram) AM_SIZE(&nvram_size) | |
| 376 | AM_RANGE(0x8800, 0x8fff) AM_RAM AM_WRITE(goldstar_fg_vidram_w) AM_BASE(&videoram) | |
| 377 | AM_RANGE(0x9000, 0x97ff) AM_RAM AM_WRITE(goldstar_fg_atrram_w) AM_BASE(&colorram) | |
| 378 | AM_RANGE(0x9800, 0x99ff) AM_RAM AM_WRITE(goldstar_reel1_ram_w) AM_BASE(&goldstar_reel1_ram) | |
| 379 | AM_RANGE(0xa000, 0xa1ff) AM_RAM AM_WRITE(goldstar_reel2_ram_w) AM_BASE(&goldstar_reel2_ram) | |
| 380 | AM_RANGE(0xa800, 0xa9ff) AM_RAM AM_WRITE(goldstar_reel3_ram_w) AM_BASE(&goldstar_reel3_ram) | |
| 381 | AM_RANGE(0xb040, 0xb07f) AM_RAM AM_BASE(&goldstar_reel1_scroll) | |
| 382 | AM_RANGE(0xb080, 0xb0bf) AM_RAM AM_BASE(&goldstar_reel2_scroll) | |
| 383 | AM_RANGE(0xb100, 0xb17f) AM_RAM AM_BASE(&goldstar_reel3_scroll) | |
| 384 | ||
| 385 | AM_RANGE(0xb800, 0xb803) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */ | |
| 386 | AM_RANGE(0xb810, 0xb813) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* DSW bank */ | |
| 387 | AM_RANGE(0xb830, 0xb830) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w) | |
| 388 | AM_RANGE(0xb840, 0xb840) AM_WRITE(ay8910_control_port_0_w) /* no sound... only use ports */ | |
| 389 | AM_RANGE(0xb850, 0xb850) AM_WRITENOP /* just turn off the lamps, if exist */ | |
| 390 | AM_RANGE(0xb870, 0xb870) AM_WRITE(sn76496_0_w) /* sound */ | |
| 391 | AM_RANGE(0xf800, 0xffff) AM_RAM | |
| 392 | ADDRESS_MAP_END | |
| 393 | ||
| 394 | ||
| 295 | 395 | static INPUT_PORTS_START( cmv801 ) |
| 296 | 396 | PORT_START("IN0") |
| 297 | 397 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 298 | 398 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 299 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Stop 2 / Big") PORT_CODE(KEYCODE_X) | |
| 300 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Stop 1 / D-UP") PORT_CODE(KEYCODE_Z) | |
| 301 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Stop All / Take") PORT_CODE(KEYCODE_V) | |
| 302 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Bet") PORT_CODE(KEYCODE_B) | |
| 303 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Stop 3 / Small / Info") PORT_CODE(KEYCODE_C) | |
| 304 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Start") PORT_CODE(KEYCODE_N) | |
| 399 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Stop 2 / Big") | |
| 400 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("Stop 1 / D-UP") | |
| 401 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Stop All / Take") | |
| 402 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Bet") | |
| 403 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Stop 3 / Small / Info") | |
| 404 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Start") | |
| 305 | 405 | |
| 306 | 406 | PORT_START("IN1") |
| 307 | 407 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r4135 | r4136 | |
| 310 | 410 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 311 | 411 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ |
| 312 | 412 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ |
| 313 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 413 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 314 | 414 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ |
| 315 | 415 | |
| 316 | 416 | PORT_START("IN2") |
| r4135 | r4136 | |
| 318 | 418 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 319 | 419 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 320 | 420 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 321 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key Out / Attendant" | |
| 421 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant" | |
| 322 | 422 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 323 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_9) | |
| 324 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats") PORT_CODE(KEYCODE_0) | |
| 423 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 424 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 325 | 425 | |
| 326 | 426 | PORT_START("DSW1") |
| 327 | 427 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:1") /* OK */ |
| r4135 | r4136 | |
| 458 | 558 | PORT_START("IN0") |
| 459 | 559 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 460 | 560 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 461 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Stop 3 / Big") PORT_CODE(KEYCODE_X) | |
| 462 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Stop 1 / D-UP") PORT_CODE(KEYCODE_Z) | |
| 463 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Stop All / Take") PORT_CODE(KEYCODE_V) | |
| 464 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Bet") PORT_CODE(KEYCODE_B) | |
| 465 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Stop 2 / Small / Info") PORT_CODE(KEYCODE_C) | |
| 466 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Start") PORT_CODE(KEYCODE_N) | |
| 561 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Stop 3 / Big") | |
| 562 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("Stop 1 / D-UP") | |
| 563 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Stop All / Take") | |
| 564 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Bet") | |
| 565 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Stop 2 / Small / Info") | |
| 566 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Start") | |
| 467 | 567 | |
| 468 | 568 | PORT_START("IN1") |
| 469 | 569 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r4135 | r4136 | |
| 472 | 572 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 473 | 573 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ |
| 474 | 574 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ |
| 475 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 575 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 476 | 576 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ |
| 477 | 577 | |
| 478 | 578 | PORT_START("IN2") |
| r4135 | r4136 | |
| 480 | 580 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 481 | 581 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 482 | 582 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 483 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key Out / Attendant" | |
| 583 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant" | |
| 484 | 584 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 485 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_9) | |
| 486 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats") PORT_CODE(KEYCODE_0) | |
| 585 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 586 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 487 | 587 | |
| 488 | 588 | PORT_START("DSW1") |
| 489 | 589 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:1") /* OK */ |
| r4135 | r4136 | |
| 511 | 611 | PORT_DIPSETTING( 0xc0, "64" ) |
| 512 | 612 | |
| 513 | 613 | PORT_START("DSW2") |
| 514 | PORT_DIPNAME( 0x07, 0x0 | |
| 614 | PORT_DIPNAME( 0x07, 0x03, "Main Game Pay Rate" ) PORT_DIPLOCATION("DSW2:1,2,3") /* OK */ | |
| 515 | 615 | PORT_DIPSETTING( 0x07, "30%" ) |
| 516 | 616 | PORT_DIPSETTING( 0x06, "38%" ) |
| 517 | 617 | PORT_DIPSETTING( 0x05, "46%" ) |
| r4135 | r4136 | |
| 620 | 720 | PORT_START("IN0") |
| 621 | 721 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 622 | 722 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 623 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Stop 3 / Big") PORT_CODE(KEYCODE_X) | |
| 624 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Stop 1 / D-UP") PORT_CODE(KEYCODE_Z) | |
| 625 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Take") PORT_CODE(KEYCODE_V) | |
| 626 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Bet / Stop All") PORT_CODE(KEYCODE_B) | |
| 627 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Stop 2 / Small / Info") PORT_CODE(KEYCODE_C) | |
| 628 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Start") PORT_CODE(KEYCODE_N) | |
| 723 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Stop 3 / Big") | |
| 724 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("Stop 1 / D-UP") | |
| 725 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Take") | |
| 726 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Bet / Stop All") | |
| 727 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Stop 2 / Small / Info") | |
| 728 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Start") | |
| 629 | 729 | |
| 630 | 730 | PORT_START("IN1") |
| 631 | 731 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r4135 | r4136 | |
| 634 | 734 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 635 | 735 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ |
| 636 | 736 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ |
| 637 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 737 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 638 | 738 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ |
| 639 | 739 | |
| 640 | 740 | PORT_START("IN2") |
| r4135 | r4136 | |
| 642 | 742 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 643 | 743 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 644 | 744 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 645 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key Out / Attendant" | |
| 745 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant" | |
| 646 | 746 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 647 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_9) | |
| 648 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats") PORT_CODE(KEYCODE_0) | |
| 747 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 748 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 649 | 749 | |
| 650 | 750 | PORT_START("DSW1") |
| 651 | 751 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:1") /* OK */ |
| r4135 | r4136 | |
| 673 | 773 | PORT_DIPSETTING( 0xc0, "64" ) |
| 674 | 774 | |
| 675 | 775 | PORT_START("DSW2") |
| 676 | PORT_DIPNAME( 0x07, 0x0 | |
| 776 | PORT_DIPNAME( 0x07, 0x03, "Main Game Pay Rate" ) PORT_DIPLOCATION("DSW2:1,2,3") /* OK */ | |
| 677 | 777 | PORT_DIPSETTING( 0x07, "45%" ) |
| 678 | 778 | PORT_DIPSETTING( 0x06, "50%" ) |
| 679 | 779 | PORT_DIPSETTING( 0x05, "55%" ) |
| r4135 | r4136 | |
| 754 | 854 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 755 | 855 | |
| 756 | 856 | PORT_START("DSW5") |
| 757 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:1") /* not checked */ | |
| 857 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:1") /* not checked */ | |
| 758 | 858 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 759 | 859 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 760 | 860 | PORT_DIPNAME( 0x06, 0x06, "Coin In Limit" ) PORT_DIPLOCATION("DSW5:2,3") /* not checked */ |
| r4135 | r4136 | |
| 778 | 878 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 779 | 879 | INPUT_PORTS_END |
| 780 | 880 | |
| 881 | static INPUT_PORTS_START( cmasterb ) | |
| 882 | PORT_START("IN0") | |
| 883 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 884 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 885 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Big / Stop All") | |
| 886 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("D-UP") | |
| 887 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Take Score") | |
| 888 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Bet") | |
| 889 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Small / Info") | |
| 890 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Start") | |
| 781 | 891 | |
| 892 | PORT_START("IN1") | |
| 893 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 894 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 895 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2) PORT_IMPULSE(2) /* Coin B */ | |
| 896 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 897 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ | |
| 898 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ | |
| 899 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_Q) PORT_NAME("Key In") | |
| 900 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ | |
| 901 | ||
| 902 | PORT_START("IN2") | |
| 903 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 904 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 905 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 906 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 907 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant") | |
| 908 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 909 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 910 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 911 | ||
| 912 | PORT_START("DSW1") | |
| 913 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:1") /* OK */ | |
| 914 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 915 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 916 | PORT_DIPNAME( 0x02, 0x02, "Hopper Out Switch" ) PORT_DIPLOCATION("DSW1:2") /* OK */ | |
| 917 | PORT_DIPSETTING( 0x02, "Active Low" ) | |
| 918 | PORT_DIPSETTING( 0x00, "Active High" ) | |
| 919 | PORT_DIPNAME( 0x04, 0x00, "Payout Mode" ) PORT_DIPLOCATION("DSW1:3") /* OK */ | |
| 920 | PORT_DIPSETTING( 0x04, "Payout Switch" ) | |
| 921 | PORT_DIPSETTING( 0x00, "Automatic" ) | |
| 922 | PORT_DIPNAME( 0x08, 0x00, "W-UP '7'" ) PORT_DIPLOCATION("DSW1:4") /* not checked */ | |
| 923 | PORT_DIPSETTING( 0x08, "Loss" ) | |
| 924 | PORT_DIPSETTING( 0x00, "Even" ) | |
| 925 | PORT_DIPNAME( 0x10, 0x00, "W-UP Pay Rate" ) PORT_DIPLOCATION("DSW1:5") /* OK */ | |
| 926 | PORT_DIPSETTING( 0x00, "80%" ) | |
| 927 | PORT_DIPSETTING( 0x10, "90%" ) | |
| 928 | PORT_DIPNAME( 0x20, 0x00, "W-UP Game" ) PORT_DIPLOCATION("DSW1:6") /* OK */ | |
| 929 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 930 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 931 | PORT_DIPNAME( 0xc0, 0xc0, "Bet Max" ) PORT_DIPLOCATION("DSW1:7,8") /* OK */ | |
| 932 | PORT_DIPSETTING( 0x00, "8" ) | |
| 933 | PORT_DIPSETTING( 0x40, "16" ) | |
| 934 | PORT_DIPSETTING( 0x80, "32" ) | |
| 935 | PORT_DIPSETTING( 0xc0, "64" ) | |
| 936 | ||
| 937 | PORT_START("DSW2") | |
| 938 | PORT_DIPNAME( 0x07, 0x03, "Main Game Pay Rate" ) PORT_DIPLOCATION("DSW2:1,2,3") /* OK */ | |
| 939 | PORT_DIPSETTING( 0x07, "55%" ) | |
| 940 | PORT_DIPSETTING( 0x06, "60%" ) | |
| 941 | PORT_DIPSETTING( 0x05, "65%" ) | |
| 942 | PORT_DIPSETTING( 0x04, "70%" ) | |
| 943 | PORT_DIPSETTING( 0x03, "75%" ) | |
| 944 | PORT_DIPSETTING( 0x02, "80%" ) | |
| 945 | PORT_DIPSETTING( 0x01, "85%" ) | |
| 946 | PORT_DIPSETTING( 0x00, "90%" ) | |
| 947 | PORT_DIPNAME( 0x18, 0x00, "Hopper Limit" ) PORT_DIPLOCATION("DSW2:4,5") /* OK */ | |
| 948 | PORT_DIPSETTING( 0x18, "300" ) | |
| 949 | PORT_DIPSETTING( 0x10, "500" ) | |
| 950 | PORT_DIPSETTING( 0x08, "1000" ) | |
| 951 | PORT_DIPSETTING( 0x00, "Unlimited" ) | |
| 952 | PORT_DIPNAME( 0x20, 0x00, "100 Odds Sound" ) PORT_DIPLOCATION("DSW2:6") /* not checked */ | |
| 953 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 954 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) | |
| 955 | PORT_DIPNAME( 0x40, 0x40, "Key-In Type" ) PORT_DIPLOCATION("DSW2:7") /* OK */ | |
| 956 | PORT_DIPSETTING( 0x40, "A-Type" ) | |
| 957 | PORT_DIPSETTING( 0x00, "B-Type" ) | |
| 958 | PORT_DIPNAME( 0x80, 0x00, "Center Super 7 Bet Limit" ) PORT_DIPLOCATION("DSW2:8") /* related with DSW 4-6 */ | |
| 959 | PORT_DIPSETTING( 0x80, "Unlimited" ) | |
| 960 | PORT_DIPSETTING( 0x00, "Limited" ) | |
| 961 | ||
| 962 | PORT_START("DSW3") | |
| 963 | PORT_DIPNAME( 0x03, 0x03, "Key In Rate" ) PORT_DIPLOCATION("DSW3:1,2") /* OK */ | |
| 964 | PORT_DIPSETTING( 0x00, "1 Coin/10 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) /* A-Type */ | |
| 965 | PORT_DIPSETTING( 0x01, "1 Coin/20 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 966 | PORT_DIPSETTING( 0x02, "1 Coin/50 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 967 | PORT_DIPSETTING( 0x03, "1 Coin/100 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 968 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) /* B-Type */ | |
| 969 | PORT_DIPSETTING( 0x01, "1 Coin/10 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 970 | PORT_DIPSETTING( 0x02, "1 Coin/25 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 971 | PORT_DIPSETTING( 0x03, "1 Coin/50 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 972 | PORT_DIPNAME( 0x0c, 0x0c, "Coin A Rate" ) PORT_DIPLOCATION("DSW3:3,4") /* OK */ | |
| 973 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) | |
| 974 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) ) | |
| 975 | PORT_DIPSETTING( 0x08, DEF_STR( 1C_5C ) ) | |
| 976 | PORT_DIPSETTING( 0x0c, "1 Coin/10 Credits" ) | |
| 977 | PORT_DIPNAME( 0x30, 0x30, "Coin D Rate" ) PORT_DIPLOCATION("DSW3:5,6") /* OK */ | |
| 978 | PORT_DIPSETTING( 0x30, DEF_STR( 5C_1C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) /* C-Type */ | |
| 979 | PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 980 | PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 981 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 982 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) /* D-Type */ | |
| 983 | PORT_DIPSETTING( 0x10, "1 Coin/10 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 984 | PORT_DIPSETTING( 0x20, "1 Coin/25 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 985 | PORT_DIPSETTING( 0x30, "1 Coin/50 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 986 | PORT_DIPNAME( 0xc0, 0xc0, "Coin C Rate" ) PORT_DIPLOCATION("DSW3:7,8") /* OK */ | |
| 987 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) | |
| 988 | PORT_DIPSETTING( 0x40, DEF_STR( 1C_2C ) ) | |
| 989 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_5C ) ) | |
| 990 | PORT_DIPSETTING( 0xc0, "1 Coin/10 Credits" ) | |
| 991 | ||
| 992 | PORT_START("DSW4") | |
| 993 | PORT_DIPNAME( 0x07, 0x05, "Credit Limit" ) PORT_DIPLOCATION("DSW4:1,2,3") /* OK */ | |
| 994 | PORT_DIPSETTING( 0x07, "5,000" ) | |
| 995 | PORT_DIPSETTING( 0x06, "10,000" ) | |
| 996 | PORT_DIPSETTING( 0x05, "20,000" ) | |
| 997 | PORT_DIPSETTING( 0x04, "30,000" ) | |
| 998 | PORT_DIPSETTING( 0x03, "40,000" ) | |
| 999 | PORT_DIPSETTING( 0x02, "50,000" ) | |
| 1000 | PORT_DIPSETTING( 0x01, "100,000" ) | |
| 1001 | PORT_DIPSETTING( 0x00, "Unlimited" ) | |
| 1002 | PORT_DIPNAME( 0x08, 0x00, "Display Of Payout Limit" ) PORT_DIPLOCATION("DSW4:4") /* OK */ | |
| 1003 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 1004 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1005 | PORT_DIPNAME( 0x10, 0x10, "Type Of Coin D" ) PORT_DIPLOCATION("DSW4:5") /* OK */ | |
| 1006 | PORT_DIPSETTING( 0x10, "C-Type" ) | |
| 1007 | PORT_DIPSETTING( 0x00, "D-Type" ) | |
| 1008 | PORT_DIPNAME( 0x20, 0x20, "Min. Bet For Bonus Play" ) PORT_DIPLOCATION("DSW4:6") /* OK */ | |
| 1009 | PORT_DIPSETTING( 0x20, "16 Bet" ) | |
| 1010 | PORT_DIPSETTING( 0x00, "8 Bet" ) | |
| 1011 | PORT_DIPNAME( 0x40, 0x40, "Reel Speed" ) PORT_DIPLOCATION("DSW4:7") /* OK */ | |
| 1012 | PORT_DIPSETTING( 0x40, DEF_STR( Low ) ) | |
| 1013 | PORT_DIPSETTING( 0x00, DEF_STR( High ) ) | |
| 1014 | PORT_DIPNAME( 0x80, 0x80, "Hopper Out By Coin A" ) PORT_DIPLOCATION("DSW4:8") /* not checked */ | |
| 1015 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1016 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1017 | ||
| 1018 | PORT_START("DSW5") | |
| 1019 | PORT_DIPNAME( 0x01, 0x01, "Display Of Doll On Demo" ) PORT_DIPLOCATION("DSW5:1") /* not checked */ | |
| 1020 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1021 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1022 | PORT_DIPNAME( 0x06, 0x06, "Coin In Limit" ) PORT_DIPLOCATION("DSW5:2,3") /* not checked */ | |
| 1023 | PORT_DIPSETTING( 0x06, "1,000" ) | |
| 1024 | PORT_DIPSETTING( 0x04, "5,000" ) | |
| 1025 | PORT_DIPSETTING( 0x02, "10,000" ) | |
| 1026 | PORT_DIPSETTING( 0x00, "20,000" ) | |
| 1027 | PORT_DIPNAME( 0x18, 0x18, "Condition For 3 Kind Of Bonus" ) PORT_DIPLOCATION("DSW5:4,5") /* not checked */ | |
| 1028 | PORT_DIPSETTING( 0x18, "12-7-1" ) | |
| 1029 | PORT_DIPSETTING( 0x10, "9-5-1" ) | |
| 1030 | PORT_DIPSETTING( 0x08, "6-3-1" ) | |
| 1031 | PORT_DIPSETTING( 0x00, "3-2-1" ) | |
| 1032 | PORT_DIPNAME( 0x20, 0x20, "Display Of Doll At All Fr. Bonus" ) PORT_DIPLOCATION("DSW5:6") /* not checked */ | |
| 1033 | PORT_DIPSETTING( 0x20, DEF_STR( Low ) ) | |
| 1034 | PORT_DIPSETTING( 0x00, DEF_STR( High ) ) | |
| 1035 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:7") /* listed as unused */ | |
| 1036 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1037 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1038 | PORT_DIPNAME( 0x80, 0x80, "Test Mode For Disp. Of Doll" ) PORT_DIPLOCATION("DSW5:8") /* not checked */ | |
| 1039 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1040 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1041 | INPUT_PORTS_END | |
| 1042 | ||
| 1043 | static INPUT_PORTS_START( cmasterc ) | |
| 1044 | PORT_START("IN0") | |
| 1045 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1046 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1047 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Big / Stop 1") | |
| 1048 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("D-UP / Stop 2") | |
| 1049 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Take Score") | |
| 1050 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Bet") | |
| 1051 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Small / Info / Stop 3") | |
| 1052 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Start") | |
| 1053 | ||
| 1054 | PORT_START("IN1") | |
| 1055 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1056 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1057 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2) PORT_IMPULSE(2) /* Coin B */ | |
| 1058 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1059 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ | |
| 1060 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ | |
| 1061 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_Q) PORT_NAME("Key In") | |
| 1062 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ | |
| 1063 | ||
| 1064 | PORT_START("IN2") | |
| 1065 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1066 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1067 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1068 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1069 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant") | |
| 1070 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1071 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 1072 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 1073 | ||
| 1074 | PORT_START("DSW1") | |
| 1075 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:1") /* OK */ | |
| 1076 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1077 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1078 | PORT_DIPNAME( 0x02, 0x02, "Hopper Out Switch" ) PORT_DIPLOCATION("DSW1:2") /* OK */ | |
| 1079 | PORT_DIPSETTING( 0x02, "Active Low" ) | |
| 1080 | PORT_DIPSETTING( 0x00, "Active High" ) | |
| 1081 | PORT_DIPNAME( 0x04, 0x00, "Payout Mode" ) PORT_DIPLOCATION("DSW1:3") /* OK */ | |
| 1082 | PORT_DIPSETTING( 0x04, "Payout Switch" ) | |
| 1083 | PORT_DIPSETTING( 0x00, "Automatic" ) | |
| 1084 | PORT_DIPNAME( 0x08, 0x00, "W-UP '7'" ) PORT_DIPLOCATION("DSW1:4") /* not checked */ | |
| 1085 | PORT_DIPSETTING( 0x08, "Loss" ) | |
| 1086 | PORT_DIPSETTING( 0x00, "Even" ) | |
| 1087 | PORT_DIPNAME( 0x10, 0x00, "W-UP Pay Rate" ) PORT_DIPLOCATION("DSW1:5") /* OK */ | |
| 1088 | PORT_DIPSETTING( 0x00, "80%" ) | |
| 1089 | PORT_DIPSETTING( 0x10, "90%" ) | |
| 1090 | PORT_DIPNAME( 0x20, 0x00, "W-UP Game" ) PORT_DIPLOCATION("DSW1:6") /* OK */ | |
| 1091 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1092 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1093 | PORT_DIPNAME( 0xc0, 0xc0, "Bet Max" ) PORT_DIPLOCATION("DSW1:7,8") /* OK */ | |
| 1094 | PORT_DIPSETTING( 0x00, "8" ) | |
| 1095 | PORT_DIPSETTING( 0x40, "16" ) | |
| 1096 | PORT_DIPSETTING( 0x80, "32" ) | |
| 1097 | PORT_DIPSETTING( 0xc0, "64" ) | |
| 1098 | ||
| 1099 | PORT_START("DSW2") | |
| 1100 | PORT_DIPNAME( 0x07, 0x03, "Main Game Pay Rate" ) PORT_DIPLOCATION("DSW2:1,2,3") /* OK */ | |
| 1101 | PORT_DIPSETTING( 0x07, "55%" ) | |
| 1102 | PORT_DIPSETTING( 0x06, "60%" ) | |
| 1103 | PORT_DIPSETTING( 0x05, "65%" ) | |
| 1104 | PORT_DIPSETTING( 0x04, "70%" ) | |
| 1105 | PORT_DIPSETTING( 0x03, "75%" ) | |
| 1106 | PORT_DIPSETTING( 0x02, "80%" ) | |
| 1107 | PORT_DIPSETTING( 0x01, "85%" ) | |
| 1108 | PORT_DIPSETTING( 0x00, "90%" ) | |
| 1109 | PORT_DIPNAME( 0x18, 0x00, "Hopper Limit" ) PORT_DIPLOCATION("DSW2:4,5") /* OK */ | |
| 1110 | PORT_DIPSETTING( 0x18, "300" ) | |
| 1111 | PORT_DIPSETTING( 0x10, "500" ) | |
| 1112 | PORT_DIPSETTING( 0x08, "1000" ) | |
| 1113 | PORT_DIPSETTING( 0x00, "Unlimited" ) | |
| 1114 | PORT_DIPNAME( 0x20, 0x00, "100 Odds Sound" ) PORT_DIPLOCATION("DSW2:6") /* not checked */ | |
| 1115 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1116 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) | |
| 1117 | PORT_DIPNAME( 0x40, 0x40, "Key-In Type" ) PORT_DIPLOCATION("DSW2:7") /* OK */ | |
| 1118 | PORT_DIPSETTING( 0x40, "A-Type" ) | |
| 1119 | PORT_DIPSETTING( 0x00, "B-Type" ) | |
| 1120 | PORT_DIPNAME( 0x80, 0x00, "Center Super 7 Bet Limit" ) PORT_DIPLOCATION("DSW2:8") /* related with DSW 4-6 */ | |
| 1121 | PORT_DIPSETTING( 0x80, "Unlimited" ) | |
| 1122 | PORT_DIPSETTING( 0x00, "Limited" ) | |
| 1123 | ||
| 1124 | PORT_START("DSW3") | |
| 1125 | PORT_DIPNAME( 0x03, 0x03, "Key In Rate" ) PORT_DIPLOCATION("DSW3:1,2") /* OK */ | |
| 1126 | PORT_DIPSETTING( 0x00, "1 Coin/10 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) /* A-Type */ | |
| 1127 | PORT_DIPSETTING( 0x01, "1 Coin/20 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 1128 | PORT_DIPSETTING( 0x02, "1 Coin/50 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 1129 | PORT_DIPSETTING( 0x03, "1 Coin/100 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 1130 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) /* B-Type */ | |
| 1131 | PORT_DIPSETTING( 0x01, "1 Coin/10 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 1132 | PORT_DIPSETTING( 0x02, "1 Coin/25 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 1133 | PORT_DIPSETTING( 0x03, "1 Coin/50 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 1134 | PORT_DIPNAME( 0x0c, 0x0c, "Coin A Rate" ) PORT_DIPLOCATION("DSW3:3,4") /* OK */ | |
| 1135 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) | |
| 1136 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) ) | |
| 1137 | PORT_DIPSETTING( 0x08, DEF_STR( 1C_5C ) ) | |
| 1138 | PORT_DIPSETTING( 0x0c, "1 Coin/10 Credits" ) | |
| 1139 | PORT_DIPNAME( 0x30, 0x30, "Coin D Rate" ) PORT_DIPLOCATION("DSW3:5,6") /* OK */ | |
| 1140 | PORT_DIPSETTING( 0x30, DEF_STR( 5C_1C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) /* C-Type */ | |
| 1141 | PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 1142 | PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 1143 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 1144 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) /* D-Type */ | |
| 1145 | PORT_DIPSETTING( 0x10, "1 Coin/10 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 1146 | PORT_DIPSETTING( 0x20, "1 Coin/25 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 1147 | PORT_DIPSETTING( 0x30, "1 Coin/50 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 1148 | PORT_DIPNAME( 0xc0, 0xc0, "Coin C Rate" ) PORT_DIPLOCATION("DSW3:7,8") /* OK */ | |
| 1149 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) | |
| 1150 | PORT_DIPSETTING( 0x40, DEF_STR( 1C_2C ) ) | |
| 1151 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_5C ) ) | |
| 1152 | PORT_DIPSETTING( 0xc0, "1 Coin/10 Credits" ) | |
| 1153 | ||
| 1154 | PORT_START("DSW4") | |
| 1155 | PORT_DIPNAME( 0x07, 0x05, "Credit Limit" ) PORT_DIPLOCATION("DSW4:1,2,3") /* OK */ | |
| 1156 | PORT_DIPSETTING( 0x07, "5,000" ) | |
| 1157 | PORT_DIPSETTING( 0x06, "10,000" ) | |
| 1158 | PORT_DIPSETTING( 0x05, "20,000" ) | |
| 1159 | PORT_DIPSETTING( 0x04, "30,000" ) | |
| 1160 | PORT_DIPSETTING( 0x03, "40,000" ) | |
| 1161 | PORT_DIPSETTING( 0x02, "50,000" ) | |
| 1162 | PORT_DIPSETTING( 0x01, "100,000" ) | |
| 1163 | PORT_DIPSETTING( 0x00, "Unlimited" ) | |
| 1164 | PORT_DIPNAME( 0x08, 0x00, "Display Of Payout Limit" ) PORT_DIPLOCATION("DSW4:4") /* OK */ | |
| 1165 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 1166 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1167 | PORT_DIPNAME( 0x10, 0x10, "Type Of Coin D" ) PORT_DIPLOCATION("DSW4:5") /* OK */ | |
| 1168 | PORT_DIPSETTING( 0x10, "C-Type" ) | |
| 1169 | PORT_DIPSETTING( 0x00, "D-Type" ) | |
| 1170 | PORT_DIPNAME( 0x20, 0x20, "Min. Bet For Bonus Play" ) PORT_DIPLOCATION("DSW4:6") /* OK */ | |
| 1171 | PORT_DIPSETTING( 0x20, "16 Bet" ) | |
| 1172 | PORT_DIPSETTING( 0x00, "8 Bet" ) | |
| 1173 | PORT_DIPNAME( 0x40, 0x40, "Reel Speed" ) PORT_DIPLOCATION("DSW4:7") /* OK */ | |
| 1174 | PORT_DIPSETTING( 0x40, DEF_STR( Low ) ) | |
| 1175 | PORT_DIPSETTING( 0x00, DEF_STR( High ) ) | |
| 1176 | PORT_DIPNAME( 0x80, 0x80, "Hopper Out By Coin A" ) PORT_DIPLOCATION("DSW4:8") /* not checked */ | |
| 1177 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1178 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1179 | ||
| 1180 | PORT_START("DSW5") | |
| 1181 | PORT_DIPNAME( 0x01, 0x01, "Display Of Doll On Demo" ) PORT_DIPLOCATION("DSW5:1") /* not checked */ | |
| 1182 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1183 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1184 | PORT_DIPNAME( 0x06, 0x06, "Coin In Limit" ) PORT_DIPLOCATION("DSW5:2,3") /* not checked */ | |
| 1185 | PORT_DIPSETTING( 0x06, "1,000" ) | |
| 1186 | PORT_DIPSETTING( 0x04, "5,000" ) | |
| 1187 | PORT_DIPSETTING( 0x02, "10,000" ) | |
| 1188 | PORT_DIPSETTING( 0x00, "20,000" ) | |
| 1189 | PORT_DIPNAME( 0x18, 0x18, "Condition For 3 Kind Of Bonus" ) PORT_DIPLOCATION("DSW5:4,5") /* not checked */ | |
| 1190 | PORT_DIPSETTING( 0x18, "12-7-1" ) | |
| 1191 | PORT_DIPSETTING( 0x10, "9-5-1" ) | |
| 1192 | PORT_DIPSETTING( 0x08, "6-3-1" ) | |
| 1193 | PORT_DIPSETTING( 0x00, "3-2-1" ) | |
| 1194 | PORT_DIPNAME( 0x20, 0x20, "Display Of Doll At All Fr. Bonus" ) PORT_DIPLOCATION("DSW5:6") /* not checked */ | |
| 1195 | PORT_DIPSETTING( 0x20, DEF_STR( Low ) ) | |
| 1196 | PORT_DIPSETTING( 0x00, DEF_STR( High ) ) | |
| 1197 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:7") /* listed as unused */ | |
| 1198 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1199 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1200 | PORT_DIPNAME( 0x80, 0x80, "Test Mode For Disp. Of Doll" ) PORT_DIPLOCATION("DSW5:8") /* not checked */ | |
| 1201 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1202 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1203 | INPUT_PORTS_END | |
| 1204 | ||
| 1205 | static INPUT_PORTS_START( cmast91 ) | |
| 1206 | PORT_START("IN0") | |
| 1207 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1208 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1209 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Big") | |
| 1210 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("D-UP") | |
| 1211 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Take") | |
| 1212 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Bet") | |
| 1213 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Small / Info") | |
| 1214 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Start") | |
| 1215 | ||
| 1216 | PORT_START("IN1") | |
| 1217 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1218 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1219 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2) PORT_IMPULSE(2) /* Coin B */ | |
| 1220 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1221 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ | |
| 1222 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ | |
| 1223 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_Q) PORT_NAME("Key In") | |
| 1224 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ | |
| 1225 | ||
| 1226 | PORT_START("IN2") | |
| 1227 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1228 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1229 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1230 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1231 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant") | |
| 1232 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1233 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 1234 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 1235 | ||
| 1236 | PORT_START("DSW1") | |
| 1237 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:1") /* OK */ | |
| 1238 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1239 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1240 | PORT_DIPNAME( 0x02, 0x02, "Hopper Out Switch" ) PORT_DIPLOCATION("DSW1:2") /* OK */ | |
| 1241 | PORT_DIPSETTING( 0x02, "Active Low" ) | |
| 1242 | PORT_DIPSETTING( 0x00, "Active High" ) | |
| 1243 | PORT_DIPNAME( 0x04, 0x00, "Payout Mode" ) PORT_DIPLOCATION("DSW1:3") /* OK */ | |
| 1244 | PORT_DIPSETTING( 0x04, "Payout Switch" ) | |
| 1245 | PORT_DIPSETTING( 0x00, "Automatic" ) | |
| 1246 | PORT_DIPNAME( 0x08, 0x00, "W-UP '7'" ) PORT_DIPLOCATION("DSW1:4") /* not checked */ | |
| 1247 | PORT_DIPSETTING( 0x08, "Loss" ) | |
| 1248 | PORT_DIPSETTING( 0x00, "Even" ) | |
| 1249 | PORT_DIPNAME( 0x10, 0x00, "W-UP Pay Rate" ) PORT_DIPLOCATION("DSW1:5") /* OK */ | |
| 1250 | PORT_DIPSETTING( 0x00, "80%" ) | |
| 1251 | PORT_DIPSETTING( 0x10, "90%" ) | |
| 1252 | PORT_DIPNAME( 0x20, 0x00, "W-UP Game" ) PORT_DIPLOCATION("DSW1:6") /* OK */ | |
| 1253 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1254 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1255 | PORT_DIPNAME( 0xc0, 0xc0, "Bet Max" ) PORT_DIPLOCATION("DSW1:7,8") /* OK */ | |
| 1256 | PORT_DIPSETTING( 0x00, "8" ) | |
| 1257 | PORT_DIPSETTING( 0x40, "16" ) | |
| 1258 | PORT_DIPSETTING( 0x80, "32" ) | |
| 1259 | PORT_DIPSETTING( 0xc0, "64" ) | |
| 1260 | ||
| 1261 | PORT_START("DSW2") | |
| 1262 | PORT_DIPNAME( 0x07, 0x03, "Main Game Pay Rate" ) PORT_DIPLOCATION("DSW2:1,2,3") /* OK */ | |
| 1263 | PORT_DIPSETTING( 0x07, "45%" ) | |
| 1264 | PORT_DIPSETTING( 0x06, "50%" ) | |
| 1265 | PORT_DIPSETTING( 0x05, "55%" ) | |
| 1266 | PORT_DIPSETTING( 0x04, "60%" ) | |
| 1267 | PORT_DIPSETTING( 0x03, "65%" ) | |
| 1268 | PORT_DIPSETTING( 0x02, "70%" ) | |
| 1269 | PORT_DIPSETTING( 0x01, "75%" ) | |
| 1270 | PORT_DIPSETTING( 0x00, "80%" ) | |
| 1271 | PORT_DIPNAME( 0x18, 0x00, "Hopper Limit" ) PORT_DIPLOCATION("DSW2:4,5") /* OK */ | |
| 1272 | PORT_DIPSETTING( 0x18, "300" ) | |
| 1273 | PORT_DIPSETTING( 0x10, "500" ) | |
| 1274 | PORT_DIPSETTING( 0x08, "1000" ) | |
| 1275 | PORT_DIPSETTING( 0x00, "Unlimited" ) | |
| 1276 | PORT_DIPNAME( 0x20, 0x00, "100 Odds Sound" ) PORT_DIPLOCATION("DSW2:6") /* not checked */ | |
| 1277 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1278 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) | |
| 1279 | PORT_DIPNAME( 0x40, 0x40, "Key-In Type" ) PORT_DIPLOCATION("DSW2:7") /* OK */ | |
| 1280 | PORT_DIPSETTING( 0x40, "A-Type" ) | |
| 1281 | PORT_DIPSETTING( 0x00, "B-Type" ) | |
| 1282 | PORT_DIPNAME( 0x80, 0x00, "Center Super 7 Bet Limit" ) PORT_DIPLOCATION("DSW2:8") /* related with DSW 4-6 */ | |
| 1283 | PORT_DIPSETTING( 0x80, "Unlimited" ) | |
| 1284 | PORT_DIPSETTING( 0x00, "Limited" ) | |
| 1285 | ||
| 1286 | PORT_START("DSW3") | |
| 1287 | PORT_DIPNAME( 0x03, 0x03, "Key In Rate" ) PORT_DIPLOCATION("DSW3:1,2") /* OK */ | |
| 1288 | PORT_DIPSETTING( 0x00, "1 Coin/10 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) /* A-Type */ | |
| 1289 | PORT_DIPSETTING( 0x01, "1 Coin/20 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 1290 | PORT_DIPSETTING( 0x02, "1 Coin/50 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 1291 | PORT_DIPSETTING( 0x03, "1 Coin/100 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 1292 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) /* B-Type */ | |
| 1293 | PORT_DIPSETTING( 0x01, "1 Coin/10 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 1294 | PORT_DIPSETTING( 0x02, "1 Coin/25 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 1295 | PORT_DIPSETTING( 0x03, "1 Coin/50 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 1296 | PORT_DIPNAME( 0x0c, 0x0c, "Coin A Rate" ) PORT_DIPLOCATION("DSW3:3,4") /* OK */ | |
| 1297 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) | |
| 1298 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) ) | |
| 1299 | PORT_DIPSETTING( 0x08, DEF_STR( 1C_5C ) ) | |
| 1300 | PORT_DIPSETTING( 0x0c, "1 Coin/10 Credits" ) | |
| 1301 | PORT_DIPNAME( 0x30, 0x30, "Coin D Rate" ) PORT_DIPLOCATION("DSW3:5,6") /* OK */ | |
| 1302 | PORT_DIPSETTING( 0x30, DEF_STR( 5C_1C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) /* C-Type */ | |
| 1303 | PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 1304 | PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 1305 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 1306 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) /* D-Type */ | |
| 1307 | PORT_DIPSETTING( 0x10, "1 Coin/10 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 1308 | PORT_DIPSETTING( 0x20, "1 Coin/25 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 1309 | PORT_DIPSETTING( 0x30, "1 Coin/50 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 1310 | PORT_DIPNAME( 0xc0, 0xc0, "Coin C Rate" ) PORT_DIPLOCATION("DSW3:7,8") /* OK */ | |
| 1311 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) | |
| 1312 | PORT_DIPSETTING( 0x40, DEF_STR( 1C_2C ) ) | |
| 1313 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_5C ) ) | |
| 1314 | PORT_DIPSETTING( 0xc0, "1 Coin/10 Credits" ) | |
| 1315 | ||
| 1316 | PORT_START("DSW4") | |
| 1317 | PORT_DIPNAME( 0x07, 0x06, "Credit Limit" ) PORT_DIPLOCATION("DSW4:1,2,3") /* OK */ | |
| 1318 | PORT_DIPSETTING( 0x07, "5,000" ) | |
| 1319 | PORT_DIPSETTING( 0x06, "10,000" ) | |
| 1320 | PORT_DIPSETTING( 0x05, "20,000" ) | |
| 1321 | PORT_DIPSETTING( 0x04, "30,000" ) | |
| 1322 | PORT_DIPSETTING( 0x03, "40,000" ) | |
| 1323 | PORT_DIPSETTING( 0x02, "50,000" ) | |
| 1324 | PORT_DIPSETTING( 0x01, "100,000" ) | |
| 1325 | PORT_DIPSETTING( 0x00, "Unlimited" ) | |
| 1326 | PORT_DIPNAME( 0x08, 0x00, "Display Of Payout Limit" ) PORT_DIPLOCATION("DSW4:4") /* OK */ | |
| 1327 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 1328 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1329 | PORT_DIPNAME( 0x10, 0x10, "Type Of Coin D" ) PORT_DIPLOCATION("DSW4:5") /* OK */ | |
| 1330 | PORT_DIPSETTING( 0x10, "C-Type" ) | |
| 1331 | PORT_DIPSETTING( 0x00, "D-Type" ) | |
| 1332 | PORT_DIPNAME( 0x20, 0x20, "Min. Bet For Bonus Play" ) PORT_DIPLOCATION("DSW4:6") /* OK */ | |
| 1333 | PORT_DIPSETTING( 0x20, "16 Bet" ) | |
| 1334 | PORT_DIPSETTING( 0x00, "8 Bet" ) | |
| 1335 | PORT_DIPNAME( 0x40, 0x00, "Reel Speed" ) PORT_DIPLOCATION("DSW4:7") /* OK */ | |
| 1336 | PORT_DIPSETTING( 0x40, DEF_STR( Low ) ) | |
| 1337 | PORT_DIPSETTING( 0x00, DEF_STR( High ) ) | |
| 1338 | PORT_DIPNAME( 0x80, 0x80, "Hopper Out By Coin A" ) PORT_DIPLOCATION("DSW4:8") /* not checked */ | |
| 1339 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1340 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1341 | ||
| 1342 | PORT_START("DSW5") | |
| 1343 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:1") /* no whores here */ | |
| 1344 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1345 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1346 | PORT_DIPNAME( 0x06, 0x06, "Coin In Limit" ) PORT_DIPLOCATION("DSW5:2,3") /* not checked */ | |
| 1347 | PORT_DIPSETTING( 0x06, "1,000" ) | |
| 1348 | PORT_DIPSETTING( 0x04, "5,000" ) | |
| 1349 | PORT_DIPSETTING( 0x02, "10,000" ) | |
| 1350 | PORT_DIPSETTING( 0x00, "20,000" ) | |
| 1351 | PORT_DIPNAME( 0x18, 0x18, "Condition For 3 Kind Of Bonus" ) PORT_DIPLOCATION("DSW5:4,5") /* not checked */ | |
| 1352 | PORT_DIPSETTING( 0x18, "12-7-1" ) | |
| 1353 | PORT_DIPSETTING( 0x10, "9-5-1" ) | |
| 1354 | PORT_DIPSETTING( 0x08, "6-3-1" ) | |
| 1355 | PORT_DIPSETTING( 0x00, "3-2-1" ) | |
| 1356 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:6") /* not checked */ | |
| 1357 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1358 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1359 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:7") /* listed as unused */ | |
| 1360 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1361 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1362 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:8") /* no whores in demo */ | |
| 1363 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1364 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1365 | INPUT_PORTS_END | |
| 1366 | ||
| 1367 | ||
| 782 | 1368 | static INPUT_PORTS_START( goldstar ) |
| 783 | 1369 | PORT_START("IN0") |
| 784 | 1370 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 785 | 1371 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 786 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Bet Red/2") | |
| 787 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Stop 3/Small/1/Info") | |
| 788 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Bet Blue/Double/3") | |
| 789 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("Stop 1/Take") | |
| 790 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Stop 2/Big/Ticket") | |
| 791 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Start/Stop All/4") | |
| 1372 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Bet Red / 2") | |
| 1373 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Stop 3 / Small / 1 / Info") | |
| 1374 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Bet Blue / D-UP / 3") | |
| 1375 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("Stop 1 / Take") | |
| 1376 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Stop 2 / Big / Ticket") | |
| 1377 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Start / Stop All / 4") | |
| 792 | 1378 | |
| 793 | 1379 | PORT_START("IN1") |
| 794 | 1380 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| r4135 | r4136 | |
| 909 | 1495 | PORT_START("IN0") |
| 910 | 1496 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 911 | 1497 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 912 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Stop 2 / Big / Bonus Game") PORT_CODE(KEYCODE_X) | |
| 913 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Blue Bet / D-UP / Card 3") PORT_CODE(KEYCODE_B) | |
| 914 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Stop 1 / Take") PORT_CODE(KEYCODE_Z) | |
| 915 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Red Bet / Card 2") PORT_CODE(KEYCODE_V) | |
| 916 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Stop 3 / Small / Info / Card 1") PORT_CODE(KEYCODE_C) | |
| 917 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Start / Stop All / Card 4") PORT_CODE(KEYCODE_N) | |
| 1498 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Stop 2 / Big / Bonus Game") | |
| 1499 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Blue Bet / D-UP / Card 3") | |
| 1500 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("Stop 1 / Take") | |
| 1501 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Red Bet / Card 2") | |
| 1502 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Stop 3 / Small / Info / Card 1") | |
| 1503 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Start / Stop All / Card 4") | |
| 918 | 1504 | |
| 919 | 1505 | PORT_START("IN1") |
| 920 | 1506 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r4135 | r4136 | |
| 923 | 1509 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 924 | 1510 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ |
| 925 | 1511 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ |
| 926 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 1512 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 927 | 1513 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ |
| 928 | 1514 | |
| 929 | 1515 | PORT_START("IN2") |
| r4135 | r4136 | |
| 931 | 1517 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 932 | 1518 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 933 | 1519 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 934 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key Out / Attendant" | |
| 1520 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant" | |
| 935 | 1521 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 936 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_9) | |
| 937 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats") PORT_CODE(KEYCODE_0) | |
| 1522 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 1523 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 938 | 1524 | |
| 939 | 1525 | PORT_START("IN3") |
| 940 | 1526 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r4135 | r4136 | |
| 996 | 1582 | PORT_DIPSETTING( 0x80, "Unlimited" ) |
| 997 | 1583 | PORT_DIPSETTING( 0x00, "Limited" ) |
| 998 | 1584 | |
| 999 | PORT_START("DSW3") /* some of these | |
| 1585 | PORT_START("DSW3") /* some of these could be wrong */ | |
| 1000 | 1586 | PORT_DIPNAME( 0x03, 0x03, "Key In Rate" ) PORT_DIPLOCATION("DSW3:1,2") |
| 1001 | 1587 | PORT_DIPSETTING( 0x00, "1 Coin/10 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) // A-Type |
| 1002 | 1588 | PORT_DIPSETTING( 0x01, "1 Coin/20 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) |
| r4135 | r4136 | |
| 1077 | 1663 | PORT_DIPSETTING( 0x00, "100 Credits / 100 Pulses" ) |
| 1078 | 1664 | INPUT_PORTS_END |
| 1079 | 1665 | |
| 1666 | static INPUT_PORTS_START( chry10 ) | |
| 1667 | PORT_START("IN0") | |
| 1668 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1669 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1670 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Stop 2 / Big / Bonus Game") | |
| 1671 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Blue Bet / D-UP / Card 3") | |
| 1672 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("Stop 1 / Take") | |
| 1673 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Red Bet / Card 2") | |
| 1674 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Stop 3 / Small / Info / Card 1") | |
| 1675 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Start / Stop All / Card 4") | |
| 1676 | ||
| 1677 | PORT_START("IN1") | |
| 1678 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1679 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1680 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2) PORT_IMPULSE(2) /* Coin B */ | |
| 1681 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1682 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ | |
| 1683 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ | |
| 1684 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_Q) PORT_NAME("Key In") | |
| 1685 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ | |
| 1686 | ||
| 1687 | PORT_START("IN2") | |
| 1688 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1689 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1690 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1691 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1692 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant") | |
| 1693 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1694 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 1695 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 1696 | ||
| 1697 | PORT_START("IN3") | |
| 1698 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1699 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1700 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1701 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1702 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1703 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1704 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1705 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1706 | ||
| 1707 | PORT_START("DSW1") | |
| 1708 | PORT_DIPNAME( 0x01, 0x00, "Game Style" ) PORT_DIPLOCATION("DSW1:1") /* OK */ | |
| 1709 | PORT_DIPSETTING( 0x01, "Tokens" ) | |
| 1710 | PORT_DIPSETTING( 0x00, "Ticket" ) | |
| 1711 | PORT_DIPNAME( 0x02, 0x02, "Hopper Out Switch" ) PORT_DIPLOCATION("DSW1:2") /* OK */ | |
| 1712 | PORT_DIPSETTING( 0x02, "Active Low" ) | |
| 1713 | PORT_DIPSETTING( 0x00, "Active High" ) | |
| 1714 | PORT_DIPNAME( 0x04, 0x04, "Payout Mode" ) PORT_DIPLOCATION("DSW1:3") /* OK */ | |
| 1715 | PORT_DIPSETTING( 0x04, "Payout Switch" ) | |
| 1716 | PORT_DIPSETTING( 0x00, "Automatic" ) | |
| 1717 | PORT_DIPNAME( 0x08, 0x00, "W-UP '7'" ) PORT_DIPLOCATION("DSW1:4") | |
| 1718 | PORT_DIPSETTING( 0x08, "Loss" ) | |
| 1719 | PORT_DIPSETTING( 0x00, "Even" ) | |
| 1720 | PORT_DIPNAME( 0x10, 0x10, "W-UP Pay Rate" ) PORT_DIPLOCATION("DSW1:5") /* OK */ | |
| 1721 | PORT_DIPSETTING( 0x10, "80%" ) | |
| 1722 | PORT_DIPSETTING( 0x00, "90%" ) | |
| 1723 | PORT_DIPNAME( 0x20, 0x20, "W-UP Game" ) PORT_DIPLOCATION("DSW1:6") /* OK */ | |
| 1724 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1725 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) | |
| 1726 | PORT_DIPNAME( 0xc0, 0x00, "Bet Max" ) PORT_DIPLOCATION("DSW1:7,8") /* OK */ | |
| 1727 | PORT_DIPSETTING( 0xc0, "8" ) | |
| 1728 | PORT_DIPSETTING( 0x80, "16" ) | |
| 1729 | PORT_DIPSETTING( 0x40, "32" ) | |
| 1730 | PORT_DIPSETTING( 0x00, "64" ) | |
| 1731 | ||
| 1732 | PORT_START("DSW2") | |
| 1733 | PORT_DIPNAME( 0x07, 0x04, "Main Game Pay Rate" ) PORT_DIPLOCATION("DSW2:1,2,3") /* OK */ | |
| 1734 | PORT_DIPSETTING( 0x00, "40%" ) | |
| 1735 | PORT_DIPSETTING( 0x01, "45%" ) | |
| 1736 | PORT_DIPSETTING( 0x02, "50%" ) | |
| 1737 | PORT_DIPSETTING( 0x03, "55%" ) | |
| 1738 | PORT_DIPSETTING( 0x04, "60%" ) | |
| 1739 | PORT_DIPSETTING( 0x05, "65%" ) | |
| 1740 | PORT_DIPSETTING( 0x06, "70%" ) | |
| 1741 | PORT_DIPSETTING( 0x07, "80%" ) | |
| 1742 | PORT_DIPNAME( 0x18, 0x00, "Hopper Limit" ) PORT_DIPLOCATION("DSW2:4,5") | |
| 1743 | PORT_DIPSETTING( 0x18, "300" ) | |
| 1744 | PORT_DIPSETTING( 0x10, "500" ) | |
| 1745 | PORT_DIPSETTING( 0x08, "1000" ) | |
| 1746 | PORT_DIPSETTING( 0x00, "Unlimited" ) | |
| 1747 | PORT_DIPNAME( 0x20, 0x00, "100 Odds Sound" ) PORT_DIPLOCATION("DSW2:6") | |
| 1748 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1749 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) | |
| 1750 | PORT_DIPNAME( 0x40, 0x00, "Key-In Type" ) PORT_DIPLOCATION("DSW2:7") /* OK */ | |
| 1751 | PORT_DIPSETTING( 0x40, "B-Type" ) | |
| 1752 | PORT_DIPSETTING( 0x00, "A-Type" ) | |
| 1753 | PORT_DIPNAME( 0x80, 0x00, "Center Super 7 Bet Limit" ) PORT_DIPLOCATION("DSW2:8") /* related with DSW 4-6 */ | |
| 1754 | PORT_DIPSETTING( 0x80, "Unlimited" ) | |
| 1755 | PORT_DIPSETTING( 0x00, "Limited" ) | |
| 1756 | ||
| 1757 | PORT_START("DSW3") /* seems ok */ | |
| 1758 | PORT_DIPNAME( 0x03, 0x03, "Key In Rate" ) PORT_DIPLOCATION("DSW3:1,2") /* OK */ | |
| 1759 | PORT_DIPSETTING( 0x00, "1 Coin/10 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) // A-Type | |
| 1760 | PORT_DIPSETTING( 0x01, "1 Coin/20 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 1761 | PORT_DIPSETTING( 0x02, "1 Coin/50 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 1762 | PORT_DIPSETTING( 0x03, "1 Coin/100 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00) | |
| 1763 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) // B-Type | |
| 1764 | PORT_DIPSETTING( 0x01, "1 Coin/10 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 1765 | PORT_DIPSETTING( 0x02, "1 Coin/25 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 1766 | PORT_DIPSETTING( 0x03, "1 Coin/50 Credits" ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) | |
| 1767 | PORT_DIPNAME( 0x0c, 0x0c, "Coin A Rate" ) PORT_DIPLOCATION("DSW3:3,4") /* OK */ | |
| 1768 | PORT_DIPSETTING( 0x00, "1 Coin/10 Credits" ) | |
| 1769 | PORT_DIPSETTING( 0x04, "1 Coin/20 Credits" ) | |
| 1770 | PORT_DIPSETTING( 0x08, "1 Coin/50 Credits" ) | |
| 1771 | PORT_DIPSETTING( 0x0c, "1 Coin/100 Credits" ) | |
| 1772 | PORT_DIPNAME( 0x30, 0x30, "Coin D Rate" ) PORT_DIPLOCATION("DSW3:5,6") /* OK */ | |
| 1773 | PORT_DIPSETTING( 0x30, "5 Coin/10 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) // C-Type | |
| 1774 | PORT_DIPSETTING( 0x20, "2 Coin/10 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 1775 | PORT_DIPSETTING( 0x10, "1 Coin/10 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 1776 | PORT_DIPSETTING( 0x00, "1 Coin/20 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x10) | |
| 1777 | PORT_DIPSETTING( 0x00, "1 Ticket/Coin / 50 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 1778 | PORT_DIPSETTING( 0x10, "1 Ticket/Coin / 100 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 1779 | PORT_DIPSETTING( 0x20, "1 Ticket/Coin / 200 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) | |
| 1780 | PORT_DIPSETTING( 0x30, "1 Ticket/Coin / 500 Credits" ) PORT_CONDITION("DSW4",0x10,PORTCOND_EQUALS,0x00) // D-Type | |
| 1781 | PORT_DIPNAME( 0xc0, 0xc0, "Coin C Rate" ) PORT_DIPLOCATION("DSW3:7,8") /* OK */ | |
| 1782 | PORT_DIPSETTING( 0x00, "1 Coin/10 Credits" ) | |
| 1783 | PORT_DIPSETTING( 0x40, "1 Coin/20 Credits" ) | |
| 1784 | PORT_DIPSETTING( 0x80, "1 Coin/50 Credits" ) | |
| 1785 | PORT_DIPSETTING( 0xc0, "1 Coin/100 Credits" ) | |
| 1786 | ||
| 1787 | PORT_START("DSW4") | |
| 1788 | PORT_DIPNAME( 0x07, 0x06, "Credit Limit" ) PORT_DIPLOCATION("DSW4:1,2,3") /* OK */ | |
| 1789 | PORT_DIPSETTING( 0x07, "5,000" ) | |
| 1790 | PORT_DIPSETTING( 0x06, "10,000" ) | |
| 1791 | PORT_DIPSETTING( 0x05, "20,000" ) | |
| 1792 | PORT_DIPSETTING( 0x04, "30,000" ) | |
| 1793 | PORT_DIPSETTING( 0x03, "40,000" ) | |
| 1794 | PORT_DIPSETTING( 0x02, "50,000" ) | |
| 1795 | PORT_DIPSETTING( 0x01, "100,000" ) | |
| 1796 | PORT_DIPSETTING( 0x00, "Unlimited" ) | |
| 1797 | PORT_DIPNAME( 0x08, 0x00, "Display Of Credit Limit" ) PORT_DIPLOCATION("DSW4:4") /* OK */ | |
| 1798 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 1799 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1800 | PORT_DIPNAME( 0x10, 0x10, "Type Of Coin D" ) PORT_DIPLOCATION("DSW4:5") /* OK */ | |
| 1801 | PORT_DIPSETTING( 0x10, "D-Type (Tokens)" ) | |
| 1802 | PORT_DIPSETTING( 0x00, "C-Type (Ticket)" ) | |
| 1803 | PORT_DIPNAME( 0x20, 0x00, "Bonus Play Min.Bet" ) PORT_DIPLOCATION("DSW4:6") /* OK */ | |
| 1804 | PORT_DIPSETTING( 0x20, "16 Bet" ) | |
| 1805 | PORT_DIPSETTING( 0x00, "8 Bet" ) | |
| 1806 | PORT_DIPNAME( 0x40, 0x00, "Reel Speed" ) PORT_DIPLOCATION("DSW4:7") /* OK */ | |
| 1807 | PORT_DIPSETTING( 0x40, DEF_STR( Low ) ) | |
| 1808 | PORT_DIPSETTING( 0x00, DEF_STR( High ) ) | |
| 1809 | PORT_DIPNAME( 0x80, 0x80, "Coin A Mode" ) PORT_DIPLOCATION("DSW4:8") /* OK */ | |
| 1810 | PORT_DIPSETTING( 0x80, "Unexchange" ) | |
| 1811 | PORT_DIPSETTING( 0x00, "Exchange" ) | |
| 1812 | ||
| 1813 | PORT_START("DSW5") | |
| 1814 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSW5:1") | |
| 1815 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1816 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1817 | PORT_DIPNAME( 0x06, 0x00, "Coin In Limit" ) PORT_DIPLOCATION("DSW5:2,3") | |
| 1818 | PORT_DIPSETTING( 0x06, "1000" ) | |
| 1819 | PORT_DIPSETTING( 0x04, "5000" ) | |
| 1820 | PORT_DIPSETTING( 0x02, "10000" ) | |
| 1821 | PORT_DIPSETTING( 0x00, "20000" ) | |
| 1822 | PORT_DIPNAME( 0x18, 0x10, "Coin Out Rate" ) PORT_DIPLOCATION("DSW5:4,5") | |
| 1823 | PORT_DIPSETTING( 0x00, "100 Credits / 1 Pulse" ) | |
| 1824 | PORT_DIPSETTING( 0x08, "100 Credits / 5 Pulses" ) | |
| 1825 | PORT_DIPSETTING( 0x10, "100 Credits / 10 Pulses" ) | |
| 1826 | PORT_DIPSETTING( 0x18, "100 Credits / 100 Pulses" ) | |
| 1827 | PORT_DIPNAME( 0x20, 0x00, "W-UP Girl" ) PORT_DIPLOCATION("DSW5:6") | |
| 1828 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1829 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1830 | PORT_DIPNAME( 0xc0, 0x40, "Coin In Rate" ) PORT_DIPLOCATION("DSW5:7,8") | |
| 1831 | PORT_DIPSETTING( 0xc0, "100 Credits / 1 Pulse" ) | |
| 1832 | PORT_DIPSETTING( 0x40, "100 Credits / 5 Pulses" ) | |
| 1833 | PORT_DIPSETTING( 0x80, "100 Credits / 10 Pulses" ) | |
| 1834 | PORT_DIPSETTING( 0x00, "100 Credits / 100 Pulses" ) | |
| 1835 | INPUT_PORTS_END | |
| 1836 | ||
| 1080 | 1837 | static INPUT_PORTS_START( ncb3 ) |
| 1081 | 1838 | PORT_START("IN0") |
| 1082 | 1839 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1083 | 1840 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1084 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 - Stop 2 / Big / Bonus Game / Switch Controls") PORT_CODE(KEYCODE_X) | |
| 1085 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 - Blue Bet / D-UP / Card 3") PORT_CODE(KEYCODE_B) | |
| 1086 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 - Stop 1 / Take") PORT_CODE(KEYCODE_Z) | |
| 1087 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 - Red Bet / Card 2") PORT_CODE(KEYCODE_V) | |
| 1088 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 - Stop 3 / Small / Info / Card 1") PORT_CODE(KEYCODE_C) | |
| 1089 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 - Start / Stop All / Card 4") PORT_CODE(KEYCODE_N) | |
| 1841 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("P1 - Stop 2 / Big / Bonus Game / Switch Controls") | |
| 1842 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("P1 - Blue Bet / D-UP / Card 3") | |
| 1843 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("P1 - Stop 1 / Take") | |
| 1844 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("P1 - Red Bet / Card 2") | |
| 1845 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("P1 - Stop 3 / Small / Info / Card 1") | |
| 1846 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("P1 - Start / Stop All / Card 4") | |
| 1090 | 1847 | |
| 1091 | 1848 | PORT_START("IN1") |
| 1092 | 1849 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r4135 | r4136 | |
| 1095 | 1852 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1096 | 1853 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ |
| 1097 | 1854 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ |
| 1098 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 1855 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 1099 | 1856 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ |
| 1100 | 1857 | |
| 1101 | 1858 | PORT_START("IN2") |
| r4135 | r4136 | |
| 1103 | 1860 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1104 | 1861 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1105 | 1862 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1106 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key Out / Attendant" | |
| 1863 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant" | |
| 1107 | 1864 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1108 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_9) | |
| 1109 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats") PORT_CODE(KEYCODE_0) | |
| 1865 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 1866 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 1110 | 1867 | |
| 1111 | 1868 | PORT_START("IN3") |
| 1112 | 1869 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1113 | 1870 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1114 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P2 - Stop 2 / Big / Bonus Game / Switch Controls") PORT_CODE(KEYCODE_S) | |
| 1115 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("P2 - Blue Bet / D-UP / Card 3") PORT_CODE(KEYCODE_G) | |
| 1116 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("P2 - Stop 1 / Take") PORT_CODE(KEYCODE_A) | |
| 1117 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("P2 - Red Bet / Card 2") PORT_CODE(KEYCODE_F) | |
| 1118 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("P2 - Stop 3 / Small / Info / Card 1") PORT_CODE(KEYCODE_D) | |
| 1119 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("P2 - Start / Stop All / Card 4") PORT_CODE(KEYCODE_H) | |
| 1871 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_CODE(KEYCODE_S) PORT_NAME("P2 - Stop 2 / Big / Bonus Game / Switch Controls") | |
| 1872 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_CODE(KEYCODE_G) PORT_NAME("P2 - Blue Bet / D-UP / Card 3") | |
| 1873 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_CODE(KEYCODE_A) PORT_NAME("P2 - Stop 1 / Take") | |
| 1874 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_CODE(KEYCODE_F) PORT_NAME("P2 - Red Bet / Card 2") | |
| 1875 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_CODE(KEYCODE_D) PORT_NAME("P2 - Stop 3 / Small / Info / Card 1") | |
| 1876 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_CODE(KEYCODE_H) PORT_NAME("P2 - Start / Stop All / Card 4") | |
| 1120 | 1877 | |
| 1121 | 1878 | /* to check DIP switches... */ |
| 1122 | 1879 | PORT_START("DSW1") |
| r4135 | r4136 | |
| 1253 | 2010 | PORT_START("IN0") |
| 1254 | 2011 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1255 | 2012 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1256 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 - Stop 2 / Big / Bonus Game / Switch Controls") PORT_CODE(KEYCODE_X) | |
| 1257 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 - Blue Bet / D-UP / Card 3") PORT_CODE(KEYCODE_B) | |
| 1258 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 - Stop 1 / Take") PORT_CODE(KEYCODE_Z) | |
| 1259 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 - Red Bet / Card 2") PORT_CODE(KEYCODE_V) | |
| 1260 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 - Stop 3 / Small / Info / Card 1") PORT_CODE(KEYCODE_C) | |
| 1261 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 - Start / Stop All / Card 4") PORT_CODE(KEYCODE_N) | |
| 2013 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("P1 - Stop 2 / Big / Bonus Game / Switch Controls") | |
| 2014 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("P1 - Blue Bet / D-UP / Card 3") | |
| 2015 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("P1 - Stop 1 / Take") | |
| 2016 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("P1 - Red Bet / Card 2") | |
| 2017 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("P1 - Stop 3 / Small / Info / Card 1") | |
| 2018 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("P1 - Start / Stop All / Card 4") | |
| 1262 | 2019 | |
| 1263 | 2020 | PORT_START("IN1") |
| 1264 | 2021 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r4135 | r4136 | |
| 1267 | 2024 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1268 | 2025 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ |
| 1269 | 2026 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ |
| 1270 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 2027 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 1271 | 2028 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ |
| 1272 | 2029 | |
| 1273 | 2030 | PORT_START("IN2") |
| r4135 | r4136 | |
| 1275 | 2032 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1276 | 2033 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1277 | 2034 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1278 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key Out / Attendant" | |
| 2035 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant" | |
| 1279 | 2036 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1280 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_9) | |
| 1281 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats") PORT_CODE(KEYCODE_0) | |
| 2037 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 2038 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 1282 | 2039 | |
| 1283 | 2040 | PORT_START("IN3") |
| 1284 | 2041 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1285 | 2042 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1286 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P2 - Stop 2 / Big / Bonus Game / Switch Controls") PORT_CODE(KEYCODE_S) | |
| 1287 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("P2 - Blue Bet / D-UP / Card 3") PORT_CODE(KEYCODE_G) | |
| 1288 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("P2 - Stop 1 / Take") PORT_CODE(KEYCODE_A) | |
| 1289 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("P2 - Red Bet / Card 2") PORT_CODE(KEYCODE_F) | |
| 1290 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("P2 - Stop 3 / Small / Info / Card 1") PORT_CODE(KEYCODE_D) | |
| 1291 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("P2 - Start / Stop All / Card 4") PORT_CODE(KEYCODE_H) | |
| 2043 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_CODE(KEYCODE_S) PORT_NAME("P2 - Stop 2 / Big / Bonus Game / Switch Controls") | |
| 2044 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_CODE(KEYCODE_G) PORT_NAME("P2 - Blue Bet / D-UP / Card 3") | |
| 2045 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_CODE(KEYCODE_A) PORT_NAME("P2 - Stop 1 / Take") | |
| 2046 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_CODE(KEYCODE_F) PORT_NAME("P2 - Red Bet / Card 2") | |
| 2047 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_CODE(KEYCODE_D) PORT_NAME("P2 - Stop 3 / Small / Info / Card 1") | |
| 2048 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_CODE(KEYCODE_H) PORT_NAME("P2 - Start / Stop All / Card 4") | |
| 1292 | 2049 | |
| 1293 | 2050 | /* to check DIP switches... */ |
| 1294 | 2051 | PORT_START("DSW1") |
| r4135 | r4136 | |
| 1425 | 2182 | PORT_START("IN0") /* d800 */ |
| 1426 | 2183 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1427 | 2184 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1428 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 - Big / Switch Controls") PORT_CODE(KEYCODE_X) | |
| 1429 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 - Double-Up") PORT_CODE(KEYCODE_B) | |
| 1430 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 - Take Score") PORT_CODE(KEYCODE_Z) | |
| 1431 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 - Bet") PORT_CODE(KEYCODE_V) | |
| 1432 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 - Small / Info") PORT_CODE(KEYCODE_C) | |
| 1433 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 - Start") PORT_CODE(KEYCODE_N) | |
| 2185 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_X) PORT_NAME("P1 - Big / Switch Controls") | |
| 2186 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_B) PORT_NAME("P1 - Double-Up") | |
| 2187 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_Z) PORT_NAME("P1 - Take Score") | |
| 2188 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_V) PORT_NAME("P1 - Bet") | |
| 2189 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("P1 - Small / Info") | |
| 2190 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_N) PORT_NAME("P1 - Start") | |
| 1434 | 2191 | |
| 1435 | 2192 | PORT_START("IN1") /* d801 */ |
| 1436 | 2193 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1437 | 2194 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1438 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("P2 - Big / Switch Controls") PORT_CODE(KEYCODE_S) | |
| 1439 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("P2 - Double-Up") PORT_CODE(KEYCODE_G) | |
| 1440 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("P2 - Take Score") PORT_CODE(KEYCODE_A) | |
| 1441 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_NAME("P2 - Bet") PORT_CODE(KEYCODE_F) | |
| 1442 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("P2 - Small / Info") PORT_CODE(KEYCODE_D) | |
| 1443 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_NAME("P2 - Start") PORT_CODE(KEYCODE_H) | |
| 2195 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_CODE(KEYCODE_S) PORT_NAME("P2 - Big / Switch Controls") | |
| 2196 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_CODE(KEYCODE_G) PORT_NAME("P2 - Double-Up") | |
| 2197 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_CODE(KEYCODE_A) PORT_NAME("P2 - Take Score") | |
| 2198 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_CODE(KEYCODE_F) PORT_NAME("P2 - Bet") | |
| 2199 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_CODE(KEYCODE_D) PORT_NAME("P2 - Small / Info") | |
| 2200 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_CODE(KEYCODE_H) PORT_NAME("P2 - Start") | |
| 1444 | 2201 | |
| 1445 | 2202 | PORT_START("IN2") /* d802 */ |
| 1446 | 2203 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r4135 | r4136 | |
| 1459 | 2216 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1460 | 2217 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2) PORT_IMPULSE(2) // Coin2? |
| 1461 | 2218 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) // Coin3? |
| 1462 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 2219 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 1463 | 2220 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) // Coin4? |
| 1464 | 2221 | |
| 1465 | 2222 | PORT_START("IN4") /* d811 */ |
| r4135 | r4136 | |
| 1467 | 2224 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1468 | 2225 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1469 | 2226 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1470 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key Out / Attendant" | |
| 2227 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant" | |
| 1471 | 2228 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1472 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_9) | |
| 1473 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats") PORT_CODE(KEYCODE_0) | |
| 2229 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 2230 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 1474 | 2231 | |
| 1475 | 2232 | PORT_START("DSW1") |
| 1476 | 2233 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:1") |
| r4135 | r4136 | |
| 1581 | 2338 | PORT_START("IN0") /* d800 */ |
| 1582 | 2339 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1583 | 2340 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1584 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 - Big / Switch Controls") PORT_CODE(KEYCODE_X) | |
| 1585 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 - Double-Up") PORT_CODE(KEYCODE_B) | |
| 1586 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 - Take Score") PORT_CODE(KEYCODE_Z) | |
| 1587 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 - Bet") PORT_CODE(KEYCODE_V) | |
| 1588 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 - Small / Info") PORT_CODE(KEYCODE_C) | |
| 1589 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 - Start") PORT_CODE(KEYCODE_N) | |
| 2341 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_X) PORT_NAME("P1 - Big / Switch Controls") | |
| 2342 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_B) PORT_NAME("P1 - Double-Up") | |
| 2343 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_Z) PORT_NAME("P1 - Take Score") | |
| 2344 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_V) PORT_NAME("P1 - Bet") | |
| 2345 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("P1 - Small / Info") | |
| 2346 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_N) PORT_NAME("P1 - Start") | |
| 1590 | 2347 | |
| 1591 | 2348 | PORT_START("IN1") /* d801 */ |
| 1592 | 2349 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1593 | 2350 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1594 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("P2 - Big / Switch Controls") PORT_CODE(KEYCODE_S) | |
| 1595 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("P2 - Double-Up") PORT_CODE(KEYCODE_G) | |
| 1596 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("P2 - Take Score") PORT_CODE(KEYCODE_A) | |
| 1597 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_NAME("P2 - Bet") PORT_CODE(KEYCODE_F) | |
| 1598 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("P2 - Small / Info") PORT_CODE(KEYCODE_D) | |
| 1599 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_NAME("P2 - Start") PORT_CODE(KEYCODE_H) | |
| 2351 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_CODE(KEYCODE_S) PORT_NAME("P2 - Big / Switch Controls") | |
| 2352 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_CODE(KEYCODE_G) PORT_NAME("P2 - Double-Up") | |
| 2353 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_CODE(KEYCODE_A) PORT_NAME("P2 - Take Score") | |
| 2354 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_CODE(KEYCODE_F) PORT_NAME("P2 - Bet") | |
| 2355 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_CODE(KEYCODE_D) PORT_NAME("P2 - Small / Info") | |
| 2356 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_CODE(KEYCODE_H) PORT_NAME("P2 - Start") | |
| 1600 | 2357 | |
| 1601 | 2358 | PORT_START("IN2") /* d802 */ |
| 1602 | 2359 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r4135 | r4136 | |
| 1615 | 2372 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1616 | 2373 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2) PORT_IMPULSE(2) // Coin2? |
| 1617 | 2374 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) // Coin3? |
| 1618 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 2375 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 1619 | 2376 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) // Coin4? |
| 1620 | 2377 | |
| 1621 | 2378 | PORT_START("IN4") /* d811 */ |
| r4135 | r4136 | |
| 1623 | 2380 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1624 | 2381 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1625 | 2382 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1626 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key Out / Attendant" | |
| 2383 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Out / Attendant" | |
| 1627 | 2384 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1628 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_9) | |
| 1629 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats") PORT_CODE(KEYCODE_0) | |
| 2385 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 2386 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 1630 | 2387 | |
| 1631 | 2388 | PORT_START("DSW1") |
| 1632 | 2389 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:1") |
| r4135 | r4136 | |
| 1676 | 2433 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:7") |
| 1677 | 2434 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1678 | 2435 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1679 | PORT_DIPNAME( 0x80, 0x80, "W-UP Type" ) | |
| 2436 | PORT_DIPNAME( 0x80, 0x80, "W-UP Type" ) PORT_DIPLOCATION("DSW2:8") | |
| 1680 | 2437 | PORT_DIPSETTING( 0x80, "Reels (automatic)" ) |
| 1681 | 2438 | PORT_DIPSETTING( 0x00, "Cards (Big/Small)" ) |
| 1682 | 2439 | |
| r4135 | r4136 | |
| 1733 | 2490 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1734 | 2491 | INPUT_PORTS_END |
| 1735 | 2492 | |
| 2493 | static INPUT_PORTS_START( ladylinr ) | |
| 2494 | PORT_START("IN0") | |
| 2495 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2496 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2497 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2498 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2499 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) | |
| 2500 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(2) | |
| 2501 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key In") PORT_CODE(KEYCODE_Q) | |
| 2502 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) | |
| 1736 | 2503 | |
| 2504 | PORT_START("IN1") | |
| 2505 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2506 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2507 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_H) PORT_NAME("Hopper Muenze (Hopper Coin") | |
| 2508 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_J) PORT_NAME("Hopper Voll (Hopper Fill)") | |
| 2509 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2510 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Abschreib (Payout)") | |
| 2511 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Aufsteller (Supervisor)") | |
| 2512 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Buchhaltung (Bookkeeping)") | |
| 1737 | 2513 | |
| 2514 | PORT_START("IN2") | |
| 2515 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2516 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2517 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Hoch (High) / Stop 3") | |
| 2518 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Gamble (D-UP)") | |
| 2519 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Nehmen (Take)") | |
| 2520 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("Setzen (Bet)") | |
| 2521 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Tief (Low) / Stop 1 / Info") | |
| 2522 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Start / Stop 2") | |
| 2523 | ||
| 2524 | PORT_START("DSW1") | |
| 2525 | PORT_DIPNAME( 0x03, 0x03, "Remote Credits" ) PORT_DIPLOCATION("DSW1:1,2") /* OK */ | |
| 2526 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 2527 | PORT_DIPSETTING( 0x01, "10" ) | |
| 2528 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 2529 | PORT_DIPSETTING( 0x03, "100" ) | |
| 2530 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:3") | |
| 2531 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 2532 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2533 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:4") | |
| 2534 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 2535 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2536 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DSW1:5") /* OK */ | |
| 2537 | PORT_DIPSETTING( 0x00, "20 credits" ) | |
| 2538 | PORT_DIPSETTING( 0x10, "50 Credits" ) | |
| 2539 | PORT_DIPNAME( 0x20, 0x20, "Coin B & C" ) PORT_DIPLOCATION("DSW1:6") /* OK */ | |
| 2540 | PORT_DIPSETTING( 0x00, "10 credits" ) | |
| 2541 | PORT_DIPSETTING( 0x20, "20 credits" ) | |
| 2542 | PORT_DIPNAME( 0x40, 0x40, "Reels Speed" ) PORT_DIPLOCATION("DSW1:7") /* OK */ | |
| 2543 | PORT_DIPSETTING( 0x40, DEF_STR( Normal ) ) | |
| 2544 | PORT_DIPSETTING( 0x00, DEF_STR( High ) ) | |
| 2545 | PORT_DIPNAME( 0x80, 0x00, "Input Test Mode" ) PORT_DIPLOCATION("DSW1:8") /* OK */ | |
| 2546 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 2547 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) | |
| 2548 | ||
| 2549 | /* there are 2 extra DSW banks... | |
| 2550 | both are tied to a daughterboard, maybe hooked to a device. | |
| 2551 | they are not related to the original hardware, and are not | |
| 2552 | listed in the Input Test Mode. | |
| 2553 | */ | |
| 2554 | INPUT_PORTS_END | |
| 2555 | ||
| 2556 | static INPUT_PORTS_START( kkojnoli ) | |
| 2557 | PORT_START("IN0") /* d800 */ | |
| 2558 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2559 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2560 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_X) PORT_NAME("P1 - Big / Switch Controls") | |
| 2561 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_B) PORT_NAME("P1 - Double-Up") | |
| 2562 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_Z) PORT_NAME("P1 - Take Score") | |
| 2563 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_V) PORT_NAME("P1 - Bet") | |
| 2564 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("P1 - Small / Info") | |
| 2565 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_N) PORT_NAME("P1 - Start") | |
| 2566 | ||
| 2567 | PORT_START("IN1") /* d801 */ | |
| 2568 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2569 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2570 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_CODE(KEYCODE_S) PORT_NAME("P2 - Big / Switch Controls") | |
| 2571 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_CODE(KEYCODE_G) PORT_NAME("P2 - Double-Up") | |
| 2572 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_CODE(KEYCODE_A) PORT_NAME("P2 - Take Score") | |
| 2573 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_CODE(KEYCODE_F) PORT_NAME("P2 - Bet") | |
| 2574 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_CODE(KEYCODE_D) PORT_NAME("P2 - Small / Info") | |
| 2575 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_CODE(KEYCODE_H) PORT_NAME("P2 - Start") | |
| 2576 | ||
| 2577 | PORT_START("IN2") /* d802 */ | |
| 2578 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2579 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2580 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2581 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2582 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2583 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2584 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2585 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2586 | ||
| 2587 | PORT_START("IN3") /* d810 */ | |
| 2588 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2589 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2590 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) // Coin1? | |
| 2591 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2592 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2) PORT_IMPULSE(2) // Coin2? | |
| 2593 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) // Coin3? | |
| 2594 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_Q) PORT_NAME("Key In") | |
| 2595 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) // Coin4? | |
| 2596 | ||
| 2597 | PORT_START("IN4") /* d811 */ | |
| 2598 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2599 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2600 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2601 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2602 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2603 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2604 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2605 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2606 | ||
| 2607 | PORT_START("DSW1") | |
| 2608 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:1") | |
| 2609 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 2610 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2611 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:2") | |
| 2612 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 2613 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2614 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:3") | |
| 2615 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 2616 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2617 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:4") | |
| 2618 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 2619 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2620 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:5") | |
| 2621 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 2622 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2623 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:6") | |
| 2624 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 2625 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2626 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:7") | |
| 2627 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 2628 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2629 | PORT_DIPNAME( 0x80, 0x00, "W-UP Type" ) PORT_DIPLOCATION("DSW1:8") | |
| 2630 | PORT_DIPSETTING( 0x80, "Reels (automatic)" ) | |
| 2631 | PORT_DIPSETTING( 0x00, "Flowers (Big/Small)" ) | |
| 2632 | ||
| 2633 | INPUT_PORTS_END | |
| 2634 | ||
| 2635 | ||
| 2636 | ||
| 1738 | 2637 | static const gfx_layout charlayout = |
| 1739 | 2638 | { |
| 1740 | 2639 | 8,8, /* 8*8 characters */ |
| r4135 | r4136 | |
| 1829 | 2728 | 32*8 |
| 1830 | 2729 | }; |
| 1831 | 2730 | |
| 2731 | static const UINT32 layout_xoffset[128] = | |
| 2732 | { | |
| 2733 | STEP32(0*128,4),STEP32(1*128,4),STEP32(2*128,4),STEP32(3*128,4) | |
| 2734 | }; | |
| 2735 | ||
| 2736 | static const UINT32 layout_yoffset[128] = | |
| 2737 | { | |
| 2738 | STEP32(0*16384, 512),STEP32(1*16384,512),STEP32(2*16384,512),STEP32(3*16384,512) | |
| 2739 | }; | |
| 2740 | ||
| 2741 | static const gfx_layout tiles128x128x4_layout = | |
| 2742 | { | |
| 2743 | 128,128, | |
| 2744 | RGN_FRAC(1,1), | |
| 2745 | 4, | |
| 2746 | { 0, 1, 2, 3 }, | |
| 2747 | EXTENDED_XOFFS, | |
| 2748 | EXTENDED_YOFFS, | |
| 2749 | 4 * 16384, /* object takes 8 consecutive bytes */ | |
| 2750 | layout_xoffset, | |
| 2751 | layout_yoffset | |
| 2752 | }; | |
| 2753 | ||
| 2754 | ||
| 2755 | static const UINT32 layout_xoffset256[256] = | |
| 2756 | { | |
| 2757 | STEP32(0*128,4),STEP32(1*128,4),STEP32(2*128,4),STEP32(3*128,4), STEP32(4*128,4), STEP32(5*128,4), STEP32(6*128,4), STEP32(7*128,4) | |
| 2758 | }; | |
| 2759 | ||
| 2760 | static const UINT32 layout_yoffset256[256] = | |
| 2761 | { | |
| 2762 | STEP32(0*32768, 1024),STEP32(1*32768,1024),STEP32(2*32768,1024),STEP32(3*32768,1024),STEP32(4*32768,1024), STEP32(5*32768,1024),STEP32(6*32768,1024),STEP32(7*32768,1024) | |
| 2763 | }; | |
| 2764 | ||
| 2765 | ||
| 2766 | static const gfx_layout tiles256x128x4_layout = | |
| 2767 | { | |
| 2768 | 256,256, | |
| 2769 | RGN_FRAC(1,1), | |
| 2770 | 4, | |
| 2771 | { 0, 1, 2, 3 }, | |
| 2772 | EXTENDED_XOFFS, | |
| 2773 | EXTENDED_YOFFS, | |
| 2774 | 8 * 32768, /* object takes 8 consecutive bytes */ | |
| 2775 | layout_xoffset256, | |
| 2776 | layout_yoffset256 | |
| 2777 | }; | |
| 2778 | ||
| 1832 | 2779 | #if 0 // decodes an extra plane for cmv4 / cmasterb, not sure if we need to |
| 1833 | 2780 | static const gfx_layout tiles8x32x5_layout = |
| 1834 | 2781 | { |
| r4135 | r4136 | |
| 1871 | 2818 | GFXDECODE_ENTRY( "gfx2", 0, tiles8x32x4_layout, 128, 4 ) |
| 1872 | 2819 | GFXDECODE_END |
| 1873 | 2820 | |
| 1874 | static GFXDECODE_START( cm | |
| 2821 | static GFXDECODE_START( cm | |
| 1875 | 2822 | GFXDECODE_ENTRY( "gfx1", 0, tiles8x8x3_layout, 0, 16 ) |
| 1876 | 2823 | GFXDECODE_ENTRY( "gfx2", 0, tiles8x32x4_layout, 128+64, 4 ) // or is there a register for the +64? |
| 1877 | 2824 | GFXDECODE_END |
| 1878 | 2825 | |
| 2826 | static GFXDECODE_START( cmbitmap ) | |
| 2827 | GFXDECODE_ENTRY( "gfx1", 0, tiles8x8x3_layout, 0, 16 ) | |
| 2828 | GFXDECODE_ENTRY( "gfx2", 0, tiles8x32x4_layout, 128+64, 4 ) // or is there a register for the +64? | |
| 2829 | GFXDECODE_ENTRY( "user1", 0, tiles128x128x4_layout, 128, 4 ) | |
| 2830 | GFXDECODE_END | |
| 2831 | ||
| 2832 | static GFXDECODE_START( cmast91 ) | |
| 2833 | GFXDECODE_ENTRY( "gfx1", 0, tiles8x8x3_layout, 0, 16 ) | |
| 2834 | GFXDECODE_ENTRY( "gfx2", 0, tiles8x32x4_layout, 128+64, 4 ) // or is there a register for the +64? | |
| 2835 | GFXDECODE_ENTRY( "user1", 0, tiles256x128x4_layout, 128, 4 ) // wrong... FIXME. | |
| 2836 | GFXDECODE_END | |
| 2837 | ||
| 1879 | 2838 | #if 0 // decodes an extra plane for cmv4 / cmasterb, not sure if we need to |
| 1880 | 2839 | static GFXDECODE_START( cmasterb ) |
| 1881 | 2840 | GFXDECODE_ENTRY( "gfx1", 0, tiles8x8x3_layout, 0, 16 ) |
| r4135 | r4136 | |
| 1964 | 2923 | } |
| 1965 | 2924 | }; |
| 1966 | 2925 | |
| 2926 | static const ppi8255_interface kkojnoli_ppi8255_intf[3] = | |
| 2927 | { | |
| 2928 | { /* A, B & C set as input */ | |
| 2929 | DEVICE8_PORT("IN0"), /* Port A read */ | |
| 2930 | DEVICE8_PORT("IN1"), /* Port B read */ | |
| 2931 | DEVICE8_PORT("IN2"), /* Port C read */ | |
| 2932 | NULL, /* Port A write */ | |
| 2933 | NULL, /* Port B write */ | |
| 2934 | NULL /* Port C write */ | |
| 2935 | }, | |
| 2936 | { /* A, B & C set as input */ | |
| 2937 | DEVICE8_PORT("IN3"), /* Port A read */ | |
| 2938 | DEVICE8_PORT("IN4"), /* Port B read */ | |
| 2939 | NULL, /* Port C read */ | |
| 2940 | NULL, /* Port A write */ | |
| 2941 | NULL, /* Port B write */ | |
| 2942 | NULL /* Port C write */ | |
| 2943 | }, | |
| 2944 | { /* A set as input */ | |
| 2945 | DEVICE8_PORT("DSW1"), /* Port A read */ | |
| 2946 | NULL, /* Port B read */ | |
| 2947 | NULL, /* Port C read */ | |
| 2948 | NULL, /* Port A write */ | |
| 2949 | NULL, /* Port B write */ | |
| 2950 | NULL /* Port C write */ | |
| 2951 | } | |
| 2952 | }; | |
| 2953 | ||
| 2954 | static const ppi8255_interface ladylinr_ppi8255_intf[2] = | |
| 2955 | { | |
| 2956 | { /* A, B & C set as input */ | |
| 2957 | DEVICE8_PORT("IN0"), /* Port A read */ | |
| 2958 | DEVICE8_PORT("IN1"), /* Port B read */ | |
| 2959 | DEVICE8_PORT("IN2"), /* Port C read */ | |
| 2960 | NULL, /* Port A write */ | |
| 2961 | NULL, /* Port B write */ | |
| 2962 | NULL /* Port C write */ | |
| 2963 | }, | |
| 2964 | { /* A set as input */ | |
| 2965 | DEVICE8_PORT("DSW1"), /* Port A read */ | |
| 2966 | NULL, /* Port B read */ | |
| 2967 | NULL, /* Port C read */ | |
| 2968 | NULL, /* Port A write */ | |
| 2969 | NULL, /* Port B write */ | |
| 2970 | NULL /* Port C write */ | |
| 2971 | } | |
| 2972 | }; | |
| 2973 | ||
| 1967 | 2974 | static const ay8910_interface ay8910_config = |
| 1968 | 2975 | { |
| 1969 | 2976 | AY8910_LEGACY_OUTPUT, |
| r4135 | r4136 | |
| 1994 | 3001 | NULL |
| 1995 | 3002 | }; |
| 1996 | 3003 | |
| 3004 | static const ay8910_interface ladylinr_ay8910_config = | |
| 3005 | { | |
| 3006 | AY8910_LEGACY_OUTPUT, | |
| 3007 | AY8910_DEFAULT_LOADS, | |
| 3008 | NULL, | |
| 3009 | NULL, | |
| 3010 | NULL, | |
| 3011 | NULL | |
| 3012 | }; | |
| 3013 | ||
| 1997 | 3014 | static MACHINE_DRIVER_START( goldstar ) |
| 1998 | 3015 | |
| 1999 | 3016 | /* basic machine hardware */ |
| 2000 | MDRV_CPU_ADD("main", Z80, | |
| 3017 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK | |
| 2001 | 3018 | MDRV_CPU_PROGRAM_MAP(goldstar_map,0) |
| 2002 | 3019 | MDRV_CPU_IO_MAP(goldstar_readport,0) |
| 2003 | 3020 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| r4135 | r4136 | |
| 2018 | 3035 | MDRV_VIDEO_UPDATE(goldstar) |
| 2019 | 3036 | |
| 2020 | 3037 | /* sound hardware */ |
| 2021 | MDRV_SPEAKER_STANDARD_MONO("mono")//set up a standard mono speaker called 'mono' | |
| 2022 | MDRV_SOUND_ADD("ay", AY8910,1500000)//1 AY8910, at clock 150000Hz | |
| 2023 | MDRV_SOUND_CONFIG(ay8910_config)//read extra data from interface | |
| 2024 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)//all sound goes to the 'mono' speaker, at 0.50 X maximum | |
| 3038 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 3039 | MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK) | |
| 3040 | MDRV_SOUND_CONFIG(ay8910_config) | |
| 3041 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 2025 | 3042 | |
| 2026 | MDRV_SOUND_ADD("oki", OKIM6295, 1056000)//clock | |
| 2027 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified //"oki" | |
| 2028 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)//all sound goes to the 'mono' speaker, at 1.0 X maximum | |
| 3043 | MDRV_SOUND_ADD("oki", OKIM6295, OKI_CLOCK) | |
| 3044 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) /* clock frequency & pin 7 not verified */ | |
| 3045 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 2029 | 3046 | |
| 2030 | 3047 | MACHINE_DRIVER_END |
| 2031 | 3048 | |
| r4135 | r4136 | |
| 2033 | 3050 | static MACHINE_DRIVER_START( goldstbl ) |
| 2034 | 3051 | |
| 2035 | 3052 | /* basic machine hardware */ |
| 2036 | MDRV_CPU_ADD("main", Z80, | |
| 3053 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK | |
| 2037 | 3054 | MDRV_CPU_PROGRAM_MAP(goldstar_map,0) |
| 2038 | 3055 | MDRV_CPU_IO_MAP(goldstar_readport,0) |
| 2039 | 3056 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| r4135 | r4136 | |
| 2054 | 3071 | MDRV_VIDEO_UPDATE(goldstar) |
| 2055 | 3072 | |
| 2056 | 3073 | /* sound hardware */ |
| 2057 | MDRV_SPEAKER_STANDARD_MONO("mono")//set up a standard mono speaker called 'mono' | |
| 2058 | MDRV_SOUND_ADD("ay", AY8910,1500000)//1 AY8910, at clock 150000Hz | |
| 2059 | MDRV_SOUND_CONFIG(ay8910_config)//read extra data from interface | |
| 2060 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)//all sound goes to the 'mono' speaker, at 0.50 X maximum | |
| 3074 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 3075 | MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK) | |
| 3076 | MDRV_SOUND_CONFIG(ay8910_config) | |
| 3077 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 2061 | 3078 | |
| 2062 | MDRV_SOUND_ADD("oki", OKIM6295, 1056000)//clock | |
| 2063 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified //"oki" | |
| 2064 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)//all sound goes to the 'mono' speaker, at 1.0 X maximum | |
| 3079 | MDRV_SOUND_ADD("oki", OKIM6295, OKI_CLOCK) | |
| 3080 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) /* clock frequency & pin 7 not verified */ | |
| 3081 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 2065 | 3082 | MACHINE_DRIVER_END |
| 2066 | 3083 | |
| 2067 | 3084 | |
| 2068 | 3085 | static MACHINE_DRIVER_START( moonlght ) |
| 2069 | 3086 | |
| 2070 | 3087 | /* basic machine hardware */ |
| 2071 | MDRV_CPU_ADD("main", Z80, | |
| 3088 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK | |
| 2072 | 3089 | MDRV_CPU_PROGRAM_MAP(goldstar_map,0) |
| 2073 | 3090 | MDRV_CPU_IO_MAP(goldstar_readport,0) |
| 2074 | 3091 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| r4135 | r4136 | |
| 2089 | 3106 | MDRV_VIDEO_UPDATE(goldstar) |
| 2090 | 3107 | |
| 2091 | 3108 | /* sound hardware */ |
| 2092 | MDRV_SPEAKER_STANDARD_MONO("mono")//set up a standard mono speaker called 'mono' | |
| 2093 | MDRV_SOUND_ADD("ay", AY8910,1500000)//1 AY8910, at clock 150000Hz | |
| 2094 | MDRV_SOUND_CONFIG(ay8910_config)//read extra data from interface | |
| 2095 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)//all sound goes to the 'mono' speaker, at 0.50 X maximum | |
| 3109 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 3110 | MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK) | |
| 3111 | MDRV_SOUND_CONFIG(ay8910_config) | |
| 3112 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 2096 | 3113 | |
| 2097 | MDRV_SOUND_ADD("oki", OKIM6295, 1056000)//clock | |
| 2098 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high)// clock frequency & pin 7 not verified //"oki" | |
| 2099 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)//all sound goes to the 'mono' speaker, at 1.0 X maximum | |
| 3114 | MDRV_SOUND_ADD("oki", OKIM6295, OKI_CLOCK) | |
| 3115 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) /* clock frequency & pin 7 not verified */ | |
| 3116 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 2100 | 3117 | MACHINE_DRIVER_END |
| 2101 | 3118 | |
| 2102 | 3119 | |
| 2103 | 3120 | static PALETTE_INIT(cm) |
| 2104 | 3121 | { |
| 3122 | /* BBGGGRRR */ | |
| 3123 | ||
| 2105 | 3124 | int i; |
| 2106 | for (i=0;i<0x100;i++) | |
| 3125 | ||
| 3126 | for (i = 0; i < 0x100; i++) | |
| 2107 | 3127 | { |
| 2108 | int r,g,b; | |
| 2109 | UINT8 dat; | |
| 2110 | ||
| 3128 | UINT8 data; | |
| 2111 | 3129 | UINT8*proms = memory_region(machine, "proms"); |
| 2112 | 3130 | |
| 2113 | dat = proms[0x000+i] | (proms[0x100+i]<<4); | |
| 3131 | data = proms[0x000 + i] | (proms[0x100 + i] << 4); | |
| 2114 | 3132 | |
| 2115 | r = (dat & 0x07) << 5; | |
| 2116 | g = (dat & 0x38) << 2; | |
| 2117 | b = (dat & 0xc0) << 0; | |
| 3133 | palette_set_color_rgb(machine, i, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6)); | |
| 2118 | 3134 | |
| 2119 | palette_set_color(machine, i, MAKE_RGB(r, g, b)); | |
| 2120 | ||
| 2121 | 3135 | } |
| 2122 | 3136 | } |
| 2123 | 3137 | |
| 2124 | 3138 | static PALETTE_INIT(cmast91) |
| 2125 | 3139 | { |
| 2126 | 3140 | int i; |
| 2127 | for (i=0;i<0x100;i++) | |
| 3141 | for (i = 0; i < 0x100; i++) | |
| 2128 | 3142 | { |
| 2129 | 3143 | int r,g,b; |
| 2130 | 3144 | |
| 2131 | 3145 | UINT8*proms = memory_region(machine, "proms"); |
| 2132 | 3146 | |
| 2133 | b = proms[0x000+i]<<4; | |
| 2134 | g = proms[0x100+i]<<4; | |
| 2135 | r = proms[0x200+i]<<4; | |
| 3147 | b = proms[0x000 + i] << 4; | |
| 3148 | g = proms[0x100 + i] << 4; | |
| 3149 | r = proms[0x200 + i] << 4; | |
| 2136 | 3150 | |
| 2137 | 3151 | palette_set_color(machine, i, MAKE_RGB(r, g, b)); |
| 2138 | ||
| 2139 | 3152 | } |
| 2140 | 3153 | } |
| 2141 | 3154 | |
| 2142 | 3155 | static PALETTE_INIT(lucky8) |
| 2143 | 3156 | { |
| 3157 | /* BBGGGRRR */ | |
| 3158 | ||
| 2144 | 3159 | int i; |
| 2145 | int r,g,b; | |
| 2146 | UINT8 dat; | |
| 3160 | UINT8 data; | |
| 2147 | 3161 | UINT8 *proms; |
| 2148 | 3162 | |
| 2149 | 3163 | proms = memory_region(machine, "proms"); |
| 2150 | for (i=0;i<0x100;i++) | |
| 3164 | for (i = 0; i < 0x100; i++) | |
| 2151 | 3165 | { |
| 2152 | 3166 | |
| 2153 | dat = proms[0x000+i] | (proms[0x100+i]<<4); | |
| 3167 | data = proms[0x000 + i] | (proms[0x100 + i] << 4); | |
| 2154 | 3168 | |
| 2155 | r = (dat & 0x07) << 5; | |
| 2156 | g = (dat & 0x38) << 2; | |
| 2157 | b = (dat & 0xc0) << 0; | |
| 2158 | ||
| 2159 | palette_set_color(machine, i, MAKE_RGB(r, g, b)); | |
| 2160 | ||
| 3169 | palette_set_color_rgb(machine, i, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6)); | |
| 2161 | 3170 | } |
| 2162 | 3171 | |
| 2163 | 3172 | proms = memory_region(machine, "proms2"); |
| 2164 | for (i=0;i<0x20;i++) | |
| 3173 | for (i=0; i < 0x20; i++) | |
| 2165 | 3174 | { |
| 2166 | dat = proms[i]; | |
| 3175 | data = proms[i]; | |
| 2167 | 3176 | |
| 2168 | r = (dat & 0x07) << 5; | |
| 2169 | g = (dat & 0x38) << 2; | |
| 2170 | b = (dat & 0xc0) << 0; | |
| 2171 | ||
| 2172 | palette_set_color(machine, i+0x80, MAKE_RGB(r, g, b)); | |
| 3177 | palette_set_color_rgb(machine, i + 0x80, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6)); | |
| 2173 | 3178 | } |
| 2174 | ||
| 2175 | 3179 | } |
| 2176 | 3180 | |
| 2177 | 3181 | |
| 2178 | 3182 | static MACHINE_DRIVER_START( chrygld ) |
| 2179 | 3183 | |
| 2180 | 3184 | /* basic machine hardware */ |
| 2181 | MDRV_CPU_ADD("main", Z80, | |
| 3185 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK | |
| 2182 | 3186 | MDRV_CPU_PROGRAM_MAP(ncb3_map,0) |
| 2183 | 3187 | MDRV_CPU_IO_MAP(ncb3_readwriteport,0) |
| 2184 | 3188 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| r4135 | r4136 | |
| 2207 | 3211 | /* sound hardware */ |
| 2208 | 3212 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 2209 | 3213 | |
| 2210 | MDRV_SOUND_ADD("sn1", SN76489, | |
| 3214 | MDRV_SOUND_ADD("sn1", SN76489, PSG_CLOCK) | |
| 2211 | 3215 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 2212 | 3216 | |
| 2213 | MDRV_SOUND_ADD("ay", AY8910, | |
| 3217 | MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK) | |
| 2214 | 3218 | MDRV_SOUND_CONFIG(ay8910_config) |
| 2215 | 3219 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 2216 | 3220 | MACHINE_DRIVER_END |
| r4135 | r4136 | |
| 2220 | 3224 | static MACHINE_DRIVER_START( ncb3 ) |
| 2221 | 3225 | |
| 2222 | 3226 | /* basic machine hardware */ |
| 2223 | MDRV_CPU_ADD("main", Z80, | |
| 3227 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK | |
| 2224 | 3228 | MDRV_CPU_PROGRAM_MAP(ncb3_map,0) |
| 2225 | 3229 | MDRV_CPU_IO_MAP(ncb3_readwriteport,0) |
| 2226 | 3230 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| r4135 | r4136 | |
| 2250 | 3254 | /* sound hardware */ |
| 2251 | 3255 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 2252 | 3256 | |
| 2253 | MDRV_SOUND_ADD("sn1", SN76489, | |
| 3257 | MDRV_SOUND_ADD("sn1", SN76489, PSG_CLOCK) | |
| 2254 | 3258 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 2255 | 3259 | |
| 2256 | MDRV_SOUND_ADD("ay", AY8910, | |
| 3260 | MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK) | |
| 2257 | 3261 | MDRV_SOUND_CONFIG(ay8910_config) |
| 2258 | 3262 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 2259 | 3263 | MACHINE_DRIVER_END |
| r4135 | r4136 | |
| 2262 | 3266 | static MACHINE_DRIVER_START( cm ) |
| 2263 | 3267 | |
| 2264 | 3268 | /* basic machine hardware */ |
| 2265 | MDRV_CPU_ADD("main", Z80, | |
| 3269 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK | |
| 2266 | 3270 | MDRV_CPU_PROGRAM_MAP(cm_map,0) |
| 2267 | 3271 | MDRV_CPU_IO_MAP(cm_portmap,0) |
| 2268 | 3272 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| 2269 | 3273 | |
| 2270 | 3274 | /* 2x 8255 */ |
| 2271 | MDRV_PPI8255_ADD( "cm_ppi8255_0", cm_ppi8255_intf[0] ) | |
| 2272 | MDRV_PPI8255_ADD( "cm_ppi8255_1", cm_ppi8255_intf[1] ) | |
| 3275 | MDRV_PPI8255_ADD( "ppi8255_0", cm_ppi8255_intf[0] ) | |
| 3276 | MDRV_PPI8255_ADD( "ppi8255_1", cm_ppi8255_intf[1] ) | |
| 2273 | 3277 | |
| 2274 | 3278 | /* video hardware */ |
| 2275 | 3279 | MDRV_SCREEN_ADD("main", RASTER) |
| r4135 | r4136 | |
| 2279 | 3283 | MDRV_SCREEN_SIZE(64*8, 32*8) |
| 2280 | 3284 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1) |
| 2281 | 3285 | |
| 2282 | MDRV_GFXDECODE(cm | |
| 3286 | MDRV_GFXDECODE(cmbitmap) | |
| 2283 | 3287 | MDRV_PALETTE_LENGTH(256) |
| 2284 | 3288 | MDRV_PALETTE_INIT(cm) |
| 2285 | 3289 | MDRV_NVRAM_HANDLER(goldstar) |
| r4135 | r4136 | |
| 2289 | 3293 | |
| 2290 | 3294 | /* sound hardware */ |
| 2291 | 3295 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 2292 | MDRV_SOUND_ADD("ay", AY8910, | |
| 3296 | MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK) | |
| 2293 | 3297 | MDRV_SOUND_CONFIG(cm_ay8910_config) |
| 2294 | 3298 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 2295 | 3299 | MACHINE_DRIVER_END |
| 2296 | 3300 | |
| 2297 | static MACHINE_DRIVER_START( cm | |
| 3301 | static MACHINE_DRIVER_START( cmnobmp ) | |
| 2298 | 3302 | |
| 2299 | 3303 | /* basic machine hardware */ |
| 2300 | MDRV_CPU_ADD("main", Z80, | |
| 3304 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK | |
| 2301 | 3305 | MDRV_CPU_PROGRAM_MAP(cm_map,0) |
| 2302 | MDRV_CPU_IO_MAP(cm | |
| 3306 | MDRV_CPU_IO_MAP(cm | |
| 2303 | 3307 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| 2304 | 3308 | |
| 2305 | 3309 | /* 2x 8255 */ |
| 2306 | MDRV_PPI8255_ADD( "cm_ppi8255_0", cm_ppi8255_intf[0] ) | |
| 2307 | MDRV_PPI8255_ADD( "cm_ppi8255_1", cm_ppi8255_intf[1] ) | |
| 3310 | MDRV_PPI8255_ADD( "ppi8255_0", cm_ppi8255_intf[0] ) | |
| 3311 | MDRV_PPI8255_ADD( "ppi8255_1", cm_ppi8255_intf[1] ) | |
| 2308 | 3312 | |
| 2309 | 3313 | /* video hardware */ |
| 2310 | 3314 | MDRV_SCREEN_ADD("main", RASTER) |
| r4135 | r4136 | |
| 2312 | 3316 | // MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2313 | 3317 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 2314 | 3318 | MDRV_SCREEN_SIZE(64*8, 32*8) |
| 2315 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, | |
| 3319 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1) | |
| 2316 | 3320 | |
| 2317 | MDRV_GFXDECODE(cm | |
| 3321 | MDRV_GFXDECODE(cm | |
| 2318 | 3322 | MDRV_PALETTE_LENGTH(256) |
| 2319 | MDRV_PALETTE_INIT(cm | |
| 3323 | MDRV_PALETTE_INIT(cm | |
| 2320 | 3324 | MDRV_NVRAM_HANDLER(goldstar) |
| 2321 | 3325 | |
| 2322 | 3326 | MDRV_VIDEO_START(cherrym) |
| 2323 | 3327 | MDRV_VIDEO_UPDATE(goldstar) |
| 2324 | 3328 | |
| 2325 | 3329 | /* sound hardware */ |
| 2326 | MDRV_SPEAKER_STANDARD_MONO("mono")//set up a standard mono speaker called 'mono' | |
| 2327 | MDRV_SOUND_ADD("ay", AY8910,1500000)//1 AY8910, at clock 150000Hz | |
| 2328 | MDRV_SOUND_CONFIG(ay8910_config)//read extra data from interface | |
| 2329 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)//all sound goes to the 'mono' speaker, at 0.50 X maximum | |
| 3330 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 3331 | MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK) | |
| 3332 | MDRV_SOUND_CONFIG(cm_ay8910_config) | |
| 3333 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 2330 | 3334 | MACHINE_DRIVER_END |
| 2331 | 3335 | |
| 2332 | #if 0 // not currently used, might be needed later | |
| 2333 | static MACHINE_DRIVER_START( cmb ) | |
| 3336 | static MACHINE_DRIVER_START( cmast91 ) | |
| 2334 | 3337 | |
| 2335 | 3338 | /* basic machine hardware */ |
| 2336 | MDRV_CPU_ADD("main", Z80, | |
| 3339 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK | |
| 2337 | 3340 | MDRV_CPU_PROGRAM_MAP(cm_map,0) |
| 2338 | MDRV_CPU_IO_MAP(cm_portmap,0) | |
| 3341 | MDRV_CPU_IO_MAP(cmast91_portmap,0) | |
| 2339 | 3342 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| 2340 | 3343 | |
| 3344 | /* 2x 8255 */ | |
| 3345 | MDRV_PPI8255_ADD( "ppi8255_0", cm_ppi8255_intf[0] ) | |
| 3346 | MDRV_PPI8255_ADD( "ppi8255_1", cm_ppi8255_intf[1] ) | |
| 3347 | ||
| 2341 | 3348 | /* video hardware */ |
| 2342 | 3349 | MDRV_SCREEN_ADD("main", RASTER) |
| 2343 | 3350 | MDRV_SCREEN_REFRESH_RATE(60) |
| 2344 | 3351 | // MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2345 | 3352 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 2346 | 3353 | MDRV_SCREEN_SIZE(64*8, 32*8) |
| 2347 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, | |
| 3354 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 1*8, 31*8-1) | |
| 2348 | 3355 | |
| 2349 | MDRV_GFXDECODE(cmast | |
| 3356 | MDRV_GFXDECODE(cmast91 | |
| 2350 | 3357 | MDRV_PALETTE_LENGTH(256) |
| 2351 | MDRV_PALETTE_INIT(cm) | |
| 2352 | // MDRV_NVRAM_HANDLER(goldstar) | |
| 3358 | MDRV_PALETTE_INIT(cmast91) | |
| 3359 | MDRV_NVRAM_HANDLER(goldstar) | |
| 2353 | 3360 | |
| 2354 | 3361 | MDRV_VIDEO_START(cherrym) |
| 2355 | MDRV_VIDEO_UPDATE( | |
| 3362 | MDRV_VIDEO_UPDATE(cma | |
| 2356 | 3363 | |
| 2357 | 3364 | /* sound hardware */ |
| 2358 | MDRV_SPEAKER_STANDARD_MONO("mono")//set up a standard mono speaker called 'mono' | |
| 2359 | MDRV_SOUND_ADD("ay", AY8910,1500000)//1 AY8910, at clock 150000Hz | |
| 2360 | MDRV_SOUND_CONFIG(ay8910_config)//read extra data from interface | |
| 2361 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)//all sound goes to the 'mono' speaker, at 0.50 X maximum | |
| 2362 | ||
| 2363 | MDRV_SOUND_ADD("oki", OKIM6295, 1056000)//clock | |
| 2364 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified //"oki" | |
| 2365 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)//all sound goes to the 'mono' speaker, at 1.0 X maximum | |
| 3365 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 3366 | MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK) | |
| 3367 | MDRV_SOUND_CONFIG(cm_ay8910_config) | |
| 3368 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 2366 | 3369 | MACHINE_DRIVER_END |
| 2367 | #endif | |
| 2368 | 3370 | |
| 2369 | ||
| 2370 | 3371 | static MACHINE_DRIVER_START( lucky8 ) |
| 2371 | 3372 | |
| 2372 | 3373 | /* basic machine hardware */ |
| 2373 | MDRV_CPU_ADD("main", Z80, | |
| 3374 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK | |
| 2374 | 3375 | MDRV_CPU_PROGRAM_MAP(lucky8_map,0) |
| 2375 | 3376 | //MDRV_CPU_IO_MAP(goldstar_readport,0) |
| 2376 | 3377 | MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) |
| r4135 | r4136 | |
| 2397 | 3398 | MDRV_VIDEO_UPDATE(goldstar) |
| 2398 | 3399 | |
| 2399 | 3400 | /* sound hardware */ |
| 2400 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 3401 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 2401 | 3402 | |
| 2402 | MDRV_SOUND_ADD("sn1", SN76489, | |
| 3403 | MDRV_SOUND_ADD("sn1", SN76489, PSG_CLOCK) | |
| 2403 | 3404 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 2404 | 3405 | |
| 2405 | MDRV_SOUND_ADD("ay", AY8910, | |
| 3406 | MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK) | |
| 2406 | 3407 | MDRV_SOUND_CONFIG(lucky8_ay8910_config) |
| 2407 | 3408 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 2408 | 3409 | |
| 2409 | 3410 | MACHINE_DRIVER_END |
| 2410 | 3411 | |
| 2411 | 3412 | |
| 3413 | static MACHINE_DRIVER_START( kkojnoli ) | |
| 2412 | 3414 | |
| 3415 | /* basic machine hardware */ | |
| 3416 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK) | |
| 3417 | MDRV_CPU_PROGRAM_MAP(kkojnoli_map,0) | |
| 3418 | //MDRV_CPU_IO_MAP(goldstar_readport,0) | |
| 3419 | MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) | |
| 3420 | ||
| 3421 | /* 3x 8255 */ | |
| 3422 | MDRV_PPI8255_ADD( "ppi8255_0", kkojnoli_ppi8255_intf[0] ) | |
| 3423 | MDRV_PPI8255_ADD( "ppi8255_1", kkojnoli_ppi8255_intf[1] ) | |
| 3424 | MDRV_PPI8255_ADD( "ppi8255_2", kkojnoli_ppi8255_intf[2] ) | |
| 3425 | ||
| 3426 | /* video hardware */ | |
| 3427 | MDRV_SCREEN_ADD("main", RASTER) | |
| 3428 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 3429 | // MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 3430 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 3431 | MDRV_SCREEN_SIZE(64*8, 32*8) | |
| 3432 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1) | |
| 3433 | MDRV_PALETTE_INIT(lucky8) | |
| 3434 | ||
| 3435 | MDRV_GFXDECODE(ncb3) | |
| 3436 | MDRV_PALETTE_LENGTH(256) | |
| 3437 | ||
| 3438 | MDRV_VIDEO_START(goldstar) | |
| 3439 | MDRV_VIDEO_UPDATE(goldstar) | |
| 3440 | ||
| 3441 | /* sound hardware */ | |
| 3442 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 3443 | ||
| 3444 | MDRV_SOUND_ADD("sn1", SN76489, PSG_CLOCK) | |
| 3445 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) | |
| 3446 | ||
| 3447 | MACHINE_DRIVER_END | |
| 3448 | ||
| 3449 | ||
| 3450 | static MACHINE_DRIVER_START( ladylinr ) | |
| 3451 | ||
| 3452 | /* basic machine hardware */ | |
| 3453 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK) | |
| 3454 | MDRV_CPU_PROGRAM_MAP(ladylinr_map,0) | |
| 3455 | //MDRV_CPU_IO_MAP(goldstar_readport,0) | |
| 3456 | MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) | |
| 3457 | ||
| 3458 | /* 2x 8255 */ | |
| 3459 | MDRV_PPI8255_ADD( "ppi8255_0", ladylinr_ppi8255_intf[0] ) | |
| 3460 | MDRV_PPI8255_ADD( "ppi8255_1", ladylinr_ppi8255_intf[1] ) | |
| 3461 | ||
| 3462 | /* video hardware */ | |
| 3463 | MDRV_SCREEN_ADD("main", RASTER) | |
| 3464 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 3465 | // MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 3466 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 3467 | MDRV_SCREEN_SIZE(64*8, 32*8) | |
| 3468 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1) | |
| 3469 | MDRV_PALETTE_INIT(lucky8) | |
| 3470 | ||
| 3471 | MDRV_GFXDECODE(ncb3) | |
| 3472 | MDRV_PALETTE_LENGTH(256) | |
| 3473 | MDRV_NVRAM_HANDLER(goldstar) | |
| 3474 | ||
| 3475 | MDRV_VIDEO_START(goldstar) | |
| 3476 | MDRV_VIDEO_UPDATE(goldstar) | |
| 3477 | ||
| 3478 | /* sound hardware */ | |
| 3479 | MDRV_SPEAKER_STANDARD_MONO("mono")//set up a standard mono speaker called 'mono' | |
| 3480 | ||
| 3481 | MDRV_SOUND_ADD("sn1", SN76489, PSG_CLOCK) | |
| 3482 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) | |
| 3483 | ||
| 3484 | MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK) | |
| 3485 | MDRV_SOUND_CONFIG(ladylinr_ay8910_config) | |
| 3486 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 3487 | ||
| 3488 | MACHINE_DRIVER_END | |
| 3489 | ||
| 3490 | ||
| 3491 | ||
| 2413 | 3492 | /*************************************************************************** |
| 2414 | 3493 | |
| 2415 | 3494 | Game driver(s) |
| r4135 | r4136 | |
| 2684 | 3763 | ROM_LOAD( "m1.64", 0x4000, 0x2000, CRC(6dfcb188) SHA1(22430429c798954d9d979e62699b58feae7fdbf4) ) |
| 2685 | 3764 | ROM_LOAD( "m2.64", 0x6000, 0x2000, CRC(9678ead2) SHA1(e80aefa98b2363fe9e6b2415762695ace272e4d3) ) |
| 2686 | 3765 | |
| 3766 | ROM_REGION( 0x10000, "user1", ROMREGION_DISPOSE ) | |
| 3767 | ROM_LOAD( "27512.u53", 0x0000, 0x10000, NO_DUMP ) | |
| 3768 | ||
| 2687 | 3769 | ROM_REGION( 0x200, "proms", 0 ) // pal |
| 2688 | 3770 | ROM_LOAD( "prom2.287", 0x0000, 0x0100, CRC(0489b760) SHA1(78f8632b17a76335183c5c204cdec856988368b0) ) |
| 2689 | 3771 | ROM_LOAD( "prom3.287", 0x0100, 0x0100, CRC(21eb5b19) SHA1(9b8425bdb97f11f4855c998c7792c3291fd07470) ) |
| r4135 | r4136 | |
| 2769 | 3851 | ROM_LOAD( "82s129.u46", 0x0000, 0x0100, CRC(50ec383b) SHA1(ae95b92bd3946b40134bcdc22708d5c6b0f4c23e) ) |
| 2770 | 3852 | ROM_END |
| 2771 | 3853 | |
| 3854 | /* | |
| 2772 | 3855 | |
| 3856 | cmv4 vs. fruit2 | |
| 3857 | ||
| 3858 | 12 and 12 files | |
| 3859 | 82s129.u46 FIXED BITS (0000x0xx) | |
| 3860 | 82s129.u46 BADADDR xxxxxxx- | |
| 3861 | 82s129.u70 FIXED BITS (0000xxxx) | |
| 3862 | 82s129.u84 FIXED BITS (0000xxxx) | |
| 3863 | HOLD8_PR1.U46 FIXED BITS (0000x0xx) | |
| 3864 | HOLD8_PR1.U46 BADADDR xxxxxxx- | |
| 3865 | HOLD8_PR2.U84 FIXED BITS (0000xxxx) | |
| 3866 | HOLD8_PR3.U79 FIXED BITS (0000xxxx) | |
| 3867 | TETRIS_5.U4 1ST AND 2ND HALF IDENTICAL | |
| 3868 | TETRIS_6.U11 1ST AND 2ND HALF IDENTICAL | |
| 3869 | TETRIS_7.U16 1ST AND 2ND HALF IDENTICAL | |
| 3870 | 2764.u10 HOLDX8_3.U10 IDENTICAL | |
| 3871 | 2764.u14 HOLDX8_2.U14 IDENTICAL | |
| 3872 | 2764.u15 HOLDX8_4.U15 IDENTICAL | |
| 3873 | 82s129.u46 HOLD8_PR1.U46 IDENTICAL | |
| 3874 | 27512.u53 HOLDX8_8.U53 IDENTICAL | |
| 3875 | 82s129.u70 HOLD8_PR3.U79 IDENTICAL | |
| 3876 | 82s129.u84 HOLD8_PR2.U84 IDENTICAL | |
| 3877 | 2764.u9 HOLDX8_1.U9 IDENTICAL | |
| 3878 | 27256.u81 HOLDX8.U81 25.512695% | |
| 3879 | 27256.u11 NO MATCH | |
| 3880 | 27256.u16 NO MATCH | |
| 3881 | 27256.u4 NO MATCH | |
| 3882 | TETRIS_5.U4 NO MATCH | |
| 3883 | TETRIS_6.U11 NO MATCH | |
| 3884 | TETRIS_7.U16 NO MATCH | |
| 3885 | */ | |
| 3886 | ||
| 3887 | ROM_START( cmv4a ) | |
| 3888 | ROM_REGION( 0x10000, "main", 0 ) | |
| 3889 | ROM_LOAD( "holdx8.u81", 0x0000, 0x2000, CRC(2da4d267) SHA1(3deb6ce4703bb1cca2b58409a6fc5ba7cf601011) ) | |
| 3890 | ROM_CONTINUE(0x4000,0x2000) | |
| 3891 | ROM_CONTINUE(0x2000,0x2000) | |
| 3892 | ROM_CONTINUE(0x6000,0x2000) | |
| 3893 | ||
| 3894 | ROM_REGION( 0x30000, "gfx1", ROMREGION_DISPOSE ) /* double size... tetris gfx inside. */ | |
| 3895 | ROM_LOAD( "tetris_7.u16", 0x00000, 0x10000, CRC(a9e61fac) SHA1(a4093868b570af52f1cd816d523dbb6a750bc1af) ) | |
| 3896 | ROM_LOAD( "tetris_6.u11", 0x10000, 0x10000, CRC(f3e15b41) SHA1(6c44bcdcf7b29d201018e2c2cc0b6b0b62cbaf12) ) | |
| 3897 | ROM_LOAD( "tetris_5.u4", 0x20000, 0x10000, CRC(79a85560) SHA1(b028345ac2d01c643230c6e6c28189c11734aaf5) ) | |
| 3898 | ||
| 3899 | ROM_REGION( 0x8000, "gfx2", ROMREGION_DISPOSE ) | |
| 3900 | ROM_LOAD( "holdx8_4.u15", 0x0000, 0x2000, CRC(8607ffd9) SHA1(9bc94715554aa2473ae2ed249a47f29c7886b3dc) ) | |
| 3901 | ROM_LOAD( "holdx8_3.u10", 0x2000, 0x2000, CRC(c32367be) SHA1(ff217021b9c58e23b2226f8b0a7f5da966225715) ) | |
| 3902 | ROM_LOAD( "holdx8_2.u14", 0x4000, 0x2000, CRC(6dfcb188) SHA1(22430429c798954d9d979e62699b58feae7fdbf4) ) | |
| 3903 | ROM_LOAD( "holdx8_1.u9", 0x6000, 0x2000, CRC(9678ead2) SHA1(e80aefa98b2363fe9e6b2415762695ace272e4d3) ) | |
| 3904 | ||
| 3905 | ROM_REGION( 0x10000, "user1", 0 ) | |
| 3906 | // contains a bitmap? and an extra plane for gfx2, should it be used? | |
| 3907 | ROM_LOAD( "holdx8_8.u53", 0x0000, 0x10000, CRC(e92443d3) SHA1(4b6ca4521841610054165f085ae05510e77af191) ) | |
| 3908 | ||
| 3909 | ROM_REGION( 0x200, "proms", 0 ) | |
| 3910 | ROM_LOAD( "hold8_pr2.u84", 0x0000, 0x0100, CRC(0489b760) SHA1(78f8632b17a76335183c5c204cdec856988368b0) ) | |
| 3911 | ROM_LOAD( "hold8_pr3.u79", 0x0100, 0x0100, CRC(21eb5b19) SHA1(9b8425bdb97f11f4855c998c7792c3291fd07470) ) | |
| 3912 | ||
| 3913 | ROM_REGION( 0x100, "proms2", 0 ) | |
| 3914 | ROM_LOAD( "hold8_pr1.u46", 0x0000, 0x0100, CRC(50ec383b) SHA1(ae95b92bd3946b40134bcdc22708d5c6b0f4c23e) ) | |
| 3915 | ROM_END | |
| 3916 | ||
| 3917 | ||
| 2773 | 3918 | /* looks like a bootleg of cmv4 */ |
| 2774 | 3919 | ROM_START( cmaster ) |
| 2775 | 3920 | ROM_REGION( 0x10000, "main", 0 ) |
| r4135 | r4136 | |
| 2818 | 3963 | ROM_END |
| 2819 | 3964 | |
| 2820 | 3965 | |
| 2821 | /* doesn't seem to have 'cherry master 2' anywhere on the screen.. */ | |
| 2822 | /* | |
| 3966 | /* cmasterb & cmasterc | |
| 2823 | 3967 | |
| 2824 | 3968 | Cherry Master II ver 8.41 |
| 2825 | 3969 | |
| r4135 | r4136 | |
| 2840 | 3984 | 4x8 dip + 1 Switch (main test ???) |
| 2841 | 3985 | */ |
| 2842 | 3986 | |
| 2843 | ROM_START( cm | |
| 3987 | ROM_START( cmasterb ) | |
| 2844 | 3988 | ROM_REGION( 0x10000, "main", 0 ) |
| 2845 | 3989 | ROM_LOAD( "u81.9", 0x0000, 0x1000, CRC(09e44314) SHA1(dbb7e9afc9a1dc0d4ce7b150324077f3f3579c02) ) |
| 2846 | 3990 | ROM_CONTINUE(0x4000,0x1000) |
| r4135 | r4136 | |
| 2852 | 3996 | ROM_CONTINUE(0x5000,0x1000) |
| 2853 | 3997 | |
| 2854 | 3998 | ROM_REGION( 0x18000, "gfx1", ROMREGION_DISPOSE ) |
| 3999 | ROM_LOAD( "u16.7", 0x00000, 0x8000, CRC(19cc1d67) SHA1(47487f9362bfb36a32100ed772960628844462bf) ) | |
| 4000 | ROM_LOAD( "u11.6", 0x08000, 0x8000, CRC(63b3df4e) SHA1(9bacd23da598805ec18ec5ad15cab95d71eb9262) ) | |
| 2855 | 4001 | ROM_LOAD( "u4.5", 0x10000, 0x8000, CRC(e39fff9c) SHA1(22fdc517fa478441622c6245cecb5728c5595757) ) |
| 2856 | ROM_LOAD( "u11.6", 0x08000, 0x8000, CRC(63b3df4e) SHA1(9bacd23da598805ec18ec5ad15cab95d71eb9262) ) | |
| 2857 | ROM_LOAD( "u16.7", 0x00000, 0x8000, CRC(19cc1d67) SHA1(47487f9362bfb36a32100ed772960628844462bf) ) | |
| 2858 | 4002 | |
| 2859 | 4003 | ROM_REGION( 0x8000, "gfx2", ROMREGION_DISPOSE ) |
| 2860 | 4004 | ROM_LOAD( "u15.4", 0x0000, 0x2000, CRC(8607ffd9) SHA1(9bc94715554aa2473ae2ed249a47f29c7886b3dc) ) |
| r4135 | r4136 | |
| 2874 | 4018 | ROM_LOAD( "82s129.u46", 0x0000, 0x0100, CRC(50ec383b) SHA1(ae95b92bd3946b40134bcdc22708d5c6b0f4c23e) ) |
| 2875 | 4019 | ROM_END |
| 2876 | 4020 | |
| 2877 | ROM_START( cm | |
| 4021 | ROM_START( cm | |
| 2878 | 4022 | ROM_REGION( 0x10000, "main", 0 ) |
| 2879 | 4023 | ROM_LOAD( "msii841.u81", 0x3000, 0x1000, CRC(977db602) SHA1(0fd3d6781b654ac6befdc9278f84ca708d5d448c) ) |
| 2880 | 4024 | ROM_CONTINUE(0x2000,0x1000) |
| r4135 | r4136 | |
| 2886 | 4030 | ROM_CONTINUE(0x7000,0x1000) |
| 2887 | 4031 | |
| 2888 | 4032 | ROM_REGION( 0x18000, "gfx1", ROMREGION_DISPOSE ) |
| 4033 | ROM_LOAD( "msii841.u16", 0x00000, 0x8000, CRC(19cc1d67) SHA1(47487f9362bfb36a32100ed772960628844462bf) ) | |
| 4034 | ROM_LOAD( "msii841.u11", 0x08000, 0x8000, CRC(63b3df4e) SHA1(9bacd23da598805ec18ec5ad15cab95d71eb9262) ) | |
| 2889 | 4035 | ROM_LOAD( "msii841.u4", 0x10000, 0x8000, CRC(e39fff9c) SHA1(22fdc517fa478441622c6245cecb5728c5595757) ) |
| 2890 | ROM_LOAD( "msii841.u11", 0x08000, 0x8000, CRC(63b3df4e) SHA1(9bacd23da598805ec18ec5ad15cab95d71eb9262) ) | |
| 2891 | ROM_LOAD( "msii841.u16", 0x00000, 0x8000, CRC(19cc1d67) SHA1(47487f9362bfb36a32100ed772960628844462bf) ) | |
| 2892 | 4036 | |
| 2893 | 4037 | /* these gfx are in a different format to usual */ |
| 2894 | 4038 | ROM_REGION( 0x8000, "gfx2", ROMREGION_DISPOSE ) |
| r4135 | r4136 | |
| 2907 | 4051 | ROM_LOAD( "82s129.u46", 0x0000, 0x0100, CRC(50ec383b) SHA1(ae95b92bd3946b40134bcdc22708d5c6b0f4c23e) ) |
| 2908 | 4052 | ROM_END |
| 2909 | 4053 | |
| 4054 | /* | |
| 2910 | 4055 | |
| 4056 | Cherry Master '91 | |
| 4057 | ----------------- | |
| 4058 | ||
| 4059 | CPU: z8400 | |
| 4060 | other chips: NEC D71055C, WB5300 | |
| 4061 | Dips 5 x 8 position | |
| 4062 | ||
| 4063 | OSC: 12.000mhz | |
| 4064 | ||
| 4065 | all pals are type 16L8 | |
| 4066 | all proms are type s129 | |
| 4067 | ||
| 4068 | */ | |
| 4069 | ||
| 2911 | 4070 | ROM_START( cmast91 ) |
| 2912 | 4071 | ROM_REGION( 0x10000, "main", 0 ) |
| 2913 | 4072 | ROM_LOAD( "8.bin", 0x00000, 0x01000, CRC(31a16d9f) SHA1(f007148449d66954b780f12a9f910968a4052482) ) |
| r4135 | r4136 | |
| 2927 | 4086 | ROM_CONTINUE(0xe000,0x1000) |
| 2928 | 4087 | ROM_CONTINUE(0xf000,0x1000) |
| 2929 | 4088 | |
| 2930 | ROM_REGION( 0x40000, "user1", 0 ) // unknown, bitmaps, or sound? | |
| 2931 | ROM_LOAD( "9.bin", 0x00000, 0x40000, CRC(92342276) SHA1(f9436752f2ec67cf873fd01c729c7c113dc18be0) ) // ? | |
| 2932 | ||
| 2933 | 4089 | ROM_REGION( 0x18000, "gfx1", ROMREGION_DISPOSE ) |
| 2934 | ROM_LOAD( "5.bin", 0x10000, 0x8000, CRC(28ff88cc) SHA1(46bc0407be857e8348159735b60cfb660f047a56) ) | |
| 2935 | ROM_LOAD( "6.bin", 0x08000, 0x8000, CRC(13582e74) SHA1(27e318542606b8e8d38250749ba996402d314abd) ) | |
| 2936 | ROM_LOAD( "7.bin", 0x00000, 0x8000, CRC(1edf1f1d) SHA1(558fa01f1efd7f6541047d3930bdce0974bae5b0)) | |
| 4090 | ROM_LOAD( "7.bin", 0x00000, 0x8000, CRC(1edf1f1d) SHA1(558fa01f1efd7f6541047d3930bdce0974bae5b0)) | |
| 4091 | ROM_LOAD( "6.bin", 0x08000, 0x8000, CRC(13582e74) SHA1(27e318542606b8e8d38250749ba996402d314abd) ) | |
| 4092 | ROM_LOAD( "5.bin", 0x10000, 0x8000, CRC(28ff88cc) SHA1(46bc0407be857e8348159735b60cfb660f047a56) ) | |
| 2937 | 4093 | |
| 2938 | 4094 | ROM_REGION( 0x20000, "gfx2", ROMREGION_DISPOSE ) |
| 2939 | ROM_LOAD( "1.bin", 0x0000, 0x8000, CRC(71bdab69) SHA1(d2c594ed88d6368df15b623c48eecc1c219b839e) ) | |
| 2940 | ROM_LOAD( "2.bin", 0x8000, 0x8000, CRC(fccd48d7) SHA1(af564f5ef9ff5b6363897ce6bdf0b21123911fd4) ) | |
| 2941 | ROM_LOAD( "3.bin", 0x10000, 0x8000, CRC(dc77d04a) SHA1(d8656130cde54d4bb96307899f6d607867e49e6c) ) | |
| 2942 | ROM_LOAD( "4.bin", 0x18000, 0x8000, CRC(0dbabaa2) SHA1(44235b19dac1c996e2166672b03f6e3888ecbefa) ) | |
| 4095 | ROM_LOAD( "4.bin", 0x00000, 0x8000, CRC(0dbabaa2) SHA1(44235b19dac1c996e2166672b03f6e3888ecbefa) ) | |
| 4096 | ROM_LOAD( "3.bin", 0x08000, 0x8000, CRC(dc77d04a) SHA1(d8656130cde54d4bb96307899f6d607867e49e6c) ) | |
| 4097 | ROM_LOAD( "1.bin", 0x10000, 0x8000, CRC(71bdab69) SHA1(d2c594ed88d6368df15b623c48eecc1c219b839e) ) | |
| 4098 | ROM_LOAD( "2.bin", 0x18000, 0x8000, CRC(fccd48d7) SHA1(af564f5ef9ff5b6363897ce6bdf0b21123911fd4) ) | |
| 2943 | 4099 | |
| 4100 | ROM_REGION( 0x40000, "user1", 0 ) /* unknown, bitmaps, or sound? */ | |
| 4101 | ROM_LOAD( "9.bin", 0x00000, 0x40000, CRC(92342276) SHA1(f9436752f2ec67cf873fd01c729c7c113dc18be0) ) // ? | |
| 4102 | ||
| 2944 | 4103 | ROM_REGION( 0x300, "proms", 0 ) |
| 2945 | 4104 | ROM_LOAD( "p1.bin", 0x0000, 0x0100, CRC(ac529f04) SHA1(5bc92e50c85bb23e609172cc15c430ddea7fdcb5) ) |
| 2946 | 4105 | ROM_LOAD( "p2.bin", 0x0100, 0x0100, CRC(3febce95) SHA1(c7c0fec0fb024ebf7d7365a09d28ba3d0037b0b4) ) |
| 2947 | 4106 | ROM_LOAD( "p3.bin", 0x0200, 0x0100, CRC(99dbdf19) SHA1(3680335406f63289f8d9a81b4cd163e4aa0c14d4) ) |
| 2948 | 4107 | |
| 2949 | ROM_REGION( 0x100, "proms2", 0 ) / | |
| 4108 | ROM_REGION( 0x100, "proms2", 0 ) /* screen layout? */ | |
| 2950 | 4109 | ROM_LOAD( "p4.bin", 0x0000, 0x0100, CRC(72212427) SHA1(e87a91f28284313c706ebb8175a3586780636e31) ) |
| 4110 | ||
| 4111 | ROM_REGION( 0x800, "plds", 0 ) /* all 16L8 type, protected */ | |
| 4112 | ROM_LOAD( "pld1.bin", 0x0000, 0x0104, NO_DUMP ) | |
| 4113 | ROM_LOAD( "pld2.bin", 0x0200, 0x0104, NO_DUMP ) | |
| 4114 | ROM_LOAD( "pld3.bin", 0x0400, 0x0104, NO_DUMP ) | |
| 4115 | ROM_LOAD( "pld4.bin", 0x0600, 0x0104, NO_DUMP ) | |
| 2951 | 4116 | ROM_END |
| 2952 | 4117 | |
| 2953 | 4118 | /* |
| r4135 | r4136 | |
| 3004 | 4169 | ROM_END |
| 3005 | 4170 | |
| 3006 | 4171 | /* |
| 4172 | ||
| 3007 | 4173 | unknown koren or chinese bootleg of something? |
| 3008 | 4174 | |
| 3009 | 4175 | XTAL 12MHz |
| r4135 | r4136 | |
| 3081 | 4247 | ROM_LOAD( "prom2", 0x0000, 0x0020, CRC(7b1a769f) SHA1(788b3573df17d398c74662fec4fd7693fc27e2ef) ) |
| 3082 | 4248 | ROM_END |
| 3083 | 4249 | |
| 4250 | /* | |
| 4251 | LADY LINER - TAB Austria | |
| 3084 | 4252 | |
| 4253 | Hardware Notes: | |
| 4254 | --------------- | |
| 4255 | ||
| 4256 | CPU: 1x Z80. | |
| 4257 | Sound: 1x AY8930. | |
| 4258 | I/O: 2x P8255A. | |
| 4259 | ||
| 4260 | Clock: 1x Xtal @ 12.0000MHz. | |
| 4261 | ||
| 4262 | ROMs: 1x NM27C256Q (ladybrd) | |
| 4263 | 7x M27C64A (1,2,3,4,71,72,73) | |
| 4264 | 2x PROM AM27S19PC (39,73) | |
| 4265 | 3x PROM AM27S21PC (37,38,96) | |
| 4266 | ||
| 4267 | RAM: 4x HY6116ALP-10 (near graphics ROMs) | |
| 4268 | 1x HY6116ALP-10 (near program ROM) | |
| 4269 | ||
| 4270 | 1x 8 DIP Switches. | |
| 4271 | 1x trimmer (volume). | |
| 4272 | ||
| 4273 | Connectors: 1x 18x2 edge connector. | |
| 4274 | 1x 22x2 edge connector. | |
| 4275 | ||
| 4276 | Both connectors are wired to a strange small PCB with: | |
| 4277 | 1x 6x2 edge connector + 1x 60x2 edge connector (with smaller spacing) + 2x 8 DIP Switches. | |
| 4278 | ||
| 4279 | Silkscreened on PCB: | |
| 4280 | "TAB AUSTRIA" | |
| 4281 | ||
| 4282 | Sticker on PCB: | |
| 4283 | "TAB Austria" & "LL 2690" | |
| 4284 | ||
| 4285 | */ | |
| 4286 | ||
| 4287 | ROM_START( ladylinr ) | |
| 4288 | ROM_REGION( 0x8000, "main", 0 ) | |
| 4289 | ROM_LOAD( "ladybrd.bin", 0x0000, 0x8000, CRC(44d2aed0) SHA1(1afe6178d1bf4ad0b623f33be879ed5180ad2db1) ) | |
| 4290 | ||
| 4291 | ROM_REGION( 0x18000, "gfx1", ROMREGION_DISPOSE ) | |
| 4292 | ROM_LOAD( "ll73.bin", 0x00000, 0x8000, CRC(afa4a705) SHA1(779340713df7029553cfc1c57997dfdd96a0f0cc) ) | |
| 4293 | ROM_LOAD( "ll72.bin", 0x08000, 0x8000, CRC(bd1d8a39) SHA1(01e37704c753352024e79b0b83b040f8288b9aed) ) | |
| 4294 | ROM_LOAD( "ll71.bin", 0x10000, 0x8000, CRC(1c417efa) SHA1(491579a76d80c4f488ef94393d12a190571ae285) ) | |
| 4295 | ||
| 4296 | ROM_REGION( 0x8000, "gfx2", ROMREGION_DISPOSE ) | |
| 4297 | ROM_LOAD( "1.bin", 0x0000, 0x2000, CRC(29d6f197) SHA1(1542ca457594f6b7fe8f28f7d78023edd7021bc8) ) | |
| 4298 | ROM_LOAD( "2.bin", 0x2000, 0x2000, CRC(5f812e65) SHA1(70d9ea82f9337936bf21f82b6961768d436f3a6f) ) | |
| 4299 | ROM_LOAD( "3.bin", 0x4000, 0x2000, CRC(898b9ed5) SHA1(11b7d1cfcf425d00d086c74e0dbcb72068dda9fe) ) | |
| 4300 | ROM_LOAD( "4.bin", 0x6000, 0x2000, CRC(4f7cfb35) SHA1(0617cf4419be00d9bacc78724089cb8af4104d68) ) | |
| 4301 | ||
| 4302 | ROM_REGION( 0x200, "proms", 0 ) | |
| 4303 | ROM_LOAD( "am27s21pc.38", 0x0000, 0x0100, CRC(06a0ee6f) SHA1(e793fbb9e14e4e6c6d6783a36edee74f28e7e214) ) | |
| 4304 | ROM_LOAD( "am27s21pc.37", 0x0100, 0x0100, CRC(8589d23c) SHA1(9629c0d8af3cce47ef376898a4be84c0752a265b) ) | |
| 4305 | ||
| 4306 | ROM_REGION( 0x40, "proms2", 0 ) | |
| 4307 | ROM_LOAD( "am27s19pc.39", 0x0000, 0x0020, CRC(c6b41352) SHA1(d7c3b5aa32e4e456c9432a13bede1db6d62eb270) ) | |
| 4308 | ||
| 4309 | ROM_REGION( 0x100, "unkprom", 0 ) | |
| 4310 | ROM_LOAD( "am27s21pc.96", 0x0000, 0x0100, CRC(1d668d4a) SHA1(459117f78323ea264d3a29f1da2889bbabe9e4be) ) | |
| 4311 | ||
| 4312 | ROM_REGION( 0x40, "unkprom2", 0 ) | |
| 4313 | ROM_LOAD( "am27s19pc.73", 0x0000, 0x0020, CRC(b48d0b41) SHA1(01d2d0fd5e79c17043e97146001150b4b32ac86c) ) | |
| 4314 | ROM_END | |
| 4315 | ||
| 4316 | /* | |
| 4317 | ||
| 4318 | Board had a sticker that said MODEL 9006 | |
| 4319 | ||
| 4320 | .u22 2764 | |
| 4321 | .u21 2764 | |
| 4322 | .u20 2764 | |
| 4323 | .u19 2764 | |
| 4324 | .u18 27256 | |
| 4325 | .u17 27256 | |
| 4326 | .u16 27256 | |
| 4327 | .u66 27256 | |
| 4328 | ||
| 4329 | HM6116P | |
| 4330 | D4016C-2 x3 | |
| 4331 | D4016C-5 | |
| 4332 | 12Mhz Crystal | |
| 4333 | D780C | |
| 4334 | UM82C55A-PC | |
| 4335 | M5L8255AP-5 | |
| 4336 | D8255AC-2 | |
| 4337 | ||
| 4338 | */ | |
| 4339 | ROM_START( kkojnoli ) | |
| 4340 | ROM_REGION( 0x8000, "main", 0 ) | |
| 4341 | ROM_LOAD( "9006.u66", 0x0000, 0x8000, CRC(5807a005) SHA1(9c7156656cd651c7785c42ce25e96aadd8e3d9ff) ) | |
| 4342 | ||
| 4343 | ROM_REGION( 0x18000, "gfx1", ROMREGION_DISPOSE ) | |
| 4344 | ROM_LOAD( "9006.u18", 0x00000, 0x8000, CRC(b83e304f) SHA1(1022518928d8cb094340927a65b8fb72b0f3c640) ) | |
| 4345 | ROM_LOAD( "9006.u17", 0x08000, 0x8000, CRC(13a3258b) SHA1(605555ae48012ca4b1829d1c835b33ddeec17da6) ) | |
| 4346 | ROM_LOAD( "9006.u16", 0x10000, 0x8000, CRC(84d09be4) SHA1(09a9e491a9a5fc7882c88d46ae2a6e7e99d082f4) ) | |
| 4347 | ||
| 4348 | ROM_REGION( 0x8000, "gfx2", ROMREGION_DISPOSE ) /* redumped */ | |
| 4349 | ROM_LOAD( "9006.u22", 0x0000, 0x2000, CRC(4e93130d) SHA1(faaaf51844da8d3bdb908fb8ce0f2442e26b5f62) ) | |
| 4350 | ROM_LOAD( "9006.u20", 0x2000, 0x2000, CRC(717fe736) SHA1(04e578c1992bbdb312bb6bc12137bd96522a50e6) ) | |
| 4351 | ROM_LOAD( "9006.u21", 0x4000, 0x2000, CRC(f5314f3f) SHA1(0423dc545fce0322377f1934894a999427709b33) ) | |
| 4352 | ROM_LOAD( "9006.u19", 0x6000, 0x2000, CRC(c321d50b) SHA1(8c132d8fcc812bcec5966c8a3960dfbe5d9f8c36) ) | |
| 4353 | ||
| 4354 | /* proper proms recent dumped */ | |
| 4355 | ROM_REGION( 0x200, "proms", 0 ) | |
| 4356 | ROM_LOAD( "9006.u24", 0x0000, 0x0100, CRC(23e81049) SHA1(78071dae70fad870e972d944642fb3a2374be5e4) ) | |
| 4357 | ROM_LOAD( "9006.u23", 0x0100, 0x0100, CRC(526cf9d3) SHA1(eb779d70f2507d0f26d225ac8f5de8f2243599ca) ) | |
| 4358 | ||
| 4359 | /* this one seems bitrotten (bits 3 and 7), except for this issue, | |
| 4360 | the prom have concordance with prom1 from lucky8 */ | |
| 4361 | ROM_REGION( 0x40, "proms2", 0 ) | |
| 4362 | ROM_LOAD( "prom1", 0x0000, 0x0020, CRC(c6b41352) SHA1(d7c3b5aa32e4e456c9432a13bede1db6d62eb270) ) | |
| 4363 | // ROM_LOAD( "9006.u57", 0x0000, 0x0020, CRC(8a37416a) SHA1(696b46db2ff2bb9ef471ff925977e8a186b17de8) ) | |
| 4364 | ||
| 4365 | ROM_REGION( 0x100, "unkprom", 0 ) | |
| 4366 | ROM_LOAD( "9006.u41", 0x0000, 0x0100, CRC(1d668d4a) SHA1(459117f78323ea264d3a29f1da2889bbabe9e4be) ) | |
| 4367 | ||
| 4368 | ROM_REGION( 0x20, "unkprom2", 0 ) | |
| 4369 | ROM_LOAD( "9006.u58", 0x0000, 0x0020, CRC(6df3f972) SHA1(0096a7f7452b70cac6c0752cb62e24b643015b5c) ) | |
| 4370 | ROM_END | |
| 4371 | ||
| 4372 | /* | |
| 4373 | ||
| 4374 | Magical Tonic | |
| 4375 | ||
| 4376 | unknown, 40 pin cpu (plastic box, with "Tonic" sticker on it) | |
| 4377 | 8255 x3 | |
| 4378 | YM2203 | |
| 4379 | 12 MHz | |
| 4380 | ||
| 4381 | 4x DSW | |
| 4382 | ||
| 4383 | */ | |
| 4384 | ||
| 4385 | ROM_START( mtonic ) | |
| 4386 | ROM_REGION( 0x10000, "main", 0 ) | |
| 4387 | ROM_LOAD( "8.e6", 0x0000, 0x8000, CRC(01daf2af) SHA1(cb9b12c79dce3c9123510a49dffc9f3cee056cf6) ) | |
| 4388 | ROM_LOAD( "9.e6", 0x8000, 0x8000, CRC(1770ac79) SHA1(cadfd00ae75b90b1d202d741828e0afbd5ba0bec) ) | |
| 4389 | ||
| 4390 | ROM_REGION( 0x30000, "gfx1", ROMREGION_DISPOSE ) | |
| 4391 | ROM_LOAD( "5.j10", 0x00000, 0x10000, CRC(b8032ea3) SHA1(15e5335a583d8e7a5422cd4d1d7342874a4962ab) ) | |
| 4392 | ROM_LOAD( "6.j11", 0x10000, 0x10000, CRC(ff38ff30) SHA1(8fef6e1fe7c307c69c9dcafa69ecf66467b9cb41) ) | |
| 4393 | ROM_LOAD( "7.j12", 0x20000, 0x10000, CRC(8f1d2db9) SHA1(200de01334905079dca542541e442d4194ecd913) ) | |
| 4394 | ||
| 4395 | ROM_REGION( 0x10000, "gfx2", ROMREGION_DISPOSE ) | |
| 4396 | ROM_LOAD( "1.l10", 0x0000, 0x4000, CRC(746588db) SHA1(2a0af552011246d4cc0cd0b670907cf8685ce8ef) ) | |
| 4397 | ROM_LOAD( "2.l11", 0x4000, 0x4000, CRC(8b7dd248) SHA1(a3ebde9fd0b6b1e42aa9b6d8e30c225abf2f80ce) ) | |
| 4398 | ROM_LOAD( "3.l12", 0x8000, 0x4000, CRC(de05e678) SHA1(8b9fcb9f912075a20a9ae38100006b57d508e0e7) ) | |
| 4399 | ROM_LOAD( "4.l13", 0xc000, 0x4000, CRC(8c542eee) SHA1(cb424e2a67c6d39302beca7cd5244bcad4a91189) ) | |
| 4400 | ||
| 4401 | ROM_REGION( 0x200, "proms", 0 ) | |
| 4402 | ROM_LOAD( "prom1", 0x0000, 0x0100, NO_DUMP ) | |
| 4403 | ROM_LOAD( "prom2", 0x0100, 0x0100, NO_DUMP ) | |
| 4404 | ||
| 4405 | ROM_REGION( 0x40, "proms2", 0 ) | |
| 4406 | ROM_LOAD( "prom3", 0x0000, 0x0020, NO_DUMP ) | |
| 4407 | ROM_END | |
| 4408 | ||
| 4409 | ||
| 4410 | /* these 'Amcoe' games look like bootlegs of cherry master | |
| 4411 | the z80 roms are encrypted */ | |
| 4412 | ROM_START( schery98 ) | |
| 4413 | ROM_REGION( 0x10000, "main", 0 ) | |
| 4414 | ROM_LOAD( "sk98133.bin", 0x0000, 0x10000, CRC(77a5dd54) SHA1(e693f477b42b83f1f5e45fb7c56486119bf91856) ) | |
| 4415 | ||
| 4416 | ROM_REGION( 0x20000, "graphics", ROMREGION_DISPOSE ) | |
| 4417 | ROM_LOAD( "sk98h.bin", 0x00000, 0x10000, CRC(0574357b) SHA1(96a846f6d49dd67ad078ad9240e632f79ae1b437) ) | |
| 4418 | ROM_LOAD( "sk98l.bin", 0x10000, 0x10000, CRC(ebe802a4) SHA1(178542c204fd1027874e6d2c099edaa7878c993f) ) | |
| 4419 | ||
| 4420 | ROM_REGION( 0x18000, "gfx1", ROMREGION_DISPOSE ) | |
| 4421 | ROM_COPY( "graphics", 0x04000, 0x00000, 0x4000 ) // 1 | |
| 4422 | ROM_COPY( "graphics", 0x0c000, 0x04000, 0x4000 ) // 2 | |
| 4423 | ROM_COPY( "graphics", 0x08000, 0x08000, 0x4000 ) // 1 | |
| 4424 | ROM_COPY( "graphics", 0x14000, 0x0c000, 0x4000 ) // 2 | |
| 4425 | ROM_COPY( "graphics", 0x18000, 0x10000, 0x4000 ) // 1 | |
| 4426 | ROM_COPY( "graphics", 0x1c000, 0x14000, 0x4000 ) // 2 | |
| 4427 | ||
| 4428 | ROM_REGION( 0x8000, "gfx2", ROMREGION_DISPOSE ) | |
| 4429 | ROM_COPY( "graphics", 0x00000, 0x04000, 0x4000 ) | |
| 4430 | ROM_COPY( "graphics", 0x10000, 0x00000, 0x4000 ) | |
| 4431 | ||
| 4432 | ROM_REGION( 0x200, "proms", 0 ) // palette | |
| 4433 | ROM_LOAD( "sk98u19.bin", 0x0000, 0x0100, CRC(796c7960) SHA1(0f64a8119fd4809a5ac79585b415b34b2a83e9dc) ) | |
| 4434 | ROM_LOAD( "sk98u20.bin", 0x0100, 0x0100, CRC(a0862663) SHA1(e27c3bba5f87b51a19ea8068f2ce7b82a6f0eedb) ) | |
| 4435 | ||
| 4436 | ROM_REGION( 0x100, "sku1920.bin", 0 ) // colours again? | |
| 4437 | ROM_LOAD( "sku1920.bin", 0x0000, 0x0100, CRC(a8c86d5e) SHA1(d19cd5e57ac8fdd685540c1bb2e1474d1326362b) ) | |
| 4438 | ||
| 4439 | ROM_REGION( 0x80000, "oki", 0 ) // samples | |
| 4440 | ROM_LOAD( "sk98t.bin", 0x00000, 0x20000, CRC(8598b059) SHA1(9e031e30e58a9c1b3d029004ee0f1616711fa2ae) ) | |
| 4441 | ROM_END | |
| 4442 | ||
| 4443 | ||
| 4444 | ||
| 4445 | ROM_START( schery97 ) | |
| 4446 | ROM_REGION( 0x20000, "main", 0 ) | |
| 4447 | ROM_LOAD( "sc352.bin", 0x00000, 0x10000, CRC(d3857d85) SHA1(e97b2634f0993631023c08f6baf800461abfad12) ) | |
| 4448 | ROM_LOAD( "sc352c4.bin", 0x10000, 0x10000, CRC(44f55f6e) SHA1(8b6e8618281de480979de37c7b36a0e68a524f47) ) // ?? alt program? | |
| 4449 | ||
| 4450 | ROM_REGION( 0x20000, "graphics", ROMREGION_DISPOSE ) | |
| 4451 | ROM_LOAD( "sc97h.bin", 0x00000, 0x10000, CRC(def39ee2) SHA1(5e6817bd947ebf16d0313285a00876b796b71cab) ) | |
| 4452 | ROM_LOAD( "sc97l.bin", 0x10000, 0x10000, CRC(6f4d6aea) SHA1(6809c26e6975cac97b0f8c01a508d4e022859b1a) ) | |
| 4453 | ||
| 4454 | ROM_REGION( 0x18000, "gfx1", ROMREGION_DISPOSE ) | |
| 4455 | ROM_COPY( "graphics", 0x04000, 0x00000, 0x4000 ) // 1 | |
| 4456 | ROM_COPY( "graphics", 0x0c000, 0x04000, 0x4000 ) // 2 | |
| 4457 | ROM_COPY( "graphics", 0x08000, 0x08000, 0x4000 ) // 1 | |
| 4458 | ROM_COPY( "graphics", 0x14000, 0x0c000, 0x4000 ) // 2 | |
| 4459 | ROM_COPY( "graphics", 0x18000, 0x10000, 0x4000 ) // 1 | |
| 4460 | ROM_COPY( "graphics", 0x1c000, 0x14000, 0x4000 ) // 2 | |
| 4461 | ||
| 4462 | ROM_REGION( 0x8000, "gfx2", ROMREGION_DISPOSE ) | |
| 4463 | ROM_COPY( "graphics", 0x00000, 0x04000, 0x4000 ) | |
| 4464 | ROM_COPY( "graphics", 0x10000, 0x00000, 0x4000 ) | |
| 4465 | ||
| 4466 | ROM_REGION( 0x200, "proms", 0 ) // palette | |
| 4467 | ROM_LOAD( "sc97u19.bin", 0x0000, 0x0100, CRC(6a01caca) SHA1(9b3e9eebb9fcc8770f7e92f0f1c0434516ee613d) ) | |
| 4468 | ROM_LOAD( "sc97u20.bin", 0x0100, 0x0100, CRC(5899c1d5) SHA1(c335b99bb58da3a11005a8952a15d9f43bdff157) ) | |
| 4469 | ||
| 4470 | ROM_REGION( 0x100, "sku1920.bin", 0 ) // colours again? | |
| 4471 | ROM_LOAD( "scu1920.bin", 0x0000, 0x0100, CRC(3aa291dd) SHA1(f35c916b5463ff9ec6e57048af29a746148a13af) ) | |
| 4472 | ||
| 4473 | ROM_REGION( 0x80000, "oki", 0 ) // samples | |
| 4474 | ROM_LOAD( "sc97t.bin", 0x00000, 0x20000, CRC(8598b059) SHA1(9e031e30e58a9c1b3d029004ee0f1616711fa2ae) ) | |
| 4475 | ROM_END | |
| 4476 | ||
| 4477 | ||
| 3085 | 4478 | static DRIVER_INIT(goldstar) |
| 3086 | 4479 | { |
| 3087 | 4480 | int A; |
| r4135 | r4136 | |
| 3103 | 4496 | int A; |
| 3104 | 4497 | UINT8 *buffer; |
| 3105 | 4498 | |
| 3106 | static UINT16 cherry_swaptables[32] = { | |
| 4499 | static const UINT16 cherry_swaptables[32] = { | |
| 3107 | 4500 | /* to align with goldstar */ |
| 3108 | 4501 | 0x0800, 0x4000, 0x2800, 0x5800, |
| 3109 | 4502 | 0x1800, 0x3000, 0x6800, 0x7000, |
| r4135 | r4136 | |
| 3146 | 4539 | #endif |
| 3147 | 4540 | } |
| 3148 | 4541 | |
| 3149 | UINT8 decrypt(UINT8 cipherText, UINT16 address) | |
| 4542 | static UINT8 decrypt(UINT8 cipherText, UINT16 address) | |
| 3150 | 4543 | { |
| 3151 | 4544 | int idx; |
| 3152 | 4545 | UINT8 output; |
| r4135 | r4136 | |
| 3163 | 4556 | return output ^ sbox[idx]; |
| 3164 | 4557 | } |
| 3165 | 4558 | |
| 3166 | UINT8 chry10_decrypt(UINT8 cipherText) | |
| 4559 | static UINT8 chry10_decrypt(UINT8 cipherText) | |
| 3167 | 4560 | { |
| 3168 | 4561 | return cipherText ^ (BIT(cipherText, 4) << 3) ^ (BIT(cipherText, 1) << 5) ^ (BIT(cipherText, 6) << 7); |
| 3169 | 4562 | } |
| r4135 | r4136 | |
| 3188 | 4581 | free(buffer); |
| 3189 | 4582 | |
| 3190 | 4583 | do_blockswaps(ROM); |
| 4584 | ||
| 4585 | /* The game has a PIC for protection. | |
| 4586 | If the code enter to this sub, just | |
| 4587 | keeps looping eternally... | |
| 4588 | */ | |
| 4589 | ROM[0xA5DC] = 0xc9; | |
| 4590 | ||
| 3191 | 4591 | dump_to_file(machine, ROM); |
| 3192 | 4592 | } |
| 3193 | 4593 | |
| r4135 | r4136 | |
| 3282 | 4682 | GAME( 199?, goldstbl, goldstar, goldstbl, goldstar, 0, ROT0, "IGS", "Golden Star (Blue version)", 0 ) |
| 3283 | 4683 | GAME( 199?, moonlght, goldstar, moonlght, goldstar, 0, ROT0, "bootleg", "Moon Light (bootleg of Golden Star)", 0 ) |
| 3284 | 4684 | GAME( 199?, chrygld, 0, chrygld, chrygld, chrygld, ROT0, "bootleg", "Cherry Gold I", 0 ) |
| 3285 | GAME( 199?, chry10, 0, chrygld, | |
| 4685 | GAME( 199?, chry10, 0, chrygld, | |
| 3286 | 4686 | |
| 3287 | 4687 | // are these really dyna, or bootlegs? |
| 3288 | 4688 | GAME( 199?, ncb3, 0, ncb3, ncb3, 0, ROT0, "Dyna", "Cherry Bonus III (ver.1.40, set 1)", 0 ) |
| r4135 | r4136 | |
| 3292 | 4692 | // cherry master hardware has a rather different mem map, but is basically the same |
| 3293 | 4693 | GAME( 198?, cmv801, 0, cm, cmv801, cm, ROT0, "Corsica", "Cherry Master (Corsica, ver.8.01)", 0 ) /* says ED-96 where the manufacturer is on some games.. */ |
| 3294 | 4694 | |
| 3295 | GAME( 1992, cmv4, 0, cm, cmv4, cmv4, ROT0, "Dyna", "Cherry Master (ver.4)", 0 ) | |
| 3296 | GAME( 1991, cmaster, cmv4, cm, cmaster, 0, ROT0, "Dyna", "Cherry Master I (ver.1.01)", 0 ) | |
| 3297 | GAME( 198?, cm2v841, cmv4, cm, cmv801, 0, ROT0, "Dyna", "Cherry Master (II?) (ver.8.41, set 1)", GAME_NOT_WORKING ) | |
| 3298 | GAME( 198?, cm2841a, cmv4, cm, cmv801, 0, ROT0, "Dyna", "Cherry Master (II?) (ver.8.41, set 2)", GAME_NOT_WORKING ) | |
| 4695 | GAME( 1992, cmv4, 0, cm, cmv4, cmv4, ROT0, "Dyna", "Cherry Master (ver.4, set 1)", 0 ) | |
| 4696 | GAME( 1992, cmv4a, cmv4, cm, cmv4, cmv4, ROT0, "Dyna", "Cherry Master (ver.4, set 2)", GAME_NOT_WORKING ) /* stealth game? */ | |
| 4697 | GAME( 1991, cmaster, 0, cm, cmaster, 0, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 1)", 0 ) | |
| 4698 | GAME( 1991, cmasterb, cmaster, cm, cmasterb, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 2)", 0 ) | |
| 4699 | GAME( 1991, cmasterc, cmaster, cm, cmasterc, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 3)", GAME_IMPERFECT_GRAPHICS ) | |
| 4700 | GAME( 1991, cmast91, 0, cmast91, cmast91, cmast91, ROT0, "Dyna", "Cherry Master '91 (ver.1.30)", 0 ) | |
| 3299 | 4701 | |
| 3300 | GAME( 1991, cmast91, 0, cmast91, cmv801, cmast91, ROT0, "Dyna", "Cherry Master '91 (ver.1.30)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_NOT_WORKING ) | |
| 3301 | 4702 | |
| 3302 | GAME( 1989, lucky8, 0, lucky8, lucky8, 0, ROT0, "Wing Co.Ltd / GEI", "New Lucky 8 Lines (set 1)", GAME_IMPERFECT_COLORS ) | |
| 3303 | GAME( 1989, lucky8a, lucky8, lucky8, lucky8a, lucky8a, ROT0, "Wing Co.Ltd / GEI", "New Lucky 8 Lines (set 2)", GAME_IMPERFECT_COLORS ) | |
| 4703 | GAME( 1989, lucky8, 0, lucky8, lucky8, 0, ROT0, "Wing Co.Ltd / GEI", "New Lucky 8 Lines (set 1)", 0 ) | |
| 4704 | GAME( 1989, lucky8a, lucky8, lucky8, lucky8a, lucky8a, ROT0, "Wing Co.Ltd / GEI", "New Lucky 8 Lines (set 2)", 0 ) | |
| 4705 | GAME( 198?, ladylinr, 0, ladylinr, ladylinr, 0, ROT0, "TAB Austria", "Lady Liner", 0 ) | |
| 4706 | GAME( 198?, kkojnoli, 0, kkojnoli, kkojnoli, 0, ROT0, "south korean hack", "Kkoj Noli (Kill the Bees)", GAME_IMPERFECT_COLORS ) | |
| 4707 | ||
| 4708 | GAME( 198?, mtonic, 0, ncb3, cmv801, 0, ROT0, "Tonic", "Magical Tonic?", GAME_WRONG_COLORS | GAME_NOT_WORKING ) | |
| 4709 | ||
| 4710 | // bootlegs of cherry master? | |
| 4711 | GAME( 1998, schery98, 0, cmnobmp, cmv801, 0, ROT0, "Amcoe", "Skill Cherry '98", GAME_NOT_WORKING ) | |
| 4712 | GAME( 1998, schery97, 0, cmnobmp, cmv801, 0, ROT0, "Amcoe", "Skill Cherry '97", GAME_NOT_WORKING ) | |
| 4713 | ||
| 4714 | /* possible stealth sets: | |
| 4715 | ||
| 4716 | - cmaster | |
| 4717 | - cmv4 | |
| 4718 | - cmv4a ---> see the 1fxx zone. put a bp in 1f9f to see the loop. | |
| 4719 | - cm2v841 | |
| 4720 | - cm2841a | |
| 4721 | - cmast91 | |
| 4722 | ||
| 4723 | */ |
| r4135 | r4136 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | TODO: |
| 26 | 26 | |
| 27 | - Hook the PPI 8255 devices and rework the I/O based on them. | |
| 28 | - Proper M5M82C255 emulation. | |
| 27 | - Proper M5M82C255 device emulation. | |
| 29 | 28 | |
| 30 | 29 | |
| 31 | 30 | *************************************************************************************************************/ |
| r4135 | r4136 | |
| 36 | 35 | #include "driver.h" |
| 37 | 36 | #include "cpu/z80/z80.h" |
| 38 | 37 | #include "sound/ay8910.h" |
| 38 | #include "machine/8255ppi.h" | |
| 39 | 39 | |
| 40 | 40 | static tilemap *tmap; |
| 41 | 41 | |
| r4135 | r4136 | |
| 58 | 58 | static UINT8* reelscroll3; |
| 59 | 59 | static UINT8* reelscroll4; |
| 60 | 60 | |
| 61 | static UINT8 skylncr_nmi_enable; | |
| 61 | 62 | |
| 63 | ||
| 64 | /************************************** | |
| 65 | * Video Hardware * | |
| 66 | **************************************/ | |
| 67 | ||
| 62 | 68 | static WRITE8_HANDLER( skylncr_videoram_w ) |
| 63 | 69 | { |
| 64 | 70 | skylncr_videoram[offset] = data; |
| r4135 | r4136 | |
| 106 | 112 | static VIDEO_START( skylncr ) |
| 107 | 113 | { |
| 108 | 114 | |
| 109 | tmap = tilemap_create( machine, get_tile_info, tilemap_scan_rows, | |
| 110 | 8,8, 0x40,0x20 ); | |
| 115 | tmap = tilemap_create( machine, get_tile_info, tilemap_scan_rows, 8, 8, 0x40, 0x20 ); | |
| 111 | 116 | |
| 112 | reel_1_tilemap = tilemap_create(machine, get_reel_1_tile_info, tilemap_scan_rows, 8,32, 64,8 ); | |
| 113 | reel_2_tilemap = tilemap_create(machine, get_reel_2_tile_info, tilemap_scan_rows, 8,32, 64,8 ); | |
| 114 | reel_3_tilemap = tilemap_create(machine, get_reel_3_tile_info, tilemap_scan_rows, 8,32, 64,8 ); | |
| 115 | reel_4_tilemap = tilemap_create(machine, get_reel_4_tile_info, tilemap_scan_rows, 8,32, 64,8 ); | |
| 117 | reel_1_tilemap = tilemap_create(machine, get_reel_1_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 118 | reel_2_tilemap = tilemap_create(machine, get_reel_2_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 119 | reel_3_tilemap = tilemap_create(machine, get_reel_3_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 120 | reel_4_tilemap = tilemap_create(machine, get_reel_4_tile_info, tilemap_scan_rows, 8, 32, 64, 8 ); | |
| 116 | 121 | |
| 117 | 122 | tilemap_set_scroll_cols(reel_2_tilemap, 0x40); |
| 118 | 123 | tilemap_set_scroll_cols(reel_3_tilemap, 0x40); |
| r4135 | r4136 | |
| 127 | 132 | } |
| 128 | 133 | |
| 129 | 134 | // are these hardcoded, or registers? |
| 130 | static const rectangle visible1 = { 0*8, (14+48)*8-1, 4*8, (4+7)*8-1 }; | |
| 131 | static const rectangle visible2 = { 0*8, (14+48)*8-1, 12*8, (12+7)*8-1 }; | |
| 132 | static const rectangle visible3 = { 0*8, (14+48)*8-1, 20*8, (20+7)*8-1 }; | |
| 135 | static const rectangle visible1 = { 0*8, (20+48)*8-1, 4*8, (4+7)*8-1 }; | |
| 136 | static const rectangle visible2 = { 0*8, (20+48)*8-1, 12*8, (12+7)*8-1 }; | |
| 137 | static const rectangle visible3 = { 0*8, (20+48)*8-1, 20*8, (20+7)*8-1 }; | |
| 133 | 138 | |
| 134 | 139 | |
| 135 | 140 | static VIDEO_UPDATE( skylncr ) |
| r4135 | r4136 | |
| 146 | 151 | tilemap_set_scrolly(reel_4_tilemap, i, reelscroll4[i]); |
| 147 | 152 | } |
| 148 | 153 | |
| 149 | tilemap_draw(bitmap,&visible1,reel_2_tilemap,0,0); | |
| 150 | tilemap_draw(bitmap,&visible2,reel_3_tilemap,0,0); | |
| 151 | tilemap_draw(bitmap,&visible3,reel_4_tilemap,0,0); | |
| 154 | tilemap_draw(bitmap,&visible1,reel_2_tilemap, 0, 0); | |
| 155 | tilemap_draw(bitmap,&visible2,reel_3_tilemap, 0, 0); | |
| 156 | tilemap_draw(bitmap,&visible3,reel_4_tilemap, 0, 0); | |
| 152 | 157 | |
| 153 | 158 | |
| 154 | 159 | tilemap_draw(bitmap,cliprect, tmap, 0, 0); |
| 155 | 160 | return 0; |
| 156 | 161 | } |
| 157 | 162 | |
| 158 | WRITE8_HANDLER( reeltiles_1_w ) | |
| 163 | static WRITE8_HANDLER( reeltiles_1_w ) | |
| 159 | 164 | { |
| 160 | 165 | reeltiles_1_ram[offset] = data; |
| 161 | 166 | tilemap_mark_tile_dirty(reel_1_tilemap, offset); |
| 162 | 167 | } |
| 163 | 168 | |
| 164 | WRITE8_HANDLER( reeltiles_2_w ) | |
| 169 | static WRITE8_HANDLER( reeltiles_2_w ) | |
| 165 | 170 | { |
| 166 | 171 | reeltiles_2_ram[offset] = data; |
| 167 | 172 | tilemap_mark_tile_dirty(reel_2_tilemap, offset); |
| 168 | 173 | } |
| 169 | 174 | |
| 170 | WRITE8_HANDLER( reeltiles_3_w ) | |
| 175 | static WRITE8_HANDLER( reeltiles_3_w ) | |
| 171 | 176 | { |
| 172 | 177 | reeltiles_3_ram[offset] = data; |
| 173 | 178 | tilemap_mark_tile_dirty(reel_3_tilemap, offset); |
| 174 | 179 | } |
| 175 | 180 | |
| 176 | WRITE8_HANDLER( reeltiles_4_w ) | |
| 181 | static WRITE8_HANDLER( reeltiles_4_w ) | |
| 177 | 182 | { |
| 178 | 183 | reeltiles_4_ram[offset] = data; |
| 179 | 184 | tilemap_mark_tile_dirty(reel_4_tilemap, offset); |
| 180 | 185 | } |
| 181 | 186 | |
| 182 | WRITE8_HANDLER( reeltileshigh_1_w ) | |
| 187 | static WRITE8_HANDLER( reeltileshigh_1_w ) | |
| 183 | 188 | { |
| 184 | 189 | reeltileshigh_1_ram[offset] = data; |
| 185 | 190 | tilemap_mark_tile_dirty(reel_1_tilemap, offset); |
| 186 | 191 | } |
| 187 | 192 | |
| 188 | WRITE8_HANDLER( reeltileshigh_2_w ) | |
| 193 | static WRITE8_HANDLER( reeltileshigh_2_w ) | |
| 189 | 194 | { |
| 190 | 195 | reeltileshigh_2_ram[offset] = data; |
| 191 | 196 | tilemap_mark_tile_dirty(reel_2_tilemap, offset); |
| 192 | 197 | } |
| 193 | 198 | |
| 194 | WRITE8_HANDLER( reeltileshigh_3_w ) | |
| 199 | static WRITE8_HANDLER( reeltileshigh_3_w ) | |
| 195 | 200 | { |
| 196 | 201 | reeltileshigh_3_ram[offset] = data; |
| 197 | 202 | tilemap_mark_tile_dirty(reel_3_tilemap, offset); |
| 198 | 203 | } |
| 199 | 204 | |
| 200 | WRITE8_HANDLER( reeltileshigh_4_w ) | |
| 205 | static WRITE8_HANDLER( reeltileshigh_4_w ) | |
| 201 | 206 | { |
| 202 | 207 | reeltileshigh_4_ram[offset] = data; |
| 203 | 208 | tilemap_mark_tile_dirty(reel_4_tilemap, offset); |
| 204 | 209 | } |
| 205 | 210 | |
| 206 | 211 | |
| 207 | static READ8_HANDLER( ret_ff ) | |
| 208 | { | |
| 209 | return 0xff; | |
| 210 | } | |
| 211 | ||
| 212 | #ifdef UNUSED_FUNCTION | |
| 213 | static READ8_HANDLER( ret_00 ) | |
| 214 | { | |
| 215 | return 0x00; | |
| 216 | } | |
| 217 | #endif | |
| 218 | ||
| 219 | static UINT8 skylncr_nmi_enable; | |
| 220 | ||
| 221 | static WRITE8_HANDLER( skylncr_nmi_enable_w ) | |
| 222 | { | |
| 223 | skylncr_nmi_enable = data & 0x10; | |
| 224 | } | |
| 225 | ||
| 226 | 212 | static WRITE8_HANDLER( skylncr_paletteram_w ) |
| 227 | 213 | { |
| 228 | 214 | static int color; |
| r4135 | r4136 | |
| 235 | 221 | { |
| 236 | 222 | int r,g,b; |
| 237 | 223 | paletteram[color] = data; |
| 238 | r = paletteram[(color/3*3)+0]; g = paletteram[(color/3*3)+1]; b = paletteram[(color/3*3)+2]; | |
| 239 | r = (r << 2) | (r >> 4); g = (g << 2) | (g >> 4); b = (b << 2) | (b >> 4); | |
| 240 | palette_set_color(space->machine,color/3,MAKE_RGB(r,g,b)); | |
| 241 | color = (color + 1) % (0x100*3); | |
| 224 | ||
| 225 | r = paletteram[(color/3 * 3) + 0]; | |
| 226 | g = paletteram[(color/3 * 3) + 1]; | |
| 227 | b = paletteram[(color/3 * 3) + 2]; | |
| 228 | r = (r << 2) | (r >> 4); | |
| 229 | g = (g << 2) | (g >> 4); | |
| 230 | b = (b << 2) | (b >> 4); | |
| 231 | ||
| 232 | palette_set_color(space->machine, color / 3, MAKE_RGB(r, g, b)); | |
| 233 | color = (color + 1) % (0x100 * 3); | |
| 242 | 234 | } |
| 243 | 235 | } |
| 244 | 236 | |
| r4135 | r4136 | |
| 254 | 246 | { |
| 255 | 247 | int r,g,b; |
| 256 | 248 | paletteram_2[color] = data; |
| 257 | r = paletteram_2[(color/3*3)+0]; g = paletteram_2[(color/3*3)+1]; b = paletteram_2[(color/3*3)+2]; | |
| 258 | r = (r << 2) | (r >> 4); g = (g << 2) | (g >> 4); b = (b << 2) | (b >> 4); | |
| 259 | palette_set_color(space->machine,0x100 + color/3,MAKE_RGB(r,g,b)); | |
| 260 | color = (color + 1) % (0x100*3); | |
| 249 | ||
| 250 | r = paletteram_2[(color/3 * 3) + 0]; | |
| 251 | g = paletteram_2[(color/3 * 3) + 1]; | |
| 252 | b = paletteram_2[(color/3 * 3) + 2]; | |
| 253 | r = (r << 2) | (r >> 4); | |
| 254 | g = (g << 2) | (g >> 4); | |
| 255 | b = (b << 2) | (b >> 4); | |
| 256 | ||
| 257 | palette_set_color(space->machine, 0x100 + color / 3, MAKE_RGB(r, g, b)); | |
| 258 | color = (color + 1) % (0x100 * 3); | |
| 261 | 259 | } |
| 262 | 260 | } |
| 263 | 261 | |
| r4135 | r4136 | |
| 282 | 280 | } |
| 283 | 281 | |
| 284 | 282 | |
| 283 | /************************************ | |
| 284 | * Other Handlers * | |
| 285 | ************************************/ | |
| 286 | ||
| 287 | static WRITE8_HANDLER( skylncr_coin_w ) | |
| 288 | { | |
| 289 | coin_counter_w( 0, data & 0x04 ); | |
| 290 | } | |
| 291 | ||
| 292 | static READ8_HANDLER( ret_ff ) | |
| 293 | { | |
| 294 | return 0xff; | |
| 295 | } | |
| 296 | ||
| 297 | #ifdef UNUSED_FUNCTION | |
| 298 | static READ8_HANDLER( ret_00 ) | |
| 299 | { | |
| 300 | return 0x00; | |
| 301 | } | |
| 302 | #endif | |
| 303 | ||
| 304 | static WRITE8_HANDLER( skylncr_nmi_enable_w ) | |
| 305 | { | |
| 306 | skylncr_nmi_enable = data & 0x10; | |
| 307 | } | |
| 308 | ||
| 309 | ||
| 310 | /************************************** | |
| 311 | * Memory Map * | |
| 312 | **************************************/ | |
| 313 | ||
| 285 | 314 | static ADDRESS_MAP_START( mem_map_skylncr, ADDRESS_SPACE_PROGRAM, 8 ) |
| 286 | 315 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 287 | 316 | AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) |
| r4135 | r4136 | |
| 340 | 369 | ADDRESS_MAP_END |
| 341 | 370 | |
| 342 | 371 | |
| 343 | static WRITE8_HANDLER( skylncr_coin_w ) | |
| 344 | { | |
| 345 | coin_counter_w( 0, data & 0x04 ); | |
| 346 | // popmessage("%02x",data); | |
| 347 | } | |
| 348 | ||
| 349 | 372 | static ADDRESS_MAP_START( io_map_skylncr, ADDRESS_SPACE_IO, 8 ) |
| 350 | 373 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 351 | 374 | |
| 352 | AM_RANGE(0x00, 0x00) AM_READ_PORT("IN1") | |
| 353 | AM_RANGE(0x01, 0x01) AM_READ_PORT("IN2") | |
| 354 | AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW1") | |
| 355 | AM_RANGE(0x10, 0x10) AM_READ_PORT("DSW2") | |
| 356 | AM_RANGE(0x11, 0x11) AM_READ_PORT("IN3") | |
| 357 | AM_RANGE(0x12, 0x12) AM_READ_PORT("IN4") | |
| 375 | AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */ | |
| 376 | AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* Input Ports */ | |
| 358 | 377 | |
| 359 | 378 | AM_RANGE(0x20, 0x20) AM_WRITE( skylncr_coin_w ) |
| 360 | 379 | |
| r4135 | r4136 | |
| 368 | 387 | ADDRESS_MAP_END |
| 369 | 388 | |
| 370 | 389 | |
| 390 | /*************************************** | |
| 391 | * Graphics Layouts * | |
| 392 | ***************************************/ | |
| 393 | ||
| 371 | 394 | static const gfx_layout layout8x8x8 = |
| 372 | 395 | { |
| 373 | 396 | 8,8, |
| r4135 | r4136 | |
| 424 | 447 | 8*32*8/2 |
| 425 | 448 | }; |
| 426 | 449 | |
| 450 | ||
| 451 | /************************************** | |
| 452 | * Graphics Decode * | |
| 453 | **************************************/ | |
| 454 | ||
| 427 | 455 | static GFXDECODE_START( skylncr ) |
| 428 | 456 | GFXDECODE_ENTRY( "gfx1", 0, layout8x8x8, 0, 2 ) |
| 429 | 457 | GFXDECODE_ENTRY( "gfx2", 0, layout8x32x8, 0, 2 ) |
| r4135 | r4136 | |
| 431 | 459 | GFXDECODE_END |
| 432 | 460 | |
| 433 | 461 | |
| 462 | /*********************************** | |
| 463 | * Input Ports * | |
| 464 | ***********************************/ | |
| 465 | ||
| 434 | 466 | static INPUT_PORTS_START( skylncr ) |
| 435 | PORT_START("IN1") /* $0 "PORT0 A" */ | |
| 436 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6) PORT_NAME("Stop 2") PORT_CODE(KEYCODE_X) | |
| 467 | PORT_START("IN1") /* $00 (PPI0 port A) */ | |
| 468 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6) PORT_CODE(KEYCODE_X) PORT_NAME("Stop 2") | |
| 437 | 469 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 438 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5) PORT_ | |
| 470 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5) PORT_ | |
| 439 | 471 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 440 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7) PORT_ | |
| 472 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7) PORT_ | |
| 441 | 473 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 442 | 474 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 443 | 475 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 444 | 476 | |
| 445 | PORT_START("IN2") /* $1 "PORT0 B" */ | |
| 446 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Bet") PORT_CODE(KEYCODE_2) | |
| 477 | PORT_START("IN2") /* $01 (PPI0 port B) */ | |
| 478 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(KEYCODE_2) PORT_NAME("Bet") | |
| 447 | 479 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 448 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON9) PORT_NAME("Option 2 (D-UP)" | |
| 480 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON9) PORT_CODE(KEYCODE_S) PORT_NAME("Option 2 (D-UP)" | |
| 449 | 481 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 450 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_ | |
| 482 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_ | |
| 451 | 483 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 452 | 484 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 453 | 485 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 454 | 486 | |
| 455 | PORT_START("IN3") /* $11 "PORT1 B" */ | |
| 456 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) | |
| 457 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) | |
| 458 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(2) | |
| 459 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key In") PORT_CODE(KEYCODE_Q) | |
| 460 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Option 1 (D-UP)") PORT_CODE(KEYCODE_A) | |
| 461 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("D-UP") PORT_CODE(KEYCODE_3) | |
| 487 | PORT_START("IN3") /* $11 (PPI1 port B) */ | |
| 488 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) | |
| 489 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) | |
| 490 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(2) | |
| 491 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_Q) PORT_NAME("Key In") | |
| 492 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_CODE(KEYCODE_A) PORT_NAME("Option 1 (D-UP)") | |
| 493 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_3) PORT_NAME("D-UP") | |
| 462 | 494 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 463 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Take Score" | |
| 495 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_4) PORT_NAME("Take Score" | |
| 464 | 496 | |
| 465 | PORT_START("IN4") /* $12 | |
| 497 | PORT_START("IN4") /* $12 (PPI | |
| 466 | 498 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 467 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Reset") PORT_CODE(KEYCODE_R) | |
| 468 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats") PORT_CODE(KEYCODE_0) | |
| 499 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") | |
| 500 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 469 | 501 | PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW ) /* Settings */ |
| 470 | 502 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 471 | 503 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 472 | 504 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 473 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_ | |
| 505 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE( | |
| 474 | 506 | |
| 475 | PORT_START("DSW1") /* $2 | |
| 507 | PORT_START("DSW1") /* $02 (PPI0 port C) */ | |
| 476 | 508 | PORT_DIPNAME( 0x11, 0x01, "D-UP Percentage" ) |
| 477 | 509 | PORT_DIPSETTING( 0x11, "60%" ) |
| 478 | 510 | PORT_DIPSETTING( 0x01, "70%" ) |
| r4135 | r4136 | |
| 497 | 529 | PORT_DIPSETTING( 0x80, "x100" ) |
| 498 | 530 | PORT_DIPSETTING( 0x00, "x1" ) |
| 499 | 531 | |
| 500 | PORT_START("DSW2") /* $10 "DSW2" */ | |
| 501 | PORT_DIPNAME( 0x01, 0x01, "DSW2" ) | |
| 532 | PORT_START("DSW2") /* $10 (PPI1 port A) */ | |
| 533 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 502 | 534 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 503 | 535 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 504 | 536 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) |
| r4135 | r4136 | |
| 573 | 605 | INPUT_PORTS_END |
| 574 | 606 | |
| 575 | 607 | |
| 608 | /************************************** | |
| 609 | * PPI 8255 (x2) Interface * | |
| 610 | **************************************/ | |
| 611 | ||
| 612 | static const ppi8255_interface ppi8255_intf[2] = | |
| 613 | { | |
| 614 | { /* A, B & C set as input */ | |
| 615 | DEVICE8_PORT("IN1"), /* Port A read */ | |
| 616 | DEVICE8_PORT("IN2"), /* Port B read */ | |
| 617 | DEVICE8_PORT("DSW1"), /* Port C read */ | |
| 618 | NULL, /* Port A write */ | |
| 619 | NULL, /* Port B write */ | |
| 620 | NULL /* Port C write */ | |
| 621 | }, | |
| 622 | { /* A, B & C set as input */ | |
| 623 | DEVICE8_PORT("DSW2"), /* Port A read */ | |
| 624 | DEVICE8_PORT("IN3"), /* Port B read */ | |
| 625 | DEVICE8_PORT("IN4"), /* Port C read */ | |
| 626 | NULL, /* Port A write */ | |
| 627 | NULL, /* Port B write */ | |
| 628 | NULL /* Port C write */ | |
| 629 | } | |
| 630 | }; | |
| 631 | ||
| 632 | ||
| 633 | /********************************** | |
| 634 | * AY-3-8910 Interface * | |
| 635 | **********************************/ | |
| 636 | ||
| 576 | 637 | static const ay8910_interface ay8910_config = |
| 577 | 638 | { |
| 578 | 639 | AY8910_LEGACY_OUTPUT, |
| r4135 | r4136 | |
| 590 | 651 | if (skylncr_nmi_enable) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); |
| 591 | 652 | } |
| 592 | 653 | |
| 654 | ||
| 655 | /************************************* | |
| 656 | * Machine Driver * | |
| 657 | *************************************/ | |
| 658 | ||
| 593 | 659 | static MACHINE_DRIVER_START( skylncr ) |
| 594 | 660 | |
| 595 | 661 | /* basic machine hardware */ |
| r4135 | r4136 | |
| 600 | 666 | |
| 601 | 667 | MDRV_NVRAM_HANDLER(generic_0fill) |
| 602 | 668 | |
| 669 | /* 1x M5M82C255, or 2x PPI8255 */ | |
| 670 | MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf[0] ) | |
| 671 | MDRV_PPI8255_ADD( "ppi8255_1", ppi8255_intf[1] ) | |
| 672 | ||
| 603 | 673 | /* video hardware */ |
| 604 | 674 | MDRV_SCREEN_ADD("main", RASTER) |
| 605 | 675 | MDRV_SCREEN_REFRESH_RATE(60) |
| r4135 | r4136 | |
| 621 | 691 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 622 | 692 | MACHINE_DRIVER_END |
| 623 | 693 | |
| 694 | ||
| 695 | /********************************** | |
| 696 | * ROM Load * | |
| 697 | **********************************/ | |
| 624 | 698 | /* |
| 625 | 699 | |
| 626 | 700 | Sky Lancer PCB Layout |
| r4135 | r4136 | |
| 744 | 818 | ROM_END |
| 745 | 819 | |
| 746 | 820 | |
| 821 | /********************************** | |
| 822 | * Driver Init * | |
| 823 | **********************************/ | |
| 824 | ||
| 747 | 825 | static DRIVER_INIT( skylncr ) |
| 748 | 826 | { |
| 749 | paletteram = auto_malloc(0x100*3); | |
| 750 | paletteram_2 = auto_malloc(0x100*3); | |
| 827 | paletteram = auto_malloc(0x100 * 3); | |
| 828 | paletteram_2 = auto_malloc(0x100 * 3); | |
| 751 | 829 | } |
| 752 | 830 | |
| 753 | 831 | |
| 754 | /***************************************************** | |
| 755 | Game Drivers | |
| 756 | *****************************************************/ | |
| 832 | /**************************************************** | |
| 833 | * Game Drivers * | |
| 834 | ****************************************************/ | |
| 757 | 835 | |
| 758 | 836 | /* YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS */ |
| 759 | 837 | GAME( 1995, skylncr, 0, skylncr, skylncr, skylncr, ROT0, "Bordun International", "Sky Lancer (Bordun, ver.U450C)", 0 ) |
| r4135 | r4136 | |
|---|---|---|
| 246 | 246 | const rectangle *clip,int priority) |
| 247 | 247 | { |
| 248 | 248 | int pal_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors); |
| 249 | UINT8 *source_base = gfx | |
| 249 | const UINT8 *source_base = gfx_element_get_data | |
| 250 | 250 | |
| 251 | 251 | int sprite_screen_height = ((1<<16)*gfx->height+0x8000)>>16; |
| 252 | 252 | int sprite_screen_width = ((1<<16)*gfx->width+0x8000)>>16; |
| r4135 | r4136 | |
| 316 | 316 | |
| 317 | 317 | for( y=sy; y<ey; y++ ) |
| 318 | 318 | { |
| 319 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 319 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 320 | 320 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 321 | 321 | UINT8 *pri = BITMAP_ADDR8(sprites_bitmap_pri, y, 0); |
| 322 | 322 | |
| r4135 | r4136 | |
| 380 | 380 | |
| 381 | 381 | gfxdata = base_gfx + 64 * code; |
| 382 | 382 | |
| 383 | /* prepare GfxElement on the fly */ | |
| 384 | gfx.machine = machine; | |
| 385 | gfx.width = width; | |
| 386 | gfx.height = height; | |
| 387 | gfx.total_elements = 1; | |
| 388 | gfx.color_depth = 256; | |
| 389 | gfx.color_granularity = 256; | |
| 390 | gfx.color_base = 0; | |
| 391 | gfx.total_colors = 0x10; | |
| 392 | gfx.pen_usage = NULL; | |
| 393 | gfx.gfxdata = gfxdata; | |
| 394 | gfx.line_modulo = width; | |
| 395 | gfx.char_modulo = 0; /* doesn't matter */ | |
| 396 | gfx.flags = 0; | |
| 397 | ||
| 398 | 383 | /* Bounds checking */ |
| 399 | 384 | if ( (gfxdata + width * height - 1) >= gfx_max ) |
| 400 | 385 | continue; |
| 401 | 386 | |
| 387 | /* prepare GfxElement on the fly */ | |
| 388 | gfx_element_build_temporary(&gfx, machine, gfxdata, width, height, width, 0, 256, 0); | |
| 389 | ||
| 402 | 390 | draw_single_sprite(sprites_bitmap,&gfx,0,color,flipx,flipy,x,y,cliprect,pri); |
| 403 | 391 | |
| 404 | 392 | // wrap around x |
| r4135 | r4136 | |
|---|---|---|
| 288 | 288 | |
| 289 | 289 | /******************************************************************************/ |
| 290 | 290 | |
| 291 | static MACHINE_START( triothep ) | |
| 292 | { | |
| 293 | state_save_register_global(machine, trio_control_select); | |
| 294 | } | |
| 295 | ||
| 296 | /******************************************************************************/ | |
| 297 | ||
| 291 | 298 | static MACHINE_DRIVER_START( actfancr ) |
| 292 | 299 | |
| 293 | 300 | /* basic machine hardware */ |
| r4135 | r4136 | |
| 341 | 348 | MDRV_CPU_ADD("audio",M6502, XTAL_12MHz/8) /* verified on pcb */ |
| 342 | 349 | MDRV_CPU_PROGRAM_MAP(dec0_s_map,0) |
| 343 | 350 | |
| 351 | MDRV_MACHINE_START(triothep) | |
| 352 | ||
| 344 | 353 | /* video hardware */ |
| 345 | 354 | MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM) |
| 346 | 355 | |
| r4135 | r4136 | |
| 586 | 595 | |
| 587 | 596 | |
| 588 | 597 | |
| 589 | GAME( 1989, actfancr, 0, actfancr, actfancr, actfancr, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 2)", 0 ) | |
| 590 | GAME( 1989, actfanc1, actfancr, actfancr, actfancr, actfancr, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 1)", 0 ) | |
| 591 | GAME( 1989, actfancj, actfancr, actfancr, actfancr, actfancj, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (Japan revision 1)", 0 ) | |
| 592 | GAME( 1989, triothep, 0, triothep, triothep, 0, ROT0, "Data East Corporation", "Trio The Punch - Never Forget Me... (World)", 0 ) | |
| 593 | GAME( 1989, triothej, triothep, triothep, triothep, 0, ROT0, "Data East Corporation", "Trio The Punch - Never Forget Me... (Japan)", 0 ) | |
| 598 | GAME( 1989, actfancr, 0, actfancr, actfancr, actfancr, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 2)", GAME_SUPPORTS_SAVE ) | |
| 599 | GAME( 1989, actfanc1, actfancr, actfancr, actfancr, actfancr, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 1)", GAME_SUPPORTS_SAVE ) | |
| 600 | GAME( 1989, actfancj, actfancr, actfancr, actfancr, actfancj, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (Japan revision 1)", GAME_SUPPORTS_SAVE ) | |
| 601 | GAME( 1989, triothep, 0, triothep, triothep, 0, ROT0, "Data East Corporation", "Trio The Punch - Never Forget Me... (World)", GAME_SUPPORTS_SAVE ) | |
| 602 | GAME( 1989, triothej, triothep, triothep, triothep, 0, ROT0, "Data East Corporation", "Trio The Punch - Never Forget Me... (Japan)", GAME_SUPPORTS_SAVE ) |
| r4135 | r4136 | |
|---|---|---|
| 12 | 12 | The palette resolution is 12 bits in some games and 15 bits in others. |
| 13 | 13 | |
| 14 | 14 | TODO: |
| 15 | - hitice: ice trails | |
| 15 | - hitice: ice trails ar | |
| 16 | 16 | - hitice: the pixel bitmap is not cleared on startup nor during attract mode. There's a |
| 17 | 17 | kludge to fix it in the first case. |
| 18 | 18 | - rambo3a: has a lot of unmapped writes in the VCU area (log up to end of |
| r4135 | r4136 | |
| 3354 | 3354 | |
| 3355 | 3355 | ROM_START( hitice ) |
| 3356 | 3356 | ROM_REGION( 0x80000, "main", 0 ) /* 512k for 68000 code */ |
| 3357 | ROM_LOAD16_BYTE( "c59-10", 0x00000, 0x20000, CRC(e4ffad15) SHA1(87da85e1489fe57bd012177a70434152e5475009) ) | |
| 3358 | ROM_LOAD16_BYTE( "c59-12", 0x00001, 0x20000, CRC(a080d7af) SHA1(9c68b78fbcc42a2f748d1b7f84f138be79f7c0c9) ) | |
| 3359 | ROM_LOAD16_BYTE( "c59-09", 0x40000, 0x10000, CRC(e243e3b0) SHA1(a7daf96ef70e9a92bb3ee4a151ce674a187c15a2) ) | |
| 3360 | ROM_LOAD16_BYTE( "c59-11", 0x40001, 0x10000, CRC(4d4dfa52) SHA1(8ecd62dc2a2f35850340469afa54862b46053ce0) ) | |
| 3357 | ROM_LOAD16_BYTE( "c59-10.42", 0x00000, 0x20000, CRC(e4ffad15) SHA1(87da85e1489fe57bd012177a70434152e5475009) ) | |
| 3358 | ROM_LOAD16_BYTE( "c59-12.64", 0x00001, 0x20000, CRC(a080d7af) SHA1(9c68b78fbcc42a2f748d1b7f84f138be79f7c0c9) ) | |
| 3359 | ROM_LOAD16_BYTE( "c59-09.41", 0x40000, 0x10000, CRC(e243e3b0) SHA1(a7daf96ef70e9a92bb3ee4a151ce674a187c15a2) ) | |
| 3360 | ROM_LOAD16_BYTE( "c59-11.63", 0x40001, 0x10000, CRC(4d4dfa52) SHA1(8ecd62dc2a2f35850340469afa54862b46053ce0) ) | |
| 3361 | 3361 | |
| 3362 | 3362 | ROM_REGION( 0x1c000, "audio", 0 ) /* 64k for Z80 code */ |
| 3363 | ROM_LOAD( "c59-08", 0x00000, 0x4000, CRC(d3cbc10b) SHA1(75305e264300e0ebd15ada45a6d222fee75bd8e4) ) | |
| 3363 | ROM_LOAD( "c59-08.50", 0x00000, 0x4000, CRC(d3cbc10b) SHA1(75305e264300e0ebd15ada45a6d222fee75bd8e4) ) | |
| 3364 | 3364 | ROM_CONTINUE( 0x10000, 0xc000 ) /* banked stuff */ |
| 3365 | 3365 | |
| 3366 | 3366 | ROM_REGION( 0x100000, "gfx1", ROMREGION_DISPOSE ) |
| 3367 | ROM_LOAD( "c59-03", 0x00000, 0x80000, CRC(9e513048) SHA1(4ffa63c01a25e912dd218b7b2deaf5ad1a53659a) ) | |
| 3368 | ROM_LOAD( "c59-02", 0x80000, 0x80000, CRC(affb5e07) SHA1(afe92268c78ab5565d2913672e25f3136a15f534) ) | |
| 3367 | ROM_LOAD( "c59-03.12", 0x00000, 0x80000, CRC(9e513048) SHA1(4ffa63c01a25e912dd218b7b2deaf5ad1a53659a) ) | |
| 3368 | ROM_LOAD( "c59-02.13", 0x80000, 0x80000, CRC(affb5e07) SHA1(afe92268c78ab5565d2913672e25f3136a15f534) ) | |
| 3369 | 3369 | |
| 3370 | 3370 | ROM_REGION( 0x80000, "oki", 0 ) |
| 3371 | ROM_LOAD( "c59-01", 0x00000, 0x20000, CRC(46ae291d) SHA1(d36ab48cfa393a6a1eae5caa2a397087eb098f7f) ) | |
| 3371 | ROM_LOAD( "c59-01.30", 0x00000, 0x20000, CRC(46ae291d) SHA1(d36ab48cfa393a6a1eae5caa2a397087eb098f7f) ) | |
| 3372 | ||
| 3373 | ROM_REGION( 0x800, "plds", ROMREGION_DISPOSE ) | |
| 3374 | ROM_LOAD( "pal20l8b-c59-04.25", 0x000, 0x144, CRC(2ebcf07c) SHA1(b73396fff8cde51e8a429843cd6dc3386f777f3b) ) | |
| 3375 | ROM_LOAD( "pal16l8b-c59-05.26", 0x200, 0x104, CRC(37b67c5c) SHA1(a4bf3532774bcd285a6e0e24a9e9a3b28684f724) ) | |
| 3376 | ROM_LOAD( "pal20l8b-c59-06.53", 0x400, 0x144, CRC(bf176875) SHA1(d7073ff7bf8f905dc8a6d3cf51543a572fa87f2f) ) | |
| 3377 | ROM_LOAD( "pal16r4b-c59-07.61", 0x600, 0x104, CRC(cf64bd95) SHA1(5acada8bd6da40b5342bdd7ec494ee0e615492f0) ) | |
| 3372 | 3378 | ROM_END |
| 3373 | 3379 | |
| 3380 | ROM_START( hiticej ) | |
| 3381 | ROM_REGION( 0x80000, "main", 0 ) /* 512k for 68000 code */ | |
| 3382 | ROM_LOAD16_BYTE( "c59-23.42", 0x00000, 0x20000, CRC(01958fcc) SHA1(adaf9b0a4658d4d8eb8cdd343b40643b4c05d09e) ) | |
| 3383 | ROM_LOAD16_BYTE( "c59-25.64", 0x00001, 0x20000, CRC(71984c76) SHA1(2e8bbfd01b0f229db5f10563a0864e8a2d1a515f) ) | |
| 3384 | ROM_LOAD16_BYTE( "c59-22.41", 0x40000, 0x10000, CRC(c2c86140) SHA1(8d285a50786c91d28004a30854bbc40cf7d0de4b) ) | |
| 3385 | ROM_LOAD16_BYTE( "c59-24.63", 0x40001, 0x10000, CRC(26c8f409) SHA1(c10f5504e4521c64e2410cef504ff7079c7d4e70) ) | |
| 3386 | ||
| 3387 | ROM_REGION( 0x1c000, "audio", 0 ) /* 64k for Z80 code */ | |
| 3388 | ROM_LOAD( "c59-08.50", 0x00000, 0x4000, CRC(d3cbc10b) SHA1(75305e264300e0ebd15ada45a6d222fee75bd8e4) ) | |
| 3389 | ROM_CONTINUE( 0x10000, 0xc000 ) /* banked stuff */ | |
| 3390 | ||
| 3391 | ROM_REGION( 0x100000, "gfx1", ROMREGION_DISPOSE ) | |
| 3392 | ROM_LOAD( "c59-03.12", 0x00000, 0x80000, CRC(9e513048) SHA1(4ffa63c01a25e912dd218b7b2deaf5ad1a53659a) ) | |
| 3393 | ROM_LOAD( "c59-02.13", 0x80000, 0x80000, CRC(affb5e07) SHA1(afe92268c78ab5565d2913672e25f3136a15f534) ) | |
| 3394 | ||
| 3395 | ROM_REGION( 0x80000, "oki", 0 ) | |
| 3396 | ROM_LOAD( "c59-01.30", 0x00000, 0x20000, CRC(46ae291d) SHA1(d36ab48cfa393a6a1eae5caa2a397087eb098f7f) ) | |
| 3397 | ||
| 3398 | ROM_REGION( 0x800, "plds", ROMREGION_DISPOSE ) | |
| 3399 | ROM_LOAD( "pal20l8b-c59-04.25", 0x000, 0x144, CRC(2ebcf07c) SHA1(b73396fff8cde51e8a429843cd6dc3386f777f3b) ) | |
| 3400 | ROM_LOAD( "pal16l8b-c59-05.26", 0x200, 0x104, CRC(37b67c5c) SHA1(a4bf3532774bcd285a6e0e24a9e9a3b28684f724) ) | |
| 3401 | ROM_LOAD( "pal20l8b-c59-06.53", 0x400, 0x144, CRC(bf176875) SHA1(d7073ff7bf8f905dc8a6d3cf51543a572fa87f2f) ) | |
| 3402 | ROM_LOAD( "pal16r4b-c59-07.61", 0x600, 0x104, CRC(cf64bd95) SHA1(5acada8bd6da40b5342bdd7ec494ee0e615492f0) ) | |
| 3403 | ROM_END | |
| 3404 | ||
| 3374 | 3405 | ROM_START( rambo3 ) |
| 3375 | 3406 | ROM_REGION( 0x80000, "main", 0 ) /* 512k for 68000 code */ |
| 3376 | 3407 | ROM_LOAD16_BYTE( "r3-0e.rom", 0x00000, 0x10000, CRC(3efa4177) SHA1(5e4995e34b92f625f7825238dfbc9e76d4090871) ) |
| r4135 | r4136 | |
| 3793 | 3824 | GAME( 1989, viofighu, viofight,viofight, viofight, taito_b, ROT0, "Taito America Corporation", "Violence Fight (US)", GAME_SUPPORTS_SAVE ) |
| 3794 | 3825 | GAME( 1990, ashura, 0, ashura, ashura, taito_b, ROT270, "Taito Corporation", "Ashura Blaster (Japan)", GAME_SUPPORTS_SAVE ) |
| 3795 | 3826 | GAME( 1990, ashurau, ashura, ashura, ashurau, taito_b, ROT270, "Taito America Corporation", "Ashura Blaster (US)", GAME_SUPPORTS_SAVE ) |
| 3796 | GAME( 1990, hitice, 0, hitice, hitice, taito_b, ROT0, "Williams", "Hit the Ice (US)", GAME_SUPPORTS_SAVE ) | |
| 3827 | GAME( 1990, hitice, 0, hitice, hitice, taito_b, ROT0, "Williams", "Hit the Ice (US)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 3828 | GAME( 1990, hiticej, hitice, hitice, hitice, taito_b, ROT0, "Midway/Taito Corporation", "Hit the Ice (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 3797 | 3829 | GAME( 1991, selfeena, 0, selfeena, selfeena, taito_b, ROT0, "East Technology", "Sel Feena", GAME_SUPPORTS_SAVE ) |
| 3798 | 3830 | GAME( 1992, silentd, 0, silentd, silentd, taito_b, ROT0, "Taito Corporation Japan", "Silent Dragon (World)", GAME_SUPPORTS_SAVE ) |
| 3799 | 3831 | GAME( 1992, silentdj, silentd, silentd, silentdj, taito_b, ROT0, "Taito Corporation", "Silent Dragon (Japan)", GAME_SUPPORTS_SAVE ) |
| r4135 | r4136 | |
|---|---|---|
| 1155 | 1155 | 8*8 |
| 1156 | 1156 | }; |
| 1157 | 1157 | |
| 1158 | static const gfx_layout disco_tile8layout = | |
| 1159 | { | |
| 1160 | 8,8, | |
| 1161 | 0x6000/3/8, | |
| 1162 | 3, | |
| 1163 | { 0x4000*8, 0x2000*8, 0x0000*8 }, | |
| 1164 | { STEP8(0,1) }, | |
| 1165 | { STEP8(0,8) }, | |
| 1166 | 8*8 | |
| 1167 | }; | |
| 1158 | 1168 | |
| 1159 | 1169 | |
| 1160 | 1170 | static const gfx_layout tile16layout = |
| r4135 | r4136 | |
| 1168 | 1178 | 32*8 |
| 1169 | 1179 | }; |
| 1170 | 1180 | |
| 1181 | static const gfx_layout disco_tile16layout = | |
| 1182 | { | |
| 1183 | 16,16, | |
| 1184 | 0x6000/3/32, | |
| 1185 | 3, | |
| 1186 | { 0x4000*8, 0x2000*8, 0x0000*8 }, | |
| 1187 | { STEP8(16*8,1), STEP8(0,1) }, | |
| 1188 | { STEP16(0,8) }, | |
| 1189 | 32*8 | |
| 1190 | }; | |
| 1171 | 1191 | |
| 1172 | ||
| 1173 | 1192 | static const gfx_layout bnj_tile16layout = |
| 1174 | 1193 | { |
| 1175 | 1194 | 16,16, |
| r4135 | r4136 | |
| 1211 | 1230 | GFXDECODE_END |
| 1212 | 1231 | |
| 1213 | 1232 | static GFXDECODE_START( disco ) |
| 1214 | GFXDECODE_ENTRY( "gfx1", 0, tile8layout, 0, 4 ) /* char set #1 */ | |
| 1215 | GFXDECODE_ENTRY( "gfx1", 0, tile16layout, 0, 4 ) /* sprites */ | |
| 1233 | GFXDECODE_ENTRY( NULL, 0, disco_tile8layout, 0, 4 ) /* char set #1 */ | |
| 1234 | GFXDECODE_ENTRY( NULL, 0, disco_tile16layout, 0, 4 ) /* sprites */ | |
| 1216 | 1235 | GFXDECODE_END |
| 1217 | 1236 | |
| 1218 | 1237 | |
| r4135 | r4136 | |
| 1736 | 1755 | ROM_REGION( 0x10000, "audio", 0 ) |
| 1737 | 1756 | ROM_LOAD( "disco.w6", 0xf000, 0x1000, CRC(d81e781e) SHA1(bde510bfed06a13bd56bf7ddbf220e7cf82f79b6) ) |
| 1738 | 1757 | |
| 1739 | ROM_REGION( 0x6000, "gfx1", ROMREGION_ERASE00 ) | |
| 1740 | /* dynamically allocated */ | |
| 1741 | ||
| 1742 | 1758 | ROM_REGION( 0x0020, "proms", 0 ) |
| 1743 | 1759 | ROM_LOAD( "disco.clr", 0x0000, 0x0020, CRC(a393f913) SHA1(42dce159283427064b3f5ce3a6e2189744ecd943) ) |
| 1744 | 1760 | ROM_END |
| r4135 | r4136 | |
| 1755 | 1771 | ROM_REGION( 0x10000, "audio", 0 ) |
| 1756 | 1772 | ROM_LOAD( "disco.w6", 0xf000, 0x1000, CRC(d81e781e) SHA1(bde510bfed06a13bd56bf7ddbf220e7cf82f79b6) ) |
| 1757 | 1773 | |
| 1758 | ROM_REGION( 0x6000, "gfx1", ROMREGION_ERASE00 ) | |
| 1759 | /* dynamically allocated */ | |
| 1760 | ||
| 1761 | 1774 | ROM_REGION( 0x0020, "proms", 0 ) |
| 1762 | 1775 | ROM_LOAD( "disco.clr", 0x0000, 0x0020, CRC(a393f913) SHA1(42dce159283427064b3f5ce3a6e2189744ecd943) ) |
| 1763 | 1776 | ROM_END |
| r4135 | r4136 | |
|---|---|---|
| 8285 | 8285 | /* The mapping is handled by a PAL on the B-board */ |
| 8286 | 8286 | memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800140, 0x80017f, 0, 0, SMH_UNMAP, SMH_UNMAP); |
| 8287 | 8287 | memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8001c0, 0x8001ff, 0, 0, cps1_cps_b_r, cps1_cps_b_w); |
| 8288 | ||
| 8289 | DRIVER_INIT_CALL(cps1); | |
| 8288 | 8290 | } |
| 8289 | 8291 | |
| 8290 | 8292 | static DRIVER_INIT( sf2hack ) |
| r4135 | r4136 | |
|---|---|---|
| 69 | 69 | static UINT8 vram_bank,col_bank; |
| 70 | 70 | static UINT8 mux_data; |
| 71 | 71 | |
| 72 | VIDEO_START(jantotsu) | |
| 72 | static VIDEO_START(jantotsu) | |
| 73 | 73 | { |
| 74 | 74 | jan_bitmap_1 = auto_malloc(0x2000); |
| 75 | 75 | jan_bitmap_2 = auto_malloc(0x2000); |
| r4135 | r4136 | |
| 78 | 78 | vram_bank = 0; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | VIDEO_UPDATE(jantotsu) | |
| 81 | static VIDEO_UPDATE(jantotsu) | |
| 82 | 82 | { |
| 83 | 83 | int x,y,i; |
| 84 | 84 | int count; |
| r4135 | r4136 | |
|---|---|---|
| 232 | 232 | #include "sound/ay8910.h" |
| 233 | 233 | #include "sound/sn76496.h" |
| 234 | 234 | #include "sound/dac.h" |
| 235 | #include "sound/digitalk.h" | |
| 235 | 236 | #include "includes/cclimber.h" |
| 236 | 237 | #include "sound/discrete.h" |
| 237 | 238 | |
| r4135 | r4136 | |
| 251 | 252 | static UINT8 kingball_speech_dip; |
| 252 | 253 | static UINT8 kingball_sound; |
| 253 | 254 | static UINT8 mshuttle_ay8910_cs; |
| 254 | static UINT8 scorpion_sound_data; | |
| 255 | 255 | |
| 256 | 256 | static UINT16 protection_state; |
| 257 | 257 | static UINT8 protection_result; |
| r4135 | r4136 | |
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | ||
| 803 | static READ8_HANDLER( scorpion_sound_status_r ) | |
| 802 | static READ8_HANDLER( scorpion_digitalker_intr_r ) | |
| 804 | 803 | { |
| 805 | logerror("%04X:scorpion_sound_status_r()\n", cpu_get_pc(space->cpu)); | |
| 806 | return 1; | |
| 804 | return digitalker_0_intr_r(); | |
| 807 | 805 | } |
| 808 | 806 | |
| 809 | ||
| 810 | static WRITE8_HANDLER( scorpion_sound_data_w ) | |
| 807 | static WRITE8_HANDLER( scorpion_digitalker_control_w ) | |
| 811 | 808 | { |
| 812 | scorpion_sound_data = data; | |
| 813 | // logerror("%04X:scorpion_sound_data_w(%02X)\n", cpu_get_pc(space->cpu), data); | |
| 809 | digitalker_0_cs_w(data & 1 ? ASSERT_LINE : CLEAR_LINE); | |
| 810 | digitalker_0_cms_w(data & 2 ? ASSERT_LINE : CLEAR_LINE); | |
| 811 | digitalker_0_wr_w(data & 4 ? ASSERT_LINE : CLEAR_LINE); | |
| 814 | 812 | } |
| 815 | 813 | |
| 816 | ||
| 817 | static WRITE8_HANDLER( scorpion_sound_control_w ) | |
| 818 | { | |
| 819 | if (!(data & 0x04)) | |
| 820 | mame_printf_debug("Secondary sound = %02X\n", scorpion_sound_data); | |
| 821 | // logerror("%04X:scorpion_sound_control_w(%02X)\n", cpu_get_pc(space->cpu), data); | |
| 822 | } | |
| 823 | ||
| 824 | ||
| 825 | 814 | static const ppi8255_interface scorpion_ppi8255_1_intf = |
| 826 | 815 | { |
| 827 | 816 | NULL, /* Port A read */ |
| r4135 | r4136 | |
| 1652 | 1641 | AY8910_DEFAULT_LOADS, |
| 1653 | 1642 | NULL, |
| 1654 | 1643 | NULL, |
| 1655 | scorpion_sound_data_w, | |
| 1656 | scorpion_sound_control_w, | |
| 1644 | digitalker_0_data_w, | |
| 1645 | scorpion_digitalker_control_w, | |
| 1657 | 1646 | }; |
| 1658 | 1647 | |
| 1659 | 1648 | static const ay8910_interface checkmaj_ay8910_interface = |
| r4135 | r4136 | |
| 1666 | 1655 | NULL |
| 1667 | 1656 | }; |
| 1668 | 1657 | |
| 1669 | ||
| 1670 | 1658 | static const discrete_mixer_desc konami_sound_mixer_desc = |
| 1671 | 1659 | {DISC_MIXER_IS_OP_AMP, |
| 1672 | 1660 | {RES_K(5.1), RES_K(5.1), RES_K(5.1), RES_K(5.1), RES_K(5.1), RES_K(5.1)}, |
| r4135 | r4136 | |
| 2052 | 2040 | MDRV_SOUND_ADD("8910.2", AY8910, KONAMI_SOUND_CLOCK/8) |
| 2053 | 2041 | MDRV_SOUND_CONFIG(scorpion_ay8910_interface) |
| 2054 | 2042 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 2043 | ||
| 2044 | MDRV_SOUND_ADD("digitalker", DIGITALKER, 4000000) | |
| 2045 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.16) | |
| 2055 | 2046 | MACHINE_DRIVER_END |
| 2056 | 2047 | |
| 2057 | 2048 | |
| r4135 | r4136 | |
| 2882 | 2873 | /* no background related */ |
| 2883 | 2874 | // memory_install_write8_handler(space, 0x6803, 0x6803, 0, 0, SMH_NOP); |
| 2884 | 2875 | |
| 2885 | memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x3000, 0x3000, 0, 0, scorpion_ | |
| 2876 | memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x3000, 0x3000, 0, 0, scorpion_ | |
| 2886 | 2877 | /* |
| 2887 | 2878 | { |
| 2888 | 2879 | const UINT8 *rom = memory_region(machine, "speech"); |
| r4135 | r4136 | |
|---|---|---|
| 649 | 649 | /******************************************************************************/ |
| 650 | 650 | |
| 651 | 651 | // default eeprom with reasonable calibration for MAME |
| 652 | unsigned char bbusters_default_eeprom[128] = { | |
| 652 | static const unsigned char bbusters_default_eeprom[128] = { | |
| 653 | 653 | /*y*/ /*y*/ |
| 654 | 654 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0xEE, 0x00, |
| 655 | 655 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xFE, 0x00, |
| r0 | r4136 | |
|---|---|---|
| 1 | /************************************************************************************************* | |
| 2 | ||
| 3 | High Video Tour 4000 | |
| 4 | ||
| 5 | driver by Mirko Buffoni | |
| 6 | ||
| 7 | ||
| 8 | Memory layout: | |
| 9 | ||
| 10 | 000000-0003FF Interrupt table | |
| 11 | 000400-003FFF NVRAM and main ram | |
| 12 | 040000-04FFFF VGA 320x200 address space | |
| 13 | 080000-0BFFFF Banked ROM | |
| 14 | 0C0000-0FFFFF Program ROM | |
| 15 | ||
| 16 | ||
| 17 | Port layout: | |
| 18 | ||
| 19 | 0x0008 R Input port -> Keyboard | |
| 20 | 0x000A R Input port -> Coin and Service | |
| 21 | 0x000C R Input port -> Reset | |
| 22 | ||
| 23 | 0x0030 R Read continuously... maybe watchdog? | |
| 24 | ||
| 25 | 0x0000 W Keyboard Lights control port | |
| 26 | 0x0002 W \ Hopper or ticket related | |
| 27 | 0x0004 W / | |
| 28 | 0x0006 W OKI6395 ADPCM command: need to be latched | |
| 29 | 0x0010 W Like 0x3c8 in VGA | |
| 30 | 0x0014 W Like 0x3c9 in VGA | |
| 31 | ||
| 32 | 0x0030 W Bankswitch select | |
| 33 | ||
| 34 | ---- | |
| 35 | ||
| 36 | INT 2 (NMI) called every Vblank | |
| 37 | ||
| 38 | ---- | |
| 39 | ||
| 40 | Interesting locations. 255 = YES | |
| 41 | ||
| 42 | 3E23-24 Valore Moneta (5) (1,5,10) | |
| 43 | 3E25-26 Valore Gettone (5) (1-20) | |
| 44 | 3E27-28 Valore Servizio (10) (5-500) | |
| 45 | 3E29-2A Banconote 1 (5) (5-500) | |
| 46 | ||
| 47 | 3E33 Replay (255) (0,255) | |
| 48 | 3E34 Double (0) (0,255) | |
| 49 | 3E35 BloccaBanconote (255) (0,255) | |
| 50 | 3E36 Accumulo (0) (0,255) | |
| 51 | 3E37 Vincita 10 (255) (0,255) | |
| 52 | 3E38 Numeroni (255) (0,255) | |
| 53 | 3E39 Palline (255) (0,255) | |
| 54 | 3E3B Lattine (255) (0,255) | |
| 55 | 3E3D Premio (10) (X,10) | |
| 56 | 3E3E Bet Max Credit (20) (1-50) | |
| 57 | 3E3F Bet Max Points (20) (1-50) | |
| 58 | ||
| 59 | 3E40-41 Blocco Getton. (100) (10-1000) | |
| 60 | 3E42 Cambio Carte (0) (Veloce=0, Normale=1, Lento=2) | |
| 61 | 3E45-46 Valore ticket (100) (1-500) | |
| 62 | 3E4B Bet Min Gioco (1) (1-10) | |
| 63 | 3E4C Bet Min Fever (1) (1-10) | |
| 64 | ||
| 65 | 3E59 Tickets (10) (Tutti=0, 10=F, 1=FF) | |
| 66 | ||
| 67 | ---- | |
| 68 | ||
| 69 | Initial High Video releases have roms named 'vcf'... | |
| 70 | They have low resolution 320x200x256 colors. | |
| 71 | Game is V30 based, with rom banking | |
| 72 | ||
| 73 | Next, they released new board with roms named 'ncf'... | |
| 74 | Same resolution, but different mapping for memory and input ports, plus a check for vblank (protection?) | |
| 75 | Game is V30 based, without banking | |
| 76 | ||
| 77 | Newer boards instead have roms named 'tcf'... | |
| 78 | Resolution is higher as 400x300x256 colors, and graphic is fancier. | |
| 79 | There is a simple protection check, tied on an input port. | |
| 80 | Game is V30 based, with rom banking (2Mb) | |
| 81 | ||
| 82 | *************************************************************************************************/ | |
| 83 | ||
| 84 | #include "driver.h" | |
| 85 | #include "cpu/nec/nec.h" | |
| 86 | #include "sound/okim6376.h" | |
| 87 | ||
| 88 | static UINT16 *blit_ram; | |
| 89 | ||
| 90 | ||
| 91 | VIDEO_START(tourvisn) | |
| 92 | { | |
| 93 | ||
| 94 | } | |
| 95 | ||
| 96 | VIDEO_UPDATE(tourvisn) | |
| 97 | { | |
| 98 | int x,y,count; | |
| 99 | ||
| 100 | count = (0/2); | |
| 101 | ||
| 102 | for(y=0;y<(video_screen_get_visible_area(screen)->max_y+1);y++) | |
| 103 | { | |
| 104 | for(x=0;x<(video_screen_get_visible_area(screen)->max_x+1)/2;x++) | |
| 105 | { | |
| 106 | UINT32 color; | |
| 107 | ||
| 108 | color = ((blit_ram[count]) & 0x00ff)>>0; | |
| 109 | ||
| 110 | if((x*2)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y) | |
| 111 | *BITMAP_ADDR32(bitmap, y, (x*2)+0) = screen->machine->pens[color]; | |
| 112 | ||
| 113 | color = ((blit_ram[count]) & 0xff00)>>8; | |
| 114 | ||
| 115 | if(((x*2)+1)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y) | |
| 116 | *BITMAP_ADDR32(bitmap, y, (x*2)+1) = screen->machine->pens[color]; | |
| 117 | ||
| 118 | count++; | |
| 119 | } | |
| 120 | } | |
| 121 | ||
| 122 | return 0; | |
| 123 | } | |
| 124 | ||
| 125 | ||
| 126 | ||
| 127 | static READ16_HANDLER( read1_r ) | |
| 128 | { | |
| 129 | return input_port_read(space->machine, "IN0"); | |
| 130 | } | |
| 131 | ||
| 132 | static READ16_HANDLER( read2_r ) | |
| 133 | { | |
| 134 | return input_port_read(space->machine, "IN1"); | |
| 135 | } | |
| 136 | ||
| 137 | static READ16_HANDLER( read3_r ) | |
| 138 | { | |
| 139 | return input_port_read(space->machine, "IN2"); | |
| 140 | } | |
| 141 | ||
| 142 | static WRITE16_HANDLER( tv_vcf_paletteram_w ) | |
| 143 | { | |
| 144 | static int pal_offs,r,g,b,internal_pal_offs; | |
| 145 | ||
| 146 | switch(offset*2) | |
| 147 | { | |
| 148 | case 0: | |
| 149 | pal_offs = 0; | |
| 150 | break; | |
| 151 | case 2: | |
| 152 | internal_pal_offs = 0; | |
| 153 | break; | |
| 154 | case 4: | |
| 155 | switch(internal_pal_offs) | |
| 156 | { | |
| 157 | case 0: | |
| 158 | r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 159 | internal_pal_offs++; | |
| 160 | break; | |
| 161 | case 1: | |
| 162 | g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 163 | internal_pal_offs++; | |
| 164 | break; | |
| 165 | case 2: | |
| 166 | b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4); | |
| 167 | palette_set_color(space->machine, pal_offs, MAKE_RGB(r, g, b)); | |
| 168 | internal_pal_offs = 0; | |
| 169 | pal_offs++; | |
| 170 | break; | |
| 171 | } | |
| 172 | ||
| 173 | break; | |
| 174 | } | |
| 175 | } | |
| 176 | ||
| 177 | static WRITE16_HANDLER( tv_vcf_bankselect_w ) | |
| 178 | { | |
| 179 | static UINT32 bankaddress; | |
| 180 | UINT8 *ROM = memory_region(space->machine, "user1"); | |
| 181 | ||
| 182 | /* bits 0, 1 select the ROM bank */ | |
| 183 | bankaddress = (data & 0x03) * 0x40000; | |
| 184 | ||
| 185 | memory_set_bankptr(space->machine, 1, &ROM[bankaddress]); | |
| 186 | } | |
| 187 | ||
| 188 | ||
| 189 | static WRITE16_HANDLER( tv_oki6395_w ) | |
| 190 | { | |
| 191 | static int okidata; | |
| 192 | if (okidata != data) { | |
| 193 | okidata = data; | |
| 194 | okim6376_data_0_lsb_w(space, 0, data, mem_mask); | |
| 195 | okim6376_data_0_lsb_w(space, 0, (1 << 4), mem_mask); | |
| 196 | } | |
| 197 | } | |
| 198 | ||
| 199 | ||
| 200 | static ADDRESS_MAP_START( tv_vcf_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 201 | AM_RANGE(0x00000, 0x003ff) AM_RAM /*irq vector area*/ | |
| 202 | AM_RANGE(0x00400, 0x03fff) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size ) | |
| 203 | AM_RANGE(0x40000, 0x4ffff) AM_RAM AM_BASE(&blit_ram) /*blitter ram*/ | |
| 204 | AM_RANGE(0x80000, 0xbffff) AM_ROMBANK(1) | |
| 205 | AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0) | |
| 206 | ADDRESS_MAP_END | |
| 207 | ||
| 208 | static ADDRESS_MAP_START( tv_vcf_io, ADDRESS_SPACE_IO, 16 ) | |
| 209 | AM_RANGE(0x0006, 0x0007) AM_WRITE( tv_oki6395_w ) | |
| 210 | AM_RANGE(0x0008, 0x0009) AM_READ( read1_r ) | |
| 211 | AM_RANGE(0x000a, 0x000b) AM_READ( read2_r ) | |
| 212 | AM_RANGE(0x000c, 0x000d) AM_READ( read3_r ) | |
| 213 | AM_RANGE(0x0010, 0x0015) AM_WRITE( tv_vcf_paletteram_w ) | |
| 214 | AM_RANGE(0x0030, 0x0031) AM_WRITE( tv_vcf_bankselect_w ) AM_READ( okim6376_status_0_lsb_r ) | |
| 215 | ADDRESS_MAP_END | |
| 216 | ||
| 217 | ||
| 218 | static READ16_HANDLER( tv_ncf_read2_r ) | |
| 219 | { | |
| 220 | static int resetpulse = 0; | |
| 221 | ||
| 222 | // Bit 6 of port 1 is connected to clock impulse, as heartbeat. If impulse cease | |
| 223 | // machine resets itself. | |
| 224 | resetpulse ^= 0x40; | |
| 225 | ||
| 226 | return (input_port_read(space->machine, "IN1") & 0xbf) | resetpulse; | |
| 227 | } | |
| 228 | ||
| 229 | static WRITE16_HANDLER( tv_ncf_oki6395_w ) | |
| 230 | { | |
| 231 | static int okidata; | |
| 232 | if (okidata != data) { | |
| 233 | okidata = data; | |
| 234 | okim6376_data_0_lsb_w(space, 0, data | 0x80, mem_mask); | |
| 235 | okim6376_data_0_lsb_w(space, 0, (1 << 4), mem_mask); | |
| 236 | } | |
| 237 | } | |
| 238 | static ADDRESS_MAP_START( tv_ncf_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 239 | AM_RANGE(0x00000, 0x003ff) AM_RAM /*irq vector area*/ | |
| 240 | AM_RANGE(0x00400, 0x03fff) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size ) | |
| 241 | AM_RANGE(0x20000, 0x2ffff) AM_RAM AM_BASE(&blit_ram) /*blitter ram*/ | |
| 242 | AM_RANGE(0x40000, 0xbffff) AM_ROM AM_REGION("user1",0x40000) | |
| 243 | AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0) | |
| 244 | ADDRESS_MAP_END | |
| 245 | ||
| 246 | static ADDRESS_MAP_START( tv_ncf_io, ADDRESS_SPACE_IO, 16 ) | |
| 247 | AM_RANGE(0x0008, 0x0009) AM_WRITE( tv_ncf_oki6395_w ) | |
| 248 | AM_RANGE(0x000c, 0x000d) AM_READ( read1_r ) | |
| 249 | AM_RANGE(0x0010, 0x0011) AM_READ( tv_ncf_read2_r ) | |
| 250 | AM_RANGE(0x0012, 0x0013) AM_READ( read3_r ) | |
| 251 | AM_RANGE(0x0030, 0x0035) AM_WRITE( tv_vcf_paletteram_w ) | |
| 252 | ADDRESS_MAP_END | |
| 253 | ||
| 254 | ||
| 255 | static WRITE16_HANDLER( tv_tcf_paletteram_w ) | |
| 256 | { | |
| 257 | int r, g, b, color; | |
| 258 | ||
| 259 | COMBINE_DATA(&paletteram16[offset]); | |
| 260 | ||
| 261 | color = paletteram16[offset]; | |
| 262 | r = (color >> 8) & 0xf8; | |
| 263 | g = (color >> 3) & 0xf8; | |
| 264 | b = (color << 3) & 0xf8; | |
| 265 | ||
| 266 | palette_set_color_rgb(space->machine, offset, r, g, b); | |
| 267 | } | |
| 268 | ||
| 269 | static WRITE16_HANDLER( tv_tcf_bankselect_w ) | |
| 270 | { | |
| 271 | static UINT32 bankaddress; | |
| 272 | UINT8 *ROM = memory_region(space->machine, "user1"); | |
| 273 | ||
| 274 | /* bits 0, 1, 2 select the ROM bank */ | |
| 275 | bankaddress = (data & 0x07) * 0x40000; | |
| 276 | ||
| 277 | memory_set_bankptr(space->machine, 1, &ROM[bankaddress]); | |
| 278 | } | |
| 279 | ||
| 280 | static ADDRESS_MAP_START( tv_tcf_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 281 | AM_RANGE(0x00000, 0x003ff) AM_RAM /*irq vector area*/ | |
| 282 | AM_RANGE(0x00400, 0x03fff) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size ) | |
| 283 | AM_RANGE(0x40000, 0x5d4bf) AM_RAM AM_BASE(&blit_ram) /*blitter ram*/ | |
| 284 | AM_RANGE(0x7fe00, 0x7ffff) AM_RAM_WRITE( tv_tcf_paletteram_w ) AM_BASE(&paletteram16) | |
| 285 | AM_RANGE(0x80000, 0xbffff) AM_ROMBANK(1) | |
| 286 | AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0) | |
| 287 | ADDRESS_MAP_END | |
| 288 | ||
| 289 | static ADDRESS_MAP_START( tv_tcf_io, ADDRESS_SPACE_IO, 16 ) | |
| 290 | AM_RANGE(0x0006, 0x0007) AM_WRITE( tv_oki6395_w ) | |
| 291 | AM_RANGE(0x0008, 0x0009) AM_READ( read1_r ) | |
| 292 | AM_RANGE(0x000a, 0x000b) AM_READ( read2_r ) | |
| 293 | AM_RANGE(0x0030, 0x0031) AM_READ( read3_r ) AM_WRITE( tv_tcf_bankselect_w ) | |
| 294 | ADDRESS_MAP_END | |
| 295 | ||
| 296 | static INPUT_PORTS_START( tv_vcf ) | |
| 297 | PORT_START("IN0") | |
| 298 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Take Button") PORT_CODE(KEYCODE_A) | |
| 299 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Start") PORT_CODE(KEYCODE_N) | |
| 300 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X) | |
| 301 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V) | |
| 302 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Risk Button") PORT_CODE(KEYCODE_S) | |
| 303 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C) | |
| 304 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B) | |
| 305 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z) | |
| 306 | ||
| 307 | PORT_START("IN1") | |
| 308 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 309 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 310 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) | |
| 311 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN4 ) // Note 1 | |
| 312 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Ticket") | |
| 313 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Diagnostics") PORT_CODE(KEYCODE_F2) | |
| 314 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("Hopper") | |
| 315 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START3 ) | |
| 316 | ||
| 317 | PORT_START("IN2") | |
| 318 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Key") PORT_CODE(KEYCODE_9) | |
| 319 | PORT_DIPNAME( 0x0002, 0x0000, "Reset NVRAM" ) | |
| 320 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 321 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 322 | PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F1) | |
| 323 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) | |
| 324 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 325 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 326 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) | |
| 327 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) | |
| 328 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 329 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) | |
| 330 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) | |
| 331 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 332 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) | |
| 333 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 334 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 335 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) | |
| 336 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 337 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 338 | INPUT_PORTS_END | |
| 339 | ||
| 340 | static INPUT_PORTS_START( tv_ncf ) | |
| 341 | PORT_START("IN0") | |
| 342 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Take Button") PORT_CODE(KEYCODE_A) | |
| 343 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Start") PORT_CODE(KEYCODE_N) | |
| 344 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X) | |
| 345 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V) | |
| 346 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Risk Button") PORT_CODE(KEYCODE_S) | |
| 347 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C) | |
| 348 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B) | |
| 349 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z) | |
| 350 | ||
| 351 | PORT_START("IN1") | |
| 352 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 353 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 354 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) | |
| 355 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN4 ) // Note 1 | |
| 356 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START1 ) | |
| 357 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 ) | |
| 358 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_OTHER ) /* connected to the clock signal, to signal heartbeat */ | |
| 359 | PORT_DIPNAME( 0x0080, 0x0000, "Reset NVRAM" ) | |
| 360 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 361 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 362 | ||
| 363 | PORT_START("IN2") | |
| 364 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Diagnostics") PORT_CODE(KEYCODE_F2) | |
| 365 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) | |
| 366 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 367 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 368 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) | |
| 369 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 370 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 371 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) | |
| 372 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 373 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 374 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) | |
| 375 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) | |
| 376 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 377 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) | |
| 378 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) | |
| 379 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 380 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) | |
| 381 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 382 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 383 | PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F1) | |
| 384 | INPUT_PORTS_END | |
| 385 | ||
| 386 | static INPUT_PORTS_START( tv_tcf ) | |
| 387 | PORT_START("IN0") | |
| 388 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Take Button") PORT_CODE(KEYCODE_A) | |
| 389 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Start") PORT_CODE(KEYCODE_N) | |
| 390 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X) | |
| 391 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V) | |
| 392 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Risk Button") PORT_CODE(KEYCODE_S) | |
| 393 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C) | |
| 394 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B) | |
| 395 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z) | |
| 396 | ||
| 397 | PORT_START("IN1") | |
| 398 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 399 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 400 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) | |
| 401 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN4 ) // Note 1 | |
| 402 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Ticket") | |
| 403 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Diagnostics") PORT_CODE(KEYCODE_F2) | |
| 404 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("Hopper") | |
| 405 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START3 ) | |
| 406 | ||
| 407 | PORT_START("IN2") | |
| 408 | PORT_BIT( 0x0003, 0x0002, IPT_OTHER ) // Protection | |
| 409 | PORT_DIPNAME( 0x0004, 0x0000, "Reset NVRAM" ) | |
| 410 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 411 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 412 | PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F1) | |
| 413 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) | |
| 414 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) | |
| 415 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 416 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) | |
| 417 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) | |
| 418 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 419 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) | |
| 420 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 421 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 422 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) | |
| 423 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 424 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 425 | INPUT_PORTS_END | |
| 426 | ||
| 427 | static INTERRUPT_GEN( vblank_irq ) | |
| 428 | { | |
| 429 | cpu_set_input_line_and_vector(device,0,HOLD_LINE,0x08/4); | |
| 430 | } | |
| 431 | ||
| 432 | static MACHINE_DRIVER_START( tv_vcf ) | |
| 433 | MDRV_CPU_ADD("main", V30, XTAL_12MHz/2 ) // ? | |
| 434 | MDRV_CPU_PROGRAM_MAP(tv_vcf_map,0) | |
| 435 | MDRV_CPU_IO_MAP(tv_vcf_io,0) | |
| 436 | MDRV_CPU_VBLANK_INT("main", vblank_irq) | |
| 437 | ||
| 438 | MDRV_NVRAM_HANDLER(generic_0fill) | |
| 439 | ||
| 440 | MDRV_SCREEN_ADD("main", RASTER) | |
| 441 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 442 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 443 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) | |
| 444 | MDRV_SCREEN_SIZE(400, 300) | |
| 445 | MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) | |
| 446 | ||
| 447 | MDRV_PALETTE_LENGTH(0x100) | |
| 448 | ||
| 449 | MDRV_VIDEO_START(tourvisn) | |
| 450 | MDRV_VIDEO_UPDATE(tourvisn) | |
| 451 | ||
| 452 | /* sound hardware */ | |
| 453 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 454 | ||
| 455 | //OkiM6376 | |
| 456 | MDRV_SOUND_ADD("oki", OKIM6376, XTAL_12MHz/2/2) | |
| 457 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 458 | ||
| 459 | MACHINE_DRIVER_END | |
| 460 | ||
| 461 | static MACHINE_DRIVER_START( tv_ncf ) | |
| 462 | MDRV_IMPORT_FROM(tv_vcf) | |
| 463 | ||
| 464 | MDRV_CPU_MODIFY("main") | |
| 465 | MDRV_CPU_PROGRAM_MAP(tv_ncf_map,0) | |
| 466 | MDRV_CPU_IO_MAP(tv_ncf_io,0) | |
| 467 | ||
| 468 | MACHINE_DRIVER_END | |
| 469 | ||
| 470 | static MACHINE_DRIVER_START( tv_tcf ) | |
| 471 | MDRV_IMPORT_FROM(tv_vcf) | |
| 472 | ||
| 473 | MDRV_CPU_MODIFY("main") | |
| 474 | MDRV_CPU_PROGRAM_MAP(tv_tcf_map,0) | |
| 475 | MDRV_CPU_IO_MAP(tv_tcf_io,0) | |
| 476 | ||
| 477 | MDRV_SCREEN_MODIFY("main") | |
| 478 | MDRV_SCREEN_VISIBLE_AREA(0, 400-1, 0, 300-1) | |
| 479 | MACHINE_DRIVER_END | |
| 480 | ||
| 481 | ||
| 482 | ROM_START( tour4000 ) | |
| 483 | ROM_REGION( 0x100000, "user1", 0 ) /* V30 Code */ | |
| 484 | ROM_LOAD16_BYTE( "vcfi18.bin", 0x00001, 0x80000, CRC(8c83cd34) SHA1(a94bdfdb74d047ac3851f2aef295a37c93b091f2) ) | |
| 485 | ROM_LOAD16_BYTE( "vcfi17.bin", 0x00000, 0x80000, CRC(bcae57ed) SHA1(13c02cae59ed5cc0847a7827a315902066b03190) ) | |
| 486 | ||
| 487 | ROM_REGION( 0x040000, "boot_prg", 0 ) /*copy for program code*/ | |
| 488 | ROM_COPY( "user1", 0x0c0000, 0x000000, 0x40000 ) | |
| 489 | ||
| 490 | ROM_REGION( 0x080000, "oki", 0 ) /* M6376 Samples */ | |
| 491 | ROM_LOAD( "ic25.bin", 0x00000, 0x80000, CRC(d71a5566) SHA1(2f7aefc06e39ce211e31b15aadf6338b679e7a31) ) | |
| 492 | ROM_END | |
| 493 | ||
| 494 | ROM_START( cfever40 ) | |
| 495 | ROM_REGION( 0x100000, "user1", 0 ) /* V30 Code */ | |
| 496 | ROM_LOAD16_BYTE( "vcfi48.bin", 0x00001, 0x80000, CRC(5a86a642) SHA1(fd927bc393242ff0aca87a0e3c2127f6f1df09cd) ) | |
| 497 | ROM_LOAD16_BYTE( "vcfi47.bin", 0x00000, 0x80000, CRC(e7adc4d8) SHA1(862041c2c5d260727e525ab85fde18994484db16) ) | |
| 498 | ||
| 499 | ROM_REGION( 0x040000, "boot_prg", 0 ) /*copy for program code*/ | |
| 500 | ROM_COPY( "user1", 0x0c0000, 0x000000, 0x40000 ) | |
| 501 | ||
| 502 | ROM_REGION( 0x080000, "oki", 0 ) /* M6376 Samples */ | |
| 503 | ROM_LOAD( "ic25.bin", 0x00000, 0x80000, CRC(d71a5566) SHA1(2f7aefc06e39ce211e31b15aadf6338b679e7a31) ) | |
| 504 | ROM_END | |
| 505 | ||
| 506 | ROM_START( cfever50 ) | |
| 507 | ROM_REGION( 0x100000, "user1", 0 ) /* V30 Code */ | |
| 508 | ROM_LOAD16_BYTE( "vcfi58.bin", 0x00001, 0x80000, CRC(c3464934) SHA1(1672c34d9ca250769973f7bc739137f153552eb9) ) | |
| 509 | ROM_LOAD16_BYTE( "vcfi57.bin", 0x00000, 0x80000, CRC(2b789acb) SHA1(782ad3a6e0eacbf9adec4afd20a309215913e505) ) | |
| 510 | ||
| 511 | ROM_REGION( 0x040000, "boot_prg", 0 ) /*copy for program code*/ | |
| 512 | ROM_COPY( "user1", 0x0c0000, 0x000000, 0x40000 ) | |
| 513 | ||
| 514 | ROM_REGION( 0x080000, "oki", 0 ) /* M6376 Samples */ | |
| 515 | ROM_LOAD( "ic25.bin", 0x00000, 0x80000, CRC(d71a5566) SHA1(2f7aefc06e39ce211e31b15aadf6338b679e7a31) ) | |
| 516 | ROM_END | |
| 517 | ||
| 518 | ROM_START( tour4010 ) | |
| 519 | ROM_REGION( 0x100000, "user1", 0 ) /* V30 Code */ | |
| 520 | ROM_LOAD16_BYTE( "ncfi18.bin", 0x00001, 0x80000, CRC(294929d9) SHA1(712926cf1f78197fce838a4e76d70082182214eb) ) | |
| 521 | ROM_LOAD16_BYTE( "ncfi17.bin", 0x00000, 0x80000, CRC(4a8ac279) SHA1(41b0de4444466700ef2de2e926c8fa6f0bda280d) ) | |
| 522 | ||
| 523 | ROM_REGION( 0x040000, "boot_prg", 0 ) /*copy for program code*/ | |
| 524 | ROM_COPY( "user1", 0x0c0000, 0x000000, 0x40000 ) | |
| 525 | ||
| 526 | ROM_REGION( 0x080000, "oki", 0 ) /* M6376 Samples */ | |
| 527 | ROM_LOAD( "ic25.bin", 0x00000, 0x80000, CRC(d71a5566) SHA1(2f7aefc06e39ce211e31b15aadf6338b679e7a31) ) | |
| 528 | ROM_END | |
| 529 | ||
| 530 | ROM_START( cfever51 ) | |
| 531 | ROM_REGION( 0x100000, "user1", 0 ) /* V30 Code */ | |
| 532 | ROM_LOAD16_BYTE( "ncfi58.bin", 0x00001, 0x80000, CRC(cdf9c2f0) SHA1(94f9cf6b1856becd74971022ded6db5ae927fb54) ) | |
| 533 | ROM_LOAD16_BYTE( "ncfi57.bin", 0x00000, 0x80000, CRC(5005cf2b) SHA1(468ccd27fcb8bdb7d6ccf423542e1d4773930b88) ) | |
| 534 | ||
| 535 | ROM_REGION( 0x040000, "boot_prg", 0 ) /*copy for program code*/ | |
| 536 | ROM_COPY( "user1", 0x0c0000, 0x000000, 0x40000 ) | |
| 537 | ||
| 538 | ROM_REGION( 0x080000, "oki", 0 ) /* M6376 Samples */ | |
| 539 | ROM_LOAD( "ic25.bin", 0x00000, 0x80000, CRC(d71a5566) SHA1(2f7aefc06e39ce211e31b15aadf6338b679e7a31) ) | |
| 540 | ROM_END | |
| 541 | ||
| 542 | ROM_START( cfever61 ) | |
| 543 | ROM_REGION( 0x100000, "user1", 0 ) /* V30 Code */ | |
| 544 | ROM_LOAD16_BYTE( "ncfi68.bin", 0x00001, 0x80000, CRC(51fe839f) SHA1(e4d9bce4a995cb407faaf36b2c1e10409a2e94da) ) | |
| 545 | ROM_LOAD16_BYTE( "ncfi67.bin", 0x00000, 0x80000, CRC(d889d6b6) SHA1(791d9b9fc2d0a128ab07a9ae18a32f2838a5ea3f) ) | |
| 546 | ||
| 547 | ROM_REGION( 0x040000, "boot_prg", 0 ) /*copy for program code*/ | |
| 548 | ROM_COPY( "user1", 0x0c0000, 0x000000, 0x40000 ) | |
| 549 | ||
| 550 | ROM_REGION( 0x080000, "oki", 0 ) /* M6376 Samples */ | |
| 551 | ROM_LOAD( "ic25.bin", 0x00000, 0x80000, CRC(d71a5566) SHA1(2f7aefc06e39ce211e31b15aadf6338b679e7a31) ) | |
| 552 | ROM_END | |
| 553 | ||
| 554 | ROM_START( cfever1k ) | |
| 555 | ROM_REGION( 0x200000, "user1", 0 ) /* V30 Code */ | |
| 556 | ROM_LOAD16_BYTE( "tcfi28.bin", 0x00001, 0x100000, CRC(e38d115a) SHA1(7fec94ddcdb07e483ed2f0d7d667c35ceb7a1f44) ) | |
| 557 | ROM_LOAD16_BYTE( "tcfi27.bin", 0x00000, 0x100000, CRC(32f884e6) SHA1(cc74a4c6313654bbd363a89fe7757a05c74de45b) ) | |
| 558 | ||
| 559 | ROM_REGION( 0x040000, "boot_prg", 0 ) /*copy for program code*/ | |
| 560 | ROM_COPY( "user1", 0x1C0000, 0x000000, 0x40000 ) | |
| 561 | ||
| 562 | ROM_REGION( 0x080000, "oki", 0 ) /* M6376 Samples */ | |
| 563 | ROM_LOAD( "ic25.bin", 0x00000, 0x80000, CRC(d71a5566) SHA1(2f7aefc06e39ce211e31b15aadf6338b679e7a31) ) | |
| 564 | ROM_END | |
| 565 | ||
| 566 | ROM_START( girotutt ) | |
| 567 | ROM_REGION( 0x200000, "user1", 0 ) /* V30 Code */ | |
| 568 | ROM_LOAD16_BYTE( "tcfi18.bin", 0x00001, 0x100000, CRC(822ab6a1) SHA1(04f4254da46cf67ea17587fde4a0fdd39c658b3b) ) | |
| 569 | ROM_LOAD16_BYTE( "tcfi17.bin", 0x00000, 0x100000, CRC(b326a0ee) SHA1(c96b7578c112a97ba1d8de4d3d0ae68fef846cad) ) | |
| 570 | ||
| 571 | ROM_REGION( 0x040000, "boot_prg", 0 ) /*copy for program code*/ | |
| 572 | ROM_COPY( "user1", 0x1C0000, 0x000000, 0x40000 ) | |
| 573 | ||
| 574 | ROM_REGION( 0x080000, "oki", 0 ) /* M6376 Samples */ | |
| 575 | ROM_LOAD( "t41.bin", 0x00000, 0x80000, CRC(6f694406) SHA1(ec8b8baba0ee1bfe8986ce978412ee4de06f1906) ) | |
| 576 | ROM_END | |
| 577 | ||
| 578 | GAME( 2000, tour4000, 0, tv_vcf, tv_vcf, 0, ROT0, "High Video", "Tour 4000", 0 ) | |
| 579 | GAME( 2000, cfever40, 0, tv_vcf, tv_vcf, 0, ROT0, "High Video", "Casino Fever 4.0", 0 ) | |
| 580 | GAME( 2000, cfever50, 0, tv_vcf, tv_vcf, 0, ROT0, "High Video", "Casino Fever 5.0", 0 ) | |
| 581 | GAME( 2000, tour4010, 0, tv_ncf, tv_ncf, 0, ROT0, "High Video", "Tour 4010", 0 ) | |
| 582 | GAME( 2000, cfever51, 0, tv_ncf, tv_ncf, 0, ROT0, "High Video", "Casino Fever 5.1", 0 ) | |
| 583 | GAME( 2000, cfever61, 0, tv_ncf, tv_ncf, 0, ROT0, "High Video", "Casino Fever 6.1", 0 ) | |
| 584 | GAME( 2000, cfever1k, 0, tv_tcf, tv_tcf, 0, ROT0, "High Video", "Casino Fever 1k", 0 ) | |
| 585 | GAME( 2000, girotutt, 0, tv_tcf, tv_tcf, 0, ROT0, "High Video", "GiroTutto", 0 ) |
| r4135 | r4136 | |
|---|---|---|
| 427 | 427 | * |
| 428 | 428 | *************************************/ |
| 429 | 429 | |
| 430 | GAME( 1992, arcadecl, 0, arcadecl, arcadecl, arcadecl, ROT0, "Atari Games", "Arcade Classics (prototype)", 0 ) | |
| 431 | GAME( 1992, sparkz, 0, arcadecl, sparkz, sparkz, ROT0, "Atari Games", "Sparkz (prototype)", 0 ) | |
| 430 | GAME( 1992, arcadecl, 0, arcadecl, arcadecl, arcadecl, ROT0, "Atari Games", "Arcade Classics (prototype)", GAME_SUPPORTS_SAVE ) | |
| 431 | GAME( 1992, sparkz, 0, arcadecl, sparkz, sparkz, ROT0, "Atari Games", "Sparkz (prototype)", GAME_SUPPORTS_SAVE ) |
| r4135 | r4136 | |
|---|---|---|
| 923 | 923 | { |
| 924 | 924 | case 0x00: |
| 925 | 925 | return input_port_read_safe(space->machine, "P4", 0xff); |
| 926 | break; | |
| 927 | 926 | |
| 928 | 927 | case 0x20: |
| 929 | 928 | return input_port_read(space->machine, "MISC"); |
| 930 | break; | |
| 931 | 929 | |
| 932 | 930 | case 0x40: |
| 933 | 931 | return input_port_read(space->machine, "P1"); |
| 934 | break; | |
| 935 | 932 | |
| 936 | 933 | case 0x60: |
| 937 | 934 | return input_port_read(space->machine, "P2"); |
| 938 | break; | |
| 939 | 935 | |
| 940 | 936 | default: |
| 941 | 937 | break; |
| r4135 | r4136 | |
|---|---|---|
| 84 | 84 | return 0xff; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | void sfkick_remap_banks(running_machine *machine) | |
| 87 | static void sfkick_remap_banks(running_machine *machine) | |
| 88 | 88 | { |
| 89 | 89 | /* 0000-3ffff */ |
| 90 | 90 | switch(sfkick_bank_cfg&3) |
| r4135 | r4136 | |
| 417 | 417 | cpu_set_input_line (machine->cpu[0], 0, (i ? HOLD_LINE : CLEAR_LINE)); |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | VIDEO_START( sfkick ) | |
| 420 | static VIDEO_START( sfkick ) | |
| 421 | 421 | { |
| 422 | 422 | VIDEO_START_CALL(generic_bitmapped); |
| 423 | 423 | v9938_init (machine, 0, machine->primary_screen, tmpbitmap, MODEL_V9938, 0x80000, sfkick_vdp_interrupt); |
| r4135 | r4136 | |
|---|---|---|
| 174 | 174 | // prepare GfxElement on the fly |
| 175 | 175 | gfx_element gfx; |
| 176 | 176 | |
| 177 | gfx.machine = machine; | |
| 178 | gfx.width = dimx; | |
| 179 | gfx.height = dimy; | |
| 180 | gfx.total_elements = 1; | |
| 181 | gfx.color_depth = 32; | |
| 182 | gfx.color_granularity = 32; | |
| 183 | gfx.color_base = 0x100; | |
| 184 | gfx.total_colors = 8; | |
| 185 | gfx.pen_usage = NULL; | |
| 186 | gfx.gfxdata = sprites_gfx + addr; | |
| 187 | gfx.line_modulo = dimx; | |
| 188 | gfx.char_modulo = 0; // doesn't matter | |
| 189 | gfx.flags = 0; | |
| 190 | ||
| 191 | 177 | // Bounds checking |
| 192 | 178 | if ( addr + dimx * dimy >= sprites_gfx_size ) |
| 193 | 179 | return; |
| 194 | 180 | |
| 181 | gfx_element_build_temporary(&gfx, machine, sprites_gfx + addr, dimx, dimy, dimx, 0x100, 32, 0); | |
| 182 | ||
| 195 | 183 | drawgfx( bitmap,&gfx, |
| 196 | 184 | 0, color, |
| 197 | 185 | flipx, flipy, |
| r4135 | r4136 | |
|---|---|---|
| 34 | 34 | static READ16_HANDLER( lemmings_trackball_r ) |
| 35 | 35 | { |
| 36 | 36 | switch (offset) { |
| 37 | case 0: return input_port_read(space->machine, "AN0"); break; | |
| 38 | case 1: return input_port_read(space->machine, "AN1"); break; | |
| 39 | case 4: return input_port_read(space->machine, "AN2"); break; | |
| 40 | case 5: return input_port_read(space->machine, "AN3"); break; | |
| 37 | case 0: return input_port_read(space->machine, "AN0"); | |
| 38 | case 1: return input_port_read(space->machine, "AN1"); | |
| 39 | case 4: return input_port_read(space->machine, "AN2"); | |
| 40 | case 5: return input_port_read(space->machine, "AN3"); | |
| 41 | 41 | } |
| 42 | 42 | return 0; |
| 43 | 43 | } |
| r4135 | r4136 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | 8 | #include "cpu/z80/z80.h" |
| 9 | #include "machine/konami1.h" | |
| 10 | 9 | #include "cpu/m6809/m6809.h" |
| 10 | #include "sound/dac.h" | |
| 11 | #include "sound/sn76496.h" | |
| 11 | 12 | #include "sound/vlm5030.h" |
| 12 | #include " | |
| 13 | #include "machine/konami1.h" | |
| 13 | 14 | |
| 14 | 15 | |
| 15 | 16 | extern UINT8 *hyperspt_scroll; |
| r4135 | r4136 | |
|---|---|---|
| 118 | 118 | #include "cpu/i8085/i8085.h" |
| 119 | 119 | #include "includes/tiamc1.h" |
| 120 | 120 | |
| 121 | static UINT8 *video_ram; | |
| 122 | ||
| 123 | static DRIVER_INIT( tiamc1 ) | |
| 124 | { | |
| 125 | video_ram = auto_malloc(0x3040); | |
| 126 | } | |
| 127 | ||
| 128 | 121 | static MACHINE_RESET( tiamc1 ) |
| 129 | 122 | { |
| 130 | 123 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 131 | ||
| 132 | memset(video_ram, 0, 0x3040); | |
| 133 | ||
| 134 | tiamc1_charram = video_ram + 0x0800; /* Ram is banked */ | |
| 135 | tiamc1_tileram = video_ram + 0x0000; | |
| 136 | ||
| 137 | tiamc1_spriteram_y = video_ram + 0x3000; | |
| 138 | tiamc1_spriteram_x = video_ram + 0x3010; | |
| 139 | tiamc1_spriteram_n = video_ram + 0x3020; | |
| 140 | tiamc1_spriteram_a = video_ram + 0x3030; | |
| 141 | ||
| 142 | 124 | tiamc1_bankswitch_w(space, 0, 0); |
| 143 | ||
| 144 | state_save_register_global_pointer(machine, video_ram, 0x3040); | |
| 145 | 125 | } |
| 146 | 126 | |
| 147 | 127 | static WRITE8_HANDLER( tiamc1_control_w ) |
| r4135 | r4136 | |
| 342 | 322 | |
| 343 | 323 | ROM_END |
| 344 | 324 | |
| 345 | GAME( 1988, konek, 0, tiamc1, tiamc1, tiamc1, ROT0, "Terminal", "Konek-Gorbunok", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 346 | GAME( 1988, sosterm, 0, tiamc1, tiamc1, tiamc1, ROT0, "Terminal", "S.O.S.", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 347 | GAME( 1988, koroleva, 0, tiamc1, tiamc1, tiamc1, ROT0, "Terminal", "Snezhnaja Koroleva", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 325 | GAME( 1988, konek, 0, tiamc1, tiamc1, 0, ROT0, "Terminal", "Konek-Gorbunok", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 326 | GAME( 1988, sosterm, 0, tiamc1, tiamc1, 0, ROT0, "Terminal", "S.O.S.", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 327 | GAME( 1988, koroleva, 0, tiamc1, tiamc1, 0, ROT0, "Terminal", "Snezhnaja Koroleva", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 348 | 328 |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | not all games work due to either banking, dma or protection issues. |
| 11 | 11 | graphics are glitchy in some games. |
| 12 | 12 | |
| 13 | - day, date, and year from the RTC appear to be ignored (hour/min/sec are fine). H8 core bug or BIOS doesn't care? | |
| 14 | 13 | - golgo13 assumes the test switch is a switch, not a button - must hold down F2 to stay in test mode |
| 15 | 14 | |
| 16 | 15 | |
| r4135 | r4136 | |
| 1311 | 1310 | ret = make_bcd(systime.local_time.hour); // hour (BCD, 0-23) |
| 1312 | 1311 | break; |
| 1313 | 1312 | case 3: |
| 1314 | ret = make_bcd(weekday[systime.local_time.weekday]); // day of the week (1 = Monday, 7 = Sunday) | |
| 1313 | ret = make_bcd(weekday[systime.local_time.weekday]); // low nibble = day of the week | |
| 1314 | ret |= (make_bcd(systime.local_time.mday) & 0x0f)<<4; // high nibble = low digit of day | |
| 1315 | 1315 | break; |
| 1316 | 1316 | case 4: |
| 1317 | ret = make_bcd(systime.local_time.mday); // day (BCD, 1-31) | |
| 1317 | ret = (make_bcd(systime.local_time.mday) >> 4); // low nibble = high digit of day | |
| 1318 | ret |= (make_bcd(systime.local_time.month + 1) & 0x0f)<<4; // high nibble = low digit of month | |
| 1318 | 1319 | break; |
| 1319 | 1320 | case 5: |
| 1320 | ret = make_bcd(systime.local_time.month + 1); // month (BCD, 1-12) | |
| 1321 | ret = make_bcd(systime.local_time.month + 1) >> 4; // low nibble = high digit of month | |
| 1322 | ret |= (make_bcd(systime.local_time.year % 10) << 4); // high nibble = low digit of year | |
| 1321 | 1323 | break; |
| 1322 | 1324 | case 6: |
| 1323 | ret = make_bcd(systime.local_time.year % 100); // year (BCD, 0- | |
| 1325 | ret = make_bcd(systime.local_time.year % 100) >> 4; // low nibble = tens digit of year (BCD, 0- | |
| 1324 | 1326 | break; |
| 1325 | 1327 | } |
| 1326 | 1328 |
| r4135 | r4136 | |
|---|---|---|
| 28 | 28 | #include "driver.h" |
| 29 | 29 | #include "cpu/z80/z80.h" |
| 30 | 30 | #include "cpu/s2650/s2650.h" |
| 31 | #include "machine/8255ppi.h" | |
| 32 | 31 | #include "sound/ay8910.h" |
| 33 | 32 | #include "sound/dac.h" |
| 33 | #include "sound/flt_rc.h" | |
| 34 | #include "machine/8255ppi.h" | |
| 34 | 35 | #include "galaxold.h" |
| 35 | 36 | |
| 36 | 37 |
| r4135 | r4136 | |
|---|---|---|
| 55 | 55 | |
| 56 | 56 | static VIDEO_START( mogura ) |
| 57 | 57 | { |
| 58 | gfx_element_set_source(machine->gfx[0], mogura_gfxram); | |
| 58 | 59 | mogura_tilemap = tilemap_create(machine, get_mogura_tile_info,tilemap_scan_rows,8,8,64, 32); |
| 59 | 60 | } |
| 60 | 61 | |
| r4135 | r4136 | |
| 110 | 111 | { |
| 111 | 112 | mogura_gfxram[offset] = data ; |
| 112 | 113 | |
| 113 | decodechar(space->machine->gfx[0], offset/16, mogura_gfxram); | |
| 114 | ||
| 115 | tilemap_mark_all_tiles_dirty(mogura_tilemap); | |
| 114 | gfx_element_mark_dirty(space->machine->gfx[0], offset/16); | |
| 116 | 115 | } |
| 117 | 116 | |
| 118 | 117 |
| r4135 | r4136 | |
|---|---|---|
| 1461 | 1461 | ROM_LOAD( "e17-23.65", 0x000000, 0x010000, CRC(80ac1428) SHA1(5a2a1e60a11ecdb8743c20ddacfb61f9fd00f01c) ) |
| 1462 | 1462 | |
| 1463 | 1463 | ROM_REGION( 0x00080, "user2", 0 ) /* eeprom */ |
| 1464 | ROM_LOAD( "93c46.87", 0x000000, 0x000080, CRC(50fdcce0) SHA1(6e901856755ccdcf478a457c510c0de58683216a) ) | |
| 1464 | ROM_LOAD( "japan-93c46.87", 0x000000, 0x000080, CRC(50fdcce0) SHA1(6e901856755ccdcf478a457c510c0de58683216a) ) /* No specific label but different defaults */ | |
| 1465 | 1465 | |
| 1466 | 1466 | ROM_REGION( 0x1800000, "gfx1", 0 ) |
| 1467 | 1467 | ROM_LOAD32_WORD( "e38-05.9", 0x0800002, 0x200000, CRC(bda366bf) SHA1(a7558e6d5e4583a2d8e3d2bfa8cabcc459d3ee83) ) |
| r4135 | r4136 | |
|---|---|---|
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | static tilemap *gp98_reel1_tilemap; |
| 30 | UINT8 *gp98_reel1_ram; | |
| 30 | static UINT8 *gp98_reel1_ram; | |
| 31 | 31 | |
| 32 | WRITE8_HANDLER( gp98_reel1_ram_w ) | |
| 32 | static WRITE8_HANDLER( gp98_reel1_ram_w ) | |
| 33 | 33 | { |
| 34 | 34 | gp98_reel1_ram[offset] = data; |
| 35 | 35 | tilemap_mark_tile_dirty(gp98_reel1_tilemap,offset); |
| r4135 | r4136 | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | static tilemap *gp98_reel2_tilemap; |
| 62 | UINT8 *gp98_reel2_ram; | |
| 62 | static UINT8 *gp98_reel2_ram; | |
| 63 | 63 | |
| 64 | WRITE8_HANDLER( gp98_reel2_ram_w ) | |
| 64 | static WRITE8_HANDLER( gp98_reel2_ram_w ) | |
| 65 | 65 | { |
| 66 | 66 | gp98_reel2_ram[offset] = data; |
| 67 | 67 | tilemap_mark_tile_dirty(gp98_reel2_tilemap,offset); |
| r4135 | r4136 | |
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | static tilemap *gp98_reel3_tilemap; |
| 94 | UINT8 *gp98_reel3_ram; | |
| 94 | static UINT8 *gp98_reel3_ram; | |
| 95 | 95 | |
| 96 | WRITE8_HANDLER( gp98_reel3_ram_w ) | |
| 96 | static WRITE8_HANDLER( gp98_reel3_ram_w ) | |
| 97 | 97 | { |
| 98 | 98 | gp98_reel3_ram[offset] = data; |
| 99 | 99 | tilemap_mark_tile_dirty(gp98_reel3_tilemap,offset); |
| r4135 | r4136 | |
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | static tilemap *gp98_reel4_tilemap; |
| 126 | UINT8 *gp98_reel4_ram; | |
| 126 | static UINT8 *gp98_reel4_ram; | |
| 127 | 127 | |
| 128 | WRITE8_HANDLER( gp98_reel4_ram_w ) | |
| 128 | static WRITE8_HANDLER( gp98_reel4_ram_w ) | |
| 129 | 129 | { |
| 130 | 130 | gp98_reel4_ram[offset] = data; |
| 131 | 131 | tilemap_mark_tile_dirty(gp98_reel4_tilemap,offset); |
| r4135 | r4136 | |
|---|---|---|
| 1176 | 1176 | *************************/ |
| 1177 | 1177 | |
| 1178 | 1178 | /* YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS LAYOUT */ |
| 1179 | GAMEL( 1990, ampoker2, 0, ampoker2, ampoker2, 0, ROT0, "Novomatic", "American Poker II", 0, layout_ampoker2 ) | |
| 1180 | GAMEL( 1990, ampkr2b1, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "American Poker II (bootleg, set 1)", 0, layout_ampoker2 ) | |
| 1181 | GAMEL( 1990, ampkr2b2, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "American Poker II (bootleg, set 2)", 0, layout_ampoker2 ) | |
| 1182 | GAMEL( 1994, ampkr2b3, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "American Poker II (bootleg, set 3)", 0, layout_ampoker2 ) | |
| 1183 | GAMEL( 1995, ampkr95, ampoker2, ampoker2, ampkr95, 0, ROT0, "Bootleg", "American Poker 95", 0, layout_ampoker2 ) | |
| 1184 | GAMEL( 1990, pkrdewin, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "Poker De Win", 0, layout_ampoker2 ) | |
| 1185 | GAMEL( 1990, videomat, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "Videomat (polish bootleg)", 0, layout_ampoker2 ) | |
| 1186 | GAMEL( 1995, sigmapkr, 0, ampoker2, sigmapkr, 0, ROT0, "Sigma Inc.", "Sigma Poker", 0, layout_sigmapkr ) | |
| 1187 | GAMEL( 1998, sigma2k, 0, sigma2k, sigma2k, 0, ROT0, "Sigma Inc.", "Sigma Poker 2000", 0, layout_sigmapkr ) | |
| 1179 | GAMEL( 1990, ampoker2, 0, ampoker2, ampoker2, 0, ROT0, "Novomatic", "American Poker II", GAME_SUPPORTS_SAVE, layout_ampoker2 ) | |
| 1180 | GAMEL( 1990, ampkr2b1, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "American Poker II (bootleg, set 1)", GAME_SUPPORTS_SAVE, layout_ampoker2 ) | |
| 1181 | GAMEL( 1990, ampkr2b2, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "American Poker II (bootleg, set 2)", GAME_SUPPORTS_SAVE, layout_ampoker2 ) | |
| 1182 | GAMEL( 1994, ampkr2b3, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "American Poker II (bootleg, set 3)", GAME_SUPPORTS_SAVE, layout_ampoker2 ) | |
| 1183 | GAMEL( 1995, ampkr95, ampoker2, ampoker2, ampkr95, 0, ROT0, "Bootleg", "American Poker 95", GAME_SUPPORTS_SAVE, layout_ampoker2 ) | |
| 1184 | GAMEL( 1990, pkrdewin, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "Poker De Win", GAME_SUPPORTS_SAVE, layout_ampoker2 ) | |
| 1185 | GAMEL( 1990, videomat, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "Videomat (polish bootleg)", GAME_SUPPORTS_SAVE, layout_ampoker2 ) | |
| 1186 | GAMEL( 1995, sigmapkr, 0, ampoker2, sigmapkr, 0, ROT0, "Sigma Inc.", "Sigma Poker", GAME_SUPPORTS_SAVE, layout_sigmapkr ) | |
| 1187 | GAMEL( 1998, sigma2k, 0, sigma2k, sigma2k, 0, ROT0, "Sigma Inc.", "Sigma Poker 2000", GAME_SUPPORTS_SAVE, layout_sigmapkr ) |
| r4135 | r4136 | |
|---|---|---|
| 56 | 56 | int bit0, bit1, bit2 , r, g, b; |
| 57 | 57 | int i; |
| 58 | 58 | |
| 59 | for (i = 0; i < 0x | |
| 59 | for (i = 0; i < 0x20; ++i) | |
| 60 | 60 | { |
| 61 | 61 | bit0 = (color_prom[0] >> 0) & 0x01; |
| 62 | 62 | bit1 = (color_prom[0] >> 1) & 0x01; |
| r4135 | r4136 | |
| 659 | 659 | MDRV_SCREEN_SIZE(256, 256) |
| 660 | 660 | MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 16, 240-1) |
| 661 | 661 | |
| 662 | MDRV_PALETTE_LENGTH( | |
| 662 | MDRV_PALETTE_LENGTH(32) | |
| 663 | 663 | |
| 664 | 664 | MDRV_VIDEO_START(jangou) |
| 665 | 665 | MDRV_VIDEO_UPDATE(jangou) |
| r4135 | r4136 | |
| 809 | 809 | ROM_LOAD( "rom5.bin", 0x02000, 0x02000, CRC(24d210ed) SHA1(6a0eae9d459975fbaad75bf21284baac3ba4f872) ) |
| 810 | 810 | |
| 811 | 811 | /*wtf,these 2 roms are next to the CPU roms, one is a CPU rom from Moon Quasar, the other a GFX rom from Crazy Climber, |
| 812 | I dunno what's going on,game doesn't appear to need these two....*/ | |
| 812 | I dunno what's going on,the game doesn't appear to need these two....*/ | |
| 813 | 813 | ROM_REGION( 0x1000, "user1", 0 ) |
| 814 | 814 | ROM_LOAD( "rom6.bin", 0x00000, 0x0800, CRC(33965a89) SHA1(92912cea76a472d9b709c664d9818844a07fcc32) ) // = mq3 Moon Quasar |
| 815 | 815 | ROM_LOAD( "rom7.bin", 0x00800, 0x0800, CRC(481b64cc) SHA1(3f35c545fc784ed4f969aba2d7be6e13a5ae32b7) ) // = cc06 Crazy Climber (US) |
| r4135 | r4136 | |
| 823 | 823 | ROM_LOAD( "countrygirl_prom.bin", 0x00, 0x20, CRC(dc54dc52) SHA1(db91a7ae05eb6b6e4b42f91dfe20ac0da6680b46) ) |
| 824 | 824 | ROM_END |
| 825 | 825 | |
| 826 | ROM_START( luckygrl ) | |
| 827 | ROM_REGION( 0x10000, "cpu0", 0 ) //encrypted z80 cpu | |
| 828 | ROM_LOAD( "5.9c", 0x00000, 0x01000, CRC(79b34eb2) SHA1(4b4916e09bfd6573fd2c7a7254fa4419164e0c4d) ) | |
| 829 | ROM_LOAD( "7.9f", 0x01000, 0x01000, CRC(14a44d23) SHA1(4f84a8f986a8fd9d5ac0636be1bb036c3b2746c2) ) | |
| 830 | ROM_LOAD( "6.9e", 0x02000, 0x01000, CRC(06850aa8) SHA1(c23cb6b7b26d5586b1a095dee88228d1613ae7d0) ) | |
| 831 | ||
| 832 | ROM_REGION( 0x80000, "gfx", 0 ) | |
| 833 | ROM_LOAD( "1.5r", 0x00000, 0x2000, CRC(fb429678) SHA1(00e37e90550d9190d06977a5f5ed75b691750cc1) ) | |
| 834 | ROM_LOAD( "piggy2.5r", 0x02000, 0x2000, CRC(a3919845) SHA1(45fffe34b7a29ecf8c8feb4152b5c7330ea3ad83) ) | |
| 835 | ROM_LOAD( "3.5n", 0x04000, 0x2000, CRC(130cfb89) SHA1(86b2a2142675cbd69d7cccab9b00f4c8863cdcbc) ) | |
| 836 | ROM_LOAD( "piggy4.5r", 0x06000, 0x2000, CRC(f5641c95) SHA1(e824b95c80d00789f07391aa5dcc02505bb8e141) ) | |
| 837 | ||
| 838 | ROM_REGION( 0x20, "proms", 0 ) | |
| 839 | ROM_LOAD( "prom_mb7051.3h", 0x00, 0x20, CRC(dff9f7a1) SHA1(593c99434df5dfd900ec57e3efa459903b589d96) ) | |
| 840 | ROM_END | |
| 841 | ||
| 842 | ||
| 826 | 843 | /*Temporary kludge for make the RNG work*/ |
| 827 | 844 | static READ8_HANDLER( jngolady_rng_r ) |
| 828 | 845 | { |
| r4135 | r4136 | |
| 834 | 851 | memory_install_read8_handler(cpu_get_address_space(machine->cpu[2], ADDRESS_SPACE_PROGRAM), 0x08, 0x08, 0, 0, jngolady_rng_r ); |
| 835 | 852 | } |
| 836 | 853 | |
| 854 | static DRIVER_INIT (luckygrl) | |
| 855 | { | |
| 856 | // this is WRONG | |
| 857 | int A; | |
| 858 | UINT8 *ROM = memory_region(machine, "cpu0"); | |
| 837 | 859 | |
| 838 | 860 | |
| 861 | unsigned char patn1[32] = { | |
| 862 | 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, | |
| 863 | 0x88, 0x28, 0x88, 0x28, 0x88, 0x28, 0x88, 0x28, 0x88, 0x28, 0x88, 0x28, 0x88, 0x28, 0x88, 0x28, | |
| 864 | }; | |
| 865 | ||
| 866 | unsigned char patn2[32] = { | |
| 867 | 0x28, 0x20, 0x28, 0x20, 0x28, 0x20, 0x28, 0x20, 0x28, 0x20, 0x28, 0x20, 0x28, 0x20, 0x28, 0x20, | |
| 868 | 0x28, 0x88, 0x28, 0x88, 0x28, 0x88, 0x28, 0x88, 0x28, 0x88, 0x28, 0x88, 0x28, 0x88, 0x28, 0x88 | |
| 869 | }; | |
| 870 | ||
| 871 | for (A = 0;A < 0x3000;A++) | |
| 872 | { | |
| 873 | UINT8 dat = ROM[A]; | |
| 874 | if (A&0x100) dat = dat ^ patn2[A&0x1f]; | |
| 875 | else dat = dat ^ patn1[A&0x1f]; | |
| 876 | ||
| 877 | ROM[A] = dat; | |
| 878 | } | |
| 879 | ||
| 880 | ||
| 881 | #if 0 | |
| 882 | { | |
| 883 | FILE *fp; | |
| 884 | char filename[256]; | |
| 885 | sprintf(filename,"decrypted_%s", machine->gamedrv->name); | |
| 886 | fp=fopen(filename, "w+b"); | |
| 887 | if (fp) | |
| 888 | { | |
| 889 | fwrite(ROM, 0x3000, 1, fp); | |
| 890 | fclose(fp); | |
| 891 | } | |
| 892 | } | |
| 893 | #endif | |
| 894 | ||
| 895 | } | |
| 896 | ||
| 897 | ||
| 839 | 898 | /* flyer shows a bet version of Jangou Lady too,does it truly exists?*/ |
| 840 | 899 | GAME( 1983, jangou, 0, jangou, jangou, 0, ROT0, "Nichibutsu", "Jangou [BET] (Japan)", GAME_NO_COCKTAIL ) |
| 841 | 900 | /* Jangou Night */ |
| 842 | 901 | GAME( 1984, jngolady, 0, jngolady, jngolady, jngolady, ROT0, "Nichibutsu", "Jangou Lady (Japan)", GAME_NO_COCKTAIL ) |
| 843 | 902 | GAME( 1984, cntrygrl, 0, cntrygrl, cntrygrl, 0, ROT0, "Royal Denshi", "Country Girl (Japan)", GAME_NO_COCKTAIL ) |
| 903 | GAME( 1984?,luckygrl, 0, cntrygrl, cntrygrl, luckygrl, ROT0, "Wing", "Lucky Girl? (Wing)", GAME_NOT_WORKING ) |
| r4135 | r4136 | |
|---|---|---|
| 867 | 867 | return; |
| 868 | 868 | } |
| 869 | 869 | return; |
| 870 | break; | |
| 871 | 870 | } |
| 872 | 871 | fatalerror("real3d_dma_w: %08X, %08X%08X, %08X%08X", offset, (UINT32)(data >> 32), (UINT32)(data), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask)); |
| 873 | 872 | } |
| r4135 | r4136 | |
|---|---|---|
| 36 | 36 | |
| 37 | 37 | ------------------------------ |
| 38 | 38 | |
| 39 | ||
| 40 | 39 | *************************************************************************************************/ |
| 41 | 40 | |
| 42 | 41 | #include "driver.h" |
| r4135 | r4136 | |
| 127 | 126 | */ |
| 128 | 127 | |
| 129 | 128 | |
| 130 | VIDEO_START(cb2001) | |
| 129 | static VIDEO_START(cb2001) | |
| 131 | 130 | { |
| 132 | 131 | |
| 133 | 132 | } |
| 134 | 133 | |
| 135 | VIDEO_UPDATE(cb2001) | |
| 134 | static VIDEO_UPDATE(cb2001) | |
| 136 | 135 | { |
| 137 | 136 | return 0; |
| 138 | 137 | } |
| r4135 | r4136 | |
| 153 | 152 | // cpu_set_input_line_and_vector(device,0,HOLD_LINE,0x08/4); |
| 154 | 153 | } |
| 155 | 154 | |
| 155 | static const gfx_layout cb2001_layout = | |
| 156 | { | |
| 157 | 8,8, | |
| 158 | RGN_FRAC(1,1), | |
| 159 | 4, | |
| 160 | { 0,1,2,3 }, | |
| 161 | { 8,12,0,4,24,28, 16,20 }, | |
| 162 | { 0*32,1*32,2*32,3*32,4*32,5*32,6*32,7*32 }, | |
| 163 | 8*32 | |
| 164 | }; | |
| 165 | ||
| 166 | static const gfx_layout cb2001_layout32 = | |
| 167 | { | |
| 168 | 8,32, | |
| 169 | RGN_FRAC(1,1), | |
| 170 | 4, | |
| 171 | { 0,1,2,3 }, | |
| 172 | { 8,12,0,4,24,28, 16,20 }, | |
| 173 | { 0*32,1*32,2*32,3*32,4*32,5*32,6*32,7*32, 8*32, 9*32, 10*32, 11*32, 12*32, 13*32,14*32,15*32,16*32,17*32,18*32,19*32,20*32,21*32,22*32,23*32,24*32,25*32,26*32,27*32,28*32,29*32,30*32,31*32 }, | |
| 174 | 32*32 | |
| 175 | }; | |
| 176 | ||
| 177 | static GFXDECODE_START( cb2001 ) | |
| 178 | GFXDECODE_ENTRY( "gfx", 0, cb2001_layout, 0x0, 2 ) | |
| 179 | GFXDECODE_ENTRY( "gfx", 0, cb2001_layout32, 0x0, 2 ) | |
| 180 | GFXDECODE_END | |
| 181 | ||
| 156 | 182 | static const nec_config cb2001_config = { cb2001_decryption_table, }; |
| 157 | 183 | static MACHINE_DRIVER_START( cb2001 ) |
| 158 | 184 | MDRV_CPU_ADD("main", V30, 20000000) // CPU91A-011-0016JK004; encrypted cpu like nec v25/35 used in some irem game |
| r4135 | r4136 | |
| 161 | 187 | MDRV_CPU_IO_MAP(cb2001_io,0) |
| 162 | 188 | MDRV_CPU_VBLANK_INT("main", vblank_irq) |
| 163 | 189 | |
| 190 | MDRV_GFXDECODE(cb2001) | |
| 191 | ||
| 164 | 192 | MDRV_SCREEN_ADD("main", RASTER) |
| 165 | 193 | MDRV_SCREEN_REFRESH_RATE(60) |
| 166 | 194 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | static UINT8* mpoker_video; |
| 11 | 11 | |
| 12 | 12 | |
| 13 | VIDEO_START(mpoker) | |
| 13 | static VIDEO_START(mpoker) | |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | VIDEO_UPDATE(mpoker) | |
| 18 | static VIDEO_UPDATE(mpoker) | |
| 19 | 19 | { |
| 20 | 20 | int y,x; |
| 21 | 21 | int count; |
| r4135 | r4136 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | Todo: |
| 7 | 7 | - find NMI source, and NMI enable/disable (timer ? video hw ?) |
| 8 | ||
| 9 | Dips verified for Neratte Chu (nratechu) from manual | |
| 8 | 10 | */ |
| 9 | 11 | |
| 10 | 12 | #include "driver.h" |
| r4135 | r4136 | |
| 191 | 193 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused ? */ |
| 192 | 194 | |
| 193 | 195 | PORT_START("DSW1") |
| 194 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 196 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1") | |
| 195 | 197 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 196 | 198 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 197 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 199 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2") | |
| 198 | 200 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 199 | 201 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 200 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 202 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") | |
| 201 | 203 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 202 | 204 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 203 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 205 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4") | |
| 204 | 206 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 205 | 207 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 206 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 208 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5") | |
| 207 | 209 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 208 | 210 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 209 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 211 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:6") | |
| 210 | 212 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 211 | 213 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 212 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 214 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7") | |
| 213 | 215 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 214 | 216 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 215 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 217 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") | |
| 216 | 218 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 217 | 219 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 218 | 220 | |
| 219 | 221 | PORT_START("DSW2") |
| 220 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 222 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1") | |
| 221 | 223 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 222 | 224 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 223 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 225 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2") | |
| 224 | 226 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 225 | 227 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 226 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 228 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3") | |
| 227 | 229 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 228 | 230 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 229 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 231 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:4") | |
| 230 | 232 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 231 | 233 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 232 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 234 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:5") | |
| 233 | 235 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 234 | 236 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 235 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 237 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") | |
| 236 | 238 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 237 | 239 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 238 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 240 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") | |
| 239 | 241 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 240 | 242 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 241 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 243 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8") | |
| 242 | 244 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 243 | 245 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 244 | 246 | INPUT_PORTS_END |
| r4135 | r4136 | |
| 257 | 259 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 258 | 260 | |
| 259 | 261 | PORT_MODIFY("DSW1") /* Dip switch A */ |
| 260 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 261 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) | |
| 262 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:2") | |
| 262 | 263 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 263 | 264 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 264 | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) | |
| 265 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) | |
| 265 | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW1:3") | |
| 266 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:4") | |
| 266 | 267 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 267 | 268 | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 268 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) | |
| 269 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:5,6") | |
| 269 | 270 | PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) ) |
| 270 | 271 | PORT_DIPSETTING( 0x30, DEF_STR( 1C_1C ) ) |
| 271 | 272 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) ) |
| 272 | 273 | PORT_DIPSETTING( 0x10, DEF_STR( 1C_2C ) ) |
| 273 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) | |
| 274 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:7,8") | |
| 274 | 275 | PORT_DIPSETTING( 0x80, DEF_STR( 2C_1C ) ) |
| 275 | 276 | PORT_DIPSETTING( 0xc0, DEF_STR( 1C_1C ) ) |
| 276 | 277 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) ) |
| 277 | 278 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_2C ) ) |
| 278 | 279 | |
| 279 | 280 | PORT_MODIFY("DSW2") /* Dip switch B */ |
| 280 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) | |
| 281 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") | |
| 281 | 282 | PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) ) |
| 282 | 283 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 283 | 284 | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| r4135 | r4136 | |
| 297 | 298 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 298 | 299 | |
| 299 | 300 | PORT_MODIFY("DSW1") /* Dip switch A */ |
| 300 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 301 | PORT_DIPNAME( 0x02, 0x02, "Crt Mode" ) //flip screen ? | |
| 301 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1") | |
| 302 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 303 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 304 | PORT_DIPNAME( 0x02, 0x02, "Crt Mode" ) PORT_DIPLOCATION("SW1:2") // flip screen ? | |
| 302 | 305 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 303 | 306 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 304 | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) | |
| 305 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) | |
| 307 | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW1:3") | |
| 308 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:4") | |
| 306 | 309 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 307 | 310 | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 308 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) | |
| 311 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:5,6") | |
| 309 | 312 | PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) |
| 310 | 313 | PORT_DIPSETTING( 0x30, DEF_STR( 1C_1C ) ) |
| 311 | 314 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) ) |
| 312 | 315 | PORT_DIPSETTING( 0x20, DEF_STR( 1C_2C ) ) |
| 313 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Controls ) ) | |
| 316 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Controls ) ) PORT_DIPLOCATION("SW1:7") | |
| 314 | 317 | PORT_DIPSETTING( 0x00, "Majyan Panel" ) |
| 315 | 318 | PORT_DIPSETTING( 0x40, DEF_STR( Joystick ) ) |
| 316 | 319 | |
| 317 | 320 | PORT_MODIFY("DSW2") /* Dip switch B */ |
| 318 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) | |
| 321 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") | |
| 319 | 322 | PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) ) |
| 320 | 323 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 321 | 324 | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| r4135 | r4136 | |
| 325 | 328 | static INPUT_PORTS_START( nratechu ) |
| 326 | 329 | PORT_INCLUDE( st0016 ) |
| 327 | 330 | |
| 331 | PORT_MODIFY("SYSTEM") | |
| 332 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 333 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 334 | ||
| 328 | 335 | PORT_MODIFY("DSW1") /* Dip switch A */ |
| 329 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) | |
| 336 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3") | |
| 337 | PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) ) | |
| 330 | 338 | PORT_DIPSETTING( 0x01, DEF_STR( 4C_1C ) ) |
| 331 | 339 | PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) |
| 332 | 340 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) |
| r4135 | r4136 | |
| 334 | 342 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) |
| 335 | 343 | PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) |
| 336 | 344 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) |
| 337 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) ) | |
| 345 | PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW1:4" ) | |
| 346 | PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW1:5" ) | |
| 347 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW1:6" ) | |
| 348 | PORT_DIPNAME( 0x40, 0x40, "How To Play" ) PORT_DIPLOCATION("SW1:7") | |
| 349 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 350 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) | |
| 351 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:8") | |
| 338 | 352 | PORT_DIPSETTING( 0x00, DEF_STR( English ) ) |
| 339 | 353 | PORT_DIPSETTING( 0x80, DEF_STR( Japanese ) ) |
| 340 | 354 | |
| 341 | 355 | PORT_MODIFY("DSW2") /* Dip switch B */ |
| 342 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) // speed / time.. | |
| 356 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") // speed / time.. | |
| 343 | 357 | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 344 | 358 | PORT_DIPSETTING( 0x03, DEF_STR( Normal )) |
| 345 | 359 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 346 | 360 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 347 | PORT_DIPNAME( 0x0C, 0x0C, "VS Round" ) | |
| 348 | PORT_DIPSETTING( 0x00, "1" ) | |
| 349 | PORT_DIPSETTING( 0x0C, "2" ) | |
| 350 | PORT_DIPSETTING( 0x08, "3" ) | |
| 351 | PORT_DIPSETTING( 0x04, "4" ) | |
| 352 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 361 | PORT_DIPNAME( 0x0C, 0x0c, "VS Round" ) PORT_DIPLOCATION("SW2:3,4") | |
| 362 | PORT_DIPSETTING( 0x00, "First one to win" ) | |
| 363 | PORT_DIPSETTING( 0x04, "Best 4 out of 7" ) | |
| 364 | PORT_DIPSETTING( 0x08, "Best 3 out of 5" ) | |
| 365 | PORT_DIPSETTING( 0x0C, "Best 2 out of 3" ) | |
| 366 | PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW2:5" ) | |
| 367 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:6") // Manual has this Defaulted OFF | |
| 353 | 368 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 354 | 369 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 355 | PORT_DIPNAME( 0x80, 0x80, "Test Mode" ) | |
| 356 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 370 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:7") | |
| 371 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 357 | 372 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 373 | PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW2:8") | |
| 358 | 374 | INPUT_PORTS_END |
| 359 | 375 | |
| 360 | 376 | static INPUT_PORTS_START( mayjisn2 ) |
| 361 | 377 | PORT_INCLUDE( st0016 ) |
| 362 | 378 | |
| 379 | PORT_MODIFY("SYSTEM") | |
| 380 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 381 | ||
| 363 | 382 | PORT_MODIFY("DSW1") /* Dip switch A */ |
| 364 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) | |
| 383 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3") | |
| 365 | 384 | PORT_DIPSETTING( 0x01, DEF_STR( 4C_1C ) ) |
| 366 | 385 | PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) |
| 367 | 386 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) |
| r4135 | r4136 | |
| 369 | 388 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) |
| 370 | 389 | PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) |
| 371 | 390 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) |
| 372 | PORT_DIPNAME( 0x18, 0x18, "Timer" ) | |
| 391 | PORT_DIPNAME( 0x18, 0x18, "Timer" ) PORT_DIPLOCATION("SW1:4,5") | |
| 373 | 392 | PORT_DIPSETTING( 0x00, "6:00" ) |
| 374 | 393 | PORT_DIPSETTING( 0x08, "5:00" ) |
| 375 | 394 | PORT_DIPSETTING( 0x18, "4:00" ) |
| 376 | 395 | PORT_DIPSETTING( 0x10, "3:00" ) |
| 377 | 396 | |
| 378 | 397 | PORT_MODIFY("DSW2") /* Dip switch B */ |
| 379 | PORT_DIPNAME( 0x18, 0x18, "Music in Game" ) | |
| 398 | PORT_DIPNAME( 0x18, 0x18, "Music in Game" ) PORT_DIPLOCATION("SW2:4,5") | |
| 380 | 399 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 381 | 400 | PORT_DIPSETTING( 0x08, "Remixed" ) |
| 382 | 401 | PORT_DIPSETTING( 0x18, "Only Intro" ) |
| 383 | 402 | PORT_DIPSETTING( 0x10, "Classic" ) |
| 384 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) | |
| 403 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:6") | |
| 385 | 404 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 386 | 405 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 387 | PORT_DIPNAME( 0x40, 0x40, "Position of Title" ) | |
| 406 | PORT_DIPNAME( 0x40, 0x40, "Position of Title" ) PORT_DIPLOCATION("SW2:7") | |
| 388 | 407 | PORT_DIPSETTING( 0x00, "B" ) |
| 389 | 408 | PORT_DIPSETTING( 0x40, "A" ) |
| 390 | PORT_DIPNAME( 0x80, 0x80, "Test mode" ) | |
| 391 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 392 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 393 | 409 | INPUT_PORTS_END |
| 394 | 410 | |
| 395 | 411 | static GFXDECODE_START( st0016 ) |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | #include "driver.h" |
| 16 | 16 | #include "cpu/z80/z80.h" |
| 17 | #include "cpu/z80/z80daisy.h" | |
| 17 | 18 | #include "cpu/m68000/m68000.h" |
| 19 | #include "sound/ay8910.h" | |
| 20 | #include "sound/custom.h" | |
| 21 | #include "sound/dac.h" | |
| 18 | 22 | #include "video/vector.h" |
| 19 | 23 | #include "machine/6840ptm.h" |
| 20 | 24 | #include "machine/z80ctc.h" |
| 21 | 25 | #include "cchasm.h" |
| 22 | #include "sound/custom.h" | |
| 23 | #include "sound/ay8910.h" | |
| 24 | #include "cpu/z80/z80daisy.h" | |
| 25 | 26 | |
| 26 | 27 | #define CCHASM_68K_CLOCK (XTAL_8MHz) |
| 27 | 28 |
| r4135 | r4136 | |
|---|---|---|
| 40 | 40 | |
| 41 | 41 | #include "driver.h" |
| 42 | 42 | #include "cpu/z80/z80.h" |
| 43 | #include "machine/konami1.h" | |
| 44 | 43 | #include "cpu/m6809/m6809.h" |
| 44 | #include "sound/dac.h" | |
| 45 | #include "sound/sn76496.h" | |
| 45 | 46 | #include "sound/vlm5030.h" |
| 46 | #include " | |
| 47 | #include "machine/konami1.h" | |
| 47 | 48 | |
| 48 | 49 | |
| 49 | 50 | extern UINT8 *sbasketb_scroll; |
| r4135 | r4136 | |
|---|---|---|
| 1029 | 1029 | *************************************/ |
| 1030 | 1030 | |
| 1031 | 1031 | // 99 means the value is unknown |
| 1032 | static | |
| 1032 | static const UINT8 xor1_table[] = | |
| 1033 | 1033 | { |
| 1034 | 1034 | 99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99, |
| 1035 | 1035 | 99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99, |
| r4135 | r4136 | |
| 1097 | 1097 | 99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99, |
| 1098 | 1098 | }; |
| 1099 | 1099 | |
| 1100 | static | |
| 1100 | static const UINT8 xor2_table[] = | |
| 1101 | 1101 | { |
| 1102 | 1102 | 99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99, |
| 1103 | 1103 | 99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99, |
| r4135 | r4136 | |
| 1177 | 1177 | } |
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | static int kram3_permut2(int tbl_index, int idx, | |
| 1180 | static int kram3_permut2(int tbl_index, int idx, const UINT8 *xor_table) | |
| 1181 | 1181 | { |
| 1182 | 1182 | int xor = 0; |
| 1183 | 1183 |
| r4135 | r4136 | |
|---|---|---|
| 350 | 350 | if (input_code_pressed(KEYCODE_8)) return 0x0080 ^ 0xffff; |
| 351 | 351 | |
| 352 | 352 | return 0x0004 ^ 0xffff; // 0x0004 |
| 353 | ||
| 354 | // FIXME: this code is never executed | |
| 353 | 355 | switch (mame_rand(space->machine) & 3) |
| 354 | 356 | { |
| 355 | 357 | case 0: |
| r4135 | r4136 | |
|---|---|---|
| 428 | 428 | // const pen_t *pal = &gfx->colortable[gfx->color_granularity * (color % gfx->total_colors)]; |
| 429 | 429 | UINT32 palbase = (gfx->color_granularity * color) & 0x1ffff; |
| 430 | 430 | const pen_t *pal = &cps3_mame_colours[palbase]; |
| 431 | UINT8 *source_base = gfx | |
| 431 | const UINT8 *source_base = gfx_element_get_data | |
| 432 | 432 | |
| 433 | 433 | int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; |
| 434 | 434 | int sprite_screen_width = (scalex*gfx->width+0x8000)>>16; |
| r4135 | r4136 | |
| 501 | 501 | { |
| 502 | 502 | for( y=sy; y<ey; y++ ) |
| 503 | 503 | { |
| 504 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 504 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 505 | 505 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 506 | 506 | |
| 507 | 507 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 520 | 520 | { |
| 521 | 521 | for( y=sy; y<ey; y++ ) |
| 522 | 522 | { |
| 523 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 523 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 524 | 524 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 525 | 525 | |
| 526 | 526 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 540 | 540 | { |
| 541 | 541 | for( y=sy; y<ey; y++ ) |
| 542 | 542 | { |
| 543 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 543 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 544 | 544 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 545 | 545 | |
| 546 | 546 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 560 | 560 | { |
| 561 | 561 | for( y=sy; y<ey; y++ ) |
| 562 | 562 | { |
| 563 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 563 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 564 | 564 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 565 | 565 | |
| 566 | 566 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 797 | 797 | }; |
| 798 | 798 | |
| 799 | 799 | static UINT32* cps3_ss_ram; |
| 800 | static UINT8* cps3_ss_ram_dirty; | |
| 801 | static int cps3_ss_ram_is_dirty; | |
| 802 | 800 | |
| 803 | static UINT8* cps3_char_ram_dirty; | |
| 804 | static int cps3_char_ram_is_dirty; | |
| 805 | ||
| 806 | 801 | static void cps3_set_mame_colours(running_machine *machine, int colournum, UINT16 data, UINT32 fadeval ) |
| 807 | 802 | { |
| 808 | 803 | int r,g,b; |
| r4135 | r4136 | |
| 845 | 840 | static VIDEO_START(cps3) |
| 846 | 841 | { |
| 847 | 842 | cps3_ss_ram = auto_malloc(0x10000); |
| 848 | cps3_ss_ram_dirty = auto_malloc(0x400); | |
| 849 | cps3_ss_ram_is_dirty = 1; | |
| 850 | 843 | memset(cps3_ss_ram, 0x00, 0x10000); |
| 851 | memset(cps3_ss_ram_dirty, 1, 0x400); | |
| 852 | 844 | state_save_register_global_pointer(machine, cps3_ss_ram, 0x10000/4); |
| 853 | 845 | |
| 854 | 846 | cps3_char_ram = auto_malloc(0x800000); |
| 855 | cps3_char_ram_dirty = auto_malloc(0x800000/256); | |
| 856 | cps3_char_ram_is_dirty = 1; | |
| 857 | 847 | memset(cps3_char_ram, 0x00, 0x800000); |
| 858 | memset(cps3_char_ram_dirty, 1, 0x8000); | |
| 859 | 848 | state_save_register_global_pointer(machine, cps3_char_ram, 0x800000 /4); |
| 860 | 849 | |
| 861 | 850 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 862 | machine->gfx[0] = allocgfx(machine, &cps3_tiles8x8_layout); | |
| 863 | machine->gfx[0]->total_colors = machine->config->total_colors / 16; | |
| 851 | machine->gfx[0] = gfx_element_alloc(machine, &cps3_tiles8x8_layout, (UINT8 *)cps3_ss_ram, machine->config->total_colors / 16, 0); | |
| 864 | 852 | |
| 865 | 853 | //decode_ssram(); |
| 866 | 854 | |
| 867 | 855 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 868 | machine->gfx[1] = allocgfx(machine, &cps3_tiles16x16_layout); | |
| 869 | machine->gfx[1]->total_colors = machine->config->total_colors / 64; | |
| 870 | machine->gfx[1]->color_granularity=64; | |
| 856 | machine->gfx[1] = gfx_element_alloc(machine, &cps3_tiles16x16_layout, (UINT8 *)cps3_char_ram, machine->config->total_colors / 64, 0); | |
| 857 | machine->gfx[1]->color_granularity = 64; | |
| 871 | 858 | |
| 872 | 859 | //decode_charram(); |
| 873 | 860 | |
| r4135 | r4136 | |
| 968 | 955 | if (!bpp) machine->gfx[1]->color_granularity=256; |
| 969 | 956 | else machine->gfx[1]->color_granularity=64; |
| 970 | 957 | |
| 971 | if (cps3_char_ram_dirty[tileno]) | |
| 972 | { | |
| 973 | decodechar(machine->gfx[1], tileno, (UINT8*)cps3_char_ram); | |
| 974 | cps3_char_ram_dirty[tileno] = 0; | |
| 975 | } | |
| 976 | 958 | cps3_drawgfxzoom(machine, bitmap, machine->gfx[1],tileno,colour,xflip,yflip,(x*16)-scrollx%16,drawline-tilesubline,&clip,CPS3_TRANSPARENCY_PEN_INDEX,0, 0x10000, 0x10000, NULL, 0); |
| 977 | ||
| 978 | 959 | } |
| 979 | 960 | } |
| 980 | 961 | } |
| r4135 | r4136 | |
| 1215 | 1196 | { |
| 1216 | 1197 | int realtileno = tileno+count; |
| 1217 | 1198 | |
| 1218 | if (cps3_char_ram_dirty[realtileno]) | |
| 1219 | { | |
| 1220 | decodechar(screen->machine->gfx[1], realtileno, (UINT8*)cps3_char_ram); | |
| 1221 | cps3_char_ram_dirty[realtileno] = 0; | |
| 1222 | } | |
| 1223 | ||
| 1224 | 1199 | if (global_alpha || alpha) |
| 1225 | 1200 | { |
| 1226 | 1201 | cps3_drawgfxzoom(screen->machine, renderbuffer_bitmap, screen->machine->gfx[1],realtileno,actualpal,0^flipx,0^flipy,current_xpos,current_ypos,&renderbuffer_clip,CPS3_TRANSPARENCY_PEN_INDEX_BLEND,0,xinc,yinc, NULL, 0); |
| r4135 | r4136 | |
| 1293 | 1268 | pal += cps3_ss_pal_base << 5; |
| 1294 | 1269 | tile+=0x200; |
| 1295 | 1270 | |
| 1296 | ||
| 1297 | if (cps3_ss_ram_dirty[tile]) | |
| 1298 | { | |
| 1299 | decodechar(screen->machine->gfx[0], tile, (UINT8*)cps3_ss_ram); | |
| 1300 | cps3_ss_ram_dirty[tile] = 0; | |
| 1301 | } | |
| 1302 | ||
| 1303 | 1271 | cps3_drawgfxzoom(screen->machine, bitmap, screen->machine->gfx[0],tile,pal,flipx,flipy,x*8,y*8,cliprect,CPS3_TRANSPARENCY_PEN,0,0x10000,0x10000,NULL,0); |
| 1304 | 1272 | count++; |
| 1305 | 1273 | } |
| r4135 | r4136 | |
| 1323 | 1291 | // we only want to endian-flip the character data, the tilemap info is fine |
| 1324 | 1292 | data = LITTLE_ENDIANIZE_INT32(data); |
| 1325 | 1293 | mem_mask = LITTLE_ENDIANIZE_INT32(mem_mask); |
| 1326 | ||
| 1327 | cps3_ss_ram_dirty[offset/16] = 1; | |
| 1328 | cps3_ss_ram_is_dirty = 1; | |
| 1294 | gfx_element_mark_dirty(space->machine->gfx[0], offset/16); | |
| 1329 | 1295 | } |
| 1330 | 1296 | |
| 1331 | 1297 | COMBINE_DATA(&cps3_ss_ram[offset]); |
| r4135 | r4136 | |
| 1419 | 1385 | mem_mask = LITTLE_ENDIANIZE_INT32(mem_mask); |
| 1420 | 1386 | data = LITTLE_ENDIANIZE_INT32(data); |
| 1421 | 1387 | COMBINE_DATA(&cps3_char_ram[fulloffset]); |
| 1422 | cps3_char_ram_dirty[fulloffset/0x40] = 1; | |
| 1423 | cps3_char_ram_is_dirty = 1; | |
| 1388 | gfx_element_mark_dirty(space->machine->gfx[1], fulloffset/0x40); | |
| 1424 | 1389 | } |
| 1425 | 1390 | |
| 1426 | 1391 | /* FLASH ROM ACCESS */ |
| r4135 | r4136 | |
| 1904 | 1869 | static int last_normal_byte = 0; |
| 1905 | 1870 | |
| 1906 | 1871 | |
| 1907 | static UINT32 process_byte( UINT8 real_byte, UINT32 destination, int max_length ) | |
| 1872 | static UINT32 process_byte( running_machine *machine, UINT8 real_byte, UINT32 destination, int max_length ) | |
| 1908 | 1873 | { |
| 1909 | 1874 | UINT8* dest = (UINT8*)cps3_char_ram; |
| 1910 | 1875 | |
| r4135 | r4136 | |
| 1924 | 1889 | while (cps3_rle_length) |
| 1925 | 1890 | { |
| 1926 | 1891 | dest[((destination+tranfercount)&0x7fffff)^3] = (last_normal_byte&0x3f); |
| 1927 | cps3_char_ram_dirty[((destination+tranfercount)&0x7fffff)/0x100] = 1; | |
| 1928 | cps3_char_ram_is_dirty = 1; | |
| 1892 | gfx_element_mark_dirty(machine->gfx[1], ((destination+tranfercount)&0x7fffff)/0x100); | |
| 1929 | 1893 | //printf("RLE WRite Byte %08x, %02x\n", destination+tranfercount, real_byte); |
| 1930 | 1894 | |
| 1931 | 1895 | tranfercount++; |
| r4135 | r4136 | |
| 1944 | 1908 | //printf("Write Normal Data\n"); |
| 1945 | 1909 | dest[(destination&0x7fffff)^3] = real_byte; |
| 1946 | 1910 | last_normal_byte = real_byte; |
| 1947 | cps3_char_ram_dirty[(destination&0x7fffff)/0x100] = 1; | |
| 1948 | cps3_char_ram_is_dirty = 1; | |
| 1911 | gfx_element_mark_dirty(machine->gfx[1], (destination&0x7fffff)/0x100); | |
| 1949 | 1912 | return 1; |
| 1950 | 1913 | } |
| 1951 | 1914 | } |
| r4135 | r4136 | |
| 1973 | 1936 | |
| 1974 | 1937 | real_byte = sourcedata[DMA_XOR((current_table_address+current_byte*2+0))]; |
| 1975 | 1938 | //if (real_byte&0x80) return; |
| 1976 | length_processed = process_byte( real_byte, real_destination, length_remaining ); | |
| 1939 | length_processed = process_byte( machine, real_byte, real_destination, length_remaining ); | |
| 1977 | 1940 | length_remaining-=length_processed; // subtract the number of bytes the operation has taken |
| 1978 | 1941 | real_destination+=length_processed; // add it onto the destination |
| 1979 | 1942 | if (real_destination>0x7fffff) return; |
| r4135 | r4136 | |
| 1981 | 1944 | |
| 1982 | 1945 | real_byte = sourcedata[DMA_XOR((current_table_address+current_byte*2+1))]; |
| 1983 | 1946 | //if (real_byte&0x80) return; |
| 1984 | length_processed = process_byte( real_byte, real_destination, length_remaining ); | |
| 1947 | length_processed = process_byte( machine, real_byte, real_destination, length_remaining ); | |
| 1985 | 1948 | length_remaining-=length_processed; // subtract the number of bytes the operation has taken |
| 1986 | 1949 | real_destination+=length_processed; // add it onto the destination |
| 1987 | 1950 | if (real_destination>0x7fffff) return; |
| r4135 | r4136 | |
| 1990 | 1953 | else |
| 1991 | 1954 | { |
| 1992 | 1955 | UINT32 length_processed; |
| 1993 | length_processed = process_byte( current_byte, real_destination, length_remaining ); | |
| 1956 | length_processed = process_byte( machine, current_byte, real_destination, length_remaining ); | |
| 1994 | 1957 | length_remaining-=length_processed; // subtract the number of bytes the operation has taken |
| 1995 | 1958 | real_destination+=length_processed; // add it onto the destination |
| 1996 | 1959 | if (real_destination>0x7fffff) return; |
| r4135 | r4136 | |
| 2003 | 1966 | |
| 2004 | 1967 | static unsigned short lastb; |
| 2005 | 1968 | static unsigned short lastb2; |
| 2006 | static UINT32 ProcessByte8(UINT8 b,UINT32 dst_offset) | |
| 1969 | static UINT32 ProcessByte8(running_machine *machine,UINT8 b,UINT32 dst_offset) | |
| 2007 | 1970 | { |
| 2008 | 1971 | UINT8* destRAM = (UINT8*)cps3_char_ram; |
| 2009 | 1972 | int l=0; |
| r4135 | r4136 | |
| 2016 | 1979 | for(i=0;i<rle;++i) |
| 2017 | 1980 | { |
| 2018 | 1981 | destRAM[(dst_offset&0x7fffff)^3] = lastb; |
| 2019 | cps3_char_ram_dirty[(dst_offset&0x7fffff)/0x100] = 1; | |
| 2020 | cps3_char_ram_is_dirty = 1; | |
| 1982 | gfx_element_mark_dirty(machine->gfx[1], (dst_offset&0x7fffff)/0x100); | |
| 2021 | 1983 | |
| 2022 | 1984 | dst_offset++; |
| 2023 | 1985 | ++l; |
| r4135 | r4136 | |
| 2031 | 1993 | lastb2=lastb; |
| 2032 | 1994 | lastb=b; |
| 2033 | 1995 | destRAM[(dst_offset&0x7fffff)^3] = b; |
| 2034 | cps3_char_ram_dirty[(dst_offset&0x7fffff)/0x100] = 1; | |
| 2035 | cps3_char_ram_is_dirty = 1; | |
| 1996 | gfx_element_mark_dirty(machine->gfx[1], (dst_offset&0x7fffff)/0x100); | |
| 2036 | 1997 | return 1; |
| 2037 | 1998 | } |
| 2038 | 1999 | } |
| r4135 | r4136 | |
| 2061 | 2022 | UINT8 real_byte; |
| 2062 | 2023 | p&=0x7f; |
| 2063 | 2024 | real_byte = px[DMA_XOR((current_table_address+p*2+0))]; |
| 2064 | ds+=ProcessByte8(real_byte,ds); | |
| 2025 | ds+=ProcessByte8(machine,real_byte,ds); | |
| 2065 | 2026 | real_byte = px[DMA_XOR((current_table_address+p*2+1))]; |
| 2066 | ds+=ProcessByte8(real_byte,ds); | |
| 2027 | ds+=ProcessByte8(machine,real_byte,ds); | |
| 2067 | 2028 | } |
| 2068 | 2029 | else |
| 2069 | 2030 | { |
| 2070 | ds+=ProcessByte8(p,ds); | |
| 2031 | ds+=ProcessByte8(machine,p,ds); | |
| 2071 | 2032 | } |
| 2072 | 2033 | ++src; |
| 2073 | 2034 | ctrl<<=1; |
| r0 | r4136 | |
|---|---|---|
| 1 | /* | |
| 2 | ||
| 3 | 3 Super 8 | |
| 4 | ||
| 5 | this dump is bad | |
| 6 | ||
| 7 | ||
| 8 | Produttore ?Italy? | |
| 9 | N.revisione | |
| 10 | CPU | |
| 11 | ||
| 12 | 1x 24mhz osc | |
| 13 | 2x fpga | |
| 14 | 1x z840006 | |
| 15 | 1x PIC16c65a-20/p | |
| 16 | 1x 6295 oki | |
| 17 | ||
| 18 | ROMs | |
| 19 | ||
| 20 | Note | |
| 21 | ||
| 22 | 4x 8 dipswitch | |
| 23 | 1x 4 dispwitch | |
| 24 | ||
| 25 | */ | |
| 26 | ||
| 27 | #include "driver.h" | |
| 28 | #include "cpu/z80/z80.h" | |
| 29 | #include "sound/okim6295.h" | |
| 30 | ||
| 31 | static VIDEO_START(3super8) | |
| 32 | { | |
| 33 | ||
| 34 | } | |
| 35 | ||
| 36 | static VIDEO_UPDATE(3super8) | |
| 37 | { | |
| 38 | return 0; | |
| 39 | } | |
| 40 | ||
| 41 | static ADDRESS_MAP_START( map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 42 | AM_RANGE(0x0000, 0x7fff) AM_ROM | |
| 43 | ADDRESS_MAP_END | |
| 44 | ||
| 45 | ||
| 46 | static INPUT_PORTS_START( 3super8 ) | |
| 47 | INPUT_PORTS_END | |
| 48 | ||
| 49 | ||
| 50 | static const gfx_layout tiles8x8_layout = | |
| 51 | { | |
| 52 | 8,8, | |
| 53 | RGN_FRAC(1,3), | |
| 54 | 6, | |
| 55 | { RGN_FRAC(2,3)+0, RGN_FRAC(2,3)+2*8, RGN_FRAC(1,3)+0, RGN_FRAC(1,3)+2*8,RGN_FRAC(0,3)+0, RGN_FRAC(0,3)+2*8 }, | |
| 56 | { 0, 1,2,3,4,5,6,7 }, | |
| 57 | { 0*8, 1*8, 4*8, 5*8, 8*8, 9*8, 12*8, 13*8,}, | |
| 58 | 16*8 | |
| 59 | }; | |
| 60 | ||
| 61 | static GFXDECODE_START( 3super8 ) | |
| 62 | GFXDECODE_ENTRY( "gfx", 0, tiles8x8_layout, 0, 16 ) | |
| 63 | GFXDECODE_END | |
| 64 | ||
| 65 | ||
| 66 | ||
| 67 | static MACHINE_DRIVER_START( 3super8 ) | |
| 68 | /* basic machine hardware */ | |
| 69 | MDRV_CPU_ADD("main", Z80,24000000/4) /* 6 MHz */ | |
| 70 | MDRV_CPU_PROGRAM_MAP(0,map) | |
| 71 | //MDRV_CPU_VBLANK_INT("main", irq0_line_hold) | |
| 72 | ||
| 73 | /* video hardware */ | |
| 74 | MDRV_SCREEN_ADD("main", RASTER) | |
| 75 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 76 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 77 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 78 | MDRV_SCREEN_SIZE(512, 256) | |
| 79 | MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-0-1) | |
| 80 | ||
| 81 | MDRV_GFXDECODE(3super8) | |
| 82 | MDRV_PALETTE_LENGTH(0x100) | |
| 83 | ||
| 84 | MDRV_VIDEO_START(3super8) | |
| 85 | MDRV_VIDEO_UPDATE(3super8) | |
| 86 | ||
| 87 | /* sound hardware */ | |
| 88 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 89 | ||
| 90 | MDRV_SOUND_ADD("oki", OKIM6295, 1056000) | |
| 91 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified | |
| 92 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 93 | MACHINE_DRIVER_END | |
| 94 | ||
| 95 | ||
| 96 | ||
| 97 | // all gfx / sound roms are bad. they're definitely meant to have different data | |
| 98 | // in each half, and maybe even be twice the size. | |
| 99 | // in all cases the first half is missing (the sample table in the samples rom for example) | |
| 100 | //1.bin 1ST AND 2ND HALF IDENTICAL | |
| 101 | //2.bin 1ST AND 2ND HALF IDENTICAL | |
| 102 | //3.bin 1ST AND 2ND HALF IDENTICAL | |
| 103 | //sound.bin 1ST AND 2ND HALF IDENTICAL | |
| 104 | ||
| 105 | ||
| 106 | ROM_START( 3super8 ) | |
| 107 | ROM_REGION( 0x20000, "main", 0 ) | |
| 108 | ROM_LOAD( "prgrom.bin", 0x00000, 0x20000, CRC(37c85dfe) SHA1(56bd2fb859b17dda1e675a385b6bcd6867ecceb0) ) | |
| 109 | ||
| 110 | ROM_REGION( 0x1000, "pic", 0 ) | |
| 111 | ROM_LOAD( "pic16c65a-20-p", 0x0000, 0x1000, NO_DUMP ) | |
| 112 | ||
| 113 | ROM_REGION( 0xc0000, "gfx", 0 ) | |
| 114 | ROM_LOAD( "1.bin", 0x00000, 0x40000, BAD_DUMP CRC(d9d3e21e) SHA1(2f3f07ca427d9f56f0ff143d15d95cbf15255e33) ) | |
| 115 | ROM_LOAD( "2.bin", 0x40000, 0x40000, BAD_DUMP CRC(fbb50ab1) SHA1(50a7ef9219c38d59117c510fe6d53fb3ba1fa456) ) | |
| 116 | ROM_LOAD( "3.bin", 0x80000, 0x40000, BAD_DUMP CRC(545aa4e6) SHA1(3348d4b692900c9e9cd4a52b20922a84e596cd35) ) | |
| 117 | ||
| 118 | ROM_REGION( 0x40000, "oki", 0 ) | |
| 119 | ROM_LOAD( "sound.bin", 0x00000, 0x40000, BAD_DUMP CRC(230b31c3) SHA1(38c107325d3a4e9781912078b1317dc9ba3e1ced) ) | |
| 120 | ROM_END | |
| 121 | ||
| 122 | GAME( 199?, 3super8, 0, 3super8, 3super8, 0, ROT0, "unknown", "3 Super 8 (Italy)", GAME_NOT_WORKING|GAME_NO_SOUND ) |
| r0 | r4136 | |
|---|---|---|
| 1 | /****************************************************************************************** | |
| 2 | ||
| 3 | PC-XT (c) 1987 IBM | |
| 4 | ||
| 5 | (Actually Arcade games running on more or less modified PC-XT HW) | |
| 6 | ||
| 7 | driver by Angelo Salese & Chris Hardy | |
| 8 | original tetriunk.c by David Haywood & Tomasz Slanina | |
| 9 | ||
| 10 | Notes: | |
| 11 | - The Korean Tetris is a blantant rip-off of the Mirrorsoft/Andromeda Software Tetris PC | |
| 12 | version; | |
| 13 | ||
| 14 | TODO: | |
| 15 | - EGA/CGA/VGA emulation uses the bare minimum for these games,there are still a lot of | |
| 16 | features that needs to be added; | |
| 17 | - Filetto: Add a proper FDC device,if you enable it will give a boot error,probably because it | |
| 18 | expects that in the floppy drive shouldn't be anything,there's currently a kludge that | |
| 19 | does the trick; | |
| 20 | - Filetto: Add sound,"buzzer" PC sound plus the UM5100 sound chip ,might be connected to the | |
| 21 | prototyping card; | |
| 22 | - Korean Tetris: Add the aforementioned "buzzer" plus identify if there's any kind of sound | |
| 23 | chip on it; | |
| 24 | ||
| 25 | ******************************************************************************************** | |
| 26 | Filetto HW notes: | |
| 27 | The PCB is a un-modified IBM-PC with a CGA adapter & a prototyping card that controls the | |
| 28 | interface between the pc and the Jamma connectors.Additionally there's also a UM5100 sound | |
| 29 | chip for the sound. | |
| 30 | PCB Part Number: S/N 90289764 NOVARXT | |
| 31 | PCB Contents: | |
| 32 | 1x UMC 8923S-UM5100 voice processor (upper board) | |
| 33 | 1x MMI PAL16L8ACN-940CRK9 (upper board) | |
| 34 | 1x AMD AMPAL16R8APC-8804DM (upper board) | |
| 35 | 1x AMD P8088-1 main processor 8.000MHz (lower board) | |
| 36 | 1x Proton PT8010AF PLCC 28.636MHz (lower board) | |
| 37 | 1x UMC 8928LP-UM8272A floppy disk controller (lower board) | |
| 38 | 1x UMC 8935CS-UM82C11 Printer Adapter Interface (lower board) | |
| 39 | 1x UMC 8936CS-UM8250B Programmable asynchronous communications element (lower board) | |
| 40 | There isn't any keyboard found connected to the pcb. | |
| 41 | ******************************************************************************************** | |
| 42 | Filetto SW notes: | |
| 43 | The software of this game can be extracted with a normal Windows program extractor. | |
| 44 | The files names are: | |
| 45 | -command.com (1) | |
| 46 | -ibmbio.com (1) | |
| 47 | -ibmdos.com (1) | |
| 48 | -ansi.sys (1) | |
| 49 | -config.sys (2) | |
| 50 | -autoexec.bat (3) | |
| 51 | -x.exe (4) | |
| 52 | (1)This is an old Italian version of MS-DOS (v3.30 18th March 1987). | |
| 53 | (2)Contains "device=ansi.sys",it's an hook-up for the graphics used by the BIOS. | |
| 54 | (3)It has an Echo off (as you can notice from the game itself) and then the loading of the | |
| 55 | main program (x.exe). | |
| 56 | (4)The main program,done in plain Basic with several Italian comments in it.The date of | |
| 57 | the main program is 9th October 1990. | |
| 58 | ||
| 59 | ******************************************************************************************/ | |
| 60 | ||
| 61 | #include "driver.h" | |
| 62 | #include "cpu/i86/i86.h" | |
| 63 | #include "video/generic.h" | |
| 64 | #include "machine/pit8253.h" | |
| 65 | #include "machine/8255ppi.h" | |
| 66 | #include "machine/8237dma.h" | |
| 67 | #include "machine/pic8259.h" | |
| 68 | #include "machine/mc146818.h" | |
| 69 | #include "sound/hc55516.h" | |
| 70 | #include "sound/beep.h" | |
| 71 | ||
| 72 | #define SET_VISIBLE_AREA(_x_,_y_) \ | |
| 73 | { \ | |
| 74 | rectangle visarea = *video_screen_get_visible_area(machine->primary_screen); \ | |
| 75 | visarea.min_x = 0; \ | |
| 76 | visarea.max_x = _x_-1; \ | |
| 77 | visarea.min_y = 0; \ | |
| 78 | visarea.max_y = _y_-1; \ | |
| 79 | video_screen_configure(machine->primary_screen, _x_, _y_, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds ); \ | |
| 80 | } \ | |
| 81 | ||
| 82 | ||
| 83 | static UINT8 *vga_vram,*work_ram; | |
| 84 | static UINT8 video_regs[0x19]; | |
| 85 | static UINT8 *vga_mode; | |
| 86 | static UINT8 hv_blank; | |
| 87 | static UINT8 *vga_bg_bank; | |
| 88 | ||
| 89 | static int bank; | |
| 90 | static int lastvalue; | |
| 91 | ||
| 92 | /*Add here Video regs defines...*/ | |
| 93 | ||
| 94 | ||
| 95 | #define RES_320x200 0 | |
| 96 | #define RES_640x200 1 | |
| 97 | ||
| 98 | static void cga_alphanumeric_tilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs,UINT8 gfx_num); | |
| 99 | ||
| 100 | static VIDEO_START( filetto ) | |
| 101 | { | |
| 102 | } | |
| 103 | ||
| 104 | static VIDEO_START( tetriskr ) | |
| 105 | { | |
| 106 | } | |
| 107 | ||
| 108 | static READ8_HANDLER( vga_hvretrace_r ) | |
| 109 | { | |
| 110 | /* | |
| 111 | Read-Only lower 8 bits,TRUSTED | |
| 112 | ---- x--- Vertical Retrace | |
| 113 | ---- ---x Horizontal Retrace | |
| 114 | */ | |
| 115 | static UINT8 res; | |
| 116 | static int h,w; | |
| 117 | res = 0; | |
| 118 | h = video_screen_get_height(space->machine->primary_screen); | |
| 119 | w = video_screen_get_width(space->machine->primary_screen); | |
| 120 | ||
| 121 | // popmessage("%d %d",h,w); | |
| 122 | ||
| 123 | if (video_screen_get_hpos(space->machine->primary_screen) > h) | |
| 124 | res|= 1; | |
| 125 | ||
| 126 | if (video_screen_get_vpos(space->machine->primary_screen) > w) | |
| 127 | res|= 8; | |
| 128 | ||
| 129 | return res; | |
| 130 | } | |
| 131 | ||
| 132 | /*Basic Graphic mode */ | |
| 133 | /*TODO: non-black colours should use the bright versions*/ | |
| 134 | static void cga_graphic_bitmap(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs) | |
| 135 | { | |
| 136 | static UINT16 x,y; | |
| 137 | static UINT32 offs; | |
| 138 | ||
| 139 | SET_VISIBLE_AREA(320,200); | |
| 140 | offs = map_offs; | |
| 141 | for(y=0;y<200;y+=2) | |
| 142 | for(x=0;x<320;x+=4) | |
| 143 | { | |
| 144 | *BITMAP_ADDR16(bitmap, y, x+0) = machine->pens[0x200+(((vga_vram[offs] & 0xc0)>>6)<<1)]; | |
| 145 | *BITMAP_ADDR16(bitmap, y, x+1) = machine->pens[0x200+(((vga_vram[offs] & 0x30)>>4)<<1)]; | |
| 146 | *BITMAP_ADDR16(bitmap, y, x+2) = machine->pens[0x200+(((vga_vram[offs] & 0x0c)>>2)<<1)]; | |
| 147 | *BITMAP_ADDR16(bitmap, y, x+3) = machine->pens[0x200+(((vga_vram[offs] & 0x03)>>0)<<1)]; | |
| 148 | offs++; | |
| 149 | } | |
| 150 | ||
| 151 | offs = 0x2000+map_offs; | |
| 152 | for(y=1;y<200;y+=2) | |
| 153 | for(x=0;x<320;x+=4) | |
| 154 | { | |
| 155 | *BITMAP_ADDR16(bitmap, y, x+0) = machine->pens[0x200+(((vga_vram[offs] & 0xc0)>>6)<<1)]; | |
| 156 | *BITMAP_ADDR16(bitmap, y, x+1) = machine->pens[0x200+(((vga_vram[offs] & 0x30)>>4)<<1)]; | |
| 157 | *BITMAP_ADDR16(bitmap, y, x+2) = machine->pens[0x200+(((vga_vram[offs] & 0x0c)>>2)<<1)]; | |
| 158 | *BITMAP_ADDR16(bitmap, y, x+3) = machine->pens[0x200+(((vga_vram[offs] & 0x03)>>0)<<1)]; | |
| 159 | offs++; | |
| 160 | } | |
| 161 | ||
| 162 | } | |
| 163 | ||
| 164 | ||
| 165 | ||
| 166 | static void cga_alphanumeric_tilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs,UINT8 gfx_num) | |
| 167 | { | |
| 168 | static UINT32 offs,x,y,max_x,max_y; | |
| 169 | ||
| 170 | /*define the visible area*/ | |
| 171 | switch(size) | |
| 172 | { | |
| 173 | case RES_320x200: | |
| 174 | SET_VISIBLE_AREA(320,200); | |
| 175 | max_x = 40; | |
| 176 | max_y = 25; | |
| 177 | break; | |
| 178 | case RES_640x200: | |
| 179 | SET_VISIBLE_AREA(640,200); | |
| 180 | max_x = 80; | |
| 181 | max_y = 25; | |
| 182 | break; | |
| 183 | } | |
| 184 | ||
| 185 | offs = map_offs; | |
| 186 | ||
| 187 | for(y=0;y<max_y;y++) | |
| 188 | for(x=0;x<max_x;x++) | |
| 189 | { | |
| 190 | int tile = vga_vram[offs] & 0xff; | |
| 191 | int color = vga_vram[offs+1] & 0xff; | |
| 192 | ||
| 193 | drawgfx(bitmap,machine->gfx[gfx_num], | |
| 194 | tile, | |
| 195 | color, | |
| 196 | 0,0, | |
| 197 | x*8,y*8, | |
| 198 | cliprect,((color & 0xf0) != 0) ? TRANSPARENCY_NONE : TRANSPARENCY_PEN,0); | |
| 199 | ||
| 200 | offs+=2; | |
| 201 | } | |
| 202 | } | |
| 203 | ||
| 204 | ||
| 205 | static VIDEO_UPDATE( filetto ) | |
| 206 | { | |
| 207 | /* xx1x xxxx Attribute bit 7. 0=blink, 1=Intesity | |
| 208 | xxx1 xxxx 640x200 mode | |
| 209 | xxxx 1xxx Enable video signal | |
| 210 | xxxx x1xx Select B/W mode | |
| 211 | xxxx xx1x Select graphics | |
| 212 | xxxx xxx1 80x25 text | |
| 213 | */ | |
| 214 | bitmap_fill(bitmap, cliprect, 0); | |
| 215 | ||
| 216 | if(vga_mode[0] & 8) | |
| 217 | { | |
| 218 | if(vga_mode[0] & 2) | |
| 219 | cga_graphic_bitmap(screen->machine,bitmap,cliprect,0,0x18000); | |
| 220 | else | |
| 221 | { | |
| 222 | switch(vga_mode[0] & 1) | |
| 223 | { | |
| 224 | case 0x00: | |
| 225 | cga_alphanumeric_tilemap(screen->machine,bitmap,cliprect,RES_320x200,0x18000,2); | |
| 226 | break; | |
| 227 | case 0x01: | |
| 228 | cga_alphanumeric_tilemap(screen->machine,bitmap,cliprect,RES_640x200,0x18000,2); | |
| 229 | break; | |
| 230 | } | |
| 231 | } | |
| 232 | } | |
| 233 | ||
| 234 | return 0; | |
| 235 | } | |
| 236 | ||
| 237 | static void vga_bitmap_layer(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) | |
| 238 | { | |
| 239 | int x,y,z; | |
| 240 | UINT8 *region = memory_region(machine, "user1"); | |
| 241 | static UINT32 cur_bank; | |
| 242 | ||
| 243 | /*TODO: might be a different descramble algorythm plus plain bg bank*/ | |
| 244 | cur_bank = (((8-vga_bg_bank[0]) & 0x1f)*0x10000); | |
| 245 | ||
| 246 | for(y=0;y<200;y+=8) | |
| 247 | { | |
| 248 | for(z=0;z<8;z++) | |
| 249 | for(x=0;x<320;x++) | |
| 250 | { | |
| 251 | *BITMAP_ADDR16(bitmap, y+z, x) = 0x200+(region[(y*320/8)+x+z*0x2000+cur_bank+8] & 0xf); | |
| 252 | } | |
| 253 | } | |
| 254 | } | |
| 255 | ||
| 256 | /*S3 Video card,VGA*/ | |
| 257 | static VIDEO_UPDATE( tetriskr ) | |
| 258 | { | |
| 259 | bitmap_fill(bitmap, cliprect, 0); | |
| 260 | ||
| 261 | if(vga_mode[0] & 8) | |
| 262 | { | |
| 263 | if(vga_mode[0] & 2) | |
| 264 | cga_graphic_bitmap(screen->machine,bitmap,cliprect,0,0x18000); | |
| 265 | else | |
| 266 | { | |
| 267 | vga_bitmap_layer(screen->machine,bitmap,cliprect); | |
| 268 | ||
| 269 | switch(vga_mode[0] & 1) | |
| 270 | { | |
| 271 | case 0x00: | |
| 272 | cga_alphanumeric_tilemap(screen->machine,bitmap,cliprect,RES_320x200,0x18000,0); | |
| 273 | break; | |
| 274 | case 0x01: | |
| 275 | cga_alphanumeric_tilemap(screen->machine,bitmap,cliprect,RES_640x200,0x18000,0); | |
| 276 | break; | |
| 277 | } | |
| 278 | } | |
| 279 | } | |
| 280 | ||
| 281 | return 0; | |
| 282 | } | |
| 283 | ||
| 284 | static READ8_HANDLER( vga_regs_r ) | |
| 285 | { | |
| 286 | logerror("(PC=%05x) Warning: VGA reg port read\n",cpu_get_pc(space->cpu)); | |
| 287 | return 0xff; | |
| 288 | } | |
| 289 | ||
| 290 | static WRITE8_HANDLER( vga_regs_w ) | |
| 291 | { | |
| 292 | static UINT8 video_index; | |
| 293 | ||
| 294 | if(offset == 0) | |
| 295 | { | |
| 296 | video_index = data; | |
| 297 | } | |
| 298 | if(offset == 1) | |
| 299 | { | |
| 300 | if(video_index <= 0x18) | |
| 301 | { | |
| 302 | video_regs[video_index] = data; | |
| 303 | //logerror("write %02x to video register [%02x]",data,video_index); | |
| 304 | } | |
| 305 | else | |
| 306 | logerror("(PC=%05x) Warning: Undefined VGA reg port write (I=%02x D=%02x)\n",cpu_get_pc(space->cpu),video_index,data); | |
| 307 | } | |
| 308 | } | |
| 309 | ||
| 310 | static WRITE8_HANDLER( vga_vram_w ) | |
| 311 | { | |
| 312 | vga_vram[offset] = data; | |
| 313 | } | |
| 314 | ||
| 315 | /*end of Video HW file*/ | |
| 316 | ||
| 317 | static struct { | |
| 318 | const device_config *pit8253; | |
| 319 | const device_config *pic8259_1; | |
| 320 | const device_config *pic8259_2; | |
| 321 | const device_config *dma8237_1; | |
| 322 | const device_config *dma8237_2; | |
| 323 | } filetto_devices; | |
| 324 | ||
| 325 | ||
| 326 | static UINT8 disk_data[2]; | |
| 327 | ||
| 328 | static READ8_HANDLER( disk_iobank_r ) | |
| 329 | { | |
| 330 | //printf("Read Prototyping card [%02x] @ PC=%05x\n",offset,cpu_get_pc(space->cpu)); | |
| 331 | //if(offset == 0) return input_port_read(space->machine, "DSW"); | |
| 332 | if(offset == 1) return input_port_read(space->machine, "IN1"); | |
| 333 | ||
| 334 | return disk_data[offset]; | |
| 335 | } | |
| 336 | ||
| 337 | static WRITE8_HANDLER( disk_iobank_w ) | |
| 338 | { | |
| 339 | /* | |
| 340 | BIOS does a single out $0310,$F0 on reset | |
| 341 | ||
| 342 | Then does 2 outs to set the bank.. | |
| 343 | ||
| 344 | X1 X2 | |
| 345 | ||
| 346 | $F0 $F2 = m0 | |
| 347 | $F1 $F2 = m1 | |
| 348 | $F0 $F3 = m2 | |
| 349 | $F1 $F3 = m3 | |
| 350 | ||
| 351 | The sequence of | |
| 352 | ||
| 353 | out $0310,X1 | |
| 354 | out $0310,X2 | |
| 355 | ||
| 356 | sets the selected rom that appears in $C0000-$CFFFF | |
| 357 | ||
| 358 | */ | |
| 359 | int newbank = 0; | |
| 360 | ||
| 361 | // printf("bank %d set to %02X\n", offset,data); | |
| 362 | ||
| 363 | if (data == 0xF0) | |
| 364 | { | |
| 365 | newbank = 0; | |
| 366 | } | |
| 367 | else | |
| 368 | { | |
| 369 | if((lastvalue == 0xF0) && (data == 0xF2)) | |
| 370 | newbank = 0; | |
| 371 | else if ((lastvalue == 0xF1) && (data == 0xF2)) | |
| 372 | newbank = 1; | |
| 373 | else if ((lastvalue == 0xF0) && (data == 0xF3)) | |
| 374 | newbank = 2; | |
| 375 | else if ((lastvalue == 0xF1) && (data == 0xF3)) | |
| 376 | newbank = 3; | |
| 377 | } | |
| 378 | ||
| 379 | // printf("newbank = %d\n", newbank); | |
| 380 | ||
| 381 | if (newbank != bank) | |
| 382 | { | |
| 383 | bank = newbank; | |
| 384 | memory_set_bankptr(space->machine, 1,memory_region(space->machine, "user1") + 0x10000 * bank ); | |
| 385 | } | |
| 386 | ||
| 387 | lastvalue = data; | |
| 388 | ||
| 389 | disk_data[offset] = data; | |
| 390 | } | |
| 391 | ||
| 392 | /********************************* | |
| 393 | Pit8253 | |
| 394 | *********************************/ | |
| 395 | ||
| 396 | static PIT8253_OUTPUT_CHANGED( pc_timer0_w ) | |
| 397 | { | |
| 398 | pic8259_set_irq_line(filetto_devices.pic8259_1, 0, state); | |
| 399 | } | |
| 400 | ||
| 401 | static const struct pit8253_config pc_pit8253_config = | |
| 402 | { | |
| 403 | { | |
| 404 | { | |
| 405 | 4772720/4, /* heartbeat IRQ */ | |
| 406 | pc_timer0_w | |
| 407 | }, { | |
| 408 | 4772720/4, /* dram refresh */ | |
| 409 | NULL | |
| 410 | }, { | |
| 411 | 4772720/4, /* pio port c pin 4, and speaker polling enough */ | |
| 412 | NULL | |
| 413 | } | |
| 414 | } | |
| 415 | }; | |
| 416 | ||
| 417 | static UINT8 port_b_data; | |
| 418 | static UINT8 wss1_data,wss2_data; | |
| 419 | ||
| 420 | static READ8_DEVICE_HANDLER( port_a_r ) | |
| 421 | { | |
| 422 | if(!(port_b_data & 0x80))//??? | |
| 423 | { | |
| 424 | /* | |
| 425 | x--- ---- Undefined (Always 0) | |
| 426 | -x-- ---- B: Floppy disk drive installed. | |
| 427 | --xx ---- Default Display Mode | |
| 428 | ---- xx-- Undefined (Always 1) | |
| 429 | ---- --x- 8087 NDP installed | |
| 430 | ---- ---x Undefined (Always 1) | |
| 431 | */ | |
| 432 | return wss1_data; | |
| 433 | } | |
| 434 | else//keyboard emulation | |
| 435 | { | |
| 436 | //cpu_set_input_line(device->machine->cpu[0],1,PULSE_LINE); | |
| 437 | return 0x00;//Keyboard is disconnected | |
| 438 | //return 0xaa;//Keyboard code | |
| 439 | } | |
| 440 | } | |
| 441 | ||
| 442 | static READ8_DEVICE_HANDLER( port_b_r ) | |
| 443 | { | |
| 444 | return port_b_data; | |
| 445 | } | |
| 446 | ||
| 447 | static READ8_DEVICE_HANDLER( port_c_r ) | |
| 448 | { | |
| 449 | return wss2_data;//??? | |
| 450 | } | |
| 451 | ||
| 452 | /*'buzzer' sound routes here*/ | |
| 453 | /* Filetto uses this for either beep and um5100 sound routing,probably there's a mux somewhere.*/ | |
| 454 | /* The Korean Tetris uses it as a regular buzzer,probably the sound is all in there...*/ | |
| 455 | static WRITE8_DEVICE_HANDLER( port_b_w ) | |
| 456 | { | |
| 457 | port_b_data = data; | |
| 458 | // hc55516_digit_w(0, data); | |
| 459 | // popmessage("%02x\n",data); | |
| 460 | // beep_set_state(0, 0); | |
| 461 | // beep_set_state(0, 1); | |
| 462 | // beep_set_frequency(0, port_b_data); | |
| 463 | } | |
| 464 | ||
| 465 | static WRITE8_DEVICE_HANDLER( wss_1_w ) | |
| 466 | { | |
| 467 | wss1_data = data; | |
| 468 | } | |
| 469 | ||
| 470 | static WRITE8_DEVICE_HANDLER( wss_2_w ) | |
| 471 | { | |
| 472 | wss2_data = data; | |
| 473 | } | |
| 474 | ||
| 475 | static WRITE8_DEVICE_HANDLER( sys_reset_w ) | |
| 476 | { | |
| 477 | cpu_set_input_line(device->machine->cpu[0],INPUT_LINE_RESET,PULSE_LINE); | |
| 478 | } | |
| 479 | ||
| 480 | ||
| 481 | static const ppi8255_interface filetto_ppi8255_intf[2] = | |
| 482 | { | |
| 483 | { | |
| 484 | port_a_r, /* Port A read */ | |
| 485 | port_b_r, /* Port B read */ | |
| 486 | port_c_r, /* Port C read */ | |
| 487 | NULL, /* Port A write */ | |
| 488 | port_b_w, /* Port B write */ | |
| 489 | NULL /* Port C write */ | |
| 490 | }, | |
| 491 | { | |
| 492 | NULL, /* Port A read */ | |
| 493 | NULL, /* Port B read */ | |
| 494 | NULL, /* Port C read */ | |
| 495 | wss_1_w, /* Port A write */ | |
| 496 | wss_2_w, /* Port B write */ | |
| 497 | sys_reset_w /* Port C write */ | |
| 498 | } | |
| 499 | }; | |
| 500 | ||
| 501 | /*Floppy Disk Controller 765 device*/ | |
| 502 | /*Currently we only emulate it at a point that the BIOS will pass the checks*/ | |
| 503 | static UINT8 status; | |
| 504 | ||
| 505 | #define FDC_BUSY 0x10 | |
| 506 | #define FDC_WRITE 0x40 | |
| 507 | #define FDC_READ 0x00 /*~0x40*/ | |
| 508 | ||
| 509 | static READ8_HANDLER( fdc765_status_r ) | |
| 510 | { | |
| 511 | static UINT8 tmp,clr_status; | |
| 512 | // popmessage("Read FDC status @ PC=%05x",cpu_get_pc(space->cpu)); | |
| 513 | tmp = status | 0x80; | |
| 514 | clr_status++; | |
| 515 | if(clr_status == 0x10) | |
| 516 | { | |
| 517 | status = 0; | |
| 518 | clr_status = 0; | |
| 519 | } | |
| 520 | return tmp; | |
| 521 | } | |
| 522 | ||
| 523 | static READ8_HANDLER( fdc765_data_r ) | |
| 524 | { | |
| 525 | status = (FDC_READ); | |
| 526 | return 0xc0; | |
| 527 | } | |
| 528 | ||
| 529 | static WRITE8_HANDLER( fdc765_data_w ) | |
| 530 | { | |
| 531 | status = (FDC_WRITE); | |
| 532 | } | |
| 533 | ||
| 534 | static UINT8 drive_data; | |
| 535 | ||
| 536 | static WRITE8_HANDLER( drive_selection_w ) | |
| 537 | { | |
| 538 | drive_data = data; | |
| 539 | /*write to this area then expects that location [43e] has the bit 7 activated*/ | |
| 540 | work_ram[0x3e] = 0x80; | |
| 541 | } | |
| 542 | ||
| 543 | /****************** | |
| 544 | DMA8237 Controller | |
| 545 | ******************/ | |
| 546 | ||
| 547 | static UINT8 dma_offset[2][4]; | |
| 548 | static UINT8 at_pages[0x10]; | |
| 549 | ||
| 550 | static DMA8237_MEM_READ( pc_dma_read_byte ) | |
| 551 | { | |
| 552 | const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 553 | offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) | |
| 554 | & 0xFF0000; | |
| 555 | ||
| 556 | return memory_read_byte(space, page_offset + offset); | |
| 557 | } | |
| 558 | ||
| 559 | ||
| 560 | static DMA8237_MEM_WRITE( pc_dma_write_byte ) | |
| 561 | { | |
| 562 | const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 563 | offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) | |
| 564 | & 0xFF0000; | |
| 565 | ||
| 566 | memory_write_byte(space, page_offset + offset, data); | |
| 567 | } | |
| 568 | ||
| 569 | static READ8_HANDLER(dma_page_select_r) | |
| 570 | { | |
| 571 | UINT8 data = at_pages[offset % 0x10]; | |
| 572 | ||
| 573 | switch(offset % 8) { | |
| 574 | case 1: | |
| 575 | data = dma_offset[(offset / 8) & 1][2]; | |
| 576 | break; | |
| 577 | case 2: | |
| 578 | data = dma_offset[(offset / 8) & 1][3]; | |
| 579 | break; | |
| 580 | case 3: | |
| 581 | data = dma_offset[(offset / 8) & 1][1]; | |
| 582 | break; | |
| 583 | case 7: | |
| 584 | data = dma_offset[(offset / 8) & 1][0]; | |
| 585 | break; | |
| 586 | } | |
| 587 | return data; | |
| 588 | } | |
| 589 | ||
| 590 | ||
| 591 | static WRITE8_HANDLER(dma_page_select_w) | |
| 592 | { | |
| 593 | at_pages[offset % 0x10] = data; | |
| 594 | ||
| 595 | switch(offset % 8) { | |
| 596 | case 1: | |
| 597 | dma_offset[(offset / 8) & 1][2] = data; | |
| 598 | break; | |
| 599 | case 2: | |
| 600 | dma_offset[(offset / 8) & 1][3] = data; | |
| 601 | break; | |
| 602 | case 3: | |
| 603 | dma_offset[(offset / 8) & 1][1] = data; | |
| 604 | break; | |
| 605 | case 7: | |
| 606 | dma_offset[(offset / 8) & 1][0] = data; | |
| 607 | break; | |
| 608 | } | |
| 609 | } | |
| 610 | ||
| 611 | ||
| 612 | static const struct dma8237_interface dma8237_1_config = | |
| 613 | { | |
| 614 | "main", | |
| 615 | 1.0e-6, // 1us | |
| 616 | ||
| 617 | pc_dma_read_byte, | |
| 618 | pc_dma_write_byte, | |
| 619 | ||
| 620 | { 0, 0, NULL, NULL }, | |
| 621 | { 0, 0, NULL, NULL }, | |
| 622 | NULL | |
| 623 | }; | |
| 624 | ||
| 625 | /****************** | |
| 626 | 8259 IRQ controller | |
| 627 | ******************/ | |
| 628 | ||
| 629 | static PIC8259_SET_INT_LINE( pic8259_1_set_int_line ) { | |
| 630 | cpu_set_input_line(device->machine->cpu[0], 0, interrupt ? HOLD_LINE : CLEAR_LINE); | |
| 631 | } | |
| 632 | ||
| 633 | static const struct pic8259_interface pic8259_1_config = { | |
| 634 | pic8259_1_set_int_line | |
| 635 | }; | |
| 636 | ||
| 637 | static PIC8259_SET_INT_LINE( pic8259_2_set_int_line ) { | |
| 638 | pic8259_set_irq_line( filetto_devices.pic8259_1, 2, interrupt); | |
| 639 | } | |
| 640 | ||
| 641 | static const struct pic8259_interface pic8259_2_config = { | |
| 642 | pic8259_2_set_int_line | |
| 643 | }; | |
| 644 | ||
| 645 | static IRQ_CALLBACK(irq_callback) | |
| 646 | { | |
| 647 | int r = 0; | |
| 648 | r = pic8259_acknowledge(filetto_devices.pic8259_2); | |
| 649 | if (r==0) | |
| 650 | { | |
| 651 | r = pic8259_acknowledge(filetto_devices.pic8259_1); | |
| 652 | } | |
| 653 | return r; | |
| 654 | } | |
| 655 | ||
| 656 | static ADDRESS_MAP_START( filetto_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 657 | AM_RANGE(0x00000, 0x003ff) AM_RAM //irq vectors | |
| 658 | AM_RANGE(0x00400, 0x007ff) AM_RAM AM_BASE(&work_ram) | |
| 659 | AM_RANGE(0x00800, 0x9ffff) AM_RAM //work RAM 640KB | |
| 660 | AM_RANGE(0xa0000, 0xbffff) AM_RAM_WRITE(vga_vram_w) AM_BASE(&vga_vram)//VGA RAM | |
| 661 | AM_RANGE(0xc0000, 0xcffff) AM_READ(SMH_BANK1) | |
| 662 | AM_RANGE(0xf0000, 0xfffff) AM_ROM | |
| 663 | ADDRESS_MAP_END | |
| 664 | ||
| 665 | static ADDRESS_MAP_START( filetto_io, ADDRESS_SPACE_IO, 8 ) | |
| 666 | ADDRESS_MAP_GLOBAL_MASK(0x3ff) | |
| 667 | AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237_1", dma8237_r, dma8237_w ) //8237 DMA Controller | |
| 668 | AM_RANGE(0x0020, 0x002f) AM_DEVREADWRITE(PIC8259, "pic8259_1", pic8259_r, pic8259_w ) //8259 Interrupt control | |
| 669 | AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pit8253_r, pit8253_w) //8253 PIT | |
| 670 | AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) //PPI 8255 | |
| 671 | AM_RANGE(0x0064, 0x0066) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) //PPI 8255 | |
| 672 | AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port_r,mc146818_port_w) | |
| 673 | AM_RANGE(0x0080, 0x0087) AM_READWRITE(dma_page_select_r,dma_page_select_w) | |
| 674 | AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE(PIC8259, "pic8259_2", pic8259_r, pic8259_w ) | |
| 675 | // AM_RANGE(0x0200, 0x020f) AM_RAM //game port | |
| 676 | AM_RANGE(0x0201, 0x0201) AM_READ_PORT("COIN") //game port | |
| 677 | AM_RANGE(0x0278, 0x027f) AM_RAM //printer (parallel) port latch | |
| 678 | AM_RANGE(0x02f8, 0x02ff) AM_RAM //Modem port | |
| 679 | AM_RANGE(0x0310, 0x0311) AM_READWRITE(disk_iobank_r,disk_iobank_w) //Prototyping card | |
| 680 | AM_RANGE(0x0312, 0x0312) AM_READ_PORT("IN0") //Prototyping card,read only | |
| 681 | AM_RANGE(0x0378, 0x037f) AM_RAM //printer (parallel) port | |
| 682 | AM_RANGE(0x03bc, 0x03bf) AM_RAM //printer port | |
| 683 | AM_RANGE(0x03b4, 0x03b5) AM_READWRITE(vga_regs_r,vga_regs_w) //various VGA/CGA/EGA regs | |
| 684 | AM_RANGE(0x03d4, 0x03d5) AM_READWRITE(vga_regs_r,vga_regs_w) //mirror of above | |
| 685 | AM_RANGE(0x03d8, 0x03d9) AM_RAM AM_BASE(&vga_mode) | |
| 686 | AM_RANGE(0x03ba, 0x03bb) AM_READ(vga_hvretrace_r)//Controls H-Blank/V-Blank | |
| 687 | AM_RANGE(0x03da, 0x03db) AM_READ(vga_hvretrace_r)//mirror of above | |
| 688 | AM_RANGE(0x03f2, 0x03f2) AM_WRITE(drive_selection_w) | |
| 689 | AM_RANGE(0x03f4, 0x03f4) AM_READ(fdc765_status_r) //765 Floppy Disk Controller (FDC) Status | |
| 690 | AM_RANGE(0x03f5, 0x03f5) AM_READWRITE(fdc765_data_r,fdc765_data_w)//FDC Data | |
| 691 | AM_RANGE(0x03f8, 0x03ff) AM_RAM //rs232c (serial) port | |
| 692 | ADDRESS_MAP_END | |
| 693 | ||
| 694 | static ADDRESS_MAP_START( tetriskr_io, ADDRESS_SPACE_IO, 8 ) | |
| 695 | ADDRESS_MAP_GLOBAL_MASK(0x3ff) | |
| 696 | AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237_1", dma8237_r, dma8237_w ) //8237 DMA Controller | |
| 697 | AM_RANGE(0x0020, 0x002f) AM_DEVREADWRITE(PIC8259, "pic8259_1", pic8259_r, pic8259_w ) //8259 Interrupt control | |
| 698 | AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pit8253_r, pit8253_w) //8253 PIT | |
| 699 | AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) //PPI 8255 | |
| 700 | AM_RANGE(0x0064, 0x0066) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) //PPI 8255 | |
| 701 | AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port_r,mc146818_port_w) | |
| 702 | AM_RANGE(0x0080, 0x0087) AM_READWRITE(dma_page_select_r,dma_page_select_w) | |
| 703 | AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE(PIC8259, "pic8259_2", pic8259_r, pic8259_w ) | |
| 704 | AM_RANGE(0x0200, 0x020f) AM_RAM //game port | |
| 705 | // AM_RANGE(0x0201, 0x0201) AM_READ_PORT("IN1") //game port | |
| 706 | AM_RANGE(0x0278, 0x027f) AM_RAM //printer (parallel) port latch | |
| 707 | AM_RANGE(0x02f8, 0x02ff) AM_RAM //Modem port | |
| 708 | // AM_RANGE(0x0310, 0x0311) AM_READWRITE(disk_iobank_r,disk_iobank_w) //Prototyping card | |
| 709 | // AM_RANGE(0x0312, 0x0312) AM_READ_PORT("IN0") //Prototyping card,read only | |
| 710 | AM_RANGE(0x0378, 0x037f) AM_RAM //printer (parallel) port | |
| 711 | AM_RANGE(0x03c0, 0x03c0) AM_RAM AM_BASE(&vga_bg_bank) | |
| 712 | AM_RANGE(0x03c8, 0x03c8) AM_READ_PORT("IN0") | |
| 713 | AM_RANGE(0x03c9, 0x03c9) AM_READ_PORT("IN1") | |
| 714 | // AM_RANGE(0x03ce, 0x03ce) AM_READ_PORT("IN1") | |
| 715 | AM_RANGE(0x03bc, 0x03bf) AM_RAM //printer port | |
| 716 | AM_RANGE(0x03b4, 0x03b5) AM_READWRITE(vga_regs_r,vga_regs_w) //various VGA/CGA/EGA regs | |
| 717 | AM_RANGE(0x03d4, 0x03d5) AM_READWRITE(vga_regs_r,vga_regs_w) //mirror of above | |
| 718 | AM_RANGE(0x03d8, 0x03d9) AM_RAM AM_BASE(&vga_mode) | |
| 719 | AM_RANGE(0x03ba, 0x03bb) AM_READ(vga_hvretrace_r)//Controls H-Blank/V-Blank | |
| 720 | AM_RANGE(0x03da, 0x03db) AM_READ(vga_hvretrace_r)//mirror of above | |
| 721 | AM_RANGE(0x03f2, 0x03f2) AM_WRITE(drive_selection_w) | |
| 722 | AM_RANGE(0x03f4, 0x03f4) AM_READ(fdc765_status_r) //765 Floppy Disk Controller (FDC) Status | |
| 723 | AM_RANGE(0x03f5, 0x03f5) AM_READWRITE(fdc765_data_r,fdc765_data_w)//FDC Data | |
| 724 | AM_RANGE(0x03f8, 0x03ff) AM_RAM //rs232c (serial) port | |
| 725 | ADDRESS_MAP_END | |
| 726 | ||
| 727 | static INPUT_PORTS_START( filetto ) | |
| 728 | PORT_START("IN0") | |
| 729 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 730 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 731 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 732 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 733 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 734 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 735 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 736 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 737 | ||
| 738 | PORT_START("IN1") | |
| 739 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) ) | |
| 740 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) | |
| 741 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) ) | |
| 742 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 743 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 744 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 745 | PORT_DIPNAME( 0x04, 0x04, "Extra Play" ) | |
| 746 | PORT_DIPSETTING( 0x04, DEF_STR( No ) ) | |
| 747 | PORT_DIPSETTING( 0x00, "Play at 6th match reached" ) | |
| 748 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Difficulty ) ) | |
| 749 | PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) | |
| 750 | PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) | |
| 751 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) | |
| 752 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) | |
| 753 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 754 | ||
| 755 | PORT_START("COIN") | |
| 756 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 757 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 758 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 759 | INPUT_PORTS_END | |
| 760 | ||
| 761 | static INPUT_PORTS_START( tetriskr ) | |
| 762 | PORT_START("IN0") | |
| 763 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 764 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) //probably unused | |
| 765 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 766 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 767 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 768 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 769 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 770 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 771 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 772 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) | |
| 773 | PORT_START("IN1") //dip-switches? | |
| 774 | PORT_DIPNAME( 0x01, 0x01, "IN1" ) | |
| 775 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 776 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 777 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 778 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 779 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 780 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 781 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 782 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 783 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 784 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 785 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 786 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 787 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 788 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 789 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 790 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 791 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 792 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 793 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 794 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 795 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 796 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 797 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 798 | INPUT_PORTS_END | |
| 799 | ||
| 800 | ||
| 801 | static const gfx_layout dos_chars = | |
| 802 | { | |
| 803 | 8,16, | |
| 804 | 256, | |
| 805 | 1, | |
| 806 | { 0 }, | |
| 807 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 808 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, | |
| 809 | (0x4000)+(0*8),(0x4000)+(1*8),(0x4000)+(2*8),(0x4000)+(3*8),(0x4000)+(4*8),(0x4000)+(5*8),(0x4000)+(6*8),(0x4000)+(7*8) }, | |
| 810 | 8*8 | |
| 811 | }; | |
| 812 | ||
| 813 | static const gfx_layout dos_chars2 = | |
| 814 | { | |
| 815 | 8,8, | |
| 816 | 256, | |
| 817 | 1, | |
| 818 | { 0 }, | |
| 819 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 820 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, | |
| 821 | 8*8 | |
| 822 | }; | |
| 823 | ||
| 824 | static GFXDECODE_START( filetto ) | |
| 825 | GFXDECODE_ENTRY( "gfx1", 0x0000, dos_chars, 0, 0x100 ) | |
| 826 | GFXDECODE_ENTRY( "gfx1", 0x1000, dos_chars2, 0, 0x100 ) | |
| 827 | GFXDECODE_ENTRY( "gfx1", 0x1800, dos_chars2, 0, 0x100 ) | |
| 828 | GFXDECODE_END | |
| 829 | ||
| 830 | static GFXDECODE_START( tetriskr ) | |
| 831 | GFXDECODE_ENTRY( "gfx1", 0x0000, dos_chars2, 0, 0x100 ) | |
| 832 | GFXDECODE_END | |
| 833 | ||
| 834 | ||
| 835 | /* | |
| 836 | BLACK = 0 | |
| 837 | BLUE = 1 | |
| 838 | GREEN = 2 | |
| 839 | CYAN = 3 | |
| 840 | RED = 4 | |
| 841 | MAGENTA = 5 | |
| 842 | BROWN = 6 | |
| 843 | LIGHT GRAY = 7 | |
| 844 | */ | |
| 845 | ||
| 846 | static const rgb_t defcolors[]= | |
| 847 | { | |
| 848 | MAKE_RGB(0x00,0x00,0x00), | |
| 849 | MAKE_RGB(0x00,0x00,0xaa), | |
| 850 | MAKE_RGB(0x00,0xaa,0x00), | |
| 851 | MAKE_RGB(0x00,0xaa,0xaa), | |
| 852 | MAKE_RGB(0xaa,0x00,0x00), | |
| 853 | MAKE_RGB(0xaa,0x00,0xaa), | |
| 854 | MAKE_RGB(0xaa,0xaa,0x00), | |
| 855 | MAKE_RGB(0xaa,0xaa,0xaa), | |
| 856 | MAKE_RGB(0x55,0x55,0x55), | |
| 857 | MAKE_RGB(0x55,0x55,0xff), | |
| 858 | MAKE_RGB(0x55,0xff,0x55), | |
| 859 | MAKE_RGB(0x55,0xff,0xff), | |
| 860 | MAKE_RGB(0xff,0x55,0x55), | |
| 861 | MAKE_RGB(0xff,0x55,0xff), | |
| 862 | MAKE_RGB(0xff,0xff,0x55), | |
| 863 | MAKE_RGB(0xff,0xff,0xff) | |
| 864 | }; | |
| 865 | ||
| 866 | static PALETTE_INIT(filetto) | |
| 867 | { | |
| 868 | /*Note:palette colors are 6bpp... | |
| 869 | xxxx xx-- | |
| 870 | */ | |
| 871 | int ix,iy; | |
| 872 | ||
| 873 | for(ix=0;ix<0x300;ix++) | |
| 874 | palette_set_color(machine, ix,MAKE_RGB(0x00,0x00,0x00)); | |
| 875 | ||
| 876 | //regular colors | |
| 877 | for(iy=0;iy<0x10;iy++) | |
| 878 | { | |
| 879 | for(ix=0;ix<0x10;ix++) | |
| 880 | { | |
| 881 | palette_set_color(machine,(ix*2)+1+(iy*0x20),defcolors[ix]); | |
| 882 | palette_set_color(machine,(ix*2)+0+(iy*0x20),defcolors[iy]); | |
| 883 | } | |
| 884 | } | |
| 885 | ||
| 886 | //bitmap mode | |
| 887 | for(ix=0;ix<0x10;ix++) | |
| 888 | palette_set_color(machine, 0x200+ix,defcolors[ix]); | |
| 889 | //todo: 256 colors | |
| 890 | } | |
| 891 | ||
| 892 | static MACHINE_RESET( filetto ) | |
| 893 | { | |
| 894 | bank = -1; | |
| 895 | lastvalue = -1; | |
| 896 | hv_blank = 0; | |
| 897 | cpu_set_irq_callback(machine->cpu[0], irq_callback); | |
| 898 | filetto_devices.pit8253 = device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ); | |
| 899 | filetto_devices.pic8259_1 = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_1" ); | |
| 900 | filetto_devices.pic8259_2 = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_2" ); | |
| 901 | filetto_devices.dma8237_1 = device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" ); | |
| 902 | filetto_devices.dma8237_2 = device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" ); | |
| 903 | } | |
| 904 | ||
| 905 | static MACHINE_DRIVER_START( filetto ) | |
| 906 | MDRV_CPU_ADD("main", I8088, 8000000) //or regular PC-XT 14318180/3 clock? | |
| 907 | MDRV_CPU_PROGRAM_MAP(filetto_map,0) | |
| 908 | MDRV_CPU_IO_MAP(filetto_io,0) | |
| 909 | ||
| 910 | MDRV_MACHINE_RESET( filetto ) | |
| 911 | ||
| 912 | MDRV_PIT8253_ADD( "pit8253", pc_pit8253_config ) | |
| 913 | ||
| 914 | MDRV_PPI8255_ADD( "ppi8255_0", filetto_ppi8255_intf[0] ) | |
| 915 | MDRV_PPI8255_ADD( "ppi8255_1", filetto_ppi8255_intf[1] ) | |
| 916 | ||
| 917 | MDRV_DMA8237_ADD( "dma8237_1", dma8237_1_config ) | |
| 918 | ||
| 919 | MDRV_PIC8259_ADD( "pic8259_1", pic8259_1_config ) | |
| 920 | ||
| 921 | MDRV_PIC8259_ADD( "pic8259_2", pic8259_2_config ) | |
| 922 | ||
| 923 | MDRV_GFXDECODE(filetto) | |
| 924 | ||
| 925 | MDRV_SCREEN_ADD("main", RASTER) | |
| 926 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 927 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 928 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 929 | MDRV_SCREEN_SIZE(640, 480) | |
| 930 | MDRV_SCREEN_VISIBLE_AREA(0*8, 640-1, 0*8, 480-1) | |
| 931 | ||
| 932 | MDRV_PALETTE_LENGTH(0x300) | |
| 933 | ||
| 934 | MDRV_PALETTE_INIT(filetto) | |
| 935 | ||
| 936 | MDRV_VIDEO_START(filetto) | |
| 937 | MDRV_VIDEO_UPDATE(filetto) | |
| 938 | ||
| 939 | /*Sound Hardware*/ | |
| 940 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 941 | ||
| 942 | MDRV_SOUND_ADD("voice", HC55516, 8000000/4)//8923S-UM5100 is a HC55536 with ROM hook-up | |
| 943 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60) | |
| 944 | ||
| 945 | // PC "buzzer" sound | |
| 946 | MDRV_SOUND_ADD("beep", BEEP, 0) | |
| 947 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) | |
| 948 | MACHINE_DRIVER_END | |
| 949 | ||
| 950 | static MACHINE_DRIVER_START( tetriskr ) | |
| 951 | MDRV_CPU_ADD("main", I8088, 14318180/3) | |
| 952 | MDRV_CPU_PROGRAM_MAP(filetto_map,0) | |
| 953 | MDRV_CPU_IO_MAP(tetriskr_io,0) | |
| 954 | ||
| 955 | MDRV_MACHINE_RESET( filetto ) | |
| 956 | ||
| 957 | MDRV_PIT8253_ADD( "pit8253", pc_pit8253_config ) | |
| 958 | ||
| 959 | MDRV_PPI8255_ADD( "ppi8255_0", filetto_ppi8255_intf[0] ) | |
| 960 | MDRV_PPI8255_ADD( "ppi8255_1", filetto_ppi8255_intf[1] ) | |
| 961 | ||
| 962 | MDRV_DMA8237_ADD( "dma8237_1", dma8237_1_config ) | |
| 963 | ||
| 964 | MDRV_PIC8259_ADD( "pic8259_1", pic8259_1_config ) | |
| 965 | ||
| 966 | MDRV_PIC8259_ADD( "pic8259_2", pic8259_2_config ) | |
| 967 | ||
| 968 | MDRV_GFXDECODE(tetriskr) | |
| 969 | ||
| 970 | MDRV_SCREEN_ADD("main", RASTER) | |
| 971 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 972 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 973 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 974 | MDRV_SCREEN_SIZE(640, 480) | |
| 975 | MDRV_SCREEN_VISIBLE_AREA(0*8, 640-1, 0*8, 480-1) | |
| 976 | ||
| 977 | MDRV_PALETTE_LENGTH(0x300) | |
| 978 | ||
| 979 | MDRV_PALETTE_INIT(filetto) | |
| 980 | ||
| 981 | MDRV_VIDEO_START(tetriskr) | |
| 982 | MDRV_VIDEO_UPDATE(tetriskr) | |
| 983 | ||
| 984 | /*Sound Hardware*/ | |
| 985 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 986 | ||
| 987 | // PC "buzzer" sound | |
| 988 | MDRV_SOUND_ADD("beep", BEEP, 0) | |
| 989 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) | |
| 990 | MACHINE_DRIVER_END | |
| 991 | ||
| 992 | ROM_START( filetto ) | |
| 993 | ROM_REGION( 0x100000, "main", 0 ) | |
| 994 | ROM_LOAD("u49.bin", 0xfc000, 0x2000, CRC(1be6948a) SHA1(9c433f63d347c211ee4663f133e8417221bc4bf0)) | |
| 995 | ROM_RELOAD( 0xf8000, 0x2000 ) | |
| 996 | ROM_RELOAD( 0xf4000, 0x2000 ) | |
| 997 | ROM_RELOAD( 0xf0000, 0x2000 ) | |
| 998 | ROM_LOAD("u55.bin", 0xfe000, 0x2000, CRC(1e455ed7) SHA1(786d18ce0ab1af45fc538a2300853e497488f0d4) ) | |
| 999 | ROM_RELOAD( 0xfa000, 0x2000 ) | |
| 1000 | ROM_RELOAD( 0xf6000, 0x2000 ) | |
| 1001 | ROM_RELOAD( 0xf2000, 0x2000 ) | |
| 1002 | ||
| 1003 | ROM_REGION( 0x40000, "user1", 0 ) // program data | |
| 1004 | ROM_LOAD( "m0.u1", 0x00000, 0x10000, CRC(2408289d) SHA1(eafc144a557a79b58bcb48545cb9c9778e61fcd3) ) | |
| 1005 | ROM_LOAD( "m1.u2", 0x10000, 0x10000, CRC(5b623114) SHA1(0d9a14e6b7f57ce4fa09762343b610a973910f58) ) | |
| 1006 | ROM_LOAD( "m2.u3", 0x20000, 0x10000, CRC(abc64869) SHA1(564fc9d90d241a7b7776160b3fd036fb08037355) ) | |
| 1007 | ROM_LOAD( "m3.u4", 0x30000, 0x10000, CRC(0c1e8a67) SHA1(f1b9280c65fcfcb5ec481cae48eb6f52d6cdbc9d) ) | |
| 1008 | ||
| 1009 | ROM_REGION( 0x2000, "gfx1", ROMREGION_DISPOSE ) | |
| 1010 | ROM_LOAD("u67.bin", 0x0000, 0x2000, CRC(09710122) SHA1(de84bdd9245df287bbd3bb808f0c3531d13a3545) ) | |
| 1011 | ||
| 1012 | ROM_REGION( 0x40000, "user2", ROMREGION_DISPOSE ) // UM5100 sample roms? | |
| 1013 | ROM_LOAD16_BYTE("v1.u15", 0x00000, 0x20000, CRC(613ddd07) SHA1(ebda3d559315879819cb7034b5696f8e7861fe42) ) | |
| 1014 | ROM_LOAD16_BYTE("v2.u14", 0x00001, 0x20000, CRC(427e012e) SHA1(50514a6307e63078fe7444a96e39d834684db7df) ) | |
| 1015 | ROM_END | |
| 1016 | ||
| 1017 | ROM_START( tetriskr ) | |
| 1018 | ROM_REGION( 0x100000, "main", 0 ) /* code */ | |
| 1019 | ROM_LOAD( "b-10.u10", 0xf0000, 0x10000, CRC(efc2a0f6) SHA1(5f0f1e90237bee9b78184035a32055b059a91eb3) ) | |
| 1020 | ||
| 1021 | ROM_REGION( 0x10000, "gfx1",0 ) /* gfx - 1bpp font*/ | |
| 1022 | ROM_LOAD( "b-3.u36", 0x00000, 0x2000, CRC(1a636f9a) SHA1(a356cc57914d0c9b9127670b55d1f340e64b1ac9) ) | |
| 1023 | ||
| 1024 | ROM_REGION( 0x80000, "gfx2",ROMREGION_INVERT ) | |
| 1025 | ROM_LOAD( "b-1.u59", 0x00000, 0x10000, CRC(4719d986) SHA1(6e0499944b968d96fbbfa3ead6237d69c769d634)) | |
| 1026 | ROM_LOAD( "b-2.u58", 0x10000, 0x10000, CRC(599e1154) SHA1(14d99f90b4fedeab0ac24ffa9b1fd9ad0f0ba699)) | |
| 1027 | ROM_LOAD( "b-4.u54", 0x20000, 0x10000, CRC(e112c450) SHA1(dfdecfc6bd617ec520b7563b7caf44b79d498bd3)) | |
| 1028 | ROM_LOAD( "b-5.u53", 0x30000, 0x10000, CRC(050b7650) SHA1(5981dda4ed43b6e81fbe48bfba90a8775d5ecddf)) | |
| 1029 | ROM_LOAD( "b-6.u49", 0x40000, 0x10000, CRC(d596ceb0) SHA1(8c82fb638688971ef11159a6b240253e63f0949d)) | |
| 1030 | ROM_LOAD( "b-7.u48", 0x50000, 0x10000, CRC(79336b6c) SHA1(7a95875f3071bdc3ee25c0e6a5a3c00ef02dc977)) | |
| 1031 | ROM_LOAD( "b-8.u44", 0x60000, 0x10000, CRC(1f82121a) SHA1(106da0f39f1260d0761217ed0a24c1611bfd7f05)) | |
| 1032 | ROM_LOAD( "b-9.u43", 0x70000, 0x10000, CRC(4ea22349) SHA1(14dfd3dbd51f8bd6f3290293b8ea1c165e8cf7fd)) | |
| 1033 | ||
| 1034 | ROM_REGION( 0x180000, "user1", ROMREGION_ERASEFF ) | |
| 1035 | // copy for the gfx2,to be made with the DRIVER_INIT | |
| 1036 | ROM_END | |
| 1037 | ||
| 1038 | static DRIVER_INIT( filetto ) | |
| 1039 | { | |
| 1040 | //... | |
| 1041 | } | |
| 1042 | ||
| 1043 | /*Descramble the background gfx data.*/ | |
| 1044 | static DRIVER_INIT( tetriskr ) | |
| 1045 | { | |
| 1046 | int i,j,k; | |
| 1047 | int index=0; | |
| 1048 | UINT8 *region = memory_region(machine, "user1"); | |
| 1049 | UINT8 *gfx = memory_region(machine, "gfx2"); | |
| 1050 | ||
| 1051 | for(i=0;i<0x20000;i++) | |
| 1052 | { | |
| 1053 | //8 pixels/byte | |
| 1054 | for(j=0;j<8;j++) | |
| 1055 | { | |
| 1056 | int mask=(1<<(7-j)); | |
| 1057 | int pixel=0; | |
| 1058 | for(k=0;k<4;k++) | |
| 1059 | { | |
| 1060 | if(gfx[k*0x20000+i]&mask) | |
| 1061 | { | |
| 1062 | pixel|=(1<<k); | |
| 1063 | } | |
| 1064 | } | |
| 1065 | region[index++]=pixel; | |
| 1066 | } | |
| 1067 | } | |
| 1068 | } | |
| 1069 | ||
| 1070 | GAME( 1990, filetto, 0, filetto, filetto, filetto, ROT0, "Novarmatic", "Filetto (v1.05 901009)",GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS) | |
| 1071 | GAME( 1988?,tetriskr, 0, tetriskr, tetriskr, tetriskr, ROT0, "bootleg", "Tetris (bootleg of Mirrorsoft PC-XT Tetris version)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS) |
| r4135 | r4136 | |
|---|---|---|
| 189 | 189 | static UINT16 *jchan_spriteram_2; |
| 190 | 190 | static UINT16* jchan_sprregs_2; |
| 191 | 191 | |
| 192 | extern int suprnova_alt_enable_sprites; | |
| 193 | 192 | static UINT16 *mainsub_shared_ram; |
| 194 | 193 | |
| 195 | 194 | /*************************************************************************** |
| r4135 | r4136 | |
|---|---|---|
| 17 | 17 | static UINT16 * ml_unk; |
| 18 | 18 | static bitmap_t *ml_bitmap[8]; |
| 19 | 19 | #define ML_CHARS 0x2000 |
| 20 | static UINT8 dirtychar[ML_CHARS]; | |
| 21 | 20 | static int status_bit; |
| 22 | 21 | static int adpcm_pos; |
| 23 | 22 | static int adpcm_data; |
| r4135 | r4136 | |
| 35 | 34 | 32*8 |
| 36 | 35 | }; |
| 37 | 36 | |
| 38 | static void updateChars(running_machine *machine) | |
| 39 | { | |
| 40 | int i; | |
| 41 | for(i=0;i<ML_CHARS;i++) | |
| 42 | { | |
| 43 | if(dirtychar[i]) | |
| 44 | { | |
| 45 | dirtychar[i]=0; | |
| 46 | decodechar(machine->gfx[0], i,(UINT8 *) ml_tileram); | |
| 47 | } | |
| 48 | } | |
| 49 | } | |
| 50 | ||
| 51 | 37 | static WRITE16_HANDLER(ml_tileram_w) |
| 52 | 38 | { |
| 53 | 39 | COMBINE_DATA(&ml_tileram[offset]); |
| 54 | dirtyc | |
| 40 | gfx_element_mark_dirty(space->machine->gfx[0], offset>>4) | |
| 55 | 41 | } |
| 56 | 42 | |
| 57 | 43 | static READ16_HANDLER(ml_tileram_r) |
| r4135 | r4136 | |
| 200 | 186 | static VIDEO_START(mlanding) |
| 201 | 187 | { |
| 202 | 188 | int i; |
| 203 | for(i=0;i<ML_CHARS;i++) | |
| 204 | { | |
| 205 | dirtychar[i]=0; | |
| 206 | } | |
| 207 | 189 | |
| 190 | gfx_element_set_source(machine->gfx[0], (UINT8 *) ml_tileram); | |
| 191 | ||
| 208 | 192 | for (i=0;i<8;i++) |
| 209 | 193 | ml_bitmap[i] = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 210 | 194 | } |
| r4135 | r4136 | |
| 213 | 197 | { |
| 214 | 198 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); |
| 215 | 199 | |
| 216 | updateChars(screen->machine); | |
| 217 | ||
| 218 | 200 | { |
| 219 | 201 | int i,dx,dy,j,k,num; |
| 220 | 202 | for(i=0;i<0x1000;i+=4) |
| r4135 | r4136 | |
|---|---|---|
| 218 | 218 | INPUT_PORTS_END |
| 219 | 219 | |
| 220 | 220 | // stops the game hanging.. |
| 221 | CUSTOM_INPUT( nb1413m3_hackbusyflag_r ) | |
| 221 | static CUSTOM_INPUT( nb1413m3_hackbusyflag_r ) | |
| 222 | 222 | { |
| 223 | 223 | static int i = 0; |
| 224 | 224 | i ^= 1; |
| r4135 | r4136 | |
|---|---|---|
| 196 | 196 | |
| 197 | 197 | PALETTE_INIT( kyros ); |
| 198 | 198 | PALETTE_INIT( paddlem ); |
| 199 | VIDEO_START( alpha68k_common_vh ); | |
| 199 | 200 | VIDEO_START( alpha68k ); |
| 200 | 201 | VIDEO_UPDATE( kyros ); |
| 201 | 202 | VIDEO_UPDATE( sstingry ); |
| r4135 | r4136 | |
| 238 | 239 | alpha68k_flipscreen_w(0); |
| 239 | 240 | } |
| 240 | 241 | |
| 242 | static MACHINE_START( common ) | |
| 243 | { | |
| 244 | state_save_register_global(machine, trigstate); | |
| 245 | state_save_register_global(machine, deposits1); | |
| 246 | state_save_register_global(machine, deposits2); | |
| 247 | state_save_register_global(machine, credits); | |
| 248 | } | |
| 249 | ||
| 241 | 250 | /******************************************************************************/ |
| 242 | 251 | |
| 243 | 252 | static WRITE16_HANDLER( tnexspce_coin_counters_w ) |
| r4135 | r4136 | |
| 362 | 371 | //ZT |
| 363 | 372 | /******************************************************************************/ |
| 364 | 373 | |
| 374 | static unsigned coinvalue = 0; | |
| 375 | static unsigned microcontroller_data = 0; | |
| 376 | static int latch; | |
| 377 | ||
| 365 | 378 | /* Kyros, Super Stingray, Mahjong Block Jongbou */ |
| 379 | static MACHINE_START( kyros ) | |
| 380 | { | |
| 381 | state_save_register_global(machine, coinvalue); | |
| 382 | state_save_register_global(machine, microcontroller_data); | |
| 383 | state_save_register_global(machine, latch); | |
| 384 | ||
| 385 | MACHINE_START_CALL( common ); | |
| 386 | } | |
| 387 | ||
| 366 | 388 | static READ16_HANDLER( kyros_alpha_trigger_r ) |
| 367 | 389 | { |
| 368 | 390 | /* possible jump codes: |
| 369 | 391 | - Kyros : 0x22 |
| 370 | 392 | - Super Stingray : 0x21,0x22,0x23,0x24,0x34,0x37,0x3a,0x3d,0x40,0x43,0x46,0x49 |
| 371 | 393 | */ |
| 372 | static unsigned coinvalue = 0, microcontroller_data = 0; | |
| 373 | 394 | static const UINT8 coinage1[8][2]={{1,1}, {1,5}, {1,3}, {2,3}, {1,2}, {1,6}, {1,4}, {3,2}}; |
| 374 | 395 | static const UINT8 coinage2[8][2]={{1,1}, {5,1}, {3,1}, {7,1}, {2,1}, {6,1}, {4,1}, {8,1}}; |
| 375 | 396 | |
| 376 | static int latch; | |
| 377 | 397 | int source = shared_ram[offset]; |
| 378 | 398 | |
| 379 | 399 | switch (offset) { |
| r4135 | r4136 | |
| 451 | 471 | - Sky Soldiers : 0x21,0x22,0x23,0x24,0x34,0x37,0x3a,0x3d,0x40,0x43,0x46,0x49 |
| 452 | 472 | - Gold Medalist : 0x21,0x23,0x24,0x5b |
| 453 | 473 | */ |
| 454 | static unsigned coinvalue = 0, microcontroller_data = 0; | |
| 455 | 474 | static const UINT8 coinage1[8][2] = {{1,1}, {1,2}, {1,3}, {1,4}, {1,5}, {1,6}, {2,3}, {3,2}}; |
| 456 | 475 | static const UINT8 coinage2[8][2] = {{1,1}, {2,1}, {3,1}, {4,1}, {5,1}, {6,1}, {7,1}, {8,1}}; |
| 457 | 476 | |
| 458 | static int latch; | |
| 459 | 477 | int source = shared_ram[offset]; |
| 460 | 478 | |
| 461 | 479 | switch (offset) |
| r4135 | r4136 | |
| 547 | 565 | - Gang Wars : 0x21,0x23,0x24,0x54 |
| 548 | 566 | - Super Champion Baseball : 0x21,0x23,0x24 |
| 549 | 567 | */ |
| 550 | static unsigned coinvalue = 0, microcontroller_data = 0; | |
| 551 | 568 | static const UINT8 coinage1[8][2] = {{1,1}, {1,5}, {1,3}, {2,3}, {1,2}, {1,6}, {1,4}, {3,2}}; |
| 552 | 569 | static const UINT8 coinage2[8][2] = {{1,1}, {5,1}, {3,1}, {7,1}, {2,1}, {6,1}, {4,1}, {8,1}}; |
| 553 | 570 | |
| 554 | static int latch; | |
| 555 | 571 | int source = shared_ram[offset]; |
| 556 | 572 | |
| 557 | 573 | switch (offset) |
| r4135 | r4136 | |
| 1912 | 1928 | MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 4000) |
| 1913 | 1929 | //ZT |
| 1914 | 1930 | |
| 1931 | MDRV_MACHINE_START(kyros) | |
| 1915 | 1932 | MDRV_MACHINE_RESET(common) |
| 1916 | 1933 | |
| 1917 | 1934 | /* video hardware */ |
| r4135 | r4136 | |
| 1926 | 1943 | //AT |
| 1927 | 1944 | MDRV_PALETTE_INIT(kyros) |
| 1928 | 1945 | //ZT |
| 1946 | MDRV_VIDEO_START(alpha68k_common_vh) | |
| 1929 | 1947 | MDRV_VIDEO_UPDATE(sstingry) |
| 1930 | 1948 | |
| 1931 | 1949 | /* sound hardware */ |
| r4135 | r4136 | |
| 1961 | 1979 | MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 4000) |
| 1962 | 1980 | //ZT |
| 1963 | 1981 | |
| 1982 | MDRV_MACHINE_START(kyros) | |
| 1964 | 1983 | MDRV_MACHINE_RESET(common) |
| 1965 | 1984 | |
| 1966 | 1985 | /* video hardware */ |
| r4135 | r4136 | |
| 1974 | 1993 | MDRV_PALETTE_LENGTH(256 + 1) |
| 1975 | 1994 | |
| 1976 | 1995 | MDRV_PALETTE_INIT(kyros) |
| 1996 | MDRV_VIDEO_START(alpha68k_common_vh) | |
| 1977 | 1997 | MDRV_VIDEO_UPDATE(kyros) |
| 1978 | 1998 | |
| 1979 | 1999 | /* sound hardware */ |
| r4135 | r4136 | |
| 2006 | 2026 | MDRV_CPU_IO_MAP(jongbou_sound_portmap,0) |
| 2007 | 2027 | MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 160) // guess, controls sound speed |
| 2008 | 2028 | |
| 2029 | MDRV_MACHINE_START(kyros) | |
| 2009 | 2030 | MDRV_MACHINE_RESET(common) |
| 2010 | 2031 | |
| 2011 | 2032 | /* video hardware */ |
| r4135 | r4136 | |
| 2019 | 2040 | MDRV_PALETTE_LENGTH(256 + 1) |
| 2020 | 2041 | |
| 2021 | 2042 | MDRV_PALETTE_INIT(kyros) |
| 2043 | MDRV_VIDEO_START(alpha68k_common_vh) | |
| 2022 | 2044 | MDRV_VIDEO_UPDATE(kyros) |
| 2023 | 2045 | |
| 2024 | 2046 | /* sound hardware */ |
| r4135 | r4136 | |
| 2051 | 2073 | MDRV_PALETTE_LENGTH(1024) |
| 2052 | 2074 | MDRV_PALETTE_INIT(paddlem) |
| 2053 | 2075 | //ZT |
| 2076 | MDRV_VIDEO_START(alpha68k_common_vh) | |
| 2054 | 2077 | MDRV_VIDEO_UPDATE(alpha68k_I) |
| 2055 | 2078 | |
| 2056 | 2079 | /* sound hardware */ |
| r4135 | r4136 | |
| 2257 | 2280 | |
| 2258 | 2281 | MDRV_PALETTE_LENGTH(1024) |
| 2259 | 2282 | MDRV_PALETTE_INIT(paddlem) |
| 2283 | MDRV_VIDEO_START(alpha68k_common_vh) | |
| 2260 | 2284 | MDRV_VIDEO_UPDATE(alpha68k_I) |
| 2261 | 2285 | |
| 2262 | 2286 | /* sound hardware */ |
| r4135 | r4136 | |
| 3266 | 3290 | |
| 3267 | 3291 | /******************************************************************************/ |
| 3268 | 3292 | |
| 3269 | GAME( 1986, sstingry, 0, sstingry, sstingry, sstingry, ROT90, "Alpha Denshi Co.", "Super Stingray", 0 ) | |
| 3270 | GAME( 1987, kyros, 0, kyros, kyros, kyros, ROT90, "World Games Inc", "Kyros", 0 ) | |
| 3271 | GAME( 1986, kyrosj, kyros, kyros, kyros, kyros, ROT90, "Alpha Denshi Co.", "Kyros No Yakata (Japan)", 0 ) | |
| 3272 | GAME( 1987, jongbou, 0, jongbou, jongbou, jongbou, ROT90, "SNK", "Mahjong Block Jongbou (Japan)", 0 ) | |
| 3273 | GAME( 1988, paddlema, 0, alpha68k_I, paddlema, paddlema, ROT90, "SNK", "Paddle Mania", 0 ) | |
| 3274 | GAME( 1987, timesold, 0, alpha68k_II, timesold, timesold, ROT90, "[Alpha Denshi Co.] (SNK/Romstar license)", "Time Soldiers (US Rev 3)", 0 ) | |
| 3275 | GAME( 1987, timesol1, timesold, alpha68k_II, timesold, timesol1, ROT90, "[Alpha Denshi Co.] (SNK/Romstar license)", "Time Soldiers (US Rev 1)", 0 ) | |
| 3276 | GAME( 1987, btlfield, timesold, alpha68k_II, btlfield, btlfield, ROT90, "[Alpha Denshi Co.] (SNK license)", "Battle Field (Japan)", 0 ) | |
| 3277 | GAME( 1987, btlfildb, timesold, btlfildb, btlfildb, btlfildb, ROT90, "bootleg", "Battle Field (bootleg)", 0 ) | |
| 3278 | GAME( 1988, skysoldr, 0, alpha68k_II, skysoldr, skysoldr, ROT90, "[Alpha Denshi Co.] (SNK of America/Romstar license)", "Sky Soldiers (US)", 0 ) | |
| 3279 | GAME( 1988, goldmedl, 0, alpha68k_II_gm,goldmedl, goldmedl, ROT0, "SNK", "Gold Medalist", 0 ) | |
| 3280 | GAME( 1988, goldmeda, goldmedl, alpha68k_II_gm,goldmedl, goldmeda, ROT0, "SNK", "Gold Medalist (alt)", 0 ) | |
| 3293 | GAME( 1986, sstingry, 0, sstingry, sstingry, sstingry, ROT90, "Alpha Denshi Co.", "Super Stingray", GAME_SUPPORTS_SAVE ) | |
| 3294 | GAME( 1987, kyros, 0, kyros, kyros, kyros, ROT90, "World Games Inc", "Kyros", GAME_SUPPORTS_SAVE ) | |
| 3295 | GAME( 1986, kyrosj, kyros, kyros, kyros, kyros, ROT90, "Alpha Denshi Co.", "Kyros No Yakata (Japan)", GAME_SUPPORTS_SAVE ) | |
| 3296 | GAME( 1987, jongbou, 0, jongbou, jongbou, jongbou, ROT90, "SNK", "Mahjong Block Jongbou (Japan)", GAME_SUPPORTS_SAVE ) | |
| 3297 | GAME( 1988, paddlema, 0, alpha68k_I, paddlema, paddlema, ROT90, "SNK", "Paddle Mania", GAME_SUPPORTS_SAVE ) | |
| 3298 | GAME( 1987, timesold, 0, alpha68k_II, timesold, timesold, ROT90, "[Alpha Denshi Co.] (SNK/Romstar license)", "Time Soldiers (US Rev 3)", GAME_SUPPORTS_SAVE ) | |
| 3299 | GAME( 1987, timesol1, timesold, alpha68k_II, timesold, timesol1, ROT90, "[Alpha Denshi Co.] (SNK/Romstar license)", "Time Soldiers (US Rev 1)", GAME_SUPPORTS_SAVE ) | |
| 3300 | GAME( 1987, btlfield, timesold, alpha68k_II, btlfield, btlfield, ROT90, "[Alpha Denshi Co.] (SNK license)", "Battle Field (Japan)", GAME_SUPPORTS_SAVE ) | |
| 3301 | GAME( 1987, btlfildb, timesold, btlfildb, btlfildb, btlfildb, ROT90, "bootleg", "Battle Field (bootleg)", GAME_SUPPORTS_SAVE ) | |
| 3302 | GAME( 1988, skysoldr, 0, alpha68k_II, skysoldr, skysoldr, ROT90, "[Alpha Denshi Co.] (SNK of America/Romstar license)", "Sky Soldiers (US)", GAME_SUPPORTS_SAVE ) | |
| 3303 | GAME( 1988, goldmedl, 0, alpha68k_II_gm,goldmedl, goldmedl, ROT0, "SNK", "Gold Medalist", GAME_SUPPORTS_SAVE ) | |
| 3304 | GAME( 1988, goldmeda, goldmedl, alpha68k_II_gm,goldmedl, goldmeda, ROT0, "SNK", "Gold Medalist (alt)", GAME_SUPPORTS_SAVE ) | |
| 3281 | 3305 | GAME( 1988, goldmedb, goldmedl, alpha68k_II_gm,goldmedl, goldmeda, ROT0, "bootleg", "Gold Medalist (bootleg)", GAME_NOT_WORKING ) |
| 3282 | GAME( 1989, skyadvnt, 0, alpha68k_V, skyadvnt, skyadvnt, ROT90, "Alpha Denshi Co.", "Sky Adventure (World)", 0 ) | |
| 3283 | GAME( 1989, skyadvnu, skyadvnt, alpha68k_V, skyadvnu, skyadvnu, ROT90, "Alpha Denshi Co. (SNK of America license)", "Sky Adventure (US)", 0 ) | |
| 3284 | GAME( 1989, skyadvnj, skyadvnt, alpha68k_V, skyadvnt, skyadvnt, ROT90, "Alpha Denshi Co.", "Sky Adventure (Japan)", 0 ) | |
| 3285 | GAME( 1989, gangwars, 0, alpha68k_V, gangwars, gangwars, ROT0, "Alpha Denshi Co.", "Gang Wars (US)", 0 ) | |
| 3286 | GAME( 1989, gangwarb, gangwars, alpha68k_V, gangwarb, gangwarb, ROT0, "bootleg", "Gang Wars (bootleg)", 0 ) | |
| 3306 | GAME( 1989, skyadvnt, 0, alpha68k_V, skyadvnt, skyadvnt, ROT90, "Alpha Denshi Co.", "Sky Adventure (World)", GAME_SUPPORTS_SAVE ) | |
| 3307 | GAME( 1989, skyadvnu, skyadvnt, alpha68k_V, skyadvnu, skyadvnu, ROT90, "Alpha Denshi Co. (SNK of America license)", "Sky Adventure (US)", GAME_SUPPORTS_SAVE ) | |
| 3308 | GAME( 1989, skyadvnj, skyadvnt, alpha68k_V, skyadvnt, skyadvnt, ROT90, "Alpha Denshi Co.", "Sky Adventure (Japan)", GAME_SUPPORTS_SAVE ) | |
| 3309 | GAME( 1989, gangwars, 0, alpha68k_V, gangwars, gangwars, ROT0, "Alpha Denshi Co.", "Gang Wars (US)", GAME_SUPPORTS_SAVE ) | |
| 3310 | GAME( 1989, gangwarb, gangwars, alpha68k_V, gangwarb, gangwarb, ROT0, "bootleg", "Gang Wars (bootleg)", GAME_SUPPORTS_SAVE ) | |
| 3287 | 3311 | #if SBASEBAL_HACK |
| 3288 | GAME( 1989, sbasebal, 0, alpha68k_V_sb, sbasebal, sbasebal, ROT0, "Alpha Denshi Co.", "Super Champion Baseball (Japan)", | |
| 3312 | GAME( 1989, sbasebal, 0, alpha68k_V_sb, sbasebal, sbasebal, ROT0, "Alpha Denshi Co.", "Super Champion Baseball (Japan)", GAME_SUPPORTS_SAVE ) | |
| 3289 | 3313 | #else |
| 3290 | GAME( 1989, sbasebal, 0, alpha68k_V_sb, sbasebal, sbasebal, ROT0, "Alpha Denshi Co. (SNK of America license)", "Super Champion Baseball (US)", | |
| 3314 | GAME( 1989, sbasebal, 0, alpha68k_V_sb, sbasebal, sbasebal, ROT0, "Alpha Denshi Co. (SNK of America license)", "Super Champion Baseball (US)", GAME_SUPPORTS_SAVE ) | |
| 3291 | 3315 | #endif |
| 3292 | GAME( 1989, tnexspce, 0, tnexspce, tnexspce, tnexspce, ROT90, "SNK", "The Next Space", GAME_NO_COCKTAIL ) | |
| 3316 | GAME( 1989, tnexspce, 0, tnexspce, tnexspce, tnexspce, ROT90, "SNK", "The Next Space", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) |
| r4135 | r4136 | |
|---|---|---|
| 2606 | 2606 | } |
| 2607 | 2607 | |
| 2608 | 2608 | return (ddx & 0xff); |
| 2609 | break; | |
| 2610 | 2609 | case 1: |
| 2611 | 2610 | return (ddx>>8); |
| 2612 | break; | |
| 2613 | 2611 | case 2: |
| 2614 | 2612 | return (ddy & 0xff); |
| 2615 | break; | |
| 2616 | 2613 | case 3: |
| 2617 | 2614 | return (ddy>>8); |
| 2618 | break; | |
| 2619 | 2615 | default: |
| 2620 | 2616 | return 0; |
| 2621 | break; | |
| 2622 | 2617 | } |
| 2623 | 2618 | } |
| 2624 | 2619 | |
| r4135 | r4136 | |
| 2636 | 2631 | { |
| 2637 | 2632 | case 0: |
| 2638 | 2633 | return swing & 0xff; |
| 2639 | break; | |
| 2640 | 2634 | |
| 2641 | 2635 | case 1: |
| 2642 | 2636 | return (swing>>8); |
| 2643 | break; | |
| 2644 | 2637 | |
| 2645 | 2638 | case 2: |
| 2646 | 2639 | return edge & 0xff; |
| 2647 | break; | |
| 2648 | 2640 | |
| 2649 | 2641 | case 3: |
| 2650 | 2642 | return (edge>>8); |
| 2651 | break; | |
| 2652 | 2643 | |
| 2653 | 2644 | default: |
| 2654 | 2645 | return 0; |
| 2655 | break; | |
| 2656 | 2646 | } |
| 2657 | 2647 | } |
| 2658 | 2648 | |
| r4135 | r4136 | |
| 2669 | 2659 | { |
| 2670 | 2660 | case 0: |
| 2671 | 2661 | return steer & 0xff; |
| 2672 | break; | |
| 2673 | 2662 | |
| 2674 | 2663 | case 1: |
| 2675 | 2664 | return (steer>>8); |
| 2676 | break; | |
| 2677 | 2665 | |
| 2678 | 2666 | case 2: |
| 2679 | 2667 | return gas & 0xff; |
| 2680 | break; | |
| 2681 | 2668 | |
| 2682 | 2669 | case 3: |
| 2683 | 2670 | return (gas>>8); |
| 2684 | break; | |
| 2685 | 2671 | |
| 2686 | 2672 | case 4: |
| 2687 | 2673 | return brake & 0xff; |
| 2688 | break; | |
| 2689 | 2674 | |
| 2690 | 2675 | case 5: |
| 2691 | 2676 | return (brake>>8); |
| 2692 | break; | |
| 2693 | 2677 | |
| 2694 | 2678 | default: |
| 2695 | 2679 | return 0; |
| 2696 | break; | |
| 2697 | 2680 | } |
| 2698 | 2681 | } |
| 2699 | 2682 | |
| r4135 | r4136 | |
| 2710 | 2693 | { |
| 2711 | 2694 | case 0: |
| 2712 | 2695 | return x & 0xff; |
| 2713 | break; | |
| 2714 | 2696 | |
| 2715 | 2697 | case 1: |
| 2716 | 2698 | return (x>>8); |
| 2717 | break; | |
| 2718 | 2699 | |
| 2719 | 2700 | case 2: |
| 2720 | 2701 | return y & 0xff; |
| 2721 | break; | |
| 2722 | 2702 | |
| 2723 | 2703 | case 3: |
| 2724 | 2704 | return (y>>8); |
| 2725 | break; | |
| 2726 | 2705 | |
| 2727 | 2706 | case 4: |
| 2728 | 2707 | return pedal & 0xff; |
| 2729 | break; | |
| 2730 | 2708 | |
| 2731 | 2709 | case 5: |
| 2732 | 2710 | return (pedal>>8); |
| 2733 | break; | |
| 2734 | 2711 | |
| 2735 | 2712 | default: |
| 2736 | 2713 | return 0; |
| 2737 | break; | |
| 2738 | 2714 | } |
| 2739 | 2715 | } |
| 2740 | 2716 |
| r4135 | r4136 | |
|---|---|---|
| 518 | 518 | { |
| 519 | 519 | switch( input_selector ) |
| 520 | 520 | { |
| 521 | case 0x01: return input_port_read(space->machine, "IN0-0"); break; | |
| 522 | case 0x02: return input_port_read(space->machine, "IN0-1"); break; | |
| 523 | case 0x04: return input_port_read(space->machine, "IN0-2"); break; | |
| 524 | case 0x08: return input_port_read(space->machine, "IN0-3"); break; | |
| 525 | case 0x00: return input_port_read(space->machine, "DSW0"); break; | |
| 521 | case 0x01: return input_port_read(space->machine, "IN0-0"); | |
| 522 | case 0x02: return input_port_read(space->machine, "IN0-1"); | |
| 523 | case 0x04: return input_port_read(space->machine, "IN0-2"); | |
| 524 | case 0x08: return input_port_read(space->machine, "IN0-3"); | |
| 525 | case 0x00: return input_port_read(space->machine, "DSW0"); | |
| 526 | 526 | } |
| 527 | 527 | return 0xff; |
| 528 | 528 | } |
| r4135 | r4136 | |
|---|---|---|
| 2004 | 2004 | GAME( 1980, millpac, centiped, centipdb, centiped, 0, ROT270, "Valadon Automation", "Millpac", GAME_SUPPORTS_SAVE ) |
| 2005 | 2005 | GAME( 1980, magworm, centiped, magworm, magworm, magworm, ROT270, "bootleg", "Magic Worm (bootleg)", GAME_SUPPORTS_SAVE ) |
| 2006 | 2006 | GAME( 1982, milliped, 0, milliped, milliped, 0, ROT270, "Atari", "Millipede", GAME_SUPPORTS_SAVE ) |
| 2007 | GAME( 1982, millipdd, milliped, milliped, milliped, 0, ROT270, " | |
| 2007 | GAME( 1982, millipdd, milliped, milliped, milliped, 0, ROT270, "h | |
| 2008 | 2008 | |
| 2009 | 2009 | GAME( 1980, warlords, 0, warlords, warlords, 0, ROT0, "Atari", "Warlords", GAME_SUPPORTS_SAVE ) |
| 2010 | 2010 | GAME( 1981, mazeinv, 0, mazeinv, mazeinv, 0, ROT270, "Atari", "Maze Invaders (prototype)", 0 ) |
| r4135 | r4136 | |
|---|---|---|
| 536 | 536 | { |
| 537 | 537 | offset += gdfs_gfxram_bank * 0x100000/2; |
| 538 | 538 | COMBINE_DATA(&eaglshot_gfxram[offset]); |
| 539 | ||
| 540 | eaglshot_dirty = 1; | |
| 541 | eaglshot_dirty_tile[offset / (16*8/2)] = 1; | |
| 539 | gfx_element_mark_dirty(space->machine->gfx[2], offset / (16*8/2)); | |
| 542 | 540 | } |
| 543 | 541 | |
| 544 | 542 | static READ16_HANDLER( gdfs_blitram_r ) |
| r4135 | r4136 | |
| 588 | 586 | |
| 589 | 587 | if ( (src+len <= size) && (dst+len <= 4 * 0x100000) ) |
| 590 | 588 | { |
| 591 | eaglshot_dirty = 1; | |
| 592 | ||
| 593 | 589 | memcpy( &eaglshot_gfxram[dst/2], &rom[src], len ); |
| 594 | 590 | |
| 595 | 591 | if (len % (16*8)) len = len / (16*8) + 1; |
| 596 | 592 | else len = len / (16*8); |
| 597 | 593 | |
| 598 | memset( &eaglshot_dirty_tile[dst / (16*8)], 1, len ); | |
| 594 | dst /= 16*8; | |
| 595 | while (len--) | |
| 596 | { | |
| 597 | gfx_element_mark_dirty(space->machine->gfx[2], dst); | |
| 598 | dst++; | |
| 599 | } | |
| 599 | 600 | } |
| 600 | 601 | else |
| 601 | 602 | { |
| r4135 | r4136 | |
| 1101 | 1102 | { |
| 1102 | 1103 | offset += (ssv_scroll[0x76/2] & 0xf) * 0x40000/2; |
| 1103 | 1104 | COMBINE_DATA(&eaglshot_gfxram[offset]); |
| 1104 | ||
| 1105 | eaglshot_dirty = 1; | |
| 1106 | eaglshot_dirty_tile[offset / (16*8/2)] = 1; | |
| 1105 | gfx_element_mark_dirty(space->machine->gfx[0], offset / (16*8/2)); | |
| 1106 | gfx_element_mark_dirty(space->machine->gfx[1], offset / (16*8/2)); | |
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | 1109 | |
| r4135 | r4136 | |
| 2716 | 2716 | ssv_enable_video(1); |
| 2717 | 2717 | ssv_special = 0; |
| 2718 | 2718 | interrupt_ultrax = 0; |
| 2719 | eaglshot_dirty = 0; | |
| 2720 | 2719 | } |
| 2721 | 2720 | |
| 2722 | 2721 | static void init_ssv_hypreac2(void) |
| r4135 | r4136 | |
|---|---|---|
| 37 | 37 | AM_RANGE(0x0000, 0x3fff) AM_ROM |
| 38 | 38 | ADDRESS_MAP_END |
| 39 | 39 | |
| 40 | VIDEO_START(janshi) | |
| 40 | static VIDEO_START(janshi) | |
| 41 | 41 | { |
| 42 | 42 | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | VIDEO_UPDATE(janshi) | |
| 45 | static VIDEO_UPDATE(janshi) | |
| 46 | 46 | { |
| 47 | 47 | return 0; |
| 48 | 48 | } |
| r4135 | r4136 | |
|---|---|---|
| 212 | 212 | /* SCN2674 AVDC stuff */ |
| 213 | 213 | static int mpu4_gfx_index; |
| 214 | 214 | static UINT16 * mpu4_vid_vidram; |
| 215 | static UINT8 * mpu4_vid_vidram_is_dirty; | |
| 216 | 215 | static UINT16 * mpu4_vid_mainram; |
| 217 | 216 | |
| 218 | 217 | static UINT8 scn2674_IR[16]; |
| r4135 | r4136 | |
| 452 | 451 | |
| 453 | 452 | bitmap_fill(bitmap,cliprect,0); |
| 454 | 453 | |
| 455 | for (i = 0; i < 0x1000; i++) | |
| 456 | { | |
| 457 | if (mpu4_vid_vidram_is_dirty[i]==1) | |
| 458 | { | |
| 459 | decodechar(screen->machine->gfx[mpu4_gfx_index+0], i, (UINT8 *)mpu4_vid_vidram); | |
| 460 | decodechar(screen->machine->gfx[mpu4_gfx_index+1], i, (UINT8 *)mpu4_vid_vidram); | |
| 461 | decodechar(screen->machine->gfx[mpu4_gfx_index+2], i, (UINT8 *)mpu4_vid_vidram); | |
| 462 | decodechar(screen->machine->gfx[mpu4_gfx_index+3], i, (UINT8 *)mpu4_vid_vidram); | |
| 463 | mpu4_vid_vidram_is_dirty[i]=0; | |
| 464 | } | |
| 465 | } | |
| 466 | ||
| 467 | 454 | /* this is in main ram.. i think it must transfer it out of here??? */ |
| 468 | 455 | /* count = 0x0018b6/2; - crmaze count = 0x004950/2; - turnover */ |
| 469 | 456 | |
| r4135 | r4136 | |
| 517 | 504 | { |
| 518 | 505 | COMBINE_DATA(&mpu4_vid_vidram[offset]); |
| 519 | 506 | offset <<= 1; |
| 520 | mpu4_vid_vidram_is_dirty[offset/0x20]=1; | |
| 507 | gfx_element_mark_dirty(space->machine->gfx[mpu4_gfx_index+0], offset/0x20); | |
| 508 | gfx_element_mark_dirty(space->machine->gfx[mpu4_gfx_index+1], offset/0x20); | |
| 509 | gfx_element_mark_dirty(space->machine->gfx[mpu4_gfx_index+2], offset/0x20); | |
| 510 | gfx_element_mark_dirty(space->machine->gfx[mpu4_gfx_index+3], offset/0x20); | |
| 521 | 511 | } |
| 522 | 512 | |
| 523 | 513 | |
| r4135 | r4136 | |
| 983 | 973 | maybe we will anyway, but for now we don't need to */ |
| 984 | 974 | |
| 985 | 975 | mpu4_vid_vidram = auto_malloc (0x20000); |
| 986 | mpu4_vid_vidram_is_dirty = auto_malloc(0x1000); | |
| 987 | 976 | |
| 988 | memset(mpu4_vid_vidram_is_dirty,1,0x1000); | |
| 989 | 977 | memset(mpu4_vid_vidram,0,0x20000); |
| 990 | 978 | |
| 991 | 979 | /* find first empty slot to decode gfx */ |
| r4135 | r4136 | |
| 996 | 984 | assert(mpu4_gfx_index != MAX_GFX_ELEMENTS); |
| 997 | 985 | |
| 998 | 986 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 999 | machine->gfx[mpu4_gfx_index+0] = allocgfx(machine, &mpu4_vid_char_8x8_layout); | |
| 1000 | machine->gfx[mpu4_gfx_index+1] = allocgfx(machine, &mpu4_vid_char_8x16_layout); | |
| 1001 | machine->gfx[mpu4_gfx_index+2] = allocgfx(machine, &mpu4_vid_char_16x8_layout); | |
| 1002 | machine->gfx[mpu4_gfx_index+3] = allocgfx(machine, &mpu4_vid_char_16x16_layout); | |
| 987 | machine->gfx[mpu4_gfx_index+0] = gfx_element_alloc(machine, &mpu4_vid_char_8x8_layout, (UINT8 *)mpu4_vid_vidram, machine->config->total_colors / 16, 0); | |
| 988 | machine->gfx[mpu4_gfx_index+1] = gfx_element_alloc(machine, &mpu4_vid_char_8x16_layout, (UINT8 *)mpu4_vid_vidram, machine->config->total_colors / 16, 0); | |
| 989 | machine->gfx[mpu4_gfx_index+2] = gfx_element_alloc(machine, &mpu4_vid_char_16x8_layout, (UINT8 *)mpu4_vid_vidram, machine->config->total_colors / 16, 0); | |
| 990 | machine->gfx[mpu4_gfx_index+3] = gfx_element_alloc(machine, &mpu4_vid_char_16x16_layout, (UINT8 *)mpu4_vid_vidram, machine->config->total_colors / 16, 0); | |
| 1003 | 991 | |
| 1004 | /* set the color information */ | |
| 1005 | machine->gfx[mpu4_gfx_index+0]->total_colors = machine->config->total_colors / 16; | |
| 1006 | machine->gfx[mpu4_gfx_index+1]->total_colors = machine->config->total_colors / 16; | |
| 1007 | machine->gfx[mpu4_gfx_index+2]->total_colors = machine->config->total_colors / 16; | |
| 1008 | machine->gfx[mpu4_gfx_index+3]->total_colors = machine->config->total_colors / 16; | |
| 1009 | ||
| 1010 | 992 | scn2675_IR_pointer = 0; |
| 1011 | 993 | } |
| 1012 | 994 |
| r4135 | r4136 | |
|---|---|---|
| 341 | 341 | }; |
| 342 | 342 | |
| 343 | 343 | |
| 344 | static MACHINE_START( aquarium ) | |
| 345 | { | |
| 346 | state_save_register_global(machine, aquarium_snd_ack); | |
| 347 | } | |
| 348 | ||
| 344 | 349 | static MACHINE_DRIVER_START( aquarium ) |
| 345 | 350 | |
| 346 | 351 | /* basic machine hardware */ |
| r4135 | r4136 | |
| 352 | 357 | MDRV_CPU_PROGRAM_MAP(snd_map,0) |
| 353 | 358 | MDRV_CPU_IO_MAP(snd_portmap,0) |
| 354 | 359 | |
| 360 | MDRV_MACHINE_START(aquarium) | |
| 355 | 361 | #if AQUARIUS_HACK |
| 356 | 362 | MDRV_MACHINE_RESET(aquarium) |
| 357 | 363 | #endif |
| r4135 | r4136 | |
| 414 | 420 | ROM_END |
| 415 | 421 | |
| 416 | 422 | #if !AQUARIUS_HACK |
| 417 | GAME( 1996, aquarium, 0, aquarium, aquarium, aquarium, ROT0, "Excellent System", "Aquarium (Japan)", GAME_NO_COCKTAIL ) | |
| 423 | GAME( 1996, aquarium, 0, aquarium, aquarium, aquarium, ROT0, "Excellent System", "Aquarium (Japan)", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 418 | 424 | #else |
| 419 | GAME( 1996, aquarium, 0, aquarium, aquarium, aquarium, ROT0, "Excellent System", "Aquarium", GAME_NO_COCKTAIL ) | |
| 425 | GAME( 1996, aquarium, 0, aquarium, aquarium, aquarium, ROT0, "Excellent System", "Aquarium", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL ) | |
| 420 | 426 | #endif |
| r4135 | r4136 | |
|---|---|---|
| 70 | 70 | #include "driver.h" |
| 71 | 71 | #include "cpu/m68000/m68000.h" |
| 72 | 72 | |
| 73 | VIDEO_START(gal3) | |
| 73 | static VIDEO_START(gal3) | |
| 74 | 74 | { |
| 75 | 75 | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | VIDEO_UPDATE(gal3) | |
| 78 | static VIDEO_UPDATE(gal3) | |
| 79 | 79 | { |
| 80 | 80 | return 0; |
| 81 | 81 | } |
| r4135 | r4136 | |
|---|---|---|
| 208 | 208 | game it doesn't, so maybe it wasn't really hooked up and instead |
| 209 | 209 | only one of the register (f001) is used for both part? |
| 210 | 210 | |
| 211 | ||
| 211 | ||
| 212 | 212 | the kid goes what would be offscreen, just looked kinda odd |
| 213 | 213 | |
| 214 | 214 | Interesting note, each Bank in the 0x8000 - 0xbfff appears to |
| r4135 | r4136 | |
| 598 | 598 | |
| 599 | 599 | */ |
| 600 | 600 | |
| 601 | static MACHINE_START( angelkds ) | |
| 602 | { | |
| 603 | state_save_register_global_array(machine, angelkds_sound); | |
| 604 | state_save_register_global_array(machine, angelkds_sound2); | |
| 605 | } | |
| 606 | ||
| 601 | 607 | static MACHINE_DRIVER_START( angelkds ) |
| 602 | 608 | MDRV_CPU_ADD("main", Z80, 8000000) /* 8MHz? 6 seems too slow? */ |
| 603 | 609 | MDRV_CPU_PROGRAM_MAP(main_map,0) |
| r4135 | r4136 | |
| 608 | 614 | MDRV_CPU_PROGRAM_MAP(sub_map,0) |
| 609 | 615 | MDRV_CPU_IO_MAP(sub_portmap,0) |
| 610 | 616 | |
| 617 | MDRV_MACHINE_START(angelkds) | |
| 618 | ||
| 611 | 619 | MDRV_QUANTUM_TIME(HZ(6000)) |
| 612 | 620 | |
| 613 | 621 | /* video hardware */ |
| r4135 | r4136 | |
| 740 | 748 | static DRIVER_INIT( spcpostn ) { spcpostn_decode(machine, "main"); } |
| 741 | 749 | |
| 742 | 750 | |
| 743 | GAME( 1988, angelkds, 0, angelkds, angelkds, 0, ROT90, "Sega / Nasco?", "Angel Kids (Japan)" , 0) /* Nasco not displayed but 'Exa Planning' is */ | |
| 744 | GAME( 1986, spcpostn, 0, angelkds, spcpostn, spcpostn, ROT90, "Sega / Nasco", "Space Position (Japan)" , 0) /* encrypted */ | |
| 751 | GAME( 1988, angelkds, 0, angelkds, angelkds, 0, ROT90, "Sega / Nasco?", "Angel Kids (Japan)" , GAME_SUPPORTS_SAVE) /* Nasco not displayed but 'Exa Planning' is */ | |
| 752 | GAME( 1986, spcpostn, 0, angelkds, spcpostn, spcpostn, ROT90, "Sega / Nasco", "Space Position (Japan)" , GAME_SUPPORTS_SAVE) /* encrypted */ |
| r4135 | r4136 | |
|---|---|---|
| 1804 | 1804 | |
| 1805 | 1805 | /*****************************************************************************/ |
| 1806 | 1806 | |
| 1807 | static READ8_HANDLER( soundram_r ) | |
| 1807 | static READ8_DEVICE_HANDLER( soundram_r ) | |
| 1808 | 1808 | { |
| 1809 | 1809 | if (offset >= 0 && offset < 0x200000) |
| 1810 | 1810 | { |
| r4135 | r4136 | |
| 1817 | 1817 | return 0; |
| 1818 | 1818 | } |
| 1819 | 1819 | |
| 1820 | static WRITE8_HANDLER( soundram_w ) | |
| 1820 | static WRITE8_DEVICE_HANDLER( soundram_w ) | |
| 1821 | 1821 | { |
| 1822 | 1822 | } |
| 1823 | 1823 |
| r4135 | r4136 | |
|---|---|---|
| 775 | 775 | |
| 776 | 776 | static VIDEO_START( ss23 ) |
| 777 | 777 | { |
| 778 | gfx_element_set_source(machine->gfx[0], (UINT8 *)namcos23_charram); | |
| 778 | 779 | bgtilemap = tilemap_create(machine, TextTilemapGetInfo, tilemap_scan_rows, 16, 16, 64, 64); |
| 779 | 780 | tilemap_set_transparent_pen(bgtilemap, 0xf); |
| 780 | 781 | } |
| r4135 | r4136 | |
| 936 | 937 | |
| 937 | 938 | static WRITE32_HANDLER( s23_txtchar_w ) |
| 938 | 939 | { |
| 939 | COMBINE_DATA(&namcos23_charram[offset] ); | |
| 940 | ||
| 941 | decodechar( space->machine->gfx[0],offset/32,(UINT8 *)namcos23_charram ); | |
| 942 | ||
| 943 | tilemap_mark_all_tiles_dirty(bgtilemap); | |
| 940 | COMBINE_DATA(&namcos23_charram[offset]); | |
| 941 | gfx_element_mark_dirty(space->machine->gfx[0], offset/32); | |
| 944 | 942 | } |
| 945 | 943 | |
| 946 | 944 | static READ32_HANDLER( ss23_vstat_r ) |
| r4135 | r4136 | |
| 1152 | 1150 | ret = make_bcd(systime.local_time.hour); // hour (BCD, 0-23) |
| 1153 | 1151 | break; |
| 1154 | 1152 | case 3: |
| 1155 | ret = make_bcd(weekday[systime.local_time.weekday]); // day of the week (1 = Monday, 7 = Sunday) | |
| 1153 | ret = make_bcd(weekday[systime.local_time.weekday]); // low nibble = day of the week | |
| 1154 | ret |= (make_bcd(systime.local_time.mday) & 0x0f)<<4; // high nibble = low digit of day | |
| 1156 | 1155 | break; |
| 1157 | 1156 | case 4: |
| 1158 | ret = make_bcd(systime.local_time.mday); // day (BCD, 1-31) | |
| 1157 | ret = (make_bcd(systime.local_time.mday) >> 4); // low nibble = high digit of day | |
| 1158 | ret |= (make_bcd(systime.local_time.month + 1) & 0x0f)<<4; // high nibble = low digit of month | |
| 1159 | 1159 | break; |
| 1160 | 1160 | case 5: |
| 1161 | ret = make_bcd(systime.local_time.month + 1); // month (BCD, 1-12) | |
| 1161 | ret = make_bcd(systime.local_time.month + 1) >> 4; // low nibble = high digit of month | |
| 1162 | ret |= (make_bcd(systime.local_time.year % 10) << 4); // high nibble = low digit of year | |
| 1162 | 1163 | break; |
| 1163 | 1164 | case 6: |
| 1164 | ret = make_bcd(systime.local_time.year % 100); // year (BCD, 0- | |
| 1165 | ret = make_bcd(systime.local_time.year % 100) >> 4; // low nibble = tens digit of year (BCD, 0- | |
| 1165 | 1166 | break; |
| 1166 | 1167 | } |
| 1167 | 1168 |
| r4135 | r4136 | |
|---|---|---|
| 47 | 47 | #include "driver.h" |
| 48 | 48 | #include "cpu/m68000/m68000.h" |
| 49 | 49 | #include "sound/custom.h" |
| 50 | #include "sound/cdda.h" | |
| 50 | 51 | #include "includes/amiga.h" |
| 51 | 52 | #include "includes/cubocd32.h" |
| 52 | 53 | #include "machine/6526cia.h" |
| r4135 | r4136 | |
|---|---|---|
| 195 | 195 | WRITE8_HANDLER( cvs_s2636_0_or_character_ram_w ) |
| 196 | 196 | { |
| 197 | 197 | if (cpu_get_reg(space->cpu, S2650_FO)) |
| 198 | cvs_character_ram[(0 * 0x800) | 0x400 | character_ram_page_start | offset] = data; | |
| 198 | { | |
| 199 | offset |= (0 * 0x800) | 0x400 | character_ram_page_start; | |
| 200 | cvs_character_ram[offset] = data; | |
| 201 | gfx_element_mark_dirty(space->machine->gfx[1], offset/8); | |
| 202 | } | |
| 199 | 203 | else |
| 200 | 204 | cvs_s2636_0_ram[offset] = data; |
| 201 | 205 | } |
| r4135 | r4136 | |
| 212 | 216 | WRITE8_HANDLER( cvs_s2636_1_or_character_ram_w ) |
| 213 | 217 | { |
| 214 | 218 | if (cpu_get_reg(space->cpu, S2650_FO)) |
| 215 | cvs_character_ram[(1 * 0x800) | 0x400 | character_ram_page_start | offset] = data; | |
| 219 | { | |
| 220 | offset |= (1 * 0x800) | 0x400 | character_ram_page_start; | |
| 221 | cvs_character_ram[offset] = data; | |
| 222 | gfx_element_mark_dirty(space->machine->gfx[1], offset/8); | |
| 223 | } | |
| 216 | 224 | else |
| 217 | 225 | cvs_s2636_1_ram[offset] = data; |
| 218 | 226 | } |
| r4135 | r4136 | |
| 229 | 237 | WRITE8_HANDLER( cvs_s2636_2_or_character_ram_w ) |
| 230 | 238 | { |
| 231 | 239 | if (cpu_get_reg(space->cpu, S2650_FO)) |
| 232 | cvs_character_ram[(2 * 0x800) | 0x400 | character_ram_page_start | offset] = data; | |
| 240 | { | |
| 241 | offset |= (2 * 0x800) | 0x400 | character_ram_page_start; | |
| 242 | cvs_character_ram[offset] = data; | |
| 243 | gfx_element_mark_dirty(space->machine->gfx[1], offset/8); | |
| 244 | } | |
| 233 | 245 | else |
| 234 | 246 | cvs_s2636_2_ram[offset] = data; |
| 235 | 247 | } |
| r4135 | r4136 | |
| 497 | 509 | cvs_character_ram = auto_malloc(3 * 0x800); /* only half is used, but |
| 498 | 510 | by allocating twice the amount, |
| 499 | 511 | we can use the same gfx_layout */ |
| 512 | ||
| 513 | if (machine->gfx[1] != NULL) | |
| 514 | gfx_element_set_source(machine->gfx[1], cvs_character_ram); | |
| 515 | ||
| 500 | 516 | start_393hz_timer(machine); |
| 501 | 517 | |
| 502 | 518 | /* register state save */ |
| r4135 | r4136 | |
| 996 | 1012 | |
| 997 | 1013 | static GFXDECODE_START( cvs ) |
| 998 | 1014 | GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout, 0, 256+4 ) |
| 1015 | GFXDECODE_ENTRY( NULL, 0x0000, charlayout, 0, 256+4 ) | |
| 999 | 1016 | GFXDECODE_END |
| 1000 | 1017 | |
| 1001 | 1018 |
| r4135 | r4136 | |
|---|---|---|
| 1424 | 1424 | |
| 1425 | 1425 | ROM_START( buckrogn ) |
| 1426 | 1426 | ROM_REGION( 0xc000, "main", 0 ) |
| 1427 | ROM_LOAD( "cpu-ic3", 0x0000, 0x4000, CRC(7f1910af) SHA1(22d37750282676d8fd1f602e928c174f823245c9) ) | |
| 1428 | ROM_LOAD( "cpu-ic4", 0x4000, 0x4000, CRC(5ecd393b) SHA1(d069f12326644f2c685e516d91d33b97ec162c56) ) | |
| 1427 | ROM_LOAD( "cpu-ic3.bin", 0x0000, 0x4000, CRC(7f1910af) SHA1(22d37750282676d8fd1f602e928c174f823245c9) ) | |
| 1428 | ROM_LOAD( "cpu-ic4.bin", 0x4000, 0x4000, CRC(5ecd393b) SHA1(d069f12326644f2c685e516d91d33b97ec162c56) ) | |
| 1429 | 1429 | |
| 1430 | 1430 | ROM_REGION( 0x2000, "sub", 0 ) |
| 1431 | 1431 | ROM_LOAD( "epr-5200.cpu-ic66", 0x0000, 0x1000, CRC(0d58b154) SHA1(9f3951eb7ea1fa9ff914738462e4b4f755d60802) ) |
| r4135 | r4136 | |
|---|---|---|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | |
| 312 | WRITE32_HANDLER( plygonet_palette_w ) | |
| 312 | static WRITE32_HANDLER( plygonet_palette_w ) | |
| 313 | 313 | { |
| 314 | 314 | int r,g,b; |
| 315 | 315 |
| r4135 | r4136 | |
|---|---|---|
| 806 | 806 | |
| 807 | 807 | static const aica_interface aica_config = |
| 808 | 808 | { |
| 809 | TRUE, | |
| 809 | 810 | 0, |
| 810 | 811 | aica_irq |
| 811 | 812 | }; |
| r4135 | r4136 | |
|---|---|---|
| 1918 | 1918 | static const gfx_layout charlayout = |
| 1919 | 1919 | { |
| 1920 | 1920 | 8,8, /* 8*8 characters */ |
| 1921 | 2048 | |
| 1921 | 2048 | |
| 1922 | 1922 | 4, /* 4 bits per pixel */ |
| 1923 | 1923 | { 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */ |
| 1924 | 1924 | { XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4) }, |
| r4135 | r4136 | |
|---|---|---|
| 222 | 222 | scu_size_1, /* lv 1*/ |
| 223 | 223 | scu_size_2; /* lv 2*/ |
| 224 | 224 | |
| 225 | struct | |
| 225 | static struct | |
| 226 | 226 | { |
| 227 | 227 | UINT8 vblank_out; |
| 228 | 228 | UINT8 vblank_in; |
| r4135 | r4136 | |
| 2426 | 2426 | static const gfx_layout tiles8x8x8_layout = |
| 2427 | 2427 | { |
| 2428 | 2428 | 8,8, |
| 2429 | 0x100000/( | |
| 2429 | 0x100000/(32*8/8), | |
| 2430 | 2430 | 8, |
| 2431 | 2431 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 2432 | 2432 | { 0, 8, 16, 24, 32, 40, 48, 56 }, |
| 2433 | 2433 | { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64 }, |
| 2434 | 64*8 | |
| 2434 | 32*8 /* really 64*8, but granularity is 32 bytes */ | |
| 2435 | 2435 | }; |
| 2436 | 2436 | |
| 2437 | 2437 | static const gfx_layout tiles16x16x8_layout = |
| 2438 | 2438 | { |
| 2439 | 2439 | 16,16, |
| 2440 | 0x100000/( | |
| 2440 | 0x100000/(64 | |
| 2441 | 2441 | 8, |
| 2442 | 2442 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 2443 | 2443 | { 0, 8, 16, 24, 32, 40, 48, 56, |
| r4135 | r4136 | |
| 2447 | 2447 | { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, |
| 2448 | 2448 | 64*16, 64*17, 64*18, 64*19, 64*20, 64*21, 64*22, 64*23 |
| 2449 | 2449 | }, |
| 2450 | 128*16 | |
| 2450 | 64*16 /* really 128*16, but granularity is 32 bytes */ | |
| 2451 | 2451 | }; |
| 2452 | 2452 | |
| 2453 | 2453 | |
| r4135 | r4136 | |
| 2947 | 2947 | |
| 2948 | 2948 | ROM_START( diehard ) /* must use USA, Europe or Taiwan BIOS */ |
| 2949 | 2949 | STV_BIOS |
| 2950 | ROM_DEFAULT_BIOS( "us" ) | |
| 2950 | 2951 | |
| 2951 | 2952 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2952 | 2953 | |
| r4135 | r4136 | |
| 3400 | 3401 | |
| 3401 | 3402 | ROM_START( smleague ) /* only runs with the USA bios */ |
| 3402 | 3403 | STV_BIOS |
| 3404 | ROM_DEFAULT_BIOS( "us" ) | |
| 3403 | 3405 | |
| 3404 | 3406 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3405 | 3407 | ROM_LOAD16_BYTE( "epr18777.13", 0x0000001, 0x0080000, CRC(8d180866) SHA1(d47ebabab6e06400312d39f68cd818852e496b96) ) |
| r4135 | r4136 | |
| 3622 | 3624 | |
| 3623 | 3625 | ROM_START( critcrsh ) /* Must use Europe or Asia BIOS */ |
| 3624 | 3626 | STV_BIOS |
| 3627 | ROM_DEFAULT_BIOS( "euro" ) | |
| 3625 | 3628 | |
| 3626 | 3629 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3627 | 3630 | ROM_LOAD16_BYTE( "epr-18821.ic13", 0x0000001, 0x0080000, CRC(9a6658e2) SHA1(16dbae3d9ab584713afcb403f89fe71049609245) ) |
| r4135 | r4136 | |
|---|---|---|
| 19 | 19 | #include "driver.h" |
| 20 | 20 | #include "cpu/i386/i386.h" |
| 21 | 21 | |
| 22 | VIDEO_START(queen) | |
| 22 | static VIDEO_START(queen) | |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | VIDEO_UPDATE(queen) | |
| 27 | static VIDEO_UPDATE(queen) | |
| 28 | 28 | { |
| 29 | 29 | return 0; |
| 30 | 30 | } |
| r4135 | r4136 | |
|---|---|---|
| 370 | 370 | int xsize, ysize, xzoom, yzoom; |
| 371 | 371 | int code, attr, color, size, pri, pri_mask, trans; |
| 372 | 372 | gfx_element *gfx = machine->gfx[region]; |
| 373 | gfx_element mygfx = *gfx; | |
| 374 | 373 | |
| 375 | 374 | UINT32 *source = sprram_top; |
| 376 | 375 | const UINT32 *finish = sprram_top + (sprram_size - 0x10) / 4; |
| r4135 | r4136 | |
| 433 | 432 | flipy = !flipy; |
| 434 | 433 | } |
| 435 | 434 | |
| 436 | /* change GfxElement parameters to draw only the needed part of the 256x256 tile */ | |
| 437 | mygfx.width = xsize; | |
| 438 | mygfx.height = ysize; | |
| 439 | mygfx.gfxdata = gfx->gfxdata + tx + ty * gfx->line_modulo; | |
| 440 | ||
| 441 | 435 | /* TODO: priority handling is completely wrong, but better than nothing */ |
| 442 | 436 | if (pri == 0x0) |
| 443 | 437 | pri_mask = 0x00; |
| r4135 | r4136 | |
| 448 | 442 | else |
| 449 | 443 | pri_mask = 0xfe; |
| 450 | 444 | |
| 451 | pdrawgfxzoom(bitmap, &mygfx, | |
| 445 | gfx_element_set_source_clip(gfx, tx, xsize, ty, ysize); | |
| 446 | pdrawgfxzoom(bitmap, gfx, | |
| 452 | 447 | code, |
| 453 | 448 | color, |
| 454 | 449 | flipx, flipy, |
| r4135 | r4136 | |
|---|---|---|
| 92 | 92 | case 0x50: |
| 93 | 93 | case 0x51: |
| 94 | 94 | return okim6295_status_0_r(space,0)<<8; |
| 95 | break; | |
| 96 | 95 | |
| 97 | 96 | } |
| 98 | 97 |
| r4135 | r4136 | |
|---|---|---|
| 61 | 61 | } |
| 62 | 62 | #endif |
| 63 | 63 | |
| 64 | static VIDEO_START( ace ) | |
| 65 | { | |
| 66 | gfx_element_set_source(machine->gfx[1], ace_characterram); | |
| 67 | gfx_element_set_source(machine->gfx[2], ace_characterram); | |
| 68 | gfx_element_set_source(machine->gfx[3], ace_characterram); | |
| 69 | gfx_element_set_source(machine->gfx[4], ace_scoreram); | |
| 70 | } | |
| 71 | ||
| 64 | 72 | static VIDEO_UPDATE( ace ) |
| 65 | 73 | { |
| 66 | 74 | int offs; |
| 67 | 75 | |
| 68 | decodechar(screen->machine->gfx[1], 0, ace_characterram); | |
| 69 | decodechar(screen->machine->gfx[2], 0, ace_characterram); | |
| 70 | decodechar(screen->machine->gfx[3], 0, ace_characterram); | |
| 71 | ||
| 72 | for (offs = 0; offs < 8; offs++) | |
| 73 | { | |
| 74 | decodechar(screen->machine->gfx[4], offs, ace_scoreram); | |
| 75 | } | |
| 76 | ||
| 77 | 76 | /* first of all, fill the screen with the background color */ |
| 78 | 77 | bitmap_fill(bitmap, cliprect, 0); |
| 79 | 78 | |
| r4135 | r4136 | |
| 119 | 118 | } |
| 120 | 119 | |
| 121 | 120 | |
| 122 | static READ8_HANDLER( ace_characterram_r ) | |
| 123 | { | |
| 124 | return ace_characterram[offset]; | |
| 125 | } | |
| 126 | ||
| 127 | 121 | static WRITE8_HANDLER( ace_characterram_w ) |
| 128 | 122 | { |
| 129 | 123 | if (ace_characterram[offset] != data) |
| r4135 | r4136 | |
| 134 | 128 | popmessage("write to %04x data=%02x\n", 0x8000+offset, data); |
| 135 | 129 | } |
| 136 | 130 | ace_characterram[offset] = data; |
| 131 | gfx_element_mark_dirty(space->machine->gfx[1], 0); | |
| 132 | gfx_element_mark_dirty(space->machine->gfx[2], 0); | |
| 133 | gfx_element_mark_dirty(space->machine->gfx[3], 0); | |
| 137 | 134 | } |
| 138 | 135 | } |
| 139 | 136 | |
| 137 | static WRITE8_HANDLER( ace_scoreram_w ) | |
| 138 | { | |
| 139 | ace_scoreram[offset] = data; | |
| 140 | gfx_element_mark_dirty(space->machine->gfx[4], offset / 32); | |
| 141 | } | |
| 140 | 142 | |
| 141 | 143 | static READ8_HANDLER( unk_r ) |
| 142 | 144 | { |
| r4135 | r4136 | |
| 152 | 154 | |
| 153 | 155 | AM_RANGE(0x0000, 0x09ff) AM_ROM |
| 154 | 156 | |
| 155 | AM_RANGE(0x2000, 0x20ff) AM_RAM AM_BASE(&ace_scoreram) /* 2x2101 */ | |
| 157 | AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(ace_scoreram_w) AM_BASE(&ace_scoreram) /* 2x2101 */ | |
| 156 | 158 | AM_RANGE(0x8300, 0x83ff) AM_RAM AM_BASE(&ace_ram2) /* 2x2101 */ |
| 157 | AM_RANGE(0x8000, 0x80ff) AM_R | |
| 159 | AM_RANGE(0x8000, 0x80ff) AM_R | |
| 158 | 160 | |
| 159 | 161 | AM_RANGE(0xc000, 0xc005) AM_WRITE(ace_objpos_w) |
| 160 | 162 | |
| r4135 | r4136 | |
| 303 | 305 | GFXDECODE_ENTRY( NULL , 0x8000, scorelayout, 0, 2 ) /* the game dynamically modifies this */ |
| 304 | 306 | GFXDECODE_END |
| 305 | 307 | |
| 308 | static MACHINE_START( ace ) | |
| 309 | { | |
| 310 | state_save_register_global_array(machine, objpos); | |
| 311 | } | |
| 306 | 312 | |
| 307 | ||
| 308 | 313 | static MACHINE_DRIVER_START( ace ) |
| 309 | 314 | |
| 310 | 315 | /* basic machine hardware */ |
| 311 | 316 | MDRV_CPU_ADD("main", 8080, MASTER_CLOCK/9) /* 2 MHz ? */ |
| 312 | 317 | MDRV_CPU_PROGRAM_MAP(main_map,0) |
| 318 | MDRV_MACHINE_START(ace) | |
| 313 | 319 | |
| 314 | 320 | /* video hardware */ |
| 315 | 321 | MDRV_SCREEN_ADD("main", RASTER) |
| r4135 | r4136 | |
| 322 | 328 | MDRV_PALETTE_LENGTH(2) |
| 323 | 329 | |
| 324 | 330 | MDRV_PALETTE_INIT(ace) |
| 331 | MDRV_VIDEO_START(ace) | |
| 325 | 332 | MDRV_VIDEO_UPDATE(ace) |
| 326 | 333 | |
| 327 | 334 | /* sound hardware */ |
| r4135 | r4136 | |
| 349 | 356 | |
| 350 | 357 | ROM_END |
| 351 | 358 | |
| 352 | GAME( 1976, ace, 0, ace, ace, 0, ROT0, "Allied Leisure", "Ace", GAME_NO_SOUND | GAME_IMPERFECT_COLORS ) | |
| 359 | GAME( 1976, ace, 0, ace, ace, 0, ROT0, "Allied Leisure", "Ace", GAME_SUPPORTS_SAVE | GAME_NO_SOUND | GAME_IMPERFECT_COLORS ) |
| r4135 | r4136 | |
|---|---|---|
| 4375 | 4375 | ROM_LOAD( "32_f5.5f", 0x0000, 0x1000, CRC(1e5da9d6) SHA1(ca8b27e6dd40e4ca13e7e6b5f813bafca78b62f4) ) |
| 4376 | 4376 | ROM_LOAD( "32_h5.5h", 0x1000, 0x1000, CRC(a57adb0a) SHA1(d97c7dc4a6c5efb59cc0148e2498156c682c6714) ) |
| 4377 | 4377 | |
| 4378 | ROM_REGION( 0x3000, " | |
| 4378 | ROM_REGION( 0x3000, "digitalker | |
| 4379 | 4379 | ROM_LOAD( "32_a3.6e", 0x0000, 0x1000, CRC(279ae6f9) SHA1(a93b1d68c9f4b6ad62fdb8816285e61bd3b4b884) ) |
| 4380 | 4380 | ROM_LOAD( "32_a2.6d", 0x1000, 0x1000, CRC(90352dd4) SHA1(62c261a2f2fbd8eff31d5c72cf532d5e43d86dd3) ) |
| 4381 | 4381 | ROM_LOAD( "32_a1.6c", 0x2000, 0x1000, CRC(3bf2452d) SHA1(7a163e0ef108dd40d3beab5e9805886e45be744b) ) |
| r4135 | r4136 | |
| 4402 | 4402 | ROM_LOAD( "scor_f5.bin", 0x0000, 0x1000, CRC(60180a38) SHA1(518c1267523139aa4e27860012a722b67fe25b6d) ) |
| 4403 | 4403 | ROM_LOAD( "32_h5.5h", 0x1000, 0x1000, CRC(a57adb0a) SHA1(d97c7dc4a6c5efb59cc0148e2498156c682c6714) ) |
| 4404 | 4404 | |
| 4405 | ROM_REGION( 0x3000, " | |
| 4405 | ROM_REGION( 0x3000, "digitalker | |
| 4406 | 4406 | ROM_LOAD( "scor_a3.bin", 0x0000, 0x1000, CRC(04abf178) SHA1(2e7f231413d9ec461ca21840f31d1d6b8b17c4d5) ) |
| 4407 | 4407 | ROM_LOAD( "scor_a2.bin", 0x1000, 0x1000, CRC(452d6354) SHA1(3d5397fddcc17b4d03b9cdc53a6439f159d1bfcc) ) |
| 4408 | 4408 | ROM_LOAD( "32_a1.6c", 0x2000, 0x1000, CRC(3bf2452d) SHA1(7a163e0ef108dd40d3beab5e9805886e45be744b) ) |
| r4135 | r4136 | |
| 4428 | 4428 | ROM_LOAD( "ic72.5f", 0x0000, 0x1000, CRC(1e5da9d6) SHA1(ca8b27e6dd40e4ca13e7e6b5f813bafca78b62f4) ) |
| 4429 | 4429 | ROM_LOAD( "ic73.5h", 0x1000, 0x1000, CRC(a57adb0a) SHA1(d97c7dc4a6c5efb59cc0148e2498156c682c6714) ) |
| 4430 | 4430 | |
| 4431 | ROM_REGION( 0x3000, " | |
| 4431 | ROM_REGION( 0x3000, "digitalker | |
| 4432 | 4432 | ROM_LOAD( "ic25.6e", 0x0000, 0x1000, CRC(04abf178) SHA1(2e7f231413d9ec461ca21840f31d1d6b8b17c4d5) ) |
| 4433 | 4433 | ROM_LOAD( "ic24.6d", 0x1000, 0x1000, CRC(90352dd4) SHA1(62c261a2f2fbd8eff31d5c72cf532d5e43d86dd3) ) |
| 4434 | 4434 | ROM_LOAD( "ic23.6c", 0x2000, 0x1000, CRC(3bf2452d) SHA1(7a163e0ef108dd40d3beab5e9805886e45be744b) ) |
| r4135 | r4136 | |
|---|---|---|
| 31 | 31 | 0); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | VIDEO_START(vvillage) | |
| 34 | static VIDEO_START(vvillage) | |
| 35 | 35 | { |
| 36 | 36 | sc0_tilemap = tilemap_create(machine, get_sc0_tile_info,tilemap_scan_rows,8,8,32,32); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | VIDEO_UPDATE(vvillage) | |
| 39 | static VIDEO_UPDATE(vvillage) | |
| 40 | 40 | { |
| 41 | 41 | tilemap_draw(bitmap,cliprect,sc0_tilemap,0,0); |
| 42 | 42 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 89 | 89 | #include "driver.h" |
| 90 | 90 | #include "cpu/m6800/m6800.h" |
| 91 | 91 | #include "cpu/i8085/i8085.h" |
| 92 | #include "sound/speaker.h" | |
| 92 | 93 | #include "deprecat.h" |
| 93 | 94 | #include "8080bw.h" |
| 94 | 95 | #include "mw8080bw.h" |
| r4135 | r4136 | |
| 99 | 100 | |
| 100 | 101 | /*******************************************************/ |
| 101 | 102 | /* */ |
| 103 | /* Games with additional sound / video hardware */ | |
| 104 | /* */ | |
| 105 | /*******************************************************/ | |
| 106 | ||
| 107 | static MACHINE_START( extra_8080bw ) | |
| 108 | { | |
| 109 | MACHINE_START_CALL(extra_8080bw_sh); | |
| 110 | MACHINE_START_CALL(extra_8080bw_vh); | |
| 111 | MACHINE_START_CALL(mw8080bw); | |
| 112 | } | |
| 113 | ||
| 114 | /*******************************************************/ | |
| 115 | /* */ | |
| 102 | 116 | /* Space Invaders CV Version (Taito) */ |
| 103 | 117 | /* */ |
| 104 | 118 | /*******************************************************/ |
| r4135 | r4136 | |
| 230 | 244 | MDRV_IMPORT_FROM(mw8080bw_root) |
| 231 | 245 | MDRV_CPU_MODIFY("main") |
| 232 | 246 | MDRV_CPU_IO_MAP(invadpt2_io_map,0) |
| 247 | MDRV_MACHINE_START(extra_8080bw) | |
| 233 | 248 | |
| 234 | 249 | /* 60 Hz signal clocks two LS161. Ripple carry will */ |
| 235 | 250 | /* reset circuit, if LS161 not cleared before. */ |
| r4135 | r4136 | |
| 285 | 300 | MDRV_IMPORT_FROM(mw8080bw_root) |
| 286 | 301 | MDRV_CPU_MODIFY("main") |
| 287 | 302 | MDRV_CPU_IO_MAP(spcewars_io_map,0) |
| 303 | MDRV_MACHINE_START(extra_8080bw) | |
| 288 | 304 | |
| 289 | 305 | /* sound hardware */ |
| 290 | 306 | MDRV_IMPORT_FROM(invaders_samples_audio) |
| r4135 | r4136 | |
| 407 | 423 | MDRV_CPU_MODIFY("main") |
| 408 | 424 | MDRV_CPU_PROGRAM_MAP(cosmo_map, 0) |
| 409 | 425 | MDRV_CPU_IO_MAP(cosmo_io_map, 0) |
| 426 | MDRV_MACHINE_START(extra_8080bw) | |
| 410 | 427 | |
| 411 | 428 | /* video hardware */ |
| 412 | 429 | MDRV_VIDEO_UPDATE(cosmo) |
| r4135 | r4136 | |
| 631 | 648 | MDRV_IMPORT_FROM(mw8080bw_root) |
| 632 | 649 | MDRV_CPU_MODIFY("main") |
| 633 | 650 | MDRV_CPU_IO_MAP(lrescue_io_map,0) |
| 651 | MDRV_MACHINE_START(extra_8080bw) | |
| 634 | 652 | |
| 635 | 653 | /* video hardware */ |
| 636 | 654 | MDRV_VIDEO_UPDATE(invadpt2) |
| r4135 | r4136 | |
| 943 | 961 | MDRV_CPU_MODIFY("main") |
| 944 | 962 | MDRV_CPU_PROGRAM_MAP(schaser_map,0) |
| 945 | 963 | MDRV_CPU_IO_MAP(schasrcv_io_map,0) |
| 964 | MDRV_MACHINE_START(extra_8080bw) | |
| 946 | 965 | |
| 947 | 966 | /* video hardware */ |
| 948 | 967 | MDRV_VIDEO_UPDATE(schasrcv) |
| r4135 | r4136 | |
| 971 | 990 | return sfl_int; |
| 972 | 991 | } |
| 973 | 992 | |
| 993 | static MACHINE_START( sflush ) | |
| 994 | { | |
| 995 | state_save_register_global(machine, sfl_int); | |
| 996 | ||
| 997 | MACHINE_START_CALL(mw8080bw); | |
| 998 | } | |
| 999 | ||
| 974 | 1000 | static ADDRESS_MAP_START( sflush_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 975 | 1001 | AM_RANGE(0x0000, 0x1fff) AM_RAM |
| 976 | 1002 | AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE(&mw8080bw_ram) AM_SIZE(&mw8080bw_ram_size) |
| r4135 | r4136 | |
| 994 | 1020 | MDRV_CPU_REPLACE("main",M6800,2000000) /* ?? */ |
| 995 | 1021 | MDRV_CPU_PROGRAM_MAP(sflush_map,0) |
| 996 | 1022 | MDRV_CPU_VBLANK_INT_HACK(irq0_line_pulse,2) |
| 1023 | MDRV_MACHINE_START(sflush) | |
| 997 | 1024 | |
| 998 | 1025 | /* video hardware */ |
| 999 | 1026 | MDRV_VIDEO_UPDATE(sflush) |
| r4135 | r4136 | |
| 1095 | 1122 | MDRV_CPU_MODIFY("main") |
| 1096 | 1123 | MDRV_CPU_PROGRAM_MAP(schaser_map,0) |
| 1097 | 1124 | MDRV_CPU_IO_MAP(lupin3_io_map,0) |
| 1125 | MDRV_MACHINE_START(extra_8080bw) | |
| 1098 | 1126 | |
| 1099 | 1127 | /* video hardware */ |
| 1100 | 1128 | MDRV_VIDEO_UPDATE(lupin3) |
| r4135 | r4136 | |
| 1133 | 1161 | return polaris_cloud_pos; |
| 1134 | 1162 | } |
| 1135 | 1163 | |
| 1164 | static MACHINE_START( polaris ) | |
| 1165 | { | |
| 1166 | state_save_register_global(machine, polaris_cloud_speed); | |
| 1167 | state_save_register_global(machine, polaris_cloud_pos); | |
| 1136 | 1168 | |
| 1169 | MACHINE_START_CALL(mw8080bw); | |
| 1170 | } | |
| 1171 | ||
| 1137 | 1172 | // Port 5 is used to reset the watchdog timer. |
| 1138 | 1173 | // This port is also written to when the boss plane is going up and down. |
| 1139 | 1174 | // If you write this value to a note ciruit similar to the music, |
| r4135 | r4136 | |
| 1214 | 1249 | MDRV_CPU_IO_MAP(polaris_io_map,0) |
| 1215 | 1250 | MDRV_WATCHDOG_VBLANK_INIT(255) |
| 1216 | 1251 | MDRV_CPU_VBLANK_INT("main", polaris_interrupt) |
| 1252 | MDRV_MACHINE_START(polaris) | |
| 1217 | 1253 | |
| 1218 | 1254 | /* video hardware */ |
| 1219 | 1255 | MDRV_VIDEO_UPDATE(polaris) |
| r4135 | r4136 | |
| 1336 | 1372 | MDRV_IMPORT_FROM(mw8080bw_root) |
| 1337 | 1373 | MDRV_CPU_MODIFY("main") |
| 1338 | 1374 | MDRV_CPU_IO_MAP(ballbomb_io_map,0) |
| 1375 | MDRV_MACHINE_START(extra_8080bw) | |
| 1339 | 1376 | |
| 1340 | 1377 | /* video hardware */ |
| 1341 | 1378 | MDRV_VIDEO_UPDATE(ballbomb) |
| r4135 | r4136 | |
| 1410 | 1447 | MDRV_CPU_MODIFY("main") |
| 1411 | 1448 | MDRV_CPU_PROGRAM_MAP(yosakdon_map,0) |
| 1412 | 1449 | MDRV_CPU_IO_MAP(yosakdon_io_map,0) |
| 1450 | MDRV_MACHINE_START(extra_8080bw) | |
| 1413 | 1451 | |
| 1414 | 1452 | /* sound hardware */ |
| 1415 | 1453 | MDRV_IMPORT_FROM(invaders_samples_audio) |
| r4135 | r4136 | |
| 1506 | 1544 | MDRV_IMPORT_FROM(mw8080bw_root) |
| 1507 | 1545 | MDRV_CPU_MODIFY("main") |
| 1508 | 1546 | MDRV_CPU_IO_MAP(indianbt_io_map,0) |
| 1547 | MDRV_MACHINE_START(extra_8080bw) | |
| 1509 | 1548 | |
| 1510 | 1549 | /* video hardware */ |
| 1511 | 1550 | MDRV_VIDEO_UPDATE(indianbt) |
| r4135 | r4136 | |
| 1603 | 1642 | MDRV_CPU_MODIFY("main") |
| 1604 | 1643 | MDRV_CPU_PROGRAM_MAP(shuttlei_map,0) |
| 1605 | 1644 | MDRV_CPU_IO_MAP(shuttlei_io_map,0) |
| 1645 | MDRV_MACHINE_START(extra_8080bw) | |
| 1606 | 1646 | |
| 1607 | 1647 | /* video hardware */ |
| 1608 | 1648 | MDRV_SCREEN_MODIFY("main") |
| r4135 | r4136 | |
| 2492 | 2532 | /* board # rom parent machine inp */ |
| 2493 | 2533 | |
| 2494 | 2534 | /* Taito games */ |
| 2495 | GAMEL(1978, sitv, invaders, invaders, sitv, 0, ROT270, "Taito", "Space Invaders (TV Version)", 0, layout_invaders ) | |
| 2496 | GAME( 1979, sicv, invaders, invadpt2, sicv, 0, ROT270, "Taito", "Space Invaders (CV Version)", 0 ) | |
| 2497 | GAME( 1978, sisv, invaders, invadpt2, sicv, 0, ROT270, "Taito", "Space Invaders (SV Version)", 0 ) | |
| 2498 | GAME( 1978, sisv2, invaders, invadpt2, sicv, 0, ROT270, "Taito", "Space Invaders (SV Version 2)", 0 ) | |
| 2499 | GAMEL(1979, galxwars, 0, invaders, galxwars, 0, ROT270, "Universal", "Galaxy Wars (Universal set 1)", 0, layout_invaders ) | |
| 2500 | GAMEL(1979, galxwar2, galxwars, invaders, galxwars, 0, ROT270, "Universal", "Galaxy Wars (Universal set 2)", 0, layout_invaders ) | |
| 2501 | GAMEL(1979, galxwart, galxwars, invaders, galxwars, 0, ROT270, "Taito?", "Galaxy Wars (Taito?)" , 0, layout_invaders) /* Copyright Not Displayed */ | |
| 2502 | GAMEL(1979, starw, galxwars, invaders, galxwars, 0, ROT270, "bootleg", "Star Wars", 0, layout_invaders ) | |
| 2503 | GAME( 1979, lrescue, 0, lrescue, lrescue, 0, ROT270, "Taito", "Lunar Rescue", 0 ) | |
| 2504 | GAME( 1980, mlander, lrescue, invaders, lrescue, 0, ROT270, "[Taito] (Leisure Time Electronics bootleg)", "Moon Lander (bootleg of Lunar Rescue)", 0 ) | |
| 2505 | GAME( 1978, lrescuem, lrescue, lrescue, lrescue, 0, ROT270, "Taito (Model Racing bootleg)", "Lunar Rescue (Model Racing bootleg)", 0 ) | |
| 2506 | GAME( 1979, grescue, lrescue, lrescue, lrescue, 0, ROT270, "Taito (Universal license?)", "Galaxy Rescue", 0 ) | |
| 2507 | GAME( 1979, desterth, lrescue, lrescue, invrvnge, 0, ROT270, "bootleg", "Destination Earth", 0 ) | |
| 2508 | GAME( 1979, invadpt2, 0, invadpt2, invadpt2, 0, ROT270, "Taito", "Space Invaders Part II (Taito)", 0 ) | |
| 2509 | GAME( 1980, invaddlx, invadpt2, invaders, invadpt2, 0, ROT270, "Midway", "Space Invaders Deluxe", 0 ) | |
| 2510 | GAME( 1979, cosmo, 0, cosmo, cosmo, 0, ROT90, "TDS & Mints", "Cosmo", GAME_IMPERFECT_SOUND ) | |
| 2511 | GAME( 1979, schaser, 0, schaser, schaser, 0, ROT270, "Taito", "Space Chaser", GAME_IMPERFECT_COLORS ) | |
| 2512 | GAME( 1979, schasrcv, schaser, schasrcv, schasrcv, 0, ROT270, "Taito", "Space Chaser (CV version)", GAME_IMPERFECT_COLORS ) | |
| 2513 | GAME( 1979, sflush, 0, sflush, sflush, 0, ROT270, "Taito", "Straight Flush",GAME_NO_SOUND| GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL) | |
| 2514 | GAME( 1980, lupin3, 0, lupin3, lupin3, 0, ROT270, "Taito", "Lupin III", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL ) | |
| 2515 | GAME( 1980, polaris, 0, polaris, polaris, 0, ROT270, "Taito", "Polaris (set 1)", 0 ) | |
| 2516 | GAME( 1980, polarisa, polaris, polaris, polaris, 0, ROT270, "Taito", "Polaris (set 2)", 0 ) | |
| 2517 | GAME( 1980, ballbomb, 0, ballbomb, ballbomb, 0, ROT270, "Taito", "Balloon Bomber", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) /* missing clouds */ | |
| 2518 | GAME( 1980, indianbt, 0, indianbt, indianbt, 0, ROT270, "Taito", "Indian Battle", 0 ) | |
| 2535 | GAMEL(1978, sitv, invaders, invaders, sitv, 0, ROT270, "Taito", "Space Invaders (TV Version)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2536 | GAME( 1979, sicv, invaders, invadpt2, sicv, 0, ROT270, "Taito", "Space Invaders (CV Version)", GAME_SUPPORTS_SAVE ) | |
| 2537 | GAME( 1978, sisv, invaders, invadpt2, sicv, 0, ROT270, "Taito", "Space Invaders (SV Version)", GAME_SUPPORTS_SAVE ) | |
| 2538 | GAME( 1978, sisv2, invaders, invadpt2, sicv, 0, ROT270, "Taito", "Space Invaders (SV Version 2)", GAME_SUPPORTS_SAVE ) | |
| 2539 | GAMEL(1979, galxwars, 0, invaders, galxwars, 0, ROT270, "Universal", "Galaxy Wars (Universal set 1)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2540 | GAMEL(1979, galxwar2, galxwars, invaders, galxwars, 0, ROT270, "Universal", "Galaxy Wars (Universal set 2)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2541 | GAMEL(1979, galxwart, galxwars, invaders, galxwars, 0, ROT270, "Taito?", "Galaxy Wars (Taito?)" , GAME_SUPPORTS_SAVE, layout_invaders) /* Copyright Not Displayed */ | |
| 2542 | GAMEL(1979, starw, galxwars, invaders, galxwars, 0, ROT270, "bootleg", "Star Wars", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2543 | GAME( 1979, lrescue, 0, lrescue, lrescue, 0, ROT270, "Taito", "Lunar Rescue", GAME_SUPPORTS_SAVE ) | |
| 2544 | GAME( 1980, mlander, lrescue, invaders, lrescue, 0, ROT270, "[Taito] (Leisure Time Electronics bootleg)", "Moon Lander (bootleg of Lunar Rescue)", GAME_SUPPORTS_SAVE ) | |
| 2545 | GAME( 1978, lrescuem, lrescue, lrescue, lrescue, 0, ROT270, "Taito (Model Racing bootleg)", "Lunar Rescue (Model Racing bootleg)", GAME_SUPPORTS_SAVE ) | |
| 2546 | GAME( 1979, grescue, lrescue, lrescue, lrescue, 0, ROT270, "Taito (Universal license?)", "Galaxy Rescue", GAME_SUPPORTS_SAVE ) | |
| 2547 | GAME( 1979, desterth, lrescue, lrescue, invrvnge, 0, ROT270, "bootleg", "Destination Earth", GAME_SUPPORTS_SAVE ) | |
| 2548 | GAME( 1979, invadpt2, 0, invadpt2, invadpt2, 0, ROT270, "Taito", "Space Invaders Part II (Taito)", GAME_SUPPORTS_SAVE ) | |
| 2549 | GAME( 1980, invaddlx, invadpt2, invaders, invadpt2, 0, ROT270, "Midway", "Space Invaders Deluxe", GAME_SUPPORTS_SAVE ) | |
| 2550 | GAME( 1979, cosmo, 0, cosmo, cosmo, 0, ROT90, "TDS & Mints", "Cosmo", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) | |
| 2551 | GAME( 1979, schaser, 0, schaser, schaser, 0, ROT270, "Taito", "Space Chaser", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_COLORS ) | |
| 2552 | GAME( 1979, schasrcv, schaser, schasrcv, schasrcv, 0, ROT270, "Taito", "Space Chaser (CV version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_COLORS ) | |
| 2553 | GAME( 1979, sflush, 0, sflush, sflush, 0, ROT270, "Taito", "Straight Flush",GAME_SUPPORTS_SAVE | GAME_NO_SOUND | GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL) | |
| 2554 | GAME( 1980, lupin3, 0, lupin3, lupin3, 0, ROT270, "Taito", "Lupin III", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL ) | |
| 2555 | GAME( 1980, polaris, 0, polaris, polaris, 0, ROT270, "Taito", "Polaris (set 1)", GAME_SUPPORTS_SAVE ) | |
| 2556 | GAME( 1980, polarisa, polaris, polaris, polaris, 0, ROT270, "Taito", "Polaris (set 2)", GAME_SUPPORTS_SAVE ) | |
| 2557 | GAME( 1980, ballbomb, 0, ballbomb, ballbomb, 0, ROT270, "Taito", "Balloon Bomber", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) /* missing clouds */ | |
| 2558 | GAME( 1980, indianbt, 0, indianbt, indianbt, 0, ROT270, "Taito", "Indian Battle", GAME_SUPPORTS_SAVE ) | |
| 2519 | 2559 | |
| 2520 | 2560 | /* Misc. manufacturers */ |
| 2521 | 2561 | |
| 2522 | GAMEL(1980, searthin, invaders, invaders, searthin, 0, ROT270, "bootleg", "Super Earth Invasion (set 1)", 0, layout_invaders ) | |
| 2523 | GAMEL(1980, searthia, invaders, invaders, searthin, 0, ROT270, "bootleg", "Super Earth Invasion (set 2)", 0, layout_invaders ) | |
| 2524 | GAMEL(1978, invadrmr, invaders, invaders, invadrmr, 0, ROT270, "Model Racing", "Space Invaders (Model Racing)", 0, layout_invaders ) | |
| 2525 | GAMEL(1978, spaceatt, invaders, invaders, sicv, 0, ROT270, "Video Games GMBH", "Space Attack", 0, layout_invaders ) | |
| 2526 | GAMEL(1980, spaceat2, invaders, invaders, spaceatt, 0, ROT270, "Zenitone-Microsec Ltd", "Space Attack II", 0, layout_invaders ) | |
| 2527 | GAMEL(19??, sinvzen, invaders, invaders, spaceatt, 0, ROT270, "Zenitone-Microsec Ltd", "Super Invaders (Zenitone-Microsec)", 0, layout_invaders ) | |
| 2528 | GAMEL(19??, sinvemag, invaders, invaders, sinvemag, 0, ROT270, "bootleg", "Super Invaders (EMAG)", 0, layout_invaders ) | |
| 2529 | GAMEL(19??, tst_invd, invaders, invaders, sicv, 0, ROT0, "Test ROM", "Space Invaders Test ROM", 0, layout_invaders ) | |
| 2530 | GAMEL(19??, alieninv, invaders, invaders, searthin, 0, ROT270, "bootleg", "Alien Invasion Part II", 0, layout_invaders ) | |
| 2531 | GAMEL(1978, spceking, invaders, invaders, sicv, 0, ROT270, "Leijac Corporation (Konami)","Space King", 0, layout_invaders ) | |
| 2532 | GAMEL(1978, spcewars, invaders, spcewars, spcewars, 0, ROT270, "Sanritsu", "Space War (Sanritsu)", 0, layout_invaders ) | |
| 2533 | GAME (19??, astropal, 0, astropal, astropal, 0, ROT0, "Sidam?", "Astropal", GAME_IMPERFECT_SOUND ) | |
| 2534 | GAMEL(1978, spacewr3, invaders, spcewars, sicv, 0, ROT270, "bootleg", "Space War Part 3", 0, layout_invaders ) | |
| 2535 | GAMEL(1978, invaderl, invaders, invaders, sicv, 0, ROT270, "Logitec", "Space Invaders (Logitec)", 0, layout_invaders ) | |
| 2536 | GAMEL(1978, invader4, invaders, invaders, sicv, 0, ROT270, "bootleg", "Space Invaders Part Four", 0, layout_invaders ) | |
| 2537 | GAMEL(1979, jspecter, invaders, invaders, jspecter, 0, ROT270, "Jatre", "Jatre Specter (set 1)", 0, layout_invaders ) | |
| 2538 | GAMEL(1979, jspectr2, invaders, invaders, jspecter, 0, ROT270, "Jatre", "Jatre Specter (set 2)", 0, layout_invaders ) | |
| 2539 | GAMEL(1979, cosmicmo, invaders, invaders, cosmicmo, 0, ROT270, "Universal", "Cosmic Monsters", 0, layout_invaders ) | |
| 2540 | GAMEL(1979, cosmicm2, invaders, invaders, cosmicmo, 0, ROT270, "Universal", "Cosmic Monsters 2", 0, layout_invaders ) | |
| 2541 | GAMEL(19??, superinv, invaders, invaders, superinv, 0, ROT270, "bootleg", "Super Invaders", 0, layout_invaders ) | |
| 2542 | GAMEL(19??, invasion, invaders, invaders, invasion, 0, ROT270, "Sidam", "Invasion", 0, layout_invaders ) | |
| 2543 | GAME( 19??, darthvdr, invaders, darthvdr, darthvdr, 0, ROT270, "bootleg", "Darth Vader", GAME_NO_SOUND ) | |
| 2544 | GAME( 1979, moonbase, invadpt2, invadpt2, invadpt2, 0, ROT270, "Nichibutsu", "Moon Base", 0 ) | |
| 2545 | GAMEL(19??, invrvnge, 0, invrvnge, invrvnge, 0, ROT270, "Zenitone-Microsec Ltd.", "Invader's Revenge", GAME_IMPERFECT_SOUND, layout_invrvnge ) | |
| 2546 | GAMEL(19??, invrvnga, invrvnge, invrvnge, invrvnge, 0, ROT270, "Zenitone-Microsec Ltd. (Dutchford license)", "Invader's Revenge (Dutchford)", GAME_IMPERFECT_SOUND, layout_invrvnge ) | |
| 2547 | GAME( 1980, spclaser, 0, invaders, spclaser, 0, ROT270, "GamePlan (Taito)", "Space Laser", 0 ) | |
| 2548 | GAME( 1980, laser, spclaser, invaders, spclaser, 0, ROT270, "Leisure Time Electronics Inc.", "Astro Laser", 0 ) | |
| 2549 | GAME( 1979, spcewarl, spclaser, invaders, spclaser, 0, ROT270, "Leijac Corporation (Konami)","Space War (Leijac Corporation)", 0 ) | |
| 2550 | GAME( 1979, rollingc, 0, rollingc, rollingc, 0, ROT270, "Nichibutsu", "Rolling Crash / Moon Base", 0 ) | |
| 2551 | GAME( 1979, ozmawars, 0, invaders, ozmawars, 0, ROT270, "SNK", "Ozma Wars (set 1)", 0 ) | |
| 2552 | GAME( 1979, ozmawar2, ozmawars, invaders, ozmawars, 0, ROT270, "SNK", "Ozma Wars (set 2)" , 0) /* Uses Taito's three board color version of Space Invaders PCB */ | |
| 2553 | GAME( 1979, solfight, ozmawars, invaders, ozmawars, 0, ROT270, "bootleg", "Solar Fight", 0 ) | |
| 2554 | GAME( 1979, spaceph, ozmawars, invaders, spaceph, 0, ROT270, "Zilec Games", "Space Phantoms", 0 ) | |
| 2555 | GAME( 1979, yosakdon, 0, yosakdon, yosakdon, 0, ROT270, "Wing", "Yosaku To Donbei (set 1)", GAME_IMPERFECT_SOUND ) /* bootleg? */ | |
| 2556 | GAME( 1979, yosakdoa, yosakdon, yosakdon, yosakdon, 0, ROT270, "Wing", "Yosaku To Donbei (set 2)", GAME_IMPERFECT_SOUND ) /* bootleg? */ | |
| 2557 | GAMEL(197?, shuttlei, 0, shuttlei, shuttlei, 0, ROT270, "Omori", "Shuttle Invader", GAME_NO_COCKTAIL, layout_shuttlei ) | |
| 2562 | GAMEL(1980, searthin, invaders, invaders, searthin, 0, ROT270, "bootleg", "Super Earth Invasion (set 1)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2563 | GAMEL(1980, searthia, invaders, invaders, searthin, 0, ROT270, "bootleg", "Super Earth Invasion (set 2)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2564 | GAMEL(1978, invadrmr, invaders, invaders, invadrmr, 0, ROT270, "Model Racing", "Space Invaders (Model Racing)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2565 | GAMEL(1978, spaceatt, invaders, invaders, sicv, 0, ROT270, "Video Games GMBH", "Space Attack", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2566 | GAMEL(1980, spaceat2, invaders, invaders, spaceatt, 0, ROT270, "Zenitone-Microsec Ltd", "Space Attack II", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2567 | GAMEL(19??, sinvzen, invaders, invaders, spaceatt, 0, ROT270, "Zenitone-Microsec Ltd", "Super Invaders (Zenitone-Microsec)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2568 | GAMEL(19??, sinvemag, invaders, invaders, sinvemag, 0, ROT270, "bootleg", "Super Invaders (EMAG)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2569 | GAMEL(19??, tst_invd, invaders, invaders, sicv, 0, ROT0, "Test ROM", "Space Invaders Test ROM", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2570 | GAMEL(19??, alieninv, invaders, invaders, searthin, 0, ROT270, "bootleg", "Alien Invasion Part II", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2571 | GAMEL(1978, spceking, invaders, invaders, sicv, 0, ROT270, "Leijac Corporation (Konami)","Space King", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2572 | GAMEL(1978, spcewars, invaders, spcewars, spcewars, 0, ROT270, "Sanritsu", "Space War (Sanritsu)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2573 | GAME (19??, astropal, 0, astropal, astropal, 0, ROT0, "Sidam?", "Astropal", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) | |
| 2574 | GAMEL(1978, spacewr3, invaders, spcewars, sicv, 0, ROT270, "bootleg", "Space War Part 3", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2575 | GAMEL(1978, invaderl, invaders, invaders, sicv, 0, ROT270, "Logitec", "Space Invaders (Logitec)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2576 | GAMEL(1978, invader4, invaders, invaders, sicv, 0, ROT270, "bootleg", "Space Invaders Part Four", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2577 | GAMEL(1979, jspecter, invaders, invaders, jspecter, 0, ROT270, "Jatre", "Jatre Specter (set 1)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2578 | GAMEL(1979, jspectr2, invaders, invaders, jspecter, 0, ROT270, "Jatre", "Jatre Specter (set 2)", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2579 | GAMEL(1979, cosmicmo, invaders, invaders, cosmicmo, 0, ROT270, "Universal", "Cosmic Monsters", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2580 | GAMEL(1979, cosmicm2, invaders, invaders, cosmicmo, 0, ROT270, "Universal", "Cosmic Monsters 2", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2581 | GAMEL(19??, superinv, invaders, invaders, superinv, 0, ROT270, "bootleg", "Super Invaders", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2582 | GAMEL(19??, invasion, invaders, invaders, invasion, 0, ROT270, "Sidam", "Invasion", GAME_SUPPORTS_SAVE, layout_invaders ) | |
| 2583 | GAME( 19??, darthvdr, invaders, darthvdr, darthvdr, 0, ROT270, "bootleg", "Darth Vader", GAME_SUPPORTS_SAVE | GAME_NO_SOUND ) | |
| 2584 | GAME( 1979, moonbase, invadpt2, invadpt2, invadpt2, 0, ROT270, "Nichibutsu", "Moon Base", GAME_SUPPORTS_SAVE ) | |
| 2585 | GAMEL(19??, invrvnge, 0, invrvnge, invrvnge, 0, ROT270, "Zenitone-Microsec Ltd.", "Invader's Revenge", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND, layout_invrvnge ) | |
| 2586 | GAMEL(19??, invrvnga, invrvnge, invrvnge, invrvnge, 0, ROT270, "Zenitone-Microsec Ltd. (Dutchford license)", "Invader's Revenge (Dutchford)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND, layout_invrvnge ) | |
| 2587 | GAME( 1980, spclaser, 0, invaders, spclaser, 0, ROT270, "GamePlan (Taito)", "Space Laser", GAME_SUPPORTS_SAVE ) | |
| 2588 | GAME( 1980, laser, spclaser, invaders, spclaser, 0, ROT270, "Leisure Time Electronics Inc.", "Astro Laser", GAME_SUPPORTS_SAVE ) | |
| 2589 | GAME( 1979, spcewarl, spclaser, invaders, spclaser, 0, ROT270, "Leijac Corporation (Konami)","Space War (Leijac Corporation)", GAME_SUPPORTS_SAVE ) | |
| 2590 | GAME( 1979, rollingc, 0, rollingc, rollingc, 0, ROT270, "Nichibutsu", "Rolling Crash / Moon Base", GAME_SUPPORTS_SAVE ) | |
| 2591 | GAME( 1979, ozmawars, 0, invaders, ozmawars, 0, ROT270, "SNK", "Ozma Wars (set 1)", GAME_SUPPORTS_SAVE ) | |
| 2592 | GAME( 1979, ozmawar2, ozmawars, invaders, ozmawars, 0, ROT270, "SNK", "Ozma Wars (set 2)", GAME_SUPPORTS_SAVE ) /* Uses Taito's three board color version of Space Invaders PCB */ | |
| 2593 | GAME( 1979, solfight, ozmawars, invaders, ozmawars, 0, ROT270, "bootleg", "Solar Fight", GAME_SUPPORTS_SAVE ) | |
| 2594 | GAME( 1979, spaceph, ozmawars, invaders, spaceph, 0, ROT270, "Zilec Games", "Space Phantoms", GAME_SUPPORTS_SAVE ) | |
| 2595 | GAME( 1979, yosakdon, 0, yosakdon, yosakdon, 0, ROT270, "Wing", "Yosaku To Donbei (set 1)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) /* bootleg? */ | |
| 2596 | GAME( 1979, yosakdoa, yosakdon, yosakdon, yosakdon, 0, ROT270, "Wing", "Yosaku To Donbei (set 2)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) /* bootleg? */ | |
| 2597 | GAMEL(197?, shuttlei, 0, shuttlei, shuttlei, 0, ROT270, "Omori", "Shuttle Invader", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL, layout_shuttlei ) |
| r4135 | r4136 | |
|---|---|---|
| 99 | 99 | { |
| 100 | 100 | case 0x81 : |
| 101 | 101 | return input_port_read(space->machine, "P1") & 0x7f; |
| 102 | break; | |
| 103 | 102 | case 0x82 : |
| 104 | 103 | return input_port_read(space->machine, "P2") & 0x7f; |
| 105 | break; | |
| 106 | 104 | case 0x91: |
| 107 | 105 | /* check coin inputs */ |
| 108 | 106 | coin = ((input_port_read(space->machine, "P1") & 0x80) >> 7) | ((input_port_read(space->machine, "P2") & 0x80) >> 6); |
| r4135 | r4136 | |
| 112 | 110 | } |
| 113 | 111 | prev_coin = coin; |
| 114 | 112 | return credits; |
| 115 | break; | |
| 116 | 113 | case 0x92: |
| 117 | 114 | return ((input_port_read(space->machine, "P1") & 0x80) >> 7) | ((input_port_read(space->machine, "P2") & 0x80) >> 6); |
| 118 | break; | |
| 119 | 115 | case 0xe0: /* reset? */ |
| 120 | 116 | coins = 0; |
| 121 | 117 | credits = 0; |
| 122 | 118 | return 0xff; |
| 123 | break; | |
| 124 | 119 | case 0xe1: |
| 125 | 120 | credits--; |
| 126 | 121 | return 0xff; |
| 127 | break; | |
| 128 | 122 | case 0xfe: /* Dip Switches 1 to 4 */ |
| 129 | 123 | return input_port_read(space->machine, "DSW") & 0x0f; |
| 130 | break; | |
| 131 | 124 | case 0xff: /* Dip Switches 5 to 8 */ |
| 132 | 125 | return input_port_read(space->machine, "DSW") >> 4; |
| 133 | break; | |
| 134 | 126 | } |
| 135 | 127 | } |
| 136 | 128 |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | ROMs wanted: |
| 11 | 11 | * Bouncer |
| 12 | * Turbo Sub [later version] (uses 512 | |
| 12 | * Turbo Sub [later version] (improved gameplay, uses 27512 | |
| 13 | 13 | |
| 14 | 14 | Notes: |
| 15 | 15 | * 'turbosub' executes a series of hardware tests on startup. |
| 16 | 16 | To skip, hold down keypad '*' on reset. |
| 17 | 17 | * Hold '*' during the game to access the operator menu. |
| 18 | 18 | |
| 19 | Todo: | |
| 19 | To do: | |
| 20 | 20 | * TMS5220 speech. The game is sending speech play commands to |
| 21 | 21 | the sound CPU but any speech code greater than 2 is ignored (see $EC26). |
| 22 | 22 | I think most of the speech data is stored in the upper half of the |
| 23 | 23 | banked sound data ROMs but I don't know how or when the ROM |
| 24 | 24 | bank is switched :/ |
| 25 | 25 | |
| 26 | * Determine if line drop outs occur on real hardware. Overclocking | |
| 27 | the RIP CPU eliminates them. | |
| 26 | * Confirm that occasional line drop outs do occur on real hardware. | |
| 27 | 14 sprites seems to be the maximum number that the RIP CPU can safely | |
| 28 | process per line. | |
| 28 | 29 | |
| 29 | * Implement collision detection hardware (n | |
| 30 | * Implement collision detection hardware (un | |
| 30 | 31 | |
| 31 | 32 | ****************************************************************************/ |
| 32 | 33 | |
| r4135 | r4136 | |
| 238 | 239 | * |
| 239 | 240 | *************************************/ |
| 240 | 241 | |
| 241 | READ16_DEVICE_HANDLER( fdt_rip_r ) | |
| 242 | static READ16_DEVICE_HANDLER( fdt_rip_r ) | |
| 242 | 243 | { |
| 243 | 244 | offset = (offset & 0x7ff) << 1; |
| 244 | 245 | |
| r4135 | r4136 | |
| 248 | 249 | return (fdt_b[offset] << 8) | fdt_b[offset + 1]; |
| 249 | 250 | } |
| 250 | 251 | |
| 251 | WRITE16_DEVICE_HANDLER( fdt_rip_w ) | |
| 252 | static WRITE16_DEVICE_HANDLER( fdt_rip_w ) | |
| 252 | 253 | { |
| 253 | 254 | offset = (offset & 0x7ff) << 1; |
| 254 | 255 | |
| r4135 | r4136 | |
| 275 | 276 | D7 = /FDONE |
| 276 | 277 | */ |
| 277 | 278 | |
| 278 | UINT8 rip_status_in(running_machine *machine) | |
| 279 | static UINT8 rip_status_in(running_machine *machine) | |
| 279 | 280 | { |
| 280 | UINT8 _vblank = !video_screen_get_vblank(machine->primary_screen); | |
| 281 | UINT8 _hblank = !video_screen_get_hblank(machine->primary_screen); | |
| 282 | UINT8 v0 = video_screen_get_vpos(machine->primary_screen) & 1; | |
| 281 | int vpos = video_screen_get_vpos(machine->primary_screen); | |
| 282 | UINT8 _vblank = !(vpos >= ESRIPSYS_VBLANK_START); | |
| 283 | // UINT8 _hblank = !video_screen_get_hblank(machine->primary_screen); | |
| 283 | 284 | |
| 284 | 285 | return _vblank |
| 285 | | (_hblank << 1) | |
| 286 | | (esripsys_hblank << 1) | |
| 286 | 287 | | (esripsys__12sel << 2) |
| 287 | 288 | | (_fbsel << 4) |
| 288 | | (v | |
| 289 | | ((vpos & 1) << 5) | |
| 289 | 290 | | (f_status & 0x80); |
| 290 | 291 | } |
| 291 | 292 | |
| r4135 | r4136 | |
| 464 | 465 | * |
| 465 | 466 | *************************************/ |
| 466 | 467 | |
| 467 | INPUT_PORTS_START( turbosub ) | |
| 468 | static INPUT_PORTS_START( turbosub ) | |
| 468 | 469 | PORT_START("KEYPAD_A") |
| 469 | 470 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Keypad 0") PORT_CHANGED(keypad_interrupt, 0) |
| 470 | 471 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Keypad 1") PORT_CHANGED(keypad_interrupt, 0) |
| r4135 | r4136 | |
| 529 | 530 | { |
| 530 | 531 | /* Bit 6 -> Reset latch U56A */ |
| 531 | 532 | /* Bit 7 -> Clock latch U56B */ |
| 532 | ||
| 533 | 533 | if (s_to_g_latch2 & 0x40) |
| 534 | 534 | { |
| 535 | 535 | u56a = 0; |
| r4135 | r4136 | |
| 679 | 679 | |
| 680 | 680 | ptm6840_config(machine, 0, &ptm_intf); |
| 681 | 681 | |
| 682 | memory_set_bankptr(machine, 2, &ROM[0x0000+0x0000]); | |
| 683 | memory_set_bankptr(machine, 3, &ROM[0x0000+0x4000]); | |
| 684 | memory_set_bankptr(machine, 4, &ROM[0x0000+0x8000]); | |
| 682 | memory_set_bankptr(machine, 2, &ROM[0x0000]); | |
| 683 | memory_set_bankptr(machine, 3, &ROM[0x4000]); | |
| 684 | memory_set_bankptr(machine, 4, &ROM[0x8000]); | |
| 685 | 685 | |
| 686 | /* TODO: Finish me! */ | |
| 687 | // state_save_register_global_pointer(fdt_a, FDT_RAM_SIZE); | |
| 688 | // state_save_register_global_pointer(fdt_b, FDT_RAM_SIZE); | |
| 686 | /* Register stuff for state saving */ | |
| 687 | state_save_register_global_pointer(machine, fdt_a, FDT_RAM_SIZE); | |
| 688 | state_save_register_global_pointer(machine, fdt_b, FDT_RAM_SIZE); | |
| 689 | state_save_register_global_pointer(machine, cmos_ram, CMOS_RAM_SIZE); | |
| 690 | ||
| 691 | state_save_register_global(machine, g_iodata); | |
| 692 | state_save_register_global(machine, g_ioaddr); | |
| 693 | state_save_register_global(machine, coin_latch); | |
| 694 | state_save_register_global(machine, keypad_status); | |
| 695 | state_save_register_global(machine, g_status); | |
| 696 | state_save_register_global(machine, f_status); | |
| 697 | state_save_register_global(machine, io_firq_status); | |
| 698 | state_save_register_global(machine, cmos_ram_a2_0); | |
| 699 | state_save_register_global(machine, cmos_ram_a10_3); | |
| 700 | ||
| 701 | state_save_register_global(machine, u56a); | |
| 702 | state_save_register_global(machine, u56b); | |
| 703 | state_save_register_global(machine, g_to_s_latch1); | |
| 704 | state_save_register_global(machine, g_to_s_latch2); | |
| 705 | state_save_register_global(machine, s_to_g_latch1); | |
| 706 | state_save_register_global(machine, s_to_g_latch2); | |
| 707 | state_save_register_global(machine, dac_msb); | |
| 708 | state_save_register_global(machine, dac_vol); | |
| 709 | state_save_register_global(machine, tms_data); | |
| 710 | ||
| 711 | state_save_register_global(machine, _fasel); | |
| 712 | state_save_register_global(machine, _fbsel); | |
| 689 | 713 | } |
| 690 | 714 | |
| 691 | 715 | static NVRAM_HANDLER( esripsys ) |
| r4135 | r4136 | |
| 698 | 722 | memset(cmos_ram, 0x00, CMOS_RAM_SIZE); |
| 699 | 723 | } |
| 700 | 724 | |
| 701 | static esrip_config rip_config = | |
| 725 | static const esrip_config rip_config = | |
| 702 | 726 | { |
| 703 | 727 | fdt_rip_r, |
| 704 | 728 | fdt_rip_w, |
| r4135 | r4136 | |
| 729 | 753 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 730 | 754 | MDRV_SCREEN_RAW_PARAMS(ESRIPSYS_PIXEL_CLOCK, ESRIPSYS_HTOTAL, ESRIPSYS_HBLANK_END, ESRIPSYS_HBLANK_START, ESRIPSYS_VTOTAL, ESRIPSYS_VBLANK_END, ESRIPSYS_VBLANK_START) |
| 731 | 755 | |
| 756 | MDRV_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) | |
| 732 | 757 | MDRV_VIDEO_START(esripsys) |
| 733 | 758 | MDRV_VIDEO_UPDATE(esripsys) |
| 734 | 759 | |
| r4135 | r4136 | |
| 988 | 1013 | * |
| 989 | 1014 | *************************************/ |
| 990 | 1015 | |
| 991 | GAME( 1985, turbosub, 0, esripsys, turbosub, esripsys, ROT0, "Entertainment Sciences", "Turbo Sub (prototype rev. TSCA)", GAME_IMPERFECT_SOUND ) | |
| 992 | GAME( 1985, turbosba, turbosub, esripsys, turbosub, esripsys, ROT0, "Entertainment Sciences", "Turbo Sub (prototype rev. TSC6)", GAME_IMPERFECT_SOUND ) | |
| 1016 | GAME( 1985, turbosub, 0, esripsys, turbosub, esripsys, ROT0, "Entertainment Sciences", "Turbo Sub (prototype rev. TSCA)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) | |
| 1017 | GAME( 1985, turbosba, turbosub, esripsys, turbosub, esripsys, ROT0, "Entertainment Sciences", "Turbo Sub (prototype rev. TSC6)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) |
| r4135 | r4136 | |
|---|---|---|
| 19 | 19 | /*Temporary,to show something on screen...*/ |
| 20 | 20 | static char led_array[21]; |
| 21 | 21 | |
| 22 | VIDEO_START( deshoros ) | |
| 22 | static VIDEO_START( deshoros ) | |
| 23 | 23 | { |
| 24 | 24 | static UINT8 i; |
| 25 | 25 | for(i=0;i<20;i++) |
| r4135 | r4136 | |
| 27 | 27 | led_array[20] = 0; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | VIDEO_UPDATE( deshoros ) | |
| 30 | static VIDEO_UPDATE( deshoros ) | |
| 31 | 31 | { |
| 32 | 32 | popmessage("%s",led_array); |
| 33 | 33 | return 0; |
| r0 | r4136 | |
|---|---|---|
| 1 | /* | |
| 2 | ||
| 3 | Buster | |
| 4 | ||
| 5 | Video Fruit Machine | |
| 6 | ||
| 7 | */ | |
| 8 | ||
| 9 | #include "driver.h" | |
| 10 | #include "cpu/z80/z80.h" | |
| 11 | #include "sound/ay8910.h" | |
| 12 | ||
| 13 | static UINT8 *buster_rom; | |
| 14 | static UINT8 *buster_vram; | |
| 15 | ||
| 16 | static VIDEO_START(buster) | |
| 17 | { | |
| 18 | ||
| 19 | } | |
| 20 | ||
| 21 | static VIDEO_UPDATE(buster) | |
| 22 | { | |
| 23 | const gfx_element *gfx = screen->machine->gfx[0]; | |
| 24 | int count = 0x0000; | |
| 25 | ||
| 26 | int y,x; | |
| 27 | ||
| 28 | ||
| 29 | for (y=0;y<64;y++) | |
| 30 | { | |
| 31 | for (x=0;x<32;x++) | |
| 32 | { | |
| 33 | int tile = (buster_vram[count+1])|(buster_vram[count]<<8); | |
| 34 | //int colour = tile>>12; | |
| 35 | drawgfx(bitmap,gfx,tile,0,0,0,x*8,y*4,cliprect,TRANSPARENCY_NONE,0); | |
| 36 | ||
| 37 | count+=2; | |
| 38 | } | |
| 39 | } | |
| 40 | return 0; | |
| 41 | } | |
| 42 | ||
| 43 | static ADDRESS_MAP_START( mainmap, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 44 | AM_RANGE(0x0000, 0x3fff) AM_RAM AM_BASE(&buster_rom) | |
| 45 | AM_RANGE(0x4000, 0x47ff) AM_RAM | |
| 46 | AM_RANGE(0x5000, 0x5fff) AM_RAM AM_BASE(&buster_vram) | |
| 47 | // AM_RANGE(0x6000, 0x6000) MC6845 address | |
| 48 | // AM_RANGE(0x6001, 0x6001) MC6845 data | |
| 49 | AM_RANGE(0x7000, 0xafff) AM_ROM | |
| 50 | ADDRESS_MAP_END | |
| 51 | ||
| 52 | ||
| 53 | ||
| 54 | static INPUT_PORTS_START( buster ) | |
| 55 | INPUT_PORTS_END | |
| 56 | ||
| 57 | static const gfx_layout tiles8x8_layout = | |
| 58 | { | |
| 59 | 8,4, | |
| 60 | RGN_FRAC(1,3), | |
| 61 | 3, | |
| 62 | { RGN_FRAC(0,3),RGN_FRAC(1,3),RGN_FRAC(2,3) }, | |
| 63 | { 0,1,2,3,4,5,6,7 }, | |
| 64 | { 0*8, 1*8, 2*8, 3*8 }, | |
| 65 | 8*4 | |
| 66 | }; | |
| 67 | ||
| 68 | static GFXDECODE_START( buster ) | |
| 69 | GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 16 ) | |
| 70 | GFXDECODE_END | |
| 71 | ||
| 72 | static MACHINE_DRIVER_START( buster ) | |
| 73 | /* basic machine hardware */ | |
| 74 | MDRV_CPU_ADD("main", Z80,8000000) /* ? MHz */ | |
| 75 | MDRV_CPU_PROGRAM_MAP(mainmap,0) | |
| 76 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) | |
| 77 | ||
| 78 | /* video hardware */ | |
| 79 | MDRV_SCREEN_ADD("main", RASTER) | |
| 80 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 81 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 82 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 83 | MDRV_SCREEN_SIZE(256, 256) | |
| 84 | MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1) | |
| 85 | ||
| 86 | MDRV_GFXDECODE(buster) | |
| 87 | MDRV_PALETTE_LENGTH(0x100) | |
| 88 | ||
| 89 | MDRV_VIDEO_START(buster) | |
| 90 | MDRV_VIDEO_UPDATE(buster) | |
| 91 | ||
| 92 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 93 | ||
| 94 | MDRV_SOUND_ADD("ay", AY8910, 1500000/2) | |
| 95 | // MDRV_SOUND_CONFIG(ay8910_config) | |
| 96 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 97 | MACHINE_DRIVER_END | |
| 98 | ||
| 99 | ||
| 100 | ROM_START( buster ) | |
| 101 | ROM_REGION( 0x10000, "main", 0 ) | |
| 102 | ROM_LOAD( "vf-1.bin", 0x00000, 0x1000, CRC(571c32fe) SHA1(a61a052a4caf4430be5c5377934295bb90bb903a) ) | |
| 103 | ROM_LOAD( "vf-2.bin", 0x01000, 0x1000, CRC(fefe8783) SHA1(aed2bae4cf531dc994b50be9968fa5e10b61f2b8) ) | |
| 104 | ROM_LOAD( "vf-3.bin", 0x02000, 0x1000, CRC(9dd9be43) SHA1(5319ef3b43236abd38138adef87a7701f91afd1d)) | |
| 105 | ROM_LOAD( "vf-4.bin", 0x03000, 0x1000, CRC(90dd550b) SHA1(a0a26031aada35f6d6c4fa5af9b75e594d8039d0) ) | |
| 106 | ROM_COPY( "main", 0x00000, 0x7000, 0x4000 ) | |
| 107 | ||
| 108 | ROM_REGION( 0x6000, "gfx1", 0 ) | |
| 109 | ROM_LOAD( "b-red.bin", 0x00000, 0x2000, CRC(6e3ea232) SHA1(dcf76a1ee12517bd00c7b10aaeda0fa2fcec941e) ) | |
| 110 | ROM_LOAD( "b-grn.bin", 0x02000, 0x2000, CRC(acdbb44f) SHA1(41f6a2d4a6b12f506588379f2ed3df48fbc8184e) ) | |
| 111 | ROM_LOAD( "b-blu.bin", 0x04000, 0x2000, CRC(3b6bfe7b) SHA1(1888149a2ef85db59845d7e6e9227449f80c8f22) ) | |
| 112 | ROM_END | |
| 113 | ||
| 114 | static DRIVER_INIT( buster ) | |
| 115 | { | |
| 116 | UINT8 *ROM = memory_region(machine, "main"); | |
| 117 | // vram = auto_malloc(0x2000); | |
| 118 | memcpy(buster_rom, ROM, 0x4000); | |
| 119 | } | |
| 120 | ||
| 121 | GAME( 1987, buster, 0, buster, buster, buster, ROT0, "Marian Electronics Ltd.", "Buster", GAME_NOT_WORKING|GAME_NO_SOUND ) |
| r4135 | r4136 | |
|---|---|---|
| 298 | 298 | MDRV_PALETTE_LENGTH(10) |
| 299 | 299 | |
| 300 | 300 | MDRV_PALETTE_INIT(polyplay) |
| 301 | MDRV_VIDEO_START(polyplay) | |
| 301 | 302 | MDRV_VIDEO_UPDATE(polyplay) |
| 302 | 303 | |
| 303 | 304 | /* sound hardware */ |
| r0 | r4136 | |
|---|---|---|
| 1 | /* | |
| 2 | SMS Manufacturing Corp hardware | |
| 3 | ||
| 4 | Driver by Mariusz Wojcieszek | |
| 5 | ||
| 6 | Preliminary driver by Reip | |
| 7 | Schematics provided by Exodus | |
| 8 | Sure Shot board provided by ranger_lennier | |
| 9 | Notes by Lord Nightmare | |
| 10 | ||
| 11 | Notes/ToDo: | |
| 12 | - pit8254 is not accessed by z80 (and there is no interrupt service routine), so | |
| 13 | it is not fitted in the driver | |
| 14 | - video registers can be read (to read framebuffer contents), this is not emulated | |
| 15 | as software does not use this feature | |
| 16 | - I8088 clock may be incorrect | |
| 17 | - Video Blanking Zone input - probably hblank or vblank | |
| 18 | - game speed may be not 100% correct - software does not use interrupts and | |
| 19 | Video Blanking Zone is not emulated (which is required to get proper timings) | |
| 20 | - implement video raw parameters | |
| 21 | ||
| 22 | */ | |
| 23 | ||
| 24 | /* | |
| 25 | smssshot (Lord Nightmare) | |
| 26 | SMS Sure Shot (poker?) | |
| 27 | * Same exact board as sms trivia, but "COMPONENT SIDE REV 01" | |
| 28 | instead of rev 02. | |
| 29 | * 3 chips were removed from the board; two are shown as removed | |
| 30 | in the schematic, one was removed later (an apparently | |
| 31 | unnecessary data buffer on one of the z80 external latches) | |
| 32 | * Does NOT have a daughterboard with additional roms; in fact, | |
| 33 | connector J1 for the ribbon cable to the daughterboard isn't | |
| 34 | populated with pins at all | |
| 35 | * Serial Number A-108 etched in board, on back. | |
| 36 | ||
| 37 | ||
| 38 | smsbingo (Lord Nightmare) | |
| 39 | SMS Bingo | |
| 40 | Someone on the MW forums has this iirc, but it isn't dumped yet - LN | |
| 41 | ||
| 42 | ||
| 43 | ||
| 44 | **** Notes from schematics (applies to all drivers): | |
| 45 | Framebuffer is six tms4416 16384*4 chips; chips are arranged as three | |
| 46 | planes of 16384*8 bits per plane, one plane per color channel. | |
| 47 | Screen resolution is probably either 212x256 (two bits per plane, per | |
| 48 | pixel) or 424x256 (one bit per plane per pixel), depending on the pals | |
| 49 | installed. See schematics on page 6. The counters at U137 and U139 | |
| 50 | compare against binary 0b110101 (53) in comparitor at U138, and as soon | |
| 51 | as it hits that, HDONE is pulled high on the next MCLR clock. | |
| 52 | This means there will be 53 (0-52) counts in the X counter before HDONE; | |
| 53 | as each count refers to one 8 bit address, and the addressed 4416 rams | |
| 54 | have between all of them 24 bits of output (8 per plane), the minimum | |
| 55 | horizontal displayed resolution is 53x256 (8 bits per color per pixel), | |
| 56 | and maximum is 8 times that. With proper pals (and proper mixing | |
| 57 | resistors or other PWM fun) it should be possible to get: | |
| 58 | 53x256 8,8,8 RGB | |
| 59 | 106x256 4,4,4 RGB | |
| 60 | 212x256 2,2,2 RGB <- this seems the most likely to me (LN) | |
| 61 | 424x256 1,1,1 RGB | |
| 62 | ||
| 63 | ||
| 64 | * The socket at U50 and the 3 pin connector J3 is for an | |
| 65 | undumped intel 8050 MCU used for rs232 serial communication, | |
| 66 | for either linking together machines, or more likely for factory | |
| 67 | testing. The function of this internal rom is probably simple | |
| 68 | enough to HLE or to even rewrite from scratch, but I doubt the code | |
| 69 | on any of the dumped games even touches it, it was probably for use | |
| 70 | with a specific game or for a set of hardware test roms to report | |
| 71 | errors. | |
| 72 | (schematic page 4) | |
| 73 | The pinout of J3 is: | |
| 74 | pin 1 (toward bottom of pcb): rs232 input to pcb | |
| 75 | (pre-level shifted to 5v i.e. with a max232 or mc1489) | |
| 76 | pin 2 : ground | |
| 77 | pin 3 : rs232 output to elsewhere (to be sent to a max232 or | |
| 78 | mc1488 to shift to rs232 voltage levels) | |
| 79 | ||
| 80 | * The 8255 PPI at U13 (connected to the 8088) is connected to 75451 | |
| 81 | drivers on all pins EXCEPT pins PC3 thru PC0. | |
| 82 | (schematic page 3) | |
| 83 | PA7 - Display Light 1 | |
| 84 | PA6 - Display Light 2 | |
| 85 | PA5 - Display Light 3 | |
| 86 | PA4 - Display Light 4 | |
| 87 | PA3 - Display Light 5 | |
| 88 | PA2 - Bet Light | |
| 89 | PA1 - Deal Light | |
| 90 | PA0 - Draw Light | |
| 91 | PB7 - Stand Light | |
| 92 | PB6 - Cancel Light | |
| 93 | PB5 - Coin Lock out A | |
| 94 | PB4 - Coin Lock out B | |
| 95 | PB3 - Setup Light | |
| 96 | PB2 - Hopper Motor | |
| 97 | PB1 - Coin in Counter (mechanical counter inside the machine) | |
| 98 | PB0 - Knock off Counter (tilt? probably also a mechanical counter) | |
| 99 | PC7 - unused | |
| 100 | PC6 - unused | |
| 101 | PC5 - unused | |
| 102 | PC4 - Battery Charge control (for 8088 ram backup 3.6v Nicad) | |
| 103 | PC3 - (pulled high externally, input) - unused? possibly for an ABC hopper | |
| 104 | PC2 - (pulled high externally, input) - unused? possibly for an ABC hopper | |
| 105 | PC1 - (pulled high externally, input) - "Hopper Count", | |
| 106 | probably a beam to check the hopper coin out | |
| 107 | PC0 - "Video BZ" (Video Blanking Zone, is an input) | |
| 108 | ||
| 109 | * The 8255 PPI at U2 (connected to the z80) is unused and not populated. | |
| 110 | (All 3 ports have +5V pullups on all pins) | |
| 111 | ||
| 112 | * The 8255 PPI at U1 (connected to the z80) is used as follows: | |
| 113 | (All 3 ports have +5V pullups on all pins) | |
| 114 | PA7 - Lighted Button 1 (input) | |
| 115 | PA6 - Lighted Button 2 (input) | |
| 116 | PA5 - Lighted Button 3 (input) | |
| 117 | PA4 - Lighted Button 4 (input) | |
| 118 | PA3 - Lighted Button 5 (input) | |
| 119 | PA2 - Bet Button (input) | |
| 120 | PA1 - Deal Button (input) | |
| 121 | PA0 - Draw Button (input) | |
| 122 | PB7 - Stand Button (input) | |
| 123 | PB6 - Cancel Button (input) | |
| 124 | PB5 - Alt Coin (input) | |
| 125 | PB4 - Remote Knockoff (tilt? input) | |
| 126 | PB3 - Operator Mode (input) | |
| 127 | PB2 - Coin Error reset (input) | |
| 128 | PB1 - unused | |
| 129 | PB0 - unused | |
| 130 | PC7 - unused | |
| 131 | PC6 - unused | |
| 132 | PC5 - unused | |
| 133 | PC4 - unused | |
| 134 | PC3 - unused | |
| 135 | PC2 - unused | |
| 136 | PC1 - unused | |
| 137 | PC0 - Coin (input) | |
| 138 | ||
| 139 | ||
| 140 | * The function of the pals is: | |
| 141 | LOCATION DOTS TYPE PURPOSE | |
| 142 | U32 1Green DMPAL10L8NC Decodes the gated by U33/U34) | |
| 143 | high address lines of the 8088, for mainboard ROM mapping. A | |
| 144 | different pal is probably used depending on whether the | |
| 145 | mainboard has 2764 or 27128 roms installed. | |
| 146 | SMS Sure Shot: dumped ok as truth table, mainboard has 4 2764s | |
| 147 | SMS Trivia: bad (chip shorted internally), mainboard has 2 27128s | |
| 148 | SMS Bingo: not dumped | |
| 149 | (schematic page 2) | |
| 150 | U38 3Blue PAL10L8CN Decodes the (gated by U36) | |
| 151 | high address lines of the z80 address bus, for mapping of the z80 | |
| 152 | ROM, RAM, Counter control, 4 z80-to-8088 ports (2 one direction, | |
| 153 | 2 the other), the ay-3-8910, and the two 8255 PPIs. | |
| 154 | (schematic page 10) | |
| 155 | U39 3Green PAL10L8CN Accessory decoder to U38, helps | |
| 156 | with the 4 z80-to-8088 ports. | |
| 157 | (schematic page 10) | |
| 158 | U40 1Red PAL10L8CN Connects to the low bits of the | |
| 159 | 8088 address bus for decoding writing to/reading from the 8088 side of | |
| 160 | the 4 z80-to-8088 ports. | |
| 161 | (schematic page 10, note this chip is mismarked as U9 on the page, | |
| 162 | it is the chip in the lower left) | |
| 163 | U52 1Blue PAL10L8CN Decodes the (gated by U33/U34) | |
| 164 | high address lines of the 8088, for main memory mapping of ram, | |
| 165 | z80 communication, video, serial I/O (to U50), and the output-only | |
| 166 | 8255 at U13 (which controls button lights and the coin hopper) | |
| 167 | SMS Sure Shot: dumped ok as truth table | |
| 168 | SMS Trivia: checksum 0, probably bad | |
| 169 | SMS Bingo: not dumped | |
| 170 | (schematic page 1) | |
| 171 | U58 3Brown DMPAL10H8NC Controls BDIR and BC1 on the | |
| 172 | ay-3-8910 given the low two address bits of the z80 bits, the | |
| 173 | ay-3-8910 enable line, and the buffered z80 RD and WR lines. | |
| 174 | (schematic page 12) | |
| 175 | U80 2Blue PAL10H8CN State machine which controls StartH, | |
| 176 | StartV, and the related functions involving the shifters for framebuffer | |
| 177 | address and framebuffer output. Also lets framebuffer know when in hblank | |
| 178 | or vblank. Is separate from the other "Video BZ" thing. | |
| 179 | (schematic page 6) | |
| 180 | U94 2Green PAL14H4CN State machine controls the | |
| 181 | read-modify-write logic for accessing the frame buffer (while outside | |
| 182 | of vblank and hblank?), may allow writing red green and blue plane bytes | |
| 183 | all to one address, one after the other | |
| 184 | (schematic page 7) | |
| 185 | U109 2Brown PAL14H4CN Determines next state of the | |
| 186 | 'Pixel control' hardware, i.e. H and V current line counters | |
| 187 | Also determines VBLANK/"Video BZ" | |
| 188 | (schematic page 5) | |
| 189 | U110 2Red PAL10L8CN Translates output of U109 | |
| 190 | before being sent to counters/color reg latch/etc. | |
| 191 | (schematic page 5) | |
| 192 | U128 Blue-Brown-Blue PAL10H8CN One of three 'sync' pals which | |
| 193 | control the memory and other timing subsystem, fed by a 4 bit counter. | |
| 194 | this particular pal has one external feedback bit. | |
| 195 | (schematic page 6) | |
| 196 | U129 Red-Green-Red DMPAL10H8NC Second of three 'sync' pals | |
| 197 | This one has 2 external feedback bits. | |
| 198 | (schematic page 6) | |
| 199 | U130 3Red PAL10H8CN Third of three 'sync' pals' | |
| 200 | This one has 3 external feedback bits plus three extra inputs from elsewhere | |
| 201 | which are not readable on the schematic. Will trace them later. | |
| 202 | (schematic page 6) | |
| 203 | U140 1Brown PAL14H4CN This and the next 5 pals are used | |
| 204 | to shift the framebuffer data, 4 bits at a time. This is done in parallel | |
| 205 | (8 bits per channel) for output. all 6 pals are the same. | |
| 206 | (schematic page 7) | |
| 207 | U141 1Brown PAL14H4CN | |
| 208 | U142 1Brown PAL14H4CN | |
| 209 | U143 1Brown PAL14H4CN | |
| 210 | U144 1Brown PAL14H4CN | |
| 211 | U145 1Brown PAL14H4CN | |
| 212 | ||
| 213 | ||
| 214 | */ | |
| 215 | #include "driver.h" | |
| 216 | #include "cpu/i86/i86.h" | |
| 217 | #include "cpu/z80/z80.h" | |
| 218 | #include "sound/ay8910.h" | |
| 219 | #include "machine/8255ppi.h" | |
| 220 | ||
| 221 | /************************************* | |
| 222 | * | |
| 223 | * Bankswitching (for trivia question roms) | |
| 224 | * | |
| 225 | *************************************/ | |
| 226 | ||
| 227 | static WRITE8_HANDLER(bankswitch_w) | |
| 228 | { | |
| 229 | memory_set_bank(space->machine, 1, data); | |
| 230 | } | |
| 231 | ||
| 232 | /************************************* | |
| 233 | * | |
| 234 | * 8088 <-> Z80 communication | |
| 235 | * | |
| 236 | *************************************/ | |
| 237 | ||
| 238 | static UINT8 communication_port[4]; | |
| 239 | static UINT8 communication_port_status = 0; | |
| 240 | ||
| 241 | static READ8_HANDLER(link_r) | |
| 242 | { | |
| 243 | switch(offset) | |
| 244 | { | |
| 245 | case 0: | |
| 246 | communication_port_status &= ~0x01; | |
| 247 | return communication_port[0]; | |
| 248 | case 1: | |
| 249 | communication_port_status &= ~0x02; | |
| 250 | return communication_port[1]; | |
| 251 | case 2: | |
| 252 | return communication_port_status; | |
| 253 | } | |
| 254 | return 0; | |
| 255 | }; | |
| 256 | ||
| 257 | static WRITE8_HANDLER(link_w) | |
| 258 | { | |
| 259 | switch(offset) | |
| 260 | { | |
| 261 | case 0: | |
| 262 | communication_port_status |= 0x08; | |
| 263 | communication_port[3] = data; | |
| 264 | break; | |
| 265 | case 1: | |
| 266 | communication_port_status |= 0x04; | |
| 267 | communication_port[2] = data; | |
| 268 | break; | |
| 269 | } | |
| 270 | } | |
| 271 | ||
| 272 | static READ8_HANDLER(z80_8088_r) | |
| 273 | { | |
| 274 | return communication_port_status; | |
| 275 | } | |
| 276 | ||
| 277 | static READ8_HANDLER(p03_r) | |
| 278 | { | |
| 279 | switch(offset) | |
| 280 | { | |
| 281 | case 0: | |
| 282 | communication_port_status &= ~0x08; | |
| 283 | return communication_port[3]; | |
| 284 | case 1: | |
| 285 | communication_port_status &= ~0x04; | |
| 286 | return communication_port[2]; | |
| 287 | } | |
| 288 | return 0; | |
| 289 | } | |
| 290 | ||
| 291 | static WRITE8_HANDLER(p03_w) | |
| 292 | { | |
| 293 | switch(offset) | |
| 294 | { | |
| 295 | case 0: | |
| 296 | communication_port_status |= 0x01; | |
| 297 | communication_port[0] = data; | |
| 298 | break; | |
| 299 | case 1: | |
| 300 | communication_port_status |= 0x02; | |
| 301 | communication_port[1] = data; | |
| 302 | break; | |
| 303 | } | |
| 304 | } | |
| 305 | ||
| 306 | ||
| 307 | /************************************* | |
| 308 | * | |
| 309 | * Input ports | |
| 310 | * | |
| 311 | *************************************/ | |
| 312 | ||
| 313 | INPUT_PORTS_START(sms) | |
| 314 | PORT_START("IN0") | |
| 315 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Draw") /* Draw Button */ | |
| 316 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Deal") /* Deal Button */ | |
| 317 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Bet") /* Bet Button */ | |
| 318 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) /* Lighted Button 5 */ | |
| 319 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) /* Lighted Button 4 */ | |
| 320 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) /* Lighted Button 3 */ | |
| 321 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* Lighted Button 2 */ | |
| 322 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* Lighted Button 1 */ | |
| 323 | ||
| 324 | PORT_START("IN1") | |
| 325 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 326 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 327 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Coin Error reset */ | |
| 328 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) /* Operator Mode */ | |
| 329 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Remote Knockoff */ | |
| 330 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) | |
| 331 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("Cancel") /* Cancel Button */ | |
| 332 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Stand") /* Stand Button */ | |
| 333 | ||
| 334 | PORT_START("IN2") | |
| 335 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) /* Coin */ | |
| 336 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 337 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 338 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 339 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 340 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 341 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 342 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 343 | INPUT_PORTS_END | |
| 344 | ||
| 345 | /************************************* | |
| 346 | * | |
| 347 | * 8255 PPIs | |
| 348 | * | |
| 349 | *************************************/ | |
| 350 | ||
| 351 | static READ8_DEVICE_HANDLER(ppi0_c_r) | |
| 352 | { | |
| 353 | /* | |
| 354 | PC7 - unused | |
| 355 | PC6 - unused | |
| 356 | PC5 - unused | |
| 357 | PC4 - Battery Charge control (for 8088 ram backup 3.6v Nicad) | |
| 358 | PC3 - (pulled high externally, input) - unused? possibly for an ABC hopper | |
| 359 | PC2 - (pulled high externally, input) - unused? possibly for an ABC hopper | |
| 360 | PC1 - (pulled high externally, input) - "Hopper Count", | |
| 361 | probably a beam to check the hopper coin out | |
| 362 | PC0 - "Video BZ" (Video Blanking Zone, is an input) | |
| 363 | it's probably vblank or hblank, 0 is always returned, games wait for this bit | |
| 364 | to become 0 before accesing video | |
| 365 | */ | |
| 366 | return 0; | |
| 367 | } | |
| 368 | ||
| 369 | static WRITE8_DEVICE_HANDLER(ppi0_a_w) | |
| 370 | { | |
| 371 | //popmessage("Lamps: %d %d %d %d %d %d %d", BIT(data,7), BIT(data,6), BIT(data,5), BIT(data,4), BIT(data,3), BIT(data,2), BIT(data,1) ); | |
| 372 | output_set_lamp_value(0, !BIT(data,7)); /* Display Light 1 */ | |
| 373 | output_set_lamp_value(1, !BIT(data,6)); /* Display Light 2 */ | |
| 374 | output_set_lamp_value(2, !BIT(data,5)); /* Display Light 3 */ | |
| 375 | output_set_lamp_value(3, !BIT(data,4)); /* Display Light 4 */ | |
| 376 | output_set_lamp_value(4, !BIT(data,3)); /* Display Light 5 */ | |
| 377 | output_set_lamp_value(5, !BIT(data,2)); /* Bet Light */ | |
| 378 | output_set_lamp_value(6, !BIT(data,1)); /* Deal Light */ | |
| 379 | output_set_lamp_value(7, !BIT(data,0)); /* Draw Light */ | |
| 380 | } | |
| 381 | ||
| 382 | static WRITE8_DEVICE_HANDLER(ppi0_b_w) | |
| 383 | { | |
| 384 | output_set_lamp_value(8, !BIT(data,7)); /* Stand Light */ | |
| 385 | output_set_lamp_value(9, !BIT(data,6)); /* Cancel Light */ | |
| 386 | ||
| 387 | coin_counter_w(0, BIT(data,1)); | |
| 388 | coin_lockout_w(0, BIT(data,5)); | |
| 389 | coin_lockout_w(1, BIT(data,4)); | |
| 390 | } | |
| 391 | ||
| 392 | static const ppi8255_interface ppi8255_intf[2] = | |
| 393 | { | |
| 394 | { | |
| 395 | 0, /* Port A read */ | |
| 396 | 0, /* Port B read */ | |
| 397 | ppi0_c_r, /* Port C read */ | |
| 398 | ppi0_a_w, /* Port A write */ | |
| 399 | ppi0_b_w, /* Port B write */ | |
| 400 | 0 /* Port C write */ | |
| 401 | }, | |
| 402 | { | |
| 403 | DEVICE8_PORT("IN0"), /* Port A read */ | |
| 404 | DEVICE8_PORT("IN1"), /* Port B read */ | |
| 405 | DEVICE8_PORT("IN2"), /* Port C read */ | |
| 406 | 0, /* Port A write */ | |
| 407 | 0, /* Port B write */ | |
| 408 | 0 /* Port C write */ | |
| 409 | } | |
| 410 | }; | |
| 411 | ||
| 412 | /************************************* | |
| 413 | * | |
| 414 | * Video | |
| 415 | * | |
| 416 | *************************************/ | |
| 417 | ||
| 418 | static bitmap_t *sms_bitmap; | |
| 419 | ||
| 420 | static UINT8 vid_regs[7]; | |
| 421 | ||
| 422 | WRITE8_HANDLER(video_w) | |
| 423 | { | |
| 424 | vid_regs[offset] = data; | |
| 425 | if ( offset == 5 ) | |
| 426 | { | |
| 427 | int x,y; | |
| 428 | int xstart = vid_regs[0] + vid_regs[1]*256; | |
| 429 | int width = vid_regs[2]; | |
| 430 | int ystart = vid_regs[3]; | |
| 431 | int height = vid_regs[4]; | |
| 432 | int color = vid_regs[5]; | |
| 433 | ||
| 434 | if ( height == 0 ) | |
| 435 | height = 256; | |
| 436 | ||
| 437 | if ( width == 0 ) | |
| 438 | width = 256; | |
| 439 | ||
| 440 | for ( y = ystart; y < ystart + height; y++ ) | |
| 441 | { | |
| 442 | for ( x = xstart; x < xstart + width; x++ ) | |
| 443 | { | |
| 444 | if ( y < 256 ) | |
| 445 | *BITMAP_ADDR16(sms_bitmap, y, x) = color; | |
| 446 | } | |
| 447 | } | |
| 448 | } | |
| 449 | } | |
| 450 | ||
| 451 | static VIDEO_START( sms ) | |
| 452 | { | |
| 453 | sms_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); | |
| 454 | ||
| 455 | state_save_register_global_array(machine, vid_regs); | |
| 456 | state_save_register_global_bitmap(machine, sms_bitmap); | |
| 457 | } | |
| 458 | ||
| 459 | static VIDEO_UPDATE( sms ) | |
| 460 | { | |
| 461 | copybitmap(bitmap, sms_bitmap, 0, 0, 0, 0, cliprect); | |
| 462 | return 0; | |
| 463 | } | |
| 464 | ||
| 465 | static PALETTE_INIT( sms ) | |
| 466 | { | |
| 467 | int i; | |
| 468 | ||
| 469 | for (i = 0; i < 8; i++ ) | |
| 470 | { | |
| 471 | palette_set_color(machine, i, MAKE_RGB(pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i))); | |
| 472 | } | |
| 473 | } | |
| 474 | ||
| 475 | /************************************* | |
| 476 | * | |
| 477 | * Memory maps | |
| 478 | * | |
| 479 | *************************************/ | |
| 480 | ||
| 481 | static ADDRESS_MAP_START( sms_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 482 | AM_RANGE(0x00000, 0x007ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) | |
| 483 | AM_RANGE(0x00800, 0x00803) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) | |
| 484 | AM_RANGE(0x01000, 0x01007) AM_WRITE(video_w) | |
| 485 | AM_RANGE(0x01800, 0x01803) AM_READWRITE(link_r, link_w) | |
| 486 | AM_RANGE(0x04000, 0x07fff) AM_ROMBANK(1) | |
| 487 | AM_RANGE(0x04000, 0x04000) AM_WRITE(bankswitch_w) | |
| 488 | AM_RANGE(0x08000, 0x0ffff) AM_ROM | |
| 489 | AM_RANGE(0xf8000, 0xfffff) AM_ROM // mirror for vectors | |
| 490 | ADDRESS_MAP_END | |
| 491 | ||
| 492 | static ADDRESS_MAP_START( sureshot_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 493 | AM_RANGE(0x00000, 0x007ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) | |
| 494 | AM_RANGE(0x02000, 0x02007) AM_WRITE(video_w) | |
| 495 | AM_RANGE(0x03000, 0x03003) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) | |
| 496 | AM_RANGE(0x03800, 0x03803) AM_READWRITE(link_r, link_w) | |
| 497 | AM_RANGE(0x08000, 0x0ffff) AM_ROM | |
| 498 | AM_RANGE(0xf8000, 0xfffff) AM_ROM // mirror for vectors | |
| 499 | ADDRESS_MAP_END | |
| 500 | ||
| 501 | static ADDRESS_MAP_START( sub_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 502 | AM_RANGE(0x0000, 0x1fff) AM_ROM | |
| 503 | AM_RANGE(0x2000, 0x27ff) AM_RAM | |
| 504 | AM_RANGE(0x3100, 0x3103) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) | |
| 505 | AM_RANGE(0x3381, 0x3381) AM_WRITE(ay8910_write_port_0_w) | |
| 506 | AM_RANGE(0x3382, 0x3382) AM_WRITE(ay8910_control_port_0_w) | |
| 507 | AM_RANGE(0x3400, 0x3400) AM_READ(z80_8088_r) | |
| 508 | AM_RANGE(0x3500, 0x3501) AM_READWRITE(p03_r, p03_w) | |
| 509 | ADDRESS_MAP_END | |
| 510 | ||
| 511 | /************************************* | |
| 512 | * | |
| 513 | * Machine | |
| 514 | * | |
| 515 | *************************************/ | |
| 516 | ||
| 517 | static MACHINE_START( sms ) | |
| 518 | { | |
| 519 | memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "questions"), 0x4000); | |
| 520 | } | |
| 521 | ||
| 522 | static MACHINE_START( sureshot ) | |
| 523 | { | |
| 524 | } | |
| 525 | ||
| 526 | static MACHINE_RESET( sms ) | |
| 527 | { | |
| 528 | communication_port_status = 0; | |
| 529 | ||
| 530 | state_save_register_global(machine, communication_port_status); | |
| 531 | state_save_register_global_array(machine, communication_port); | |
| 532 | } | |
| 533 | ||
| 534 | static MACHINE_DRIVER_START( sms ) | |
| 535 | MDRV_CPU_ADD("main", I8088, XTAL_24MHz/8) | |
| 536 | MDRV_CPU_PROGRAM_MAP(sms_map,0) | |
| 537 | ||
| 538 | MDRV_CPU_ADD("sound", Z80, XTAL_16MHz/8) | |
| 539 | MDRV_CPU_PROGRAM_MAP(sub_map, 0) | |
| 540 | ||
| 541 | MDRV_QUANTUM_TIME(HZ(6000)) | |
| 542 | ||
| 543 | MDRV_MACHINE_START(sms) | |
| 544 | MDRV_MACHINE_RESET(sms) | |
| 545 | ||
| 546 | MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf[0] ) | |
| 547 | MDRV_PPI8255_ADD( "ppi8255_1", ppi8255_intf[1] ) | |
| 548 | ||
| 549 | MDRV_NVRAM_HANDLER(generic_0fill) | |
| 550 | ||
| 551 | /* video hardware */ | |
| 552 | MDRV_SCREEN_ADD("main", RASTER) | |
| 553 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 554 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 555 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 556 | MDRV_SCREEN_SIZE(0x1b0, 0x100) | |
| 557 | MDRV_SCREEN_VISIBLE_AREA(0, 0x1af, 0, 0xff) | |
| 558 | ||
| 559 | MDRV_PALETTE_LENGTH(8) | |
| 560 | ||
| 561 | MDRV_PALETTE_INIT(sms) | |
| 562 | MDRV_VIDEO_START(sms) | |
| 563 | MDRV_VIDEO_UPDATE(sms) | |
| 564 | ||
| 565 | /* sound hardware */ | |
| 566 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 567 | ||
| 568 | MDRV_SOUND_ADD("ay", AY8910, XTAL_16MHz/8) | |
| 569 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 570 | MACHINE_DRIVER_END | |
| 571 | ||
| 572 | static MACHINE_DRIVER_START(sureshot) | |
| 573 | MDRV_IMPORT_FROM(sms) | |
| 574 | ||
| 575 | MDRV_CPU_MODIFY("main") | |
| 576 | MDRV_CPU_PROGRAM_MAP(sureshot_map,0) | |
| 577 | ||
| 578 | MDRV_MACHINE_START(sureshot) | |
| 579 | MACHINE_DRIVER_END | |
| 580 | ||
| 581 | /************************************* | |
| 582 | * | |
| 583 | * ROM definitions | |
| 584 | * | |
| 585 | *************************************/ | |
| 586 | ||
| 587 | /* | |
| 588 | Triva looking board | |
| 589 | Silk screened on front... | |
| 590 | P/N 1001 | |
| 591 | Etched in copper on font... | |
| 592 | COMPONENT SIDE REV 02 | |
| 593 | Etched in copper on back... | |
| 594 | COPYRIGHT SMS 1983 S/N MADE IN USA | |
| 595 | mfg corp | |
| 596 | ||
| 597 | Serial number A4675 etched in board | |
| 598 | ||
| 599 | Large chips | |
| 600 | P8088 | |
| 601 | AY-3-8910 | |
| 602 | CDM6116 x2 | |
| 603 | P8255A-5 | |
| 604 | P8254 | |
| 605 | D8255AC-5 | |
| 606 | D780C-1 | |
| 607 | ||
| 608 | 16 Mhz crystal by D780C (U21) | |
| 609 | 24 Mhz crystal by P8088 (u53) | |
| 610 | ||
| 611 | Open sockets at U50 (40 pin), U15 (24 pin), U2 (40 pin), U25 (24 pin) | |
| 612 | ||
| 613 | Bottom Board | |
| 614 | .U17 - 27128 | |
| 615 | .U16 - 27128 | |
| 616 | .U26 - 2732 - stickered #26 073184 | |
| 617 | .U38 - DMPAL10L8NC - 3 blue dots on it - saved in jedec format | |
| 618 | .U39 - DMPAL10L8NC - 3 green dots on it - saved in jedec format | |
| 619 | .U40 - DMPAL10L8NC - 1 pink dot on it - saved in jedec format | |
| 620 | .U110 - DMPAL10L8NC - 2 pink dots on it - saved in jedec format | |
| 621 | .U52 - DMPAL10L8NC - not labeled - checksum was 0 | |
| 622 | .U32 - DMPAL10L8NC - stickered trivia U32 - couldn't read "device overcurrent" | |
| 623 | .U58 - DMPAL10H8NC - 3 brown dots on it - saved in jedec format | |
| 624 | .U80 - DMPAL10H8NC - 2 blue dots on it - saved in jedec format | |
| 625 | .U130 - DMPAL10H8NC - 3 pink dots on it - saved in jedec format | |
| 626 | .U129 - DMPAL10H8NC - pink-green-pink dots on it - saved in jedec format | |
| 627 | .U128 - DMPAL10H8NC - blue-brown-blue dots on it - saved in jedec format | |
| 628 | .U145 - DMPAL14H4NC - brown dot on it - saved in jedec format | |
| 629 | .U144 - DMPAL14H4NC - brown dot on it - saved in jedec format | |
| 630 | .U143 - DMPAL14H4NC - brown dot on it - saved in jedec format | |
| 631 | .U142 - DMPAL14H4NC - brown dot on it - saved in jedec format | |
| 632 | .U141 - DMPAL14H4NC - brown dot on it - saved in jedec format | |
| 633 | .U140 - DMPAL14H4NC - brown dot on it - saved in jedec format | |
| 634 | U.145-U.140 had the same checksum | |
| 635 | ||
| 636 | .U94 - DMPAL14H4NC - 2 green dots on it - saved in jedec format | |
| 637 | .U109 - DMPAL14H4NC - 2 brown dots on it - saved in jedec format | |
| 638 | ||
| 639 | Daughter Board | |
| 640 | Etched in copper on top... | |
| 641 | SMS MFG M?I 2685 ? = a cage looking symbol | |
| 642 | ||
| 643 | Read starting at top row, closest to connector to main board | |
| 644 | .D0 - DMPAL10L8NC - 1 orange dot on it - saved in jedec format | |
| 645 | .D1 - 27128 - couldn't read sticker - | |
| 646 | .D2 - 27128 - couldn't read sticker - | |
| 647 | .D3 - 27128 - couldn't read sticker - | |
| 648 | .D4 - 27128 - stickered 4 MOVIES .1 ?2485 ? = can't read | |
| 649 | .D5 - 27128 - stickered 3 ANYTHING .4 042485 | |
| 650 | .D6 - 27128 - stickered 2 ANYTHING .3 042485 | |
| 651 | .D7 - 27128 - stickered 1 ANYTHING .2 042485 | |
| 652 | .D8 - 27128 - stickered 0 ANYTHING .1 042485 | |
| 653 | ||
| 654 | 2nd row - left to right | |
| 655 | .D9 - 27128 - stickered 12 MUSIC .1 042485 | |
| 656 | .D10 - 27128 - stickered 13 MUSIC .1 042485 | |
| 657 | .D11 - 27128 - stickered 14 MUSIC .1 042485 | |
| 658 | .D12 - 27128 - stickered 15 MUSIC .1 042485 | |
| 659 | ||
| 660 | 3rd row - left to right | |
| 661 | .D13 - 27128 - stickered 11 SPORTS .4 042485 | |
| 662 | .D14 - 27128 - stickered 10 SPORTS .3 042485 | |
| 663 | .D15 - 27128 - stickered 9 SPORTS .2 042485 | |
| 664 | .D16 - 27128 - stickered 8 SPORTS .1 042485 | |
| 665 | .D17 - DMPAL10L8NC - 1 white dot on it - saved in jedec format | |
| 666 | ||
| 667 | ||
| 668 | ROM text showed... | |
| 669 | COPYRIGHT 1984 SMS MFG CORP | |
| 670 | TRIVIA HANGUP | |
| 671 | SMART ALECS | |
| 672 | */ | |
| 673 | ||
| 674 | ROM_START( trvhang ) | |
| 675 | ROM_REGION( 0x100000, "main", 0 ) | |
| 676 | ROM_LOAD( "sms.17", 0xf8000, 0x04000, CRC(af6ef980) SHA1(f0f98d1f91de718a63b87c5f1c6ee3bd854d1c1b) ) | |
| 677 | ROM_LOAD( "sms.16", 0xfc000, 0x04000, CRC(b827d883) SHA1(68d6c2127ef9e537471c414ca7baa89c63997bbb) ) | |
| 678 | ROM_COPY( "main", 0xf8000, 0x08000, 0x8000 ) | |
| 679 | ||
| 680 | ROM_REGION( 0x10000, "sound", 0 ) | |
| 681 | ROM_LOAD( "sms.26", 0x0000, 0x1000, CRC(e04bb922) SHA1(1df90720f11a5b736273f43272d7727b3020f848) ) | |
| 682 | ROM_RELOAD( 0x1000, 0x1000 ) | |
| 683 | ||
| 684 | ROM_REGION( 0x40000, "questions", 0 ) | |
| 685 | // anything | |
| 686 | ROM_LOAD( "0anything1.d8", 0x00000, 0x4000, CRC(80096807) SHA1(a38b1b13365577c0c588b8e196ee1a6c774ce3a3) ) | |
| 687 | ROM_LOAD( "1anything2.d7", 0x04000, 0x4000, CRC(d09946b6) SHA1(b5827945ce380f09ee758c4296f06f00ef3cbd0a) ) | |
| 688 | ROM_LOAD( "2anything3.d6", 0x08000, 0x4000, CRC(5b12fd09) SHA1(15804480e65bfb3207d24a1679bb78d1ad491d70) ) | |
| 689 | ROM_LOAD( "3anything4.d5", 0x0c000, 0x4000, CRC(f1a37ed7) SHA1(687a610319b21091cbc53232b47eb99dabe12f02) ) | |
| 690 | // movies | |
| 691 | ROM_LOAD( "4movies1.d4", 0x10000, 0x4000, CRC(76993bd1) SHA1(b9a97ab7c6d35f5fdda04342e0b3773618deedef) ) | |
| 692 | ROM_LOAD( "5movies1.d3", 0x14000, 0x4000, CRC(8c5f62ef) SHA1(34ac235358a71620a6619dbb16255c363f34df53) ) | |
| 693 | ROM_LOAD( "6movies1.d2", 0x18000, 0x4000, CRC(13c9fe08) SHA1(6b7d055621ce578446d320f98f7a4cd095e756b0) ) | |
| 694 | ROM_LOAD( "7movies1.d1", 0x1c000, 0x4000, CRC(04f627c0) SHA1(c656b66c60059a1b068c4a7262f07f4c136c34c1) ) | |
| 695 | // sports | |
| 696 | ROM_LOAD( "8sports1.d16", 0x20000, 0x4000, CRC(b700e7e6) SHA1(42b2c12c6af5f15d909e15ee3e7ca2e13e0142c2) ) | |
| 697 | ROM_LOAD( "9sports2.d15", 0x24000, 0x4000, CRC(bec225fe) SHA1(13252894eca30e06354885a21ecad43965cfd3ef) ) | |
| 698 | ROM_LOAD( "10sports3.d14", 0x28000, 0x4000, CRC(3bfe9b52) SHA1(0cdd9ec6ed784fab9272d50821994be5b0fd0532) ) | |
| 699 | ROM_LOAD( "11sports4.d13", 0x2c000, 0x4000, CRC(9bb8dbad) SHA1(0dd9ed23e6794a86a12906b326e984a2d58cc4c6) ) | |
| 700 | // music | |
| 701 | ROM_LOAD( "12music1.d9", 0x30000, 0x4000, CRC(c1691ec9) SHA1(95725fa315944c0786e2a32d483703173eb2e730) ) | |
| 702 | ROM_LOAD( "13music1.d10", 0x34000, 0x4000, CRC(df0da39f) SHA1(29103dca8b0c1967791e8ddd722153874e16bbda) ) | |
| 703 | ROM_LOAD( "14music1.d11", 0x38000, 0x4000, CRC(114b4aa6) SHA1(2621d1042b0774d60be88cc8d62613aa07c12552) ) | |
| 704 | ROM_LOAD( "15music1.d12", 0x3c000, 0x4000, CRC(59a40e4f) SHA1(e726ce624c76ee527edc51c1e5757b7d433dcf8c) ) | |
| 705 | ||
| 706 | ||
| 707 | ROM_REGION( 0x1000, "plds", 0 ) | |
| 708 | ROM_LOAD( "dmpal10l8nc.d17.bin", 0x000000, 0x0001f3, CRC(e9eb78e7) SHA1(688e854e82c230d367c211f611e9a8298ab64399) ) | |
| 709 | ROM_LOAD( "dmpal10l8nc.38.bin", 0x000000, 0x0001f3, CRC(be17ebde) SHA1(22c05eeafeadc8f55b55951c2060fb4873146cba) ) | |
| 710 | ROM_LOAD( "dmpal10l8nc.39.bin", 0x000000, 0x0001f3, CRC(3299e803) SHA1(12f361d27497f6347ee26838fa9f675f6aac12c2) ) | |
| 711 | ROM_LOAD( "dmpal10l8nc.40.bin", 0x000000, 0x0001f3, CRC(22881f1c) SHA1(646fdc4e4a423e1432b448140f2d92dd2304ff71) ) | |
| 712 | ROM_LOAD( "dmpal10l8nc.52.bin", 0x000000, 0x0001f3, CRC(2e43ba5f) SHA1(8b87ee8ce21f5241260f2d0de4878096d8ecb5f5) ) | |
| 713 | ROM_LOAD( "dmpal10h8nc.58.bin", 0x000000, 0x0001f3, CRC(020b5108) SHA1(f3221fbce40a9d6fdc2eece606e4eded3faf5f02) ) | |
| 714 | ROM_LOAD( "dmpal10h8nc.80.bin", 0x000000, 0x0001f3, CRC(66e21ee5) SHA1(31c29a250f50dcdf531810e59068adfea4d2d9a3) ) | |
| 715 | ROM_LOAD( "dmpal14h4nc.94.bin", 0x000000, 0x000283, CRC(c5fda3df) SHA1(4fdd597d25ed893cb005165b68e48567fbd2b1ce) ) | |
| 716 | ROM_LOAD( "dmpal14h4nc.109.bin", 0x000000, 0x000283, CRC(15d05aaa) SHA1(57500b4825a1da943d79ee7df657efed56c4320e) ) | |
| 717 | ROM_LOAD( "dmpal10l8nc.110.bin", 0x000000, 0x0001f3, CRC(6263b1e1) SHA1(6c8d92bcbbc2d196b5ac7765888eaf171671d651) ) | |
| 718 | ROM_LOAD( "dmpal10h8nc.128.bin", 0x000000, 0x0001f3, CRC(fbaea5b0) SHA1(85a757485c26304d4ce718fd954aa4736cdc4752) ) | |
| 719 | ROM_LOAD( "dmpal10h8nc.129.bin", 0x000000, 0x0001f3, CRC(4722fb3b) SHA1(adc0a3c0721acaa5b447c7aee771703caab80dd9) ) | |
| 720 | ROM_LOAD( "dmpal10h8nc.130.bin", 0x000000, 0x0001f3, CRC(d3f0a6a5) SHA1(5e08b6104dfd3e463031b2b12619589a8f7b453c) ) | |
| 721 | ROM_LOAD( "dmpal14h4nc.140.bin", 0x000000, 0x000283, CRC(031f662d) SHA1(6fa072db3203cdb95262d7778a6ee8310423b3df) ) | |
| 722 | ROM_LOAD( "dmpal14h4nc.141.bin", 0x000000, 0x000283, CRC(031f662d) SHA1(6fa072db3203cdb95262d7778a6ee8310423b3df) ) | |
| 723 | ROM_LOAD( "dmpal14h4nc.142.bin", 0x000000, 0x000283, CRC(031f662d) SHA1(6fa072db3203cdb95262d7778a6ee8310423b3df) ) | |
| 724 | ROM_LOAD( "dmpal14h4nc.143.bin", 0x000000, 0x000283, CRC(031f662d) SHA1(6fa072db3203cdb95262d7778a6ee8310423b3df) ) | |
| 725 | ROM_LOAD( "dmpal14h4nc.144.bin", 0x000000, 0x000283, CRC(031f662d) SHA1(6fa072db3203cdb95262d7778a6ee8310423b3df) ) | |
| 726 | ROM_LOAD( "dmpal14h4nc.145.bin", 0x000000, 0x000283, CRC(031f662d) SHA1(6fa072db3203cdb95262d7778a6ee8310423b3df) ) | |
| 727 | ROM_LOAD( "dmpal10l8nc.d0.bin", 0x000000, 0x0001f3, CRC(b1c221a7) SHA1(f63a022199a2d7b52c4c4827b170d49aae85e4e3) ) | |
| 728 | ROM_END | |
| 729 | ||
| 730 | /* | |
| 731 | Etched in copper on back COPYRIGHT SMS 1983 | |
| 732 | mfg corp. S/N A-2043 | |
| 733 | A-2043 was hand etched | |
| 734 | ||
| 735 | 16MHz Crystal | |
| 736 | 24MHz Crystal | |
| 737 | D780C | |
| 738 | D8255AC-5 | |
| 739 | P8255A-5 | |
| 740 | P8088 | |
| 741 | AY-3-8910 | |
| 742 | 6116 x2 | |
| 743 | P8254 | |
| 744 | ||
| 745 | Empty 40 pin socket at U2 and U50 | |
| 746 | Empty 24 pin socket at U25 | |
| 747 | Empty 28 pin socket at U18 | |
| 748 | ||
| 749 | ||
| 750 | ||
| 751 | .u16 28128 stickered U-16 | |
| 752 | TRIVIA -2 | |
| 753 | 011586 | |
| 754 | ||
| 755 | .u17 28128 stickered U-16 | |
| 756 | TRIVIA -2 | |
| 757 | 011586 | |
| 758 | ||
| 759 | .u19 28128 stickered U-16 | |
| 760 | TRIVIA DLXE | |
| 761 | 021281 | |
| 762 | ||
| 763 | .u26 2732 stickered #26 | |
| 764 | 073184 | |
| 765 | ||
| 766 | ||
| 767 | the pal's had colored dots on them | |
| 768 | saved in JEDEC format | |
| 769 | .32 dmpal10l8nc red red blue | |
| 770 | .52 dmpal10l8nc red red white | |
| 771 | .38 dmpal10l8nc blue blue blue | |
| 772 | .39 dmpal10l8nc green green green | |
| 773 | .40 dmpal10l8nc pink | |
| 774 | .110 dmpal10l8nc pink pink | |
| 775 | .58 dmpal10h8nc brown brown brown | |
| 776 | .80 dmpal10h8nc blue blue | |
| 777 | .128 dmpal10h8nc blue brown blue | |
| 778 | .129 dmpal10h8nc pink green pink | |
| 779 | .130 dmpal10h8nc pink scratched off | |
| 780 | .94 dmpal14h4nc green green | |
| 781 | .109 dmpal14h4nc brown brown | |
| 782 | .140 dmpal14h4nc brown | |
| 783 | .141 dmpal14h4nc brown | |
| 784 | .142 dmpal14h4nc brown | |
| 785 | .143 dmpal14h4nc brown | |
| 786 | .144 dmpal14h4nc brown | |
| 787 | .145 dmpal14h4nc brown | |
| 788 | */ | |
| 789 | ||
| 790 | ROM_START( trvhanga ) | |
| 791 | ROM_REGION( 0x100000, "main", 0 ) | |
| 792 | ROM_LOAD( "sms2.u17", 0xf8000, 0x04000, CRC(e5c880a1) SHA1(da777c4e126da2f03a663f8c8f565bda8520c883) ) | |
| 793 | ROM_LOAD( "sms2.16", 0xfc000, 0x04000, CRC(85484aee) SHA1(7c282bd208bd644d5d57ac399942c95211e87bf4) ) | |
| 794 | ROM_COPY( "main", 0xf8000, 0x08000, 0x8000 ) | |
| 795 | ||
| 796 | ROM_REGION( 0x10000, "sound", 0 ) | |
| 797 | ROM_LOAD( "sms2.26", 0x0000, 0x1000, CRC(e04bb922) SHA1(1df90720f11a5b736273f43272d7727b3020f848) ) | |
| 798 | ROM_RELOAD( 0x1000, 0x1000 ) | |
| 799 | ||
| 800 | ROM_REGION( 0x4000, "user", 0 ) | |
| 801 | ROM_LOAD( "sms2.u19", 0x00000, 0x04000, CRC(5e10059b) SHA1(f0eb490d41009ffe1c80216f699557480110954b) ) // unknown rom (leftover from conversion?) | |
| 802 | ||
| 803 | ROM_REGION( 0x40000, "questions", 0 ) | |
| 804 | // sex | |
| 805 | ROM_LOAD( "0sex1.d8", 0x00000, 0x4000, NO_DUMP ) | |
| 806 | ROM_LOAD( "1sex2.d7", 0x04000, 0x4000, NO_DUMP ) | |
| 807 | ROM_LOAD( "2sex3.d6", 0x08000, 0x4000, NO_DUMP ) | |
| 808 | ROM_LOAD( "3sex4.d5", 0x0c000, 0x4000, NO_DUMP ) | |
| 809 | // movies | |
| 810 | ROM_LOAD( "4movies1.d4", 0x10000, 0x4000, NO_DUMP ) | |
| 811 | ROM_LOAD( "5movies1.d3", 0x14000, 0x4000, NO_DUMP ) | |
| 812 | ROM_LOAD( "6movies1.d2", 0x18000, 0x4000, NO_DUMP ) | |
| 813 | ROM_LOAD( "7movies1.d1", 0x1c000, 0x4000, NO_DUMP ) | |
| 814 | // sports | |
| 815 | ROM_LOAD( "8sports1.d16", 0x20000, 0x4000, NO_DUMP ) | |
| 816 | ROM_LOAD( "9sports2.d15", 0x24000, 0x4000, NO_DUMP ) | |
| 817 | ROM_LOAD( "10sports3.d14", 0x28000, 0x4000, NO_DUMP ) | |
| 818 | ROM_LOAD( "11sports4.d13", 0x2c000, 0x4000, NO_DUMP ) | |
| 819 | // music | |
| 820 | ROM_LOAD( "12music1.d9", 0x30000, 0x4000, NO_DUMP ) | |
| 821 | ROM_LOAD( "13music1.d10", 0x34000, 0x4000, NO_DUMP ) | |
| 822 | ROM_LOAD( "14music1.d11", 0x38000, 0x4000, NO_DUMP ) | |
| 823 | ROM_LOAD( "15music1.d12", 0x3c000, 0x4000, NO_DUMP ) | |
| 824 | ||
| 825 | ROM_REGION( 0x1000, "plds", 0 ) | |
| 826 | ROM_LOAD( "dmpal10l8nc.32.bin", 0x000000, 0x00002c, CRC(558ca47e) SHA1(4612e5dd9832bcbf6d7b3bce803f92ea2ee03b98) ) | |
| 827 | ROM_LOAD( "dmpal10l8nc.38.bin", 0x000000, 0x00002c, CRC(84c39631) SHA1(8aa28be5418dd119883a9d400f23927e0cf8d7b4) ) | |
| 828 | ROM_LOAD( "dmpal10l8nc.39.bin", 0x000000, 0x00002c, CRC(ab950780) SHA1(73e8eb8050ca337e58b34513a9cf522e4fb43b5d) ) | |
| 829 | ROM_LOAD( "dmpal10l8nc.40.bin", 0x000000, 0x00002c, CRC(a2de5f30) SHA1(ea2293f6b979aa16ccf1c8d6c88ea484ef45ea6b) ) | |
| 830 | ROM_LOAD( "dmpal10l8nc.52.bin", 0x000000, 0x00002c, CRC(5d09ff76) SHA1(0b977db9dc465a36975b935d3585f404b86de293) ) | |
| 831 | ROM_LOAD( "dmpal10h8nc.58.bin", 0x000000, 0x00002c, CRC(3df46d79) SHA1(606040b69908635ab5166193c53557ffa524c9d3) ) | |
| 832 | ROM_LOAD( "dmpal10h8nc.80.bin", 0x000000, 0x00002c, CRC(7bd4fbf5) SHA1(a2951bcf6af2a6d0211070c2dc49b8c1e9b78b9b) ) | |
| 833 | ROM_LOAD( "dmpal14h4nc.94.bin", 0x000000, 0x00003c, CRC(43a4e3f1) SHA1(afc530cc52ac04abce33b7c61e256da1cb30eb23) ) | |
| 834 | ROM_LOAD( "dmpal14h4nc.109.bin", 0x000000, 0x00003c, CRC(98542c78) SHA1(282d06701da1130d9ca0fcbd81ea89f1462693e2) ) | |
| 835 | ROM_LOAD( "dmpal10l8nc.110.bin", 0x000000, 0x00002c, CRC(f59c1868) SHA1(cc75ce71057360e62ea3ea929f241dc6105f1362) ) | |
| 836 | ROM_LOAD( "dmpal10h8nc.128.bin", 0x000000, 0x00002c, CRC(083cd773) SHA1(70a49a53d549b90c7a036f4afaf92759bf8e20c9) ) | |
| 837 | ROM_LOAD( "dmpal10h8nc.129.bin", 0x000000, 0x00002c, CRC(c5841a1a) SHA1(f2929321b041114f771e9fba4cbe2fb36c26a053) ) | |
| 838 | ROM_LOAD( "dmpal10h8nc.130.bin", 0x000000, 0x00002c, CRC(a4051372) SHA1(23b200f3950e583cc40b3cc82d62e274294e5593) ) | |
| 839 | ROM_LOAD( "dmpal14h4nc.140.bin", 0x000000, 0x00003c, CRC(c921d183) SHA1(db7be592058456e83a8603cf839f5664ea0a0f76) ) | |
| 840 | ROM_LOAD( "dmpal14h4nc.141.bin", 0x000000, 0x00003c, CRC(c921d183) SHA1(db7be592058456e83a8603cf839f5664ea0a0f76) ) | |
| 841 | ROM_LOAD( "dmpal14h4nc.142.bin", 0x000000, 0x00003c, CRC(c921d183) SHA1(db7be592058456e83a8603cf839f5664ea0a0f76) ) | |
| 842 | ROM_LOAD( "dmpal14h4nc.143.bin", 0x000000, 0x00003c, CRC(c921d183) SHA1(db7be592058456e83a8603cf839f5664ea0a0f76) ) | |
| 843 | ROM_LOAD( "dmpal14h4nc.144.bin", 0x000000, 0x00003c, CRC(c921d183) SHA1(db7be592058456e83a8603cf839f5664ea0a0f76) ) | |
| 844 | ROM_LOAD( "dmpal14h4nc.145.bin", 0x000000, 0x00003c, CRC(ab2af8de) SHA1(775495d47435c23eecf3defba15f5ca890836354) ) | |
| 845 | ROM_END | |
| 846 | ||
| 847 | ROM_START( sureshot ) | |
| 848 | ROM_REGION( 0x100000, "main", 0 ) | |
| 849 | ROM_LOAD( "u-19 hldly s.shot 020687.u19.a12.bin", 0xf8000, 0x02000, CRC(028bdb61) SHA1(e39c27cc6dec12de5a5e60d544f35448e49baee1) ) | |
| 850 | ROM_LOAD( "u-18 hldly s.shot 020687.u18.a11.bin", 0xfa000, 0x02000, CRC(5aa083f1) SHA1(3eed1a7421e7abcc41a1bddf655b1e777d843898) ) | |
| 851 | ROM_LOAD( "u-17 hldly s.shot 020687.u17.a10.bin", 0xfc000, 0x02000, CRC(a37432d6) SHA1(398462642ab0b34efdb6ff4756758057b9833e10) ) | |
| 852 | ROM_LOAD( "u-16 hldly s.shot 020687.u16.a9.bin", 0xfe000, 0x02000, CRC(d7f756d5) SHA1(5c7f62b02b4d4836881c3da0604448c34ede674b) ) | |
| 853 | ROM_COPY( "main", 0xf8000, 0x08000, 0x8000 ) | |
| 854 | ||
| 855 | ROM_REGION( 0x10000, "sound", 0 ) | |
| 856 | ROM_LOAD( "26 404 073184.u26.b5.bin", 0x0000, 0x1000, CRC(e04bb922) SHA1(1df90720f11a5b736273f43272d7727b3020f848) ) | |
| 857 | ROM_RELOAD( 0x1000, 0x1000 ) | |
| 858 | ROM_END | |
| 859 | ||
| 860 | GAME( 1984, trvhang, 0, sms, sms, 0, ROT0, "SMS MFG CORP", "Trivia Hangup (Question Set 1)", GAME_SUPPORTS_SAVE ) /* Version Trivia-1-050185 */ | |
| 861 | GAME( 1984, trvhanga, 0, sms, sms, 0, ROT0, "SMS MFG CORP", "Trivia Hangup (Question Set 2)", GAME_NOT_WORKING ) /* Version Trivia-2-011586 */ | |
| 862 | GAME( 1985, sureshot, 0, sureshot, sms, 0, ROT0, "SMS MFG CORP", "Sure Shot", GAME_SUPPORTS_SAVE ) |
| r4135 | r4136 | |
|---|---|---|
| 83 | 83 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 84 | 84 | AM_RANGE(0x0000, 0x03ff) AM_RAM |
| 85 | 85 | |
| 86 | AM_RANGE(0x6000, 0x63ff) AM_RAM AM_BASE(&madalien_videoram) | |
| 86 | AM_RANGE(0x6000, 0x63ff) AM_RAM_WRITE(madalien_videoram_w) AM_BASE(&madalien_videoram) | |
| 87 | 87 | AM_RANGE(0x6400, 0x67ff) AM_RAM |
| 88 | AM_RANGE(0x6800, 0x7fff) AM_RAM AM_BASE(&madalien_charram) | |
| 88 | AM_RANGE(0x6800, 0x7fff) AM_RAM_WRITE(madalien_charram_w) AM_BASE(&madalien_charram) | |
| 89 | 89 | |
| 90 | 90 | AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0ff0) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w) |
| 91 | 91 | AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x0ff0) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w) |
| r4135 | r4136 | |
|---|---|---|
| 229 | 229 | NULL |
| 230 | 230 | }; |
| 231 | 231 | |
| 232 | static MACHINE_START( formatz ) | |
| 233 | { | |
| 234 | state_save_register_global(machine, disable_irq); | |
| 235 | } | |
| 236 | ||
| 232 | 237 | static MACHINE_DRIVER_START( formatz ) |
| 233 | 238 | |
| 234 | 239 | /* basic machine hardware */ |
| r4135 | r4136 | |
| 240 | 245 | MDRV_CPU_PROGRAM_MAP(sound_map,0) |
| 241 | 246 | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| 242 | 247 | |
| 248 | MDRV_MACHINE_START(formatz) | |
| 249 | ||
| 243 | 250 | /* video hardware */ |
| 244 | 251 | MDRV_SCREEN_ADD("main", RASTER) |
| 245 | 252 | MDRV_SCREEN_REFRESH_RATE(60) |
| r4135 | r4136 | |
| 329 | 336 | |
| 330 | 337 | |
| 331 | 338 | |
| 332 | GAME( 1984, formatz, 0, formatz, formatz, 0, ROT0, "Jaleco", "Formation Z", GAME_IMPERFECT_GRAPHICS ) | |
| 333 | GAME( 1984, aeroboto, formatz, formatz, formatz, 0, ROT0, "[Jaleco] (Williams license)", "Aeroboto", GAME_IMPERFECT_GRAPHICS ) | |
| 339 | GAME( 1984, formatz, 0, formatz, formatz, 0, ROT0, "Jaleco", "Formation Z", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) | |
| 340 | GAME( 1984, aeroboto, formatz, formatz, formatz, 0, ROT0, "[Jaleco] (Williams license)", "Aeroboto", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) |
| r4135 | r4136 | |
|---|---|---|
| 460 | 460 | |
| 461 | 461 | static VIDEO_START(mastboy) |
| 462 | 462 | { |
| 463 | gfx_element_set_source(machine->gfx[0], mastboy_vram); | |
| 463 | 464 | } |
| 464 | 465 | |
| 465 | 466 | static VIDEO_UPDATE(mastboy) |
| r4135 | r4136 | |
| 563 | 564 | mastboy_vram[offs] = data^0xff; |
| 564 | 565 | |
| 565 | 566 | /* Decode the new tile */ |
| 566 | | |
| 567 | gfx_el | |
| 567 | 568 | } |
| 568 | 569 | } |
| 569 | 570 | else |
| r4135 | r4136 | |
|---|---|---|
| 199 | 199 | |
| 200 | 200 | // defined in drivers/nwk-tr.c |
| 201 | 201 | int K001604_vh_start(running_machine *machine, int chip); |
| 202 | void K001604_tile_update(running_machine *machine, int chip); | |
| 203 | 202 | void K001604_draw_front_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect); |
| 204 | 203 | void K001604_draw_back_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect); |
| 205 | 204 | READ32_HANDLER(K001604_tile_r); |
| r4135 | r4136 | |
| 224 | 223 | { |
| 225 | 224 | bitmap_fill(bitmap, cliprect, screen->machine->pens[0]); |
| 226 | 225 | |
| 227 | K001604_tile_update(screen->machine, 0); | |
| 228 | 226 | K001005_draw(bitmap, cliprect); |
| 229 | 227 | |
| 230 | 228 | K001604_draw_front_layer(0, bitmap, cliprect); |
| r4135 | r4136 | |
| 505 | 503 | AM_RANGE(0x780c0000, 0x780c0007) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc) |
| 506 | 504 | AM_RANGE(0x7e000000, 0x7e003fff) AM_MIRROR(0x80000000) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff) |
| 507 | 505 | AM_RANGE(0x7e008000, 0x7e009fff) AM_MIRROR(0x80000000) AM_READWRITE8(K056230_r, K056230_w, 0xffffffff) /* LANC registers */ |
| 508 | AM_RANGE(0x7e00a000, 0x7e00bfff) AM_MIRROR(0x80000000) AM_READWRITE(lanc_ram_r, lanc_ram_w) /* LANC Buffer RAM (27E) */ | |
| 506 | AM_RANGE(0x7e00a000, 0x7e00bfff) AM_MIRROR(0x80000000) AM_READWRITE(lanc_ram_r, lanc_ram_w) AM_BASE(&lanc_ram) /* LANC Buffer RAM (27E) */ | |
| 509 | 507 | AM_RANGE(0x7e00c000, 0x7e00c007) AM_MIRROR(0x80000000) AM_WRITE(K056800_host_w) |
| 510 | 508 | AM_RANGE(0x7e00c008, 0x7e00c00f) AM_MIRROR(0x80000000) AM_READ(K056800_host_r) |
| 511 | 509 | AM_RANGE(0x7f000000, 0x7f3fffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION("user2", 0) |
| r4135 | r4136 | |
|---|---|---|
| 43 | 43 | |
| 44 | 44 | Or last value when wheel delta = 0 |
| 45 | 45 | */ |
| 46 | #define AMSPDWY_WHEEL_R( _n_ ) \ | |
| 47 | static READ8_HANDLER( amspdwy_wheel_##_n_##_r ) \ | |
| 48 | { \ | |
| 49 | static UINT8 wheel_old, ret; \ | |
| 50 | static const char *const portnames[] = { "WHEEL1", "WHEEL2", "AN1", "AN2" };\ | |
| 51 | UINT8 wheel; \ | |
| 52 | wheel = input_port_read(space->machine, portnames[2 + _n_]); \ | |
| 53 | if (wheel != wheel_old) \ | |
| 54 | { \ | |
| 55 | wheel = (wheel & 0x7fff) - (wheel & 0x8000); \ | |
| 56 | if (wheel > wheel_old) ret = ((+wheel) & 0xf) | 0x00; \ | |
| 57 | else ret = ((-wheel) & 0xf) | 0x10; \ | |
| 58 | wheel_old = wheel; \ | |
| 59 | } \ | |
| 60 | return ret | input_port_read(space->machine, portnames[_n_]); \ | |
| 46 | ||
| 47 | static UINT8 wheel_old[2]; | |
| 48 | static UINT8 wheel_return[2]; | |
| 49 | ||
| 50 | static UINT8 amspdwy_wheel_r(running_machine *machine, int index) | |
| 51 | { | |
| 52 | static const char *const portnames[] = { "WHEEL1", "WHEEL2", "AN1", "AN2" }; | |
| 53 | UINT8 wheel; | |
| 54 | wheel = input_port_read(machine, portnames[2 + index]); | |
| 55 | if (wheel != wheel_old[index]) | |
| 56 | { | |
| 57 | wheel = (wheel & 0x7fff) - (wheel & 0x8000); | |
| 58 | if (wheel > wheel_old[index]) wheel_return[index] = ((+wheel) & 0xf) | 0x00; | |
| 59 | else wheel_return[index] = ((-wheel) & 0xf) | 0x10; | |
| 60 | wheel_old[index] = wheel; | |
| 61 | } | |
| 62 | return wheel_return[index] | input_port_read(machine, portnames[index]); | |
| 61 | 63 | } |
| 62 | AMSPDWY_WHEEL_R( 0 ) | |
| 63 | AMSPDWY_WHEEL_R( 1 ) | |
| 64 | 64 | |
| 65 | static READ8_HANDLER( amspdwy_wheel_0_r ) | |
| 66 | { | |
| 67 | return amspdwy_wheel_r(space->machine, 0); | |
| 68 | } | |
| 65 | 69 | |
| 70 | static READ8_HANDLER( amspdwy_wheel_1_r ) | |
| 71 | { | |
| 72 | return amspdwy_wheel_r(space->machine, 0); | |
| 73 | } | |
| 74 | ||
| 66 | 75 | static READ8_HANDLER( amspdwy_sound_r ) |
| 67 | 76 | { |
| 68 | 77 | return (ym2151_status_port_0_r(space,0) & ~ 0x30) | input_port_read(space->machine, "IN0"); |
| r4135 | r4136 | |
| 250 | 259 | irq_handler |
| 251 | 260 | }; |
| 252 | 261 | |
| 262 | static MACHINE_START( amspdwy ) | |
| 263 | { | |
| 264 | wheel_old[0] = wheel_old[1] = 0; | |
| 265 | wheel_return[0] = wheel_return[1] = 0; | |
| 266 | state_save_register_global_array(machine, wheel_old); | |
| 267 | state_save_register_global_array(machine, wheel_return); | |
| 268 | } | |
| 253 | 269 | |
| 254 | 270 | static MACHINE_DRIVER_START( amspdwy ) |
| 255 | 271 | |
| r4135 | r4136 | |
| 262 | 278 | MDRV_CPU_ADD("audio", Z80,3000000) /* Can't be disabled: the YM2151 timers must work */ |
| 263 | 279 | MDRV_CPU_PROGRAM_MAP(amspdwy_sound_map,0) |
| 264 | 280 | |
| 281 | MDRV_MACHINE_START(amspdwy) | |
| 282 | ||
| 265 | 283 | /* video hardware */ |
| 266 | 284 | MDRV_SCREEN_ADD("main", RASTER) |
| 267 | 285 | MDRV_SCREEN_REFRESH_RATE(60) |
| r4135 | r4136 | |
| 376 | 394 | |
| 377 | 395 | /* (C) 1987 ETI 8402 MAGNOLIA ST. #C SANTEE, CA 92071 */ |
| 378 | 396 | |
| 379 | GAME( 1987, amspdwy, 0, amspdwy, amspdwy, 0, ROT0, "Enerdyne Technologies, Inc.", "American Speedway (set 1)", 0 ) | |
| 380 | GAME( 1987, amspdwya, amspdwy, amspdwy, amspdwya, 0, ROT0, "Enerdyne Technologies, Inc.", "American Speedway (set 2)", 0 ) | |
| 397 | GAME( 1987, amspdwy, 0, amspdwy, amspdwy, 0, ROT0, "Enerdyne Technologies, Inc.", "American Speedway (set 1)", GAME_SUPPORTS_SAVE ) | |
| 398 | GAME( 1987, amspdwya, amspdwy, amspdwy, amspdwya, 0, ROT0, "Enerdyne Technologies, Inc.", "American Speedway (set 2)", GAME_SUPPORTS_SAVE ) |
| r0 | r4136 | |
|---|---|---|
| 1 | /* New Champion Skill by IGS | |
| 2 | -- the dump MAY be incomplete, there were 3 empty positions on the PCB near | |
| 3 | the gfx roms | |
| 4 | ||
| 5 | Chips of Note | |
| 6 | ||
| 7 | IGS 003C (near chip with TEST OK E0069281 label) | |
| 8 | IGS 002 | |
| 9 | IGA 001A | |
| 10 | ||
| 11 | ||
| 12 | 'file' | |
| 13 | KC8255A | |
| 14 | 9941 | |
| 15 | (near CPU roms) | |
| 16 | ||
| 17 | UM3567 9946 | |
| 18 | ||
| 19 | 5x 8 switch dips | |
| 20 | ||
| 21 | Clocks | |
| 22 | 3.579545Mhz (near sound) | |
| 23 | 12Mhz | |
| 24 | ||
| 25 | ||
| 26 | --- what is the CPU, it looks like either Z80 or Z180 based | |
| 27 | -- CPU rom is lightly encrypted (usual IGS style, some xors) | |
| 28 | ||
| 29 | */ | |
| 30 | ||
| 31 | #include "driver.h" | |
| 32 | #include "cpu/z180/z180.h" | |
| 33 | #include "sound/2413intf.h" | |
| 34 | #include "deprecat.h" | |
| 35 | ||
| 36 | static UINT8*ncs_video; | |
| 37 | static UINT8*ncs_video2; | |
| 38 | ||
| 39 | VIDEO_START(igs_ncs) | |
| 40 | { | |
| 41 | ||
| 42 | } | |
| 43 | ||
| 44 | VIDEO_UPDATE(igs_ncs) | |
| 45 | { | |
| 46 | const gfx_element *gfx = screen->machine->gfx[0]; | |
| 47 | int count = 0; | |
| 48 | ||
| 49 | int y,x; | |
| 50 | ||
| 51 | ||
| 52 | for (y=0;y<32;y++) | |
| 53 | { | |
| 54 | for (x=0;x<64;x++) | |
| 55 | { | |
| 56 | int tile = ncs_video[count] | (ncs_video[count+0x800]<<8); | |
| 57 | int colour = (tile >> 12) & 0x7; | |
| 58 | ||
| 59 | drawgfx(bitmap,gfx,tile&0x1fff,colour+1,0,0,x*8,y*8,cliprect,TRANSPARENCY_NONE,0); | |
| 60 | ||
| 61 | count++; | |
| 62 | } | |
| 63 | } | |
| 64 | ||
| 65 | ||
| 66 | return 0; | |
| 67 | } | |
| 68 | ||
| 69 | static const gfx_layout layout_8x8x6 = | |
| 70 | { | |
| 71 | 8, 8, | |
| 72 | RGN_FRAC(1, 3), | |
| 73 | 6, | |
| 74 | { RGN_FRAC(0,3)+8,RGN_FRAC(0,3)+0, | |
| 75 | RGN_FRAC(1,3)+8,RGN_FRAC(1,3)+0, | |
| 76 | RGN_FRAC(2,3)+8,RGN_FRAC(2,3)+0 }, | |
| 77 | { STEP8(0,1) }, | |
| 78 | { STEP8(0,2*8) }, | |
| 79 | 8*8*2 | |
| 80 | }; | |
| 81 | ||
| 82 | static GFXDECODE_START( igs_ncs ) | |
| 83 | GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x6, 0, 16 ) | |
| 84 | GFXDECODE_END | |
| 85 | ||
| 86 | static INPUT_PORTS_START( igs_ncs ) | |
| 87 | INPUT_PORTS_END | |
| 88 | ||
| 89 | static ADDRESS_MAP_START( igs_ncs_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 90 | AM_RANGE( 0x00000, 0x0efff ) AM_ROM | |
| 91 | AM_RANGE( 0x0f000, 0x0ffff ) AM_RAM | |
| 92 | ADDRESS_MAP_END | |
| 93 | ||
| 94 | static READ8_HANDLER( ncs_random_r ) | |
| 95 | { | |
| 96 | return 0xff;// mame_rand(space->machine); | |
| 97 | } | |
| 98 | ||
| 99 | static ADDRESS_MAP_START( igs_ncs_portmap, ADDRESS_SPACE_IO, 8 ) | |
| 100 | AM_RANGE( 0x2000, 0x23ff ) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_BASE( &paletteram ) | |
| 101 | AM_RANGE( 0x2800, 0x2cff ) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_BASE( &paletteram_2 ) | |
| 102 | ||
| 103 | ||
| 104 | AM_RANGE( 0x4000, 0x4000 ) AM_READ(ncs_random_r) | |
| 105 | AM_RANGE( 0x4001, 0x4001 ) AM_READ(ncs_random_r) | |
| 106 | AM_RANGE( 0x4002, 0x4002 ) AM_READ(ncs_random_r) | |
| 107 | AM_RANGE( 0x4003, 0x4003 ) AM_READ(ncs_random_r) | |
| 108 | AM_RANGE( 0x4004, 0x4004 ) AM_READ(ncs_random_r) | |
| 109 | ||
| 110 | ||
| 111 | AM_RANGE( 0x5081, 0x5081 ) AM_READ(ncs_random_r) | |
| 112 | AM_RANGE( 0x5082, 0x5082 ) AM_READ(ncs_random_r) | |
| 113 | ||
| 114 | AM_RANGE( 0x5082, 0x5091 ) AM_READ(ncs_random_r) | |
| 115 | ||
| 116 | AM_RANGE( 0x50a0, 0x50a0 ) AM_READ(ncs_random_r) | |
| 117 | AM_RANGE( 0x50c0, 0x50c0 ) AM_READ(ncs_random_r) | |
| 118 | ||
| 119 | AM_RANGE( 0x6000, 0x6fff ) AM_RAM AM_BASE(&ncs_video2) // 'reels' layer -- we're missing the gfx | |
| 120 | ||
| 121 | AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_BASE(&ncs_video) | |
| 122 | ||
| 123 | ||
| 124 | AM_RANGE( 0x8000, 0xffff ) AM_ROM AM_REGION("data", 0) | |
| 125 | ||
| 126 | ADDRESS_MAP_END | |
| 127 | ||
| 128 | static INTERRUPT_GEN( igs_ncs_interrupt ) | |
| 129 | { | |
| 130 | // wrong!! | |
| 131 | if (cpu_getiloops(device)&1) | |
| 132 | cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); | |
| 133 | else | |
| 134 | cpu_set_input_line(device, INPUT_LINE_IRQ0, HOLD_LINE); | |
| 135 | } | |
| 136 | ||
| 137 | ||
| 138 | static MACHINE_DRIVER_START( igs_ncs ) | |
| 139 | /* basic machine hardware */ | |
| 140 | MDRV_CPU_ADD("main", Z180, XTAL_12MHz / 2) /* CPU is..?? 6 MHz? */ | |
| 141 | MDRV_CPU_PROGRAM_MAP(igs_ncs_map,0) | |
| 142 | MDRV_CPU_IO_MAP(igs_ncs_portmap,0) | |
| 143 | MDRV_CPU_VBLANK_INT_HACK(igs_ncs_interrupt,2) | |
| 144 | // MDRV_CPU_VBLANK_INT("main",igs_ncs_interrupt) | |
| 145 | ||
| 146 | /* video hardware */ | |
| 147 | MDRV_SCREEN_ADD("main", RASTER) | |
| 148 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 149 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 150 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 151 | MDRV_SCREEN_SIZE(512, 256) | |
| 152 | MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) | |
| 153 | ||
| 154 | MDRV_GFXDECODE(igs_ncs) | |
| 155 | MDRV_PALETTE_LENGTH(0x400) | |
| 156 | ||
| 157 | MDRV_VIDEO_START(igs_ncs) | |
| 158 | MDRV_VIDEO_UPDATE(igs_ncs) | |
| 159 | ||
| 160 | /* sound hardware */ | |
| 161 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 162 | MDRV_SOUND_ADD("ym", YM2413, XTAL_3_579545MHz) | |
| 163 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 164 | ||
| 165 | MACHINE_DRIVER_END | |
| 166 | ||
| 167 | ||
| 168 | ||
| 169 | ROM_START( igs_ncs ) | |
| 170 | ROM_REGION( 0x10000, "main", 0 ) | |
| 171 | ROM_LOAD( "ncs_v100n.u20", 0x00000, 0x10000, CRC(2bb91de5) SHA1(b0b7b3b9cee1ce4da10cf78ef1c8079f3d9cafbf) ) | |
| 172 | ||
| 173 | ROM_REGION( 0x10000, "data", 0 ) | |
| 174 | ROM_LOAD( "ncs_v100n.u21", 0x00000, 0x10000, CRC(678e412c) SHA1(dba031d3576d098d314d6589dd1aeda44d17c650) ) | |
| 175 | ||
| 176 | ROM_REGION( 0xc0000, "gfx1", ROMREGION_DISPOSE ) | |
| 177 | ROM_LOAD( "ncs_v100n.u50", 0x00000, 0x40000, CRC(ff2bb3dc) SHA1(364c948504003b4230fbdac74227842c802d4c12) ) | |
| 178 | ROM_LOAD( "ncs_v100n.u51", 0x40000, 0x40000, CRC(f8530313) SHA1(b21d6de7d5d4b902008ceea7e1227545e0d1701b) ) | |
| 179 | ROM_LOAD( "ncs_v100n.u52", 0x80000, 0x40000, CRC(2fa5b6df) SHA1(5bfc651297440f73692079f1806b1e40b457b7b8) ) | |
| 180 | ||
| 181 | ROM_REGION( 0x30000, "gfx2", ROMREGION_ERASEFF | ROMREGION_DISPOSE ) | |
| 182 | // looks like these are needed for pre-game screens, sockets were empty | |
| 183 | ROM_LOAD( "ncs_v100n.u55", 0x00000, 0x10000, NO_DUMP ) | |
| 184 | ROM_LOAD( "ncs_v100n.u56", 0x10000, 0x10000, NO_DUMP ) | |
| 185 | ROM_LOAD( "ncs_v100n.u57", 0x20000, 0x10000, NO_DUMP ) | |
| 186 | ROM_END | |
| 187 | ||
| 188 | ||
| 189 | DRIVER_INIT( igs_ncs ) | |
| 190 | { | |
| 191 | UINT8 *src = (UINT8 *) (memory_region(machine, "main")); | |
| 192 | int i; | |
| 193 | ||
| 194 | for(i = 0; i < 0x10000; i++) | |
| 195 | { | |
| 196 | /* bit 0 xor layer */ | |
| 197 | if(i & 0x200) | |
| 198 | { | |
| 199 | if(i & 0x80) | |
| 200 | { | |
| 201 | if(~i & 0x02) | |
| 202 | { | |
| 203 | src[i] ^= 0x01; | |
| 204 | } | |
| 205 | } | |
| 206 | else | |
| 207 | { | |
| 208 | src[i] ^= 0x01; | |
| 209 | } | |
| 210 | } | |
| 211 | else | |
| 212 | { | |
| 213 | src[i] ^= 0x01; | |
| 214 | } | |
| 215 | ||
| 216 | /* bit 1 xor layer */ | |
| 217 | if(i & 0x800) | |
| 218 | { | |
| 219 | if(i & 0x100) | |
| 220 | { | |
| 221 | if(i & 0x40) | |
| 222 | { | |
| 223 | src[i] ^= 0x02; | |
| 224 | } | |
| 225 | } | |
| 226 | } | |
| 227 | ||
| 228 | /* bit 5 xor layer */ | |
| 229 | if(i & 0x100) | |
| 230 | { | |
| 231 | if(i & 0x40) | |
| 232 | { | |
| 233 | src[i] ^= 0x20; | |
| 234 | } | |
| 235 | } | |
| 236 | else | |
| 237 | { | |
| 238 | src[i] ^= 0x20; | |
| 239 | } | |
| 240 | } | |
| 241 | ||
| 242 | } | |
| 243 | ||
| 244 | GAME( 2000, igs_ncs, 0, igs_ncs, igs_ncs, igs_ncs, ROT0, "IGS", "New Champion Skill (v100n)", GAME_NOT_WORKING ) | |
| 245 |
| r4135 | r4136 | |
|---|---|---|
| 370 | 370 | 5, |
| 371 | 371 | { 0, 0, 1, 2, 3 }, |
| 372 | 372 | { RGN_FRAC(2,5)+0, RGN_FRAC(2,5)+4, 0, 4, RGN_FRAC(2,5)+8, RGN_FRAC(2,5)+12, 8, 12 }, |
| 373 | { | |
| 373 | { STEP8( | |
| 374 | 374 | 16*8 |
| 375 | 375 | }; |
| 376 | 376 | |
| r4135 | r4136 | |
| 381 | 381 | 5, |
| 382 | 382 | { RGN_FRAC(4,5), RGN_FRAC(4,5), RGN_FRAC(4,5), RGN_FRAC(4,5), RGN_FRAC(4,5) }, |
| 383 | 383 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 384 | { | |
| 384 | { STEP8(0, | |
| 385 | 385 | 8*8 |
| 386 | 386 | }; |
| 387 | 387 | |
| r4135 | r4136 | |
| 390 | 390 | 8,8, |
| 391 | 391 | RGN_FRAC(1,1), |
| 392 | 392 | 4, |
| 393 | { 0, 1, 2, 3 }, | |
| 394 | { 0, 4, 8, 12, 16, 20, 24, 28 }, | |
| 395 | { 0*8, 4*8, 8*8, 12*8, 16*8, 20*8, 24*8, 28*8 }, | |
| 393 | { STEP4(0,1) }, | |
| 394 | { STEP8(0,4) }, | |
| 395 | { STEP8(0,32) }, | |
| 396 | 396 | 32*8 |
| 397 | 397 | }; |
| 398 | 398 |
| r4135 | r4136 | |
|---|---|---|
| 247 | 247 | * Input ports * |
| 248 | 248 | ************************/ |
| 249 | 249 | |
| 250 | INPUT_PORTS_START( re900 ) | |
| 250 | static INPUT_PORTS_START( re900 ) | |
| 251 | 251 | |
| 252 | 252 | PORT_START("IN0") |
| 253 | 253 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Operator Key") PORT_TOGGLE PORT_CODE(KEYCODE_0) |
| r4135 | r4136 | |
| 334 | 334 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 335 | 335 | INPUT_PORTS_END |
| 336 | 336 | |
| 337 | INPUT_PORTS_START( bs94 ) | |
| 337 | static INPUT_PORTS_START( bs94 ) | |
| 338 | 338 | PORT_START("IN0") |
| 339 | 339 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Bet") PORT_CODE(KEYCODE_2) |
| 340 | 340 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Double") PORT_CODE(KEYCODE_3) |
| r4135 | r4136 | |
|---|---|---|
| 1 | /* | |
| 1 | /******************************************************************************************* | |
| 2 | 2 | |
| 3 | ||
| 3 | Jackpot Cards / Jackpot Pool (c) 1997 Electronic Projects | |
| 4 | 4 | |
| 5 | Copyright (C) 1992 HI-TECH Software..Brisbane, QLD Australia | |
| 6 | is present in the ROMs, although the game is in Italian | |
| 7 | and has a 1997 copyright, its probably a bootleg | |
| 5 | driver by David Haywood & Angelo Salese | |
| 8 | 6 | |
| 9 | */ | |
| 7 | Notes: | |
| 8 | -There's a "(c) 1992 HI-TECH Software..Brisbane, QLD Australia" string in the program roms, | |
| 9 | this is actually the m68k C compiler used for doing this game. | |
| 10 | 10 | |
| 11 | TODO: | |
| 12 | -Correct NVRAM emulation (and default eeprom too?); | |
| 13 | -Doesn't accept coins? (might be related to the eeprom); | |
| 14 | -Transparent pen issue on the text layer? (might be a btanb); | |
| 15 | -Understand master-slave comms properly; | |
| 16 | ||
| 17 | *******************************************************************************************/ | |
| 18 | ||
| 11 | 19 | #include "driver.h" |
| 12 | 20 | #include "cpu/m68000/m68000.h" |
| 13 | #include "deprecat.h" | |
| 14 | 21 | #include "sound/okim6295.h" |
| 22 | #include "machine/eeprom.h" | |
| 23 | #include "rendlay.h" | |
| 15 | 24 | |
| 16 | 25 | |
| 17 | static tilemap *jackpool_layer0_tilemap; | |
| 18 | static UINT16 *jackpool_layer0_videoram; | |
| 19 | static tilemap *jackpool_layer1_tilemap; | |
| 20 | static UINT16 *jackpool_layer1_videoram; | |
| 21 | static tilemap *jackpool_layer2_tilemap; | |
| 22 | static UINT16 *jackpool_layer2_videoram; | |
| 26 | static UINT16 *sc0_vram; | |
| 27 | static UINT16 *sc1_vram; | |
| 28 | static UINT16 *sc2_vram; | |
| 29 | static UINT16 *sc3_vram; | |
| 23 | 30 | |
| 31 | static UINT16 *jackpool_io; | |
| 24 | 32 | |
| 25 | static | |
| 33 | static VIDEO_S | |
| 26 | 34 | { |
| 27 | int tileno,attr; | |
| 28 | ||
| 29 | tileno = jackpool_layer0_videoram[tile_index]&0x7fff; | |
| 30 | attr = jackpool_layer0_videoram[tile_index+0x800]&0x1f; | |
| 31 | ||
| 32 | SET_TILE_INFO(0,tileno,attr,0); | |
| 33 | 35 | } |
| 34 | 36 | |
| 35 | static | |
| 37 | static V | |
| 36 | 38 | { |
| 37 | COMBINE_DATA(&jackpool_layer0_videoram[offset]); | |
| 39 | const device_config *left_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "left"); | |
| 40 | const device_config *right_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "right"); | |
| 41 | const gfx_element *gfx = screen->machine->gfx[0]; | |
| 42 | int count;// = 0x00000/2; | |
| 38 | 43 | |
| 39 | tilemap_mark_tile_dirty(jackpool_layer0_tilemap,offset&0x07ff); | |
| 40 | } | |
| 44 | int y,x; | |
| 41 | 45 | |
| 42 | static TILE_GET_INFO( get_jackpool_layer1_tile_info ) | |
| 43 | { | |
| 44 | int tileno,attr; | |
| 46 | if(screen == left_screen) | |
| 47 | { | |
| 48 | count = 0x0000/2; | |
| 49 | for (y=0;y<32;y++) | |
| 50 | { | |
| 51 | for (x=0;x<64;x++) | |
| 52 | { | |
| 53 | int tile = (sc1_vram[count] & 0x7fff); | |
| 54 | int attr = (sc1_vram[count+0x800] & 0x1f00)>>8; | |
| 55 | //int t_pen = (sc1_vram[count+0x800] & 0x2000); | |
| 56 | //int colour = tile>>12; | |
| 57 | drawgfx(bitmap,gfx,tile,attr,0,0,x*8,y*8,cliprect,TRANSPARENCY_NONE,0); | |
| 45 | 58 | |
| 46 | tileno = jackpool_layer1_videoram[tile_index]&0x7fff; | |
| 47 | attr = jackpool_layer1_videoram[tile_index+0x800]&0x1f; | |
| 59 | count++; | |
| 60 | } | |
| 61 | } | |
| 48 | 62 | |
| 49 | SET_TILE_INFO(0,tileno,attr,0); | |
| 50 | } | |
| 63 | count = 0x0000/2; | |
| 64 | for (y=0;y<32;y++) | |
| 65 | { | |
| 66 | for (x=0;x<64;x++) | |
| 67 | { | |
| 68 | int tile = (sc0_vram[count] & 0x7fff); | |
| 69 | int attr = (sc0_vram[count+0x800] & 0x1f00)>>8; | |
| 70 | /*might just be sloppy coding,colors are enabled as 0x20-0x3f*/ | |
| 71 | int t_pen = (sc0_vram[count+0x800] & 0x2000); | |
| 72 | //int colour = tile>>12; | |
| 73 | drawgfx(bitmap,gfx,tile,attr,0,0,x*8,y*8,cliprect,(t_pen) ? TRANSPARENCY_NONE : TRANSPARENCY_PEN,0); | |
| 74 | count++; | |
| 75 | } | |
| 76 | } | |
| 77 | } | |
| 51 | 78 | |
| 52 | static WRITE16_HANDLER( jackpool_layer1_videoram_w ) | |
| 53 | { | |
| 54 | COMBINE_DATA(&jackpool_layer1_videoram[offset]); | |
| 79 | if(screen == right_screen) | |
| 80 | { | |
| 81 | count = 0x0000/2; | |
| 82 | for (y=0;y<32;y++) | |
| 83 | { | |
| 84 | for (x=0;x<64;x++) | |
| 85 | { | |
| 86 | int tile = (sc2_vram[count] & 0x7fff); | |
| 87 | int attr = (sc2_vram[count+0x800] & 0x1f00)>>8; | |
| 88 | //int t_pen = (sc1_vram[count+0x800] & 0x2000); | |
| 89 | //int colour = tile>>12; | |
| 90 | drawgfx(bitmap,gfx,tile,attr,0,0,x*8,y*8,cliprect,TRANSPARENCY_NONE,0); | |
| 55 | 91 | |
| 56 | tilemap_mark_tile_dirty(jackpool_layer1_tilemap,offset&0x07ff); | |
| 57 | } | |
| 92 | count++; | |
| 93 | } | |
| 94 | } | |
| 58 | 95 | |
| 59 | static TILE_GET_INFO( get_jackpool_layer2_tile_info ) | |
| 60 | { | |
| 61 | int tileno,attr; | |
| 96 | count = 0x0000/2; | |
| 97 | for (y=0;y<32;y++) | |
| 98 | { | |
| 99 | for (x=0;x<64;x++) | |
| 100 | { | |
| 101 | int tile = (sc3_vram[count] & 0x7fff); | |
| 102 | int attr = (sc3_vram[count+0x800] & 0x1f00)>>8; | |
| 103 | /*might just be sloppy coding,colors are enabled as 0x20-0x3f*/ | |
| 104 | int t_pen = (sc3_vram[count+0x800] & 0x2000); | |
| 105 | //int colour = tile>>12; | |
| 106 | drawgfx(bitmap,gfx,tile,attr,0,0,x*8,y*8,cliprect,(t_pen) ? TRANSPARENCY_NONE : TRANSPARENCY_PEN,0); | |
| 107 | count++; | |
| 108 | } | |
| 109 | } | |
| 110 | } | |
| 62 | 111 | |
| 63 | tileno = jackpool_layer2_videoram[tile_index]&0x7fff; | |
| 64 | attr = jackpool_layer2_videoram[tile_index+0x800]&0x1f; | |
| 65 | ||
| 66 | SET_TILE_INFO(0,tileno,attr,0); | |
| 112 | return 0; | |
| 67 | 113 | } |
| 68 | 114 | |
| 69 | static WRITE16_HANDLER( jackpool_layer2_videoram_w ) | |
| 115 | /*Communication ram*/ | |
| 116 | static READ16_HANDLER( jackpool_ff_r ) | |
| 70 | 117 | { |
| 71 | COMBINE_DATA(&jackpool_layer2_videoram[offset]); | |
| 72 | ||
| 73 | tilemap_mark_tile_dirty(jackpool_layer2_tilemap,offset&0x07ff); | |
| 118 | return 0xffff; | |
| 74 | 119 | } |
| 75 | 120 | |
| 76 | ||
| 77 | ||
| 78 | 121 | static READ16_HANDLER( jackpool_io_r ) |
| 79 | 122 | { |
| 80 | return 0xffff; | |
| 123 | switch(offset*2) | |
| 124 | { | |
| 125 | case 0x0: return input_port_read(space->machine,"COIN1"); | |
| 126 | case 0x8: return input_port_read(space->machine,"SERVICE1"); | |
| 127 | case 0xa: return input_port_read(space->machine,"SERVICE2");//probably not a button | |
| 128 | case 0xc: return input_port_read(space->machine,"PAYOUT"); | |
| 129 | case 0xe: return input_port_read(space->machine,"START2"); | |
| 130 | case 0x10: return input_port_read(space->machine,"HOLD3"); | |
| 131 | case 0x12: return input_port_read(space->machine,"HOLD4"); | |
| 132 | case 0x14: return input_port_read(space->machine,"HOLD2"); | |
| 133 | case 0x16: return input_port_read(space->machine,"HOLD1"); | |
| 134 | case 0x18: return input_port_read(space->machine,"HOLD5"); | |
| 135 | case 0x1a: return input_port_read(space->machine,"START1"); | |
| 136 | case 0x1c: return input_port_read(space->machine,"BET"); | |
| 137 | // case 0x2c: eeprom 1 r? | |
| 138 | // case 0x2e: eeprom 2 r? | |
| 139 | } | |
| 140 | ||
| 141 | // printf("R %02x\n",offset*2); | |
| 142 | return jackpool_io[offset]; | |
| 81 | 143 | } |
| 82 | 144 | |
| 83 | static ADDRESS_MAP_START( jackpool_readmem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 84 | AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM) | |
| 85 | AM_RANGE(0x100000, 0x10ffff) AM_READ(SMH_RAM) | |
| 145 | static WRITE16_HANDLER( jackpool_io_w ) | |
| 146 | { | |
| 147 | // printf("W %02x %02x\n",offset*2,data); | |
| 148 | COMBINE_DATA(&jackpool_io[offset]); | |
| 86 | 149 | |
| 87 | AM_RANGE(0x120000, 0x1200ff) AM_READ(SMH_RAM) // maybe nvram? | |
| 150 | #if 0 | |
| 151 | if(offset*2 == 0x54) | |
| 152 | { | |
| 153 | printf("Write bit %02x\n",data); | |
| 154 | eeprom_write_bit(data & 1); | |
| 155 | } | |
| 156 | if(offset*2 == 0x52) | |
| 157 | { | |
| 158 | printf("Clock bit %02x\n",data); | |
| 159 | eeprom_set_clock_line((data & 1) ? ASSERT_LINE : CLEAR_LINE ); | |
| 160 | } | |
| 161 | if(offset*2 == 0x50) | |
| 162 | { | |
| 163 | printf("chip select bit %02x\n",data); | |
| 164 | eeprom_set_cs_line((data & 1) ? CLEAR_LINE : ASSERT_LINE ); | |
| 165 | } | |
| 166 | #endif | |
| 167 | } | |
| 88 | 168 | |
| 89 | AM_RANGE(0x340000, 0x34ffff) AM_READ(SMH_RAM) | |
| 90 | AM_RANGE(0x360000, 0x3603ff) AM_READ(SMH_RAM) | |
| 91 | AM_RANGE(0x380000, 0x38005f) AM_READ(SMH_RAM) | |
| 92 | ||
| 93 | AM_RANGE(0x800000, 0x80000f) AM_READ(jackpool_io_r) | |
| 94 | ||
| 95 | ||
| 96 | ADDRESS_MAP_END | |
| 97 | ||
| 98 | static ADDRESS_MAP_START( jackpool_writemem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 99 | AM_RANGE(0x000000, 0x03ffff) AM_WRITE(SMH_ROM) | |
| 100 | AM_RANGE(0x100000, 0x10ffff) AM_WRITE(SMH_RAM) | |
| 101 | ||
| 102 | AM_RANGE(0x120000, 0x1200ff) AM_WRITE(SMH_RAM) | |
| 103 | ||
| 104 | AM_RANGE(0x340000, 0x341fff) AM_WRITE(jackpool_layer0_videoram_w) AM_BASE(&jackpool_layer0_videoram) | |
| 105 | AM_RANGE(0x342000, 0x343fff) AM_WRITE(jackpool_layer1_videoram_w) AM_BASE(&jackpool_layer1_videoram) | |
| 106 | AM_RANGE(0x344000, 0x345fff) AM_WRITE(jackpool_layer2_videoram_w) AM_BASE(&jackpool_layer2_videoram) // is this the same screen? | |
| 169 | static ADDRESS_MAP_START( jackpool_mem, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 170 | AM_RANGE(0x000000, 0x03ffff) AM_ROM | |
| 171 | AM_RANGE(0x100000, 0x10ffff) AM_RAM | |
| 172 | AM_RANGE(0x120000, 0x1200ff) AM_RAM | |
| 173 | AM_RANGE(0x340000, 0x341fff) AM_RAM AM_BASE(&sc0_vram) | |
| 174 | AM_RANGE(0x342000, 0x343fff) AM_RAM AM_BASE(&sc1_vram) | |
| 175 | AM_RANGE(0x344000, 0x345fff) AM_RAM AM_BASE(&sc2_vram) | |
| 176 | AM_RANGE(0x346000, 0x347fff) AM_RAM AM_BASE(&sc3_vram) | |
| 107 | 177 | /* are the ones below used? */ |
| 108 | AM_RANGE(0x346000, 0x347fff) AM_WRITE(SMH_RAM) | |
| 109 | AM_RANGE(0x348000, 0x349fff) AM_WRITE(SMH_RAM) | |
| 110 | AM_RANGE(0x34a000, 0x34bfff) AM_WRITE(SMH_RAM) | |
| 111 | AM_RANGE(0x34c000, 0x34dfff) AM_WRITE(SMH_RAM) | |
| 112 | AM_RANGE(0x34e000, 0x34ffff) AM_WRITE(SMH_RAM) | |
| 178 | AM_RANGE(0x348000, 0x349fff) AM_RAM | |
| 179 | AM_RANGE(0x34a000, 0x34bfff) AM_RAM | |
| 180 | AM_RANGE(0x34c000, 0x34dfff) AM_RAM | |
| 181 | AM_RANGE(0x34e000, 0x34ffff) AM_RAM | |
| 113 | 182 | |
| 114 | AM_RANGE(0x360000, 0x3603ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16) | |
| 115 | AM_RANGE(0x380000, 0x38005f) AM_WRITE(SMH_RAM) | |
| 116 | ADDRESS_MAP_END | |
| 183 | AM_RANGE(0x360000, 0x3603ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16) | |
| 184 | AM_RANGE(0x380000, 0x380061) AM_READWRITE(jackpool_io_r,jackpool_io_w) AM_BASE(&jackpool_io)//AM_READ(jackpool_io_r) | |
| 117 | 185 | |
| 118 | #if 0 | |
| 119 | static ADDRESS_MAP_START( roulette_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 120 | AM_RANGE(0x000000, 0x03ffff) AM_ROM | |
| 186 | AM_RANGE(0x800000, 0x80000f) AM_READ(jackpool_ff_r) AM_WRITENOP | |
| 187 | AM_RANGE(0xa00000, 0xa00001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w) | |
| 121 | 188 | ADDRESS_MAP_END |
| 122 | #endif | |
| 123 | 189 | |
| 124 | 190 | |
| 125 | ||
| 126 | 191 | static INPUT_PORTS_START( jackpool ) |
| 192 | PORT_START("COIN1") | |
| 193 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 194 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 195 | PORT_START("SERVICE1") | |
| 196 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 197 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 198 | PORT_START("SERVICE2") //toggle this to change game to Jackpot Pool,with different gfxs for cards. | |
| 199 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) | |
| 200 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 201 | PORT_START("PAYOUT") | |
| 202 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_W) | |
| 203 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 204 | PORT_START("START1") | |
| 205 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) | |
| 206 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 207 | PORT_START("START2") | |
| 208 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) | |
| 209 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 210 | PORT_START("BET") | |
| 211 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Bet / Cancel") PORT_CODE(KEYCODE_A) | |
| 212 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 213 | PORT_START("HOLD1") | |
| 214 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z) | |
| 215 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 216 | PORT_START("HOLD2") | |
| 217 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X) | |
| 218 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 219 | PORT_START("HOLD3") | |
| 220 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C) | |
| 221 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 222 | PORT_START("HOLD4") | |
| 223 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V) | |
| 224 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 225 | PORT_START("HOLD5") | |
| 226 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B) | |
| 227 | PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 127 | 228 | INPUT_PORTS_END |
| 128 | 229 | |
| 129 | 230 | |
| r4135 | r4136 | |
| 132 | 233 | 8,8, |
| 133 | 234 | RGN_FRAC(1,4), |
| 134 | 235 | 4, |
| 135 | { RGN_FRAC( | |
| 236 | { RGN_FRAC(0,4),RGN_FRAC(1,4),RGN_FRAC(2,4),RGN_FRAC(3,4) }, | |
| 136 | 237 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 137 | 238 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 138 | 239 | 8*8 |
| 139 | 240 | }; |
| 140 | 241 | |
| 141 | ||
| 142 | ||
| 143 | ||
| 144 | static VIDEO_START(jackpool) | |
| 145 | { | |
| 146 | jackpool_layer0_tilemap = tilemap_create(machine, get_jackpool_layer0_tile_info,tilemap_scan_rows, 8, 8,64,32); | |
| 147 | jackpool_layer1_tilemap = tilemap_create(machine, get_jackpool_layer1_tile_info,tilemap_scan_rows, 8, 8,64,32); | |
| 148 | jackpool_layer2_tilemap = tilemap_create(machine, get_jackpool_layer2_tile_info,tilemap_scan_rows, 8, 8,64,32); | |
| 149 | ||
| 150 | tilemap_set_transparent_pen(jackpool_layer0_tilemap,0); | |
| 151 | tilemap_set_transparent_pen(jackpool_layer2_tilemap,0); | |
| 152 | } | |
| 153 | ||
| 154 | static VIDEO_UPDATE(jackpool) | |
| 155 | { | |
| 156 | tilemap_draw(bitmap,cliprect,jackpool_layer1_tilemap,0,0); | |
| 157 | tilemap_draw(bitmap,cliprect,jackpool_layer0_tilemap,0,0); | |
| 158 | ||
| 159 | // tilemap_draw(bitmap,cliprect,jackpool_layer2_tilemap,0,0); // is this actually a second display? | |
| 160 | ||
| 161 | return 0; | |
| 162 | } | |
| 163 | ||
| 164 | ||
| 165 | 242 | static GFXDECODE_START( jackpool ) |
| 166 | GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0x000, 2 | |
| 243 | GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0x000, 0x20 | |
| 167 | 244 | GFXDECODE_END |
| 168 | 245 | |
| 169 | /* verify */ | |
| 246 | ||
| 247 | /*irq 2 used for communication stuff.3 is just a rte*/ | |
| 170 | 248 | static INTERRUPT_GEN( jackpool_interrupt ) |
| 171 | 249 | { |
| 172 | cpu_set_input_line(device, | |
| 250 | cpu_set_input_line(device, | |
| 173 | 251 | } |
| 174 | 252 | |
| 175 | 253 | |
| 176 | 254 | static MACHINE_DRIVER_START( jackpool ) |
| 177 | 255 | MDRV_CPU_ADD("main", M68000, 12000000) // ? |
| 178 | MDRV_CPU_PROGRAM_MAP(jackpool_readmem,jackpool_writemem) | |
| 179 | MDRV_CPU_VBLANK_INT_HACK(jackpool_interrupt,3) // ? | |
| 256 | MDRV_CPU_PROGRAM_MAP(jackpool_mem,0) | |
| 257 | MDRV_CPU_VBLANK_INT("left",jackpool_interrupt) // ? | |
| 180 | 258 | |
| 181 | 259 | MDRV_GFXDECODE(jackpool) |
| 260 | MDRV_DEFAULT_LAYOUT(layout_dualhsxs) | |
| 182 | 261 | |
| 262 | MDRV_SCREEN_ADD("left", RASTER) | |
| 263 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 264 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 265 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 266 | MDRV_SCREEN_SIZE(64*8, 64*8) | |
| 267 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1) | |
| 183 | 268 | |
| 184 | MDRV_SCREEN_ADD(" | |
| 269 | MDRV_SCREEN_ADD("r | |
| 185 | 270 | MDRV_SCREEN_REFRESH_RATE(60) |
| 186 | 271 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 187 | 272 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 188 | 273 | MDRV_SCREEN_SIZE(64*8, 64*8) |
| 189 | 274 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1) |
| 190 | 275 | |
| 276 | MDRV_NVRAM_HANDLER(93C46) | |
| 277 | ||
| 191 | 278 | MDRV_PALETTE_LENGTH(0x200) |
| 192 | 279 | |
| 193 | 280 | MDRV_VIDEO_START(jackpool) |
| r4135 | r4136 | |
| 198 | 285 | MDRV_SOUND_ADD("oki", OKIM6295, 1056000) |
| 199 | 286 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified |
| 200 | 287 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 201 | ||
| 202 | 288 | MACHINE_DRIVER_END |
| 203 | 289 | |
| 204 | 290 | |
| r4135 | r4136 | |
| 217 | 303 | ROM_LOAD( "jpc7", 0xc0000, 0x40000, CRC(b1d40623) SHA1(fb76ae6b53474bd4bee19dbce9537da0f2b63ff4) ) |
| 218 | 304 | ROM_END |
| 219 | 305 | |
| 220 | GAME( 1997, jackpool, 0, jackpool, jackpool, 0, ROT0, "Electronic Projects", "Jackpot Pool (Italy | |
| 306 | GAME( 1997, jackpool, 0, jackpool, jackpool, 0, ROT0, "Electronic Projects", "Jackpot Cards / Jackpot Pool (Italy |
| r4135 | r4136 | |
|---|---|---|
| 299 | 299 | case 0x45: |
| 300 | 300 | case 0x46: |
| 301 | 301 | return K053244_r(space,offset-0x40); |
| 302 | break; | |
| 303 | 302 | |
| 304 | 303 | case 0x80: |
| 305 | 304 | case 0x81: |
| r4135 | r4136 | |
| 334 | 333 | case 0x9e: |
| 335 | 334 | case 0x9f: |
| 336 | 335 | return K054000_r(space,offset-0x80); |
| 337 | break; | |
| 338 | 336 | |
| 339 | 337 | case 0xca: |
| 340 | 338 | return sound_status_r(space,0); |
| 341 | break; | |
| 342 | 339 | } |
| 343 | 340 | } |
| 344 | 341 | else if (offset < 0x1800) |
| r4135 | r4136 | |
| 454 | 451 | { |
| 455 | 452 | case 0: |
| 456 | 453 | return GUNX(1)>>1; |
| 457 | break; | |
| 458 | 454 | case 1: |
| 459 | 455 | if ((240-GUNY(1)) == 7) |
| 460 | 456 | return 0; |
| r4135 | r4136 | |
| 463 | 459 | break; |
| 464 | 460 | case 2: |
| 465 | 461 | return GUNX(2)>>1; |
| 466 | break; | |
| 467 | 462 | case 3: |
| 468 | 463 | if ((240-GUNY(2)) == 7) |
| 469 | 464 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 81 | 81 | |
| 82 | 82 | static VIDEO_UPDATE( drill ) |
| 83 | 83 | { |
| 84 | int i; | |
| 85 | 84 | bitmap_fill(bitmap,NULL,0); |
| 86 | 85 | |
| 87 | for (i=0; i<256; i++) | |
| 88 | { | |
| 89 | decodechar(screen->machine->gfx[1],i,(UINT8*)&charram[0]); | |
| 90 | } | |
| 91 | ||
| 92 | 86 | DRAW_MAP(map1ram,0) |
| 93 | 87 | DRAW_MAP(map2ram,1) |
| 94 | 88 | DRAW_MAP(map3ram,2) |
| r4135 | r4136 | |
| 117 | 111 | static VIDEO_START( drill ) |
| 118 | 112 | { |
| 119 | 113 | machine->gfx[0]->color_granularity=16; |
| 114 | gfx_element_set_source(machine->gfx[1], (UINT8 *)charram); | |
| 120 | 115 | } |
| 121 | 116 | |
| 122 | 117 | static UINT16 *iodata; |
| r4135 | r4136 | |
| 220 | 215 | } |
| 221 | 216 | } |
| 222 | 217 | |
| 218 | static WRITE16_HANDLER( charram_w ) | |
| 219 | { | |
| 220 | COMBINE_DATA(&charram[offset]); | |
| 221 | gfx_element_mark_dirty(space->machine->gfx[1], offset/16); | |
| 222 | } | |
| 223 | ||
| 223 | 224 | static ADDRESS_MAP_START( drill_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 224 | 225 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 225 | 226 | AM_RANGE(0x200000, 0x20ffff) AM_RAM |
| r4135 | r4136 | |
| 229 | 230 | AM_RANGE(0x414000, 0x415fff) AM_RAM AM_BASE(&map3ram) |
| 230 | 231 | AM_RANGE(0x416000, 0x417fff) AM_RAM AM_BASE(&map4ram) |
| 231 | 232 | AM_RANGE(0x41c000, 0x41dfff) AM_RAM AM_BASE(&textram) |
| 232 | AM_RANGE(0x41e000, 0x41ffff) AM_RAM AM_BASE(&charram) | |
| 233 | AM_RANGE(0x41e000, 0x41ffff) AM_RAM_WRITE(charram_w) AM_BASE(&charram) | |
| 233 | 234 | AM_RANGE(0x400000, 0x4fffff) AM_RAM AM_BASE(&unkram)// video stuff, 460000 - video regs ? |
| 234 | 235 | AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16) |
| 235 | 236 | AM_RANGE(0x502000, 0x503fff) AM_RAM |
| r4135 | r4136 | |
|---|---|---|
| 51 | 51 | static void draw_char(bitmap_t *bitmap, const rectangle *cliprect, const gfx_element *gfx, int ch, int att, int x, int y) |
| 52 | 52 | { |
| 53 | 53 | int i,j; |
| 54 | UINT8 *dp; | |
| 54 | const UINT8 *dp; | |
| 55 | 55 | int index = 0; |
| 56 | dp = gfx | |
| 56 | dp = gfx_element_get_data( | |
| 57 | 57 | |
| 58 | 58 | for (j=y; j < y+8; j++) |
| 59 | 59 | { |
| r4135 | r4136 | |
|---|---|---|
| 129 | 129 | case 0x41: |
| 130 | 130 | case 0x42: |
| 131 | 131 | return 0; |
| 132 | break; | |
| 133 | 132 | |
| 134 | 133 | /*With this command the MCU controls body direction */ |
| 135 | 134 | case 0x02: |
| r4135 | r4136 | |
| 167 | 166 | |
| 168 | 167 | return direction; |
| 169 | 168 | } |
| 170 | break; | |
| 171 | 169 | |
| 172 | 170 | /*This controls the arms when they return to the player. */ |
| 173 | 171 | case 0x07: |
| 174 | 172 | return 0x45; |
| 175 | break; | |
| 176 | 173 | |
| 177 | 174 | default: |
| 178 | 175 | logerror("CPU#0 read from MCU pc=%4x, mcu_val=%2x\n", cpu_get_pc(space->cpu), mcu_val ); |
| 179 | 176 | return mcu_val; |
| 180 | break; | |
| 181 | 177 | } |
| 182 | 178 | #endif |
| 183 | 179 | } |
| r4135 | r4136 | |
|---|---|---|
| 22 | 22 | #include "driver.h" |
| 23 | 23 | #include "cpu/m68000/m68000.h" |
| 24 | 24 | #include "cpu/m6502/m6502.h" |
| 25 | #include "sound/2151intf.h" | |
| 26 | #include "sound/dac.h" | |
| 25 | 27 | #include "rendlay.h" |
| 26 | 28 | #include "machine/atarigen.h" |
| 27 | 29 | #include "audio/atarijsa.h" |
| 28 | 30 | #include "cyberbal.h" |
| 29 | #include "sound/2151intf.h" | |
| 30 | 31 | |
| 31 | 32 | |
| 32 | ||
| 33 | 33 | /************************************* |
| 34 | 34 | * |
| 35 | 35 | * Initialization |
| r4135 | r4136 | |
|---|---|---|
| 228 | 228 | logerror("mode =%02x pc=%04x\n",*io9401,cpu_get_pc(space->cpu) ); |
| 229 | 229 | popmessage("mode =%02x pc=%04x\n",*io9401,cpu_get_pc(space->cpu) ); |
| 230 | 230 | return; |
| 231 | break; | |
| 232 | 231 | } |
| 233 | 232 | |
| 234 | 233 |
| r4135 | r4136 | |
|---|---|---|
| 53 | 53 | switch (inputport_selected) |
| 54 | 54 | { |
| 55 | 55 | case 0x00: /* DSW B (bits 0-4) */ |
| 56 | return (input_port_read(space->machine, "DSWB") & 0xf8) >> 3; | |
| 56 | return (input_port_read(space->machine, "DSWB") & 0xf8) >> 3; | |
| 57 | 57 | case 0x01: /* DSW B (bits 5-7), DSW A (bits 0-1) */ |
| 58 | return ((input_port_read(space->machine, "DSWB") & 0x07) << 2) | ((input_port_read(space->machine, "DSWA") & 0xc0) >> 6); | |
| 58 | return ((input_port_read(space->machine, "DSWB") & 0x07) << 2) | ((input_port_read(space->machine, "DSWA") & 0xc0) >> 6); | |
| 59 | 59 | case 0x02: /* DSW A (bits 2-6) */ |
| 60 | return (input_port_read(space->machine, "DSWA") & 0x3e) >> 1; | |
| 60 | return (input_port_read(space->machine, "DSWA") & 0x3e) >> 1; | |
| 61 | 61 | case 0x03: /* DSW A (bit 7), DSW C (bits 0-3) */ |
| 62 | return ((input_port_read(space->machine, "DSWA") & 0x01) << 4) | (input_port_read(space->machine, "BUTTON2") & 0x0f); | |
| 62 | return ((input_port_read(space->machine, "DSWA") & 0x01) << 4) | (input_port_read(space->machine, "BUTTON2") & 0x0f); | |
| 63 | 63 | case 0x04: /* coins, start */ |
| 64 | return input_port_read(space->machine, "SYSTEM"); | |
| 64 | return input_port_read(space->machine, "SYSTEM"); | |
| 65 | 65 | case 0x05: /* 2P controls */ |
| 66 | return input_port_read(space->machine, "P2"); | |
| 66 | return input_port_read(space->machine, "P2"); | |
| 67 | 67 | case 0x06: /* 1P controls */ |
| 68 | return input_port_read(space->machine, "P1"); | |
| 68 | return input_port_read(space->machine, "P1"); | |
| 69 | 69 | default: |
| 70 | 70 | return 0xff; |
| 71 | 71 | } |
| r4135 | r4136 | |
|---|---|---|
| 1 | 1 | |
| 2 | 2 | /* Old IGS game called Tarzan, don't know much about it, could be gambling */ |
| 3 | /* CPU might not be z80 | |
| 3 | /* CPU might not be z80 (maybe z180) | |
| 4 | 4 | |
| 5 | #include "driver.h" | |
| 6 | #include "cpu/z80/z80.h" | |
| 5 | decryption is incomplete?, first part of code doesn't seem right? | |
| 7 | 6 | |
| 8 | #if 0 | |
| 9 | static UINT16 *file1_data; | |
| 10 | static int file1_size; | |
| 7 | graphics area also encrypted | |
| 11 | 8 | |
| 12 | ||
| 9 | ||
| 13 | 10 | |
| 14 | static int decrypt_tarzan() | |
| 15 | { | |
| 16 | int fd; | |
| 17 | int i; | |
| 18 | char msg[512]; | |
| 11 | #include "driver.h" | |
| 12 | #include "cpu/z80/z80.h" | |
| 19 | 13 | |
| 20 | if(argc != 3) { | |
| 21 | fprintf(stderr, "Usage:\n%s <file1.bin> <result.bin>\n", argv[0]); | |
| 22 | exit(1); | |
| 23 | } | |
| 24 | 14 | |
| 25 | sprintf(msg, "Open %s", argv[1]); | |
| 26 | fd = open(argv[1], O_RDONLY); | |
| 27 | if(fd<0) { | |
| 28 | perror(msg); | |
| 29 | exit(2); | |
| 30 | } | |
| 31 | ||
| 32 | file1_size = lseek(fd, 0, SEEK_END); | |
| 33 | lseek(fd, 0, SEEK_SET); | |
| 34 | ||
| 35 | file1_data = malloc_or_die(file1_size); | |
| 36 | read(fd, file1_data, file1_size); | |
| 37 | close(fd); | |
| 38 | ||
| 39 | result_data = malloc_or_die(file1_size); | |
| 40 | for(i=0; i<file1_size/2; i++) { | |
| 41 | UINT16 x = file1_data[i]; | |
| 42 | ||
| 43 | if((i & 0x10c0) == 0x0000) | |
| 44 | x ^= 0x0001; | |
| 45 | ||
| 46 | if((i & 0x0010) == 0x0010 || (i & 0x0130) == 0x0020) | |
| 47 | x ^= 0x0404; | |
| 48 | ||
| 49 | if((i & 0x00d0) != 0x0010) | |
| 50 | x ^= 0x1010; | |
| 51 | ||
| 52 | if(((i & 0x0008) == 0x0008)^((i & 0x10c0) == 0x0000)) | |
| 53 | x ^= 0x0100; | |
| 54 | ||
| 55 | result_data[i] = x; | |
| 56 | } | |
| 57 | ||
| 58 | sprintf(msg, "Open %s", argv[2]); | |
| 59 | fd = open(argv[2], O_RDWR|O_CREAT|O_TRUNC, 0666); | |
| 60 | if(fd<0) { | |
| 61 | perror(msg); | |
| 62 | exit(2); | |
| 63 | } | |
| 64 | ||
| 65 | write(fd, result_data, file1_size); | |
| 66 | close(fd); | |
| 67 | ||
| 68 | return 0; | |
| 69 | } | |
| 70 | #endif | |
| 71 | ||
| 72 | ||
| 73 | 15 | static VIDEO_START(tarzan) |
| 74 | 16 | { |
| 75 | 17 | } |
| r4135 | r4136 | |
| 89 | 31 | INPUT_PORTS_END |
| 90 | 32 | |
| 91 | 33 | |
| 34 | static const gfx_layout tarzan_layout = | |
| 35 | { | |
| 36 | 8,8, | |
| 37 | RGN_FRAC(1,1), | |
| 38 | 4, | |
| 39 | { 0*8,1*8,2*8,3*8 }, | |
| 40 | { 0,1,2,3,4,5,6,7 }, | |
| 41 | { 0*8, 4*8, 8*8,12*8,16*8,20*8,24*8,28*8}, | |
| 42 | 32*8 | |
| 43 | }; | |
| 44 | ||
| 45 | ||
| 46 | static GFXDECODE_START( tarzan ) | |
| 47 | GFXDECODE_ENTRY( "gfx1", 0, tarzan_layout, 0x0, 2 ) | |
| 48 | GFXDECODE_ENTRY( "gfx2", 0, tarzan_layout, 0x0, 2 ) | |
| 49 | GFXDECODE_END | |
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ||
| 92 | 54 | static MACHINE_DRIVER_START( tarzan ) |
| 93 | 55 | /* basic machine hardware */ |
| 94 | 56 | MDRV_CPU_ADD("main", Z80,8000000) /* ? */ |
| r4135 | r4136 | |
| 103 | 65 | MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1) |
| 104 | 66 | |
| 105 | 67 | MDRV_PALETTE_LENGTH(0x100) |
| 68 | MDRV_GFXDECODE(tarzan) | |
| 106 | 69 | |
| 107 | 70 | MDRV_VIDEO_START(tarzan) |
| 108 | 71 | MDRV_VIDEO_UPDATE(tarzan) |
| 109 | 72 | MACHINE_DRIVER_END |
| 110 | 73 | |
| 74 | DRIVER_INIT( tarzan ) | |
| 75 | { | |
| 76 | UINT16* ROM = (UINT16*)memory_region(machine,"main"); | |
| 77 | int i; | |
| 78 | int size = 0x040000; | |
| 111 | 79 | |
| 80 | for(i=0; i<size/2; i++) | |
| 81 | { | |
| 82 | UINT16 x = ROM[i]; | |
| 112 | 83 | |
| 84 | if((i & 0x10c0) == 0x0000) | |
| 85 | x ^= 0x0001; | |
| 86 | ||
| 87 | if((i & 0x0010) == 0x0010 || (i & 0x0130) == 0x0020) | |
| 88 | x ^= 0x0404; | |
| 89 | ||
| 90 | if((i & 0x00d0) != 0x0010) | |
| 91 | x ^= 0x1010; | |
| 92 | ||
| 93 | if(((i & 0x0008) == 0x0008)^((i & 0x10c0) == 0x0000)) | |
| 94 | x ^= 0x0100; | |
| 95 | ||
| 96 | ROM[i] = x; | |
| 97 | } | |
| 98 | ||
| 99 | #if 0 | |
| 100 | { | |
| 101 | FILE *fp; | |
| 102 | char filename[256]; | |
| 103 | sprintf(filename,"decrypted_%s", machine->gamedrv->name); | |
| 104 | fp=fopen(filename, "w+b"); | |
| 105 | if (fp) | |
| 106 | { | |
| 107 | fwrite(ROM, 0x40000, 1, fp); | |
| 108 | fclose(fp); | |
| 109 | } | |
| 110 | } | |
| 111 | #endif | |
| 112 | } | |
| 113 | ||
| 113 | 114 | ROM_START( tarzan ) |
| 114 | 115 | ROM_REGION( 0x040000, "main", 0 ) |
| 115 | 116 | ROM_LOAD( "0228-u16.bin", 0x00000, 0x040000, CRC(e6c552a5) SHA1(f156de9459833474c85a1f5b35917881b390d34c) ) |
| 116 | 117 | |
| 117 | ROM_REGION( 0x080000, " | |
| 118 | ROM_REGION( 0x080000, "gfx | |
| 118 | 119 | ROM_LOAD( "0228-u21.bin", 0x00000, 0x080000, CRC(80aaece4) SHA1(07cad92492c5de36c3915867ed4c6544b1a30c07) ) |
| 119 | 120 | |
| 120 | ROM_REGION( 0x080000, " | |
| 121 | ROM_REGION( 0x080000, "gfx | |
| 121 | 122 | ROM_LOAD( "0228-u6.bin", 0x00000, 0x080000, CRC(55e94832) SHA1(b15409f4f1264b6d1218d5dc51c5bd1de2e40284) ) |
| 122 | 123 | |
| 123 | 124 | ROM_END |
| 124 | 125 | |
| 125 | 126 | |
| 126 | GAME( 199?, tarzan, 0, tarzan, tarzan, | |
| 127 | GAME( 199?, tarzan, 0, tarzan, tarzan, tarzan, ROT0, "IGS", "Tarzan",GAME_NOT_WORKING|GAME_NO_SOUND ) |
| r4135 | r4136 | |
|---|---|---|
| 316 | 316 | { |
| 317 | 317 | case MSECR: |
| 318 | 318 | return mame_rand(space->machine); |
| 319 | break; | |
| 320 | 319 | |
| 321 | 320 | case IOLINES: //TODO: eeprom 24c01 |
| 322 | 321 | #if 0 |
| r4135 | r4136 | |
|---|---|---|
| 103 | 103 | pexp0112 2 |
| 104 | 104 | pexs0006 2 |
| 105 | 105 | pexmp006 2 |
| 106 | pexmp017 2 | |
| 106 | 107 | |
| 107 | 108 | |
| 108 | 109 | 2) Configuration |
| r4135 | r4136 | |
| 173 | 174 | #define MASTER_CLOCK XTAL_20MHz |
| 174 | 175 | #define CPU_CLOCK ((MASTER_CLOCK)/2) /* divided by 2 - 7474 */ |
| 175 | 176 | #define MC6845_CLOCK ((MASTER_CLOCK)/8/3) |
| 177 | #define SOUND_CLOCK ((MASTER_CLOCK)/12) | |
| 176 | 178 | |
| 177 | 179 | static UINT16 autohold_addr; /* address to patch in program RAM to enable autohold feature */ |
| 178 | 180 | |
| 179 | 181 | static tilemap *bg_tilemap; |
| 182 | static UINT8 wingboard; | |
| 183 | static UINT8 jumper_e16_e17; /* Set this to TRUE when CG chips are 27c512 instead of 27c256 */ | |
| 180 | 184 | |
| 181 | 185 | /* Pointers to External RAM */ |
| 182 | 186 | static UINT8 *program_ram; |
| r4135 | r4136 | |
| 191 | 195 | /* Variables used instead of CRTC6845 system */ |
| 192 | 196 | static UINT16 vid_address = 0; |
| 193 | 197 | |
| 194 | /* Holds upper video address | |
| 198 | /* Holds upper video address, | |
| 195 | 199 | static UINT8 *palette_ram; |
| 200 | static UINT8 *palette_ram2; | |
| 196 | 201 | |
| 197 | 202 | /* IO Ports */ |
| 198 | 203 | static UINT8 *io_port; |
| r4135 | r4136 | |
| 227 | 232 | crtc_addr /* update address callback */ |
| 228 | 233 | }; |
| 229 | 234 | |
| 235 | ||
| 236 | /************** | |
| 237 | * Memory Copy * | |
| 238 | ***************/ | |
| 239 | ||
| 240 | static void peplus_load_superdata(running_machine *machine, const char *bank_name) | |
| 241 | { | |
| 242 | UINT8 *super_data = memory_region(machine, bank_name); | |
| 243 | ||
| 244 | /* Distribute Superboard Data */ | |
| 245 | memcpy(s3000_ram, &super_data[0x3000], 0x1000); | |
| 246 | memcpy(s5000_ram, &super_data[0x5000], 0x1000); | |
| 247 | memcpy(s7000_ram, &super_data[0x7000], 0x1000); | |
| 248 | memcpy(sb000_ram, &super_data[0xb000], 0x1000); | |
| 249 | memcpy(sd000_ram, &super_data[0xd000], 0x1000); | |
| 250 | memcpy(sf000_ram, &super_data[0xf000], 0x1000); | |
| 251 | } | |
| 252 | ||
| 253 | ||
| 230 | 254 | /***************** |
| 231 | 255 | * NVRAM Handlers * |
| 232 | 256 | ******************/ |
| r4135 | r4136 | |
| 252 | 276 | NVRAM_HANDLER_CALL(i2cmem_0); |
| 253 | 277 | } |
| 254 | 278 | |
| 279 | ||
| 255 | 280 | /***************** |
| 256 | 281 | * Write Handlers * |
| 257 | 282 | ******************/ |
| r4135 | r4136 | |
| 260 | 285 | { |
| 261 | 286 | int i; |
| 262 | 287 | |
| 263 | for (i = 0; i < | |
| 288 | for (i = 0; i < space->machine->config->total_colors; i++) | |
| 264 | 289 | { |
| 265 | 290 | int bit0, bit1, bit2, r, g, b; |
| 266 | 291 | |
| r4135 | r4136 | |
| 286 | 311 | } |
| 287 | 312 | } |
| 288 | 313 | |
| 289 | /* | |
| 290 | ROCKWELL 6545 - Transparent Memory Addressing | |
| 291 | The current CRTC6845 driver does not support these | |
| 292 | additional registers (R18, R19, R31) | |
| 293 | */ | |
| 294 | 314 | |
| 315 | /* ROCKWELL 6545 - Transparent Memory Addressing */ | |
| 316 | ||
| 295 | 317 | static MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr) |
| 296 | 318 | { |
| 297 | 319 | vid_address = address; |
| 298 | 320 | } |
| 299 | 321 | |
| 300 | ||
| 301 | 322 | static WRITE8_DEVICE_HANDLER( peplus_crtc_mode_w ) |
| 302 | 323 | { |
| 303 | 324 | /* Reset timing logic */ |
| r4135 | r4136 | |
| 327 | 348 | handle_lightpen(device); |
| 328 | 349 | } |
| 329 | 350 | |
| 330 | ||
| 331 | 351 | static WRITE8_DEVICE_HANDLER( peplus_crtc_display_w ) |
| 332 | 352 | { |
| 333 | 353 | videoram[vid_address] = data; |
| 334 | 354 | palette_ram[vid_address] = io_port[1]; |
| 355 | palette_ram2[vid_address] = io_port[3]; | |
| 356 | ||
| 335 | 357 | tilemap_mark_tile_dirty(bg_tilemap, vid_address); |
| 336 | 358 | |
| 337 | 359 | /* An access here triggers a device read !*/ |
| r4135 | r4136 | |
| 350 | 372 | |
| 351 | 373 | static WRITE8_HANDLER( peplus_cmos_w ) |
| 352 | 374 | { |
| 375 | char bank_name[5]; | |
| 376 | ||
| 377 | /* Test for Wingboard PAL Trigger Condition */ | |
| 378 | if (offset == 0x1fff && wingboard && data < 5) | |
| 379 | { | |
| 380 | sprintf(bank_name, "user%d", data + 1); | |
| 381 | peplus_load_superdata(space->machine, bank_name); | |
| 382 | } | |
| 383 | ||
| 353 | 384 | cmos_ram[offset] = data; |
| 354 | 385 | } |
| 355 | 386 | |
| r4135 | r4136 | |
| 513 | 544 | UINT8 coin_optics = 0x00; |
| 514 | 545 | UINT8 coin_out = 0x00; |
| 515 | 546 | UINT64 curr_cycles = cpu_get_total_cycles(space->cpu); |
| 547 | UINT16 door_wait = 500; | |
| 516 | 548 | |
| 517 | 549 | UINT8 sda = 0; |
| 518 | 550 | if(!sda_dir) |
| r4135 | r4136 | |
| 555 | 587 | break; |
| 556 | 588 | } |
| 557 | 589 | |
| 558 | if (curr_cycles - last_door > 6000/12) { // Guessing with 6000 | |
| 590 | if (wingboard) | |
| 591 | door_wait = 12345; | |
| 592 | ||
| 593 | if (curr_cycles - last_door > door_wait) { | |
| 559 | 594 | if ((input_port_read_safe(space->machine, "DOOR",0xff) & 0x01) == 0x01) { |
| 560 | 595 | door_open = (!door_open & 0x01); |
| 561 | 596 | } else { |
| r4135 | r4136 | |
| 603 | 638 | static TILE_GET_INFO( get_bg_tile_info ) |
| 604 | 639 | { |
| 605 | 640 | int pr = palette_ram[tile_index]; |
| 641 | int pr2 = palette_ram2[tile_index]; | |
| 606 | 642 | int vr = videoram[tile_index]; |
| 607 | 643 | |
| 608 | 644 | int code = ((pr & 0x0f)*256) | vr; |
| 609 | 645 | int color = (pr>>4) & 0x0f; |
| 610 | 646 | |
| 647 | // Access 2nd Half of CGs and CAP | |
| 648 | if (jumper_e16_e17 && (pr2 & 0x10) == 0x10) | |
| 649 | { | |
| 650 | code += 0x1000; | |
| 651 | color += 0x10; | |
| 652 | } | |
| 653 | ||
| 611 | 654 | SET_TILE_INFO(0, code, color, 0); |
| 612 | 655 | } |
| 613 | 656 | |
| r4135 | r4136 | |
| 616 | 659 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 40, 25); |
| 617 | 660 | palette_ram = auto_malloc(0x3000); |
| 618 | 661 | memset(palette_ram, 0, 0x3000); |
| 662 | palette_ram2 = auto_malloc(0x3000); | |
| 663 | memset(palette_ram2, 0, 0x3000); | |
| 619 | 664 | } |
| 620 | 665 | |
| 621 | 666 | static VIDEO_UPDATE( peplus ) |
| r4135 | r4136 | |
| 662 | 707 | } |
| 663 | 708 | |
| 664 | 709 | |
| 665 | /************************* | |
| 666 | * Graphics Layouts * | |
| 667 | *************************/ | |
| 668 | ||
| 669 | static const gfx_layout charlayout = | |
| 670 | { | |
| 671 | 8,8, /* 8x8 characters */ | |
| 672 | 0x1000, /* 4096 characters */ | |
| 673 | 4, /* 4 bitplanes */ | |
| 674 | { 0x1000*8*8*3, 0x1000*8*8*2, 0x1000*8*8*1, 0x1000*8*8*0 }, /* bitplane offsets */ | |
| 675 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 676 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, | |
| 677 | 8*8 | |
| 678 | }; | |
| 679 | ||
| 680 | ||
| 681 | 710 | /****************************** |
| 682 | 711 | * Graphics Decode Information * |
| 683 | 712 | ******************************/ |
| 684 | 713 | |
| 685 | 714 | static GFXDECODE_START( peplus ) |
| 686 | GFXDECODE_ENTRY( "gfx1", 0x00000, | |
| 715 | GFXDECODE_ENTRY( "gfx1", 0x00000, gfx_8x8x4_planar | |
| 687 | 716 | GFXDECODE_END |
| 688 | 717 | |
| 689 | 718 | |
| r4135 | r4136 | |
| 752 | 781 | AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READ(peplus_io_r) AM_WRITE(peplus_io_w) AM_BASE(&io_port) |
| 753 | 782 | ADDRESS_MAP_END |
| 754 | 783 | |
| 784 | ||
| 755 | 785 | /************************* |
| 756 | 786 | * Input ports * |
| 757 | 787 | *************************/ |
| r4135 | r4136 | |
| 995 | 1025 | MDRV_NVRAM_HANDLER(peplus) |
| 996 | 1026 | |
| 997 | 1027 | // video hardware |
| 998 | ||
| 999 | 1028 | MDRV_SCREEN_ADD("main", RASTER) |
| 1000 | 1029 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1001 | 1030 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| r4135 | r4136 | |
| 1003 | 1032 | MDRV_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 25*8-1) |
| 1004 | 1033 | |
| 1005 | 1034 | MDRV_GFXDECODE(peplus) |
| 1006 | MDRV_PALETTE_LENGTH(16*16) | |
| 1035 | MDRV_PALETTE_LENGTH(16*16*2) | |
| 1007 | 1036 | |
| 1008 | 1037 | MDRV_MC6845_ADD("crtc", R6545_1, MC6845_CLOCK, mc6845_intf) |
| 1009 | 1038 | |
| r4135 | r4136 | |
| 1012 | 1041 | MDRV_VIDEO_UPDATE(peplus) |
| 1013 | 1042 | |
| 1014 | 1043 | // sound hardware |
| 1015 | MDRV_SOUND_ADD("ay", AY8912, | |
| 1044 | MDRV_SOUND_ADD("ay", AY8912, SOUND_CLOCK) | |
| 1016 | 1045 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1017 | 1046 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 1018 | 1047 | MACHINE_DRIVER_END |
| r4135 | r4136 | |
| 1040 | 1069 | /* Normal board */ |
| 1041 | 1070 | static DRIVER_INIT( peplus ) |
| 1042 | 1071 | { |
| 1072 | wingboard = FALSE; | |
| 1073 | jumper_e16_e17 = FALSE; | |
| 1043 | 1074 | peplus_init(machine); |
| 1044 | 1075 | } |
| 1045 | 1076 | |
| 1046 | 1077 | /* Superboard */ |
| 1047 | 1078 | static DRIVER_INIT( peplussb ) |
| 1048 | 1079 | { |
| 1049 | UINT8 *super_data = memory_region(machine, "user1"); | |
| 1080 | wingboard = FALSE; | |
| 1081 | jumper_e16_e17 = FALSE; | |
| 1082 | peplus_load_superdata(machine, "user1"); | |
| 1050 | 1083 | |
| 1051 | /* Distribute Superboard Data */ | |
| 1052 | memcpy(s3000_ram, &super_data[0x3000], 0x1000); | |
| 1053 | memcpy(s5000_ram, &super_data[0x5000], 0x1000); | |
| 1054 | memcpy(s7000_ram, &super_data[0x7000], 0x1000); | |
| 1055 | memcpy(sb000_ram, &super_data[0xb000], 0x1000); | |
| 1056 | memcpy(sd000_ram, &super_data[0xd000], 0x1000); | |
| 1057 | memcpy(sf000_ram, &super_data[0xf000], 0x1000); | |
| 1084 | peplus_init(machine); | |
| 1085 | } | |
| 1058 | 1086 | |
| 1087 | /* Superboard with Attached Wingboard */ | |
| 1088 | static DRIVER_INIT( peplussbw ) | |
| 1089 | { | |
| 1090 | wingboard = TRUE; | |
| 1091 | jumper_e16_e17 = TRUE; | |
| 1092 | peplus_load_superdata(machine, "user1"); | |
| 1093 | ||
| 1059 | 1094 | peplus_init(machine); |
| 1060 | 1095 | } |
| 1061 | 1096 | |
| 1097 | ||
| 1062 | 1098 | /************************* |
| 1063 | 1099 | * Rom Load * |
| 1064 | 1100 | *************************/ |
| r4135 | r4136 | |
| 1067 | 1103 | ROM_REGION( 0x10000, "main", 0 ) |
| 1068 | 1104 | ROM_LOAD( "set038.u68", 0x00000, 0x10000, CRC(9c4b1d1a) SHA1(8a65cd1d8e2d74c7b66f4dfc73e7afca8458e979) ) |
| 1069 | 1105 | |
| 1070 | ROM_REGION( 0x | |
| 1106 | ROM_REGION( 0x | |
| 1071 | 1107 | ROM_LOAD( "mro-cg740.u72", 0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) ) |
| 1072 | 1108 | ROM_LOAD( "mgo-cg740.u73", 0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) ) |
| 1073 | 1109 | ROM_LOAD( "mbo-cg740.u74", 0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) ) |
| 1074 | 1110 | ROM_LOAD( "mxo-cg740.u75", 0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) ) |
| 1075 | 1111 | |
| 1076 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1077 | ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) ) | |
| 1112 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1113 | ROM_LOAD( "cap740.u50", 0x0000, 0x0200, CRC(8020b65f) SHA1(e280b11315acba88799d8875fb2980bee9d5e687) ) | |
| 1078 | 1114 | ROM_END |
| 1079 | 1115 | |
| 1080 | 1116 | ROM_START( pepp0065 ) /* Normal board : Jokers Wild Poker (PP0065) */ |
| 1081 | 1117 | ROM_REGION( 0x10000, "main", 0 ) |
| 1082 | 1118 | ROM_LOAD( "pp0065.u68", 0x00000, 0x10000, CRC(76c1a367) SHA1(ea8be9241e9925b5a4206db6875e1572f85fa5fe) ) |
| 1083 | 1119 | |
| 1084 | ROM_REGION( 0x | |
| 1120 | ROM_REGION( 0x | |
| 1085 | 1121 | ROM_LOAD( "mro-cg740.u72", 0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) ) |
| 1086 | 1122 | ROM_LOAD( "mgo-cg740.u73", 0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) ) |
| 1087 | 1123 | ROM_LOAD( "mbo-cg740.u74", 0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) ) |
| 1088 | 1124 | ROM_LOAD( "mxo-cg740.u75", 0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) ) |
| 1089 | 1125 | |
| 1090 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1091 | ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) ) | |
| 1126 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1127 | ROM_LOAD( "cap740.u50", 0x0000, 0x0200, CRC(8020b65f) SHA1(e280b11315acba88799d8875fb2980bee9d5e687) ) | |
| 1092 | 1128 | ROM_END |
| 1093 | 1129 | |
| 1094 | 1130 | ROM_START( pepp0158 ) /* Normal board : 4 of a Kind Bonus Poker (PP0158) */ |
| 1095 | 1131 | ROM_REGION( 0x10000, "main", 0 ) |
| 1096 | 1132 | ROM_LOAD( "pp0158.u68", 0x00000, 0x10000, CRC(5976cd19) SHA1(6a461ea9ddf78dffa3cf8b65903ebf3127f23d45) ) |
| 1097 | 1133 | |
| 1098 | ROM_REGION( 0x | |
| 1134 | ROM_REGION( 0x | |
| 1099 | 1135 | ROM_LOAD( "mro-cg740.u72", 0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) ) |
| 1100 | 1136 | ROM_LOAD( "mgo-cg740.u73", 0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) ) |
| 1101 | 1137 | ROM_LOAD( "mbo-cg740.u74", 0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) ) |
| 1102 | 1138 | ROM_LOAD( "mxo-cg740.u75", 0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) ) |
| 1103 | 1139 | |
| 1104 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1105 | ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) ) | |
| 1140 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1141 | ROM_LOAD( "cap740.u50", 0x0000, 0x0200, CRC(8020b65f) SHA1(e280b11315acba88799d8875fb2980bee9d5e687) ) | |
| 1106 | 1142 | ROM_END |
| 1107 | 1143 | |
| 1108 | 1144 | ROM_START( pepp0188 ) /* Normal board : Standard Draw Poker (PP0188) */ |
| 1109 | 1145 | ROM_REGION( 0x10000, "main", 0 ) |
| 1110 | 1146 | ROM_LOAD( "pp0188.u68", 0x00000, 0x10000, CRC(cf36a53c) SHA1(99b578538ab24d9ff91971b1f77599272d1dbfc6) ) |
| 1111 | 1147 | |
| 1112 | ROM_REGION( 0x | |
| 1148 | ROM_REGION( 0x | |
| 1113 | 1149 | ROM_LOAD( "mro-cg740.u72", 0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) ) |
| 1114 | 1150 | ROM_LOAD( "mgo-cg740.u73", 0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) ) |
| 1115 | 1151 | ROM_LOAD( "mbo-cg740.u74", 0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) ) |
| 1116 | 1152 | ROM_LOAD( "mxo-cg740.u75", 0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) ) |
| 1117 | 1153 | |
| 1118 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1119 | ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) ) | |
| 1154 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1155 | ROM_LOAD( "cap740.u50", 0x0000, 0x0200, CRC(8020b65f) SHA1(e280b11315acba88799d8875fb2980bee9d5e687) ) | |
| 1120 | 1156 | ROM_END |
| 1121 | 1157 | |
| 1122 | 1158 | ROM_START( pepp0250 ) /* Normal board : Double Down Stud Poker (PP0250) */ |
| 1123 | 1159 | ROM_REGION( 0x10000, "main", 0 ) |
| 1124 | 1160 | ROM_LOAD( "pp0250.u68", 0x00000, 0x10000, CRC(4c919598) SHA1(fe73503c6ccb3c5746fb96be58cd5b740c819713) ) |
| 1125 | 1161 | |
| 1126 | ROM_REGION( 0x | |
| 1162 | ROM_REGION( 0x | |
| 1127 | 1163 | ROM_LOAD( "mro-cg740.u72", 0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) ) |
| 1128 | 1164 | ROM_LOAD( "mgo-cg740.u73", 0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) ) |
| 1129 | 1165 | ROM_LOAD( "mbo-cg740.u74", 0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) ) |
| 1130 | 1166 | ROM_LOAD( "mxo-cg740.u75", 0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) ) |
| 1131 | 1167 | |
| 1132 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1133 | ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) ) | |
| 1168 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1169 | ROM_LOAD( "cap740.u50", 0x0000, 0x0200, CRC(8020b65f) SHA1(e280b11315acba88799d8875fb2980bee9d5e687) ) | |
| 1134 | 1170 | ROM_END |
| 1135 | 1171 | |
| 1136 | 1172 | ROM_START( pepp0447 ) /* Normal board : Standard Draw Poker (PP0447) */ |
| 1137 | 1173 | ROM_REGION( 0x10000, "main", 0 ) |
| 1138 | 1174 | ROM_LOAD( "pp0447.u68", 0x00000, 0x10000, CRC(0ef0bb6c) SHA1(d0ef7a83417054f05d32d0a93ed0d5d618f4dfb9) ) |
| 1139 | 1175 | |
| 1140 | ROM_REGION( 0x | |
| 1176 | ROM_REGION( 0x | |
| 1141 | 1177 | ROM_LOAD( "mro-cg740.u72", 0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) ) |
| 1142 | 1178 | ROM_LOAD( "mgo-cg740.u73", 0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) ) |
| 1143 | 1179 | ROM_LOAD( "mbo-cg740.u74", 0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) ) |
| 1144 | 1180 | ROM_LOAD( "mxo-cg740.u75", 0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) ) |
| 1145 | 1181 | |
| 1146 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1147 | ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) ) | |
| 1182 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1183 | ROM_LOAD( "cap740.u50", 0x0000, 0x0200, CRC(8020b65f) SHA1(e280b11315acba88799d8875fb2980bee9d5e687) ) | |
| 1148 | 1184 | ROM_END |
| 1149 | 1185 | |
| 1150 | 1186 | ROM_START( pepp0516 ) /* Normal board : Double Bonus Poker (PP0516) */ |
| 1151 | 1187 | ROM_REGION( 0x10000, "main", 0 ) |
| 1152 | 1188 | ROM_LOAD( "pp0516.u68", 0x00000, 0x10000, CRC(d9da6e13) SHA1(421678d9cb42daaf5b21074cc3900db914dd26cf) ) |
| 1153 | 1189 | |
| 1154 | ROM_REGION( 0x | |
| 1190 | ROM_REGION( 0x | |
| 1155 | 1191 | ROM_LOAD( "mro-cg740.u72", 0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) ) |
| 1156 | 1192 | ROM_LOAD( "mgo-cg740.u73", 0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) ) |
| 1157 | 1193 | ROM_LOAD( "mbo-cg740.u74", 0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) ) |
| 1158 | 1194 | ROM_LOAD( "mxo-cg740.u75", 0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) ) |
| 1159 | 1195 | |
| 1160 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1161 | ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) ) | |
| 1196 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1197 | ROM_LOAD( "cap740.u50", 0x0000, 0x0200, CRC(8020b65f) SHA1(e280b11315acba88799d8875fb2980bee9d5e687) ) | |
| 1162 | 1198 | ROM_END |
| 1163 | 1199 | |
| 1164 | 1200 | ROM_START( pebe0014 ) /* Normal board : Blackjack (BE0014) */ |
| 1165 | 1201 | ROM_REGION( 0x10000, "main", 0 ) |
| 1166 | 1202 | ROM_LOAD( "be0014.u68", 0x00000, 0x10000, CRC(232b32b7) SHA1(a3af9414577642fedc23b4c1911901cd31e9d6e0) ) |
| 1167 | 1203 | |
| 1168 | ROM_REGION( 0x | |
| 1204 | ROM_REGION( 0x | |
| 1169 | 1205 | ROM_LOAD( "mro-cg2036.u72", 0x00000, 0x8000, CRC(0a168d06) SHA1(7ed4fb5c7bcacab077bcec030f0465c6eaf3ce1c) ) |
| 1170 | 1206 | ROM_LOAD( "mgo-cg2036.u73", 0x08000, 0x8000, CRC(826b4090) SHA1(34390484c0faffe9340fd93d273b9292d09f97fd) ) |
| 1171 | 1207 | ROM_LOAD( "mbo-cg2036.u74", 0x10000, 0x8000, CRC(46aac851) SHA1(28d84b49c6cebcf2894b5a15d935618f84093caa) ) |
| 1172 | 1208 | ROM_LOAD( "mxo-cg2036.u75", 0x18000, 0x8000, CRC(60204a56) SHA1(2e3420da9e79ba304ca866d124788f84861380a7) ) |
| 1173 | 1209 | |
| 1174 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1175 | ROM_LOAD( "cap707.u50", 0x0000, 0x0100, CRC(9851ba36) SHA1(5a0a43c1e212ae8c173102ede9c57a3d95752f99) ) | |
| 1210 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1211 | ROM_LOAD( "cap707.u50", 0x0000, 0x0200, CRC(5bfeed62) SHA1(df47a2723a70a7c16fbf03b9f614e9b98751a59e) ) | |
| 1176 | 1212 | ROM_END |
| 1177 | 1213 | |
| 1178 | 1214 | ROM_START( peke1012 ) /* Normal board : Keno (KE1012) */ |
| 1179 | 1215 | ROM_REGION( 0x10000, "main", 0 ) |
| 1180 | 1216 | ROM_LOAD( "ke1012.u68", 0x00000, 0x10000, CRC(470e8c10) SHA1(f8a65a3a73477e9e9d2f582eeefa93b470497dfa) ) |
| 1181 | 1217 | |
| 1182 | ROM_REGION( 0x | |
| 1218 | ROM_REGION( 0x | |
| 1183 | 1219 | ROM_LOAD( "mro-cg1267.u72", 0x00000, 0x8000, CRC(16498b57) SHA1(9c22726299af7204c4be1c6d8afc4c1b512ad918) ) |
| 1184 | 1220 | ROM_LOAD( "mgo-cg1267.u73", 0x08000, 0x8000, CRC(80847c5a) SHA1(8422cd13a91c3c462af5efcfca8615e7eeaa2e52) ) |
| 1185 | 1221 | ROM_LOAD( "mbo-cg1267.u74", 0x10000, 0x8000, CRC(ce7af8a7) SHA1(38675122c764b8fa9260246ea99ac0f0750da277) ) |
| 1186 | 1222 | ROM_LOAD( "mxo-cg1267.u75", 0x18000, 0x8000, CRC(3aac0d4a) SHA1(764da54bdb2f2c49551cf1d10286de9450abad2f) ) |
| 1187 | 1223 | |
| 1188 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1189 | ROM_LOAD( "cap1267.u50", 0x0000, 0x0100, CRC(7051db57) SHA1(76751a3cc47d506983205decb07e99ca0c178a42) ) | |
| 1224 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1225 | ROM_LOAD( "cap1267.u50", 0x0000, 0x0200, CRC(3dac264f) SHA1(e9c9de42ffd64d4463bee6fa10886a53bc062ff8) ) | |
| 1190 | 1226 | ROM_END |
| 1191 | 1227 | |
| 1192 | 1228 | ROM_START( peps0014 ) /* Normal board : Super Joker Slots (PS0014) */ |
| 1193 | 1229 | ROM_REGION( 0x10000, "main", 0 ) |
| 1194 | 1230 | ROM_LOAD( "ps0014.u68", 0x00000, 0x10000, CRC(368c3f58) SHA1(ebefcefbb5386659680719936bff72ad61087343) ) |
| 1195 | 1231 | |
| 1196 | ROM_REGION( 0x | |
| 1232 | ROM_REGION( 0x | |
| 1197 | 1233 | ROM_LOAD( "mro-cg0916.u72", 0x00000, 0x8000, CRC(d97049d9) SHA1(78f7bb33866ca92922a8b83d5f9ac459edd39176) ) |
| 1198 | 1234 | ROM_LOAD( "mgo-cg0916.u73", 0x08000, 0x8000, CRC(6e075788) SHA1(e8e9d8b7943d62e31d1d58f870bc765cba65c203) ) |
| 1199 | 1235 | ROM_LOAD( "mbo-cg0916.u74", 0x10000, 0x8000, CRC(a5cdf0f3) SHA1(23b2749fd2cb5b8462ce7c912005779b611f32f9) ) |
| 1200 | 1236 | ROM_LOAD( "mxo-cg0916.u75", 0x18000, 0x8000, CRC(1f3a2d72) SHA1(8e07324d436980b628e007d30a835757c1f70f6d) ) |
| 1201 | 1237 | |
| 1202 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1203 | ROM_LOAD( "cap0916.u50", 0x0000, 0x0100, CRC(b9a5ee21) SHA1(d3c952f594baca9dc234602d90c506dd537c4dcc) ) | |
| 1238 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1239 | ROM_LOAD( "cap0916.u50", 0x0000, 0x0200, CRC(c9a4f87c) SHA1(3c7c53fbf7573f07b334e0529bfd7ccf8d5339b5) ) | |
| 1204 | 1240 | ROM_END |
| 1205 | 1241 | |
| 1206 | 1242 | ROM_START( peps0022 ) /* Normal board : Red White & Blue Slots (PS0022) */ |
| 1207 | 1243 | ROM_REGION( 0x10000, "main", 0 ) |
| 1208 | 1244 | ROM_LOAD( "ps0022.u68", 0x00000, 0x10000, CRC(d65c0939) SHA1(d91f472a43f77f9df8845e97561540f988e522e3) ) |
| 1209 | 1245 | |
| 1210 | ROM_REGION( 0x | |
| 1246 | ROM_REGION( 0x | |
| 1211 | 1247 | ROM_LOAD( "mro-cg0960.u72", 0x00000, 0x8000, CRC(8c38c6fd) SHA1(5d6e9ac18b9b3f1253bba080bef1c067b2fdd7a8) ) |
| 1212 | 1248 | ROM_LOAD( "mgo-cg0960.u73", 0x08000, 0x8000, CRC(b4f44163) SHA1(1bc635a5160fdff2882c8362644aebf983a1a427) ) |
| 1213 | 1249 | ROM_LOAD( "mbo-cg0960.u74", 0x10000, 0x8000, CRC(8057e3a8) SHA1(5510872b1607daaf890603e76a8a47680e639e8e) ) |
| 1214 | 1250 | ROM_LOAD( "mxo-cg0960.u75", 0x18000, 0x8000, CRC(d57b4c25) SHA1(6ddfbaae87f9958642ddb95e581ac31e1dd55608) ) |
| 1215 | 1251 | |
| 1216 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1217 | ROM_LOAD( "cap0960.u50", 0x0000, 0x0100, CRC(00dd8d0a) SHA1(542763b12aeb0aec2b410f7c075c52907f45d171) ) | |
| 1252 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1253 | ROM_LOAD( "cap0960.u50", 0x0000, 0x0200, CRC(83d67070) SHA1(4c50abbe750dbd4a461084b0bfc51e38df97e421) ) | |
| 1218 | 1254 | ROM_END |
| 1219 | 1255 | |
| 1220 | 1256 | ROM_START( peps0043 ) /* Normal board : Double Diamond Slots (PS0043) */ |
| 1221 | 1257 | ROM_REGION( 0x10000, "main", 0 ) |
| 1222 | 1258 | ROM_LOAD( "ps0043.u68", 0x00000, 0x10000, CRC(d612429c) SHA1(95eb4774482a930066456d517fb2e4f67d4df4cb) ) |
| 1223 | 1259 | |
| 1224 | ROM_REGION( 0x | |
| 1260 | ROM_REGION( 0x | |
| 1225 | 1261 | ROM_LOAD( "mro-cg1003.u72", 0x00000, 0x8000, CRC(41ce0395) SHA1(ae90dbae30e4efed33f83ee7038fb2e5171c1945) ) |
| 1226 | 1262 | ROM_LOAD( "mgo-cg1003.u73", 0x08000, 0x8000, CRC(5a383fa1) SHA1(27b1febbdda7332e8d474fc0cca683f451a07090) ) |
| 1227 | 1263 | ROM_LOAD( "mbo-cg1003.u74", 0x10000, 0x8000, CRC(5ec00224) SHA1(bb70a4326cd1810b200e193a449061df62085f37) ) |
| 1228 | 1264 | ROM_LOAD( "mxo-cg1003.u75", 0x18000, 0x8000, CRC(2ffacd52) SHA1(38126ac4998806a1ddd55e6aa1942044240d41d0) ) |
| 1229 | 1265 | |
| 1230 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1231 | ROM_LOAD( "cap1003.u50", 0x0000, 0x0100, CRC(cc400805) SHA1(f5ac48ad2a5df64da150f09f2ea5d910230bde56) ) | |
| 1266 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1267 | ROM_LOAD( "cap1003.u50", 0x0000, 0x0200, CRC(1fb7b69f) SHA1(cdb609f39ef1ca0ddf389a599f799c269c7163f9) ) | |
| 1232 | 1268 | ROM_END |
| 1233 | 1269 | |
| 1234 | 1270 | ROM_START( peps0045 ) /* Normal board : Red White & Blue Slots (PS0045) */ |
| 1235 | 1271 | ROM_REGION( 0x10000, "main", 0 ) |
| 1236 | 1272 | ROM_LOAD( "ps0045.u68", 0x00000, 0x10000, CRC(de180b84) SHA1(0d592d7d535b0aacbd62c18ac222da770fab7b85) ) |
| 1237 | 1273 | |
| 1238 | ROM_REGION( 0x | |
| 1274 | ROM_REGION( 0x | |
| 1239 | 1275 | ROM_LOAD( "mro-cg0960.u72", 0x00000, 0x8000, CRC(8c38c6fd) SHA1(5d6e9ac18b9b3f1253bba080bef1c067b2fdd7a8) ) |
| 1240 | 1276 | ROM_LOAD( "mgo-cg0960.u73", 0x08000, 0x8000, CRC(b4f44163) SHA1(1bc635a5160fdff2882c8362644aebf983a1a427) ) |
| 1241 | 1277 | ROM_LOAD( "mbo-cg0960.u74", 0x10000, 0x8000, CRC(8057e3a8) SHA1(5510872b1607daaf890603e76a8a47680e639e8e) ) |
| 1242 | 1278 | ROM_LOAD( "mxo-cg0960.u75", 0x18000, 0x8000, CRC(d57b4c25) SHA1(6ddfbaae87f9958642ddb95e581ac31e1dd55608) ) |
| 1243 | 1279 | |
| 1244 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1245 | ROM_LOAD( "cap0960.u50", 0x0000, 0x0100, CRC(00dd8d0a) SHA1(542763b12aeb0aec2b410f7c075c52907f45d171) ) | |
| 1280 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1281 | ROM_LOAD( "cap0960.u50", 0x0000, 0x0200, CRC(83d67070) SHA1(4c50abbe750dbd4a461084b0bfc51e38df97e421) ) | |
| 1246 | 1282 | ROM_END |
| 1247 | 1283 | |
| 1248 | 1284 | ROM_START( peps0308 ) /* Normal board : Double Jackpot Slots (PS0308) */ |
| 1249 | 1285 | ROM_REGION( 0x10000, "main", 0 ) |
| 1250 | 1286 | ROM_LOAD( "ps0308.u68", 0x00000, 0x10000, CRC(fe30e081) SHA1(d216cbc6336727caf359e6b178c856ab2659cabd) ) |
| 1251 | 1287 | |
| 1252 | ROM_REGION( 0x | |
| 1288 | ROM_REGION( 0x | |
| 1253 | 1289 | ROM_LOAD( "mro-cg0911.u72", 0x00000, 0x8000, CRC(48491b50) SHA1(9ec6d3ff34a08d40082a1347a46635838fd31afc) ) |
| 1254 | 1290 | ROM_LOAD( "mgo-cg0911.u73", 0x08000, 0x8000, CRC(c1ff7d97) SHA1(78ab138ae9c7f9b3352f9b1ef5fbc473993bb8c8) ) |
| 1255 | 1291 | ROM_LOAD( "mbo-cg0911.u74", 0x10000, 0x8000, CRC(202e0f9e) SHA1(51421dfd1b00a9e3b1e938d5bffaa3b7cd4c2b5e) ) |
| 1256 | 1292 | ROM_LOAD( "mxo-cg0911.u75", 0x18000, 0x8000, CRC(d97740a2) SHA1(d76926d7fbbc24d2384a1079cb97e654600b134b) ) |
| 1257 | 1293 | |
| 1258 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1259 | ROM_LOAD( "cap0911.u50", 0x0000, 0x0100, CRC(f117e781) SHA1(ba9d850c93e5f3abc26b0ba51f67fa7c07e05f59) ) | |
| 1294 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1295 | ROM_LOAD( "cap0911.u50", 0x0000, 0x0200, CRC(79dc19c0) SHA1(9ebf998b73c3390cbb957b3dd3fec57b3c70a06d) ) | |
| 1260 | 1296 | ROM_END |
| 1261 | 1297 | |
| 1262 | 1298 | ROM_START( peps0615 ) /* Normal board : Chaos Slots (PS0615) */ |
| 1263 | 1299 | ROM_REGION( 0x10000, "main", 0 ) |
| 1264 | 1300 | ROM_LOAD( "ps0615.u68", 0x00000, 0x10000, CRC(d27dd6ab) SHA1(b3f065f507191682edbd93b07b72ed87bf6ae9b1) ) |
| 1265 | 1301 | |
| 1266 | ROM_REGION( 0x | |
| 1302 | ROM_REGION( 0x | |
| 1267 | 1303 | ROM_LOAD( "mro-cg2246.u72", 0x00000, 0x8000, CRC(7c08c355) SHA1(2a154b81c6d9671cea55a924bffb7f5461747142) ) |
| 1268 | 1304 | ROM_LOAD( "mgo-cg2246.u73", 0x08000, 0x8000, CRC(b3c16487) SHA1(c97232fadd086f604eaeb3cd3c2d1c8fe0dcfa70) ) |
| 1269 | 1305 | ROM_LOAD( "mbo-cg2246.u74", 0x10000, 0x8000, CRC(e61331f5) SHA1(4364edc625d64151cbae40780b54cb1981086647) ) |
| 1270 | 1306 | ROM_LOAD( "mxo-cg2246.u75", 0x18000, 0x8000, CRC(f0f4a27d) SHA1(3a10ab196aeaa5b50d47b9d3c5b378cfadd6fe96) ) |
| 1271 | 1307 | |
| 1272 | ROM_REGION( 0x100, "proms", 0 ) // WRONG CAP | |
| 1273 | ROM_LOAD( "cap0960.u50", 0x0000, 0x0100, CRC(00dd8d0a) SHA1(542763b12aeb0aec2b410f7c075c52907f45d171) ) | |
| 1308 | ROM_REGION( 0x200, "proms", 0 ) // WRONG CAP | |
| 1309 | ROM_LOAD( "cap0960.u50", 0x0000, 0x0200, CRC(83d67070) SHA1(4c50abbe750dbd4a461084b0bfc51e38df97e421) ) | |
| 1274 | 1310 | ROM_END |
| 1275 | 1311 | |
| 1276 | 1312 | ROM_START( peps0716 ) /* Normal board : River Gambler Slots (PS0716) */ |
| 1277 | 1313 | ROM_REGION( 0x10000, "main", 0 ) |
| 1278 | 1314 | ROM_LOAD( "ps0716.u68", 0x00000, 0x10000, CRC(7615d7b6) SHA1(91fe62eec720a0dc2ebf48835065148f19499d16) ) |
| 1279 | 1315 | |
| 1280 | ROM_REGION( 0x | |
| 1316 | ROM_REGION( 0x | |
| 1281 | 1317 | ROM_LOAD( "mro-cg2266.u72", 0x00000, 0x8000, CRC(590accd8) SHA1(4e1c963c50799eaa49970e25ecf9cb01eb6b09e1) ) |
| 1282 | 1318 | ROM_LOAD( "mgo-cg2266.u73", 0x08000, 0x8000, CRC(b87ffa05) SHA1(92126b670b9cabeb5e2cc35b6e9c458088b18eea) ) |
| 1283 | 1319 | ROM_LOAD( "mbo-cg2266.u74", 0x10000, 0x8000, CRC(e3df30e1) SHA1(c7d2ae9a7c7e53bfb6197b635efcb5dc231e4fe0) ) |
| 1284 | 1320 | ROM_LOAD( "mxo-cg2266.u75", 0x18000, 0x8000, CRC(56271442) SHA1(61ad0756b9f6412516e46ef6625a4c3899104d4e) ) |
| 1285 | 1321 | |
| 1286 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1287 | ROM_LOAD( "cap2266.u50", 0x0000, 0x0100, CRC(5aaff103) SHA1(9cfda9c095cb77a8bb761c131a0f358e79b97abc) ) | |
| 1322 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1323 | ROM_LOAD( "cap2266.u50", 0x0000, 0x0200, CRC(ae8b52ac) SHA1(f58d40ee77d7f432dfe5f37954e43cab654c9a4c) ) | |
| 1288 | 1324 | ROM_END |
| 1289 | 1325 | |
| 1290 | 1326 | ROM_START( pex2069p ) /* Superboard : Double Double Bonus Poker (X002069P) */ |
| r4135 | r4136 | |
| 1294 | 1330 | ROM_REGION( 0x10000, "user1", 0 ) |
| 1295 | 1331 | ROM_LOAD( "x002069p.u66", 0x00000, 0x10000, CRC(875ecfcf) SHA1(80472cb43b36e518216e60a9b4883a81163718a2) ) |
| 1296 | 1332 | |
| 1297 | ROM_REGION( 0x | |
| 1333 | ROM_REGION( 0x | |
| 1298 | 1334 | ROM_LOAD( "mro-cg2185.u77", 0x00000, 0x8000, CRC(7e64bd1a) SHA1(e988a380ee58078bf5bdc7747e83aed1393cfad8) ) |
| 1299 | 1335 | ROM_LOAD( "mgo-cg2185.u78", 0x08000, 0x8000, CRC(d4127893) SHA1(75039c45ba6fd171a66876c91abc3191c7feddfc) ) |
| 1300 | 1336 | ROM_LOAD( "mbo-cg2185.u79", 0x10000, 0x8000, CRC(17dba955) SHA1(5f77379c88839b3a04e235e4fb0120c77e17b60e) ) |
| 1301 | 1337 | ROM_LOAD( "mxo-cg2185.u80", 0x18000, 0x8000, CRC(583eb3b1) SHA1(4a2952424969917fb1594698a779fe5a1e99bff5) ) |
| 1302 | 1338 | |
| 1303 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1304 | ROM_LOAD( "cap1321.u43", 0x0000, 0x0100, CRC(1e19c0ff) SHA1(e48ebc4a3c88e8b8c9740841dac919e9bb2c4b7f) ) | |
| 1339 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1340 | ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) ) | |
| 1305 | 1341 | ROM_END |
| 1306 | 1342 | |
| 1307 | 1343 | ROM_START( pexp0019 ) /* Superboard : Deuces Wild Poker (XP000019) */ |
| r4135 | r4136 | |
| 1311 | 1347 | ROM_REGION( 0x10000, "user1", 0 ) |
| 1312 | 1348 | ROM_LOAD( "x002025p.u66", 0x00000, 0x10000, CRC(f3dac423) SHA1(e9394d330deb3b8a1001e57e72a506cd9098f161) ) |
| 1313 | 1349 | |
| 1314 | ROM_REGION( 0x | |
| 1350 | ROM_REGION( 0x | |
| 1315 | 1351 | ROM_LOAD( "mro-cg2185.u77", 0x00000, 0x8000, CRC(7e64bd1a) SHA1(e988a380ee58078bf5bdc7747e83aed1393cfad8) ) |
| 1316 | 1352 | ROM_LOAD( "mgo-cg2185.u78", 0x08000, 0x8000, CRC(d4127893) SHA1(75039c45ba6fd171a66876c91abc3191c7feddfc) ) |
| 1317 | 1353 | ROM_LOAD( "mbo-cg2185.u79", 0x10000, 0x8000, CRC(17dba955) SHA1(5f77379c88839b3a04e235e4fb0120c77e17b60e) ) |
| 1318 | 1354 | ROM_LOAD( "mxo-cg2185.u80", 0x18000, 0x8000, CRC(583eb3b1) SHA1(4a2952424969917fb1594698a779fe5a1e99bff5) ) |
| 1319 | 1355 | |
| 1320 | ROM_REGION( 0x100, "proms", 0 ) // WRONG CAP | |
| 1321 | ROM_LOAD( "cap2234.u43", 0x0000, 0x0100, CRC(a930e283) SHA1(61bce50fa13b3e980ece3e72d068835e19bd5049) ) | |
| 1356 | ROM_REGION( 0x200, "proms", 0 ) // WRONG CAP | |
| 1357 | ROM_LOAD( "capx2234.u43", 0x0000, 0x0200, CRC(519000fa) SHA1(31cd72643ca74a778418f944045e9e03937143d6) ) | |
| 1322 | 1358 | ROM_END |
| 1323 | 1359 | |
| 1324 | 1360 | ROM_START( pexp0112 ) /* Superboard : White Hot Aces Poker (XP000112) */ |
| r4135 | r4136 | |
| 1328 | 1364 | ROM_REGION( 0x10000, "user1", 0 ) |
| 1329 | 1365 | ROM_LOAD( "x002035p.u66", 0x00000, 0x10000, CRC(dc3f0742) SHA1(d57cf3353b81f41895458019e47203f98645f17a) ) |
| 1330 | 1366 | |
| 1331 | ROM_REGION( 0x | |
| 1367 | ROM_REGION( 0x | |
| 1332 | 1368 | ROM_LOAD( "mro-cg2324.u77", 0x00000, 0x8000, CRC(6eceef42) SHA1(a2ddd2a3290c41e510f483c6b633fe0002694d0b) ) |
| 1333 | 1369 | ROM_LOAD( "mgo-cg2324.u78", 0x08000, 0x8000, CRC(26d0acbe) SHA1(09a9127deb88185cd5b748bac657461eadb2f48f) ) |
| 1334 | 1370 | ROM_LOAD( "mbo-cg2324.u79", 0x10000, 0x8000, CRC(47baee32) SHA1(d8af09022ccb5fc06aa3aa4c200a734b66cbee00) ) |
| 1335 | 1371 | ROM_LOAD( "mxo-cg2324.u80", 0x18000, 0x8000, CRC(60449fc0) SHA1(251d1e04786b70c1d2bc7b02f3b69cd58ac76398) ) |
| 1336 | 1372 | |
| 1337 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1338 | ROM_LOAD( "cap2174.u43", 0x0000, 0x0100, CRC(cbff3f26) SHA1(9e145676f2871c2369042a13cbeabb7efe2728e1) ) | |
| 1373 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1374 | ROM_LOAD( "capx2174.u43", 0x0000, 0x0200, CRC(50bdad55) SHA1(958d463c7effb3457c1f9c44c9b7822339c04e8b) ) | |
| 1339 | 1375 | ROM_END |
| 1340 | 1376 | |
| 1341 | 1377 | ROM_START( pexs0006 ) /* Superboard : Triple Triple Diamond Slots (XS000006) */ |
| r4135 | r4136 | |
| 1345 | 1381 | ROM_REGION( 0x10000, "user1", 0 ) |
| 1346 | 1382 | ROM_LOAD( "x000998s.u66", 0x00000, 0x10000, CRC(e29d4346) SHA1(93901ff65c8973e34ac1f0dd68bb4c4973da5621) ) |
| 1347 | 1383 | |
| 1348 | ROM_REGION( 0x | |
| 1384 | ROM_REGION( 0x | |
| 1349 | 1385 | ROM_LOAD( "mro-cg2361.u77", 0x00000, 0x8000, CRC(c0eba866) SHA1(8f217aeb3e8028a5633d95e5612f1b55e601650f) ) |
| 1350 | 1386 | ROM_LOAD( "mgo-cg2361.u78", 0x08000, 0x8000, CRC(345eaea2) SHA1(18ebb94a323e1cf671201db8b9f85d4f30d8b5ec) ) |
| 1351 | 1387 | ROM_LOAD( "mbo-cg2361.u79", 0x10000, 0x8000, CRC(fa130af6) SHA1(aca5e52e00bc75a4801fd3f6c564e62ed4251d8e) ) |
| 1352 | 1388 | ROM_LOAD( "mxo-cg2361.u80", 0x18000, 0x8000, CRC(7de1812c) SHA1(c7e23a10f20fc8b618df21dd33ac456e1d2cfe33) ) |
| 1353 | 1389 | |
| 1354 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1355 | ROM_LOAD( "cap2361.u43", 0x0000, 0x0100, CRC(051aea66) SHA1(2abf32caaeb821ca50a6398581de69bbfe5930e9) ) | |
| 1390 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1391 | ROM_LOAD( "capx2361.u43", 0x0000, 0x0200, CRC(93057296) SHA1(534bbf8ee80a22822d577f6685501f4c929987ef) ) | |
| 1356 | 1392 | ROM_END |
| 1357 | 1393 | |
| 1358 | 1394 | ROM_START( pexmp006 ) /* Superboard : Multi-Poker (XMP00006) */ |
| r4135 | r4136 | |
| 1362 | 1398 | ROM_REGION( 0x10000, "user1", 0 ) |
| 1363 | 1399 | ROM_LOAD( "xm00002p.u66", 0x00000, 0x10000, CRC(96cf471c) SHA1(9597bf6a80c392ee22dc4606db610fdaf032377f) ) |
| 1364 | 1400 | |
| 1365 | ROM_REGION( 0x | |
| 1401 | ROM_REGION( 0x | |
| 1366 | 1402 | ROM_LOAD( "mro-cg2174.u77", 0x00000, 0x8000, CRC(bb666733) SHA1(dcaa1980b051a554cb0f443b1183a680edc9ad3f) ) |
| 1367 | 1403 | ROM_LOAD( "mgo-cg2174.u78", 0x08000, 0x8000, CRC(cc46adb0) SHA1(6065aa5dcb9091ad80e499c7ee6dc629e79c865a) ) |
| 1368 | 1404 | ROM_LOAD( "mbo-cg2174.u79", 0x10000, 0x8000, CRC(7291a0c8) SHA1(1068f35e6ef5fd88c584922860231840a90fb623) ) |
| 1369 | 1405 | ROM_LOAD( "mxo-cg2174.u80", 0x18000, 0x8000, CRC(14f9480c) SHA1(59323f9fc5995277aea86d088893b6eb95b4e89b) ) |
| 1370 | 1406 | |
| 1371 | ROM_REGION( 0x100, "proms", 0 ) | |
| 1372 | ROM_LOAD( "cap2174.u43", 0x0000, 0x0100, CRC(cbff3f26) SHA1(9e145676f2871c2369042a13cbeabb7efe2728e1) ) | |
| 1407 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1408 | ROM_LOAD( "capx2174.u43", 0x0000, 0x0200, CRC(50bdad55) SHA1(958d463c7effb3457c1f9c44c9b7822339c04e8b) ) | |
| 1373 | 1409 | ROM_END |
| 1374 | 1410 | |
| 1411 | ROM_START( pexmp017 ) /* Superboard : 5-in-1 Wingboard (XMP00017) */ | |
| 1412 | ROM_REGION( 0x10000, "main", 0 ) | |
| 1413 | ROM_LOAD( "xmp00017.u67", 0x00000, 0x10000, CRC(129e6eaa) SHA1(1dd2b83a672a618f338b553a6cbd598b6d4ce672) ) | |
| 1414 | ||
| 1415 | ROM_REGION( 0x10000, "user1", 0 ) | |
| 1416 | ROM_LOAD( "x000055p.u66", 0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) | |
| 1417 | ROM_REGION( 0x10000, "user2", 0 ) | |
| 1418 | ROM_LOAD( "x000188p.u66", 0x00000, 0x10000, CRC(3eb7580e) SHA1(86f2280542fb8a55767efd391d0fb04a12ed9408) ) | |
| 1419 | ROM_REGION( 0x10000, "user3", 0 ) | |
| 1420 | ROM_LOAD( "x000581p.u66", 0x00000, 0x10000, CRC(a4cfecc3) SHA1(b2c805781ba43bda9e208d8c16578dc96b6f58f7) ) | |
| 1421 | ROM_REGION( 0x10000, "user4", 0 ) | |
| 1422 | ROM_LOAD( "x000727p.u66", 0x00000, 0x10000, CRC(4828474c) SHA1(9836b76113a71802df30ca15f7c9a5790e6f1c5b) ) | |
| 1423 | ROM_REGION( 0x10000, "user5", 0 ) | |
| 1424 | ROM_LOAD( "x002036p.u66", 0x00000, 0x10000, CRC(69207baf) SHA1(fe038b969106ae5cdc8dde1c06497be9c7b5b8bf) ) | |
| 1425 | ||
| 1426 | ROM_REGION( 0x040000, "gfx1", ROMREGION_DISPOSE ) | |
| 1427 | ROM_LOAD( "mro-cg2298.u77", 0x00000, 0x10000, CRC(8c35dc7f) SHA1(90e9566e816287e6248d7cab318dee3ad6fac871) ) | |
| 1428 | ROM_LOAD( "mgo-cg2298.u78", 0x10000, 0x10000, CRC(3663174a) SHA1(c203a4a59f6bc1625d47f35426ffc5b4d279251a) ) | |
| 1429 | ROM_LOAD( "mbo-cg2298.u79", 0x20000, 0x10000, CRC(9088cdbe) SHA1(dc62951c584463a1e795a774f5752f890d8e3f65) ) | |
| 1430 | ROM_LOAD( "mxo-cg2298.u80", 0x30000, 0x10000, CRC(8d3aafc8) SHA1(931bc82398b94c63ed9f6f1bd95723aa801894cc) ) | |
| 1431 | ||
| 1432 | ROM_REGION( 0x200, "proms", 0 ) | |
| 1433 | ROM_LOAD( "capx2298.u43", 0x0000, 0x0200, CRC(77856036) SHA1(820487c8494965408402ddee6a54511906218e66) ) | |
| 1434 | ROM_END | |
| 1435 | ||
| 1436 | ||
| 1375 | 1437 | /************************* |
| 1376 | 1438 | * Game Drivers * |
| 1377 | 1439 | *************************/ |
| r4135 | r4136 | |
| 1412 | 1474 | /* Superboard : multi-poker */ |
| 1413 | 1475 | GAMEL(1995, pexmp006, 0, peplus, peplus_poker, peplussb, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (XMP00006) Multi-Poker", 0, layout_pe_poker ) |
| 1414 | 1476 | |
| 1477 | /* Superboard : multi-poker (wingboard) */ | |
| 1478 | GAMEL(1995, pexmp017, 0, peplus, peplus_poker, peplussbw,ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (XMP00017) 5-in-1 Wingboard", 0, layout_pe_poker ) | |
| 1479 | ||
| 1415 | 1480 | /* Superboard : slots machine */ |
| 1416 | 1481 | GAMEL(1997, pexs0006, 0, peplus, peplus_slots, peplussb, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (XS000006) Triple Triple Diamond Slots", 0, layout_pe_slots ) |
| r4135 | r4136 | |
|---|---|---|
| 278 | 278 | { |
| 279 | 279 | int shadow_offset = (machine->config->video_attributes&VIDEO_HAS_SHADOWS)?machine->config->total_colors:0; |
| 280 | 280 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 281 | UINT8 *source_base = gfx | |
| 281 | const UINT8 *source_base = gfx_element_get_data | |
| 282 | 282 | int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; |
| 283 | 283 | int sprite_screen_width = (scalex*gfx->width+0x8000)>>16; |
| 284 | 284 | if (sprite_screen_width && sprite_screen_height) |
| r4135 | r4136 | |
| 348 | 348 | { |
| 349 | 349 | for( y=sy; y<ey; y++ ) |
| 350 | 350 | { |
| 351 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 351 | const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 352 | 352 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); |
| 353 | 353 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0); |
| 354 | 354 | int x, x_index = x_index_base; |
| r4135 | r4136 | |
| 470 | 470 | int scaley = (sizey<<16)/((word0&0x0200)?0x20:0x10); |
| 471 | 471 | if(scalex && scaley) |
| 472 | 472 | { |
| 473 | gfx_element gfx = *machine->gfx[rgn]; | |
| 473 | gfx_element *gfx = machine->gfx[rgn]; | |
| 474 | ||
| 474 | 475 | if( (word0&0x0200)==0 ) |
| 475 | { | |
| 476 | gfx.width = 16; | |
| 477 | gfx.height = 16; | |
| 478 | if( word1&0x0001 ) gfx.gfxdata += 16; | |
| 479 | if( word1&0x0002 ) gfx.gfxdata += 16*gfx.line_modulo; | |
| 480 | } | |
| 476 | gfx_element_set_source_clip(gfx, (word1&0x0001) ? 16 : 0, 16, (word1&0x0002) ? 16 : 0, 16); | |
| 477 | else | |
| 478 | gfx_element_set_source_clip(gfx, 0, 32, 0, 32); | |
| 479 | ||
| 481 | 480 | zdrawgfxzoom( |
| 482 | 481 | machine, |
| 483 | 482 | bitmap, |
| 484 | | |
| 483 | | |
| 485 | 484 | sprn, |
| 486 | 485 | color, |
| 487 | 486 | flipx,flipy, |
| 488 | 487 | xpos,ypos, |
| 489 | 488 | cliprect, |
| 490 | 489 | TRANSPARENCY_PEN,0xff, |
| 491 | //(color==0x0f ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN),0xff, | |
| 492 | 490 | scalex,scaley, |
| 493 | 491 | loop ); |
| 494 | 492 | } |
| r4135 | r4136 | |
| 1508 | 1506 | * 0x1fffd always 0xffff 0xffff? |
| 1509 | 1507 | */ |
| 1510 | 1508 | static UINT16 *mpRoadRAM; /* at 0x880000 in Final Lap; at 0xa00000 in Lucky&Wild */ |
| 1511 | static UINT8 *mpRoadDirty; | |
| 1512 | static int mbRoadSomethingIsDirty; | |
| 1513 | 1509 | static int mRoadGfxBank; |
| 1514 | 1510 | static tilemap *mpRoadTilemap; |
| 1515 | 1511 | static pen_t mRoadTransparentColor; |
| r4135 | r4136 | |
| 1572 | 1568 | else |
| 1573 | 1569 | { |
| 1574 | 1570 | offset -= 0x10000/2; |
| 1575 | if( offset<ROAD_TILE_COUNT_MAX*WORDS_PER_ROAD_TILE ) | |
| 1576 | { | |
| 1577 | mpRoadDirty[offset/WORDS_PER_ROAD_TILE] = 1; | |
| 1578 | mbRoadSomethingIsDirty = 1; | |
| 1579 | } | |
| 1571 | gfx_element_mark_dirty(space->machine->gfx[mRoadGfxBank], offset/WORDS_PER_ROAD_TILE); | |
| 1580 | 1572 | } |
| 1581 | 1573 | } |
| 1582 | 1574 | |
| 1583 | static void | |
| 1584 | UpdateRoad(running_machine *machine) | |
| 1585 | { | |
| 1586 | int i; | |
| 1587 | if( mbRoadSomethingIsDirty ) | |
| 1588 | { | |
| 1589 | for( i=0; i<ROAD_TILE_COUNT_MAX; i++ ) | |
| 1590 | { | |
| 1591 | if( mpRoadDirty[i] ) | |
| 1592 | { | |
| 1593 | decodechar( | |
| 1594 | machine->gfx[mRoadGfxBank], | |
| 1595 | i, | |
| 1596 | 0x10000+(UINT8 *)mpRoadRAM); | |
| 1597 | mpRoadDirty[i] = 0; | |
| 1598 | } | |
| 1599 | } | |
| 1600 | tilemap_mark_all_tiles_dirty( mpRoadTilemap ); | |
| 1601 | mbRoadSomethingIsDirty = 0; | |
| 1602 | } | |
| 1603 | } | |
| 1604 | ||
| 1605 | static STATE_POSTLOAD( RoadMarkAllDirty ) | |
| 1606 | { | |
| 1607 | memset( mpRoadDirty,0x01,ROAD_TILE_COUNT_MAX ); | |
| 1608 | mbRoadSomethingIsDirty = 1; | |
| 1609 | } | |
| 1610 | ||
| 1611 | 1575 | void |
| 1612 | 1576 | namco_road_init(running_machine *machine, int gfxbank ) |
| 1613 | 1577 | { |
| 1578 | gfx_element *pGfx; | |
| 1579 | ||
| 1614 | 1580 | mbRoadNeedTransparent = 0; |
| 1615 | 1581 | mRoadGfxBank = gfxbank; |
| 1616 | mpRoadDirty = auto_malloc(ROAD_TILE_COUNT_MAX); | |
| 1617 | { | |
| 1618 | memset( mpRoadDirty,0x00,ROAD_TILE_COUNT_MAX ); | |
| 1619 | mbRoadSomethingIsDirty = 0; | |
| 1620 | mpRoadRAM = auto_malloc(0x20000); | |
| 1621 | { | |
| 1622 | gfx_element *pGfx = allocgfx( machine, &RoadTileLayout ); | |
| 1623 | decodegfx(pGfx, 0x10000+(UINT8 *)mpRoadRAM, 0, pGfx->total_elements); | |
| 1624 | pGfx->color_base = 0xf00; | |
| 1625 | pGfx->total_colors = 0x3f; | |
| 1626 | 1582 | |
| 1627 | machine->gfx[gfxbank] = pGfx; | |
| 1628 | mpRoadTilemap = tilemap_create(machine, | |
| 1629 | get_road_info,tilemap_scan_rows, | |
| 1630 | ROAD_TILE_SIZE,ROAD_TILE_SIZE, | |
| 1631 | ROAD_COLS,ROAD_ROWS); | |
| 1583 | mpRoadRAM = auto_malloc(0x20000); | |
| 1632 | 1584 | |
| 1633 | state_save_register_global_pointer(machine, mpRoadDirty, ROAD_TILE_COUNT_MAX); | |
| 1634 | state_save_register_global_pointer(machine, mpRoadRAM, 0x20000 / 2); | |
| 1635 | state_save_register_postload(machine, RoadMarkAllDirty, NULL); | |
| 1585 | pGfx = gfx_element_alloc( machine, &RoadTileLayout, 0x10000+(UINT8 *)mpRoadRAM, 0x3f, 0xf00); | |
| 1636 | 1586 | |
| 1637 | } | |
| 1638 | } | |
| 1587 | machine->gfx[gfxbank] = pGfx; | |
| 1588 | mpRoadTilemap = tilemap_create(machine, | |
| 1589 | get_road_info,tilemap_scan_rows, | |
| 1590 | ROAD_TILE_SIZE,ROAD_TILE_SIZE, | |
| 1591 | ROAD_COLS,ROAD_ROWS); | |
| 1592 | ||
| 1593 | state_save_register_global_pointer(machine, mpRoadRAM, 0x20000 / 2); | |
| 1639 | 1594 | } /* namco_road_init */ |
| 1640 | 1595 | |
| 1641 | 1596 | void |
| r4135 | r4136 | |
| 1653 | 1608 | unsigned yscroll; |
| 1654 | 1609 | int i; |
| 1655 | 1610 | |
| 1656 | UpdateRoad(machine); | |
| 1657 | ||
| 1658 | 1611 | pSourceBitmap = tilemap_get_pixmap(mpRoadTilemap); |
| 1659 | 1612 | yscroll = mpRoadRAM[0x1fdfe/2]; |
| 1660 | 1613 |
| r4135 | r4136 | |
|---|---|---|
| 1105 | 1105 | * |
| 1106 | 1106 | *************************************/ |
| 1107 | 1107 | |
| 1108 | static ym2610_interface ym2610_config = | |
| 1108 | static const ym2610_interface ym2610_config = | |
| 1109 | 1109 | { |
| 1110 | 1110 | audio_cpu_irq |
| 1111 | 1111 | }; |
| r4135 | r4136 | |
|---|---|---|
| 1866 | 1866 | ROM_LOAD( "321b18.7g", 0x200000, 2*1024*1024, CRC(2c561ad0) SHA1(6265054072ba1c2837dd96e0259b20bc50457160) ) |
| 1867 | 1867 | ROM_END |
| 1868 | 1868 | |
| 1869 | /* Salamander 2 */ | |
| 1869 | /* Salamander 2 (ver JAA) */ | |
| 1870 | 1870 | ROM_START( salmndr2 ) |
| 1871 | 1871 | /* main program */ |
| 1872 | 1872 | ROM_REGION( 0x800000, "main", 0 ) |
| r4135 | r4136 | |
| 1897 | 1897 | ROM_LOAD( "521-a13.7g", 0x200000, 1*1024*1024, CRC(c3322475) SHA1(1774524ff031e0c4a7f3432810e968d37f9c6331) ) |
| 1898 | 1898 | ROM_END |
| 1899 | 1899 | |
| 1900 | /* Salamander 2 (ver AAB) */ | |
| 1901 | ROM_START( salmnd2a ) | |
| 1902 | /* main program */ | |
| 1903 | ROM_REGION( 0x800000, "main", 0 ) | |
| 1904 | GX_BIOS | |
| 1905 | ROM_LOAD32_WORD_SWAP( "521aab02.bin", 0x200002, 512*1024, CRC(ac9d151f) SHA1(aabd17a41a42cbbe9b62a9751cdb264e714cac6a) ) | |
| 1906 | ROM_LOAD32_WORD_SWAP( "521aab03.bin", 0x200000, 512*1024, CRC(feecf34d) SHA1(c37959199afedd3deee9d4c248ec83ccccf9a401) ) | |
| 1907 | ||
| 1908 | /* sound program */ | |
| 1909 | ROM_REGION( 0x40000, "sound", 0 ) | |
| 1910 | ROM_LOAD16_BYTE("521-a04.9c", 0x000000, 64*1024, CRC(efddca7a) SHA1(ac6b45044b6abeb2455ec21a61322185bf1c7219) ) | |
| 1911 | ROM_LOAD16_BYTE("521-a05.7c", 0x000001, 64*1024, CRC(51a3af2c) SHA1(94d220ae619d53747bd3e762000ed59cf1b4d305) ) | |
| 1912 | ||
| 1913 | /* tiles */ | |
| 1914 | ROM_REGION( 0x800000, "gfx1", ROMREGION_ERASE00 ) | |
| 1915 | TILE_WORDS2_ROM_LOAD("521-a09.17h", 0x000000, 2*1024*1024, CRC(fb9e2f5e) SHA1(acb41616625d6976ad50e184787ab74e29f86039) ) | |
| 1916 | TILE_WORDS2_ROM_LOAD("521-a11.15h", 0x300000, 1*1024*1024, CRC(25e0a6e5) SHA1(592e9f183f077e9272a4f0ead441b5bfd8029816) ) | |
| 1917 | TILE_BYTES2_ROM_LOAD("521-a13.13c", 0x000004, 2*1024*1024, CRC(3ed7441b) SHA1(57e3e8035c056cf46a383d228c76a7da7def134f) ) | |
| 1918 | ||
| 1919 | /* sprites */ | |
| 1920 | ROM_REGION( 0x600000, "gfx2", ROMREGION_ERASE00 ) | |
| 1921 | _48_WORD_ROM_LOAD( "521-a08.25g", 0x000000, 2*1024*1024, CRC(f24f76bd) SHA1(823f614d436901241743c923206cb61d8bbb5c58) ) | |
| 1922 | _48_WORD_ROM_LOAD( "521-a07.28g", 0x000002, 2*1024*1024, CRC(50ef9b7a) SHA1(104eac2bce43e99d4adc208145afe7be9156628e) ) | |
| 1923 | _48_WORD_ROM_LOAD( "521-a06.30g", 0x000004, 2*1024*1024, CRC(cba5db2c) SHA1(505efdf8571ae28d8788dcafbfffcfb67e3189ce) ) | |
| 1924 | ||
| 1925 | /* sound data */ | |
| 1926 | ROM_REGION( 0x400000, "shared", 0 ) | |
| 1927 | ROM_LOAD( "521-a12.9g", 0x000000, 2*1024*1024, CRC(66614d3b) SHA1(e1e5ebe546bced6ab74b0af500acf0f3308902a4) ) | |
| 1928 | ROM_LOAD( "521-a13.7g", 0x200000, 1*1024*1024, CRC(c3322475) SHA1(1774524ff031e0c4a7f3432810e968d37f9c6331) ) | |
| 1929 | ROM_END | |
| 1930 | ||
| 1900 | 1931 | /* Twinbee Yahoo! */ |
| 1901 | 1932 | ROM_START( tbyahhoo ) |
| 1902 | 1933 | /* main program */ |
| r4135 | r4136 | |
| 3310 | 3341 | { "daiskiss", 7, 0, 5, BPP5 }, |
| 3311 | 3342 | { "tokkae", 7, 0, 0, BPP5 }, |
| 3312 | 3343 | { "salmndr2", 7, 0, 6, BPP66 }, |
| 3344 | { "salmnd2a", 7, 0, 6, BPP66 }, | |
| 3313 | 3345 | { "winspike", 8, 2, 7, BPP4 }, |
| 3314 | 3346 | { "winspikj", 8, 2, 7, BPP4 }, |
| 3315 | 3347 | { "soccerss", 7, 0, 0, BPP4 }, |
| r4135 | r4136 | |
| 3458 | 3490 | GAME( 1996, tokkae, konamigx, konamigx_6bpp, puzldama, konamigx, ROT0, "Konami", "Taisen Tokkae-dama (ver JAA)", GAME_IMPERFECT_GRAPHICS ) |
| 3459 | 3491 | /* protection controls player ship direction in attract mode - doesn't impact playability */ |
| 3460 | 3492 | GAME( 1996, salmndr2, konamigx, konamigx_6bpp_2, gokuparo, konamigx, ROT0, "Konami", "Salamander 2 (ver JAA)", GAME_IMPERFECT_GRAPHICS|GAME_UNEMULATED_PROTECTION ) |
| 3493 | GAME( 1996, salmnd2a, salmndr2, konamigx_6bpp_2, gokuparo, konamigx, ROT0, "Konami", "Salamander 2 (ver AAB)", GAME_IMPERFECT_GRAPHICS|GAME_UNEMULATED_PROTECTION ) | |
| 3461 | 3494 | /* bad sprite colours, part of tilemap gets blanked out when a game starts (might be more protection) */ |
| 3462 | 3495 | GAME( 1997, winspike, konamigx, winspike, konamigx, konamigx, ROT0, "Konami", "Winning Spike (ver EAA)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS ) |
| 3463 | 3496 | GAME( 1997, winspikj, winspike, winspike, konamigx, konamigx, ROT0, "Konami", "Winning Spike (ver JAA)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS ) |
| r4135 | r4136 | |
|---|---|---|
| 247 | 247 | return paletteram16[offset + palbank * 0x200]; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | UINT16* megadrive_vdp_palette_lookup_segac2; | |
| 251 | UINT16* megadrive_vdp_palette_lookup_sprite_segac2; | |
| 252 | UINT16* megadrive_vdp_palette_lookup_shadow_segac2; | |
| 253 | UINT16* megadrive_vdp_palette_lookup_highlight_segac2; | |
| 254 | ||
| 255 | ||
| 256 | 250 | /* handle writes to the paletteram */ |
| 257 | 251 | static WRITE16_HANDLER( palette_w ) |
| 258 | 252 | { |
| r4135 | r4136 | |
| 277 | 271 | /* set the color */ |
| 278 | 272 | palette_set_color_rgb(space->machine, offset, pal5bit(r), pal5bit(g), pal5bit(b)); |
| 279 | 273 | |
| 280 | megadrive_vdp_palette_lookup_segac2[offset] = (b) | (g<<5) | (r<<10); | |
| 281 | megadrive_vdp_palette_lookup_sprite_segac2[offset] = (b) | (g<<5) | (r<<10); | |
| 274 | megadrive_vdp_palette_lookup[offset] = (b) | (g<<5) | (r<<10); | |
| 275 | megadrive_vdp_palette_lookup_sprite[offset] = (b) | (g<<5) | (r<<10); | |
| 282 | 276 | |
| 283 | 277 | tmpr = r>>1;tmpg=g>>1;tmpb=b>>1; |
| 284 | megadrive_vdp_palette_lookup_shadow | |
| 278 | megadrive_vdp_palette_lookup_shadow | |
| 285 | 279 | |
| 286 | 280 | // how is it calculated on c2? |
| 287 | 281 | tmpr = tmpr|0x10; tmpg = tmpg|0x10; tmpb = tmpb|0x10; |
| 288 | megadrive_vdp_palette_lookup_highlight | |
| 282 | megadrive_vdp_palette_lookup_highlight | |
| 289 | 283 | } |
| 290 | 284 | |
| 291 | 285 | |
| r4135 | r4136 | |
| 1347 | 1341 | Sound interfaces |
| 1348 | 1342 | ******************************************************************************/ |
| 1349 | 1343 | |
| 1350 | void segac2_irq2_interrupt(running_machine *machine, int state) | |
| 1344 | static void segac2_irq2_interrupt(running_machine *machine, int state) | |
| 1351 | 1345 | { |
| 1352 | 1346 | //printf("sound irq %d\n", state); |
| 1353 | 1347 | cpu_set_input_line(machine->cpu[0], 2, state ? ASSERT_LINE : CLEAR_LINE); |
| r4135 | r4136 | |
| 1371 | 1365 | |
| 1372 | 1366 | ******************************************************************************/ |
| 1373 | 1367 | |
| 1374 | VIDEO_START(segac2_new) | |
| 1368 | static VIDEO_START(segac2_new) | |
| 1375 | 1369 | { |
| 1376 | 1370 | VIDEO_START_CALL(megadriv); |
| 1377 | 1371 | |
| 1378 | 1372 | |
| 1379 | megadrive_vdp_palette_lookup_segac2 = auto_malloc(0x1000); | |
| 1380 | megadrive_vdp_palette_lookup_sprite_segac2 = auto_malloc(0x1000); | |
| 1381 | megadrive_vdp_palette_lookup_shadow_segac2 = auto_malloc(0x1000); | |
| 1382 | megadrive_vdp_palette_lookup_highlight_segac2 = auto_malloc(0x1000); | |
| 1383 | ||
| 1384 | megadrive_vdp_palette_lookup = megadrive_vdp_palette_lookup_segac2; | |
| 1385 | megadrive_vdp_palette_lookup_sprite = megadrive_vdp_palette_lookup_sprite_segac2; | |
| 1386 | megadrive_vdp_palette_lookup_shadow = megadrive_vdp_palette_lookup_shadow_segac2; | |
| 1387 | megadrive_vdp_palette_lookup_highlight = megadrive_vdp_palette_lookup_highlight_segac2; | |
| 1388 | ||
| 1373 | megadrive_vdp_palette_lookup = auto_malloc(0x1000); | |
| 1374 | megadrive_vdp_palette_lookup_sprite = auto_malloc(0x1000); | |
| 1375 | megadrive_vdp_palette_lookup_shadow = auto_malloc(0x1000); | |
| 1376 | megadrive_vdp_palette_lookup_highlight = auto_malloc(0x1000); | |
| 1389 | 1377 | } |
| 1390 | 1378 | |
| 1391 | VIDEO_UPDATE(segac2_new) | |
| 1379 | static VIDEO_UPDATE(segac2_new) | |
| 1392 | 1380 | { |
| 1393 | 1381 | if (!segac2_enable_display) |
| 1394 | 1382 | { |
| r4135 | r4136 | |
|---|---|---|
| 622 | 622 | a = ((paletteram32[offset] & 0xff000000) >>24); |
| 623 | 623 | |
| 624 | 624 | // a sure ain't alpha. |
| 625 | // alpha_set_level(mame_rand(space->machine)) ; | |
| 626 | 625 | // mame_printf_debug("Alpha : %d %d %d %d\n", a, b, g, r) ; |
| 627 | 626 | |
| 628 | 627 | //if (a != 0) |
| r4135 | r4136 | |
|---|---|---|
| 60 | 60 | #include "includes/taito_l.h" |
| 61 | 61 | |
| 62 | 62 | |
| 63 | static | |
| 63 | static | |
| 64 | 64 | { |
| 65 | taitol_chardef14_m, // 14 | |
| 66 | taitol_chardef15_m, // 15 | |
| 67 | taitol_chardef16_m, // 16 | |
| 68 | taitol_chardef17_m, // 17 | |
| 65 | void (*notifier)(running_machine *, int); | |
| 66 | UINT32 offset; | |
| 67 | } rambank_modify_notifiers[12] = | |
| 68 | { | |
| 69 | { taitol_chardef14_m, 0x0000 }, // 14 | |
| 70 | { taitol_chardef15_m, 0x1000 }, // 15 | |
| 71 | { taitol_chardef16_m, 0x2000 }, // 16 | |
| 72 | { taitol_chardef17_m, 0x3000 }, // 17 | |
| 69 | 73 | |
| 70 | taitol_bg18_m, // 18 | |
| 71 | taitol_bg19_m, // 19 | |
| 72 | taitol_char1a_m, // 1a | |
| 73 | taitol_obj1b_m, // 1b | |
| 74 | { taitol_bg18_m, 0x8000 }, // 18 | |
| 75 | { taitol_bg19_m, 0x9000 }, // 19 | |
| 76 | { taitol_char1a_m, 0xa000 }, // 1a | |
| 77 | { taitol_obj1b_m, 0xb000 }, // 1b | |
| 74 | 78 | |
| 75 | taitol_chardef1c_m, // 1c | |
| 76 | taitol_chardef1d_m, // 1d | |
| 77 | taitol_chardef1e_m, // 1e | |
| 78 | taitol_chardef1f_m, // 1f | |
| 79 | { taitol_chardef1c_m, 0x4000 }, // 1c | |
| 80 | { taitol_chardef1d_m, 0x5000 }, // 1d | |
| 81 | { taitol_chardef1e_m, 0x6000 }, // 1e | |
| 82 | { taitol_chardef1f_m, 0x7000 }, // 1f | |
| 79 | 83 | }; |
| 80 | 84 | |
| 81 | 85 | static void (*current_notifier[4])(running_machine *, int); |
| r4135 | r4136 | |
| 152 | 156 | cur_rombank = cur_rombank2 = 0; |
| 153 | 157 | memory_set_bankptr(machine, 1, memory_region(machine, "main") + 0x10000); |
| 154 | 158 | |
| 155 | for(i=0;i<512;i++) | |
| 156 | { | |
| 157 | decodechar(machine->gfx[2], i, taitol_rambanks); | |
| 158 | decodechar(machine->gfx[2], i+512, taitol_rambanks + 0x4000); | |
| 159 | } | |
| 159 | gfx_element_set_source(machine->gfx[2], taitol_rambanks); | |
| 160 | 160 | |
| 161 | 161 | adpcm_pos = 0; |
| 162 | 162 | adpcm_data = -1; |
| r4135 | r4136 | |
| 377 | 377 | if(data>=0x14 && data<=0x1f) |
| 378 | 378 | { |
| 379 | 379 | data -= 0x14; |
| 380 | current_notifier[offset] = rambank_modify_notifiers[data]; | |
| 381 | current_base[offset] = taitol_rambanks+0x1000*data; | |
| 380 | current_notifier[offset] = rambank_modify_notifiers[data].notifier; | |
| 381 | current_base[offset] = taitol_rambanks+rambank_modify_notifiers[data].offset; | |
| 382 | 382 | } |
| 383 | 383 | else if (data == 0x80) |
| 384 | 384 | { |
| r4135 | r4136 | |
|---|---|---|
| 105 | 105 | static void draw_char(bitmap_t *bitmap, const rectangle *cliprect, const gfx_element *gfx, int ch, int att, int x, int y) |
| 106 | 106 | { |
| 107 | 107 | int i,j; |
| 108 | UINT8 *dp; | |
| 108 | const UINT8 *dp; | |
| 109 | 109 | int index = 0; |
| 110 | dp = gfx | |
| 110 | dp = gfx_element_get_data( | |
| 111 | 111 | |
| 112 | 112 | for (j=y; j < y+8; j++) |
| 113 | 113 | { |
| r4135 | r4136 | |
|---|---|---|
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | 42 | #include "driver.h" |
| 43 | #include "cpu/m6502/m6502.h" | |
| 44 | #include "sound/dac.h" | |
| 45 | #include "sound/nes_apu.h" | |
| 43 | 46 | #include "video/ppu2c0x.h" |
| 44 | #include "sound/nes_apu.h" | |
| 45 | #include "cpu/m6502/m6502.h" | |
| 46 | 47 | |
| 47 | 48 | /****************************************************** |
| 48 | 49 |
| r4135 | r4136 | |
|---|---|---|
| 243 | 243 | |
| 244 | 244 | static UINT32 *K001604_tile_ram[MAX_K001604_CHIPS]; |
| 245 | 245 | static UINT32 *K001604_char_ram[MAX_K001604_CHIPS]; |
| 246 | static UINT8 *K001604_dirty_map[MAX_K001604_CHIPS][2]; | |
| 247 | static int K001604_gfx_index[MAX_K001604_CHIPS][2], K001604_char_dirty[MAX_K001604_CHIPS][2]; | |
| 246 | static int K001604_gfx_index[MAX_K001604_CHIPS][2]; | |
| 248 | 247 | static tilemap *K001604_layer_8x8[MAX_K001604_CHIPS][2]; |
| 249 | 248 | static int K001604_tilemap_offset; |
| 250 | 249 | static tilemap *K001604_layer_roz[MAX_K001604_CHIPS][2]; |
| r4135 | r4136 | |
| 422 | 421 | |
| 423 | 422 | K001604_tile_ram[chip] = auto_malloc(0x20000); |
| 424 | 423 | |
| 425 | K001604_dirty_map[chip][0] = auto_malloc(K001604_NUM_TILES_LAYER0); | |
| 426 | K001604_dirty_map[chip][1] = auto_malloc(K001604_NUM_TILES_LAYER1); | |
| 427 | ||
| 428 | 424 | K001604_reg[chip] = auto_malloc(0x400); |
| 429 | 425 | |
| 430 | 426 | if (chip == 0) |
| r4135 | r4136 | |
| 453 | 449 | |
| 454 | 450 | memset(K001604_char_ram[chip], 0, 0x200000); |
| 455 | 451 | memset(K001604_tile_ram[chip], 0, 0x10000); |
| 456 | memset(K001604_dirty_map[chip][0], 0, K001604_NUM_TILES_LAYER0); | |
| 457 | memset(K001604_dirty_map[chip][1], 0, K001604_NUM_TILES_LAYER1); | |
| 458 | 452 | memset(K001604_reg[chip], 0, 0x400); |
| 459 | 453 | |
| 460 | 454 | |
| 461 | machine->gfx[K001604_gfx_index[chip][0]] = allocgfx(machine, &K001604_char_layout_layer_8x8); | |
| 462 | decodegfx(machine->gfx[K001604_gfx_index[chip][0]], (UINT8*)&K001604_char_ram[chip][0], 0, machine->gfx[K001604_gfx_index[chip][0]]->total_elements); | |
| 463 | machine->gfx[K001604_gfx_index[chip][1]] = allocgfx(machine, &K001604_char_layout_layer_16x16); | |
| 464 | decodegfx(machine->gfx[K001604_gfx_index[chip][1]], (UINT8*)&K001604_char_ram[chip][0], 0, machine->gfx[K001604_gfx_index[chip][1]]->total_elements); | |
| 455 | machine->gfx[K001604_gfx_index[chip][0]] = gfx_element_alloc(machine, &K001604_char_layout_layer_8x8, (UINT8*)&K001604_char_ram[chip][0], machine->config->total_colors / 16, 0); | |
| 456 | machine->gfx[K001604_gfx_index[chip][1]] = gfx_element_alloc(machine, &K001604_char_layout_layer_16x16, (UINT8*)&K001604_char_ram[chip][0], machine->config->total_colors / 16, 0); | |
| 465 | 457 | |
| 466 | machine->gfx[K001604_gfx_index[chip][0]]->total_colors = machine->config->total_colors / 16; | |
| 467 | machine->gfx[K001604_gfx_index[chip][1]]->total_colors = machine->config->total_colors / 16; | |
| 468 | ||
| 469 | 458 | return 0; |
| 470 | 459 | } |
| 471 | 460 | |
| 472 | void K001604_tile_update(running_machine *machine, int chip) | |
| 473 | { | |
| 474 | if(K001604_char_dirty[chip][0]) | |
| 475 | { | |
| 476 | int i; | |
| 477 | for (i=0; i < K001604_NUM_TILES_LAYER0; i++) | |
| 478 | { | |
| 479 | if(K001604_dirty_map[chip][0][i]) | |
| 480 | { | |
| 481 | K001604_dirty_map[chip][0][i] = 0; | |
| 482 | decodechar(machine->gfx[K001604_gfx_index[chip][0]], i, (UINT8*)&K001604_char_ram[chip][0]); | |
| 483 | } | |
| 484 | } | |
| 485 | tilemap_mark_all_tiles_dirty(K001604_layer_8x8[chip][0]); | |
| 486 | tilemap_mark_all_tiles_dirty(K001604_layer_8x8[chip][1]); | |
| 487 | ||
| 488 | if (K001604_roz_size[chip] == 0) | |
| 489 | { | |
| 490 | tilemap_mark_all_tiles_dirty(K001604_layer_roz[chip][0]); | |
| 491 | tilemap_mark_all_tiles_dirty(K001604_layer_roz[chip][1]); | |
| 492 | } | |
| 493 | K001604_char_dirty[chip][0] = 0; | |
| 494 | } | |
| 495 | if(K001604_char_dirty[chip][1]) | |
| 496 | { | |
| 497 | int i; | |
| 498 | for (i=0; i < K001604_NUM_TILES_LAYER1; i++) | |
| 499 | { | |
| 500 | if(K001604_dirty_map[chip][1][i]) | |
| 501 | { | |
| 502 | K001604_dirty_map[chip][1][i] = 0; | |
| 503 | decodechar(machine->gfx[K001604_gfx_index[chip][1]], i, (UINT8*)&K001604_char_ram[chip][0]); | |
| 504 | } | |
| 505 | } | |
| 506 | ||
| 507 | if (K001604_roz_size[chip] == 1) | |
| 508 | { | |
| 509 | tilemap_mark_all_tiles_dirty(K001604_layer_roz[chip][0]); | |
| 510 | tilemap_mark_all_tiles_dirty(K001604_layer_roz[chip][1]); | |
| 511 | } | |
| 512 | K001604_char_dirty[chip][1] = 0; | |
| 513 | } | |
| 514 | } | |
| 515 | ||
| 516 | 461 | void K001604_draw_back_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect) |
| 517 | 462 | { |
| 518 | 463 | int layer; |
| r4135 | r4136 | |
| 659 | 604 | |
| 660 | 605 | COMBINE_DATA(K001604_char_ram[chip] + addr); |
| 661 | 606 | |
| 662 | K001604_dirty_map[chip][0][addr / 32] = 1; | |
| 663 | K001604_char_dirty[chip][0] = 1; | |
| 664 | ||
| 665 | K001604_dirty_map[chip][1][addr / 128] = 1; | |
| 666 | K001604_char_dirty[chip][1] = 1; | |
| 607 | gfx_element_mark_dirty(space->machine->gfx[K001604_gfx_index[chip][0]], addr / 32); | |
| 608 | gfx_element_mark_dirty(space->machine->gfx[K001604_gfx_index[chip][1]], addr / 128); | |
| 667 | 609 | } |
| 668 | 610 | |
| 669 | 611 | |
| r4135 | r4136 | |
| 724 | 666 | |
| 725 | 667 | voodoo_update(voodoo, bitmap, cliprect); |
| 726 | 668 | |
| 727 | K001604_tile_update(screen->machine, 0); | |
| 728 | 669 | K001604_draw_front_layer(0, bitmap, cliprect); |
| 729 | 670 | |
| 730 | 671 | draw_7segment_led(bitmap, 3, 3, led_reg0); |
| r4135 | r4136 | |
|---|---|---|
| 18 | 18 | WRITE8_HANDLER( tinvader_videoram_w ); |
| 19 | 19 | static WRITE8_HANDLER( tinvader_sound_w ); |
| 20 | 20 | READ8_HANDLER( zac_s2636_r ); |
| 21 | WRITE8_HANDLER( zac_s2636_w ); | |
| 21 | 22 | READ8_HANDLER( tinvader_port_0_r ); |
| 22 | 23 | |
| 23 | 24 | VIDEO_START( tinvader ); |
| r4135 | r4136 | |
| 33 | 34 | AM_RANGE(0x1e82, 0x1e82) AM_READ_PORT("1E82") |
| 34 | 35 | AM_RANGE(0x1e85, 0x1e85) AM_READ_PORT("1E85") /* Dodgem Only */ |
| 35 | 36 | AM_RANGE(0x1e86, 0x1e86) AM_READ_PORT("1E86") AM_WRITENOP /* Dodgem Only */ |
| 36 | AM_RANGE(0x1f00, 0x1fff) AM_READWRITE(zac_s2636_r, | |
| 37 | AM_RANGE(0x1f00, 0x1fff) AM_READWRITE(zac_s2636_r, zac_s2636_w) AM_BASE(&zac2650_s2636_0_ram) | |
| 37 | 38 | ADDRESS_MAP_END |
| 38 | 39 | |
| 39 | 40 | static ADDRESS_MAP_START( port_map, ADDRESS_SPACE_IO, 8 ) |
| r4135 | r4136 | |
| 210 | 211 | |
| 211 | 212 | static const gfx_layout tinvader_character = |
| 212 | 213 | { |
| 213 | | |
| 214 | 8 | |
| 214 | 215 | 128, |
| 215 | 216 | 1, |
| 216 | 217 | { 0 }, |
| 217 | { 0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7 }, | |
| 218 | { 0*8, 0*8, 0*8, 1*8, 1*8, 1*8, 2*8, 2*8, 2*8, 3*8, 3*8, 3*8, 4*8, 4*8, 4*8, | |
| 219 | 5*8, 5*8, 5*8, 6*8, 6*8, 6*8, 7*8, 7*8, 7*8 }, | |
| 218 | { STEP8(0,1) }, | |
| 219 | { STEP8(0,8) }, | |
| 220 | 220 | 8*8 |
| 221 | 221 | }; |
| 222 | 222 | |
| 223 | 223 | |
| 224 | static const gfx_layout s2636_character | |
| 224 | static const gfx_layout s2636_character | |
| 225 | 225 | { |
| 226 | | |
| 226 | 8 | |
| 227 | 227 | 16, |
| 228 | 228 | 1, |
| 229 | 229 | { 0 }, |
| 230 | { 0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7 }, | |
| 231 | { 0*8, 0*8, 0*8, 1*8, 1*8, 1*8, 2*8, 2*8, 2*8, 3*8, 3*8, 3*8, | |
| 232 | 4*8, 4*8, 4*8, 5*8, 5*8, 5*8, 6*8, 6*8, 6*8, 7*8, 7*8, 7*8, | |
| 233 | 8*8, 8*8, 8*8, 9*8, 9*8, 9*8 } , | |
| 230 | { STEP8(0,1) }, | |
| 231 | { STEP8(0,8), STEP2(8*8,8) }, | |
| 234 | 232 | 8*8 |
| 235 | 233 | }; |
| 236 | 234 | |
| 237 | static const UINT32 s2636_character16_xoffset[64] = | |
| 238 | { | |
| 239 | 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, | |
| 240 | 4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7 | |
| 241 | }; | |
| 242 | ||
| 243 | static const UINT32 s2636_character16_yoffset[60] = | |
| 244 | { | |
| 245 | 0*8, 0*8, 0*8, 0*8, 0*8, 0*8, 1*8, 1*8, 1*8, 1*8, 1*8, 1*8, | |
| 246 | 2*8, 2*8, 2*8, 2*8, 2*8, 2*8, 3*8, 3*8, 3*8, 3*8, 3*8, 3*8, | |
| 247 | 4*8, 4*8, 4*8, 4*8, 4*8, 4*8, 5*8, 5*8, 5*8, 5*8, 5*8, 5*8, | |
| 248 | 6*8, 6*8, 6*8, 6*8, 6*8, 6*8, 7*8, 7*8, 7*8, 7*8, 7*8, 7*8, | |
| 249 | 8*8, 8*8, 8*8, 8*8, 8*8, 8*8, 9*8, 9*8, 9*8, 9*8, 9*8, 9*8 | |
| 250 | }; | |
| 251 | ||
| 252 | static const gfx_layout s2636_character16 = | |
| 253 | { | |
| 254 | 64,60, | |
| 255 | 16, | |
| 256 | 1, | |
| 257 | { 0 }, | |
| 258 | EXTENDED_XOFFS, | |
| 259 | EXTENDED_YOFFS, | |
| 260 | 8*8, | |
| 261 | s2636_character16_xoffset, | |
| 262 | s2636_character16_yoffset | |
| 263 | }; | |
| 264 | ||
| 265 | 235 | static GFXDECODE_START( tinvader ) |
| 266 | GFXDECODE_ENTRY( "gfx1", 0, tinvader_character, 0, 2 ) | |
| 267 | GFXDECODE_ENTRY( NULL, 0x1F00, s2636_character8, 0, 2 ) /* dynamic */ | |
| 268 | GFXDECODE_ENTRY( NULL, 0x1F00, s2636_character16, 0, 2 ) /* dynamic */ | |
| 236 | GFXDECODE_SCALE( "gfx1", 0, tinvader_character, 0, 2, 3, 3 ) | |
| 237 | GFXDECODE_SCALE( NULL, 0x1F00, s2636_character, 0, 2, 4, 3 ) /* dynamic */ | |
| 238 | GFXDECODE_SCALE( NULL, 0x1F00, s2636_character, 0, 2, 8, 6 ) /* dynamic */ | |
| 269 | 239 | GFXDECODE_END |
| 270 | 240 | |
| 271 | 241 | static MACHINE_DRIVER_START( tinvader ) |
| r4135 | r4136 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | There are two boards to this hardware. The upper, which contains the |
| 19 | 19 | graphics ROMs and the i860, and the lower which contains the main |
| 20 | and sound CPUs. Virtual Combat sports two upper boards which | |
| 20 | and sound CPUs. Virtual Combat sports two upper boards which | |
| 21 | 21 | output a different rasterization of the scene for each stereo eye. |
| 22 | 22 | |
| 23 | UPPER: | |
| 23 | UPPER: (Virtual Combat has an identical MIDDLE board also). | |
| 24 | 24 | Intel I860 XR processor |
| 25 | 25 | MB8298-25P-SK RAMS x12 (silkscreen said 62256) |
| 26 | 26 | Analog device ADV476KN50E (silkscreen said BT476) |
| r4135 | r4136 | |
| 54 | 54 | The data stored in "samples" is simply a series of |
| 55 | 55 | Creative Media VOC files concatenated to eachother. |
| 56 | 56 | The sound program ("sound") is about 640 bytes long. |
| 57 | The graphics ROMs have had images successfully extracted from | |
| 58 | them. Pictures for Shadow Fighters can be found online. | |
| 59 | 57 | The hardware is said to run at medium resolution. |
| 60 | 58 | The SRAM module dump can likely be thrown away for both games. |
| 61 | 59 | The PAL that's dumped for Shadow Fighters looks pretty bad. |
| 62 | Websites seem to say Shadow Fighters is a SEGA game, but I | |
| 63 | couldn't find a SEGA string anywhere in the ROMs. I also, | |
| 64 | however, could not find a VR8 string in the Virtual Combat | |
| 65 | ROMs, so who knows... Kyle's name is easily found in both | |
| 66 | though :). | |
| 67 | 60 | |
| 68 | TODO : This is a skeleton driver. Nearly everything. | |
| 69 | i860XR-25 CPU core! | |
| 61 | TODO : This is a partially working driver. Most of the memory maps for | |
| 62 | all four CPUs are complete. An Intel i860XR CPU core has now | |
| 63 | been incorporated into MAME. | |
| 70 | 64 | |
| 65 | -------- Notes/questions ---------- | |
| 66 | - Most of the memory maps and input ports are complete now. | |
| 67 | For "main", the only I/O locations that seem to be left | |
| 68 | mysterious are: | |
| 69 | 0x600010, | |
| 70 | 0x60000C: Only written; maybe mc6845? Often accessed | |
| 71 | together, and 16 consecutive words of data are | |
| 72 | written to 0x60000C, making me think it might be | |
| 73 | 6845-related. May or may not be important for | |
| 74 | reasonable emulation. | |
| 75 | 0x60001C: Only read; might be a latch of some sort. It is | |
| 76 | read each time M0's interrupt service routine syncs | |
| 77 | with the i860's to have them update the frame buffer. | |
| 78 | Might this be a HW blank bit so things look clean when | |
| 79 | the i860's do their updates? | |
| 80 | The two other times I see it read are just before | |
| 81 | and after one of the pallette setups is done. | |
| 82 | 0x600018: ? No info yet. | |
| 83 | 0x704000: (VC only) Likely analog axis for VR headset | |
| 84 | 0x703000: (VC only) Likely analog axis for VR headset | |
| 85 | 0x702000: (Shadow only). I think this is another IN port. It | |
| 86 | is always read at the same time as the other two | |
| 87 | ports. | |
| 88 | ||
| 89 | - Assuming a single framebuffer, as I think we are at the moment, | |
| 90 | how are all the CPUs writes to the framebuffer prioritized, | |
| 91 | if at all? The zero values written by the 68k side erase | |
| 92 | the i860-generated FB data (i.e., zero maps to black in the | |
| 93 | pallette). On the other hand, treating the zero values as | |
| 94 | transparent doesn't quite look right either. Could just the | |
| 95 | i860s each have their own framebuffers? After | |
| 96 | all, since each eye of the binocular sees a slightly different | |
| 97 | picture, the i860's might just maintain their own. Then maybe | |
| 98 | the 68k shares with each of the two, since I think it just | |
| 99 | generates a single picture (not sure about that either). | |
| 100 | ---------------------------------------------- | |
| 71 | 101 | */ |
| 72 | 102 | |
| 73 | 103 | #include <stdio.h> |
| r4135 | r4136 | |
| 77 | 107 | #include "video/generic.h" |
| 78 | 108 | #include "video/tlc34076.h" |
| 79 | 109 | |
| 80 | static UINT16* framebuffer; | |
| 110 | static UINT16* framebuffer_main; | |
| 111 | static UINT16* framebuffer_secondary; | |
| 81 | 112 | static UINT16* vid_0_shared_RAM; |
| 82 | 113 | static UINT16* vid_1_shared_RAM; |
| 83 | 114 | |
| 115 | ||
| 116 | static VIDEO_UPDATE( vcombat ) | |
| 117 | { | |
| 118 | int x, y; | |
| 119 | int count = 0; | |
| 120 | const rgb_t *pens = tlc34076_get_pens(); | |
| 121 | ||
| 122 | /* TODO: It looks like the leftmost chunk of the ground should really be on the right side? */ | |
| 123 | /* But the i860 draws the background correctly, so it may be an original game issue. */ | |
| 124 | /* There's also some garbage in the upper-left corner. Might be related to this 'wraparound'. */ | |
| 125 | /* Or maybe it's related to the 68k's alpha? It might come from the 68k side of the house. */ | |
| 126 | ||
| 127 | /* Main eye */ | |
| 128 | for(y = 0; y < 256; y++) | |
| 129 | { | |
| 130 | for(x = 384; x < 640; x++) | |
| 131 | { | |
| 132 | UINT32 color; | |
| 133 | if (x % 2) color = (framebuffer_main[count] & 0xff00) >> 8; | |
| 134 | else color = framebuffer_main[count] & 0x00ff; | |
| 135 | ||
| 136 | /* Vcombat's screen renders 'flopped' - very likely because VR headset displays may reflect off mirrors. | |
| 137 | Shadfgtr isn't flopped, so it's not a constant feature of the hardware. */ | |
| 138 | if(x < video_screen_get_visible_area(screen)->max_x && y < video_screen_get_visible_area(screen)->max_y) | |
| 139 | *BITMAP_ADDR32(bitmap, y, x) = pens[color]; | |
| 140 | ||
| 141 | if (x % 2) count++; | |
| 142 | } | |
| 143 | } | |
| 144 | ||
| 145 | /* Early out for shadow fighters */ | |
| 146 | if (!framebuffer_secondary) | |
| 147 | return 0; | |
| 148 | ||
| 149 | /* Secondary eye */ | |
| 150 | count = 0; | |
| 151 | for(y = 0; y < 256; y++) | |
| 152 | { | |
| 153 | for(x = 0; x < 256; x++) | |
| 154 | { | |
| 155 | UINT32 color; | |
| 156 | if (x % 2) color = (framebuffer_secondary[count] & 0xff00) >> 8; | |
| 157 | else color = framebuffer_secondary[count] & 0x00ff; | |
| 158 | ||
| 159 | /* Vcombat's screen renders 'flopped' - very likely because VR headset displays may reflect off mirrors. | |
| 160 | Shadfgtr isn't flopped, so it's not a constant feature of the hardware. */ | |
| 161 | if(x < video_screen_get_visible_area(screen)->max_x && y < video_screen_get_visible_area(screen)->max_y) | |
| 162 | *BITMAP_ADDR32(bitmap, y, x) = pens[color]; | |
| 163 | ||
| 164 | if (x % 2) count++; | |
| 165 | } | |
| 166 | } | |
| 167 | ||
| 168 | return 0; | |
| 169 | } | |
| 170 | ||
| 171 | ||
| 172 | /* Maybe there's a blend chip between the 68k and the framebuffer? */ | |
| 173 | static WRITE16_HANDLER( main_video_write ) | |
| 174 | { | |
| 175 | /* Doesn't seem to make sense for shadow fighters. Maybe some of that factory rework disables this? */ | |
| 176 | /* Doesn't always seem to work for vcombat either. More testing needed. */ | |
| 177 | if (data != 0x00000000) { | |
| 178 | framebuffer_main[offset] = data; | |
| 179 | } | |
| 180 | } | |
| 181 | ||
| 182 | static READ16_HANDLER( control_1_r ) | |
| 183 | { | |
| 184 | return (input_port_read(space->machine, "IN0") << 8); | |
| 185 | } | |
| 186 | ||
| 187 | static READ16_HANDLER( control_2_r ) | |
| 188 | { | |
| 189 | return (input_port_read(space->machine, "IN1") << 8); | |
| 190 | } | |
| 191 | ||
| 192 | static void wiggle_i860_common(int n, UINT16 data, const device_config *device) | |
| 193 | { | |
| 194 | int bus_hold = (data & 0x03) == 0x03; | |
| 195 | int reset = data & 0x10; | |
| 196 | assert(n >= 0 && n < 2); | |
| 197 | if (!device) | |
| 198 | return; | |
| 199 | if (bus_hold) | |
| 200 | { | |
| 201 | fprintf(stderr, "M0 asserting bus HOLD to i860 %s\n", device->tag); | |
| 202 | i860_set_pin(device->token, DEC_PIN_BUS_HOLD, 1); | |
| 203 | } | |
| 204 | else | |
| 205 | { | |
| 206 | fprintf(stderr, "M0 clearing bus HOLD to i860 %s\n", device->tag); | |
| 207 | i860_set_pin(device->token, DEC_PIN_BUS_HOLD, 0); | |
| 208 | } | |
| 209 | ||
| 210 | if (reset) | |
| 211 | { | |
| 212 | fprintf(stderr, "M0 asserting RESET to i860 %s\n", device->tag); | |
| 213 | i860_set_pin(device->token, DEC_PIN_RESET, 1); | |
| 214 | } | |
| 215 | else | |
| 216 | i860_set_pin(device->token, DEC_PIN_RESET, 0); | |
| 217 | } | |
| 218 | ||
| 219 | static WRITE16_HANDLER( wiggle_i860p0_pins_w ) | |
| 220 | { | |
| 221 | wiggle_i860_common(0, data, cputag_get_cpu(space->machine, "vid_0")); | |
| 222 | } | |
| 223 | ||
| 224 | static WRITE16_HANDLER( wiggle_i860p1_pins_w ) | |
| 225 | { | |
| 226 | wiggle_i860_common(1, data, cputag_get_cpu(space->machine, "vid_1")); | |
| 227 | } | |
| 228 | ||
| 229 | static READ16_HANDLER( main_irqiack_r ) | |
| 230 | { | |
| 231 | //fprintf(stderr, "M0: irq iack\n"); | |
| 232 | cpu_set_input_line(cputag_get_cpu(space->machine, "main"), M68K_IRQ_1, CLEAR_LINE); | |
| 233 | //cpu_set_input_line(cputag_get_cpu(space->machine, "main"), INPUT_LINE_RESET, CLEAR_LINE); | |
| 234 | return 0; | |
| 235 | } | |
| 236 | ||
| 237 | static READ16_HANDLER( sound_resetmain_r ) | |
| 238 | { | |
| 239 | //fprintf(stderr, "M1: reset line to M0\n"); | |
| 240 | //cpu_set_input_line(cputag_get_cpu(space->machine, "main"), INPUT_LINE_RESET, PULSE_LINE); | |
| 241 | return 0; | |
| 242 | } | |
| 243 | ||
| 244 | static WRITE64_HANDLER( v0_fb_w ) | |
| 245 | { | |
| 246 | /* The frame buffer seems to sit on a 32-bit data bus, while the | |
| 247 | i860 uses a 64-bit data bus. Adjust accordingly. */ | |
| 248 | char *p = (char *)framebuffer_main; | |
| 249 | int m = mem_mask; | |
| 250 | int o = (offset << 2); | |
| 251 | if (m & 0xff000000) { | |
| 252 | p[o+3] = (data >> 24) & 0xff; | |
| 253 | } | |
| 254 | if (m & 0x00ff0000) { | |
| 255 | p[o+2] = (data >> 16) & 0xff; | |
| 256 | } | |
| 257 | if (m & 0x0000ff00) { | |
| 258 | p[o+1] = (data >> 8) & 0xff; | |
| 259 | } | |
| 260 | if (m & 0x000000ff) { | |
| 261 | p[o+0] = (data >> 0) & 0xff; | |
| 262 | } | |
| 263 | } | |
| 264 | ||
| 265 | /* This is just temporary so we can see what each i860 is doing to the | |
| 266 | framebuffer. */ | |
| 267 | static WRITE64_HANDLER( v1_fb_w ) | |
| 268 | { | |
| 269 | /* The frame buffer seems to sit on a 32-bit data bus, while the | |
| 270 | i860 uses a 64-bit data bus. Adjust accordingly. */ | |
| 271 | char *p = (char *)framebuffer_secondary; | |
| 272 | int m = mem_mask; | |
| 273 | int o = (offset << 2); | |
| 274 | if (m & 0xff000000) { | |
| 275 | p[o+3] = (data >> 24) & 0xff; | |
| 276 | } | |
| 277 | if (m & 0x00ff0000) { | |
| 278 | p[o+2] = (data >> 16) & 0xff; | |
| 279 | } | |
| 280 | if (m & 0x0000ff00) { | |
| 281 | p[o+1] = (data >> 8) & 0xff; | |
| 282 | } | |
| 283 | if (m & 0x000000ff) { | |
| 284 | p[o+0] = (data >> 0) & 0xff; | |
| 285 | } | |
| 286 | } | |
| 287 | ||
| 288 | ||
| 84 | 289 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 85 | 290 | AM_RANGE(0x000000, 0x0fffff) AM_ROM |
| 86 | 291 | AM_RANGE(0x200000, 0x2fffff) AM_RAM |
| 87 | AM_RANGE(0x300000, 0x3ffff | |
| 292 | AM_RANGE(0x300000, 0x30ffff | |
| 88 | 293 | |
| 89 | 294 | AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_BASE(&vid_0_shared_RAM) AM_SHARE(2) /* First i860 shared RAM */ |
| 90 | // AM_RANGE(0x440000, 0x440003) i860 #1 com 1 | |
| 91 | // AM_RANGE(0x480000, 0x480003) i860 #1 com 2 | |
| 92 | // AM_RANGE(0x4c0000, 0x4c0003) i860 #1 stop/start/reset | |
| 295 | AM_RANGE(0x440000, 0x440003) AM_RAM AM_SHARE(6) /* M0->P0 i860 #1 com 1 */ | |
| 296 | AM_RANGE(0x480000, 0x480003) AM_RAM AM_SHARE(7) /* M0<-P0 i860 #1 com 2 */ | |
| 297 | AM_RANGE(0x4c0000, 0x4c0003) AM_WRITE(wiggle_i860p0_pins_w) /* i860 #1 stop/start/reset */ | |
| 93 | 298 | |
| 94 | 299 | AM_RANGE(0x500000, 0x53ffff) AM_RAM AM_BASE(&vid_1_shared_RAM) AM_SHARE(3) /* Second i860 shared RAM */ |
| 95 | // AM_RANGE(0x540000, 0x540003) i860 #2 com 1 | |
| 96 | // AM_RANGE(0x580000, 0x580003) i860 #2 com 2 | |
| 97 | // AM_RANGE(0x5c0000, 0x5c0003) i860 #2 stop/start/reset | |
| 300 | AM_RANGE(0x540000, 0x540003) AM_RAM AM_SHARE(8) /* M0->P1 i860 #2 com 1 */ | |
| 301 | AM_RANGE(0x580000, 0x580003) AM_RAM AM_SHARE(9) /* M0<-P1 i860 #2 com 2 */ | |
| 302 | AM_RANGE(0x5c0000, 0x5c0003) AM_WRITE(wiggle_i860p1_pins_w) /* i860 #2 stop/start/reset */ | |
| 98 | 303 | |
| 304 | AM_RANGE(0x600000, 0x600001) AM_READ(control_1_r) /* IN0 port */ | |
| 305 | AM_RANGE(0x600004, 0x600005) AM_RAM AM_SHARE(5) /* M0<-M1 */ | |
| 306 | AM_RANGE(0x600008, 0x600009) AM_READ(control_2_r) /* IN1 port */ | |
| 307 | /* AM_RANGE(0x60000c, 0x60000d) See notes at top of driver. */ | |
| 308 | /* AM_RANGE(0x600010, 0x600011) See notes at top of driver. */ | |
| 309 | AM_RANGE(0x700000, 0x7007ff) AM_RAM /* TODO: Non-volatile RAM */ | |
| 310 | AM_RANGE(0x701000, 0x701001) AM_READ(main_irqiack_r) | |
| 311 | AM_RANGE(0x705000, 0x705001) AM_RAM AM_SHARE(4) /* M1->M0 */ | |
| 312 | ||
| 313 | //AM_RANGE(0x703000, 0x703001) /* Headset rotation axis? */ | |
| 314 | //AM_RANGE(0x704000, 0x704001) /* Headset rotation axis? */ | |
| 315 | ||
| 99 | 316 | AM_RANGE(0x706000, 0x70601f) AM_READWRITE(tlc34076_lsb_r, tlc34076_lsb_w) |
| 100 | 317 | ADDRESS_MAP_END |
| 101 | 318 | |
| 102 | 319 | |
| 103 | 320 | /* The first i860 - middle board */ |
| 104 | static ADDRESS_MAP_START( vid_0_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 105 | AM_RANGE(0x00000000, 0x000fffff) AM_RAM AM_SHARE(1) /* Shared framebuffer */ | |
| 106 | // AM_RANGE(0x20000000, 0x20000003) com 1 (0x440000 in 68k-land) | |
| 107 | // AM_RANGE(0x40000000, 0x401fffff) AM_ROM /* 3d data ROMs */ | |
| 108 | // AM_RANGE(0x80000000, 0x80000003) com 2 (0x480000 in 68k-land) | |
| 109 | AM_RANGE(0xfffc0000, 0xffffffff) AM_RAM AM_SHARE(2) /* Shared RAM with main */ | |
| 321 | static ADDRESS_MAP_START( vid_0_map, ADDRESS_SPACE_PROGRAM, 64 ) | |
| 322 | AM_RANGE(0x00000000, 0x0001ffff) AM_RAM_WRITE(v0_fb_w) /* Shared framebuffer - half of the bits lost to 32-bit bus */ | |
| 323 | AM_RANGE(0x20000000, 0x20000007) AM_RAM AM_SHARE(6) /* M0<-P0 com 1 (0x440000 in 68k-land) */ | |
| 324 | AM_RANGE(0x40000000, 0x401fffff) AM_ROM AM_REGION("gfx", 0) | |
| 325 | AM_RANGE(0x80000000, 0x80000007) AM_RAM AM_SHARE(7) /* M0->P0 com 2 (0x480000 in 68k-land) */ | |
| 326 | AM_RANGE(0xc0000000, 0xc0000fff) AM_NOP /* Dummy D$ flush page. */ | |
| 327 | AM_RANGE(0xfffc0000, 0xffffffff) AM_RAM AM_SHARE(2) /* Shared RAM with main */ | |
| 110 | 328 | ADDRESS_MAP_END |
| 111 | 329 | |
| 112 | 330 | |
| 113 | 331 | /* The second i860 - top board */ |
| 114 | static ADDRESS_MAP_START( vid_1_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 115 | AM_RANGE(0x00000000, 0x000fffff) AM_RAM AM_SHARE(1) /* Shared framebuffer */ | |
| 116 | // AM_RANGE(0x20000000, 0x20000003) com 1 (0x540000 in 68k-land) | |
| 117 | // AM_RANGE(0x40000000, 0x401fffff) AM_ROM /* 3d data ROMs */ | |
| 118 | // AM_RANGE(0x80000000, 0x80000003) com 2 (0x580000 in 68k-land) | |
| 119 | AM_RANGE(0xfffc0000, 0xffffffff) AM_RAM AM_SHARE(3) /* Shared RAM with main */ | |
| 332 | static ADDRESS_MAP_START( vid_1_map, ADDRESS_SPACE_PROGRAM, 64 ) | |
| 333 | AM_RANGE(0x00000000, 0x0001ffff) AM_RAM_WRITE(v1_fb_w) /* Half of the bits lost to 32-bit bus */ | |
| 334 | AM_RANGE(0x20000000, 0x20000007) AM_RAM AM_SHARE(8) /* M0->P1 com 1 (0x540000 in 68k-land) */ | |
| 335 | AM_RANGE(0x40000000, 0x401fffff) AM_ROM AM_REGION("gfx", 0) | |
| 336 | AM_RANGE(0x80000000, 0x80000007) AM_RAM AM_SHARE(9) /* M0<-P1 com 2 (0x580000 in 68k-land) */ | |
| 337 | AM_RANGE(0xc0000000, 0xc0000fff) AM_NOP /* Dummy D$ flush page. */ | |
| 338 | AM_RANGE(0xfffc0000, 0xffffffff) AM_RAM AM_SHARE(3) /* Shared RAM with main */ | |
| 120 | 339 | ADDRESS_MAP_END |
| 121 | 340 | |
| 122 | 341 | |
| 123 | /* Sound CPU - temprarily disabled */ | |
| 124 | //static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 125 | // AM_RANGE(0x000000, 0x03ffff) AM_ROM | |
| 126 | //ADDRESS_MAP_END | |
| 342 | /* Sound CPU */ | |
| 343 | static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 344 | AM_RANGE(0x000000, 0x03ffff) AM_ROM | |
| 345 | AM_RANGE(0x081000, 0x081fff) AM_RAM | |
| 346 | AM_RANGE(0x140000, 0x140001) AM_READ(sound_resetmain_r) /* Ping M0's reset line */ | |
| 347 | AM_RANGE(0x180000, 0x180001) AM_RAM AM_SHARE(4) /* M1<-M0 */ | |
| 348 | AM_RANGE(0x1C0000, 0x1C0001) AM_RAM AM_SHARE(5) /* M1->M0 */ | |
| 349 | ADDRESS_MAP_END | |
| 127 | 350 | |
| 128 | 351 | |
| 129 | 352 | static MACHINE_RESET( vcombat ) |
| 130 | 353 | { |
| 131 | 354 | /* Setup the Bt476 VGA RAMDAC palette chip */ |
| 132 | 355 | tlc34076_reset(6); |
| 356 | ||
| 357 | i860_set_pin(cputag_get_cpu(machine, "vid_0")->token, DEC_PIN_BUS_HOLD, 1); | |
| 358 | i860_set_pin(cputag_get_cpu(machine, "vid_1")->token, DEC_PIN_BUS_HOLD, 1); | |
| 133 | 359 | } |
| 134 | 360 | |
| 361 | static MACHINE_RESET( shadfgtr ) | |
| 362 | { | |
| 363 | /* Setup the Bt476 VGA RAMDAC palette chip */ | |
| 364 | tlc34076_reset(6); | |
| 365 | ||
| 366 | i860_set_pin(cputag_get_cpu(machine, "vid_0")->token, DEC_PIN_BUS_HOLD, 1); | |
| 367 | } | |
| 368 | ||
| 369 | ||
| 135 | 370 | static DIRECT_UPDATE_HANDLER( vid_0_direct_handler ) |
| 136 | 371 | { |
| 137 | 372 | if (address >= 0xfffc0000 && address <= 0xffffffff) |
| r4135 | r4136 | |
| 152 | 387 | return address; |
| 153 | 388 | } |
| 154 | 389 | |
| 390 | ||
| 155 | 391 | static DRIVER_INIT( vcombat ) |
| 156 | 392 | { |
| 157 | 393 | UINT8 *ROM = memory_region(machine, "main"); |
| r4135 | r4136 | |
| 160 | 396 | memory_set_direct_update_handler(cputag_get_address_space(machine, "vid_0", ADDRESS_SPACE_PROGRAM), vid_0_direct_handler); |
| 161 | 397 | memory_set_direct_update_handler(cputag_get_address_space(machine, "vid_1", ADDRESS_SPACE_PROGRAM), vid_1_direct_handler); |
| 162 | 398 | |
| 163 | // Hacks | |
| 164 | // pc==4016 : jump 4038 ... There's something strange about how it waits at 402e (interrupts all masked out) | |
| 399 | /* Allocate the two framebuffers */ | |
| 400 | framebuffer_main = auto_malloc(0x10000 * sizeof(UINT16)); | |
| 401 | framebuffer_secondary = auto_malloc(0x10000 * sizeof(UINT16)); | |
| 402 | ||
| 403 | /* pc==4016 : jump 4038 ... There's something strange about how it waits at 402e (interrupts all masked out) | |
| 404 | I think what is happening here is that M0 snags the first time | |
| 405 | it hits this point based on a counter test just above this | |
| 406 | instruction. That counter gets updated just past this instruction. | |
| 407 | However, the only way this can be passed is if the M0 CPU is | |
| 408 | reset (the IPL=7, but irq 7 is a nop). I am almost sure that M1 | |
| 409 | reads a latch, which resets M0 (probably to ensure M0 and M1 are | |
| 410 | both alive) and gets passed this snag. I tried to hook up a reset | |
| 411 | which should work, but asserting the reset line on the m68k doesn't | |
| 412 | seem to do anything. Maybe the 68k emulator doesn't respond to | |
| 413 | that, or I didn't do it correctly. But I think that is what needs | |
| 414 | to be done. But it isn't crucial for emulation. Shadow does not | |
| 415 | have this snag. */ | |
| 165 | 416 | ROM[0x4017] = 0x66; |
| 417 | } | |
| 166 | 418 | |
| 167 | // Sound CPU comm bits | |
| 168 | // pc==40fa : jump 40fc ... 600004 should be -16 | |
| 169 | ROM[0x40fb] = 0x67; | |
| 170 | // pc==410e : jump 4110 ... 600004 should be 31 | |
| 171 | ROM[0x410f] = 0x67; | |
| 419 | static DRIVER_INIT( shadfgtr ) | |
| 420 | { | |
| 421 | /* Allocate just one framebuffer */ | |
| 422 | framebuffer_main = auto_malloc(0x10000 * sizeof(UINT16)); | |
| 423 | framebuffer_secondary = NULL; | |
| 172 | 424 | |
| 173 | // pc==e220 : jump e222 ... 20119a should not be 0. (no interrupts masked) | |
| 174 | // TODO: I wonder if this is an input bit that's ticked on vblank or something. The menu selection continually crawls up. | |
| 425 | /* The i860 executes out of RAM */ | |
| 426 | memory_set_direct_update_handler(cputag_get_address_space(machine, "vid_0", ADDRESS_SPACE_PROGRAM), vid_0_direct_handler); | |
| 175 | 427 | } |
| 176 | 428 | |
| 177 | 429 | |
| 178 | 430 | static INPUT_PORTS_START( vcombat ) |
| 431 | PORT_START("IN0") | |
| 432 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 433 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* Left button */ | |
| 434 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* Right button */ | |
| 435 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY | |
| 436 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 437 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 438 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY | |
| 439 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 440 | ||
| 441 | PORT_START("IN1") | |
| 442 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 443 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 444 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 445 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 446 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 447 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) | |
| 448 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 449 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 179 | 450 | INPUT_PORTS_END |
| 180 | 451 | |
| 181 | 452 | |
| 182 | static VIDEO_UPDATE( vcombat ) | |
| 183 | { | |
| 184 | int x, y; | |
| 185 | int count = 0; | |
| 186 | const rgb_t *pens = tlc34076_get_pens(); | |
| 453 | static INPUT_PORTS_START( shadfgtr ) | |
| 454 | PORT_START("IN0") | |
| 455 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 456 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 457 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 458 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY | |
| 459 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY /* ? */ | |
| 460 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY /* ? */ | |
| 461 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY | |
| 462 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 187 | 463 | |
| 188 | for(y = 0; y < 480; y++) | |
| 189 | { | |
| 190 | for(x = 0; x < 256; x++) | |
| 191 | { | |
| 192 | UINT32 color; | |
| 464 | PORT_START("IN1") | |
| 465 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 466 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 467 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 468 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) | |
| 469 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) | |
| 470 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) | |
| 471 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 472 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 473 | INPUT_PORTS_END | |
| 193 | 474 | |
| 194 | if (x % 2) color = (framebuffer[count] & 0xff00) >> 8; | |
| 195 | else color = framebuffer[count] & 0x00ff; | |
| 196 | 475 | |
| 197 | if(x < video_screen_get_visible_area(screen)->max_x && y < video_screen_get_visible_area(screen)->max_y) | |
| 198 | *BITMAP_ADDR32(bitmap, y, x) = pens[color]; | |
| 199 | ||
| 200 | if (x % 2) count++; | |
| 201 | } | |
| 202 | } | |
| 203 | return 0; | |
| 204 | } | |
| 205 | ||
| 206 | ||
| 207 | // This is just here to show that there is text in the main program ROM. It probably won't really be a useful decode. | |
| 208 | static const gfx_layout vcombat_charlayout = | |
| 209 | { | |
| 210 | 8, 8, | |
| 211 | 0x100000 / 0x80, | |
| 212 | 8, | |
| 213 | { 0,1,2,3,4,5,6,7 }, | |
| 214 | { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, | |
| 215 | { 0*16*8, 1*16*8, 2*16*8, 3*16*8, 4*16*8, 5*16*8, 6*16*8, 7*16*8 }, | |
| 216 | 8 * 0x80 | |
| 217 | }; | |
| 218 | ||
| 219 | ||
| 220 | static GFXDECODE_START( vcombat ) | |
| 221 | GFXDECODE_ENTRY( "main", 0, vcombat_charlayout, 0, 256 ) | |
| 222 | GFXDECODE_END | |
| 223 | ||
| 224 | ||
| 225 | 476 | static MACHINE_DRIVER_START( vcombat ) |
| 226 | 477 | MDRV_CPU_ADD("main", M68000, XTAL_12MHz) |
| 227 | 478 | MDRV_CPU_PROGRAM_MAP(main_map,0) |
| 228 | | |
| 479 | | |
| 229 | 480 | |
| 230 | 481 | /* The middle board i860 */ |
| 231 | 482 | MDRV_CPU_ADD("vid_0", I860, XTAL_20MHz) |
| r4135 | r4136 | |
| 235 | 486 | MDRV_CPU_ADD("vid_1", I860, XTAL_20MHz) |
| 236 | 487 | MDRV_CPU_PROGRAM_MAP(vid_1_map,0) |
| 237 | 488 | |
| 238 | /* Sound CPU Disabled for now */ | |
| 239 | //MDRV_CPU_ADD("sound", M68000, XTAL_12MHz) | |
| 240 | //MDRV_CPU_PROGRAM_MAP(sound_map,0) | |
| 489 | /* Sound CPU */ | |
| 490 | MDRV_CPU_ADD("sound", M68000, XTAL_12MHz) | |
| 491 | MDRV_CPU_PROGRAM_MAP(sound_map,0) | |
| 241 | 492 | |
| 242 | 493 | MDRV_MACHINE_RESET(vcombat) |
| 243 | 494 | |
| 244 | // Likely will go away | |
| 245 | MDRV_GFXDECODE(vcombat) | |
| 495 | /* Temporary hack for experimenting with timing. */ | |
| 496 | #if 0 | |
| 497 | //MDRV_QUANTUM_TIME(HZ(1200)) | |
| 498 | MDRV_QUANTUM_PERFECT_CPU("main") | |
| 499 | #endif | |
| 246 | 500 | |
| 247 | 501 | MDRV_SCREEN_ADD("main", RASTER) |
| 502 | MDRV_SCREEN_REFRESH_RATE(50) | |
| 503 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 504 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) | |
| 505 | MDRV_SCREEN_SIZE(640, 480) | |
| 506 | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) | |
| 507 | ||
| 508 | MDRV_VIDEO_UPDATE(vcombat) | |
| 509 | MACHINE_DRIVER_END | |
| 510 | ||
| 511 | ||
| 512 | static MACHINE_DRIVER_START( shadfgtr ) | |
| 513 | MDRV_CPU_ADD("main", M68000, XTAL_12MHz) | |
| 514 | MDRV_CPU_PROGRAM_MAP(main_map,0) | |
| 515 | MDRV_CPU_VBLANK_INT("main", irq1_line_assert) | |
| 516 | ||
| 517 | /* The middle board i860 */ | |
| 518 | MDRV_CPU_ADD("vid_0", I860, XTAL_20MHz) | |
| 519 | MDRV_CPU_PROGRAM_MAP(vid_0_map,0) | |
| 520 | ||
| 521 | /* Sound CPU */ | |
| 522 | MDRV_CPU_ADD("sound", M68000, XTAL_12MHz) | |
| 523 | MDRV_CPU_PROGRAM_MAP(sound_map,0) | |
| 524 | ||
| 525 | MDRV_MACHINE_RESET(shadfgtr) | |
| 526 | ||
| 527 | MDRV_SCREEN_ADD("main", RASTER) | |
| 248 | 528 | MDRV_SCREEN_REFRESH_RATE(60) |
| 249 | 529 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 250 | 530 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| r4135 | r4136 | |
| 255 | 535 | MACHINE_DRIVER_END |
| 256 | 536 | |
| 257 | 537 | |
| 538 | /* Perhaps add this to the core romload.h file? */ | |
| 539 | #define ROM_LOAD64_WORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(6)) | |
| 540 | ||
| 258 | 541 | ROM_START( vcombat ) |
| 259 | 542 | ROM_REGION( 0x100000, "main", 0 ) |
| 260 | 543 | ROM_LOAD16_BYTE( "ep8v2.b49", 0x00000, 0x80000, CRC(98d5a45d) SHA1(099e314f11c93ad6e642ceaa311e2a5b6fd7193c) ) |
| r4135 | r4136 | |
| 270 | 553 | ROM_LOAD16_BYTE( "ep3v2.b40", 0x100000, 0x40000, CRC(8c491526) SHA1(95c6bcbe0adcfffb12fd2b86c9f4ca26aa188bbf) ) |
| 271 | 554 | ROM_LOAD16_BYTE( "ep5v2.b36", 0x100001, 0x40000, CRC(7592b2eb) SHA1(92a540726306d7adbf207fe86a4c4fa66958f90b) ) |
| 272 | 555 | |
| 273 | ROM_REGION( 0x800, "user1", 0 ) | |
| 556 | ROM_REGION( 0x800, "user1", 0 ) /* The SRAM module */ | |
| 274 | 557 | ROM_LOAD( "ds1220y.b53", 0x000, 0x800, CRC(b21cfe5f) SHA1(898ace3cd0913ea4b0dc84320219777773ef856f) ) |
| 275 | 558 | |
| 276 | 559 | /* These roms are identical on both of the upper boards */ |
| 277 | ROM_REGION( 0x200000, "3d", 0 ) | |
| 278 | ROM_LOAD16_BYTE( "11.u56", 0x000000, 0x80000, CRC(a83094ce) SHA1(c3512375fecdb5e7eb02a4aa140ae4efe0233cb8) ) | |
| 279 | ROM_LOAD16_BYTE( "9.u54", 0x000001, 0x80000, CRC(a276e18b) SHA1(6d60e519196a4858b82241504592413df498e12f) ) | |
| 280 | ROM_LOAD16_BYTE( "12.u57", 0x100000, 0x80000, CRC(0cdffd4f) SHA1(65ace78711b3ef6e0ff9a7ad7343b5558e652f6c) ) | |
| 281 | ROM_LOAD16_BYTE( "10.u55", 0x100001, 0x80000, CRC(8921f20e) SHA1(6e9ca2eaad3e1108ba0e1d7792fd5d0305bec201) ) | |
| 560 | ROM_REGION( 0x200000, "gfx", 0 ) | |
| 561 | ROM_LOAD64_WORD( "9.u55", 0x000000, 0x80000, CRC(a276e18b) SHA1(6d60e519196a4858b82241504592413df498e12f) ) | |
| 562 | ROM_LOAD64_WORD( "10.u57", 0x000002, 0x80000, CRC(8921f20e) SHA1(6e9ca2eaad3e1108ba0e1d7792fd5d0305bec201) ) | |
| 563 | ROM_LOAD64_WORD( "11.u54", 0x000004, 0x80000, CRC(a83094ce) SHA1(c3512375fecdb5e7eb02a4aa140ae4efe0233cb8) ) | |
| 564 | ROM_LOAD64_WORD( "12.u56", 0x000006, 0x80000, CRC(0cdffd4f) SHA1(65ace78711b3ef6e0ff9a7ad7343b5558e652f6c) ) | |
| 282 | 565 | |
| 283 | 566 | ROM_REGION( 0x400, "plds", 0 ) |
| 284 | 567 | ROM_LOAD( "pal1_w2.u51", 0x000, 0x1f1, CRC(af497420) SHA1(03aa82189d91ae194dd5a6e7b9dbdb7cd473ddb6) ) |
| r4135 | r4136 | |
| 301 | 584 | ROM_REGION( 0x800, "user1", 0 ) /* The SRAM module */ |
| 302 | 585 | ROM_LOAD( "shadfgtr.b53", 0x000, 0x800, CRC(e766a3ab) SHA1(e7696ec08d5c86f64d768480f43edbd19ded162d) ) |
| 303 | 586 | |
| 304 | /* These roms are identical on both of the upper boards */ | |
| 305 | ROM_REGION( 0x200000, "3d", 0 ) | |
| 306 | ROM_LOAD16_BYTE( "shadfgtr.u56", 0x000000, 0x80000, CRC(fb76db5a) SHA1(fa546f465df113c13037abed1162bfa6f9b1dc9b) ) | |
| 307 | ROM_LOAD16_BYTE( "shadfgtr.u54", 0x000001, 0x80000, CRC(c45d68d6) SHA1(a133e4f13d3af18bccf0d060a659d64ac699b159) ) | |
| 308 | ROM_LOAD16_BYTE( "shadfgtr.u57", 0x100000, 0x80000, CRC(60d701d7) SHA1(936473b5e3b2e9e9e3b50cf977fc5a670a097850) ) | |
| 309 | ROM_LOAD16_BYTE( "shadfgtr.u55", 0x100001, 0x80000, CRC(e807631d) SHA1(9027ff7dc60b808434dac292c08f0630d3d52186) ) | |
| 587 | ROM_REGION( 0x200000, "gfx", 0 ) | |
| 588 | ROM_LOAD64_WORD( "shadfgtr.u55", 0x000000, 0x80000, CRC(e807631d) SHA1(9027ff7dc60b808434dac292c08f0630d3d52186) ) | |
| 589 | ROM_LOAD64_WORD( "shadfgtr.u57", 0x000002, 0x80000, CRC(60d701d7) SHA1(936473b5e3b2e9e9e3b50cf977fc5a670a097850) ) | |
| 590 | ROM_LOAD64_WORD( "shadfgtr.u54", 0x000004, 0x80000, CRC(c45d68d6) SHA1(a133e4f13d3af18bccf0d060a659d64ac699b159) ) | |
| 591 | ROM_LOAD64_WORD( "shadfgtr.u56", 0x000006, 0x80000, CRC(fb76db5a) SHA1(fa546f465df113c13037abed1162bfa6f9b1dc9b) ) | |
| 310 | 592 | |
| 311 | 593 | ROM_REGION( 0x200, "plds", 0 ) |
| 312 | 594 | ROM_LOAD( "shadfgtr.u51", 0x000, 0x1f1, CRC(bab58337) SHA1(c4a79c8e53aeadb7f64d49d214b607b5b36f144e) ) |
| 313 | 595 | /* The second upper-board PAL couldn't be read */ |
| 314 | 596 | ROM_END |
| 315 | 597 | |
| 316 | /* YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME FLAGS */ | |
| 317 | GAME( 1993, vcombat, 0, vcombat, vcombat, vcombat, ROT0, "VR8 Inc.", "Virtual Combat", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 318 | GAME( 1989, shadfgtr, 0, vcombat, vcombat, 0, ROT0, "Sega?", "Shadow Fighters", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 598 | /* YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME FLAGS */ | |
| 599 | GAME( 1993, vcombat, 0, vcombat, vcombat, vcombat, ORIENTATION_FLIP_X, "VR8 Inc.", "Virtual Combat", GAME_NOT_WORKING | GAME_NO_SOUND ) | |
| 600 | GAME( 1989, shadfgtr, 0, shadfgtr, shadfgtr, shadfgtr, ROT0, "DUTECH Inc.", "Shadow Fighters", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| r4135 | r4136 | |
|---|---|---|
| 294 | 294 | * |
| 295 | 295 | *************************************/ |
| 296 | 296 | |
| 297 | static const gfx_layout pf | |
| 297 | static const gfx_layout pf | |
| 298 | 298 | { |
| 299 | 299 | 8,8, |
| 300 | RGN_FRAC(1, | |
| 300 | RGN_FRAC(1,5), | |
| 301 | 301 | 4, |
| 302 | { RGN_FRAC(3,4), RGN_FRAC(2,4), RGN_FRAC(1,4), RGN_FRAC(0,4) }, | |
| 303 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 304 | { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8 }, | |
| 302 | { RGN_FRAC(3,5), RGN_FRAC(2,5), RGN_FRAC(1,5), RGN_FRAC(0,5) }, | |
| 303 | { STEP8(0,1) }, | |
| 304 | { STEP8(0,16) }, | |
| 305 | 305 | 16*8 |
| 306 | 306 | }; |
| 307 | 307 | |
| 308 | 308 | |
| 309 | static const gfx_layout mo | |
| 309 | static const gfx_layout mo | |
| 310 | 310 | { |
| 311 | 311 | 8,8, |
| 312 | RGN_FRAC(1, | |
| 312 | RGN_FRAC(1,5), | |
| 313 | 313 | 5, |
| 314 | { 0, 0, 0, 0, 0 }, | |
| 315 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 316 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, | |
| 317 | 8*8 | |
| 314 | { RGN_FRAC(4,5), RGN_FRAC(3,5), RGN_FRAC(2,5), RGN_FRAC(1,5), RGN_FRAC(0,5) }, | |
| 315 | { STEP8(0,1) }, | |
| 316 | { STEP8(0,16) }, | |
| 317 | 16*8 | |
| 318 | 318 | }; |
| 319 | 319 | |
| 320 | 320 | |
| 321 | 321 | static GFXDECODE_START( relief ) |
| 322 | GFXDECODE_ENTRY( "gfx1", 0, pfmolayout, 0, 64 ) /* alpha & playfield */ | |
| 323 | GFXDECODE_ENTRY( "gfx1", 1, pfmolayout, 256, 16 ) /* sprites */ | |
| 324 | GFXDECODE_ENTRY( "gfx2", 0, moexlayout, 256, 16 ) /* extra sprite bit */ | |
| 322 | GFXDECODE_ENTRY( "gfx1", 0, pflayout, 0, 64 ) /* alpha & playfield */ | |
| 323 | GFXDECODE_ENTRY( "gfx1", 1, molayout, 256, 16 ) /* sprites */ | |
| 325 | 324 | GFXDECODE_END |
| 326 | 325 | |
| 327 | 326 | |
| r4135 | r4136 | |
| 381 | 380 | ROM_LOAD16_BYTE( "136093-0013.17e", 0x40000, 0x20000, CRC(1e1e82e5) SHA1(d33c84ae950db9775f9db9bf953aa63188d3f2f9) ) |
| 382 | 381 | ROM_LOAD16_BYTE( "136093-0014.17j", 0x40001, 0x20000, CRC(19e5decd) SHA1(8d93d93f966df46d59cf9f4cdaa689e4dcd2689a) ) |
| 383 | 382 | |
| 384 | ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE | ROMREGION_INVERT ) | |
| 385 | ROM_LOAD( "136093-0025a.14s", 0x000000, 0x80000, CRC(1b9e5ef2) SHA1(d7d14e75ca2d56c5c67154506096570c9ccbcf8e) ) | |
| 386 | ROM_LOAD( "136093-0026a.8d", 0x080000, 0x80000, CRC(09b25d93) SHA1(94d424b21410182b5121201066f4acfa415f4b6b) ) | |
| 387 | ROM_LOAD( "136093-0027a.18s", 0x100000, 0x80000, CRC(5bc1c37b) SHA1(89f1bca55dd431ca3171b89347209decf0b25e12) ) | |
| 388 | ROM_LOAD( "136093-0028a.10d", 0x180000, 0x80000, CRC(55fb9111) SHA1(a95508f0831842fa79ca2fc168cfadc8c6d3fbd4) ) | |
| 383 | ROM_REGION( 0x280000, "gfx1", ROMREGION_DISPOSE | ROMREGION_INVERT ) | |
| 384 | ROM_LOAD( "136093-0025a.14s", 0x000000, 0x80000, CRC(1b9e5ef2) SHA1(d7d14e75ca2d56c5c67154506096570c9ccbcf8e) ) | |
| 385 | ROM_LOAD( "136093-0026a.8d", 0x080000, 0x80000, CRC(09b25d93) SHA1(94d424b21410182b5121201066f4acfa415f4b6b) ) | |
| 386 | ROM_LOAD( "136093-0027a.18s", 0x100000, 0x80000, CRC(5bc1c37b) SHA1(89f1bca55dd431ca3171b89347209decf0b25e12) ) | |
| 387 | ROM_LOAD( "136093-0028a.10d", 0x180000, 0x80000, CRC(55fb9111) SHA1(a95508f0831842fa79ca2fc168cfadc8c6d3fbd4) ) | |
| 388 | ROM_LOAD16_BYTE( "136093-0029a.4d", 0x200001, 0x40000, CRC(e4593ff4) SHA1(7360ec7a65aabc90aa787dc30f39992e342495dd) ) | |
| 389 | 389 | |
| 390 | ROM_REGION( 0x040000, "gfx2", ROMREGION_DISPOSE | ROMREGION_INVERT ) | |
| 391 | ROM_LOAD( "136093-0029a.4d", 0x000000, 0x40000, CRC(e4593ff4) SHA1(7360ec7a65aabc90aa787dc30f39992e342495dd) ) | |
| 392 | ||
| 393 | 390 | ROM_REGION( 0x200000, "oki", 0 ) /* 2MB for ADPCM data */ |
| 394 | 391 | ROM_LOAD( "136093-0030a.9b", 0x100000, 0x80000, CRC(f4c567f5) SHA1(7e8c1d54d918b0b41625eacbaf6dcb5bd99d1949) ) |
| 395 | 392 | ROM_LOAD( "136093-0031a.10b", 0x180000, 0x80000, CRC(ba908d73) SHA1(a83afd86f4c39394cf624b728a87b8d8b6de1944) ) |
| r4135 | r4136 | |
| 412 | 409 | ROM_LOAD16_BYTE( "136093-0013.17e", 0x40000, 0x20000, CRC(1e1e82e5) SHA1(d33c84ae950db9775f9db9bf953aa63188d3f2f9) ) |
| 413 | 410 | ROM_LOAD16_BYTE( "136093-0014.17j", 0x40001, 0x20000, CRC(19e5decd) SHA1(8d93d93f966df46d59cf9f4cdaa689e4dcd2689a) ) |
| 414 | 411 | |
| 415 | ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE | ROMREGION_INVERT ) | |
| 416 | ROM_LOAD( "136093-0025a.14s", 0x000000, 0x80000, CRC(1b9e5ef2) SHA1(d7d14e75ca2d56c5c67154506096570c9ccbcf8e) ) | |
| 417 | ROM_LOAD( "136093-0026a.8d", 0x080000, 0x80000, CRC(09b25d93) SHA1(94d424b21410182b5121201066f4acfa415f4b6b) ) | |
| 418 | ROM_LOAD( "136093-0027a.18s", 0x100000, 0x80000, CRC(5bc1c37b) SHA1(89f1bca55dd431ca3171b89347209decf0b25e12) ) | |
| 419 | ROM_LOAD( "136093-0028a.10d", 0x180000, 0x80000, CRC(55fb9111) SHA1(a95508f0831842fa79ca2fc168cfadc8c6d3fbd4) ) | |
| 412 | ROM_REGION( 0x280000, "gfx1", ROMREGION_DISPOSE | ROMREGION_INVERT ) | |
| 413 | ROM_LOAD( "136093-0025a.14s", 0x000000, 0x80000, CRC(1b9e5ef2) SHA1(d7d14e75ca2d56c5c67154506096570c9ccbcf8e) ) | |
| 414 | ROM_LOAD( "136093-0026a.8d", 0x080000, 0x80000, CRC(09b25d93) SHA1(94d424b21410182b5121201066f4acfa415f4b6b) ) | |
| 415 | ROM_LOAD( "136093-0027a.18s", 0x100000, 0x80000, CRC(5bc1c37b) SHA1(89f1bca55dd431ca3171b89347209decf0b25e12) ) | |
| 416 | ROM_LOAD( "136093-0028a.10d", 0x180000, 0x80000, CRC(55fb9111) SHA1(a95508f0831842fa79ca2fc168cfadc8c6d3fbd4) ) | |
| 417 | ROM_LOAD16_BYTE( "136093-0029.4d", 0x200001, 0x40000, CRC(e4593ff4) SHA1(7360ec7a65aabc90aa787dc30f39992e342495dd) ) | |
| 420 | 418 | |
| 421 | ROM_REGION( 0x040000, "gfx2", ROMREGION_DISPOSE | ROMREGION_INVERT ) | |
| 422 | ROM_LOAD( "136093-0029.4d", 0x000000, 0x40000, CRC(e4593ff4) SHA1(7360ec7a65aabc90aa787dc30f39992e342495dd) ) | |
| 423 | ||
| 424 | 419 | ROM_REGION( 0x200000, "oki", 0 ) /* 2MB for ADPCM data */ |
| 425 | 420 | ROM_LOAD( "136093-0030a.9b", 0x100000, 0x80000, CRC(f4c567f5) SHA1(7e8c1d54d918b0b41625eacbaf6dcb5bd99d1949) ) |
| 426 | 421 | ROM_LOAD( "136093-0031a.10b", 0x180000, 0x80000, CRC(ba908d73) SHA1(a83afd86f4c39394cf624b728a87b8d8b6de1944) ) |
| r4135 | r4136 | |
|---|---|---|
| 144 | 144 | switch (inputport_selected) |
| 145 | 145 | { |
| 146 | 146 | case 0x00: /* DSW A (bits 0-4) */ |
| 147 | return (input_port_read(space->machine, "DSWA") & 0xf8) >> 3; | |
| 147 | return (input_port_read(space->machine, "DSWA") & 0xf8) >> 3; | |
| 148 | 148 | case 0x01: /* DSW A (bits 5-7), DSW B (bits 0-1) */ |
| 149 | return ((input_port_read(space->machine, "DSWA") & 0x07) << 2) | ((input_port_read(space->machine, "DSWB") & 0xc0) >> 6); | |
| 149 | return ((input_port_read(space->machine, "DSWA") & 0x07) << 2) | ((input_port_read(space->machine, "DSWB") & 0xc0) >> 6); | |
| 150 | 150 | case 0x02: /* DSW B (bits 2-6) */ |
| 151 | return (input_port_read(space->machine, "DSWB") & 0x3e) >> 1; | |
| 151 | return (input_port_read(space->machine, "DSWB") & 0x3e) >> 1; | |
| 152 | 152 | case 0x03: /* DSW B (bit 7), DSW C (bits 0-3) */ |
| 153 | return ((input_port_read(space->machine, "DSWB") & 0x01) << 4) | (input_port_read(space->machine, "EDGE") & 0x0f); | |
| 153 | return ((input_port_read(space->machine, "DSWB") & 0x01) << 4) | (input_port_read(space->machine, "EDGE") & 0x0f); | |
| 154 | 154 | case 0x04: /* coins, start */ |
| 155 | return input_port_read(space->machine, "IN0"); | |
| 155 | return input_port_read(space->machine, "IN0"); | |
| 156 | 156 | case 0x05: /* 2P controls */ |
| 157 | return input_port_read(space->machine, "IN2"); | |
| 157 | return input_port_read(space->machine, "IN2"); | |
| 158 | 158 | case 0x06: /* 1P controls */ |
| 159 | return input_port_read(space->machine, "IN1"); | |
| 159 | return input_port_read(space->machine, "IN1"); | |
| 160 | 160 | default: |
| 161 | 161 | return 0xff; |
| 162 | 162 | } |
| r4135 | r4136 | |
|---|---|---|
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | |
| 150 | /* | |
| 151 | ** | |
| 152 | ** Main cpu data | |
| 153 | ** | |
| 154 | ** | |
| 155 | */ | |
| 150 | /************************************* | |
| 151 | * | |
| 152 | * Main CPU memory handlers | |
| 153 | * | |
| 154 | *************************************/ | |
| 156 | 155 | |
| 157 | ||
| 158 | 156 | /*************************************************************************** |
| 159 | 157 | [ Main CPU - System A / Z ] |
| 160 | 158 | ***************************************************************************/ |
| r4135 | r4136 | |
| 248 | 246 | |
| 249 | 247 | switch (i) |
| 250 | 248 | { |
| 251 | case 0 : return input_port_read(space->machine, "SYSTEM"); break; | |
| 252 | case 1 : return input_port_read(space->machine, "P1"); break; | |
| 253 | case 2 : return input_port_read(space->machine, "P2"); break; | |
| 254 | case 3 : return input_port_read(space->machine, "DSW1"); break; | |
| 255 | case 4 : return input_port_read(space->machine, "DSW2"); break; | |
| 249 | case 0 : return input_port_read(space->machine, "SYSTEM"); | |
| 250 | case 1 : return input_port_read(space->machine, "P1"); | |
| 251 | case 2 : return input_port_read(space->machine, "P2"); | |
| 252 | case 3 : return input_port_read(space->machine, "DSW1"); | |
| 253 | case 4 : return input_port_read(space->machine, "DSW2"); | |
| 256 | 254 | default : return 0x0006; |
| 257 | 255 | } |
| 258 | 256 | } |
| r4135 | r4136 | |
| 369 | 367 | ADDRESS_MAP_END |
| 370 | 368 | |
| 371 | 369 | |
| 370 | /************************************* | |
| 371 | * | |
| 372 | * Sound CPU memory handlers | |
| 373 | * | |
| 374 | *************************************/ | |
| 372 | 375 | |
| 373 | ||
| 374 | 376 | /* |
| 375 | ** | |
| 376 | ** Sound cpu data | |
| 377 | ** | |
| 378 | ** | |
| 379 | */ | |
| 380 | ||
| 381 | /* | |
| 382 | 377 | [ Sound CPU interrupts ] |
| 383 | 378 | |
| 384 | 379 | [MS1-A] |
| r4135 | r4136 | |
| 537 | 532 | ADDRESS_MAP_END |
| 538 | 533 | |
| 539 | 534 | |
| 535 | /************************************* | |
| 536 | * | |
| 537 | * Generic port definitions | |
| 538 | * | |
| 539 | *************************************/ | |
| 540 | 540 | |
| 541 | static INPUT_PORTS_START( megasys1_generic ) | |
| 542 | PORT_START("SYSTEM") | |
| 543 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 ) | |
| 544 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 ) | |
| 545 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 546 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 547 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 548 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 549 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 550 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 551 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 541 | 552 | |
| 553 | PORT_START("P1") | |
| 554 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 555 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 556 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 557 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 558 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 559 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 560 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 561 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 562 | ||
| 563 | PORT_START("P2") | |
| 564 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 565 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 566 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 567 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 568 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 569 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 570 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 571 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 572 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Reserve 1P */ | |
| 573 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 574 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 575 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 576 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Reserve 2P */ | |
| 577 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 578 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 579 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 580 | INPUT_PORTS_END | |
| 581 | ||
| 582 | /* Coinage DSWs */ | |
| 583 | // 1] 01-41 02-31 03-21 07-11 06-12 05-13 04-14 00-FC * 2 | |
| 584 | // 2] 04-31 02-21 07-11 03-12 05-13 01-14 06-15 00-FC | |
| 585 | // 00-41 20-31 10-21 38-11 18-12 28-13 08-14 30-15 | |
| 586 | ||
| 587 | #define COINAGE_8BITS \ | |
| 588 | PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) )\ | |
| 589 | PORT_DIPSETTING( 0x0007, DEF_STR( 4C_1C ) )\ | |
| 590 | PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) )\ | |
| 591 | PORT_DIPSETTING( 0x0009, DEF_STR( 2C_1C ) )\ | |
| 592 | PORT_DIPSETTING( 0x000f, DEF_STR( 1C_1C ) )\ | |
| 593 | /* PORT_DIPSETTING( 0x0005, DEF_STR( 1C_1C ) )*/\ | |
| 594 | /* PORT_DIPSETTING( 0x0004, DEF_STR( 1C_1C ) )*/\ | |
| 595 | /* PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) )*/\ | |
| 596 | /* PORT_DIPSETTING( 0x0002, DEF_STR( 1C_1C ) )*/\ | |
| 597 | /* PORT_DIPSETTING( 0x0001, DEF_STR( 1C_1C ) )*/\ | |
| 598 | PORT_DIPSETTING( 0x0006, DEF_STR( 2C_3C ) )\ | |
| 599 | PORT_DIPSETTING( 0x000e, DEF_STR( 1C_2C ) )\ | |
| 600 | PORT_DIPSETTING( 0x000d, DEF_STR( 1C_3C ) )\ | |
| 601 | PORT_DIPSETTING( 0x000c, DEF_STR( 1C_4C ) )\ | |
| 602 | PORT_DIPSETTING( 0x000b, DEF_STR( 1C_5C ) )\ | |
| 603 | PORT_DIPSETTING( 0x000a, DEF_STR( 1C_6C ) )\ | |
| 604 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )\ | |
| 605 | PORT_DIPNAME( 0x00f0, 0x00f0, DEF_STR( Coin_B ) )\ | |
| 606 | PORT_DIPSETTING( 0x0070, DEF_STR( 4C_1C ) )\ | |
| 607 | PORT_DIPSETTING( 0x0080, DEF_STR( 3C_1C ) )\ | |
| 608 | PORT_DIPSETTING( 0x0090, DEF_STR( 2C_1C ) )\ | |
| 609 | PORT_DIPSETTING( 0x00f0, DEF_STR( 1C_1C ) )\ | |
| 610 | /* PORT_DIPSETTING( 0x0050, DEF_STR( 1C_1C ) )*/\ | |
| 611 | /* PORT_DIPSETTING( 0x0040, DEF_STR( 1C_1C ) )*/\ | |
| 612 | /* PORT_DIPSETTING( 0x0030, DEF_STR( 1C_1C ) )*/\ | |
| 613 | /* PORT_DIPSETTING( 0x0020, DEF_STR( 1C_1C ) )*/\ | |
| 614 | /* PORT_DIPSETTING( 0x0010, DEF_STR( 1C_1C ) )*/\ | |
| 615 | PORT_DIPSETTING( 0x0060, DEF_STR( 2C_3C ) )\ | |
| 616 | PORT_DIPSETTING( 0x00e0, DEF_STR( 1C_2C ) )\ | |
| 617 | PORT_DIPSETTING( 0x00d0, DEF_STR( 1C_3C ) )\ | |
| 618 | PORT_DIPSETTING( 0x00c0, DEF_STR( 1C_4C ) )\ | |
| 619 | PORT_DIPSETTING( 0x00b0, DEF_STR( 1C_5C ) )\ | |
| 620 | PORT_DIPSETTING( 0x00a0, DEF_STR( 1C_6C ) )\ | |
| 621 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 622 | ||
| 623 | /************************************* | |
| 624 | * | |
| 625 | * Game-specific port definitions | |
| 626 | * | |
| 627 | *************************************/ | |
| 628 | ||
| 629 | static INPUT_PORTS_START( 64street ) | |
| 630 | PORT_INCLUDE( megasys1_generic ) | |
| 631 | ||
| 632 | PORT_START("DSW1") | |
| 633 | COINAGE_8BITS | |
| 634 | ||
| 635 | PORT_START("DSW2") | |
| 636 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) | |
| 637 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 638 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 639 | PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 640 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 641 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 642 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Allow_Continue ) ) | |
| 643 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 644 | PORT_DIPSETTING( 0x0004, DEF_STR( On ) ) | |
| 645 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) | |
| 646 | PORT_DIPSETTING( 0x0010, DEF_STR( Easy ) ) | |
| 647 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 648 | PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) ) | |
| 649 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 650 | PORT_DIPNAME( 0x0060, 0x0020, DEF_STR( Lives ) ) | |
| 651 | PORT_DIPSETTING( 0x0040, "1" ) | |
| 652 | PORT_DIPSETTING( 0x0060, "2" ) | |
| 653 | PORT_DIPSETTING( 0x0020, "3" ) | |
| 654 | PORT_DIPSETTING( 0x0000, "5" ) | |
| 655 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) | |
| 656 | INPUT_PORTS_END | |
| 657 | ||
| 658 | static INPUT_PORTS_START( astyanax ) | |
| 659 | PORT_INCLUDE( megasys1_generic ) | |
| 660 | ||
| 661 | PORT_MODIFY("P1") | |
| 662 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 663 | ||
| 664 | PORT_MODIFY("P2") | |
| 665 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 666 | ||
| 667 | PORT_START("DSW") | |
| 668 | PORT_DIPUNUSED( 0x0001, 0x0001 ) // according to manual | |
| 669 | PORT_DIPUNUSED( 0x0002, 0x0002 ) // according to manual | |
| 670 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Bonus_Life ) ) | |
| 671 | PORT_DIPSETTING( 0x0004, "30k 70k 110k then every 30k" ) | |
| 672 | PORT_DIPSETTING( 0x0000, "50k 100k then every 40k" ) | |
| 673 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Lives ) ) | |
| 674 | PORT_DIPSETTING( 0x0008, "2" ) | |
| 675 | PORT_DIPSETTING( 0x0018, "3" ) | |
| 676 | PORT_DIPSETTING( 0x0010, "4" ) | |
| 677 | PORT_DIPSETTING( 0x0000, "5" ) | |
| 678 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Difficulty ) ) | |
| 679 | PORT_DIPSETTING( 0x0020, DEF_STR( Normal ) ) | |
| 680 | PORT_DIPSETTING( 0x0000, DEF_STR( Hard ) ) | |
| 681 | PORT_DIPNAME( 0x0040, 0x0040, "Swap 1P/2P Controls" ) | |
| 682 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 683 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 684 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 685 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 686 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 687 | ||
| 688 | PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) ) | |
| 689 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) | |
| 690 | PORT_DIPSETTING( 0x0400, DEF_STR( 3C_1C ) ) | |
| 691 | PORT_DIPSETTING( 0x0200, DEF_STR( 2C_1C ) ) | |
| 692 | PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) ) | |
| 693 | // PORT_DIPSETTING( 0x0300, DEF_STR( 1C_1C ) ) // 1_2 shown in test mode | |
| 694 | // PORT_DIPSETTING( 0x0500, DEF_STR( 1C_1C ) ) // 1_3 | |
| 695 | // PORT_DIPSETTING( 0x0100, DEF_STR( 1C_1C ) ) // 1_4 | |
| 696 | // PORT_DIPSETTING( 0x0600, DEF_STR( 1C_1C ) ) // 1_5 | |
| 697 | PORT_DIPNAME( 0x3800, 0x3800, DEF_STR( Coin_B ) ) | |
| 698 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) | |
| 699 | PORT_DIPSETTING( 0x2000, DEF_STR( 3C_1C ) ) | |
| 700 | PORT_DIPSETTING( 0x1000, DEF_STR( 2C_1C ) ) | |
| 701 | PORT_DIPSETTING( 0x3800, DEF_STR( 1C_1C ) ) | |
| 702 | // PORT_DIPSETTING( 0x1800, DEF_STR( 1C_1C ) ) // 1_2 shown in test mode | |
| 703 | // PORT_DIPSETTING( 0x2800, DEF_STR( 1C_1C ) ) // 1_3 | |
| 704 | // PORT_DIPSETTING( 0x0800, DEF_STR( 1C_1C ) ) // 1_4 | |
| 705 | // PORT_DIPSETTING( 0x3000, DEF_STR( 1C_1C ) ) // 1_5 | |
| 706 | PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 707 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 708 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 709 | PORT_DIPNAME( 0x8000, 0x8000, "Test Mode" ) | |
| 710 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 711 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 712 | INPUT_PORTS_END | |
| 713 | ||
| 714 | static INPUT_PORTS_START( avspirit ) | |
| 715 | PORT_INCLUDE( 64street ) | |
| 716 | ||
| 717 | PORT_MODIFY("DSW2") | |
| 718 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) | |
| 719 | PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) ) | |
| 720 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 721 | PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) | |
| 722 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 723 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Cabinet ) ) | |
| 724 | PORT_DIPSETTING( 0x0020, DEF_STR( Upright ) ) | |
| 725 | PORT_DIPSETTING( 0x0000, DEF_STR( Cocktail ) ) | |
| 726 | PORT_DIPNAME( 0x0040, 0x0040, "Test Mode" ) // freeze & slow motion via P1 + P2 start | |
| 727 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 728 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 729 | INPUT_PORTS_END | |
| 730 | ||
| 731 | ||
| 732 | static INPUT_PORTS_START( phantasm ) | |
| 733 | PORT_INCLUDE( megasys1_generic ) | |
| 734 | ||
| 735 | PORT_START("DSW") | |
| 736 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) | |
| 737 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 738 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 739 | PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 740 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 741 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 742 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Allow_Continue ) ) | |
| 743 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 744 | PORT_DIPSETTING( 0x0004, DEF_STR( On ) ) | |
| 745 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) | |
| 746 | PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) ) | |
| 747 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 748 | PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) | |
| 749 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 750 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Cabinet ) ) | |
| 751 | PORT_DIPSETTING( 0x0020, DEF_STR( Upright ) ) | |
| 752 | PORT_DIPSETTING( 0x0000, DEF_STR( Cocktail ) ) | |
| 753 | PORT_DIPNAME( 0x0040, 0x0040, "Test Mode" ) // freeze & slow motion via P1 + P2 start | |
| 754 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 755 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 756 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) | |
| 757 | ||
| 758 | PORT_DIPNAME( 0x0f00, 0x0f00, DEF_STR( Coin_A ) ) | |
| 759 | PORT_DIPSETTING( 0x0700, DEF_STR( 4C_1C ) ) | |
| 760 | PORT_DIPSETTING( 0x0800, DEF_STR( 3C_1C ) ) | |
| 761 | PORT_DIPSETTING( 0x0900, DEF_STR( 2C_1C ) ) | |
| 762 | PORT_DIPSETTING( 0x0f00, DEF_STR( 1C_1C ) ) | |
| 763 | /* PORT_DIPSETTING( 0x0500, DEF_STR( 1C_1C ) )*/ | |
| 764 | /* PORT_DIPSETTING( 0x0400, DEF_STR( 1C_1C ) )*/ | |
| 765 | /* PORT_DIPSETTING( 0x0300, DEF_STR( 1C_1C ) )*/ | |
| 766 | /* PORT_DIPSETTING( 0x0200, DEF_STR( 1C_1C ) )*/ | |
| 767 | /* PORT_DIPSETTING( 0x0100, DEF_STR( 1C_1C ) )*/ | |
| 768 | PORT_DIPSETTING( 0x0600, DEF_STR( 2C_3C ) ) | |
| 769 | PORT_DIPSETTING( 0x0e00, DEF_STR( 1C_2C ) ) | |
| 770 | PORT_DIPSETTING( 0x0d00, DEF_STR( 1C_3C ) ) | |
| 771 | PORT_DIPSETTING( 0x0c00, DEF_STR( 1C_4C ) ) | |
| 772 | PORT_DIPSETTING( 0x0b00, DEF_STR( 1C_5C ) ) | |
| 773 | PORT_DIPSETTING( 0x0a00, DEF_STR( 1C_6C ) ) | |
| 774 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 775 | PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coin_B ) ) | |
| 776 | PORT_DIPSETTING( 0x7000, DEF_STR( 4C_1C ) ) | |
| 777 | PORT_DIPSETTING( 0x8000, DEF_STR( 3C_1C ) ) | |
| 778 | PORT_DIPSETTING( 0x9000, DEF_STR( 2C_1C ) ) | |
| 779 | PORT_DIPSETTING( 0xf000, DEF_STR( 1C_1C ) ) | |
| 780 | /* PORT_DIPSETTING( 0x5000, DEF_STR( 1C_1C ) )*/ | |
| 781 | /* PORT_DIPSETTING( 0x4000, DEF_STR( 1C_1C ) )*/ | |
| 782 | /* PORT_DIPSETTING( 0x3000, DEF_STR( 1C_1C ) )*/ | |
| 783 | /* PORT_DIPSETTING( 0x2000, DEF_STR( 1C_1C ) )*/ | |
| 784 | /* PORT_DIPSETTING( 0x1000, DEF_STR( 1C_1C ) )*/ | |
| 785 | PORT_DIPSETTING( 0x6000, DEF_STR( 2C_3C ) ) | |
| 786 | PORT_DIPSETTING( 0xe000, DEF_STR( 1C_2C ) ) | |
| 787 | PORT_DIPSETTING( 0xd000, DEF_STR( 1C_3C ) ) | |
| 788 | PORT_DIPSETTING( 0xc000, DEF_STR( 1C_4C ) ) | |
| 789 | PORT_DIPSETTING( 0xb000, DEF_STR( 1C_5C ) ) | |
| 790 | PORT_DIPSETTING( 0xa000, DEF_STR( 1C_6C ) ) | |
| 791 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 792 | INPUT_PORTS_END | |
| 793 | ||
| 794 | static INPUT_PORTS_START( bigstrik ) | |
| 795 | PORT_INCLUDE( 64street ) | |
| 796 | ||
| 797 | PORT_MODIFY("P1") | |
| 798 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 799 | ||
| 800 | PORT_MODIFY("P2") | |
| 801 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 802 | ||
| 803 | PORT_MODIFY("DSW2") | |
| 804 | PORT_DIPNAME( 0x0006, 0x0006, DEF_STR( Difficulty ) ) | |
| 805 | PORT_DIPSETTING( 0x0002, DEF_STR( Easy ) ) | |
| 806 | PORT_DIPSETTING( 0x0006, DEF_STR( Normal ) ) | |
| 807 | PORT_DIPSETTING( 0x0004, DEF_STR( Hard ) ) | |
| 808 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 809 | PORT_DIPNAME( 0x0018, 0x0018, "Time" ) | |
| 810 | PORT_DIPSETTING( 0x0000, "Very Short" ) | |
| 811 | PORT_DIPSETTING( 0x0010, "Short" ) | |
| 812 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 813 | PORT_DIPSETTING( 0x0008, "Long" ) | |
| 814 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) ) | |
| 815 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 816 | PORT_DIPSETTING( 0x0020, DEF_STR( On ) ) | |
| 817 | PORT_DIPNAME( 0x0040, 0x0040, "1 Credit 2 Play" ) | |
| 818 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 819 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 820 | INPUT_PORTS_END | |
| 821 | ||
| 822 | static INPUT_PORTS_START( chimerab ) | |
| 823 | PORT_INCLUDE( megasys1_generic ) | |
| 824 | ||
| 825 | PORT_START("DSW1") | |
| 826 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) | |
| 827 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 828 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 829 | PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 830 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 831 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 832 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Allow_Continue ) ) | |
| 833 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 834 | PORT_DIPSETTING( 0x0004, DEF_STR( On ) ) | |
| 835 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) | |
| 836 | PORT_DIPSETTING( 0x0010, DEF_STR( Easy ) ) | |
| 837 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 838 | PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) ) | |
| 839 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 840 | PORT_DIPNAME( 0x0060, 0x0020, DEF_STR( Lives ) ) | |
| 841 | PORT_DIPSETTING( 0x0040, "1" ) | |
| 842 | PORT_DIPSETTING( 0x0060, "2" ) | |
| 843 | PORT_DIPSETTING( 0x0020, "3" ) | |
| 844 | PORT_DIPSETTING( 0x0000, "4" ) | |
| 845 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) | |
| 846 | ||
| 847 | PORT_START("DSW2") | |
| 848 | COINAGE_8BITS | |
| 849 | INPUT_PORTS_END | |
| 850 | ||
| 851 | static INPUT_PORTS_START( cybattlr ) | |
| 852 | PORT_INCLUDE( megasys1_generic ) | |
| 853 | ||
| 854 | PORT_START("DSW1") /*1fd2d9.b, !1fd009.b */ | |
| 855 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) | |
| 856 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) | |
| 857 | PORT_DIPSETTING( 0x0001, DEF_STR( 3C_1C ) ) | |
| 858 | PORT_DIPSETTING( 0x0003, DEF_STR( 2C_1C ) ) | |
| 859 | PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) | |
| 860 | PORT_DIPSETTING( 0x0002, DEF_STR( 2C_3C ) ) | |
| 861 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) | |
| 862 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) | |
| 863 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) | |
| 864 | PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) | |
| 865 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) | |
| 866 | PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) ) | |
| 867 | PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) ) | |
| 868 | PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) | |
| 869 | PORT_DIPSETTING( 0x0010, DEF_STR( 2C_3C ) ) | |
| 870 | PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) | |
| 871 | PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) | |
| 872 | PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) | |
| 873 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) ) | |
| 874 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 875 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 876 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) | |
| 877 | ||
| 878 | PORT_START("DSW2") /* 1fd2d7.b, !1fd007.b */ | |
| 879 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) | |
| 880 | PORT_DIPSETTING( 0x0002, DEF_STR( Easy ) ) | |
| 881 | PORT_DIPSETTING( 0x0003, DEF_STR( Normal ) ) | |
| 882 | PORT_DIPSETTING( 0x0001, DEF_STR( Hard ) ) | |
| 883 | PORT_DIPSETTING( 0x0000, DEF_STR( Very_Hard ) ) | |
| 884 | PORT_DIPNAME( 0x0004, 0x0004, "Disable Instruction Screen" ) /* Manual states this dip is "Unused" */ | |
| 885 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 886 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 887 | PORT_DIPNAME( 0x0018, 0x00018, DEF_STR( Allow_Continue ) ) | |
| 888 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 889 | PORT_DIPSETTING( 0x0010, "Up to Mission 4" ) | |
| 890 | PORT_DIPSETTING( 0x0008, "Not on Final Mission" ) | |
| 891 | PORT_DIPSETTING( 0x0018, DEF_STR( On ) ) | |
| 892 | PORT_DIPNAME( 0x0020, 0x0020, "Intro Music" ) | |
| 893 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 894 | PORT_DIPSETTING( 0x0020, DEF_STR( On ) ) | |
| 895 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 896 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 897 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 898 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 899 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 900 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 901 | INPUT_PORTS_END | |
| 902 | ||
| 903 | static INPUT_PORTS_START( edf ) | |
| 904 | PORT_INCLUDE( megasys1_generic ) | |
| 905 | ||
| 906 | PORT_START("DSW1") | |
| 907 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) | |
| 908 | PORT_DIPSETTING( 0x0004, DEF_STR( 3C_1C ) ) | |
| 909 | PORT_DIPSETTING( 0x0002, DEF_STR( 2C_1C ) ) | |
| 910 | PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) | |
| 911 | PORT_DIPSETTING( 0x0003, DEF_STR( 1C_2C ) ) | |
| 912 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) | |
| 913 | PORT_DIPSETTING( 0x0001, DEF_STR( 1C_4C ) ) | |
| 914 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_5C ) ) | |
| 915 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 916 | PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) | |
| 917 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) | |
| 918 | PORT_DIPSETTING( 0x0020, DEF_STR( 3C_1C ) ) | |
| 919 | PORT_DIPSETTING( 0x0010, DEF_STR( 2C_1C ) ) | |
| 920 | PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) | |
| 921 | PORT_DIPSETTING( 0x0018, DEF_STR( 1C_2C ) ) | |
| 922 | PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) | |
| 923 | PORT_DIPSETTING( 0x0008, DEF_STR( 1C_4C ) ) | |
| 924 | PORT_DIPSETTING( 0x0030, DEF_STR( 1C_5C ) ) | |
| 925 | PORT_DIPNAME( 0x000040, 0x000040, DEF_STR( Demo_Sounds ) ) | |
| 926 | PORT_DIPSETTING( 0x000000, DEF_STR( Off ) ) | |
| 927 | PORT_DIPSETTING( 0x000040, DEF_STR( On ) ) | |
| 928 | PORT_SERVICE( 0x000080, IP_ACTIVE_LOW ) | |
| 929 | ||
| 930 | PORT_START("DSW2") /* 0x66007.b */ | |
| 931 | PORT_DIPNAME( 0x0007, 0x0007, "DSW-B bits 2-0" ) | |
| 932 | PORT_DIPSETTING( 0x0000, "0" ) | |
| 933 | PORT_DIPSETTING( 0x0001, "1" ) | |
| 934 | PORT_DIPSETTING( 0x0002, "2" ) | |
| 935 | PORT_DIPSETTING( 0x0003, "3" ) | |
| 936 | PORT_DIPSETTING( 0x0004, "4" ) | |
| 937 | PORT_DIPSETTING( 0x0005, "5" ) | |
| 938 | PORT_DIPSETTING( 0x0006, "6" ) | |
| 939 | PORT_DIPSETTING( 0x0007, "7" ) | |
| 940 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Lives ) ) | |
| 941 | PORT_DIPSETTING( 0x0008, "3" ) | |
| 942 | PORT_DIPSETTING( 0x0000, "4" ) | |
| 943 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 944 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 945 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 946 | PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) | |
| 947 | PORT_DIPSETTING( 0x0020, DEF_STR( Very_Hard ) ) | |
| 948 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) | |
| 949 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 950 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 951 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 952 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 953 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 954 | INPUT_PORTS_END | |
| 955 | ||
| 956 | static INPUT_PORTS_START( hachoo ) | |
| 957 | PORT_INCLUDE( megasys1_generic ) | |
| 958 | ||
| 959 | PORT_START("DSW") | |
| 960 | PORT_DIPUNUSED( 0x0001, 0x0001 ) /* Manual states dips 1-4 & 6 are "Unused" */ | |
| 961 | PORT_DIPUNUSED( 0x0002, 0x0002 ) | |
| 962 | PORT_DIPUNUSED( 0x0004, 0x0004 ) | |
| 963 | PORT_DIPUNUSED( 0x0008, 0x0008 ) | |
| 964 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 965 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 966 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) | |
| 967 | PORT_DIPSETTING( 0x0010, DEF_STR( Harder ) ) | |
| 968 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 969 | PORT_DIPUNUSED( 0x0040, 0x0040 ) | |
| 970 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 971 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 972 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 973 | ||
| 974 | PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) ) | |
| 975 | PORT_DIPSETTING( 0x0400, DEF_STR( 3C_1C ) ) | |
| 976 | PORT_DIPSETTING( 0x0200, DEF_STR( 2C_1C ) ) | |
| 977 | PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) ) | |
| 978 | PORT_DIPSETTING( 0x0300, DEF_STR( 1C_2C ) ) | |
| 979 | PORT_DIPSETTING( 0x0500, DEF_STR( 1C_3C ) ) | |
| 980 | PORT_DIPSETTING( 0x0100, DEF_STR( 1C_4C ) ) | |
| 981 | PORT_DIPSETTING( 0x0600, DEF_STR( 1C_5C ) ) | |
| 982 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 983 | PORT_DIPNAME( 0x3800, 0x3800, DEF_STR( Coin_B ) ) | |
| 984 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) | |
| 985 | PORT_DIPSETTING( 0x2000, DEF_STR( 3C_1C ) ) | |
| 986 | PORT_DIPSETTING( 0x1000, DEF_STR( 2C_1C ) ) | |
| 987 | PORT_DIPSETTING( 0x3800, DEF_STR( 1C_1C ) ) | |
| 988 | PORT_DIPSETTING( 0x1800, DEF_STR( 1C_2C ) ) | |
| 989 | PORT_DIPSETTING( 0x2800, DEF_STR( 1C_3C ) ) | |
| 990 | PORT_DIPSETTING( 0x0800, DEF_STR( 1C_4C ) ) | |
| 991 | PORT_DIPSETTING( 0x3000, DEF_STR( 1C_5C ) ) | |
| 992 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) | |
| 993 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 994 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) | |
| 995 | PORT_DIPUNUSED( 0x8000, 0x8000 ) | |
| 996 | INPUT_PORTS_END | |
| 997 | ||
| 998 | static INPUT_PORTS_START( kazan ) | |
| 999 | PORT_INCLUDE( hachoo ) | |
| 1000 | ||
| 1001 | PORT_MODIFY("DSW") | |
| 1002 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) | |
| 1003 | PORT_DIPSETTING( 0x0003, "2" ) | |
| 1004 | PORT_DIPSETTING( 0x0001, "3" ) | |
| 1005 | PORT_DIPSETTING( 0x0002, "4" ) | |
| 1006 | PORT_DIPSETTING( 0x0000, "Infinite (Cheat)" ) | |
| 1007 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Bonus_Life ) ) | |
| 1008 | PORT_DIPSETTING( 0x0004, "50k" ) | |
| 1009 | PORT_DIPSETTING( 0x0000, "200k" ) | |
| 1010 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Allow_Continue ) ) | |
| 1011 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 1012 | PORT_DIPSETTING( 0x0008, DEF_STR( On ) ) | |
| 1013 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Cabinet ) ) | |
| 1014 | PORT_DIPSETTING( 0x0000, DEF_STR( Upright ) ) | |
| 1015 | PORT_DIPSETTING( 0x0040, DEF_STR( Cocktail ) ) | |
| 1016 | ||
| 1017 | PORT_DIPNAME( 0x8000, 0x8000, "Freeze Screen (Cheat)") | |
| 1018 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 1019 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1020 | INPUT_PORTS_END | |
| 1021 | ||
| 1022 | static INPUT_PORTS_START( jitsupro ) | |
| 1023 | PORT_INCLUDE( hachoo ) | |
| 1024 | ||
| 1025 | PORT_MODIFY("P1") | |
| 1026 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 1027 | ||
| 1028 | PORT_MODIFY("P2") | |
| 1029 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 1030 | ||
| 1031 | PORT_MODIFY("DSW") | |
| 1032 | PORT_DIPNAME( 0x0001, 0x0001, "2 Player Innings per Credit" ) | |
| 1033 | PORT_DIPSETTING( 0x0001, "2" ) | |
| 1034 | PORT_DIPSETTING( 0x0000, "3" ) | |
| 1035 | PORT_DIPNAME( 0x0002, 0x0002, "Difficulty for Catching Ball" ) | |
| 1036 | PORT_DIPSETTING( 0x0002, DEF_STR( Normal ) ) // $200-140 | |
| 1037 | PORT_DIPSETTING( 0x0000, DEF_STR( Hard ) ) // $400-140 | |
| 1038 | PORT_DIPNAME( 0x003c, 0x003c, "Franchise (Increase Batting Power)" ) | |
| 1039 | PORT_DIPSETTING( 0x003c, DEF_STR( Normal ) ) | |
| 1040 | PORT_DIPSETTING( 0x0038, "G" ) | |
| 1041 | PORT_DIPSETTING( 0x0034, "D" ) | |
| 1042 | PORT_DIPSETTING( 0x0030, "C" ) /* I hope the Japanese Baseball crowd knows what these leagues are ;-) */ | |
| 1043 | PORT_DIPSETTING( 0x002c, "S" ) | |
| 1044 | PORT_DIPSETTING( 0x0028, "W (B)" ) | |
| 1045 | PORT_DIPSETTING( 0x0024, "T" ) | |
| 1046 | PORT_DIPSETTING( 0x0020, "L" ) | |
| 1047 | PORT_DIPSETTING( 0x001c, "Br (Bw)" ) | |
| 1048 | PORT_DIPSETTING( 0x0018, "F" ) | |
| 1049 | PORT_DIPSETTING( 0x0014, "H" ) | |
| 1050 | PORT_DIPSETTING( 0x0010, "O (M)" ) | |
| 1051 | PORT_DIPSETTING( 0x000c, "Bu" ) | |
| 1052 | // PORT_DIPSETTING( 0x0008, "13" ) | |
| 1053 | // PORT_DIPSETTING( 0x0004, "14" ) | |
| 1054 | // PORT_DIPSETTING( 0x0000, "15" ) | |
| 1055 | PORT_DIPNAME( 0x0040, 0x0040, "Scroll Is Based On" ) | |
| 1056 | PORT_DIPSETTING( 0x0040, "Shadow of Baseball" ) | |
| 1057 | PORT_DIPSETTING( 0x0000, "The Baseball Itself" ) | |
| 1058 | INPUT_PORTS_END | |
| 1059 | ||
| 1060 | static INPUT_PORTS_START( kickoff ) | |
| 1061 | PORT_INCLUDE( megasys1_generic ) | |
| 1062 | ||
| 1063 | PORT_START("DSW") | |
| 1064 | PORT_DIPNAME( 0x0003, 0x0003, "Time" ) // -> !f0082.w | |
| 1065 | PORT_DIPSETTING( 0x0003, "3'" ) | |
| 1066 | PORT_DIPSETTING( 0x0002, "4'" ) | |
| 1067 | PORT_DIPSETTING( 0x0001, "5'" ) | |
| 1068 | PORT_DIPSETTING( 0x0000, "6'" ) | |
| 1069 | PORT_DIPUNUSED( 0x0004, 0x0004 ) /* Manual states dips 3 & 4 are "Unused" */ | |
| 1070 | PORT_DIPUNUSED( 0x0008, 0x0008 ) | |
| 1071 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 1072 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 1073 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) | |
| 1074 | PORT_DIPSETTING( 0x0010, DEF_STR( Harder ) ) | |
| 1075 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 1076 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Controls ) ) | |
| 1077 | PORT_DIPSETTING( 0x0040, DEF_STR( Trackball ) ) | |
| 1078 | PORT_DIPSETTING( 0x0000, DEF_STR( Joystick ) ) | |
| 1079 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 1080 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 1081 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1082 | ||
| 1083 | PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coinage ) ) | |
| 1084 | PORT_DIPSETTING( 0x0100, DEF_STR( 4C_1C ) ) | |
| 1085 | PORT_DIPSETTING( 0x0200, DEF_STR( 3C_1C ) ) | |
| 1086 | PORT_DIPSETTING( 0x0300, DEF_STR( 2C_1C ) ) | |
| 1087 | PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) ) | |
| 1088 | PORT_DIPSETTING( 0x0600, DEF_STR( 1C_2C ) ) | |
| 1089 | PORT_DIPSETTING( 0x0500, DEF_STR( 1C_3C ) ) | |
| 1090 | PORT_DIPSETTING( 0x0400, DEF_STR( 1C_4C ) ) | |
| 1091 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 1092 | PORT_DIPUNUSED( 0x0800, 0x0800 ) | |
| 1093 | PORT_DIPUNUSED( 0x1000, 0x1000 ) | |
| 1094 | PORT_DIPNAME( 0x2000, 0x2000, "Freeze Screen (Cheat)" ) | |
| 1095 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) | |
| 1096 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1097 | PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 1098 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 1099 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1100 | PORT_DIPNAME( 0x8000, 0x8000, "Text" ) | |
| 1101 | PORT_DIPSETTING( 0x8000, DEF_STR( Japanese ) ) | |
| 1102 | PORT_DIPSETTING( 0x0000, DEF_STR( English ) ) // show "Japan Only" warning | |
| 1103 | INPUT_PORTS_END | |
| 1104 | ||
| 1105 | static INPUT_PORTS_START( lomakai ) | |
| 1106 | PORT_INCLUDE( megasys1_generic ) | |
| 1107 | ||
| 1108 | PORT_START("DSW") | |
| 1109 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) | |
| 1110 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 1111 | PORT_DIPSETTING( 0x0003, "3" ) | |
| 1112 | PORT_DIPSETTING( 0x0002, "4" ) | |
| 1113 | PORT_DIPSETTING( 0x0001, "5" ) | |
| 1114 | PORT_DIPUNUSED( 0x0004, 0x0004 ) | |
| 1115 | PORT_DIPUNUSED( 0x0008, 0x0008 ) | |
| 1116 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) // boss enemy damage bar | |
| 1117 | PORT_DIPSETTING( 0x0030, DEF_STR( Easy ) ) // 6 dots | |
| 1118 | PORT_DIPSETTING( 0x0020, DEF_STR( Normal ) ) // 8 dots | |
| 1119 | PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) // 9 dots | |
| 1120 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) // 12 dots | |
| 1121 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Cabinet ) ) | |
| 1122 | PORT_DIPSETTING( 0x0000, DEF_STR( Upright ) ) | |
| 1123 | PORT_DIPSETTING( 0x0040, DEF_STR( Cocktail ) ) | |
| 1124 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 1125 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 1126 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1127 | ||
| 1128 | PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) ) | |
| 1129 | PORT_DIPSETTING( 0x0100, DEF_STR( 4C_1C ) ) | |
| 1130 | PORT_DIPSETTING( 0x0200, DEF_STR( 3C_1C ) ) | |
| 1131 | PORT_DIPSETTING( 0x0300, DEF_STR( 2C_1C ) ) | |
| 1132 | PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) ) | |
| 1133 | PORT_DIPSETTING( 0x0600, DEF_STR( 1C_2C ) ) | |
| 1134 | PORT_DIPSETTING( 0x0500, DEF_STR( 1C_3C ) ) | |
| 1135 | PORT_DIPSETTING( 0x0400, DEF_STR( 1C_4C ) ) | |
| 1136 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 1137 | PORT_DIPNAME( 0x3800, 0x3800, DEF_STR( Coin_B ) ) | |
| 1138 | PORT_DIPSETTING( 0x0800, DEF_STR( 4C_1C ) ) | |
| 1139 | PORT_DIPSETTING( 0x1000, DEF_STR( 3C_1C ) ) | |
| 1140 | PORT_DIPSETTING( 0x1800, DEF_STR( 2C_1C ) ) | |
| 1141 | PORT_DIPSETTING( 0x3800, DEF_STR( 1C_1C ) ) | |
| 1142 | PORT_DIPSETTING( 0x3000, DEF_STR( 1C_2C ) ) | |
| 1143 | PORT_DIPSETTING( 0x2800, DEF_STR( 1C_3C ) ) | |
| 1144 | PORT_DIPSETTING( 0x2000, DEF_STR( 1C_4C ) ) | |
| 1145 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 1146 | PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 1147 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 1148 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1149 | PORT_DIPNAME( 0x8000, 0x8000, "Invulnerability (Cheat)") | |
| 1150 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 1151 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1152 | INPUT_PORTS_END | |
| 1153 | ||
| 1154 | static INPUT_PORTS_START( p47 ) | |
| 1155 | PORT_INCLUDE( lomakai ) | |
| 1156 | ||
| 1157 | PORT_MODIFY("DSW") /* Manual states dips 3 & 4 are "Unused" */ | |
| 1158 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) | |
| 1159 | PORT_DIPSETTING( 0x0002, "2" ) | |
| 1160 | PORT_DIPSETTING( 0x0003, "3" ) | |
| 1161 | PORT_DIPSETTING( 0x0001, "4" ) | |
| 1162 | PORT_DIPSETTING( 0x0000, "5" ) | |
| 1163 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 1164 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 1165 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 1166 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) | |
| 1167 | PORT_DIPSETTING( 0x0010, DEF_STR( Hardest ) ) | |
| 1168 | PORT_DIPUNUSED( 0x0040, 0x0040 ) /* Manual states this dip is "Unused" */ | |
| 1169 | INPUT_PORTS_END | |
| 1170 | ||
| 1171 | static INPUT_PORTS_START( plusalph ) | |
| 1172 | PORT_INCLUDE( hachoo ) | |
| 1173 | ||
| 1174 | PORT_MODIFY("DSW") | |
| 1175 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) | |
| 1176 | PORT_DIPSETTING( 0x0003, "3" ) | |
| 1177 | PORT_DIPSETTING( 0x0002, "4" ) | |
| 1178 | PORT_DIPSETTING( 0x0001, "5" ) | |
| 1179 | PORT_DIPSETTING( 0x0000, "Infinite (Cheat)" ) | |
| 1180 | PORT_DIPNAME( 0x0004, 0x0004, "Hyper Laser Beams" ) | |
| 1181 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 1182 | PORT_DIPSETTING( 0x0004, "3" ) | |
| 1183 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Bonus_Life ) ) | |
| 1184 | PORT_DIPSETTING( 0x0008, "70k and every 200k") /* As stated in manual, but was 70K & Every 130K */ | |
| 1185 | PORT_DIPSETTING( 0x0000, "100k and 300k Only") /* As stated in manual, but was 100K & Every 200K */ | |
| 1186 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 1187 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 1188 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 1189 | PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) | |
| 1190 | PORT_DIPSETTING( 0x0020, DEF_STR( Hardest ) ) | |
| 1191 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Cabinet ) ) | |
| 1192 | PORT_DIPSETTING( 0x0000, DEF_STR( Upright ) ) | |
| 1193 | PORT_DIPSETTING( 0x0040, DEF_STR( Cocktail ) ) | |
| 1194 | ||
| 1195 | PORT_DIPNAME( 0x8000, 0x8000, "Freeze Screen (Cheat)") | |
| 1196 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 1197 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1198 | INPUT_PORTS_END | |
| 1199 | ||
| 1200 | static INPUT_PORTS_START( rodland ) | |
| 1201 | PORT_INCLUDE( hachoo ) | |
| 1202 | ||
| 1203 | PORT_MODIFY("DSW") /* Manual states dips 1 & 2 are "Unused" */ | |
| 1204 | PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Lives ) ) | |
| 1205 | PORT_DIPSETTING( 0x0004, "2" ) | |
| 1206 | PORT_DIPSETTING( 0x000c, "3" ) | |
| 1207 | PORT_DIPSETTING( 0x0008, "4" ) | |
| 1208 | PORT_DIPSETTING( 0x0000, "Infinite (Cheat)") | |
| 1209 | PORT_DIPNAME( 0x0010, 0x0010, "Default episode" ) | |
| 1210 | PORT_DIPSETTING( 0x0010, "1" ) | |
| 1211 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 1212 | PORT_DIPNAME( 0x0060, 0x0060, DEF_STR( Difficulty ) ) | |
| 1213 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 1214 | PORT_DIPSETTING( 0x0060, DEF_STR( Normal ) ) | |
| 1215 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) | |
| 1216 | PORT_DIPSETTING( 0x0040, DEF_STR( Hardest ) ) | |
| 1217 | ||
| 1218 | PORT_SERVICE( 0x8000, IP_ACTIVE_LOW ) | |
| 1219 | INPUT_PORTS_END | |
| 1220 | ||
| 1221 | static INPUT_PORTS_START( stdragon ) | |
| 1222 | PORT_INCLUDE( lomakai ) | |
| 1223 | ||
| 1224 | PORT_MODIFY("DSW") /* Manual states dips 3 & 4 are "Unused" */ | |
| 1225 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) | |
| 1226 | PORT_DIPSETTING( 0x0002, "2" ) | |
| 1227 | PORT_DIPSETTING( 0x0003, "3" ) | |
| 1228 | PORT_DIPSETTING( 0x0001, "4" ) | |
| 1229 | PORT_DIPSETTING( 0x0000, "5" ) | |
| 1230 | PORT_DIPUNUSED( 0x8000, 0x8000 ) // used? | |
| 1231 | INPUT_PORTS_END | |
| 1232 | ||
| 1233 | static INPUT_PORTS_START( soldam ) | |
| 1234 | PORT_INCLUDE( lomakai ) | |
| 1235 | ||
| 1236 | PORT_MODIFY("DSW") | |
| 1237 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) | |
| 1238 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 1239 | PORT_DIPSETTING( 0x0003, DEF_STR( Normal ) ) | |
| 1240 | PORT_DIPSETTING( 0x0002, DEF_STR( Hard ) ) | |
| 1241 | PORT_DIPSETTING( 0x0001, DEF_STR( Hardest )) | |
| 1242 | PORT_DIPNAME( 0x000c, 0x000c, "Games To Play (Vs)" ) | |
| 1243 | PORT_DIPSETTING( 0x0000, "1" ) | |
| 1244 | PORT_DIPSETTING( 0x000c, "2" ) | |
| 1245 | PORT_DIPSETTING( 0x0008, "3" ) | |
| 1246 | PORT_DIPSETTING( 0x0004, "4" ) | |
| 1247 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Allow_Continue ) ) | |
| 1248 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 1249 | PORT_DIPSETTING( 0x0010, DEF_STR( On ) ) | |
| 1250 | PORT_DIPNAME( 0x0020, 0x0020, "Credits To Start (Vs)" ) | |
| 1251 | PORT_DIPSETTING( 0x0020, "1" ) | |
| 1252 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 1253 | PORT_DIPNAME( 0x0040, 0x0040, "Credits To Continue (Vs)" ) | |
| 1254 | PORT_DIPSETTING( 0x0040, "1" ) | |
| 1255 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 1256 | PORT_SERVICE( 0x8000, IP_ACTIVE_LOW ) | |
| 1257 | INPUT_PORTS_END | |
| 1258 | ||
| 1259 | static INPUT_PORTS_START( tshingen ) | |
| 1260 | PORT_INCLUDE( hachoo ) | |
| 1261 | ||
| 1262 | PORT_MODIFY("P1") | |
| 1263 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 1264 | ||
| 1265 | PORT_MODIFY("P2") | |
| 1266 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 1267 | ||
| 1268 | PORT_MODIFY("DSW") | |
| 1269 | PORT_DIPNAME( 0x0003, 0x0001, DEF_STR( Lives ) ) | |
| 1270 | PORT_DIPSETTING( 0x0003, "2" ) | |
| 1271 | PORT_DIPSETTING( 0x0001, "3" ) | |
| 1272 | PORT_DIPSETTING( 0x0002, "4" ) | |
| 1273 | PORT_DIPSETTING( 0x0000, "Infinite (Cheat)" ) | |
| 1274 | PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Bonus_Life ) ) | |
| 1275 | PORT_DIPSETTING( 0x000c, "20k" ) | |
| 1276 | PORT_DIPSETTING( 0x0004, "30k" ) | |
| 1277 | PORT_DIPSETTING( 0x0008, "40k" ) | |
| 1278 | PORT_DIPSETTING( 0x0000, "50k" ) | |
| 1279 | PORT_DIPNAME( 0x0030, 0x0010, DEF_STR( Difficulty ) ) // damage when hit | |
| 1280 | PORT_DIPSETTING( 0x0030, DEF_STR( Easy ) ) // 0 | |
| 1281 | PORT_DIPSETTING( 0x0010, DEF_STR( Normal ) ) // 1 | |
| 1282 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) // 2 | |
| 1283 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) // 3 | |
| 1284 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Allow_Continue ) ) | |
| 1285 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 1286 | PORT_DIPSETTING( 0x0040, DEF_STR( On ) ) | |
| 1287 | INPUT_PORTS_END | |
| 1288 | ||
| 1289 | static INPUT_PORTS_START( hayaosi1 ) | |
| 1290 | PORT_START("SYSTEM") | |
| 1291 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 ) | |
| 1292 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 ) | |
| 1293 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1294 | PORT_SERVICE_NO_TOGGLE( 0x0008, IP_ACTIVE_LOW ) | |
| 1295 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START3 ) | |
| 1296 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 1297 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 1298 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 1299 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1300 | ||
| 1301 | PORT_START("P1") | |
| 1302 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 1303 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 1304 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 1305 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 1306 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) | |
| 1307 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) | |
| 1308 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) | |
| 1309 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(3) | |
| 1310 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1311 | ||
| 1312 | PORT_START("P2") | |
| 1313 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) | |
| 1314 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 1315 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) | |
| 1316 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 1317 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3) | |
| 1318 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) | |
| 1319 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) | |
| 1320 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1321 | ||
| 1322 | PORT_START("DSW1") | |
| 1323 | COINAGE_8BITS | |
| 1324 | ||
| 1325 | PORT_START("DSW2") /* 0x69353.b */ | |
| 1326 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) | |
| 1327 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 1328 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1329 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) ) | |
| 1330 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 1331 | PORT_DIPSETTING( 0x0002, DEF_STR( On ) ) | |
| 1332 | PORT_DIPNAME( 0x0004, 0x0004, "Unknown 2-2" ) | |
| 1333 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 1334 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1335 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) | |
| 1336 | PORT_DIPSETTING( 0x0010, DEF_STR( Easy ) ) | |
| 1337 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 1338 | PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) ) | |
| 1339 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 1340 | PORT_DIPNAME( 0x0020, 0x0020, "Points To Win" ) | |
| 1341 | PORT_DIPSETTING( 0x0000, "10" ) | |
| 1342 | PORT_DIPSETTING( 0x0020, "15" ) | |
| 1343 | PORT_DIPNAME( 0x0040, 0x0040, "Unknown 2-6" ) | |
| 1344 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 1345 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1346 | PORT_DIPNAME( 0x0080, 0x0080, "Unknown 2-7" ) | |
| 1347 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 1348 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1349 | INPUT_PORTS_END | |
| 1350 | ||
| 1351 | static INPUT_PORTS_START( peekaboo ) | |
| 1352 | PORT_START("SYSTEM") | |
| 1353 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN3 ) // called "service" | |
| 1354 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN4 ) // called "test" | |
| 1355 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 1356 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 1357 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START1 ) | |
| 1358 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 ) | |
| 1359 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1360 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1361 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 1362 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 1363 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 1364 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 1365 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON3 ) // called "stage clear" | |
| 1366 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON4 ) // called "option" | |
| 1367 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1368 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1369 | ||
| 1370 | PORT_START("P1") | |
| 1371 | PORT_BIT( 0x00ff, 0x0080, IPT_PADDLE ) PORT_PLAYER(1) PORT_MINMAX(0x0018,0x00e0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) | |
| 1372 | ||
| 1373 | PORT_START("P2") | |
| 1374 | PORT_BIT( 0x00ff, 0x0080, IPT_PADDLE ) PORT_PLAYER(2) PORT_MINMAX(0x0018,0x00e0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_COCKTAIL | |
| 1375 | ||
| 1376 | PORT_START("DSW") | |
| 1377 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) // 1f0358<-! | |
| 1378 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 1379 | PORT_DIPSETTING( 0x0003, DEF_STR( Normal ) ) | |
| 1380 | PORT_DIPSETTING( 0x0002, DEF_STR( Hard ) ) | |
| 1381 | PORT_DIPSETTING( 0x0001, DEF_STR( Hardest ) ) | |
| 1382 | PORT_SERVICE( 0x0004, IP_ACTIVE_LOW ) | |
| 1383 | PORT_DIPNAME( 0x0008, 0x0008, "Movement" ) // 1f0392<-! | |
| 1384 | PORT_DIPSETTING( 0x0008, "Paddles" ) | |
| 1385 | PORT_DIPSETTING( 0x0000, "Buttons" ) | |
| 1386 | PORT_DIPNAME( 0x0030, 0x0030, "Nudity" ) // 1f0356<-! | |
| 1387 | PORT_DIPSETTING( 0x0030, "Female and Male (Full)" ) | |
| 1388 | PORT_DIPSETTING( 0x0020, "Female (Full)" ) | |
| 1389 | PORT_DIPSETTING( 0x0010, "Female (Partial)" ) | |
| 1390 | PORT_DIPSETTING( 0x0000, DEF_STR( None ) ) | |
| 1391 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Cabinet ) ) // 1f006a<-! | |
| 1392 | PORT_DIPSETTING( 0x0040, DEF_STR( Upright ) ) | |
| 1393 | PORT_DIPSETTING( 0x0000, DEF_STR( Cocktail ) ) | |
| 1394 | PORT_DIPNAME( 0x0080, 0x0080, "Number of controllers" ) // 1f0074<-! | |
| 1395 | PORT_DIPSETTING( 0x0080, "1" ) | |
| 1396 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 1397 | ||
| 1398 | PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) ) | |
| 1399 | PORT_DIPSETTING( 0x0100, DEF_STR( 4C_1C ) ) | |
| 1400 | PORT_DIPSETTING( 0x0200, DEF_STR( 3C_1C ) ) | |
| 1401 | PORT_DIPSETTING( 0x0300, DEF_STR( 2C_1C ) ) | |
| 1402 | PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) ) | |
| 1403 | PORT_DIPSETTING( 0x0600, DEF_STR( 1C_2C ) ) | |
| 1404 | PORT_DIPSETTING( 0x0500, DEF_STR( 1C_3C ) ) | |
| 1405 | PORT_DIPSETTING( 0x0400, DEF_STR( 1C_4C ) ) | |
| 1406 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 1407 | PORT_DIPNAME( 0x3800, 0x3800, DEF_STR( Coin_B ) ) | |
| 1408 | PORT_DIPSETTING( 0x0800, DEF_STR( 4C_1C ) ) | |
| 1409 | PORT_DIPSETTING( 0x1000, DEF_STR( 3C_1C ) ) | |
| 1410 | PORT_DIPSETTING( 0x1800, DEF_STR( 2C_1C ) ) | |
| 1411 | PORT_DIPSETTING( 0x3800, DEF_STR( 1C_1C ) ) | |
| 1412 | PORT_DIPSETTING( 0x3000, DEF_STR( 1C_2C ) ) | |
| 1413 | PORT_DIPSETTING( 0x2800, DEF_STR( 1C_3C ) ) | |
| 1414 | PORT_DIPSETTING( 0x2000, DEF_STR( 1C_4C ) ) | |
| 1415 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 1416 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) // 1f0354<- | |
| 1417 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 1418 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) | |
| 1419 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Flip_Screen ) ) // 1f0022/6e<-! | |
| 1420 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 1421 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1422 | INPUT_PORTS_END | |
| 1423 | ||
| 1424 | /************************************* | |
| 1425 | * | |
| 1426 | * Peek-a-Boo! Custom I/O | |
| 1427 | * | |
| 1428 | *************************************/ | |
| 1429 | ||
| 1430 | static UINT16 protection_val; | |
| 1431 | ||
| 1432 | /* Read the input ports, through a protection device */ | |
| 1433 | static READ16_HANDLER( protection_peekaboo_r ) | |
| 1434 | { | |
| 1435 | switch (protection_val) | |
| 1436 | { | |
| 1437 | case 0x02: return 0x03; | |
| 1438 | case 0x51: return input_port_read(space->machine, "P1"); | |
| 1439 | case 0x52: return input_port_read(space->machine, "P2"); | |
| 1440 | default: return protection_val; | |
| 1441 | } | |
| 1442 | } | |
| 1443 | ||
| 1444 | static WRITE16_HANDLER( protection_peekaboo_w ) | |
| 1445 | { | |
| 1446 | static int bank; | |
| 1447 | ||
| 1448 | COMBINE_DATA(&protection_val); | |
| 1449 | ||
| 1450 | if ((protection_val & 0x90) == 0x90) | |
| 1451 | { | |
| 1452 | UINT8 *RAM = memory_region(space->machine, "oki1"); | |
| 1453 | int new_bank = (protection_val & 0x7) % 7; | |
| 1454 | ||
| 1455 | if (bank != new_bank) | |
| 1456 | { | |
| 1457 | memcpy(&RAM[0x20000],&RAM[0x40000 + 0x20000*new_bank],0x20000); | |
| 1458 | bank = new_bank; | |
| 1459 | } | |
| 1460 | } | |
| 1461 | ||
| 1462 | cpu_set_input_line(space->machine->cpu[0],4,HOLD_LINE); | |
| 1463 | } | |
| 1464 | ||
| 1465 | /************************************* | |
| 1466 | * | |
| 1467 | * Graphics definitions | |
| 1468 | * | |
| 1469 | *************************************/ | |
| 1470 | ||
| 542 | 1471 | static const gfx_layout tilelayout = |
| 543 | 1472 | { |
| 544 | 1473 | 8,8, |
| r4135 | r4136 | |
| 574 | 1503 | GFXDECODE_ENTRY( "gfx4", 0, spritelayout, 256*3, 16 ) // [3] Sprites |
| 575 | 1504 | GFXDECODE_END |
| 576 | 1505 | |
| 1506 | /************************************* | |
| 1507 | * | |
| 1508 | * Machine Driver Macros | |
| 1509 | * | |
| 1510 | *************************************/ | |
| 577 | 1511 | |
| 578 | 1512 | /*************************************************************************** |
| 579 | 1513 | |
| 580 | Machine Driver Macros | |
| 581 | ||
| 582 | ***************************************************************************/ | |
| 583 | ||
| 584 | /*************************************************************************** | |
| 585 | ||
| 586 | 1514 | [ Mega System 1 A,B and C ] |
| 587 | 1515 | |
| 588 | 1516 | 2x68000 2xM6295 1xYM2151 |
| r4135 | r4136 | |
| 801 | 1729 | MACHINE_DRIVER_END |
| 802 | 1730 | |
| 803 | 1731 | |
| 1732 | /************************************* | |
| 1733 | * | |
| 1734 | * ROM definition(s) | |
| 1735 | * | |
| 1736 | *************************************/ | |
| 804 | 1737 | |
| 805 | ||
| 806 | ||
| 807 | 1738 | /*************************************************************************** |
| 808 | 1739 | |
| 809 | ROMs Loading | |
| 810 | ||
| 811 | ***************************************************************************/ | |
| 812 | ||
| 813 | ||
| 814 | ||
| 815 | /*************************************************************************** | |
| 816 | ||
| 817 | 1740 | [ 64th Street ] |
| 818 | 1741 | |
| 819 | 1742 | It runs on 1 MC68000P12 and 1 MC6800P10 |
| r4135 | r4136 | |
| 850 | 1773 | |
| 851 | 1774 | ***************************************************************************/ |
| 852 | 1775 | |
| 1776 | ||
| 853 | 1777 | ROM_START( 64street ) |
| 854 | 1778 | ROM_REGION( 0x80000, "main", 0 ) /* Main CPU Code */ |
| 855 | 1779 | ROM_LOAD16_BYTE( "64th_03.rom", 0x000000, 0x040000, CRC(ed6c6942) SHA1(f610b31548ed4889a43d77be286b9bfabf700064) ) |
| r4135 | r4136 | |
| 922 | 1846 | ROM_END |
| 923 | 1847 | |
| 924 | 1848 | |
| 925 | ||
| 926 | static INPUT_PORTS_START( 64street ) | |
| 927 | PORT_START("SYSTEM") | |
| 928 | COINS | |
| 929 | ||
| 930 | PORT_START("P1") | |
| 931 | JOY_2BUTTONS(1) // fire jump | |
| 932 | ||
| 933 | PORT_START("P2") | |
| 934 | JOY_2BUTTONS(2) | |
| 935 | RESERVE // Unused | |
| 936 | ||
| 937 | PORT_START("DSW1") | |
| 938 | COINAGE_8BITS | |
| 939 | ||
| 940 | PORT_START("DSW2") | |
| 941 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) | |
| 942 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 943 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 944 | PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 945 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 946 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 947 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Allow_Continue ) ) | |
| 948 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 949 | PORT_DIPSETTING( 0x0004, DEF_STR( On ) ) | |
| 950 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) | |
| 951 | PORT_DIPSETTING( 0x0010, DEF_STR( Easy ) ) | |
| 952 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 953 | PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) ) | |
| 954 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 955 | PORT_DIPNAME( 0x0060, 0x0020, DEF_STR( Lives ) ) | |
| 956 | PORT_DIPSETTING( 0x0040, "1" ) | |
| 957 | PORT_DIPSETTING( 0x0060, "2" ) | |
| 958 | PORT_DIPSETTING( 0x0020, "3" ) | |
| 959 | PORT_DIPSETTING( 0x0000, "5" ) | |
| 960 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) | |
| 961 | INPUT_PORTS_END | |
| 962 | ||
| 963 | ||
| 964 | 1849 | /*************************************************************************** |
| 965 | 1850 | |
| 966 | 1851 | [ The Astyanax ] / [ The Lord of King ] |
| r4135 | r4136 | |
| 1014 | 1899 | ROM_LOAD( "rd.bpr", 0x0000, 0x0200, CRC(85b30ac4) SHA1(b03f577ceb0f26b67453ffa52ef61fea76a93184) ) |
| 1015 | 1900 | ROM_END |
| 1016 | 1901 | |
| 1902 | ||
| 1017 | 1903 | ROM_START( lordofk ) |
| 1018 | 1904 | ROM_REGION( 0x80000, "main", 0 ) /* Main CPU Code */ |
| 1019 | 1905 | ROM_LOAD16_BYTE( "lokj02.bin", 0x00000, 0x20000, CRC(0d7f9b4a) SHA1(551f237cd60e3b9aa339e393a672b08645b043cc) ) |
| r4135 | r4136 | |
| 1059 | 1945 | ROM_END |
| 1060 | 1946 | |
| 1061 | 1947 | |
| 1062 | static INPUT_PORTS_START( astyanax ) | |
| 1063 | PORT_START("SYSTEM") /* 0x80001.b */ | |
| 1064 | COINS | |
| 1065 | ||
| 1066 | PORT_START("P1") /* 0x80003.b */ | |
| 1067 | JOY_3BUTTONS(1) // fire jump magic | |
| 1068 | ||
| 1069 | PORT_START("P2") /* 0x80004.b - 0x80005.b */ | |
| 1070 | JOY_3BUTTONS(2) | |
| 1071 | RESERVE | |
| 1072 | ||
| 1073 | PORT_START("DSW") | |
| 1074 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) // according to manual | |
| 1075 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 1076 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1077 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) // according to manual | |
| 1078 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 1079 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1080 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Bonus_Life ) ) | |
| 1081 | PORT_DIPSETTING( 0x0004, "30k 70k 110k then every 30k" ) | |
| 1082 | PORT_DIPSETTING( 0x0000, "50k 100k then every 40k" ) | |
| 1083 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Lives ) ) | |
| 1084 | PORT_DIPSETTING( 0x0008, "2" ) | |
| 1085 | PORT_DIPSETTING( 0x0018, "3" ) | |
| 1086 | PORT_DIPSETTING( 0x0010, "4" ) | |
| 1087 | PORT_DIPSETTING( 0x0000, "5" ) | |
| 1088 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Difficulty ) ) | |
| 1089 | PORT_DIPSETTING( 0x0020, DEF_STR( Normal ) ) | |
| 1090 | PORT_DIPSETTING( 0x0000, DEF_STR( Hard ) ) | |
| 1091 | PORT_DIPNAME( 0x0040, 0x0040, "Swap 1P/2P Controls" ) | |
| 1092 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 1093 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1094 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 1095 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 1096 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1097 | ||
| 1098 | PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) ) | |
| 1099 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) | |
| 1100 | PORT_DIPSETTING( 0x0400, DEF_STR( 3C_1C ) ) | |
| 1101 | PORT_DIPSETTING( 0x0200, DEF_STR( 2C_1C ) ) | |
| 1102 | PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) ) | |
| 1103 | // PORT_DIPSETTING( 0x0300, DEF_STR( 1C_1C ) ) // 1_2 shown in test mode | |
| 1104 | // PORT_DIPSETTING( 0x0500, DEF_STR( 1C_1C ) ) // 1_3 | |
| 1105 | // PORT_DIPSETTING( 0x0100, DEF_STR( 1C_1C ) ) // 1_4 | |
| 1106 | // PORT_DIPSETTING( 0x0600, DEF_STR( 1C_1C ) ) // 1_5 | |
| 1107 | PORT_DIPNAME( 0x3800, 0x3800, DEF_STR( Coin_B ) ) | |
| 1108 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) | |
| 1109 | PORT_DIPSETTING( 0x2000, DEF_STR( 3C_1C ) ) | |
| 1110 | PORT_DIPSETTING( 0x1000, DEF_STR( 2C_1C ) ) | |
| 1111 | PORT_DIPSETTING( 0x3800, DEF_STR( 1C_1C ) ) | |
| 1112 | // PORT_DIPSETTING( 0x1800, DEF_STR( 1C_1C ) ) // 1_2 shown in test mode | |
| 1113 | // PORT_DIPSETTING( 0x2800, DEF_STR( 1C_1C ) ) // 1_3 | |
| 1114 | // PORT_DIPSETTING( 0x0800, DEF_STR( 1C_1C ) ) // 1_4 | |
| 1115 | // PORT_DIPSETTING( 0x3000, DEF_STR( 1C_1C ) ) // 1_5 | |
| 1116 | PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 1117 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 1118 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1119 | PORT_DIPNAME( 0x8000, 0x8000, "Test Mode" ) | |
| 1120 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 1121 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1122 | INPUT_PORTS_END | |
| 1123 | ||
| 1124 | ||
| 1125 | ||
| 1126 | 1948 | /*************************************************************************** |
| 1127 | 1949 | |
| 1128 | 1950 | [ Avenging Spirit ] / [ Phantasm ] |
| r4135 | r4136 | |
| 1161 | 1983 | |
| 1162 | 1984 | ***************************************************************************/ |
| 1163 | 1985 | |
| 1986 | ||
| 1164 | 1987 | ROM_START( avspirit ) |
| 1165 | 1988 | ROM_REGION( 0xc0000, "main", 0 ) /* Main CPU Code: 00000-3ffff & 80000-bffff */ |
| 1166 | 1989 | ROM_LOAD16_BYTE( "spirit05.rom", 0x000000, 0x020000, CRC(b26a341a) SHA1(5ff5b7d3aa73cc7cea7b6e8cc2ba55f4cd9b52e5) ) |
| r4135 | r4136 | |
| 1240 | 2063 | ROM_LOAD( "ph.bin", 0x0000, 0x0200, CRC(8359650a) SHA1(97d0105f06c64340fb19a541db03481a7e0b5e05) ) |
| 1241 | 2064 | ROM_END |
| 1242 | 2065 | |
| 1243 | /* | |
| 1244 | 2066 | |
| 2067 | /*************************************************************************** | |
| 2068 | ||
| 1245 | 2069 | Monky Elf |
| 1246 | 2070 | |
| 1247 | 2071 | PCB Layout |
| r4135 | r4136 | |
| 1273 | 2097 | YM2151 clock 3.000MHz [12/4] |
| 1274 | 2098 | M6295 clocks 3.000MHz [12/4] pin 7 high |
| 1275 | 2099 | |
| 1276 | */ | |
| 2100 | ***************************************************************************/ | |
| 1277 | 2101 | |
| 2102 | ||
| 1278 | 2103 | ROM_START( monkelf ) |
| 1279 | 2104 | ROM_REGION( 0xc0000, "main", 0 ) /* Main CPU Code: 00000-3ffff & 80000-bffff */ |
| 1280 | 2105 | ROM_LOAD16_BYTE( "6", 0x000000, 0x020000, CRC(40b80914) SHA1(103dd3531b6b270e0d756801ff5ac69db5c6b82f) ) |
| r4135 | r4136 | |
| 1311 | 2136 | ROM_END |
| 1312 | 2137 | |
| 1313 | 2138 | |
| 1314 | static INPUT_PORTS_START( avspirit ) | |
| 1315 | PORT_START("SYSTEM") | |
| 1316 | COINS | |
| 1317 | ||
| 1318 | PORT_START("P1") | |
| 1319 | JOY_2BUTTONS(1) | |
| 1320 | ||
| 1321 | PORT_START("P2") | |
| 1322 | JOY_2BUTTONS(2) | |
| 1323 | RESERVE | |
| 1324 | ||
| 1325 | PORT_START("DSW1") | |
| 1326 | COINAGE_8BITS | |
| 1327 | ||
| 1328 | PORT_START("DSW2") | |
| 1329 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) | |
| 1330 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 1331 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1332 | PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 1333 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 1334 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1335 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Allow_Continue ) ) | |
| 1336 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 1337 | PORT_DIPSETTING( 0x0004, DEF_STR( On ) ) | |
| 1338 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) | |
| 1339 | PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) ) | |
| 1340 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 1341 | PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) | |
| 1342 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 1343 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Cabinet ) ) | |
| 1344 | PORT_DIPSETTING( 0x0020, DEF_STR( Upright ) ) | |
| 1345 | PORT_DIPSETTING( 0x0000, DEF_STR( Cocktail ) ) | |
| 1346 | PORT_DIPNAME( 0x0040, 0x0040, "Test Mode" ) // freeze & slow motion via P1 + P2 start | |
| 1347 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 1348 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1349 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) | |
| 1350 | INPUT_PORTS_END | |
| 1351 | ||
| 1352 | ||
| 1353 | static INPUT_PORTS_START( phantasm ) | |
| 1354 | PORT_START("SYSTEM") | |
| 1355 | COINS | |
| 1356 | ||
| 1357 | PORT_START("P1") | |
| 1358 | JOY_2BUTTONS(1) | |
| 1359 | ||
| 1360 | PORT_START("P2") | |
| 1361 | JOY_2BUTTONS(2) | |
| 1362 | RESERVE | |
| 1363 | ||
| 1364 | PORT_START("DSW") | |
| 1365 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) | |
| 1366 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 1367 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1368 | PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 1369 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 1370 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1371 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Allow_Continue ) ) | |
| 1372 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 1373 | PORT_DIPSETTING( 0x0004, DEF_STR( On ) ) | |
| 1374 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) | |
| 1375 | PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) ) | |
| 1376 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 1377 | PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) | |
| 1378 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 1379 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Cabinet ) ) | |
| 1380 | PORT_DIPSETTING( 0x0020, DEF_STR( Upright ) ) | |
| 1381 | PORT_DIPSETTING( 0x0000, DEF_STR( Cocktail ) ) | |
| 1382 | PORT_DIPNAME( 0x0040, 0x0040, "Test Mode" ) // freeze & slow motion via P1 + P2 start | |
| 1383 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 1384 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1385 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) | |
| 1386 | ||
| 1387 | PORT_DIPNAME( 0x0f00, 0x0f00, DEF_STR( Coin_A ) ) | |
| 1388 | PORT_DIPSETTING( 0x0700, DEF_STR( 4C_1C ) ) | |
| 1389 | PORT_DIPSETTING( 0x0800, DEF_STR( 3C_1C ) ) | |
| 1390 | PORT_DIPSETTING( 0x0900, DEF_STR( 2C_1C ) ) | |
| 1391 | PORT_DIPSETTING( 0x0f00, DEF_STR( 1C_1C ) ) | |
| 1392 | /* PORT_DIPSETTING( 0x0500, DEF_STR( 1C_1C ) )*/ | |
| 1393 | /* PORT_DIPSETTING( 0x0400, DEF_STR( 1C_1C ) )*/ | |
| 1394 | /* PORT_DIPSETTING( 0x0300, DEF_STR( 1C_1C ) )*/ | |
| 1395 | /* PORT_DIPSETTING( 0x0200, DEF_STR( 1C_1C ) )*/ | |
| 1396 | /* PORT_DIPSETTING( 0x0100, DEF_STR( 1C_1C ) )*/ | |
| 1397 | PORT_DIPSETTING( 0x0600, DEF_STR( 2C_3C ) ) | |
| 1398 | PORT_DIPSETTING( 0x0e00, DEF_STR( 1C_2C ) ) | |
| 1399 | PORT_DIPSETTING( 0x0d00, DEF_STR( 1C_3C ) ) | |
| 1400 | PORT_DIPSETTING( 0x0c00, DEF_STR( 1C_4C ) ) | |
| 1401 | PORT_DIPSETTING( 0x0b00, DEF_STR( 1C_5C ) ) | |
| 1402 | PORT_DIPSETTING( 0x0a00, DEF_STR( 1C_6C ) ) | |
| 1403 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 1404 | PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coin_B ) ) | |
| 1405 | PORT_DIPSETTING( 0x7000, DEF_STR( 4C_1C ) ) | |
| 1406 | PORT_DIPSETTING( 0x8000, DEF_STR( 3C_1C ) ) | |
| 1407 | PORT_DIPSETTING( 0x9000, DEF_STR( 2C_1C ) ) | |
| 1408 | PORT_DIPSETTING( 0xf000, DEF_STR( 1C_1C ) ) | |
| 1409 | /* PORT_DIPSETTING( 0x5000, DEF_STR( 1C_1C ) )*/ | |
| 1410 | /* PORT_DIPSETTING( 0x4000, DEF_STR( 1C_1C ) )*/ | |
| 1411 | /* PORT_DIPSETTING( 0x3000, DEF_STR( 1C_1C ) )*/ | |
| 1412 | /* PORT_DIPSETTING( 0x2000, DEF_STR( 1C_1C ) )*/ | |
| 1413 | /* PORT_DIPSETTING( 0x1000, DEF_STR( 1C_1C ) )*/ | |
| 1414 | PORT_DIPSETTING( 0x6000, DEF_STR( 2C_3C ) ) | |
| 1415 | PORT_DIPSETTING( 0xe000, DEF_STR( 1C_2C ) ) | |
| 1416 | PORT_DIPSETTING( 0xd000, DEF_STR( 1C_3C ) ) | |
| 1417 | PORT_DIPSETTING( 0xc000, DEF_STR( 1C_4C ) ) | |
| 1418 | PORT_DIPSETTING( 0xb000, DEF_STR( 1C_5C ) ) | |
| 1419 | PORT_DIPSETTING( 0xa000, DEF_STR( 1C_6C ) ) | |
| 1420 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 1421 | INPUT_PORTS_END | |
| 1422 | ||
| 1423 | ||
| 1424 | ||
| 1425 | 2139 | /*************************************************************************** |
| 1426 | 2140 | |
| 1427 | 2141 | [ Big Striker ] |
| r4135 | r4136 | |
| 1448 | 2162 | |
| 1449 | 2163 | ***************************************************************************/ |
| 1450 | 2164 | |
| 2165 | ||
| 1451 | 2166 | ROM_START( bigstrik ) |
| 1452 | 2167 | ROM_REGION( 0x80000, "main", 0 ) /* Main CPU Code */ |
| 1453 | 2168 | ROM_LOAD16_BYTE( "91105v11.3", 0x000000, 0x020000, CRC(5d6e08ec) SHA1(4b80a5073cd0b0142cad094816b935d750ac11fb) ) |
| r4135 | r4136 | |
| 1483 | 2198 | ROM_END |
| 1484 | 2199 | |
| 1485 | 2200 | |
| 1486 | static INPUT_PORTS_START( bigstrik ) | |
| 1487 | PORT_START("SYSTEM") | |
| 1488 | COINS | |
| 1489 | ||
| 1490 | PORT_START("P1") | |
| 1491 | JOY_3BUTTONS(1) // pass shoot feint | |
| 1492 | ||
| 1493 | PORT_START("P2") | |
| 1494 | JOY_3BUTTONS(2) | |
| 1495 | RESERVE | |
| 1496 | ||
| 1497 | PORT_START("DSW1") | |
| 1498 | PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) ) | |
| 1499 | PORT_DIPSETTING( 0x0007, DEF_STR( 4C_1C ) ) | |
| 1500 | PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) ) | |
| 1501 | PORT_DIPSETTING( 0x0009, DEF_STR( 2C_1C ) ) | |
| 1502 | PORT_DIPSETTING( 0x000f, DEF_STR( 1C_1C ) ) | |
| 1503 | PORT_DIPSETTING( 0x0005, DEF_STR( 2C_3C ) ) | |
| 1504 | // PORT_DIPSETTING( 0x0004, DEF_STR( 2C_3C ) ) | |
| 1505 | // PORT_DIPSETTING( 0x0003, DEF_STR( 2C_3C ) ) | |
| 1506 | // PORT_DIPSETTING( 0x0002, DEF_STR( 2C_3C ) ) | |
| 1507 | // PORT_DIPSETTING( 0x0001, DEF_STR( 2C_3C ) ) | |
| 1508 | // PORT_DIPSETTING( 0x0006, DEF_STR( 2C_3C ) ) | |
| 1509 | PORT_DIPSETTING( 0x000e, DEF_STR( 1C_2C ) ) | |
| 1510 | PORT_DIPSETTING( 0x000d, DEF_STR( 1C_3C ) ) | |
| 1511 | PORT_DIPSETTING( 0x000c, DEF_STR( 1C_4C ) ) | |
| 1512 | PORT_DIPSETTING( 0x000b, DEF_STR( 1C_5C ) ) | |
| 1513 | PORT_DIPSETTING( 0x000a, DEF_STR( 1C_6C ) ) | |
| 1514 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 1515 | PORT_DIPNAME( 0x00f0, 0x00f0, DEF_STR( Coin_B ) ) | |
| 1516 | PORT_DIPSETTING( 0x0070, DEF_STR( 4C_1C ) ) | |
| 1517 | PORT_DIPSETTING( 0x0080, DEF_STR( 3C_1C ) ) | |
| 1518 | PORT_DIPSETTING( 0x0090, DEF_STR( 2C_1C ) ) | |
| 1519 | PORT_DIPSETTING( 0x00f0, DEF_STR( 1C_1C ) ) | |
| 1520 | PORT_DIPSETTING( 0x0050, DEF_STR( 2C_3C ) ) | |
| 1521 | // PORT_DIPSETTING( 0x0040, DEF_STR( 2C_3C ) ) | |
| 1522 | // PORT_DIPSETTING( 0x0030, DEF_STR( 2C_3C ) ) | |
| 1523 | // PORT_DIPSETTING( 0x0020, DEF_STR( 2C_3C ) ) | |
| 1524 | // PORT_DIPSETTING( 0x0010, DEF_STR( 2C_3C ) ) | |
| 1525 | // PORT_DIPSETTING( 0x0060, DEF_STR( 2C_3C ) ) | |
| 1526 | PORT_DIPSETTING( 0x00e0, DEF_STR( 1C_2C ) ) | |
| 1527 | PORT_DIPSETTING( 0x00d0, DEF_STR( 1C_3C ) ) | |
| 1528 | PORT_DIPSETTING( 0x00c0, DEF_STR( 1C_4C ) ) | |
| 1529 | PORT_DIPSETTING( 0x00b0, DEF_STR( 1C_5C ) ) | |
| 1530 | PORT_DIPSETTING( 0x00a0, DEF_STR( 1C_6C ) ) | |
| 1531 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 1532 | ||
| 1533 | PORT_START("DSW2") | |
| 1534 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) | |
| 1535 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 1536 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1537 | PORT_DIPNAME( 0x0006, 0x0006, DEF_STR( Difficulty ) ) | |
| 1538 | PORT_DIPSETTING( 0x0002, DEF_STR( Easy ) ) | |
| 1539 | PORT_DIPSETTING( 0x0006, DEF_STR( Normal ) ) | |
| 1540 | PORT_DIPSETTING( 0x0004, DEF_STR( Hard ) ) | |
| 1541 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 1542 | PORT_DIPNAME( 0x0018, 0x0018, "Time" ) | |
| 1543 | PORT_DIPSETTING( 0x0000, "Very Short" ) | |
| 1544 | PORT_DIPSETTING( 0x0010, "Short" ) | |
| 1545 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 1546 | PORT_DIPSETTING( 0x0008, "Long" ) | |
| 1547 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) ) | |
| 1548 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 1549 | PORT_DIPSETTING( 0x0020, DEF_STR( On ) ) | |
| 1550 | PORT_DIPNAME( 0x0040, 0x0040, "1 Credit 2 Play" ) | |
| 1551 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 1552 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1553 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) | |
| 1554 | INPUT_PORTS_END | |
| 1555 | ||
| 1556 | ||
| 1557 | 2201 | /*************************************************************************** |
| 1558 | 2202 | |
| 1559 | 2203 | [ Chimera Beast ] |
| r4135 | r4136 | |
| 1566 | 2210 | |
| 1567 | 2211 | ***************************************************************************/ |
| 1568 | 2212 | |
| 2213 | ||
| 1569 | 2214 | ROM_START( chimerab ) |
| 1570 | 2215 | ROM_REGION( 0x80000, "main", 0 ) /* Main CPU Code */ |
| 1571 | 2216 | ROM_LOAD16_BYTE( "prg3.bin", 0x000000, 0x040000, CRC(70f1448f) SHA1(60aaee1cf7aa15ffa4962d947747b0ae7cdcfd8a) ) |
| r4135 | r4136 | |
| 1601 | 2246 | ROM_LOAD( "prom", 0x0000, 0x0200, NO_DUMP ) |
| 1602 | 2247 | ROM_END |
| 1603 | 2248 | |
| 1604 | static INPUT_PORTS_START( chimerab ) | |
| 1605 | PORT_START("SYSTEM") | |
| 1606 | COINS | |
| 1607 | 2249 | |
| 1608 | PORT_START("P1") | |
| 1609 | JOY_2BUTTONS(1) // fire jump unused?(shown in service mode, but not in instructions) | |
| 1610 | ||
| 1611 | PORT_START("P2") | |
| 1612 | JOY_2BUTTONS(2) | |
| 1613 | RESERVE // Unused | |
| 1614 | ||
| 1615 | PORT_START("DSW1") | |
| 1616 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) | |
| 1617 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 1618 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1619 | PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 1620 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 1621 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1622 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Allow_Continue ) ) | |
| 1623 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 1624 | PORT_DIPSETTING( 0x0004, DEF_STR( On ) ) | |
| 1625 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) | |
| 1626 | PORT_DIPSETTING( 0x0010, DEF_STR( Easy ) ) | |
| 1627 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 1628 | PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) ) | |
| 1629 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 1630 | PORT_DIPNAME( 0x0060, 0x0020, DEF_STR( Lives ) ) | |
| 1631 | PORT_DIPSETTING( 0x0040, "1" ) | |
| 1632 | PORT_DIPSETTING( 0x0060, "2" ) | |
| 1633 | PORT_DIPSETTING( 0x0020, "3" ) | |
| 1634 | PORT_DIPSETTING( 0x0000, "4" ) | |
| 1635 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) | |
| 1636 | ||
| 1637 | PORT_START("DSW2") | |
| 1638 | COINAGE_8BITS | |
| 1639 | INPUT_PORTS_END | |
| 1640 | ||
| 1641 | ||
| 1642 | ||
| 1643 | 2250 | /*************************************************************************** |
| 1644 | 2251 | |
| 1645 | 2252 | [ Cybattler ] |
| r4135 | r4136 | |
| 1691 | 2298 | |
| 1692 | 2299 | ***************************************************************************/ |
| 1693 | 2300 | |
| 2301 | ||
| 1694 | 2302 | ROM_START( cybattlr ) |
| 1695 | 2303 | ROM_REGION( 0x80000, "main", 0 ) /* Main CPU Code */ |
| 1696 | 2304 | ROM_LOAD16_BYTE( "cb_03.rom", 0x000000, 0x040000, CRC(bee20587) SHA1(3c1d546c63a3d6f8a63b7dee1c8e99a7091d774d) ) |
| r4135 | r4136 | |
| 1726 | 2334 | ROM_LOAD( "pr-91028.12", 0x0000, 0x0200, CRC(cfe90082) SHA1(b59991ec7b3e83ba645b709547e5b4cbe03c0f11) ) |
| 1727 | 2335 | ROM_END |
| 1728 | 2336 | |
| 1729 | static INPUT_PORTS_START( cybattlr ) | |
| 1730 | PORT_START("SYSTEM") | |
| 1731 | COINS | |
| 1732 | 2337 | |
| 1733 | PORT_START("P1") | |
| 1734 | JOY_2BUTTONS(1) // fire sword | |
| 1735 | ||
| 1736 | PORT_START("P2") | |
| 1737 | JOY_2BUTTONS(2) | |
| 1738 | RESERVE // Unused | |
| 1739 | ||
| 1740 | PORT_START("DSW1") /*1fd2d9.b, !1fd009.b */ | |
| 1741 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) | |
| 1742 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) | |
| 1743 | PORT_DIPSETTING( 0x0001, DEF_STR( 3C_1C ) ) | |
| 1744 | PORT_DIPSETTING( 0x0003, DEF_STR( 2C_1C ) ) | |
| 1745 | PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) | |
| 1746 | PORT_DIPSETTING( 0x0002, DEF_STR( 2C_3C ) ) | |
| 1747 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) | |
| 1748 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) | |
| 1749 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) | |
| 1750 | PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) | |
| 1751 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) | |
| 1752 | PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) ) | |
| 1753 | PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) ) | |
| 1754 | PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) | |
| 1755 | PORT_DIPSETTING( 0x0010, DEF_STR( 2C_3C ) ) | |
| 1756 | PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) | |
| 1757 | PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) | |
| 1758 | PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) | |
| 1759 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) ) | |
| 1760 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 1761 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1762 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) | |
| 1763 | ||
| 1764 | PORT_START("DSW2") /* 1fd2d7.b, !1fd007.b */ | |
| 1765 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) | |
| 1766 | PORT_DIPSETTING( 0x0002, DEF_STR( Easy ) ) | |
| 1767 | PORT_DIPSETTING( 0x0003, DEF_STR( Normal ) ) | |
| 1768 | PORT_DIPSETTING( 0x0001, DEF_STR( Hard ) ) | |
| 1769 | PORT_DIPSETTING( 0x0000, DEF_STR( Very_Hard ) ) | |
| 1770 | PORT_DIPNAME( 0x0004, 0x0004, "Disable Instruction Screen" ) /* Manual states this dip is "Unused" */ | |
| 1771 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 1772 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1773 | PORT_DIPNAME( 0x0018, 0x00018, DEF_STR( Allow_Continue ) ) | |
| 1774 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 1775 | PORT_DIPSETTING( 0x0010, "Up to Mission 4" ) | |
| 1776 | PORT_DIPSETTING( 0x0008, "Not on Final Mission" ) | |
| 1777 | PORT_DIPSETTING( 0x0018, DEF_STR( On ) ) | |
| 1778 | PORT_DIPNAME( 0x0020, 0x0020, "Intro Music" ) | |
| 1779 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 1780 | PORT_DIPSETTING( 0x0020, DEF_STR( On ) ) | |
| 1781 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 1782 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 1783 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1784 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 1785 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 1786 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1787 | INPUT_PORTS_END | |
| 1788 | ||
| 1789 | ||
| 1790 | ||
| 1791 | ||
| 1792 | 2338 | /*************************************************************************** |
| 1793 | 2339 | |
| 1794 | 2340 | [ Earth Defense Force ] |
| r4135 | r4136 | |
| 1812 | 2358 | |
| 1813 | 2359 | ***************************************************************************/ |
| 1814 | 2360 | |
| 2361 | ||
| 1815 | 2362 | ROM_START( edf ) |
| 1816 | 2363 | ROM_REGION( 0xc0000, "main", 0 ) /* Main CPU Code: 00000-3ffff & 80000-bffff */ |
| 1817 | 2364 | ROM_LOAD16_BYTE( "edf5.b5", 0x000000, 0x020000, CRC(105094d1) SHA1(e962164836756bc20c2b5dc0032042a0219e82d8) ) |
| r4135 | r4136 | |
| 1848 | 2395 | ROM_LOAD( "rd.20n", 0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) ) |
| 1849 | 2396 | ROM_END |
| 1850 | 2397 | |
| 2398 | ||
| 1851 | 2399 | ROM_START( edfu ) |
| 1852 | 2400 | ROM_REGION( 0xc0000, "main", 0 ) /* Main CPU Code: 00000-3ffff & 80000-bffff */ |
| 1853 | 2401 | ROM_LOAD16_BYTE( "edf5.b5", 0x000000, 0x020000, CRC(105094d1) SHA1(e962164836756bc20c2b5dc0032042a0219e82d8) ) |
| r4135 | r4136 | |
| 1884 | 2432 | ROM_LOAD( "rd.20n", 0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) ) |
| 1885 | 2433 | ROM_END |
| 1886 | 2434 | |
| 1887 | static INPUT_PORTS_START( edf ) | |
| 1888 | PORT_START("SYSTEM") | |
| 1889 | COINS | |
| 1890 | 2435 | |
| 1891 | PORT_START("P1") | |
| 1892 | JOY_2BUTTONS(1) // fire unfold_weapons | |
| 1893 | ||
| 1894 | PORT_START("P2") | |
| 1895 | JOY_2BUTTONS(2) | |
| 1896 | RESERVE | |
| 1897 | ||
| 1898 | PORT_START("DSW1") | |
| 1899 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) | |
| 1900 | PORT_DIPSETTING( 0x0004, DEF_STR( 3C_1C ) ) | |
| 1901 | PORT_DIPSETTING( 0x0002, DEF_STR( 2C_1C ) ) | |
| 1902 | PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) | |
| 1903 | PORT_DIPSETTING( 0x0003, DEF_STR( 1C_2C ) ) | |
| 1904 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) | |
| 1905 | PORT_DIPSETTING( 0x0001, DEF_STR( 1C_4C ) ) | |
| 1906 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_5C ) ) | |
| 1907 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 1908 | PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) | |
| 1909 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) | |
| 1910 | PORT_DIPSETTING( 0x0020, DEF_STR( 3C_1C ) ) | |
| 1911 | PORT_DIPSETTING( 0x0010, DEF_STR( 2C_1C ) ) | |
| 1912 | PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) | |
| 1913 | PORT_DIPSETTING( 0x0018, DEF_STR( 1C_2C ) ) | |
| 1914 | PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) | |
| 1915 | PORT_DIPSETTING( 0x0008, DEF_STR( 1C_4C ) ) | |
| 1916 | PORT_DIPSETTING( 0x0030, DEF_STR( 1C_5C ) ) | |
| 1917 | PORT_DIPNAME( 0x000040, 0x000040, DEF_STR( Demo_Sounds ) ) | |
| 1918 | PORT_DIPSETTING( 0x000000, DEF_STR( Off ) ) | |
| 1919 | PORT_DIPSETTING( 0x000040, DEF_STR( On ) ) | |
| 1920 | PORT_SERVICE( 0x000080, IP_ACTIVE_LOW ) | |
| 1921 | ||
| 1922 | PORT_START("DSW2") /* 0x66007.b */ | |
| 1923 | PORT_DIPNAME( 0x0007, 0x0007, "DSW-B bits 2-0" ) | |
| 1924 | PORT_DIPSETTING( 0x0000, "0" ) | |
| 1925 | PORT_DIPSETTING( 0x0001, "1" ) | |
| 1926 | PORT_DIPSETTING( 0x0002, "2" ) | |
| 1927 | PORT_DIPSETTING( 0x0003, "3" ) | |
| 1928 | PORT_DIPSETTING( 0x0004, "4" ) | |
| 1929 | PORT_DIPSETTING( 0x0005, "5" ) | |
| 1930 | PORT_DIPSETTING( 0x0006, "6" ) | |
| 1931 | PORT_DIPSETTING( 0x0007, "7" ) | |
| 1932 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Lives ) ) | |
| 1933 | PORT_DIPSETTING( 0x0008, "3" ) | |
| 1934 | PORT_DIPSETTING( 0x0000, "4" ) | |
| 1935 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 1936 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 1937 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 1938 | PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) | |
| 1939 | PORT_DIPSETTING( 0x0020, DEF_STR( Very_Hard ) ) | |
| 1940 | PORT_DIPNAME( 0x0040, 0x0040, "DSW-B bit 6" ) | |
| 1941 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 1942 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1943 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 1944 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 1945 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1946 | INPUT_PORTS_END | |
| 1947 | ||
| 1948 | ||
| 1949 | ||
| 1950 | 2436 | /*************************************************************************** |
| 1951 | 2437 | |
| 1952 | 2438 | [ Hachoo! ] |
| r4135 | r4136 | |
| 2001 | 2487 | ROM_END |
| 2002 | 2488 | |
| 2003 | 2489 | |
| 2004 | static INPUT_PORTS_START( hachoo ) | |
| 2005 | PORT_START("SYSTEM") /* 0x80001.b */ | |
| 2006 | COINS | |
| 2007 | ||
| 2008 | PORT_START("P1") /* 0x80003.b */ | |
| 2009 | JOY_2BUTTONS(1) // fire jump | |
| 2010 | ||
| 2011 | PORT_START("P2") /* 0x80004.b - 0x80005.b */ | |
| 2012 | JOY_2BUTTONS(2) | |
| 2013 | RESERVE | |
| 2014 | ||
| 2015 | PORT_START("DSW") | |
| 2016 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unused ) ) /* Manual states dips 1-4 & 6 are "Unused" */ | |
| 2017 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 2018 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2019 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) ) | |
| 2020 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 2021 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2022 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unused ) ) | |
| 2023 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 2024 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2025 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unused ) ) | |
| 2026 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 2027 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2028 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 2029 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 2030 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) | |
| 2031 | PORT_DIPSETTING( 0x0010, DEF_STR( Harder ) ) | |
| 2032 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 2033 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unused ) ) | |
| 2034 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 2035 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2036 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 2037 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 2038 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2039 | ||
| 2040 | COINAGE_6BITS | |
| 2041 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) | |
| 2042 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 2043 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) | |
| 2044 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unused ) ) | |
| 2045 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 2046 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2047 | INPUT_PORTS_END | |
| 2048 | ||
| 2049 | ||
| 2050 | ||
| 2051 | 2490 | /*************************************************************************** |
| 2052 | 2491 | |
| 2053 | 2492 | Hayaoshi Quiz Ouza Ketteisen |
| r4135 | r4136 | |
| 2085 | 2524 | |
| 2086 | 2525 | ***************************************************************************/ |
| 2087 | 2526 | |
| 2527 | ||
| 2088 | 2528 | ROM_START( hayaosi1 ) |
| 2089 | 2529 | ROM_REGION( 0xc0000, "main", 0 ) /* Main CPU Code: 00000-3ffff & 80000-bffff */ |
| 2090 | 2530 | ROM_LOAD16_BYTE( "5", 0x000000, 0x020000, CRC(eaf38fab) SHA1(0f9cd6e674668a86d2bb54228b50217c934e96af) ) |
| r4135 | r4136 | |
| 2121 | 2561 | ROM_LOAD( "pr-91044", 0x0000, 0x0200, CRC(c69423d6) SHA1(ba9644a9899df2d73a5a16bf7ceef1954c2e25f3) ) |
| 2122 | 2562 | ROM_END |
| 2123 | 2563 | |
| 2124 | static INPUT_PORTS_START( hayaosi1 ) | |
| 2125 | PORT_START("SYSTEM") | |
| 2126 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 ) | |
| 2127 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 ) | |
| 2128 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2129 | PORT_SERVICE_NO_TOGGLE( 0x0008, IP_ACTIVE_LOW ) | |
| 2130 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START3 ) | |
| 2131 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 2132 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 2133 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 2134 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2135 | 2564 | |
| 2136 | PORT_START("P1") | |
| 2137 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 2138 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 2139 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 2140 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 2141 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) | |
| 2142 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) | |
| 2143 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) | |
| 2144 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(3) | |
| 2145 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2146 | ||
| 2147 | PORT_START("P2") | |
| 2148 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) | |
| 2149 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 2150 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) | |
| 2151 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 2152 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3) | |
| 2153 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) | |
| 2154 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) | |
| 2155 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2156 | RESERVE | |
| 2157 | ||
| 2158 | PORT_START("DSW1") | |
| 2159 | COINAGE_8BITS | |
| 2160 | ||
| 2161 | PORT_START("DSW2") /* 0x69353.b */ | |
| 2162 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) | |
| 2163 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 2164 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2165 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) ) | |
| 2166 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 2167 | PORT_DIPSETTING( 0x0002, DEF_STR( On ) ) | |
| 2168 | PORT_DIPNAME( 0x0004, 0x0004, "Unknown 2-2" ) | |
| 2169 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 2170 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2171 | PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) | |
| 2172 | PORT_DIPSETTING( 0x0010, DEF_STR( Easy ) ) | |
| 2173 | PORT_DIPSETTING( 0x0018, DEF_STR( Normal ) ) | |
| 2174 | PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) ) | |
| 2175 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 2176 | PORT_DIPNAME( 0x0020, 0x0020, "Points To Win" ) | |
| 2177 | PORT_DIPSETTING( 0x0000, "10" ) | |
| 2178 | PORT_DIPSETTING( 0x0020, "15" ) | |
| 2179 | PORT_DIPNAME( 0x0040, 0x0040, "Unknown 2-6" ) | |
| 2180 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 2181 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2182 | PORT_DIPNAME( 0x0080, 0x0080, "Unknown 2-7" ) | |
| 2183 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 2184 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2185 | INPUT_PORTS_END | |
| 2186 | ||
| 2187 | ||
| 2188 | ||
| 2189 | 2565 | /*************************************************************************** |
| 2190 | 2566 | |
| 2191 | 2567 | [ Ninja Kazan ] \ [ Iga Ninjyutsuden ] |
| r4135 | r4136 | |
| 2202 | 2578 | |
| 2203 | 2579 | ***************************************************************************/ |
| 2204 | 2580 | |
| 2581 | ||
| 2205 | 2582 | ROM_START( kazan ) |
| 2206 | 2583 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 2207 | 2584 | ROM_LOAD16_BYTE( "kazan.2", 0x000000, 0x020000, CRC(072aa3d6) SHA1(49fd03d72f647dcda140d0a507f23a80911427e1) ) |
| r4135 | r4136 | |
| 2244 | 2621 | ROM_LOAD( "kazan.14m", 0x0000, 0x0200, CRC(85b30ac4) SHA1(b03f577ceb0f26b67453ffa52ef61fea76a93184) ) |
| 2245 | 2622 | ROM_END |
| 2246 | 2623 | |
| 2624 | ||
| 2247 | 2625 | ROM_START( iganinju ) |
| 2248 | 2626 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 2249 | 2627 | ROM_LOAD16_BYTE( "iga_02.bin", 0x000000, 0x020000, CRC(bd00c280) SHA1(d4e074bb25fc7295b1a39aa22e966cf471a6789f) ) |
| r4135 | r4136 | |
| 2278 | 2656 | ROM_END |
| 2279 | 2657 | |
| 2280 | 2658 | |
| 2281 | static INPUT_PORTS_START( kazan ) | |
| 2282 | PORT_START("SYSTEM") /* 0x80001.b */ | |
| 2283 | COINS | |
| 2284 | ||
| 2285 | PORT_START("P1") /* 0x80003.b */ | |
| 2286 | JOY_2BUTTONS(1) // fire jump | |
| 2287 | ||
| 2288 | PORT_START("P2") /* 0x80004.b - 0x80005.b */ | |
| 2289 | JOY_2BUTTONS(2) | |
| 2290 | RESERVE | |
| 2291 | ||
| 2292 | PORT_START("DSW") | |
| 2293 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) | |
| 2294 | PORT_DIPSETTING( 0x0003, "2" ) | |
| 2295 | PORT_DIPSETTING( 0x0001, "3" ) | |
| 2296 | PORT_DIPSETTING( 0x0002, "4" ) | |
| 2297 | PORT_DIPSETTING( 0x0000, "Infinite (Cheat)" ) | |
| 2298 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Bonus_Life ) ) | |
| 2299 | PORT_DIPSETTING( 0x0004, "50k" ) | |
| 2300 | PORT_DIPSETTING( 0x0000, "200k" ) | |
| 2301 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Allow_Continue ) ) | |
| 2302 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 2303 | PORT_DIPSETTING( 0x0008, DEF_STR( On ) ) | |
| 2304 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 2305 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 2306 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) | |
| 2307 | PORT_DIPSETTING( 0x0010, DEF_STR( Harder ) ) | |
| 2308 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 2309 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Cabinet ) ) | |
| 2310 | PORT_DIPSETTING( 0x0000, DEF_STR( Upright ) ) | |
| 2311 | PORT_DIPSETTING( 0x0040, DEF_STR( Cocktail ) ) | |
| 2312 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 2313 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 2314 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2315 | ||
| 2316 | COINAGE_6BITS | |
| 2317 | PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 2318 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 2319 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2320 | PORT_DIPNAME( 0x8000, 0x8000, "Freeze Screen (Cheat)") | |
| 2321 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 2322 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2323 | INPUT_PORTS_END | |
| 2324 | ||
| 2325 | ||
| 2326 | ||
| 2327 | 2659 | /*************************************************************************** |
| 2328 | 2660 | |
| 2329 | 2661 | [ Jitsuryoku!! Pro Yakyuu ] |
| r4135 | r4136 | |
| 2347 | 2679 | |
| 2348 | 2680 | ***************************************************************************/ |
| 2349 | 2681 | |
| 2682 | ||
| 2350 | 2683 | ROM_START( jitsupro ) |
| 2351 | 2684 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 2352 | 2685 | ROM_LOAD16_BYTE( "jp_2.bin", 0x000000, 0x020000, CRC(5d842ff2) SHA1(69032601c0e67c5c78fad1cb2bb4f1b59014fe5a) ) |
| r4135 | r4136 | |
| 2381 | 2714 | ROM_END |
| 2382 | 2715 | |
| 2383 | 2716 | |
| 2384 | static INPUT_PORTS_START( jitsupro ) | |
| 2385 | PORT_START("SYSTEM") /* 0x80001.b */ | |
| 2386 | COINS | |
| 2387 | ||
| 2388 | PORT_START("P1") /* 0x80003.b */ | |
| 2389 | JOY_3BUTTONS(1) // shoot change view change bat | |
| 2390 | ||
| 2391 | PORT_START("P2") /* 0x80004.b - 0x80005.b */ | |
| 2392 | JOY_3BUTTONS(2) | |
| 2393 | RESERVE | |
| 2394 | ||
| 2395 | PORT_START("DSW") | |
| 2396 | PORT_DIPNAME( 0x0001, 0x0001, "2 Player Innings per Credit" ) | |
| 2397 | PORT_DIPSETTING( 0x0001, "2" ) | |
| 2398 | PORT_DIPSETTING( 0x0000, "3" ) | |
| 2399 | PORT_DIPNAME( 0x0002, 0x0002, "Difficulty for Catching Ball" ) | |
| 2400 | PORT_DIPSETTING( 0x0002, DEF_STR( Normal ) ) // $200-140 | |
| 2401 | PORT_DIPSETTING( 0x0000, DEF_STR( Hard ) ) // $400-140 | |
| 2402 | PORT_DIPNAME( 0x003c, 0x003c, "Franchise (Increase Batting Power)" ) | |
| 2403 | PORT_DIPSETTING( 0x003c, DEF_STR( Normal ) ) | |
| 2404 | PORT_DIPSETTING( 0x0038, "G" ) | |
| 2405 | PORT_DIPSETTING( 0x0034, "D" ) | |
| 2406 | PORT_DIPSETTING( 0x0030, "C" ) /* I hope the Japanese Baseball crowd knows what these leagues are ;-) */ | |
| 2407 | PORT_DIPSETTING( 0x002c, "S" ) | |
| 2408 | PORT_DIPSETTING( 0x0028, "W (B)" ) | |
| 2409 | PORT_DIPSETTING( 0x0024, "T" ) | |
| 2410 | PORT_DIPSETTING( 0x0020, "L" ) | |
| 2411 | PORT_DIPSETTING( 0x001c, "Br (Bw)" ) | |
| 2412 | PORT_DIPSETTING( 0x0018, "F" ) | |
| 2413 | PORT_DIPSETTING( 0x0014, "H" ) | |
| 2414 | PORT_DIPSETTING( 0x0010, "O (M)" ) | |
| 2415 | PORT_DIPSETTING( 0x000c, "Bu" ) | |
| 2416 | // PORT_DIPSETTING( 0x0008, "13" ) | |
| 2417 | // PORT_DIPSETTING( 0x0004, "14" ) | |
| 2418 | // PORT_DIPSETTING( 0x0000, "15" ) | |
| 2419 | PORT_DIPNAME( 0x0040, 0x0040, "Scroll Is Based On" ) | |
| 2420 | PORT_DIPSETTING( 0x0040, "Shadow of Baseball" ) | |
| 2421 | PORT_DIPSETTING( 0x0000, "The Baseball Itself" ) | |
| 2422 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 2423 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 2424 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2425 | ||
| 2426 | COINAGE_6BITS | |
| 2427 | PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 2428 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 2429 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2430 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unused ) ) | |
| 2431 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 2432 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2433 | INPUT_PORTS_END | |
| 2434 | ||
| 2435 | ||
| 2436 | ||
| 2437 | 2717 | /*************************************************************************** |
| 2438 | 2718 | |
| 2439 | 2719 | [ Kick Off ] |
| r4135 | r4136 | |
| 2464 | 2744 | |
| 2465 | 2745 | ***************************************************************************/ |
| 2466 | 2746 | |
| 2747 | ||
| 2467 | 2748 | ROM_START( kickoff ) |
| 2468 | 2749 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 2469 | 2750 | ROM_LOAD16_BYTE( "kioff03.rom", 0x000000, 0x010000, CRC(3b01be65) SHA1(110b4e02053073c0315aba1eca8c19afe5fafb33) ) |
| r4135 | r4136 | |
| 2504 | 2785 | ROM_LOAD( "kick.bin", 0x0000, 0x0200, CRC(85b30ac4) SHA1(b03f577ceb0f26b67453ffa52ef61fea76a93184) ) |
| 2505 | 2786 | ROM_END |
| 2506 | 2787 | |
| 2507 | static INPUT_PORTS_START( kickoff ) | |
| 2508 | PORT_START("SYSTEM") /* 0x80001.b -> !f0008/a.w */ | |
| 2509 | COINS | |
| 2510 | 2788 | |
| 2511 | PORT_START("P1") /* 0x80003.b -> !f000c/e.w */ | |
| 2512 | JOY_2BUTTONS(1) // shoot pass | |
| 2513 | ||
| 2514 | PORT_START("P2") /* 0x80004.b --> !f0010/11.w */ | |
| 2515 | JOY_2BUTTONS(2) | |
| 2516 | RESERVE | |
| 2517 | ||
| 2518 | PORT_START("DSW") | |
| 2519 | PORT_DIPNAME( 0x0003, 0x0003, "Time" ) // -> !f0082.w | |
| 2520 | PORT_DIPSETTING( 0x0003, "3'" ) | |
| 2521 | PORT_DIPSETTING( 0x0002, "4'" ) | |
| 2522 | PORT_DIPSETTING( 0x0001, "5'" ) | |
| 2523 | PORT_DIPSETTING( 0x0000, "6'" ) | |
| 2524 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unused ) ) /* Manual states dips 3 & 4 are "Unused" */ | |
| 2525 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 2526 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2527 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unused ) ) | |
| 2528 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 2529 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2530 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 2531 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 2532 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) | |
| 2533 | PORT_DIPSETTING( 0x0010, DEF_STR( Harder ) ) | |
| 2534 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 2535 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Controls ) ) | |
| 2536 | PORT_DIPSETTING( 0x0040, DEF_STR( Trackball ) ) | |
| 2537 | PORT_DIPSETTING( 0x0000, DEF_STR( Joystick ) ) | |
| 2538 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 2539 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 2540 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2541 | ||
| 2542 | PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) ) | |
| 2543 | PORT_DIPSETTING( 0x0100, DEF_STR( 4C_1C ) ) | |
| 2544 | PORT_DIPSETTING( 0x0200, DEF_STR( 3C_1C ) ) | |
| 2545 | PORT_DIPSETTING( 0x0300, DEF_STR( 2C_1C ) ) | |
| 2546 | PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) ) | |
| 2547 | PORT_DIPSETTING( 0x0600, DEF_STR( 1C_2C ) ) | |
| 2548 | PORT_DIPSETTING( 0x0500, DEF_STR( 1C_3C ) ) | |
| 2549 | PORT_DIPSETTING( 0x0400, DEF_STR( 1C_4C ) ) | |
| 2550 | PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) | |
| 2551 | PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unused ) ) | |
| 2552 | PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) | |
| 2553 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2554 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unused ) ) | |
| 2555 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) | |
| 2556 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2557 | PORT_DIPNAME( 0x2000, 0x2000, "Freeze Screen (Cheat)" ) | |
| 2558 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) | |
| 2559 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2560 | PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 2561 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 2562 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2563 | PORT_DIPNAME( 0x8000, 0x8000, "Text" ) | |
| 2564 | PORT_DIPSETTING( 0x8000, DEF_STR( Japanese ) ) | |
| 2565 | PORT_DIPSETTING( 0x0000, DEF_STR( English ) ) // show "Japan Only" warning | |
| 2566 | INPUT_PORTS_END | |
| 2567 | ||
| 2568 | ||
| 2569 | 2789 | /*************************************************************************** |
| 2570 | 2790 | |
| 2571 | 2791 | [ Legend of Makai ] |
| r4135 | r4136 | |
| 2600 | 2820 | ROM_LOAD( "makaiden.10", 0x0100, 0x0100, CRC(e6709c51) SHA1(f5cd4f0454c1a71a5b0006b098f9e76c2d8a27d2) ) |
| 2601 | 2821 | ROM_END |
| 2602 | 2822 | |
| 2823 | ||
| 2603 | 2824 | ROM_START( makaiden ) |
| 2604 | 2825 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 2605 | 2826 | ROM_LOAD16_BYTE( "makaiden.3a", 0x000000, 0x020000, CRC(87cf81d1) SHA1(c4410a86a01c683368dbc3daca61e21931885650) ) |
| r4135 | r4136 | |
| 2622 | 2843 | ROM_LOAD( "makaiden.10", 0x0100, 0x0100, CRC(e6709c51) SHA1(f5cd4f0454c1a71a5b0006b098f9e76c2d8a27d2) ) |
| 2623 | 2844 | ROM_END |
| 2624 | 2845 | |
| 2625 | static INPUT_PORTS_START( lomakai ) | |
| 2626 | PORT_START("SYSTEM") /* 0x80001.b */ | |
| 2627 | COINS | |
| 2628 | 2846 | |
| 2629 | PORT_START("P1") /* 0x80003.b */ | |
| 2630 | JOY_2BUTTONS(1) // fire jump | |
| 2631 | ||
| 2632 | PORT_START("P2") /* 0x80004.b - 0x80005.b */ | |
| 2633 | JOY_2BUTTONS(2) | |
| 2634 | RESERVE | |
| 2635 | ||
| 2636 | PORT_START("DSW") | |
| 2637 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) | |
| 2638 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 2639 | PORT_DIPSETTING( 0x0003, "3" ) | |
| 2640 | PORT_DIPSETTING( 0x0002, "4" ) | |
| 2641 | PORT_DIPSETTING( 0x0001, "5" ) | |
| 2642 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) | |
| 2643 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 2644 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2645 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) | |
| 2646 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 2647 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2648 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) // boss enemy damage bar | |
| 2649 | PORT_DIPSETTING( 0x0030, DEF_STR( Easy ) ) // 6 dots | |
| 2650 | PORT_DIPSETTING( 0x0020, DEF_STR( Normal ) ) // 8 dots | |
| 2651 | PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) // 9 dots | |
| 2652 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) // 12 dots | |
| 2653 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Cabinet ) ) | |
| 2654 | PORT_DIPSETTING( 0x0000, DEF_STR( Upright ) ) | |
| 2655 | PORT_DIPSETTING( 0x0040, DEF_STR( Cocktail ) ) | |
| 2656 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 2657 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 2658 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2659 | ||
| 2660 | COINAGE_6BITS_2 | |
| 2661 | PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 2662 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 2663 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2664 | PORT_DIPNAME( 0x8000, 0x8000, "Invulnerability (Cheat)") | |
| 2665 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 2666 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2667 | INPUT_PORTS_END | |
| 2668 | ||
| 2669 | ||
| 2670 | 2847 | /*************************************************************************** |
| 2671 | 2848 | |
| 2672 | 2849 | [ P - 47 ] |
| r4135 | r4136 | |
| 2803 | 2980 | ROM_LOAD( "p-47.14m", 0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) ) |
| 2804 | 2981 | ROM_END |
| 2805 | 2982 | |
| 2806 | static INPUT_PORTS_START( p47 ) | |
| 2807 | PORT_START("SYSTEM") /* 0x80001.b */ | |
| 2808 | COINS | |
| 2809 | 2983 | |
| 2810 | PORT_START("P1") /* 0x80003.b */ | |
| 2811 | JOY_2BUTTONS(1) // fire bomb | |
| 2812 | ||
| 2813 | PORT_START("P2") /* 0x80004.b - 0x80005.b */ | |
| 2814 | JOY_2BUTTONS(2) | |
| 2815 | RESERVE | |
| 2816 | ||
| 2817 | PORT_START("DSW") | |
| 2818 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) | |
| 2819 | PORT_DIPSETTING( 0x0002, "2" ) | |
| 2820 | PORT_DIPSETTING( 0x0003, "3" ) | |
| 2821 | PORT_DIPSETTING( 0x0001, "4" ) | |
| 2822 | PORT_DIPSETTING( 0x0000, "5" ) | |
| 2823 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unused ) ) /* Manual states dips 3 & 4 are "Unused" */ | |
| 2824 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 2825 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2826 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unused ) ) | |
| 2827 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 2828 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2829 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 2830 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 2831 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 2832 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) | |
| 2833 | PORT_DIPSETTING( 0x0010, DEF_STR( Hardest ) ) | |
| 2834 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unused ) ) /* Manual states this dip is "Unused" */ | |
| 2835 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 2836 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2837 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 2838 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 2839 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2840 | ||
| 2841 | COINAGE_6BITS_2 | |
| 2842 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) | |
| 2843 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 2844 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) | |
| 2845 | PORT_DIPNAME( 0x8000, 0x8000, "Invulnerability (Cheat)") | |
| 2846 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 2847 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 2848 | INPUT_PORTS_END | |
| 2849 | ||
| 2850 | ||
| 2851 | ||
| 2852 | ||
| 2853 | 2984 | /*************************************************************************** |
| 2854 | 2985 | |
| 2855 | 2986 | [ Peek-a-Boo! ] |
| r4135 | r4136 | |
| 2941 | 3072 | |
| 2942 | 3073 | ***************************************************************************/ |
| 2943 | 3074 | |
| 3075 | ||
| 2944 | 3076 | ROM_START( peekaboo ) |
| 2945 | 3077 | ROM_REGION( 0x40000, "main", 0 ) /* 68000 CPU Code */ |
| 2946 | 3078 | ROM_LOAD16_BYTE( "j3", 0x000000, 0x020000, CRC(f5f4cf33) SHA1(f135f2b627347255bb0811e9a4a213e3b447c199) ) |
| r4135 | r4136 | |
| 2969 | 3101 | ROM_LOAD( "priority.69", 0x000000, 0x200, CRC(b40bff56) SHA1(39c95eed79328ef2df754988db83e07909e848f8) ) |
| 2970 | 3102 | ROM_END |
| 2971 | 3103 | |
| 2972 | #define PEEKABOO_PADDLE(_FLAG_) \ | |
| 2973 | PORT_BIT( 0x00ff, 0x0080, IPT_PADDLE ) PORT_PLAYER(_FLAG_) PORT_MINMAX(0x0018,0x00e0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) | |
| 2974 | 3104 | |
| 2975 | static INPUT_PORTS_START( peekaboo ) | |
| 2976 | PORT_START("SYSTEM") | |
| 2977 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN3 ) // called "service" | |
| 2978 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN4 ) // called "test" | |
| 2979 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 2980 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 2981 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START1 ) | |
| 2982 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 ) | |
| 2983 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2984 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2985 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 2986 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 2987 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 2988 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 2989 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON3 ) // called "stage clear" | |
| 2990 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON4 ) // called "option" | |
| 2991 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2992 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2993 | ||
| 2994 | PORT_START("P1") | |
| 2995 | PEEKABOO_PADDLE(1) | |
| 2996 | ||
| 2997 | PORT_START("P2") | |
| 2998 | PEEKABOO_PADDLE(2) PORT_COCKTAIL | |
| 2999 | RESERVE | |
| 3000 | ||
| 3001 | PORT_START("DSW") | |
| 3002 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) // 1f0358<-! | |
| 3003 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 3004 | PORT_DIPSETTING( 0x0003, DEF_STR( Normal ) ) | |
| 3005 | PORT_DIPSETTING( 0x0002, DEF_STR( Hard ) ) | |
| 3006 | PORT_DIPSETTING( 0x0001, DEF_STR( Hardest ) ) | |
| 3007 | PORT_SERVICE( 0x0004, IP_ACTIVE_LOW ) | |
| 3008 | PORT_DIPNAME( 0x0008, 0x0008, "Movement" ) // 1f0392<-! | |
| 3009 | PORT_DIPSETTING( 0x0008, "Paddles" ) | |
| 3010 | PORT_DIPSETTING( 0x0000, "Buttons" ) | |
| 3011 | PORT_DIPNAME( 0x0030, 0x0030, "Nudity" ) // 1f0356<-! | |
| 3012 | PORT_DIPSETTING( 0x0030, "Female and Male (Full)" ) | |
| 3013 | PORT_DIPSETTING( 0x0020, "Female (Full)" ) | |
| 3014 | PORT_DIPSETTING( 0x0010, "Female (Partial)" ) | |
| 3015 | PORT_DIPSETTING( 0x0000, DEF_STR( None ) ) | |
| 3016 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Cabinet ) ) // 1f006a<-! | |
| 3017 | PORT_DIPSETTING( 0x0040, DEF_STR( Upright ) ) | |
| 3018 | PORT_DIPSETTING( 0x0000, DEF_STR( Cocktail ) ) | |
| 3019 | PORT_DIPNAME( 0x0080, 0x0080, "Number of controllers" ) // 1f0074<-! | |
| 3020 | PORT_DIPSETTING( 0x0080, "1" ) | |
| 3021 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 3022 | ||
| 3023 | COINAGE_6BITS_2 | |
| 3024 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) // 1f0354<- | |
| 3025 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 3026 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) | |
| 3027 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Flip_Screen ) ) // 1f0022/6e<-! | |
| 3028 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 3029 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3030 | INPUT_PORTS_END | |
| 3031 | ||
| 3032 | ||
| 3033 | ||
| 3034 | static UINT16 protection_val; | |
| 3035 | ||
| 3036 | /* Read the input ports, through a protection device */ | |
| 3037 | static READ16_HANDLER( protection_peekaboo_r ) | |
| 3038 | { | |
| 3039 | switch (protection_val) | |
| 3040 | { | |
| 3041 | case 0x02: return 0x03; | |
| 3042 | case 0x51: return input_port_read(space->machine, "P1"); | |
| 3043 | case 0x52: return input_port_read(space->machine, "P2"); | |
| 3044 | default: return protection_val; | |
| 3045 | } | |
| 3046 | } | |
| 3047 | ||
| 3048 | static WRITE16_HANDLER( protection_peekaboo_w ) | |
| 3049 | { | |
| 3050 | static int bank; | |
| 3051 | ||
| 3052 | COMBINE_DATA(&protection_val); | |
| 3053 | ||
| 3054 | if ((protection_val & 0x90) == 0x90) | |
| 3055 | { | |
| 3056 | UINT8 *RAM = memory_region(space->machine, "oki1"); | |
| 3057 | int new_bank = (protection_val & 0x7) % 7; | |
| 3058 | ||
| 3059 | if (bank != new_bank) | |
| 3060 | { | |
| 3061 | memcpy(&RAM[0x20000],&RAM[0x40000 + 0x20000*new_bank],0x20000); | |
| 3062 | bank = new_bank; | |
| 3063 | } | |
| 3064 | } | |
| 3065 | ||
| 3066 | cpu_set_input_line(space->machine->cpu[0],4,HOLD_LINE); | |
| 3067 | } | |
| 3068 | ||
| 3069 | ||
| 3070 | 3105 | /*************************************************************************** |
| 3071 | 3106 | |
| 3072 | 3107 | [ Plus Alpha ] |
| r4135 | r4136 | |
| 3078 | 3113 | |
| 3079 | 3114 | ***************************************************************************/ |
| 3080 | 3115 | |
| 3116 | ||
| 3081 | 3117 | ROM_START( plusalph ) |
| 3082 | 3118 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 3083 | 3119 | ROM_LOAD16_BYTE( "pa-rom2.bin", 0x000000, 0x020000, CRC(33244799) SHA1(686fb7fa8a6c25b5aff78bc509f35c69492d7d1e) ) |
| r4135 | r4136 | |
| 3122 | 3158 | ROM_LOAD( "prom.14m", 0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) ) |
| 3123 | 3159 | ROM_END |
| 3124 | 3160 | |
| 3125 | static INPUT_PORTS_START( plusalph ) | |
| 3126 | PORT_START("SYSTEM") /* 0x80001.b */ | |
| 3127 | COINS | |
| 3128 | 3161 | |
| 3129 | PORT_START("P1") /* 0x80003.b */ | |
| 3130 | JOY_2BUTTONS(1) // fire bomb | |
| 3131 | ||
| 3132 | PORT_START("P2") /* 0x80004.b - 0x80005.b */ | |
| 3133 | JOY_2BUTTONS(2) | |
| 3134 | RESERVE | |
| 3135 | ||
| 3136 | PORT_START("DSW") | |
| 3137 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) | |
| 3138 | PORT_DIPSETTING( 0x0003, "3" ) | |
| 3139 | PORT_DIPSETTING( 0x0002, "4" ) | |
| 3140 | PORT_DIPSETTING( 0x0001, "5" ) | |
| 3141 | PORT_DIPSETTING( 0x0000, "Infinite (Cheat)" ) | |
| 3142 | PORT_DIPNAME( 0x0004, 0x0004, "Hyper Laser Beams" ) | |
| 3143 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 3144 | PORT_DIPSETTING( 0x0004, "3" ) | |
| 3145 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Bonus_Life ) ) | |
| 3146 | PORT_DIPSETTING( 0x0008, "70k and every 200k") /* As stated in manual, but was 70K & Every 130K */ | |
| 3147 | PORT_DIPSETTING( 0x0000, "100k and 300k Only") /* As stated in manual, but was 100K & Every 200K */ | |
| 3148 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 3149 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 3150 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 3151 | PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) | |
| 3152 | PORT_DIPSETTING( 0x0020, DEF_STR( Hardest ) ) | |
| 3153 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Cabinet ) ) | |
| 3154 | PORT_DIPSETTING( 0x0000, DEF_STR( Upright ) ) | |
| 3155 | PORT_DIPSETTING( 0x0040, DEF_STR( Cocktail ) ) | |
| 3156 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 3157 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 3158 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3159 | ||
| 3160 | COINAGE_6BITS | |
| 3161 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) | |
| 3162 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 3163 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) | |
| 3164 | PORT_DIPNAME( 0x8000, 0x8000, "Freeze Screen (Cheat)") | |
| 3165 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 3166 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3167 | INPUT_PORTS_END | |
| 3168 | ||
| 3169 | ||
| 3170 | 3162 | /*************************************************************************** |
| 3171 | 3163 | |
| 3172 | 3164 | [ RodLand ] |
| r4135 | r4136 | |
| 3198 | 3190 | |
| 3199 | 3191 | ***************************************************************************/ |
| 3200 | 3192 | |
| 3193 | ||
| 3201 | 3194 | ROM_START( rodland ) |
| 3202 | 3195 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 3203 | 3196 | ROM_LOAD16_BYTE( "rl_02.rom", 0x000000, 0x020000, CRC(c7e00593) SHA1(055b7bcabf90ed6d5edc2797d0f85a5d49b8693b) ) |
| r4135 | r4136 | |
| 3236 | 3229 | ROM_LOAD( "rl.bin", 0x0000, 0x0200, CRC(8914e72d) SHA1(80a664471f14c8ed8544a5e226fdca425ab3c657) ) |
| 3237 | 3230 | ROM_END |
| 3238 | 3231 | |
| 3232 | ||
| 3239 | 3233 | ROM_START( rodlandj ) |
| 3240 | 3234 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 3241 | 3235 | ROM_LOAD16_BYTE( "rl_2.bin", 0x000000, 0x020000, CRC(b1d2047e) SHA1(75d282b7614c5f4b76ab44e34fea9e87ab8b992c) ) |
| r4135 | r4136 | |
| 3313 | 3307 | ROM_END |
| 3314 | 3308 | |
| 3315 | 3309 | |
| 3316 | static INPUT_PORTS_START( rodland ) | |
| 3317 | PORT_START("SYSTEM") /* 0x80001.b */ | |
| 3318 | COINS | |
| 3319 | ||
| 3320 | PORT_START("P1") /* 0x80003.b */ | |
| 3321 | JOY_2BUTTONS(1) // fire ladder | |
| 3322 | ||
| 3323 | PORT_START("P2") /* 0x80004.b - 0x80005.b */ | |
| 3324 | JOY_2BUTTONS(2) | |
| 3325 | RESERVE | |
| 3326 | ||
| 3327 | PORT_START("DSW") | |
| 3328 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unused ) ) /* according to manual */ | |
| 3329 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 3330 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3331 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) ) /* according to manual */ | |
| 3332 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 3333 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3334 | PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Lives ) ) | |
| 3335 | PORT_DIPSETTING( 0x0004, "2" ) | |
| 3336 | PORT_DIPSETTING( 0x000c, "3" ) | |
| 3337 | PORT_DIPSETTING( 0x0008, "4" ) | |
| 3338 | PORT_DIPSETTING( 0x0000, "Infinite (Cheat)") | |
| 3339 | PORT_DIPNAME( 0x0010, 0x0010, "Default episode" ) | |
| 3340 | PORT_DIPSETTING( 0x0010, "1" ) | |
| 3341 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 3342 | PORT_DIPNAME( 0x0060, 0x0060, DEF_STR( Difficulty ) ) | |
| 3343 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 3344 | PORT_DIPSETTING( 0x0060, DEF_STR( Normal ) ) | |
| 3345 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) | |
| 3346 | PORT_DIPSETTING( 0x0040, DEF_STR( Hardest ) ) | |
| 3347 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 3348 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 3349 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3350 | ||
| 3351 | COINAGE_6BITS | |
| 3352 | PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 3353 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 3354 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3355 | PORT_SERVICE( 0x8000, IP_ACTIVE_LOW ) | |
| 3356 | INPUT_PORTS_END | |
| 3357 | ||
| 3358 | ||
| 3359 | 3310 | /*************************************************************************** |
| 3360 | 3311 | |
| 3361 | 3312 | [ Saint Dragon ] |
| r4135 | r4136 | |
| 3366 | 3317 | |
| 3367 | 3318 | ***************************************************************************/ |
| 3368 | 3319 | |
| 3320 | ||
| 3369 | 3321 | ROM_START( stdragon ) |
| 3370 | 3322 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 3371 | 3323 | ROM_LOAD16_BYTE( "jsd-02.bin", 0x000000, 0x020000, CRC(cc29ab19) SHA1(e145eeb01fad313e300f0c614c0e7a5c1d75d7d9) ) |
| r4135 | r4136 | |
| 3408 | 3360 | ROM_LOAD( "prom.14m", 0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) ) |
| 3409 | 3361 | ROM_END |
| 3410 | 3362 | |
| 3411 | static INPUT_PORTS_START( stdragon ) | |
| 3412 | PORT_START("SYSTEM") /* 0x80001.b */ | |
| 3413 | COINS | |
| 3414 | 3363 | |
| 3415 | PORT_START("P1") /* 0x80003.b */ | |
| 3416 | JOY_2BUTTONS(1) // fire fire | |
| 3417 | ||
| 3418 | PORT_START("P2") /* 0x80004.b - 0x80005.b */ | |
| 3419 | JOY_2BUTTONS(2) | |
| 3420 | RESERVE | |
| 3421 | ||
| 3422 | PORT_START("DSW") | |
| 3423 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) | |
| 3424 | PORT_DIPSETTING( 0x0002, "2" ) | |
| 3425 | PORT_DIPSETTING( 0x0003, "3" ) | |
| 3426 | PORT_DIPSETTING( 0x0001, "4" ) | |
| 3427 | PORT_DIPSETTING( 0x0000, "5" ) | |
| 3428 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unused ) ) /* Manual states dips 3 & 4 are "Unused" */ | |
| 3429 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 3430 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3431 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unused ) ) | |
| 3432 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 3433 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3434 | PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) | |
| 3435 | PORT_DIPSETTING( 0x0030, DEF_STR( Easy ) ) | |
| 3436 | PORT_DIPSETTING( 0x0020, DEF_STR( Normal ) ) | |
| 3437 | PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) | |
| 3438 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 3439 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Cabinet ) ) | |
| 3440 | PORT_DIPSETTING( 0x0000, DEF_STR( Upright ) ) | |
| 3441 | PORT_DIPSETTING( 0x0040, DEF_STR( Cocktail ) ) | |
| 3442 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 3443 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 3444 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3445 | ||
| 3446 | COINAGE_6BITS_2 | |
| 3447 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) | |
| 3448 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 3449 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) | |
| 3450 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unused ) ) // used? | |
| 3451 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 3452 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3453 | INPUT_PORTS_END | |
| 3454 | ||
| 3455 | ||
| 3456 | ||
| 3457 | ||
| 3458 | 3364 | /*************************************************************************** |
| 3459 | 3365 | |
| 3460 | 3366 | [ Soldam ] |
| r4135 | r4136 | |
| 3467 | 3373 | |
| 3468 | 3374 | ***************************************************************************/ |
| 3469 | 3375 | |
| 3376 | ||
| 3470 | 3377 | ROM_START( soldam ) |
| 3471 | 3378 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 3472 | 3379 | ROM_LOAD16_BYTE( "2ver1j.bin",0x000000, 0x020000, CRC(45444b07) SHA1(d991dd52904671fbd8cfcfe07c956d9fd45b3470) ) |
| r4135 | r4136 | |
| 3534 | 3441 | ROM_LOAD( "pr-91023.m14", 0x0000, 0x0200, CRC(8914e72d) SHA1(80a664471f14c8ed8544a5e226fdca425ab3c657) ) |
| 3535 | 3442 | ROM_END |
| 3536 | 3443 | |
| 3537 | static INPUT_PORTS_START( soldamj ) | |
| 3538 | PORT_START("SYSTEM") /* 0x80001.b */ | |
| 3539 | COINS | |
| 3540 | 3444 | |
| 3541 | PORT_START("P1") /* 0x80003.b */ | |
| 3542 | JOY_2BUTTONS(1) // turn turn (3rd button is shown in service mode, but seems unused) | |
| 3543 | ||
| 3544 | PORT_START("P2") /* 0x80004.b - 0x80005.b */ | |
| 3545 | JOY_2BUTTONS(2) | |
| 3546 | RESERVE | |
| 3547 | ||
| 3548 | PORT_START("DSW") | |
| 3549 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) | |
| 3550 | PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) ) | |
| 3551 | PORT_DIPSETTING( 0x0003, DEF_STR( Normal ) ) | |
| 3552 | PORT_DIPSETTING( 0x0002, DEF_STR( Hard ) ) | |
| 3553 | PORT_DIPSETTING( 0x0001, DEF_STR( Hardest )) | |
| 3554 | PORT_DIPNAME( 0x000c, 0x000c, "Games To Play (Vs)" ) | |
| 3555 | PORT_DIPSETTING( 0x0000, "1" ) | |
| 3556 | PORT_DIPSETTING( 0x000c, "2" ) | |
| 3557 | PORT_DIPSETTING( 0x0008, "3" ) | |
| 3558 | PORT_DIPSETTING( 0x0004, "4" ) | |
| 3559 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Allow_Continue ) ) | |
| 3560 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 3561 | PORT_DIPSETTING( 0x0010, DEF_STR( On ) ) | |
| 3562 | PORT_DIPNAME( 0x0020, 0x0020, "Credits To Start (Vs)" ) | |
| 3563 | PORT_DIPSETTING( 0x0020, "1" ) | |
| 3564 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 3565 | PORT_DIPNAME( 0x0040, 0x0040, "Credits To Continue (Vs)" ) | |
| 3566 | PORT_DIPSETTING( 0x0040, "1" ) | |
| 3567 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 3568 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 3569 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 3570 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3571 | ||
| 3572 | COINAGE_6BITS_2 | |
| 3573 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) | |
| 3574 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 3575 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) | |
| 3576 | PORT_SERVICE( 0x8000, IP_ACTIVE_LOW ) | |
| 3577 | INPUT_PORTS_END | |
| 3578 | ||
| 3579 | static READ16_HANDLER( soldamj_spriteram16_r ) | |
| 3580 | { | |
| 3581 | return spriteram16[offset]; | |
| 3582 | } | |
| 3583 | static WRITE16_HANDLER( soldamj_spriteram16_w ) | |
| 3584 | { | |
| 3585 | if (offset < 0x800/2) COMBINE_DATA(&spriteram16[offset]); | |
| 3586 | } | |
| 3587 | ||
| 3588 | ||
| 3589 | ||
| 3590 | 3445 | /*************************************************************************** |
| 3591 | 3446 | |
| 3592 | 3447 | [ Takeda Shingen ] |
| 3593 | 3448 | |
| 3594 | 3449 | ***************************************************************************/ |
| 3595 | 3450 | |
| 3596 | ROM_START( tshingen ) | |
| 3451 | ||
| 3452 | ROM_START( tshingna ) | |
| 3597 | 3453 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 3598 | 3454 | ROM_LOAD16_BYTE( "takeda2.bin", 0x000000, 0x020000, CRC(6ddfc9f3) SHA1(0ce1b8eae31453db0b2081717d7dbda9ea7d5a60) ) |
| 3599 | 3455 | ROM_LOAD16_BYTE( "takeda1.bin", 0x000001, 0x020000, CRC(1afc6b7d) SHA1(b56da1b8c5b417a88a2952491c2d5472bb783945) ) |
| r4135 | r4136 | |
| 3632 | 3488 | ROM_LOAD( "ts.bpr", 0x0000, 0x0200, CRC(85b30ac4) SHA1(b03f577ceb0f26b67453ffa52ef61fea76a93184) ) |
| 3633 | 3489 | ROM_END |
| 3634 | 3490 | |
| 3635 | ROM_START( tshingna ) | |
| 3491 | ||
| 3492 | ROM_START( tshingen ) | |
| 3636 | 3493 | ROM_REGION( 0x60000, "main", 0 ) /* Main CPU Code */ |
| 3637 | 3494 | ROM_LOAD16_BYTE( "shing_02.rom", 0x000000, 0x020000, CRC(d9ab5b78) SHA1(c7622ec11a636dc7a6bcad02556a98aa0a9fb043) ) |
| 3638 | 3495 | ROM_LOAD16_BYTE( "shing_01.rom", 0x000001, 0x020000, CRC(a9d2de20) SHA1(b53205722ae19305a1c373abbbac4fbcbcb0b0f0) ) |
| r4135 | r4136 | |
| 3671 | 3528 | ROM_LOAD( "ts.bpr", 0x0000, 0x0200, CRC(85b30ac4) SHA1(b03f577ceb0f26b67453ffa52ef61fea76a93184) ) |
| 3672 | 3529 | ROM_END |
| 3673 | 3530 | |
| 3674 | static INPUT_PORTS_START( tshingen ) | |
| 3675 | PORT_START("SYSTEM") /* 0x80001.b */ | |
| 3676 | COINS | |
| 3677 | 3531 | |
| 3678 | PORT_START("P1") /* 0x80003.b */ | |
| 3679 | JOY_3BUTTONS(1) // sword_left sword_right jump | |
| 3532 | /************************************* | |
| 3533 | * | |
| 3534 | * Code Decryption | |
| 3535 | * | |
| 3536 | *************************************/ | |
| 3680 | 3537 | |
| 3681 | PORT_START("P2") /* 0x80004.b - 0x80005.b */ | |
| 3682 | JOY_3BUTTONS(2) | |
| 3683 | RESERVE | |
| 3684 | ||
| 3685 | PORT_START("DSW") | |
| 3686 | PORT_DIPNAME( 0x0003, 0x0001, DEF_STR( Lives ) ) | |
| 3687 | PORT_DIPSETTING( 0x0003, "2" ) | |
| 3688 | PORT_DIPSETTING( 0x0001, "3" ) | |
| 3689 | PORT_DIPSETTING( 0x0002, "4" ) | |
| 3690 | PORT_DIPSETTING( 0x0000, "Infinite (Cheat)" ) | |
| 3691 | PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Bonus_Life ) ) | |
| 3692 | PORT_DIPSETTING( 0x000c, "20k" ) | |
| 3693 | PORT_DIPSETTING( 0x0004, "30k" ) | |
| 3694 | PORT_DIPSETTING( 0x0008, "40k" ) | |
| 3695 | PORT_DIPSETTING( 0x0000, "50k" ) | |
| 3696 | PORT_DIPNAME( 0x0030, 0x0010, DEF_STR( Difficulty ) ) // damage when hit | |
| 3697 | PORT_DIPSETTING( 0x0030, DEF_STR( Easy ) ) // 0 | |
| 3698 | PORT_DIPSETTING( 0x0010, DEF_STR( Normal ) ) // 1 | |
| 3699 | PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) // 2 | |
| 3700 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) // 3 | |
| 3701 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Allow_Continue ) ) | |
| 3702 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 3703 | PORT_DIPSETTING( 0x0040, DEF_STR( On ) ) | |
| 3704 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) | |
| 3705 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 3706 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 3707 | ||
| 3708 | COINAGE_6BITS | |
| 3709 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) | |
| 3710 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 3711 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) | |
| 3712 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unused ) ) | |
| 3713 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 3714 | PORT_DIPSETTING( 0x8000, DEF_STR( On ) ) | |
| 3715 | INPUT_PORTS_END | |
| 3716 | ||
| 3717 | ||
| 3718 | ||
| 3719 | ||
| 3720 | /*************************************************************************** | |
| 3721 | ||
| 3722 | Code Decryption | |
| 3723 | ||
| 3724 | ***************************************************************************/ | |
| 3725 | ||
| 3726 | 3538 | void phantasm_rom_decode(running_machine *machine, const char *region) |
| 3727 | 3539 | { |
| 3728 | 3540 | UINT16 *RAM = (UINT16 *) memory_region(machine, region); |
| r4135 | r4136 | |
| 3885 | 3697 | free(buffer); |
| 3886 | 3698 | } |
| 3887 | 3699 | |
| 3700 | /************************************* | |
| 3701 | * | |
| 3702 | * Game-specific driver inits | |
| 3703 | * | |
| 3704 | *************************************/ | |
| 3888 | 3705 | |
| 3889 | ||
| 3890 | ||
| 3891 | 3706 | static DRIVER_INIT( 64street ) |
| 3892 | 3707 | { |
| 3893 | 3708 | // UINT16 *RAM = (UINT16 *) memory_region(machine, "main"); |
| r4135 | r4136 | |
| 4055 | 3870 | astyanax_rom_decode(machine, "main"); |
| 4056 | 3871 | } |
| 4057 | 3872 | |
| 3873 | static READ16_HANDLER( soldamj_spriteram16_r ) | |
| 3874 | { | |
| 3875 | return spriteram16[offset]; | |
| 3876 | } | |
| 3877 | static WRITE16_HANDLER( soldamj_spriteram16_w ) | |
| 3878 | { | |
| 3879 | if (offset < 0x800/2) COMBINE_DATA(&spriteram16[offset]); | |
| 3880 | } | |
| 3881 | ||
| 4058 | 3882 | static DRIVER_INIT( soldamj ) |
| 4059 | 3883 | { |
| 4060 | 3884 | astyanax_rom_decode(machine, "main"); |
| r4135 | r4136 | |
| 4098 | 3922 | |
| 4099 | 3923 | } |
| 4100 | 3924 | |
| 3925 | /************************************* | |
| 3926 | * | |
| 3927 | * Game driver(s) | |
| 3928 | * | |
| 3929 | *************************************/ | |
| 4101 | 3930 | |
| 4102 | ||
| 4103 | 3931 | GAME( 1988, lomakai, 0, system_Z, lomakai, 0, ROT0, "Jaleco", "Legend of Makai (World)", 0 ) |
| 4104 | 3932 | GAME( 1988, makaiden, lomakai, system_Z, lomakai, 0, ROT0, "Jaleco", "Makai Densetsu (Japan)", 0 ) |
| 4105 | 3933 | GAME( 1988, p47, 0, system_A, p47, 0, ROT0, "Jaleco", "P-47 - The Phantom Fighter (World)", 0 ) |
| 4106 | 3934 | GAME( 1988, p47j, p47, system_A, p47, 0, ROT0, "Jaleco", "P-47 - The Freedom Fighter (Japan)", 0 ) |
| 4107 | 3935 | GAME( 1988, kickoff, 0, system_A, kickoff, 0, ROT0, "Jaleco", "Kick Off (Japan)", 0 ) |
| 4108 | GAME( 1988, tshingen, 0, system_A, tshingen, phantasm, ROT0, "Jaleco", "Takeda Shingen (Japan, Japanese)", 0 ) | |
| 4109 | GAME( 1988, tshingna, tshingen, system_A, tshingen, phantasm, ROT0, "Jaleco", "Shingen Samurai-Fighter (Japan, English)", 0 ) | |
| 3936 | GAME( 1988, tshingen, 0, system_A, tshingen, phantasm, ROT0, "Jaleco", "Shingen Samurai-Fighter (Japan, English)", 0 ) | |
| 3937 | GAME( 1988, tshingna, tshingen, system_A, tshingen, phantasm, ROT0, "Jaleco", "Takeda Shingen (Japan, Japanese)", 0 ) | |
| 4110 | 3938 | GAME( 1988, kazan, 0, system_A, kazan, iganinju, ROT0, "Jaleco", "Ninja Kazan (World)", 0 ) |
| 4111 | 3939 | GAME( 1988, iganinju, kazan, system_A, kazan, iganinju, ROT0, "Jaleco", "Iga Ninjyutsuden (Japan)", 0 ) |
| 4112 | 3940 | GAME( 1989, astyanax, 0, system_A, astyanax, astyanax, ROT0, "Jaleco", "The Astyanax", 0 ) |
| r4135 | r4136 | |
| 4125 | 3953 | GAME( 1991, edfu, edf, system_B, edf, edf, ROT0, "Jaleco", "E.D.F. : Earth Defense Force (North America)", 0 ) |
| 4126 | 3954 | GAME( 1991, 64street, 0, system_C, 64street, 64street, ROT0, "Jaleco", "64th. Street - A Detective Story (World)", 0 ) |
| 4127 | 3955 | GAME( 1991, 64streej, 64street, system_C, 64street, 64street, ROT0, "Jaleco", "64th. Street - A Detective Story (Japan)", 0 ) |
| 4128 | GAME( 1992, soldam, 0, system_A, soldamj, soldam, ROT0, "Jaleco", "Soldam", 0 ) | |
| 4129 | GAME( 1992, soldamj, soldam, system_A, soldamj, soldamj, ROT0, "Jaleco", "Soldam (Japan)", 0 ) | |
| 3956 | GAME( 1992, soldam, 0, system_A, soldam, soldam, ROT0, "Jaleco", "Soldam", 0 ) | |
| 3957 | GAME( 1992, soldamj, soldam, system_A, soldam, soldamj, ROT0, "Jaleco", "Soldam (Japan)", 0 ) | |
| 4130 | 3958 | GAME( 1992, bigstrik, 0, system_C, bigstrik, bigstrik, ROT0, "Jaleco", "Big Striker", 0 ) |
| 4131 | 3959 | GAME( 1993, chimerab, 0, system_C, chimerab, chimerab, ROT0, "Jaleco", "Chimera Beast (prototype)", 0 ) |
| 4132 | 3960 | GAME( 1993, cybattlr, 0, system_C, cybattlr, cybattlr, ROT90, "Jaleco", "Cybattler", 0 ) |
| r4135 | r4136 | |
|---|---|---|
| 589 | 589 | |
| 590 | 590 | /* Machine Initialization */ |
| 591 | 591 | |
| 592 | static MACHINE_START( airbustr ) | |
| 593 | { | |
| 594 | state_save_register_global(machine, soundlatch_status); | |
| 595 | state_save_register_global(machine, soundlatch2_status); | |
| 596 | state_save_register_global(machine, master_addr); | |
| 597 | state_save_register_global(machine, slave_addr); | |
| 598 | } | |
| 599 | ||
| 592 | 600 | static MACHINE_RESET( airbustr ) |
| 593 | 601 | { |
| 594 | 602 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| r4135 | r4136 | |
| 621 | 629 | |
| 622 | 630 | MDRV_QUANTUM_TIME(HZ(6000)) // Palette RAM is filled by sub cpu with data supplied by main cpu |
| 623 | 631 | // Maybe a high value is safer in order to avoid glitches |
| 632 | MDRV_MACHINE_START(airbustr) | |
| 624 | 633 | MDRV_MACHINE_RESET(airbustr) |
| 625 | 634 | MDRV_WATCHDOG_TIME_INIT(SEC(3)) /* a guess, and certainly wrong */ |
| 626 | 635 | |
| r4135 | r4136 | |
| 768 | 777 | |
| 769 | 778 | /* Game Drivers */ |
| 770 | 779 | |
| 771 | GAME( 1990, airbustr, 0, airbustr, airbustr, airbustr, ROT0, "Kaneko (Namco license)", "Air Buster: Trouble Specialty Raid Unit (World)" , 0) // 891220 | |
| 772 | GAME( 1990, airbustj, airbustr, airbustr, airbustj, airbustr, ROT0, "Kaneko (Namco license)", "Air Buster: Trouble Specialty Raid Unit (Japan)" , 0) // 891229 | |
| 773 | GAME( 1990, airbusb, airbustr, airbusb, airbustj, 0, ROT0, "bootleg", "Air Buster: Trouble Specialty Raid Unit (bootleg)" , 0) // based on Japan set (891229) | |
| 780 | GAME( 1990, airbustr, 0, airbustr, airbustr, airbustr, ROT0, "Kaneko (Namco license)", "Air Buster: Trouble Specialty Raid Unit (World)", GAME_SUPPORTS_SAVE ) // 891220 | |
| 781 | GAME( 1990, airbustj, airbustr, airbustr, airbustj, airbustr, ROT0, "Kaneko (Namco license)", "Air Buster: Trouble Specialty Raid Unit (Japan)", GAME_SUPPORTS_SAVE) // 891229 | |
| 782 | GAME( 1990, airbusb, airbustr, airbusb, airbustj, 0, ROT0, "bootleg", "Air Buster: Trouble Specialty Raid Unit (bootleg)", GAME_SUPPORTS_SAVE) // based on Japan set (891229) |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | static UINT16* parentj_video; |
| 12 | 12 | |
| 13 | VIDEO_START(parentj) | |
| 13 | static VIDEO_START(parentj) | |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | VIDEO_UPDATE(parentj) | |
| 19 | static VIDEO_UPDATE(parentj) | |
| 20 | 20 | { |
| 21 | 21 | const gfx_element *gfx = screen->machine->gfx[0]; |
| 22 | 22 | int count = 0x0c000/2; |
| r4135 | r4136 | |
|---|---|---|
| 72 | 72 | #include "sound/nile.h" |
| 73 | 73 | |
| 74 | 74 | static UINT16* tileram; |
| 75 | static UINT8* dirty_tileram; | |
| 76 | 75 | static UINT16* dmaram; |
| 77 | 76 | |
| 78 | 77 | static UINT16 *sprram, *sprram_old; |
| r4135 | r4136 | |
| 127 | 126 | |
| 128 | 127 | static VIDEO_START(srmp6) |
| 129 | 128 | { |
| 130 | /* create the char set (gfx will then be updated dynamically from RAM) */ | |
| 131 | machine->gfx[0] = allocgfx(machine, &tiles8x8_layout); | |
| 132 | machine->gfx[0]->total_colors = machine->config->total_colors / 256; | |
| 133 | machine->gfx[0]->color_granularity=256; | |
| 134 | ||
| 135 | 129 | tileram = auto_malloc(0x100000*16); |
| 136 | dirty_tileram = auto_malloc((0x100000*16)/0x40); // every 8x8x8 tile is 0x40 bytes | |
| 137 | ||
| 138 | 130 | memset(tileram,0x00,(0x100000*16)); |
| 139 | memset(dirty_tileram,1,(0x100000*16)/0x40); | |
| 140 | 131 | |
| 141 | 132 | dmaram = auto_malloc(0x100); |
| 142 | 133 | |
| 143 | 134 | sprram_old = auto_malloc(0x80000); |
| 144 | 135 | memset(sprram_old, 0, 0x80000); |
| 145 | 136 | |
| 137 | /* create the char set (gfx will then be updated dynamically from RAM) */ | |
| 138 | machine->gfx[0] = gfx_element_alloc(machine, &tiles8x8_layout, (UINT8*)tileram, machine->config->total_colors / 256, 0); | |
| 139 | machine->gfx[0]->color_granularity=256; | |
| 140 | ||
| 146 | 141 | brightness = 0x60; |
| 147 | 142 | } |
| 148 | 143 | |
| 149 | /* Debug code */ | |
| 150 | #ifdef UNUSED_FUNCTION | |
| 151 | static void srmp6_decode_charram(running_machine *machine) | |
| 152 | { | |
| 153 | if(input_code_pressed_once(KEYCODE_Z)) | |
| 154 | { | |
| 155 | int i; | |
| 156 | for (i=0;i<(0x100000*16)/0x40;i++) | |
| 157 | { | |
| 158 | decodechar(machine->gfx[0], i, (UINT8*)tileram); | |
| 159 | dirty_tileram[i] = 0; | |
| 160 | } | |
| 161 | } | |
| 162 | } | |
| 163 | #endif | |
| 164 | ||
| 165 | 144 | #if 0 |
| 166 | 145 | static int xixi=0; |
| 167 | 146 | #endif |
| 168 | 147 | |
| 169 | 148 | static VIDEO_UPDATE(srmp6) |
| 170 | 149 | { |
| 171 | int | |
| 150 | int | |
| 172 | 151 | int x,y,tileno,height,width,xw,yw,sprite,xb,yb; |
| 173 | 152 | UINT16 *sprite_list=sprram_old; |
| 174 | 153 | UINT16 mainlist_offset = 0; |
| r4135 | r4136 | |
| 183 | 162 | |
| 184 | 163 | #if 0 |
| 185 | 164 | /* debug */ |
| 186 | srmp6_decode_charram(screen->machine); | |
| 187 | ||
| 188 | ||
| 189 | ||
| 190 | /* debug */ | |
| 191 | 165 | if(input_code_pressed_once(KEYCODE_Q)) |
| 192 | 166 | { |
| 193 | 167 | ++xixi; |
| r4135 | r4136 | |
| 226 | 200 | |
| 227 | 201 | if((sprite_list[mainlist_offset+5] & 0x700) == 0x700) |
| 228 | 202 | { |
| 229 | trans = TRANSPARENCY_ALPHA; | |
| 230 | alpha_set_level((sprite_list[mainlist_offset+5] & 0x1F) << 3); | |
| 203 | alpha = (sprite_list[mainlist_offset+5] & 0x1F) << 3; | |
| 231 | 204 | } |
| 232 | 205 | else |
| 233 | 206 | { |
| 234 | trans = TRANSPARENCY_PEN; | |
| 235 | alpha_set_level(255); | |
| 207 | alpha = 255; | |
| 236 | 208 | } |
| 237 | 209 | // printf("%x %x \n",sprite_list[mainlist_offset+1],sublist_length); |
| 238 | 210 | |
| r4135 | r4136 | |
| 273 | 245 | else |
| 274 | 246 | yb=y+(height-yw-1)*8+global_y; |
| 275 | 247 | |
| 276 | if (dirty_tileram[tileno]) | |
| 277 | { | |
| 278 | decodechar(screen->machine->gfx[0], tileno, (UINT8*)tileram); | |
| 279 | dirty_tileram[tileno] = 0; | |
| 280 | } | |
| 281 | ||
| 282 | drawgfx(bitmap,screen->machine->gfx[0],tileno,global_pal,flip_x,flip_y,xb,yb,cliprect,trans,0); | |
| 248 | drawgfx_alpha(bitmap,cliprect,screen->machine->gfx[0],tileno,global_pal,flip_x,flip_y,xb,yb,0,alpha); | |
| 283 | 249 | tileno++; |
| 284 | 250 | } |
| 285 | 251 | } |
| r4135 | r4136 | |
| 384 | 350 | static unsigned short lastb2; |
| 385 | 351 | static int destl; |
| 386 | 352 | |
| 387 | static UINT32 process(UINT8 b,UINT32 dst_offset) | |
| 353 | static UINT32 process(running_machine *machine,UINT8 b,UINT32 dst_offset) | |
| 388 | 354 | { |
| 389 | 355 | |
| 390 | 356 | int l=0; |
| r4135 | r4136 | |
| 399 | 365 | for(i=0;i<rle;++i) |
| 400 | 366 | { |
| 401 | 367 | tram[dst_offset+destl] = lastb; |
| 402 | dirty | |
| 368 | gfx_element_mark_dirty(machine->gfx[0], (dst_offset+destl)/0x40) | |
| 403 | 369 | |
| 404 | 370 | dst_offset++; |
| 405 | 371 | ++l; |
| r4135 | r4136 | |
| 413 | 379 | lastb2=lastb; |
| 414 | 380 | lastb=b; |
| 415 | 381 | tram[dst_offset+destl] = b; |
| 416 | dirty | |
| 382 | gfx_element_mark_dirty(machine->gfx[0], (dst_offset+destl)/0x40) | |
| 417 | 383 | |
| 418 | 384 | return 1; |
| 419 | 385 | } |
| r4135 | r4136 | |
| 467 | 433 | { |
| 468 | 434 | UINT8 real_byte; |
| 469 | 435 | real_byte = rom[srctab+p*2]; |
| 470 | tempidx+=process(real_byte,tempidx); | |
| 436 | tempidx+=process(space->machine,real_byte,tempidx); | |
| 471 | 437 | real_byte = rom[srctab+p*2+1];//px[DMA_XOR((current_table_address+p*2+1))]; |
| 472 | tempidx+=process(real_byte,tempidx); | |
| 438 | tempidx+=process(space->machine,real_byte,tempidx); | |
| 473 | 439 | } |
| 474 | 440 | else |
| 475 | 441 | { |
| 476 | tempidx+=process(p,tempidx); | |
| 442 | tempidx+=process(space->machine,p,tempidx); | |
| 477 | 443 | } |
| 478 | 444 | |
| 479 | 445 | ctrl<<=1; |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | - Find what the remaining video C.R.T. registers does; |
| 11 | 11 | - Fix sprites bugs at a start of a play; |
| 12 | 12 | - Check NVRAM boudaries; |
| 13 | - Why we need to write "something" to the comms to let the coins to work? Bug with the Seibu custom z80? | |
| 13 | 14 | - How the "SW Service Mode" (press F2 during gameplay) really works (inputs etc)? Nothing mapped works with it... |
| 14 | 15 | |
| 15 | 16 | Notes: |
| r4135 | r4136 | |
| 64 | 65 | WRITE16_HANDLER( sengokmj_mdvram_w ); |
| 65 | 66 | WRITE16_HANDLER( sengokmj_txvram_w ); |
| 66 | 67 | WRITE16_HANDLER( sengokmj_layer_enable_w ); |
| 68 | WRITE16_HANDLER( sengokmj_bg_scrolly_w ); | |
| 67 | 69 | VIDEO_START( sengokmj ); |
| 68 | 70 | VIDEO_UPDATE( sengokmj ); |
| 69 | 71 | |
| r4135 | r4136 | |
| 99 | 101 | coin_counter_w(0,data & 4); |
| 100 | 102 | } |
| 101 | 103 | |
| 104 | static WRITE16_HANDLER( seibu_z80_com_6_mirror_w ) | |
| 105 | { | |
| 106 | seibu_main_word_w(space,6,data,0xffff); | |
| 107 | } | |
| 102 | 108 | |
| 103 | 109 | static ADDRESS_MAP_START( sengokmj_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 104 | 110 | AM_RANGE(0x00000, 0x07fff) AM_RAM |
| r4135 | r4136 | |
| 114 | 120 | |
| 115 | 121 | static ADDRESS_MAP_START( sengokmj_io_map, ADDRESS_SPACE_IO, 16 ) |
| 116 | 122 | AM_RANGE(0x4000, 0x400f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w) |
| 117 | AM_RANGE(0x8000, 0x800f) AM_WRITE(seibu_main_word_w) | |
| 118 | /*Areas from 8010-804f appears to be video registers / C.R.T. related,probably usual Seibu customness.*/ | |
| 119 | AM_RANGE(0x8010, 0x801b) AM_WRITENOP | |
| 123 | /*Areas from 8000-804f are for the custom Seibu CRTC.*/ | |
| 124 | // AM_RANGE(0x8000, 0x800f) AM_WRITE(seibu_main_word_w) | |
| 125 | // AM_RANGE(0x8010, 0x801b) AM_WRITENOP | |
| 120 | 126 | AM_RANGE(0x801c, 0x801d) AM_WRITE(sengokmj_layer_enable_w) |
| 121 | AM_RANGE(0x801e, 0x801f) AM_WRITENOP | |
| 122 | AM_RANGE(0x8020, 0x802f) AM_WRITENOP | |
| 123 | AM_RANGE(0x8030, 0x803f) AM_WRITENOP | |
| 124 | AM_RANGE(0x8040, 0x804f) AM_WRITENOP | |
| 127 | // AM_RANGE(0x801e, 0x801f) AM_WRITENOP | |
| 128 | // AM_RANGE(0x8020, 0x802f) AM_WRITENOP | |
| 129 | AM_RANGE(0x8022, 0x8023) AM_WRITE(sengokmj_bg_scrolly_w) | |
| 130 | // AM_RANGE(0x8030, 0x803f) AM_WRITENOP | |
| 131 | // AM_RANGE(0x8040, 0x804f) AM_WRITENOP | |
| 125 | 132 | |
| 126 | AM_RANGE(0x8100, 0x8101) AM_WRITENOP // always 0 | |
| 133 | AM_RANGE(0x8080, 0x8081) AM_WRITE(seibu_z80_com_6_mirror_w) | |
| 134 | // AM_RANGE(0x80c0, 0x80c1) AM_WRITE(seibu_z80_com_unk_mirror_w) | |
| 135 | // AM_RANGE(0x8100, 0x8101) AM_WRITENOP // always 0 | |
| 127 | 136 | AM_RANGE(0x8180, 0x8181) AM_WRITE(sengokmj_out_w) |
| 128 | AM_RANGE(0x8080, 0x8081) AM_WRITENOP | |
| 129 | AM_RANGE(0x80c0, 0x80cf) AM_WRITENOP | |
| 130 | 137 | AM_RANGE(0x8140, 0x8141) AM_WRITE(mahjong_panel_w) |
| 131 | 138 | AM_RANGE(0xc000, 0xc001) AM_READ_PORT("DSW1") |
| 132 | 139 | AM_RANGE(0xc002, 0xc003) AM_READ(mahjong_panel_r) |
| r4135 | r4136 | |
|---|---|---|
| 55 | 55 | */ |
| 56 | 56 | |
| 57 | 57 | #include "driver.h" |
| 58 | #include "cpu/m6502/m6502.h" | |
| 59 | #include "sound/dac.h" | |
| 60 | #include "sound/nes_apu.h" | |
| 58 | 61 | #include "video/ppu2c0x.h" |
| 59 | #include "sound/nes_apu.h" | |
| 60 | #include "cpu/m6502/m6502.h" | |
| 61 | 62 | |
| 62 | 63 | static WRITE8_HANDLER( sprite_dma_w ) |
| 63 | 64 | { |
| r4135 | r4136 | |
|---|---|---|
| 494 | 494 | #include "driver.h" |
| 495 | 495 | #include "cpu/m6809/m6809.h" |
| 496 | 496 | #include "cpu/m6800/m6800.h" |
| 497 | #include "machine/6821pia.h" | |
| 497 | #include "sound/dac.h" | |
| 498 | #include "sound/hc55516.h" | |
| 499 | #include "machine/6821new.h" | |
| 498 | 500 | #include "audio/williams.h" |
| 499 | 501 | #include "williams.h" |
| 500 | #include "sound/dac.h" | |
| 501 | 502 | |
| 502 | 503 | |
| 503 | 504 | #define MASTER_CLOCK (12000000) |
| r4135 | r4136 | |
| 522 | 523 | |
| 523 | 524 | void defender_install_io_space(const address_space *space) |
| 524 | 525 | { |
| 526 | const device_config *pia_0 = devtag_get_device(space->machine, PIA6821, "pia_0"); | |
| 527 | const device_config *pia_1 = devtag_get_device(space->machine, PIA6821, "pia_1"); | |
| 528 | ||
| 525 | 529 | /* this routine dynamically installs the memory mapped above from c000-cfff */ |
| 526 | memory_install_write8_handler (space, 0xc000, 0xc00f, 0, 0x03e0, SMH_BANK4); | |
| 527 | memory_install_write8_handler (space, 0xc010, 0xc01f, 0, 0x03e0, defender_video_control_w); | |
| 528 | memory_install_write8_handler (space, 0xc3ff, 0xc3ff, 0, 0, williams_watchdog_reset_w); | |
| 529 | memory_install_readwrite8_handler (space, 0xc400, 0xc4ff, 0, 0x0300, SMH_BANK3, williams_cmos_w); | |
| 530 | memory_install_read8_handler (space, 0xc800, 0xcbff, 0, 0x03e0, williams_video_counter_r); | |
| 531 | memory_install_readwrite8_handler (space, 0xcc00, 0xcc03, 0, 0x03e0, pia_1_r, pia_1_w); | |
| 532 | memory_install_readwrite8_handler (space, 0xcc04, 0xcc07, 0, 0x03e0, pia_0_r, pia_0_w); | |
| 530 | memory_install_write8_handler (space, 0xc000, 0xc00f, 0, 0x03e0, SMH_BANK4); | |
| 531 | memory_install_write8_handler (space, 0xc010, 0xc01f, 0, 0x03e0, defender_video_control_w); | |
| 532 | memory_install_write8_handler (space, 0xc3ff, 0xc3ff, 0, 0, williams_watchdog_reset_w); | |
| 533 | memory_install_readwrite8_handler(space, 0xc400, 0xc4ff, 0, 0x0300, SMH_BANK3, williams_cmos_w); | |
| 534 | memory_install_read8_handler (space, 0xc800, 0xcbff, 0, 0x03e0, williams_video_counter_r); | |
| 535 | memory_install_readwrite8_device_handler(space, pia_1, 0xcc00, 0xcc03, 0, 0x03e0, pia_r, pia_w); | |
| 536 | memory_install_readwrite8_device_handler(space, pia_0, 0xcc04, 0xcc07, 0, 0x03e0, pia_r, pia_w); | |
| 533 | 537 | memory_set_bankptr(space->machine, 3, generic_nvram); |
| 534 | 538 | memory_set_bankptr(space->machine, 4, paletteram); |
| 535 | 539 | } |
| r4135 | r4136 | |
| 546 | 550 | AM_RANGE(0x0000, 0x8fff) AM_READWRITE(SMH_BANK1, SMH_RAM) AM_BASE(&williams_videoram) |
| 547 | 551 | AM_RANGE(0x9000, 0xbfff) AM_RAM |
| 548 | 552 | AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x03f0) AM_WRITE(SMH_RAM) AM_BASE(&paletteram) |
| 549 | AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_READWRITE(pia_0_r, pia_0_w) | |
| 550 | AM_RANGE(0xc80c, 0xc80f) AM_MIRROR(0x00f0) AM_READWRITE(pia_1_r, pia_1_w) | |
| 553 | AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_DEVREADWRITE(PIA6821, "pia_0", pia_r, pia_w) | |
| 554 | AM_RANGE(0xc80c, 0xc80f) AM_MIRROR(0x00f0) AM_DEVREADWRITE(PIA6821, "pia_1", pia_r, pia_w) | |
| 551 | 555 | AM_RANGE(0xc900, 0xc9ff) AM_WRITE(williams_vram_select_w) |
| 552 | 556 | AM_RANGE(0xca00, 0xca07) AM_MIRROR(0x00f8) AM_WRITE(williams_blitter_w) |
| 553 | 557 | AM_RANGE(0xcb00, 0xcbff) AM_READ(williams_video_counter_r) |
| r4135 | r4136 | |
| 561 | 565 | AM_RANGE(0x0000, 0x8fff) AM_READWRITE(SMH_BANK1, SMH_RAM) AM_BASE(&williams_videoram) |
| 562 | 566 | AM_RANGE(0x9000, 0xbfff) AM_RAM |
| 563 | 567 | AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x03f0) AM_WRITE(SMH_RAM) AM_BASE(&paletteram) |
| 564 | AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_READWRITE(pia_0_r, pia_0_w) | |
| 565 | AM_RANGE(0xc80c, 0xc80f) AM_MIRROR(0x00f0) AM_READWRITE(pia_1_r, pia_1_w) | |
| 568 | AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_DEVREADWRITE(PIA6821, "pia_0", pia_r, pia_w) | |
| 569 | AM_RANGE(0xc80c, 0xc80f) AM_MIRROR(0x00f0) AM_DEVREADWRITE(PIA6821, "pia_1", pia_r, pia_w) | |
| 566 | 570 | AM_RANGE(0xc900, 0xc9ff) AM_WRITE(sinistar_vram_select_w) |
| 567 | 571 | AM_RANGE(0xca00, 0xca07) AM_MIRROR(0x00f8) AM_WRITE(williams_blitter_w) |
| 568 | 572 | AM_RANGE(0xcb00, 0xcbff) AM_READ(williams_video_counter_r) |
| r4135 | r4136 | |
| 587 | 591 | AM_RANGE(0xbc00, 0xbcff) AM_WRITE(SMH_RAM) AM_BASE(&blaster_scanline_control) |
| 588 | 592 | AM_RANGE(0x9000, 0xbfff) AM_RAM |
| 589 | 593 | AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x03f0) AM_WRITE(SMH_RAM) AM_BASE(&paletteram) |
| 590 | AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_READWRITE(pia_0_r, pia_0_w) | |
| 591 | AM_RANGE(0xc80c, 0xc80f) AM_MIRROR(0x00f0) AM_READWRITE(pia_1_r, pia_1_w) | |
| 594 | AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_DEVREADWRITE(PIA6821, "pia_0", pia_r, pia_w) | |
| 595 | AM_RANGE(0xc80c, 0xc80f) AM_MIRROR(0x00f0) AM_DEVREADWRITE(PIA6821, "pia_1", pia_r, pia_w) | |
| 592 | 596 | AM_RANGE(0xc900, 0xc93f) AM_WRITE(blaster_vram_select_w) |
| 593 | 597 | AM_RANGE(0xc940, 0xc97f) AM_WRITE(blaster_remap_select_w) |
| 594 | 598 | AM_RANGE(0xc980, 0xc9bf) AM_WRITE(blaster_bank_select_w) |
| r4135 | r4136 | |
| 615 | 619 | AM_RANGE(0xc800, 0xc87f) AM_WRITE(williams2_bank_select_w) |
| 616 | 620 | AM_RANGE(0xc880, 0xc887) AM_MIRROR(0x0078) AM_WRITE(williams_blitter_w) |
| 617 | 621 | AM_RANGE(0xc900, 0xc97f) AM_WRITE(williams2_watchdog_reset_w) |
| 618 | AM_RANGE(0xc980, 0xc983) AM_MIRROR(0x0070) AM_READWRITE(pia_1_r, pia_1_w) | |
| 619 | AM_RANGE(0xc984, 0xc987) AM_MIRROR(0x0070) AM_READWRITE(pia_0_r, pia_0_w) | |
| 622 | AM_RANGE(0xc980, 0xc983) AM_MIRROR(0x0070) AM_DEVREADWRITE(PIA6821, "pia_1", pia_r, pia_w) | |
| 623 | AM_RANGE(0xc984, 0xc987) AM_MIRROR(0x0070) AM_DEVREADWRITE(PIA6821, "pia_0", pia_r, pia_w) | |
| 620 | 624 | AM_RANGE(0xc98c, 0xc98f) AM_MIRROR(0x0070) AM_WRITE(williams2_7segment_w) |
| 621 | 625 | AM_RANGE(0xcb00, 0xcb1f) AM_WRITE(williams2_fg_select_w) |
| 622 | 626 | AM_RANGE(0xcb20, 0xcb3f) AM_WRITE(williams2_bg_select_w) |
| r4135 | r4136 | |
| 637 | 641 | AM_RANGE(0xc800, 0xc87f) AM_WRITE(williams2_bank_select_w) |
| 638 | 642 | AM_RANGE(0xc880, 0xc887) AM_MIRROR(0x0078) AM_WRITE(williams_blitter_w) |
| 639 | 643 | AM_RANGE(0xc900, 0xc97f) AM_WRITE(williams2_watchdog_reset_w) |
| 640 | AM_RANGE(0xc980, 0xc983) AM_MIRROR(0x0070) AM_READWRITE(pia_1_r, pia_1_w) | |
| 641 | AM_RANGE(0xc984, 0xc987) AM_MIRROR(0x0070) AM_READWRITE(pia_0_r, pia_0_w) | |
| 644 | AM_RANGE(0xc980, 0xc983) AM_MIRROR(0x0070) AM_DEVREADWRITE(PIA6821, "pia_1", pia_r, pia_w) | |
| 645 | AM_RANGE(0xc984, 0xc987) AM_MIRROR(0x0070) AM_DEVREADWRITE(PIA6821, "pia_0", pia_r, pia_w) | |
| 642 | 646 | AM_RANGE(0xc98c, 0xc98f) AM_MIRROR(0x0070) AM_WRITE(williams2_7segment_w) |
| 643 | 647 | AM_RANGE(0xcb00, 0xcb1f) AM_WRITE(williams2_fg_select_w) |
| 644 | 648 | AM_RANGE(0xcb20, 0xcb3f) AM_WRITE(williams2_bg_select_w) |
| r4135 | r4136 | |
| 662 | 666 | |
| 663 | 667 | static ADDRESS_MAP_START( defender_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 664 | 668 | AM_RANGE(0x0000, 0x007f) AM_RAM /* internal RAM */ |
| 665 | AM_RANGE(0x0400, 0x0403) AM_MIRROR(0x8000) AM_READWRITE(pia_2_r, pia | |
| 669 | AM_RANGE(0x0400, 0x0403) AM_MIRROR(0x8000) AM_DEVREADWRITE(PIA6821, "pia_2", pia_r, pia | |
| 666 | 670 | AM_RANGE(0xb000, 0xffff) AM_ROM /* most games start at $F000, Sinistar starts at $B000 */ |
| 667 | 671 | ADDRESS_MAP_END |
| 668 | 672 | |
| r4135 | r4136 | |
| 670 | 674 | static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 671 | 675 | AM_RANGE(0x0000, 0x007f) AM_RAM /* internal RAM */ |
| 672 | 676 | AM_RANGE(0x0080, 0x00ff) AM_RAM /* MC6810 RAM */ |
| 673 | AM_RANGE(0x0400, 0x0403) AM_MIRROR(0x8000) AM_READWRITE(pia_2_r, pia | |
| 677 | AM_RANGE(0x0400, 0x0403) AM_MIRROR(0x8000) AM_DEVREADWRITE(PIA6821, "pia_2", pia_r, pia | |
| 674 | 678 | AM_RANGE(0xb000, 0xffff) AM_ROM /* most games start at $F000, Sinistar starts at $B000 */ |
| 675 | 679 | ADDRESS_MAP_END |
| 676 | 680 | |
| r4135 | r4136 | |
| 685 | 689 | static ADDRESS_MAP_START( williams2_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 686 | 690 | AM_RANGE(0x0000, 0x007f) AM_RAM /* internal RAM */ |
| 687 | 691 | AM_RANGE(0x0080, 0x00ff) AM_RAM /* MC6810 RAM */ |
| 688 | AM_RANGE(0x2000, 0x2003) AM_MIRROR(0x1ffc) AM_READWRITE(pia_2_r, pia | |
| 692 | AM_RANGE(0x2000, 0x2003) AM_MIRROR(0x1ffc) AM_DEVREADWRITE(PIA6821, "pia_2", pia_r, pia | |
| 689 | 693 | AM_RANGE(0xe000, 0xffff) AM_ROM |
| 690 | 694 | ADDRESS_MAP_END |
| 691 | 695 | |
| r4135 | r4136 | |
| 1445 | 1449 | |
| 1446 | 1450 | MDRV_SOUND_ADD("dac", DAC, 0) |
| 1447 | 1451 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 1452 | ||
| 1453 | /* pia */ | |
| 1454 | MDRV_PIA6821_ADD("pia_0", williams_pia_0_intf) | |
| 1455 | MDRV_PIA6821_ADD("pia_1", williams_pia_1_intf) | |
| 1456 | MDRV_PIA6821_ADD("pia_2", williams_snd_pia_intf) | |
| 1448 | 1457 | MACHINE_DRIVER_END |
| 1449 | 1458 | |
| 1450 | 1459 | |
| r4135 | r4136 | |
| 1473 | 1482 | MACHINE_DRIVER_END |
| 1474 | 1483 | |
| 1475 | 1484 | |
| 1485 | static MACHINE_DRIVER_START( williams_muxed ) | |
| 1486 | ||
| 1487 | /* basic machine hardware */ | |
| 1488 | MDRV_IMPORT_FROM(williams) | |
| 1489 | ||
| 1490 | /* pia */ | |
| 1491 | MDRV_PIA6821_MODIFY("pia_0", williams_muxed_pia_0_intf) | |
| 1492 | MACHINE_DRIVER_END | |
| 1493 | ||
| 1494 | ||
| 1476 | 1495 | static MACHINE_DRIVER_START( williams_extra_ram ) |
| 1477 | 1496 | |
| 1478 | 1497 | /* basic machine hardware */ |
| r4135 | r4136 | |
| 1483 | 1502 | MACHINE_DRIVER_END |
| 1484 | 1503 | |
| 1485 | 1504 | |
| 1505 | static MACHINE_DRIVER_START( spdball ) | |
| 1506 | ||
| 1507 | /* basic machine hardware */ | |
| 1508 | MDRV_IMPORT_FROM(williams) | |
| 1509 | ||
| 1510 | /* pia */ | |
| 1511 | MDRV_PIA6821_ADD("pia_3", spdball_pia_3_intf) | |
| 1512 | MACHINE_DRIVER_END | |
| 1513 | ||
| 1514 | ||
| 1515 | static MACHINE_DRIVER_START( lottofun ) | |
| 1516 | ||
| 1517 | /* basic machine hardware */ | |
| 1518 | MDRV_IMPORT_FROM(williams) | |
| 1519 | ||
| 1520 | /* pia */ | |
| 1521 | MDRV_PIA6821_MODIFY("pia_0", lottofun_pia_0_intf) | |
| 1522 | MACHINE_DRIVER_END | |
| 1523 | ||
| 1524 | ||
| 1486 | 1525 | static MACHINE_DRIVER_START( alienar ) |
| 1487 | 1526 | |
| 1488 | 1527 | /* basic machine hardware */ |
| r4135 | r4136 | |
| 1494 | 1533 | MDRV_MACHINE_RESET(williams) |
| 1495 | 1534 | MDRV_SCREEN_MODIFY("main") |
| 1496 | 1535 | MDRV_SCREEN_VISIBLE_AREA(6, 298-1, 7, 247-1) |
| 1536 | ||
| 1537 | /* pia */ | |
| 1538 | MDRV_PIA6821_MODIFY("pia_0", williams_muxed_pia_0_intf) | |
| 1497 | 1539 | MACHINE_DRIVER_END |
| 1498 | 1540 | |
| 1499 | 1541 | |
| r4135 | r4136 | |
| 1505 | 1547 | /* sound hardware */ |
| 1506 | 1548 | MDRV_SOUND_ADD("cvsd", HC55516, 0) |
| 1507 | 1549 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 1550 | ||
| 1551 | /* pia */ | |
| 1552 | MDRV_PIA6821_MODIFY("pia_0", williams_49way_pia_0_intf) | |
| 1553 | MDRV_PIA6821_MODIFY("pia_2", sinistar_snd_pia_intf) | |
| 1508 | 1554 | MACHINE_DRIVER_END |
| 1509 | 1555 | |
| 1510 | 1556 | |
| r4135 | r4136 | |
| 1520 | 1566 | /* sound hardware */ |
| 1521 | 1567 | MDRV_SOUND_ADD("cvsd", HC55516, 0) |
| 1522 | 1568 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 1569 | ||
| 1570 | /* pia */ | |
| 1571 | MDRV_PIA6821_MODIFY("pia_1", playball_pia_1_intf) | |
| 1572 | MDRV_PIA6821_MODIFY("pia_2", sinistar_snd_pia_intf) | |
| 1523 | 1573 | MACHINE_DRIVER_END |
| 1524 | 1574 | |
| 1525 | 1575 | |
| r4135 | r4136 | |
| 1536 | 1586 | /* video hardware */ |
| 1537 | 1587 | MDRV_VIDEO_START(blaster) |
| 1538 | 1588 | MDRV_VIDEO_UPDATE(blaster) |
| 1589 | ||
| 1590 | /* pia */ | |
| 1591 | MDRV_PIA6821_MODIFY("pia_0", williams_49way_pia_0_intf) | |
| 1539 | 1592 | MACHINE_DRIVER_END |
| 1540 | 1593 | |
| 1541 | 1594 | |
| 1595 | static MACHINE_DRIVER_START( blastkit ) | |
| 1596 | ||
| 1597 | /* basic machine hardware */ | |
| 1598 | MDRV_IMPORT_FROM(blaster) | |
| 1599 | ||
| 1600 | /* pia */ | |
| 1601 | MDRV_PIA6821_MODIFY("pia_0", williams_49way_muxed_pia_0_intf) | |
| 1602 | MACHINE_DRIVER_END | |
| 1603 | ||
| 1604 | ||
| 1542 | 1605 | static MACHINE_DRIVER_START( williams2 ) |
| 1543 | 1606 | |
| 1544 | 1607 | /* basic machine hardware */ |
| r4135 | r4136 | |
| 1568 | 1631 | |
| 1569 | 1632 | MDRV_SOUND_ADD("wmsdac", DAC, 0) |
| 1570 | 1633 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 1634 | ||
| 1635 | /* pia */ | |
| 1636 | MDRV_PIA6821_ADD("pia_0", williams2_muxed_pia_0_intf) | |
| 1637 | MDRV_PIA6821_ADD("pia_1", williams2_pia_1_intf) | |
| 1638 | MDRV_PIA6821_ADD("pia_2", williams2_snd_pia_intf) | |
| 1571 | 1639 | MACHINE_DRIVER_END |
| 1572 | 1640 | |
| 1573 | 1641 | |
| r4135 | r4136 | |
| 1581 | 1649 | MACHINE_DRIVER_END |
| 1582 | 1650 | |
| 1583 | 1651 | |
| 1652 | static MACHINE_DRIVER_START( mysticm ) | |
| 1653 | ||
| 1654 | /* basic machine hardware */ | |
| 1655 | MDRV_IMPORT_FROM(williams2_extra_ram) | |
| 1656 | ||
| 1657 | /* pia */ | |
| 1658 | MDRV_PIA6821_MODIFY("pia_0", mysticm_pia_0_intf) | |
| 1659 | MDRV_PIA6821_MODIFY("pia_1", mysticm_pia_1_intf) | |
| 1660 | MACHINE_DRIVER_END | |
| 1661 | ||
| 1662 | ||
| 1663 | static MACHINE_DRIVER_START( tshoot ) | |
| 1664 | ||
| 1665 | /* basic machine hardware */ | |
| 1666 | MDRV_IMPORT_FROM(williams2) | |
| 1667 | ||
| 1668 | /* pia */ | |
| 1669 | MDRV_PIA6821_MODIFY("pia_0", tshoot_pia_0_intf) | |
| 1670 | MDRV_PIA6821_MODIFY("pia_1", tshoot_pia_1_intf) | |
| 1671 | MDRV_PIA6821_MODIFY("pia_2", tshoot_snd_pia_intf) | |
| 1672 | MACHINE_DRIVER_END | |
| 1673 | ||
| 1674 | ||
| 1584 | 1675 | static MACHINE_DRIVER_START( joust2 ) |
| 1585 | 1676 | |
| 1586 | 1677 | /* basic machine hardware */ |
| r4135 | r4136 | |
| 1593 | 1684 | |
| 1594 | 1685 | /* sound hardware */ |
| 1595 | 1686 | MDRV_SOUND_REMOVE("wmsdac") |
| 1687 | ||
| 1688 | /* pia */ | |
| 1689 | MDRV_PIA6821_MODIFY("pia_1", joust2_pia_1_intf) | |
| 1690 | MDRV_PIA6821_ADD("pia_3", joust2_pia_3_intf) | |
| 1596 | 1691 | MACHINE_DRIVER_END |
| 1597 | 1692 | |
| 1598 | 1693 | |
| r4135 | r4136 | |
| 2600 | 2695 | #define CONFIGURE_TILEMAP(x) \ |
| 2601 | 2696 | williams2_tilemap_config = x |
| 2602 | 2697 | |
| 2603 | #define CONFIGURE_PIAS(a,b,c) \ | |
| 2604 | pia_config(machine, 0, &a);\ | |
| 2605 | pia_config(machine, 1, &b);\ | |
| 2606 | pia_config(machine, 2, &c) | |
| 2607 | 2698 | |
| 2608 | 2699 | |
| 2609 | ||
| 2610 | 2700 | /************************************* |
| 2611 | 2701 | * |
| 2612 | 2702 | * Defender hardware driver init |
| r4135 | r4136 | |
| 2616 | 2706 | static DRIVER_INIT( defender ) |
| 2617 | 2707 | { |
| 2618 | 2708 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000); |
| 2619 | CONFIGURE_PIAS(williams_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2620 | 2709 | } |
| 2621 | 2710 | |
| 2622 | 2711 | |
| r4135 | r4136 | |
| 2626 | 2715 | int i; |
| 2627 | 2716 | |
| 2628 | 2717 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000); |
| 2629 | CONFIGURE_PIAS(williams_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2630 | 2718 | |
| 2631 | 2719 | /* apply simple decryption by swapping bits 0 and 7 */ |
| 2632 | 2720 | for (i = 0xd000; i < 0x19000; i++) |
| r4135 | r4136 | |
| 2637 | 2725 | static DRIVER_INIT( mayday ) |
| 2638 | 2726 | { |
| 2639 | 2727 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000); |
| 2640 | CONFIGURE_PIAS(williams_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2641 | 2728 | |
| 2642 | 2729 | /* install a handler to catch protection checks */ |
| 2643 | 2730 | mayday_protection = memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa190, 0xa191, 0, 0, mayday_protection_r); |
| r4135 | r4136 | |
| 2654 | 2741 | static DRIVER_INIT( stargate ) |
| 2655 | 2742 | { |
| 2656 | 2743 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000); |
| 2657 | CONFIGURE_PIAS(williams_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2658 | 2744 | } |
| 2659 | 2745 | |
| 2660 | 2746 | |
| 2661 | 2747 | static DRIVER_INIT( robotron ) |
| 2662 | 2748 | { |
| 2663 | 2749 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000); |
| 2664 | CONFIGURE_PIAS(williams_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2665 | 2750 | } |
| 2666 | 2751 | |
| 2667 | 2752 | |
| 2668 | 2753 | static DRIVER_INIT( joust ) |
| 2669 | 2754 | { |
| 2670 | 2755 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000); |
| 2671 | CONFIGURE_PIAS(williams_muxed_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2672 | 2756 | } |
| 2673 | 2757 | |
| 2674 | 2758 | |
| 2675 | 2759 | static DRIVER_INIT( bubbles ) |
| 2676 | 2760 | { |
| 2677 | 2761 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000); |
| 2678 | CONFIGURE_PIAS(williams_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2679 | 2762 | |
| 2680 | 2763 | /* bubbles has a full 8-bit-wide CMOS */ |
| 2681 | 2764 | memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcc00, 0xcfff, 0, 0, bubbles_cmos_w); |
| r4135 | r4136 | |
| 2685 | 2768 | static DRIVER_INIT( splat ) |
| 2686 | 2769 | { |
| 2687 | 2770 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0xc000); |
| 2688 | CONFIGURE_PIAS(williams_muxed_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2689 | 2771 | } |
| 2690 | 2772 | |
| 2691 | 2773 | |
| 2692 | 2774 | static DRIVER_INIT( sinistar ) |
| 2693 | 2775 | { |
| 2694 | 2776 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0x7400); |
| 2695 | CONFIGURE_PIAS(williams_49way_pia_0_intf, williams_pia_1_intf, sinistar_snd_pia_intf); | |
| 2696 | 2777 | } |
| 2697 | 2778 | |
| 2698 | 2779 | |
| 2699 | 2780 | static DRIVER_INIT( playball ) |
| 2700 | 2781 | { |
| 2701 | 2782 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000); |
| 2702 | CONFIGURE_PIAS(williams_pia_0_intf, playball_pia_1_intf, sinistar_snd_pia_intf); | |
| 2703 | 2783 | } |
| 2704 | 2784 | |
| 2705 | 2785 | |
| 2706 | 2786 | static DRIVER_INIT( blaster ) |
| 2707 | 2787 | { |
| 2708 | 2788 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9700); |
| 2709 | CONFIGURE_PIAS(williams_49way_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2710 | 2789 | } |
| 2711 | 2790 | |
| 2712 | 2791 | |
| 2713 | 2792 | static DRIVER_INIT( blastkit ) |
| 2714 | 2793 | { |
| 2715 | 2794 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9700); |
| 2716 | CONFIGURE_PIAS(williams_49way_muxed_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2717 | 2795 | } |
| 2718 | 2796 | |
| 2719 | 2797 | |
| 2720 | 2798 | static DRIVER_INIT( spdball ) |
| 2721 | 2799 | { |
| 2800 | const device_config *pia_3 = devtag_get_device(machine, PIA6821, "pia_3"); | |
| 2801 | ||
| 2722 | 2802 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000); |
| 2723 | CONFIGURE_PIAS(williams_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2724 | 2803 | |
| 2725 | 2804 | /* add a third PIA */ |
| 2726 | pia_config(machine, 3, &spdball_pia_3_intf); | |
| 2727 | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc808, 0xc80b, 0, 0, pia_3_r, pia_3_w); | |
| 2805 | memory_install_readwrite8_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), pia_3, 0xc808, 0xc80b, 0, 0, pia_r, pia_w); | |
| 2728 | 2806 | |
| 2729 | 2807 | /* install extra input handlers */ |
| 2730 | 2808 | memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xc800, 0, 0, input_port_read_handler8(machine->portconfig, "AN0")); |
| r4135 | r4136 | |
| 2737 | 2815 | static DRIVER_INIT( alienar ) |
| 2738 | 2816 | { |
| 2739 | 2817 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000); |
| 2740 | CONFIGURE_PIAS(williams_muxed_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2741 | 2818 | memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0, SMH_NOP); |
| 2742 | 2819 | } |
| 2743 | 2820 | |
| r4135 | r4136 | |
| 2745 | 2822 | static DRIVER_INIT( alienaru ) |
| 2746 | 2823 | { |
| 2747 | 2824 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000); |
| 2748 | CONFIGURE_PIAS(williams_muxed_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2749 | 2825 | memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0, SMH_NOP); |
| 2750 | 2826 | } |
| 2751 | 2827 | |
| r4135 | r4136 | |
| 2753 | 2829 | static DRIVER_INIT( lottofun ) |
| 2754 | 2830 | { |
| 2755 | 2831 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000); |
| 2756 | CONFIGURE_PIAS(lottofun_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf); | |
| 2757 | 2832 | } |
| 2758 | 2833 | |
| 2759 | 2834 | |
| r4135 | r4136 | |
| 2768 | 2843 | { |
| 2769 | 2844 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000); |
| 2770 | 2845 | CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_MYSTICM); |
| 2771 | CONFIGURE_PIAS(mysticm_pia_0_intf, mysticm_pia_1_intf, williams2_snd_pia_intf); | |
| 2772 | 2846 | } |
| 2773 | 2847 | |
| 2774 | 2848 | |
| r4135 | r4136 | |
| 2776 | 2850 | { |
| 2777 | 2851 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000); |
| 2778 | 2852 | CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_TSHOOT); |
| 2779 | CONFIGURE_PIAS(tshoot_pia_0_intf, tshoot_pia_1_intf, tshoot_snd_pia_intf); | |
| 2780 | 2853 | } |
| 2781 | 2854 | |
| 2782 | 2855 | |
| r4135 | r4136 | |
| 2784 | 2857 | { |
| 2785 | 2858 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000); |
| 2786 | 2859 | CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_TSHOOT); |
| 2787 | CONFIGURE_PIAS(williams2_muxed_pia_0_intf, williams2_pia_1_intf, williams2_snd_pia_intf); | |
| 2788 | 2860 | } |
| 2789 | 2861 | |
| 2790 | 2862 | |
| r4135 | r4136 | |
| 2792 | 2864 | { |
| 2793 | 2865 | CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000); |
| 2794 | 2866 | CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_JOUST2); |
| 2795 | CONFIGURE_PIAS(williams2_muxed_pia_0_intf, joust2_pia_1_intf, williams2_snd_pia_intf); | |
| 2796 | 2867 | } |
| 2797 | 2868 | |
| 2798 | 2869 | |
| r4135 | r4136 | |
| 2827 | 2898 | GAME( 1981, stargate, 0, williams, stargate, stargate, ROT0, "Williams", "Stargate", GAME_SUPPORTS_SAVE ) |
| 2828 | 2899 | GAME( 1982, robotron, 0, williams, robotron, robotron, ROT0, "Williams", "Robotron (Solid Blue label)", GAME_SUPPORTS_SAVE ) |
| 2829 | 2900 | GAME( 1982, robotryo, robotron, williams, robotron, robotron, ROT0, "Williams", "Robotron (Yellow/Orange label)", GAME_SUPPORTS_SAVE ) |
| 2830 | GAME( 1982, joust, 0, williams, joust, joust, ROT0, "Williams", "Joust (White/Green label)", GAME_SUPPORTS_SAVE ) | |
| 2831 | GAME( 1982, joustr, joust, williams, joust, joust, ROT0, "Williams", "Joust (Solid Red label)", GAME_SUPPORTS_SAVE ) | |
| 2832 | GAME( 1982, joustwr, joust, williams, joust, joust, ROT0, "Williams", "Joust (White/Red label)", GAME_SUPPORTS_SAVE ) | |
| 2901 | GAME( 1982, joust, 0, williams_muxed, joust, joust, ROT0, "Williams", "Joust (White/Green label)", GAME_SUPPORTS_SAVE ) | |
| 2902 | GAME( 1982, joustr, joust, williams_muxed, joust, joust, ROT0, "Williams", "Joust (Solid Red label)", GAME_SUPPORTS_SAVE ) | |
| 2903 | GAME( 1982, joustwr, joust, williams_muxed, joust, joust, ROT0, "Williams", "Joust (White/Red label)", GAME_SUPPORTS_SAVE ) | |
| 2833 | 2904 | GAME( 1982, bubbles, 0, williams, bubbles, bubbles, ROT0, "Williams", "Bubbles", GAME_SUPPORTS_SAVE ) |
| 2834 | 2905 | GAME( 1982, bubblesr, bubbles, williams, bubbles, bubbles, ROT0, "Williams", "Bubbles (Solid Red label)", GAME_SUPPORTS_SAVE ) |
| 2835 | 2906 | GAME( 1982, bubblesp, bubbles, williams, bubbles, bubbles, ROT0, "Williams", "Bubbles (prototype version)", GAME_SUPPORTS_SAVE ) |
| 2836 | GAME( 1982, splat, 0, williams, | |
| 2907 | GAME( 1982, splat, 0, williams_muxed, | |
| 2837 | 2908 | GAME( 1982, sinistar, 0, sinistar, sinistar, sinistar, ROT270, "Williams", "Sinistar (revision 3)", GAME_SUPPORTS_SAVE ) |
| 2838 | 2909 | GAME( 1982, sinista1, sinistar, sinistar, sinistar, sinistar, ROT270, "Williams", "Sinistar (prototype version)", GAME_SUPPORTS_SAVE ) |
| 2839 | 2910 | GAME( 1982, sinista2, sinistar, sinistar, sinistar, sinistar, ROT270, "Williams", "Sinistar (revision 2)", GAME_SUPPORTS_SAVE ) |
| 2840 | 2911 | GAME( 1983, playball, 0, playball, playball, playball, ROT270, "Williams", "PlayBall! (prototype)", GAME_SUPPORTS_SAVE ) |
| 2841 | 2912 | GAME( 1983, blaster, 0, blaster, blaster, blaster, ROT0, "Williams", "Blaster", GAME_SUPPORTS_SAVE ) |
| 2842 | 2913 | GAME( 1983, blast30, blaster, blaster, blaster, blaster, ROT0, "Williams", "Blaster (early 30 wave version)", GAME_SUPPORTS_SAVE ) |
| 2843 | GAME( 1983, blastkit, blaster, blaster, blastkit, blastkit, ROT0, "Williams", "Blaster (kit)", GAME_SUPPORTS_SAVE ) | |
| 2844 | GAME( 1985, spdball, 0, williams, spdball, spdball, ROT0, "Williams", "Speed Ball (prototype)", GAME_SUPPORTS_SAVE ) | |
| 2914 | GAME( 1983, blastkit, blaster, blastkit, blastkit, blastkit, ROT0, "Williams", "Blaster (kit)", GAME_SUPPORTS_SAVE ) | |
| 2915 | GAME( 1985, spdball, 0, spdball, spdball, spdball, ROT0, "Williams", "Speed Ball (prototype)", GAME_SUPPORTS_SAVE ) | |
| 2845 | 2916 | GAME( 1985, alienar, 0, alienar, alienar, alienar, ROT0, "Duncan Brown", "Alien Arena", GAME_SUPPORTS_SAVE ) |
| 2846 | 2917 | GAME( 1985, alienaru, alienar, alienar, alienar, alienaru, ROT0, "Duncan Brown", "Alien Arena (Stargate Upgrade)", GAME_SUPPORTS_SAVE ) |
| 2847 | GAME( 1987, lottofun, 0, | |
| 2918 | GAME( 1987, lottofun, 0, | |
| 2848 | 2919 | |
| 2849 | 2920 | /* 2nd Generation Williams hardware with tilemaps */ |
| 2850 | GAME( 1983, mysticm, 0, williams2_extra_ram, mysticm, mysticm, ROT0, "Williams", "Mystic Marathon", GAME_SUPPORTS_SAVE ) | |
| 2851 | GAME( 1984, tshoot, 0, williams2, tshoot, tshoot, ROT0, "Williams", "Turkey Shoot", GAME_SUPPORTS_SAVE ) | |
| 2921 | GAME( 1983, mysticm, 0, mysticm, mysticm, mysticm, ROT0, "Williams", "Mystic Marathon", GAME_SUPPORTS_SAVE ) | |
| 2922 | GAME( 1984, tshoot, 0, tshoot, tshoot, tshoot, ROT0, "Williams", "Turkey Shoot", GAME_SUPPORTS_SAVE ) | |
| 2852 | 2923 | GAME( 1984, inferno, 0, williams2_extra_ram, inferno, inferno, ROT0, "Williams", "Inferno", GAME_SUPPORTS_SAVE ) |
| 2853 | 2924 | GAME( 1986, joust2, 0, joust2, joust2, joust2, ROT270, "Williams", "Joust 2 - Survival of the Fittest (set 1)", GAME_SUPPORTS_SAVE ) |
| r4135 | r4136 | |
|---|---|---|
| 168 | 168 | static ADDRESS_MAP_START( slotcarn_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 169 | 169 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 170 | 170 | AM_RANGE(0x6000, 0x67ff) AM_RAM AM_BASE(&backup_ram) |
| 171 | AM_RANGE(0x6800, 0x6fff) AM_RAM // spielbud | |
| 172 | AM_RANGE(0x7000, 0xafff) AM_ROM // spielbud | |
| 171 | 173 | |
| 174 | ||
| 172 | 175 | AM_RANGE(0xb000, 0xb000) AM_WRITE(ay8910_control_port_0_w) |
| 173 | 176 | AM_RANGE(0xb100, 0xb100) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w) |
| 174 | 177 | |
| r4135 | r4136 | |
| 189 | 192 | AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w) |
| 190 | 193 | ADDRESS_MAP_END |
| 191 | 194 | |
| 195 | // spielbud - is the ay mirrored, or are there now 2? | |
| 196 | static ADDRESS_MAP_START( spielbud_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 197 | AM_RANGE(0xb000, 0xb000) AM_WRITE(ay8910_control_port_0_w) | |
| 198 | AM_RANGE(0xb100, 0xb100) AM_WRITE(ay8910_write_port_0_w) | |
| 199 | ADDRESS_MAP_END | |
| 192 | 200 | |
| 193 | 201 | /******************************** |
| 194 | 202 | * Input Ports * |
| r4135 | r4136 | |
| 200 | 208 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 201 | 209 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 202 | 210 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 203 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key In") PORT_CODE(KEYCODE_Q) | |
| 204 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Start") PORT_CODE(KEYCODE_N) | |
| 205 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Cancel") PORT_CODE(KEYCODE_M) | |
| 206 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Select") PORT_CODE(KEYCODE_B) | |
| 211 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_Q) PORT_NAME("Key In") | |
| 212 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_N) PORT_NAME("Start") | |
| 213 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_M) PORT_NAME("Cancel") | |
| 214 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Select") | |
| 207 | 215 | |
| 208 | 216 | PORT_START("IN1") /* b801 (ppi8255) */ |
| 209 | 217 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ |
| 210 | 218 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2) PORT_IMPULSE(2) /* Coin B */ |
| 211 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats") PORT_CODE(KEYCODE_0) | |
| 212 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_9) | |
| 219 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 220 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 213 | 221 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 214 | 222 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ |
| 215 | 223 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ |
| 216 | 224 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 217 | 225 | |
| 218 | 226 | PORT_START("IN2") /* b802 (ppi8255) */ |
| 219 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 220 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 221 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 222 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 223 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 224 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 225 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 226 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 227 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 227 | 228 | |
| 228 | 229 | PORT_START("IN3") /* bc00 (ppi8255) */ |
| 229 | 230 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 230 | 231 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 231 | 232 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 232 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Double-Up") PORT_CODE(KEYCODE_C) | |
| 233 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Take Score") PORT_CODE(KEYCODE_V) | |
| 234 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Bet") PORT_CODE(KEYCODE_Z) | |
| 235 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Payout") PORT_CODE(KEYCODE_W) | |
| 236 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Empty Hopper") PORT_CODE(KEYCODE_H) | |
| 233 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Double-Up") | |
| 234 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Take Score") | |
| 235 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("Bet") | |
| 236 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Payout") | |
| 237 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_H) PORT_NAME("Empty Hopper") | |
| 237 | 238 | |
| 238 | 239 | PORT_START("IN4") /* bc01 (ppi8255) */ |
| 239 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 240 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 241 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 242 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 243 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 244 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 245 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 246 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 240 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 247 | 241 | |
| 248 | 242 | PORT_START("DSW1") /* ba00 (ppi8255) */ |
| 249 | 243 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:8") |
| r4135 | r4136 | |
| 349 | 343 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 350 | 344 | INPUT_PORTS_END |
| 351 | 345 | |
| 346 | static INPUT_PORTS_START( spielbud ) | |
| 347 | PORT_START("IN0") /* b800 (ppi8255) */ | |
| 348 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("Discard 1 / Deal (BJ)") | |
| 349 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("Discard 2") | |
| 350 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Discard 3 / Bet 1 / Split (BJ)") | |
| 351 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("Discard4 / Stand (BJ)") | |
| 352 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("Discard5 / Hit (BJ)") | |
| 353 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_1) PORT_NAME("Start") | |
| 354 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_CODE(KEYCODE_N) PORT_NAME("Cancel / Select") | |
| 355 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 352 | 356 | |
| 357 | PORT_START("IN1") /* b801 (ppi8255) */ | |
| 358 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1) PORT_IMPULSE(2) /* Coin A */ | |
| 359 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2) PORT_IMPULSE(2) /* Coin B */ | |
| 360 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Stats") | |
| 361 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings") | |
| 362 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 363 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3) PORT_IMPULSE(2) /* Coin C */ | |
| 364 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN4) PORT_IMPULSE(2) /* Coin D */ | |
| 365 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 366 | ||
| 367 | PORT_START("IN2") /* b802 (ppi8255) */ | |
| 368 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 369 | ||
| 370 | PORT_START("IN3") /* bc00 (ppi8255) */ | |
| 371 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 372 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_CODE(KEYCODE_A) PORT_NAME("Tief (Low)") | |
| 373 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_CODE(KEYCODE_S) PORT_NAME("Hoch (High)") | |
| 374 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_CODE(KEYCODE_3) PORT_NAME("Double-Up") | |
| 375 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_CODE(KEYCODE_4) PORT_NAME("Take Score") | |
| 376 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_CODE(KEYCODE_2) PORT_NAME("Bet 2") | |
| 377 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Payout") | |
| 378 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 379 | ||
| 380 | PORT_START("IN4") /* bc01 (ppi8255) */ | |
| 381 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 382 | ||
| 383 | PORT_START("DSW1") /* ba00 (ppi8255) */ | |
| 384 | PORT_DIPNAME( 0x01, 0x01, "Game STRATEGIE" ) | |
| 385 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 386 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) | |
| 387 | PORT_DIPNAME( 0x02, 0x02, "Game MITTE TRIFFT" ) | |
| 388 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 389 | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) | |
| 390 | PORT_DIPNAME( 0x04, 0x04, "Game KNOBELN" ) | |
| 391 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 392 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 393 | PORT_DIPNAME( 0x08, 0x08, "Game BLACK JACK" ) | |
| 394 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 395 | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) | |
| 396 | PORT_DIPNAME( 0x10, 0x10, "Game CONTINENTAL" ) | |
| 397 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 398 | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) | |
| 399 | PORT_DIPNAME( 0x20, 0x20, "Game 5 LINIEN SPIEL" ) | |
| 400 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 401 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) | |
| 402 | PORT_DIPNAME( 0xc0, 0xc0, "Max Bet Settings" ) | |
| 403 | PORT_DIPSETTING( 0xc0, "Play 1 to 10 bets" ) | |
| 404 | PORT_DIPSETTING( 0x80, "Play 1 to 20 bets" ) | |
| 405 | PORT_DIPSETTING( 0x40, "Play 1 bet by hand" ) | |
| 406 | PORT_DIPSETTING( 0x00, "Play 1 to 50 bets" ) | |
| 407 | ||
| 408 | PORT_START("DSW2") /* ay8910, port B */ | |
| 409 | PORT_DIPNAME( 0x07, 0x07, "Main Game rate" ) | |
| 410 | PORT_DIPSETTING( 0x06, "75%" ) | |
| 411 | PORT_DIPSETTING( 0x05, "80%" ) | |
| 412 | PORT_DIPSETTING( 0x07, "85%" ) | |
| 413 | PORT_DIPSETTING( 0x03, "90%" ) | |
| 414 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 415 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 416 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 417 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 418 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 419 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 420 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 421 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 422 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 423 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 424 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 425 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 426 | PORT_DIPNAME( 0x80, 0x00, "Hold Buttons Behaviour" ) | |
| 427 | PORT_DIPSETTING( 0x00, "Hold" ) | |
| 428 | PORT_DIPSETTING( 0x80, "Discard" ) | |
| 429 | ||
| 430 | PORT_START("DSW3") /* c000 direct */ | |
| 431 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 432 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 433 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 434 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 435 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 436 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 437 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 438 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 439 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 440 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 441 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 442 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 443 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 444 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 445 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 446 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 447 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 448 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 449 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 450 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 451 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 452 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 453 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 454 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 455 | ||
| 456 | PORT_START("DSW4") /* c400 direct */ | |
| 457 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) | |
| 458 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 459 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 460 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 461 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 462 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 463 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 464 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 465 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 466 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 467 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 468 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 469 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 470 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 471 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 472 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 473 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 474 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 475 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 476 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 477 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 478 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 479 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 480 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 481 | INPUT_PORTS_END | |
| 482 | ||
| 483 | ||
| 353 | 484 | /************************************* |
| 354 | 485 | * Graphics Layouts * |
| 355 | 486 | *************************************/ |
| r4135 | r4136 | |
| 463 | 594 | /* basic machine hardware */ |
| 464 | 595 | MDRV_CPU_ADD("main", Z80, CPU_CLOCK) // 2.5 Mhz? |
| 465 | 596 | MDRV_CPU_PROGRAM_MAP(slotcarn_map,0) |
| 466 | //MDRV_CPU_IO_MAP(goldstar_readport,0) | |
| 467 | //MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) | |
| 597 | MDRV_CPU_IO_MAP(spielbud_io_map,0) | |
| 468 | 598 | |
| 469 | 599 | /* 3x 8255 */ |
| 470 | 600 | MDRV_PPI8255_ADD( "ppi8255_0", scarn_ppi8255_intf[0] ) |
| r4135 | r4136 | |
| 561 | 691 | ROM_LOAD( "rom4.a5", 0x0000, 0x4000, CRC(1428c46c) SHA1(ea30eeebcc2cc825f33e1ffeb590b047e3072b9c) ) |
| 562 | 692 | ROM_END |
| 563 | 693 | |
| 694 | /* | |
| 564 | 695 | |
| 696 | Lucky - Wing? | |
| 697 | -------------- | |
| 698 | ||
| 699 | CPU: 1x Z80 (NEC D780C) | |
| 700 | Video: 1x 6845 (HD46505SP HD6845SP) | |
| 701 | Sound: 1x AY-3-8910 | |
| 702 | I/O: 3x 8255 (M5L8255AP-5) | |
| 703 | ||
| 704 | ROM: 6x 2764 (0, 1, 2, 3, 4, 9) | |
| 705 | 3x 27128 (6, 7, 8) | |
| 706 | ||
| 707 | RAM: 1x HM6116LP-3 near ROMs 0 to 4 | |
| 708 | 1x M58725P near ROMs 0 to 4 | |
| 709 | 2x M58725P near ROMs 6 to 9 | |
| 710 | ||
| 711 | Xtal: 10 MHz. | |
| 712 | ||
| 713 | DIP SW: 4x 8 DSW banks. | |
| 714 | ||
| 715 | ||
| 716 | --------------------------------- | |
| 717 | ||
| 718 | Not from Wing. | |
| 719 | It's a multi cards game produced in 1983, called "Spiel Bud" (Play Booth) | |
| 720 | Language: german. | |
| 721 | ||
| 722 | Roms have stickers with only a number, so were renamed from lwing to spielbud. | |
| 723 | ||
| 724 | */ | |
| 725 | ||
| 726 | ROM_START( spielbud ) | |
| 727 | ROM_REGION( 0x20000, "main", 0 ) | |
| 728 | ROM_LOAD( "spielbud.00", 0x0000, 0x2000, CRC(201c7f19) SHA1(fb902824d1f6cfdf7ba124fca4c680af099ca4e1) ) | |
| 729 | ROM_LOAD( "spielbud.01", 0x2000, 0x2000, CRC(16339de8) SHA1(00b14c6bca268b98bfb6ac9840d59b9a64d43b92) ) | |
| 730 | ROM_LOAD( "spielbud.02", 0x4000, 0x2000, CRC(c791e75b) SHA1(b0276a82302a194fc1ab2608440a5bf1efe99e64) ) | |
| 731 | ROM_LOAD( "spielbud.03", 0x7000, 0x2000, CRC(ddc60075) SHA1(592dc1f9ff00e703ed1c06fd037aa32569b19143) ) | |
| 732 | ROM_LOAD( "spielbud.04", 0x9000, 0x2000, CRC(74f1ca60) SHA1(17a67beb00d9c4b3310930ad5c5f566b801634d7) ) | |
| 733 | ||
| 734 | ROM_REGION( 0xc000, "gfx1", 0 ) | |
| 735 | ROM_LOAD( "spielbud.08", 0x0000, 0x4000, CRC(4a4ebe62) SHA1(5d789f2eea61864cd55f20a7697304daaff105c4) ) | |
| 736 | ROM_LOAD( "spielbud.07", 0x4000, 0x4000, CRC(33c0064e) SHA1(bb4b80359b36b0b34e0d31ee1f18fd64b92ed342) ) | |
| 737 | ROM_LOAD( "spielbud.06", 0x8000, 0x4000, CRC(bb2b6fd3) SHA1(5adb543c1d10aaede08609463f2ce82c5a68aca8) ) | |
| 738 | ||
| 739 | ROM_REGION( 0x4000, "gfx2", 0 ) | |
| 740 | ROM_LOAD( "spielbud.09", 0x0000, 0x2000, CRC(d88c72f2) SHA1(bb015685f4c2cc7723c24880c11cb6d31f71e73f) ) | |
| 741 | ROM_END | |
| 742 | ||
| 743 | ||
| 565 | 744 | /********************************************* |
| 566 | 745 | * Game Drivers * |
| 567 | 746 | ********************************************** |
| 568 | 747 | |
| 569 | YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS */ | |
| 570 | GAME( 1985, slotcarn, 0, slotcarn, slotcarn, 0, ROT0, "Wing Co.Ltd", "Slot Carnival", GAME_NOT_WORKING ) | |
| 571 | ||
| 748 | YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS */ | |
| 749 | GAME( 1985, slotcarn, 0, slotcarn, slotcarn, 0, ROT0, "Wing Co.Ltd", "Slot Carnival", GAME_NOT_WORKING ) | |
| 750 | GAME( 1985, spielbud, 0, slotcarn, spielbud, 0, ROT0, "ADP", "Spiel Bude (German)", GAME_NOT_WORKING ) |
| r4135 | r4136 | |
|---|---|---|
| 180 | 180 | { |
| 181 | 181 | case 0: /* DRAM mode is write only */ |
| 182 | 182 | return 0xffff; |
| 183 | break; | |
| 184 | 183 | case 0x80: /* return Z80 CPU Function Stop Accessible or not */ |
| 185 | 184 | /* logerror("Returning z80 state\n"); */ |
| 186 | 185 | return (z80running ? 0x0100 : 0x0); |
| 187 | break; | |
| 188 | 186 | case 0x100: /* Z80 CPU Reset - write only */ |
| 189 | 187 | return 0xffff; |
| 190 | break; | |
| 191 | 188 | } |
| 192 | 189 | return 0x00; |
| 193 | 190 | |
| r4135 | r4136 | |
| 204 | 201 | { |
| 205 | 202 | case 0: /* set DRAM mode... we have to ignore this for production cartridges */ |
| 206 | 203 | return; |
| 207 | break; | |
| 208 | 204 | case 0x80: /* Z80 BusReq */ |
| 209 | 205 | if (data == 0x100) |
| 210 | 206 | { |
| r4135 | r4136 | |
| 221 | 217 | /* logerror("z80 started, BusReq ends\n"); */ |
| 222 | 218 | } |
| 223 | 219 | return; |
| 224 | break; | |
| 225 | 220 | case 0x100: /* Z80 CPU Reset */ |
| 226 | 221 | if (data == 0x00) |
| 227 | 222 | { |
| r4135 | r4136 | |
| 238 | 233 | /* logerror("z80 out of reset\n"); */ |
| 239 | 234 | } |
| 240 | 235 | return; |
| 241 | ||
| 242 | break; | |
| 243 | 236 | } |
| 244 | 237 | } |
| 245 | 238 |
| r4135 | r4136 | |
|---|---|---|
| 185 | 185 | ADDRESS_MAP_END |
| 186 | 186 | |
| 187 | 187 | static ADDRESS_MAP_START( intrepid_main_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 188 | AM_RANGE(0x0000, 0x | |
| 188 | AM_RANGE(0x0000, 0x7fff) AM_ROM | |
| 189 | 189 | AM_RANGE(0x8000, 0x87ff) AM_RAM |
| 190 | 190 | AM_RANGE(0x8c00, 0x8fff) AM_READWRITE(thepit_colorram_r, thepit_colorram_w) /* mirror for intrepi2 */ |
| 191 | 191 | AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(thepit_videoram_w) AM_BASE(&thepit_videoram) |
| r4135 | r4136 | |
|---|---|---|
| 143 | 143 | static WRITE8_HANDLER( trvmadns_gfxram_w ) |
| 144 | 144 | { |
| 145 | 145 | trvmadns_gfxram[offset] = data; |
| 146 | decodechar(space->machine->gfx[0], offset/16, trvmadns_gfxram); | |
| 147 | ||
| 148 | tilemap_mark_all_tiles_dirty(bg_tilemap); | |
| 146 | gfx_element_mark_dirty(space->machine->gfx[0], offset/16); | |
| 149 | 147 | } |
| 150 | 148 | |
| 151 | 149 | #ifdef UNUSED_FUNCTION |
| r4135 | r4136 | |
| 268 | 266 | bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); |
| 269 | 267 | |
| 270 | 268 | tilemap_set_transparent_pen(bg_tilemap,1); |
| 269 | ||
| 270 | gfx_element_set_source(machine->gfx[0], trvmadns_gfxram); | |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | static VIDEO_UPDATE( trvmadns ) |
| r4135 | r4136 | |
|---|---|---|
| 35 | 35 | |
| 36 | 36 | #define SOUND_TEST 0 |
| 37 | 37 | |
| 38 | VIDEO_START(bingoc) | |
| 38 | static VIDEO_START(bingoc) | |
| 39 | 39 | { |
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | VIDEO_UPDATE(bingoc) | |
| 43 | static VIDEO_UPDATE(bingoc) | |
| 44 | 44 | { |
| 45 | 45 | return 0; |
| 46 | 46 | } |
| r4135 | r4136 | |
|---|---|---|
| 242 | 242 | MDRV_QUANTUM_TIME(HZ(600)) |
| 243 | 243 | |
| 244 | 244 | MDRV_MACHINE_RESET(ajax) |
| 245 | MDRV_MACHINE_START(ajax) | |
| 245 | 246 | |
| 246 | 247 | /* video hardware */ |
| 247 | 248 | MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS) |
| r4135 | r4136 | |
| 436 | 437 | |
| 437 | 438 | |
| 438 | 439 | |
| 439 | GAME( 1987, ajax, 0, ajax, ajax, ajax, ROT90, "Konami", "Ajax", 0 ) | |
| 440 | GAME( 1987, typhoon, ajax, ajax, ajax, ajax, ROT90, "Konami", "Typhoon", 0 ) | |
| 441 | GAME( 1987, ajaxj, ajax, ajax, ajax, ajax, ROT90, "Konami", "Ajax (Japan)", 0 ) | |
| 440 | GAME( 1987, ajax, 0, ajax, ajax, ajax, ROT90, "Konami", "Ajax", GAME_SUPPORTS_SAVE ) | |
| 441 | GAME( 1987, typhoon, ajax, ajax, ajax, ajax, ROT90, "Konami", "Typhoon", GAME_SUPPORTS_SAVE ) | |
| 442 | GAME( 1987, ajaxj, ajax, ajax, ajax, ajax, ROT90, "Konami", "Ajax (Japan)", GAME_SUPPORTS_SAVE ) |
| r4135 | r4136 | |
|---|---|---|
| 951 | 951 | |
| 952 | 952 | void CreateSoundFolders(int parent_index) |
| 953 | 953 | { |
| 954 | int i,jj; | |
| 955 | int nGames = driver_list_get_count(drivers); | |
| 956 | int nFolder = numFolders; | |
| 957 | LPTREEFOLDER lpFolder = treeFolders[parent_index]; | |
| 958 | LPTREEFOLDER map[SOUND_COUNT]; | |
| 959 | ||
| 960 | sndintrf_init(NULL); | |
| 961 | ||
| 962 | // no games in top level folder | |
| 963 | SetAllBits(lpFolder->m_lpGameBits,FALSE); | |
| 964 | ||
| 965 | for (i = 1 ; i < SOUND_COUNT ; i++) | |
| 966 | { | |
| 967 | LPTREEFOLDER lpTemp; | |
| 968 | // Init to NULL here in case it doesn't get assigned below. | |
| 969 | map[i] = NULL; | |
| 970 | // empty fields get filled in with SOUND_DUMMY, so check for this and | |
| 971 | // don't add it | |
| 972 | if (strcmp(sndtype_get_name(SOUND_DUMMY), sndtype_get_name(i)) == 0) | |
| 973 | continue; | |
| 974 | ||
| 975 | lpTemp = NewFolder(sndtype_get_name(i), next_folder_id, parent_index, IDI_SOUND, | |
| 976 | GetFolderFlags(numFolders)); | |
| 977 | ExtraFolderData[next_folder_id] = malloc(sizeof(EXFOLDERDATA) ); | |
| 978 | memset(ExtraFolderData[next_folder_id], 0, sizeof(EXFOLDERDATA)); | |
| 979 | ||
| 980 | ExtraFolderData[next_folder_id]->m_nFolderId = next_folder_id; | |
| 981 | ExtraFolderData[next_folder_id]->m_nIconId = IDI_SOUND; | |
| 982 | ExtraFolderData[next_folder_id]->m_nParent = lpFolder->m_nFolderId; | |
| 983 | ExtraFolderData[next_folder_id]->m_nSubIconId = -1; | |
| 984 | strcpy( ExtraFolderData[next_folder_id]->m_szTitle, sndtype_get_name(i) ); | |
| 985 | ExtraFolderData[next_folder_id++]->m_dwFlags = 0; | |
| 986 | AddFolder(lpTemp); | |
| 987 | map[i] = treeFolders[nFolder++]; | |
| 988 | } | |
| 989 | ||
| 990 | for (jj = 0; jj < nGames; jj++) | |
| 991 | { | |
| 992 | int n; | |
| 993 | machine_config *config; | |
| 994 | ||
| 995 | config = machine_config_alloc(drivers[jj]->machine_config); | |
| 996 | for (n = 0; n < MAX_SOUND ; n++) { | |
| 997 | if (config->sound[n].type != SOUND_DUMMY) | |
| 998 | // { | |
| 999 | // if (map[config->sound[n].type] != NULL) { | |
| 1000 | // sound type #'s are one-based, though that doesn't affect us here | |
| 1001 | AddGame(map[config->sound[n].type],jj); | |
| 1002 | // } | |
| 1003 | // } | |
| 1004 | } | |
| 1005 | machine_config_free(config); | |
| 1006 | } | |
| 1007 | ||
| 954 | CreateDeviceFolders(parent_index, DEVICE_CLASS_SOUND_CHIP, IDI_SOUND); | |
| 1008 | 955 | } |
| 1009 | 956 | |
| 1010 | 957 | void CreateDeficiencyFolders(int parent_index) |
| r4135 | r4136 | |
|---|---|---|
| 137 | 137 | #include "winmain.h" |
| 138 | 138 | #include "strconv.h" |
| 139 | 139 | #include "winutf8.h" |
| 140 | #include "sound/2413intf.h" | |
| 141 | #include "sound/3812intf.h" | |
| 140 | 142 | |
| 141 | 143 | typedef HANDLE HTHEME; |
| 142 | 144 | |
| r4135 | r4136 | |
| 651 | 653 | { |
| 652 | 654 | if (config->sound[chipnum].type != SOUND_DUMMY) |
| 653 | 655 | { |
| 654 | int clock,sound_type,count; | |
| 656 | int clock,count; | |
| 657 | sound_type sound_type_; | |
| 655 | 658 | |
| 656 | sound_type = config->sound[chipnum].type; | |
| 659 | sound_type_ = config->sound[chipnum].type; | |
| 657 | 660 | clock = config->sound[chipnum].clock; |
| 658 | 661 | |
| 659 | 662 | count = 1; |
| r4135 | r4136 | |
| 661 | 664 | |
| 662 | 665 | /* Matching chips at the same clock are aggregated */ |
| 663 | 666 | while (chipnum < ARRAY_LENGTH(config->sound) |
| 664 | && config->sound[chipnum].type == sound_type | |
| 667 | && config->sound[chipnum].type == sound_type_ | |
| 665 | 668 | && config->sound[chipnum].clock == clock) |
| 666 | 669 | { |
| 667 | 670 | count++; |
| r4135 | r4136 | |
| 673 | 676 | sprintf(&buf[strlen(buf)],"%dx",count); |
| 674 | 677 | } |
| 675 | 678 | |
| 676 | sprintf(&buf[strlen(buf)],"%s",sndtype_get_name(sound_type)); | |
| 679 | sprintf(&buf[strlen(buf)],"%s",sndtype_get_name(sound_type_)); | |
| 677 | 680 | |
| 678 | 681 | if (clock) |
| 679 | 682 | { |
| r4135 | r4136 | |
|---|---|---|
| 1735 | 1735 | |
| 1736 | 1736 | UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, int arg) |
| 1737 | 1737 | { |
| 1738 | UINT64 result = ~(UINT64)0 & (~(UINT64)0 >> (64 - 8*size)), result2; | |
| 1738 | 1739 | cpu_debug_data *info = cpu_get_debug_data(space->cpu); |
| 1739 | offs_t lowbits_mask; | |
| 1740 | const void *ptr; | |
| 1741 | 1740 | |
| 1742 | 1741 | /* keep in logical range */ |
| 1743 | 1742 | address &= space->logbytemask; |
| r4135 | r4136 | |
| 1765 | 1764 | |
| 1766 | 1765 | /* translate to physical first */ |
| 1767 | 1766 | if (!debug_cpu_translate(space, TRANSLATE_FETCH_DEBUG, &address)) |
| 1768 | return | |
| 1767 | return r | |
| 1769 | 1768 | |
| 1770 | 1769 | /* keep in physical range */ |
| 1771 | 1770 | address &= space->bytemask; |
| r4135 | r4136 | |
| 1822 | 1821 | break; |
| 1823 | 1822 | } |
| 1824 | 1823 | |
| 1825 | /* get pointer to data */ | |
| 1826 | /* note that we query aligned to the bus width, and then add back the low bits */ | |
| 1827 | lowbits_mask = space->dbits / 8 - 1; | |
| 1828 | if (!arg) | |
| 1829 | ptr = memory_decrypted_read_ptr(space, address & ~lowbits_mask); | |
| 1830 | else | |
| 1831 | ptr = memory_raw_read_ptr(space, address & ~lowbits_mask); | |
| 1832 | if (ptr == NULL) | |
| 1833 | return ~(UINT64)0 & (~(UINT64)0 >> (64 - 8*size)); | |
| 1834 | ptr = (UINT8 *)ptr + (address & lowbits_mask); | |
| 1835 | ||
| 1836 | /* return based on the size */ | |
| 1824 | /* switch off the size and handle unaligned accesses */ | |
| 1837 | 1825 | switch (size) |
| 1838 | 1826 | { |
| 1839 | case 1: return *(UINT8 *) ptr; | |
| 1840 | case 2: return *(UINT16 *)ptr; | |
| 1841 | case 4: return *(UINT32 *)ptr; | |
| 1842 | case 8: return *(UINT64 *)ptr; | |
| 1827 | case 1: | |
| 1828 | result = (arg) ? memory_raw_read_byte(space, address) : memory_decrypted_read_byte(space, address); | |
| 1829 | break; | |
| 1830 | ||
| 1831 | case 2: | |
| 1832 | result = (arg) ? memory_raw_read_word(space, address & ~1) : memory_decrypted_read_word(space, address & ~1); | |
| 1833 | if ((address & 1) != 0) | |
| 1834 | { | |
| 1835 | result2 = (arg) ? memory_raw_read_word(space, (address & ~1) + 2) : memory_decrypted_read_word(space, (address & ~1) + 2); | |
| 1836 | if (space->endianness == ENDIANNESS_LITTLE) | |
| 1837 | result = (result >> (8 * (address & 1))) | (result2 << (16 - 8 * (address & 1))); | |
| 1838 | else | |
| 1839 | result = (result << (8 * (address & 1))) | (result2 >> (16 - 8 * (address & 1))); | |
| 1840 | result &= 0xffff; | |
| 1841 | } | |
| 1842 | break; | |
| 1843 | ||
| 1844 | case 4: | |
| 1845 | result = (arg) ? memory_raw_read_dword(space, address & ~3) : memory_decrypted_read_dword(space, address & ~3); | |
| 1846 | if ((address & 3) != 0) | |
| 1847 | { | |
| 1848 | result2 = (arg) ? memory_raw_read_dword(space, (address & ~3) + 4) : memory_decrypted_read_dword(space, (address & ~3) + 4); | |
| 1849 | if (space->endianness == ENDIANNESS_LITTLE) | |
| 1850 | result = (result >> (8 * (address & 3))) | (result2 << (32 - 8 * (address & 3))); | |
| 1851 | else | |
| 1852 | result = (result << (8 * (address & 3))) | (result2 >> (32 - 8 * (address & 3))); | |
| 1853 | result &= 0xffffffff; | |
| 1854 | } | |
| 1855 | break; | |
| 1856 | ||
| 1857 | case 8: | |
| 1858 | result = (arg) ? memory_raw_read_qword(space, address & ~7) : memory_decrypted_read_qword(space, address & ~7); | |
| 1859 | if ((address & 7) != 0) | |
| 1860 | { | |
| 1861 | result2 = (arg) ? memory_raw_read_qword(space, (address & ~7) + 8) : memory_decrypted_read_qword(space, (address & ~7) + 8); | |
| 1862 | if (space->endianness == ENDIANNESS_LITTLE) | |
| 1863 | result = (result >> (8 * (address & 7))) | (result2 << (64 - 8 * (address & 7))); | |
| 1864 | else | |
| 1865 | result = (result << (8 * (address & 7))) | (result2 >> (64 - 8 * (address & 7))); | |
| 1866 | } | |
| 1867 | break; | |
| 1843 | 1868 | } |
| 1844 | ||
| 1845 | return 0; /* appease compiler */ | |
| 1869 | return result; | |
| 1846 | 1870 | } |
| 1847 | 1871 | |
| 1848 | 1872 |
| r4135 | r4136 | |
|---|---|---|
| 73 | 73 | return h8_disasm(buffer, pc, oprom, opram, 0xffff); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | void h8_300_InterruptRequest(h83xx_state *h8, UINT8 source) | |
| 76 | static void h8_300_InterruptRequest(h83xx_state *h8, UINT8 source) | |
| 77 | 77 | { |
| 78 | 78 | if(source>31) |
| 79 | 79 | { |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | #include "cpuintrf.h" |
| 16 | 16 | |
| 17 | #ifndef INLINE | |
| 18 | #define INLINE static inline | |
| 19 | #endif | |
| 20 | ||
| 21 | 17 | /* Size of the memory buffer allocated for the shiftr register */ |
| 22 | 18 | #define SHIFTREG_SIZE (8 * 512 * sizeof(UINT16)) |
| 23 | 19 |
| r4135 | r4136 | |
|---|---|---|
| 404 | 404 | { |
| 405 | 405 | case 2: // p0 |
| 406 | 406 | return memory_read_byte_8le(cpustate->io, M37710_PORT0); |
| 407 | break; | |
| 408 | 407 | case 3: // p1 |
| 409 | 408 | return memory_read_byte_8le(cpustate->io, M37710_PORT1); |
| 410 | break; | |
| 411 | 409 | case 6: // p2 |
| 412 | 410 | return memory_read_byte_8le(cpustate->io, M37710_PORT2); |
| 413 | break; | |
| 414 | 411 | case 7: // p3 |
| 415 | 412 | return memory_read_byte_8le(cpustate->io, M37710_PORT3); |
| 416 | break; | |
| 417 | 413 | case 0xa: // p4 |
| 418 | 414 | return memory_read_byte_8le(cpustate->io, M37710_PORT4); |
| 419 | break; | |
| 420 | 415 | case 0xb: // p5 |
| 421 | 416 | return memory_read_byte_8le(cpustate->io, M37710_PORT5); |
| 422 | break; | |
| 423 | 417 | case 0xe: // p6 |
| 424 | 418 | return memory_read_byte_8le(cpustate->io, M37710_PORT6); |
| 425 | break; | |
| 426 | 419 | case 0xf: // p7 |
| 427 | 420 | return memory_read_byte_8le(cpustate->io, M37710_PORT7); |
| 428 | break; | |
| 429 | 421 | case 0x12: // p8 |
| 430 | 422 | return memory_read_byte_8le(cpustate->io, M37710_PORT8); |
| 431 | break; | |
| 432 | 423 | |
| 433 | 424 | case 0x20: |
| 434 | 425 | return memory_read_byte_8le(cpustate->io, M37710_ADC0_L); |
| 435 | break; | |
| 436 | 426 | case 0x21: |
| 437 | 427 | return memory_read_byte_8le(cpustate->io, M37710_ADC0_H); |
| 438 | break; | |
| 439 | 428 | case 0x22: |
| 440 | 429 | return memory_read_byte_8le(cpustate->io, M37710_ADC1_L); |
| 441 | break; | |
| 442 | 430 | case 0x23: |
| 443 | 431 | return memory_read_byte_8le(cpustate->io, M37710_ADC1_H); |
| 444 | break; | |
| 445 | 432 | case 0x24: |
| 446 | 433 | return memory_read_byte_8le(cpustate->io, M37710_ADC2_L); |
| 447 | break; | |
| 448 | 434 | case 0x25: |
| 449 | 435 | return memory_read_byte_8le(cpustate->io, M37710_ADC2_H); |
| 450 | break; | |
| 451 | 436 | case 0x26: |
| 452 | 437 | return memory_read_byte_8le(cpustate->io, M37710_ADC3_L); |
| 453 | break; | |
| 454 | 438 | case 0x27: |
| 455 | 439 | return memory_read_byte_8le(cpustate->io, M37710_ADC3_H); |
| 456 | break; | |
| 457 | 440 | case 0x28: |
| 458 | 441 | return memory_read_byte_8le(cpustate->io, M37710_ADC4_L); |
| 459 | break; | |
| 460 | 442 | case 0x29: |
| 461 | 443 | return memory_read_byte_8le(cpustate->io, M37710_ADC4_H); |
| 462 | break; | |
| 463 | 444 | case 0x2a: |
| 464 | 445 | return memory_read_byte_8le(cpustate->io, M37710_ADC5_L); |
| 465 | break; | |
| 466 | 446 | case 0x2b: |
| 467 | 447 | return memory_read_byte_8le(cpustate->io, M37710_ADC5_H); |
| 468 | break; | |
| 469 | 448 | case 0x2c: |
| 470 | 449 | return memory_read_byte_8le(cpustate->io, M37710_ADC6_L); |
| 471 | break; | |
| 472 | 450 | case 0x2d: |
| 473 | 451 | return memory_read_byte_8le(cpustate->io, M37710_ADC6_H); |
| 474 | break; | |
| 475 | 452 | case 0x2e: |
| 476 | 453 | return memory_read_byte_8le(cpustate->io, M37710_ADC7_L); |
| 477 | break; | |
| 478 | 454 | case 0x2f: |
| 479 | 455 | return memory_read_byte_8le(cpustate->io, M37710_ADC7_H); |
| 480 | break; | |
| 481 | 456 | case 0x35: |
| 482 | 457 | return 0xff; // UART control |
| 483 | break; | |
| 484 | 458 | |
| 485 | 459 | case 0x70: // A/D IRQ control |
| 486 | 460 | return cpustate->m37710_regs[offset] | 8; |
| 487 | break; | |
| 488 | 461 | } |
| 489 | 462 | |
| 490 | 463 | return cpustate->m37710_regs[offset]; |
| r4135 | r4136 | |
| 499 | 472 | case 2: // p0 |
| 500 | 473 | memory_write_byte_8le(cpustate->io, M37710_PORT0, data); |
| 501 | 474 | return; |
| 502 | break; | |
| 503 | 475 | case 3: // p1 |
| 504 | 476 | memory_write_byte_8le(cpustate->io, M37710_PORT1, data); |
| 505 | 477 | return; |
| 506 | break; | |
| 507 | 478 | case 6: // p2 |
| 508 | 479 | memory_write_byte_8le(cpustate->io, M37710_PORT2, data); |
| 509 | 480 | return; |
| 510 | break; | |
| 511 | 481 | case 7: // p3 |
| 512 | 482 | memory_write_byte_8le(cpustate->io, M37710_PORT3, data); |
| 513 | 483 | return; |
| 514 | break; | |
| 515 | 484 | case 0xa: // p4 |
| 516 | 485 | memory_write_byte_8le(cpustate->io, M37710_PORT4, data); |
| 517 | 486 | return; |
| 518 | break; | |
| 519 | 487 | case 0xb: // p5 |
| 520 | 488 | memory_write_byte_8le(cpustate->io, M37710_PORT5, data); |
| 521 | 489 | return; |
| 522 | break; | |
| 523 | 490 | case 0xe: // p6 |
| 524 | 491 | memory_write_byte_8le(cpustate->io, M37710_PORT6, data); |
| 525 | 492 | return; |
| 526 | break; | |
| 527 | 493 | case 0xf: // p7 |
| 528 | 494 | memory_write_byte_8le(cpustate->io, M37710_PORT7, data); |
| 529 | 495 | return; |
| 530 | break; | |
| 531 | 496 | case 0x12: // p8 |
| 532 | 497 | memory_write_byte_8le(cpustate->io, M37710_PORT8, data); |
| 533 | 498 | return; |
| 534 | break; | |
| 535 | 499 | |
| 536 | 500 | case 0x40: // count start |
| 537 | 501 | for (i = 0; i < 8; i++) |
| r4135 | r4136 | |
| 546 | 510 | cpustate->m37710_regs[offset] = data; |
| 547 | 511 | |
| 548 | 512 | return; |
| 549 | break; | |
| 550 | 513 | |
| 551 | 514 | case 0x60: // watchdog reset |
| 552 | 515 | return; |
| 553 | break; | |
| 554 | 516 | } |
| 555 | 517 | |
| 556 | 518 | cpustate->m37710_regs[offset] = data; |
| r4135 | r4136 | |
| 841 | 803 | } |
| 842 | 804 | |
| 843 | 805 | /* Exit and clean up */ |
| 844 | CPU_EXIT( m37710 ) | |
| 806 | static CPU_EXIT( m37710 ) | |
| 845 | 807 | { |
| 846 | 808 | /* nothing to do yet */ |
| 847 | 809 | } |
| r4135 | r4136 | |
| 888 | 850 | FTABLE_SET_REG(cpustate, regnum, value); |
| 889 | 851 | } |
| 890 | 852 | |
| 891 | /* Load a CPU state */ | |
| 892 | void m37710_state_load(void *file) | |
| 893 | { | |
| 894 | } | |
| 895 | ||
| 896 | /* Save the current CPU state */ | |
| 897 | void m37710_state_save(void *file) | |
| 898 | { | |
| 899 | } | |
| 900 | ||
| 901 | 853 | /* Set an interrupt line */ |
| 902 | 854 | static void m37710_set_irq_line(m37710i_cpu_struct *cpustate, int line, int state) |
| 903 | 855 | { |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | #define ADDRESS_24BIT(A) ((A)&0xffffff) |
| 18 | 18 | |
| 19 | #ifndef INLINE | |
| 20 | #define INLINE static | |
| 21 | #endif | |
| 22 | ||
| 23 | 19 | typedef struct |
| 24 | 20 | { |
| 25 | 21 | unsigned char name; |
| r4135 | r4136 | |
|---|---|---|
| 2862 | 2862 | cpustate->m37710_regs[m37710_irq_levels[line]] |= 8; |
| 2863 | 2863 | } |
| 2864 | 2864 | return; |
| 2865 | break; | |
| 2866 | 2865 | case ASSERT_LINE: |
| 2867 | 2866 | case PULSE_LINE: |
| 2868 | 2867 | case HOLD_LINE: |
| r4135 | r4136 | |
|---|---|---|
| 21 | 21 | /* ================================= MAME ================================= */ |
| 22 | 22 | /* ======================================================================== */ |
| 23 | 23 | |
| 24 | /* Clean up after the emulation core - Not used in this core - */ | |
| 25 | CPU_EXIT( m37710 ); | |
| 26 | ||
| 27 | /* Save the current CPU state to disk */ | |
| 28 | void m37710_state_save(void *file); | |
| 29 | ||
| 30 | /* Load a CPU state from disk */ | |
| 31 | void m37710_state_load(void *file); | |
| 32 | ||
| 33 | 24 | #undef M37710_CALL_DEBUGGER |
| 34 | 25 | |
| 35 | 26 | #define M37710_CALL_DEBUGGER(x) debugger_instruction_hook(cpustate->device, x) |
| r4135 | r4136 | |
| 46 | 37 | /* ================================ GENERAL =============================== */ |
| 47 | 38 | /* ======================================================================== */ |
| 48 | 39 | |
| 49 | /* Fallback on static if we don't have inline */ | |
| 50 | #ifndef INLINE | |
| 51 | #define INLINE static | |
| 52 | #endif | |
| 53 | ||
| 54 | 40 | /* This should be set to the default size of your processor (min 16 bit) */ |
| 55 | 41 | #undef uint |
| 56 | 42 | #define uint unsigned int |
| r4135 | r4136 | |
|---|---|---|
| 300 | 300 | |
| 301 | 301 | |
| 302 | 302 | #------------------------------------------------- |
| 303 | # National Semiconductor COP4 | |
| 303 | # National Semiconductor COP400 family | |
| 304 | 304 | #------------------------------------------------- |
| 305 | 305 | |
| 306 | CPUDEFS += -DHAS_COP401=$(if $(filter COP401,$(CPUS)),1,0) | |
| 307 | CPUDEFS += -DHAS_COP410=$(if $(filter COP410,$(CPUS)),1,0) | |
| 308 | CPUDEFS += -DHAS_COP411=$(if $(filter COP411,$(CPUS)),1,0) | |
| 309 | CPUDEFS += -DHAS_COP402=$(if $(filter COP402,$(CPUS)),1,0) | |
| 310 | CPUDEFS += -DHAS_COP420=$(if $(filter COP420,$(CPUS)),1,0) | |
| 311 | CPUDEFS += -DHAS_COP421=$(if $(filter COP421,$(CPUS)),1,0) | |
| 312 | CPUDEFS += -DHAS_COP422=$(if $(filter COP421,$(CPUS)),1,0) | |
| 313 | CPUDEFS += -DHAS_COP404=$(if $(filter COP404,$(CPUS)),1,0) | |
| 314 | CPUDEFS += -DHAS_COP424=$(if $(filter COP424,$(CPUS)),1,0) | |
| 315 | CPUDEFS += -DHAS_COP425=$(if $(filter COP425,$(CPUS)),1,0) | |
| 316 | CPUDEFS += -DHAS_COP426=$(if $(filter COP426,$(CPUS)),1,0) | |
| 317 | CPUDEFS += -DHAS_COP444=$(if $(filter COP444,$(CPUS)),1,0) | |
| 318 | CPUDEFS += -DHAS_COP445=$(if $(filter COP445,$(CPUS)),1,0) | |
| 306 | CPUDEFS += -DHAS_COP400=$(if $(filter COP400,$(CPUS)),1,0) | |
| 319 | 307 | |
| 320 | ifneq ($(filter COP40 | |
| 308 | ifneq ($(filter COP40 | |
| 321 | 309 | OBJDIRS += $(CPUOBJ)/cop400 |
| 322 | CPUOBJS += $(CPUOBJ)/cop400/cop4 | |
| 310 | CPUOBJS += $(CPUOBJ)/cop400/cop400.o | |
| 323 | 311 | DBGOBJS += $(CPUOBJ)/cop400/cop410ds.o |
| 324 | endif | |
| 325 | ||
| 326 | ifneq ($(filter COP402 COP420 COP421 COP422,$(CPUS)),) | |
| 327 | OBJDIRS += $(CPUOBJ)/cop400 | |
| 328 | CPUOBJS += $(CPUOBJ)/cop400/cop420.o | |
| 329 | 312 | DBGOBJS += $(CPUOBJ)/cop400/cop420ds.o |
| 330 | endif | |
| 331 | ||
| 332 | ifneq ($(filter COP404 COP424 COP425 COP426 COP444 COP445,$(CPUS)),) | |
| 333 | OBJDIRS += $(CPUOBJ)/cop400 | |
| 334 | CPUOBJS += $(CPUOBJ)/cop400/cop440.o | |
| 335 | 313 | DBGOBJS += $(CPUOBJ)/cop400/cop440ds.o |
| 336 | 314 | endif |
| 337 | 315 | |
| 338 | $(CPUOBJ)/cop400/cop4 | |
| 316 | $(CPUOBJ)/cop400/cop4 | |
| 339 | 317 | $(CPUSRC)/cop400/cop400.h \ |
| 340 | $(CPUSRC)/cop400/4 | |
| 318 | $(CPUSRC)/cop400/cop4 | |
| 341 | 319 | |
| 342 | $(CPUOBJ)/cop400/cop420.o: $(CPUSRC)/cop400/cop420.c \ | |
| 343 | $(CPUSRC)/cop400/cop400.h \ | |
| 344 | $(CPUSRC)/cop400/410ops.c \ | |
| 345 | $(CPUSRC)/cop400/420ops.c | |
| 346 | 320 | |
| 347 | $(CPUOBJ)/cop400/cop440.o: $(CPUSRC)/cop400/cop440.c \ | |
| 348 | $(CPUSRC)/cop400/cop400.h \ | |
| 349 | $(CPUSRC)/cop400/410ops.c \ | |
| 350 | $(CPUSRC)/cop400/420ops.c \ | |
| 351 | $(CPUSRC)/cop400/440ops.c | |
| 352 | 321 | |
| 353 | ||
| 354 | 322 | #------------------------------------------------- |
| 355 | 323 | # CP1610 |
| 356 | 324 | #------------------------------------------------- |
| r4135 | r4136 | |
| 776 | 744 | ifneq ($(filter I860,$(CPUS)),) |
| 777 | 745 | OBJDIRS += $(CPUOBJ)/i860 |
| 778 | 746 | CPUOBJS += $(CPUOBJ)/i860/i860.o |
| 779 | DBGOBJS += $(CPUOBJ)/i860/i860d | |
| 747 | DBGOBJS += $(CPUOBJ)/i860/i860dis | |
| 780 | 748 | endif |
| 781 | 749 | |
| 782 | $(CPUOBJ)/i860/i860.o: $(CPUSRC)/i860/i860.c \ | |
| 783 | $(CPUSRC)/i860/i860.h | |
| 750 | $(CPUOBJ)/i860/i860.o: $(CPUSRC)/i860/i860.c \ | |
| 751 | $(CPUSRC)/i860/i860.h \ | |
| 752 | $(CPUSRC)/i860/i860dec.c | |
| 784 | 753 | |
| 785 | ||
| 786 | 754 | #------------------------------------------------- |
| 787 | 755 | # Intel i960 |
| 788 | 756 | #------------------------------------------------- |
| r4135 | r4136 | |
|---|---|---|
| 1058 | 1058 | case 0: |
| 1059 | 1059 | cpustate->amout = OpRead8(cpustate->program, cpustate->modadd + 1); |
| 1060 | 1060 | return 2; |
| 1061 | break; | |
| 1062 | 1061 | |
| 1063 | 1062 | case 1: |
| 1064 | 1063 | cpustate->amout = OpRead16(cpustate->program, cpustate->modadd + 1); |
| 1065 | 1064 | return 3; |
| 1066 | break; | |
| 1067 | 1065 | |
| 1068 | 1066 | case 2: |
| 1069 | 1067 | cpustate->amout = OpRead32(cpustate->program, cpustate->modadd + 1); |
| 1070 | 1068 | return 5; |
| 1071 | break; | |
| 1072 | 1069 | } |
| 1073 | 1070 | |
| 1074 | 1071 | // It should not be here! Written to avoid warning |
| r4135 | r4136 | |
|---|---|---|
| 721 | 721 | // Interrupt Control Register (ICR) |
| 722 | 722 | case 0x00: |
| 723 | 723 | return ICR; |
| 724 | break; | |
| 725 | 724 | |
| 726 | 725 | // Command Vector Register (CVR) |
| 727 | 726 | case 0x01: |
| 728 | 727 | return CVR; |
| 729 | break; | |
| 730 | 728 | |
| 731 | 729 | // Interrupt status register (ISR) |
| 732 | 730 | case 0x02: |
| 733 | 731 | return ISR; |
| 734 | break; | |
| 735 | 732 | |
| 736 | 733 | // Interrupt vector register (IVR) |
| 737 | 734 | case 0x03: |
| 738 | 735 | return IVR; |
| 739 | break; | |
| 740 | 736 | |
| 741 | 737 | // Read zeroes |
| 742 | 738 | case 0x04: |
| 743 | 739 | return 0x00; |
| 744 | break; | |
| 745 | 740 | |
| 746 | 741 | // Reserved |
| 747 | 742 | case 0x05: |
| r4135 | r4136 | |
|---|---|---|
| 4345 | 4345 | |
| 4346 | 4346 | switch(q) |
| 4347 | 4347 | { |
| 4348 | case 0x0: /* No permanent changes */ ; return (*rX)+(*nX); break; | |
| 4349 | case 0x1: (*rX)--; return (*rX); break; // This one is special - it's a *PRE-decrement*! | |
| 4348 | case 0x0: /* No permanent changes */ ; return (*rX)+(*nX); | |
| 4349 | case 0x1: (*rX)--; return (*rX); // This one is special - it's a *PRE-decrement*! | |
| 4350 | 4350 | } |
| 4351 | 4351 | |
| 4352 | 4352 | /* Should not get here */ |
| r4135 | r4136 | |
|---|---|---|
| 2659 | 2659 | { |
| 2660 | 2660 | switch(BBB) |
| 2661 | 2661 | { |
| 2662 | case 0x4: return BBB_UPPER ; break; | |
| 2663 | case 0x2: return BBB_MIDDLE; break; | |
| 2664 | case 0x1: return BBB_LOWER ; break; | |
| 2662 | case 0x4: return BBB_UPPER; | |
| 2663 | case 0x2: return BBB_MIDDLE; | |
| 2664 | case 0x1: return BBB_LOWER; | |
| 2665 | 2665 | } |
| 2666 | 2666 | |
| 2667 | 2667 | return BBB_LOWER; /* Not really safe... */ |
| r4135 | r4136 | |
|---|---|---|
| 12 | 12 | /* ============================= Configuration ============================ */ |
| 13 | 13 | /* ======================================================================== */ |
| 14 | 14 | |
| 15 | #ifndef INLINE | |
| 16 | #define INLINE static | |
| 17 | #endif | |
| 18 | ||
| 19 | 15 | #undef uint |
| 20 | 16 | #define uint unsigned int |
| 21 | 17 |
| r4135 | r4136 | |
|---|---|---|
| 19 | 19 | #include "spc700ds.h" |
| 20 | 20 | |
| 21 | 21 | |
| 22 | #ifndef INLINE | |
| 23 | #define INLINE static | |
| 24 | #endif | |
| 25 | 22 | |
| 26 | ||
| 27 | 23 | typedef struct |
| 28 | 24 | { |
| 29 | 25 | unsigned char name; |
| r4135 | r4136 | |
|---|---|---|
| 101 | 101 | /* ==================== ARCHITECTURE-DEPENDANT DEFINES ==================== */ |
| 102 | 102 | /* ======================================================================== */ |
| 103 | 103 | |
| 104 | /* Fallback on static if we don't have inline */ | |
| 105 | #ifndef INLINE | |
| 106 | #define INLINE static | |
| 107 | #endif | |
| 108 | ||
| 109 | 104 | /* This should be set to the default size of your processor (min 16 bit) */ |
| 110 | 105 | #undef uint |
| 111 | 106 | #define uint unsigned int |
| r4135 | r4136 | |
| 259 | 254 | |
| 260 | 255 | |
| 261 | 256 | /* ======================================================================== */ |
| 262 | /* ============================= INTERFACE API ============================ */ | |
| 263 | /* ======================================================================== */ | |
| 264 | ||
| 265 | /* This is the interface, not the implementation. Please call the */ | |
| 266 | /* implementation APIs below. */ | |
| 267 | ||
| 268 | ||
| 269 | CPU_INIT( spc700 ); | |
| 270 | ||
| 271 | /* Pulse the RESET pin on the CPU */ | |
| 272 | CPU_RESET( spc700 ); | |
| 273 | ||
| 274 | /* Set the RESET line on the CPU */ | |
| 275 | void spc700_set_reset_line(spc700i_cpu *cpustate, int state, void* param); | |
| 276 | ||
| 277 | /* Clean up after the emulation core - Not used in this core - */ | |
| 278 | CPU_EXIT( spc700 ); | |
| 279 | ||
| 280 | /* Get the current Program Counter */ | |
| 281 | unsigned spc700_get_pc(spc700i_cpu *cpustate); | |
| 282 | ||
| 283 | /* Set the current Program Counter */ | |
| 284 | void spc700_set_pc(spc700i_cpu *cpustate,unsigned val); | |
| 285 | ||
| 286 | /* Get the current Stack Pointer */ | |
| 287 | unsigned spc700_get_sp(spc700i_cpu *cpustate); | |
| 288 | ||
| 289 | /* Set the current Stack Pointer */ | |
| 290 | void spc700_set_sp(spc700i_cpu *cpustate,unsigned val); | |
| 291 | ||
| 292 | /* Get a register from the core */ | |
| 293 | unsigned spc700_get_reg(spc700i_cpu *cpustate,int regnum); | |
| 294 | ||
| 295 | /* Set a register in the core */ | |
| 296 | void spc700_set_reg(spc700i_cpu *cpustate,int regnum, unsigned val); | |
| 297 | ||
| 298 | /* Note about NMI: | |
| 299 | * NMI is a one-shot trigger. In order to trigger NMI again, you must | |
| 300 | * clear NMI and then assert it again. | |
| 301 | */ | |
| 302 | void spc700_set_nmi_line(spc700i_cpu *cpustate,int state); | |
| 303 | ||
| 304 | /* Assert or clear the IRQ pin */ | |
| 305 | void spc700_set_irq_line(spc700i_cpu *cpustate,int line, int state); | |
| 306 | ||
| 307 | /* Set the callback that will be called when an interrupt is serviced */ | |
| 308 | void spc700_set_irq_callback(spc700i_cpu *cpustate,cpu_irq_callback callback); | |
| 309 | ||
| 310 | /* Get a formatted string representing a register and its contents */ | |
| 311 | const char *spc700_info(spc700i_cpu *cpustate,void *context, int regnum); | |
| 312 | ||
| 313 | ||
| 314 | /* Pulse the SO (Set Overflow) pin on the CPU */ | |
| 315 | void spc700_pulse_so(spc700i_cpu *cpustate); | |
| 316 | ||
| 317 | ||
| 318 | /* ======================================================================== */ | |
| 319 | 257 | /* ============================ UTILITY MACROS ============================ */ |
| 320 | 258 | /* ======================================================================== */ |
| 321 | 259 | |
| r4135 | r4136 | |
| 1299 | 1237 | /* ================================= API ================================== */ |
| 1300 | 1238 | /* ======================================================================== */ |
| 1301 | 1239 | |
| 1302 | CPU_INIT( spc700 ) | |
| 1240 | static CPU_INIT( spc700 ) | |
| 1303 | 1241 | { |
| 1304 | 1242 | spc700i_cpu *cpustate = device->token; |
| 1305 | 1243 | |
| r4135 | r4136 | |
| 1309 | 1247 | } |
| 1310 | 1248 | |
| 1311 | 1249 | |
| 1312 | CPU_RESET( spc700 ) | |
| 1250 | static CPU_RESET( spc700 ) | |
| 1313 | 1251 | { |
| 1314 | 1252 | spc700i_cpu *cpustate = device->token; |
| 1315 | 1253 | |
| r4135 | r4136 | |
| 1330 | 1268 | } |
| 1331 | 1269 | |
| 1332 | 1270 | /* Exit and clean up */ |
| 1333 | CPU_EXIT( spc700 ) | |
| 1271 | static CPU_EXIT( spc700 ) | |
| 1334 | 1272 | { |
| 1335 | 1273 | /* nothing to do yet */ |
| 1336 | 1274 | } |
| 1337 | 1275 | |
| 1338 | 1276 | |
| 1339 | /* Get the current Program Counter */ | |
| 1340 | unsigned spc700_get_pc(spc700i_cpu *cpustate) | |
| 1341 | { | |
| 1342 | return REG_PC; | |
| 1343 | } | |
| 1344 | ||
| 1345 | /* Set the Program Counter */ | |
| 1346 | void spc700_set_pc(spc700i_cpu *cpustate,unsigned val) | |
| 1347 | { | |
| 1348 | JUMP(cpustate, val); | |
| 1349 | } | |
| 1350 | ||
| 1351 | /* Get the current Stack Pointer */ | |
| 1352 | unsigned spc700_get_sp(spc700i_cpu *cpustate) | |
| 1353 | { | |
| 1354 | return REG_S + STACK_PAGE; | |
| 1355 | } | |
| 1356 | ||
| 1357 | /* Set the Stack Pointer */ | |
| 1358 | void spc700_set_sp(spc700i_cpu *cpustate,unsigned val) | |
| 1359 | { | |
| 1360 | REG_S = MAKE_UINT_8(val); | |
| 1361 | } | |
| 1362 | ||
| 1363 | 1277 | /* Assert or clear the NMI line of the CPU */ |
| 1364 | void spc700_set_nmi_line(spc700i_cpu *cpustate,int state) | |
| 1278 | static void spc700_set_nmi_line(spc700i_cpu *cpustate,int state) | |
| 1365 | 1279 | { |
| 1366 | 1280 | #if !SPC700_OPTIMIZE_SNES |
| 1367 | 1281 | if(state == CLEAR_LINE) |
| r4135 | r4136 | |
| 1378 | 1292 | } |
| 1379 | 1293 | |
| 1380 | 1294 | /* Assert or clear the IRQ line of the CPU */ |
| 1381 | void spc700_set_irq_line(spc700i_cpu *cpustate,int line, int state) | |
| 1295 | static void spc700_set_irq_line(spc700i_cpu *cpustate,int line, int state) | |
| 1382 | 1296 | { |
| 1383 | 1297 | #if !SPC700_OPTIMIZE_SNES |
| 1384 | 1298 | LINE_IRQ = (state != CLEAR_LINE) ? IRQ_SET : IRQ_CLEAR; |
| r4135 | r4136 | |
| 1386 | 1300 | #endif /* SPC700_OPTIMIZE_SNES */ |
| 1387 | 1301 | } |
| 1388 | 1302 | |
| 1389 | /* Set the callback that is called when servicing an interrupt */ | |
| 1390 | void spc700_set_irq_callback(spc700i_cpu *cpustate,cpu_irq_callback callback) | |
| 1391 | { | |
| 1392 | INT_ACK = callback; | |
| 1393 | } | |
| 1394 | ||
| 1395 | 1303 | #include "spc700ds.h" |
| 1396 | 1304 | |
| 1397 | 1305 | //int dump_flag = 0; |
| 1398 | 1306 | |
| 1399 | 1307 | /* Execute instructions for <clocks> cycles */ |
| 1400 | CPU_EXECUTE( spc700 ) | |
| 1308 | static CPU_EXECUTE( spc700 ) | |
| 1401 | 1309 | { |
| 1402 | 1310 | spc700i_cpu *cpustate = device->token; |
| 1403 | 1311 |
| r4135 | r4136 | |
|---|---|---|
| 945 | 945 | case 2: srcValue = RM(Y++); break; |
| 946 | 946 | case 3: srcValue = RM(U++); break; |
| 947 | 947 | case 4: srcValue = RM(S++); break; |
| 948 | default: IIError(m68_state); return; | |
| 948 | default: IIError(m68_state); return; | |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | switch(tb&15) { |
| r4135 | r4136 | |
| 954 | 954 | case 2: WM(Y++, srcValue); break; |
| 955 | 955 | case 3: WM(U++, srcValue); break; |
| 956 | 956 | case 4: WM(S++, srcValue); break; |
| 957 | default: IIError(m68_state); return; | |
| 957 | default: IIError(m68_state); return; | |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | PCD = PCD - 3; |
| r4135 | r4136 | |
| 979 | 979 | case 2: srcValue = RM(Y--); break; |
| 980 | 980 | case 3: srcValue = RM(U--); break; |
| 981 | 981 | case 4: srcValue = RM(S--); break; |
| 982 | default: IIError(m68_state); return; | |
| 982 | default: IIError(m68_state); return; | |
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | switch(tb&15) { |
| r4135 | r4136 | |
| 988 | 988 | case 2: WM(Y--, srcValue); break; |
| 989 | 989 | case 3: WM(U--, srcValue); break; |
| 990 | 990 | case 4: WM(S--, srcValue); break; |
| 991 | default: IIError(m68_state); return; | |
| 991 | default: IIError(m68_state); return; | |
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | PCD = PCD - 3; |
| r4135 | r4136 | |
| 1013 | 1013 | case 2: srcValue = RM(Y++); break; |
| 1014 | 1014 | case 3: srcValue = RM(U++); break; |
| 1015 | 1015 | case 4: srcValue = RM(S++); break; |
| 1016 | default: IIError(m68_state); return; | |
| 1016 | default: IIError(m68_state); return; | |
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | switch(tb&15) { |
| r4135 | r4136 | |
| 1022 | 1022 | case 2: WM(Y, srcValue); break; |
| 1023 | 1023 | case 3: WM(U, srcValue); break; |
| 1024 | 1024 | case 4: WM(S, srcValue); break; |
| 1025 | default: IIError(m68_state); return; | |
| 1025 | default: IIError(m68_state); return; | |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | PCD = PCD - 3; |
| r4135 | r4136 | |
| 1047 | 1047 | case 2: srcValue = RM(Y); break; |
| 1048 | 1048 | case 3: srcValue = RM(U); break; |
| 1049 | 1049 | case 4: srcValue = RM(S); break; |
| 1050 | default: IIError(m68_state); return; | |
| 1050 | default: IIError(m68_state); return; | |
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | switch(tb&15) { |
| r4135 | r4136 | |
| 1056 | 1056 | case 2: WM(Y++, srcValue); break; |
| 1057 | 1057 | case 3: WM(U++, srcValue); break; |
| 1058 | 1058 | case 4: WM(S++, srcValue); break; |
| 1059 | default: IIError(m68_state); return; | |
| 1059 | default: IIError(m68_state); return; | |
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | PCD = PCD - 3; |
| r4135 | r4136 | |
|---|---|---|
| 1464 | 1464 | break; |
| 1465 | 1465 | case 0x1: |
| 1466 | 1466 | return LERI; |
| 1467 | break; | |
| 1468 | 1467 | case 0x2: |
| 1469 | 1468 | { |
| 1470 | 1469 | switch(EXTRACT(Opcode,11,13)) |
| r4135 | r4136 | |
|---|---|---|
| 1171 | 1171 | break; |
| 1172 | 1172 | case 0x1: |
| 1173 | 1173 | return LERI; |
| 1174 | break; | |
| 1175 | 1174 | case 0x2: |
| 1176 | 1175 | { |
| 1177 | 1176 | switch(EXTRACT(Opcode,11,13)) |
| r0 | r4136 | |
|---|---|---|
| 1 | /*************************************************************************** | |
| 2 | ||
| 3 | i860dec.c | |
| 4 | ||
| 5 | Execution engine for the Intel i860 emulator. | |
| 6 | ||
| 7 | Copyright (C) 1995-present Jason Eckhardt (jle@rice.edu) | |
| 8 | Released for general non-commercial use under the MAME license | |
| 9 | with the additional requirement that you are free to use and | |
| 10 | redistribute this code in modified or unmodified form, provided | |
| 11 | you list me in the credits. | |
| 12 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 13 | ||
| 14 | ***************************************************************************/ | |
| 15 | ||
| 16 | /* | |
| 17 | * References: | |
| 18 | * `i860 Microprocessor Programmer's Reference Manual', Intel, 1990. | |
| 19 | * | |
| 20 | * This code was originally written by Jason Eckhardt as part of an | |
| 21 | * emulator for some i860-based Unix workstations (early 1990's) such | |
| 22 | * as the Stardent Vistra 800 series and the OkiStation/i860 7300 series. | |
| 23 | * The code you are reading now is the i860 CPU portion only, which has | |
| 24 | * been adapted to (and simplified for) MAME. | |
| 25 | * MAME-specific notes: | |
| 26 | * - i860XR emulation only (i860XP unnecessary for MAME). | |
| 27 | * - No emulation of data and instruction caches (unnecessary for MAME version). | |
| 28 | * - No emulation of DIM mode or CS8 mode (unnecessary for MAME version). | |
| 29 | * - No BL/IL/locked sequences (unnecessary for MAME). | |
| 30 | * - Emulate only the i860's LSB-first mode (BE = 0). | |
| 31 | * Generic notes: | |
| 32 | * - There is some amount of code duplication (e.g., see the | |
| 33 | * various insn_* routines for the branches and FP routines) that | |
| 34 | * could be eliminated. | |
| 35 | * - The host's floating point types are used to emulate the i860's | |
| 36 | * floating point. Should probably be made machine independent by | |
| 37 | * using an IEEE FP emulation library. On the other hand, most machines | |
| 38 | * today also use IEEE FP. | |
| 39 | * | |
| 40 | */ | |
| 41 | #include "i860.h" | |
| 42 | #include <math.h> | |
| 43 | ||
| 44 | ||
| 45 | #ifdef LSB_FIRST | |
| 46 | #undef HOST_MSB | |
| 47 | #else | |
| 48 | #define HOST_MSB | |
| 49 | #endif | |
| 50 | ||
| 51 | ||
| 52 | #undef TRACE_RDWR_MEM | |
| 53 | #undef TRACE_ADDR_TRANSLATION | |
| 54 | #undef TRACE_PAGE_FAULT | |
| 55 | #define TRACE_UNDEFINED_I860 | |
| 56 | #undef TRACE_EXT_INT | |
| 57 | #define TRACE_UNALIGNED_MEM | |
| 58 | ||
| 59 | ||
| 60 | ||
| 61 | #define i860s i860_state_t | |
| 62 | ||
| 63 | ||
| 64 | /* Prototypes. */ | |
| 65 | static void decode_exec (i860s *, UINT32, UINT32); | |
| 66 | static UINT32 get_address_translation (i860s *, UINT32, int, int); | |
| 67 | static UINT32 readmemi_emu (i860s *cpustate, UINT32, int); | |
| 68 | ||
| 69 | //static void debugger (i860s *cpustate); | |
| 70 | //static void disasm (i860s *cpustate, UINT32, int); | |
| 71 | //static void dump_state (i860s *cpustate); | |
| 72 | ||
| 73 | ||
| 74 | ||
| 75 | ||
| 76 | /* Defines for pending_trap. */ | |
| 77 | enum { | |
| 78 | TRAP_NORMAL = 0x01, | |
| 79 | TRAP_IN_DELAY_SLOT = 0x02, | |
| 80 | TRAP_WAS_EXTERNAL = 0x04 | |
| 81 | }; | |
| 82 | ||
| 83 | ||
| 84 | ||
| 85 | ||
| 86 | /* Get/set general register value -- watch for r0 on writes. */ | |
| 87 | #define get_iregval(gr) (cpustate->iregs[(gr)]) | |
| 88 | #define set_iregval(gr, val) (cpustate->iregs[(gr)] = ((gr) == 0 ? 0 : (val))) | |
| 89 | ||
| 90 | INLINE float get_fregval_s (i860s *cpustate, int fr) | |
| 91 | { | |
| 92 | float f; | |
| 93 | UINT32 x; | |
| 94 | UINT8 *tp; | |
| 95 | fr = 31 - fr; | |
| 96 | tp = (UINT8 *)(&cpustate->frg[fr * 4]); | |
| 97 | x = ((UINT32)tp[0] << 24) | ((UINT32)tp[1] << 16) | | |
| 98 | ((UINT32)tp[2] << 8) | ((UINT32)tp[3]); | |
| 99 | f = *(float *)(&x); | |
| 100 | return f; | |
| 101 | } | |
| 102 | ||
| 103 | INLINE double get_fregval_d (i860s *cpustate, int fr) | |
| 104 | { | |
| 105 | double d; | |
| 106 | UINT64 x; | |
| 107 | UINT8 *tp; | |
| 108 | fr = 31 - (fr + 1); | |
| 109 | tp = (UINT8 *)(&cpustate->frg[fr * 4]); | |
| 110 | x = ((UINT64)tp[0] << 56) | ((UINT64)tp[1] << 48) | | |
| 111 | ((UINT64)tp[2] << 40) | ((UINT64)tp[3] << 32) | | |
| 112 | ((UINT64)tp[4] << 24) | ((UINT64)tp[5] << 16) | | |
| 113 | ((UINT64)tp[6] << 8) | ((UINT64)tp[7]); | |
| 114 | d = *(double *)(&x); | |
| 115 | return d; | |
| 116 | } | |
| 117 | ||
| 118 | INLINE void set_fregval_s (i860s *cpustate, int fr, float s) | |
| 119 | { | |
| 120 | UINT8 *f = (UINT8 *)&s; | |
| 121 | UINT8 *tp; | |
| 122 | int newfr = 31 - fr; | |
| 123 | float jj = s; | |
| 124 | tp = (UINT8 *)(&cpustate->frg[newfr * 4]); | |
| 125 | ||
| 126 | f = (UINT8 *)(&jj); | |
| 127 | if (fr == 0 || fr == 1) | |
| 128 | { | |
| 129 | tp[0] = 0; tp[1] = 0; tp[2] = 0; tp[3] = 0; | |
| 130 | } | |
| 131 | else | |
| 132 | { | |
| 133 | #ifndef HOST_MSB | |
| 134 | tp[0] = f[3]; tp[1] = f[2]; tp[2] = f[1]; tp[3] = f[0]; | |
| 135 | #else | |
| 136 | tp[0] = f[0]; tp[1] = f[1]; tp[2] = f[2]; tp[3] = f[3]; | |
| 137 | #endif | |
| 138 | } | |
| 139 | } | |
| 140 | ||
| 141 | INLINE void set_fregval_d (i860s *cpustate, int fr, double d) | |
| 142 | { | |
| 143 | UINT8 *f = (UINT8 *)&d; | |
| 144 | UINT8 *tp; | |
| 145 | int newfr = 31 - (fr + 1); | |
| 146 | double jj = d; | |
| 147 | tp = (UINT8 *)(&cpustate->frg[newfr * 4]); | |
| 148 | ||
| 149 | f = (UINT8 *)(&jj); | |
| 150 | ||
| 151 | if (fr == 0) | |
| 152 | { | |
| 153 | tp[0] = 0; tp[1] = 0; tp[2] = 0; tp[3] = 0; | |
| 154 | tp[4] = 0; tp[5] = 0; tp[6] = 0; tp[7] = 0; | |
| 155 | } | |
| 156 | else | |
| 157 | { | |
| 158 | #ifndef HOST_MSB | |
| 159 | tp[0] = f[7]; tp[1] = f[6]; tp[2] = f[5]; tp[3] = f[4]; | |
| 160 | tp[4] = f[3]; tp[5] = f[2]; tp[6] = f[1]; tp[7] = f[0]; | |
| 161 | #else | |
| 162 | tp[0] = f[0]; tp[1] = f[1]; tp[2] = f[2]; tp[3] = f[3]; | |
| 163 | tp[4] = f[4]; tp[5] = f[5]; tp[6] = f[6]; tp[7] = f[7]; | |
| 164 | #endif | |
| 165 | } | |
| 166 | } | |
| 167 | ||
| 168 | ||
| 169 | /* Macros for accessing register fields in instruction word. */ | |
| 170 | #define get_isrc1(bits) (((bits) >> 11) & 0x1f) | |
| 171 | #define get_isrc2(bits) (((bits) >> 21) & 0x1f) | |
| 172 | #define get_idest(bits) (((bits) >> 16) & 0x1f) | |
| 173 | #define get_fsrc1(bits) (((bits) >> 11) & 0x1f) | |
| 174 | #define get_fsrc2(bits) (((bits) >> 21) & 0x1f) | |
| 175 | #define get_fdest(bits) (((bits) >> 16) & 0x1f) | |
| 176 | #define get_creg(bits) (((bits) >> 21) & 0x7) | |
| 177 | ||
| 178 | /* Macros for accessing immediate fields. */ | |
| 179 | /* 16-bit immediate. */ | |
| 180 | #define get_imm16(insn) ((insn) & 0xffff) | |
| 181 | ||
| 182 | /* Control register numbers. */ | |
| 183 | enum { | |
| 184 | CR_FIR = 0, | |
| 185 | CR_PSR = 1, | |
| 186 | CR_DIRBASE = 2, | |
| 187 | CR_DB = 3, | |
| 188 | CR_FSR = 4, | |
| 189 | CR_EPSR = 5 | |
| 190 | }; | |
| 191 | ||
| 192 | /* A mask for all the trap bits of the PSR (FT, DAT, IAT, IN, IT, or | |
| 193 | bits [12..8]). */ | |
| 194 | #define PSR_ALL_TRAP_BITS_MASK 0x00001f00 | |
| 195 | ||
| 196 | /* A mask for PSR bits which can only be changed from supervisor level. */ | |
| 197 | #define PSR_SUPERVISOR_ONLY_MASK 0x0000fff3 | |
| 198 | ||
| 199 | ||
| 200 | /* PSR: BR flag (PSR[0]): set/get. */ | |
| 201 | #define GET_PSR_BR() ((cpustate->cregs[CR_PSR] >> 0) & 1) | |
| 202 | #define SET_PSR_BR(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 0)) | (((val) & 1) << 0)) | |
| 203 | ||
| 204 | /* PSR: BW flag (PSR[1]): set/get. */ | |
| 205 | #define GET_PSR_BW() ((cpustate->cregs[CR_PSR] >> 1) & 1) | |
| 206 | #define SET_PSR_BW(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 1)) | (((val) & 1) << 1)) | |
| 207 | ||
| 208 | /* PSR: Shift count (PSR[21..17]): set/get. */ | |
| 209 | #define GET_PSR_SC() ((cpustate->cregs[CR_PSR] >> 17) & 0x1f) | |
| 210 | #define SET_PSR_SC(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~0x003e0000) | (((val) & 0x1f) << 17)) | |
| 211 | ||
| 212 | /* PSR: CC flag (PSR[2]): set/get. */ | |
| 213 | #define GET_PSR_CC() ((cpustate->cregs[CR_PSR] >> 2) & 1) | |
| 214 | #define SET_PSR_CC(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 2)) | (((val) & 1) << 2)) | |
| 215 | ||
| 216 | /* PSR: IT flag (PSR[8]): set/get. */ | |
| 217 | #define GET_PSR_IT() ((cpustate->cregs[CR_PSR] >> 8) & 1) | |
| 218 | #define SET_PSR_IT(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 8)) | (((val) & 1) << 8)) | |
| 219 | ||
| 220 | /* PSR: IN flag (PSR[9]): set/get. */ | |
| 221 | #define GET_PSR_IN() ((cpustate->cregs[CR_PSR] >> 9) & 1) | |
| 222 | #define SET_PSR_IN(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 9)) | (((val) & 1) << 9)) | |
| 223 | ||
| 224 | /* PSR: IAT flag (PSR[10]): set/get. */ | |
| 225 | #define GET_PSR_IAT() ((cpustate->cregs[CR_PSR] >> 10) & 1) | |
| 226 | #define SET_PSR_IAT(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 10)) | (((val) & 1) << 10)) | |
| 227 | ||
| 228 | /* PSR: DAT flag (PSR[11]): set/get. */ | |
| 229 | #define GET_PSR_DAT() ((cpustate->cregs[CR_PSR] >> 11) & 1) | |
| 230 | #define SET_PSR_DAT(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 11)) | (((val) & 1) << 11)) | |
| 231 | ||
| 232 | /* PSR: FT flag (PSR[12]): set/get. */ | |
| 233 | #define GET_PSR_FT() ((cpustate->cregs[CR_PSR] >> 12) & 1) | |
| 234 | #define SET_PSR_FT(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 12)) | (((val) & 1) << 12)) | |
| 235 | ||
| 236 | /* PSR: DS flag (PSR[13]): set/get. */ | |
| 237 | #define GET_PSR_DS() ((cpustate->cregs[CR_PSR] >> 13) & 1) | |
| 238 | #define SET_PSR_DS(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 13)) | (((val) & 1) << 13)) | |
| 239 | ||
| 240 | /* PSR: DIM flag (PSR[14]): set/get. */ | |
| 241 | #define GET_PSR_DIM() ((cpustate->cregs[CR_PSR] >> 14) & 1) | |
| 242 | #define SET_PSR_DIM(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 14)) | (((val) & 1) << 14)) | |
| 243 | ||
| 244 | /* PSR: LCC (PSR[3]): set/get. */ | |
| 245 | #define GET_PSR_LCC() ((cpustate->cregs[CR_PSR] >> 3) & 1) | |
| 246 | #define SET_PSR_LCC(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 3)) | (((val) & 1) << 3)) | |
| 247 | ||
| 248 | /* PSR: IM (PSR[4]): set/get. */ | |
| 249 | #define GET_PSR_IM() ((cpustate->cregs[CR_PSR] >> 4) & 1) | |
| 250 | #define SET_PSR_IM(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 4)) | (((val) & 1) << 4)) | |
| 251 | ||
| 252 | /* PSR: PIM (PSR[5]): set/get. */ | |
| 253 | #define GET_PSR_PIM() ((cpustate->cregs[CR_PSR] >> 5) & 1) | |
| 254 | #define SET_PSR_PIM(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 5)) | (((val) & 1) << 5)) | |
| 255 | ||
| 256 | /* PSR: U (PSR[6]): set/get. */ | |
| 257 | #define GET_PSR_U() ((cpustate->cregs[CR_PSR] >> 6) & 1) | |
| 258 | #define SET_PSR_U(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 6)) | (((val) & 1) << 6)) | |
| 259 | ||
| 260 | /* PSR: PU (PSR[7]): set/get. */ | |
| 261 | #define GET_PSR_PU() ((cpustate->cregs[CR_PSR] >> 7) & 1) | |
| 262 | #define SET_PSR_PU(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~(1 << 7)) | (((val) & 1) << 7)) | |
| 263 | ||
| 264 | /* PSR: Pixel size (PSR[23..22]): set/get. */ | |
| 265 | #define GET_PSR_PS() ((cpustate->cregs[CR_PSR] >> 22) & 0x3) | |
| 266 | #define SET_PSR_PS(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~0x00c00000) | (((val) & 0x3) << 22)) | |
| 267 | ||
| 268 | /* PSR: Pixel mask (PSR[31..24]): set/get. */ | |
| 269 | #define GET_PSR_PM() ((cpustate->cregs[CR_PSR] >> 24) & 0xff) | |
| 270 | #define SET_PSR_PM(val) (cpustate->cregs[CR_PSR] = (cpustate->cregs[CR_PSR] & ~0xff000000) | (((val) & 0xff) << 24)) | |
| 271 | ||
| 272 | /* EPSR: WP bit (EPSR[14]): set/get. */ | |
| 273 | #define GET_EPSR_WP() ((cpustate->cregs[CR_EPSR] >> 14) & 1) | |
| 274 | #define SET_EPSR_WP(val) (cpustate->cregs[CR_EPSR] = (cpustate->cregs[CR_EPSR] & ~(1 << 14)) | (((val) & 1) << 14)) | |
| 275 | ||
| 276 | /* EPSR: INT bit (EPSR[17]): set/get. */ | |
| 277 | #define GET_EPSR_INT() ((cpustate->cregs[CR_EPSR] >> 17) & 1) | |
| 278 | #define SET_EPSR_INT(val) (cpustate->cregs[CR_EPSR] = (cpustate->cregs[CR_EPSR] & ~(1 << 17)) | (((val) & 1) << 17)) | |
| 279 | ||
| 280 | ||
| 281 | /* EPSR: OF flag (EPSR[24]): set/get. */ | |
| 282 | #define GET_EPSR_OF() ((cpustate->cregs[CR_EPSR] >> 24) & 1) | |
| 283 | #define SET_EPSR_OF(val) (cpustate->cregs[CR_EPSR] = (cpustate->cregs[CR_EPSR] & ~(1 << 24)) | (((val) & 1) << 24)) | |
| 284 | ||
| 285 | /* EPSR: BE flag (EPSR[23]): set/get. */ | |
| 286 | #define GET_EPSR_BE() ((cpustate->cregs[CR_EPSR] >> 23) & 1) | |
| 287 | #define SET_EPSR_BE(val) (cpustate->cregs[CR_EPSR] = (cpustate->cregs[CR_EPSR] & ~(1 << 23)) | (((val) & 1) << 23)) | |
| 288 | ||
| 289 | /* DIRBASE: ATE bit (DIRBASE[0]): get. */ | |
| 290 | #define GET_DIRBASE_ATE() (cpustate->cregs[CR_DIRBASE] & 1) | |
| 291 | ||
| 292 | /* DIRBASE: CS8 bit (DIRBASE[7]): get. */ | |
| 293 | #define GET_DIRBASE_CS8() ((cpustate->cregs[CR_DIRBASE] >> 7) & 1) | |
| 294 | ||
| 295 | /* FSR: FTE bit (FSR[5]): set/get. */ | |
| 296 | #define GET_FSR_FTE() ((cpustate->cregs[CR_FSR] >> 5) & 1) | |
| 297 | #define SET_FSR_FTE(val) (cpustate->cregs[CR_FSR] = (cpustate->cregs[CR_FSR] & ~(1 << 5)) | (((val) & 1) << 5)) | |
| 298 | ||
| 299 | /* FSR: SE bit (FSR[8]): set/get. */ | |
| 300 | #define GET_FSR_SE() ((cpustate->cregs[CR_FSR] >> 8) & 1) | |
| 301 | #define SET_FSR_SE(val) (cpustate->cregs[CR_FSR] = (cpustate->cregs[CR_FSR] & ~(1 << 8)) | (((val) & 1) << 8)) | |
| 302 | ||
| 303 | ||
| 304 | /* | |
| 305 | static int has_delay_slot(UINT32 insn) | |
| 306 | { | |
| 307 | int opc = (insn >> 26) & 0x3f; | |
| 308 | if (opc == 0x10 || opc == 0x1a || opc == 0x1b || opc == 0x1d || | |
| 309 | opc == 0x1f || opc == 0x2d || (opc == 0x13 && (insn & 3) == 2)) | |
| 310 | return 1; | |
| 311 | return 0; | |
| 312 | } | |
| 313 | */ | |
| 314 | ||
| 315 | /* This is the external interface for asserting/deasserting pins on | |
| 316 | the i860. */ | |
| 317 | void i860_set_pin (i860s *cpustate, int pin, int val) | |
| 318 | { | |
| 319 | if (pin == DEC_PIN_BUS_HOLD) | |
| 320 | cpustate->pin_bus_hold = val; | |
| 321 | else if (pin == DEC_PIN_RESET) | |
| 322 | cpustate->pin_reset = val; | |
| 323 | else | |
| 324 | assert (0); | |
| 325 | } | |
| 326 | ||
| 327 | ||
| 328 | /* This is the external interface for indicating an external interrupt | |
| 329 | to the i860. */ | |
| 330 | void i860_gen_interrupt (i860s *cpustate) | |
| 331 | { | |
| 332 | /* If interrupts are enabled, then set PSR.IN and prepare for trap. | |
| 333 | Otherwise, the external interrupt is ignored. We also set | |
| 334 | bit EPSR.INT (which tracks the INT pin). */ | |
| 335 | if (GET_PSR_IM ()) | |
| 336 | { | |
| 337 | SET_PSR_IN (1); | |
| 338 | SET_EPSR_INT (1); | |
| 339 | cpustate->pending_trap = TRAP_WAS_EXTERNAL; | |
| 340 | } | |
| 341 | ||
| 342 | #ifdef TRACE_EXT_INT | |
| 343 | fprintf (stderr, "i860_gen_interrupt: External interrupt received "); | |
| 344 | if (GET_PSR_IM ()) | |
| 345 | fprintf (stderr, "[PSR.IN set, preparing to trap]\n"); | |
| 346 | else | |
| 347 | fprintf (stderr, "[ignored (interrupts disabled)]\n"); | |
| 348 | #endif | |
| 349 | } | |
| 350 | ||
| 351 | ||
| 352 | /* Fetch instructions from instruction cache. | |
| 353 | Note: The instruction cache is not implemented for MAME version, | |
| 354 | this just fetches and returns 1 instruction from memory. */ | |
| 355 | static UINT32 ifetch (i860s *cpustate, UINT32 pc) | |
| 356 | { | |
| 357 | UINT32 phys_pc = 0; | |
| 358 | UINT32 w1 = 0; | |
| 359 | ||
| 360 | /* If virtual mode, get translation. */ | |
| 361 | if (GET_DIRBASE_ATE ()) | |
| 362 | { | |
| 363 | phys_pc = get_address_translation (cpustate, pc, 0 /* is_dataref */, 0 /* is_write */); | |
| 364 | cpustate->exiting_ifetch = 0; | |
| 365 | if (cpustate->pending_trap && (GET_PSR_DAT () || GET_PSR_IAT ())) | |
| 366 | { | |
| 367 | cpustate->exiting_ifetch = 1; | |
| 368 | return 0xffeeffee; | |
| 369 | } | |
| 370 | } | |
| 371 | else | |
| 372 | phys_pc = pc; | |
| 373 | ||
| 374 | /* Since i860 instructions are always stored LSB first (regardless of | |
| 375 | the BE bit), we need to adjust the instruction below on MSB hosts. */ | |
| 376 | w1 = memory_read_dword_64le(cpustate->program, phys_pc); | |
| 377 | #ifdef HOST_MSB | |
| 378 | BYTE_REV32 (w1); | |
| 379 | #endif /* HOST_MSB. */ | |
| 380 | return w1; | |
| 381 | } | |
| 382 | ||
| 383 | ||
| 384 | /* Given a virtual address, perform the i860 address translation and | |
| 385 | return the corresponding physical address. | |
| 386 | vaddr: virtual address | |
| 387 | is_dataref: 1 = load/store, 0 = instruction fetch. | |
| 388 | is_write: 1 = writing to vaddr, 0 = reading from vaddr | |
| 389 | The last two arguments are only used to determine what types | |
| 390 | of traps should be taken. | |
| 391 | ||
| 392 | Page tables must always be in memory (not cached). So the routine | |
| 393 | here only accesses memory. */ | |
| 394 | static UINT32 get_address_translation (i860s *cpustate, UINT32 vaddr, int is_dataref, int is_write) | |
| 395 | { | |
| 396 | UINT32 vdir = (vaddr >> 22) & 0x3ff; | |
| 397 | UINT32 vpage = (vaddr >> 12) & 0x3ff; | |
| 398 | UINT32 voffset = vaddr & 0xfff; | |
| 399 | UINT32 dtb = (cpustate->cregs[CR_DIRBASE]) & 0xfffff000; | |
| 400 | UINT32 pg_dir_entry_a = 0; | |
| 401 | UINT32 pg_dir_entry = 0; | |
| 402 | UINT32 pg_tbl_entry_a = 0; | |
| 403 | UINT32 pg_tbl_entry = 0; | |
| 404 | UINT32 pfa1 = 0; | |
| 405 | UINT32 pfa2 = 0; | |
| 406 | UINT32 ret = 0; | |
| 407 | UINT32 ttpde = 0; | |
| 408 | UINT32 ttpte = 0; | |
| 409 | ||
| 410 | assert (GET_DIRBASE_ATE ()); | |
| 411 | ||
| 412 | /* Get page directory entry at DTB:DIR:00. */ | |
| 413 | pg_dir_entry_a = dtb | (vdir << 2); | |
| 414 | pg_dir_entry = memory_read_dword_64le(cpustate->program, pg_dir_entry_a); | |
| 415 | #ifdef HOST_MSB | |
| 416 | BYTE_REV32 (pg_dir_entry); | |
| 417 | #endif | |
| 418 | ||
| 419 | /* Check for non-present PDE. */ | |
| 420 | if (!(pg_dir_entry & 1)) | |
| 421 | { | |
| 422 | /* PDE is not present, generate DAT or IAT. */ | |
| 423 | if (is_dataref) | |
| 424 | SET_PSR_DAT (1); | |
| 425 | else | |
| 426 | SET_PSR_IAT (1); | |
| 427 | cpustate->pending_trap = 1; | |
| 428 | ||
| 429 | /* Dummy return. */ | |
| 430 | return 0; | |
| 431 | } | |
| 432 | ||
| 433 | /* PDE Check for write protection violations. */ | |
| 434 | if (is_write && is_dataref | |
| 435 | && !(pg_dir_entry & 2) /* W = 0. */ | |
| 436 | && (GET_PSR_U () || GET_EPSR_WP ())) /* PSR_U = 1 or EPSR_WP = 1. */ | |
| 437 | { | |
| 438 | SET_PSR_DAT (1); | |
| 439 | cpustate->pending_trap = 1; | |
| 440 | /* Dummy return. */ | |
| 441 | return 0; | |
| 442 | } | |
| 443 | ||
| 444 | /* PDE Check for user-mode access to supervisor pages. */ | |
| 445 | if (GET_PSR_U () | |
| 446 | && !(pg_dir_entry & 4)) /* U = 0. */ | |
| 447 | { | |
| 448 | if (is_dataref) | |
| 449 | SET_PSR_DAT (1); | |
| 450 | else | |
| 451 | SET_PSR_IAT (1); | |
| 452 | cpustate->pending_trap = 1; | |
| 453 | /* Dummy return. */ | |
| 454 | return 0; | |
| 455 | } | |
| 456 | ||
| 457 | /* FIXME: How exactly to handle A check/update?. */ | |
| 458 | ||
| 459 | /* Get page table entry at PFA1:PAGE:00. */ | |
| 460 | pfa1 = pg_dir_entry & 0xfffff000; | |
| 461 | pg_tbl_entry_a = pfa1 | (vpage << 2); | |
| 462 | pg_tbl_entry = memory_read_dword_64le(cpustate->program, pg_tbl_entry_a); | |
| 463 | #ifdef HOST_MSB | |
| 464 | BYTE_REV32 (pg_tbl_entry); | |
| 465 | #endif | |
| 466 | ||
| 467 | /* Check for non-present PTE. */ | |
| 468 | if (!(pg_tbl_entry & 1)) | |
| 469 | { | |
| 470 | /* PTE is not present, generate DAT or IAT. */ | |
| 471 | if (is_dataref) | |
| 472 | SET_PSR_DAT (1); | |
| 473 | else | |
| 474 | SET_PSR_IAT (1); | |
| 475 | cpustate->pending_trap = 1; | |
| 476 | ||
| 477 | /* Dummy return. */ | |
| 478 | return 0; | |
| 479 | } | |
| 480 | ||
| 481 | /* PTE Check for write protection violations. */ | |
| 482 | if (is_write && is_dataref | |
| 483 | && !(pg_tbl_entry & 2) /* W = 0. */ | |
| 484 | && (GET_PSR_U () || GET_EPSR_WP ())) /* PSR_U = 1 or EPSR_WP = 1. */ | |
| 485 | { | |
| 486 | SET_PSR_DAT (1); | |
| 487 | cpustate->pending_trap = 1; | |
| 488 | /* Dummy return. */ | |
| 489 | return 0; | |
| 490 | } | |
| 491 | ||
| 492 | /* PTE Check for user-mode access to supervisor pages. */ | |
| 493 | if (GET_PSR_U () | |
| 494 | && !(pg_tbl_entry & 4)) /* U = 0. */ | |
| 495 | { | |
| 496 | if (is_dataref) | |
| 497 | SET_PSR_DAT (1); | |
| 498 | else | |
| 499 | SET_PSR_IAT (1); | |
| 500 | cpustate->pending_trap = 1; | |
| 501 | /* Dummy return. */ | |
| 502 | return 0; | |
| 503 | } | |
| 504 | ||
| 505 | /* Update A bit and check D bit. */ | |
| 506 | ttpde = pg_dir_entry | 0x20; | |
| 507 | ttpte = pg_tbl_entry | 0x20; | |
| 508 | #ifdef HOST_MSB | |
| 509 | BYTE_REV32 (ttpde); | |
| 510 | BYTE_REV32 (ttpte); | |
| 511 | #endif | |
| 512 | memory_write_dword_64le(cpustate->program, pg_dir_entry_a, ttpde); | |
| 513 | memory_write_dword_64le(cpustate->program, pg_tbl_entry_a, ttpte); | |
| 514 | ||
| 515 | if (is_write && is_dataref && (pg_tbl_entry & 0x40) == 0) | |
| 516 | { | |
| 517 | /* fprintf(stderr, "DAT trap on write without dirty bit v0x%08x/p0x%08x\n", | |
| 518 | vaddr, (pg_tbl_entry & ~0xfff)|voffset); */ | |
| 519 | SET_PSR_DAT (1); | |
| 520 | cpustate->pending_trap = 1; | |
| 521 | /* Dummy return. */ | |
| 522 | return 0; | |
| 523 | } | |
| 524 | ||
| 525 | pfa2 = (pg_tbl_entry & 0xfffff000); | |
| 526 | ret = pfa2 | voffset; | |
| 527 | ||
| 528 | #ifdef TRACE_ADDR_TRANSLATION | |
| 529 | fprintf (stderr, "get_address_translation: virt(0x%08x) -> phys(0x%08x)\n", | |
| 530 | vaddr, ret); | |
| 531 | #endif | |
| 532 | ||
| 533 | return ret; | |
| 534 | } | |
| 535 | ||
| 536 | ||
| 537 | /* Read memory emulation. | |
| 538 | addr = address to read. | |
| 539 | size = size of read in bytes. */ | |
| 540 | static UINT32 readmemi_emu (i860s *cpustate, UINT32 addr, int size) | |
| 541 | { | |
| 542 | #ifdef TRACE_RDWR_MEM | |
| 543 | fprintf (stderr, "readmemi_emu: (ATE=%d) addr = 0x%08x, size = %d\n", | |
| 544 | GET_DIRBASE_ATE (), addr, size); | |
| 545 | #endif | |
| 546 | ||
| 547 | /* If virtual mode, do translation. */ | |
| 548 | if (GET_DIRBASE_ATE ()) | |
| 549 | { | |
| 550 | UINT32 phys = get_address_translation (cpustate, addr, 1 /* is_dataref */, 0 /* is_write */); | |
| 551 | if (cpustate->pending_trap && (GET_PSR_IAT () || GET_PSR_DAT ())) | |
| 552 | { | |
| 553 | #ifdef TRACE_PAGE_FAULT | |
| 554 | fprintf (stderr, "0x%08x: ## Page fault (readmemi_emu).\n", | |
| 555 | cpustate->pc); | |
| 556 | #endif | |
| 557 | cpustate->exiting_readmem = 1; | |
| 558 | return 0; | |
| 559 | } | |
| 560 | addr = phys; | |
| 561 | } | |
| 562 | ||
| 563 | /* First check for match to db register (before read). */ | |
| 564 | if (((addr & ~(size - 1)) == cpustate->cregs[CR_DB]) && GET_PSR_BR ()) | |
| 565 | { | |
| 566 | SET_PSR_DAT (1); | |
| 567 | cpustate->pending_trap = 1; | |
| 568 | return 0; | |
| 569 | } | |
| 570 | ||
| 571 | /* Now do the actual read. */ | |
| 572 | if (size == 1) | |
| 573 | { | |
| 574 | UINT32 ret = memory_read_byte_64le(cpustate->program, addr); | |
| 575 | return ret & 0xff; | |
| 576 | } | |
| 577 | else if (size == 2) | |
| 578 | { | |
| 579 | UINT32 ret = memory_read_word_64le(cpustate->program, addr); | |
| 580 | #ifdef HOST_MSB | |
| 581 | BYTE_REV16 (ret); | |
| 582 | #endif | |
| 583 | return ret & 0xffff; | |
| 584 | } | |
| 585 | else if (size == 4) | |
| 586 | { | |
| 587 | UINT32 ret = memory_read_dword_64le(cpustate->program, addr); | |
| 588 | #ifdef HOST_MSB | |
| 589 | BYTE_REV32 (ret); | |
| 590 | #endif | |
| 591 | return ret; | |
| 592 | } | |
| 593 | else | |
| 594 | assert (0); | |
| 595 | ||
| 596 | return 0; | |
| 597 | } | |
| 598 | ||
| 599 | ||
| 600 | /* Write memory emulation. | |
| 601 | addr = address to write. | |
| 602 | size = size of write in bytes. | |
| 603 | data = data to write. */ | |
| 604 | static void writememi_emu (i860s *cpustate, UINT32 addr, int size, UINT32 data) | |
| 605 | { | |
| 606 | #ifdef TRACE_RDWR_MEM | |
| 607 | fprintf (stderr, "writememi_emu: (ATE=%d) addr = 0x%08x, size = %d, data = 0x%08x\n", | |
| 608 | GET_DIRBASE_ATE (), addr, size, data); | |
| 609 | #endif | |
| 610 | ||
| 611 | /* If virtual mode, do translation. */ | |
| 612 | if (GET_DIRBASE_ATE ()) | |
| 613 | { | |
| 614 | UINT32 phys = get_address_translation (cpustate, addr, 1 /* is_dataref */, 1 /* is_write */); | |
| 615 | if (cpustate->pending_trap && (GET_PSR_IAT () || GET_PSR_DAT ())) | |
| 616 | { | |
| 617 | #ifdef TRACE_PAGE_FAULT | |
| 618 | fprintf (stderr, "0x%08x: ## Page fault (writememi_emu).\n", | |
| 619 | cpustate->pc); | |
| 620 | #endif | |
| 621 | cpustate->exiting_readmem = 2; | |
| 622 | return; | |
| 623 | } | |
| 624 | addr = phys; | |
| 625 | } | |
| 626 | ||
| 627 | /* First check for match to db register (before write). */ | |
| 628 | if (((addr & ~(size - 1)) == cpustate->cregs[CR_DB]) && GET_PSR_BW ()) | |
| 629 | { | |
| 630 | SET_PSR_DAT (1); | |
| 631 | cpustate->pending_trap = 1; | |
| 632 | return; | |
| 633 | } | |
| 634 | ||
| 635 | /* Now do the actual write. */ | |
| 636 | if (size == 1) | |
| 637 | memory_write_byte_64le(cpustate->program, addr, data); | |
| 638 | else if (size == 2) | |
| 639 | { | |
| 640 | #ifdef HOST_MSB | |
| 641 | BYTE_REV16 (data); | |
| 642 | #endif | |
| 643 | memory_write_word_64le(cpustate->program, addr, data); | |
| 644 | } | |
| 645 | else if (size == 4) | |
| 646 | { | |
| 647 | #ifdef HOST_MSB | |
| 648 | BYTE_REV32 (data); | |
| 649 | #endif | |
| 650 | memory_write_dword_64le(cpustate->program, addr, data); | |
| 651 | } | |
| 652 | else | |
| 653 | assert (0); | |
| 654 | } | |
| 655 | ||
| 656 | ||
| 657 | /* Floating-point read mem routine. | |
| 658 | addr = address to read. | |
| 659 | size = size of read in bytes. | |
| 660 | dest = memory to put read data. */ | |
| 661 | static void fp_readmem_emu (i860s *cpustate, UINT32 addr, int size, UINT8 *dest) | |
| 662 | { | |
| 663 | #ifdef TRACE_RDWR_MEM | |
| 664 | fprintf (stderr, "fp_readmem_emu: (ATE=%d) addr = 0x%08x, size = %d\n", | |
| 665 | GET_DIRBASE_ATE (), addr, size); | |
| 666 | #endif | |
| 667 | ||
| 668 | assert (size == 4 || size == 8 || size == 16); | |
| 669 | ||
| 670 | /* If virtual mode, do translation. */ | |
| 671 | if (GET_DIRBASE_ATE ()) | |
| 672 | { | |
| 673 | UINT32 phys = get_address_translation (cpustate, addr, 1 /* is_dataref */, 0 /* is_write */); | |
| 674 | if (cpustate->pending_trap && (GET_PSR_IAT () || GET_PSR_DAT ())) | |
| 675 | { | |
| 676 | #ifdef TRACE_PAGE_FAULT | |
| 677 | fprintf (stderr, "0x%08x: ## Page fault (fp_readmem_emu).\n", | |
| 678 | cpustate->pc); | |
| 679 | #endif | |
| 680 | cpustate->exiting_readmem = 3; | |
| 681 | return; | |
| 682 | } | |
| 683 | addr = phys; | |
| 684 | } | |
| 685 | ||
| 686 | /* First check for match to db register (before read). */ | |
| 687 | if (((addr & ~(size - 1)) == cpustate->cregs[CR_DB]) && GET_PSR_BR ()) | |
| 688 | { | |
| 689 | SET_PSR_DAT (1); | |
| 690 | cpustate->pending_trap = 1; | |
| 691 | return; | |
| 692 | } | |
| 693 | ||
| 694 | if (size == 4) | |
| 695 | { | |
| 696 | dest[0] = memory_read_byte_64le(cpustate->program, addr+3); | |
| 697 | dest[1] = memory_read_byte_64le(cpustate->program, addr+2); | |
| 698 | dest[2] = memory_read_byte_64le(cpustate->program, addr+1); | |
| 699 | dest[3] = memory_read_byte_64le(cpustate->program, addr+0); | |
| 700 | } | |
| 701 | else if (size == 8) | |
| 702 | { | |
| 703 | dest[0] = memory_read_byte_64le(cpustate->program, addr+7); | |
| 704 | dest[1] = memory_read_byte_64le(cpustate->program, addr+6); | |
| 705 | dest[2] = memory_read_byte_64le(cpustate->program, addr+5); | |
| 706 | dest[3] = memory_read_byte_64le(cpustate->program, addr+4); | |
| 707 | dest[4] = memory_read_byte_64le(cpustate->program, addr+3); | |
| 708 | dest[5] = memory_read_byte_64le(cpustate->program, addr+2); | |
| 709 | dest[6] = memory_read_byte_64le(cpustate->program, addr+1); | |
| 710 | dest[7] = memory_read_byte_64le(cpustate->program, addr+0); | |
| 711 | } | |
| 712 | else if (size == 16) | |
| 713 | { | |
| 714 | int i; | |
| 715 | for (i = 0; i < 16; i++) | |
| 716 | { | |
| 717 | dest[i] = memory_read_byte_64le(cpustate->program, addr+15-i); | |
| 718 | } | |
| 719 | } | |
| 720 | } | |
| 721 | ||
| 722 | ||
| 723 | /* Floating-point write mem routine. | |
| 724 | addr = address to read. | |
| 725 | size = size of read in bytes. | |
| 726 | data = pointer to the data. | |
| 727 | wmask = bit mask of bytes to write (only for pst.d). */ | |
| 728 | static void fp_writemem_emu (i860s *cpustate, UINT32 addr, int size, UINT8 *data, UINT32 wmask) | |
| 729 | { | |
| 730 | #ifdef TRACE_RDWR_MEM | |
| 731 | fprintf (stderr, "fp_writemem_emu: (ATE=%d) addr = 0x%08x, size = %d\n", | |
| 732 | GET_DIRBASE_ATE (), addr, size); | |
| 733 | #endif | |
| 734 | ||
| 735 | assert (size == 4 || size == 8 || size == 16); | |
| 736 | ||
| 737 | /* If virtual mode, do translation. */ | |
| 738 | if (GET_DIRBASE_ATE ()) | |
| 739 | { | |
| 740 | UINT32 phys = get_address_translation (cpustate, addr, 1 /* is_dataref */, 1 /* is_write */); | |
| 741 | if (cpustate->pending_trap && GET_PSR_DAT ()) | |
| 742 | { | |
| 743 | #ifdef TRACE_PAGE_FAULT | |
| 744 | fprintf (stderr, "0x%08x: ## Page fault (fp_writememi_emu).\n", | |
| 745 | cpustate->pc); | |
| 746 | #endif | |
| 747 | cpustate->exiting_readmem = 4; | |
| 748 | return; | |
| 749 | } | |
| 750 | addr = phys; | |
| 751 | } | |
| 752 | ||
| 753 | /* First check for match to db register (before read). */ | |
| 754 | if (((addr & ~(size - 1)) == cpustate->cregs[CR_DB]) && GET_PSR_BW ()) | |
| 755 | { | |
| 756 | SET_PSR_DAT (1); | |
| 757 | cpustate->pending_trap = 1; | |
| 758 | return; | |
| 759 | } | |
| 760 | ||
| 761 | if (size == 4) | |
| 762 | { | |
| 763 | #if 1 | |
| 764 | memory_write_byte_64le(cpustate->program, addr+3, data[0]); | |
| 765 | memory_write_byte_64le(cpustate->program, addr+2, data[1]); | |
| 766 | memory_write_byte_64le(cpustate->program, addr+1, data[2]); | |
| 767 | memory_write_byte_64le(cpustate->program, addr+0, data[3]); | |
| 768 | #else | |
| 769 | UINT32 ddd = (data[3]) | (data[2] << 8) | (data[1] << 16) |(data[0] << 24); | |
| 770 | memory_write_dword_64le(cpustate->program, addr+0, ddd); | |
| 771 | #endif | |
| 772 | } | |
| 773 | else if (size == 8) | |
| 774 | { | |
| 775 | /* Special: watch for wmask != 0xff, which means we're doing pst.d. */ | |
| 776 | if (wmask == 0xff) | |
| 777 | { | |
| 778 | memory_write_byte_64le(cpustate->program, addr+7, data[0]); | |
| 779 | memory_write_byte_64le(cpustate->program, addr+6, data[1]); | |
| 780 | memory_write_byte_64le(cpustate->program, addr+5, data[2]); | |
| 781 | memory_write_byte_64le(cpustate->program, addr+4, data[3]); | |
| 782 | memory_write_byte_64le(cpustate->program, addr+3, data[4]); | |
| 783 | memory_write_byte_64le(cpustate->program, addr+2, data[5]); | |
| 784 | memory_write_byte_64le(cpustate->program, addr+1, data[6]); | |
| 785 | memory_write_byte_64le(cpustate->program, addr+0, data[7]); | |
| 786 | } | |
| 787 | else | |
| 788 | { | |
| 789 | if (wmask & 0x80) memory_write_byte_64le(cpustate->program, addr+7, data[0]); | |
| 790 | if (wmask & 0x40) memory_write_byte_64le(cpustate->program, addr+6, data[1]); | |
| 791 | if (wmask & 0x20) memory_write_byte_64le(cpustate->program, addr+5, data[2]); | |
| 792 | if (wmask & 0x10) memory_write_byte_64le(cpustate->program, addr+4, data[3]); | |
| 793 | if (wmask & 0x08) memory_write_byte_64le(cpustate->program, addr+3, data[4]); | |
| 794 | if (wmask & 0x04) memory_write_byte_64le(cpustate->program, addr+2, data[5]); | |
| 795 | if (wmask & 0x02) memory_write_byte_64le(cpustate->program, addr+1, data[6]); | |
| 796 | if (wmask & 0x01) memory_write_byte_64le(cpustate->program, addr+0, data[7]); | |
| 797 | } | |
| 798 | } | |
| 799 | else if (size == 16) | |
| 800 | { | |
| 801 | int i; | |
| 802 | for (i = 0; i < 16; i++) | |
| 803 | { | |
| 804 | memory_write_byte_64le(cpustate->program, addr+15-i, data[i]); | |
| 805 | } | |
| 806 | } | |
| 807 | ||
| 808 | } | |
| 809 | ||
| 810 | ||
| 811 | #if 0 | |
| 812 | /* Do a pipeline dump. | |
| 813 | type: 0 (all), 1 (add), 2 (mul), 3 (load), 4 (graphics). */ | |
| 814 | static void dump_pipe (i860s *cpustate, int type) | |
| 815 | { | |
| 816 | int i = 0; | |
| 817 | ||
| 818 | fprintf (stderr, "pipeline state:\n"); | |
| 819 | /* Dump the adder pipeline, if requested. */ | |
| 820 | if (type == 0 || type == 1) | |
| 821 | { | |
| 822 | fprintf (stderr, " A: "); | |
| 823 | for (i = 0; i < 3; i++) | |
| 824 | { | |
| 825 | if (cpustate->A[i].stat.arp) | |
| 826 | fprintf (stderr, "[%dd] 0x%016llx ", i + 1, | |
| 827 | *(UINT64 *)(&cpustate->A[i].val.d)); | |
| 828 | else | |
| 829 | fprintf (stderr, "[%ds] 0x%08x ", i + 1, | |
| 830 | *(UINT32 *)(&cpustate->A[i].val.s)); | |
| 831 | } | |
| 832 | fprintf (stderr, "\n"); | |
| 833 | } | |
| 834 | ||
| 835 | ||
| 836 | /* Dump the multiplier pipeline, if requested. */ | |
| 837 | if (type == 0 || type == 2) | |
| 838 | { | |
| 839 | fprintf (stderr, " M: "); | |
| 840 | for (i = 0; i < 3; i++) | |
| 841 | { | |
| 842 | if (cpustate->M[i].stat.mrp) | |
| 843 | fprintf (stderr, "[%dd] 0x%016llx ", i + 1, | |
| 844 | *(UINT64 *)(&cpustate->M[i].val.d)); | |
| 845 | else | |
| 846 | fprintf (stderr, "[%ds] 0x%08x ", i + 1, | |
| 847 | *(UINT32 *)(&cpustate->M[i].val.s)); | |
| 848 | } | |
| 849 | fprintf (stderr, "\n"); | |
| 850 | } | |
| 851 | ||
| 852 | /* Dump the load pipeline, if requested. */ | |
| 853 | if (type == 0 || type == 3) | |
| 854 | { | |
| 855 | fprintf (stderr, " L: "); | |
| 856 | for (i = 0; i < 3; i++) | |
| 857 | { | |
| 858 | if (cpustate->L[i].stat.lrp) | |
| 859 | fprintf (stderr, "[%dd] 0x%016llx ", i + 1, | |
| 860 | *(UINT64 *)(&cpustate->L[i].val.d)); | |
| 861 | else | |
| 862 | fprintf (stderr, "[%ds] 0x%08x ", i + 1, | |
| 863 | *(UINT32 *)(&cpustate->L[i].val.s)); | |
| 864 | } | |
| 865 | fprintf (stderr, "\n"); | |
| 866 | } | |
| 867 | ||
| 868 | /* Dump the graphics pipeline, if requested. */ | |
| 869 | if (type == 0 || type == 4) | |
| 870 | { | |
| 871 | fprintf (stderr, " I: "); | |
| 872 | if (cpustate->G.stat.irp) | |
| 873 | fprintf (stderr, "[1d] 0x%016llx\n", | |
| 874 | *(UINT64 *)(&cpustate->G.val.d)); | |
| 875 | else | |
| 876 | fprintf (stderr, "[1s] 0x%08x\n", | |
| 877 | *(UINT32 *)(&cpustate->G.val.s)); | |
| 878 | } | |
| 879 | } | |
| 880 | ||
| 881 | ||
| 882 | /* Do a register/state dump. */ | |
| 883 | static void dump_state (i860s *cpustate) | |
| 884 | { | |
| 885 | int rn; | |
| 886 | ||
| 887 | /* GR's first, 4 per line. */ | |
| 888 | for (rn = 0; rn < 32; rn++) | |
| 889 | { | |
| 890 | if ((rn % 4) == 0) | |
| 891 | fprintf (stderr, "\n"); | |
| 892 | fprintf (stderr, "%%r%-3d: 0x%08x ", rn, get_iregval (rn)); | |
| 893 | } | |
| 894 | fprintf (stderr, "\n"); | |
| 895 | ||
| 896 | /* FR's (as 32-bits), 4 per line. */ | |
| 897 | for (rn = 0; rn < 32; rn++) | |
| 898 | { | |
| 899 | float ff = get_fregval_s (cpustate, rn); | |
| 900 | if ((rn % 4) == 0) | |
| 901 | fprintf (stderr, "\n"); | |
| 902 | fprintf (stderr, "%%f%-3d: 0x%08x ", rn, *(UINT32 *)&ff); | |
| 903 | } | |
| 904 | fprintf (stderr, "\n"); | |
| 905 | ||
| 906 | fprintf (stderr, " psr: CC = %d, LCC = %d, SC = %d, IM = %d, U = %d\n", | |
| 907 | GET_PSR_CC (), GET_PSR_LCC (), GET_PSR_SC (), GET_PSR_IM (), | |
| 908 | GET_PSR_U ()); | |
| 909 | fprintf (stderr, " IT/FT/IAT/DAT/IN = %d/%d/%d/%d/%d\n", | |
| 910 | GET_PSR_IT (), GET_PSR_FT (), GET_PSR_IAT (), | |
| 911 | GET_PSR_DAT (), GET_PSR_IN ()); | |
| 912 | fprintf (stderr, "epsr: INT = %d, OF = %d, BE = %d\n", | |
| 913 | GET_EPSR_INT (), GET_EPSR_OF (), GET_EPSR_BE ()); | |
| 914 | fprintf (stderr, " fir: 0x%08x dirbase: 0x%08x fsr: 0x%08x\n", | |
| 915 | cpustate->cregs[CR_FIR], cpustate->cregs[CR_DIRBASE], | |
| 916 | cpustate->cregs[CR_FSR]); | |
| 917 | fprintf (stderr, " pc: 0x%08x\n", cpustate->pc); | |
| 918 | } | |
| 919 | #endif | |
| 920 | ||
| 921 | /* Sign extend N-bit number. */ | |
| 922 | INLINE INT32 sign_ext (UINT32 x, int n) | |
| 923 | { | |
| 924 | INT32 t; | |
| 925 | t = x >> (n - 1); | |
| 926 | t = ((-t) << n) | x; | |
| 927 | return t; | |
| 928 | } | |
| 929 | ||
| 930 | ||
| 931 | static void unrecog_opcode (UINT32 pc, UINT32 insn) | |
| 932 | { | |
| 933 | fprintf (stderr, "0x%08x: 0x%08x (unrecognized opcode)\n", pc, insn); | |
| 934 | } | |
| 935 | ||
| 936 | ||
| 937 | /* Execute "ld.c csrc2,idest" instruction. */ | |
| 938 | static void insn_ld_ctrl (i860s *cpustate, UINT32 insn) | |
| 939 | { | |
| 940 | UINT32 csrc2 = get_creg (insn); | |
| 941 | UINT32 idest = get_idest (insn); | |
| 942 | ||
| 943 | #ifdef TRACE_UNDEFINED_I860 | |
| 944 | if (csrc2 > 5) | |
| 945 | { | |
| 946 | /* Control register not between 0..5. Undefined i860XR behavior. */ | |
| 947 | fprintf (stderr, "WARNING: insn_ld_from_ctrl (pc=0x%08x): bad creg in ld.c (ignored)\n", cpustate->pc); | |
| 948 | return; | |
| 949 | } | |
| 950 | #endif | |
| 951 | ||
| 952 | /* If this is a load of the fir, then there are two cases: | |
| 953 | 1. First load of fir after a trap = usual value. | |
| 954 | 2. Not first load of fir after a trap = address of the ld.c insn. */ | |
| 955 | if (csrc2 == CR_FIR) | |
| 956 | { | |
| 957 | if (cpustate->fir_gets_trap_addr) | |
| 958 | set_iregval (idest, cpustate->cregs[csrc2]); | |
| 959 | else | |
| 960 | { | |
| 961 | cpustate->cregs[csrc2] = cpustate->pc; | |
| 962 | set_iregval (idest, cpustate->cregs[csrc2]); | |
| 963 | } | |
| 964 | cpustate->fir_gets_trap_addr = 0; | |
| 965 | } | |
| 966 | else | |
| 967 | set_iregval (idest, cpustate->cregs[csrc2]); | |
| 968 | } | |
| 969 | ||
| 970 | ||
| 971 | /* Execute "st.c isrc1,csrc2" instruction. */ | |
| 972 | static void insn_st_ctrl (i860s *cpustate, UINT32 insn) | |
| 973 | { | |
| 974 | UINT32 csrc2 = get_creg (insn); | |
| 975 | UINT32 isrc1 = get_isrc1 (insn); | |
| 976 | ||
| 977 | #ifdef TRACE_UNDEFINED_I860 | |
| 978 | if (csrc2 > 5) | |
| 979 | { | |
| 980 | /* Control register not between 0..5. Undefined i860XR behavior. */ | |
| 981 | fprintf (stderr, "WARNING: insn_st_to_ctrl (pc=0x%08x): bad creg in st.c (ignored)\n", cpustate->pc); | |
| 982 | return; | |
| 983 | } | |
| 984 | #endif | |
| 985 | ||
| 986 | /* Look for ITI bit turned on (but it never actually is written -- | |
| 987 | it always appears to be 0). */ | |
| 988 | if (csrc2 == CR_DIRBASE && (get_iregval (isrc1) & 0x20)) | |
| 989 | { | |
| 990 | /* NOTE: The actual icache and TLB flush are unimplemented for | |
| 991 | the MAME version. */ | |
| 992 | ||
| 993 | /* Make sure ITI isn't actually written. */ | |
| 994 | set_iregval (isrc1, (get_iregval (isrc1) & ~0x20)); | |
| 995 | } | |
| 996 | ||
| 997 | if (csrc2 == CR_DIRBASE && (get_iregval (isrc1) & 1) | |
| 998 | && GET_DIRBASE_ATE () == 0) | |
| 999 | { | |
| 1000 | fprintf (stderr, "0x%08x: ** ATE going high!\n", cpustate->pc); | |
| 1001 | } | |
| 1002 | ||
| 1003 | /* Update the register -- unless it is fir which cannot be updated. */ | |
| 1004 | if (csrc2 == CR_EPSR) | |
| 1005 | { | |
| 1006 | UINT32 enew = 0, tmp = 0; | |
| 1007 | /* Make sure unchangeable EPSR bits stay unchanged (DCS, stepping, | |
| 1008 | and type). Also, some bits are only writeable in supervisor | |
| 1009 | mode. */ | |
| 1010 | if (GET_PSR_U ()) | |
| 1011 | { | |
| 1012 | enew = get_iregval (isrc1) & ~(0x003e1fff | 0x00c06000); | |
| 1013 | tmp = cpustate->cregs[CR_EPSR] & (0x003e1fff | 0x00c06000); | |
| 1014 | } | |
| 1015 | else | |
| 1016 | { | |
| 1017 | enew = get_iregval (isrc1) & ~0x003e1fff; | |
| 1018 | tmp = cpustate->cregs[CR_EPSR] & 0x003e1fff; | |
| 1019 | } | |
| 1020 | cpustate->cregs[CR_EPSR] = enew | tmp; | |
| 1021 | } | |
| 1022 | else if (csrc2 == CR_PSR) | |
| 1023 | { | |
| 1024 | /* Some PSR bits are only writeable in supervisor mode. */ | |
| 1025 | if (GET_PSR_U ()) | |
| 1026 | { | |
| 1027 | UINT32 enew = get_iregval (isrc1) & ~PSR_SUPERVISOR_ONLY_MASK; | |
| 1028 | UINT32 tmp = cpustate->cregs[CR_PSR] & PSR_SUPERVISOR_ONLY_MASK; | |
| 1029 | cpustate->cregs[CR_PSR] = enew | tmp; | |
| 1030 | } | |
| 1031 | else | |
| 1032 | cpustate->cregs[CR_PSR] = get_iregval (isrc1); | |
| 1033 | } | |
| 1034 | else if (csrc2 == CR_FSR) | |
| 1035 | { | |
| 1036 | /* I believe that only 21..17, 8..5, and 3..0 should be updated. */ | |
| 1037 | UINT32 enew = get_iregval (isrc1) & 0x003e01ef; | |
| 1038 | UINT32 tmp = cpustate->cregs[CR_FSR] & ~0x003e01ef; | |
| 1039 | cpustate->cregs[CR_FSR] = enew | tmp; | |
| 1040 | } | |
| 1041 | else if (csrc2 != CR_FIR) | |
| 1042 | cpustate->cregs[csrc2] = get_iregval (isrc1); | |
| 1043 | } | |
| 1044 | ||
| 1045 | ||
| 1046 | /* Execute "ld.{s,b,l} isrc1(isrc2),idest" or | |
| 1047 | "ld.{s,b,l} #const(isrc2),idest". */ | |
| 1048 | static void insn_ldx (i860s *cpustate, UINT32 insn) | |
| 1049 | { | |
| 1050 | UINT32 isrc1 = get_isrc1 (insn); | |
| 1051 | INT32 immsrc1 = sign_ext (get_imm16 (insn), 16); | |
| 1052 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1053 | UINT32 idest = get_idest (insn); | |
| 1054 | UINT32 eff = 0; | |
| 1055 | /* Operand size, in bytes. */ | |
| 1056 | int sizes[4] = { 1, 1, 2, 4}; | |
| 1057 | int size = 0; | |
| 1058 | int form_disp_reg = 0; | |
| 1059 | ||
| 1060 | /* Bits 28 and 0 determine the operand size. */ | |
| 1061 | size = sizes[((insn >> 27) & 2) | (insn & 1)]; | |
| 1062 | ||
| 1063 | /* Bit 26 determines the addressing mode (reg+reg or disp+reg). */ | |
| 1064 | form_disp_reg = (insn & 0x04000000); | |
| 1065 | ||
| 1066 | /* Get effective address depending on disp+reg or reg+reg form. */ | |
| 1067 | if (form_disp_reg) | |
| 1068 | { | |
| 1069 | /* Chop off lower bits of displacement. */ | |
| 1070 | immsrc1 &= ~(size - 1); | |
| 1071 | eff = (UINT32)(immsrc1 + (INT32)(get_iregval (isrc2))); | |
| 1072 | } | |
| 1073 | else | |
| 1074 | eff = get_iregval (isrc1) + get_iregval (isrc2); | |
| 1075 | ||
| 1076 | #ifdef TRACE_UNALIGNED_MEM | |
| 1077 | if (eff & (size - 1)) | |
| 1078 | { | |
| 1079 | fprintf (stderr, "0x%08x: Unaligned access detected (0x%08x).\n", | |
| 1080 | cpustate->pc, eff); | |
| 1081 | SET_PSR_DAT (1); | |
| 1082 | cpustate->pending_trap = 1; | |
| 1083 | return; | |
| 1084 | } | |
| 1085 | #endif | |
| 1086 | ||
| 1087 | /* The i860 sign-extends 8- or 16-bit integer loads. | |
| 1088 | ||
| 1089 | Below, the readmemi_emu() needs to happen outside of the | |
| 1090 | set_iregval macro (otherwise the readmem won't occur if r0 | |
| 1091 | is the target register). */ | |
| 1092 | if (size < 4) | |
| 1093 | { | |
| 1094 | UINT32 readval = sign_ext (readmemi_emu (cpustate, eff, size), size * 8); | |
| 1095 | /* Do not update register on page fault. */ | |
| 1096 | if (cpustate->exiting_readmem) | |
| 1097 | { | |
| 1098 | return; | |
| 1099 | } | |
| 1100 | set_iregval (idest, readval); | |
| 1101 | } | |
| 1102 | else | |
| 1103 | { | |
| 1104 | UINT32 readval = readmemi_emu (cpustate, eff, size); | |
| 1105 | /* Do not update register on page fault. */ | |
| 1106 | if (cpustate->exiting_readmem) | |
| 1107 | { | |
| 1108 | return; | |
| 1109 | } | |
| 1110 | set_iregval (idest, readval); | |
| 1111 | } | |
| 1112 | } | |
| 1113 | ||
| 1114 | ||
| 1115 | /* Execute "st.x isrc1ni,#const(isrc2)" instruction (there is no | |
| 1116 | (reg + reg form). Store uses the split immediate, not the normal | |
| 1117 | 16-bit immediate as in ld.x. */ | |
| 1118 | static void insn_stx (i860s *cpustate, UINT32 insn) | |
| 1119 | { | |
| 1120 | INT32 immsrc = sign_ext ((((insn >> 5) & 0xf800) | (insn & 0x07ff)), 16); | |
| 1121 | UINT32 isrc1 = get_isrc1 (insn); | |
| 1122 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1123 | UINT32 eff = 0; | |
| 1124 | /* Operand size, in bytes. */ | |
| 1125 | int sizes[4] = { 1, 1, 2, 4}; | |
| 1126 | int size = 0; | |
| 1127 | ||
| 1128 | /* Bits 28 and 0 determine the operand size. */ | |
| 1129 | size = sizes[((insn >> 27) & 2) | (insn & 1)]; | |
| 1130 | ||
| 1131 | /* FIXME: Do any necessary traps. */ | |
| 1132 | ||
| 1133 | /* Get effective address. Chop off lower bits of displacement. */ | |
| 1134 | immsrc &= ~(size - 1); | |
| 1135 | eff = (UINT32)(immsrc + (INT32)get_iregval (isrc2)); | |
| 1136 | ||
| 1137 | /* Write data (value of reg isrc1) to memory at eff. */ | |
| 1138 | writememi_emu (cpustate, eff, size, get_iregval (isrc1)); | |
| 1139 | if (cpustate->exiting_readmem) | |
| 1140 | return; | |
| 1141 | } | |
| 1142 | ||
| 1143 | ||
| 1144 | /* Execute "fst.y fdest,isrc1(isrc2)", "fst.y fdest,isrc1(isrc2)++", | |
| 1145 | "fst.y fdest,#const(isrc2)" or "fst.y fdest,#const(isrc2)++" | |
| 1146 | instruction. */ | |
| 1147 | static void insn_fsty (i860s *cpustate, UINT32 insn) | |
| 1148 | { | |
| 1149 | UINT32 isrc1 = get_isrc1 (insn); | |
| 1150 | INT32 immsrc1 = sign_ext (get_imm16 (insn), 16); | |
| 1151 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1152 | UINT32 fdest = get_fdest (insn); | |
| 1153 | UINT32 eff = 0; | |
| 1154 | /* Operand size, in bytes. */ | |
| 1155 | int sizes[4] = { 8, 4, 16, 4}; | |
| 1156 | int size = 0; | |
| 1157 | int form_disp_reg = 0; | |
| 1158 | int auto_inc = (insn & 1); | |
| 1159 | ||
| 1160 | /* Bits 2 and 1 determine the operand size. */ | |
| 1161 | size = sizes[((insn >> 1) & 3)]; | |
| 1162 | ||
| 1163 | /* Bit 26 determines the addressing mode (reg+reg or disp+reg). */ | |
| 1164 | form_disp_reg = (insn & 0x04000000); | |
| 1165 | ||
| 1166 | /* FIXME: Check for undefined behavior, non-even or non-quad | |
| 1167 | register operands for fst.d and fst.q respectively. */ | |
| 1168 | ||
| 1169 | /* Get effective address depending on disp+reg or reg+reg form. */ | |
| 1170 | if (form_disp_reg) | |
| 1171 | { | |
| 1172 | /* Chop off lower bits of displacement. */ | |
| 1173 | immsrc1 &= ~(size - 1); | |
| 1174 | eff = (UINT32)(immsrc1 + (INT32)(get_iregval (isrc2))); | |
| 1175 | } | |
| 1176 | else | |
| 1177 | eff = get_iregval (isrc1) + get_iregval (isrc2); | |
| 1178 | ||
| 1179 | #ifdef TRACE_UNALIGNED_MEM | |
| 1180 | if (eff & (size - 1)) | |
| 1181 | { | |
| 1182 | fprintf (stderr, "0x%08x: Unaligned access detected (0x%08x).\n", | |
| 1183 | cpustate->pc, eff); | |
| 1184 | SET_PSR_DAT (1); | |
| 1185 | cpustate->pending_trap = 1; | |
| 1186 | return; | |
| 1187 | } | |
| 1188 | #endif | |
| 1189 | ||
| 1190 | /* Do (post) auto-increment. */ | |
| 1191 | if (auto_inc) | |
| 1192 | { | |
| 1193 | set_iregval (isrc2, eff); | |
| 1194 | #ifdef TRACE_UNDEFINED_I860 | |
| 1195 | /* When auto-inc, isrc1 and isrc2 regs can't be the same. */ | |
| 1196 | if (isrc1 == isrc2) | |
| 1197 | { | |
| 1198 | /* Undefined i860XR behavior. */ | |
| 1199 | fprintf (stderr, "WARNING: insn_fsty (pc=0x%08x): isrc1 = isrc2 in fst with auto-inc (ignored)\n", cpustate->pc); | |
| 1200 | return; | |
| 1201 | } | |
| 1202 | #endif | |
| 1203 | } | |
| 1204 | ||
| 1205 | /* Write data (value of freg fdest) to memory at eff. */ | |
| 1206 | if (size == 4) | |
| 1207 | fp_writemem_emu (cpustate, eff, size, (UINT8 *)(&cpustate->frg[4 * (31 - fdest)]), 0xff); | |
| 1208 | else if (size == 8) | |
| 1209 | fp_writemem_emu (cpustate, eff, size, (UINT8 *)(&cpustate->frg[4 * (31 - (fdest + 1))]), 0xff); | |
| 1210 | else | |
| 1211 | fp_writemem_emu (cpustate, eff, size, (UINT8 *)(&cpustate->frg[4 * (31 - (fdest + 3))]), 0xff); | |
| 1212 | ||
| 1213 | } | |
| 1214 | ||
| 1215 | ||
| 1216 | /* Execute "fld.y isrc1(isrc2),fdest", "fld.y isrc1(isrc2)++,idest", | |
| 1217 | "fld.y #const(isrc2),fdest" or "fld.y #const(isrc2)++,idest". | |
| 1218 | Where y = {l,d,q}. Note, there is no pfld.q, though. */ | |
| 1219 | static void insn_fldy (i860s *cpustate, UINT32 insn) | |
| 1220 | { | |
| 1221 | UINT32 isrc1 = get_isrc1 (insn); | |
| 1222 | INT32 immsrc1 = sign_ext (get_imm16 (insn), 16); | |
| 1223 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1224 | UINT32 fdest = get_fdest (insn); | |
| 1225 | UINT32 eff = 0; | |
| 1226 | /* Operand size, in bytes. */ | |
| 1227 | int sizes[4] = { 8, 4, 16, 4}; | |
| 1228 | int size = 0; | |
| 1229 | int form_disp_reg = 0; | |
| 1230 | int auto_inc = (insn & 1); | |
| 1231 | int piped = (insn & 0x40000000); | |
| 1232 | ||
| 1233 | /* Bits 2 and 1 determine the operand size. */ | |
| 1234 | size = sizes[((insn >> 1) & 3)]; | |
| 1235 | ||
| 1236 | /* Bit 26 determines the addressing mode (reg+reg or disp+reg). */ | |
| 1237 | form_disp_reg = (insn & 0x04000000); | |
| 1238 | ||
| 1239 | /* There is no pipelined load quad. */ | |
| 1240 | if (piped && size == 16) | |
| 1241 | { | |
| 1242 | unrecog_opcode (cpustate->pc, insn); | |
| 1243 | return; | |
| 1244 | } | |
| 1245 | ||
| 1246 | /* FIXME: Check for undefined behavior, non-even or non-quad | |
| 1247 | register operands for fld.d and fld.q respectively. */ | |
| 1248 | ||
| 1249 | /* Get effective address depending on disp+reg or reg+reg form. */ | |
| 1250 | if (form_disp_reg) | |
| 1251 | { | |
| 1252 | /* Chop off lower bits of displacement. */ | |
| 1253 | immsrc1 &= ~(size - 1); | |
| 1254 | eff = (UINT32)(immsrc1 + (INT32)(get_iregval (isrc2))); | |
| 1255 | } | |
| 1256 | else | |
| 1257 | eff = get_iregval (isrc1) + get_iregval (isrc2); | |
| 1258 | ||
| 1259 | /* Do (post) auto-increment. */ | |
| 1260 | if (auto_inc) | |
| 1261 | { | |
| 1262 | set_iregval (isrc2, eff); | |
| 1263 | #ifdef TRACE_UNDEFINED_I860 | |
| 1264 | /* When auto-inc, isrc1 and isrc2 regs can't be the same. */ | |
| 1265 | if (isrc1 == isrc2) | |
| 1266 | { | |
| 1267 | /* Undefined i860XR behavior. */ | |
| 1268 | fprintf (stderr, "WARNING: insn_fldy (pc=0x%08x): isrc1 = isrc2 in fst with auto-inc (ignored)\n", cpustate->pc); | |
| 1269 | return; | |
| 1270 | } | |
| 1271 | #endif | |
| 1272 | } | |
| 1273 | ||
| 1274 | #ifdef TRACE_UNALIGNED_MEM | |
| 1275 | if (eff & (size - 1)) | |
| 1276 | { | |
| 1277 | fprintf (stderr, "0x%08x: Unaligned access detected (0x%08x).\n", | |
| 1278 | cpustate->pc, eff); | |
| 1279 | SET_PSR_DAT (1); | |
| 1280 | cpustate->pending_trap = 1; | |
| 1281 | return; | |
| 1282 | } | |
| 1283 | #endif | |
| 1284 | ||
| 1285 | /* Update the load pipe if necessary. */ | |
| 1286 | /* FIXME: Copy result-status bits to fsr from last stage. */ | |
| 1287 | if (!piped) | |
| 1288 | { | |
| 1289 | /* Scalar version writes the current result to fdest. */ | |
| 1290 | /* Read data at 'eff' into freg 'fdest' (reads to f0 or f1 are | |
| 1291 | thrown away). */ | |
| 1292 | if (fdest > 1) | |
| 1293 | { | |
| 1294 | if (size == 4) | |
| 1295 | fp_readmem_emu (cpustate, eff, size, (UINT8 *)&(cpustate->frg[4 * (31 - fdest)])); | |
| 1296 | else if (size == 8) | |
| 1297 | fp_readmem_emu (cpustate, eff, size, (UINT8 *)&(cpustate->frg[4 * (31 - (fdest + 1))])); | |
| 1298 | else if (size == 16) | |
| 1299 | fp_readmem_emu (cpustate, eff, size, (UINT8 *)&(cpustate->frg[4 * (31 - (fdest + 3))])); | |
| 1300 | } | |
| 1301 | } | |
| 1302 | else | |
| 1303 | { | |
| 1304 | /* Read the data into a temp space first. This way we can test | |
| 1305 | for any traps before updating the pipeline. The pipeline must | |
| 1306 | stay unaffected after a trap so that the instruction can be | |
| 1307 | properly restarted. */ | |
| 1308 | UINT8 bebuf[8]; | |
| 1309 | fp_readmem_emu (cpustate, eff, size, bebuf); | |
| 1310 | if (cpustate->pending_trap && cpustate->exiting_readmem) | |
| 1311 | goto ab_op; | |
| 1312 | ||
| 1313 | /* Pipelined version writes fdest with the result from the last | |
| 1314 | stage of the pipeline, with precision specified by the LRP | |
| 1315 | bit of the stage's result-status bits. */ | |
| 1316 | #if 1 /* FIXME: WIP on FSR update. This may not be correct. */ | |
| 1317 | /* Copy 3rd stage LRP to FSR. */ | |
| 1318 | if (cpustate->L[1 /* 2 */].stat.lrp) | |
| 1319 | cpustate->cregs[CR_FSR] |= 0x04000000; | |
| 1320 | else | |
| 1321 | cpustate->cregs[CR_FSR] &= ~0x04000000; | |
| 1322 | #endif | |
| 1323 | if (cpustate->L[2].stat.lrp) /* 3rd (last) stage. */ | |
| 1324 | set_fregval_d (cpustate, fdest, cpustate->L[2].val.d); | |
| 1325 | else | |
| 1326 | set_fregval_s (cpustate, fdest, cpustate->L[2].val.s); | |
| 1327 | ||
| 1328 | /* Now advance pipeline and write loaded data to first stage. */ | |
| 1329 | cpustate->L[2] = cpustate->L[1]; | |
| 1330 | cpustate->L[1] = cpustate->L[0]; | |
| 1331 | if (size == 8) | |
| 1332 | { | |
| 1333 | UINT8 *t = (UINT8 *)&(cpustate->L[0].val.d); | |
| 1334 | #ifndef HOST_MSB | |
| 1335 | t[7] = bebuf[0]; t[6] = bebuf[1]; t[5] = bebuf[2]; t[4] = bebuf[3]; | |
| 1336 | t[3] = bebuf[4]; t[2] = bebuf[5]; t[1] = bebuf[6]; t[0] = bebuf[7]; | |
| 1337 | #else | |
| 1338 | t[0] = bebuf[0]; t[1] = bebuf[1]; t[2] = bebuf[2]; t[3] = bebuf[3]; | |
| 1339 | t[4] = bebuf[4]; t[5] = bebuf[5]; t[6] = bebuf[6]; t[7] = bebuf[7]; | |
| 1340 | #endif | |
| 1341 | cpustate->L[0].stat.lrp = 1; | |
| 1342 | } | |
| 1343 | else | |
| 1344 | { | |
| 1345 | UINT8 *t = (UINT8 *)&(cpustate->L[0].val.s); | |
| 1346 | #ifndef HOST_MSB | |
| 1347 | t[3] = bebuf[0]; t[2] = bebuf[1]; t[1] = bebuf[2]; t[0] = bebuf[3]; | |
| 1348 | #else | |
| 1349 | t[0] = bebuf[0]; t[1] = bebuf[1]; t[2] = bebuf[2]; t[3] = bebuf[3]; | |
| 1350 | #endif | |
| 1351 | cpustate->L[0].stat.lrp = 0; | |
| 1352 | } | |
| 1353 | } | |
| 1354 | ||
| 1355 | ab_op:; | |
| 1356 | } | |
| 1357 | ||
| 1358 | ||
| 1359 | /* Execute "pst.d fdest,#const(isrc2)" or "fst.d fdest,#const(isrc2)++" | |
| 1360 | instruction. */ | |
| 1361 | static void insn_pstd (i860s *cpustate, UINT32 insn) | |
| 1362 | { | |
| 1363 | INT32 immsrc1 = sign_ext (get_imm16 (insn), 16); | |
| 1364 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1365 | UINT32 fdest = get_fdest (insn); | |
| 1366 | UINT32 eff = 0; | |
| 1367 | int auto_inc = (insn & 1); | |
| 1368 | UINT8 *bebuf = 0; | |
| 1369 | int pm = GET_PSR_PM (); | |
| 1370 | int i; | |
| 1371 | UINT32 wmask; | |
| 1372 | int orig_pm = pm; | |
| 1373 | ||
| 1374 | /* Get the pixel size, where: | |
| 1375 | PS: 0 = 8 bits, 1 = 16 bits, 2 = 32-bits. */ | |
| 1376 | int ps = GET_PSR_PS (); | |
| 1377 | ||
| 1378 | #ifdef TRACE_UNDEFINED_I860 | |
| 1379 | if (!(ps == 0 || ps == 1 || ps == 2)) | |
| 1380 | fprintf (stderr, "insn_pstd: Undefined i860XR behavior, invalid value %d for pixel size.\n", ps); | |
| 1381 | #endif | |
| 1382 | ||
| 1383 | #ifdef TRACE_UNDEFINED_I860 | |
| 1384 | /* Bits 2 and 1 determine the operand size, which must always be | |
| 1385 | zero (indicating a 64-bit operand). */ | |
| 1386 | if (insn & 0x6) | |
| 1387 | { | |
| 1388 | /* Undefined i860XR behavior. */ | |
| 1389 | fprintf (stderr, "WARNING: insn_pstd (pc=0x%08x): bad operand size specifier\n", cpustate->pc); | |
| 1390 | } | |
| 1391 | #endif | |
| 1392 | ||
| 1393 | /* FIXME: Check for undefined behavior, non-even register operands. */ | |
| 1394 | ||
| 1395 | /* Get effective address. Chop off lower bits of displacement. */ | |
| 1396 | immsrc1 &= ~(8 - 1); | |
| 1397 | eff = (UINT32)(immsrc1 + (INT32)(get_iregval (isrc2))); | |
| 1398 | ||
| 1399 | #ifdef TRACE_UNALIGNED_MEM | |
| 1400 | if (eff & (8 - 1)) | |
| 1401 | { | |
| 1402 | fprintf (stderr, "0x%08x: Unaligned access detected (0x%08x).\n", | |
| 1403 | cpustate->pc, eff); | |
| 1404 | SET_PSR_DAT (1); | |
| 1405 | cpustate->pending_trap = 1; | |
| 1406 | return; | |
| 1407 | } | |
| 1408 | #endif | |
| 1409 | ||
| 1410 | /* Do (post) auto-increment. */ | |
| 1411 | if (auto_inc) | |
| 1412 | set_iregval (isrc2, eff); | |
| 1413 | ||
| 1414 | /* Update the the pixel mask depending on the pixel size. Shift PM | |
| 1415 | right by 8/2^ps bits. */ | |
| 1416 | if (ps == 0) | |
| 1417 | pm = (pm >> 8) & 0x00; | |
| 1418 | else if (ps == 1) | |
| 1419 | pm = (pm >> 4) & 0x0f; | |
| 1420 | else if (ps == 2) | |
| 1421 | pm = (pm >> 2) & 0x3f; | |
| 1422 | SET_PSR_PM (pm); | |
| 1423 | ||
| 1424 | /* Write data (value of freg fdest) to memory at eff-- but only those | |
| 1425 | bytes that are enabled by the bits in PSR.PM. Bit 0 of PM selects | |
| 1426 | the pixel at the lowest address. */ | |
| 1427 | wmask = 0; | |
| 1428 | for (i = 0; i < 8; ) | |
| 1429 | { | |
| 1430 | if (ps == 0) | |
| 1431 | { | |
| 1432 | if (orig_pm & 0x80) | |
| 1433 | wmask |= 1 << (7-i); | |
| 1434 | i += 1; | |
| 1435 | } | |
| 1436 | else if (ps == 1) | |
| 1437 | { | |
| 1438 | if (orig_pm & 0x08) | |
| 1439 | wmask |= 0x3 << (6-i); | |
| 1440 | i += 2; | |
| 1441 | } | |
| 1442 | else if (ps == 2) | |
| 1443 | { | |
| 1444 | if (orig_pm & 0x02) | |
| 1445 | wmask |= 0xf << (4-i); | |
| 1446 | i += 4; | |
| 1447 | } | |
| 1448 | else | |
| 1449 | { | |
| 1450 | wmask = 0xff; | |
| 1451 | break; | |
| 1452 | } | |
| 1453 | orig_pm <<= 1; | |
| 1454 | } | |
| 1455 | bebuf = (UINT8 *)(&cpustate->frg[4 * (31 - (fdest + 1))]); | |
| 1456 | fp_writemem_emu (cpustate, eff, 8, bebuf, wmask); | |
| 1457 | } | |
| 1458 | ||
| 1459 | ||
| 1460 | /* Execute "ixfr isrc1ni,fdest" instruction. */ | |
| 1461 | static void insn_ixfr (i860s *cpustate, UINT32 insn) | |
| 1462 | { | |
| 1463 | UINT32 isrc1 = get_isrc1 (insn); | |
| 1464 | UINT32 fdest = get_fdest (insn); | |
| 1465 | UINT32 iv = 0; | |
| 1466 | ||
| 1467 | /* This is a bit-pattern transfer, not a conversion. */ | |
| 1468 | iv = get_iregval (isrc1); | |
| 1469 | set_fregval_s (cpustate, fdest, *(float *)&iv); | |
| 1470 | } | |
| 1471 | ||
| 1472 | ||
| 1473 | /* Execute "addu isrc1,isrc2,idest". */ | |
| 1474 | static void insn_addu (i860s *cpustate, UINT32 insn) | |
| 1475 | { | |
| 1476 | UINT32 src1val; | |
| 1477 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1478 | UINT32 idest = get_idest (insn); | |
| 1479 | UINT32 tmp_dest_val = 0; | |
| 1480 | UINT64 tmp = 0; | |
| 1481 | ||
| 1482 | src1val = get_iregval (get_isrc1 (insn)); | |
| 1483 | ||
| 1484 | /* We don't update the actual idest register now because below we | |
| 1485 | need to test the original src1 and src2 if either happens to | |
| 1486 | be the destination register. */ | |
| 1487 | tmp_dest_val = src1val + get_iregval (isrc2); | |
| 1488 | ||
| 1489 | /* Set OF and CC flags. | |
| 1490 | For unsigned: | |
| 1491 | OF = bit 31 carry | |
| 1492 | CC = bit 31 carry. | |
| 1493 | */ | |
| 1494 | tmp = (UINT64)src1val + (UINT64)(get_iregval (isrc2)); | |
| 1495 | if ((tmp >> 32) & 1) | |
| 1496 | { | |
| 1497 | SET_PSR_CC (1); | |
| 1498 | SET_EPSR_OF (1); | |
| 1499 | } | |
| 1500 | else | |
| 1501 | { | |
| 1502 | SET_PSR_CC (0); | |
| 1503 | SET_EPSR_OF (0); | |
| 1504 | } | |
| 1505 | ||
| 1506 | /* Now update the destination register. */ | |
| 1507 | set_iregval (idest, tmp_dest_val); | |
| 1508 | } | |
| 1509 | ||
| 1510 | ||
| 1511 | /* Execute "addu #const,isrc2,idest". */ | |
| 1512 | static void insn_addu_imm (i860s *cpustate, UINT32 insn) | |
| 1513 | { | |
| 1514 | UINT32 src1val; | |
| 1515 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1516 | UINT32 idest = get_idest (insn); | |
| 1517 | UINT32 tmp_dest_val = 0; | |
| 1518 | UINT64 tmp = 0; | |
| 1519 | ||
| 1520 | src1val = sign_ext (get_imm16 (insn), 16); | |
| 1521 | ||
| 1522 | /* We don't update the actual idest register now because below we | |
| 1523 | need to test the original src1 and src2 if either happens to | |
| 1524 | be the destination register. */ | |
| 1525 | tmp_dest_val = src1val + get_iregval (isrc2); | |
| 1526 | ||
| 1527 | /* Set OF and CC flags. | |
| 1528 | For unsigned: | |
| 1529 | OF = bit 31 carry | |
| 1530 | CC = bit 31 carry. | |
| 1531 | */ | |
| 1532 | tmp = (UINT64)src1val + (UINT64)(get_iregval (isrc2)); | |
| 1533 | if ((tmp >> 32) & 1) | |
| 1534 | { | |
| 1535 | SET_PSR_CC (1); | |
| 1536 | SET_EPSR_OF (1); | |
| 1537 | } | |
| 1538 | else | |
| 1539 | { | |
| 1540 | SET_PSR_CC (0); | |
| 1541 | SET_EPSR_OF (0); | |
| 1542 | } | |
| 1543 | ||
| 1544 | /* Now update the destination register. */ | |
| 1545 | set_iregval (idest, tmp_dest_val); | |
| 1546 | } | |
| 1547 | ||
| 1548 | ||
| 1549 | /* Execute "adds isrc1,isrc2,idest". */ | |
| 1550 | static void insn_adds (i860s *cpustate, UINT32 insn) | |
| 1551 | { | |
| 1552 | UINT32 src1val; | |
| 1553 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1554 | UINT32 idest = get_idest (insn); | |
| 1555 | UINT32 tmp_dest_val = 0; | |
| 1556 | int sa, sb, sres; | |
| 1557 | ||
| 1558 | src1val = get_iregval (get_isrc1 (insn)); | |
| 1559 | ||
| 1560 | /* We don't update the actual idest register now because below we | |
| 1561 | need to test the original src1 and src2 if either happens to | |
| 1562 | be the destination register. */ | |
| 1563 | tmp_dest_val = src1val + get_iregval (isrc2); | |
| 1564 | ||
| 1565 | /* Set OF and CC flags. | |
| 1566 | For signed: | |
| 1567 | OF = standard signed overflow. | |
| 1568 | CC set if isrc2 < -isrc1 | |
| 1569 | CC clear if isrc2 >= -isrc1 | |
| 1570 | */ | |
| 1571 | sa = src1val & 0x80000000; | |
| 1572 | sb = get_iregval (isrc2) & 0x80000000; | |
| 1573 | sres = tmp_dest_val & 0x80000000; | |
| 1574 | if (sa != sb && sa != sres) | |
| 1575 | SET_EPSR_OF (1); | |
| 1576 | else | |
| 1577 | SET_EPSR_OF (0); | |
| 1578 | ||
| 1579 | if ((INT32)get_iregval (isrc2) < -(INT32)(src1val)) | |
| 1580 | SET_PSR_CC (1); | |
| 1581 | else | |
| 1582 | SET_PSR_CC (0); | |
| 1583 | ||
| 1584 | /* Now update the destination register. */ | |
| 1585 | set_iregval (idest, tmp_dest_val); | |
| 1586 | } | |
| 1587 | ||
| 1588 | ||
| 1589 | /* Execute "adds #const,isrc2,idest". */ | |
| 1590 | static void insn_adds_imm (i860s *cpustate, UINT32 insn) | |
| 1591 | { | |
| 1592 | UINT32 src1val; | |
| 1593 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1594 | UINT32 idest = get_idest (insn); | |
| 1595 | UINT32 tmp_dest_val = 0; | |
| 1596 | int sa, sb, sres; | |
| 1597 | ||
| 1598 | src1val = sign_ext (get_imm16 (insn), 16); | |
| 1599 | ||
| 1600 | /* We don't update the actual idest register now because below we | |
| 1601 | need to test the original src1 and src2 if either happens to | |
| 1602 | be the destination register. */ | |
| 1603 | tmp_dest_val = src1val + get_iregval (isrc2); | |
| 1604 | ||
| 1605 | /* Set OF and CC flags. | |
| 1606 | For signed: | |
| 1607 | OF = standard signed overflow. | |
| 1608 | CC set if isrc2 < -isrc1 | |
| 1609 | CC clear if isrc2 >= -isrc1 | |
| 1610 | */ | |
| 1611 | sa = src1val & 0x80000000; | |
| 1612 | sb = get_iregval (isrc2) & 0x80000000; | |
| 1613 | sres = tmp_dest_val & 0x80000000; | |
| 1614 | if (sa != sb && sa != sres) | |
| 1615 | SET_EPSR_OF (1); | |
| 1616 | else | |
| 1617 | SET_EPSR_OF (0); | |
| 1618 | ||
| 1619 | if ((INT32)get_iregval (isrc2) < -(INT32)(src1val)) | |
| 1620 | SET_PSR_CC (1); | |
| 1621 | else | |
| 1622 | SET_PSR_CC (0); | |
| 1623 | ||
| 1624 | /* Now update the destination register. */ | |
| 1625 | set_iregval (idest, tmp_dest_val); | |
| 1626 | } | |
| 1627 | ||
| 1628 | ||
| 1629 | /* Execute "subu isrc1,isrc2,idest". */ | |
| 1630 | static void insn_subu (i860s *cpustate, UINT32 insn) | |
| 1631 | { | |
| 1632 | UINT32 src1val; | |
| 1633 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1634 | UINT32 idest = get_idest (insn); | |
| 1635 | UINT32 tmp_dest_val = 0; | |
| 1636 | ||
| 1637 | src1val = get_iregval (get_isrc1 (insn)); | |
| 1638 | ||
| 1639 | /* We don't update the actual idest register now because below we | |
| 1640 | need to test the original src1 and src2 if either happens to | |
| 1641 | be the destination register. */ | |
| 1642 | tmp_dest_val = src1val - get_iregval (isrc2); | |
| 1643 | ||
| 1644 | /* Set OF and CC flags. | |
| 1645 | For unsigned: | |
| 1646 | OF = NOT(bit 31 carry) | |
| 1647 | CC = bit 31 carry. | |
| 1648 | (i.e. CC set if isrc2 <= isrc1 | |
| 1649 | CC clear if isrc2 > isrc1 | |
| 1650 | */ | |
| 1651 | if ((UINT32)get_iregval (isrc2) <= (UINT32)src1val) | |
| 1652 | { | |
| 1653 | SET_PSR_CC (1); | |
| 1654 | SET_EPSR_OF (0); | |
| 1655 | } | |
| 1656 | else | |
| 1657 | { | |
| 1658 | SET_PSR_CC (0); | |
| 1659 | SET_EPSR_OF (1); | |
| 1660 | } | |
| 1661 | ||
| 1662 | /* Now update the destination register. */ | |
| 1663 | set_iregval (idest, tmp_dest_val); | |
| 1664 | } | |
| 1665 | ||
| 1666 | ||
| 1667 | /* Execute "subu #const,isrc2,idest". */ | |
| 1668 | static void insn_subu_imm (i860s *cpustate, UINT32 insn) | |
| 1669 | { | |
| 1670 | UINT32 src1val; | |
| 1671 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1672 | UINT32 idest = get_idest (insn); | |
| 1673 | UINT32 tmp_dest_val = 0; | |
| 1674 | ||
| 1675 | src1val = sign_ext (get_imm16 (insn), 16); | |
| 1676 | ||
| 1677 | /* We don't update the actual idest register now because below we | |
| 1678 | need to test the original src1 and src2 if either happens to | |
| 1679 | be the destination register. */ | |
| 1680 | tmp_dest_val = src1val - get_iregval (isrc2); | |
| 1681 | ||
| 1682 | /* Set OF and CC flags. | |
| 1683 | For unsigned: | |
| 1684 | OF = NOT(bit 31 carry) | |
| 1685 | CC = bit 31 carry. | |
| 1686 | (i.e. CC set if isrc2 <= isrc1 | |
| 1687 | CC clear if isrc2 > isrc1 | |
| 1688 | */ | |
| 1689 | if ((UINT32)get_iregval (isrc2) <= (UINT32)src1val) | |
| 1690 | { | |
| 1691 | SET_PSR_CC (1); | |
| 1692 | SET_EPSR_OF (0); | |
| 1693 | } | |
| 1694 | else | |
| 1695 | { | |
| 1696 | SET_PSR_CC (0); | |
| 1697 | SET_EPSR_OF (1); | |
| 1698 | } | |
| 1699 | ||
| 1700 | /* Now update the destination register. */ | |
| 1701 | set_iregval (idest, tmp_dest_val); | |
| 1702 | } | |
| 1703 | ||
| 1704 | ||
| 1705 | /* Execute "subs isrc1,isrc2,idest". */ | |
| 1706 | static void insn_subs (i860s *cpustate, UINT32 insn) | |
| 1707 | { | |
| 1708 | UINT32 src1val; | |
| 1709 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1710 | UINT32 idest = get_idest (insn); | |
| 1711 | UINT32 tmp_dest_val = 0; | |
| 1712 | int sa, sb, sres; | |
| 1713 | ||
| 1714 | src1val = get_iregval (get_isrc1 (insn)); | |
| 1715 | ||
| 1716 | /* We don't update the actual idest register now because below we | |
| 1717 | need to test the original src1 and src2 if either happens to | |
| 1718 | be the destination register. */ | |
| 1719 | tmp_dest_val = src1val - get_iregval (isrc2); | |
| 1720 | ||
| 1721 | /* Set OF and CC flags. | |
| 1722 | For signed: | |
| 1723 | OF = standard signed overflow. | |
| 1724 | CC set if isrc2 > isrc1 | |
| 1725 | CC clear if isrc2 <= isrc1 | |
| 1726 | */ | |
| 1727 | sa = src1val & 0x80000000; | |
| 1728 | sb = get_iregval (isrc2) & 0x80000000; | |
| 1729 | sres = tmp_dest_val & 0x80000000; | |
| 1730 | if (sa != sb && sa != sres) | |
| 1731 | SET_EPSR_OF (1); | |
| 1732 | else | |
| 1733 | SET_EPSR_OF (0); | |
| 1734 | ||
| 1735 | if ((INT32)get_iregval (isrc2) > (INT32)(src1val)) | |
| 1736 | SET_PSR_CC (1); | |
| 1737 | else | |
| 1738 | SET_PSR_CC (0); | |
| 1739 | ||
| 1740 | /* Now update the destination register. */ | |
| 1741 | set_iregval (idest, tmp_dest_val); | |
| 1742 | } | |
| 1743 | ||
| 1744 | ||
| 1745 | /* Execute "subs #const,isrc2,idest". */ | |
| 1746 | static void insn_subs_imm (i860s *cpustate, UINT32 insn) | |
| 1747 | { | |
| 1748 | UINT32 src1val; | |
| 1749 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1750 | UINT32 idest = get_idest (insn); | |
| 1751 | UINT32 tmp_dest_val = 0; | |
| 1752 | int sa, sb, sres; | |
| 1753 | ||
| 1754 | src1val = sign_ext (get_imm16 (insn), 16); | |
| 1755 | ||
| 1756 | /* We don't update the actual idest register now because below we | |
| 1757 | need to test the original src1 and src2 if either happens to | |
| 1758 | be the destination register. */ | |
| 1759 | tmp_dest_val = src1val - get_iregval (isrc2); | |
| 1760 | ||
| 1761 | /* Set OF and CC flags. | |
| 1762 | For signed: | |
| 1763 | OF = standard signed overflow. | |
| 1764 | CC set if isrc2 > isrc1 | |
| 1765 | CC clear if isrc2 <= isrc1 | |
| 1766 | */ | |
| 1767 | sa = src1val & 0x80000000; | |
| 1768 | sb = get_iregval (isrc2) & 0x80000000; | |
| 1769 | sres = tmp_dest_val & 0x80000000; | |
| 1770 | if (sa != sb && sa != sres) | |
| 1771 | SET_EPSR_OF (1); | |
| 1772 | else | |
| 1773 | SET_EPSR_OF (0); | |
| 1774 | ||
| 1775 | if ((INT32)get_iregval (isrc2) > (INT32)(src1val)) | |
| 1776 | SET_PSR_CC (1); | |
| 1777 | else | |
| 1778 | SET_PSR_CC (0); | |
| 1779 | ||
| 1780 | /* Now update the destination register. */ | |
| 1781 | set_iregval (idest, tmp_dest_val); | |
| 1782 | } | |
| 1783 | ||
| 1784 | ||
| 1785 | /* Execute "shl isrc1,isrc2,idest". */ | |
| 1786 | static void insn_shl (i860s *cpustate, UINT32 insn) | |
| 1787 | { | |
| 1788 | UINT32 src1val = 0; | |
| 1789 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1790 | UINT32 idest = get_idest (insn); | |
| 1791 | ||
| 1792 | src1val = get_iregval (get_isrc1 (insn)); | |
| 1793 | set_iregval (idest, get_iregval (isrc2) << src1val); | |
| 1794 | } | |
| 1795 | ||
| 1796 | ||
| 1797 | /* Execute "shl #const,isrc2,idest". */ | |
| 1798 | static void insn_shl_imm (i860s *cpustate, UINT32 insn) | |
| 1799 | { | |
| 1800 | UINT32 src1val = 0; | |
| 1801 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1802 | UINT32 idest = get_idest (insn); | |
| 1803 | ||
| 1804 | src1val = sign_ext (get_imm16 (insn), 16); | |
| 1805 | set_iregval (idest, get_iregval (isrc2) << src1val); | |
| 1806 | } | |
| 1807 | ||
| 1808 | ||
| 1809 | /* Execute "shr isrc1,isrc2,idest". */ | |
| 1810 | static void insn_shr (i860s *cpustate, UINT32 insn) | |
| 1811 | { | |
| 1812 | UINT32 src1val = 0; | |
| 1813 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1814 | UINT32 idest = get_idest (insn); | |
| 1815 | ||
| 1816 | src1val = get_iregval (get_isrc1 (insn)); | |
| 1817 | ||
| 1818 | /* The iregs array is UINT32, so this is a logical shift. */ | |
| 1819 | set_iregval (idest, get_iregval (isrc2) >> src1val); | |
| 1820 | ||
| 1821 | /* shr also sets the SC in psr (shift count). */ | |
| 1822 | SET_PSR_SC (src1val); | |
| 1823 | } | |
| 1824 | ||
| 1825 | ||
| 1826 | /* Execute "shr #const,isrc2,idest". */ | |
| 1827 | static void insn_shr_imm (i860s *cpustate, UINT32 insn) | |
| 1828 | { | |
| 1829 | UINT32 src1val = 0; | |
| 1830 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1831 | UINT32 idest = get_idest (insn); | |
| 1832 | ||
| 1833 | src1val = sign_ext (get_imm16 (insn), 16); | |
| 1834 | ||
| 1835 | /* The iregs array is UINT32, so this is a logical shift. */ | |
| 1836 | set_iregval (idest, get_iregval (isrc2) >> src1val); | |
| 1837 | ||
| 1838 | /* shr also sets the SC in psr (shift count). */ | |
| 1839 | SET_PSR_SC (src1val); | |
| 1840 | } | |
| 1841 | ||
| 1842 | ||
| 1843 | /* Execute "shra isrc1,isrc2,idest". */ | |
| 1844 | static void insn_shra (i860s *cpustate, UINT32 insn) | |
| 1845 | { | |
| 1846 | UINT32 src1val = 0; | |
| 1847 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1848 | UINT32 idest = get_idest (insn); | |
| 1849 | ||
| 1850 | src1val = get_iregval (get_isrc1 (insn)); | |
| 1851 | ||
| 1852 | /* The iregs array is UINT32, so cast isrc2 to get arithmetic shift. */ | |
| 1853 | set_iregval (idest, (INT32)get_iregval (isrc2) >> src1val); | |
| 1854 | } | |
| 1855 | ||
| 1856 | ||
| 1857 | /* Execute "shra #const,isrc2,idest". */ | |
| 1858 | static void insn_shra_imm (i860s *cpustate, UINT32 insn) | |
| 1859 | { | |
| 1860 | UINT32 src1val = 0; | |
| 1861 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1862 | UINT32 idest = get_idest (insn); | |
| 1863 | ||
| 1864 | src1val = sign_ext (get_imm16 (insn), 16); | |
| 1865 | ||
| 1866 | /* The iregs array is UINT32, so cast isrc2 to get arithmetic shift. */ | |
| 1867 | set_iregval (idest, (INT32)get_iregval (isrc2) >> src1val); | |
| 1868 | } | |
| 1869 | ||
| 1870 | ||
| 1871 | /* Execute "shrd isrc1ni,isrc2,idest" instruction. */ | |
| 1872 | static void insn_shrd (i860s *cpustate, UINT32 insn) | |
| 1873 | { | |
| 1874 | UINT32 isrc1 = get_isrc1 (insn); | |
| 1875 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1876 | UINT32 idest = get_idest (insn); | |
| 1877 | UINT32 sc = GET_PSR_SC (); | |
| 1878 | UINT32 tmp; | |
| 1879 | ||
| 1880 | /* Do the operation: | |
| 1881 | idest = low_32(isrc1ni:isrc2 >> sc). */ | |
| 1882 | if (sc == 0) | |
| 1883 | tmp = get_iregval (isrc2); | |
| 1884 | else | |
| 1885 | { | |
| 1886 | tmp = get_iregval (isrc1) << (32 - sc); | |
| 1887 | tmp |= (get_iregval (isrc2) >> sc); | |
| 1888 | } | |
| 1889 | set_iregval (idest, tmp); | |
| 1890 | } | |
| 1891 | ||
| 1892 | ||
| 1893 | /* Execute "and isrc1,isrc2,idest". */ | |
| 1894 | static void insn_and (i860s *cpustate, UINT32 insn) | |
| 1895 | { | |
| 1896 | UINT32 isrc1 = get_isrc1 (insn); | |
| 1897 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1898 | UINT32 idest = get_idest (insn); | |
| 1899 | UINT32 res = 0; | |
| 1900 | ||
| 1901 | /* Do the operation. */ | |
| 1902 | res = get_iregval (isrc1) & get_iregval (isrc2); | |
| 1903 | ||
| 1904 | /* Set flags. */ | |
| 1905 | if (res == 0) | |
| 1906 | SET_PSR_CC (1); | |
| 1907 | else | |
| 1908 | SET_PSR_CC (0); | |
| 1909 | ||
| 1910 | set_iregval (idest, res); | |
| 1911 | } | |
| 1912 | ||
| 1913 | ||
| 1914 | /* Execute "and #const,isrc2,idest". */ | |
| 1915 | static void insn_and_imm (i860s *cpustate, UINT32 insn) | |
| 1916 | { | |
| 1917 | UINT32 src1val = 0; | |
| 1918 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1919 | UINT32 idest = get_idest (insn); | |
| 1920 | UINT32 res = 0; | |
| 1921 | ||
| 1922 | /* Do the operation. */ | |
| 1923 | src1val = get_imm16 (insn); | |
| 1924 | res = src1val & get_iregval (isrc2); | |
| 1925 | ||
| 1926 | /* Set flags. */ | |
| 1927 | if (res == 0) | |
| 1928 | SET_PSR_CC (1); | |
| 1929 | else | |
| 1930 | SET_PSR_CC (0); | |
| 1931 | ||
| 1932 | set_iregval (idest, res); | |
| 1933 | } | |
| 1934 | ||
| 1935 | ||
| 1936 | /* Execute "andh #const,isrc2,idest". */ | |
| 1937 | static void insn_andh_imm (i860s *cpustate, UINT32 insn) | |
| 1938 | { | |
| 1939 | UINT32 src1val = 0; | |
| 1940 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1941 | UINT32 idest = get_idest (insn); | |
| 1942 | UINT32 res = 0; | |
| 1943 | ||
| 1944 | /* Do the operation. */ | |
| 1945 | src1val = get_imm16 (insn); | |
| 1946 | res = (src1val << 16) & get_iregval (isrc2); | |
| 1947 | ||
| 1948 | /* Set flags. */ | |
| 1949 | if (res == 0) | |
| 1950 | SET_PSR_CC (1); | |
| 1951 | else | |
| 1952 | SET_PSR_CC (0); | |
| 1953 | ||
| 1954 | set_iregval (idest, res); | |
| 1955 | } | |
| 1956 | ||
| 1957 | ||
| 1958 | /* Execute "andnot isrc1,isrc2,idest". */ | |
| 1959 | static void insn_andnot (i860s *cpustate, UINT32 insn) | |
| 1960 | { | |
| 1961 | UINT32 isrc1 = get_isrc1 (insn); | |
| 1962 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1963 | UINT32 idest = get_idest (insn); | |
| 1964 | UINT32 res = 0; | |
| 1965 | ||
| 1966 | /* Do the operation. */ | |
| 1967 | res = (~get_iregval (isrc1)) & get_iregval (isrc2); | |
| 1968 | ||
| 1969 | /* Set flags. */ | |
| 1970 | if (res == 0) | |
| 1971 | SET_PSR_CC (1); | |
| 1972 | else | |
| 1973 | SET_PSR_CC (0); | |
| 1974 | ||
| 1975 | set_iregval (idest, res); | |
| 1976 | } | |
| 1977 | ||
| 1978 | ||
| 1979 | /* Execute "andnot #const,isrc2,idest". */ | |
| 1980 | static void insn_andnot_imm (i860s *cpustate, UINT32 insn) | |
| 1981 | { | |
| 1982 | UINT32 src1val = 0; | |
| 1983 | UINT32 isrc2 = get_isrc2 (insn); | |
| 1984 | UINT32 idest = get_idest (insn); | |
| 1985 | UINT32 res = 0; | |
| 1986 | ||
| 1987 | /* Do the operation. */ | |
| 1988 | src1val = get_imm16 (insn); | |
| 1989 | res = (~src1val) & get_iregval (isrc2); | |
| 1990 | ||
| 1991 | /* Set flags. */ | |
| 1992 | if (res == 0) | |
| 1993 | SET_PSR_CC (1); | |
| 1994 | else | |
| 1995 | SET_PSR_CC (0); | |
| 1996 | ||
| 1997 | set_iregval (idest, res); | |
| 1998 | } | |
| 1999 | ||
| 2000 | ||
| 2001 | /* Execute "andnoth #const,isrc2,idest". */ | |
| 2002 | static void insn_andnoth_imm (i860s *cpustate, UINT32 insn) | |
| 2003 | { | |
| 2004 | UINT32 src1val = 0; | |
| 2005 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2006 | UINT32 idest = get_idest (insn); | |
| 2007 | UINT32 res = 0; | |
| 2008 | ||
| 2009 | /* Do the operation. */ | |
| 2010 | src1val = get_imm16 (insn); | |
| 2011 | res = (~(src1val << 16)) & get_iregval (isrc2); | |
| 2012 | ||
| 2013 | /* Set flags. */ | |
| 2014 | if (res == 0) | |
| 2015 | SET_PSR_CC (1); | |
| 2016 | else | |
| 2017 | SET_PSR_CC (0); | |
| 2018 | ||
| 2019 | set_iregval (idest, res); | |
| 2020 | } | |
| 2021 | ||
| 2022 | ||
| 2023 | /* Execute "or isrc1,isrc2,idest". */ | |
| 2024 | static void insn_or (i860s *cpustate, UINT32 insn) | |
| 2025 | { | |
| 2026 | UINT32 isrc1 = get_isrc1 (insn); | |
| 2027 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2028 | UINT32 idest = get_idest (insn); | |
| 2029 | UINT32 res = 0; | |
| 2030 | ||
| 2031 | /* Do the operation. */ | |
| 2032 | res = get_iregval (isrc1) | get_iregval (isrc2); | |
| 2033 | ||
| 2034 | /* Set flags. */ | |
| 2035 | if (res == 0) | |
| 2036 | SET_PSR_CC (1); | |
| 2037 | else | |
| 2038 | SET_PSR_CC (0); | |
| 2039 | ||
| 2040 | set_iregval (idest, res); | |
| 2041 | } | |
| 2042 | ||
| 2043 | ||
| 2044 | /* Execute "or #const,isrc2,idest". */ | |
| 2045 | static void insn_or_imm (i860s *cpustate, UINT32 insn) | |
| 2046 | { | |
| 2047 | UINT32 src1val = 0; | |
| 2048 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2049 | UINT32 idest = get_idest (insn); | |
| 2050 | UINT32 res = 0; | |
| 2051 | ||
| 2052 | /* Do the operation. */ | |
| 2053 | src1val = get_imm16 (insn); | |
| 2054 | res = src1val | get_iregval (isrc2); | |
| 2055 | ||
| 2056 | /* Set flags. */ | |
| 2057 | if (res == 0) | |
| 2058 | SET_PSR_CC (1); | |
| 2059 | else | |
| 2060 | SET_PSR_CC (0); | |
| 2061 | ||
| 2062 | set_iregval (idest, res); | |
| 2063 | } | |
| 2064 | ||
| 2065 | ||
| 2066 | /* Execute "orh #const,isrc2,idest". */ | |
| 2067 | static void insn_orh_imm (i860s *cpustate, UINT32 insn) | |
| 2068 | { | |
| 2069 | UINT32 src1val = 0; | |
| 2070 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2071 | UINT32 idest = get_idest (insn); | |
| 2072 | UINT32 res = 0; | |
| 2073 | ||
| 2074 | /* Do the operation. */ | |
| 2075 | src1val = get_imm16 (insn); | |
| 2076 | res = (src1val << 16) | get_iregval (isrc2); | |
| 2077 | ||
| 2078 | /* Set flags. */ | |
| 2079 | if (res == 0) | |
| 2080 | SET_PSR_CC (1); | |
| 2081 | else | |
| 2082 | SET_PSR_CC (0); | |
| 2083 | ||
| 2084 | set_iregval (idest, res); | |
| 2085 | } | |
| 2086 | ||
| 2087 | ||
| 2088 | /* Execute "xor isrc1,isrc2,idest". */ | |
| 2089 | static void insn_xor (i860s *cpustate, UINT32 insn) | |
| 2090 | { | |
| 2091 | UINT32 isrc1 = get_isrc1 (insn); | |
| 2092 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2093 | UINT32 idest = get_idest (insn); | |
| 2094 | UINT32 res = 0; | |
| 2095 | ||
| 2096 | /* Do the operation. */ | |
| 2097 | res = get_iregval (isrc1) ^ get_iregval (isrc2); | |
| 2098 | ||
| 2099 | /* Set flags. */ | |
| 2100 | if (res == 0) | |
| 2101 | SET_PSR_CC (1); | |
| 2102 | else | |
| 2103 | SET_PSR_CC (0); | |
| 2104 | ||
| 2105 | set_iregval (idest, res); | |
| 2106 | } | |
| 2107 | ||
| 2108 | ||
| 2109 | /* Execute "xor #const,isrc2,idest". */ | |
| 2110 | static void insn_xor_imm (i860s *cpustate, UINT32 insn) | |
| 2111 | { | |
| 2112 | UINT32 src1val = 0; | |
| 2113 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2114 | UINT32 idest = get_idest (insn); | |
| 2115 | UINT32 res = 0; | |
| 2116 | ||
| 2117 | /* Do the operation. */ | |
| 2118 | src1val = get_imm16 (insn); | |
| 2119 | res = src1val ^ get_iregval (isrc2); | |
| 2120 | ||
| 2121 | /* Set flags. */ | |
| 2122 | if (res == 0) | |
| 2123 | SET_PSR_CC (1); | |
| 2124 | else | |
| 2125 | SET_PSR_CC (0); | |
| 2126 | ||
| 2127 | set_iregval (idest, res); | |
| 2128 | } | |
| 2129 | ||
| 2130 | ||
| 2131 | /* Execute "xorh #const,isrc2,idest". */ | |
| 2132 | static void insn_xorh_imm (i860s *cpustate, UINT32 insn) | |
| 2133 | { | |
| 2134 | UINT32 src1val = 0; | |
| 2135 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2136 | UINT32 idest = get_idest (insn); | |
| 2137 | UINT32 res = 0; | |
| 2138 | ||
| 2139 | /* Do the operation. */ | |
| 2140 | src1val = get_imm16 (insn); | |
| 2141 | res = (src1val << 16) ^ get_iregval (isrc2); | |
| 2142 | ||
| 2143 | /* Set flags. */ | |
| 2144 | if (res == 0) | |
| 2145 | SET_PSR_CC (1); | |
| 2146 | else | |
| 2147 | SET_PSR_CC (0); | |
| 2148 | ||
| 2149 | set_iregval (idest, res); | |
| 2150 | } | |
| 2151 | ||
| 2152 | ||
| 2153 | /* Execute "trap isrc1ni,isrc2,idest" instruction. */ | |
| 2154 | static void insn_trap (i860s *cpustate, UINT32 insn) | |
| 2155 | { | |
| 2156 | SET_PSR_IT (1); | |
| 2157 | cpustate->pending_trap = 1; | |
| 2158 | } | |
| 2159 | ||
| 2160 | ||
| 2161 | /* Execute "intovr" instruction. */ | |
| 2162 | static void insn_intovr (i860s *cpustate, UINT32 insn) | |
| 2163 | { | |
| 2164 | if (GET_EPSR_OF ()) | |
| 2165 | { | |
| 2166 | SET_PSR_IT (1); | |
| 2167 | cpustate->pending_trap = 1; | |
| 2168 | } | |
| 2169 | } | |
| 2170 | ||
| 2171 | ||
| 2172 | /* Execute "bte isrc1,isrc2,sbroff". */ | |
| 2173 | static void insn_bte (i860s *cpustate, UINT32 insn) | |
| 2174 | { | |
| 2175 | UINT32 src1val = 0; | |
| 2176 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2177 | UINT32 target_addr = 0; | |
| 2178 | INT32 sbroff = 0; | |
| 2179 | int res = 0; | |
| 2180 | ||
| 2181 | src1val = get_iregval (get_isrc1 (insn)); | |
| 2182 | ||
| 2183 | /* Compute the target address from the sbroff field. */ | |
| 2184 | sbroff = sign_ext ((((insn >> 5) & 0xf800) | (insn & 0x07ff)), 16); | |
| 2185 | target_addr = (INT32)cpustate->pc + 4 + (sbroff << 2); | |
| 2186 | ||
| 2187 | /* Determine comparison result. */ | |
| 2188 | res = (src1val == get_iregval (isrc2)); | |
| 2189 | ||
| 2190 | /* Branch routines always update the PC. */ | |
| 2191 | if (res) | |
| 2192 | cpustate->pc = target_addr; | |
| 2193 | else | |
| 2194 | cpustate->pc += 4; | |
| 2195 | ||
| 2196 | cpustate->pc_updated = 1; | |
| 2197 | } | |
| 2198 | ||
| 2199 | ||
| 2200 | /* Execute "bte #const5,isrc2,sbroff". */ | |
| 2201 | static void insn_bte_imm (i860s *cpustate, UINT32 insn) | |
| 2202 | { | |
| 2203 | UINT32 src1val = 0; | |
| 2204 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2205 | UINT32 target_addr = 0; | |
| 2206 | INT32 sbroff = 0; | |
| 2207 | int res = 0; | |
| 2208 | ||
| 2209 | src1val = (insn >> 11) & 0x1f; /* 5-bit field, zero-extended. */ | |
| 2210 | ||
| 2211 | /* Compute the target address from the sbroff field. */ | |
| 2212 | sbroff = sign_ext ((((insn >> 5) & 0xf800) | (insn & 0x07ff)), 16); | |
| 2213 | target_addr = (INT32)cpustate->pc + 4 + (sbroff << 2); | |
| 2214 | ||
| 2215 | /* Determine comparison result. */ | |
| 2216 | res = (src1val == get_iregval (isrc2)); | |
| 2217 | ||
| 2218 | /* Branch routines always update the PC. */ | |
| 2219 | if (res) | |
| 2220 | cpustate->pc = target_addr; | |
| 2221 | else | |
| 2222 | cpustate->pc += 4; | |
| 2223 | ||
| 2224 | cpustate->pc_updated = 1; | |
| 2225 | } | |
| 2226 | ||
| 2227 | ||
| 2228 | /* Execute "btne isrc1,isrc2,sbroff". */ | |
| 2229 | static void insn_btne (i860s *cpustate, UINT32 insn) | |
| 2230 | { | |
| 2231 | UINT32 src1val = 0; | |
| 2232 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2233 | UINT32 target_addr = 0; | |
| 2234 | INT32 sbroff = 0; | |
| 2235 | int res = 0; | |
| 2236 | ||
| 2237 | src1val = get_iregval (get_isrc1 (insn)); | |
| 2238 | ||
| 2239 | /* Compute the target address from the sbroff field. */ | |
| 2240 | sbroff = sign_ext ((((insn >> 5) & 0xf800) | (insn & 0x07ff)), 16); | |
| 2241 | target_addr = (INT32)cpustate->pc + 4 + (sbroff << 2); | |
| 2242 | ||
| 2243 | /* Determine comparison result. */ | |
| 2244 | res = (src1val != get_iregval (isrc2)); | |
| 2245 | ||
| 2246 | /* Branch routines always update the PC. */ | |
| 2247 | if (res) | |
| 2248 | cpustate->pc = target_addr; | |
| 2249 | else | |
| 2250 | cpustate->pc += 4; | |
| 2251 | ||
| 2252 | cpustate->pc_updated = 1; | |
| 2253 | } | |
| 2254 | ||
| 2255 | ||
| 2256 | /* Execute "btne #const5,isrc2,sbroff". */ | |
| 2257 | static void insn_btne_imm (i860s *cpustate, UINT32 insn) | |
| 2258 | { | |
| 2259 | UINT32 src1val = 0; | |
| 2260 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2261 | UINT32 target_addr = 0; | |
| 2262 | INT32 sbroff = 0; | |
| 2263 | int res = 0; | |
| 2264 | ||
| 2265 | src1val = (insn >> 11) & 0x1f; /* 5-bit field, zero-extended. */ | |
| 2266 | ||
| 2267 | /* Compute the target address from the sbroff field. */ | |
| 2268 | sbroff = sign_ext ((((insn >> 5) & 0xf800) | (insn & 0x07ff)), 16); | |
| 2269 | target_addr = (INT32)cpustate->pc + 4 + (sbroff << 2); | |
| 2270 | ||
| 2271 | /* Determine comparison result. */ | |
| 2272 | res = (src1val != get_iregval (isrc2)); | |
| 2273 | ||
| 2274 | /* Branch routines always update the PC. */ | |
| 2275 | if (res) | |
| 2276 | cpustate->pc = target_addr; | |
| 2277 | else | |
| 2278 | cpustate->pc += 4; | |
| 2279 | ||
| 2280 | cpustate->pc_updated = 1; | |
| 2281 | } | |
| 2282 | ||
| 2283 | ||
| 2284 | /* Execute "bc lbroff" instruction. */ | |
| 2285 | static void insn_bc (i860s *cpustate, UINT32 insn) | |
| 2286 | { | |
| 2287 | UINT32 target_addr = 0; | |
| 2288 | INT32 lbroff = 0; | |
| 2289 | int res = 0; | |
| 2290 | ||
| 2291 | /* Compute the target address from the lbroff field. */ | |
| 2292 | lbroff = sign_ext ((insn & 0x03ffffff), 26); | |
| 2293 | target_addr = (INT32)cpustate->pc + 4 + (lbroff << 2); | |
| 2294 | ||
| 2295 | /* Determine comparison result. */ | |
| 2296 | res = (GET_PSR_CC () == 1); | |
| 2297 | ||
| 2298 | /* Branch routines always update the PC. */ | |
| 2299 | if (res) | |
| 2300 | cpustate->pc = target_addr; | |
| 2301 | else | |
| 2302 | cpustate->pc += 4; | |
| 2303 | ||
| 2304 | cpustate->pc_updated = 1; | |
| 2305 | } | |
| 2306 | ||
| 2307 | ||
| 2308 | /* Execute "bnc lbroff" instruction. */ | |
| 2309 | static void insn_bnc (i860s *cpustate, UINT32 insn) | |
| 2310 | { | |
| 2311 | UINT32 target_addr = 0; | |
| 2312 | INT32 lbroff = 0; | |
| 2313 | int res = 0; | |
| 2314 | ||
| 2315 | /* Compute the target address from the lbroff field. */ | |
| 2316 | lbroff = sign_ext ((insn & 0x03ffffff), 26); | |
| 2317 | target_addr = (INT32)cpustate->pc + 4 + (lbroff << 2); | |
| 2318 | ||
| 2319 | /* Determine comparison result. */ | |
| 2320 | res = (GET_PSR_CC () == 0); | |
| 2321 | ||
| 2322 | /* Branch routines always update the PC, since pc_updated is set | |
| 2323 | in the decode routine. */ | |
| 2324 | if (res) | |
| 2325 | cpustate->pc = target_addr; | |
| 2326 | else | |
| 2327 | cpustate->pc += 4; | |
| 2328 | ||
| 2329 | cpustate->pc_updated = 1; | |
| 2330 | } | |
| 2331 | ||
| 2332 | ||
| 2333 | /* Execute "bc.t lbroff" instruction. */ | |
| 2334 | static void insn_bct (i860s *cpustate, UINT32 insn) | |
| 2335 | { | |
| 2336 | UINT32 target_addr = 0; | |
| 2337 | INT32 lbroff = 0; | |
| 2338 | int res = 0; | |
| 2339 | UINT32 orig_pc = cpustate->pc; | |
| 2340 | ||
| 2341 | /* Compute the target address from the lbroff field. */ | |
| 2342 | lbroff = sign_ext ((insn & 0x03ffffff), 26); | |
| 2343 | target_addr = (INT32)cpustate->pc + 4 + (lbroff << 2); | |
| 2344 | ||
| 2345 | /* Determine comparison result. */ | |
| 2346 | res = (GET_PSR_CC () == 1); | |
| 2347 | ||
| 2348 | /* Careful. Unlike bla, the delay slot instruction is only executed | |
| 2349 | if the branch is taken. */ | |
| 2350 | if (res) | |
| 2351 | { | |
| 2352 | /* Execute delay slot instruction. */ | |
| 2353 | cpustate->pc += 4; | |
| 2354 | decode_exec (cpustate, ifetch (cpustate, orig_pc + 4), 0); | |
| 2355 | cpustate->pc = orig_pc; | |
| 2356 | if (cpustate->pending_trap) | |
| 2357 | { | |
| 2358 | cpustate->pending_trap |= TRAP_IN_DELAY_SLOT; | |
| 2359 | goto ab_op; | |
| 2360 | } | |
| 2361 | } | |
| 2362 | ||
| 2363 | /* Since this branch is delayed, we must jump 2 instructions if | |
| 2364 | if isn't taken. */ | |
| 2365 | if (res) | |
| 2366 | cpustate->pc = target_addr; | |
| 2367 | else | |
| 2368 | cpustate->pc += 8; | |
| 2369 | ||
| 2370 | cpustate->pc_updated = 1; | |
| 2371 | ||
| 2372 | ab_op: | |
| 2373 | ; | |
| 2374 | } | |
| 2375 | ||
| 2376 | ||
| 2377 | /* Execute "bnc.t lbroff" instruction. */ | |
| 2378 | static void insn_bnct (i860s *cpustate, UINT32 insn) | |
| 2379 | { | |
| 2380 | UINT32 target_addr = 0; | |
| 2381 | INT32 lbroff = 0; | |
| 2382 | int res = 0; | |
| 2383 | UINT32 orig_pc = cpustate->pc; | |
| 2384 | ||
| 2385 | /* Compute the target address from the lbroff field. */ | |
| 2386 | lbroff = sign_ext ((insn & 0x03ffffff), 26); | |
| 2387 | target_addr = (INT32)cpustate->pc + 4 + (lbroff << 2); | |
| 2388 | ||
| 2389 | /* Determine comparison result. */ | |
| 2390 | res = (GET_PSR_CC () == 0); | |
| 2391 | ||
| 2392 | /* Careful. Unlike bla, the delay slot instruction is only executed | |
| 2393 | if the branch is taken. */ | |
| 2394 | if (res) | |
| 2395 | { | |
| 2396 | /* Execute delay slot instruction. */ | |
| 2397 | cpustate->pc += 4; | |
| 2398 | decode_exec (cpustate, ifetch (cpustate, orig_pc + 4), 0); | |
| 2399 | cpustate->pc = orig_pc; | |
| 2400 | if (cpustate->pending_trap) | |
| 2401 | { | |
| 2402 | cpustate->pending_trap |= TRAP_IN_DELAY_SLOT; | |
| 2403 | goto ab_op; | |
| 2404 | } | |
| 2405 | } | |
| 2406 | ||
| 2407 | /* Since this branch is delayed, we must jump 2 instructions if | |
| 2408 | if isn't taken. */ | |
| 2409 | if (res) | |
| 2410 | cpustate->pc = target_addr; | |
| 2411 | else | |
| 2412 | cpustate->pc += 8; | |
| 2413 | ||
| 2414 | cpustate->pc_updated = 1; | |
| 2415 | ||
| 2416 | ab_op: | |
| 2417 | ; | |
| 2418 | } | |
| 2419 | ||
| 2420 | ||
| 2421 | /* Execute "call lbroff" instruction. */ | |
| 2422 | static void insn_call (i860s *cpustate, UINT32 insn) | |
| 2423 | { | |
| 2424 | UINT32 target_addr = 0; | |
| 2425 | INT32 lbroff = 0; | |
| 2426 | UINT32 orig_pc = cpustate->pc; | |
| 2427 | ||
| 2428 | /* Compute the target address from the lbroff field. */ | |
| 2429 | lbroff = sign_ext ((insn & 0x03ffffff), 26); | |
| 2430 | target_addr = (INT32)cpustate->pc + 4 + (lbroff << 2); | |
| 2431 | ||
| 2432 | /* Execute the delay slot instruction. */ | |
| 2433 | cpustate->pc += 4; | |
| 2434 | decode_exec (cpustate, ifetch (cpustate, orig_pc + 4), 0); | |
| 2435 | cpustate->pc = orig_pc; | |
| 2436 | if (cpustate->pending_trap) | |
| 2437 | { | |
| 2438 | cpustate->pending_trap |= TRAP_IN_DELAY_SLOT; | |
| 2439 | goto ab_op; | |
| 2440 | } | |
| 2441 | ||
| 2442 | /* Sets the return pointer (r1). */ | |
| 2443 | set_iregval (1, orig_pc + 8); | |
| 2444 | ||
| 2445 | /* New target. */ | |
| 2446 | cpustate->pc = target_addr; | |
| 2447 | cpustate->pc_updated = 1; | |
| 2448 | ||
| 2449 | ab_op:; | |
| 2450 | } | |
| 2451 | ||
| 2452 | ||
| 2453 | /* Execute "br lbroff". */ | |
| 2454 | static void insn_br (i860s *cpustate, UINT32 insn) | |
| 2455 | { | |
| 2456 | UINT32 target_addr = 0; | |
| 2457 | INT32 lbroff = 0; | |
| 2458 | UINT32 orig_pc = cpustate->pc; | |
| 2459 | ||
| 2460 | /* Compute the target address from the lbroff field. */ | |
| 2461 | lbroff = sign_ext ((insn & 0x03ffffff), 26); | |
| 2462 | target_addr = (INT32)cpustate->pc + 4 + (lbroff << 2); | |
| 2463 | ||
| 2464 | /* Execute the delay slot instruction. */ | |
| 2465 | cpustate->pc += 4; | |
| 2466 | decode_exec (cpustate, ifetch (cpustate, orig_pc + 4), 0); | |
| 2467 | cpustate->pc = orig_pc; | |
| 2468 | if (cpustate->pending_trap) | |
| 2469 | { | |
| 2470 | cpustate->pending_trap |= TRAP_IN_DELAY_SLOT; | |
| 2471 | goto ab_op; | |
| 2472 | } | |
| 2473 | ||
| 2474 | /* New target. */ | |
| 2475 | cpustate->pc = target_addr; | |
| 2476 | cpustate->pc_updated = 1; | |
| 2477 | ||
| 2478 | ab_op:; | |
| 2479 | } | |
| 2480 | ||
| 2481 | ||
| 2482 | /* Execute "bri isrc1ni" instruction. | |
| 2483 | Note: I didn't merge this code with calli because bri must do | |
| 2484 | a lot of flag manipulation if any trap bits are set. */ | |
| 2485 | static void insn_bri (i860s *cpustate, UINT32 insn) | |
| 2486 | { | |
| 2487 | UINT32 isrc1 = get_isrc1 (insn); | |
| 2488 | UINT32 orig_pc = cpustate->pc; | |
| 2489 | UINT32 orig_psr = cpustate->cregs[CR_PSR]; | |
| 2490 | UINT32 orig_src1_val = get_iregval (isrc1); | |
| 2491 | ||
| 2492 | #if 1 /* TURBO. */ | |
| 2493 | cpustate->cregs[CR_PSR] &= ~PSR_ALL_TRAP_BITS_MASK; | |
| 2494 | #endif | |
| 2495 | ||
| 2496 | /* Execute the delay slot instruction. */ | |
| 2497 | cpustate->pc += 4; | |
| 2498 | decode_exec (cpustate, ifetch (cpustate, orig_pc + 4), 0); | |
| 2499 | cpustate->pc = orig_pc; | |
| 2500 | ||
| 2501 | /* Delay slot insn caused a trap, abort operation. */ | |
| 2502 | if (cpustate->pending_trap) | |
| 2503 | { | |
| 2504 | cpustate->pending_trap |= TRAP_IN_DELAY_SLOT; | |
| 2505 | goto ab_op; | |
| 2506 | } | |
| 2507 | ||
| 2508 | /* If any trap bits are set, we need to do the return from | |
| 2509 | trap work. Note, we must use the PSR value that existed | |
| 2510 | before the delay slot instruction was executed since the | |
| 2511 | delay slot instruction might itself cause a trap bit to | |
| 2512 | be set. */ | |
| 2513 | if (orig_psr & PSR_ALL_TRAP_BITS_MASK) | |
| 2514 | { | |
| 2515 | /* Restore U and IM from their previous copies. */ | |
| 2516 | SET_PSR_U (GET_PSR_PU ()); | |
| 2517 | SET_PSR_IM (GET_PSR_PIM ()); | |
| 2518 | ||
| 2519 | cpustate->fir_gets_trap_addr = 0; | |
| 2520 | } | |
| 2521 | ||
| 2522 | /* Update PC. */ | |
| 2523 | cpustate->pc = orig_src1_val; | |
| 2524 | ||
| 2525 | cpustate->pc_updated = 1; | |
| 2526 | ab_op:; | |
| 2527 | } | |
| 2528 | ||
| 2529 | /* Execute "calli isrc1ni" instruction. */ | |
| 2530 | static void insn_calli (i860s *cpustate, UINT32 insn) | |
| 2531 | { | |
| 2532 | UINT32 isrc1 = get_isrc1 (insn); | |
| 2533 | UINT32 orig_pc = cpustate->pc; | |
| 2534 | UINT32 orig_src1_val = get_iregval (isrc1); | |
| 2535 | ||
| 2536 | #ifdef TRACE_UNDEFINED_I860 | |
| 2537 | /* Check for undefined behavior. */ | |
| 2538 | if (isrc1 == 1) | |
| 2539 | { | |
| 2540 | /* Src1 must not be r1. */ | |
| 2541 | fprintf (stderr, "WARNING: insn_calli (pc=0x%08x): isrc1 = r1 on a calli\n", cpustate->pc); | |
| 2542 | } | |
| 2543 | #endif | |
| 2544 | ||
| 2545 | /* Set return pointer before executing delay slot instruction. */ | |
| 2546 | set_iregval (1, cpustate->pc + 8); | |
| 2547 | ||
| 2548 | /* Execute the delay slot instruction. */ | |
| 2549 | cpustate->pc += 4; | |
| 2550 | decode_exec (cpustate, ifetch (cpustate, orig_pc + 4), 0); | |
| 2551 | cpustate->pc = orig_pc; | |
| 2552 | if (cpustate->pending_trap) | |
| 2553 | { | |
| 2554 | set_iregval (1, orig_src1_val); | |
| 2555 | cpustate->pending_trap |= TRAP_IN_DELAY_SLOT; | |
| 2556 | goto ab_op; | |
| 2557 | } | |
| 2558 | ||
| 2559 | /* Set new PC. */ | |
| 2560 | cpustate->pc = orig_src1_val; | |
| 2561 | cpustate->pc_updated = 1; | |
| 2562 | ||
| 2563 | ab_op:; | |
| 2564 | } | |
| 2565 | ||
| 2566 | ||
| 2567 | /* Execute "bla isrc1ni,isrc2,sbroff" instruction. */ | |
| 2568 | static void insn_bla (i860s *cpustate, UINT32 insn) | |
| 2569 | { | |
| 2570 | UINT32 isrc1 = get_isrc1 (insn); | |
| 2571 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2572 | UINT32 target_addr = 0; | |
| 2573 | INT32 sbroff = 0; | |
| 2574 | int lcc_tmp = 0; | |
| 2575 | UINT32 orig_pc = cpustate->pc; | |
| 2576 | UINT32 orig_isrc2val = get_iregval (isrc2); | |
| 2577 | ||
| 2578 | #ifdef TRACE_UNDEFINED_I860 | |
| 2579 | /* Check for undefined behavior. */ | |
| 2580 | if (isrc1 == isrc2) | |
| 2581 | { | |
| 2582 | /* Src1 and src2 the same is undefined i860XR behavior. */ | |
| 2583 | fprintf (stderr, "WARNING: insn_bla (pc=0x%08x): isrc1 and isrc2 are the same (ignored)\n", cpustate->pc); | |
| 2584 | return; | |
| 2585 | } | |
| 2586 | #endif | |
| 2587 | ||
| 2588 | /* Compute the target address from the sbroff field. */ | |
| 2589 | sbroff = sign_ext ((((insn >> 5) & 0xf800) | (insn & 0x07ff)), 16); | |
| 2590 | target_addr = (INT32)cpustate->pc + 4 + (sbroff << 2); | |
| 2591 | ||
| 2592 | /* Determine comparison result based on opcode. */ | |
| 2593 | lcc_tmp = ((INT32)get_iregval (isrc2) >= -(INT32)get_iregval (isrc1)); | |
| 2594 | ||
| 2595 | set_iregval (isrc2, get_iregval (isrc1) + orig_isrc2val); | |
| 2596 | ||
| 2597 | /* Execute the delay slot instruction. */ | |
| 2598 | cpustate->pc += 4; | |
| 2599 | decode_exec (cpustate, ifetch (cpustate, orig_pc + 4), 0); | |
| 2600 | cpustate->pc = orig_pc; | |
| 2601 | if (cpustate->pending_trap) | |
| 2602 | { | |
| 2603 | cpustate->pending_trap |= TRAP_IN_DELAY_SLOT; | |
| 2604 | goto ab_op; | |
| 2605 | } | |
| 2606 | ||
| 2607 | if (GET_PSR_LCC ()) | |
| 2608 | cpustate->pc = target_addr; | |
| 2609 | else | |
| 2610 | { | |
| 2611 | /* Since this branch is delayed, we must jump 2 instructions if | |
| 2612 | if isn't taken. */ | |
| 2613 | cpustate->pc += 8; | |
| 2614 | } | |
| 2615 | SET_PSR_LCC (lcc_tmp); | |
| 2616 | ||
| 2617 | cpustate->pc_updated = 1; | |
| 2618 | ab_op:; | |
| 2619 | } | |
| 2620 | ||
| 2621 | ||
| 2622 | /* Execute "flush #const(isrc2)" or "flush #const(isrc2)++" instruction. */ | |
| 2623 | static void insn_flush (i860s *cpustate, UINT32 insn) | |
| 2624 | { | |
| 2625 | UINT32 src1val = sign_ext (get_imm16 (insn), 16); | |
| 2626 | UINT32 isrc2 = get_isrc2 (insn); | |
| 2627 | int auto_inc = (insn & 1); | |
| 2628 | UINT32 eff = 0; | |
| 2629 | ||
| 2630 | /* Technically, idest should be encoded as r0 because idest | |
| 2631 | is undefined after the instruction. We don't currently | |
| 2632 | check for this. | |
| 2633 | ||
| 2634 | Flush D$ block at address #const+isrc2. Block is undefined | |
| 2635 | after. The effective address must be 16-byte aligned. | |
| 2636 | ||
| 2637 | FIXME: Need to examine RB and RC and do this right. | |
| 2638 | */ | |
| 2639 | ||
| 2640 | /* Chop off lower bits of displacement to 16-byte alignment. */ | |
| 2641 | src1val &= ~(16-1); | |
| 2642 | eff = src1val + get_iregval (isrc2); | |
| 2643 | if (auto_inc) | |
| 2644 | set_iregval (isrc2, eff); | |
| 2645 | ||
| 2646 | /* In user mode, the flush is ignored. */ | |
| 2647 | if (GET_PSR_U () == 0) | |
| 2648 | { | |
| 2649 | /* If line is dirty, write it to memory and invalidate. | |
| 2650 | NOTE: The actual dirty write is unimplemented in the MAME version | |
| 2651 | as we don't emulate the dcache. */ | |
| 2652 | } | |
| 2653 | } | |
| 2654 | ||
| 2655 | ||
| 2656 | /* Execute "[p]fmul.{ss,sd,dd} fsrc1,fsrc2,fdest" instruction or | |
| 2657 | pfmul3.dd fsrc1,fsrc2,fdest. | |
| 2658 | ||
| 2659 | The pfmul3.dd differs from pfmul.dd in that it treats the pipeline | |
| 2660 | as 3 stages, even though it is a double precision multiply. */ | |
| 2661 | static void insn_fmul (i860s *cpustate, UINT32 insn) | |
| 2662 | { | |
| 2663 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 2664 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 2665 | UINT32 fdest = get_fdest (insn); | |
| 2666 | int src_prec = insn & 0x100; /* 1 = double, 0 = single. */ | |
| 2667 | int res_prec = insn & 0x080; /* 1 = double, 0 = single. */ | |
| 2668 | int piped = insn & 0x400; /* 1 = pipelined, 0 = scalar. */ | |
| 2669 | double dbl_tmp_dest = 0.0; | |
| 2670 | float sgl_tmp_dest = 0.0; | |
| 2671 | double dbl_last_stage_contents = 0.0; | |
| 2672 | float sgl_last_stage_contents = 0.0; | |
| 2673 | int is_pfmul3 = insn & 0x4; | |
| 2674 | int num_stages = (src_prec && !is_pfmul3) ? 2 : 3; | |
| 2675 | ||
| 2676 | /* Only .dd is valid for pfmul. */ | |
| 2677 | if (is_pfmul3 && (insn & 0x180) != 0x180) | |
| 2678 | { | |
| 2679 | unrecog_opcode (cpustate->pc, insn); | |
| 2680 | return; | |
| 2681 | } | |
| 2682 | ||
| 2683 | /* Check for invalid .ds combination. */ | |
| 2684 | if ((insn & 0x180) == 0x100) | |
| 2685 | { | |
| 2686 | unrecog_opcode (cpustate->pc, insn); | |
| 2687 | return; | |
| 2688 | } | |
| 2689 | ||
| 2690 | /* For pipelined version, retrieve the contents of the last stage | |
| 2691 | of the pipeline, whose precision is specified by the MRP bit | |
| 2692 | of the stage's result-status bits. Note for pfmul, the number | |
| 2693 | of stages is determined by the source precision of the current | |
| 2694 | operation. */ | |
| 2695 | if (piped) | |
| 2696 | { | |
| 2697 | if (cpustate->M[num_stages - 1].stat.mrp) | |
| 2698 | dbl_last_stage_contents = cpustate->M[num_stages - 1].val.d; | |
| 2699 | else | |
| 2700 | sgl_last_stage_contents = cpustate->M[num_stages - 1].val.s; | |
| 2701 | } | |
| 2702 | ||
| 2703 | /* Do the operation, being careful about source and result | |
| 2704 | precision. */ | |
| 2705 | if (src_prec) | |
| 2706 | { | |
| 2707 | double v1 = get_fregval_d (cpustate, fsrc1); | |
| 2708 | double v2 = get_fregval_d (cpustate, fsrc2); | |
| 2709 | ||
| 2710 | /* For pipelined mul, if fsrc2 is the same as fdest, then the last | |
| 2711 | stage is bypassed to fsrc2 (rather than using the value in fsrc2). | |
| 2712 | This bypass is not available for fsrc1, and is undefined behavior. */ | |
| 2713 | if (0 && piped && fdest != 0 && fsrc1 == fdest) | |
| 2714 | v1 = dbl_last_stage_contents; | |
| 2715 | if (piped && fdest != 0 && fsrc2 == fdest) | |
| 2716 | v2 = dbl_last_stage_contents; | |
| 2717 | ||
| 2718 | if (res_prec) | |
| 2719 | dbl_tmp_dest = v1 * v2; | |
| 2720 | else | |
| 2721 | sgl_tmp_dest = (float)(v1 * v2); | |
| 2722 | } | |
| 2723 | else | |
| 2724 | { | |
| 2725 | float v1 = get_fregval_s (cpustate, fsrc1); | |
| 2726 | float v2 = get_fregval_s (cpustate, fsrc2); | |
| 2727 | ||
| 2728 | /* For pipelined mul, if fsrc2 is the same as fdest, then the last | |
| 2729 | stage is bypassed to fsrc2 (rather than using the value in fsrc2). | |
| 2730 | This bypass is not available for fsrc1, and is undefined behavior. */ | |
| 2731 | if (0 && piped && fdest != 0 && fsrc1 == fdest) | |
| 2732 | v1 = sgl_last_stage_contents; | |
| 2733 | if (piped && fdest != 0 && fsrc2 == fdest) | |
| 2734 | v2 = sgl_last_stage_contents; | |
| 2735 | ||
| 2736 | if (res_prec) | |
| 2737 | dbl_tmp_dest = (double)(v1 * v2); | |
| 2738 | else | |
| 2739 | sgl_tmp_dest = v1 * v2; | |
| 2740 | } | |
| 2741 | ||
| 2742 | /* FIXME: Set result-status bits besides MRP. And copy to fsr from | |
| 2743 | last stage. */ | |
| 2744 | /* FIXME: Scalar version flows through all stages. */ | |
| 2745 | /* FIXME: Mixed precision (only wierd for pfmul). */ | |
| 2746 | if (!piped) | |
| 2747 | { | |
| 2748 | /* Scalar version writes the current calculation to the fdest | |
| 2749 | register, with precision specified by the R bit. */ | |
| 2750 | if (res_prec) | |
| 2751 | set_fregval_d (cpustate, fdest, dbl_tmp_dest); | |
| 2752 | else | |
| 2753 | set_fregval_s (cpustate, fdest, sgl_tmp_dest); | |
| 2754 | } | |
| 2755 | else | |
| 2756 | { | |
| 2757 | /* Pipelined version writes fdest with the result from the last | |
| 2758 | stage of the pipeline. */ | |
| 2759 | #if 1 /* FIXME: WIP on FSR update. This may not be correct. */ | |
| 2760 | /* Copy 3rd stage MRP to FSR. */ | |
| 2761 | if (cpustate->M[num_stages - 2 /* 1 */].stat.mrp) | |
| 2762 | cpustate->cregs[CR_FSR] |= 0x10000000; | |
| 2763 | else | |
| 2764 | cpustate->cregs[CR_FSR] &= ~0x10000000; | |
| 2765 | #endif | |
| 2766 | ||
| 2767 | if (cpustate->M[num_stages - 1].stat.mrp) | |
| 2768 | set_fregval_d (cpustate, fdest, dbl_last_stage_contents); | |
| 2769 | else | |
| 2770 | set_fregval_s (cpustate, fdest, sgl_last_stage_contents); | |
| 2771 | ||
| 2772 | /* Now advance pipeline and write current calculation to | |
| 2773 | first stage. */ | |
| 2774 | if (num_stages == 3) | |
| 2775 | { | |
| 2776 | cpustate->M[2] = cpustate->M[1]; | |
| 2777 | cpustate->M[1] = cpustate->M[0]; | |
| 2778 | } | |
| 2779 | else | |
| 2780 | cpustate->M[1] = cpustate->M[0]; | |
| 2781 | ||
| 2782 | if (res_prec) | |
| 2783 | { | |
| 2784 | cpustate->M[0].val.d = dbl_tmp_dest; | |
| 2785 | cpustate->M[0].stat.mrp = 1; | |
| 2786 | } | |
| 2787 | else | |
| 2788 | { | |
| 2789 | cpustate->M[0].val.s = sgl_tmp_dest; | |
| 2790 | cpustate->M[0].stat.mrp = 0; | |
| 2791 | } | |
| 2792 | } | |
| 2793 | } | |
| 2794 | ||
| 2795 | ||
| 2796 | /* Execute "fmlow.dd fsrc1,fsrc2,fdest" instruction. */ | |
| 2797 | static void insn_fmlow (i860s *cpustate, UINT32 insn) | |
| 2798 | { | |
| 2799 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 2800 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 2801 | UINT32 fdest = get_fdest (insn); | |
| 2802 | ||
| 2803 | double v1 = get_fregval_d (cpustate, fsrc1); | |
| 2804 | double v2 = get_fregval_d (cpustate, fsrc2); | |
| 2805 | INT64 i1 = *(UINT64 *)&v1; | |
| 2806 | INT64 i2 = *(UINT64 *)&v2; | |
| 2807 | INT64 tmp = 0; | |
| 2808 | ||
| 2809 | /* Only .dd is valid for fmlow. */ | |
| 2810 | if ((insn & 0x180) != 0x180) | |
| 2811 | { | |
| 2812 | unrecog_opcode (cpustate->pc, insn); | |
| 2813 | return; | |
| 2814 | } | |
| 2815 | ||
| 2816 | /* The lower 32-bits are obvious. What exactly goes in the upper | |
| 2817 | bits? | |
| 2818 | Technically, the upper-most 10 bits are undefined, but i'd like | |
| 2819 | to be undefined in the same way as the real i860 if possible. */ | |
| 2820 | ||
| 2821 | /* Keep lower 53 bits of multiply. */ | |
| 2822 | tmp = i1 * i2; | |
| 2823 | tmp &= 0x001fffffffffffffULL; | |
| 2824 | tmp |= (i1 & 0x8000000000000000LL) ^ (i2 & 0x8000000000000000LL); | |
| 2825 | set_fregval_d (cpustate, fdest, *(double *)&tmp); | |
| 2826 | } | |
| 2827 | ||
| 2828 | ||
| 2829 | /* Execute [p]fadd.{ss,sd,dd} fsrc1,fsrc2,fdest (.ds disallowed above). */ | |
| 2830 | static void insn_fadd_sub (i860s *cpustate, UINT32 insn) | |
| 2831 | { | |
| 2832 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 2833 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 2834 | UINT32 fdest = get_fdest (insn); | |
| 2835 | int src_prec = insn & 0x100; /* 1 = double, 0 = single. */ | |
| 2836 | int res_prec = insn & 0x080; /* 1 = double, 0 = single. */ | |
| 2837 | int piped = insn & 0x400; /* 1 = pipelined, 0 = scalar. */ | |
| 2838 | int is_sub = insn & 1; /* 1 = sub, 0 = add. */ | |
| 2839 | double dbl_tmp_dest = 0.0; | |
| 2840 | float sgl_tmp_dest = 0.0; | |
| 2841 | double dbl_last_stage_contents = 0.0; | |
| 2842 | float sgl_last_stage_contents = 0.0; | |
| 2843 | ||
| 2844 | /* Check for invalid .ds combination. */ | |
| 2845 | if ((insn & 0x180) == 0x100) | |
| 2846 | { | |
| 2847 | unrecog_opcode (cpustate->pc, insn); | |
| 2848 | return; | |
| 2849 | } | |
| 2850 | ||
| 2851 | /* For pipelined version, retrieve the contents of the last stage | |
| 2852 | of the pipeline, whose precision is specified by the ARP bit | |
| 2853 | of the stage's result-status bits. There are always three stages | |
| 2854 | for pfadd/pfsub. */ | |
| 2855 | if (piped) | |
| 2856 | { | |
| 2857 | if (cpustate->A[2].stat.arp) | |
| 2858 | dbl_last_stage_contents = cpustate->A[2].val.d; | |
| 2859 | else | |
| 2860 | sgl_last_stage_contents = cpustate->A[2].val.s; | |
| 2861 | } | |
| 2862 | ||
| 2863 | /* Do the operation, being careful about source and result | |
| 2864 | precision. */ | |
| 2865 | if (src_prec) | |
| 2866 | { | |
| 2867 | double v1 = get_fregval_d (cpustate, fsrc1); | |
| 2868 | double v2 = get_fregval_d (cpustate, fsrc2); | |
| 2869 | ||
| 2870 | /* For pipelined add/sub, if fsrc1 is the same as fdest, then the last | |
| 2871 | stage is bypassed to fsrc1 (rather than using the value in fsrc1). | |
| 2872 | Likewise for fsrc2. */ | |
| 2873 | if (piped && fdest != 0 && fsrc1 == fdest) | |
| 2874 | v1 = dbl_last_stage_contents; | |
| 2875 | if (piped && fdest != 0 && fsrc2 == fdest) | |
| 2876 | v2 = dbl_last_stage_contents; | |
| 2877 | ||
| 2878 | if (res_prec) | |
| 2879 | dbl_tmp_dest = is_sub ? v1 - v2 : v1 + v2; | |
| 2880 | else | |
| 2881 | sgl_tmp_dest = is_sub ? (float)(v1 - v2) : (float)(v1 + v2); | |
| 2882 | } | |
| 2883 | else | |
| 2884 | { | |
| 2885 | float v1 = get_fregval_s (cpustate, fsrc1); | |
| 2886 | float v2 = get_fregval_s (cpustate, fsrc2); | |
| 2887 | ||
| 2888 | /* For pipelined add/sub, if fsrc1 is the same as fdest, then the last | |
| 2889 | stage is bypassed to fsrc1 (rather than using the value in fsrc1). | |
| 2890 | Likewise for fsrc2. */ | |
| 2891 | if (piped && fdest != 0 && fsrc1 == fdest) | |
| 2892 | v1 = sgl_last_stage_contents; | |
| 2893 | if (piped && fdest != 0 && fsrc2 == fdest) | |
| 2894 | v2 = sgl_last_stage_contents; | |
| 2895 | ||
| 2896 | if (res_prec) | |
| 2897 | dbl_tmp_dest = is_sub ? (double)(v1 - v2) : (double)(v1 + v2); | |
| 2898 | else | |
| 2899 | sgl_tmp_dest = is_sub ? v1 - v2 : v1 + v2; | |
| 2900 | } | |
| 2901 | ||
| 2902 | /* FIXME: Set result-status bits besides ARP. And copy to fsr from | |
| 2903 | last stage. */ | |
| 2904 | /* FIXME: Scalar version flows through all stages. */ | |
| 2905 | if (!piped) | |
| 2906 | { | |
| 2907 | /* Scalar version writes the current calculation to the fdest | |
| 2908 | register, with precision specified by the R bit. */ | |
| 2909 | if (res_prec) | |
| 2910 | set_fregval_d (cpustate, fdest, dbl_tmp_dest); | |
| 2911 | else | |
| 2912 | set_fregval_s (cpustate, fdest, sgl_tmp_dest); | |
| 2913 | } | |
| 2914 | else | |
| 2915 | { | |
| 2916 | /* Pipelined version writes fdest with the result from the last | |
| 2917 | stage of the pipeline, with precision specified by the ARP | |
| 2918 | bit of the stage's result-status bits. */ | |
| 2919 | #if 1 /* FIXME: WIP on FSR update. This may not be correct. */ | |
| 2920 | /* Copy 3rd stage ARP to FSR. */ | |
| 2921 | if (cpustate->A[1 /* 2 */].stat.arp) | |
| 2922 | cpustate->cregs[CR_FSR] |= 0x20000000; | |
| 2923 | else | |
| 2924 | cpustate->cregs[CR_FSR] &= ~0x20000000; | |
| 2925 | #endif | |
| 2926 | if (cpustate->A[2].stat.arp) /* 3rd (last) stage. */ | |
| 2927 | set_fregval_d (cpustate, fdest, dbl_last_stage_contents); | |
| 2928 | else | |
| 2929 | set_fregval_s (cpustate, fdest, sgl_last_stage_contents); | |
| 2930 | ||
| 2931 | /* Now advance pipeline and write current calculation to | |
| 2932 | first stage. */ | |
| 2933 | cpustate->A[2] = cpustate->A[1]; | |
| 2934 | cpustate->A[1] = cpustate->A[0]; | |
| 2935 | if (res_prec) | |
| 2936 | { | |
| 2937 | cpustate->A[0].val.d = dbl_tmp_dest; | |
| 2938 | cpustate->A[0].stat.arp = 1; | |
| 2939 | } | |
| 2940 | else | |
| 2941 | { | |
| 2942 | cpustate->A[0].val.s = sgl_tmp_dest; | |
| 2943 | cpustate->A[0].stat.arp = 0; | |
| 2944 | } | |
| 2945 | } | |
| 2946 | } | |
| 2947 | ||
| 2948 | ||
| 2949 | /* Operand types for PFAM/PFMAM routine below. */ | |
| 2950 | enum { | |
| 2951 | OP_SRC1 = 0, | |
| 2952 | OP_SRC2 = 1, | |
| 2953 | OP_KI = 2, | |
| 2954 | OP_KR = 4, | |
| 2955 | OP_T = 8, | |
| 2956 | OP_MPIPE = 16, | |
| 2957 | OP_APIPE = 32, | |
| 2958 | FLAGM = 64 /* Indicates PFMAM uses M rather than A pipe result. */ | |
| 2959 | }; | |
| 2960 | ||
| 2961 | /* A table to map DPC value to source operands. | |
| 2962 | ||
| 2963 | The PFAM and PFMAM tables are nearly identical, and the only differences | |
| 2964 | are that every time PFAM uses the A pipe, PFMAM uses the M pipe instead. | |
| 2965 | So we only represent the PFAM table and use a special flag on any entry | |
| 2966 | where the PFMAM table would use the M pipe rather than the A pipe. | |
| 2967 | Also, entry 16 is not valid for PFMAM. */ | |
| 2968 | static struct | |
| 2969 | { | |
| 2970 | int M_unit_op1; | |
| 2971 | int M_unit_op2; | |
| 2972 | int A_unit_op1; | |
| 2973 | int A_unit_op2; | |
| 2974 | int T_loaded; | |
| 2975 | int K_loaded; | |
| 2976 | } src_opers[] = { | |
| 2977 | /* 0000 */ { OP_KR, OP_SRC2, OP_SRC1, OP_MPIPE, 0, 0}, | |
| 2978 | /* 0001 */ { OP_KR, OP_SRC2, OP_T, OP_MPIPE, 0, 1}, | |
| 2979 | /* 0010 */ { OP_KR, OP_SRC2, OP_SRC1, OP_APIPE|FLAGM, 1, 0}, | |
| 2980 | /* 0011 */ { OP_KR, OP_SRC2, OP_T, OP_APIPE|FLAGM, 1, 1}, | |
| 2981 | /* 0100 */ { OP_KI, OP_SRC2, OP_SRC1, OP_MPIPE, 0, 0}, | |
| 2982 | /* 0101 */ { OP_KI, OP_SRC2, OP_T, OP_MPIPE, 0, 1}, | |
| 2983 | /* 0110 */ { OP_KI, OP_SRC2, OP_SRC1, OP_APIPE|FLAGM, 1, 0}, | |
| 2984 | /* 0111 */ { OP_KI, OP_SRC2, OP_T, OP_APIPE|FLAGM, 1, 1}, | |
| 2985 | /* 1000 */ { OP_KR, OP_APIPE|FLAGM, OP_SRC1, OP_SRC2, 1, 0}, | |
| 2986 | /* 1001 */ { OP_SRC1, OP_SRC2, OP_APIPE|FLAGM, OP_MPIPE, 0, 0}, | |
| 2987 | /* 1010 */ { OP_KR, OP_APIPE|FLAGM, OP_SRC1, OP_SRC2, 0, 0}, | |
| 2988 | /* 1011 */ { OP_SRC1, OP_SRC2, OP_T, OP_APIPE|FLAGM, 1, 0}, | |
| 2989 | /* 1100 */ { OP_KI, OP_APIPE|FLAGM, OP_SRC1, OP_SRC2, 1, 0}, | |
| 2990 | /* 1101 */ { OP_SRC1, OP_SRC2, OP_T, OP_MPIPE, 0, 0}, | |
| 2991 | /* 1110 */ { OP_KI, OP_APIPE|FLAGM, OP_SRC1, OP_SRC2, 0, 0}, | |
| 2992 | /* 1111 */ { OP_SRC1, OP_SRC2, OP_T, OP_APIPE|FLAGM, 0, 0} | |
| 2993 | }; | |
| 2994 | ||
| 2995 | float get_fval_from_optype_s (i860s *cpustate, UINT32 insn, int optype) | |
| 2996 | { | |
| 2997 | float retval = 0.0; | |
| 2998 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 2999 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 3000 | ||
| 3001 | optype &= ~FLAGM; | |
| 3002 | switch (optype) | |
| 3003 | { | |
| 3004 | case OP_SRC1: | |
| 3005 | retval = get_fregval_s (cpustate, fsrc1); | |
| 3006 | break; | |
| 3007 | case OP_SRC2: | |
| 3008 | retval = get_fregval_s (cpustate, fsrc2); | |
| 3009 | break; | |
| 3010 | case OP_KI: | |
| 3011 | retval = cpustate->KI.s; | |
| 3012 | break; | |
| 3013 | case OP_KR: | |
| 3014 | retval = cpustate->KR.s; | |
| 3015 | break; | |
| 3016 | case OP_T: | |
| 3017 | retval = cpustate->T.s; | |
| 3018 | break; | |
| 3019 | case OP_MPIPE: | |
| 3020 | /* Last stage is 3rd stage for single precision input. */ | |
| 3021 | retval = cpustate->M[2].val.s; | |
| 3022 | break; | |
| 3023 | case OP_APIPE: | |
| 3024 | retval = cpustate->A[2].val.s; | |
| 3025 | break; | |
| 3026 | default: | |
| 3027 | assert (0); | |
| 3028 | } | |
| 3029 | ||
| 3030 | return retval; | |
| 3031 | } | |
| 3032 | ||
| 3033 | ||
| 3034 | double get_fval_from_optype_d (i860s *cpustate, UINT32 insn, int optype) | |
| 3035 | { | |
| 3036 | double retval = 0.0; | |
| 3037 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 3038 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 3039 | ||
| 3040 | optype &= ~FLAGM; | |
| 3041 | switch (optype) | |
| 3042 | { | |
| 3043 | case OP_SRC1: | |
| 3044 | retval = get_fregval_d (cpustate, fsrc1); | |
| 3045 | break; | |
| 3046 | case OP_SRC2: | |
| 3047 | retval = get_fregval_d (cpustate, fsrc2); | |
| 3048 | break; | |
| 3049 | case OP_KI: | |
| 3050 | retval = cpustate->KI.d; | |
| 3051 | break; | |
| 3052 | case OP_KR: | |
| 3053 | retval = cpustate->KR.d; | |
| 3054 | break; | |
| 3055 | case OP_T: | |
| 3056 | retval = cpustate->T.d; | |
| 3057 | break; | |
| 3058 | case OP_MPIPE: | |
| 3059 | /* Last stage is 2nd stage for double precision input. */ | |
| 3060 | retval = cpustate->M[1].val.d; | |
| 3061 | break; | |
| 3062 | case OP_APIPE: | |
| 3063 | retval = cpustate->A[2].val.d; | |
| 3064 | break; | |
| 3065 | default: | |
| 3066 | assert (0); | |
| 3067 | } | |
| 3068 | ||
| 3069 | return retval; | |
| 3070 | } | |
| 3071 | ||
| 3072 | ||
| 3073 | /* Execute pf[m]{a,s}m.{ss,sd,dd} fsrc1,fsrc2,fdest (FP dual ops). | |
| 3074 | ||
| 3075 | Since these are always pipelined, the P bit is used to distinguish | |
| 3076 | family pfam (P=1) from family pfmam (P=0), and the lower 4 bits | |
| 3077 | of the extended opcode is the DPC. | |
| 3078 | ||
| 3079 | Note also that the S and R bits are slightly different than normal | |
| 3080 | floating point operations. The S bit denotes the precision of the | |
| 3081 | multiplication source, while the R bit denotes the precision of | |
| 3082 | the addition source as well as precision of all results. */ | |
| 3083 | static void insn_dualop (i860s *cpustate, UINT32 insn) | |
| 3084 | { | |
| 3085 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 3086 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 3087 | UINT32 fdest = get_fdest (insn); | |
| 3088 | int src_prec = insn & 0x100; /* 1 = double, 0 = single. */ | |
| 3089 | int res_prec = insn & 0x080; /* 1 = double, 0 = single. */ | |
| 3090 | int is_pfam = insn & 0x400; /* 1 = pfam, 0 = pfmam. */ | |
| 3091 | int is_sub = insn & 0x10; /* 1 = pf[m]sm, 0 = pf[m]am. */ | |
| 3092 | double dbl_tmp_dest_mul = 0.0; | |
| 3093 | float sgl_tmp_dest_mul = 0.0; | |
| 3094 | double dbl_tmp_dest_add = 0.0; | |
| 3095 | float sgl_tmp_dest_add = 0.0; | |
| 3096 | double dbl_last_Mstage_contents = 0.0; | |
| 3097 | float sgl_last_Mstage_contents = 0.0; | |
| 3098 | double dbl_last_Astage_contents = 0.0; | |
| 3099 | float sgl_last_Astage_contents = 0.0; | |
| 3100 | int num_mul_stages = src_prec ? 2 : 3; | |
| 3101 | ||
| 3102 | int dpc = insn & 0xf; | |
| 3103 | int M_unit_op1 = src_opers[dpc].M_unit_op1; | |
| 3104 | int M_unit_op2 = src_opers[dpc].M_unit_op2; | |
| 3105 | int A_unit_op1 = src_opers[dpc].A_unit_op1; | |
| 3106 | int A_unit_op2 = src_opers[dpc].A_unit_op2; | |
| 3107 | int T_loaded = src_opers[dpc].T_loaded; | |
| 3108 | int K_loaded = src_opers[dpc].K_loaded; | |
| 3109 | ||
| 3110 | /* Check for invalid .ds combination. */ | |
| 3111 | if ((insn & 0x180) == 0x100) | |
| 3112 | { | |
| 3113 | unrecog_opcode (cpustate->pc, insn); | |
| 3114 | return; | |
| 3115 | } | |
| 3116 | ||
| 3117 | if (is_pfam == 0) | |
| 3118 | { | |
| 3119 | /* Check for invalid DPC combination 16 for PFMAM. */ | |
| 3120 | if (dpc == 16) | |
| 3121 | { | |
| 3122 | unrecog_opcode (cpustate->pc, insn); | |
| 3123 | return; | |
| 3124 | } | |
| 3125 | ||
| 3126 | /* PFMAM table adjustments (M_unit_op1 is never a pipe stage, | |
| 3127 | so no adjustment made for it). */ | |
| 3128 | M_unit_op2 = (M_unit_op2 & FLAGM) ? OP_MPIPE : M_unit_op2; | |
| 3129 | A_unit_op1 = (A_unit_op1 & FLAGM) ? OP_MPIPE : A_unit_op1; | |
| 3130 | A_unit_op2 = (A_unit_op2 & FLAGM) ? OP_MPIPE : A_unit_op2; | |
| 3131 | } | |
| 3132 | ||
| 3133 | /* FIXME: Check for fsrc1/fdest overlap for some mul DPC combinations. */ | |
| 3134 | ||
| 3135 | /* Retrieve the contents of the last stage of the multiplier pipeline, | |
| 3136 | whose precision is specified by the MRP bit of the stage's result- | |
| 3137 | status bits. Note for multiply, the number of stages is determined | |
| 3138 | by the source precision of the current operation. */ | |
| 3139 | if (cpustate->M[num_mul_stages - 1].stat.mrp) | |
| 3140 | dbl_last_Mstage_contents = cpustate->M[num_mul_stages - 1].val.d; | |
| 3141 | else | |
| 3142 | sgl_last_Mstage_contents = cpustate->M[num_mul_stages - 1].val.s; | |
| 3143 | ||
| 3144 | /* Similarly, retrieve the last stage of the adder pipe. */ | |
| 3145 | if (cpustate->A[2].stat.arp) | |
| 3146 | dbl_last_Astage_contents = cpustate->A[2].val.d; | |
| 3147 | else | |
| 3148 | sgl_last_Astage_contents = cpustate->A[2].val.s; | |
| 3149 | ||
| 3150 | /* Do the mul operation, being careful about source and result | |
| 3151 | precision. */ | |
| 3152 | if (src_prec) | |
| 3153 | { | |
| 3154 | double v1 = get_fval_from_optype_d (cpustate, insn, M_unit_op1); | |
| 3155 | double v2 = get_fval_from_optype_d (cpustate, insn, M_unit_op2); | |
| 3156 | ||
| 3157 | /* For mul, if fsrc2 is the same as fdest, then the last stage | |
| 3158 | is bypassed to fsrc2 (rather than using the value in fsrc2). | |
| 3159 | This bypass is not available for fsrc1, and is undefined behavior. */ | |
| 3160 | if (0 && M_unit_op1 == OP_SRC1 && fdest != 0 && fsrc1 == fdest) | |
| 3161 | v1 = is_pfam ? dbl_last_Astage_contents : dbl_last_Mstage_contents; | |
| 3162 | if (M_unit_op2 == OP_SRC2 && fdest != 0 && fsrc2 == fdest) | |
| 3163 | v2 = is_pfam ? dbl_last_Astage_contents : dbl_last_Mstage_contents; | |
| 3164 | ||
| 3165 | if (res_prec) | |
| 3166 | dbl_tmp_dest_mul = v1 * v2; | |
| 3167 | else | |
| 3168 | sgl_tmp_dest_mul = (float)(v1 * v2); | |
| 3169 | } | |
| 3170 | else | |
| 3171 | { | |
| 3172 | float v1 = get_fval_from_optype_s (cpustate, insn, M_unit_op1); | |
| 3173 | float v2 = get_fval_from_optype_s (cpustate, insn, M_unit_op2); | |
| 3174 | ||
| 3175 | /* For mul, if fsrc2 is the same as fdest, then the last stage | |
| 3176 | is bypassed to fsrc2 (rather than using the value in fsrc2). | |
| 3177 | This bypass is not available for fsrc1, and is undefined behavior. */ | |
| 3178 | if (0 && M_unit_op1 == OP_SRC1 && fdest != 0 && fsrc1 == fdest) | |
| 3179 | v1 = is_pfam ? sgl_last_Astage_contents : sgl_last_Mstage_contents; | |
| 3180 | if (M_unit_op2 == OP_SRC2 && fdest != 0 && fsrc2 == fdest) | |
| 3181 | v2 = is_pfam ? sgl_last_Astage_contents : sgl_last_Mstage_contents; | |
| 3182 | ||
| 3183 | if (res_prec) | |
| 3184 | dbl_tmp_dest_mul = (double)(v1 * v2); | |
| 3185 | else | |
| 3186 | sgl_tmp_dest_mul = v1 * v2; | |
| 3187 | } | |
| 3188 | ||
| 3189 | /* Do the add operation, being careful about source and result | |
| 3190 | precision. Remember, the R bit indicates source and result precision | |
| 3191 | here. */ | |
| 3192 | if (res_prec) | |
| 3193 | { | |
| 3194 | double v1 = get_fval_from_optype_d (cpustate, insn, A_unit_op1); | |
| 3195 | double v2 = get_fval_from_optype_d (cpustate, insn, A_unit_op2); | |
| 3196 | ||
| 3197 | /* For add/sub, if fsrc1 is the same as fdest, then the last stage | |
| 3198 | is bypassed to fsrc1 (rather than using the value in fsrc1). | |
| 3199 | Likewise for fsrc2. */ | |
| 3200 | if (A_unit_op1 == OP_SRC1 && fdest != 0 && fsrc1 == fdest) | |
| 3201 | v1 = is_pfam ? dbl_last_Astage_contents : dbl_last_Mstage_contents; | |
| 3202 | if (A_unit_op2 == OP_SRC2 && fdest != 0 && fsrc2 == fdest) | |
| 3203 | v2 = is_pfam ? dbl_last_Astage_contents : dbl_last_Mstage_contents; | |
| 3204 | ||
| 3205 | if (res_prec) | |
| 3206 | dbl_tmp_dest_add = is_sub ? v1 - v2 : v1 + v2; | |
| 3207 | else | |
| 3208 | sgl_tmp_dest_add = is_sub ? (float)(v1 - v2) : (float)(v1 + v2); | |
| 3209 | } | |
| 3210 | else | |
| 3211 | { | |
| 3212 | float v1 = get_fval_from_optype_s (cpustate, insn, A_unit_op1); | |
| 3213 | float v2 = get_fval_from_optype_s (cpustate, insn, A_unit_op2); | |
| 3214 | ||
| 3215 | /* For add/sub, if fsrc1 is the same as fdest, then the last stage | |
| 3216 | is bypassed to fsrc1 (rather than using the value in fsrc1). | |
| 3217 | Likewise for fsrc2. */ | |
| 3218 | if (A_unit_op1 == OP_SRC1 && fdest != 0 && fsrc1 == fdest) | |
| 3219 | v1 = is_pfam ? sgl_last_Astage_contents : sgl_last_Mstage_contents; | |
| 3220 | if (A_unit_op2 == OP_SRC2 && fdest != 0 && fsrc2 == fdest) | |
| 3221 | v2 = is_pfam ? sgl_last_Astage_contents : sgl_last_Mstage_contents; | |
| 3222 | ||
| 3223 | if (res_prec) | |
| 3224 | dbl_tmp_dest_add = is_sub ? (double)(v1 - v2) : (double)(v1 + v2); | |
| 3225 | else | |
| 3226 | sgl_tmp_dest_add = is_sub ? v1 - v2 : v1 + v2; | |
| 3227 | } | |
| 3228 | ||
| 3229 | /* If necessary, load T. */ | |
| 3230 | if (T_loaded) | |
| 3231 | { | |
| 3232 | /* T is loaded from the result of the last stage of the multiplier. */ | |
| 3233 | if (cpustate->M[num_mul_stages - 1].stat.mrp) | |
| 3234 | cpustate->T.d = dbl_last_Mstage_contents; | |
| 3235 | else | |
| 3236 | cpustate->T.s = sgl_last_Mstage_contents; | |
| 3237 | } | |
| 3238 | ||
| 3239 | /* If necessary, load KR or KI. */ | |
| 3240 | if (K_loaded) | |
| 3241 | { | |
| 3242 | /* KI or KR is loaded from the first register input. */ | |
| 3243 | if (M_unit_op1 == OP_KI) | |
| 3244 | { | |
| 3245 | if (src_prec) | |
| 3246 | cpustate->KI.d = get_fregval_d (cpustate, fsrc1); | |
| 3247 | else | |
| 3248 | cpustate->KI.s = get_fregval_s (cpustate, fsrc1); | |
| 3249 | } | |
| 3250 | else if (M_unit_op1 == OP_KR) | |
| 3251 | { | |
| 3252 | if (src_prec) | |
| 3253 | cpustate->KR.d = get_fregval_d (cpustate, fsrc1); | |
| 3254 | else | |
| 3255 | cpustate->KR.s = get_fregval_s (cpustate, fsrc1); | |
| 3256 | } | |
| 3257 | else | |
| 3258 | assert (0); | |
| 3259 | } | |
| 3260 | ||
| 3261 | /* Now update fdest (either from adder pipe or multiplier pipe, | |
| 3262 | depending on whether the instruction is pfam or pfmam). */ | |
| 3263 | if (is_pfam) | |
| 3264 | { | |
| 3265 | /* Update fdest with the result from the last stage of the | |
| 3266 | adder pipeline, with precision specified by the ARP | |
| 3267 | bit of the stage's result-status bits. */ | |
| 3268 | if (cpustate->A[2].stat.arp) | |
| 3269 | set_fregval_d (cpustate, fdest, dbl_last_Astage_contents); | |
| 3270 | else | |
| 3271 | set_fregval_s (cpustate, fdest, sgl_last_Astage_contents); | |
| 3272 | } | |
| 3273 | else | |
| 3274 | { | |
| 3275 | /* Update fdest with the result from the last stage of the | |
| 3276 | multiplier pipeline, with precision specified by the MRP | |
| 3277 | bit of the stage's result-status bits. */ | |
| 3278 | if (cpustate->M[num_mul_stages - 1].stat.mrp) | |
| 3279 | set_fregval_d (cpustate, fdest, dbl_last_Mstage_contents); | |
| 3280 | else | |
| 3281 | set_fregval_s (cpustate, fdest, sgl_last_Mstage_contents); | |
| 3282 | } | |
| 3283 | ||
| 3284 | /* FIXME: Set result-status bits besides MRP. And copy to fsr from | |
| 3285 | last stage. */ | |
| 3286 | /* FIXME: Mixed precision (only wierd for pfmul). */ | |
| 3287 | #if 1 /* FIXME: WIP on FSR update. This may not be correct. */ | |
| 3288 | /* Copy 3rd stage MRP to FSR. */ | |
| 3289 | if (cpustate->M[num_mul_stages - 2 /* 1 */].stat.mrp) | |
| 3290 | cpustate->cregs[CR_FSR] |= 0x10000000; | |
| 3291 | else | |
| 3292 | cpustate->cregs[CR_FSR] &= ~0x10000000; | |
| 3293 | #endif | |
| 3294 | ||
| 3295 | /* Now advance multiplier pipeline and write current calculation to | |
| 3296 | first stage. */ | |
| 3297 | if (num_mul_stages == 3) | |
| 3298 | { | |
| 3299 | cpustate->M[2] = cpustate->M[1]; | |
| 3300 | cpustate->M[1] = cpustate->M[0]; | |
| 3301 | } | |
| 3302 | else | |
| 3303 | cpustate->M[1] = cpustate->M[0]; | |
| 3304 | ||
| 3305 | if (res_prec) | |
| 3306 | { | |
| 3307 | cpustate->M[0].val.d = dbl_tmp_dest_mul; | |
| 3308 | cpustate->M[0].stat.mrp = 1; | |
| 3309 | } | |
| 3310 | else | |
| 3311 | { | |
| 3312 | cpustate->M[0].val.s = sgl_tmp_dest_mul; | |
| 3313 | cpustate->M[0].stat.mrp = 0; | |
| 3314 | } | |
| 3315 | ||
| 3316 | /* FIXME: Set result-status bits besides ARP. And copy to fsr from | |
| 3317 | last stage. */ | |
| 3318 | #if 1 /* FIXME: WIP on FSR update. This may not be correct. */ | |
| 3319 | /* Copy 3rd stage ARP to FSR. */ | |
| 3320 | if (cpustate->A[1 /* 2 */].stat.arp) | |
| 3321 | cpustate->cregs[CR_FSR] |= 0x20000000; | |
| 3322 | else | |
| 3323 | cpustate->cregs[CR_FSR] &= ~0x20000000; | |
| 3324 | #endif | |
| 3325 | ||
| 3326 | /* Now advance adder pipeline and write current calculation to | |
| 3327 | first stage. */ | |
| 3328 | cpustate->A[2] = cpustate->A[1]; | |
| 3329 | cpustate->A[1] = cpustate->A[0]; | |
| 3330 | if (res_prec) | |
| 3331 | { | |
| 3332 | cpustate->A[0].val.d = dbl_tmp_dest_add; | |
| 3333 | cpustate->A[0].stat.arp = 1; | |
| 3334 | } | |
| 3335 | else | |
| 3336 | { | |
| 3337 | cpustate->A[0].val.s = sgl_tmp_dest_add; | |
| 3338 | cpustate->A[0].stat.arp = 0; | |
| 3339 | } | |
| 3340 | } | |
| 3341 | ||
| 3342 | ||
| 3343 | /* Execute frcp.{ss,sd,dd} fsrc2,fdest (.ds disallowed above). */ | |
| 3344 | static void insn_frcp (i860s *cpustate, UINT32 insn) | |
| 3345 | { | |
| 3346 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 3347 | UINT32 fdest = get_fdest (insn); | |
| 3348 | int src_prec = insn & 0x100; /* 1 = double, 0 = single. */ | |
| 3349 | int res_prec = insn & 0x080; /* 1 = double, 0 = single. */ | |
| 3350 | ||
| 3351 | /* Do the operation, being careful about source and result | |
| 3352 | precision. */ | |
| 3353 | if (src_prec) | |
| 3354 | { | |
| 3355 | double v = get_fregval_d (cpustate, fsrc2); | |
| 3356 | double res; | |
| 3357 | if (v == (double)0.0) | |
| 3358 | { | |
| 3359 | /* Generate source-exception trap if fsrc2 is 0. */ | |
| 3360 | if (0 /* && GET_FSR_FTE () */) | |
| 3361 | { | |
| 3362 | SET_PSR_FT (1); | |
| 3363 | SET_FSR_SE (1); | |
| 3364 | cpustate->pending_trap = GET_FSR_FTE (); | |
| 3365 | } | |
| 3366 | /* Set fdest to INF or some other exceptional value here? */ | |
| 3367 | } | |
| 3368 | else | |
| 3369 | { | |
| 3370 | /* Real i860 isn't a precise as a real divide, but this should | |
| 3371 | be okay. */ | |
| 3372 | SET_FSR_SE (0); | |
| 3373 | *((UINT64 *)&v) &= 0xfffff00000000000ULL; | |
| 3374 | res = (double)1.0/v; | |
| 3375 | *((UINT64 *)&res) &= 0xfffff00000000000ULL; | |
| 3376 | if (res_prec) | |
| 3377 | set_fregval_d (cpustate, fdest, res); | |
| 3378 | else | |
| 3379 | set_fregval_s (cpustate, fdest, (float)res); | |
| 3380 | } | |
| 3381 | } | |
| 3382 | else | |
| 3383 | { | |
| 3384 | float v = get_fregval_s (cpustate, fsrc2); | |
| 3385 | float res; | |
| 3386 | if (v == 0.0) | |
| 3387 | { | |
| 3388 | /* Generate source-exception trap if fsrc2 is 0. */ | |
| 3389 | if (0 /* GET_FSR_FTE () */) | |
| 3390 | { | |
| 3391 | SET_PSR_FT (1); | |
| 3392 | SET_FSR_SE (1); | |
| 3393 | cpustate->pending_trap = GET_FSR_FTE (); | |
| 3394 | } | |
| 3395 | /* Set fdest to INF or some other exceptional value here? */ | |
| 3396 | } | |
| 3397 | else | |
| 3398 | { | |
| 3399 | /* Real i860 isn't a precise as a real divide, but this should | |
| 3400 | be okay. */ | |
| 3401 | SET_FSR_SE (0); | |
| 3402 | *((UINT32 *)&v) &= 0xffff8000; | |
| 3403 | res = (float)1.0/v; | |
| 3404 | *((UINT32 *)&res) &= 0xffff8000; | |
| 3405 | if (res_prec) | |
| 3406 | set_fregval_d (cpustate, fdest, (double)res); | |
| 3407 | else | |
| 3408 | set_fregval_s (cpustate, fdest, res); | |
| 3409 | } | |
| 3410 | } | |
| 3411 | } | |
| 3412 | ||
| 3413 | ||
| 3414 | /* Execute frsqr.{ss,sd,dd} fsrc2,fdest (.ds disallowed above). */ | |
| 3415 | static void insn_frsqr (i860s *cpustate, UINT32 insn) | |
| 3416 | { | |
| 3417 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 3418 | UINT32 fdest = get_fdest (insn); | |
| 3419 | int src_prec = insn & 0x100; /* 1 = double, 0 = single. */ | |
| 3420 | int res_prec = insn & 0x080; /* 1 = double, 0 = single. */ | |
| 3421 | ||
| 3422 | /* Check for invalid .ds combination. */ | |
| 3423 | if ((insn & 0x180) == 0x100) | |
| 3424 | { | |
| 3425 | unrecog_opcode (cpustate->pc, insn); | |
| 3426 | return; | |
| 3427 | } | |
| 3428 | ||
| 3429 | /* Check for invalid .ds combination. */ | |
| 3430 | if ((insn & 0x180) == 0x100) | |
| 3431 | { | |
| 3432 | unrecog_opcode (cpustate->pc, insn); | |
| 3433 | return; | |
| 3434 | } | |
| 3435 | ||
| 3436 | /* Do the operation, being careful about source and result | |
| 3437 | precision. */ | |
| 3438 | if (src_prec) | |
| 3439 | { | |
| 3440 | double v = get_fregval_d (cpustate, fsrc2); | |
| 3441 | double res; | |
| 3442 | if (v == 0.0 || v < 0.0) | |
| 3443 | { | |
| 3444 | /* Generate source-exception trap if fsrc2 is 0 or negative. */ | |
| 3445 | if (0 /* GET_FSR_FTE () */) | |
| 3446 | { | |
| 3447 | SET_PSR_FT (1); | |
| 3448 | SET_FSR_SE (1); | |
| 3449 | cpustate->pending_trap = GET_FSR_FTE (); | |
| 3450 | } | |
| 3451 | /* Set fdest to INF or some other exceptional value here? */ | |
| 3452 | } | |
| 3453 | else | |
| 3454 | { | |
| 3455 | SET_FSR_SE (0); | |
| 3456 | *((UINT64 *)&v) &= 0xfffff00000000000ULL; | |
| 3457 | res = (double)1.0/sqrt (v); | |
| 3458 | *((UINT64 *)&res) &= 0xfffff00000000000ULL; | |
| 3459 | if (res_prec) | |
| 3460 | set_fregval_d (cpustate, fdest, res); | |
| 3461 | else | |
| 3462 | set_fregval_s (cpustate, fdest, (float)res); | |
| 3463 | } | |
| 3464 | } | |
| 3465 | else | |
| 3466 | { | |
| 3467 | float v = get_fregval_s (cpustate, fsrc2); | |
| 3468 | float res; | |
| 3469 | if (v == 0.0 || v < 0.0) | |
| 3470 | { | |
| 3471 | /* Generate source-exception trap if fsrc2 is 0 or negative. */ | |
| 3472 | if (0 /* GET_FSR_FTE () */) | |
| 3473 | { | |
| 3474 | SET_PSR_FT (1); | |
| 3475 | SET_FSR_SE (1); | |
| 3476 | cpustate->pending_trap = GET_FSR_FTE (); | |
| 3477 | } | |
| 3478 | /* Set fdest to INF or some other exceptional value here? */ | |
| 3479 | } | |
| 3480 | else | |
| 3481 | { | |
| 3482 | SET_FSR_SE (0); | |
| 3483 | *((UINT32 *)&v) &= 0xffff8000; | |
| 3484 | res = (float)1.0/sqrt (v); | |
| 3485 | *((UINT32 *)&res) &= 0xffff8000; | |
| 3486 | if (res_prec) | |
| 3487 | set_fregval_d (cpustate, fdest, (double)res); | |
| 3488 | else | |
| 3489 | set_fregval_s (cpustate, fdest, res); | |
| 3490 | } | |
| 3491 | } | |
| 3492 | } | |
| 3493 | ||
| 3494 | ||
| 3495 | /* Execute fxfr fsrc1,idest. */ | |
| 3496 | static void insn_fxfr (i860s *cpustate, UINT32 insn) | |
| 3497 | { | |
| 3498 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 3499 | UINT32 idest = get_idest (insn); | |
| 3500 | float fv = 0; | |
| 3501 | ||
| 3502 | /* This is a bit-pattern transfer, not a conversion. */ | |
| 3503 | fv = get_fregval_s (cpustate, fsrc1); | |
| 3504 | set_iregval (idest, *(UINT32 *)&fv); | |
| 3505 | } | |
| 3506 | ||
| 3507 | ||
| 3508 | /* Execute [p]ftrunc.{ss,sd,dd} fsrc1,idest. */ | |
| 3509 | /* FIXME: Is .ss really a valid combination? On the one hand, | |
| 3510 | the programmer's reference (1990) lists ftrunc.p where .p | |
| 3511 | is any of {ss,sd,dd}. On the other hand, a paragraph on the | |
| 3512 | same page states that [p]ftrunc must specify double-precision | |
| 3513 | results. Inconsistent. | |
| 3514 | Update: The vendor SVR4 assembler does not accept .ss combination, | |
| 3515 | so the latter sentence above appears to be the correct way. */ | |
| 3516 | static void insn_ftrunc (i860s *cpustate, UINT32 insn) | |
| 3517 | { | |
| 3518 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 3519 | UINT32 fdest = get_fdest (insn); | |
| 3520 | int src_prec = insn & 0x100; /* 1 = double, 0 = single. */ | |
| 3521 | int res_prec = insn & 0x080; /* 1 = double, 0 = single. */ | |
| 3522 | int piped = insn & 0x400; /* 1 = pipelined, 0 = scalar. */ | |
| 3523 | ||
| 3524 | /* Check for invalid .ds or .ss combinations. */ | |
| 3525 | if ((insn & 0x080) == 0) | |
| 3526 | { | |
| 3527 | unrecog_opcode (cpustate->pc, insn); | |
| 3528 | return; | |
| 3529 | } | |
| 3530 | ||
| 3531 | /* Do the operation, being careful about source and result | |
| 3532 | precision. Operation: fdest = integer part of fsrc1 in | |
| 3533 | lower 32-bits. */ | |
| 3534 | if (src_prec) | |
| 3535 | { | |
| 3536 | double v1 = get_fregval_d (cpustate, fsrc1); | |
| 3537 | INT32 iv = (INT32)v1; | |
| 3538 | /* We always write a single, since the lower 32-bits of fdest | |
| 3539 | get the result (and the even numbered reg is the lower). */ | |
| 3540 | set_fregval_s (cpustate, fdest, *(float *)&iv); | |
| 3541 | } | |
| 3542 | else | |
| 3543 | { | |
| 3544 | float v1 = get_fregval_s (cpustate, fsrc1); | |
| 3545 | INT32 iv = (INT32)v1; | |
| 3546 | /* We always write a single, since the lower 32-bits of fdest | |
| 3547 | get the result (and the even numbered reg is the lower). */ | |
| 3548 | set_fregval_s (cpustate, fdest, *(float *)&iv); | |
| 3549 | } | |
| 3550 | ||
| 3551 | /* FIXME: Handle updating of pipestages for pftrunc. */ | |
| 3552 | /* Includes looking at ARP (add result precision.) */ | |
| 3553 | if (piped) | |
| 3554 | { | |
| 3555 | fprintf (stderr, "insn_ftrunc: FIXME: pipelined not functional yet.\n"); | |
| 3556 | if (res_prec) | |
| 3557 | set_fregval_d (cpustate, fdest, 0.0); | |
| 3558 | else | |
| 3559 | set_fregval_s (cpustate, fdest, 0.0); | |
| 3560 | } | |
| 3561 | } | |
| 3562 | ||
| 3563 | ||
| 3564 | /* Execute [p]famov.{ss,sd,ds,dd} fsrc1,fdest. */ | |
| 3565 | static void insn_famov (i860s *cpustate, UINT32 insn) | |
| 3566 | { | |
| 3567 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 3568 | UINT32 fdest = get_fdest (insn); | |
| 3569 | int src_prec = insn & 0x100; /* 1 = double, 0 = single. */ | |
| 3570 | int res_prec = insn & 0x080; /* 1 = double, 0 = single. */ | |
| 3571 | int piped = insn & 0x400; /* 1 = pipelined, 0 = scalar. */ | |
| 3572 | double dbl_tmp_dest = 0.0; | |
| 3573 | double sgl_tmp_dest = 0.0; | |
| 3574 | ||
| 3575 | /* Do the operation, being careful about source and result | |
| 3576 | precision. */ | |
| 3577 | if (src_prec) | |
| 3578 | { | |
| 3579 | double v1 = get_fregval_d (cpustate, fsrc1); | |
| 3580 | if (res_prec) | |
| 3581 | dbl_tmp_dest = v1; | |
| 3582 | else | |
| 3583 | sgl_tmp_dest = (float)v1; | |
| 3584 | } | |
| 3585 | else | |
| 3586 | { | |
| 3587 | float v1 = get_fregval_s (cpustate, fsrc1); | |
| 3588 | if (res_prec) | |
| 3589 | dbl_tmp_dest = (double)v1; | |
| 3590 | else | |
| 3591 | sgl_tmp_dest = v1; | |
| 3592 | } | |
| 3593 | ||
| 3594 | /* FIXME: Set result-status bits besides ARP. And copy to fsr from | |
| 3595 | last stage. */ | |
| 3596 | /* FIXME: Scalar version flows through all stages. */ | |
| 3597 | if (!piped) | |
| 3598 | { | |
| 3599 | /* Scalar version writes the current calculation to the fdest | |
| 3600 | register, with precision specified by the R bit. */ | |
| 3601 | if (res_prec) | |
| 3602 | set_fregval_d (cpustate, fdest, dbl_tmp_dest); | |
| 3603 | else | |
| 3604 | set_fregval_s (cpustate, fdest, sgl_tmp_dest); | |
| 3605 | } | |
| 3606 | else | |
| 3607 | { | |
| 3608 | /* Pipelined version writes fdest with the result from the last | |
| 3609 | stage of the pipeline, with precision specified by the ARP | |
| 3610 | bit of the stage's result-status bits. */ | |
| 3611 | #if 1 /* FIXME: WIP on FSR update. This may not be correct. */ | |
| 3612 | /* Copy 3rd stage ARP to FSR. */ | |
| 3613 | if (cpustate->A[1 /* 2 */].stat.arp) | |
| 3614 | cpustate->cregs[CR_FSR] |= 0x20000000; | |
| 3615 | else | |
| 3616 | cpustate->cregs[CR_FSR] &= ~0x20000000; | |
| 3617 | #endif | |
| 3618 | if (cpustate->A[2].stat.arp) /* 3rd (last) stage. */ | |
| 3619 | set_fregval_d (cpustate, fdest, cpustate->A[2].val.d); | |
| 3620 | else | |
| 3621 | set_fregval_s (cpustate, fdest, cpustate->A[2].val.s); | |
| 3622 | ||
| 3623 | /* Now advance pipeline and write current calculation to | |
| 3624 | first stage. */ | |
| 3625 | cpustate->A[2] = cpustate->A[1]; | |
| 3626 | cpustate->A[1] = cpustate->A[0]; | |
| 3627 | if (res_prec) | |
| 3628 | { | |
| 3629 | cpustate->A[0].val.d = dbl_tmp_dest; | |
| 3630 | cpustate->A[0].stat.arp = 1; | |
| 3631 | } | |
| 3632 | else | |
| 3633 | { | |
| 3634 | cpustate->A[0].val.s = sgl_tmp_dest; | |
| 3635 | cpustate->A[0].stat.arp = 0; | |
| 3636 | } | |
| 3637 | } | |
| 3638 | } | |
| 3639 | ||
| 3640 | ||
| 3641 | /* Execute [p]fiadd/sub.{ss,dd} fsrc1,fsrc2,fdest. */ | |
| 3642 | static void insn_fiadd_sub (i860s *cpustate, UINT32 insn) | |
| 3643 | { | |
| 3644 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 3645 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 3646 | UINT32 fdest = get_fdest (insn); | |
| 3647 | int src_prec = insn & 0x100; /* 1 = double, 0 = single. */ | |
| 3648 | int res_prec = insn & 0x080; /* 1 = double, 0 = single. */ | |
| 3649 | int piped = insn & 0x400; /* 1 = pipelined, 0 = scalar. */ | |
| 3650 | int is_sub = insn & 0x4; /* 1 = sub, 0 = add. */ | |
| 3651 | double dbl_tmp_dest = 0.0; | |
| 3652 | float sgl_tmp_dest = 0.0; | |
| 3653 | ||
| 3654 | /* Check for invalid .ds and .sd combinations. */ | |
| 3655 | if ((insn & 0x180) == 0x100 | |
| 3656 | || (insn & 0x180) == 0x080) | |
| 3657 | { | |
| 3658 | unrecog_opcode (cpustate->pc, insn); | |
| 3659 | return; | |
| 3660 | } | |
| 3661 | ||
| 3662 | /* Do the operation, being careful about source and result | |
| 3663 | precision. */ | |
| 3664 | if (src_prec) | |
| 3665 | { | |
| 3666 | double v1 = get_fregval_d (cpustate, fsrc1); | |
| 3667 | double v2 = get_fregval_d (cpustate, fsrc2); | |
| 3668 | UINT64 iv1 = *(UINT64 *)&v1; | |
| 3669 | UINT64 iv2 = *(UINT64 *)&v2; | |
| 3670 | UINT64 r; | |
| 3671 | if (is_sub) | |
| 3672 | r = iv1 - iv2; | |
| 3673 | else | |
| 3674 | r = iv1 + iv2; | |
| 3675 | if (res_prec) | |
| 3676 | dbl_tmp_dest = *(double *)&r; | |
| 3677 | else | |
| 3678 | assert (0); /* .ds not allowed. */ | |
| 3679 | } | |
| 3680 | else | |
| 3681 | { | |
| 3682 | float v1 = get_fregval_s (cpustate, fsrc1); | |
| 3683 | float v2 = get_fregval_s (cpustate, fsrc2); | |
| 3684 | UINT64 iv1 = (UINT64)(*(UINT32 *)&v1); | |
| 3685 | UINT64 iv2 = (UINT64)(*(UINT32 *)&v2); | |
| 3686 | UINT32 r; | |
| 3687 | if (is_sub) | |
| 3688 | r = (UINT32)(iv1 - iv2); | |
| 3689 | else | |
| 3690 | r = (UINT32)(iv1 + iv2); | |
| 3691 | if (res_prec) | |
| 3692 | assert (0); /* .sd not allowed. */ | |
| 3693 | else | |
| 3694 | sgl_tmp_dest = *(float *)&r; | |
| 3695 | } | |
| 3696 | ||
| 3697 | /* FIXME: Copy result-status bit IRP to fsr from last stage. */ | |
| 3698 | /* FIXME: Scalar version flows through all stages. */ | |
| 3699 | if (!piped) | |
| 3700 | { | |
| 3701 | /* Scalar version writes the current calculation to the fdest | |
| 3702 | register, with precision specified by the R bit. */ | |
| 3703 | if (res_prec) | |
| 3704 | set_fregval_d (cpustate, fdest, dbl_tmp_dest); | |
| 3705 | else | |
| 3706 | set_fregval_s (cpustate, fdest, sgl_tmp_dest); | |
| 3707 | } | |
| 3708 | else | |
| 3709 | { | |
| 3710 | /* Pipelined version writes fdest with the result from the last | |
| 3711 | stage of the pipeline, with precision specified by the IRP | |
| 3712 | bit of the stage's result-status bits. */ | |
| 3713 | #if 1 /* FIXME: WIP on FSR update. This may not be correct. */ | |
| 3714 | /* Copy stage IRP to FSR. */ | |
| 3715 | if (res_prec) | |
| 3716 | cpustate->cregs[CR_FSR] |= 0x08000000; | |
| 3717 | else | |
| 3718 | cpustate->cregs[CR_FSR] &= ~0x08000000; | |
| 3719 | #endif | |
| 3720 | if (cpustate->G.stat.irp) /* 1st (and last) stage. */ | |
| 3721 | set_fregval_d (cpustate, fdest, cpustate->G.val.d); | |
| 3722 | else | |
| 3723 | set_fregval_s (cpustate, fdest, cpustate->G.val.s); | |
| 3724 | ||
| 3725 | /* Now write current calculation to first and only stage. */ | |
| 3726 | if (res_prec) | |
| 3727 | { | |
| 3728 | cpustate->G.val.d = dbl_tmp_dest; | |
| 3729 | cpustate->G.stat.irp = 1; | |
| 3730 | } | |
| 3731 | else | |
| 3732 | { | |
| 3733 | cpustate->G.val.s = sgl_tmp_dest; | |
| 3734 | cpustate->G.stat.irp = 0; | |
| 3735 | } | |
| 3736 | } | |
| 3737 | } | |
| 3738 | ||
| 3739 | ||
| 3740 | /* Execute pf{gt,le,eq}.{ss,dd} fsrc1,fsrc2,fdest. | |
| 3741 | Opcode pfgt has R bit cleared; pfle has R bit set. */ | |
| 3742 | static void insn_fcmp (i860s *cpustate, UINT32 insn) | |
| 3743 | { | |
| 3744 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 3745 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 3746 | UINT32 fdest = get_fdest (insn); | |
| 3747 | int src_prec = insn & 0x100; /* 1 = double, 0 = single. */ | |
| 3748 | double dbl_tmp_dest = 0.0; | |
| 3749 | double sgl_tmp_dest = 0.0; | |
| 3750 | /* int is_eq = insn & 1; */ | |
| 3751 | int is_gt = ((insn & 0x81) == 0x00); | |
| 3752 | int is_le = ((insn & 0x81) == 0x80); | |
| 3753 | ||
| 3754 | /* Do the operation. Source and result precision must be the same. | |
| 3755 | pfgt: CC set if fsrc1 > fsrc2, else cleared. | |
| 3756 | pfle: CC cleared if fsrc1 <= fsrc2, else set. | |
| 3757 | pfeq: CC set if fsrc1 = fsrc2, else cleared. | |
| 3758 | ||
| 3759 | Note that the compares write an undefined (but non-exceptional) | |
| 3760 | result into the first stage of the adder pipeline. We'll model | |
| 3761 | this by just pushing in dbl_ or sgl_tmp_dest which equal 0.0. */ | |
| 3762 | if (src_prec) | |
| 3763 | { | |
| 3764 | double v1 = get_fregval_d (cpustate, fsrc1); | |
| 3765 | double v2 = get_fregval_d (cpustate, fsrc2); | |
| 3766 | if (is_gt) /* gt. */ | |
| 3767 | SET_PSR_CC (v1 > v2 ? 1 : 0); | |
| 3768 | else if (is_le) /* le. */ | |
| 3769 | SET_PSR_CC (v1 <= v2 ? 0 : 1); | |
| 3770 | else /* eq. */ | |
| 3771 | SET_PSR_CC (v1 == v2 ? 1 : 0); | |
| 3772 | } | |
| 3773 | else | |
| 3774 | { | |
| 3775 | float v1 = get_fregval_s (cpustate, fsrc1); | |
| 3776 | float v2 = get_fregval_s (cpustate, fsrc2); | |
| 3777 | if (is_gt) /* gt. */ | |
| 3778 | SET_PSR_CC (v1 > v2 ? 1 : 0); | |
| 3779 | else if (is_le) /* le. */ | |
| 3780 | SET_PSR_CC (v1 <= v2 ? 0 : 1); | |
| 3781 | else /* eq. */ | |
| 3782 | SET_PSR_CC (v1 == v2 ? 1 : 0); | |
| 3783 | } | |
| 3784 | ||
| 3785 | /* FIXME: Set result-status bits besides ARP. And copy to fsr from | |
| 3786 | last stage. */ | |
| 3787 | /* These write fdest with the result from the last | |
| 3788 | stage of the pipeline, with precision specified by the ARP | |
| 3789 | bit of the stage's result-status bits. */ | |
| 3790 | #if 1 /* FIXME: WIP on FSR update. This may not be correct. */ | |
| 3791 | /* Copy 3rd stage ARP to FSR. */ | |
| 3792 | if (cpustate->A[1 /* 2 */].stat.arp) | |
| 3793 | cpustate->cregs[CR_FSR] |= 0x20000000; | |
| 3794 | else | |
| 3795 | cpustate->cregs[CR_FSR] &= ~0x20000000; | |
| 3796 | #endif | |
| 3797 | if (cpustate->A[2].stat.arp) /* 3rd (last) stage. */ | |
| 3798 | set_fregval_d (cpustate, fdest, cpustate->A[2].val.d); | |
| 3799 | else | |
| 3800 | set_fregval_s (cpustate, fdest, cpustate->A[2].val.s); | |
| 3801 | ||
| 3802 | /* Now advance pipeline and write current calculation to | |
| 3803 | first stage. */ | |
| 3804 | cpustate->A[2] = cpustate->A[1]; | |
| 3805 | cpustate->A[1] = cpustate->A[0]; | |
| 3806 | if (src_prec) | |
| 3807 | { | |
| 3808 | cpustate->A[0].val.d = dbl_tmp_dest; | |
| 3809 | cpustate->A[0].stat.arp = 1; | |
| 3810 | } | |
| 3811 | else | |
| 3812 | { | |
| 3813 | cpustate->A[0].val.s = sgl_tmp_dest; | |
| 3814 | cpustate->A[0].stat.arp = 0; | |
| 3815 | } | |
| 3816 | } | |
| 3817 | ||
| 3818 | ||
| 3819 | /* Execute [p]fzchk{l,s} fsrc1,fsrc2,fdest. | |
| 3820 | The fzchk instructions have S and R bits set. */ | |
| 3821 | static void insn_fzchk (i860s *cpustate, UINT32 insn) | |
| 3822 | { | |
| 3823 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 3824 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 3825 | UINT32 fdest = get_fdest (insn); | |
| 3826 | int piped = insn & 0x400; /* 1 = pipelined, 0 = scalar. */ | |
| 3827 | int is_fzchks = insn & 8; /* 1 = fzchks, 0 = fzchkl. */ | |
| 3828 | double dbl_tmp_dest = 0.0; | |
| 3829 | int i; | |
| 3830 | double v1 = get_fregval_d (cpustate, fsrc1); | |
| 3831 | double v2 = get_fregval_d (cpustate, fsrc2); | |
| 3832 | UINT64 iv1 = *(UINT64 *)&v1; | |
| 3833 | UINT64 iv2 = *(UINT64 *)&v2; | |
| 3834 | UINT64 r = 0; | |
| 3835 | char pm = GET_PSR_PM (); | |
| 3836 | ||
| 3837 | /* Check for S and R bits set. */ | |
| 3838 | if ((insn & 0x180) != 0x180) | |
| 3839 | { | |
| 3840 | unrecog_opcode (cpustate->pc, insn); | |
| 3841 | return; | |
| 3842 | } | |
| 3843 | ||
| 3844 | /* Do the operation. The fzchks version operates in parallel on | |
| 3845 | four 16-bit pixels, while the fzchkl operates on two 32-bit | |
| 3846 | pixels (pixels are unsigned ordinals in this context). */ | |
| 3847 | if (is_fzchks) | |
| 3848 | { | |
| 3849 | pm = (pm >> 4) & 0x0f; | |
| 3850 | for (i = 3; i >= 0; i--) | |
| 3851 | { | |
| 3852 | UINT16 ps1 = (iv1 >> (i * 16)) & 0xffff; | |
| 3853 | UINT16 ps2 = (iv2 >> (i * 16)) & 0xffff; | |
| 3854 | if (ps2 <= ps1) | |
| 3855 | { | |
| 3856 | r |= ((UINT64)ps2 << (i * 16)); | |
| 3857 | pm |= (1 << (7 - (3 - i))); | |
| 3858 | } | |
| 3859 | else | |
| 3860 | { | |
| 3861 | r |= ((UINT64)ps1 << (i * 16)); | |
| 3862 | pm &= ~(1 << (7 - (3 - i))); | |
| 3863 | } | |
| 3864 | } | |
| 3865 | } | |
| 3866 | else | |
| 3867 | { | |
| 3868 | pm = (pm >> 2) & 0x3f; | |
| 3869 | for (i = 1; i >= 0; i--) | |
| 3870 | { | |
| 3871 | UINT32 ps1 = (iv1 >> (i * 32)) & 0xffffffff; | |
| 3872 | UINT32 ps2 = (iv2 >> (i * 32)) & 0xffffffff; | |
| 3873 | if (ps2 <= ps1) | |
| 3874 | { | |
| 3875 | r |= ((UINT64)ps2 << (i * 32)); | |
| 3876 | pm |= (1 << (7 - (1 - i))); | |
| 3877 | } | |
| 3878 | else | |
| 3879 | { | |
| 3880 | r |= ((UINT64)ps1 << (i * 32)); | |
| 3881 | pm &= ~(1 << (7 - (1 - i))); | |
| 3882 | } | |
| 3883 | } | |
| 3884 | } | |
| 3885 | ||
| 3886 | dbl_tmp_dest = *(double *)&r; | |
| 3887 | SET_PSR_PM (pm); | |
| 3888 | cpustate->merge = 0; | |
| 3889 | ||
| 3890 | /* FIXME: Copy result-status bit IRP to fsr from last stage. */ | |
| 3891 | /* FIXME: Scalar version flows through all stages. */ | |
| 3892 | if (!piped) | |
| 3893 | { | |
| 3894 | /* Scalar version writes the current calculation to the fdest | |
| 3895 | register, always with double precision. */ | |
| 3896 | set_fregval_d (cpustate, fdest, dbl_tmp_dest); | |
| 3897 | } | |
| 3898 | else | |
| 3899 | { | |
| 3900 | /* Pipelined version writes fdest with the result from the last | |
| 3901 | stage of the pipeline, with precision specified by the IRP | |
| 3902 | bit of the stage's result-status bits. */ | |
| 3903 | if (cpustate->G.stat.irp) /* 1st (and last) stage. */ | |
| 3904 | set_fregval_d (cpustate, fdest, cpustate->G.val.d); | |
| 3905 | else | |
| 3906 | set_fregval_s (cpustate, fdest, cpustate->G.val.s); | |
| 3907 | ||
| 3908 | /* Now write current calculation to first and only stage. */ | |
| 3909 | cpustate->G.val.d = dbl_tmp_dest; | |
| 3910 | cpustate->G.stat.irp = 1; | |
| 3911 | } | |
| 3912 | } | |
| 3913 | ||
| 3914 | ||
| 3915 | /* Execute [p]form.dd fsrc1,fdest. | |
| 3916 | The form.dd instructions have S and R bits set. */ | |
| 3917 | static void insn_form (i860s *cpustate, UINT32 insn) | |
| 3918 | { | |
| 3919 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 3920 | UINT32 fdest = get_fdest (insn); | |
| 3921 | int piped = insn & 0x400; /* 1 = pipelined, 0 = scalar. */ | |
| 3922 | double dbl_tmp_dest = 0.0; | |
| 3923 | double v1 = get_fregval_d (cpustate, fsrc1); | |
| 3924 | UINT64 iv1 = *(UINT64 *)&v1; | |
| 3925 | ||
| 3926 | /* Check for S and R bits set. */ | |
| 3927 | if ((insn & 0x180) != 0x180) | |
| 3928 | { | |
| 3929 | unrecog_opcode (cpustate->pc, insn); | |
| 3930 | return; | |
| 3931 | } | |
| 3932 | ||
| 3933 | iv1 |= cpustate->merge; | |
| 3934 | dbl_tmp_dest = *(double *)&iv1; | |
| 3935 | cpustate->merge = 0; | |
| 3936 | ||
| 3937 | /* FIXME: Copy result-status bit IRP to fsr from last stage. */ | |
| 3938 | /* FIXME: Scalar version flows through all stages. */ | |
| 3939 | if (!piped) | |
| 3940 | { | |
| 3941 | /* Scalar version writes the current calculation to the fdest | |
| 3942 | register, always with double precision. */ | |
| 3943 | set_fregval_d (cpustate, fdest, dbl_tmp_dest); | |
| 3944 | } | |
| 3945 | else | |
| 3946 | { | |
| 3947 | /* Pipelined version writes fdest with the result from the last | |
| 3948 | stage of the pipeline, with precision specified by the IRP | |
| 3949 | bit of the stage's result-status bits. */ | |
| 3950 | if (cpustate->G.stat.irp) /* 1st (and last) stage. */ | |
| 3951 | set_fregval_d (cpustate, fdest, cpustate->G.val.d); | |
| 3952 | else | |
| 3953 | set_fregval_s (cpustate, fdest, cpustate->G.val.s); | |
| 3954 | ||
| 3955 | /* Now write current calculation to first and only stage. */ | |
| 3956 | cpustate->G.val.d = dbl_tmp_dest; | |
| 3957 | cpustate->G.stat.irp = 1; | |
| 3958 | } | |
| 3959 | } | |
| 3960 | ||
| 3961 | ||
| 3962 | /* Execute [p]faddp fsrc1,fsrc2,fdest. */ | |
| 3963 | static void insn_faddp (i860s *cpustate, UINT32 insn) | |
| 3964 | { | |
| 3965 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 3966 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 3967 | UINT32 fdest = get_fdest (insn); | |
| 3968 | int piped = insn & 0x400; /* 1 = pipelined, 0 = scalar. */ | |
| 3969 | double dbl_tmp_dest = 0.0; | |
| 3970 | double v1 = get_fregval_d (cpustate, fsrc1); | |
| 3971 | double v2 = get_fregval_d (cpustate, fsrc2); | |
| 3972 | UINT64 iv1 = *(UINT64 *)&v1; | |
| 3973 | UINT64 iv2 = *(UINT64 *)&v2; | |
| 3974 | UINT64 r = 0; | |
| 3975 | int ps = GET_PSR_PS (); | |
| 3976 | ||
| 3977 | r = iv1 + iv2; | |
| 3978 | dbl_tmp_dest = *(double *)&r; | |
| 3979 | ||
| 3980 | /* Update the merge register depending on the pixel size. | |
| 3981 | PS: 0 = 8 bits, 1 = 16 bits, 2 = 32-bits. */ | |
| 3982 | if (ps == 0) | |
| 3983 | { | |
| 3984 | cpustate->merge = ((cpustate->merge >> 8) & ~0xff00ff00ff00ff00ULL); | |
| 3985 | cpustate->merge |= (r & 0xff00ff00ff00ff00ULL); | |
| 3986 | } | |
| 3987 | else if (ps == 1) | |
| 3988 | { | |
| 3989 | cpustate->merge = ((cpustate->merge >> 6) & ~0xfc00fc00fc00fc00ULL); | |
| 3990 | cpustate->merge |= (r & 0xfc00fc00fc00fc00ULL); | |
| 3991 | } | |
| 3992 | else if (ps == 2) | |
| 3993 | { | |
| 3994 | cpustate->merge = ((cpustate->merge >> 8) & ~0xff000000ff000000ULL); | |
| 3995 | cpustate->merge |= (r & 0xff000000ff000000ULL); | |
| 3996 | } | |
| 3997 | #ifdef TRACE_UNDEFINED_I860 | |
| 3998 | else | |
| 3999 | fprintf (stderr, "insn_faddp: Undefined i860XR behavior, invalid value %d for pixel size.\n", ps); | |
| 4000 | #endif | |
| 4001 | ||
| 4002 | /* FIXME: Copy result-status bit IRP to fsr from last stage. */ | |
| 4003 | /* FIXME: Scalar version flows through all stages. */ | |
| 4004 | if (!piped) | |
| 4005 | { | |
| 4006 | /* Scalar version writes the current calculation to the fdest | |
| 4007 | register, always with double precision. */ | |
| 4008 | set_fregval_d (cpustate, fdest, dbl_tmp_dest); | |
| 4009 | } | |
| 4010 | else | |
| 4011 | { | |
| 4012 | /* Pipelined version writes fdest with the result from the last | |
| 4013 | stage of the pipeline, with precision specified by the IRP | |
| 4014 | bit of the stage's result-status bits. */ | |
| 4015 | if (cpustate->G.stat.irp) /* 1st (and last) stage. */ | |
| 4016 | set_fregval_d (cpustate, fdest, cpustate->G.val.d); | |
| 4017 | else | |
| 4018 | set_fregval_s (cpustate, fdest, cpustate->G.val.s); | |
| 4019 | ||
| 4020 | /* Now write current calculation to first and only stage. */ | |
| 4021 | cpustate->G.val.d = dbl_tmp_dest; | |
| 4022 | cpustate->G.stat.irp = 1; | |
| 4023 | } | |
| 4024 | } | |
| 4025 | ||
| 4026 | ||
| 4027 | /* Execute [p]faddz fsrc1,fsrc2,fdest. */ | |
| 4028 | static void insn_faddz (i860s *cpustate, UINT32 insn) | |
| 4029 | { | |
| 4030 | UINT32 fsrc1 = get_fsrc1 (insn); | |
| 4031 | UINT32 fsrc2 = get_fsrc2 (insn); | |
| 4032 | UINT32 fdest = get_fdest (insn); | |
| 4033 | int piped = insn & 0x400; /* 1 = pipelined, 0 = scalar. */ | |
| 4034 | double dbl_tmp_dest = 0.0; | |
| 4035 | double v1 = get_fregval_d (cpustate, fsrc1); | |
| 4036 | double v2 = get_fregval_d (cpustate, fsrc2); | |
| 4037 | UINT64 iv1 = *(UINT64 *)&v1; | |
| 4038 | UINT64 iv2 = *(UINT64 *)&v2; | |
| 4039 | UINT64 r = 0; | |
| 4040 | ||
| 4041 | r = iv1 + iv2; | |
| 4042 | dbl_tmp_dest = *(double *)&r; | |
| 4043 | ||
| 4044 | /* Update the merge register depending on the pixel size. */ | |
| 4045 | cpustate->merge = ((cpustate->merge >> 16) & ~0xffff0000ffff0000ULL); | |
| 4046 | cpustate->merge |= (r & 0xffff0000ffff0000ULL); | |
| 4047 | ||
| 4048 | /* FIXME: Copy result-status bit IRP to fsr from last stage. */ | |
| 4049 | /* FIXME: Scalar version flows through all stages. */ | |
| 4050 | if (!piped) | |
| 4051 | { | |
| 4052 | /* Scalar version writes the current calculation to the fdest | |
| 4053 | register, always with double precision. */ | |
| 4054 | set_fregval_d (cpustate, fdest, dbl_tmp_dest); | |
| 4055 | } | |
| 4056 | else | |
| 4057 | { | |
| 4058 | /* Pipelined version writes fdest with the result from the last | |
| 4059 | stage of the pipeline, with precision specified by the IRP | |
| 4060 | bit of the stage's result-status bits. */ | |
| 4061 | if (cpustate->G.stat.irp) /* 1st (and last) stage. */ | |
| 4062 | set_fregval_d (cpustate, fdest, cpustate->G.val.d); | |
| 4063 | else | |
| 4064 | set_fregval_s (cpustate, fdest, cpustate->G.val.s); | |
| 4065 | ||
| 4066 | /* Now write current calculation to first and only stage. */ | |
| 4067 | cpustate->G.val.d = dbl_tmp_dest; | |
| 4068 | cpustate->G.stat.irp = 1; | |
| 4069 | } | |
| 4070 | } | |
| 4071 | ||
| 4072 | ||
| 4073 | /* Flags for the decode table. */ | |
| 4074 | enum { | |
| 4075 | DEC_MORE = 1, /* More decoding necessary. */ | |
| 4076 | DEC_DECODED = 2 /* Fully decoded, go. */ | |
| 4077 | }; | |
| 4078 | ||
| 4079 | ||
| 4080 | typedef struct { | |
| 4081 | /* Execute function for this opcode. */ | |
| 4082 | void (*insn_exec)(i860s *, UINT32); | |
| 4083 | ||
| 4084 | /* Flags for this opcode. */ | |
| 4085 | char flags; | |
| 4086 | } decode_tbl_t; | |
| 4087 | ||
| 4088 | ||
| 4089 | /* First-level decode table (i.e., for the 6 primary opcode bits). */ | |
| 4090 | static decode_tbl_t decode_tbl[64] = { | |
| 4091 | /* A slight bit of decoding for loads and stores is done in the | |
| 4092 | execution routines (operand size and addressing mode), which | |
| 4093 | is why their respective entries are identical. */ | |
| 4094 | { insn_ldx, DEC_DECODED}, /* ld.b isrc1(isrc2),idest. */ | |
| 4095 | { insn_ldx, DEC_DECODED}, /* ld.b #const(isrc2),idest. */ | |
| 4096 | { insn_ixfr, DEC_DECODED}, /* ixfr isrc1ni,fdest. */ | |
| 4097 | { insn_stx, DEC_DECODED}, /* st.b isrc1ni,#const(isrc2). */ | |
| 4098 | { insn_ldx, DEC_DECODED}, /* ld.{s,l} isrc1(isrc2),idest. */ | |
| 4099 | { insn_ldx, DEC_DECODED}, /* ld.{s,l} #const(isrc2),idest. */ | |
| 4100 | { 0, 0}, | |
| 4101 | { insn_stx, DEC_DECODED}, /* st.{s,l} isrc1ni,#const(isrc2),idest.*/ | |
| 4102 | { insn_fldy, DEC_DECODED}, /* fld.{l,d,q} isrc1(isrc2)[++],fdest. */ | |
| 4103 | { insn_fldy, DEC_DECODED}, /* fld.{l,d,q} #const(isrc2)[++],fdest. */ | |
| 4104 | { insn_fsty, DEC_DECODED}, /* fst.{l,d,q} fdest,isrc1(isrc2)[++] */ | |
| 4105 | { insn_fsty, DEC_DECODED}, /* fst.{l,d,q} fdest,#const(isrc2)[++] */ | |
| 4106 | { insn_ld_ctrl, DEC_DECODED}, /* ld.c csrc2,idest. */ | |
| 4107 | { insn_flush, DEC_DECODED}, /* flush #const(isrc2) (or autoinc). */ | |
| 4108 | { insn_st_ctrl, DEC_DECODED}, /* st.c isrc1,csrc2. */ | |
| 4109 | { insn_pstd, DEC_DECODED}, /* pst.d fdest,#const(isrc2)[++]. */ | |
| 4110 | { insn_bri, DEC_DECODED}, /* bri isrc1ni. */ | |
| 4111 | { insn_trap, DEC_DECODED}, /* trap isrc1ni,isrc2,idest. */ | |
| 4112 | { 0, DEC_MORE}, /* FP ESCAPE FORMAT, more decode. */ | |
| 4113 | { 0, DEC_MORE}, /* CORE ESCAPE FORMAT, more decode. */ | |
| 4114 | { insn_btne, DEC_DECODED}, /* btne isrc1,isrc2,sbroff. */ | |
| 4115 | { insn_btne_imm, DEC_DECODED}, /* btne #const,isrc2,sbroff. */ | |
| 4116 | { insn_bte, DEC_DECODED}, /* bte isrc1,isrc2,sbroff. */ | |
| 4117 | { insn_bte_imm, DEC_DECODED}, /* bte #const5,isrc2,idest. */ | |
| 4118 | { insn_fldy, DEC_DECODED}, /* pfld.{l,d,q} isrc1(isrc2)[++],fdest.*/ | |
| 4119 | { insn_fldy, DEC_DECODED}, /* pfld.{l,d,q} #const(isrc2)[++],fdest.*/ | |
| 4120 | { insn_br, DEC_DECODED}, /* br lbroff. */ | |
| 4121 | { insn_call, DEC_DECODED}, /* call lbroff . */ | |
| 4122 | { insn_bc, DEC_DECODED}, /* bc lbroff. */ | |
| 4123 | { insn_bct, DEC_DECODED}, /* bc.t lbroff. */ | |
| 4124 | { insn_bnc, DEC_DECODED}, /* bnc lbroff. */ | |
| 4125 | { insn_bnct, DEC_DECODED}, /* bnc.t lbroff. */ | |
| 4126 | { insn_addu, DEC_DECODED}, /* addu isrc1,isrc2,idest. */ | |
| 4127 | { insn_addu_imm, DEC_DECODED}, /* addu #const,isrc2,idest. */ | |
| 4128 | { insn_subu, DEC_DECODED}, /* subu isrc1,isrc2,idest. */ | |
| 4129 | { insn_subu_imm, DEC_DECODED}, /* subu #const,isrc2,idest. */ | |
| 4130 | { insn_adds, DEC_DECODED}, /* adds isrc1,isrc2,idest. */ | |
| 4131 | { insn_adds_imm, DEC_DECODED}, /* adds #const,isrc2,idest. */ | |
| 4132 | { insn_subs, DEC_DECODED}, /* subs isrc1,isrc2,idest. */ | |
| 4133 | { insn_subs_imm, DEC_DECODED}, /* subs #const,isrc2,idest. */ | |
| 4134 | { insn_shl, DEC_DECODED}, /* shl isrc1,isrc2,idest. */ | |
| 4135 | { insn_shl_imm, DEC_DECODED}, /* shl #const,isrc2,idest. */ | |
| 4136 | { insn_shr, DEC_DECODED}, /* shr isrc1,isrc2,idest. */ | |
| 4137 | { insn_shr_imm, DEC_DECODED}, /* shr #const,isrc2,idest. */ | |
| 4138 | { insn_shrd, DEC_DECODED}, /* shrd isrc1ni,isrc2,idest. */ | |
| 4139 | { insn_bla, DEC_DECODED}, /* bla isrc1ni,isrc2,sbroff. */ | |
| 4140 | { insn_shra, DEC_DECODED}, /* shra isrc1,isrc2,idest. */ | |
| 4141 | { insn_shra_imm, DEC_DECODED}, /* shra #const,isrc2,idest. */ | |
| 4142 | { insn_and, DEC_DECODED}, /* and isrc1,isrc2,idest. */ | |
| 4143 | { insn_and_imm, DEC_DECODED}, /* and #const,isrc2,idest. */ | |
| 4144 | { 0, 0}, | |
| 4145 | { insn_andh_imm, DEC_DECODED}, /* andh #const,isrc2,idest. */ | |
| 4146 | { insn_andnot, DEC_DECODED}, /* andnot isrc1,isrc2,idest. */ | |
| 4147 | { insn_andnot_imm, DEC_DECODED}, /* andnot #const,isrc2,idest. */ | |
| 4148 | { 0, 0}, | |
| 4149 | { insn_andnoth_imm, DEC_DECODED}, /* andnoth #const,isrc2,idest. */ | |
| 4150 | { insn_or, DEC_DECODED}, /* or isrc1,isrc2,idest. */ | |
| 4151 | { insn_or_imm, DEC_DECODED}, /* or #const,isrc2,idest. */ | |
| 4152 | { 0, 0}, | |
| 4153 | { insn_orh_imm, DEC_DECODED}, /* orh #const,isrc2,idest. */ | |
| 4154 | { insn_xor, DEC_DECODED}, /* xor isrc1,isrc2,idest. */ | |
| 4155 | { insn_xor_imm, DEC_DECODED}, /* xor #const,isrc2,idest. */ | |
| 4156 | { 0, 0}, | |
| 4157 | { insn_xorh_imm, DEC_DECODED}, /* xorh #const,isrc2,idest. */ | |
| 4158 | }; | |
| 4159 | ||
| 4160 | ||
| 4161 | /* Second-level decode table (i.e., for the 3 core escape opcode bits). */ | |
| 4162 | static decode_tbl_t core_esc_decode_tbl[8] = { | |
| 4163 | { 0, 0}, | |
| 4164 | { 0, 0}, /* lock (FIXME: unimplemented). */ | |
| 4165 | { insn_calli, DEC_DECODED}, /* calli isrc1ni. */ | |
| 4166 | { 0, 0}, | |
| 4167 | { insn_intovr, DEC_DECODED}, /* intovr. */ | |
| 4168 | { 0, 0}, | |
| 4169 | { 0, 0}, | |
| 4170 | { 0, 0}, /* unlock (FIXME: unimplemented). */ | |
| 4171 | }; | |
| 4172 | ||
| 4173 | ||
| 4174 | /* Second-level decode table (i.e., for the 7 FP extended opcode bits). */ | |
| 4175 | static decode_tbl_t fp_decode_tbl[128] = { | |
| 4176 | /* Floating point instructions. The least significant 7 bits are | |
| 4177 | the (extended) opcode and bits 10:7 are P,D,S,R respectively | |
| 4178 | ([p]ipelined, [d]ual, [s]ource prec., [r]esult prec.). | |
| 4179 | For some operations, I defer decoding the P,S,R bits to the | |
| 4180 | emulation routine for them. */ | |
| 4181 | { insn_dualop, DEC_DECODED}, /* 0x00 pf[m]am */ | |
| 4182 | { insn_dualop, DEC_DECODED}, /* 0x01 pf[m]am */ | |
| 4183 | { insn_dualop, DEC_DECODED}, /* 0x02 pf[m]am */ | |
| 4184 | { insn_dualop, DEC_DECODED}, /* 0x03 pf[m]am */ | |
| 4185 | { insn_dualop, DEC_DECODED}, /* 0x04 pf[m]am */ | |
| 4186 | { insn_dualop, DEC_DECODED}, /* 0x05 pf[m]am */ | |
| 4187 | { insn_dualop, DEC_DECODED}, /* 0x06 pf[m]am */ | |
| 4188 | { insn_dualop, DEC_DECODED}, /* 0x07 pf[m]am */ | |
| 4189 | { insn_dualop, DEC_DECODED}, /* 0x08 pf[m]am */ | |
| 4190 | { insn_dualop, DEC_DECODED}, /* 0x09 pf[m]am */ | |
| 4191 | { insn_dualop, DEC_DECODED}, /* 0x0A pf[m]am */ | |
| 4192 | { insn_dualop, DEC_DECODED}, /* 0x0B pf[m]am */ | |
| 4193 | { insn_dualop, DEC_DECODED}, /* 0x0C pf[m]am */ | |
| 4194 | { insn_dualop, DEC_DECODED}, /* 0x0D pf[m]am */ | |
| 4195 | { insn_dualop, DEC_DECODED}, /* 0x0E pf[m]am */ | |
| 4196 | { insn_dualop, DEC_DECODED}, /* 0x0F pf[m]am */ | |
| 4197 | { insn_dualop, DEC_DECODED}, /* 0x10 pf[m]sm */ | |
| 4198 | { insn_dualop, DEC_DECODED}, /* 0x11 pf[m]sm */ | |
| 4199 | { insn_dualop, DEC_DECODED}, /* 0x12 pf[m]sm */ | |
| 4200 | { insn_dualop, DEC_DECODED}, /* 0x13 pf[m]sm */ | |
| 4201 | { insn_dualop, DEC_DECODED}, /* 0x14 pf[m]sm */ | |
| 4202 | { insn_dualop, DEC_DECODED}, /* 0x15 pf[m]sm */ | |
| 4203 | { insn_dualop, DEC_DECODED}, /* 0x16 pf[m]sm */ | |
| 4204 | { insn_dualop, DEC_DECODED}, /* 0x17 pf[m]sm */ | |
| 4205 | { insn_dualop, DEC_DECODED}, /* 0x18 pf[m]sm */ | |
| 4206 | { insn_dualop, DEC_DECODED}, /* 0x19 pf[m]sm */ | |
| 4207 | { insn_dualop, DEC_DECODED}, /* 0x1A pf[m]sm */ | |
| 4208 | { insn_dualop, DEC_DECODED}, /* 0x1B pf[m]sm */ | |
| 4209 | { insn_dualop, DEC_DECODED}, /* 0x1C pf[m]sm */ | |
| 4210 | { insn_dualop, DEC_DECODED}, /* 0x1D pf[m]sm */ | |
| 4211 | { insn_dualop, DEC_DECODED}, /* 0x1E pf[m]sm */ | |
| 4212 | { insn_dualop, DEC_DECODED}, /* 0x1F pf[m]sm */ | |
| 4213 | { insn_fmul, DEC_DECODED}, /* 0x20 [p]fmul */ | |
| 4214 | { insn_fmlow, DEC_DECODED}, /* 0x21 fmlow.dd */ | |
| 4215 | { insn_frcp, DEC_DECODED}, /* 0x22 frcp.{ss,sd,dd} */ | |
| 4216 | { insn_frsqr, DEC_DECODED}, /* 0x23 frsqr.{ss,sd,dd} */ | |
| 4217 | { insn_fmul, DEC_DECODED}, /* 0x24 pfmul3.dd */ | |
| 4218 | { 0, 0}, /* 0x25 */ | |
| 4219 | { 0, 0}, /* 0x26 */ | |
| 4220 | { 0, 0}, /* 0x27 */ | |
| 4221 | { 0, 0}, /* 0x28 */ | |
| 4222 | { 0, 0}, /* 0x29 */ | |
| 4223 | { 0, 0}, /* 0x2A */ | |
| 4224 | { 0, 0}, /* 0x2B */ | |
| 4225 | { 0, 0}, /* 0x2C */ | |
| 4226 | { 0, 0}, /* 0x2D */ | |
| 4227 | { 0, 0}, /* 0x2E */ | |
| 4228 | { 0, 0}, /* 0x2F */ | |
| 4229 | { insn_fadd_sub, DEC_DECODED}, /* 0x30, [p]fadd.{ss,sd,dd} */ | |
| 4230 | { insn_fadd_sub, DEC_DECODED}, /* 0x31, [p]fsub.{ss,sd,dd} */ | |
| 4231 | { 0, 0}, /* 0x32, [p]fix.{ss,sd,dd} FIXME: nyi. */ | |
| 4232 | { insn_famov, DEC_DECODED}, /* 0x33, [p]famov.{ss,sd,ds,dd} */ | |
| 4233 | { insn_fcmp, DEC_DECODED}, /* 0x34, pf{gt,le}.{ss,dd} */ | |
| 4234 | { insn_fcmp, DEC_DECODED}, /* 0x35, pfeq.{ss,dd} */ | |
| 4235 | { 0, 0}, /* 0x36 */ | |
| 4236 | { 0, 0}, /* 0x37 */ | |
| 4237 | { 0, 0}, /* 0x38 */ | |
| 4238 | { 0, 0}, /* 0x39 */ | |
| 4239 | { insn_ftrunc, DEC_DECODED}, /* 0x3A, [p]ftrunc.{ss,sd,dd} */ | |
| 4240 | { 0, 0}, /* 0x3B */ | |
| 4241 | { 0, 0}, /* 0x3C */ | |
| 4242 | { 0, 0}, /* 0x3D */ | |
| 4243 | { 0, 0}, /* 0x3E */ | |
| 4244 | { 0, 0}, /* 0x3F */ | |
| 4245 | { insn_fxfr, DEC_DECODED}, /* 0x40, fxfr */ | |
| 4246 | { 0, 0}, /* 0x41 */ | |
| 4247 | { 0, 0}, /* 0x42 */ | |
| 4248 | { 0, 0}, /* 0x43 */ | |
| 4249 | { 0, 0}, /* 0x44 */ | |
| 4250 | { 0, 0}, /* 0x45 */ | |
| 4251 | { 0, 0}, /* 0x46 */ | |
| 4252 | { 0, 0}, /* 0x47 */ | |
| 4253 | { 0, 0}, /* 0x48 */ | |
| 4254 | { insn_fiadd_sub, DEC_DECODED}, /* 0x49, [p]fiadd.{ss,dd} */ | |
| 4255 | { 0, 0}, /* 0x4A */ | |
| 4256 | { 0, 0}, /* 0x4B */ | |
| 4257 | { 0, 0}, /* 0x4C */ | |
| 4258 | { insn_fiadd_sub, DEC_DECODED}, /* 0x4D, [p]fisub.{ss,dd} */ | |
| 4259 | { 0, 0}, /* 0x4E */ | |
| 4260 | { 0, 0}, /* 0x4F */ | |
| 4261 | { insn_faddp, DEC_DECODED}, /* 0x50, [p]faddp */ | |
| 4262 | { insn_faddz, DEC_DECODED}, /* 0x51, [p]faddz */ | |
| 4263 | { 0, 0}, /* 0x52 */ | |
| 4264 | { 0, 0}, /* 0x53 */ | |
| 4265 | { 0, 0}, /* 0x54 */ | |
| 4266 | { 0, 0}, /* 0x55 */ | |
| 4267 | { 0, 0}, /* 0x56 */ | |
| 4268 | { insn_fzchk, DEC_DECODED}, /* 0x57, [p]fzchkl */ | |
| 4269 | { 0, 0}, /* 0x58 */ | |
| 4270 | { 0, 0}, /* 0x59 */ | |
| 4271 | { insn_form, DEC_DECODED}, /* 0x5A, [p]form.dd */ | |
| 4272 | { 0, 0}, /* 0x5B */ | |
| 4273 | { 0, 0}, /* 0x5C */ | |
| 4274 | { 0, 0}, /* 0x5D */ | |
| 4275 | { 0, 0}, /* 0x5E */ | |
| 4276 | { insn_fzchk, DEC_DECODED}, /* 0x5F, [p]fzchks */ | |
| 4277 | { 0, 0}, /* 0x60 */ | |
| 4278 | { 0, 0}, /* 0x61 */ | |
| 4279 | { 0, 0}, /* 0x62 */ | |
| 4280 | { 0, 0}, /* 0x63 */ | |
| 4281 | { 0, 0}, /* 0x64 */ | |
| 4282 | { 0, 0}, /* 0x65 */ | |
| 4283 | { 0, 0}, /* 0x66 */ | |
| 4284 | { 0, 0}, /* 0x67 */ | |
| 4285 | { 0, 0}, /* 0x68 */ | |
| 4286 | { 0, 0}, /* 0x69 */ | |
| 4287 | { 0, 0}, /* 0x6A */ | |
| 4288 | { 0, 0}, /* 0x6B */ | |
| 4289 | { 0, 0}, /* 0x6C */ | |
| 4290 | { 0, 0}, /* 0x6D */ | |
| 4291 | { 0, 0}, /* 0x6E */ | |
| 4292 | { 0, 0}, /* 0x6F */ | |
| 4293 | { 0, 0}, /* 0x70 */ | |
| 4294 | { 0, 0}, /* 0x71 */ | |
| 4295 | { 0, 0}, /* 0x72 */ | |
| 4296 | { 0, 0}, /* 0x73 */ | |
| 4297 | { 0, 0}, /* 0x74 */ | |
| 4298 | { 0, 0}, /* 0x75 */ | |
| 4299 | { 0, 0}, /* 0x76 */ | |
| 4300 | { 0, 0}, /* 0x77 */ | |
| 4301 | { 0, 0}, /* 0x78 */ | |
| 4302 | { 0, 0}, /* 0x79 */ | |
| 4303 | { 0, 0}, /* 0x7A */ | |
| 4304 | { 0, 0}, /* 0x7B */ | |
| 4305 | { 0, 0}, /* 0x7C */ | |
| 4306 | { 0, 0}, /* 0x7D */ | |
| 4307 | { 0, 0}, /* 0x7E */ | |
| 4308 | { 0, 0}, /* 0x7F */ | |
| 4309 | }; | |
| 4310 | ||
| 4311 | ||
| 4312 | /* | |
| 4313 | * Main decoder driver. | |
| 4314 | * insn = instruction at the current PC to execute. | |
| 4315 | * non_shadow = This insn is not in the shadow of a delayed branch). | |
| 4316 | */ | |
| 4317 | static void decode_exec (i860s *cpustate, UINT32 insn, UINT32 non_shadow) | |
| 4318 | { | |
| 4319 | int upper_6bits = (insn >> 26) & 0x3f; | |
| 4320 | char flags = 0; | |
| 4321 | int unrecognized = 1; | |
| 4322 | ||
| 4323 | if (cpustate->exiting_ifetch) | |
| 4324 | return; | |
| 4325 | ||
| 4326 | if ((upper_6bits == 0x12 || upper_6bits == 0x2c) && insn & 0x0200) | |
| 4327 | logerror("D-bit seen.\n"); | |
| 4328 | if (GET_EPSR_BE ()) | |
| 4329 | logerror("BE-bit high.\n"); | |
| 4330 | if (GET_DIRBASE_CS8 ()) | |
| 4331 | logerror("CS8-bit high.\n"); | |
| 4332 | ||
| 4333 | flags = decode_tbl[upper_6bits].flags; | |
| 4334 | if (flags & DEC_DECODED) | |
| 4335 | { | |
| 4336 | decode_tbl[upper_6bits].insn_exec (cpustate, insn); | |
| 4337 | unrecognized = 0; | |
| 4338 | } | |
| 4339 | else if (flags & DEC_MORE) | |
| 4340 | { | |
| 4341 | if (upper_6bits == 0x12) | |
| 4342 | { | |
| 4343 | /* FP instruction format handled here. */ | |
| 4344 | char fp_flags = fp_decode_tbl[insn & 0x7f].flags; | |
| 4345 | if (fp_flags & DEC_DECODED) | |
| 4346 | { | |
| 4347 | fp_decode_tbl[insn & 0x7f].insn_exec (cpustate, insn); | |
| 4348 | unrecognized = 0; | |
| 4349 | } | |
| 4350 | } | |
| 4351 | else if (upper_6bits == 0x13) | |
| 4352 | { | |
| 4353 | /* Core escape instruction format handled here. */ | |
| 4354 | char esc_flags = core_esc_decode_tbl[insn & 0x3].flags; | |
| 4355 | if (esc_flags & DEC_DECODED) | |
| 4356 | { | |
| 4357 | core_esc_decode_tbl[insn & 0x3].insn_exec (cpustate, insn); | |
| 4358 | unrecognized = 0; | |
| 4359 | } | |
| 4360 | } | |
| 4361 | } | |
| 4362 | ||
| 4363 | if (unrecognized) | |
| 4364 | unrecog_opcode (cpustate->pc, insn); | |
| 4365 | ||
| 4366 | /* For now, just treat every instruction as taking the same number of | |
| 4367 | clocks-- a major oversimplification. */ | |
| 4368 | cpustate->icount -= 9; | |
| 4369 | } | |
| 4370 | ||
| 4371 | ||
| 4372 | /* Set-up all the default power-on/reset values. */ | |
| 4373 | void reset_i860 (i860s *cpustate) | |
| 4374 | { | |
| 4375 | int i; | |
| 4376 | /* On power-up/reset, i860 has values: | |
| 4377 | PC = 0xffffff00. | |
| 4378 | Integer registers: r0 = 0, others = undefined. | |
| 4379 | FP registers: f0:f1 = 0, others undefined. | |
| 4380 | psr: U = IM = BR = BW = 0; others = undefined. | |
| 4381 | epsr: IL = WP = PBM = BE = 0; processor type, stepping, and | |
| 4382 | DCS are proper and read-only; others = undefined. | |
| 4383 | db: undefined. | |
| 4384 | dirbase: DPS, BL, ATE = 0 | |
| 4385 | fir, fsr, KR, KI, MERGE: undefined. (what about T?) | |
| 4386 | ||
| 4387 | I$: flushed. | |
| 4388 | D$: undefined (all modified bits = 0). | |
| 4389 | TLB: flushed. | |
| 4390 | ||
| 4391 | Note that any undefined values are set to 0x55aa55aa patterns to | |
| 4392 | try to detect defective i860 software. */ | |
| 4393 | ||
| 4394 | /* PC is at trap address after reset. */ | |
| 4395 | cpustate->pc = 0xffffff00; | |
| 4396 | ||
| 4397 | /* Set grs and frs to undefined/nonsense values, except r0. */ | |
| 4398 | for (i = 0; i < 32; i++) | |
| 4399 | { | |
| 4400 | set_iregval (i, 0x55aa55aa); | |
| 4401 | set_fregval_s (cpustate, i, 0.0); | |
| 4402 | } | |
| 4403 | set_iregval (0, 0); | |
| 4404 | set_fregval_s (cpustate, 0, 0.0); | |
| 4405 | set_fregval_s (cpustate, 1, 0.0); | |
| 4406 | ||
| 4407 | /* Set whole psr to 0. This sets the proper bits to 0 as specified | |
| 4408 | above, and zeroes the undefined bits. */ | |
| 4409 | cpustate->cregs[CR_PSR] = 0; | |
| 4410 | ||
| 4411 | /* Set most of the epsr bits to 0 (as specified above), leaving | |
| 4412 | undefined as zero as well. Then properly set processor type, | |
| 4413 | step, and DCS. Type = EPSR[7..0], step = EPSR[12..8], | |
| 4414 | DCS = EPSR[21..18] (2^[12+dcs] = cache size). | |
| 4415 | We'll pretend to be stepping D0, since it has the fewest bugs | |
| 4416 | (and I don't want to emulate the many defects in the earlier | |
| 4417 | steppings). | |
| 4418 | Proc type: 1 = XR, 2 = XP (XR has 8KB data cache -> DCS = 1). | |
| 4419 | Steppings (XR): 3,4,5,6,7 = (B2, C0, B3, C1, D0 respectively). | |
| 4420 | Steppings (XP): 0, 2, 3, 4 = (A0, B0, B1, B2) (any others?). */ | |
| 4421 | cpustate->cregs[CR_EPSR] = 0x00040701; | |
| 4422 | ||
| 4423 | /* Set DPS, BL, ATE = 0 and the undefined parts also to 0. */ | |
| 4424 | cpustate->cregs[CR_DIRBASE] = 0x00000000; | |
| 4425 | ||
| 4426 | /* Set fir, fsr, KR, KI, MERGE, T to undefined. */ | |
| 4427 | cpustate->cregs[CR_FIR] = 0xaa55aa55; | |
| 4428 | cpustate->cregs[CR_FSR] = /* 0xaa55aa55; */ 0; | |
| 4429 | cpustate->KR.d = 0.0; | |
| 4430 | cpustate->KI.d = 0.0; | |
| 4431 | cpustate->T.d = 0.0; | |
| 4432 | cpustate->merge = 0xaa55aa55; | |
| 4433 | ||
| 4434 | cpustate->fir_gets_trap_addr = 0; | |
| 4435 | } | |
| 4436 | ||
| 4437 | ||
| 4438 | ||
| 4439 | ||
| 4440 | /*=================================================================*/ | |
| 4441 | /* MAME execution hook for i860 emulator. */ | |
| 4442 | /*=================================================================*/ | |
| 4443 | ||
| 4444 | #include "cpuintrf.h" | |
| 4445 | ||
| 4446 | static CPU_EXECUTE( i860 ) | |
| 4447 | { | |
| 4448 | i860_state_t *cpustate = device->token; | |
| 4449 | ||
| 4450 | /* Check if the data bus is held by another device, and bail if so. | |
| 4451 | Also check for reset. */ | |
| 4452 | if (cpustate->pin_reset) | |
| 4453 | reset_i860 (cpustate); | |
| 4454 | if (cpustate->pin_bus_hold) | |
| 4455 | return cycles; | |
| 4456 | ||
| 4457 | cpustate->exiting_readmem = 0; | |
| 4458 | cpustate->exiting_ifetch = 0; | |
| 4459 | cpustate->icount = cycles; | |
| 4460 | ||
| 4461 | /* Decode and execute loop. */ | |
| 4462 | while (cpustate->icount > 0) | |
| 4463 | { | |
| 4464 | UINT32 savepc = cpustate->pc; | |
| 4465 | cpustate->pc_updated = 0; | |
| 4466 | cpustate->pending_trap = 0; | |
| 4467 | ||
| 4468 | #if 1 /* Delete me soon, for debugging VC inter-processor synch. */ | |
| 4469 | if (cpustate->pc == 0xfffc0370 || | |
| 4470 | cpustate->pc == 0xfffc03a4) | |
| 4471 | { | |
| 4472 | fprintf(stderr, "(%s) 0x%08x: snag 0x20000000\n", cpustate->device->tag, cpustate->pc); | |
| 4473 | cpustate->single_stepping = 0; | |
| 4474 | } | |
| 4475 | else if (cpustate->pc == 0xfffc0384 || | |
| 4476 | cpustate->pc == 0xfffc03b8) | |
| 4477 | { | |
| 4478 | fprintf(stderr, "(%s) 0x%08x: passed 0x20000000\n", cpustate->device->tag, cpustate->pc); | |
| 4479 | cpustate->single_stepping = 0; | |
| 4480 | } | |
| 4481 | #endif | |
| 4482 | ||
| 4483 | savepc = cpustate->pc; | |
| 4484 | debugger_instruction_hook(cpustate->device, cpustate->pc); | |
| 4485 | decode_exec (cpustate, ifetch (cpustate, cpustate->pc), 1); | |
| 4486 | ||
| 4487 | cpustate->exiting_ifetch = 0; | |
| 4488 | cpustate->exiting_readmem = 0; | |
| 4489 | ||
| 4490 | if (cpustate->pending_trap) | |
| 4491 | { | |
| 4492 | /* If we need to trap, change PC to trap address. | |
| 4493 | Also set supervisor mode, copy U and IM to their | |
| 4494 | previous versions, clear IM. */ | |
| 4495 | if ((cpustate->pending_trap & TRAP_WAS_EXTERNAL) || (GET_EPSR_INT () && GET_PSR_IN ())) | |
| 4496 | { | |
| 4497 | if (!cpustate->pc_updated) | |
| 4498 | cpustate->cregs[CR_FIR] = savepc + 4; | |
| 4499 | else | |
| 4500 | cpustate->cregs[CR_FIR] = cpustate->pc; | |
| 4501 | } | |
| 4502 | else if (cpustate->pending_trap & TRAP_IN_DELAY_SLOT) | |
| 4503 | { | |
| 4504 | cpustate->cregs[CR_FIR] = savepc + 4; | |
| 4505 | } | |
| 4506 | else | |
| 4507 | cpustate->cregs[CR_FIR] = savepc; | |
| 4508 | ||
| 4509 | cpustate->fir_gets_trap_addr = 1; | |
| 4510 | SET_PSR_PU (GET_PSR_U ()); | |
| 4511 | SET_PSR_PIM (GET_PSR_IM ()); | |
| 4512 | SET_PSR_U (0); | |
| 4513 | SET_PSR_IM (0); | |
| 4514 | SET_PSR_DIM (0); | |
| 4515 | SET_PSR_DS (0); | |
| 4516 | cpustate->pc = 0xffffff00; | |
| 4517 | cpustate->pending_trap = 0; | |
| 4518 | } | |
| 4519 | else if (!cpustate->pc_updated) | |
| 4520 | { | |
| 4521 | /* If the PC wasn't updated by a control flow instruction, just | |
| 4522 | bump to next sequential instruction. */ | |
| 4523 | cpustate->pc += 4; | |
| 4524 | } | |
| 4525 | ||
| 4526 | /*if (cpustate->single_stepping) | |
| 4527 | debugger (cpustate); */ | |
| 4528 | } | |
| 4529 | ||
| 4530 | return cycles - cpustate->icount; | |
| 4531 | } | |
| 4532 | /*=================================================================*/ | |
| 4533 | ||
| 4534 | ||
| 4535 | ||
| 4536 | ||
| 4537 | #if 0 | |
| 4538 | /*=================================================================*/ | |
| 4539 | /* Internal debugger-related stuff. */ | |
| 4540 | ||
| 4541 | extern unsigned disasm_i860 (char *buf, unsigned int pc, unsigned int insn); | |
| 4542 | ||
| 4543 | ||
| 4544 | /* Disassemble `len' instructions starting at `addr'. */ | |
| 4545 | static void disasm (i860s *cpustate, UINT32 addr, int len) | |
| 4546 | { | |
| 4547 | UINT32 insn; | |
| 4548 | int j; | |
| 4549 | for (j = 0; j < len; j++) | |
| 4550 | { | |
| 4551 | char buf[256]; | |
| 4552 | UINT32 phys_addr = addr; | |
| 4553 | if (GET_DIRBASE_ATE ()) | |
| 4554 | phys_addr = get_address_translation (cpustate, addr, 1 /* is_dataref */, 0 /* is_write */); | |
| 4555 | ||
| 4556 | /* Note that we print the incoming (possibly virtual) address as the | |
| 4557 | PC rather than the translated address. */ | |
| 4558 | fprintf (stderr, " (%s) 0x%08x: ", cpustate->device->tag, addr); | |
| 4559 | insn = memory_read_dword_64le(cpustate->program, phys_addr); | |
| 4560 | #ifdef HOST_MSB | |
| 4561 | BYTE_REV32 (insn); | |
| 4562 | #endif /* HOST_MSB. */ | |
| 4563 | disasm_i860 (buf, addr, insn); fprintf (stderr, "%s", buf); | |
| 4564 | fprintf (stderr, "\n"); | |
| 4565 | addr += 4; | |
| 4566 | #if 1 | |
| 4567 | if (cpustate->single_stepping == 1 && has_delay_slot (insn)) | |
| 4568 | len += 1; | |
| 4569 | #endif | |
| 4570 | } | |
| 4571 | } | |
| 4572 | ||
| 4573 | ||
| 4574 | /* Dump `len' bytes starting at `addr'. */ | |
| 4575 | static void dbg_db (i860s *cpustate, UINT32 addr, int len) | |
| 4576 | { | |
| 4577 | UINT8 b[16]; | |
| 4578 | int i; | |
| 4579 | /* This will always dump a multiple of 16 bytes, even if 'len' isn't. */ | |
| 4580 | while (len > 0) | |
| 4581 | { | |
| 4582 | /* Note that we print the incoming (possibly virtual) address | |
| 4583 | rather than the translated address. */ | |
| 4584 | fprintf (stderr, "0x%08x: ", addr); | |
| 4585 | for (i = 0; i < 16; i++) | |
| 4586 | { | |
| 4587 | UINT32 phys_addr = addr; | |
| 4588 | if (GET_DIRBASE_ATE ()) | |
| 4589 | phys_addr = get_address_translation (cpustate, addr, 1 /* is_dataref */, 0 /* is_write */); | |
| 4590 | ||
| 4591 | b[i] = memory_read_byte_64le(cpustate->program, phys_addr); | |
| 4592 | fprintf (stderr, "%02x ", b[i]); | |
| 4593 | addr++; | |
| 4594 | } | |
| 4595 | fprintf (stderr, "| "); | |
| 4596 | for (i = 0; i < 16; i++) | |
| 4597 | { | |
| 4598 | if (isprint (b[i])) | |
| 4599 | fprintf (stderr, "%c", b[i]); | |
| 4600 | else | |
| 4601 | fprintf (stderr, "."); | |
| 4602 | } | |
| 4603 | fprintf (stderr, "\n"); | |
| 4604 | len -= 16; | |
| 4605 | } | |
| 4606 | } | |
| 4607 | ||
| 4608 | ||
| 4609 | /* A simple internal debugger. */ | |
| 4610 | void debugger (i860s *cpustate) | |
| 4611 | { | |
| 4612 | char buf[256]; | |
| 4613 | UINT32 curr_disasm = cpustate->pc; | |
| 4614 | UINT32 curr_dumpdb = 0; | |
| 4615 | int c = 0; | |
| 4616 | ||
| 4617 | if (cpustate->single_stepping > 1 && cpustate->single_stepping != cpustate->pc) | |
| 4618 | return; | |
| 4619 | ||
| 4620 | buf[0] = 0; | |
| 4621 | ||
| 4622 | /* Always disassemble the upcoming instruction when single-stepping. */ | |
| 4623 | if (cpustate->single_stepping) | |
| 4624 | { | |
| 4625 | disasm (cpustate, cpustate->pc, 1); | |
| 4626 | if (has_delay_slot (2)) | |
| 4627 | disasm (cpustate, cpustate->pc + 4, 1); | |
| 4628 | } | |
| 4629 | else | |
| 4630 | fprintf (stderr, "\nEmulator: internal debugger started (? for help).\n"); | |
| 4631 | ||
| 4632 | fflush (stdin); | |
| 4633 | ||
| 4634 | cpustate->single_stepping = 0; | |
| 4635 | while (!cpustate->single_stepping) | |
| 4636 | { | |
| 4637 | fprintf (stderr, "- "); | |
| 4638 | #if 0 /* Doesn't work on MacOSX BSD flavor. */ | |
| 4639 | fscanf (stdin, "%s", buf); | |
| 4640 | #else | |
| 4641 | while (1) | |
| 4642 | { | |
| 4643 | char it = 0; | |
| 4644 | if (read(STDIN_FILENO, &it, 1) == 1) | |
| 4645 | { | |
| 4646 | if (it == '\n') | |
| 4647 | { | |
| 4648 | buf[c] = 0; | |
| 4649 | c = 0; | |
| 4650 | break; | |
| 4651 | } | |
| 4652 | buf[c++] = it; | |
| 4653 | } | |
| 4654 | } | |
| 4655 | #endif | |
| 4656 | if (buf[0] == 'g') | |
| 4657 | { | |
| 4658 | if (buf[1] == '0') | |
| 4659 | sscanf (buf + 1, "%x", &cpustate->single_stepping); | |
| 4660 | else | |
| 4661 | break; | |
| 4662 | buf[1] = 0; | |
| 4663 | fprintf (stderr, "go until pc = 0x%08x.\n", | |
| 4664 | cpustate->single_stepping); | |
| 4665 | cpustate->single_stepping = 0; /* HACK */ | |
| 4666 | } | |
| 4667 | else if (buf[0] == 'r') | |
| 4668 | dump_state (cpustate); | |
| 4669 | else if (buf[0] == 'u') | |
| 4670 | { | |
| 4671 | if (buf[1] == '0') | |
| 4672 | sscanf (buf + 1, "%x", &curr_disasm); | |
| 4673 | disasm (cpustate, curr_disasm, 10); | |
| 4674 | curr_disasm += 10 * 4; | |
| 4675 | buf[1] = 0; | |
| 4676 | } | |
| 4677 | else if (buf[0] == 'p') | |
| 4678 | { | |
| 4679 | if (buf[1] >= '0' && buf[1] <= '4') | |
| 4680 | dump_pipe (cpustate, buf[1] - 0x30); | |
| 4681 | buf[1] = 0; | |
| 4682 | } | |
| 4683 | else if (buf[0] == 's') | |
| 4684 | cpustate->single_stepping = 1; | |
| 4685 | else if (buf[0] == 'l') | |
| 4686 | ; //cpustate->pc = elf_load(buf + 1); | |
| 4687 | else if (buf[0] == 'd' && buf[1] == 'b') | |
| 4688 | { | |
| 4689 | if (buf[2] == '0') | |
| 4690 | sscanf (buf + 2, "%x", &curr_dumpdb); | |
| 4691 | dbg_db (cpustate, curr_dumpdb, 32); | |
| 4692 | curr_dumpdb += 32; | |
| 4693 | } | |
| 4694 | else if (buf[0] == 'x' && buf[1] == '0') | |
| 4695 | { | |
| 4696 | UINT32 v; | |
| 4697 | sscanf (buf + 1, "%x", &v); | |
| 4698 | if (GET_DIRBASE_ATE ()) | |
| 4699 | fprintf (stderr, "vma 0x%08x ==> phys 0x%08x\n", v, | |
| 4700 | get_address_translation (cpustate, v, 1, 0)); | |
| 4701 | else | |
| 4702 | fprintf (stderr, "not in virtual address mode.\n"); | |
| 4703 | } | |
| 4704 | else if (buf[0] == 'B') | |
| 4705 | { | |
| 4706 | ;//cpustate->pc = elf_load("bins/bsd"); | |
| 4707 | break; | |
| 4708 | } | |
| 4709 | else if (buf[0] == '?') | |
| 4710 | { | |
| 4711 | fprintf (stderr, " db: dump bytes (db[0xaddress])\n r: dump registers\n s: single-step\n g: go back to emulator (g[0xaddress])\n u: disassemble (u[0xaddress])\n p: dump pipelines (p{0-4} for all, add, mul, load, graphics)\n l: load an ELF binary (lpath)\n x: give virt->phys translation (x{0xaddress})\n"); | |
| 4712 | } | |
| 4713 | else | |
| 4714 | fprintf (stderr, "Bad command '%s'.\n", buf); | |
| 4715 | } | |
| 4716 | ||
| 4717 | /* Less noise when single-stepping. */ | |
| 4718 | if (cpustate->single_stepping != 1) | |
| 4719 | fprintf (stderr, "Debugger done, continuing emulation.\n"); | |
| 4720 | } | |
| 4721 | ||
| 4722 | #endif |
| r4135 | r4136 | |
|---|---|---|
| 1 | #include "debugger.h" | |
| 2 | #include "i860.h" | |
| 1 | /*************************************************************************** | |
| 3 | 2 | |
| 4 | /************************************************************************** | |
| 5 | * The core struct | |
| 6 | **************************************************************************/ | |
| 7 | typedef struct _i860_state_t i860_state_t; | |
| 8 | struct _i860_state_t | |
| 9 | { | |
| 10 | const device_config *device; | |
| 11 | const address_space *program; | |
| 3 | i860.c | |
| 12 | 4 | |
| 13 | UINT32 pc; | |
| 14 | UINT32 ppc; | |
| 5 | Interface file for the Intel i860 emulator. | |
| 15 | 6 | |
| 16 | int icount; | |
| 17 | }; | |
| 7 | Copyright (C) 1995-present Jason Eckhardt (jle@rice.edu) | |
| 8 | Released for general non-commercial use under the MAME license | |
| 9 | with the additional requirement that you are free to use and | |
| 10 | redistribute this code in modified or unmodified form, provided | |
| 11 | you list me in the credits. | |
| 12 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 18 | 13 | |
| 14 | ***************************************************************************/ | |
| 19 | 15 | |
| 16 | /* | |
| 17 | TODO: Separate out i860XR and i860XP (make different types, etc). | |
| 18 | Hook IRQ lines into MAME core (they're custom functions atm). | |
| 19 | */ | |
| 20 | ||
| 21 | #include "debugger.h" | |
| 22 | #include "i860.h" | |
| 23 | ||
| 20 | 24 | /************************************************************************** |
| 21 | 25 | * Functions specified by GET_INFO |
| 22 | 26 | **************************************************************************/ |
| 23 | 27 | |
| 24 | 28 | static CPU_INIT( i860 ) |
| 25 | 29 | { |
| 26 | i860_state_t *i860 = device->token; | |
| 27 | i860->device = device; | |
| 28 | i860->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); | |
| 30 | i860_state_t *cpustate = device->token; | |
| 31 | cpustate->device = device; | |
| 32 | cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); | |
| 33 | reset_i860(cpustate); | |
| 34 | i860_set_pin(cpustate, DEC_PIN_BUS_HOLD, 0); | |
| 35 | i860_set_pin(cpustate, DEC_PIN_RESET, 0); | |
| 36 | cpustate->single_stepping = 0; | |
| 37 | ||
| 38 | state_save_register_device_item_array(device, 0, cpustate->iregs); | |
| 39 | state_save_register_device_item_array(device, 0, cpustate->cregs); | |
| 40 | state_save_register_device_item_array(device, 0, cpustate->frg); | |
| 41 | state_save_register_device_item(device, 0, cpustate->pc); | |
| 29 | 42 | } |
| 30 | 43 | |
| 31 | 44 | static CPU_RESET( i860 ) |
| 32 | 45 | { |
| 33 | logerror("i860 reset\n"); | |
| 46 | i860_state_t *cpustate = device->token; | |
| 47 | reset_i860(cpustate); | |
| 34 | 48 | } |
| 35 | 49 | |
| 36 | static CPU_EXECUTE( i860 ) | |
| 50 | ||
| 51 | /*************************************************************************** | |
| 52 | * Disassembler hook | |
| 53 | ***************************************************************************/ | |
| 54 | ||
| 55 | static CPU_DISASSEMBLE( i860 ) | |
| 37 | 56 | { |
| 38 | /* Just a disassembler ATM */ | |
| 39 | return cycles; | |
| 57 | extern unsigned disasm_i860(char*, unsigned, UINT32); | |
| 58 | ||
| 59 | /* Hard-coded little endian for now. */ | |
| 60 | return disasm_i860(buffer, pc, (oprom[0] << 0) | | |
| 61 | (oprom[1] << 8) | | |
| 62 | (oprom[2] << 16) | | |
| 63 | (oprom[3] << 24)); | |
| 40 | 64 | } |
| 41 | 65 | |
| 42 | extern CPU_DISASSEMBLE( i860 ); | |
| 43 | 66 | |
| 67 | /************************************************************************** | |
| 68 | * The actual decode and execute code. | |
| 69 | **************************************************************************/ | |
| 70 | #include "i860dec.c" | |
| 44 | 71 | |
| 72 | ||
| 45 | 73 | /************************************************************************** |
| 46 | 74 | * Generic set_info/get_info |
| 47 | 75 | **************************************************************************/ |
| 76 | ||
| 77 | #define CPU_SET_INFO_F(fnum) cpustate->frg[0+(4*fnum)] = (info->i & 0x000000ff); \ | |
| 78 | cpustate->frg[1+(4*fnum)] = (info->i & 0x0000ff00) >> 8; \ | |
| 79 | cpustate->frg[2+(4*fnum)] = (info->i & 0x00ff0000) >> 16; \ | |
| 80 | cpustate->frg[3+(4*fnum)] = (info->i & 0xff000000) >> 24; | |
| 81 | ||
| 48 | 82 | static CPU_SET_INFO( i860 ) |
| 49 | 83 | { |
| 50 | i860_state_t * | |
| 84 | i860_state_t *cpustate = device->token; | |
| 51 | 85 | |
| 52 | 86 | switch(state) |
| 53 | 87 | { |
| 54 | /* Interfacing */ | |
| 55 | 88 | case CPUINFO_INT_PC: |
| 56 | case CPUINFO_INT_REGISTER + I860_PC: i860->pc = info->i & 0xffffffff; break; | |
| 89 | case CPUINFO_INT_REGISTER + I860_PC: cpustate->pc = info->i & 0xffffffff; break; | |
| 90 | ||
| 91 | case CPUINFO_INT_REGISTER + I860_FIR: cpustate->cregs[CR_FIR] = info->i & 0xffffffff; break; | |
| 92 | case CPUINFO_INT_REGISTER + I860_PSR: cpustate->cregs[CR_PSR] = info->i & 0xffffffff; break; | |
| 93 | case CPUINFO_INT_REGISTER + I860_DIRBASE: cpustate->cregs[CR_DIRBASE] = info->i & 0xffffffff; break; | |
| 94 | case CPUINFO_INT_REGISTER + I860_DB: cpustate->cregs[CR_DB] = info->i & 0xffffffff; break; | |
| 95 | case CPUINFO_INT_REGISTER + I860_FSR: cpustate->cregs[CR_FSR] = info->i & 0xffffffff; break; | |
| 96 | case CPUINFO_INT_REGISTER + I860_EPSR: cpustate->cregs[CR_EPSR] = info->i & 0xffffffff; break; | |
| 97 | ||
| 98 | case CPUINFO_INT_REGISTER + I860_R0: cpustate->iregs[0] = info->i & 0xffffffff; break; | |
| 99 | case CPUINFO_INT_REGISTER + I860_R1: cpustate->iregs[1] = info->i & 0xffffffff; break; | |
| 100 | case CPUINFO_INT_REGISTER + I860_R2: cpustate->iregs[2] = info->i & 0xffffffff; break; | |
| 101 | case CPUINFO_INT_REGISTER + I860_R3: cpustate->iregs[3] = info->i & 0xffffffff; break; | |
| 102 | case CPUINFO_INT_REGISTER + I860_R4: cpustate->iregs[4] = info->i & 0xffffffff; break; | |
| 103 | case CPUINFO_INT_REGISTER + I860_R5: cpustate->iregs[5] = info->i & 0xffffffff; break; | |
| 104 | case CPUINFO_INT_REGISTER + I860_R6: cpustate->iregs[6] = info->i & 0xffffffff; break; | |
| 105 | case CPUINFO_INT_REGISTER + I860_R7: cpustate->iregs[7] = info->i & 0xffffffff; break; | |
| 106 | case CPUINFO_INT_REGISTER + I860_R8: cpustate->iregs[8] = info->i & 0xffffffff; break; | |
| 107 | case CPUINFO_INT_REGISTER + I860_R9: cpustate->iregs[9] = info->i & 0xffffffff; break; | |
| 108 | case CPUINFO_INT_REGISTER + I860_R10: cpustate->iregs[10] = info->i & 0xffffffff; break; | |
| 109 | case CPUINFO_INT_REGISTER + I860_R11: cpustate->iregs[11] = info->i & 0xffffffff; break; | |
| 110 | case CPUINFO_INT_REGISTER + I860_R12: cpustate->iregs[12] = info->i & 0xffffffff; break; | |
| 111 | case CPUINFO_INT_REGISTER + I860_R13: cpustate->iregs[13] = info->i & 0xffffffff; break; | |
| 112 | case CPUINFO_INT_REGISTER + I860_R14: cpustate->iregs[14] = info->i & 0xffffffff; break; | |
| 113 | case CPUINFO_INT_REGISTER + I860_R15: cpustate->iregs[15] = info->i & 0xffffffff; break; | |
| 114 | case CPUINFO_INT_REGISTER + I860_R16: cpustate->iregs[16] = info->i & 0xffffffff; break; | |
| 115 | case CPUINFO_INT_REGISTER + I860_R17: cpustate->iregs[17] = info->i & 0xffffffff; break; | |
| 116 | case CPUINFO_INT_REGISTER + I860_R18: cpustate->iregs[18] = info->i & 0xffffffff; break; | |
| 117 | case CPUINFO_INT_REGISTER + I860_R19: cpustate->iregs[19] = info->i & 0xffffffff; break; | |
| 118 | case CPUINFO_INT_REGISTER + I860_R20: cpustate->iregs[20] = info->i & 0xffffffff; break; | |
| 119 | case CPUINFO_INT_REGISTER + I860_R21: cpustate->iregs[21] = info->i & 0xffffffff; break; | |
| 120 | case CPUINFO_INT_REGISTER + I860_R22: cpustate->iregs[22] = info->i & 0xffffffff; break; | |
| 121 | case CPUINFO_INT_REGISTER + I860_R23: cpustate->iregs[23] = info->i & 0xffffffff; break; | |
| 122 | case CPUINFO_INT_REGISTER + I860_R24: cpustate->iregs[24] = info->i & 0xffffffff; break; | |
| 123 | case CPUINFO_INT_REGISTER + I860_R25: cpustate->iregs[25] = info->i & 0xffffffff; break; | |
| 124 | case CPUINFO_INT_REGISTER + I860_R26: cpustate->iregs[26] = info->i & 0xffffffff; break; | |
| 125 | case CPUINFO_INT_REGISTER + I860_R27: cpustate->iregs[27] = info->i & 0xffffffff; break; | |
| 126 | case CPUINFO_INT_REGISTER + I860_R28: cpustate->iregs[28] = info->i & 0xffffffff; break; | |
| 127 | case CPUINFO_INT_REGISTER + I860_R29: cpustate->iregs[29] = info->i & 0xffffffff; break; | |
| 128 | case CPUINFO_INT_REGISTER + I860_R30: cpustate->iregs[30] = info->i & 0xffffffff; break; | |
| 129 | case CPUINFO_INT_REGISTER + I860_R31: cpustate->iregs[31] = info->i & 0xffffffff; break; | |
| 130 | ||
| 131 | case CPUINFO_INT_REGISTER + I860_F0: CPU_SET_INFO_F(0); break; | |
| 132 | case CPUINFO_INT_REGISTER + I860_F1: CPU_SET_INFO_F(1); break; | |
| 133 | case CPUINFO_INT_REGISTER + I860_F2: CPU_SET_INFO_F(2); break; | |
| 134 | case CPUINFO_INT_REGISTER + I860_F3: CPU_SET_INFO_F(3); break; | |
| 135 | case CPUINFO_INT_REGISTER + I860_F4: CPU_SET_INFO_F(4); break; | |
| 136 | case CPUINFO_INT_REGISTER + I860_F5: CPU_SET_INFO_F(5); break; | |
| 137 | case CPUINFO_INT_REGISTER + I860_F6: CPU_SET_INFO_F(6); break; | |
| 138 | case CPUINFO_INT_REGISTER + I860_F7: CPU_SET_INFO_F(7); break; | |
| 139 | case CPUINFO_INT_REGISTER + I860_F8: CPU_SET_INFO_F(8); break; | |
| 140 | case CPUINFO_INT_REGISTER + I860_F9: CPU_SET_INFO_F(9); break; | |
| 141 | case CPUINFO_INT_REGISTER + I860_F10: CPU_SET_INFO_F(10); break; | |
| 142 | case CPUINFO_INT_REGISTER + I860_F11: CPU_SET_INFO_F(11); break; | |
| 143 | case CPUINFO_INT_REGISTER + I860_F12: CPU_SET_INFO_F(12); break; | |
| 144 | case CPUINFO_INT_REGISTER + I860_F13: CPU_SET_INFO_F(13); break; | |
| 145 | case CPUINFO_INT_REGISTER + I860_F14: CPU_SET_INFO_F(14); break; | |
| 146 | case CPUINFO_INT_REGISTER + I860_F15: CPU_SET_INFO_F(15); break; | |
| 147 | case CPUINFO_INT_REGISTER + I860_F16: CPU_SET_INFO_F(16); break; | |
| 148 | case CPUINFO_INT_REGISTER + I860_F17: CPU_SET_INFO_F(17); break; | |
| 149 | case CPUINFO_INT_REGISTER + I860_F18: CPU_SET_INFO_F(18); break; | |
| 150 | case CPUINFO_INT_REGISTER + I860_F19: CPU_SET_INFO_F(19); break; | |
| 151 | case CPUINFO_INT_REGISTER + I860_F20: CPU_SET_INFO_F(20); break; | |
| 152 | case CPUINFO_INT_REGISTER + I860_F21: CPU_SET_INFO_F(21); break; | |
| 153 | case CPUINFO_INT_REGISTER + I860_F22: CPU_SET_INFO_F(22); break; | |
| 154 | case CPUINFO_INT_REGISTER + I860_F23: CPU_SET_INFO_F(23); break; | |
| 155 | case CPUINFO_INT_REGISTER + I860_F24: CPU_SET_INFO_F(24); break; | |
| 156 | case CPUINFO_INT_REGISTER + I860_F25: CPU_SET_INFO_F(25); break; | |
| 157 | case CPUINFO_INT_REGISTER + I860_F26: CPU_SET_INFO_F(26); break; | |
| 158 | case CPUINFO_INT_REGISTER + I860_F27: CPU_SET_INFO_F(27); break; | |
| 159 | case CPUINFO_INT_REGISTER + I860_F28: CPU_SET_INFO_F(28); break; | |
| 160 | case CPUINFO_INT_REGISTER + I860_F29: CPU_SET_INFO_F(29); break; | |
| 161 | case CPUINFO_INT_REGISTER + I860_F30: CPU_SET_INFO_F(30); break; | |
| 162 | case CPUINFO_INT_REGISTER + I860_F31: CPU_SET_INFO_F(31); break; | |
| 57 | 163 | } |
| 58 | 164 | } |
| 59 | 165 | |
| 166 | #define CPU_GET_INFO_INT_F(fnum) (info->i = cpustate->frg[0+(4*fnum)] | \ | |
| 167 | cpustate->frg[1+(4*fnum)] << 8 | \ | |
| 168 | cpustate->frg[2+(4*fnum)] << 16 | \ | |
| 169 | cpustate->frg[3+(4*fnum)] << 24) | |
| 170 | ||
| 171 | #define CPU_GET_INFO_STR_F(fnum) (sprintf(info->s, "F%d : %08x", fnum, cpustate->frg[0+(4*fnum)] | \ | |
| 172 | cpustate->frg[1+(4*fnum)] << 8 | \ | |
| 173 | cpustate->frg[2+(4*fnum)] << 16 | \ | |
| 174 | cpustate->frg[3+(4*fnum)] << 24)) | |
| 175 | ||
| 60 | 176 | CPU_GET_INFO( i860 ) |
| 61 | 177 | { |
| 62 | i860_state_t * | |
| 178 | i860_state_t *cpustate = (device != NULL) ? device->token : NULL; | |
| 63 | 179 | |
| 64 | 180 | switch (state) |
| 65 | 181 | { |
| 66 | // --- the following bits of info are returned as 64-bit signed integers --- | |
| 67 | case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(i860_state_t); break; | |
| 68 | case CPUINFO_INT_INPUT_LINES: info->i = 0; break; | |
| 69 | case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0x00000000; break; | |
| 70 | case CPUINFO_INT_ENDIANNESS: info->i = ENDIANNESS_LITTLE; break; | |
| 71 | case CPUINFO_INT_CLOCK_MULTIPLIER: info->i = 1; break; | |
| 72 | case CPUINFO_INT_CLOCK_DIVIDER: info->i = 1; break; | |
| 73 | case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 4; break; | |
| 74 | case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 4; break; | |
| 75 | case CPUINFO_INT_MIN_CYCLES: info->i = 1; break; | |
| 76 | case CPUINFO_INT_MAX_CYCLES: info->i = 8; break; | |
| 182 | /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 183 | case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(i860_state_t); break; | |
| 184 | case CPUINFO_INT_INPUT_LINES: info->i = 0; break; | |
| 185 | case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0x00000000; break; | |
| 186 | case CPUINFO_INT_ENDIANNESS: info->i = ENDIANNESS_LITTLE; break; | |
| 187 | case CPUINFO_INT_CLOCK_MULTIPLIER: info->i = 1; break; | |
| 188 | case CPUINFO_INT_CLOCK_DIVIDER: info->i = 1; break; | |
| 189 | case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 4; break; | |
| 190 | case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 4; break; | |
| 191 | case CPUINFO_INT_MIN_CYCLES: info->i = 1; break; | |
| 192 | case CPUINFO_INT_MAX_CYCLES: info->i = 8; break; | |
| 77 | 193 | |
| 78 | case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32; break; | |
| 79 | case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32; break; | |
| 80 | case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0; break; | |
| 81 | case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA: info->i = 0; break; | |
| 82 | case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA: info->i = 0; break; | |
| 83 | case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA: info->i = 0; break; | |
| 84 | case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO: info->i = 0; break; | |
| 85 | case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO: info->i = 0; break; | |
| 86 | case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO: info->i = 0; break; | |
| 194 | case CPUINFO_INT_DATABUS_WIDTH_PROGRAM: info->i = 64; break; | |
| 195 | case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32; break; | |
| 196 | case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0; break; | |
| 197 | case CPUINFO_INT_DATABUS_WIDTH_DATA: info->i = 0; break; | |
| 198 | case CPUINFO_INT_ADDRBUS_WIDTH_DATA: info->i = 0; break; | |
| 199 | case CPUINFO_INT_ADDRBUS_SHIFT_DATA: info->i = 0; break; | |
| 200 | case CPUINFO_INT_DATABUS_WIDTH_IO: info->i = 0; break; | |
| 201 | case CPUINFO_INT_ADDRBUS_WIDTH_IO: info->i = 0; break; | |
| 202 | case CPUINFO_INT_ADDRBUS_SHIFT_IO: info->i = 0; break; | |
| 87 | 203 | |
| 88 | // --- the following bits of info are returned as pointers to data or functions --- | |
| 204 | case CPUINFO_INT_PC: | |
| 205 | case CPUINFO_INT_REGISTER + I860_PC: info->i = cpustate->pc; break; | |
| 206 | case CPUINFO_INT_PREVIOUSPC: info->i = cpustate->ppc; break; | |
| 207 | ||
| 208 | case CPUINFO_INT_REGISTER + I860_FIR: info->i = cpustate->cregs[CR_FIR]; break; | |
| 209 | case CPUINFO_INT_REGISTER + I860_PSR: info->i = cpustate->cregs[CR_PSR]; break; | |
| 210 | case CPUINFO_INT_REGISTER + I860_DIRBASE: info->i = cpustate->cregs[CR_DIRBASE]; break; | |
| 211 | case CPUINFO_INT_REGISTER + I860_DB: info->i = cpustate->cregs[CR_DB]; break; | |
| 212 | case CPUINFO_INT_REGISTER + I860_FSR: info->i = cpustate->cregs[CR_FSR]; break; | |
| 213 | case CPUINFO_INT_REGISTER + I860_EPSR: info->i = cpustate->cregs[CR_EPSR]; break; | |
| 214 | ||
| 215 | case CPUINFO_INT_REGISTER + I860_R0: info->i = cpustate->iregs[0]; break; | |
| 216 | case CPUINFO_INT_REGISTER + I860_R1: info->i = cpustate->iregs[1]; break; | |
| 217 | case CPUINFO_INT_REGISTER + I860_R2: info->i = cpustate->iregs[2]; break; | |
| 218 | case CPUINFO_INT_REGISTER + I860_R3: info->i = cpustate->iregs[3]; break; | |
| 219 | case CPUINFO_INT_REGISTER + I860_R4: info->i = cpustate->iregs[4]; break; | |
| 220 | case CPUINFO_INT_REGISTER + I860_R5: info->i = cpustate->iregs[5]; break; | |
| 221 | case CPUINFO_INT_REGISTER + I860_R6: info->i = cpustate->iregs[6]; break; | |
| 222 | case CPUINFO_INT_REGISTER + I860_R7: info->i = cpustate->iregs[7]; break; | |
| 223 | case CPUINFO_INT_REGISTER + I860_R8: info->i = cpustate->iregs[8]; break; | |
| 224 | case CPUINFO_INT_REGISTER + I860_R9: info->i = cpustate->iregs[9]; break; | |
| 225 | case CPUINFO_INT_REGISTER + I860_R10: info->i = cpustate->iregs[10]; break; | |
| 226 | case CPUINFO_INT_REGISTER + I860_R11: info->i = cpustate->iregs[11]; break; | |
| 227 | case CPUINFO_INT_REGISTER + I860_R12: info->i = cpustate->iregs[12]; break; | |
| 228 | case CPUINFO_INT_REGISTER + I860_R13: info->i = cpustate->iregs[13]; break; | |
| 229 | case CPUINFO_INT_REGISTER + I860_R14: info->i = cpustate->iregs[14]; break; | |
| 230 | case CPUINFO_INT_REGISTER + I860_R15: info->i = cpustate->iregs[15]; break; | |
| 231 | case CPUINFO_INT_REGISTER + I860_R16: info->i = cpustate->iregs[16]; break; | |
| 232 | case CPUINFO_INT_REGISTER + I860_R17: info->i = cpustate->iregs[17]; break; | |
| 233 | case CPUINFO_INT_REGISTER + I860_R18: info->i = cpustate->iregs[18]; break; | |
| 234 | case CPUINFO_INT_REGISTER + I860_R19: info->i = cpustate->iregs[19]; break; | |
| 235 | case CPUINFO_INT_REGISTER + I860_R20: info->i = cpustate->iregs[20]; break; | |
| 236 | case CPUINFO_INT_REGISTER + I860_R21: info->i = cpustate->iregs[21]; break; | |
| 237 | case CPUINFO_INT_REGISTER + I860_R22: info->i = cpustate->iregs[22]; break; | |
| 238 | case CPUINFO_INT_REGISTER + I860_R23: info->i = cpustate->iregs[23]; break; | |
| 239 | case CPUINFO_INT_REGISTER + I860_R24: info->i = cpustate->iregs[24]; break; | |
| 240 | case CPUINFO_INT_REGISTER + I860_R25: info->i = cpustate->iregs[25]; break; | |
| 241 | case CPUINFO_INT_REGISTER + I860_R26: info->i = cpustate->iregs[26]; break; | |
| 242 | case CPUINFO_INT_REGISTER + I860_R27: info->i = cpustate->iregs[27]; break; | |
| 243 | case CPUINFO_INT_REGISTER + I860_R28: info->i = cpustate->iregs[28]; break; | |
| 244 | case CPUINFO_INT_REGISTER + I860_R29: info->i = cpustate->iregs[29]; break; | |
| 245 | case CPUINFO_INT_REGISTER + I860_R30: info->i = cpustate->iregs[30]; break; | |
| 246 | case CPUINFO_INT_REGISTER + I860_R31: info->i = cpustate->iregs[31]; break; | |
| 247 | ||
| 248 | case CPUINFO_INT_REGISTER + I860_F0: CPU_GET_INFO_INT_F(0); break; | |
| 249 | case CPUINFO_INT_REGISTER + I860_F1: CPU_GET_INFO_INT_F(1); break; | |
| 250 | case CPUINFO_INT_REGISTER + I860_F2: CPU_GET_INFO_INT_F(2); break; | |
| 251 | case CPUINFO_INT_REGISTER + I860_F3: CPU_GET_INFO_INT_F(3); break; | |
| 252 | case CPUINFO_INT_REGISTER + I860_F4: CPU_GET_INFO_INT_F(4); break; | |
| 253 | case CPUINFO_INT_REGISTER + I860_F5: CPU_GET_INFO_INT_F(5); break; | |
| 254 | case CPUINFO_INT_REGISTER + I860_F6: CPU_GET_INFO_INT_F(6); break; | |
| 255 | case CPUINFO_INT_REGISTER + I860_F7: CPU_GET_INFO_INT_F(7); break; | |
| 256 | case CPUINFO_INT_REGISTER + I860_F8: CPU_GET_INFO_INT_F(8); break; | |
| 257 | case CPUINFO_INT_REGISTER + I860_F9: CPU_GET_INFO_INT_F(9); break; | |
| 258 | case CPUINFO_INT_REGISTER + I860_F10: CPU_GET_INFO_INT_F(10); break; | |
| 259 | case CPUINFO_INT_REGISTER + I860_F11: CPU_GET_INFO_INT_F(11); break; | |
| 260 | case CPUINFO_INT_REGISTER + I860_F12: CPU_GET_INFO_INT_F(12); break; | |
| 261 | case CPUINFO_INT_REGISTER + I860_F13: CPU_GET_INFO_INT_F(13); break; | |
| 262 | case CPUINFO_INT_REGISTER + I860_F14: CPU_GET_INFO_INT_F(14); break; | |
| 263 | case CPUINFO_INT_REGISTER + I860_F15: CPU_GET_INFO_INT_F(15); break; | |
| 264 | case CPUINFO_INT_REGISTER + I860_F16: CPU_GET_INFO_INT_F(16); break; | |
| 265 | case CPUINFO_INT_REGISTER + I860_F17: CPU_GET_INFO_INT_F(17); break; | |
| 266 | case CPUINFO_INT_REGISTER + I860_F18: CPU_GET_INFO_INT_F(18); break; | |
| 267 | case CPUINFO_INT_REGISTER + I860_F19: CPU_GET_INFO_INT_F(19); break; | |
| 268 | case CPUINFO_INT_REGISTER + I860_F20: CPU_GET_INFO_INT_F(20); break; | |
| 269 | case CPUINFO_INT_REGISTER + I860_F21: CPU_GET_INFO_INT_F(21); break; | |
| 270 | case CPUINFO_INT_REGISTER + I860_F22: CPU_GET_INFO_INT_F(22); break; | |
| 271 | case CPUINFO_INT_REGISTER + I860_F23: CPU_GET_INFO_INT_F(23); break; | |
| 272 | case CPUINFO_INT_REGISTER + I860_F24: CPU_GET_INFO_INT_F(24); break; | |
| 273 | case CPUINFO_INT_REGISTER + I860_F25: CPU_GET_INFO_INT_F(25); break; | |
| 274 | case CPUINFO_INT_REGISTER + I860_F26: CPU_GET_INFO_INT_F(26); break; | |
| 275 | case CPUINFO_INT_REGISTER + I860_F27: CPU_GET_INFO_INT_F(27); break; | |
| 276 | case CPUINFO_INT_REGISTER + I860_F28: CPU_GET_INFO_INT_F(28); break; | |
| 277 | case CPUINFO_INT_REGISTER + I860_F29: CPU_GET_INFO_INT_F(29); break; | |
| 278 | case CPUINFO_INT_REGISTER + I860_F30: CPU_GET_INFO_INT_F(30); break; | |
| 279 | case CPUINFO_INT_REGISTER + I860_F31: CPU_GET_INFO_INT_F(31); break; | |
| 280 | ||
| 281 | ||
| 282 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 89 | 283 | case CPUINFO_FCT_SET_INFO: info->setinfo = CPU_SET_INFO_NAME(i860); break; |
| 90 | 284 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(i860); break; |
| 91 | 285 | case CPUINFO_FCT_RESET: info->reset = CPU_RESET_NAME(i860); break; |
| r4135 | r4136 | |
| 98 | 292 | case CPUINFO_FCT_READ: info->read = NULL; break; |
| 99 | 293 | case CPUINFO_FCT_WRITE: info->write = NULL; break; |
| 100 | 294 | case CPUINFO_FCT_READOP: info->readop = NULL; break; |
| 101 | case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = & | |
| 295 | case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; | |
| 102 | 296 | |
| 103 | // --- the following bits of info are returned as NULL-terminated strings --- | |
| 104 | case CPUINFO_STR_NAME: strcpy(info->s, "i860"); break; | |
| 105 | case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "Intel"); break; | |
| 297 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 298 | case CPUINFO_STR_NAME: strcpy(info->s, "i860XR"); break; | |
| 299 | case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "Intel i860"); break; | |
| 106 | 300 | case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "0.1"); break; |
| 107 | 301 | case CPUINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break; |
| 108 | case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "Jason Eckhardt | |
| 302 | case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "Jason Eckhardt | |
| 109 | 303 | |
| 110 | case CPUINFO_INT_PC: info->i = i860->pc; break; | |
| 111 | case CPUINFO_INT_PREVIOUSPC: info->i = i860->ppc; break; | |
| 304 | case CPUINFO_STR_FLAGS: | |
| 305 | strcpy(info->s, ""); break; | |
| 306 | ||
| 307 | case CPUINFO_STR_REGISTER + I860_PC: sprintf(info->s, "PC : %08x", cpustate->pc); break; | |
| 308 | case CPUINFO_STR_REGISTER + I860_FIR: sprintf(info->s, "FIR : %08x", cpustate->cregs[CR_FIR]); break; | |
| 309 | case CPUINFO_STR_REGISTER + I860_PSR: sprintf(info->s, "PSR : %08x", cpustate->cregs[CR_PSR]); break; | |
| 310 | case CPUINFO_STR_REGISTER + I860_DIRBASE: sprintf(info->s, "DIRBASE : %08x", cpustate->cregs[CR_DIRBASE]);break; | |
| 311 | case CPUINFO_STR_REGISTER + I860_DB: sprintf(info->s, "DB : %08x", cpustate->cregs[CR_DB]); break; | |
| 312 | case CPUINFO_STR_REGISTER + I860_FSR: sprintf(info->s, "FSR : %08x", cpustate->cregs[CR_FSR]); break; | |
| 313 | case CPUINFO_STR_REGISTER + I860_EPSR: sprintf(info->s, "EPSR : %08x", cpustate->cregs[CR_EPSR]); break; | |
| 314 | ||
| 315 | case CPUINFO_STR_REGISTER + I860_R0: sprintf(info->s, "R0 : %08x", cpustate->iregs[0]); break; | |
| 316 | case CPUINFO_STR_REGISTER + I860_R1: sprintf(info->s, "R1 : %08x", cpustate->iregs[1]); break; | |
| 317 | case CPUINFO_STR_REGISTER + I860_R2: sprintf(info->s, "R2 : %08x", cpustate->iregs[2]); break; | |
| 318 | case CPUINFO_STR_REGISTER + I860_R3: sprintf(info->s, "R3 : %08x", cpustate->iregs[3]); break; | |
| 319 | case CPUINFO_STR_REGISTER + I860_R4: sprintf(info->s, "R4 : %08x", cpustate->iregs[4]); break; | |
| 320 | case CPUINFO_STR_REGISTER + I860_R5: sprintf(info->s, "R5 : %08x", cpustate->iregs[5]); break; | |
| 321 | case CPUINFO_STR_REGISTER + I860_R6: sprintf(info->s, "R6 : %08x", cpustate->iregs[6]); break; | |
| 322 | case CPUINFO_STR_REGISTER + I860_R7: sprintf(info->s, "R7 : %08x", cpustate->iregs[7]); break; | |
| 323 | case CPUINFO_STR_REGISTER + I860_R8: sprintf(info->s, "R8 : %08x", cpustate->iregs[8]); break; | |
| 324 | case CPUINFO_STR_REGISTER + I860_R9: sprintf(info->s, "R9 : %08x", cpustate->iregs[9]); break; | |
| 325 | case CPUINFO_STR_REGISTER + I860_R10: sprintf(info->s, "R10 : %08x", cpustate->iregs[10]); break; | |
| 326 | case CPUINFO_STR_REGISTER + I860_R11: sprintf(info->s, "R11 : %08x", cpustate->iregs[11]); break; | |
| 327 | case CPUINFO_STR_REGISTER + I860_R12: sprintf(info->s, "R12 : %08x", cpustate->iregs[12]); break; | |
| 328 | case CPUINFO_STR_REGISTER + I860_R13: sprintf(info->s, "R13 : %08x", cpustate->iregs[13]); break; | |
| 329 | case CPUINFO_STR_REGISTER + I860_R14: sprintf(info->s, "R14 : %08x", cpustate->iregs[14]); break; | |
| 330 | case CPUINFO_STR_REGISTER + I860_R15: sprintf(info->s, "R15 : %08x", cpustate->iregs[15]); break; | |
| 331 | case CPUINFO_STR_REGISTER + I860_R16: sprintf(info->s, "R16 : %08x", cpustate->iregs[16]); break; | |
| 332 | case CPUINFO_STR_REGISTER + I860_R17: sprintf(info->s, "R17 : %08x", cpustate->iregs[17]); break; | |
| 333 | case CPUINFO_STR_REGISTER + I860_R18: sprintf(info->s, "R18 : %08x", cpustate->iregs[18]); break; | |
| 334 | case CPUINFO_STR_REGISTER + I860_R19: sprintf(info->s, "R19 : %08x", cpustate->iregs[19]); break; | |
| 335 | case CPUINFO_STR_REGISTER + I860_R20: sprintf(info->s, "R20 : %08x", cpustate->iregs[20]); break; | |
| 336 | case CPUINFO_STR_REGISTER + I860_R21: sprintf(info->s, "R21 : %08x", cpustate->iregs[21]); break; | |
| 337 | case CPUINFO_STR_REGISTER + I860_R22: sprintf(info->s, "R22 : %08x", cpustate->iregs[22]); break; | |
| 338 | case CPUINFO_STR_REGISTER + I860_R23: sprintf(info->s, "R23 : %08x", cpustate->iregs[23]); break; | |
| 339 | case CPUINFO_STR_REGISTER + I860_R24: sprintf(info->s, "R24 : %08x", cpustate->iregs[24]); break; | |
| 340 | case CPUINFO_STR_REGISTER + I860_R25: sprintf(info->s, "R25 : %08x", cpustate->iregs[25]); break; | |
| 341 | case CPUINFO_STR_REGISTER + I860_R26: sprintf(info->s, "R26 : %08x", cpustate->iregs[26]); break; | |
| 342 | case CPUINFO_STR_REGISTER + I860_R27: sprintf(info->s, "R27 : %08x", cpustate->iregs[27]); break; | |
| 343 | case CPUINFO_STR_REGISTER + I860_R28: sprintf(info->s, "R28 : %08x", cpustate->iregs[28]); break; | |
| 344 | case CPUINFO_STR_REGISTER + I860_R29: sprintf(info->s, "R29 : %08x", cpustate->iregs[29]); break; | |
| 345 | case CPUINFO_STR_REGISTER + I860_R30: sprintf(info->s, "R30 : %08x", cpustate->iregs[30]); break; | |
| 346 | case CPUINFO_STR_REGISTER + I860_R31: sprintf(info->s, "R31 : %08x", cpustate->iregs[31]); break; | |
| 347 | ||
| 348 | case CPUINFO_STR_REGISTER + I860_F0: CPU_GET_INFO_STR_F(0); break; | |
| 349 | case CPUINFO_STR_REGISTER + I860_F1: CPU_GET_INFO_STR_F(1); break; | |
| 350 | case CPUINFO_STR_REGISTER + I860_F2: CPU_GET_INFO_STR_F(2); break; | |
| 351 | case CPUINFO_STR_REGISTER + I860_F3: CPU_GET_INFO_STR_F(3); break; | |
| 352 | case CPUINFO_STR_REGISTER + I860_F4: CPU_GET_INFO_STR_F(4); break; | |
| 353 | case CPUINFO_STR_REGISTER + I860_F5: CPU_GET_INFO_STR_F(5); break; | |
| 354 | case CPUINFO_STR_REGISTER + I860_F6: CPU_GET_INFO_STR_F(6); break; | |
| 355 | case CPUINFO_STR_REGISTER + I860_F7: CPU_GET_INFO_STR_F(7); break; | |
| 356 | case CPUINFO_STR_REGISTER + I860_F8: CPU_GET_INFO_STR_F(8); break; | |
| 357 | case CPUINFO_STR_REGISTER + I860_F9: CPU_GET_INFO_STR_F(9); break; | |
| 358 | case CPUINFO_STR_REGISTER + I860_F10: CPU_GET_INFO_STR_F(10); break; | |
| 359 | case CPUINFO_STR_REGISTER + I860_F11: CPU_GET_INFO_STR_F(11); break; | |
| 360 | case CPUINFO_STR_REGISTER + I860_F12: CPU_GET_INFO_STR_F(12); break; | |
| 361 | case CPUINFO_STR_REGISTER + I860_F13: CPU_GET_INFO_STR_F(13); break; | |
| 362 | case CPUINFO_STR_REGISTER + I860_F14: CPU_GET_INFO_STR_F(14); break; | |
| 363 | case CPUINFO_STR_REGISTER + I860_F15: CPU_GET_INFO_STR_F(15); break; | |
| 364 | case CPUINFO_STR_REGISTER + I860_F16: CPU_GET_INFO_STR_F(16); break; | |
| 365 | case CPUINFO_STR_REGISTER + I860_F17: CPU_GET_INFO_STR_F(17); break; | |
| 366 | case CPUINFO_STR_REGISTER + I860_F18: CPU_GET_INFO_STR_F(18); break; | |
| 367 | case CPUINFO_STR_REGISTER + I860_F19: CPU_GET_INFO_STR_F(19); break; | |
| 368 | case CPUINFO_STR_REGISTER + I860_F20: CPU_GET_INFO_STR_F(20); break; | |
| 369 | case CPUINFO_STR_REGISTER + I860_F21: CPU_GET_INFO_STR_F(21); break; | |
| 370 | case CPUINFO_STR_REGISTER + I860_F22: CPU_GET_INFO_STR_F(22); break; | |
| 371 | case CPUINFO_STR_REGISTER + I860_F23: CPU_GET_INFO_STR_F(23); break; | |
| 372 | case CPUINFO_STR_REGISTER + I860_F24: CPU_GET_INFO_STR_F(24); break; | |
| 373 | case CPUINFO_STR_REGISTER + I860_F25: CPU_GET_INFO_STR_F(25); break; | |
| 374 | case CPUINFO_STR_REGISTER + I860_F26: CPU_GET_INFO_STR_F(26); break; | |
| 375 | case CPUINFO_STR_REGISTER + I860_F27: CPU_GET_INFO_STR_F(27); break; | |
| 376 | case CPUINFO_STR_REGISTER + I860_F28: CPU_GET_INFO_STR_F(28); break; | |
| 377 | case CPUINFO_STR_REGISTER + I860_F29: CPU_GET_INFO_STR_F(29); break; | |
| 378 | case CPUINFO_STR_REGISTER + I860_F30: CPU_GET_INFO_STR_F(30); break; | |
| 379 | case CPUINFO_STR_REGISTER + I860_F31: CPU_GET_INFO_STR_F(31); break; | |
| 112 | 380 | } |
| 113 | 381 | } |
| r0 | r4136 | |
|---|---|---|
| 1 | /*************************************************************************** | |
| 2 | ||
| 3 | i860dis.c | |
| 4 | ||
| 5 | Disassembler for the Intel i860 emulator. | |
| 6 | ||
| 7 | Copyright (C) 1995-present Jason Eckhardt (jle@rice.edu) | |
| 8 | Released for general non-commercial use under the MAME license | |
| 9 | with the additional requirement that you are free to use and | |
| 10 | redistribute this code in modified or unmodified form, provided | |
| 11 | you list me in the credits. | |
| 12 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 13 | ||
| 14 | ***************************************************************************/ | |
| 15 | ||
| 16 | #include "i860.h" | |
| 17 | #include <string.h> | |
| 18 | ||
| 19 | /* Macros for accessing register fields in instruction word. */ | |
| 20 | #define get_isrc1(bits) (((bits) >> 11) & 0x1f) | |
| 21 | #define get_isrc2(bits) (((bits) >> 21) & 0x1f) | |
| 22 | #define get_idest(bits) (((bits) >> 16) & 0x1f) | |
| 23 | #define get_fsrc1(bits) (((bits) >> 11) & 0x1f) | |
| 24 | #define get_fsrc2(bits) (((bits) >> 21) & 0x1f) | |
| 25 | #define get_fdest(bits) (((bits) >> 16) & 0x1f) | |
| 26 | #define get_creg(bits) (((bits) >> 21) & 0x7) | |
| 27 | ||
| 28 | /* Macros for accessing immediate fields. */ | |
| 29 | /* 16-bit immediate. */ | |
| 30 | #define get_imm16(insn) ((insn) & 0xffff) | |
| 31 | ||
| 32 | ||
| 33 | /* Control register names. */ | |
| 34 | static const char *const cr2str[] = | |
| 35 | {"fir", "psr", "dirbase", "db", "fsr", "epsr", "!", "!"}; | |
| 36 | ||
| 37 | ||
| 38 | /* Sign extend N-bit number. */ | |
| 39 | static INT32 sign_ext(UINT32 x, int n) | |
| 40 | { | |
| 41 | INT32 t; | |
| 42 | t = x >> (n - 1); | |
| 43 | t = ((-t) << n) | x; | |
| 44 | return t; | |
| 45 | } | |
| 46 | ||
| 47 | ||
| 48 | /* Basic integer 3-address register format: | |
| 49 | * mnemonic %rs1,%rs2,%rd */ | |
| 50 | static void int_12d(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 51 | { | |
| 52 | /* Possibly prefix shrd with 'd.' */ | |
| 53 | if (((insn & 0xfc000000) == 0xb0000000) && (insn & 0x200)) | |
| 54 | sprintf(buf, "d.%s\t%%r%d,%%r%d,%%r%d", mnemonic, | |
| 55 | get_isrc1 (insn), get_isrc2 (insn), get_idest (insn)); | |
| 56 | else | |
| 57 | sprintf(buf, "%s\t%%r%d,%%r%d,%%r%d", mnemonic, | |
| 58 | get_isrc1 (insn), get_isrc2 (insn), get_idest (insn)); | |
| 59 | } | |
| 60 | ||
| 61 | ||
| 62 | /* Basic integer 3-address imm16 format: | |
| 63 | * mnemonic #imm16,%rs2,%rd */ | |
| 64 | static void int_i2d(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 65 | { | |
| 66 | /* Sign extend the 16-bit immediate. | |
| 67 | Print as hex for the bitwise operations. */ | |
| 68 | int upper_6bits = (insn >> 26) & 0x3f; | |
| 69 | if (upper_6bits >= 0x30 && upper_6bits <= 0x3f) | |
| 70 | sprintf(buf, "%s\t0x%04x,%%r%d,%%r%d", mnemonic, | |
| 71 | (UINT32)(get_imm16 (insn)), get_isrc2 (insn), get_idest (insn)); | |
| 72 | else | |
| 73 | sprintf(buf, "%s\t%d,%%r%d,%%r%d", mnemonic, | |
| 74 | sign_ext(get_imm16 (insn), 16), get_isrc2 (insn), get_idest (insn)); | |
| 75 | } | |
| 76 | ||
| 77 | ||
| 78 | /* Integer (mixed) 2-address isrc1ni,fdest. */ | |
| 79 | static void int_1d(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 80 | { | |
| 81 | sprintf(buf, "%s\t%%r%d,%%f%d", mnemonic, get_isrc1 (insn), get_fdest (insn)); | |
| 82 | } | |
| 83 | ||
| 84 | ||
| 85 | /* Integer (mixed) 2-address csrc2,idest. */ | |
| 86 | static void int_cd(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 87 | { | |
| 88 | sprintf(buf, "%s\t%%%s,%%r%d", mnemonic, cr2str[get_creg (insn)], get_idest (insn)); | |
| 89 | } | |
| 90 | ||
| 91 | ||
| 92 | /* Integer (mixed) 2-address isrc1,csrc2. */ | |
| 93 | static void int_1c(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 94 | { | |
| 95 | sprintf(buf, "%s\t%%r%d,%%%s", mnemonic, get_isrc1(insn), cr2str[get_creg (insn)]); | |
| 96 | } | |
| 97 | ||
| 98 | ||
| 99 | /* Integer 1-address register format: | |
| 100 | * mnemonic %rs1 */ | |
| 101 | static void int_1(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 102 | { | |
| 103 | sprintf(buf, "%s\t%%r%d", mnemonic, get_isrc1 (insn)); | |
| 104 | } | |
| 105 | ||
| 106 | ||
| 107 | /* Integer no-address register format: | |
| 108 | * mnemonic */ | |
| 109 | static void int_0(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 110 | { | |
| 111 | sprintf(buf, "%s", mnemonic); | |
| 112 | } | |
| 113 | ||
| 114 | ||
| 115 | /* Basic floating-point 3-address register format: | |
| 116 | * mnemonic %fs1,%fs2,%fd */ | |
| 117 | static void flop_12d(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 118 | { | |
| 119 | const char *suffix[4] = { "ss", "sd", "ds", "dd" }; | |
| 120 | const char *prefix_d, *prefix_p; | |
| 121 | int s = (insn & 0x180) >> 7; | |
| 122 | prefix_p = (insn & 0x400) ? "p" : ""; | |
| 123 | prefix_d = (insn & 0x200) ? "d." : ""; | |
| 124 | ||
| 125 | /* Special case: pf[m]am and pf[m]sm families are always pipelined, so they | |
| 126 | do not have a prefix. Also, for the pfmam and pfmsm families, replace | |
| 127 | any 'a' in the mnemonic with 'm' and prepend an 'm'. */ | |
| 128 | if ((insn & 0x7f) < 0x20) | |
| 129 | { | |
| 130 | int is_pfam = insn & 0x400; | |
| 131 | if (!is_pfam) | |
| 132 | { | |
| 133 | char newname[256]; | |
| 134 | char *op = mnemonic; | |
| 135 | char *np = newname + 1; | |
| 136 | newname[0] = 'm'; | |
| 137 | while (*op) | |
| 138 | { | |
| 139 | if (*op == 'a') | |
| 140 | *np = 'm'; | |
| 141 | else | |
| 142 | *np = *op; | |
| 143 | np++; | |
| 144 | op++; | |
| 145 | } | |
| 146 | *np = 0; | |
| 147 | mnemonic = newname; | |
| 148 | } | |
| 149 | prefix_p = ""; | |
| 150 | } | |
| 151 | ||
| 152 | /* Special case: pfgt/pfle-- R-bit distinguishes the two. */ | |
| 153 | if ((insn & 0x7f) == 0x34) | |
| 154 | { | |
| 155 | const char *mn[2] = { "fgt.", "fle." }; | |
| 156 | int r = (insn & 0x080) >> 7; | |
| 157 | int s = (insn & 0x100) ? 3 : 0; | |
| 158 | sprintf(buf, "%s%s%s%s\t%%f%d,%%f%d,%%f%d", prefix_d, prefix_p, mn[r], | |
| 159 | suffix[s], get_fsrc1 (insn), get_fsrc2 (insn), get_fdest (insn)); | |
| 160 | } | |
| 161 | else | |
| 162 | sprintf(buf, "%s%s%s%s\t%%f%d,%%f%d,%%f%d", prefix_d, prefix_p, mnemonic, | |
| 163 | suffix[s], get_fsrc1 (insn), get_fsrc2 (insn), get_fdest (insn)); | |
| 164 | } | |
| 165 | ||
| 166 | ||
| 167 | /* Floating-point 2-address register format: | |
| 168 | * mnemonic %fs1,%fd */ | |
| 169 | static void flop_1d(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 170 | { | |
| 171 | const char *suffix[4] = { "ss", "sd", "ds", "dd" }; | |
| 172 | const char *prefix_d, *prefix_p; | |
| 173 | int s = (insn & 0x180) >> 7; | |
| 174 | prefix_p = (insn & 0x400) ? "p" : ""; | |
| 175 | prefix_d = (insn & 0x200) ? "d." : ""; | |
| 176 | sprintf(buf, "%s%s%s%s\t%%f%d,%%f%d", prefix_d, prefix_p, mnemonic, | |
| 177 | suffix[s], get_fsrc1 (insn), get_fdest (insn)); | |
| 178 | } | |
| 179 | ||
| 180 | ||
| 181 | /* Floating-point 2-address register format: | |
| 182 | * mnemonic %fs2,%fd */ | |
| 183 | static void flop_2d(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 184 | { | |
| 185 | const char *suffix[4] = { "ss", "sd", "ds", "dd" }; | |
| 186 | const char *prefix_d; | |
| 187 | int s = (insn & 0x180) >> 7; | |
| 188 | prefix_d = (insn & 0x200) ? "d." : ""; | |
| 189 | sprintf(buf, "%s%s%s\t%%f%d,%%f%d", prefix_d, mnemonic, suffix[s], | |
| 190 | get_fsrc2 (insn), get_fdest (insn)); | |
| 191 | } | |
| 192 | ||
| 193 | ||
| 194 | /* Floating-point (mixed) 2-address register format: | |
| 195 | * fxfr fsrc1,idest. */ | |
| 196 | static void flop_fxfr(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 197 | { | |
| 198 | const char *prefix_d = (insn & 0x200) ? "d." : ""; | |
| 199 | sprintf(buf, "%s%s\t%%f%d,%%r%d", prefix_d, mnemonic, get_fsrc1 (insn), | |
| 200 | get_idest (insn)); | |
| 201 | } | |
| 202 | ||
| 203 | ||
| 204 | /* Branch with reg,reg,sbroff format: | |
| 205 | * mnemonic %rs1,%rs2,sbroff */ | |
| 206 | static void int_12S(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 207 | { | |
| 208 | INT32 sbroff = sign_ext ((((insn >> 5) & 0xf800) | (insn & 0x07ff)), 16); | |
| 209 | INT32 rel = (INT32)pc + (sbroff << 2) + 4; | |
| 210 | ||
| 211 | sprintf(buf, "%s\t%%r%d,%%r%d,0x%08x", mnemonic, get_isrc1 (insn), | |
| 212 | get_isrc2 (insn), (UINT32)rel); | |
| 213 | } | |
| 214 | ||
| 215 | ||
| 216 | /* Branch with #const5,reg,sbroff format: | |
| 217 | * mnemonic #const5,%rs2,sbroff */ | |
| 218 | static void int_i2S(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 219 | { | |
| 220 | INT32 sbroff = sign_ext ((((insn >> 5) & 0xf800) | (insn & 0x07ff)), 16); | |
| 221 | INT32 rel = (INT32)pc + (sbroff << 2) + 4; | |
| 222 | ||
| 223 | sprintf(buf, "%s\t%d,%%r%d,0x%08x", mnemonic, ((insn >> 11) & 0x1f), | |
| 224 | get_isrc2 (insn), (UINT32)rel); | |
| 225 | } | |
| 226 | ||
| 227 | ||
| 228 | /* Branch with lbroff format: | |
| 229 | * mnemonic lbroff */ | |
| 230 | static void int_L(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 231 | { | |
| 232 | INT32 lbroff = sign_ext ((insn & 0x03ffffff), 26); | |
| 233 | INT32 rel = (INT32)pc + (lbroff << 2) + 4; | |
| 234 | ||
| 235 | sprintf(buf, "%s\t0x%08x", mnemonic, (UINT32)rel); | |
| 236 | } | |
| 237 | ||
| 238 | ||
| 239 | /* Integer load. | |
| 240 | * ld.{b,s,l} isrc1(isrc2),idest | |
| 241 | * ld.{b,s,l} #const(isrc2),idest */ | |
| 242 | static void int_ldx(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 243 | { | |
| 244 | /* Operand size, in bytes. */ | |
| 245 | int sizes[4] = { 1, 1, 2, 4 }; | |
| 246 | const char *suffix[4] = { "b", "b", "s", "l" }; | |
| 247 | UINT32 idx = 0; | |
| 248 | ||
| 249 | /* Bits 28 and 0 determine the operand size. */ | |
| 250 | idx = ((insn >> 27) & 2) | (insn & 1); | |
| 251 | ||
| 252 | /* Bit 26 determines the addressing mode (reg+reg or disp+reg). */ | |
| 253 | if (insn & 0x04000000) | |
| 254 | { | |
| 255 | /* Chop off lower bits of displacement. */ | |
| 256 | INT32 immsrc1 = sign_ext (get_imm16 (insn), 16); | |
| 257 | int size = sizes[idx]; | |
| 258 | immsrc1 &= ~(size - 1); | |
| 259 | sprintf(buf, "%s%s\t%d(%%r%d),%%r%d", mnemonic, suffix[idx], | |
| 260 | immsrc1, get_isrc2 (insn), get_idest (insn)); | |
| 261 | } | |
| 262 | else | |
| 263 | sprintf(buf, "%s%s\t%%r%d(%%r%d),%%r%d", mnemonic, suffix[idx], | |
| 264 | get_isrc1 (insn), get_isrc2 (insn), get_idest (insn)); | |
| 265 | } | |
| 266 | ||
| 267 | ||
| 268 | /* Integer store: st.b isrc1ni,#const(isrc2) */ | |
| 269 | static void int_stx(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 270 | { | |
| 271 | /* Operand size, in bytes. */ | |
| 272 | int sizes[4] = { 1, 1, 2, 4 }; | |
| 273 | const char *suffix[4] = { "b", "b", "s", "l" }; | |
| 274 | int idx = 0; | |
| 275 | int size; | |
| 276 | INT32 immsrc = sign_ext ((((insn >> 5) & 0xf800) | (insn & 0x07ff)), 16); | |
| 277 | ||
| 278 | /* Bits 28 and 0 determine the operand size. */ | |
| 279 | idx = ((insn >> 27) & 2) | (insn & 1); | |
| 280 | ||
| 281 | /* Chop off lower bits of displacement. */ | |
| 282 | size = sizes[idx]; | |
| 283 | immsrc &= ~(size - 1); | |
| 284 | sprintf(buf, "%s%s\t%%r%d,%d(%%r%d)", mnemonic, suffix[idx], | |
| 285 | get_isrc1 (insn), immsrc, get_isrc2 (insn)); | |
| 286 | } | |
| 287 | ||
| 288 | ||
| 289 | /* Disassemble: | |
| 290 | * "[p]fld.y isrc1(isrc2),fdest", "[p]fld.y isrc1(isrc2)++,idest", | |
| 291 | * "[p]fld.y #const(isrc2),fdest" or "[p]fld.y #const(isrc2)++,idest". | |
| 292 | * "fst.y fdest,isrc1(isrc2)", "fst.y fdest,isrc1(isrc2)++", | |
| 293 | * "fst.y fdest,#const(isrc2)" or "fst.y fdest,#const(isrc2)++" | |
| 294 | * Where y = {l,d,q}. Note, there is no pfld.q, though. */ | |
| 295 | static void int_fldst(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 296 | { | |
| 297 | INT32 immsrc1 = sign_ext (get_imm16 (insn), 16); | |
| 298 | /* Operand size, in bytes. */ | |
| 299 | int sizes[4] = { 8, 4, 16, 4 }; | |
| 300 | const char *suffix[4] = { "d", "l", "q", "l" }; | |
| 301 | int idx = 0; | |
| 302 | int size = 0; | |
| 303 | int auto_inc = (insn & 1); | |
| 304 | const char *auto_suff[2] = { "", "++" }; | |
| 305 | int piped = (insn & 0x40000000) >> 29; | |
| 306 | const char *piped_suff[2] = { "", "p" }; | |
| 307 | int upper_6bits = (insn >> 26) & 0x3f; | |
| 308 | int is_load = (upper_6bits == 8 || upper_6bits == 9 || upper_6bits == 24 | |
| 309 | || upper_6bits == 25); | |
| 310 | ||
| 311 | /* Bits 2 and 1 determine the operand size. */ | |
| 312 | idx = ((insn >> 1) & 3); | |
| 313 | size = sizes[idx]; | |
| 314 | ||
| 315 | /* There is no pipelined load quad on XR. */ | |
| 316 | if (piped && size == 16) | |
| 317 | { | |
| 318 | sprintf (buf, ".long\t%#08x; *", insn); | |
| 319 | return; | |
| 320 | } | |
| 321 | ||
| 322 | /* There is only a 64-bit pixel store. */ | |
| 323 | if ((upper_6bits == 15) && size != 8) | |
| 324 | { | |
| 325 | sprintf (buf, ".long\t%#08x", insn); | |
| 326 | return; | |
| 327 | } | |
| 328 | ||
| 329 | /* Bit 26 determines the addressing mode (reg+reg or disp+reg). */ | |
| 330 | if (insn & 0x04000000) | |
| 331 | { | |
| 332 | /* Chop off lower bits of displacement. */ | |
| 333 | immsrc1 &= ~(size - 1); | |
| 334 | if (is_load) | |
| 335 | sprintf(buf, "%s%s%s\t%d(%%r%d)%s,%%f%d", piped_suff[piped], mnemonic, | |
| 336 | suffix[idx], immsrc1, get_isrc2 (insn), auto_suff[auto_inc], | |
| 337 | get_fdest (insn)); | |
| 338 | else | |
| 339 | sprintf(buf, "%s%s\t%%f%d,%d(%%r%d)%s", mnemonic, suffix[idx], | |
| 340 | get_fdest (insn), immsrc1, get_isrc2 (insn), auto_suff[auto_inc]); | |
| 341 | } | |
| 342 | else | |
| 343 | { | |
| 344 | if (is_load) | |
| 345 | sprintf(buf, "%s%s%s\t%%r%d(%%r%d)%s,%%f%d", piped_suff[piped], | |
| 346 | mnemonic, suffix[idx], get_isrc1 (insn), get_isrc2 (insn), | |
| 347 | auto_suff[auto_inc], get_fdest (insn)); | |
| 348 | else | |
| 349 | sprintf(buf, "%s%s\t%%f%d,%%r%d(%%r%d)%s", mnemonic, suffix[idx], | |
| 350 | get_fdest (insn), get_isrc1 (insn), get_isrc2 (insn), | |
| 351 | auto_suff[auto_inc]); | |
| 352 | } | |
| 353 | } | |
| 354 | ||
| 355 | ||
| 356 | /* flush #const(isrc2)[++]. */ | |
| 357 | static void int_flush(char *buf, char *mnemonic, UINT32 pc, UINT32 insn) | |
| 358 | { | |
| 359 | const char *auto_suff[2] = { "", "++" }; | |
| 360 | INT32 immsrc = sign_ext (get_imm16 (insn), 16); | |
| 361 | immsrc &= ~(16-1); | |
| 362 | sprintf(buf, "%s\t%d(%%r%d)%s", mnemonic, immsrc, get_isrc2 (insn), | |
| 363 | auto_suff[(insn & 1)]); | |
| 364 | } | |
| 365 | ||
| 366 | ||
| 367 | /* Flags for the decode table. */ | |
| 368 | enum | |
| 369 | { | |
| 370 | DEC_MORE = 1, /* More decoding necessary. */ | |
| 371 | DEC_DECODED = 2 /* Fully decoded, go. */ | |
| 372 | }; | |
| 373 | ||
| 374 | ||
| 375 | typedef struct | |
| 376 | { | |
| 377 | /* Disassembly function for this opcode. | |
| 378 | Call with buffer, mnemonic, pc, insn. */ | |
| 379 | void (*insn_dis)(char *, char *, UINT32, UINT32); | |
| 380 | ||
| 381 | /* Flags for this opcode. */ | |
| 382 | char flags; | |
| 383 | ||
| 384 | /* Mnemonic of this opcode (sometimes partial when more decode is | |
| 385 | done in disassembly routines-- e.g., loads and stores). */ | |
| 386 | const char *mnemonic; | |
| 387 | } decode_tbl_t; | |
| 388 | ||
| 389 | ||
| 390 | /* First-level decode table (i.e., for the 6 primary opcode bits). */ | |
| 391 | static decode_tbl_t decode_tbl[64] = | |
| 392 | { | |
| 393 | /* A slight bit of decoding for loads and stores is done in the | |
| 394 | execution routines (operand size and addressing mode), which | |
| 395 | is why their respective entries are identical. */ | |
| 396 | { int_ldx, DEC_DECODED, "ld." }, /* ld.b isrc1(isrc2),idest. */ | |
| 397 | { int_ldx, DEC_DECODED, "ld." }, /* ld.b #const(isrc2),idest. */ | |
| 398 | { int_1d, DEC_DECODED, "ixfr" }, /* ixfr isrc1ni,fdest. */ | |
| 399 | { int_stx, DEC_DECODED, "st." }, /* st.b isrc1ni,#const(isrc2). */ | |
| 400 | { int_ldx, DEC_DECODED, "ld." }, /* ld.{s,l} isrc1(isrc2),idest. */ | |
| 401 | { int_ldx, DEC_DECODED, "ld." }, /* ld.{s,l} #const(isrc2),idest. */ | |
| 402 | { 0, 0 , 0 }, | |
| 403 | { int_stx, DEC_DECODED, "st." }, /* st.{s,l} isrc1ni,#const(isrc2),idest.*/ | |
| 404 | { int_fldst, DEC_DECODED, "fld." }, /* fld.{l,d,q} isrc1(isrc2)[++],fdest. */ | |
| 405 | { int_fldst, DEC_DECODED, "fld." }, /* fld.{l,d,q} #const(isrc2)[++],fdest. */ | |
| 406 | { int_fldst, DEC_DECODED, "fst." }, /* fst.{l,d,q} fdest,isrc1(isrc2)[++] */ | |
| 407 | { int_fldst, DEC_DECODED, "fst." }, /* fst.{l,d,q} fdest,#const(isrc2)[++] */ | |
| 408 | { int_cd, DEC_DECODED, "ld.c" }, /* ld.c csrc2,idest. */ | |
| 409 | { int_flush, DEC_DECODED, "flush" }, /* flush #const(isrc2) (or autoinc). */ | |
| 410 | { int_1c, DEC_DECODED, "st.c" }, /* st.c isrc1,csrc2. */ | |
| 411 | { int_fldst, DEC_DECODED, "pstd." }, /* pst.d fdest,#const(isrc2)[++]. */ | |
| 412 | { int_1, DEC_DECODED, "bri" }, /* bri isrc1ni. */ | |
| 413 | { int_12d, DEC_DECODED, "trap" }, /* trap isrc1ni,isrc2,idest. */ | |
| 414 | { 0, DEC_MORE, 0 }, /* FP ESCAPE FORMAT, more decode. */ | |
| 415 | { 0, DEC_MORE, 0 }, /* CORE ESCAPE FORMAT, more decode. */ | |
| 416 | { int_12S, DEC_DECODED, "btne" }, /* btne isrc1,isrc2,sbroff. */ | |
| 417 | { int_i2S, DEC_DECODED, "btne" }, /* btne #const,isrc2,sbroff. */ | |
| 418 | { int_12S, DEC_DECODED, "bte" }, /* bte isrc1,isrc2,sbroff. */ | |
| 419 | { int_i2S, DEC_DECODED, "bte" }, /* bte #const5,isrc2,idest. */ | |
| 420 | { int_fldst, DEC_DECODED, "pfld." }, /* pfld.{l,d,q} isrc1(isrc2)[++],fdest. */ | |
| 421 | { int_fldst, DEC_DECODED, "pfld." }, /* pfld.{l,d,q} #const(isrc2)[++],fdest.*/ | |
| 422 | { int_L, DEC_DECODED, "br" }, /* br lbroff. */ | |
| 423 | { int_L, DEC_DECODED, "call" }, /* call lbroff . */ | |
| 424 | { int_L, DEC_DECODED, "bc" }, /* bc lbroff. */ | |
| 425 | { int_L, DEC_DECODED, "bc.t" }, /* bc.t lbroff. */ | |
| 426 | { int_L, DEC_DECODED, "bnc" }, /* bnc lbroff. */ | |
| 427 | { int_L, DEC_DECODED, "bnc.t" }, /* bnc.t lbroff. */ | |
| 428 | { int_12d, DEC_DECODED, "addu" }, /* addu isrc1,isrc2,idest. */ | |
| 429 | { int_i2d, DEC_DECODED, "addu" }, /* addu #const,isrc2,idest. */ | |
| 430 | { int_12d, DEC_DECODED, "subu" }, /* subu isrc1,isrc2,idest. */ | |
| 431 | { int_i2d, DEC_DECODED, "subu" }, /* subu #const,isrc2,idest. */ | |
| 432 | { int_12d, DEC_DECODED, "adds" }, /* adds isrc1,isrc2,idest. */ | |
| 433 | { int_i2d, DEC_DECODED, "adds" }, /* adds #const,isrc2,idest. */ | |
| 434 | { int_12d, DEC_DECODED, "subs" }, /* subs isrc1,isrc2,idest. */ | |
| 435 | { int_i2d, DEC_DECODED, "subs" }, /* subs #const,isrc2,idest. */ | |
| 436 | { int_12d, DEC_DECODED, "shl" }, /* shl isrc1,isrc2,idest. */ | |
| 437 | { int_i2d, DEC_DECODED, "shl" }, /* shl #const,isrc2,idest. */ | |
| 438 | { int_12d, DEC_DECODED, "shr" }, /* shr isrc1,isrc2,idest. */ | |
| 439 | { int_i2d, DEC_DECODED, "shr" }, /* shr #const,isrc2,idest. */ | |
| 440 | { int_12d, DEC_DECODED, "shrd" }, /* shrd isrc1ni,isrc2,idest. */ | |
| 441 | { int_12S, DEC_DECODED, "bla" }, /* bla isrc1ni,isrc2,sbroff. */ | |
| 442 | { int_12d, DEC_DECODED, "shra" }, /* shra isrc1,isrc2,idest. */ | |
| 443 | { int_i2d, DEC_DECODED, "shra" }, /* shra #const,isrc2,idest. */ | |
| 444 | { int_12d, DEC_DECODED, "and" }, /* and isrc1,isrc2,idest. */ | |
| 445 | { int_i2d, DEC_DECODED, "and" }, /* and #const,isrc2,idest. */ | |
| 446 | { 0, 0 , 0 }, | |
| 447 | { int_i2d, DEC_DECODED, "andh" }, /* andh #const,isrc2,idest. */ | |
| 448 | { int_12d, DEC_DECODED, "andnot" }, /* andnot isrc1,isrc2,idest. */ | |
| 449 | { int_i2d, DEC_DECODED, "andnot" }, /* andnot #const,isrc2,idest. */ | |
| 450 | { 0, 0 , 0 }, | |
| 451 | { int_i2d, DEC_DECODED, "andnoth" }, /* andnoth #const,isrc2,idest.*/ | |
| 452 | { int_12d, DEC_DECODED, "or" }, /* or isrc1,isrc2,idest. */ | |
| 453 | { int_i2d, DEC_DECODED, "or" }, /* or #const,isrc2,idest. */ | |
| 454 | { 0, 0 , 0 }, | |
| 455 | { int_i2d, DEC_DECODED, "orh" }, /* orh #const,isrc2,idest. */ | |
| 456 | { int_12d, DEC_DECODED, "xor" }, /* xor isrc1,isrc2,idest. */ | |
| 457 | { int_i2d, DEC_DECODED, "xor" }, /* xor #const,isrc2,idest. */ | |
| 458 | { 0, 0 , 0 }, | |
| 459 | { int_i2d, DEC_DECODED, "xorh" }, /* xorh #const,isrc2,idest. */ | |
| 460 | }; | |
| 461 | ||
| 462 | ||
| 463 | /* Second-level decode table (i.e., for the 3 core escape opcode bits). */ | |
| 464 | static decode_tbl_t core_esc_decode_tbl[8] = | |
| 465 | { | |
| 466 | { 0, 0 , 0 }, | |
| 467 | { int_0, DEC_DECODED, "lock" }, /* lock. */ | |
| 468 | { int_1, DEC_DECODED, "calli" }, /* calli isrc1ni. */ | |
| 469 | { 0, 0 , 0 }, | |
| 470 | { int_0, DEC_DECODED, "intovr" }, /* intovr. */ | |
| 471 | { 0, 0 , 0 }, | |
| 472 | { 0, 0 , 0 }, | |
| 473 | { int_0, DEC_DECODED, "unlock" }, /* unlock. */ | |
| 474 | }; | |
| 475 | ||
| 476 | ||
| 477 | /* Second-level decode table (i.e., for the 7 FP extended opcode bits). */ | |
| 478 | static decode_tbl_t fp_decode_tbl[128] = | |
| 479 | { | |
| 480 | /* Floating point instructions. The least significant 7 bits are | |
| 481 | the (extended) opcode and bits 10:7 are P,D,S,R respectively | |
| 482 | ([p]ipelined, [d]ual, [s]ource prec., [r]esult prec.). | |
| 483 | For some operations, I defer decoding the P,S,R bits to the | |
| 484 | emulation routine for them. */ | |
| 485 | { flop_12d, DEC_DECODED, "r2p1." }, /* 0x00 pf[m]am */ | |
| 486 | { flop_12d, DEC_DECODED, "r2pt." }, /* 0x01 pf[m]am */ | |
| 487 | { flop_12d, DEC_DECODED, "r2ap1." }, /* 0x02 pf[m]am */ | |
| 488 | { flop_12d, DEC_DECODED, "r2apt." }, /* 0x03 pf[m]am */ | |
| 489 | { flop_12d, DEC_DECODED, "i2p1." }, /* 0x04 pf[m]am */ | |
| 490 | { flop_12d, DEC_DECODED, "i2pt." }, /* 0x05 pf[m]am */ | |
| 491 | { flop_12d, DEC_DECODED, "i2ap1." }, /* 0x06 pf[m]am */ | |
| 492 | { flop_12d, DEC_DECODED, "i2apt." }, /* 0x07 pf[m]am */ | |
| 493 | { flop_12d, DEC_DECODED, "rat1p2." }, /* 0x08 pf[m]am */ | |
| 494 | { flop_12d, DEC_DECODED, "m12apm." }, /* 0x09 pf[m]am */ | |
| 495 | { flop_12d, DEC_DECODED, "ra1p2." }, /* 0x0A pf[m]am */ | |
| 496 | { flop_12d, DEC_DECODED, "m12ttpa." }, /* 0x0B pf[m]am */ | |
| 497 | { flop_12d, DEC_DECODED, "iat1p2." }, /* 0x0C pf[m]am */ | |
| 498 | { flop_12d, DEC_DECODED, "m12tpm." }, /* 0x0D pf[m]am */ | |
| 499 | { flop_12d, DEC_DECODED, "ia1p2." }, /* 0x0E pf[m]am */ | |
| 500 | { flop_12d, DEC_DECODED, "m12tpa." }, /* 0x0F pf[m]am */ | |
| 501 | { flop_12d, DEC_DECODED, "r2s1." }, /* 0x10 pf[m]sm */ | |
| 502 | { flop_12d, DEC_DECODED, "r2st." }, /* 0x11 pf[m]sm */ | |
| 503 | { flop_12d, DEC_DECODED, "r2as1." }, /* 0x12 pf[m]sm */ | |
| 504 | { flop_12d, DEC_DECODED, "r2ast." }, /* 0x13 pf[m]sm */ | |
| 505 | { flop_12d, DEC_DECODED, "i2s1." }, /* 0x14 pf[m]sm */ | |
| 506 | { flop_12d, DEC_DECODED, "i2st." }, /* 0x15 pf[m]sm */ | |
| 507 | { flop_12d, DEC_DECODED, "i2as1." }, /* 0x16 pf[m]sm */ | |
| 508 | { flop_12d, DEC_DECODED, "i2ast." }, /* 0x17 pf[m]sm */ | |
| 509 | { flop_12d, DEC_DECODED, "rat1s2." }, /* 0x18 pf[m]sm */ | |
| 510 | { flop_12d, DEC_DECODED, "m12asm." }, /* 0x19 pf[m]sm */ | |
| 511 | { flop_12d, DEC_DECODED, "ra1s2." }, /* 0x1A pf[m]sm */ | |
| 512 | { flop_12d, DEC_DECODED, "m12ttsa." }, /* 0x1B pf[m]sm */ | |
| 513 | { flop_12d, DEC_DECODED, "iat1s2." }, /* 0x1C pf[m]sm */ | |
| 514 | { flop_12d, DEC_DECODED, "m12tsm." }, /* 0x1D pf[m]sm */ | |
| 515 | { flop_12d, DEC_DECODED, "ia1s2." }, /* 0x1E pf[m]sm */ | |
| 516 | { flop_12d, DEC_DECODED, "m12tsa." }, /* 0x1F pf[m]sm */ | |
| 517 | { flop_12d, DEC_DECODED, "fmul." }, /* 0x20 [p]fmul */ | |
| 518 | { flop_12d, DEC_DECODED, "fmlow." }, /* 0x21 fmlow.dd */ | |
| 519 | { flop_2d, DEC_DECODED, "frcp." }, /* 0x22 frcp.{ss,sd,dd} */ | |
| 520 | { flop_2d, DEC_DECODED, "frsqr." }, /* 0x23 frsqr.{ss,sd,dd} */ | |
| 521 | { flop_12d, DEC_DECODED, "pfmul3.dd" }, /* 0x24 pfmul3.dd */ | |
| 522 | { 0, 0 , 0 }, /* 0x25 */ | |
| 523 | { 0, 0 , 0 }, /* 0x26 */ | |
| 524 | { 0, 0 , 0 }, /* 0x27 */ | |
| 525 | { 0, 0 , 0 }, /* 0x28 */ | |
| 526 | { 0, 0 , 0 }, /* 0x29 */ | |
| 527 | { 0, 0 , 0 }, /* 0x2A */ | |
| 528 | { 0, 0 , 0 }, /* 0x2B */ | |
| 529 | { 0, 0 , 0 }, /* 0x2C */ | |
| 530 | { 0, 0 , 0 }, /* 0x2D */ | |
| 531 | { 0, 0 , 0 }, /* 0x2E */ | |
| 532 | { 0, 0 , 0 }, /* 0x2F */ | |
| 533 | { flop_12d, DEC_DECODED, "fadd." }, /* 0x30, [p]fadd.{ss,sd,dd} */ | |
| 534 | { flop_12d, DEC_DECODED, "fsub." }, /* 0x31, [p]fsub.{ss,sd,dd} */ | |
| 535 | { flop_1d, DEC_DECODED, "fix." }, /* 0x32, [p]fix.{ss,sd,dd} */ | |
| 536 | { flop_1d, DEC_DECODED, "famov." }, /* 0x33, [p]famov.{ss,sd,ds,dd} */ | |
| 537 | { flop_12d, DEC_DECODED, "f{gt,le}" }, /* 0x34, pf{gt,le}.{ss,dd} */ | |
| 538 | { flop_12d, DEC_DECODED, "feq." }, /* 0x35, pfeq.{ss,dd} */ | |
| 539 | { 0, 0 , 0 }, /* 0x36 */ | |
| 540 | { 0, 0 , 0 }, /* 0x37 */ | |
| 541 | { 0, 0 , 0 }, /* 0x38 */ | |
| 542 | { 0, 0 , 0 }, /* 0x39 */ | |
| 543 | { flop_1d, DEC_DECODED, "ftrunc." }, /* 0x3A, [p]ftrunc.{ss,sd,dd} */ | |
| 544 | { 0, 0 , 0 }, /* 0x3B */ | |
| 545 | { 0, 0 , 0 }, /* 0x3C */ | |
| 546 | { 0, 0 , 0 }, /* 0x3D */ | |
| 547 | { 0, 0 , 0 }, /* 0x3E */ | |
| 548 | { 0, 0 , 0 }, /* 0x3F */ | |
| 549 | { flop_fxfr, DEC_DECODED, "fxfr" }, /* 0x40, fxfr fsrc1,idest. */ | |
| 550 | { 0, 0 , 0 }, /* 0x41 */ | |
| 551 | { 0, 0 , 0 }, /* 0x42 */ | |
| 552 | { 0, 0 , 0 }, /* 0x43 */ | |
| 553 | { 0, 0 , 0 }, /* 0x44 */ | |
| 554 | { 0, 0 , 0 }, /* 0x45 */ | |
| 555 | { 0, 0 , 0 }, /* 0x46 */ | |
| 556 | { 0, 0 , 0 }, /* 0x47 */ | |
| 557 | { 0, 0 , 0 }, /* 0x48 */ | |
| 558 | { flop_12d, DEC_DECODED, "fiadd." }, /* 0x49, [p]fiadd.{ss,dd} */ | |
| 559 | { 0, 0 , 0 }, /* 0x4A */ | |
| 560 | { 0, 0 , 0 }, /* 0x4B */ | |
| 561 | { 0, 0 , 0 }, /* 0x4C */ | |
| 562 | { flop_12d, DEC_DECODED, "fisub." }, /* 0x4D, [p]fisub.{ss,dd} */ | |
| 563 | { 0, 0 , 0 }, /* 0x4E */ | |
| 564 | { 0, 0 , 0 }, /* 0x4F */ | |
| 565 | { flop_12d, DEC_DECODED, "faddp" }, /* 0x50, [p]faddp */ | |
| 566 | { flop_12d, DEC_DECODED, "faddz" }, /* 0x51, [p]faddz */ | |
| 567 | { 0, 0 , 0 }, /* 0x52 */ | |
| 568 | { 0, 0 , 0 }, /* 0x53 */ | |
| 569 | { 0, 0 , 0 }, /* 0x54 */ | |
| 570 | { 0, 0 , 0 }, /* 0x55 */ | |
| 571 | { 0, 0 , 0 }, /* 0x56 */ | |
| 572 | { flop_12d, DEC_DECODED, "fzchkl" }, /* 0x57, [p]fzchkl */ | |
| 573 | { 0, 0 , 0 }, /* 0x58 */ | |
| 574 | { 0, 0 , 0 }, /* 0x59 */ | |
| 575 | { flop_1d, DEC_DECODED, "form" }, /* 0x5A, [p]form.dd */ | |
| 576 | { 0, 0 , 0 }, /* 0x5B */ | |
| 577 | { 0, 0 , 0 }, /* 0x5C */ | |
| 578 | { 0, 0 , 0 }, /* 0x5D */ | |
| 579 | { 0, 0 , 0 }, /* 0x5E */ | |
| 580 | { flop_12d, DEC_DECODED, "fzchks" }, /* 0x5F, [p]fzchks */ | |
| 581 | { 0, 0 , 0 }, /* 0x60 */ | |
| 582 | { 0, 0 , 0 }, /* 0x61 */ | |
| 583 | { 0, 0 , 0 }, /* 0x62 */ | |
| 584 | { 0, 0 , 0 }, /* 0x63 */ | |
| 585 | { 0, 0 , 0 }, /* 0x64 */ | |
| 586 | { 0, 0 , 0 }, /* 0x65 */ | |
| 587 | { 0, 0 , 0 }, /* 0x66 */ | |
| 588 | { 0, 0 , 0 }, /* 0x67 */ | |
| 589 | { 0, 0 , 0 }, /* 0x68 */ | |
| 590 | { 0, 0 , 0 }, /* 0x69 */ | |
| 591 | { 0, 0 , 0 }, /* 0x6A */ | |
| 592 | { 0, 0 , 0 }, /* 0x6B */ | |
| 593 | { 0, 0 , 0 }, /* 0x6C */ | |
| 594 | { 0, 0 , 0 }, /* 0x6D */ | |
| 595 | { 0, 0 , 0 }, /* 0x6E */ | |
| 596 | { 0, 0 , 0 }, /* 0x6F */ | |
| 597 | { 0, 0 , 0 }, /* 0x70 */ | |
| 598 | { 0, 0 , 0 }, /* 0x71 */ | |
| 599 | { 0, 0 , 0 }, /* 0x72 */ | |
| 600 | { 0, 0 , 0 }, /* 0x73 */ | |
| 601 | { 0, 0 , 0 }, /* 0x74 */ | |
| 602 | { 0, 0 , 0 }, /* 0x75 */ | |
| 603 | { 0, 0 , 0 }, /* 0x76 */ | |
| 604 | { 0, 0 , 0 }, /* 0x77 */ | |
| 605 | { 0, 0 , 0 }, /* 0x78 */ | |
| 606 | { 0, 0 , 0 }, /* 0x79 */ | |
| 607 | { 0, 0 , 0 }, /* 0x7A */ | |
| 608 | { 0, 0 , 0 }, /* 0x7B */ | |
| 609 | { 0, 0 , 0 }, /* 0x7C */ | |
| 610 | { 0, 0 , 0 }, /* 0x7D */ | |
| 611 | { 0, 0 , 0 }, /* 0x7E */ | |
| 612 | { 0, 0 , 0 }, /* 0x7F */ | |
| 613 | }; | |
| 614 | ||
| 615 | ||
| 616 | /* Replaces tabs with spaces. */ | |
| 617 | static void i860_dasm_tab_replacer(char* buf, int tab_size) | |
| 618 | { | |
| 619 | int i = 0; | |
| 620 | int tab_count = 0; | |
| 621 | char tab_buf[1024]; | |
| 622 | memset(tab_buf, 0, 1024); | |
| 623 | ||
| 624 | while (i != strlen(buf)) | |
| 625 | { | |
| 626 | if (buf[i] != '\t') | |
| 627 | { | |
| 628 | tab_buf[tab_count] = buf[i]; | |
| 629 | tab_count++; | |
| 630 | } | |
| 631 | else | |
| 632 | { | |
| 633 | while (tab_count % tab_size != 0) | |
| 634 | { | |
| 635 | strcat(tab_buf, " "); | |
| 636 | tab_count++; | |
| 637 | } | |
| 638 | } | |
| 639 | i++; | |
| 640 | } | |
| 641 | ||
| 642 | tab_buf[tab_count] = 0x00; | |
| 643 | strcpy(buf, tab_buf); | |
| 644 | } | |
| 645 | ||
| 646 | ||
| 647 | /* Entry point for disassembler. */ | |
| 648 | unsigned disasm_i860(char *buf, unsigned pc, UINT32 insn) | |
| 649 | { | |
| 650 | int unrecognized_op = 1; | |
| 651 | int upper_6bits = (insn >> 26) & 0x3f; | |
| 652 | char flags = decode_tbl[upper_6bits].flags; | |
| 653 | if (flags & DEC_DECODED) | |
| 654 | { | |
| 655 | const char *s = decode_tbl[upper_6bits].mnemonic; | |
| 656 | decode_tbl[upper_6bits].insn_dis (buf, (char *)s, pc, insn); | |
| 657 | unrecognized_op = 0; | |
| 658 | } | |
| 659 | else if (flags & DEC_MORE) | |
| 660 | { | |
| 661 | if (upper_6bits == 0x12) | |
| 662 | { | |
| 663 | /* FP instruction format handled here. */ | |
| 664 | char fp_flags = fp_decode_tbl[insn & 0x7f].flags; | |
| 665 | const char *s = fp_decode_tbl[insn & 0x7f].mnemonic; | |
| 666 | if (fp_flags & DEC_DECODED) | |
| 667 | { | |
| 668 | fp_decode_tbl[insn & 0x7f].insn_dis (buf, (char *)s, pc, insn); | |
| 669 | unrecognized_op = 0; | |
| 670 | } | |
| 671 | } | |
| 672 | else if (upper_6bits == 0x13) | |
| 673 | { | |
| 674 | /* Core escape instruction format handled here. */ | |
| 675 | char esc_flags = core_esc_decode_tbl[insn & 0x3].flags; | |
| 676 | const char *s = core_esc_decode_tbl[insn & 0x3].mnemonic; | |
| 677 | if (esc_flags & DEC_DECODED) | |
| 678 | { | |
| 679 | core_esc_decode_tbl[insn & 0x3].insn_dis (buf, (char *)s, pc, insn); | |
| 680 | unrecognized_op = 0; | |
| 681 | } | |
| 682 | } | |
| 683 | } | |
| 684 | ||
| 685 | if (unrecognized_op) | |
| 686 | sprintf (buf, ".long\t%#08x", insn); | |
| 687 | ||
| 688 | /* Replace tabs with spaces */ | |
| 689 | i860_dasm_tab_replacer(buf, 10); | |
| 690 | ||
| 691 | /* Return number of bytes disassembled. */ | |
| 692 | /* MAME dasm flags haven't been added yet */ | |
| 693 | return (4); | |
| 694 | } |
| r4135 | r4136 | |
|---|---|---|
| 1 | /*************************************************************************** | |
| 2 | ||
| 3 | i860.h | |
| 4 | ||
| 5 | Interface file for the Intel i860 emulator. | |
| 6 | ||
| 7 | Copyright (C) 1995-present Jason Eckhardt (jle@rice.edu) | |
| 8 | Released for general non-commercial use under the MAME license | |
| 9 | with the additional requirement that you are free to use and | |
| 10 | redistribute this code in modified or unmodified form, provided | |
| 11 | you list me in the credits. | |
| 12 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 13 | ||
| 14 | ***************************************************************************/ | |
| 15 | ||
| 1 | 16 | #pragma once |
| 2 | 17 | |
| 3 | 18 | #ifndef __I860_H__ |
| r4135 | r4136 | |
| 5 | 20 | |
| 6 | 21 | #include "cpuintrf.h" |
| 7 | 22 | |
| 23 | /*************************************************************************** | |
| 24 | REGISTER ENUMERATION | |
| 25 | ***************************************************************************/ | |
| 26 | ||
| 8 | 27 | enum |
| 9 | 28 | { |
| 10 | I860_PC = 0 | |
| 29 | I860_PC = 1, | |
| 30 | ||
| 31 | I860_FIR, | |
| 32 | I860_PSR, | |
| 33 | I860_DIRBASE, | |
| 34 | I860_DB, | |
| 35 | I860_FSR, | |
| 36 | I860_EPSR, | |
| 37 | ||
| 38 | I860_R0, I860_R1, I860_R2, I860_R3, I860_R4, I860_R5, I860_R6, I860_R7, I860_R8, I860_R9, | |
| 39 | I860_R10, I860_R11, I860_R12, I860_R13, I860_R14, I860_R15, I860_R16, I860_R17, I860_R18, I860_R19, | |
| 40 | I860_R20, I860_R21, I860_R22, I860_R23, I860_R24, I860_R25, I860_R26, I860_R27, I860_R28, I860_R29, | |
| 41 | I860_R30, I860_R31, | |
| 42 | ||
| 43 | I860_F0, I860_F1, I860_F2, I860_F3, I860_F4, I860_F5, I860_F6, I860_F7, I860_F8, I860_F9, | |
| 44 | I860_F10, I860_F11, I860_F12, I860_F13, I860_F14, I860_F15, I860_F16, I860_F17, I860_F18, I860_F19, | |
| 45 | I860_F20, I860_F21, I860_F22, I860_F23, I860_F24, I860_F25, I860_F26, I860_F27, I860_F28, I860_F29, | |
| 46 | I860_F30, I860_F31, | |
| 47 | ||
| 11 | 48 | }; |
| 12 | 49 | |
| 50 | /* Needed for MAME */ | |
| 13 | 51 | CPU_GET_INFO( i860 ); |
| 14 | 52 | #define CPU_I860 CPU_GET_INFO_NAME( i860 ) |
| 15 | 53 | |
| 54 | ||
| 55 | /*************************************************************************** | |
| 56 | STRUCTURES & TYPEDEFS | |
| 57 | ***************************************************************************/ | |
| 58 | ||
| 59 | /* i860 state. */ | |
| 60 | typedef struct { | |
| 61 | /* Integer registers (32 x 32-bits). */ | |
| 62 | UINT32 iregs[32]; | |
| 63 | ||
| 64 | /* Floating point registers (32 x 32-bits, 16 x 64 bits, or 8 x 128 bits). | |
| 65 | When referenced as pairs or quads, the higher numbered registers | |
| 66 | are the upper bits. E.g., double precision f0 is f1:f0. */ | |
| 67 | UINT8 frg[32 * 4]; | |
| 68 | ||
| 69 | /* Control registers (6 x 32-bits). */ | |
| 70 | UINT32 cregs[6]; | |
| 71 | ||
| 72 | /* Program counter (1 x 32-bits). Reset starts at pc=0xffffff00. */ | |
| 73 | UINT32 pc; | |
| 74 | ||
| 75 | /* Special registers (4 x 64-bits). */ | |
| 76 | union | |
| 77 | { | |
| 78 | float s; | |
| 79 | double d; | |
| 80 | } KR, KI, T; | |
| 81 | UINT64 merge; | |
| 82 | ||
| 83 | /* The adder pipeline, always 3 stages. */ | |
| 84 | struct | |
| 85 | { | |
| 86 | /* The stage contents. */ | |
| 87 | union { | |
| 88 | float s; | |
| 89 | double d; | |
| 90 | } val; | |
| 91 | ||
| 92 | /* The stage status bits. */ | |
| 93 | struct { | |
| 94 | /* Adder result precision (1 = dbl, 0 = sgl). */ | |
| 95 | char arp; | |
| 96 | } stat; | |
| 97 | } A[3]; | |
| 98 | ||
| 99 | /* The multiplier pipeline. 3 stages for single precision, 2 stages | |
| 100 | for double precision, and confusing for mixed precision. */ | |
| 101 | struct { | |
| 102 | /* The stage contents. */ | |
| 103 | union { | |
| 104 | float s; | |
| 105 | double d; | |
| 106 | } val; | |
| 107 | ||
| 108 | /* The stage status bits. */ | |
| 109 | struct { | |
| 110 | /* Multiplier result precision (1 = dbl, 0 = sgl). */ | |
| 111 | char mrp; | |
| 112 | } stat; | |
| 113 | } M[3]; | |
| 114 | ||
| 115 | /* The load pipeline, always 3 stages. */ | |
| 116 | struct { | |
| 117 | /* The stage contents. */ | |
| 118 | union { | |
| 119 | float s; | |
| 120 | double d; | |
| 121 | } val; | |
| 122 | ||
| 123 | /* The stage status bits. */ | |
| 124 | struct { | |
| 125 | /* Load result precision (1 = dbl, 0 = sgl). */ | |
| 126 | char lrp; | |
| 127 | } stat; | |
| 128 | } L[3]; | |
| 129 | ||
| 130 | /* The graphics/integer pipeline, always 1 stage. */ | |
| 131 | struct { | |
| 132 | /* The stage contents. */ | |
| 133 | union { | |
| 134 | float s; | |
| 135 | double d; | |
| 136 | } val; | |
| 137 | ||
| 138 | /* The stage status bits. */ | |
| 139 | struct { | |
| 140 | /* Integer/graphics result precision (1 = dbl, 0 = sgl). */ | |
| 141 | char irp; | |
| 142 | } stat; | |
| 143 | } G; | |
| 144 | ||
| 145 | /* Pins. */ | |
| 146 | int pin_bus_hold; | |
| 147 | int pin_reset; | |
| 148 | ||
| 149 | /* | |
| 150 | * Other emulator state. | |
| 151 | */ | |
| 152 | int exiting_readmem; | |
| 153 | int exiting_ifetch; | |
| 154 | ||
| 155 | /* Indicate a control-flow instruction, so we know the PC is updated. */ | |
| 156 | int pc_updated; | |
| 157 | ||
| 158 | /* Indicate an instruction just generated a trap, so we know the PC | |
| 159 | needs to go to the trap address. */ | |
| 160 | int pending_trap; | |
| 161 | ||
| 162 | /* This is 1 if the next fir load gets the trap address, otherwise | |
| 163 | it is 0 to get the ld.c address. This is set to 1 only when a | |
| 164 | non-reset trap occurs. */ | |
| 165 | int fir_gets_trap_addr; | |
| 166 | ||
| 167 | /* Single stepping flag for internal use. */ | |
| 168 | int single_stepping; | |
| 169 | ||
| 170 | /* | |
| 171 | * MAME-specific stuff. | |
| 172 | */ | |
| 173 | const device_config *device; | |
| 174 | const address_space *program; | |
| 175 | UINT32 ppc; | |
| 176 | int icount; | |
| 177 | ||
| 178 | } i860_state_t; | |
| 179 | ||
| 180 | ||
| 181 | /*************************************************************************** | |
| 182 | PUBLIC FUNCTIONS | |
| 183 | ***************************************************************************/ | |
| 184 | ||
| 185 | /* This is the external interface for asserting an external interrupt | |
| 186 | to the i860. */ | |
| 187 | extern void i860_gen_interrupt(i860_state_t*); | |
| 188 | ||
| 189 | /* This is the external interface for asserting/deasserting a pin on | |
| 190 | the i860. */ | |
| 191 | extern void i860_set_pin(i860_state_t*, int, int); | |
| 192 | ||
| 193 | /* Hard or soft reset. */ | |
| 194 | extern void reset_i860(i860_state_t*); | |
| 195 | ||
| 196 | /* i860 pins. */ | |
| 197 | enum { | |
| 198 | DEC_PIN_BUS_HOLD, /* Bus HOLD pin. */ | |
| 199 | DEC_PIN_RESET /* System reset pin. */ | |
| 200 | }; | |
| 201 | ||
| 202 | ||
| 203 | /* TODO: THESE WILL BE REPLACED BY MAME FUNCTIONS | |
| 204 | #define BYTE_REV32(t) \ | |
| 205 | do { \ | |
| 206 | (t) = ((UINT32)(t) >> 16) | ((UINT32)(t) << 16); \ | |
| 207 | (t) = (((UINT32)(t) >> 8) & 0x00ff00ff) | (((UINT32)(t) << 8) & 0xff00ff00); \ | |
| 208 | } while (0); | |
| 209 | ||
| 210 | #define BYTE_REV16(t) \ | |
| 211 | do { \ | |
| 212 | (t) = (((UINT16)(t) >> 8) & 0x00ff) | (((UINT16)(t) << 8) & 0xff00); \ | |
| 213 | } while (0); | |
| 214 | #endif | |
| 215 | */ | |
| 216 | ||
| 16 | 217 | #endif /* __I860_H__ */ |
| 17 | 218 |
| r4135 | r4136 | |
|---|---|---|
| 55 | 55 | |
| 56 | 56 | //SFR Names |
| 57 | 57 | |
| 58 | static struct { | |
| 58 | static const struct { | |
| 59 | 59 | int feature; |
| 60 | 60 | int addr; |
| 61 | 61 | const char *name; |
| r0 | r4136 | |
|---|---|---|
| 1 | /*************************************************************************** | |
| 2 | ||
| 3 | cop400op.c | |
| 4 | ||
| 5 | National Semiconductor COP400 Emulator. | |
| 6 | ||
| 7 | Copyright Nicola Salmoria and the MAME Team. | |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 9 | ||
| 10 | ***************************************************************************/ | |
| 11 | ||
| 12 | /*************************************************************************** | |
| 13 | ARITHMETIC INSTRUCTIONS | |
| 14 | ***************************************************************************/ | |
| 15 | ||
| 16 | /* | |
| 17 | ||
| 18 | Mnemonic: ASC | |
| 19 | ||
| 20 | Hex Code: 30 | |
| 21 | Binary: 0 0 1 1 0 0 0 0 | |
| 22 | ||
| 23 | Data Flow: A + C + RAM(B) -> A | |
| 24 | Carry -> C | |
| 25 | ||
| 26 | Skip Conditions: Carry | |
| 27 | ||
| 28 | Description: Add with Carry, Skip on Carry | |
| 29 | ||
| 30 | */ | |
| 31 | ||
| 32 | INSTRUCTION( asc ) | |
| 33 | { | |
| 34 | A = A + C + RAM_R(B); | |
| 35 | ||
| 36 | if (A > 0xF) | |
| 37 | { | |
| 38 | C = 1; | |
| 39 | cpustate->skip = 1; | |
| 40 | A &= 0xF; | |
| 41 | } | |
| 42 | else | |
| 43 | { | |
| 44 | C = 0; | |
| 45 | } | |
| 46 | } | |
| 47 | ||
| 48 | /* | |
| 49 | ||
| 50 | Mnemonic: ADD | |
| 51 | ||
| 52 | Hex Code: 31 | |
| 53 | Binary: 0 0 1 1 0 0 0 1 | |
| 54 | ||
| 55 | Data Flow: A + RAM(B) -> A | |
| 56 | ||
| 57 | Description: Add RAM to A | |
| 58 | ||
| 59 | */ | |
| 60 | ||
| 61 | INSTRUCTION( add ) | |
| 62 | { | |
| 63 | A = (A + RAM_R(B)) & 0x0F; | |
| 64 | } | |
| 65 | ||
| 66 | /* | |
| 67 | ||
| 68 | Mnemonic: AISC | |
| 69 | ||
| 70 | Operand: y | |
| 71 | Hex Code: 5- | |
| 72 | Binary: 0 1 0 1 y3 y2 y1 y0 | |
| 73 | ||
| 74 | Data Flow: A + y -> A | |
| 75 | ||
| 76 | Skip Conditions: Carry | |
| 77 | ||
| 78 | Description: Add Immediate, Skip on Carry (y != 0) | |
| 79 | ||
| 80 | */ | |
| 81 | ||
| 82 | INSTRUCTION( aisc ) | |
| 83 | { | |
| 84 | UINT8 y = opcode & 0x0f; | |
| 85 | ||
| 86 | A = A + y; | |
| 87 | ||
| 88 | if (A > 0x0f) | |
| 89 | { | |
| 90 | cpustate->skip = 1; | |
| 91 | A &= 0xF; | |
| 92 | } | |
| 93 | } | |
| 94 | ||
| 95 | /* | |
| 96 | ||
| 97 | Mnemonic: CLRA | |
| 98 | ||
| 99 | Hex Code: 00 | |
| 100 | Binary: 0 0 0 0 0 0 0 0 | |
| 101 | ||
| 102 | Data Flow: 0 -> A | |
| 103 | ||
| 104 | Description: Clear A | |
| 105 | ||
| 106 | */ | |
| 107 | ||
| 108 | INSTRUCTION( clra ) | |
| 109 | { | |
| 110 | A = 0; | |
| 111 | } | |
| 112 | ||
| 113 | /* | |
| 114 | ||
| 115 | Mnemonic: COMP | |
| 116 | ||
| 117 | Hex Code: 40 | |
| 118 | Binary: 0 1 0 0 0 0 0 0 | |
| 119 | ||
| 120 | Data Flow: ~A -> A | |
| 121 | ||
| 122 | Description: Ones Complement of A to A | |
| 123 | ||
| 124 | */ | |
| 125 | ||
| 126 | INSTRUCTION( comp ) | |
| 127 | { | |
| 128 | A = A ^ 0xF; | |
| 129 | } | |
| 130 | ||
| 131 | /* | |
| 132 | ||
| 133 | Mnemonic: NOP | |
| 134 | ||
| 135 | Hex Code: 44 | |
| 136 | Binary: 0 1 0 0 0 1 0 0 | |
| 137 | ||
| 138 | Description: No Operation | |
| 139 | ||
| 140 | */ | |
| 141 | ||
| 142 | INSTRUCTION( nop ) | |
| 143 | { | |
| 144 | // do nothing | |
| 145 | } | |
| 146 | ||
| 147 | /* | |
| 148 | ||
| 149 | Mnemonic: RC | |
| 150 | ||
| 151 | Hex Code: 32 | |
| 152 | Binary: 0 0 1 1 0 0 1 0 | |
| 153 | ||
| 154 | Data Flow: "0" -> C | |
| 155 | ||
| 156 | Description: Reset C | |
| 157 | ||
| 158 | */ | |
| 159 | ||
| 160 | INSTRUCTION( rc ) | |
| 161 | { | |
| 162 | C = 0; | |
| 163 | } | |
| 164 | ||
| 165 | /* | |
| 166 | ||
| 167 | Mnemonic: SC | |
| 168 | ||
| 169 | Hex Code: 22 | |
| 170 | Binary: 0 0 1 0 0 0 1 0 | |
| 171 | ||
| 172 | Data Flow: "1" -> C | |
| 173 | ||
| 174 | Description: Set C | |
| 175 | ||
| 176 | */ | |
| 177 | ||
| 178 | INSTRUCTION( sc ) | |
| 179 | { | |
| 180 | C = 1; | |
| 181 | } | |
| 182 | ||
| 183 | /* | |
| 184 | ||
| 185 | Mnemonic: XOR | |
| 186 | ||
| 187 | Hex Code: 02 | |
| 188 | Binary: 0 0 0 0 0 0 1 0 | |
| 189 | ||
| 190 | Data Flow: A ^ RAM(B) -> A | |
| 191 | ||
| 192 | Description: Exclusive-OR RAM with A | |
| 193 | ||
| 194 | */ | |
| 195 | ||
| 196 | INSTRUCTION( xor ) | |
| 197 | { | |
| 198 | A = A ^ RAM_R(B); | |
| 199 | } | |
| 200 | ||
| 201 | /* | |
| 202 | ||
| 203 | Mnemonic: ADT | |
| 204 | ||
| 205 | Hex Code: 4A | |
| 206 | Binary: 0 1 0 0 1 0 1 0 | |
| 207 | ||
| 208 | Data Flow: A + 10 -> A | |
| 209 | ||
| 210 | Description: Add Ten to A | |
| 211 | ||
| 212 | */ | |
| 213 | ||
| 214 | INSTRUCTION( adt ) | |
| 215 | { | |
| 216 | A = (A + 10) & 0x0F; | |
| 217 | } | |
| 218 | ||
| 219 | /* | |
| 220 | ||
| 221 | Mnemonic: CASC | |
| 222 | ||
| 223 | Hex Code: 10 | |
| 224 | Binary: 0 0 0 1 0 0 0 0 | |
| 225 | ||
| 226 | Data Flow: ~A + RAM(B) + C -> A | |
| 227 | Carry -> C | |
| 228 | ||
| 229 | Skip Conditions: Carry | |
| 230 | ||
| 231 | Description: Complement and Add with Carry, Skip on Carry | |
| 232 | ||
| 233 | */ | |
| 234 | ||
| 235 | INSTRUCTION( casc ) | |
| 236 | { | |
| 237 | A = (A ^ 0xF) + RAM_R(B) + C; | |
| 238 | ||
| 239 | if (A > 0xF) | |
| 240 | { | |
| 241 | C = 1; | |
| 242 | cpustate->skip = 1; | |
| 243 | A &= 0xF; | |
| 244 | } | |
| 245 | else | |
| 246 | { | |
| 247 | C = 0; | |
| 248 | } | |
| 249 | } | |
| 250 | ||
| 251 | /*************************************************************************** | |
| 252 | TRANSFER-OF-CONTROL INSTRUCTIONS | |
| 253 | ***************************************************************************/ | |
| 254 | ||
| 255 | /* | |
| 256 | ||
| 257 | Mnemonic: JID | |
| 258 | ||
| 259 | Hex Code: FF | |
| 260 | Binary: 1 1 1 1 1 1 1 1 | |
| 261 | ||
| 262 | Data Flow: ROM(PC10:8,A,M) -> PC7:0 | |
| 263 | ||
| 264 | Description: Jump Indirect | |
| 265 | ||
| 266 | */ | |
| 267 | ||
| 268 | INSTRUCTION( jid ) | |
| 269 | { | |
| 270 | UINT16 addr = (PC & 0x700) | (A << 4) | RAM_R(B); | |
| 271 | PC = (PC & 0x700) | ROM(addr); | |
| 272 | } | |
| 273 | ||
| 274 | /* | |
| 275 | ||
| 276 | Mnemonic: JMP | |
| 277 | ||
| 278 | Operand: a | |
| 279 | Hex Code: 6- -- | |
| 280 | Binary: 0 1 1 0 0 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 | |
| 281 | ||
| 282 | Data Flow: a -> PC | |
| 283 | ||
| 284 | Description: Jump | |
| 285 | ||
| 286 | */ | |
| 287 | ||
| 288 | INSTRUCTION( jmp ) | |
| 289 | { | |
| 290 | UINT16 a = ((opcode & 0x07) << 8) | ROM(PC); | |
| 291 | ||
| 292 | PC = a; | |
| 293 | } | |
| 294 | ||
| 295 | /* | |
| 296 | ||
| 297 | Mnemonic: JP | |
| 298 | ||
| 299 | Operand: a | |
| 300 | Hex Code: -- | |
| 301 | Binary: 1 a6 a5 a4 a3 a2 a1 a0 | |
| 302 | (pages 2,3 only) | |
| 303 | ||
| 304 | 1 1 a5 a4 a3 a2 a1 a0 | |
| 305 | (all other pages) | |
| 306 | ||
| 307 | Data Flow: a -> PC6:0 | |
| 308 | ||
| 309 | a -> PC5:0 | |
| 310 | ||
| 311 | Description: Jump within Page | |
| 312 | ||
| 313 | */ | |
| 314 | ||
| 315 | INSTRUCTION( jp ) | |
| 316 | { | |
| 317 | UINT8 page = PC >> 6; | |
| 318 | ||
| 319 | if (page == 2 || page == 3) | |
| 320 | { | |
| 321 | UINT8 a = opcode & 0x7f; | |
| 322 | PC = (PC & 0x780) | a; | |
| 323 | } | |
| 324 | else if ((opcode & 0xc0) == 0xc0) | |
| 325 | { | |
| 326 | UINT8 a = opcode & 0x3f; | |
| 327 | PC = (PC & 0x7c0) | a; | |
| 328 | } | |
| 329 | else | |
| 330 | { | |
| 331 | // JSRP | |
| 332 | UINT8 a = opcode & 0x3f; | |
| 333 | PUSH(cpustate, PC); | |
| 334 | PC = 0x80 | a; | |
| 335 | } | |
| 336 | } | |
| 337 | ||
| 338 | /* | |
| 339 | ||
| 340 | Mnemonic: JSR | |
| 341 | ||
| 342 | Operand: a | |
| 343 | Hex Code: 6- -- | |
| 344 | Binary: 0 1 1 0 1 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 | |
| 345 | ||
| 346 | Data Flow: PC + 1 -> SA -> SB -> SC | |
| 347 | a -> PC | |
| 348 | ||
| 349 | Description: Jump to Subroutine | |
| 350 | ||
| 351 | */ | |
| 352 | ||
| 353 | INSTRUCTION( jsr ) | |
| 354 | { | |
| 355 | UINT16 a = ((opcode & 0x07) << 8) | ROM(PC); | |
| 356 | ||
| 357 | PUSH(cpustate, PC + 1); | |
| 358 | PC = a; | |
| 359 | } | |
| 360 | ||
| 361 | /* | |
| 362 | ||
| 363 | Mnemonic: RET | |
| 364 | ||
| 365 | Hex Code: 48 | |
| 366 | Binary: 0 1 0 0 1 0 0 0 | |
| 367 | ||
| 368 | Data Flow: SC -> SB -> SA -> PC | |
| 369 | ||
| 370 | Description: Return from Subroutine | |
| 371 | ||
| 372 | */ | |
| 373 | ||
| 374 | INSTRUCTION( ret ) | |
| 375 | { | |
| 376 | POP(cpustate); | |
| 377 | } | |
| 378 | ||
| 379 | /* | |
| 380 | ||
| 381 | Processor: COP420 | |
| 382 | ||
| 383 | Mnemonic: RET | |
| 384 | ||
| 385 | Hex Code: 48 | |
| 386 | Binary: 0 1 0 0 1 0 0 0 | |
| 387 | ||
| 388 | Data Flow: SC -> SB -> SA -> PC | |
| 389 | ||
| 390 | Description: Return from Subroutine, restore Skip logic | |
| 391 | ||
| 392 | */ | |
| 393 | ||
| 394 | INSTRUCTION( cop420_ret ) | |
| 395 | { | |
| 396 | POP(cpustate); | |
| 397 | cpustate->skip = cpustate->last_skip; | |
| 398 | } | |
| 399 | ||
| 400 | /* | |
| 401 | ||
| 402 | Mnemonic: RETSK | |
| 403 | ||
| 404 | Hex Code: 49 | |
| 405 | Binary: 0 1 0 0 1 0 0 1 | |
| 406 | ||
| 407 | Data Flow: SC -> SB -> SA -> PC | |
| 408 | ||
| 409 | Skip Conditions: Always Skip on Return | |
| 410 | ||
| 411 | Description: Return from Subroutine then Skip | |
| 412 | ||
| 413 | */ | |
| 414 | ||
| 415 | INSTRUCTION( retsk ) | |
| 416 | { | |
| 417 | POP(cpustate); | |
| 418 | cpustate->skip = 1; | |
| 419 | } | |
| 420 | ||
| 421 | /* | |
| 422 | ||
| 423 | Processor: COP410C/COP411C | |
| 424 | ||
| 425 | Mnemonic: HALT | |
| 426 | ||
| 427 | Hex Code: 33 38 | |
| 428 | Binary: 0 0 1 1 0 0 1 1 0 0 1 1 1 0 0 0 | |
| 429 | ||
| 430 | Description: Halt processor | |
| 431 | ||
| 432 | */ | |
| 433 | ||
| 434 | INSTRUCTION( halt ) | |
| 435 | { | |
| 436 | cpustate->halt = 1; | |
| 437 | } | |
| 438 | ||
| 439 | /* | |
| 440 | ||
| 441 | Mnemonic: IT | |
| 442 | ||
| 443 | Hex Code: 33 39 | |
| 444 | Binary: 0 0 1 1 0 0 1 1 0 0 1 1 1 0 0 1 | |
| 445 | ||
| 446 | Description: IDLE till Timer Overflows then Continues | |
| 447 | ||
| 448 | */ | |
| 449 | ||
| 450 | INSTRUCTION( it ) | |
| 451 | { | |
| 452 | cpustate->halt = 1; | |
| 453 | cpustate->idle = 1; | |
| 454 | } | |
| 455 | ||
| 456 | /*************************************************************************** | |
| 457 | MEMORY REFERENCE INSTRUCTIONS | |
| 458 | ***************************************************************************/ | |
| 459 | ||
| 460 | /* | |
| 461 | ||
| 462 | Mnemonic: CAMQ | |
| 463 | ||
| 464 | Hex Code: 33 3C | |
| 465 | Binary: 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0 | |
| 466 | ||
| 467 | Data Flow: A -> Q7:4 | |
| 468 | RAM(B) -> Q3:0 | |
| 469 | ||
| 470 | Description: Copy A, RAM to Q | |
| 471 | ||
| 472 | */ | |
| 473 | ||
| 474 | INSTRUCTION( camq ) | |
| 475 | { | |
| 476 | /* | |
| 477 | ||
| 478 | Excerpt from the COP410L data sheet: | |
| 479 | ||
| 480 | False states may be generated on L0-L7 during the execution of the CAMQ instruction. | |
| 481 | The L-ports should not be used as clocks for edge sensitive devices such as flip-flops, | |
| 482 | counters, shift registers, etc. the following short program that illustrates this situation. | |
| 483 | ||
| 484 | START: | |
| 485 | CLRA ;ENABLE THE Q | |
| 486 | LEI 4 ;REGISTER TO L LINES | |
| 487 | LBI TEST | |
| 488 | STII 3 | |
| 489 | AISC 12 | |
| 490 | LOOP: | |
| 491 | LBI TEST ;LOAD Q WITH X'C3 | |
| 492 | CAMQ | |
| 493 | JP LOOP | |
| 494 | ||
| 495 | In this program the internal Q register is enabled onto the L lines and a steady bit | |
| 496 | pattern of logic highs is output on L0, L1, L6, L7, and logic lows on L2-L5 via the | |
| 497 | two-byte CAMQ instruction. Timing constraints on the device are such that the Q | |
| 498 | register may be temporarily loaded with the second byte of the CAMQ opcode (3C) prior | |
| 499 | to receiving the valid data pattern. If this occurs, the opcode will ripple onto the L | |
| 500 | lines and cause negative-going glitches on L0, L1, L6, L7, and positive glitches on | |
| 501 | L2-L5. Glitch durations are under 2 ms, although the exact value may vary due to data | |
| 502 | patterns, processing parameters, and L line loading. These false states are peculiar | |
| 503 | only to the CAMQ instruction and the L lines. | |
| 504 | ||
| 505 | */ | |
| 506 | ||
| 507 | UINT8 data = (A << 4) | RAM_R(B); | |
| 508 | ||
| 509 | WRITE_Q(cpustate, data); | |
| 510 | ||
| 511 | #ifdef CAMQ_BUG | |
| 512 | WRITE_Q(cpustate, 0x3c); | |
| 513 | WRITE_Q(cpustate, data); | |
| 514 | #endif | |
| 515 | } | |
| 516 | ||
| 517 | /* | |
| 518 | ||
| 519 | Mnemonic: LD | |
| 520 | ||
| 521 | Operand: r | |
| 522 | Hex Code: -5 | |
| 523 | Binary: 0 0 r1 r0 0 1 0 1 | |
| 524 | ||
| 525 | Data Flow: RAM(B) -> A | |
| 526 | Br ^ r -> Br | |
| 527 | ||
| 528 | Description: Load RAM into A, Exclusive-OR Br with r | |
| 529 | ||
| 530 | */ | |
| 531 | ||
| 532 | INSTRUCTION( ld ) | |
| 533 | { | |
| 534 | UINT8 r = opcode & 0x30; | |
| 535 | ||
| 536 | A = RAM_R(B); | |
| 537 | B = B ^ r; | |
| 538 | } | |
| 539 | ||
| 540 | /* | |
| 541 | ||
| 542 | Mnemonic: LQID | |
| 543 | ||
| 544 | Hex Code: BF | |
| 545 | Binary: 1 0 1 1 1 1 1 1 | |
| 546 | ||
| 547 | Data Flow: ROM(PC10:8,A,M) -> Q | |
| 548 | SB -> SC | |
| 549 | ||
| 550 | Description: Load Q Indirect | |
| 551 | ||
| 552 | */ | |
| 553 | ||
| 554 | INSTRUCTION( lqid ) | |
| 555 | { | |
| 556 | PUSH(cpustate, PC); | |
| 557 | PC = (PC & 0x700) | (A << 4) | RAM_R(B); | |
| 558 | WRITE_Q(cpustate, ROM(PC)); | |
| 559 | POP(cpustate); | |
| 560 | } | |
| 561 | ||
| 562 | /* | |
| 563 | ||
| 564 | Mnemonic: RMB | |
| 565 | ||
| 566 | Operand: 0 | |
| 567 | 1 | |
| 568 | 2 | |
| 569 | 3 | |
| 570 | ||
| 571 | Hex Code: 4C | |
| 572 | 45 | |
| 573 | 42 | |
| 574 | 43 | |
| 575 | ||
| 576 | Binary: 0 1 0 0 1 1 0 0 | |
| 577 | 0 1 0 0 0 1 0 1 | |
| 578 | 0 1 0 0 0 0 1 0 | |
| 579 | 0 1 0 0 0 0 1 1 | |
| 580 | ||
| 581 | Data Flow: 0 -> RAM(B)0 | |
| 582 | 0 -> RAM(B)1 | |
| 583 | 0 -> RAM(B)2 | |
| 584 | 0 -> RAM(B)3 | |
| 585 | ||
| 586 | Description: Reset RAM Bit | |
| 587 | ||
| 588 | */ | |
| 589 | ||
| 590 | INSTRUCTION( rmb0 ) { RAM_W(B, RAM_R(B) & 0xE); } | |
| 591 | INSTRUCTION( rmb1 ) { RAM_W(B, RAM_R(B) & 0xD); } | |
| 592 | INSTRUCTION( rmb2 ) { RAM_W(B, RAM_R(B) & 0xB); } | |
| 593 | INSTRUCTION( rmb3 ) { RAM_W(B, RAM_R(B) & 0x7); } | |
| 594 | ||
| 595 | /* | |
| 596 | ||
| 597 | Mnemonic: SMB | |
| 598 | ||
| 599 | Operand: 0 | |
| 600 | 1 | |
| 601 | 2 | |
| 602 | 3 | |
| 603 | ||
| 604 | Hex Code: 4D | |
| 605 | 47 | |
| 606 | 46 | |
| 607 | 4B | |
| 608 | ||
| 609 | Binary: 0 1 0 0 1 1 0 1 | |
| 610 | 0 1 0 0 0 1 1 1 | |
| 611 | 0 1 0 0 0 1 1 0 | |
| 612 | 0 1 0 0 1 0 1 1 | |
| 613 | ||
| 614 | Data Flow: 1 -> RAM(B)0 | |
| 615 | 1 -> RAM(B)1 | |
| 616 | 1 -> RAM(B)2 | |
| 617 | 1 -> RAM(B)3 | |
| 618 | ||
| 619 | Description: Set RAM Bit | |
| 620 | ||
| 621 | */ | |
| 622 | ||
| 623 | INSTRUCTION( smb0 ) { RAM_W(B, RAM_R(B) | 0x1); } | |
| 624 | INSTRUCTION( smb1 ) { RAM_W(B, RAM_R(B) | 0x2); } | |
| 625 | INSTRUCTION( smb2 ) { RAM_W(B, RAM_R(B) | 0x4); } | |
| 626 | INSTRUCTION( smb3 ) { RAM_W(B, RAM_R(B) | 0x8); } | |
| 627 | ||
| 628 | /* | |
| 629 | ||
| 630 | Mnemonic: STII | |
| 631 | ||
| 632 | Operand: y | |
| 633 | Hex Code: 7- | |
| 634 | Binary: 0 1 1 1 y3 y2 y1 y0 | |
| 635 | ||
| 636 | Data Flow: y -> RAM(B) | |
| 637 | Bd + 1 -> Bd | |
| 638 | ||
| 639 | Description: Store Memory Immediate and Increment Bd | |
| 640 | ||
| 641 | */ | |
| 642 | ||
| 643 | INSTRUCTION( stii ) | |
| 644 | { | |
| 645 | UINT8 y = opcode & 0x0f; | |
| 646 | UINT16 Bd; | |
| 647 | ||
| 648 | RAM_W(B, y); | |
| 649 | ||
| 650 | Bd = ((B & 0x0f) + 1) & 0x0f; | |
| 651 | B = (B & 0x70) + Bd; | |
| 652 | } | |
| 653 | ||
| 654 | /* | |
| 655 | ||
| 656 | Mnemonic: X | |
| 657 | ||
| 658 | Operand: r | |
| 659 | Hex Code: -6 | |
| 660 | Binary: 0 0 r1 r0 0 1 1 0 | |
| 661 | ||
| 662 | Data Flow: RAM(B) <-> A | |
| 663 | Br ^ r -> Br | |
| 664 | ||
| 665 | Description: Exchange RAM with A, Exclusive-OR Br with r | |
| 666 | ||
| 667 | */ | |
| 668 | ||
| 669 | INSTRUCTION( x ) | |
| 670 | { | |
| 671 | UINT8 r = opcode & 0x30; | |
| 672 | UINT8 t = RAM_R(B); | |
| 673 | ||
| 674 | RAM_W(B, A); | |
| 675 | ||
| 676 | A = t; | |
| 677 | B = B ^ r; | |
| 678 | } | |
| 679 | ||
| 680 | /* | |
| 681 | ||
| 682 | Mnemonic: XAD | |
| 683 | ||
| 684 | Operand: r,d | |
| 685 | Hex Code: 23 -- | |
| 686 | Binary: 0 0 1 0 0 0 1 1 1 r2 r1 r0 d3 d2 d1 d0 | |
| 687 | ||
| 688 | Data Flow: RAM(r,d) <-> A | |
| 689 | ||
| 690 | Description: Exchange A with RAM pointed to directly by r,d | |
| 691 | ||
| 692 | */ | |
| 693 | ||
| 694 | INSTRUCTION( xad ) | |
| 695 | { | |
| 696 | UINT8 rd = opcode & 0x7f; | |
| 697 | UINT8 t = A; | |
| 698 | ||
| 699 | A = RAM_R(rd); | |
| 700 | ||
| 701 | RAM_W(rd, t); | |
| 702 | } | |
| 703 | ||
| 704 | /* | |
| 705 | ||
| 706 | Mnemonic: XDS | |
| 707 | ||
| 708 | Operand: r | |
| 709 | Hex Code: -7 | |
| 710 | Binary: 0 0 r1 r0 0 1 1 1 | |
| 711 | ||
| 712 | Data Flow: RAM(B) <-> A | |
| 713 | Bd - 1 -> Bd | |
| 714 | Br ^ r -> Br | |
| 715 | ||
| 716 | Skip Conditions: Bd decrements past 0 | |
| 717 | ||
| 718 | Description: Exchange RAM with A and Decrement Bd, Exclusive-OR Br with r | |
| 719 | ||
| 720 | */ | |
| 721 | ||
| 722 | INSTRUCTION( xds ) | |
| 723 | { | |
| 724 | UINT8 t, Bd; | |
| 725 | UINT8 r = opcode & 0x30; | |
| 726 | ||
| 727 | t = RAM_R(B); | |
| 728 | RAM_W(B, A); | |
| 729 | A = t; | |
| 730 | ||
| 731 | Bd = ((B & 0x0f) - 1) & 0x0f; | |
| 732 | B = (B & 0x30) | Bd; | |
| 733 | ||
| 734 | B = B ^ r; | |
| 735 | ||
| 736 | if (Bd == 0x0f) cpustate->skip = 1; | |
| 737 | } | |
| 738 | ||
| 739 | /* | |
| 740 | ||
| 741 | Mnemonic: XIS | |
| 742 | ||
| 743 | Operand: r | |
| 744 | Hex Code: -4 | |
| 745 | Binary: 0 0 r1 r0 0 1 0 0 | |
| 746 | ||
| 747 | Data Flow: RAM(B) <-> A | |
| 748 | Bd + 1 -> Bd | |
| 749 | Br ^ r -> Br | |
| 750 | ||
| 751 | Skip Conditions: Bd increments past 15 | |
| 752 | ||
| 753 | Description: Exchange RAM with A and Increment Bd, Exclusive-OR Br with r | |
| 754 | ||
| 755 | */ | |
| 756 | ||
| 757 | INSTRUCTION( xis ) | |
| 758 | { | |
| 759 | UINT8 t, Bd; | |
| 760 | UINT8 r = opcode & 0x30; | |
| 761 | ||
| 762 | t = RAM_R(B); | |
| 763 | RAM_W(B, A); | |
| 764 | A = t; | |
| 765 | ||
| 766 | Bd = ((B & 0x0f) + 1) & 0x0f; | |
| 767 | B = (B & 0x30) | Bd; | |
| 768 | ||
| 769 | B = B ^ r; | |
| 770 | ||
| 771 | if (Bd == 0x00) cpustate->skip = 1; | |
| 772 | } | |
| 773 | ||
| 774 | /* | |
| 775 | ||
| 776 | Mnemonic: CQMA | |
| 777 | ||
| 778 | Hex Code: 33 2C | |
| 779 | Binary: 0 0 1 1 0 0 1 1 0 0 1 0 1 1 0 0 | |
| 780 | ||
| 781 | Data Flow: Q7:4 -> RAM(B) | |
| 782 | Q3:0 -> A | |
| 783 | ||
| 784 | Description: Copy Q to RAM, A | |
| 785 | ||
| 786 | */ | |
| 787 | ||
| 788 | INSTRUCTION( cqma ) | |
| 789 | { | |
| 790 | RAM_W(B, Q >> 4); | |
| 791 | A = Q & 0xF; | |
| 792 | } | |
| 793 | ||
| 794 | /* | |
| 795 | ||
| 796 | Mnemonic: LDD | |
| 797 | ||
| 798 | Operand: r, d | |
| 799 | Hex Code: 23 -- | |
| 800 | Binary: 0 0 1 0 0 0 1 1 0 r2 r1 r0 d3 d2 d1 d0 | |
| 801 | ||
| 802 | Data Flow: RAM(r,d) -> A | |
| 803 | ||
| 804 | Description: Load A with RAM pointed to directly by r,d | |
| 805 | ||
| 806 | */ | |
| 807 | ||
| 808 | INSTRUCTION( ldd ) | |
| 809 | { | |
| 810 | UINT8 rd = opcode & 0x7f; | |
| 811 | ||
| 812 | A = RAM_R(rd); | |
| 813 | } | |
| 814 | ||
| 815 | /* | |
| 816 | ||
| 817 | Mnemonic: CAMT | |
| 818 | ||
| 819 | Hex Code: 33 3F | |
| 820 | Binary: | |
| 821 | ||
| 822 | Data Flow: A -> T7:4 | |
| 823 | RAM(B) -> T3:0 | |
| 824 | ||
| 825 | Description: Copy A, RAM to T | |
| 826 | ||
| 827 | */ | |
| 828 | ||
| 829 | INSTRUCTION( camt ) | |
| 830 | { | |
| 831 | T = (A << 4) | RAM_R(B); | |
| 832 | } | |
| 833 | /* | |
| 834 | ||
| 835 | Mnemonic: CTMA | |
| 836 | ||
| 837 | Hex Code: 33 2F | |
| 838 | Binary: | |
| 839 | ||
| 840 | Data Flow: T7:4 -> RAM(B) | |
| 841 | T3:0 -> A | |
| 842 | ||
| 843 | Description: Copy T to RAM, A | |
| 844 | ||
| 845 | */ | |
| 846 | ||
| 847 | INSTRUCTION( ctma ) | |
| 848 | { | |
| 849 | RAM_W(B, T >> 4); | |
| 850 | A = T & 0x0f; | |
| 851 | } | |
| 852 | ||
| 853 | /*************************************************************************** | |
| 854 | REGISTER REFERENCE INSTRUCTIONS | |
| 855 | ***************************************************************************/ | |
| 856 | ||
| 857 | /* | |
| 858 | ||
| 859 | Mnemonic: CAB | |
| 860 | ||
| 861 | Hex Code: 50 | |
| 862 | Binary: 0 1 0 1 0 0 0 0 0 | |
| 863 | ||
| 864 | Data Flow: A -> Bd | |
| 865 | ||
| 866 | Description: Copy A to Bd | |
| 867 | ||
| 868 | */ | |
| 869 | ||
| 870 | INSTRUCTION( cab ) | |
| 871 | { | |
| 872 | B = (B & 0x70) | A; | |
| 873 | } | |
| 874 | ||
| 875 | /* | |
| 876 | ||
| 877 | Mnemonic: CBA | |
| 878 | ||
| 879 | Hex Code: 4E | |
| 880 | Binary: 0 1 0 0 1 1 1 0 | |
| 881 | ||
| 882 | Data Flow: Bd -> A | |
| 883 | ||
| 884 | Description: Copy Bd to A | |
| 885 | ||
| 886 | */ | |
| 887 | ||
| 888 | INSTRUCTION( cba ) | |
| 889 | { | |
| 890 | A = B & 0xF; | |
| 891 | } | |
| 892 | ||
| 893 | /* | |
| 894 | ||
| 895 | Mnemonic: LBI | |
| 896 | ||
| 897 | Operand: r,d | |
| 898 | Hex Code: -- | |
| 899 | 33 -- | |
| 900 | ||
| 901 | Binary: 0 0 r1 r0 d3 d2 d1 d0 (d-1) | |
| 902 | 0 0 1 1 0 0 1 1 1 r2 r1 r0 d3 d2 d1 d0 | |
| 903 | ||
| 904 | Data Flow: r,d -> B | |
| 905 | ||
| 906 | Skip Conditions: Skip until not a LBI | |
| 907 | ||
| 908 | Description: Load B Immediate with r,d | |
| 909 | ||
| 910 | */ | |
| 911 | ||
| 912 | INSTRUCTION( lbi ) | |
| 913 | { | |
| 914 | if (opcode & 0x80) | |
| 915 | { | |
| 916 | B = opcode & 0x3f; | |
| 917 | } | |
| 918 | else | |
| 919 | { | |
| 920 | B = (opcode & 0x70) | (((opcode & 0x0f) + 1) & 0x0f); | |
| 921 | } | |
| 922 | ||
| 923 | cpustate->skip_lbi = 1; | |
| 924 | } | |
| 925 | ||
| 926 | /* | |
| 927 | ||
| 928 | Mnemonic: LEI | |
| 929 | ||
| 930 | Operand: y | |
| 931 | Hex Code: 33 6- | |
| 932 | Binary: 0 0 1 1 0 0 1 1 0 1 1 0 y3 y2 y1 y0 | |
| 933 | ||
| 934 | Data Flow: y -> EN | |
| 935 | ||
| 936 | Description: Load EN Immediate | |
| 937 | ||
| 938 | */ | |
| 939 | ||
| 940 | INSTRUCTION( lei ) | |
| 941 | { | |
| 942 | UINT8 y = opcode & 0x0f; | |
| 943 | ||
| 944 | EN = y; | |
| 945 | ||
| 946 | if (BIT(EN, 2)) | |
| 947 | { | |
| 948 | OUT_L(Q); | |
| 949 | } | |
| 950 | } | |
| 951 | ||
| 952 | /* | |
| 953 | ||
| 954 | Mnemonic: XABR | |
| 955 | ||
| 956 | Hex Code: 12 | |
| 957 | Binary: 0 0 0 1 0 0 1 0 | |
| 958 | ||
| 959 | Data Flow: A <-> Br(0,0 -> A3,A2) | |
| 960 | ||
| 961 | Description: Exchange A with Br | |
| 962 | ||
| 963 | */ | |
| 964 | ||
| 965 | INSTRUCTION( xabr ) | |
| 966 | { | |
| 967 | UINT8 Br = A & 0x03; | |
| 968 | UINT8 Bd = B & 0x0f; | |
| 969 | ||
| 970 | A = B >> 4; | |
| 971 | B = (Br << 4) + Bd; | |
| 972 | } | |
| 973 | ||
| 974 | /* | |
| 975 | ||
| 976 | Processor: COP444 | |
| 977 | ||
| 978 | Mnemonic: XABR | |
| 979 | ||
| 980 | Hex Code: 12 | |
| 981 | Binary: 0 0 0 1 0 0 1 0 | |
| 982 | ||
| 983 | Data Flow: A <-> Br(0 -> A3) | |
| 984 | ||
| 985 | Description: Exchange A with Br | |
| 986 | ||
| 987 | */ | |
| 988 | ||
| 989 | INSTRUCTION( cop444_xabr ) | |
| 990 | { | |
| 991 | UINT8 Br = A & 0x07; | |
| 992 | UINT8 Bd = B & 0x0f; | |
| 993 | ||
| 994 | A = B >> 4; | |
| 995 | B = (Br << 4) + Bd; | |
| 996 | } | |
| 997 | ||
| 998 | /*************************************************************************** | |
| 999 | TEST INSTRUCTIONS | |
| 1000 | ***************************************************************************/ | |
| 1001 | ||
| 1002 | /* | |
| 1003 | ||
| 1004 | Mnemonic: SKC | |
| 1005 | ||
| 1006 | Hex Code: 20 | |
| 1007 | Binary: 0 0 1 0 0 0 0 0 | |
| 1008 | ||
| 1009 | Skip Conditions: C = "1" | |
| 1010 | ||
| 1011 | Description: Skip if C is True | |
| 1012 | ||
| 1013 | */ | |
| 1014 | ||
| 1015 | INSTRUCTION( skc ) | |
| 1016 | { | |
| 1017 | if (C == 1) cpustate->skip = 1; | |
| 1018 | } | |
| 1019 | ||
| 1020 | /* | |
| 1021 | ||
| 1022 | Mnemonic: SKE | |
| 1023 | ||
| 1024 | Hex Code: 21 | |
| 1025 | Binary: 0 0 1 0 0 0 0 1 | |
| 1026 | ||
| 1027 | Skip Conditions: A = RAM(B) | |
| 1028 | ||
| 1029 | Description: Skip if A Equals RAM | |
| 1030 | ||
| 1031 | */ | |
| 1032 | ||
| 1033 | INSTRUCTION( ske ) | |
| 1034 | { | |
| 1035 | if (A == RAM_R(B)) cpustate->skip = 1; | |
| 1036 | } | |
| 1037 | ||
| 1038 | /* | |
| 1039 | ||
| 1040 | Mnemonic: SKGZ | |
| 1041 | ||
| 1042 | Hex Code: 33 21 | |
| 1043 | Binary: 00 0 1 1 0 0 1 1 0 0 1 0 0 0 0 1 | |
| 1044 | ||
| 1045 | Skip Conditions: G3:0 = 0 | |
| 1046 | ||
| 1047 | Description: Skip if G is Zero (all 4 bits) | |
| 1048 | ||
| 1049 | */ | |
| 1050 | ||
| 1051 | INSTRUCTION( skgz ) | |
| 1052 | { | |
| 1053 | if (IN_G() == 0) cpustate->skip = 1; | |
| 1054 | } | |
| 1055 | ||
| 1056 | /* | |
| 1057 | ||
| 1058 | Mnemonic: SKGBZ | |
| 1059 | ||
| 1060 | Hex Code: 33 01 | |
| 1061 | 33 11 | |
| 1062 | 33 03 | |
| 1063 | 33 13 | |
| 1064 | ||
| 1065 | Binary: | |
| 1066 | ||
| 1067 | Skip Conditions: G0 = 0 | |
| 1068 | G1 = 0 | |
| 1069 | G2 = 0 | |
| 1070 | G3 = 0 | |
| 1071 | ||
| 1072 | Description: Skip if G Bit is Zero | |
| 1073 | ||
| 1074 | */ | |
| 1075 | ||
| 1076 | INLINE void skgbz(cop400_state *cpustate, int bit) | |
| 1077 | { | |
| 1078 | if (!BIT(IN_G(), bit)) cpustate->skip = 1; | |
| 1079 | } | |
| 1080 | ||
| 1081 | INSTRUCTION( skgbz0 ) { skgbz(cpustate, 0); } | |
| 1082 | INSTRUCTION( skgbz1 ) { skgbz(cpustate, 1); } | |
| 1083 | INSTRUCTION( skgbz2 ) { skgbz(cpustate, 2); } | |
| 1084 | INSTRUCTION( skgbz3 ) { skgbz(cpustate, 3); } | |
| 1085 | ||
| 1086 | /* | |
| 1087 | ||
| 1088 | Mnemonic: SKMBZ | |
| 1089 | ||
| 1090 | Hex Code: 01 | |
| 1091 | 11 | |
| 1092 | 03 | |
| 1093 | 13 | |
| 1094 | ||
| 1095 | Binary: | |
| 1096 | ||
| 1097 | Skip Conditions: RAM(B)0 = 0 | |
| 1098 | RAM(B)0 = 1 | |
| 1099 | RAM(B)0 = 2 | |
| 1100 | RAM(B)0 = 3 | |
| 1101 | ||
| 1102 | Description: Skip if RAM Bit is Zero | |
| 1103 | ||
| 1104 | */ | |
| 1105 | ||
| 1106 | INLINE void skmbz(cop400_state *cpustate, int bit) | |
| 1107 | { | |
| 1108 | if (!BIT(RAM_R(B), bit)) cpustate->skip = 1; | |
| 1109 | } | |
| 1110 | ||
| 1111 | INSTRUCTION( skmbz0 ) { skmbz(cpustate, 0); } | |
| 1112 | INSTRUCTION( skmbz1 ) { skmbz(cpustate, 1); } | |
| 1113 | INSTRUCTION( skmbz2 ) { skmbz(cpustate, 2); } | |
| 1114 | INSTRUCTION( skmbz3 ) { skmbz(cpustate, 3); } | |
| 1115 | ||
| 1116 | /* | |
| 1117 | ||
| 1118 | Mnemonic: SKT | |
| 1119 | ||
| 1120 | Hex Code: 41 | |
| 1121 | Binary: 0 1 0 0 0 0 0 1 | |
| 1122 | ||
| 1123 | Skip Conditions: A time-base counter carry has occurred since last test | |
| 1124 | ||
| 1125 | Description: Skip on Timer | |
| 1126 | ||
| 1127 | */ | |
| 1128 | ||
| 1129 | INSTRUCTION( skt ) | |
| 1130 | { | |
| 1131 | if (cpustate->skt_latch) | |
| 1132 | { | |
| 1133 | cpustate->skt_latch = 0; | |
| 1134 | cpustate->skip = 1; | |
| 1135 | } | |
| 1136 | } | |
| 1137 | ||
| 1138 | /*************************************************************************** | |
| 1139 | INPUT/OUTPUT INSTRUCTIONS | |
| 1140 | ***************************************************************************/ | |
| 1141 | ||
| 1142 | /* | |
| 1143 | ||
| 1144 | Mnemonic: ING | |
| 1145 | ||
| 1146 | Hex Code: 33 2A | |
| 1147 | Binary: | |
| 1148 | ||
| 1149 | Data Flow: G -> A | |
| 1150 | ||
| 1151 | Description: Input G Ports to A | |
| 1152 | ||
| 1153 | */ | |
| 1154 | ||
| 1155 | INSTRUCTION( ing ) | |
| 1156 | { | |
| 1157 | A = IN_G(); | |
| 1158 | } | |
| 1159 | ||
| 1160 | /* | |
| 1161 | ||
| 1162 | Mnemonic: INL | |
| 1163 | ||
| 1164 | Hex Code: 33 2E | |
| 1165 | Binary: | |
| 1166 | ||
| 1167 | Data Flow: L7:4 -> RAM(B) | |
| 1168 | L3:0 -> A | |
| 1169 | ||
| 1170 | Description: Input L Ports to RAM,A | |
| 1171 | ||
| 1172 | */ | |
| 1173 | ||
| 1174 | INSTRUCTION( inl ) | |
| 1175 | { | |
| 1176 | UINT8 L = IN_L(); | |
| 1177 | ||
| 1178 | RAM_W(B, L >> 4); | |
| 1179 | A = L & 0xF; | |
| 1180 | } | |
| 1181 | ||
| 1182 | /* | |
| 1183 | ||
| 1184 | Mnemonic: OBD | |
| 1185 | ||
| 1186 | Hex Code: 33 3E | |
| 1187 | Binary: | |
| 1188 | ||
| 1189 | Data Flow: Bd -> D | |
| 1190 | ||
| 1191 | Description: Output Bd to D Outputs | |
| 1192 | ||
| 1193 | */ | |
| 1194 | ||
| 1195 | INSTRUCTION( obd ) | |
| 1196 | { | |
| 1197 | OUT_D(B & 0x0f); | |
| 1198 | } | |
| 1199 | ||
| 1200 | /* | |
| 1201 | ||
| 1202 | Mnemonic: OMG | |
| 1203 | ||
| 1204 | Hex Code: 33 3A | |
| 1205 | Binary: | |
| 1206 | ||
| 1207 | Data Flow: RAM(B) -> G | |
| 1208 | ||
| 1209 | Description: Output RAM to G Ports | |
| 1210 | ||
| 1211 | */ | |
| 1212 | ||
| 1213 | INSTRUCTION( omg ) | |
| 1214 | { | |
| 1215 | WRITE_G(cpustate, RAM_R(B)); | |
| 1216 | } | |
| 1217 | ||
| 1218 | /* | |
| 1219 | ||
| 1220 | Mnemonic: XAS | |
| 1221 | ||
| 1222 | Hex Code: 4F | |
| 1223 | Binary: 0 1 0 0 1 1 1 1 | |
| 1224 | ||
| 1225 | Data Flow: A <-> SIO | |
| 1226 | C -> SK | |
| 1227 | ||
| 1228 | Description: Exchange A with SIO | |
| 1229 | ||
| 1230 | */ | |
| 1231 | ||
| 1232 | INSTRUCTION( xas ) | |
| 1233 | { | |
| 1234 | UINT8 t = SIO; | |
| 1235 | SIO = A; | |
| 1236 | A = t; | |
| 1237 | ||
| 1238 | SKL = C; | |
| 1239 | } | |
| 1240 | ||
| 1241 | /* | |
| 1242 | ||
| 1243 | Mnemonic: ININ | |
| 1244 | ||
| 1245 | Hex Code: 33 28 | |
| 1246 | Binary: | |
| 1247 | ||
| 1248 | Data Flow: IN -> A | |
| 1249 | ||
| 1250 | Description: Input IN Inputs to A | |
| 1251 | ||
| 1252 | */ | |
| 1253 | ||
| 1254 | INSTRUCTION( inin ) | |
| 1255 | { | |
| 1256 | A = IN_IN(); | |
| 1257 | } | |
| 1258 | ||
| 1259 | /* | |
| 1260 | ||
| 1261 | Processor: COP402M | |
| 1262 | ||
| 1263 | Mnemonic: ININ | |
| 1264 | ||
| 1265 | Hex Code: 33 28 | |
| 1266 | Binary: | |
| 1267 | ||
| 1268 | Data Flow: IN -> A, A1 = "1" | |
| 1269 | ||
| 1270 | Description: Input IN Inputs to A | |
| 1271 | ||
| 1272 | */ | |
| 1273 | ||
| 1274 | INSTRUCTION( cop402m_inin ) | |
| 1275 | { | |
| 1276 | A = IN_IN() | 0x02; | |
| 1277 | } | |
| 1278 | ||
| 1279 | /* | |
| 1280 | ||
| 1281 | Mnemonic: INIL | |
| 1282 | ||
| 1283 | Hex Code: 33 29 | |
| 1284 | Binary: | |
| 1285 | ||
| 1286 | Data Flow: IL3,CKO,"0",IL0 -> A | |
| 1287 | ||
| 1288 | Description: Input IL Latches to A | |
| 1289 | ||
| 1290 | */ | |
| 1291 | ||
| 1292 | INSTRUCTION( inil ) | |
| 1293 | { | |
| 1294 | A = (IL & 0x09) | IN_CKO() << 2; | |
| 1295 | ||
| 1296 | IL = 0; | |
| 1297 | } | |
| 1298 | ||
| 1299 | /* | |
| 1300 | ||
| 1301 | Mnemonic: OGI | |
| 1302 | ||
| 1303 | Operand: y | |
| 1304 | Hex Code: 33 5- | |
| 1305 | Binary: 0 0 1 1 0 0 1 1 0 1 0 1 y3 y2 y1 y0 | |
| 1306 | ||
| 1307 | Data Flow: y -> G | |
| 1308 | ||
| 1309 | Description: Output to G Ports Immediate | |
| 1310 | ||
| 1311 | */ | |
| 1312 | ||
| 1313 | INSTRUCTION( ogi ) | |
| 1314 | { | |
| 1315 | UINT8 y = opcode & 0x0f; | |
| 1316 | ||
| 1317 | WRITE_G(cpustate, y); | |
| 1318 | } |
| r0 | r4136 | |
|---|---|---|
| 1 | /*************************************************************************** | |
| 2 | ||
| 3 | cop400.c | |
| 4 | ||
| 5 | National Semiconductor COP400 Emulator. | |
| 6 | ||
| 7 | Copyright Nicola Salmoria and the MAME Team. | |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 9 | ||
| 10 | **************************************************************************** | |
| 11 | ||
| 12 | Type ROM RAM G D IN | |
| 13 | ||
| 14 | COP410 512x8 32x4 none | |
| 15 | COP411 512x8 32x4 0-2 0-1 none | |
| 16 | COP401 none 32x4 none | |
| 17 | COP413? | |
| 18 | COP414? | |
| 19 | COP415? | |
| 20 | COP405? | |
| 21 | ||
| 22 | COP420 1024x8 64x4 | |
| 23 | COP421 1024x8 64x4 none | |
| 24 | COP422 1024x8 64x4 2-3 2-3 none | |
| 25 | COP402 none 64x4 | |
| 26 | ||
| 27 | COP444 2048x8 128x4 | |
| 28 | COP445 2048x8 128x4 none | |
| 29 | COP424 1024x8 64x4 | |
| 30 | COP425 1024x8 64x4 none | |
| 31 | COP426 1024x8 64x4 2-3 2-3 | |
| 32 | COP404 none none | |
| 33 | ||
| 34 | COP440 2048x8 160x4 | |
| 35 | COP441 2048x8 160x4 | |
| 36 | COP442 2048x8 160x4 | |
| 37 | ||
| 38 | **************************************************************************** | |
| 39 | ||
| 40 | Prefix Temperature Range | |
| 41 | ||
| 42 | COP4xx 0C ... 70C | |
| 43 | COP3xx -40C ... +85C | |
| 44 | COP2xx -55C ... +125C | |
| 45 | ||
| 46 | ***************************************************************************/ | |
| 47 | ||
| 48 | /* | |
| 49 | ||
| 50 | TODO: | |
| 51 | ||
| 52 | - remove LBIOps | |
| 53 | - remove InstLen | |
| 54 | - run interrupt test suite | |
| 55 | - run production test suite | |
| 56 | - run microbus test suite | |
| 57 | - when is the microbus int cleared? | |
| 58 | - opcode support for 2048x8 and 128x4/160x4 memory sizes | |
| 59 | - CKO sync input | |
| 60 | - save internal RAM when CKO is RAM power supply pin | |
| 61 | - COP413/COP414/COP415/COP405 | |
| 62 | - COP404 opcode map switching, dual timer, microbus enable | |
| 63 | - COP440/COP441/COP442 (new registers: 2-bit N, 4-bit H, 8-bit R; some new opcodes, 2Kx8 ROM, 160x4 RAM) | |
| 64 | ||
| 65 | */ | |
| 66 | ||
| 67 | #include "driver.h" | |
| 68 | #include "cpuintrf.h" | |
| 69 | #include "debugger.h" | |
| 70 | #include "cop400.h" | |
| 71 | ||
| 72 | /*************************************************************************** | |
| 73 | CONSTANTS | |
| 74 | ***************************************************************************/ | |
| 75 | ||
| 76 | /* feature masks */ | |
| 77 | #define COP410_FEATURE 0x01 | |
| 78 | #define COP420_FEATURE 0x02 | |
| 79 | #define COP444_FEATURE 0x04 | |
| 80 | #define COP440_FEATURE 0x08 | |
| 81 | ||
| 82 | /*************************************************************************** | |
| 83 | TYPE DEFINITIONS | |
| 84 | ***************************************************************************/ | |
| 85 | ||
| 86 | typedef struct _cop400_opcode_map cop400_opcode_map; | |
| 87 | ||
| 88 | typedef struct _cop400_state cop400_state; | |
| 89 | struct _cop400_state | |
| 90 | { | |
| 91 | const cop400_interface *intf; | |
| 92 | ||
| 93 | const address_space *program; | |
| 94 | const address_space *data; | |
| 95 | const address_space *io; | |
| 96 | ||
| 97 | /* registers */ | |
| 98 | UINT16 pc; /* 9/10/11-bit ROM address program counter */ | |
| 99 | UINT16 prevpc; /* previous value of program counter */ | |
| 100 | UINT8 a; /* 4-bit accumulator */ | |
| 101 | UINT8 b; /* 5/6/7-bit RAM address register */ | |
| 102 | int c; /* 1-bit carry register */ | |
| 103 | UINT8 n; /* 2-bit stack pointer (COP440 only) */ | |
| 104 | UINT8 en; /* 4-bit enable register */ | |
| 105 | UINT8 g; /* 4-bit general purpose I/O port */ | |
| 106 | UINT8 q; /* 8-bit latch for L port */ | |
| 107 | UINT16 sa, sb, sc; /* subroutine save registers (not present in COP440) */ | |
| 108 | UINT8 sio; /* 4-bit shift register and counter */ | |
| 109 | int skl; /* 1-bit latch for SK output */ | |
| 110 | UINT8 h; /* 4-bit general purpose I/O port (COP440 only) */ | |
| 111 | UINT8 r; /* 8-bit general purpose I/O port (COP440 only) */ | |
| 112 | ||
| 113 | /* counter */ | |
| 114 | UINT8 t; /* 8-bit timer */ | |
| 115 | int skt_latch; /* timer overflow latch */ | |
| 116 | ||
| 117 | /* input/output ports */ | |
| 118 | UINT8 g_mask; /* G port mask */ | |
| 119 | UINT8 d_mask; /* D port mask */ | |
| 120 | UINT8 in_mask; /* IN port mask */ | |
| 121 | UINT8 il; /* IN latch */ | |
| 122 | UINT8 in[4]; /* IN port shift register */ | |
| 123 | UINT8 si; /* serial input */ | |
| 124 | ||
| 125 | /* skipping logic */ | |
| 126 | int skip; /* skip next instruction */ | |
| 127 | int skip_lbi; /* skip until next non-LBI instruction */ | |
| 128 | int last_skip; /* last value of skip */ | |
| 129 | int halt; /* halt mode */ | |
| 130 | int idle; /* idle mode */ | |
| 131 | ||
| 132 | /* microbus */ | |
| 133 | int microbus_int; /* microbus interrupt */ | |
| 134 | ||
| 135 | /* execution logic */ | |
| 136 | int InstLen[256]; /* instruction length in bytes */ | |
| 137 | int LBIops[256]; | |
| 138 | int LBIops33[256]; | |
| 139 | int icount; /* instruction counter */ | |
| 140 | cpu_state_table state_table; /* state table */ | |
| 141 | ||
| 142 | const cop400_opcode_map *opcode_map; | |
| 143 | ||
| 144 | /* timers */ | |
| 145 | emu_timer *serial_timer; | |
| 146 | emu_timer *counter_timer; | |
| 147 | emu_timer *inil_timer; | |
| 148 | emu_timer *microbus_timer; | |
| 149 | }; | |
| 150 | ||
| 151 | struct _cop400_opcode_map { | |
| 152 | unsigned cycles; | |
| 153 | void (*function) (cop400_state *cpustate, UINT8 opcode); | |
| 154 | }; | |
| 155 | ||
| 156 | /*************************************************************************** | |
| 157 | CPU STATE DESCRIPTION | |
| 158 | ***************************************************************************/ | |
| 159 | ||
| 160 | #define COP400_STATE_ENTRY(_name, _format, _member, _datamask, _featuremask, _flags) \ | |
| 161 | CPU_STATE_ENTRY(COP400_##_name, #_name, _format, cop400_state, _member, _datamask, _featuremask, _flags) | |
| 162 | ||
| 163 | #define COP410_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \ | |
| 164 | COP400_STATE_ENTRY(_name, _format, _member, _datamask, COP410_FEATURE | COP420_FEATURE | COP444_FEATURE | COP440_FEATURE, _flags) | |
| 165 | ||
| 166 | #define COP420_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \ | |
| 167 | COP400_STATE_ENTRY(_name, _format, _member, _datamask, COP420_FEATURE | COP444_FEATURE | COP440_FEATURE, _flags) | |
| 168 | ||
| 169 | #define COP444_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \ | |
| 170 | COP400_STATE_ENTRY(_name, _format, _member, _datamask, COP444_FEATURE | COP440_FEATURE, _flags) | |
| 171 | ||
| 172 | #define COP440_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \ | |
| 173 | COP400_STATE_ENTRY(_name, _format, _member, _datamask, COP440_FEATURE, _flags) | |
| 174 | ||
| 175 | static const cpu_state_entry state_array[] = | |
| 176 | { | |
| 177 | COP410_STATE_ENTRY(GENPC, "%03X", pc, 0xfff, CPUSTATE_NOSHOW) | |
| 178 | COP410_STATE_ENTRY(GENPCBASE, "%03X", prevpc, 0xfff, CPUSTATE_NOSHOW) | |
| 179 | COP440_STATE_ENTRY(GENSP, "%01X", n, 0x3, CPUSTATE_NOSHOW) | |
| 180 | ||
| 181 | COP410_STATE_ENTRY(PC, "%03X", pc, 0xfff, 0) | |
| 182 | ||
| 183 | COP400_STATE_ENTRY(SA, "%03X", sa, 0xfff, COP410_FEATURE | COP420_FEATURE | COP444_FEATURE, 0) | |
| 184 | COP400_STATE_ENTRY(SB, "%03X", sb, 0xfff, COP410_FEATURE | COP420_FEATURE | COP444_FEATURE, 0) | |
| 185 | COP400_STATE_ENTRY(SC, "%03X", sc, 0xfff, COP420_FEATURE | COP444_FEATURE, 0) | |
| 186 | COP440_STATE_ENTRY(N, "%01X", n, 0x3, 0) | |
| 187 | ||
| 188 | COP410_STATE_ENTRY(A, "%01X", a, 0xf, 0) | |
| 189 | COP410_STATE_ENTRY(B, "%02X", b, 0xff, 0) | |
| 190 | COP410_STATE_ENTRY(C, "%1u", c, 0x1, 0) | |
| 191 | ||
| 192 | COP410_STATE_ENTRY(EN, "%01X", en, 0xf, 0) | |
| 193 | COP410_STATE_ENTRY(G, "%01X", g, 0xf, 0) | |
| 194 | COP440_STATE_ENTRY(H, "%01X", h, 0xf, 0) | |
| 195 | COP410_STATE_ENTRY(Q, "%02X", q, 0xff, 0) | |
| 196 | COP440_STATE_ENTRY(R, "%02X", r, 0xff, 0) | |
| 197 | ||
| 198 | COP410_STATE_ENTRY(SIO, "%01X", sio, 0xf, 0) | |
| 199 | COP410_STATE_ENTRY(SKL, "%1u", skl, 0x1, 0) | |
| 200 | ||
| 201 | COP420_STATE_ENTRY(T, "%02X", t, 0xff, 0) | |
| 202 | }; | |
| 203 | ||
| 204 | static const cpu_state_table state_table_template = | |
| 205 | { | |
| 206 | NULL, /* pointer to the base of state (offsets are relative to this) */ | |
| 207 | 0, /* subtype this table refers to */ | |
| 208 | ARRAY_LENGTH(state_array), /* number of entries */ | |
| 209 | state_array /* array of entries */ | |
| 210 | }; | |
| 211 | ||
| 212 | /*************************************************************************** | |
| 213 | MACROS | |
| 214 | ***************************************************************************/ | |
| 215 | ||
| 216 | #define ROM(a) memory_decrypted_read_byte(cpustate->program, a) | |
| 217 | #define RAM_R(a) memory_read_byte_8le(cpustate->data, a) | |
| 218 | #define RAM_W(a, v) memory_write_byte_8le(cpustate->data, a, v) | |
| 219 | #define IN(a) memory_read_byte_8le(cpustate->io, a) | |
| 220 | #define OUT(a, v) memory_write_byte_8le(cpustate->io, a, v) | |
| 221 | ||
| 222 | #define IN_G() (IN(COP400_PORT_G) & cpustate->g_mask) | |
| 223 | #define IN_L() IN(COP400_PORT_L) | |
| 224 | #define IN_SI() BIT(IN(COP400_PORT_SIO), 0) | |
| 225 | #define IN_CKO() BIT(IN(COP400_PORT_CKO), 0) | |
| 226 | #define IN_IN() (cpustate->in_mask ? IN(COP400_PORT_IN) : 0) | |
| 227 | ||
| 228 | #define OUT_G(v) OUT(COP400_PORT_G, (v) & cpustate->g_mask) | |
| 229 | #define OUT_L(v) OUT(COP400_PORT_L, (v)) | |
| 230 | #define OUT_D(v) OUT(COP400_PORT_D, (v) & cpustate->d_mask) | |
| 231 | #define OUT_SK(v) OUT(COP400_PORT_SK, (v)) | |
| 232 | #define OUT_SO(v) OUT(COP400_PORT_SIO, (v)) | |
| 233 | ||
| 234 | #define PC cpustate->pc | |
| 235 | #define A cpustate->a | |
| 236 | #define B cpustate->b | |
| 237 | #define C cpustate->c | |
| 238 | #define G cpustate->g | |
| 239 | #define Q cpustate->q | |
| 240 | #define H cpustate->h | |
| 241 | #define R cpustate->r | |
| 242 | #define EN cpustate->en | |
| 243 | #define SA cpustate->sa | |
| 244 | #define SB cpustate->sb | |
| 245 | #define SC cpustate->sc | |
| 246 | #define SIO cpustate->sio | |
| 247 | #define SKL cpustate->skl | |
| 248 | #define T cpustate->t | |
| 249 | #define IL cpustate->il | |
| 250 | ||
| 251 | /*************************************************************************** | |
| 252 | INLINE FUNCTIONS | |
| 253 | ***************************************************************************/ | |
| 254 | ||
| 255 | INLINE void PUSH(cop400_state *cpustate, UINT16 data) | |
| 256 | { | |
| 257 | if (cpustate->state_table.subtypemask != COP410_FEATURE) | |
| 258 | { | |
| 259 | SC = SB; | |
| 260 | } | |
| 261 | ||
| 262 | SB = SA; | |
| 263 | SA = data; | |
| 264 | } | |
| 265 | ||
| 266 | INLINE void POP(cop400_state *cpustate) | |
| 267 | { | |
| 268 | PC = SA; | |
| 269 | SA = SB; | |
| 270 | ||
| 271 | if (cpustate->state_table.subtypemask != COP410_FEATURE) | |
| 272 | { | |
| 273 | SB = SC; | |
| 274 | } | |
| 275 | } | |
| 276 | ||
| 277 | INLINE void WRITE_Q(cop400_state *cpustate, UINT8 data) | |
| 278 | { | |
| 279 | Q = data; | |
| 280 | ||
| 281 | if (BIT(EN, 2)) | |
| 282 | { | |
| 283 | OUT_L(Q); | |
| 284 | } | |
| 285 | } | |
| 286 | ||
| 287 | INLINE void WRITE_G(cop400_state *cpustate, UINT8 data) | |
| 288 | { | |
| 289 | if (cpustate->intf->microbus == COP400_MICROBUS_ENABLED) | |
| 290 | { | |
| 291 | data = (data & 0x0e) | cpustate->microbus_int; | |
| 292 | } | |
| 293 | ||
| 294 | G = data; | |
| 295 | ||
| 296 | OUT_G(G); | |
| 297 | } | |
| 298 | ||
| 299 | /*************************************************************************** | |
| 300 | OPCODE HANDLERS | |
| 301 | ***************************************************************************/ | |
| 302 | ||
| 303 | #define INSTRUCTION(mnemonic) INLINE void (mnemonic)(cop400_state *cpustate, UINT8 opcode) | |
| 304 | ||
| 305 | INSTRUCTION(illegal) | |
| 306 | { | |
| 307 | logerror("COP400: PC = %04x, Illegal opcode = %02x\n", PC-1, ROM(PC-1)); | |
| 308 | } | |
| 309 | ||
| 310 | #include "cop400op.c" | |
| 311 | ||
| 312 | /*************************************************************************** | |
| 313 | OPCODE TABLES | |
| 314 | ***************************************************************************/ | |
| 315 | ||
| 316 | static const cop400_opcode_map COP410_OPCODE_23_MAP[] = | |
| 317 | { | |
| 318 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 319 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 320 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 321 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 322 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 323 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 324 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 325 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 326 | ||
| 327 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 328 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 329 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 330 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 331 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 332 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 333 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 334 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 335 | ||
| 336 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 337 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 338 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 339 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 340 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 341 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 342 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 343 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, xad }, | |
| 344 | ||
| 345 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 346 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 347 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 348 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 349 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 350 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 351 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 352 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal } | |
| 353 | }; | |
| 354 | ||
| 355 | static void cop410_op23(cop400_state *cpustate, UINT8 opcode) | |
| 356 | { | |
| 357 | UINT8 opcode23 = ROM(PC++); | |
| 358 | ||
| 359 | (*(COP410_OPCODE_23_MAP[opcode23].function))(cpustate, opcode23); | |
| 360 | } | |
| 361 | ||
| 362 | static const cop400_opcode_map COP410_OPCODE_33_MAP[] = | |
| 363 | { | |
| 364 | {1, illegal },{1, skgbz0 },{1, illegal },{1, skgbz2 },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 365 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 366 | {1, illegal },{1, skgbz1 },{1, illegal },{1, skgbz3 },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 367 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 368 | {1, illegal },{1, skgz },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 369 | {1, illegal },{1, illegal },{1, ing },{1, illegal },{1, illegal },{1, illegal },{1, inl },{1, illegal }, | |
| 370 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 371 | {1, halt },{1, illegal },{1, omg },{1, illegal },{1, camq },{1, illegal },{1, obd },{1, illegal }, | |
| 372 | ||
| 373 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 374 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 375 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 376 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 377 | {1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei }, | |
| 378 | {1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei }, | |
| 379 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 380 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 381 | ||
| 382 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 383 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 384 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 385 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 386 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 387 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 388 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 389 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 390 | ||
| 391 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 392 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 393 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 394 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 395 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 396 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 397 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 398 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal } | |
| 399 | }; | |
| 400 | ||
| 401 | static void cop410_op33(cop400_state *cpustate, UINT8 opcode) | |
| 402 | { | |
| 403 | UINT8 opcode33 = ROM(PC++); | |
| 404 | ||
| 405 | (*(COP410_OPCODE_33_MAP[opcode33].function))(cpustate, opcode33); | |
| 406 | } | |
| 407 | ||
| 408 | static const cop400_opcode_map COP410_OPCODE_MAP[] = | |
| 409 | { | |
| 410 | {1, clra },{1, skmbz0 },{1, xor },{1, skmbz2 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 411 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 412 | {0, illegal },{1, skmbz1 },{0, illegal },{1, skmbz3 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 413 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 414 | {1, skc },{1, ske },{1, sc },{1, cop410_op23 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 415 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 416 | {1, asc },{1, add },{1, rc },{1, cop410_op33 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 417 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 418 | ||
| 419 | {1, comp },{0, illegal },{1, rmb2 },{1, rmb3 },{1, nop },{1, rmb1 },{1, smb2 },{1, smb1 }, | |
| 420 | {1, ret },{1, retsk },{0, illegal },{1, smb3 },{1, rmb0 },{1, smb0 },{1, cba },{1, xas }, | |
| 421 | {1, cab },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc }, | |
| 422 | {1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc }, | |
| 423 | {2, jmp },{2, jmp },{0, illegal },{0, illegal },{0, illegal },{0, illegal },{0, illegal },{0, illegal }, | |
| 424 | {2, jsr },{2, jsr },{0, illegal },{0, illegal },{0, illegal },{0, illegal },{0, illegal },{0, illegal }, | |
| 425 | {1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii }, | |
| 426 | {1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii }, | |
| 427 | ||
| 428 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 429 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 430 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 431 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 432 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 433 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 434 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 435 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{2, lqid }, | |
| 436 | ||
| 437 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 438 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 439 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 440 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 441 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 442 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 443 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 444 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{2, jid } | |
| 445 | }; | |
| 446 | ||
| 447 | static const cop400_opcode_map COP420_OPCODE_23_MAP[] = | |
| 448 | { | |
| 449 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 450 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 451 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 452 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 453 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 454 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 455 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 456 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 457 | ||
| 458 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 459 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 460 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 461 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 462 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 463 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 464 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 465 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 466 | ||
| 467 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 468 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 469 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 470 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 471 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 472 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 473 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 474 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 475 | ||
| 476 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 477 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 478 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 479 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 480 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 481 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 482 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 483 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal } | |
| 484 | }; | |
| 485 | ||
| 486 | static void cop420_op23(cop400_state *cpustate, UINT8 opcode) | |
| 487 | { | |
| 488 | UINT8 opcode23 = ROM(PC++); | |
| 489 | ||
| 490 | (*(COP420_OPCODE_23_MAP[opcode23].function))(cpustate, opcode23); | |
| 491 | } | |
| 492 | ||
| 493 | static const cop400_opcode_map COP420_OPCODE_33_MAP[] = | |
| 494 | { | |
| 495 | {1, illegal },{1, skgbz0 },{1, illegal },{1, skgbz2 },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 496 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 497 | {1, illegal },{1, skgbz1 },{1, illegal },{1, skgbz3 },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 498 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 499 | {1, illegal },{1, skgz },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 500 | {1, inin },{1, inil },{1, ing },{1, illegal },{1, cqma },{1, illegal },{1, inl },{1, illegal }, | |
| 501 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 502 | {1, illegal },{1, illegal },{1, omg },{1, illegal },{1, camq },{1, illegal },{1, obd },{1, illegal }, | |
| 503 | ||
| 504 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 505 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 506 | {1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi }, | |
| 507 | {1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi }, | |
| 508 | {1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei }, | |
| 509 | {1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei }, | |
| 510 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 511 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 512 | ||
| 513 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 514 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 515 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 516 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 517 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 518 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 519 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 520 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 521 | ||
| 522 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 523 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 524 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 525 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 526 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 527 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 528 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 529 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal } | |
| 530 | }; | |
| 531 | ||
| 532 | static void cop420_op33(cop400_state *cpustate, UINT8 opcode) | |
| 533 | { | |
| 534 | UINT8 opcode33 = ROM(PC++); | |
| 535 | ||
| 536 | (*(COP420_OPCODE_33_MAP[opcode33].function))(cpustate, opcode33); | |
| 537 | } | |
| 538 | ||
| 539 | static const cop400_opcode_map COP420_OPCODE_MAP[] = | |
| 540 | { | |
| 541 | {1, clra },{1, skmbz0 },{1, xor },{1, skmbz2 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 542 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 543 | {1, casc },{1, skmbz1 },{1, xabr },{1, skmbz3 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 544 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 545 | {1, skc },{1, ske },{1, sc },{1, cop420_op23 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 546 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 547 | {1, asc },{1, add },{1, rc },{1, cop420_op33 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 548 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 549 | ||
| 550 | {1, comp },{1, skt },{1, rmb2 },{1, rmb3 },{1, nop },{1, rmb1 },{1, smb2 },{1, smb1 }, | |
| 551 | {1, cop420_ret },{1, retsk },{1, adt },{1, smb3 },{1, rmb0 },{1, smb0 },{1, cba },{1, xas }, | |
| 552 | {1, cab },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc }, | |
| 553 | {1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc }, | |
| 554 | {2, jmp },{2, jmp },{2, jmp },{2, jmp },{0, illegal },{0, illegal },{0, illegal },{0, illegal }, | |
| 555 | {2, jsr },{2, jsr },{2, jsr },{2, jsr },{0, illegal },{0, illegal },{0, illegal },{0, illegal }, | |
| 556 | {1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii }, | |
| 557 | {1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii }, | |
| 558 | ||
| 559 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 560 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 561 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 562 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 563 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 564 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 565 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 566 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{2, lqid }, | |
| 567 | ||
| 568 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 569 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 570 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 571 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 572 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 573 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 574 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 575 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{2, jid } | |
| 576 | }; | |
| 577 | ||
| 578 | static const cop400_opcode_map COP444_OPCODE_23_MAP[256] = | |
| 579 | { | |
| 580 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 581 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 582 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 583 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 584 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 585 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 586 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 587 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 588 | ||
| 589 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 590 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 591 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 592 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 593 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 594 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 595 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 596 | {1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd },{1, ldd }, | |
| 597 | ||
| 598 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 599 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 600 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 601 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 602 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 603 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 604 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 605 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 606 | ||
| 607 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 608 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 609 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 610 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 611 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 612 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 613 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 614 | {1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad },{1, xad }, | |
| 615 | }; | |
| 616 | ||
| 617 | static void cop444_op23(cop400_state *cpustate, UINT8 opcode) | |
| 618 | { | |
| 619 | UINT8 opcode23 = ROM(PC++); | |
| 620 | ||
| 621 | (*(COP444_OPCODE_23_MAP[opcode23].function))(cpustate, opcode23); | |
| 622 | } | |
| 623 | ||
| 624 | static const cop400_opcode_map COP444_OPCODE_33_MAP[256] = | |
| 625 | { | |
| 626 | {1, illegal },{1, skgbz0 },{1, illegal },{1, skgbz2 },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 627 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 628 | {1, illegal },{1, skgbz1 },{1, illegal },{1, skgbz3 },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 629 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 630 | {1, illegal },{1, skgz },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 631 | {1, inin },{1, inil },{1, ing },{1, illegal },{1, cqma },{1, illegal },{1, inl },{1, ctma }, | |
| 632 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 633 | {1, it },{1, illegal },{1, omg },{1, illegal },{1, camq },{1, illegal },{1, obd },{1, camt }, | |
| 634 | ||
| 635 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 636 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 637 | {1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi }, | |
| 638 | {1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi },{1, ogi }, | |
| 639 | {1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei }, | |
| 640 | {1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei },{1, lei }, | |
| 641 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 642 | {1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal },{1, illegal }, | |
| 643 | ||
| 644 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 645 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 646 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 647 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 648 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 649 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 650 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 651 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 652 | ||
| 653 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 654 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 655 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 656 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 657 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 658 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 659 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 660 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 661 | }; | |
| 662 | ||
| 663 | static void cop444_op33(cop400_state *cpustate, UINT8 opcode) | |
| 664 | { | |
| 665 | UINT8 opcode33 = ROM(PC++); | |
| 666 | ||
| 667 | (*(COP444_OPCODE_33_MAP[opcode33].function))(cpustate, opcode33); | |
| 668 | } | |
| 669 | ||
| 670 | static const cop400_opcode_map COP444_OPCODE_MAP[256] = | |
| 671 | { | |
| 672 | {1, clra },{1, skmbz0 },{1, xor },{1, skmbz2 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 673 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 674 | {1, casc },{1, skmbz1 },{1, cop444_xabr},{1, skmbz3 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 675 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 676 | {1, skc },{1, ske },{1, sc },{1, cop444_op23 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 677 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 678 | {1, asc },{1, add },{1, rc },{1, cop444_op33 },{1, xis },{1, ld },{1, x },{1, xds }, | |
| 679 | {1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi },{1, lbi }, | |
| 680 | ||
| 681 | {1, comp },{1, skt },{1, rmb2 },{1, rmb3 },{1, nop },{1, rmb1 },{1, smb2 },{1, smb1 }, | |
| 682 | {1, cop420_ret },{1, retsk },{1, adt },{1, smb3 },{1, rmb0 },{1, smb0 },{1, cba },{1, xas }, | |
| 683 | {1, cab },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc }, | |
| 684 | {1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc },{1, aisc }, | |
| 685 | {2, jmp },{2, jmp },{2, jmp },{2, jmp },{2, jmp },{2, jmp },{2, jmp },{2, jmp }, | |
| 686 | {2, jsr },{2, jsr },{2, jsr },{2, jsr },{2, jsr },{2, jsr },{2, jsr },{2, jsr }, | |
| 687 | {1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii }, | |
| 688 | {1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii },{1, stii }, | |
| 689 | ||
| 690 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 691 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 692 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 693 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 694 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 695 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 696 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 697 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{2, lqid }, | |
| 698 | ||
| 699 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 700 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 701 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 702 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 703 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 704 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 705 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp }, | |
| 706 | {1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{1, jp },{2, jid } | |
| 707 | }; | |
| 708 | ||
| 709 | /*************************************************************************** | |
| 710 | TIMER CALLBACKS | |
| 711 | ***************************************************************************/ | |
| 712 | ||
| 713 | static TIMER_CALLBACK( serial_tick ) | |
| 714 | { | |
| 715 | cop400_state *cpustate = ptr; | |
| 716 | ||
| 717 | if (BIT(EN, 0)) | |
| 718 | { | |
| 719 | /* | |
| 720 | ||
| 721 | SIO is an asynchronous binary counter decrementing its value by one upon each low-going pulse ("1" to "0") occurring on the SI input. | |
| 722 | Each pulse must remain at each logic level at least two instruction cycles. SK outputs the value of the C upon the execution of an XAS | |
| 723 | and remains latched until the execution of another XAS instruction. The SO output is equal to the value of EN3. | |
| 724 | ||
| 725 | */ | |
| 726 | ||
| 727 | // serial output | |
| 728 | ||
| 729 | OUT_SO(BIT(EN, 3)); | |
| 730 | ||
| 731 | // serial clock | |
| 732 | ||
| 733 | OUT_SK(SKL); | |
| 734 | ||
| 735 | // serial input | |
| 736 | ||
| 737 | cpustate->si <<= 1; | |
| 738 | cpustate->si = (cpustate->si & 0x0e) | IN_SI(); | |
| 739 | ||
| 740 | if ((cpustate->si & 0x0f) == 0x0c) // 1100 | |
| 741 | { | |
| 742 | SIO--; | |
| 743 | SIO &= 0x0f; | |
| 744 | } | |
| 745 | } | |
| 746 | else | |
| 747 | { | |
| 748 | /* | |
| 749 | ||
| 750 | SIO is a serial shift register, shifting continuously left each instruction cycle time. The data present at SI goes into the least | |
| 751 | significant bit of SIO: SO can be enabled to output the most significant bit of SIO each cycle time. SK output becomes a logic- | |
| 752 | controlled clock, providing a SYNC signal each instruction time. It will start outputting a SYNC pulse upon the execution of an XAS | |
| 753 | instruction with C = "1," stopping upon the execution of a subsequent XAS with C = "0". | |
| 754 | ||
| 755 | If EN0 is changed from "1" to "0" ("0" to "1") the SK output will change from "1" to SYNC (SYNC to "1") without the execution of | |
| 756 | an XAS instruction. | |
| 757 | ||
| 758 | */ | |
| 759 | ||
| 760 | // serial output | |
| 761 | ||
| 762 | if (BIT(EN, 3)) | |
| 763 | { | |
| 764 | OUT_SO(BIT(SIO, 3)); | |
| 765 | } | |
| 766 | else | |
| 767 | { | |
| 768 | OUT_SO(0); | |
| 769 | } | |
| 770 | ||
| 771 | // serial clock | |
| 772 | ||
| 773 | if (SKL) | |
| 774 | { | |
| 775 | OUT_SK(1); // SYNC | |
| 776 | } | |
| 777 | else | |
| 778 | { | |
| 779 | OUT_SK(0); | |
| 780 | } | |
| 781 | ||
| 782 | // serial input | |
| 783 | ||
| 784 | SIO = ((SIO << 1) | IN_SI()) & 0x0f; | |
| 785 | } | |
| 786 | } | |
| 787 | ||
| 788 | static TIMER_CALLBACK( counter_tick ) | |
| 789 | { | |
| 790 | cop400_state *cpustate = ptr; | |
| 791 | ||
| 792 | T++; | |
| 793 | ||
| 794 | if (T == 0) | |
| 795 | { | |
| 796 | cpustate->skt_latch = 1; | |
| 797 | ||
| 798 | if (cpustate->idle) | |
| 799 | { | |
| 800 | cpustate->idle = 0; | |
| 801 | cpustate->halt = 0; | |
| 802 | } | |
| 803 | } | |
| 804 | } | |
| 805 | ||
| 806 | static TIMER_CALLBACK( inil_tick ) | |
| 807 | { | |
| 808 | cop400_state *cpustate = ptr; | |
| 809 | UINT8 in; | |
| 810 | int i; | |
| 811 | ||
| 812 | in = IN_IN(); | |
| 813 | ||
| 814 | for (i = 0; i < 4; i++) | |
| 815 | { | |
| 816 | cpustate->in[i] = (cpustate->in[i] << 1) | BIT(in, i); | |
| 817 | ||
| 818 | if ((cpustate->in[i] & 0x07) == 0x04) // 100 | |
| 819 | { | |
| 820 | IL |= (1 << i); | |
| 821 | } | |
| 822 | } | |
| 823 | } | |
| 824 | ||
| 825 | static TIMER_CALLBACK( microbus_tick ) | |
| 826 | { | |
| 827 | cop400_state *cpustate = ptr; | |
| 828 | UINT8 in; | |
| 829 | ||
| 830 | in = IN_IN(); | |
| 831 | ||
| 832 | if (!BIT(in, 2)) | |
| 833 | { | |
| 834 | // chip select | |
| 835 | ||
| 836 | if (!BIT(in, 1)) | |
| 837 | { | |
| 838 | // read strobe | |
| 839 | ||
| 840 | OUT_L(Q); | |
| 841 | ||
| 842 | cpustate->microbus_int = 1; | |
| 843 | } | |
| 844 | else if (!BIT(in, 3)) | |
| 845 | { | |
| 846 | // write strobe | |
| 847 | ||
| 848 | Q = IN_L(); | |
| 849 | ||
| 850 | cpustate->microbus_int = 0; | |
| 851 | } | |
| 852 | } | |
| 853 | } | |
| 854 | ||
| 855 | /*************************************************************************** | |
| 856 | INITIALIZATION | |
| 857 | ***************************************************************************/ | |
| 858 | ||
| 859 | static void cop400_init(const device_config *device, UINT8 g_mask, UINT8 d_mask, UINT8 in_mask, int has_counter, int has_inil) | |
| 860 | { | |
| 861 | cop400_state *cpustate = device->token; | |
| 862 | ||
| 863 | cpustate->intf = (cop400_interface *) device->static_config; | |
| 864 | ||
| 865 | /* find address spaces */ | |
| 866 | ||
| 867 | cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); | |
| 868 | cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA); | |
| 869 | cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO); | |
| 870 | ||
| 871 | /* set output pin masks */ | |
| 872 | ||
| 873 | cpustate->g_mask = g_mask; | |
| 874 | cpustate->d_mask = d_mask; | |
| 875 | cpustate->in_mask = in_mask; | |
| 876 | ||
| 877 | /* set clock divider */ | |
| 878 | ||
| 879 | device_set_info_int(device, CPUINFO_INT_CLOCK_DIVIDER, cpustate->intf->cki); | |
| 880 | ||
| 881 | /* allocate serial timer */ | |
| 882 | ||
| 883 | cpustate->serial_timer = timer_alloc(device->machine, serial_tick, cpustate); | |
| 884 | timer_adjust_periodic(cpustate->serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16)); | |
| 885 | ||
| 886 | /* allocate counter timer */ | |
| 887 | ||
| 888 | if (has_counter) | |
| 889 | { | |
| 890 | cpustate->counter_timer = timer_alloc(device->machine, counter_tick, cpustate); | |
| 891 | timer_adjust_periodic(cpustate->counter_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16 / 4)); | |
| 892 | } | |
| 893 | ||
| 894 | /* allocate IN latch timer */ | |
| 895 | ||
| 896 | if (has_inil) | |
| 897 | { | |
| 898 | cpustate->inil_timer = timer_alloc(device->machine, inil_tick, cpustate); | |
| 899 | timer_adjust_periodic(cpustate->inil_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16)); | |
| 900 | } | |
| 901 | ||
| 902 | /* allocate Microbus timer */ | |
| 903 | ||
| 904 | if (cpustate->intf->microbus == COP400_MICROBUS_ENABLED) | |
| 905 | { | |
| 906 | cpustate->microbus_timer = timer_alloc(device->machine, microbus_tick, cpustate); | |
| 907 | timer_adjust_periodic(cpustate->microbus_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16)); | |
| 908 | } | |
| 909 | ||
| 910 | /* register for state saving */ | |
| 911 | ||
| 912 | state_save_register_device_item(device, 0, cpustate->pc); | |
| 913 | state_save_register_device_item(device, 0, cpustate->prevpc); | |
| 914 | state_save_register_device_item(device, 0, cpustate->n); | |
| 915 | state_save_register_device_item(device, 0, cpustate->sa); | |
| 916 | state_save_register_device_item(device, 0, cpustate->sb); | |
| 917 | state_save_register_device_item(device, 0, cpustate->sc); | |
| 918 | state_save_register_device_item(device, 0, cpustate->a); | |
| 919 | state_save_register_device_item(device, 0, cpustate->b); | |
| 920 | state_save_register_device_item(device, 0, cpustate->c); | |
| 921 | state_save_register_device_item(device, 0, cpustate->g); | |
| 922 | state_save_register_device_item(device, 0, cpustate->h); | |
| 923 | state_save_register_device_item(device, 0, cpustate->q); | |
| 924 | state_save_register_device_item(device, 0, cpustate->r); | |
| 925 | state_save_register_device_item(device, 0, cpustate->en); | |
| 926 | state_save_register_device_item(device, 0, cpustate->sio); | |
| 927 | state_save_register_device_item(device, 0, cpustate->skl); | |
| 928 | state_save_register_device_item(device, 0, cpustate->t); | |
| 929 | state_save_register_device_item(device, 0, cpustate->skip); | |
| 930 | state_save_register_device_item(device, 0, cpustate->skip_lbi); | |
| 931 | state_save_register_device_item(device, 0, cpustate->skt_latch); | |
| 932 | state_save_register_device_item(device, 0, cpustate->si); | |
| 933 | state_save_register_device_item(device, 0, cpustate->last_skip); | |
| 934 | state_save_register_device_item_array(device, 0, cpustate->in); | |
| 935 | state_save_register_device_item(device, 0, cpustate->microbus_int); | |
| 936 | state_save_register_device_item(device, 0, cpustate->halt); | |
| 937 | state_save_register_device_item(device, 0, cpustate->idle); | |
| 938 | } | |
| 939 | ||
| 940 | static void cop410_init_opcodes(const device_config *device) | |
| 941 | { | |
| 942 | cop400_state *cpustate = device->token; | |
| 943 | int i; | |
| 944 | ||
| 945 | /* set up the state table */ | |
| 946 | ||
| 947 | cpustate->state_table = state_table_template; | |
| 948 | cpustate->state_table.baseptr = cpustate; | |
| 949 | cpustate->state_table.subtypemask = COP410_FEATURE; | |
| 950 | ||
| 951 | /* initialize instruction length array */ | |
| 952 | ||
| 953 | for (i=0; i<256; i++) cpustate->InstLen[i]=1; | |
| 954 | ||
| 955 | cpustate->InstLen[0x60] = cpustate->InstLen[0x61] = cpustate->InstLen[0x68] = | |
| 956 | cpustate->InstLen[0x69] = cpustate->InstLen[0x33] = cpustate->InstLen[0x23] = 2; | |
| 957 | ||
| 958 | /* initialize LBI opcode array */ | |
| 959 | ||
| 960 | for (i=0; i<256; i++) cpustate->LBIops[i] = 0; | |
| 961 | for (i=0x08; i<0x10; i++) cpustate->LBIops[i] = 1; | |
| 962 | for (i=0x18; i<0x20; i++) cpustate->LBIops[i] = 1; | |
| 963 | for (i=0x28; i<0x30; i++) cpustate->LBIops[i] = 1; | |
| 964 | for (i=0x38; i<0x40; i++) cpustate->LBIops[i] = 1; | |
| 965 | ||
| 966 | /* select opcode map */ | |
| 967 | ||
| 968 | cpustate->opcode_map = COP410_OPCODE_MAP; | |
| 969 | } | |
| 970 | ||
| 971 | static void cop420_init_opcodes(const device_config *device) | |
| 972 | { | |
| 973 | cop400_state *cpustate = device->token; | |
| 974 | int i; | |
| 975 | ||
| 976 | /* set up the state table */ | |
| 977 | ||
| 978 | cpustate->state_table = state_table_template; | |
| 979 | cpustate->state_table.baseptr = cpustate; | |
| 980 | cpustate->state_table.subtypemask = COP420_FEATURE; | |
| 981 | ||
| 982 | /* initialize instruction length array */ | |
| 983 | ||
| 984 | for (i=0; i<256; i++) cpustate->InstLen[i]=1; | |
| 985 | ||
| 986 | cpustate->InstLen[0x60] = cpustate->InstLen[0x61] = cpustate->InstLen[0x62] = cpustate->InstLen[0x63] = | |
| 987 | cpustate->InstLen[0x68] = cpustate->InstLen[0x69] = cpustate->InstLen[0x6a] = cpustate->InstLen[0x6b] = | |
| 988 | cpustate->InstLen[0x33] = cpustate->InstLen[0x23] = 2; | |
| 989 | ||
| 990 | /* initialize LBI opcode array */ | |
| 991 | ||
| 992 | for (i=0; i<256; i++) cpustate->LBIops[i] = 0; | |
| 993 | for (i=0x08; i<0x10; i++) cpustate->LBIops[i] = 1; | |
| 994 | for (i=0x18; i<0x20; i++) cpustate->LBIops[i] = 1; | |
| 995 | for (i=0x28; i<0x30; i++) cpustate->LBIops[i] = 1; | |
| 996 | for (i=0x38; i<0x40; i++) cpustate->LBIops[i] = 1; | |
| 997 | ||
| 998 | for (i=0; i<256; i++) cpustate->LBIops33[i] = 0; | |
| 999 | for (i=0x80; i<0xc0; i++) cpustate->LBIops33[i] = 1; | |
| 1000 | ||
| 1001 | /* select opcode map */ | |
| 1002 | ||
| 1003 | cpustate->opcode_map = COP420_OPCODE_MAP; | |
| 1004 | } | |
| 1005 | ||
| 1006 | static void cop444_init_opcodes(const device_config *device) | |
| 1007 | { | |
| 1008 | cop400_state *cpustate = device->token; | |
| 1009 | int i; | |
| 1010 | ||
| 1011 | /* set up the state table */ | |
| 1012 | ||
| 1013 | cpustate->state_table = state_table_template; | |
| 1014 | cpustate->state_table.baseptr = cpustate; | |
| 1015 | cpustate->state_table.subtypemask = COP444_FEATURE; | |
| 1016 | ||
| 1017 | /* initialize instruction length array */ | |
| 1018 | ||
| 1019 | for (i=0; i<256; i++) cpustate->InstLen[i]=1; | |
| 1020 | ||
| 1021 | cpustate->InstLen[0x60] = cpustate->InstLen[0x61] = cpustate->InstLen[0x62] = cpustate->InstLen[0x63] = | |
| 1022 | cpustate->InstLen[0x68] = cpustate->InstLen[0x69] = cpustate->InstLen[0x6a] = cpustate->InstLen[0x6b] = | |
| 1023 | cpustate->InstLen[0x33] = cpustate->InstLen[0x23] = 2; | |
| 1024 | ||
| 1025 | /* initialize LBI opcode array */ | |
| 1026 | ||
| 1027 | for (i=0; i<256; i++) cpustate->LBIops[i] = 0; | |
| 1028 | for (i=0x08; i<0x10; i++) cpustate->LBIops[i] = 1; | |
| 1029 | for (i=0x18; i<0x20; i++) cpustate->LBIops[i] = 1; | |
| 1030 | for (i=0x28; i<0x30; i++) cpustate->LBIops[i] = 1; | |
| 1031 | for (i=0x38; i<0x40; i++) cpustate->LBIops[i] = 1; | |
| 1032 | ||
| 1033 | for (i=0; i<256; i++) cpustate->LBIops33[i] = 0; | |
| 1034 | for (i=0x80; i<0xc0; i++) cpustate->LBIops33[i] = 1; | |
| 1035 | ||
| 1036 | /* select opcode map */ | |
| 1037 | ||
| 1038 | cpustate->opcode_map = COP444_OPCODE_MAP; | |
| 1039 | } | |
| 1040 | ||
| 1041 | static CPU_INIT( cop410 ) | |
| 1042 | { | |
| 1043 | cop410_init_opcodes(device); | |
| 1044 | cop400_init(device, 0xf, 0xf, 0, 0, 0); | |
| 1045 | } | |
| 1046 | ||
| 1047 | static CPU_INIT( cop411 ) | |
| 1048 | { | |
| 1049 | cop410_init_opcodes(device); | |
| 1050 | cop400_init(device, 0x7, 0x3, 0, 0, 0); | |
| 1051 | } | |
| 1052 | ||
| 1053 | static CPU_INIT( cop420 ) | |
| 1054 | { | |
| 1055 | cop420_init_opcodes(device); | |
| 1056 | cop400_init(device, 0xf, 0xf, 0xf, 1, 1); | |
| 1057 | } | |
| 1058 | ||
| 1059 | static CPU_INIT( cop421 ) | |
| 1060 | { | |
| 1061 | cop420_init_opcodes(device); | |
| 1062 | cop400_init(device, 0xf, 0xf, 0, 1, 0); | |
| 1063 | } | |
| 1064 | ||
| 1065 | static CPU_INIT( cop422 ) | |
| 1066 | { | |
| 1067 | cop420_init_opcodes(device); | |
| 1068 | cop400_init(device, 0xe, 0xe, 0, 1, 0); | |
| 1069 | } | |
| 1070 | ||
| 1071 | static CPU_INIT( cop444 ) | |
| 1072 | { | |
| 1073 | cop444_init_opcodes(device); | |
| 1074 | cop400_init(device, 0xf, 0xf, 0xf, 1, 1); | |
| 1075 | } | |
| 1076 | ||
| 1077 | static CPU_INIT( cop425 ) | |
| 1078 | { | |
| 1079 | cop444_init_opcodes(device); | |
| 1080 | cop400_init(device, 0xf, 0xf, 0, 1, 0); | |
| 1081 | } | |
| 1082 | ||
| 1083 | static CPU_INIT( cop426 ) | |
| 1084 | { | |
| 1085 | cop444_init_opcodes(device); | |
| 1086 | cop400_init(device, 0xe, 0xe, 0xf, 1, 1); | |
| 1087 | } | |
| 1088 | ||
| 1089 | static CPU_INIT( cop445 ) | |
| 1090 | { | |
| 1091 | cop444_init_opcodes(device); | |
| 1092 | cop400_init(device, 0x7, 0x3, 0, 1, 0); | |
| 1093 | } | |
| 1094 | ||
| 1095 | /*************************************************************************** | |
| 1096 | RESET | |
| 1097 | ***************************************************************************/ | |
| 1098 | ||
| 1099 | static CPU_RESET( cop400 ) | |
| 1100 | { | |
| 1101 | cop400_state *cpustate = device->token; | |
| 1102 | ||
| 1103 | PC = 0; | |
| 1104 | A = 0; | |
| 1105 | B = 0; | |
| 1106 | C = 0; | |
| 1107 | OUT_D(0); | |
| 1108 | EN = 0; | |
| 1109 | WRITE_G(cpustate, 0); | |
| 1110 | SKL = 1; | |
| 1111 | ||
| 1112 | T = 0; | |
| 1113 | cpustate->skt_latch = 1; | |
| 1114 | ||
| 1115 | cpustate->halt = 0; | |
| 1116 | cpustate->idle = 0; | |
| 1117 | } | |
| 1118 | ||
| 1119 | /*************************************************************************** | |
| 1120 | EXECUTION | |
| 1121 | ***************************************************************************/ | |
| 1122 | ||
| 1123 | static CPU_EXECUTE( cop400 ) | |
| 1124 | { | |
| 1125 | cop400_state *cpustate = device->token; | |
| 1126 | ||
| 1127 | UINT8 opcode; | |
| 1128 | ||
| 1129 | cpustate->icount = cycles; | |
| 1130 | ||
| 1131 | do | |
| 1132 | { | |
| 1133 | cpustate->prevpc = PC; | |
| 1134 | ||
| 1135 | debugger_instruction_hook(device, PC); | |
| 1136 | ||
| 1137 | if (cpustate->intf->cko == COP400_CKO_HALT_IO_PORT) | |
| 1138 | { | |
| 1139 | cpustate->halt = IN_CKO(); | |
| 1140 | } | |
| 1141 | ||
| 1142 | if (cpustate->halt) | |
| 1143 | { | |
| 1144 | cpustate->icount -= 1; | |
| 1145 | continue; | |
| 1146 | } | |
| 1147 | ||
| 1148 | opcode = ROM(PC); | |
| 1149 | ||
| 1150 | if (cpustate->skip_lbi) | |
| 1151 | { | |
| 1152 | int is_lbi = 0; | |
| 1153 | ||
| 1154 | if (opcode == 0x33) | |
| 1155 | { | |
| 1156 | is_lbi = cpustate->LBIops33[ROM(PC+1)]; | |
| 1157 | } | |
| 1158 | else | |
| 1159 | { | |
| 1160 | is_lbi = cpustate->LBIops[opcode]; | |
| 1161 | } | |
| 1162 | ||
| 1163 | if (is_lbi) | |
| 1164 | { | |
| 1165 | cpustate->icount -= cpustate->opcode_map[opcode].cycles; | |
| 1166 | ||
| 1167 | PC += cpustate->InstLen[opcode]; | |
| 1168 | } | |
| 1169 | else | |
| 1170 | { | |
| 1171 | cpustate->skip_lbi = 0; | |
| 1172 | } | |
| 1173 | } | |
| 1174 | ||
| 1175 | if (!cpustate->skip_lbi) | |
| 1176 | { | |
| 1177 | int inst_cycles = cpustate->opcode_map[opcode].cycles; | |
| 1178 | ||
| 1179 | PC++; | |
| 1180 | ||
| 1181 | (*(cpustate->opcode_map[opcode].function))(cpustate, opcode); | |
| 1182 | cpustate->icount -= inst_cycles; | |
| 1183 | ||
| 1184 | // check for interrupt | |
| 1185 | ||
| 1186 | if (BIT(EN, 1) && BIT(IL, 1)) | |
| 1187 | { | |
| 1188 | void *function = cpustate->opcode_map[ROM(PC)].function; | |
| 1189 | ||
| 1190 | if ((function != jp) && (function != jmp) && (function != jsr)) | |
| 1191 | { | |
| 1192 | // store skip logic | |
| 1193 | cpustate->last_skip = cpustate->skip; | |
| 1194 | cpustate->skip = 0; | |
| 1195 | ||
| 1196 | // push next PC | |
| 1197 | PUSH(cpustate, PC); | |
| 1198 | ||
| 1199 | // jump to interrupt service routine | |
| 1200 | PC = 0x0ff; | |
| 1201 | ||
| 1202 | // disable interrupt | |
| 1203 | EN &= ~0x02; | |
| 1204 | } | |
| 1205 | ||
| 1206 | IL &= ~2; | |
| 1207 | } | |
| 1208 | ||
| 1209 | // skip next instruction? | |
| 1210 | ||
| 1211 | if (cpustate->skip) | |
| 1212 | { | |
| 1213 | void *function = cpustate->opcode_map[ROM(PC)].function; | |
| 1214 | ||
| 1215 | opcode = ROM(PC); | |
| 1216 | ||
| 1217 | if ((function == lqid) || (function == jid)) | |
| 1218 | { | |
| 1219 | cpustate->icount -= 1; | |
| 1220 | } | |
| 1221 | else | |
| 1222 | { | |
| 1223 | cpustate->icount -= cpustate->opcode_map[opcode].cycles; | |
| 1224 | } | |
| 1225 | ||
| 1226 | PC += cpustate->InstLen[opcode]; | |
| 1227 | ||
| 1228 | cpustate->skip = 0; | |
| 1229 | } | |
| 1230 | } | |
| 1231 | } while (cpustate->icount > 0); | |
| 1232 | ||
| 1233 | return cycles - cpustate->icount; | |
| 1234 | } | |
| 1235 | ||
| 1236 | /*************************************************************************** | |
| 1237 | ADDRESS MAPS | |
| 1238 | ***************************************************************************/ | |
| 1239 | ||
| 1240 | static ADDRESS_MAP_START( program_512b, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 1241 | AM_RANGE(0x000, 0x1ff) AM_ROM | |
| 1242 | ADDRESS_MAP_END | |
| 1243 | ||
| 1244 | static ADDRESS_MAP_START( program_1kb, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 1245 | AM_RANGE(0x000, 0x3ff) AM_ROM | |
| 1246 | ADDRESS_MAP_END | |
| 1247 | ||
| 1248 | static ADDRESS_MAP_START( program_2kb, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 1249 | AM_RANGE(0x000, 0x7ff) AM_ROM | |
| 1250 | ADDRESS_MAP_END | |
| 1251 | ||
| 1252 | static ADDRESS_MAP_START( data_32b, ADDRESS_SPACE_DATA, 8 ) | |
| 1253 | AM_RANGE(0x00, 0x1f) AM_RAM | |
| 1254 | ADDRESS_MAP_END | |
| 1255 | ||
| 1256 | static ADDRESS_MAP_START( data_64b, ADDRESS_SPACE_DATA, 8 ) | |
| 1257 | AM_RANGE(0x00, 0x3f) AM_RAM | |
| 1258 | ADDRESS_MAP_END | |
| 1259 | ||
| 1260 | static ADDRESS_MAP_START( data_128b, ADDRESS_SPACE_DATA, 8 ) | |
| 1261 | AM_RANGE(0x00, 0x7f) AM_RAM | |
| 1262 | ADDRESS_MAP_END | |
| 1263 | ||
| 1264 | static ADDRESS_MAP_START( data_160b, ADDRESS_SPACE_DATA, 8 ) | |
| 1265 | AM_RANGE(0x00, 0x9f) AM_RAM | |
| 1266 | ADDRESS_MAP_END | |
| 1267 | ||
| 1268 | /*************************************************************************** | |
| 1269 | VALIDITY CHECKS | |
| 1270 | ***************************************************************************/ | |
| 1271 | ||
| 1272 | static CPU_VALIDITY_CHECK( cop410 ) | |
| 1273 | { | |
| 1274 | int error = FALSE; | |
| 1275 | const cop400_interface *intf = (const cop400_interface *) config; | |
| 1276 | ||
| 1277 | if ((intf == NULL) || (intf->cki <= 0)) | |
| 1278 | { | |
| 1279 | mame_printf_error("%s: %s has an invalid CPU configuration\n", driver->source_file, driver->name); | |
| 1280 | error = TRUE; | |
| 1281 | } | |
| 1282 | ||
| 1283 | return error; | |
| 1284 | } | |
| 1285 | ||
| 1286 | static CPU_VALIDITY_CHECK( cop420 ) | |
| 1287 | { | |
| 1288 | int error = FALSE; | |
| 1289 | const cop400_interface *intf = (const cop400_interface *) config; | |
| 1290 | ||
| 1291 | if ((intf == NULL) || (intf->cki <= 0)) | |
| 1292 | { | |
| 1293 | mame_printf_error("%s: %s has an invalid CPU configuration\n", driver->source_file, driver->name); | |
| 1294 | error = TRUE; | |
| 1295 | } | |
| 1296 | ||
| 1297 | return error; | |
| 1298 | } | |
| 1299 | ||
| 1300 | static CPU_VALIDITY_CHECK( cop421 ) | |
| 1301 | { | |
| 1302 | int error = FALSE; | |
| 1303 | const cop400_interface *intf = (const cop400_interface *) config; | |
| 1304 | ||
| 1305 | if ((intf == NULL) || (intf->cki <= 0) || (intf->microbus == COP400_MICROBUS_ENABLED)) | |
| 1306 | { | |
| 1307 | mame_printf_error("%s: %s has an invalid CPU configuration\n", driver->source_file, driver->name); | |
| 1308 | error = TRUE; | |
| 1309 | } | |
| 1310 | ||
| 1311 | return error; | |
| 1312 | } | |
| 1313 | ||
| 1314 | static CPU_VALIDITY_CHECK( cop444 ) | |
| 1315 | { | |
| 1316 | int error = FALSE; | |
| 1317 | const cop400_interface *intf = (const cop400_interface *) config; | |
| 1318 | ||
| 1319 | if ((intf == NULL) || (intf->cki <= 0)) | |
| 1320 | { | |
| 1321 | mame_printf_error("%s: %s has an invalid CPU configuration\n", driver->source_file, driver->name); | |
| 1322 | error = TRUE; | |
| 1323 | } | |
| 1324 | ||
| 1325 | return error; | |
| 1326 | } | |
| 1327 | ||
| 1328 | /*************************************************************************** | |
| 1329 | GENERAL CONTEXT ACCESS | |
| 1330 | ***************************************************************************/ | |
| 1331 | ||
| 1332 | static CPU_SET_INFO( cop400 ) | |
| 1333 | { | |
| 1334 | /* nothing to set */ | |
| 1335 | } | |
| 1336 | ||
| 1337 | static CPU_GET_INFO( cop400 ) | |
| 1338 | { | |
| 1339 | cop400_state *cpustate = (device != NULL) ? device->token : NULL; | |
| 1340 | ||
| 1341 | switch (state) | |
| 1342 | { | |
| 1343 | /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 1344 | case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(cop400_state); break; | |
| 1345 | case CPUINFO_INT_INPUT_LINES: info->i = 0; break; | |
| 1346 | case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0; break; | |
| 1347 | case CPUINFO_INT_ENDIANNESS: info->i = ENDIANNESS_LITTLE; break; | |
| 1348 | case CPUINFO_INT_CLOCK_MULTIPLIER: info->i = 1; break; | |
| 1349 | case CPUINFO_INT_CLOCK_DIVIDER: info->i = 16; break; | |
| 1350 | case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 1; break; | |
| 1351 | case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 2; break; | |
| 1352 | case CPUINFO_INT_MIN_CYCLES: info->i = 1; break; | |
| 1353 | case CPUINFO_INT_MAX_CYCLES: info->i = 2; break; | |
| 1354 | ||
| 1355 | case CPUINFO_INT_DATABUS_WIDTH_PROGRAM: info->i = 8; break; | |
| 1356 | case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: /* set per-core */ break; | |
| 1357 | case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0; break; | |
| 1358 | case CPUINFO_INT_DATABUS_WIDTH_DATA: info->i = 8; /* really 4 */ break; | |
| 1359 | case CPUINFO_INT_ADDRBUS_WIDTH_DATA: /* set per-core */ break; | |
| 1360 | case CPUINFO_INT_ADDRBUS_SHIFT_DATA: info->i = 0; break; | |
| 1361 | case CPUINFO_INT_DATABUS_WIDTH_IO: info->i = 8; break; | |
| 1362 | case CPUINFO_INT_ADDRBUS_WIDTH_IO: info->i = 9; break; | |
| 1363 | case CPUINFO_INT_ADDRBUS_SHIFT_IO: info->i = 0; break; | |
| 1364 | ||
| 1365 | /* --- the following bits of info are returned as pointers to functions --- */ | |
| 1366 | case CPUINFO_FCT_SET_INFO: info->setinfo = CPU_SET_INFO_NAME(cop400); break; | |
| 1367 | case CPUINFO_FCT_INIT: /* set per-core */ break; | |
| 1368 | case CPUINFO_FCT_RESET: info->reset = CPU_RESET_NAME(cop400); break; | |
| 1369 | case CPUINFO_FCT_EXECUTE: info->execute = CPU_EXECUTE_NAME(cop400); break; | |
| 1370 | case CPUINFO_FCT_DISASSEMBLE: /* set per-core */ break; | |
| 1371 | case CPUINFO_FCT_VALIDITY_CHECK: /* set per-core */ break; | |
| 1372 | ||
| 1373 | /* --- the following bits of info are returned as pointers --- */ | |
| 1374 | case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break; | |
| 1375 | case CPUINFO_PTR_STATE_TABLE: info->state_table = &cpustate->state_table; break; | |
| 1376 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: /* set per-core */ break; | |
| 1377 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA: /* set per-core */ break; | |
| 1378 | ||
| 1379 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1380 | case CPUINFO_STR_NAME: strcpy(info->s, "COP400"); break; | |
| 1381 | case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "National Semiconductor COPS"); break; | |
| 1382 | case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break; | |
| 1383 | case CPUINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break; | |
| 1384 | case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright MAME Team"); break; | |
| 1385 | } | |
| 1386 | } | |
| 1387 | ||
| 1388 | /*************************************************************************** | |
| 1389 | CPU-SPECIFIC CONTEXT ACCESS | |
| 1390 | ***************************************************************************/ | |
| 1391 | ||
| 1392 | CPU_GET_INFO( cop410 ) | |
| 1393 | { | |
| 1394 | cop400_state *cpustate = (device != NULL) ? device->token : NULL; | |
| 1395 | ||
| 1396 | switch (state) | |
| 1397 | { | |
| 1398 | /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 1399 | case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 9; break; | |
| 1400 | case CPUINFO_INT_ADDRBUS_WIDTH_DATA: info->i = 5; break; | |
| 1401 | ||
| 1402 | /* --- the following bits of info are returned as pointers to functions --- */ | |
| 1403 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop410); break; | |
| 1404 | case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(cop410); break; | |
| 1405 | case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop410); break; | |
| 1406 | ||
| 1407 | /* --- the following bits of info are returned as pointers --- */ | |
| 1408 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_512b); break; | |
| 1409 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA: info->internal_map8 = ADDRESS_MAP_NAME(data_32b); break; | |
| 1410 | ||
| 1411 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1412 | case CPUINFO_STR_NAME: strcpy(info->s, "COP410"); break; | |
| 1413 | ||
| 1414 | case CPUINFO_STR_FLAGS: sprintf(info->s, | |
| 1415 | "%c%c", | |
| 1416 | cpustate->c ? 'C' : '.', | |
| 1417 | cpustate->skl ? 'S' : '.'); break; | |
| 1418 | ||
| 1419 | default: CPU_GET_INFO_CALL(cop400); break; | |
| 1420 | } | |
| 1421 | } | |
| 1422 | ||
| 1423 | CPU_GET_INFO( cop411 ) | |
| 1424 | { | |
| 1425 | // COP411 is a 20-pin package version of the COP410, missing D2/D3/G3/CKO | |
| 1426 | ||
| 1427 | switch (state) | |
| 1428 | { | |
| 1429 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1430 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop411); break; | |
| 1431 | ||
| 1432 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1433 | case CPUINFO_STR_NAME: strcpy(info->s, "COP411"); break; | |
| 1434 | ||
| 1435 | default: CPU_GET_INFO_CALL(cop410); break; | |
| 1436 | } | |
| 1437 | } | |
| 1438 | ||
| 1439 | CPU_GET_INFO( cop401 ) | |
| 1440 | { | |
| 1441 | // COP401 is a ROMless version of the COP410 | |
| 1442 | ||
| 1443 | switch (state) | |
| 1444 | { | |
| 1445 | /* --- the following bits of info are returned as pointers --- */ | |
| 1446 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = NULL; break; | |
| 1447 | ||
| 1448 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1449 | case CPUINFO_STR_NAME: strcpy(info->s, "COP401"); break; | |
| 1450 | ||
| 1451 | default: CPU_GET_INFO_CALL(cop410); break; | |
| 1452 | } | |
| 1453 | } | |
| 1454 | ||
| 1455 | CPU_GET_INFO( cop420 ) | |
| 1456 | { | |
| 1457 | cop400_state *cpustate = (device != NULL) ? device->token : NULL; | |
| 1458 | ||
| 1459 | switch (state) | |
| 1460 | { | |
| 1461 | /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 1462 | case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 10; break; | |
| 1463 | case CPUINFO_INT_ADDRBUS_WIDTH_DATA: info->i = 6; break; | |
| 1464 | ||
| 1465 | /* --- the following bits of info are returned as pointers to functions --- */ | |
| 1466 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop420); break; | |
| 1467 | case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(cop420); break; | |
| 1468 | case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop420); break; | |
| 1469 | ||
| 1470 | /* --- the following bits of info are returned as pointers --- */ | |
| 1471 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_1kb); break; | |
| 1472 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA: info->internal_map8 = ADDRESS_MAP_NAME(data_64b); break; | |
| 1473 | ||
| 1474 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1475 | case CPUINFO_STR_NAME: strcpy(info->s, "COP420"); break; | |
| 1476 | ||
| 1477 | case CPUINFO_STR_FLAGS: sprintf(info->s, | |
| 1478 | "%c%c%c", | |
| 1479 | cpustate->c ? 'C' : '.', | |
| 1480 | cpustate->skl ? 'S' : '.', | |
| 1481 | cpustate->skt_latch ? 'T' : '.'); break; | |
| 1482 | ||
| 1483 | default: CPU_GET_INFO_CALL(cop400); break; | |
| 1484 | } | |
| 1485 | } | |
| 1486 | ||
| 1487 | CPU_GET_INFO( cop421 ) | |
| 1488 | { | |
| 1489 | // COP421 is a 24-pin package version of the COP420, lacking the IN ports | |
| 1490 | ||
| 1491 | switch (state) | |
| 1492 | { | |
| 1493 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1494 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop421); break; | |
| 1495 | case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop421); break; | |
| 1496 | ||
| 1497 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1498 | case CPUINFO_STR_NAME: strcpy(info->s, "COP421"); break; | |
| 1499 | ||
| 1500 | default: CPU_GET_INFO_CALL(cop420); break; | |
| 1501 | } | |
| 1502 | } | |
| 1503 | ||
| 1504 | CPU_GET_INFO( cop422 ) | |
| 1505 | { | |
| 1506 | // COP422 is a 20-pin package version of the COP420, lacking G0/G1, D0/D1, and the IN ports | |
| 1507 | ||
| 1508 | switch (state) | |
| 1509 | { | |
| 1510 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1511 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop422); break; | |
| 1512 | ||
| 1513 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1514 | case CPUINFO_STR_NAME: strcpy(info->s, "COP422"); break; | |
| 1515 | ||
| 1516 | default: CPU_GET_INFO_CALL(cop421); break; | |
| 1517 | } | |
| 1518 | } | |
| 1519 | ||
| 1520 | CPU_GET_INFO( cop402 ) | |
| 1521 | { | |
| 1522 | // COP402 is a ROMless version of the COP420 | |
| 1523 | ||
| 1524 | switch (state) | |
| 1525 | { | |
| 1526 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1527 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = NULL; break; | |
| 1528 | ||
| 1529 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1530 | case CPUINFO_STR_NAME: strcpy(info->s, "COP402"); break; | |
| 1531 | ||
| 1532 | default: CPU_GET_INFO_CALL(cop420); break; | |
| 1533 | } | |
| 1534 | } | |
| 1535 | ||
| 1536 | CPU_GET_INFO( cop444 ) | |
| 1537 | { | |
| 1538 | cop400_state *cpustate = (device != NULL) ? device->token : NULL; | |
| 1539 | ||
| 1540 | switch (state) | |
| 1541 | { | |
| 1542 | /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 1543 | case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 11; break; | |
| 1544 | case CPUINFO_INT_ADDRBUS_WIDTH_DATA: info->i = 7; break; | |
| 1545 | ||
| 1546 | /* --- the following bits of info are returned as pointers to functions --- */ | |
| 1547 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop444); break; | |
| 1548 | case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(cop444); break; | |
| 1549 | case CPUINFO_FCT_VALIDITY_CHECK: info->validity_check = CPU_VALIDITY_CHECK_NAME(cop444); break; | |
| 1550 | ||
| 1551 | /* --- the following bits of info are returned as pointers --- */ | |
| 1552 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_2kb); break; | |
| 1553 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA: info->internal_map8 = ADDRESS_MAP_NAME(data_128b); break; | |
| 1554 | ||
| 1555 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1556 | case CPUINFO_STR_NAME: strcpy(info->s, "COP444"); break; | |
| 1557 | ||
| 1558 | case CPUINFO_STR_FLAGS: sprintf(info->s, | |
| 1559 | "%c%c%c", | |
| 1560 | cpustate->c ? 'C' : '.', | |
| 1561 | cpustate->skl ? 'S' : '.', | |
| 1562 | cpustate->skt_latch ? 'T' : '.'); break; | |
| 1563 | ||
| 1564 | default: CPU_GET_INFO_CALL(cop400); break; | |
| 1565 | } | |
| 1566 | } | |
| 1567 | ||
| 1568 | CPU_GET_INFO( cop445 ) | |
| 1569 | { | |
| 1570 | // COP445 is a 24-pin package version of the COP444, lacking the IN ports | |
| 1571 | ||
| 1572 | switch (state) | |
| 1573 | { | |
| 1574 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1575 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop445); break; | |
| 1576 | ||
| 1577 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1578 | case CPUINFO_STR_NAME: strcpy(info->s, "COP445"); break; | |
| 1579 | ||
| 1580 | default: CPU_GET_INFO_CALL(cop444); break; | |
| 1581 | } | |
| 1582 | } | |
| 1583 | ||
| 1584 | CPU_GET_INFO( cop424 ) | |
| 1585 | { | |
| 1586 | // COP424 is functionally equivalent to COP444, with only 1K ROM and 64x4 bytes RAM | |
| 1587 | ||
| 1588 | switch (state) | |
| 1589 | { | |
| 1590 | /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 1591 | case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 10; break; | |
| 1592 | case CPUINFO_INT_ADDRBUS_WIDTH_DATA: info->i = 6; break; | |
| 1593 | ||
| 1594 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1595 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_1kb); break; | |
| 1596 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA: info->internal_map8 = ADDRESS_MAP_NAME(data_64b); break; | |
| 1597 | ||
| 1598 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1599 | case CPUINFO_STR_NAME: strcpy(info->s, "COP424"); break; | |
| 1600 | ||
| 1601 | default: CPU_GET_INFO_CALL(cop444); break; | |
| 1602 | } | |
| 1603 | } | |
| 1604 | ||
| 1605 | CPU_GET_INFO( cop425 ) | |
| 1606 | { | |
| 1607 | // COP425 is a 24-pin package version of the COP424, lacking the IN ports | |
| 1608 | ||
| 1609 | switch (state) | |
| 1610 | { | |
| 1611 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1612 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop425); break; | |
| 1613 | ||
| 1614 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1615 | case CPUINFO_STR_NAME: strcpy(info->s, "COP425"); break; | |
| 1616 | ||
| 1617 | default: CPU_GET_INFO_CALL(cop424); break; | |
| 1618 | } | |
| 1619 | } | |
| 1620 | ||
| 1621 | CPU_GET_INFO( cop426 ) | |
| 1622 | { | |
| 1623 | // COP426 is a 20-pin package version of the COP424, with only L0-L7, G2-G3, D2-D3 ports | |
| 1624 | ||
| 1625 | switch (state) | |
| 1626 | { | |
| 1627 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1628 | case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(cop426); break; | |
| 1629 | ||
| 1630 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1631 | case CPUINFO_STR_NAME: strcpy(info->s, "COP426"); break; | |
| 1632 | ||
| 1633 | default: CPU_GET_INFO_CALL(cop424); break; | |
| 1634 | } | |
| 1635 | } | |
| 1636 | ||
| 1637 | CPU_GET_INFO( cop404 ) | |
| 1638 | { | |
| 1639 | // COP404 is a ROMless version of the COP444, which can emulate a COP410C/COP411C, COP424C/COP425C, or a COP444C/COP445C | |
| 1640 | ||
| 1641 | switch (state) | |
| 1642 | { | |
| 1643 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1644 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = NULL; break; | |
| 1645 | ||
| 1646 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1647 | case CPUINFO_STR_NAME: strcpy(info->s, "COP404"); break; | |
| 1648 | ||
| 1649 | default: CPU_GET_INFO_CALL(cop444); break; | |
| 1650 | } | |
| 1651 | } |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | #ifndef __COP400__ |
| 15 | 15 | #define __COP400__ |
| 16 | 16 | |
| 17 | /*************************************************************************** | |
| 18 | CONSTANTS | |
| 19 | ***************************************************************************/ | |
| 20 | ||
| 21 | /* register access indexes */ | |
| 17 | 22 | enum |
| 18 | 23 | { |
| 24 | COP400_PC, | |
| 25 | COP400_SA, | |
| 26 | COP400_SB, | |
| 27 | COP400_SC, | |
| 28 | COP400_N, | |
| 29 | COP400_A, | |
| 30 | COP400_B, | |
| 31 | COP400_C, | |
| 32 | COP400_G, | |
| 33 | COP400_H, | |
| 34 | COP400_Q, | |
| 35 | COP400_R, | |
| 36 | COP400_EN, | |
| 37 | COP400_SIO, | |
| 38 | COP400_SKL, | |
| 39 | COP400_T, | |
| 40 | COP400_GENPC = REG_GENPC, | |
| 41 | COP400_GENPCBASE = REG_GENPCBASE, | |
| 42 | COP400_GENSP = REG_GENSP | |
| 43 | }; | |
| 44 | ||
| 45 | /* special I/O space ports */ | |
| 46 | enum | |
| 47 | { | |
| 19 | 48 | COP400_PORT_L = 0x100, |
| 20 | 49 | COP400_PORT_G, |
| 21 | 50 | COP400_PORT_D, |
| r4135 | r4136 | |
| 27 | 56 | COP400_PORT_CKO |
| 28 | 57 | }; |
| 29 | 58 | |
| 59 | /* input lines */ | |
| 30 | 60 | enum |
| 31 | 61 | { |
| 32 | COP400_PC = 1, | |
| 33 | COP400_A, | |
| 34 | COP400_B, | |
| 35 | COP400_C, | |
| 36 | COP400_G, | |
| 37 | COP400_H, | |
| 38 | COP400_R, | |
| 39 | COP400_EN, | |
| 40 | COP400_Q, | |
| 41 | COP400_SA, | |
| 42 | COP400_SB, | |
| 43 | COP400_SC, | |
| 44 | COP400_SIO, | |
| 45 | COP400_SKL, | |
| 46 | COP400_T | |
| 62 | /* COP420 */ | |
| 63 | COP400_IN0 = 0, | |
| 64 | COP400_IN1, | |
| 65 | COP400_IN2, | |
| 66 | COP400_IN3, | |
| 67 | ||
| 68 | /* COP404 */ | |
| 69 | COP400_MB, | |
| 70 | COP400_DUAL, | |
| 71 | COP400_SEL10, | |
| 72 | COP400_SEL20 | |
| 47 | 73 | }; |
| 48 | 74 | |
| 75 | /* CKI bonding options */ | |
| 49 | 76 | typedef enum _cop400_cki_bond cop400_cki_bond; |
| 50 | 77 | enum _cop400_cki_bond { |
| 51 | 78 | COP400_CKI_DIVISOR_4 = 4, |
| r4135 | r4136 | |
| 54 | 81 | COP400_CKI_DIVISOR_32 = 32 |
| 55 | 82 | }; |
| 56 | 83 | |
| 84 | /* CKO bonding options */ | |
| 57 | 85 | typedef enum _cop400_cko_bond cop400_cko_bond; |
| 58 | 86 | enum _cop400_cko_bond { |
| 59 | 87 | COP400_CKO_OSCILLATOR_OUTPUT = 0, |
| r4135 | r4136 | |
| 63 | 91 | COP400_CKO_GENERAL_PURPOSE_INPUT |
| 64 | 92 | }; |
| 65 | 93 | |
| 94 | /* microbus bonding options */ | |
| 66 | 95 | typedef enum _cop400_microbus cop400_microbus; |
| 67 | 96 | enum _cop400_microbus { |
| 68 | 97 | COP400_MICROBUS_DISABLED = 0, |
| r4135 | r4136 | |
| 79 | 108 | }; |
| 80 | 109 | #define COP400_INTERFACE(name) const cop400_interface (name) = |
| 81 | 110 | |
| 82 | /* | |
| 111 | /*************************************************************************** | |
| 112 | MACROS | |
| 113 | ***************************************************************************/ | |
| 83 | 114 | |
| 84 | Prefix Temperature Range | |
| 115 | #define CPU_COP401 CPU_GET_INFO_NAME( cop401 ) | |
| 116 | #define CPU_COP410 CPU_GET_INFO_NAME( cop410 ) | |
| 117 | #define CPU_COP411 CPU_GET_INFO_NAME( cop411 ) | |
| 85 | 118 | |
| 86 | COP4xx 0C to 70C | |
| 87 | COP3xx -40C to +85C | |
| 88 | COP2xx -55C to +125C | |
| 119 | #define CPU_COP402 CPU_GET_INFO_NAME( cop402 ) | |
| 120 | #define CPU_COP420 CPU_GET_INFO_NAME( cop420 ) | |
| 121 | #define CPU_COP421 CPU_GET_INFO_NAME( cop421 ) | |
| 122 | #define CPU_COP422 CPU_GET_INFO_NAME( cop422 ) | |
| 89 | 123 | |
| 90 | */ | |
| 124 | #define CPU_COP404 CPU_GET_INFO_NAME( cop404 ) | |
| 125 | #define CPU_COP424 CPU_GET_INFO_NAME( cop424 ) | |
| 126 | #define CPU_COP425 CPU_GET_INFO_NAME( cop425 ) | |
| 127 | #define CPU_COP426 CPU_GET_INFO_NAME( cop426 ) | |
| 128 | #define CPU_COP444 CPU_GET_INFO_NAME( cop444 ) | |
| 129 | #define CPU_COP445 CPU_GET_INFO_NAME( cop445 ) | |
| 91 | 130 | |
| 92 | /* COP 41x */ | |
| 131 | /*************************************************************************** | |
| 132 | FUNCTION PROTOTYPES | |
| 133 | ***************************************************************************/ | |
| 134 | ||
| 135 | /* COP410 family */ | |
| 93 | 136 | extern CPU_GET_INFO( cop401 ); |
| 94 | 137 | extern CPU_GET_INFO( cop410 ); |
| 95 | 138 | extern CPU_GET_INFO( cop411 ); |
| 96 | 139 | |
| 97 | #define CPU_COP401 CPU_GET_INFO_NAME( cop401 ) | |
| 98 | #define CPU_COP410 CPU_GET_INFO_NAME( cop410 ) | |
| 99 | #define CPU_COP411 CPU_GET_INFO_NAME( cop411 ) | |
| 100 | ||
| 101 | /* COP 42x */ | |
| 140 | /* COP420 family */ | |
| 102 | 141 | extern CPU_GET_INFO( cop402 ); |
| 103 | 142 | extern CPU_GET_INFO( cop420 ); |
| 104 | 143 | extern CPU_GET_INFO( cop421 ); |
| 105 | 144 | extern CPU_GET_INFO( cop422 ); |
| 106 | 145 | |
| 107 | #define CPU_COP402 CPU_GET_INFO_NAME( cop402 ) | |
| 108 | #define CPU_COP420 CPU_GET_INFO_NAME( cop420 ) | |
| 109 | #define CPU_COP421 CPU_GET_INFO_NAME( cop421 ) | |
| 110 | #define CPU_COP422 CPU_GET_INFO_NAME( cop422 ) | |
| 111 | ||
| 112 | /* COP 44x */ | |
| 146 | /* COP444 family */ | |
| 113 | 147 | extern CPU_GET_INFO( cop404 ); |
| 114 | 148 | extern CPU_GET_INFO( cop424 ); |
| 115 | 149 | extern CPU_GET_INFO( cop425 ); |
| r4135 | r4136 | |
| 117 | 151 | extern CPU_GET_INFO( cop444 ); |
| 118 | 152 | extern CPU_GET_INFO( cop445 ); |
| 119 | 153 | |
| 120 | #define CPU_COP404 CPU_GET_INFO_NAME( cop404 ) | |
| 121 | #define CPU_COP424 CPU_GET_INFO_NAME( cop424 ) | |
| 122 | #define CPU_COP425 CPU_GET_INFO_NAME( cop425 ) | |
| 123 | #define CPU_COP426 CPU_GET_INFO_NAME( cop426 ) | |
| 124 | #define CPU_COP444 CPU_GET_INFO_NAME( cop444 ) | |
| 125 | #define CPU_COP445 CPU_GET_INFO_NAME( cop445 ) | |
| 154 | /* disassemblers */ | |
| 155 | extern CPU_DISASSEMBLE( cop410 ); | |
| 156 | extern CPU_DISASSEMBLE( cop420 ); | |
| 157 | extern CPU_DISASSEMBLE( cop444 ); | |
| 126 | 158 | |
| 127 | CPU_DISASSEMBLE( cop410 ); | |
| 128 | CPU_DISASSEMBLE( cop420 ); | |
| 129 | CPU_DISASSEMBLE( cop444 ); | |
| 130 | ||
| 131 | 159 | #endif /* __COP400__ */ |
| r4135 | r4136 | |
|---|---|---|
| 1200 | 1200 | *pCarry = k ? (rm & (1 << (32 - k))) : (R15 & C_MASK); |
| 1201 | 1201 | } |
| 1202 | 1202 | return k ? LSL(rm, k) : rm; |
| 1203 | break; | |
| 1204 | 1203 | |
| 1205 | 1204 | case 1: /* LSR */ |
| 1206 | 1205 | if (k == 0 || k == 32) |
| r4135 | r4136 | |
|---|---|---|
| 56 | 56 | #include "tms32010.h" |
| 57 | 57 | |
| 58 | 58 | |
| 59 | #ifndef INLINE | |
| 60 | #define INLINE static inline | |
| 61 | #endif | |
| 62 | 59 | |
| 63 | ||
| 64 | 60 | #define M_RDROM(A) TMS32010_ROM_RDMEM(A) |
| 65 | 61 | #define M_WRTROM(A,V) TMS32010_ROM_WRMEM(A,V) |
| 66 | 62 | #define M_RDRAM(A) TMS32010_RAM_RDMEM(A) |
| r4135 | r4136 | |
|---|---|---|
| 1661 | 1661 | { |
| 1662 | 1662 | case 0: |
| 1663 | 1663 | return generate_group_0(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1664 | break; | |
| 1665 | 1664 | |
| 1666 | 1665 | case 1: // MOVLS4 |
| 1667 | 1666 | scratch = (opcode & 0x0f) * 4; |
| r4135 | r4136 | |
| 1673 | 1672 | if (!in_delay_slot) |
| 1674 | 1673 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 1675 | 1674 | return TRUE; |
| 1676 | break; | |
| 1677 | 1675 | |
| 1678 | 1676 | case 2: |
| 1679 | 1677 | return generate_group_2(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1680 | break; | |
| 1681 | 1678 | case 3: |
| 1682 | 1679 | return generate_group_3(sh2, block, compiler, desc, opcode); |
| 1683 | break; | |
| 1684 | 1680 | case 4: |
| 1685 | 1681 | return generate_group_4(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1686 | break; | |
| 1687 | 1682 | |
| 1688 | 1683 | case 5: // MOVLL4 |
| 1689 | 1684 | scratch = (opcode & 0x0f) * 4; |
| r4135 | r4136 | |
| 1695 | 1690 | if (!in_delay_slot) |
| 1696 | 1691 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 1697 | 1692 | return TRUE; |
| 1698 | break; | |
| 1699 | 1693 | |
| 1700 | 1694 | case 6: |
| 1701 | 1695 | return generate_group_6(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1702 | break; | |
| 1703 | 1696 | |
| 1704 | 1697 | case 7: // ADDI |
| 1705 | 1698 | scratch = opcode & 0xff; |
| 1706 | 1699 | scratch2 = (UINT32)(INT32)(INT16)(INT8)scratch; |
| 1707 | 1700 | UML_ADD(block, R32(Rn), R32(Rn), IMM(scratch2)); // add Rn, Rn, scratch2 |
| 1708 | 1701 | return TRUE; |
| 1709 | break; | |
| 1710 | 1702 | |
| 1711 | 1703 | case 8: |
| 1712 | 1704 | return generate_group_8(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1713 | break; | |
| 1714 | 1705 | |
| 1715 | 1706 | case 9: // MOVWI |
| 1716 | 1707 | scratch = (desc->pc + 2) + ((opcode & 0xff) * 2) + 2; |
| r4135 | r4136 | |
| 1731 | 1722 | if (!in_delay_slot) |
| 1732 | 1723 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 1733 | 1724 | return TRUE; |
| 1734 | break; | |
| 1735 | 1725 | |
| 1736 | 1726 | case 10: // BRA |
| 1737 | 1727 | generate_delay_slot(sh2, block, compiler, desc); |
| r4135 | r4136 | |
| 1743 | 1733 | generate_update_cycles(sh2, block, compiler, IMM(sh2->ea), TRUE); // <subtract cycles> |
| 1744 | 1734 | UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode); // hashjmp sh2->ea |
| 1745 | 1735 | return TRUE; |
| 1746 | break; | |
| 1747 | 1736 | |
| 1748 | 1737 | case 11: // BSR |
| 1749 | 1738 | // panicstr @ 403da22 relies on the delay slot clobbering the PR set by a BSR, so |
| r4135 | r4136 | |
| 1758 | 1747 | generate_update_cycles(sh2, block, compiler, IMM(sh2->ea), TRUE); // <subtract cycles> |
| 1759 | 1748 | UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode); // hashjmp sh2->ea |
| 1760 | 1749 | return TRUE; |
| 1761 | break; | |
| 1762 | 1750 | |
| 1763 | 1751 | case 12: |
| 1764 | 1752 | return generate_group_12(sh2, block, compiler, desc, opcode, in_delay_slot); |
| 1765 | break; | |
| 1766 | 1753 | |
| 1767 | 1754 | case 13: // MOVLI |
| 1768 | 1755 | scratch = ((desc->pc + 4) & ~3) + ((opcode & 0xff) * 4); |
| r4135 | r4136 | |
| 1782 | 1769 | if (!in_delay_slot) |
| 1783 | 1770 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 1784 | 1771 | return TRUE; |
| 1785 | break; | |
| 1786 | 1772 | |
| 1787 | 1773 | case 14: // MOVI |
| 1788 | 1774 | scratch = opcode & 0xff; |
| 1789 | 1775 | scratch2 = (UINT32)(INT32)(INT16)(INT8)scratch; |
| 1790 | 1776 | UML_MOV(block, R32(Rn), IMM(scratch2)); |
| 1791 | 1777 | return TRUE; |
| 1792 | break; | |
| 1793 | 1778 | |
| 1794 | 1779 | case 15: // NOP |
| 1795 | 1780 | return TRUE; |
| 1796 | break; | |
| 1797 | 1781 | } |
| 1798 | 1782 | |
| 1799 | 1783 | return FALSE; |
| r4135 | r4136 | |
| 1820 | 1804 | case 0x3a: // NOP(); |
| 1821 | 1805 | case 0x3b: // NOP(); |
| 1822 | 1806 | return TRUE; |
| 1823 | break; | |
| 1824 | 1807 | |
| 1825 | 1808 | case 0x02: // STCSR(Rn); |
| 1826 | 1809 | UML_MOV(block, R32(Rn), MEM(&sh2->sr)); |
| 1827 | 1810 | return TRUE; |
| 1828 | break; | |
| 1829 | 1811 | |
| 1830 | 1812 | case 0x03: // BSRF(Rn); |
| 1831 | 1813 | if (sh2->cpu_type > CPU_TYPE_SH1) |
| r4135 | r4136 | |
| 1855 | 1837 | if (!in_delay_slot) |
| 1856 | 1838 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 1857 | 1839 | return TRUE; |
| 1858 | break; | |
| 1859 | 1840 | |
| 1860 | 1841 | case 0x05: // MOVWS0(Rm, Rn); |
| 1861 | 1842 | case 0x15: // MOVWS0(Rm, Rn); |
| r4135 | r4136 | |
| 1869 | 1850 | if (!in_delay_slot) |
| 1870 | 1851 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 1871 | 1852 | return TRUE; |
| 1872 | break; | |
| 1873 | 1853 | |
| 1874 | 1854 | case 0x06: // MOVLS0(Rm, Rn); |
| 1875 | 1855 | case 0x16: // MOVLS0(Rm, Rn); |
| r4135 | r4136 | |
| 1882 | 1862 | if (!in_delay_slot) |
| 1883 | 1863 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 1884 | 1864 | return TRUE; |
| 1885 | break; | |
| 1886 | 1865 | |
| 1887 | 1866 | case 0x07: // MULL(Rm, Rn); |
| 1888 | 1867 | case 0x17: // MULL(Rm, Rn); |
| r4135 | r4136 | |
| 1898 | 1877 | case 0x08: // CLRT(); |
| 1899 | 1878 | UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T)); // and r0, sr, ~T (clear the T bit) |
| 1900 | 1879 | return TRUE; |
| 1901 | break; | |
| 1902 | 1880 | |
| 1903 | 1881 | case 0x0a: // STSMACH(Rn); |
| 1904 | 1882 | UML_MOV(block, R32(Rn), MEM(&sh2->mach)); // mov Rn, mach |
| 1905 | 1883 | return TRUE; |
| 1906 | break; | |
| 1907 | 1884 | |
| 1908 | 1885 | case 0x0b: // RTS(); |
| 1909 | 1886 | UML_MOV(block, MEM(&sh2->target), MEM(&sh2->pr)); // mov target, pr (in case of d-slot shenanigans) |
| r4135 | r4136 | |
| 1913 | 1890 | generate_update_cycles(sh2, block, compiler, MEM(&sh2->target), TRUE); // <subtract cycles> |
| 1914 | 1891 | UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode); |
| 1915 | 1892 | return TRUE; |
| 1916 | break; | |
| 1917 | 1893 | |
| 1918 | 1894 | case 0x0c: // MOVBL0(Rm, Rn); |
| 1919 | 1895 | case 0x1c: // MOVBL0(Rm, Rn); |
| r4135 | r4136 | |
| 1926 | 1902 | if (!in_delay_slot) |
| 1927 | 1903 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 1928 | 1904 | return TRUE; |
| 1929 | break; | |
| 1930 | 1905 | |
| 1931 | 1906 | case 0x0d: // MOVWL0(Rm, Rn); |
| 1932 | 1907 | case 0x1d: // MOVWL0(Rm, Rn); |
| r4135 | r4136 | |
| 1939 | 1914 | if (!in_delay_slot) |
| 1940 | 1915 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 1941 | 1916 | return TRUE; |
| 1942 | break; | |
| 1943 | 1917 | |
| 1944 | 1918 | case 0x0e: // MOVLL0(Rm, Rn); |
| 1945 | 1919 | case 0x1e: // MOVLL0(Rm, Rn); |
| r4135 | r4136 | |
| 1952 | 1926 | if (!in_delay_slot) |
| 1953 | 1927 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 1954 | 1928 | return TRUE; |
| 1955 | break; | |
| 1956 | 1929 | |
| 1957 | 1930 | case 0x0f: // MAC_L(Rm, Rn); |
| 1958 | 1931 | case 0x1f: // MAC_L(Rm, Rn); |
| r4135 | r4136 | |
| 1971 | 1944 | case 0x12: // STCGBR(Rn); |
| 1972 | 1945 | UML_MOV(block, R32(Rn), MEM(&sh2->gbr)); // mov Rn, gbr |
| 1973 | 1946 | return TRUE; |
| 1974 | break; | |
| 1975 | 1947 | |
| 1976 | 1948 | case 0x18: // SETT(); |
| 1977 | 1949 | UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T)); // or sr, sr, T |
| 1978 | 1950 | return TRUE; |
| 1979 | break; | |
| 1980 | 1951 | |
| 1981 | 1952 | case 0x19: // DIV0U(); |
| 1982 | 1953 | UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~(M|Q|T))); // and sr, sr, ~(M|Q|T) |
| 1983 | 1954 | return TRUE; |
| 1984 | break; | |
| 1985 | 1955 | |
| 1986 | 1956 | case 0x1a: // STSMACL(Rn); |
| 1987 | 1957 | UML_MOV(block, R32(Rn), MEM(&sh2->macl)); // mov Rn, macl |
| 1988 | 1958 | return TRUE; |
| 1989 | break; | |
| 1990 | 1959 | |
| 1991 | 1960 | case 0x1b: // SLEEP(); |
| 1992 | 1961 | // inlined special version of generate_update_cycles here |
| r4135 | r4136 | |
| 2024 | 1993 | } |
| 2025 | 1994 | |
| 2026 | 1995 | return TRUE; |
| 2027 | break; | |
| 2028 | 1996 | |
| 2029 | 1997 | case 0x22: // STCVBR(Rn); |
| 2030 | 1998 | UML_MOV(block, R32(Rn), MEM(&sh2->vbr)); // mov Rn, vbr |
| 2031 | 1999 | return TRUE; |
| 2032 | break; | |
| 2033 | 2000 | |
| 2034 | 2001 | case 0x23: // BRAF(Rn); |
| 2035 | 2002 | if (sh2->cpu_type > CPU_TYPE_SH1) |
| r4135 | r4136 | |
| 2048 | 2015 | UML_MOV(block, MEM(&sh2->macl), IMM(0)); // mov macl, #0 |
| 2049 | 2016 | UML_MOV(block, MEM(&sh2->mach), IMM(0)); // mov mach, #0 |
| 2050 | 2017 | return TRUE; |
| 2051 | break; | |
| 2052 | 2018 | |
| 2053 | 2019 | case 0x29: // MOVT(Rn); |
| 2054 | 2020 | UML_AND(block, R32(Rn), MEM(&sh2->sr), IMM(T)); // and Rn, sr, T |
| 2055 | 2021 | return TRUE; |
| 2056 | break; | |
| 2057 | 2022 | |
| 2058 | 2023 | case 0x2a: // STSPR(Rn); |
| 2059 | 2024 | UML_MOV(block, R32(Rn), MEM(&sh2->pr)); // mov Rn, pr |
| 2060 | 2025 | return TRUE; |
| 2061 | break; | |
| 2062 | 2026 | |
| 2063 | 2027 | case 0x2b: // RTE(); |
| 2064 | 2028 | generate_delay_slot(sh2, block, compiler, desc); |
| r4135 | r4136 | |
| 2079 | 2043 | UML_HASHJMP(block, IMM(0), MEM(&sh2->pc), sh2->nocode); // and jump to the "resume PC" |
| 2080 | 2044 | |
| 2081 | 2045 | return TRUE; |
| 2082 | break; | |
| 2083 | 2046 | } |
| 2084 | 2047 | |
| 2085 | 2048 | return FALSE; |
| r4135 | r4136 | |
| 2098 | 2061 | if (!in_delay_slot) |
| 2099 | 2062 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2100 | 2063 | return TRUE; |
| 2101 | break; | |
| 2102 | 2064 | |
| 2103 | 2065 | case 1: // MOVWS(Rm, Rn); |
| 2104 | 2066 | UML_MOV(block, IREG(0), R32(Rn)); // mov r0, Rn |
| r4135 | r4136 | |
| 2109 | 2071 | if (!in_delay_slot) |
| 2110 | 2072 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2111 | 2073 | return TRUE; |
| 2112 | break; | |
| 2113 | 2074 | |
| 2114 | 2075 | case 2: // MOVLS(Rm, Rn); |
| 2115 | 2076 | UML_MOV(block, IREG(0), R32(Rn)); // mov r0, Rn |
| r4135 | r4136 | |
| 2119 | 2080 | if (!in_delay_slot) |
| 2120 | 2081 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2121 | 2082 | return TRUE; |
| 2122 | break; | |
| 2123 | 2083 | |
| 2124 | 2084 | case 3: // NOP(); |
| 2125 | 2085 | return TRUE; |
| 2126 | break; | |
| 2127 | 2086 | |
| 2128 | 2087 | case 4: // MOVBM(Rm, Rn); |
| 2129 | 2088 | UML_MOV(block, IREG(1), R32(Rm)); // mov r1, Rm |
| r4135 | r4136 | |
| 2134 | 2093 | if (!in_delay_slot) |
| 2135 | 2094 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2136 | 2095 | return TRUE; |
| 2137 | break; | |
| 2138 | 2096 | |
| 2139 | 2097 | case 5: // MOVWM(Rm, Rn); |
| 2140 | 2098 | UML_MOV(block, IREG(1), R32(Rm)); // mov r1, Rm |
| r4135 | r4136 | |
| 2145 | 2103 | if (!in_delay_slot) |
| 2146 | 2104 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2147 | 2105 | return TRUE; |
| 2148 | break; | |
| 2149 | 2106 | |
| 2150 | 2107 | case 6: // MOVLM(Rm, Rn); |
| 2151 | 2108 | UML_MOV(block, IREG(1), R32(Rm)); // mov r1, Rm |
| r4135 | r4136 | |
| 2156 | 2113 | if (!in_delay_slot) |
| 2157 | 2114 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2158 | 2115 | return TRUE; |
| 2159 | break; | |
| 2160 | 2116 | |
| 2161 | 2117 | case 13: // XTRCT(Rm, Rn); |
| 2162 | 2118 | UML_SHL(block, IREG(0), R32(Rm), IMM(16)); // shl r0, Rm, #16 |
| r4135 | r4136 | |
| 2167 | 2123 | |
| 2168 | 2124 | UML_OR(block, R32(Rn), IREG(0), IREG(1)); // or Rn, r0, r1 |
| 2169 | 2125 | return TRUE; |
| 2170 | break; | |
| 2171 | 2126 | |
| 2172 | 2127 | case 7: // DIV0S(Rm, Rn); |
| 2173 | 2128 | UML_MOV(block, IREG(0), MEM(&sh2->sr)); // move r0, sr |
| r4135 | r4136 | |
| 2193 | 2148 | UML_LABEL(block, compiler->labelnum++); // labelnum: |
| 2194 | 2149 | UML_MOV(block, MEM(&sh2->sr), IREG(0)); // mov sr, r0 |
| 2195 | 2150 | return TRUE; |
| 2196 | break; | |
| 2197 | 2151 | |
| 2198 | 2152 | case 8: // TST(Rm, Rn); |
| 2199 | 2153 | UML_AND(block, IREG(0), MEM(&sh2->sr), IMM(~T)); // and r0, sr, ~T (clear the T bit) |
| r4135 | r4136 | |
| 2205 | 2159 | |
| 2206 | 2160 | UML_MOV(block, MEM(&sh2->sr), IREG(0)); // mov sh2->sr, r0 |
| 2207 | 2161 | return TRUE; |
| 2208 | break; | |
| 2209 | 2162 | |
| 2210 | 2163 | case 12: // CMPSTR(Rm, Rn); |
| 2211 | 2164 | UML_XOR(block, IREG(0), R32(Rn), R32(Rm)); // xor r0, Rn, Rm (temp) |
| r4135 | r4136 | |
| 2237 | 2190 | |
| 2238 | 2191 | UML_LABEL(block, compiler->labelnum++); // labelnum+1: |
| 2239 | 2192 | return TRUE; |
| 2240 | break; | |
| 2241 | 2193 | |
| 2242 | 2194 | case 9: // AND(Rm, Rn); |
| 2243 | 2195 | UML_AND(block, R32(Rn), R32(Rn), R32(Rm)); // and Rn, Rn, Rm |
| 2244 | 2196 | return TRUE; |
| 2245 | break; | |
| 2246 | 2197 | |
| 2247 | 2198 | case 10: // XOR(Rm, Rn); |
| 2248 | 2199 | UML_XOR(block, R32(Rn), R32(Rn), R32(Rm)); // xor Rn, Rn, Rm |
| 2249 | 2200 | return TRUE; |
| 2250 | break; | |
| 2251 | 2201 | |
| 2252 | 2202 | case 11: // OR(Rm, Rn); |
| 2253 | 2203 | UML_OR(block, R32(Rn), R32(Rn), R32(Rm)); // or Rn, Rn, Rm |
| 2254 | 2204 | return TRUE; |
| 2255 | break; | |
| 2256 | 2205 | |
| 2257 | 2206 | case 14: // MULU(Rm, Rn); |
| 2258 | 2207 | UML_AND(block, IREG(0), R32(Rm), IMM(0xffff)); // and r0, Rm, 0xffff |
| 2259 | 2208 | UML_AND(block, IREG(1), R32(Rn), IMM(0xffff)); // and r1, Rn, 0xffff |
| 2260 | 2209 | UML_MULU(block, MEM(&sh2->macl), MEM(&sh2->ea), IREG(0), IREG(1)); // mulu macl, ea, r0, r1 |
| 2261 | 2210 | return TRUE; |
| 2262 | break; | |
| 2263 | 2211 | |
| 2264 | 2212 | case 15: // MULS(Rm, Rn); |
| 2265 | 2213 | UML_SEXT(block, IREG(0), R32(Rm), WORD); // sext r0, Rm |
| 2266 | 2214 | UML_SEXT(block, IREG(1), R32(Rn), WORD); // sext r1, Rn |
| 2267 | 2215 | UML_MULS(block, MEM(&sh2->macl), MEM(&sh2->ea), IREG(0), IREG(1)); // muls macl, ea, r0, r1 |
| 2268 | 2216 | return TRUE; |
| 2269 | break; | |
| 2270 | 2217 | } |
| 2271 | 2218 | |
| 2272 | 2219 | return FALSE; |
| r4135 | r4136 | |
| 2281 | 2228 | UML_SETc(block, IF_E, IREG(0)); // set E, r0 |
| 2282 | 2229 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(1)); // rolins sr, r0, 0, 1 |
| 2283 | 2230 | return TRUE; |
| 2284 | break; | |
| 2285 | 2231 | |
| 2286 | 2232 | case 2: // CMPHS(Rm, Rn); (unsigned greater than or equal) |
| 2287 | 2233 | UML_CMP(block, R32(Rn), R32(Rm)); // cmp Rn, Rm |
| 2288 | 2234 | UML_SETc(block, IF_AE, IREG(0)); // set AE, r0 |
| 2289 | 2235 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(1)); // rolins sr, r0, 0, 1 |
| 2290 | 2236 | return TRUE; |
| 2291 | break; | |
| 2292 | 2237 | |
| 2293 | 2238 | case 3: // CMPGE(Rm, Rn); (signed greater than or equal) |
| 2294 | 2239 | UML_CMP(block, R32(Rn), R32(Rm)); // cmp Rn, Rm |
| 2295 | 2240 | UML_SETc(block, IF_GE, IREG(0)); // set GE, r0 |
| 2296 | 2241 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(1)); // rolins sr, r0, 0, 1 |
| 2297 | 2242 | return TRUE; |
| 2298 | break; | |
| 2299 | 2243 | |
| 2300 | 2244 | case 6: // CMPHI(Rm, Rn); (unsigned greater than) |
| 2301 | 2245 | UML_CMP(block, R32(Rn), R32(Rm)); // cmp Rn, Rm |
| 2302 | 2246 | UML_SETc(block, IF_A, IREG(0)); // set A, r0 |
| 2303 | 2247 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(1)); // rolins sr, r0, 0, 1 |
| 2304 | 2248 | return TRUE; |
| 2305 | break; | |
| 2306 | 2249 | |
| 2307 | 2250 | case 7: // CMPGT(Rm, Rn); (signed greater than) |
| 2308 | 2251 | UML_CMP(block, R32(Rn), R32(Rm)); // cmp Rn, Rm |
| 2309 | 2252 | UML_SETc(block, IF_G, IREG(0)); // set G, r0 |
| 2310 | 2253 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(1)); // rolins sr, r0, 0, 1 |
| 2311 | 2254 | return TRUE; |
| 2312 | break; | |
| 2313 | 2255 | |
| 2314 | 2256 | case 1: // NOP(); |
| 2315 | 2257 | case 9: // NOP(); |
| 2316 | 2258 | return TRUE; |
| 2317 | break; | |
| 2318 | 2259 | |
| 2319 | 2260 | case 4: // DIV1(Rm, Rn); |
| 2320 | 2261 | save_fast_iregs(sh2, block); |
| r4135 | r4136 | |
| 2322 | 2263 | UML_CALLC(block, cfunc_DIV1, sh2); |
| 2323 | 2264 | load_fast_iregs(sh2, block); |
| 2324 | 2265 | return TRUE; |
| 2325 | break; | |
| 2326 | 2266 | |
| 2327 | 2267 | case 5: // DMULU(Rm, Rn); |
| 2328 | 2268 | if (sh2->cpu_type > CPU_TYPE_SH1) |
| r4135 | r4136 | |
| 2343 | 2283 | case 8: // SUB(Rm, Rn); |
| 2344 | 2284 | UML_SUB(block, R32(Rn), R32(Rn), R32(Rm)); // sub Rn, Rn, Rm |
| 2345 | 2285 | return TRUE; |
| 2346 | break; | |
| 2347 | 2286 | |
| 2348 | 2287 | case 12: // ADD(Rm, Rn); |
| 2349 | 2288 | UML_ADD(block, R32(Rn), R32(Rn), R32(Rm)); // add Rn, Rn, Rm |
| 2350 | 2289 | return TRUE; |
| 2351 | break; | |
| 2352 | 2290 | |
| 2353 | 2291 | case 10: // SUBC(Rm, Rn); |
| 2354 | 2292 | UML_CARRY(block, MEM(&sh2->sr), IMM(0)); // carry = T (T is bit 0 of SR) |
| r4135 | r4136 | |
| 2356 | 2294 | UML_SETc(block, IF_C, IREG(0)); // setc i0, C |
| 2357 | 2295 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(T)); // rolins sr,i0,0,T |
| 2358 | 2296 | return TRUE; |
| 2359 | break; | |
| 2360 | 2297 | |
| 2361 | 2298 | case 11: // SUBV(Rm, Rn); |
| 2362 | 2299 | #if ADDSUBV_DIRECT |
| r4135 | r4136 | |
| 2370 | 2307 | load_fast_iregs(sh2, block); |
| 2371 | 2308 | #endif |
| 2372 | 2309 | return TRUE; |
| 2373 | break; | |
| 2374 | 2310 | |
| 2375 | 2311 | case 14: // ADDC(Rm, Rn); |
| 2376 | 2312 | UML_CARRY(block, MEM(&sh2->sr), IMM(0)); // carry = T (T is bit 0 of SR) |
| r4135 | r4136 | |
| 2378 | 2314 | UML_SETc(block, IF_C, IREG(0)); // setc i0, C |
| 2379 | 2315 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(T)); // rolins sr,i0,0,T |
| 2380 | 2316 | return TRUE; |
| 2381 | break; | |
| 2382 | 2317 | |
| 2383 | 2318 | case 15: // ADDV(Rm, Rn); |
| 2384 | 2319 | #if ADDSUBV_DIRECT |
| r4135 | r4136 | |
| 2392 | 2327 | load_fast_iregs(sh2, block); |
| 2393 | 2328 | #endif |
| 2394 | 2329 | return TRUE; |
| 2395 | break; | |
| 2396 | 2330 | } |
| 2397 | 2331 | return FALSE; |
| 2398 | 2332 | } |
| r4135 | r4136 | |
| 2406 | 2340 | UML_SETc(block, IF_C, IREG(0)); // set i0,C |
| 2407 | 2341 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(T)); // rolins [sr],i0,0,T |
| 2408 | 2342 | return TRUE; |
| 2409 | break; | |
| 2410 | 2343 | |
| 2411 | 2344 | case 0x01: // SHLR(Rn); |
| 2412 | 2345 | UML_SHR(block, R32(Rn), R32(Rn), IMM(1)); // shr Rn, Rn, 1 |
| 2413 | 2346 | UML_SETc(block, IF_C, IREG(0)); // set i0,C |
| 2414 | 2347 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(T)); // rolins [sr],i0,0,T |
| 2415 | 2348 | return TRUE; |
| 2416 | break; | |
| 2417 | 2349 | |
| 2418 | 2350 | case 0x04: // ROTL(Rn); |
| 2419 | 2351 | UML_ROL(block, R32(Rn), R32(Rn), IMM(1)); // rol Rn, Rn, 1 |
| 2420 | 2352 | UML_SETc(block, IF_C, IREG(0)); // set i0,C |
| 2421 | 2353 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(T)); // rolins [sr],i0,0,T |
| 2422 | 2354 | return TRUE; |
| 2423 | break; | |
| 2424 | 2355 | |
| 2425 | 2356 | case 0x05: // ROTR(Rn); |
| 2426 | 2357 | UML_ROR(block, R32(Rn), R32(Rn), IMM(1)); // ror Rn, Rn, 1 |
| 2427 | 2358 | UML_SETc(block, IF_C, IREG(0)); // set i0,C |
| 2428 | 2359 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(T)); // rolins [sr],i0,0,T |
| 2429 | 2360 | return TRUE; |
| 2430 | break; | |
| 2431 | 2361 | |
| 2432 | 2362 | case 0x02: // STSMMACH(Rn); |
| 2433 | 2363 | UML_SUB(block, R32(Rn), R32(Rn), IMM(4)); // sub Rn, Rn, #4 |
| r4135 | r4136 | |
| 2439 | 2369 | if (!in_delay_slot) |
| 2440 | 2370 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2441 | 2371 | return TRUE; |
| 2442 | break; | |
| 2443 | 2372 | |
| 2444 | 2373 | case 0x03: // STCMSR(Rn); |
| 2445 | 2374 | UML_SUB(block, R32(Rn), R32(Rn), IMM(4)); // sub Rn, Rn, #4 |
| r4135 | r4136 | |
| 2451 | 2380 | if (!in_delay_slot) |
| 2452 | 2381 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2453 | 2382 | return TRUE; |
| 2454 | break; | |
| 2455 | 2383 | |
| 2456 | 2384 | case 0x06: // LDSMMACH(Rn); |
| 2457 | 2385 | UML_MOV(block, IREG(0), R32(Rn)); // mov r0, Rn |
| r4135 | r4136 | |
| 2463 | 2391 | if (!in_delay_slot) |
| 2464 | 2392 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2465 | 2393 | return TRUE; |
| 2466 | break; | |
| 2467 | 2394 | |
| 2468 | 2395 | case 0x07: // LDCMSR(Rn); |
| 2469 | 2396 | UML_MOV(block, IREG(0), R32(Rn)); // mov r0, Rn |
| r4135 | r4136 | |
| 2476 | 2403 | if (!in_delay_slot) |
| 2477 | 2404 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2478 | 2405 | return TRUE; |
| 2479 | break; | |
| 2480 | 2406 | |
| 2407 | ||
| 2481 | 2408 | case 0x08: // SHLL2(Rn); |
| 2482 | 2409 | UML_SHL(block, R32(Rn), R32(Rn), IMM(2)); |
| 2483 | 2410 | return TRUE; |
| 2484 | break; | |
| 2485 | 2411 | |
| 2486 | 2412 | case 0x09: // SHLR2(Rn); |
| 2487 | 2413 | UML_SHR(block, R32(Rn), R32(Rn), IMM(2)); |
| 2488 | 2414 | return TRUE; |
| 2489 | break; | |
| 2490 | 2415 | |
| 2491 | 2416 | case 0x18: // SHLL8(Rn); |
| 2492 | 2417 | UML_SHL(block, R32(Rn), R32(Rn), IMM(8)); |
| 2493 | 2418 | return TRUE; |
| 2494 | break; | |
| 2495 | 2419 | |
| 2496 | 2420 | case 0x19: // SHLR8(Rn); |
| 2497 | 2421 | UML_SHR(block, R32(Rn), R32(Rn), IMM(8)); |
| 2498 | 2422 | return TRUE; |
| 2499 | break; | |
| 2500 | 2423 | |
| 2501 | 2424 | case 0x28: // SHLL16(Rn); |
| 2502 | 2425 | UML_SHL(block, R32(Rn), R32(Rn), IMM(16)); |
| 2503 | 2426 | return TRUE; |
| 2504 | break; | |
| 2505 | 2427 | |
| 2506 | 2428 | case 0x29: // SHLR16(Rn); |
| 2507 | 2429 | UML_SHR(block, R32(Rn), R32(Rn), IMM(16)); |
| 2508 | 2430 | return TRUE; |
| 2509 | break; | |
| 2510 | 2431 | |
| 2511 | 2432 | case 0x0a: // LDSMACH(Rn); |
| 2512 | 2433 | UML_MOV(block, MEM(&sh2->mach), R32(Rn)); // mov mach, Rn |
| 2513 | 2434 | return TRUE; |
| 2514 | break; | |
| 2515 | 2435 | |
| 2516 | 2436 | case 0x0b: // JSR(Rn); |
| 2517 | 2437 | UML_MOV(block, MEM(&sh2->target), R32(Rn)); // mov target, Rn |
| r4135 | r4136 | |
| 2523 | 2443 | generate_update_cycles(sh2, block, compiler, MEM(&sh2->target), TRUE); // <subtract cycles> |
| 2524 | 2444 | UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode); // and do the jump |
| 2525 | 2445 | return TRUE; |
| 2526 | break; | |
| 2527 | 2446 | |
| 2528 | 2447 | case 0x0e: // LDCSR(Rn); |
| 2529 | 2448 | UML_MOV(block, IREG(0), R32(Rn)); // mov r0, Rn |
| r4135 | r4136 | |
| 2532 | 2451 | |
| 2533 | 2452 | compiler->checkints = TRUE; |
| 2534 | 2453 | return TRUE; |
| 2535 | break; | |
| 2536 | 2454 | |
| 2537 | 2455 | case 0x0f: // MAC_W(Rm, Rn); |
| 2538 | 2456 | case 0x1f: // MAC_W(Rm, Rn); |
| r4135 | r4136 | |
| 2543 | 2461 | UML_CALLC(block, cfunc_MAC_W, sh2); |
| 2544 | 2462 | load_fast_iregs(sh2, block); |
| 2545 | 2463 | return TRUE; |
| 2546 | break; | |
| 2547 | 2464 | |
| 2548 | 2465 | case 0x10: // DT(Rn); |
| 2549 | 2466 | if (sh2->cpu_type > CPU_TYPE_SH1) |
| r4135 | r4136 | |
| 2571 | 2488 | |
| 2572 | 2489 | UML_MOV(block, MEM(&sh2->sr), IREG(0)); // mov sh2->sr, r0 |
| 2573 | 2490 | return TRUE; |
| 2574 | break; | |
| 2575 | 2491 | |
| 2576 | 2492 | case 0x15: // CMPPL(Rn); |
| 2577 | 2493 | UML_AND(block, IREG(0), MEM(&sh2->sr), IMM(~T)); // and r0, sr, ~T (clear the T bit) |
| r4135 | r4136 | |
| 2586 | 2502 | UML_LABEL(block, compiler->labelnum++); // desc->pc: |
| 2587 | 2503 | UML_MOV(block, MEM(&sh2->sr), IREG(0)); // mov sh2->sr, r0 |
| 2588 | 2504 | return TRUE; |
| 2589 | break; | |
| 2590 | 2505 | |
| 2591 | 2506 | case 0x12: // STSMMACL(Rn); |
| 2592 | 2507 | UML_SUB(block, R32(Rn), R32(Rn), IMM(4)); // sub Rn, Rn, #4 |
| r4135 | r4136 | |
| 2598 | 2513 | if (!in_delay_slot) |
| 2599 | 2514 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2600 | 2515 | return TRUE; |
| 2601 | break; | |
| 2602 | 2516 | |
| 2603 | 2517 | case 0x13: // STCMGBR(Rn); |
| 2604 | 2518 | UML_SUB(block, R32(Rn), R32(Rn), IMM(4)); // sub Rn, Rn, #4 |
| r4135 | r4136 | |
| 2610 | 2524 | if (!in_delay_slot) |
| 2611 | 2525 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2612 | 2526 | return TRUE; |
| 2613 | break; | |
| 2614 | 2527 | |
| 2615 | 2528 | case 0x16: // LDSMMACL(Rn); |
| 2616 | 2529 | UML_MOV(block, IREG(0), R32(Rn)); // mov r0, Rn |
| r4135 | r4136 | |
| 2622 | 2535 | if (!in_delay_slot) |
| 2623 | 2536 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2624 | 2537 | return TRUE; |
| 2625 | break; | |
| 2626 | 2538 | |
| 2627 | 2539 | case 0x17: // LDCMGBR(Rn); |
| 2628 | 2540 | UML_MOV(block, IREG(0), R32(Rn)); // mov r0, Rn |
| r4135 | r4136 | |
| 2634 | 2546 | if (!in_delay_slot) |
| 2635 | 2547 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2636 | 2548 | return TRUE; |
| 2637 | break; | |
| 2638 | 2549 | |
| 2639 | 2550 | case 0x1a: // LDSMACL(Rn); |
| 2640 | 2551 | UML_MOV(block, MEM(&sh2->macl), R32(Rn)); // mov macl, Rn |
| 2641 | 2552 | return TRUE; |
| 2642 | break; | |
| 2643 | 2553 | |
| 2644 | 2554 | case 0x1b: // TAS(Rn); |
| 2645 | 2555 | UML_MOV(block, IREG(0), R32(Rn)); // mov r0, Rn |
| r4135 | r4136 | |
| 2663 | 2573 | if (!in_delay_slot) |
| 2664 | 2574 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2665 | 2575 | return TRUE; |
| 2666 | break; | |
| 2667 | 2576 | |
| 2668 | 2577 | case 0x1e: // LDCGBR(Rn); |
| 2669 | 2578 | UML_MOV(block, MEM(&sh2->gbr), R32(Rn)); // mov gbr, Rn |
| 2670 | 2579 | return TRUE; |
| 2671 | break; | |
| 2672 | 2580 | |
| 2673 | 2581 | case 0x20: // SHAL(Rn); |
| 2674 | 2582 | UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T)); // and sr, sr, ~T |
| r4135 | r4136 | |
| 2677 | 2585 | UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IREG(0)); // or sr, sr, r0 |
| 2678 | 2586 | UML_SHL(block, R32(Rn), R32(Rn), IMM(1)); // shl Rn, Rn, 1 |
| 2679 | 2587 | return TRUE; |
| 2680 | break; | |
| 2681 | 2588 | |
| 2682 | 2589 | case 0x21: // SHAR(Rn); |
| 2683 | 2590 | UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T)); // and sr, sr, ~T |
| r4135 | r4136 | |
| 2685 | 2592 | UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IREG(0)); // or sr, sr, r0 |
| 2686 | 2593 | UML_SAR(block, R32(Rn), R32(Rn), IMM(1)); // sar Rn, Rn, 1 |
| 2687 | 2594 | return TRUE; |
| 2688 | break; | |
| 2689 | 2595 | |
| 2690 | 2596 | case 0x22: // STSMPR(Rn); |
| 2691 | 2597 | UML_SUB(block, R32(Rn), R32(Rn), IMM(4)); // sub Rn, Rn, 4 |
| r4135 | r4136 | |
| 2697 | 2603 | if (!in_delay_slot) |
| 2698 | 2604 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2699 | 2605 | return TRUE; |
| 2700 | break; | |
| 2701 | 2606 | |
| 2702 | 2607 | case 0x23: // STCMVBR(Rn); |
| 2703 | 2608 | UML_SUB(block, R32(Rn), R32(Rn), IMM(4)); // sub Rn, Rn, 4 |
| r4135 | r4136 | |
| 2709 | 2614 | if (!in_delay_slot) |
| 2710 | 2615 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2711 | 2616 | return TRUE; |
| 2712 | break; | |
| 2713 | 2617 | |
| 2714 | 2618 | case 0x24: // ROTCL(Rn); |
| 2715 | 2619 | UML_CARRY(block, MEM(&sh2->sr), IMM(0)); // carry sr,0 |
| r4135 | r4136 | |
| 2717 | 2621 | UML_SETc(block, IF_C, IREG(0)); // set i0,C |
| 2718 | 2622 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(T)); // rolins sr,i0,0,T |
| 2719 | 2623 | return TRUE; |
| 2720 | break; | |
| 2721 | 2624 | |
| 2722 | 2625 | case 0x25: // ROTCR(Rn); |
| 2723 | 2626 | UML_CARRY(block, MEM(&sh2->sr), IMM(0)); // carry sr,0 |
| r4135 | r4136 | |
| 2725 | 2628 | UML_SETc(block, IF_C, IREG(0)); // set i0,C |
| 2726 | 2629 | UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(T)); // rolins sr,i0,0,T |
| 2727 | 2630 | return TRUE; |
| 2728 | break; | |
| 2729 | 2631 | |
| 2730 | 2632 | case 0x26: // LDSMPR(Rn); |
| 2731 | 2633 | UML_MOV(block, IREG(0), R32(Rn)); // mov r0, Rn |
| r4135 | r4136 | |
| 2737 | 2639 | if (!in_delay_slot) |
| 2738 | 2640 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2739 | 2641 | return TRUE; |
| 2740 | break; | |
| 2741 | 2642 | |
| 2742 | 2643 | case 0x27: // LDCMVBR(Rn); |
| 2743 | 2644 | UML_MOV(block, IREG(0), R32(Rn)); // mov r0, Rn |
| r4135 | r4136 | |
| 2749 | 2650 | if (!in_delay_slot) |
| 2750 | 2651 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2751 | 2652 | return TRUE; |
| 2752 | break; | |
| 2753 | 2653 | |
| 2754 | 2654 | case 0x2a: // LDSPR(Rn); |
| 2755 | 2655 | UML_MOV(block, MEM(&sh2->pr), R32(Rn)); // mov sh2->pr, Rn |
| 2756 | 2656 | return TRUE; |
| 2757 | break; | |
| 2758 | 2657 | |
| 2759 | 2658 | case 0x2b: // JMP(Rn); |
| 2760 | 2659 | UML_MOV(block, MEM(&sh2->target), R32(Rn)); // mov target, Rn |
| r4135 | r4136 | |
| 2764 | 2663 | generate_update_cycles(sh2, block, compiler, MEM(&sh2->target), TRUE); // <subtract cycles> |
| 2765 | 2664 | UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode); // jmp (target) |
| 2766 | 2665 | return TRUE; |
| 2767 | break; | |
| 2768 | 2666 | |
| 2769 | 2667 | case 0x2e: // LDCVBR(Rn); |
| 2770 | 2668 | UML_MOV(block, MEM(&sh2->vbr), R32(Rn)); // mov vbr, Rn |
| 2771 | 2669 | return TRUE; |
| 2772 | break; | |
| 2773 | 2670 | |
| 2774 | 2671 | case 0x0c: // NOP(); |
| 2775 | 2672 | case 0x0d: // NOP(); |
| r4135 | r4136 | |
| 2794 | 2691 | case 0x3d: // NOP(); |
| 2795 | 2692 | case 0x3e: // NOP(); |
| 2796 | 2693 | return TRUE; |
| 2797 | break; | |
| 2798 | ||
| 2799 | 2694 | } |
| 2800 | 2695 | |
| 2801 | 2696 | return FALSE; |
| r4135 | r4136 | |
| 2814 | 2709 | if (!in_delay_slot) |
| 2815 | 2710 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2816 | 2711 | return TRUE; |
| 2817 | break; | |
| 2818 | 2712 | |
| 2819 | 2713 | case 1: // MOVWL(Rm, Rn); |
| 2820 | 2714 | UML_MOV(block, IREG(0), R32(Rm)); // mov r0, Rm |
| r4135 | r4136 | |
| 2825 | 2719 | if (!in_delay_slot) |
| 2826 | 2720 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2827 | 2721 | return TRUE; |
| 2828 | break; | |
| 2829 | 2722 | |
| 2830 | 2723 | case 2: // MOVLL(Rm, Rn); |
| 2831 | 2724 | UML_MOV(block, IREG(0), R32(Rm)); // mov r0, Rm |
| r4135 | r4136 | |
| 2836 | 2729 | if (!in_delay_slot) |
| 2837 | 2730 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2838 | 2731 | return TRUE; |
| 2839 | break; | |
| 2840 | 2732 | |
| 2841 | 2733 | case 3: // MOV(Rm, Rn); |
| 2842 | 2734 | UML_MOV(block, R32(Rn), R32(Rm)); // mov Rn, Rm |
| 2843 | 2735 | return TRUE; |
| 2844 | break; | |
| 2845 | 2736 | |
| 2846 | 2737 | case 7: // NOT(Rm, Rn); |
| 2847 | 2738 | UML_XOR(block, R32(Rn), R32(Rm), IMM(0xffffffff)); // xor Rn, Rm, 0xffffffff |
| 2848 | 2739 | return TRUE; |
| 2849 | break; | |
| 2850 | 2740 | |
| 2851 | 2741 | case 9: // SWAPW(Rm, Rn); |
| 2852 | 2742 | UML_ROL(block, R32(Rn), R32(Rm), IMM(16)); // rol Rn, Rm, 16 |
| 2853 | 2743 | return TRUE; |
| 2854 | break; | |
| 2855 | 2744 | |
| 2856 | 2745 | case 11: // NEG(Rm, Rn); |
| 2857 | 2746 | UML_SUB(block, R32(Rn), IMM(0), R32(Rm)); // sub Rn, 0, Rm |
| 2858 | 2747 | return TRUE; |
| 2859 | break; | |
| 2860 | 2748 | |
| 2861 | 2749 | case 12: // EXTUB(Rm, Rn); |
| 2862 | 2750 | UML_AND(block, R32(Rn), R32(Rm), IMM(0x000000ff)); // and Rn, Rm, 0xff |
| 2863 | 2751 | return TRUE; |
| 2864 | break; | |
| 2865 | 2752 | |
| 2866 | 2753 | case 13: // EXTUW(Rm, Rn); |
| 2867 | 2754 | UML_AND(block, R32(Rn), R32(Rm), IMM(0x0000ffff)); // and Rn, Rm, 0xffff |
| 2868 | 2755 | return TRUE; |
| 2869 | break; | |
| 2870 | 2756 | |
| 2871 | 2757 | case 14: // EXTSB(Rm, Rn); |
| 2872 | 2758 | UML_SEXT(block, R32(Rn), R32(Rm), BYTE); // sext Rn, Rm, BYTE |
| 2873 | 2759 | return TRUE; |
| 2874 | break; | |
| 2875 | 2760 | |
| 2876 | 2761 | case 15: // EXTSW(Rm, Rn); |
| 2877 | 2762 | UML_SEXT(block, R32(Rn), R32(Rm), WORD); // sext Rn, Rm, WORD |
| 2878 | 2763 | return TRUE; |
| 2879 | break; | |
| 2880 | 2764 | |
| 2881 | 2765 | case 4: // MOVBP(Rm, Rn); |
| 2882 | 2766 | UML_MOV(block, IREG(0), R32(Rm)); // mov r0, Rm |
| r4135 | r4136 | |
| 2893 | 2777 | if (!in_delay_slot) |
| 2894 | 2778 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2895 | 2779 | return TRUE; |
| 2896 | break; | |
| 2897 | 2780 | |
| 2898 | 2781 | case 5: // MOVWP(Rm, Rn); |
| 2899 | 2782 | UML_MOV(block, IREG(0), R32(Rm)); // mov r0, Rm |
| r4135 | r4136 | |
| 2910 | 2793 | if (!in_delay_slot) |
| 2911 | 2794 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2912 | 2795 | return TRUE; |
| 2913 | break; | |
| 2914 | 2796 | |
| 2915 | 2797 | case 6: // MOVLP(Rm, Rn); |
| 2916 | 2798 | UML_MOV(block, IREG(0), R32(Rm)); // mov r0, Rm |
| r4135 | r4136 | |
| 2927 | 2809 | if (!in_delay_slot) |
| 2928 | 2810 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2929 | 2811 | return TRUE; |
| 2930 | break; | |
| 2931 | 2812 | |
| 2932 | 2813 | case 8: // SWAPB(Rm, Rn); |
| 2933 | 2814 | UML_AND(block, IREG(0), R32(Rm), IMM(0xffff0000)); // and r0, Rm, #0xffff0000 |
| r4135 | r4136 | |
| 2938 | 2819 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or r0, r0, r1 |
| 2939 | 2820 | UML_OR(block, R32(Rn), IREG(0), IREG(2)); // or Rn, r0, r2 |
| 2940 | 2821 | return TRUE; |
| 2941 | break; | |
| 2942 | 2822 | |
| 2943 | 2823 | case 10: // NEGC(Rm, Rn); |
| 2944 | 2824 | UML_MOV(block, IREG(0), MEM(&sh2->sr)); // mov r0, sr (save SR) |
| r4135 | r4136 | |
| 2953 | 2833 | UML_LABEL(block, compiler->labelnum++); // labelnum: |
| 2954 | 2834 | |
| 2955 | 2835 | return TRUE; |
| 2956 | break; | |
| 2957 | 2836 | } |
| 2958 | 2837 | |
| 2959 | 2838 | return FALSE; |
| r4135 | r4136 | |
| 2976 | 2855 | if (!in_delay_slot) |
| 2977 | 2856 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2978 | 2857 | return TRUE; |
| 2979 | break; | |
| 2980 | 2858 | |
| 2981 | 2859 | case 1 << 8: // MOVWS4(opcode & 0x0f, Rm); |
| 2982 | 2860 | udisp = (opcode & 0x0f) * 2; |
| r4135 | r4136 | |
| 2987 | 2865 | if (!in_delay_slot) |
| 2988 | 2866 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 2989 | 2867 | return TRUE; |
| 2990 | break; | |
| 2991 | 2868 | |
| 2992 | 2869 | case 2<< 8: // NOP(); |
| 2993 | 2870 | case 3<< 8: // NOP(); |
| r4135 | r4136 | |
| 2997 | 2874 | case 12<< 8: // NOP(); |
| 2998 | 2875 | case 14<< 8: // NOP(); |
| 2999 | 2876 | return TRUE; |
| 3000 | break; | |
| 3001 | 2877 | |
| 3002 | 2878 | case 4<< 8: // MOVBL4(Rm, opcode & 0x0f); |
| 3003 | 2879 | udisp = opcode & 0x0f; |
| r4135 | r4136 | |
| 3009 | 2885 | if (!in_delay_slot) |
| 3010 | 2886 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 3011 | 2887 | return TRUE; |
| 3012 | break; | |
| 3013 | 2888 | |
| 3014 | 2889 | case 5<< 8: // MOVWL4(Rm, opcode & 0x0f); |
| 3015 | 2890 | udisp = (opcode & 0x0f)*2; |
| r4135 | r4136 | |
| 3021 | 2896 | if (!in_delay_slot) |
| 3022 | 2897 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 3023 | 2898 | return TRUE; |
| 3024 | break; | |
| 3025 | 2899 | |
| 3026 | 2900 | case 8<< 8: // CMPIM(opcode & 0xff); |
| 3027 | 2901 | UML_AND(block, IREG(0), MEM(&sh2->sr), IMM(~T)); // and r0, sr, ~T (clear the T bit) |
| r4135 | r4136 | |
| 3035 | 2909 | UML_LABEL(block, compiler->labelnum++); // labelnum: |
| 3036 | 2910 | UML_MOV(block, MEM(&sh2->sr), IREG(0)); // mov sh2->sr, r0 |
| 3037 | 2911 | return TRUE; |
| 3038 | break; | |
| 3039 | 2912 | |
| 3040 | 2913 | case 9<< 8: // BT(opcode & 0xff); |
| 3041 | 2914 | UML_TEST(block, MEM(&sh2->sr), IMM(T)); // test sh2->sr, T |
| r4135 | r4136 | |
| 3049 | 2922 | |
| 3050 | 2923 | UML_LABEL(block, compiler->labelnum++); // labelnum: |
| 3051 | 2924 | return TRUE; |
| 3052 | break; | |
| 3053 | 2925 | |
| 3054 | 2926 | case 11<< 8: // BF(opcode & 0xff); |
| 3055 | 2927 | UML_TEST(block, MEM(&sh2->sr), IMM(T)); // test sh2->sr, T |
| r4135 | r4136 | |
| 3063 | 2935 | |
| 3064 | 2936 | UML_LABEL(block, compiler->labelnum++); // labelnum: |
| 3065 | 2937 | return TRUE; |
| 3066 | break; | |
| 3067 | 2938 | |
| 3068 | 2939 | case 13<< 8: // BTS(opcode & 0xff); |
| 3069 | 2940 | if (sh2->cpu_type > CPU_TYPE_SH1) |
| r4135 | r4136 | |
| 3126 | 2997 | if (!in_delay_slot) |
| 3127 | 2998 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 3128 | 2999 | return TRUE; |
| 3129 | break; | |
| 3130 | 3000 | |
| 3131 | 3001 | case 1<<8: // MOVWSG(opcode & 0xff); |
| 3132 | 3002 | scratch = (opcode & 0xff) * 2; |
| r4135 | r4136 | |
| 3137 | 3007 | if (!in_delay_slot) |
| 3138 | 3008 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 3139 | 3009 | return TRUE; |
| 3140 | break; | |
| 3141 | 3010 | |
| 3142 | 3011 | case 2<<8: // MOVLSG(opcode & 0xff); |
| 3143 | 3012 | scratch = (opcode & 0xff) * 4; |
| r4135 | r4136 | |
| 3148 | 3017 | if (!in_delay_slot) |
| 3149 | 3018 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 3150 | 3019 | return TRUE; |
| 3151 | break; | |
| 3152 | 3020 | |
| 3153 | 3021 | case 3<<8: // TRAPA(opcode & 0xff); |
| 3154 | 3022 | scratch = (opcode & 0xff) * 4; |
| r4135 | r4136 | |
| 3169 | 3037 | UML_HASHJMP(block, IMM(0), IREG(0), sh2->nocode); // jmp (r0) |
| 3170 | 3038 | |
| 3171 | 3039 | return TRUE; |
| 3172 | break; | |
| 3173 | 3040 | |
| 3174 | 3041 | case 4<<8: // MOVBLG(opcode & 0xff); |
| 3175 | 3042 | scratch = (opcode & 0xff); |
| r4135 | r4136 | |
| 3180 | 3047 | if (!in_delay_slot) |
| 3181 | 3048 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 3182 | 3049 | return TRUE; |
| 3183 | break; | |
| 3184 | 3050 | |
| 3185 | 3051 | case 5<<8: // MOVWLG(opcode & 0xff); |
| 3186 | 3052 | scratch = (opcode & 0xff) * 2; |
| r4135 | r4136 | |
| 3191 | 3057 | if (!in_delay_slot) |
| 3192 | 3058 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 3193 | 3059 | return TRUE; |
| 3194 | break; | |
| 3195 | 3060 | |
| 3196 | 3061 | case 6<<8: // MOVLLG(opcode & 0xff); |
| 3197 | 3062 | scratch = (opcode & 0xff) * 4; |
| r4135 | r4136 | |
| 3202 | 3067 | if (!in_delay_slot) |
| 3203 | 3068 | generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE); |
| 3204 | 3069 | return TRUE; |
| 3205 | break; | |
| 3206 | 3070 | |
| 3207 | 3071 | case 7<<8: // MOVA(opcode & 0xff); |
| 3208 | 3072 | scratch = (opcode & 0xff) * 4; |
| r4135 | r4136 | |
| 3210 | 3074 | |
| 3211 | 3075 | UML_MOV(block, R32(0), IMM(scratch)); // mov R0, scratch |
| 3212 | 3076 | return TRUE; |
| 3213 | break; | |
| 3214 | 3077 | |
| 3215 | 3078 | case 8<<8: // TSTI(opcode & 0xff); |
| 3216 | 3079 | scratch = opcode & 0xff; |
| r4135 | r4136 | |
| 3224 | 3087 | |
| 3225 | 3088 | UML_LABEL(block, compiler->labelnum++); // labelnum: |
| 3226 | 3089 | return TRUE; |
| 3227 | break; | |
| 3228 | 3090 | |
| 3229 | 3091 | case 9<<8: // ANDI(opcode & 0xff); |
| 3230 | 3092 | UML_AND(block, R32(0), R32(0), IMM(opcode & 0xff)); // and r0, r0, opcode & 0xff |
| 3231 | 3093 | return TRUE; |
| 3232 | break; | |
| 3233 | 3094 | |
| 3234 | 3095 | case 10<<8: // XORI(opcode & 0xff); |
| 3235 | 3096 | UML_XOR(block, R32(0), R32(0), IMM(opcode & 0xff)); // xor r0, r0, opcode & 0xff |
| 3236 | 3097 | return TRUE; |
| 3237 | break; | |
| 3238 | 3098 | |
| 3239 | 3099 | case 11<<8: // ORI(opcode & 0xff); |
| 3240 | 3100 | UML_OR(block, R32(0), R32(0), IMM(opcode & 0xff)); // or r0, r0, opcode & 0xff |
| 3241 | 3101 | return TRUE; |
| 3242 | break; | |
| 3243 | 3102 | |
| 3244 | 3103 | case 12<<8: // TSTM(opcode & 0xff); |
| 3245 | 3104 | UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T)); // and sr, sr, ~T (clear the T bit) |
| r4135 | r4136 | |
| 3253 | 3112 | |
| 3254 | 3113 | UML_LABEL(block, compiler->labelnum++); // labelnum: |
| 3255 | 3114 | return TRUE; |
| 3256 | break; | |
| 3257 | 3115 | |
| 3258 | 3116 | case 13<<8: // ANDM(opcode & 0xff); |
| 3259 | 3117 | UML_ADD(block, IREG(0), R32(0), MEM(&sh2->gbr)); // add r0, R0, gbr |
| r4135 | r4136 | |
| 3264 | 3122 | SETEA(0); |
| 3265 | 3123 | UML_CALLH(block, sh2->write8); // write8 |
| 3266 | 3124 | return TRUE; |
| 3267 | break; | |
| 3268 | 3125 | |
| 3269 | 3126 | case 14<<8: // XORM(opcode & 0xff); |
| 3270 | 3127 | UML_ADD(block, IREG(0), R32(0), MEM(&sh2->gbr)); // add r0, R0, gbr |
| r4135 | r4136 | |
| 3275 | 3132 | SETEA(0); |
| 3276 | 3133 | UML_CALLH(block, sh2->write8); // write8 |
| 3277 | 3134 | return TRUE; |
| 3278 | break; | |
| 3279 | 3135 | |
| 3280 | 3136 | case 15<<8: // ORM(opcode & 0xff); |
| 3281 | 3137 | UML_ADD(block, IREG(0), R32(0), MEM(&sh2->gbr)); // add r0, R0, gbr |
| r4135 | r4136 | |
| 3286 | 3142 | SETEA(0); |
| 3287 | 3143 | UML_CALLH(block, sh2->write8); // write8 |
| 3288 | 3144 | return TRUE; |
| 3289 | break; | |
| 3290 | 3145 | } |
| 3291 | 3146 | |
| 3292 | 3147 | return FALSE; |
| r4135 | r4136 | |
|---|---|---|
| 48 | 48 | { |
| 49 | 49 | case 0: |
| 50 | 50 | return describe_group_0(context, desc, prev, opcode); |
| 51 | break; | |
| 52 | 51 | |
| 53 | 52 | case 1: // MOVLS4 |
| 54 | 53 | desc->regin[0] |= REGFLAG_R(Rn) | REGFLAG_R(Rm); |
| 55 | 54 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 56 | 55 | return TRUE; |
| 57 | break; | |
| 58 | 56 | |
| 59 | 57 | case 2: |
| 60 | 58 | return describe_group_2(context, desc, prev, opcode); |
| 61 | break; | |
| 62 | 59 | |
| 63 | 60 | case 3: |
| 64 | 61 | return describe_group_3(context, desc, prev, opcode); |
| 65 | break; | |
| 66 | 62 | |
| 67 | 63 | case 4: |
| 68 | 64 | return describe_group_4(context, desc, prev, opcode); |
| 69 | break; | |
| 70 | 65 | |
| 71 | 66 | case 5: // MOVLL4 |
| 72 | 67 | desc->regin[0] |= REGFLAG_R(Rm); |
| 73 | 68 | desc->regout[0] |= REGFLAG_R(Rn); |
| 74 | 69 | desc->flags |= OPFLAG_READS_MEMORY; |
| 75 | 70 | return TRUE; |
| 76 | break; | |
| 77 | 71 | |
| 78 | 72 | case 6: |
| 79 | 73 | return describe_group_6(context, desc, prev, opcode); |
| 80 | break; | |
| 81 | 74 | |
| 82 | 75 | case 7: // ADDI |
| 83 | 76 | desc->regin[0] |= REGFLAG_R(Rn); |
| 84 | 77 | desc->regout[0] |= REGFLAG_R(Rn); |
| 85 | 78 | return TRUE; |
| 86 | break; | |
| 87 | 79 | |
| 88 | 80 | case 8: |
| 89 | 81 | return describe_group_8(context, desc, prev, opcode); |
| 90 | break; | |
| 91 | 82 | |
| 92 | 83 | case 9: // MOVWI |
| 93 | 84 | desc->regout[0] |= REGFLAG_R(Rn); |
| 94 | 85 | desc->flags |= OPFLAG_READS_MEMORY; |
| 95 | 86 | return TRUE; |
| 96 | break; | |
| 97 | 87 | |
| 98 | 88 | case 11: // BSR |
| 99 | 89 | desc->regout[1] |= REGFLAG_PR; |
| r4135 | r4136 | |
| 108 | 98 | desc->cycles = 2; |
| 109 | 99 | return TRUE; |
| 110 | 100 | } |
| 111 | break; | |
| 112 | 101 | |
| 113 | 102 | case 12: |
| 114 | 103 | return describe_group_12(context, desc, prev, opcode); |
| 115 | break; | |
| 116 | 104 | |
| 117 | 105 | case 13: // MOVLI |
| 118 | 106 | desc->regout[0] |= REGFLAG_R(Rn); |
| 119 | 107 | desc->flags |= OPFLAG_READS_MEMORY; |
| 120 | 108 | return TRUE; |
| 121 | break; | |
| 122 | 109 | |
| 123 | 110 | case 14: // MOVI |
| 124 | 111 | desc->regout[0] |= REGFLAG_R(Rn); |
| 125 | 112 | return TRUE; |
| 126 | break; | |
| 127 | 113 | |
| 128 | 114 | case 15: // NOP |
| 129 | 115 | return TRUE; |
| 130 | break; | |
| 131 | 116 | } |
| 132 | 117 | |
| 133 | 118 | return FALSE; |
| r4135 | r4136 | |
| 154 | 139 | case 0x3a: // NOP(); |
| 155 | 140 | case 0x3b: // NOP(); |
| 156 | 141 | return TRUE; |
| 157 | break; | |
| 158 | 142 | |
| 159 | 143 | case 0x02: // STCSR(Rn); |
| 160 | 144 | desc->regout[0] |= REGFLAG_R(Rn); |
| 161 | 145 | return TRUE; |
| 162 | break; | |
| 163 | 146 | |
| 164 | 147 | case 0x03: // BSRF(Rn); |
| 165 | 148 | desc->regout[1] |= REGFLAG_PR; |
| r4135 | r4136 | |
| 169 | 152 | desc->delayslots = 1; |
| 170 | 153 | |
| 171 | 154 | return TRUE; |
| 172 | break; | |
| 173 | 155 | |
| 174 | 156 | case 0x04: // MOVBS0(Rm, Rn); |
| 175 | 157 | case 0x05: // MOVWS0(Rm, Rn); |
| r4135 | r4136 | |
| 186 | 168 | desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn) | REGFLAG_R(0); |
| 187 | 169 | desc->flags |= OPFLAG_READS_MEMORY; |
| 188 | 170 | return TRUE; |
| 189 | break; | |
| 190 | 171 | |
| 191 | 172 | case 0x07: // MULL(Rm, Rn); |
| 192 | 173 | case 0x17: // MULL(Rm, Rn); |
| r4135 | r4136 | |
| 196 | 177 | desc->regout[1] |= REGFLAG_MACL; |
| 197 | 178 | desc->cycles = 2; |
| 198 | 179 | return TRUE; |
| 199 | break; | |
| 200 | 180 | |
| 201 | 181 | case 0x08: // CLRT(); |
| 202 | 182 | desc->regout[1] |= REGFLAG_SR; |
| 203 | 183 | return TRUE; |
| 204 | break; | |
| 205 | 184 | |
| 206 | 185 | case 0x0a: // STSMACH(Rn); |
| 207 | 186 | desc->regout[0] |= REGFLAG_R(Rn); |
| 208 | 187 | desc->regout[1] |= REGFLAG_MACH; |
| 209 | 188 | return TRUE; |
| 210 | break; | |
| 211 | 189 | |
| 212 | 190 | case 0x0b: // RTS(); |
| 213 | 191 | desc->regin[1] |= REGFLAG_PR; |
| r4135 | r4136 | |
| 218 | 196 | desc->cycles = 2; |
| 219 | 197 | |
| 220 | 198 | return TRUE; |
| 221 | break; | |
| 222 | 199 | |
| 223 | 200 | case 0x0c: // MOVBL0(Rm, Rn); |
| 224 | 201 | case 0x0d: // MOVWL0(Rm, Rn); |
| r4135 | r4136 | |
| 236 | 213 | desc->regout[0] |= REGFLAG_R(Rn); |
| 237 | 214 | desc->flags |= OPFLAG_READS_MEMORY; |
| 238 | 215 | return TRUE; |
| 239 | break; | |
| 240 | 216 | |
| 241 | 217 | case 0x0f: // MAC_L(Rm, Rn); |
| 242 | 218 | case 0x1f: // MAC_L(Rm, Rn); |
| r4135 | r4136 | |
| 246 | 222 | desc->regout[1] |= REGFLAG_MACL | REGFLAG_MACH; |
| 247 | 223 | desc->cycles = 3; |
| 248 | 224 | return TRUE; |
| 249 | break; | |
| 250 | 225 | |
| 251 | 226 | case 0x12: // STCGBR(Rn); |
| 252 | 227 | desc->regout[0] |= REGFLAG_R(Rn); |
| 253 | 228 | desc->regin[1] |= REGFLAG_GBR; |
| 254 | 229 | return TRUE; |
| 255 | break; | |
| 256 | 230 | |
| 257 | 231 | case 0x18: // SETT(); |
| 258 | 232 | desc->regout[1] |= REGFLAG_SR; |
| 259 | 233 | return TRUE; |
| 260 | break; | |
| 261 | 234 | |
| 262 | 235 | case 0x19: // DIV0U(); |
| 263 | 236 | desc->regout[1] |= REGFLAG_SR; |
| 264 | 237 | return TRUE; |
| 265 | break; | |
| 266 | 238 | |
| 267 | 239 | case 0x1a: // STSMACL(Rn); |
| 268 | 240 | desc->regin[1] |= REGFLAG_MACL; |
| 269 | 241 | desc->regout[0] |= REGFLAG_R(Rn); |
| 270 | 242 | return TRUE; |
| 271 | break; | |
| 272 | 243 | |
| 273 | 244 | case 0x1b: // SLEEP(); |
| 274 | 245 | desc->cycles = 3; |
| 275 | 246 | return TRUE; |
| 276 | break; | |
| 277 | 247 | |
| 278 | 248 | case 0x22: // STCVBR(Rn); |
| 279 | 249 | desc->regin[0] |= REGFLAG_R(Rn); |
| 280 | 250 | desc->regout[1] |= REGFLAG_VBR; |
| 281 | 251 | return TRUE; |
| 282 | break; | |
| 283 | 252 | |
| 284 | 253 | case 0x23: // BRAF(Rn); |
| 285 | 254 | desc->regin[0] |= REGFLAG_R(Rm); |
| r4135 | r4136 | |
| 288 | 257 | desc->delayslots = 1; |
| 289 | 258 | desc->cycles = 2; |
| 290 | 259 | return TRUE; |
| 291 | break; | |
| 292 | 260 | |
| 293 | 261 | case 0x28: // CLRMAC(); |
| 294 | 262 | desc->regout[1] |= REGFLAG_MACL | REGFLAG_MACH; |
| 295 | 263 | return TRUE; |
| 296 | break; | |
| 297 | 264 | |
| 298 | 265 | case 0x29: // MOVT(Rn); |
| 299 | 266 | desc->regin[1] |= REGFLAG_SR; |
| 300 | 267 | desc->regout[0] |= REGFLAG_R(Rn); |
| 301 | 268 | return TRUE; |
| 302 | break; | |
| 303 | 269 | |
| 304 | 270 | case 0x2a: // STSPR(Rn); |
| 305 | 271 | desc->regin[1] |= REGFLAG_PR; |
| 306 | 272 | desc->regout[0] |= REGFLAG_R(Rn); |
| 307 | 273 | return TRUE; |
| 308 | break; | |
| 309 | 274 | |
| 310 | 275 | case 0x2b: // RTE(); |
| 311 | 276 | desc->regin[0] |= REGFLAG_R(15); |
| r4135 | r4136 | |
| 317 | 282 | desc->cycles = 4; |
| 318 | 283 | |
| 319 | 284 | return TRUE; |
| 320 | break; | |
| 321 | 285 | } |
| 322 | 286 | |
| 323 | 287 | return FALSE; |
| r4135 | r4136 | |
| 333 | 297 | desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn); |
| 334 | 298 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 335 | 299 | return TRUE; |
| 336 | break; | |
| 337 | 300 | |
| 338 | 301 | case 3: // NOP(); |
| 339 | 302 | return TRUE; |
| 340 | break; | |
| 341 | 303 | |
| 342 | 304 | case 4: // MOVBM(Rm, Rn); |
| 343 | 305 | case 5: // MOVWM(Rm, Rn); |
| r4135 | r4136 | |
| 347 | 309 | desc->regout[0] |= REGFLAG_R(Rn); |
| 348 | 310 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 349 | 311 | return TRUE; |
| 350 | break; | |
| 351 | 312 | |
| 352 | 313 | case 7: // DIV0S(Rm, Rn); |
| 353 | 314 | case 8: // TST(Rm, Rn); |
| r4135 | r4136 | |
| 355 | 316 | desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn); |
| 356 | 317 | desc->regout[1] |= REGFLAG_SR; |
| 357 | 318 | return TRUE; |
| 358 | break; | |
| 359 | 319 | |
| 360 | 320 | case 9: // AND(Rm, Rn); |
| 361 | 321 | case 10: // XOR(Rm, Rn); |
| r4135 | r4136 | |
| 363 | 323 | desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn); |
| 364 | 324 | desc->regout[0] |= REGFLAG_R(Rn); |
| 365 | 325 | return TRUE; |
| 366 | break; | |
| 367 | 326 | |
| 368 | 327 | case 14: // MULU(Rm, Rn); |
| 369 | 328 | case 15: // MULS(Rm, Rn); |
| r4135 | r4136 | |
| 371 | 330 | desc->regout[1] |= REGFLAG_MACL | REGFLAG_MACH; |
| 372 | 331 | desc->cycles = 2; |
| 373 | 332 | return TRUE; |
| 374 | break; | |
| 375 | 333 | } |
| 376 | 334 | |
| 377 | 335 | return FALSE; |
| r4135 | r4136 | |
| 389 | 347 | desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn); |
| 390 | 348 | desc->regout[1] |= REGFLAG_SR; |
| 391 | 349 | return TRUE; |
| 392 | break; | |
| 393 | 350 | |
| 394 | 351 | case 1: // NOP(); |
| 395 | 352 | case 9: // NOP(); |
| 396 | 353 | return TRUE; |
| 397 | break; | |
| 398 | 354 | |
| 399 | 355 | case 4: // DIV1(Rm, Rn); |
| 400 | 356 | desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn); |
| 401 | 357 | desc->regout[0] |= REGFLAG_R(Rn); |
| 402 | 358 | desc->regout[1] |= REGFLAG_SR; |
| 403 | 359 | return TRUE; |
| 404 | break; | |
| 405 | 360 | |
| 406 | 361 | case 5: // DMULU(Rm, Rn); |
| 407 | 362 | case 13: // DMULS(Rm, Rn); |
| r4135 | r4136 | |
| 409 | 364 | desc->regout[1] |= REGFLAG_MACL | REGFLAG_MACH; |
| 410 | 365 | desc->cycles = 2; |
| 411 | 366 | return TRUE; |
| 412 | break; | |
| 413 | 367 | |
| 414 | 368 | case 8: // SUB(Rm, Rn); |
| 415 | 369 | case 12: // ADD(Rm, Rn); |
| 416 | 370 | desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn); |
| 417 | 371 | desc->regout[0] |= REGFLAG_R(Rn); |
| 418 | 372 | return TRUE; |
| 419 | break; | |
| 420 | 373 | |
| 421 | 374 | case 10: // SUBC(Rm, Rn); |
| 422 | 375 | case 11: // SUBV(Rm, Rn); |
| r4135 | r4136 | |
| 427 | 380 | desc->regout[0] |= REGFLAG_R(Rn); |
| 428 | 381 | desc->regout[1] |= REGFLAG_SR; |
| 429 | 382 | return TRUE; |
| 430 | break; | |
| 431 | 383 | } |
| 432 | 384 | return FALSE; |
| 433 | 385 | } |
| r4135 | r4136 | |
| 444 | 396 | desc->regout[0] |= REGFLAG_R(Rn); |
| 445 | 397 | desc->regout[1] |= REGFLAG_SR; |
| 446 | 398 | return TRUE; |
| 447 | break; | |
| 448 | 399 | |
| 449 | 400 | case 0x02: // STSMMACH(Rn); |
| 450 | 401 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 452 | 403 | desc->regout[0] |= REGFLAG_R(Rn); |
| 453 | 404 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 454 | 405 | return TRUE; |
| 455 | break; | |
| 456 | 406 | |
| 457 | 407 | case 0x03: // STCMSR(Rn); |
| 458 | 408 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 460 | 410 | desc->cycles = 2; |
| 461 | 411 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 462 | 412 | return TRUE; |
| 463 | break; | |
| 464 | 413 | |
| 465 | 414 | case 0x06: // LDSMMACH(Rn); |
| 466 | 415 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 468 | 417 | desc->regout[1] |= REGFLAG_MACH; |
| 469 | 418 | desc->flags |= OPFLAG_READS_MEMORY; |
| 470 | 419 | return TRUE; |
| 471 | break; | |
| 472 | 420 | |
| 473 | 421 | case 0x07: // LDCMSR(Rn); |
| 474 | 422 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 477 | 425 | desc->cycles = 3; |
| 478 | 426 | desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_CAN_EXPOSE_EXTERNAL_INT | OPFLAG_END_SEQUENCE; |
| 479 | 427 | return TRUE; |
| 480 | break; | |
| 481 | 428 | |
| 482 | 429 | case 0x08: // SHLL2(Rn); |
| 483 | 430 | case 0x09: // SHLR2(Rn); |
| r4135 | r4136 | |
| 488 | 435 | desc->regin[0] |= REGFLAG_R(Rn); |
| 489 | 436 | desc->regout[0] |= REGFLAG_R(Rn); |
| 490 | 437 | return TRUE; |
| 491 | break; | |
| 492 | 438 | |
| 493 | 439 | case 0x0a: // LDSMACH(Rn); |
| 494 | 440 | desc->regin[0] |= REGFLAG_R(Rn); |
| 495 | 441 | desc->regout[1] |= REGFLAG_MACH; |
| 496 | 442 | return TRUE; |
| 497 | break; | |
| 498 | 443 | |
| 499 | 444 | case 0x0b: // JSR(Rn); |
| 500 | 445 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 503 | 448 | desc->targetpc = BRANCH_TARGET_DYNAMIC; |
| 504 | 449 | desc->delayslots = 1; |
| 505 | 450 | return TRUE; |
| 506 | break; | |
| 507 | 451 | |
| 508 | 452 | case 0x0e: // LDCSR(Rn); |
| 509 | 453 | desc->regin[0] |= REGFLAG_R(Rn); |
| 510 | 454 | desc->regout[1] |= REGFLAG_SR; |
| 511 | 455 | desc->flags |= OPFLAG_CAN_EXPOSE_EXTERNAL_INT | OPFLAG_END_SEQUENCE; |
| 512 | 456 | return TRUE; |
| 513 | break; | |
| 514 | 457 | |
| 515 | 458 | case 0x0f: // MAC_W(Rm, Rn); |
| 516 | 459 | case 0x1f: // MAC_W(Rm, Rn); |
| r4135 | r4136 | |
| 522 | 465 | desc->regout[1] |= REGFLAG_MACL | REGFLAG_MACH; |
| 523 | 466 | desc->cycles = 3; |
| 524 | 467 | return TRUE; |
| 525 | break; | |
| 526 | 468 | |
| 527 | 469 | case 0x10: // DT(Rn); |
| 528 | 470 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 530 | 472 | desc->regout[0] |= REGFLAG_R(Rn); |
| 531 | 473 | desc->regout[1] |= REGFLAG_SR; |
| 532 | 474 | return TRUE; |
| 533 | break; | |
| 534 | 475 | |
| 535 | 476 | case 0x11: // CMPPZ(Rn); |
| 536 | 477 | case 0x15: // CMPPL(Rn); |
| r4135 | r4136 | |
| 538 | 479 | desc->regin[1] |= REGFLAG_SR; |
| 539 | 480 | desc->regout[1] |= REGFLAG_SR; |
| 540 | 481 | return TRUE; |
| 541 | break; | |
| 542 | 482 | |
| 543 | 483 | case 0x12: // STSMMACL(Rn); |
| 544 | 484 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 546 | 486 | desc->regout[0] |= REGFLAG_R(Rn); |
| 547 | 487 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 548 | 488 | return TRUE; |
| 549 | break; | |
| 550 | 489 | |
| 551 | 490 | case 0x13: // STCMGBR(Rn); |
| 552 | 491 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 554 | 493 | desc->regout[0] |= REGFLAG_R(Rn); |
| 555 | 494 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 556 | 495 | return TRUE; |
| 557 | break; | |
| 558 | 496 | |
| 559 | 497 | case 0x16: // LDSMMACL(Rn); |
| 560 | 498 | desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 562 | 500 | desc->regout[1] |= REGFLAG_MACL; |
| 563 | 501 | desc->flags |= OPFLAG_READS_MEMORY; |
| 564 | 502 | return TRUE; |
| 565 | break; | |
| 566 | 503 | |
| 567 | 504 | case 0x17: // LDCMGBR(Rn); |
| 568 | 505 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 570 | 507 | desc->regout[1] |= REGFLAG_GBR; |
| 571 | 508 | desc->flags |= OPFLAG_READS_MEMORY; |
| 572 | 509 | return TRUE; |
| 573 | break; | |
| 574 | 510 | |
| 575 | 511 | case 0x1a: // LDSMACL(Rn); |
| 576 | 512 | desc->regin[0] |= REGFLAG_R(Rn); |
| 577 | 513 | desc->regout[1] |= REGFLAG_MACL; |
| 578 | 514 | return TRUE; |
| 579 | break; | |
| 580 | 515 | |
| 581 | 516 | case 0x1b: // TAS(Rn); |
| 582 | 517 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 585 | 520 | desc->cycles = 4; |
| 586 | 521 | desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_WRITES_MEMORY; |
| 587 | 522 | return TRUE; |
| 588 | break; | |
| 589 | 523 | |
| 590 | 524 | case 0x1e: // LDCGBR(Rn); |
| 591 | 525 | desc->regin[0] |= REGFLAG_R(Rn); |
| 592 | 526 | desc->regout[1] |= REGFLAG_GBR; |
| 593 | 527 | return TRUE; |
| 594 | break; | |
| 595 | 528 | |
| 596 | 529 | case 0x20: // SHAL(Rn); |
| 597 | 530 | case 0x21: // SHAR(Rn); |
| r4135 | r4136 | |
| 599 | 532 | desc->regout[0] |= REGFLAG_R(Rn); |
| 600 | 533 | desc->regout[1] |= REGFLAG_SR; |
| 601 | 534 | return TRUE; |
| 602 | break; | |
| 603 | 535 | |
| 604 | 536 | case 0x22: // STSMPR(Rn); |
| 605 | 537 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 607 | 539 | desc->regout[0] |= REGFLAG_R(Rn); |
| 608 | 540 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 609 | 541 | return TRUE; |
| 610 | break; | |
| 611 | 542 | |
| 612 | 543 | case 0x23: // STCMVBR(Rn); |
| 613 | 544 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 615 | 546 | desc->regout[0] |= REGFLAG_R(Rn); |
| 616 | 547 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 617 | 548 | return TRUE; |
| 618 | break; | |
| 619 | 549 | |
| 620 | 550 | case 0x24: // ROTCL(Rn); |
| 621 | 551 | case 0x25: // ROTCR(Rn); |
| r4135 | r4136 | |
| 624 | 554 | desc->regout[0] |= REGFLAG_R(Rn); |
| 625 | 555 | desc->regout[1] |= REGFLAG_SR; |
| 626 | 556 | return TRUE; |
| 627 | break; | |
| 628 | 557 | |
| 629 | 558 | case 0x26: // LDSMPR(Rn); |
| 630 | 559 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 632 | 561 | desc->regout[1] |= REGFLAG_PR; |
| 633 | 562 | desc->flags |= OPFLAG_READS_MEMORY; |
| 634 | 563 | return TRUE; |
| 635 | break; | |
| 636 | 564 | |
| 637 | 565 | case 0x27: // LDCMVBR(Rn); |
| 638 | 566 | desc->regin[0] |= REGFLAG_R(Rn); |
| r4135 | r4136 | |
| 640 | 568 | desc->regout[1] |= REGFLAG_VBR; |
| 641 | 569 | desc->flags |= OPFLAG_READS_MEMORY; |
| 642 | 570 | return TRUE; |
| 643 | break; | |
| 644 | 571 | |
| 645 | 572 | case 0x2a: // LDSPR(Rn); |
| 646 | 573 | desc->regin[0] |= REGFLAG_R(Rn); |
| 647 | 574 | desc->regout[1] |= REGFLAG_PR; |
| 648 | 575 | return TRUE; |
| 649 | break; | |
| 650 | 576 | |
| 651 | 577 | case 0x2b: // JMP(Rm); |
| 652 | 578 | desc->regin[0] |= REGFLAG_R(Rm); |
| r4135 | r4136 | |
| 654 | 580 | desc->targetpc = BRANCH_TARGET_DYNAMIC; |
| 655 | 581 | desc->delayslots = 1; |
| 656 | 582 | return TRUE; |
| 657 | break; | |
| 658 | 583 | |
| 659 | 584 | case 0x2e: // LDCVBR(Rn); |
| 660 | 585 | desc->regin[0] |= REGFLAG_R(Rn); |
| 661 | 586 | desc->regout[1] |= REGFLAG_VBR; |
| 662 | 587 | return TRUE; |
| 663 | break; | |
| 664 | 588 | |
| 665 | 589 | case 0x0c: // NOP(); |
| 666 | 590 | case 0x0d: // NOP(); |
| r4135 | r4136 | |
| 685 | 609 | case 0x3d: // NOP(); |
| 686 | 610 | case 0x3e: // NOP(); |
| 687 | 611 | return TRUE; |
| 688 | break; | |
| 689 | ||
| 690 | 612 | } |
| 691 | 613 | |
| 692 | 614 | return FALSE; |
| r4135 | r4136 | |
| 710 | 632 | desc->regin[0] |= REGFLAG_R(Rm); |
| 711 | 633 | desc->regout[0] |= REGFLAG_R(Rn); |
| 712 | 634 | return TRUE; |
| 713 | break; | |
| 714 | 635 | |
| 715 | 636 | case 4: // MOVBP(Rm, Rn); |
| 716 | 637 | case 5: // MOVWP(Rm, Rn); |
| r4135 | r4136 | |
| 719 | 640 | desc->regout[0] |= REGFLAG_R(Rn); |
| 720 | 641 | desc->flags |= OPFLAG_READS_MEMORY; |
| 721 | 642 | return TRUE; |
| 722 | break; | |
| 723 | 643 | |
| 724 | 644 | case 8: // SWAPB(Rm, Rn); |
| 725 | 645 | desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn); |
| 726 | 646 | desc->regout[0] |= REGFLAG_R(Rn); |
| 727 | 647 | return TRUE; |
| 728 | break; | |
| 729 | 648 | |
| 730 | 649 | case 10: // NEGC(Rm, Rn); |
| 731 | 650 | desc->regin[0] |= REGFLAG_R(Rm); |
| 732 | 651 | desc->regout[0] |= REGFLAG_R(Rn); |
| 733 | 652 | desc->regout[1] |= REGFLAG_SR; |
| 734 | 653 | return TRUE; |
| 735 | break; | |
| 736 | 654 | } |
| 737 | 655 | return FALSE; |
| 738 | 656 | } |
| r4135 | r4136 | |
| 748 | 666 | desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(0); |
| 749 | 667 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 750 | 668 | return TRUE; |
| 751 | break; | |
| 752 | 669 | |
| 753 | 670 | case 2<< 8: // NOP(); |
| 754 | 671 | case 3<< 8: // NOP(); |
| r4135 | r4136 | |
| 758 | 675 | case 12<< 8: // NOP(); |
| 759 | 676 | case 14<< 8: // NOP(); |
| 760 | 677 | return TRUE; |
| 761 | break; | |
| 762 | 678 | |
| 763 | 679 | case 4<< 8: // MOVBL4(Rm, opcode & 0x0f); |
| 764 | 680 | case 5<< 8: // MOVWL4(Rm, opcode & 0x0f); |
| r4135 | r4136 | |
| 766 | 682 | desc->regout[0] |= REGFLAG_R(0); |
| 767 | 683 | desc->flags |= OPFLAG_READS_MEMORY; |
| 768 | 684 | return TRUE; |
| 769 | break; | |
| 770 | 685 | |
| 771 | 686 | case 8<< 8: // CMPIM(opcode & 0xff); |
| 772 | 687 | desc->regin[0] |= REGFLAG_R(Rm); |
| 773 | 688 | desc->regin[1] |= REGFLAG_SR; |
| 774 | 689 | desc->regout[1] |= REGFLAG_SR; |
| 775 | 690 | return TRUE; |
| 776 | break; | |
| 777 | 691 | |
| 778 | 692 | case 9<< 8: // BT(opcode & 0xff); |
| 779 | 693 | case 11<< 8: // BF(opcode & 0xff); |
| r4135 | r4136 | |
| 782 | 696 | disp = ((INT32)opcode << 24) >> 24; |
| 783 | 697 | desc->targetpc = (desc->pc + 2) + disp * 2 + 2; |
| 784 | 698 | return TRUE; |
| 785 | break; | |
| 786 | 699 | |
| 787 | 700 | case 13<< 8: // BTS(opcode & 0xff); |
| 788 | 701 | case 15<< 8: // BFS(opcode & 0xff); |
| r4135 | r4136 | |
| 792 | 705 | desc->targetpc = (desc->pc + 2) + disp * 2 + 2; |
| 793 | 706 | desc->delayslots = 1; |
| 794 | 707 | return TRUE; |
| 795 | break; | |
| 796 | 708 | } |
| 797 | 709 | |
| 798 | 710 | return FALSE; |
| r4135 | r4136 | |
| 808 | 720 | desc->regin[0] |= REGFLAG_R(0); |
| 809 | 721 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 810 | 722 | return TRUE; |
| 811 | break; | |
| 812 | 723 | |
| 813 | 724 | case 3<<8: // TRAPA(opcode & 0xff); |
| 814 | 725 | desc->regin[0] |= REGFLAG_R(15); |
| r4135 | r4136 | |
| 818 | 729 | desc->targetpc = BRANCH_TARGET_DYNAMIC; |
| 819 | 730 | desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 820 | 731 | return TRUE; |
| 821 | break; | |
| 822 | 732 | |
| 823 | 733 | case 4<<8: // MOVBLG(opcode & 0xff); |
| 824 | 734 | case 5<<8: // MOVWLG(opcode & 0xff); |
| r4135 | r4136 | |
| 827 | 737 | desc->regout[0] |= REGFLAG_R(0); |
| 828 | 738 | desc->flags |= OPFLAG_READS_MEMORY; |
| 829 | 739 | return TRUE; |
| 830 | break; | |
| 831 | 740 | |
| 832 | 741 | case 8<<8: // TSTI(opcode & 0xff); |
| 833 | 742 | desc->regin[0] |= REGFLAG_R(0); |
| 834 | 743 | desc->regin[1] |= REGFLAG_SR; |
| 835 | 744 | desc->regout[1] |= REGFLAG_SR; |
| 836 | 745 | return TRUE; |
| 837 | break; | |
| 838 | 746 | |
| 839 | 747 | case 9<<8: // ANDI(opcode & 0xff); |
| 840 | 748 | case 10<<8: // XORI(opcode & 0xff); |
| r4135 | r4136 | |
| 842 | 750 | desc->regin[0] |= REGFLAG_R(0); |
| 843 | 751 | desc->regout[0] |= REGFLAG_R(0); |
| 844 | 752 | return TRUE; |
| 845 | break; | |
| 846 | 753 | |
| 847 | 754 | case 12<<8: // TSTM(opcode & 0xff); |
| 848 | 755 | case 13<<8: // ANDM(opcode & 0xff); |
| r4135 | r4136 | |
| 853 | 760 | desc->regout[1] |= REGFLAG_SR; |
| 854 | 761 | desc->flags |= OPFLAG_READS_MEMORY; |
| 855 | 762 | return TRUE; |
| 856 | break; | |
| 857 | 763 | } |
| 858 | 764 | |
| 859 | 765 | return FALSE; |
| r4135 | r4136 | |
|---|---|---|
| 59 | 59 | 0, 8, 2, 10, 4, 12, 6, 14 |
| 60 | 60 | }; |
| 61 | 61 | |
| 62 | UINT8 sm85cpu_mem_readbyte( sm8500_state *cpustate, UINT32 offset ) { | |
| 62 | static UINT8 sm85cpu_mem_readbyte( sm8500_state *cpustate, UINT32 offset ) { | |
| 63 | 63 | return ( offset < 0x10 ) ? cpustate->register_base[offset] : memory_read_byte_8be( cpustate->program, offset ); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | void sm85cpu_mem_writebyte( sm8500_state *cpustate, UINT32 offset, UINT8 data ) { | |
| 66 | static void sm85cpu_mem_writebyte( sm8500_state *cpustate, UINT32 offset, UINT8 data ) { | |
| 67 | 67 | if ( offset < 0x10 ) { |
| 68 | 68 | cpustate->register_base[offset] = data; |
| 69 | 69 | } else { |
| r4135 | r4136 | |
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | unsigned sm8500_get_reg( sm8500_state *cpustate, int regnum ) | |
| 270 | static unsigned sm8500_get_reg( sm8500_state *cpustate, int regnum ) | |
| 271 | 271 | { |
| 272 | 272 | switch( regnum ) |
| 273 | 273 | { |
| r4135 | r4136 | |
|---|---|---|
| 12 | 12 | #ifndef __MB88XX_H__ |
| 13 | 13 | #define __MB88XX_H__ |
| 14 | 14 | |
| 15 | #ifndef INLINE | |
| 16 | #define INLINE static inline | |
| 17 | #endif | |
| 18 | ||
| 19 | 15 | #include "cpuintrf.h" |
| 20 | 16 | |
| 21 | 17 | /*************************************************************************** |
| r4135 | r4136 | |
|---|---|---|
| 12 | 12 | #ifndef __ALPH8201_H__ |
| 13 | 13 | #define __ALPH8201_H__ |
| 14 | 14 | |
| 15 | #ifndef INLINE | |
| 16 | #define INLINE static inline | |
| 17 | #endif | |
| 18 | ||
| 19 | 15 | #include "cpuintrf.h" |
| 20 | 16 | |
| 21 | 17 | enum |
| r4135 | r4136 | |
|---|---|---|
| 30 | 30 | /* ================================ GENERAL =============================== */ |
| 31 | 31 | /* ======================================================================== */ |
| 32 | 32 | |
| 33 | /* Fallback on static if we don't have inline */ | |
| 34 | #ifndef INLINE | |
| 35 | #define INLINE static | |
| 36 | #endif | |
| 37 | ||
| 38 | 33 | /* This should be set to the default size of your processor (min 16 bit) */ |
| 39 | 34 | #undef uint |
| 40 | 35 | #define uint unsigned int |
| r4135 | r4136 | |
|---|---|---|
| 24 | 24 | #endif |
| 25 | 25 | |
| 26 | 26 | #define ADDRESS_65816(A) ((A)&0xffffff) |
| 27 | #ifndef INLINE | |
| 28 | #define INLINE static | |
| 29 | #endif | |
| 30 | 27 | |
| 31 | 28 | |
| 32 | 29 | typedef struct |
| r4135 | r4136 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | es | |
| 3 | esrip. | |
| 4 | 4 | |
| 5 | 5 | Implementation of the Entertainment Sciences |
| 6 | 6 | AM29116-based Real Time Image Processor |
| r4135 | r4136 | |
| 23 | 23 | MACROS |
| 24 | 24 | ***************************************************************************/ |
| 25 | 25 | |
| 26 | #define ASSERT(x) | |
| 27 | //(assert(x)) | |
| 28 | 26 | #define RIP_PC (cpustate->pc | ((cpustate->status_out & 1) << 8)) |
| 29 | 27 | #define _BIT(x, n) ((x) & (1 << (n))) |
| 30 | 28 | #define RISING_EDGE(old_val, new_val, bit) (!(old_val & (1 << bit)) && (new_val & (1 << bit))) |
| 31 | 29 | |
| 32 | #define UNHANDLED do {printf("%s:UNHANDLED (%x)\n", __FUNCTION__, inst); ASSERT(0);}while(0) | |
| 33 | #define INVALID do {printf("%s:INVALID (%x)\n", __FUNCTION__, inst); ASSERT(0);}while(0) | |
| 30 | #define UNHANDLED do {printf("%s:UNHANDLED (%x)\n", __FUNCTION__, inst); assert(0);} while (0) | |
| 31 | #define INVALID do {printf("%s:INVALID (%x)\n", __FUNCTION__, inst); assert(0);} while (0) | |
| 34 | 32 | |
| 35 | 33 | #define RAM_ADDR (inst & 0x1f) |
| 36 | 34 | #define MODE (inst & 0x8000) |
| r4135 | r4136 | |
| 94 | 92 | UINT16 attr_latch; |
| 95 | 93 | UINT16 adl_latch; |
| 96 | 94 | UINT16 adr_latch; |
| 95 | UINT16 iaddr_latch; | |
| 97 | 96 | UINT8 c_latch; |
| 98 | UINT16 iaddr; | |
| 99 | 97 | |
| 100 | 98 | UINT16 fdt_cnt; |
| 101 | 99 | UINT16 ipt_cnt; |
| 102 | 100 | |
| 103 | UINT16 *ipt_ram; | |
| 104 | UINT8 *lbrm; | |
| 101 | UINT8 fig; | |
| 102 | UINT16 fig_cycles; | |
| 105 | 103 | |
| 106 | 104 | UINT8 *optable; |
| 107 | 105 | |
| 108 | UINT8 fig; | |
| 109 | UINT16 fig_cycles; | |
| 106 | UINT16 *ipt_ram; | |
| 107 | UINT8 *lbrm; | |
| 110 | 108 | |
| 111 | 109 | const device_config *device; |
| 112 | 110 | const address_space *program; |
| r4135 | r4136 | |
| 120 | 118 | |
| 121 | 119 | |
| 122 | 120 | /*************************************************************************** |
| 123 | | |
| 121 | PUB | |
| 124 | 122 | ***************************************************************************/ |
| 125 | 123 | |
| 126 | 124 | UINT8 get_rip_status(const device_config *cpu) |
| 127 | 125 | { |
| 128 | 126 | esrip_state *cpustate = cpu->token; |
| 129 | ||
| 130 | 127 | return cpustate->status_out; |
| 131 | 128 | } |
| 132 | 129 | |
| 133 | /* | |
| 134 | static STATE_POSTLOAD( esrip_postload ) | |
| 135 | { | |
| 136 | 130 | |
| 137 | } | |
| 138 | */ | |
| 131 | /*************************************************************************** | |
| 132 | INITIALIZATION AND SHUTDOWN | |
| 133 | ***************************************************************************/ | |
| 139 | 134 | |
| 140 | //static void esrip_state_register(int index, const char *type) | |
| 141 | //{ | |
| 142 | // state_save_register_item_pointer(type, index, cpustate->ipt_ram, IPT_RAM_SIZE / 2); | |
| 143 | //} | |
| 144 | ||
| 145 | ||
| 146 | 135 | enum |
| 147 | 136 | { |
| 148 | 137 | ROTR1, TOR1, ROTR2, ROTC, ROTM, BOR2, CRCF, CRCR, |
| r4135 | r4136 | |
| 150 | 139 | ROTNR, BONR, BOR1, SONR, SHFTNR, PRTNR, TONR |
| 151 | 140 | } ops; |
| 152 | 141 | |
| 153 | ||
| 154 | 142 | void make_ops(esrip_state *cpustate) |
| 155 | 143 | { |
| 156 | 144 | int inst; |
| r4135 | r4136 | |
| 260 | 248 | cpustate->status_in = _config->status_in; |
| 261 | 249 | cpustate->draw = _config->draw; |
| 262 | 250 | |
| 251 | /* Allocate image pointer table RAM */ | |
| 263 | 252 | cpustate->ipt_ram = auto_malloc(IPT_RAM_SIZE); |
| 264 | //state_save_register_global_pointer(cpustate->ipt_ram, IPT_RAM_SIZE / 2); // TODO | |
| 265 | 253 | |
| 266 | // esrip_state_register(index, "esrip"); | |
| 267 | 254 | cpustate->device = device; |
| 268 | 255 | cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); |
| 269 | 256 | |
| 270 | 257 | /* Create the instruction decode lookup table */ |
| 271 | 258 | cpustate->optable = auto_malloc(65536); |
| 272 | 259 | make_ops(cpustate); |
| 260 | ||
| 261 | /* Register stuff for state saving */ | |
| 262 | state_save_register_device_item(device, 0, cpustate->acc); | |
| 263 | state_save_register_device_item_array(device, 0, cpustate->ram); | |
| 264 | state_save_register_device_item(device, 0, cpustate->d_latch); | |
| 265 | state_save_register_device_item(device, 0, cpustate->i_latch); | |
| 266 | state_save_register_device_item(device, 0, cpustate->result); | |
| 267 | state_save_register_device_item(device, 0, cpustate->new_status); | |
| 268 | state_save_register_device_item(device, 0, cpustate->status); | |
| 269 | state_save_register_device_item(device, 0, cpustate->inst); | |
| 270 | state_save_register_device_item(device, 0, cpustate->immflag); | |
| 271 | state_save_register_device_item(device, 0, cpustate->ct); | |
| 272 | state_save_register_device_item(device, 0, cpustate->t); | |
| 273 | state_save_register_device_item(device, 0, cpustate->l1); | |
| 274 | state_save_register_device_item(device, 0, cpustate->l2); | |
| 275 | state_save_register_device_item(device, 0, cpustate->l3); | |
| 276 | state_save_register_device_item(device, 0, cpustate->l4); | |
| 277 | state_save_register_device_item(device, 0, cpustate->l5); | |
| 278 | state_save_register_device_item(device, 0, cpustate->l6); | |
| 279 | state_save_register_device_item(device, 0, cpustate->l7); | |
| 280 | state_save_register_device_item(device, 0, cpustate->pl1); | |
| 281 | state_save_register_device_item(device, 0, cpustate->pl2); | |
| 282 | state_save_register_device_item(device, 0, cpustate->pl3); | |
| 283 | state_save_register_device_item(device, 0, cpustate->pl4); | |
| 284 | state_save_register_device_item(device, 0, cpustate->pl5); | |
| 285 | state_save_register_device_item(device, 0, cpustate->pl6); | |
| 286 | state_save_register_device_item(device, 0, cpustate->pl7); | |
| 287 | state_save_register_device_item(device, 0, cpustate->pc); | |
| 288 | state_save_register_device_item(device, 0, cpustate->status_out); | |
| 289 | state_save_register_device_item(device, 0, cpustate->x_scale); | |
| 290 | state_save_register_device_item(device, 0, cpustate->y_scale); | |
| 291 | state_save_register_device_item(device, 0, cpustate->line_latch); | |
| 292 | state_save_register_device_item(device, 0, cpustate->fig_latch); | |
| 293 | state_save_register_device_item(device, 0, cpustate->attr_latch); | |
| 294 | state_save_register_device_item(device, 0, cpustate->adl_latch); | |
| 295 | state_save_register_device_item(device, 0, cpustate->adr_latch); | |
| 296 | state_save_register_device_item(device, 0, cpustate->iaddr_latch); | |
| 297 | state_save_register_device_item(device, 0, cpustate->c_latch); | |
| 298 | state_save_register_device_item(device, 0, cpustate->fdt_cnt); | |
| 299 | state_save_register_device_item(device, 0, cpustate->ipt_cnt); | |
| 300 | state_save_register_device_item(device, 0, cpustate->fig); | |
| 301 | state_save_register_device_item(device, 0, cpustate->fig_cycles); | |
| 302 | state_save_register_device_item_pointer(device, 0, cpustate->ipt_ram, IPT_RAM_SIZE / sizeof(UINT16)); | |
| 273 | 303 | } |
| 274 | 304 | |
| 275 | 305 | |
| r4135 | r4136 | |
| 306 | 336 | } |
| 307 | 337 | |
| 308 | 338 | |
| 339 | /*************************************************************************** | |
| 340 | PRIVATE FUNCTIONS | |
| 341 | ***************************************************************************/ | |
| 309 | 342 | |
| 310 | 343 | static int get_hblank(running_machine *machine) |
| 311 | 344 | { |
| r4135 | r4136 | |
| 358 | 391 | } |
| 359 | 392 | } |
| 360 | 393 | else |
| 361 | | |
| 394 | assert(!"RIP: Invalid jump control"); | |
| 362 | 395 | |
| 363 | 396 | return ret; |
| 364 | 397 | } |
| r4135 | r4136 | |
| 401 | 434 | } |
| 402 | 435 | |
| 403 | 436 | |
| 437 | /*************************************************************************** | |
| 438 | INSTRUCTIONS | |
| 439 | ***************************************************************************/ | |
| 440 | ||
| 404 | 441 | enum |
| 405 | 442 | { |
| 406 | 443 | ACC, |
| r4135 | r4136 | |
| 1614 | 1651 | { |
| 1615 | 1652 | esrip_state *cpustate = device->token; |
| 1616 | 1653 | int calldebugger = (device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0; |
| 1617 | UINT | |
| 1654 | UINT8 | |
| 1618 | 1655 | |
| 1619 | 1656 | cpustate->icount = cycles; |
| 1620 | 1657 | |
| 1658 | /* I think we can get away with placing this outside of the loop */ | |
| 1659 | status = cpustate->status_in(device->machine); | |
| 1660 | ||
| 1621 | 1661 | /* Core execution loop */ |
| 1622 | 1662 | do |
| 1623 | 1663 | { |
| r4135 | r4136 | |
| 1636 | 1676 | |
| 1637 | 1677 | if (cpustate->fig_cycles) |
| 1638 | 1678 | { |
| 1639 | if(--cpustate->fig_cycles == 0) | |
| 1679 | if (--cpustate->fig_cycles == 0) | |
| 1640 | 1680 | cpustate->fig = 0; |
| 1641 | 1681 | } |
| 1642 | 1682 | |
| r4135 | r4136 | |
| 1761 | 1801 | cpustate->attr_latch = x_bus; |
| 1762 | 1802 | |
| 1763 | 1803 | cpustate->fig = 1; |
| 1764 | cpustate->fig_cycles = cpustate->draw(device->machine, cpustate->adl_latch, cpustate->adr_latch, cpustate->fig_latch, cpustate->attr_latch, cpustate->iaddr, cpustate->c_latch, cpustate->x_scale, cpustate->line_latch); | |
| 1804 | cpustate->fig_cycles = cpustate->draw(device->machine, cpustate->adl_latch, cpustate->adr_latch, cpustate->fig_latch, cpustate->attr_latch, cpustate->iaddr_latch, cpustate->c_latch, cpustate->x_scale, cpustate->line_latch); | |
| 1765 | 1805 | } |
| 1766 | 1806 | |
| 1767 | 1807 | /* X-scale */ |
| r4135 | r4136 | |
| 1777 | 1817 | |
| 1778 | 1818 | /* Image ROM address */ |
| 1779 | 1819 | if (RISING_EDGE(cpustate->pl3, cpustate->l3, 5)) |
| 1780 | cpustate->iaddr = y_bus; | |
| 1820 | cpustate->iaddr_latch = y_bus; | |
| 1781 | 1821 | |
| 1782 | 1822 | /* IXLLD */ |
| 1783 | 1823 | if (RISING_EDGE(cpustate->pl3, cpustate->l3, 6)) |
| r4135 | r4136 | |
| 1815 | 1855 | |
| 1816 | 1856 | |
| 1817 | 1857 | /*************************************************************************** |
| 1818 | DISASSEMBLY HOOK | |
| 1858 | DISASSEMBLY HOOK (TODO: FINISH) | |
| 1819 | 1859 | ***************************************************************************/ |
| 1820 | 1860 | |
| 1821 | 1861 | static CPU_DISASSEMBLE( esrip ) |
| r4135 | r4136 | |
| 1862 | 1902 | UINT8 ctrl3 = (inst_hi) & 0xff; |
| 1863 | 1903 | |
| 1864 | 1904 | sprintf(buffer, "%.4x %c%c%c%c %.2x %s%s%s%s%s%s%s%s %c%s%s%s %c%c%c%c%c%c%c%c\n", |
| 1865 | ins, | |
| 1866 | ctrl & 1 ? 'D' : ' ', | |
| 1867 | ctrl & 2 ? ' ' : 'Y', | |
| 1868 | ctrl & 4 ? 'S' : ' ', | |
| 1869 | (~jmp_ctrl & 0x18) ? 'J' : ' ', | |
| 1870 | jmp_dest, | |
| 1871 | ctrl1 & 0x01 ? " " : "I ", | |
| 1872 | ctrl1 & 0x02 ? " " : "FL", | |
| 1873 | ctrl1 & 0x04 ? "FE" : " ", | |
| 1874 | ctrl1 & 0x08 ? " " : "FR", | |
| 1875 | ctrl1 & 0x10 ? " " : "IL", | |
| 1876 | ctrl1 & 0x20 ? "IE" : " ", | |
| 1877 | ctrl1 & 0x40 ? " " : "IR", | |
| 1878 | ctrl1 & 0x80 ? " " : "IW", | |
| 1905 | ins, | |
| 1906 | ctrl & 1 ? 'D' : ' ', | |
| 1907 | ctrl & 2 ? ' ' : 'Y', | |
| 1908 | ctrl & 4 ? 'S' : ' ', | |
| 1909 | (~jmp_ctrl & 0x18) ? 'J' : ' ', | |
| 1910 | jmp_dest, | |
| 1911 | ctrl1 & 0x01 ? " " : "I ", | |
| 1912 | ctrl1 & 0x02 ? " " : "FL", | |
| 1913 | ctrl1 & 0x04 ? "FE" : " ", | |
| 1914 | ctrl1 & 0x08 ? " " : "FR", | |
| 1915 | ctrl1 & 0x10 ? " " : "IL", | |
| 1916 | ctrl1 & 0x20 ? "IE" : " ", | |
| 1917 | ctrl1 & 0x40 ? " " : "IR", | |
| 1918 | ctrl1 & 0x80 ? " " : "IW", | |
| 1879 | 1919 | |
| 1880 | ctrl2 & 0x80 ? ' ' : 'O', | |
| 1881 | ctrl2 & 0x40 ? " " : "IXLLD", | |
| 1882 | ctrl2 & 0x20 ? " " : "IADLD", | |
| 1883 | ctrl2 & 0x10 ? " " : "SCALD", | |
| 1920 | ctrl2 & 0x80 ? ' ' : 'O', | |
| 1921 | ctrl2 & 0x40 ? " " : "IXLLD", | |
| 1922 | ctrl2 & 0x20 ? " " : "IADLD", | |
| 1923 | ctrl2 & 0x10 ? " " : "SCALD", | |
| 1884 | 1924 | |
| 1885 | ctrl3 & 0x01 ? ' ' : '0', | |
| 1886 | ctrl3 & 0x02 ? ' ' : '1', | |
| 1887 | ctrl3 & 0x04 ? ' ' : '2', | |
| 1888 | ctrl3 & 0x08 ? ' ' : '3', | |
| 1889 | ctrl3 & 0x10 ? ' ' : '4', | |
| 1890 | ctrl3 & 0x20 ? ' ' : '5', | |
| 1891 | ctrl3 & 0x40 ? ' ' : '6', | |
| 1892 | ctrl3 & 0x80 ? ' ' : '7' | |
| 1893 | ); | |
| 1925 | ctrl3 & 0x01 ? ' ' : '0', | |
| 1926 | ctrl3 & 0x02 ? ' ' : '1', | |
| 1927 | ctrl3 & 0x04 ? ' ' : '2', | |
| 1928 | ctrl3 & 0x08 ? ' ' : '3', | |
| 1929 | ctrl3 & 0x10 ? ' ' : '4', | |
| 1930 | ctrl3 & 0x20 ? ' ' : '5', | |
| 1931 | ctrl3 & 0x40 ? ' ' : '6', | |
| 1932 | ctrl3 & 0x80 ? ' ' : '7' | |
| 1933 | ); | |
| 1894 | 1934 | |
| 1895 | 1935 | return 1 | DASMFLAG_SUPPORTED; |
| 1896 | 1936 | } |
| r4135 | r4136 | |
| 1899 | 1939 | * set_info |
| 1900 | 1940 | **************************************************************************/ |
| 1901 | 1941 | |
| 1902 | CPU_SET_INFO( esrip ) | |
| 1942 | static CPU_SET_INFO( esrip ) | |
| 1903 | 1943 | { |
| 1904 | 1944 | esrip_state *cpustate = device->token; |
| 1905 | 1945 | |
| r4135 | r4136 | |
| 2025 | 2065 | case CPUINFO_STR_REGISTER + ESRIP_ADRL: sprintf(info->s, "ADRL: %04X", cpustate->adl_latch); break; |
| 2026 | 2066 | case CPUINFO_STR_REGISTER + ESRIP_ADRR: sprintf(info->s, "ADRR: %04X", cpustate->adr_latch); break; |
| 2027 | 2067 | case CPUINFO_STR_REGISTER + ESRIP_COLR: sprintf(info->s, "COLR: %04X", cpustate->c_latch); break; |
| 2028 | case CPUINFO_STR_REGISTER + ESRIP_IADDR: sprintf(info->s, "IADR: %04X", cpustate->iaddr); break; | |
| 2068 | case CPUINFO_STR_REGISTER + ESRIP_IADDR: sprintf(info->s, "IADR: %04X", cpustate->iaddr_latch); break; | |
| 2029 | 2069 | } |
| 2030 | 2070 | } |
| r4135 | r4136 | |
|---|---|---|
| 325 | 325 | { |
| 326 | 326 | case 0x0: /* workspace register */ |
| 327 | 327 | return sprintf (dest, "R%d", arg); |
| 328 | break; | |
| 329 | 328 | case 0x1: /* workspace register indirect */ |
| 330 | 329 | return sprintf (dest, "*R%d", arg); |
| 331 | break; | |
| 332 | 330 | case 0x2: /* symbolic|indexed */ |
| 333 | 331 | base = readop_arg(opram, pc); |
| 334 | 332 | if (arg) /* indexed */ |
| r4135 | r4136 | |
| 338 | 336 | break; |
| 339 | 337 | case 0x3: /* workspace register indirect auto increment */ |
| 340 | 338 | return sprintf (dest, "*R%d+", arg); |
| 341 | break; | |
| 342 | 339 | } |
| 343 | 340 | |
| 344 | 341 | return 0; |
| r4135 | r4136 | |
|---|---|---|
| 123 | 123 | #define CLK 4 /* 1 cycle equals 4 clock ticks */ /* PE/DI */ |
| 124 | 124 | |
| 125 | 125 | |
| 126 | #ifndef INLINE | |
| 127 | #define INLINE static inline | |
| 128 | #endif | |
| 129 | 126 | |
| 130 | ||
| 131 | 127 | #define SET_PC(x) do { cpustate->PC = (x); } while (0) |
| 132 | 128 | |
| 133 | 129 | #define P_IN(A) (memory_read_word_16be(cpustate->io, (A)<<1)) |
| r4135 | r4136 | |
|---|---|---|
| 55 | 55 | #include "pic16c5x.h" |
| 56 | 56 | |
| 57 | 57 | |
| 58 | #ifndef INLINE | |
| 59 | #define INLINE static inline | |
| 60 | #endif | |
| 61 | 58 | |
| 62 | ||
| 63 | 59 | #define M_RDRAM(A) (((A) < 8) ? cpustate->internalram[A] : PIC16C5x_RAM_RDMEM(A)) |
| 64 | 60 | #define M_WRTRAM(A,V) do { if ((A) < 8) cpustate->internalram[A] = (V); else PIC16C5x_RAM_WRMEM(A,V); } while (0) |
| 65 | 61 | #define M_RDOP(A) PIC16C5x_RDOP(A) |
| r4135 | r4136 | |
|---|---|---|
| 204 | 204 | |
| 205 | 205 | case 0x16: /* always */ |
| 206 | 206 | return 1; |
| 207 | break; | |
| 208 | 207 | |
| 209 | 208 | default: |
| 210 | 209 | logerror( "TGP: Unknown condition code (cc=%d) at PC:%x\n", cond, GETPC()); |
| r4135 | r4136 | |
| 594 | 593 | { |
| 595 | 594 | case 0x10: /* A */ |
| 596 | 595 | return GETA().u; |
| 597 | break; | |
| 598 | 596 | |
| 599 | 597 | case 0x11: /* A.e */ |
| 600 | 598 | return (GETA().u >> 23) & 0xff; |
| 601 | break; | |
| 602 | 599 | |
| 603 | 600 | case 0x12: /* A.m */ |
| 604 | 601 | return (GETA().u & 0x7fffff) | ((GETA().u&0x80000000) >> 8); |
| 605 | break; | |
| 606 | 602 | |
| 607 | 603 | case 0x13: /* B */ |
| 608 | 604 | return GETB().u; |
| 609 | break; | |
| 610 | 605 | |
| 611 | 606 | case 0x14: /* B.e */ |
| 612 | 607 | return (GETB().u >> 23) & 0xff; |
| 613 | break; | |
| 614 | 608 | |
| 615 | 609 | case 0x15: /* B.m */ |
| 616 | 610 | return (GETB().u & 0x7fffff) | ((GETB().u&0x80000000) >> 8); |
| 617 | break; | |
| 618 | 611 | |
| 619 | 612 | case 0x19: /* D */ |
| 620 | 613 | return GETD().u; |
| 621 | break; | |
| 622 | 614 | |
| 623 | 615 | case 0x1A: /* D.e */ |
| 624 | 616 | return (GETD().u >> 23) & 0xff; |
| 625 | break; | |
| 626 | 617 | |
| 627 | 618 | case 0x1B: /* D.m */ |
| 628 | 619 | return (GETD().u & 0x7fffff) | ((GETD().u&0x80000000) >> 8); |
| 629 | break; | |
| 630 | 620 | |
| 631 | 621 | case 0x1C: /* P */ |
| 632 | 622 | return GETP().u; |
| 633 | break; | |
| 634 | 623 | |
| 635 | 624 | case 0x1D: /* P.e */ |
| 636 | 625 | return (GETP().u >> 23) & 0xff; |
| 637 | break; | |
| 638 | 626 | |
| 639 | 627 | case 0x1E: /* P.m */ |
| 640 | 628 | return (GETP().u & 0x7fffff) | ((GETP().u&0x80000000) >> 8); |
| 641 | break; | |
| 642 | 629 | |
| 643 | 630 | case 0x1F: /* Shift */ |
| 644 | 631 | return GETSHIFT(); |
| 645 | break; | |
| 646 | 632 | |
| 647 | 633 | case 0x20: /* Parallel Port */ |
| 648 | 634 | logerror( "TGP: Parallel port read at PC:%04x\n", GETPC() ); |
| 649 | 635 | return 0; |
| 650 | break; | |
| 651 | 636 | |
| 652 | 637 | case 0x21: /* FIn */ |
| 653 | 638 | { |
| r4135 | r4136 | |
| 664 | 649 | GETFIFOWAIT() = 1; |
| 665 | 650 | return 0; |
| 666 | 651 | } |
| 667 | break; | |
| 668 | 652 | |
| 669 | 653 | case 0x22: /* FOut */ |
| 670 | 654 | return 0; |
| 671 | break; | |
| 672 | 655 | |
| 673 | 656 | case 0x23: /* EB */ |
| 674 | 657 | return GETEB(); |
| 675 | break; | |
| 676 | 658 | |
| 677 | 659 | case 0x34: |
| 678 | 660 | return GETREPCNT(); |
| 679 | break; | |
| 680 | 661 | |
| 681 | 662 | default: |
| 682 | 663 | logerror( "TGP: Unknown GETREG (%d) at PC=%04x\n", reg, GETPC() ); |
| r4135 | r4136 | |
|---|---|---|
| 117 | 117 | |
| 118 | 118 | /* Static Vars */ |
| 119 | 119 | // Note: for multi-cpu implementation, this approach won't work w/o modification |
| 120 | WRITE32_HANDLER((*arm7_coproc_do_callback)); // holder for the co processor Data Operations Callback func. | |
| 121 | READ32_HANDLER((*arm7_coproc_rt_r_callback)); // holder for the co processor Register Transfer Read Callback func. | |
| 122 | WRITE32_HANDLER((*arm7_coproc_rt_w_callback)); // holder for the co processor Register Transfer Write Callback Callback func. | |
| 120 | write32_space_func arm7_coproc_do_callback; // holder for the co processor Data Operations Callback func. | |
| 121 | read32_space_func arm7_coproc_rt_r_callback; // holder for the co processor Register Transfer Read Callback func. | |
| 122 | write32_space_func arm7_coproc_rt_w_callback; // holder for the co processor Register Transfer Write Callback Callback func. | |
| 123 | 123 | // holder for the co processor Data Transfer Read & Write Callback funcs |
| 124 | 124 | void (*arm7_coproc_dt_r_callback)(arm_state *cpustate, UINT32 insn, UINT32 *prn, UINT32 (*read32)(arm_state *cpustate, UINT32 addr)); |
| 125 | 125 | void (*arm7_coproc_dt_w_callback)(arm_state *cpustate, UINT32 insn, UINT32 *prn, void (*write32)(arm_state *cpustate, UINT32 addr, UINT32 data)); |
| r4135 | r4136 | |
|---|---|---|
| 403 | 403 | #define SET_REGISTER(state, reg, val) SetRegister(state, reg, val) |
| 404 | 404 | #define ARM7_CHECKIRQ arm7_check_irq_state(cpustate) |
| 405 | 405 | |
| 406 | extern WRITE32_HANDLER((*arm7_coproc_do_callback)); | |
| 407 | extern READ32_HANDLER((*arm7_coproc_rt_r_callback)); | |
| 408 | extern WRITE32_HANDLER((*arm7_coproc_rt_w_callback)); | |
| 406 | extern write32_space_func arm7_coproc_do_callback; | |
| 407 | extern read32_space_func arm7_coproc_rt_r_callback; | |
| 408 | extern write32_space_func arm7_coproc_rt_w_callback; | |
| 409 | 409 | extern void (*arm7_coproc_dt_r_callback)(arm_state *cpustate, UINT32 insn, UINT32* prn, UINT32 (*read32)(arm_state *cpustate, UINT32 addr)); |
| 410 | 410 | extern void (*arm7_coproc_dt_w_callback)(arm_state *cpustate, UINT32 insn, UINT32* prn, void (*write32)(arm_state *cpustate, UINT32 addr, UINT32 data)); |
| 411 | 411 |
| r4135 | r4136 | |
|---|---|---|
| 289 | 289 | |
| 290 | 290 | switch (offset&3) |
| 291 | 291 | { |
| 292 | default: return cpustate->io_buffer; | |
| 292 | default: return cpustate->io_buffer; | |
| 293 | 293 | case 3: |
| 294 | 294 | { |
| 295 | 295 | status=0; |
| r4135 | r4136 | |
| 298 | 298 | if(cpustate->irq_state[2]!=CLEAR_LINE) status|=4; /* TIMER */ |
| 299 | 299 | return status|(cpustate->io_buffer&(~H6280_IRQ_MASK)); |
| 300 | 300 | } |
| 301 | case 2: return cpustate->irq_mask|(cpustate->io_buffer&(~H6280_IRQ_MASK)); | |
| 301 | case 2: return cpustate->irq_mask|(cpustate->io_buffer&(~H6280_IRQ_MASK)); | |
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 |
| r4135 | r4136 | |
|---|---|---|
| 787 | 787 | for (y = 0; y < height; y++) |
| 788 | 788 | { |
| 789 | 789 | UINT32 *dest = (UINT32 *)bitmap->base + (dsty + y) * rowpixels + dstx; |
| 790 | UINT8 *src = gfx | |
| 790 | const UINT8 *src = gfx_element_get_data(gfx, | |
| 791 | 791 | |
| 792 | 792 | /* loop over columns in the cell */ |
| 793 | 793 | for (x = 0; x < width; x++) |
| 794 | 794 | { |
| 795 | 795 | int effx = x, effy = y; |
| 796 | 796 | rgb_t pixel; |
| 797 | UINT8 *s; | |
| 797 | const UINT8 *s; | |
| 798 | 798 | |
| 799 | 799 | /* compute effective x,y values after rotation */ |
| 800 | 800 | if (!(rotate & ORIENTATION_SWAP_XY)) |
| r4135 | r4136 | |
|---|---|---|
| 3121 | 3121 | { |
| 3122 | 3122 | stats->pixels_in++; |
| 3123 | 3123 | stats->clip_fail++; |
| 3124 | | |
| 3124 | goto nextpix | |
| 3125 | 3125 | } |
| 3126 | 3126 | } |
| 3127 | 3127 | |
| r4135 | r4136 | |
| 3142 | 3142 | /* pixel pipeline part 2 handles color combine, fog, alpha, and final output */ |
| 3143 | 3143 | PIXEL_PIPELINE_END(v, stats, dither, dither4, dither_lookup, x, dest, depth, v->reg[fbzMode].u, v->reg[fbzColorPath].u, v->reg[alphaMode].u, v->reg[fogMode].u, iterz, iterw, v->reg[zaColor]); |
| 3144 | 3144 | } |
| 3145 | ||
| 3145 | nextpixel: | |
| 3146 | 3146 | /* advance our pointers */ |
| 3147 | 3147 | x++; |
| 3148 | 3148 | mask >>= 4; |
| r4135 | r4136 | |
|---|---|---|
| 908 | 908 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 909 | 909 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 910 | 910 | |
| 911 | /* --- the following bits of info are returned as pointers to | |
| 911 | /* --- the following bits of info are returned as pointers to | |
| 912 | 912 | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(mc6845); break; |
| 913 | 913 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(mc6845); break; |
| 914 | 914 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| r4135 | r4136 | |
|---|---|---|
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | /* internal blitting callbacks */ |
| 49 | typedef void (*blitmask_func)(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 50 | typedef void (*blitopaque_func)(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 49 | typedef void (*blitmask_func)(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 50 | typedef void (*blitopaque_func)(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | /* blitting parameters for rendering */ |
| r4135 | r4136 | |
| 61 | 61 | UINT32 tilemap_priority_code; |
| 62 | 62 | UINT8 mask; |
| 63 | 63 | UINT8 value; |
| 64 | UINT8 alpha; | |
| 64 | 65 | }; |
| 65 | 66 | |
| 66 | 67 | |
| r4135 | r4136 | |
| 97 | 98 | UINT8 all_tiles_clean; /* true if all tiles are clean */ |
| 98 | 99 | UINT32 palette_offset; /* palette offset */ |
| 99 | 100 | UINT32 pen_data_offset; /* pen data offset */ |
| 101 | UINT32 gfx_used; /* bitmask of gfx items used */ | |
| 102 | UINT32 gfx_dirtyseq[MAX_GFX_ELEMENTS]; /* dirtyseq values from last check */ | |
| 100 | 103 | |
| 101 | 104 | /* scroll information */ |
| 102 | 105 | UINT32 scrollrows; /* number of independently scrolled rows */ |
| r4135 | r4136 | |
| 157 | 160 | UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound); |
| 158 | 161 | |
| 159 | 162 | /* scanline rasterizers for drawing to the pixmap */ |
| 160 | static void scanline_draw_opaque_null(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 161 | static void scanline_draw_masked_null(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 162 | static void scanline_draw_opaque_ind16(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 163 | static void scanline_draw_masked_ind16(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 164 | static void scanline_draw_opaque_rgb16(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 165 | static void scanline_draw_masked_rgb16(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 166 | static void scanline_draw_opaque_rgb16_alpha(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 167 | static void scanline_draw_masked_rgb16_alpha(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 168 | static void scanline_draw_opaque_rgb32(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 169 | static void scanline_draw_masked_rgb32(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 170 | static void scanline_draw_opaque_rgb32_alpha(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 171 | static void scanline_draw_masked_rgb32_alpha(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode); | |
| 163 | static void scanline_draw_opaque_null(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 164 | static void scanline_draw_masked_null(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 165 | static void scanline_draw_opaque_ind16(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 166 | static void scanline_draw_masked_ind16(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 167 | static void scanline_draw_opaque_rgb16(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 168 | static void scanline_draw_masked_rgb16(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 169 | static void scanline_draw_opaque_rgb16_alpha(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 170 | static void scanline_draw_masked_rgb16_alpha(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 171 | static void scanline_draw_opaque_rgb32(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 172 | static void scanline_draw_masked_rgb32(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 173 | static void scanline_draw_opaque_rgb32_alpha(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 174 | static void scanline_draw_masked_rgb32_alpha(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha); | |
| 172 | 175 | |
| 173 | 176 | |
| 174 | 177 | |
| r4135 | r4136 | |
| 251 | 254 | } |
| 252 | 255 | |
| 253 | 256 | |
| 257 | /*------------------------------------------------- | |
| 258 | gfx_tiles_changed - return TRUE if any | |
| 259 | gfx_elements used by this tilemap have | |
| 260 | changed | |
| 261 | -------------------------------------------------*/ | |
| 254 | 262 | |
| 263 | INLINE int gfx_elements_changed(tilemap *tmap) | |
| 264 | { | |
| 265 | UINT32 usedmask = tmap->gfx_used; | |
| 266 | int isdirty = FALSE; | |
| 267 | int gfxnum; | |
| 268 | ||
| 269 | /* iterate over all used gfx types and set the dirty flag if any of them have changed */ | |
| 270 | for (gfxnum = 0; usedmask != 0; usedmask >>= 1, gfxnum++) | |
| 271 | if ((usedmask & 1) != 0) | |
| 272 | if (tmap->gfx_dirtyseq[gfxnum] != tmap->machine->gfx[gfxnum]->dirtyseq) | |
| 273 | { | |
| 274 | tmap->gfx_dirtyseq[gfxnum] = tmap->machine->gfx[gfxnum]->dirtyseq; | |
| 275 | isdirty = TRUE; | |
| 276 | } | |
| 277 | ||
| 278 | return isdirty; | |
| 279 | } | |
| 280 | ||
| 281 | ||
| 255 | 282 | /*************************************************************************** |
| 256 | 283 | SYSTEM-WIDE MANAGEMENT |
| 257 | 284 | ***************************************************************************/ |
| r4135 | r4136 | |
| 318 | 345 | |
| 319 | 346 | /* set up the default pen mask */ |
| 320 | 347 | tmap->tileinfo.pen_mask = 0xff; |
| 348 | tmap->tileinfo.gfxnum = 0xff; | |
| 321 | 349 | |
| 322 | 350 | /* initialize global states */ |
| 323 | 351 | tmap->enable = TRUE; |
| r4135 | r4136 | |
| 391 | 419 | |
| 392 | 420 | |
| 393 | 421 | /*------------------------------------------------- |
| 394 | tilemap_set_pen_data_offset - specify an offset | |
| 395 | to be added to pen_data while rendering tiles | |
| 396 | -------------------------------------------------*/ | |
| 397 | ||
| 398 | void tilemap_set_pen_data_offset(tilemap *tmap, UINT32 offset) | |
| 399 | { | |
| 400 | if (tmap->pen_data_offset != offset) | |
| 401 | { | |
| 402 | tmap->pen_data_offset = offset; | |
| 403 | tilemap_mark_all_tiles_dirty(tmap); | |
| 404 | } | |
| 405 | } | |
| 406 | ||
| 407 | ||
| 408 | /*------------------------------------------------- | |
| 409 | 422 | tilemap_set_enable - set an enable flag for |
| 410 | 423 | the tilemap; if 0, requests to draw the |
| 411 | 424 | tilemap are ignored |
| r4135 | r4136 | |
| 776 | 789 | original_cliprect = blit.cliprect; |
| 777 | 790 | |
| 778 | 791 | /* if the whole map is dirty, mark it as such */ |
| 779 | if (tmap->all_tiles_dirty) | |
| 792 | if (tmap->all_tiles_dirty || gfx_elements_changed(tmap)) | |
| 780 | 793 | { |
| 781 | 794 | memset(tmap->tileflags, TILE_FLAG_DIRTY, tmap->max_logical_index); |
| 782 | 795 | tmap->all_tiles_dirty = FALSE; |
| 796 | tmap->gfx_used = 0; | |
| 783 | 797 | } |
| 784 | 798 | |
| 785 | 799 | width = video_screen_get_width(tmap->machine->primary_screen); |
| r4135 | r4136 | |
| 975 | 989 | scrolly = tmap->height - scrolly % tmap->height; |
| 976 | 990 | |
| 977 | 991 | /* if the whole map is dirty, mark it as such */ |
| 978 | if (tmap->all_tiles_dirty) | |
| 992 | if (tmap->all_tiles_dirty || gfx_elements_changed(tmap)) | |
| 979 | 993 | { |
| 980 | 994 | memset(tmap->tileflags, TILE_FLAG_DIRTY, tmap->max_logical_index); |
| 981 | 995 | tmap->all_tiles_dirty = FALSE; |
| 996 | tmap->gfx_used = 0; | |
| 982 | 997 | } |
| 983 | 998 | |
| 984 | 999 | /* iterate to handle wraparound */ |
| r4135 | r4136 | |
| 1206 | 1221 | int mincol, maxcol, minrow, maxrow; |
| 1207 | 1222 | int row, col; |
| 1208 | 1223 | |
| 1224 | /* if the graphics changed, we need to mark everything dirty */ | |
| 1225 | if (gfx_elements_changed(tmap)) | |
| 1226 | tilemap_mark_all_tiles_dirty(tmap); | |
| 1227 | ||
| 1209 | 1228 | /* if everything is clean, do nothing */ |
| 1210 | 1229 | if (tmap->all_tiles_clean) |
| 1211 | 1230 | return; |
| r4135 | r4136 | |
| 1232 | 1251 | { |
| 1233 | 1252 | memset(tmap->tileflags, TILE_FLAG_DIRTY, tmap->max_logical_index); |
| 1234 | 1253 | tmap->all_tiles_dirty = FALSE; |
| 1254 | tmap->gfx_used = 0; | |
| 1235 | 1255 | } |
| 1236 | 1256 | |
| 1237 | 1257 | /* iterate over rows */ |
| r4135 | r4136 | |
| 1281 | 1301 | if ((flags & (TILE_FORCE_LAYER0 | TILE_FORCE_LAYER1 | TILE_FORCE_LAYER2)) == 0 && tmap->tileinfo.mask_data != NULL) |
| 1282 | 1302 | tmap->tileflags[logindex] = tile_apply_bitmask(tmap, tmap->tileinfo.mask_data, x0, y0, tmap->tileinfo.category, flags); |
| 1283 | 1303 | |
| 1304 | /* track which gfx have been used for this tilemap */ | |
| 1305 | if (tmap->tileinfo.gfxnum != 0xff && (tmap->gfx_used & (1 << tmap->tileinfo.gfxnum)) == 0) | |
| 1306 | { | |
| 1307 | tmap->gfx_used |= 1 << tmap->tileinfo.gfxnum; | |
| 1308 | tmap->gfx_dirtyseq[tmap->tileinfo.gfxnum] = tmap->machine->gfx[tmap->tileinfo.gfxnum]->dirtyseq; | |
| 1309 | } | |
| 1310 | ||
| 1284 | 1311 | profiler_mark(PROFILER_END); |
| 1285 | 1312 | } |
| 1286 | 1313 | |
| r4135 | r4136 | |
| 1470 | 1497 | blit->cliprect.max_y = dest->height - 1; |
| 1471 | 1498 | } |
| 1472 | 1499 | |
| 1473 | /* set the priority code */ | |
| 1500 | /* set the priority code and alpha */ | |
| 1474 | 1501 | blit->tilemap_priority_code = priority | (priority_mask << 8) | (tmap->palette_offset << 16); |
| 1502 | blit->alpha = (flags & TILEMAP_DRAW_ALPHA_FLAG) ? (flags >> 24) : 0xff; | |
| 1475 | 1503 | |
| 1476 | 1504 | /* if no destination, just render priority */ |
| 1477 | 1505 | if (dest == NULL) |
| r4135 | r4136 | |
| 1486 | 1514 | switch (dest->format) |
| 1487 | 1515 | { |
| 1488 | 1516 | case BITMAP_FORMAT_RGB32: |
| 1489 | blit->draw_masked = (flags & TILEMAP_DRAW_ALPHA) ? scanline_draw_masked_rgb32_alpha : scanline_draw_masked_rgb32; | |
| 1490 | blit->draw_opaque = (flags & TILEMAP_DRAW_ALPHA) ? scanline_draw_opaque_rgb32_alpha : scanline_draw_opaque_rgb32; | |
| 1517 | blit->draw_masked = (blit->alpha < 0xff) ? scanline_draw_masked_rgb32_alpha : scanline_draw_masked_rgb32; | |
| 1518 | blit->draw_opaque = (blit->alpha < 0xff) ? scanline_draw_opaque_rgb32_alpha : scanline_draw_opaque_rgb32; | |
| 1491 | 1519 | break; |
| 1492 | 1520 | |
| 1493 | 1521 | case BITMAP_FORMAT_RGB15: |
| 1494 | blit->draw_masked = (flags & TILEMAP_DRAW_ALPHA) ? scanline_draw_masked_rgb16_alpha : scanline_draw_masked_rgb16; | |
| 1495 | blit->draw_opaque = (flags & TILEMAP_DRAW_ALPHA) ? scanline_draw_opaque_rgb16_alpha : scanline_draw_opaque_rgb16; | |
| 1522 | blit->draw_masked = (blit->alpha < 0xff) ? scanline_draw_masked_rgb16_alpha : scanline_draw_masked_rgb16; | |
| 1523 | blit->draw_opaque = (blit->alpha < 0xff) ? scanline_draw_opaque_rgb16_alpha : scanline_draw_opaque_rgb16; | |
| 1496 | 1524 | break; |
| 1497 | 1525 | |
| 1498 | 1526 | case BITMAP_FORMAT_INDEXED16: |
| r4135 | r4136 | |
| 1650 | 1678 | { |
| 1651 | 1679 | for (cury = y; cury < nexty; cury++) |
| 1652 | 1680 | { |
| 1653 | (*blit->draw_opaque)(dest0, source0, x_end - x_start, tmap->machine->pens, pmap0, blit->tilemap_priority_code); | |
| 1681 | (*blit->draw_opaque)(dest0, source0, x_end - x_start, tmap->machine->pens, pmap0, blit->tilemap_priority_code, blit->alpha); | |
| 1654 | 1682 | |
| 1655 | 1683 | dest0 = (UINT8 *)dest0 + dest_line_pitch_bytes; |
| 1656 | 1684 | source0 += tmap->pixmap->rowpixels; |
| r4135 | r4136 | |
| 1664 | 1692 | const UINT8 *mask0 = mask_baseaddr + x_start; |
| 1665 | 1693 | for (cury = y; cury < nexty; cury++) |
| 1666 | 1694 | { |
| 1667 | (*blit->draw_masked)(dest0, source0, mask0, blit->mask, blit->value, x_end - x_start, tmap->machine->pens, pmap0, blit->tilemap_priority_code); | |
| 1695 | (*blit->draw_masked)(dest0, source0, mask0, blit->mask, blit->value, x_end - x_start, tmap->machine->pens, pmap0, blit->tilemap_priority_code, blit->alpha); | |
| 1668 | 1696 | |
| 1669 | 1697 | dest0 = (UINT8 *)dest0 + dest_line_pitch_bytes; |
| 1670 | 1698 | source0 += tmap->pixmap->rowpixels; |
| r4135 | r4136 | |
| 1712 | 1740 | else if (blit->draw_masked == scanline_draw_masked_rgb16) \ |
| 1713 | 1741 | *(UINT16 *)dest = clut[INPUT_VAL]; \ |
| 1714 | 1742 | else if (blit->draw_masked == scanline_draw_masked_rgb32_alpha) \ |
| 1715 | *(UINT32 *)dest = alpha_blend32(*(UINT32 *)dest, clut[INPUT_VAL]); \ | |
| 1743 | *(UINT32 *)dest = alpha_blend_r32(*(UINT32 *)dest, clut[INPUT_VAL], alpha); \ | |
| 1716 | 1744 | else if (blit->draw_masked == scanline_draw_masked_rgb16_alpha) \ |
| 1717 | *(UINT16 *)dest = alpha_blend16(*(UINT16 *)dest, clut[INPUT_VAL]); \ | |
| 1745 | *(UINT16 *)dest = alpha_blend_r16(*(UINT16 *)dest, clut[INPUT_VAL], alpha); \ | |
| 1718 | 1746 | } while (0) |
| 1719 | 1747 | |
| 1720 | 1748 | static void tilemap_draw_roz_core(tilemap *tmap, const blit_parameters *blit, |
| r4135 | r4136 | |
| 1731 | 1759 | UINT32 priority = blit->tilemap_priority_code; |
| 1732 | 1760 | UINT8 mask = blit->mask; |
| 1733 | 1761 | UINT8 value = blit->value; |
| 1762 | UINT8 alpha = blit->alpha; | |
| 1734 | 1763 | UINT32 cx; |
| 1735 | 1764 | UINT32 cy; |
| 1736 | 1765 | int x; |
| r4135 | r4136 | |
| 1902 | 1931 | bitmap, setting priority only |
| 1903 | 1932 | -------------------------------------------------*/ |
| 1904 | 1933 | |
| 1905 | static void scanline_draw_opaque_null(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 1934 | static void scanline_draw_opaque_null(void *dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 1906 | 1935 | { |
| 1907 | 1936 | int i; |
| 1908 | 1937 | |
| r4135 | r4136 | |
| 1920 | 1949 | bitmap using a mask, setting priority only |
| 1921 | 1950 | -------------------------------------------------*/ |
| 1922 | 1951 | |
| 1923 | static void scanline_draw_masked_null(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 1952 | static void scanline_draw_masked_null(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 1924 | 1953 | { |
| 1925 | 1954 | int i; |
| 1926 | 1955 | |
| r4135 | r4136 | |
| 1940 | 1969 | indexed bitmap |
| 1941 | 1970 | -------------------------------------------------*/ |
| 1942 | 1971 | |
| 1943 | static void scanline_draw_opaque_ind16(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 1972 | static void scanline_draw_opaque_ind16(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 1944 | 1973 | { |
| 1945 | 1974 | UINT16 *dest = _dest; |
| 1946 | 1975 | int pal = pcode >> 16; |
| r4135 | r4136 | |
| 1983 | 2012 | indexed bitmap using a mask |
| 1984 | 2013 | -------------------------------------------------*/ |
| 1985 | 2014 | |
| 1986 | static void scanline_draw_masked_ind16(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 2015 | static void scanline_draw_masked_ind16(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 1987 | 2016 | { |
| 1988 | 2017 | UINT16 *dest = _dest; |
| 1989 | 2018 | int pal = pcode >> 16; |
| r4135 | r4136 | |
| 2016 | 2045 | RGB bitmap |
| 2017 | 2046 | -------------------------------------------------*/ |
| 2018 | 2047 | |
| 2019 | static void scanline_draw_opaque_rgb16(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 2048 | static void scanline_draw_opaque_rgb16(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 2020 | 2049 | { |
| 2021 | 2050 | const pen_t *clut = &pens[pcode >> 16]; |
| 2022 | 2051 | UINT16 *dest = _dest; |
| r4135 | r4136 | |
| 2046 | 2075 | RGB bitmap using a mask |
| 2047 | 2076 | -------------------------------------------------*/ |
| 2048 | 2077 | |
| 2049 | static void scanline_draw_masked_rgb16(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 2078 | static void scanline_draw_masked_rgb16(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 2050 | 2079 | { |
| 2051 | 2080 | const pen_t *clut = &pens[pcode >> 16]; |
| 2052 | 2081 | UINT16 *dest = _dest; |
| r4135 | r4136 | |
| 2078 | 2107 | 16bpp RGB bitmap with alpha blending |
| 2079 | 2108 | -------------------------------------------------*/ |
| 2080 | 2109 | |
| 2081 | static void scanline_draw_opaque_rgb16_alpha(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 2110 | static void scanline_draw_opaque_rgb16_alpha(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 2082 | 2111 | { |
| 2083 | 2112 | const pen_t *clut = &pens[pcode >> 16]; |
| 2084 | 2113 | UINT16 *dest = _dest; |
| r4135 | r4136 | |
| 2089 | 2118 | { |
| 2090 | 2119 | for (i = 0; i < count; i++) |
| 2091 | 2120 | { |
| 2092 | dest[i] = alpha_blend16(dest[i], clut[source[i]]); | |
| 2121 | dest[i] = alpha_blend_r16(dest[i], clut[source[i]], alpha); | |
| 2093 | 2122 | pri[i] = (pri[i] & (pcode >> 8)) | pcode; |
| 2094 | 2123 | } |
| 2095 | 2124 | } |
| r4135 | r4136 | |
| 2098 | 2127 | else |
| 2099 | 2128 | { |
| 2100 | 2129 | for (i = 0; i < count; i++) |
| 2101 | dest[i] = alpha_blend16(dest[i], clut[source[i]]); | |
| 2130 | dest[i] = alpha_blend_r16(dest[i], clut[source[i]], alpha); | |
| 2102 | 2131 | } |
| 2103 | 2132 | } |
| 2104 | 2133 | |
| r4135 | r4136 | |
| 2109 | 2138 | blending |
| 2110 | 2139 | -------------------------------------------------*/ |
| 2111 | 2140 | |
| 2112 | static void scanline_draw_masked_rgb16_alpha(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 2141 | static void scanline_draw_masked_rgb16_alpha(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 2113 | 2142 | { |
| 2114 | 2143 | const pen_t *clut = &pens[pcode >> 16]; |
| 2115 | 2144 | UINT16 *dest = _dest; |
| r4135 | r4136 | |
| 2121 | 2150 | for (i = 0; i < count; i++) |
| 2122 | 2151 | if ((maskptr[i] & mask) == value) |
| 2123 | 2152 | { |
| 2124 | dest[i] = alpha_blend16(dest[i], clut[source[i]]); | |
| 2153 | dest[i] = alpha_blend_r16(dest[i], clut[source[i]], alpha); | |
| 2125 | 2154 | pri[i] = (pri[i] & (pcode >> 8)) | pcode; |
| 2126 | 2155 | } |
| 2127 | 2156 | } |
| r4135 | r4136 | |
| 2131 | 2160 | { |
| 2132 | 2161 | for (i = 0; i < count; i++) |
| 2133 | 2162 | if ((maskptr[i] & mask) == value) |
| 2134 | dest[i] = alpha_blend16(dest[i], clut[source[i]]); | |
| 2163 | dest[i] = alpha_blend_r16(dest[i], clut[source[i]], alpha); | |
| 2135 | 2164 | } |
| 2136 | 2165 | } |
| 2137 | 2166 | |
| r4135 | r4136 | |
| 2141 | 2170 | RGB bitmap |
| 2142 | 2171 | -------------------------------------------------*/ |
| 2143 | 2172 | |
| 2144 | static void scanline_draw_opaque_rgb32(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 2173 | static void scanline_draw_opaque_rgb32(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 2145 | 2174 | { |
| 2146 | 2175 | const pen_t *clut = &pens[pcode >> 16]; |
| 2147 | 2176 | UINT32 *dest = _dest; |
| r4135 | r4136 | |
| 2171 | 2200 | RGB bitmap using a mask |
| 2172 | 2201 | -------------------------------------------------*/ |
| 2173 | 2202 | |
| 2174 | static void scanline_draw_masked_rgb32(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 2203 | static void scanline_draw_masked_rgb32(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 2175 | 2204 | { |
| 2176 | 2205 | const pen_t *clut = &pens[pcode >> 16]; |
| 2177 | 2206 | UINT32 *dest = _dest; |
| r4135 | r4136 | |
| 2203 | 2232 | 32bpp RGB bitmap with alpha blending |
| 2204 | 2233 | -------------------------------------------------*/ |
| 2205 | 2234 | |
| 2206 | static void scanline_draw_opaque_rgb32_alpha(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 2235 | static void scanline_draw_opaque_rgb32_alpha(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 2207 | 2236 | { |
| 2208 | 2237 | const pen_t *clut = &pens[pcode >> 16]; |
| 2209 | 2238 | UINT32 *dest = _dest; |
| r4135 | r4136 | |
| 2214 | 2243 | { |
| 2215 | 2244 | for (i = 0; i < count; i++) |
| 2216 | 2245 | { |
| 2217 | dest[i] = alpha_blend32(dest[i], clut[source[i]]); | |
| 2246 | dest[i] = alpha_blend_r32(dest[i], clut[source[i]], alpha); | |
| 2218 | 2247 | pri[i] = (pri[i] & (pcode >> 8)) | pcode; |
| 2219 | 2248 | } |
| 2220 | 2249 | } |
| r4135 | r4136 | |
| 2223 | 2252 | else |
| 2224 | 2253 | { |
| 2225 | 2254 | for (i = 0; i < count; i++) |
| 2226 | dest[i] = alpha_blend32(dest[i], clut[source[i]]); | |
| 2255 | dest[i] = alpha_blend_r32(dest[i], clut[source[i]], alpha); | |
| 2227 | 2256 | } |
| 2228 | 2257 | } |
| 2229 | 2258 | |
| r4135 | r4136 | |
| 2234 | 2263 | blending |
| 2235 | 2264 | -------------------------------------------------*/ |
| 2236 | 2265 | |
| 2237 | static void scanline_draw_masked_rgb32_alpha(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode) | |
| 2266 | static void scanline_draw_masked_rgb32_alpha(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) | |
| 2238 | 2267 | { |
| 2239 | 2268 | const pen_t *clut = &pens[pcode >> 16]; |
| 2240 | 2269 | UINT32 *dest = _dest; |
| r4135 | r4136 | |
| 2246 | 2275 | for (i = 0; i < count; i++) |
| 2247 | 2276 | if ((maskptr[i] & mask) == value) |
| 2248 | 2277 | { |
| 2249 | dest[i] = alpha_blend32(dest[i], clut[source[i]]); | |
| 2278 | dest[i] = alpha_blend_r32(dest[i], clut[source[i]], alpha); | |
| 2250 | 2279 | pri[i] = (pri[i] & (pcode >> 8)) | pcode; |
| 2251 | 2280 | } |
| 2252 | 2281 | } |
| r4135 | r4136 | |
| 2256 | 2285 | { |
| 2257 | 2286 | for (i = 0; i < count; i++) |
| 2258 | 2287 | if ((maskptr[i] & mask) == value) |
| 2259 | dest[i] = alpha_blend32(dest[i], clut[source[i]]); | |
| 2288 | dest[i] = alpha_blend_r32(dest[i], clut[source[i]], alpha); | |
| 2260 | 2289 | } |
| 2261 | 2290 | } |
| r4135 | r4136 | |
|---|---|---|
| 54 | 54 | int cpu_getiloops(const device_config *device); |
| 55 | 55 | |
| 56 | 56 | |
| 57 | ||
| 58 | /************************************* | |
| 59 | * | |
| 60 | * Graphics decoding. Drivers should | |
| 61 | * use the new gfx_element_mark_dirty() | |
| 62 | * to explicitly mark tiles dirty, and | |
| 63 | * gfx_element_get_data() to fetch a | |
| 64 | * pointer to the data (and undirty | |
| 65 | * the tile) | |
| 66 | * | |
| 67 | *************************************/ | |
| 68 | ||
| 69 | /* decode a series of tiles from a particular gfx_element */ | |
| 70 | void decodegfx(gfx_element *gfx, UINT32 first, UINT32 count); | |
| 71 | ||
| 72 | void decodechar(const gfx_element *gfx, UINT32 code, const UINT8 *src); | |
| 73 | ||
| 74 | ||
| 75 | ||
| 57 | 76 | #endif /* __DEPRECAT_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 131 | 131 | * setting a global palette offset via |
| 132 | 132 | tilemap_set_palette_offset() |
| 133 | 133 | |
| 134 | * setting a global pen data offset via | |
| 135 | tilemap_set_pen_data_offset() | |
| 136 | ||
| 137 | 134 | 3. In your memory write handlers for the tile memory, anytime tile |
| 138 | 135 | data is modified, you need to mark the tile dirty so that it is |
| 139 | 136 | re-rendered with the new data the next time the tilemap is drawn. |
| r4135 | r4136 | |
| 282 | 279 | TILEMAP_DRAW_LAYER0 is assumed. |
| 283 | 280 | |
| 284 | 281 | * If you want to render with alpha blending, you can call |
| 285 | tilemap_draw() with the TILEMAP_DRAW_ALPHA flag. To configure the | |
| 286 | amount of alpha blending, call alpha_set_level() ahead of time. | |
| 282 | tilemap_draw() with the TILEMAP_DRAW_ALPHA flag. | |
| 287 | 283 | |
| 288 | 284 | * To configure more complex pen-to-layer mapping, use the |
| 289 | 285 | tilemap_map_pens_to_layer() call. This call takes a group number |
| r4135 | r4136 | |
| 302 | 298 | #define __TILEMAP_H__ |
| 303 | 299 | |
| 304 | 300 | #include "mamecore.h" |
| 301 | #include "drawgfx.h" | |
| 305 | 302 | |
| 306 | 303 | |
| 307 | 304 | /*************************************************************************** |
| r4135 | r4136 | |
| 323 | 320 | #define TILEMAP_DRAW_LAYER1 0x20 /* draw layer 1 */ |
| 324 | 321 | #define TILEMAP_DRAW_LAYER2 0x40 /* draw layer 2 */ |
| 325 | 322 | #define TILEMAP_DRAW_OPAQUE 0x80 /* draw everything, even transparent stuff */ |
| 326 | #define TILEMAP_DRAW_ALPHA 0x100 /* draw with alpha blending */ | |
| 323 | #define TILEMAP_DRAW_ALPHA_FLAG 0x100 /* draw with alpha blending (in the upper 8 bits) */ | |
| 324 | #define TILEMAP_DRAW_ALPHA(x) (TILEMAP_DRAW_ALPHA_FLAG | (rgb_clamp(x) << 24)) | |
| 327 | 325 | #define TILEMAP_DRAW_ALL_CATEGORIES 0x200 /* draw all categories */ |
| 328 | 326 | |
| 329 | 327 | |
| r4135 | r4136 | |
| 390 | 388 | typedef struct _tile_data tile_data; |
| 391 | 389 | struct _tile_data |
| 392 | 390 | { |
| 393 | const UINT8* pen_data; /* required */ | |
| 394 | const UINT8* mask_data; /* required */ | |
| 391 | const UINT8 * pen_data; /* required */ | |
| 392 | const UINT8 * mask_data; /* required */ | |
| 395 | 393 | pen_t palette_base; /* defaults to 0 */ |
| 396 | 394 | UINT8 category; /* defaults to 0; range from 0..15 */ |
| 397 | 395 | UINT8 group; /* defaults to 0; range from 0..TILEMAP_NUM_GROUPS */ |
| 398 | 396 | UINT8 flags; /* defaults to 0; one or more of TILE_* flags above */ |
| 399 | 397 | UINT8 pen_mask; /* defaults to 0xff; mask to apply to pen_data while rendering the tile */ |
| 398 | UINT8 gfxnum; /* defaults to 0xff; specify index of machine->gfx for auto-invalidation on dirty */ | |
| 400 | 399 | }; |
| 401 | 400 | |
| 402 | 401 | |
| r4135 | r4136 | |
| 442 | 441 | */ |
| 443 | 442 | void tilemap_set_palette_offset(tilemap *tmap, UINT32 offset); |
| 444 | 443 | |
| 445 | /* specify an offset to be added to pen_data while rendering tiles. | |
| 446 | * This will automatically mark all tiles dirty if the offset changes. | |
| 447 | */ | |
| 448 | void tilemap_set_pen_data_offset(tilemap *tmap, UINT32 offset); | |
| 449 | ||
| 450 | 444 | /* set an enable flag for the tilemap; if 0, requests to draw the tilemap are ignored */ |
| 451 | 445 | void tilemap_set_enable(tilemap *tmap, int enable); |
| 452 | 446 | |
| r4135 | r4136 | |
| 570 | 564 | |
| 571 | 565 | INLINE void tileinfo_set(running_machine *machine, tile_data *tileinfo, int gfxnum, int rawcode, int rawcolor, int flags) |
| 572 | 566 | { |
| 573 | const gfx_element * | |
| 567 | const gfx_element * | |
| 574 | 568 | int code = rawcode % gfx->total_elements; |
| 575 | tileinfo->pen_data = gfx | |
| 569 | tileinfo->pen_data = gfx_element_get_data( | |
| 576 | 570 | tileinfo->palette_base = gfx->color_base + gfx->color_granularity * rawcolor; |
| 577 | 571 | tileinfo->flags = flags; |
| 578 | 572 | if (gfx->flags & GFX_ELEMENT_PACKED) |
| 579 | 573 | tileinfo->flags |= TILE_4BPP; |
| 574 | tileinfo->gfxnum = gfxnum; | |
| 580 | 575 | } |
| 581 | 576 | |
| 582 | 577 |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | #include "rendutil.h" |
| 17 | 17 | #include "ui.h" |
| 18 | 18 | #include "aviio.h" |
| 19 | #include "deprecat.h" | |
| 19 | 20 | |
| 20 | 21 | #include "snap.lh" |
| 21 | 22 | |
| r4135 | r4136 | |
| 340 | 341 | (*machine->config->init_palette)(machine, memory_region(machine, "proms")); |
| 341 | 342 | |
| 342 | 343 | /* actually decode the graphics */ |
| 343 | if (machine->config->gfxdecodeinfo != NULL) | |
| 344 | if (PREDECODE_GFX && machine->config->gfxdecodeinfo != NULL) | |
| 344 | 345 | decode_graphics(machine, machine->config->gfxdecodeinfo); |
| 345 | 346 | |
| 346 | /* reset video statics and get out of here */ | |
| 347 | pdrawgfx_shadow_lowpri = 0; | |
| 348 | ||
| 349 | 347 | /* create a render target for snapshots */ |
| 350 | 348 | viewname = options_get_string(mame_options(), OPTION_SNAPVIEW); |
| 351 | 349 | global.snap_native = (machine->primary_screen != NULL && (viewname[0] == 0 || strcmp(viewname, "native") == 0)); |
| r4135 | r4136 | |
| 407 | 405 | |
| 408 | 406 | /* free all the graphics elements */ |
| 409 | 407 | for (i = 0; i < MAX_GFX_ELEMENTS; i++) |
| 410 | f | |
| 408 | gfx_element_free(machine->gfx[i]); | |
| 411 | 409 | |
| 412 | 410 | /* free the snapshot target */ |
| 413 | 411 | if (global.snap_target != NULL) |
| r4135 | r4136 | |
| 471 | 469 | |
| 472 | 470 | static void allocate_graphics(running_machine *machine, const gfx_decode_entry *gfxdecodeinfo) |
| 473 | 471 | { |
| 474 | int | |
| 472 | int curgfx; | |
| 475 | 473 | |
| 476 | 474 | /* loop over all elements */ |
| 477 | for ( | |
| 475 | for (curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++) | |
| 478 | 476 | { |
| 479 | int region_length = 8 * memory_region_length(machine, gfxdecodeinfo[i].memory_region); | |
| 480 | int xscale = (gfxdecodeinfo[i].xscale == 0) ? 1 : gfxdecodeinfo[i].xscale; | |
| 481 | int yscale = (gfxdecodeinfo[i].yscale == 0) ? 1 : gfxdecodeinfo[i].yscale; | |
| 477 | const gfx_decode_entry *gfxdecode = &gfxdecodeinfo[curgfx]; | |
| 478 | UINT32 region_length = 8 * memory_region_length(machine, gfxdecode->memory_region); | |
| 479 | const UINT8 *region_base = memory_region(machine, gfxdecode->memory_region); | |
| 480 | UINT32 xscale = (gfxdecode->xscale == 0) ? 1 : gfxdecode->xscale; | |
| 481 | UINT32 yscale = (gfxdecode->yscale == 0) ? 1 : gfxdecode->yscale; | |
| 482 | 482 | UINT32 *extpoffs, extxoffs[MAX_ABS_GFX_SIZE], extyoffs[MAX_ABS_GFX_SIZE]; |
| 483 | gfx_layout glcopy; | |
| 484 | const gfx_layout *gl = gfxdecodeinfo[i].gfxlayout; | |
| 483 | const gfx_layout *gl = gfxdecode->gfxlayout; | |
| 485 | 484 | int israw = (gl->planeoffset[0] == GFX_RAW); |
| 486 | 485 | int planes = gl->planes; |
| 487 | UINT16 width = gl->width; | |
| 488 | UINT16 height = gl->height; | |
| 486 | UINT32 width = gl->width; | |
| 487 | UINT32 height = gl->height; | |
| 489 | 488 | UINT32 total = gl->total; |
| 490 | 489 | UINT32 charincrement = gl->charincrement; |
| 490 | gfx_layout glcopy; | |
| 491 | 491 | int j; |
| 492 | 492 | |
| 493 | 493 | /* make a copy of the layout */ |
| 494 | glcopy = *gfxdecode | |
| 494 | glcopy = *gfxdecode-> | |
| 495 | 495 | |
| 496 | 496 | /* copy the X and Y offsets into temporary arrays */ |
| 497 | 497 | memcpy(extxoffs, glcopy.xoffset, sizeof(glcopy.xoffset)); |
| r4135 | r4136 | |
| 526 | 526 | /* if the character count is a region fraction, compute the effective total */ |
| 527 | 527 | if (IS_FRAC(total)) |
| 528 | 528 | { |
| 529 | if (region_length == 0) | |
| 530 | continue; | |
| 529 | assert(region_length != 0); | |
| 531 | 530 | total = region_length / charincrement * FRAC_NUM(total) / FRAC_DEN(total); |
| 532 | 531 | } |
| 533 | 532 | |
| r4135 | r4136 | |
| 539 | 538 | { |
| 540 | 539 | UINT32 value = extpoffs[j]; |
| 541 | 540 | if (IS_FRAC(value)) |
| 541 | { | |
| 542 | assert(region_length != 0); | |
| 542 | 543 | extpoffs[j] = FRAC_OFFSET(value) + region_length * FRAC_NUM(value) / FRAC_DEN(value); |
| 544 | } | |
| 543 | 545 | } |
| 544 | 546 | |
| 545 | 547 | /* loop over all the X/Y offsets, converting fractions */ |
| r4135 | r4136 | |
| 547 | 549 | { |
| 548 | 550 | UINT32 value = extxoffs[j]; |
| 549 | 551 | if (IS_FRAC(value)) |
| 552 | { | |
| 553 | assert(region_length != 0); | |
| 550 | 554 | extxoffs[j] = FRAC_OFFSET(value) + region_length * FRAC_NUM(value) / FRAC_DEN(value); |
| 555 | } | |
| 551 | 556 | } |
| 552 | 557 | |
| 553 | 558 | for (j = 0; j < height; j++) |
| 554 | 559 | { |
| 555 | 560 | UINT32 value = extyoffs[j]; |
| 556 | 561 | if (IS_FRAC(value)) |
| 562 | { | |
| 563 | assert(region_length != 0); | |
| 557 | 564 | extyoffs[j] = FRAC_OFFSET(value) + region_length * FRAC_NUM(value) / FRAC_DEN(value); |
| 565 | } | |
| 558 | 566 | } |
| 559 | 567 | } |
| 560 | 568 | |
| 561 | 569 | /* otherwise, just use the line modulo */ |
| 562 | 570 | else |
| 563 | 571 | { |
| 564 | int base = gfxdecode | |
| 572 | int base = gfxdecode-> | |
| 565 | 573 | int end = region_length/8; |
| 566 | 574 | int linemod = gl->yoffset[0]; |
| 567 | 575 | while (total > 0) |
| r4135 | r4136 | |
| 580 | 588 | glcopy.total = total; |
| 581 | 589 | |
| 582 | 590 | /* allocate the graphics */ |
| 583 | machine->gfx[i] = allocgfx(machine, &glcopy); | |
| 584 | ||
| 585 | /* if we have a remapped colortable, point our local colortable to it */ | |
| 586 | machine->gfx[i]->total_colors = gfxdecodeinfo[i].total_color_codes; | |
| 587 | machine->gfx[i]->color_base = machine->config->gfxdecodeinfo[i].color_codes_start; | |
| 591 | machine->gfx[curgfx] = gfx_element_alloc(machine, &glcopy, (region_base != NULL) ? region_base + gfxdecode->start : NULL, gfxdecode->total_color_codes, gfxdecode->color_codes_start); | |
| 588 | 592 | } |
| 589 | 593 | } |
| 590 | 594 | |
| r4135 | r4136 | |
| 610 | 614 | /* if we have a valid region, decode it now */ |
| 611 | 615 | if (gfxdecodeinfo[i].memory_region != NULL) |
| 612 | 616 | { |
| 613 | UINT8 *region_base = memory_region(machine, gfxdecodeinfo[i].memory_region); | |
| 614 | 617 | gfx_element *gfx = machine->gfx[i]; |
| 615 | 618 | int j; |
| 616 | 619 | |
| r4135 | r4136 | |
| 619 | 622 | { |
| 620 | 623 | char buffer[200]; |
| 621 | 624 | int num_to_decode = (j + 1024 < gfx->total_elements) ? 1024 : (gfx->total_elements - j); |
| 622 | decodegfx(gfx, | |
| 625 | decodegfx(gfx, | |
| 623 | 626 | curgfx += num_to_decode; |
| 624 | 627 | |
| 625 | 628 | /* display some startup text */ |
| r4135 | r4136 | |
| 1275 | 1278 | { |
| 1276 | 1279 | const device_config *screen = param; |
| 1277 | 1280 | realloc_screen_bitmaps(screen); |
| 1281 | global.movie_next_frame_time = timer_get_time(machine); | |
| 1278 | 1282 | } |
| 1279 | 1283 | |
| 1280 | 1284 | |
| r4135 | r4136 | |
| 2727 | 2731 | |
| 2728 | 2732 | |
| 2729 | 2733 | /*************************************************************************** |
| 2734 | DEBUGGING HELPERS | |
| 2735 | ***************************************************************************/ | |
| 2736 | ||
| 2737 | /*------------------------------------------------- | |
| 2738 | video_assert_out_of_range_pixels - assert if | |
| 2739 | any pixels in the given bitmap contain an | |
| 2740 | invalid palette index | |
| 2741 | -------------------------------------------------*/ | |
| 2742 | ||
| 2743 | void video_assert_out_of_range_pixels(running_machine *machine, bitmap_t *bitmap) | |
| 2744 | { | |
| 2745 | #ifdef MAME_DEBUG | |
| 2746 | int maxindex = palette_get_max_index(machine->palette); | |
| 2747 | int x, y; | |
| 2748 | ||
| 2749 | /* this only applies to indexed16 bitmaps */ | |
| 2750 | if (bitmap->format != BITMAP_FORMAT_INDEXED16) | |
| 2751 | return; | |
| 2752 | ||
| 2753 | /* iterate over rows */ | |
| 2754 | for (y = 0; y < bitmap->height; y++) | |
| 2755 | { | |
| 2756 | UINT16 *rowbase = BITMAP_ADDR16(bitmap, y, 0); | |
| 2757 | for (x = 0; x < bitmap->width; x++) | |
| 2758 | assert(rowbase[x] < maxindex); | |
| 2759 | } | |
| 2760 | #endif | |
| 2761 | } | |
| 2762 | ||
| 2763 | ||
| 2764 | ||
| 2765 | /*************************************************************************** | |
| 2730 | 2766 | SOFTWARE RENDERING |
| 2731 | 2767 | ***************************************************************************/ |
| 2732 | 2768 |
| r4135 | r4136 | |
|---|---|---|
| 226 | 226 | void * entryd[MAX_BANK_ENTRIES];/* array of decrypted entries for this bank */ |
| 227 | 227 | }; |
| 228 | 228 | |
| 229 | /* In memory.h: typedef struct _direct_range direct_range; */ | |
| 230 | struct _direct_range | |
| 231 | { | |
| 232 | direct_range * next; /* pointer to the next range in the list */ | |
| 233 | offs_t bytestart; /* starting byte offset of the range */ | |
| 234 | offs_t byteend; /* ending byte offset of the range */ | |
| 235 | }; | |
| 236 | ||
| 229 | 237 | /* In memory.h: typedef struct _handler_data handler_data */ |
| 230 | 238 | struct _handler_data |
| 231 | 239 | { |
| r4135 | r4136 | |
| 331 | 339 | static UINT8 table_assign_handler(const address_space *space, handler_data **table, void *object, genf *handler, const char *handler_name, offs_t bytestart, offs_t byteend, offs_t bytemask); |
| 332 | 340 | static void table_compute_subhandler(handler_data **table, UINT8 entry, read_or_write readorwrite, int spacebits, int spaceendian, int handlerbits, int handlerunitmask); |
| 333 | 341 | static void table_populate_range(address_table *tabledata, offs_t bytestart, offs_t byteend, UINT8 handler); |
| 334 | static void table_populate_range_mirrored(address_table *tabledata, offs_t bytestart, offs_t byteend, offs_t bytemirror, UINT8 handler); | |
| 342 | static void table_populate_range_mirrored(address_space *space, address_table *tabledata, offs_t bytestart, offs_t byteend, offs_t bytemirror, UINT8 handler); | |
| 343 | UINT8 table_derive_range(const address_table *table, offs_t byteaddress, offs_t *bytestart, offs_t *byteend); | |
| 335 | 344 | |
| 336 | 345 | /* subtable management */ |
| 337 | 346 | static UINT8 subtable_alloc(address_table *tabledata); |
| r4135 | r4136 | |
| 341 | 350 | static UINT8 *subtable_open(address_table *tabledata, offs_t l1index); |
| 342 | 351 | static void subtable_close(address_table *tabledata, offs_t l1index); |
| 343 | 352 | |
| 353 | /* direct memory ranges */ | |
| 354 | static direct_range *direct_range_find(address_space *space, offs_t byteaddress, UINT8 *entry); | |
| 355 | static void direct_range_remove_intersecting(address_space *space, offs_t bytestart, offs_t byteend); | |
| 356 | ||
| 344 | 357 | /* memory block allocation */ |
| 345 | 358 | static void *block_allocate(const address_space *space, offs_t bytestart, offs_t byteend, void *memory); |
| 346 | 359 | static address_map_entry *block_assign_intersecting(address_space *space, offs_t bytestart, offs_t byteend, UINT8 *base); |
| r4135 | r4136 | |
| 368 | 381 | INLINE void force_opbase_update(const address_space *space) |
| 369 | 382 | { |
| 370 | 383 | address_space *spacerw = (address_space *)space; |
| 371 | spacerw->direct.max = 0; | |
| 372 | spacerw->direct.min = 1; | |
| 384 | spacerw->direct.byteend = 0; | |
| 385 | spacerw->direct.bytestart = 1; | |
| 373 | 386 | } |
| 374 | 387 | |
| 375 | 388 | |
| r4135 | r4136 | |
| 875 | 888 | address_space *spacerw = (address_space *)space; |
| 876 | 889 | UINT8 *base = NULL, *based = NULL; |
| 877 | 890 | const handler_data *handlers; |
| 891 | direct_range *range; | |
| 892 | offs_t maskedbits; | |
| 878 | 893 | UINT8 entry; |
| 879 | 894 | |
| 880 | 895 | /* allow overrides */ |
| r4135 | r4136 | |
| 885 | 900 | return TRUE; |
| 886 | 901 | } |
| 887 | 902 | |
| 888 | /* perform the lookup */ | |
| 889 | byteaddress &= spacerw->bytemask; | |
| 890 | entry = spacerw->readlookup[LEVEL1_INDEX(byteaddress)]; | |
| 891 | if (entry >= SUBTABLE_BASE) | |
| 892 | entry = spacerw->readlookup[LEVEL2_INDEX(entry,byteaddress)]; | |
| 903 | /* remove the masked bits (we'll put them back later) */ | |
| 904 | maskedbits = byteaddress & ~spacerw->bytemask; | |
| 893 | 905 | |
| 906 | /* find or allocate a matching range */ | |
| 907 | range = direct_range_find(spacerw, byteaddress, &entry); | |
| 908 | ||
| 894 | 909 | /* keep track of current entry */ |
| 895 | 910 | spacerw->direct.entry = entry; |
| 896 | 911 | |
| 897 | /* if we don't map to a bank, | |
| 912 | /* if we don't map to a bank, re | |
| 898 | 913 | if (entry < STATIC_BANK1 || entry >= STATIC_RAM) |
| 899 | 914 | { |
| 900 | /* loop over banks and find a match */ | |
| 901 | for (entry = 1; entry < STATIC_COUNT; entry++) | |
| 902 | { | |
| 903 | bank_info *bank = &memdata->bankdata[entry]; | |
| 904 | if (bank->used && bank_references_space(bank, space) && bank->bytestart < byteaddress && bank->byteend > byteaddress) | |
| 905 | break; | |
| 906 | } | |
| 907 | ||
| 908 | /* if nothing was found, leave everything alone */ | |
| 909 | if (entry == STATIC_COUNT) | |
| 910 | { | |
| 911 | logerror("CPU '%s': warning - attempt to direct-map address %08X in %s space\n", space->cpu->tag, byteaddress, space->name); | |
| 912 | return FALSE; | |
| 913 | } | |
| 915 | /* ensure future updates to land here as well until we get back into a bank */ | |
| 916 | spacerw->direct.byteend = 0; | |
| 917 | spacerw->direct.bytestart = 1; | |
| 918 | logerror("CPU '%s': warning - attempt to direct-map address %08X in %s space\n", space->cpu->tag, byteaddress, space->name); | |
| 919 | return FALSE; | |
| 914 | 920 | } |
| 915 | 921 | |
| 916 | 922 | /* if no decrypted opcodes, point to the same base */ |
| r4135 | r4136 | |
| 921 | 927 | |
| 922 | 928 | /* compute the adjusted base */ |
| 923 | 929 | handlers = spacerw->read.handlers[entry]; |
| 924 | spacerw->direct.mask = handlers->bytemask; | |
| 925 | spacerw->direct.raw = base - (handlers->bytestart & spacerw->direct.mask); | |
| 926 | spacerw->direct.decrypted = based - (handlers->bytestart & spacerw->direct.mask); | |
| 927 | spacerw->direct.min = handlers->bytestart; | |
| 928 | spacerw->direct.max = handlers->byteend; | |
| 930 | spacerw->direct.bytemask = handlers->bytemask; | |
| 931 | spacerw->direct.raw = base - (handlers->bytestart & spacerw->direct.bytemask); | |
| 932 | spacerw->direct.decrypted = based - (handlers->bytestart & spacerw->direct.bytemask); | |
| 933 | spacerw->direct.bytestart = maskedbits | range->bytestart; | |
| 934 | spacerw->direct.byteend = maskedbits | range->byteend; | |
| 929 | 935 | return TRUE; |
| 930 | 936 | } |
| 931 | 937 | |
| r4135 | r4136 | |
| 1546 | 1552 | |
| 1547 | 1553 | /* set the direct access information base */ |
| 1548 | 1554 | space->direct.raw = space->direct.decrypted = NULL; |
| 1549 | space->direct.mask = space->bytemask; | |
| 1550 | space->direct.min = 1; | |
| 1551 | space->direct.max = 0; | |
| 1555 | space->direct.bytemask = space->bytemask; | |
| 1556 | space->direct.bytestart = 1; | |
| 1557 | space->direct.byteend = 0; | |
| 1552 | 1558 | space->direct.entry = STATIC_UNMAP; |
| 1553 | 1559 | space->directupdate = NULL; |
| 1554 | 1560 | |
| r4135 | r4136 | |
| 1898 | 1904 | /* free all the address spaces and tables */ |
| 1899 | 1905 | for (space = (address_space *)memdata->spacelist; space != NULL; space = nextspace) |
| 1900 | 1906 | { |
| 1907 | int entry; | |
| 1908 | ||
| 1901 | 1909 | nextspace = (address_space *)space->next; |
| 1910 | ||
| 1911 | /* free all direct ranges */ | |
| 1912 | for (entry = 0; entry < ARRAY_LENGTH(space->direct.rangelist); entry++) | |
| 1913 | while (space->direct.rangelist[entry] != NULL) | |
| 1914 | { | |
| 1915 | direct_range *range = space->direct.rangelist[entry]; | |
| 1916 | space->direct.rangelist[entry] = range->next; | |
| 1917 | free(range); | |
| 1918 | } | |
| 1919 | ||
| 1920 | /* free the free list of direct ranges */ | |
| 1921 | while (space->direct.freerangelist != NULL) | |
| 1922 | { | |
| 1923 | direct_range *range = space->direct.freerangelist; | |
| 1924 | space->direct.freerangelist = range->next; | |
| 1925 | free(range); | |
| 1926 | } | |
| 1927 | ||
| 1928 | /* free the address map and tables */ | |
| 1902 | 1929 | if (space->map != NULL) |
| 1903 | 1930 | address_map_free(space->map); |
| 1904 | 1931 | if (space->read.table != NULL) |
| 1905 | 1932 | free(space->read.table); |
| 1906 | 1933 | if (space->write.table != NULL) |
| 1907 | 1934 | free(space->write.table); |
| 1935 | ||
| 1908 | 1936 | free(space); |
| 1909 | 1937 | } |
| 1910 | 1938 | } |
| r4135 | r4136 | |
| 2193 | 2221 | table_compute_subhandler(tabledata->handlers, entry, readorwrite, space->dbits, space->endianness, handlerbits, handlerunitmask); |
| 2194 | 2222 | |
| 2195 | 2223 | /* populate it */ |
| 2196 | table_populate_range_mirrored(tabledata, bytestart, byteend, bytemirror, entry); | |
| 2224 | table_populate_range_mirrored(space, tabledata, bytestart, byteend, bytemirror, entry); | |
| 2197 | 2225 | |
| 2198 | 2226 | /* reset read/write pointers if necessary (could have moved due to realloc) */ |
| 2199 | 2227 | if (reset_write) |
| r4135 | r4136 | |
| 2205 | 2233 | if (readorwrite == ROW_READ && entry == space->direct.entry) |
| 2206 | 2234 | { |
| 2207 | 2235 | space->direct.entry = STATIC_UNMAP; |
| 2208 | space->direct.min = 1; | |
| 2209 | space->direct.max = 0; | |
| 2236 | space->direct.bytestart = 1; | |
| 2237 | space->direct.byteend = 0; | |
| 2210 | 2238 | } |
| 2211 | 2239 | } |
| 2212 | 2240 | |
| r4135 | r4136 | |
| 2551 | 2579 | including mirrors |
| 2552 | 2580 | -------------------------------------------------*/ |
| 2553 | 2581 | |
| 2554 | static void table_populate_range_mirrored(address_table *tabledata, offs_t bytestart, offs_t byteend, offs_t bytemirror, UINT8 handler) | |
| 2582 | static void table_populate_range_mirrored(address_space *space, address_table *tabledata, offs_t bytestart, offs_t byteend, offs_t bytemirror, UINT8 handler) | |
| 2555 | 2583 | { |
| 2556 | 2584 | offs_t lmirrorbit[LEVEL2_BITS], lmirrorbits, hmirrorbit[32 - LEVEL2_BITS], hmirrorbits, lmirrorcount, hmirrorcount; |
| 2557 | 2585 | UINT8 prev_entry = STATIC_INVALID; |
| r4135 | r4136 | |
| 2576 | 2604 | if (hmirrorcount & (1 << i)) |
| 2577 | 2605 | hmirrorbase |= hmirrorbit[i]; |
| 2578 | 2606 | |
| 2607 | /* invalidate any intersecting cached ranges */ | |
| 2608 | for (lmirrorcount = 0; lmirrorcount < (1 << lmirrorbits); lmirrorcount++) | |
| 2609 | { | |
| 2610 | /* compute the base of this mirror */ | |
| 2611 | offs_t lmirrorbase = hmirrorbase; | |
| 2612 | for (i = 0; i < lmirrorbits; i++) | |
| 2613 | if (lmirrorcount & (1 << i)) | |
| 2614 | lmirrorbase |= lmirrorbit[i]; | |
| 2615 | direct_range_remove_intersecting(space, bytestart + lmirrorbase, byteend + lmirrorbase); | |
| 2616 | } | |
| 2617 | ||
| 2579 | 2618 | /* if this is not our first time through, and the level 2 entry matches the previous |
| 2580 | 2619 | level 2 entry, just do a quick map and get out; note that this only works for entries |
| 2581 | 2620 | which don't span multiple level 1 table entries */ |
| r4135 | r4136 | |
| 2618 | 2657 | } |
| 2619 | 2658 | |
| 2620 | 2659 | |
| 2660 | /*------------------------------------------------- | |
| 2661 | table_derive_range - look up the entry for | |
| 2662 | a memory range, and then compute the extent | |
| 2663 | of that range based on the lookup tables | |
| 2664 | -------------------------------------------------*/ | |
| 2621 | 2665 | |
| 2666 | UINT8 table_derive_range(const address_table *table, offs_t byteaddress, offs_t *bytestart, offs_t *byteend) | |
| 2667 | { | |
| 2668 | UINT32 curentry, entry, curl1entry, l1entry; | |
| 2669 | const handler_data *handler; | |
| 2670 | offs_t minscan, maxscan; | |
| 2671 | ||
| 2672 | /* look up the initial address to get the entry we care about */ | |
| 2673 | entry = l1entry = table->table[LEVEL1_INDEX(byteaddress)]; | |
| 2674 | if (l1entry >= SUBTABLE_BASE) | |
| 2675 | entry = table->table[LEVEL2_INDEX(l1entry, byteaddress)]; | |
| 2676 | handler = table->handlers[entry]; | |
| 2677 | ||
| 2678 | /* use the bytemask of the entry to set minimum and maximum bounds */ | |
| 2679 | minscan = handler->bytestart | ((byteaddress - handler->bytestart) & ~handler->bytemask); | |
| 2680 | maxscan = handler->byteend | ((byteaddress - handler->bytestart) & ~handler->bytemask); | |
| 2681 | ||
| 2682 | /* first scan backwards to find the start address */ | |
| 2683 | curl1entry = l1entry; | |
| 2684 | curentry = entry; | |
| 2685 | *bytestart = byteaddress; | |
| 2686 | while (1) | |
| 2687 | { | |
| 2688 | /* if we need to scan the subtable, do it */ | |
| 2689 | if (curentry != curl1entry) | |
| 2690 | { | |
| 2691 | UINT32 minindex = LEVEL2_INDEX(curl1entry, 0); | |
| 2692 | UINT32 index; | |
| 2693 | ||
| 2694 | /* scan backwards from the current address, until the previous entry doesn't match */ | |
| 2695 | for (index = LEVEL2_INDEX(curl1entry, *bytestart); index > minindex; index--, *bytestart -= 1) | |
| 2696 | if (table->table[index - 1] != entry) | |
| 2697 | break; | |
| 2698 | ||
| 2699 | /* if we didn't hit the beginning, then we're finished scanning */ | |
| 2700 | if (index != minindex) | |
| 2701 | break; | |
| 2702 | } | |
| 2703 | ||
| 2704 | /* move to the beginning of this L1 entry; stop at the minimum address */ | |
| 2705 | *bytestart &= ~((1 << LEVEL2_BITS) - 1); | |
| 2706 | if (*bytestart <= minscan) | |
| 2707 | break; | |
| 2708 | ||
| 2709 | /* look up the entry of the byte at the end of the previous L1 entry; if it doesn't match, stop */ | |
| 2710 | curentry = curl1entry = table->table[LEVEL1_INDEX(*bytestart - 1)]; | |
| 2711 | if (curl1entry >= SUBTABLE_BASE) | |
| 2712 | curentry = table->table[LEVEL2_INDEX(curl1entry, *bytestart - 1)]; | |
| 2713 | if (curentry != entry) | |
| 2714 | break; | |
| 2715 | ||
| 2716 | /* move into the previous entry and resume searching */ | |
| 2717 | *bytestart -= 1; | |
| 2718 | } | |
| 2719 | ||
| 2720 | /* then scan forwards to find the end address */ | |
| 2721 | curl1entry = l1entry; | |
| 2722 | curentry = entry; | |
| 2723 | *byteend = byteaddress; | |
| 2724 | while (1) | |
| 2725 | { | |
| 2726 | /* if we need to scan the subtable, do it */ | |
| 2727 | if (curentry != curl1entry) | |
| 2728 | { | |
| 2729 | UINT32 maxindex = LEVEL2_INDEX(curl1entry, ~0); | |
| 2730 | UINT32 index; | |
| 2731 | ||
| 2732 | /* scan forwards from the current address, until the next entry doesn't match */ | |
| 2733 | for (index = LEVEL2_INDEX(curl1entry, *byteend); index < maxindex; index++, *byteend += 1) | |
| 2734 | if (table->table[index + 1] != entry) | |
| 2735 | break; | |
| 2736 | ||
| 2737 | /* if we didn't hit the end, then we're finished scanning */ | |
| 2738 | if (index != maxindex) | |
| 2739 | break; | |
| 2740 | } | |
| 2741 | ||
| 2742 | /* move to the end of this L1 entry; stop at the maximum address */ | |
| 2743 | *byteend |= (1 << LEVEL2_BITS) - 1; | |
| 2744 | if (*byteend >= maxscan) | |
| 2745 | break; | |
| 2746 | ||
| 2747 | /* look up the entry of the byte at the start of the next L1 entry; if it doesn't match, stop */ | |
| 2748 | curentry = curl1entry = table->table[LEVEL1_INDEX(*byteend + 1)]; | |
| 2749 | if (curl1entry >= SUBTABLE_BASE) | |
| 2750 | curentry = table->table[LEVEL2_INDEX(curl1entry, *byteend + 1)]; | |
| 2751 | if (curentry != entry) | |
| 2752 | break; | |
| 2753 | ||
| 2754 | /* move into the next entry and resume searching */ | |
| 2755 | *byteend += 1; | |
| 2756 | } | |
| 2757 | ||
| 2758 | return entry; | |
| 2759 | } | |
| 2760 | ||
| 2761 | ||
| 2762 | ||
| 2622 | 2763 | /*************************************************************************** |
| 2623 | 2764 | SUBTABLE MANAGEMENT |
| 2624 | 2765 | ***************************************************************************/ |
| r4135 | r4136 | |
| 2816 | 2957 | |
| 2817 | 2958 | |
| 2818 | 2959 | /*************************************************************************** |
| 2960 | DIRECT MEMORY RANGES | |
| 2961 | ***************************************************************************/ | |
| 2962 | ||
| 2963 | /*------------------------------------------------- | |
| 2964 | direct_range_find - find a byte address in | |
| 2965 | a range | |
| 2966 | -------------------------------------------------*/ | |
| 2967 | ||
| 2968 | static direct_range *direct_range_find(address_space *space, offs_t byteaddress, UINT8 *entry) | |
| 2969 | { | |
| 2970 | direct_range **rangelistptr; | |
| 2971 | direct_range **rangeptr; | |
| 2972 | direct_range *range; | |
| 2973 | ||
| 2974 | /* determine which entry */ | |
| 2975 | byteaddress &= space->bytemask; | |
| 2976 | *entry = space->readlookup[LEVEL1_INDEX(byteaddress)]; | |
| 2977 | if (*entry >= SUBTABLE_BASE) | |
| 2978 | *entry = space->readlookup[LEVEL2_INDEX(*entry, byteaddress)]; | |
| 2979 | rangelistptr = &space->direct.rangelist[*entry]; | |
| 2980 | ||
| 2981 | /* scan our table */ | |
| 2982 | for (rangeptr = rangelistptr; *rangeptr != NULL; rangeptr = &(*rangeptr)->next) | |
| 2983 | if (byteaddress >= (*rangeptr)->bytestart && byteaddress <= (*rangeptr)->byteend) | |
| 2984 | { | |
| 2985 | /* found a match; move us to the head of the list if we're not already there */ | |
| 2986 | range = *rangeptr; | |
| 2987 | if (range != *rangelistptr) | |
| 2988 | { | |
| 2989 | *rangeptr = range->next; | |
| 2990 | range->next = *rangelistptr; | |
| 2991 | *rangelistptr = range; | |
| 2992 | } | |
| 2993 | return range; | |
| 2994 | } | |
| 2995 | ||
| 2996 | /* didn't find out; allocate a new one */ | |
| 2997 | range = space->direct.freerangelist; | |
| 2998 | if (range != NULL) | |
| 2999 | space->direct.freerangelist = range->next; | |
| 3000 | else | |
| 3001 | range = malloc_or_die(sizeof(*range)); | |
| 3002 | ||
| 3003 | /* fill in the range */ | |
| 3004 | table_derive_range(&space->read, byteaddress, &range->bytestart, &range->byteend); | |
| 3005 | range->next = *rangelistptr; | |
| 3006 | *rangelistptr = range; | |
| 3007 | ||
| 3008 | return range; | |
| 3009 | } | |
| 3010 | ||
| 3011 | ||
| 3012 | /*------------------------------------------------- | |
| 3013 | direct_range_remove_intersecting - remove | |
| 3014 | all cached ranges that intersect the given | |
| 3015 | address range | |
| 3016 | -------------------------------------------------*/ | |
| 3017 | ||
| 3018 | static void direct_range_remove_intersecting(address_space *space, offs_t bytestart, offs_t byteend) | |
| 3019 | { | |
| 3020 | int entry; | |
| 3021 | ||
| 3022 | /* loop over all entries */ | |
| 3023 | for (entry = 0; entry < ARRAY_LENGTH(space->read.handlers); entry++) | |
| 3024 | { | |
| 3025 | direct_range **rangeptr, **nextrangeptr; | |
| 3026 | ||
| 3027 | /* loop over all ranges in this entry's list */ | |
| 3028 | for (nextrangeptr = rangeptr = &space->direct.rangelist[entry]; *rangeptr != NULL; rangeptr = nextrangeptr) | |
| 3029 | { | |
| 3030 | /* if we intersect, remove and add to the free range list */ | |
| 3031 | if (bytestart <= (*rangeptr)->byteend && byteend >= (*rangeptr)->bytestart) | |
| 3032 | { | |
| 3033 | direct_range *range = *rangeptr; | |
| 3034 | *rangeptr = range->next; | |
| 3035 | range->next = space->direct.freerangelist; | |
| 3036 | space->direct.freerangelist = range; | |
| 3037 | } | |
| 3038 | ||
| 3039 | /* otherwise advance to the next in the list */ | |
| 3040 | else | |
| 3041 | nextrangeptr = &(*rangeptr)->next; | |
| 3042 | } | |
| 3043 | } | |
| 3044 | } | |
| 3045 | ||
| 3046 | ||
| 3047 | ||
| 3048 | /*************************************************************************** | |
| 2819 | 3049 | MEMORY BLOCK ALLOCATION |
| 2820 | 3050 | ***************************************************************************/ |
| 2821 | 3051 | |
| r4135 | r4136 | |
| 3180 | 3410 | |
| 3181 | 3411 | static void dump_map(FILE *file, const address_space *space, const address_table *table) |
| 3182 | 3412 | { |
| 3183 | int l1count = 1 << LEVEL1_BITS; | |
| 3184 | int l2count = 1 << LEVEL2_BITS; | |
| 3185 | UINT8 lastentry = STATIC_UNMAP; | |
| 3186 | int entrymatches = 0; | |
| 3187 | int i, j; | |
| 3413 | offs_t byteaddress, bytestart, byteend; | |
| 3188 | 3414 | |
| 3189 | 3415 | /* dump generic information */ |
| 3190 | 3416 | fprintf(file, " Address bits = %d\n", space->abits); |
| r4135 | r4136 | |
| 3194 | 3420 | fprintf(file, " Address mask = %X\n", space->bytemask); |
| 3195 | 3421 | fprintf(file, "\n"); |
| 3196 | 3422 | |
| 3197 | /* loop over level 1 entries */ | |
| 3198 | for (i = 0; i < l1count; i++) | |
| 3423 | /* iterate over addresses */ | |
| 3424 | for (byteaddress = 0; byteaddress <= space->bytemask; byteaddress = byteend + 1) | |
| 3199 | 3425 | { |
| 3200 | UINT8 entry = table->table[i]; | |
| 3201 | ||
| 3202 | /* if this entry matches the previous one, just count it */ | |
| 3203 | if (entry < SUBTABLE_BASE && entry == lastentry) | |
| 3204 | { | |
| 3205 | entrymatches++; | |
| 3206 | continue; | |
| 3207 | } | |
| 3208 | ||
| 3209 | /* otherwise, print accumulated info */ | |
| 3210 | if (lastentry < SUBTABLE_BASE && lastentry != STATIC_UNMAP) | |
| 3211 | fprintf(file, "%08X-%08X = %02X: %s [offset=%08X]\n", | |
| 3212 | (i - entrymatches) << LEVEL2_BITS, | |
| 3213 | (i << LEVEL2_BITS) - 1, | |
| 3214 | lastentry, | |
| 3215 | handler_to_string(table, lastentry), | |
| 3216 | table->handlers[lastentry]->bytestart); | |
| 3217 | ||
| 3218 | /* start counting with this entry */ | |
| 3219 | lastentry = entry; | |
| 3220 | entrymatches = 1; | |
| 3221 | ||
| 3222 | /* if we're a subtable, we need to drill down */ | |
| 3223 | if (entry >= SUBTABLE_BASE) | |
| 3224 | { | |
| 3225 | UINT8 lastentry2 = STATIC_UNMAP; | |
| 3226 | int entry2matches = 0; | |
| 3227 | ||
| 3228 | /* loop over level 2 entries */ | |
| 3229 | entry -= SUBTABLE_BASE; | |
| 3230 | for (j = 0; j < l2count; j++) | |
| 3231 | { | |
| 3232 | UINT8 entry2 = table->table[(1 << LEVEL1_BITS) + (entry << LEVEL2_BITS) + j]; | |
| 3233 | ||
| 3234 | /* if this entry matches the previous one, just count it */ | |
| 3235 | if (entry2 < SUBTABLE_BASE && entry2 == lastentry2) | |
| 3236 | { | |
| 3237 | entry2matches++; | |
| 3238 | continue; | |
| 3239 | } | |
| 3240 | ||
| 3241 | /* otherwise, print accumulated info */ | |
| 3242 | if (lastentry2 < SUBTABLE_BASE && lastentry2 != STATIC_UNMAP) | |
| 3243 | fprintf(file, "%08X-%08X = %02X: %s [offset=%08X]\n", | |
| 3244 | ((i << LEVEL2_BITS) | (j - entry2matches)), | |
| 3245 | ((i << LEVEL2_BITS) | (j - 1)), | |
| 3246 | lastentry2, | |
| 3247 | handler_to_string(table, lastentry2), | |
| 3248 | table->handlers[lastentry2]->bytestart); | |
| 3249 | ||
| 3250 | /* start counting with this entry */ | |
| 3251 | lastentry2 = entry2; | |
| 3252 | entry2matches = 1; | |
| 3253 | } | |
| 3254 | ||
| 3255 | /* flush the last entry */ | |
| 3256 | if (lastentry2 < SUBTABLE_BASE && lastentry2 != STATIC_UNMAP) | |
| 3257 | fprintf(file, "%08X-%08X = %02X: %s [offset=%08X]\n", | |
| 3258 | ((i << LEVEL2_BITS) | (j - entry2matches)), | |
| 3259 | ((i << LEVEL2_BITS) | (j - 1)), | |
| 3260 | lastentry2, | |
| 3261 | handler_to_string(table, lastentry2), | |
| 3262 | table->handlers[lastentry2]->bytestart); | |
| 3263 | } | |
| 3426 | UINT8 entry = table_derive_range(table, byteaddress, &bytestart, &byteend); | |
| 3427 | fprintf(file, "%08X-%08X = %02X: %s [offset=%08X]\n", | |
| 3428 | bytestart, byteend, entry, handler_to_string(table, entry), table->handlers[entry]->bytestart); | |
| 3264 | 3429 | } |
| 3265 | ||
| 3266 | /* flush the last entry */ | |
| 3267 | if (lastentry < SUBTABLE_BASE && lastentry != STATIC_UNMAP) | |
| 3268 | fprintf(file, "%08X-%08X = %02X: %s [offset=%08X]\n", | |
| 3269 | (i - entrymatches) << LEVEL2_BITS, | |
| 3270 | (i << LEVEL2_BITS) - 1, | |
| 3271 | lastentry, | |
| 3272 | handler_to_string(table, lastentry), | |
| 3273 | table->handlers[lastentry]->bytestart); | |
| 3274 | 3430 | } |
| 3275 | 3431 | |
| 3276 | 3432 |
| r4135 | r4136 | |
|---|---|---|
| 278 | 278 | /* select a view for a given target */ |
| 279 | 279 | int video_get_view_for_target(running_machine *machine, render_target *target, const char *viewname, int targetindex, int numtargets); |
| 280 | 280 | |
| 281 | ||
| 282 | /* ----- debugging helpers ----- */ | |
| 283 | ||
| 284 | /* assert if any pixels in the given bitmap contain an invalid palette index */ | |
| 285 | void video_assert_out_of_range_pixels(running_machine *machine, bitmap_t *bitmap); | |
| 286 | ||
| 287 | ||
| 281 | 288 | #endif /* __VIDEO_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 111 | 111 | $(EMUMACHINE)/6522via.o \ |
| 112 | 112 | $(EMUMACHINE)/6526cia.o \ |
| 113 | 113 | $(EMUMACHINE)/6821pia.o \ |
| 114 | $(EMUMACHINE)/6821new.o \ | |
| 114 | 115 | $(EMUMACHINE)/6840ptm.o \ |
| 115 | 116 | $(EMUMACHINE)/6850acia.o \ |
| 116 | 117 | $(EMUMACHINE)/68681.o \ |
| r4135 | r4136 | |
|---|---|---|
| 88 | 88 | typedef struct _handler_data handler_data; |
| 89 | 89 | typedef struct _subtable_data subtable_data; |
| 90 | 90 | |
| 91 | /* direct_range is an opaque type used to track ranges for direct access */ | |
| 92 | typedef struct _direct_range direct_range; | |
| 91 | 93 | |
| 92 | 94 | /* forward-declare the address_space structure */ |
| 93 | 95 | typedef struct _address_space address_space; |
| r4135 | r4136 | |
| 103 | 105 | { |
| 104 | 106 | UINT8 * raw; /* direct access data pointer (raw) */ |
| 105 | 107 | UINT8 * decrypted; /* direct access data pointer (decrypted) */ |
| 106 | offs_t mask; /* address mask */ | |
| 107 | offs_t min; /* minimum valid address */ | |
| 108 | offs_t max; /* maximum valid address */ | |
| 108 | offs_t bytemask; /* byte address mask */ | |
| 109 | offs_t bytestart; /* minimum valid byte address */ | |
| 110 | offs_t byteend; /* maximum valid byte address */ | |
| 109 | 111 | UINT8 entry; /* live entry */ |
| 112 | direct_range * rangelist[256]; /* list of ranges for each entry */ | |
| 113 | direct_range * freerangelist; /* list of recycled range entries */ | |
| 110 | 114 | }; |
| 111 | 115 | |
| 112 | 116 | |
| r4135 | r4136 | |
| 445 | 449 | #define SMH_ROM ((void *)STATIC_ROM) |
| 446 | 450 | #define SMH_NOP ((void *)STATIC_NOP) |
| 447 | 451 | #define SMH_UNMAP ((void *)STATIC_UNMAP) |
| 448 | #define SMH_BANK(n) ((void *)(STATIC_BANK1 + ( | |
| 452 | #define SMH_BANK(n) ((void *)(STATIC_BANK1 + ( | |
| 449 | 453 | #define SMH_BANK1 SMH_BANK(1) |
| 450 | 454 | #define SMH_BANK2 SMH_BANK(2) |
| 451 | 455 | #define SMH_BANK3 SMH_BANK(3) |
| r4135 | r4136 | |
| 502 | 506 | |
| 503 | 507 | |
| 504 | 508 | /* opcode range safety check */ |
| 505 | #define address_ | |
| 509 | #define memory_address_o | |
| 506 | 510 | |
| 507 | 511 | |
| 508 | 512 | /* wrappers for dynamic read handler installation */ |
| r4135 | r4136 | |
| 1108 | 1112 | |
| 1109 | 1113 | INLINE void *memory_decrypted_read_ptr(const address_space *space, offs_t byteaddress) |
| 1110 | 1114 | { |
| 1111 | if (!address_is_unsafe(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1112 | return &space->direct.decrypted[byteaddress & space->direct.mask]; | |
| 1115 | if (!memory_address_outside_direct_region(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1116 | return &space->direct.decrypted[byteaddress & space->direct.bytemask]; | |
| 1113 | 1117 | return NULL; |
| 1114 | 1118 | } |
| 1115 | 1119 | |
| 1116 | 1120 | INLINE UINT8 memory_decrypted_read_byte(const address_space *space, offs_t byteaddress) |
| 1117 | 1121 | { |
| 1118 | if (!address_is_unsafe(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1119 | return space->direct.decrypted[byteaddress & space->direct.mask]; | |
| 1122 | if (!memory_address_outside_direct_region(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1123 | return space->direct.decrypted[byteaddress & space->direct.bytemask]; | |
| 1120 | 1124 | return memory_read_byte(space, byteaddress); |
| 1121 | 1125 | } |
| 1122 | 1126 | |
| 1123 | 1127 | INLINE UINT16 memory_decrypted_read_word(const address_space *space, offs_t byteaddress) |
| 1124 | 1128 | { |
| 1125 | if (!address_is_unsafe(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1126 | return *(UINT16 *)&space->direct.decrypted[byteaddress & space->direct.mask]; | |
| 1129 | if (!memory_address_outside_direct_region(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1130 | return *(UINT16 *)&space->direct.decrypted[byteaddress & space->direct.bytemask]; | |
| 1127 | 1131 | return memory_read_word(space, byteaddress); |
| 1128 | 1132 | } |
| 1129 | 1133 | |
| 1130 | 1134 | INLINE UINT32 memory_decrypted_read_dword(const address_space *space, offs_t byteaddress) |
| 1131 | 1135 | { |
| 1132 | if (!address_is_unsafe(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1133 | return *(UINT32 *)&space->direct.decrypted[byteaddress & space->direct.mask]; | |
| 1136 | if (!memory_address_outside_direct_region(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1137 | return *(UINT32 *)&space->direct.decrypted[byteaddress & space->direct.bytemask]; | |
| 1134 | 1138 | return memory_read_dword(space, byteaddress); |
| 1135 | 1139 | } |
| 1136 | 1140 | |
| 1137 | 1141 | INLINE UINT64 memory_decrypted_read_qword(const address_space *space, offs_t byteaddress) |
| 1138 | 1142 | { |
| 1139 | if (!address_is_unsafe(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1140 | return *(UINT64 *)&space->direct.decrypted[byteaddress & space->direct.mask]; | |
| 1143 | if (!memory_address_outside_direct_region(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1144 | return *(UINT64 *)&space->direct.decrypted[byteaddress & space->direct.bytemask]; | |
| 1141 | 1145 | return memory_read_qword(space, byteaddress); |
| 1142 | 1146 | } |
| 1143 | 1147 | |
| r4135 | r4136 | |
| 1151 | 1155 | |
| 1152 | 1156 | INLINE void *memory_raw_read_ptr(const address_space *space, offs_t byteaddress) |
| 1153 | 1157 | { |
| 1154 | if (!address_is_unsafe(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1155 | return &space->direct.raw[byteaddress & space->direct.mask]; | |
| 1158 | if (!memory_address_outside_direct_region(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1159 | return &space->direct.raw[byteaddress & space->direct.bytemask]; | |
| 1156 | 1160 | return NULL; |
| 1157 | 1161 | } |
| 1158 | 1162 | |
| 1159 | 1163 | INLINE UINT8 memory_raw_read_byte(const address_space *space, offs_t byteaddress) |
| 1160 | 1164 | { |
| 1161 | if (!address_is_unsafe(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1162 | return space->direct.raw[byteaddress & space->direct.mask]; | |
| 1165 | if (!memory_address_outside_direct_region(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1166 | return space->direct.raw[byteaddress & space->direct.bytemask]; | |
| 1163 | 1167 | return memory_read_byte(space, byteaddress); |
| 1164 | 1168 | } |
| 1165 | 1169 | |
| 1166 | 1170 | INLINE UINT16 memory_raw_read_word(const address_space *space, offs_t byteaddress) |
| 1167 | 1171 | { |
| 1168 | if (!address_is_unsafe(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1169 | return *(UINT16 *)&space->direct.raw[byteaddress & space->direct.mask]; | |
| 1172 | if (!memory_address_outside_direct_region(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1173 | return *(UINT16 *)&space->direct.raw[byteaddress & space->direct.bytemask]; | |
| 1170 | 1174 | return memory_read_word(space, byteaddress); |
| 1171 | 1175 | } |
| 1172 | 1176 | |
| 1173 | 1177 | INLINE UINT32 memory_raw_read_dword(const address_space *space, offs_t byteaddress) |
| 1174 | 1178 | { |
| 1175 | if (!address_is_unsafe(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1176 | return *(UINT32 *)&space->direct.raw[byteaddress & space->direct.mask]; | |
| 1179 | if (!memory_address_outside_direct_region(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1180 | return *(UINT32 *)&space->direct.raw[byteaddress & space->direct.bytemask]; | |
| 1177 | 1181 | return memory_read_dword(space, byteaddress); |
| 1178 | 1182 | } |
| 1179 | 1183 | |
| 1180 | 1184 | INLINE UINT64 memory_raw_read_qword(const address_space *space, offs_t byteaddress) |
| 1181 | 1185 | { |
| 1182 | if (!address_is_unsafe(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1183 | return *(UINT64 *)&space->direct.raw[byteaddress & space->direct.mask]; | |
| 1186 | if (!memory_address_outside_direct_region(space, byteaddress) || memory_set_direct_region(space, byteaddress)) | |
| 1187 | return *(UINT64 *)&space->direct.raw[byteaddress & space->direct.bytemask]; | |
| 1184 | 1188 | return memory_read_qword(space, byteaddress); |
| 1185 | 1189 | } |
| 1186 | 1190 |
| r4135 | r4136 | |
|---|---|---|
| 32 | 32 | - calls output_init() [output.c] to initialize the output system |
| 33 | 33 | - calls state_init() [state.c] to initialize save state system |
| 34 | 34 | - calls state_save_allow_registration() [state.c] to allow registrations |
| 35 | - calls drawgfx_init() [drawgfx.c] to initialize rendering globals | |
| 36 | 35 | - calls palette_init() [palette.c] to initialize palette system |
| 37 | 36 | - calls render_init() [render.c] to initialize the rendering system |
| 38 | 37 | - calls ui_init() [ui.c] to initialize the user interface |
| r4135 | r4136 | |
| 1478 | 1477 | output_init(machine); |
| 1479 | 1478 | state_init(machine); |
| 1480 | 1479 | state_save_allow_registration(machine, TRUE); |
| 1481 | drawgfx_init(machine); | |
| 1482 | 1480 | palette_init(machine); |
| 1483 | 1481 | render_init(machine); |
| 1484 | 1482 | ui_init(machine); |
| r4135 | r4136 | |
| 1559 | 1557 | |
| 1560 | 1558 | /* free memory regions allocated with REGIONFLAG_DISPOSE (typically gfx roms) */ |
| 1561 | 1559 | /* but not if the debugger is enabled (so we can look at the data) */ |
| 1562 | if (!options_get_bool(mame_options(), OPTION_DEBUG)) | |
| 1560 | if (PREDECODE_GFX && !options_get_bool(mame_options(), OPTION_DEBUG)) | |
| 1563 | 1561 | for (rgntag = memory_region_next(machine, NULL); rgntag != NULL; rgntag = nextrgntag) |
| 1564 | 1562 | { |
| 1565 | 1563 | nextrgntag = memory_region_next(machine, rgntag); |
| r4135 | r4136 | |
|---|---|---|
| 122 | 122 | assert_always((which >= 0) && (which < MAX_PIA), "pia_config called on an invalid PIA!"); |
| 123 | 123 | assert_always(intf, "pia_config called with an invalid interface!"); |
| 124 | 124 | |
| 125 | { | |
| 126 | /* NPW 5-Jan-2009 - Multisession hack */ | |
| 127 | int i; | |
| 128 | for (i = 0; i < ARRAY_LENGTH(pias); i++) | |
| 129 | { | |
| 130 | if ((pias[i].machine != NULL) && (pias[i].machine != machine)) | |
| 131 | memset(&pias[i], 0, sizeof(pias[i])); | |
| 132 | } | |
| 133 | } | |
| 134 | ||
| 135 | 125 | p = &pias[which]; |
| 136 | 126 | memset(p, 0, sizeof(pias[0])); |
| 137 | 127 |
| r0 | r4136 | |
|---|---|---|
| 1 | /********************************************************************** | |
| 2 | ||
| 3 | Motorola 6821 PIA interface and emulation | |
| 4 | ||
| 5 | **********************************************************************/ | |
| 6 | ||
| 7 | #include "6821new.h" | |
| 8 | ||
| 9 | ||
| 10 | /*************************************************************************** | |
| 11 | TYPE DEFINITIONS | |
| 12 | ***************************************************************************/ | |
| 13 | ||
| 14 | typedef struct _pia6821 pia6821; | |
| 15 | struct _pia6821 | |
| 16 | { | |
| 17 | UINT8 in_a; | |
| 18 | UINT8 in_ca1; | |
| 19 | UINT8 in_ca2; | |
| 20 | UINT8 out_a; | |
| 21 | UINT8 out_ca2; | |
| 22 | UINT8 port_a_z_mask; | |
| 23 | UINT8 ddr_a; | |
| 24 | UINT8 ctl_a; | |
| 25 | UINT8 irq_a1; | |
| 26 | UINT8 irq_a2; | |
| 27 | UINT8 irq_a_state; | |
| 28 | ||
| 29 | UINT8 in_b; | |
| 30 | UINT8 in_cb1; | |
| 31 | UINT8 in_cb2; | |
| 32 | UINT8 out_b; | |
| 33 | UINT8 out_cb2; | |
| 34 | UINT8 last_out_cb2_z; | |
| 35 | UINT8 ddr_b; | |
| 36 | UINT8 ctl_b; | |
| 37 | UINT8 irq_b1; | |
| 38 | UINT8 irq_b2; | |
| 39 | UINT8 irq_b_state; | |
| 40 | ||
| 41 | /* variables that indicate if access a line externally - | |
| 42 | used to for logging purposes ONLY */ | |
| 43 | UINT8 in_a_pushed; | |
| 44 | UINT8 out_a_needs_pulled; | |
| 45 | UINT8 in_ca1_pushed; | |
| 46 | UINT8 in_ca2_pushed; | |
| 47 | UINT8 out_ca2_needs_pulled; | |
| 48 | UINT8 in_b_pushed; | |
| 49 | UINT8 out_b_needs_pulled; | |
| 50 | UINT8 in_cb1_pushed; | |
| 51 | UINT8 in_cb2_pushed; | |
| 52 | UINT8 out_cb2_needs_pulled; | |
| 53 | UINT8 logged_port_a_not_connected; | |
| 54 | UINT8 logged_port_b_not_connected; | |
| 55 | UINT8 logged_ca1_not_connected; | |
| 56 | UINT8 logged_ca2_not_connected; | |
| 57 | UINT8 logged_cb1_not_connected; | |
| 58 | UINT8 logged_cb2_not_connected; | |
| 59 | }; | |
| 60 | ||
| 61 | ||
| 62 | /*************************************************************************** | |
| 63 | MACROS | |
| 64 | ***************************************************************************/ | |
| 65 | ||
| 66 | #define VERBOSE 0 | |
| 67 | ||
| 68 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) | |
| 69 | ||
| 70 | #define PIA_IRQ1 (0x80) | |
| 71 | #define PIA_IRQ2 (0x40) | |
| 72 | ||
| 73 | #define IRQ1_ENABLED(c) ( (((c) >> 0) & 0x01)) | |
| 74 | #define C1_LOW_TO_HIGH(c) ( (((c) >> 1) & 0x01)) | |
| 75 | #define C1_HIGH_TO_LOW(c) (!(((c) >> 1) & 0x01)) | |
| 76 | #define OUTPUT_SELECTED(c) ( (((c) >> 2) & 0x01)) | |
| 77 | #define IRQ2_ENABLED(c) ( (((c) >> 3) & 0x01)) | |
| 78 | #define STROBE_E_RESET(c) ( (((c) >> 3) & 0x01)) | |
| 79 | #define STROBE_C1_RESET(c) (!(((c) >> 3) & 0x01)) | |
| 80 | #define C2_SET(c) ( (((c) >> 3) & 0x01)) | |
| 81 | #define C2_LOW_TO_HIGH(c) ( (((c) >> 4) & 0x01)) | |
| 82 | #define C2_HIGH_TO_LOW(c) (!(((c) >> 4) & 0x01)) | |
| 83 | #define C2_SET_MODE(c) ( (((c) >> 4) & 0x01)) | |
| 84 | #define C2_STROBE_MODE(c) (!(((c) >> 4) & 0x01)) | |
| 85 | #define C2_OUTPUT(c) ( (((c) >> 5) & 0x01)) | |
| 86 | #define C2_INPUT(c) (!(((c) >> 5) & 0x01)) | |
| 87 | ||
| 88 | ||
| 89 | /*************************************************************************** | |
| 90 | PROTOTYPES | |
| 91 | ***************************************************************************/ | |
| 92 | /*************************************************************************** | |
| 93 | INLINE FUNCTIONS | |
| 94 | ***************************************************************************/ | |
| 95 | ||
| 96 | INLINE pia6821 *get_token(const device_config *device) | |
| 97 | { | |
| 98 | assert(device != NULL); | |
| 99 | assert((device->type == PIA6821) || (device->type == PIA6822)); | |
| 100 | return (pia6821 *) device->token; | |
| 101 | } | |
| 102 | ||
| 103 | ||
| 104 | INLINE const pia6821_interface *get_interface(const device_config *device) | |
| 105 | { | |
| 106 | assert(device != NULL); | |
| 107 | assert((device->type == PIA6821) || (device->type == PIA6822)); | |
| 108 | return (const pia6821_interface *) device->static_config; | |
| 109 | } | |
| 110 | ||
| 111 | ||
| 112 | /*************************************************************************** | |
| 113 | IMPLEMENTATION | |
| 114 | ***************************************************************************/ | |
| 115 | ||
| 116 | /*------------------------------------------------- | |
| 117 | DEVICE_START( pia ) | |
| 118 | -------------------------------------------------*/ | |
| 119 | ||
| 120 | static DEVICE_START( pia ) | |
| 121 | { | |
| 122 | pia6821 *p = get_token(device); | |
| 123 | memset(p, 0, sizeof(*p)); | |
| 124 | ||
| 125 | state_save_register_device_item(device, 0, p->in_a); | |
| 126 | state_save_register_device_item(device, 0, p->in_ca1); | |
| 127 | state_save_register_device_item(device, 0, p->in_ca2); | |
| 128 | state_save_register_device_item(device, 0, p->out_a); | |
| 129 | state_save_register_device_item(device, 0, p->out_ca2); | |
| 130 | state_save_register_device_item(device, 0, p->port_a_z_mask); | |
| 131 | state_save_register_device_item(device, 0, p->ddr_a); | |
| 132 | state_save_register_device_item(device, 0, p->ctl_a); | |
| 133 | state_save_register_device_item(device, 0, p->irq_a1); | |
| 134 | state_save_register_device_item(device, 0, p->irq_a2); | |
| 135 | state_save_register_device_item(device, 0, p->irq_a_state); | |
| 136 | state_save_register_device_item(device, 0, p->in_b); | |
| 137 | state_save_register_device_item(device, 0, p->in_cb1); | |
| 138 | state_save_register_device_item(device, 0, p->in_cb2); | |
| 139 | state_save_register_device_item(device, 0, p->out_b); | |
| 140 | state_save_register_device_item(device, 0, p->out_cb2); | |
| 141 | state_save_register_device_item(device, 0, p->last_out_cb2_z); | |
| 142 | state_save_register_device_item(device, 0, p->ddr_b); | |
| 143 | state_save_register_device_item(device, 0, p->ctl_b); | |
| 144 | state_save_register_device_item(device, 0, p->irq_b1); | |
| 145 | state_save_register_device_item(device, 0, p->irq_b2); | |
| 146 | state_save_register_device_item(device, 0, p->irq_b_state); | |
| 147 | state_save_register_device_item(device, 0, p->in_a_pushed); | |
| 148 | state_save_register_device_item(device, 0, p->out_a_needs_pulled); | |
| 149 | state_save_register_device_item(device, 0, p->in_ca1_pushed); | |
| 150 | state_save_register_device_item(device, 0, p->in_ca2_pushed); | |
| 151 | state_save_register_device_item(device, 0, p->out_ca2_needs_pulled); | |
| 152 | state_save_register_device_item(device, 0, p->in_b_pushed); | |
| 153 | state_save_register_device_item(device, 0, p->out_b_needs_pulled); | |
| 154 | state_save_register_device_item(device, 0, p->in_cb1_pushed); | |
| 155 | state_save_register_device_item(device, 0, p->in_cb2_pushed); | |
| 156 | state_save_register_device_item(device, 0, p->out_cb2_needs_pulled); | |
| 157 | ||
| 158 | return DEVICE_START_OK; | |
| 159 | } | |
| 160 | ||
| 161 | ||
| 162 | /*------------------------------------------------- | |
| 163 | DEVICE_RESET( pia ) | |
| 164 | -------------------------------------------------*/ | |
| 165 | ||
| 166 | static DEVICE_RESET( pia ) | |
| 167 | { | |
| 168 | pia6821 *p = get_token(device); | |
| 169 | const pia6821_interface *intf = get_interface(device); | |
| 170 | ||
| 171 | memset(p, 0, sizeof(*p)); | |
| 172 | ||
| 173 | /* | |
| 174 | * set default read values. | |
| 175 | * | |
| 176 | * ports A,CA1,CA2 default to 1 | |
| 177 | * ports B,CB1,CB2 are three-state and undefined (set to 0) | |
| 178 | */ | |
| 179 | p->in_a = 0xff; | |
| 180 | p->in_ca1 = TRUE; | |
| 181 | p->in_ca2 = TRUE; | |
| 182 | ||
| 183 | /* clear the IRQs */ | |
| 184 | if (intf->irq_a_func) (*intf->irq_a_func)(device, FALSE); | |
| 185 | if (intf->irq_b_func) (*intf->irq_b_func)(device, FALSE); | |
| 186 | } | |
| 187 | ||
| 188 | ||
| 189 | /*------------------------------------------------- | |
| 190 | update_interrupts | |
| 191 | -------------------------------------------------*/ | |
| 192 | ||
| 193 | static void update_interrupts(const device_config *device) | |
| 194 | { | |
| 195 | pia6821 *p = get_token(device); | |
| 196 | const pia6821_interface *intf = get_interface(device); | |
| 197 | int new_state; | |
| 198 | ||
| 199 | /* start with IRQ A */ | |
| 200 | new_state = (p->irq_a1 && IRQ1_ENABLED(p->ctl_a)) || (p->irq_a2 && IRQ2_ENABLED(p->ctl_a)); | |
| 201 | ||
| 202 | if (new_state != p->irq_a_state) | |
| 203 | { | |
| 204 | p->irq_a_state = new_state; | |
| 205 | ||
| 206 | if (intf->irq_a_func) | |
| 207 | (*intf->irq_a_func)(device, p->irq_a_state); | |
| 208 | } | |
| 209 | ||
| 210 | /* then do IRQ B */ | |
| 211 | new_state = (p->irq_b1 && IRQ1_ENABLED(p->ctl_b)) || (p->irq_b2 && IRQ2_ENABLED(p->ctl_b)); | |
| 212 | ||
| 213 | if (new_state != p->irq_b_state) | |
| 214 | { | |
| 215 | p->irq_b_state = new_state; | |
| 216 | ||
| 217 | if (intf->irq_b_func) | |
| 218 | (*intf->irq_b_func)(device, p->irq_b_state); | |
| 219 | } | |
| 220 | } | |
| 221 | ||
| 222 | ||
| 223 | /*------------------------------------------------- | |
| 224 | get_in_a_value | |
| 225 | -------------------------------------------------*/ | |
| 226 | ||
| 227 | static UINT8 get_in_a_value(const device_config *device) | |
| 228 | { | |
| 229 | pia6821 *p = get_token(device); | |
| 230 | const pia6821_interface *intf = get_interface(device); | |
| 231 | UINT8 port_a_data = 0; | |
| 232 | UINT8 ret; | |
| 233 | ||
| 234 | /* update the input */ | |
| 235 | if (intf->in_a_func) | |
| 236 | port_a_data = (*intf->in_a_func)(device, 0); | |
| 237 | else | |
| 238 | { | |
| 239 | if (p->in_a_pushed) | |
| 240 | port_a_data = p->in_a; | |
| 241 | else | |
| 242 | { | |
| 243 | /* mark all pins disconnected */ | |
| 244 | p->port_a_z_mask = 0xff; | |
| 245 | ||
| 246 | if (!p->logged_port_a_not_connected && (p->ddr_a != 0xff)) | |
| 247 | { | |
| 248 | logerror("PIA #%s: Warning! No port A read handler. Assuming pins 0x%02X not connected\n", device->tag, p->ddr_a ^ 0xff); | |
| 249 | p->logged_port_a_not_connected = TRUE; | |
| 250 | } | |
| 251 | } | |
| 252 | } | |
| 253 | ||
| 254 | /* - connected pins are always read | |
| 255 | - disconnected pins read the output buffer in output mode | |
| 256 | - disconnected pins are HI in input mode */ | |
| 257 | ret = (~p->port_a_z_mask & port_a_data) | | |
| 258 | ( p->port_a_z_mask & p->ddr_a & p->out_a) | | |
| 259 | ( p->port_a_z_mask & ~p->ddr_a); | |
| 260 | ||
| 261 | return ret; | |
| 262 | } | |
| 263 | ||
| 264 | ||
| 265 | /*------------------------------------------------- | |
| 266 | get_in_b_value | |
| 267 | -------------------------------------------------*/ | |
| 268 | ||
| 269 | static UINT8 get_in_b_value(const device_config *device) | |
| 270 | { | |
| 271 | pia6821 *p = get_token(device); | |
| 272 | const pia6821_interface *intf = get_interface(device); | |
| 273 | UINT8 ret; | |
| 274 | ||
| 275 | if (p->ddr_b == 0xff) | |
| 276 | /* all output, just return buffer */ | |
| 277 | ret = p->out_b; | |
| 278 | else | |
| 279 | { | |
| 280 | UINT8 port_b_data; | |
| 281 | ||
| 282 | /* update the input */ | |
| 283 | if (intf->in_b_func) | |
| 284 | port_b_data = (*intf->in_b_func)(device, 0); | |
| 285 | else | |
| 286 | { | |
| 287 | if (p->in_b_pushed) | |
| 288 | port_b_data = p->in_b; | |
| 289 | else | |
| 290 | { | |
| 291 | if (!p->logged_port_b_not_connected && (p->ddr_b != 0xff)) | |
| 292 | { | |
| 293 | logerror("PIA #%s: Error! No port B read handler. Three-state pins 0x%02X are undefined\n", device->tag, p->ddr_b ^ 0xff); | |
| 294 | p->logged_port_b_not_connected = TRUE; | |
| 295 | } | |
| 296 | ||
| 297 | /* undefined -- need to return something */ | |
| 298 | port_b_data = 0x00; | |
| 299 | } | |
| 300 | } | |
| 301 | ||
| 302 | /* the DDR determines if the pin or the output buffer is read */ | |
| 303 | ret = (p->out_b & p->ddr_b) | (port_b_data & ~p->ddr_b); | |
| 304 | } | |
| 305 | ||
| 306 | return ret; | |
| 307 | } | |
| 308 | ||
| 309 | ||
| 310 | /*------------------------------------------------- | |
| 311 | get_out_a_value | |
| 312 | -------------------------------------------------*/ | |
| 313 | ||
| 314 | static UINT8 get_out_a_value(const device_config *device) | |
| 315 | { | |
| 316 | pia6821 *p = get_token(device); | |
| 317 | UINT8 ret; | |
| 318 | ||
| 319 | if (p->ddr_a == 0xff) | |
| 320 | /* all output */ | |
| 321 | ret = p->out_a; | |
| 322 | else | |
| 323 | /* input pins don't change */ | |
| 324 | ret = (p->out_a & p->ddr_a) | (get_in_a_value(device) & ~p->ddr_a); | |
| 325 | ||
| 326 | return ret; | |
| 327 | } | |
| 328 | ||
| 329 | ||
| 330 | /*------------------------------------------------- | |
| 331 | get_out_b_value | |
| 332 | -------------------------------------------------*/ | |
| 333 | ||
| 334 | static UINT8 get_out_b_value(const device_config *device) | |
| 335 | { | |
| 336 | pia6821 *p = get_token(device); | |
| 337 | ||
| 338 | /* input pins are high-impedance - we just send them as zeros for backwards compatibility */ | |
| 339 | return p->out_b & p->ddr_b; | |
| 340 | } | |
| 341 | ||
| 342 | ||
| 343 | /*------------------------------------------------- | |
| 344 | set_out_ca2 | |
| 345 | -------------------------------------------------*/ | |
| 346 | ||
| 347 | static void set_out_ca2(const device_config *device, int data) | |
| 348 | { | |
| 349 | pia6821 *p = get_token(device); | |
| 350 | const pia6821_interface *intf = get_interface(device); | |
| 351 | ||
| 352 | if (data != p->out_ca2) | |
| 353 | { | |
| 354 | p->out_ca2 = data; | |
| 355 | ||
| 356 | /* send to output function */ | |
| 357 | if (intf->out_ca2_func) | |
| 358 | (*intf->out_ca2_func)(device, 0, p->out_ca2); | |
| 359 | else | |
| 360 | { | |
| 361 | if (p->out_ca2_needs_pulled) | |
| 362 | logerror("PIA #%s: Warning! No port CA2 write handler. Previous value has been lost!\n", device->tag); | |
| 363 | ||
| 364 | p->out_ca2_needs_pulled = TRUE; | |
| 365 | } | |
| 366 | } | |
| 367 | } | |
| 368 | ||
| 369 | ||
| 370 | /*------------------------------------------------- | |
| 371 | set_out_cb2 | |
| 372 | -------------------------------------------------*/ | |
| 373 | ||
| 374 | static void set_out_cb2(const device_config *device, int data) | |
| 375 | { | |
| 376 | pia6821 *p = get_token(device); | |
| 377 | const pia6821_interface *intf = get_interface(device); | |
| 378 | ||
| 379 | int z = pianew_get_output_cb2_z(device); | |
| 380 | ||
| 381 | if ((data != p->out_cb2) || (z != p->last_out_cb2_z)) | |
| 382 | { | |
| 383 | p->out_cb2 = data; | |
| 384 | p->last_out_cb2_z = z; | |
| 385 | ||
| 386 | /* send to output function */ | |
| 387 | if (intf->out_cb2_func) | |
| 388 | (*intf->out_cb2_func)(device, 0, p->out_cb2); | |
| 389 | else | |
| 390 | { | |
| 391 | if (p->out_cb2_needs_pulled) | |
| 392 | logerror("PIA #%s: Warning! No port CB2 write handler. Previous value has been lost!\n", device->tag); | |
| 393 | ||
| 394 | p->out_cb2_needs_pulled = TRUE; | |
| 395 | } | |
| 396 | } | |
| 397 | } | |
| 398 | ||
| 399 | ||
| 400 | /*------------------------------------------------- | |
| 401 | port_a_r | |
| 402 | -------------------------------------------------*/ | |
| 403 | ||
| 404 | static UINT8 port_a_r(const device_config *device) | |
| 405 | { | |
| 406 | pia6821 *p = get_token(device); | |
| 407 | ||
| 408 | UINT8 ret = get_in_a_value(device); | |
| 409 | ||
| 410 | /* IRQ flags implicitly cleared by a read */ | |
| 411 | p->irq_a1 = FALSE; | |
| 412 | p->irq_a2 = FALSE; | |
| 413 | update_interrupts(device); | |
| 414 | ||
| 415 | /* CA2 is configured as output and in read strobe mode */ | |
| 416 | if (C2_OUTPUT(p->ctl_a) && C2_STROBE_MODE(p->ctl_a)) | |
| 417 | { | |
| 418 | /* this will cause a transition low */ | |
| 419 | set_out_ca2(device, FALSE); | |
| 420 | ||
| 421 | /* if the CA2 strobe is cleared by the E, reset it right away */ | |
| 422 | if (STROBE_E_RESET(p->ctl_a)) | |
| 423 | set_out_ca2(device, TRUE); | |
| 424 | } | |
| 425 | ||
| 426 | LOG(("PIA #%s: port A read = %02X\n", device->tag, ret)); | |
| 427 | ||
| 428 | return ret; | |
| 429 | } | |
| 430 | ||
| 431 | ||
| 432 | /*------------------------------------------------- | |
| 433 | ddr_a_r | |
| 434 | -------------------------------------------------*/ | |
| 435 | ||
| 436 | static UINT8 ddr_a_r(const device_config *device) | |
| 437 | { | |
| 438 | pia6821 *p = get_token(device); | |
| 439 | ||
| 440 | UINT8 ret = p->ddr_a; | |
| 441 | ||
| 442 | LOG(("PIA #%s: DDR A read = %02X\n", device->tag, ret)); | |
| 443 | ||
| 444 | return ret; | |
| 445 | } | |
| 446 | ||
| 447 | ||
| 448 | /*------------------------------------------------- | |
| 449 | port_b_r | |
| 450 | -------------------------------------------------*/ | |
| 451 | ||
| 452 | static UINT8 port_b_r(const device_config *device) | |
| 453 | { | |
| 454 | pia6821 *p = get_token(device); | |
| 455 | ||
| 456 | UINT8 ret = get_in_b_value(device); | |
| 457 | ||
| 458 | /* This read will implicitly clear the IRQ B1 flag. If CB2 is in write-strobe | |
| 459 | mode with CB1 restore, and a CB1 active transition set the flag, | |
| 460 | clearing it will cause CB2 to go high again. Note that this is different | |
| 461 | from what happens with port A. */ | |
| 462 | if (p->irq_b1 && C2_STROBE_MODE(p->ctl_b) && STROBE_C1_RESET(p->ctl_b)) | |
| 463 | set_out_cb2(device, TRUE); | |
| 464 | ||
| 465 | /* IRQ flags implicitly cleared by a read */ | |
| 466 | p->irq_b1 = FALSE; | |
| 467 | p->irq_b2 = FALSE; | |
| 468 | update_interrupts(device); | |
| 469 | ||
| 470 | LOG(("PIA #%s: port B read = %02X\n", device->tag, ret)); | |
| 471 | ||
| 472 | return ret; | |
| 473 | } | |
| 474 | ||
| 475 | ||
| 476 | /*------------------------------------------------- | |
| 477 | ddr_b_r | |
| 478 | -------------------------------------------------*/ | |
| 479 | ||
| 480 | static UINT8 ddr_b_r(const device_config *device) | |
| 481 | { | |
| 482 | pia6821 *p = get_token(device); | |
| 483 | ||
| 484 | UINT8 ret = p->ddr_b; | |
| 485 | ||
| 486 | LOG(("PIA #%s: DDR B read = %02X\n", device->tag, ret)); | |
| 487 | ||
| 488 | return ret; | |
| 489 | } | |
| 490 | ||
| 491 | ||
| 492 | /*------------------------------------------------- | |
| 493 | control_a_r | |
| 494 | -------------------------------------------------*/ | |
| 495 | ||
| 496 | static UINT8 control_a_r(const device_config *device) | |
| 497 | { | |
| 498 | pia6821 *p = get_token(device); | |
| 499 | const pia6821_interface *intf = get_interface(device); | |
| 500 | UINT8 ret; | |
| 501 | ||
| 502 | /* update CA1 & CA2 if callback exists, these in turn may update IRQ's */ | |
| 503 | if (intf->in_ca1_func) | |
| 504 | pia_ca1_w(device, 0, (*intf->in_ca1_func)(device, 0)); | |
| 505 | else if (!p->logged_ca1_not_connected && (!p->in_ca1_pushed)) | |
| 506 | { | |
| 507 | logerror("PIA #%s: Warning! No CA1 read handler. Assuming pin not connected\n", device->tag); | |
| 508 | p->logged_ca1_not_connected = TRUE; | |
| 509 | } | |
| 510 | ||
| 511 | if (intf->in_ca2_func) | |
| 512 | pia_ca2_w(device, 0, (*intf->in_ca2_func)(device, 0)); | |
| 513 | else if ( !p->logged_ca2_not_connected && C2_INPUT(p->ctl_a) && !p->in_ca2_pushed) | |
| 514 | { | |
| 515 | logerror("PIA #%s: Warning! No CA2 read handler. Assuming pin not connected\n", device->tag); | |
| 516 | p->logged_ca2_not_connected = TRUE; | |
| 517 | } | |
| 518 | ||
| 519 | /* read control register */ | |
| 520 | ret = p->ctl_a; | |
| 521 | ||
| 522 | /* set the IRQ flags if we have pending IRQs */ | |
| 523 | if (p->irq_a1) | |
| 524 | ret |= PIA_IRQ1; | |
| 525 | ||
| 526 | if (p->irq_a2 && C2_INPUT(p->ctl_a)) | |
| 527 | ret |= PIA_IRQ2; | |
| 528 | ||
| 529 | LOG(("PIA #%s: control A read = %02X\n", device->tag, ret)); | |
| 530 | ||
| 531 | return ret; | |
| 532 | } | |
| 533 | ||
| 534 | ||
| 535 | /*------------------------------------------------- | |
| 536 | control_b_r | |
| 537 | -------------------------------------------------*/ | |
| 538 | ||
| 539 | static UINT8 control_b_r(const device_config *device) | |
| 540 | { | |
| 541 | pia6821 *p = get_token(device); | |
| 542 | const pia6821_interface *intf = get_interface(device); | |
| 543 | UINT8 ret; | |
| 544 | ||
| 545 | /* update CB1 & CB2 if callback exists, these in turn may update IRQ's */ | |
| 546 | if (intf->in_cb1_func) | |
| 547 | pia_cb1_w(device, 0, (*intf->in_cb1_func)(device, 0)); | |
| 548 | else if (!p->logged_cb1_not_connected && !p->in_cb1_pushed) | |
| 549 | { | |
| 550 | logerror("PIA #%s: Error! no CB1 read handler. Three-state pin is undefined\n", device->tag); | |
| 551 | p->logged_cb1_not_connected = TRUE; | |
| 552 | } | |
| 553 | ||
| 554 | if (intf->in_cb2_func) | |
| 555 | pia_cb2_w(device, 0, (*intf->in_cb2_func)(device, 0)); | |
| 556 | else if (!p->logged_cb2_not_connected && C2_INPUT(p->ctl_b) && !p->in_cb2_pushed) | |
| 557 | { | |
| 558 | logerror("PIA #%s: Error! No CB2 read handler. Three-state pin is undefined\n", device->tag); | |
| 559 | p->logged_cb2_not_connected = TRUE; | |
| 560 | } | |
| 561 | ||
| 562 | /* read control register */ | |
| 563 | ret = p->ctl_b; | |
| 564 | ||
| 565 | /* set the IRQ flags if we have pending IRQs */ | |
| 566 | if (p->irq_b1) | |
| 567 | ret |= PIA_IRQ1; | |
| 568 | ||
| 569 | if (p->irq_b2 && C2_INPUT(p->ctl_b)) | |
| 570 | ret |= PIA_IRQ2; | |
| 571 | ||
| 572 | LOG(("PIA #%s: control B read = %02X\n", device->tag, ret)); | |
| 573 | ||
| 574 | return ret; | |
| 575 | } | |
| 576 | ||
| 577 | ||
| 578 | /*------------------------------------------------- | |
| 579 | pia_r | |
| 580 | -------------------------------------------------*/ | |
| 581 | ||
| 582 | READ8_DEVICE_HANDLER(pia_r) | |
| 583 | { | |
| 584 | pia6821 *p = get_token(device); | |
| 585 | UINT8 ret; | |
| 586 | ||
| 587 | switch (offset & 0x03) | |
| 588 | { | |
| 589 | default: /* impossible */ | |
| 590 | case 0x00: | |
| 591 | if (OUTPUT_SELECTED(p->ctl_a)) | |
| 592 | ret = port_a_r(device); | |
| 593 | else | |
| 594 | ret = ddr_a_r(device); | |
| 595 | break; | |
| 596 | ||
| 597 | case 0x01: | |
| 598 | ret = control_a_r(device); | |
| 599 | break; | |
| 600 | ||
| 601 | case 0x02: | |
| 602 | if (OUTPUT_SELECTED(p->ctl_b)) | |
| 603 | ret = port_b_r(device); | |
| 604 | else | |
| 605 | ret = ddr_b_r(device); | |
| 606 | break; | |
| 607 | ||
| 608 | case 0x03: | |
| 609 | ret = control_b_r(device); | |
| 610 | break; | |
| 611 | } | |
| 612 | ||
| 613 | return ret; | |
| 614 | } | |
| 615 | ||
| 616 | ||
| 617 | /*------------------------------------------------- | |
| 618 | pia_alt_r | |
| 619 | -------------------------------------------------*/ | |
| 620 | ||
| 621 | READ8_DEVICE_HANDLER(pia_alt_r) | |
| 622 | { | |
| 623 | return pia_r(device, ((offset << 1) & 0x02) | ((offset >> 1) & 0x01)); | |
| 624 | } | |
| 625 | ||
| 626 | ||
| 627 | /*------------------------------------------------- | |
| 628 | pianew_get_port_b_z_mask | |
| 629 | -------------------------------------------------*/ | |
| 630 | ||
| 631 | UINT8 pianew_get_port_b_z_mask(const device_config *device) | |
| 632 | { | |
| 633 | pia6821 *p = get_token(device); | |
| 634 | return ~p->ddr_b; | |
| 635 | } | |
| 636 | ||
| 637 | ||
| 638 | /*------------------------------------------------- | |
| 639 | send_to_out_a_func | |
| 640 | -------------------------------------------------*/ | |
| 641 | ||
| 642 | static void send_to_out_a_func(const device_config *device, const char* message) | |
| 643 | { | |
| 644 | pia6821 *p = get_token(device); | |
| 645 | const pia6821_interface *intf = get_interface(device); | |
| 646 | ||
| 647 | /* input pins are pulled high */ | |
| 648 | UINT8 data = get_out_a_value(device); | |
| 649 | ||
| 650 | LOG(("PIA #%s: %s = %02X\n", device->tag, message, data)); | |
| 651 | ||
| 652 | if (intf->out_a_func) | |
| 653 | (*intf->out_a_func)(device, 0, data); | |
| 654 | else | |
| 655 | { | |
| 656 | if (p->out_a_needs_pulled) | |
| 657 | logerror("PIA #%s: Warning! No port A write handler. Previous value has been lost!\n", device->tag); | |
| 658 | ||
| 659 | p->out_a_needs_pulled = TRUE; | |
| 660 | } | |
| 661 | } | |
| 662 | ||
| 663 | ||
| 664 | /*------------------------------------------------- | |
| 665 | send_to_out_b_func | |
| 666 | -------------------------------------------------*/ | |
| 667 | ||
| 668 | static void send_to_out_b_func(const device_config *device, const char* message) | |
| 669 | { | |
| 670 | pia6821 *p = get_token(device); | |
| 671 | const pia6821_interface *intf = get_interface(device); | |
| 672 | ||
| 673 | /* input pins are high-impedance - we just send them as zeros for backwards compatibility */ | |
| 674 | UINT8 data = get_out_b_value(device); | |
| 675 | ||
| 676 | LOG(("PIA #%s: %s = %02X\n", device->tag, message, data)); | |
| 677 | ||
| 678 | if (intf->out_b_func) | |
| 679 | (*intf->out_b_func)(device, 0, data); | |
| 680 | else | |
| 681 | { | |
| 682 | if (p->out_b_needs_pulled) | |
| 683 | logerror("PIA #%s: Warning! No port B write handler. Previous value has been lost!\n", device->tag); | |
| 684 | ||
| 685 | p->out_b_needs_pulled = TRUE; | |
| 686 | } | |
| 687 | } | |
| 688 | ||
| 689 | ||
| 690 | /*------------------------------------------------- | |
| 691 | port_a_w | |
| 692 | -------------------------------------------------*/ | |
| 693 | ||
| 694 | static void port_a_w(const device_config *device, UINT8 data) | |
| 695 | { | |
| 696 | pia6821 *p = get_token(device); | |
| 697 | ||
| 698 | /* buffer the output value */ | |
| 699 | p->out_a = data; | |
| 700 | ||
| 701 | send_to_out_a_func(device, "port A write"); | |
| 702 | } | |
| 703 | ||
| 704 | ||
| 705 | /*------------------------------------------------- | |
| 706 | ddr_a_w | |
| 707 | -------------------------------------------------*/ | |
| 708 | ||
| 709 | static void ddr_a_w(const device_config *device, UINT8 data) | |
| 710 | { | |
| 711 | pia6821 *p = get_token(device); | |
| 712 | ||
| 713 | if (data == 0x00) | |
| 714 | LOG(("PIA #%s: DDR A write = %02X (input mode)\n", device->tag, data)); | |
| 715 | else if (data == 0xff) | |
| 716 | LOG(("PIA #%s: DDR A write = %02X (output mode)\n", device->tag, data)); | |
| 717 | else | |
| 718 | LOG(("PIA #%s: DDR A write = %02X (mixed mode)\n", device->tag, data)); | |
| 719 | ||
| 720 | if (p->ddr_a != data) | |
| 721 | { | |
| 722 | /* DDR changed, call the callback again */ | |
| 723 | p->ddr_a = data; | |
| 724 | p->logged_port_a_not_connected = FALSE; | |
| 725 | send_to_out_a_func(device, "port A write due to DDR change"); | |
| 726 | } | |
| 727 | } | |
| 728 | ||
| 729 | ||
| 730 | /*------------------------------------------------- | |
| 731 | port_b_w | |
| 732 | -------------------------------------------------*/ | |
| 733 | ||
| 734 | static void port_b_w(const device_config *device, UINT8 data) | |
| 735 | { | |
| 736 | pia6821 *p = get_token(device); | |
| 737 | ||
| 738 | /* buffer the output value */ | |
| 739 | p->out_b = data; | |
| 740 | ||
| 741 | send_to_out_b_func(device, "port B write"); | |
| 742 | ||
| 743 | /* CB2 in write strobe mode */ | |
| 744 | if (C2_STROBE_MODE(p->ctl_b)) | |
| 745 | { | |
| 746 | /* this will cause a transition low */ | |
| 747 | set_out_cb2(device, FALSE); | |
| 748 | ||
| 749 | /* if the CB2 strobe is cleared by the E, reset it right away */ | |
| 750 | if (STROBE_E_RESET(p->ctl_b)) | |
| 751 | set_out_cb2(device, TRUE); | |
| 752 | } | |
| 753 | } | |
| 754 | ||
| 755 | ||
| 756 | /*------------------------------------------------- | |
| 757 | ddr_b_w | |
| 758 | -------------------------------------------------*/ | |
| 759 | ||
| 760 | static void ddr_b_w(const device_config *device, UINT8 data) | |
| 761 | { | |
| 762 | pia6821 *p = get_token(device); | |
| 763 | ||
| 764 | if (data == 0x00) | |
| 765 | LOG(("PIA #%s: DDR B write = %02X (input mode)\n", device->tag, data)); | |
| 766 | else if (data == 0xff) | |
| 767 | LOG(("PIA #%s: DDR B write = %02X (output mode)\n", device->tag, data)); | |
| 768 | else | |
| 769 | LOG(("PIA #%s: DDR B write = %02X (mixed mode)\n", device->tag, data)); | |
| 770 | ||
| 771 | if (p->ddr_b != data) | |
| 772 | { | |
| 773 | /* DDR changed, call the callback again */ | |
| 774 | p->ddr_b = data; | |
| 775 | p->logged_port_b_not_connected = FALSE; | |
| 776 | send_to_out_b_func(device, "port B write due to DDR change"); | |
| 777 | } | |
| 778 | } | |
| 779 | ||
| 780 | ||
| 781 | /*------------------------------------------------- | |
| 782 | control_a_w | |
| 783 | -------------------------------------------------*/ | |
| 784 | ||
| 785 | static void control_a_w(const device_config *device, UINT8 data) | |
| 786 | { | |
| 787 | pia6821 *p = get_token(device); | |
| 788 | ||
| 789 | /* bit 7 and 6 are read only */ | |
| 790 | data &= 0x3f; | |
| 791 | ||
| 792 | LOG(("PIA #%s: control A write = %02X\n", device->tag, data)); | |
| 793 | ||
| 794 | /* update the control register */ | |
| 795 | p->ctl_a = data; | |
| 796 | ||
| 797 | /* CA2 is configured as output */ | |
| 798 | if (C2_OUTPUT(p->ctl_a)) | |
| 799 | { | |
| 800 | int temp; | |
| 801 | ||
| 802 | if (C2_SET_MODE(p->ctl_a)) | |
| 803 | /* set/reset mode - bit value determines the new output */ | |
| 804 | temp = C2_SET(p->ctl_a); | |
| 805 | else | |
| 806 | /* strobe mode - output is always high unless strobed */ | |
| 807 | temp = TRUE; | |
| 808 | ||
| 809 | set_out_ca2(device, temp); | |
| 810 | } | |
| 811 | ||
| 812 | /* update externals */ | |
| 813 | update_interrupts(device); | |
| 814 | } | |
| 815 | ||
| 816 | ||
| 817 | /*------------------------------------------------- | |
| 818 | control_b_w | |
| 819 | -------------------------------------------------*/ | |
| 820 | ||
| 821 | static void control_b_w(const device_config *device, UINT8 data) | |
| 822 | { | |
| 823 | pia6821 *p = get_token(device); | |
| 824 | int temp; | |
| 825 | ||
| 826 | /* bit 7 and 6 are read only */ | |
| 827 | data &= 0x3f; | |
| 828 | ||
| 829 | LOG(("PIA #%s: control B write = %02X\n", device->tag, data)); | |
| 830 | ||
| 831 | /* update the control register */ | |
| 832 | p->ctl_b = data; | |
| 833 | ||
| 834 | if (C2_SET_MODE(p->ctl_b)) | |
| 835 | /* set/reset mode - bit value determines the new output */ | |
| 836 | temp = C2_SET(p->ctl_b); | |
| 837 | else | |
| 838 | /* strobe mode - output is always high unless strobed */ | |
| 839 | temp = TRUE; | |
| 840 | ||
| 841 | set_out_cb2(device, temp); | |
| 842 | ||
| 843 | /* update externals */ | |
| 844 | update_interrupts(device); | |
| 845 | } | |
| 846 | ||
| 847 | ||
| 848 | /*------------------------------------------------- | |
| 849 | pia_w | |
| 850 | -------------------------------------------------*/ | |
| 851 | ||
| 852 | WRITE8_DEVICE_HANDLER(pia_w) | |
| 853 | { | |
| 854 | pia6821 *p = get_token(device); | |
| 855 | ||
| 856 | switch (offset & 0x03) | |
| 857 | { | |
| 858 | default: /* impossible */ | |
| 859 | case 0x00: | |
| 860 | if (OUTPUT_SELECTED(p->ctl_a)) | |
| 861 | port_a_w(device, data); | |
| 862 | else | |
| 863 | ddr_a_w(device, data); | |
| 864 | break; | |
| 865 | ||
| 866 | case 0x01: | |
| 867 | control_a_w(device, data); | |
| 868 | break; | |
| 869 | ||
| 870 | case 0x02: | |
| 871 | if (OUTPUT_SELECTED(p->ctl_b)) | |
| 872 | port_b_w(device, data); | |
| 873 | else | |
| 874 | ddr_b_w(device, data); | |
| 875 | break; | |
| 876 | ||
| 877 | case 0x03: | |
| 878 | control_b_w(device, data); | |
| 879 | break; | |
| 880 | } | |
| 881 | } | |
| 882 | ||
| 883 | ||
| 884 | /*------------------------------------------------- | |
| 885 | pia_alt_w | |
| 886 | -------------------------------------------------*/ | |
| 887 | ||
| 888 | WRITE8_DEVICE_HANDLER(pia_alt_w) | |
| 889 | { | |
| 890 | pia_w(device, ((offset << 1) & 0x02) | ((offset >> 1) & 0x01), data); | |
| 891 | } | |
| 892 | ||
| 893 | ||
| 894 | /*------------------------------------------------- | |
| 895 | pianew_set_port_a_z_mask | |
| 896 | -------------------------------------------------*/ | |
| 897 | ||
| 898 | void pianew_set_port_a_z_mask(const device_config *device, UINT8 data) | |
| 899 | { | |
| 900 | pia6821 *p = get_token(device); | |
| 901 | ||
| 902 | p->port_a_z_mask = data; | |
| 903 | } | |
| 904 | ||
| 905 | ||
| 906 | /*------------------------------------------------- | |
| 907 | pia_porta_r | |
| 908 | -------------------------------------------------*/ | |
| 909 | ||
| 910 | READ8_DEVICE_HANDLER(pia_porta_r) | |
| 911 | { | |
| 912 | pia6821 *p = get_token(device); | |
| 913 | ||
| 914 | return p->in_a; | |
| 915 | } | |
| 916 | ||
| 917 | ||
| 918 | /*------------------------------------------------- | |
| 919 | pianew_set_input_a | |
| 920 | -------------------------------------------------*/ | |
| 921 | ||
| 922 | void pianew_set_input_a(const device_config *device, UINT8 data, UINT8 z_mask) | |
| 923 | { | |
| 924 | pia6821 *p = get_token(device); | |
| 925 | const pia6821_interface *intf = get_interface(device); | |
| 926 | ||
| 927 | assert_always(intf->in_a_func == NULL, "pia_porta_w() called when in_a_func implemented"); | |
| 928 | ||
| 929 | LOG(("PIA #%s: set input port A = %02X\n", device->tag, data)); | |
| 930 | ||
| 931 | p->in_a = data; | |
| 932 | p->port_a_z_mask = z_mask; | |
| 933 | p->in_a_pushed = TRUE; | |
| 934 | } | |
| 935 | ||
| 936 | ||
| 937 | /*------------------------------------------------- | |
| 938 | pia_porta_w | |
| 939 | -------------------------------------------------*/ | |
| 940 | ||
| 941 | WRITE8_DEVICE_HANDLER(pia_porta_w) | |
| 942 | { | |
| 943 | pianew_set_input_a(device, data, 0); | |
| 944 | } | |
| 945 | ||
| 946 | ||
| 947 | /*------------------------------------------------- | |
| 948 | pianew_get_output_a | |
| 949 | -------------------------------------------------*/ | |
| 950 | ||
| 951 | UINT8 pianew_get_output_a(const device_config *device) | |
| 952 | { | |
| 953 | pia6821 *p = get_token(device); | |
| 954 | ||
| 955 | p->out_a_needs_pulled = FALSE; | |
| 956 | ||
| 957 | return get_out_a_value(device); | |
| 958 | } | |
| 959 | ||
| 960 | ||
| 961 | /*------------------------------------------------- | |
| 962 | pia_ca1_r | |
| 963 | -------------------------------------------------*/ | |
| 964 | ||
| 965 | READ8_DEVICE_HANDLER(pia_ca1_r) | |
| 966 | { | |
| 967 | pia6821 *p = get_token(device); | |
| 968 | ||
| 969 | return p->in_ca1; | |
| 970 | } | |
| 971 | ||
| 972 | ||
| 973 | /*------------------------------------------------- | |
| 974 | pia_ca1_w | |
| 975 | -------------------------------------------------*/ | |
| 976 | ||
| 977 | WRITE8_DEVICE_HANDLER(pia_ca1_w) | |
| 978 | { | |
| 979 | pia6821 *p = get_token(device); | |
| 980 | ||
| 981 | /* limit the data to 0 or 1 */ | |
| 982 | data = data ? TRUE : FALSE; | |
| 983 | ||
| 984 | LOG(("PIA #%s: set input CA1 = %d\n", device->tag, data)); | |
| 985 | ||
| 986 | /* the new state has caused a transition */ | |
| 987 | if ((p->in_ca1 != data) && | |
| 988 | ((data && C1_LOW_TO_HIGH(p->ctl_a)) || (!data && C1_HIGH_TO_LOW(p->ctl_a)))) | |
| 989 | { | |
| 990 | LOG(("PIA #%s: CA1 triggering\n", device->tag)); | |
| 991 | ||
| 992 | /* mark the IRQ */ | |
| 993 | p->irq_a1 = TRUE; | |
| 994 | ||
| 995 | /* update externals */ | |
| 996 | update_interrupts(device); | |
| 997 | ||
| 998 | /* CA2 is configured as output and in read strobe mode and cleared by a CA1 transition */ | |
| 999 | if (C2_OUTPUT(p->ctl_a) && C2_STROBE_MODE(p->ctl_a) && STROBE_C1_RESET(p->ctl_a)) | |
| 1000 | set_out_ca2(device, TRUE); | |
| 1001 | } | |
| 1002 | ||
| 1003 | /* set the new value for CA1 */ | |
| 1004 | p->in_ca1 = data; | |
| 1005 | p->in_ca1_pushed = TRUE; | |
| 1006 | } | |
| 1007 | ||
| 1008 | ||
| 1009 | /*------------------------------------------------- | |
| 1010 | pia_ca2_r | |
| 1011 | -------------------------------------------------*/ | |
| 1012 | ||
| 1013 | READ8_DEVICE_HANDLER(pia_ca2_r) | |
| 1014 | { | |
| 1015 | pia6821 *p = get_token(device); | |
| 1016 | ||
| 1017 | return p->in_ca2; | |
| 1018 | } | |
| 1019 | ||
| 1020 | ||
| 1021 | /*------------------------------------------------- | |
| 1022 | pia_ca2_w | |
| 1023 | -------------------------------------------------*/ | |
| 1024 | ||
| 1025 | WRITE8_DEVICE_HANDLER(pia_ca2_w) | |
| 1026 | { | |
| 1027 | pia6821 *p = get_token(device); | |
| 1028 | ||
| 1029 | /* limit the data to 0 or 1 */ | |
| 1030 | data = data ? 1 : 0; | |
| 1031 | ||
| 1032 | LOG(("PIA #%s: set input CA2 = %d\n", device->tag, data)); | |
| 1033 | ||
| 1034 | /* if input mode and the new state has caused a transition */ | |
| 1035 | if (C2_INPUT(p->ctl_a) && | |
| 1036 | (p->in_ca2 != data) && | |
| 1037 | ((data && C2_LOW_TO_HIGH(p->ctl_a)) || (!data && C2_HIGH_TO_LOW(p->ctl_a)))) | |
| 1038 | { | |
| 1039 | LOG(("PIA #%s: CA2 triggering\n", device->tag)); | |
| 1040 | ||
| 1041 | /* mark the IRQ */ | |
| 1042 | p->irq_a2 = TRUE; | |
| 1043 | ||
| 1044 | /* update externals */ | |
| 1045 | update_interrupts(device); | |
| 1046 | } | |
| 1047 | ||
| 1048 | /* set the new value for CA2 */ | |
| 1049 | p->in_ca2 = data; | |
| 1050 | p->in_ca2_pushed = TRUE; | |
| 1051 | } | |
| 1052 | ||
| 1053 | ||
| 1054 | /*------------------------------------------------- | |
| 1055 | pianew_get_output_ca2 | |
| 1056 | -------------------------------------------------*/ | |
| 1057 | ||
| 1058 | int pianew_get_output_ca2(const device_config *device) | |
| 1059 | { | |
| 1060 | pia6821 *p = get_token(device); | |
| 1061 | ||
| 1062 | p->out_ca2_needs_pulled = FALSE; | |
| 1063 | ||
| 1064 | return p->out_ca2; | |
| 1065 | } | |
| 1066 | ||
| 1067 | ||
| 1068 | /*------------------------------------------------- | |
| 1069 | pianew_get_output_ca2_z - version of | |
| 1070 | pianew_get_output_ca2, which takes account of internal | |
| 1071 | pullup resistor | |
| 1072 | -------------------------------------------------*/ | |
| 1073 | ||
| 1074 | int pianew_get_output_ca2_z(const device_config *device) | |
| 1075 | { | |
| 1076 | pia6821 *p = get_token(device); | |
| 1077 | ||
| 1078 | p->out_ca2_needs_pulled = FALSE; | |
| 1079 | ||
| 1080 | // If it's an output, output the bit, if it's an input, it's | |
| 1081 | // pulled up | |
| 1082 | return p->out_ca2 | | |
| 1083 | C2_INPUT(p->ctl_a); | |
| 1084 | } | |
| 1085 | ||
| 1086 | ||
| 1087 | /*------------------------------------------------- | |
| 1088 | pia_portb_r | |
| 1089 | -------------------------------------------------*/ | |
| 1090 | ||
| 1091 | READ8_DEVICE_HANDLER(pia_portb_r) | |
| 1092 | { | |
| 1093 | pia6821 *p = get_token(device); | |
| 1094 | ||
| 1095 | return p->in_b; | |
| 1096 | } | |
| 1097 | ||
| 1098 | ||
| 1099 | /*------------------------------------------------- | |
| 1100 | pia_portb_w | |
| 1101 | -------------------------------------------------*/ | |
| 1102 | ||
| 1103 | WRITE8_DEVICE_HANDLER(pia_portb_w) | |
| 1104 | { | |
| 1105 | pia6821 *p = get_token(device); | |
| 1106 | const pia6821_interface *intf = get_interface(device); | |
| 1107 | ||
| 1108 | assert_always(intf->in_b_func == NULL, "pia_set_input_b() called when in_b_func implemented"); | |
| 1109 | ||
| 1110 | LOG(("PIA #%s: set input port B = %02X\n", device->tag, data)); | |
| 1111 | ||
| 1112 | p->in_b = data; | |
| 1113 | p->in_b_pushed = TRUE; | |
| 1114 | } | |
| 1115 | ||
| 1116 | ||
| 1117 | /*------------------------------------------------- | |
| 1118 | pianew_get_output_b | |
| 1119 | -------------------------------------------------*/ | |
| 1120 | ||
| 1121 | UINT8 pianew_get_output_b(const device_config *device) | |
| 1122 | { | |
| 1123 | pia6821 *p = get_token(device); | |
| 1124 | ||
| 1125 | p->out_b_needs_pulled = FALSE; | |
| 1126 | ||
| 1127 | return get_out_b_value(device); | |
| 1128 | } | |
| 1129 | ||
| 1130 | ||
| 1131 | /*------------------------------------------------- | |
| 1132 | pia_cb1_r | |
| 1133 | -------------------------------------------------*/ | |
| 1134 | ||
| 1135 | READ8_DEVICE_HANDLER(pia_cb1_r) | |
| 1136 | { | |
| 1137 | pia6821 *p = get_token(device); | |
| 1138 | ||
| 1139 | return p->in_cb1; | |
| 1140 | } | |
| 1141 | ||
| 1142 | ||
| 1143 | /*------------------------------------------------- | |
| 1144 | pia_cb1_w | |
| 1145 | -------------------------------------------------*/ | |
| 1146 | ||
| 1147 | WRITE8_DEVICE_HANDLER(pia_cb1_w) | |
| 1148 | { | |
| 1149 | pia6821 *p = get_token(device); | |
| 1150 | ||
| 1151 | /* limit the data to 0 or 1 */ | |
| 1152 | data = data ? 1 : 0; | |
| 1153 | ||
| 1154 | LOG(("PIA #%s: set input CB1 = %d\n", device->tag, data)); | |
| 1155 | ||
| 1156 | /* the new state has caused a transition */ | |
| 1157 | if ((p->in_cb1 != data) && | |
| 1158 | ((data && C1_LOW_TO_HIGH(p->ctl_b)) || (!data && C1_HIGH_TO_LOW(p->ctl_b)))) | |
| 1159 | { | |
| 1160 | LOG(("PIA #%s: CB1 triggering\n", device->tag)); | |
| 1161 | ||
| 1162 | /* mark the IRQ */ | |
| 1163 | p->irq_b1 = 1; | |
| 1164 | ||
| 1165 | /* update externals */ | |
| 1166 | update_interrupts(device); | |
| 1167 | ||
| 1168 | /* If CB2 is configured as a write-strobe output which is reset by a CB1 | |
| 1169 | transition, this reset will only happen when a read from port B implicitly | |
| 1170 | clears the IRQ B1 flag. So we handle the CB2 reset there. Note that this | |
| 1171 | is different from what happens with port A. */ | |
| 1172 | } | |
| 1173 | ||
| 1174 | /* set the new value for CB1 */ | |
| 1175 | p->in_cb1 = data; | |
| 1176 | p->in_cb1_pushed = TRUE; | |
| 1177 | } | |
| 1178 | ||
| 1179 | ||
| 1180 | /*------------------------------------------------- | |
| 1181 | pia_cb2_r | |
| 1182 | -------------------------------------------------*/ | |
| 1183 | ||
| 1184 | READ8_DEVICE_HANDLER(pia_cb2_r) | |
| 1185 | { | |
| 1186 | pia6821 *p = get_token(device); | |
| 1187 | ||
| 1188 | return p->in_cb2; | |
| 1189 | } | |
| 1190 | ||
| 1191 | ||
| 1192 | /*------------------------------------------------- | |
| 1193 | pia_cb2_w | |
| 1194 | -------------------------------------------------*/ | |
| 1195 | ||
| 1196 | WRITE8_DEVICE_HANDLER(pia_cb2_w) | |
| 1197 | { | |
| 1198 | pia6821 *p = get_token(device); | |
| 1199 | ||
| 1200 | /* limit the data to 0 or 1 */ | |
| 1201 | data = data ? 1 : 0; | |
| 1202 | ||
| 1203 | LOG(("PIA #%s: set input CB2 = %d\n", device->tag, data)); | |
| 1204 | ||
| 1205 | /* if input mode and the new state has caused a transition */ | |
| 1206 | if (C2_INPUT(p->ctl_b) && | |
| 1207 | (p->in_cb2 != data) && | |
| 1208 | ((data && C2_LOW_TO_HIGH(p->ctl_b)) || (!data && C2_HIGH_TO_LOW(p->ctl_b)))) | |
| 1209 | { | |
| 1210 | LOG(("PIA #%s: CB2 triggering\n", device->tag)); | |
| 1211 | ||
| 1212 | /* mark the IRQ */ | |
| 1213 | p->irq_b2 = 1; | |
| 1214 | ||
| 1215 | /* update externals */ | |
| 1216 | update_interrupts(device); | |
| 1217 | } | |
| 1218 | ||
| 1219 | /* set the new value for CA2 */ | |
| 1220 | p->in_cb2 = data; | |
| 1221 | p->in_cb2_pushed = TRUE; | |
| 1222 | } | |
| 1223 | ||
| 1224 | ||
| 1225 | /*------------------------------------------------- | |
| 1226 | pianew_get_output_cb2 | |
| 1227 | -------------------------------------------------*/ | |
| 1228 | ||
| 1229 | int pianew_get_output_cb2(const device_config *device) | |
| 1230 | { | |
| 1231 | pia6821 *p = get_token(device); | |
| 1232 | ||
| 1233 | p->out_cb2_needs_pulled = FALSE; | |
| 1234 | ||
| 1235 | return p->out_cb2; | |
| 1236 | } | |
| 1237 | ||
| 1238 | ||
| 1239 | /*------------------------------------------------- | |
| 1240 | pianew_get_output_cb2_z | |
| 1241 | -------------------------------------------------*/ | |
| 1242 | ||
| 1243 | int pianew_get_output_cb2_z(const device_config *device) | |
| 1244 | { | |
| 1245 | pia6821 *p = get_token(device); | |
| 1246 | ||
| 1247 | return !C2_OUTPUT(p->ctl_b); | |
| 1248 | } | |
| 1249 | ||
| 1250 | ||
| 1251 | /*------------------------------------------------- | |
| 1252 | pianew_get_irq_a | |
| 1253 | -------------------------------------------------*/ | |
| 1254 | ||
| 1255 | int pianew_get_irq_a(const device_config *device) | |
| 1256 | { | |
| 1257 | pia6821 *p = get_token(device); | |
| 1258 | ||
| 1259 | return p->irq_a_state; | |
| 1260 | } | |
| 1261 | ||
| 1262 | ||
| 1263 | /*------------------------------------------------- | |
| 1264 | pianew_get_irq_b | |
| 1265 | -------------------------------------------------*/ | |
| 1266 | ||
| 1267 | int pianew_get_irq_b(const device_config *device) | |
| 1268 | { | |
| 1269 | pia6821 *p = get_token(device); | |
| 1270 | ||
| 1271 | return p->irq_b_state; | |
| 1272 | } | |
| 1273 | ||
| 1274 | ||
| 1275 | /*------------------------------------------------- | |
| 1276 | DEVICE_SET_INFO( pia ) | |
| 1277 | -------------------------------------------------*/ | |
| 1278 | ||
| 1279 | static DEVICE_SET_INFO( pia ) | |
| 1280 | { | |
| 1281 | switch(state) | |
| 1282 | { | |
| 1283 | } | |
| 1284 | } | |
| 1285 | ||
| 1286 | ||
| 1287 | /*------------------------------------------------- | |
| 1288 | DEVICE_GET_INFO( pia6821 ) | |
| 1289 | -------------------------------------------------*/ | |
| 1290 | ||
| 1291 | DEVICE_GET_INFO(pia6821) | |
| 1292 | { | |
| 1293 | switch (state) | |
| 1294 | { | |
| 1295 | /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 1296 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(pia6821); break; | |
| 1297 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; | |
| 1298 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; | |
| 1299 | ||
| 1300 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1301 | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(pia); break; | |
| 1302 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(pia); break; | |
| 1303 | case DEVINFO_FCT_STOP: /* Nothing */ break; | |
| 1304 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(pia); break; | |
| 1305 | ||
| 1306 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1307 | case DEVINFO_STR_NAME: strcpy(info->s, "6821 PIA"); break; | |
| 1308 | case DEVINFO_STR_FAMILY: strcpy(info->s, "6821 PIA"); break; | |
| 1309 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; | |
| 1310 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; | |
| 1311 | case DEVINFO_STR_CREDITS: /* Nothing */ break; | |
| 1312 | } | |
| 1313 | } | |
| 1314 | ||
| 1315 | ||
| 1316 | /*------------------------------------------------- | |
| 1317 | DEVICE_GET_INFO( pia6822 ) | |
| 1318 | -------------------------------------------------*/ | |
| 1319 | ||
| 1320 | DEVICE_GET_INFO(pia6822) | |
| 1321 | { | |
| 1322 | switch (state) | |
| 1323 | { | |
| 1324 | case DEVINFO_STR_NAME: strcpy(info->s, "6822 PIA"); break; | |
| 1325 | default: DEVICE_GET_INFO_CALL(pia6821); break; | |
| 1326 | } | |
| 1327 | } |
| r0 | r4136 | |
|---|---|---|
| 1 | /********************************************************************** | |
| 2 | ||
| 3 | Motorola 6821 PIA interface and emulation | |
| 4 | ||
| 5 | Notes: | |
| 6 | * pia_get_port_b_z_mask() gives the caller the bitmask | |
| 7 | that show which bits are high-impendance when | |
| 8 | reading port B, thus neither 0 or 1. | |
| 9 | pia_get_output_cb2_z() returns the same | |
| 10 | information for the CB2 pin | |
| 11 | * pia_set_port_a_z_mask allows the input callback to | |
| 12 | indicate which port A bits are disconnected. | |
| 13 | For these bit, the read operation will return the | |
| 14 | output buffer's contents | |
| 15 | * the 'alt' interface functions are used when the A0 and A1 | |
| 16 | address bits are swapped | |
| 17 | * all 'int' data or return values are Boolean | |
| 18 | ||
| 19 | **********************************************************************/ | |
| 20 | ||
| 21 | #ifndef __6821NEW_H__ | |
| 22 | #define __6821NEW_H__ | |
| 23 | ||
| 24 | #include "driver.h" | |
| 25 | ||
| 26 | ||
| 27 | /*************************************************************************** | |
| 28 | CONSTANTS | |
| 29 | ***************************************************************************/ | |
| 30 | ||
| 31 | #define PIA6821 DEVICE_GET_INFO_NAME(pia6821) | |
| 32 | #define PIA6822 DEVICE_GET_INFO_NAME(pia6822) | |
| 33 | ||
| 34 | ||
| 35 | /*************************************************************************** | |
| 36 | TYPE DEFINITIONS | |
| 37 | ***************************************************************************/ | |
| 38 | ||
| 39 | /*------------- PIA interface structure -----------------*/ | |
| 40 | ||
| 41 | typedef struct _pia6821_interface pia6821_interface; | |
| 42 | struct _pia6821_interface | |
| 43 | { | |
| 44 | read8_device_func in_a_func; | |
| 45 | read8_device_func in_b_func; | |
| 46 | read8_device_func in_ca1_func; | |
| 47 | read8_device_func in_cb1_func; | |
| 48 | read8_device_func in_ca2_func; | |
| 49 | read8_device_func in_cb2_func; | |
| 50 | write8_device_func out_a_func; | |
| 51 | write8_device_func out_b_func; | |
| 52 | write8_device_func out_ca2_func; | |
| 53 | write8_device_func out_cb2_func; | |
| 54 | void (*irq_a_func)(const device_config *device, int state); | |
| 55 | void (*irq_b_func)(const device_config *device, int state); | |
| 56 | }; | |
| 57 | ||
| 58 | ||
| 59 | /*************************************************************************** | |
| 60 | PROTOTYPES | |
| 61 | ***************************************************************************/ | |
| 62 | ||
| 63 | DEVICE_GET_INFO(pia6821); | |
| 64 | DEVICE_GET_INFO(pia6822); | |
| 65 | ||
| 66 | READ8_DEVICE_HANDLER(pia_r); | |
| 67 | WRITE8_DEVICE_HANDLER(pia_w); | |
| 68 | ||
| 69 | READ8_DEVICE_HANDLER(pia_alt_r); | |
| 70 | WRITE8_DEVICE_HANDLER(pia_alt_w); | |
| 71 | ||
| 72 | UINT8 pianew_get_port_b_z_mask(const device_config *device); /* see first note */ | |
| 73 | void pianew_set_port_a_z_mask(const device_config *device, UINT8 data); /* see second note */ | |
| 74 | ||
| 75 | READ8_DEVICE_HANDLER(pia_porta_r); | |
| 76 | WRITE8_DEVICE_HANDLER(pia_porta_w); | |
| 77 | void pianew_set_input_a(const device_config *device, UINT8 data, UINT8 z_mask); | |
| 78 | UINT8 pianew_get_output_a(const device_config *device); | |
| 79 | ||
| 80 | READ8_DEVICE_HANDLER(pia_ca1_r); | |
| 81 | WRITE8_DEVICE_HANDLER(pia_ca1_w); | |
| 82 | ||
| 83 | READ8_DEVICE_HANDLER(pia_ca2_r); | |
| 84 | WRITE8_DEVICE_HANDLER(pia_ca2_w); | |
| 85 | int pianew_get_output_ca2(const device_config *device); | |
| 86 | int pianew_get_output_ca2_z(const device_config *device); | |
| 87 | ||
| 88 | READ8_DEVICE_HANDLER(pia_portb_r); | |
| 89 | WRITE8_DEVICE_HANDLER(pia_portb_w); | |
| 90 | UINT8 pianew_get_output_b(const device_config *device); | |
| 91 | ||
| 92 | READ8_DEVICE_HANDLER(pia_cb1_r); | |
| 93 | WRITE8_DEVICE_HANDLER(pia_cb1_w); | |
| 94 | ||
| 95 | READ8_DEVICE_HANDLER(pia_cb2_r); | |
| 96 | WRITE8_DEVICE_HANDLER(pia_cb2_w); | |
| 97 | int pianew_get_output_cb2(const device_config *device); | |
| 98 | int pianew_get_output_cb2_z(const device_config *device); | |
| 99 | ||
| 100 | int pianew_get_irq_a(const device_config *device); | |
| 101 | int pianew_get_irq_b(const device_config *device); | |
| 102 | ||
| 103 | ||
| 104 | /*************************************************************************** | |
| 105 | DEVICE CONFIGURATION MACROS | |
| 106 | ***************************************************************************/ | |
| 107 | ||
| 108 | #define MDRV_PIA6821_ADD(_tag, _intrf) \ | |
| 109 | MDRV_DEVICE_ADD(_tag, PIA6821, 0) \ | |
| 110 | MDRV_DEVICE_CONFIG(_intrf) | |
| 111 | ||
| 112 | #define MDRV_PIA6821_MODIFY(_tag, _intrf) \ | |
| 113 | MDRV_DEVICE_MODIFY(_tag, PIA6821) \ | |
| 114 | MDRV_DEVICE_CONFIG(_intrf) | |
| 115 | ||
| 116 | #define MDRV_PIA6821_REMOVE(_tag) \ | |
| 117 | MDRV_DEVICE_REMOVE(_tag, PIA6821) | |
| 118 | ||
| 119 | #define MDRV_PIA6822_ADD(_tag, _intrf) \ | |
| 120 | MDRV_DEVICE_ADD(_tag, PIA6822, 0) \ | |
| 121 | MDRV_DEVICE_CONFIG(_intrf) | |
| 122 | ||
| 123 | #define MDRV_PIA6822_MODIFY(_tag, _intrf) \ | |
| 124 | MDRV_DEVICE_MODIFY(_tag, PIA6822) \ | |
| 125 | MDRV_DEVICE_CONFIG(_intrf) | |
| 126 | ||
| 127 | #define MDRV_PIA6822_REMOVE(_tag) \ | |
| 128 | MDRV_DEVICE_REMOVE(_tag, PIA6821) | |
| 129 | ||
| 130 | #endif /* __6821NEW_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | |
| 213 | DEVICE_SET_INFO( f3853 ) | |
| 213 | static DEVICE_SET_INFO( f3853 ) | |
| 214 | 214 | { |
| 215 | 215 | switch ( state ) |
| 216 | 216 | { |
| r4135 | r4136 | |
|---|---|---|
| 27 | 27 | #endif /* MESS */ |
| 28 | 28 | |
| 29 | 29 | |
| 30 | // temporary: set this to 1 to pre-decode graphics like we used to | |
| 31 | #define PREDECODE_GFX (0) | |
| 30 | 32 | |
| 33 | ||
| 34 | ||
| 31 | 35 | /*************************************************************************** |
| 32 | 36 | CONSTANTS |
| 33 | 37 | ***************************************************************************/ |
| r4135 | r4136 | |
|---|---|---|
| 20 | 20 | WRITE16_HANDLER( es8712_data_2_msb_w ); |
| 21 | 21 | |
| 22 | 22 | SND_GET_INFO( es8712 ); |
| 23 | #define SOUND_ES8712 SND_GET_INFO_NAME( es8712 ) | |
| 23 | 24 | |
| 24 | 25 | #endif /* __ES8712_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 48 | 48 | WRITE8_HANDLER( nes_psg_1_w ); |
| 49 | 49 | |
| 50 | 50 | SND_GET_INFO( nesapu ); |
| 51 | #define SOUND_NES SND_GET_INFO_NAME( nesapu ) | |
| 51 | 52 | |
| 52 | 53 | #endif /* __NES_APU_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 27 | 27 | WRITE8_HANDLER( ymf262_data_b_1_w ); |
| 28 | 28 | |
| 29 | 29 | SND_GET_INFO( ymf262 ); |
| 30 | #define SOUND_YMF262 SND_GET_INFO_NAME( ymf262 ) | |
| 30 | 31 | |
| 31 | 32 | #endif /* __262INTF_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 339 | 339 | switch (state) |
| 340 | 340 | { |
| 341 | 341 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 342 | case SNDINFO_ | |
| 342 | case SNDINFO_FCT_ALIAS: info->type = SOUND_HC55516; break; | |
| 343 | 343 | |
| 344 | 344 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 345 | 345 | case SNDINFO_PTR_START: info->start = SND_START_NAME( hc55516 ); break; |
| r4135 | r4136 | |
|---|---|---|
| 41 | 41 | void cdp1869_set_wnoff(int which, int value); |
| 42 | 42 | |
| 43 | 43 | SND_GET_INFO( cdp1869 ); |
| 44 | #define SOUND_CDP1869 SND_GET_INFO_NAME( cdp1869 ) | |
| 44 | 45 | |
| 45 | 46 | #endif /* __CDP1869_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 37 | 37 | WRITE16_HANDLER( spb640_w ); |
| 38 | 38 | |
| 39 | 39 | SND_GET_INFO( sp0256 ); |
| 40 | #define SOUND_SP0256 SND_GET_INFO_NAME( sp0256 ) | |
| 40 | 41 | |
| 41 | 42 | #endif /* __SP0256_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 38 | 38 | SND_GET_INFO( mc3417 ); |
| 39 | 39 | SND_GET_INFO( mc3418 ); |
| 40 | 40 | |
| 41 | #define SOUND_HC55516 SND_GET_INFO_NAME( hc55516 ) | |
| 42 | #define SOUND_MC3417 SND_GET_INFO_NAME( mc3417 ) | |
| 43 | #define SOUND_MC3418 SND_GET_INFO_NAME( mc3418 ) | |
| 44 | ||
| 41 | 45 | #endif /* __HC55516_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 195 | 195 | { |
| 196 | 196 | case 7: // voice status. bit 0 is 1 if active. (routine around 0xccc in rtypeleo) |
| 197 | 197 | return chip->channel[channel].play ? 1 : 0; |
| 198 | break; | |
| 199 | 198 | |
| 200 | 199 | default: |
| 201 | 200 | logerror("GA20: read unk. register %d, channel %d\n", offset & 0xf, channel); |
| r4135 | r4136 | |
| 248 | 247 | |
| 249 | 248 | chip->stream = stream_create( device, 0, 2, clock/4, chip, IremGA20_update ); |
| 250 | 249 | |
| 251 | state_save_register_device_item_array(device, | |
| 250 | state_save_register_device_item_array(device, 0 | |
| 252 | 251 | for (i = 0; i < 4; i++) |
| 253 | 252 | { |
| 254 | 253 | state_save_register_device_item(device, i, chip->channel[i].rate); |
| r4135 | r4136 | |
|---|---|---|
| 12 | 12 | READ16_HANDLER( irem_ga20_r ); |
| 13 | 13 | |
| 14 | 14 | SND_GET_INFO( iremga20 ); |
| 15 | #define SOUND_IREMGA20 SND_GET_INFO_NAME( iremga20 ) | |
| 15 | 16 | |
| 16 | 17 | #endif /* __IREMGA20_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 19 | 19 | #define CUSTOM_RESET(name) void name(const device_config *device, void *token) |
| 20 | 20 | |
| 21 | 21 | SND_GET_INFO( custom ); |
| 22 | #define SOUND_CUSTOM SND_GET_INFO_NAME( custom ) | |
| 22 | 23 | |
| 23 | 24 | #endif /* __CUSTOM_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 35 | 35 | WRITE8_HANDLER( ym2612_data_port_1_b_w ); |
| 36 | 36 | |
| 37 | 37 | SND_GET_INFO( ym2612 ); |
| 38 | #define SOUND_YM2612 SND_GET_INFO_NAME( ym2612 ) | |
| 38 | 39 | |
| 39 | 40 | |
| 40 | 41 | typedef struct _ym3438_interface ym3438_interface; |
| r4135 | r4136 | |
| 67 | 68 | WRITE8_HANDLER( ym3438_data_port_1_b_w ); |
| 68 | 69 | |
| 69 | 70 | SND_GET_INFO( ym3438 ); |
| 71 | #define SOUND_YM3438 SND_GET_INFO_NAME( ym3438 ) | |
| 70 | 72 | |
| 71 | 73 | #endif /* __2612INTF_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 7 | 7 | WRITE16_HANDLER( c352_0_w ); |
| 8 | 8 | |
| 9 | 9 | SND_GET_INFO( c352 ); |
| 10 | #define SOUND_C352 SND_GET_INFO_NAME( c352 ) | |
| 10 | 11 | |
| 11 | 12 | #endif /* __C352_H__ */ |
| 12 | 13 |
| r4135 | r4136 | |
|---|---|---|
| 11 | 11 | WRITE8_HANDLER( k052539_waveform_w ); |
| 12 | 12 | |
| 13 | 13 | SND_GET_INFO( k051649 ); |
| 14 | #define SOUND_K051649 SND_GET_INFO_NAME( k051649 ) | |
| 14 | 15 | |
| 15 | 16 | #endif /* __K051649_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 46 | 46 | void k054539_set_gain(int chip, int channel, double gain); |
| 47 | 47 | |
| 48 | 48 | SND_GET_INFO( k054539 ); |
| 49 | #define SOUND_K054539 SND_GET_INFO_NAME( k054539 ) | |
| 49 | 50 | |
| 50 | 51 | #endif /* __K054539_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 33 | 33 | const msm5205_interface *intf; |
| 34 | 34 | const device_config *device; |
| 35 | 35 | sound_stream * stream; /* number of stream system */ |
| 36 | INT32 index; | |
| 37 | 36 | INT32 clock; /* clock rate */ |
| 38 | 37 | emu_timer *timer; /* VCLK callback timer */ |
| 39 | 38 | INT32 data; /* next adpcm data */ |
| r4135 | r4136 | |
| 47 | 46 | }; |
| 48 | 47 | |
| 49 | 48 | |
| 49 | static void msm5205_playmode(struct MSM5205Voice *voice,int select); | |
| 50 | ||
| 50 | 51 | /* |
| 51 | 52 | * ADPCM lockup tabe |
| 52 | 53 | */ |
| r4135 | r4136 | |
| 156 | 157 | voice->signal = 0; |
| 157 | 158 | voice->step = 0; |
| 158 | 159 | /* timer and bitwidth set */ |
| 159 | msm5205_playmode | |
| 160 | msm5205_playmode | |
| 160 | 161 | } |
| 161 | 162 | |
| 162 | 163 | |
| r4135 | r4136 | |
| 180 | 181 | /* save a global pointer to our interface */ |
| 181 | 182 | voice->intf = config; |
| 182 | 183 | voice->device = device; |
| 183 | voice->index = sndindex; | |
| 184 | 184 | voice->clock = clock; |
| 185 | 185 | |
| 186 | 186 | /* compute the difference tables */ |
| r4135 | r4136 | |
| 259 | 259 | void msm5205_playmode_w(int num,int select) |
| 260 | 260 | { |
| 261 | 261 | struct MSM5205Voice *voice = sndti_token(SOUND_MSM5205, num); |
| 262 | msm5205_playmode(voice,select); | |
| 263 | } | |
| 264 | ||
| 265 | static void msm5205_playmode(struct MSM5205Voice *voice,int select) | |
| 266 | { | |
| 262 | 267 | static const int prescaler_table[4] = {96,48,64,0}; |
| 263 | 268 | int prescaler = prescaler_table[select & 3]; |
| 264 | 269 | int bitwidth = (select & 4) ? 4 : 3; |
| r4135 | r4136 | |
|---|---|---|
| 31 | 31 | void namcoio_52xx_write(int data); |
| 32 | 32 | |
| 33 | 33 | SND_GET_INFO( namco_52xx ); |
| 34 | #define SOUND_NAMCO_52XX SND_GET_INFO_NAME( namco_52xx ) | |
| 34 | 35 | |
| 35 | 36 | #endif /* __NAMCO52_H__ */ |
| 36 | 37 |
| r4135 | r4136 | |
|---|---|---|
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | 26 | SND_GET_INFO( c140 ); |
| 27 | #define SOUND_C140 SND_GET_INFO_NAME( c140 ) | |
| 27 | 28 | |
| 28 | 29 | #endif /* __C140_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 37 | 37 | void msm5205_set_volume(int num,int volume); |
| 38 | 38 | |
| 39 | 39 | SND_GET_INFO( msm5205 ); |
| 40 | #define SOUND_MSM5205 SND_GET_INFO_NAME( msm5205 ) | |
| 40 | 41 | |
| 41 | 42 | #endif /* __MSM5205_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 17 | 17 | READ8_HANDLER( qsound_status_r ); |
| 18 | 18 | |
| 19 | 19 | SND_GET_INFO( qsound ); |
| 20 | #define SOUND_QSOUND SND_GET_INFO_NAME( qsound ) | |
| 20 | 21 | |
| 21 | 22 | #endif /* __QSOUND_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 372 | 372 | void * chip; |
| 373 | 373 | const y8950_interface *intf; |
| 374 | 374 | const device_config *device; |
| 375 | int index; | |
| 376 | 375 | }; |
| 377 | 376 | |
| 378 | 377 | static void IRQHandler_8950(void *param,int irq) |
| r4135 | r4136 | |
| 407 | 406 | static unsigned char Y8950PortHandler_r(void *param) |
| 408 | 407 | { |
| 409 | 408 | struct y8950_info *info = param; |
| 410 | /* temporary hack until this is converted to a device */ | |
| 411 | const address_space *space = memory_find_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 412 | 409 | if (info->intf->portread) |
| 413 | return info->intf->portread( | |
| 410 | return info->intf->portread( | |
| 414 | 411 | return 0; |
| 415 | 412 | } |
| 416 | 413 | |
| 417 | 414 | static void Y8950PortHandler_w(void *param,unsigned char data) |
| 418 | 415 | { |
| 419 | 416 | struct y8950_info *info = param; |
| 420 | /* temporary hack until this is converted to a device */ | |
| 421 | const address_space *space = memory_find_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 422 | 417 | if (info->intf->portwrite) |
| 423 | info->intf->portwrite( | |
| 418 | info->intf->portwrite( | |
| 424 | 419 | } |
| 425 | 420 | |
| 426 | 421 | static unsigned char Y8950KeyboardHandler_r(void *param) |
| 427 | 422 | { |
| 428 | 423 | struct y8950_info *info = param; |
| 429 | /* temporary hack until this is converted to a device */ | |
| 430 | const address_space *space = memory_find_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 431 | 424 | if (info->intf->keyboardread) |
| 432 | return info->intf->keyboardread( | |
| 425 | return info->intf->keyboardread( | |
| 433 | 426 | return 0; |
| 434 | 427 | } |
| 435 | 428 | |
| 436 | 429 | static void Y8950KeyboardHandler_w(void *param,unsigned char data) |
| 437 | 430 | { |
| 438 | 431 | struct y8950_info *info = param; |
| 439 | /* temporary hack until this is converted to a device */ | |
| 440 | const address_space *space = memory_find_address_space(info->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 441 | 432 | if (info->intf->keyboardwrite) |
| 442 | info->intf->keyboardwrite( | |
| 433 | info->intf->keyboardwrite( | |
| 443 | 434 | } |
| 444 | 435 | |
| 445 | 436 | static STREAM_UPDATE( y8950_stream_update ) |
| r4135 | r4136 | |
| 466 | 457 | |
| 467 | 458 | info->intf = config ? config : &dummy; |
| 468 | 459 | info->device = device; |
| 469 | info->index = sndindex; | |
| 470 | 460 | |
| 471 | 461 | /* stream system initialize */ |
| 472 | 462 | info->chip = y8950_init(device,clock,rate); |
| r4135 | r4136 | |
|---|---|---|
| 17 | 17 | { |
| 18 | 18 | void (*handler)(running_machine *machine, int linestate); |
| 19 | 19 | |
| 20 | read8_space_func keyboardread; | |
| 21 | write8_space_func keyboardwrite; | |
| 22 | read8_space_func portread; | |
| 23 | write8_space_func portwrite; | |
| 20 | read8_device_func keyboardread; | |
| 21 | write8_device_func keyboardwrite; | |
| 22 | read8_device_func portread; | |
| 23 | write8_device_func portwrite; | |
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | 26 | |
| r4135 | r4136 | |
| 36 | 36 | WRITE8_HANDLER( ym3812_write_port_1_w ); |
| 37 | 37 | |
| 38 | 38 | SND_GET_INFO( ym3812 ); |
| 39 | #define SOUND_YM3812 SND_GET_INFO_NAME( ym3812 ) | |
| 39 | 40 | |
| 40 | 41 | /* YM3526 */ |
| 41 | 42 | READ8_HANDLER ( ym3526_status_port_0_r ); |
| r4135 | r4136 | |
| 49 | 50 | WRITE8_HANDLER( ym3526_write_port_1_w ); |
| 50 | 51 | |
| 51 | 52 | SND_GET_INFO( ym3526 ); |
| 53 | #define SOUND_YM3526 SND_GET_INFO_NAME( ym3526 ) | |
| 52 | 54 | |
| 53 | 55 | /* Y8950 */ |
| 54 | 56 | READ8_HANDLER ( y8950_status_port_0_r ); |
| r4135 | r4136 | |
| 62 | 64 | WRITE8_HANDLER( y8950_write_port_1_w ); |
| 63 | 65 | |
| 64 | 66 | SND_GET_INFO( y8950 ); |
| 67 | #define SOUND_Y8950 SND_GET_INFO_NAME( y8950 ) | |
| 65 | 68 | |
| 66 | 69 | #endif /* __3812INTF_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 6 | 6 | WRITE8_HANDLER( snkwave_w ); |
| 7 | 7 | |
| 8 | 8 | SND_GET_INFO( snkwave ); |
| 9 | #define SOUND_SNKWAVE SND_GET_INFO_NAME( snkwave ) | |
| 9 | 10 | |
| 10 | 11 | #endif /* __SNKWAVE_H__ */ |
| 11 |
| r4135 | r4136 | |
|---|---|---|
| 108 | 108 | typedef struct |
| 109 | 109 | { |
| 110 | 110 | sound_stream * stream; /* our stream */ |
| 111 | void (*external)( | |
| 111 | void (*external)(const device_config *, int, short *);/* callback to generate external samples */ | |
| 112 | 112 | double vco_zero_freq; /* frequency of VCO at 0.0V */ |
| 113 | 113 | double filter_zero_freq; /* frequency of filter at 0.0V */ |
| 114 | 114 | |
| r4135 | r4136 | |
| 131 | 131 | |
| 132 | 132 | double inv_sample_rate; |
| 133 | 133 | int sample_rate; |
| 134 | | |
| 134 | const device_config *device; | |
| 135 | 135 | |
| 136 | 136 | INT16 *mixer_buffer; |
| 137 | 137 | INT16 *external_buffer; |
| r4135 | r4136 | |
| 171 | 171 | INT16 last_ext = chip->last_ext; |
| 172 | 172 | |
| 173 | 173 | /* fetch the external data */ |
| 174 | (*chip->external)(chip-> | |
| 174 | (*chip->external)(chip-> | |
| 175 | 175 | |
| 176 | 176 | /* compute the modulation depth, and adjust fstep to the maximum frequency */ |
| 177 | 177 | /* we lop off 13 bits of depth so that we can multiply by stepadjust, below, */ |
| r4135 | r4136 | |
| 322 | 322 | |
| 323 | 323 | chip = auto_malloc(sizeof(*chip)); |
| 324 | 324 | memset(chip, 0, sizeof(*chip)); |
| 325 | chip-> | |
| 325 | chip-> | |
| 326 | 326 | |
| 327 | 327 | /* copy global parameters */ |
| 328 | 328 | chip->sample_rate = CEM3394_SAMPLE_RATE; |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | WRITE16_HANDLER( rf5c400_0_w ); |
| 10 | 10 | |
| 11 | 11 | SND_GET_INFO( rf5c400 ); |
| 12 | #define SOUND_RF5C400 SND_GET_INFO_NAME( rf5c400 ) | |
| 12 | 13 | |
| 13 | 14 | #endif /* __RF5C400_H__ */ |
| r0 | r4136 | |
|---|---|---|
| 1 | #include <math.h> | |
| 2 | #include "sndintrf.h" | |
| 3 | #include "streams.h" | |
| 4 | #include "digitalk.h" | |
| 5 | ||
| 6 | /* | |
| 7 | National Semiconductor's Digitalker, also known as MM54104. | |
| 8 | ||
| 9 | This is a sample decompression chip where the codec is very | |
| 10 | specialized for speech. | |
| 11 | ||
| 12 | - Driver history | |
| 13 | ||
| 14 | The history of this driver is a little strange. The real | |
| 15 | reverse-engineering work has been done by Kevin Horton | |
| 16 | (single-stepping the chip and everything) with assistance by Lord | |
| 17 | Nightmare who had done the work (with help from Mr. Horton) on the tsi | |
| 18 | s14001a, a predecessor of the digitalker. Mr. Horton was not | |
| 19 | interested in publishing his findings, but provided full-rate | |
| 20 | resynthesized samples for the game scorpion. This driver is the | |
| 21 | result of analyzing these samples. | |
| 22 | ||
| 23 | ||
| 24 | - The Chip | |
| 25 | ||
| 26 | Pinout from chipdir, added there by Agustin Yado. Added rompwr. | |
| 27 | Package is DIP40. Standard osc is 4MHz, maximum is 5Mhz. | |
| 28 | ||
| 29 | +--()--+ | |
| 30 | osc in | 1 40| vdd | |
| 31 | osc out | 2 39| speech out | |
| 32 | cs | 3 38| adr 13 | |
| 33 | wr | 4 37| adr 12 | |
| 34 | rompwr | 5 36| adr 11 | |
| 35 | intr | 6 35| adr 10 | |
| 36 | cms | 7 34| adr 9 | |
| 37 | d0 | 8 33| adr 8 | |
| 38 | d1 | 9 32| adr 7 | |
| 39 | d2 |10 31| adr 6 | |
| 40 | d3 |11 30| adr 5 | |
| 41 | d4 |12 29| adr 4 | |
| 42 | d5 |13 28| adr 3 | |
| 43 | d6 |14 27| adr 2 | |
| 44 | d7 |15 26| adr 1 | |
| 45 | rdata 0 |16 25| adr 0 | |
| 46 | rdata 1 |17 24| rdata 7 | |
| 47 | rdata 2 |18 23| rdata 6 | |
| 48 | rdata 3 |19 22| rdata 5 | |
| 49 | vss |20 21| rdata 4 | |
| 50 | +------+ | |
| 51 | ||
| 52 | Pin functions, excerpt from | |
| 53 | http://www.ski.org/Rehab/sktf/vol06no1Winter1985.html, slightly modified | |
| 54 | "Smith-Kettlewell Technical File, Vol 6, No 1, winter 1985" | |
| 55 | ||
| 56 | On the controller chip, pin 40 is VCC, while pin 20 is ground. VCC | |
| 57 | for this chip is between 7 and 11 VDC, and pin 40 is bypassed to | |
| 58 | pin 20 by 0.1uF. Maximum current is listed at 45mA. | |
| 59 | ||
| 60 | Pin 3 is called "Chip Select Not," and can be taken high to "open" | |
| 61 | the input address and control lines. This is used in cases where | |
| 62 | the Digitalker is connected to a computer bus, and the address | |
| 63 | lines need to be floated while the bus is doing something else. In | |
| 64 | other words, taking pin 3 high makes the Digitalker turn a deaf | |
| 65 | ear to all of its inputs. | |
| 66 | ||
| 67 | Pin 4 is "Write Not," and, as mentioned before, is brought low to | |
| 68 | load an address into the controller, then brought high again to | |
| 69 | start speech. In other words, this is the pin by which you | |
| 70 | "trigger" the Digitalker. | |
| 71 | ||
| 72 | Pin 5 is "Not ROM-Power Enable," an output which can be used to | |
| 73 | control the power to the ROM's. This is used in cases of battery | |
| 74 | supply where current drain is important; the ROM's will have their | |
| 75 | power controlled by the controller. | |
| 76 | ||
| 77 | Pin 6 is the "Interrupt Output," (equivalent to the "Busy Line" of | |
| 78 | the old TSI Speech Board); this line goes low when an address is | |
| 79 | loaded into the chip, then goes high again when speech is | |
| 80 | finished. This signal can be used to control the driver circuitry | |
| 81 | (or other controlling device), in which case it tells the driver | |
| 82 | to "Hold the phone!" while the speech is running. Pin 7 is called | |
| 83 | "CMS," and its state controls the action of the "Write Not" | |
| 84 | line. With pin 7 low, the operation of pin 4 is as described. If | |
| 85 | pin 7 is brought high, raising pin 4 high after loading an address | |
| 86 | serves only to reset the interrupt and does not start speech. This | |
| 87 | facility is probably intended for use where the interrupt line | |
| 88 | really controls the hardware interrupt of a computer, and where | |
| 89 | the program taking care of the interrupt may not have another word | |
| 90 | to say every time the Digitalker is finished. I have found no | |
| 91 | particular use for pin 7, and I simply ground it for normal | |
| 92 | operation. | |
| 93 | ||
| 94 | Pins 8 through 15 are the eight input address lines, with pin 8 | |
| 95 | being the most significant BIT and pin 15 being least | |
| 96 | significant. These address lines are "active high." They should | |
| 97 | never be left open. They are TTL-compatible; this means that logic | |
| 98 | low is ground and logic high is plus 5VDC. (Actually, being MOS | |
| 99 | inputs, you can take them as high as the VCC on the controller, | |
| 100 | but a 5V supply is required for the ROM's anyhow -- it's there if | |
| 101 | you want to use 5V.) | |
| 102 | ||
| 103 | Pins 16 through 24 are the eight data lines which bring data from | |
| 104 | the ROMs to the controller, with pin 16 being called "ROM Data | |
| 105 | 1," and pin 24 being "ROM Data 8." | |
| 106 | ||
| 107 | Pins 25 through 38 are the fourteen address lines which select | |
| 108 | location in the ROM's to be read by the controller. Pin 25 is | |
| 109 | "Address 0," pin 38 is "Address 13." | |
| 110 | ||
| 111 | ||
| 112 | - Codec | |
| 113 | ||
| 114 | The codec stems from the standard model for voiced speech generation: | |
| 115 | a stream of impulses at the pitch frequency followed by an | |
| 116 | articulation filter. Both of those are considered slowly varying. | |
| 117 | ||
| 118 | pitch filter voiced sound | |
| 119 | |||||||||| * /\/\ = ~~~~ | |
| 120 | ||
| 121 | The first compression effect is by forcing the filter to be | |
| 122 | zero-phase. That makes the periods perfectly symmetrical around the | |
| 123 | pitch pulse. The voiced speech is as a result extracted as a number | |
| 124 | of symmetric periods, centered on the pitch pulses. | |
| 125 | ||
| 126 | Following that, two quantizations are done. First, the pitch | |
| 127 | frequency is quantized to one of 32 values (see pitch_vals), going | |
| 128 | from ~80 to 200Hz. Then the volume is selected among 8 possible | |
| 129 | values in an exponential scale, and the amplitudes are quantized as a | |
| 130 | 4-bit signed value. The period is time-warped to make it exactly 128 | |
| 131 | samples long. | |
| 132 | ||
| 133 | The next step of the compression is to select which harnomics will be | |
| 134 | kept. The choices are to keep only the even ones or only the odd | |
| 135 | ones. Dropping half the harmonics allow to encode the period in only | |
| 136 | 32 samples, using the fact that a period, for a zero-phase-at-center, | |
| 137 | half-harmonics signal, looks like: | |
| 138 | ||
| 139 | even harmonics: /\/\ odd harmonics: _/\_ | |
| 140 | ||
| 141 | Where / = block of 32 samples | |
| 142 | \ = same block reversed | |
| 143 | _ = 32 zeroes | |
| 144 | ||
| 145 | So we're left with 32 4-bit samples to encode, which is done using a | |
| 146 | 2-bit adpcm. The adaptative part is done by using a fixed 16-deltas | |
| 147 | table indexed by the current and the previous encoded value. | |
| 148 | ||
| 149 | Added to all that is the possibility of repeating such a period while | |
| 150 | increasing or decreasing the pitch frequency. | |
| 151 | ||
| 152 | ||
| 153 | For non-voiced speech or non-speech an alternative mode is available | |
| 154 | where an equivalent period cutting, frequency and amplitude | |
| 155 | quantization is done, but the whole 128 samples are adpcm-encoded. | |
| 156 | ||
| 157 | ||
| 158 | Finally, silent zones are compressed specifically by storing their | |
| 159 | lenghts. | |
| 160 | ||
| 161 | ||
| 162 | Decoding is simpler. The 128-samples waveform is decoded using the | |
| 163 | adpcm data and mirroring/zeroing as needed in the voiced case. The | |
| 164 | pitch is taken into account by modulating a 1MHz (clock/4) signal at | |
| 165 | the pitch frequency multiplied by 128. pitch_vals in is practice this | |
| 166 | modulation interval, hence its 128us base unit to compute the pitch | |
| 167 | period. | |
| 168 | ||
| 169 | ||
| 170 | - Rom organization | |
| 171 | ||
| 172 | The rom starts with a vector of 16-bits little endian values which are | |
| 173 | the adresses of the segments table for the samples. The segments data | |
| 174 | is a vector of 24-bits little-endian values organized as such: | |
| 175 | ||
| 176 | adr+2 adr+1 adr | |
| 177 | MMAAAAAA AAAAAAAA ERRRSSSS | |
| 178 | ||
| 179 | M: Segment base waveforms compression mode (0-3) | |
| 180 | A: Segment base waveforms data address (0-16383) | |
| 181 | R: Repeat count (1-8) | |
| 182 | S: Number of waveforms (1-16) | |
| 183 | E: Last segment of the sample (flag) | |
| 184 | ||
| 185 | Decoding stops after having decoded a segment with the E bit set. A | |
| 186 | final 8.192ms silence is systematically added. | |
| 187 | ||
| 188 | A == 0 means silence. Duration is 5.12ms*(R+1)*(S+1), or in other | |
| 189 | terms a full decode of all-zero waveforms at maximal pitch frequency | |
| 190 | (pitch code 31). | |
| 191 | ||
| 192 | ||
| 193 | A != 0 means sound. The sound data starts at that offset. The | |
| 194 | encoding method is selected with M: | |
| 195 | ||
| 196 | 0: odd-harmonics voiced mode | |
| 197 | 2: even-harmonics voiced mode | |
| 198 | 3: unvoiced/non-speech mode | |
| 199 | ||
| 200 | Mode 1 is not supported because it is not present in the available | |
| 201 | samples, hence unknown. | |
| 202 | ||
| 203 | ||
| 204 | Voiced mode (9 bytes/waveform): | |
| 205 | ||
| 206 | VVVPPPPP AAAAAAAAx8 - First waveform | |
| 207 | VVVDCCCC AAAAAAAAx8 - Following waveforms | |
| 208 | ||
| 209 | V: Volume (first index in pcm_levels) | |
| 210 | P: Pitch index | |
| 211 | A: adpcm data | |
| 212 | D: Pitch index change direction (0=increase, 1=decrease) | |
| 213 | C: Pitch index maximum change | |
| 214 | ||
| 215 | The waveforms are encoded with a 2-bit adpcm, lowest pair of bits | |
| 216 | first. Deltas are a size-16 vector, indexed with the previous adpcm | |
| 217 | value in bits 0&1 and the current in bits 2&3. Voiced speech modes | |
| 218 | use table delta1 and initial "previous" value 2. | |
| 219 | ||
| 220 | Each waveform is repeated R times at volume V. First waveform has | |
| 221 | fixed pitch P. Subsequent waveforms change the pitch index by 1 every | |
| 222 | repeat (including the first) up to a change of C. D indicates whether | |
| 223 | it's an increment or a decrement. | |
| 224 | ||
| 225 | ||
| 226 | Unvoiced mode (33 bytes/waveform): | |
| 227 | ||
| 228 | VVVPPPPP AAAAAAAAx32 - All waveforms | |
| 229 | ||
| 230 | V: Volume (first index in pcm_levels) | |
| 231 | P: Pitch index | |
| 232 | A: adpcm data | |
| 233 | ||
| 234 | Adpcm encoding is identical but using delta2 table and an initial | |
| 235 | value of 1. Every waveform is played consecutively and the adpcm | |
| 236 | previous value or dac level is not reset between waveforms. The | |
| 237 | complete set of waveforms is repeated R times. | |
| 238 | ||
| 239 | */ | |
| 240 | ||
| 241 | ||
| 242 | typedef struct { | |
| 243 | const UINT8 *rom; | |
| 244 | const device_config *device; | |
| 245 | sound_stream *stream; | |
| 246 | ||
| 247 | // Port/lines state | |
| 248 | UINT8 data, cs, cms, wr, intr; | |
| 249 | ||
| 250 | // Current decoding state | |
| 251 | UINT16 bpos, apos; | |
| 252 | UINT8 mode, cur_segment, cur_repeat, segments, repeats; | |
| 253 | UINT8 prev_pitch, pitch, pitch_pos; | |
| 254 | UINT8 stop_after, cur_dac, cur_bits; | |
| 255 | ||
| 256 | // Zero-range size | |
| 257 | UINT32 zero_count; // 0 for done | |
| 258 | ||
| 259 | // Waveform and current index in it | |
| 260 | UINT8 dac_index; // 128 for done | |
| 261 | INT16 dac[128]; | |
| 262 | ||
| 263 | } digitalker; | |
| 264 | ||
| 265 | // Quantized intensity values, first index is the volume, second the | |
| 266 | // intensity (positive half only, real value goes -8..7) | |
| 267 | static const short pcm_levels[8][8] = { | |
| 268 | { 473, 945, 1418, 1890, 2363, 2835, 3308, 3781 }, | |
| 269 | { 655, 1310, 1966, 2621, 3276, 3931, 4586, 5242 }, | |
| 270 | { 925, 1851, 2776, 3702, 4627, 5553, 6478, 7404 }, | |
| 271 | { 1249, 2498, 3747, 4996, 6245, 7494, 8743, 9992 }, | |
| 272 | { 1638, 3276, 4914, 6552, 8190, 9828, 11466, 13104 }, | |
| 273 | { 2252, 4504, 6757, 9009, 11261, 13514, 15766, 18018 }, | |
| 274 | { 2989, 5979, 8968, 11957, 14947, 17936, 20925, 23915 }, | |
| 275 | { 4095, 8190, 12285, 16380, 20475, 24570, 28665, 32760 }, | |
| 276 | }; | |
| 277 | ||
| 278 | static const int delta1[16] = { -4, -4, -1, -1, -2, -2, 0, 0, 0, 0, 2, 2, 1, 1, 4, 4 }; | |
| 279 | static const int delta2[16] = { 0, -1, -2, -3, 1, 0, -1, -2, 2, 1, 0, -1, 3, 2, 1, 0 }; | |
| 280 | ||
| 281 | // Frequency quantizations, values are in units of 128us. | |
| 282 | ||
| 283 | static const int pitch_vals[32] = { | |
| 284 | 97, 95, 92, 89, 87, 84, 82, 80, 77, 75, 73, 71, 69, 67, 65, 63, | |
| 285 | 61, 60, 58, 56, 55, 53, 52, 50, 49, 48, 46, 45, 43, 42, 41, 40 | |
| 286 | }; | |
| 287 | ||
| 288 | static void digitalker_write(digitalker *dg, UINT8 *adr, UINT8 vol, INT8 dac) | |
| 289 | { | |
| 290 | INT16 v; | |
| 291 | dac &= 15; | |
| 292 | if(dac >= 9) | |
| 293 | v = -pcm_levels[vol][15-dac]; | |
| 294 | else if(dac) | |
| 295 | v = pcm_levels[vol][dac-1]; | |
| 296 | else | |
| 297 | v = 0; | |
| 298 | dg->dac[(*adr)++] = v; | |
| 299 | } | |
| 300 | ||
| 301 | static UINT8 digitalker_pitch_next(UINT8 val, UINT8 prev, int step) | |
| 302 | { | |
| 303 | int delta, nv; | |
| 304 | ||
| 305 | delta = val & 0xf; | |
| 306 | if(delta > step + 1) | |
| 307 | delta = step + 1; | |
| 308 | if(val & 0x10) | |
| 309 | delta = -delta; | |
| 310 | ||
| 311 | nv = prev + delta; | |
| 312 | if(nv < 0) | |
| 313 | nv = 0; | |
| 314 | else if(nv > 31) | |
| 315 | nv = 31; | |
| 316 | return nv; | |
| 317 | } | |
| 318 | ||
| 319 | static void digitalker_set_intr(digitalker *dg, UINT8 intr) | |
| 320 | { | |
| 321 | dg->intr = intr; | |
| 322 | } | |
| 323 | ||
| 324 | static void digitalker_start_command(digitalker *dg, UINT8 cmd) | |
| 325 | { | |
| 326 | dg->bpos = ((dg->rom[cmd*2] << 8) | dg->rom[cmd*2+1]) & 0x3fff; | |
| 327 | dg->cur_segment = dg->segments = dg->cur_repeat = dg->repeats = 0; | |
| 328 | dg->dac_index = 128; | |
| 329 | dg->zero_count = 0; | |
| 330 | digitalker_set_intr(dg, 0); | |
| 331 | } | |
| 332 | ||
| 333 | static void digitalker_step_mode_0(digitalker *dg) | |
| 334 | { | |
| 335 | INT8 dac = 0; | |
| 336 | int i, k, l; | |
| 337 | UINT8 wpos = 0; | |
| 338 | UINT8 h = dg->rom[dg->apos]; | |
| 339 | UINT16 bits = 0x80; | |
| 340 | UINT8 vol = h >> 5; | |
| 341 | UINT8 pitch_id = dg->cur_segment ? digitalker_pitch_next(h, dg->prev_pitch, dg->cur_repeat) : h & 0x1f; | |
| 342 | ||
| 343 | dg->pitch = pitch_vals[pitch_id]; | |
| 344 | ||
| 345 | for(i=0; i<32; i++) | |
| 346 | dg->dac[wpos++] = 0; | |
| 347 | ||
| 348 | for(k=1; k != 9; k++) { | |
| 349 | bits |= dg->rom[dg->apos+k] << 8; | |
| 350 | for(l=0; l<4; l++) { | |
| 351 | dac += delta1[(bits >> (6+2*l)) & 15]; | |
| 352 | digitalker_write(dg, &wpos, vol, dac); | |
| 353 | } | |
| 354 | bits >>= 8; | |
| 355 | } | |
| 356 | ||
| 357 | digitalker_write(dg, &wpos, vol, dac); | |
| 358 | ||
| 359 | for(k=7; k >= 0; k--) { | |
| 360 | bits = (bits << 8) | (k ? dg->rom[dg->apos+k] : 0x80); | |
| 361 | for(l=3; l>=0; l--) { | |
| 362 | dac -= delta1[(bits >> (6+2*l)) & 15]; | |
| 363 | digitalker_write(dg, &wpos, vol, dac); | |
| 364 | } | |
| 365 | } | |
| 366 | ||
| 367 | for(i=0; i<31; i++) | |
| 368 | dg->dac[wpos++] = 0; | |
| 369 | ||
| 370 | dg->cur_repeat++; | |
| 371 | if(dg->cur_repeat == dg->repeats) { | |
| 372 | dg->apos += 9; | |
| 373 | dg->prev_pitch = pitch_id; | |
| 374 | dg->cur_repeat = 0; | |
| 375 | dg->cur_segment++; | |
| 376 | } | |
| 377 | } | |
| 378 | ||
| 379 | static void digitalker_step_mode_1(digitalker *dg) | |
| 380 | { | |
| 381 | logerror("Digitalker mode 1 unsupported"); | |
| 382 | dg->zero_count = 1; | |
| 383 | dg->cur_segment = dg->segments; | |
| 384 | } | |
| 385 | ||
| 386 | static void digitalker_step_mode_2(digitalker *dg) | |
| 387 | { | |
| 388 | INT8 dac = 0; | |
| 389 | int k, l; | |
| 390 | UINT8 wpos=0; | |
| 391 | UINT8 h = dg->rom[dg->apos]; | |
| 392 | UINT16 bits = 0x80; | |
| 393 | UINT8 vol = h >> 5; | |
| 394 | UINT8 pitch_id = dg->cur_segment ? digitalker_pitch_next(h, dg->prev_pitch, dg->cur_repeat) : h & 0x1f; | |
| 395 | ||
| 396 | dg->pitch = pitch_vals[pitch_id]; | |
| 397 | ||
| 398 | for(k=1; k != 9; k++) { | |
| 399 | bits |= dg->rom[dg->apos+k] << 8; | |
| 400 | for(l=0; l<4; l++) { | |
| 401 | dac += delta1[(bits >> (6+2*l)) & 15]; | |
| 402 | digitalker_write(dg, &wpos, vol, dac); | |
| 403 | } | |
| 404 | bits >>= 8; | |
| 405 | } | |
| 406 | ||
| 407 | digitalker_write(dg, &wpos, vol, dac); | |
| 408 | ||
| 409 | for(k=7; k >= 0; k--) { | |
| 410 | bits = (bits << 8) | (k ? dg->rom[dg->apos+k] : 0x80); | |
| 411 | for(l=3; l>=0; l--) { | |
| 412 | dac -= delta1[(bits >> (6+2*l)) & 15]; | |
| 413 | digitalker_write(dg, &wpos, vol, dac); | |
| 414 | } | |
| 415 | } | |
| 416 | ||
| 417 | digitalker_write(dg, &wpos, vol, dac); | |
| 418 | ||
| 419 | for(k=1; k != 9; k++) { | |
| 420 | bits |= dg->rom[dg->apos+k] << 8; | |
| 421 | for(l=0; l<4; l++) { | |
| 422 | dac += delta1[(bits >> (6+2*l)) & 15]; | |
| 423 | digitalker_write(dg, &wpos, vol, dac); | |
| 424 | } | |
| 425 | bits >>= 8; | |
| 426 | } | |
| 427 | ||
| 428 | digitalker_write(dg, &wpos, vol, dac); | |
| 429 | ||
| 430 | for(k=7; k >= 0; k--) { | |
| 431 | bits = (bits << 8) | (k ? dg->rom[dg->apos+k] : 0x80); | |
| 432 | for(l=3; l>=0; l--) { | |
| 433 | dac -= delta1[(bits >> (6+2*l)) & 15]; | |
| 434 | digitalker_write(dg, &wpos, vol, dac); | |
| 435 | } | |
| 436 | } | |
| 437 | ||
| 438 | dg->cur_repeat++; | |
| 439 | if(dg->cur_repeat == dg->repeats) { | |
| 440 | dg->apos += 9; | |
| 441 | dg->prev_pitch = pitch_id; | |
| 442 | dg->cur_repeat = 0; | |
| 443 | dg->cur_segment++; | |
| 444 | } | |
| 445 | } | |
| 446 | ||
| 447 | static void digitalker_step_mode_3(digitalker *dg) | |
| 448 | { | |
| 449 | UINT8 h = dg->rom[dg->apos]; | |
| 450 | UINT8 vol = h >> 5; | |
| 451 | UINT16 bits; | |
| 452 | UINT8 dac, apos, wpos; | |
| 453 | int k, l; | |
| 454 | ||
| 455 | dg->pitch = pitch_vals[h & 0x1f]; | |
| 456 | if(dg->cur_segment == 0 && dg->cur_repeat == 0) { | |
| 457 | dg->cur_bits = 0x40; | |
| 458 | dg->cur_dac = 0; | |
| 459 | } | |
| 460 | bits = dg->cur_bits; | |
| 461 | dac = 0; | |
| 462 | ||
| 463 | apos = dg->apos + 1 + 32*dg->cur_segment; | |
| 464 | wpos = 0; | |
| 465 | for(k=0; k != 32; k++) { | |
| 466 | bits |= dg->rom[apos++] << 8; | |
| 467 | for(l=0; l<4; l++) { | |
| 468 | dac += delta2[(bits >> (6+2*l)) & 15]; | |
| 469 | digitalker_write(dg, &wpos, vol, dac); | |
| 470 | } | |
| 471 | bits >>= 8; | |
| 472 | } | |
| 473 | ||
| 474 | dg->cur_bits = bits; | |
| 475 | dg->cur_dac = dac; | |
| 476 | ||
| 477 | dg->cur_segment++; | |
| 478 | if(dg->cur_segment == dg->segments) { | |
| 479 | dg->cur_segment = 0; | |
| 480 | dg->cur_repeat++; | |
| 481 | } | |
| 482 | } | |
| 483 | ||
| 484 | static void digitalker_step(digitalker *dg) | |
| 485 | { | |
| 486 | if(dg->cur_segment == dg->segments || dg->cur_repeat == dg->repeats) { | |
| 487 | if(dg->stop_after == 0 && dg->bpos == 0xffff) | |
| 488 | return; | |
| 489 | if(dg->stop_after == 0) { | |
| 490 | UINT8 v1 = dg->rom[dg->bpos++]; | |
| 491 | UINT8 v2 = dg->rom[dg->bpos++]; | |
| 492 | UINT8 v3 = dg->rom[dg->bpos++]; | |
| 493 | dg->apos = v2 | ((v3 << 8) & 0x3f00); | |
| 494 | dg->segments = (v1 & 15) + 1; | |
| 495 | dg->repeats = ((v1 >> 4) & 7) + 1; | |
| 496 | dg->mode = (v3 >> 6) & 3; | |
| 497 | dg->stop_after = (v1 & 0x80) != 0; | |
| 498 | ||
| 499 | dg->cur_segment = 0; | |
| 500 | dg->cur_repeat = 0; | |
| 501 | ||
| 502 | if(!dg->apos) { | |
| 503 | dg->zero_count = 40*128*dg->segments*dg->repeats; | |
| 504 | dg->segments = 0; | |
| 505 | dg->repeats = 0; | |
| 506 | return; | |
| 507 | } | |
| 508 | } else if(dg->stop_after == 1) { | |
| 509 | dg->bpos = 0xffff; | |
| 510 | dg->zero_count = 81920; | |
| 511 | dg->stop_after = 2; | |
| 512 | dg->cur_segment = 0; | |
| 513 | dg->cur_repeat = 0; | |
| 514 | dg->segments = 0; | |
| 515 | dg->repeats = 0; | |
| 516 | } else { | |
| 517 | dg->stop_after = 0; | |
| 518 | digitalker_set_intr(dg, 1); | |
| 519 | } | |
| 520 | } | |
| 521 | ||
| 522 | switch(dg->mode) { | |
| 523 | case 0: digitalker_step_mode_0(dg); break; | |
| 524 | case 1: digitalker_step_mode_1(dg); break; | |
| 525 | case 2: digitalker_step_mode_2(dg); break; | |
| 526 | case 3: digitalker_step_mode_3(dg); break; | |
| 527 | } | |
| 528 | if(!dg->zero_count) | |
| 529 | dg->dac_index = 0; | |
| 530 | } | |
| 531 | ||
| 532 | static STREAM_UPDATE(digitalker_update) | |
| 533 | { | |
| 534 | digitalker *dg = param; | |
| 535 | stream_sample_t *sout = outputs[0]; | |
| 536 | int cpos = 0; | |
| 537 | while(cpos != samples) { | |
| 538 | if(dg->zero_count == 0 && dg->dac_index == 128) | |
| 539 | digitalker_step(dg); | |
| 540 | ||
| 541 | if(dg->zero_count) { | |
| 542 | int n = samples - cpos; | |
| 543 | int i; | |
| 544 | if(n > dg->zero_count) | |
| 545 | n = dg->zero_count; | |
| 546 | for(i=0; i != n; i++) | |
| 547 | sout[cpos++] = 0; | |
| 548 | dg->zero_count -= n; | |
| 549 | ||
| 550 | } else if(dg->dac_index != 128) { | |
| 551 | while(cpos != samples && dg->dac_index != 128) { | |
| 552 | short v = dg->dac[dg->dac_index]; | |
| 553 | int pp = dg->pitch_pos; | |
| 554 | while(cpos != samples && pp != dg->pitch) { | |
| 555 | sout[cpos++] = v; | |
| 556 | pp++; | |
| 557 | } | |
| 558 | if(pp == dg->pitch) { | |
| 559 | pp = 0; | |
| 560 | dg->dac_index++; | |
| 561 | } | |
| 562 | dg->pitch_pos = pp; | |
| 563 | } | |
| 564 | ||
| 565 | } else { | |
| 566 | while(cpos != samples) | |
| 567 | sout[cpos++] = 0; | |
| 568 | } | |
| 569 | } | |
| 570 | } | |
| 571 | ||
| 572 | static void digitalker_data_w(digitalker *dg, UINT8 data) | |
| 573 | { | |
| 574 | dg->data = data; | |
| 575 | } | |
| 576 | ||
| 577 | static void digitalker_cs_w(digitalker *dg, int line) | |
| 578 | { | |
| 579 | UINT8 cs = line == ASSERT_LINE ? 1 : 0; | |
| 580 | if(cs == dg->cs) | |
| 581 | return; | |
| 582 | dg->cs = cs; | |
| 583 | if(cs) | |
| 584 | return; | |
| 585 | if(!dg->wr) { | |
| 586 | if(dg->cms) | |
| 587 | digitalker_set_intr(dg, 1); | |
| 588 | else | |
| 589 | digitalker_start_command(dg, dg->data); | |
| 590 | } | |
| 591 | } | |
| 592 | ||
| 593 | static void digitalker_cms_w(digitalker *dg, int line) | |
| 594 | { | |
| 595 | dg->cms = line == ASSERT_LINE ? 1 : 0; | |
| 596 | } | |
| 597 | ||
| 598 | static void digitalker_wr_w(digitalker *dg, int line) | |
| 599 | { | |
| 600 | UINT8 wr = line == ASSERT_LINE ? 1 : 0; | |
| 601 | if(wr == dg->wr) | |
| 602 | return; | |
| 603 | dg->wr = wr; | |
| 604 | if(wr || dg->cs) | |
| 605 | return; | |
| 606 | if(dg->cms) | |
| 607 | digitalker_set_intr(dg, 1); | |
| 608 | else | |
| 609 | digitalker_start_command(dg, dg->data); | |
| 610 | } | |
| 611 | ||
| 612 | static int digitalker_intr_r(digitalker *dg) | |
| 613 | { | |
| 614 | return dg->intr ? ASSERT_LINE : CLEAR_LINE; | |
| 615 | } | |
| 616 | ||
| 617 | static void digitalker_register_for_save(digitalker *dg) | |
| 618 | { | |
| 619 | state_save_register_device_item(dg->device, 0, dg->data); | |
| 620 | state_save_register_device_item(dg->device, 0, dg->cs); | |
| 621 | state_save_register_device_item(dg->device, 0, dg->cms); | |
| 622 | state_save_register_device_item(dg->device, 0, dg->wr); | |
| 623 | state_save_register_device_item(dg->device, 0, dg->intr); | |
| 624 | state_save_register_device_item(dg->device, 0, dg->bpos); | |
| 625 | state_save_register_device_item(dg->device, 0, dg->apos); | |
| 626 | state_save_register_device_item(dg->device, 0, dg->mode); | |
| 627 | state_save_register_device_item(dg->device, 0, dg->cur_segment); | |
| 628 | state_save_register_device_item(dg->device, 0, dg->cur_repeat); | |
| 629 | state_save_register_device_item(dg->device, 0, dg->segments); | |
| 630 | state_save_register_device_item(dg->device, 0, dg->repeats); | |
| 631 | state_save_register_device_item(dg->device, 0, dg->prev_pitch); | |
| 632 | state_save_register_device_item(dg->device, 0, dg->pitch); | |
| 633 | state_save_register_device_item(dg->device, 0, dg->pitch_pos); | |
| 634 | state_save_register_device_item(dg->device, 0, dg->stop_after); | |
| 635 | state_save_register_device_item(dg->device, 0, dg->cur_dac); | |
| 636 | state_save_register_device_item(dg->device, 0, dg->cur_bits); | |
| 637 | state_save_register_device_item(dg->device, 0, dg->zero_count); | |
| 638 | state_save_register_device_item(dg->device, 0, dg->dac_index); | |
| 639 | state_save_register_device_item_array(dg->device, 0, dg->dac); | |
| 640 | } | |
| 641 | ||
| 642 | static SND_START(digitalker) | |
| 643 | { | |
| 644 | digitalker *dg = auto_malloc(sizeof(*dg)); | |
| 645 | memset(dg, 0, sizeof(*dg)); | |
| 646 | dg->device = device; | |
| 647 | dg->rom = memory_region(device->machine, device->tag); | |
| 648 | dg->stream = stream_create(device, 0, 1, clock/4, dg, digitalker_update); | |
| 649 | dg->dac_index = 128; | |
| 650 | dg->data = 0xff; | |
| 651 | dg->cs = dg->cms = dg->wr = 1; | |
| 652 | dg->bpos = 0xffff; | |
| 653 | digitalker_set_intr(dg, 1); | |
| 654 | ||
| 655 | digitalker_register_for_save(dg); | |
| 656 | ||
| 657 | return dg; | |
| 658 | } | |
| 659 | ||
| 660 | static SND_SET_INFO(digitalker) | |
| 661 | { | |
| 662 | /* no parameters to set */ | |
| 663 | } | |
| 664 | ||
| 665 | SND_GET_INFO(digitalker) | |
| 666 | { | |
| 667 | switch(state) { | |
| 668 | case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME(digitalker); break; | |
| 669 | case SNDINFO_PTR_START: info->start = SND_START_NAME(digitalker); break; | |
| 670 | case SNDINFO_PTR_STOP: break; | |
| 671 | case SNDINFO_PTR_RESET: break; | |
| 672 | case SNDINFO_STR_NAME: strcpy(info->s, "Digitalker"); break; | |
| 673 | case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "National Semiconductor"); break; | |
| 674 | case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break; | |
| 675 | case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break; | |
| 676 | case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Olivier Galibert"); break; | |
| 677 | } | |
| 678 | } | |
| 679 | ||
| 680 | void digitalker_0_cs_w(int line) | |
| 681 | { | |
| 682 | digitalker *dg = sndti_token(SOUND_DIGITALKER, 0); | |
| 683 | digitalker_cs_w(dg, line); | |
| 684 | } | |
| 685 | ||
| 686 | void digitalker_0_cms_w(int line) | |
| 687 | { | |
| 688 | digitalker *dg = sndti_token(SOUND_DIGITALKER, 0); | |
| 689 | digitalker_cms_w(dg, line); | |
| 690 | } | |
| 691 | ||
| 692 | void digitalker_0_wr_w(int line) | |
| 693 | { | |
| 694 | digitalker *dg = sndti_token(SOUND_DIGITALKER, 0); | |
| 695 | digitalker_wr_w(dg, line); | |
| 696 | } | |
| 697 | ||
| 698 | int digitalker_0_intr_r(void) | |
| 699 | { | |
| 700 | digitalker *dg = sndti_token(SOUND_DIGITALKER, 0); | |
| 701 | return digitalker_intr_r(dg); | |
| 702 | } | |
| 703 | ||
| 704 | WRITE8_HANDLER(digitalker_0_data_w) | |
| 705 | { | |
| 706 | digitalker *dg = sndti_token(SOUND_DIGITALKER, 0); | |
| 707 | digitalker_data_w(dg, data); | |
| 708 | } |
| r4135 | r4136 | |
|---|---|---|
| 13 | 13 | { |
| 14 | 14 | double vco_zero_freq; /* frequency at 0V for VCO */ |
| 15 | 15 | double filter_zero_freq; /* frequency at 0V for filter */ |
| 16 | void (*external)( | |
| 16 | void (*external)(const device_config *, int, short *);/* external input source */ | |
| 17 | 17 | }; |
| 18 | 18 | |
| 19 | 19 | /* inputs */ |
| r4135 | r4136 | |
| 44 | 44 | double cem3394_get_parameter(int chip, int input); |
| 45 | 45 | |
| 46 | 46 | SND_GET_INFO( cem3394 ); |
| 47 | #define SOUND_CEM3394 SND_GET_INFO_NAME( cem3394 ) | |
| 47 | 48 | |
| 48 | 49 | #endif /* __CEM3394_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 18 | 18 | WRITE16_HANDLER( saa1099_write_port_1_lsb_w ); |
| 19 | 19 | |
| 20 | 20 | SND_GET_INFO( saa1099 ); |
| 21 | #define SOUND_SAA1099 SND_GET_INFO_NAME( saa1099 ) | |
| 21 | 22 | |
| 22 | 23 | #endif /* __SAA1099_H__ */ |
| r0 | r4136 | |
|---|---|---|
| 1 | #ifndef _DIGITALKER_H_ | |
| 2 | #define _DIGITALKER_H_ | |
| 3 | ||
| 4 | void digitalker_0_cs_w(int line); | |
| 5 | void digitalker_0_cms_w(int line); | |
| 6 | void digitalker_0_wr_w(int line); | |
| 7 | int digitalker_0_intr_r(void); | |
| 8 | WRITE8_HANDLER(digitalker_0_data_w); | |
| 9 | ||
| 10 | SND_GET_INFO(digitalker); | |
| 11 | #define SOUND_DIGITALKER SND_GET_INFO_NAME(digitalker) | |
| 12 | ||
| 13 | #endif |
| r4135 | r4136 | |
|---|---|---|
| 91 | 91 | void (*irq_callback)(running_machine *, int); /* IRQ callback */ |
| 92 | 92 | struct YMZ280BVoice voice[8]; /* the 8 voices */ |
| 93 | 93 | UINT32 rom_readback_addr; /* where the CPU can read the ROM */ |
| 94 | read8_space_func ext_ram_read; /* external RAM read handler */ | |
| 95 | write8_space_func ext_ram_write; /* external RAM write handler */ | |
| 94 | read8_device_func ext_ram_read; /* external RAM read handler */ | |
| 95 | write8_device_func ext_ram_write; /* external RAM write handler */ | |
| 96 | 96 | |
| 97 | 97 | #if MAKE_WAVS |
| 98 | 98 | void * wavresample; /* resampled waveform */ |
| r4135 | r4136 | |
| 868 | 868 | case 0x87: /* RAM write */ |
| 869 | 869 | if (chip->ext_ram_write) |
| 870 | 870 | { |
| 871 | /* temporary hack until this is converted to a device */ | |
| 872 | const address_space *space = memory_find_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 873 | chip->ext_ram_write(space, chip->rom_readback_addr, data); | |
| 871 | chip->ext_ram_write(chip->device, chip->rom_readback_addr, data); | |
| 874 | 872 | } |
| 875 | 873 | else |
| 876 | 874 | logerror("YMZ280B attempted RAM write to %X\n", chip->rom_readback_addr); |
| r4135 | r4136 | |
| 1081 | 1079 | { |
| 1082 | 1080 | UINT8 data; |
| 1083 | 1081 | struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0); |
| 1084 | data = chip->ext_ram_read( | |
| 1082 | data = chip->ext_ram_read(chip->device, chip->rom_readback_addr - 1); | |
| 1085 | 1083 | chip->rom_readback_addr++; |
| 1086 | 1084 | return data; |
| 1087 | 1085 | } |
| r4135 | r4136 | |
| 1090 | 1088 | { |
| 1091 | 1089 | UINT8 data; |
| 1092 | 1090 | struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1); |
| 1093 | data = chip->ext_ram_read( | |
| 1091 | data = chip->ext_ram_read(chip->device, chip->rom_readback_addr - 1); | |
| 1094 | 1092 | chip->rom_readback_addr++; |
| 1095 | 1093 | return data; |
| 1096 | 1094 | } |
| r4135 | r4136 | |
|---|---|---|
| 15 | 15 | struct _ymz280b_interface |
| 16 | 16 | { |
| 17 | 17 | void (*irq_callback)(running_machine *machine, int state); /* irq callback */ |
| 18 | read8_space_func ext_read; /* external RAM read */ | |
| 19 | write8_space_func ext_write; /* external RAM write */ | |
| 18 | read8_device_func ext_read; /* external RAM read */ | |
| 19 | write8_device_func ext_write; /* external RAM write */ | |
| 20 | 20 | }; |
| 21 | 21 | |
| 22 | 22 | READ8_HANDLER ( ymz280b_status_0_r ); |
| r4135 | r4136 | |
| 44 | 44 | WRITE16_HANDLER( ymz280b_data_1_msb_w ); |
| 45 | 45 | |
| 46 | 46 | SND_GET_INFO( ymz280b ); |
| 47 | #define SOUND_YMZ280B SND_GET_INFO_NAME( ymz280b ) | |
| 47 | 48 | |
| 48 | 49 | #endif /* __YMZ280B_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | WRITE8_HANDLER( rf5c68_w ); |
| 15 | 15 | |
| 16 | 16 | SND_GET_INFO( rf5c68 ); |
| 17 | #define SOUND_RF5C68 SND_GET_INFO_NAME( rf5c68 ) | |
| 17 | 18 | |
| 18 | 19 | #endif /* __RF5C68_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 1635 | 1635 | { |
| 1636 | 1636 | case 0x101: /* test register */ |
| 1637 | 1637 | return; |
| 1638 | ||
| 1638 | ||
| 1639 | 1639 | case 0x104: /* 6 channels enable */ |
| 1640 | 1640 | { |
| 1641 | 1641 | UINT8 prev; |
| r4135 | r4136 | |
| 1675 | 1675 | |
| 1676 | 1676 | } |
| 1677 | 1677 | return; |
| 1678 | ||
| 1678 | ||
| 1679 | 1679 | case 0x105: /* OPL3 extensions enable register */ |
| 1680 | 1680 | |
| 1681 | 1681 | chip->OPL3_mode = v&0x01; /* OPL3 mode when bit0=1 otherwise it is OPL2 mode */ |
| r4135 | r4136 | |
| 1689 | 1689 | */ |
| 1690 | 1690 | |
| 1691 | 1691 | return; |
| 1692 | break; | |
| 1693 | 1692 | |
| 1694 | 1693 | default: |
| 1695 | 1694 | if (r < 0x120) |
| r4135 | r4136 | |
|---|---|---|
| 11 | 11 | WRITE8_HANDLER( k005289_keylatch_B_w ); |
| 12 | 12 | |
| 13 | 13 | SND_GET_INFO( k005289 ); |
| 14 | #define SOUND_K005289 SND_GET_INFO_NAME( k005289 ) | |
| 14 | 15 | |
| 15 | 16 | #endif /* __K005289_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 7 | 7 | int votrax_status_r(void); |
| 8 | 8 | |
| 9 | 9 | SND_GET_INFO( votrax ); |
| 10 | #define SOUND_VOTRAX SND_GET_INFO_NAME( votrax ) | |
| 10 | 11 | |
| 11 | 12 | #endif /* __VOTRAX_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 513 | 513 | |
| 514 | 514 | #define log_base_2(n) (log((float) n)/log((float) 2)) |
| 515 | 515 | |
| 516 | static void AICA_Init(const device_config *device, struct _AICA *AICA, const aica_interface *intf | |
| 516 | static void AICA_Init(const device_config *device, struct _AICA *AICA, const aica_interface *intf | |
| 517 | 517 | { |
| 518 | 518 | int i; |
| 519 | 519 | |
| r4135 | r4136 | |
| 524 | 524 | |
| 525 | 525 | // get AICA RAM |
| 526 | 526 | { |
| 527 | if (sndindex == 0) | |
| 528 | { | |
| 529 | AICA->Master=1; | |
| 530 | } | |
| 531 | else | |
| 532 | { | |
| 533 | AICA->Master=0; | |
| 534 | } | |
| 527 | AICA->Master = intf->master; | |
| 535 | 528 | |
| 536 | 529 | AICA->AICARAM = device->region; |
| 537 | 530 | if (AICA->AICARAM) |
| r4135 | r4136 | |
| 1295 | 1288 | intf = config; |
| 1296 | 1289 | |
| 1297 | 1290 | // init the emulation |
| 1298 | AICA_Init(device, AICA, intf | |
| 1291 | AICA_Init(device, AICA, intf | |
| 1299 | 1292 | |
| 1300 | 1293 | // set up the IRQ callbacks |
| 1301 | 1294 | { |
| r4135 | r4136 | |
|---|---|---|
| 392 | 392 | switch (state) |
| 393 | 393 | { |
| 394 | 394 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 395 | case SNDINFO_ | |
| 395 | case SNDINFO_FCT_ALIAS: info->type = SOUND_SN76496; break; | |
| 396 | 396 | |
| 397 | 397 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 398 | 398 | case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( sn76496 ); break; |
| r4135 | r4136 | |
|---|---|---|
| 11 | 11 | typedef struct _aica_interface aica_interface; |
| 12 | 12 | struct _aica_interface |
| 13 | 13 | { |
| 14 | int master; | |
| 14 | 15 | int roffset; /* offset in the region */ |
| 15 | 16 | void (*irq_callback)(running_machine *machine, int state); /* irq callback */ |
| 16 | 17 | }; |
| r4135 | r4136 | |
| 26 | 27 | READ16_HANDLER( aica_midi_out_r ); |
| 27 | 28 | |
| 28 | 29 | SND_GET_INFO( aica ); |
| 30 | #define SOUND_AICA SND_GET_INFO_NAME( aica ) | |
| 29 | 31 | |
| 30 | 32 | #endif /* __AICA_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 64 | 64 | image = device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, device->tag ); |
| 65 | 65 | #endif |
| 66 | 66 | stream_create(device, 0, 1, device->machine->sample_rate, (void *)image, wave_sound_update); |
| 67 | return (void *) (FPTR)( | |
| 67 | return (void *) (FPTR)( | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | SND_GET_INFO( gamegear ); |
| 17 | 17 | SND_GET_INFO( smsiii ); |
| 18 | 18 | |
| 19 | #define SOUND_SN76496 SND_GET_INFO_NAME( sn76496 ) | |
| 20 | #define SOUND_SN76489 SND_GET_INFO_NAME( sn76489 ) | |
| 21 | #define SOUND_SN76489A SND_GET_INFO_NAME( sn76489a ) | |
| 22 | #define SOUND_SN76494 SND_GET_INFO_NAME( sn76494 ) | |
| 23 | #define SOUND_GAMEGEAR SND_GET_INFO_NAME( gamegear ) | |
| 24 | #define SOUND_SMSIII SND_GET_INFO_NAME( smsiii ) | |
| 25 | ||
| 19 | 26 | #endif /* __SN76496_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 12 | 12 | #endif |
| 13 | 13 | |
| 14 | 14 | SND_GET_INFO( wave ); |
| 15 | #define SOUND_WAVE SND_GET_INFO_NAME( wave ) | |
| 15 | 16 | |
| 16 | ||
| 17 | 17 | #endif /* __WAVE_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 7 | 7 | WRITE8_HANDLER( astrocade_sound2_w ); |
| 8 | 8 | |
| 9 | 9 | SND_GET_INFO( astrocade ); |
| 10 | #define SOUND_ASTROCADE SND_GET_INFO_NAME( astrocade ) | |
| 10 | 11 | |
| 11 | 12 | #endif /* __ASTROCDE_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 20 | 20 | void seta_sound_enable_w(int); |
| 21 | 21 | |
| 22 | 22 | SND_GET_INFO( x1_010 ); |
| 23 | #define SOUND_X1_010 SND_GET_INFO_NAME( x1_010 ) | |
| 23 | 24 | |
| 24 | 25 | #endif /* __X1_010_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 107 | 107 | UINT8 ext_read; |
| 108 | 108 | |
| 109 | 109 | const UINT8 *rom; |
| 110 | read8_space_func ext_mem_read; | |
| 111 | write8_space_func ext_mem_write; | |
| 110 | read8_device_func ext_mem_read; | |
| 111 | write8_device_func ext_mem_write; | |
| 112 | 112 | void (*irq_callback)(running_machine *, int); |
| 113 | 113 | |
| 114 | 114 | UINT32 clock; |
| r4135 | r4136 | |
| 1374 | 1374 | |
| 1375 | 1375 | static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address) |
| 1376 | 1376 | { |
| 1377 | /* temporary hack until this is converted to a device */ | |
| 1378 | const address_space *space = memory_find_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 1379 | 1377 | if( chip->ext_mem_read ) { |
| 1380 | return chip->ext_mem_read( | |
| 1378 | return chip->ext_mem_read(chip->device,address); | |
| 1381 | 1379 | } else { |
| 1382 | 1380 | if( address < 0x800000) |
| 1383 | 1381 | return chip->rom[address]; |
| r4135 | r4136 | |
| 1387 | 1385 | |
| 1388 | 1386 | static void ymf271_write_ext_memory(YMF271Chip *chip, UINT32 address, UINT8 data) |
| 1389 | 1387 | { |
| 1390 | /* temporary hack until this is converted to a device */ | |
| 1391 | const address_space *space = memory_find_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); | |
| 1392 | 1388 | if( chip->ext_mem_write ) { |
| 1393 | chip->ext_mem_write( | |
| 1389 | chip->ext_mem_write(chip->device, address, data); | |
| 1394 | 1390 | } |
| 1395 | 1391 | } |
| 1396 | 1392 | |
| r4135 | r4136 | |
| 1727 | 1723 | state_save_register_device_item(device, 0, chip->ext_read); |
| 1728 | 1724 | } |
| 1729 | 1725 | |
| 1730 | static void ymf271_init(const device_config *device, YMF271Chip *chip, UINT8 *rom, void (*cb)(running_machine *,int), read8_ | |
| 1726 | static void ymf271_init(const device_config *device, YMF271Chip *chip, UINT8 *rom, void (*cb)(running_machine *,int), read8_device_func ext_read, write8_device_func ext_write) | |
| 1731 | 1727 | { |
| 1732 | 1728 | chip->timA = timer_alloc(device->machine, ymf271_timer_a_tick, chip); |
| 1733 | 1729 | chip->timB = timer_alloc(device->machine, ymf271_timer_b_tick, chip); |
| r4135 | r4136 | |
|---|---|---|
| 204 | 204 | attotime clock_period; |
| 205 | 205 | attotime ad_time_fast; |
| 206 | 206 | attotime ad_time_slow; |
| 207 | int index; | |
| 208 | 207 | |
| 209 | 208 | UINT8 poly4[0x0f]; |
| 210 | 209 | UINT8 poly5[0x1f]; |
| r4135 | r4136 | |
| 620 | 619 | memcpy(&chip->intf, config, sizeof(pokey_interface)); |
| 621 | 620 | chip->device = device; |
| 622 | 621 | chip->clock_period = ATTOTIME_IN_HZ(clock); |
| 623 | chip->index = sndindex; | |
| 624 | 622 | |
| 625 | 623 | /* calculate the A/D times |
| 626 | 624 | * In normal, slow mode (SKCTL bit SK_PADDLE is clear) the conversion |
| r4135 | r4136 | |
| 803 | 801 | { |
| 804 | 802 | int r = (*p->pot_r[pot])(space, pot); |
| 805 | 803 | |
| 806 | LOG(("POKEY | |
| 804 | LOG(("POKEY | |
| 807 | 805 | if( r != -1 ) |
| 808 | 806 | { |
| 809 | 807 | if (r > 228) |
| r4135 | r4136 | |
|---|---|---|
| 30 | 30 | READ8_HANDLER( upd7759_0_busy_r ); |
| 31 | 31 | |
| 32 | 32 | SND_GET_INFO( upd7759 ); |
| 33 | #define SOUND_UPD7759 SND_GET_INFO_NAME( upd7759 ) | |
| 33 | 34 | |
| 34 | 35 | #endif /* __UPD7759_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 6 | 6 | typedef struct _ymf271_interface ymf271_interface; |
| 7 | 7 | struct _ymf271_interface |
| 8 | 8 | { |
| 9 | read8_space_func ext_read; /* external memory read */ | |
| 10 | write8_space_func ext_write; /* external memory write */ | |
| 9 | read8_device_func ext_read; /* external memory read */ | |
| 10 | write8_device_func ext_write; /* external memory write */ | |
| 11 | 11 | void (*irq_callback)(running_machine *machine, int state); /* irq callback */ |
| 12 | 12 | }; |
| 13 | 13 | |
| r4135 | r4136 | |
| 17 | 17 | WRITE8_HANDLER( ymf271_1_w ); |
| 18 | 18 | |
| 19 | 19 | SND_GET_INFO( ymf271 ); |
| 20 | #define SOUND_YMF271 SND_GET_INFO_NAME( ymf271 ) | |
| 20 | 21 | |
| 21 | 22 | #endif /* __YMF271_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 6 | 6 | void namco_63701x_write(int offset,int data); |
| 7 | 7 | |
| 8 | 8 | SND_GET_INFO( namco_63701x ); |
| 9 | #define SOUND_NAMCO_63701X SND_GET_INFO_NAME( namco_63701x ) | |
| 9 | 10 | |
| 10 | 11 | #endif /* __N63701X_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 675 | 675 | else |
| 676 | 676 | info->streams = 3; |
| 677 | 677 | |
| 678 | | |
| 678 | | |
| 679 | 679 | { |
| 680 | case SOUND_AY8910: | |
| 681 | case SOUND_AY8930: | |
| 682 | info->step = 2; | |
| 683 | info->par = &ay8910_param; | |
| 684 | info->par_env = &ay8910_param; | |
| 685 | info->zero_is_off = 1; | |
| 686 | info->env_step_mask = 0x0F; | |
| 687 | break; | |
| 688 | case SOUND_YM2149: | |
| 689 | case SOUND_YM2203: | |
| 690 | case SOUND_YM2610: | |
| 691 | case SOUND_YM2610B: | |
| 692 | case SOUND_YM2608: | |
| 693 | case SOUND_YMZ284: | |
| 694 | case SOUND_YMZ294: | |
| 695 | case SOUND_YM3439: | |
| 696 | default: | |
| 697 | info->step = 1; | |
| 698 | info->par = &ym2149_param; | |
| 699 | info->par_env = &ym2149_param_env; | |
| 700 | info->zero_is_off = 0; | |
| 701 | info->env_step_mask = 0x1F; | |
| 702 | break; | |
| 680 | info->step = 2; | |
| 681 | info->par = &ay8910_param; | |
| 682 | info->par_env = &ay8910_param; | |
| 683 | info->zero_is_off = 1; | |
| 684 | info->env_step_mask = 0x0F; | |
| 703 | 685 | } |
| 686 | else | |
| 687 | { | |
| 688 | info->step = 1; | |
| 689 | info->par = &ym2149_param; | |
| 690 | info->par_env = &ym2149_param_env; | |
| 691 | info->zero_is_off = 0; | |
| 692 | info->env_step_mask = 0x1F; | |
| 693 | } | |
| 704 | 694 | |
| 705 | 695 | build_mixer_table(info); |
| 706 | 696 | |
| r4135 | r4136 | |
| 867 | 857 | switch (state) |
| 868 | 858 | { |
| 869 | 859 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 870 | case SNDINFO_ | |
| 860 | case SNDINFO_FCT_ALIAS: info->type = SOUND_AY8910; break; | |
| 871 | 861 | |
| 872 | 862 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 873 | 863 | case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ay8910 ); break; |
| r4135 | r4136 | |
|---|---|---|
| 107 | 107 | void pokey4_kbcode_w (int kbcode, int make); |
| 108 | 108 | |
| 109 | 109 | SND_GET_INFO( pokey ); |
| 110 | #define SOUND_POKEY SND_GET_INFO_NAME( pokey ) | |
| 110 | 111 | |
| 111 | 112 | #endif /* __POKEY_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 11 | 11 | UINT8 sp0250_drq_r(void); |
| 12 | 12 | |
| 13 | 13 | SND_GET_INFO( sp0250 ); |
| 14 | #define SOUND_SP0250 SND_GET_INFO_NAME( sp0250 ) | |
| 14 | 15 | |
| 15 | 16 | #endif /* __SP0250_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | /*#define FM_EMU*/ |
| 18 | 18 | #ifdef FM_EMU |
| 19 | #define INLINE static __inline__ | |
| 20 | 19 | #ifdef USE_MAME_TIMERS |
| 21 | 20 | #undef USE_MAME_TIMERS |
| 22 | 21 | #endif |
| r4135 | r4136 | |
|---|---|---|
| 26 | 26 | void speaker_level_w (int which, int new_level); |
| 27 | 27 | |
| 28 | 28 | SND_GET_INFO( speaker ); |
| 29 | #define SOUND_SPEAKER SND_GET_INFO_NAME( speaker ) | |
| 29 | 30 | |
| 30 | 31 | #ifdef __cplusplus |
| 31 | 32 | } |
| r4135 | r4136 | |
|---|---|---|
| 143 | 143 | SND_GET_INFO( ymz284 ); |
| 144 | 144 | SND_GET_INFO( ymz294 ); |
| 145 | 145 | |
| 146 | #define SOUND_AY8910 SND_GET_INFO_NAME( ay8910 ) | |
| 147 | #define SOUND_AY8912 SND_GET_INFO_NAME( ay8912 ) | |
| 148 | #define SOUND_AY8913 SND_GET_INFO_NAME( ay8913 ) | |
| 149 | #define SOUND_AY8930 SND_GET_INFO_NAME( ay8930 ) | |
| 150 | #define SOUND_YM2149 SND_GET_INFO_NAME( ym2149 ) | |
| 151 | #define SOUND_YM3439 SND_GET_INFO_NAME( ym3439 ) | |
| 152 | #define SOUND_YMZ284 SND_GET_INFO_NAME( ymz284 ) | |
| 153 | #define SOUND_YMZ294 SND_GET_INFO_NAME( ymz294 ) | |
| 154 | ||
| 146 | 155 | #endif /* __AY8910_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | int cdda_audio_ended(int num); |
| 17 | 17 | |
| 18 | 18 | SND_GET_INFO( cdda ); |
| 19 | #define SOUND_CDDA SND_GET_INFO_NAME( cdda ) | |
| 19 | 20 | |
| 20 | 21 | #endif /* __CDDA_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 27 | 27 | extern void tms3617_enable_w(int chip, int enable); |
| 28 | 28 | |
| 29 | 29 | SND_GET_INFO( tms36xx ); |
| 30 | #define SOUND_TMS36XX SND_GET_INFO_NAME( tms36xx ) | |
| 30 | 31 | |
| 31 | 32 | #endif /* __TMS36XX_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 255 | 255 | memset(info, 0, sizeof(*info)); |
| 256 | 256 | |
| 257 | 257 | info->device = device; |
| 258 | info->sndindex = sndindex; | |
| 259 | 258 | |
| 260 | 259 | /* If a clock is specified we will use it, otherwise run at the audio sample rate. */ |
| 261 | 260 | if (clock) |
| r4135 | r4136 | |
| 266 | 265 | info->neg_sample_time = - info->sample_time; |
| 267 | 266 | |
| 268 | 267 | /* create the logfile */ |
| 269 | sprintf(name, "discrete% | |
| 268 | sprintf(name, "discrete%s.log", | |
| 270 | 269 | if (DISCRETE_DEBUGLOG && !info->disclogfile) |
| 271 | 270 | info->disclogfile = fopen(name, "w"); |
| 272 | 271 | |
| r4135 | r4136 | |
| 714 | 713 | |
| 715 | 714 | for (log_num = 0; log_num < info->num_csvlogs; log_num++) |
| 716 | 715 | { |
| 717 | sprintf(name, "discrete% | |
| 716 | sprintf(name, "discrete%s_%d.csv", info-> | |
| 718 | 717 | info->disc_csv_file[log_num] = fopen(name, "w"); |
| 719 | 718 | /* Output some header info */ |
| 720 | 719 | fprintf(info->disc_csv_file[log_num], "\"MAME Discrete System Node Log\"\n"); |
| r4135 | r4136 | |
| 731 | 730 | |
| 732 | 731 | for (log_num = 0; log_num < info->num_wavelogs; log_num++) |
| 733 | 732 | { |
| 734 | sprintf(name, "discrete% | |
| 733 | sprintf(name, "discrete%s_%d.wav", info-> | |
| 735 | 734 | info->disc_wav_file[log_num] = wav_open(name, info->sample_rate, info->wavelog_node[log_num]->active_inputs/2); |
| 736 | 735 | } |
| 737 | 736 | } |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | WRITE8_HANDLER(st0016_snd_w); |
| 15 | 15 | |
| 16 | 16 | SND_GET_INFO( st0016 ); |
| 17 | #define SOUND_ST0016 SND_GET_INFO_NAME( st0016 ) | |
| 17 | 18 | |
| 18 | 19 | #endif /* __ST0016_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 6 | 6 | WRITE8_HANDLER( tia_sound_w ); |
| 7 | 7 | |
| 8 | 8 | SND_GET_INFO( tia ); |
| 9 | #define SOUND_TIA SND_GET_INFO_NAME( tia ) | |
| 9 | 10 | |
| 10 | 11 | #endif /* __TIAINTF_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | READ8_HANDLER( c6280_r ); |
| 10 | 10 | |
| 11 | 11 | SND_GET_INFO( c6280 ); |
| 12 | #define SOUND_C6280 SND_GET_INFO_NAME( c6280 ) | |
| 12 | 13 | |
| 13 | 14 | #endif /* __C6280_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 3186 | 3186 | * Use this to monitor nodes while debugging the driver. You should |
| 3187 | 3187 | * remove these nodes from the final driver. You can use up to a maximum |
| 3188 | 3188 | * DISCRETE_MAX_CSVLOGS. Each file will be called discreteX_Y.csv, |
| 3189 | * where X is the snd | |
| 3189 | * where X is the sound tag | |
| 3190 | 3190 | * created in the driver. |
| 3191 | 3191 | * |
| 3192 | 3192 | * This can be used to monitor how multiple nodes relate to each other. |
| r4135 | r4136 | |
| 3209 | 3209 | * Use this to monitor nodes while debugging the driver. You should |
| 3210 | 3210 | * remove these nodes from the final driver. You can use up to a maximum |
| 3211 | 3211 | * of DISCRETE_MAX_WAVELOGS. Each file will be called discreteX_Y.wav, |
| 3212 | * where X is the snd | |
| 3212 | * where X is the sound tag | |
| 3213 | 3213 | * created in the driver. |
| 3214 | 3214 | * |
| 3215 | 3215 | * This can be used to monitor how a node's input affects it's output. |
| r4135 | r4136 | |
| 3586 | 3586 | const device_config *device; |
| 3587 | 3587 | |
| 3588 | 3588 | /* emulation info */ |
| 3589 | int sndindex; | |
| 3590 | 3589 | int sample_rate; |
| 3591 | 3590 | double sample_time; |
| 3592 | 3591 | double neg_sample_time; |
| r4135 | r4136 | |
| 4306 | 4305 | READ8_HANDLER(discrete_sound_3_r); |
| 4307 | 4306 | |
| 4308 | 4307 | SND_GET_INFO( discrete ); |
| 4308 | #define SOUND_DISCRETE SND_GET_INFO_NAME( discrete ) | |
| 4309 | 4309 | |
| 4310 | 4310 | #endif /* __DISCRETE_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 509 | 509 | |
| 510 | 510 | #define log_base_2(n) (log((double)(n))/log(2.0)) |
| 511 | 511 | |
| 512 | static void SCSP_Init(const device_config *device, struct _SCSP *SCSP, const scsp_interface *intf | |
| 512 | static void SCSP_Init(const device_config *device, struct _SCSP *SCSP, const scsp_interface *intf | |
| 513 | 513 | { |
| 514 | 514 | int i; |
| 515 | 515 | |
| r4135 | r4136 | |
| 521 | 521 | SCSP->MidiOutR=SCSP->MidiOutW=0; |
| 522 | 522 | |
| 523 | 523 | // get SCSP RAM |
| 524 | if (s | |
| 524 | if (strcmp(device->tag, "scsp") == 0 || strcmp(device->tag, "scsp1") == 0) | |
| 525 | 525 | { |
| 526 | 526 | SCSP->Master=1; |
| 527 | 527 | } |
| r4135 | r4136 | |
| 1233 | 1233 | intf = config; |
| 1234 | 1234 | |
| 1235 | 1235 | // init the emulation |
| 1236 | SCSP_Init(device, SCSP, intf | |
| 1236 | SCSP_Init(device, SCSP, intf | |
| 1237 | 1237 | |
| 1238 | 1238 | // set up the IRQ callbacks |
| 1239 | 1239 | { |
| r4135 | r4136 | |
|---|---|---|
| 53 | 53 | struct loaded_samples *readsamples(const char *const *samplenames, const char *name); |
| 54 | 54 | |
| 55 | 55 | SND_GET_INFO( samples ); |
| 56 | #define SOUND_SAMPLES SND_GET_INFO_NAME( samples ) | |
| 56 | 57 | |
| 57 | 58 | #endif /* __SAMPLES_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | void msm5232_set_clock(void *chip, int clock); |
| 17 | 17 | |
| 18 | 18 | SND_GET_INFO( msm5232 ); |
| 19 | #define SOUND_MSM5232 SND_GET_INFO_NAME( msm5232 ) | |
| 19 | 20 | |
| 20 | 21 | #endif /* __MSM5232_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 29 | 29 | extern UINT32* stv_scu; |
| 30 | 30 | |
| 31 | 31 | SND_GET_INFO( scsp ); |
| 32 | #define SOUND_SCSP SND_GET_INFO_NAME( scsp ) | |
| 32 | 33 | |
| 33 | 34 | #endif /* __SCSP_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 59 | 59 | void filter_rc_set_RC(int num, int type, double R1, double R2, double R3, double C); |
| 60 | 60 | |
| 61 | 61 | SND_GET_INFO( filter_rc ); |
| 62 | #define SOUND_FILTER_RC SND_GET_INFO_NAME( filter_rc ) | |
| 62 | 63 | |
| 63 | 64 | #endif /* __FLT_RC_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 53 | 53 | SND_GET_INFO( ym2610 ); |
| 54 | 54 | SND_GET_INFO( ym2610b ); |
| 55 | 55 | |
| 56 | #define SOUND_YM2610 SND_GET_INFO_NAME( ym2610 ) | |
| 57 | #define SOUND_YM2610B SND_GET_INFO_NAME( ym2610b ) | |
| 56 | 58 | |
| 57 | 59 | #endif /* __2610INTF_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 12 | 12 | void beep_set_volume(int,int); |
| 13 | 13 | |
| 14 | 14 | SND_GET_INFO( beep ); |
| 15 | #define SOUND_BEEP SND_GET_INFO_NAME( beep ) | |
| 15 | 16 | |
| 16 | 17 | #ifdef __cplusplus |
| 17 | 18 | } |
| r4135 | r4136 | |
|---|---|---|
| 45 | 45 | { |
| 46 | 46 | const ics2115_interface *intf; |
| 47 | 47 | const device_config *device; |
| 48 | int index; | |
| 49 | 48 | UINT8 *rom; |
| 50 | 49 | INT16 *ulaw; |
| 51 | 50 | |
| r4135 | r4136 | |
| 450 | 449 | |
| 451 | 450 | chip->device = device; |
| 452 | 451 | chip->intf = config; |
| 453 | chip->index = sndindex; | |
| 454 | 452 | chip->rom = device->region; |
| 455 | 453 | chip->timer[0].timer = timer_alloc(device->machine, timer_cb_0, chip); |
| 456 | 454 | chip->timer[1].timer = timer_alloc(device->machine, timer_cb_1, chip); |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | #define TMS3615_FOOTAGE_16 1 |
| 10 | 10 | |
| 11 | 11 | SND_GET_INFO( tms3615 ); |
| 12 | #define SOUND_TMS3615 SND_GET_INFO_NAME( tms3615 ) | |
| 12 | 13 | |
| 13 | 14 | #endif /* __TMS3615_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 236 | 236 | |
| 237 | 237 | typedef struct |
| 238 | 238 | { |
| 239 | int index; | |
| 240 | 239 | sound_stream * stream; |
| 241 | 240 | |
| 242 | 241 | UINT8 WordInput; // value on word input bus |
| r4135 | r4136 | |
| 565 | 564 | |
| 566 | 565 | chip = auto_malloc(sizeof(*chip)); |
| 567 | 566 | memset(chip, 0, sizeof(*chip)); |
| 568 | chip->index = sndindex; | |
| 569 | 567 | |
| 570 | 568 | chip->GlobalSilenceState = 1; |
| 571 | 569 | chip->OldDelta = 0x02; |
| r4135 | r4136 | |
|---|---|---|
| 12 | 12 | WRITE8_HANDLER( ics2115_w ); |
| 13 | 13 | |
| 14 | 14 | SND_GET_INFO( ics2115 ); |
| 15 | #define SOUND_ICS2115 SND_GET_INFO_NAME( ics2115 ) | |
| 15 | 16 | |
| 16 | 17 | #endif /* __ICS2115_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | WRITE8_HANDLER( dac_2_signed_data_w ); |
| 17 | 17 | |
| 18 | 18 | SND_GET_INFO( dac ); |
| 19 | #define SOUND_DAC SND_GET_INFO_NAME( dac ) | |
| 19 | 20 | |
| 20 | 21 | #endif /* __DAC_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | void s14001a_set_volume(int volume); /* set VSU-1000 volume control */ |
| 11 | 11 | |
| 12 | 12 | SND_GET_INFO( s14001a ); |
| 13 | #define SOUND_S14001A SND_GET_INFO_NAME( s14001a ) | |
| 13 | 14 | |
| 14 | 15 | #endif /* __S14001A_H__ */ |
| 15 | 16 |
| r4135 | r4136 | |
|---|---|---|
| 18 | 18 | SND_GET_INFO( gaelco_gae1 ); |
| 19 | 19 | SND_GET_INFO( gaelco_cg1v ); |
| 20 | 20 | |
| 21 | #define SOUND_GAELCO_GAE1 SND_GET_INFO_NAME( gaelco_gae1 ) | |
| 22 | #define SOUND_GAELCO_CG1V SND_GET_INFO_NAME( gaelco_cg1v ) | |
| 23 | ||
| 21 | 24 | #endif /* __GALELCO_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 85 | 85 | #endif /* OSD_CPU_H */ |
| 86 | 86 | #endif |
| 87 | 87 | |
| 88 | #ifndef INLINE | |
| 89 | #define INLINE static __inline__ | |
| 90 | #endif | |
| 91 | 88 | |
| 92 | 89 | |
| 93 | ||
| 94 | ||
| 95 | 90 | typedef stream_sample_t FMSAMPLE; |
| 96 | 91 | /* |
| 97 | 92 | #if (FM_SAMPLE_BITS==16) |
| r4135 | r4136 | |
|---|---|---|
| 13 | 13 | WRITE16_HANDLER( bsmt2000_data_0_w ); |
| 14 | 14 | |
| 15 | 15 | SND_GET_INFO( bsmt2000 ); |
| 16 | #define SOUND_BSMT2000 SND_GET_INFO_NAME( bsmt2000 ) | |
| 16 | 17 | |
| 17 | 18 | #endif /* __BSMT2000_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | void dmadac_set_volume(UINT8 first_channel, UINT8 num_channels, UINT16 volume); |
| 17 | 17 | |
| 18 | 18 | SND_GET_INFO( dmadac ); |
| 19 | #define SOUND_DMADAC SND_GET_INFO_NAME( dmadac ) | |
| 19 | 20 | |
| 20 | 21 | #endif /* __DMADAC_H__ */ |
| r0 | r4136 | |
|---|---|---|
| 1 | /********************************************************************************************** | |
| 2 | * | |
| 3 | * OKI MSM6376 ADPCM | |
| 4 | * by Mirko Buffoni | |
| 5 | * | |
| 6 | * TODO: | |
| 7 | * add BEEP tone generator | |
| 8 | * add 2ch handling (for echoing and continuous speech) | |
| 9 | * | |
| 10 | **********************************************************************************************/ | |
| 11 | ||
| 12 | ||
| 13 | #include <math.h> | |
| 14 | ||
| 15 | #include "sndintrf.h" | |
| 16 | #include "streams.h" | |
| 17 | #include "okim6376.h" | |
| 18 | ||
| 19 | #define MAX_SAMPLE_CHUNK 10000 | |
| 20 | #define MAX_WORDS 111 | |
| 21 | ||
| 22 | ||
| 23 | /* struct describing a single playing ADPCM voice */ | |
| 24 | struct ADPCMVoice | |
| 25 | { | |
| 26 | UINT8 playing; /* 1 if we are actively playing */ | |
| 27 | ||
| 28 | UINT32 base_offset; /* pointer to the base memory location */ | |
| 29 | UINT32 sample; /* current sample number */ | |
| 30 | UINT32 count; /* total samples to play */ | |
| 31 | ||
| 32 | UINT32 volume; /* output volume */ | |
| 33 | INT32 signal; | |
| 34 | INT32 step; | |
| 35 | }; | |
| 36 | ||
| 37 | struct okim6376 | |
| 38 | { | |
| 39 | #define OKIM6376_VOICES 2 | |
| 40 | struct ADPCMVoice voice[OKIM6376_VOICES]; | |
| 41 | INT32 command; | |
| 42 | UINT8 *region_base; /* pointer to the base of the region */ | |
| 43 | sound_stream *stream; /* which stream are we playing on? */ | |
| 44 | UINT32 master_clock; /* master clock frequency */ | |
| 45 | }; | |
| 46 | ||
| 47 | /* step size index shift table */ | |
| 48 | static const int index_shift[8] = { -1, -1, -1, -1, 2, 4, 6, 8 }; | |
| 49 | ||
| 50 | /* lookup table for the precomputed difference */ | |
| 51 | static int diff_lookup[49*16]; | |
| 52 | ||
| 53 | /* volume lookup table. Upon configuration, the number of ST pulses determine how much | |
| 54 | attenuation to apply to the sound signal. */ | |
| 55 | static int volume_table[4] = | |
| 56 | { | |
| 57 | 0x10, // 0 dB | |
| 58 | 0x08, // -6.0 dB | |
| 59 | 0x04, // -12.0 dB | |
| 60 | 0x02, // -24.0 dB | |
| 61 | }; | |
| 62 | ||
| 63 | /* tables computed? */ | |
| 64 | static int tables_computed = 0; | |
| 65 | ||
| 66 | ||
| 67 | ||
| 68 | /********************************************************************************************** | |
| 69 | ||
| 70 | compute_tables -- compute the difference tables | |
| 71 | ||
| 72 | ***********************************************************************************************/ | |
| 73 | ||
| 74 | static void compute_tables(void) | |
| 75 | { | |
| 76 | /* nibble to bit map */ | |
| 77 | static const int nbl2bit[16][4] = | |
| 78 | { | |
| 79 | { 1, 0, 0, 0}, { 1, 0, 0, 1}, { 1, 0, 1, 0}, { 1, 0, 1, 1}, | |
| 80 | { 1, 1, 0, 0}, { 1, 1, 0, 1}, { 1, 1, 1, 0}, { 1, 1, 1, 1}, | |
| 81 | {-1, 0, 0, 0}, {-1, 0, 0, 1}, {-1, 0, 1, 0}, {-1, 0, 1, 1}, | |
| 82 | {-1, 1, 0, 0}, {-1, 1, 0, 1}, {-1, 1, 1, 0}, {-1, 1, 1, 1} | |
| 83 | }; | |
| 84 | ||
| 85 | int step, nib; | |
| 86 | ||
| 87 | /* loop over all possible steps */ | |
| 88 | for (step = 0; step <= 48; step++) | |
| 89 | { | |
| 90 | /* compute the step value */ | |
| 91 | int stepval = floor(16.0 * pow(11.0 / 10.0, (double)step)); | |
| 92 | ||
| 93 | /* loop over all nibbles and compute the difference */ | |
| 94 | for (nib = 0; nib < 16; nib++) | |
| 95 | { | |
| 96 | diff_lookup[step*16 + nib] = nbl2bit[nib][0] * | |
| 97 | (stepval * nbl2bit[nib][1] + | |
| 98 | stepval/2 * nbl2bit[nib][2] + | |
| 99 | stepval/4 * nbl2bit[nib][3] + | |
| 100 | stepval/8); | |
| 101 | } | |
| 102 | } | |
| 103 | ||
| 104 | tables_computed = 1; | |
| 105 | } | |
| 106 | ||
| 107 | ||
| 108 | ||
| 109 | /********************************************************************************************** | |
| 110 | ||
| 111 | reset_adpcm -- reset the ADPCM stream | |
| 112 | ||
| 113 | ***********************************************************************************************/ | |
| 114 | ||
| 115 | static void reset_adpcm(struct ADPCMVoice *voice) | |
| 116 | { | |
| 117 | /* make sure we have our tables */ | |
| 118 | if (!tables_computed) | |
| 119 | compute_tables(); | |
| 120 | ||
| 121 | /* reset the signal/step */ | |
| 122 | voice->signal = -2; | |
| 123 | voice->step = 0; | |
| 124 | } | |
| 125 | ||
| 126 | ||
| 127 | ||
| 128 | /********************************************************************************************** | |
| 129 | ||
| 130 | clock_adpcm -- clock the next ADPCM byte | |
| 131 | ||
| 132 | ***********************************************************************************************/ | |
| 133 | ||
| 134 | static INT16 clock_adpcm(struct ADPCMVoice *voice, UINT8 nibble) | |
| 135 | { | |
| 136 | voice->signal += diff_lookup[voice->step * 16 + (nibble & 15)]; | |
| 137 | ||
| 138 | /* clamp to the maximum 12bit */ | |
| 139 | if (voice->signal > 4095) | |
| 140 | voice->signal = 4095; | |
| 141 | else if (voice->signal < -4096) | |
| 142 | voice->signal = -4096; | |
| 143 | ||
| 144 | /* adjust the step size and clamp */ | |
| 145 | voice->step += index_shift[nibble & 7]; | |
| 146 | if (voice->step > 48) | |
| 147 | voice->step = 48; | |
| 148 | else if (voice->step < 0) | |
| 149 | voice->step = 0; | |
| 150 | ||
| 151 | /* return the signal */ | |
| 152 | return voice->signal; | |
| 153 | } | |
| 154 | ||
| 155 | ||
| 156 | ||
| 157 | /********************************************************************************************** | |
| 158 | ||
| 159 | generate_adpcm -- general ADPCM decoding routine | |
| 160 | ||
| 161 | ***********************************************************************************************/ | |
| 162 | ||
| 163 | static void generate_adpcm(struct okim6376 *chip, struct ADPCMVoice *voice, INT16 *buffer, int samples) | |
| 164 | { | |
| 165 | /* if this voice is active */ | |
| 166 | if (voice->playing) | |
| 167 | { | |
| 168 | UINT8 *base = chip->region_base + voice->base_offset; | |
| 169 | int sample = voice->sample; | |
| 170 | int count = voice->count; | |
| 171 | ||
| 172 | /* loop while we still have samples to generate */ | |
| 173 | while (samples) | |
| 174 | { | |
| 175 | int nibble; | |
| 176 | ||
| 177 | if (count == 0) | |
| 178 | { | |
| 179 | /* get the number of samples to play */ | |
| 180 | count = (base[sample / 2] & 0x7f) << 1; | |
| 181 | ||
| 182 | /* end of voice marker */ | |
| 183 | if (count == 0) | |
| 184 | { | |
| 185 | voice->playing = 0; | |
| 186 | break; | |
| 187 | } | |
| 188 | else | |
| 189 | { | |
| 190 | /* step past the count byte */ | |
| 191 | sample += 2; | |
| 192 | } | |
| 193 | } | |
| 194 | ||
| 195 | /* compute the new amplitude and update the current step */ | |
| 196 | nibble = base[sample / 2] >> (((sample & 1) << 2) ^ 4); | |
| 197 | ||
| 198 | /* output to the buffer, scaling by the volume */ | |
| 199 | /* signal in range -4096..4095, volume in range 2..16 => signal * volume / 2 in range -32768..32767 */ | |
| 200 | *buffer++ = clock_adpcm(voice, nibble) * voice->volume / 2; | |
| 201 | ||
| 202 | ++sample; | |
| 203 | --count; | |
| 204 | --samples; | |
| 205 | } | |
| 206 | ||
| 207 | /* update the parameters */ | |
| 208 | voice->sample = sample; | |
| 209 | voice->count = count; | |
| 210 | } | |
| 211 | ||
| 212 | /* fill the rest with silence */ | |
| 213 | while (samples--) | |
| 214 | *buffer++ = 0; | |
| 215 | } | |
| 216 | ||
| 217 | ||
| 218 | ||
| 219 | /********************************************************************************************** | |
| 220 | ||
| 221 | okim6376_update -- update the sound chip so that it is in sync with CPU execution | |
| 222 | ||
| 223 | ***********************************************************************************************/ | |
| 224 | ||
| 225 | static STREAM_UPDATE( okim6376_update ) | |
| 226 | { | |
| 227 | struct okim6376 *chip = param; | |
| 228 | int i; | |
| 229 | ||
| 230 | memset(outputs[0], 0, samples * sizeof(*outputs[0])); | |
| 231 | ||
| 232 | for (i = 0; i < OKIM6376_VOICES; i++) | |
| 233 | { | |
| 234 | struct ADPCMVoice *voice = &chip->voice[i]; | |
| 235 | stream_sample_t *buffer = outputs[0]; | |
| 236 | INT16 sample_data[MAX_SAMPLE_CHUNK]; | |
| 237 | int remaining = samples; | |
| 238 | ||
| 239 | /* loop while we have samples remaining */ | |
| 240 | while (remaining) | |
| 241 | { | |
| 242 | int samples = (remaining > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : remaining; | |
| 243 | int samp; | |
| 244 | ||
| 245 | generate_adpcm(chip, voice, sample_data, samples); | |
| 246 | for (samp = 0; samp < samples; samp++) | |
| 247 | *buffer++ += sample_data[samp]; | |
| 248 | ||
| 249 | remaining -= samples; | |
| 250 | } | |
| 251 | } | |
| 252 | } | |
| 253 | ||
| 254 | ||
| 255 | ||
| 256 | /********************************************************************************************** | |
| 257 | ||
| 258 | state save support for MAME | |
| 259 | ||
| 260 | ***********************************************************************************************/ | |
| 261 | ||
| 262 | static void adpcm_state_save_register(struct ADPCMVoice *voice, const device_config *device, int index) | |
| 263 | { | |
| 264 | state_save_register_device_item(device, index, voice->playing); | |
| 265 | state_save_register_device_item(device, index, voice->sample); | |
| 266 | state_save_register_device_item(device, index, voice->count); | |
| 267 | state_save_register_device_item(device, index, voice->signal); | |
| 268 | state_save_register_device_item(device, index, voice->step); | |
| 269 | state_save_register_device_item(device, index, voice->volume); | |
| 270 | state_save_register_device_item(device, index, voice->base_offset); | |
| 271 | } | |
| 272 | ||
| 273 | static void okim6376_state_save_register(struct okim6376 *info, const device_config *device) | |
| 274 | { | |
| 275 | int j; | |
| 276 | ||
| 277 | state_save_register_device_item(device, 0, info->command); | |
| 278 | for (j = 0; j < OKIM6376_VOICES; j++) | |
| 279 | adpcm_state_save_register(&info->voice[j], device, j); | |
| 280 | } | |
| 281 | ||
| 282 | ||
| 283 | ||
| 284 | /********************************************************************************************** | |
| 285 | ||
| 286 | SND_START( okim6376 ) -- start emulation of an OKIM6376-compatible chip | |
| 287 | ||
| 288 | ***********************************************************************************************/ | |
| 289 | ||
| 290 | static SND_START( okim6376 ) | |
| 291 | { | |
| 292 | struct okim6376 *info; | |
| 293 | int voice; | |
| 294 | int divisor = 165; | |
| 295 | ||
| 296 | info = auto_malloc(sizeof(*info)); | |
| 297 | memset(info, 0, sizeof(*info)); | |
| 298 | ||
| 299 | compute_tables(); | |
| 300 | ||
| 301 | info->command = -1; | |
| 302 | info->region_base = device->region; | |
| 303 | info->master_clock = clock; | |
| 304 | ||
| 305 | /* generate the name and create the stream */ | |
| 306 | info->stream = stream_create(device, 0, 1, clock/divisor, info, okim6376_update); | |
| 307 | ||
| 308 | /* initialize the voices */ | |
| 309 | for (voice = 0; voice < OKIM6376_VOICES; voice++) | |
| 310 | { | |
| 311 | /* initialize the rest of the structure */ | |
| 312 | info->voice[voice].volume = 0; | |
| 313 | reset_adpcm(&info->voice[voice]); | |
| 314 | } | |
| 315 | ||
| 316 | okim6376_state_save_register(info, device); | |
| 317 | ||
| 318 | /* success */ | |
| 319 | return info; | |
| 320 | } | |
| 321 | ||
| 322 | ||
| 323 | ||
| 324 | /********************************************************************************************** | |
| 325 | ||
| 326 | SND_RESET( okim6376 ) -- stop emulation of an OKIM6376-compatible chip | |
| 327 | ||
| 328 | ***********************************************************************************************/ | |
| 329 | ||
| 330 | static SND_RESET( okim6376 ) | |
| 331 | { | |
| 332 | struct okim6376 *info = device->token; | |
| 333 | int i; | |
| 334 | ||
| 335 | stream_update(info->stream); | |
| 336 | for (i = 0; i < OKIM6376_VOICES; i++) | |
| 337 | info->voice[i].playing = 0; | |
| 338 | } | |
| 339 | ||
| 340 | ||
| 341 | ||
| 342 | ||
| 343 | /********************************************************************************************** | |
| 344 | ||
| 345 | okim6376_status_r -- read the status port of an OKIM6376-compatible chip | |
| 346 | ||
| 347 | ***********************************************************************************************/ | |
| 348 | ||
| 349 | static int okim6376_status_r(int num) | |
| 350 | { | |
| 351 | struct okim6376 *info = sndti_token(SOUND_OKIM6376, num); | |
| 352 | int i, result; | |
| 353 | ||
| 354 | result = 0xff; | |
| 355 | ||
| 356 | /* set the bit to 1 if something is playing on a given channel */ | |
| 357 | stream_update(info->stream); | |
| 358 | for (i = 0; i < OKIM6376_VOICES; i++) | |
| 359 | { | |
| 360 | struct ADPCMVoice *voice = &info->voice[i]; | |
| 361 | ||
| 362 | /* set the bit if it's playing */ | |
| 363 | if (!voice->playing) | |
| 364 | result ^= 1 << i; | |
| 365 | } | |
| 366 | ||
| 367 | return result; | |
| 368 | } | |
| 369 | ||
| 370 | ||
| 371 | ||
| 372 | /********************************************************************************************** | |
| 373 | ||
| 374 | okim6376_data_w -- write to the data port of an OKIM6376-compatible chip | |
| 375 | ||
| 376 | ***********************************************************************************************/ | |
| 377 | ||
| 378 | static void okim6376_data_w(int num, int data) | |
| 379 | { | |
| 380 | struct okim6376 *info = sndti_token(SOUND_OKIM6376, num); | |
| 381 | ||
| 382 | /* if a command is pending, process the second half */ | |
| 383 | if (info->command != -1) | |
| 384 | { | |
| 385 | int temp = data >> 4, i, start; | |
| 386 | unsigned char *base, *base_end; | |
| 387 | ||
| 388 | ||
| 389 | /* FIX: Check if it's possible to start multiple voices at the same time */ | |
| 390 | if (temp != 0 && temp != 1 && temp != 2) | |
| 391 | popmessage("OKI6376 start %x contact MAMEDEV", temp); | |
| 392 | ||
| 393 | /* update the stream */ | |
| 394 | stream_update(info->stream); | |
| 395 | ||
| 396 | /* determine which voice(s) (voice is set by a 1 bit in the upper 4 bits of the second byte) */ | |
| 397 | for (i = 0; i < OKIM6376_VOICES; i++, temp >>= 1) | |
| 398 | { | |
| 399 | if (temp & 1) | |
| 400 | { | |
| 401 | struct ADPCMVoice *voice = &info->voice[i]; | |
| 402 | ||
| 403 | /* determine the start position, max address space is 16Mbit */ | |
| 404 | base = &info->region_base[info->command * 4]; | |
| 405 | base_end = &info->region_base[(MAX_WORDS+1) * 4]; | |
| 406 | start = ((base[0] << 16) + (base[1] << 8) + base[2]) & 0x1fffff; | |
| 407 | ||
| 408 | if (start == 0) | |
| 409 | { | |
| 410 | voice->playing = 0; | |
| 411 | } | |
| 412 | else | |
| 413 | { | |
| 414 | /* set up the voice to play this sample */ | |
| 415 | if (!voice->playing) | |
| 416 | { | |
| 417 | voice->playing = 1; | |
| 418 | voice->base_offset = start; | |
| 419 | voice->sample = 0; | |
| 420 | voice->count = 0; | |
| 421 | ||
| 422 | /* also reset the ADPCM parameters */ | |
| 423 | reset_adpcm(voice); | |
| 424 | /* FIX: no attenuation for now */ | |
| 425 | voice->volume = volume_table[0]; | |
| 426 | } | |
| 427 | else | |
| 428 | { | |
| 429 | logerror("OKIM6376:%d requested to play sample %02x on non-stopped voice\n",num,info->command); | |
| 430 | } | |
| 431 | } | |
| 432 | } | |
| 433 | } | |
| 434 | ||
| 435 | /* reset the command */ | |
| 436 | info->command = -1; | |
| 437 | } | |
| 438 | ||
| 439 | /* if this is the start of a command, remember the sample number for next time */ | |
| 440 | else if (data & 0x80) | |
| 441 | { | |
| 442 | // FIX: maximum adpcm words are 111, there are other 8 commands to generate BEEP tone (0x70 to 0x77), | |
| 443 | // and others for internal testing, that manual explicitly says not to use (0x78 to 0x7f) | |
| 444 | info->command = data & 0x7f; | |
| 445 | } | |
| 446 | ||
| 447 | /* otherwise, see if this is a silence command */ | |
| 448 | else | |
| 449 | { | |
| 450 | int temp = data >> 3, i; | |
| 451 | ||
| 452 | /* update the stream, then turn it off */ | |
| 453 | stream_update(info->stream); | |
| 454 | ||
| 455 | /* determine which voice(s) (voice is set by a 1 bit in bits 3-6 of the command */ | |
| 456 | for (i = 0; i < OKIM6376_VOICES; i++, temp >>= 1) | |
| 457 | { | |
| 458 | if (temp & 1) | |
| 459 | { | |
| 460 | struct ADPCMVoice *voice = &info->voice[i]; | |
| 461 | ||
| 462 | voice->playing = 0; | |
| 463 | } | |
| 464 | } | |
| 465 | } | |
| 466 | } | |
| 467 | ||
| 468 | ||
| 469 | ||
| 470 | /********************************************************************************************** | |
| 471 | ||
| 472 | okim6376_status_0_r -- generic status read functions | |
| 473 | okim6376_status_1_r | |
| 474 | ||
| 475 | ***********************************************************************************************/ | |
| 476 | ||
| 477 | READ8_HANDLER( okim6376_status_0_r ) | |
| 478 | { | |
| 479 | return okim6376_status_r(0); | |
| 480 | } | |
| 481 | ||
| 482 | READ8_HANDLER( okim6376_status_1_r ) | |
| 483 | { | |
| 484 | return okim6376_status_r(1); | |
| 485 | } | |
| 486 | ||
| 487 | READ8_HANDLER( okim6376_status_2_r ) | |
| 488 | { | |
| 489 | return okim6376_status_r(2); | |
| 490 | } | |
| 491 | ||
| 492 | READ16_HANDLER( okim6376_status_0_lsb_r ) | |
| 493 | { | |
| 494 | return okim6376_status_r(0); | |
| 495 | } | |
| 496 | ||
| 497 | READ16_HANDLER( okim6376_status_1_lsb_r ) | |
| 498 | { | |
| 499 | return okim6376_status_r(1); | |
| 500 | } | |
| 501 | ||
| 502 | READ16_HANDLER( okim6376_status_2_lsb_r ) | |
| 503 | { | |
| 504 | return okim6376_status_r(2); | |
| 505 | } | |
| 506 | ||
| 507 | READ16_HANDLER( okim6376_status_0_msb_r ) | |
| 508 | { | |
| 509 | return okim6376_status_r(0) << 8; | |
| 510 | } | |
| 511 | ||
| 512 | READ16_HANDLER( okim6376_status_1_msb_r ) | |
| 513 | { | |
| 514 | return okim6376_status_r(1) << 8; | |
| 515 | } | |
| 516 | ||
| 517 | READ16_HANDLER( okim6376_status_2_msb_r ) | |
| 518 | { | |
| 519 | return okim6376_status_r(2) << 8; | |
| 520 | } | |
| 521 | ||
| 522 | ||
| 523 | ||
| 524 | /********************************************************************************************** | |
| 525 | ||
| 526 | okim6376_data_0_w -- generic data write functions | |
| 527 | okim6376_data_1_w | |
| 528 | ||
| 529 | ***********************************************************************************************/ | |
| 530 | ||
| 531 | WRITE8_HANDLER( okim6376_data_0_w ) | |
| 532 | { | |
| 533 | okim6376_data_w(0, data); | |
| 534 | } | |
| 535 | ||
| 536 | WRITE8_HANDLER( okim6376_data_1_w ) | |
| 537 | { | |
| 538 | okim6376_data_w(1, data); | |
| 539 | } | |
| 540 | ||
| 541 | WRITE8_HANDLER( okim6376_data_2_w ) | |
| 542 | { | |
| 543 | okim6376_data_w(2, data); | |
| 544 | } | |
| 545 | ||
| 546 | WRITE16_HANDLER( okim6376_data_0_lsb_w ) | |
| 547 | { | |
| 548 | if (ACCESSING_BITS_0_7) | |
| 549 | okim6376_data_w(0, data & 0xff); | |
| 550 | } | |
| 551 | ||
| 552 | WRITE16_HANDLER( okim6376_data_1_lsb_w ) | |
| 553 | { | |
| 554 | if (ACCESSING_BITS_0_7) | |
| 555 | okim6376_data_w(1, data & 0xff); | |
| 556 | } | |
| 557 | ||
| 558 | WRITE16_HANDLER( okim6376_data_2_lsb_w ) | |
| 559 | { | |
| 560 | if (ACCESSING_BITS_0_7) | |
| 561 | okim6376_data_w(2, data & 0xff); | |
| 562 | } | |
| 563 | ||
| 564 | WRITE16_HANDLER( okim6376_data_0_msb_w ) | |
| 565 | { | |
| 566 | if (ACCESSING_BITS_8_15) | |
| 567 | okim6376_data_w(0, data >> 8); | |
| 568 | } | |
| 569 | ||
| 570 | WRITE16_HANDLER( okim6376_data_1_msb_w ) | |
| 571 | { | |
| 572 | if (ACCESSING_BITS_8_15) | |
| 573 | okim6376_data_w(1, data >> 8); | |
| 574 | } | |
| 575 | ||
| 576 | WRITE16_HANDLER( okim6376_data_2_msb_w ) | |
| 577 | { | |
| 578 | if (ACCESSING_BITS_8_15) | |
| 579 | okim6376_data_w(2, data >> 8); | |
| 580 | } | |
| 581 | ||
| 582 | ||
| 583 | ||
| 584 | /************************************************************************** | |
| 585 | * Generic get_info | |
| 586 | **************************************************************************/ | |
| 587 | ||
| 588 | static SND_SET_INFO( okim6376 ) | |
| 589 | { | |
| 590 | switch (state) | |
| 591 | { | |
| 592 | /* no parameters to set */ | |
| 593 | } | |
| 594 | } | |
| 595 | ||
| 596 | ||
| 597 | SND_GET_INFO( okim6376 ) | |
| 598 | { | |
| 599 | switch (state) | |
| 600 | { | |
| 601 | /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 602 | ||
| 603 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 604 | case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( okim6376 ); break; | |
| 605 | case SNDINFO_PTR_START: info->start = SND_START_NAME( okim6376 ); break; | |
| 606 | case SNDINFO_PTR_STOP: /* nothing */ break; | |
| 607 | case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( okim6376 ); break; | |
| 608 | ||
| 609 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 610 | case SNDINFO_STR_NAME: strcpy(info->s, "OKI6376"); break; | |
| 611 | case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "OKI ADPCM"); break; | |
| 612 | case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break; | |
| 613 | case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break; | |
| 614 | case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break; | |
| 615 | } | |
| 616 | } | |
| 617 |
| r4135 | r4136 | |
|---|---|---|
| 61 | 61 | static int diff_lookup[49*16]; |
| 62 | 62 | |
| 63 | 63 | /* volume lookup table. The manual lists only 9 steps, ~3dB per step. Given the dB values, |
| 64 | that seems to map to a 5-bit volume control. What happens for steps after the 9th is not | |
| 65 | known, we arbitrarily assign a "1" to all those steps. */ | |
| 66 | static int volume_table[16] = | |
| 64 | that seems to map to a 5-bit volume control. Any volume parameter beyond the 9th index | |
| 65 | results in silent playback. */ | |
| 66 | static const int volume_table[16] = | |
| 67 | 67 | { |
| 68 | 68 | 0x20, // 0 dB |
| 69 | 69 | 0x16, // -3.2 dB |
| r4135 | r4136 | |
| 74 | 74 | 0x04, // -18.0 dB |
| 75 | 75 | 0x03, // -20.5 dB |
| 76 | 76 | 0x02, // -24.0 dB |
| 77 | 0x01, // unknown | |
| 78 | 0x01, // unknown | |
| 79 | 0x01, // unknown | |
| 80 | 0x01, // unknown | |
| 81 | 0x01, // unknown | |
| 82 | 0x01, // unknown | |
| 83 | 0x01, // unknown | |
| 77 | 0x00, | |
| 78 | 0x00, | |
| 79 | 0x00, | |
| 80 | 0x00, | |
| 81 | 0x00, | |
| 82 | 0x00, | |
| 83 | 0x00, | |
| 84 | 84 | }; |
| 85 | 85 | |
| 86 | 86 | /* tables computed? */ |
| r4135 | r4136 | |
| 482 | 482 | /* also reset the ADPCM parameters */ |
| 483 | 483 | reset_adpcm(&voice->adpcm); |
| 484 | 484 | voice->volume = volume_table[data & 0x0f]; |
| 485 | ||
| 486 | /* the manual only lists 9 volume steps */ | |
| 487 | if ((data & 0x0f) >= 9) | |
| 488 | popmessage("OKI6295 volume %x contact MAMEDEV", data & 0x0f); | |
| 489 | 485 | } |
| 490 | 486 | else |
| 491 | 487 | { |
| r4135 | r4136 | |
|---|---|---|
| 38 | 38 | WRITE8_HANDLER( ym2608_data_port_1_b_w ); |
| 39 | 39 | |
| 40 | 40 | SND_GET_INFO( ym2608 ); |
| 41 | #define SOUND_YM2608 SND_GET_INFO_NAME( ym2608 ) | |
| 41 | 42 | |
| 42 | 43 | #endif /* __2608INTF_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 821 | 821 | |
| 822 | 822 | ***********************************************************************************************/ |
| 823 | 823 | |
| 824 | static void *es5506_start_common(const device_config *device, int | |
| 824 | static void *es5506_start_common(const device_config *device, int | |
| 825 | 825 | { |
| 826 | 826 | const es5506_interface *intf = config; |
| 827 | 827 | struct ES5506Chip *chip; |
| r4135 | r4136 | |
| 876 | 876 | |
| 877 | 877 | static SND_START( es5506 ) |
| 878 | 878 | { |
| 879 | return es5506_start_common(device, | |
| 879 | return es5506_start_common(device, | |
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | |
| r4135 | r4136 | |
| 1513 | 1513 | es5506intf.irq_callback = intf->irq_callback; |
| 1514 | 1514 | es5506intf.read_port = intf->read_port; |
| 1515 | 1515 | |
| 1516 | return es5506_start_common(device, | |
| 1516 | return es5506_start_common(device, | |
| 1517 | 1517 | } |
| 1518 | 1518 | |
| 1519 | 1519 |
| r0 | r4136 | |
|---|---|---|
| 1 | #pragma once | |
| 2 | ||
| 3 | #ifndef __OKIM6376_H__ | |
| 4 | #define __OKIM6376_H__ | |
| 5 | ||
| 6 | /* an interface for the OKIM6376 and similar chips */ | |
| 7 | ||
| 8 | READ8_HANDLER( okim6376_status_0_r ); | |
| 9 | READ8_HANDLER( okim6376_status_1_r ); | |
| 10 | READ8_HANDLER( okim6376_status_2_r ); | |
| 11 | READ16_HANDLER( okim6376_status_0_lsb_r ); | |
| 12 | READ16_HANDLER( okim6376_status_1_lsb_r ); | |
| 13 | READ16_HANDLER( okim6376_status_2_lsb_r ); | |
| 14 | READ16_HANDLER( okim6376_status_0_msb_r ); | |
| 15 | READ16_HANDLER( okim6376_status_1_msb_r ); | |
| 16 | READ16_HANDLER( okim6376_status_2_msb_r ); | |
| 17 | WRITE8_HANDLER( okim6376_data_0_w ); | |
| 18 | WRITE8_HANDLER( okim6376_data_1_w ); | |
| 19 | WRITE8_HANDLER( okim6376_data_2_w ); | |
| 20 | WRITE16_HANDLER( okim6376_data_0_lsb_w ); | |
| 21 | WRITE16_HANDLER( okim6376_data_1_lsb_w ); | |
| 22 | WRITE16_HANDLER( okim6376_data_2_lsb_w ); | |
| 23 | WRITE16_HANDLER( okim6376_data_0_msb_w ); | |
| 24 | WRITE16_HANDLER( okim6376_data_1_msb_w ); | |
| 25 | WRITE16_HANDLER( okim6376_data_2_msb_w ); | |
| 26 | ||
| 27 | SND_GET_INFO( okim6376 ); | |
| 28 | #define SOUND_OKIM6376 SND_GET_INFO_NAME( okim6376 ) | |
| 29 | ||
| 30 | #endif /* __OKIM6376_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 56 | 56 | INT16 clock_adpcm(struct adpcm_state *state, UINT8 nibble); |
| 57 | 57 | |
| 58 | 58 | SND_GET_INFO( okim6295 ); |
| 59 | #define SOUND_OKIM6295 SND_GET_INFO_NAME( okim6295 ) | |
| 59 | 60 | |
| 60 | 61 | #endif /* __OKIM6295_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 28 | 28 | void es5505_voice_bank_1_w(int voice, int bank); |
| 29 | 29 | |
| 30 | 30 | SND_GET_INFO( es5505 ); |
| 31 | #define SOUND_ES5505 SND_GET_INFO_NAME( es5505 ) | |
| 31 | 32 | |
| 32 | 33 | |
| 33 | 34 | typedef struct _es5506_interface es5506_interface; |
| r4135 | r4136 | |
| 55 | 56 | void es5506_voice_bank_1_w(int voice, int bank); |
| 56 | 57 | |
| 57 | 58 | SND_GET_INFO( es5506 ); |
| 59 | #define SOUND_ES5506 SND_GET_INFO_NAME( es5506 ) | |
| 58 | 60 | |
| 59 | 61 | #endif /* __ES5506_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 128 | 128 | INT32 mix_level[8]; |
| 129 | 129 | |
| 130 | 130 | sound_stream * stream; |
| 131 | int index; | |
| 132 | 131 | } YMF278BChip; |
| 133 | 132 | |
| 134 | 133 | static INT32 *mix; |
| r4135 | r4136 | |
| 675 | 674 | |
| 676 | 675 | chip = auto_malloc(sizeof(*chip)); |
| 677 | 676 | memset(chip, 0, sizeof(*chip)); |
| 678 | chip->index = sndindex; | |
| 679 | 677 | |
| 680 | 678 | intf = (config != NULL) ? config : &defintrf; |
| 681 | 679 |
| r4135 | r4136 | |
|---|---|---|
| 31 | 31 | WRITE8_HANDLER( ymf278b_data_port_1_c_w ); |
| 32 | 32 | |
| 33 | 33 | SND_GET_INFO( ymf278b ); |
| 34 | #define SOUND_YMF278B SND_GET_INFO_NAME( ymf278b ) | |
| 34 | 35 | |
| 35 | 36 | #endif /* __YMF278B_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 34 | 34 | |
| 35 | 35 | SND_GET_INFO( sid6581 ); |
| 36 | 36 | SND_GET_INFO( sid8580 ); |
| 37 | #define SOUND_SID6581 SND_GET_INFO_NAME( sid6581 ) | |
| 38 | #define SOUND_SID8580 SND_GET_INFO_NAME( sid8580 ) | |
| 37 | 39 | |
| 38 | 40 | #endif /* __SID6581_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 254 | 254 | switch (state) |
| 255 | 255 | { |
| 256 | 256 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 257 | case SNDINFO_ | |
| 257 | case SNDINFO_FCT_ALIAS: info->type = SOUND_TMS5220; break; | |
| 258 | 258 | |
| 259 | 259 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 260 | 260 | case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( tms5220 ); break; |
| r4135 | r4136 | |
|---|---|---|
| 17 | 17 | #define BASE_SHIFT 16 |
| 18 | 18 | |
| 19 | 19 | struct k053260_channel_def { |
| 20 | unsigned long rate; | |
| 21 | unsigned long size; | |
| 22 | unsigned long start; | |
| 23 | unsigned long bank; | |
| 24 | unsigned long volume; | |
| 20 | UINT32 rate; | |
| 21 | UINT32 size; | |
| 22 | UINT32 start; | |
| 23 | UINT32 bank; | |
| 24 | UINT32 volume; | |
| 25 | 25 | int play; |
| 26 | unsigned long pan; | |
| 27 | unsigned long pos; | |
| 26 | UINT32 pan; | |
| 27 | UINT32 pos; | |
| 28 | 28 | int loop; |
| 29 | 29 | int ppcm; /* packed PCM ( 4 bit signed ) */ |
| 30 | 30 | int ppcm_data; |
| r4135 | r4136 | |
| 33 | 33 | sound_stream * channel; |
| 34 | 34 | int mode; |
| 35 | 35 | int regs[0x30]; |
| 36 | | |
| 36 | UINT8 | |
| 37 | 37 | int rom_size; |
| 38 | | |
| 38 | UINT32 | |
| 39 | 39 | struct k053260_channel_def channels[4]; |
| 40 | 40 | const k053260_interface *intf; |
| 41 | 41 | const device_config *device; |
| r4135 | r4136 | |
| 46 | 46 | int i; |
| 47 | 47 | double base = ( double )rate; |
| 48 | 48 | double max = (double)(clock); /* Hz */ |
| 49 | | |
| 49 | UINT32 | |
| 50 | 50 | |
| 51 | 51 | for( i = 0; i < 0x1000; i++ ) { |
| 52 | 52 | double v = ( double )( 0x1000 - i ); |
| r4135 | r4136 | |
| 55 | 55 | |
| 56 | 56 | if ( target && base ) { |
| 57 | 57 | target = fixed / ( base / target ); |
| 58 | val = ( | |
| 58 | val = ( UINT32 | |
| 59 | 59 | if ( val == 0 ) |
| 60 | 60 | val = 1; |
| 61 | 61 | } else |
| r4135 | r4136 | |
| 105 | 105 | |
| 106 | 106 | int i, j, lvol[4], rvol[4], play[4], loop[4], ppcm_data[4], ppcm[4]; |
| 107 | 107 | unsigned char *rom[4]; |
| 108 | | |
| 108 | UINT32 | |
| 109 | 109 | int dataL, dataR; |
| 110 | 110 | signed char d; |
| 111 | 111 | struct k053260_chip_def *ic = param; |
| r4135 | r4136 | |
| 227 | 227 | for ( i = 0; i < 0x30; i++ ) |
| 228 | 228 | ic->regs[i] = 0; |
| 229 | 229 | |
| 230 | ic->delta_table = ( | |
| 230 | ic->delta_table = ( UINT32 | |
| 231 | 231 | |
| 232 | 232 | ic->channel = stream_create( device, 0, 2, rate, ic, k053260_update ); |
| 233 | 233 | |
| r4135 | r4136 | |
| 258 | 258 | |
| 259 | 259 | ic->channels[channel].size = ic->rom_size - channel_start; |
| 260 | 260 | } |
| 261 | if (LOG) logerror("K053260: Sample Start = %06x, Sample End = %06x, Sample rate = %04 | |
| 261 | if (LOG) logerror("K053260: Sample Start = %06x, Sample End = %06x, Sample rate = %04 | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | static void k053260_write( const address_space *space, offs_t offset, UINT8 data, int chip ) |
| r4135 | r4136 | |
| 395 | 395 | break; |
| 396 | 396 | |
| 397 | 397 | case 0x2e: /* read rom */ |
| 398 | if ( ic->mode & 1 ) { | |
| 399 | unsigned int offs = ic->channels[0].start + ( ic->channels[0].pos >> BASE_SHIFT ) + ( ic->channels[0].bank << 16 ); | |
| 398 | if ( ic->mode & 1 ) | |
| 399 | { | |
| 400 | UINT32 offs = ic->channels[0].start + ( ic->channels[0].pos >> BASE_SHIFT ) + ( ic->channels[0].bank << 16 ); | |
| 400 | 401 | |
| 401 | 402 | ic->channels[0].pos += ( 1 << 16 ); |
| 402 | 403 |
| r4135 | r4136 | |
|---|---|---|
| 6 | 6 | void flt_volume_set_volume(int num, float volume); |
| 7 | 7 | |
| 8 | 8 | SND_GET_INFO( filter_volume ); |
| 9 | #define SOUND_FILTER_VOLUME SND_GET_INFO_NAME( filter_volume ) | |
| 9 | 10 | |
| 10 | 11 | #endif /* __FLT_VOL_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 34 | 34 | SND_GET_INFO( tmc0285 ); |
| 35 | 35 | SND_GET_INFO( tms5200 ); |
| 36 | 36 | |
| 37 | #define SOUND_TMS5220 SND_GET_INFO_NAME( tms5220 ) | |
| 38 | #define SOUND_TMC0285 SND_GET_INFO_NAME( tmc0285 ) | |
| 39 | #define SOUND_TMS5200 SND_GET_INFO_NAME( tms5200 ) | |
| 40 | ||
| 37 | 41 | #endif /* __5200INTF_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 38 | 38 | WRITE16_HANDLER( ym2151_data_port_2_lsb_w ); |
| 39 | 39 | |
| 40 | 40 | SND_GET_INFO( ym2151 ); |
| 41 | #define SOUND_YM2151 SND_GET_INFO_NAME( ym2151 ) | |
| 41 | 42 | |
| 42 | 43 | #endif /* __2151INTF_H__ */ |
| 43 | 44 |
| r4135 | r4136 | |
|---|---|---|
| 336 | 336 | |
| 337 | 337 | |
| 338 | 338 | #------------------------------------------------- |
| 339 | # National Semiconductor Digitalker | |
| 340 | #------------------------------------------------- | |
| 341 | ||
| 342 | SOUNDDEFS += -DHAS_DIGITALKER=$(if $(filter DIGITALKER,$(SOUNDS)),1,0) | |
| 343 | ||
| 344 | ifneq ($(filter DIGITALKER,$(SOUNDS)),) | |
| 345 | SOUNDOBJS += $(SOUNDOBJ)/digitalk.o | |
| 346 | endif | |
| 347 | ||
| 348 | ||
| 349 | ||
| 350 | #------------------------------------------------- | |
| 339 | 351 | # Nintendo custom sound chips |
| 340 | 352 | #------------------------------------------------- |
| 341 | 353 | |
| r4135 | r4136 | |
| 365 | 377 | |
| 366 | 378 | SOUNDDEFS += -DHAS_MSM5205=$(if $(filter MSM5205,$(SOUNDS)),1,0) |
| 367 | 379 | SOUNDDEFS += -DHAS_MSM5232=$(if $(filter MSM5232,$(SOUNDS)),1,0) |
| 380 | SOUNDDEFS += -DHAS_OKIM6376=$(if $(filter OKIM6376,$(SOUNDS)),1,0) | |
| 368 | 381 | SOUNDDEFS += -DHAS_OKIM6295=$(if $(filter OKIM6295,$(SOUNDS)),1,0) |
| 369 | 382 | SOUNDDEFS += -DHAS_OKIM6258=$(if $(filter OKIM6258,$(SOUNDS)),1,0) |
| 370 | 383 | |
| r4135 | r4136 | |
| 376 | 389 | SOUNDOBJS += $(SOUNDOBJ)/msm5232.o |
| 377 | 390 | endif |
| 378 | 391 | |
| 392 | ifneq ($(filter OKIM6376,$(SOUNDS)),) | |
| 393 | SOUNDOBJS += $(SOUNDOBJ)/okim6376.o | |
| 394 | endif | |
| 395 | ||
| 379 | 396 | ifneq ($(filter OKIM6295,$(SOUNDS)),) |
| 380 | 397 | SOUNDOBJS += $(SOUNDOBJ)/okim6295.o |
| 381 | 398 | endif |
| r4135 | r4136 | |
|---|---|---|
| 28 | 28 | }; |
| 29 | 29 | |
| 30 | 30 | SND_GET_INFO( psxspu ); |
| 31 | #define SOUND_PSXSPU SND_GET_INFO_NAME( psxspu ) | |
| 31 | 32 | |
| 32 | 33 | #endif /* __SOUND_PSX_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 26 | 26 | READ16_HANDLER( k053260_1_lsb_r ); |
| 27 | 27 | |
| 28 | 28 | SND_GET_INFO( k053260 ); |
| 29 | #define SOUND_K053260 SND_GET_INFO_NAME( k053260 ) | |
| 29 | 30 | |
| 30 | 31 | #endif /* __K053260_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 25 | 25 | WRITE16_HANDLER( ym2413_data_port_3_lsb_w ); |
| 26 | 26 | |
| 27 | 27 | SND_GET_INFO( ym2413 ); |
| 28 | #define SOUND_YM2413 SND_GET_INFO_NAME( ym2413 ) | |
| 28 | 29 | |
| 29 | 30 | #endif /* __2413INTF_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 24 | 24 | READ8_HANDLER( sega_pcm_r ); |
| 25 | 25 | |
| 26 | 26 | SND_GET_INFO( segapcm ); |
| 27 | #define SOUND_SEGAPCM SND_GET_INFO_NAME( segapcm ) | |
| 27 | 28 | |
| 28 | 29 | #endif /* __SEGAPCM_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | WRITE32_HANDLER(vr0_snd_write); |
| 17 | 17 | |
| 18 | 18 | SND_GET_INFO( vrender0 ); |
| 19 | #define SOUND_VRENDER0 SND_GET_INFO_NAME( vrender0 ) | |
| 19 | 20 | |
| 20 | 21 | #endif /* __VRENDER0_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 11 | 11 | void multi_pcm_set_bank(int which, UINT32 leftoffs, UINT32 rightoffs); |
| 12 | 12 | |
| 13 | 13 | SND_GET_INFO( multipcm ); |
| 14 | #define SOUND_MULTIPCM SND_GET_INFO_NAME( multipcm ) | |
| 14 | 15 | |
| 15 | 16 | #endif /* __MULTIPCM_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 34 | 34 | SND_GET_INFO( namco_15xx ); |
| 35 | 35 | SND_GET_INFO( namco_cus30 ); |
| 36 | 36 | |
| 37 | #define SOUND_NAMCO SND_GET_INFO_NAME( namco ) | |
| 38 | #define SOUND_NAMCO_15XX SND_GET_INFO_NAME( namco_15xx ) | |
| 39 | #define SOUND_NAMCO_CUS30 SND_GET_INFO_NAME( namco_cus30 ) | |
| 40 | ||
| 41 | ||
| 37 | 42 | #endif /* __NAMCO_H__ */ |
| 38 | 43 |
| r4135 | r4136 | |
|---|---|---|
| 125 | 125 | void sn76477_pitch_voltage_w(int chip, double data); |
| 126 | 126 | |
| 127 | 127 | SND_GET_INFO( sn76477 ); |
| 128 | #define SOUND_SN76477 SND_GET_INFO_NAME( sn76477 ) | |
| 128 | 129 | |
| 129 | 130 | #endif/* __SN76477_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 298 | 298 | switch (state) |
| 299 | 299 | { |
| 300 | 300 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 301 | case SNDINFO_ | |
| 301 | case SNDINFO_FCT_ALIAS: info->type = SOUND_TMS5110; break; | |
| 302 | 302 | |
| 303 | 303 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 304 | 304 | case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( tms5110 ); break; |
| r4135 | r4136 | |
|---|---|---|
| 24 | 24 | void vlm5030_st(int pin ); |
| 25 | 25 | |
| 26 | 26 | SND_GET_INFO( vlm5030 ); |
| 27 | #define SOUND_VLM5030 SND_GET_INFO_NAME( vlm5030 ) | |
| 27 | 28 | |
| 28 | 29 | #endif /* __VLM5030_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 30 | 30 | SND_GET_INFO( cd2802 ); |
| 31 | 31 | SND_GET_INFO( m58817 ); |
| 32 | 32 | |
| 33 | #define SOUND_TMS5110 SND_GET_INFO_NAME( tms5110 ) | |
| 34 | #define SOUND_TMS5100 SND_GET_INFO_NAME( tms5100 ) | |
| 35 | #define SOUND_TMS5110A SND_GET_INFO_NAME( tms5110a ) | |
| 36 | #define SOUND_CD2801 SND_GET_INFO_NAME( cd2801 ) | |
| 37 | #define SOUND_TMC0281 SND_GET_INFO_NAME( tmc0281 ) | |
| 38 | #define SOUND_CD2802 SND_GET_INFO_NAME( cd2802 ) | |
| 39 | #define SOUND_M58817 SND_GET_INFO_NAME( m58817 ) | |
| 40 | ||
| 33 | 41 | #endif /* __5110INTF_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 67 | 67 | WRITE8_HANDLER( ym2203_word_1_w ); |
| 68 | 68 | |
| 69 | 69 | SND_GET_INFO( ym2203 ); |
| 70 | #define SOUND_YM2203 SND_GET_INFO_NAME( ym2203 ) | |
| 70 | 71 | |
| 71 | 72 | #endif /* __2203INTF_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 33 | 33 | void k007232_set_volume(int chip,int channel,int volumeA,int volumeB); |
| 34 | 34 | |
| 35 | 35 | SND_GET_INFO( k007232 ); |
| 36 | #define SOUND_K007232 SND_GET_INFO_NAME( k007232 ) | |
| 36 | 37 | |
| 37 | 38 | #endif /* __K007232_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 64 | 64 | |
| 65 | 65 | UINT8 *docram; |
| 66 | 66 | |
| 67 | int index; | |
| 68 | 67 | sound_stream * stream; |
| 69 | 68 | |
| 70 | 69 | void (*irq_callback)(running_machine *machine, int); // IRQ callback |
| r4135 | r4136 | |
| 232 | 231 | |
| 233 | 232 | chip = auto_malloc(sizeof(*chip)); |
| 234 | 233 | memset(chip, 0, sizeof(*chip)); |
| 235 | chip->index = sndindex; | |
| 236 | 234 | |
| 237 | 235 | intf = config; |
| 238 | 236 | |
| r4135 | r4136 | |
| 289 | 287 | { |
| 290 | 288 | case 0: // freq lo |
| 291 | 289 | return (chip->oscillators[osc].freq & 0xff); |
| 292 | break; | |
| 293 | 290 | |
| 294 | 291 | case 0x20: // freq hi |
| 295 | 292 | return (chip->oscillators[osc].freq >> 8); |
| 296 | break; | |
| 297 | 293 | |
| 298 | 294 | case 0x40: // volume |
| 299 | 295 | return chip->oscillators[osc].vol; |
| 300 | break; | |
| 301 | 296 | |
| 302 | 297 | case 0x60: // data |
| 303 | 298 | return chip->oscillators[osc].data; |
| 304 | break; | |
| 305 | 299 | |
| 306 | 300 | case 0x80: // wavetable pointer |
| 307 | 301 | return (chip->oscillators[osc].wavetblpointer>>8) & 0xff; |
| 308 | break; | |
| 309 | 302 | |
| 310 | 303 | case 0xa0: // oscillator control |
| 311 | 304 | return chip->oscillators[osc].control; |
| 312 | break; | |
| 313 | 305 | |
| 314 | 306 | case 0xc0: // bank select / wavetable size / resolution |
| 315 | 307 | retval = 0; |
| r4135 | r4136 | |
| 321 | 313 | retval |= (chip->oscillators[osc].wavetblsize<<3); |
| 322 | 314 | retval |= chip->oscillators[osc].resolution; |
| 323 | 315 | return retval; |
| 324 | break; | |
| 325 | 316 | } |
| 326 | 317 | } |
| 327 | 318 | else // global registers |
| r4135 | r4136 | |
| 366 | 357 | } |
| 367 | 358 | |
| 368 | 359 | return retval; |
| 369 | break; | |
| 370 | 360 | |
| 371 | 361 | case 0xe1: // oscillator enable |
| 372 | 362 | return chip->oscsenabled<<1; |
| 373 | break; | |
| 374 | 363 | |
| 375 | 364 | case 0xe2: // A/D converter |
| 376 | 365 | if (chip->adc_read) |
| r4135 | r4136 | |
|---|---|---|
| 46 | 46 | WRITE16_HANDLER( okim6258_ctrl_0_lsb_w ); |
| 47 | 47 | |
| 48 | 48 | SND_GET_INFO( okim6258 ); |
| 49 | #define SOUND_OKIM6258 SND_GET_INFO_NAME( okim6258 ) | |
| 49 | 50 | |
| 50 | 51 | #endif /* __OKIM6258_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | void es5503_set_base_0(UINT8 *wavemem); |
| 17 | 17 | |
| 18 | 18 | SND_GET_INFO( es5503 ); |
| 19 | #define SOUND_ES5503 SND_GET_INFO_NAME( es5503 ) | |
| 19 | 20 | |
| 20 | 21 | #endif /* __ES5503_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 11 | 11 | READ16_HANDLER(nile_sndctrl_r); |
| 12 | 12 | |
| 13 | 13 | SND_GET_INFO( nile ); |
| 14 | #define SOUND_NILE SND_GET_INFO_NAME( nile ) | |
| 14 | 15 | |
| 15 | 16 | #endif /* __NILE_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 191 | 191 | switches = 0; |
| 192 | 192 | for (curmem = 0; curmem < ARRAY_LENGTH(global_profiler.data); curmem++) |
| 193 | 193 | switches += global_profiler.data[curmem].context_switches; |
| 194 | astring_catprintf(string, "%d CPU switches\n", switches / ARRAY_LENGTH(global_profiler.data)); | |
| 194 | astring_catprintf(string, "%d CPU switches\n", switches / (int) ARRAY_LENGTH(global_profiler.data)); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | profiler_mark(PROFILER_END); |
| r4135 | r4136 | |
|---|---|---|
| 41 | 41 | sound_type sndtype; /* type index of this sound chip */ |
| 42 | 42 | sound_type aliastype; /* aliased type index of this sound chip */ |
| 43 | 43 | device_config * device; /* dummy device for now */ |
| 44 | const char * tag; /* tag this sound chip */ | |
| 45 | 44 | int index; /* index of this sound chip */ |
| 46 | int clock; /* clock for this sound chip */ | |
| 47 | 45 | }; |
| 48 | 46 | |
| 49 | 47 | |
| 50 | 48 | |
| 51 | 49 | /*************************************************************************** |
| 52 | PROTOTYPES FOR ALL SND ENTRY POINTS | |
| 53 | ***************************************************************************/ | |
| 54 | ||
| 55 | static SND_GET_INFO( dummy_sound ); | |
| 56 | SND_GET_INFO( custom ); | |
| 57 | SND_GET_INFO( samples ); | |
| 58 | SND_GET_INFO( dac ); | |
| 59 | SND_GET_INFO( dmadac ); | |
| 60 | SND_GET_INFO( discrete ); | |
| 61 | SND_GET_INFO( ay8910 ); | |
| 62 | SND_GET_INFO( ay8912 ); | |
| 63 | SND_GET_INFO( ay8913 ); | |
| 64 | SND_GET_INFO( ay8930 ); | |
| 65 | SND_GET_INFO( ym2149 ); | |
| 66 | SND_GET_INFO( ym3439 ); | |
| 67 | SND_GET_INFO( ymz284 ); | |
| 68 | SND_GET_INFO( ymz294 ); | |
| 69 | SND_GET_INFO( ym2203 ); | |
| 70 | SND_GET_INFO( ym2151 ); | |
| 71 | SND_GET_INFO( ym2608 ); | |
| 72 | SND_GET_INFO( ym2610 ); | |
| 73 | SND_GET_INFO( ym2610b ); | |
| 74 | SND_GET_INFO( ym2612 ); | |
| 75 | SND_GET_INFO( ym3438 ); | |
| 76 | SND_GET_INFO( ym2413 ); | |
| 77 | SND_GET_INFO( ym3812 ); | |
| 78 | SND_GET_INFO( ym3526 ); | |
| 79 | SND_GET_INFO( ymz280b ); | |
| 80 | SND_GET_INFO( y8950 ); | |
| 81 | SND_GET_INFO( sn76477 ); | |
| 82 | SND_GET_INFO( sn76489 ); | |
| 83 | SND_GET_INFO( sn76489a ); | |
| 84 | SND_GET_INFO( sn76494 ); | |
| 85 | SND_GET_INFO( sn76496 ); | |
| 86 | SND_GET_INFO( gamegear ); | |
| 87 | SND_GET_INFO( smsiii ); | |
| 88 | SND_GET_INFO( pokey ); | |
| 89 | SND_GET_INFO( nesapu ); | |
| 90 | SND_GET_INFO( astrocade ); | |
| 91 | SND_GET_INFO( namco ); | |
| 92 | SND_GET_INFO( namco_15xx ); | |
| 93 | SND_GET_INFO( namco_cus30 ); | |
| 94 | SND_GET_INFO( namco_52xx ); | |
| 95 | SND_GET_INFO( namco_63701x ); | |
| 96 | SND_GET_INFO( snkwave ); | |
| 97 | SND_GET_INFO( tms36xx ); | |
| 98 | SND_GET_INFO( tms3615 ); | |
| 99 | SND_GET_INFO( tms5100 ); | |
| 100 | SND_GET_INFO( tms5110 ); | |
| 101 | SND_GET_INFO( tms5110a ); | |
| 102 | SND_GET_INFO( cd2801 ); | |
| 103 | SND_GET_INFO( tmc0281 ); | |
| 104 | SND_GET_INFO( cd2802 ); | |
| 105 | SND_GET_INFO( m58817 ); | |
| 106 | SND_GET_INFO( tmc0285 ); | |
| 107 | SND_GET_INFO( tms5200 ); | |
| 108 | SND_GET_INFO( tms5220 ); | |
| 109 | SND_GET_INFO( vlm5030 ); | |
| 110 | SND_GET_INFO( adpcm ); | |
| 111 | SND_GET_INFO( okim6295 ); | |
| 112 | SND_GET_INFO( okim6258 ); | |
| 113 | SND_GET_INFO( msm5205 ); | |
| 114 | SND_GET_INFO( msm5232 ); | |
| 115 | SND_GET_INFO( upd7759 ); | |
| 116 | SND_GET_INFO( hc55516 ); | |
| 117 | SND_GET_INFO( mc3417 ); | |
| 118 | SND_GET_INFO( mc3418 ); | |
| 119 | SND_GET_INFO( k005289 ); | |
| 120 | SND_GET_INFO( k007232 ); | |
| 121 | SND_GET_INFO( k051649 ); | |
| 122 | SND_GET_INFO( k053260 ); | |
| 123 | SND_GET_INFO( k054539 ); | |
| 124 | SND_GET_INFO( segapcm ); | |
| 125 | SND_GET_INFO( rf5c68 ); | |
| 126 | SND_GET_INFO( cem3394 ); | |
| 127 | SND_GET_INFO( c140 ); | |
| 128 | SND_GET_INFO( qsound ); | |
| 129 | SND_GET_INFO( saa1099 ); | |
| 130 | SND_GET_INFO( iremga20 ); | |
| 131 | SND_GET_INFO( es5503 ); | |
| 132 | SND_GET_INFO( es5505 ); | |
| 133 | SND_GET_INFO( es5506 ); | |
| 134 | SND_GET_INFO( bsmt2000 ); | |
| 135 | SND_GET_INFO( ymf262 ); | |
| 136 | SND_GET_INFO( ymf278b ); | |
| 137 | SND_GET_INFO( gaelco_cg1v ); | |
| 138 | SND_GET_INFO( gaelco_gae1 ); | |
| 139 | SND_GET_INFO( x1_010 ); | |
| 140 | SND_GET_INFO( multipcm ); | |
| 141 | SND_GET_INFO( c6280 ); | |
| 142 | SND_GET_INFO( tia ); | |
| 143 | SND_GET_INFO( sp0250 ); | |
| 144 | SND_GET_INFO( scsp ); | |
| 145 | SND_GET_INFO( psxspu ); | |
| 146 | SND_GET_INFO( ymf271 ); | |
| 147 | SND_GET_INFO( cdda ); | |
| 148 | SND_GET_INFO( ics2115 ); | |
| 149 | SND_GET_INFO( st0016 ); | |
| 150 | SND_GET_INFO( nile ); | |
| 151 | SND_GET_INFO( c352 ); | |
| 152 | SND_GET_INFO( vrender0 ); | |
| 153 | SND_GET_INFO( votrax ); | |
| 154 | SND_GET_INFO( es8712 ); | |
| 155 | SND_GET_INFO( rf5c400 ); | |
| 156 | SND_GET_INFO( speaker ); | |
| 157 | SND_GET_INFO( cdp1869 ); | |
| 158 | SND_GET_INFO( beep ); | |
| 159 | SND_GET_INFO( wave ); | |
| 160 | SND_GET_INFO( sid6581 ); | |
| 161 | SND_GET_INFO( sid8580 ); | |
| 162 | SND_GET_INFO( sp0256 ); | |
| 163 | SND_GET_INFO( s14001a ); | |
| 164 | SND_GET_INFO( aica ); | |
| 165 | ||
| 166 | SND_GET_INFO( filter_volume ); | |
| 167 | SND_GET_INFO( filter_rc ); | |
| 168 | ||
| 169 | ||
| 170 | ||
| 171 | /*************************************************************************** | |
| 172 | MASTER SND LIST | |
| 173 | ***************************************************************************/ | |
| 174 | ||
| 175 | static const struct | |
| 176 | { | |
| 177 | sound_type sndtype; | |
| 178 | snd_get_info_func get_info; | |
| 179 | } sndintrf_map[] = | |
| 180 | { | |
| 181 | { SOUND_DUMMY, SND_GET_INFO_NAME( dummy_sound ) }, | |
| 182 | #if (HAS_CUSTOM) | |
| 183 | { SOUND_CUSTOM, SND_GET_INFO_NAME( custom ) }, | |
| 184 | #endif | |
| 185 | #if (HAS_SAMPLES) | |
| 186 | { SOUND_SAMPLES, SND_GET_INFO_NAME( samples ) }, | |
| 187 | #endif | |
| 188 | #if (HAS_DAC) | |
| 189 | { SOUND_DAC, SND_GET_INFO_NAME( dac ) }, | |
| 190 | #endif | |
| 191 | #if (HAS_DMADAC) | |
| 192 | { SOUND_DMADAC, SND_GET_INFO_NAME( dmadac ) }, | |
| 193 | #endif | |
| 194 | #if (HAS_DISCRETE) | |
| 195 | { SOUND_DISCRETE, SND_GET_INFO_NAME( discrete ) }, | |
| 196 | #endif | |
| 197 | #if (HAS_AY8910) | |
| 198 | { SOUND_AY8910, SND_GET_INFO_NAME( ay8910 ) }, | |
| 199 | { SOUND_AY8912, SND_GET_INFO_NAME( ay8912 ) }, | |
| 200 | { SOUND_AY8913, SND_GET_INFO_NAME( ay8913 ) }, | |
| 201 | { SOUND_AY8930, SND_GET_INFO_NAME( ay8930 ) }, | |
| 202 | { SOUND_YM2149, SND_GET_INFO_NAME( ym2149 ) }, | |
| 203 | { SOUND_YM3439, SND_GET_INFO_NAME( ym3439 ) }, | |
| 204 | { SOUND_YMZ284, SND_GET_INFO_NAME( ymz284 ) }, | |
| 205 | { SOUND_YMZ294, SND_GET_INFO_NAME( ymz294 ) }, | |
| 206 | #endif | |
| 207 | #if (HAS_YM2203) | |
| 208 | { SOUND_YM2203, SND_GET_INFO_NAME( ym2203 ) }, | |
| 209 | #endif | |
| 210 | #if (HAS_YM2151) | |
| 211 | { SOUND_YM2151, SND_GET_INFO_NAME( ym2151 ) }, | |
| 212 | #endif | |
| 213 | #if (HAS_YM2608) | |
| 214 | { SOUND_YM2608, SND_GET_INFO_NAME( ym2608 ) }, | |
| 215 | #endif | |
| 216 | #if (HAS_YM2610) | |
| 217 | { SOUND_YM2610, SND_GET_INFO_NAME( ym2610 ) }, | |
| 218 | #endif | |
| 219 | #if (HAS_YM2610B) | |
| 220 | { SOUND_YM2610B, SND_GET_INFO_NAME( ym2610b ) }, | |
| 221 | #endif | |
| 222 | #if (HAS_YM2612) | |
| 223 | { SOUND_YM2612, SND_GET_INFO_NAME( ym2612 ) }, | |
| 224 | #endif | |
| 225 | #if (HAS_YM3438) | |
| 226 | { SOUND_YM3438, SND_GET_INFO_NAME( ym3438 ) }, | |
| 227 | #endif | |
| 228 | #if (HAS_YM2413) | |
| 229 | { SOUND_YM2413, SND_GET_INFO_NAME( ym2413 ) }, | |
| 230 | #endif | |
| 231 | #if (HAS_YM3812) | |
| 232 | { SOUND_YM3812, SND_GET_INFO_NAME( ym3812 ) }, | |
| 233 | #endif | |
| 234 | #if (HAS_YM3526) | |
| 235 | { SOUND_YM3526, SND_GET_INFO_NAME( ym3526 ) }, | |
| 236 | #endif | |
| 237 | #if (HAS_YMZ280B) | |
| 238 | { SOUND_YMZ280B, SND_GET_INFO_NAME( ymz280b ) }, | |
| 239 | #endif | |
| 240 | #if (HAS_Y8950) | |
| 241 | { SOUND_Y8950, SND_GET_INFO_NAME( y8950 ) }, | |
| 242 | #endif | |
| 243 | #if (HAS_SN76477) | |
| 244 | { SOUND_SN76477, SND_GET_INFO_NAME( sn76477 ) }, | |
| 245 | #endif | |
| 246 | #if (HAS_SN76496) | |
| 247 | { SOUND_SN76489, SND_GET_INFO_NAME( sn76489 ) }, | |
| 248 | { SOUND_SN76489A, SND_GET_INFO_NAME( sn76489a ) }, | |
| 249 | { SOUND_SN76494, SND_GET_INFO_NAME( sn76494 ) }, | |
| 250 | { SOUND_SN76496, SND_GET_INFO_NAME( sn76496 ) }, | |
| 251 | { SOUND_GAMEGEAR, SND_GET_INFO_NAME( gamegear ) }, | |
| 252 | { SOUND_SMSIII, SND_GET_INFO_NAME( smsiii ) }, | |
| 253 | #endif | |
| 254 | #if (HAS_POKEY) | |
| 255 | { SOUND_POKEY, SND_GET_INFO_NAME( pokey ) }, | |
| 256 | #endif | |
| 257 | #if (HAS_NES) | |
| 258 | { SOUND_NES, SND_GET_INFO_NAME( nesapu ) }, | |
| 259 | #endif | |
| 260 | #if (HAS_ASTROCADE) | |
| 261 | { SOUND_ASTROCADE, SND_GET_INFO_NAME( astrocade ) }, | |
| 262 | #endif | |
| 263 | #if (HAS_NAMCO) | |
| 264 | { SOUND_NAMCO, SND_GET_INFO_NAME( namco ) }, | |
| 265 | #endif | |
| 266 | #if (HAS_NAMCO_15XX) | |
| 267 | { SOUND_NAMCO_15XX, SND_GET_INFO_NAME( namco_15xx ) }, | |
| 268 | #endif | |
| 269 | #if (HAS_NAMCO_CUS30) | |
| 270 | { SOUND_NAMCO_CUS30, SND_GET_INFO_NAME( namco_cus30 ) }, | |
| 271 | #endif | |
| 272 | #if (HAS_NAMCO_52XX) | |
| 273 | { SOUND_NAMCO_52XX, SND_GET_INFO_NAME( namco_52xx ) }, | |
| 274 | #endif | |
| 275 | #if (HAS_NAMCO_63701X) | |
| 276 | { SOUND_NAMCO_63701X, SND_GET_INFO_NAME( namco_63701x ) }, | |
| 277 | #endif | |
| 278 | #if (HAS_SNKWAVE) | |
| 279 | { SOUND_SNKWAVE, SND_GET_INFO_NAME( snkwave ) }, | |
| 280 | #endif | |
| 281 | #if (HAS_TMS36XX) | |
| 282 | { SOUND_TMS36XX, SND_GET_INFO_NAME( tms36xx ) }, | |
| 283 | #endif | |
| 284 | #if (HAS_TMS3615) | |
| 285 | { SOUND_TMS3615, SND_GET_INFO_NAME( tms3615 ) }, | |
| 286 | #endif | |
| 287 | #if (HAS_TMS5100) | |
| 288 | { SOUND_TMS5100, SND_GET_INFO_NAME( tms5100 ) }, | |
| 289 | #endif | |
| 290 | #if (HAS_TMS5110) | |
| 291 | { SOUND_TMS5110, SND_GET_INFO_NAME( tms5110 ) }, | |
| 292 | #endif | |
| 293 | #if (HAS_TMS5110A) | |
| 294 | { SOUND_TMS5110A, SND_GET_INFO_NAME( tms5110a ) }, | |
| 295 | #endif | |
| 296 | #if (HAS_CD2801) | |
| 297 | { SOUND_CD2801, SND_GET_INFO_NAME( cd2801 ) }, | |
| 298 | #endif | |
| 299 | #if (HAS_TMC0281) | |
| 300 | { SOUND_TMC0281, SND_GET_INFO_NAME( tmc0281 ) }, | |
| 301 | #endif | |
| 302 | #if (HAS_CD2802) | |
| 303 | { SOUND_CD2802, SND_GET_INFO_NAME( cd2802 ) }, | |
| 304 | #endif | |
| 305 | #if (HAS_M58817) | |
| 306 | { SOUND_M58817, SND_GET_INFO_NAME( m58817 ) }, | |
| 307 | #endif | |
| 308 | #if (HAS_TMC0285) | |
| 309 | { SOUND_TMC0285, SND_GET_INFO_NAME( tmc0285 ) }, | |
| 310 | #endif | |
| 311 | #if (HAS_TMS5200) | |
| 312 | { SOUND_TMS5200, SND_GET_INFO_NAME( tms5200 ) }, | |
| 313 | #endif | |
| 314 | #if (HAS_TMS5220) | |
| 315 | { SOUND_TMS5220, SND_GET_INFO_NAME( tms5220 ) }, | |
| 316 | #endif | |
| 317 | #if (HAS_VLM5030) | |
| 318 | { SOUND_VLM5030, SND_GET_INFO_NAME( vlm5030 ) }, | |
| 319 | #endif | |
| 320 | #if (HAS_OKIM6295) | |
| 321 | { SOUND_OKIM6295, SND_GET_INFO_NAME( okim6295 ) }, | |
| 322 | #endif | |
| 323 | #if (HAS_OKIM6258) | |
| 324 | { SOUND_OKIM6258, SND_GET_INFO_NAME( okim6258 ) }, | |
| 325 | #endif | |
| 326 | #if (HAS_MSM5205) | |
| 327 | { SOUND_MSM5205, SND_GET_INFO_NAME( msm5205 ) }, | |
| 328 | #endif | |
| 329 | #if (HAS_MSM5232) | |
| 330 | { SOUND_MSM5232, SND_GET_INFO_NAME( msm5232 ) }, | |
| 331 | #endif | |
| 332 | #if (HAS_UPD7759) | |
| 333 | { SOUND_UPD7759, SND_GET_INFO_NAME( upd7759 ) }, | |
| 334 | #endif | |
| 335 | #if (HAS_HC55516) | |
| 336 | { SOUND_HC55516, SND_GET_INFO_NAME( hc55516 ) }, | |
| 337 | { SOUND_MC3417, SND_GET_INFO_NAME( mc3417 ) }, | |
| 338 | { SOUND_MC3418, SND_GET_INFO_NAME( mc3418 ) }, | |
| 339 | #endif | |
| 340 | #if (HAS_K005289) | |
| 341 | { SOUND_K005289, SND_GET_INFO_NAME( k005289 ) }, | |
| 342 | #endif | |
| 343 | #if (HAS_K007232) | |
| 344 | { SOUND_K007232, SND_GET_INFO_NAME( k007232 ) }, | |
| 345 | #endif | |
| 346 | #if (HAS_K051649) | |
| 347 | { SOUND_K051649, SND_GET_INFO_NAME( k051649 ) }, | |
| 348 | #endif | |
| 349 | #if (HAS_K053260) | |
| 350 | { SOUND_K053260, SND_GET_INFO_NAME( k053260 ) }, | |
| 351 | #endif | |
| 352 | #if (HAS_K054539) | |
| 353 | { SOUND_K054539, SND_GET_INFO_NAME( k054539 ) }, | |
| 354 | #endif | |
| 355 | #if (HAS_SEGAPCM) | |
| 356 | { SOUND_SEGAPCM, SND_GET_INFO_NAME( segapcm ) }, | |
| 357 | #endif | |
| 358 | #if (HAS_RF5C68) | |
| 359 | { SOUND_RF5C68, SND_GET_INFO_NAME( rf5c68 ) }, | |
| 360 | #endif | |
| 361 | #if (HAS_CEM3394) | |
| 362 | { SOUND_CEM3394, SND_GET_INFO_NAME( cem3394 ) }, | |
| 363 | #endif | |
| 364 | #if (HAS_C140) | |
| 365 | { SOUND_C140, SND_GET_INFO_NAME( c140 ) }, | |
| 366 | #endif | |
| 367 | #if (HAS_QSOUND) | |
| 368 | { SOUND_QSOUND, SND_GET_INFO_NAME( qsound ) }, | |
| 369 | #endif | |
| 370 | #if (HAS_SAA1099) | |
| 371 | { SOUND_SAA1099, SND_GET_INFO_NAME( saa1099 ) }, | |
| 372 | #endif | |
| 373 | #if (HAS_IREMGA20) | |
| 374 | { SOUND_IREMGA20, SND_GET_INFO_NAME( iremga20 ) }, | |
| 375 | #endif | |
| 376 | #if (HAS_ES5503) | |
| 377 | { SOUND_ES5503, SND_GET_INFO_NAME( es5503 ) }, | |
| 378 | #endif | |
| 379 | #if (HAS_ES5505) | |
| 380 | { SOUND_ES5505, SND_GET_INFO_NAME( es5505 ) }, | |
| 381 | #endif | |
| 382 | #if (HAS_ES5506) | |
| 383 | { SOUND_ES5506, SND_GET_INFO_NAME( es5506 ) }, | |
| 384 | #endif | |
| 385 | #if (HAS_BSMT2000) | |
| 386 | { SOUND_BSMT2000, SND_GET_INFO_NAME( bsmt2000 ) }, | |
| 387 | #endif | |
| 388 | #if (HAS_YMF262) | |
| 389 | { SOUND_YMF262, SND_GET_INFO_NAME( ymf262 ) }, | |
| 390 | #endif | |
| 391 | #if (HAS_YMF278B) | |
| 392 | { SOUND_YMF278B, SND_GET_INFO_NAME( ymf278b ) }, | |
| 393 | #endif | |
| 394 | #if (HAS_GAELCO_CG1V) | |
| 395 | { SOUND_GAELCO_CG1V, SND_GET_INFO_NAME( gaelco_cg1v ) }, | |
| 396 | #endif | |
| 397 | #if (HAS_GAELCO_GAE1) | |
| 398 | { SOUND_GAELCO_GAE1, SND_GET_INFO_NAME( gaelco_gae1 ) }, | |
| 399 | #endif | |
| 400 | #if (HAS_X1_010) | |
| 401 | { SOUND_X1_010, SND_GET_INFO_NAME( x1_010 ) }, | |
| 402 | #endif | |
| 403 | #if (HAS_MULTIPCM) | |
| 404 | { SOUND_MULTIPCM, SND_GET_INFO_NAME( multipcm ) }, | |
| 405 | #endif | |
| 406 | #if (HAS_C6280) | |
| 407 | { SOUND_C6280, SND_GET_INFO_NAME( c6280 ) }, | |
| 408 | #endif | |
| 409 | #if (HAS_TIA) | |
| 410 | { SOUND_TIA, SND_GET_INFO_NAME( tia ) }, | |
| 411 | #endif | |
| 412 | #if (HAS_SP0250) | |
| 413 | { SOUND_SP0250, SND_GET_INFO_NAME( sp0250 ) }, | |
| 414 | #endif | |
| 415 | #if (HAS_SCSP) | |
| 416 | { SOUND_SCSP, SND_GET_INFO_NAME( scsp ) }, | |
| 417 | #endif | |
| 418 | #if (HAS_PSXSPU) | |
| 419 | { SOUND_PSXSPU, SND_GET_INFO_NAME( psxspu ) }, | |
| 420 | #endif | |
| 421 | #if (HAS_YMF271) | |
| 422 | { SOUND_YMF271, SND_GET_INFO_NAME( ymf271 ) }, | |
| 423 | #endif | |
| 424 | #if (HAS_CDDA) | |
| 425 | { SOUND_CDDA, SND_GET_INFO_NAME( cdda ) }, | |
| 426 | #endif | |
| 427 | #if (HAS_ICS2115) | |
| 428 | { SOUND_ICS2115, SND_GET_INFO_NAME( ics2115 ) }, | |
| 429 | #endif | |
| 430 | #if (HAS_ST0016) | |
| 431 | { SOUND_ST0016, SND_GET_INFO_NAME( st0016 ) }, | |
| 432 | #endif | |
| 433 | #if (HAS_NILE) | |
| 434 | { SOUND_NILE, SND_GET_INFO_NAME( nile ) }, | |
| 435 | #endif | |
| 436 | #if (HAS_C352) | |
| 437 | { SOUND_C352, SND_GET_INFO_NAME( c352 ) }, | |
| 438 | #endif | |
| 439 | #if (HAS_VRENDER0) | |
| 440 | { SOUND_VRENDER0, SND_GET_INFO_NAME( vrender0 ) }, | |
| 441 | #endif | |
| 442 | #if (HAS_VOTRAX) | |
| 443 | { SOUND_VOTRAX, SND_GET_INFO_NAME( votrax ) }, | |
| 444 | #endif | |
| 445 | #if (HAS_ES8712) | |
| 446 | { SOUND_ES8712, SND_GET_INFO_NAME( es8712 ) }, | |
| 447 | #endif | |
| 448 | #if (HAS_RF5C400) | |
| 449 | { SOUND_RF5C400, SND_GET_INFO_NAME( rf5c400 ) }, | |
| 450 | #endif | |
| 451 | #if (HAS_SPEAKER) | |
| 452 | { SOUND_SPEAKER, SND_GET_INFO_NAME( speaker ) }, | |
| 453 | #endif | |
| 454 | #if (HAS_CDP1869) | |
| 455 | { SOUND_CDP1869, SND_GET_INFO_NAME( cdp1869 ) }, | |
| 456 | #endif | |
| 457 | #if (HAS_S14001A) | |
| 458 | { SOUND_S14001A, SND_GET_INFO_NAME( s14001a ) }, | |
| 459 | #endif | |
| 460 | #if (HAS_BEEP) | |
| 461 | { SOUND_BEEP, SND_GET_INFO_NAME( beep ) }, | |
| 462 | #endif | |
| 463 | #if (HAS_WAVE) | |
| 464 | { SOUND_WAVE, SND_GET_INFO_NAME( wave ) }, | |
| 465 | #endif | |
| 466 | #if (HAS_SID6581) | |
| 467 | { SOUND_SID6581, SND_GET_INFO_NAME( sid6581 ) }, | |
| 468 | #endif | |
| 469 | #if (HAS_SID8580) | |
| 470 | { SOUND_SID8580, SND_GET_INFO_NAME( sid8580 ) }, | |
| 471 | #endif | |
| 472 | #if (HAS_SP0256) | |
| 473 | { SOUND_SP0256, SND_GET_INFO_NAME( sp0256 ) }, | |
| 474 | #endif | |
| 475 | #if (HAS_AICA) | |
| 476 | { SOUND_AICA, SND_GET_INFO_NAME( aica ) }, | |
| 477 | #endif | |
| 478 | ||
| 479 | { SOUND_FILTER_VOLUME, SND_GET_INFO_NAME( filter_volume ) }, | |
| 480 | { SOUND_FILTER_RC, SND_GET_INFO_NAME( filter_rc ) }, | |
| 481 | }; | |
| 482 | ||
| 483 | ||
| 484 | ||
| 485 | /*************************************************************************** | |
| 486 | 50 | VALIDATION MACROS |
| 487 | 51 | ***************************************************************************/ |
| 488 | 52 | |
| r4135 | r4136 | |
| 490 | 54 | assert_always(sndnum >= 0 && sndnum < totalsnd, #name "() called with invalid sound num!") |
| 491 | 55 | |
| 492 | 56 | #define VERIFY_SNDTI(name) \ |
| 493 | assert_always(sndtype >= 0 && sndtype < SOUND_COUNT, #name "() called with invalid sound type!"); \ | |
| 494 | assert_always(sndindex >= 0 && sndindex < totalsnd && sound_matrix[sndtype][sndindex] != 0, #name "() called with invalid (type,index) pair!") | |
| 57 | int sndnum = sndti_to_sndnum(sndtype, sndindex); \ | |
| 58 | assert_always(sndindex >= 0 && sndindex < totalsnd && sndnum != -1, #name "() called with invalid (type,index) pair!") | |
| 495 | 59 | |
| 496 | 60 | #define VERIFY_SNDTYPE(name) \ |
| 497 | assert_always(sndtype >= 0 && sndtype < SOUND_COUNT, #name "() called with invalid sound type!") | |
| 498 | 61 | |
| 499 | 62 | |
| 500 | 63 | |
| r4135 | r4136 | |
| 502 | 65 | GLOBAL VARIABLES |
| 503 | 66 | ***************************************************************************/ |
| 504 | 67 | |
| 505 | static snd_class_header snd_type_header[SOUND_COUNT]; | |
| 506 | ||
| 507 | 68 | static sndintrf_data sound[MAX_SOUND]; |
| 508 | 69 | static sndintrf_data *current_sound_start; |
| 509 | static UINT8 sound_matrix[SOUND_COUNT][MAX_SOUND]; | |
| 510 | 70 | static int totalsnd; |
| 511 | 71 | |
| 512 | 72 | |
| r4135 | r4136 | |
| 523 | 83 | |
| 524 | 84 | void sndintrf_init(running_machine *machine) |
| 525 | 85 | { |
| 526 | int mapindex; | |
| 527 | ||
| 528 | /* reset the sndintrf array */ | |
| 529 | memset(snd_type_header, 0, sizeof(snd_type_header)); | |
| 530 | ||
| 531 | /* build the sndintrf array */ | |
| 532 | for (mapindex = 0; mapindex < ARRAY_LENGTH(sndintrf_map); mapindex++) | |
| 533 | { | |
| 534 | sound_type sndtype = sndintrf_map[mapindex].sndtype; | |
| 535 | snd_class_header *header = &snd_type_header[sndtype]; | |
| 536 | sndinfo info; | |
| 537 | ||
| 538 | /* start with the get_info routine */ | |
| 539 | header->sndtype = sndtype; | |
| 540 | header->get_info = sndintrf_map[mapindex].get_info; | |
| 541 | ||
| 542 | /* bootstrap the rest of the function pointers */ | |
| 543 | info.set_info = NULL; | |
| 544 | (*header->get_info)(NULL, SNDINFO_PTR_SET_INFO, &info); | |
| 545 | header->set_info = info.set_info; | |
| 546 | ||
| 547 | info.start = NULL; | |
| 548 | (*header->get_info)(NULL, SNDINFO_PTR_START, &info); | |
| 549 | header->start = info.start; | |
| 550 | ||
| 551 | info.stop = NULL; | |
| 552 | (*header->get_info)(NULL, SNDINFO_PTR_STOP, &info); | |
| 553 | header->stop = info.stop; | |
| 554 | ||
| 555 | info.reset = NULL; | |
| 556 | (*header->get_info)(NULL, SNDINFO_PTR_RESET, &info); | |
| 557 | header->reset = info.reset; | |
| 558 | } | |
| 559 | ||
| 560 | /* fill in any empty entries with the dummy sound */ | |
| 561 | for (mapindex = 0; mapindex < SOUND_COUNT; mapindex++) | |
| 562 | if (snd_type_header[mapindex].get_info == NULL) | |
| 563 | snd_type_header[mapindex] = snd_type_header[SOUND_DUMMY]; | |
| 564 | ||
| 565 | 86 | /* zap the sound data structures */ |
| 566 | 87 | memset(sound, 0, sizeof(sound)); |
| 567 | 88 | totalsnd = 0; |
| 568 | ||
| 569 | /* reset the (type,index) matrix */ | |
| 570 | memset(sound_matrix, 0, sizeof(sound_matrix)); | |
| 571 | 89 | } |
| 572 | 90 | |
| 573 | 91 | |
| r4135 | r4136 | |
| 584 | 102 | |
| 585 | 103 | int sndintrf_init_sound(running_machine *machine, int sndnum, const char *tag, sound_type sndtype, int clock, const void *config) |
| 586 | 104 | { |
| 105 | snd_start_func start; | |
| 587 | 106 | sndintrf_data *info = &sound[sndnum]; |
| 588 | 107 | int index; |
| 108 | int sndidx; | |
| 589 | 109 | |
| 590 | 110 | info->device = auto_malloc(sizeof(*info->device) + strlen(tag)); |
| 591 | 111 | memset(info->device, 0, sizeof(*info->device) + strlen(tag)); |
| r4135 | r4136 | |
| 600 | 120 | info->device->inline_config = info; |
| 601 | 121 | |
| 602 | 122 | /* fill in the type and interface */ |
| 603 | info->intf = snd_type_header[sndtype]; | |
| 604 | info->tag = tag; | |
| 123 | info->intf.get_info = sndtype; | |
| 124 | info->intf.set_info = (snd_set_info_func)sndtype_get_info_fct(sndtype, SNDINFO_PTR_SET_INFO); | |
| 605 | 125 | info->sndtype = sndtype; |
| 606 | info->aliastype = sndtype_get_info_ | |
| 126 | info->aliastype = (sound_type)sndtype_get_info_fct(sndtype, SNDINFO_FCT_ALIAS); | |
| 607 | 127 | if (info->aliastype == 0) |
| 608 | 128 | info->aliastype = sndtype; |
| 609 | info->clock = clock; | |
| 129 | info->device->clock = clock; | |
| 610 | 130 | |
| 611 | /* find an empty slot in the matrix and add it */ | |
| 612 | totalsnd++; | |
| 613 | for (index = 0; index < MAX_SOUND; index++) | |
| 614 | if (sound_matrix[info->aliastype][index] == 0) | |
| 615 | { | |
| 616 | sound_matrix[info->aliastype][index] = totalsnd; | |
| 617 | break; | |
| 618 | } | |
| 131 | /* compute the index */ | |
| 132 | for (index = 0, sndidx = 0; sndidx < totalsnd; sndidx++) | |
| 133 | if (sound[sndidx].aliastype == info->aliastype) | |
| 134 | index++; | |
| 619 | 135 | info->index = index; |
| 136 | totalsnd++; | |
| 620 | 137 | |
| 621 | 138 | /* start the chip, tagging all its streams */ |
| 622 | 139 | current_sound_start = &sound[sndnum]; |
| 623 | info->device->token = (*info->intf.start)(info->device, clock, config, info->index); | |
| 140 | start = (snd_start_func)sndtype_get_info_fct(sndtype, SNDINFO_PTR_START); | |
| 141 | info->device->token = (*start)(info->device, clock, config); | |
| 624 | 142 | current_sound_start = NULL; |
| 625 | 143 | VPRINTF((" token = %p\n", info->device->token)); |
| 626 | 144 | |
| r4135 | r4136 | |
| 639 | 157 | |
| 640 | 158 | void sndintrf_exit_sound(int sndnum) |
| 641 | 159 | { |
| 160 | sndinfo info; | |
| 161 | ||
| 162 | info.stop = NULL; | |
| 163 | (*sound[sndnum].intf.get_info)(NULL, SNDINFO_PTR_STOP, &info); | |
| 164 | ||
| 642 | 165 | /* stop the chip */ |
| 643 | if (sound[sndnum].intf.stop) | |
| 644 | (*sound[sndnum].intf.stop)(sound[sndnum].device); | |
| 166 | if (info.stop) | |
| 167 | (*info.stop)(sound[sndnum].device); | |
| 645 | 168 | } |
| 646 | 169 | |
| 647 | 170 | |
| r4135 | r4136 | |
| 669 | 192 | |
| 670 | 193 | int sndti_exists(sound_type type, int index) |
| 671 | 194 | { |
| 672 | return (s | |
| 195 | return (s | |
| 673 | 196 | } |
| 674 | 197 | |
| 675 | 198 | |
| r4135 | r4136 | |
| 680 | 203 | |
| 681 | 204 | int sndti_to_sndnum(sound_type type, int index) |
| 682 | 205 | { |
| 683 | return sound_matrix[type][index] - 1; | |
| 206 | int sndnum; | |
| 207 | for (sndnum = 0; sndnum < totalsnd; sndnum++) | |
| 208 | if (sound[sndnum].aliastype == type) | |
| 209 | if (index-- == 0) | |
| 210 | return sndnum; | |
| 211 | return -1; | |
| 684 | 212 | } |
| 685 | 213 | |
| 686 | 214 | |
| r4135 | r4136 | |
| 801 | 329 | |
| 802 | 330 | void sndnum_reset(int sndnum) |
| 803 | 331 | { |
| 332 | sndinfo info; | |
| 333 | ||
| 804 | 334 | VERIFY_SNDNUM(sndnum_reset); |
| 805 | if (sound[sndnum].intf.reset) | |
| 806 | (*sound[sndnum].intf.reset)(sound[sndnum].device); | |
| 335 | info.reset = NULL; | |
| 336 | (*sound[sndnum].intf.get_info)(NULL, SNDINFO_PTR_RESET, &info); | |
| 337 | if (info.reset) | |
| 338 | (info.reset)(sound[sndnum].device); | |
| 807 | 339 | } |
| 808 | 340 | |
| 809 | 341 | int sndnum_clock(int sndnum) |
| 810 | 342 | { |
| 811 | 343 | VERIFY_SNDNUM(sndnum_clock); |
| 812 | return sound[sndnum].clock; | |
| 344 | return sound[sndnum].device->clock; | |
| 813 | 345 | } |
| 814 | 346 | |
| 815 | 347 | void *sndnum_token(int sndnum) |
| r4135 | r4136 | |
| 831 | 363 | INT64 sndti_get_info_int(sound_type sndtype, int sndindex, UINT32 state) |
| 832 | 364 | { |
| 833 | 365 | sndinfo info; |
| 834 | int sndnum; | |
| 835 | 366 | |
| 836 | 367 | VERIFY_SNDTI(sndti_get_info_int); |
| 837 | sndnum = sound_matrix[sndtype][sndindex] - 1; | |
| 838 | 368 | info.i = 0; |
| 839 | 369 | (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info); |
| 840 | 370 | return info.i; |
| r4135 | r4136 | |
| 843 | 373 | void *sndti_get_info_ptr(sound_type sndtype, int sndindex, UINT32 state) |
| 844 | 374 | { |
| 845 | 375 | sndinfo info; |
| 846 | int sndnum; | |
| 847 | 376 | |
| 848 | 377 | VERIFY_SNDTI(sndti_get_info_ptr); |
| 849 | sndnum = sound_matrix[sndtype][sndindex] - 1; | |
| 850 | 378 | info.p = NULL; |
| 851 | 379 | (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info); |
| 852 | 380 | return info.p; |
| r4135 | r4136 | |
| 855 | 383 | genf *sndti_get_info_fct(sound_type sndtype, int sndindex, UINT32 state) |
| 856 | 384 | { |
| 857 | 385 | sndinfo info; |
| 858 | int sndnum; | |
| 859 | 386 | |
| 860 | 387 | VERIFY_SNDTI(sndti_get_info_fct); |
| 861 | sndnum = sound_matrix[sndtype][sndindex] - 1; | |
| 862 | 388 | info.f = NULL; |
| 863 | 389 | (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info); |
| 864 | 390 | return info.f; |
| r4135 | r4136 | |
| 868 | 394 | { |
| 869 | 395 | extern char *get_temp_string_buffer(void); |
| 870 | 396 | sndinfo info; |
| 871 | int sndnum; | |
| 872 | 397 | |
| 873 | 398 | VERIFY_SNDTI(sndti_get_info_string); |
| 874 | sndnum = sound_matrix[sndtype][sndindex] - 1; | |
| 875 | 399 | info.s = get_temp_string_buffer(); |
| 876 | 400 | (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info); |
| 877 | 401 | return info.s; |
| r4135 | r4136 | |
| 885 | 409 | void sndti_set_info_int(sound_type sndtype, int sndindex, UINT32 state, INT64 data) |
| 886 | 410 | { |
| 887 | 411 | sndinfo info; |
| 888 | int sndnum; | |
| 889 | 412 | |
| 890 | 413 | VERIFY_SNDTI(sndti_set_info_int); |
| 891 | sndnum = sound_matrix[sndtype][sndindex] - 1; | |
| 892 | 414 | info.i = data; |
| 893 | 415 | (*sound[sndnum].intf.set_info)(sound[sndnum].device, state, &info); |
| 894 | 416 | } |
| r4135 | r4136 | |
| 896 | 418 | void sndti_set_info_ptr(sound_type sndtype, int sndindex, UINT32 state, void *data) |
| 897 | 419 | { |
| 898 | 420 | sndinfo info; |
| 899 | int sndnum; | |
| 900 | 421 | |
| 901 | 422 | VERIFY_SNDTI(sndti_set_info_ptr); |
| 902 | sndnum = sound_matrix[sndtype][sndindex] - 1; | |
| 903 | 423 | info.p = data; |
| 904 | 424 | (*sound[sndnum].intf.set_info)(sound[sndnum].device, state, &info); |
| 905 | 425 | } |
| r4135 | r4136 | |
| 907 | 427 | void sndti_set_info_fct(sound_type sndtype, int sndindex, UINT32 state, genf *data) |
| 908 | 428 | { |
| 909 | 429 | sndinfo info; |
| 910 | int sndnum; | |
| 911 | 430 | |
| 912 | 431 | VERIFY_SNDTI(sndti_set_info_ptr); |
| 913 | sndnum = sound_matrix[sndtype][sndindex] - 1; | |
| 914 | 432 | info.f = data; |
| 915 | 433 | (*sound[sndnum].intf.set_info)(sound[sndnum].device, state, &info); |
| 916 | 434 | } |
| r4135 | r4136 | |
| 922 | 440 | |
| 923 | 441 | void sndti_reset(sound_type sndtype, int sndindex) |
| 924 | 442 | { |
| 925 | | |
| 443 | | |
| 926 | 444 | |
| 927 | 445 | VERIFY_SNDTI(sndti_reset); |
| 928 | sndnum = sound_matrix[sndtype][sndindex] - 1; | |
| 929 | if (sound[sndnum].intf.reset) | |
| 930 | (*sound[sndnum].intf.reset)(sound[sndnum].device); | |
| 446 | info.reset = NULL; | |
| 447 | (*sound[sndnum].intf.get_info)(NULL, SNDINFO_PTR_RESET, &info); | |
| 448 | ||
| 449 | if (info.reset) | |
| 450 | (*info.reset)(sound[sndnum].device); | |
| 931 | 451 | } |
| 932 | 452 | |
| 933 | 453 | int sndti_clock(sound_type sndtype, int sndindex) |
| 934 | 454 | { |
| 935 | int sndnum; | |
| 936 | 455 | VERIFY_SNDTI(sndti_clock); |
| 937 | sndnum = sound_matrix[sndtype][sndindex] - 1; | |
| 938 | return sound[sndnum].clock; | |
| 456 | return sound[sndnum].device->clock; | |
| 939 | 457 | } |
| 940 | 458 | |
| 941 | 459 | void *sndti_token(sound_type sndtype, int sndindex) |
| 942 | 460 | { |
| 943 | int sndnum; | |
| 944 | 461 | VERIFY_SNDTI(sndti_token); |
| 945 | sndnum = sound_matrix[sndtype][sndindex] - 1; | |
| 946 | 462 | return sound[sndnum].device->token; |
| 947 | 463 | } |
| 948 | 464 | |
| r4135 | r4136 | |
| 958 | 474 | |
| 959 | 475 | INT64 sndtype_get_info_int(sound_type sndtype, UINT32 state) |
| 960 | 476 | { |
| 961 | snd_ | |
| 477 | snd_g | |
| 962 | 478 | sndinfo info; |
| 963 | 479 | |
| 964 | 480 | VERIFY_SNDTYPE(sndtype_get_info_int); |
| 965 | 481 | info.i = 0; |
| 966 | (* | |
| 482 | (* | |
| 967 | 483 | return info.i; |
| 968 | 484 | } |
| 969 | 485 | |
| 970 | 486 | void *sndtype_get_info_ptr(sound_type sndtype, UINT32 state) |
| 971 | 487 | { |
| 972 | snd_ | |
| 488 | snd_g | |
| 973 | 489 | sndinfo info; |
| 974 | 490 | |
| 975 | 491 | VERIFY_SNDTYPE(sndtype_get_info_ptr); |
| 976 | 492 | info.p = NULL; |
| 977 | (* | |
| 493 | (* | |
| 978 | 494 | return info.p; |
| 979 | 495 | } |
| 980 | 496 | |
| 981 | 497 | genf *sndtype_get_info_fct(sound_type sndtype, UINT32 state) |
| 982 | 498 | { |
| 983 | snd_ | |
| 499 | snd_g | |
| 984 | 500 | sndinfo info; |
| 985 | 501 | |
| 986 | 502 | VERIFY_SNDTYPE(sndtype_get_info_fct); |
| 987 | 503 | info.f = NULL; |
| 988 | (* | |
| 504 | (* | |
| 989 | 505 | return info.f; |
| 990 | 506 | } |
| 991 | 507 | |
| 992 | 508 | const char *sndtype_get_info_string(sound_type sndtype, UINT32 state) |
| 993 | 509 | { |
| 994 | 510 | extern char *get_temp_string_buffer(void); |
| 995 | snd_ | |
| 511 | snd_g | |
| 996 | 512 | sndinfo info; |
| 997 | 513 | |
| 998 | 514 | VERIFY_SNDTYPE(sndtype_get_info_string); |
| 999 | 515 | info.s = get_temp_string_buffer(); |
| 1000 | (* | |
| 516 | (* | |
| 1001 | 517 | return info.s; |
| 1002 | 518 | } |
| 1003 | ||
| 1004 | ||
| 1005 | ||
| 1006 | /*************************************************************************** | |
| 1007 | DUMMY INTERFACES | |
| 1008 | ***************************************************************************/ | |
| 1009 | ||
| 1010 | static SND_START( dummy_sound ) | |
| 1011 | { | |
| 1012 | logerror("Warning: starting a dummy sound core -- you are missing a hookup in sndintrf.c!\n"); | |
| 1013 | return auto_malloc(1); | |
| 1014 | } | |
| 1015 | ||
| 1016 | ||
| 1017 | static SND_SET_INFO( dummy_sound ) | |
| 1018 | { | |
| 1019 | switch (state) | |
| 1020 | { | |
| 1021 | /* no parameters to set */ | |
| 1022 | } | |
| 1023 | } | |
| 1024 | ||
| 1025 | ||
| 1026 | static SND_GET_INFO( dummy_sound ) | |
| 1027 | { | |
| 1028 | switch (state) | |
| 1029 | { | |
| 1030 | /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 1031 | ||
| 1032 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 1033 | case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( dummy_sound ); break; | |
| 1034 | case SNDINFO_PTR_START: info->start = SND_START_NAME( dummy_sound ); break; | |
| 1035 | case SNDINFO_PTR_STOP: /* Nothing */ break; | |
| 1036 | case SNDINFO_PTR_RESET: /* Nothing */ break; | |
| 1037 | ||
| 1038 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 1039 | case SNDINFO_STR_NAME: strcpy(info->s, "Dummy"); break; | |
| 1040 | case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Dummy"); break; | |
| 1041 | case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break; | |
| 1042 | case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break; | |
| 1043 | case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break; | |
| 1044 | } | |
| 1045 | } |
| r4135 | r4136 | |
|---|---|---|
| 291 | 291 | info->sound = msound; |
| 292 | 292 | |
| 293 | 293 | /* start the chip, tagging all its streams */ |
| 294 | VPRINTF(("sndnum = %d -- sound_type = % | |
| 294 | VPRINTF(("sndnum = %d -- sound_type = %s\n", sndnum, sndtype_get_name(msound->type))); | |
| 295 | 295 | num_regs = state_save_get_reg_count(machine); |
| 296 | 296 | streams_set_tag(machine, info); |
| 297 | 297 | if (sndintrf_init_sound(machine, sndnum, msound->tag, msound->type, msound->clock, msound->config) != 0) |
| r4135 | r4136 | |
| 903 | 903 | |
| 904 | 904 | if (sndnum < 0) |
| 905 | 905 | { |
| 906 | logerror("sndti_set_output_gain called for invalid sound type % | |
| 906 | logerror("sndti_set_output_gain called for invalid sound type %s, index %d\n", sndtype_get_name(type), index); | |
| 907 | 907 | return; |
| 908 | 908 | } |
| 909 | 909 | if (output >= sound[sndnum].outputs) |
| 910 | 910 | { |
| 911 | logerror("sndti_set_output_gain called for invalid sound output %d (type % | |
| 911 | logerror("sndti_set_output_gain called for invalid sound output %d (type %s, index %d)\n", output, sndtype_get_name(type), index); | |
| 912 | 912 | return; |
| 913 | 913 | } |
| 914 | 914 | stream_set_output_gain(sound[sndnum].output[output].stream, sound[sndnum].output[output].output, gain); |
| r4135 | r4136 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | #define MAX_SOUND 32 |
| 27 | 27 | |
| 28 | /* Enum listing all the sound chips */ | |
| 29 | enum _sound_type | |
| 30 | { | |
| 31 | SOUND_DUMMY, | |
| 32 | SOUND_CUSTOM, | |
| 33 | SOUND_SAMPLES, | |
| 34 | SOUND_DAC, | |
| 35 | SOUND_DMADAC, | |
| 36 | SOUND_DISCRETE, | |
| 37 | SOUND_AY8910, | |
| 38 | SOUND_AY8912, | |
| 39 | SOUND_AY8913, | |
| 40 | SOUND_AY8930, | |
| 41 | SOUND_YM2149, | |
| 42 | SOUND_YM3439, | |
| 43 | SOUND_YMZ284, | |
| 44 | SOUND_YMZ294, | |
| 45 | SOUND_YM2203, | |
| 46 | SOUND_YM2151, | |
| 47 | SOUND_YM2608, | |
| 48 | SOUND_YM2610, | |
| 49 | SOUND_YM2610B, | |
| 50 | SOUND_YM2612, | |
| 51 | SOUND_YM3438, | |
| 52 | SOUND_YM2413, | |
| 53 | SOUND_YM3812, | |
| 54 | SOUND_YM3526, | |
| 55 | SOUND_YMZ280B, | |
| 56 | SOUND_Y8950, | |
| 57 | SOUND_SN76477, | |
| 58 | SOUND_SN76489, | |
| 59 | SOUND_SN76489A, | |
| 60 | SOUND_SN76494, | |
| 61 | SOUND_SN76496, | |
| 62 | SOUND_GAMEGEAR, | |
| 63 | SOUND_SMSIII, | |
| 64 | SOUND_POKEY, | |
| 65 | SOUND_NES, | |
| 66 | SOUND_ASTROCADE, | |
| 67 | SOUND_NAMCO, | |
| 68 | SOUND_NAMCO_15XX, | |
| 69 | SOUND_NAMCO_CUS30, | |
| 70 | SOUND_NAMCO_52XX, | |
| 71 | SOUND_NAMCO_63701X, | |
| 72 | SOUND_SNKWAVE, | |
| 73 | SOUND_TMS36XX, | |
| 74 | SOUND_TMS3615, | |
| 75 | SOUND_TMS5100, | |
| 76 | SOUND_TMS5110, | |
| 77 | SOUND_TMS5110A, | |
| 78 | SOUND_CD2801, | |
| 79 | SOUND_TMC0281, | |
| 80 | SOUND_CD2802, | |
| 81 | SOUND_M58817, | |
| 82 | SOUND_TMC0285, | |
| 83 | SOUND_TMS5200, | |
| 84 | SOUND_TMS5220, | |
| 85 | SOUND_VLM5030, | |
| 86 | SOUND_OKIM6295, | |
| 87 | SOUND_OKIM6258, | |
| 88 | SOUND_MSM5205, | |
| 89 | SOUND_MSM5232, | |
| 90 | SOUND_UPD7759, | |
| 91 | SOUND_HC55516, | |
| 92 | SOUND_MC3417, | |
| 93 | SOUND_MC3418, | |
| 94 | SOUND_K005289, | |
| 95 | SOUND_K007232, | |
| 96 | SOUND_K051649, | |
| 97 | SOUND_K053260, | |
| 98 | SOUND_K054539, | |
| 99 | SOUND_SEGAPCM, | |
| 100 | SOUND_RF5C68, | |
| 101 | SOUND_CEM3394, | |
| 102 | SOUND_C140, | |
| 103 | SOUND_QSOUND, | |
| 104 | SOUND_SAA1099, | |
| 105 | SOUND_IREMGA20, | |
| 106 | SOUND_ES5503, | |
| 107 | SOUND_ES5505, | |
| 108 | SOUND_ES5506, | |
| 109 | SOUND_BSMT2000, | |
| 110 | SOUND_YMF262, | |
| 111 | SOUND_YMF278B, | |
| 112 | SOUND_GAELCO_CG1V, | |
| 113 | SOUND_GAELCO_GAE1, | |
| 114 | SOUND_X1_010, | |
| 115 | SOUND_MULTIPCM, | |
| 116 | SOUND_C6280, | |
| 117 | SOUND_TIA, | |
| 118 | SOUND_SP0250, | |
| 119 | SOUND_SCSP, | |
| 120 | SOUND_PSXSPU, | |
| 121 | SOUND_YMF271, | |
| 122 | SOUND_CDDA, | |
| 123 | SOUND_ICS2115, | |
| 124 | SOUND_ST0016, | |
| 125 | SOUND_NILE, | |
| 126 | SOUND_C352, | |
| 127 | SOUND_VRENDER0, | |
| 128 | SOUND_VOTRAX, | |
| 129 | SOUND_ES8712, | |
| 130 | SOUND_RF5C400, | |
| 131 | SOUND_SPEAKER, | |
| 132 | SOUND_CDP1869, | |
| 133 | SOUND_BEEP, | |
| 134 | SOUND_WAVE, | |
| 135 | SOUND_SID6581, | |
| 136 | SOUND_SID8580, | |
| 137 | SOUND_SP0256, | |
| 138 | SOUND_S14001A, | |
| 139 | SOUND_AICA, | |
| 140 | 28 | |
| 141 | /* filters start here */ | |
| 142 | SOUND_FILTER_VOLUME, | |
| 143 | SOUND_FILTER_RC, | |
| 144 | SOUND_FILTER_LOWPASS, | |
| 145 | ||
| 146 | SOUND_COUNT | |
| 147 | }; | |
| 148 | typedef enum _sound_type sound_type; | |
| 149 | ||
| 150 | ||
| 151 | 29 | /* Sound information constants */ |
| 152 | 30 | enum |
| 153 | 31 | { |
| 154 | 32 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 155 | 33 | SNDINFO_INT_FIRST = DEVINFO_INT_FIRST, |
| 156 | 34 | |
| 157 | SNDINFO_INT_ALIAS = DEVINFO_INT_CLASS_SPECIFIC, /* R/O: alias to sound type for (type,index) identification */ | |
| 158 | ||
| 159 | 35 | SNDINFO_INT_CORE_SPECIFIC = DEVINFO_INT_DEVICE_SPECIFIC, /* R/W: core-specific values start here */ |
| 160 | 36 | |
| 161 | 37 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| r4135 | r4136 | |
| 170 | 46 | SNDINFO_PTR_RESET = DEVINFO_FCT_RESET, /* R/O: void (*reset)(const device_config *device) */ |
| 171 | 47 | |
| 172 | 48 | SNDINFO_PTR_SET_INFO = DEVINFO_FCT_CLASS_SPECIFIC, /* R/O: void (*set_info)(const device_config *device, UINT32 state, sndinfo *info) */ |
| 173 | SNDINFO_PTR_START, /* R/O: void *(*start)(const device_config *device, int clock, const void *config, int sndindex) */ | |
| 49 | SNDINFO_PTR_START, /* R/O: void *(*start)(const device_config *device, int clock, const void *config) */ | |
| 50 | SNDINFO_FCT_ALIAS, /* R/O: alias to sound type for (type,index) identification */ | |
| 174 | 51 | |
| 175 | 52 | SNDINFO_FCT_CORE_SPECIFIC = DEVINFO_FCT_DEVICE_SPECIFIC, /* R/W: core-specific values start here */ |
| 176 | 53 | |
| r4135 | r4136 | |
| 201 | 78 | #define SND_SET_INFO_CALL(name) SND_SET_INFO_NAME(name)(device, state, info) |
| 202 | 79 | |
| 203 | 80 | #define SND_START_NAME(name) snd_start_##name |
| 204 | #define SND_START(name) void *SND_START_NAME(name)(const device_config *device, int clock, const void *config, int sndindex) | |
| 205 | #define SND_START_CALL(name) SND_START_NAME(name)(device, clock, config, sndindex) | |
| 81 | #define SND_START(name) void *SND_START_NAME(name)(const device_config *device, int clock, const void *config) | |
| 82 | #define SND_START_CALL(name) SND_START_NAME(name)(device, clock, config) | |
| 206 | 83 | |
| 207 | 84 | #define SND_STOP_NAME(name) snd_stop_##name |
| 208 | 85 | #define SND_STOP(name) void SND_STOP_NAME(name)(const device_config *device) |
| r4135 | r4136 | |
| 224 | 101 | /* define the various callback functions */ |
| 225 | 102 | typedef void (*snd_get_info_func)(const device_config *device, UINT32 state, sndinfo *info); |
| 226 | 103 | typedef void (*snd_set_info_func)(const device_config *device, UINT32 state, sndinfo *info); |
| 227 | typedef void *(*snd_start_func)(const device_config *device, int clock, const void *config | |
| 104 | typedef void *(*snd_start_func)(const device_config *device, int clock, const void *config | |
| 228 | 105 | typedef void (*snd_stop_func)(const device_config *device); |
| 229 | 106 | typedef void (*snd_reset_func)(const device_config *device); |
| 230 | 107 | |
| 108 | typedef snd_get_info_func sound_type; | |
| 231 | 109 | |
| 110 | ||
| 232 | 111 | /* sndinfo union used to pass data to/from the get_info/set_info functions */ |
| 233 | 112 | union _sndinfo |
| 234 | 113 | { |
| r4135 | r4136 | |
| 236 | 115 | void * p; /* generic pointers */ |
| 237 | 116 | genf * f; /* generic function pointers */ |
| 238 | 117 | char * s; /* generic strings */ |
| 118 | sound_type type; /* generic type */ | |
| 239 | 119 | |
| 240 | 120 | snd_set_info_func set_info; /* SNDINFO_PTR_SET_INFO */ |
| 241 | 121 | snd_start_func start; /* SNDINFO_PTR_START */ |
| r4135 | r4136 | |
| 246 | 126 | typedef struct _snd_class_header snd_class_header; |
| 247 | 127 | struct _snd_class_header |
| 248 | 128 | { |
| 249 | int index; /* index of this SND */ | |
| 250 | sound_type sndtype; /* type index of this SND */ | |
| 251 | ||
| 252 | 129 | /* table of core functions */ |
| 253 | 130 | snd_get_info_func get_info; |
| 254 | 131 | snd_set_info_func set_info; |
| 255 | snd_start_func start; | |
| 256 | snd_stop_func stop; | |
| 257 | snd_reset_func reset; | |
| 258 | 132 | }; |
| 259 | 133 | |
| 260 | 134 | |
| r4135 | r4136 | |
| 351 | 225 | sound_type sndnum_to_sndti(int sndnum, int *index); |
| 352 | 226 | int sndtype_count(sound_type sndtype); |
| 353 | 227 | |
| 228 | #define SOUND_DUMMY NULL | |
| 354 | 229 | |
| 230 | ||
| 355 | 231 | #endif /* __SNDINTRF_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | *********************************************************************/ |
| 11 | 11 | |
| 12 | #ifndef DECLAREG | |
| 13 | ||
| 14 | 12 | #include "driver.h" |
| 15 | #include " | |
| 13 | #include "drawgfxm | |
| 16 | 14 | |
| 17 | 15 | |
| 18 | 16 | /*************************************************************************** |
| 19 | | |
| 17 | GLOB | |
| 20 | 18 | ***************************************************************************/ |
| 21 | 19 | |
| 22 | #ifdef LSB_FIRST | |
| 23 | #define SHIFT0 0 | |
| 24 | #define SHIFT1 8 | |
| 25 | #define SHIFT2 16 | |
| 26 | #define SHIFT3 24 | |
| 27 | #else | |
| 28 | #define SHIFT3 0 | |
| 29 | #define SHIFT2 8 | |
| 30 | #define SHIFT1 16 | |
| 31 | #define SHIFT0 24 | |
| 32 | #endif | |
| 20 | /* if this line errors during compile, the size of NO_PRIORITY is wrong and I need to use something else */ | |
| 21 | UINT8 no_priority_size_is_wrong[2 * (sizeof(NO_PRIORITY) == 3) - 1]; | |
| 33 | 22 | |
| 34 | 23 | |
| 35 | 24 | |
| 36 | 25 | /*************************************************************************** |
| 37 | | |
| 26 | FUNCTION | |
| 38 | 27 | ***************************************************************************/ |
| 39 | 28 | |
| 40 | UINT8 gfx_drawmode_table[256]; | |
| 41 | UINT8 gfx_alpharange_table[256]; | |
| 29 | void decodechar(const gfx_element *gfx, UINT32 code, const UINT8 *src); | |
| 42 | 30 | |
| 43 | alpha_cache drawgfx_alpha_cache; | |
| 44 | 31 | |
| 45 | 32 | |
| 46 | ||
| 47 | 33 | /*************************************************************************** |
| 48 | 34 | INLINE FUNCTIONS |
| 49 | 35 | ***************************************************************************/ |
| 50 | 36 | |
| 51 | 37 | /*------------------------------------------------- |
| 52 | write_dword - safely write an unaligned DWORD | |
| 53 | -------------------------------------------------*/ | |
| 54 | ||
| 55 | #ifdef ALIGN_INTS /* GSL 980108 read/write nonaligned dword routine for ARM processor etc */ | |
| 56 | ||
| 57 | INLINE void write_dword(void *address, UINT32 data) | |
| 58 | { | |
| 59 | if ((FPTR)address & 3) | |
| 60 | { | |
| 61 | *((UINT8 *)address) = (data>>SHIFT0); | |
| 62 | *((UINT8 *)address+1) = (data>>SHIFT1); | |
| 63 | *((UINT8 *)address+2) = (data>>SHIFT2); | |
| 64 | *((UINT8 *)address+3) = (data>>SHIFT3); | |
| 65 | return; | |
| 66 | } | |
| 67 | else | |
| 68 | *(UINT32 *)address = data; | |
| 69 | } | |
| 70 | ||
| 71 | #else | |
| 72 | ||
| 73 | #define write_dword(address,data) *(int *)address=data | |
| 74 | ||
| 75 | #endif | |
| 76 | ||
| 77 | ||
| 78 | /*------------------------------------------------- | |
| 79 | 38 | readbit - read a single bit from a base |
| 80 | 39 | offset |
| 81 | 40 | -------------------------------------------------*/ |
| r4135 | r4136 | |
| 86 | 45 | } |
| 87 | 46 | |
| 88 | 47 | |
| 89 | ||
| 90 | /*************************************************************************** | |
| 91 | INITIALIZATION | |
| 92 | ***************************************************************************/ | |
| 93 | ||
| 94 | void drawgfx_init(running_machine *machine) | |
| 95 | { | |
| 96 | /* initialize the alpha drawing table */ | |
| 97 | alpha_set_level(255); | |
| 98 | } | |
| 99 | ||
| 100 | ||
| 101 | ||
| 102 | /*************************************************************************** | |
| 103 | GRAPHICS DECODING | |
| 104 | ***************************************************************************/ | |
| 105 | ||
| 106 | 48 | /*------------------------------------------------- |
| 107 | calc_penusage - calculate the pen usage for | |
| 108 | a given graphics tile | |
| 49 | normalize_xscroll - normalize an X scroll | |
| 50 | value for a bitmap to be positive and less | |
| 51 | than the width | |
| 109 | 52 | -------------------------------------------------*/ |
| 110 | 53 | |
| 111 | ||
| 54 | INLINE INT32 normaliz | |
| 112 | 55 | { |
| 113 | const UINT8 *dp = gfx->gfxdata + num * gfx->char_modulo; | |
| 114 | UINT32 usage = 0; | |
| 115 | int x, y; | |
| 116 | ||
| 117 | /* if nothing allocated, don't do it */ | |
| 118 | if (!gfx->pen_usage) | |
| 119 | return; | |
| 120 | ||
| 121 | /* packed case */ | |
| 122 | if (gfx->flags & GFX_ELEMENT_PACKED) | |
| 123 | for (y = 0; y < gfx->height; y++) | |
| 124 | { | |
| 125 | for (x = 0; x < gfx->width/2; x++) | |
| 126 | usage |= (1 << (dp[x] & 0x0f)) | (1 << (dp[x] >> 4)); | |
| 127 | ||
| 128 | dp += gfx->line_modulo; | |
| 129 | } | |
| 130 | ||
| 131 | /* unpacked case */ | |
| 132 | else | |
| 133 | for (y = 0; y < gfx->height; y++) | |
| 134 | { | |
| 135 | for (x = 0; x < gfx->width; x++) | |
| 136 | usage |= 1 << dp[x]; | |
| 137 | ||
| 138 | dp += gfx->line_modulo; | |
| 139 | } | |
| 140 | ||
| 141 | /* store the final result */ | |
| 142 | gfx->pen_usage[num] = usage; | |
| 56 | return (xscroll >= 0) ? xscroll % bitmap->width : (bitmap->width - (-xscroll) % bitmap->width); | |
| 143 | 57 | } |
| 144 | 58 | |
| 145 | 59 | |
| 146 | 60 | /*------------------------------------------------- |
| 147 | decodechar - decode a single character based | |
| 148 | on a specified layout | |
| 61 | normalize_yscroll - normalize a Y scroll | |
| 62 | value for a bitmap to be positive and less | |
| 63 | than the height | |
| 149 | 64 | -------------------------------------------------*/ |
| 150 | 65 | |
| 151 | ||
| 66 | INLINE INT32 normaliz | |
| 152 | 67 | { |
| 153 | const gfx_layout *gl = &gfx->layout; | |
| 154 | int israw = (gl->planeoffset[0] == GFX_RAW); | |
| 155 | int planes = gl->planes; | |
| 156 | UINT32 charincrement = gl->charincrement; | |
| 157 | const UINT32 *poffset = gl->planeoffset; | |
| 158 | const UINT32 *xoffset = gl->extxoffs ? gl->extxoffs : gl->xoffset; | |
| 159 | const UINT32 *yoffset = gl->extyoffs ? gl->extyoffs : gl->yoffset; | |
| 160 | UINT8 *dp = gfx->gfxdata + num * gfx->char_modulo; | |
| 161 | int plane, x, y; | |
| 162 | ||
| 163 | assert_always(!israw, "decodechar: raw layouts not supported"); | |
| 164 | ||
| 165 | /* zap the data to 0 */ | |
| 166 | memset(dp, 0, gfx->char_modulo); | |
| 167 | ||
| 168 | /* packed case */ | |
| 169 | if (gfx->flags & GFX_ELEMENT_PACKED) | |
| 170 | for (plane = 0; plane < planes; plane++) | |
| 171 | { | |
| 172 | int planebit = 1 << (planes - 1 - plane); | |
| 173 | int planeoffs = num * charincrement + poffset[plane]; | |
| 174 | ||
| 175 | for (y = 0; y < gfx->height; y++) | |
| 176 | { | |
| 177 | int yoffs = planeoffs + yoffset[y]; | |
| 178 | ||
| 179 | dp = gfx->gfxdata + num * gfx->char_modulo + y * gfx->line_modulo; | |
| 180 | for (x = 0; x < gfx->width; x += 2) | |
| 181 | { | |
| 182 | if (readbit(src, yoffs + xoffset[x+0])) | |
| 183 | dp[x+0] |= planebit; | |
| 184 | if (readbit(src, yoffs + xoffset[x+1])) | |
| 185 | dp[x+1] |= planebit; | |
| 186 | } | |
| 187 | } | |
| 188 | } | |
| 189 | ||
| 190 | /* unpacked case */ | |
| 191 | else | |
| 192 | for (plane = 0; plane < planes; plane++) | |
| 193 | { | |
| 194 | int planebit = 1 << (planes - 1 - plane); | |
| 195 | int planeoffs = num * charincrement + poffset[plane]; | |
| 196 | ||
| 197 | for (y = 0; y < gfx->height; y++) | |
| 198 | { | |
| 199 | int yoffs = planeoffs + yoffset[y]; | |
| 200 | ||
| 201 | dp = gfx->gfxdata + num * gfx->char_modulo + y * gfx->line_modulo; | |
| 202 | for (x = 0; x < gfx->width; x++) | |
| 203 | if (readbit(src, yoffs + xoffset[x])) | |
| 204 | dp[x] |= planebit; | |
| 205 | } | |
| 206 | } | |
| 207 | ||
| 208 | /* compute pen usage */ | |
| 209 | calc_penusage(gfx, num); | |
| 68 | return (yscroll >= 0) ? yscroll % bitmap->height : (bitmap->height - (-yscroll) % bitmap->height); | |
| 210 | 69 | } |
| 211 | 70 | |
| 212 | 71 | |
| 213 | 72 | |
| 214 | 73 | /*************************************************************************** |
| 215 | GRAPHICS | |
| 74 | GRAPHICS | |
| 216 | 75 | ***************************************************************************/ |
| 217 | 76 | |
| 218 | 77 | /*------------------------------------------------- |
| 219 | alloc | |
| 78 | gfx_element_alloc | |
| 220 | 79 | based on a given layout |
| 221 | 80 | -------------------------------------------------*/ |
| 222 | 81 | |
| 223 | gfx_element *alloc | |
| 82 | gfx_element *gfx_element_alloc | |
| 224 | 83 | { |
| 225 | 84 | int israw = (gl->planeoffset[0] == GFX_RAW); |
| 226 | 85 | int planes = gl->planes; |
| r4135 | r4136 | |
| 233 | 92 | gfx = malloc_or_die(sizeof(*gfx)); |
| 234 | 93 | memset(gfx, 0, sizeof(*gfx)); |
| 235 | 94 | |
| 95 | /* fill in the data */ | |
| 96 | gfx->width = width; | |
| 97 | gfx->height = height; | |
| 98 | ||
| 99 | gfx->origwidth = width; | |
| 100 | gfx->origheight = height; | |
| 101 | gfx->total_elements = total; | |
| 102 | ||
| 103 | gfx->color_base = color_base; | |
| 104 | gfx->color_depth = 1 << planes; | |
| 105 | gfx->color_granularity = 1 << planes; | |
| 106 | gfx->total_colors = total_colors; | |
| 107 | ||
| 108 | gfx->srcdata = srcdata; | |
| 236 | 109 | gfx->machine = machine; |
| 237 | 110 | |
| 238 | 111 | /* copy the layout */ |
| 239 | 112 | gfx->layout = *gl; |
| 240 | if (g | |
| 113 | if (gfx->layout.extxoffs != NULL) | |
| 241 | 114 | { |
| 242 | UINT32 *buffer = malloc_or_die(sizeof(buffer[0]) * gl->width); | |
| 243 | memcpy(buffer, gl->extxoffs, sizeof(gfx->layout.extxoffs[0]) * gl->width); | |
| 244 | gfx->layout.extxoffs = buffer; | |
| 115 | if (gfx->layout.width < ARRAY_LENGTH(gfx->layout.xoffset)) | |
| 116 | { | |
| 117 | memcpy(gfx->layout.xoffset, gfx->layout.extxoffs, sizeof(gfx->layout.xoffset[0]) * gfx->layout.width); | |
| 118 | gfx->layout.extxoffs = NULL; | |
| 119 | } | |
| 120 | else | |
| 121 | { | |
| 122 | UINT32 *buffer = malloc_or_die(sizeof(buffer[0]) * gfx->layout.width); | |
| 123 | memcpy(buffer, gfx->layout.extxoffs, sizeof(gfx->layout.extxoffs[0]) * gfx->layout.width); | |
| 124 | gfx->layout.extxoffs = buffer; | |
| 125 | } | |
| 245 | 126 | } |
| 246 | 127 | |
| 247 | if (g | |
| 128 | if (gfx->layout.extyoffs != NULL) | |
| 248 | 129 | { |
| 249 | UINT32 *buffer = malloc_or_die(sizeof(buffer[0]) * gl->height); | |
| 250 | memcpy(buffer, gl->extyoffs, sizeof(gfx->layout.extyoffs[0]) * gl->height); | |
| 251 | gfx->layout.extyoffs = buffer; | |
| 130 | if (gfx->layout.height < ARRAY_LENGTH(gfx->layout.yoffset)) | |
| 131 | { | |
| 132 | memcpy(gfx->layout.yoffset, gfx->layout.extyoffs, sizeof(gfx->layout.yoffset[0]) * gfx->layout.height); | |
| 133 | gfx->layout.extyoffs = NULL; | |
| 134 | } | |
| 135 | else | |
| 136 | { | |
| 137 | UINT32 *buffer = malloc_or_die(sizeof(buffer[0]) * gfx->layout.height); | |
| 138 | memcpy(buffer, gfx->layout.extyoffs, sizeof(gfx->layout.extyoffs[0]) * gfx->layout.height); | |
| 139 | gfx->layout.extyoffs = buffer; | |
| 140 | } | |
| 252 | 141 | } |
| 253 | 142 | |
| 254 | /* fill in the rest */ | |
| 255 | gfx->width = width; | |
| 256 | gfx->height = height; | |
| 257 | gfx->total_elements = total; | |
| 258 | gfx->color_base = 0; | |
| 259 | gfx->color_depth = 1 << planes; | |
| 260 | gfx->color_granularity = 1 << planes; | |
| 143 | /* allocate a pen usage array for entries with 32 pens or less */ | |
| 261 | 144 | if (gfx->color_depth <= 32) |
| 262 | 145 | gfx->pen_usage = malloc_or_die(gfx->total_elements * sizeof(*gfx->pen_usage)); |
| 263 | 146 | |
| 147 | /* allocate a dirty array */ | |
| 148 | gfx->dirty = malloc_or_die(gfx->total_elements * sizeof(*gfx->dirty)); | |
| 149 | memset(gfx->dirty, 1, gfx->total_elements * sizeof(*gfx->dirty)); | |
| 150 | ||
| 264 | 151 | /* raw graphics case */ |
| 265 | 152 | if (israw) |
| 266 | 153 | { |
| r4135 | r4136 | |
| 272 | 159 | gfx->flags |= GFX_ELEMENT_DONT_FREE; |
| 273 | 160 | if (planes <= 4) |
| 274 | 161 | gfx->flags |= GFX_ELEMENT_PACKED; |
| 162 | ||
| 163 | /* RAW graphics must have a pointer up front */ | |
| 164 | gfx->gfxdata = (UINT8 *)gfx->srcdata; | |
| 275 | 165 | } |
| 276 | 166 | |
| 277 | 167 | /* decoded graphics case */ |
| 278 | 168 | else |
| 279 | 169 | { |
| 280 | 170 | /* we get to pick our own modulos */ |
| 281 | gfx->line_modulo = gfx->width; | |
| 282 | gfx->char_modulo = gfx->line_modulo * gfx->height; | |
| 171 | gfx->line_modulo = gfx->origwidth; | |
| 172 | gfx->char_modulo = gfx->line_modulo * gfx->origheight; | |
| 283 | 173 | |
| 284 | 174 | /* allocate memory for the data */ |
| 285 | gfx->gfxdata = malloc_or_die(gfx->total_elements * gfx->char_modulo | |
| 175 | gfx->gfxdata = malloc_or_die(gfx->total_elements * gfx->char_modulo | |
| 286 | 176 | } |
| 287 | 177 | |
| 288 | 178 | return gfx; |
| r4135 | r4136 | |
| 290 | 180 | |
| 291 | 181 | |
| 292 | 182 | /*------------------------------------------------- |
| 293 | decodegfx - decode a series of tiles from | |
| 294 | a particular gfx_element | |
| 183 | gfx_element_decode - update a single code in | |
| 184 | a gfx_element | |
| 295 | 185 | -------------------------------------------------*/ |
| 296 | 186 | |
| 297 | void decode | |
| 187 | void gfx_element_decode | |
| 298 | 188 | { |
| 299 | int last = first + count - 1; | |
| 300 | int c; | |
| 301 | ||
| 302 | assert(gfx); | |
| 303 | assert(first < gfx->total_elements); | |
| 304 | assert(last < gfx->total_elements); | |
| 305 | ||
| 306 | /* if this is raw graphics data, just set the pointer and compute pen usage */ | |
| 307 | if (gfx->flags & GFX_ELEMENT_DONT_FREE) | |
| 308 | { | |
| 309 | /* if we got a pointer, set it */ | |
| 310 | if (first == 0 && src) | |
| 311 | gfx->gfxdata = (UINT8 *)src; | |
| 312 | ||
| 313 | /* compute pen usage for everything */ | |
| 314 | for (c = first; c <= last; c++) | |
| 315 | calc_penusage(gfx, c); | |
| 316 | } | |
| 317 | ||
| 318 | /* otherwise, we get to manually decode */ | |
| 319 | else | |
| 320 | for (c = first; c <= last; c++) | |
| 321 | decodechar(gfx, c, src); | |
| 189 | decodechar(gfx, code, gfx->srcdata); | |
| 322 | 190 | } |
| 323 | 191 | |
| 324 | 192 | |
| 325 | 193 | /*------------------------------------------------- |
| 326 | f | |
| 194 | gfx_element_free - free a gfx_element | |
| 327 | 195 | -------------------------------------------------*/ |
| 328 | 196 | |
| 329 | void f | |
| 197 | void gfx_element_free(gfx_element *gfx) | |
| 330 | 198 | { |
| 331 | 199 | /* ignore NULL frees */ |
| 332 | 200 | if (gfx == NULL) |
| 333 | 201 | return; |
| 334 | 202 | |
| 335 | 203 | /* free our data */ |
| 336 | if (gfx->layout.extyoffs) | |
| 204 | if (gfx->layout.extyoffs != NULL) | |
| 337 | 205 | free((void *)gfx->layout.extyoffs); |
| 338 | if (gfx->layout.extxoffs) | |
| 206 | if (gfx->layout.extxoffs != NULL) | |
| 339 | 207 | free((void *)gfx->layout.extxoffs); |
| 340 | if (gfx->pen_usage) | |
| 208 | if (gfx->pen_usage != NULL) | |
| 341 | 209 | free(gfx->pen_usage); |
| 210 | if (gfx->dirty != NULL) | |
| 211 | free(gfx->dirty); | |
| 342 | 212 | if (!(gfx->flags & GFX_ELEMENT_DONT_FREE)) |
| 343 | 213 | free(gfx->gfxdata); |
| 344 | 214 | free(gfx); |
| 345 | 215 | } |
| 346 | 216 | |
| 347 | 217 | |
| 218 | /*------------------------------------------------- | |
| 219 | gfx_element_build_temporary - create a | |
| 220 | temporary one-off gfx_element | |
| 221 | -------------------------------------------------*/ | |
| 348 | 222 | |
| 349 | /*************************************************************************** | |
| 350 | BLOCKMOVE PRIMITIVES | |
| 351 | ***************************************************************************/ | |
| 352 | ||
| 353 | INLINE void blockmove_NtoN_transpen_noremap16( | |
| 354 | const UINT16 *srcdata,int srcwidth,int srcheight,int srcmodulo, | |
| 355 | UINT16 *dstdata,int dstmodulo, | |
| 356 | int transpen) | |
| 223 | void gfx_element_build_temporary(gfx_element *gfx, running_machine *machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags) | |
| 357 | 224 | { |
| 358 | UINT | |
| 225 | static UINT8 | |
| 359 | 226 | |
| 360 | srcmodulo -= srcwidth; | |
| 361 | dstmodulo -= srcwidth; | |
| 227 | gfx->width = width; | |
| 228 | gfx->height = height; | |
| 229 | gfx->startx = 0; | |
| 230 | gfx->starty = 0; | |
| 362 | 231 | |
| 363 | while (srcheight) | |
| 364 | { | |
| 365 | end = dstdata + srcwidth; | |
| 366 | while (dstdata < end) | |
| 367 | { | |
| 368 | int col; | |
| 232 | gfx->origwidth = width; | |
| 233 | gfx->origheight = height; | |
| 234 | gfx->flags = flags; | |
| 235 | gfx->total_elements = 1; | |
| 369 | 236 | |
| 370 | col = *(srcdata++); | |
| 371 | if (col != transpen) *dstdata = col; | |
| 372 | dstdata++; | |
| 373 | } | |
| 237 | gfx->color_base = color_base; | |
| 238 | gfx->color_depth = color_granularity; | |
| 239 | gfx->color_granularity = color_granularity; | |
| 240 | gfx->total_colors = (machine->config->total_colors - color_base) / color_granularity; | |
| 374 | 241 | |
| 375 | srcdata += srcmodulo; | |
| 376 | dstdata += dstmodulo; | |
| 377 | srcheight--; | |
| 378 | } | |
| 379 | } | |
| 242 | gfx->pen_usage = NULL; | |
| 380 | 243 | |
| 381 | INLINE void blockmove_NtoN_transpen_noremap_flipx16( | |
| 382 | const UINT16 *srcdata,int srcwidth,int srcheight,int srcmodulo, | |
| 383 | UINT16 *dstdata,int dstmodulo, | |
| 384 | int transpen) | |
| 385 | { | |
| 386 | UINT16 *end; | |
| 244 | gfx->gfxdata = base; | |
| 245 | gfx->line_modulo = rowbytes; | |
| 246 | gfx->char_modulo = 0; | |
| 247 | gfx->srcdata = base; | |
| 248 | gfx->dirty = ¬_dirty; | |
| 249 | gfx->dirtyseq = 0; | |
| 387 | 250 | |
| 388 | srcmodulo += srcwidth; | |
| 389 | dstmodulo -= srcwidth; | |
| 251 | gfx->machine = machine; | |
| 252 | } | |
| 390 | 253 | |
| 391 | while (srcheight) | |
| 392 | { | |
| 393 | end = dstdata + srcwidth; | |
| 394 | while (dstdata < end) | |
| 395 | { | |
| 396 | int col; | |
| 397 | 254 | |
| 398 | col = *(srcdata--); | |
| 399 | if (col != transpen) *dstdata = col; | |
| 400 | dstdata++; | |
| 401 | } | |
| 255 | /*------------------------------------------------- | |
| 256 | calc_penusage - calculate the pen usage for | |
| 257 | a given graphics tile | |
| 258 | -------------------------------------------------*/ | |
| 402 | 259 | |
| 403 | srcdata += srcmodulo; | |
| 404 | dstdata += dstmodulo; | |
| 405 | srcheight--; | |
| 406 | } | |
| 407 | } | |
| 408 | ||
| 409 | INLINE void blockmove_NtoN_transpen_noremap32( | |
| 410 | const UINT32 *srcdata,int srcwidth,int srcheight,int srcmodulo, | |
| 411 | UINT32 *dstdata,int dstmodulo, | |
| 412 | int transpen) | |
| 260 | static void calc_penusage(const gfx_element *gfx, UINT32 code) | |
| 413 | 261 | { |
| 414 | UINT32 *end; | |
| 262 | const UINT8 *dp = gfx->gfxdata + code * gfx->char_modulo; | |
| 263 | UINT32 usage = 0; | |
| 264 | int x, y; | |
| 415 | 265 | |
| 416 | srcmodulo -= srcwidth; | |
| 417 | dstmodulo -= srcwidth; | |
| 266 | /* if nothing allocated, don't do it */ | |
| 267 | if (gfx->pen_usage == NULL) | |
| 268 | return; | |
| 418 | 269 | |
| 419 | while (srcheight) | |
| 420 | { | |
| 421 | end = dstdata + srcwidth; | |
| 422 | while (dstdata < end) | |
| 270 | /* packed case */ | |
| 271 | if (gfx->flags & GFX_ELEMENT_PACKED) | |
| 272 | for (y = 0; y < gfx->origheight; y++) | |
| 423 | 273 | { |
| 424 | int col; | |
| 274 | for (x = 0; x < gfx->origwidth/2; x++) | |
| 275 | usage |= (1 << (dp[x] & 0x0f)) | (1 << (dp[x] >> 4)); | |
| 425 | 276 | |
| 426 | col = *(srcdata++); | |
| 427 | if (col != transpen) *dstdata = col; | |
| 428 | dstdata++; | |
| 277 | dp += gfx->line_modulo; | |
| 429 | 278 | } |
| 430 | 279 | |
| 431 | srcdata += srcmodulo; | |
| 432 | dstdata += dstmodulo; | |
| 433 | srcheight--; | |
| 434 | } | |
| 435 | } | |
| 436 | ||
| 437 | INLINE void blockmove_NtoN_transpen_noremap_flipx32( | |
| 438 | const UINT32 *srcdata,int srcwidth,int srcheight,int srcmodulo, | |
| 439 | UINT32 *dstdata,int dstmodulo, | |
| 440 | int transpen) | |
| 441 | { | |
| 442 | UINT32 *end; | |
| 443 | ||
| 444 | srcmodulo += srcwidth; | |
| 445 | dstmodulo -= srcwidth; | |
| 446 | ||
| 447 | while (srcheight) | |
| 448 | { | |
| 449 | end = dstdata + srcwidth; | |
| 450 | while (dstdata < end) | |
| 280 | /* unpacked case */ | |
| 281 | else | |
| 282 | for (y = 0; y < gfx->origheight; y++) | |
| 451 | 283 | { |
| 452 | int col; | |
| 284 | for (x = 0; x < gfx->origwidth; x++) | |
| 285 | usage |= 1 << dp[x]; | |
| 453 | 286 | |
| 454 | col = *(srcdata--); | |
| 455 | if (col != transpen) *dstdata = col; | |
| 456 | dstdata++; | |
| 287 | dp += gfx->line_modulo; | |
| 457 | 288 | } |
| 458 | 289 | |
| 459 | srcdata += srcmodulo; | |
| 460 | dstdata += dstmodulo; | |
| 461 | srcheight--; | |
| 462 | } | |
| 290 | /* store the final result */ | |
| 291 | gfx->pen_usage[code] = usage; | |
| 463 | 292 | } |
| 464 | 293 | |
| 465 | 294 | |
| 295 | /*------------------------------------------------- | |
| 296 | decodechar - decode a single character based | |
| 297 | on a specified layout | |
| 298 | -------------------------------------------------*/ | |
| 466 | 299 | |
| 467 | static int afterdrawmask = 31; | |
| 468 | int pdrawgfx_shadow_lowpri = 0; | |
| 300 | void decodechar(const gfx_element *gfx, UINT32 code, const UINT8 *src) | |
| 301 | { | |
| 302 | const gfx_layout *gl = &gfx->layout; | |
| 303 | int israw = (gl->planeoffset[0] == GFX_RAW); | |
| 304 | int planes = gl->planes; | |
| 305 | UINT32 charincrement = gl->charincrement; | |
| 306 | const UINT32 *poffset = gl->planeoffset; | |
| 307 | const UINT32 *xoffset = gl->extxoffs ? gl->extxoffs : gl->xoffset; | |
| 308 | const UINT32 *yoffset = gl->extyoffs ? gl->extyoffs : gl->yoffset; | |
| 309 | UINT8 *dp = gfx->gfxdata + code * gfx->char_modulo; | |
| 310 | int plane, x, y; | |
| 469 | 311 | |
| 470 | /* 8-bit version (only used to generate the draw_scanline family of functions) */ | |
| 471 | #define DATA_TYPE UINT8 | |
| 472 | #define DEPTH 8 | |
| 473 | #define DECLAREG(function,args,body) void function##8 args body | |
| 474 | #include "drawgfx.c" | |
| 475 | #undef DECLAREG | |
| 476 | #undef DEPTH | |
| 477 | #undef DATA_TYPE | |
| 312 | if (!israw) | |
| 313 | { | |
| 314 | /* zap the data to 0 */ | |
| 315 | memset(dp, 0, gfx->char_modulo); | |
| 478 | 316 | |
| 479 | /* 16-bit version */ | |
| 480 | #define DATA_TYPE UINT16 | |
| 481 | #define DEPTH 16 | |
| 482 | #define alpha_blend_r alpha_blend_r16 | |
| 483 | #define alpha_blend alpha_blend16 | |
| 317 | /* packed case */ | |
| 318 | if (gfx->flags & GFX_ELEMENT_PACKED) | |
| 319 | for (plane = 0; plane < planes; plane++) | |
| 320 | { | |
| 321 | int planebit = 1 << (planes - 1 - plane); | |
| 322 | int planeoffs = code * charincrement + poffset[plane]; | |
| 484 | 323 | |
| 485 | #define DECLARE(function,args,body) | |
| 486 | #define DECLAREG(function,args,body) | |
| 324 | for (y = 0; y < gfx->origheight; y++) | |
| 325 | { | |
| 326 | int yoffs = planeoffs + yoffset[y]; | |
| 487 | 327 | |
| 488 | #define HMODULO 1 | |
| 489 | #define VMODULO dstmodulo | |
| 490 | #define COMMON_ARGS \ | |
| 491 | pen_t *palette_shadow_table, \ | |
| 492 | const UINT8 *srcdata,int srcwidth,int srcheight,int srcmodulo, \ | |
| 493 | int leftskip,int topskip,int flipx,int flipy, \ | |
| 494 | DATA_TYPE *dstdata,int dstwidth,int dstheight,int dstmodulo | |
| 328 | dp = gfx->gfxdata + code * gfx->char_modulo + y * gfx->line_modulo; | |
| 329 | for (x = 0; x < gfx->origwidth; x += 2) | |
| 330 | { | |
| 331 | if (readbit(src, yoffs + xoffset[x+0])) | |
| 332 | dp[x+0] |= planebit; | |
| 333 | if (readbit(src, yoffs + xoffset[x+1])) | |
| 334 | dp[x+1] |= planebit; | |
| 335 | } | |
| 336 | } | |
| 337 | } | |
| 495 | 338 | |
| 496 | #define RAW 1 | |
| 497 | #define COLOR_ARG int color,UINT8 *pridata,UINT32 pmask | |
| 498 | #define INCREMENT_DST(n) {dstdata+=(n);pridata += (n);} | |
| 499 | #define LOOKUP(n) (color + (n)) | |
| 500 | #define SETPIXELCOLOR(dest,n) { if (((1 << (pridata[dest] & 0x1f)) & pmask) == 0) { if (pridata[dest] & 0x80) { dstdata[dest] = palette_shadow_table[n];} else { dstdata[dest] = (n);} } pridata[dest] = (pridata[dest] & 0x7f) | afterdrawmask; } | |
| 501 | #define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_raw_pri16 args body | |
| 502 | #include "drawgfx.c" | |
| 503 | #undef DECLARE_SWAP_RAW_PRI | |
| 504 | #undef COLOR_ARG | |
| 505 | #undef LOOKUP | |
| 506 | #undef SETPIXELCOLOR | |
| 507 | #undef RAW | |
| 339 | /* unpacked case */ | |
| 340 | else | |
| 341 | for (plane = 0; plane < planes; plane++) | |
| 342 | { | |
| 343 | int planebit = 1 << (planes - 1 - plane); | |
| 344 | int planeoffs = code * charincrement + poffset[plane]; | |
| 508 | 345 | |
| 509 | #define RAW 0 | |
| 510 | #define COLOR_ARG int colorbase,const pen_t *paldata,UINT8 *pridata,UINT32 pmask | |
| 511 | #define LOOKUP(n) (paldata[n]) | |
| 512 | //#define LOOKUP(n) (colorbase + (n)) | |
| 513 | #define SETPIXELCOLOR(dest,n) { if (((1 << (pridata[dest] & 0x1f)) & pmask) == 0) { if (pridata[dest] & 0x80) { dstdata[dest] = palette_shadow_table[n];} else { dstdata[dest] = (n);} } pridata[dest] = (pridata[dest] & 0x7f) | afterdrawmask; } | |
| 514 | #define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_pri16 args body | |
| 515 | #include "drawgfx.c" | |
| 516 | #undef DECLARE_SWAP_RAW_PRI | |
| 517 | #undef COLOR_ARG | |
| 518 | #undef LOOKUP | |
| 519 | #undef INCREMENT_DST | |
| 520 | #undef SETPIXELCOLOR | |
| 521 | #undef RAW | |
| 346 | for (y = 0; y < gfx->origheight; y++) | |
| 347 | { | |
| 348 | int yoffs = planeoffs + yoffset[y]; | |
| 522 | 349 | |
| 523 | #define RAW 1 | |
| 524 | #define COLOR_ARG int color | |
| 525 | #define INCREMENT_DST(n) {dstdata+=(n);} | |
| 526 | #define LOOKUP(n) (color + (n)) | |
| 527 | #define SETPIXELCOLOR(dest,n) {dstdata[dest] = (n);} | |
| 528 | #define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_raw16 args body | |
| 529 | #include "drawgfx.c" | |
| 530 | #undef DECLARE_SWAP_RAW_PRI | |
| 531 | #undef COLOR_ARG | |
| 532 | #undef LOOKUP | |
| 533 | #undef SETPIXELCOLOR | |
| 534 | #undef RAW | |
| 350 | dp = gfx->gfxdata + code * gfx->char_modulo + y * gfx->line_modulo; | |
| 351 | for (x = 0; x < gfx->origwidth; x++) | |
| 352 | if (readbit(src, yoffs + xoffset[x])) | |
| 353 | dp[x] |= planebit; | |
| 354 | } | |
| 355 | } | |
| 356 | } | |
| 535 | 357 | |
| 536 | #define RAW 0 | |
| 537 | #define COLOR_ARG int colorbase, const pen_t *paldata | |
| 538 | #define LOOKUP(n) (paldata[n]) | |
| 539 | //#define LOOKUP(n) (colorbase + (n)) | |
| 540 | #define SETPIXELCOLOR(dest,n) {dstdata[dest] = (n);} | |
| 541 | #define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##16 args body | |
| 542 | #include "drawgfx.c" | |
| 543 | #undef DECLARE_SWAP_RAW_PRI | |
| 544 | #undef COLOR_ARG | |
| 545 | #undef LOOKUP | |
| 546 | #undef INCREMENT_DST | |
| 547 | #undef SETPIXELCOLOR | |
| 358 | /* compute pen usage */ | |
| 359 | calc_penusage(gfx, code); | |
| 548 | 360 | |
| 549 | #undef HMODULO | |
| 550 | #undef VMODULO | |
| 551 | #undef COMMON_ARGS | |
| 552 | #undef DECLARE | |
| 553 | #undef DECLAREG | |
| 361 | /* no longer dirty */ | |
| 362 | gfx->dirty[code] = 0; | |
| 363 | } | |
| 554 | 364 | |
| 555 | #define DECLARE(function,args,body) static void function##16 args body | |
| 556 | #define DECLAREG(function,args,body) void function##16 args body | |
| 557 | #define DECLARE_SWAP_RAW_PRI(function,args,body) | |
| 558 | #define BLOCKMOVE(function,flipx,args) \ | |
| 559 | if (flipx) blockmove_##function##_flipx##16 args ; \ | |
| 560 | else blockmove_##function##16 args | |
| 561 | #define BLOCKMOVELU(function,args) \ | |
| 562 | blockmove_##function##16 args | |
| 563 | #define BLOCKMOVERAW(function,args) \ | |
| 564 | blockmove_##function##_raw##16 args | |
| 565 | #define BLOCKMOVEPRI(function,args) \ | |
| 566 | blockmove_##function##_pri##16 args | |
| 567 | #define BLOCKMOVERAWPRI(function,args) \ | |
| 568 | blockmove_##function##_raw_pri##16 args | |
| 569 | #include "drawgfx.c" | |
| 570 | #undef DECLARE | |
| 571 | #undef DECLARE_SWAP_RAW_PRI | |
| 572 | #undef DECLAREG | |
| 573 | #undef BLOCKMOVE | |
| 574 | #undef BLOCKMOVELU | |
| 575 | #undef BLOCKMOVERAW | |
| 576 | #undef BLOCKMOVEPRI | |
| 577 | #undef BLOCKMOVERAWPRI | |
| 578 | 365 | |
| 579 | #undef RAW | |
| 580 | #undef DEPTH | |
| 581 | #undef DATA_TYPE | |
| 582 | #undef alpha_blend_r | |
| 583 | #undef alpha_blend | |
| 366 | /*------------------------------------------------- | |
| 367 | decodegfx - decode a series of tiles from | |
| 368 | a particular gfx_element | |
| 369 | -------------------------------------------------*/ | |
| 584 | 370 | |
| 585 | /* 32-bit version */ | |
| 586 | INLINE UINT32 SHADOW32(pen_t *shadow_table, UINT32 c) | |
| 371 | void decodegfx(gfx_element *gfx, UINT32 first, UINT32 count) | |
| 587 | 372 | { |
| 588 | return shadow_table[((c >> 9) & 0x7c00) | ((c >> 6) & 0x03e0) | ((c >> 3) & 0x001f)]; | |
| 589 | } | |
| 373 | int last = first + count - 1; | |
| 374 | int c; | |
| 590 | 375 | |
| 591 | #define DATA_TYPE UINT32 | |
| 592 | #define DEPTH 32 | |
| 593 | #define alpha_blend_r alpha_blend_r32 | |
| 594 | #define alpha_blend alpha_blend32 | |
| 376 | assert(gfx != NULL); | |
| 377 | assert(gfx->srcdata != NULL); | |
| 378 | assert(first < gfx->total_elements); | |
| 379 | assert(last < gfx->total_elements); | |
| 595 | 380 | |
| 596 | #define DECLARE(function,args,body) | |
| 597 | #define DECLAREG(function,args,body) | |
| 381 | /* if this is raw graphics data, just set the pointer and compute pen usage */ | |
| 382 | if (gfx->flags & GFX_ELEMENT_DONT_FREE) | |
| 383 | { | |
| 384 | /* if we got a pointer, set it */ | |
| 385 | gfx->gfxdata = (UINT8 *)gfx->srcdata; | |
| 598 | 386 | |
| 599 | #define HMODULO 1 | |
| 600 | #define VMODULO dstmodulo | |
| 601 | #define COMMON_ARGS \ | |
| 602 | pen_t *palette_shadow_table, \ | |
| 603 | const UINT8 *srcdata,int srcwidth,int srcheight,int srcmodulo, \ | |
| 604 | int leftskip,int topskip,int flipx,int flipy, \ | |
| 605 | DATA_TYPE *dstdata,int dstwidth,int dstheight,int dstmodulo | |
| 387 | /* compute pen usage for everything */ | |
| 388 | for (c = first; c <= last; c++) | |
| 389 | calc_penusage(gfx, c); | |
| 390 | } | |
| 606 | 391 | |
| 607 | #define RAW 1 | |
| 608 | #define COLOR_ARG int color,UINT8 *pridata,UINT32 pmask | |
| 609 | #define INCREMENT_DST(n) {dstdata+=(n);pridata += (n);} | |
| 610 | #define LOOKUP(n) (color + (n)) | |
| 611 | #define SETPIXELCOLOR(dest,n) { UINT8 r8=pridata[dest]; if(!(1<<(r8&0x1f)&pmask)){ if(afterdrawmask){ r8&=0x7f; r8|=0x1f; dstdata[dest]=(n); pridata[dest]=r8; } else if(!(r8&0x80)){ dstdata[dest]=SHADOW32(palette_shadow_table,n); pridata[dest]|=0x80; } } } | |
| 612 | #define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_raw_pri32 args body | |
| 613 | #include "drawgfx.c" | |
| 614 | #undef DECLARE_SWAP_RAW_PRI | |
| 615 | #undef COLOR_ARG | |
| 616 | #undef LOOKUP | |
| 617 | #undef SETPIXELCOLOR | |
| 618 | #undef RAW | |
| 392 | /* otherwise, we get to manually decode */ | |
| 393 | else | |
| 394 | for (c = first; c <= last; c++) | |
| 395 | decodechar(gfx, c, gfx->srcdata); | |
| 396 | } | |
| 619 | 397 | |
| 620 | #define RAW 0 | |
| 621 | #define COLOR_ARG int colorbase,const pen_t *paldata,UINT8 *pridata,UINT32 pmask | |
| 622 | #define LOOKUP(n) (paldata[n]) | |
| 623 | //#define LOOKUP(n) (colorbase + (n)) | |
| 624 | #define SETPIXELCOLOR(dest,n) { UINT8 r8=pridata[dest]; if(!(1<<(r8&0x1f)&pmask)){ if(afterdrawmask){ r8&=0x7f; r8|=0x1f; dstdata[dest]=(n); pridata[dest]=r8; } else if(!(r8&0x80)){ dstdata[dest]=SHADOW32(palette_shadow_table,n); pridata[dest]|=0x80; } } } | |
| 625 | #define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_pri32 args body | |
| 626 | #include "drawgfx.c" | |
| 627 | #undef DECLARE_SWAP_RAW_PRI | |
| 628 | #undef COLOR_ARG | |
| 629 | #undef LOOKUP | |
| 630 | #undef INCREMENT_DST | |
| 631 | #undef SETPIXELCOLOR | |
| 632 | #undef RAW | |
| 633 | 398 | |
| 634 | #define RAW 1 | |
| 635 | #define COLOR_ARG int color | |
| 636 | #define INCREMENT_DST(n) {dstdata+=(n);} | |
| 637 | #define LOOKUP(n) (color + (n)) | |
| 638 | #define SETPIXELCOLOR(dest,n) {dstdata[dest] = (n);} | |
| 639 | #define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##_raw32 args body | |
| 640 | #include "drawgfx.c" | |
| 641 | #undef DECLARE_SWAP_RAW_PRI | |
| 642 | #undef COLOR_ARG | |
| 643 | #undef LOOKUP | |
| 644 | #undef SETPIXELCOLOR | |
| 645 | #undef RAW | |
| 646 | 399 | |
| 647 | #define RAW 0 | |
| 648 | #define COLOR_ARG int colorbase, const pen_t *paldata | |
| 649 | #define LOOKUP(n) (paldata[n]) | |
| 650 | //#define LOOKUP(n) (colorbase + (n)) | |
| 651 | #define SETPIXELCOLOR(dest,n) {dstdata[dest] = (n);} | |
| 652 | #define DECLARE_SWAP_RAW_PRI(function,args,body) static void function##32 args body | |
| 653 | #include "drawgfx.c" | |
| 654 | #undef DECLARE_SWAP_RAW_PRI | |
| 655 | #undef COLOR_ARG | |
| 656 | #undef LOOKUP | |
| 657 | #undef INCREMENT_DST | |
| 658 | #undef SETPIXELCOLOR | |
| 400 | /*************************************************************************** | |
| 401 | DRAWGFX IMPLEMENTATIONS | |
| 402 | ***************************************************************************/ | |
| 659 | 403 | |
| 660 | #undef HMODULO | |
| 661 | #undef VMODULO | |
| 662 | #undef COMMON_ARGS | |
| 663 | #undef DECLARE | |
| 664 | #undef DECLAREG | |
| 404 | /*------------------------------------------------- | |
| 405 | drawgfx - generic drawgfx with legacy | |
| 406 | interface | |
| 407 | -------------------------------------------------*/ | |
| 665 | 408 | |
| 666 | #define DECLARE(function,args,body) static void function##32 args body | |
| 667 | #define DECLAREG(function,args,body) void function##32 args body | |
| 668 | #define DECLARE_SWAP_RAW_PRI(function,args,body) | |
| 669 | #define BLOCKMOVE(function,flipx,args) \ | |
| 670 | if (flipx) blockmove_##function##_flipx##32 args ; \ | |
| 671 | else blockmove_##function##32 args | |
| 672 | #define BLOCKMOVELU(function,args) \ | |
| 673 | blockmove_##function##32 args | |
| 674 | #define BLOCKMOVERAW(function,args) \ | |
| 675 | blockmove_##function##_raw##32 args | |
| 676 | #define BLOCKMOVEPRI(function,args) \ | |
| 677 | blockmove_##function##_pri##32 args | |
| 678 | #define BLOCKMOVERAWPRI(function,args) \ | |
| 679 | blockmove_##function##_raw_pri##32 args | |
| 680 | #include "drawgfx.c" | |
| 681 | #undef DECLARE | |
| 682 | #undef DECLARE_SWAP_RAW_PRI | |
| 683 | #undef DECLAREG | |
| 684 | #undef BLOCKMOVE | |
| 685 | #undef BLOCKMOVELU | |
| 686 | #undef BLOCKMOVERAW | |
| 687 | #undef BLOCKMOVEPRI | |
| 688 | #undef BLOCKMOVERAWPRI | |
| 409 | void drawgfx(bitmap_t *dest, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, | |
| 410 | INT32 sx, INT32 sy, const rectangle *cliprect, int transparency, UINT32 transparent_color) | |
| 411 | { | |
| 412 | switch (transparency) | |
| 413 | { | |
| 414 | case TRANSPARENCY_NONE: | |
| 415 | drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy); | |
| 416 | break; | |
| 689 | 417 | |
| 690 | #undef RAW | |
| 691 | #undef DEPTH | |
| 692 | #undef DATA_TYPE | |
| 693 | #undef alpha_blend_r | |
| 694 | #undef alpha_blend | |
| 418 | case TRANSPARENCY_PEN: | |
| 419 | drawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy, transparent_color); | |
| 420 | break; | |
| 695 | 421 | |
| 422 | case TRANSPARENCY_PENS: | |
| 423 | drawgfx_transmask(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy, transparent_color); | |
| 424 | break; | |
| 696 | 425 | |
| 697 | /*************************************************************************** | |
| 426 | default: | |
| 427 | fatalerror("Invalid transparency specified for drawgfx (%d)", transparency); | |
| 428 | break; | |
| 429 | } | |
| 430 | } | |
| 698 | 431 | |
| 699 | Draw graphic elements in the specified bitmap. | |
| 700 | 432 | |
| 701 | transparency == TRANSPARENCY_NONE - no transparency. | |
| 702 | transparency == TRANSPARENCY_PEN - bits whose _original_ value is == transparent_color | |
| 703 | are transparent. This is the most common kind of | |
| 704 | transparency. | |
| 705 | transparency == TRANSPARENCY_PENS - as above, but transparent_color is a mask of | |
| 706 | transparent pens. | |
| 707 | transparency == TRANSPARENCY_PEN_TABLE - the transparency condition is same as TRANSPARENCY_PEN | |
| 708 | A special drawing is done according to gfx_drawmode_table[source pixel]. | |
| 709 | DRAWMODE_NONE transparent | |
| 710 | DRAWMODE_SOURCE normal, draw source pixel. | |
| 711 | DRAWMODE_SHADOW destination is changed through palette_shadow_table[] | |
| 433 | /*------------------------------------------------- | |
| 434 | drawgfx_opaque - render a gfx element with | |
| 435 | no transparency | |
| 436 | -------------------------------------------------*/ | |
| 712 | 437 | |
| 713 | ***************************************************************************/ | |
| 714 | ||
| 715 | INLINE void common_drawgfx(bitmap_t *dest,const gfx_element *gfx, | |
| 716 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 717 | const rectangle *clip,int transparency,int transparent_color, | |
| 718 | bitmap_t *pri_buffer,UINT32 pri_mask) | |
| 438 | void drawgfx_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 439 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty) | |
| 719 | 440 | { |
| 441 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 442 | const pen_t *paldata; | |
| 443 | ||
| 720 | 444 | assert(dest != NULL); |
| 721 | assert( | |
| 445 | assert( | |
| 722 | 446 | assert(gfx != NULL); |
| 723 | 447 | |
| 448 | /* get final code and color, and grab lookup tables */ | |
| 724 | 449 | code %= gfx->total_elements; |
| 450 | color %= gfx->total_colors; | |
| 451 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 725 | 452 | |
| 726 | if (transparency != TRANSPARENCY_PEN_RAW) | |
| 727 | color %= gfx->total_colors; | |
| 453 | /* render based on dest bitmap depth */ | |
| 454 | if (dest->bpp == 16) | |
| 455 | DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); | |
| 456 | else | |
| 457 | DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); | |
| 458 | } | |
| 728 | 459 | |
| 729 | if ((dest->format == BITMAP_FORMAT_INDEXED16 || dest->format == BITMAP_FORMAT_INDEXED32) && | |
| 730 | (transparency == TRANSPARENCY_ALPHA || transparency == TRANSPARENCY_ALPHARANGE)) | |
| 460 | ||
| 461 | /*------------------------------------------------- | |
| 462 | drawgfx_transpen - render a gfx element with | |
| 463 | a single transparent pen | |
| 464 | -------------------------------------------------*/ | |
| 465 | ||
| 466 | void drawgfx_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 467 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 468 | UINT32 transpen) | |
| 469 | { | |
| 470 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 471 | const pen_t *paldata; | |
| 472 | ||
| 473 | /* special case invalid pens to opaque */ | |
| 474 | if (transpen > 0xff) | |
| 731 | 475 | { |
| 732 | transparency = TRANSPARENCY_PEN; | |
| 733 | transparent_color &= 0xff; | |
| 476 | drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); | |
| 477 | return; | |
| 734 | 478 | } |
| 735 | 479 | |
| 736 | if (gfx->pen_usage && (transparency == TRANSPARENCY_PEN || transparency == TRANSPARENCY_PENS)) | |
| 480 | assert(dest != NULL); | |
| 481 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 482 | assert(gfx != NULL); | |
| 483 | ||
| 484 | /* get final code and color, and grab lookup tables */ | |
| 485 | code %= gfx->total_elements; | |
| 486 | color %= gfx->total_colors; | |
| 487 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 488 | ||
| 489 | /* use pen usage to optimize */ | |
| 490 | if (gfx->pen_usage != NULL && !gfx->dirty[code]) | |
| 737 | 491 | { |
| 738 | | |
| 492 | UINT32 u | |
| 739 | 493 | |
| 740 | if (transparency == TRANSPARENCY_PEN) | |
| 741 | transmask = 1 << (transparent_color & 0xff); | |
| 742 | else /* transparency == TRANSPARENCY_PENS */ | |
| 743 | transmask = transparent_color; | |
| 494 | /* fully transparent; do nothing */ | |
| 495 | if ((usage & ~(1 << transpen)) == 0) | |
| 496 | return; | |
| 744 | 497 | |
| 745 | if ((gfx->pen_usage[code] & ~transmask) == 0) | |
| 746 | /* character is totally transparent, no need to draw */ | |
| 498 | /* fully opaque; draw as such */ | |
| 499 | if ((usage & (1 << transpen)) == 0) | |
| 500 | { | |
| 501 | drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); | |
| 747 | 502 | return; |
| 748 | else if ((gfx->pen_usage[code] & transmask) == 0) | |
| 749 | /* character is totally opaque, can disable transparency */ | |
| 750 | transparency = TRANSPARENCY_NONE; | |
| 503 | } | |
| 751 | 504 | } |
| 752 | 505 | |
| 506 | /* render based on dest bitmap depth */ | |
| 753 | 507 | if (dest->bpp == 16) |
| 754 | | |
| 508 | DRAWGFX_CORE(UINT16 | |
| 755 | 509 | else |
| 756 | | |
| 510 | DRAWGFX_CORE(UINT32 | |
| 757 | 511 | } |
| 758 | 512 | |
| 759 | void drawgfx(bitmap_t *dest,const gfx_element *gfx, | |
| 760 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 761 | const rectangle *clip,int transparency,int transparent_color) | |
| 762 | { | |
| 763 | profiler_mark(PROFILER_DRAWGFX); | |
| 764 | common_drawgfx(dest,gfx,code,color,flipx,flipy,sx,sy,clip,transparency,transparent_color,NULL,0); | |
| 765 | profiler_mark(PROFILER_END); | |
| 766 | } | |
| 767 | 513 | |
| 768 | void pdrawgfx(bitmap_t *dest,const gfx_element *gfx, | |
| 769 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 770 | const rectangle *clip,int transparency,int transparent_color,UINT32 priority_mask) | |
| 771 | { | |
| 772 | profiler_mark(PROFILER_DRAWGFX); | |
| 773 | common_drawgfx(dest,gfx,code,color,flipx,flipy,sx,sy,clip,transparency,transparent_color,priority_bitmap,priority_mask | (1<<31)); | |
| 774 | profiler_mark(PROFILER_END); | |
| 775 | } | |
| 514 | /*------------------------------------------------- | |
| 515 | drawgfx_transpen_raw - render a gfx element | |
| 516 | with a single transparent pen and no color | |
| 517 | lookups | |
| 518 | -------------------------------------------------*/ | |
| 776 | 519 | |
| 777 | void mdrawgfx(bitmap_t *dest,const gfx_element *gfx, | |
| 778 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 779 | const rectangle *clip,int transparency,int transparent_color,UINT32 priority_mask) | |
| 520 | void drawgfx_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 521 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 522 | UINT32 transpen) | |
| 780 | 523 | { |
| 781 | profiler_mark(PROFILER_DRAWGFX); | |
| 782 | common_drawgfx(dest,gfx,code,color,flipx,flipy,sx,sy,clip,transparency,transparent_color,priority_bitmap,priority_mask); | |
| 783 | profiler_mark(PROFILER_END); | |
| 784 | } | |
| 524 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 785 | 525 | |
| 786 | ||
| 787 | /*************************************************************************** | |
| 788 | ||
| 789 | Use copybitmap() to copy a bitmap onto another at the given position. | |
| 790 | ||
| 791 | ***************************************************************************/ | |
| 792 | static void copybitmap_common(bitmap_t *dest,bitmap_t *src,int flipx,int flipy,int sx,int sy, | |
| 793 | const rectangle *clip,int transparency,int transparent_color) | |
| 794 | { | |
| 795 | 526 | assert(dest != NULL); |
| 796 | assert(src != NULL); | |
| 797 | assert((dest->bpp == 16) || (dest->bpp == 32)); | |
| 798 | assert(dest->bpp == src->bpp); | |
| 527 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 528 | assert(gfx != NULL); | |
| 799 | 529 | |
| 800 | profiler_mark(PROFILER_COPYBITMAP); | |
| 530 | /* get final code and color, and grab lookup tables */ | |
| 531 | code %= gfx->total_elements; | |
| 801 | 532 | |
| 533 | /* early out if completely transparent */ | |
| 534 | if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) | |
| 535 | return; | |
| 536 | ||
| 537 | /* render based on dest bitmap depth */ | |
| 802 | 538 | if (dest->bpp == 16) |
| 803 | | |
| 539 | DRAWGFX | |
| 804 | 540 | else |
| 805 | copybitmap_core32(dest,src,flipx,flipy,sx,sy,clip,transparency,transparent_color); | |
| 806 | ||
| 807 | profiler_mark(PROFILER_END); | |
| 541 | DRAWGFX_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); | |
| 808 | 542 | } |
| 809 | 543 | |
| 810 | void copybitmap(bitmap_t *dest, bitmap_t *src, int flipx, int flipy, | |
| 811 | int sx, int sy, const rectangle *clip) | |
| 812 | { | |
| 813 | copybitmap_common(dest,src,flipx,flipy,sx,sy,clip,TRANSPARENCY_NONE,0); | |
| 814 | } | |
| 815 | 544 | |
| 816 | void copybitmap_trans(bitmap_t *dest, bitmap_t *src, int flipx, int flipy, | |
| 817 | int sx, int sy, const rectangle *clip, pen_t transparent_pen) | |
| 818 | { | |
| 819 | copybitmap_common(dest,src,flipx,flipy,sx,sy,clip,TRANSPARENCY_PEN,transparent_pen); | |
| 820 | } | |
| 545 | /*------------------------------------------------- | |
| 546 | drawgfx_transmask - render a gfx element | |
| 547 | with a multiple transparent pens provided as | |
| 548 | a mask | |
| 549 | -------------------------------------------------*/ | |
| 821 | 550 | |
| 822 | ||
| 823 | ||
| 824 | /*************************************************************************** | |
| 825 | ||
| 826 | Copy a bitmap onto another with scroll and wraparound. | |
| 827 | This function supports multiple independently scrolling rows/columns. | |
| 828 | "rows" is the number of indepentently scrolling rows. "rowscroll" is an | |
| 829 | array of integers telling how much to scroll each row. Same thing for | |
| 830 | "cols" and "colscroll". | |
| 831 | If the bitmap cannot scroll in one direction, set rows or columns to 0. | |
| 832 | If the bitmap scrolls as a whole, set rows and/or cols to 1. | |
| 833 | Bidirectional scrolling is, of course, supported only if the bitmap | |
| 834 | scrolls as a whole in at least one direction. | |
| 835 | ||
| 836 | ***************************************************************************/ | |
| 837 | static void copyscrollbitmap_common(bitmap_t *dest,bitmap_t *src, | |
| 838 | int rows,const int *rowscroll,int cols,const int *colscroll, | |
| 839 | const rectangle *clip,int transparency,int transparent_color) | |
| 551 | void drawgfx_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 552 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 553 | UINT32 transmask) | |
| 840 | 554 | { |
| 841 | int srcwidth,srcheight,destwidth,destheight; | |
| 842 | rectangle orig_clip; | |
| 555 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 556 | const pen_t *paldata; | |
| 843 | 557 | |
| 844 | assert(dest != NULL); | |
| 845 | assert(src != NULL); | |
| 846 | assert((dest->bpp == 16) || (dest->bpp == 32)); | |
| 847 | assert(dest->bpp == src->bpp); | |
| 848 | assert((rows != 0) || (rowscroll == NULL)); | |
| 849 | assert((rows == 0) || (rowscroll != NULL)); | |
| 850 | assert((cols != 0) || (colscroll == NULL)); | |
| 851 | assert((cols == 0) || (colscroll != NULL)); | |
| 852 | ||
| 853 | if (clip) | |
| 558 | /* special case 0 mask to opaque */ | |
| 559 | if (transmask == 0) | |
| 854 | 560 | { |
| 855 | orig_clip.min_x = clip->min_x; | |
| 856 | orig_clip.max_x = clip->max_x; | |
| 857 | orig_clip.min_y = clip->min_y; | |
| 858 | orig_clip.max_y = clip->max_y; | |
| 859 | } | |
| 860 | else | |
| 861 | { | |
| 862 | orig_clip.min_x = 0; | |
| 863 | orig_clip.max_x = dest->width-1; | |
| 864 | orig_clip.min_y = 0; | |
| 865 | orig_clip.max_y = dest->height-1; | |
| 866 | } | |
| 867 | clip = &orig_clip; | |
| 868 | ||
| 869 | if (rows == 0 && cols == 0) | |
| 870 | { | |
| 871 | copybitmap_common(dest,src,0,0,0,0,clip,transparency,transparent_color); | |
| 561 | drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); | |
| 872 | 562 | return; |
| 873 | 563 | } |
| 874 | 564 | |
| 875 | srcwidth = src->width; | |
| 876 | srcheight = src->height; | |
| 877 | destwidth = dest->width; | |
| 878 | destheight = dest->height; | |
| 565 | assert(dest != NULL); | |
| 566 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 567 | assert(gfx != NULL); | |
| 879 | 568 | |
| 880 | if (rows == 0) | |
| 569 | /* get final code and color, and grab lookup tables */ | |
| 570 | code %= gfx->total_elements; | |
| 571 | color %= gfx->total_colors; | |
| 572 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 573 | ||
| 574 | /* use pen usage to optimize */ | |
| 575 | if (gfx->pen_usage != NULL && !gfx->dirty[code]) | |
| 881 | 576 | { |
| 882 | /* scrolling columns */ | |
| 883 | int col,colwidth; | |
| 884 | rectangle myclip; | |
| 577 | UINT32 usage = gfx->pen_usage[code]; | |
| 885 | 578 | |
| 886 | colwidth = srcwidth / cols; | |
| 579 | /* fully transparent; do nothing */ | |
| 580 | if ((usage & ~transmask) == 0) | |
| 581 | return; | |
| 887 | 582 | |
| 888 | myclip.min_y = clip->min_y; | |
| 889 | myclip.max_y = clip->max_y; | |
| 890 | ||
| 891 | col = 0; | |
| 892 | while (col < cols) | |
| 583 | /* fully opaque; draw as such */ | |
| 584 | if ((usage & transmask) == 0) | |
| 893 | 585 | { |
| 894 | int cons,scroll; | |
| 895 | ||
| 896 | /* count consecutive columns scrolled by the same amount */ | |
| 897 | scroll = colscroll[col]; | |
| 898 | cons = 1; | |
| 899 | while (col + cons < cols && colscroll[col + cons] == scroll) | |
| 900 | cons++; | |
| 901 | ||
| 902 | if (scroll < 0) | |
| 903 | scroll = srcheight - (-scroll) % srcheight; | |
| 904 | else | |
| 905 | scroll %= srcheight; | |
| 906 | ||
| 907 | myclip.min_x = col * colwidth; | |
| 908 | if (myclip.min_x < clip->min_x) myclip.min_x = clip->min_x; | |
| 909 | myclip.max_x = (col + cons) * colwidth - 1; | |
| 910 | if (myclip.max_x > clip->max_x) myclip.max_x = clip->max_x; | |
| 911 | ||
| 912 | copybitmap_common(dest,src,0,0,0,scroll,&myclip,transparency,transparent_color); | |
| 913 | copybitmap_common(dest,src,0,0,0,scroll - srcheight,&myclip,transparency,transparent_color); | |
| 914 | ||
| 915 | col += cons; | |
| 586 | drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); | |
| 587 | return; | |
| 916 | 588 | } |
| 917 | 589 | } |
| 918 | else if (cols == 0) | |
| 919 | { | |
| 920 | /* scrolling rows */ | |
| 921 | int row,rowheight; | |
| 922 | rectangle myclip; | |
| 923 | 590 | |
| 924 | rowheight = srcheight / rows; | |
| 591 | /* render based on dest bitmap depth */ | |
| 592 | if (dest->bpp == 16) | |
| 593 | DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); | |
| 594 | else | |
| 595 | DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); | |
| 596 | } | |
| 925 | 597 | |
| 926 | myclip.min_x = clip->min_x; | |
| 927 | myclip.max_x = clip->max_x; | |
| 928 | 598 | |
| 929 | row = 0; | |
| 930 | while (row < rows) | |
| 931 | { | |
| 932 | int cons,scroll; | |
| 599 | /*------------------------------------------------- | |
| 600 | drawgfx_transtable - render a gfx element | |
| 601 | using a table to look up which pens are | |
| 602 | transparent, opaque, or shadowing | |
| 603 | -------------------------------------------------*/ | |
| 933 | 604 | |
| 934 | /* count consecutive rows scrolled by the same amount */ | |
| 935 | scroll = rowscroll[row]; | |
| 936 | cons = 1; | |
| 937 | while (row + cons < rows && rowscroll[row + cons] == scroll) | |
| 938 | cons++; | |
| 605 | void drawgfx_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 606 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 607 | const UINT8 *pentable, const pen_t *shadowtable) | |
| 608 | { | |
| 609 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 610 | const pen_t *paldata; | |
| 939 | 611 | |
| 940 | if (scroll < 0) | |
| 941 | scroll = srcwidth - (-scroll) % srcwidth; | |
| 942 | else | |
| 943 | scroll %= srcwidth; | |
| 612 | assert(dest != NULL); | |
| 613 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 614 | assert(gfx != NULL); | |
| 615 | assert(pentable != NULL); | |
| 944 | 616 | |
| 945 | myclip.min_y = row * rowheight; | |
| 946 | if (myclip.min_y < clip->min_y) myclip.min_y = clip->min_y; | |
| 947 | myclip.max_y = (row + cons) * rowheight - 1; | |
| 948 | if (myclip.max_y > clip->max_y) myclip.max_y = clip->max_y; | |
| 617 | /* get final code and color, and grab lookup tables */ | |
| 618 | code %= gfx->total_elements; | |
| 619 | color %= gfx->total_colors; | |
| 620 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 949 | 621 | |
| 950 | copybitmap_common(dest,src,0,0,scroll,0,&myclip,transparency,transparent_color); | |
| 951 | copybitmap_common(dest,src,0,0,scroll - srcwidth,0,&myclip,transparency,transparent_color); | |
| 622 | /* render based on dest bitmap depth */ | |
| 623 | if (dest->bpp == 16) | |
| 624 | DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY); | |
| 625 | else | |
| 626 | DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY); | |
| 627 | } | |
| 952 | 628 | |
| 953 | row += cons; | |
| 954 | } | |
| 955 | } | |
| 956 | else if (rows == 1 && cols == 1) | |
| 957 | { | |
| 958 | /* XY scrolling playfield */ | |
| 959 | int scrollx,scrolly,sx,sy; | |
| 960 | 629 | |
| 961 | if (rowscroll[0] < 0) | |
| 962 | scrollx = srcwidth - (-rowscroll[0]) % srcwidth; | |
| 963 | else | |
| 964 | scrollx = rowscroll[0] % srcwidth; | |
| 630 | /*------------------------------------------------- | |
| 631 | drawgfx_alpha - render a gfx element with | |
| 632 | a single transparent pen, alpha blending the | |
| 633 | remaining pixels with a fixed alpha value | |
| 634 | -------------------------------------------------*/ | |
| 965 | 635 | |
| 966 | if (colscroll[0] < 0) | |
| 967 | scrolly = srcheight - (-colscroll[0]) % srcheight; | |
| 968 | else | |
| 969 | scrolly = colscroll[0] % srcheight; | |
| 636 | void drawgfx_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 637 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 638 | UINT32 transpen, UINT8 alpha) | |
| 639 | { | |
| 640 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 641 | const pen_t *paldata; | |
| 970 | 642 | |
| 971 | for (sx = scrollx - srcwidth;sx < destwidth;sx += srcwidth) | |
| 972 | for (sy = scrolly - srcheight;sy < destheight;sy += srcheight) | |
| 973 | copybitmap_common(dest,src,0,0,sx,sy,clip,transparency,transparent_color); | |
| 974 | } | |
| 975 | else if (rows == 1) | |
| 643 | /* special case alpha = 0xff */ | |
| 644 | if (alpha == 0xff) | |
| 976 | 645 | { |
| 977 | /* scrolling columns + horizontal scroll */ | |
| 978 | int col,colwidth; | |
| 979 | int scrollx; | |
| 980 | rectangle myclip; | |
| 646 | drawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen); | |
| 647 | return; | |
| 648 | } | |
| 981 | 649 | |
| 982 | if (rowscroll[0] < 0) | |
| 983 | scrollx = srcwidth - (-rowscroll[0]) % srcwidth; | |
| 984 | else | |
| 985 | scrollx = rowscroll[0] % srcwidth; | |
| 650 | assert(dest != NULL); | |
| 651 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 652 | assert(gfx != NULL); | |
| 986 | 653 | |
| 987 | colwidth = srcwidth / cols; | |
| 654 | /* get final code and color, and grab lookup tables */ | |
| 655 | code %= gfx->total_elements; | |
| 656 | color %= gfx->total_colors; | |
| 657 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 988 | 658 | |
| 989 | myclip.min_y = clip->min_y; | |
| 990 | myclip.max_y = clip->max_y; | |
| 659 | /* early out if completely transparent */ | |
| 660 | if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) | |
| 661 | return; | |
| 991 | 662 | |
| 992 | col = 0; | |
| 993 | while (col < cols) | |
| 994 | { | |
| 995 | int cons,scroll; | |
| 663 | /* render based on dest bitmap depth */ | |
| 664 | if (dest->bpp == 16) | |
| 665 | DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16, NO_PRIORITY); | |
| 666 | else | |
| 667 | DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY); | |
| 668 | } | |
| 996 | 669 | |
| 997 | /* count consecutive columns scrolled by the same amount */ | |
| 998 | scroll = colscroll[col]; | |
| 999 | cons = 1; | |
| 1000 | while (col + cons < cols && colscroll[col + cons] == scroll) | |
| 1001 | cons++; | |
| 1002 | 670 | |
| 1003 | if (scroll < 0) | |
| 1004 | scroll = srcheight - (-scroll) % srcheight; | |
| 1005 | else | |
| 1006 | scroll %= srcheight; | |
| 1007 | 671 | |
| 1008 | myclip.min_x = col * colwidth + scrollx; | |
| 1009 | if (myclip.min_x < clip->min_x) myclip.min_x = clip->min_x; | |
| 1010 | myclip.max_x = (col + cons) * colwidth - 1 + scrollx; | |
| 1011 | if (myclip.max_x > clip->max_x) myclip.max_x = clip->max_x; | |
| 672 | /*************************************************************************** | |
| 673 | DRAWGFXZOOM IMPLEMENTATIONS | |
| 674 | ***************************************************************************/ | |
| 1012 | 675 | |
| 1013 | copybitmap_common(dest,src,0,0,scrollx,scroll,&myclip,transparency,transparent_color); | |
| 1014 | copybitmap_common(dest,src,0,0,scrollx,scroll - srcheight,&myclip,transparency,transparent_color); | |
| 676 | /*------------------------------------------------- | |
| 677 | drawgfxzoom - generic drawgfxzoom with legacy | |
| 678 | interface | |
| 679 | -------------------------------------------------*/ | |
| 1015 | 680 | |
| 1016 | myclip.min_x = col * colwidth + scrollx - srcwidth; | |
| 1017 | if (myclip.min_x < clip->min_x) myclip.min_x = clip->min_x; | |
| 1018 | myclip.max_x = (col + cons) * colwidth - 1 + scrollx - srcwidth; | |
| 1019 | if (myclip.max_x > clip->max_x) myclip.max_x = clip->max_x; | |
| 1020 | ||
| 1021 | copybitmap_common(dest,src,0,0,scrollx - srcwidth,scroll,&myclip,transparency,transparent_color); | |
| 1022 | copybitmap_common(dest,src,0,0,scrollx - srcwidth,scroll - srcheight,&myclip,transparency,transparent_color); | |
| 1023 | ||
| 1024 | col += cons; | |
| 1025 | } | |
| 1026 | } | |
| 1027 | else if (cols == 1) | |
| 681 | void drawgfxzoom(bitmap_t *dest, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, | |
| 682 | INT32 sx, INT32 sy, const rectangle *cliprect, int transparency, UINT32 transparent_color, | |
| 683 | UINT32 scalex, UINT32 scaley) | |
| 684 | { | |
| 685 | switch (transparency) | |
| 1028 | 686 | { |
| 1029 | /* scrolling rows + vertical scroll */ | |
| 1030 | int row,rowheight; | |
| 1031 | int scrolly; | |
| 1032 | rectangle myclip; | |
| 687 | case TRANSPARENCY_NONE: | |
| 688 | drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy, scalex, scaley); | |
| 689 | break; | |
| 1033 | 690 | |
| 1034 | if (colscroll[0] < 0) | |
| 1035 | scrolly = srcheight - (-colscroll[0]) % srcheight; | |
| 1036 | else | |
| 1037 | scrolly = colscroll[0] % srcheight; | |
| 691 | case TRANSPARENCY_PEN: | |
| 692 | drawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy, scalex, scaley, transparent_color); | |
| 693 | break; | |
| 1038 | 694 | |
| 1039 | rowheight = srcheight / rows; | |
| 695 | case TRANSPARENCY_PENS: | |
| 696 | drawgfxzoom_transmask(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy, scalex, scaley, transparent_color); | |
| 697 | break; | |
| 1040 | 698 | |
| 1041 | myclip.min_x = clip->min_x; | |
| 1042 | myclip.max_x = clip->max_x; | |
| 1043 | ||
| 1044 | row = 0; | |
| 1045 | while (row < rows) | |
| 1046 | { | |
| 1047 | int cons,scroll; | |
| 1048 | ||
| 1049 | /* count consecutive rows scrolled by the same amount */ | |
| 1050 | scroll = rowscroll[row]; | |
| 1051 | cons = 1; | |
| 1052 | while (row + cons < rows && rowscroll[row + cons] == scroll) | |
| 1053 | cons++; | |
| 1054 | ||
| 1055 | if (scroll < 0) | |
| 1056 | scroll = srcwidth - (-scroll) % srcwidth; | |
| 1057 | else | |
| 1058 | scroll %= srcwidth; | |
| 1059 | ||
| 1060 | myclip.min_y = row * rowheight + scrolly; | |
| 1061 | if (myclip.min_y < clip->min_y) myclip.min_y = clip->min_y; | |
| 1062 | myclip.max_y = (row + cons) * rowheight - 1 + scrolly; | |
| 1063 | if (myclip.max_y > clip->max_y) myclip.max_y = clip->max_y; | |
| 1064 | ||
| 1065 | copybitmap_common(dest,src,0,0,scroll,scrolly,&myclip,transparency,transparent_color); | |
| 1066 | copybitmap_common(dest,src,0,0,scroll - srcwidth,scrolly,&myclip,transparency,transparent_color); | |
| 1067 | ||
| 1068 | myclip.min_y = row * rowheight + scrolly - srcheight; | |
| 1069 | if (myclip.min_y < clip->min_y) myclip.min_y = clip->min_y; | |
| 1070 | myclip.max_y = (row + cons) * rowheight - 1 + scrolly - srcheight; | |
| 1071 | if (myclip.max_y > clip->max_y) myclip.max_y = clip->max_y; | |
| 1072 | ||
| 1073 | copybitmap_common(dest,src,0,0,scroll,scrolly - srcheight,&myclip,transparency,transparent_color); | |
| 1074 | copybitmap_common(dest,src,0,0,scroll - srcwidth,scrolly - srcheight,&myclip,transparency,transparent_color); | |
| 1075 | ||
| 1076 | row += cons; | |
| 1077 | } | |
| 699 | default: | |
| 700 | fatalerror("Invalid transparency specified for drawgfxzoom (%d)", transparency); | |
| 701 | break; | |
| 1078 | 702 | } |
| 1079 | 703 | } |
| 1080 | 704 | |
| 1081 | 705 | |
| 1082 | void copyscrollbitmap(bitmap_t *dest, bitmap_t *src, | |
| 1083 | int rows, const int *rowscroll, int cols, const int *colscroll, | |
| 1084 | const rectangle *clip) | |
| 1085 | { | |
| 1086 | copyscrollbitmap_common(dest,src,rows,rowscroll,cols,colscroll,clip,TRANSPARENCY_NONE,0); | |
| 1087 | } | |
| 706 | /*------------------------------------------------- | |
| 707 | drawgfxzoom_opaque - render a scaled gfx | |
| 708 | element with no transparency | |
| 709 | -------------------------------------------------*/ | |
| 1088 | 710 | |
| 1089 | void copyscrollbitmap_trans(bitmap_t *dest, bitmap_t *src, | |
| 1090 | int rows, const int *rowscroll, int cols, const int *colscroll, | |
| 1091 | const rectangle *clip, pen_t transparent_pen) | |
| 711 | void drawgfxzoom_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 712 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 713 | UINT32 scalex, UINT32 scaley) | |
| 1092 | 714 | { |
| 1093 | copyscrollbitmap_common(dest,src,rows,rowscroll,cols,colscroll,clip,TRANSPARENCY_PEN,transparent_pen); | |
| 1094 | } | |
| 715 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 716 | const pen_t *paldata; | |
| 1095 | 717 | |
| 1096 | ||
| 1097 | /* notes: | |
| 1098 | - startx and starty MUST be UINT32 for calculations to work correctly | |
| 1099 | - srcbitmap->width and height are assumed to be a power of 2 to speed up wraparound | |
| 1100 | */ | |
| 1101 | void copyrozbitmap(bitmap_t *dest,bitmap_t *src, | |
| 1102 | UINT32 startx,UINT32 starty,int incxx,int incxy,int incyx,int incyy,int wraparound, | |
| 1103 | const rectangle *clip,int transparency,int transparent_color,UINT32 priority) | |
| 1104 | { | |
| 1105 | assert(dest != NULL); | |
| 1106 | assert(src != NULL); | |
| 1107 | assert((dest->bpp == 16) || (dest->bpp == 32)); | |
| 1108 | assert(dest->bpp == src->bpp); | |
| 1109 | ||
| 1110 | profiler_mark(PROFILER_COPYBITMAP); | |
| 1111 | ||
| 1112 | /* cheat, the core doesn't support TRANSPARENCY_NONE yet */ | |
| 1113 | if (transparency == TRANSPARENCY_NONE) | |
| 718 | /* non-zoom case */ | |
| 719 | if (scalex == 0x10000 && scaley == 0x10000) | |
| 1114 | 720 | { |
| 1115 | transparency = TRANSPARENCY_PEN; | |
| 1116 | transparent_color = -1; | |
| 1117 | } | |
| 1118 | ||
| 1119 | if (transparency != TRANSPARENCY_PEN) | |
| 1120 | { | |
| 1121 | popmessage("copyrozbitmap unsupported trans %02x",transparency); | |
| 721 | drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); | |
| 1122 | 722 | return; |
| 1123 | 723 | } |
| 1124 | 724 | |
| 725 | assert(dest != NULL); | |
| 726 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 727 | assert(gfx != NULL); | |
| 728 | ||
| 729 | /* get final code and color, and grab lookup tables */ | |
| 730 | code %= gfx->total_elements; | |
| 731 | color %= gfx->total_colors; | |
| 732 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 733 | ||
| 734 | /* render based on dest bitmap depth */ | |
| 1125 | 735 | if (dest->bpp == 16) |
| 1126 | | |
| 736 | DRAWGFXZOOM | |
| 1127 | 737 | else |
| 1128 | copyrozbitmap_core32(dest,src,startx,starty,incxx,incxy,incyx,incyy,wraparound,clip,transparency,transparent_color,priority); | |
| 1129 | ||
| 1130 | profiler_mark(PROFILER_END); | |
| 738 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); | |
| 1131 | 739 | } |
| 1132 | 740 | |
| 1133 | 741 | |
| 742 | /*------------------------------------------------- | |
| 743 | drawgfxzoom_transpen - render a scaled gfx | |
| 744 | element with a single transparent pen | |
| 745 | -------------------------------------------------*/ | |
| 1134 | 746 | |
| 1135 | INLINE void common_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 1136 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 1137 | const rectangle *clip,int transparency,int transparent_color, | |
| 1138 | int scalex, int scaley,bitmap_t *pri_buffer,UINT32 pri_mask) | |
| 747 | void drawgfxzoom_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 748 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 749 | UINT32 scalex, UINT32 scaley, UINT32 transpen) | |
| 1139 | 750 | { |
| 1140 | /* verify arguments */ | |
| 1141 | assert(dest_bmp != NULL); | |
| 1142 | assert((dest_bmp->bpp == 16) || (dest_bmp->bpp == 32)); | |
| 1143 | assert(gfx != NULL); | |
| 751 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 752 | const pen_t *paldata; | |
| 1144 | 753 | |
| 1145 | if ((scalex == 0) || (scaley == 0)) return; | |
| 1146 | ||
| 754 | /* non-zoom case */ | |
| 1147 | 755 | if (scalex == 0x10000 && scaley == 0x10000) |
| 1148 | 756 | { |
| 1149 | | |
| 757 | | |
| 1150 | 758 | return; |
| 1151 | 759 | } |
| 1152 | 760 | |
| 1153 | if ((dest_bmp->format == BITMAP_FORMAT_INDEXED16 || dest_bmp->format == BITMAP_FORMAT_INDEXED32) && | |
| 1154 | (transparency == TRANSPARENCY_ALPHA || transparency == TRANSPARENCY_ALPHARANGE)) | |
| 761 | /* special case invalid pens to opaque */ | |
| 762 | if (transpen > 0xff) | |
| 1155 | 763 | { |
| 1156 | transparency = TRANSPARENCY_PEN; | |
| 1157 | transparent_color &= 0xff; | |
| 764 | drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley); | |
| 765 | return; | |
| 1158 | 766 | } |
| 1159 | 767 | |
| 1160 | /* | |
| 1161 | scalex and scaley are 16.16 fixed point numbers | |
| 1162 | 1<<15 : shrink to 50% | |
| 1163 | 1<<16 : uniform scale | |
| 1164 | 1<<17 : double to 200% | |
| 1165 | */ | |
| 768 | assert(dest != NULL); | |
| 769 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 770 | assert(gfx != NULL); | |
| 1166 | 771 | |
| 1167 | /* force clip to bitmap boundary */ | |
| 1168 | if (clip) | |
| 772 | /* get final code and color, and grab lookup tables */ | |
| 773 | code %= gfx->total_elements; | |
| 774 | color %= gfx->total_colors; | |
| 775 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 776 | ||
| 777 | /* use pen usage to optimize */ | |
| 778 | if (gfx->pen_usage != NULL && !gfx->dirty[code]) | |
| 1169 | 779 | { |
| 1170 | | |
| 780 | UINT32 usa | |
| 1171 | 781 | |
| 1172 | myclip.min_x = clip->min_x; | |
| 1173 | myclip.max_x = clip->max_x; | |
| 1174 | myclip.min_y = clip->min_y; | |
| 1175 | myclip.max_y = clip->max_y; | |
| 782 | /* fully transparent; do nothing */ | |
| 783 | if ((usage & ~(1 << transpen)) == 0) | |
| 784 | return; | |
| 1176 | 785 | |
| 1177 | if (myclip.min_x < 0) myclip.min_x = 0; | |
| 1178 | if (myclip.max_x >= dest_bmp->width) myclip.max_x = dest_bmp->width-1; | |
| 1179 | if (myclip.min_y < 0) myclip.min_y = 0; | |
| 1180 | if (myclip.max_y >= dest_bmp->height) myclip.max_y = dest_bmp->height-1; | |
| 1181 | ||
| 1182 | clip = &myclip; | |
| 786 | /* fully opaque; draw as such */ | |
| 787 | if ((usage & (1 << transpen)) == 0) | |
| 788 | { | |
| 789 | drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley); | |
| 790 | return; | |
| 791 | } | |
| 1183 | 792 | } |
| 1184 | 793 | |
| 1185 | /* 16-bit destination bitmap */ | |
| 1186 | if (dest_bmp->bpp == 16) | |
| 1187 | { | |
| 1188 | int colorbase = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors); | |
| 1189 | const pen_t *pal = &gfx->machine->pens[colorbase]; | |
| 1190 | UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo; | |
| 794 | /* render based on dest bitmap depth */ | |
| 795 | if (dest->bpp == 16) | |
| 796 | DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); | |
| 797 | else | |
| 798 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); | |
| 799 | } | |
| 1191 | 800 | |
| 1192 | int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; | |
| 1193 | int sprite_screen_width = (scalex*gfx->width+0x8000)>>16; | |
| 1194 | 801 | |
| 1195 | if (sprite_screen_width && sprite_screen_height) | |
| 1196 | { | |
| 1197 | /* compute sprite increment per screen pixel */ | |
| 1198 | int dx = (gfx->width<<16)/sprite_screen_width; | |
| 1199 | int dy = (gfx->height<<16)/sprite_screen_height; | |
| 802 | /*------------------------------------------------- | |
| 803 | drawgfxzoom_transpen_raw - render a scaled gfx | |
| 804 | element with a single transparent pen and no | |
| 805 | color lookups | |
| 806 | -------------------------------------------------*/ | |
| 1200 | 807 | |
| 1201 | int ex = sx+sprite_screen_width; | |
| 1202 | int ey = sy+sprite_screen_height; | |
| 808 | void drawgfxzoom_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 809 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 810 | UINT32 scalex, UINT32 scaley, UINT32 transpen) | |
| 811 | { | |
| 812 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 1203 | 813 | |
| 1204 | int x_index_base; | |
| 1205 | int y_index; | |
| 814 | /* non-zoom case */ | |
| 815 | if (scalex == 0x10000 && scaley == 0x10000) | |
| 816 | { | |
| 817 | drawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen); | |
| 818 | return; | |
| 819 | } | |
| 1206 | 820 | |
| 1207 | if (flipx) | |
| 1208 | { | |
| 1209 | x_index_base = (sprite_screen_width-1)*dx; | |
| 1210 | dx = -dx; | |
| 1211 | } | |
| 1212 | else | |
| 1213 | x_index_base = 0; | |
| 821 | assert(dest != NULL); | |
| 822 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 823 | assert(gfx != NULL); | |
| 1214 | 824 | |
| 1215 | if (flipy) | |
| 1216 | { | |
| 1217 | y_index = (sprite_screen_height-1)*dy; | |
| 1218 | dy = -dy; | |
| 1219 | } | |
| 1220 | else | |
| 1221 | y_index = 0; | |
| 825 | /* get final code and color, and grab lookup tables */ | |
| 826 | code %= gfx->total_elements; | |
| 1222 | 827 | |
| 1223 | if (clip) | |
| 1224 | { | |
| 1225 | if (sx < clip->min_x) | |
| 1226 | { /* clip left */ | |
| 1227 | int pixels = clip->min_x-sx; | |
| 1228 | sx += pixels; | |
| 1229 | x_index_base += pixels*dx; | |
| 1230 | } | |
| 828 | /* early out if completely transparent */ | |
| 829 | if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) | |
| 830 | return; | |
| 1231 | 831 | |
| 1232 | if (sy < clip->min_y) | |
| 1233 | { /* clip top */ | |
| 1234 | int pixels = clip->min_y-sy; | |
| 1235 | sy += pixels; | |
| 1236 | y_index += pixels*dy; | |
| 1237 | } | |
| 832 | /* render based on dest bitmap depth */ | |
| 833 | if (dest->bpp == 16) | |
| 834 | DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); | |
| 835 | else | |
| 836 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); | |
| 837 | } | |
| 1238 | 838 | |
| 1239 | if (ex > clip->max_x + 1) | |
| 1240 | { /* clip right */ | |
| 1241 | int pixels = ex-clip->max_x-1; | |
| 1242 | ex -= pixels; | |
| 1243 | } | |
| 1244 | 839 | |
| 1245 | if (ey > clip->max_y + 1) | |
| 1246 | { /* clip bottom */ | |
| 1247 | int pixels = ey-clip->max_y-1; | |
| 1248 | ey -= pixels; | |
| 1249 | } | |
| 1250 | } | |
| 840 | /*------------------------------------------------- | |
| 841 | drawgfxzoom_transmask - render a scaled gfx | |
| 842 | element with a multiple transparent pens | |
| 843 | provided as a mask | |
| 844 | -------------------------------------------------*/ | |
| 1251 | 845 | |
| 1252 | if (ex > sx) | |
| 1253 | { /* skip if inner loop doesn't draw anything */ | |
| 1254 | int y; | |
| 846 | void drawgfxzoom_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 847 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 848 | UINT32 scalex, UINT32 scaley, UINT32 transmask) | |
| 849 | { | |
| 850 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 851 | const pen_t *paldata; | |
| 1255 | 852 | |
| 1256 | /* case 0: TRANSPARENCY_NONE */ | |
| 1257 | if (transparency == TRANSPARENCY_NONE) | |
| 1258 | { | |
| 1259 | if (pri_buffer) | |
| 1260 | { | |
| 1261 | if (gfx->flags & GFX_ELEMENT_PACKED) | |
| 1262 | for (y = sy; y < ey; y++) | |
| 1263 | { | |
| 1264 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1265 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1266 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 853 | /* non-zoom case */ | |
| 854 | if (scalex == 0x10000 && scaley == 0x10000) | |
| 855 | { | |
| 856 | drawgfx_transmask(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transmask); | |
| 857 | return; | |
| 858 | } | |
| 1267 | 859 | |
| 1268 | int x, x_index = x_index_base; | |
| 1269 | for (x = sx; x < ex; x++) | |
| 1270 | { | |
| 1271 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1272 | dest[x] = pal[(source[x_index>>17] >> ((x_index & 0x10000) >> 14)) & 0x0f]; | |
| 1273 | // dest[x] = colorbase + ((source[x_index>>17] >> ((x_index & 0x10000) >> 14)) & 0x0f); | |
| 1274 | pri[x] = 31; | |
| 1275 | x_index += dx; | |
| 1276 | } | |
| 860 | /* special case 0 mask to opaque */ | |
| 861 | if (transmask == 0) | |
| 862 | { | |
| 863 | drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley); | |
| 864 | return; | |
| 865 | } | |
| 1277 | 866 | |
| 1278 | y_index += dy; | |
| 1279 | } | |
| 1280 | else | |
| 1281 | for (y = sy; y < ey; y++) | |
| 1282 | { | |
| 1283 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1284 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1285 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 867 | assert(dest != NULL); | |
| 868 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 869 | assert(gfx != NULL); | |
| 1286 | 870 | |
| 1287 | int x, x_index = x_index_base; | |
| 1288 | for (x = sx; x < ex; x++) | |
| 1289 | { | |
| 1290 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1291 | dest[x] = pal[source[x_index>>16]]; | |
| 1292 | // dest[x] = colorbase + source[x_index>>16]; | |
| 1293 | pri[x] = 31; | |
| 1294 | x_index += dx; | |
| 1295 | } | |
| 871 | /* get final code and color, and grab lookup tables */ | |
| 872 | code %= gfx->total_elements; | |
| 873 | color %= gfx->total_colors; | |
| 874 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 1296 | 875 | |
| 1297 | y_index += dy; | |
| 1298 | } | |
| 1299 | } | |
| 1300 | else | |
| 1301 | { | |
| 1302 | if (gfx->flags & GFX_ELEMENT_PACKED) | |
| 1303 | for (y = sy; y < ey; y++) | |
| 1304 | { | |
| 1305 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1306 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 876 | /* use pen usage to optimize */ | |
| 877 | if (gfx->pen_usage != NULL && !gfx->dirty[code]) | |
| 878 | { | |
| 879 | UINT32 usage = gfx->pen_usage[code]; | |
| 1307 | 880 | |
| 1308 | int x, x_index = x_index_base; | |
| 1309 | for (x = sx; x < ex; x++) | |
| 1310 | { | |
| 1311 | dest[x] = pal[(source[x_index>>17] >> ((x_index & 0x10000) >> 14)) & 0x0f]; | |
| 1312 | // dest[x] = colorbase + ((source[x_index>>17] >> ((x_index & 0x10000) >> 14)) & 0x0f); | |
| 1313 | x_index += dx; | |
| 1314 | } | |
| 881 | /* fully transparent; do nothing */ | |
| 882 | if ((usage & ~transmask) == 0) | |
| 883 | return; | |
| 1315 | 884 | |
| 1316 | y_index += dy; | |
| 1317 | } | |
| 1318 | else | |
| 1319 | for (y = sy; y < ey; y++) | |
| 1320 | { | |
| 1321 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1322 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 885 | /* fully opaque; draw as such */ | |
| 886 | if ((usage & transmask) == 0) | |
| 887 | { | |
| 888 | drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley); | |
| 889 | return; | |
| 890 | } | |
| 891 | } | |
| 1323 | 892 | |
| 1324 | int x, x_index = x_index_base; | |
| 1325 | for (x = sx; x < ex; x++) | |
| 1326 | { | |
| 1327 | dest[x] = pal[source[x_index>>16]]; | |
| 1328 | // dest[x] = colorbase + source[x_index>>16]; | |
| 1329 | x_index += dx; | |
| 1330 | } | |
| 893 | /* render based on dest bitmap depth */ | |
| 894 | if (dest->bpp == 16) | |
| 895 | DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); | |
| 896 | else | |
| 897 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); | |
| 898 | } | |
| 1331 | 899 | |
| 1332 | y_index += dy; | |
| 1333 | } | |
| 1334 | } | |
| 1335 | } | |
| 1336 | 900 | |
| 1337 | /* case 1: TRANSPARENCY_PEN */ | |
| 1338 | if (transparency == TRANSPARENCY_PEN) | |
| 1339 | { | |
| 1340 | if (pri_buffer) | |
| 1341 | { | |
| 1342 | if (gfx->flags & GFX_ELEMENT_PACKED) | |
| 1343 | for(y = sy; y < ey; y++) | |
| 1344 | { | |
| 1345 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1346 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1347 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 901 | /*------------------------------------------------- | |
| 902 | drawgfxzoom_transtable - render a scaled gfx | |
| 903 | element using a table to look up which pens | |
| 904 | are transparent, opaque, or shadowing | |
| 905 | -------------------------------------------------*/ | |
| 1348 | 906 | |
| 1349 | int x, x_index = x_index_base; | |
| 1350 | for (x = sx; x < ex; x++) | |
| 1351 | { | |
| 1352 | int c = (source[x_index>>17] >> ((x_index & 0x10000) >> 14)) & 0x0f; | |
| 1353 | if (c != transparent_color) | |
| 1354 | { | |
| 1355 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1356 | dest[x] = pal[c]; | |
| 1357 | // dest[x] = colorbase + c; | |
| 1358 | pri[x] = 31; | |
| 1359 | } | |
| 1360 | x_index += dx; | |
| 1361 | } | |
| 907 | void drawgfxzoom_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 908 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 909 | UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable) | |
| 910 | { | |
| 911 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 912 | const pen_t *paldata; | |
| 1362 | 913 | |
| 1363 | y_index += dy; | |
| 1364 | } | |
| 1365 | else | |
| 1366 | for(y = sy; y < ey; y++) | |
| 1367 | { | |
| 1368 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1369 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1370 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 914 | /* non-zoom case */ | |
| 915 | if (scalex == 0x10000 && scaley == 0x10000) | |
| 916 | { | |
| 917 | drawgfx_transtable(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, pentable, shadowtable); | |
| 918 | return; | |
| 919 | } | |
| 1371 | 920 | |
| 1372 | int x, x_index = x_index_base; | |
| 1373 | for (x = sx; x < ex; x++) | |
| 1374 | { | |
| 1375 | int c = source[x_index>>16]; | |
| 1376 | if (c != transparent_color) | |
| 1377 | { | |
| 1378 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1379 | dest[x] = pal[c]; | |
| 1380 | // dest[x] = colorbase + c; | |
| 1381 | pri[x] = 31; | |
| 1382 | } | |
| 1383 | x_index += dx; | |
| 1384 | } | |
| 921 | assert(dest != NULL); | |
| 922 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 923 | assert(gfx != NULL); | |
| 924 | assert(pentable != NULL); | |
| 1385 | 925 | |
| 1386 | y_index += dy; | |
| 1387 | } | |
| 1388 | } | |
| 1389 | else | |
| 1390 | { | |
| 1391 | if (gfx->flags & GFX_ELEMENT_PACKED) | |
| 1392 | for (y = sy; y < ey; y++) | |
| 1393 | { | |
| 1394 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1395 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 926 | /* get final code and color, and grab lookup tables */ | |
| 927 | code %= gfx->total_elements; | |
| 928 | color %= gfx->total_colors; | |
| 929 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 1396 | 930 | |
| 1397 | int x, x_index = x_index_base; | |
| 1398 | for (x = sx; x < ex; x++) | |
| 1399 | { | |
| 1400 | int c = (source[x_index>>17] >> ((x_index & 0x10000) >> 14)) & 0x0f; | |
| 1401 | if( c != transparent_color ) dest[x] = pal[c]; | |
| 1402 | // if (c != transparent_color) dest[x] = colorbase + c; | |
| 1403 | x_index += dx; | |
| 1404 | } | |
| 931 | /* render based on dest bitmap depth */ | |
| 932 | if (dest->bpp == 16) | |
| 933 | DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY); | |
| 934 | else | |
| 935 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY); | |
| 936 | } | |
| 1405 | 937 | |
| 1406 | y_index += dy; | |
| 1407 | } | |
| 1408 | else | |
| 1409 | for (y = sy; y < ey; y++) | |
| 1410 | { | |
| 1411 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1412 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1413 | 938 | |
| 1414 | int x, x_index = x_index_base; | |
| 1415 | for (x = sx; x < ex; x++) | |
| 1416 | { | |
| 1417 | int c = source[x_index>>16]; | |
| 1418 | if( c != transparent_color ) dest[x] = pal[c]; | |
| 1419 | // if (c != transparent_color) dest[x] = colorbase + c; | |
| 1420 | x_index += dx; | |
| 1421 | } | |
| 939 | /*------------------------------------------------- | |
| 940 | drawgfxzoom_alpha - render a scaled gfx element | |
| 941 | with a single transparent pen, alpha blending | |
| 942 | the remaining pixels with a fixed alpha value | |
| 943 | -------------------------------------------------*/ | |
| 1422 | 944 | |
| 1423 | y_index += dy; | |
| 1424 | } | |
| 1425 | } | |
| 1426 | } | |
| 945 | void drawgfxzoom_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 946 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 947 | UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha) | |
| 948 | { | |
| 949 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 950 | const pen_t *paldata; | |
| 1427 | 951 | |
| 1428 | /* case 1b: TRANSPARENCY_PEN_RAW */ | |
| 1429 | if (transparency == TRANSPARENCY_PEN_RAW) | |
| 1430 | { | |
| 1431 | if (pri_buffer) | |
| 1432 | for (y = sy; y < ey; y++) | |
| 1433 | { | |
| 1434 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1435 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1436 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 952 | /* non-zoom case */ | |
| 953 | if (scalex == 0x10000 && scaley == 0x10000) | |
| 954 | { | |
| 955 | drawgfx_alpha(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen, alpha); | |
| 956 | return; | |
| 957 | } | |
| 1437 | 958 | |
| 1438 | int x, x_index = x_index_base; | |
| 1439 | for (x = sx; x < ex; x++) | |
| 1440 | { | |
| 1441 | int c = source[x_index>>16]; | |
| 1442 | if (c != transparent_color) | |
| 1443 | { | |
| 1444 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1445 | dest[x] = color + c; | |
| 1446 | pri[x] = 31; | |
| 1447 | } | |
| 1448 | x_index += dx; | |
| 1449 | } | |
| 959 | /* special case alpha = 0xff */ | |
| 960 | if (alpha == 0xff) | |
| 961 | { | |
| 962 | drawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, transpen); | |
| 963 | return; | |
| 964 | } | |
| 1450 | 965 | |
| 1451 | y_index += dy; | |
| 1452 | } | |
| 1453 | else | |
| 1454 | for (y = sy; y < ey; y++) | |
| 1455 | { | |
| 1456 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1457 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 966 | assert(dest != NULL); | |
| 967 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 968 | assert(gfx != NULL); | |
| 1458 | 969 | |
| 1459 | int x, x_index = x_index_base; | |
| 1460 | for (x = sx; x < ex; x++) | |
| 1461 | { | |
| 1462 | int c = source[x_index>>16]; | |
| 1463 | if (c != transparent_color) dest[x] = color + c; | |
| 1464 | x_index += dx; | |
| 1465 | } | |
| 970 | /* get final code and color, and grab lookup tables */ | |
| 971 | code %= gfx->total_elements; | |
| 972 | color %= gfx->total_colors; | |
| 973 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 1466 | 974 | |
| 1467 | y_index += dy; | |
| 1468 | } | |
| 1469 | } | |
| 975 | /* early out if completely transparent */ | |
| 976 | if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) | |
| 977 | return; | |
| 1470 | 978 | |
| 1471 | /* case 2: TRANSPARENCY_PENS */ | |
| 1472 | if (transparency == TRANSPARENCY_PENS) | |
| 1473 | { | |
| 1474 | if (pri_buffer) | |
| 1475 | for (y = sy; y < ey; y++) | |
| 1476 | { | |
| 1477 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1478 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1479 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 979 | /* render based on dest bitmap depth */ | |
| 980 | if (dest->bpp == 16) | |
| 981 | DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16, NO_PRIORITY); | |
| 982 | else | |
| 983 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY); | |
| 984 | } | |
| 1480 | 985 | |
| 1481 | int x, x_index = x_index_base; | |
| 1482 | for (x = sx; x < ex; x++) | |
| 1483 | { | |
| 1484 | int c = source[x_index>>16]; | |
| 1485 | if (((1 << c) & transparent_color) == 0) | |
| 1486 | { | |
| 1487 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1488 | dest[x] = pal[c]; | |
| 1489 | // dest[x] = colorbase + c; | |
| 1490 | pri[x] = 31; | |
| 1491 | } | |
| 1492 | x_index += dx; | |
| 1493 | } | |
| 1494 | 986 | |
| 1495 | y_index += dy; | |
| 1496 | } | |
| 1497 | else | |
| 1498 | for (y = sy; y < ey; y++) | |
| 1499 | { | |
| 1500 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1501 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1502 | 987 | |
| 1503 | int x, x_index = x_index_base; | |
| 1504 | for (x = sx; x < ex; x++) | |
| 1505 | { | |
| 1506 | int c = source[x_index>>16]; | |
| 1507 | if (((1 << c) & transparent_color) == 0) | |
| 1508 | dest[x] = pal[c]; | |
| 1509 | // dest[x] = colorbase + c; | |
| 1510 | x_index += dx; | |
| 1511 | } | |
| 988 | /*************************************************************************** | |
| 989 | PDRAWGFX IMPLEMENTATIONS | |
| 990 | ***************************************************************************/ | |
| 1512 | 991 | |
| 1513 | y_index += dy; | |
| 1514 | } | |
| 1515 | } | |
| 992 | /*------------------------------------------------- | |
| 993 | pdrawgfx - generic pdrawgfx with legacy | |
| 994 | interface | |
| 995 | -------------------------------------------------*/ | |
| 1516 | 996 | |
| 1517 | /* case 3: TRANSPARENCY_PEN_TABLE */ | |
| 1518 | if (transparency == TRANSPARENCY_PEN_TABLE) | |
| 1519 | { | |
| 1520 | pen_t *palette_shadow_table = gfx->machine->shadow_table; | |
| 1521 | if (pri_buffer) | |
| 1522 | { | |
| 1523 | UINT8 al = (pdrawgfx_shadow_lowpri) ? 0 : 0x80; | |
| 997 | void pdrawgfx(bitmap_t *dest, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, | |
| 998 | INT32 sx, INT32 sy, const rectangle *cliprect, int transparency, UINT32 transparent_color, | |
| 999 | UINT32 priority_mask) | |
| 1000 | { | |
| 1001 | switch (transparency) | |
| 1002 | { | |
| 1003 | case TRANSPARENCY_NONE: | |
| 1004 | pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy, priority_bitmap, priority_mask); | |
| 1005 | break; | |
| 1524 | 1006 | |
| 1525 | for (y = sy; y < ey; y++) | |
| 1526 | { | |
| 1527 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1528 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1529 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 1007 | case TRANSPARENCY_PEN: | |
| 1008 | pdrawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy, priority_bitmap, priority_mask, transparent_color); | |
| 1009 | break; | |
| 1530 | 1010 | |
| 1531 | int x, x_index = x_index_base; | |
| 1532 | for (x = sx; x < ex; x++) | |
| 1533 | { | |
| 1534 | int c = source[x_index>>16]; | |
| 1535 | if (c != transparent_color) | |
| 1536 | { | |
| 1537 | UINT8 ah; | |
| 1011 | case TRANSPARENCY_PENS: | |
| 1012 | pdrawgfx_transmask(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy, priority_bitmap, priority_mask, transparent_color); | |
| 1013 | break; | |
| 1538 | 1014 | |
| 1539 | switch(gfx_drawmode_table[c]) | |
| 1540 | { | |
| 1541 | case DRAWMODE_SOURCE: | |
| 1542 | ah = pri[x]; | |
| 1543 | if (((1 << (ah & 0x1f)) & pri_mask) == 0) | |
| 1544 | { | |
| 1545 | if (ah & 0x80) | |
| 1546 | dest[x] = palette_shadow_table[pal[c]]; | |
| 1547 | // dest[x] = palette_shadow_table[colorbase + c]; | |
| 1548 | else | |
| 1549 | dest[x] = pal[c]; | |
| 1550 | // dest[x] = colorbase + c; | |
| 1551 | } | |
| 1552 | pri[x] = (ah & 0x7f) | 31; | |
| 1553 | break; | |
| 1554 | case DRAWMODE_SHADOW: | |
| 1555 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1556 | dest[x] = palette_shadow_table[dest[x]]; | |
| 1557 | pri[x] |= al; | |
| 1558 | break; | |
| 1559 | } | |
| 1560 | } | |
| 1561 | x_index += dx; | |
| 1562 | } | |
| 1015 | default: | |
| 1016 | fatalerror("Invalid transparency specified for pdrawgfx (%d)", transparency); | |
| 1017 | break; | |
| 1018 | } | |
| 1019 | } | |
| 1563 | 1020 | |
| 1564 | y_index += dy; | |
| 1565 | } | |
| 1566 | } | |
| 1567 | else | |
| 1568 | { | |
| 1569 | for (y = sy; y < ey; y++) | |
| 1570 | { | |
| 1571 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1572 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1573 | 1021 | |
| 1574 | int x, x_index = x_index_base; | |
| 1575 | for (x = sx; x < ex; x++) | |
| 1576 | { | |
| 1577 | int c = source[x_index>>16]; | |
| 1578 | if (c != transparent_color) | |
| 1579 | { | |
| 1580 | switch(gfx_drawmode_table[c]) | |
| 1581 | { | |
| 1582 | case DRAWMODE_SOURCE: | |
| 1583 | dest[x] = pal[c]; | |
| 1584 | // dest[x] = colorbase + c; | |
| 1585 | break; | |
| 1586 | case DRAWMODE_SHADOW: | |
| 1587 | dest[x] = palette_shadow_table[dest[x]]; | |
| 1588 | break; | |
| 1589 | } | |
| 1590 | } | |
| 1591 | x_index += dx; | |
| 1592 | } | |
| 1022 | /*------------------------------------------------- | |
| 1023 | pdrawgfx_opaque - render a gfx element with | |
| 1024 | no transparency, checking against the priority | |
| 1025 | bitmap | |
| 1026 | -------------------------------------------------*/ | |
| 1593 | 1027 | |
| 1594 | y_index += dy; | |
| 1595 | } | |
| 1596 | } | |
| 1597 | } | |
| 1028 | void pdrawgfx_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1029 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1030 | bitmap_t *priority, UINT32 pmask) | |
| 1031 | { | |
| 1032 | const pen_t *paldata; | |
| 1598 | 1033 | |
| 1599 | /* case 6: TRANSPARENCY_ALPHA */ | |
| 1600 | if (transparency == TRANSPARENCY_ALPHA) | |
| 1601 | { | |
| 1602 | if (pri_buffer) | |
| 1603 | for (y = sy; y < ey; y++) | |
| 1604 | { | |
| 1605 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1606 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1607 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 1034 | assert(dest != NULL); | |
| 1035 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1036 | assert(gfx != NULL); | |
| 1608 | 1037 | |
| 1609 | int x, x_index = x_index_base; | |
| 1610 | for (x = sx; x < ex; x++) | |
| 1611 | { | |
| 1612 | int c = source[x_index>>16]; | |
| 1613 | if (c != transparent_color) | |
| 1614 | { | |
| 1615 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1616 | dest[x] = alpha_blend16(dest[x], pal[c]); | |
| 1617 | // dest[x] = alpha_blend16(dest[x], colorbase + c); | |
| 1618 | pri[x] = 31; | |
| 1619 | } | |
| 1620 | x_index += dx; | |
| 1621 | } | |
| 1038 | /* get final code and color, and grab lookup tables */ | |
| 1039 | code %= gfx->total_elements; | |
| 1040 | color %= gfx->total_colors; | |
| 1041 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 1622 | 1042 | |
| 1623 | y_index += dy; | |
| 1624 | } | |
| 1625 | else | |
| 1626 | for (y = sy; y < ey; y++) | |
| 1627 | { | |
| 1628 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1629 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1043 | /* high bit of the mask is implicitly on */ | |
| 1044 | pmask |= 1 << 31; | |
| 1630 | 1045 | |
| 1631 | int x, x_index = x_index_base; | |
| 1632 | for (x = sx; x < ex; x++) | |
| 1633 | { | |
| 1634 | int c = source[x_index>>16]; | |
| 1635 | if( c != transparent_color ) dest[x] = alpha_blend16(dest[x], pal[c]); | |
| 1636 | // if (c != transparent_color) dest[x] = alpha_blend16(dest[x], colorbase + c); | |
| 1637 | x_index += dx; | |
| 1638 | } | |
| 1046 | /* render based on dest bitmap depth */ | |
| 1047 | if (dest->bpp == 16) | |
| 1048 | DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8); | |
| 1049 | else | |
| 1050 | DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8); | |
| 1051 | } | |
| 1639 | 1052 | |
| 1640 | y_index += dy; | |
| 1641 | } | |
| 1642 | } | |
| 1643 | 1053 | |
| 1644 | /* case 7: TRANSPARENCY_ALPHARANGE */ | |
| 1645 | if (transparency == TRANSPARENCY_ALPHARANGE) | |
| 1646 | { | |
| 1647 | if (pri_buffer) | |
| 1648 | for (y = sy; y < ey; y++) | |
| 1649 | { | |
| 1650 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1651 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1652 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 1054 | /*------------------------------------------------- | |
| 1055 | pdrawgfx_transpen - render a gfx element with | |
| 1056 | a single transparent pen, checking against the | |
| 1057 | priority bitmap | |
| 1058 | -------------------------------------------------*/ | |
| 1653 | 1059 | |
| 1654 | int x, x_index = x_index_base; | |
| 1655 | for (x = sx; x < ex; x++) | |
| 1656 | { | |
| 1657 | int c = source[x_index>>16]; | |
| 1658 | if (c != transparent_color) | |
| 1659 | { | |
| 1660 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1661 | { | |
| 1662 | if (gfx_alpharange_table[c] == 0xff) | |
| 1663 | dest[x] = pal[c]; | |
| 1664 | // dest[x] = colorbase + c; | |
| 1665 | else | |
| 1666 | dest[x] = alpha_blend_r16(dest[x], pal[c], gfx_alpharange_table[c]); | |
| 1667 | // dest[x] = alpha_blend_r16(dest[x], colorbase + c, gfx_alpharange_table[c]); | |
| 1668 | } | |
| 1669 | pri[x] = 31; | |
| 1670 | } | |
| 1671 | x_index += dx; | |
| 1672 | } | |
| 1060 | void pdrawgfx_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1061 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1062 | bitmap_t *priority, UINT32 pmask, UINT32 transpen) | |
| 1063 | { | |
| 1064 | const pen_t *paldata; | |
| 1673 | 1065 | |
| 1674 | y_index += dy; | |
| 1675 | } | |
| 1676 | else | |
| 1677 | for (y = sy; y < ey; y++) | |
| 1678 | { | |
| 1679 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1680 | UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); | |
| 1066 | /* special case invalid pens to opaque */ | |
| 1067 | if (transpen > 0xff) | |
| 1068 | { | |
| 1069 | pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask); | |
| 1070 | return; | |
| 1071 | } | |
| 1681 | 1072 | |
| 1682 | int x, x_index = x_index_base; | |
| 1683 | for (x = sx; x < ex; x++) | |
| 1684 | { | |
| 1685 | int c = source[x_index>>16]; | |
| 1686 | if (c != transparent_color) | |
| 1687 | { | |
| 1688 | if (gfx_alpharange_table[c] == 0xff) | |
| 1689 | dest[x] = pal[c]; | |
| 1690 | // dest[x] = colorbase + c; | |
| 1691 | else | |
| 1692 | dest[x] = alpha_blend_r16(dest[x], pal[c], gfx_alpharange_table[c]); | |
| 1693 | // dest[x] = alpha_blend_r16(dest[x], colorbase + c, gfx_alpharange_table[c]); | |
| 1694 | } | |
| 1695 | x_index += dx; | |
| 1696 | } | |
| 1073 | assert(dest != NULL); | |
| 1074 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1075 | assert(gfx != NULL); | |
| 1697 | 1076 | |
| 1698 | y_index += dy; | |
| 1699 | } | |
| 1700 | } | |
| 1701 | } | |
| 1702 | } | |
| 1703 | } | |
| 1077 | /* get final code and color, and grab lookup tables */ | |
| 1078 | code %= gfx->total_elements; | |
| 1079 | color %= gfx->total_colors; | |
| 1080 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 1704 | 1081 | |
| 1705 | /* 32-bit destination bitmap */ | |
| 1706 | else | |
| 1082 | /* use pen usage to optimize */ | |
| 1083 | if (gfx->pen_usage != NULL && !gfx->dirty[code]) | |
| 1707 | 1084 | { |
| 1708 | const pen_t *pal = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; | |
| 1709 | UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo; | |
| 1085 | UINT32 usage = gfx->pen_usage[code]; | |
| 1710 | 1086 | |
| 1711 | int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; | |
| 1712 | int sprite_screen_width = (scalex*gfx->width+0x8000)>>16; | |
| 1087 | /* fully transparent; do nothing */ | |
| 1088 | if ((usage & ~(1 << transpen)) == 0) | |
| 1089 | return; | |
| 1713 | 1090 | |
| 1714 | if (sprite_screen_width && sprite_screen_height) | |
| 1091 | /* fully opaque; draw as such */ | |
| 1092 | if ((usage & (1 << transpen)) == 0) | |
| 1715 | 1093 | { |
| 1716 | /* compute sprite increment per screen pixel */ | |
| 1717 | int dx = (gfx->width<<16)/sprite_screen_width; | |
| 1718 | int dy = (gfx->height<<16)/sprite_screen_height; | |
| 1094 | pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask); | |
| 1095 | return; | |
| 1096 | } | |
| 1097 | } | |
| 1719 | 1098 | |
| 1720 | int ex = sx+sprite_screen_width; | |
| 1721 | int ey = sy+sprite_screen_height; | |
| 1099 | /* high bit of the mask is implicitly on */ | |
| 1100 | pmask |= 1 << 31; | |
| 1722 | 1101 | |
| 1723 | int x_index_base; | |
| 1724 | int y_index; | |
| 1102 | /* render based on dest bitmap depth */ | |
| 1103 | if (dest->bpp == 16) | |
| 1104 | DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8); | |
| 1105 | else | |
| 1106 | DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8); | |
| 1107 | } | |
| 1725 | 1108 | |
| 1726 | if (flipx) | |
| 1727 | { | |
| 1728 | x_index_base = (sprite_screen_width-1)*dx; | |
| 1729 | dx = -dx; | |
| 1730 | } | |
| 1731 | else | |
| 1732 | { | |
| 1733 | x_index_base = 0; | |
| 1734 | } | |
| 1735 | 1109 | |
| 1736 | if (flipy) | |
| 1737 | { | |
| 1738 | y_index = (sprite_screen_height-1)*dy; | |
| 1739 | dy = -dy; | |
| 1740 | } | |
| 1741 | else | |
| 1742 | { | |
| 1743 | y_index = 0; | |
| 1744 | } | |
| 1110 | /*------------------------------------------------- | |
| 1111 | pdrawgfx_transpen_raw - render a gfx element | |
| 1112 | with a single transparent pen and no color | |
| 1113 | lookups, checking against the priority bitmap | |
| 1114 | -------------------------------------------------*/ | |
| 1745 | 1115 | |
| 1746 | if (clip) | |
| 1747 | { | |
| 1748 | if (sx < clip->min_x) | |
| 1749 | { /* clip left */ | |
| 1750 | int pixels = clip->min_x-sx; | |
| 1751 | sx += pixels; | |
| 1752 | x_index_base += pixels*dx; | |
| 1753 | } | |
| 1116 | void pdrawgfx_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1117 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1118 | bitmap_t *priority, UINT32 pmask, UINT32 transpen) | |
| 1119 | { | |
| 1120 | assert(dest != NULL); | |
| 1121 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1122 | assert(gfx != NULL); | |
| 1754 | 1123 | |
| 1755 | if (sy < clip->min_y) | |
| 1756 | { /* clip top */ | |
| 1757 | int pixels = clip->min_y-sy; | |
| 1758 | sy += pixels; | |
| 1759 | y_index += pixels*dy; | |
| 1760 | } | |
| 1124 | /* get final code and color, and grab lookup tables */ | |
| 1125 | code %= gfx->total_elements; | |
| 1761 | 1126 | |
| 1762 | if (ex > clip->max_x + 1) | |
| 1763 | { /* clip right */ | |
| 1764 | int pixels = ex-clip->max_x-1; | |
| 1765 | ex -= pixels; | |
| 1766 | } | |
| 1127 | /* early out if completely transparent */ | |
| 1128 | if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) | |
| 1129 | return; | |
| 1767 | 1130 | |
| 1768 | if (ey > clip->max_y + 1) | |
| 1769 | { /* clip bottom */ | |
| 1770 | int pixels = ey-clip->max_y-1; | |
| 1771 | ey -= pixels; | |
| 1772 | } | |
| 1773 | } | |
| 1131 | /* high bit of the mask is implicitly on */ | |
| 1132 | pmask |= 1 << 31; | |
| 1774 | 1133 | |
| 1775 | if (ex > sx) | |
| 1776 | { /* skip if inner loop doesn't draw anything */ | |
| 1777 | int y; | |
| 1134 | /* render based on dest bitmap depth */ | |
| 1135 | if (dest->bpp == 16) | |
| 1136 | DRAWGFX_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8); | |
| 1137 | else | |
| 1138 | DRAWGFX_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8); | |
| 1139 | } | |
| 1778 | 1140 | |
| 1779 | /* case 0: TRANSPARENCY_NONE */ | |
| 1780 | if (transparency == TRANSPARENCY_NONE) | |
| 1781 | { | |
| 1782 | if (pri_buffer) | |
| 1783 | for (y = sy; y < ey; y++) | |
| 1784 | { | |
| 1785 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1786 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 1787 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 1788 | 1141 | |
| 1789 | int x, x_index = x_index_base; | |
| 1790 | for (x = sx; x < ex; x++) | |
| 1791 | { | |
| 1792 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1793 | dest[x] = pal[source[x_index>>16]]; | |
| 1794 | pri[x] = 31; | |
| 1795 | x_index += dx; | |
| 1796 | } | |
| 1142 | /*------------------------------------------------- | |
| 1143 | pdrawgfx_transmask - render a gfx element | |
| 1144 | with a multiple transparent pens provided as | |
| 1145 | a mask, checking against the priority bitmap | |
| 1146 | -------------------------------------------------*/ | |
| 1797 | 1147 | |
| 1798 | y_index += dy; | |
| 1799 | } | |
| 1800 | else | |
| 1801 | for (y = sy; y < ey; y++) | |
| 1802 | { | |
| 1803 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1804 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 1148 | void pdrawgfx_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1149 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1150 | bitmap_t *priority, UINT32 pmask, UINT32 transmask) | |
| 1151 | { | |
| 1152 | const pen_t *paldata; | |
| 1805 | 1153 | |
| 1806 | int x, x_index = x_index_base; | |
| 1807 | for (x = sx; x < ex; x++) | |
| 1808 | { | |
| 1809 | dest[x] = pal[source[x_index>>16]]; | |
| 1810 | x_index += dx; | |
| 1811 | } | |
| 1154 | /* special case 0 mask to opaque */ | |
| 1155 | if (transmask == 0) | |
| 1156 | { | |
| 1157 | pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask); | |
| 1158 | return; | |
| 1159 | } | |
| 1812 | 1160 | |
| 1813 | y_index += dy; | |
| 1814 | } | |
| 1815 | } | |
| 1161 | assert(dest != NULL); | |
| 1162 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1163 | assert(gfx != NULL); | |
| 1816 | 1164 | |
| 1817 | /* case 1: TRANSPARENCY_PEN */ | |
| 1818 | if (transparency == TRANSPARENCY_PEN) | |
| 1819 | { | |
| 1820 | if (pri_buffer) | |
| 1821 | for (y = sy; y < ey; y++) | |
| 1822 | { | |
| 1823 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1824 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 1825 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 1165 | /* get final code and color, and grab lookup tables */ | |
| 1166 | code %= gfx->total_elements; | |
| 1167 | color %= gfx->total_colors; | |
| 1168 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 1826 | 1169 | |
| 1827 | int x, x_index = x_index_base; | |
| 1828 | for (x = sx; x < ex; x++) | |
| 1829 | { | |
| 1830 | int c = source[x_index>>16]; | |
| 1831 | if (c != transparent_color) | |
| 1832 | { | |
| 1833 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1834 | dest[x] = pal[c]; | |
| 1835 | pri[x] = 31; | |
| 1836 | } | |
| 1837 | x_index += dx; | |
| 1838 | } | |
| 1170 | /* use pen usage to optimize */ | |
| 1171 | if (gfx->pen_usage != NULL && !gfx->dirty[code]) | |
| 1172 | { | |
| 1173 | UINT32 usage = gfx->pen_usage[code]; | |
| 1839 | 1174 | |
| 1840 | y_index += dy; | |
| 1841 | } | |
| 1842 | else | |
| 1843 | for (y = sy; y < ey; y++) | |
| 1844 | { | |
| 1845 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1846 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 1175 | /* fully transparent; do nothing */ | |
| 1176 | if ((usage & ~transmask) == 0) | |
| 1177 | return; | |
| 1847 | 1178 | |
| 1848 | int x, x_index = x_index_base; | |
| 1849 | for (x = sx; x < ex; x++) | |
| 1850 | { | |
| 1851 | int c = source[x_index>>16]; | |
| 1852 | if (c != transparent_color) dest[x] = pal[c]; | |
| 1853 | x_index += dx; | |
| 1854 | } | |
| 1179 | /* fully opaque; draw as such */ | |
| 1180 | if ((usage & transmask) == 0) | |
| 1181 | { | |
| 1182 | pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask); | |
| 1183 | return; | |
| 1184 | } | |
| 1185 | } | |
| 1855 | 1186 | |
| 1856 | y_index += dy; | |
| 1857 | } | |
| 1858 | } | |
| 1187 | /* high bit of the mask is implicitly on */ | |
| 1188 | pmask |= 1 << 31; | |
| 1859 | 1189 | |
| 1860 | /* case 1b: TRANSPARENCY_PEN_RAW */ | |
| 1861 | if (transparency == TRANSPARENCY_PEN_RAW) | |
| 1862 | { | |
| 1863 | if (pri_buffer) | |
| 1864 | for (y = sy; y < ey; y++) | |
| 1865 | { | |
| 1866 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1867 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 1868 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 1190 | /* render based on dest bitmap depth */ | |
| 1191 | if (dest->bpp == 16) | |
| 1192 | DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8); | |
| 1193 | else | |
| 1194 | DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8); | |
| 1195 | } | |
| 1869 | 1196 | |
| 1870 | int x, x_index = x_index_base; | |
| 1871 | for (x = sx; x < ex; x++) | |
| 1872 | { | |
| 1873 | int c = source[x_index>>16]; | |
| 1874 | if (c != transparent_color) | |
| 1875 | { | |
| 1876 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1877 | dest[x] = color + c; | |
| 1878 | pri[x] = 31; | |
| 1879 | } | |
| 1880 | x_index += dx; | |
| 1881 | } | |
| 1882 | 1197 | |
| 1883 | y_index += dy; | |
| 1884 | } | |
| 1885 | else | |
| 1886 | for (y = sy; y < ey; y++) | |
| 1887 | { | |
| 1888 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1889 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 1198 | /*------------------------------------------------- | |
| 1199 | pdrawgfx_transtable - render a gfx element | |
| 1200 | using a table to look up which pens are | |
| 1201 | transparent, opaque, or shadowing, checking | |
| 1202 | against the priority bitmap | |
| 1203 | -------------------------------------------------*/ | |
| 1890 | 1204 | |
| 1891 | int x, x_index = x_index_base; | |
| 1892 | for (x = sx; x < ex; x++) | |
| 1893 | { | |
| 1894 | int c = source[x_index>>16]; | |
| 1895 | if (c != transparent_color) dest[x] = color + c; | |
| 1896 | x_index += dx; | |
| 1897 | } | |
| 1205 | void pdrawgfx_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1206 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1207 | bitmap_t *priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable) | |
| 1208 | { | |
| 1209 | const pen_t *paldata; | |
| 1898 | 1210 | |
| 1899 | y_index += dy; | |
| 1900 | } | |
| 1901 | } | |
| 1211 | assert(dest != NULL); | |
| 1212 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1213 | assert(gfx != NULL); | |
| 1214 | assert(pentable != NULL); | |
| 1902 | 1215 | |
| 1903 | /* case 2: TRANSPARENCY_PENS */ | |
| 1904 | if (transparency == TRANSPARENCY_PENS) | |
| 1905 | { | |
| 1906 | if (pri_buffer) | |
| 1907 | for (y = sy; y < ey; y++) | |
| 1908 | { | |
| 1909 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1910 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 1911 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 1216 | /* get final code and color, and grab lookup tables */ | |
| 1217 | code %= gfx->total_elements; | |
| 1218 | color %= gfx->total_colors; | |
| 1219 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 1912 | 1220 | |
| 1913 | int x, x_index = x_index_base; | |
| 1914 | for (x = sx; x < ex; x++) | |
| 1915 | { | |
| 1916 | int c = source[x_index>>16]; | |
| 1917 | if (((1 << c) & transparent_color) == 0) | |
| 1918 | { | |
| 1919 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 1920 | dest[x] = pal[c]; | |
| 1921 | pri[x] = 31; | |
| 1922 | } | |
| 1923 | x_index += dx; | |
| 1924 | } | |
| 1221 | /* high bit of the mask is implicitly on */ | |
| 1222 | pmask |= 1 << 31; | |
| 1925 | 1223 | |
| 1926 | y_index += dy; | |
| 1927 | } | |
| 1928 | else | |
| 1929 | for (y = sy; y < ey; y++) | |
| 1930 | { | |
| 1931 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1932 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 1224 | /* render based on dest bitmap depth */ | |
| 1225 | if (dest->bpp == 16) | |
| 1226 | DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8); | |
| 1227 | else | |
| 1228 | DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8); | |
| 1229 | } | |
| 1933 | 1230 | |
| 1934 | int x, x_index = x_index_base; | |
| 1935 | for (x = sx; x < ex; x++) | |
| 1936 | { | |
| 1937 | int c = source[x_index>>16]; | |
| 1938 | if (((1 << c) & transparent_color) == 0) | |
| 1939 | dest[x] = pal[c]; | |
| 1940 | x_index += dx; | |
| 1941 | } | |
| 1942 | 1231 | |
| 1943 | y_index += dy; | |
| 1944 | } | |
| 1945 | } | |
| 1232 | /*------------------------------------------------- | |
| 1233 | pdrawgfx_alpha - render a gfx element with | |
| 1234 | a single transparent pen, alpha blending the | |
| 1235 | remaining pixels with a fixed alpha value, | |
| 1236 | checking against the priority bitmap | |
| 1237 | -------------------------------------------------*/ | |
| 1946 | 1238 | |
| 1947 | /* case 3: TRANSPARENCY_PEN_TABLE */ | |
| 1948 | if (transparency == TRANSPARENCY_PEN_TABLE) | |
| 1949 | { | |
| 1950 | pen_t *palette_shadow_table = gfx->machine->shadow_table; | |
| 1951 | UINT8 *source; | |
| 1952 | UINT8 *pri; | |
| 1953 | UINT32 *dest; | |
| 1954 | int c, x, x_index; | |
| 1955 | UINT8 al, ah; | |
| 1239 | void pdrawgfx_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1240 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1241 | bitmap_t *priority, UINT32 pmask, UINT32 transpen, UINT8 alpha) | |
| 1242 | { | |
| 1243 | const pen_t *paldata; | |
| 1956 | 1244 | |
| 1957 | if (pri_buffer) | |
| 1958 | for (y = sy; y < ey; y++) | |
| 1959 | { | |
| 1960 | source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 1961 | y_index += dy; | |
| 1962 | dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 1963 | pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 1964 | x_index = x_index_base; | |
| 1245 | assert(dest != NULL); | |
| 1246 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1247 | assert(gfx != NULL); | |
| 1965 | 1248 | |
| 1966 | for (x = sx; x < ex; x++) | |
| 1967 | { | |
| 1968 | int ebx = x_index; | |
| 1969 | x_index += dx; | |
| 1970 | ebx >>= 16; | |
| 1971 | al = pri[x]; | |
| 1972 | c = source[ebx]; | |
| 1973 | ah = al; | |
| 1974 | al &= 0x1f; | |
| 1249 | /* special case alpha = 0xff */ | |
| 1250 | if (alpha == 0xff) | |
| 1251 | { | |
| 1252 | pdrawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen); | |
| 1253 | return; | |
| 1254 | } | |
| 1975 | 1255 | |
| 1976 | if (gfx_drawmode_table[c] == DRAWMODE_NONE) continue; | |
| 1256 | /* get final code and color, and grab lookup tables */ | |
| 1257 | code %= gfx->total_elements; | |
| 1258 | color %= gfx->total_colors; | |
| 1259 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 1977 | 1260 | |
| 1978 | if (!(1<<al & pri_mask)) | |
| 1979 | { | |
| 1980 | if (gfx_drawmode_table[c] == DRAWMODE_SOURCE) | |
| 1981 | { | |
| 1982 | ah &= 0x7f; | |
| 1983 | ebx = pal[c]; | |
| 1984 | ah |= 0x1f; | |
| 1985 | dest[x] = ebx; | |
| 1986 | pri[x] = ah; | |
| 1987 | } | |
| 1988 | else if (!(ah & 0x80)) | |
| 1989 | { | |
| 1990 | ebx = SHADOW32(palette_shadow_table,dest[x]); | |
| 1991 | pri[x] |= 0x80; | |
| 1992 | dest[x] = ebx; | |
| 1993 | } | |
| 1994 | } | |
| 1995 | } | |
| 1996 | } | |
| 1997 | else | |
| 1998 | for (y = sy; y < ey; y++) | |
| 1999 | { | |
| 2000 | source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2001 | y_index += dy; | |
| 2002 | dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 2003 | x_index = x_index_base; | |
| 1261 | /* early out if completely transparent */ | |
| 1262 | if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) | |
| 1263 | return; | |
| 2004 | 1264 | |
| 2005 | for (x = sx; x < ex; x++) | |
| 2006 | { | |
| 2007 | c = source[x_index>>16]; | |
| 2008 | x_index += dx; | |
| 1265 | /* high bit of the mask is implicitly on */ | |
| 1266 | pmask |= 1 << 31; | |
| 2009 | 1267 | |
| 2010 | if (gfx_drawmode_table[c] == DRAWMODE_NONE) continue; | |
| 2011 | if (gfx_drawmode_table[c] == DRAWMODE_SOURCE) | |
| 2012 | dest[x] = pal[c]; | |
| 2013 | else | |
| 2014 | dest[x] = SHADOW32(palette_shadow_table,dest[x]); | |
| 2015 | } | |
| 2016 | } | |
| 2017 | } | |
| 1268 | /* render based on dest bitmap depth */ | |
| 1269 | if (dest->bpp == 16) | |
| 1270 | DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16_PRIORITY, UINT8); | |
| 1271 | else | |
| 1272 | DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8); | |
| 1273 | } | |
| 2018 | 1274 | |
| 2019 | /* case 6: TRANSPARENCY_ALPHA */ | |
| 2020 | if (transparency == TRANSPARENCY_ALPHA) | |
| 2021 | { | |
| 2022 | if (pri_buffer) | |
| 2023 | for (y = sy; y < ey; y++) | |
| 2024 | { | |
| 2025 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2026 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 2027 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 2028 | 1275 | |
| 2029 | int x, x_index = x_index_base; | |
| 2030 | for (x = sx; x < ex; x++) | |
| 2031 | { | |
| 2032 | int c = source[x_index>>16]; | |
| 2033 | if (c != transparent_color) | |
| 2034 | { | |
| 2035 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 2036 | dest[x] = alpha_blend32(dest[x], pal[c]); | |
| 2037 | pri[x] = 31; | |
| 2038 | } | |
| 2039 | x_index += dx; | |
| 2040 | } | |
| 2041 | 1276 | |
| 2042 | y_index += dy; | |
| 2043 | } | |
| 2044 | else | |
| 2045 | for (y = sy; y < ey; y++) | |
| 2046 | { | |
| 2047 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2048 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 1277 | /*************************************************************************** | |
| 1278 | PDRAWGFXZOOM IMPLEMENTATIONS | |
| 1279 | ***************************************************************************/ | |
| 2049 | 1280 | |
| 2050 | int x, x_index = x_index_base; | |
| 2051 | for (x = sx; x < ex; x++) | |
| 2052 | { | |
| 2053 | int c = source[x_index>>16]; | |
| 2054 | if (c != transparent_color) dest[x] = alpha_blend32(dest[x], pal[c]); | |
| 2055 | x_index += dx; | |
| 2056 | } | |
| 1281 | /*------------------------------------------------- | |
| 1282 | pdrawgfxzoom - generic pdrawgfxzoom with | |
| 1283 | legacy interface | |
| 1284 | -------------------------------------------------*/ | |
| 2057 | 1285 | |
| 2058 | y_index += dy; | |
| 2059 | } | |
| 2060 | } | |
| 1286 | void pdrawgfxzoom(bitmap_t *dest, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, | |
| 1287 | INT32 sx, INT32 sy, const rectangle *cliprect, int transparency, UINT32 transparent_color, | |
| 1288 | UINT32 scalex, UINT32 scaley, UINT32 priority_mask) | |
| 1289 | { | |
| 1290 | switch (transparency) | |
| 1291 | { | |
| 1292 | case TRANSPARENCY_NONE: | |
| 1293 | pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy, scalex, scaley, priority_bitmap, priority_mask); | |
| 1294 | break; | |
| 2061 | 1295 | |
| 2062 | /* case 7: TRANSPARENCY_ALPHARANGE */ | |
| 2063 | if (transparency == TRANSPARENCY_ALPHARANGE) | |
| 2064 | { | |
| 2065 | if (pri_buffer) | |
| 2066 | for (y = sy; y < ey; y++) | |
| 2067 | { | |
| 2068 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2069 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 2070 | UINT8 *pri = BITMAP_ADDR8(pri_buffer, y, 0); | |
| 1296 | case TRANSPARENCY_PEN: | |
| 1297 | pdrawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy, scalex, scaley, priority_bitmap, priority_mask, transparent_color); | |
| 1298 | break; | |
| 2071 | 1299 | |
| 2072 | int x, x_index = x_index_base; | |
| 2073 | for (x = sx; x < ex; x++) | |
| 2074 | { | |
| 2075 | int c = source[x_index>>16]; | |
| 2076 | if (c != transparent_color) | |
| 2077 | { | |
| 2078 | if (((1 << pri[x]) & pri_mask) == 0) | |
| 2079 | { | |
| 2080 | if (gfx_alpharange_table[c] == 0xff) | |
| 2081 | dest[x] = pal[c]; | |
| 2082 | else | |
| 2083 | dest[x] = alpha_blend_r32(dest[x], pal[c], gfx_alpharange_table[c]); | |
| 2084 | } | |
| 2085 | pri[x] = 31; | |
| 2086 | } | |
| 2087 | x_index += dx; | |
| 2088 | } | |
| 1300 | case TRANSPARENCY_PENS: | |
| 1301 | pdrawgfxzoom_transmask(dest, cliprect, gfx, code, color, flipx, flipy, sx, sy, scalex, scaley, priority_bitmap, priority_mask, transparent_color); | |
| 1302 | break; | |
| 2089 | 1303 | |
| 2090 | y_index += dy; | |
| 2091 | } | |
| 2092 | else | |
| 2093 | for (y = sy; y < ey; y++) | |
| 2094 | { | |
| 2095 | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; | |
| 2096 | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); | |
| 2097 | ||
| 2098 | int x, x_index = x_index_base; | |
| 2099 | for (x = sx; x < ex; x++) | |
| 2100 | { | |
| 2101 | int c = source[x_index>>16]; | |
| 2102 | if (c != transparent_color) | |
| 2103 | { | |
| 2104 | if (gfx_alpharange_table[c] == 0xff) | |
| 2105 | dest[x] = pal[c]; | |
| 2106 | else | |
| 2107 | dest[x] = alpha_blend_r32(dest[x], pal[c], gfx_alpharange_table[c]); | |
| 2108 | } | |
| 2109 | x_index += dx; | |
| 2110 | } | |
| 2111 | ||
| 2112 | y_index += dy; | |
| 2113 | } | |
| 2114 | } | |
| 2115 | } | |
| 2116 | } | |
| 1304 | default: | |
| 1305 | fatalerror("Invalid transparency specified for pdrawgfxzoom (%d)", transparency); | |
| 1306 | break; | |
| 2117 | 1307 | } |
| 2118 | 1308 | } |
| 2119 | 1309 | |
| 2120 | void drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 2121 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 2122 | const rectangle *clip,int transparency,int transparent_color,int scalex, int scaley) | |
| 2123 | { | |
| 2124 | profiler_mark(PROFILER_DRAWGFX); | |
| 2125 | common_drawgfxzoom(dest_bmp,gfx,code,color,flipx,flipy,sx,sy, | |
| 2126 | clip,transparency,transparent_color,scalex,scaley,NULL,0); | |
| 2127 | profiler_mark(PROFILER_END); | |
| 2128 | } | |
| 2129 | 1310 | |
| 2130 | void pdrawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 2131 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 2132 | const rectangle *clip,int transparency,int transparent_color,int scalex, int scaley, | |
| 2133 | UINT32 priority_mask) | |
| 2134 | { | |
| 2135 | profiler_mark(PROFILER_DRAWGFX); | |
| 2136 | common_drawgfxzoom(dest_bmp,gfx,code,color,flipx,flipy,sx,sy, | |
| 2137 | clip,transparency,transparent_color,scalex,scaley,priority_bitmap,priority_mask | (1<<31)); | |
| 2138 | profiler_mark(PROFILER_END); | |
| 2139 | } | |
| 1311 | /*------------------------------------------------- | |
| 1312 | pdrawgfxzoom_opaque - render a scaled gfx | |
| 1313 | element with no transparency, checking against | |
| 1314 | the priority bitmap | |
| 1315 | -------------------------------------------------*/ | |
| 2140 | 1316 | |
| 2141 | void mdrawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 2142 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 2143 | const rectangle *clip,int transparency,int transparent_color,int scalex, int scaley, | |
| 2144 | UINT32 priority_mask) | |
| 1317 | void pdrawgfxzoom_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1318 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1319 | UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask) | |
| 2145 | 1320 | { |
| 2146 | profiler_mark(PROFILER_DRAWGFX); | |
| 2147 | common_drawgfxzoom(dest_bmp,gfx,code,color,flipx,flipy,sx,sy, | |
| 2148 | clip,transparency,transparent_color,scalex,scaley,priority_bitmap,priority_mask); | |
| 2149 | profiler_mark(PROFILER_END); | |
| 2150 | } | |
| 1321 | const pen_t *paldata; | |
| 2151 | 1322 | |
| 1323 | /* non-zoom case */ | |
| 1324 | if (scalex == 0x10000 && scaley == 0x10000) | |
| 1325 | { | |
| 1326 | pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask); | |
| 1327 | return; | |
| 1328 | } | |
| 2152 | 1329 | |
| 2153 | #else /* DECLAREG */ | |
| 1330 | assert(dest != NULL); | |
| 1331 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1332 | assert(gfx != NULL); | |
| 2154 | 1333 | |
| 2155 | #if (DEPTH != 8) | |
| 2156 | /* -------------------- included inline section --------------------- */ | |
| 2157 | #define ADJUST_8 \ | |
| 2158 | int ydir; \ | |
| 2159 | if (flipy) \ | |
| 2160 | { \ | |
| 2161 | INCREMENT_DST(VMODULO * (dstheight-1)) \ | |
| 2162 | srcdata += (srcheight - dstheight - topskip) * srcmodulo; \ | |
| 2163 | ydir = -1; \ | |
| 2164 | } \ | |
| 2165 | else \ | |
| 2166 | { \ | |
| 2167 | srcdata += topskip * srcmodulo; \ | |
| 2168 | ydir = 1; \ | |
| 2169 | } \ | |
| 2170 | if (flipx) \ | |
| 2171 | { \ | |
| 2172 | INCREMENT_DST(HMODULO * (dstwidth-1)) \ | |
| 2173 | srcdata += (srcwidth - dstwidth - leftskip); \ | |
| 2174 | } \ | |
| 2175 | else \ | |
| 2176 | srcdata += leftskip; \ | |
| 2177 | srcmodulo -= dstwidth; | |
| 1334 | /* get final code and color, and grab lookup tables */ | |
| 1335 | code %= gfx->total_elements; | |
| 1336 | color %= gfx->total_colors; | |
| 1337 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 2178 | 1338 | |
| 1339 | /* high bit of the mask is implicitly on */ | |
| 1340 | pmask |= 1 << 31; | |
| 2179 | 1341 | |
| 2180 | #define ADJUST_4 \ | |
| 2181 | int ydir; \ | |
| 2182 | if (flipy) \ | |
| 2183 | { \ | |
| 2184 | INCREMENT_DST(VMODULO * (dstheight-1)) \ | |
| 2185 | srcdata += (srcheight - dstheight - topskip) * srcmodulo; \ | |
| 2186 | ydir = -1; \ | |
| 2187 | } \ | |
| 2188 | else \ | |
| 2189 | { \ | |
| 2190 | srcdata += topskip * srcmodulo; \ | |
| 2191 | ydir = 1; \ | |
| 2192 | } \ | |
| 2193 | if (flipx) \ | |
| 2194 | { \ | |
| 2195 | INCREMENT_DST(HMODULO * (dstwidth-1)) \ | |
| 2196 | srcdata += (srcwidth - dstwidth - leftskip)/2; \ | |
| 2197 | leftskip = (srcwidth - dstwidth - leftskip) & 1; \ | |
| 2198 | } \ | |
| 2199 | else \ | |
| 2200 | { \ | |
| 2201 | srcdata += leftskip/2; \ | |
| 2202 | leftskip &= 1; \ | |
| 2203 | } \ | |
| 2204 | srcmodulo -= (dstwidth+leftskip)/2; | |
| 1342 | /* render based on dest bitmap depth */ | |
| 1343 | if (dest->bpp == 16) | |
| 1344 | DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8); | |
| 1345 | else | |
| 1346 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8); | |
| 1347 | } | |
| 2205 | 1348 | |
| 2206 | 1349 | |
| 1350 | /*------------------------------------------------- | |
| 1351 | pdrawgfxzoom_transpen - render a scaled gfx | |
| 1352 | element with a single transparent pen, | |
| 1353 | checking against the priority bitmap | |
| 1354 | -------------------------------------------------*/ | |
| 2207 | 1355 | |
| 2208 | #if (RAW == 0) | |
| 2209 | DECLARE_SWAP_RAW_PRI(blockmove_8toN_opaque,(COMMON_ARGS, COLOR_ARG), | |
| 1356 | void pdrawgfxzoom_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1357 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1358 | UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask, | |
| 1359 | UINT32 transpen) | |
| 2210 | 1360 | { |
| 2211 | | |
| 1361 | const pen_t *paldata; | |
| 2212 | 1362 | |
| 2213 | (void)palette_shadow_table; | |
| 2214 | ||
| 2215 | if (flipx) | |
| 1363 | /* non-zoom case */ | |
| 1364 | if (scalex == 0x10000 && scaley == 0x10000) | |
| 2216 | 1365 | { |
| 2217 | DATA_TYPE *end; | |
| 2218 | ||
| 2219 | while (dstheight) | |
| 2220 | { | |
| 2221 | end = dstdata - dstwidth*HMODULO; | |
| 2222 | while (dstdata >= end + 8*HMODULO) | |
| 2223 | { | |
| 2224 | INCREMENT_DST(-8*HMODULO) | |
| 2225 | SETPIXELCOLOR(8*HMODULO,LOOKUP(srcdata[0])) | |
| 2226 | SETPIXELCOLOR(7*HMODULO,LOOKUP(srcdata[1])) | |
| 2227 | SETPIXELCOLOR(6*HMODULO,LOOKUP(srcdata[2])) | |
| 2228 | SETPIXELCOLOR(5*HMODULO,LOOKUP(srcdata[3])) | |
| 2229 | SETPIXELCOLOR(4*HMODULO,LOOKUP(srcdata[4])) | |
| 2230 | SETPIXELCOLOR(3*HMODULO,LOOKUP(srcdata[5])) | |
| 2231 | SETPIXELCOLOR(2*HMODULO,LOOKUP(srcdata[6])) | |
| 2232 | SETPIXELCOLOR(1*HMODULO,LOOKUP(srcdata[7])) | |
| 2233 | srcdata += 8; | |
| 2234 | } | |
| 2235 | while (dstdata > end) | |
| 2236 | { | |
| 2237 | SETPIXELCOLOR(0,LOOKUP(*srcdata)) | |
| 2238 | srcdata++; | |
| 2239 | INCREMENT_DST(-HMODULO) | |
| 2240 | } | |
| 2241 | ||
| 2242 | srcdata += srcmodulo; | |
| 2243 | INCREMENT_DST(ydir*VMODULO + dstwidth*HMODULO) | |
| 2244 | dstheight--; | |
| 2245 | } | |
| 1366 | pdrawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen); | |
| 1367 | return; | |
| 2246 | 1368 | } |
| 2247 | else | |
| 2248 | { | |
| 2249 | DATA_TYPE *end; | |
| 2250 | 1369 | |
| 2251 | while (dstheight) | |
| 2252 | { | |
| 2253 | end = dstdata + dstwidth*HMODULO; | |
| 2254 | while (dstdata <= end - 8*HMODULO) | |
| 2255 | { | |
| 2256 | SETPIXELCOLOR(0*HMODULO,LOOKUP(srcdata[0])) | |
| 2257 | SETPIXELCOLOR(1*HMODULO,LOOKUP(srcdata[1])) | |
| 2258 | SETPIXELCOLOR(2*HMODULO,LOOKUP(srcdata[2])) | |
| 2259 | SETPIXELCOLOR(3*HMODULO,LOOKUP(srcdata[3])) | |
| 2260 | SETPIXELCOLOR(4*HMODULO,LOOKUP(srcdata[4])) | |
| 2261 | SETPIXELCOLOR(5*HMODULO,LOOKUP(srcdata[5])) | |
| 2262 | SETPIXELCOLOR(6*HMODULO,LOOKUP(srcdata[6])) | |
| 2263 | SETPIXELCOLOR(7*HMODULO,LOOKUP(srcdata[7])) | |
| 2264 | srcdata += 8; | |
| 2265 | INCREMENT_DST(8*HMODULO) | |
| 2266 | } | |
| 2267 | while (dstdata < end) | |
| 2268 | { | |
| 2269 | SETPIXELCOLOR(0,LOOKUP(*srcdata)) | |
| 2270 | srcdata++; | |
| 2271 | INCREMENT_DST(HMODULO) | |
| 2272 | } | |
| 2273 | ||
| 2274 | srcdata += srcmodulo; | |
| 2275 | INCREMENT_DST(ydir*VMODULO - dstwidth*HMODULO) | |
| 2276 | dstheight--; | |
| 2277 | } | |
| 1370 | /* special case invalid pens to opaque */ | |
| 1371 | if (transpen > 0xff) | |
| 1372 | { | |
| 1373 | pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask); | |
| 1374 | return; | |
| 2278 | 1375 | } |
| 2279 | }) | |
| 2280 | #endif | |
| 2281 | 1376 | |
| 2282 | #if (RAW == 0) | |
| 2283 | DECLARE_SWAP_RAW_PRI(blockmove_4toN_opaque,(COMMON_ARGS, COLOR_ARG), | |
| 2284 | { | |
| 2285 | ADJUST_4 | |
| 1377 | assert(dest != NULL); | |
| 1378 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1379 | assert(gfx != NULL); | |
| 2286 | 1380 | |
| 2287 | (void)palette_shadow_table; | |
| 1381 | /* get final code and color, and grab lookup tables */ | |
| 1382 | code %= gfx->total_elements; | |
| 1383 | color %= gfx->total_colors; | |
| 1384 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 2288 | 1385 | |
| 2289 | if (flipx) | |
| 1386 | /* use pen usage to optimize */ | |
| 1387 | if (gfx->pen_usage != NULL && !gfx->dirty[code]) | |
| 2290 | 1388 | { |
| 2291 | | |
| 1389 | UINT32 | |
| 2292 | 1390 | |
| 2293 | while (dstheight) | |
| 2294 | { | |
| 2295 | end = dstdata - dstwidth*HMODULO; | |
| 2296 | if (leftskip) | |
| 2297 | { | |
| 2298 | SETPIXELCOLOR(0,LOOKUP(*srcdata>>4)) | |
| 2299 | srcdata++; | |
| 2300 | INCREMENT_DST(-HMODULO) | |
| 2301 | } | |
| 2302 | while (dstdata >= end + 8*HMODULO) | |
| 2303 | { | |
| 2304 | INCREMENT_DST(-8*HMODULO) | |
| 2305 | SETPIXELCOLOR(8*HMODULO,LOOKUP(srcdata[0]&0x0f)) | |
| 2306 | SETPIXELCOLOR(7*HMODULO,LOOKUP(srcdata[0]>>4)) | |
| 2307 | SETPIXELCOLOR(6*HMODULO,LOOKUP(srcdata[1]&0x0f)) | |
| 2308 | SETPIXELCOLOR(5*HMODULO,LOOKUP(srcdata[1]>>4)) | |
| 2309 | SETPIXELCOLOR(4*HMODULO,LOOKUP(srcdata[2]&0x0f)) | |
| 2310 | SETPIXELCOLOR(3*HMODULO,LOOKUP(srcdata[2]>>4)) | |
| 2311 | SETPIXELCOLOR(2*HMODULO,LOOKUP(srcdata[3]&0x0f)) | |
| 2312 | SETPIXELCOLOR(1*HMODULO,LOOKUP(srcdata[3]>>4)) | |
| 2313 | srcdata += 4; | |
| 2314 | } | |
| 2315 | while (dstdata > end) | |
| 2316 | { | |
| 2317 | SETPIXELCOLOR(0,LOOKUP(*srcdata&0x0f)) | |
| 2318 | INCREMENT_DST(-HMODULO) | |
| 2319 | if (dstdata > end) | |
| 2320 | { | |
| 2321 | SETPIXELCOLOR(0,LOOKUP(*srcdata>>4)) | |
| 2322 | srcdata++; | |
| 2323 | INCREMENT_DST(-HMODULO) | |
| 2324 | } | |
| 2325 | } | |
| 1391 | /* fully transparent; do nothing */ | |
| 1392 | if ((usage & ~(1 << transpen)) == 0) | |
| 1393 | return; | |
| 2326 | 1394 | |
| 2327 | srcdata += srcmodulo; | |
| 2328 | INCREMENT_DST(ydir*VMODULO + dstwidth*HMODULO) | |
| 2329 | dstheight--; | |
| 1395 | /* fully opaque; draw as such */ | |
| 1396 | if ((usage & (1 << transpen)) == 0) | |
| 1397 | { | |
| 1398 | pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask); | |
| 1399 | return; | |
| 2330 | 1400 | } |
| 2331 | 1401 | } |
| 2332 | else | |
| 2333 | { | |
| 2334 | DATA_TYPE *end; | |
| 2335 | 1402 | |
| 2336 | while (dstheight) | |
| 2337 | { | |
| 2338 | end = dstdata + dstwidth*HMODULO; | |
| 2339 | if (leftskip) | |
| 2340 | { | |
| 2341 | SETPIXELCOLOR(0,LOOKUP(*srcdata>>4)) | |
| 2342 | srcdata++; | |
| 2343 | INCREMENT_DST(HMODULO) | |
| 2344 | } | |
| 2345 | while (dstdata <= end - 8*HMODULO) | |
| 2346 | { | |
| 2347 | SETPIXELCOLOR(0*HMODULO,LOOKUP(srcdata[0]&0x0f)) | |
| 2348 | SETPIXELCOLOR(1*HMODULO,LOOKUP(srcdata[0]>>4)) | |
| 2349 | SETPIXELCOLOR(2*HMODULO,LOOKUP(srcdata[1]&0x0f)) | |
| 2350 | SETPIXELCOLOR(3*HMODULO,LOOKUP(srcdata[1]>>4)) | |
| 2351 | SETPIXELCOLOR(4*HMODULO,LOOKUP(srcdata[2]&0x0f)) | |
| 2352 | SETPIXELCOLOR(5*HMODULO,LOOKUP(srcdata[2]>>4)) | |
| 2353 | SETPIXELCOLOR(6*HMODULO,LOOKUP(srcdata[3]&0x0f)) | |
| 2354 | SETPIXELCOLOR(7*HMODULO,LOOKUP(srcdata[3]>>4)) | |
| 2355 | srcdata += 4; | |
| 2356 | INCREMENT_DST(8*HMODULO) | |
| 2357 | } | |
| 2358 | while (dstdata < end) | |
| 2359 | { | |
| 2360 | SETPIXELCOLOR(0,LOOKUP(*srcdata&0x0f)) | |
| 2361 | INCREMENT_DST(HMODULO) | |
| 2362 | if (dstdata < end) | |
| 2363 | { | |
| 2364 | SETPIXELCOLOR(0,LOOKUP(*srcdata>>4)) | |
| 2365 | srcdata++; | |
| 2366 | INCREMENT_DST(HMODULO) | |
| 2367 | } | |
| 2368 | } | |
| 1403 | /* high bit of the mask is implicitly on */ | |
| 1404 | pmask |= 1 << 31; | |
| 2369 | 1405 | |
| 2370 | srcdata += srcmodulo; | |
| 2371 | INCREMENT_DST(ydir*VMODULO - dstwidth*HMODULO) | |
| 2372 | dstheight--; | |
| 2373 | } | |
| 2374 | } | |
| 2375 | }) | |
| 2376 | #endif | |
| 1406 | /* render based on dest bitmap depth */ | |
| 1407 | if (dest->bpp == 16) | |
| 1408 | DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8); | |
| 1409 | else | |
| 1410 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8); | |
| 1411 | } | |
| 2377 | 1412 | |
| 2378 | DECLARE_SWAP_RAW_PRI(blockmove_8toN_transpen,(COMMON_ARGS, COLOR_ARG, int transpen), | |
| 2379 | { | |
| 2380 | ADJUST_8 | |
| 2381 | 1413 | |
| 2382 | (void)palette_shadow_table; | |
| 1414 | /*------------------------------------------------- | |
| 1415 | pdrawgfxzoom_transpen_raw - render a scaled gfx | |
| 1416 | element with a single transparent pen and no | |
| 1417 | color lookups, checking against the priority | |
| 1418 | bitmap | |
| 1419 | -------------------------------------------------*/ | |
| 2383 | 1420 | |
| 2384 | if (flipx) | |
| 1421 | void pdrawgfxzoom_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1422 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1423 | UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask, | |
| 1424 | UINT32 transpen) | |
| 1425 | { | |
| 1426 | /* non-zoom case */ | |
| 1427 | if (scalex == 0x10000 && scaley == 0x10000) | |
| 2385 | 1428 | { |
| 2386 | DATA_TYPE *end; | |
| 2387 | int trans4; | |
| 2388 | UINT32 *sd4; | |
| 1429 | pdrawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen); | |
| 1430 | return; | |
| 1431 | } | |
| 2389 | 1432 | |
| 2390 | trans4 = transpen * 0x01010101; | |
| 1433 | assert(dest != NULL); | |
| 1434 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1435 | assert(gfx != NULL); | |
| 2391 | 1436 | |
| 2392 | while (dstheight) | |
| 2393 | { | |
| 2394 | end = dstdata - dstwidth*HMODULO; | |
| 2395 | while (((FPTR)srcdata & 3) && dstdata > end) /* longword align */ | |
| 2396 | { | |
| 2397 | int col; | |
| 1437 | /* get final code and color, and grab lookup tables */ | |
| 1438 | code %= gfx->total_elements; | |
| 2398 | 1439 | |
| 2399 | col = *(srcdata++); | |
| 2400 | if (col != transpen) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2401 | INCREMENT_DST(-HMODULO) | |
| 2402 | } | |
| 2403 | sd4 = (UINT32 *)srcdata; | |
| 2404 | while (dstdata >= end + 4*HMODULO) | |
| 2405 | { | |
| 2406 | UINT32 col4; | |
| 1440 | /* early out if completely transparent */ | |
| 1441 | if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) | |
| 1442 | return; | |
| 2407 | 1443 | |
| 2408 | INCREMENT_DST(-4*HMODULO) | |
| 2409 | if ((col4 = *(sd4++)) != trans4) | |
| 2410 | { | |
| 2411 | UINT32 xod4; | |
| 1444 | /* high bit of the mask is implicitly on */ | |
| 1445 | pmask |= 1 << 31; | |
| 2412 | 1446 | |
| 2413 | xod4 = col4 ^ trans4; | |
| 2414 | if (xod4 & (0xff<<SHIFT0)) SETPIXELCOLOR(4*HMODULO,LOOKUP((col4>>SHIFT0) & 0xff)) | |
| 2415 | if (xod4 & (0xff<<SHIFT1)) SETPIXELCOLOR(3*HMODULO,LOOKUP((col4>>SHIFT1) & 0xff)) | |
| 2416 | if (xod4 & (0xff<<SHIFT2)) SETPIXELCOLOR(2*HMODULO,LOOKUP((col4>>SHIFT2) & 0xff)) | |
| 2417 | if (xod4 & (0xff<<SHIFT3)) SETPIXELCOLOR(1*HMODULO,LOOKUP((col4>>SHIFT3) & 0xff)) | |
| 2418 | } | |
| 2419 | } | |
| 2420 | srcdata = (UINT8 *)sd4; | |
| 2421 | while (dstdata > end) | |
| 2422 | { | |
| 2423 | int col; | |
| 2424 | ||
| 2425 | col = *(srcdata++); | |
| 2426 | if (col != transpen) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2427 | INCREMENT_DST(-HMODULO) | |
| 2428 | } | |
| 2429 | ||
| 2430 | srcdata += srcmodulo; | |
| 2431 | INCREMENT_DST(ydir*VMODULO + dstwidth*HMODULO); | |
| 2432 | dstheight--; | |
| 2433 | } | |
| 2434 | } | |
| 1447 | /* render based on dest bitmap depth */ | |
| 1448 | if (dest->bpp == 16) | |
| 1449 | DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8); | |
| 2435 | 1450 | else |
| 2436 | { | |
| 2437 | DATA_TYPE *end; | |
| 2438 | int trans4; | |
| 2439 | UINT32 *sd4; | |
| 1451 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8); | |
| 1452 | } | |
| 2440 | 1453 | |
| 2441 | trans4 = transpen * 0x01010101; | |
| 2442 | 1454 | |
| 2443 | while (dstheight) | |
| 2444 | { | |
| 2445 | end = dstdata + dstwidth*HMODULO; | |
| 2446 | while (((FPTR)srcdata & 3) && dstdata < end) /* longword align */ | |
| 2447 | { | |
| 2448 | int col; | |
| 1455 | /*------------------------------------------------- | |
| 1456 | pdrawgfxzoom_transmask - render a scaled gfx | |
| 1457 | element with a multiple transparent pens | |
| 1458 | provided as a mask, checking against the | |
| 1459 | priority bitmap | |
| 1460 | -------------------------------------------------*/ | |
| 2449 | 1461 | |
| 2450 | col = *(srcdata++); | |
| 2451 | if (col != transpen) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2452 | INCREMENT_DST(HMODULO) | |
| 2453 | } | |
| 2454 | sd4 = (UINT32 *)srcdata; | |
| 2455 | while (dstdata <= end - 4*HMODULO) | |
| 2456 | { | |
| 2457 | UINT32 col4; | |
| 1462 | void pdrawgfxzoom_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1463 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1464 | UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask, | |
| 1465 | UINT32 transmask) | |
| 1466 | { | |
| 1467 | const pen_t *paldata; | |
| 2458 | 1468 | |
| 2459 | if ((col4 = *(sd4++)) != trans4) | |
| 2460 | { | |
| 2461 | UINT32 xod4; | |
| 1469 | /* non-zoom case */ | |
| 1470 | if (scalex == 0x10000 && scaley == 0x10000) | |
| 1471 | { | |
| 1472 | pdrawgfx_transmask(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transmask); | |
| 1473 | return; | |
| 1474 | } | |
| 2462 | 1475 | |
| 2463 | xod4 = col4 ^ trans4; | |
| 2464 | if (xod4 & (0xff<<SHIFT0)) SETPIXELCOLOR(0*HMODULO,LOOKUP((col4>>SHIFT0) & 0xff)) | |
| 2465 | if (xod4 & (0xff<<SHIFT1)) SETPIXELCOLOR(1*HMODULO,LOOKUP((col4>>SHIFT1) & 0xff)) | |
| 2466 | if (xod4 & (0xff<<SHIFT2)) SETPIXELCOLOR(2*HMODULO,LOOKUP((col4>>SHIFT2) & 0xff)) | |
| 2467 | if (xod4 & (0xff<<SHIFT3)) SETPIXELCOLOR(3*HMODULO,LOOKUP((col4>>SHIFT3) & 0xff)) | |
| 2468 | } | |
| 2469 | INCREMENT_DST(4*HMODULO) | |
| 2470 | } | |
| 2471 | srcdata = (UINT8 *)sd4; | |
| 2472 | while (dstdata < end) | |
| 2473 | { | |
| 2474 | int col; | |
| 2475 | ||
| 2476 | col = *(srcdata++); | |
| 2477 | if (col != transpen) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2478 | INCREMENT_DST(HMODULO) | |
| 2479 | } | |
| 2480 | ||
| 2481 | srcdata += srcmodulo; | |
| 2482 | INCREMENT_DST(ydir*VMODULO - dstwidth*HMODULO); | |
| 2483 | dstheight--; | |
| 2484 | } | |
| 1476 | /* special case 0 mask to opaque */ | |
| 1477 | if (transmask == 0) | |
| 1478 | { | |
| 1479 | pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask); | |
| 1480 | return; | |
| 2485 | 1481 | } |
| 2486 | }) | |
| 2487 | 1482 | |
| 2488 | DECLARE_SWAP_RAW_PRI(blockmove_4toN_transpen,(COMMON_ARGS, COLOR_ARG, int transpen), | |
| 2489 | { | |
| 2490 | ADJUST_4 | |
| 1483 | assert(dest != NULL); | |
| 1484 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1485 | assert(gfx != NULL); | |
| 2491 | 1486 | |
| 2492 | (void)palette_shadow_table; | |
| 1487 | /* get final code and color, and grab lookup tables */ | |
| 1488 | code %= gfx->total_elements; | |
| 1489 | color %= gfx->total_colors; | |
| 1490 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 2493 | 1491 | |
| 2494 | if (flipx) | |
| 1492 | /* use pen usage to optimize */ | |
| 1493 | if (gfx->pen_usage != NULL && !gfx->dirty[code]) | |
| 2495 | 1494 | { |
| 2496 | | |
| 1495 | UINT32 | |
| 2497 | 1496 | |
| 2498 | while (dstheight) | |
| 2499 | { | |
| 2500 | int col; | |
| 1497 | /* fully transparent; do nothing */ | |
| 1498 | if ((usage & ~transmask) == 0) | |
| 1499 | return; | |
| 2501 | 1500 | |
| 2502 | end = dstdata - dstwidth*HMODULO; | |
| 2503 | if (leftskip) | |
| 2504 | { | |
| 2505 | col = *(srcdata++)>>4; | |
| 2506 | if (col != transpen) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2507 | INCREMENT_DST(-HMODULO) | |
| 2508 | } | |
| 2509 | while (dstdata > end) | |
| 2510 | { | |
| 2511 | col = *(srcdata)&0x0f; | |
| 2512 | if (col != transpen) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2513 | INCREMENT_DST(-HMODULO) | |
| 2514 | if (dstdata > end) | |
| 2515 | { | |
| 2516 | col = *(srcdata++)>>4; | |
| 2517 | if (col != transpen) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2518 | INCREMENT_DST(-HMODULO) | |
| 2519 | } | |
| 2520 | } | |
| 2521 | ||
| 2522 | srcdata += srcmodulo; | |
| 2523 | INCREMENT_DST(ydir*VMODULO + dstwidth*HMODULO) | |
| 2524 | dstheight--; | |
| 1501 | /* fully opaque; draw as such */ | |
| 1502 | if ((usage & transmask) == 0) | |
| 1503 | { | |
| 1504 | pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask); | |
| 1505 | return; | |
| 2525 | 1506 | } |
| 2526 | 1507 | } |
| 2527 | else | |
| 2528 | { | |
| 2529 | DATA_TYPE *end; | |
| 2530 | 1508 | |
| 2531 | while (dstheight) | |
| 2532 | { | |
| 2533 | int col; | |
| 1509 | /* high bit of the mask is implicitly on */ | |
| 1510 | pmask |= 1 << 31; | |
| 2534 | 1511 | |
| 2535 | end = dstdata + dstwidth*HMODULO; | |
| 2536 | if (leftskip) | |
| 2537 | { | |
| 2538 | col = *(srcdata++)>>4; | |
| 2539 | if (col != transpen) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2540 | INCREMENT_DST(HMODULO) | |
| 2541 | } | |
| 2542 | while (dstdata < end) | |
| 2543 | { | |
| 2544 | col = *(srcdata)&0x0f; | |
| 2545 | if (col != transpen) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2546 | INCREMENT_DST(HMODULO) | |
| 2547 | if (dstdata < end) | |
| 2548 | { | |
| 2549 | col = *(srcdata++)>>4; | |
| 2550 | if (col != transpen) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2551 | INCREMENT_DST(HMODULO) | |
| 2552 | } | |
| 2553 | } | |
| 1512 | /* render based on dest bitmap depth */ | |
| 1513 | if (dest->bpp == 16) | |
| 1514 | DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8); | |
| 1515 | else | |
| 1516 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8); | |
| 1517 | } | |
| 2554 | 1518 | |
| 2555 | srcdata += srcmodulo; | |
| 2556 | INCREMENT_DST(ydir*VMODULO - dstwidth*HMODULO) | |
| 2557 | dstheight--; | |
| 2558 | } | |
| 2559 | } | |
| 2560 | }) | |
| 2561 | 1519 | |
| 2562 | #if (RAW == 0) | |
| 2563 | #define PEN_IS_OPAQUE ((1<<col)&transmask) == 0 | |
| 1520 | /*------------------------------------------------- | |
| 1521 | pdrawgfxzoom_transtable - render a scaled gfx | |
| 1522 | element using a table to look up which pens | |
| 1523 | are transparent, opaque, or shadowing, | |
| 1524 | checking against the priority bitmap | |
| 1525 | -------------------------------------------------*/ | |
| 2564 | 1526 | |
| 2565 | DECLARE_SWAP_RAW_PRI(blockmove_8toN_transmask,(COMMON_ARGS, COLOR_ARG, int transmask), | |
| 1527 | void pdrawgfxzoom_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1528 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1529 | UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask, | |
| 1530 | const UINT8 *pentable, const pen_t *shadowtable) | |
| 2566 | 1531 | { |
| 2567 | | |
| 1532 | const pen_t *paldata; | |
| 2568 | 1533 | |
| 2569 | (void)palette_shadow_table; | |
| 2570 | ||
| 2571 | if (flipx) | |
| 1534 | /* non-zoom case */ | |
| 1535 | if (scalex == 0x10000 && scaley == 0x10000) | |
| 2572 | 1536 | { |
| 2573 | DATA_TYPE *end; | |
| 2574 | UINT32 *sd4; | |
| 1537 | pdrawgfx_transtable(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, pentable, shadowtable); | |
| 1538 | return; | |
| 1539 | } | |
| 2575 | 1540 | |
| 2576 | while (dstheight) | |
| 2577 | { | |
| 2578 | end = dstdata - dstwidth*HMODULO; | |
| 2579 | while (((FPTR)srcdata & 3) && dstdata > end) /* longword align */ | |
| 2580 | { | |
| 2581 | int col; | |
| 1541 | assert(dest != NULL); | |
| 1542 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1543 | assert(gfx != NULL); | |
| 1544 | assert(pentable != NULL); | |
| 2582 | 1545 | |
| 2583 | col = *(srcdata++); | |
| 2584 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2585 | INCREMENT_DST(-HMODULO) | |
| 2586 | } | |
| 2587 | sd4 = (UINT32 *)srcdata; | |
| 2588 | while (dstdata >= end + 4*HMODULO) | |
| 2589 | { | |
| 2590 | int col; | |
| 2591 | UINT32 col4; | |
| 1546 | /* get final code and color, and grab lookup tables */ | |
| 1547 | code %= gfx->total_elements; | |
| 1548 | color %= gfx->total_colors; | |
| 1549 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 2592 | 1550 | |
| 2593 | INCREMENT_DST(-4*HMODULO) | |
| 2594 | col4 = *(sd4++); | |
| 2595 | col = (col4 >> SHIFT0) & 0xff; | |
| 2596 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(4*HMODULO,LOOKUP(col)) | |
| 2597 | col = (col4 >> SHIFT1) & 0xff; | |
| 2598 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(3*HMODULO,LOOKUP(col)) | |
| 2599 | col = (col4 >> SHIFT2) & 0xff; | |
| 2600 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(2*HMODULO,LOOKUP(col)) | |
| 2601 | col = (col4 >> SHIFT3) & 0xff; | |
| 2602 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(1*HMODULO,LOOKUP(col)) | |
| 2603 | } | |
| 2604 | srcdata = (UINT8 *)sd4; | |
| 2605 | while (dstdata > end) | |
| 2606 | { | |
| 2607 | int col; | |
| 1551 | /* high bit of the mask is implicitly on */ | |
| 1552 | pmask |= 1 << 31; | |
| 2608 | 1553 | |
| 2609 | col = *(srcdata++); | |
| 2610 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2611 | INCREMENT_DST(-HMODULO) | |
| 2612 | } | |
| 2613 | ||
| 2614 | srcdata += srcmodulo; | |
| 2615 | INCREMENT_DST(ydir*VMODULO + dstwidth*HMODULO) | |
| 2616 | dstheight--; | |
| 2617 | } | |
| 2618 | } | |
| 1554 | /* render based on dest bitmap depth */ | |
| 1555 | if (dest->bpp == 16) | |
| 1556 | DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8); | |
| 2619 | 1557 | else |
| 2620 | { | |
| 2621 | DATA_TYPE *end; | |
| 2622 | UINT32 *sd4; | |
| 1558 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8); | |
| 1559 | } | |
| 2623 | 1560 | |
| 2624 | while (dstheight) | |
| 2625 | { | |
| 2626 | end = dstdata + dstwidth*HMODULO; | |
| 2627 | while (((FPTR)srcdata & 3) && dstdata < end) /* longword align */ | |
| 2628 | { | |
| 2629 | int col; | |
| 2630 | 1561 | |
| 2631 | col = *(srcdata++); | |
| 2632 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2633 | INCREMENT_DST(HMODULO) | |
| 2634 | } | |
| 2635 | sd4 = (UINT32 *)srcdata; | |
| 2636 | while (dstdata <= end - 4*HMODULO) | |
| 2637 | { | |
| 2638 | int col; | |
| 2639 | UINT32 col4; | |
| 1562 | /*------------------------------------------------- | |
| 1563 | pdrawgfxzoom_alpha - render a scaled gfx | |
| 1564 | element with a single transparent pen, alpha | |
| 1565 | blending the remaining pixels with a fixed | |
| 1566 | alpha value, checking against the priority | |
| 1567 | bitmap | |
| 1568 | -------------------------------------------------*/ | |
| 2640 | 1569 | |
| 2641 | col4 = *(sd4++); | |
| 2642 | col = (col4 >> SHIFT0) & 0xff; | |
| 2643 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(0*HMODULO,LOOKUP(col)) | |
| 2644 | col = (col4 >> SHIFT1) & 0xff; | |
| 2645 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(1*HMODULO,LOOKUP(col)) | |
| 2646 | col = (col4 >> SHIFT2) & 0xff; | |
| 2647 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(2*HMODULO,LOOKUP(col)) | |
| 2648 | col = (col4 >> SHIFT3) & 0xff; | |
| 2649 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(3*HMODULO,LOOKUP(col)) | |
| 2650 | INCREMENT_DST(4*HMODULO) | |
| 2651 | } | |
| 2652 | srcdata = (UINT8 *)sd4; | |
| 2653 | while (dstdata < end) | |
| 2654 | { | |
| 2655 | int col; | |
| 2656 | ||
| 2657 | col = *(srcdata++); | |
| 2658 | if (PEN_IS_OPAQUE) SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2659 | INCREMENT_DST(HMODULO) | |
| 2660 | } | |
| 2661 | ||
| 2662 | srcdata += srcmodulo; | |
| 2663 | INCREMENT_DST(ydir*VMODULO - dstwidth*HMODULO) | |
| 2664 | dstheight--; | |
| 2665 | } | |
| 2666 | } | |
| 2667 | }) | |
| 2668 | #endif | |
| 2669 | ||
| 2670 | #if (RAW == 0) | |
| 2671 | #if (DEPTH == 32) | |
| 2672 | DECLARE_SWAP_RAW_PRI(blockmove_8toN_pen_table,(COMMON_ARGS, COLOR_ARG, int transcolor), | |
| 1570 | void pdrawgfxzoom_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, | |
| 1571 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, | |
| 1572 | UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask, | |
| 1573 | UINT32 transpen, UINT8 alpha) | |
| 2673 | 1574 | { |
| 2674 | | |
| 1575 | const pen_t *paldata; | |
| 2675 | 1576 | |
| 2676 | (void)palette_shadow_table; | |
| 2677 | ||
| 2678 | if (flipx) | |
| 1577 | /* non-zoom case */ | |
| 1578 | if (scalex == 0x10000 && scaley == 0x10000) | |
| 2679 | 1579 | { |
| 2680 | DATA_TYPE *end; | |
| 2681 | ||
| 2682 | while (dstheight) | |
| 2683 | { | |
| 2684 | end = dstdata - dstwidth*HMODULO; | |
| 2685 | while (dstdata > end) | |
| 2686 | { | |
| 2687 | int col; | |
| 2688 | ||
| 2689 | col = *(srcdata++); | |
| 2690 | if (col != transcolor) | |
| 2691 | { | |
| 2692 | switch(gfx_drawmode_table[col]) | |
| 2693 | { | |
| 2694 | case DRAWMODE_SOURCE: | |
| 2695 | SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2696 | break; | |
| 2697 | case DRAWMODE_SHADOW: | |
| 2698 | afterdrawmask = 0; | |
| 2699 | SETPIXELCOLOR(0,*dstdata) | |
| 2700 | afterdrawmask = 31; | |
| 2701 | break; | |
| 2702 | } | |
| 2703 | } | |
| 2704 | INCREMENT_DST(-HMODULO) | |
| 2705 | } | |
| 2706 | ||
| 2707 | srcdata += srcmodulo; | |
| 2708 | INCREMENT_DST(ydir*VMODULO + dstwidth*HMODULO) | |
| 2709 | dstheight--; | |
| 2710 | } | |
| 1580 | pdrawgfx_alpha(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen, alpha); | |
| 1581 | return; | |
| 2711 | 1582 | } |
| 2712 | else | |
| 2713 | { | |
| 2714 | DATA_TYPE *end; | |
| 2715 | 1583 | |
| 2716 | while (dstheight) | |
| 2717 | { | |
| 2718 | end = dstdata + dstwidth*HMODULO; | |
| 2719 | while (dstdata < end) | |
| 2720 | { | |
| 2721 | int col; | |
| 2722 | ||
| 2723 | col = *(srcdata++); | |
| 2724 | if (col != transcolor) | |
| 2725 | { | |
| 2726 | switch(gfx_drawmode_table[col]) | |
| 2727 | { | |
| 2728 | case DRAWMODE_SOURCE: | |
| 2729 | SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2730 | break; | |
| 2731 | case DRAWMODE_SHADOW: | |
| 2732 | afterdrawmask = 0; | |
| 2733 | SETPIXELCOLOR(0,*dstdata) | |
| 2734 | afterdrawmask = 31; | |
| 2735 | break; | |
| 2736 | } | |
| 2737 | } | |
| 2738 | INCREMENT_DST(HMODULO) | |
| 2739 | } | |
| 2740 | ||
| 2741 | srcdata += srcmodulo; | |
| 2742 | INCREMENT_DST(ydir*VMODULO - dstwidth*HMODULO) | |
| 2743 | dstheight--; | |
| 2744 | } | |
| 1584 | /* special case alpha = 0xff */ | |
| 1585 | if (alpha == 0xff) | |
| 1586 | { | |
| 1587 | pdrawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask, transpen); | |
| 1588 | return; | |
| 2745 | 1589 | } |
| 2746 | }) | |
| 2747 | #else | |
| 2748 | DECLARE_SWAP_RAW_PRI(blockmove_8toN_pen_table,(COMMON_ARGS, COLOR_ARG, int transcolor), | |
| 2749 | { | |
| 2750 | int eax = (pdrawgfx_shadow_lowpri) ? 0 : 0x80; | |
| 2751 | 1590 | |
| 2752 | ADJUST_8 | |
| 1591 | assert(dest != NULL); | |
| 1592 | assert(dest->bpp == 16 || dest->bpp == 32); | |
| 1593 | assert(gfx != NULL); | |
| 2753 | 1594 | |
| 2754 | (void)palette_shadow_table; | |
| 1595 | /* get final code and color, and grab lookup tables */ | |
| 1596 | code %= gfx->total_elements; | |
| 1597 | color %= gfx->total_colors; | |
| 1598 | paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; | |
| 2755 | 1599 | |
| 2756 | if (flipx) | |
| 2757 | { | |
| 2758 | DATA_TYPE *end; | |
| 1600 | /* early out if completely transparent */ | |
| 1601 | if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) | |
| 1602 | return; | |
| 2759 | 1603 | |
| 2760 | while (dstheight) | |
| 2761 | { | |
| 2762 | end = dstdata - dstwidth*HMODULO; | |
| 2763 | while (dstdata > end) | |
| 2764 | { | |
| 2765 | int col; | |
| 1604 | /* high bit of the mask is implicitly on */ | |
| 1605 | pmask |= 1 << 31; | |
| 2766 | 1606 | |
| 2767 | col = *(srcdata++); | |
| 2768 | if (col != transcolor) | |
| 2769 | { | |
| 2770 | switch(gfx_drawmode_table[col]) | |
| 2771 | { | |
| 2772 | case DRAWMODE_SOURCE: | |
| 2773 | SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2774 | break; | |
| 2775 | case DRAWMODE_SHADOW: | |
| 2776 | afterdrawmask = eax; | |
| 2777 | SETPIXELCOLOR(0,palette_shadow_table[*dstdata]) | |
| 2778 | afterdrawmask = 31; | |
| 2779 | break; | |
| 2780 | } | |
| 2781 | } | |
| 2782 | INCREMENT_DST(-HMODULO) | |
| 2783 | } | |
| 2784 | ||
| 2785 | srcdata += srcmodulo; | |
| 2786 | INCREMENT_DST(ydir*VMODULO + dstwidth*HMODULO) | |
| 2787 | dstheight--; | |
| 2788 | } | |
| 2789 | } | |
| 1607 | /* render based on dest bitmap depth */ | |
| 1608 | if (dest->bpp == 16) | |
| 1609 | DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16_PRIORITY, UINT8); | |
| 2790 | 1610 | else |
| 2791 | { | |
| 2792 | DATA_TYPE *end; | |
| 1611 | DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8); | |
| 1612 | } | |
| 2793 | 1613 | |
| 2794 | while (dstheight) | |
| 2795 | { | |
| 2796 | end = dstdata + dstwidth*HMODULO; | |
| 2797 | while (dstdata < end) | |
| 2798 | { | |
| 2799 | int col; | |
| 2800 | 1614 | |
| 2801 | col = *(srcdata++); | |
| 2802 | if (col != transcolor) | |
| 2803 | { | |
| 2804 | switch(gfx_drawmode_table[col]) | |
| 2805 | { | |
| 2806 | case DRAWMODE_SOURCE: | |
| 2807 | SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2808 | break; | |
| 2809 | case DRAWMODE_SHADOW: | |
| 2810 | afterdrawmask = eax; | |
| 2811 | SETPIXELCOLOR(0,palette_shadow_table[*dstdata]) | |
| 2812 | afterdrawmask = 31; | |
| 2813 | break; | |
| 2814 | } | |
| 2815 | } | |
| 2816 | INCREMENT_DST(HMODULO) | |
| 2817 | } | |
| 2818 | 1615 | |
| 2819 | srcdata += srcmodulo; | |
| 2820 | INCREMENT_DST(ydir*VMODULO - dstwidth*HMODULO) | |
| 2821 | dstheight--; | |
| 2822 | } | |
| 2823 | } | |
| 2824 | }) | |
| 2825 | #endif | |
| 2826 | #endif | |
| 1616 | /*************************************************************************** | |
| 1617 | DRAW_SCANLINE IMPLEMENTATIONS | |
| 1618 | ***************************************************************************/ | |
| 2827 | 1619 | |
| 2828 | #if (RAW == 0) | |
| 2829 | DECLARE_SWAP_RAW_PRI(blockmove_8toN_alpha,(COMMON_ARGS, COLOR_ARG, int transpen), | |
| 1620 | /*------------------------------------------------- | |
| 1621 | draw_scanline8 - copy pixels from an 8bpp | |
| 1622 | buffer to a single scanline of a bitmap | |
| 1623 | -------------------------------------------------*/ | |
| 1624 | ||
| 1625 | void draw_scanline8(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT8 *srcptr, const pen_t *paldata) | |
| 2830 | 1626 | { |
| 2831 | | |
| 1627 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 2832 | 1628 | |
| 2833 | (void)palette_shadow_table; | |
| 1629 | assert(bitmap != NULL); | |
| 1630 | assert(bitmap->bpp == 16 || bitmap->bpp == 32); | |
| 2834 | 1631 | |
| 2835 | if (flipx) | |
| 1632 | /* palette lookup case */ | |
| 1633 | if (paldata != NULL) | |
| 2836 | 1634 | { |
| 2837 | DATA_TYPE *end; | |
| 2838 | int trans4; | |
| 2839 | UINT32 *sd4; | |
| 1635 | /* 16bpp case */ | |
| 1636 | if (bitmap->bpp == 16) | |
| 1637 | DRAWSCANLINE_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); | |
| 1638 | else | |
| 1639 | DRAWSCANLINE_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); | |
| 1640 | } | |
| 2840 | 1641 | |
| 2841 | trans4 = transpen * 0x01010101; | |
| 1642 | /* raw copy case */ | |
| 1643 | else | |
| 1644 | { | |
| 1645 | /* 16bpp case */ | |
| 1646 | if (bitmap->bpp == 16) | |
| 1647 | DRAWSCANLINE_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 1648 | else | |
| 1649 | DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 1650 | } | |
| 1651 | } | |
| 2842 | 1652 | |
| 2843 | while (dstheight) | |
| 2844 | { | |
| 2845 | end = dstdata - dstwidth*HMODULO; | |
| 2846 | while (((FPTR)srcdata & 3) && dstdata > end) /* longword align */ | |
| 2847 | { | |
| 2848 | int col; | |
| 2849 | 1653 | |
| 2850 | col = *(srcdata++); | |
| 2851 | if (col != transpen) SETPIXELCOLOR(0,alpha_blend(*dstdata, LOOKUP(col))); | |
| 2852 | INCREMENT_DST(-HMODULO); | |
| 2853 | } | |
| 2854 | sd4 = (UINT32 *)srcdata; | |
| 2855 | while (dstdata >= end + 4*HMODULO) | |
| 2856 | { | |
| 2857 | UINT32 col4; | |
| 1654 | /*------------------------------------------------- | |
| 1655 | draw_scanline16 - copy pixels from a 16bpp | |
| 1656 | buffer to a single scanline of a bitmap | |
| 1657 | -------------------------------------------------*/ | |
| 2858 | 1658 | |
| 2859 | INCREMENT_DST(-4*HMODULO); | |
| 2860 | if ((col4 = *(sd4++)) != trans4) | |
| 2861 | { | |
| 2862 | UINT32 xod4; | |
| 1659 | void draw_scanline16(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT16 *srcptr, const pen_t *paldata) | |
| 1660 | { | |
| 1661 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 2863 | 1662 | |
| 2864 | xod4 = col4 ^ trans4; | |
| 2865 | if (xod4 & (0xff<<SHIFT0)) SETPIXELCOLOR(4*HMODULO,alpha_blend(dstdata[4*HMODULO], LOOKUP((col4>>SHIFT0) & 0xff))); | |
| 2866 | if (xod4 & (0xff<<SHIFT1)) SETPIXELCOLOR(3*HMODULO,alpha_blend(dstdata[3*HMODULO], LOOKUP((col4>>SHIFT1) & 0xff))); | |
| 2867 | if (xod4 & (0xff<<SHIFT2)) SETPIXELCOLOR(2*HMODULO,alpha_blend(dstdata[2*HMODULO], LOOKUP((col4>>SHIFT2) & 0xff))); | |
| 2868 | if (xod4 & (0xff<<SHIFT3)) SETPIXELCOLOR(1*HMODULO,alpha_blend(dstdata[1*HMODULO], LOOKUP((col4>>SHIFT3) & 0xff))); | |
| 2869 | } | |
| 2870 | } | |
| 2871 | srcdata = (UINT8 *)sd4; | |
| 2872 | while (dstdata > end) | |
| 2873 | { | |
| 2874 | int col; | |
| 1663 | assert(bitmap != NULL); | |
| 1664 | assert(bitmap->bpp == 16 || bitmap->bpp == 32); | |
| 2875 | 1665 | |
| 2876 | col = *(srcdata++); | |
| 2877 | if (col != transpen) SETPIXELCOLOR(0,alpha_blend(*dstdata, LOOKUP(col))); | |
| 2878 | INCREMENT_DST(-HMODULO); | |
| 2879 | } | |
| 2880 | ||
| 2881 | srcdata += srcmodulo; | |
| 2882 | INCREMENT_DST(ydir*VMODULO + dstwidth*HMODULO); | |
| 2883 | dstheight--; | |
| 2884 | } | |
| 1666 | /* palette lookup case */ | |
| 1667 | if (paldata != NULL) | |
| 1668 | { | |
| 1669 | /* 16bpp case */ | |
| 1670 | if (bitmap->bpp == 16) | |
| 1671 | DRAWSCANLINE_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); | |
| 1672 | else | |
| 1673 | DRAWSCANLINE_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); | |
| 2885 | 1674 | } |
| 1675 | ||
| 1676 | /* raw copy case */ | |
| 2886 | 1677 | else |
| 2887 | 1678 | { |
| 2888 | DATA_TYPE *end; | |
| 2889 | int trans4; | |
| 2890 | UINT32 *sd4; | |
| 1679 | /* 16bpp case */ | |
| 1680 | if (bitmap->bpp == 16) | |
| 1681 | DRAWSCANLINE_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 1682 | else | |
| 1683 | DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 1684 | } | |
| 1685 | } | |
| 2891 | 1686 | |
| 2892 | trans4 = transpen * 0x01010101; | |
| 2893 | 1687 | |
| 2894 | while (dstheight) | |
| 2895 | { | |
| 2896 | end = dstdata + dstwidth*HMODULO; | |
| 2897 | while (((FPTR)srcdata & 3) && dstdata < end) /* longword align */ | |
| 2898 | { | |
| 2899 | int col; | |
| 1688 | /*------------------------------------------------- | |
| 1689 | draw_scanline32 - copy pixels from a 32bpp | |
| 1690 | buffer to a single scanline of a bitmap | |
| 1691 | -------------------------------------------------*/ | |
| 2900 | 1692 | |
| 2901 | col = *(srcdata++); | |
| 2902 | if (col != transpen) SETPIXELCOLOR(0,alpha_blend(*dstdata, LOOKUP(col))); | |
| 2903 | INCREMENT_DST(HMODULO); | |
| 2904 | } | |
| 2905 | sd4 = (UINT32 *)srcdata; | |
| 2906 | while (dstdata <= end - 4*HMODULO) | |
| 2907 | { | |
| 2908 | UINT32 col4; | |
| 2909 | ||
| 2910 | if ((col4 = *(sd4++)) != trans4) | |
| 2911 | { | |
| 2912 | UINT32 xod4; | |
| 2913 | ||
| 2914 | xod4 = col4 ^ trans4; | |
| 2915 | if (xod4 & (0xff<<SHIFT0)) SETPIXELCOLOR(0*HMODULO,alpha_blend(dstdata[0*HMODULO], LOOKUP((col4>>SHIFT0) & 0xff))); | |
| 2916 | if (xod4 & (0xff<<SHIFT1)) SETPIXELCOLOR(1*HMODULO,alpha_blend(dstdata[1*HMODULO], LOOKUP((col4>>SHIFT1) & 0xff))); | |
| 2917 | if (xod4 & (0xff<<SHIFT2)) SETPIXELCOLOR(2*HMODULO,alpha_blend(dstdata[2*HMODULO], LOOKUP((col4>>SHIFT2) & 0xff))); | |
| 2918 | if (xod4 & (0xff<<SHIFT3)) SETPIXELCOLOR(3*HMODULO,alpha_blend(dstdata[3*HMODULO], LOOKUP((col4>>SHIFT3) & 0xff))); | |
| 2919 | } | |
| 2920 | INCREMENT_DST(4*HMODULO); | |
| 2921 | } | |
| 2922 | srcdata = (UINT8 *)sd4; | |
| 2923 | while (dstdata < end) | |
| 2924 | { | |
| 2925 | int col; | |
| 2926 | ||
| 2927 | col = *(srcdata++); | |
| 2928 | if (col != transpen) SETPIXELCOLOR(0,alpha_blend(*dstdata, LOOKUP(col))); | |
| 2929 | INCREMENT_DST(HMODULO); | |
| 2930 | } | |
| 2931 | ||
| 2932 | srcdata += srcmodulo; | |
| 2933 | INCREMENT_DST(ydir*VMODULO - dstwidth*HMODULO); | |
| 2934 | dstheight--; | |
| 2935 | } | |
| 2936 | } | |
| 2937 | }) | |
| 2938 | ||
| 2939 | /* pjp 02/06/02 */ | |
| 2940 | DECLARE_SWAP_RAW_PRI(blockmove_8toN_alpharange,(COMMON_ARGS, COLOR_ARG, int transpen), | |
| 1693 | void draw_scanline32(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, const pen_t *paldata) | |
| 2941 | 1694 | { |
| 2942 | | |
| 1695 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 2943 | 1696 | |
| 2944 | (void)palette_shadow_table; | |
| 1697 | assert(bitmap != NULL); | |
| 1698 | assert(bitmap->bpp == 16 || bitmap->bpp == 32); | |
| 2945 | 1699 | |
| 2946 | if (flipx) | |
| 1700 | /* palette lookup case */ | |
| 1701 | if (paldata != NULL) | |
| 2947 | 1702 | { |
| 2948 | DATA_TYPE *end; | |
| 2949 | ||
| 2950 | while (dstheight) | |
| 2951 | { | |
| 2952 | end = dstdata - dstwidth*HMODULO; | |
| 2953 | while (dstdata > end) /* Note that I'm missing the optimisations present in the other alpha functions */ | |
| 2954 | { | |
| 2955 | int col; | |
| 2956 | ||
| 2957 | col = *(srcdata++); | |
| 2958 | if (col != transpen) | |
| 2959 | { | |
| 2960 | if (gfx_alpharange_table[col] == 0xff) | |
| 2961 | SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2962 | else | |
| 2963 | SETPIXELCOLOR(0,alpha_blend_r(*dstdata,LOOKUP(col),gfx_alpharange_table[col])) | |
| 2964 | } | |
| 2965 | INCREMENT_DST(-HMODULO); | |
| 2966 | } | |
| 2967 | ||
| 2968 | srcdata += srcmodulo; | |
| 2969 | INCREMENT_DST(ydir*VMODULO + dstwidth*HMODULO); | |
| 2970 | dstheight--; | |
| 2971 | } | |
| 1703 | /* 16bpp case */ | |
| 1704 | if (bitmap->bpp == 16) | |
| 1705 | DRAWSCANLINE_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); | |
| 1706 | else | |
| 1707 | DRAWSCANLINE_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); | |
| 2972 | 1708 | } |
| 1709 | ||
| 1710 | /* raw copy case */ | |
| 2973 | 1711 | else |
| 2974 | 1712 | { |
| 2975 | DATA_TYPE *end; | |
| 1713 | /* 16bpp case */ | |
| 1714 | if (bitmap->bpp == 16) | |
| 1715 | DRAWSCANLINE_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 1716 | else | |
| 1717 | DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 1718 | } | |
| 1719 | } | |
| 2976 | 1720 | |
| 2977 | while (dstheight) | |
| 2978 | { | |
| 2979 | end = dstdata + dstwidth*HMODULO; | |
| 2980 | while (dstdata < end) | |
| 2981 | { | |
| 2982 | int col; | |
| 2983 | 1721 | |
| 2984 | col = *(srcdata++); | |
| 2985 | if (col != transpen) | |
| 2986 | { | |
| 2987 | if (gfx_alpharange_table[col] == 0xff) | |
| 2988 | SETPIXELCOLOR(0,LOOKUP(col)) | |
| 2989 | else | |
| 2990 | SETPIXELCOLOR(0,alpha_blend_r(*dstdata,LOOKUP(col),gfx_alpharange_table[col])) | |
| 2991 | } | |
| 2992 | INCREMENT_DST(HMODULO); | |
| 2993 | } | |
| 2994 | 1722 | |
| 2995 | srcdata += srcmodulo; | |
| 2996 | INCREMENT_DST(ydir*VMODULO - dstwidth*HMODULO); | |
| 2997 | dstheight--; | |
| 2998 | } | |
| 2999 | } | |
| 3000 | }) | |
| 3001 | #endif | |
| 1723 | /*************************************************************************** | |
| 1724 | EXTRACT_SCANLINE IMPLEMENTATIONS | |
| 1725 | ***************************************************************************/ | |
| 3002 | 1726 | |
| 3003 | DECLARE(blockmove_NtoN_opaque_noremap,( | |
| 3004 | const DATA_TYPE *srcdata,int srcwidth,int srcheight,int srcmodulo, | |
| 3005 | DATA_TYPE *dstdata,int dstmodulo), | |
| 3006 | { | |
| 3007 | while (srcheight) | |
| 3008 | { | |
| 3009 | memcpy(dstdata,srcdata,srcwidth * sizeof(DATA_TYPE)); | |
| 3010 | srcdata += srcmodulo; | |
| 3011 | dstdata += dstmodulo; | |
| 3012 | srcheight--; | |
| 3013 | } | |
| 3014 | }) | |
| 1727 | /*------------------------------------------------- | |
| 1728 | extract_scanline8 - copy pixels from a single | |
| 1729 | scanline of a bitmap to an 8bpp buffer | |
| 1730 | -------------------------------------------------*/ | |
| 3015 | 1731 | |
| 3016 | DECLARE(blockmove_NtoN_opaque_noremap_flipx,( | |
| 3017 | const DATA_TYPE *srcdata,int srcwidth,int srcheight,int srcmodulo, | |
| 3018 | DATA_TYPE *dstdata,int dstmodulo), | |
| 1732 | void extract_scanline8(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT8 *destptr) | |
| 3019 | 1733 | { |
| 3020 | DATA_TYPE *end; | |
| 1734 | assert(bitmap != NULL); | |
| 1735 | assert(bitmap->bpp == 16 || bitmap->bpp == 32); | |
| 3021 | 1736 | |
| 3022 | srcmodulo += srcwidth; | |
| 3023 | dstmodulo -= srcwidth; | |
| 1737 | /* 16bpp case */ | |
| 1738 | if (bitmap->bpp == 16) | |
| 1739 | EXTRACTSCANLINE_CORE(UINT16); | |
| 1740 | else | |
| 1741 | EXTRACTSCANLINE_CORE(UINT32); | |
| 1742 | } | |
| 3024 | 1743 | |
| 3025 | while (srcheight) | |
| 3026 | { | |
| 3027 | end = dstdata + srcwidth; | |
| 3028 | while (dstdata <= end - 8) | |
| 3029 | { | |
| 3030 | srcdata -= 8; | |
| 3031 | dstdata[0] = srcdata[8]; | |
| 3032 | dstdata[1] = srcdata[7]; | |
| 3033 | dstdata[2] = srcdata[6]; | |
| 3034 | dstdata[3] = srcdata[5]; | |
| 3035 | dstdata[4] = srcdata[4]; | |
| 3036 | dstdata[5] = srcdata[3]; | |
| 3037 | dstdata[6] = srcdata[2]; | |
| 3038 | dstdata[7] = srcdata[1]; | |
| 3039 | dstdata += 8; | |
| 3040 | } | |
| 3041 | while (dstdata < end) | |
| 3042 | *(dstdata++) = *(srcdata--); | |
| 3043 | 1744 | |
| 3044 | srcdata += srcmodulo; | |
| 3045 | dstdata += dstmodulo; | |
| 3046 | srcheight--; | |
| 3047 | } | |
| 3048 | }) | |
| 1745 | /*------------------------------------------------- | |
| 1746 | extract_scanline16 - copy pixels from a single | |
| 1747 | scanline of a bitmap to a 16bpp buffer | |
| 1748 | -------------------------------------------------*/ | |
| 3049 | 1749 | |
| 3050 | ||
| 3051 | DECLARE(drawgfx_core,( | |
| 3052 | bitmap_t *dest,const gfx_element *gfx, | |
| 3053 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 3054 | const rectangle *clip,int transparency,int transparent_color, | |
| 3055 | bitmap_t *pri_buffer,UINT32 pri_mask), | |
| 1750 | void extract_scanline16(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT16 *destptr) | |
| 3056 | 1751 | { |
| 3057 | int ox; | |
| 3058 | int oy; | |
| 3059 | int ex; | |
| 3060 | int ey; | |
| 1752 | assert(bitmap != NULL); | |
| 1753 | assert(bitmap->bpp == 16 || bitmap->bpp == 32); | |
| 3061 | 1754 | |
| 3062 | /* check bounds */ | |
| 3063 | ox = sx; | |
| 3064 | oy = sy; | |
| 1755 | /* 16bpp case */ | |
| 1756 | if (bitmap->bpp == 16) | |
| 1757 | EXTRACTSCANLINE_CORE(UINT16); | |
| 1758 | else | |
| 1759 | EXTRACTSCANLINE_CORE(UINT32); | |
| 1760 | } | |
| 3065 | 1761 | |
| 3066 | ex = sx + gfx->width-1; | |
| 3067 | if (sx < 0) sx = 0; | |
| 3068 | if (clip && sx < clip->min_x) sx = clip->min_x; | |
| 3069 | if (ex >= dest->width) ex = dest->width-1; | |
| 3070 | if (clip && ex > clip->max_x) ex = clip->max_x; | |
| 3071 | if (sx > ex) return; | |
| 3072 | 1762 | |
| 3073 | ey = sy + gfx->height-1; | |
| 3074 | if (sy < 0) sy = 0; | |
| 3075 | if (clip && sy < clip->min_y) sy = clip->min_y; | |
| 3076 | if (ey >= dest->height) ey = dest->height-1; | |
| 3077 | if (clip && ey > clip->max_y) ey = clip->max_y; | |
| 3078 | if (sy > ey) return; | |
| 1763 | /*------------------------------------------------- | |
| 1764 | extract_scanline32 - copy pixels from a single | |
| 1765 | scanline of a bitmap to a 32bpp buffer | |
| 1766 | -------------------------------------------------*/ | |
| 3079 | 1767 | |
| 3080 | { | |
| 3081 | pen_t *st = gfx->machine->shadow_table; | |
| 3082 | UINT8 *sd = gfx->gfxdata + code * gfx->char_modulo; /* source data */ | |
| 3083 | int sw = gfx->width; /* source width */ | |
| 3084 | int sh = gfx->height; /* source height */ | |
| 3085 | int sm = gfx->line_modulo; /* source modulo */ | |
| 3086 | int ls = sx-ox; /* left skip */ | |
| 3087 | int ts = sy-oy; /* top skip */ | |
| 3088 | DATA_TYPE *dd = BITMAP_ADDR(dest, DATA_TYPE, sy, sx); /* dest data */ | |
| 3089 | int dw = ex-sx+1; /* dest width */ | |
| 3090 | int dh = ey-sy+1; /* dest height */ | |
| 3091 | int dm = dest->rowpixels; /* dest modulo */ | |
| 3092 | int colorbase = gfx->color_base + gfx->color_granularity * color; | |
| 3093 | const pen_t *paldata = &gfx->machine->pens[colorbase]; | |
| 3094 | UINT8 *pribuf = (pri_buffer) ? BITMAP_ADDR8(pri_buffer, sy, sx) : NULL; | |
| 1768 | void extract_scanline32(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT32 *destptr) | |
| 1769 | { | |
| 1770 | assert(bitmap != NULL); | |
| 1771 | assert(bitmap->bpp == 16 || bitmap->bpp == 32); | |
| 3095 | 1772 | |
| 3096 | switch (transparency) | |
| 3097 | { | |
| 3098 | case TRANSPARENCY_NONE: | |
| 3099 | if (gfx->flags & GFX_ELEMENT_PACKED) | |
| 3100 | { | |
| 3101 | if (pribuf) | |
| 3102 | BLOCKMOVEPRI(4toN_opaque,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask)); | |
| 3103 | else | |
| 3104 | BLOCKMOVELU(4toN_opaque,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata)); | |
| 3105 | } | |
| 3106 | else | |
| 3107 | { | |
| 3108 | if (pribuf) | |
| 3109 | BLOCKMOVEPRI(8toN_opaque,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask)); | |
| 3110 | else | |
| 3111 | BLOCKMOVELU(8toN_opaque,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata)); | |
| 3112 | } | |
| 3113 | break; | |
| 1773 | /* 16bpp case */ | |
| 1774 | if (bitmap->bpp == 16) | |
| 1775 | EXTRACTSCANLINE_CORE(UINT16); | |
| 1776 | else | |
| 1777 | EXTRACTSCANLINE_CORE(UINT32); | |
| 1778 | } | |
| 3114 | 1779 | |
| 3115 | case TRANSPARENCY_PEN: | |
| 3116 | if (gfx->flags & GFX_ELEMENT_PACKED) | |
| 3117 | { | |
| 3118 | if (pribuf) | |
| 3119 | BLOCKMOVEPRI(4toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color)); | |
| 3120 | else | |
| 3121 | BLOCKMOVELU(4toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color)); | |
| 3122 | } | |
| 3123 | else | |
| 3124 | { | |
| 3125 | if (pribuf) | |
| 3126 | BLOCKMOVEPRI(8toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color)); | |
| 3127 | else | |
| 3128 | BLOCKMOVELU(8toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color)); | |
| 3129 | } | |
| 3130 | break; | |
| 3131 | 1780 | |
| 3132 | case TRANSPARENCY_PEN_RAW: | |
| 3133 | if (gfx->flags & GFX_ELEMENT_PACKED) | |
| 3134 | { | |
| 3135 | if (pribuf) | |
| 3136 | BLOCKMOVERAWPRI(4toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,pribuf,pri_mask,transparent_color)); | |
| 3137 | else | |
| 3138 | BLOCKMOVERAW(4toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,transparent_color)); | |
| 3139 | } | |
| 3140 | else | |
| 3141 | { | |
| 3142 | if (pribuf) | |
| 3143 | BLOCKMOVERAWPRI(8toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,pribuf,pri_mask,transparent_color)); | |
| 3144 | else | |
| 3145 | BLOCKMOVERAW(8toN_transpen,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,color,transparent_color)); | |
| 3146 | } | |
| 3147 | break; | |
| 3148 | 1781 | |
| 3149 | case TRANSPARENCY_PENS: | |
| 3150 | if (pribuf) | |
| 3151 | BLOCKMOVEPRI(8toN_transmask,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color)); | |
| 3152 | else | |
| 3153 | BLOCKMOVELU(8toN_transmask,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color)); | |
| 3154 | break; | |
| 1782 | /*************************************************************************** | |
| 1783 | COPYBITMAP IMPLEMENTATIONS | |
| 1784 | ***************************************************************************/ | |
| 3155 | 1785 | |
| 3156 | case TRANSPARENCY_PEN_TABLE: | |
| 3157 | if (pribuf) | |
| 3158 | BLOCKMOVEPRI(8toN_pen_table,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color)); | |
| 3159 | else | |
| 3160 | BLOCKMOVELU(8toN_pen_table,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color)); | |
| 3161 | break; | |
| 1786 | /*------------------------------------------------- | |
| 1787 | copybitmap - copy from one bitmap to another, | |
| 1788 | copying all unclipped pixels | |
| 1789 | -------------------------------------------------*/ | |
| 3162 | 1790 | |
| 3163 | case TRANSPARENCY_ALPHA: | |
| 3164 | if (pribuf) | |
| 3165 | BLOCKMOVEPRI(8toN_alpha,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color)); | |
| 3166 | else | |
| 3167 | BLOCKMOVELU(8toN_alpha,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color)); | |
| 3168 | break; | |
| 1791 | void copybitmap(bitmap_t *dest, bitmap_t *src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect) | |
| 1792 | { | |
| 1793 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 3169 | 1794 | |
| 3170 | case TRANSPARENCY_ALPHARANGE: | |
| 3171 | if (pribuf) | |
| 3172 | BLOCKMOVEPRI(8toN_alpharange,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,pribuf,pri_mask,transparent_color)); | |
| 3173 | else | |
| 3174 | BLOCKMOVELU(8toN_alpharange,(st,sd,sw,sh,sm,ls,ts,flipx,flipy,dd,dw,dh,dm,colorbase,paldata,transparent_color)); | |
| 3175 | break; | |
| 1795 | assert(dest != NULL); | |
| 1796 | assert(src != NULL); | |
| 1797 | assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32); | |
| 1798 | assert(src->bpp == dest->bpp); | |
| 3176 | 1799 | |
| 3177 | default: | |
| 3178 | if (pribuf) | |
| 3179 | popmessage("pdrawgfx pen mode not supported"); | |
| 3180 | else | |
| 3181 | popmessage("drawgfx pen mode not supported"); | |
| 3182 | break; | |
| 3183 | } | |
| 3184 | } | |
| 3185 | }) | |
| 1800 | if (dest->bpp == 8) | |
| 1801 | COPYBITMAP_CORE(UINT8, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 1802 | else if (dest->bpp == 16) | |
| 1803 | COPYBITMAP_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 1804 | else | |
| 1805 | COPYBITMAP_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 1806 | } | |
| 3186 | 1807 | |
| 3187 | DECLARE(copybitmap_core,( | |
| 3188 | bitmap_t *dest,bitmap_t *src, | |
| 3189 | int flipx,int flipy,int sx,int sy, | |
| 3190 | const rectangle *clip,int transparency,int transparent_color), | |
| 3191 | { | |
| 3192 | int ox; | |
| 3193 | int oy; | |
| 3194 | int ex; | |
| 3195 | int ey; | |
| 3196 | 1808 | |
| 3197 | /* check bounds */ | |
| 3198 | ox = sx; | |
| 3199 | oy = sy; | |
| 1809 | /*------------------------------------------------- | |
| 1810 | copybitmap_trans - copy from one bitmap to | |
| 1811 | another, copying all unclipped pixels except | |
| 1812 | those that match transpen | |
| 1813 | -------------------------------------------------*/ | |
| 3200 | 1814 | |
| 3201 | ex = sx + src->width-1; | |
| 3202 | if (sx < 0) sx = 0; | |
| 3203 | if (clip && sx < clip->min_x) sx = clip->min_x; | |
| 3204 | if (ex >= dest->width) ex = dest->width-1; | |
| 3205 | if (clip && ex > clip->max_x) ex = clip->max_x; | |
| 3206 | if (sx > ex) return; | |
| 1815 | void copybitmap_trans(bitmap_t *dest, bitmap_t *src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect, UINT32 transpen) | |
| 1816 | { | |
| 1817 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 3207 | 1818 | |
| 3208 | ey = sy + src->height-1; | |
| 3209 | if (sy < 0) sy = 0; | |
| 3210 | if (clip && sy < clip->min_y) sy = clip->min_y; | |
| 3211 | if (ey >= dest->height) ey = dest->height-1; | |
| 3212 | if (clip && ey > clip->max_y) ey = clip->max_y; | |
| 3213 | if (sy > ey) return; | |
| 1819 | assert(dest != NULL); | |
| 1820 | assert(src != NULL); | |
| 1821 | assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32); | |
| 1822 | assert(src->bpp == dest->bpp); | |
| 3214 | 1823 | |
| 1824 | if (dest->bpp == 8) | |
| 3215 | 1825 | { |
| 3216 | DATA_TYPE *sd = (DATA_TYPE *)src->base; /* source data */ | |
| 3217 | int sw = ex-sx+1; /* source width */ | |
| 3218 | int sh = ey-sy+1; /* source height */ | |
| 3219 | int sm = src->rowpixels; /* source modulo */ | |
| 3220 | DATA_TYPE *dd = BITMAP_ADDR(dest, DATA_TYPE, sy, sx); /* dest data */ | |
| 3221 | int dm = dest->rowpixels; /* dest modulo */ | |
| 3222 | ||
| 3223 | if (flipx) | |
| 3224 | sd += src->width -1 -(sx-ox); | |
| 1826 | if (transpen > 0xff) | |
| 1827 | copybitmap(dest, src, flipx, flipy, destx, desty, cliprect); | |
| 3225 | 1828 | else |
| 3226 | sd += (sx-ox); | |
| 3227 | ||
| 3228 | if (flipy) | |
| 3229 | { | |
| 3230 | sd += sm * (src->height -1 -(sy-oy)); | |
| 3231 | sm = -sm; | |
| 3232 | } | |
| 3233 | else | |
| 3234 | sd += sm * (sy-oy); | |
| 3235 | ||
| 3236 | switch (transparency) | |
| 3237 | { | |
| 3238 | case TRANSPARENCY_NONE: | |
| 3239 | BLOCKMOVE(NtoN_opaque_noremap,flipx,(sd,sw,sh,sm,dd,dm)); | |
| 3240 | break; | |
| 3241 | ||
| 3242 | case TRANSPARENCY_PEN: | |
| 3243 | BLOCKMOVE(NtoN_transpen_noremap,flipx,(sd,sw,sh,sm,dd,dm,transparent_color)); | |
| 3244 | break; | |
| 3245 | ||
| 3246 | default: | |
| 3247 | popmessage("copybitmap pen mode not supported"); | |
| 3248 | break; | |
| 3249 | } | |
| 1829 | COPYBITMAP_CORE(UINT8, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); | |
| 3250 | 1830 | } |
| 3251 | }) | |
| 3252 | ||
| 3253 | DECLARE(copyrozbitmap_core,(bitmap_t *bitmap,bitmap_t *srcbitmap, | |
| 3254 | UINT32 startx,UINT32 starty,int incxx,int incxy,int incyx,int incyy,int wraparound, | |
| 3255 | const rectangle *clip,int transparency,int transparent_color,UINT32 priority), | |
| 3256 | { | |
| 3257 | UINT32 cx; | |
| 3258 | UINT32 cy; | |
| 3259 | int x; | |
| 3260 | int sx; | |
| 3261 | int sy; | |
| 3262 | int ex; | |
| 3263 | int ey; | |
| 3264 | const int xmask = srcbitmap->width-1; | |
| 3265 | const int ymask = srcbitmap->height-1; | |
| 3266 | const int widthshifted = srcbitmap->width << 16; | |
| 3267 | const int heightshifted = srcbitmap->height << 16; | |
| 3268 | DATA_TYPE *dest; | |
| 3269 | ||
| 3270 | if (clip) | |
| 1831 | else if (dest->bpp == 16) | |
| 3271 | 1832 | { |
| 3272 | startx += clip->min_x * incxx + clip->min_y * incyx; | |
| 3273 | starty += clip->min_x * incxy + clip->min_y * incyy; | |
| 3274 | ||
| 3275 | sx = clip->min_x; | |
| 3276 | sy = clip->min_y; | |
| 3277 | ex = clip->max_x; | |
| 3278 | ey = clip->max_y; | |
| 1833 | if (transpen > 0xffff) | |
| 1834 | copybitmap(dest, src, flipx, flipy, destx, desty, cliprect); | |
| 1835 | else | |
| 1836 | COPYBITMAP_CORE(UINT16, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); | |
| 3279 | 1837 | } |
| 3280 | 1838 | else |
| 3281 | 1839 | { |
| 3282 | sx = 0; | |
| 3283 | sy = 0; | |
| 3284 | ex = bitmap->width-1; | |
| 3285 | ey = bitmap->height-1; | |
| 1840 | if (transpen == 0xffffffff) | |
| 1841 | copybitmap(dest, src, flipx, flipy, destx, desty, cliprect); | |
| 1842 | else | |
| 1843 | COPYBITMAP_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); | |
| 3286 | 1844 | } |
| 1845 | } | |
| 3287 | 1846 | |
| 3288 | 1847 | |
| 3289 | if (incxy == 0 && incyx == 0 && !wraparound) | |
| 3290 | { | |
| 3291 | /* optimized loop for the not rotated case */ | |
| 3292 | 1848 | |
| 3293 | if (incxx == 0x10000) | |
| 3294 | { | |
| 3295 | /* optimized loop for the not zoomed case */ | |
| 1849 | /*************************************************************************** | |
| 1850 | COPYSCROLLBITMAP IMPLEMENTATIONS | |
| 1851 | ***************************************************************************/ | |
| 3296 | 1852 | |
| 3297 | /* startx is unsigned */ | |
| 3298 | startx = ((INT32)startx) >> 16; | |
| 1853 | /*------------------------------------------------- | |
| 1854 | copyscrollbitmap - copy from one bitmap to | |
| 1855 | another, copying all unclipped pixels, and | |
| 1856 | applying scrolling to one or more rows/colums | |
| 1857 | -------------------------------------------------*/ | |
| 3299 | 1858 | |
| 3300 | if (startx >= srcbitmap->width) | |
| 3301 | { | |
| 3302 | sx += -startx; | |
| 3303 | startx = 0; | |
| 3304 | } | |
| 1859 | void copyscrollbitmap(bitmap_t *dest, bitmap_t *src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle *cliprect) | |
| 1860 | { | |
| 1861 | /* just call through to the transparent case as the underlying copybitmap will | |
| 1862 | optimize for pen == 0xffffffff */ | |
| 1863 | copyscrollbitmap_trans(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, 0xffffffff); | |
| 1864 | } | |
| 3305 | 1865 | |
| 3306 | if (sx <= ex) | |
| 3307 | { | |
| 3308 | while (sy <= ey) | |
| 3309 | { | |
| 3310 | if (starty < heightshifted) | |
| 3311 | { | |
| 3312 | x = sx; | |
| 3313 | cx = startx; | |
| 3314 | cy = starty >> 16; | |
| 3315 | dest = BITMAP_ADDR(bitmap, DATA_TYPE, sy, sx); | |
| 3316 | if (priority) | |
| 3317 | { | |
| 3318 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, sy, sx); | |
| 3319 | DATA_TYPE *src = BITMAP_ADDR(srcbitmap, DATA_TYPE, cy, 0); | |
| 3320 | 1866 | |
| 3321 | while (x <= ex && cx < srcbitmap->width) | |
| 3322 | { | |
| 3323 | int c = src[cx]; | |
| 1867 | /*------------------------------------------------- | |
| 1868 | copyscrollbitmap_trans - copy from one bitmap | |
| 1869 | to another, copying all unclipped pixels | |
| 1870 | except those that match transpen, and applying | |
| 1871 | scrolling to one or more rows/colums | |
| 1872 | -------------------------------------------------*/ | |
| 3324 | 1873 | |
| 3325 | if (c != transparent_color) | |
| 3326 | { | |
| 3327 | *dest = c; | |
| 3328 | *pri |= priority; | |
| 3329 | } | |
| 1874 | void copyscrollbitmap_trans(bitmap_t *dest, bitmap_t *src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle *cliprect, UINT32 transpen) | |
| 1875 | { | |
| 1876 | /* no rowscroll and no colscroll means no scroll */ | |
| 1877 | if (numrows == 0 && numcols == 0) | |
| 1878 | { | |
| 1879 | copybitmap_trans(dest, src, 0, 0, 0, 0, cliprect, transpen); | |
| 1880 | return; | |
| 1881 | } | |
| 3330 | 1882 | |
| 3331 | cx++; | |
| 3332 | x++; | |
| 3333 | dest++; | |
| 3334 | pri++; | |
| 3335 | } | |
| 3336 | } | |
| 3337 | else | |
| 3338 | { | |
| 3339 | DATA_TYPE *src = BITMAP_ADDR(srcbitmap, DATA_TYPE, cy, 0); | |
| 1883 | assert(dest != NULL); | |
| 1884 | assert(src != NULL); | |
| 1885 | assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32); | |
| 1886 | assert(dest->bpp == src->bpp); | |
| 1887 | assert(numrows != 0 || rowscroll == NULL); | |
| 1888 | assert(numrows == 0 || rowscroll != NULL); | |
| 1889 | assert(numcols != 0 || colscroll == NULL); | |
| 1890 | assert(numcols == 0 || colscroll != NULL); | |
| 3340 | 1891 | |
| 3341 | while (x <= ex && cx < srcbitmap->width) | |
| 3342 | { | |
| 3343 | int c = src[cx]; | |
| 1892 | /* NULL clip means use the full bitmap */ | |
| 1893 | if (cliprect == NULL) | |
| 1894 | cliprect = &dest->cliprect; | |
| 3344 | 1895 | |
| 3345 | if (c != transparent_color) | |
| 3346 | *dest = c; | |
| 1896 | /* fully scrolling X,Y playfield */ | |
| 1897 | if (numrows <= 1 && numcols <= 1) | |
| 1898 | { | |
| 1899 | INT32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]); | |
| 1900 | INT32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]); | |
| 1901 | INT32 sx, sy; | |
| 3347 | 1902 | |
| 3348 | cx++; | |
| 3349 | x++; | |
| 3350 | dest++; | |
| 3351 | } | |
| 3352 | } | |
| 3353 | } | |
| 3354 | starty += incyy; | |
| 3355 | sy++; | |
| 3356 | } | |
| 3357 | } | |
| 3358 | } | |
| 3359 | else | |
| 3360 | { | |
| 3361 | while (startx >= widthshifted && sx <= ex) | |
| 3362 | { | |
| 3363 | startx += incxx; | |
| 3364 | sx++; | |
| 3365 | } | |
| 3366 | ||
| 3367 | if (sx <= ex) | |
| 3368 | { | |
| 3369 | while (sy <= ey) | |
| 3370 | { | |
| 3371 | if (starty < heightshifted) | |
| 3372 | { | |
| 3373 | x = sx; | |
| 3374 | cx = startx; | |
| 3375 | cy = starty >> 16; | |
| 3376 | dest = BITMAP_ADDR(bitmap, DATA_TYPE, sy, sx); | |
| 3377 | if (priority) | |
| 3378 | { | |
| 3379 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, sy, sx); | |
| 3380 | DATA_TYPE *src = BITMAP_ADDR(srcbitmap, DATA_TYPE, cy, 0); | |
| 3381 | ||
| 3382 | while (x <= ex && cx < widthshifted) | |
| 3383 | { | |
| 3384 | int c = src[cx >> 16]; | |
| 3385 | ||
| 3386 | if (c != transparent_color) | |
| 3387 | { | |
| 3388 | *dest = c; | |
| 3389 | *pri |= priority; | |
| 3390 | } | |
| 3391 | ||
| 3392 | cx += incxx; | |
| 3393 | x++; | |
| 3394 | dest++; | |
| 3395 | pri++; | |
| 3396 | } | |
| 3397 | } | |
| 3398 | else | |
| 3399 | { | |
| 3400 | DATA_TYPE *src = BITMAP_ADDR(srcbitmap, DATA_TYPE, cy, 0); | |
| 3401 | ||
| 3402 | while (x <= ex && cx < widthshifted) | |
| 3403 | { | |
| 3404 | int c = src[cx >> 16]; | |
| 3405 | ||
| 3406 | if (c != transparent_color) | |
| 3407 | *dest = c; | |
| 3408 | ||
| 3409 | cx += incxx; | |
| 3410 | x++; | |
| 3411 | dest++; | |
| 3412 | } | |
| 3413 | } | |
| 3414 | } | |
| 3415 | starty += incyy; | |
| 3416 | sy++; | |
| 3417 | } | |
| 3418 | } | |
| 3419 | } | |
| 1903 | /* iterate over all portions of the scroll that overlap the destination */ | |
| 1904 | for (sx = xscroll - src->width; sx < dest->width; sx += src->width) | |
| 1905 | for (sy = yscroll - src->height; sy < dest->height; sy += src->height) | |
| 1906 | copybitmap_trans(dest, src, 0, 0, sx, sy, cliprect, transpen); | |
| 3420 | 1907 | } |
| 3421 | else | |
| 1908 | ||
| 1909 | /* scrolling columns plus horizontal scroll */ | |
| 1910 | else if (numrows <= 1) | |
| 3422 | 1911 | { |
| 3423 | if (wraparound) | |
| 3424 | { | |
| 3425 | /* plot with wraparound */ | |
| 3426 | while (sy <= ey) | |
| 3427 | { | |
| 3428 | x = sx; | |
| 3429 | cx = startx; | |
| 3430 | cy = starty; | |
| 3431 | dest = BITMAP_ADDR(bitmap, DATA_TYPE, sy, sx); | |
| 3432 | if (priority) | |
| 3433 | { | |
| 3434 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, sy, sx); | |
| 1912 | INT32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]); | |
| 1913 | rectangle subclip = *cliprect; | |
| 1914 | int col, colwidth, groupcols; | |
| 3435 | 1915 | |
| 3436 | while (x <= ex) | |
| 3437 | { | |
| 3438 | int c = *BITMAP_ADDR(srcbitmap, DATA_TYPE, (cy >> 16) & ymask, (cx >> 16) & xmask); | |
| 1916 | /* determine width of each column */ | |
| 1917 | colwidth = src->width / numcols; | |
| 1918 | assert(src->width % colwidth == 0); | |
| 3439 | 1919 | |
| 3440 | if (c != transparent_color) | |
| 3441 | { | |
| 3442 | *dest = c; | |
| 3443 | *pri |= priority; | |
| 3444 | } | |
| 3445 | ||
| 3446 | cx += incxx; | |
| 3447 | cy += incxy; | |
| 3448 | x++; | |
| 3449 | dest++; | |
| 3450 | pri++; | |
| 3451 | } | |
| 3452 | } | |
| 3453 | else | |
| 3454 | { | |
| 3455 | while (x <= ex) | |
| 3456 | { | |
| 3457 | int c = *BITMAP_ADDR(srcbitmap, DATA_TYPE, (cy >> 16) & ymask, (cx >> 16) & xmask); | |
| 3458 | ||
| 3459 | if (c != transparent_color) | |
| 3460 | *dest = c; | |
| 3461 | ||
| 3462 | cx += incxx; | |
| 3463 | cy += incxy; | |
| 3464 | x++; | |
| 3465 | dest++; | |
| 3466 | } | |
| 3467 | } | |
| 3468 | startx += incyx; | |
| 3469 | starty += incyy; | |
| 3470 | sy++; | |
| 3471 | } | |
| 3472 | } | |
| 3473 | else | |
| 1920 | /* iterate over each column */ | |
| 1921 | for (col = 0; col < numcols; col += groupcols) | |
| 3474 | 1922 | { |
| 3475 | while (sy <= ey) | |
| 3476 | { | |
| 3477 | x = sx; | |
| 3478 | cx = startx; | |
| 3479 | cy = starty; | |
| 3480 | if (priority) | |
| 3481 | { | |
| 3482 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, sy, sx); | |
| 1923 | INT32 yscroll = colscroll[col]; | |
| 1924 | INT32 sx, sy; | |
| 3483 | 1925 | |
| 3484 | while (x <= ex) | |
| 3485 | { | |
| 3486 | if (cx < widthshifted && cy < heightshifted) | |
| 3487 | { | |
| 3488 | int c = *BITMAP_ADDR(srcbitmap, DATA_TYPE, cy >> 16, cx >> 16); | |
| 1926 | /* count consecutive columns scrolled by the same amount */ | |
| 1927 | for (groupcols = 1; col + groupcols < numcols; groupcols++) | |
| 1928 | if (colscroll[col + groupcols] != yscroll) | |
| 1929 | break; | |
| 3489 | 1930 | |
| 3490 | if (c != transparent_color) | |
| 3491 | { | |
| 3492 | dest = BITMAP_ADDR(bitmap, DATA_TYPE, sy, x); | |
| 3493 | *dest = c; | |
| 3494 | *pri |= priority; | |
| 3495 | } | |
| 3496 | } | |
| 1931 | /* compute the cliprect for this group */ | |
| 1932 | subclip.min_x = col * colwidth + xscroll; | |
| 1933 | subclip.max_x = (col + groupcols) * colwidth - 1 + xscroll; | |
| 1934 | sect_rect(&subclip, cliprect); | |
| 3497 | 1935 | |
| 3498 | cx += incxx; | |
| 3499 | cy += incxy; | |
| 3500 | x++; | |
| 3501 | pri++; | |
| 3502 | } | |
| 3503 | } | |
| 3504 | else | |
| 3505 | { | |
| 3506 | while (x <= ex) | |
| 3507 | { | |
| 3508 | if (cx < widthshifted && cy < heightshifted) | |
| 3509 | { | |
| 3510 | int c = *BITMAP_ADDR(srcbitmap, DATA_TYPE, cy >> 16, cx >> 16); | |
| 3511 | ||
| 3512 | if (c != transparent_color) | |
| 3513 | { | |
| 3514 | dest = BITMAP_ADDR(bitmap, DATA_TYPE, sy, x); | |
| 3515 | *dest = c; | |
| 3516 | } | |
| 3517 | } | |
| 3518 | ||
| 3519 | cx += incxx; | |
| 3520 | cy += incxy; | |
| 3521 | x++; | |
| 3522 | } | |
| 3523 | } | |
| 3524 | startx += incyx; | |
| 3525 | starty += incyy; | |
| 3526 | sy++; | |
| 3527 | } | |
| 1936 | /* iterate over all portions of the scroll that overlap the destination */ | |
| 1937 | for (sy = normalize_yscroll(src, yscroll) - src->height; sy < dest->height; sy += src->height) | |
| 1938 | for (sx = xscroll - src->width; sx < dest->width; sx += src->width) | |
| 1939 | copybitmap_trans(dest, src, 0, 0, sx, sy, &subclip, transpen); | |
| 3528 | 1940 | } |
| 3529 | 1941 | } |
| 3530 | }) | |
| 3531 | 1942 | |
| 3532 | #endif /* (DEPTH != 8) */ | |
| 3533 | ||
| 3534 | DECLAREG(draw_scanline, ( | |
| 3535 | bitmap_t *bitmap,int x,int y,int length, | |
| 3536 | const DATA_TYPE *src,const pen_t *pens,int transparent_pen), | |
| 3537 | { | |
| 3538 | assert(bitmap != NULL); | |
| 3539 | assert((bitmap->bpp == 16) || (bitmap->bpp == 32)); | |
| 3540 | assert(src != NULL); | |
| 3541 | assert(length > 0); | |
| 3542 | assert(x >= 0); | |
| 3543 | assert(y >= 0); | |
| 3544 | ||
| 3545 | /* 16bpp destination */ | |
| 3546 | if (bitmap->bpp == 16) | |
| 1943 | /* scrolling rows plus vertical scroll */ | |
| 1944 | else if (numcols <= 1) | |
| 3547 | 1945 | { |
| 3548 | UINT16 *dst = BITMAP_ADDR16(bitmap, y, x); | |
| 3549 | int xadv = 1; | |
| 1946 | INT32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]); | |
| 1947 | rectangle subclip = *cliprect; | |
| 1948 | int row, rowheight, grouprows; | |
| 3550 | 1949 | |
| 3551 | /* with pen lookups */ | |
| 3552 | if (pens) | |
| 3553 | { | |
| 3554 | if (transparent_pen == -1) | |
| 3555 | while (length--) | |
| 3556 | { | |
| 3557 | *dst = pens[*src++]; | |
| 3558 | dst += xadv; | |
| 3559 | } | |
| 3560 | else | |
| 3561 | while (length--) | |
| 3562 | { | |
| 3563 | UINT32 spixel = *src++; | |
| 3564 | if (spixel != transparent_pen) | |
| 3565 | *dst = pens[spixel]; | |
| 3566 | dst += xadv; | |
| 3567 | } | |
| 3568 | } | |
| 1950 | /* determine width of each rows */ | |
| 1951 | rowheight = src->height / numrows; | |
| 1952 | assert(src->height % rowheight == 0); | |
| 3569 | 1953 | |
| 3570 | /* without pen lookups */ | |
| 3571 | else | |
| 1954 | /* iterate over each row */ | |
| 1955 | for (row = 0; row < numrows; row += grouprows) | |
| 3572 | 1956 | { |
| 3573 | if (transparent_pen == -1) | |
| 3574 | while (length--) | |
| 3575 | { | |
| 3576 | *dst = *src++; | |
| 3577 | dst += xadv; | |
| 3578 | } | |
| 3579 | else | |
| 3580 | while (length--) | |
| 3581 | { | |
| 3582 | UINT32 spixel = *src++; | |
| 3583 | if (spixel != transparent_pen) | |
| 3584 | *dst = spixel; | |
| 3585 | dst += xadv; | |
| 3586 | } | |
| 3587 | } | |
| 3588 | } | |
| 1957 | INT32 xscroll = rowscroll[row]; | |
| 1958 | INT32 sx, sy; | |
| 3589 | 1959 | |
| 3590 | /* 32bpp destination */ | |
| 3591 | else | |
| 3592 | { | |
| 3593 | UINT32 *dst = BITMAP_ADDR32(bitmap, y, x); | |
| 3594 | int xadv = 1; | |
| 1960 | /* count consecutive rows scrolled by the same amount */ | |
| 1961 | for (grouprows = 1; row + grouprows < numrows; grouprows++) | |
| 1962 | if (rowscroll[row + grouprows] != xscroll) | |
| 1963 | break; | |
| 3595 | 1964 | |
| 3596 | /* with pen lookups */ | |
| 3597 | if (pens) | |
| 3598 | { | |
| 3599 | if (transparent_pen == -1) | |
| 3600 | while (length--) | |
| 3601 | { | |
| 3602 | *dst = pens[*src++]; | |
| 3603 | dst += xadv; | |
| 3604 | } | |
| 3605 | else | |
| 3606 | while (length--) | |
| 3607 | { | |
| 3608 | UINT32 spixel = *src++; | |
| 3609 | if (spixel != transparent_pen) | |
| 3610 | *dst = pens[spixel]; | |
| 3611 | dst += xadv; | |
| 3612 | } | |
| 3613 | } | |
| 1965 | /* compute the cliprect for this group */ | |
| 1966 | subclip.min_y = row * rowheight + yscroll; | |
| 1967 | subclip.max_y = (row + grouprows) * rowheight - 1 + yscroll; | |
| 1968 | sect_rect(&subclip, cliprect); | |
| 3614 | 1969 | |
| 3615 | /* without pen lookups */ | |
| 3616 | else | |
| 3617 | { | |
| 3618 | if (transparent_pen == -1) | |
| 3619 | while (length--) | |
| 3620 | { | |
| 3621 | *dst = *src++; | |
| 3622 | dst += xadv; | |
| 3623 | } | |
| 3624 | else | |
| 3625 | while (length--) | |
| 3626 | { | |
| 3627 | UINT32 spixel = *src++; | |
| 3628 | if (spixel != transparent_pen) | |
| 3629 | *dst = spixel; | |
| 3630 | dst += xadv; | |
| 3631 | } | |
| 1970 | /* iterate over all portions of the scroll that overlap the destination */ | |
| 1971 | for (sx = normalize_xscroll(src, xscroll) - src->width; sx < dest->width; sx += src->width) | |
| 1972 | for (sy = yscroll - src->height; sy < dest->height; sy += src->height) | |
| 1973 | copybitmap_trans(dest, src, 0, 0, sx, sy, &subclip, transpen); | |
| 3632 | 1974 | } |
| 3633 | 1975 | } |
| 3634 | } | |
| 1976 | } | |
| 3635 | 1977 | |
| 3636 | DECLAREG(pdraw_scanline, ( | |
| 3637 | bitmap_t *bitmap,int x,int y,int length, | |
| 3638 | const DATA_TYPE *src,const pen_t *pens,int transparent_pen,int pri), | |
| 3639 | { | |
| 3640 | assert(bitmap != NULL); | |
| 3641 | assert((bitmap->bpp == 16) || (bitmap->bpp == 32)); | |
| 3642 | assert(length > 0); | |
| 3643 | assert(x >= 0); | |
| 3644 | assert(y >= 0); | |
| 3645 | 1978 | |
| 3646 | /* 16bpp destination */ | |
| 3647 | if (bitmap->bpp == 16) | |
| 3648 | { | |
| 3649 | UINT16 *dsti = BITMAP_ADDR16(bitmap, y, x); | |
| 3650 | UINT8 *dstp = BITMAP_ADDR8(priority_bitmap, y, x); | |
| 3651 | int xadv = 1; | |
| 3652 | 1979 | |
| 3653 | /* with pen lookups */ | |
| 3654 | if (pens) | |
| 3655 | { | |
| 3656 | if (transparent_pen == -1) | |
| 3657 | while (length--) | |
| 3658 | { | |
| 3659 | *dsti = pens[*src++]; | |
| 3660 | *dstp = pri; | |
| 3661 | dsti += xadv; | |
| 3662 | dstp += xadv; | |
| 3663 | } | |
| 3664 | else | |
| 3665 | while (length--) | |
| 3666 | { | |
| 3667 | UINT32 spixel = *src++; | |
| 3668 | if (spixel != transparent_pen) | |
| 3669 | { | |
| 3670 | *dsti = pens[spixel]; | |
| 3671 | *dstp = pri; | |
| 3672 | } | |
| 3673 | dsti += xadv; | |
| 3674 | dstp += xadv; | |
| 3675 | } | |
| 3676 | } | |
| 1980 | /*************************************************************************** | |
| 1981 | COPYROZBITMAP IMPLEMENTATIONS | |
| 1982 | ***************************************************************************/ | |
| 3677 | 1983 | |
| 3678 | /* without pen lookups */ | |
| 3679 | else | |
| 3680 | { | |
| 3681 | if (transparent_pen == -1) | |
| 3682 | while (length--) | |
| 3683 | { | |
| 3684 | *dsti = *src++; | |
| 3685 | *dstp = pri; | |
| 3686 | dsti += xadv; | |
| 3687 | dstp += xadv; | |
| 3688 | } | |
| 3689 | else | |
| 3690 | while (length--) | |
| 3691 | { | |
| 3692 | UINT32 spixel = *src++; | |
| 3693 | if (spixel != transparent_pen) | |
| 3694 | { | |
| 3695 | *dsti = spixel; | |
| 3696 | *dstp = pri; | |
| 3697 | } | |
| 3698 | dsti += xadv; | |
| 3699 | dstp += xadv; | |
| 3700 | } | |
| 3701 | } | |
| 3702 | } | |
| 1984 | /*------------------------------------------------- | |
| 1985 | copyrozbitmap - copy from one bitmap to another, | |
| 1986 | with zoom and rotation, copying all unclipped | |
| 1987 | pixels | |
| 1988 | -------------------------------------------------*/ | |
| 3703 | 1989 | |
| 3704 | /* 32bpp destination */ | |
| 3705 | else | |
| 3706 | { | |
| 3707 | UINT32 *dsti = BITMAP_ADDR32(bitmap, y, x); | |
| 3708 | UINT8 *dstp = BITMAP_ADDR8(priority_bitmap, y, x); | |
| 3709 | int xadv = 1; | |
| 1990 | void copyrozbitmap(bitmap_t *dest, const rectangle *cliprect, bitmap_t *src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound) | |
| 1991 | { | |
| 1992 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 3710 | 1993 | |
| 3711 | /* with pen lookups */ | |
| 3712 | if (pens) | |
| 3713 | { | |
| 3714 | if (transparent_pen == -1) | |
| 3715 | while (length--) | |
| 3716 | { | |
| 3717 | *dsti = pens[*src++]; | |
| 3718 | *dstp = pri; | |
| 3719 | dsti += xadv; | |
| 3720 | dstp += xadv; | |
| 3721 | } | |
| 3722 | else | |
| 3723 | while (length--) | |
| 3724 | { | |
| 3725 | UINT32 spixel = *src++; | |
| 3726 | if (spixel != transparent_pen) | |
| 3727 | { | |
| 3728 | *dsti = pens[spixel]; | |
| 3729 | *dstp = pri; | |
| 3730 | } | |
| 3731 | dsti += xadv; | |
| 3732 | dstp += xadv; | |
| 3733 | } | |
| 3734 | } | |
| 1994 | assert(dest != NULL); | |
| 1995 | assert(src != NULL); | |
| 1996 | assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32); | |
| 1997 | assert(src->bpp == dest->bpp); | |
| 3735 | 1998 | |
| 3736 | /* without pen lookups */ | |
| 3737 | else | |
| 3738 | { | |
| 3739 | if (transparent_pen == -1) | |
| 3740 | while (length--) | |
| 3741 | { | |
| 3742 | *dsti = *src++; | |
| 3743 | *dstp = pri; | |
| 3744 | dsti += xadv; | |
| 3745 | dstp += xadv; | |
| 3746 | } | |
| 3747 | else | |
| 3748 | while (length--) | |
| 3749 | { | |
| 3750 | UINT32 spixel = *src++; | |
| 3751 | if (spixel != transparent_pen) | |
| 3752 | { | |
| 3753 | *dsti = spixel; | |
| 3754 | *dstp = pri; | |
| 3755 | } | |
| 3756 | dsti += xadv; | |
| 3757 | dstp += xadv; | |
| 3758 | } | |
| 3759 | } | |
| 3760 | } | |
| 1999 | if (dest->bpp == 8) | |
| 2000 | COPYROZBITMAP_CORE(UINT8, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 2001 | else if (dest->bpp == 16) | |
| 2002 | COPYROZBITMAP_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 2003 | else | |
| 2004 | COPYROZBITMAP_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); | |
| 3761 | 2005 | } |
| 3762 | ) | |
| 3763 | 2006 | |
| 3764 | DECLAREG(extract_scanline, ( | |
| 3765 | bitmap_t *bitmap,int x,int y,int length, | |
| 3766 | DATA_TYPE *dst), | |
| 3767 | { | |
| 3768 | assert(bitmap != NULL); | |
| 3769 | assert((bitmap->bpp == 16) || (bitmap->bpp == 32)); | |
| 3770 | assert(dst != NULL); | |
| 3771 | assert(length > 0); | |
| 3772 | assert(x >= 0); | |
| 3773 | assert(y >= 0); | |
| 3774 | 2007 | |
| 3775 | /* 16bpp destination */ | |
| 3776 | if (bitmap->bpp == 16) | |
| 3777 | { | |
| 3778 | UINT16 *src = BITMAP_ADDR16(bitmap, y, x); | |
| 3779 | int xadv = 1; | |
| 2008 | /*------------------------------------------------- | |
| 2009 | copyrozbitmap_trans - copy from one bitmap to | |
| 2010 | another, with zoom and rotation, copying all | |
| 2011 | unclipped pixels whose values do not match | |
| 2012 | transpen | |
| 2013 | -------------------------------------------------*/ | |
| 3780 | 2014 | |
| 3781 | while (length--) | |
| 3782 | { | |
| 3783 | *dst++ = *src; | |
| 3784 | src += xadv; | |
| 3785 | } | |
| 3786 | } | |
| 2015 | void copyrozbitmap_trans(bitmap_t *dest, const rectangle *cliprect, bitmap_t *src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound, UINT32 transpen) | |
| 2016 | { | |
| 2017 | bitmap_t *priority = NULL; /* dummy, no priority in this case */ | |
| 3787 | 2018 | |
| 3788 | /* 32bpp destination */ | |
| 3789 | else | |
| 3790 | { | |
| 3791 | UINT32 *src = BITMAP_ADDR32(bitmap, y, x); | |
| 3792 | int xadv = 1; | |
| 2019 | assert(dest != NULL); | |
| 2020 | assert(src != NULL); | |
| 2021 | assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32); | |
| 2022 | assert(src->bpp == dest->bpp); | |
| 3793 | 2023 | |
| 3794 | while (length--) | |
| 3795 | { | |
| 3796 | *dst++ = *src; | |
| 3797 | src += xadv; | |
| 3798 | } | |
| 3799 | } | |
| 3800 | }) | |
| 3801 | ||
| 3802 | #endif /* DECLAREG */ | |
| 2024 | if (dest->bpp == 8) | |
| 2025 | COPYROZBITMAP_CORE(UINT8, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); | |
| 2026 | else if (dest->bpp == 16) | |
| 2027 | COPYROZBITMAP_CORE(UINT16, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); | |
| 2028 | else | |
| 2029 | COPYROZBITMAP_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); | |
| 2030 | } |
| r4135 | r4136 | |
|---|---|---|
| 50 | 50 | { |
| 51 | 51 | TRANSPARENCY_NONE, /* opaque with remapping */ |
| 52 | 52 | TRANSPARENCY_PEN, /* single pen transparency with remapping */ |
| 53 | TRANSPARENCY_PEN_RAW, /* single pen transparency with no remapping */ | |
| 54 | 53 | TRANSPARENCY_PENS, /* multiple pen transparency with remapping */ |
| 55 | TRANSPARENCY_PEN_TABLE, /* special pen remapping modes (see DRAWMODE_xxx below) with remapping */ | |
| 56 | TRANSPARENCY_ALPHA, /* single pen transparency, other pens alpha */ | |
| 57 | TRANSPARENCY_ALPHARANGE, /* single pen transparency, multiple pens alpha depending on array, see psikyosh.c */ | |
| 58 | 54 | |
| 59 | 55 | TRANSPARENCY_MODES /* total number of modes; must be last */ |
| 60 | 56 | }; |
| r4135 | r4136 | |
| 99 | 95 | const gfx_layout name = { width, height, RGN_FRAC(1,1), planes, { GFX_RAW }, { 0 }, { linemod }, charmod }; |
| 100 | 96 | |
| 101 | 97 | |
| 98 | ||
| 102 | 99 | /*************************************************************************** |
| 103 | 100 | TYPE DEFINITIONS |
| 104 | 101 | ***************************************************************************/ |
| r4135 | r4136 | |
| 122 | 119 | /* In mamecore.h: typedef struct _gfx_element gfx_element; */ |
| 123 | 120 | struct _gfx_element |
| 124 | 121 | { |
| 125 | UINT16 width; /* pixel width of each element */ | |
| 126 | UINT16 height; /* pixel height of each element */ | |
| 122 | UINT16 width; /* current pixel width of each element (changeble with source clipping) */ | |
| 123 | UINT16 height; /* current pixel height of each element (changeble with source clipping) */ | |
| 124 | UINT16 startx; /* current source clip X offset */ | |
| 125 | UINT16 starty; /* current source clip Y offset */ | |
| 126 | ||
| 127 | UINT16 origwidth; /* starting pixel width of each element */ | |
| 128 | UINT16 origheight; /* staring pixel height of each element */ | |
| 127 | 129 | UINT8 flags; /* one of the GFX_ELEMENT_* flags above */ |
| 128 | 130 | UINT32 total_elements; /* total number of decoded elements */ |
| 129 | 131 | |
| r4135 | r4136 | |
| 137 | 139 | UINT8 * gfxdata; /* pixel data, 8bpp or 4bpp (if GFX_ELEMENT_PACKED) */ |
| 138 | 140 | UINT32 line_modulo; /* bytes between each row of data */ |
| 139 | 141 | UINT32 char_modulo; /* bytes between each element */ |
| 140 | running_machine * machine; /* pointer to the owning machine */ | |
| 142 | const UINT8 * srcdata; /* pointer to the source data for decoding */ | |
| 143 | UINT8 * dirty; /* dirty array for detecting tiles that need decoding */ | |
| 144 | UINT32 dirtyseq; /* sequence number; incremented each time a tile is dirtied */ | |
| 145 | ||
| 146 | running_machine *machine; /* pointer to the owning machine */ | |
| 141 | 147 | gfx_layout layout; /* copy of the original layout */ |
| 142 | 148 | }; |
| 143 | 149 | |
| r4135 | r4136 | |
| 155 | 161 | }; |
| 156 | 162 | |
| 157 | 163 | |
| 158 | typedef struct _alpha_cache alpha_cache; | |
| 159 | struct _alpha_cache | |
| 160 | { | |
| 161 | int alphas; | |
| 162 | int alphad; | |
| 163 | }; | |
| 164 | 164 | |
| 165 | ||
| 166 | ||
| 167 | 165 | /*************************************************************************** |
| 168 | | |
| 166 | FUNCTION | |
| 169 | 167 | ***************************************************************************/ |
| 170 | 168 | |
| 171 | /* drawing mode case TRANSPARENCY_ALPHARANGE */ | |
| 172 | extern UINT8 gfx_alpharange_table[256]; | |
| 173 | 169 | |
| 174 | /* drawing mode case TRANSPARENCY_PEN_TABLE */ | |
| 175 | extern UINT8 gfx_drawmode_table[256]; | |
| 170 | /* ----- graphics elements ----- */ | |
| 176 | 171 | |
| 177 | /* By default, when drawing sprites with pdrawgfx, shadows affect the sprites below them. */ | |
| 178 | /* Set this flag to 1 to make shadows only affect the background, leaving sprites at full brightness. */ | |
| 179 | extern int pdrawgfx_shadow_lowpri; | |
| 172 | /* allocate a gfx_element structure based on a given layout */ | |
| 173 | gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base); | |
| 180 | 174 | |
| 175 | /* update a single code in a gfx_element */ | |
| 176 | void gfx_element_decode(const gfx_element *gfx, UINT32 code); | |
| 181 | 177 | |
| 178 | /* free a gfx_element */ | |
| 179 | void gfx_element_free(gfx_element *gfx); | |
| 182 | 180 | |
| 183 | /*************************************************************************** | |
| 184 | FUNCTION PROTOTYPES | |
| 185 | ***************************************************************************/ | |
| 181 | /* create a temporary one-off gfx_element */ | |
| 182 | void gfx_element_build_temporary(gfx_element *gfx, running_machine *machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags); | |
| 186 | 183 | |
| 187 | void drawgfx_init(running_machine *machine); | |
| 188 | 184 | |
| 189 | 185 | |
| 190 | void decodechar(gfx_element *gfx,int num,const unsigned char *src); | |
| 191 | gfx_element *allocgfx(running_machine *machine, const gfx_layout *gl); | |
| 192 | void decodegfx(gfx_element *gfx, const UINT8 *src, UINT32 first, UINT32 count); | |
| 193 | void freegfx(gfx_element *gfx); | |
| 186 | /* ----- core graphics drawing ----- */ | |
| 194 | 187 | |
| 188 | /* generic drawgfx with legacy interface */ | |
| 189 | void drawgfx(bitmap_t *dest, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect, int transparency, UINT32 transparent_color); | |
| 195 | 190 | |
| 196 | void drawgfx(bitmap_t *dest,const gfx_element *gfx, | |
| 197 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 198 | const rectangle *clip,int transparency,int transparent_color); | |
| 199 | void pdrawgfx(bitmap_t *dest,const gfx_element *gfx, | |
| 200 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 201 | const rectangle *clip,int transparency,int transparent_color, | |
| 202 | UINT32 priority_mask); | |
| 203 | void mdrawgfx(bitmap_t *dest,const gfx_element *gfx, | |
| 204 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 205 | const rectangle *clip,int transparency,int transparent_color, | |
| 206 | UINT32 priority_mask); | |
| 191 | /* specific drawgfx implementations for each transparency type */ | |
| 192 | void drawgfx_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty); | |
| 193 | void drawgfx_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen); | |
| 194 | void drawgfx_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen); | |
| 195 | void drawgfx_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask); | |
| 196 | void drawgfx_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable); | |
| 197 | void drawgfx_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen, UINT8 alpha); | |
| 207 | 198 | |
| 208 | 199 | |
| 209 | void drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 210 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 211 | const rectangle *clip,int transparency,int transparent_color,int scalex,int scaley); | |
| 212 | void pdrawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 213 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 214 | const rectangle *clip,int transparency,int transparent_color,int scalex,int scaley, | |
| 215 | UINT32 priority_mask); | |
| 216 | void mdrawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 217 | unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy, | |
| 218 | const rectangle *clip,int transparency,int transparent_color,int scalex,int scaley, | |
| 219 | UINT32 priority_mask); | |
| 220 | 200 | |
| 201 | /* ----- zoomed graphics drawing ----- */ | |
| 221 | 202 | |
| 222 | void draw_scanline8(bitmap_t *bitmap,int x,int y,int length,const UINT8 *src,const pen_t *pens,int transparent_pen); | |
| 223 | void draw_scanline16(bitmap_t *bitmap,int x,int y,int length,const UINT16 *src,const pen_t *pens,int transparent_pen); | |
| 224 | void draw_scanline32(bitmap_t *bitmap,int x,int y,int length,const UINT32 *src,const pen_t *pens,int transparent_pen); | |
| 225 | void pdraw_scanline8(bitmap_t *bitmap,int x,int y,int length,const UINT8 *src,const pen_t *pens,int transparent_pen,int pri); | |
| 226 | void pdraw_scanline16(bitmap_t *bitmap,int x,int y,int length,const UINT16 *src,const pen_t *pens,int transparent_pen,int pri); | |
| 227 | void pdraw_scanline32(bitmap_t *bitmap,int x,int y,int length,const UINT32 *src,const pen_t *pens,int transparent_pen,int pri); | |
| 228 | void extract_scanline8(bitmap_t *bitmap,int x,int y,int length,UINT8 *dst); | |
| 229 | void extract_scanline16(bitmap_t *bitmap,int x,int y,int length,UINT16 *dst); | |
| 230 | void extract_scanline32(bitmap_t *bitmap,int x,int y,int length,UINT32 *dst); | |
| 203 | /* generic drawgfxzoom with legacy interface */ | |
| 204 | void drawgfxzoom(bitmap_t *dest, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect, int transparency, UINT32 transparent_color, UINT32 scalex, UINT32 scaley); | |
| 231 | 205 | |
| 206 | /* specific drawgfxzoom implementations for each transparency type */ | |
| 207 | void drawgfxzoom_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley); | |
| 208 | void drawgfxzoom_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen); | |
| 209 | void drawgfxzoom_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen); | |
| 210 | void drawgfxzoom_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask); | |
| 211 | void drawgfxzoom_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable); | |
| 212 | void drawgfxzoom_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha); | |
| 232 | 213 | |
| 233 | void copybitmap(bitmap_t *dest,bitmap_t *src,int flipx,int flipy, | |
| 234 | int sx,int sy,const rectangle *clip); | |
| 235 | 214 | |
| 236 | void copybitmap_trans(bitmap_t *dest,bitmap_t *src,int flipx,int flipy, | |
| 237 | int sx,int sy,const rectangle *clip,pen_t transparent_pen); | |
| 238 | 215 | |
| 239 | void copyscrollbitmap(bitmap_t *dest,bitmap_t *src, | |
| 240 | int rows,const int *rowscroll,int cols,const int *colscroll, | |
| 241 | const rectangle *clip); | |
| 216 | /* ----- priority masked graphics drawing ----- */ | |
| 242 | 217 | |
| 243 | void copyscrollbitmap_trans(bitmap_t *dest,bitmap_t *src, | |
| 244 | int rows,const int *rowscroll,int cols,const int *colscroll, | |
| 245 | const rectangle *clip,pen_t transparent_pen); | |
| 218 | /* generic pdrawgfx with legacy interface */ | |
| 219 | void pdrawgfx(bitmap_t *dest, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect, int transparency, UINT32 transparent_color, UINT32 pmask); | |
| 246 | 220 | |
| 221 | /* specific pdrawgfx implementations for each transparency type */ | |
| 222 | void pdrawgfx_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_t *priority, UINT32 pmask); | |
| 223 | void pdrawgfx_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_t *priority, UINT32 pmask, UINT32 transpen); | |
| 224 | void pdrawgfx_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_t *priority, UINT32 pmask, UINT32 transpen); | |
| 225 | void pdrawgfx_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_t *priority, UINT32 pmask, UINT32 transmask); | |
| 226 | void pdrawgfx_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_t *priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable); | |
| 227 | void pdrawgfx_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_t *priority, UINT32 pmask, UINT32 transpen, UINT8 alpha); | |
| 247 | 228 | |
| 229 | ||
| 230 | ||
| 231 | /* ----- priority masked zoomed graphics drawing ----- */ | |
| 232 | ||
| 233 | /* generic pdrawgfxzoom with legacy interface */ | |
| 234 | void pdrawgfxzoom(bitmap_t *dest, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect, int transparency, UINT32 transparent_color, UINT32 scalex, UINT32 scaley, UINT32 pmask); | |
| 235 | ||
| 236 | /* specific pdrawgfxzoom implementations for each transparency type */ | |
| 237 | void pdrawgfxzoom_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask); | |
| 238 | void pdrawgfxzoom_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask, UINT32 transpen); | |
| 239 | void pdrawgfxzoom_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask, UINT32 transpen); | |
| 240 | void pdrawgfxzoom_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask, UINT32 transmask); | |
| 241 | void pdrawgfxzoom_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable); | |
| 242 | void pdrawgfxzoom_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask, UINT32 transpen, UINT8 alpha); | |
| 243 | ||
| 244 | ||
| 245 | ||
| 246 | /* ----- scanline copying ----- */ | |
| 247 | ||
| 248 | /* copy pixels from an 8bpp buffer to a single scanline of a bitmap */ | |
| 249 | void draw_scanline8(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT8 *srcptr, const pen_t *paldata); | |
| 250 | ||
| 251 | /* copy pixels from a 16bpp buffer to a single scanline of a bitmap */ | |
| 252 | void draw_scanline16(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT16 *srcptr, const pen_t *paldata); | |
| 253 | ||
| 254 | /* copy pixels from a 32bpp buffer to a single scanline of a bitmap */ | |
| 255 | void draw_scanline32(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, const pen_t *paldata); | |
| 256 | ||
| 257 | ||
| 258 | ||
| 259 | /* ----- scanline extraction ----- */ | |
| 260 | ||
| 261 | /* copy pixels from a single scanline of a bitmap to an 8bpp buffer */ | |
| 262 | void extract_scanline8(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT8 *destptr); | |
| 263 | ||
| 264 | /* copy pixels from a single scanline of a bitmap to a 16bpp buffer */ | |
| 265 | void extract_scanline16(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT16 *destptr); | |
| 266 | ||
| 267 | /* copy pixels from a single scanline of a bitmap to a 32bpp buffer */ | |
| 268 | void extract_scanline32(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT32 *destptr); | |
| 269 | ||
| 270 | ||
| 271 | ||
| 272 | /* ----- bitmap copying ----- */ | |
| 273 | ||
| 274 | /* copy from one bitmap to another, copying all unclipped pixels */ | |
| 275 | void copybitmap(bitmap_t *dest, bitmap_t *src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect); | |
| 276 | ||
| 277 | /* copy from one bitmap to another, copying all unclipped pixels except those that match transpen */ | |
| 278 | void copybitmap_trans(bitmap_t *dest, bitmap_t *src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect, UINT32 transpen); | |
| 279 | ||
| 248 | 280 | /* |
| 249 | Copy a bitmap applying rotation, zooming, and arbitrary distortion. | |
| 250 | This function works in a way that mimics some real hardware like the Konami | |
| 251 | 051316, so it requires little or no further processing on the caller side. | |
| 281 | Copy a bitmap onto another with scroll and wraparound. | |
| 282 | These functions support multiple independently scrolling rows/columns. | |
| 283 | "rows" is the number of indepentently scrolling rows. "rowscroll" is an | |
| 284 | array of integers telling how much to scroll each row. Same thing for | |
| 285 | "numcols" and "colscroll". | |
| 286 | If the bitmap cannot scroll in one direction, set numrows or columns to 0. | |
| 287 | If the bitmap scrolls as a whole, set numrows and/or numcols to 1. | |
| 288 | Bidirectional scrolling is, of course, supported only if the bitmap | |
| 289 | scrolls as a whole in at least one direction. | |
| 290 | */ | |
| 252 | 291 | |
| 253 | Two 16.16 fixed point counters are used to keep track of the position on | |
| 254 | the source bitmap. startx and starty are the initial values of those counters, | |
| 255 | indicating the source pixel that will be drawn at coordinates (0,0) in the | |
| 256 | destination bitmap. The destination bitmap is scanned left to right, top to | |
| 257 | bottom; every time the cursor moves one pixel to the right, incxx is added | |
| 258 | to startx and incxy is added to starty. Every time the cursor moves to the | |
| 259 | next line, incyx is added to startx and incyy is added to startyy. | |
| 292 | /* copy from one bitmap to another, copying all unclipped pixels, and applying scrolling to one or more rows/colums */ | |
| 293 | void copyscrollbitmap(bitmap_t *dest, bitmap_t *src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle *cliprect); | |
| 260 | 294 | |
| 261 | What this means is that if incxy and incyx are both 0, the bitmap will be | |
| 262 | copied with only zoom and no rotation. If e.g. incxx and incyy are both 0x8000, | |
| 263 | the source bitmap will be doubled. | |
| 295 | /* copy from one bitmap to another, copying all unclipped pixels except those that match transpen, and applying scrolling to one or more rows/colums */ | |
| 296 | void copyscrollbitmap_trans(bitmap_t *dest, bitmap_t *src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle *cliprect, UINT32 transpen); | |
| 264 | 297 | |
| 265 | Rotation is performed this way: | |
| 266 | incxx = 0x10000 * cos(theta) | |
| 267 | incxy = 0x10000 * -sin(theta) | |
| 268 | incyx = 0x10000 * sin(theta) | |
| 269 | incyy = 0x10000 * cos(theta) | |
| 270 | this will perform a rotation around (0,0), you'll have to adjust startx and | |
| 271 | starty to move the center of rotation elsewhere. | |
| 298 | /* | |
| 299 | Copy a bitmap applying rotation, zooming, and arbitrary distortion. | |
| 300 | This function works in a way that mimics some real hardware like the Konami | |
| 301 | 051316, so it requires little or no further processing on the caller side. | |
| 272 | 302 | |
| 273 | Optionally the bitmap can be tiled across the screen instead of doing a single | |
| 274 | copy. This is obtained by setting the wraparound parameter to true. | |
| 275 | */ | |
| 276 | void copyrozbitmap(bitmap_t *dest,bitmap_t *src, | |
| 277 | UINT32 startx,UINT32 starty,int incxx,int incxy,int incyx,int incyy,int wraparound, | |
| 278 | const rectangle *clip,int transparency,int transparent_color,UINT32 priority); | |
| 303 | Two 16.16 fixed point counters are used to keep track of the position on | |
| 304 | the source bitmap. startx and starty are the initial values of those counters, | |
| 305 | indicating the source pixel that will be drawn at coordinates (0,0) in the | |
| 306 | destination bitmap. The destination bitmap is scanned left to right, top to | |
| 307 | bottom; every time the cursor moves one pixel to the right, incxx is added | |
| 308 | to startx and incxy is added to starty. Every time the cursor moves to the | |
| 309 | next line, incyx is added to startx and incyy is added to startyy. | |
| 279 | 310 | |
| 311 | What this means is that if incxy and incyx are both 0, the bitmap will be | |
| 312 | copied with only zoom and no rotation. If e.g. incxx and incyy are both 0x8000, | |
| 313 | the source bitmap will be doubled. | |
| 280 | 314 | |
| 315 | Rotation is performed this way: | |
| 316 | incxx = 0x10000 * cos(theta) | |
| 317 | incxy = 0x10000 * -sin(theta) | |
| 318 | incyx = 0x10000 * sin(theta) | |
| 319 | incyy = 0x10000 * cos(theta) | |
| 320 | this will perform a rotation around (0,0), you'll have to adjust startx and | |
| 321 | starty to move the center of rotation elsewhere. | |
| 281 | 322 | |
| 323 | Optionally the bitmap can be tiled across the screen instead of doing a single | |
| 324 | copy. This is obtained by setting the wraparound parameter to true. | |
| 325 | */ | |
| 326 | ||
| 327 | /* copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels */ | |
| 328 | void copyrozbitmap(bitmap_t *dest, const rectangle *cliprect, bitmap_t *src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound); | |
| 329 | ||
| 330 | /* copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels whose values do not match transpen */ | |
| 331 | void copyrozbitmap_trans(bitmap_t *dest, const rectangle *cliprect, bitmap_t *src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound, UINT32 transparent_color); | |
| 332 | ||
| 333 | ||
| 334 | ||
| 282 | 335 | /*************************************************************************** |
| 283 | 336 | INLINE FUNCTIONS |
| 284 | 337 | ***************************************************************************/ |
| 285 | 338 | |
| 286 | /* Alpha blending functions */ | |
| 287 | INLINE void alpha_set_level(int level) | |
| 339 | /*------------------------------------------------- | |
| 340 | gfx_element_set_source - set a pointer to | |
| 341 | the source of a gfx_element | |
| 342 | -------------------------------------------------*/ | |
| 343 | ||
| 344 | INLINE void gfx_element_set_source(gfx_element *gfx, const UINT8 *source) | |
| 288 | 345 | { |
| 289 | extern struct _alpha_cache drawgfx_alpha_cache; | |
| 290 | assert(level >= 0 && level <= 256); | |
| 291 | drawgfx_alpha_cache.alphas = level; | |
| 292 | drawgfx_alpha_cache.alphad = 256 - level; | |
| 346 | gfx->srcdata = source; | |
| 347 | memset(gfx->dirty, 1, gfx->total_elements); | |
| 293 | 348 | } |
| 294 | 349 | |
| 295 | 350 | |
| 296 | INLINE UINT32 alpha_blend16(UINT32 d, UINT32 s) | |
| 351 | /*------------------------------------------------- | |
| 352 | gfx_element_get_data - return a pointer to | |
| 353 | the base of the given code within a | |
| 354 | gfx_element, decoding it if it is dirty | |
| 355 | -------------------------------------------------*/ | |
| 356 | ||
| 357 | INLINE const UINT8 *gfx_element_get_data(const gfx_element *gfx, UINT32 code) | |
| 297 | 358 | { |
| 298 | extern struct _alpha_cache drawgfx_alpha_cache; | |
| 299 | return ((((s & 0x001f) * drawgfx_alpha_cache.alphas + (d & 0x001f) * drawgfx_alpha_cache.alphad) >> 8)) | | |
| 300 | ((((s & 0x03e0) * drawgfx_alpha_cache.alphas + (d & 0x03e0) * drawgfx_alpha_cache.alphad) >> 8) & 0x03e0) | | |
| 301 | ((((s & 0x7c00) * drawgfx_alpha_cache.alphas + (d & 0x7c00) * drawgfx_alpha_cache.alphad) >> 8) & 0x7c00); | |
| 359 | assert(code < gfx->total_elements); | |
| 360 | if (gfx->dirty[code]) | |
| 361 | gfx_element_decode(gfx, code); | |
| 362 | return gfx->gfxdata + code * gfx->char_modulo + gfx->starty * gfx->line_modulo + gfx->startx; | |
| 302 | 363 | } |
| 303 | 364 | |
| 304 | 365 | |
| 305 | INLINE UINT32 alpha_blend32(UINT32 d, UINT32 s) | |
| 366 | /*------------------------------------------------- | |
| 367 | gfx_element_mark_dirty - mark a code of a | |
| 368 | gfx_element dirty | |
| 369 | -------------------------------------------------*/ | |
| 370 | ||
| 371 | INLINE void gfx_element_mark_dirty(gfx_element *gfx, UINT32 code) | |
| 306 | 372 | { |
| 307 | extern struct _alpha_cache drawgfx_alpha_cache; | |
| 308 | return ((((s & 0x0000ff) * drawgfx_alpha_cache.alphas + (d & 0x0000ff) * drawgfx_alpha_cache.alphad) >> 8)) | | |
| 309 | ((((s & 0x00ff00) * drawgfx_alpha_cache.alphas + (d & 0x00ff00) * drawgfx_alpha_cache.alphad) >> 8) & 0x00ff00) | | |
| 310 | ((((s & 0xff0000) * drawgfx_alpha_cache.alphas + (d & 0xff0000) * drawgfx_alpha_cache.alphad) >> 8) & 0xff0000); | |
| 373 | if (code < gfx->total_elements) | |
| 374 | { | |
| 375 | gfx->dirty[code] = 1; | |
| 376 | gfx->dirtyseq++; | |
| 377 | } | |
| 311 | 378 | } |
| 312 | 379 | |
| 313 | 380 | |
| 381 | /*------------------------------------------------- | |
| 382 | gfx_element_set_source_clip - set a source | |
| 383 | clipping area to apply to subsequent renders | |
| 384 | -------------------------------------------------*/ | |
| 385 | ||
| 386 | INLINE void gfx_element_set_source_clip(gfx_element *gfx, UINT32 xoffs, UINT32 width, UINT32 yoffs, UINT32 height) | |
| 387 | { | |
| 388 | assert(xoffs < gfx->origwidth); | |
| 389 | assert(yoffs < gfx->origheight); | |
| 390 | assert(xoffs + width <= gfx->origwidth); | |
| 391 | assert(yoffs + height <= gfx->origheight); | |
| 392 | ||
| 393 | gfx->width = width; | |
| 394 | gfx->height = height; | |
| 395 | gfx->startx = xoffs; | |
| 396 | gfx->starty = yoffs; | |
| 397 | } | |
| 398 | ||
| 399 | ||
| 400 | /*------------------------------------------------- | |
| 401 | alpha_blend_r16 - alpha blend two 16-bit | |
| 402 | 5-5-5 RGB pixels | |
| 403 | -------------------------------------------------*/ | |
| 404 | ||
| 314 | 405 | INLINE UINT32 alpha_blend_r16(UINT32 d, UINT32 s, UINT8 level) |
| 315 | 406 | { |
| 316 | 407 | int alphad = 256 - level; |
| r4135 | r4136 | |
| 320 | 411 | } |
| 321 | 412 | |
| 322 | 413 | |
| 323 | INLINE UINT32 alpha_blend_r32( UINT32 d, UINT32 s, UINT8 level ) | |
| 414 | /*------------------------------------------------- | |
| 415 | alpha_blend_r32 - alpha blend two 32-bit | |
| 416 | 8-8-8 RGB pixels | |
| 417 | -------------------------------------------------*/ | |
| 418 | ||
| 419 | INLINE UINT32 alpha_blend_r32(UINT32 d, UINT32 s, UINT8 level) | |
| 324 | 420 | { |
| 325 | 421 | int alphad = 256 - level; |
| 326 | 422 | return ((((s & 0x0000ff) * level + (d & 0x0000ff) * alphad) >> 8)) | |
| r4135 | r4136 | |
|---|---|---|
| 160 | 160 | /* loop over tokens until we hit the end */ |
| 161 | 161 | while (entrytype != MCONFIG_TOKEN_END) |
| 162 | 162 | { |
| 163 | int size, offset, | |
| 163 | int size, offset, | |
| 164 | 164 | UINT32 data32, clock, gain; |
| 165 | 165 | device_type devtype; |
| 166 | sound_type type; | |
| 166 | 167 | const char *tag; |
| 167 | 168 | UINT64 data64; |
| 168 | 169 | |
| r4135 | r4136 | |
| 360 | 361 | /* add/remove/replace sounds */ |
| 361 | 362 | case MCONFIG_TOKEN_SOUND_ADD: |
| 362 | 363 | TOKEN_UNGET_UINT32(tokens); |
| 363 | TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32); | |
| 364 | TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, clock, 32); | |
| 365 | type = TOKEN_GET_PTR(tokens, sndtype); | |
| 364 | 366 | tag = TOKEN_GET_STRING(tokens); |
| 365 | 367 | sound = sound_add(config, device_build_tag(tempstring, owner, tag), type, clock); |
| 366 | 368 | break; |
| r4135 | r4136 | |
| 384 | 386 | |
| 385 | 387 | case MCONFIG_TOKEN_SOUND_REPLACE: |
| 386 | 388 | TOKEN_UNGET_UINT32(tokens); |
| 387 | TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32); | |
| 389 | TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, clock, 32); | |
| 390 | type = TOKEN_GET_PTR(tokens, sndtype); | |
| 388 | 391 | tag = TOKEN_GET_STRING(tokens); |
| 389 | 392 | sound = sound_find(config, device_build_tag(tempstring, owner, tag)); |
| 390 | 393 | if (sound == NULL) |
| r0 | r4136 | |
|---|---|---|
| 1 | /********************************************************************* | |
| 2 | ||
| 3 | drawgfxm.h | |
| 4 | ||
| 5 | Macros implementing drawgfx core operations. Drivers can use | |
| 6 | these if they need custom behavior not provided by the existing | |
| 7 | drawgfx functions. | |
| 8 | ||
| 9 | Copyright Nicola Salmoria and the MAME Team. | |
| 10 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 11 | ||
| 12 | ********************************************************************** | |
| 13 | ||
| 14 | How to use these macros: | |
| 15 | ||
| 16 | There are two sets of macros. The PIXEL_OP* macros are simple | |
| 17 | per-pixel operations, designed to take a SOURCE pixel and | |
| 18 | copy it to the DEST, perhaps updating the PRIORITY pixel as | |
| 19 | well. On their own, they are not particularly useful. | |
| 20 | ||
| 21 | The second set of macros represents the core gfx/bitmap walking | |
| 22 | and rendering code. These macros generally take the target pixel | |
| 23 | type (UINT8, UINT16, UINT32), one of the PIXEL_OP* macros, | |
| 24 | and a priority bitmap pixel type (UINT8, UINT16, UINT32, or the | |
| 25 | special type NO_PRIORITY). | |
| 26 | ||
| 27 | Although the code may look inefficient at first, the compiler is | |
| 28 | able to easily optimize out unused cases due to the way the | |
| 29 | macros are written, leaving behind just the cases we are | |
| 30 | interested in. | |
| 31 | ||
| 32 | The general approach for using these macros is: | |
| 33 | ||
| 34 | my_drawing_function(params) | |
| 35 | { | |
| 36 | // ensure that all the required parameters for the mega | |
| 37 | // macro are defined (if they are not needed, just declare | |
| 38 | // the variables and set them equal to a known constant | |
| 39 | // value to help the compiler) | |
| 40 | ||
| 41 | // set up any additional variables needed by the PIXEL_OP* | |
| 42 | // macro you want to use (each macro has its own | |
| 43 | // requirements) | |
| 44 | ||
| 45 | MEGA_MACRO(BITMAP_TYPE, PIXEL_OP, PRIORITY_TYPE); | |
| 46 | } | |
| 47 | ||
| 48 | *********************************************************************/ | |
| 49 | ||
| 50 | #pragma once | |
| 51 | ||
| 52 | #ifndef __DRAWGFXM_H__ | |
| 53 | #define __DRAWGFXM_H__ | |
| 54 | ||
| 55 | #include "profiler.h" | |
| 56 | ||
| 57 | ||
| 58 | /* special priority type meaning "none" */ | |
| 59 | typedef struct { char dummy[3]; } NO_PRIORITY; | |
| 60 | ||
| 61 | ||
| 62 | /* macros for using the optional priority */ | |
| 63 | #define PRIORITY_VALID(x) (sizeof(x) != sizeof(NO_PRIORITY)) | |
| 64 | #define PRIORITY_ADDR(p,t,y,x) (PRIORITY_VALID(t) ? BITMAP_ADDR(p, t, y, x) : NULL) | |
| 65 | #define PRIORITY_ADVANCE(t,p,i) do { if (PRIORITY_VALID(t)) (p) += (i); } while (0) | |
| 66 | ||
| 67 | ||
| 68 | /*************************************************************************** | |
| 69 | PIXEL OPERATIONS | |
| 70 | ***************************************************************************/ | |
| 71 | ||
| 72 | /*------------------------------------------------- | |
| 73 | PIXEL_OP_COPY_OPAQUE - render all pixels | |
| 74 | regardless of pen, copying directly | |
| 75 | -------------------------------------------------*/ | |
| 76 | ||
| 77 | #define PIXEL_OP_COPY_OPAQUE(DEST, PRIORITY, SOURCE) \ | |
| 78 | do \ | |
| 79 | { \ | |
| 80 | (DEST) = SOURCE; \ | |
| 81 | } \ | |
| 82 | while (0) \ | |
| 83 | ||
| 84 | ||
| 85 | /*------------------------------------------------- | |
| 86 | PIXEL_OP_COPY_TRANSPEN - render all pixels | |
| 87 | except those matching 'transpen', copying | |
| 88 | directly | |
| 89 | -------------------------------------------------*/ | |
| 90 | ||
| 91 | #define PIXEL_OP_COPY_TRANSPEN(DEST, PRIORITY, SOURCE) \ | |
| 92 | do \ | |
| 93 | { \ | |
| 94 | UINT32 srcdata = (SOURCE); \ | |
| 95 | if (srcdata != transpen) \ | |
| 96 | (DEST) = SOURCE; \ | |
| 97 | } \ | |
| 98 | while (0) \ | |
| 99 | ||
| 100 | ||
| 101 | /*------------------------------------------------- | |
| 102 | PIXEL_OP_REMAP_OPAQUE - render all pixels | |
| 103 | regardless of pen, mapping the pen via the | |
| 104 | 'paldata' array | |
| 105 | -------------------------------------------------*/ | |
| 106 | ||
| 107 | #define PIXEL_OP_REMAP_OPAQUE(DEST, PRIORITY, SOURCE) \ | |
| 108 | do \ | |
| 109 | { \ | |
| 110 | (DEST) = paldata[SOURCE]; \ | |
| 111 | } \ | |
| 112 | while (0) \ | |
| 113 | ||
| 114 | #define PIXEL_OP_REMAP_OPAQUE_PRIORITY(DEST, PRIORITY, SOURCE) \ | |
| 115 | do \ | |
| 116 | { \ | |
| 117 | if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ | |
| 118 | (DEST) = paldata[SOURCE]; \ | |
| 119 | (PRIORITY) = 31; \ | |
| 120 | } \ | |
| 121 | while (0) \ | |
| 122 | ||
| 123 | ||
| 124 | /*------------------------------------------------- | |
| 125 | PIXEL_OP_REMAP_TRANSPEN - render all pixels | |
| 126 | except those matching 'transpen', mapping the | |
| 127 | pen via the 'paldata' array | |
| 128 | -------------------------------------------------*/ | |
| 129 | ||
| 130 | #define PIXEL_OP_REMAP_TRANSPEN(DEST, PRIORITY, SOURCE) \ | |
| 131 | do \ | |
| 132 | { \ | |
| 133 | UINT32 srcdata = (SOURCE); \ | |
| 134 | if (srcdata != transpen) \ | |
| 135 | (DEST) = paldata[srcdata]; \ | |
| 136 | } \ | |
| 137 | while (0) \ | |
| 138 | ||
| 139 | #define PIXEL_OP_REMAP_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ | |
| 140 | do \ | |
| 141 | { \ | |
| 142 | UINT32 srcdata = (SOURCE); \ | |
| 143 | if (srcdata != transpen) \ | |
| 144 | { \ | |
| 145 | if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ | |
| 146 | (DEST) = paldata[srcdata]; \ | |
| 147 | (PRIORITY) = 31; \ | |
| 148 | } \ | |
| 149 | } \ | |
| 150 | while (0) \ | |
| 151 | ||
| 152 | ||
| 153 | /*------------------------------------------------- | |
| 154 | PIXEL_OP_REBASE_TRANSPEN - render all pixels | |
| 155 | except those matching 'transpen', adding | |
| 156 | 'color' to the pen value | |
| 157 | -------------------------------------------------*/ | |
| 158 | ||
| 159 | #define PIXEL_OP_REBASE_TRANSPEN(DEST, PRIORITY, SOURCE) \ | |
| 160 | do \ | |
| 161 | { \ | |
| 162 | UINT32 srcdata = (SOURCE); \ | |
| 163 | if (srcdata != transpen) \ | |
| 164 | (DEST) = color + srcdata; \ | |
| 165 | } \ | |
| 166 | while (0) \ | |
| 167 | ||
| 168 | #define PIXEL_OP_REBASE_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ | |
| 169 | do \ | |
| 170 | { \ | |
| 171 | UINT32 srcdata = (SOURCE); \ | |
| 172 | if (srcdata != transpen) \ | |
| 173 | { \ | |
| 174 | if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ | |
| 175 | (DEST) = color + srcdata; \ | |
| 176 | (PRIORITY) = 31; \ | |
| 177 | } \ | |
| 178 | } \ | |
| 179 | while (0) \ | |
| 180 | ||
| 181 | ||
| 182 | /*------------------------------------------------- | |
| 183 | PIXEL_OP_REMAP_TRANSMASK - render all pixels | |
| 184 | except those matching 'transmask', mapping the | |
| 185 | pen via the 'paldata' array | |
| 186 | -------------------------------------------------*/ | |
| 187 | ||
| 188 | #define PIXEL_OP_REMAP_TRANSMASK(DEST, PRIORITY, SOURCE) \ | |
| 189 | do \ | |
| 190 | { \ | |
| 191 | UINT32 srcdata = (SOURCE); \ | |
| 192 | if (((transmask >> srcdata) & 1) == 0) \ | |
| 193 | (DEST) = paldata[srcdata]; \ | |
| 194 | } \ | |
| 195 | while (0) \ | |
| 196 | ||
| 197 | #define PIXEL_OP_REMAP_TRANSMASK_PRIORITY(DEST, PRIORITY, SOURCE) \ | |
| 198 | do \ | |
| 199 | { \ | |
| 200 | UINT32 srcdata = (SOURCE); \ | |
| 201 | if (((transmask >> srcdata) & 1) == 0) \ | |
| 202 | { \ | |
| 203 | if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ | |
| 204 | (DEST) = paldata[srcdata]; \ | |
| 205 | (PRIORITY) = 31; \ | |
| 206 | } \ | |
| 207 | } \ | |
| 208 | while (0) \ | |
| 209 | ||
| 210 | ||
| 211 | /*------------------------------------------------- | |
| 212 | PIXEL_OP_REMAP_TRANSTABLE - look up each pen in | |
| 213 | 'pentable'; if the entry is DRAWMODE_NONE, | |
| 214 | don't draw it; if the entry is DRAWMODE_SOURCE, | |
| 215 | look up the pen via the 'paldata' array; if the | |
| 216 | entry is DRAWMODE_SHADOW, generate a shadow of | |
| 217 | the destination pixel using 'shadowtable' | |
| 218 | -------------------------------------------------*/ | |
| 219 | ||
| 220 | #define PIXEL_OP_REMAP_TRANSTABLE16(DEST, PRIORITY, SOURCE) \ | |
| 221 | do \ | |
| 222 | { \ | |
| 223 | UINT32 srcdata = (SOURCE); \ | |
| 224 | UINT32 entry = pentable[srcdata]; \ | |
| 225 | if (entry != DRAWMODE_NONE) \ | |
| 226 | { \ | |
| 227 | if (entry == DRAWMODE_SOURCE) \ | |
| 228 | (DEST) = paldata[srcdata]; \ | |
| 229 | else \ | |
| 230 | (DEST) = shadowtable[DEST]; \ | |
| 231 | } \ | |
| 232 | } \ | |
| 233 | while (0) \ | |
| 234 | ||
| 235 | #define PIXEL_OP_REMAP_TRANSTABLE32(DEST, PRIORITY, SOURCE) \ | |
| 236 | do \ | |
| 237 | { \ | |
| 238 | UINT32 srcdata = (SOURCE); \ | |
| 239 | UINT32 entry = pentable[srcdata]; \ | |
| 240 | if (entry != DRAWMODE_NONE) \ | |
| 241 | { \ | |
| 242 | if (entry == DRAWMODE_SOURCE) \ | |
| 243 | (DEST) = paldata[srcdata]; \ | |
| 244 | else \ | |
| 245 | (DEST) = shadowtable[rgb_to_rgb15(DEST)]; \ | |
| 246 | } \ | |
| 247 | } \ | |
| 248 | while (0) \ | |
| 249 | ||
| 250 | #define PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY(DEST, PRIORITY, SOURCE) \ | |
| 251 | do \ | |
| 252 | { \ | |
| 253 | UINT32 srcdata = (SOURCE); \ | |
| 254 | UINT32 entry = pentable[srcdata]; \ | |
| 255 | if (entry != DRAWMODE_NONE) \ | |
| 256 | { \ | |
| 257 | UINT8 pridata = (PRIORITY); \ | |
| 258 | if (((1 << (pridata & 0x1f)) & pmask) == 0) \ | |
| 259 | { \ | |
| 260 | if (entry == DRAWMODE_SOURCE) \ | |
| 261 | { \ | |
| 262 | (DEST) = paldata[srcdata]; \ | |
| 263 | (PRIORITY) = 31; \ | |
| 264 | } \ | |
| 265 | else if ((pridata & 0x80) == 0) \ | |
| 266 | { \ | |
| 267 | (DEST) = shadowtable[DEST]; \ | |
| 268 | (PRIORITY) = pridata | 0x80; \ | |
| 269 | } \ | |
| 270 | } \ | |
| 271 | } \ | |
| 272 | } \ | |
| 273 | while (0) \ | |
| 274 | ||
| 275 | #define PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY(DEST, PRIORITY, SOURCE) \ | |
| 276 | do \ | |
| 277 | { \ | |
| 278 | UINT32 srcdata = (SOURCE); \ | |
| 279 | UINT32 entry = pentable[srcdata]; \ | |
| 280 | if (entry != DRAWMODE_NONE) \ | |
| 281 | { \ | |
| 282 | UINT8 pridata = (PRIORITY); \ | |
| 283 | if (((1 << (pridata & 0x1f)) & pmask) == 0) \ | |
| 284 | { \ | |
| 285 | if (entry == DRAWMODE_SOURCE) \ | |
| 286 | { \ | |
| 287 | (DEST) = paldata[srcdata]; \ | |
| 288 | (PRIORITY) = 31; \ | |
| 289 | } \ | |
| 290 | else if ((pridata & 0x80) == 0) \ | |
| 291 | { \ | |
| 292 | (DEST) = shadowtable[rgb_to_rgb15(DEST)]; \ | |
| 293 | (PRIORITY) = pridata | 0x80; \ | |
| 294 | } \ | |
| 295 | } \ | |
| 296 | } \ | |
| 297 | } \ | |
| 298 | while (0) \ | |
| 299 | ||
| 300 | ||
| 301 | /*------------------------------------------------- | |
| 302 | PIXEL_OP_REMAP_TRANSPEN_ALPHA - render all | |
| 303 | pixels except those matching 'transpen', | |
| 304 | mapping the pen to via the 'paldata' array; | |
| 305 | the resulting color is RGB alpha blended | |
| 306 | against the destination using 'alpha' | |
| 307 | -------------------------------------------------*/ | |
| 308 | ||
| 309 | #define PIXEL_OP_REMAP_TRANSPEN_ALPHA16(DEST, PRIORITY, SOURCE) \ | |
| 310 | do \ | |
| 311 | { \ | |
| 312 | UINT32 srcdata = (SOURCE); \ | |
| 313 | if (srcdata != transpen) \ | |
| 314 | (DEST) = alpha_blend_r16((DEST), paldata[srcdata], alpha); \ | |
| 315 | } \ | |
| 316 | while (0) \ | |
| 317 | ||
| 318 | #define PIXEL_OP_REMAP_TRANSPEN_ALPHA32(DEST, PRIORITY, SOURCE) \ | |
| 319 | do \ | |
| 320 | { \ | |
| 321 | UINT32 srcdata = (SOURCE); \ | |
| 322 | if (srcdata != transpen) \ | |
| 323 | (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alpha); \ | |
| 324 | } \ | |
| 325 | while (0) \ | |
| 326 | ||
| 327 | #define PIXEL_OP_REMAP_TRANSPEN_ALPHA16_PRIORITY(DEST, PRIORITY, SOURCE) \ | |
| 328 | do \ | |
| 329 | { \ | |
| 330 | UINT32 srcdata = (SOURCE); \ | |
| 331 | if (srcdata != transpen) \ | |
| 332 | { \ | |
| 333 | if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ | |
| 334 | (DEST) = alpha_blend_r16((DEST), paldata[srcdata], alpha); \ | |
| 335 | (PRIORITY) = 31; \ | |
| 336 | } \ | |
| 337 | } \ | |
| 338 | while (0) \ | |
| 339 | ||
| 340 | #define PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY(DEST, PRIORITY, SOURCE) \ | |
| 341 | do \ | |
| 342 | { \ | |
| 343 | UINT32 srcdata = (SOURCE); \ | |
| 344 | if (srcdata != transpen) \ | |
| 345 | { \ | |
| 346 | if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ | |
| 347 | (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alpha); \ | |
| 348 | (PRIORITY) = 31; \ | |
| 349 | } \ | |
| 350 | } \ | |
| 351 | while (0) \ | |
| 352 | ||
| 353 | ||
| 354 | ||
| 355 | /*************************************************************************** | |
| 356 | BASIC DRAWGFX CORE | |
| 357 | ***************************************************************************/ | |
| 358 | ||
| 359 | /* | |
| 360 | Assumed input parameters or local variables: | |
| 361 | ||
| 362 | bitmap_t *dest - the bitmap to render to | |
| 363 | const rectangle *cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') | |
| 364 | const gfx_element *gfx - pointer to the gfx_element to render | |
| 365 | UINT32 code - index of the entry within gfx_element | |
| 366 | UINT32 color - index of the color within gfx_element | |
| 367 | int flipx - non-zero means render right-to-left instead of left-to-right | |
| 368 | int flipy - non-zero means render bottom-to-top instead of top-to-bottom | |
| 369 | INT32 destx - the top-left X coordinate to render to | |
| 370 | INT32 desty - the top-left Y coordinate to render to | |
| 371 | bitmap_t *priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) | |
| 372 | */ | |
| 373 | ||
| 374 | ||
| 375 | #define DRAWGFX_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ | |
| 376 | do { \ | |
| 377 | profiler_mark(PROFILER_DRAWGFX); \ | |
| 378 | do { \ | |
| 379 | const UINT8 *srcdata; \ | |
| 380 | INT32 destendx, destendy; \ | |
| 381 | INT32 srcx, srcy; \ | |
| 382 | INT32 curx, cury; \ | |
| 383 | INT32 dy; \ | |
| 384 | \ | |
| 385 | assert(dest != NULL); \ | |
| 386 | assert(gfx != NULL); \ | |
| 387 | assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority != NULL); \ | |
| 388 | assert(cliprect == NULL || cliprect->min_x >= 0); \ | |
| 389 | assert(cliprect == NULL || cliprect->max_x < dest->width); \ | |
| 390 | assert(cliprect == NULL || cliprect->min_y >= 0); \ | |
| 391 | assert(cliprect == NULL || cliprect->max_y < dest->height); \ | |
| 392 | \ | |
| 393 | /* NULL clip means use the full bitmap */ \ | |
| 394 | if (cliprect == NULL) \ | |
| 395 | cliprect = &dest->cliprect; \ | |
| 396 | \ | |
| 397 | /* ignore empty/invalid cliprects */ \ | |
| 398 | if (cliprect->min_x > cliprect->max_x || cliprect->min_y > cliprect->max_y) \ | |
| 399 | break; \ | |
| 400 | \ | |
| 401 | /* compute final pixel in X and exit if we are entirely clipped */ \ | |
| 402 | destendx = destx + gfx->width - 1; \ | |
| 403 | if (destx > cliprect->max_x || destendx < cliprect->min_x) \ | |
| 404 | break; \ | |
| 405 | \ | |
| 406 | /* apply left clip */ \ | |
| 407 | srcx = 0; \ | |
| 408 | if (destx < cliprect->min_x) \ | |
| 409 | { \ | |
| 410 | srcx = cliprect->min_x - destx; \ | |
| 411 | destx = cliprect->min_x; \ | |
| 412 | } \ | |
| 413 | \ | |
| 414 | /* apply right clip */ \ | |
| 415 | if (destendx > cliprect->max_x) \ | |
| 416 | destendx = cliprect->max_x; \ | |
| 417 | \ | |
| 418 | /* compute final pixel in Y and exit if we are entirely clipped */ \ | |
| 419 | destendy = desty + gfx->height - 1; \ | |
| 420 | if (desty > cliprect->max_y || destendy < cliprect->min_y) \ | |
| 421 | break; \ | |
| 422 | \ | |
| 423 | /* apply top clip */ \ | |
| 424 | srcy = 0; \ | |
| 425 | if (desty < cliprect->min_y) \ | |
| 426 | { \ | |
| 427 | srcy = cliprect->min_y - desty; \ | |
| 428 | desty = cliprect->min_y; \ | |
| 429 | } \ | |
| 430 | \ | |
| 431 | /* apply bottom clip */ \ | |
| 432 | if (destendy > cliprect->max_y) \ | |
| 433 | destendy = cliprect->max_y; \ | |
| 434 | \ | |
| 435 | /* apply X flipping */ \ | |
| 436 | if (flipx) \ | |
| 437 | srcx = gfx->width - 1 - srcx; \ | |
| 438 | \ | |
| 439 | /* apply Y flipping */ \ | |
| 440 | dy = gfx->line_modulo; \ | |
| 441 | if (flipy) \ | |
| 442 | { \ | |
| 443 | srcy = gfx->height - 1 - srcy; \ | |
| 444 | dy = -dy; \ | |
| 445 | } \ | |
| 446 | \ | |
| 447 | /* fetch the source data */ \ | |
| 448 | srcdata = gfx_element_get_data(gfx, code); \ | |
| 449 | \ | |
| 450 | /* draw normal 8bpp source data */ \ | |
| 451 | if (!(gfx->flags & GFX_ELEMENT_PACKED)) \ | |
| 452 | { \ | |
| 453 | /* compute how many blocks of 4 pixels we have */ \ | |
| 454 | UINT32 numblocks = (destendx + 1 - destx) / 4; \ | |
| 455 | UINT32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ | |
| 456 | \ | |
| 457 | /* adjust srcdata to point to the first source pixel of the row */ \ | |
| 458 | srcdata += srcy * gfx->line_modulo + srcx; \ | |
| 459 | \ | |
| 460 | /* non-flipped 8bpp case */ \ | |
| 461 | if (!flipx) \ | |
| 462 | { \ | |
| 463 | /* iterate over pixels in Y */ \ | |
| 464 | for (cury = desty; cury <= destendy; cury++) \ | |
| 465 | { \ | |
| 466 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ | |
| 467 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, destx); \ | |
| 468 | const UINT8 *srcptr = srcdata; \ | |
| 469 | srcdata += dy; \ | |
| 470 | \ | |
| 471 | /* iterate over unrolled blocks of 4 */ \ | |
| 472 | for (curx = 0; curx < numblocks; curx++) \ | |
| 473 | { \ | |
| 474 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 475 | PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ | |
| 476 | PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ | |
| 477 | PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ | |
| 478 | \ | |
| 479 | srcptr += 4; \ | |
| 480 | destptr += 4; \ | |
| 481 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ | |
| 482 | } \ | |
| 483 | \ | |
| 484 | /* iterate over leftover pixels */ \ | |
| 485 | for (curx = 0; curx < leftovers; curx++) \ | |
| 486 | { \ | |
| 487 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 488 | srcptr++; \ | |
| 489 | destptr++; \ | |
| 490 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 491 | } \ | |
| 492 | } \ | |
| 493 | } \ | |
| 494 | \ | |
| 495 | /* flipped 8bpp case */ \ | |
| 496 | else \ | |
| 497 | { \ | |
| 498 | /* iterate over pixels in Y */ \ | |
| 499 | for (cury = desty; cury <= destendy; cury++) \ | |
| 500 | { \ | |
| 501 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ | |
| 502 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, destx); \ | |
| 503 | const UINT8 *srcptr = srcdata; \ | |
| 504 | srcdata += dy; \ | |
| 505 | \ | |
| 506 | /* iterate over unrolled blocks of 4 */ \ | |
| 507 | for (curx = 0; curx < numblocks; curx++) \ | |
| 508 | { \ | |
| 509 | PIXEL_OP(destptr[0], priptr[0], srcptr[ 0]); \ | |
| 510 | PIXEL_OP(destptr[1], priptr[1], srcptr[-1]); \ | |
| 511 | PIXEL_OP(destptr[2], priptr[2], srcptr[-2]); \ | |
| 512 | PIXEL_OP(destptr[3], priptr[3], srcptr[-3]); \ | |
| 513 | \ | |
| 514 | srcptr -= 4; \ | |
| 515 | destptr += 4; \ | |
| 516 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ | |
| 517 | } \ | |
| 518 | \ | |
| 519 | /* iterate over leftover pixels */ \ | |
| 520 | for (curx = 0; curx < leftovers; curx++) \ | |
| 521 | { \ | |
| 522 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 523 | srcptr--; \ | |
| 524 | destptr++; \ | |
| 525 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 526 | } \ | |
| 527 | } \ | |
| 528 | } \ | |
| 529 | } \ | |
| 530 | \ | |
| 531 | /* draw packed 4bpp source data */ \ | |
| 532 | else \ | |
| 533 | { \ | |
| 534 | /* adjust srcdata to point to the first source pixel of the row */ \ | |
| 535 | srcdata += srcy * gfx->line_modulo + srcx / 2; \ | |
| 536 | \ | |
| 537 | /* non-flipped 4bpp case */ \ | |
| 538 | if (!flipx) \ | |
| 539 | { \ | |
| 540 | /* compute how many blocks of 2 pixels we have */ \ | |
| 541 | UINT32 oddstart = srcx & 1; \ | |
| 542 | UINT32 numblocks = (destendx + 1 - destx - oddstart) / 2; \ | |
| 543 | UINT32 leftovers = (destendx + 1 - destx - oddstart) - 2 * numblocks; \ | |
| 544 | \ | |
| 545 | /* iterate over pixels in Y */ \ | |
| 546 | for (cury = desty; cury <= destendy; cury++) \ | |
| 547 | { \ | |
| 548 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ | |
| 549 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, destx); \ | |
| 550 | const UINT8 *srcptr = srcdata; \ | |
| 551 | srcdata += dy; \ | |
| 552 | \ | |
| 553 | /* odd starting pixel */ \ | |
| 554 | if (oddstart) \ | |
| 555 | { \ | |
| 556 | PIXEL_OP(destptr[0], priptr[0], srcptr[0] >> 4); \ | |
| 557 | srcptr++; \ | |
| 558 | destptr++; \ | |
| 559 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 560 | } \ | |
| 561 | \ | |
| 562 | /* iterate over unrolled blocks of 2 */ \ | |
| 563 | for (curx = 0; curx < numblocks; curx++) \ | |
| 564 | { \ | |
| 565 | UINT8 srcbyte = *srcptr++; \ | |
| 566 | PIXEL_OP(destptr[0], priptr[0], srcbyte & 15); \ | |
| 567 | PIXEL_OP(destptr[1], priptr[1], srcbyte >> 4); \ | |
| 568 | destptr += 2; \ | |
| 569 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 2); \ | |
| 570 | } \ | |
| 571 | \ | |
| 572 | /* iterate over leftover pixels */ \ | |
| 573 | if (leftovers > 0) \ | |
| 574 | PIXEL_OP(destptr[0], priptr[0], srcptr[0] & 15); \ | |
| 575 | } \ | |
| 576 | } \ | |
| 577 | \ | |
| 578 | /* flipped 4bpp case */ \ | |
| 579 | else \ | |
| 580 | { \ | |
| 581 | /* compute how many blocks of 2 pixels we have */ \ | |
| 582 | UINT32 oddstart = ~srcx & 1; \ | |
| 583 | UINT32 numblocks = (destendx + 1 - destx - oddstart) / 2; \ | |
| 584 | UINT32 leftovers = (destendx + 1 - destx - oddstart) - 2 * numblocks; \ | |
| 585 | \ | |
| 586 | /* iterate over pixels in Y */ \ | |
| 587 | for (cury = desty; cury <= destendy; cury++) \ | |
| 588 | { \ | |
| 589 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ | |
| 590 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, destx); \ | |
| 591 | const UINT8 *srcptr = srcdata; \ | |
| 592 | srcdata += dy; \ | |
| 593 | \ | |
| 594 | /* odd right pixel */ \ | |
| 595 | if (oddstart) \ | |
| 596 | { \ | |
| 597 | PIXEL_OP(destptr[0], priptr[0], srcptr[0] & 15); \ | |
| 598 | srcptr--; \ | |
| 599 | destptr++; \ | |
| 600 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 601 | } \ | |
| 602 | \ | |
| 603 | /* middle pixels */ \ | |
| 604 | for (curx = 0; curx < numblocks; curx++) \ | |
| 605 | { \ | |
| 606 | UINT8 srcbyte = *srcptr--; \ | |
| 607 | PIXEL_OP(destptr[0], priptr[0], srcbyte >> 4); \ | |
| 608 | PIXEL_OP(destptr[1], priptr[1], srcbyte & 15); \ | |
| 609 | destptr += 2; \ | |
| 610 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 2); \ | |
| 611 | } \ | |
| 612 | \ | |
| 613 | /* odd left pixel */ \ | |
| 614 | if (leftovers > 0) \ | |
| 615 | PIXEL_OP(destptr[0], priptr[0], srcptr[0] >> 4); \ | |
| 616 | } \ | |
| 617 | } \ | |
| 618 | } \ | |
| 619 | } while (0); \ | |
| 620 | profiler_mark(PROFILER_END); \ | |
| 621 | } while (0) | |
| 622 | ||
| 623 | ||
| 624 | ||
| 625 | /*************************************************************************** | |
| 626 | BASIC DRAWGFXZOOM CORE | |
| 627 | ***************************************************************************/ | |
| 628 | ||
| 629 | /* | |
| 630 | Assumed input parameters or local variables: | |
| 631 | ||
| 632 | bitmap_t *dest - the bitmap to render to | |
| 633 | const rectangle *cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') | |
| 634 | const gfx_element *gfx - pointer to the gfx_element to render | |
| 635 | UINT32 code - index of the entry within gfx_element | |
| 636 | UINT32 color - index of the color within gfx_element | |
| 637 | int flipx - non-zero means render right-to-left instead of left-to-right | |
| 638 | int flipy - non-zero means render bottom-to-top instead of top-to-bottom | |
| 639 | INT32 destx - the top-left X coordinate to render to | |
| 640 | INT32 desty - the top-left Y coordinate to render to | |
| 641 | UINT32 scalex - the 16.16 scale factor in the X dimension | |
| 642 | UINT32 scaley - the 16.16 scale factor in the Y dimension | |
| 643 | bitmap_t *priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) | |
| 644 | */ | |
| 645 | ||
| 646 | ||
| 647 | #define DRAWGFXZOOM_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ | |
| 648 | do { \ | |
| 649 | profiler_mark(PROFILER_DRAWGFX); \ | |
| 650 | do { \ | |
| 651 | const UINT8 *srcdata; \ | |
| 652 | UINT32 dstwidth, dstheight; \ | |
| 653 | INT32 destendx, destendy; \ | |
| 654 | INT32 srcx, srcy; \ | |
| 655 | INT32 curx, cury; \ | |
| 656 | INT32 dx, dy; \ | |
| 657 | \ | |
| 658 | assert(dest != NULL); \ | |
| 659 | assert(gfx != NULL); \ | |
| 660 | assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority != NULL); \ | |
| 661 | assert(cliprect == NULL || cliprect->min_x >= 0); \ | |
| 662 | assert(cliprect == NULL || cliprect->max_x < dest->width); \ | |
| 663 | assert(cliprect == NULL || cliprect->min_y >= 0); \ | |
| 664 | assert(cliprect == NULL || cliprect->max_y < dest->height); \ | |
| 665 | \ | |
| 666 | /* NULL clip means use the full bitmap */ \ | |
| 667 | if (cliprect == NULL) \ | |
| 668 | cliprect = &dest->cliprect; \ | |
| 669 | \ | |
| 670 | /* ignore empty/invalid cliprects */ \ | |
| 671 | if (cliprect->min_x > cliprect->max_x || cliprect->min_y > cliprect->max_y) \ | |
| 672 | break; \ | |
| 673 | \ | |
| 674 | /* compute scaled size */ \ | |
| 675 | dstwidth = (scalex * gfx->width + 0x8000) >> 16; \ | |
| 676 | dstheight = (scaley * gfx->height + 0x8000) >> 16; \ | |
| 677 | if (dstwidth < 1 || dstheight < 1) \ | |
| 678 | break; \ | |
| 679 | \ | |
| 680 | /* compute 16.16 source steps in dx and dy */ \ | |
| 681 | dx = (gfx->width << 16) / dstwidth; \ | |
| 682 | dy = (gfx->height << 16) / dstheight; \ | |
| 683 | \ | |
| 684 | /* compute final pixel in X and exit if we are entirely clipped */ \ | |
| 685 | destendx = destx + dstwidth - 1; \ | |
| 686 | if (destx > cliprect->max_x || destendx < cliprect->min_x) \ | |
| 687 | break; \ | |
| 688 | \ | |
| 689 | /* apply left clip */ \ | |
| 690 | srcx = 0; \ | |
| 691 | if (destx < cliprect->min_x) \ | |
| 692 | { \ | |
| 693 | srcx = (cliprect->min_x - destx) * dx; \ | |
| 694 | destx = cliprect->min_x; \ | |
| 695 | } \ | |
| 696 | \ | |
| 697 | /* apply right clip */ \ | |
| 698 | if (destendx > cliprect->max_x) \ | |
| 699 | destendx = cliprect->max_x; \ | |
| 700 | \ | |
| 701 | /* compute final pixel in Y and exit if we are entirely clipped */ \ | |
| 702 | destendy = desty + dstheight - 1; \ | |
| 703 | if (desty > cliprect->max_y || destendy < cliprect->min_y) \ | |
| 704 | return; \ | |
| 705 | \ | |
| 706 | /* apply top clip */ \ | |
| 707 | srcy = 0; \ | |
| 708 | if (desty < cliprect->min_y) \ | |
| 709 | { \ | |
| 710 | srcy = (cliprect->min_y - desty) * dy; \ | |
| 711 | desty = cliprect->min_y; \ | |
| 712 | } \ | |
| 713 | \ | |
| 714 | /* apply bottom clip */ \ | |
| 715 | if (destendy > cliprect->max_y) \ | |
| 716 | destendy = cliprect->max_y; \ | |
| 717 | \ | |
| 718 | /* apply X flipping */ \ | |
| 719 | if (flipx) \ | |
| 720 | { \ | |
| 721 | srcx = (dstwidth - 1) * dx - srcx; \ | |
| 722 | dx = -dx; \ | |
| 723 | } \ | |
| 724 | \ | |
| 725 | /* apply Y flipping */ \ | |
| 726 | if (flipy) \ | |
| 727 | { \ | |
| 728 | srcy = (dstheight - 1) * dy - srcy; \ | |
| 729 | dy = -dy; \ | |
| 730 | } \ | |
| 731 | \ | |
| 732 | /* fetch the source data */ \ | |
| 733 | srcdata = gfx_element_get_data(gfx, code); \ | |
| 734 | \ | |
| 735 | /* draw normal */ \ | |
| 736 | if (!(gfx->flags & GFX_ELEMENT_PACKED)) \ | |
| 737 | { \ | |
| 738 | /* compute how many blocks of 4 pixels we have */ \ | |
| 739 | UINT32 numblocks = (destendx + 1 - destx) / 4; \ | |
| 740 | UINT32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ | |
| 741 | \ | |
| 742 | /* iterate over pixels in Y */ \ | |
| 743 | for (cury = desty; cury <= destendy; cury++) \ | |
| 744 | { \ | |
| 745 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ | |
| 746 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, destx); \ | |
| 747 | const UINT8 *srcptr = srcdata + (srcy >> 16) * gfx->line_modulo; \ | |
| 748 | INT32 cursrcx = srcx; \ | |
| 749 | srcy += dy; \ | |
| 750 | \ | |
| 751 | /* iterate over unrolled blocks of 4 */ \ | |
| 752 | for (curx = 0; curx < numblocks; curx++) \ | |
| 753 | { \ | |
| 754 | PIXEL_OP(destptr[0], priptr[0], srcptr[cursrcx >> 16]); \ | |
| 755 | cursrcx += dx; \ | |
| 756 | PIXEL_OP(destptr[1], priptr[1], srcptr[cursrcx >> 16]); \ | |
| 757 | cursrcx += dx; \ | |
| 758 | PIXEL_OP(destptr[2], priptr[2], srcptr[cursrcx >> 16]); \ | |
| 759 | cursrcx += dx; \ | |
| 760 | PIXEL_OP(destptr[3], priptr[3], srcptr[cursrcx >> 16]); \ | |
| 761 | cursrcx += dx; \ | |
| 762 | \ | |
| 763 | destptr += 4; \ | |
| 764 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ | |
| 765 | } \ | |
| 766 | \ | |
| 767 | /* iterate over leftover pixels */ \ | |
| 768 | for (curx = 0; curx < leftovers; curx++) \ | |
| 769 | { \ | |
| 770 | PIXEL_OP(destptr[0], priptr[0], srcptr[cursrcx >> 16]); \ | |
| 771 | cursrcx += dx; \ | |
| 772 | destptr++; \ | |
| 773 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 774 | } \ | |
| 775 | } \ | |
| 776 | } \ | |
| 777 | \ | |
| 778 | /* draw packed */ \ | |
| 779 | else \ | |
| 780 | { \ | |
| 781 | /* iterate over pixels in Y */ \ | |
| 782 | for (cury = desty; cury <= destendy; cury++) \ | |
| 783 | { \ | |
| 784 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ | |
| 785 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, destx); \ | |
| 786 | const UINT8 *srcptr = srcdata + (srcy >> 16) * gfx->line_modulo; \ | |
| 787 | INT32 cursrcx = srcx; \ | |
| 788 | srcy += dy; \ | |
| 789 | \ | |
| 790 | /* iterate over pixels in X */ \ | |
| 791 | for (curx = destx; curx <= destendx; curx++) \ | |
| 792 | { \ | |
| 793 | PIXEL_OP(destptr[0], priptr[0], (srcptr[cursrcx >> 17] >> ((cursrcx >> 14) & 4)) & 15); \ | |
| 794 | cursrcx += dx; \ | |
| 795 | destptr++; \ | |
| 796 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 797 | } \ | |
| 798 | } \ | |
| 799 | } \ | |
| 800 | } while (0); \ | |
| 801 | profiler_mark(PROFILER_END); \ | |
| 802 | } while (0) | |
| 803 | ||
| 804 | ||
| 805 | ||
| 806 | /*************************************************************************** | |
| 807 | BASIC COPYBITMAP CORE | |
| 808 | ***************************************************************************/ | |
| 809 | ||
| 810 | /* | |
| 811 | Assumed input parameters or local variables: | |
| 812 | ||
| 813 | bitmap_t *dest - the bitmap to copy to | |
| 814 | bitmap_t *src - the bitmap to copy from (must be same bpp as dest) | |
| 815 | const rectangle *cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') | |
| 816 | int flipx - non-zero means render right-to-left instead of left-to-right | |
| 817 | int flipy - non-zero means render bottom-to-top instead of top-to-bottom | |
| 818 | INT32 destx - the top-left X coordinate to copy to | |
| 819 | INT32 desty - the top-left Y coordinate to copy to | |
| 820 | bitmap_t *priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) | |
| 821 | */ | |
| 822 | ||
| 823 | #define COPYBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ | |
| 824 | do { \ | |
| 825 | profiler_mark(PROFILER_COPYBITMAP); \ | |
| 826 | do { \ | |
| 827 | const PIXEL_TYPE *srcdata; \ | |
| 828 | UINT32 numblocks, leftovers; \ | |
| 829 | INT32 destendx, destendy; \ | |
| 830 | INT32 srcx, srcy; \ | |
| 831 | INT32 curx, cury; \ | |
| 832 | INT32 dx, dy; \ | |
| 833 | \ | |
| 834 | assert(dest != NULL); \ | |
| 835 | assert(src != NULL); \ | |
| 836 | assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority != NULL); \ | |
| 837 | assert(cliprect == NULL || cliprect->min_x >= 0); \ | |
| 838 | assert(cliprect == NULL || cliprect->max_x < dest->width); \ | |
| 839 | assert(cliprect == NULL || cliprect->min_y >= 0); \ | |
| 840 | assert(cliprect == NULL || cliprect->max_y < dest->height); \ | |
| 841 | \ | |
| 842 | /* NULL clip means use the full bitmap */ \ | |
| 843 | if (cliprect == NULL) \ | |
| 844 | cliprect = &dest->cliprect; \ | |
| 845 | \ | |
| 846 | /* ignore empty/invalid cliprects */ \ | |
| 847 | if (cliprect->min_x > cliprect->max_x || cliprect->min_y > cliprect->max_y) \ | |
| 848 | break; \ | |
| 849 | \ | |
| 850 | /* standard setup; dx counts bytes in X, dy counts pixels in Y */ \ | |
| 851 | dx = 1; \ | |
| 852 | dy = src->rowpixels; \ | |
| 853 | \ | |
| 854 | /* compute final pixel in X and exit if we are entirely clipped */ \ | |
| 855 | destendx = destx + src->width - 1; \ | |
| 856 | if (destx > cliprect->max_x || destendx < cliprect->min_x) \ | |
| 857 | break; \ | |
| 858 | \ | |
| 859 | /* apply left clip */ \ | |
| 860 | srcx = 0; \ | |
| 861 | if (destx < cliprect->min_x) \ | |
| 862 | { \ | |
| 863 | srcx = cliprect->min_x - destx; \ | |
| 864 | destx = cliprect->min_x; \ | |
| 865 | } \ | |
| 866 | \ | |
| 867 | /* apply right clip */ \ | |
| 868 | if (destendx > cliprect->max_x) \ | |
| 869 | destendx = cliprect->max_x; \ | |
| 870 | \ | |
| 871 | /* compute final pixel in Y and exit if we are entirely clipped */ \ | |
| 872 | destendy = desty + src->height - 1; \ | |
| 873 | if (desty > cliprect->max_y || destendy < cliprect->min_y) \ | |
| 874 | break; \ | |
| 875 | \ | |
| 876 | /* apply top clip */ \ | |
| 877 | srcy = 0; \ | |
| 878 | if (desty < cliprect->min_y) \ | |
| 879 | { \ | |
| 880 | srcy = cliprect->min_y - desty; \ | |
| 881 | desty = cliprect->min_y; \ | |
| 882 | } \ | |
| 883 | \ | |
| 884 | /* apply bottom clip */ \ | |
| 885 | if (destendy > cliprect->max_y) \ | |
| 886 | destendy = cliprect->max_y; \ | |
| 887 | \ | |
| 888 | /* apply X flipping */ \ | |
| 889 | if (flipx) \ | |
| 890 | { \ | |
| 891 | srcx = src->width - 1 - srcx; \ | |
| 892 | dx = -dx; \ | |
| 893 | } \ | |
| 894 | \ | |
| 895 | /* apply Y flipping */ \ | |
| 896 | if (flipy) \ | |
| 897 | { \ | |
| 898 | srcy = src->height - 1 - srcy; \ | |
| 899 | dy = -dy; \ | |
| 900 | } \ | |
| 901 | \ | |
| 902 | /* compute how many blocks of 4 pixels we have */ \ | |
| 903 | numblocks = (destendx + 1 - destx) / 4; \ | |
| 904 | leftovers = (destendx + 1 - destx) - 4 * numblocks; \ | |
| 905 | \ | |
| 906 | /* compute the address of the first source pixel of the first row */ \ | |
| 907 | srcdata = BITMAP_ADDR(src, PIXEL_TYPE, srcy, srcx); \ | |
| 908 | \ | |
| 909 | /* non-flipped case */ \ | |
| 910 | if (!flipx) \ | |
| 911 | { \ | |
| 912 | /* iterate over pixels in Y */ \ | |
| 913 | for (cury = desty; cury <= destendy; cury++) \ | |
| 914 | { \ | |
| 915 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ | |
| 916 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, destx); \ | |
| 917 | const PIXEL_TYPE *srcptr = srcdata; \ | |
| 918 | srcdata += dy; \ | |
| 919 | \ | |
| 920 | /* iterate over unrolled blocks of 4 */ \ | |
| 921 | for (curx = 0; curx < numblocks; curx++) \ | |
| 922 | { \ | |
| 923 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 924 | PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ | |
| 925 | PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ | |
| 926 | PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ | |
| 927 | \ | |
| 928 | srcptr += 4; \ | |
| 929 | destptr += 4; \ | |
| 930 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ | |
| 931 | } \ | |
| 932 | \ | |
| 933 | /* iterate over leftover pixels */ \ | |
| 934 | for (curx = 0; curx < leftovers; curx++) \ | |
| 935 | { \ | |
| 936 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 937 | srcptr++; \ | |
| 938 | destptr++; \ | |
| 939 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 940 | } \ | |
| 941 | } \ | |
| 942 | } \ | |
| 943 | \ | |
| 944 | /* flipped case */ \ | |
| 945 | else \ | |
| 946 | { \ | |
| 947 | /* iterate over pixels in Y */ \ | |
| 948 | for (cury = desty; cury <= destendy; cury++) \ | |
| 949 | { \ | |
| 950 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ | |
| 951 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, destx); \ | |
| 952 | const PIXEL_TYPE *srcptr = srcdata; \ | |
| 953 | srcdata += dy; \ | |
| 954 | \ | |
| 955 | /* iterate over unrolled blocks of 4 */ \ | |
| 956 | for (curx = 0; curx < numblocks; curx++) \ | |
| 957 | { \ | |
| 958 | PIXEL_OP(destptr[0], priptr[0], srcptr[ 0]); \ | |
| 959 | PIXEL_OP(destptr[1], priptr[1], srcptr[-1]); \ | |
| 960 | PIXEL_OP(destptr[2], priptr[2], srcptr[-2]); \ | |
| 961 | PIXEL_OP(destptr[3], priptr[3], srcptr[-3]); \ | |
| 962 | \ | |
| 963 | srcptr -= 4; \ | |
| 964 | destptr += 4; \ | |
| 965 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ | |
| 966 | } \ | |
| 967 | \ | |
| 968 | /* iterate over leftover pixels */ \ | |
| 969 | for (curx = 0; curx < leftovers; curx++) \ | |
| 970 | { \ | |
| 971 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 972 | srcptr--; \ | |
| 973 | destptr++; \ | |
| 974 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 975 | } \ | |
| 976 | } \ | |
| 977 | } \ | |
| 978 | } while (0); \ | |
| 979 | profiler_mark(PROFILER_END); \ | |
| 980 | } while (0) | |
| 981 | ||
| 982 | ||
| 983 | ||
| 984 | /*************************************************************************** | |
| 985 | BASIC COPYROZBITMAP CORE | |
| 986 | ***************************************************************************/ | |
| 987 | ||
| 988 | /* | |
| 989 | Assumed input parameters or local variables: | |
| 990 | ||
| 991 | bitmap_t *dest - the bitmap to copy to | |
| 992 | bitmap_t *src - the bitmap to copy from (must be same bpp as dest) | |
| 993 | const rectangle *cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') | |
| 994 | INT32 destx - the 16.16 source X position at destination pixel (0,0) | |
| 995 | INT32 desty - the 16.16 source Y position at destination pixel (0,0) | |
| 996 | INT32 incxx - the 16.16 amount to increment in source X for each destination X pixel | |
| 997 | INT32 incyx - the 16.16 amount to increment in source Y for each destination X pixel | |
| 998 | INT32 incxy - the 16.16 amount to increment in source X for each destination Y pixel | |
| 999 | INT32 incyy - the 16.16 amount to increment in source Y for each destination Y pixel | |
| 1000 | int wraparound - non-zero means wrap when hitting the edges of the source | |
| 1001 | bitmap_t *priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) | |
| 1002 | */ | |
| 1003 | ||
| 1004 | #define COPYROZBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ | |
| 1005 | do { \ | |
| 1006 | UINT32 srcfixwidth, srcfixheight; \ | |
| 1007 | UINT32 numblocks, leftovers; \ | |
| 1008 | INT32 curx, cury; \ | |
| 1009 | \ | |
| 1010 | profiler_mark(PROFILER_COPYBITMAP); \ | |
| 1011 | \ | |
| 1012 | assert(dest != NULL); \ | |
| 1013 | assert(src != NULL); \ | |
| 1014 | assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority != NULL); \ | |
| 1015 | assert(cliprect == NULL || cliprect->min_x >= 0); \ | |
| 1016 | assert(cliprect == NULL || cliprect->max_x < dest->width); \ | |
| 1017 | assert(cliprect == NULL || cliprect->min_y >= 0); \ | |
| 1018 | assert(cliprect == NULL || cliprect->max_y < dest->height); \ | |
| 1019 | assert(!wraparound || (src->width & (src->width - 1)) == 0); \ | |
| 1020 | assert(!wraparound || (src->height & (src->height - 1)) == 0); \ | |
| 1021 | \ | |
| 1022 | /* NULL clip means use the full bitmap */ \ | |
| 1023 | if (cliprect == NULL) \ | |
| 1024 | cliprect = &dest->cliprect; \ | |
| 1025 | \ | |
| 1026 | /* ignore empty/invalid cliprects */ \ | |
| 1027 | if (cliprect->min_x > cliprect->max_x || cliprect->min_y > cliprect->max_y) \ | |
| 1028 | break; \ | |
| 1029 | \ | |
| 1030 | /* compute fixed-point 16.16 size of the source bitmap */ \ | |
| 1031 | srcfixwidth = src->width << 16; \ | |
| 1032 | srcfixheight = src->height << 16; \ | |
| 1033 | \ | |
| 1034 | /* advance the starting coordinates to the top-left of the cliprect */ \ | |
| 1035 | startx += cliprect->min_x * incxx + cliprect->min_y * incyx; \ | |
| 1036 | starty += cliprect->min_x * incxy + cliprect->min_y * incyy; \ | |
| 1037 | \ | |
| 1038 | /* compute how many blocks of 4 pixels we have */ \ | |
| 1039 | numblocks = (cliprect->max_x + 1 - cliprect->min_x) / 4; \ | |
| 1040 | leftovers = (cliprect->max_x + 1 - cliprect->min_x) - 4 * numblocks; \ | |
| 1041 | \ | |
| 1042 | /* if incxy and incyx are 0, then we aren't rotating, just zooming */ \ | |
| 1043 | if (incxy == 0 && incyx == 0) \ | |
| 1044 | { \ | |
| 1045 | /* zoom-only, non-wraparound case */ \ | |
| 1046 | if (!wraparound) \ | |
| 1047 | { \ | |
| 1048 | /* iterate over pixels in Y */ \ | |
| 1049 | for (cury = cliprect->min_y; cury <= cliprect->max_y; cury++) \ | |
| 1050 | { \ | |
| 1051 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect->min_x); \ | |
| 1052 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, cliprect->min_x); \ | |
| 1053 | const PIXEL_TYPE *srcptr; \ | |
| 1054 | INT32 srcx = startx; \ | |
| 1055 | INT32 srcy = starty; \ | |
| 1056 | \ | |
| 1057 | starty += incyy; \ | |
| 1058 | \ | |
| 1059 | /* check srcy for the whole row at once */ \ | |
| 1060 | if ((UINT32)srcy < srcfixheight) \ | |
| 1061 | { \ | |
| 1062 | srcptr = BITMAP_ADDR(src, PIXEL_TYPE, srcy >> 16, 0); \ | |
| 1063 | \ | |
| 1064 | /* iterate over unrolled blocks of 4 */ \ | |
| 1065 | for (curx = 0; curx < numblocks; curx++) \ | |
| 1066 | { \ | |
| 1067 | if ((UINT32)srcx < srcfixwidth) \ | |
| 1068 | PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ | |
| 1069 | srcx += incxx; \ | |
| 1070 | \ | |
| 1071 | if ((UINT32)srcx < srcfixwidth) \ | |
| 1072 | PIXEL_OP(destptr[1], priptr[1], srcptr[srcx >> 16]); \ | |
| 1073 | srcx += incxx; \ | |
| 1074 | \ | |
| 1075 | if ((UINT32)srcx < srcfixwidth) \ | |
| 1076 | PIXEL_OP(destptr[2], priptr[2], srcptr[srcx >> 16]); \ | |
| 1077 | srcx += incxx; \ | |
| 1078 | \ | |
| 1079 | if ((UINT32)srcx < srcfixwidth) \ | |
| 1080 | PIXEL_OP(destptr[3], priptr[3], srcptr[srcx >> 16]); \ | |
| 1081 | srcx += incxx; \ | |
| 1082 | \ | |
| 1083 | destptr += 4; \ | |
| 1084 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ | |
| 1085 | } \ | |
| 1086 | \ | |
| 1087 | /* iterate over leftover pixels */ \ | |
| 1088 | for (curx = 0; curx < leftovers; curx++) \ | |
| 1089 | { \ | |
| 1090 | if ((UINT32)srcx < srcfixwidth) \ | |
| 1091 | PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ | |
| 1092 | srcx += incxx; \ | |
| 1093 | destptr++; \ | |
| 1094 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 1095 | } \ | |
| 1096 | } \ | |
| 1097 | } \ | |
| 1098 | } \ | |
| 1099 | \ | |
| 1100 | /* zoom-only, wraparound case */ \ | |
| 1101 | else \ | |
| 1102 | { \ | |
| 1103 | /* convert srcfixwidth/height into a mask and apply */ \ | |
| 1104 | srcfixwidth--; \ | |
| 1105 | srcfixheight--; \ | |
| 1106 | startx &= srcfixwidth; \ | |
| 1107 | starty &= srcfixheight; \ | |
| 1108 | \ | |
| 1109 | /* iterate over pixels in Y */ \ | |
| 1110 | for (cury = cliprect->min_y; cury <= cliprect->max_y; cury++) \ | |
| 1111 | { \ | |
| 1112 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect->min_x); \ | |
| 1113 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, cliprect->min_x); \ | |
| 1114 | const PIXEL_TYPE *srcptr = BITMAP_ADDR(src, PIXEL_TYPE, starty >> 16, 0); \ | |
| 1115 | INT32 srcx = startx; \ | |
| 1116 | \ | |
| 1117 | starty = (starty + incyy) & srcfixheight; \ | |
| 1118 | \ | |
| 1119 | /* iterate over unrolled blocks of 4 */ \ | |
| 1120 | for (curx = 0; curx < numblocks; curx++) \ | |
| 1121 | { \ | |
| 1122 | PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ | |
| 1123 | srcx = (srcx + incxx) & srcfixwidth; \ | |
| 1124 | \ | |
| 1125 | PIXEL_OP(destptr[1], priptr[1], srcptr[srcx >> 16]); \ | |
| 1126 | srcx = (srcx + incxx) & srcfixwidth; \ | |
| 1127 | \ | |
| 1128 | PIXEL_OP(destptr[2], priptr[2], srcptr[srcx >> 16]); \ | |
| 1129 | srcx = (srcx + incxx) & srcfixwidth; \ | |
| 1130 | \ | |
| 1131 | PIXEL_OP(destptr[3], priptr[3], srcptr[srcx >> 16]); \ | |
| 1132 | srcx = (srcx + incxx) & srcfixwidth; \ | |
| 1133 | \ | |
| 1134 | destptr += 4; \ | |
| 1135 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ | |
| 1136 | } \ | |
| 1137 | \ | |
| 1138 | /* iterate over leftover pixels */ \ | |
| 1139 | for (curx = 0; curx < leftovers; curx++) \ | |
| 1140 | { \ | |
| 1141 | PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ | |
| 1142 | srcx = (srcx + incxx) & srcfixwidth; \ | |
| 1143 | destptr++; \ | |
| 1144 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 1145 | } \ | |
| 1146 | } \ | |
| 1147 | } \ | |
| 1148 | } \ | |
| 1149 | \ | |
| 1150 | /* full rotation case */ \ | |
| 1151 | else \ | |
| 1152 | { \ | |
| 1153 | /* full rotation, non-wraparound case */ \ | |
| 1154 | if (!wraparound) \ | |
| 1155 | { \ | |
| 1156 | /* iterate over pixels in Y */ \ | |
| 1157 | for (cury = cliprect->min_y; cury <= cliprect->max_y; cury++) \ | |
| 1158 | { \ | |
| 1159 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect->min_x); \ | |
| 1160 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, cliprect->min_x); \ | |
| 1161 | const PIXEL_TYPE *srcptr; \ | |
| 1162 | INT32 srcx = startx; \ | |
| 1163 | INT32 srcy = starty; \ | |
| 1164 | \ | |
| 1165 | startx += incyx; \ | |
| 1166 | starty += incyy; \ | |
| 1167 | \ | |
| 1168 | /* iterate over unrolled blocks of 4 */ \ | |
| 1169 | for (curx = 0; curx < numblocks; curx++) \ | |
| 1170 | { \ | |
| 1171 | if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ | |
| 1172 | { \ | |
| 1173 | srcptr = BITMAP_ADDR(src, PIXEL_TYPE, srcy >> 16, srcx >> 16); \ | |
| 1174 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 1175 | } \ | |
| 1176 | srcx += incxx; \ | |
| 1177 | srcy += incxy; \ | |
| 1178 | \ | |
| 1179 | if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ | |
| 1180 | { \ | |
| 1181 | srcptr = BITMAP_ADDR(src, PIXEL_TYPE, srcy >> 16, srcx >> 16); \ | |
| 1182 | PIXEL_OP(destptr[1], priptr[1], srcptr[0]); \ | |
| 1183 | } \ | |
| 1184 | srcx += incxx; \ | |
| 1185 | srcy += incxy; \ | |
| 1186 | \ | |
| 1187 | if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ | |
| 1188 | { \ | |
| 1189 | srcptr = BITMAP_ADDR(src, PIXEL_TYPE, srcy >> 16, srcx >> 16); \ | |
| 1190 | PIXEL_OP(destptr[2], priptr[2], srcptr[0]); \ | |
| 1191 | } \ | |
| 1192 | srcx += incxx; \ | |
| 1193 | srcy += incxy; \ | |
| 1194 | \ | |
| 1195 | if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ | |
| 1196 | { \ | |
| 1197 | srcptr = BITMAP_ADDR(src, PIXEL_TYPE, srcy >> 16, srcx >> 16); \ | |
| 1198 | PIXEL_OP(destptr[3], priptr[3], srcptr[0]); \ | |
| 1199 | } \ | |
| 1200 | srcx += incxx; \ | |
| 1201 | srcy += incxy; \ | |
| 1202 | \ | |
| 1203 | destptr += 4; \ | |
| 1204 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ | |
| 1205 | } \ | |
| 1206 | \ | |
| 1207 | /* iterate over leftover pixels */ \ | |
| 1208 | for (curx = 0; curx < leftovers; curx++) \ | |
| 1209 | { \ | |
| 1210 | if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ | |
| 1211 | { \ | |
| 1212 | srcptr = BITMAP_ADDR(src, PIXEL_TYPE, srcy >> 16, srcx >> 16); \ | |
| 1213 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 1214 | } \ | |
| 1215 | srcx += incxx; \ | |
| 1216 | srcy += incxy; \ | |
| 1217 | destptr++; \ | |
| 1218 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 1219 | } \ | |
| 1220 | } \ | |
| 1221 | } \ | |
| 1222 | \ | |
| 1223 | /* zoom-only, wraparound case */ \ | |
| 1224 | else \ | |
| 1225 | { \ | |
| 1226 | /* convert srcfixwidth/height into a mask and apply */ \ | |
| 1227 | srcfixwidth--; \ | |
| 1228 | srcfixheight--; \ | |
| 1229 | startx &= srcfixwidth; \ | |
| 1230 | starty &= srcfixheight; \ | |
| 1231 | \ | |
| 1232 | /* iterate over pixels in Y */ \ | |
| 1233 | for (cury = cliprect->min_y; cury <= cliprect->max_y; cury++) \ | |
| 1234 | { \ | |
| 1235 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect->min_x); \ | |
| 1236 | PIXEL_TYPE *destptr = BITMAP_ADDR(dest, PIXEL_TYPE, cury, cliprect->min_x); \ | |
| 1237 | const PIXEL_TYPE *srcptr; \ | |
| 1238 | INT32 srcx = startx; \ | |
| 1239 | INT32 srcy = starty; \ | |
| 1240 | \ | |
| 1241 | startx = (startx + incyx) & srcfixwidth; \ | |
| 1242 | starty = (starty + incyy) & srcfixheight; \ | |
| 1243 | \ | |
| 1244 | /* iterate over unrolled blocks of 4 */ \ | |
| 1245 | for (curx = 0; curx < numblocks; curx++) \ | |
| 1246 | { \ | |
| 1247 | srcptr = BITMAP_ADDR(src, PIXEL_TYPE, srcy >> 16, srcx >> 16); \ | |
| 1248 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 1249 | srcx = (srcx + incxx) & srcfixwidth; \ | |
| 1250 | srcy = (srcy + incxy) & srcfixheight; \ | |
| 1251 | \ | |
| 1252 | srcptr = BITMAP_ADDR(src, PIXEL_TYPE, srcy >> 16, srcx >> 16); \ | |
| 1253 | PIXEL_OP(destptr[1], priptr[1], srcptr[0]); \ | |
| 1254 | srcx = (srcx + incxx) & srcfixwidth; \ | |
| 1255 | srcy = (srcy + incxy) & srcfixheight; \ | |
| 1256 | \ | |
| 1257 | srcptr = BITMAP_ADDR(src, PIXEL_TYPE, srcy >> 16, srcx >> 16); \ | |
| 1258 | PIXEL_OP(destptr[2], priptr[2], srcptr[0]); \ | |
| 1259 | srcx = (srcx + incxx) & srcfixwidth; \ | |
| 1260 | srcy = (srcy + incxy) & srcfixheight; \ | |
| 1261 | \ | |
| 1262 | srcptr = BITMAP_ADDR(src, PIXEL_TYPE, srcy >> 16, srcx >> 16); \ | |
| 1263 | PIXEL_OP(destptr[3], priptr[3], srcptr[0]); \ | |
| 1264 | srcx = (srcx + incxx) & srcfixwidth; \ | |
| 1265 | srcy = (srcy + incxy) & srcfixheight; \ | |
| 1266 | \ | |
| 1267 | destptr += 4; \ | |
| 1268 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ | |
| 1269 | } \ | |
| 1270 | \ | |
| 1271 | /* iterate over leftover pixels */ \ | |
| 1272 | for (curx = 0; curx < leftovers; curx++) \ | |
| 1273 | { \ | |
| 1274 | srcptr = BITMAP_ADDR(src, PIXEL_TYPE, srcy >> 16, srcx >> 16); \ | |
| 1275 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 1276 | srcx = (srcx + incxx) & srcfixwidth; \ | |
| 1277 | srcy = (srcy + incxy) & srcfixheight; \ | |
| 1278 | destptr++; \ | |
| 1279 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 1280 | } \ | |
| 1281 | } \ | |
| 1282 | } \ | |
| 1283 | } \ | |
| 1284 | profiler_mark(PROFILER_END); \ | |
| 1285 | } while (0) | |
| 1286 | ||
| 1287 | ||
| 1288 | ||
| 1289 | /*************************************************************************** | |
| 1290 | BASIC DRAWSCANLINE CORE | |
| 1291 | ***************************************************************************/ | |
| 1292 | ||
| 1293 | /* | |
| 1294 | Assumed input parameters or local variables: | |
| 1295 | ||
| 1296 | bitmap_t *bitmap - the bitmap to copy to | |
| 1297 | INT32 destx - the X coordinate to copy to | |
| 1298 | INT32 desty - the Y coordinate to copy to | |
| 1299 | INT32 length - the total number of pixels to copy | |
| 1300 | const UINTx *srcptr - pointer to memory containing the source pixels | |
| 1301 | bitmap_t *priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) | |
| 1302 | */ | |
| 1303 | ||
| 1304 | #define DRAWSCANLINE_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ | |
| 1305 | do { \ | |
| 1306 | assert(bitmap != NULL); \ | |
| 1307 | assert(destx >= 0); \ | |
| 1308 | assert(destx + length <= bitmap->width); \ | |
| 1309 | assert(desty >= 0); \ | |
| 1310 | assert(desty < bitmap->height); \ | |
| 1311 | assert(srcptr != NULL); \ | |
| 1312 | assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority != NULL); \ | |
| 1313 | \ | |
| 1314 | { \ | |
| 1315 | PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, desty, destx); \ | |
| 1316 | PIXEL_TYPE *destptr = BITMAP_ADDR(bitmap, PIXEL_TYPE, desty, destx); \ | |
| 1317 | \ | |
| 1318 | /* iterate over unrolled blocks of 4 */ \ | |
| 1319 | while (length >= 4) \ | |
| 1320 | { \ | |
| 1321 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 1322 | PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ | |
| 1323 | PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ | |
| 1324 | PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ | |
| 1325 | \ | |
| 1326 | length -= 4; \ | |
| 1327 | srcptr += 4; \ | |
| 1328 | destptr += 4; \ | |
| 1329 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ | |
| 1330 | } \ | |
| 1331 | \ | |
| 1332 | /* iterate over leftover pixels */ \ | |
| 1333 | while (length-- > 0) \ | |
| 1334 | { \ | |
| 1335 | PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ | |
| 1336 | srcptr++; \ | |
| 1337 | destptr++; \ | |
| 1338 | PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ | |
| 1339 | } \ | |
| 1340 | } \ | |
| 1341 | } while (0) | |
| 1342 | ||
| 1343 | ||
| 1344 | ||
| 1345 | /*************************************************************************** | |
| 1346 | BASIC EXTRACTSCANLINE CORE | |
| 1347 | ***************************************************************************/ | |
| 1348 | ||
| 1349 | /* | |
| 1350 | Assumed input parameters: | |
| 1351 | ||
| 1352 | bitmap_t *bitmap - the bitmap to extract from | |
| 1353 | INT32 srcx - the X coordinate to begin extraction | |
| 1354 | INT32 srcy - the Y coordinate to begin extraction | |
| 1355 | INT32 length - the total number of pixels to extract | |
| 1356 | UINTx *destptr - pointer to memory to receive the extracted pixels | |
| 1357 | */ | |
| 1358 | ||
| 1359 | #define EXTRACTSCANLINE_CORE(PIXEL_TYPE) \ | |
| 1360 | do { \ | |
| 1361 | assert(bitmap != NULL); \ | |
| 1362 | assert(srcx >= 0); \ | |
| 1363 | assert(srcx + length <= bitmap->width); \ | |
| 1364 | assert(srcy >= 0); \ | |
| 1365 | assert(srcy < bitmap->height); \ | |
| 1366 | assert(destptr != NULL); \ | |
| 1367 | \ | |
| 1368 | { \ | |
| 1369 | const PIXEL_TYPE *srcptr = BITMAP_ADDR(bitmap, PIXEL_TYPE, srcy, srcx); \ | |
| 1370 | \ | |
| 1371 | /* iterate over unrolled blocks of 4 */ \ | |
| 1372 | while (length >= 4) \ | |
| 1373 | { \ | |
| 1374 | destptr[0] = srcptr[0]; \ | |
| 1375 | destptr[1] = srcptr[1]; \ | |
| 1376 | destptr[2] = srcptr[2]; \ | |
| 1377 | destptr[3] = srcptr[3]; \ | |
| 1378 | length -= 4; \ | |
| 1379 | srcptr += 4; \ | |
| 1380 | destptr += 4; \ | |
| 1381 | } \ | |
| 1382 | \ | |
| 1383 | /* iterate over leftover pixels */ \ | |
| 1384 | while (length > 0) \ | |
| 1385 | { \ | |
| 1386 | destptr[0] = srcptr[0]; \ | |
| 1387 | length--; \ | |
| 1388 | srcptr++; \ | |
| 1389 | destptr++; \ | |
| 1390 | } \ | |
| 1391 | } \ | |
| 1392 | } while (0) | |
| 1393 | ||
| 1394 | ||
| 1395 | #endif /* __DRAWGFXM_H__ */ |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | #include "devintrf.h" |
| 18 | 18 | #include "cpuexec.h" |
| 19 | #include "sndintrf.h" | |
| 19 | 20 | #include <stddef.h> |
| 20 | 21 | |
| 21 | 22 | |
| r4135 | r4136 | |
| 132 | 133 | |
| 133 | 134 | palette_init_func init_palette; /* one-time palette init callback */ |
| 134 | 135 | video_start_func video_start; /* one-time video start callback */ |
| 135 | | |
| 136 | vi | |
| 136 | 137 | video_eof_func video_eof; /* end-of-frame video callback */ |
| 137 | 138 | video_update_func video_update; /* video update callback */ |
| 138 | 139 | |
| r4135 | r4136 | |
| 172 | 173 | palette_init_func palette_init; |
| 173 | 174 | video_eof_func video_eof; |
| 174 | 175 | video_update_func video_update; |
| 176 | sound_type sndtype; | |
| 175 | 177 | }; |
| 176 | 178 | |
| 177 | 179 | |
| r4135 | r4136 | |
| 375 | 377 | |
| 376 | 378 | /* add/remove/replace sounds */ |
| 377 | 379 | #define MDRV_SOUND_ADD(_tag, _type, _clock) \ |
| 378 | TOKEN_UINT64_PACK3(MCONFIG_TOKEN_SOUND_ADD, 8, SOUND_##_type, 24, _clock, 32), \ | |
| 380 | TOKEN_UINT64_PACK2(MCONFIG_TOKEN_SOUND_ADD, 8, _clock, 32), \ | |
| 381 | TOKEN_PTR(sndtype, SOUND_##_type), \ | |
| 379 | 382 | TOKEN_STRING(_tag), |
| 380 | 383 | |
| 381 | 384 | #define MDRV_SOUND_REMOVE(_tag) \ |
| r4135 | r4136 | |
| 391 | 394 | TOKEN_PTR(voidptr, &(_config)), |
| 392 | 395 | |
| 393 | 396 | #define MDRV_SOUND_REPLACE(_tag, _type, _clock) \ |
| 394 | TOKEN_UINT64_PACK3(MCONFIG_TOKEN_SOUND_REPLACE, 8, SOUND_##_type, 24, _clock, 32), \ | |
| 397 | TOKEN_UINT64_PACK2(MCONFIG_TOKEN_SOUND_REPLACE, 8, _clock, 32), \ | |
| 398 | TOKEN_PTR(sndtype, SOUND_##_type), \ | |
| 395 | 399 | TOKEN_STRING(_tag), |
| 396 | 400 | |
| 397 | 401 | #define MDRV_SOUND_ROUTE_EX(_output, _target, _gain, _input) \ |
| r4135 | r4136 | |
|---|---|---|
| 74 | 74 | |
| 75 | 75 | 1) declare MDRV_VIDEO_ATTRIBUTES( ... VIDEO_HAS_SHADOWS | VIDEO_HAS_HIGHLIGHTS ... ) |
| 76 | 76 | |
| 77 | 2) | |
| 77 | 2) make | |
| 78 | 78 | |
| 79 | 79 | 3) (optional) set shadow darkness or highlight brightness by |
| 80 | 80 | palette_set_shadow_factor(0.0-1.0) or |
| r4135 | r4136 | |
| 84 | 84 | palette_set_shadow_mode(0) to arm shadows or |
| 85 | 85 | palette_set_shadow_mode(1) to arm highlights |
| 86 | 86 | |
| 87 | 5) call drawgfx with the TRANSPARENCY_PEN_TABLE flag | |
| 88 | drawgfx( ..., cliprect, TRANSPARENCY_PEN_TABLE, transparent_color ) | |
| 87 | 5) call drawgfx_transtable | |
| 88 | drawgfx_transtable( ..., pentable ) | |
| 89 | 89 | |
| 90 | 90 | ******************************************************************************/ |
| 91 | 91 |
| r4135 | r4136 | |
|---|---|---|
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | /*------------------------------------------------- |
| 233 | palette_get_max_index - return the maximum | |
| 234 | allowed index (i.e., length of arrays returned | |
| 235 | by palette_entry_list*) | |
| 236 | -------------------------------------------------*/ | |
| 237 | ||
| 238 | int palette_get_max_index(palette_t *palette) | |
| 239 | { | |
| 240 | return palette->numcolors * palette->numgroups + 2; | |
| 241 | } | |
| 242 | ||
| 243 | ||
| 244 | /*------------------------------------------------- | |
| 233 | 245 | palette_get_black_entry - return the index of |
| 234 | 246 | the black entry |
| 235 | 247 | -------------------------------------------------*/ |
| r4135 | r4136 | |
|---|---|---|
| 81 | 81 | /* return the number of groups managed by the palette */ |
| 82 | 82 | int palette_get_num_groups(palette_t *palette); |
| 83 | 83 | |
| 84 | /* return the maximum allowed index (i.e., length of arrays returned by palette_entry_list*) */ | |
| 85 | int palette_get_max_index(palette_t *palette); | |
| 86 | ||
| 84 | 87 | /* return the index of the black entry */ |
| 85 | 88 | UINT32 palette_get_black_entry(palette_t *palette); |
| 86 | 89 |
| r4135 | r4136 | |
|---|---|---|
| 72 | 72 | bitmap->bpp = bpp; |
| 73 | 73 | bitmap->rowpixels = rowpixels; |
| 74 | 74 | bitmap->base = (UINT8 *)bitmap->alloc + (rowpixels * yslop + xslop) * (bpp / 8); |
| 75 | bitmap->cliprect.min_x = 0; | |
| 76 | bitmap->cliprect.max_x = width - 1; | |
| 77 | bitmap->cliprect.min_y = 0; | |
| 78 | bitmap->cliprect.max_y = height - 1; | |
| 75 | 79 | |
| 76 | 80 | return bitmap; |
| 77 | 81 | } |
| r4135 | r4136 | |
| 104 | 108 | bitmap->bpp = bpp; |
| 105 | 109 | bitmap->rowpixels = rowpixels; |
| 106 | 110 | bitmap->base = base; |
| 111 | bitmap->cliprect.min_x = 0; | |
| 112 | bitmap->cliprect.max_x = width - 1; | |
| 113 | bitmap->cliprect.min_y = 0; | |
| 114 | bitmap->cliprect.max_y = height - 1; | |
| 107 | 115 | |
| 108 | 116 | return bitmap; |
| 109 | 117 | } |
| r4135 | r4136 | |
| 164 | 172 | |
| 165 | 173 | void bitmap_fill(bitmap_t *dest, const rectangle *cliprect, UINT32 color) |
| 166 | 174 | { |
| 167 | rectangle fill; | |
| 175 | rectangle fill = dest->cliprect; | |
| 168 | 176 | int x, y; |
| 169 | 177 | |
| 170 | /* default to the whole bitmap */ | |
| 171 | fill.min_x = fill.min_y = 0; | |
| 172 | fill.max_x = dest->width - 1; | |
| 173 | fill.max_y = dest->height - 1; | |
| 174 | ||
| 175 | 178 | /* if we have a cliprect, intersect with that */ |
| 176 | 179 | if (cliprect != NULL) |
| 177 | 180 | sect_rect(&fill, cliprect); |
| r4135 | r4136 | |
|---|---|---|
| 61 | 61 | bitmap_format format; /* format of the bitmap */ |
| 62 | 62 | int bpp; /* bits per pixel */ |
| 63 | 63 | palette_t * palette; /* optional palette */ |
| 64 | rectangle cliprect; /* a clipping rectangle covering the full bitmap */ | |
| 64 | 65 | }; |
| 65 | 66 | |
| 66 | 67 |
| r4135 | r4136 | |
|---|---|---|
| 378 | 378 | for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) |
| 379 | 379 | { |
| 380 | 380 | extract_scanline8(typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf); |
| 381 | draw_scanline8(typewriter_bitmap, 0, y, typewriter_window_width, buf, machine->pens | |
| 381 | draw_scanline8(typewriter_bitmap, 0, y, typewriter_window_width, buf, machine->pens | |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | bitmap_fill(typewriter_bitmap, &typewriter_scroll_clear_window, pen_typewriter_bg); |
| r4135 | r4136 | |
|---|---|---|
| 77 | 77 | int chr = 0x80 + offset / 16; |
| 78 | 78 | pcgram[0x0800+offset] = data; |
| 79 | 79 | /* decode character graphics again */ |
| 80 | | |
| 80 | gfx_el | |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| r4135 | r4136 | |
| 90 | 90 | int chr = 0x80 + offset / 16; |
| 91 | 91 | pcgram[0x0800+offset] = data; |
| 92 | 92 | /* decode character graphics again */ |
| 93 | | |
| 93 | gfx_el | |
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | else |
| r4135 | r4136 | |
| 352 | 352 | addr = 0x17000+((data & 32) << 6); |
| 353 | 353 | memcpy(pcgram, memory_region(space->machine, "main")+addr, 0x800); |
| 354 | 354 | for (i = 0; i < 128; i++) |
| 355 | | |
| 355 | gfx_el | |
| 356 | 356 | break; |
| 357 | 357 | case 13: |
| 358 | 358 | crt.screen_address_lo = data; |
| r4135 | r4136 | |
| 475 | 475 | for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++) |
| 476 | 476 | pcgram[0x1000+i] = pcgram[(videoram[cursor]<<4) + i] ^ mc6845_cursor[i]; |
| 477 | 477 | |
| 478 | | |
| 478 | gfx_el | |
| 479 | 479 | |
| 480 | 480 | for( i = 0; i < bytes; i++ ) |
| 481 | 481 | { |
| r4135 | r4136 | |
| 517 | 517 | for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++) |
| 518 | 518 | pcgram[0x1000+i] = pcgram[(videoram[cursor]<<4) + i] ^ mc6845_cursor[i]; |
| 519 | 519 | |
| 520 | | |
| 520 | gfx_el | |
| 521 | 521 | |
| 522 | 522 | for( i = 0; i < bytes; i++ ) |
| 523 | 523 | { |
| r4135 | r4136 | |
|---|---|---|
| 989 | 989 | ypos = thom_bheight /* * scale */; |
| 990 | 990 | for ( y = 0; y < 200; v += xwidth, y++ , ypos ++ /* += scale */ ) |
| 991 | 991 | { |
| 992 | draw_scanline16( bitmap, xbleft, ypos, xwidth, v, NULL | |
| 992 | draw_scanline16( bitmap, xbleft, ypos, xwidth, v, NULL | |
| 993 | 993 | #if 0 |
| 994 | 994 | if ( thom_hires ) |
| 995 | draw_scanline16( bitmap, xbleft, ypos+1, xwidth, v, NULL | |
| 995 | draw_scanline16( bitmap, xbleft, ypos+1, xwidth, v, NULL | |
| 996 | 996 | #endif |
| 997 | 997 | } |
| 998 | 998 |
| r4135 | r4136 | |
|---|---|---|
| 958 | 958 | break; |
| 959 | 959 | |
| 960 | 960 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 961 | machine->gfx[gfx_index] = allocgfx(machine, &x68k_pcg_8); | |
| 962 | decodegfx(machine->gfx[gfx_index] , memory_region(machine, "user1"), 0, 256); | |
| 963 | machine->gfx[gfx_index]->total_colors = 32; | |
| 961 | machine->gfx[gfx_index] = gfx_element_alloc(machine, &x68k_pcg_8, memory_region(machine, "user1"), 32, 0); | |
| 964 | 962 | |
| 965 | 963 | gfx_index++; |
| 966 | 964 | |
| 967 | machine->gfx[gfx_index] = allocgfx(machine, &x68k_pcg_16); | |
| 968 | decodegfx(machine->gfx[gfx_index] , memory_region(machine, "user1"), 0, 256); | |
| 965 | machine->gfx[gfx_index] = gfx_element_alloc(machine, &x68k_pcg_16, memory_region(machine, "user1"), 32, 0); | |
| 969 | 966 | machine->gfx[gfx_index]->total_colors = 32; |
| 970 | 967 | |
| 971 | 968 | /* Tilemaps */ |
| r4135 | r4136 | |
| 1024 | 1021 | { |
| 1025 | 1022 | if(sys.video.tile16_dirty[x] != 0) |
| 1026 | 1023 | { |
| 1027 | | |
| 1024 | gfx_el | |
| 1028 | 1025 | sys.video.tile16_dirty[x] = 0; |
| 1029 | 1026 | } |
| 1030 | 1027 | if(sys.video.tile8_dirty[x] != 0) |
| 1031 | 1028 | { |
| 1032 | | |
| 1029 | gfx_el | |
| 1033 | 1030 | sys.video.tile8_dirty[x] = 0; |
| 1034 | 1031 | } |
| 1035 | 1032 | } |
| r4135 | r4136 | |
|---|---|---|
| 118 | 118 | |
| 119 | 119 | for (count=0;count<32*8;count++) |
| 120 | 120 | { |
| 121 | decodechar( screen->machine->gfx[0],count,spectrum_characterram); | |
| 122 | decodechar( screen->machine->gfx[1],count,&spectrum_characterram[0x800]); | |
| 123 | decodechar( screen->machine->gfx[2],count,&spectrum_characterram[0x1000]); | |
| 121 | gfx_element_mark_dirty( screen->machine->gfx[0],count); | |
| 122 | gfx_element_mark_dirty( screen->machine->gfx[1],count); | |
| 123 | gfx_element_mark_dirty( screen->machine->gfx[2],count); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | for (count=0;count<32*8;count++) |
| r4135 | r4136 | |
|---|---|---|
| 363 | 363 | for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) |
| 364 | 364 | { |
| 365 | 365 | extract_scanline8(typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf); |
| 366 | draw_scanline8(typewriter_bitmap, 0, y, typewriter_window_width, buf, machine->pens | |
| 366 | draw_scanline8(typewriter_bitmap, 0, y, typewriter_window_width, buf, machine->pens | |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | bitmap_fill(typewriter_bitmap, &typewriter_scroll_clear_window, pen_typewriter_bg); |
| r4135 | r4136 | |
|---|---|---|
| 565 | 565 | { |
| 566 | 566 | if (full_refresh||vdc.fontdirty[i]) |
| 567 | 567 | { |
| 568 | | |
| 568 | gfx_el | |
| 569 | 569 | vdc.fontdirty[i]=0; |
| 570 | 570 | } |
| 571 | 571 | } |
| r4135 | r4136 | |
|---|---|---|
| 940 | 940 | xloc += rect.min_x; |
| 941 | 941 | yloc = amstrad_plus_asic_ram[sprptr+2] + (amstrad_plus_asic_ram[sprptr+3] << 8); |
| 942 | 942 | yloc += rect.min_y; |
| 943 | decodechar(machine->gfx[0],spr,amstrad_plus_asic_ram); | |
| 944 | 943 | drawgfxzoom(scr_bitmap,machine->gfx[0],spr,0,0,0,xloc,yloc,&rect, |
| 945 | 944 | TRANSPARENCY_PEN,0,xmag,ymag); |
| 946 | 945 | } |
| r4135 | r4136 | |
|---|---|---|
| 116 | 116 | |
| 117 | 117 | /* allocate video memory */ |
| 118 | 118 | avigo_video_memory = auto_malloc(((AVIGO_SCREEN_WIDTH>>3)*AVIGO_SCREEN_HEIGHT)); |
| 119 | machine->gfx[0] = stylus_pointer = alloc | |
| 119 | machine->gfx[0] = stylus_pointer = gfx_element_alloc | |
| 120 | 120 | |
| 121 | decodegfx(stylus_pointer, pointermask, 0, 1); | |
| 122 | 121 | stylus_pointer->total_colors = 3; |
| 123 | 122 | } |
| 124 | 123 |
| r4135 | r4136 | |
|---|---|---|
| 951 | 951 | return val; |
| 952 | 952 | } |
| 953 | 953 | |
| 954 | static void ted7360_video_stop(running_machine *machine) | |
| 955 | { | |
| 956 | freegfx(cursorelement); | |
| 957 | } | |
| 958 | ||
| 959 | 954 | VIDEO_START( ted7360 ) |
| 960 | 955 | { |
| 961 | 956 | const device_config *screen = video_screen_first(machine->config); |
| 962 | 957 | int width = video_screen_get_width(screen); |
| 963 | 958 | int height = video_screen_get_height(screen); |
| 964 | 959 | |
| 965 | cursorelement = allocgfx(machine, &cursorlayout); | |
| 966 | decodegfx(cursorelement, cursormask, 0, 1); | |
| 960 | cursorelement = gfx_element_alloc(machine, &cursorlayout, cursormask, machine->config->total_colors / 16, 0); | |
| 967 | 961 | /* 7-Sep-2007 - After 0.118u5, you cannot revector the color table */ |
| 968 | 962 | /* cursorelement->colortable = cursorcolortable; */ |
| 969 | 963 | cursorcolortable[1] = 1; |
| 970 | 964 | cursorelement->total_colors = 2; |
| 971 | 965 | ted7360_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); |
| 972 | add_exit_callback(machine, ted7360_video_stop); | |
| 973 | 966 | } |
| 974 | 967 | |
| 975 | 968 | static void ted7360_draw_character (running_machine *machine, int ybegin, int yend, int ch, int yoff, int xoff, |
| r4135 | r4136 | |
|---|---|---|
| 224 | 224 | for (y=asr_window_offset_y; y<asr_window_offset_y+asr_window_height-asr_scroll_step; y++) |
| 225 | 225 | { |
| 226 | 226 | extract_scanline8(asr[unit].bitmap, asr_window_offset_x, y+asr_scroll_step, asr_window_width, buf); |
| 227 | draw_scanline8(asr[unit].bitmap, asr_window_offset_x, y, asr_window_width, buf, machine->pens | |
| 227 | draw_scanline8(asr[unit].bitmap, asr_window_offset_x, y, asr_window_width, buf, machine->pens | |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | bitmap_fill(asr[unit].bitmap, &asr_scroll_clear_window, 0); |
| r4135 | r4136 | |
|---|---|---|
| 662 | 662 | if ((address & 0xFF00) == 0x0000) |
| 663 | 663 | { |
| 664 | 664 | opptr = apple3_get_zpa_addr(address); |
| 665 | direct->mask = ~0; | |
| 665 | direct->bytemask = ~0; | |
| 666 | 666 | direct->raw = direct->decrypted = opptr - address; |
| 667 | direct->min = address; | |
| 668 | direct->max = address; | |
| 667 | direct->bytestart = address; | |
| 668 | direct->byteend = address; | |
| 669 | 669 | address = ~0; |
| 670 | 670 | } |
| 671 | 671 | return address; |
| r4135 | r4136 | |
|---|---|---|
| 206 | 206 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 207 | 207 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 208 | 208 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 209 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR( | |
| 209 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(0xFFFD) | |
| 210 | 210 | |
| 211 | 211 | PORT_START("D2") |
| 212 | 212 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| r4135 | r4136 | |
|---|---|---|
| 219 | 219 | { |
| 220 | 220 | if ( ! osborne1.bank2_enabled ) |
| 221 | 221 | { |
| 222 | direct->mask = 0x0fff; | |
| 222 | direct->bytemask = 0x0fff; | |
| 223 | 223 | direct->decrypted = mess_ram + 0x2000; |
| 224 | 224 | direct->raw = mess_ram + 0x2000; |
| 225 | direct->min = 0x2000; | |
| 226 | direct->max = 0x2fff; | |
| 225 | direct->bytestart = 0x2000; | |
| 226 | direct->byteend = 0x2fff; | |
| 227 | 227 | return ~0; |
| 228 | 228 | } |
| 229 | 229 | } |
| r4135 | r4136 | |
|---|---|---|
| 1601 | 1601 | |
| 1602 | 1602 | if (opptr != NULL) |
| 1603 | 1603 | { |
| 1604 | direct->mask = ~0; | |
| 1604 | direct->bytemask = ~0; | |
| 1605 | 1605 | direct->raw = direct->decrypted = opptr - address; |
| 1606 | direct->min = address; | |
| 1607 | direct->max = address; | |
| 1606 | direct->bytestart = address; | |
| 1607 | direct->byteend = address; | |
| 1608 | 1608 | address = ~0; |
| 1609 | 1609 | } |
| 1610 | 1610 | } |
| r4135 | r4136 | |
|---|---|---|
| 925 | 925 | for (x = 0; x < resx; x++) |
| 926 | 926 | // line_buffer[x] = (v[(x+y*resx)>>4] & (0x8000 >> ((x+y*resx) & 0xf))) ? 0 : 1; |
| 927 | 927 | line_buffer[x] = (v[(x+y*resx)>>4] & (0x8000 >> (x & 0xf))) ? 0 : 1; |
| 928 | draw_scanline8(bitmap, 0, y, resx, line_buffer, screen->machine->pens | |
| 928 | draw_scanline8(bitmap, 0, y, resx, line_buffer, screen->machine->pens | |
| 929 | 929 | } |
| 930 | 930 | return 0; |
| 931 | 931 | } |
| r4135 | r4136 | |
| 956 | 956 | } |
| 957 | 957 | else |
| 958 | 958 | { /* system ROMs */ |
| 959 | direct->mask = 0xffffff; | |
| 959 | direct->bytemask = 0xffffff; | |
| 960 | 960 | direct->raw = direct->decrypted = lisa_rom_ptr - (address & 0xffc000); |
| 961 | direct->min = (address & 0xffc000); | |
| 962 | direct->max = (address & 0xffc000) + 0x003fff; | |
| 961 | direct->bytestart = (address & 0xffc000); | |
| 962 | direct->byteend = (address & 0xffc000) + 0x003fff; | |
| 963 | 963 | /*logerror("ROM (setup mode)\n");*/ |
| 964 | 964 | } |
| 965 | 965 | |
| r4135 | r4136 | |
| 988 | 988 | /* out of segment limits : bus error */ |
| 989 | 989 | logerror("illegal opbase address%lX\n", (long) address); |
| 990 | 990 | } |
| 991 | direct->mask = 0xffffff; | |
| 991 | direct->bytemask = 0xffffff; | |
| 992 | 992 | direct->raw = direct->decrypted = lisa_ram_ptr + mapped_address - address; |
| 993 | direct->min = (address & 0xffc000); | |
| 994 | direct->max = (address & 0xffc000) + 0x003fff; | |
| 993 | direct->bytestart = (address & 0xffc000); | |
| 994 | direct->byteend = (address & 0xffc000) + 0x003fff; | |
| 995 | 995 | /*logerror("RAM\n");*/ |
| 996 | 996 | break; |
| 997 | 997 | |
| r4135 | r4136 | |
| 1004 | 1004 | break; |
| 1005 | 1005 | |
| 1006 | 1006 | case special_IO: |
| 1007 | direct->mask = 0xffffff; | |
| 1007 | direct->bytemask = 0xffffff; | |
| 1008 | 1008 | direct->raw = direct->decrypted = lisa_rom_ptr + (mapped_address & 0x003fff) - address; |
| 1009 | direct->min = (address & 0xffc000); | |
| 1010 | direct->max = (address & 0xffc000) + 0x003fff; | |
| 1009 | direct->bytestart = (address & 0xffc000); | |
| 1010 | direct->byteend = (address & 0xffc000) + 0x003fff; | |
| 1011 | 1011 | /*logerror("ROM\n");*/ |
| 1012 | 1012 | break; |
| 1013 | 1013 | } |
| r4135 | r4136 | |
|---|---|---|
| 1104 | 1104 | { |
| 1105 | 1105 | if (c64_io_enabled) |
| 1106 | 1106 | { |
| 1107 | direct->mask = 0x0fff; | |
| 1107 | direct->bytemask = 0x0fff; | |
| 1108 | 1108 | direct->decrypted = c64_io_mirror; |
| 1109 | 1109 | direct->raw = c64_io_mirror; |
| 1110 | direct->min = 0x0000; | |
| 1111 | direct->max = 0xcfff; | |
| 1110 | direct->bytestart = 0x0000; | |
| 1111 | direct->byteend = 0xcfff; | |
| 1112 | 1112 | c64_io_mirror[address & 0x0fff] = c64_read_io( space, address & 0x0fff ); |
| 1113 | 1113 | } |
| 1114 | 1114 | else |
| 1115 | 1115 | { |
| 1116 | direct->mask = 0x0fff; | |
| 1116 | direct->bytemask = 0x0fff; | |
| 1117 | 1117 | direct->decrypted = c64_io_ram_r_ptr; |
| 1118 | 1118 | direct->raw = c64_io_ram_r_ptr; |
| 1119 | direct->min = 0x0000; | |
| 1120 | direct->max = 0xcfff; | |
| 1119 | direct->bytestart = 0x0000; | |
| 1120 | direct->byteend = 0xcfff; | |
| 1121 | 1121 | } |
| 1122 | 1122 | return ~0; |
| 1123 | 1123 | } |
| r4135 | r4136 | |
|---|---|---|
| 176 | 176 | CPUS += V810 |
| 177 | 177 | #CPUS += M37702 |
| 178 | 178 | #CPUS += M37710 |
| 179 | ||
| 179 | ||
| 180 | 180 | #CPUS += SE3208 |
| 181 | 181 | #CPUS += MC68HC11 |
| 182 | 182 | #CPUS += ADSP21062 |
| r4135 | r4136 | |
| 185 | 185 | #CPUS += ALPHA8201 |
| 186 | 186 | #CPUS += ALPHA8301 |
| 187 | 187 | CPUS += CDP1802 |
| 188 | #CPUS += COP401 | |
| 189 | #CPUS += COP410 | |
| 190 | CPUS += COP411 | |
| 191 | #CPUS += COP402 | |
| 192 | CPUS += COP420 | |
| 193 | #CPUS += COP421 | |
| 194 | #CPUS += COP422 | |
| 195 | #CPUS += COP404 | |
| 196 | #CPUS += COP424 | |
| 197 | #CPUS += COP425 | |
| 198 | #CPUS += COP426 | |
| 199 | #CPUS += COP444 | |
| 200 | #CPUS += COP445 | |
| 188 | CPUS += COP400 | |
| 201 | 189 | #CPUS += TLCS90 |
| 202 | 190 | #CPUS += MB8841 |
| 203 | 191 | #CPUS += MB8842 |
| r4135 | r4136 | |
| 218 | 206 | CPUS += TMS7000_EXL |
| 219 | 207 | CPUS += SM8500 |
| 220 | 208 | CPUS += MINX |
| 209 | #CPUS += COP401 | |
| 210 | #CPUS += COP410 | |
| 211 | CPUS += COP411 | |
| 212 | #CPUS += COP402 | |
| 213 | CPUS += COP420 | |
| 214 | #CPUS += COP421 | |
| 215 | #CPUS += COP422 | |
| 216 | #CPUS += COP404 | |
| 217 | #CPUS += COP424 | |
| 218 | #CPUS += COP425 | |
| 219 | #CPUS += COP426 | |
| 220 | #CPUS += COP444 | |
| 221 | #CPUS += COP445 | |
| 221 | 222 | CPUS += I8035 |
| 222 | 223 | #CPUS += I8041 |
| 223 | 224 | CPUS += I8048 |
| r4135 | r4136 | |
| 233 | 234 | CPUS += I8042 |
| 234 | 235 | #CPUS += I8242 |
| 235 | 236 | #CPUS += I8742 |
| 236 | CPUS += POWERPC | |
| 237 | 237 | #CPUS += PPC403GA |
| 238 | 238 | #CPUS += PPC403GCX |
| 239 | 239 | #CPUS += PPC601 |
| r4135 | r4136 | |
| 323 | 323 | #SOUNDS += MSM5232 |
| 324 | 324 | SOUNDS += OKIM6258 |
| 325 | 325 | SOUNDS += OKIM6295 |
| 326 | #SOUNDS += OKIM6376 | |
| 326 | 327 | #SOUNDS += UPD7759 |
| 327 | 328 | #SOUNDS += HC55516 |
| 328 | 329 | #SOUNDS += K005289 |
| r4135 | r4136 | |
| 363 | 364 | SOUNDS += SID6581 |
| 364 | 365 | SOUNDS += SID8580 |
| 365 | 366 | SOUNDS += SP0256 |
| 367 | #SOUNDS += DIGITALKER | |
| 366 | 368 | |
| 367 | 369 | |
| 368 | 370 | #------------------------------------------------- |
| r4135 | r4136 | |
|---|---|---|
| 27 | 27 | |
| 28 | 28 | #include "driver.h" |
| 29 | 29 | #include "cpu/z80/z80.h" |
| 30 | #include "sound/dac.h" | |
| 31 | #include "sound/wave.h" | |
| 30 | 32 | #include "includes/zx.h" |
| 31 | 33 | #include "devices/cassette.h" |
| 32 | 34 | #include "formats/zx81_p.h" |
| r4135 | r4136 | |
|---|---|---|
| 49 | 49 | #include "includes/jaguar.h" |
| 50 | 50 | #include "devices/cartslot.h" |
| 51 | 51 | #include "devices/snapquik.h" |
| 52 | #include "sound/dac.h" | |
| 52 | 53 | |
| 53 | 54 | #define JAGUAR_CLOCK XTAL_52MHz |
| 54 | 55 | #define R3000_CLOCK XTAL_40MHz |
| r4135 | r4136 | |
|---|---|---|
| 56 | 56 | #include "machine/mockngbd.h" |
| 57 | 57 | #include "machine/8530scc.h" |
| 58 | 58 | #include "sound/ay8910.h" |
| 59 | #include "sound/dac.h" | |
| 59 | 60 | |
| 60 | 61 | static const gfx_layout apple2gs_text_layout = |
| 61 | 62 | { |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | #include "devices/xmodem.h" |
| 15 | 15 | #include "devices/kermit.h" |
| 16 | 16 | #include "cpu/saturn/saturn.h" |
| 17 | #include "sound/dac.h" | |
| 17 | 18 | |
| 18 | 19 | #include "includes/hp48.h" |
| 19 | 20 |
| r4135 | r4136 | |
|---|---|---|
| 60 | 60 | |
| 61 | 61 | #include "driver.h" |
| 62 | 62 | #include "cpu/i8085/i8085.h" |
| 63 | #include "sound/wave.h" | |
| 63 | 64 | #include "machine/8255ppi.h" |
| 64 | 65 | #include "includes/dai.h" |
| 65 | 66 | #include "machine/pit8253.h" |
| r4135 | r4136 | |
|---|---|---|
| 14 | 14 | #include "sound/pokey.h" |
| 15 | 15 | #include "machine/6821pia.h" |
| 16 | 16 | #include "video/gtia.h" |
| 17 | #include "sound/dac.h" | |
| 17 | 18 | |
| 18 | 19 | /****************************************************************************** |
| 19 | 20 | Atari 800 memory map (preliminary) |
| r4135 | r4136 | |
|---|---|---|
| 46 | 46 | |
| 47 | 47 | #include "driver.h" |
| 48 | 48 | #include "cpu/z80/z80.h" |
| 49 | #include "cpu/z80/z80daisy.h" | |
| 50 | #include "sound/speaker.h" | |
| 51 | #include "sound/wave.h" | |
| 49 | 52 | #include "machine/z80pio.h" |
| 50 | #include "cpu/z80/z80daisy.h" | |
| 51 | 53 | #include "machine/wd17xx.h" |
| 52 | 54 | #include "includes/mbee.h" |
| 53 | 55 | #include "devices/snapquik.h" |
| r4135 | r4136 | |
| 55 | 57 | #include "devices/cartslot.h" |
| 56 | 58 | #include "devices/cassette.h" |
| 57 | 59 | #include "devices/z80bin.h" |
| 58 | #include "sound/speaker.h" | |
| 59 | 60 | |
| 60 | 61 | static const device_config *cassette_device_image(running_machine *machine) |
| 61 | 62 | { |
| r4135 | r4136 | |
|---|---|---|
| 13 | 13 | #include "driver.h" |
| 14 | 14 | #include "cpu/m6809/m6809.h" |
| 15 | 15 | #include "cpu/hd6309/hd6309.h" |
| 16 | #include "sound/wave.h" | |
| 16 | 17 | #include "machine/6821pia.h" |
| 17 | 18 | #include "video/m6847.h" |
| 18 | 19 | #include "machine/msm6242.h" |
| r4135 | r4136 | |
| 32 | 33 | #include "devices/cartslot.h" |
| 33 | 34 | #include "devices/coco_vhd.h" |
| 34 | 35 | #include "sound/ay8910.h" |
| 36 | #include "sound/dac.h" | |
| 35 | 37 | #include "coco3.lh" |
| 36 | 38 | |
| 37 | 39 | #define SHOW_FULL_AREA 0 |
| r4135 | r4136 | |
|---|---|---|
| 161 | 161 | #include "devices/cartslot.h" |
| 162 | 162 | #include "machine/smartmed.h" |
| 163 | 163 | #include "sound/5220intf.h" |
| 164 | #include "sound/sn76496.h" | |
| 165 | #include "sound/wave.h" | |
| 164 | 166 | #include "devices/harddriv.h" |
| 165 | 167 | #include "machine/idectrl.h" |
| 166 | 168 |
| r4135 | r4136 | |
|---|---|---|
| 81 | 81 | |
| 82 | 82 | #include "driver.h" |
| 83 | 83 | #include "cpu/m6502/m6502.h" |
| 84 | #include "sound/dac.h" | |
| 84 | 85 | #include "machine/6530miot.h" |
| 85 | 86 | #include "devices/cassette.h" |
| 86 | 87 | #include "formats/kim1_cas.h" |
| r4135 | r4136 | |
|---|---|---|
| 290 | 290 | #include "devices/cassette.h" |
| 291 | 291 | #include "formats/fmsx_cas.h" |
| 292 | 292 | #include "sound/ay8910.h" |
| 293 | #include "sound/dac.h" | |
| 294 | #include "sound/wave.h" | |
| 295 | #include "sound/k051649.h" | |
| 296 | #include "sound/2413intf.h" | |
| 293 | 297 | |
| 294 | 298 | static ADDRESS_MAP_START (readmem, ADDRESS_SPACE_PROGRAM, 8) |
| 295 | 299 | AM_RANGE( 0x0000, 0x1fff) AM_READ( SMH_BANK1 ) |
| r4135 | r4136 | |
|---|---|---|
| 85 | 85 | #include "devices/cassette.h" |
| 86 | 86 | #include "devices/snapquik.h" |
| 87 | 87 | #include "cpu/cdp1802/cdp1802.h" |
| 88 | #include "sound/cdp1869.h" | |
| 88 | 89 | #include "includes/tmc600.h" |
| 89 | 90 | #include "video/cdp1869.h" |
| 90 | 91 |
| r4135 | r4136 | |
|---|---|---|
| 21 | 21 | #include "cpu/mcs48/mcs48.h" |
| 22 | 22 | #include "cpu/cop400/cop400.h" |
| 23 | 23 | #include "devices/cartslot.h" |
| 24 | #include "sound/dac.h" | |
| 24 | 25 | |
| 25 | 26 | /* Memory Maps */ |
| 26 | 27 |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/i8085/i8085.h" |
| 12 | #include "sound/wave.h" | |
| 12 | 13 | #include "machine/8255ppi.h" |
| 13 | 14 | #include "machine/8257dma.h" |
| 14 | 15 | #include "video/i8275.h" |
| r4135 | r4136 | |
| 316 | 317 | static DIRECT_UPDATE_HANDLER( radio16_direct ) |
| 317 | 318 | { |
| 318 | 319 | if (address >= 0x4000 && address <=0x7FFF) { |
| 319 | direct->mask = 0xffff; | |
| 320 | direct->bytemask = 0xffff; | |
| 320 | 321 | direct->raw = radio16_io_mirror; |
| 321 | 322 | direct->decrypted = radio16_io_mirror; |
| 322 | direct->min = 0x4000; | |
| 323 | direct->max = 0x7fff; | |
| 323 | direct->bytestart = 0x4000; | |
| 324 | direct->byteend = 0x7fff; | |
| 324 | 325 | radio16_io_mirror[address] = cpu_get_reg(space->machine->cpu[0], I8085_STATUS); |
| 325 | 326 | } |
| 326 | 327 | return address; |
| r4135 | r4136 | |
|---|---|---|
| 66 | 66 | /* Core includes */ |
| 67 | 67 | #include "driver.h" |
| 68 | 68 | #include "cpu/z80/z80.h" |
| 69 | #include "sound/speaker.h" | |
| 70 | #include "sound/wave.h" | |
| 69 | 71 | #include "machine/8255ppi.h" |
| 70 | 72 | #include "includes/mz700.h" |
| 71 | 73 | #include "machine/pit8253.h" |
| r4135 | r4136 | |
|---|---|---|
| 15 | 15 | #include "includes/vectrex.h" |
| 16 | 16 | #include "devices/cartslot.h" |
| 17 | 17 | #include "sound/ay8910.h" |
| 18 | #include "sound/dac.h" | |
| 18 | 19 | |
| 19 | 20 | static ADDRESS_MAP_START(vectrex_map, ADDRESS_SPACE_PROGRAM, 8) |
| 20 | 21 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| r4135 | r4136 | |
|---|---|---|
| 44 | 44 | #include "video/tms9928a.h" |
| 45 | 45 | #include "devices/cassette.h" |
| 46 | 46 | #include "sound/speaker.h" |
| 47 | #include "sound/wave.h" | |
| 47 | 48 | |
| 48 | 49 | |
| 49 | 50 | static int load_state; |
| r4135 | r4136 | |
|---|---|---|
| 126 | 126 | static const aica_interface dc_aica_interface = |
| 127 | 127 | { |
| 128 | 128 | 0, |
| 129 | 0, | |
| 129 | 130 | aica_irq |
| 130 | 131 | }; |
| 131 | 132 |
| r4135 | r4136 | |
|---|---|---|
| 15 | 15 | #include "devices/sonydriv.h" |
| 16 | 16 | #include "machine/applefdc.h" |
| 17 | 17 | #include "machine/6522via.h" |
| 18 | #include "sound/speaker.h" | |
| 18 | 19 | |
| 19 | 20 | |
| 20 | 21 | /*************************************************************************** |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/m6502/m6502.h" |
| 12 | #include "sound/speaker.h" | |
| 12 | 13 | #include "includes/sym1.h" |
| 13 | 14 | |
| 14 | 15 | /* Peripheral chips */ |
| r4135 | r4136 | |
|---|---|---|
| 33 | 33 | #include "devices/cartslot.h" |
| 34 | 34 | #include "devices/cassette.h" |
| 35 | 35 | #include "sound/ay8910.h" |
| 36 | #include "sound/dac.h" | |
| 36 | 37 | #include "formats/cgen_cas.h" |
| 37 | 38 | |
| 38 | 39 |
| r4135 | r4136 | |
|---|---|---|
| 171 | 171 | |
| 172 | 172 | #include "driver.h" |
| 173 | 173 | #include "cpu/i8085/i8085.h" |
| 174 | #include "sound/wave.h" | |
| 174 | 175 | #include "devices/cassette.h" |
| 175 | 176 | #include "includes/pmd85.h" |
| 176 | 177 | #include "machine/8255ppi.h" |
| r4135 | r4136 | |
|---|---|---|
| 576 | 576 | for (y=teletyper_window_offset_y; y<teletyper_window_offset_y+teletyper_window_height-teletyper_scroll_step; y++) |
| 577 | 577 | { |
| 578 | 578 | extract_scanline8(apexc_bitmap, teletyper_window_offset_x, y+teletyper_scroll_step, teletyper_window_width, buf); |
| 579 | draw_scanline8(apexc_bitmap, teletyper_window_offset_x, y, teletyper_window_width, buf, machine->pens | |
| 579 | draw_scanline8(apexc_bitmap, teletyper_window_offset_x, y, teletyper_window_width, buf, machine->pens | |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | bitmap_fill(apexc_bitmap, &teletyper_scroll_clear_window, 0); |
| r4135 | r4136 | |
|---|---|---|
| 146 | 146 | |
| 147 | 147 | #include "driver.h" |
| 148 | 148 | #include "cpu/z80/z80.h" |
| 149 | #include "sound/speaker.h" | |
| 150 | #include "sound/wave.h" | |
| 149 | 151 | #include "includes/spectrum.h" |
| 150 | 152 | #include "eventlst.h" |
| 151 | 153 | #include "devices/snapquik.h" |
| 152 | 154 | #include "devices/cartslot.h" |
| 153 | 155 | #include "devices/cassette.h" |
| 154 | #include "sound/speaker.h" | |
| 155 | 156 | #include "formats/tzx_cas.h" |
| 156 | 157 | |
| 157 | 158 |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/z80/z80.h" |
| 12 | #include "sound/wave.h" | |
| 12 | 13 | #include "devices/cassette.h" |
| 13 | 14 | #include "includes/ondra.h" |
| 14 | 15 |
| r4135 | r4136 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | #include "driver.h" |
| 4 | 4 | #include "cpu/z80/z80.h" |
| 5 | #include "cpu/z80/z80daisy.h" | |
| 6 | #include "sound/wave.h" | |
| 5 | 7 | #include "machine/z80pio.h" |
| 6 | #include "cpu/z80/z80daisy.h" | |
| 7 | 8 | #include "devices/snapquik.h" |
| 8 | 9 | #include "devices/cartslot.h" |
| 9 | 10 | #include "devices/cassette.h" |
| r4135 | r4136 | |
| 153 | 154 | pcgram[0x800+offset] = data; |
| 154 | 155 | |
| 155 | 156 | /* decode character graphics again */ |
| 156 | | |
| 157 | gfx_el | |
| 157 | 158 | } |
| 158 | 159 | } |
| 159 | 160 | } |
| r4135 | r4136 | |
| 306 | 307 | for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++) |
| 307 | 308 | pcgram[0x1000+i] = pcgram[(videoram[cursor])*16 + i] ^ mc6845_cursor[i]; |
| 308 | 309 | |
| 309 | | |
| 310 | gfx_el | |
| 310 | 311 | |
| 311 | 312 | for( i = 0; i < bytes; i++ ) |
| 312 | 313 | { |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | #include "cpu/rsp/rsp.h" |
| 11 | 11 | #include "cpu/mips/mips3.h" |
| 12 | 12 | #include "sound/custom.h" |
| 13 | #include "sound/dmadac.h" | |
| 13 | 14 | #include "devices/cartslot.h" |
| 14 | 15 | #include "includes/n64.h" |
| 15 | 16 |
| r4135 | r4136 | |
|---|---|---|
| 199 | 199 | |
| 200 | 200 | #include "driver.h" |
| 201 | 201 | #include "cpu/tms9900/tms9900.h" |
| 202 | #include "sound/sn76496.h" | |
| 202 | 203 | #include "deprecat.h" |
| 203 | 204 | #include "video/v9938.h" |
| 204 | 205 | #include "includes/geneve.h" |
| r4135 | r4136 | |
|---|---|---|
| 40 | 40 | |
| 41 | 41 | #include "driver.h" |
| 42 | 42 | #include "cpu/mips/mips3.h" |
| 43 | #include "sound/cdda.h" | |
| 43 | 44 | #include "machine/sgi.h" |
| 44 | 45 | #include "machine/pckeybrd.h" |
| 45 | 46 | #include "includes/pc_mouse.h" |
| r4135 | r4136 | |
|---|---|---|
| 174 | 174 | #include "cpu/z80/z80.h" |
| 175 | 175 | #include "cpu/m6502/m6502.h" |
| 176 | 176 | #include "sound/sid6581.h" |
| 177 | #include "sound/dac.h" | |
| 177 | 178 | #include "machine/6526cia.h" |
| 178 | 179 | |
| 179 | 180 | #include "machine/cbmipt.h" |
| r4135 | r4136 | |
|---|---|---|
| 282 | 282 | |
| 283 | 283 | #include "driver.h" |
| 284 | 284 | #include "cpu/i8085/i8085.h" |
| 285 | #include "sound/speaker.h" | |
| 286 | #include "sound/wave.h" | |
| 285 | 287 | #include "machine/8255ppi.h" |
| 286 | 288 | #include "includes/lviv.h" |
| 287 | 289 | #include "devices/snapquik.h" |
| r4135 | r4136 | |
|---|---|---|
| 135 | 135 | So far, it has been tested to work at 300 baud. |
| 136 | 136 | |
| 137 | 137 | ********************************************************************************/ |
| 138 | ||
| 138 | 139 | #include "driver.h" |
| 140 | #include "cpu/z80/z80.h" | |
| 141 | #include "sound/speaker.h" | |
| 142 | #include "sound/wave.h" | |
| 139 | 143 | #include "includes/exidy.h" |
| 140 | 144 | #include "machine/centroni.h" |
| 141 | #include "cpu/z80/z80.h" | |
| 142 | 145 | #include "machine/wd17xx.h" |
| 143 | 146 | #include "devices/basicdsk.h" |
| 144 | 147 | #include "devices/cassette.h" |
| r4135 | r4136 | |
| 146 | 149 | #include "devices/cartslot.h" |
| 147 | 150 | #include "devices/printer.h" |
| 148 | 151 | #include "devices/z80bin.h" |
| 149 | #include "sound/speaker.h" | |
| 150 | 152 | #include "machine/ay31015.h" |
| 151 | 153 | |
| 152 | 154 |
| r4135 | r4136 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | 8 | #include "cpu/z80/z80.h" |
| 9 | #include "sound/beep.h" | |
| 9 | 10 | #include "machine/8255ppi.h" |
| 10 | 11 | #include "includes/pc8801.h" |
| 11 | 12 | #include "machine/nec765.h" |
| r4135 | r4136 | |
|---|---|---|
| 29 | 29 | #include "driver.h" |
| 30 | 30 | #include "includes/p2000t.h" |
| 31 | 31 | #include "cpu/z80/z80.h" |
| 32 | #include "sound/speaker.h" | |
| 32 | 33 | #include "video/saa5050.h" |
| 33 | 34 | |
| 34 | 35 |
| r4135 | r4136 | |
|---|---|---|
| 7 | 7 | #include "driver.h" |
| 8 | 8 | #include "machine/6532riot.h" |
| 9 | 9 | #include "cpu/m6502/m6502.h" |
| 10 | #include "sound/wave.h" | |
| 10 | 11 | #include "sound/tiaintf.h" |
| 11 | 12 | #include "devices/cartslot.h" |
| 12 | 13 | #include "devices/cassette.h" |
| r4135 | r4136 | |
| 738 | 739 | static DIRECT_UPDATE_HANDLER( modeSS_opbase ) |
| 739 | 740 | { |
| 740 | 741 | if ( address & 0x1000 ) { |
| 741 | direct->mask = 0x7ff; | |
| 742 | direct->min = ( address & 0xf800 ); | |
| 743 | direct->max = ( address & 0xf800 ) | 0x7ff; | |
| 742 | direct->bytemask = 0x7ff; | |
| 743 | direct->bytestart = ( address & 0xf800 ); | |
| 744 | direct->byteend = ( address & 0xf800 ) | 0x7ff; | |
| 744 | 745 | if ( address & 0x800 ) { |
| 745 | 746 | direct->decrypted = bank_base[2]; |
| 746 | 747 | direct->raw = bank_base[2]; |
| r4135 | r4136 | |
|---|---|---|
| 18 | 18 | |
| 19 | 19 | #include "driver.h" |
| 20 | 20 | #include "cpu/m6502/m6502.h" |
| 21 | #include "sound/wave.h" | |
| 21 | 22 | #include "includes/oric.h" |
| 22 | 23 | #include "machine/centroni.h" |
| 23 | 24 | #include "devices/printer.h" |
| r4135 | r4136 | |
|---|---|---|
| 13 | 13 | #include "driver.h" |
| 14 | 14 | #include "cpu/m6502/m6502.h" |
| 15 | 15 | #include "sound/dac.h" |
| 16 | #include "sound/wave.h" | |
| 16 | 17 | #include "includes/orao.h" |
| 17 | 18 | #include "devices/cassette.h" |
| 18 | 19 | #include "formats/orao_cas.h" |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| 12 | 12 | #include "cpu/m6800/m6800.h" |
| 13 | #include "sound/dac.h" | |
| 13 | 14 | #include "video/m6847.h" |
| 14 | 15 | #include "includes/mc10.h" |
| 15 | 16 | #include "devices/cassette.h" |
| r4135 | r4136 | |
|---|---|---|
| 74 | 74 | #include "devices/printer.h" |
| 75 | 75 | #include "devices/cassette.h" |
| 76 | 76 | #include "devices/snapquik.h" |
| 77 | #include "sound/speaker.h" | |
| 77 | 78 | |
| 78 | 79 | #include "includes/atom.h" |
| 79 | 80 |
| r4135 | r4136 | |
|---|---|---|
| 28 | 28 | |
| 29 | 29 | #include "driver.h" |
| 30 | 30 | #include "cpu/m6800/m6800.h" |
| 31 | #include "sound/dac.h" | |
| 31 | 32 | #include "devices/cartslot.h" |
| 32 | 33 | #include "includes/mekd2.h" |
| 33 | 34 |
| r4135 | r4136 | |
|---|---|---|
| 52 | 52 | #include "machine/pci.h" |
| 53 | 53 | #include "machine/kb_keytro.h" |
| 54 | 54 | |
| 55 | #include "sound/dac.h" | |
| 56 | #include "sound/speaker.h" | |
| 57 | #include "sound/saa1099.h" | |
| 58 | ||
| 55 | 59 | /* window resizing with dirtybuffering traping in xmess window */ |
| 56 | 60 | |
| 57 | 61 | #define ym3812_StdClock 3579545 |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/z80/z80.h" |
| 12 | 12 | #include "cpu/i8085/i8085.h" |
| 13 | #include "sound/wave.h" | |
| 13 | 14 | #include "machine/8255ppi.h" |
| 14 | 15 | #include "machine/wd17xx.h" |
| 15 | 16 | #include "devices/cassette.h" |
| r4135 | r4136 | |
|---|---|---|
| 84 | 84 | |
| 85 | 85 | #include "driver.h" |
| 86 | 86 | #include "cpu/m6502/m6502.h" |
| 87 | #include "sound/dac.h" | |
| 87 | 88 | |
| 88 | 89 | #include "machine/6522via.h" |
| 89 | 90 | #include "includes/vc1541.h" |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/i8085/i8085.h" |
| 12 | #include "sound/wave.h" | |
| 12 | 13 | #include "machine/8255ppi.h" |
| 13 | 14 | #include "machine/8257dma.h" |
| 14 | 15 | #include "machine/wd17xx.h" |
| r4135 | r4136 | |
|---|---|---|
| 27 | 27 | #include "includes/electron.h" |
| 28 | 28 | #include "devices/cassette.h" |
| 29 | 29 | #include "formats/uef_cas.h" |
| 30 | #include "sound/beep.h" | |
| 30 | 31 | |
| 31 | 32 | static const rgb_t electron_palette[8]= |
| 32 | 33 | { |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/i8085/i8085.h" |
| 12 | #include "sound/wave.h" | |
| 12 | 13 | #include "machine/8255ppi.h" |
| 13 | 14 | #include "machine/8257dma.h" |
| 14 | 15 | #include "machine/pit8253.h" |
| r4135 | r4136 | |
| 136 | 137 | static DIRECT_UPDATE_HANDLER( mikrosha_direct ) |
| 137 | 138 | { |
| 138 | 139 | if (address >= 0x8000 && address <=0xFFFF) { |
| 139 | direct->mask = 0xffff; | |
| 140 | direct->bytemask = 0xffff; | |
| 140 | 141 | direct->raw = mikrosha_io_mirror; |
| 141 | 142 | direct->decrypted = mikrosha_io_mirror; |
| 142 | direct->min = 0x8000; | |
| 143 | direct->max = 0xffff; | |
| 143 | direct->bytestart = 0x8000; | |
| 144 | direct->byteend = 0xffff; | |
| 144 | 145 | mikrosha_io_mirror[address] = cpu_get_reg(space->machine->cpu[0], I8085_STATUS); |
| 145 | 146 | } |
| 146 | 147 | return address; |
| r4135 | r4136 | |
|---|---|---|
| 30 | 30 | #include "machine/amigacd.h" |
| 31 | 31 | #include "machine/amigacrt.h" |
| 32 | 32 | #include "machine/msm6242.h" |
| 33 | #include "sound/cdda.h" | |
| 33 | 34 | |
| 34 | 35 | /* Devices */ |
| 35 | 36 | #include "devices/chd_cd.h" |
| r4135 | r4136 | |
|---|---|---|
| 70 | 70 | #include "driver.h" |
| 71 | 71 | |
| 72 | 72 | #include "cpu/tms9900/tms9900.h" |
| 73 | #include "sound/beep.h" | |
| 73 | 74 | #include "machine/ti990.h" |
| 74 | 75 | #include "machine/990_hd.h" |
| 75 | 76 | #include "machine/990_tap.h" |
| r4135 | r4136 | |
|---|---|---|
| 11 | 11 | #include "driver.h" |
| 12 | 12 | #include "cpu/z80/z80.h" |
| 13 | 13 | #include "cpu/i8085/i8085.h" |
| 14 | #include "sound/ay8910.h" | |
| 15 | #include "sound/speaker.h" | |
| 16 | #include "sound/wave.h" | |
| 14 | 17 | #include "machine/8255ppi.h" |
| 15 | 18 | #include "machine/mc146818.h" |
| 16 | 19 | #include "machine/wd17xx.h" |
| r4135 | r4136 | |
| 18 | 21 | #include "devices/cassette.h" |
| 19 | 22 | #include "devices/cartslot.h" |
| 20 | 23 | #include "formats/rk_cas.h" |
| 21 | #include "sound/ay8910.h" | |
| 22 | #include "sound/speaker.h" | |
| 23 | 24 | #include "includes/orion.h" |
| 24 | 25 | #include "includes/radio86.h" |
| 25 | 26 |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/t11/t11.h" |
| 12 | #include "sound/wave.h" | |
| 12 | 13 | #include "includes/bk.h" |
| 13 | 14 | #include "devices/cassette.h" |
| 14 | 15 | #include "formats/rk_cas.h" |
| r4135 | r4136 | |
|---|---|---|
| 16 | 16 | #include "video/pc_vga.h" |
| 17 | 17 | #include "video/cirrus.h" |
| 18 | 18 | #include "cpu/powerpc/ppc.h" |
| 19 | #include "sound/3812intf.h" | |
| 19 | 20 | #include "machine/ins8250.h" |
| 20 | 21 | #include "machine/pic8259.h" |
| 21 | 22 | #include "machine/mc146818.h" |
| r4135 | r4136 | |
|---|---|---|
| 15 | 15 | #include "driver.h" |
| 16 | 16 | #include "deprecat.h" |
| 17 | 17 | #include "cpu/m6502/m6502.h" |
| 18 | #include "sound/pokey.h" | |
| 18 | 19 | #include "sound/tiaintf.h" |
| 19 | 20 | #include "devices/cartslot.h" |
| 20 | 21 | #include "machine/6532riot.h" |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/i8085/i8085.h" |
| 12 | #include "sound/wave.h" | |
| 12 | 13 | #include "machine/8255ppi.h" |
| 13 | 14 | #include "machine/8257dma.h" |
| 14 | 15 | #include "video/i8275.h" |
| r4135 | r4136 | |
|---|---|---|
| 42 | 42 | |
| 43 | 43 | /* Components */ |
| 44 | 44 | #include "sound/ay8910.h" |
| 45 | #include "sound/dac.h" | |
| 46 | #include "sound/wave.h" | |
| 45 | 47 | #include "machine/6522via.h" |
| 46 | 48 | #include "machine/6551.h" |
| 47 | 49 |
| r4135 | r4136 | |
|---|---|---|
| 11 | 11 | #include "driver.h" |
| 12 | 12 | #include "cpu/z80/z80.h" |
| 13 | 13 | #include "cpu/i8085/i8085.h" |
| 14 | #include "sound/dac.h" | |
| 15 | #include "sound/wave.h" | |
| 14 | 16 | #include "includes/special.h" |
| 15 | 17 | #include "machine/8255ppi.h" |
| 16 | 18 | #include "machine/pit8253.h" |
| 17 | #include "sound/dac.h" | |
| 18 | 19 | #include "devices/cassette.h" |
| 19 | 20 | #include "devices/basicdsk.h" |
| 20 | 21 | #include "formats/rk_cas.h" |
| r4135 | r4136 | |
|---|---|---|
| 240 | 240 | jupiter_charram[offset] = data; |
| 241 | 241 | |
| 242 | 242 | /* decode character graphics again */ |
| 243 | decodechar(space->machine->gfx[0], offset / 8, jupiter_charram); | |
| 244 | decodechar(space->machine->gfx[1], offset / 8, jupiter_charram); | |
| 243 | gfx_element_mark_dirty(space->machine->gfx[0], offset / 8); | |
| 244 | gfx_element_mark_dirty(space->machine->gfx[1], offset / 8); | |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 |
| r4135 | r4136 | |
|---|---|---|
| 36 | 36 | |
| 37 | 37 | #include "driver.h" |
| 38 | 38 | #include "cpu/z80/z80.h" |
| 39 | #include "cpu/z80/z80daisy.h" | |
| 40 | #include "sound/beep.h" | |
| 39 | 41 | #include "devices/basicdsk.h" |
| 40 | 42 | #include "machine/wd17xx.h" |
| 41 | #include "cpu/z80/z80daisy.h" | |
| 42 | 43 | #include "includes/osborne1.h" |
| 43 | 44 | |
| 44 | 45 |
| r4135 | r4136 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/i8085/i8085.h" |
| 12 | #include "sound/wave.h" | |
| 12 | 13 | #include "machine/8255ppi.h" |
| 13 | 14 | #include "includes/mikro80.h" |
| 14 | 15 | #include "devices/cassette.h" |
| r4135 | r4136 | |
|---|---|---|
| 38 | 38 | #include "includes/ssystem3.h" |
| 39 | 39 | #include "machine/6522via.h" |
| 40 | 40 | #include "cpu/m6502/m6502.h" |
| 41 | ||
| 41 | ||
| 42 | 42 | |
| 43 | 43 | static struct { |
| 44 | 44 | UINT8 porta; |
| r4135 | r4136 | |
|---|---|---|
| 101 | 101 | /* Core includes */ |
| 102 | 102 | #include "driver.h" |
| 103 | 103 | #include "cpu/z80/z80.h" |
| 104 | #include "sound/wave.h" | |
| 104 | 105 | #include "includes/vtech1.h" |
| 105 | 106 | |
| 106 | 107 | /* Components */ |
| r4135 | r4136 | |
|---|---|---|
| 87 | 87 | #include "video/m6845.h" /* CRTC display */ |
| 88 | 88 | #include "machine/nec765.h" /* for floppy disc controller */ |
| 89 | 89 | #include "sound/ay8910.h" |
| 90 | #include "sound/wave.h" | |
| 90 | 91 | #include "machine/mc146818.h" /* Aleste RTC */ |
| 91 | 92 | |
| 92 | 93 | /* Devices */ |
| r4135 | r4136 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "cpu/z80/z80.h" |
| 11 | #include "sound/speaker.h" | |
| 12 | #include "sound/wave.h" | |
| 11 | 13 | #include "machine/8255ppi.h" |
| 12 | 14 | #include "machine/pit8253.h" |
| 13 | 15 | #include "devices/cassette.h" |
| 14 | #include "sound/speaker.h" | |
| 15 | 16 | #include "includes/mz80.h" |
| 16 | 17 | |
| 17 | 18 | static INPUT_PORTS_START( mz80k ) |
| r4135 | r4136 | |
|---|---|---|
| 296 | 296 | // if the boot ROM is mapped in, do some trickery to make it show up |
| 297 | 297 | if (a310_latchrom) |
| 298 | 298 | { |
| 299 | direct->mask = 0x1fffff; | |
| 300 | direct->min = 0; | |
| 301 | direct->max = 0x1fffff; | |
| 299 | direct->bytemask = 0x1fffff; | |
| 300 | direct->bytestart = 0; | |
| 301 | direct->byteend = 0x1fffff; | |
| 302 | 302 | direct->raw = direct->decrypted = memory_region(space->machine, "main"); |
| 303 | 303 | } |
| 304 | 304 | else // executing from logical memory |
| 305 | 305 | { |
| 306 | 306 | UINT32 page = address / page_sizes[a310_pagesize]; |
| 307 | 307 | |
| 308 | direct->mask = page_sizes[a310_pagesize]-1; | |
| 309 | direct->min = page * page_sizes[a310_pagesize]; | |
| 310 | direct->max = direct->min + direct->mask; | |
| 308 | direct->bytemask = page_sizes[a310_pagesize]-1; | |
| 309 | direct->bytestart = page * page_sizes[a310_pagesize]; | |
| 310 | direct->byteend = direct->bytestart + direct->bytemask; | |
| 311 | 311 | direct->raw = direct->decrypted = (UINT8 *)&a310_physmem[(a310_pages[page] * page_sizes[a310_pagesize])>>2]; |
| 312 | 312 | } |
| 313 | 313 |
| r4135 | r4136 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| 12 | 12 | #include "cpu/i8085/i8085.h" |
| 13 | #include "sound/dac.h" | |
| 14 | #include "sound/wave.h" | |
| 13 | 15 | #include "includes/ut88.h" |
| 14 | #include "sound/dac.h" | |
| 15 | 16 | #include "devices/cassette.h" |
| 16 | 17 | #include "formats/rk_cas.h" |
| 17 | 18 | #include "ut88mini.lh" |
| r4135 | r4136 | |
|---|---|---|
| 160 | 160 | |
| 161 | 161 | #include "driver.h" |
| 162 | 162 | #include "cpu/tms9900/tms9900.h" |
| 163 | #include "sound/wave.h" | |
| 163 | 164 | #include "video/tms9928a.h" |
| 164 | 165 | #include "devices/cartslot.h" |
| 165 | 166 | #include "devices/cassette.h" |
| r4135 | r4136 | |
|---|---|---|
| 13 | 13 | #include "driver.h" |
| 14 | 14 | #include "includes/comx35.h" |
| 15 | 15 | #include "cpu/cdp1802/cdp1802.h" |
| 16 | #include "sound/cdp1869.h" | |
| 17 | #include "sound/wave.h" | |
| 16 | 18 | #include "devices/basicdsk.h" |
| 17 | 19 | #include "devices/cassette.h" |
| 18 | 20 | #include "devices/printer.h" |
| r4135 | r4136 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | /* Core includes */ |
| 14 | 14 | #include "driver.h" |
| 15 | #include "sound/speaker.h" | |
| 15 | 16 | #include "includes/cybiko.h" |
| 16 | 17 | |
| 17 | 18 | /* Components */ |
| r4135 | r4136 | |
|---|---|---|
| 78 | 78 | |
| 79 | 79 | /* Core includes */ |
| 80 | 80 | #include "driver.h" |
| 81 | #include "deprecat.h" | |
| 81 | 82 | #include "cpu/z80/z80.h" |
| 82 | #include "d | |
| 83 | #include "sound/w | |
| 83 | 84 | #include "includes/trs80.h" |
| 84 | 85 | |
| 85 | 86 | /* Components */ |
| r4135 | r4136 | |
|---|---|---|
| 195 | 195 | #include "machine/applefdc.h" |
| 196 | 196 | #include "machine/mockngbd.h" |
| 197 | 197 | #include "sound/ay8910.h" |
| 198 | #include "sound/dac.h" | |
| 198 | 199 | |
| 199 | 200 | |
| 200 | 201 |
| r4135 | r4136 | |
|---|---|---|
| 102 | 102 | *******************************************************************************/ |
| 103 | 103 | |
| 104 | 104 | #include "driver.h" |
| 105 | #include "sound/speaker.h" | |
| 106 | #include "sound/wave.h" | |
| 105 | 107 | #include "includes/primo.h" |
| 106 | 108 | #include "cpu/z80/z80.h" |
| 107 | 109 | #include "devices/cassette.h" |
| r4135 | r4136 | |
|---|---|---|
| 134 | 134 | |
| 135 | 135 | #include "driver.h" |
| 136 | 136 | #include "cpu/z80/z80.h" |
| 137 | #include "sound/speaker.h" | |
| 137 | 138 | #include "includes/ti85.h" |
| 138 | 139 | #include "devices/snapquik.h" |
| 139 | 140 |
| r4135 | r4136 | |
|---|---|---|
| 325 | 325 | #include "driver.h" |
| 326 | 326 | #include "cpu/m6502/m6502.h" |
| 327 | 327 | #include "sound/sid6581.h" |
| 328 | #include "sound/dac.h" | |
| 328 | 329 | #include "machine/6526cia.h" |
| 329 | 330 | |
| 330 | 331 | #include "machine/cbmipt.h" |
| r4135 | r4136 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | #include "driver.h" |
| 13 | 13 | #include "cpu/z80/z80.h" |
| 14 | #include "sound/wave.h" | |
| 14 | 15 | #include "video/mc6845.h" |
| 15 | 16 | #include "includes/svi318.h" |
| 16 | 17 | #include "video/tms9928a.h" |
| r4135 | r4136 | |
|---|---|---|
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | #include "driver.h" |
| 30 | #include "deprecat.h" | |
| 30 | 31 | #include "cpu/tms9900/tms9900.h" |
| 31 | #include "deprecat.h" | |
| 32 | #include "sound/dac.h" | |
| 33 | #include "sound/sn76496.h" | |
| 32 | 34 | #include "video/v9938.h" |
| 33 | 35 | |
| 34 | 36 | #include "machine/ti99_4x.h" |
| r4135 | r4136 | |
|---|---|---|
| 109 | 109 | #include "driver.h" |
| 110 | 110 | #include "cpu/nec/nec.h" |
| 111 | 111 | #include "cpu/i86/i86.h" |
| 112 | #include "sound/speaker.h" | |
| 113 | #include "sound/saa1099.h" | |
| 112 | 114 | #include "deprecat.h" |
| 113 | 115 | |
| 114 | 116 | #include "machine/8255ppi.h" |
| r4135 | r4136 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "cpu/cdp1802/cdp1802.h" |
| 11 | #include "sound/cdp1869.h" | |
| 12 | #include "sound/wave.h" | |
| 11 | 13 | #include "video/cdp1869.h" |
| 12 | 14 | #include "devices/cassette.h" |
| 13 | 15 | #include "includes/pecom.h" |
| r4135 | r4136 | |
|---|---|---|
| 59 | 59 | #include "devices/cartslot.h" |
| 60 | 60 | #include "devices/chd_cd.h" |
| 61 | 61 | #include "sound/c6280.h" |
| 62 | #include "sound/cdda.h" | |
| 62 | 63 | #include "sound/msm5205.h" |
| 63 | 64 | #include "hash.h" |
| 64 | 65 |
| r4135 | r4136 | |
|---|---|---|
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | #include "driver.h" |
| 22 | #include "deprecat.h" | |
| 22 | 23 | #include "cpu/tms9900/tms9900.h" |
| 23 | #include "deprecat.h" | |
| 24 | #include "sound/sn76496.h" | |
| 25 | #include "sound/wave.h" | |
| 24 | 26 | #include "video/v9938.h" |
| 25 | 27 | #include "machine/ti99_4x.h" |
| 26 | 28 | #include "machine/tms9901.h" |
| r4135 | r4136 | |
|---|---|---|
| 18 | 18 | |
| 19 | 19 | #include "driver.h" |
| 20 | 20 | #include "cpu/mips/mips3.h" |
| 21 | #include "sound/cdda.h" | |
| 21 | 22 | #include "machine/8530scc.h" |
| 22 | 23 | #include "machine/sgi.h" |
| 23 | 24 | #include "machine/eeprom.h" |
| r4135 | r4136 | |
|---|---|---|
| 23 | 23 | |
| 24 | 24 | #include "driver.h" |
| 25 | 25 | #include "cpu/z80/z80.h" |
| 26 | #include "sound/wave.h" | |
| 26 | 27 | #include "includes/galaxy.h" |
| 27 | 28 | #include "devices/snapquik.h" |
| 28 | 29 | #include "devices/cassette.h" |
| r4135 | r4136 | |
|---|---|---|
| 22 | 22 | #include "devices/cassette.h" |
| 23 | 23 | #include "formats/uef_cas.h" |
| 24 | 24 | #include "formats/csw_cas.h" |
| 25 | #include "sound/sn76496.h" | |
| 25 | 26 | |
| 26 | 27 | |
| 27 | 28 | /****************************************************************************** |
| r4135 | r4136 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "cpu/upd7810/upd7810.h" |
| 3 | #include "sound/speaker.h" | |
| 3 | 4 | #include "devices/cartslot.h" |
| 4 | 5 | #include "includes/gamepock.h" |
| 5 | 6 | #include "gamepock.lh" |
| r4135 | r4136 | |
|---|---|---|
| 65 | 65 | |
| 66 | 66 | #include "driver.h" |
| 67 | 67 | #include "cpu/z80/z80.h" |
| 68 | #include "sound/speaker.h" | |
| 69 | #include "sound/wave.h" | |
| 68 | 70 | #include "includes/vtech2.h" |
| 69 | 71 | #include "devices/cartslot.h" |
| 70 | 72 | #include "devices/cassette.h" |
| r4135 | r4136 | |
|---|---|---|
| 21 | 21 | #include "machine/z80sio.h" |
| 22 | 22 | #include "cpu/z80/z80.h" |
| 23 | 23 | #include "cpu/z80/z80daisy.h" |
| 24 | #include "sound/speaker.h" | |
| 25 | #include "sound/wave.h" | |
| 24 | 26 | #include "machine/nec765.h" |
| 25 | 27 | |
| 26 | 28 | /* Devices */ |
| r4135 | r4136 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | New System Drivers Supported (in no particular order): |
| 4 | 4 | ------------------------------------------------------ |
| 5 | Intelligent Software Enterprise 64 [Dirk Best] | |
| 6 | Hegener & Glaser Mephisto PHC 64 [Dirk Best] | |
| 5 | - Intelligent Software Enterprise 64 [Dirk Best] | |
| 6 | - Hegener & Glaser Mephisto PHC 64 [Dirk Best] | |
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | System Driver Changes: |
| 11 | 11 | ---------------------- |
| 12 | - [X68000] Added better implementation of 1024x1024 graphic layer. [Barry Rodewald] | |
| 13 | ||
| 14 | 12 | - [TI81, TI85, TI86] Added the new ROM_DEFAULT_BIOS feature to select the most |
| 15 | 13 | recent rom versions. [Hobie Troxell] |
| 16 | 14 | |
| 15 | - [X68000] Added better implementation of 1024x1024 graphic layer. [Barry Rodewald] | |
| 17 | 16 | |
| 18 | 17 | |
| 18 | ||
| 19 | 19 | User Interface Changes: |
| 20 | 20 | ----------------------- |
| 21 | 21 | (none) |
| r4135 | r4136 | |
| 30 | 30 | |
| 31 | 31 | Source Changes: |
| 32 | 32 | ---------------- |
| 33 | - The core is based on MAME 0.129u1. This incorporates all features of the | |
| 34 | update to this core. [MAME team] | |
| 35 | ||
| 33 | 36 | - Changed the DS1315 implementation to be a device. [Nathan Woods] |
| 34 | - Changed the AT45DBxx and SST39VFxx to be a device [Miodrag Milanovic] | |
| 35 | 37 | |
| 38 | - Changed the AT45DBxx and SST39VFxx to be a device. [Miodrag Milanovic] | |
| 39 | ||
| 36 | 40 | - Fixed a bug that caused the day of the week to not be properly returned by |
| 37 | 41 | the DS1315. (bug #1755) [Nathan Woods] |
| 38 | 42 |
| Previous | 15994 Revisions | Next |