| Previous | 15994 Revisions | Next |
| r2845 Thursday 12th June, 2008 at 23:55:42 UTC by Nathan Woods |
|---|
| Updated to MAME 0.125u5 core |
| [docs] | messnew.txt |
| [src/emu] | cheat.c cpuexec.h cpuintrf.c emuopts.c emuopts.h inptport.c rendersw.c video.h |
| [src/emu/cpu] | cpu.mak drcbec.c drcbex64.c drcbex86.c drcfe.c drcfe.h drcuml.c drcuml.h drcumlsh.h |
| [src/emu/cpu/cop400] | 410ops.c 420ops.c cop400.h cop420.c |
| [src/emu/cpu/i8051] | i8051.c |
| [src/emu/cpu/i8085] | i8085.c i8085cpu.h |
| [src/emu/cpu/minx] | minxops.h |
| [src/emu/cpu/mips] | mips3.h mips3drc.c mips3fe.c mips3fe.h |
| [src/emu/cpu/powerpc] | ppc.h ppccom.c ppccom.h ppcdrc.c ppcfe.c ppcfe.h |
| [src/emu/cpu/saturn] | satops.c sattable.c |
| [src/emu/debug] | debugcmd.c |
| [src/emu/drivers] | xtal.h |
| [src/emu/machine] | 53c810.c 53c810.h 68681.c 68681.h pc16552d.c |
| [src/emu/sound] | gaelco.h namco.h scsp.h sn76496.c tms5220.c |
| [src/emu/video] | generic.c v9938.c |
| [src/mame] | mame.mak mamedriv.c |
| [src/mame/audio] | cchasm.c cyberbal.c galaxian.c |
| [src/mame/drivers] | 40love.c ajax.c aleck64.c ampoker2.c amspdwy.c angelkds.c arabian.c asteroid.c astrocorp.c asuka.c atarig1.c atarig42.c atarigt.c atarigx2.c atarisy1.c atarisy2.c backfire.c badlands.c bagman.c balsente.c baraduke.c batman.c bbusters.c beathead.c beezer.c bfcobra.c bfm_sc2.c bigevglf.c bigfghtr.c bionicc.c bishi.c bishjan.c bking.c blackt96.c bladestl.c blmbycar.c blockade.c blstroid.c bmcbowl.c bnstars.c boxer.c bsktball.c btime.c btoads.c bublbobl.c buggychl.c bwing.c bzone.c cabal.c calomega.c canyon.c capbowl.c carpolo.c cave.c cbuster.c ccastles.c centiped.c chaknpop.c cham24.c champbwl.c changela.c chqflag.c cidelsa.c cischeat.c citycon.c cliffhgr.c cloak.c cloud9.c cninja.c cojag.c combatsc.c coolpool.c copsnrob.c cosmic.c cps1.c cps3.c crgolf.c crshrace.c crystal.c cshooter.c csk.c cvs.c cyberbal.c dacholer.c dambustr.c darkseal.c dassault.c dblewing.c dcheese.c ddayjlc.c ddragon.c deadang.c deco156.c destroyr.c dgpix.c dietgo.c djboy.c djmain.c dominob.c dragrace.c dreamwld.c dribling.c dunhuang.c esd16.c expro02.c fastfred.c firebeat.c flstory.c funkybee.c gaelco2.c galaxian.c galaxold.c galdrvr.c gaplus.c gstriker.c gticlub.c guab.c hornet.c igs_180.c itgambl2.c itgambl3.c* itgamble.c jackal.c jcross.c kaneko16.c kinstb.c konamigq.c konamigv.c ksys573.c legionna.c lkage.c lsasquad.c m90.c mainsnk.c marvins.c matmania.c megadriv.h megaplay.c megasys1.c megatech.c mexico86.c mirage.c missb2.c model1.c model3.c msisaac.c multigam.c namcos1.c namcos10.c namcos11.c namcos12.c naomi.c neodrvr.c nitedrvr.c nss.c nwk-tr.c nycaptor.c opwolf.c peplus.c pgm.c pitnrun.c playch10.c polepos.c progolf.c punchout.c raiden2.c rainbow.c retofinv.c scobra.c segac2.c segahang.c segaorun.c segas16a.c segas16b.c segas18.c segaxbd.c segaybd.c seibuspi.c seta.c seta2.c simpsons.c skullxbo.c slapfght.c snookr10.c snowbros.c stfight.c stv.c stvinit.c subsino.c* suprnova.c system16.c taito_f2.c taito_x.c taitojc.c taitosj.c tecmosys.c thayers.c tmaster.c tnzs.c toaplan2.c tourtabl.c ultrsprt.c vball.c volfied.c vsnes.c wrally.c zn.c zr107.c |
| [src/mame/includes] | ajax.h* arkanoid.h bagman.h* beezer.h* bigevglf.h* btime.h* bublbobl.h* buggychl.h* cchip.h* chaknpop.h* cloak.h dc.h deco16ic.h decoprot.h fastfred.h flstory.h* gaelco2.h* gaelcrpt.h galaxian.h galaxold.h gaplus.h* genesis.h gstriker.h irobot.h jackal.h* kaneko16.h legionna.h* lkage.h* lsasquad.h* matmania.h* megasys1.h mexico86.h* model1.h* model3.h* n64.h namcos1.h* namcos2.h nitedrvr.h nycaptor.h* pgm.h pitnrun.h* playch10.h* polepos.h psx.h raiden2.h* retofinv.h* segag80r.h seibuspi.h* seta.h simpsons.h* skullxbo.h slapfght.h* snes.h stfight.h* stv.h* system16.h taito_f2.h taitosj.h* tatsumi.h vsnes.h* wrally.h* |
| [src/mame/machine] | ajax.c asteroid.c atari.c bagman.c balsente.c beezer.c bigevglf.c bonzeadv.c bsktball.c btime.c bublbobl.c buggychl.c carpolo.c chaknpop.c copsnrob.c daikaiju.c deco156.c flstory.c gaelco2.c gaelcrpt.c gaplus.c irobot.c jackal.c kaneko16.c lkage.c lsasquad.c maniach.c mexico86.c model1.c model3.c n64.c namcos1.c namcos2.c nycaptor.c opwolf.c pitnrun.c playch10.c psx.c r2crypt.c rainbow.c retofinv.c scramble.c scudsp.c seibuspi.c seicop.c seicop.h* simpsons.c slapfght.c spisprit.c stfight.c taitosj.c volfied.c vsnes.c wrally.c |
| [src/mame/video] | aeroboto.c airbustr.c ajax.c ampoker2.c argus.c arkanoid.c atari.c atarig1.c atarig42.c atarigt.c atarigx2.c atarirle.c atarirle.h bagman.c beezer.c bigevglf.c bking.c blockade.c blockout.c boogwing.c btime.c bublbobl.c buggychl.c bwing.c calomega.c canyon.c cbuster.c centiped.c chaknpop.c cischeat.c citycon.c cninja.c combatsc.c darkseal.c dassault.c dc.c dcheese.c dec0.c deco16ic.c deco32.c deco_mlc.c dietgo.c djboy.c esd16.c fastfred.c flstory.c funkybee.c funkyjet.c gaelco2.c galaxian.c galaxold.c galpanic.c gameplan.c gaplus.c genesis.c gticlub.c gticlub.h harddriv.c irobot.c jackal.c jaguar.c jalblend.c kan_pand.c kan_pand.h kaneko16.c konamiic.c konamiic.h legionna.c leland.c lkage.c lsasquad.c m10.c m72.c m90.c mainsnk.c matmania.c mcr.c metro.c mexico86.c midzeus2.c model1.c model3.c mrdo.c ms32.c n64.c namcona1.c namcos1.c namcos2.c namcos21.c nbmj8891.c nbmj8991.c nbmj9195.c niyanpai.c nycaptor.c pastelg.c pitnrun.c pktgaldx.c playch10.c polepos.c ppu2c0x.c ppu2c0x.h psikyosh.c psx.c psychic5.c punchout.c realbrk.c retofinv.c rockola.c rohga.c segag80r.c segaic16.c segaic16.h segas18.c segas32.c segasyse.c seibuspi.c seta.c simpl156.c simpsons.c skullxbo.c slapfght.c slapshot.c snk.c snookr10.c stfight.c stvvdp1.c stvvdp2.c supbtime.c suprnova.c system16.c taito_f2.c taito_f3.c taito_h.c taitoair.c taitoic.h taitojc.c taitosj.c tatsumi.c tia.c tia.h toaplan2.c tumblep.c vaportra.c vball.c vdc.c vsnes.c wrally.c |
| [src/mess] | mess.mak |
| [src/mess/drivers] | a2600.c cpschngr.c dc.c psx.c |
| [src/mess/machine] | bebox.c |
| [src/mess/video] | nes.c |
| r2844 | r2845 | |
|---|---|---|
| 21 | 21 | switch (offset & 0x61 ) |
| 22 | 22 | { |
| 23 | 23 | case 0x00: |
| 24 | coin = (input_port_read | |
| 24 | coin = (input_port_read | |
| 25 | 25 | if (coin != 0x7) coin |= 0x8; |
| 26 | 26 | return sound_flags | coin; |
| 27 | 27 | |
| r2844 | r2845 | |
| 118 | 118 | sound_flags &= ~0x40; |
| 119 | 119 | return soundlatch4_r (machine,offset) << 8; |
| 120 | 120 | case 0x2: |
| 121 | return (sound_flags| (input_port_read | |
| 121 | return (sound_flags| (input_port_read | |
| 122 | 122 | case 0x5: |
| 123 | return input_port_read | |
| 123 | return input_port_read | |
| 124 | 124 | case 0x8: |
| 125 | return input_port_read | |
| 125 | return input_port_read | |
| 126 | 126 | default: |
| 127 | 127 | return 0xff << 8; |
| 128 | 128 | } |
| r2844 | r2845 | |
| 168 | 168 | |
| 169 | 169 | static TIMER_CALLBACK( cchasm_sh_update ) |
| 170 | 170 | { |
| 171 | if ((input_port_read | |
| 171 | if ((input_port_read | |
| 172 | 172 | z80ctc_0_trg0_w (machine, 0, 1); |
| 173 | 173 | } |
| 174 | 174 |
| r2844 | r2845 | |
|---|---|---|
| 40 | 40 | |
| 41 | 41 | READ8_HANDLER( cyberbal_special_port3_r ) |
| 42 | 42 | { |
| 43 | int temp = input_port_read_indexed(machine, 3); | |
| 44 | if (!(input_port_read_indexed(machine, 0) & 0x8000)) temp ^= 0x80; | |
| 43 | int temp = input_port_read(machine, "JSAII"); | |
| 44 | if (!(input_port_read(machine, "IN0") & 0x8000)) temp ^= 0x80; | |
| 45 | 45 | if (atarigen_cpu_to_sound_ready) temp ^= 0x40; |
| 46 | 46 | if (atarigen_sound_to_cpu_ready) temp ^= 0x20; |
| 47 | 47 | return temp; |
| r2844 | r2845 | |
|---|---|---|
| 2 | 2 | #include "streams.h" |
| 3 | 3 | #include "deprecat.h" |
| 4 | 4 | #include "sound/samples.h" |
| 5 | #include "includes/galax | |
| 5 | #include "includes/galaxian.h" | |
| 6 | 6 | |
| 7 | 7 | #define VERBOSE 0 |
| 8 | 8 |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "includes/nycaptor.h" | |
| 11 | 12 | |
| 12 | 13 | static UINT8 from_main,from_mcu; |
| 13 | 14 | static int mcu_sent = 0,main_sent = 0; |
| r2844 | r2845 | |
|---|---|---|
| 1 | ||
| 2 | 1 | #include "driver.h" |
| 2 | #include "includes/btime.h" | |
| 3 | 3 | |
| 4 | 4 | |
| 5 | 5 | #define BASE 0xb000 |
| r2844 | r2845 | |
|---|---|---|
| 49 | 49 | |
| 50 | 50 | #include "driver.h" |
| 51 | 51 | #include "deprecat.h" |
| 52 | #include "includes/cchip.h" | |
| 52 | 53 | |
| 53 | 54 | static UINT8* CRAM[8]; |
| 54 | 55 |
| r2844 | r2845 | |
|---|---|---|
| 53 | 53 | #include "deprecat.h" |
| 54 | 54 | #include "machine/scudsp.h" |
| 55 | 55 | #include "osd_cpu.h" |
| 56 | #include "sound/scsp.h" | |
| 56 | 57 | |
| 57 | 58 | /*DSP macros*/ |
| 58 | 59 | #define PRF ((stv_scu[32] & 0x04000000) >> 26) |
| r2844 | r2845 | |
| 104 | 105 | UINT32 internal_prg[0x100]; |
| 105 | 106 | } dsp_reg; |
| 106 | 107 | |
| 107 | extern UINT32* stv_scu; | |
| 108 | ||
| 109 | 108 | static UINT32 opcode; |
| 110 | 109 | static UINT8 update_mul = 0; |
| 111 | 110 |
| r2844 | r2845 | |
|---|---|---|
| 2 | 2 | #include "deprecat.h" |
| 3 | 3 | #include "video/ppu2c0x.h" |
| 4 | 4 | #include "machine/rp5h01.h" |
| 5 | #include "includes/playch10.h" | |
| 5 | 6 | |
| 6 | 7 | /* Globals */ |
| 7 | 8 | int pc10_sdcs; /* ShareD Chip Select */ |
| r2844 | r2845 | |
| 49 | 50 | RP5H01_enable_w( 0, 1 ); |
| 50 | 51 | |
| 51 | 52 | /* reset the ppu */ |
| 52 | ppu2c0x_reset( 0, /* video_screen_get_scan_period(machine->primary_screen) * */ 1 ); | |
| 53 | ppu2c0x_reset( machine, 0, /* video_screen_get_scan_period(machine->primary_screen) * */ 1 ); | |
| 53 | 54 | |
| 54 | 55 | ppu2c0x_set_mirroring( 0, mirroring ); |
| 55 | 56 | } |
| r2844 | r2845 | |
| 113 | 114 | WRITE8_HANDLER( pc10_PPURES_w ) |
| 114 | 115 | { |
| 115 | 116 | if ( data & 1 ) |
| 116 | ppu2c0x_reset( 0, /* video_screen_get_scan_period(machine->primary_screen) * */ 1 ); | |
| 117 | ppu2c0x_reset( machine, 0, /* video_screen_get_scan_period(machine->primary_screen) * */ 1 ); | |
| 117 | 118 | } |
| 118 | 119 | |
| 119 | 120 | READ8_HANDLER( pc10_detectclr_r ) |
| r2844 | r2845 | |
|---|---|---|
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "deprecat.h" |
| 12 | 12 | #include "cpu/z80/z80.h" |
| 13 | #include "includes/bublbobl.h" | |
| 13 | 14 | |
| 14 | 15 | |
| 15 | ||
| 16 | 16 | UINT8 *bublbobl_mcu_sharedram; |
| 17 | extern int bublbobl_video_enable; | |
| 18 | 17 | |
| 19 | 18 | |
| 20 | 19 | WRITE8_HANDLER( bublbobl_bankswitch_w ) |
| r2844 | r2845 | |
| 181 | 180 | READ8_HANDLER( bublbobl_mcu_port1_r ) |
| 182 | 181 | { |
| 183 | 182 | //logerror("%04x: 6801U4 port 1 read\n",activecpu_get_pc()); |
| 184 | port1_in = input_port_read | |
| 183 | port1_in = input_port_read | |
| 185 | 184 | return (port1_out & ddr1) | (port1_in & ~ddr1); |
| 186 | 185 | } |
| 187 | 186 | |
| r2844 | r2845 | |
| 217 | 216 | WRITE8_HANDLER( bublbobl_mcu_port2_w ) |
| 218 | 217 | { |
| 219 | 218 | //logerror("%04x: 6801U4 port 2 write %02x\n",activecpu_get_pc(),data); |
| 219 | static const char *portnames[] = { "DSW0", "DSW1", "IN1", "IN2" }; | |
| 220 | 220 | |
| 221 | 221 | // bits 0-3: bits 8-11 of shared RAM address |
| 222 | 222 | |
| r2844 | r2845 | |
| 230 | 230 | { |
| 231 | 231 | // read |
| 232 | 232 | if ((address & 0x0800) == 0x0000) |
| 233 | port3_in = input_port_read | |
| 233 | port3_in = input_port_read | |
| 234 | 234 | else if ((address & 0x0c00) == 0x0c00) |
| 235 | 235 | port3_in = bublbobl_mcu_sharedram[address & 0x03ff]; |
| 236 | 236 | // logerror("reading %02x from shared RAM %04x\n",port3_in,address); |
| r2844 | r2845 | |
| 430 | 430 | WRITE8_HANDLER( bublbobl_68705_portB_w ) |
| 431 | 431 | { |
| 432 | 432 | //logerror("%04x: 68705 port B write %02x\n",activecpu_get_pc(),data); |
| 433 | static const char *portnames[] = { "DSW0", "DSW1", "IN1", "IN2" }; | |
| 433 | 434 | |
| 434 | 435 | if ((ddrB & 0x01) && (~data & 0x01) && (portB_out & 0x01)) |
| 435 | 436 | { |
| r2844 | r2845 | |
| 451 | 452 | if ((address & 0x0800) == 0x0000) |
| 452 | 453 | { |
| 453 | 454 | //logerror("%04x: 68705 read input port %02x\n",activecpu_get_pc(),address); |
| 454 | latch = input_port_read | |
| 455 | latch = input_port_read | |
| 455 | 456 | } |
| 456 | 457 | else if ((address & 0x0c00) == 0x0c00) |
| 457 | 458 | { |
| r2844 | r2845 | |
|---|---|---|
| 843 | 843 | { |
| 844 | 844 | size = image_fread(image, &mem[0x12000], 0x2000); |
| 845 | 845 | a800_cart_is_16k = (size == 0x2000); |
| 846 | logerror("%s loaded right cartridge '%s' size 16K\n", | |
| 846 | logerror("%s loaded right cartridge '%s' size 16K\n", image->machine->gamedrv->name, image_filename(image) ); | |
| 847 | 847 | } |
| 848 | 848 | else |
| 849 | 849 | { |
| r2844 | r2845 | |
| 851 | 851 | a800_cart_loaded = size > 0x0000; |
| 852 | 852 | size = image_fread(image, &mem[0x12000], 0x2000); |
| 853 | 853 | a800_cart_is_16k = size > 0x2000; |
| 854 | logerror("%s loaded left cartridge '%s' size %s\n", | |
| 854 | logerror("%s loaded left cartridge '%s' size %s\n", image->machine->gamedrv->name, image_filename(image) , (a800_cart_is_16k) ? "16K":"8K"); | |
| 855 | 855 | } |
| 856 | 856 | return INIT_PASS; |
| 857 | 857 | } |
| r2844 | r2845 | |
| 895 | 895 | file_error filerr; |
| 896 | 896 | unsigned size; |
| 897 | 897 | |
| 898 | fname = astring_assemble_3(astring_alloc(), | |
| 898 | fname = astring_assemble_3(astring_alloc(), image->machine->gamedrv->name, PATH_SEPARATOR, "basic.rom"); | |
| 899 | 899 | filerr = mame_fopen(SEARCHPATH_ROM, astring_c(fname), OPEN_FLAG_READ, &basic_fp); |
| 900 | 900 | astring_free(fname); |
| 901 | 901 | |
| r2844 | r2845 | |
| 904 | 904 | size = mame_fread(basic_fp, &mem[0x14000], 0x2000); |
| 905 | 905 | if( size < 0x2000 ) |
| 906 | 906 | { |
| 907 | logerror("%s image '%s' load failed (less than 8K)\n", | |
| 907 | logerror("%s image '%s' load failed (less than 8K)\n", image->machine->gamedrv->name, astring_c(fname)); | |
| 908 | 908 | mame_fclose(basic_fp); |
| 909 | 909 | return 2; |
| 910 | 910 | } |
| r2844 | r2845 | |
| 919 | 919 | size = image_fread(image, &mem[0x16000], 0x2000); |
| 920 | 920 | a800_cart_is_16k = size / 0x2000; |
| 921 | 921 | logerror("%s loaded cartridge '%s' size %s\n", |
| 922 | | |
| 922 | image->machine->gamedrv->name, image_filename(image), (a800_cart_is_16k) ? "16K":"8K"); | |
| 923 | 923 | } |
| 924 | 924 | mame_fclose(basic_fp); |
| 925 | 925 | } |
| r2844 | r2845 | |
| 967 | 967 | } |
| 968 | 968 | } |
| 969 | 969 | logerror("%s loaded cartridge '%s' size %dK\n", |
| 970 | | |
| 970 | image->machine->gamedrv->name, image_filename(image) , size/1024); | |
| 971 | 971 | return INIT_PASS; |
| 972 | 972 | } |
| 973 | 973 |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "includes/flstory.h" | |
| 11 | 12 | |
| 12 | extern UINT8 *onna34ro_workram; | |
| 13 | extern UINT8 *victnine_workram; | |
| 14 | ||
| 15 | 13 | static UINT8 from_main,from_mcu; |
| 16 | 14 | static int mcu_sent = 0,main_sent = 0; |
| 17 | 15 |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "includes/slapfght.h" | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | UINT8 *slapfight_dpram; |
| r2844 | r2845 | |
| 18 | 19 | static int getstar_sh_intenabled; |
| 19 | 20 | |
| 20 | 21 | static int slapfight_status_state; |
| 21 | extern UINT8 *getstar_e803; | |
| 22 | 22 | |
| 23 | 23 | static UINT8 mcu_val; |
| 24 | 24 |
| r2844 | r2845 | |
|---|---|---|
| 122 | 122 | int res; |
| 123 | 123 | int res1; |
| 124 | 124 | |
| 125 | res1 = input_port_read(machine, "DSW"); | |
| 125 | res1 = input_port_read(machine, "DSW1"); | |
| 126 | 126 | |
| 127 | 127 | res = 0xfc | ((res1 >> (2 * (3 - (offset & 0x3)))) & 0x3); |
| 128 | 128 | return res; |
| r2844 | r2845 | |
|---|---|---|
| 25 | 25 | default: |
| 26 | 26 | case 0x00: |
| 27 | 27 | current_car_image = copsnrob_carimage[0]; |
| 28 | keys = input_port_read | |
| 28 | keys = input_port_read | |
| 29 | 29 | break; |
| 30 | 30 | case 0x04: |
| 31 | 31 | current_car_image = copsnrob_carimage[1]; |
| 32 | keys = input_port_read | |
| 32 | keys = input_port_read | |
| 33 | 33 | break; |
| 34 | 34 | case 0x08: |
| 35 | 35 | current_car_image = copsnrob_carimage[2]; |
| 36 | keys = input_port_read | |
| 36 | keys = input_port_read | |
| 37 | 37 | break; |
| 38 | 38 | case 0x0c: |
| 39 | 39 | current_car_image = copsnrob_carimage[3]; |
| 40 | keys = input_port_read | |
| 40 | keys = input_port_read | |
| 41 | 41 | break; |
| 42 | 42 | } |
| 43 | 43 |
| r2844 | r2845 | |
|---|---|---|
| 100 | 100 | irobot_combase_mb = comRAM[(data >> 7) ^ 1]; |
| 101 | 101 | irobot_bufsel = data & 0x02; |
| 102 | 102 | if (((data & 0x01) == 0x01) && (irobot_vg_clear == 0)) |
| 103 | irobot_poly_clear(); | |
| 103 | irobot_poly_clear(machine); | |
| 104 | 104 | |
| 105 | 105 | irobot_vg_clear = data & 0x01; |
| 106 | 106 |
| r2844 | r2845 | |
|---|---|---|
| 22 | 22 | *************************************************************************/ |
| 23 | 23 | |
| 24 | 24 | #include "driver.h" |
| 25 | #include "includes/cchip.h" | |
| 25 | 26 | |
| 26 | 27 | static int current_round = 0; |
| 27 | 28 | static int current_bank = 0; |
| r2844 | r2845 | |
|---|---|---|
| 99 | 99 | ***************************************************************************/ |
| 100 | 100 | #include "driver.h" |
| 101 | 101 | #include "cpu/z80/z80.h" |
| 102 | #include "includes/lsasquad.h" | |
| 102 | 103 | |
| 103 | 104 | #define ID_DAIKAIJU 0x5a |
| 104 | 105 | |
| r2844 | r2845 | |
| 124 | 125 | daikaiju_cntr=0; |
| 125 | 126 | |
| 126 | 127 | |
| 127 | extern int lsasquad_sound_pending; | |
| 128 | 128 | static int daikaiju_xor, daikaiju_command, daikaiju_length, daikaiju_prev, daikaiju_cnt, daikaiju_cntr; |
| 129 | 129 | |
| 130 | 130 | static int daikaiju_buffer[256]; |
| r2844 | r2845 | |
| 338 | 338 | |
| 339 | 339 | READ8_HANDLER( daikaiju_mcu_status_r ) |
| 340 | 340 | { |
| 341 | int res = input_port_read | |
| 341 | int res = input_port_read | |
| 342 | 342 | |
| 343 | 343 | res^=mame_rand(machine)&3; |
| 344 | 344 | res |=((lsasquad_sound_pending & 0x02)^2)<<3; //inverted flag |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "includes/seibuspi.h" | |
| 2 | 3 | |
| 3 | 4 | |
| 4 | 5 |
| r2844 | r2845 | |
|---|---|---|
| 12 | 12 | #include "machine/8255ppi.h" |
| 13 | 13 | #include "includes/galaxold.h" |
| 14 | 14 | |
| 15 | static UINT8 moonwar_port_select; | |
| 16 | ||
| 17 | 15 | static UINT8 cavelon_bank; |
| 18 | 16 | |
| 19 | 17 | static UINT8 security_2B_counter; |
| r2844 | r2845 | |
| 37 | 35 | sfx_sh_init(); |
| 38 | 36 | } |
| 39 | 37 | |
| 40 | int monsterz_count = 0; | |
| 38 | static int monsterz_count = 0; | |
| 41 | 39 | MACHINE_RESET( monsterz ) |
| 42 | 40 | { |
| 43 | 41 | /* |
| r2844 | r2845 | |
| 76 | 74 | } |
| 77 | 75 | |
| 78 | 76 | |
| 79 | static WRITE8_HANDLER( moonwar_port_select_w ) | |
| 80 | { | |
| 81 | moonwar_port_select = data & 0x10; | |
| 82 | } | |
| 83 | ||
| 84 | static READ8_HANDLER( moonwar_input_port_0_r ) | |
| 85 | { | |
| 86 | UINT8 sign; | |
| 87 | UINT8 delta; | |
| 88 | ||
| 89 | delta = (moonwar_port_select ? input_port_read_indexed(machine, 3) : input_port_read_indexed(machine, 4)); | |
| 90 | ||
| 91 | sign = (delta & 0x80) >> 3; | |
| 92 | delta &= 0x0f; | |
| 93 | ||
| 94 | return ((input_port_read_indexed(machine, 0) & 0xe0) | delta | sign ); | |
| 95 | } | |
| 96 | ||
| 97 | ||
| 98 | 77 | /* the coinage DIPs are spread accross two input ports */ |
| 99 | 78 | static READ8_HANDLER( stratgyx_input_port_2_r ) |
| 100 | 79 | { |
| r2844 | r2845 | |
| 265 | 244 | }; |
| 266 | 245 | |
| 267 | 246 | |
| 268 | const ppi8255_interface moonwar_ppi8255_intf[2] = | |
| 269 | { | |
| 270 | { | |
| 271 | moonwar_input_port_0_r, /* Port A read */ | |
| 272 | input_port_1_r, /* Port B read */ | |
| 273 | input_port_2_r, /* Port C read */ | |
| 274 | NULL, /* Port A write */ | |
| 275 | NULL, /* Port B write */ | |
| 276 | moonwar_port_select_w /* Port C write */ | |
| 277 | }, | |
| 278 | { | |
| 279 | NULL, /* Port A read */ | |
| 280 | NULL, /* Port B read */ | |
| 281 | NULL, /* Port C read */ | |
| 282 | soundlatch_w, /* Port A write */ | |
| 283 | scramble_sh_irqtrigger_w, /* Port B write */ | |
| 284 | NULL /* Port C write */ | |
| 285 | } | |
| 286 | }; | |
| 287 | ||
| 288 | ||
| 289 | 247 | const ppi8255_interface darkplnt_ppi8255_intf[2] = |
| 290 | 248 | { |
| 291 | 249 | { |
| r2844 | r2845 | |
| 525 | 483 | state_save_register_global(cavelon_bank); |
| 526 | 484 | } |
| 527 | 485 | |
| 528 | DRIVER_INIT( moonwar ) | |
| 529 | { | |
| 530 | state_save_register_global(moonwar_port_select); | |
| 531 | } | |
| 532 | 486 | |
| 487 | ||
| 533 | 488 | DRIVER_INIT( darkplnt ) |
| 534 | 489 | { |
| 535 | 490 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb00a, 0xb00a, 0, 0, darkplnt_bullet_color_w); |
| r2844 | r2845 | |
| 736 | 691 | free(scratch); |
| 737 | 692 | } |
| 738 | 693 | |
| 739 | DRIVER_INIT( superbon ) | |
| 740 | { | |
| 741 | offs_t i; | |
| 742 | UINT8 *RAM; | |
| 743 | 694 | |
| 744 | ||
| 745 | DRIVER_INIT_CALL(scramble); | |
| 746 | ||
| 747 | /* Deryption worked out by hand by Chris Hardy. */ | |
| 748 | ||
| 749 | RAM = memory_region(REGION_CPU1); | |
| 750 | ||
| 751 | for (i = 0;i < 0x1000;i++) | |
| 752 | { | |
| 753 | /* Code is encrypted depending on bit 7 and 9 of the address */ | |
| 754 | switch (i & 0x0280) | |
| 755 | { | |
| 756 | case 0x0000: | |
| 757 | RAM[i] ^= 0x92; | |
| 758 | break; | |
| 759 | case 0x0080: | |
| 760 | RAM[i] ^= 0x82; | |
| 761 | break; | |
| 762 | case 0x0200: | |
| 763 | RAM[i] ^= 0x12; | |
| 764 | break; | |
| 765 | case 0x0280: | |
| 766 | RAM[i] ^= 0x10; | |
| 767 | break; | |
| 768 | } | |
| 769 | } | |
| 770 | } | |
| 771 | ||
| 772 | ||
| 773 | 695 | DRIVER_INIT( hustler ) |
| 774 | 696 | { |
| 775 | 697 | offs_t A; |
| r2844 | r2845 | |
|---|---|---|
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "machine/namcoio.h" |
| 12 | 12 | #include "sound/samples.h" |
| 13 | #include "includes/gaplus.h" | |
| 13 | 14 | |
| 14 | 15 | UINT8 *gaplus_customio_3; |
| 15 | 16 |
| r2844 | r2845 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/m6805/m6805.h" |
| 12 | #include "includes/pitnrun.h" | |
| 12 | 13 | |
| 13 | 14 | |
| 14 | 15 | static UINT8 fromz80,toz80; |
| r2844 | r2845 | |
|---|---|---|
| 241 | 241 | |
| 242 | 242 | |
| 243 | 243 | /* check the coins here as well - they drive the clock of the flip-flops */ |
| 244 | port_value = input_port_read | |
| 244 | port_value = input_port_read | |
| 245 | 245 | |
| 246 | 246 | TTL7474_clock_w(TTL7474_2S_1, port_value & 0x01); |
| 247 | 247 | TTL7474_clock_w(TTL7474_2S_2, port_value & 0x02); |
| r2844 | r2845 | |
| 259 | 259 | { |
| 260 | 260 | int movement_flip_flop = TTL7474_1F_1 + (2 * player); |
| 261 | 261 | int dir_flip_flop = movement_flip_flop + 1; |
| 262 | static const char *portnames[] = { "DIAL0", "DIAL1", "DIAL2", "DIAL3" }; | |
| 262 | 263 | |
| 264 | port_value = input_port_read(machine, portnames[player]); | |
| 263 | 265 | |
| 264 | port_value = input_port_read_indexed(machine, 2 + player); | |
| 265 | ||
| 266 | 266 | if (port_value != last_wheel_value[player]) |
| 267 | 267 | { |
| 268 | 268 | /* set the movement direction */ |
| r2844 | r2845 | |
| 282 | 282 | |
| 283 | 283 | |
| 284 | 284 | /* finally read the accelerator pedals */ |
| 285 | port_value = input_port_read | |
| 285 | port_value = input_port_read | |
| 286 | 286 | |
| 287 | 287 | for (player = 0; player < 4; player++) |
| 288 | 288 | { |
| r2844 | r2845 | |
| 446 | 446 | (TTL7474_output_r(TTL7474_1C_2) ? 0x02 : 0x00) | |
| 447 | 447 | (TTL7474_output_r(TTL7474_1D_2) ? 0x04 : 0x00) | |
| 448 | 448 | (TTL7474_output_r(TTL7474_1F_2) ? 0x08 : 0x00) | |
| 449 | (input_port_read | |
| 449 | (input_port_read | |
| 450 | 450 | |
| 451 | 451 | return ret; |
| 452 | 452 | } |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "sound/ym2151.h" |
| 3 | 3 | #include "sound/namco.h" |
| 4 | #include "includes/namcos1.h" | |
| 4 | 5 | |
| 5 | 6 | #define NAMCOS1_MAX_BANK 0x400 |
| 6 | 7 | |
| 7 | /* from drivers */ | |
| 8 | void namcos1_init_DACs(void); | |
| 9 | ||
| 10 | /* from video */ | |
| 11 | READ8_HANDLER( namcos1_videoram_r ); | |
| 12 | WRITE8_HANDLER( namcos1_videoram_w ); | |
| 13 | WRITE8_HANDLER( namcos1_paletteram_w ); | |
| 14 | READ8_HANDLER( namcos1_spriteram_r ); | |
| 15 | WRITE8_HANDLER( namcos1_spriteram_w ); | |
| 16 | extern void namcos1_set_scroll_offsets( const int *bgx, const int *bgy, int negative, int optimize ); | |
| 17 | extern void namcos1_set_sprite_offsets( int x, int y ); | |
| 18 | ||
| 19 | 8 | UINT8 *namcos1_paletteram; |
| 20 | 9 | |
| 21 | 10 | static UINT8 *namcos1_triram; |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "cpu/z80/z80.h" |
| 3 | #include "includes/buggychl.h" | |
| 3 | 4 | |
| 4 | 5 | |
| 5 | 6 | static UINT8 from_main,from_mcu; |
| r2844 | r2845 | |
|---|---|---|
| 31 | 31 | */ |
| 32 | 32 | |
| 33 | 33 | #include "driver.h" |
| 34 | #include "includes/decocrpt.h" | |
| 34 | 35 | |
| 35 | 36 | |
| 36 | 37 | static void decrypt(UINT32 *src, UINT32 *dst, int length) |
| r2844 | r2845 | |
|---|---|---|
| 27 | 27 | static UINT32 mi_interrupt = 0; |
| 28 | 28 | static UINT32 mi_intr_mask = 0; |
| 29 | 29 | |
| 30 | extern int fb_width; | |
| 31 | ||
| 32 | 30 | void signal_rcp_interrupt(int interrupt) |
| 33 | 31 | { |
| 34 | 32 | if (mi_intr_mask & interrupt) |
| r2844 | r2845 | |
| 1174 | 1172 | { |
| 1175 | 1173 | UINT16 buttons = 0; |
| 1176 | 1174 | INT8 x = 0, y = 0; |
| 1175 | /* add here tags for P2, P3 and P4 when implemented */ | |
| 1176 | static const char *portnames[] = { "P1", "P1_ANALOG_X", "P1_ANALOG_Y" }; | |
| 1177 | ||
| 1177 | 1178 | if (slength != 1 || rlength != 4) |
| 1178 | 1179 | { |
| 1179 | 1180 | fatalerror("handle_pif: read button values (bytes to send %d, bytes to receive %d)\n", slength, rlength); |
| r2844 | r2845 | |
| 1183 | 1184 | { |
| 1184 | 1185 | case 0: |
| 1185 | 1186 | { |
| 1186 | buttons = input_port_read_indexed(machine, (channel*3) + 0); | |
| 1187 | x = input_port_read_indexed(machine, (channel*3) + 1) - 128; | |
| 1188 | y = input_port_read_indexed(machine, (channel*3) + 2) - 128; | |
| 1187 | buttons = input_port_read(machine, portnames[(channel*3) + 0]); | |
| 1188 | x = input_port_read(machine, portnames[(channel*3) + 1]) - 128; | |
| 1189 | y = input_port_read(machine, portnames[(channel*3) + 2]) - 128; | |
| 1189 | 1190 | |
| 1190 | 1191 | rdata[0] = (buttons >> 8) & 0xff; |
| 1191 | 1192 | rdata[1] = (buttons >> 0) & 0xff; |
| r2844 | r2845 | |
|---|---|---|
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/z80/z80.h" |
| 12 | 12 | #include "sound/msm5205.h" |
| 13 | #include "includes/stfight.h" | |
| 13 | 14 | |
| 14 | 15 | // this prototype will move to the driver |
| 15 | 16 | static WRITE8_HANDLER( stfight_bank_w ); |
| r2844 | r2845 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | 8 | #include "deprecat.h" |
| 9 | #include "includes/model3.h" | |
| 9 | 10 | |
| 10 | 11 | static int m3_step; |
| 11 | 12 |
| r2844 | r2845 | |
|---|---|---|
| 15 | 15 | *************************************************************************/ |
| 16 | 16 | |
| 17 | 17 | #include "driver.h" |
| 18 | #include "includes/cchip.h" | |
| 18 | 19 | |
| 19 | 20 | static UINT8 current_bank = 0; |
| 20 | 21 | static UINT8 current_flag = 0; |
| r2844 | r2845 | |
|---|---|---|
| 133 | 133 | /* we latch the beam values on the first interrupt after VBLANK */ |
| 134 | 134 | if (param == 64 && balsente_shooter) |
| 135 | 135 | { |
| 136 | balsente_shooter_x = input_port_read_indexed(machine, 8); | |
| 137 | balsente_shooter_y = input_port_read_indexed(machine, 9); | |
| 136 | balsente_shooter_x = input_port_read(machine, "FAKEX"); | |
| 137 | balsente_shooter_y = input_port_read(machine, "FAKEY"); | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /* which bits get returned depends on which scanline we're at */ |
| r2844 | r2845 | |
| 605 | 605 | INTERRUPT_GEN( balsente_update_analog_inputs ) |
| 606 | 606 | { |
| 607 | 607 | int i; |
| 608 | static const char *analog[] = { "AN0", "AN1", "AN2", "AN3" }; | |
| 608 | 609 | |
| 609 | 610 | /* the analog input system helpfully scales the value read by the percentage of time */ |
| 610 | 611 | /* into the current frame we are; unfortunately, this is bad for us, since the analog */ |
| 611 | 612 | /* ports are read once a frame, just at varying intervals. To get around this, we */ |
| 612 | 613 | /* read all the analog inputs at VBLANK time and just return the cached values. */ |
| 613 | 614 | for (i = 0; i < 4; i++) |
| 614 | analog_input_data[i] = input_port_read | |
| 615 | analog_input_data[i] = input_port_read | |
| 615 | 616 | } |
| 616 | 617 | |
| 617 | 618 | |
| r2844 | r2845 | |
| 1122 | 1123 | |
| 1123 | 1124 | READ8_HANDLER( nstocker_port2_r ) |
| 1124 | 1125 | { |
| 1125 | return (input_port_read | |
| 1126 | return (input_port_read | |
| 1126 | 1127 | } |
| 1127 | 1128 | |
| 1128 | 1129 | |
| r2844 | r2845 | |
| 1167 | 1168 | INT8 diff[3]; |
| 1168 | 1169 | |
| 1169 | 1170 | /* read the current steering values */ |
| 1170 | wheel[0] = input_port_read_indexed(machine, 4); | |
| 1171 | wheel[1] = input_port_read_indexed(machine, 5); | |
| 1172 | wheel[2] = input_port_read_indexed(machine, 6); | |
| 1171 | wheel[0] = input_port_read(machine, "AN0"); | |
| 1172 | wheel[1] = input_port_read(machine, "AN1"); | |
| 1173 | wheel[2] = input_port_read(machine, "AN2"); | |
| 1173 | 1174 | |
| 1174 | 1175 | /* diff the values */ |
| 1175 | 1176 | diff[0] = wheel[0] - grudge_last_steering[0]; |
| r2844 | r2845 | |
|---|---|---|
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "deprecat.h" |
| 12 | 12 | #include "video/ppu2c0x.h" |
| 13 | #include "includes/vsnes.h" | |
| 13 | 14 | |
| 14 | 15 | /* Globals */ |
| 15 | 16 | static int vsnes_gun_controller; |
| r2844 | r2845 | |
| 223 | 224 | input_latch[2] = input_latch[3] = 0; |
| 224 | 225 | |
| 225 | 226 | /* reset the ppu */ |
| 226 | ppu2c0x_reset( 0, 1 ); | |
| 227 | ppu2c0x_reset( machine, 0, 1 ); | |
| 227 | 228 | |
| 228 | 229 | /* if we need to remap, install the callback */ |
| 229 | 230 | if ( remapped_colortable ) |
| r2844 | r2845 | |
| 241 | 242 | input_latch[2] = input_latch[3] = 0; |
| 242 | 243 | |
| 243 | 244 | /* reset the ppu */ |
| 244 | ppu2c0x_reset( 0,1); | |
| 245 | ppu2c0x_reset( 1,1 ); | |
| 245 | ppu2c0x_reset( machine,0,1 ); | |
| 246 | ppu2c0x_reset( machine,1,1 ); | |
| 246 | 247 | |
| 247 | 248 | /* if we need to remap, install the callback */ |
| 248 | 249 | if ( remapped_colortable ) |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "deprecat.h" |
| 3 | #include "includes/mexico86.h" | |
| 3 | 4 | |
| 4 | 5 | |
| 5 | 6 | UINT8 *mexico86_protection_ram; |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | #include "driver.h" |
| 7 | 7 | #include "cpu/z80/z80.h" |
| 8 | #include "includes/chaknpop.h" | |
| 8 | 9 | |
| 9 | 10 | #define MCU_INITIAL_SEED 0x81 |
| 10 | 11 |
| r2844 | r2845 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/m6805/m6805.h" |
| 12 | #include "includes/taitosj.h" | |
| 12 | 13 | |
| 13 | 14 | |
| 14 | 15 | #define VERBOSE 1 |
| r2844 | r2845 | |
| 24 | 25 | static UINT32 address; |
| 25 | 26 | |
| 26 | 27 | void taitosj_register_main_savestate(void); |
| 27 | WRITE8_HANDLER( taitosj_bankswitch_w ); | |
| 28 | 28 | |
| 29 | 29 | MACHINE_START( taitosj ) |
| 30 | 30 | { |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "includes/lkage.h" | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | static UINT8 from_main,from_mcu; |
| r2844 | r2845 | |
|---|---|---|
| 10 | 10 | ***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | #include "driver.h" |
| 13 | #include "deprecat.h" | |
| 14 | 13 | #include "cpu/m6809/m6809.h" |
| 15 | 14 | #include "cpu/m6805/m6805.h" |
| 16 | 15 | #include "namcos2.h" |
| r2844 | r2845 | |
| 73 | 72 | static UINT8 *namcos2_eeprom; |
| 74 | 73 | |
| 75 | 74 | static void |
| 76 | ResetAllSubCPUs( int state ) | |
| 75 | ResetAllSubCPUs( running_machine *machine, int state ) | |
| 77 | 76 | { |
| 78 | cpunum_set_input_line(Machine, CPU_SLAVE, INPUT_LINE_RESET, state); | |
| 79 | cpunum_set_input_line(Machine, CPU_MCU, INPUT_LINE_RESET, state); | |
| 77 | cpunum_set_input_line(machine, CPU_SLAVE, INPUT_LINE_RESET, state); | |
| 78 | cpunum_set_input_line(machine, CPU_MCU, INPUT_LINE_RESET, state); | |
| 80 | 79 | switch( namcos2_gametype ) |
| 81 | 80 | { |
| 82 | 81 | case NAMCOS21_SOLVALOU: |
| 83 | 82 | case NAMCOS21_STARBLADE: |
| 84 | 83 | case NAMCOS21_AIRCOMBAT: |
| 85 | 84 | case NAMCOS21_CYBERSLED: |
| 86 | cpunum_set_input_line(Machine, 4,INPUT_LINE_RESET,state); /* MASTER DSP */ | |
| 87 | cpunum_set_input_line(Machine, 5,INPUT_LINE_RESET,state); /* SLAVE DSP */ | |
| 85 | cpunum_set_input_line(machine, 4,INPUT_LINE_RESET,state); /* MASTER DSP */ | |
| 86 | cpunum_set_input_line(machine, 5,INPUT_LINE_RESET,state); /* SLAVE DSP */ | |
| 88 | 87 | break; |
| 89 | 88 | |
| 90 | 89 | // case NAMCOS21_WINRUN91: |
| r2844 | r2845 | |
| 110 | 109 | cpunum_set_input_line(machine, CPU_SOUND, INPUT_LINE_RESET, ASSERT_LINE ); |
| 111 | 110 | |
| 112 | 111 | /* Place CPU2 & CPU3 into the reset condition */ |
| 113 | ResetAllSubCPUs( ASSERT_LINE ); | |
| 112 | ResetAllSubCPUs( machine, ASSERT_LINE ); | |
| 114 | 113 | |
| 115 | 114 | /* Initialise interrupt handlers */ |
| 116 | 115 | for(loop=0;loop<0x20;loop++) |
| r2844 | r2845 | |
| 465 | 464 | } |
| 466 | 465 | |
| 467 | 466 | static UINT16 |
| 468 | ReadWriteC148( int cpu, offs_t offset, UINT16 data, int bWrite ) | |
| 467 | ReadWriteC148( running_machine *machine, int cpu, offs_t offset, UINT16 data, int bWrite ) | |
| 469 | 468 | { |
| 470 | 469 | offs_t addr = ((offset*2)+0x1c0000)&0x1fe000; |
| 471 | 470 | UINT16 *pC148Reg = NULL; |
| r2844 | r2845 | |
| 513 | 512 | case 0x1d0000: |
| 514 | 513 | if( bWrite ) |
| 515 | 514 | { |
| 516 | cpunum_set_input_line(Machine, altCPU, pC148RegAlt[NAMCOS2_C148_CPUIRQ], ASSERT_LINE); | |
| 517 | } cpunum_set_input_line(Machine, cpu, pC148Reg[NAMCOS2_C148_0], CLEAR_LINE); | |
| 515 | cpunum_set_input_line(machine, altCPU, pC148RegAlt[NAMCOS2_C148_CPUIRQ], ASSERT_LINE); | |
| 516 | } cpunum_set_input_line(machine, cpu, pC148Reg[NAMCOS2_C148_0], CLEAR_LINE); | |
| 518 | 517 | break; |
| 519 | 518 | |
| 520 | 519 | case 0x1d2000: |
| 521 | cpunum_set_input_line( | |
| 520 | cpunum_set_input_line(machine, cpu, pC148Reg[NAMCOS2_C148_1], CLEAR_LINE); | |
| 522 | 521 | break; |
| 523 | 522 | |
| 524 | 523 | case 0x1d4000: |
| 525 | 524 | if( bWrite ) |
| 526 | 525 | { |
| 527 | cpunum_set_input_line( | |
| 526 | cpunum_set_input_line(machine, altCPU, pC148RegAlt[NAMCOS2_C148_CPUIRQ], ASSERT_LINE); | |
| 528 | 527 | } |
| 529 | cpunum_set_input_line( | |
| 528 | cpunum_set_input_line(machine, cpu, pC148Reg[NAMCOS2_C148_2], CLEAR_LINE); | |
| 530 | 529 | break; |
| 531 | 530 | |
| 532 | 531 | case 0x1d6000: |
| r2844 | r2845 | |
| 534 | 533 | { |
| 535 | 534 | // mame_printf_debug( "cpu(%d) RAM[0x%06x] = 0x%x\n", cpu, addr, data ); |
| 536 | 535 | } |
| 537 | cpunum_set_input_line( | |
| 536 | cpunum_set_input_line(machine, cpu, pC148Reg[NAMCOS2_C148_CPUIRQ], CLEAR_LINE); | |
| 538 | 537 | break; |
| 539 | 538 | |
| 540 | 539 | case 0x1d8000: /* ack EXIRQ */ |
| r2844 | r2845 | |
| 542 | 541 | { |
| 543 | 542 | // mame_printf_debug( "cpu(%d) RAM[0x%06x] = 0x%x\n", cpu, addr, data ); |
| 544 | 543 | } |
| 545 | cpunum_set_input_line( | |
| 544 | cpunum_set_input_line(machine, cpu, pC148Reg[NAMCOS2_C148_EXIRQ], CLEAR_LINE); | |
| 546 | 545 | break; |
| 547 | 546 | |
| 548 | 547 | case 0x1da000: /* ack POSIRQ */ |
| r2844 | r2845 | |
| 550 | 549 | { |
| 551 | 550 | // mame_printf_debug( "cpu(%d) RAM[0x%06x] = 0x%x\n", cpu, addr, data ); |
| 552 | 551 | } |
| 553 | cpunum_set_input_line( | |
| 552 | cpunum_set_input_line(machine, cpu, pC148Reg[NAMCOS2_C148_POSIRQ], CLEAR_LINE); | |
| 554 | 553 | break; |
| 555 | 554 | |
| 556 | 555 | case 0x1dc000: /* ack SCIRQ */ |
| r2844 | r2845 | |
| 558 | 557 | { |
| 559 | 558 | // mame_printf_debug( "cpu(%d) RAM[0x%06x] = 0x%x\n", cpu, addr, data ); |
| 560 | 559 | } |
| 561 | cpunum_set_input_line( | |
| 560 | cpunum_set_input_line(machine, cpu, pC148Reg[NAMCOS2_C148_SERIRQ], CLEAR_LINE); | |
| 562 | 561 | break; |
| 563 | 562 | |
| 564 | 563 | case 0x1de000: /* ack VBLANK */ |
| 565 | cpunum_set_input_line( | |
| 564 | cpunum_set_input_line(machine, cpu, pC148Reg[NAMCOS2_C148_VBLANKIRQ], CLEAR_LINE); | |
| 566 | 565 | break; |
| 567 | 566 | |
| 568 | 567 | case 0x1e0000: /* EEPROM Status Register */ |
| r2844 | r2845 | |
| 575 | 574 | if( data&0x01 ) |
| 576 | 575 | { |
| 577 | 576 | /* Resume execution */ |
| 578 | cpunum_set_input_line( | |
| 577 | cpunum_set_input_line(machine, CPU_SOUND, INPUT_LINE_RESET, CLEAR_LINE); | |
| 579 | 578 | cpu_yield(); |
| 580 | 579 | } |
| 581 | 580 | else |
| 582 | 581 | { |
| 583 | 582 | /* Suspend execution */ |
| 584 | cpunum_set_input_line( | |
| 583 | cpunum_set_input_line(machine, CPU_SOUND, INPUT_LINE_RESET, ASSERT_LINE); | |
| 585 | 584 | } |
| 586 | 585 | if( IsSystem21() ) |
| 587 | 586 | { |
| r2844 | r2845 | |
| 599 | 598 | { |
| 600 | 599 | if( data&0x01 ) |
| 601 | 600 | { /* Resume execution */ |
| 602 | ResetAllSubCPUs( CLEAR_LINE ); | |
| 601 | ResetAllSubCPUs( machine, CLEAR_LINE ); | |
| 603 | 602 | /* Give the new CPU an immediate slice of the action */ |
| 604 | 603 | cpu_yield(); |
| 605 | 604 | } |
| 606 | 605 | else |
| 607 | 606 | { /* Suspend execution */ |
| 608 | ResetAllSubCPUs( ASSERT_LINE ); | |
| 607 | ResetAllSubCPUs( machine, ASSERT_LINE ); | |
| 609 | 608 | } |
| 610 | 609 | } |
| 611 | 610 | break; |
| r2844 | r2845 | |
| 622 | 621 | |
| 623 | 622 | WRITE16_HANDLER( namcos2_68k_master_C148_w ) |
| 624 | 623 | { |
| 625 | (void)ReadWriteC148( CPU_MASTER, offset, data, 1 ); | |
| 624 | (void)ReadWriteC148( machine, CPU_MASTER, offset, data, 1 ); | |
| 626 | 625 | } |
| 627 | 626 | |
| 628 | 627 | READ16_HANDLER( namcos2_68k_master_C148_r ) |
| 629 | 628 | { |
| 630 | return ReadWriteC148( CPU_MASTER, offset, 0, 0 ); | |
| 629 | return ReadWriteC148( machine, CPU_MASTER, offset, 0, 0 ); | |
| 631 | 630 | } |
| 632 | 631 | |
| 633 | 632 | WRITE16_HANDLER( namcos2_68k_slave_C148_w ) |
| 634 | 633 | { |
| 635 | (void)ReadWriteC148( CPU_SLAVE, offset, data, 1 ); | |
| 634 | (void)ReadWriteC148( machine, CPU_SLAVE, offset, data, 1 ); | |
| 636 | 635 | } |
| 637 | 636 | |
| 638 | 637 | READ16_HANDLER( namcos2_68k_slave_C148_r ) |
| 639 | 638 | { |
| 640 | return ReadWriteC148( CPU_SLAVE, offset, 0, 0 ); | |
| 639 | return ReadWriteC148( machine, CPU_SLAVE, offset, 0, 0 ); | |
| 641 | 640 | } |
| 642 | 641 | |
| 643 | 642 | WRITE16_HANDLER( namcos2_68k_gpu_C148_w ) |
| 644 | 643 | { |
| 645 | (void)ReadWriteC148( CPU_GPU, offset, data, 1 ); | |
| 644 | (void)ReadWriteC148( machine, CPU_GPU, offset, data, 1 ); | |
| 646 | 645 | } |
| 647 | 646 | |
| 648 | 647 | READ16_HANDLER( namcos2_68k_gpu_C148_r ) |
| 649 | 648 | { |
| 650 | return ReadWriteC148( CPU_GPU, offset, 0, 0 ); | |
| 649 | return ReadWriteC148( machine, CPU_GPU, offset, 0, 0 ); | |
| 651 | 650 | } |
| 652 | 651 | |
| 653 | 652 | static TIMER_CALLBACK( namcos2_68k_master_posirq ) |
| r2844 | r2845 | |
| 657 | 656 | } |
| 658 | 657 | |
| 659 | 658 | static int |
| 660 | GetPosIRQScanline( | |
| 659 | GetPosIRQScanline( running_machine *machine ) | |
| 661 | 660 | { |
| 662 | 661 | if( IsSystem21() ) return 0; |
| 663 | return namcos2_GetPosIrqScanline(); | |
| 662 | return namcos2_GetPosIrqScanline(machine); | |
| 664 | 663 | } |
| 665 | 664 | |
| 666 | 665 | INTERRUPT_GEN( namcos2_68k_master_vblank ) |
| 667 | 666 | { |
| 668 | 667 | if( IsSystem21()==0 && namcos2_68k_master_C148[NAMCOS2_C148_POSIRQ] ) |
| 669 | 668 | { |
| 670 | int scanline = GetPosIRQScanline(); | |
| 669 | int scanline = GetPosIRQScanline(machine); | |
| 671 | 670 | timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, namcos2_68k_master_posirq ); |
| 672 | 671 | } |
| 673 | 672 | cpunum_set_input_line(machine, CPU_MASTER, namcos2_68k_master_C148[NAMCOS2_C148_VBLANKIRQ], HOLD_LINE); |
| r2844 | r2845 | |
| 683 | 682 | { |
| 684 | 683 | if( IsSystem21()==0 && namcos2_68k_slave_C148[NAMCOS2_C148_POSIRQ] ) |
| 685 | 684 | { |
| 686 | int scanline = GetPosIRQScanline(); | |
| 685 | int scanline = GetPosIRQScanline(machine); | |
| 687 | 686 | timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, namcos2_68k_slave_posirq ); |
| 688 | 687 | } |
| 689 | 688 | cpunum_set_input_line(machine, CPU_SLAVE, namcos2_68k_slave_C148[NAMCOS2_C148_VBLANKIRQ], HOLD_LINE); |
| r2844 | r2845 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "machine/eeprom.h" |
| 12 | #include "includes/gaelco2.h" | |
| 12 | 13 | |
| 13 | 14 | /*************************************************************************** |
| 14 | 15 |
| r2844 | r2845 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | #include "driver.h" |
| 15 | #include "includes/seibuspi.h" | |
| 16 | ||
| 15 | 17 | // add two numbers generating carry from one bit to the next only if |
| 16 | 18 | // the corresponding bit in carry_mask is 1 |
| 17 | 19 | static int partial_carry_sum(int add1,int add2,int carry_mask,int bits) |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "cpu/z80/z80.h" |
| 3 | #include "includes/retofinv.h" | |
| 3 | 4 | |
| 4 | 5 | |
| 5 | 6 | static UINT8 from_main,from_mcu; |
| r2844 | r2845 | |
|---|---|---|
| 73 | 73 | int p2_vert; |
| 74 | 74 | int temp; |
| 75 | 75 | |
| 76 | p1_horiz = input_port_read_indexed(machine,0); | |
| 77 | p1_vert = input_port_read_indexed(machine,1); | |
| 78 | p2_horiz = input_port_read_indexed(machine,2); | |
| 79 | p2_vert = input_port_read_indexed(machine,3); | |
| 76 | p1_horiz = input_port_read(machine, "TRACK0_X"); | |
| 77 | p1_vert = input_port_read(machine, "TRACK0_Y"); | |
| 78 | p2_horiz = input_port_read(machine, "TRACK1_X"); | |
| 79 | p2_vert = input_port_read(machine, "TRACK1_Y"); | |
| 80 | 80 | |
| 81 | 81 | /* Set direction bits */ |
| 82 | 82 | |
| r2844 | r2845 | |
| 146 | 146 | } |
| 147 | 147 | else |
| 148 | 148 | { |
| 149 | temp = input_port_read | |
| 149 | temp = input_port_read | |
| 150 | 150 | /* Remap button 1 back to the Start button */ |
| 151 | 151 | /* NOTE: This is an ADDED feature, not a part of the original hardware! */ |
| 152 | 152 | temp = (temp) & (temp>>2); |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "includes/matmania.h" | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | static UINT8 from_main,from_mcu; |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "includes/gaelcrpt.h" | |
| 10 | 11 | |
| 11 | 12 | static int decrypt(int const param1, int const param2, int const enc_prev_word, int const dec_prev_word, int const enc_word) |
| 12 | 13 | { |
| r2844 | r2845 | |
|---|---|---|
| 1490 | 1490 | psx_gpu_write( &g_p_n_psxram[ n_address / 4 ], n_size ); |
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | void psx_machine_init( | |
| 1493 | void psx_machine_init( running_machine *machine ) | |
| 1494 | 1494 | { |
| 1495 | 1495 | int n; |
| 1496 | 1496 | |
| r2844 | r2845 | |
| 1531 | 1531 | m_p_n_sio_tx_bits[ n ] = 0; |
| 1532 | 1532 | } |
| 1533 | 1533 | |
| 1534 | psx_gpu_reset(); | |
| 1534 | psx_gpu_reset(machine); | |
| 1535 | 1535 | } |
| 1536 | 1536 | |
| 1537 | 1537 | static STATE_POSTLOAD( psx_postload ) |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "cpu/m6809/m6809.h" |
| 3 | 3 | #include "machine/6522via.h" |
| 4 | #include "includes/beezer.h" | |
| 4 | 5 | |
| 5 | WRITE8_HANDLER( beezer_map_w ); | |
| 6 | READ8_HANDLER( beezer_line_r ); | |
| 7 | ||
| 8 | 6 | static int pbus; |
| 9 | 7 | |
| 10 | 8 | static READ8_HANDLER( b_via_0_pb_r ); |
| r2844 | r2845 | |
| 69 | 67 | switch (data & 0x03) |
| 70 | 68 | { |
| 71 | 69 | case 0: |
| 72 | pbus = input_port_read | |
| 70 | pbus = input_port_read | |
| 73 | 71 | break; |
| 74 | 72 | case 1: |
| 75 | pbus = input_port_read | |
| 73 | pbus = input_port_read | |
| 76 | 74 | break; |
| 77 | 75 | case 2: |
| 78 | pbus = input_port_read | |
| 76 | pbus = input_port_read | |
| 79 | 77 | break; |
| 80 | 78 | case 3: |
| 81 | 79 | pbus = 0xff; |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "cpu/z80/z80.h" |
| 3 | #include "includes/lsasquad.h" | |
| 3 | 4 | |
| 4 | 5 | |
| 5 | 6 | /* coin inputs are inverted in storming */ |
| r2844 | r2845 | |
|---|---|---|
| 541 | 541 | TODO: look at this one since this remark is only driver-based. |
| 542 | 542 | */ |
| 543 | 543 | |
| 544 | void (*toybox_mcu_run)(running_machine *machine); /* One of the following */ | |
| 545 | void bloodwar_mcu_run(running_machine *machine); | |
| 546 | void bonkadv_mcu_run(running_machine *machine); | |
| 547 | void gtmr_mcu_run(running_machine *machine); | |
| 544 | void (*toybox_mcu_run)(running_machine *machine); | |
| 548 | 545 | |
| 549 | 546 | static UINT16 toybox_mcu_com[4]; |
| 550 | 547 |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | /* Raiden 2 Sprite Decryption */ |
| 2 | 2 | |
| 3 | 3 | #include "driver.h" |
| 4 | #include "includes/raiden2.h" | |
| 4 | 5 | |
| 5 | 6 | /* INIT */ |
| 6 | 7 |
| r2844 | r2845 | |
|---|---|---|
| 36 | 36 | *************************************************************************/ |
| 37 | 37 | |
| 38 | 38 | #include "driver.h" |
| 39 | #include "includes/cchip.h" | |
| 39 | 40 | |
| 40 | 41 | /* Select how coinage data is initialised in opwolf_cchip_data_w : 0 = user-defined in function - 1 = automatic */ |
| 41 | 42 | #define OPWOLF_READ_COINAGE_FROM_ROM 1 |
| r2844 | r2845 | |
|---|---|---|
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "cpu/ds5002fp/ds5002fp.h" |
| 12 | 12 | #include "gaelcrpt.h" |
| 13 | #include "includes/wrally.h" | |
| 13 | 14 | |
| 14 | /* from video/wrally.c */ | |
| 15 | extern UINT16 *wrally_videoram; | |
| 16 | extern tilemap *wrally_pant[2]; | |
| 17 | ||
| 18 | 15 | /*************************************************************************** |
| 19 | 16 | |
| 20 | 17 | World Rally memory handlers |
| r2844 | r2845 | |
| 54 | 51 | } |
| 55 | 52 | |
| 56 | 53 | /* Converts memory offsets to the format expected by the Dallas */ |
| 57 | READ32_HANDLER( wrally_external_ram_iaddr ) | |
| 54 | static READ32_HANDLER( wrally_external_ram_iaddr ) | |
| 58 | 55 | { |
| 59 | 56 | return offset ^= 0x0001; |
| 60 | 57 | } |
| r2844 | r2845 | |
|---|---|---|
| 3 | 3 | #include "cpu/konami/konami.h" |
| 4 | 4 | #include "machine/eeprom.h" |
| 5 | 5 | #include "sound/k053260.h" |
| 6 | #include "includes/simpsons.h" | |
| 6 | 7 | |
| 7 | /* from video */ | |
| 8 | extern void simpsons_video_banking( running_machine *machine, int select ); | |
| 9 | extern UINT8 *simpsons_xtraram; | |
| 10 | ||
| 11 | 8 | int simpsons_firq_enabled; |
| 12 | 9 | |
| 13 | 10 | /*************************************************************************** |
| r2844 | r2845 | |
|---|---|---|
| 6 | 6 | #include "deprecat.h" |
| 7 | 7 | #include "debugger.h" |
| 8 | 8 | #include "cpu/mb86233/mb86233.h" |
| 9 | #include "includes/model1.h" | |
| 9 | 10 | |
| 10 | 11 | enum {FIFO_SIZE = 256}; |
| 11 | 12 | enum {MAT_STACK_SIZE = 32}; |
| r2844 | r2845 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | #include "driver.h" |
| 50 | 50 | #include "audio/seibu.h" |
| 51 | #include "includes/legionna.h" | |
| 52 | #include "includes/raiden2.h" | |
| 53 | #include "machine/seicop.h" | |
| 51 | 54 | |
| 52 | 55 | #define seibu_cop_log logerror |
| 53 | 56 | |
| r2844 | r2845 | |
| 70 | 73 | |
| 71 | 74 | static UINT16 copd2_offs = 0; |
| 72 | 75 | |
| 73 | extern UINT16* legionna_scrollram16; | |
| 74 | extern UINT8 sdgndmrb_pri_n; | |
| 75 | extern void heatbrl_setgfxbank(UINT16 data); | |
| 76 | extern void denjinmk_setgfxbank(UINT16 data); | |
| 77 | extern UINT16 legionna_layer_disable; | |
| 78 | ||
| 79 | void copd2_set_tableoffset(UINT16 data, running_machine *machine) | |
| 76 | static void copd2_set_tableoffset(UINT16 data, running_machine *machine) | |
| 80 | 77 | { |
| 81 | 78 | logerror("mcu_offs %04x\n", data); |
| 82 | 79 | copd2_offs = data; |
| r2844 | r2845 | |
| 125 | 122 | |
| 126 | 123 | } |
| 127 | 124 | |
| 128 | void copd2_set_tabledata(UINT16 data, running_machine *machine) | |
| 125 | static void copd2_set_tabledata(UINT16 data, running_machine *machine) | |
| 129 | 126 | { |
| 130 | 127 | copd2_table[copd2_offs] = data; |
| 131 | 128 | logerror("mcu_data %04x\n", data); |
| r2844 | r2845 | |
| 900 | 897 | |
| 901 | 898 | // this still probably contains some useful information, but we should handle |
| 902 | 899 | // things as generically as possible |
| 903 | #if | |
| 900 | #ifdef UNUSED_FUNCTION | |
| 904 | 901 | /******************************************************************************************** |
| 905 | 902 | |
| 906 | 903 | COPX-D2 simulation |
| r2844 | r2845 | |
| 2001 | 1998 | } |
| 2002 | 1999 | } |
| 2003 | 2000 | |
| 2004 | extern WRITE16_HANDLER( sprcpt_val_1_w ); | |
| 2005 | extern WRITE16_HANDLER( sprcpt_val_2_w ); | |
| 2006 | extern WRITE16_HANDLER( sprcpt_data_1_w ); | |
| 2007 | extern WRITE16_HANDLER( sprcpt_data_2_w ); | |
| 2008 | extern WRITE16_HANDLER( sprcpt_data_3_w ); | |
| 2009 | extern WRITE16_HANDLER( sprcpt_data_4_w ); | |
| 2010 | extern WRITE16_HANDLER( sprcpt_adr_w ); | |
| 2011 | extern WRITE16_HANDLER( sprcpt_flags_1_w ); | |
| 2012 | extern WRITE16_HANDLER( sprcpt_flags_2_w ); | |
| 2013 | ||
| 2014 | 2001 | WRITE16_HANDLER( raiden2_mcu_w ) |
| 2015 | 2002 | { |
| 2016 | 2003 | COMBINE_DATA(&cop_mcu_ram[offset]); |
| r2844 | r2845 | |
| 2047 | 2034 | |
| 2048 | 2035 | } |
| 2049 | 2036 | } |
| 2050 | ||
| 2051 |
| r2844 | r2845 | |
|---|---|---|
| 12 | 12 | #include "cpu/z80/z80.h" |
| 13 | 13 | #include "cpu/konami/konami.h" |
| 14 | 14 | #include "video/konamiic.h" |
| 15 | #include "includes/ajax.h" | |
| 15 | 16 | |
| 16 | extern UINT8 ajax_priority; | |
| 17 | 17 | static int firq_enable; |
| 18 | 18 | |
| 19 | 19 | /* ajax_bankswitch_w: |
| r2844 | r2845 | |
| 109 | 109 | READ8_HANDLER( ajax_ls138_f10_r ) |
| 110 | 110 | { |
| 111 | 111 | int data = 0, index; |
| 112 | char port[ | |
| 112 | static const char *portnames[ | |
| 113 | 113 | |
| 114 | 114 | switch ((offset & 0x01c0) >> 6) |
| 115 | 115 | { |
| r2844 | r2845 | |
| 121 | 121 | break; |
| 122 | 122 | case 0x06: /* 1P inputs + DIPSW #1 & #2 */ |
| 123 | 123 | index = offset & 0x01; |
| 124 | sprintf(port, "%s%d", (offset & 0x02) ? "DSW" : "IN", (offset & 0x02) ? index+1 : index); | |
| 125 | data = input_port_read(machine, port); | |
| 124 | data = input_port_read(machine, (offset & 0x02) ? portnames[2 + index] : portnames[index]); | |
| 126 | 125 | break; |
| 127 | 126 | case 0x07: /* DIPSW #3 */ |
| 128 | 127 | data = input_port_read(machine, "DSW3"); |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "includes/bigevglf.h" | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | static UINT8 from_mcu; |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "includes/bagman.h" | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | /*Creation date: 98-02-18 */ |
| r2844 | r2845 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | #include "driver.h" |
| 13 | 13 | #include "cpu/m6809/m6809.h" |
| 14 | #include "includes/jackal.h" | |
| 14 | 15 | |
| 15 | extern UINT8 jackal_interrupt_enable; | |
| 16 | extern void jackal_mark_tile_dirty(int offset); | |
| 17 | ||
| 18 | 16 | static UINT8 *jackal_rambank = 0; |
| 19 | 17 | static UINT8 *jackal_spritebank = 0; |
| 20 | 18 | |
| 21 | 19 | |
| 22 | 20 | MACHINE_RESET( jackal ) |
| 23 | 21 | { |
| 22 | // HACK: running at the nominal clock rate, music stops working | |
| 23 | // at the beginning of the game. This fixes it. | |
| 24 | cpunum_set_clockscale(machine, 1, 1.2f); | |
| 25 | ||
| 24 | 26 | memory_set_bankptr(1,&((memory_region(REGION_CPU1))[0x4000])); |
| 25 | 27 | jackal_rambank = &((memory_region(REGION_CPU1))[0]); |
| 26 | 28 | jackal_spritebank = &((memory_region(REGION_CPU1))[0]); |
| r2844 | r2845 | |
| 48 | 50 | |
| 49 | 51 | WRITE8_HANDLER( jackal_rambank_w ) |
| 50 | 52 | { |
| 51 | if (data & 0x | |
| 53 | if (data & 0x04) popmessage("jackal_rambank_w %02x",data); | |
| 52 | 54 | coin_counter_w(0,data & 0x01); |
| 53 | 55 | coin_counter_w(1,data & 0x02); |
| 56 | jackal_spritebank = &((memory_region(REGION_CPU1))[((data & 0x08) << 13)]); | |
| 54 | 57 | jackal_rambank = &((memory_region(REGION_CPU1))[((data & 0x10) << 12)]); |
| 55 | jackal_spritebank = &((memory_region(REGION_CPU1))[((data & 0x08) << 13)]); | |
| 56 | 58 | memory_set_bankptr(1,&((memory_region(REGION_CPU1))[((data & 0x20) << 11) + 0x4000])); |
| 57 | 59 | } |
| 58 | 60 |
| r0 | r2845 | |
|---|---|---|
| 1 | extern UINT16* cop_mcu_ram; | |
| 2 | ||
| 3 | READ16_HANDLER( copdxbl_0_r ); | |
| 4 | WRITE16_HANDLER( copdxbl_0_w ); | |
| 5 | ||
| 6 | READ16_HANDLER( heatbrl_mcu_r ); | |
| 7 | WRITE16_HANDLER( heatbrl_mcu_w ); | |
| 8 | READ16_HANDLER( cupsoc_mcu_r ); | |
| 9 | WRITE16_HANDLER( cupsoc_mcu_w ); | |
| 10 | READ16_HANDLER( godzilla_mcu_r ); | |
| 11 | WRITE16_HANDLER( godzilla_mcu_w ); | |
| 12 | READ16_HANDLER( denjinmk_mcu_r ); | |
| 13 | WRITE16_HANDLER( denjinmk_mcu_w ); | |
| 14 | READ16_HANDLER( sdgndmrb_mcu_r ); | |
| 15 | WRITE16_HANDLER( sdgndmrb_mcu_w ); | |
| 16 | READ16_HANDLER( legionna_mcu_r ); | |
| 17 | WRITE16_HANDLER( legionna_mcu_w ); | |
| 18 | ||
| 19 | READ16_HANDLER( raiden2_mcu_r ); | |
| 20 | WRITE16_HANDLER( raiden2_mcu_w ); |
| r2844 | r2845 | |
|---|---|---|
| 719 | 719 | DRIVER( boxyboy ) /* (c) 1990 (US) */ |
| 720 | 720 | DRIVER( soukobdx ) /* (c) 1990 (Japan) */ |
| 721 | 721 | DRIVER( puzlclub ) /* (c) 1990 (Japan) */ |
| 722 | DRIVER( tankfrce ) /* (c) 1991 (US) */ | |
| 722 | DRIVER( tankfrce ) /* (c) 1991 (US, 2 Player) */ | |
| 723 | DRIVER( tankfrc4 ) /* (c) 1991 (US, 4 Player) */ | |
| 723 | 724 | DRIVER( tankfrcj ) /* (c) 1991 (Japan) */ |
| 724 | 725 | |
| 725 | 726 | /* Namco System 2 games */ |
| r2844 | r2845 | |
| 5672 | 5673 | DRIVER( s1945p ) /* 0254 (c) 1999 Psikyo */ |
| 5673 | 5674 | DRIVER( preisle2 ) /* 0255 (c) 1999 Yumekobo */ |
| 5674 | 5675 | DRIVER( mslug3 ) /* 0256 (c) 2000 SNK */ |
| 5675 | DRIVER( mslug3 | |
| 5676 | DRIVER( mslug3h ) /* 0256 (c) 2000 SNK */ | |
| 5676 | 5677 | DRIVER( mslug3b6 ) /* bootleg */ |
| 5677 | 5678 | DRIVER( kof2000 ) /* 0257 (c) 2000 SNK */ |
| 5678 | 5679 | DRIVER( kof2000n ) /* 0257 (c) 2000 SNK */ |
| r2844 | r2845 | |
| 6196 | 6197 | DRIVER( sbagmans ) /* (c) 1984 + Stern license */ |
| 6197 | 6198 | DRIVER( pickin ) /* (c) 1983 */ |
| 6198 | 6199 | DRIVER( botanic ) /* (c) 1985 */ |
| 6200 | DRIVER( squaitsa ) /* (c) 1985 */ | |
| 6199 | 6201 | DRIVER( tankbust ) /* (c) 1985 */ |
| 6200 | 6202 | |
| 6201 | 6203 | /* Seibu Denshi / Seibu Kaihatsu games */ |
| r2844 | r2845 | |
| 7102 | 7104 | DRIVER( mchampdx ) /* (c) 1999 ESD */ |
| 7103 | 7105 | DRIVER( mchampda ) /* (c) 1999 ESD */ |
| 7104 | 7106 | DRIVER( hedpanic ) /* (c) 2000 ESD */ |
| 7107 | DRIVER( hedpanif ) /* (c) 2000 ESD + Fuuki, Co. Ltd. */ | |
| 7105 | 7108 | DRIVER( tangtang ) /* (c) 2000 ESD */ |
| 7109 | DRIVER( swatpolc ) /* (c) 2001 ESD */ | |
| 7106 | 7110 | |
| 7107 | 7111 | /* Dyna Electronics / Dynax / Nakanihon games */ |
| 7108 | 7112 | DRIVER( royalmj ) /* (c) 1982 Nichibutsu */ |
| r2844 | r2845 | |
| 7932 | 7936 | DRIVER( ampkr2b3 ) /* 1994 bootleg */ |
| 7933 | 7937 | DRIVER( pkrdewin ) /* 1990 bootleg */ |
| 7934 | 7938 | DRIVER( ampkr95 ) /* 1995 bootleg */ |
| 7939 | DRIVER( videomat ) /* 1990 bootleg */ | |
| 7935 | 7940 | DRIVER( sigmapkr ) /* (c) 1995 Sigma */ |
| 7936 | 7941 | DRIVER( sigma2k ) /* (c) 2000 Sigma */ |
| 7937 | 7942 | DRIVER( lucky8 ) /* (c) 1989 Falcon */ |
| r2844 | r2845 | |
| 7963 | 7968 | DRIVER( rbmk ) /* (c) 1995 GMS */ |
| 7964 | 7969 | DRIVER( go2000 ) /* (c) 2000 SA */ |
| 7965 | 7970 | DRIVER( mirax ) /* (c) 1985 Current Technologies */ |
| 7971 | DRIVER( victor5 ) /* (c) 1990 Subsino */ | |
| 7972 | DRIVER( victor21 ) /* (c) 1990 Subsino */ | |
| 7973 | DRIVER( sharkpy ) /* (c) 1993 Subsino */ | |
| 7974 | DRIVER( sharkpya ) /* (c) 1993 Subsino */ | |
| 7975 | DRIVER( smoto20 ) /* (c) 1996 Subsino */ | |
| 7976 | DRIVER( smoto16 ) /* (c) 1996 Subsino */ | |
| 7966 | 7977 | DRIVER( lastfght ) /* (c) 2000 Subsino */ |
| 7967 | 7978 | DRIVER( bishjan ) /* (c) 1999 Subsino */ |
| 7968 | 7979 | DRIVER( sliver ) /* (c) 1996 Hollow Corp */ |
| r2844 | r2845 | |
| 8011 | 8022 | DRIVER( comg183 ) /* (c) 1983 Cal Omega Inc. */ |
| 8012 | 8023 | DRIVER( comg185 ) /* (c) 1983 Cal Omega Inc. */ |
| 8013 | 8024 | DRIVER( comg186 ) /* (c) 1983 Cal Omega Inc. */ |
| 8025 | DRIVER( comg187 ) /* (c) 1983 Cal Omega Inc. */ | |
| 8014 | 8026 | DRIVER( comg204 ) /* (c) 1984 Cal Omega Inc. */ |
| 8015 | 8027 | DRIVER( comg208 ) /* (c) 1984 Cal Omega Inc. */ |
| 8016 | 8028 | DRIVER( comg227 ) /* (c) 1984 Cal Omega Inc. */ |
| r2844 | r2845 | |
| 8069 | 8081 | DRIVER( pepp0516 ) /* (c) 1987 IGT - International Gaming Technology */ |
| 8070 | 8082 | DRIVER( pebe0014 ) /* (c) 1994 IGT - International Gaming Technology */ |
| 8071 | 8083 | DRIVER( peke1012 ) /* (c) 1994 IGT - International Gaming Technology */ |
| 8084 | DRIVER( peps0014 ) /* (c) 1996 IGT - International Gaming Technology */ | |
| 8085 | DRIVER( peps0022 ) /* (c) 1996 IGT - International Gaming Technology */ | |
| 8086 | DRIVER( peps0043 ) /* (c) 1996 IGT - International Gaming Technology */ | |
| 8087 | DRIVER( peps0045 ) /* (c) 1996 IGT - International Gaming Technology */ | |
| 8088 | DRIVER( peps0308 ) /* (c) 1996 IGT - International Gaming Technology */ | |
| 8072 | 8089 | DRIVER( peps0615 ) /* (c) 1996 IGT - International Gaming Technology */ |
| 8073 | 8090 | DRIVER( peps0716 ) /* (c) 1996 IGT - International Gaming Technology */ |
| 8074 | 8091 | DRIVER( pexp0019 ) /* (c) 1995 IGT - International Gaming Technology */ |
| r2844 | r2845 | |
| 8094 | 8111 | DRIVER( capcor ) /* (c) 2001 Nazionale Elettronica */ |
| 8095 | 8112 | DRIVER( euro2k2 ) /* (c) 2001 Nazionale Elettronica */ |
| 8096 | 8113 | DRIVER( euro2k2a ) /* (c) 2001 Nazionale Elettronica */ |
| 8114 | DRIVER( mnumber ) /* (c) 200? M.M. - B.R.L. */ | |
| 8097 | 8115 | |
| 8098 | 8116 | /* H8/3337 italian gambling games */ |
| 8099 | DRIVER( laser2k1 ) /* 200? unknown */ | |
| 8100 | DRIVER( mdrink ) /* 200? unknown */ | |
| 8101 | DRIVER( ntcash ) /* 200? unknown */ | |
| 8102 | DRIVER( wizard ) /* 200? unknown */ | |
| 8103 | DRIVER( te0144 ) /* 200? unknown */ | |
| 8117 | DRIVER( ntcash ) /* 1999 unknown */ | |
| 8118 | DRIVER( wizard ) /* (c) 1999 A.A. */ | |
| 8119 | DRIVER( laser2k1 ) /* 2001 unknown */ | |
| 8120 | DRIVER( mdrink ) /* 2001 unknown */ | |
| 8121 | DRIVER( te0144 ) /* 2001 unknown */ | |
| 8104 | 8122 | DRIVER( cmagica ) /* 200? unknown */ |
| 8105 | 8123 | DRIVER( millsun ) /* 200? unknown */ |
| 8106 | 8124 | DRIVER( sspac2k1 ) /* 200? unknown */ |
| 8107 | 8125 | DRIVER( elvis ) /* 200? unknown */ |
| 8108 | 8126 | |
| 8127 | /* Mitsubishi/Renesas M16/62A italian gambling games */ | |
| 8128 | DRIVER( ejollyx5 ) /* (c) 200? Solar Games */ | |
| 8129 | DRIVER( grandprx ) /* (c) 4fun */ | |
| 8130 | ||
| 8109 | 8131 | /* Astro Corp. */ |
| 8110 | 8132 | DRIVER( showhand ) |
| 8111 | 8133 |
| r2844 | r2845 | |
|---|---|---|
| 25 | 25 | WRITE8_HANDLER( nitedrvr_out1_w ); |
| 26 | 26 | |
| 27 | 27 | void nitedrvr_crash_toggle(running_machine *machine); |
| 28 | void nitedrvr_register_machine_vars(void); | |
| 28 | 29 | |
| 29 | 30 | |
| 30 | 31 | /*----------- defined in audio/nitedrvr.c -----------*/ |
| r2844 | r2845 | |
| 35 | 36 | /*----------- defined in video/nitedrvr.c -----------*/ |
| 36 | 37 | |
| 37 | 38 | extern UINT8 *nitedrvr_hvc; |
| 39 | ||
| 38 | 40 | WRITE8_HANDLER( nitedrvr_hvc_w ); |
| 41 | WRITE8_HANDLER( nitedrvr_videoram_w ); | |
| 42 | ||
| 43 | VIDEO_START( nitedrvr ); | |
| 39 | 44 | VIDEO_UPDATE( nitedrvr ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in drivers/nycaptor.c -----------*/ | |
| 2 | ||
| 3 | extern UINT8 *nycaptor_sharedram; | |
| 4 | extern int nyc_gametype; | |
| 5 | ||
| 6 | ||
| 7 | /*----------- defined in machine/nycaptor.c -----------*/ | |
| 8 | ||
| 9 | READ8_HANDLER( nycaptor_mcu_r ); | |
| 10 | READ8_HANDLER( nycaptor_mcu_status_r1 ); | |
| 11 | READ8_HANDLER( nycaptor_mcu_status_r2 ); | |
| 12 | READ8_HANDLER( nycaptor_68705_portC_r ); | |
| 13 | READ8_HANDLER( nycaptor_68705_portB_r ); | |
| 14 | READ8_HANDLER( nycaptor_68705_portA_r ); | |
| 15 | ||
| 16 | WRITE8_HANDLER( nycaptor_mcu_w ); | |
| 17 | WRITE8_HANDLER( nycaptor_68705_portA_w ); | |
| 18 | WRITE8_HANDLER( nycaptor_68705_portB_w ); | |
| 19 | WRITE8_HANDLER( nycaptor_68705_portC_w ); | |
| 20 | WRITE8_HANDLER( nycaptor_68705_ddrA_w ); | |
| 21 | WRITE8_HANDLER( nycaptor_68705_ddrB_w ); | |
| 22 | WRITE8_HANDLER( nycaptor_68705_ddrC_w ); | |
| 23 | ||
| 24 | ||
| 25 | /*----------- defined in video/nycaptor.c -----------*/ | |
| 26 | ||
| 27 | extern UINT8 *nycaptor_scrlram; | |
| 28 | ||
| 29 | VIDEO_START( nycaptor ); | |
| 30 | VIDEO_UPDATE( nycaptor ); | |
| 31 | ||
| 32 | ||
| 33 | READ8_HANDLER( nycaptor_videoram_r ); | |
| 34 | READ8_HANDLER( nycaptor_spriteram_r ); | |
| 35 | READ8_HANDLER( nycaptor_palette_r ); | |
| 36 | READ8_HANDLER( nycaptor_gfxctrl_r ); | |
| 37 | READ8_HANDLER( nycaptor_scrlram_r ); | |
| 38 | ||
| 39 | WRITE8_HANDLER( nycaptor_videoram_w ); | |
| 40 | WRITE8_HANDLER( nycaptor_spriteram_w ); | |
| 41 | WRITE8_HANDLER( nycaptor_palette_w ); | |
| 42 | WRITE8_HANDLER( nycaptor_gfxctrl_w ); | |
| 43 | WRITE8_HANDLER( nycaptor_scrlram_w ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/bublbobl.c -----------*/ | |
| 2 | ||
| 3 | extern UINT8 *bublbobl_mcu_sharedram; | |
| 4 | ||
| 5 | WRITE8_HANDLER( bublbobl_bankswitch_w ); | |
| 6 | WRITE8_HANDLER( tokio_bankswitch_w ); | |
| 7 | WRITE8_HANDLER( tokio_videoctrl_w ); | |
| 8 | WRITE8_HANDLER( bublbobl_nmitrigger_w ); | |
| 9 | READ8_HANDLER( tokio_mcu_r ); | |
| 10 | READ8_HANDLER( tokiob_mcu_r ); | |
| 11 | WRITE8_HANDLER( bublbobl_sound_command_w ); | |
| 12 | WRITE8_HANDLER( bublbobl_sh_nmi_disable_w ); | |
| 13 | WRITE8_HANDLER( bublbobl_sh_nmi_enable_w ); | |
| 14 | READ8_HANDLER( boblbobl_ic43_a_r ); | |
| 15 | WRITE8_HANDLER( boblbobl_ic43_a_w ); | |
| 16 | READ8_HANDLER( boblbobl_ic43_b_r ); | |
| 17 | WRITE8_HANDLER( boblbobl_ic43_b_w ); | |
| 18 | ||
| 19 | READ8_HANDLER( bublbobl_mcu_ddr1_r ); | |
| 20 | WRITE8_HANDLER( bublbobl_mcu_ddr1_w ); | |
| 21 | READ8_HANDLER( bublbobl_mcu_ddr2_r ); | |
| 22 | WRITE8_HANDLER( bublbobl_mcu_ddr2_w ); | |
| 23 | READ8_HANDLER( bublbobl_mcu_ddr3_r ); | |
| 24 | WRITE8_HANDLER( bublbobl_mcu_ddr3_w ); | |
| 25 | READ8_HANDLER( bublbobl_mcu_ddr4_r ); | |
| 26 | WRITE8_HANDLER( bublbobl_mcu_ddr4_w ); | |
| 27 | READ8_HANDLER( bublbobl_mcu_port1_r ); | |
| 28 | WRITE8_HANDLER( bublbobl_mcu_port1_w ); | |
| 29 | READ8_HANDLER( bublbobl_mcu_port2_r ); | |
| 30 | WRITE8_HANDLER( bublbobl_mcu_port2_w ); | |
| 31 | READ8_HANDLER( bublbobl_mcu_port3_r ); | |
| 32 | WRITE8_HANDLER( bublbobl_mcu_port3_w ); | |
| 33 | READ8_HANDLER( bublbobl_mcu_port4_r ); | |
| 34 | WRITE8_HANDLER( bublbobl_mcu_port4_w ); | |
| 35 | ||
| 36 | // for 68705 bootleg | |
| 37 | INTERRUPT_GEN( bublbobl_m68705_interrupt ); | |
| 38 | READ8_HANDLER( bublbobl_68705_portA_r ); | |
| 39 | WRITE8_HANDLER( bublbobl_68705_portA_w ); | |
| 40 | WRITE8_HANDLER( bublbobl_68705_ddrA_w ); | |
| 41 | READ8_HANDLER( bublbobl_68705_portB_r ); | |
| 42 | WRITE8_HANDLER( bublbobl_68705_portB_w ); | |
| 43 | WRITE8_HANDLER( bublbobl_68705_ddrB_w ); | |
| 44 | ||
| 45 | ||
| 46 | /*----------- defined in video/bublbobl.c -----------*/ | |
| 47 | ||
| 48 | extern int bublbobl_video_enable; | |
| 49 | extern UINT8 *bublbobl_objectram; | |
| 50 | extern size_t bublbobl_objectram_size; | |
| 51 | ||
| 52 | VIDEO_UPDATE( bublbobl ); |
| r2844 | r2845 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | extern int seta_tiles_offset; |
| 19 | 19 | |
| 20 | void seta_coin_lockout_w(int data); | |
| 20 | void seta_coin_lockout_w(running_machine *machine, int data); | |
| 21 | 21 | |
| 22 | 22 | WRITE16_HANDLER( twineagl_tilebank_w ); |
| 23 | 23 |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in drivers/stv.c -----------*/ | |
| 2 | ||
| 3 | extern UINT32 *stv_workram_h; | |
| 4 | extern UINT32 *stv_workram_l; | |
| 5 | ||
| 6 | extern int stv_vblank,stv_hblank; | |
| 7 | extern int stv_enable_slave_sh2; | |
| 8 | ||
| 9 | extern int minit_boost,sinit_boost; | |
| 10 | extern attotime minit_boost_timeslice, sinit_boost_timeslice; | |
| 11 | ||
| 12 | DRIVER_INIT ( stv ); | |
| 13 | ||
| 14 | ||
| 15 | /*----------- defined in drivers/stvinit.c -----------*/ | |
| 16 | ||
| 17 | DRIVER_INIT( ic13 ); | |
| 18 | NVRAM_HANDLER( stv ); | |
| 19 | void install_stvbios_speedups(running_machine *machine); | |
| 20 | DRIVER_INIT(bakubaku); | |
| 21 | DRIVER_INIT(mausuke); | |
| 22 | DRIVER_INIT(puyosun); | |
| 23 | DRIVER_INIT(shienryu); | |
| 24 | DRIVER_INIT(prikura); | |
| 25 | DRIVER_INIT(hanagumi); | |
| 26 | DRIVER_INIT(cottonbm); | |
| 27 | DRIVER_INIT(cotton2); | |
| 28 | DRIVER_INIT(fhboxers); | |
| 29 | DRIVER_INIT(dnmtdeka); | |
| 30 | DRIVER_INIT(groovef); | |
| 31 | DRIVER_INIT(danchih); | |
| 32 | DRIVER_INIT(astrass); | |
| 33 | DRIVER_INIT(thunt); | |
| 34 | DRIVER_INIT(grdforce); | |
| 35 | DRIVER_INIT(batmanfr); | |
| 36 | DRIVER_INIT(winterht); | |
| 37 | DRIVER_INIT(seabass); | |
| 38 | DRIVER_INIT(vfremix); | |
| 39 | DRIVER_INIT(diehard); | |
| 40 | DRIVER_INIT(sss); | |
| 41 | DRIVER_INIT(othellos); | |
| 42 | DRIVER_INIT(sasissu); | |
| 43 | DRIVER_INIT(gaxeduel); | |
| 44 | DRIVER_INIT(suikoenb); | |
| 45 | DRIVER_INIT(sokyugrt); | |
| 46 | DRIVER_INIT(znpwfv); | |
| 47 | DRIVER_INIT(twcup98); | |
| 48 | DRIVER_INIT(smleague); | |
| 49 | DRIVER_INIT(maruchan); | |
| 50 | DRIVER_INIT(sandor); | |
| 51 | DRIVER_INIT(colmns97); | |
| 52 | DRIVER_INIT(pblbeach); | |
| 53 | DRIVER_INIT(shanhigw); | |
| 54 | DRIVER_INIT(finlarch); | |
| 55 | DRIVER_INIT(elandore); | |
| 56 | DRIVER_INIT(rsgun); | |
| 57 | DRIVER_INIT(ffreveng); | |
| 58 | DRIVER_INIT(decathlt); | |
| 59 | DRIVER_INIT(nameclv3); | |
| 60 | ||
| 61 | /*----------- defined in video/stvvdp1.c -----------*/ | |
| 62 | ||
| 63 | extern UINT32* stv_vdp1_vram; | |
| 64 | extern UINT16 **stv_framebuffer_display_lines; | |
| 65 | extern int stv_framebuffer_double_interlace; | |
| 66 | extern int stv_framebuffer_mode; | |
| 67 | extern UINT8* stv_vdp1_gfx_decode; | |
| 68 | ||
| 69 | int stv_vdp1_start ( running_machine *machine ); | |
| 70 | void video_update_vdp1(running_machine *machine); | |
| 71 | ||
| 72 | READ32_HANDLER( stv_vdp1_regs_r ); | |
| 73 | WRITE32_HANDLER( stv_vdp1_regs_w ); | |
| 74 | READ32_HANDLER ( stv_vdp1_vram_r ); | |
| 75 | WRITE32_HANDLER ( stv_vdp1_vram_w ); | |
| 76 | ||
| 77 | WRITE32_HANDLER ( stv_vdp1_framebuffer0_w ); | |
| 78 | READ32_HANDLER ( stv_vdp1_framebuffer0_r ); | |
| 79 | ||
| 80 | /*----------- defined in video/stvvdp2.c -----------*/ | |
| 81 | ||
| 82 | extern UINT32* stv_vdp2_regs; | |
| 83 | extern UINT32* stv_vdp2_vram; | |
| 84 | extern UINT32* stv_vdp2_cram; | |
| 85 | ||
| 86 | WRITE32_HANDLER ( stv_vdp2_vram_w ); | |
| 87 | READ32_HANDLER ( stv_vdp2_vram_r ); | |
| 88 | ||
| 89 | WRITE32_HANDLER ( stv_vdp2_cram_w ); | |
| 90 | READ32_HANDLER ( stv_vdp2_cram_r ); | |
| 91 | ||
| 92 | WRITE32_HANDLER ( stv_vdp2_regs_w ); | |
| 93 | READ32_HANDLER ( stv_vdp2_regs_r ); | |
| 94 | ||
| 95 | VIDEO_START ( stv_vdp2 ); | |
| 96 | VIDEO_UPDATE( stv_vdp2 ); | |
| 97 |
| r2844 | r2845 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | extern int deco16_pf1_colour_bank,deco16_pf2_colour_bank,deco16_pf3_colour_bank,deco16_pf4_colour_bank; |
| 15 | 15 | |
| 16 | void deco16_1_video_init(void); | |
| 17 | void deco16_2_video_init(int split); | |
| 18 | void deco16_2_video_init_half_width(void); | |
| 19 | void deco_allocate_sprite_bitmap(void); | |
| 16 | void deco16_1_video_init(running_machine *machine); | |
| 17 | void deco16_2_video_init(running_machine *machine, int split); | |
| 18 | void deco16_2_video_init_half_width(running_machine *machine); | |
| 19 | void deco_allocate_sprite_bitmap(running_machine *machine); | |
| 20 | 20 | |
| 21 | 21 | void deco16_pf12_update(const UINT16 *rowscroll_1_ptr, const UINT16 *rowscroll_2_ptr); |
| 22 | 22 | void deco16_pf34_update(const UINT16 *rowscroll_1_ptr, const UINT16 *rowscroll_2_ptr); |
| r2844 | r2845 | |
| 37 | 37 | void deco16_tilemap_34_combine_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority); |
| 38 | 38 | |
| 39 | 39 | void deco16_clear_sprite_priority_bitmap(void); |
| 40 | void deco16_pdrawgfx(bitmap_t *dest,const gfx_element *gfx, | |
| 40 | void deco16_pdrawgfx(running_machine *machine, | |
| 41 | bitmap_t *dest,const gfx_element *gfx, | |
| 41 | 42 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 42 | 43 | const rectangle *clip,int transparency,int transparent_color,UINT32 pri_mask,UINT32 sprite_mask,UINT8 write_pri); |
| 43 | 44 |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in drivers/seibuspi.c -----------*/ | |
| 2 | ||
| 3 | extern UINT32 *spimainram; | |
| 4 | ||
| 5 | ||
| 6 | /*----------- defined in machine/spisprit.c -----------*/ | |
| 7 | ||
| 8 | void seibuspi_sprite_decrypt(UINT8 *src, int romsize); | |
| 9 | ||
| 10 | ||
| 11 | /*----------- defined in machine/seibuspi.c -----------*/ | |
| 12 | ||
| 13 | void seibuspi_text_decrypt(UINT8 *rom); | |
| 14 | void seibuspi_bg_decrypt(UINT8 *rom, int size); | |
| 15 | ||
| 16 | void seibuspi_rise10_text_decrypt(UINT8 *rom); | |
| 17 | void seibuspi_rise10_bg_decrypt(UINT8 *rom, int size); | |
| 18 | void seibuspi_rise10_sprite_decrypt(UINT8 *rom, int romsize); | |
| 19 | ||
| 20 | void seibuspi_rise11_text_decrypt(UINT8 *rom); | |
| 21 | void seibuspi_rise11_bg_decrypt(UINT8 *rom, int size); | |
| 22 | void seibuspi_rise11_sprite_decrypt(UINT8 *rom, int romsize); | |
| 23 | ||
| 24 | ||
| 25 | /*----------- defined in video/seibuspi.c -----------*/ | |
| 26 | ||
| 27 | extern UINT32 *spi_scrollram; | |
| 28 | ||
| 29 | VIDEO_START( spi ); | |
| 30 | VIDEO_UPDATE( spi ); | |
| 31 | ||
| 32 | READ32_HANDLER( spi_layer_bank_r ); | |
| 33 | WRITE32_HANDLER( spi_layer_bank_w ); | |
| 34 | WRITE32_HANDLER( spi_layer_enable_w ); | |
| 35 | ||
| 36 | void rf2_set_layer_banks(int banks); | |
| 37 | ||
| 38 | WRITE32_HANDLER( tilemap_dma_start_w ); | |
| 39 | WRITE32_HANDLER( palette_dma_start_w ); | |
| 40 | WRITE32_HANDLER( video_dma_length_w ); | |
| 41 | WRITE32_HANDLER( video_dma_address_w ); | |
| 42 | WRITE32_HANDLER( sprite_dma_start_w ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/gaplus.c -----------*/ | |
| 2 | ||
| 3 | extern UINT8 *gaplus_customio_3; | |
| 4 | WRITE8_HANDLER( gaplus_customio_3_w ); | |
| 5 | READ8_HANDLER( gaplus_customio_3_r ); | |
| 6 | ||
| 7 | ||
| 8 | /*----------- defined in video/gaplus.c -----------*/ | |
| 9 | ||
| 10 | extern UINT8 *gaplus_videoram; | |
| 11 | extern UINT8 *gaplus_spriteram; | |
| 12 | READ8_HANDLER( gaplus_videoram_r ); | |
| 13 | WRITE8_HANDLER( gaplus_videoram_w ); | |
| 14 | WRITE8_HANDLER( gaplus_starfield_control_w ); | |
| 15 | VIDEO_START( gaplus ); | |
| 16 | PALETTE_INIT( gaplus ); | |
| 17 | VIDEO_UPDATE( gaplus ); | |
| 18 | VIDEO_EOF( gaplus ); /* update starfields */ |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in drivers/namcos1.c -----------*/ | |
| 2 | ||
| 3 | void namcos1_init_DACs(void); | |
| 4 | ||
| 5 | ||
| 6 | /*----------- defined in machine/namcos1.c -----------*/ | |
| 7 | ||
| 8 | extern UINT8 *namcos1_paletteram; | |
| 9 | ||
| 10 | WRITE8_HANDLER( namcos1_bankswitch_w ); | |
| 11 | WRITE8_HANDLER( namcos1_subcpu_bank_w ); | |
| 12 | ||
| 13 | WRITE8_HANDLER( namcos1_cpu_control_w ); | |
| 14 | WRITE8_HANDLER( namcos1_watchdog_w ); | |
| 15 | WRITE8_HANDLER( namcos1_sound_bankswitch_w ); | |
| 16 | ||
| 17 | WRITE8_HANDLER( namcos1_mcu_bankswitch_w ); | |
| 18 | WRITE8_HANDLER( namcos1_mcu_patch_w ); | |
| 19 | ||
| 20 | MACHINE_RESET( namcos1 ); | |
| 21 | ||
| 22 | DRIVER_INIT( shadowld ); | |
| 23 | DRIVER_INIT( dspirit ); | |
| 24 | DRIVER_INIT( quester ); | |
| 25 | DRIVER_INIT( blazer ); | |
| 26 | DRIVER_INIT( pacmania ); | |
| 27 | DRIVER_INIT( galaga88 ); | |
| 28 | DRIVER_INIT( ws ); | |
| 29 | DRIVER_INIT( berabohm ); | |
| 30 | DRIVER_INIT( alice ); | |
| 31 | DRIVER_INIT( bakutotu ); | |
| 32 | DRIVER_INIT( wldcourt ); | |
| 33 | DRIVER_INIT( splatter ); | |
| 34 | DRIVER_INIT( faceoff ); | |
| 35 | DRIVER_INIT( rompers ); | |
| 36 | DRIVER_INIT( blastoff ); | |
| 37 | DRIVER_INIT( ws89 ); | |
| 38 | DRIVER_INIT( dangseed ); | |
| 39 | DRIVER_INIT( ws90 ); | |
| 40 | DRIVER_INIT( pistoldm ); | |
| 41 | DRIVER_INIT( soukobdx ); | |
| 42 | DRIVER_INIT( puzlclub ); | |
| 43 | DRIVER_INIT( tankfrce ); | |
| 44 | ||
| 45 | ||
| 46 | /*----------- defined in video/namcos1.c -----------*/ | |
| 47 | ||
| 48 | READ8_HANDLER( namcos1_videoram_r ); | |
| 49 | WRITE8_HANDLER( namcos1_videoram_w ); | |
| 50 | WRITE8_HANDLER( namcos1_paletteram_w ); | |
| 51 | READ8_HANDLER( namcos1_spriteram_r ); | |
| 52 | WRITE8_HANDLER( namcos1_spriteram_w ); | |
| 53 | ||
| 54 | VIDEO_START( namcos1 ); | |
| 55 | VIDEO_UPDATE( namcos1 ); | |
| 56 | VIDEO_EOF( namcos1 ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in video/vsnes.c -----------*/ | |
| 2 | ||
| 3 | VIDEO_START( vsnes ); | |
| 4 | PALETTE_INIT( vsnes ); | |
| 5 | VIDEO_UPDATE( vsnes ); | |
| 6 | VIDEO_START( vsdual ); | |
| 7 | VIDEO_UPDATE( vsdual ); | |
| 8 | PALETTE_INIT( vsdual ); | |
| 9 | ||
| 10 | ||
| 11 | /*----------- defined in machine/vsnes.c -----------*/ | |
| 12 | ||
| 13 | MACHINE_RESET( vsnes ); | |
| 14 | MACHINE_RESET( vsdual ); | |
| 15 | DRIVER_INIT( suprmrio ); | |
| 16 | DRIVER_INIT( excitebk ); | |
| 17 | DRIVER_INIT( excitbkj ); | |
| 18 | DRIVER_INIT( vsnormal ); | |
| 19 | DRIVER_INIT( duckhunt ); | |
| 20 | DRIVER_INIT( hogalley ); | |
| 21 | DRIVER_INIT( goonies ); | |
| 22 | DRIVER_INIT( machridr ); | |
| 23 | DRIVER_INIT( vsslalom ); | |
| 24 | DRIVER_INIT( cstlevna ); | |
| 25 | DRIVER_INIT( drmario ); | |
| 26 | DRIVER_INIT( rbibb ); | |
| 27 | DRIVER_INIT( tkoboxng ); | |
| 28 | DRIVER_INIT( topgun ); | |
| 29 | DRIVER_INIT( vsgradus ); | |
| 30 | DRIVER_INIT( vspinbal ); | |
| 31 | DRIVER_INIT( MMC3 ); | |
| 32 | DRIVER_INIT( platoon ); | |
| 33 | DRIVER_INIT( vstennis ); | |
| 34 | DRIVER_INIT( wrecking ); | |
| 35 | DRIVER_INIT( balonfgt ); | |
| 36 | DRIVER_INIT( vsbball ); | |
| 37 | DRIVER_INIT( iceclmrj ); | |
| 38 | DRIVER_INIT( supxevs ); | |
| 39 | DRIVER_INIT( btlecity ); | |
| 40 | DRIVER_INIT( vstetris ); | |
| 41 | DRIVER_INIT( bnglngby ); | |
| 42 | DRIVER_INIT( jajamaru); | |
| 43 | DRIVER_INIT( vsgshoe ); | |
| 44 | DRIVER_INIT( vsfdf ); | |
| 45 | DRIVER_INIT( mightybj); | |
| 46 | ||
| 47 | READ8_HANDLER( vsnes_in0_r ); | |
| 48 | READ8_HANDLER( vsnes_in1_r ); | |
| 49 | READ8_HANDLER( vsnes_in0_1_r ); | |
| 50 | READ8_HANDLER( vsnes_in1_1_r ); | |
| 51 | WRITE8_HANDLER( vsnes_in0_w ); | |
| 52 | WRITE8_HANDLER( vsnes_in0_1_w ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/mexico86.c -----------*/ | |
| 2 | ||
| 3 | extern UINT8 *mexico86_protection_ram; | |
| 4 | ||
| 5 | WRITE8_HANDLER( mexico86_f008_w ); | |
| 6 | INTERRUPT_GEN( kikikai_interrupt ); | |
| 7 | INTERRUPT_GEN( mexico86_m68705_interrupt ); | |
| 8 | READ8_HANDLER( mexico86_68705_portA_r ); | |
| 9 | WRITE8_HANDLER( mexico86_68705_portA_w ); | |
| 10 | WRITE8_HANDLER( mexico86_68705_ddrA_w ); | |
| 11 | READ8_HANDLER( mexico86_68705_portB_r ); | |
| 12 | WRITE8_HANDLER( mexico86_68705_portB_w ); | |
| 13 | WRITE8_HANDLER( mexico86_68705_ddrB_w ); | |
| 14 | ||
| 15 | ||
| 16 | /*----------- defined in video/mexico86.c -----------*/ | |
| 17 | ||
| 18 | extern UINT8 *mexico86_videoram,*mexico86_objectram; | |
| 19 | extern size_t mexico86_objectram_size; | |
| 20 | ||
| 21 | WRITE8_HANDLER( mexico86_bankswitch_w ); | |
| 22 | VIDEO_UPDATE( mexico86 ); | |
| 23 | VIDEO_UPDATE( kikikai ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/chaknpop.c -----------*/ | |
| 2 | ||
| 3 | extern UINT8 *chaknpop_ram; | |
| 4 | DRIVER_INIT( chaknpop ); | |
| 5 | MACHINE_RESET( chaknpop ); | |
| 6 | READ8_HANDLER( chaknpop_mcu_portA_r ); | |
| 7 | READ8_HANDLER( chaknpop_mcu_portB_r ); | |
| 8 | READ8_HANDLER( chaknpop_mcu_portC_r ); | |
| 9 | WRITE8_HANDLER( chaknpop_mcu_portA_w ); | |
| 10 | WRITE8_HANDLER( chaknpop_mcu_portB_w ); | |
| 11 | WRITE8_HANDLER( chaknpop_mcu_portC_w ); | |
| 12 | ||
| 13 | ||
| 14 | /*----------- defined in video/chaknpop.c -----------*/ | |
| 15 | ||
| 16 | extern UINT8 *chaknpop_txram; | |
| 17 | extern UINT8 *chaknpop_sprram; | |
| 18 | extern size_t chaknpop_sprram_size; | |
| 19 | extern UINT8 *chaknpop_attrram; | |
| 20 | ||
| 21 | PALETTE_INIT( chaknpop ); | |
| 22 | VIDEO_START( chaknpop ); | |
| 23 | VIDEO_UPDATE( chaknpop ); | |
| 24 | ||
| 25 | READ8_HANDLER( chaknpop_gfxmode_r ); | |
| 26 | WRITE8_HANDLER( chaknpop_gfxmode_w ); | |
| 27 | ||
| 28 | WRITE8_HANDLER( chaknpop_txram_w ); | |
| 29 | ||
| 30 | WRITE8_HANDLER( chaknpop_attrram_w ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/taitosj.c -----------*/ | |
| 2 | ||
| 3 | MACHINE_START( taitosj ); | |
| 4 | MACHINE_RESET( taitosj ); | |
| 5 | WRITE8_HANDLER( taitosj_bankswitch_w ); | |
| 6 | READ8_HANDLER( taitosj_fake_data_r ); | |
| 7 | READ8_HANDLER( taitosj_fake_status_r ); | |
| 8 | WRITE8_HANDLER( taitosj_fake_data_w ); | |
| 9 | READ8_HANDLER( taitosj_mcu_data_r ); | |
| 10 | READ8_HANDLER( taitosj_mcu_status_r ); | |
| 11 | WRITE8_HANDLER( taitosj_mcu_data_w ); | |
| 12 | READ8_HANDLER( taitosj_68705_portA_r ); | |
| 13 | READ8_HANDLER( taitosj_68705_portB_r ); | |
| 14 | READ8_HANDLER( taitosj_68705_portC_r ); | |
| 15 | WRITE8_HANDLER( taitosj_68705_portA_w ); | |
| 16 | WRITE8_HANDLER( taitosj_68705_portB_w ); | |
| 17 | ||
| 18 | READ8_HANDLER( spacecr_prot_r ); | |
| 19 | WRITE8_HANDLER( alpine_protection_w ); | |
| 20 | WRITE8_HANDLER( alpinea_bankswitch_w ); | |
| 21 | READ8_HANDLER( alpine_port_2_r ); | |
| 22 | ||
| 23 | ||
| 24 | /*----------- defined in video/taitosj.c -----------*/ | |
| 25 | ||
| 26 | extern UINT8 *taitosj_videoram_1; | |
| 27 | extern UINT8 *taitosj_videoram_2; | |
| 28 | extern UINT8 *taitosj_videoram_3; | |
| 29 | extern UINT8 *taitosj_spriteram; | |
| 30 | extern UINT8 *taitosj_paletteram; | |
| 31 | extern UINT8 *taitosj_characterram; | |
| 32 | extern UINT8 *taitosj_scroll; | |
| 33 | extern UINT8 *taitosj_colscrolly; | |
| 34 | extern UINT8 *taitosj_gfxpointer; | |
| 35 | extern UINT8 *taitosj_colorbank; | |
| 36 | extern UINT8 *taitosj_video_mode; | |
| 37 | extern UINT8 *taitosj_video_priority; | |
| 38 | extern UINT8 *taitosj_collision_reg; | |
| 39 | extern UINT8 *kikstart_scrollram; | |
| 40 | ||
| 41 | READ8_HANDLER( taitosj_gfxrom_r ); | |
| 42 | WRITE8_HANDLER( taitosj_characterram_w ); | |
| 43 | WRITE8_HANDLER( junglhbr_characterram_w ); | |
| 44 | WRITE8_HANDLER( taitosj_collision_reg_clear_w ); | |
| 45 | VIDEO_START( taitosj ); | |
| 46 | VIDEO_UPDATE( taitosj ); | |
| 47 | VIDEO_UPDATE( kikstart ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/lkage.c -----------*/ | |
| 2 | ||
| 3 | READ8_HANDLER( lkage_68705_portA_r ); | |
| 4 | WRITE8_HANDLER( lkage_68705_portA_w ); | |
| 5 | READ8_HANDLER( lkage_68705_portB_r ); | |
| 6 | WRITE8_HANDLER( lkage_68705_portB_w ); | |
| 7 | READ8_HANDLER( lkage_68705_portC_r ); | |
| 8 | WRITE8_HANDLER( lkage_68705_portC_w ); | |
| 9 | WRITE8_HANDLER( lkage_68705_ddrA_w ); | |
| 10 | WRITE8_HANDLER( lkage_68705_ddrB_w ); | |
| 11 | WRITE8_HANDLER( lkage_68705_ddrC_w ); | |
| 12 | WRITE8_HANDLER( lkage_mcu_w ); | |
| 13 | READ8_HANDLER( lkage_mcu_r ); | |
| 14 | READ8_HANDLER( lkage_mcu_status_r ); | |
| 15 | ||
| 16 | ||
| 17 | /*----------- defined in video/lkage.c -----------*/ | |
| 18 | ||
| 19 | extern UINT8 *lkage_scroll, *lkage_vreg; | |
| 20 | WRITE8_HANDLER( lkage_videoram_w ); | |
| 21 | VIDEO_START( lkage ); | |
| 22 | VIDEO_UPDATE( lkage ); | |
| 23 |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | |
| 8 | 8 | /*----------- defined in video/fastfred.c -----------*/ |
| 9 | 9 | |
| 10 | extern int fastfred_hardware_type; | |
| 11 | ||
| 10 | 12 | extern UINT8 *fastfred_videoram; |
| 11 | 13 | extern UINT8 *fastfred_spriteram; |
| 12 | 14 | extern size_t fastfred_spriteram_size; |
| r2844 | r2845 | |
|---|---|---|
| 107 | 107 | WRITE16_HANDLER( namcos2_sprite_ram_w ); |
| 108 | 108 | READ16_HANDLER( namcos2_sprite_ram_r ); |
| 109 | 109 | |
| 110 | int namcos2_GetPosIrqScanline( | |
| 110 | int namcos2_GetPosIrqScanline( running_machine *machine ); | |
| 111 | 111 | |
| 112 | 112 | WRITE16_HANDLER( namcos2_gfx_ctrl_w ); |
| 113 | 113 | READ16_HANDLER( namcos2_gfx_ctrl_r ); |
| r2844 | r2845 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | extern UINT16 *deco16_prot_ram; |
| 26 | 26 | extern UINT32 *deco32_prot_ram; |
| 27 | ||
| 28 | READ16_HANDLER( dietgo_104_prot_r ); | |
| 29 | WRITE16_HANDLER( dietgo_104_prot_w ); |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | /*----------- defined in drivers/tatsumi.c -----------*/ |
| 2 | 2 | |
| 3 | extern UINT16 bigfight_a40000[2]; | |
| 4 | ||
| 3 | 5 | extern UINT8* tatsumi_rom_sprite_lookup1; |
| 4 | 6 | extern UINT8* tatsumi_rom_sprite_lookup2; |
| 5 | 7 | extern UINT8* tatsumi_rom_clut0; |
| r2844 | r2845 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | /*----------- defined in video/cloak.c -----------*/ |
| 8 | 8 | |
| 9 | WRITE8_HANDLER( cloak_videoram_w ); | |
| 10 | WRITE8_HANDLER( cloak_flipscreen_w ); | |
| 11 | ||
| 9 | 12 | WRITE8_HANDLER( cloak_paletteram_w ); |
| 10 | 13 | READ8_HANDLER( graph_processor_r ); |
| 11 | 14 | WRITE8_HANDLER( graph_processor_w ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/retofinv.c -----------*/ | |
| 2 | ||
| 3 | READ8_HANDLER( retofinv_68705_portA_r ); | |
| 4 | WRITE8_HANDLER( retofinv_68705_portA_w ); | |
| 5 | WRITE8_HANDLER( retofinv_68705_ddrA_w ); | |
| 6 | READ8_HANDLER( retofinv_68705_portB_r ); | |
| 7 | WRITE8_HANDLER( retofinv_68705_portB_w ); | |
| 8 | WRITE8_HANDLER( retofinv_68705_ddrB_w ); | |
| 9 | READ8_HANDLER( retofinv_68705_portC_r ); | |
| 10 | WRITE8_HANDLER( retofinv_68705_portC_w ); | |
| 11 | WRITE8_HANDLER( retofinv_68705_ddrC_w ); | |
| 12 | WRITE8_HANDLER( retofinv_mcu_w ); | |
| 13 | READ8_HANDLER( retofinv_mcu_r ); | |
| 14 | READ8_HANDLER( retofinv_mcu_status_r ); | |
| 15 | ||
| 16 | ||
| 17 | /*----------- defined in video/retofinv.c -----------*/ | |
| 18 | ||
| 19 | extern UINT8 *retofinv_fg_videoram; | |
| 20 | extern UINT8 *retofinv_bg_videoram; | |
| 21 | extern UINT8 *retofinv_sharedram; | |
| 22 | ||
| 23 | VIDEO_START( retofinv ); | |
| 24 | PALETTE_INIT( retofinv ); | |
| 25 | VIDEO_UPDATE( retofinv ); | |
| 26 | WRITE8_HANDLER( retofinv_bg_videoram_w ); | |
| 27 | WRITE8_HANDLER( retofinv_fg_videoram_w ); | |
| 28 | WRITE8_HANDLER( retofinv_gfx_ctrl_w ); |
| r2844 | r2845 | |
|---|---|---|
| 13 | 13 | VIDEO_START( psx_type2 ); |
| 14 | 14 | VIDEO_UPDATE( psx ); |
| 15 | 15 | INTERRUPT_GEN( psx_vblank ); |
| 16 | extern void psx_gpu_reset( | |
| 16 | extern void psx_gpu_reset( running_machine *machine ); | |
| 17 | 17 | extern void psx_gpu_read( UINT32 *p_ram, INT32 n_size ); |
| 18 | 18 | extern void psx_gpu_write( UINT32 *p_ram, INT32 n_size ); |
| 19 | 19 | READ32_HANDLER( psx_gpu_r ); |
| r2844 | r2845 | |
| 53 | 53 | |
| 54 | 54 | WRITE32_HANDLER( psx_mdec_w ); |
| 55 | 55 | READ32_HANDLER( psx_mdec_r ); |
| 56 | extern void psx_machine_init( | |
| 56 | extern void psx_machine_init( running_machine *machine ); | |
| 57 | 57 | extern void psx_driver_init( running_machine *machine ); |
| 58 | 58 | |
| 59 | 59 | #define PSX_H ( 1 ) |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/beezer.c -----------*/ | |
| 2 | ||
| 3 | DRIVER_INIT( beezer ); | |
| 4 | WRITE8_HANDLER( beezer_bankswitch_w ); | |
| 5 | ||
| 6 | ||
| 7 | /*----------- defined in video/beezer.c -----------*/ | |
| 8 | ||
| 9 | INTERRUPT_GEN( beezer_interrupt ); | |
| 10 | VIDEO_UPDATE( beezer ); | |
| 11 | WRITE8_HANDLER( beezer_map_w ); | |
| 12 | READ8_HANDLER( beezer_line_r ); |
| r2844 | r2845 | |
|---|---|---|
| 28 | 28 | WRITE16_HANDLER( toybox_mcu_com3_w ); |
| 29 | 29 | READ16_HANDLER( toybox_mcu_status_r ); |
| 30 | 30 | |
| 31 | extern void (*toybox_mcu_run)(running_machine *machine); /* one of the following */ | |
| 32 | void bloodwar_mcu_run(running_machine *machine); | |
| 33 | void bonkadv_mcu_run(running_machine *machine); | |
| 34 | void gtmr_mcu_run(running_machine *machine); | |
| 31 | 35 | |
| 32 | 36 | |
| 33 | 37 | /*----------- defined in drivers/kaneko16.c -----------*/ |
| r2844 | r2845 | |
| 103 | 107 | VIDEO_UPDATE( sandscrp ); |
| 104 | 108 | VIDEO_UPDATE( berlwall ); |
| 105 | 109 | |
| 110 | VIDEO_START( galsnew ); | |
| 111 | VIDEO_UPDATE( galsnew ); | |
| 106 | 112 | |
| 113 | extern UINT16* galsnew_bg_pixram; | |
| 114 | extern UINT16* galsnew_fg_pixram; | |
| 115 | ||
| 116 | ||
| 107 | 117 | /*----------- defined in drivers/galpani2.c -----------*/ |
| 108 | 118 | |
| 109 | 119 | void galpani2_mcu_run(void); |
| r2844 | r2845 | |
|---|---|---|
| 24 | 24 | VIDEO_START( system18 ); |
| 25 | 25 | VIDEO_UPDATE( system18 ); |
| 26 | 26 | |
| 27 | void system18_set_grayscale(int enable); | |
| 28 | void system18_set_vdp_enable(int eanble); | |
| 29 | void system18_set_vdp_mixing(int mixing); | |
| 27 | void system18_set_grayscale(running_machine *machine, int enable); | |
| 28 | void system18_set_vdp_enable(running_machine *machine, int eanble); | |
| 29 | void system18_set_vdp_mixing(running_machine *machine, int mixing); | |
| 30 | 30 | |
| 31 | 31 | /*----------- defined in video/segaorun.c -----------*/ |
| 32 | 32 |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in video/legionna.c -----------*/ | |
| 2 | ||
| 3 | extern UINT16 *legionna_back_data,*legionna_fore_data,*legionna_mid_data,*legionna_scrollram16,*legionna_textram; | |
| 4 | extern UINT8 sdgndmrb_pri_n; | |
| 5 | extern UINT16 legionna_layer_disable; | |
| 6 | ||
| 7 | void heatbrl_setgfxbank(UINT16 data); | |
| 8 | void denjinmk_setgfxbank(UINT16 data); | |
| 9 | WRITE16_HANDLER( legionna_background_w ); | |
| 10 | WRITE16_HANDLER( legionna_foreground_w ); | |
| 11 | WRITE16_HANDLER( legionna_midground_w ); | |
| 12 | WRITE16_HANDLER( legionna_text_w ); | |
| 13 | ||
| 14 | VIDEO_START( legionna ); | |
| 15 | VIDEO_START( cupsoc ); | |
| 16 | VIDEO_START( denjinmk ); | |
| 17 | VIDEO_UPDATE( legionna ); | |
| 18 | VIDEO_UPDATE( godzilla ); | |
| 19 | VIDEO_UPDATE( sdgndmrb ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/simpsons.c -----------*/ | |
| 2 | ||
| 3 | extern int simpsons_firq_enabled; | |
| 4 | ||
| 5 | READ8_HANDLER( simpsons_eeprom_r ); | |
| 6 | WRITE8_HANDLER( simpsons_eeprom_w ); | |
| 7 | WRITE8_HANDLER( simpsons_coin_counter_w ); | |
| 8 | READ8_HANDLER( simpsons_sound_interrupt_r ); | |
| 9 | READ8_HANDLER( simpsons_sound_r ); | |
| 10 | MACHINE_RESET( simpsons ); | |
| 11 | NVRAM_HANDLER( simpsons ); | |
| 12 | ||
| 13 | /*----------- defined in video/simpsons.c -----------*/ | |
| 14 | ||
| 15 | extern UINT8 *simpsons_xtraram; | |
| 16 | ||
| 17 | void simpsons_video_banking( running_machine *machine, int select ); | |
| 18 | VIDEO_START( simpsons ); | |
| 19 | VIDEO_UPDATE( simpsons ); |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "sound/discrete.h" |
| 8 | #include "sound/custom.h" | |
| 8 | 9 | |
| 9 | 10 | |
| 10 | 11 | /*----------- defined in audio/polepos.c -----------*/ |
| 11 | 12 | |
| 13 | void *polepos_sh_start(int clock, const struct CustomSound_interface *config); | |
| 14 | void polepos_sh_reset(void *token); | |
| 15 | WRITE8_HANDLER( polepos_engine_sound_lsb_w ); | |
| 16 | WRITE8_HANDLER( polepos_engine_sound_msb_w ); | |
| 17 | ||
| 12 | 18 | DISCRETE_SOUND_EXTERN( polepos ); |
| 19 | ||
| 20 | ||
| 21 | /*----------- defined in video/polepos.c -----------*/ | |
| 22 | ||
| 23 | extern UINT16 *polepos_view16_memory; | |
| 24 | extern UINT16 *polepos_road16_memory; | |
| 25 | extern UINT16 *polepos_alpha16_memory; | |
| 26 | extern UINT16 *polepos_sprite16_memory; | |
| 27 | extern int polepos_gear_bit; | |
| 28 | ||
| 29 | VIDEO_START( polepos ); | |
| 30 | PALETTE_INIT( polepos ); | |
| 31 | VIDEO_UPDATE( polepos ); | |
| 32 | ||
| 33 | WRITE16_HANDLER( polepos_view16_w ); | |
| 34 | WRITE16_HANDLER( polepos_road16_w ); | |
| 35 | WRITE16_HANDLER( polepos_alpha16_w ); | |
| 36 | WRITE16_HANDLER( polepos_sprite16_w ); | |
| 37 | WRITE8_HANDLER( polepos_view_w ); | |
| 38 | WRITE8_HANDLER( polepos_road_w ); | |
| 39 | WRITE8_HANDLER( polepos_alpha_w ); | |
| 40 | WRITE8_HANDLER( polepos_sprite_w ); | |
| 41 | WRITE8_HANDLER( polepos_chacl_w ); | |
| 42 | ||
| 43 | READ16_HANDLER( polepos_view16_r ); | |
| 44 | READ16_HANDLER( polepos_road16_r ); | |
| 45 | READ16_HANDLER( polepos_alpha16_r ); | |
| 46 | READ16_HANDLER( polepos_sprite16_r ); | |
| 47 | READ8_HANDLER( polepos_view_r ); | |
| 48 | READ8_HANDLER( polepos_road_r ); | |
| 49 | READ8_HANDLER( polepos_alpha_r ); | |
| 50 | READ8_HANDLER( polepos_sprite_r ); | |
| 51 | WRITE16_HANDLER( polepos_view16_hscroll_w ); | |
| 52 | WRITE16_HANDLER( polepos_road16_vscroll_w ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/model1.c -----------*/ | |
| 2 | ||
| 3 | extern const struct mb86233_config model1_vr_tgp_config; | |
| 4 | extern int model1_dump; | |
| 5 | ||
| 6 | READ16_HANDLER( model1_tgp_copro_r ); | |
| 7 | WRITE16_HANDLER( model1_tgp_copro_w ); | |
| 8 | READ16_HANDLER( model1_tgp_copro_adr_r ); | |
| 9 | WRITE16_HANDLER( model1_tgp_copro_adr_w ); | |
| 10 | READ16_HANDLER( model1_tgp_copro_ram_r ); | |
| 11 | WRITE16_HANDLER( model1_tgp_copro_ram_w ); | |
| 12 | ||
| 13 | READ16_HANDLER( model1_vr_tgp_r ); | |
| 14 | WRITE16_HANDLER( model1_vr_tgp_w ); | |
| 15 | READ16_HANDLER( model1_tgp_vr_adr_r ); | |
| 16 | WRITE16_HANDLER( model1_tgp_vr_adr_w ); | |
| 17 | READ16_HANDLER( model1_vr_tgp_ram_r ); | |
| 18 | WRITE16_HANDLER( model1_vr_tgp_ram_w ); | |
| 19 | ||
| 20 | ADDRESS_MAP_EXTERN( model1_vr_tgp_map, 32 ); | |
| 21 | ||
| 22 | void model1_vr_tgp_reset( void ); | |
| 23 | void model1_tgp_reset(int swa); | |
| 24 | ||
| 25 | ||
| 26 | /*----------- defined in video/model1.c -----------*/ | |
| 27 | ||
| 28 | extern UINT16 *model1_display_list0, *model1_display_list1; | |
| 29 | extern UINT16 *model1_color_xlat; | |
| 30 | ||
| 31 | VIDEO_START(model1); | |
| 32 | VIDEO_UPDATE(model1); | |
| 33 | VIDEO_EOF(model1); | |
| 34 | ||
| 35 | READ16_HANDLER( model1_listctl_r ); | |
| 36 | WRITE16_HANDLER( model1_listctl_w ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/jackal.c -----------*/ | |
| 2 | ||
| 3 | MACHINE_RESET( jackal ); | |
| 4 | ||
| 5 | READ8_HANDLER( jackal_zram_r ); | |
| 6 | READ8_HANDLER( jackal_voram_r ); | |
| 7 | READ8_HANDLER( jackal_spriteram_r ); | |
| 8 | ||
| 9 | WRITE8_HANDLER( jackal_rambank_w ); | |
| 10 | WRITE8_HANDLER( jackal_zram_w ); | |
| 11 | WRITE8_HANDLER( jackal_voram_w ); | |
| 12 | WRITE8_HANDLER( jackal_spriteram_w ); | |
| 13 | ||
| 14 | ||
| 15 | /*----------- defined in video/jackal.c -----------*/ | |
| 16 | ||
| 17 | extern UINT8 *jackal_videoctrl; | |
| 18 | ||
| 19 | void jackal_mark_tile_dirty(int offset); | |
| 20 | PALETTE_INIT( jackal ); | |
| 21 | VIDEO_START( jackal ); | |
| 22 | VIDEO_UPDATE( jackal ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/btime.c -----------*/ | |
| 2 | ||
| 3 | READ8_HANDLER( mmonkey_protection_r ); | |
| 4 | WRITE8_HANDLER( mmonkey_protection_w ); | |
| 5 | ||
| 6 | ||
| 7 | /*----------- defined in video/btime.c -----------*/ | |
| 8 | ||
| 9 | extern UINT8 *btime_videoram; | |
| 10 | extern size_t btime_videoram_size; | |
| 11 | extern UINT8 *btime_colorram; | |
| 12 | extern UINT8 *lnc_charbank; | |
| 13 | extern UINT8 *bnj_backgroundram; | |
| 14 | extern size_t bnj_backgroundram_size; | |
| 15 | extern UINT8 *zoar_scrollram; | |
| 16 | extern UINT8 *deco_charram; | |
| 17 | ||
| 18 | PALETTE_INIT( btime ); | |
| 19 | PALETTE_INIT( lnc ); | |
| 20 | ||
| 21 | MACHINE_RESET( lnc ); | |
| 22 | ||
| 23 | VIDEO_START( btime ); | |
| 24 | VIDEO_START( bnj ); | |
| 25 | ||
| 26 | ||
| 27 | VIDEO_UPDATE( btime ); | |
| 28 | VIDEO_UPDATE( cookrace ); | |
| 29 | VIDEO_UPDATE( bnj ); | |
| 30 | VIDEO_UPDATE( lnc ); | |
| 31 | VIDEO_UPDATE( zoar ); | |
| 32 | VIDEO_UPDATE( disco ); | |
| 33 | VIDEO_UPDATE( eggs ); | |
| 34 | VIDEO_UPDATE( progolf ); | |
| 35 | ||
| 36 | WRITE8_HANDLER( btime_paletteram_w ); | |
| 37 | WRITE8_HANDLER( bnj_background_w ); | |
| 38 | WRITE8_HANDLER( bnj_scroll1_w ); | |
| 39 | WRITE8_HANDLER( bnj_scroll2_w ); | |
| 40 | READ8_HANDLER( btime_mirrorvideoram_r ); | |
| 41 | WRITE8_HANDLER( btime_mirrorvideoram_w ); | |
| 42 | READ8_HANDLER( btime_mirrorcolorram_r ); | |
| 43 | WRITE8_HANDLER( btime_mirrorcolorram_w ); | |
| 44 | WRITE8_HANDLER( lnc_videoram_w ); | |
| 45 | WRITE8_HANDLER( lnc_mirrorvideoram_w ); | |
| 46 | WRITE8_HANDLER( deco_charram_w ); | |
| 47 | ||
| 48 | WRITE8_HANDLER( zoar_video_control_w ); | |
| 49 | WRITE8_HANDLER( btime_video_control_w ); | |
| 50 | WRITE8_HANDLER( bnj_video_control_w ); | |
| 51 | WRITE8_HANDLER( lnc_video_control_w ); | |
| 52 | WRITE8_HANDLER( disco_video_control_w ); | |
| 53 | ||
| 54 | INTERRUPT_GEN( lnc_sound_interrupt ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/playch10.c -----------*/ | |
| 2 | ||
| 3 | MACHINE_RESET( pc10 ); | |
| 4 | DRIVER_INIT( playch10 ); /* standard games */ | |
| 5 | DRIVER_INIT( pc_gun ); /* gun games */ | |
| 6 | DRIVER_INIT( pc_hrz ); /* horizontal games */ | |
| 7 | DRIVER_INIT( pcaboard ); /* a-board games */ | |
| 8 | DRIVER_INIT( pcbboard ); /* b-board games */ | |
| 9 | DRIVER_INIT( pccboard ); /* c-board games */ | |
| 10 | DRIVER_INIT( pcdboard ); /* d-board games */ | |
| 11 | DRIVER_INIT( pcdboard_2 ); /* d-board games with extra ram */ | |
| 12 | DRIVER_INIT( pceboard ); /* e-board games */ | |
| 13 | DRIVER_INIT( pcfboard ); /* f-board games */ | |
| 14 | DRIVER_INIT( pcfboard_2 ); /* f-board games with extra ram */ | |
| 15 | DRIVER_INIT( pcgboard ); /* g-board games */ | |
| 16 | DRIVER_INIT( pcgboard_type2 ); /* g-board games with 4 screen mirror */ | |
| 17 | DRIVER_INIT( pchboard ); /* h-board games */ | |
| 18 | DRIVER_INIT( pciboard ); /* i-board games */ | |
| 19 | DRIVER_INIT( pckboard ); /* k-board games */ | |
| 20 | READ8_HANDLER( pc10_port_0_r ); | |
| 21 | READ8_HANDLER( pc10_prot_r ); | |
| 22 | READ8_HANDLER( pc10_detectclr_r ); | |
| 23 | READ8_HANDLER( pc10_in0_r ); | |
| 24 | READ8_HANDLER( pc10_in1_r ); | |
| 25 | WRITE8_HANDLER( pc10_SDCS_w ); | |
| 26 | WRITE8_HANDLER( pc10_CNTRLMASK_w ); | |
| 27 | WRITE8_HANDLER( pc10_DISPMASK_w ); | |
| 28 | WRITE8_HANDLER( pc10_SOUNDMASK_w ); | |
| 29 | WRITE8_HANDLER( pc10_NMIENABLE_w ); | |
| 30 | WRITE8_HANDLER( pc10_DOGDI_w ); | |
| 31 | WRITE8_HANDLER( pc10_GAMERES_w ); | |
| 32 | WRITE8_HANDLER( pc10_GAMESTOP_w ); | |
| 33 | WRITE8_HANDLER( pc10_PPURES_w ); | |
| 34 | WRITE8_HANDLER( pc10_prot_w ); | |
| 35 | WRITE8_HANDLER( pc10_CARTSEL_w ); | |
| 36 | WRITE8_HANDLER( pc10_in0_w ); | |
| 37 | ||
| 38 | extern int pc10_nmi_enable; | |
| 39 | extern int pc10_dog_di; | |
| 40 | extern int pc10_sdcs; /* ShareD Chip Select */ | |
| 41 | extern int pc10_dispmask; /* Display Mask */ | |
| 42 | extern int pc10_int_detect; | |
| 43 | extern int pc10_game_mode; | |
| 44 | extern int pc10_dispmask_old; | |
| 45 | ||
| 46 | ||
| 47 | /*----------- defined in video/playch10.c -----------*/ | |
| 48 | ||
| 49 | WRITE8_HANDLER( playch10_videoram_w ); | |
| 50 | PALETTE_INIT( playch10 ); | |
| 51 | VIDEO_START( playch10 ); | |
| 52 | VIDEO_START( playch10_hboard ); | |
| 53 | VIDEO_UPDATE( playch10 ); |
| r2844 | r2845 | |
|---|---|---|
| 34 | 34 | extern UINT8 galaxian_sprite_clip_end; |
| 35 | 35 | |
| 36 | 36 | PALETTE_INIT( galaxian ); |
| 37 | PALETTE_INIT( moonwar ); | |
| 37 | 38 | |
| 38 | 39 | VIDEO_START( galaxian ); |
| 39 | 40 | VIDEO_UPDATE( galaxian ); |
| r2844 | r2845 | |
| 98 | 99 | |
| 99 | 100 | /* Batman Part 2 extensions */ |
| 100 | 101 | void batman2_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 101 | void batman2_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); | |
| 102 | 102 | |
| 103 | 103 | /* Moon Cresta extensions */ |
| 104 | 104 | void mooncrst_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| r2844 | r2845 | |
| 112 | 112 | void mshuttle_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 113 | 113 | void mshuttle_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| 114 | 114 | |
| 115 | /* Calipso extensions */ | |
| 116 | void calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); | |
| 117 | ||
| 115 | 118 | /* Jumpbug extensions */ |
| 116 | 119 | void jumpbug_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); |
| 117 | 120 | void jumpbug_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); |
| r2844 | r2845 | |
| 120 | 123 | |
| 121 | 124 | /*----------- defined in audio/galaxian.c -----------*/ |
| 122 | 125 | |
| 126 | extern const struct Samplesinterface galaxian_samples_interface; | |
| 123 | 127 | extern const struct Samplesinterface galaxian_custom_interface; |
| 128 | ||
| 124 | 129 | WRITE8_HANDLER( galaxian_sound_w ); |
| 125 | 130 | WRITE8_HANDLER( galaxian_pitch_w ); |
| 126 | 131 | WRITE8_HANDLER( galaxian_vol_w ); |
| r2844 | r2845 | |
|---|---|---|
| 69 | 69 | #define CG10103_0_vram (CG10103[0].vram) |
| 70 | 70 | #define CG10103_1_vram (CG10103[1].vram) |
| 71 | 71 | |
| 72 | VIDEO_UPDATE( gstriker ); | |
| 73 | VIDEO_START( gstriker ); | |
| 74 | VIDEO_START( twrldc94 ); | |
| 75 | ||
| 72 | 76 | #endif |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in drivers/flstory.c -----------*/ | |
| 2 | ||
| 3 | extern UINT8 *onna34ro_workram; | |
| 4 | extern UINT8 *victnine_workram; | |
| 5 | ||
| 6 | ||
| 7 | /*----------- defined in machine/flstory.c -----------*/ | |
| 8 | ||
| 9 | READ8_HANDLER( flstory_68705_portA_r ); | |
| 10 | WRITE8_HANDLER( flstory_68705_portA_w ); | |
| 11 | READ8_HANDLER( flstory_68705_portB_r ); | |
| 12 | WRITE8_HANDLER( flstory_68705_portB_w ); | |
| 13 | READ8_HANDLER( flstory_68705_portC_r ); | |
| 14 | WRITE8_HANDLER( flstory_68705_portC_w ); | |
| 15 | WRITE8_HANDLER( flstory_68705_ddrA_w ); | |
| 16 | WRITE8_HANDLER( flstory_68705_ddrB_w ); | |
| 17 | WRITE8_HANDLER( flstory_68705_ddrC_w ); | |
| 18 | WRITE8_HANDLER( flstory_mcu_w ); | |
| 19 | READ8_HANDLER( flstory_mcu_r ); | |
| 20 | READ8_HANDLER( flstory_mcu_status_r ); | |
| 21 | WRITE8_HANDLER( onna34ro_mcu_w ); | |
| 22 | READ8_HANDLER( onna34ro_mcu_r ); | |
| 23 | READ8_HANDLER( onna34ro_mcu_status_r ); | |
| 24 | WRITE8_HANDLER( victnine_mcu_w ); | |
| 25 | READ8_HANDLER( victnine_mcu_r ); | |
| 26 | READ8_HANDLER( victnine_mcu_status_r ); | |
| 27 | ||
| 28 | ||
| 29 | /*----------- defined in video/flstory.c -----------*/ | |
| 30 | ||
| 31 | extern UINT8 *flstory_scrlram; | |
| 32 | ||
| 33 | VIDEO_START( flstory ); | |
| 34 | VIDEO_UPDATE( flstory ); | |
| 35 | VIDEO_START( victnine ); | |
| 36 | VIDEO_UPDATE( victnine ); | |
| 37 | ||
| 38 | WRITE8_HANDLER( flstory_videoram_w ); | |
| 39 | READ8_HANDLER( flstory_palette_r ); | |
| 40 | WRITE8_HANDLER( flstory_palette_w ); | |
| 41 | WRITE8_HANDLER( flstory_gfxctrl_w ); | |
| 42 | WRITE8_HANDLER( flstory_scrlram_w ); | |
| 43 | READ8_HANDLER( victnine_gfxctrl_r ); | |
| 44 | WRITE8_HANDLER( victnine_gfxctrl_w ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/slapfght.c -----------*/ | |
| 2 | ||
| 3 | MACHINE_RESET( slapfight ); | |
| 4 | ||
| 5 | extern UINT8 *slapfight_dpram; | |
| 6 | extern size_t slapfight_dpram_size; | |
| 7 | WRITE8_HANDLER( slapfight_dpram_w ); | |
| 8 | READ8_HANDLER( slapfight_dpram_r ); | |
| 9 | ||
| 10 | READ8_HANDLER( slapfight_port_00_r ); | |
| 11 | WRITE8_HANDLER( slapfight_port_00_w ); | |
| 12 | WRITE8_HANDLER( slapfight_port_01_w ); | |
| 13 | WRITE8_HANDLER( slapfight_port_06_w ); | |
| 14 | WRITE8_HANDLER( slapfight_port_07_w ); | |
| 15 | WRITE8_HANDLER( slapfight_port_08_w ); | |
| 16 | WRITE8_HANDLER( slapfight_port_09_w ); | |
| 17 | ||
| 18 | READ8_HANDLER( getstar_e803_r ); | |
| 19 | ||
| 20 | READ8_HANDLER ( tigerh_68705_portA_r ); | |
| 21 | WRITE8_HANDLER( tigerh_68705_portA_w ); | |
| 22 | READ8_HANDLER ( tigerh_68705_portB_r ); | |
| 23 | WRITE8_HANDLER( tigerh_68705_portB_w ); | |
| 24 | READ8_HANDLER ( tigerh_68705_portC_r ); | |
| 25 | WRITE8_HANDLER( tigerh_68705_portC_w ); | |
| 26 | WRITE8_HANDLER( tigerh_68705_ddrA_w ); | |
| 27 | WRITE8_HANDLER( tigerh_68705_ddrB_w ); | |
| 28 | WRITE8_HANDLER( tigerh_68705_ddrC_w ); | |
| 29 | WRITE8_HANDLER( tigerh_mcu_w ); | |
| 30 | READ8_HANDLER ( tigerh_mcu_r ); | |
| 31 | READ8_HANDLER ( tigerh_mcu_status_r ); | |
| 32 | ||
| 33 | WRITE8_HANDLER( getstar_sh_intenable_w ); | |
| 34 | INTERRUPT_GEN( getstar_interrupt ); | |
| 35 | ||
| 36 | ||
| 37 | /*----------- defined in video/slapfght.c -----------*/ | |
| 38 | ||
| 39 | extern UINT8 *slapfight_videoram; | |
| 40 | extern UINT8 *slapfight_colorram; | |
| 41 | extern size_t slapfight_videoram_size; | |
| 42 | extern UINT8 *slapfight_scrollx_lo,*slapfight_scrollx_hi,*slapfight_scrolly; | |
| 43 | ||
| 44 | VIDEO_UPDATE( slapfight ); | |
| 45 | VIDEO_UPDATE( perfrman ); | |
| 46 | VIDEO_START( slapfight ); | |
| 47 | VIDEO_START( perfrman ); | |
| 48 | ||
| 49 | WRITE8_HANDLER( slapfight_flipscreen_w ); | |
| 50 | WRITE8_HANDLER( slapfight_fixram_w ); | |
| 51 | WRITE8_HANDLER( slapfight_fixcol_w ); | |
| 52 | WRITE8_HANDLER( slapfight_videoram_w ); | |
| 53 | WRITE8_HANDLER( slapfight_colorram_w ); | |
| 54 | WRITE8_HANDLER( slapfight_palette_bank_w ); |
| r2844 | r2845 | |
|---|---|---|
| 32 | 32 | |
| 33 | 33 | WRITE8_HANDLER( irobot_paletteram_w ); |
| 34 | 34 | |
| 35 | void irobot_poly_clear( | |
| 35 | void irobot_poly_clear(running_machine *machine); | |
| 36 | 36 | void irobot_run_video(void); |
| r2844 | r2845 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | WRITE8_HANDLER( spaceod_sound_w ); |
| 27 | 27 | |
| 28 | READ8_HANDLER( monsterb_audio_8255_r ); | |
| 29 | 28 | |
| 30 | ||
| 31 | 29 | /*----------- defined in video/segag80r.c -----------*/ |
| 32 | 30 | |
| 33 | 31 | #define G80_BACKGROUND_NONE 0 |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in drivers/raiden2.c -----------*/ | |
| 2 | ||
| 3 | WRITE16_HANDLER( sprcpt_val_1_w ); | |
| 4 | WRITE16_HANDLER( sprcpt_val_2_w ); | |
| 5 | WRITE16_HANDLER( sprcpt_data_1_w ); | |
| 6 | WRITE16_HANDLER( sprcpt_data_2_w ); | |
| 7 | WRITE16_HANDLER( sprcpt_data_3_w ); | |
| 8 | WRITE16_HANDLER( sprcpt_data_4_w ); | |
| 9 | WRITE16_HANDLER( sprcpt_adr_w ); | |
| 10 | WRITE16_HANDLER( sprcpt_flags_1_w ); | |
| 11 | WRITE16_HANDLER( sprcpt_flags_2_w ); | |
| 12 | ||
| 13 | ||
| 14 | /*----------- defined in machine/r2crypt.c -----------*/ | |
| 15 | ||
| 16 | void raiden2_decrypt_sprites(void); |
| r2844 | r2845 | |
|---|---|---|
| 95 | 95 | |
| 96 | 96 | /*----------- defined in video/dc.c -----------*/ |
| 97 | 97 | |
| 98 | ||
| 98 | extern UINT64 *dc_texture_ram | |
| 99 | 99 | |
| 100 | void dc_vblank( running_machine *machine ); | |
| 101 | ||
| 100 | 102 | READ64_HANDLER( pvr_ctrl_r ); |
| 101 | 103 | WRITE64_HANDLER( pvr_ctrl_w ); |
| 102 | 104 | READ64_HANDLER( pvr_ta_r ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/pitnrun.c -----------*/ | |
| 2 | ||
| 3 | WRITE8_HANDLER (pitnrun_68705_portA_w); | |
| 4 | WRITE8_HANDLER (pitnrun_68705_portB_w); | |
| 5 | ||
| 6 | READ8_HANDLER (pitnrun_68705_portA_r); | |
| 7 | READ8_HANDLER (pitnrun_68705_portB_r); | |
| 8 | READ8_HANDLER (pitnrun_68705_portC_r); | |
| 9 | ||
| 10 | MACHINE_RESET( pitnrun ); | |
| 11 | ||
| 12 | READ8_HANDLER( pitnrun_mcu_data_r ); | |
| 13 | READ8_HANDLER( pitnrun_mcu_status_r ); | |
| 14 | WRITE8_HANDLER( pitnrun_mcu_data_w ); | |
| 15 | ||
| 16 | ||
| 17 | /*----------- defined in video/pitnrun.c -----------*/ | |
| 18 | ||
| 19 | extern UINT8* pitnrun_videoram2; | |
| 20 | ||
| 21 | WRITE8_HANDLER( pitnrun_videoram_w ); | |
| 22 | WRITE8_HANDLER( pitnrun_videoram2_w ); | |
| 23 | WRITE8_HANDLER(pitnrun_ha_w); | |
| 24 | WRITE8_HANDLER(pitnrun_h_heed_w); | |
| 25 | WRITE8_HANDLER(pitnrun_v_heed_w); | |
| 26 | WRITE8_HANDLER(pitnrun_color_select_w); | |
| 27 | WRITE8_HANDLER( pitnrun_char_bank_select ); | |
| 28 | WRITE8_HANDLER( pitnrun_scroll_w ); | |
| 29 | READ8_HANDLER( pitnrun_videoram_r ); | |
| 30 | READ8_HANDLER( pitnrun_videoram2_r ); | |
| 31 | ||
| 32 | PALETTE_INIT(pitnrun); | |
| 33 | VIDEO_START(pitnrun); | |
| 34 | VIDEO_UPDATE(pitnrun); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/buggychl.c -----------*/ | |
| 2 | ||
| 3 | MACHINE_RESET( buggychl ); | |
| 4 | READ8_HANDLER( buggychl_68705_portA_r ); | |
| 5 | WRITE8_HANDLER( buggychl_68705_portA_w ); | |
| 6 | WRITE8_HANDLER( buggychl_68705_ddrA_w ); | |
| 7 | READ8_HANDLER( buggychl_68705_portB_r ); | |
| 8 | WRITE8_HANDLER( buggychl_68705_portB_w ); | |
| 9 | WRITE8_HANDLER( buggychl_68705_ddrB_w ); | |
| 10 | READ8_HANDLER( buggychl_68705_portC_r ); | |
| 11 | WRITE8_HANDLER( buggychl_68705_portC_w ); | |
| 12 | WRITE8_HANDLER( buggychl_68705_ddrC_w ); | |
| 13 | WRITE8_HANDLER( buggychl_mcu_w ); | |
| 14 | READ8_HANDLER( buggychl_mcu_r ); | |
| 15 | READ8_HANDLER( buggychl_mcu_status_r ); | |
| 16 | ||
| 17 | ||
| 18 | /*----------- defined in video/buggychl.c -----------*/ | |
| 19 | ||
| 20 | extern UINT8 *buggychl_scrollv,*buggychl_scrollh; | |
| 21 | extern UINT8 *buggychl_character_ram; | |
| 22 | ||
| 23 | PALETTE_INIT( buggychl ); | |
| 24 | VIDEO_START( buggychl ); | |
| 25 | WRITE8_HANDLER( buggychl_chargen_w ); | |
| 26 | WRITE8_HANDLER( buggychl_sprite_lookup_bank_w ); | |
| 27 | WRITE8_HANDLER( buggychl_sprite_lookup_w ); | |
| 28 | WRITE8_HANDLER( buggychl_ctrl_w ); | |
| 29 | WRITE8_HANDLER( buggychl_bg_scrollx_w ); | |
| 30 | VIDEO_UPDATE( buggychl ); |
| r2844 | r2845 | |
|---|---|---|
| 46 | 46 | READ16_HANDLER ( koshien_spritebank_r ); |
| 47 | 47 | WRITE16_HANDLER( koshien_spritebank_w ); |
| 48 | 48 | WRITE16_HANDLER( taitof2_sprite_extension_w ); |
| 49 | ||
| 50 | /*----------- defined in machine/cchip.c -----------*/ | |
| 51 | ||
| 52 | extern UINT16 *cchip2_ram; | |
| 53 | READ16_HANDLER ( cchip2_word_r ); | |
| 54 | WRITE16_HANDLER( cchip2_word_w ); | |
| 55 |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | /*----------- defined in video/n64.c -----------*/ |
| 7 | 7 | |
| 8 | extern int fb_width; | |
| 9 | ||
| 8 | 10 | extern VIDEO_START( n64 ); |
| 9 | 11 | extern VIDEO_UPDATE( n64 ); |
| 10 | 12 | extern void rdp_process_list(void); |
| r2844 | r2845 | |
| 48 | 50 | extern UINT32 *rsp_imem; |
| 49 | 51 | extern UINT32 *rsp_dmem; |
| 50 | 52 | |
| 53 | extern UINT32 dp_start; | |
| 54 | extern UINT32 dp_end; | |
| 55 | extern UINT32 dp_current; | |
| 56 | extern UINT32 dp_status; | |
| 57 | ||
| 58 | extern UINT32 n64_vi_width; | |
| 59 | extern UINT32 n64_vi_origin; | |
| 60 | extern UINT32 n64_vi_control; | |
| 61 | ||
| 62 | extern void dp_full_sync(void); | |
| 51 | 63 | extern void signal_rcp_interrupt(int interrupt); |
| 52 | 64 | extern void clear_rcp_interrupt(int interrupt); |
| 53 | 65 |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/stfight.c -----------*/ | |
| 2 | ||
| 3 | DRIVER_INIT( empcity ); | |
| 4 | DRIVER_INIT( stfight ); | |
| 5 | MACHINE_RESET( stfight ); | |
| 6 | INTERRUPT_GEN( stfight_vb_interrupt ); | |
| 7 | READ8_HANDLER( stfight_dsw_r ); | |
| 8 | WRITE8_HANDLER( stfight_fm_w ); | |
| 9 | READ8_HANDLER( stfight_coin_r ); | |
| 10 | WRITE8_HANDLER( stfight_coin_w ); | |
| 11 | WRITE8_HANDLER( stfight_e800_w ); | |
| 12 | READ8_HANDLER( stfight_fm_r ); | |
| 13 | void stfight_adpcm_int( running_machine *machine, int data ); | |
| 14 | WRITE8_HANDLER( stfight_adpcm_control_w ); | |
| 15 | ||
| 16 | ||
| 17 | /*----------- defined in video/stfight.c -----------*/ | |
| 18 | ||
| 19 | extern UINT8 *stfight_text_char_ram; | |
| 20 | extern UINT8 *stfight_text_attr_ram; | |
| 21 | extern UINT8 *stfight_vh_latch_ram; | |
| 22 | extern UINT8 *stfight_sprite_ram; | |
| 23 | ||
| 24 | PALETTE_INIT( stfight ); | |
| 25 | WRITE8_HANDLER( stfight_text_char_w ); | |
| 26 | WRITE8_HANDLER( stfight_text_attr_w ); | |
| 27 | WRITE8_HANDLER( stfight_vh_latch_w ); | |
| 28 | WRITE8_HANDLER( stfight_sprite_bank_w ); | |
| 29 | VIDEO_START( stfight ); | |
| 30 | VIDEO_UPDATE( stfight ); |
| r2844 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in drivers/pgm.c -----------*/ | |
| 2 | ||
| 3 | extern UINT16 *pgm_mainram, *pgm_bg_videoram, *pgm_tx_videoram, *pgm_videoregs, *pgm_rowscrollram; | |
| 4 | ||
| 5 | extern UINT8 *pgm_sprite_a_region; | |
| 6 | extern size_t pgm_sprite_a_region_allocate; | |
| 7 | ||
| 8 | ||
| 9 | /*----------- defined in machine/pgmcrypt.c -----------*/ | |
| 10 | ||
| 11 | ||
| 12 | void pgm_kov_decrypt(void); | |
| 13 | void pgm_kovsh_decrypt(void); | |
| 14 | void pgm_kov2_decrypt(void); | |
| 15 | void pgm_mm_decrypt(void); | |
| 16 | void pgm_dw2_decrypt(void); | |
| 17 | void pgm_djlzz_decrypt(void); | |
| 18 | void pgm_dw3_decrypt(void); | |
| 19 | void pgm_killbld_decrypt(void); | |
| 20 | void pgm_pstar_decrypt(void); | |
| 21 | void pgm_puzzli2_decrypt(void); | |
| 22 | ||
| 23 | ||
| 24 | /*----------- defined in machine/pgmprot.c -----------*/ | |
| 25 | ||
| 26 | READ16_HANDLER (PSTARS_protram_r); | |
| 27 | READ16_HANDLER (PSTARS_r16); | |
| 28 | ||
| 29 | READ16_HANDLER( pgm_asic3_r ); | |
| 30 | WRITE16_HANDLER( pgm_asic3_w ); | |
| 31 | WRITE16_HANDLER( pgm_asic3_reg_w ); | |
| 32 | ||
| 33 | READ16_HANDLER (sango_protram_r); | |
| 34 | READ16_HANDLER (ASIC28_r16); | |
| 35 | WRITE16_HANDLER (ASIC28_w16); | |
| 36 | ||
| 37 | READ16_HANDLER (dw2_d80000_r ); | |
| 38 | ||
| 39 | ||
| 40 | /*----------- defined in machine/pgmy2ks.c -----------*/ | |
| 41 | ||
| 42 | extern const UINT32 pgmy2ks[0x3c00]; | |
| 43 | ||
| 44 | ||
| 45 | /*----------- defined in video/pgm.c -----------*/ | |
| 46 | ||
| 47 | ||
| 48 | WRITE16_HANDLER( pgm_tx_videoram_w ); | |
| 49 | WRITE16_HANDLER( pgm_bg_videoram_w ); | |
| 50 | VIDEO_START( pgm ); | |
| 51 | VIDEO_EOF( pgm ); | |
| 52 | VIDEO_UPDATE( pgm ); | |
| 1 | /*----------- defined in drivers/pgm.c -----------*/ | |
| 2 | ||
| 3 | extern UINT16 *pgm_mainram, *pgm_bg_videoram, *pgm_tx_videoram, *pgm_videoregs, *pgm_rowscrollram; | |
| 4 | ||
| 5 | extern UINT8 *pgm_sprite_a_region; | |
| 6 | extern size_t pgm_sprite_a_region_allocate; | |
| 7 | ||
| 8 | ||
| 9 | /*----------- defined in machine/pgmcrypt.c -----------*/ | |
| 10 | ||
| 11 | ||
| 12 | void pgm_kov_decrypt(void); | |
| 13 | void pgm_kovsh_decrypt(void); | |
| 14 | void pgm_kov2_decrypt(void); | |
| 15 | void pgm_mm_decrypt(void); | |
| 16 | void pgm_dw2_decrypt(void); | |
| 17 | void pgm_djlzz_decrypt(void); | |
| 18 | void pgm_dw3_decrypt(void); | |
| 19 | void pgm_killbld_decrypt(void); | |
| 20 | void pgm_pstar_decrypt(void); | |
| 21 | void pgm_puzzli2_decrypt(void); | |
| 22 | ||
| 23 | ||
| 24 | /*----------- defined in machine/pgmprot.c -----------*/ | |
| 25 | ||
| 26 | READ16_HANDLER (PSTARS_protram_r); | |
| 27 | READ16_HANDLER ( PSTARS_r16 ); | |
| 28 | WRITE16_HANDLER( PSTARS_w16 ); | |
| 29 | ||
| 30 | READ16_HANDLER( pgm_asic3_r ); | |
| 31 | WRITE16_HANDLER( pgm_asic3_w ); | |
| 32 | WRITE16_HANDLER( pgm_asic3_reg_w ); | |
| 33 | ||
| 34 | READ16_HANDLER (sango_protram_r); | |
| 35 | READ16_HANDLER (ASIC28_r16); | |
| 36 | WRITE16_HANDLER (ASIC28_w16); | |
| 37 | ||
| 38 | READ16_HANDLER (dw2_d80000_r ); | |
| 39 | ||
| 40 | ||
| 41 | /*----------- defined in machine/pgmy2ks.c -----------*/ | |
| 42 | ||
| 43 | extern const UINT32 pgmy2ks[0x3c00]; | |
| 44 | ||
| 45 | ||
| 46 | /*----------- defined in video/pgm.c -----------*/ | |
| 47 | ||
| 48 | ||
| 49 | WRITE16_HANDLER( pgm_tx_videoram_w ); | |
| 50 | WRITE16_HANDLER( pgm_bg_videoram_w ); | |
| 51 | VIDEO_START( pgm ); | |
| 52 | VIDEO_EOF( pgm ); | |
| 53 | VIDEO_UPDATE( pgm ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in drivers/model3.c -----------*/ | |
| 2 | ||
| 3 | extern UINT32 *model3_vrom; | |
| 4 | extern int model3_step; | |
| 5 | ||
| 6 | void model3_set_irq_line(running_machine *machine, UINT8 bit, int state); | |
| 7 | ||
| 8 | ||
| 9 | /*----------- defined in machine/model3.c -----------*/ | |
| 10 | ||
| 11 | extern void model3_machine_init(int step); | |
| 12 | extern int model3_tap_read(void); | |
| 13 | extern void model3_tap_write(int tck, int tms, int tdi, int trst); | |
| 14 | extern void model3_tap_reset(void); | |
| 15 | extern READ32_HANDLER(rtc72421_r); | |
| 16 | extern WRITE32_HANDLER(rtc72421_w); | |
| 17 | ||
| 18 | ||
| 19 | /*----------- defined in video/model3.c -----------*/ | |
| 20 | ||
| 21 | extern UINT64 *paletteram64; | |
| 22 | ||
| 23 | READ64_HANDLER(model3_char_r); | |
| 24 | WRITE64_HANDLER(model3_char_w); | |
| 25 | READ64_HANDLER(model3_tile_r); | |
| 26 | WRITE64_HANDLER(model3_tile_w); | |
| 27 | READ64_HANDLER(model3_vid_reg_r); | |
| 28 | WRITE64_HANDLER(model3_vid_reg_w); | |
| 29 | READ64_HANDLER(model3_palette_r); | |
| 30 | WRITE64_HANDLER(model3_palette_w); | |
| 31 | ||
| 32 | VIDEO_START(model3); | |
| 33 | VIDEO_UPDATE(model3); | |
| 34 | ||
| 35 | WRITE64_HANDLER(real3d_cmd_w); | |
| 36 | WRITE64_HANDLER(real3d_display_list_w); | |
| 37 | WRITE64_HANDLER(real3d_polygon_ram_w); | |
| 38 | void real3d_display_list_end(void); | |
| 39 | void real3d_display_list1_dma(UINT32 src, UINT32 dst, int length, int byteswap); | |
| 40 | void real3d_display_list2_dma(UINT32 src, UINT32 dst, int length, int byteswap); | |
| 41 | void real3d_vrom_texture_dma(UINT32 src, UINT32 dst, int length, int byteswap); | |
| 42 | void real3d_texture_fifo_dma(UINT32 src, int length, int byteswap); | |
| 43 | void real3d_polygon_ram_dma(UINT32 src, UINT32 dst, int length, int byteswap); |
| r2844 | r2845 | |
|---|---|---|
| 14 | 14 | VIDEO_START( skullxbo ); |
| 15 | 15 | VIDEO_UPDATE( skullxbo ); |
| 16 | 16 | |
| 17 | void skullxbo_scanline_update(int param); | |
| 17 | void skullxbo_scanline_update(running_machine *machine, int param); |
| r2844 | r2845 | |
|---|---|---|
| 351 | 351 | |
| 352 | 352 | /*----------- defined in machine/snes.c -----------*/ |
| 353 | 353 | |
| 354 | extern DRIVER_INIT( snes ); | |
| 355 | extern DRIVER_INIT( snes_hirom ); | |
| 356 | ||
| 354 | 357 | extern MACHINE_START( snes ); |
| 355 | 358 | extern MACHINE_RESET( snes ); |
| 356 | 359 |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/gaelco2.c -----------*/ | |
| 2 | ||
| 3 | extern UINT16 *snowboar_protection; | |
| 4 | ||
| 5 | DRIVER_INIT( alighunt ); | |
| 6 | DRIVER_INIT( touchgo ); | |
| 7 | DRIVER_INIT( snowboar ); | |
| 8 | WRITE16_HANDLER( gaelco2_coin_w ); | |
| 9 | WRITE16_HANDLER( gaelco2_coin2_w ); | |
| 10 | WRITE16_HANDLER( wrally2_coin_w ); | |
| 11 | NVRAM_HANDLER( gaelco2 ); | |
| 12 | READ16_HANDLER( gaelco2_eeprom_r ); | |
| 13 | WRITE16_HANDLER( gaelco2_eeprom_cs_w ); | |
| 14 | WRITE16_HANDLER( gaelco2_eeprom_sk_w ); | |
| 15 | WRITE16_HANDLER( gaelco2_eeprom_data_w ); | |
| 16 | READ16_HANDLER( snowboar_protection_r ); | |
| 17 | WRITE16_HANDLER( snowboar_protection_w ); | |
| 18 | ||
| 19 | /*----------- defined in video/gaelco2.c -----------*/ | |
| 20 | ||
| 21 | extern UINT16 *gaelco2_vregs; | |
| 22 | ||
| 23 | WRITE16_HANDLER( gaelco2_vram_w ); | |
| 24 | WRITE16_HANDLER( gaelco2_palette_w ); | |
| 25 | VIDEO_UPDATE( gaelco2 ); | |
| 26 | VIDEO_EOF( gaelco2 ); | |
| 27 | VIDEO_START( gaelco2 ); | |
| 28 | VIDEO_UPDATE( gaelco2_dual ); | |
| 29 | VIDEO_START( gaelco2_dual ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/maniach.c -----------*/ | |
| 2 | ||
| 3 | READ8_HANDLER( maniach_68705_portA_r ); | |
| 4 | WRITE8_HANDLER( maniach_68705_portA_w ); | |
| 5 | READ8_HANDLER( maniach_68705_portB_r ); | |
| 6 | WRITE8_HANDLER( maniach_68705_portB_w ); | |
| 7 | READ8_HANDLER( maniach_68705_portC_r ); | |
| 8 | WRITE8_HANDLER( maniach_68705_portC_w ); | |
| 9 | WRITE8_HANDLER( maniach_68705_ddrA_w ); | |
| 10 | WRITE8_HANDLER( maniach_68705_ddrB_w ); | |
| 11 | WRITE8_HANDLER( maniach_68705_ddrC_w ); | |
| 12 | WRITE8_HANDLER( maniach_mcu_w ); | |
| 13 | READ8_HANDLER( maniach_mcu_r ); | |
| 14 | READ8_HANDLER( maniach_mcu_status_r ); | |
| 15 | ||
| 16 | ||
| 17 | /*----------- defined in video/matmania.c -----------*/ | |
| 18 | ||
| 19 | extern UINT8 *matmania_videoram2,*matmania_colorram2; | |
| 20 | extern size_t matmania_videoram2_size; | |
| 21 | extern UINT8 *matmania_videoram3,*matmania_colorram3; | |
| 22 | extern size_t matmania_videoram3_size; | |
| 23 | extern UINT8 *matmania_scroll; | |
| 24 | extern UINT8 *matmania_pageselect; | |
| 25 | ||
| 26 | WRITE8_HANDLER( matmania_paletteram_w ); | |
| 27 | PALETTE_INIT( matmania ); | |
| 28 | VIDEO_UPDATE( maniach ); | |
| 29 | VIDEO_START( matmania ); | |
| 30 | VIDEO_UPDATE( matmania ); |
| r2844 | r2845 | |
|---|---|---|
| 27 | 27 | |
| 28 | 28 | /*----------- defined in machine/arkanoid.c -----------*/ |
| 29 | 29 | |
| 30 | extern UINT8 arkanoid_paddle_select; | |
| 31 | ||
| 30 | 32 | extern MACHINE_START( arkanoid ); |
| 31 | 33 | extern MACHINE_RESET( arkanoid ); |
| 32 | 34 |
| r2844 | r2845 | |
|---|---|---|
| 181 | 181 | |
| 182 | 182 | /* Functions */ |
| 183 | 183 | VIDEO_START( megasys1 ); |
| 184 | VIDEO_UPDATE( megasys1 ); | |
| 184 | 185 | |
| 186 | PALETTE_INIT( megasys1 ); | |
| 187 | ||
| 188 | READ16_HANDLER( megasys1_vregs_C_r ); | |
| 189 | ||
| 190 | WRITE16_HANDLER( megasys1_vregs_A_w ); | |
| 191 | WRITE16_HANDLER( megasys1_vregs_C_w ); | |
| 192 | WRITE16_HANDLER( megasys1_vregs_D_w ); | |
| 193 | ||
| 185 | 194 | WRITE16_HANDLER( megasys1_scrollram_0_w ); |
| 186 | 195 | WRITE16_HANDLER( megasys1_scrollram_1_w ); |
| 187 | 196 | WRITE16_HANDLER( megasys1_scrollram_2_w ); |
| 188 | 197 | |
| 189 | 198 | void megasys1_set_vreg_flag(int which, int data); |
| 190 | 199 | |
| 200 | ||
| 191 | 201 | /*----------- defined in drivers/megasys1.c -----------*/ |
| 192 | 202 | |
| 193 | 203 | void astyanax_rom_decode(int cpu); |
| r2844 | r2845 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | #include "machine/8255ppi.h" |
| 15 | 15 | |
| 16 | /*----------- defined in video/galax | |
| 16 | /*----------- defined in video/galaxold.c -----------*/ | |
| 17 | 17 | |
| 18 | 18 | extern UINT8 *galaxold_videoram; |
| 19 | 19 | extern UINT8 *galaxold_spriteram; |
| r2844 | r2845 | |
| 27 | 27 | extern size_t galaxold_spriteram_size; |
| 28 | 28 | extern size_t galaxold_spriteram2_size; |
| 29 | 29 | extern size_t galaxold_bulletsram_size; |
| 30 | extern UINT8 galaxold_stars_on; | |
| 30 | 31 | |
| 31 | 32 | PALETTE_INIT( galaxold ); |
| 32 | 33 | PALETTE_INIT( scrambold ); |
| 33 | PALETTE_INIT( moonwar ); | |
| 34 | 34 | PALETTE_INIT( darkplnt ); |
| 35 | 35 | PALETTE_INIT( rescue ); |
| 36 | 36 | PALETTE_INIT( minefld ); |
| 37 | 37 | PALETTE_INIT( stratgyx ); |
| 38 | 38 | PALETTE_INIT( mariner ); |
| 39 | 39 | PALETTE_INIT( rockclim ); |
| 40 | PALETTE_INIT( dambustr ); | |
| 40 | 41 | PALETTE_INIT( turtles ); |
| 41 | 42 | |
| 43 | VIDEO_START( dambustr ); | |
| 44 | ||
| 42 | 45 | WRITE8_HANDLER( galaxold_videoram_w ); |
| 43 | 46 | READ8_HANDLER( galaxold_videoram_r ); |
| 44 | 47 | |
| 45 | 48 | WRITE8_HANDLER( rockclim_videoram_w ); |
| 46 | 49 | WRITE8_HANDLER( rockclim_scroll_w ); |
| 47 | 50 | READ8_HANDLER( rockclim_videoram_r ); |
| 51 | WRITE8_HANDLER( dambustr_bg_split_line_w ); | |
| 52 | WRITE8_HANDLER( dambustr_bg_color_w ); | |
| 48 | 53 | |
| 49 | 54 | WRITE8_HANDLER( galaxold_attributesram_w ); |
| 50 | 55 | |
| r2844 | r2845 | |
| 60 | 65 | VIDEO_START( galaxold_plain ); |
| 61 | 66 | VIDEO_START( galaxold ); |
| 62 | 67 | VIDEO_START( mooncrst ); |
| 63 | VIDEO_START( mooncrgx ); | |
| 64 | VIDEO_START( moonqsr ); | |
| 65 | VIDEO_START( mshuttle ); | |
| 66 | 68 | VIDEO_START( pisces ); |
| 67 | 69 | VIDEO_START( batman2 ); |
| 68 | VIDEO_START( jumpbug ); | |
| 69 | VIDEO_START( azurian ); | |
| 70 | 70 | VIDEO_START( dkongjrm ); |
| 71 | 71 | VIDEO_START( scrambold ); |
| 72 | 72 | VIDEO_START( theend ); |
| 73 | 73 | VIDEO_START( darkplnt ); |
| 74 | 74 | VIDEO_START( rescue ); |
| 75 | 75 | VIDEO_START( minefld ); |
| 76 | VIDEO_START( calipso ); | |
| 77 | 76 | VIDEO_START( stratgyx ); |
| 78 | 77 | VIDEO_START( mimonkey ); |
| 79 | VIDEO_START( turtles ); | |
| 80 | VIDEO_START( frogger ); | |
| 81 | 78 | VIDEO_START( mariner ); |
| 82 | 79 | VIDEO_START( ckongs ); |
| 83 | VIDEO_START( froggers ); | |
| 84 | 80 | VIDEO_START( newsin7 ); |
| 85 | VIDEO_START( sfx ); | |
| 86 | 81 | VIDEO_START( rockclim ); |
| 87 | 82 | VIDEO_START( drivfrcg ); |
| 88 | 83 | VIDEO_START( bongo ); |
| r2844 | r2845 | |
| 90 | 85 | VIDEO_START( racknrol ); |
| 91 | 86 | VIDEO_START( ad2083 ); |
| 92 | 87 | |
| 88 | void galaxold_init_stars(running_machine *machine, int colors_offset); | |
| 89 | void galaxold_draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); | |
| 90 | ||
| 93 | 91 | VIDEO_UPDATE( galaxold ); |
| 92 | VIDEO_UPDATE( dambustr ); | |
| 94 | 93 | |
| 95 | 94 | WRITE8_HANDLER( galaxold_gfxbank_w ); |
| 96 | 95 | WRITE8_HANDLER( galaxold_flip_screen_x_w ); |
| r2844 | r2845 | |
| 99 | 98 | WRITE8_HANDLER( gteikob2_flip_screen_y_w ); |
| 100 | 99 | |
| 101 | 100 | |
| 102 | /*----------- defined in machine/galax | |
| 101 | /*----------- defined in machine/galaxold.c -----------*/ | |
| 103 | 102 | |
| 104 | 103 | DRIVER_INIT( zigzag ); |
| 105 | 104 | DRIVER_INIT( pisces ); |
| r2844 | r2845 | |
| 132 | 131 | READ8_HANDLER( scramblb_protection_1_r ); |
| 133 | 132 | READ8_HANDLER( scramblb_protection_2_r ); |
| 134 | 133 | |
| 135 | READ8_HANDLER( jumpbug_protection_r ); | |
| 136 | ||
| 137 | 134 | WRITE8_HANDLER( kingball_speech_dip_w ); |
| 138 | 135 | WRITE8_HANDLER( kingball_sound1_w ); |
| 139 | 136 | WRITE8_HANDLER( kingball_sound2_w ); |
| r2844 | r2845 | |
| 156 | 153 | |
| 157 | 154 | extern const ppi8255_interface scramble_ppi_ppi8255_intf[2]; |
| 158 | 155 | extern const ppi8255_interface stratgyx_ppi8255_intf[2]; |
| 159 | extern const ppi8255_interface moonwar_ppi8255_intf[2]; | |
| 160 | 156 | extern const ppi8255_interface darkplnt_ppi8255_intf[2]; |
| 161 | 157 | extern const ppi8255_interface scramble_ppi8255_intf[2]; |
| 162 | 158 | extern const ppi8255_interface ckongs_ppi8255_intf[2]; |
| r2844 | r2845 | |
| 178 | 174 | DRIVER_INIT( mars ); |
| 179 | 175 | DRIVER_INIT( hotshock ); |
| 180 | 176 | DRIVER_INIT( cavelon ); |
| 181 | DRIVER_INIT( moonwar ); | |
| 182 | 177 | DRIVER_INIT( darkplnt ); |
| 183 | 178 | DRIVER_INIT( mimonkey ); |
| 184 | 179 | DRIVER_INIT( mimonsco ); |
| r2844 | r2845 | |
| 206 | 201 | WRITE8_HANDLER( hunchbks_mirror_w ); |
| 207 | 202 | |
| 208 | 203 | |
| 209 | ||
| 210 | /*----------- defined in audio/galaxian.c -----------*/ | |
| 211 | ||
| 212 | extern const struct Samplesinterface galaxian_samples_interface; | |
| 213 | WRITE8_HANDLER( galaxian_pitch_w ); | |
| 214 | WRITE8_HANDLER( galaxian_vol_w ); | |
| 215 | WRITE8_HANDLER( galaxian_noise_enable_w ); | |
| 216 | WRITE8_HANDLER( galaxian_background_enable_w ); | |
| 217 | WRITE8_HANDLER( galaxian_shoot_enable_w ); | |
| 218 | WRITE8_HANDLER( galaxian_lfo_freq_w ); | |
| 219 | ||
| 220 | ||
| 221 | 204 | /*----------- defined in audio/scramble.c -----------*/ |
| 222 | 205 | |
| 223 | 206 | void scramble_sh_init(void); |
| r2844 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/gaelcrpt.c -----------*/ | |
| 2 | ||
| 1 | 3 | UINT16 gaelco_decrypt(int offset, int data, int param1, int param2); |
| 2 |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/daikaiju.c -----------*/ | |
| 2 | ||
| 3 | READ8_HANDLER( daikaiju_mcu_r); | |
| 4 | WRITE8_HANDLER( daikaiju_mcu_w); | |
| 5 | READ8_HANDLER( daikaiju_mcu_status_r); | |
| 6 | ||
| 7 | MACHINE_RESET(daikaiju); | |
| 8 | ||
| 9 | ||
| 10 | /*----------- defined in machine/lsasquad.c -----------*/ | |
| 11 | ||
| 12 | extern int lsasquad_invertcoin; | |
| 13 | extern int lsasquad_sound_pending; | |
| 14 | ||
| 15 | WRITE8_HANDLER( lsasquad_sh_nmi_disable_w ); | |
| 16 | WRITE8_HANDLER( lsasquad_sh_nmi_enable_w ); | |
| 17 | WRITE8_HANDLER( lsasquad_sound_command_w ); | |
| 18 | READ8_HANDLER( lsasquad_sh_sound_command_r ); | |
| 19 | WRITE8_HANDLER( lsasquad_sh_result_w ); | |
| 20 | READ8_HANDLER( lsasquad_sound_result_r ); | |
| 21 | READ8_HANDLER( lsasquad_sound_status_r ); | |
| 22 | ||
| 23 | READ8_HANDLER( lsasquad_68705_portA_r ); | |
| 24 | WRITE8_HANDLER( lsasquad_68705_portA_w ); | |
| 25 | WRITE8_HANDLER( lsasquad_68705_ddrA_w ); | |
| 26 | READ8_HANDLER( lsasquad_68705_portB_r ); | |
| 27 | WRITE8_HANDLER( lsasquad_68705_portB_w ); | |
| 28 | WRITE8_HANDLER( lsasquad_68705_ddrB_w ); | |
| 29 | WRITE8_HANDLER( lsasquad_mcu_w ); | |
| 30 | READ8_HANDLER( lsasquad_mcu_r ); | |
| 31 | READ8_HANDLER( lsasquad_mcu_status_r ); | |
| 32 | ||
| 33 | READ8_HANDLER( daikaiju_sound_status_r ); | |
| 34 | READ8_HANDLER( daikaiju_sh_sound_command_r ); | |
| 35 | ||
| 36 | ||
| 37 | /*----------- defined in video/lsasquad.c -----------*/ | |
| 38 | ||
| 39 | extern UINT8 *lsasquad_scrollram; | |
| 40 | ||
| 41 | VIDEO_UPDATE( lsasquad ); | |
| 42 | VIDEO_UPDATE( daikaiju ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/cchip.c -----------*/ | |
| 2 | ||
| 3 | extern UINT16 *cchip2_ram; | |
| 4 | READ16_HANDLER ( cchip2_word_r ); | |
| 5 | WRITE16_HANDLER( cchip2_word_w ); | |
| 6 | ||
| 7 | MACHINE_RESET( cchip1 ); | |
| 8 | READ16_HANDLER( cchip1_ctrl_r ); | |
| 9 | READ16_HANDLER( cchip1_ram_r ); | |
| 10 | WRITE16_HANDLER( cchip1_ctrl_w ); | |
| 11 | WRITE16_HANDLER( cchip1_bank_w ); | |
| 12 | WRITE16_HANDLER( cchip1_ram_w ); | |
| 13 | ||
| 14 | ||
| 15 | /*----------- defined in machine/bonzeadv.c -----------*/ | |
| 16 | ||
| 17 | READ16_HANDLER( bonzeadv_cchip_ctrl_r ); | |
| 18 | READ16_HANDLER( bonzeadv_cchip_ram_r ); | |
| 19 | WRITE16_HANDLER( bonzeadv_cchip_ctrl_w ); | |
| 20 | WRITE16_HANDLER( bonzeadv_cchip_bank_w ); | |
| 21 | WRITE16_HANDLER( bonzeadv_cchip_ram_w ); | |
| 22 | ||
| 23 | ||
| 24 | /*----------- defined in machine/opwolf.c -----------*/ | |
| 25 | ||
| 26 | void opwolf_cchip_init(void); | |
| 27 | READ16_HANDLER( opwolf_cchip_status_r ); | |
| 28 | READ16_HANDLER( opwolf_cchip_data_r ); | |
| 29 | WRITE16_HANDLER( opwolf_cchip_status_w ); | |
| 30 | WRITE16_HANDLER( opwolf_cchip_data_w ); | |
| 31 | WRITE16_HANDLER( opwolf_cchip_bank_w ); | |
| 32 | ||
| 33 | ||
| 34 | /*----------- defined in machine/rainbow.c -----------*/ | |
| 35 | ||
| 36 | void rainbow_cchip_init(int version); | |
| 37 | READ16_HANDLER( rainbow_cchip_ctrl_r ); | |
| 38 | READ16_HANDLER( rainbow_cchip_ram_r ); | |
| 39 | WRITE16_HANDLER( rainbow_cchip_ctrl_w ); | |
| 40 | WRITE16_HANDLER( rainbow_cchip_bank_w ); | |
| 41 | WRITE16_HANDLER( rainbow_cchip_ram_w ); | |
| 42 | ||
| 43 | ||
| 44 | /*----------- defined in machine/volfied.c -----------*/ | |
| 45 | ||
| 46 | void volfied_cchip_init(void); | |
| 47 | READ16_HANDLER( volfied_cchip_ctrl_r ); | |
| 48 | READ16_HANDLER( volfied_cchip_ram_r ); | |
| 49 | WRITE16_HANDLER( volfied_cchip_ctrl_w ); | |
| 50 | WRITE16_HANDLER( volfied_cchip_bank_w ); | |
| 51 | WRITE16_HANDLER( volfied_cchip_ram_w ); |
| r2844 | r2845 | |
|---|---|---|
| 49 | 49 | VIDEO_UPDATE( segac2 ); |
| 50 | 50 | VIDEO_UPDATE( megaplay ); |
| 51 | 51 | |
| 52 | void | |
| 52 | void segac2_enable_display(running_machine *machine, int enable); | |
| 53 | 53 | |
| 54 | void system18_vdp_start(running_machine *machine); | |
| 55 | void system18_vdp_update(bitmap_t *bitmap, const rectangle *cliprect); | |
| 56 | ||
| 54 | 57 | READ16_HANDLER ( genesis_vdp_r ); |
| 55 | 58 | WRITE16_HANDLER( genesis_vdp_w ); |
| 56 | 59 |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/wrally.c -----------*/ | |
| 2 | ||
| 3 | DRIVER_INIT( wrally ); | |
| 4 | MACHINE_RESET( wrally ); | |
| 5 | ||
| 6 | WRITE16_HANDLER( wrally_vram_w ); | |
| 7 | WRITE16_HANDLER( wrally_flipscreen_w ); | |
| 8 | WRITE16_HANDLER( OKIM6295_bankswitch_w ); | |
| 9 | WRITE16_HANDLER( wrally_coin_counter_w ); | |
| 10 | WRITE16_HANDLER( wrally_coin_lockout_w ); | |
| 11 | ||
| 12 | /*----------- defined in video/wrally.c -----------*/ | |
| 13 | ||
| 14 | extern tilemap *wrally_pant[2]; | |
| 15 | ||
| 16 | extern UINT16 *wrally_vregs; | |
| 17 | extern UINT16 *wrally_videoram; | |
| 18 | extern UINT16 *wrally_spriteram; | |
| 19 | ||
| 20 | VIDEO_START( wrally ); | |
| 21 | VIDEO_UPDATE( wrally ); | |
| 22 |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/ajax.c -----------*/ | |
| 2 | ||
| 3 | WRITE8_HANDLER( ajax_bankswitch_2_w ); | |
| 4 | READ8_HANDLER( ajax_ls138_f10_r ); | |
| 5 | WRITE8_HANDLER( ajax_ls138_f10_w ); | |
| 6 | MACHINE_RESET( ajax ); | |
| 7 | INTERRUPT_GEN( ajax_interrupt ); | |
| 8 | ||
| 9 | ||
| 10 | /*----------- defined in video/ajax.c -----------*/ | |
| 11 | ||
| 12 | extern UINT8 ajax_priority; | |
| 13 | ||
| 14 | VIDEO_START( ajax ); | |
| 15 | VIDEO_UPDATE( ajax ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/bagman.c -----------*/ | |
| 2 | ||
| 3 | READ8_HANDLER( bagman_pal16r6_r ); | |
| 4 | MACHINE_RESET( bagman ); | |
| 5 | WRITE8_HANDLER( bagman_pal16r6_w ); | |
| 6 | ||
| 7 | ||
| 8 | /*----------- defined in video/bagman.c -----------*/ | |
| 9 | ||
| 10 | extern UINT8 *bagman_video_enable; | |
| 11 | ||
| 12 | WRITE8_HANDLER( bagman_videoram_w ); | |
| 13 | WRITE8_HANDLER( bagman_colorram_w ); | |
| 14 | WRITE8_HANDLER( bagman_flipscreen_w ); | |
| 15 | ||
| 16 | PALETTE_INIT( bagman ); | |
| 17 | VIDEO_START( bagman ); | |
| 18 | VIDEO_UPDATE( bagman ); |
| r0 | r2845 | |
|---|---|---|
| 1 | /*----------- defined in machine/bigevglf.c -----------*/ | |
| 2 | ||
| 3 | READ8_HANDLER( bigevglf_68705_portA_r ); | |
| 4 | WRITE8_HANDLER( bigevglf_68705_portA_w ); | |
| 5 | READ8_HANDLER( bigevglf_68705_portB_r ); | |
| 6 | WRITE8_HANDLER( bigevglf_68705_portB_w ); | |
| 7 | READ8_HANDLER( bigevglf_68705_portC_r ); | |
| 8 | WRITE8_HANDLER( bigevglf_68705_portC_w ); | |
| 9 | WRITE8_HANDLER( bigevglf_68705_ddrA_w ); | |
| 10 | WRITE8_HANDLER( bigevglf_68705_ddrB_w ); | |
| 11 | WRITE8_HANDLER( bigevglf_68705_ddrC_w ); | |
| 12 | ||
| 13 | WRITE8_HANDLER( bigevglf_mcu_w ); | |
| 14 | READ8_HANDLER( bigevglf_mcu_r ); | |
| 15 | READ8_HANDLER( bigevglf_mcu_status_r ); | |
| 16 | ||
| 17 | ||
| 18 | /*----------- defined in video/bigevglf.c -----------*/ | |
| 19 | ||
| 20 | extern UINT8 *bigevglf_spriteram1; | |
| 21 | extern UINT8 *bigevglf_spriteram2; | |
| 22 | ||
| 23 | VIDEO_START( bigevglf ); | |
| 24 | VIDEO_UPDATE( bigevglf ); | |
| 25 | ||
| 26 | READ8_HANDLER( bigevglf_vidram_r ); | |
| 27 | WRITE8_HANDLER( bigevglf_vidram_w ); | |
| 28 | WRITE8_HANDLER( bigevglf_vidram_addr_w ); | |
| 29 | ||
| 30 | WRITE8_HANDLER( bigevglf_gfxcontrol_w ); | |
| 31 | WRITE8_HANDLER( bigevglf_palette_w ); |
| r2844 | r2845 | |
|---|---|---|
| 185 | 185 | CPUS += ALPHA8301 |
| 186 | 186 | CPUS += CDP1802 |
| 187 | 187 | CPUS += COP420 |
| 188 | CPUS += COP421 | |
| 188 | 189 | CPUS += COP410 |
| 189 | 190 | CPUS += TLCS90 |
| 190 | 191 | CPUS += MB8841 |
| r2844 | r2845 | |
| 1274 | 1275 | $(MAMEOBJ)/subsino.a: \ |
| 1275 | 1276 | $(DRIVERS)/bishjan.o \ |
| 1276 | 1277 | $(DRIVERS)/lastfght.o \ |
| 1278 | $(DRIVERS)/subsino.o \ | |
| 1277 | 1279 | |
| 1278 | 1280 | $(MAMEOBJ)/sun.a: \ |
| 1279 | 1281 | $(DRIVERS)/arabian.o $(VIDEO)/arabian.o \ |
| r2844 | r2845 | |
| 1562 | 1564 | $(DRIVERS)/intrscti.o \ |
| 1563 | 1565 | $(DRIVERS)/istellar.o \ |
| 1564 | 1566 | $(DRIVERS)/itgambl2.o \ |
| 1567 | $(DRIVERS)/itgambl3.o \ | |
| 1565 | 1568 | $(DRIVERS)/itgamble.o \ |
| 1566 | 1569 | $(DRIVERS)/jackpool.o \ |
| 1567 | 1570 | $(DRIVERS)/jongkyo.o \ |
| r2844 | r2845 | |
| 1739 | 1742 | |
| 1740 | 1743 | $(DRIVERS)/tetrisp2.o: $(LAYOUT)/rocknms.lh |
| 1741 | 1744 | |
| 1745 | $(DRIVERS)/thayers.o: $(LAYOUT)/dlair.lh | |
| 1746 | ||
| 1742 | 1747 | $(DRIVERS)/turbo.o: $(LAYOUT)/turbo.lh \ |
| 1743 | 1748 | $(LAYOUT)/subroc3d.lh \ |
| 1744 | 1749 | $(LAYOUT)/buckrog.lh |
| r2844 | r2845 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | #include "driver.h" |
| 9 | #include "includes/nycaptor.h" | |
| 9 | 10 | |
| 10 | 11 | #define NYCAPTOR_DEBUG 0 |
| 11 | 12 | |
| r2844 | r2845 | |
| 19 | 20 | UINT8 *nycaptor_scrlram; |
| 20 | 21 | |
| 21 | 22 | static UINT8 *nycaptor_spriteram; |
| 22 | extern UINT8 *nycaptor_sharedram; | |
| 23 | extern int nyc_gametype; | |
| 24 | 23 | |
| 25 | 24 | /* |
| 26 | 25 | 298 (e298) - spot (0-3) , 299 (e299) - lives |
| r2844 | r2845 | |
|---|---|---|
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| 12 | #include "deprecat.h" | |
| 13 | 12 | |
| 14 | 13 | extern int mlc_raster_table[9][256]; |
| 15 | 14 | extern UINT32 mlc_clipper[32]; |
| r2844 | r2845 | |
| 63 | 62 | } |
| 64 | 63 | #endif |
| 65 | 64 | |
| 66 | static void mlc_drawgfxzoom(bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 65 | static void mlc_drawgfxzoom(running_machine *machine, | |
| 66 | bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 67 | 67 | UINT32 code1,UINT32 code2, UINT32 color,int flipx,int flipy,int sx,int sy, |
| 68 | 68 | const rectangle *clip,int transparency,int transparent_color,int use8bpp, |
| 69 | 69 | int scalex, int scaley) |
| r2844 | r2845 | |
| 98 | 98 | { |
| 99 | 99 | if( gfx ) |
| 100 | 100 | { |
| 101 | const pen_t *pal = & | |
| 101 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; | |
| 102 | 102 | int source_base1 = (code1 % gfx->total_elements) * gfx->height; |
| 103 | 103 | int source_base2 = (code2 % gfx->total_elements) * gfx->height; |
| 104 | 104 | |
| r2844 | r2845 | |
| 487 | 487 | if (rasterMode) |
| 488 | 488 | rasterDirty=1; |
| 489 | 489 | |
| 490 | mlc_drawgfxzoom(/*rasterMode ? temp_bitmap : */bitmap,machine->gfx[0], | |
| 490 | mlc_drawgfxzoom(machine, | |
| 491 | /*rasterMode ? temp_bitmap : */bitmap,machine->gfx[0], | |
| 491 | 492 | tile,tile2, |
| 492 | 493 | color + colorOffset,fx,fy,xbase,ybase, |
| 493 | 494 | &user_clip,trans,0, |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | #include "driver.h" |
| 9 | 9 | #include <ctype.h> |
| 10 | #include "includes/bublbobl.h" | |
| 10 | 11 | |
| 11 | 12 | |
| 12 | 13 |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "deprecat.h" | |
| 3 | 2 | |
| 4 | 3 | static UINT8 bg_color, old_bg_color; |
| 5 | 4 | #define mainsnk_offset 8 |
| r2844 | r2845 | |
| 64 | 63 | |
| 65 | 64 | } |
| 66 | 65 | |
| 67 | static void update_palette( int type ) | |
| 66 | static void update_palette( running_machine *machine, int type ) | |
| 68 | 67 | { |
| 69 | 68 | if( bg_color!=old_bg_color ) |
| 70 | 69 | { |
| 71 | stuff_palette( | |
| 70 | stuff_palette( machine, 256+16*(bg_color&0x7), (0x11-type)*16, 16 ); | |
| 72 | 71 | old_bg_color = bg_color; |
| 73 | 72 | } |
| 74 | 73 | } |
| r2844 | r2845 | |
| 185 | 184 | tilemap_draw(bitmap,&myclip,me_fg_tilemap,0,0); |
| 186 | 185 | draw_status(screen->machine,bitmap,cliprect,0,0x400 ); |
| 187 | 186 | draw_status(screen->machine,bitmap,cliprect,32*8,0x40 ); |
| 188 | update_palette(1); | |
| 187 | update_palette(screen->machine, 1); | |
| 189 | 188 | return 0; |
| 190 | 189 | } |
| 191 | 190 | |
| r2844 | r2845 | |
| 201 | 200 | // tilemap_draw(bitmap,&myclip,me_fg_tilemap,0,0); |
| 202 | 201 | // draw_status(screen->machine,bitmap,cliprect,0,0x400 ); |
| 203 | 202 | // draw_status(screen->machine,bitmap,cliprect,32*8,0x40 ); |
| 204 | update_palette(1); | |
| 203 | update_palette(screen->machine, 1); | |
| 205 | 204 | return 0; |
| 206 | 205 | } |
| r2844 | r2845 | |
|---|---|---|
| 18 | 18 | |
| 19 | 19 | #include "driver.h" |
| 20 | 20 | #include "deprecat.h" |
| 21 | #include "sound/scsp.h" | |
| 22 | #include "includes/stv.h" | |
| 21 | 23 | |
| 22 | 24 | static int vdp1_sprite_log = 0; |
| 23 | 25 | |
| r2844 | r2845 | |
| 25 | 27 | static UINT32 *stv_vdp1_regs; |
| 26 | 28 | UINT8* stv_vdp1_gfx_decode; |
| 27 | 29 | |
| 28 | extern UINT32 *stv_scu; | |
| 29 | extern int stv_vblank; | |
| 30 | ||
| 31 | 30 | static UINT16 *stv_framebuffer[2]; |
| 32 | 31 | static UINT16 **stv_framebuffer_draw_lines; |
| 33 | 32 | UINT16 **stv_framebuffer_display_lines; |
| r2844 | r2845 | |
| 858 | 857 | and if we skip the drawing the content could be incorrect when it reads it, although i have no idea |
| 859 | 858 | why they would want to */ |
| 860 | 859 | |
| 861 | extern UINT32* stv_vdp2_cram; | |
| 862 | ||
| 863 | 860 | static UINT8* gfxdata; |
| 864 | 861 | static UINT16 sprite_colorbank; |
| 865 | 862 | |
| r2844 | r2845 | |
| 1766 | 1763 | } |
| 1767 | 1764 | } |
| 1768 | 1765 | |
| 1769 | void stv_vdp1_process_list() | |
| 1766 | static void stv_vdp1_process_list() | |
| 1770 | 1767 | { |
| 1771 | 1768 | int position; |
| 1772 | 1769 | int spritecount; |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | ******************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "deprecat.h" | |
| 12 | 11 | |
| 13 | 12 | |
| 14 | 13 | #define VRAM_MAX 2 |
| r2844 | r2845 | |
| 42 | 41 | static UINT8 *nbmj9195_clut[VRAM_MAX]; |
| 43 | 42 | |
| 44 | 43 | |
| 45 | static void nbmj9195_vramflip(int vram); | |
| 46 | static void nbmj9195_gfxdraw(int vram); | |
| 44 | static void nbmj9195_vramflip(running_machine *machine, int vram); | |
| 45 | static void nbmj9195_gfxdraw(running_machine *machine, int vram); | |
| 47 | 46 | |
| 48 | 47 | |
| 49 | 48 | /****************************************************************************** |
| r2844 | r2845 | |
| 114 | 113 | return ret; |
| 115 | 114 | } |
| 116 | 115 | |
| 117 | static void nbmj9195_blitter_w(int vram, int offset, int data) | |
| 116 | static void nbmj9195_blitter_w(running_machine *machine, int vram, int offset, int data) | |
| 118 | 117 | { |
| 119 | 118 | int new_line; |
| 120 | 119 | |
| r2844 | r2845 | |
| 128 | 127 | // if (data & 0x20) popmessage("Unknown GFX Flag!! (0x20)"); |
| 129 | 128 | nbmj9195_flipscreen[vram] = (data & 0x40) ? 0 : 1; |
| 130 | 129 | nbmj9195_dispflag[vram] = (data & 0x80) ? 1 : 0; |
| 131 | nbmj9195_vramflip(vram); | |
| 130 | nbmj9195_vramflip(machine, vram); | |
| 132 | 131 | break; |
| 133 | 132 | case 0x01: nbmj9195_scrollx[vram] = (nbmj9195_scrollx[vram] & 0x0100) | data; break; |
| 134 | 133 | case 0x02: nbmj9195_scrollx[vram] = (nbmj9195_scrollx[vram] & 0x00ff) | ((data << 8) & 0x0100); |
| 135 | new_line = video_screen_get_vpos( | |
| 134 | new_line = video_screen_get_vpos(machine->primary_screen); | |
| 136 | 135 | if (nbmj9195_flipscreen[vram]) |
| 137 | 136 | { |
| 138 | 137 | for ( ; nbmj9195_scanline[vram] < new_line; nbmj9195_scanline[vram]++) |
| r2844 | r2845 | |
| 155 | 154 | case 0x0b: blitter_destx[vram] = (blitter_destx[vram] & 0x00ff) | (data << 8); break; |
| 156 | 155 | case 0x0c: blitter_desty[vram] = (blitter_desty[vram] & 0xff00) | data; break; |
| 157 | 156 | case 0x0d: blitter_desty[vram] = (blitter_desty[vram] & 0x00ff) | (data << 8); |
| 158 | nbmj9195_gfxdraw(vram); | |
| 157 | nbmj9195_gfxdraw(machine, vram); | |
| 159 | 158 | break; |
| 160 | 159 | default: break; |
| 161 | 160 | } |
| r2844 | r2845 | |
| 180 | 179 | |
| 181 | 180 | |
| 182 | 181 | ******************************************************************************/ |
| 183 | static void nbmj9195_vramflip(int vram) | |
| 182 | static void nbmj9195_vramflip(running_machine *machine, int vram) | |
| 184 | 183 | { |
| 185 | 184 | static int nbmj9195_flipscreen_old[VRAM_MAX] = { 0, 0 }; |
| 186 | 185 | int x, y; |
| 187 | 186 | UINT16 color1, color2; |
| 188 | int width = video_screen_get_width(Machine->primary_screen); | |
| 189 | int height = video_screen_get_height(Machine->primary_screen); | |
| 187 | int width = video_screen_get_width(machine->primary_screen); | |
| 188 | int height = video_screen_get_height(machine->primary_screen); | |
| 190 | 189 | |
| 191 | 190 | if (nbmj9195_flipscreen[vram] == nbmj9195_flipscreen_old[vram]) return; |
| 192 | 191 | |
| r2844 | r2845 | |
| 219 | 218 | nbmj9195_screen_refresh = 1; |
| 220 | 219 | } |
| 221 | 220 | |
| 222 | static void update_pixel(int vram, int x, int y) | |
| 221 | static void update_pixel(running_machine *machine, int vram, int x, int y) | |
| 223 | 222 | { |
| 224 | UINT16 color = nbmj9195_videoram[vram][(y * video_screen_get_width( | |
| 223 | UINT16 color = nbmj9195_videoram[vram][(y * video_screen_get_width(machine->primary_screen)) + x]; | |
| 225 | 224 | *BITMAP_ADDR16(nbmj9195_tmpbitmap[vram], y, x) = color; |
| 226 | 225 | } |
| 227 | 226 | |
| r2844 | r2845 | |
| 230 | 229 | nb19010_busyflag = 1; |
| 231 | 230 | } |
| 232 | 231 | |
| 233 | static void nbmj9195_gfxdraw(int vram) | |
| 232 | static void nbmj9195_gfxdraw(running_machine *machine, int vram) | |
| 234 | 233 | { |
| 235 | 234 | UINT8 *GFX = memory_region(REGION_GFX1); |
| 236 | int width = video_screen_get_width( | |
| 235 | int width = video_screen_get_width(machine->primary_screen); | |
| 237 | 236 | |
| 238 | 237 | int x, y; |
| 239 | 238 | int dx1, dx2, dy; |
| r2844 | r2845 | |
| 366 | 365 | if (((color1 & 0x00ff) != 0x00ff) || (!nbmj9195_transparency[vram])) |
| 367 | 366 | { |
| 368 | 367 | nbmj9195_videoram[vram][(dy * width) + dx1] = color1; |
| 369 | update_pixel(vram, dx1, dy); | |
| 368 | update_pixel(machine, vram, dx1, dy); | |
| 370 | 369 | } |
| 371 | 370 | if (((color2 & 0x00ff) != 0x00ff) || (!nbmj9195_transparency[vram])) |
| 372 | 371 | { |
| 373 | 372 | nbmj9195_videoram[vram][(dy * width) + dx2] = color2; |
| 374 | update_pixel(vram, dx2, dy); | |
| 373 | update_pixel(machine, vram, dx2, dy); | |
| 375 | 374 | } |
| 376 | 375 | |
| 377 | 376 | nb19010_busyctr++; |
| r2844 | r2845 | |
| 394 | 393 | |
| 395 | 394 | |
| 396 | 395 | ******************************************************************************/ |
| 397 | WRITE8_HANDLER( nbmj9195_blitter_0_w ) { nbmj9195_blitter_w(0, offset, data); } | |
| 398 | WRITE8_HANDLER( nbmj9195_blitter_1_w ) { nbmj9195_blitter_w(1, offset, data); } | |
| 396 | WRITE8_HANDLER( nbmj9195_blitter_0_w ) { nbmj9195_blitter_w(machine, 0, offset, data); } | |
| 397 | WRITE8_HANDLER( nbmj9195_blitter_1_w ) { nbmj9195_blitter_w(machine, 1, offset, data); } | |
| 399 | 398 | |
| 400 | 399 | READ8_HANDLER( nbmj9195_blitter_0_r ) { return nbmj9195_blitter_r(0, offset); } |
| 401 | 400 | READ8_HANDLER( nbmj9195_blitter_1_r ) { return nbmj9195_blitter_r(1, offset); } |
| r2844 | r2845 | |
| 484 | 483 | for (y = 0; y < height; y++) |
| 485 | 484 | for (x = 0; x < width; x++) |
| 486 | 485 | { |
| 487 | update_pixel(0, x, y); | |
| 486 | update_pixel(screen->machine, 0, x, y); | |
| 488 | 487 | |
| 489 | 488 | if (gfxdraw_mode) |
| 490 | update_pixel(1, x, y); | |
| 489 | update_pixel(screen->machine, 1, x, y); | |
| 491 | 490 | } |
| 492 | 491 | } |
| 493 | 492 |
| r2844 | r2845 | |
|---|---|---|
| 150 | 150 | state_save_register_global_pointer(deco16_pf12_control, 0x10/2); |
| 151 | 151 | state_save_register_global_pointer(paletteram16, 0x1000/2); |
| 152 | 152 | |
| 153 | deco16_1_video_init(); | |
| 153 | deco16_1_video_init(machine); | |
| 154 | 154 | |
| 155 | 155 | deco16_set_tilemap_bank_callback(0, simpl156_bank_callback); |
| 156 | 156 | deco16_set_tilemap_bank_callback(1, simpl156_bank_callback); |
| r2844 | r2845 | |
|---|---|---|
| 216 | 216 | |
| 217 | 217 | READ8_HANDLER( bking_input_port_5_r ) |
| 218 | 218 | { |
| 219 | return input_port_read | |
| 219 | return input_port_read | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | READ8_HANDLER( bking_input_port_6_r ) |
| 223 | 223 | { |
| 224 | return input_port_read | |
| 224 | return input_port_read | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | READ8_HANDLER( bking_pos_r ) |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "includes/seibuspi.h" | |
| 2 | 3 | |
| 3 | 4 | static tilemap *text_layer; |
| 4 | 5 | static tilemap *back_layer; |
| r2844 | r2845 | |
| 13 | 14 | static UINT32 video_dma_address; |
| 14 | 15 | |
| 15 | 16 | static int rf2_layer_bank[3]; |
| 16 | extern UINT32 *spimainram; | |
| 17 | 17 | static UINT32 *tilemap_ram; |
| 18 | 18 | static UINT32 *palette_ram; |
| 19 | 19 | static UINT32 *sprite_ram; |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "includes/gaplus.h" | |
| 10 | 11 | |
| 11 | 12 | |
| 12 | 13 | UINT8 *gaplus_videoram; |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ******************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "deprecat.h" | |
| 11 | 10 | |
| 12 | 11 | |
| 13 | 12 | #define VRAM_MAX 3 |
| r2844 | r2845 | |
| 34 | 33 | static UINT8 *niyanpai_clut[VRAM_MAX]; |
| 35 | 34 | |
| 36 | 35 | |
| 37 | static void niyanpai_vramflip(int vram); | |
| 38 | static void niyanpai_gfxdraw(int vram); | |
| 36 | static void niyanpai_vramflip(running_machine *machine, int vram); | |
| 37 | static void niyanpai_gfxdraw(running_machine *machine, int vram); | |
| 39 | 38 | |
| 40 | 39 | |
| 41 | 40 | /****************************************************************************** |
| r2844 | r2845 | |
| 101 | 100 | return ret; |
| 102 | 101 | } |
| 103 | 102 | |
| 104 | static void niyanpai_blitter_w(int vram, int offset, int data) | |
| 103 | static void niyanpai_blitter_w(running_machine *machine, int vram, int offset, int data) | |
| 105 | 104 | { |
| 106 | 105 | switch (offset) |
| 107 | 106 | { |
| r2844 | r2845 | |
| 113 | 112 | // if (data & 0x20) popmessage("Unknown GFX Flag!! (0x20)"); |
| 114 | 113 | niyanpai_flipscreen[vram] = (data & 0x40) ? 0 : 1; |
| 115 | 114 | niyanpai_dispflag[vram] = (data & 0x80) ? 1 : 0; |
| 116 | niyanpai_vramflip(vram); | |
| 115 | niyanpai_vramflip(machine, vram); | |
| 117 | 116 | break; |
| 118 | 117 | case 0x01: niyanpai_scrollx[vram] = (niyanpai_scrollx[vram] & 0x0100) | data; break; |
| 119 | 118 | case 0x02: niyanpai_scrollx[vram] = (niyanpai_scrollx[vram] & 0x00ff) | ((data << 8) & 0x0100); break; |
| r2844 | r2845 | |
| 128 | 127 | case 0x0b: blitter_destx[vram] = (blitter_destx[vram] & 0x00ff) | (data << 8); break; |
| 129 | 128 | case 0x0c: blitter_desty[vram] = (blitter_desty[vram] & 0xff00) | data; break; |
| 130 | 129 | case 0x0d: blitter_desty[vram] = (blitter_desty[vram] & 0x00ff) | (data << 8); |
| 131 | niyanpai_gfxdraw(vram); | |
| 130 | niyanpai_gfxdraw(machine, vram); | |
| 132 | 131 | break; |
| 133 | 132 | default: break; |
| 134 | 133 | } |
| r2844 | r2845 | |
| 148 | 147 | |
| 149 | 148 | |
| 150 | 149 | ******************************************************************************/ |
| 151 | static void niyanpai_vramflip(int vram) | |
| 150 | static void niyanpai_vramflip(running_machine *machine, int vram) | |
| 152 | 151 | { |
| 153 | 152 | static int niyanpai_flipscreen_old[VRAM_MAX] = { 0, 0, 0 }; |
| 154 | 153 | int x, y; |
| 155 | 154 | UINT16 color1, color2; |
| 156 | int width = video_screen_get_width(Machine->primary_screen); | |
| 157 | int height = video_screen_get_height(Machine->primary_screen); | |
| 155 | int width = video_screen_get_width(machine->primary_screen); | |
| 156 | int height = video_screen_get_height(machine->primary_screen); | |
| 158 | 157 | |
| 159 | 158 | if (niyanpai_flipscreen[vram] == niyanpai_flipscreen_old[vram]) return; |
| 160 | 159 | |
| r2844 | r2845 | |
| 184 | 183 | niyanpai_screen_refresh = 1; |
| 185 | 184 | } |
| 186 | 185 | |
| 187 | static void update_pixel(int vram, int x, int y) | |
| 186 | static void update_pixel(running_machine *machine, int vram, int x, int y) | |
| 188 | 187 | { |
| 189 | UINT16 color = niyanpai_videoram[vram][(y * video_screen_get_width( | |
| 188 | UINT16 color = niyanpai_videoram[vram][(y * video_screen_get_width(machine->primary_screen)) + x]; | |
| 190 | 189 | *BITMAP_ADDR16(niyanpai_tmpbitmap[vram], y, x) = color; |
| 191 | 190 | } |
| 192 | 191 | |
| r2844 | r2845 | |
| 195 | 194 | nb19010_busyflag = 1; |
| 196 | 195 | } |
| 197 | 196 | |
| 198 | static void niyanpai_gfxdraw(int vram) | |
| 197 | static void niyanpai_gfxdraw(running_machine *machine, int vram) | |
| 199 | 198 | { |
| 200 | 199 | UINT8 *GFX = memory_region(REGION_GFX1); |
| 201 | int width = video_screen_get_width( | |
| 200 | int width = video_screen_get_width(machine->primary_screen); | |
| 202 | 201 | |
| 203 | 202 | int x, y; |
| 204 | 203 | int dx1, dx2, dy; |
| r2844 | r2845 | |
| 328 | 327 | if (((color1 & 0x00ff) != 0x00ff) || (!niyanpai_transparency[vram])) |
| 329 | 328 | { |
| 330 | 329 | niyanpai_videoram[vram][(dy * width) + dx1] = color1; |
| 331 | update_pixel(vram, dx1, dy); | |
| 330 | update_pixel(machine, vram, dx1, dy); | |
| 332 | 331 | } |
| 333 | 332 | if (((color2 & 0x00ff) != 0x00ff) || (!niyanpai_transparency[vram])) |
| 334 | 333 | { |
| 335 | 334 | niyanpai_videoram[vram][(dy * width) + dx2] = color2; |
| 336 | update_pixel(vram, dx2, dy); | |
| 335 | update_pixel(machine, vram, dx2, dy); | |
| 337 | 336 | } |
| 338 | 337 | |
| 339 | 338 | nb19010_busyctr++; |
| r2844 | r2845 | |
| 354 | 353 | |
| 355 | 354 | |
| 356 | 355 | ******************************************************************************/ |
| 357 | WRITE16_HANDLER( niyanpai_blitter_0_w ) { niyanpai_blitter_w(0, offset, data); } | |
| 358 | WRITE16_HANDLER( niyanpai_blitter_1_w ) { niyanpai_blitter_w(1, offset, data); } | |
| 359 | WRITE16_HANDLER( niyanpai_blitter_2_w ) { niyanpai_blitter_w(2, offset, data); } | |
| 356 | WRITE16_HANDLER( niyanpai_blitter_0_w ) { niyanpai_blitter_w(machine, 0, offset, data); } | |
| 357 | WRITE16_HANDLER( niyanpai_blitter_1_w ) { niyanpai_blitter_w(machine, 1, offset, data); } | |
| 358 | WRITE16_HANDLER( niyanpai_blitter_2_w ) { niyanpai_blitter_w(machine, 2, offset, data); } | |
| 360 | 359 | |
| 361 | 360 | READ16_HANDLER( niyanpai_blitter_0_r ) { return niyanpai_blitter_r(0, offset); } |
| 362 | 361 | READ16_HANDLER( niyanpai_blitter_1_r ) { return niyanpai_blitter_r(1, offset); } |
| r2844 | r2845 | |
| 421 | 420 | for (y = 0; y < height; y++) |
| 422 | 421 | for (x = 0; x < width; x++) |
| 423 | 422 | { |
| 424 | update_pixel(0, x, y); | |
| 425 | update_pixel(1, x, y); | |
| 426 | update_pixel(2, x, y); | |
| 423 | update_pixel(screen->machine, 0, x, y); | |
| 424 | update_pixel(screen->machine, 1, x, y); | |
| 425 | update_pixel(screen->machine, 2, x, y); | |
| 427 | 426 | } |
| 428 | 427 | } |
| 429 | 428 |
| r2844 | r2845 | |
|---|---|---|
| 83 | 83 | #include "eminline.h" |
| 84 | 84 | #include "profiler.h" |
| 85 | 85 | #include "deprecat.h" |
| 86 | #include "includes/stv.h" | |
| 86 | 87 | |
| 87 | 88 | UINT32* stv_vdp2_regs; |
| 88 | 89 | UINT32* stv_vdp2_vram; |
| r2844 | r2845 | |
| 91 | 92 | static UINT8* stv_vdp2_vram_dirty_8x8x8; |
| 92 | 93 | |
| 93 | 94 | static UINT8* stv_vdp2_gfx_decode; |
| 94 | extern UINT8* stv_vdp1_gfx_decode; | |
| 95 | 95 | |
| 96 | 96 | static int stv_vdp2_render_rbg0; |
| 97 | 97 | |
| 98 | 98 | UINT32* stv_vdp2_cram; |
| 99 | void video_update_vdp1(running_machine *machine); | |
| 100 | int stv_vdp1_start (running_machine *machine); | |
| 101 | static void stv_vdp2_dynamic_res_change(void); | |
| 102 | static void refresh_palette_data(void); | |
| 99 | static void stv_vdp2_dynamic_res_change(running_machine *machine); | |
| 100 | static void refresh_palette_data(running_machine *machine); | |
| 103 | 101 | static int stv_vdp2_window_process(int x,int y); |
| 104 | 102 | static int stv_vdp2_apply_window_on_layer(rectangle *cliprect); |
| 105 | 103 | static void stv_vdp2_get_window0_coordinates(UINT16 *s_x, UINT16 *e_x, UINT16 *s_y, UINT16 *e_y); |
| r2844 | r2845 | |
| 2357 | 2355 | |
| 2358 | 2356 | } |
| 2359 | 2357 | |
| 2360 | static void stv_vdp2_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 2358 | static void stv_vdp2_drawgfxzoom( running_machine *machine, | |
| 2359 | bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 2361 | 2360 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 2362 | 2361 | const rectangle *clip,int transparency,int transparent_color,int scalex, int scaley, |
| 2363 | 2362 | int sprite_screen_width, int sprite_screen_height) |
| r2844 | r2845 | |
| 2413 | 2412 | |
| 2414 | 2413 | if( gfx ) |
| 2415 | 2414 | { |
| 2416 | const pen_t *pal = & | |
| 2415 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; | |
| 2417 | 2416 | UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo; |
| 2418 | 2417 | |
| 2419 | 2418 | //int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; |
| r2844 | r2845 | |
| 3684 | 3683 | if (stv2_current_tilemap.tile_size==1) |
| 3685 | 3684 | { |
| 3686 | 3685 | /* normal */ |
| 3687 | stv_vdp2_drawgfxzoom(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); | |
| 3688 | stv_vdp2_drawgfxzoom(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); | |
| 3689 | stv_vdp2_drawgfxzoom(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)); | |
| 3690 | stv_vdp2_drawgfxzoom(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)); | |
| 3686 | 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); | |
| 3687 | 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); | |
| 3688 | 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)); | |
| 3689 | 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)); | |
| 3691 | 3690 | |
| 3692 | 3691 | } |
| 3693 | 3692 | else |
| 3694 | 3693 | { |
| 3695 | stv_vdp2_drawgfxzoom(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); | |
| 3694 | 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); | |
| 3696 | 3695 | } |
| 3697 | 3696 | } |
| 3698 | 3697 | else |
| r2844 | r2845 | |
| 5145 | 5144 | } |
| 5146 | 5145 | } |
| 5147 | 5146 | |
| 5148 | static void refresh_palette_data() | |
| 5147 | static void refresh_palette_data(running_machine *machine) | |
| 5149 | 5148 | { |
| 5150 | 5149 | int r,g,b; |
| 5151 | 5150 | int c_i; |
| r2844 | r2845 | |
| 5161 | 5160 | b = ((stv_vdp2_cram[c_i] & 0x00ff0000) >> 16); |
| 5162 | 5161 | g = ((stv_vdp2_cram[c_i] & 0x0000ff00) >> 8); |
| 5163 | 5162 | r = ((stv_vdp2_cram[c_i] & 0x000000ff) >> 0); |
| 5164 | palette_set_color( | |
| 5163 | palette_set_color(machine,c_i,MAKE_RGB(r,g,b)); | |
| 5165 | 5164 | } |
| 5166 | 5165 | break; |
| 5167 | 5166 | /*Mode 0*/ |
| r2844 | r2845 | |
| 5172 | 5171 | b = ((stv_vdp2_cram[c_i] & 0x00007c00) >> 10); |
| 5173 | 5172 | g = ((stv_vdp2_cram[c_i] & 0x000003e0) >> 5); |
| 5174 | 5173 | r = ((stv_vdp2_cram[c_i] & 0x0000001f) >> 0); |
| 5175 | palette_set_color_rgb( | |
| 5174 | palette_set_color_rgb(machine,(c_i*2)+1,pal5bit(r),pal5bit(g),pal5bit(b)); | |
| 5176 | 5175 | b = ((stv_vdp2_cram[c_i] & 0x7c000000) >> 26); |
| 5177 | 5176 | g = ((stv_vdp2_cram[c_i] & 0x03e00000) >> 21); |
| 5178 | 5177 | r = ((stv_vdp2_cram[c_i] & 0x001f0000) >> 16); |
| 5179 | palette_set_color_rgb( | |
| 5178 | palette_set_color_rgb(machine,c_i*2,pal5bit(r),pal5bit(g),pal5bit(b)); | |
| 5180 | 5179 | } |
| 5181 | 5180 | break; |
| 5182 | 5181 | /*Mode 1*/ |
| r2844 | r2845 | |
| 5187 | 5186 | b = ((stv_vdp2_cram[c_i] & 0x00007c00) >> 10); |
| 5188 | 5187 | g = ((stv_vdp2_cram[c_i] & 0x000003e0) >> 5); |
| 5189 | 5188 | r = ((stv_vdp2_cram[c_i] & 0x0000001f) >> 0); |
| 5190 | palette_set_color_rgb( | |
| 5189 | palette_set_color_rgb(machine,(c_i*2)+1,pal5bit(r),pal5bit(g),pal5bit(b)); | |
| 5191 | 5190 | b = ((stv_vdp2_cram[c_i] & 0x7c000000) >> 26); |
| 5192 | 5191 | g = ((stv_vdp2_cram[c_i] & 0x03e00000) >> 21); |
| 5193 | 5192 | r = ((stv_vdp2_cram[c_i] & 0x001f0000) >> 16); |
| 5194 | palette_set_color_rgb( | |
| 5193 | palette_set_color_rgb(machine,c_i*2,pal5bit(r),pal5bit(g),pal5bit(b)); | |
| 5195 | 5194 | } |
| 5196 | 5195 | break; |
| 5197 | 5196 | } |
| r2844 | r2845 | |
| 5211 | 5210 | if(old_crmd != STV_VDP2_CRMD) |
| 5212 | 5211 | { |
| 5213 | 5212 | old_crmd = STV_VDP2_CRMD; |
| 5214 | refresh_palette_data(); | |
| 5213 | refresh_palette_data(machine); | |
| 5215 | 5214 | } |
| 5216 | 5215 | } |
| 5217 | 5216 | |
| 5218 | extern int stv_vblank,stv_hblank; | |
| 5219 | 5217 | READ32_HANDLER ( stv_vdp2_regs_r ) |
| 5220 | 5218 | { |
| 5221 | 5219 | // if (offset!=1) if(LOG_VDP2) logerror ("VDP2: Read from Registers, Offset %04x\n",offset); |
| r2844 | r2845 | |
| 5261 | 5259 | stv_rbg_cache_data.is_cache_dirty = 3; |
| 5262 | 5260 | memset( &stv_vdp2_layer_data_placement, 0, sizeof(stv_vdp2_layer_data_placement)); |
| 5263 | 5261 | |
| 5264 | refresh_palette_data(); | |
| 5262 | refresh_palette_data(Machine); | |
| 5265 | 5263 | } |
| 5266 | 5264 | |
| 5267 | 5265 | static int stv_vdp2_start (running_machine *machine) |
| r2844 | r2845 | |
| 5304 | 5302 | debug.roz = 0; |
| 5305 | 5303 | } |
| 5306 | 5304 | |
| 5307 | static void stv_vdp2_dynamic_res_change() | |
| 5305 | static void stv_vdp2_dynamic_res_change(running_machine *machine) | |
| 5308 | 5306 | { |
| 5309 | 5307 | static UINT16 horz,vert; |
| 5310 | 5308 | |
| r2844 | r2845 | |
| 5336 | 5334 | case 7: horz = 704; vert = 480; break; |
| 5337 | 5335 | } |
| 5338 | 5336 | |
| 5339 | video_screen_set_visarea( | |
| 5337 | video_screen_set_visarea(machine->primary_screen, 0*8, horz-1,0*8, vert-1); | |
| 5340 | 5338 | //if(LOG_VDP2) popmessage("%04d %04d",horz-1,vert-1); |
| 5341 | 5339 | } |
| 5342 | 5340 | |
| r2844 | r2845 | |
| 5619 | 5617 | } |
| 5620 | 5618 | |
| 5621 | 5619 | /* VDP1 Framebuffer handling */ |
| 5622 | extern UINT16 **stv_framebuffer_display_lines; | |
| 5623 | extern int stv_framebuffer_width; | |
| 5624 | extern int stv_framebuffer_height; | |
| 5625 | extern int stv_framebuffer_double_interlace; | |
| 5626 | extern int stv_framebuffer_mode; | |
| 5627 | ||
| 5628 | 5620 | static int stv_sprite_priorities_used[8]; |
| 5629 | 5621 | static int stv_sprite_priorities_usage_valid; |
| 5630 | 5622 | static UINT8 stv_sprite_priorities_in_fb_line[512][8]; |
| r2844 | r2845 | |
| 6064 | 6056 | stv_sprite_priorities_usage_valid = 1; |
| 6065 | 6057 | } |
| 6066 | 6058 | |
| 6067 | extern UINT32 *stv_vdp1_vram; | |
| 6068 | ||
| 6069 | 6059 | VIDEO_UPDATE( stv_vdp2 ) |
| 6070 | 6060 | { |
| 6071 | 6061 | static UINT8 pri; |
| 6072 | 6062 | |
| 6073 | stv_vdp2_dynamic_res_change(); | |
| 6063 | stv_vdp2_dynamic_res_change(screen->machine); | |
| 6074 | 6064 | |
| 6075 | 6065 | video_update_vdp1(screen->machine); |
| 6076 | 6066 |
| r2844 | r2845 | |
|---|---|---|
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | #include "driver.h" |
| 18 | #include "deprecat.h" | |
| 18 | 19 | |
| 19 | 20 | static bitmap_t *sprite_bitmap; |
| 20 | 21 | |
| 22 | static bitmap_t *tilemap_bitmap_lower; | |
| 23 | static bitmap_t *tilemap_bitmapflags_lower; | |
| 21 | 24 | |
| 25 | static bitmap_t *tilemap_bitmap_higher; | |
| 26 | static bitmap_t *tilemap_bitmapflags_higher; | |
| 27 | ||
| 28 | ||
| 29 | /* draws ROZ with linescroll OR columnscroll to 16-bit indexed bitmap */ | |
| 30 | static void suprnova_draw_roz(bitmap_t* bitmap, bitmap_t* bitmapflags, const rectangle *cliprect, tilemap *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound, int columnscroll, UINT32* scrollram) | |
| 31 | { | |
| 32 | // const pen_t *clut = &Machine->pens[0]; | |
| 33 | //bitmap_t *destbitmap = bitmap; | |
| 34 | bitmap_t *srcbitmap = tilemap_get_pixmap(tmap); | |
| 35 | bitmap_t *srcbitmapflags = tilemap_get_flagsmap(tmap); | |
| 36 | const int xmask = srcbitmap->width-1; | |
| 37 | const int ymask = srcbitmap->height-1; | |
| 38 | const int widthshifted = srcbitmap->width << 16; | |
| 39 | const int heightshifted = srcbitmap->height << 16; | |
| 40 | UINT32 cx; | |
| 41 | UINT32 cy; | |
| 42 | int x; | |
| 43 | int sx; | |
| 44 | int sy; | |
| 45 | int ex; | |
| 46 | int ey; | |
| 47 | UINT16 *dest; | |
| 48 | UINT8* destflags; | |
| 49 | // UINT8 *pri; | |
| 50 | //const UINT16 *src; | |
| 51 | //const UINT8 *maskptr; | |
| 52 | //int destadvance = destbitmap->bpp / 8; | |
| 53 | ||
| 54 | /* pre-advance based on the cliprect */ | |
| 55 | startx += cliprect->min_x * incxx + cliprect->min_y * incyx; | |
| 56 | starty += cliprect->min_x * incxy + cliprect->min_y * incyy; | |
| 57 | ||
| 58 | /* extract start/end points */ | |
| 59 | sx = cliprect->min_x; | |
| 60 | sy = cliprect->min_y; | |
| 61 | ex = cliprect->max_x; | |
| 62 | ey = cliprect->max_y; | |
| 63 | ||
| 64 | { | |
| 65 | /* loop over rows */ | |
| 66 | while (sy <= ey) | |
| 67 | { | |
| 68 | ||
| 69 | /* initialize X counters */ | |
| 70 | x = sx; | |
| 71 | cx = startx; | |
| 72 | cy = starty; | |
| 73 | ||
| 74 | /* get dest and priority pointers */ | |
| 75 | dest = BITMAP_ADDR16( bitmap, sy, sx); | |
| 76 | destflags = BITMAP_ADDR8( bitmapflags, sy, sx); | |
| 77 | ||
| 78 | /* loop over columns */ | |
| 79 | while (x <= ex) | |
| 80 | { | |
| 81 | if ((wraparound) || (cx < widthshifted && cy < heightshifted)) // not sure how this will cope with no wraparound, but row/col scroll.. | |
| 82 | { | |
| 83 | if (columnscroll) | |
| 84 | { | |
| 85 | dest[0] = BITMAP_ADDR16(srcbitmap, ((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask)[0]; | |
| 86 | destflags[0] = BITMAP_ADDR8(srcbitmapflags, ((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask)[0]; | |
| 87 | } | |
| 88 | else | |
| 89 | { | |
| 90 | dest[0] = BITMAP_ADDR16(srcbitmap, (cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask)[0]; | |
| 91 | destflags[0] = BITMAP_ADDR8(srcbitmapflags, (cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask)[0]; | |
| 92 | } | |
| 93 | } | |
| 94 | ||
| 95 | /* advance in X */ | |
| 96 | cx += incxx; | |
| 97 | cy += incxy; | |
| 98 | x++; | |
| 99 | dest++; | |
| 100 | destflags++; | |
| 101 | // pri++; | |
| 102 | } | |
| 103 | ||
| 104 | /* advance in Y */ | |
| 105 | startx += incyx; | |
| 106 | starty += incyy; | |
| 107 | sy++; | |
| 108 | } | |
| 109 | } | |
| 110 | } | |
| 111 | ||
| 112 | ||
| 22 | 113 | #define SUPRNOVA_DECODE_BUFFER_SIZE 0x2000 |
| 23 | 114 | |
| 24 | 115 | extern UINT32 *skns_tilemapA_ram, *skns_tilemapB_ram, *skns_v3slc_ram; |
| r2844 | r2845 | |
| 33 | 124 | static int old_depthB=0, depthB=0; |
| 34 | 125 | |
| 35 | 126 | static int sprite_kludge_x=0, sprite_kludge_y=0; |
| 36 | static int use_spc_bright, use_v3_bright; | |
| 127 | static int use_spc_bright = 1, use_v3_bright = 1; // makes sarukani rather dark, but should be default.. | |
| 37 | 128 | static UINT8 bright_spc_b=0x00, bright_spc_g=0x00, bright_spc_r=0x00; |
| 38 | 129 | |
| 39 | 130 | static UINT8 bright_spc_b_trans=0x00, bright_spc_g_trans=0x00, bright_spc_r_trans=0x00; |
| 40 | 131 | |
| 41 | 132 | |
| 42 | 133 | static UINT8 bright_v3_b=0x00, bright_v3_g=0x00, bright_v3_r=0x00; |
| 134 | static UINT8 bright_v3_b_trans = 0x00, bright_v3_g_trans = 0x00, bright_v3_r_trans = 0x00; | |
| 43 | 135 | |
| 44 | ||
| 45 | 136 | // This ignores the alpha values atm. |
| 46 | 137 | static int spc_changed=0, v3_changed=0, palette_updated=0; |
| 138 | int suprnova_alt_enable_background = 1, suprnova_alt_enable_sprites = 1; | |
| 47 | 139 | |
| 48 | 140 | WRITE32_HANDLER ( skns_pal_regs_w ) |
| 49 | 141 | { |
| r2844 | r2845 | |
| 52 | 144 | |
| 53 | 145 | switch ( offset ) |
| 54 | 146 | { |
| 147 | /* RWRA regs are for SPRITES */ | |
| 148 | ||
| 55 | 149 | case (0x00/4): // RWRA0 |
| 56 | 150 | if( use_spc_bright != (data&1) ) { |
| 57 | 151 | use_spc_bright = data&1; |
| 58 | 152 | spc_changed = 1; |
| 59 | 153 | } |
| 154 | suprnova_alt_enable_sprites = (data>>8)&1; | |
| 155 | ||
| 156 | ||
| 60 | 157 | break; |
| 61 | 158 | case (0x04/4): // RWRA1 |
| 62 | 159 | if( bright_spc_g != (data&0xff) ) { |
| r2844 | r2845 | |
| 85 | 182 | |
| 86 | 183 | break; |
| 87 | 184 | |
| 185 | /* RWRB regs are for BACKGROUND */ | |
| 186 | ||
| 88 | 187 | case (0x10/4): // RWRB0 |
| 89 | 188 | if( use_v3_bright != (data&1) ) { |
| 90 | 189 | use_v3_bright = data&1; |
| 91 | 190 | v3_changed = 1; |
| 92 | 191 | } |
| 192 | ||
| 193 | suprnova_alt_enable_background = (data>>8)&1; | |
| 194 | ||
| 93 | 195 | break; |
| 94 | 196 | case (0x14/4): // RWRB1 |
| 95 | 197 | if( bright_v3_g != (data&0xff) ) { |
| 96 | 198 | bright_v3_g = data&0xff; |
| 97 | 199 | v3_changed = 1; |
| 98 | 200 | } |
| 201 | ||
| 202 | bright_v3_g_trans = (data>>8)&0xff; | |
| 203 | ||
| 99 | 204 | break; |
| 100 | 205 | case (0x18/4): // RWRB2 |
| 101 | 206 | if( bright_v3_r != (data&0xff) ) { |
| 102 | 207 | bright_v3_r = data&0xff; |
| 103 | 208 | v3_changed = 1; |
| 104 | 209 | } |
| 210 | ||
| 211 | bright_v3_r_trans = (data>>8)&0xff; | |
| 212 | ||
| 105 | 213 | break; |
| 106 | 214 | case (0x1C/4): // RWRB3 |
| 107 | 215 | if( bright_v3_b != (data&0xff) ) { |
| 108 | 216 | bright_v3_b = data&0xff; |
| 109 | 217 | v3_changed = 1; |
| 110 | 218 | } |
| 219 | ||
| 220 | bright_v3_b_trans = (data>>8)&0xff; | |
| 221 | ||
| 111 | 222 | break; |
| 112 | 223 | } |
| 113 | 224 | } |
| r2844 | r2845 | |
| 438 | 549 | |
| 439 | 550 | /* sprite ram start / end is not really fixed registers change it */ |
| 440 | 551 | |
| 441 | UINT32 *source = buffered_spriteram32; | |
| 552 | //printf ("addr %08x\n", (skns_spc_regs[0x14/4])); | |
| 553 | ||
| 554 | ||
| 555 | UINT32 *source = spriteram32; | |
| 442 | 556 | UINT32 *finish = source + spriteram_size/4; |
| 443 | 557 | |
| 444 | 558 | int group_x_offset[4]; |
| r2844 | r2845 | |
| 452 | 566 | int xsize,ysize, size, xpos=0,ypos=0, pri=0, romoffset, colour=0, xflip,yflip, joint; |
| 453 | 567 | int sx,sy; |
| 454 | 568 | int endromoffs=0, gfxlen; |
| 569 | int grow; | |
| 455 | 570 | UINT16 zoomx, zoomy; |
| 456 | 571 | |
| 457 | 572 | |
| 458 | if (!disabled){ | |
| 573 | if ((!disabled) && suprnova_alt_enable_sprites){ | |
| 459 | 574 | |
| 460 | 575 | group_enable = (skns_spc_regs[0x00/4] & 0x0040) >> 6; // RWR0 |
| 461 | 576 | |
| r2844 | r2845 | |
| 588 | 703 | romoffset = endromoffs; |
| 589 | 704 | } |
| 590 | 705 | |
| 591 | zoomx = source[2] >> 16; | |
| 592 | zoomy = source[3] >> 16; | |
| 706 | grow = (source[0]>>23) & 1; | |
| 593 | 707 | |
| 708 | if (!grow) | |
| 709 | { | |
| 710 | zoomx = (source[2] >> 16)&0xfcfc; | |
| 711 | zoomy = (source[3] >> 16)&0xfcfc; | |
| 712 | } | |
| 713 | else | |
| 714 | { | |
| 715 | // the bad sprites in sengekis all have this not set.. | |
| 716 | // we need to handle sprite shrink properly | |
| 717 | zoomx = 0; | |
| 718 | zoomy = 0; | |
| 719 | } | |
| 720 | ||
| 721 | ||
| 594 | 722 | romoffset &= gfxlen-1; |
| 595 | 723 | |
| 596 | 724 | endromoffs = skns_rle_decode ( romoffset, size ); |
| 597 | 725 | |
| 726 | // in Cyvern | |
| 727 | ||
| 728 | // train in tunnel pri = 0x00 | |
| 729 | // nothing? = 0x01 | |
| 730 | // players etc. pri = 0x02 | |
| 731 | // pickups etc. pri = 0x03 | |
| 732 | ||
| 598 | 733 | // PriTest |
| 599 | 734 | // if(!( (keyboard_pressed(KEYCODE_Q)&&(pri==0)) || (keyboard_pressed(KEYCODE_W)&&(pri==1)) || (keyboard_pressed(KEYCODE_E)&&(pri==2)) || (keyboard_pressed(KEYCODE_D)&&(pri==3)) )) |
| 600 | 735 | // if( !(keyboard_pressed(KEYCODE_Q) && ((source[0] & 0x00800000)>>24)) ) |
| 736 | ||
| 737 | ||
| 738 | ||
| 601 | 739 | { |
| 602 | int NewColour = colour | |
| 740 | int NewColour = (colour<<8) | (pri << 14); | |
| 603 | 741 | |
| 604 | 742 | if(zoomx || zoomy) |
| 605 | 743 | { |
| r2844 | r2845 | |
| 703 | 841 | { |
| 704 | 842 | int code = ((skns_tilemapA_ram[tile_index] & 0x001fffff) >> 0 ); |
| 705 | 843 | int colr = ((skns_tilemapA_ram[tile_index] & 0x3f000000) >> 24 ); |
| 706 | ||
| 844 | | |
| 707 | 845 | int depth = (skns_v3_regs[0x0c/4] & 0x0001) << 1; |
| 708 | 846 | int flags = 0; |
| 709 | 847 | |
| r2844 | r2845 | |
| 715 | 853 | code, |
| 716 | 854 | 0x40+colr, |
| 717 | 855 | flags); |
| 718 | // tileinfo->category = pri; | |
| 856 | tileinfo->category = pri; | |
| 857 | ||
| 858 | //if (pri) popmessage("pri A!! %02x\n", pri); | |
| 719 | 859 | } |
| 720 | 860 | |
| 721 | 861 | WRITE32_HANDLER ( skns_tilemapA_w ) |
| r2844 | r2845 | |
| 728 | 868 | { |
| 729 | 869 | int code = ((skns_tilemapB_ram[tile_index] & 0x001fffff) >> 0 ); |
| 730 | 870 | int colr = ((skns_tilemapB_ram[tile_index] & 0x3f000000) >> 24 ); |
| 731 | ||
| 871 | | |
| 732 | 872 | int depth = (skns_v3_regs[0x0c/4] & 0x0100) >> 7; |
| 733 | 873 | int flags = 0; |
| 734 | 874 | |
| r2844 | r2845 | |
| 740 | 880 | code, |
| 741 | 881 | 0x40+colr, |
| 742 | 882 | flags); |
| 743 | // tileinfo->category = pri; | |
| 883 | tileinfo->category = pri; | |
| 884 | ||
| 885 | //if (pri) popmessage("pri B!! %02x\n", pri); // 02 on cyvern | |
| 744 | 886 | } |
| 745 | 887 | |
| 746 | 888 | WRITE32_HANDLER ( skns_tilemapB_w ) |
| r2844 | r2845 | |
| 779 | 921 | |
| 780 | 922 | sprite_bitmap = auto_bitmap_alloc(1024,1024,BITMAP_FORMAT_INDEXED16); |
| 781 | 923 | |
| 924 | tilemap_bitmap_lower = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED16); | |
| 925 | tilemap_bitmapflags_lower = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED8); | |
| 782 | 926 | |
| 927 | tilemap_bitmap_higher = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED16); | |
| 928 | tilemap_bitmapflags_higher = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED8); | |
| 929 | ||
| 783 | 930 | machine->gfx[2]->color_granularity=256; |
| 784 | 931 | machine->gfx[3]->color_granularity=256; |
| 785 | 932 | } |
| 786 | 933 | |
| 787 | static void supernova_draw_a( bitmap_t *bitmap, const rectangle *cliprect, int tran ) | |
| 934 | static void supernova_draw_a( bitmap_t *bitmap, bitmap_t* bitmap_flags, const rectangle *cliprect, int tran ) | |
| 788 | 935 | { |
| 789 | int enable_a = (skns_v3_regs[0x10/4] >> 0) & 0x0001; | |
| 936 | int enable_a = (skns_v3_regs[0x10/4] >> 0) & 0x0001; | |
| 937 | int nowrap_a = (skns_v3_regs[0x10/4] >> 0) & 0x0004; | |
| 938 | ||
| 939 | ||
| 790 | 940 | UINT32 startx,starty; |
| 791 | 941 | int incxx,incxy,incyx,incyy; |
| 942 | int columnscroll; | |
| 792 | 943 | |
| 793 | if (enable_a) | |
| 944 | //if(nowrap_a) printf("a\n"); | |
| 945 | ||
| 946 | if (enable_a && suprnova_alt_enable_background) | |
| 794 | 947 | { |
| 795 | 948 | startx = skns_v3_regs[0x1c/4]; |
| 796 | | |
| 949 | | |
| 797 | 950 | incyx = skns_v3_regs[0x2c/4]; |
| 798 | 951 | starty = skns_v3_regs[0x20/4]; |
| 799 | 952 | incxy = skns_v3_regs[0x28/4]; |
| 800 | | |
| 953 | | |
| 801 | 954 | |
| 802 | if( (incxx == 1<<8) && !incxy & !incyx && (incyy == 1<<8) ) // No Roz, only scroll. | |
| 803 | { | |
| 804 | int columnscroll_a = (skns_v3_regs[0x0c/4] >> 1) & 0x0001; | |
| 805 | int offs; | |
| 955 | columnscroll = (skns_v3_regs[0x0c/4] >> 1) & 0x0001; | |
| 806 | 956 | |
| 807 | startx >>= 8; // Lose Floating point | |
| 808 | starty >>= 8; | |
| 809 | ||
| 810 | if(columnscroll_a) { | |
| 811 | tilemap_set_scroll_rows(skns_tilemap_A,1); | |
| 812 | tilemap_set_scroll_cols(skns_tilemap_A,0x400); | |
| 813 | ||
| 814 | tilemap_set_scrollx( skns_tilemap_A, 0, startx ); | |
| 815 | for(offs=0; offs<(0x1000/4); offs++) | |
| 816 | tilemap_set_scrolly( skns_tilemap_A, offs, starty - (skns_v3slc_ram[offs]&0x3ff) ); | |
| 817 | } | |
| 818 | else | |
| 819 | { | |
| 820 | tilemap_set_scroll_rows(skns_tilemap_A,0x400); | |
| 821 | tilemap_set_scroll_cols(skns_tilemap_A,1); | |
| 822 | ||
| 823 | tilemap_set_scrolly( skns_tilemap_A, 0, starty ); | |
| 824 | for(offs=0; offs<(0x1000/4); offs++) | |
| 825 | tilemap_set_scrollx( skns_tilemap_A, offs, startx - (skns_v3slc_ram[offs]&0x3ff) ); | |
| 826 | } | |
| 827 | tilemap_draw(bitmap,cliprect,skns_tilemap_A,tran ? 0 : TILEMAP_DRAW_OPAQUE,0); | |
| 828 | } | |
| 829 | else | |
| 830 | { | |
| 831 | tilemap_draw_roz(bitmap,cliprect,skns_tilemap_A,startx << 8,starty << 8, | |
| 832 | incxx << 8,incxy << 8,incyx << 8,incyy << 8, | |
| 833 | 1, /* wraparound */ | |
| 834 | tran ? 0 : TILEMAP_DRAW_OPAQUE,0); | |
| 835 | } | |
| 957 | suprnova_draw_roz(bitmap,bitmap_flags,cliprect, skns_tilemap_A, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, !nowrap_a, columnscroll, &skns_v3slc_ram[0]); | |
| 958 | //tilemap_copy_bitmap(bitmap, tilemap_bitmap_lower, tilemap_bitmapflags_lower); | |
| 836 | 959 | } |
| 837 | 960 | } |
| 838 | 961 | |
| 839 | static void supernova_draw_b( bitmap_t *bitmap, const rectangle *cliprect, int tran ) | |
| 962 | static void supernova_draw_b( bitmap_t *bitmap, bitmap_t* bitmap_flags, const rectangle *cliprect, int tran ) | |
| 840 | 963 | { |
| 841 | int enable_b = (skns_v3_regs[0x34/4] >> 0) & 0x0001; | |
| 964 | int enable_b = (skns_v3_regs[0x34/4] >> 0) & 0x0001; | |
| 965 | int nowrap_b = (skns_v3_regs[0x34/4] >> 0) & 0x0004; | |
| 966 | ||
| 967 | ||
| 842 | 968 | UINT32 startx,starty; |
| 843 | 969 | int incxx,incxy,incyx,incyy; |
| 970 | int columnscroll; | |
| 844 | 971 | |
| 845 | if (enable_b) | |
| 972 | //if(nowrap_b) printf("b\n"); | |
| 973 | ||
| 974 | if (enable_b && suprnova_alt_enable_background) | |
| 846 | 975 | { |
| 847 | 976 | startx = skns_v3_regs[0x40/4]; |
| 848 | | |
| 977 | | |
| 849 | 978 | incyx = skns_v3_regs[0x50/4]; |
| 850 | 979 | starty = skns_v3_regs[0x44/4]; |
| 851 | 980 | incxy = skns_v3_regs[0x4c/4]; |
| 852 | incxx = skns_v3_regs[0x48/4]; | |
| 853 | ||
| 854 | if( (incxx == 1<<8) && !incxy & !incyx && (incyy == 1<<8) ) // No Roz, only scroll. | |
| 855 | { | |
| 856 | int columnscroll_b = (skns_v3_regs[0x0c/4] >> 9) & 0x0001; | |
| 857 | int offs; | |
| 858 | ||
| 859 | startx >>= 8; | |
| 860 | starty >>= 8; | |
| 861 | ||
| 862 | if(columnscroll_b) { | |
| 863 | tilemap_set_scroll_rows(skns_tilemap_B,1); | |
| 864 | tilemap_set_scroll_cols(skns_tilemap_B,0x400); | |
| 865 | ||
| 866 | tilemap_set_scrollx( skns_tilemap_B, 0, startx ); | |
| 867 | for(offs=0; offs<(0x1000/4); offs++) | |
| 868 | tilemap_set_scrolly( skns_tilemap_B, offs, starty - (skns_v3slc_ram[offs+(0x1000/4)]&0x3ff) ); | |
| 869 | } | |
| 870 | else | |
| 871 | { | |
| 872 | tilemap_set_scroll_rows(skns_tilemap_B,0x400); | |
| 873 | tilemap_set_scroll_cols(skns_tilemap_B,1); | |
| 874 | ||
| 875 | tilemap_set_scrolly( skns_tilemap_B, 0, starty ); | |
| 876 | for(offs=0; offs<(0x1000/4); offs++) | |
| 877 | tilemap_set_scrollx( skns_tilemap_B, offs, startx - (skns_v3slc_ram[offs+(0x1000/4)]&0x3ff) ); | |
| 878 | } | |
| 879 | tilemap_draw(bitmap,cliprect,skns_tilemap_B,tran ? 0 : TILEMAP_DRAW_OPAQUE,0); | |
| 880 | } | |
| 881 | else | |
| 882 | { | |
| 883 | tilemap_draw_roz(bitmap,cliprect,skns_tilemap_B,startx << 8,starty << 8, | |
| 884 | incxx << 8,incxy << 8,incyx << 8,incyy << 8, | |
| 885 | 1, /* wraparound */ | |
| 886 | tran ? 0 : TILEMAP_DRAW_OPAQUE,0); | |
| 887 | } | |
| 981 | incxx = skns_v3_regs[0x48/4]; | |
| 982 | columnscroll = (skns_v3_regs[0x0c/4] >> 9) & 0x0001; // selects column scroll or rowscroll | |
| 983 | suprnova_draw_roz(bitmap,bitmap_flags, cliprect, skns_tilemap_B, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, !nowrap_b, columnscroll, &skns_v3slc_ram[0x1000/4]); | |
| 888 | 984 | } |
| 889 | 985 | } |
| 890 | 986 | |
| r2844 | r2845 | |
| 952 | 1048 | } |
| 953 | 1049 | |
| 954 | 1050 | fillbitmap(bitmap, get_black_pen(screen->machine), cliprect); |
| 1051 | fillbitmap(tilemap_bitmap_lower, 0, NULL); | |
| 1052 | fillbitmap(tilemap_bitmapflags_lower, 0, NULL); | |
| 1053 | fillbitmap(tilemap_bitmap_higher, 0, NULL); | |
| 1054 | fillbitmap(tilemap_bitmapflags_higher, 0, NULL); | |
| 955 | 1055 | |
| 956 | 1056 | { |
| 957 | 1057 | int supernova_pri_a; |
| 958 | 1058 | int supernova_pri_b; |
| 959 | 1059 | int tran = 0; |
| 960 | 1060 | |
| 961 | supernova_pri_a = skns_v3_regs[0x10/4] & 0x0002; | |
| 962 | supernova_pri_b = skns_v3_regs[0x34/4] & 0x0002; | |
| 1061 | supernova_pri_a = (skns_v3_regs[0x10/4] & 0x0002)>>1; | |
| 1062 | supernova_pri_b = (skns_v3_regs[0x34/4] & 0x0002)>>1; | |
| 963 | 1063 | |
| 1064 | //popmessage("pri %d %d\n", supernova_pri_a, supernova_pri_b); | |
| 964 | 1065 | |
| 965 | /* needed until we have the per tile priorities sorted out */ | |
| 966 | if (!strcmp(screen->machine->gamedrv->name,"vblokbrk") || | |
| 967 | !strcmp(screen->machine->gamedrv->name,"sarukani") || | |
| 968 | !strcmp(screen->machine->gamedrv->name,"sengekis") || | |
| 969 | !strcmp(screen->machine->gamedrv->name,"sengekij")) | |
| 1066 | /*if (!supernova_pri_b) { */ | |
| 1067 | supernova_draw_b(tilemap_bitmap_lower, tilemap_bitmapflags_lower, cliprect,tran);// tran = 1; | |
| 1068 | supernova_draw_a(tilemap_bitmap_higher,tilemap_bitmapflags_higher,cliprect,tran);// tran = 1; | |
| 1069 | ||
| 970 | 1070 | { |
| 971 | supernova_pri_b = 0; | |
| 972 | supernova_pri_a = 1; | |
| 973 | } | |
| 1071 | int x,y; | |
| 1072 | UINT8* srcflags, *src2flags; | |
| 1073 | UINT16* src, *src2, *src3; | |
| 1074 | UINT32* dst; | |
| 1075 | UINT16 pri, pri2, pri3; | |
| 1076 | UINT16 bgpri; | |
| 1077 | const pen_t *clut = &Machine->pens[0]; | |
| 1078 | // int drawpri; | |
| 974 | 1079 | |
| 975 | 1080 | |
| 976 | if (!supernova_pri_a) { supernova_draw_a(bitmap,cliprect,tran); tran = 1;} | |
| 977 | if (!supernova_pri_b) { supernova_draw_b(bitmap,cliprect,tran); tran = 1;} | |
| 978 | if (supernova_pri_a) { supernova_draw_a(bitmap,cliprect,tran); tran = 1;} | |
| 979 | if (supernova_pri_b) { supernova_draw_b(bitmap,cliprect,tran); tran = 1;} | |
| 1081 | for (y=0;y<240;y++) | |
| 1082 | { | |
| 1083 | src = BITMAP_ADDR16(tilemap_bitmap_lower, y, 0); | |
| 1084 | srcflags = BITMAP_ADDR8(tilemap_bitmapflags_lower, y, 0); | |
| 980 | 1085 | |
| 1086 | src2 = BITMAP_ADDR16(tilemap_bitmap_higher, y, 0); | |
| 1087 | src2flags = BITMAP_ADDR8(tilemap_bitmapflags_higher, y, 0); | |
| 981 | 1088 | |
| 982 | | |
| 1089 | src3 = BITMAP_ADDR16(sprite_bitmap, y, 0); | |
| 983 | 1090 | |
| 984 | fillbitmap(sprite_bitmap, 0x0000, cliprect); | |
| 985 | skns_draw_sprites(screen->machine, sprite_bitmap, cliprect); | |
| 1091 | dst = BITMAP_ADDR32(bitmap, y, 0); | |
| 986 | 1092 | |
| 987 | { | |
| 988 | int x,y; | |
| 989 | const pen_t *paldata = screen->machine->pens; | |
| 990 | 1093 | |
| 991 | for (y=0;y<240;y++) | |
| 992 | { | |
| 993 | UINT16* src; | |
| 994 | UINT32* dst; | |
| 1094 | for (x=0;x<320;x++) | |
| 1095 | { | |
| 1096 | UINT16 pendata = src[x]&0x7fff; | |
| 1097 | UINT16 pendata2 = src2[x]&0x7fff; | |
| 1098 | UINT16 bgpendata; | |
| 1099 | UINT16 pendata3 = src3[x]&0x3fff; | |
| 995 | 1100 | |
| 996 | src = BITMAP_ADDR16(sprite_bitmap,y,0); | |
| 997 | dst = BITMAP_ADDR32(bitmap,y,0); | |
| 1101 | UINT32 coldat; | |
| 998 | 1102 | |
| 999 | for (x=0;x<320;x++) | |
| 1000 | { | |
| 1001 | UINT16 pen = src[x]&0x7fff; | |
| 1002 | UINT16 palvalue = skns_palette_ram[pen]; | |
| 1103 | pri = ((srcflags[x] & 0x07)<<1) | (supernova_pri_b); | |
| 1104 | pri2= ((src2flags[x] & 0x07)<<1) | (supernova_pri_a); | |
| 1105 | pri3 = ((src3[x]&0xc000)>>12)+3; | |
| 1003 | 1106 | |
| 1004 | if (palvalue&0x8000) | |
| 1005 | { | |
| 1006 | UINT32 srccolour = dst[x]; | |
| 1007 | UINT32 dstcolour = paldata[pen]; | |
| 1107 | // work out which layers bg pixel has the higher priority | |
| 1108 | // note, can the bg layers be blended?? sarukani uses an alpha pen for | |
| 1109 | // some of them.. and registers indicate it might be possible.. | |
| 1008 | 1110 | |
| 1009 | int r,g,b; | |
| 1010 | int r2,g2,b2; | |
| 1111 | // this priority mixing is almost certainly still incorrect | |
| 1112 | // bg colour / prioirty handling is now wrong | |
| 1011 | 1113 | |
| 1012 | r = (srccolour & 0x000000ff)>> 0; | |
| 1013 | g = (srccolour & 0x0000ff00)>> 8; | |
| 1014 | b = (srccolour & 0x00ff0000)>> 16; | |
| 1114 | if (pri<=pri2) // <= is good for last level of cyvern.. < seem better for galpanis kaneko logo | |
| 1115 | { | |
| 1116 | if (pendata2&0xff) | |
| 1117 | { | |
| 1118 | bgpendata = pendata2&0x7fff; | |
| 1119 | bgpri = pri2; | |
| 1120 | } | |
| 1121 | else if (pendata&0xff) | |
| 1122 | { | |
| 1123 | bgpendata = pendata&0x7fff; | |
| 1124 | bgpri = pri; | |
| 1125 | } | |
| 1126 | else | |
| 1127 | { | |
| 1128 | bgpendata = 0; | |
| 1129 | bgpri = 0;; | |
| 1130 | } | |
| 1131 | } | |
| 1132 | else | |
| 1133 | { | |
| 1134 | if (pendata&0xff) | |
| 1135 | { | |
| 1136 | bgpendata = pendata&0x7fff; | |
| 1137 | bgpri = pri; | |
| 1138 | } | |
| 1139 | else if (pendata2&0xff) | |
| 1140 | { | |
| 1141 | bgpendata = pendata2&0x7fff; | |
| 1142 | bgpri = pri2; | |
| 1143 | } | |
| 1144 | else | |
| 1145 | { | |
| 1146 | bgpendata = 0; | |
| 1147 | bgpri = 0;; | |
| 1148 | } | |
| 1149 | } | |
| 1015 | 1150 | |
| 1016 | r2 = (dstcolour & 0x000000ff)>> 0; | |
| 1017 | g2 = (dstcolour & 0x0000ff00)>> 8; | |
| 1018 | b2 = (dstcolour & 0x00ff0000)>> 16; | |
| 1151 | // if the sprites are higher than the bg pixel | |
| 1152 | if (pri3 > bgpri) | |
| 1153 | { | |
| 1019 | 1154 | |
| 1020 | r2 = (r2 * bright_spc_r_trans) >> 8; | |
| 1021 | g2 = (g2 * bright_spc_g_trans) >> 8; | |
| 1022 | b2 = (b2 * bright_spc_b_trans) >> 8; | |
| 1155 | if (pendata3&0xff) | |
| 1156 | { | |
| 1023 | 1157 | |
| 1024 | r = (r+r2); | |
| 1025 | if (r>255) r = 255; | |
| 1158 | UINT16 palvalue = skns_palette_ram[pendata3]; | |
| 1026 | 1159 | |
| 1027 | g = (g+g2); | |
| 1028 | if (g>255) g = 255; | |
| 1160 | coldat = clut[pendata3]; | |
| 1029 | 1161 | |
| 1030 | b = (b+b2); | |
| 1031 | if (b>255) b = 255; | |
| 1162 | if (palvalue&0x8000) | |
| 1163 | { | |
| 1164 | UINT32 srccolour = clut[bgpendata&0x7fff]; | |
| 1165 | UINT32 dstcolour = clut[pendata3&0x3fff]; | |
| 1032 | 1166 | |
| 1033 | if (pen) dst[x] = (r << 0) | (g << 8) | (b << 16); | |
| 1167 | int r,g,b; | |
| 1168 | int r2,g2,b2; | |
| 1034 | 1169 | |
| 1170 | r = (srccolour & 0x000000ff)>> 0; | |
| 1171 | g = (srccolour & 0x0000ff00)>> 8; | |
| 1172 | b = (srccolour & 0x00ff0000)>> 16; | |
| 1173 | ||
| 1174 | r2 = (dstcolour & 0x000000ff)>> 0; | |
| 1175 | g2 = (dstcolour & 0x0000ff00)>> 8; | |
| 1176 | b2 = (dstcolour & 0x00ff0000)>> 16; | |
| 1177 | ||
| 1178 | r2 = (r2 * bright_spc_r_trans) >> 8; | |
| 1179 | g2 = (g2 * bright_spc_g_trans) >> 8; | |
| 1180 | b2 = (b2 * bright_spc_b_trans) >> 8; | |
| 1181 | ||
| 1182 | r = (r+r2); | |
| 1183 | if (r>255) r = 255; | |
| 1184 | ||
| 1185 | g = (g+g2); | |
| 1186 | if (g>255) g = 255; | |
| 1187 | ||
| 1188 | b = (b+b2); | |
| 1189 | if (b>255) b = 255; | |
| 1190 | ||
| 1191 | dst[x] = (r << 0) | (g << 8) | (b << 16); | |
| 1192 | ||
| 1193 | ||
| 1194 | } | |
| 1195 | ||
| 1196 | else | |
| 1197 | { | |
| 1198 | coldat = clut[pendata3]; | |
| 1199 | dst[x] = coldat; | |
| 1200 | } | |
| 1201 | } | |
| 1202 | else | |
| 1203 | { | |
| 1204 | coldat = clut[bgpendata]; | |
| 1205 | dst[x] = coldat; | |
| 1206 | } | |
| 1207 | } | |
| 1208 | else | |
| 1209 | { | |
| 1210 | coldat = clut[bgpendata]; | |
| 1211 | dst[x] = coldat; | |
| 1212 | } | |
| 1213 | ||
| 1035 | 1214 | } |
| 1036 | else | |
| 1037 | { | |
| 1038 | if (pen) dst[x] = paldata[pen]; | |
| 1039 | } | |
| 1040 | ||
| 1041 | 1215 | } |
| 1042 | 1216 | } |
| 1043 | ||
| 1044 | 1217 | } |
| 1045 | 1218 | |
| 1219 | fillbitmap(sprite_bitmap, 0x0000, cliprect); | |
| 1220 | skns_draw_sprites(screen->machine, sprite_bitmap, cliprect); | |
| 1221 | ||
| 1222 | ||
| 1046 | 1223 | return 0; |
| 1047 | 1224 | } |
| 1048 | 1225 | |
| 1049 | 1226 | VIDEO_EOF(skns) |
| 1050 | 1227 | { |
| 1051 | ||
| 1228 | // buffer_spriteram32_w(machine,0,0,0xffffffff); | |
| 1052 | 1229 | } |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "includes/mexico86.h" | |
| 2 | 3 | |
| 3 | 4 | UINT8 *mexico86_videoram,*mexico86_objectram; |
| 4 | 5 | size_t mexico86_objectram_size; |
| r2844 | r2845 | |
|---|---|---|
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | #include "driver.h" |
| 7 | #include "includes/chaknpop.h" | |
| 7 | 8 | |
| 8 | 9 | #define GFX_FLIP_X 0x01 |
| 9 | 10 | #define GFX_FLIP_Y 0x02 |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "deprecat.h" | |
| 3 | 2 | #include "deco16ic.h" |
| 4 | 3 | #include "deco32.h" |
| 5 | 4 | |
| r2844 | r2845 | |
| 327 | 326 | |
| 328 | 327 | while (multi >= 0) |
| 329 | 328 | { |
| 330 | deco16_pdrawgfx(bitmap,machine->gfx[gfxbank], | |
| 329 | deco16_pdrawgfx(machine, | |
| 330 | bitmap,machine->gfx[gfxbank], | |
| 331 | 331 | sprite - multi * inc, |
| 332 | 332 | colour, |
| 333 | 333 | fx,fy, |
| r2844 | r2845 | |
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | INLINE void dragngun_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 458 | INLINE void dragngun_drawgfxzoom( running_machine *machine, | |
| 459 | bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 459 | 460 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 460 | 461 | const rectangle *clip,int transparency,int transparent_color, |
| 461 | 462 | int scalex, int scaley,bitmap_t *pri_buffer,UINT32 pri_mask, int sprite_screen_width, int sprite_screen_height ) |
| r2844 | r2845 | |
| 490 | 491 | { |
| 491 | 492 | if( gfx ) |
| 492 | 493 | { |
| 493 | const pen_t *pal = & | |
| 494 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; | |
| 494 | 495 | int source_base = (code % gfx->total_elements) * gfx->height; |
| 495 | 496 | |
| 496 | 497 | if (sprite_screen_width && sprite_screen_height) |
| r2844 | r2845 | |
| 801 | 802 | sprite&=0x7fff; |
| 802 | 803 | |
| 803 | 804 | if (zoomx!=0x10000 || zoomy!=0x10000) |
| 804 | dragngun_drawgfxzoom(bitmap,machine->gfx[bank], | |
| 805 | dragngun_drawgfxzoom(machine, | |
| 806 | bitmap,machine->gfx[bank], | |
| 805 | 807 | sprite, |
| 806 | 808 | colour, |
| 807 | 809 | fx,fy, |
| r2844 | r2845 | |
| 975 | 977 | pf1a_tilemap =0; |
| 976 | 978 | dirty_palette = auto_malloc(4096); |
| 977 | 979 | |
| 978 | deco_allocate_sprite_bitmap(); | |
| 980 | deco_allocate_sprite_bitmap(machine); | |
| 979 | 981 | |
| 980 | 982 | tilemap_set_transparent_pen(pf1_tilemap,0); |
| 981 | 983 | tilemap_set_transparent_pen(pf2_tilemap,0); |
| r2844 | r2845 | |
|---|---|---|
| 114 | 114 | ***************************************************************************/ |
| 115 | 115 | |
| 116 | 116 | #include "driver.h" |
| 117 | #include "deprecat.h" | |
| 118 | 117 | |
| 119 | 118 | #include "jalblend.c" |
| 120 | 119 | |
| r2844 | r2845 | |
| 452 | 451 | } |
| 453 | 452 | |
| 454 | 453 | |
| 455 | static void bombsa_change_palette(int color, int data) | |
| 454 | static void bombsa_change_palette(running_machine *machine, int color, int data) | |
| 456 | 455 | { |
| 457 | palette_set_color_rgb( | |
| 456 | palette_set_color_rgb(machine, color, pal4bit(data >> 12), pal4bit(data >> 8), pal4bit(data >> 4)); | |
| 458 | 457 | } |
| 459 | 458 | |
| 460 | 459 | |
| 461 | static void argus_change_palette(int color, int data) | |
| 460 | static void argus_change_palette(running_machine *machine, int color, int data) | |
| 462 | 461 | { |
| 463 | 462 | jal_blend_table[color] = data & 0x0f ; |
| 464 | 463 | |
| 465 | palette_set_color_rgb( | |
| 464 | palette_set_color_rgb(machine, color, pal4bit(data >> 12), pal4bit(data >> 8), pal4bit(data >> 4)); | |
| 466 | 465 | } |
| 467 | 466 | |
| 468 | static void argus_change_bg_palette(int color, int data) | |
| 467 | static void argus_change_bg_palette(running_machine *machine, int color, int data) | |
| 469 | 468 | { |
| 470 | 469 | int r, g, b; |
| 471 | 470 | int ir, ig, ib; |
| r2844 | r2845 | |
| 490 | 489 | g = 0; |
| 491 | 490 | } |
| 492 | 491 | |
| 493 | palette_set_color_rgb( | |
| 492 | palette_set_color_rgb(machine, color, pal4bit(r), pal4bit(g), pal4bit(b)); | |
| 494 | 493 | } |
| 495 | 494 | |
| 496 | 495 | |
| r2844 | r2845 | |
| 706 | 705 | |
| 707 | 706 | for (offs = 0x400 ; offs < 0x500 ; offs ++) |
| 708 | 707 | { |
| 709 | argus_change_bg_palette( (offs - 0x0400) + 128, | |
| 708 | argus_change_bg_palette( machine, (offs - 0x0400) + 128, | |
| 710 | 709 | (argus_paletteram[offs] << 8) | argus_paletteram[offs + 0x0400] ); |
| 711 | 710 | } |
| 712 | 711 | } |
| r2844 | r2845 | |
| 729 | 728 | |
| 730 | 729 | for (offs = 0x400 ; offs < 0x600 ; offs += 2) |
| 731 | 730 | { |
| 732 | argus_change_bg_palette( ((offs - 0x0400) >> 1) + 256, | |
| 731 | argus_change_bg_palette( machine, ((offs - 0x0400) >> 1) + 256, | |
| 733 | 732 | argus_paletteram[offs | 1] | (argus_paletteram[offs & ~1] << 8)); |
| 734 | 733 | } |
| 735 | 734 | } |
| r2844 | r2845 | |
| 810 | 809 | if (offset & 0x80) |
| 811 | 810 | offset -= 0x80; |
| 812 | 811 | |
| 813 | argus_change_palette( offset, | |
| 812 | argus_change_palette( machine, offset, | |
| 814 | 813 | (argus_paletteram[offset] << 8) | argus_paletteram[offset + 0x80] ); |
| 815 | 814 | } |
| 816 | 815 | |
| r2844 | r2845 | |
| 820 | 819 | if (offset >= 0x0800) |
| 821 | 820 | offset -= 0x0400; |
| 822 | 821 | |
| 823 | argus_change_bg_palette( (offset - 0x0400) + 128, | |
| 822 | argus_change_bg_palette( machine, (offset - 0x0400) + 128, | |
| 824 | 823 | (argus_paletteram[offset] << 8) | argus_paletteram[offset + 0x0400] ); |
| 825 | 824 | } |
| 826 | 825 | |
| r2844 | r2845 | |
| 830 | 829 | if (offset >= 0x0900) |
| 831 | 830 | offset -= 0x0400; |
| 832 | 831 | |
| 833 | argus_change_palette( (offset - 0x0500) + 384, | |
| 832 | argus_change_palette( machine, (offset - 0x0500) + 384, | |
| 834 | 833 | (argus_paletteram[offset] << 8) | argus_paletteram[offset + 0x0400] ); |
| 835 | 834 | } |
| 836 | 835 | |
| r2844 | r2845 | |
| 840 | 839 | if (offset >= 0x0b00) |
| 841 | 840 | offset -= 0x0400; |
| 842 | 841 | |
| 843 | argus_change_palette( (offset - 0x0700) + 640, | |
| 842 | argus_change_palette( machine, (offset - 0x0700) + 640, | |
| 844 | 843 | (argus_paletteram[offset] << 8) | argus_paletteram[offset + 0x0400] ); |
| 845 | 844 | } |
| 846 | 845 | } |
| r2844 | r2845 | |
| 850 | 849 | |
| 851 | 850 | for (offs = 0x400 ; offs < 0x500 ; offs ++) |
| 852 | 851 | { |
| 853 | argus_change_bg_palette( (offs - 0x0400) + 128, | |
| 852 | argus_change_bg_palette( machine, (offs - 0x0400) + 128, | |
| 854 | 853 | (argus_paletteram[offs] << 8) | argus_paletteram[offs + 0x0400] ); |
| 855 | 854 | } |
| 856 | 855 | |
| r2844 | r2845 | |
| 868 | 867 | { |
| 869 | 868 | if (offset >= 0x0000 && offset <= 0x01ff) |
| 870 | 869 | { |
| 871 | argus_change_palette( offset >> 1, | |
| 870 | argus_change_palette( machine, offset >> 1, | |
| 872 | 871 | argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); |
| 873 | 872 | } |
| 874 | 873 | else if (offset >= 0x0400 && offset <= 0x05ff ) |
| 875 | 874 | { |
| 876 | argus_change_bg_palette( ((offset - 0x0400) >> 1) + 256, | |
| 875 | argus_change_bg_palette( machine, ((offset - 0x0400) >> 1) + 256, | |
| 877 | 876 | argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); |
| 878 | 877 | } |
| 879 | 878 | else if (offset >= 0x0600 && offset <= 0x07ff ) |
| 880 | 879 | { |
| 881 | argus_change_palette( ((offset - 0x0600) >> 1) + 512, | |
| 880 | argus_change_palette( machine, ((offset - 0x0600) >> 1) + 512, | |
| 882 | 881 | argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); |
| 883 | 882 | } |
| 884 | 883 | } |
| r2844 | r2845 | |
| 888 | 887 | |
| 889 | 888 | for (offs = 0x400 ; offs < 0x600 ; offs += 2) |
| 890 | 889 | { |
| 891 | argus_change_bg_palette( ((offs - 0x0400) >> 1) + 256, | |
| 890 | argus_change_bg_palette( machine, ((offs - 0x0400) >> 1) + 256, | |
| 892 | 891 | argus_paletteram[offs | 1] | (argus_paletteram[offs & ~1] << 8)); |
| 893 | 892 | } |
| 894 | 893 | |
| r2844 | r2845 | |
| 902 | 901 | |
| 903 | 902 | if (offset < 0x0200 ) /* BG1 color */ |
| 904 | 903 | { |
| 905 | argus_change_palette( ((offset - 0x0000) >> 1) + 256, | |
| 904 | argus_change_palette( machine, ((offset - 0x0000) >> 1) + 256, | |
| 906 | 905 | argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); |
| 907 | 906 | } |
| 908 | 907 | else if (offset < 0x0240 ) /* BG0 color */ |
| 909 | 908 | { |
| 910 | argus_change_palette( ((offset - 0x0200) >> 1) + 192, | |
| 909 | argus_change_palette( machine, ((offset - 0x0200) >> 1) + 192, | |
| 911 | 910 | argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); |
| 912 | 911 | } |
| 913 | 912 | else if (offset >= 0x0400 && offset <= 0x04ff ) /* Sprite color */ |
| 914 | 913 | { |
| 915 | 914 | if (offset < 0x0480) /* 16 colors */ |
| 916 | argus_change_palette( ((offset - 0x0400) >> 1) + 0, | |
| 915 | argus_change_palette( machine, ((offset - 0x0400) >> 1) + 0, | |
| 917 | 916 | argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); |
| 918 | 917 | else /* 8 colors */ |
| 919 | 918 | { |
| 920 | argus_change_palette( (offset & 0x70) + ((offset & 0x00f) >> 1) + 64, | |
| 919 | argus_change_palette( machine, (offset & 0x70) + ((offset & 0x00f) >> 1) + 64, | |
| 921 | 920 | argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); |
| 922 | argus_change_palette( (offset & 0x70) + ((offset & 0x00f) >> 1) + 72, | |
| 921 | argus_change_palette( machine, (offset & 0x70) + ((offset & 0x00f) >> 1) + 72, | |
| 923 | 922 | argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); |
| 924 | 923 | } |
| 925 | 924 | } |
| 926 | 925 | else if (offset >= 0x0600 && offset <= 0x07ff ) /* Text color */ |
| 927 | 926 | { |
| 928 | argus_change_palette( ((offset - 0x0600) >> 1) + 512, | |
| 927 | argus_change_palette( machine, ((offset - 0x0600) >> 1) + 512, | |
| 929 | 928 | argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); |
| 930 | 929 | } |
| 931 | 930 | } |
| r2844 | r2845 | |
| 952 | 951 | if (bombsa_ram_page==1) |
| 953 | 952 | { |
| 954 | 953 | argus_paletteram[ offset ] = data; |
| 955 | bombsa_change_palette( offset>>1, argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); | |
| 954 | bombsa_change_palette( machine, offset>>1, argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); | |
| 956 | 955 | } |
| 957 | 956 | else if (bombsa_ram_page==0) |
| 958 | 957 | { |
| r2844 | r2845 | |
| 1154 | 1153 | } |
| 1155 | 1154 | |
| 1156 | 1155 | if (priority != pri) |
| 1157 | jal_blend_drawgfx(bitmap,machine->gfx[0], | |
| 1156 | jal_blend_drawgfx(machine, | |
| 1157 | bitmap,machine->gfx[0], | |
| 1158 | 1158 | tile, |
| 1159 | 1159 | color, |
| 1160 | 1160 | flipx, flipy, |
| r2844 | r2845 | |
| 1208 | 1208 | flipy ^= 0x20; |
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | jal_blend_drawgfx(bitmap,machine->gfx[0], | |
| 1211 | jal_blend_drawgfx(machine, | |
| 1212 | bitmap,machine->gfx[0], | |
| 1212 | 1213 | tile, |
| 1213 | 1214 | color, |
| 1214 | 1215 | flipx, flipy, |
| r2844 | r2845 | |
| 1243 | 1244 | { |
| 1244 | 1245 | if ( (offs >= 0x100 && offs < 0x300) || (offs >= 0x400 && offs < 0x580) ) |
| 1245 | 1246 | { |
| 1246 | jal_blend_drawgfx(bitmap,machine->gfx[0], | |
| 1247 | jal_blend_drawgfx(machine, | |
| 1248 | bitmap,machine->gfx[0], | |
| 1247 | 1249 | tile, |
| 1248 | 1250 | color, |
| 1249 | 1251 | flipx, flipy, |
| r2844 | r2845 | |
| 1261 | 1263 | |
| 1262 | 1264 | td = (flipx) ? (1 - i) : i; |
| 1263 | 1265 | |
| 1264 | jal_blend_drawgfx(bitmap,machine->gfx[0], | |
| 1266 | jal_blend_drawgfx(machine, | |
| 1267 | bitmap,machine->gfx[0], | |
| 1265 | 1268 | tile + td, |
| 1266 | 1269 | color, |
| 1267 | 1270 | flipx, flipy, |
| r2844 | r2845 | |
| 1285 | 1288 | else |
| 1286 | 1289 | td = (flipx) ? ( (1 - i) * 2 ) + 1 - j : (1 - i) * 2 + j; |
| 1287 | 1290 | |
| 1288 | jal_blend_drawgfx(bitmap,machine->gfx[0], | |
| 1291 | jal_blend_drawgfx(machine, | |
| 1292 | bitmap,machine->gfx[0], | |
| 1289 | 1293 | tile + td, |
| 1290 | 1294 | color, |
| 1291 | 1295 | flipx, flipy, |
| r2844 | r2845 | |
| 1310 | 1314 | else |
| 1311 | 1315 | td = (flipx) ? ( (3 - i) * 4 ) + 3 - j : (3 - i) * 4 + j; |
| 1312 | 1316 | |
| 1313 | jal_blend_drawgfx(bitmap,machine->gfx[0], | |
| 1317 | jal_blend_drawgfx(machine, | |
| 1318 | bitmap,machine->gfx[0], | |
| 1314 | 1319 | tile + td, |
| 1315 | 1320 | color, |
| 1316 | 1321 | flipx, flipy, |
| r2844 | r2845 | |
| 1330 | 1335 | |
| 1331 | 1336 | if ( (offs >= 0x100 && offs < 0x300) || (offs >= 0x400 && offs < 0x580) ) |
| 1332 | 1337 | { |
| 1333 | jal_blend_drawgfx(bitmap,machine->gfx[0], | |
| 1338 | jal_blend_drawgfx(machine, | |
| 1339 | bitmap,machine->gfx[0], | |
| 1334 | 1340 | tile, |
| 1335 | 1341 | color, |
| 1336 | 1342 | flipx, flipy, |
| r2844 | r2845 | |
| 1348 | 1354 | |
| 1349 | 1355 | td = (flipx) ? i : (1 - i); |
| 1350 | 1356 | |
| 1351 | jal_blend_drawgfx(bitmap,machine->gfx[0], | |
| 1357 | jal_blend_drawgfx(machine, | |
| 1358 | bitmap,machine->gfx[0], | |
| 1352 | 1359 | tile + td, |
| 1353 | 1360 | color, |
| 1354 | 1361 | flipx, flipy, |
| r2844 | r2845 | |
| 1372 | 1379 | else |
| 1373 | 1380 | td = (flipx) ? i * 2 + j : (i * 2) + 1 - j; |
| 1374 | 1381 | |
| 1375 | jal_blend_drawgfx(bitmap,machine->gfx[0], | |
| 1382 | jal_blend_drawgfx(machine, | |
| 1383 | bitmap,machine->gfx[0], | |
| 1376 | 1384 | tile + td, |
| 1377 | 1385 | color, |
| 1378 | 1386 | flipx, flipy, |
| r2844 | r2845 | |
| 1397 | 1405 | else |
| 1398 | 1406 | td = (flipx) ? i * 4 + j : (i * 4) + 3 - j; |
| 1399 | 1407 | |
| 1400 | jal_blend_drawgfx(bitmap,machine->gfx[0], | |
| 1408 | jal_blend_drawgfx(machine, | |
| 1409 | bitmap,machine->gfx[0], | |
| 1401 | 1410 | tile + td, |
| 1402 | 1411 | color, |
| 1403 | 1412 | flipx, flipy, |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "includes/lkage.h" | |
| 2 | 3 | |
| 3 | 4 | static tilemap *bg_tilemap, *fg_tilemap, *tx_tilemap; |
| 4 | 5 | static UINT8 bg_tile_bank, fg_tile_bank; |
| r2844 | r2845 | |
|---|---|---|
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "video/resnet.h" |
| 11 | 11 | #include "fastfred.h" |
| 12 | #include "includes/galaxold.h" | |
| 12 | 13 | |
| 13 | extern UINT8 galaxold_stars_on; | |
| 14 | void galaxold_init_stars(running_machine *machine, int colors_offset); | |
| 15 | void galaxold_draw_stars(running_machine *machine, bitmap_t *bitmap); | |
| 16 | ||
| 17 | 14 | UINT8 *fastfred_videoram; |
| 18 | 15 | UINT8 *fastfred_spriteram; |
| 19 | 16 | size_t fastfred_spriteram_size; |
| r2844 | r2845 | |
| 390 | 387 | VIDEO_UPDATE( imago ) |
| 391 | 388 | { |
| 392 | 389 | tilemap_draw(bitmap,cliprect,web_tilemap,0,0); |
| 393 | galaxold_draw_stars(screen->machine, bitmap); | |
| 390 | galaxold_draw_stars(screen->machine, bitmap, cliprect); | |
| 394 | 391 | tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); |
| 395 | 392 | draw_sprites(screen->machine, bitmap, cliprect); |
| 396 | 393 | tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); |
| r2844 | r2845 | |
|---|---|---|
| 9 | 9 | #include "driver.h" |
| 10 | 10 | |
| 11 | 11 | |
| 12 | static tilemap *punchout_topTilemap; | |
| 13 | static tilemap *punchout_botTilemap; | |
| 12 | static tilemap *bg_top_tilemap; | |
| 13 | static tilemap *bg_bot_tilemap; | |
| 14 | static tilemap *fg_tilemap; // bottom only | |
| 14 | 15 | |
| 15 | static tilemap *spr1tilemap; | |
| 16 | static tilemap *spr1alttilemap; | |
| 17 | static tilemap *spr2tilemap; | |
| 18 | static tilemap *fgtilemap; | |
| 16 | static tilemap *spr1_tilemap; | |
| 17 | static tilemap *spr1_tilemap_flipx; | |
| 18 | static tilemap *spr2_tilemap; | |
| 19 | 19 | |
| 20 | UINT8 *punchout_topTilemap_ram; | |
| 21 | UINT8 *punchout_botTilemap_ram; | |
| 22 | UINT8 *punchout_botTilemap_scroll_ram; | |
| 23 | UINT8 *armwrest_fgTilemap_ram; | |
| 24 | UINT8 *punchout_bigsprite1ram; | |
| 25 | UINT8 *punchout_bigsprite2ram; | |
| 26 | UINT8 *punchout_bigsprite1; | |
| 27 | UINT8 *punchout_bigsprite2; | |
| 20 | UINT8 *punchout_bg_top_videoram; | |
| 21 | UINT8 *punchout_bg_bot_videoram; | |
| 22 | UINT8 *armwrest_fg_videoram; | |
| 23 | UINT8 *punchout_spr1_videoram; | |
| 24 | UINT8 *punchout_spr2_videoram; | |
| 25 | UINT8 *punchout_spr1_ctrlram; | |
| 26 | UINT8 *punchout_spr2_ctrlram; | |
| 28 | 27 | UINT8 *punchout_palettebank; |
| 29 | 28 | |
| 30 | static UINT8 top_palette_bank,bottom_palette_bank; | |
| 31 | 29 | |
| 32 | 30 | |
| 31 | /* these depend on jumpers(?) on the board and change from game to game */ | |
| 32 | static int palette_reverse_top, palette_reverse_bot; | |
| 33 | 33 | |
| 34 | /*************************************************************************** | |
| 35 | 34 | |
| 36 | Convert the color PROMs into a more useable format. | |
| 37 | ||
| 38 | Punch Out has a six 512x4 palette PROMs (one per gun; three for the top | |
| 39 | monitor chars, three for everything else). | |
| 40 | The PROMs are connected to the RGB output this way: | |
| 41 | ||
| 42 | bit 3 -- 240 ohm resistor -- inverter -- RED/GREEN/BLUE | |
| 43 | -- 470 ohm resistor -- inverter -- RED/GREEN/BLUE | |
| 44 | -- 1 kohm resistor -- inverter -- RED/GREEN/BLUE | |
| 45 | bit 0 -- 2 kohm resistor -- inverter -- RED/GREEN/BLUE | |
| 46 | ||
| 47 | ***************************************************************************/ | |
| 48 | ||
| 49 | /* these depend on jumpers on the board and change from game to game */ | |
| 50 | static int gfx0inv,gfx1inv,gfx2inv,gfx3inv; | |
| 51 | ||
| 52 | PALETTE_INIT( punchout ) | |
| 53 | { | |
| 54 | int i; | |
| 55 | ||
| 56 | for (i = 0; i < 0x800; i++) | |
| 57 | { | |
| 58 | int pen; | |
| 59 | int r, g, b; | |
| 60 | ||
| 61 | if (i < 0x200) | |
| 62 | /* top monitor chars */ | |
| 63 | pen = ((i - 0x000) ^ gfx0inv) | 0x000; | |
| 64 | else if (i < 0x400) | |
| 65 | /* bottom monitor chars */ | |
| 66 | pen = ((i - 0x200) ^ gfx1inv) | 0x200; | |
| 67 | else if (i < 0x600) | |
| 68 | /* big sprite #1 */ | |
| 69 | pen = ((i - 0x400) ^ gfx2inv) | 0x200; | |
| 70 | else | |
| 71 | /* big sprite #2*/ | |
| 72 | pen = ((i - 0x600) ^ gfx3inv) | 0x200; | |
| 73 | ||
| 74 | r = 255 - pal4bit(color_prom[pen + 0x000]); | |
| 75 | g = 255 - pal4bit(color_prom[pen + 0x400]); | |
| 76 | b = 255 - pal4bit(color_prom[pen + 0x800]); | |
| 77 | ||
| 78 | palette_set_color(machine, i, MAKE_RGB(r, g, b)); | |
| 79 | } | |
| 80 | } | |
| 81 | ||
| 82 | ||
| 83 | PALETTE_INIT( armwrest ) | |
| 84 | { | |
| 85 | int i; | |
| 86 | ||
| 87 | for (i = 0; i < 0xa00; i++) | |
| 88 | { | |
| 89 | int pen; | |
| 90 | int r, g, b; | |
| 91 | ||
| 92 | if (i < 0x400) | |
| 93 | /* top monitor chars */ | |
| 94 | pen = (i - 0x000) | 0x000; | |
| 95 | else if (i < 0x600) | |
| 96 | /* bottom monitor chars */ | |
| 97 | pen = (i - 0x400) | 0x200; | |
| 98 | else if (i < 0x800) | |
| 99 | /* big sprite #1 */ | |
| 100 | pen = (i - 0x600) | 0x200; | |
| 101 | else | |
| 102 | /* big sprite #2*/ | |
| 103 | pen = ((i - 0x800) ^ 0x03) | 0x200; | |
| 104 | ||
| 105 | r = 255 - pal4bit(color_prom[pen + 0x000]); | |
| 106 | g = 255 - pal4bit(color_prom[pen + 0x400]); | |
| 107 | b = 255 - pal4bit(color_prom[pen + 0x800]); | |
| 108 | ||
| 109 | palette_set_color(machine, i, MAKE_RGB(r, g, b)); | |
| 110 | } | |
| 111 | } | |
| 112 | ||
| 113 | ||
| 114 | 35 | DRIVER_INIT( punchout ) |
| 115 | 36 | { |
| 116 | gfx0inv = 0x03; | |
| 117 | gfx1inv = 0xfc; | |
| 118 | gfx2inv = 0xff; | |
| 119 | gfx3inv = 0xfc; | |
| 37 | palette_reverse_top = 0x00; | |
| 38 | palette_reverse_bot = 0xff; | |
| 120 | 39 | } |
| 121 | 40 | |
| 122 | 41 | DRIVER_INIT( spnchout ) |
| 123 | 42 | { |
| 124 | gfx0inv = 0x00; | |
| 125 | gfx1inv = 0xff; | |
| 126 | gfx2inv = 0xff; | |
| 127 | gfx3inv = 0xff; | |
| 43 | palette_reverse_top = 0x00; | |
| 44 | palette_reverse_bot = 0xff; | |
| 128 | 45 | } |
| 129 | 46 | |
| 130 | 47 | DRIVER_INIT( spnchotj ) |
| 131 | 48 | { |
| 132 | gfx0inv = 0xfc; | |
| 133 | gfx1inv = 0xff; | |
| 134 | gfx2inv = 0xff; | |
| 135 | gfx3inv = 0xff; | |
| 49 | palette_reverse_top = 0xff; | |
| 50 | palette_reverse_bot = 0xff; | |
| 136 | 51 | } |
| 137 | 52 | |
| 138 | 53 | DRIVER_INIT( armwrest ) |
| 139 | 54 | { |
| 55 | palette_reverse_top = 0x00; | |
| 56 | palette_reverse_bot = 0x00; | |
| 140 | 57 | } |
| 141 | 58 | |
| 142 | 59 | |
| r2844 | r2845 | |
| 147 | 64 | Start the video hardware emulation. |
| 148 | 65 | |
| 149 | 66 | ***************************************************************************/ |
| 67 | ||
| 150 | 68 | static TILE_GET_INFO( top_get_info ) |
| 151 | 69 | { |
| 152 | int code = punchout_topTilemap_ram[tile_index*2] + 256 * (punchout_topTilemap_ram[tile_index*2 + 1] & 0x03); | |
| 153 | int color = ((punchout_topTilemap_ram[tile_index*2 + 1] & 0x7c) >> 2) + 64 * top_palette_bank; | |
| 154 | int flipx = punchout_topTilemap_ram[tile_index*2 + 1] & 0x80; | |
| 70 | int attr = punchout_bg_top_videoram[tile_index*2 + 1]; | |
| 71 | int code = punchout_bg_top_videoram[tile_index*2] + ((attr & 0x03) << 8); | |
| 72 | int color = ((attr & 0x7c) >> 2); | |
| 73 | int flipx = attr & 0x80; | |
| 155 | 74 | SET_TILE_INFO(0, code, color, flipx ? TILE_FLIPX : 0); |
| 156 | 75 | } |
| 157 | 76 | |
| 77 | static TILE_GET_INFO( armwrest_top_get_info ) | |
| 78 | { | |
| 79 | int attr = punchout_bg_top_videoram[tile_index*2 + 1]; | |
| 80 | int code = punchout_bg_top_videoram[tile_index*2] + ((attr & 0x03) << 8) + ((attr & 0x80) << 3); | |
| 81 | int color = ((attr & 0x7c) >> 2); | |
| 82 | SET_TILE_INFO(0, code, color, 0); | |
| 83 | } | |
| 84 | ||
| 158 | 85 | static TILE_GET_INFO( bot_get_info ) |
| 159 | 86 | { |
| 160 | int code = punchout_botTilemap_ram[tile_index*2] + 256 * (punchout_botTilemap_ram[tile_index*2 + 1] & 0x03); | |
| 161 | int color = ((punchout_botTilemap_ram[tile_index*2 + 1] & 0x7c) >> 2) + 64 * bottom_palette_bank; | |
| 162 | int flipx = punchout_botTilemap_ram[tile_index*2 + 1] & 0x80; | |
| 87 | int attr = punchout_bg_bot_videoram[tile_index*2 + 1]; | |
| 88 | int code = punchout_bg_bot_videoram[tile_index*2] + ((attr & 0x03) << 8); | |
| 89 | int color = ((attr & 0x7c) >> 2); | |
| 90 | int flipx = attr & 0x80; | |
| 163 | 91 | SET_TILE_INFO(1, code, color, flipx ? TILE_FLIPX : 0); |
| 164 | 92 | } |
| 165 | 93 | |
| 94 | static TILE_GET_INFO( armwrest_bot_get_info ) | |
| 95 | { | |
| 96 | int attr = punchout_bg_bot_videoram[tile_index*2 + 1]; | |
| 97 | int code = punchout_bg_bot_videoram[tile_index*2] + ((attr & 0x03) << 8); | |
| 98 | int color = ((attr & 0x7c) >> 2) + 0x40; | |
| 99 | int flipx = attr & 0x80; | |
| 100 | SET_TILE_INFO(0, code, color, flipx ? TILE_FLIPX : 0); | |
| 101 | } | |
| 102 | ||
| 166 | 103 | static TILE_GET_INFO( bs1_get_info ) |
| 167 | 104 | { |
| 168 | int code = punchout_bigsprite1ram[tile_index*4] + 256 * (punchout_bigsprite1ram[tile_index*4 + 1] & 0x1f); | |
| 169 | int color = (punchout_bigsprite1ram[tile_index*4 + 3] & 0x1f) + 32 * bottom_palette_bank; | |
| 170 | int flipx = punchout_bigsprite1ram[tile_index*4 + 3] & 0x80; | |
| 105 | int attr = punchout_spr1_videoram[tile_index*4 + 3]; | |
| 106 | int code = punchout_spr1_videoram[tile_index*4] + ((punchout_spr1_videoram[tile_index*4 + 1] & 0x1f) << 8); | |
| 107 | int color = attr & 0x1f; | |
| 108 | int flipx = attr & 0x80; | |
| 171 | 109 | SET_TILE_INFO(2, code, color, flipx ? TILE_FLIPX : 0); |
| 172 | 110 | } |
| 173 | 111 | |
| 174 | 112 | static TILE_GET_INFO( bs2_get_info ) |
| 175 | 113 | { |
| 176 | int code = punchout_bigsprite2ram[tile_index*4] + 256 * (punchout_bigsprite2ram[tile_index*4 + 1] & 0x0f); | |
| 177 | int color = (punchout_bigsprite2ram[tile_index*4 + 3] & 0x3f) + 64 * bottom_palette_bank; | |
| 178 | int flipx = punchout_bigsprite2ram[tile_index*4 + 3] & 0x80; | |
| 114 | int attr = punchout_spr2_videoram[tile_index*4 + 3]; | |
| 115 | int code = punchout_spr2_videoram[tile_index*4] + ((punchout_spr2_videoram[tile_index*4 + 1] & 0x0f) << 8); | |
| 116 | int color = attr & 0x3f; | |
| 117 | int flipx = attr & 0x80; | |
| 179 | 118 | SET_TILE_INFO(3, code, color, flipx ? TILE_FLIPX : 0); |
| 180 | 119 | } |
| 181 | 120 | |
| 182 | ||
| 121 | static TILE | |
| 183 | 122 | { |
| 184 | punchout_topTilemap = tilemap_create(top_get_info, tilemap_scan_rows, 8,8, 32,32); | |
| 185 | punchout_botTilemap = tilemap_create(bot_get_info, tilemap_scan_rows, 8,8, 64,32); | |
| 186 | tilemap_set_scroll_rows(punchout_botTilemap, 32); | |
| 187 | ||
| 188 | spr1tilemap = tilemap_create(bs1_get_info, tilemap_scan_rows, 8,8, 16,32); | |
| 189 | spr2tilemap = tilemap_create(bs2_get_info, tilemap_scan_rows, 8,8, 16,32); | |
| 190 | ||
| 191 | fgtilemap = NULL; | |
| 192 | ||
| 193 | tilemap_set_transparent_pen(spr1tilemap, gfx2inv & 0x07); | |
| 194 | tilemap_set_transparent_pen(spr2tilemap, gfx3inv & 0x03); | |
| 123 | int attr = armwrest_fg_videoram[tile_index*2 + 1]; | |
| 124 | int code = armwrest_fg_videoram[tile_index*2] + 256 * (attr & 0x07); | |
| 125 | int color = ((attr & 0xf8) >> 3); | |
| 126 | int flipx = attr & 0x80; | |
| 127 | SET_TILE_INFO(1, code, color, flipx ? TILE_FLIPX : 0); | |
| 195 | 128 | } |
| 196 | 129 | |
| 197 | ||
| 198 | ||
| 199 | static TILE_GET_INFO( armwrest_top_get_info ) | |
| 200 | { | |
| 201 | int code = punchout_topTilemap_ram[tile_index*2] + 256 * (punchout_topTilemap_ram[tile_index*2 + 1] & 0x03) + | |
| 202 | 8 * (punchout_topTilemap_ram[tile_index*2 + 1] & 0x80); | |
| 203 | int color = ((punchout_topTilemap_ram[tile_index*2 + 1] & 0x7c) >> 2) + 64 * top_palette_bank; | |
| 204 | SET_TILE_INFO(0, code, color, 0); | |
| 205 | } | |
| 206 | ||
| 207 | static TILE_GET_INFO( armwrest_bot_get_info ) | |
| 208 | { | |
| 209 | int code = punchout_botTilemap_ram[tile_index*2] + 256 * (punchout_botTilemap_ram[tile_index*2 + 1] & 0x03); | |
| 210 | int color = 128 + ((punchout_botTilemap_ram[tile_index*2 + 1] & 0x7c) >> 2) + 64 * bottom_palette_bank; | |
| 211 | int flipx = punchout_botTilemap_ram[tile_index*2 + 1] & 0x80; | |
| 212 | SET_TILE_INFO(0, code, color, flipx ? TILE_FLIPX : 0); | |
| 213 | } | |
| 214 | ||
| 215 | 130 | static TILEMAP_MAPPER( armwrest_bs1_scan ) |
| 216 | 131 | { |
| 217 | 132 | int halfcols = num_cols/2; |
| 218 | 133 | return (col/halfcols)*(halfcols*num_rows) + row*halfcols + col%halfcols; |
| 219 | 134 | } |
| 220 | 135 | |
| 221 | static TILEMAP_MAPPER( armwrest_bs1 | |
| 136 | static TILEMAP_MAPPER( armwrest_bs1 | |
| 222 | 137 | { |
| 223 | 138 | int halfcols = num_cols/2; |
| 224 | 139 | col ^=0x10; |
| r2844 | r2845 | |
| 226 | 141 | } |
| 227 | 142 | |
| 228 | 143 | |
| 229 | ||
| 230 | static TILE_GET_INFO( armwrest_fg_get_info ) | |
| 144 | VIDEO_START( punchout ) | |
| 231 | 145 | { |
| 232 | int code = armwrest_fgTilemap_ram[tile_index*2] + 256 * (armwrest_fgTilemap_ram[tile_index*2 + 1] & 0x07); | |
| 233 | int color = ((armwrest_fgTilemap_ram[tile_index*2 + 1] & 0xf8) >> 3) + 32 * bottom_palette_bank; | |
| 234 | int flipx = armwrest_fgTilemap_ram[tile_index*2 + 1] & 0x80; | |
| 235 | SET_TILE_INFO(1, code, color, flipx ? TILE_FLIPX : 0); | |
| 146 | bg_top_tilemap = tilemap_create(top_get_info, tilemap_scan_rows, 8,8, 32,32); | |
| 147 | bg_bot_tilemap = tilemap_create(bot_get_info, tilemap_scan_rows, 8,8, 64,32); | |
| 148 | tilemap_set_scroll_rows(bg_bot_tilemap, 32); | |
| 149 | ||
| 150 | spr1_tilemap = tilemap_create(bs1_get_info, tilemap_scan_rows, 8,8, 16,32); | |
| 151 | spr2_tilemap = tilemap_create(bs2_get_info, tilemap_scan_rows, 8,8, 16,32); | |
| 152 | ||
| 153 | fg_tilemap = NULL; | |
| 154 | ||
| 155 | tilemap_set_transparent_pen(spr1_tilemap, 0x07); | |
| 156 | tilemap_set_transparent_pen(spr2_tilemap, 0x03); | |
| 236 | 157 | } |
| 237 | 158 | |
| 159 | ||
| 238 | 160 | VIDEO_START( armwrest ) |
| 239 | 161 | { |
| 240 | punchout_topTilemap = tilemap_create(armwrest_top_get_info, tilemap_scan_rows, 8,8, 32,32); | |
| 241 | punchout_botTilemap = tilemap_create(armwrest_bot_get_info, tilemap_scan_rows, 8,8, 32,32); | |
| 162 | bg_top_tilemap = tilemap_create(armwrest_top_get_info, tilemap_scan_rows, 8,8, 32,32); | |
| 163 | bg_bot_tilemap = tilemap_create(armwrest_bot_get_info, tilemap_scan_rows, 8,8, 32,32); | |
| 242 | 164 | |
| 243 | spr1tilemap = tilemap_create(bs1_get_info, armwrest_bs1_scan, 8,8, 32,16); | |
| 244 | spr1alttilemap = tilemap_create(bs1_get_info, armwrest_bs1alt_scan, 8,8, 32,16); | |
| 245 | spr2tilemap = tilemap_create(bs2_get_info, tilemap_scan_rows, 8,8, 16,32); | |
| 246 | fgtilemap = tilemap_create(armwrest_fg_get_info, tilemap_scan_rows, 8,8, 32,32); | |
| 165 | spr1_tilemap = tilemap_create(bs1_get_info, armwrest_bs1_scan, 8,8, 32,16); | |
| 166 | spr1_tilemap_flipx = tilemap_create(bs1_get_info, armwrest_bs1_scan_flipx, 8,8, 32,16); | |
| 167 | spr2_tilemap = tilemap_create(bs2_get_info, tilemap_scan_rows, 8,8, 16,32); | |
| 168 | fg_tilemap = tilemap_create(armwrest_fg_get_info, tilemap_scan_rows, 8,8, 32,32); | |
| 247 | 169 | |
| 248 | tilemap_set_transparent_pen(spr1tilemap, 0x07); | |
| 249 | tilemap_set_transparent_pen(spr1alttilemap, 0x07); | |
| 250 | tilemap_set_transparent_pen(spr2tilemap, 0x00); | |
| 251 | tilemap_set_transparent_pen(fgtilemap, 0x07); | |
| 170 | tilemap_set_transparent_pen(spr1_tilemap, 0x07); | |
| 171 | tilemap_set_transparent_pen(spr1_tilemap_flipx, 0x07); | |
| 172 | tilemap_set_transparent_pen(spr2_tilemap, 0x03); | |
| 173 | tilemap_set_transparent_pen(fg_tilemap, 0x07); | |
| 252 | 174 | } |
| 253 | 175 | |
| 254 | 176 | |
| 255 | 177 | |
| 256 | WRITE8_HANDLER( punchout_top | |
| 178 | WRITE8_HANDLER( punchout_bg_top_video | |
| 257 | 179 | { |
| 258 | punchout_topTilemap_ram[offset] = data; | |
| 259 | tilemap_mark_tile_dirty(punchout_topTilemap, offset/2); | |
| 180 | punchout_bg_top_videoram[offset] = data; | |
| 181 | tilemap_mark_tile_dirty(bg_top_tilemap, offset/2); | |
| 260 | 182 | } |
| 261 | 183 | |
| 262 | WRITE8_HANDLER( punchout_bot | |
| 184 | WRITE8_HANDLER( punchout_bg_bot_video | |
| 263 | 185 | { |
| 264 | punchout_botTilemap_ram[offset] = data; | |
| 265 | tilemap_mark_tile_dirty(punchout_botTilemap, offset/2); | |
| 186 | punchout_bg_bot_videoram[offset] = data; | |
| 187 | tilemap_mark_tile_dirty(bg_bot_tilemap, offset/2); | |
| 266 | 188 | } |
| 267 | 189 | |
| 268 | WRITE8_HANDLER( armwrest_fg | |
| 190 | WRITE8_HANDLER( armwrest_fg_video | |
| 269 | 191 | { |
| 270 | armwrest_fgTilemap_ram[offset] = data; | |
| 271 | tilemap_mark_tile_dirty(fgtilemap, offset/2); | |
| 192 | armwrest_fg_videoram[offset] = data; | |
| 193 | tilemap_mark_tile_dirty(fg_tilemap, offset/2); | |
| 272 | 194 | } |
| 273 | 195 | |
| 274 | WRITE8_HANDLER( punchout_ | |
| 196 | WRITE8_HANDLER( punchout_ | |
| 275 | 197 | { |
| 276 | punchout_bigsprite1ram[offset] = data; | |
| 277 | tilemap_mark_tile_dirty(spr1tilemap, offset/4); | |
| 278 | if (spr1alttilemap) tilemap_mark_tile_dirty(spr1alttilemap, offset/4); | |
| 198 | punchout_spr1_videoram[offset] = data; | |
| 199 | tilemap_mark_tile_dirty(spr1_tilemap, offset/4); | |
| 200 | if (spr1_tilemap_flipx) | |
| 201 | tilemap_mark_tile_dirty(spr1_tilemap_flipx, offset/4); | |
| 279 | 202 | } |
| 280 | 203 | |
| 281 | WRITE8_HANDLER( punchout_ | |
| 204 | WRITE8_HANDLER( punchout_ | |
| 282 | 205 | { |
| 283 | punchout_bigsprite2ram[offset] = data; | |
| 284 | tilemap_mark_tile_dirty(spr2tilemap, offset/4); | |
| 206 | punchout_spr2_videoram[offset] = data; | |
| 207 | tilemap_mark_tile_dirty(spr2_tilemap, offset/4); | |
| 285 | 208 | } |
| 286 | 209 | |
| 287 | 210 | |
| 288 | 211 | |
| 289 | ||
| 212 | static void draw_big_sprite(bitmap_t *bitmap, c | |
| 290 | 213 | { |
| 291 | *punchout_palettebank = data; | |
| 292 | ||
| 293 | if (top_palette_bank != ((data >> 1) & 0x01)) | |
| 294 | { | |
| 295 | top_palette_bank = (data >> 1) & 0x01; | |
| 296 | tilemap_mark_all_tiles_dirty(punchout_topTilemap); | |
| 297 | } | |
| 298 | if (bottom_palette_bank != ((data >> 0) & 0x01)) | |
| 299 | { | |
| 300 | bottom_palette_bank = (data >> 0) & 0x01; | |
| 301 | if (fgtilemap != NULL) | |
| 302 | tilemap_mark_all_tiles_dirty(fgtilemap); | |
| 303 | tilemap_mark_all_tiles_dirty(punchout_botTilemap); | |
| 304 | tilemap_mark_all_tiles_dirty(spr1tilemap); | |
| 305 | tilemap_mark_all_tiles_dirty(spr2tilemap); | |
| 306 | } | |
| 307 | } | |
| 308 | ||
| 309 | ||
| 310 | ||
| 311 | static void draw_big_sprite(bitmap_t *bitmap, const rectangle *cliprect) | |
| 312 | { | |
| 313 | 214 | int zoom; |
| 314 | 215 | |
| 315 | zoom = punchout_ | |
| 216 | zoom = punchout_ | |
| 316 | 217 | if (zoom) |
| 317 | 218 | { |
| 318 | 219 | int sx,sy; |
| 319 | 220 | UINT32 startx,starty; |
| 320 | 221 | int incxx,incyy; |
| 321 | 222 | |
| 322 | sx = 4096 - (punchout_ | |
| 223 | sx = 4096 - (punchout_ | |
| 323 | 224 | if (sx > 4096-4*127) sx -= 4096; |
| 324 | 225 | |
| 325 | sy = -(punchout_ | |
| 226 | sy = -(punchout_ | |
| 326 | 227 | if (sy <= -256 + zoom/0x40) sy += 512; |
| 327 | 228 | sy += 12; |
| 328 | 229 | |
| r2844 | r2845 | |
| 334 | 235 | startx += 3740 * zoom; /* adjustment to match the screen shots */ |
| 335 | 236 | starty -= 178 * zoom; /* and make the hall of fame picture nice */ |
| 336 | 237 | |
| 337 | if (punchout_ | |
| 238 | if (punchout_ | |
| 338 | 239 | { |
| 339 | 240 | startx = ((16 * 8) << 16) - startx - 1; |
| 340 | 241 | incxx = -incxx; |
| 341 | 242 | } |
| 342 | 243 | |
| 343 | tilemap_draw_roz(bitmap,cliprect,spr1tilemap, | |
| 244 | tilemap_set_palette_offset(spr1_tilemap, 0x100 * palette); | |
| 245 | ||
| 246 | tilemap_draw_roz(bitmap,cliprect,spr1_tilemap, | |
| 344 | 247 | startx,starty + 0x200*(2) * zoom, |
| 345 | 248 | incxx,0,0,incyy, /* zoom, no rotation */ |
| 346 | 249 | 0, /* no wraparound */ |
| r2844 | r2845 | |
| 349 | 252 | } |
| 350 | 253 | |
| 351 | 254 | |
| 352 | static void armwrest_draw_big_sprite(bitmap_t *bitmap, const rectangle *cliprect) | |
| 255 | static void armwrest_draw_big_sprite(bitmap_t *bitmap, const rectangle *cliprect, int palette) | |
| 353 | 256 | { |
| 354 | 257 | int zoom; |
| 355 | 258 | |
| 356 | zoom = punchout_ | |
| 259 | zoom = punchout_ | |
| 357 | 260 | if (zoom) |
| 358 | 261 | { |
| 359 | 262 | int sx,sy; |
| r2844 | r2845 | |
| 361 | 264 | int incxx,incyy; |
| 362 | 265 | tilemap *_tilemap; |
| 363 | 266 | |
| 364 | sx = 4096 - (punchout_ | |
| 267 | sx = 4096 - (punchout_ | |
| 365 | 268 | if (sx > 2048) sx -= 4096; |
| 366 | 269 | |
| 367 | sy = -(punchout_ | |
| 270 | sy = -(punchout_ | |
| 368 | 271 | if (sy <= -256 + zoom/0x40) sy += 512; |
| 369 | 272 | sy += 12; |
| 370 | 273 | |
| r2844 | r2845 | |
| 376 | 279 | startx += 3740 * zoom; /* adjustment to match the screen shots */ |
| 377 | 280 | starty -= 178 * zoom; /* and make the hall of fame picture nice */ |
| 378 | 281 | |
| 379 | if (punchout_ | |
| 282 | if (punchout_ | |
| 380 | 283 | { |
| 381 | _tilemap = spr1 | |
| 284 | _tilemap = spr1_ | |
| 382 | 285 | startx = ((32 * 8) << 16) - startx - 1; |
| 383 | 286 | incxx = -incxx; |
| 384 | 287 | } |
| 385 | 288 | else |
| 386 | _tilemap = spr1tilemap; | |
| 289 | _tilemap = spr1_tilemap; | |
| 387 | 290 | |
| 291 | tilemap_set_palette_offset(_tilemap, 0x100 * palette); | |
| 388 | 292 | |
| 389 | 293 | tilemap_draw_roz(bitmap,cliprect,_tilemap, |
| 390 | 294 | startx,starty + 0x200*(2) * zoom, |
| r2844 | r2845 | |
| 399 | 303 | int sx,sy; |
| 400 | 304 | int incxx; |
| 401 | 305 | |
| 402 | sx = 512 - (punchout_ | |
| 306 | sx = 512 - (punchout_ | |
| 403 | 307 | if (sx > 512-127) sx -= 512; |
| 404 | 308 | sx -= 55; /* adjustment to match the screen shots */ |
| 405 | 309 | |
| 406 | sy = -punchout_ | |
| 310 | sy = -punchout_ | |
| 407 | 311 | sy += 3; /* adjustment to match the screen shots */ |
| 408 | 312 | |
| 409 | 313 | sx = -sx << 16; |
| 410 | 314 | sy = -sy << 16; |
| 411 | 315 | |
| 412 | if (punchout_ | |
| 316 | if (punchout_ | |
| 413 | 317 | { |
| 414 | 318 | sx = ((16 * 8) << 16) - sx - 1; |
| 415 | 319 | incxx = -1; |
| r2844 | r2845 | |
| 417 | 321 | else |
| 418 | 322 | incxx = 1; |
| 419 | 323 | |
| 420 | tilemap_draw_roz(bitmap,cliprect,spr2tilemap, | |
| 324 | // this tilemap doesn't actually zoom, but draw_roz is the only way to draw it without wraparound | |
| 325 | tilemap_draw_roz(bitmap,cliprect,spr2_tilemap, | |
| 421 | 326 | sx, sy, incxx << 16, 0, 0, 1 << 16, |
| 422 | 327 | 0, 0, 0); |
| 423 | 328 | } |
| 424 | 329 | |
| 330 | ||
| 331 | ||
| 332 | static void punchout_copy_top_palette(running_machine *machine, int bank) | |
| 333 | { | |
| 334 | int i; | |
| 335 | const UINT8 *color_prom = memory_region(REGION_PROMS); | |
| 336 | ||
| 337 | // top monitor palette | |
| 338 | for (i = 0; i < 0x100; i++) | |
| 339 | { | |
| 340 | int base = 0x100 * bank; | |
| 341 | int r, g, b; | |
| 342 | ||
| 343 | r = 255 - pal4bit(color_prom[i + 0x000 + base]); | |
| 344 | g = 255 - pal4bit(color_prom[i + 0x200 + base]); | |
| 345 | b = 255 - pal4bit(color_prom[i + 0x400 + base]); | |
| 346 | ||
| 347 | palette_set_color(machine, i ^ palette_reverse_top, MAKE_RGB(r, g, b)); | |
| 348 | } | |
| 349 | } | |
| 350 | ||
| 351 | static void punchout_copy_bot_palette(running_machine *machine, int bank) | |
| 352 | { | |
| 353 | int i; | |
| 354 | const UINT8 *color_prom = memory_region(REGION_PROMS) + 0x600; | |
| 355 | ||
| 356 | // bottom monitor palette | |
| 357 | for (i = 0; i < 0x100; i++) | |
| 358 | { | |
| 359 | int base = 0x100 * bank; | |
| 360 | int r, g, b; | |
| 361 | ||
| 362 | r = 255 - pal4bit(color_prom[i + 0x000 + base]); | |
| 363 | g = 255 - pal4bit(color_prom[i + 0x200 + base]); | |
| 364 | b = 255 - pal4bit(color_prom[i + 0x400 + base]); | |
| 365 | ||
| 366 | palette_set_color(machine, (i ^ palette_reverse_bot) + 0x100, MAKE_RGB(r, g, b)); | |
| 367 | } | |
| 368 | } | |
| 369 | ||
| 370 | ||
| 425 | 371 | VIDEO_UPDATE( punchout ) |
| 426 | 372 | { |
| 427 | 373 | const device_config *top_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "top"); |
| 428 | 374 | const device_config *bottom_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "bottom"); |
| 429 | 375 | |
| 430 | if (screen == | |
| 376 | if (screen == | |
| 431 | 377 | { |
| 432 | t | |
| 378 | punchout_co | |
| 433 | 379 | |
| 434 | if (punchout_bigsprite1[7] & 1) /* display in top monitor */ | |
| 435 | draw_big_sprite(bitmap, cliprect); | |
| 380 | tilemap_draw(bitmap, cliprect, bg_top_tilemap, 0, 0); | |
| 381 | ||
| 382 | if (punchout_spr1_ctrlram[7] & 1) /* display in top monitor */ | |
| 383 | draw_big_sprite(bitmap, cliprect, 0); | |
| 436 | 384 | } |
| 437 | else if (screen == to | |
| 385 | else if (screen == bottom_screen) | |
| 438 | 386 | { |
| 439 | 387 | int offs; |
| 440 | 388 | |
| 389 | punchout_copy_bot_palette(screen->machine, BIT(*punchout_palettebank,0)); | |
| 390 | ||
| 441 | 391 | /* copy the character mapped graphics */ |
| 442 | 392 | for (offs = 0;offs < 32;offs++) |
| 443 | tilemap_set_scrollx( | |
| 393 | tilemap_set_scrollx(bg | |
| 444 | 394 | |
| 445 | tilemap_draw(bitmap, cliprect, | |
| 395 | tilemap_draw(bitmap, cliprect, bg | |
| 446 | 396 | |
| 447 | if (punchout_bigsprite1[7] & 2) /* display in bottom monitor */ | |
| 448 | draw_big_sprite(bitmap, cliprect); | |
| 397 | if (punchout_spr1_ctrlram[7] & 2) /* display in bottom monitor */ | |
| 398 | draw_big_sprite(bitmap, cliprect, 1); | |
| 449 | 399 | drawbs2(screen->machine, bitmap, cliprect); |
| 450 | 400 | } |
| 451 | 401 | return 0; |
| r2844 | r2845 | |
| 457 | 407 | const device_config *top_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "top"); |
| 458 | 408 | const device_config *bottom_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "bottom"); |
| 459 | 409 | |
| 460 | if (screen == | |
| 410 | if (screen == | |
| 461 | 411 | { |
| 462 | t | |
| 412 | punchout_co | |
| 463 | 413 | |
| 464 | if (punchout_bigsprite1[7] & 1) /* display in top monitor */ | |
| 465 | armwrest_draw_big_sprite(bitmap, cliprect); | |
| 414 | tilemap_draw(bitmap, cliprect, bg_top_tilemap, 0, 0); | |
| 415 | ||
| 416 | if (punchout_spr1_ctrlram[7] & 1) /* display in top monitor */ | |
| 417 | armwrest_draw_big_sprite(bitmap, cliprect, 0); | |
| 466 | 418 | } |
| 467 | else if (screen == to | |
| 419 | else if (screen == bottom_screen) | |
| 468 | 420 | { |
| 469 | t | |
| 421 | punchout_co | |
| 470 | 422 | |
| 471 | if (punchout_bigsprite1[7] & 2) /* display in bottom monitor */ | |
| 472 | armwrest_draw_big_sprite(bitmap, cliprect); | |
| 423 | tilemap_draw(bitmap, cliprect, bg_bot_tilemap, 0, 0); | |
| 424 | ||
| 425 | if (punchout_spr1_ctrlram[7] & 2) /* display in bottom monitor */ | |
| 426 | armwrest_draw_big_sprite(bitmap, cliprect, 1); | |
| 473 | 427 | drawbs2(screen->machine, bitmap, cliprect); |
| 474 | 428 | |
| 475 | tilemap_draw(bitmap, cliprect, fgtilemap, 0, 0); | |
| 429 | tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); | |
| 476 | 430 | } |
| 477 | 431 | return 0; |
| 478 | 432 | } |
| r2844 | r2845 | |
|---|---|---|
| 11 | 11 | tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 12 | 12 | sprites_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 13 | 13 | |
| 14 | pandora_start(0,0, -16); | |
| 14 | pandora_start(machine,0,0, -16); | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | PALETTE_INIT( galpanic ) |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "deprecat.h" | |
| 3 | 2 | #include "cpu/sharc/sharc.h" |
| 4 | 3 | #include "machine/konppc.h" |
| 5 | 4 | #include "video/poly.h" |
| r2844 | r2845 | |
| 159 | 158 | static bitmap_t *K001005_zbuffer; |
| 160 | 159 | static rectangle K001005_cliprect; |
| 161 | 160 | |
| 162 | static void render_polygons( | |
| 161 | static void render_polygons(running_machine *machine); | |
| 163 | 162 | |
| 164 | 163 | static UINT8 *K001005_texture; |
| 165 | 164 | |
| r2844 | r2845 | |
| 176 | 175 | |
| 177 | 176 | static int K001005_bitmap_page = 0; |
| 178 | 177 | |
| 179 | void K001005_swap_buffers( | |
| 178 | void K001005_swap_buffers(running_machine *machine); | |
| 180 | 179 | |
| 181 | 180 | static void K001005_exit(running_machine *machine) |
| 182 | 181 | { |
| r2844 | r2845 | |
| 403 | 402 | |
| 404 | 403 | if (data == 2 && K001005_3d_fifo_ptr > 0) |
| 405 | 404 | { |
| 406 | K001005_swap_buffers(); | |
| 407 | render_polygons(); | |
| 405 | K001005_swap_buffers(machine); | |
| 406 | render_polygons(machine); | |
| 408 | 407 | poly_wait(poly, "render_polygons"); |
| 409 | 408 | K001005_3d_fifo_ptr = 0; |
| 410 | 409 | } |
| r2844 | r2845 | |
| 527 | 526 | static poly_vertex prev_v[4]; |
| 528 | 527 | static int prev_poly_type; |
| 529 | 528 | |
| 530 | static void render_polygons( | |
| 529 | static void render_polygons(running_machine *machine) | |
| 531 | 530 | { |
| 532 | 531 | int i, j; |
| 533 | const rectangle *visarea = video_screen_get_visible_area( | |
| 532 | const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen); | |
| 534 | 533 | |
| 535 | 534 | // mame_printf_debug("K001005_fifo_ptr = %08X\n", K001005_3d_fifo_ptr); |
| 536 | 535 | |
| r2844 | r2845 | |
| 944 | 943 | } |
| 945 | 944 | } |
| 946 | 945 | |
| 947 | void K001005_swap_buffers( | |
| 946 | void K001005_swap_buffers(running_machine *machine) | |
| 948 | 947 | { |
| 949 | 948 | K001005_bitmap_page ^= 1; |
| 950 | 949 | |
| 951 | 950 | //if (K001005_status == 2) |
| 952 | 951 | { |
| 953 | fillbitmap(K001005_bitmap[K001005_bitmap_page], | |
| 952 | fillbitmap(K001005_bitmap[K001005_bitmap_page], machine->pens[0], &K001005_cliprect); | |
| 954 | 953 | fillbitmap(K001005_zbuffer, 0xffffffff, &K001005_cliprect); |
| 955 | 954 | } |
| 956 | 955 | } |
| r2844 | r2845 | |
|---|---|---|
| 15 | 15 | UINT16 *namcona1_vreg; |
| 16 | 16 | UINT16 *namcona1_scroll; |
| 17 | 17 | UINT16 *namcona1_workram; |
| 18 | UINT16 *namcona1_sparevram; | |
| 19 | UINT16 *namcona1_pixmap; | |
| 18 | //UINT16 *namcona1_sparevram; | |
| 19 | //UINT16 *namcona1_pixmap; | |
| 20 | 20 | |
| 21 | 21 | /* private variables */ |
| 22 | 22 | static char *dirtychar; |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | void K001005_draw(bitmap_t *bitmap, const rectangle *cliprect); |
| 2 | void K001005_swap_buffers( | |
| 2 | void K001005_swap_buffers(running_machine *machine); | |
| 3 | 3 | void K001005_init(running_machine *machine); |
| 4 | 4 | void K001005_preprocess_texture_data(UINT8 *rom, int length, int gticlub); |
| 5 | 5 | |
| r2844 | r2845 | |
| 10 | 10 | WRITE32_HANDLER(K001006_0_w); |
| 11 | 11 | READ32_HANDLER(K001006_1_r); |
| 12 | 12 | WRITE32_HANDLER(K001006_1_w); |
| 13 | ||
| 14 | VIDEO_START( gticlub ); | |
| 15 | VIDEO_UPDATE( gticlub ); |
| r2844 | r2845 | |
|---|---|---|
| 284 | 284 | |
| 285 | 285 | #define DEBUG_MAX ( 512 ) |
| 286 | 286 | |
| 287 | static void DebugMeshInit( | |
| 287 | static void DebugMeshInit( running_machine *machine ) | |
| 288 | 288 | { |
| 289 | int width = video_screen_get_width(Machine->primary_screen); | |
| 290 | int height = video_screen_get_height(Machine->primary_screen); | |
| 289 | int width = video_screen_get_width(machine->primary_screen); | |
| 290 | int height = video_screen_get_height(machine->primary_screen); | |
| 291 | 291 | |
| 292 | 292 | m_b_debugmesh = 0; |
| 293 | 293 | m_b_debugtexture = 0; |
| r2844 | r2845 | |
| 298 | 298 | debugmesh = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16 ); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | static void DebugMesh( int n_coordx, int n_coordy ) | |
| 301 | static void DebugMesh( running_machine *machine, int n_coordx, int n_coordy ) | |
| 302 | 302 | { |
| 303 | 303 | int n_coord; |
| 304 | 304 | int n_colour; |
| 305 | int width = video_screen_get_width(Machine->primary_screen); | |
| 306 | int height = video_screen_get_height(Machine->primary_screen); | |
| 305 | int width = video_screen_get_width(machine->primary_screen); | |
| 306 | int height = video_screen_get_height(machine->primary_screen); | |
| 307 | 307 | |
| 308 | 308 | if( m_b_debugclear ) |
| 309 | 309 | { |
| r2844 | r2845 | |
| 418 | 418 | m_n_debugcoord = 0; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | static void DebugCheckKeys( | |
| 421 | static void DebugCheckKeys( running_machine *machine ) | |
| 422 | 422 | { |
| 423 | 423 | if( input_code_pressed_once( KEYCODE_M ) ) |
| 424 | 424 | m_b_debugmesh = !m_b_debugmesh; |
| r2844 | r2845 | |
| 428 | 428 | |
| 429 | 429 | if( m_b_debugmesh || m_b_debugtexture ) |
| 430 | 430 | { |
| 431 | int width = video_screen_get_width(Machine->primary_screen); | |
| 432 | int height = video_screen_get_height(Machine->primary_screen); | |
| 433 | video_screen_set_visarea(Machine->primary_screen, 0, width - 1, 0, height - 1 ); | |
| 431 | int width = video_screen_get_width(machine->primary_screen); | |
| 432 | int height = video_screen_get_height(machine->primary_screen); | |
| 433 | video_screen_set_visarea(machine->primary_screen, 0, width - 1, 0, height - 1 ); | |
| 434 | 434 | } |
| 435 | 435 | else |
| 436 | video_screen_set_visarea( | |
| 436 | video_screen_set_visarea(machine->primary_screen, 0, m_n_screenwidth - 1, 0, m_n_screenheight - 1 ); | |
| 437 | 437 | |
| 438 | 438 | if( input_code_pressed_once( KEYCODE_I ) ) |
| 439 | 439 | { |
| r2844 | r2845 | |
| 504 | 504 | return m_b_debugmesh; |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | static int DebugTextureDisplay( bitmap_t *bitmap ) | |
| 507 | static int DebugTextureDisplay( running_machine *machine, bitmap_t *bitmap ) | |
| 508 | 508 | { |
| 509 | 509 | UINT32 n_y; |
| 510 | 510 | |
| 511 | 511 | if( m_b_debugtexture ) |
| 512 | 512 | { |
| 513 | int width = video_screen_get_width(Machine->primary_screen); | |
| 514 | int height = video_screen_get_height(Machine->primary_screen); | |
| 513 | int width = video_screen_get_width(machine->primary_screen); | |
| 514 | int height = video_screen_get_height(machine->primary_screen); | |
| 515 | 515 | |
| 516 | 516 | for( n_y = 0; n_y < height; n_y++ ) |
| 517 | 517 | { |
| r2844 | r2845 | |
| 539 | 539 | } |
| 540 | 540 | p_n_interleave[ n_x ] = m_p_p_vram[ n_yi ][ n_xi ]; |
| 541 | 541 | } |
| 542 | draw_scanline16( bitmap, 0, n_y, width, p_n_interleave, | |
| 542 | draw_scanline16( bitmap, 0, n_y, width, p_n_interleave, machine->pens, -1 ); | |
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | return m_b_debugtexture; |
| r2844 | r2845 | |
| 614 | 614 | visarea.min_x = visarea.min_y = 0; |
| 615 | 615 | visarea.max_x = m_n_screenwidth - 1; |
| 616 | 616 | visarea.max_y = m_n_screenheight - 1; |
| 617 | video_screen_configure( | |
| 617 | video_screen_configure(Machine->primary_screen, m_n_screenwidth, m_n_screenheight, &visarea, HZ_TO_ATTOSECONDS(refresh)); | |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | static void psx_gpu_init( running_machine *machine ) |
| r2844 | r2845 | |
| 628 | 628 | int height = video_screen_get_height(machine->primary_screen); |
| 629 | 629 | |
| 630 | 630 | #if defined( MAME_DEBUG ) |
| 631 | DebugMeshInit(); | |
| 631 | DebugMeshInit(machine); | |
| 632 | 632 | #endif |
| 633 | 633 | |
| 634 | 634 | m_n_gpustatus = 0x14802000; |
| r2844 | r2845 | |
| 806 | 806 | { |
| 807 | 807 | return 0; |
| 808 | 808 | } |
| 809 | if( DebugTextureDisplay( bitmap ) ) | |
| 809 | if( DebugTextureDisplay( screen->machine, bitmap ) ) | |
| 810 | 810 | { |
| 811 | 811 | return 0; |
| 812 | 812 | } |
| r2844 | r2845 | |
| 1490 | 1490 | } |
| 1491 | 1491 | for( n_point = 0; n_point < n_points; n_point++ ) |
| 1492 | 1492 | { |
| 1493 | DebugMesh( COORD_X( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_y ); | |
| 1493 | DebugMesh( Machine, COORD_X( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_y ); | |
| 1494 | 1494 | } |
| 1495 | 1495 | DebugMeshEnd(); |
| 1496 | 1496 | #endif |
| r2844 | r2845 | |
| 1663 | 1663 | } |
| 1664 | 1664 | for( n_point = 0; n_point < n_points; n_point++ ) |
| 1665 | 1665 | { |
| 1666 | DebugMesh( COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_y ); | |
| 1666 | DebugMesh( Machine, COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_y ); | |
| 1667 | 1667 | } |
| 1668 | 1668 | DebugMeshEnd(); |
| 1669 | 1669 | #endif |
| r2844 | r2845 | |
| 1882 | 1882 | } |
| 1883 | 1883 | for( n_point = 0; n_point < n_points; n_point++ ) |
| 1884 | 1884 | { |
| 1885 | DebugMesh( COORD_X( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_y ); | |
| 1885 | DebugMesh( Machine, COORD_X( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_y ); | |
| 1886 | 1886 | } |
| 1887 | 1887 | DebugMeshEnd(); |
| 1888 | 1888 | #endif |
| r2844 | r2845 | |
| 2113 | 2113 | } |
| 2114 | 2114 | for( n_point = 0; n_point < n_points; n_point++ ) |
| 2115 | 2115 | { |
| 2116 | DebugMesh( COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_y ); | |
| 2116 | DebugMesh( Machine, COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) + m_n_drawoffset_y ); | |
| 2117 | 2117 | } |
| 2118 | 2118 | DebugMeshEnd(); |
| 2119 | 2119 | #endif |
| r2844 | r2845 | |
| 2371 | 2371 | { |
| 2372 | 2372 | return; |
| 2373 | 2373 | } |
| 2374 | DebugMesh( COORD_X( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + m_n_drawoffset_y ); | |
| 2375 | DebugMesh( COORD_X( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + m_n_drawoffset_y ); | |
| 2374 | DebugMesh( Machine, COORD_X( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + m_n_drawoffset_y ); | |
| 2375 | DebugMesh( Machine, COORD_X( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + m_n_drawoffset_y ); | |
| 2376 | 2376 | DebugMeshEnd(); |
| 2377 | 2377 | #endif |
| 2378 | 2378 | |
| r2844 | r2845 | |
| 2477 | 2477 | { |
| 2478 | 2478 | return; |
| 2479 | 2479 | } |
| 2480 | DebugMesh( COORD_X( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + m_n_drawoffset_y ); | |
| 2481 | DebugMesh( COORD_X( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + m_n_drawoffset_y ); | |
| 2480 | DebugMesh( Machine, COORD_X( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + m_n_drawoffset_y ); | |
| 2481 | DebugMesh( Machine, COORD_X( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + m_n_drawoffset_y ); | |
| 2482 | 2482 | DebugMeshEnd(); |
| 2483 | 2483 | #endif |
| 2484 | 2484 | |
| r2844 | r2845 | |
| 2576 | 2576 | { |
| 2577 | 2577 | return; |
| 2578 | 2578 | } |
| 2579 | DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ), COORD_Y( m_packet.FlatRectangle.n_coord ) ); | |
| 2580 | DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) ); | |
| 2581 | DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ), COORD_Y( m_packet.FlatRectangle.n_coord ) + SIZE_H( m_packet.FlatRectangle.n_size ) ); | |
| 2582 | DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) + SIZE_H( m_packet.FlatRectangle.n_size ) ); | |
| 2579 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle.n_coord ), COORD_Y( m_packet.FlatRectangle.n_coord ) ); | |
| 2580 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle.n_coord ) + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) ); | |
| 2581 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle.n_coord ), COORD_Y( m_packet.FlatRectangle.n_coord ) + SIZE_H( m_packet.FlatRectangle.n_size ) ); | |
| 2582 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle.n_coord ) + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) + SIZE_H( m_packet.FlatRectangle.n_size ) ); | |
| 2583 | 2583 | DebugMeshEnd(); |
| 2584 | 2584 | #endif |
| 2585 | 2585 | |
| r2844 | r2845 | |
| 2638 | 2638 | { |
| 2639 | 2639 | return; |
| 2640 | 2640 | } |
| 2641 | DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_y ); | |
| 2642 | DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_x + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_y ); | |
| 2643 | DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_y + SIZE_H( m_packet.FlatRectangle.n_size ) ); | |
| 2644 | DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_x + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_y + SIZE_H( m_packet.FlatRectangle.n_size ) ); | |
| 2641 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_y ); | |
| 2642 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_x + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_y ); | |
| 2643 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_y + SIZE_H( m_packet.FlatRectangle.n_size ) ); | |
| 2644 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_x + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) + m_n_drawoffset_y + SIZE_H( m_packet.FlatRectangle.n_size ) ); | |
| 2645 | 2645 | DebugMeshEnd(); |
| 2646 | 2646 | #endif |
| 2647 | 2647 | |
| r2844 | r2845 | |
| 2703 | 2703 | { |
| 2704 | 2704 | return; |
| 2705 | 2705 | } |
| 2706 | DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_y ); | |
| 2707 | DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_x + 8, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_y ); | |
| 2708 | DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_y + 8 ); | |
| 2709 | DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_x + 8, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_y + 8 ); | |
| 2706 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_y ); | |
| 2707 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_x + 8, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_y ); | |
| 2708 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_y + 8 ); | |
| 2709 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_x + 8, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + m_n_drawoffset_y + 8 ); | |
| 2710 | 2710 | DebugMeshEnd(); |
| 2711 | 2711 | #endif |
| 2712 | 2712 | |
| r2844 | r2845 | |
| 2768 | 2768 | { |
| 2769 | 2769 | return; |
| 2770 | 2770 | } |
| 2771 | DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_y ); | |
| 2772 | DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_x + 16, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_y ); | |
| 2773 | DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_y + 16 ); | |
| 2774 | DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_x + 16, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_y + 16 ); | |
| 2771 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_y ); | |
| 2772 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_x + 16, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_y ); | |
| 2773 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_y + 16 ); | |
| 2774 | DebugMesh( Machine, COORD_X( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_x + 16, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + m_n_drawoffset_y + 16 ); | |
| 2775 | 2775 | DebugMeshEnd(); |
| 2776 | 2776 | #endif |
| 2777 | 2777 | |
| r2844 | r2845 | |
| 2844 | 2844 | { |
| 2845 | 2845 | return; |
| 2846 | 2846 | } |
| 2847 | DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_y ); | |
| 2848 | DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_x + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_y ); | |
| 2849 | DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_y + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) ); | |
| 2850 | DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_x + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_y + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) ); | |
| 2847 | DebugMesh( Machine, COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_y ); | |
| 2848 | DebugMesh( Machine, COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_x + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_y ); | |
| 2849 | DebugMesh( Machine, COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_y + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) ); | |
| 2850 | DebugMesh( Machine, COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_x + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + m_n_drawoffset_y + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) ); | |
| 2851 | 2851 | DebugMeshEnd(); |
| 2852 | 2852 | #endif |
| 2853 | 2853 | |
| r2844 | r2845 | |
| 2942 | 2942 | { |
| 2943 | 2943 | return; |
| 2944 | 2944 | } |
| 2945 | DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_y ); | |
| 2946 | DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_x + 7, COORD_Y( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_y ); | |
| 2947 | DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_y + 7 ); | |
| 2948 | DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_x + 7, COORD_Y( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_y + 7 ); | |
| 2945 | DebugMesh( Machine, COORD_X( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_y ); | |
| 2946 | DebugMesh( Machine, COORD_X( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_x + 7, COORD_Y( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_y ); | |
| 2947 | DebugMesh( Machine, COORD_X( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_y + 7 ); | |
| 2948 | DebugMesh( Machine, COORD_X( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_x + 7, COORD_Y( m_packet.Sprite8x8.n_coord ) + m_n_drawoffset_y + 7 ); | |
| 2949 | 2949 | DebugMeshEnd(); |
| 2950 | 2950 | #endif |
| 2951 | 2951 | |
| r2844 | r2845 | |
| 3040 | 3040 | { |
| 3041 | 3041 | return; |
| 3042 | 3042 | } |
| 3043 | DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_y ); | |
| 3044 | DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_x + 7, COORD_Y( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_y ); | |
| 3045 | DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_y + 7 ); | |
| 3046 | DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_x + 7, COORD_Y( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_y + 7 ); | |
| 3043 | DebugMesh( Machine, COORD_X( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_y ); | |
| 3044 | DebugMesh( Machine, COORD_X( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_x + 7, COORD_Y( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_y ); | |
| 3045 | DebugMesh( Machine, COORD_X( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_y + 7 ); | |
| 3046 | DebugMesh( Machine, COORD_X( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_x + 7, COORD_Y( m_packet.Sprite16x16.n_coord ) + m_n_drawoffset_y + 7 ); | |
| 3047 | 3047 | DebugMeshEnd(); |
| 3048 | 3048 | #endif |
| 3049 | 3049 | |
| r2844 | r2845 | |
| 3113 | 3113 | { |
| 3114 | 3114 | return; |
| 3115 | 3115 | } |
| 3116 | DebugMesh( COORD_X( m_packet.Dot.vertex.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.Dot.vertex.n_coord ) + m_n_drawoffset_y ); | |
| 3116 | DebugMesh( Machine, COORD_X( m_packet.Dot.vertex.n_coord ) + m_n_drawoffset_x, COORD_Y( m_packet.Dot.vertex.n_coord ) + m_n_drawoffset_y ); | |
| 3117 | 3117 | DebugMeshEnd(); |
| 3118 | 3118 | #endif |
| 3119 | 3119 | |
| r2844 | r2845 | |
| 3151 | 3151 | { |
| 3152 | 3152 | return; |
| 3153 | 3153 | } |
| 3154 | DebugMesh( COORD_X( m_packet.MoveImage.vertex[ 1 ].n_coord ), COORD_Y( m_packet.MoveImage.vertex[ 1 ].n_coord ) ); | |
| 3155 | DebugMesh( COORD_X( m_packet.MoveImage.vertex[ 1 ].n_coord ) + SIZE_W( m_packet.MoveImage.n_size ), COORD_Y( m_packet.MoveImage.vertex[ 1 ].n_coord ) ); | |
| 3156 | DebugMesh( COORD_X( m_packet.MoveImage.vertex[ 1 ].n_coord ), COORD_Y( m_packet.MoveImage.vertex[ 1 ].n_coord ) + SIZE_H( m_packet.MoveImage.n_size ) ); | |
| 3157 | DebugMesh( COORD_X( m_packet.MoveImage.vertex[ 1 ].n_coord ) + SIZE_W( m_packet.MoveImage.n_size ), COORD_Y( m_packet.MoveImage.vertex[ 1 ].n_coord ) + SIZE_H( m_packet.MoveImage.n_size ) ); | |
| 3154 | DebugMesh( Machine, COORD_X( m_packet.MoveImage.vertex[ 1 ].n_coord ), COORD_Y( m_packet.MoveImage.vertex[ 1 ].n_coord ) ); | |
| 3155 | DebugMesh( Machine, COORD_X( m_packet.MoveImage.vertex[ 1 ].n_coord ) + SIZE_W( m_packet.MoveImage.n_size ), COORD_Y( m_packet.MoveImage.vertex[ 1 ].n_coord ) ); | |
| 3156 | DebugMesh( Machine, COORD_X( m_packet.MoveImage.vertex[ 1 ].n_coord ), COORD_Y( m_packet.MoveImage.vertex[ 1 ].n_coord ) + SIZE_H( m_packet.MoveImage.n_size ) ); | |
| 3157 | DebugMesh( Machine, COORD_X( m_packet.MoveImage.vertex[ 1 ].n_coord ) + SIZE_W( m_packet.MoveImage.n_size ), COORD_Y( m_packet.MoveImage.vertex[ 1 ].n_coord ) + SIZE_H( m_packet.MoveImage.n_size ) ); | |
| 3158 | 3158 | DebugMeshEnd(); |
| 3159 | 3159 | #endif |
| 3160 | 3160 | |
| r2844 | r2845 | |
| 3898 | 3898 | INTERRUPT_GEN( psx_vblank ) |
| 3899 | 3899 | { |
| 3900 | 3900 | #if defined( MAME_DEBUG ) |
| 3901 | DebugCheckKeys(); | |
| 3901 | DebugCheckKeys(machine); | |
| 3902 | 3902 | #endif |
| 3903 | 3903 | |
| 3904 | 3904 | m_n_gpustatus ^= ( 1L << 31 ); |
| 3905 | 3905 | psx_irq_set( machine, 0x0001 ); |
| 3906 | 3906 | } |
| 3907 | 3907 | |
| 3908 | void psx_gpu_reset( | |
| 3908 | void psx_gpu_reset( running_machine *machine ) | |
| 3909 | 3909 | { |
| 3910 | psx_gpu_w( | |
| 3910 | psx_gpu_w( machine, 1, 0, 0xffffffff ); | |
| 3911 | 3911 | } |
| 3912 | 3912 | |
| 3913 | 3913 | void psx_lightgun_set( int n_x, int n_y ) |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "cpu/m6809/m6809.h" |
| 3 | 3 | #include "machine/6522via.h" |
| 4 | #include "includes/beezer.h" | |
| 4 | 5 | |
| 5 | 6 | static int scanline=0; |
| 6 | 7 |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "deprecat.h" | |
| 3 | 2 | #include "video/vdc.h" |
| 4 | 3 | |
| 5 | 4 | /* VDC segments */ |
| r2844 | r2845 | |
| 77 | 76 | static void draw_sgx_overscan_line(int line); |
| 78 | 77 | static void pce_refresh_line(int which, int line, int external_input, UINT8 *drawn, UINT16 *line_buffer); |
| 79 | 78 | static void pce_refresh_sprites(running_machine *machine, int which, int line, UINT8 *drawn, UINT16 *line_buffer); |
| 80 | static void vdc_do_dma(int which); | |
| 79 | static void vdc_do_dma(running_machine *machine, int which); | |
| 81 | 80 | static void vpc_init( running_machine *machine ); |
| 82 | 81 | |
| 83 | 82 | INTERRUPT_GEN( pce_interrupt ) |
| r2844 | r2845 | |
| 445 | 444 | } |
| 446 | 445 | |
| 447 | 446 | |
| 448 | static void vdc_w( int which, offs_t offset, UINT8 data ) | |
| 447 | static void vdc_w( running_machine *machine, int which, offs_t offset, UINT8 data ) | |
| 449 | 448 | { |
| 450 | 449 | switch(offset&3) |
| 451 | 450 | { |
| r2844 | r2845 | |
| 520 | 519 | break; |
| 521 | 520 | |
| 522 | 521 | case LENR: |
| 523 | vdc_do_dma( which ); | |
| 522 | vdc_do_dma( machine, which ); | |
| 524 | 523 | break; |
| 525 | 524 | case SOUR: |
| 526 | 525 | // logerror("SOUR MSB = %02X\n", data); |
| r2844 | r2845 | |
| 533 | 532 | } |
| 534 | 533 | } |
| 535 | 534 | |
| 536 | static UINT8 vdc_r( int which, offs_t offset ) | |
| 535 | static UINT8 vdc_r( running_machine *machine, int which, offs_t offset ) | |
| 537 | 536 | { |
| 538 | 537 | int temp = 0; |
| 539 | 538 | switch(offset&3) |
| r2844 | r2845 | |
| 541 | 540 | case 0x00: |
| 542 | 541 | temp = vdc[which].status; |
| 543 | 542 | vdc[which].status &= ~(VDC_VD | VDC_RR | VDC_CR | VDC_OR | VDC_DS); |
| 544 | cpunum_set_input_line( | |
| 543 | cpunum_set_input_line(machine, 0,0,CLEAR_LINE); | |
| 545 | 544 | break; |
| 546 | 545 | |
| 547 | 546 | case 0x02: |
| r2844 | r2845 | |
| 558 | 557 | return (temp); |
| 559 | 558 | } |
| 560 | 559 | |
| 561 | WRITE8_HANDLER( vdc_0_w ) { vdc_w( 0, offset, data ); } | |
| 562 | WRITE8_HANDLER( vdc_1_w ) { vdc_w( 1, offset, data ); } | |
| 563 | READ8_HANDLER( vdc_0_r ) { return vdc_r( 0, offset ); } | |
| 564 | READ8_HANDLER( vdc_1_r ) { return vdc_r( 1, offset ); } | |
| 560 | WRITE8_HANDLER( vdc_0_w ) { vdc_w( machine, 0, offset, data ); } | |
| 561 | WRITE8_HANDLER( vdc_1_w ) { vdc_w( machine, 1, offset, data ); } | |
| 562 | READ8_HANDLER( vdc_0_r ) { return vdc_r( machine, 0, offset ); } | |
| 563 | READ8_HANDLER( vdc_1_r ) { return vdc_r( machine, 1, offset ); } | |
| 565 | 564 | |
| 566 | 565 | PALETTE_INIT( vce ) { |
| 567 | 566 | int i; |
| r2844 | r2845 | |
| 946 | 945 | } |
| 947 | 946 | } |
| 948 | 947 | |
| 949 | static void vdc_do_dma(int which) | |
| 948 | static void vdc_do_dma(running_machine *machine, int which) | |
| 950 | 949 | { |
| 951 | 950 | int src = vdc[which].vdc_data[SOUR].w; |
| 952 | 951 | int dst = vdc[which].vdc_data[DESR].w; |
| r2844 | r2845 | |
| 981 | 980 | vdc[which].vdc_data[LENR].w = len; |
| 982 | 981 | if(dvc) |
| 983 | 982 | { |
| 984 | cpunum_set_input_line( | |
| 983 | cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); | |
| 985 | 984 | } |
| 986 | 985 | |
| 987 | 986 | } |
| r2844 | r2845 | |
|---|---|---|
| 221 | 221 | VIDEO_START( sandscrp_1xVIEW2 ) |
| 222 | 222 | { |
| 223 | 223 | VIDEO_START_CALL(kaneko16_1xVIEW2); |
| 224 | pandora_start(0,0,0); | |
| 224 | pandora_start(machine,0,0,0); | |
| 225 | 225 | |
| 226 | 226 | tilemap_set_scrolldy( kaneko16_tmap_0, 0, 256 - 1 ); |
| 227 | 227 | tilemap_set_scrolldy( kaneko16_tmap_1, 0, 256 - 1 ); |
| r2844 | r2845 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | #include "driver.h" |
| 16 | #include "deprecat.h" | |
| 17 | 16 | #include "includes/ms32.h" |
| 18 | 17 | |
| 19 | 18 | |
| r2844 | r2845 | |
| 100 | 99 | /********** PALETTE WRITES **********/ |
| 101 | 100 | |
| 102 | 101 | |
| 103 | static void update_color(int color) | |
| 102 | static void update_color(running_machine *machine, int color) | |
| 104 | 103 | { |
| 105 | 104 | int r,g,b; |
| 106 | 105 | |
| r2844 | r2845 | |
| 121 | 120 | b = ((ms32_palram[color*2+1] & 0x00ff) >>0 ); |
| 122 | 121 | } |
| 123 | 122 | |
| 124 | palette_set_color( | |
| 123 | palette_set_color(machine,color,MAKE_RGB(r,g,b)); | |
| 125 | 124 | } |
| 126 | 125 | |
| 127 | 126 | WRITE32_HANDLER( ms32_brightness_w ) |
| r2844 | r2845 | |
| 141 | 140 | brt_b = 0x100 - ((brt[1] & 0x00ff) >> 0); |
| 142 | 141 | |
| 143 | 142 | for (i = 0;i < 0x3000;i++) // colors 0x3000-0x3fff are not used |
| 144 | update_color(i); | |
| 143 | update_color(machine, i); | |
| 145 | 144 | } |
| 146 | 145 | } |
| 147 | 146 | |
| r2844 | r2845 | |
| 152 | 151 | { |
| 153 | 152 | COMBINE_DATA(&ms32_palram[offset]); |
| 154 | 153 | |
| 155 | update_color(offset/2); | |
| 154 | update_color(machine, offset/2); | |
| 156 | 155 | } |
| 157 | 156 | |
| 158 | 157 |
| r2844 | r2845 | |
|---|---|---|
| 86 | 86 | ***************************************************************************/ |
| 87 | 87 | |
| 88 | 88 | #include "driver.h" |
| 89 | #include "deprecat.h" | |
| 90 | 89 | |
| 91 | 90 | UINT16 *darkseal_pf12_row,*darkseal_pf34_row; |
| 92 | 91 | UINT16 *darkseal_pf1_data,*darkseal_pf2_data,*darkseal_pf3_data; |
| r2844 | r2845 | |
| 139 | 138 | |
| 140 | 139 | /******************************************************************************/ |
| 141 | 140 | |
| 142 | static void update_24bitcol(int offset) | |
| 141 | static void update_24bitcol(running_machine *machine, int offset) | |
| 143 | 142 | { |
| 144 | 143 | int r,g,b; |
| 145 | 144 | |
| r2844 | r2845 | |
| 147 | 146 | g = (paletteram16[offset] >> 8) & 0xff; |
| 148 | 147 | b = (paletteram16_2[offset] >> 0) & 0xff; |
| 149 | 148 | |
| 150 | palette_set_color( | |
| 149 | palette_set_color(machine,offset,MAKE_RGB(r,g,b)); | |
| 151 | 150 | } |
| 152 | 151 | |
| 153 | 152 | WRITE16_HANDLER( darkseal_palette_24bit_rg_w ) |
| 154 | 153 | { |
| 155 | 154 | COMBINE_DATA(&paletteram16[offset]); |
| 156 | update_24bitcol(offset); | |
| 155 | update_24bitcol(machine, offset); | |
| 157 | 156 | } |
| 158 | 157 | |
| 159 | 158 | WRITE16_HANDLER( darkseal_palette_24bit_b_w ) |
| 160 | 159 | { |
| 161 | 160 | COMBINE_DATA(&paletteram16_2[offset]); |
| 162 | update_24bitcol(offset); | |
| 161 | update_24bitcol(machine, offset); | |
| 163 | 162 | } |
| 164 | 163 | |
| 165 | 164 | /******************************************************************************/ |
| r2844 | r2845 | |
|---|---|---|
| 91 | 91 | #include "driver.h" |
| 92 | 92 | #include "system16.h" |
| 93 | 93 | #include "video/resnet.h" |
| 94 | #include "includes/genesis.h" | |
| 94 | 95 | |
| 95 | /* video/segac2.c */ | |
| 96 | void system18_vdp_update( bitmap_t *bitmap, const rectangle *cliprect ); | |
| 97 | void system18_vdp_start(running_machine *machine); | |
| 98 | READ16_HANDLER( segac2_vdp_r ); | |
| 99 | WRITE16_HANDLER( segac2_vdp_w ); | |
| 100 | UINT16 sys18_ddcrew_bankregs[0x20]; | |
| 96 | static UINT16 sys18_ddcrew_bankregs[0x20]; | |
| 101 | 97 | |
| 102 | ||
| 103 | ||
| 104 | ||
| 105 | 98 | /* callback to poll video registers */ |
| 106 | 99 | void (* sys16_update_proc)( void ); |
| 107 | 100 |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "video/konamiic.h" |
| 3 | #include "includes/simpsons.h" | |
| 3 | 4 | |
| 4 | 5 | static int bg_colorbase,sprite_colorbase,layer_colorbase[3]; |
| 5 | 6 | UINT8 *simpsons_xtraram; |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "includes/polepos.h" | |
| 2 | 3 | |
| 3 | 4 | UINT16 *polepos_view16_memory; |
| 4 | 5 | UINT16 *polepos_road16_memory; |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "video/segaic24.h" |
| 3 | #include "includes/model1.h" | |
| 3 | 4 | |
| 4 | 5 | #define LOG_TGP_VIDEO 0 |
| 5 | 6 |
| r2844 | r2845 | |
|---|---|---|
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| 12 | #include "includes/jackal.h" | |
| 12 | 13 | |
| 13 | 14 | static UINT8 *jackal_scrollram; |
| 14 | 15 | UINT8 *jackal_videoctrl; |
| r2844 | r2845 | |
| 23 | 24 | /* allocate the colortable */ |
| 24 | 25 | machine->colortable = colortable_alloc(machine, 0x200); |
| 25 | 26 | |
| 26 | for (i = 0; i < 0x100 | |
| 27 | for (i = 0; i < 0x100 | |
| 27 | 28 | { |
| 28 | UINT16 ctabentry = (i & 0xff) | 0x100; | |
| 29 | ||
| 30 | /* this is surely wrong - is there a PROM missing? */ | |
| 31 | if (i & 0x0f) | |
| 32 | ctabentry = ctabentry | (i >> 8); | |
| 33 | ||
| 29 | UINT16 ctabentry = i | 0x100; | |
| 34 | 30 | colortable_entry_set_value(machine->colortable, i, ctabentry); |
| 35 | 31 | } |
| 36 | 32 | |
| 37 | for (i = 0x100 | |
| 33 | for (i = 0x100 | |
| 38 | 34 | { |
| 39 | UINT | |
| 35 | UINT16 ctabentry = color_prom[i - 0x1 | |
| 40 | 36 | colortable_entry_set_value(machine->colortable, i, ctabentry); |
| 41 | 37 | } |
| 42 | 38 | |
| 43 | for (i = 0x | |
| 39 | for (i = 0x2 | |
| 44 | 40 | { |
| 45 | UINT | |
| 41 | UINT16 ctabentry = (color_prom[i - 0x2 | |
| 46 | 42 | colortable_entry_set_value(machine->colortable, i, ctabentry); |
| 47 | 43 | } |
| 48 | 44 | } |
| r2844 | r2845 | |
| 74 | 70 | |
| 75 | 71 | int attr = RAM[0x2000 + tile_index]; |
| 76 | 72 | int code = RAM[0x2400 + tile_index] + ((attr & 0xc0) << 2) + ((attr & 0x30) << 6); |
| 77 | int color = attr & 0x0f; | |
| 73 | int color = 0;//attr & 0x0f; | |
| 78 | 74 | int flags = ((attr & 0x10) ? TILE_FLIPX : 0) | ((attr & 0x20) ? TILE_FLIPY : 0); |
| 79 | 75 | |
| 80 | 76 | SET_TILE_INFO(0, code, color, flags); |
| r2844 | r2845 | |
|---|---|---|
| 10 | 10 | ***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | #include "driver.h" |
| 13 | #include "deprecat.h" | |
| 14 | 13 | #include "deco16ic.h" |
| 15 | 14 | |
| 16 | 15 | static UINT16 vaportra_priority[2]; |
| r2844 | r2845 | |
| 25 | 24 | |
| 26 | 25 | VIDEO_START( vaportra ) |
| 27 | 26 | { |
| 28 | deco16_2_video_init(0); | |
| 27 | deco16_2_video_init(machine, 0); | |
| 29 | 28 | |
| 30 | 29 | deco16_pf1_rowscroll = 0; |
| 31 | 30 | deco16_pf2_rowscroll = 0; |
| r2844 | r2845 | |
| 53 | 52 | |
| 54 | 53 | /******************************************************************************/ |
| 55 | 54 | |
| 56 | static void update_24bitcol(int offset) | |
| 55 | static void update_24bitcol(running_machine *machine, int offset) | |
| 57 | 56 | { |
| 58 | 57 | UINT8 r,g,b; |
| 59 | 58 | |
| r2844 | r2845 | |
| 61 | 60 | g = (paletteram16[offset] >> 8) & 0xff; |
| 62 | 61 | b = (paletteram16_2[offset] >> 0) & 0xff; |
| 63 | 62 | |
| 64 | palette_set_color( | |
| 63 | palette_set_color(machine,offset,MAKE_RGB(r,g,b)); | |
| 65 | 64 | } |
| 66 | 65 | |
| 67 | 66 | WRITE16_HANDLER( vaportra_palette_24bit_rg_w ) |
| 68 | 67 | { |
| 69 | 68 | COMBINE_DATA(&paletteram16[offset]); |
| 70 | update_24bitcol(offset); | |
| 69 | update_24bitcol(machine, offset); | |
| 71 | 70 | } |
| 72 | 71 | |
| 73 | 72 | WRITE16_HANDLER( vaportra_palette_24bit_b_w ) |
| 74 | 73 | { |
| 75 | 74 | COMBINE_DATA(&paletteram16_2[offset]); |
| 76 | update_24bitcol(offset); | |
| 75 | update_24bitcol(machine, offset); | |
| 77 | 76 | } |
| 78 | 77 | |
| 79 | 78 | /******************************************************************************/ |
| r2844 | r2845 | |
|---|---|---|
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| 12 | #include "includes/btime.h" | |
| 12 | 13 | |
| 13 | 14 | |
| 14 | 15 | UINT8 *btime_videoram; |
| r2844 | r2845 | |
| 292 | 293 | /* For now we just check 0x40 in DSW1, and ignore the write if we */ |
| 293 | 294 | /* are in upright controls mode. */ |
| 294 | 295 | |
| 295 | if (input_port_read | |
| 296 | if (input_port_read | |
| 296 | 297 | btime_video_control_w(machine, offset, data); |
| 297 | 298 | } |
| 298 | 299 | |
| r2844 | r2845 | |
| 309 | 310 | { |
| 310 | 311 | btime_palette = (data >> 2) & 0x03; |
| 311 | 312 | |
| 312 | if (!(input_port_read | |
| 313 | if (!(input_port_read | |
| 313 | 314 | { |
| 314 | 315 | flip_screen_set(data & 0x01); |
| 315 | 316 | } |
| r2844 | r2845 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | extern const int TC0100SCN_SINGLE_VDU; /* value set in taitoic.c */ |
| 6 | 6 | |
| 7 | extern UINT8 TC0360PRI_regs[16]; | |
| 8 | ||
| 9 | extern UINT16 *TC0080VCO_chain_ram_0; | |
| 10 | extern UINT16 *TC0080VCO_chain_ram_1; | |
| 11 | extern UINT16 *TC0080VCO_spriteram; | |
| 12 | extern UINT16 *TC0080VCO_scroll_ram; | |
| 13 | extern int TC0080VCO_flipscreen; | |
| 14 | ||
| 7 | 15 | int number_of_TC0100SCN(void); |
| 8 | 16 | int has_TC0110PCR(void); |
| 9 | 17 | int has_second_TC0110PCR(void); |
| r2844 | r2845 | |
|---|---|---|
| 423 | 423 | bullet_color[7] = MAKE_RGB(0xff,0xff,0x00); |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | PALETTE_INIT( moonwar ) | |
| 427 | { | |
| 428 | PALETTE_INIT_CALL(galaxian); | |
| 426 | 429 | |
| 427 | 430 | |
| 431 | /* wire mod to connect the bullet blue output to the 220 ohm resistor */ | |
| 432 | bullet_color[7] = MAKE_RGB(0xef,0xef,0x97); | |
| 433 | } | |
| 434 | ||
| 428 | 435 | /************************************* |
| 429 | 436 | * |
| 430 | 437 | * Common video init |
| r2844 | r2845 | |
| 1346 | 1353 | } |
| 1347 | 1354 | |
| 1348 | 1355 | |
| 1356 | /************************************* | |
| 1357 | * | |
| 1358 | * Calipso extensions | |
| 1359 | * | |
| 1360 | *************************************/ | |
| 1349 | 1361 | |
| 1362 | void calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) | |
| 1363 | { | |
| 1364 | /* same as the others, but no sprite flipping, but instead the bits are used | |
| 1365 | as extra sprite code bits, giving 256 sprite images */ | |
| 1366 | /* No flips */ | |
| 1367 | *code = base[1]; | |
| 1368 | *flipx = 0; | |
| 1369 | *flipy = 0; | |
| 1370 | } | |
| 1371 | ||
| 1350 | 1372 | /************************************* |
| 1351 | 1373 | * |
| 1352 | 1374 | * Jumpbug extensions |
| r2844 | r2845 | |
|---|---|---|
| 238 | 238 | return 0; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | void athena_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int xscroll, int yscroll ) | |
| 241 | static void athena_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int xscroll, int yscroll ) | |
| 242 | 242 | { |
| 243 | 243 | const gfx_element *gfx = machine->gfx[2]; |
| 244 | 244 |
| r2844 | r2845 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | #include "driver.h" |
| 9 | #include "includes/flstory.h" | |
| 9 | 10 | |
| 10 | 11 | |
| 11 | 12 | static tilemap *bg_tilemap; |
| r2844 | r2845 | |
|---|---|---|
| 45 | 45 | if (attr == 0x3a) /* Is the palette wrong? */ |
| 46 | 46 | color = 0x3b; /* 0x3b is the best match */ |
| 47 | 47 | |
| 48 | if (attr == 0x36) /* Is the palette wrong? */ | |
| 49 | color = 0x3a; /* 0x3a is the best match */ | |
| 50 | ||
| 51 | if (attr == 0x32) /* Is the palette wrong? */ | |
| 52 | color = 0x39; /* 0x39 is the best match */ | |
| 53 | ||
| 48 | 54 | SET_TILE_INFO(bank, code, color, 0); |
| 49 | 55 | } |
| 50 | 56 | |
| r2844 | r2845 | |
| 66 | 72 | ---- ---x red component. |
| 67 | 73 | ---- --x- green component. |
| 68 | 74 | ---- -x-- blue component. |
| 69 | ---- x--- unknown, aparently unused. | |
| 70 | xxxx ---- unused. | |
| 75 | xxxx x--- unused. | |
| 71 | 76 | */ |
| 72 | 77 | int i; |
| 73 | 78 |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | #include "deprecat.h" | |
| 9 | 8 | #include "tia.h" |
| 10 | 9 | #include "sound/tiaintf.h" |
| 11 | 10 | |
| r2844 | r2845 | |
| 1980 | 1979 | |
| 1981 | 1980 | |
| 1982 | 1981 | |
| 1983 | void tia_init(const struct tia_interface* ti) | |
| 1982 | void tia_init(running_machine *machine, const struct tia_interface* ti) | |
| 1984 | 1983 | { |
| 1985 | assert_always(mame_get_phase( | |
| 1984 | assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call tia_init at init time!"); | |
| 1986 | 1985 | |
| 1987 | 1986 | if ( ti ) { |
| 1988 | 1987 | tia_read_input_port = ti->read_input_port; |
| r2844 | r2845 | |
| 1994 | 1993 | tia_vsync_callback = NULL; |
| 1995 | 1994 | } |
| 1996 | 1995 | |
| 1997 | tia_reset( | |
| 1996 | tia_reset( machine ); | |
| 1998 | 1997 | |
| 1999 | add_reset_callback( | |
| 1998 | add_reset_callback(machine, tia_reset); | |
| 2000 | 1999 | } |
| 2001 | 2000 |
| r2844 | r2845 | |
|---|---|---|
| 21 | 21 | READ8_HANDLER( tia_r ); |
| 22 | 22 | WRITE8_HANDLER( tia_w ); |
| 23 | 23 | |
| 24 | void tia_init(const struct tia_interface* ti); | |
| 24 | void tia_init(running_machine *machine, const struct tia_interface* ti); | |
| 25 | 25 | |
| 26 | 26 | #endif /* _VIDEO_TIA_H_ */ |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "deprecat.h" | |
| 11 | 10 | #include "leland.h" |
| 12 | 11 | |
| 13 | 12 | |
| r2844 | r2845 | |
| 191 | 190 | * |
| 192 | 191 | *************************************/ |
| 193 | 192 | |
| 194 | static void leland_vram_port_w(int offset, int data, int num) | |
| 193 | static void leland_vram_port_w(running_machine *machine, int offset, int data, int num) | |
| 195 | 194 | { |
| 196 | 195 | struct vram_state_data *state = vram_state + num; |
| 197 | 196 | int addr = state->addr; |
| r2844 | r2845 | |
| 200 | 199 | |
| 201 | 200 | /* don't fully understand why this is needed. Isn't the |
| 202 | 201 | video RAM just one big RAM? */ |
| 203 | int scanline = video_screen_get_vpos( | |
| 202 | int scanline = video_screen_get_vpos(machine->primary_screen); | |
| 204 | 203 | if (scanline > 0) |
| 205 | video_screen_update_partial( | |
| 204 | video_screen_update_partial(machine->primary_screen, scanline - 1); | |
| 206 | 205 | |
| 207 | 206 | if (LOG_COMM && addr >= 0xf000) |
| 208 | 207 | logerror("%04X:%s comm write %04X = %02X\n", activecpu_get_previouspc(), num ? "slave" : "master", addr, data); |
| r2844 | r2845 | |
| 284 | 283 | int num = (param >> 16) & 1; |
| 285 | 284 | int offset = (param >> 8) & 0xff; |
| 286 | 285 | int data = param & 0xff; |
| 287 | leland_vram_port_w(offset, data, num); | |
| 286 | leland_vram_port_w(machine, offset, data, num); | |
| 288 | 287 | } |
| 289 | 288 | |
| 290 | 289 | |
| r2844 | r2845 | |
| 315 | 314 | |
| 316 | 315 | WRITE8_HANDLER( leland_svram_port_w ) |
| 317 | 316 | { |
| 318 | leland_vram_port_w(offset, data, 1); | |
| 317 | leland_vram_port_w(machine, offset, data, 1); | |
| 319 | 318 | } |
| 320 | 319 | |
| 321 | 320 | |
| r2844 | r2845 | |
| 342 | 341 | WRITE8_HANDLER( ataxx_svram_port_w ) |
| 343 | 342 | { |
| 344 | 343 | offset = ((offset >> 1) & 0x07) | ((offset << 3) & 0x08) | (offset & 0x10); |
| 345 | leland_vram_port_w(offset, data, 1); | |
| 344 | leland_vram_port_w(machine, offset, data, 1); | |
| 346 | 345 | } |
| 347 | 346 | |
| 348 | 347 |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | videoram[offset] = data; |
| 9 | 9 | tilemap_mark_tile_dirty(bg_tilemap, offset); |
| 10 | 10 | |
| 11 | if (input_port_read | |
| 11 | if (input_port_read | |
| 12 | 12 | { |
| 13 | 13 | logerror("blockade_videoram_w: scanline %d\n", video_screen_get_vpos(machine->primary_screen)); |
| 14 | 14 | cpu_spinuntil_int(); |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | #include "deprecat.h" | |
| 9 | 8 | #include "segag80r.h" |
| 10 | 9 | #include "rescap.h" |
| 11 | 10 | #include "video/resnet.h" |
| r2844 | r2845 | |
| 89 | 88 | * |
| 90 | 89 | *************************************/ |
| 91 | 90 | |
| 92 | static void g80_set_palette_entry(int entry, UINT8 data) | |
| 91 | static void g80_set_palette_entry(running_machine *machine, int entry, UINT8 data) | |
| 93 | 92 | { |
| 94 | 93 | int bit0, bit1, bit2; |
| 95 | 94 | int r, g, b; |
| r2844 | r2845 | |
| 116 | 115 | bit1 = (b >> 1) & 0x01; |
| 117 | 116 | b = combine_2_weights(bweights, bit0, bit1); |
| 118 | 117 | |
| 119 | palette_set_color( | |
| 118 | palette_set_color(machine, entry, MAKE_RGB(r, g, b)); | |
| 120 | 119 | } |
| 121 | 120 | |
| 122 | 121 | |
| r2844 | r2845 | |
| 280 | 279 | { |
| 281 | 280 | offset &= 0x3f; |
| 282 | 281 | paletteram[offset] = data; |
| 283 | g80_set_palette_entry(offset, data); | |
| 282 | g80_set_palette_entry(machine, offset, data); | |
| 284 | 283 | return; |
| 285 | 284 | } |
| 286 | 285 | |
| r2844 | r2845 | |
| 444 | 443 | { |
| 445 | 444 | offs_t paloffs = offset & 0x3f; |
| 446 | 445 | paletteram[paloffs | 0x40] = data; |
| 447 | g80_set_palette_entry(paloffs | 0x40, data); | |
| 446 | g80_set_palette_entry(machine, paloffs | 0x40, data); | |
| 448 | 447 | /* note that since the background board is not integrated with the main board */ |
| 449 | 448 | /* writes here also write through to regular videoram */ |
| 450 | 449 | } |
| r2844 | r2845 | |
| 514 | 513 | { |
| 515 | 514 | offs_t paloffs = offset & 0x3f; |
| 516 | 515 | paletteram[paloffs | 0x40] = data; |
| 517 | g80_set_palette_entry(paloffs | 0x40, data); | |
| 516 | g80_set_palette_entry(machine, paloffs | 0x40, data); | |
| 518 | 517 | return; |
| 519 | 518 | } |
| 520 | 519 | |
| r2844 | r2845 | |
| 597 | 596 | { |
| 598 | 597 | offs_t paloffs = offset & 0x3f; |
| 599 | 598 | paletteram[paloffs | 0x40] = data; |
| 600 | g80_set_palette_entry(paloffs | 0x40, data); | |
| 599 | g80_set_palette_entry(machine, paloffs | 0x40, data); | |
| 601 | 600 | return; |
| 602 | 601 | } |
| 603 | 602 |
| r2844 | r2845 | |
|---|---|---|
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | #include "driver.h" |
| 7 | #include "deprecat.h" | |
| 8 | 7 | #include "dc.h" |
| 9 | 8 | #include "cpu/sh4/sh4.h" |
| 10 | 9 | |
| r2844 | r2845 | |
| 662 | 661 | return 0; |
| 663 | 662 | } |
| 664 | 663 | |
| 665 | void dc_vblank( | |
| 664 | void dc_vblank(running_machine *machine) | |
| 666 | 665 | { |
| 667 | 666 | dc_sysctrl_regs[SB_ISTNRM] |= IST_VBL_IN; // V Blank-in interrupt |
| 668 | 667 | update_interrupt_status(); |
| 669 | 668 | |
| 670 | timer_adjust_oneshot(vbout_timer, video_screen_get_time_until_pos( | |
| 669 | timer_adjust_oneshot(vbout_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); | |
| 671 | 670 | } |
| 672 | 671 |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "deprecat.h" | |
| 3 | 2 | #include "video/poly.h" |
| 4 | 3 | |
| 5 | 4 | UINT8 *taitojc_texture; |
| r2844 | r2845 | |
| 428 | 427 | } |
| 429 | 428 | } |
| 430 | 429 | |
| 431 | void taitojc_render_polygons(UINT16 *polygon_fifo, int length) | |
| 430 | void taitojc_render_polygons(running_machine *machine, UINT16 *polygon_fifo, int length) | |
| 432 | 431 | { |
| 433 | 432 | poly_vertex vert[4]; |
| 434 | 433 | int i; |
| r2844 | r2845 | |
| 496 | 495 | |
| 497 | 496 | if (vert[0].p[0] < 0x8000 && vert[1].p[0] < 0x8000 && vert[2].p[0] < 0x8000) |
| 498 | 497 | { |
| 499 | poly_render_triangle(poly, framebuffer, video_screen_get_visible_area( | |
| 498 | poly_render_triangle(poly, framebuffer, video_screen_get_visible_area(machine->primary_screen), render_texture_scan, 4, &vert[0], &vert[1], &vert[2]); | |
| 500 | 499 | } |
| 501 | 500 | break; |
| 502 | 501 | } |
| r2844 | r2845 | |
| 544 | 543 | vert[2].p[1] == vert[3].p[1]) |
| 545 | 544 | { |
| 546 | 545 | // optimization: all colours the same -> render solid |
| 547 | poly_render_quad(poly, framebuffer, video_screen_get_visible_area( | |
| 546 | poly_render_quad(poly, framebuffer, video_screen_get_visible_area(machine->primary_screen), render_solid_scan, 2, &vert[0], &vert[1], &vert[2], &vert[3]); | |
| 548 | 547 | } |
| 549 | 548 | else |
| 550 | 549 | { |
| 551 | poly_render_quad(poly, framebuffer, video_screen_get_visible_area( | |
| 550 | poly_render_quad(poly, framebuffer, video_screen_get_visible_area(machine->primary_screen), render_shade_scan, 2, &vert[0], &vert[1], &vert[2], &vert[3]); | |
| 552 | 551 | } |
| 553 | 552 | } |
| 554 | 553 | break; |
| r2844 | r2845 | |
| 614 | 613 | |
| 615 | 614 | if (vert[0].p[0] < 0x8000 && vert[1].p[0] < 0x8000 && vert[2].p[0] < 0x8000 && vert[3].p[0] < 0x8000) |
| 616 | 615 | { |
| 617 | poly_render_quad(poly, framebuffer, video_screen_get_visible_area( | |
| 616 | poly_render_quad(poly, framebuffer, video_screen_get_visible_area(machine->primary_screen), render_texture_scan, 4, &vert[0], &vert[1], &vert[2], &vert[3]); | |
| 618 | 617 | } |
| 619 | 618 | break; |
| 620 | 619 | } |
| r2844 | r2845 | |
| 632 | 631 | poly_wait(poly, "Finished render"); |
| 633 | 632 | } |
| 634 | 633 | |
| 635 | void taitojc_clear_frame( | |
| 634 | void taitojc_clear_frame(running_machine *machine) | |
| 636 | 635 | { |
| 637 | 636 | rectangle cliprect; |
| 638 | 637 | |
| 639 | 638 | cliprect.min_x = 0; |
| 640 | 639 | cliprect.min_y = 0; |
| 641 | cliprect.max_x = video_screen_get_width(Machine->primary_screen) - 1; | |
| 642 | cliprect.max_y = video_screen_get_height(Machine->primary_screen) - 1; | |
| 640 | cliprect.max_x = video_screen_get_width(machine->primary_screen) - 1; | |
| 641 | cliprect.max_y = video_screen_get_height(machine->primary_screen) - 1; | |
| 643 | 642 | |
| 644 | 643 | fillbitmap(framebuffer, 0, &cliprect); |
| 645 | 644 | fillbitmap(zbuffer, 0xffff, &cliprect); |
| r2844 | r2845 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | ***************************************************************************/ |
| 19 | 19 | #include "driver.h" |
| 20 | #include "includes/pitnrun.h" | |
| 20 | 21 | |
| 21 | 22 | static int pitnrun_h_heed; |
| 22 | 23 | static int pitnrun_v_heed; |
| r2844 | r2845 | |
|---|---|---|
| 493 | 493 | * |
| 494 | 494 | *************************************/ |
| 495 | 495 | |
| 496 | void segaic16_set_display_enable(int enable) | |
| 496 | void segaic16_set_display_enable(running_machine *machine, int enable) | |
| 497 | 497 | { |
| 498 | 498 | enable = (enable != 0); |
| 499 | 499 | if (segaic16_display_enable != enable) |
| 500 | 500 | { |
| 501 | video_screen_update_partial( | |
| 501 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); | |
| 502 | 502 | segaic16_display_enable = enable; |
| 503 | 503 | } |
| 504 | 504 | } |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | **************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | #include "deprecat.h" | |
| 9 | 8 | #include "eminline.h" |
| 10 | 9 | #include "cpu/tms32031/tms32031.h" |
| 11 | 10 | #include "includes/midzeus.h" |
| r2844 | r2845 | |
| 105 | 104 | |
| 106 | 105 | static void exit_handler(running_machine *machine); |
| 107 | 106 | |
| 108 | static void zeus_register32_w(offs_t offset, UINT32 data, int logit); | |
| 109 | static void zeus_register_update(offs_t offset, UINT32 oldval, int logit); | |
| 107 | static void zeus_register32_w(running_machine *machine, offs_t offset, UINT32 data, int logit); | |
| 108 | static void zeus_register_update(running_machine *machine, offs_t offset, UINT32 oldval, int logit); | |
| 110 | 109 | static void zeus_pointer_write(UINT8 which, UINT32 value); |
| 111 | static int zeus_fifo_process(const UINT32 *data, int numwords); | |
| 112 | static void zeus_draw_model(UINT32 baseaddr, UINT16 count, int logit); | |
| 110 | static int zeus_fifo_process(running_machine *machine, const UINT32 *data, int numwords); | |
| 111 | static void zeus_draw_model(running_machine *machine, UINT32 baseaddr, UINT16 count, int logit); | |
| 113 | 112 | static void zeus_draw_quad(const UINT32 *databuffer, UINT32 texoffs, int logit); |
| 114 | 113 | static void render_poly_8bit(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid); |
| 115 | 114 | |
| r2844 | r2845 | |
| 475 | 474 | offset != 0x50 && offset != 0x51 && offset != 0x57 && offset != 0x58 && offset != 0x59 && offset != 0x5a && offset != 0x5e); |
| 476 | 475 | if (logit) |
| 477 | 476 | logerror("%06X:zeus2_w", activecpu_get_pc()); |
| 478 | zeus_register32_w(offset, data, logit); | |
| 477 | zeus_register32_w(machine, offset, data, logit); | |
| 479 | 478 | } |
| 480 | 479 | |
| 481 | 480 | |
| r2844 | r2845 | |
| 486 | 485 | * |
| 487 | 486 | *************************************/ |
| 488 | 487 | |
| 489 | static void zeus_register32_w(offs_t offset, UINT32 data, int logit) | |
| 488 | static void zeus_register32_w(running_machine *machine, offs_t offset, UINT32 data, int logit) | |
| 490 | 489 | { |
| 491 | 490 | UINT32 oldval = zeusbase[offset]; |
| 492 | 491 | |
| r2844 | r2845 | |
| 521 | 520 | logerror("(%02X) = %08X\n", offset, data); |
| 522 | 521 | |
| 523 | 522 | /* handle the update */ |
| 524 | zeus_register_update(offset, oldval, logit); | |
| 523 | zeus_register_update(machine, offset, oldval, logit); | |
| 525 | 524 | } |
| 526 | 525 | |
| 527 | 526 | |
| r2844 | r2845 | |
| 532 | 531 | * |
| 533 | 532 | *************************************/ |
| 534 | 533 | |
| 535 | static void zeus_register_update(offs_t offset, UINT32 oldval, int logit) | |
| 534 | static void zeus_register_update(running_machine *machine, offs_t offset, UINT32 oldval, int logit) | |
| 536 | 535 | { |
| 537 | 536 | /* handle the writes; only trigger on low accesses */ |
| 538 | 537 | switch (offset) |
| 539 | 538 | { |
| 540 | 539 | case 0x08: |
| 541 | 540 | zeus_fifo[zeus_fifo_words++] = zeusbase[0x08]; |
| 542 | if (zeus_fifo_process(zeus_fifo, zeus_fifo_words)) | |
| 541 | if (zeus_fifo_process(machine, zeus_fifo, zeus_fifo_words)) | |
| 543 | 542 | zeus_fifo_words = 0; |
| 544 | 543 | |
| 545 | 544 | /* set the interrupt signal to indicate we can handle more */ |
| r2844 | r2845 | |
| 562 | 561 | case 0x35: |
| 563 | 562 | case 0x36: |
| 564 | 563 | case 0x37: |
| 565 | video_screen_update_partial( | |
| 564 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); | |
| 566 | 565 | { |
| 567 | 566 | int vtotal = zeusbase[0x37] & 0xffff; |
| 568 | 567 | int htotal = zeusbase[0x34] >> 16; |
| r2844 | r2845 | |
| 574 | 573 | visarea.max_y = zeusbase[0x35] & 0xffff; |
| 575 | 574 | if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) |
| 576 | 575 | { |
| 577 | video_screen_configure( | |
| 576 | video_screen_configure(machine->primary_screen, htotal, vtotal, &visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 4.0 / (htotal * vtotal))); | |
| 578 | 577 | zeus_cliprect = visarea; |
| 579 | 578 | zeus_cliprect.max_x -= zeus_cliprect.min_x; |
| 580 | 579 | zeus_cliprect.min_x = 0; |
| r2844 | r2845 | |
| 586 | 585 | { |
| 587 | 586 | UINT32 temp = zeusbase[0x38]; |
| 588 | 587 | zeusbase[0x38] = oldval; |
| 589 | video_screen_update_partial( | |
| 588 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); | |
| 590 | 589 | log_fifo = input_code_pressed(KEYCODE_L); |
| 591 | 590 | zeusbase[0x38] = temp; |
| 592 | 591 | } |
| r2844 | r2845 | |
| 778 | 777 | * |
| 779 | 778 | *************************************/ |
| 780 | 779 | |
| 781 | static int zeus_fifo_process(const UINT32 *data, int numwords) | |
| 780 | static int zeus_fifo_process(running_machine *machine, const UINT32 *data, int numwords) | |
| 782 | 781 | { |
| 783 | 782 | int dataoffs = 0; |
| 784 | 783 | |
| r2844 | r2845 | |
| 792 | 791 | if (log_fifo) |
| 793 | 792 | log_fifo_command(data, numwords, " -- reg32"); |
| 794 | 793 | if (((data[0] >> 16) & 0x7f) != 0x08) |
| 795 | zeus_register32_w((data[0] >> 16) & 0x7f, data[1], log_fifo); | |
| 794 | zeus_register32_w(machine, (data[0] >> 16) & 0x7f, data[1], log_fifo); | |
| 796 | 795 | break; |
| 797 | 796 | |
| 798 | 797 | /* 0x08: set matrix and point (thegrid) */ |
| r2844 | r2845 | |
| 891 | 890 | return FALSE; |
| 892 | 891 | if (log_fifo) |
| 893 | 892 | log_fifo_command(data, numwords, ""); |
| 894 | zeus_draw_model(data[1], data[0] & 0xffff, log_fifo); | |
| 893 | zeus_draw_model(machine, data[1], data[0] & 0xffff, log_fifo); | |
| 895 | 894 | break; |
| 896 | 895 | |
| 897 | 896 | /* 0x31: sync pipeline? (thegrid) */ |
| r2844 | r2845 | |
| 937 | 936 | * |
| 938 | 937 | *************************************/ |
| 939 | 938 | |
| 940 | static void zeus_draw_model(UINT32 baseaddr, UINT16 count, int logit) | |
| 939 | static void zeus_draw_model(running_machine *machine, UINT32 baseaddr, UINT16 count, int logit) | |
| 941 | 940 | { |
| 942 | 941 | UINT32 databuffer[32]; |
| 943 | 942 | int databufcount = 0; |
| r2844 | r2845 | |
| 1009 | 1008 | case 0x36: /* crusnexo */ |
| 1010 | 1009 | if (logit) |
| 1011 | 1010 | logerror("reg32"); |
| 1012 | zeus_register32_w((databuffer[0] >> 16) & 0x7f, databuffer[1], logit); | |
| 1011 | zeus_register32_w(machine, (databuffer[0] >> 16) & 0x7f, databuffer[1], logit); | |
| 1013 | 1012 | break; |
| 1014 | 1013 | |
| 1015 | 1014 | case 0x38: /* crusnexo/thegrid */ |
| r2844 | r2845 | |
|---|---|---|
| 14 | 14 | extern UINT16 *segaic16_rotateram_0; |
| 15 | 15 | |
| 16 | 16 | /* misc functions */ |
| 17 | void segaic16_set_display_enable(int enable); | |
| 17 | void segaic16_set_display_enable(running_machine *machine, int enable); | |
| 18 | 18 | |
| 19 | 19 | /* palette handling */ |
| 20 | 20 | void segaic16_palette_init(int entries); |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "deprecat.h" | |
| 11 | 10 | |
| 12 | 11 | |
| 13 | 12 | |
| r2844 | r2845 | |
| 137 | 136 | } |
| 138 | 137 | |
| 139 | 138 | |
| 140 | INLINE void changecolor_RRRRGGGGBBBBxxxx(int color,int indx) | |
| 139 | INLINE void changecolor_RRRRGGGGBBBBxxxx(running_machine *machine, int color,int indx) | |
| 141 | 140 | { |
| 142 | 141 | int data = paletteram[2*indx | 1] | (paletteram[2*indx] << 8); |
| 143 | palette_set_color_rgb( | |
| 142 | palette_set_color_rgb(machine,color,pal4bit(data >> 12),pal4bit(data >> 8),pal4bit(data >> 4)); | |
| 144 | 143 | } |
| 145 | 144 | |
| 146 | 145 | VIDEO_UPDATE( citycon ) |
| r2844 | r2845 | |
| 155 | 154 | int i; |
| 156 | 155 | |
| 157 | 156 | for (i = 0;i < 4;i++) |
| 158 | changecolor_RRRRGGGGBBBBxxxx(640 + 4*offs + i,512 + 4*indx + i); | |
| 157 | changecolor_RRRRGGGGBBBBxxxx(screen->machine, 640 + 4*offs + i,512 + 4*indx + i); | |
| 159 | 158 | } |
| 160 | 159 | |
| 161 | 160 |
| r2844 | r2845 | |
|---|---|---|
| 21 | 21 | ampkr2b3 clone American Poker II (bootleg, set 3). |
| 22 | 22 | pkrdewin clone Poker De Win. |
| 23 | 23 | ampkr95 clone American Poker 95. |
| 24 | videomat clone Videomat (polish bootleg). | |
| 24 | 25 | sigmapkr parent Sigma Poker. |
| 25 | 26 | sigma2k parent Sigma Poker 2000. |
| 26 | 27 |
| r2844 | r2845 | |
|---|---|---|
| 68 | 68 | static tilemap *esdtilemap_0; |
| 69 | 69 | static tilemap *esdtilemap_1; |
| 70 | 70 | tilemap *esdtilemap_1_16x16; |
| 71 | tilemap *esdtilemap_0_16x16; | |
| 71 | 72 | |
| 72 | 73 | static TILE_GET_INFO( get_tile_info_0 ) |
| 73 | 74 | { |
| r2844 | r2845 | |
| 79 | 80 | 0); |
| 80 | 81 | } |
| 81 | 82 | |
| 83 | static TILE_GET_INFO( get_tile_info_0_16x16 ) | |
| 84 | { | |
| 85 | UINT16 code = esd16_vram_0[tile_index]; | |
| 86 | SET_TILE_INFO( | |
| 87 | 2, | |
| 88 | code, | |
| 89 | esd16_tilemap0_color, | |
| 90 | 0); | |
| 91 | } | |
| 92 | ||
| 93 | ||
| 82 | 94 | static TILE_GET_INFO( get_tile_info_1 ) |
| 83 | 95 | { |
| 84 | 96 | UINT16 code = esd16_vram_1[tile_index]; |
| r2844 | r2845 | |
| 103 | 115 | { |
| 104 | 116 | COMBINE_DATA(&esd16_vram_0[offset]); |
| 105 | 117 | tilemap_mark_tile_dirty(esdtilemap_0,offset); |
| 118 | tilemap_mark_tile_dirty(esdtilemap_0_16x16,offset); | |
| 106 | 119 | } |
| 107 | 120 | |
| 108 | 121 | WRITE16_HANDLER( esd16_vram_1_w ) |
| r2844 | r2845 | |
| 138 | 151 | esdtilemap_1 = tilemap_create( get_tile_info_1, tilemap_scan_rows, |
| 139 | 152 | 8,8, 0x80,0x40); |
| 140 | 153 | |
| 154 | /* swatpolc changes tilemap 0 to 16x16 at various times */ | |
| 155 | esdtilemap_0_16x16 = tilemap_create( get_tile_info_0_16x16, tilemap_scan_rows, | |
| 156 | 16,16, 0x40,0x40); | |
| 157 | ||
| 141 | 158 | /* hedpanic changes tilemap 1 to 16x16 at various times */ |
| 142 | 159 | esdtilemap_1_16x16 = tilemap_create( get_tile_info_1_16x16, tilemap_scan_rows, |
| 143 | 160 | 16,16, 0x40,0x40); |
| 144 | 161 | |
| 145 | 162 | tilemap_set_scrolldx(esdtilemap_0, -0x60 + 2, -0x60 ); |
| 146 | 163 | tilemap_set_scrolldx(esdtilemap_1, -0x60 , -0x60 + 2 ); |
| 164 | tilemap_set_scrolldx(esdtilemap_0_16x16, -0x60 +2 , -0x60 ); | |
| 147 | 165 | tilemap_set_scrolldx(esdtilemap_1_16x16, -0x60 , -0x60 + 2 ); |
| 148 | 166 | |
| 149 | 167 | tilemap_set_transparent_pen(esdtilemap_1,0x00); |
| r2844 | r2845 | |
| 340 | 358 | |
| 341 | 359 | fillbitmap(priority_bitmap,0,cliprect); |
| 342 | 360 | |
| 343 | tilemap_set_scrollx(esdtilemap_0, 0, esd16_scroll_0[0]); | |
| 344 | tilemap_set_scrolly(esdtilemap_0, 0, esd16_scroll_0[1]); | |
| 345 | 361 | |
| 346 | 362 | #ifdef MAME_DEBUG |
| 347 | 363 | if ( input_code_pressed(KEYCODE_Z) ) |
| r2844 | r2845 | |
| 352 | 368 | if (msk != 0) layers_ctrl &= msk; } |
| 353 | 369 | #endif |
| 354 | 370 | |
| 355 | if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect,esdtilemap_0,0,0); | |
| 356 | else fillbitmap(bitmap,0,cliprect); | |
| 371 | if (layers_ctrl & 1) | |
| 372 | { | |
| 373 | if (head_layersize[0]&0x0001) | |
| 374 | { | |
| 375 | tilemap_set_scrollx(esdtilemap_0_16x16, 0, esd16_scroll_0[0]); | |
| 376 | tilemap_set_scrolly(esdtilemap_0_16x16, 0, esd16_scroll_0[1]); | |
| 377 | tilemap_draw(bitmap,cliprect,esdtilemap_0_16x16,0,0); | |
| 378 | } | |
| 379 | else | |
| 380 | { | |
| 381 | tilemap_set_scrollx(esdtilemap_0, 0, esd16_scroll_0[0]); | |
| 382 | tilemap_set_scrolly(esdtilemap_0, 0, esd16_scroll_0[1]); | |
| 383 | tilemap_draw(bitmap,cliprect,esdtilemap_0,0,0); | |
| 384 | } | |
| 385 | } | |
| 386 | else | |
| 387 | { | |
| 388 | fillbitmap(bitmap,0,cliprect); | |
| 389 | } | |
| 357 | 390 | |
| 391 | ||
| 358 | 392 | if (layers_ctrl & 2) |
| 359 | 393 | { |
| 360 | 394 | if (head_layersize[0]&0x0002) |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "deprecat.h" | |
| 11 | 10 | #include "namcos2.h" |
| 12 | 11 | #include "namcoic.h" |
| 13 | 12 | #include "namcos21.h" |
| r2844 | r2845 | |
| 140 | 139 | } /* VIDEO_START( namcos21 ) */ |
| 141 | 140 | |
| 142 | 141 | static void |
| 143 | update_palette( | |
| 142 | update_palette( running_machine *machine ) | |
| 144 | 143 | { |
| 145 | 144 | int i; |
| 146 | 145 | INT16 data1,data2; |
| r2844 | r2845 | |
| 172 | 171 | g = data1&0xff; |
| 173 | 172 | b = data2&0xff; |
| 174 | 173 | |
| 175 | palette_set_color( | |
| 174 | palette_set_color( machine,i, MAKE_RGB(r,g,b) ); | |
| 176 | 175 | } |
| 177 | 176 | } /* update_palette */ |
| 178 | 177 | |
| r2844 | r2845 | |
| 181 | 180 | { |
| 182 | 181 | int pivot = 3; |
| 183 | 182 | int pri; |
| 184 | update_palette(); | |
| 183 | update_palette(screen->machine); | |
| 185 | 184 | fillbitmap( bitmap, 0xff, cliprect ); |
| 186 | 185 | |
| 187 | 186 | if( namcos2_gametype != NAMCOS21_WINRUN91 ) |
| r2844 | r2845 | |
|---|---|---|
| 3 | 3 | #include "video/rgbutil.h" |
| 4 | 4 | #include "eminline.h" |
| 5 | 5 | #include <math.h> |
| 6 | #include "includes/model3.h" | |
| 6 | 7 | |
| 7 | 8 | |
| 8 | 9 | #define pz p[0] |
| r2844 | r2845 | |
| 75 | 76 | |
| 76 | 77 | /*****************************************************************************/ |
| 77 | 78 | |
| 78 | /* in drivers/model3.c */ | |
| 79 | void model3_set_irq_line(running_machine *machine, UINT8 bit, int state); | |
| 80 | ||
| 81 | extern int model3_step; | |
| 82 | ||
| 83 | extern UINT32 *model3_vrom; | |
| 84 | ||
| 85 | 79 | UINT64 *paletteram64; |
| 86 | 80 | |
| 87 | 81 | static UINT8 model3_layer_enable = 0; |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "deprecat.h" | |
| 11 | 10 | #include "machine/6522via.h" |
| 12 | 11 | #include "gameplan.h" |
| 13 | 12 | |
| r2844 | r2845 | |
| 280 | 279 | } |
| 281 | 280 | |
| 282 | 281 | |
| 283 | static void start_via_0_timer(gameplan_state *state) | |
| 282 | static void start_via_0_timer(running_machine *machine, gameplan_state *state) | |
| 284 | 283 | { |
| 285 | timer_adjust_oneshot(state->via_0_ca1_timer, video_screen_get_time_until_pos( | |
| 284 | timer_adjust_oneshot(state->via_0_ca1_timer, video_screen_get_time_until_pos(machine->primary_screen, VBSTART, 0), 0); | |
| 286 | 285 | } |
| 287 | 286 | |
| 288 | 287 | |
| r2844 | r2845 | |
| 345 | 344 | static VIDEO_RESET( gameplan ) |
| 346 | 345 | { |
| 347 | 346 | via_reset(); |
| 348 | start_via_0_timer(machine->driver_data); | |
| 347 | start_via_0_timer(machine, machine->driver_data); | |
| 349 | 348 | } |
| 350 | 349 | |
| 351 | 350 |
| r2844 | r2845 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | VIDEO_START( funkyjet ) |
| 13 | 13 | { |
| 14 | deco16_1_video_init(); | |
| 14 | deco16_1_video_init(machine); | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| r2844 | r2845 | |
|---|---|---|
| 139 | 139 | static void build_rle_tables(void); |
| 140 | 140 | static int count_objects(const UINT16 *base, int length); |
| 141 | 141 | static void prescan_rle(const atarirle_data *mo, int which); |
| 142 | static void sort_and_render(atarirle_data *mo); | |
| 142 | static void sort_and_render(running_machine *machine, atarirle_data *mo); | |
| 143 | 143 | static void compute_checksum(atarirle_data *mo); |
| 144 | 144 | static void draw_rle(atarirle_data *mo, bitmap_t *bitmap, int code, int color, int hflip, int vflip, |
| 145 | 145 | int x, int y, int xscale, int yscale, const rectangle *clip); |
| r2844 | r2845 | |
| 269 | 269 | the attribute lookup table. |
| 270 | 270 | ---------------------------------------------------------------*/ |
| 271 | 271 | |
| 272 | void atarirle_init(int map, const atarirle_desc *desc) | |
| 272 | void atarirle_init(running_machine *machine, int map, const atarirle_desc *desc) | |
| 273 | 273 | { |
| 274 | 274 | const UINT16 *base = (const UINT16 *)memory_region(desc->region); |
| 275 | 275 | atarirle_data *mo = &atarirle[map]; |
| r2844 | r2845 | |
| 308 | 308 | mo->romlength = memory_region_length(desc->region); |
| 309 | 309 | mo->objectcount = count_objects(base, mo->romlength); |
| 310 | 310 | |
| 311 | mo->cliprect = *video_screen_get_visible_area( | |
| 311 | mo->cliprect = *video_screen_get_visible_area(machine->primary_screen); | |
| 312 | 312 | if (desc->rightclip) |
| 313 | 313 | { |
| 314 | 314 | mo->cliprect.min_x = desc->leftclip; |
| r2844 | r2845 | |
| 341 | 341 | memset(mo->spriteram, 0, sizeof(mo->spriteram[0]) * mo->spriteramsize); |
| 342 | 342 | |
| 343 | 343 | /* allocate bitmaps */ |
| 344 | width = video_screen_get_width(Machine->primary_screen); | |
| 345 | height = video_screen_get_height(Machine->primary_screen); | |
| 344 | width = video_screen_get_width(machine->primary_screen); | |
| 345 | height = video_screen_get_height(machine->primary_screen); | |
| 346 | 346 | |
| 347 | 347 | mo->vram[0][0] = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); |
| 348 | 348 | mo->vram[0][1] = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); |
| r2844 | r2845 | |
| 382 | 382 | atarirle_control_w: Write handler for MO control bits. |
| 383 | 383 | ---------------------------------------------------------------*/ |
| 384 | 384 | |
| 385 | void atarirle_control_w(int map, UINT8 bits) | |
| 385 | void atarirle_control_w(running_machine *machine, int map, UINT8 bits) | |
| 386 | 386 | { |
| 387 | 387 | atarirle_data *mo = &atarirle[map]; |
| 388 | int scanline = video_screen_get_vpos( | |
| 388 | int scanline = video_screen_get_vpos(machine->primary_screen); | |
| 389 | 389 | int oldbits = mo->control_bits; |
| 390 | 390 | |
| 391 | 391 | //logerror("atarirle_control_w(%d)\n", bits); |
| r2844 | r2845 | |
| 395 | 395 | return; |
| 396 | 396 | |
| 397 | 397 | /* force a partial update first */ |
| 398 | video_screen_update_partial( | |
| 398 | video_screen_update_partial(machine->primary_screen, scanline); | |
| 399 | 399 | |
| 400 | 400 | /* if the erase flag was set, erase the front map */ |
| 401 | 401 | if (oldbits & ATARIRLE_CONTROL_ERASE) |
| r2844 | r2845 | |
| 423 | 423 | if (!(oldbits & ATARIRLE_CONTROL_MOGO) && (bits & ATARIRLE_CONTROL_MOGO)) |
| 424 | 424 | { |
| 425 | 425 | if (mo->command == ATARIRLE_COMMAND_DRAW) |
| 426 | sort_and_render(mo); | |
| 426 | sort_and_render(machine, mo); | |
| 427 | 427 | else if (mo->command == ATARIRLE_COMMAND_CHECKSUM) |
| 428 | 428 | compute_checksum(mo); |
| 429 | 429 | } |
| r2844 | r2845 | |
| 435 | 435 | |
| 436 | 436 | |
| 437 | 437 | /*--------------------------------------------------------------- |
| 438 | atarirle_con | |
| 438 | atarirle_command | |
| 439 | 439 | ---------------------------------------------------------------*/ |
| 440 | 440 | |
| 441 | 441 | void atarirle_command_w(int map, UINT8 command) |
| r2844 | r2845 | |
| 734 | 734 | sort_and_render: Render all motion objects in order. |
| 735 | 735 | ---------------------------------------------------------------*/ |
| 736 | 736 | |
| 737 | static void sort_and_render(atarirle_data *mo) | |
| 737 | static void sort_and_render(running_machine *machine, atarirle_data *mo) | |
| 738 | 738 | { |
| 739 | 739 | bitmap_t *bitmap1 = mo->vram[0][(~mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2]; |
| 740 | 740 | bitmap_t *bitmap2 = mo->vram[1][(~mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2]; |
| r2844 | r2845 | |
| 843 | 843 | |
| 844 | 844 | do |
| 845 | 845 | { |
| 846 | const rectangle *visarea = video_screen_get_visible_area( | |
| 846 | const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen); | |
| 847 | 847 | int scaled_width = (scale * info->width + 0x7fff) >> 12; |
| 848 | 848 | int scaled_height = (scale * info->height + 0x7fff) >> 12; |
| 849 | 849 | int dx, dy, ex, ey, sx = x, sy = y, tx, ty; |
| r2844 | r2845 | |
| 884 | 884 | |
| 885 | 885 | for (ty = sy; ty <= ey; ty++) |
| 886 | 886 | { |
| 887 | *BITMAP_ADDR16(bitmap1, ty, sx) = mame_rand(Machine) & 0xff; | |
| 888 | *BITMAP_ADDR16(bitmap1, ty, ex) = mame_rand(Machine) & 0xff; | |
| 887 | *BITMAP_ADDR16(bitmap1, ty, sx) = mame_rand(machine) & 0xff; | |
| 888 | *BITMAP_ADDR16(bitmap1, ty, ex) = mame_rand(machine) & 0xff; | |
| 889 | 889 | } |
| 890 | 890 | for (tx = sx; tx <= ex; tx++) |
| 891 | 891 | { |
| 892 | *BITMAP_ADDR16(bitmap1, sy, tx) = mame_rand(Machine) & 0xff; | |
| 893 | *BITMAP_ADDR16(bitmap1, ey, tx) = mame_rand(Machine) & 0xff; | |
| 892 | *BITMAP_ADDR16(bitmap1, sy, tx) = mame_rand(machine) & 0xff; | |
| 893 | *BITMAP_ADDR16(bitmap1, ey, tx) = mame_rand(machine) & 0xff; | |
| 894 | 894 | } |
| 895 | 895 | } while (0); |
| 896 | 896 | fprintf(stderr, " Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n", |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | ****************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | #include "deprecat.h" | |
| 9 | 8 | #include "machine/atarigen.h" |
| 10 | 9 | #include "includes/skullxbo.h" |
| 11 | 10 | |
| r2844 | r2845 | |
| 183 | 182 | * |
| 184 | 183 | *************************************/ |
| 185 | 184 | |
| 186 | void skullxbo_scanline_update(int scanline) | |
| 185 | void skullxbo_scanline_update(running_machine *machine, int scanline) | |
| 187 | 186 | { |
| 188 | 187 | UINT16 *base = &atarigen_alpha[(scanline / 8) * 64 + 42]; |
| 189 | 188 | int x; |
| r2844 | r2845 | |
| 214 | 213 | |
| 215 | 214 | /* force a partial update with the previous scroll */ |
| 216 | 215 | if (scanline > 0) |
| 217 | video_screen_update_partial( | |
| 216 | video_screen_update_partial(machine->primary_screen, scanline - 1); | |
| 218 | 217 | |
| 219 | 218 | /* update the new scroll */ |
| 220 | 219 | tilemap_set_scrolly(atarigen_playfield_tilemap, 0, newscroll); |
| r2844 | r2845 | |
|---|---|---|
| 74 | 74 | ***************************************************************************/ |
| 75 | 75 | |
| 76 | 76 | /* setup/shutdown */ |
| 77 | void atarirle_init(int map, const atarirle_desc *desc); | |
| 77 | void atarirle_init(running_machine *machine, int map, const atarirle_desc *desc); | |
| 78 | 78 | |
| 79 | 79 | /* control handlers */ |
| 80 | void atarirle_control_w(int map, UINT8 bits); | |
| 80 | void atarirle_control_w(running_machine *machine, int map, UINT8 bits); | |
| 81 | 81 | void atarirle_command_w(int map, UINT8 command); |
| 82 | 82 | VIDEO_EOF( atarirle ); |
| 83 | 83 |
| r2844 | r2845 | |
|---|---|---|
| 145 | 145 | ***************************************************************************/ |
| 146 | 146 | |
| 147 | 147 | #include "driver.h" |
| 148 | #include "deprecat.h" | |
| 149 | 148 | #include "cpu/m68000/m68000.h" |
| 150 | 149 | |
| 151 | 150 | |
| r2844 | r2845 | |
| 836 | 835 | } |
| 837 | 836 | |
| 838 | 837 | |
| 839 | static void toaplan2_scroll_reg_data_w(offs_t offset, UINT16 data, UINT32 mem_mask, int controller) | |
| 838 | static void toaplan2_scroll_reg_data_w(running_machine *machine, offs_t offset, UINT16 data, UINT32 mem_mask, int controller) | |
| 840 | 839 | { |
| 841 | 840 | /************************************************************************/ |
| 842 | 841 | /***** layer X and Y flips can be set independantly, so emulate it ******/ |
| r2844 | r2845 | |
| 951 | 950 | if ((toaplan2_sub_cpu == CPU_2_Z80) && (data == 3)) |
| 952 | 951 | { |
| 953 | 952 | /* HACK! When tilted, sound CPU needs to be reset. */ |
| 954 | if ( | |
| 953 | if (machine->config->sound[0].type == SOUND_YM3812) | |
| 955 | 954 | { |
| 956 | cpunum_set_input_line( | |
| 955 | cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, PULSE_LINE); | |
| 957 | 956 | sndti_reset(SOUND_YM3812, 0); |
| 958 | 957 | } |
| 959 | 958 | } |
| r2844 | r2845 | |
| 1031 | 1030 | |
| 1032 | 1031 | WRITE16_HANDLER( toaplan2_0_scroll_reg_data_w ) |
| 1033 | 1032 | { |
| 1034 | toaplan2_scroll_reg_data_w(offset, data, mem_mask, 0); | |
| 1033 | toaplan2_scroll_reg_data_w(machine, offset, data, mem_mask, 0); | |
| 1035 | 1034 | } |
| 1036 | 1035 | |
| 1037 | 1036 | WRITE16_HANDLER( toaplan2_1_scroll_reg_data_w ) |
| 1038 | 1037 | { |
| 1039 | toaplan2_scroll_reg_data_w(offset, data, mem_mask, 1); | |
| 1038 | toaplan2_scroll_reg_data_w(machine, offset, data, mem_mask, 1); | |
| 1040 | 1039 | } |
| 1041 | 1040 | |
| 1042 | 1041 | |
| r2844 | r2845 | |
| 1061 | 1060 | } |
| 1062 | 1061 | |
| 1063 | 1062 | toaplan2_scroll_reg[0] = offset; |
| 1064 | toaplan2_scroll_reg_data_w(offset, data, mem_mask, 0); | |
| 1063 | toaplan2_scroll_reg_data_w(machine, offset, data, mem_mask, 0); | |
| 1065 | 1064 | } |
| 1066 | 1065 | } |
| 1067 | 1066 | |
| r2844 | r2845 | |
| 1256 | 1255 | Sprite Handlers |
| 1257 | 1256 | ***************************************************************************/ |
| 1258 | 1257 | |
| 1259 | static void draw_sprites( bitmap_t *bitmap, const rectangle *cliprect, int controller, int priority_to_display, int bank_sel ) | |
| 1258 | static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int controller, int priority_to_display, int bank_sel ) | |
| 1260 | 1259 | { |
| 1261 | const gfx_element *gfx = | |
| 1260 | const gfx_element *gfx = machine->gfx[ ((controller*2)+1) ]; | |
| 1262 | 1261 | |
| 1263 | 1262 | int offs; |
| 1264 | 1263 | |
| r2844 | r2845 | |
| 1439 | 1438 | if (fg_tile_priority[0][priority]) tilemap_draw(bitmap,cliprect,fg_tilemap[0],priority,0); |
| 1440 | 1439 | if (top_tile_priority[0][priority]) tilemap_draw(bitmap,cliprect,top_tilemap[0],priority,0); |
| 1441 | 1440 | if (sprite_priority[0][priority]) |
| 1442 | draw_sprites(bitmap,cliprect,0,priority,0); | |
| 1441 | draw_sprites(screen->machine,bitmap,cliprect,0,priority,0); | |
| 1443 | 1442 | } |
| 1444 | 1443 | return 0; |
| 1445 | 1444 | } |
| r2844 | r2845 | |
| 1466 | 1465 | if (fg_tile_priority[1][priority]) tilemap_draw(bitmap,cliprect,fg_tilemap[1],priority,0); |
| 1467 | 1466 | if (top_tile_priority[1][priority]) tilemap_draw(bitmap,cliprect,top_tilemap[1],priority,0); |
| 1468 | 1467 | if (sprite_priority[1][priority]) |
| 1469 | draw_sprites(bitmap,cliprect,1,priority,0); | |
| 1468 | draw_sprites(screen->machine,bitmap,cliprect,1,priority,0); | |
| 1470 | 1469 | } |
| 1471 | 1470 | for (priority = 0; priority < 16; priority++) |
| 1472 | 1471 | { |
| r2844 | r2845 | |
| 1474 | 1473 | if (fg_tile_priority[0][priority]) tilemap_draw(bitmap,cliprect,fg_tilemap[0],priority,0); |
| 1475 | 1474 | if (top_tile_priority[0][priority]) tilemap_draw(bitmap,cliprect,top_tilemap[0],priority,0); |
| 1476 | 1475 | if (sprite_priority[0][priority]) |
| 1477 | draw_sprites(bitmap,cliprect,0,priority,0); | |
| 1476 | draw_sprites(screen->machine,bitmap,cliprect,0,priority,0); | |
| 1478 | 1477 | } |
| 1479 | 1478 | return 0; |
| 1480 | 1479 | } |
| r2844 | r2845 | |
| 1503 | 1502 | if (fg_tile_priority[1][priority]) tilemap_draw(bitmap,cliprect,fg_tilemap[1],priority,0); |
| 1504 | 1503 | if (top_tile_priority[0][priority]) tilemap_draw(bitmap,cliprect,top_tilemap[0],priority,0); |
| 1505 | 1504 | if (sprite_priority[0][priority]) |
| 1506 | draw_sprites(bitmap,cliprect,0,priority,0); | |
| 1505 | draw_sprites(screen->machine,bitmap,cliprect,0,priority,0); | |
| 1507 | 1506 | } |
| 1508 | 1507 | |
| 1509 | 1508 | for (priority = 0; priority < 16; priority++) |
| 1510 | 1509 | { |
| 1511 | 1510 | if (top_tile_priority[1][priority]) tilemap_draw(bitmap,cliprect,top_tilemap[1],priority,0); |
| 1512 | 1511 | if (sprite_priority[1][priority]) |
| 1513 | draw_sprites(bitmap,cliprect,1,priority,0); | |
| 1512 | draw_sprites(screen->machine,bitmap,cliprect,1,priority,0); | |
| 1514 | 1513 | } |
| 1515 | 1514 | |
| 1516 | 1515 | return 0; |
| r2844 | r2845 | |
| 1555 | 1554 | if (fg_tile_priority[0][priority]) tilemap_draw(bitmap,cliprect,fg_tilemap[0],priority,0); |
| 1556 | 1555 | if (top_tile_priority[0][priority]) tilemap_draw(bitmap,cliprect,top_tilemap[0],priority,0); |
| 1557 | 1556 | if (sprite_priority[0][priority]) |
| 1558 | draw_sprites(bitmap,cliprect,0,priority,1); /* consider bank select */ | |
| 1557 | draw_sprites(screen->machine,bitmap,cliprect,0,priority,1); /* consider bank select */ | |
| 1559 | 1558 | } |
| 1560 | 1559 | |
| 1561 | 1560 | clip.min_x = visarea->min_x; |
| r2844 | r2845 | |
| 1597 | 1596 | if (fg_tile_priority[0][priority]) tilemap_draw(bitmap,cliprect,fg_tilemap[0],priority,0); |
| 1598 | 1597 | if (top_tile_priority[0][priority]) tilemap_draw(bitmap,cliprect,top_tilemap[0],priority,0); |
| 1599 | 1598 | if (sprite_priority[0][priority-1]) |
| 1600 | draw_sprites(bitmap,cliprect,0,priority-1,0); | |
| 1599 | draw_sprites(screen->machine,bitmap,cliprect,0,priority-1,0); | |
| 1601 | 1600 | } |
| 1602 | 1601 | if (sprite_priority[0][15]) |
| 1603 | draw_sprites(bitmap,cliprect,0,15,0); | |
| 1602 | draw_sprites(screen->machine,bitmap,cliprect,0,15,0); | |
| 1604 | 1603 | tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); |
| 1605 | 1604 | return 0; |
| 1606 | 1605 | } |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ******************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "deprecat.h" | |
| 11 | 10 | #include "nb1413m3.h" |
| 12 | 11 | |
| 13 | 12 | |
| r2844 | r2845 | |
| 24 | 23 | static UINT8 *pastelg_clut; |
| 25 | 24 | |
| 26 | 25 | |
| 27 | static void pastelg_vramflip(void); | |
| 28 | static void pastelg_gfxdraw(void); | |
| 26 | static void pastelg_vramflip(running_machine *machine); | |
| 27 | static void pastelg_gfxdraw(running_machine *machine); | |
| 29 | 28 | |
| 30 | 29 | |
| 31 | 30 | /****************************************************************************** |
| r2844 | r2845 | |
| 85 | 84 | case 4: blitter_sizex = data; break; |
| 86 | 85 | case 5: blitter_sizey = data; |
| 87 | 86 | /* writing here also starts the blit */ |
| 88 | pastelg_gfxdraw(); | |
| 87 | pastelg_gfxdraw(machine); | |
| 89 | 88 | break; |
| 90 | 89 | case 6: blitter_direction_x = (data & 0x01) ? 1 : 0; |
| 91 | 90 | blitter_direction_y = (data & 0x02) ? 1 : 0; |
| 92 | 91 | pastelg_flipscreen = (data & 0x04) ? 0 : 1; |
| 93 | 92 | pastelg_dispflag = (data & 0x08) ? 0 : 1; |
| 94 | pastelg_vramflip(); | |
| 93 | pastelg_vramflip(machine); | |
| 95 | 94 | break; |
| 96 | 95 | } |
| 97 | 96 | } |
| r2844 | r2845 | |
| 116 | 115 | |
| 117 | 116 | |
| 118 | 117 | ******************************************************************************/ |
| 119 | static void pastelg_vramflip( | |
| 118 | static void pastelg_vramflip(running_machine *machine) | |
| 120 | 119 | { |
| 121 | 120 | static int pastelg_flipscreen_old = 0; |
| 122 | 121 | int x, y; |
| 123 | 122 | UINT8 color1, color2; |
| 124 | int width = video_screen_get_width(Machine->primary_screen); | |
| 125 | int height = video_screen_get_height(Machine->primary_screen); | |
| 123 | int width = video_screen_get_width(machine->primary_screen); | |
| 124 | int height = video_screen_get_height(machine->primary_screen); | |
| 126 | 125 | |
| 127 | 126 | if (pastelg_flipscreen == pastelg_flipscreen_old) return; |
| 128 | 127 | |
| r2844 | r2845 | |
| 145 | 144 | nb1413m3_busyflag = 1; |
| 146 | 145 | } |
| 147 | 146 | |
| 148 | static void pastelg_gfxdraw( | |
| 147 | static void pastelg_gfxdraw(running_machine *machine) | |
| 149 | 148 | { |
| 150 | 149 | UINT8 *GFX = memory_region(REGION_GFX1); |
| 151 | int width = video_screen_get_width( | |
| 150 | int width = video_screen_get_width(machine->primary_screen); | |
| 152 | 151 | |
| 153 | 152 | int x, y; |
| 154 | 153 | int dx, dy; |
| r2844 | r2845 | |
|---|---|---|
| 89 | 89 | |
| 90 | 90 | VIDEO_START( funkybee ) |
| 91 | 91 | { |
| 92 | bg_tilemap = tilemap_create(get_bg_tile_info, funkybee_tilemap_scan, | |
| 93 | 8, 8, 32, 32); | |
| 92 | bg_tilemap = tilemap_create(get_bg_tile_info, funkybee_tilemap_scan, 8, 8, 32, 32); | |
| 94 | 93 | } |
| 95 | 94 | |
| 96 | 95 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| r2844 | r2845 | |
| 128 | 127 | |
| 129 | 128 | for (offs = 0x1f;offs >= 0;offs--) |
| 130 | 129 | { |
| 130 | int const flip = flip_screen_get(); | |
| 131 | 131 | int code = videoram[0x1c00 + offs]; |
| 132 | 132 | int color = colorram[0x1f10] & 0x03; |
| 133 | int sx = videoram[0x1f10]; | |
| 133 | int sx = flip ? videoram[0x1f1f] : videoram[0x1f10]; | |
| 134 | 134 | int sy = offs * 8; |
| 135 | 135 | |
| 136 | if (flip_screen_get()) | |
| 137 | { | |
| 138 | sx = 248 - sx; | |
| 136 | if (flip) | |
| 139 | 137 | sy = 248 - sy; |
| 140 | } | |
| 141 | 138 | |
| 142 | 139 | drawgfx(bitmap,machine->gfx[gfx_bank], |
| 143 | 140 | code, color, |
| 144 | flip | |
| 141 | flip | |
| 145 | 142 | sx, sy, |
| 146 | 143 | cliprect,TRANSPARENCY_PEN,0); |
| 147 | 144 | |
| 148 | 145 | code = videoram[0x1d00 + offs]; |
| 149 | 146 | color = colorram[0x1f11] & 0x03; |
| 150 | sx = videoram[0x1f11]; | |
| 147 | sx = flip ? videoram[0x1f1e] : videoram[0x1f11]; | |
| 151 | 148 | sy = offs * 8; |
| 152 | 149 | |
| 153 | if (flip_screen_get()) | |
| 154 | { | |
| 155 | sx = 248 - sx; | |
| 150 | if (flip) | |
| 156 | 151 | sy = 248 - sy; |
| 157 | } | |
| 158 | 152 | |
| 159 | 153 | drawgfx(bitmap,machine->gfx[gfx_bank], |
| 160 | 154 | code, color, |
| 161 | flip | |
| 155 | flip | |
| 162 | 156 | sx, sy, |
| 163 | 157 | cliprect,TRANSPARENCY_PEN,0); |
| 164 | 158 | } |
| r2844 | r2845 | |
| 166 | 160 | |
| 167 | 161 | VIDEO_UPDATE( funkybee ) |
| 168 | 162 | { |
| 169 | tilemap_mark_all_tiles_dirty(bg_tilemap); | |
| 170 | ||
| 171 | 163 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); |
| 172 | 164 | draw_sprites(screen->machine, bitmap, cliprect); |
| 173 | 165 | draw_columns(screen->machine, bitmap, cliprect); |
| r2844 | r2845 | |
|---|---|---|
| 185 | 185 | static int read_shift(running_machine *machine) |
| 186 | 186 | { |
| 187 | 187 | static int ret = 1; /* start with low shift */ |
| 188 | switch ( (input_port_read | |
| 188 | switch ( (input_port_read | |
| 189 | 189 | { |
| 190 | 190 | case 1 : ret = 1; break; // low shift: button 3 |
| 191 | 191 | case 2 : ret = 0; break; // high shift: button 4 |
| r2844 | r2845 | |
| 205 | 205 | |
| 206 | 206 | static int read_accelerator(running_machine *machine) |
| 207 | 207 | { |
| 208 | if (input_port_read | |
| 208 | if (input_port_read | |
| 209 | 209 | else return 0xff; |
| 210 | 210 | } |
| 211 | 211 | |
| r2844 | r2845 | |
| 218 | 218 | { |
| 219 | 219 | switch (offset) |
| 220 | 220 | { |
| 221 | case 0x0000/2 : return input_port_read_indexed(machine, 1); // Coins | |
| 222 | case 0x0002/2 : return input_port_read_indexed(machine, 2) + | |
| 221 | case 0x0000/2 : return input_port_read(machine, "IN1"); // Coins | |
| 222 | case 0x0002/2 : return input_port_read(machine, "IN2") + | |
| 223 | 223 | (read_shift(machine)<<1); // Buttons |
| 224 | case 0x0004/2 : return input_port_read_indexed(machine, 3); // Motor Limit Switches | |
| 225 | case 0x0006/2 : return input_port_read_indexed(machine, 4); // DSW 1 & 2 | |
| 224 | case 0x0004/2 : return input_port_read(machine, "IN3"); // Motor Limit Switches | |
| 225 | case 0x0006/2 : return input_port_read(machine, "IN4"); // DSW 1 & 2 | |
| 226 | 226 | |
| 227 | 227 | case 0x0008/2 : return soundlatch2_word_r(machine,0,0xffff); // From sound cpu |
| 228 | 228 | |
| 229 | 229 | case 0x0010/2 : |
| 230 | 230 | switch (cischeat_ip_select & 0x3) |
| 231 | 231 | { |
| 232 | case 0 : return input_port_read | |
| 232 | case 0 : return input_port_read | |
| 233 | 233 | case 1 : return 0xffff; // Cockpit: Up / Down Position |
| 234 | 234 | case 2 : return 0xffff; // Cockpit: Left / Right Position? |
| 235 | 235 | case 3 : return ~read_accelerator(machine); // Accelerator (Pedal) |
| r2844 | r2845 | |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
| 240 | case 0x2200/2 : return input_port_read | |
| 240 | case 0x2200/2 : return input_port_read | |
| 241 | 241 | |
| 242 | 242 | default: SHOW_READ_ERROR("vreg %04X read!",offset*2); |
| 243 | 243 | return megasys1_vregs[offset]; |
| r2844 | r2845 | |
| 315 | 315 | { |
| 316 | 316 | switch (offset) |
| 317 | 317 | { |
| 318 | case 0x0000/2 : return input_port_read_indexed(machine, 1); // Coins | |
| 319 | case 0x0002/2 : return input_port_read_indexed(machine, 2) + | |
| 318 | case 0x0000/2 : return input_port_read(machine, "IN1"); // Coins | |
| 319 | case 0x0002/2 : return input_port_read(machine, "IN2") + | |
| 320 | 320 | (read_shift(machine)<<1); // Buttons |
| 321 | case 0x0004/2 : return input_port_read_indexed(machine, 3); // Motor Limit Switches | |
| 322 | case 0x0006/2 : return input_port_read_indexed(machine, 4); // DSW 1 & 2 | |
| 321 | case 0x0004/2 : return input_port_read(machine, "IN3"); // Motor Limit Switches | |
| 322 | case 0x0006/2 : return input_port_read(machine, "IN4"); // DSW 1 & 2 | |
| 323 | 323 | |
| 324 | 324 | case 0x0010/2 : |
| 325 | 325 | switch (cischeat_ip_select & 0x3) |
| 326 | 326 | { |
| 327 | case 0 : return input_port_read | |
| 327 | case 0 : return input_port_read | |
| 328 | 328 | case 1 : return ~0; // Cockpit: Up / Down Position? |
| 329 | 329 | case 2 : return ~0; // Cockpit: Left / Right Position? |
| 330 | 330 | default: return ~0; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | case 0x2200/2 : return input_port_read | |
| 333 | case 0x2200/2 : return input_port_read | |
| 334 | 334 | case 0x2300/2 : return soundlatch2_r(machine,0); // From sound cpu |
| 335 | 335 | |
| 336 | 336 | default: SHOW_READ_ERROR("vreg %04X read!",offset*2); |
| r2844 | r2845 | |
| 411 | 411 | { |
| 412 | 412 | case 0x0000/2 : // DSW 1&2: coinage changes with Country |
| 413 | 413 | { |
| 414 | int val = input_port_read_indexed(machine, 1); | |
| 415 | if (val & 0x0200) return input_port_read_indexed(machine, 6) | val; // JP, US | |
| 416 | else return input_port_read_indexed(machine, 7) | val; // UK, FR | |
| 414 | int val = input_port_read(machine, "IN1"); | |
| 415 | if (val & 0x0200) return input_port_read(machine, "IN6") | val; // JP, US | |
| 416 | else return input_port_read(machine, "IN7") | val; // UK, FR | |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | // case 0x0002/2 : return 0xFFFF; |
| 420 | case 0x0004/2 : return input_port_read | |
| 420 | case 0x0004/2 : return input_port_read | |
| 421 | 421 | (read_shift(machine)<<5); // Buttons |
| 422 | 422 | |
| 423 | case 0x0006/2 : return input_port_read | |
| 423 | case 0x0006/2 : return input_port_read | |
| 424 | 424 | case 0x0008/2 : return soundlatch2_r(machine,0); // From sound cpu |
| 425 | 425 | |
| 426 | case 0x000c/2 : return input_port_read | |
| 426 | case 0x000c/2 : return input_port_read | |
| 427 | 427 | |
| 428 | 428 | case 0x0010/2 : // Accel + Driving Wheel |
| 429 | return (read_accelerator(machine)&0xff) + ((input_port_read | |
| 429 | return (read_accelerator(machine) & 0xff) + ((input_port_read | |
| 430 | 430 | |
| 431 | 431 | default: SHOW_READ_ERROR("vreg %04X read!",offset*2); |
| 432 | 432 | return megasys1_vregs[offset]; |
| r2844 | r2845 | |
| 459 | 459 | |
| 460 | 460 | switch (offset) |
| 461 | 461 | { |
| 462 | case 0x0000/2 : return input_port_read | |
| 462 | case 0x0000/2 : return input_port_read | |
| 463 | 463 | |
| 464 | case 0x0004/2 : return input_port_read | |
| 464 | case 0x0004/2 : return input_port_read | |
| 465 | 465 | |
| 466 | 466 | case 0x0008/2 : return soundlatch2_r(machine,0); // From sound cpu |
| 467 | 467 | |
| 468 | 468 | case 0x0010/2 : // X, Y |
| 469 | return input_port_read | |
| 469 | return input_port_read | |
| 470 | 470 | |
| 471 | 471 | case 0x0018/2 : |
| 472 | 472 | return (f1gpstr2_ioready[0]&1) ? 0xff : 0xf0; |
| r2844 | r2845 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | static rgb_t palette[64]; |
| 23 | 23 | |
| 24 | #define TOTAL_COLORS(gfxn) (Machine->gfx[gfxn]->total_colors * Machine->gfx[gfxn]->color_granularity) | |
| 25 | #define COLOR(gfxn,offs) (Machine->config->gfxdecodeinfo[gfxn].color_codes_start + offs) | |
| 24 | #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity) | |
| 25 | #define COLOR(gfxn,offs) (machine->config->gfxdecodeinfo[gfxn].color_codes_start + offs) | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 |
| r2844 | r2845 | |
|---|---|---|
| 102 | 102 | bg_tilemap = tilemap_create(warlords_get_tile_info, tilemap_scan_rows, 8,8, 32,32); |
| 103 | 103 | |
| 104 | 104 | /* we overload centiped_flipscreen here to track the cocktail/upright state */ |
| 105 | centiped_flipscreen = input_port_read | |
| 105 | centiped_flipscreen = input_port_read | |
| 106 | 106 | tilemap_set_flip(bg_tilemap, centiped_flipscreen ? TILEMAP_FLIPX : 0); |
| 107 | 107 | } |
| 108 | 108 | |
| r2844 | r2845 | |
| 442 | 442 | |
| 443 | 443 | VIDEO_UPDATE( warlords ) |
| 444 | 444 | { |
| 445 | int upright_mode = input_port_read | |
| 445 | int upright_mode = input_port_read | |
| 446 | 446 | int offs; |
| 447 | 447 | |
| 448 | 448 | /* if the cocktail/upright switch flipped, force refresh */ |
| r2844 | r2845 | |
|---|---|---|
| 59 | 59 | |
| 60 | 60 | static void (*modify_spritecode)(UINT8 *spriteram,int*,int*,int*,int); /* function to call to do sprite banking */ |
| 61 | 61 | static void mshuttle_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); |
| 62 | static void calipso_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); | |
| 63 | 62 | static void mimonkey_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); |
| 64 | 63 | static void batman2_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); |
| 65 | 64 | static void dkongjrm_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); |
| r2844 | r2845 | |
| 212 | 211 | palette_set_color(machine,BACKGROUND_COLOR_BASE,MAKE_RGB(0,0,0x56)); |
| 213 | 212 | } |
| 214 | 213 | |
| 215 | PALETTE_INIT( moonwar ) | |
| 216 | { | |
| 217 | PALETTE_INIT_CALL(scrambold); | |
| 218 | 214 | |
| 219 | ||
| 220 | /* wire mod to connect the bullet blue output to the 220 ohm resistor */ | |
| 221 | palette_set_color(machine,BULLETS_COLOR_BASE+0,MAKE_RGB(0xef,0xef,0x97)); | |
| 222 | } | |
| 223 | ||
| 224 | 215 | PALETTE_INIT( stratgyx ) |
| 225 | 216 | { |
| 226 | 217 | int i; |
| r2844 | r2845 | |
| 594 | 585 | modify_spritecode = mshuttle_modify_spritecode; |
| 595 | 586 | } |
| 596 | 587 | |
| 597 | VIDEO_START( calipso ) | |
| 598 | { | |
| 599 | VIDEO_START_CALL(galaxold_plain); | |
| 600 | ||
| 601 | draw_bullets = scramble_draw_bullets; | |
| 602 | ||
| 603 | draw_background = scramble_draw_background; | |
| 604 | ||
| 605 | modify_spritecode = calipso_modify_spritecode; | |
| 606 | } | |
| 607 | ||
| 608 | 588 | VIDEO_START( mariner ) |
| 609 | 589 | { |
| 610 | 590 | VIDEO_START_CALL(galaxold_plain); |
| r2844 | r2845 | |
| 1168 | 1148 | *code |= ((spriteram[offs + 2] & 0x30) << 2); |
| 1169 | 1149 | } |
| 1170 | 1150 | |
| 1171 | static void calipso_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) | |
| 1172 | { | |
| 1173 | /* No flips */ | |
| 1174 | *code = spriteram[offs + 1]; | |
| 1175 | *flipx = 0; | |
| 1176 | *flipy = 0; | |
| 1177 | } | |
| 1178 | 1151 | |
| 1179 | 1152 | static void mimonkey_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) |
| 1180 | 1153 | { |
| r2844 | r2845 | |
|---|---|---|
| 95 | 95 | ***************************************************************************/ |
| 96 | 96 | |
| 97 | 97 | #include "driver.h" |
| 98 | #include "deprecat.h" | |
| 99 | 98 | #include "includes/dec0.h" |
| 100 | 99 | |
| 101 | 100 | static tilemap *pf1_tilemap_0,*pf1_tilemap_1,*pf1_tilemap_2; |
| r2844 | r2845 | |
| 123 | 122 | |
| 124 | 123 | /******************************************************************************/ |
| 125 | 124 | |
| 126 | static void update_24bitcol(int offset) | |
| 125 | static void update_24bitcol(running_machine *machine, int offset) | |
| 127 | 126 | { |
| 128 | 127 | int r,g,b; |
| 129 | 128 | |
| r2844 | r2845 | |
| 131 | 130 | g = (paletteram16[offset] >> 8) & 0xff; |
| 132 | 131 | b = (paletteram16_2[offset] >> 0) & 0xff; |
| 133 | 132 | |
| 134 | palette_set_color( | |
| 133 | palette_set_color(machine,offset,MAKE_RGB(r,g,b)); | |
| 135 | 134 | } |
| 136 | 135 | |
| 137 | 136 | WRITE16_HANDLER( dec0_paletteram_rg_w ) |
| 138 | 137 | { |
| 139 | 138 | COMBINE_DATA(&paletteram16[offset]); |
| 140 | update_24bitcol(offset); | |
| 139 | update_24bitcol(machine, offset); | |
| 141 | 140 | } |
| 142 | 141 | |
| 143 | 142 | WRITE16_HANDLER( dec0_paletteram_b_w ) |
| 144 | 143 | { |
| 145 | 144 | COMBINE_DATA(&paletteram16_2[offset]); |
| 146 | update_24bitcol(offset); | |
| 145 | update_24bitcol(machine, offset); | |
| 147 | 146 | } |
| 148 | 147 | |
| 149 | 148 | /******************************************************************************/ |
| r2844 | r2845 | |
|---|---|---|
| 46 | 46 | ***************************************************************************/ |
| 47 | 47 | |
| 48 | 48 | #include "driver.h" |
| 49 | #include "deprecat.h" | |
| 50 | 49 | #include "taitoic.h" |
| 51 | 50 | |
| 52 | 51 | |
| 53 | extern UINT16 *TC0080VCO_chain_ram_0; | |
| 54 | extern UINT16 *TC0080VCO_chain_ram_1; | |
| 55 | extern UINT16 *TC0080VCO_spriteram; | |
| 56 | extern UINT16 *TC0080VCO_scroll_ram; | |
| 57 | extern int TC0080VCO_flipscreen; | |
| 58 | ||
| 59 | 52 | /* These are hand-tuned values */ |
| 60 | 53 | static const int zoomy_conv_table[] = |
| 61 | 54 | { |
| r2844 | r2845 | |
| 87 | 80 | Screen refresh |
| 88 | 81 | ***************************************************************************/ |
| 89 | 82 | |
| 90 | static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int priority) | |
| 83 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority) | |
| 91 | 84 | { |
| 92 | 85 | /* Y chain size is 16/32?/64/64? pixels. X chain size |
| 93 | 86 | is always 64 pixels. */ |
| r2844 | r2845 | |
| 180 | 173 | flipy ^= 0x0080; |
| 181 | 174 | } |
| 182 | 175 | |
| 183 | drawgfxzoom( bitmap, | |
| 176 | drawgfxzoom( bitmap, machine -> gfx[0], | |
| 184 | 177 | tile, |
| 185 | 178 | color, |
| 186 | 179 | flipx, flipy, |
| r2844 | r2845 | |
| 372 | 365 | if ( !input_code_pressed(KEYCODE_A) ) |
| 373 | 366 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,0,0); |
| 374 | 367 | if ( !input_code_pressed(KEYCODE_S) ) |
| 375 | draw_sprites(bitmap,cliprect,0); | |
| 368 | draw_sprites(screen->machine,bitmap,cliprect,0); | |
| 376 | 369 | if ( !input_code_pressed(KEYCODE_D) ) |
| 377 | 370 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,1,0,0); |
| 378 | 371 | if ( !input_code_pressed(KEYCODE_F) ) |
| 379 | draw_sprites(bitmap,cliprect,1); | |
| 372 | draw_sprites(screen->machine,bitmap,cliprect,1); | |
| 380 | 373 | #else |
| 381 | 374 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,0,0); |
| 382 | draw_sprites (bitmap,cliprect,0); | |
| 375 | draw_sprites (screen->machine,bitmap,cliprect,0); | |
| 383 | 376 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,1,0,0); |
| 384 | draw_sprites (bitmap,cliprect,1); | |
| 377 | draw_sprites (screen->machine,bitmap,cliprect,1); | |
| 385 | 378 | #endif |
| 386 | 379 | |
| 387 | 380 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,2,0,0); |
| r2844 | r2845 | |
|---|---|---|
| 126 | 126 | adjusted_modesc.palettebase = atarig42_motion_object_base; |
| 127 | 127 | for (i = 0; i < 8; i++) |
| 128 | 128 | adjusted_modesc.colormask.data[i] &= atarig42_motion_object_mask; |
| 129 | atarirle_init(0, &adjusted_modesc); | |
| 129 | atarirle_init(machine, 0, &adjusted_modesc); | |
| 130 | 130 | |
| 131 | 131 | /* initialize the alphanumerics */ |
| 132 | 132 | atarigen_alpha_tilemap = tilemap_create(get_alpha_tile_info, tilemap_scan_rows, 8,8, 64,32); |
| r2844 | r2845 | |
|---|---|---|
| 125 | 125 | |
| 126 | 126 | ***************************************************************************/ |
| 127 | 127 | |
| 128 | #ifdef UNUSED_FUNCTION | |
| 128 | 129 | WRITE16_HANDLER( metro_paletteram_w ) |
| 129 | 130 | { |
| 130 | 131 | data = COMBINE_DATA(&paletteram16[offset]); |
| 131 | 132 | palette_set_color_rgb(machine,offset,pal5bit(data >> 6),pal5bit(data >> 11),pal5bit(data >> 1)); |
| 132 | 133 | } |
| 134 | #endif | |
| 133 | 135 | |
| 134 | 136 | |
| 135 | 137 | /*************************************************************************** |
| r2844 | r2845 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | #include "driver.h" |
| 9 | #include "includes/bigevglf.h" | |
| 9 | 10 | |
| 10 | 11 | |
| 11 | 12 | UINT8 *bigevglf_spriteram1; |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "video/resnet.h" |
| 11 | #include "includes/bagman.h" | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | UINT8 *bagman_video_enable; |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | #include "deprecat.h" | |
| 9 | 8 | #include "deco16ic.h" |
| 10 | 9 | |
| 11 | 10 | static int twocrude_pri; |
| r2844 | r2845 | |
| 19 | 18 | |
| 20 | 19 | VIDEO_START( twocrude ) |
| 21 | 20 | { |
| 22 | deco16_2_video_init(0); | |
| 21 | deco16_2_video_init(machine, 0); | |
| 23 | 22 | |
| 24 | 23 | deco16_set_tilemap_bank_callback(0, bank_callback); |
| 25 | 24 | deco16_set_tilemap_bank_callback(1, bank_callback); |
| r2844 | r2845 | |
| 34 | 33 | |
| 35 | 34 | /******************************************************************************/ |
| 36 | 35 | |
| 37 | static void update_24bitcol(int offset) | |
| 36 | static void update_24bitcol(running_machine *machine, int offset) | |
| 38 | 37 | { |
| 39 | 38 | UINT8 r,g,b; /* The highest palette value seems to be 0x8e */ |
| 40 | 39 | |
| r2844 | r2845 | |
| 42 | 41 | g = (UINT8)((float)((paletteram16[offset] >> 8) & 0xff)*1.75); |
| 43 | 42 | b = (UINT8)((float)((paletteram16_2[offset] >> 0) & 0xff)*1.75); |
| 44 | 43 | |
| 45 | palette_set_color( | |
| 44 | palette_set_color(machine,offset,MAKE_RGB(r,g,b)); | |
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | WRITE16_HANDLER( twocrude_palette_24bit_rg_w ) |
| 49 | 48 | { |
| 50 | 49 | COMBINE_DATA(&paletteram16[offset]); |
| 51 | update_24bitcol(offset); | |
| 50 | update_24bitcol(machine, offset); | |
| 52 | 51 | } |
| 53 | 52 | |
| 54 | 53 | WRITE16_HANDLER( twocrude_palette_24bit_b_w ) |
| 55 | 54 | { |
| 56 | 55 | COMBINE_DATA(&paletteram16_2[offset]); |
| 57 | update_24bitcol(offset); | |
| 56 | update_24bitcol(machine, offset); | |
| 58 | 57 | } |
| 59 | 58 | |
| 60 | 59 | /******************************************************************************/ |
| r2844 | r2845 | |
|---|---|---|
| 241 | 241 | |
| 242 | 242 | int width = visarea->max_x + 1 - visarea->min_x; |
| 243 | 243 | int height = visarea->max_y + 1 - visarea->min_y; |
| 244 | *x = visarea->min_x + (((input_port_read_indexed(machine, 3 + player * 2) & 0xff) * width) >> 8); | |
| 245 | *y = visarea->min_y + (((input_port_read_indexed(machine, 4 + player * 2) & 0xff) * height) >> 8); | |
| 244 | /* only 2 lightguns are connected */ | |
| 245 | *x = visarea->min_x + (((input_port_read(machine, player ? "FAKE2_X" : "FAKE1_X") & 0xff) * width) >> 8); | |
| 246 | *y = visarea->min_y + (((input_port_read(machine, player ? "FAKE2_Y" : "FAKE1_Y") & 0xff) * height) >> 8); | |
| 246 | 247 | } |
| 247 | 248 | |
| 248 | 249 | |
| r2844 | r2845 | |
| 741 | 742 | return (beamy << 16) | (beamx ^ 0x1ff); |
| 742 | 743 | |
| 743 | 744 | case 2: |
| 744 | return input_port_read | |
| 745 | return input_port_read | |
| 745 | 746 | } |
| 746 | 747 | return 0; |
| 747 | 748 | } |
| r2844 | r2845 | |
|---|---|---|
| 65 | 65 | return MAKE_RGB((UINT8)finalR,(UINT8)finalG,(UINT8)finalB) ; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | static void jal_blend_drawgfx( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 68 | static void jal_blend_drawgfx( running_machine *machine, bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 69 | 69 | UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy, |
| 70 | 70 | const rectangle *clip,int transparency,int transparent_color) |
| 71 | 71 | { |
| r2844 | r2845 | |
| 91 | 91 | { |
| 92 | 92 | for (xtile = xstart; xtile != xend; xtile += xinc ) |
| 93 | 93 | { |
| 94 | const pen_t *pal = & | |
| 94 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; | |
| 95 | 95 | const UINT8 *alpha = &jal_blend_table[gfx->color_granularity * (color % gfx->total_colors)]; |
| 96 | 96 | int source_base = ((code + code_offset++) % gfx->total_elements) * gfx->height; |
| 97 | 97 |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ******************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "deprecat.h" | |
| 11 | 10 | #include "nb1413m3.h" |
| 12 | 11 | |
| 13 | 12 | |
| r2844 | r2845 | |
| 30 | 29 | static UINT8 *nbmj8891_clut; |
| 31 | 30 | |
| 32 | 31 | |
| 33 | static void nbmj8891_vramflip(int vram); | |
| 34 | static void nbmj8891_gfxdraw(void); | |
| 32 | static void nbmj8891_vramflip(running_machine *machine, int vram); | |
| 33 | static void nbmj8891_gfxdraw(running_machine *machine); | |
| 35 | 34 | |
| 36 | 35 | |
| 37 | 36 | /****************************************************************************** |
| r2844 | r2845 | |
| 134 | 133 | case 0x04: blitter_sizex = data; break; |
| 135 | 134 | case 0x05: blitter_sizey = data; |
| 136 | 135 | /* writing here also starts the blit */ |
| 137 | nbmj8891_gfxdraw(); | |
| 136 | nbmj8891_gfxdraw(machine); | |
| 138 | 137 | break; |
| 139 | 138 | case 0x06: blitter_direction_x = (data & 0x01) ? 1 : 0; |
| 140 | 139 | blitter_direction_y = (data & 0x02) ? 1 : 0; |
| 141 | 140 | nbmj8891_flipscreen = (data & 0x04) ? 1 : 0; |
| 142 | 141 | nbmj8891_dispflag = (data & 0x08) ? 0 : 1; |
| 143 | if (gfxdraw_mode) nbmj8891_vramflip(1); | |
| 144 | nbmj8891_vramflip(0); | |
| 142 | if (gfxdraw_mode) nbmj8891_vramflip(machine, 1); | |
| 143 | nbmj8891_vramflip(machine, 0); | |
| 145 | 144 | break; |
| 146 | 145 | case 0x07: break; |
| 147 | 146 | } |
| r2844 | r2845 | |
| 162 | 161 | |
| 163 | 162 | WRITE8_HANDLER( nbmj8891_taiwanmb_gfxdraw_w ) |
| 164 | 163 | { |
| 165 | // nbmj8891_gfxdraw(); | |
| 164 | // nbmj8891_gfxdraw(machine); | |
| 166 | 165 | } |
| 167 | 166 | |
| 168 | 167 | WRITE8_HANDLER( nbmj8891_taiwanmb_gfxflag_w ) |
| 169 | 168 | { |
| 170 | 169 | nbmj8891_flipscreen = (data & 0x04) ? 1 : 0; |
| 171 | 170 | |
| 172 | nbmj8891_vramflip(0); | |
| 171 | nbmj8891_vramflip(machine, 0); | |
| 173 | 172 | } |
| 174 | 173 | |
| 175 | 174 | WRITE8_HANDLER( nbmj8891_taiwanmb_mcu_w ) |
| r2844 | r2845 | |
| 248 | 247 | blitter_sizey ^= 0x00; |
| 249 | 248 | } |
| 250 | 249 | |
| 251 | nbmj8891_gfxdraw(); | |
| 250 | nbmj8891_gfxdraw(machine); | |
| 252 | 251 | } |
| 253 | 252 | |
| 254 | 253 | // blitter_direction_x = 0; // for debug |
| r2844 | r2845 | |
| 289 | 288 | |
| 290 | 289 | |
| 291 | 290 | ******************************************************************************/ |
| 292 | void nbmj8891_vramflip(int vram) | |
| 291 | void nbmj8891_vramflip(running_machine *machine, int vram) | |
| 293 | 292 | { |
| 294 | 293 | static int nbmj8891_flipscreen_old = 0; |
| 295 | 294 | int x, y; |
| 296 | 295 | UINT8 color1, color2; |
| 297 | 296 | UINT8 *vidram; |
| 298 | 297 | |
| 299 | int width = video_screen_get_width(Machine->primary_screen); | |
| 300 | int height = video_screen_get_height(Machine->primary_screen); | |
| 298 | int width = video_screen_get_width(machine->primary_screen); | |
| 299 | int height = video_screen_get_height(machine->primary_screen); | |
| 301 | 300 | |
| 302 | 301 | if (nbmj8891_flipscreen == nbmj8891_flipscreen_old) return; |
| 303 | 302 | |
| r2844 | r2845 | |
| 319 | 318 | } |
| 320 | 319 | |
| 321 | 320 | |
| 322 | static void update_pixel0(int x, int y) | |
| 321 | static void update_pixel0(running_machine *machine, int x, int y) | |
| 323 | 322 | { |
| 324 | UINT8 color = nbmj8891_videoram0[(y * video_screen_get_width( | |
| 323 | UINT8 color = nbmj8891_videoram0[(y * video_screen_get_width(machine->primary_screen)) + x]; | |
| 325 | 324 | *BITMAP_ADDR16(nbmj8891_tmpbitmap0, y, x) = color; |
| 326 | 325 | } |
| 327 | 326 | |
| 328 | static void update_pixel1(int x, int y) | |
| 327 | static void update_pixel1(running_machine *machine, int x, int y) | |
| 329 | 328 | { |
| 330 | UINT8 color = nbmj8891_videoram1[(y * video_screen_get_width( | |
| 329 | UINT8 color = nbmj8891_videoram1[(y * video_screen_get_width(machine->primary_screen)) + x]; | |
| 331 | 330 | *BITMAP_ADDR16(nbmj8891_tmpbitmap1, y, x) = (color == 0x7f) ? 0xff : color; |
| 332 | 331 | } |
| 333 | 332 | |
| r2844 | r2845 | |
| 336 | 335 | nb1413m3_busyflag = 1; |
| 337 | 336 | } |
| 338 | 337 | |
| 339 | static void nbmj8891_gfxdraw( | |
| 338 | static void nbmj8891_gfxdraw(running_machine *machine) | |
| 340 | 339 | { |
| 341 | 340 | UINT8 *GFX = memory_region(REGION_GFX1); |
| 342 | int width = video_screen_get_width( | |
| 341 | int width = video_screen_get_width(machine->primary_screen); | |
| 343 | 342 | |
| 344 | 343 | int x, y; |
| 345 | 344 | int dx1, dx2, dy1, dy2; |
| r2844 | r2845 | |
| 446 | 445 | if (color1 != 0xff) |
| 447 | 446 | { |
| 448 | 447 | nbmj8891_videoram0[(dy1 * width) + dx1] = color1; |
| 449 | update_pixel0(dx1, dy1); | |
| 448 | update_pixel0(machine, dx1, dy1); | |
| 450 | 449 | } |
| 451 | 450 | if (color2 != 0xff) |
| 452 | 451 | { |
| 453 | 452 | nbmj8891_videoram0[(dy1 * width) + dx2] = color2; |
| 454 | update_pixel0(dx2, dy1); | |
| 453 | update_pixel0(machine, dx2, dy1); | |
| 455 | 454 | } |
| 456 | 455 | } |
| 457 | 456 | if (gfxdraw_mode && (nbmj8891_vram & 0x02)) |
| r2844 | r2845 | |
| 463 | 462 | if (color1 != 0xff) |
| 464 | 463 | { |
| 465 | 464 | nbmj8891_videoram1[(dy2 * width) + dx1] = color1; |
| 466 | update_pixel1(dx1, dy2); | |
| 465 | update_pixel1(machine, dx1, dy2); | |
| 467 | 466 | } |
| 468 | 467 | if (color2 != 0xff) |
| 469 | 468 | { |
| 470 | 469 | nbmj8891_videoram1[(dy2 * width) + dx2] = color2; |
| 471 | update_pixel1(dx2, dy2); | |
| 470 | update_pixel1(machine, dx2, dy2); | |
| 472 | 471 | } |
| 473 | 472 | } |
| 474 | 473 | else |
| 475 | 474 | { |
| 476 | 475 | // transparent disable |
| 477 | 476 | nbmj8891_videoram1[(dy2 * width) + dx1] = color1; |
| 478 | update_pixel1(dx1, dy2); | |
| 477 | update_pixel1(machine, dx1, dy2); | |
| 479 | 478 | nbmj8891_videoram1[(dy2 * width) + dx2] = color2; |
| 480 | update_pixel1(dx2, dy2); | |
| 479 | update_pixel1(machine, dx2, dy2); | |
| 481 | 480 | } |
| 482 | 481 | } |
| 483 | 482 | |
| r2844 | r2845 | |
| 543 | 542 | nbmj8891_screen_refresh = 0; |
| 544 | 543 | for (y = 0; y < height; y++) |
| 545 | 544 | for (x = 0; x < width; x++) |
| 546 | update_pixel0(x, y); | |
| 545 | update_pixel0(screen->machine, x, y); | |
| 547 | 546 | |
| 548 | 547 | if (gfxdraw_mode) |
| 549 | 548 | for (y = 0; y < height; y++) |
| 550 | 549 | for (x = 0; x < width; x++) |
| 551 | update_pixel1(x, y); | |
| 550 | update_pixel1(screen->machine, x, y); | |
| 552 | 551 | } |
| 553 | 552 | |
| 554 | 553 | if (nbmj8891_dispflag) |
| r2844 | r2845 | |
|---|---|---|
| 136 | 136 | ***************************************************************************/ |
| 137 | 137 | |
| 138 | 138 | #include "driver.h" |
| 139 | #include "deprecat.h" | |
| 140 | 139 | #include "sound/x1_010.h" |
| 141 | 140 | #include "seta.h" |
| 142 | 141 | |
| r2844 | r2845 | |
| 227 | 226 | ---- --1- Coin #1 Counter |
| 228 | 227 | ---- ---0 Coin #0 Counter */ |
| 229 | 228 | |
| 230 | void seta_coin_lockout_w(int data) | |
| 229 | void seta_coin_lockout_w(running_machine *machine, int data) | |
| 231 | 230 | { |
| 232 | 231 | static int seta_coin_lockout = 1; |
| 233 | 232 | static const game_driver *seta_driver = NULL; |
| 234 | 233 | static const char *const seta_nolockout[8] = { "blandia", "gundhara", "kamenrid", "zingzip", "eightfrc", "extdwnhl", "sokonuke", "zombraid"}; |
| 235 | 234 | |
| 236 | 235 | /* Only compute seta_coin_lockout when confronted with a new gamedrv */ |
| 237 | if (seta_driver != | |
| 236 | if (seta_driver != machine->gamedrv) | |
| 238 | 237 | { |
| 239 | 238 | int i; |
| 240 | seta_driver = | |
| 239 | seta_driver = machine->gamedrv; | |
| 241 | 240 | |
| 242 | 241 | seta_coin_lockout = 1; |
| 243 | 242 | for (i=0; i<ARRAY_LENGTH(seta_nolockout); i++) |
| r2844 | r2845 | |
| 279 | 278 | ---- ---- ---- ---0 Coin #0 Counter */ |
| 280 | 279 | if (ACCESSING_BITS_0_7) |
| 281 | 280 | { |
| 282 | seta_coin_lockout_w (data & 0x0f); | |
| 281 | seta_coin_lockout_w (machine, data & 0x0f); | |
| 283 | 282 | if (sndti_exists(SOUND_X1_010, 0)) |
| 284 | 283 | seta_sound_enable_w (data & 0x20); |
| 285 | 284 | coin_counter_w(0,data & 0x01); |
| r2844 | r2845 | |
|---|---|---|
| 28 | 28 | { |
| 29 | 29 | rohga_spriteram = (UINT16*)auto_malloc(0x800); |
| 30 | 30 | |
| 31 | deco16_2_video_init(0); | |
| 31 | deco16_2_video_init(machine, 0); | |
| 32 | 32 | |
| 33 | 33 | deco16_set_tilemap_bank_callback(0,wizdfire_bank_callback); |
| 34 | 34 | deco16_set_tilemap_bank_callback(1,wizdfire_bank_callback); |
| r2844 | r2845 | |
| 38 | 38 | |
| 39 | 39 | VIDEO_START( wizdfire ) |
| 40 | 40 | { |
| 41 | deco16_2_video_init(0); | |
| 41 | deco16_2_video_init(machine, 0); | |
| 42 | 42 | |
| 43 | 43 | deco16_set_tilemap_bank_callback(0,wizdfire_bank_callback); |
| 44 | 44 | deco16_set_tilemap_bank_callback(1,wizdfire_bank_callback); |
| r2844 | r2845 | |
| 52 | 52 | |
| 53 | 53 | VIDEO_START( nitrobal ) |
| 54 | 54 | { |
| 55 | deco16_2_video_init_half_width(); | |
| 55 | deco16_2_video_init_half_width(machine); | |
| 56 | 56 | |
| 57 | 57 | deco16_set_tilemap_bank_callback(0,wizdfire_bank_callback); |
| 58 | 58 | deco16_set_tilemap_bank_callback(1,wizdfire_bank_callback); |
| r2844 | r2845 | |
| 420 | 420 | |
| 421 | 421 | for (x=0; x<w; x++) { |
| 422 | 422 | for (y=0; y<h; y++) { |
| 423 | deco16_pdrawgfx(bitmap,machine->gfx[gfxbank], | |
| 423 | deco16_pdrawgfx(machine, | |
| 424 | bitmap,machine->gfx[gfxbank], | |
| 424 | 425 | sprite + y + h * x, |
| 425 | 426 | colour, |
| 426 | 427 | fx,fy, |
| r2844 | r2845 | |
|---|---|---|
| 74 | 74 | tilemap_mark_tile_dirty(bg_tilemap,offset); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | void vb_bgprombank_w( int bank ) | |
| 77 | void vb_bgprombank_w( running_machine *machine, int bank ) | |
| 78 | 78 | { |
| 79 | 79 | int i; |
| 80 | 80 | UINT8* color_prom; |
| r2844 | r2845 | |
| 83 | 83 | |
| 84 | 84 | color_prom = memory_region(REGION_PROMS) + bank*0x80; |
| 85 | 85 | for (i=0;i<128;i++, color_prom++) { |
| 86 | palette_set_color_rgb( | |
| 86 | palette_set_color_rgb(machine,i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4), | |
| 87 | 87 | pal4bit(color_prom[0x800] >> 0)); |
| 88 | 88 | } |
| 89 | 89 | vb_bgprombank=bank; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | void vb_spprombank_w( int bank ) | |
| 92 | void vb_spprombank_w( running_machine *machine, int bank ) | |
| 93 | 93 | { |
| 94 | 94 | |
| 95 | 95 | int i; |
| r2844 | r2845 | |
| 99 | 99 | |
| 100 | 100 | color_prom = memory_region(REGION_PROMS)+0x400 + bank*0x80; |
| 101 | 101 | for (i=128;i<256;i++,color_prom++) { |
| 102 | palette_set_color_rgb( | |
| 102 | palette_set_color_rgb(machine,i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4), | |
| 103 | 103 | pal4bit(color_prom[0x800] >> 0)); |
| 104 | 104 | } |
| 105 | 105 | vb_spprombank=bank; |
| r2844 | r2845 | |
|---|---|---|
| 175 | 175 | static int (*deco16_bank_callback_2)(const int bank); |
| 176 | 176 | static int (*deco16_bank_callback_3)(const int bank); |
| 177 | 177 | static int (*deco16_bank_callback_4)(const int bank); |
| 178 | static void custom_tilemap_draw(bitmap_t *bitmap,tilemap *tilemap0_8x8,tilemap *tilemap0_16x16, | |
| 178 | static void custom_tilemap_draw(running_machine *machine, | |
| 179 | bitmap_t *bitmap,tilemap *tilemap0_8x8,tilemap *tilemap0_16x16, | |
| 179 | 180 | tilemap *tilemap1_8x8,tilemap *tilemap1_16x16, const UINT16 *rowscroll_ptr,const UINT16 scrollx, |
| 180 | 181 | const UINT16 scrolly,const UINT16 control0, const UINT16 control1,int combine_mask,int combine_shift,int trans_mask,int flags,UINT32 priority); |
| 181 | 182 | |
| r2844 | r2845 | |
| 516 | 517 | |
| 517 | 518 | /*****************************************************************************************/ |
| 518 | 519 | |
| 519 | static void deco16_video_init(int pf12_only, int split, int full_width) | |
| 520 | static void deco16_video_init(running_machine *machine, int pf12_only, int split, int full_width) | |
| 520 | 521 | { |
| 521 | int width = video_screen_get_width(Machine->primary_screen); | |
| 522 | int height = video_screen_get_height(Machine->primary_screen); | |
| 522 | int width = video_screen_get_width(machine->primary_screen); | |
| 523 | int height = video_screen_get_height(machine->primary_screen); | |
| 523 | 524 | sprite_priority_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED8 ); |
| 524 | 525 | |
| 525 | 526 | pf1_tilemap_16x16 = tilemap_create(get_pf1_tile_info, deco16_scan_rows, 16,16,64,32); |
| r2844 | r2845 | |
| 582 | 583 | deco16_raster_display_position=0; |
| 583 | 584 | } |
| 584 | 585 | |
| 585 | void deco16_1_video_init( | |
| 586 | void deco16_1_video_init(running_machine *machine) /* 1 times playfield generator chip */ | |
| 586 | 587 | { |
| 587 | deco16_video_init(1, 0, 1); | |
| 588 | deco16_video_init(machine, 1, 0, 1); | |
| 588 | 589 | } |
| 589 | 590 | |
| 590 | void deco16_2_video_init(int split) /* 2 times playfield generator chips */ | |
| 591 | void deco16_2_video_init(running_machine *machine, int split) /* 2 times playfield generator chips */ | |
| 591 | 592 | { |
| 592 | deco16_video_init(0, split, 1); | |
| 593 | deco16_video_init(machine, 0, split, 1); | |
| 593 | 594 | } |
| 594 | 595 | |
| 595 | void deco16_2_video_init_half_width( | |
| 596 | void deco16_2_video_init_half_width(running_machine *machine) /* 2 times playfield generator chips */ | |
| 596 | 597 | { |
| 597 | deco16_video_init(0, 0, 0); | |
| 598 | deco16_video_init(machine, 0, 0, 0); | |
| 598 | 599 | } |
| 599 | 600 | |
| 600 | void deco_allocate_sprite_bitmap( | |
| 601 | void deco_allocate_sprite_bitmap(running_machine *machine) | |
| 601 | 602 | { |
| 602 | 603 | /* Allow sprite bitmap to be used by Deco32 games as well */ |
| 603 | int width = video_screen_get_width(Machine->primary_screen); | |
| 604 | int height = video_screen_get_height(Machine->primary_screen); | |
| 604 | int width = video_screen_get_width(machine->primary_screen); | |
| 605 | int height = video_screen_get_height(machine->primary_screen); | |
| 605 | 606 | sprite_priority_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16 ); |
| 606 | 607 | } |
| 607 | 608 | |
| r2844 | r2845 | |
| 835 | 836 | } |
| 836 | 837 | |
| 837 | 838 | /* A special pdrawgfx z-buffered sprite renderer that is needed to properly draw multiple sprite sources with alpha */ |
| 838 | void deco16_pdrawgfx(bitmap_t *dest,const gfx_element *gfx, | |
| 839 | void deco16_pdrawgfx(running_machine *machine, | |
| 840 | bitmap_t *dest,const gfx_element *gfx, | |
| 839 | 841 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 840 | 842 | const rectangle *clip,int transparency,int transparent_color,UINT32 pri_mask,UINT32 sprite_mask,UINT8 write_pri) |
| 841 | 843 | { |
| 842 | 844 | int ox,oy,cx,cy; |
| 843 | 845 | int x_index,y_index,x,y; |
| 844 | 846 | |
| 845 | const pen_t *pal = & | |
| 847 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; | |
| 846 | 848 | int source_base = (code % gfx->total_elements) * gfx->height; |
| 847 | 849 | |
| 848 | 850 | /* check bounds */ |
| r2844 | r2845 | |
| 904 | 906 | { |
| 905 | 907 | if (use_custom_pf1) |
| 906 | 908 | { |
| 907 | custom_tilemap_draw(bitmap,pf1_tilemap_8x8,pf1_tilemap_16x16,0,0,pf1_rowscroll_ptr,deco16_pf12_control[1], deco16_pf12_control[2], deco16_pf12_control[5]&0xff, deco16_pf12_control[6]&0xff, 0, 0, deco16_pf1_trans_mask, flags, priority); | |
| 909 | custom_tilemap_draw(Machine, bitmap,pf1_tilemap_8x8,pf1_tilemap_16x16,0,0,pf1_rowscroll_ptr,deco16_pf12_control[1], deco16_pf12_control[2], deco16_pf12_control[5]&0xff, deco16_pf12_control[6]&0xff, 0, 0, deco16_pf1_trans_mask, flags, priority); | |
| 908 | 910 | } |
| 909 | 911 | else |
| 910 | 912 | { |
| r2844 | r2845 | |
| 917 | 919 | { |
| 918 | 920 | if (use_custom_pf2) |
| 919 | 921 | { |
| 920 | custom_tilemap_draw(bitmap,pf2_tilemap_8x8,pf2_tilemap_16x16,0,0,pf2_rowscroll_ptr,deco16_pf12_control[3], deco16_pf12_control[4], deco16_pf12_control[5]>>8, deco16_pf12_control[6]>>8, 0, 0, deco16_pf2_trans_mask, flags, priority); | |
| 922 | custom_tilemap_draw(Machine, bitmap,pf2_tilemap_8x8,pf2_tilemap_16x16,0,0,pf2_rowscroll_ptr,deco16_pf12_control[3], deco16_pf12_control[4], deco16_pf12_control[5]>>8, deco16_pf12_control[6]>>8, 0, 0, deco16_pf2_trans_mask, flags, priority); | |
| 921 | 923 | } |
| 922 | 924 | else |
| 923 | 925 | { |
| r2844 | r2845 | |
| 928 | 930 | |
| 929 | 931 | void deco16_tilemap_3_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority) |
| 930 | 932 | { |
| 931 | if (use_custom_pf3) custom_tilemap_draw(bitmap,0,pf3_tilemap_16x16,0,0,pf3_rowscroll_ptr,deco16_pf34_control[1], deco16_pf34_control[2], deco16_pf34_control[5]&0xff, deco16_pf34_control[6]&0xff, 0, 0, deco16_pf3_trans_mask, flags, priority); | |
| 933 | if (use_custom_pf3) custom_tilemap_draw(Machine, bitmap,0,pf3_tilemap_16x16,0,0,pf3_rowscroll_ptr,deco16_pf34_control[1], deco16_pf34_control[2], deco16_pf34_control[5]&0xff, deco16_pf34_control[6]&0xff, 0, 0, deco16_pf3_trans_mask, flags, priority); | |
| 932 | 934 | else if (pf3_tilemap_16x16) tilemap_draw(bitmap,cliprect,pf3_tilemap_16x16,flags,priority); |
| 933 | 935 | } |
| 934 | 936 | |
| 935 | 937 | void deco16_tilemap_4_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority) |
| 936 | 938 | { |
| 937 | if (use_custom_pf4) custom_tilemap_draw(bitmap,0,pf4_tilemap_16x16,0,0,pf4_rowscroll_ptr,deco16_pf34_control[3], deco16_pf34_control[4], deco16_pf34_control[5]>>8, deco16_pf34_control[6]>>8, 0, 0, deco16_pf4_trans_mask, flags, priority); | |
| 939 | if (use_custom_pf4) custom_tilemap_draw(Machine, bitmap,0,pf4_tilemap_16x16,0,0,pf4_rowscroll_ptr,deco16_pf34_control[3], deco16_pf34_control[4], deco16_pf34_control[5]>>8, deco16_pf34_control[6]>>8, 0, 0, deco16_pf4_trans_mask, flags, priority); | |
| 938 | 940 | else if (pf4_tilemap_16x16) tilemap_draw(bitmap,cliprect,pf4_tilemap_16x16,flags,priority); |
| 939 | 941 | } |
| 940 | 942 | |
| r2844 | r2845 | |
| 943 | 945 | // Combines the output of two 4BPP tilemaps into an 8BPP tilemap |
| 944 | 946 | void deco16_tilemap_34_combine_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority) |
| 945 | 947 | { |
| 946 | custom_tilemap_draw(bitmap,0,pf3_tilemap_16x16,0,pf4_tilemap_16x16,pf3_rowscroll_ptr,deco16_pf34_control[1], deco16_pf34_control[2], deco16_pf34_control[5]&0xff, deco16_pf34_control[6]&0xff, 0xf, 4, 0xff, flags, priority); | |
| 948 | custom_tilemap_draw(Machine, bitmap,0,pf3_tilemap_16x16,0,pf4_tilemap_16x16,pf3_rowscroll_ptr,deco16_pf34_control[1], deco16_pf34_control[2], deco16_pf34_control[5]&0xff, deco16_pf34_control[6]&0xff, 0xf, 4, 0xff, flags, priority); | |
| 947 | 949 | } |
| 948 | 950 | |
| 949 | 951 | /*****************************************************************************************/ |
| r2844 | r2845 | |
| 957 | 959 | */ |
| 958 | 960 | |
| 959 | 961 | static void custom_tilemap_draw( |
| 962 | running_machine *machine, | |
| 960 | 963 | bitmap_t *bitmap, |
| 961 | 964 | tilemap *tilemap0_8x8, |
| 962 | 965 | tilemap *tilemap0_16x16, |
| r2844 | r2845 | |
| 1016 | 1019 | src_x=(src_x+1)&width_mask; |
| 1017 | 1020 | if ((flags&TILEMAP_DRAW_OPAQUE) || (p&trans_mask)) |
| 1018 | 1021 | { |
| 1019 | *BITMAP_ADDR16(bitmap, y, x) = | |
| 1022 | *BITMAP_ADDR16(bitmap, y, x) = machine->pens[p]; | |
| 1020 | 1023 | if (priority_bitmap) |
| 1021 | 1024 | { |
| 1022 | 1025 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0); |
| r2844 | r2845 | |
| 1041 | 1044 | src_x=(src_x+1)&width_mask; |
| 1042 | 1045 | if ((flags&TILEMAP_DRAW_OPAQUE) || (p&trans_mask)) |
| 1043 | 1046 | { |
| 1044 | *BITMAP_ADDR32(bitmap, y, x) = | |
| 1047 | *BITMAP_ADDR32(bitmap, y, x) = machine->pens[p]; | |
| 1045 | 1048 | if (priority_bitmap) |
| 1046 | 1049 | { |
| 1047 | 1050 | UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0); |
| r2844 | r2845 | |
|---|---|---|
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | |
| 22 | 22 | #include "driver.h" |
| 23 | #include "deprecat.h" | |
| 24 | 23 | #include "realbrk.h" |
| 25 | 24 | |
| 26 | 25 | //UINT16 *realbrk_vram_0, *realbrk_vram_1, *realbrk_vram_2, *realbrk_vregs; |
| r2844 | r2845 | |
| 380 | 379 | |
| 381 | 380 | /* DaiDaiKakumei */ |
| 382 | 381 | /* layer : 0== bghigh<spr 1== bglow<spr<bghigh 2==spr<bglow 3==boarder */ |
| 383 | static void dai2kaku_draw_sprites( bitmap_t *bitmap,const rectangle *cliprect, int layer) | |
| 382 | static void dai2kaku_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect, int layer) | |
| 384 | 383 | { |
| 385 | 384 | int offs; |
| 386 | 385 | |
| 387 | int max_x = video_screen_get_width(Machine->primary_screen); | |
| 388 | int max_y = video_screen_get_height(Machine->primary_screen); | |
| 386 | int max_x = video_screen_get_width(machine->primary_screen); | |
| 387 | int max_y = video_screen_get_height(machine->primary_screen); | |
| 389 | 388 | |
| 390 | 389 | for ( offs = 0x3000/2; offs < 0x3600/2; offs += 2/2 ) |
| 391 | 390 | { |
| r2844 | r2845 | |
| 444 | 443 | int scalex = (sx + (x + 1) * xdim) / 0x10000 - currx; |
| 445 | 444 | int scaley = (sy + (y + 1) * ydim) / 0x10000 - curry; |
| 446 | 445 | |
| 447 | drawgfxzoom( bitmap, | |
| 446 | drawgfxzoom( bitmap,machine->gfx[gfx], | |
| 448 | 447 | code++, |
| 449 | 448 | color, |
| 450 | 449 | flipx, flipy, |
| r2844 | r2845 | |
| 594 | 593 | |
| 595 | 594 | |
| 596 | 595 | // spr 0 |
| 597 | if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,2); | |
| 596 | if (layers_ctrl & 8) dai2kaku_draw_sprites(screen->machine,bitmap,cliprect,2); | |
| 598 | 597 | |
| 599 | 598 | // bglow |
| 600 | 599 | if( realbrk_vregs[8/2] & (0x8000)){ |
| r2844 | r2845 | |
| 604 | 603 | } |
| 605 | 604 | |
| 606 | 605 | // spr 1 |
| 607 | if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,1); | |
| 606 | if (layers_ctrl & 8) dai2kaku_draw_sprites(screen->machine,bitmap,cliprect,1); | |
| 608 | 607 | |
| 609 | 608 | // bghigh |
| 610 | 609 | if( realbrk_vregs[8/2] & (0x8000)){ |
| r2844 | r2845 | |
| 614 | 613 | } |
| 615 | 614 | |
| 616 | 615 | // spr 2 |
| 617 | if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,0); | |
| 616 | if (layers_ctrl & 8) dai2kaku_draw_sprites(screen->machine,bitmap,cliprect,0); | |
| 618 | 617 | |
| 619 | 618 | // fix |
| 620 | 619 | if (layers_ctrl & 4) tilemap_draw(bitmap,cliprect,tilemap_2,0,0); |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | *******************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | #include "includes/namcos1.h" | |
| 8 | 9 | |
| 9 | 10 | |
| 10 | 11 | /* |
| r2844 | r2845 | |
| 33 | 34 | |
| 34 | 35 | so there is just 3x0x2000 RAM, plus the CUS116 internal registers. |
| 35 | 36 | */ |
| 36 | extern UINT8 *namcos1_paletteram; | |
| 37 | 37 | static UINT8 namcos1_cus116[0x10]; |
| 38 | 38 | |
| 39 | 39 | /* |
| r2844 | r2845 | |
|---|---|---|
| 54 | 54 | const int R2 = 120; |
| 55 | 55 | const int R3 = 100; |
| 56 | 56 | const int R4 = 75; |
| 57 | const int pull = 2 | |
| 57 | const int pull = 220; | |
| 58 | 58 | float pot[16]; |
| 59 | 59 | int weight[16]; |
| 60 | const float potadjust = 0. | |
| 60 | const float potadjust = 0.7f; /* diode voltage drop */ | |
| 61 | 61 | |
| 62 | 62 | for (i = 0x0f; i >= 0; i--) |
| 63 | 63 | { |
| r2844 | r2845 | |
| 86 | 86 | int bits0, bits2; |
| 87 | 87 | int r, g, b; |
| 88 | 88 | |
| 89 | a1 = ((i >> 3) & 0x1c) + (i & 0x03) + | |
| 89 | a1 = ((i >> 3) & 0x1c) + (i & 0x03) + 0x20; | |
| 90 | 90 | a2 = ((i >> 0) & 0x1c) + (i & 0x03); |
| 91 | 91 | |
| 92 | 92 | /* red component */ |
| r2844 | r2845 | |
| 120 | 120 | UINT8 ctabentry = color_prom[(i - 0x100) & 0x1f]; |
| 121 | 121 | |
| 122 | 122 | if ((i - 0x100) & 0x20) |
| 123 | ctabentry | |
| 123 | ctabentry | |
| 124 | 124 | else |
| 125 | ctabentry | |
| 125 | ctabentry | |
| 126 | 126 | |
| 127 | colortable_entry_set_value(machine->colortable, i, ctabentry); | |
| 127 | colortable_entry_set_value(machine->colortable, i, ctabentry + ((ctabentry & 0x0c) << 3)); | |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 |
| r2844 | r2845 | |
|---|---|---|
| 6 | 6 | ***************************************************************************/ |
| 7 | 7 | |
| 8 | 8 | #include "driver.h" |
| 9 | #include "deprecat.h" | |
| 10 | 9 | #include "jalblend.c" |
| 11 | 10 | |
| 12 | 11 | #define BG_SCROLLX_LSB 0x308 |
| r2844 | r2845 | |
| 53 | 52 | title_screen = data & 0x01; |
| 54 | 53 | } |
| 55 | 54 | |
| 56 | static void psychic5_paletteram_w(int color_offs, int offset, int data) | |
| 55 | static void psychic5_paletteram_w(running_machine *machine, int color_offs, int offset, int data) | |
| 57 | 56 | { |
| 58 | 57 | int r,g,b,a,val; |
| 59 | 58 | |
| r2844 | r2845 | |
| 74 | 73 | |
| 75 | 74 | jal_blend_table[(offset / 2)-color_offs] = a ; |
| 76 | 75 | |
| 77 | palette_set_color_rgb( | |
| 76 | palette_set_color_rgb(machine,(offset / 2)-color_offs,pal4bit(r),pal4bit(g),pal4bit(b)); | |
| 78 | 77 | } |
| 79 | 78 | |
| 80 | 79 | static void set_background_palette_intensity(running_machine *machine) |
| r2844 | r2845 | |
| 218 | 217 | } |
| 219 | 218 | else if (offset < 0x600) |
| 220 | 219 | { |
| 221 | psychic5_paletteram_w(000, offset-0x400, data); | |
| 220 | psychic5_paletteram_w(machine, 000, offset-0x400, data); | |
| 222 | 221 | } |
| 223 | 222 | else if (offset > 0x5ff && offset< 0x800) |
| 224 | 223 | { |
| r2844 | r2845 | |
| 226 | 225 | } |
| 227 | 226 | else if (offset > 0x7ff && offset < 0xa00) |
| 228 | 227 | { |
| 229 | psychic5_paletteram_w(256, offset-0x400, data); | |
| 228 | psychic5_paletteram_w(machine, 256, offset-0x400, data); | |
| 230 | 229 | } |
| 231 | 230 | else if (offset > 0x9ff && offset < 0xc00) |
| 232 | 231 | { |
| 233 | psychic5_paletteram_w(256, offset-0x400, data); | |
| 232 | psychic5_paletteram_w(machine, 256, offset-0x400, data); | |
| 234 | 233 | } |
| 235 | 234 | else if (offset < 0x1000) |
| 236 | 235 | { |
| r2844 | r2845 | |
| 290 | 289 | tilemap_set_transparent_pen(fg_tilemap, 15); |
| 291 | 290 | } |
| 292 | 291 | |
| 293 | #define DRAW_SPRITE(code, sx, sy) jal_blend_drawgfx(bitmap, machine->gfx[0], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PEN, 15); | |
| 292 | #define DRAW_SPRITE(code, sx, sy) jal_blend_drawgfx(machine, bitmap, machine->gfx[0], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PEN, 15); | |
| 294 | 293 | /* #define DRAW_SPRITE(code, sx, sy) drawgfx(bitmap, machine->gfx[0], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PEN, 15); */ |
| 295 | 294 | |
| 296 | 295 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) |
| r2844 | r2845 | |
|---|---|---|
| 46 | 46 | ***************************************************************************/ |
| 47 | 47 | |
| 48 | 48 | #include "driver.h" |
| 49 | #include "deprecat.h" | |
| 50 | 49 | #include "taitoic.h" |
| 51 | 50 | |
| 52 | 51 | |
| 53 | extern UINT16 *TC0080VCO_chain_ram_0; | |
| 54 | extern UINT16 *TC0080VCO_chain_ram_1; | |
| 55 | extern UINT16 *TC0080VCO_spriteram; | |
| 56 | extern UINT16 *TC0080VCO_scroll_ram; | |
| 57 | extern int TC0080VCO_flipscreen; | |
| 58 | ||
| 59 | 52 | /* These are hand-tuned values */ |
| 60 | 53 | static const int zoomy_conv_table[] = |
| 61 | 54 | { |
| r2844 | r2845 | |
| 97 | 90 | Screen refresh |
| 98 | 91 | ***************************************************************************/ |
| 99 | 92 | |
| 100 | static void syvalion_draw_sprites(bitmap_t *bitmap,const rectangle *cliprect) | |
| 93 | static void syvalion_draw_sprites(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect) | |
| 101 | 94 | { |
| 102 | 95 | /* Y chain size is 16/32?/64/64? pixels. X chain size |
| 103 | 96 | is always 64 pixels. */ |
| r2844 | r2845 | |
| 171 | 164 | flipy ^= 0x0080; |
| 172 | 165 | } |
| 173 | 166 | |
| 174 | drawgfxzoom( bitmap, | |
| 167 | drawgfxzoom( bitmap, machine -> gfx[0], | |
| 175 | 168 | tile, |
| 176 | 169 | color, |
| 177 | 170 | flipx, flipy, |
| r2844 | r2845 | |
| 190 | 183 | } |
| 191 | 184 | } |
| 192 | 185 | |
| 193 | static void recordbr_draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int priority) | |
| 186 | static void recordbr_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority) | |
| 194 | 187 | { |
| 195 | 188 | /* Y chain size is 16/32?/64/64? pixels. X chain size |
| 196 | 189 | is always 64 pixels. */ |
| r2844 | r2845 | |
| 283 | 276 | flipy ^= 0x0080; |
| 284 | 277 | } |
| 285 | 278 | |
| 286 | drawgfxzoom( bitmap, | |
| 279 | drawgfxzoom( bitmap, machine -> gfx[0], | |
| 287 | 280 | tile, |
| 288 | 281 | color, |
| 289 | 282 | flipx, flipy, |
| r2844 | r2845 | |
| 302 | 295 | } |
| 303 | 296 | } |
| 304 | 297 | |
| 305 | static void dleague_draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int priority) | |
| 298 | static void dleague_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority) | |
| 306 | 299 | { |
| 307 | 300 | /* Y chain size is 16/32?/64/64? pixels. X chain size |
| 308 | 301 | is always 64 pixels. */ |
| r2844 | r2845 | |
| 384 | 377 | flipy ^= 0x0080; |
| 385 | 378 | } |
| 386 | 379 | |
| 387 | drawgfxzoom( bitmap, | |
| 380 | drawgfxzoom( bitmap, machine -> gfx[0], | |
| 388 | 381 | tile, |
| 389 | 382 | color, |
| 390 | 383 | flipx, flipy, |
| r2844 | r2845 | |
| 431 | 424 | |
| 432 | 425 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,TILEMAP_DRAW_OPAQUE,0); |
| 433 | 426 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,1,0,0); |
| 434 | syvalion_draw_sprites(bitmap,cliprect); | |
| 427 | syvalion_draw_sprites(screen->machine,bitmap,cliprect); | |
| 435 | 428 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,2,0,0); |
| 436 | 429 | return 0; |
| 437 | 430 | } |
| r2844 | r2845 | |
| 451 | 444 | if ( !input_code_pressed(KEYCODE_A) ) |
| 452 | 445 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,TILEMAP_DRAW_OPAQUE,0); |
| 453 | 446 | if ( !input_code_pressed(KEYCODE_S) ) |
| 454 | recordbr_draw_sprites(bitmap,cliprect,0); | |
| 447 | recordbr_draw_sprites(screen->machine,bitmap,cliprect,0); | |
| 455 | 448 | if ( !input_code_pressed(KEYCODE_D) ) |
| 456 | 449 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,1,0,0); |
| 457 | 450 | if ( !input_code_pressed(KEYCODE_F) ) |
| 458 | recordbr_draw_sprites(bitmap,cliprect,1); | |
| 451 | recordbr_draw_sprites(screen->machine,bitmap,cliprect,1); | |
| 459 | 452 | #else |
| 460 | 453 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,TILEMAP_DRAW_OPAQUE,0); |
| 461 | recordbr_draw_sprites(bitmap,cliprect,0); | |
| 454 | recordbr_draw_sprites(screen->machine,bitmap,cliprect,0); | |
| 462 | 455 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,1,0,0); |
| 463 | recordbr_draw_sprites(bitmap,cliprect,1); | |
| 456 | recordbr_draw_sprites(screen->machine,bitmap,cliprect,1); | |
| 464 | 457 | #endif |
| 465 | 458 | |
| 466 | 459 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,2,0,0); |
| r2844 | r2845 | |
| 482 | 475 | if ( !input_code_pressed(KEYCODE_A) ) |
| 483 | 476 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,TILEMAP_DRAW_OPAQUE,0); |
| 484 | 477 | if ( !input_code_pressed(KEYCODE_S) ) |
| 485 | dleague_draw_sprites(bitmap,cliprect,0); | |
| 478 | dleague_draw_sprites(screen->machine,bitmap,cliprect,0); | |
| 486 | 479 | if ( !input_code_pressed(KEYCODE_D) ) |
| 487 | 480 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,1,0,0); |
| 488 | 481 | if ( !input_code_pressed(KEYCODE_F) ) |
| 489 | dleague_draw_sprites(bitmap,cliprect,1); | |
| 482 | dleague_draw_sprites(screen->machine,bitmap,cliprect,1); | |
| 490 | 483 | #else |
| 491 | 484 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,0,TILEMAP_DRAW_OPAQUE,0); |
| 492 | dleague_draw_sprites (bitmap,cliprect,0); | |
| 485 | dleague_draw_sprites (screen->machine,bitmap,cliprect,0); | |
| 493 | 486 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,1,0,0); |
| 494 | dleague_draw_sprites (bitmap,cliprect,1); | |
| 487 | dleague_draw_sprites (screen->machine,bitmap,cliprect,1); | |
| 495 | 488 | #endif |
| 496 | 489 | |
| 497 | 490 | TC0080VCO_tilemap_draw(screen->machine,bitmap,cliprect,2,0,0); |
| r2844 | r2845 | |
|---|---|---|
| 4 | 4 | #define TC0480SCP_GFX_NUM 1 |
| 5 | 5 | #define TC0100SCN_GFX_NUM 1 |
| 6 | 6 | |
| 7 | extern UINT8 TC0360PRI_regs[16]; | |
| 8 | ||
| 9 | 7 | struct tempsprite |
| 10 | 8 | { |
| 11 | 9 | int gfx; |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "deprecat.h" |
| 3 | 3 | #include "video/ppu2c0x.h" |
| 4 | #include "includes/vsnes.h" | |
| 4 | 5 | |
| 5 | /* from machine */ | |
| 6 | extern int vsnes_gun_controller; | |
| 7 | 6 | |
| 8 | ||
| 9 | 7 | PALETTE_INIT( vsnes ) |
| 10 | 8 | { |
| 11 | 9 | ppu2c0x_init_palette(machine, 0 ); |
| r2844 | r2845 | |
|---|---|---|
| 41 | 41 | |
| 42 | 42 | VIDEO_START( cninja ) |
| 43 | 43 | { |
| 44 | deco16_2_video_init(1); | |
| 44 | deco16_2_video_init(machine, 1); | |
| 45 | 45 | |
| 46 | 46 | deco16_set_tilemap_bank_callback(2,cninja_bank_callback); |
| 47 | 47 | deco16_set_tilemap_bank_callback(3,cninja_bank_callback); |
| r2844 | r2845 | |
| 50 | 50 | |
| 51 | 51 | VIDEO_START( stoneage ) |
| 52 | 52 | { |
| 53 | deco16_2_video_init(1); | |
| 53 | deco16_2_video_init(machine, 1); | |
| 54 | 54 | |
| 55 | 55 | deco16_set_tilemap_bank_callback(2,edrandy_bank_callback); |
| 56 | 56 | deco16_set_tilemap_bank_callback(3,edrandy_bank_callback); |
| r2844 | r2845 | |
| 64 | 64 | |
| 65 | 65 | VIDEO_START( edrandy ) |
| 66 | 66 | { |
| 67 | deco16_2_video_init(0); | |
| 67 | deco16_2_video_init(machine, 0); | |
| 68 | 68 | |
| 69 | 69 | deco16_set_tilemap_bank_callback(2,edrandy_bank_callback); |
| 70 | 70 | deco16_set_tilemap_bank_callback(3,edrandy_bank_callback); |
| r2844 | r2845 | |
| 73 | 73 | |
| 74 | 74 | VIDEO_START( robocop2 ) |
| 75 | 75 | { |
| 76 | deco16_2_video_init(0); | |
| 76 | deco16_2_video_init(machine, 0); | |
| 77 | 77 | |
| 78 | 78 | deco16_set_tilemap_bank_callback(1,robocop2_bank_callback); |
| 79 | 79 | deco16_set_tilemap_bank_callback(2,robocop2_bank_callback); |
| r2844 | r2845 | |
| 83 | 83 | |
| 84 | 84 | VIDEO_START( mutantf ) |
| 85 | 85 | { |
| 86 | deco16_2_video_init(0); | |
| 86 | deco16_2_video_init(machine, 0); | |
| 87 | 87 | |
| 88 | 88 | deco16_set_tilemap_bank_callback(0,mutantf_1_bank_callback); |
| 89 | 89 | deco16_set_tilemap_bank_callback(1,mutantf_2_bank_callback); |
| r2844 | r2845 | |
|---|---|---|
| 45 | 45 | VIDEO_START( djboy ) |
| 46 | 46 | { |
| 47 | 47 | background = tilemap_create(get_bg_tile_info,tilemap_scan_rows,16,16,64,32); |
| 48 | pandora_start(0,0,0); | |
| 48 | pandora_start(machine,0,0,0); | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | WRITE8_HANDLER( djboy_paletteram_w ) |
| r2844 | r2845 | |
|---|---|---|
| 82 | 82 | |
| 83 | 83 | VIDEO_START(tumblep) |
| 84 | 84 | { |
| 85 | deco16_1_video_init(); | |
| 85 | deco16_1_video_init(machine); | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | VIDEO_UPDATE(tumblep) |
| r2844 | r2845 | |
|---|---|---|
| 72 | 72 | |
| 73 | 73 | VIDEO_START(dietgo) |
| 74 | 74 | { |
| 75 | deco16_1_video_init(); | |
| 75 | deco16_1_video_init(machine); | |
| 76 | 76 | |
| 77 | 77 | deco16_set_tilemap_bank_callback(0, dietgo_bank_callback); |
| 78 | 78 | deco16_set_tilemap_bank_callback(1, dietgo_bank_callback); |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "video/resnet.h" |
| 11 | #include "includes/taitosj.h" | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | #define GLOBAL_FLIP_X (*taitosj_video_mode & 0x01) |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ******************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "deprecat.h" | |
| 11 | 10 | #include "nb1413m3.h" |
| 12 | 11 | |
| 13 | 12 | |
| r2844 | r2845 | |
| 27 | 26 | static UINT8 *nbmj8991_clut; |
| 28 | 27 | |
| 29 | 28 | |
| 30 | static void nbmj8991_vramflip(void); | |
| 31 | static void nbmj8991_gfxdraw(void); | |
| 32 | static void update_pixel(int x, int y); | |
| 29 | static void nbmj8991_vramflip(running_machine *machine); | |
| 30 | static void nbmj8991_gfxdraw(running_machine *machine); | |
| 31 | static void update_pixel(running_machine *machine, int x, int y); | |
| 33 | 32 | |
| 34 | 33 | |
| 35 | 34 | /****************************************************************************** |
| r2844 | r2845 | |
| 105 | 104 | case 0x04: blitter_sizex = data; break; |
| 106 | 105 | case 0x05: blitter_sizey = data; |
| 107 | 106 | /* writing here also starts the blit */ |
| 108 | nbmj8991_gfxdraw(); | |
| 107 | nbmj8991_gfxdraw(machine); | |
| 109 | 108 | break; |
| 110 | 109 | case 0x06: blitter_direction_x = (data & 0x01) ? 1 : 0; |
| 111 | 110 | blitter_direction_y = (data & 0x02) ? 1 : 0; |
| 112 | 111 | nbmj8991_flipscreen = (data & 0x04) ? 0 : 1; |
| 113 | 112 | nbmj8991_dispflag = (data & 0x10) ? 0 : 1; |
| 114 | nbmj8991_vramflip(); | |
| 113 | nbmj8991_vramflip(machine); | |
| 115 | 114 | break; |
| 116 | 115 | case 0x07: break; |
| 117 | 116 | case 0x10: blitter_destx = (blitter_destx & 0xff00) | data; break; |
| r2844 | r2845 | |
| 150 | 149 | |
| 151 | 150 | |
| 152 | 151 | ******************************************************************************/ |
| 153 | static void nbmj8991_vramflip( | |
| 152 | static void nbmj8991_vramflip(running_machine *machine) | |
| 154 | 153 | { |
| 155 | 154 | static int nbmj8991_flipscreen_old = 0; |
| 156 | 155 | int x, y; |
| 157 | 156 | UINT8 color1, color2; |
| 158 | int width = video_screen_get_width(Machine->primary_screen); | |
| 159 | int height = video_screen_get_height(Machine->primary_screen); | |
| 157 | int width = video_screen_get_width(machine->primary_screen); | |
| 158 | int height = video_screen_get_height(machine->primary_screen); | |
| 160 | 159 | |
| 161 | 160 | if (nbmj8991_flipscreen == nbmj8991_flipscreen_old) return; |
| 162 | 161 | |
| r2844 | r2845 | |
| 181 | 180 | nbmj8991_screen_refresh = 1; |
| 182 | 181 | } |
| 183 | 182 | |
| 184 | static void update_pixel(int x, int y) | |
| 183 | static void update_pixel(running_machine *machine, int x, int y) | |
| 185 | 184 | { |
| 186 | UINT8 color = nbmj8991_videoram[(y * video_screen_get_width( | |
| 185 | UINT8 color = nbmj8991_videoram[(y * video_screen_get_width(machine->primary_screen)) + x]; | |
| 187 | 186 | *BITMAP_ADDR16(nbmj8991_tmpbitmap, y, x) = color; |
| 188 | 187 | } |
| 189 | 188 | |
| r2844 | r2845 | |
| 192 | 191 | nb1413m3_busyflag = 1; |
| 193 | 192 | } |
| 194 | 193 | |
| 195 | static void nbmj8991_gfxdraw( | |
| 194 | static void nbmj8991_gfxdraw(running_machine *machine) | |
| 196 | 195 | { |
| 197 | 196 | UINT8 *GFX = memory_region(REGION_GFX1); |
| 198 | int width = video_screen_get_width( | |
| 197 | int width = video_screen_get_width(machine->primary_screen); | |
| 199 | 198 | |
| 200 | 199 | int x, y; |
| 201 | 200 | int dx1, dx2, dy; |
| r2844 | r2845 | |
| 281 | 280 | if (color1 != 0xff) |
| 282 | 281 | { |
| 283 | 282 | nbmj8991_videoram[(dy * width) + dx1] = color1; |
| 284 | update_pixel(dx1, dy); | |
| 283 | update_pixel(machine, dx1, dy); | |
| 285 | 284 | } |
| 286 | 285 | if (color2 != 0xff) |
| 287 | 286 | { |
| 288 | 287 | nbmj8991_videoram[(dy * width) + dx2] = color2; |
| 289 | update_pixel(dx2, dy); | |
| 288 | update_pixel(machine, dx2, dy); | |
| 290 | 289 | } |
| 291 | 290 | |
| 292 | 291 | nb1413m3_busyctr++; |
| r2844 | r2845 | |
| 318 | 317 | |
| 319 | 318 | if (nbmj8991_screen_refresh) |
| 320 | 319 | { |
| 321 | int width = video_screen_get_width(Machine->primary_screen); | |
| 322 | int height = video_screen_get_height(Machine->primary_screen); | |
| 320 | int width = video_screen_get_width(screen->machine->primary_screen); | |
| 321 | int height = video_screen_get_height(screen->machine->primary_screen); | |
| 323 | 322 | |
| 324 | 323 | nbmj8991_screen_refresh = 0; |
| 325 | 324 | |
| 326 | 325 | for (y = 0; y < height; y++) |
| 327 | 326 | for (x = 0; x < width; x++) |
| 328 | update_pixel(x, y); | |
| 327 | update_pixel(screen->machine, x, y); | |
| 329 | 328 | } |
| 330 | 329 | |
| 331 | 330 | if (nbmj8991_dispflag) |
| r2844 | r2845 | |
| 364 | 363 | |
| 365 | 364 | for (y = 0; y < height; y++) |
| 366 | 365 | for (x = 0; x < width; x++) |
| 367 | update_pixel(x, y); | |
| 366 | update_pixel(screen->machine, x, y); | |
| 368 | 367 | } |
| 369 | 368 | |
| 370 | 369 | if (nb1413m3_inputport & 0x20) |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "deprecat.h" | |
| 3 | 2 | |
| 4 | 3 | |
| 5 | 4 | |
| r2844 | r2845 | |
| 8 | 7 | |
| 9 | 8 | |
| 10 | 9 | |
| 11 | static void setcolor(int color,int rgb) | |
| 10 | static void setcolor(running_machine *machine,int color,int rgb) | |
| 12 | 11 | { |
| 13 | 12 | int bit0,bit1,bit2,bit3; |
| 14 | 13 | int r,g,b; |
| r2844 | r2845 | |
| 35 | 34 | bit3 = (rgb >> 11) & 0x01; |
| 36 | 35 | b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; |
| 37 | 36 | |
| 38 | palette_set_color( | |
| 37 | palette_set_color(machine,color,MAKE_RGB(r,g,b)); | |
| 39 | 38 | } |
| 40 | 39 | |
| 41 | 40 | WRITE16_HANDLER( blockout_paletteram_w ) |
| 42 | 41 | { |
| 43 | 42 | COMBINE_DATA(&paletteram16[offset]); |
| 44 | setcolor(offset,paletteram16[offset]); | |
| 43 | setcolor(machine,offset,paletteram16[offset]); | |
| 45 | 44 | } |
| 46 | 45 | |
| 47 | 46 | WRITE16_HANDLER( blockout_frontcolor_w ) |
| r2844 | r2845 | |
| 49 | 48 | static UINT16 color; |
| 50 | 49 | |
| 51 | 50 | COMBINE_DATA(&color); |
| 52 | setcolor(512,color); | |
| 51 | setcolor(machine,512,color); | |
| 53 | 52 | } |
| 54 | 53 | |
| 55 | 54 |
| r2844 | r2845 | |
|---|---|---|
| 91 | 91 | draw_bombs(bitmap, cliprect); |
| 92 | 92 | |
| 93 | 93 | /* watchdog is disabled during service mode */ |
| 94 | watchdog_enable(screen->machine, !(input_port_read | |
| 94 | watchdog_enable(screen->machine, !(input_port_read | |
| 95 | 95 | |
| 96 | 96 | return 0; |
| 97 | 97 | } |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | /* video hardware for Namco System II */ |
| 2 | 2 | |
| 3 | 3 | #include "driver.h" |
| 4 | ||
| 4 | ||
| 5 | 5 | #include "namcos2.h" |
| 6 | 6 | #include "namcoic.h" |
| 7 | 7 | |
| r2844 | r2845 | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | int |
| 257 | namcos2_GetPosIrqScanline( | |
| 257 | namcos2_GetPosIrqScanline( running_machine *machine ) | |
| 258 | 258 | { |
| 259 | 259 | /* PaleteRegister(4)? used by Finest Hour; pc=0x356e */ |
| 260 | 260 | int scanline = GetPaletteRegister(5) - 34; |
| 261 | int height = video_screen_get_height( | |
| 261 | int height = video_screen_get_height(machine->primary_screen); | |
| 262 | 262 | if( scanline<0 ) |
| 263 | 263 | scanline = 0; |
| 264 | 264 | else if( scanline > height ) |
| r2844 | r2845 | |
| 268 | 268 | } /* namcos2_GetPosIrqScanline */ |
| 269 | 269 | |
| 270 | 270 | static void |
| 271 | UpdatePalette( | |
| 271 | UpdatePalette( running_machine *machine ) | |
| 272 | 272 | { |
| 273 | 273 | int bank; |
| 274 | 274 | for( bank=0; bank<0x20; bank++ ) |
| r2844 | r2845 | |
| 281 | 281 | int r = namcos2_68k_palette_ram[offset | 0x0000] & 0x00ff; |
| 282 | 282 | int g = namcos2_68k_palette_ram[offset | 0x0800] & 0x00ff; |
| 283 | 283 | int b = namcos2_68k_palette_ram[offset | 0x1000] & 0x00ff; |
| 284 | palette_set_color( | |
| 284 | palette_set_color(machine,pen++,MAKE_RGB(r,g,b)); | |
| 285 | 285 | offset++; |
| 286 | 286 | } |
| 287 | 287 | } |
| r2844 | r2845 | |
| 290 | 290 | /**************************************************************************/ |
| 291 | 291 | |
| 292 | 292 | static void |
| 293 | DrawSpriteInit( | |
| 293 | DrawSpriteInit( running_machine *machine ) | |
| 294 | 294 | { |
| 295 | 295 | int i; |
| 296 | 296 | /* set table for sprite color == 0x0f */ |
| r2844 | r2845 | |
| 302 | 302 | gfx_drawmode_table[255] = DRAWMODE_NONE; |
| 303 | 303 | for( i = 0; i<16*256; i++ ) |
| 304 | 304 | { |
| 305 | | |
| 305 | machine->shadow_table[i] = i+0x2000; | |
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | |
| r2844 | r2845 | |
| 323 | 323 | namco_tilemap_init(2,memory_region(REGION_GFX4),TilemapCB); |
| 324 | 324 | tilemap_roz = tilemap_create(get_tile_info_roz,tilemap_scan_rows,8,8,256,256); |
| 325 | 325 | tilemap_set_transparent_pen(tilemap_roz,0xff); |
| 326 | DrawSpriteInit(); | |
| 326 | DrawSpriteInit(machine); | |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | static void |
| r2844 | r2845 | |
| 345 | 345 | rectangle clip; |
| 346 | 346 | int pri; |
| 347 | 347 | |
| 348 | UpdatePalette(); | |
| 348 | UpdatePalette(screen->machine); | |
| 349 | 349 | fillbitmap( bitmap, get_black_pen(screen->machine), cliprect ); |
| 350 | 350 | ApplyClip( &clip, cliprect ); |
| 351 | 351 | |
| r2844 | r2845 | |
| 373 | 373 | VIDEO_START( finallap ) |
| 374 | 374 | { |
| 375 | 375 | namco_tilemap_init(2,memory_region(REGION_GFX4),TilemapCB); |
| 376 | DrawSpriteInit(); | |
| 376 | DrawSpriteInit(machine); | |
| 377 | 377 | namco_road_init(machine, 3); |
| 378 | 378 | } |
| 379 | 379 | |
| r2844 | r2845 | |
| 382 | 382 | rectangle clip; |
| 383 | 383 | int pri; |
| 384 | 384 | |
| 385 | UpdatePalette(); | |
| 385 | UpdatePalette(screen->machine); | |
| 386 | 386 | fillbitmap( bitmap, get_black_pen(screen->machine), cliprect ); |
| 387 | 387 | ApplyClip( &clip, cliprect ); |
| 388 | 388 | |
| r2844 | r2845 | |
| 419 | 419 | rectangle clip; |
| 420 | 420 | int pri; |
| 421 | 421 | |
| 422 | UpdatePalette(); | |
| 422 | UpdatePalette(screen->machine); | |
| 423 | 423 | fillbitmap( bitmap, get_black_pen(screen->machine), cliprect ); |
| 424 | 424 | ApplyClip( &clip, cliprect ); |
| 425 | 425 | |
| r2844 | r2845 | |
| 452 | 452 | rectangle clip; |
| 453 | 453 | int pri; |
| 454 | 454 | |
| 455 | UpdatePalette(); | |
| 455 | UpdatePalette(screen->machine); | |
| 456 | 456 | fillbitmap( bitmap, get_black_pen(screen->machine), cliprect ); |
| 457 | 457 | ApplyClip( &clip, cliprect ); |
| 458 | 458 | |
| r2844 | r2845 | |
| 478 | 478 | rectangle clip; |
| 479 | 479 | int pri; |
| 480 | 480 | |
| 481 | UpdatePalette(); | |
| 481 | UpdatePalette(screen->machine); | |
| 482 | 482 | fillbitmap( bitmap, get_black_pen(screen->machine), cliprect ); |
| 483 | 483 | ApplyClip( &clip, cliprect ); |
| 484 | 484 |
| r2844 | r2845 | |
|---|---|---|
| 128 | 128 | |
| 129 | 129 | while (multi >= 0) |
| 130 | 130 | { |
| 131 | deco16_pdrawgfx(bitmap,machine->gfx[gfxbank], | |
| 131 | deco16_pdrawgfx(machine, | |
| 132 | bitmap,machine->gfx[gfxbank], | |
| 132 | 133 | sprite - multi * inc, |
| 133 | 134 | colour, |
| 134 | 135 | fx,fy, |
| r2844 | r2845 | |
| 150 | 151 | |
| 151 | 152 | VIDEO_START( dassault ) |
| 152 | 153 | { |
| 153 | deco16_2_video_init(0); | |
| 154 | deco16_2_video_init(machine, 0); | |
| 154 | 155 | |
| 155 | 156 | deco16_set_tilemap_bank_callback(0,dassault_bank_callback); |
| 156 | 157 | deco16_set_tilemap_bank_callback(1,dassault_bank_callback); |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "deprecat.h" | |
| 3 | 2 | #include "tatsumi.h" |
| 4 | 3 | |
| 5 | 4 | static tilemap *tx_layer; |
| r2844 | r2845 | |
| 12 | 11 | UINT16* tatsumi_sprite_control_ram; |
| 13 | 12 | static UINT16* roundup5_vram; |
| 14 | 13 | |
| 15 | extern UINT16 bigfight_a40000[2]; | |
| 16 | 14 | static UINT16 bigfight_bank, bigfight_last_bank; |
| 17 | 15 | |
| 18 | 16 | static UINT8 roundupt_crt_selected_reg; |
| 19 | 17 | static UINT8 roundupt_crt_reg[64]; |
| 20 | extern UINT16 debugA,debugB,debugC,debugD; | |
| 21 | 18 | |
| 22 | 19 | static UINT8* shadow_pen_array; |
| 23 | 20 | |
| r2844 | r2845 | |
| 237 | 234 | |
| 238 | 235 | /********************************************************************/ |
| 239 | 236 | |
| 240 | INLINE void roundupt_drawgfxzoomrotate( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 237 | INLINE void roundupt_drawgfxzoomrotate( running_machine *machine, | |
| 238 | bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 241 | 239 | UINT32 code,UINT32 color,int flipx,int flipy,UINT32 ssx,UINT32 ssy, |
| 242 | 240 | const rectangle *clip, int scalex, int scaley, int rotate, int write_priority_only ) |
| 243 | 241 | { |
| r2844 | r2845 | |
| 271 | 269 | { |
| 272 | 270 | if( gfx ) |
| 273 | 271 | { |
| 274 | const pen_t *pal = & | |
| 272 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; | |
| 275 | 273 | const UINT8 *shadow_pens = shadow_pen_array + (gfx->color_granularity * (color % gfx->total_colors)); |
| 276 | 274 | int source_base = (code % gfx->total_elements) * gfx->height; |
| 277 | 275 | |
| r2844 | r2845 | |
| 632 | 630 | |
| 633 | 631 | for (w=0; w<x_width; w++) { |
| 634 | 632 | if (rotate) |
| 635 | roundupt_drawgfxzoomrotate(temp_bitmap,machine->gfx[0], | |
| 633 | roundupt_drawgfxzoomrotate(machine, | |
| 634 | temp_bitmap,machine->gfx[0], | |
| 636 | 635 | base, |
| 637 | 636 | color,fx,0,x_pos,render_y, |
| 638 | 637 | cliprect,scale,scale,0,write_priority_only); |
| 639 | 638 | else |
| 640 | roundupt_drawgfxzoomrotate(bitmap,machine->gfx[0], | |
| 639 | roundupt_drawgfxzoomrotate(machine, | |
| 640 | bitmap,machine->gfx[0], | |
| 641 | 641 | base, |
| 642 | 642 | color,fx,0,x_pos,render_y, |
| 643 | 643 | cliprect,scale,scale,0,write_priority_only); |
| r2844 | r2845 | |
|---|---|---|
| 85 | 85 | |
| 86 | 86 | VIDEO_START(supbtime) |
| 87 | 87 | { |
| 88 | deco16_1_video_init(); | |
| 88 | deco16_1_video_init(machine); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | VIDEO_UPDATE(supbtime) |
| r2844 | r2845 | |
|---|---|---|
| 41 | 41 | Rock 'n Rage / GX620*1986 6309 007342 007420 007327 |
| 42 | 42 | Koi no Hotrock |
| 43 | 43 | Mr Kabuki/Mr Goemon GX621*1986 Z80 005849 |
| 44 | Jackal GX631*1986 6809 | |
| 44 | Jackal GX631*1986 6809 | |
| 45 | 45 | Contra / Gryzor GX633*1987 6809? 007121(x2) 007593 |
| 46 | 46 | Flak Attack GX669*1987 6309 007121 007327 007452 |
| 47 | 47 | Devil World / Dark GX687*1987 2x68000 TWIN16 |
| r2844 | r2845 | |
| 1149 | 1149 | ***************************************************************************/ |
| 1150 | 1150 | |
| 1151 | 1151 | #include "driver.h" |
| 1152 | #include "deprecat.h" | |
| 1153 | 1152 | #include "video/konamiic.h" |
| 1154 | 1153 | |
| 1155 | 1154 | #define VERBOSE 0 |
| r2844 | r2845 | |
| 7486 | 7485 | |
| 7487 | 7486 | // The DMA process should be instantaneous but since rendering in MAME is performed at VIDEO_UPDATE() |
| 7488 | 7487 | // the K053250 memory must be buffered to maintain visual integrity. |
| 7489 | void K053250_dma(int chip, int limiter) | |
| 7488 | void K053250_dma(running_machine *machine, int chip, int limiter) | |
| 7490 | 7489 | { |
| 7491 | 7490 | struct K053250_CHIPTAG *chip_ptr; |
| 7492 | 7491 | int last_frame, current_frame; |
| 7493 | 7492 | |
| 7494 | 7493 | chip_ptr = &K053250_info.chip[chip]; |
| 7495 | 7494 | |
| 7496 | current_frame = video_screen_get_frame_number( | |
| 7495 | current_frame = video_screen_get_frame_number(machine->primary_screen); | |
| 7497 | 7496 | last_frame = chip_ptr->frame; |
| 7498 | 7497 | |
| 7499 | 7498 | if (limiter && current_frame == last_frame) return; // make sure we only do DMA transfer once per frame |
| r2844 | r2845 | |
| 7554 | 7553 | if (ACCESSING_BITS_0_7) |
| 7555 | 7554 | { |
| 7556 | 7555 | // start LVC DMA transfer at the falling edge of control register's bit1 |
| 7557 | if (offset == 4 && !(data & 2) && (K053250_info.chip[0].regs[4] & 2)) K053250_dma(0, 1); | |
| 7556 | if (offset == 4 && !(data & 2) && (K053250_info.chip[0].regs[4] & 2)) K053250_dma(machine, 0, 1); | |
| 7558 | 7557 | |
| 7559 | 7558 | K053250_info.chip[0].regs[offset] = data; |
| 7560 | 7559 | } |
| r2844 | r2845 | |
| 7587 | 7586 | if (ACCESSING_BITS_0_7) |
| 7588 | 7587 | { |
| 7589 | 7588 | // start LVC DMA transfer at the falling edge of control register's bit1 |
| 7590 | if (offset == 4 && !(data & 2) && (K053250_info.chip[1].regs[4] & 2)) K053250_dma(1, 1); | |
| 7589 | if (offset == 4 && !(data & 2) && (K053250_info.chip[1].regs[4] & 2)) K053250_dma(machine, 1, 1); | |
| 7591 | 7590 | |
| 7592 | 7591 | K053250_info.chip[1].regs[offset] = data; |
| 7593 | 7592 | } |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "includes/retofinv.h" | |
| 10 | 11 | |
| 11 | 12 | UINT8 *retofinv_bg_videoram; |
| 12 | 13 | UINT8 *retofinv_fg_videoram; |
| r2844 | r2845 | |
|---|---|---|
| 430 | 430 | void K053250_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int chip, int colorbase, int flags, int pri); |
| 431 | 431 | void K053250_set_LayerOffset(int chip, int offsx, int offsy); |
| 432 | 432 | void K053250_unpack_pixels(int region); |
| 433 | void K053250_dma(int chip, int limiter); | |
| 433 | void K053250_dma(running_machine *machine, int chip, int limiter); | |
| 434 | 434 | |
| 435 | 435 | |
| 436 | 436 | // K053252 CRT and interrupt control unit |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | ****************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | #include "deprecat.h" | |
| 9 | 8 | #include "cpu/tms34010/tms34010.h" |
| 10 | 9 | #include "cpu/tms34010/34010ops.h" |
| 11 | 10 | #include "harddriv.h" |
| r2844 | r2845 | |
| 209 | 208 | * |
| 210 | 209 | *************************************/ |
| 211 | 210 | |
| 212 | static void update_palette_bank(int newbank) | |
| 211 | static void update_palette_bank(running_machine *machine, int newbank) | |
| 213 | 212 | { |
| 214 | video_screen_update_partial( | |
| 213 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); | |
| 215 | 214 | gfx_palettebank = newbank; |
| 216 | 215 | } |
| 217 | 216 | |
| r2844 | r2845 | |
| 278 | 277 | break; |
| 279 | 278 | |
| 280 | 279 | case 0x02: |
| 281 | update_palette_bank((gfx_palettebank & ~1) | val); | |
| 280 | update_palette_bank(machine, (gfx_palettebank & ~1) | val); | |
| 282 | 281 | break; |
| 283 | 282 | |
| 284 | 283 | case 0x03: |
| 285 | update_palette_bank((gfx_palettebank & ~2) | (val << 1)); | |
| 284 | update_palette_bank(machine, (gfx_palettebank & ~2) | (val << 1)); | |
| 286 | 285 | break; |
| 287 | 286 | |
| 288 | 287 | case 0x04: |
| 289 | 288 | if (machine->config->total_colors >= 256 * 8) |
| 290 | update_palette_bank((gfx_palettebank & ~4) | (val << 2)); | |
| 289 | update_palette_bank(machine, (gfx_palettebank & ~4) | (val << 2)); | |
| 291 | 290 | break; |
| 292 | 291 | |
| 293 | 292 | case 0x07: |
| r2844 | r2845 | |
| 369 | 368 | * |
| 370 | 369 | *************************************/ |
| 371 | 370 | |
| 372 | INLINE void gsp_palette_change(int offset) | |
| 371 | INLINE void gsp_palette_change(running_machine *machine, int offset) | |
| 373 | 372 | { |
| 374 | 373 | int red = (hdgsp_paletteram_lo[offset] >> 8) & 0xff; |
| 375 | 374 | int green = hdgsp_paletteram_lo[offset] & 0xff; |
| 376 | 375 | int blue = hdgsp_paletteram_hi[offset] & 0xff; |
| 377 | palette_set_color( | |
| 376 | palette_set_color(machine, offset, MAKE_RGB(red, green, blue)); | |
| 378 | 377 | } |
| 379 | 378 | |
| 380 | 379 | |
| r2844 | r2845 | |
| 395 | 394 | offset = gfx_palettebank * 0x100 + (offset & 0xff); |
| 396 | 395 | |
| 397 | 396 | COMBINE_DATA(&hdgsp_paletteram_lo[offset]); |
| 398 | gsp_palette_change(offset); | |
| 397 | gsp_palette_change(machine, offset); | |
| 399 | 398 | } |
| 400 | 399 | |
| 401 | 400 | |
| r2844 | r2845 | |
| 423 | 422 | offset = gfx_palettebank * 0x100 + (offset & 0xff); |
| 424 | 423 | |
| 425 | 424 | COMBINE_DATA(&hdgsp_paletteram_hi[offset]); |
| 426 | gsp_palette_change(offset); | |
| 425 | gsp_palette_change(machine, offset); | |
| 427 | 426 | } |
| 428 | 427 | |
| 429 | 428 |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "deprecat.h" | |
| 3 | 2 | #include "audio/m72.h" |
| 4 | 3 | #include "m72.h" |
| 5 | 4 | |
| r2844 | r2845 | |
| 260 | 259 | return paletteram16_2[offset] | 0xffe0; /* only D0-D4 are connected */ |
| 261 | 260 | } |
| 262 | 261 | |
| 263 | INLINE void changecolor(int color,int r,int g,int b) | |
| 262 | INLINE void changecolor(running_machine *machine,int color,int r,int g,int b) | |
| 264 | 263 | { |
| 265 | palette_set_color_rgb( | |
| 264 | palette_set_color_rgb(machine,color,pal5bit(r),pal5bit(g),pal5bit(b)); | |
| 266 | 265 | } |
| 267 | 266 | |
| 268 | 267 | WRITE16_HANDLER( m72_palette1_w ) |
| r2844 | r2845 | |
| 272 | 271 | |
| 273 | 272 | COMBINE_DATA(&paletteram16[offset]); |
| 274 | 273 | offset &= 0x0ff; |
| 275 | changecolor(offset, | |
| 274 | changecolor(machine, | |
| 275 | offset, | |
| 276 | 276 | paletteram16[offset + 0x000], |
| 277 | 277 | paletteram16[offset + 0x200], |
| 278 | 278 | paletteram16[offset + 0x400]); |
| r2844 | r2845 | |
| 285 | 285 | |
| 286 | 286 | COMBINE_DATA(&paletteram16_2[offset]); |
| 287 | 287 | offset &= 0x0ff; |
| 288 | changecolor(offset + 256, | |
| 288 | changecolor(machine, | |
| 289 | offset + 256, | |
| 289 | 290 | paletteram16_2[offset + 0x000], |
| 290 | 291 | paletteram16_2[offset + 0x200], |
| 291 | 292 | paletteram16_2[offset + 0x400]); |
| r2844 | r2845 | |
|---|---|---|
| 75 | 75 | |
| 76 | 76 | READ8_HANDLER( aeroboto_in0_r ) |
| 77 | 77 | { |
| 78 | char port[4]; | |
| 79 | ||
| 80 | sprintf(port, "IN%d", flip_screen_get() ? 1 : 0); | |
| 81 | return input_port_read(machine, port); | |
| 78 | return input_port_read(machine, flip_screen_get() ? "IN1" : "IN0"); | |
| 82 | 79 | } |
| 83 | 80 | |
| 84 | 81 | WRITE8_HANDLER( aeroboto_3000_w ) |
| r2844 | r2845 | |
|---|---|---|
| 117 | 117 | atarigen_playfield_tilemap = tilemap_create(get_playfield_tile_info, tilemap_scan_rows, 8,8, 64,64); |
| 118 | 118 | |
| 119 | 119 | /* initialize the motion objects */ |
| 120 | atarirle_init(0, atarig1_pitfight ? &modesc_pitfight : &modesc_hydra); | |
| 120 | atarirle_init(machine, 0, atarig1_pitfight ? &modesc_pitfight : &modesc_hydra); | |
| 121 | 121 | |
| 122 | 122 | /* initialize the alphanumerics */ |
| 123 | 123 | atarigen_alpha_tilemap = tilemap_create(get_alpha_tile_info, tilemap_scan_rows, 8,8, 64,32); |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | #include "includes/legionna.h" | |
| 8 | 9 | |
| 9 | 10 | UINT16 *legionna_back_data,*legionna_fore_data,*legionna_mid_data,*legionna_scrollram16,*legionna_textram; |
| 10 | 11 |
| r2844 | r2845 | |
|---|---|---|
| 46 | 46 | tileinfo->category = (color & 0x30) ? 1 : 0; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | INLINE void bomblord_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer) | |
| 50 | { | |
| 51 | int tile,color; | |
| 52 | tile_index = 2*tile_index + (layer * 0x2000); | |
| 49 | 53 | |
| 54 | tile=m90_video_data[tile_index]; | |
| 55 | color=m90_video_data[tile_index+1]; | |
| 56 | SET_TILE_INFO( | |
| 57 | 0, | |
| 58 | tile, | |
| 59 | color&0xf, | |
| 60 | TILE_FLIPYX((color & 0xc0) >> 6)); | |
| 61 | tileinfo->category = (color & 0x30) ? 1 : 0; | |
| 62 | } | |
| 63 | ||
| 64 | INLINE void dynablsb_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer) | |
| 65 | { | |
| 66 | int tile,color; | |
| 67 | tile_index = 2*tile_index + (layer * 0x2000); | |
| 68 | ||
| 69 | tile=m90_video_data[tile_index]; | |
| 70 | color=m90_video_data[tile_index+1]; | |
| 71 | SET_TILE_INFO( | |
| 72 | 0, | |
| 73 | tile, | |
| 74 | color&0xf, | |
| 75 | TILE_FLIPYX((color & 0xc0) >> 6)); | |
| 76 | tileinfo->category = (color & 0x30) ? 1 : 0; | |
| 77 | } | |
| 78 | ||
| 50 | 79 | static TILE_GET_INFO( get_pf1_tile_info ) { get_tile_info(machine,tileinfo,tile_index,0,0x3); } |
| 51 | 80 | static TILE_GET_INFO( get_pf1w_tile_info ) { get_tile_info(machine,tileinfo,tile_index,0,0x2); } |
| 52 | 81 | static TILE_GET_INFO( get_pf2_tile_info ) { get_tile_info(machine,tileinfo,tile_index,1,0x3); } |
| 53 | 82 | static TILE_GET_INFO( get_pf2w_tile_info ) { get_tile_info(machine,tileinfo,tile_index,1,0x2); } |
| 54 | 83 | |
| 84 | static TILE_GET_INFO( bomblord_get_pf1_tile_info ) { bomblord_get_tile_info(machine,tileinfo,tile_index,0); } | |
| 85 | static TILE_GET_INFO( bomblord_get_pf1w_tile_info ) { bomblord_get_tile_info(machine,tileinfo,tile_index,0); } | |
| 86 | static TILE_GET_INFO( bomblord_get_pf2_tile_info ) { bomblord_get_tile_info(machine,tileinfo,tile_index,2); } | |
| 87 | static TILE_GET_INFO( bomblord_get_pf2w_tile_info ) { bomblord_get_tile_info(machine,tileinfo,tile_index,2); } | |
| 55 | 88 | |
| 89 | static TILE_GET_INFO( dynablsb_get_pf1_tile_info ) { dynablsb_get_tile_info(machine,tileinfo,tile_index,0); } | |
| 90 | static TILE_GET_INFO( dynablsb_get_pf1w_tile_info ) { dynablsb_get_tile_info(machine,tileinfo,tile_index,0); } | |
| 91 | static TILE_GET_INFO( dynablsb_get_pf2_tile_info ) { dynablsb_get_tile_info(machine,tileinfo,tile_index,2); } | |
| 92 | static TILE_GET_INFO( dynablsb_get_pf2w_tile_info ) { dynablsb_get_tile_info(machine,tileinfo,tile_index,2); } | |
| 93 | ||
| 56 | 94 | VIDEO_START( m90 ) |
| 57 | 95 | { |
| 58 | 96 | pf1_layer = tilemap_create(get_pf1_tile_info, tilemap_scan_rows,8,8,64,64); |
| r2844 | r2845 | |
| 66 | 104 | state_save_register_global_array(m90_video_control_data); |
| 67 | 105 | } |
| 68 | 106 | |
| 107 | VIDEO_START( bomblord ) | |
| 108 | { | |
| 109 | pf1_layer = tilemap_create(bomblord_get_pf1_tile_info, tilemap_scan_rows,8,8,64,64); | |
| 110 | pf1_wide_layer = tilemap_create(bomblord_get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64); | |
| 111 | pf2_layer = tilemap_create(bomblord_get_pf2_tile_info, tilemap_scan_rows,8,8,64,64); | |
| 112 | pf2_wide_layer = tilemap_create(bomblord_get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64); | |
| 113 | ||
| 114 | tilemap_set_transparent_pen(pf2_layer,0); | |
| 115 | tilemap_set_transparent_pen(pf2_wide_layer,0); | |
| 116 | tilemap_set_transparent_pen(pf1_layer,0); | |
| 117 | tilemap_set_transparent_pen(pf1_wide_layer,0); | |
| 118 | ||
| 119 | state_save_register_global_array(m90_video_control_data); | |
| 120 | } | |
| 121 | ||
| 122 | VIDEO_START( dynablsb ) | |
| 123 | { | |
| 124 | pf1_layer = tilemap_create(dynablsb_get_pf1_tile_info, tilemap_scan_rows,8,8,64,64); | |
| 125 | pf1_wide_layer = tilemap_create(dynablsb_get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64); | |
| 126 | pf2_layer = tilemap_create(dynablsb_get_pf2_tile_info, tilemap_scan_rows,8,8,64,64); | |
| 127 | pf2_wide_layer = tilemap_create(dynablsb_get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64); | |
| 128 | ||
| 129 | tilemap_set_transparent_pen(pf2_layer,0); | |
| 130 | tilemap_set_transparent_pen(pf2_wide_layer,0); | |
| 131 | ||
| 132 | state_save_register_global_array(m90_video_control_data); | |
| 133 | } | |
| 134 | ||
| 69 | 135 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) |
| 70 | 136 | { |
| 71 | 137 | int offs; |
| r2844 | r2845 | |
| 118 | 184 | } |
| 119 | 185 | } |
| 120 | 186 | |
| 121 | #if 0 | |
| 122 | static void bootleg_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) | |
| 187 | static void bomblord_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) | |
| 123 | 188 | { |
| 124 | int offs; | |
| 189 | int offs = 0, last_sprite = 0; | |
| 190 | int x,y,sprite,colour,fx,fy; | |
| 125 | 191 | |
| 126 | for (offs = 0x0;offs <0x800-8;offs+= 8) { | |
| 127 | int x,y,sprite,colour,fx,fy; | |
| 128 | 192 | |
| 129 | if (/*spriteram[offs+0]==0x78 &&*/ spriteram[offs+1]==0x7f) continue; | |
| 193 | while ((offs < spriteram_size/2) & (spriteram16[offs+0] != 0x8000)) | |
| 194 | { | |
| 195 | last_sprite = offs; | |
| 196 | offs += 4; | |
| 197 | } | |
| 130 | 198 | |
| 131 | y=(spriteram[offs+0] | (spriteram[offs+1]<<8))&0x1ff; | |
| 132 | x=(spriteram[offs+6] | (spriteram[offs+7]<<8))&0x1ff; | |
| 199 | for (offs = last_sprite; offs >= 0; offs -= 4) | |
| 200 | { | |
| 201 | sprite = spriteram16[offs+1]; | |
| 202 | colour = (spriteram16[offs+2] >> 9) & 0x0f; | |
| 133 | 203 | |
| 134 | x = x - /*64 -*/ 16; | |
| 135 | y = 256 - /*32 -*/ y; | |
| 204 | y = (spriteram16[offs+0] & 0x1ff) + 152; | |
| 205 | x = (spriteram16[offs+3] & 0x1ff) + 16; | |
| 136 | 206 | |
| 137 | sprite=(spriteram[offs+2] | (spriteram[offs+3]<<8)); | |
| 138 | colour=(spriteram[offs+5]>>1)&0xf; | |
| 207 | x = x - 16; | |
| 208 | y = 512 - y; | |
| 139 | 209 | |
| 140 | fx=spriteram[offs+5]&1; | |
| 141 | fy=0;//spriteram[offs+5]&2; | |
| 210 | if (y < 0) y += 512; | |
| 142 | 211 | |
| 143 | drawgfx(bitmap,machine->gfx[1], | |
| 144 | sprite&0x1fff, | |
| 212 | fx = (spriteram16[offs+3] >> 8) & 0x02; | |
| 213 | fy = (spriteram16[offs+2] >> 8) & 0x80; | |
| 214 | ||
| 215 | pdrawgfx(bitmap,machine->gfx[1], | |
| 216 | sprite, | |
| 145 | 217 | colour, |
| 146 | 218 | fx,fy, |
| 147 | 219 | x,y, |
| 148 | cliprect,TRANSPARENCY_PEN,0); | |
| 220 | cliprect,TRANSPARENCY_PEN,0, | |
| 221 | (colour & 0x08) ? 0x00 : 0x02); | |
| 149 | 222 | } |
| 150 | 223 | } |
| 151 | #endif | |
| 152 | 224 | |
| 225 | static void dynablsb_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) | |
| 226 | { | |
| 227 | int offs = 0, last_sprite = 0; | |
| 228 | int x,y,sprite,colour,fx,fy; | |
| 229 | ||
| 230 | while ((offs < spriteram_size/2) & (spriteram16[offs+0] != 0xffff)) | |
| 231 | { | |
| 232 | last_sprite = offs; | |
| 233 | offs += 4; | |
| 234 | } | |
| 235 | ||
| 236 | for (offs = last_sprite; offs >= 0; offs -= 4) | |
| 237 | { | |
| 238 | sprite = spriteram16[offs+1]; | |
| 239 | colour = (spriteram16[offs+2] >> 9) & 0x0f; | |
| 240 | ||
| 241 | y = (spriteram16[offs+0] & 0x1ff) + 288; | |
| 242 | x = (spriteram16[offs+3] & 0x1ff) - 64; | |
| 243 | ||
| 244 | x = x - 16; | |
| 245 | y = 512 - y; | |
| 246 | ||
| 247 | if (y < 0) y += 512; | |
| 248 | ||
| 249 | fx = (spriteram16[offs+3] >> 8) & 0x02; | |
| 250 | fy = (spriteram16[offs+2] >> 8) & 0x80; | |
| 251 | ||
| 252 | pdrawgfx(bitmap,machine->gfx[1], | |
| 253 | sprite, | |
| 254 | colour, | |
| 255 | fx,fy, | |
| 256 | x,y, | |
| 257 | cliprect,TRANSPARENCY_PEN,0, | |
| 258 | (colour & 0x08) ? 0x00 : 0x02); | |
| 259 | } | |
| 260 | } | |
| 261 | ||
| 153 | 262 | WRITE16_HANDLER( m90_video_control_w ) |
| 154 | 263 | { |
| 155 | 264 | COMBINE_DATA(&m90_video_control_data[offset]); |
| 265 | // printf("%04x-%04x ",offset,m90_video_control_data[offset]); | |
| 156 | 266 | } |
| 157 | 267 | |
| 158 | ||
| 159 | 268 | static void markdirty(tilemap *tmap,int page,offs_t offset) |
| 160 | 269 | { |
| 161 | 270 | offset -= page * 0x2000; |
| r2844 | r2845 | |
| 164 | 273 | tilemap_mark_tile_dirty(tmap,offset/2); |
| 165 | 274 | } |
| 166 | 275 | |
| 167 | ||
| 168 | 276 | WRITE16_HANDLER( m90_video_w ) |
| 169 | 277 | { |
| 170 | 278 | COMBINE_DATA(&m90_video_data[offset]); |
| r2844 | r2845 | |
| 186 | 294 | if (m90_video_control_data[5]&0x10) pf1_enable=0; else pf1_enable=1; |
| 187 | 295 | if (m90_video_control_data[6]&0x10) pf2_enable=0; else pf2_enable=1; |
| 188 | 296 | |
| 189 | // tilemap_set_enable(pf1_layer,pf1_enable); | |
| 190 | // tilemap_set_enable(pf2_layer,pf2_enable); | |
| 191 | // tilemap_set_enable(pf1_wide_layer,pf1_enable); | |
| 192 | // tilemap_set_enable(pf2_wide_layer,pf2_enable); | |
| 297 | // tilemap_set_enable(pf1_layer,pf1_enable); | |
| 298 | // tilemap_set_enable(pf2_layer,pf2_enable); | |
| 299 | // tilemap_set_enable(pf1_wide_layer,pf1_enable); | |
| 300 | // tilemap_set_enable(pf2_wide_layer,pf2_enable); | |
| 193 | 301 | |
| 194 | 302 | /* Dirty tilemaps if VRAM base changes */ |
| 195 | 303 | if (pf1_base!=last_pf1) |
| r2844 | r2845 | |
| 253 | 361 | |
| 254 | 362 | if (pf2_enable) |
| 255 | 363 | { |
| 256 | if (m90_video_control_data[6] & 0x4) | |
| 364 | if (m90_video_control_data[6] & 0x4) { | |
| 257 | 365 | tilemap_draw(bitmap,cliprect,pf2_wide_layer,0,0); |
| 258 | else | |
| 366 | tilemap_draw(bitmap,cliprect,pf2_wide_layer,1,1); | |
| 367 | } else { | |
| 259 | 368 | tilemap_draw(bitmap,cliprect,pf2_layer,0,0); |
| 260 | ||
| 261 | if (m90_video_control_data[6] & 0x4) | |
| 262 | tilemap_draw(bitmap,cliprect,pf2_wide_layer,1,1); | |
| 263 | else | |
| 264 | 369 | tilemap_draw(bitmap,cliprect,pf2_layer,1,1); |
| 370 | } | |
| 265 | 371 | } |
| 266 | 372 | |
| 267 | 373 | if (pf1_enable) |
| 268 | 374 | { |
| 269 | if (m90_video_control_data[5] & 0x4) | |
| 375 | if (m90_video_control_data[5] & 0x4) { | |
| 270 | 376 | tilemap_draw(bitmap,cliprect,pf1_wide_layer,0,0); |
| 271 | else | |
| 377 | tilemap_draw(bitmap,cliprect,pf1_wide_layer,1,1); | |
| 378 | } else { | |
| 272 | 379 | tilemap_draw(bitmap,cliprect,pf1_layer,0,0); |
| 273 | ||
| 274 | if (m90_video_control_data[5] & 0x4) | |
| 275 | tilemap_draw(bitmap,cliprect,pf1_wide_layer,1,1); | |
| 276 | else | |
| 277 | 380 | tilemap_draw(bitmap,cliprect,pf1_layer,1,1); |
| 381 | } | |
| 278 | 382 | } |
| 279 | 383 | |
| 280 | 384 | draw_sprites(screen->machine,bitmap,cliprect); |
| r2844 | r2845 | |
| 284 | 388 | |
| 285 | 389 | return 0; |
| 286 | 390 | } |
| 391 | ||
| 392 | VIDEO_UPDATE( bomblord ) | |
| 393 | { | |
| 394 | int i; | |
| 395 | fillbitmap(priority_bitmap,0,cliprect); | |
| 396 | fillbitmap(bitmap,get_black_pen(screen->machine),cliprect); | |
| 397 | ||
| 398 | /* Setup scrolling */ | |
| 399 | if (m90_video_control_data[6]&0x20) { | |
| 400 | tilemap_set_scroll_rows(pf1_layer,512); | |
| 401 | tilemap_set_scroll_rows(pf1_wide_layer,512); | |
| 402 | for (i=0; i<512; i++) | |
| 403 | tilemap_set_scrollx( pf1_layer,i, m90_video_data[0xf400/2+i]-12); | |
| 404 | for (i=0; i<512; i++) | |
| 405 | tilemap_set_scrollx( pf1_wide_layer,i, m90_video_data[0xf400/2+i]-12+256); | |
| 406 | } else { | |
| 407 | tilemap_set_scroll_rows(pf1_layer,1); | |
| 408 | tilemap_set_scroll_rows(pf1_wide_layer,1); | |
| 409 | tilemap_set_scrollx( pf1_layer,0, m90_video_data[0xf004/2]-12); | |
| 410 | tilemap_set_scrollx( pf1_wide_layer,0, m90_video_data[0xf004/2]-12 ); | |
| 411 | } | |
| 412 | ||
| 413 | if (m90_video_control_data[6] & 0x02) { | |
| 414 | tilemap_mark_all_tiles_dirty(pf2_wide_layer); | |
| 415 | tilemap_set_scrollx( pf2_wide_layer,0, m90_video_data[0xf000/2]-16 ); | |
| 416 | tilemap_set_scrolly( pf2_wide_layer,0, m90_video_data[0xf008/2]+388 ); | |
| 417 | tilemap_draw(bitmap,cliprect,pf2_wide_layer,0,0); | |
| 418 | tilemap_draw(bitmap,cliprect,pf2_wide_layer,1,1); | |
| 419 | } else { | |
| 420 | tilemap_mark_all_tiles_dirty(pf2_layer); | |
| 421 | tilemap_set_scrollx( pf2_layer,0, m90_video_data[0xf000/2]-16 ); | |
| 422 | tilemap_set_scrolly( pf2_layer,0, m90_video_data[0xf008/2]-120 ); | |
| 423 | tilemap_draw(bitmap,cliprect,pf2_layer,0,0); | |
| 424 | tilemap_draw(bitmap,cliprect,pf2_layer,1,1); | |
| 425 | } | |
| 426 | ||
| 427 | if (m90_video_control_data[6] & 0x04) { | |
| 428 | tilemap_mark_all_tiles_dirty(pf1_wide_layer); | |
| 429 | tilemap_set_scrolly( pf1_wide_layer,0, m90_video_data[0xf00c/2]+392 ); | |
| 430 | tilemap_draw(bitmap,cliprect,pf1_wide_layer,0,0); | |
| 431 | tilemap_draw(bitmap,cliprect,pf1_wide_layer,1,1); | |
| 432 | } else { | |
| 433 | tilemap_mark_all_tiles_dirty(pf1_layer); | |
| 434 | tilemap_set_scrolly( pf1_layer,0, m90_video_data[0xf00c/2]-116 ); | |
| 435 | tilemap_draw(bitmap,cliprect,pf1_layer,0,0); | |
| 436 | tilemap_draw(bitmap,cliprect,pf1_layer,1,1); | |
| 437 | } | |
| 438 | ||
| 439 | bomblord_draw_sprites(screen->machine,bitmap,cliprect); | |
| 440 | ||
| 441 | return 0; | |
| 442 | } | |
| 443 | ||
| 444 | VIDEO_UPDATE( dynablsb ) | |
| 445 | { | |
| 446 | fillbitmap(priority_bitmap,0,cliprect); | |
| 447 | fillbitmap(bitmap,get_black_pen(screen->machine),cliprect); | |
| 448 | ||
| 449 | if (!(m90_video_data[0xf008/2] & 0x4000)) { | |
| 450 | tilemap_mark_all_tiles_dirty(pf1_wide_layer); | |
| 451 | tilemap_set_scroll_rows(pf1_wide_layer,1); | |
| 452 | tilemap_set_scrollx( pf1_wide_layer,0, m90_video_data[0xf004/2]+64); | |
| 453 | tilemap_set_scrolly( pf1_wide_layer,0, m90_video_data[0xf006/2]+512); | |
| 454 | tilemap_draw(bitmap,cliprect,pf1_wide_layer,0,0); | |
| 455 | tilemap_draw(bitmap,cliprect,pf1_wide_layer,1,1); | |
| 456 | } else { | |
| 457 | tilemap_mark_all_tiles_dirty(pf1_layer); | |
| 458 | tilemap_set_scroll_rows(pf1_layer,1); | |
| 459 | tilemap_set_scrollx( pf1_layer,0, m90_video_data[0xf004/2]+64); | |
| 460 | tilemap_set_scrolly( pf1_layer,0, m90_video_data[0xf006/2]+4); | |
| 461 | tilemap_draw(bitmap,cliprect,pf1_layer,0,0); | |
| 462 | tilemap_draw(bitmap,cliprect,pf1_layer,1,1); | |
| 463 | } | |
| 464 | ||
| 465 | if (!(m90_video_data[0xf008/2] & 0x8000)) { | |
| 466 | tilemap_mark_all_tiles_dirty(pf2_wide_layer); | |
| 467 | tilemap_set_scroll_rows(pf2_wide_layer,1); | |
| 468 | tilemap_set_scrollx( pf2_wide_layer,0, m90_video_data[0xf000/2]+68); | |
| 469 | tilemap_set_scrolly( pf2_wide_layer,0, m90_video_data[0xf002/2]+512); | |
| 470 | tilemap_draw(bitmap,cliprect,pf2_wide_layer,0,0); | |
| 471 | tilemap_draw(bitmap,cliprect,pf2_wide_layer,1,1); | |
| 472 | } else { | |
| 473 | tilemap_mark_all_tiles_dirty(pf2_layer); | |
| 474 | tilemap_set_scroll_rows(pf2_layer,1); | |
| 475 | tilemap_set_scrollx( pf2_layer,0, m90_video_data[0xf000/2]+68); | |
| 476 | tilemap_set_scrolly( pf2_layer,0, m90_video_data[0xf002/2]+4); | |
| 477 | tilemap_draw(bitmap,cliprect,pf2_layer,0,0); | |
| 478 | tilemap_draw(bitmap,cliprect,pf2_layer,1,1); | |
| 479 | } | |
| 480 | ||
| 481 | dynablsb_draw_sprites(screen->machine,bitmap,cliprect); | |
| 482 | ||
| 483 | return 0; | |
| 484 | } |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "deprecat.h" |
| 3 | 3 | #include "video/ppu2c0x.h" |
| 4 | #include "includes/playch10.h" | |
| 4 | 5 | |
| 5 | /* from machine */ | |
| 6 | extern int pc10_sdcs; /* ShareD Chip Select */ | |
| 7 | extern int pc10_dispmask; /* Display Mask */ | |
| 8 | extern int pc10_gun_controller; /* whether we need to draw a crosshair or not */ | |
| 9 | extern int pc10_int_detect; | |
| 10 | extern int pc10_game_mode; | |
| 11 | extern int pc10_dispmask_old; | |
| 12 | ||
| 13 | 6 | static int pc10_bios; |
| 14 | 7 | |
| 15 | 8 | static tilemap *bg_tilemap; |
| r2844 | r2845 | |
|---|---|---|
| 947 | 947 | } |
| 948 | 948 | |
| 949 | 949 | |
| 950 | static void antic_linerefresh( | |
| 950 | static void antic_linerefresh(running_machine *machine) | |
| 951 | 951 | { |
| 952 | 952 | int x, y; |
| 953 | 953 | UINT8 *src; |
| r2844 | r2845 | |
| 955 | 955 | UINT32 scanline[4 + (HCHARS * 2) + 4]; |
| 956 | 956 | |
| 957 | 957 | /* increment the scanline */ |
| 958 | if( ++antic.scanline == video_screen_get_height( | |
| 958 | if( ++antic.scanline == video_screen_get_height(machine->primary_screen) ) | |
| 959 | 959 | { |
| 960 | 960 | /* and return to the top if the frame was complete */ |
| 961 | 961 | antic.scanline = 0; |
| r2844 | r2845 | |
| 1055 | 1055 | draw_scanline8(tmpbitmap, 12, y, sizeof(scanline), (const UINT8 *) scanline, NULL, -1); |
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | static int cycle( | |
| 1058 | static int cycle(running_machine *machine) | |
| 1059 | 1059 | { |
| 1060 | return video_screen_get_hpos( | |
| 1060 | return video_screen_get_hpos(machine->primary_screen) * CYCLES_PER_LINE / video_screen_get_width(machine->primary_screen); | |
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | static void after(int cycles, timer_fired_func function, const char *funcname) | |
| 1063 | static void after(running_machine *machine, int cycles, timer_fired_func function, const char *funcname) | |
| 1064 | 1064 | { |
| 1065 | attotime duration = attotime_make(0, attotime_to_attoseconds(video_screen_get_scan_period( | |
| 1065 | attotime duration = attotime_make(0, attotime_to_attoseconds(video_screen_get_scan_period(machine->primary_screen)) * cycles / CYCLES_PER_LINE); | |
| 1066 | 1066 | (void)funcname; |
| 1067 | 1067 | LOG((" after %3d (%5.1f us) %s\n", cycles, attotime_to_double(duration) * 1.0e6, funcname)); |
| 1068 | 1068 | timer_set(duration, NULL, 0, function); |
| r2844 | r2845 | |
| 1072 | 1072 | { |
| 1073 | 1073 | if( antic.w.nmien & DLI_NMI ) |
| 1074 | 1074 | { |
| 1075 | LOG((" @cycle #%3d issue DLI\n", cycle())); | |
| 1075 | LOG((" @cycle #%3d issue DLI\n", cycle(machine))); | |
| 1076 | 1076 | antic.r.nmist |= DLI_NMI; |
| 1077 | 1077 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 1078 | 1078 | } |
| 1079 | 1079 | else |
| 1080 | 1080 | { |
| 1081 | LOG((" @cycle #%3d DLI not enabled\n", cycle())); | |
| 1081 | LOG((" @cycle #%3d DLI not enabled\n", cycle(machine))); | |
| 1082 | 1082 | } |
| 1083 | 1083 | } |
| 1084 | 1084 | |
| r2844 | r2845 | |
| 1138 | 1138 | *****************************************************************************/ |
| 1139 | 1139 | static TIMER_CALLBACK( antic_line_done ) |
| 1140 | 1140 | { |
| 1141 | LOG((" @cycle #%3d antic_line_done\n", cycle())); | |
| 1141 | LOG((" @cycle #%3d antic_line_done\n", cycle(machine))); | |
| 1142 | 1142 | if( antic.w.wsync ) |
| 1143 | 1143 | { |
| 1144 | LOG((" @cycle #%3d release WSYNC\n", cycle())); | |
| 1144 | LOG((" @cycle #%3d release WSYNC\n", cycle(machine))); | |
| 1145 | 1145 | /* release the CPU if it was actually waiting for HSYNC */ |
| 1146 | 1146 | cpu_trigger(machine, TRIGGER_HSYNC); |
| 1147 | 1147 | /* and turn off the 'wait for hsync' flag */ |
| 1148 | 1148 | antic.w.wsync = 0; |
| 1149 | 1149 | } |
| 1150 | LOG((" @cycle #%3d release CPU\n", cycle())); | |
| 1150 | LOG((" @cycle #%3d release CPU\n", cycle(machine))); | |
| 1151 | 1151 | /* release the CPU (held for emulating cycles stolen by ANTIC DMA) */ |
| 1152 | 1152 | cpu_trigger(machine, TRIGGER_STEAL); |
| 1153 | 1153 | |
| 1154 | 1154 | /* refresh the display (translate color clocks to pixels) */ |
| 1155 | antic_linerefresh(); | |
| 1155 | antic_linerefresh(machine); | |
| 1156 | 1156 | } |
| 1157 | 1157 | |
| 1158 | 1158 | /***************************************************************************** |
| r2844 | r2845 | |
| 1166 | 1166 | *****************************************************************************/ |
| 1167 | 1167 | static TIMER_CALLBACK( antic_steal_cycles ) |
| 1168 | 1168 | { |
| 1169 | LOG((" @cycle #%3d steal %d cycles\n", cycle(), antic.steal_cycles)); | |
| 1170 | after(antic.steal_cycles, antic_line_done, "antic_line_done"); | |
| 1169 | LOG((" @cycle #%3d steal %d cycles\n", cycle(machine), antic.steal_cycles)); | |
| 1170 | after(machine, antic.steal_cycles, antic_line_done, "antic_line_done"); | |
| 1171 | 1171 | antic.steal_cycles = 0; |
| 1172 | 1172 | cpunum_spinuntil_trigger( 0, TRIGGER_STEAL ); |
| 1173 | 1173 | } |
| r2844 | r2845 | |
| 1184 | 1184 | static TIMER_CALLBACK( antic_scanline_render ) |
| 1185 | 1185 | { |
| 1186 | 1186 | VIDEO *video = antic.video[antic.scanline]; |
| 1187 | LOG((" @cycle #%3d render mode $%X lines to go #%d\n", cycle(), (antic.cmd & 0x0f), antic.modelines)); | |
| 1187 | LOG((" @cycle #%3d render mode $%X lines to go #%d\n", cycle(machine), (antic.cmd & 0x0f), antic.modelines)); | |
| 1188 | 1188 | |
| 1189 | 1189 | (*antic_renderer)(video); |
| 1190 | 1190 | |
| r2844 | r2845 | |
| 1236 | 1236 | |
| 1237 | 1237 | antic.steal_cycles += CYCLES_REFRESH; |
| 1238 | 1238 | LOG((" run CPU for %d cycles\n", CYCLES_HSYNC - CYCLES_HSTART - antic.steal_cycles)); |
| 1239 | after(CYCLES_HSYNC - CYCLES_HSTART - antic.steal_cycles, antic_steal_cycles, "antic_steal_cycles"); | |
| 1239 | after(machine, CYCLES_HSYNC - CYCLES_HSTART - antic.steal_cycles, antic_steal_cycles, "antic_steal_cycles"); | |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | |
| r2844 | r2845 | |
| 1273 | 1273 | * if so, read a new command and set up the renderer function |
| 1274 | 1274 | * |
| 1275 | 1275 | *****************************************************************************/ |
| 1276 | static void antic_scanline_dma(int param) | |
| 1276 | static void antic_scanline_dma(running_machine *machine, int param) | |
| 1277 | 1277 | { |
| 1278 | LOG((" @cycle #%3d DMA fetch\n", cycle())); | |
| 1278 | LOG((" @cycle #%3d DMA fetch\n", cycle(machine))); | |
| 1279 | 1279 | if (antic.scanline == VBL_END) |
| 1280 | 1280 | antic.r.nmist &= ~VBL_NMI; |
| 1281 | 1281 | if( antic.w.dmactl & DMA_ANTIC ) |
| r2844 | r2845 | |
| 1346 | 1346 | { |
| 1347 | 1347 | /* remove the DLI bit */ |
| 1348 | 1348 | new_cmd &= ~ANTIC_DLI; |
| 1349 | after(CYCLES_DLI_NMI, antic_issue_dli, "antic_issue_dli"); | |
| 1349 | after(machine, CYCLES_DLI_NMI, antic_issue_dli, "antic_issue_dli"); | |
| 1350 | 1350 | } |
| 1351 | 1351 | /* load memory scan bit set ? */ |
| 1352 | 1352 | if( new_cmd & ANTIC_LMS ) |
| r2844 | r2845 | |
| 1359 | 1359 | /* produce empty scanlines until vblank start */ |
| 1360 | 1360 | antic.modelines = VBL_START + 1 - antic.scanline; |
| 1361 | 1361 | if( antic.modelines < 0 ) |
| 1362 | antic.modelines = video_screen_get_height( | |
| 1362 | antic.modelines = video_screen_get_height(machine->primary_screen) - antic.scanline; | |
| 1363 | 1363 | LOG((" JVB $%04x\n", antic.dpage|antic.doffs)); |
| 1364 | 1364 | } |
| 1365 | 1365 | else |
| r2844 | r2845 | |
| 1478 | 1478 | |
| 1479 | 1479 | antic.r.nmist &= ~DLI_NMI; |
| 1480 | 1480 | if( antic.modelines == 1 && (antic.cmd & antic.w.nmien & DLI_NMI) ) |
| 1481 | after(CYCLES_DLI_NMI, antic_issue_dli, "antic_issue_dli"); | |
| 1481 | after(machine, CYCLES_DLI_NMI, antic_issue_dli, "antic_issue_dli"); | |
| 1482 | 1482 | |
| 1483 | after(CYCLES_HSTART, antic_scanline_render, "antic_scanline_render"); | |
| 1483 | after(machine, CYCLES_HSTART, antic_scanline_render, "antic_scanline_render"); | |
| 1484 | 1484 | } |
| 1485 | 1485 | |
| 1486 | 1486 | /***************************************************************************** |
| r2844 | r2845 | |
| 1496 | 1496 | { |
| 1497 | 1497 | int button_port, i; |
| 1498 | 1498 | |
| 1499 | LOG(("ANTIC #%3d @cycle #%d scanline interrupt\n", antic.scanline, cycle())); | |
| 1499 | LOG(("ANTIC #%3d @cycle #%d scanline interrupt\n", antic.scanline, cycle(machine))); | |
| 1500 | 1500 | |
| 1501 | 1501 | if( antic.scanline < VBL_START ) |
| 1502 | 1502 | { |
| 1503 | antic_scanline_dma(0); | |
| 1503 | antic_scanline_dma(machine, 0); | |
| 1504 | 1504 | return; |
| 1505 | 1505 | } |
| 1506 | 1506 | |
| r2844 | r2845 | |
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | 1539 | /* refresh the display (translate color clocks to pixels) */ |
| 1540 | antic_linerefresh(); | |
| 1540 | antic_linerefresh(machine); | |
| 1541 | 1541 | } |
| 1542 | 1542 | |
| 1543 | 1543 |
| r2844 | r2845 | |
|---|---|---|
| 142 | 142 | */ |
| 143 | 143 | |
| 144 | 144 | #include "driver.h" |
| 145 | #include "deprecat.h" | |
| 146 | 145 | #include "profiler.h" |
| 147 | 146 | #include "segas32.h" |
| 148 | 147 | |
| r2844 | r2845 | |
| 410 | 409 | } |
| 411 | 410 | |
| 412 | 411 | |
| 413 | INLINE void update_color(int offset, UINT16 data) | |
| 412 | INLINE void update_color(running_machine *machine, int offset, UINT16 data) | |
| 414 | 413 | { |
| 415 | 414 | /* note that since we use this RAM directly, we don't technically need */ |
| 416 | 415 | /* to call palette_set_color() at all; however, it does give us that */ |
| 417 | 416 | /* nice display when you hit F4, which is useful for debugging */ |
| 418 | 417 | |
| 419 | 418 | /* set the color */ |
| 420 | palette_set_color_rgb( | |
| 419 | palette_set_color_rgb(machine, offset, pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); | |
| 421 | 420 | } |
| 422 | 421 | |
| 423 | 422 | |
| r2844 | r2845 | |
| 439 | 438 | } |
| 440 | 439 | |
| 441 | 440 | |
| 442 | static void common_paletteram_w(int which, offs_t offset, UINT16 data, UINT16 mem_mask) | |
| 441 | static void common_paletteram_w(running_machine *machine, int which, offs_t offset, UINT16 data, UINT16 mem_mask) | |
| 443 | 442 | { |
| 444 | 443 | UINT16 value; |
| 445 | 444 | int convert; |
| r2844 | r2845 | |
| 457 | 456 | COMBINE_DATA(&value); |
| 458 | 457 | if (convert) value = xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(value); |
| 459 | 458 | system32_paletteram[which][offset] = value; |
| 460 | update_color(0x4000*which + offset, value); | |
| 459 | update_color(machine, 0x4000*which + offset, value); | |
| 461 | 460 | |
| 462 | 461 | /* if blending is enabled, writes go to both halves of palette RAM */ |
| 463 | 462 | if (mixer_control[which][0x4e/2] & 0x0880) |
| r2844 | r2845 | |
| 470 | 469 | COMBINE_DATA(&value); |
| 471 | 470 | if (convert) value = xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(value); |
| 472 | 471 | system32_paletteram[which][offset] = value; |
| 473 | update_color(0x4000*which + offset, value); | |
| 472 | update_color(machine, 0x4000*which + offset, value); | |
| 474 | 473 | } |
| 475 | 474 | } |
| 476 | 475 | |
| r2844 | r2845 | |
| 490 | 489 | |
| 491 | 490 | WRITE16_HANDLER( system32_paletteram_w ) |
| 492 | 491 | { |
| 493 | common_paletteram_w(0, offset, data, mem_mask); | |
| 492 | common_paletteram_w(machine, 0, offset, data, mem_mask); | |
| 494 | 493 | } |
| 495 | 494 | |
| 496 | 495 | |
| r2844 | r2845 | |
| 504 | 503 | WRITE32_HANDLER( multi32_paletteram_0_w ) |
| 505 | 504 | { |
| 506 | 505 | if (ACCESSING_BITS_0_15) |
| 507 | common_paletteram_w(0, offset*2+0, data, mem_mask); | |
| 506 | common_paletteram_w(machine, 0, offset*2+0, data, mem_mask); | |
| 508 | 507 | if (ACCESSING_BITS_16_31) |
| 509 | common_paletteram_w(0, offset*2+1, data >> 16, mem_mask >> 16); | |
| 508 | common_paletteram_w(machine, 0, offset*2+1, data >> 16, mem_mask >> 16); | |
| 510 | 509 | } |
| 511 | 510 | |
| 512 | 511 | |
| r2844 | r2845 | |
| 520 | 519 | WRITE32_HANDLER( multi32_paletteram_1_w ) |
| 521 | 520 | { |
| 522 | 521 | if (ACCESSING_BITS_0_15) |
| 523 | common_paletteram_w(1, offset*2+0, data, mem_mask); | |
| 522 | common_paletteram_w(machine, 1, offset*2+0, data, mem_mask); | |
| 524 | 523 | if (ACCESSING_BITS_16_31) |
| 525 | common_paletteram_w(1, offset*2+1, data >> 16, mem_mask >> 16); | |
| 524 | common_paletteram_w(machine, 1, offset*2+1, data >> 16, mem_mask >> 16); | |
| 526 | 525 | } |
| 527 | 526 | |
| 528 | 527 |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "includes/slapfght.h" | |
| 10 | 11 | |
| 11 | 12 | UINT8 *slapfight_videoram; |
| 12 | 13 | UINT8 *slapfight_colorram; |
| r2844 | r2845 | |
|---|---|---|
| 90 | 90 | */ |
| 91 | 91 | |
| 92 | 92 | #include "driver.h" |
| 93 | #include "deprecat.h" | |
| 94 | 93 | #include "profiler.h" |
| 95 | 94 | #include "psikyosh.h" |
| 96 | 95 | |
| r2844 | r2845 | |
| 393 | 392 | /* sx and sy is top-left of entire sprite regardless of flip */ |
| 394 | 393 | /* Note that Level 5-4 of sbomberb boss is perfect! (Alpha blended zoomed) as well as S1945II logo */ |
| 395 | 394 | /* pixel is only plotted if z is >= priority_buffer[y][x] */ |
| 396 | static void psikyosh_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 395 | static void psikyosh_drawgfxzoom( running_machine *machine, | |
| 396 | bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 397 | 397 | UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy, |
| 398 | 398 | const rectangle *clip,int transparency,int transparent_color, |
| 399 | 399 | int zoomx, int zoomy, int wide, int high, UINT32 z) |
| r2844 | r2845 | |
| 443 | 443 | { |
| 444 | 444 | for (xtile = xstart; xtile != xend; xtile += xinc ) |
| 445 | 445 | { |
| 446 | const pen_t *pal = & | |
| 446 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; | |
| 447 | 447 | int source_base = ((code + code_offset++) % gfx->total_elements) * gfx->height; |
| 448 | 448 | |
| 449 | 449 | int x_index_base, y_index, sx, sy, ex, ey; |
| r2844 | r2845 | |
| 707 | 707 | /* Start drawing */ |
| 708 | 708 | if( gfx ) |
| 709 | 709 | { |
| 710 | const pen_t *pal = & | |
| 710 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; | |
| 711 | 711 | |
| 712 | 712 | int sprite_screen_height = ((high*gfx->height*(0x400*0x400))/zoomy + 0x200)>>10; /* Round up to nearest pixel */ |
| 713 | 713 | int sprite_screen_width = ((wide*gfx->width*(0x400*0x400))/zoomx + 0x200)>>10; |
| r2844 | r2845 | |
| 1021 | 1021 | /* start drawing */ |
| 1022 | 1022 | if( zoom_table[BYTE_XOR_BE(zoomy)] && zoom_table[BYTE_XOR_BE(zoomx)] ) /* Avoid division-by-zero when table contains 0 (Uninitialised/Bug) */ |
| 1023 | 1023 | { |
| 1024 | psikyosh_drawgfxzoom(bitmap,gfx,tnum,colr,flpx,flpy,xpos,ypos,cliprect,trans,0, | |
| 1024 | psikyosh_drawgfxzoom(machine, bitmap,gfx,tnum,colr,flpx,flpy,xpos,ypos,cliprect,trans,0, | |
| 1025 | 1025 | (UINT32)zoom_table[BYTE_XOR_BE(zoomx)], (UINT32)zoom_table[BYTE_XOR_BE(zoomy)], wide, high, listcntr); |
| 1026 | 1026 | |
| 1027 | 1027 | #if 0 |
| r2844 | r2845 | |
|---|---|---|
| 45 | 45 | */ |
| 46 | 46 | |
| 47 | 47 | #include "driver.h" |
| 48 | #include "deprecat.h" | |
| 49 | 48 | #include "kan_pand.h" |
| 50 | 49 | |
| 51 | 50 | static UINT8* pandora_spriteram; |
| r2844 | r2845 | |
| 162 | 161 | pandora_draw(machine, pandora_sprites_bitmap, video_screen_get_visible_area(machine->primary_screen)); |
| 163 | 162 | } |
| 164 | 163 | |
| 165 | void pandora_start(UINT8 region, int x, int y) | |
| 164 | void pandora_start(running_machine *machine, UINT8 region, int x, int y) | |
| 166 | 165 | { |
| 167 | 166 | pandora_region = region; |
| 168 | 167 | pandora_xoffset = x; |
| r2844 | r2845 | |
| 170 | 169 | pandora_spriteram = auto_malloc(0x1000); |
| 171 | 170 | memset(pandora_spriteram,0x00, 0x1000); |
| 172 | 171 | |
| 173 | pandora_sprites_bitmap = video_screen_auto_bitmap_alloc( | |
| 172 | pandora_sprites_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); | |
| 174 | 173 | pandora_clear_bitmap = 1; |
| 175 | 174 | } |
| 176 | 175 |
| r2844 | r2845 | |
|---|---|---|
| 117 | 117 | |
| 118 | 118 | while (multi >= 0) |
| 119 | 119 | { |
| 120 | deco16_pdrawgfx(bitmap,machine->gfx[gfx_region], | |
| 120 | deco16_pdrawgfx(machine, | |
| 121 | bitmap,machine->gfx[gfx_region], | |
| 121 | 122 | sprite - multi * inc, |
| 122 | 123 | colour, |
| 123 | 124 | fx,fy, |
| r2844 | r2845 | |
| 144 | 145 | |
| 145 | 146 | VIDEO_START(boogwing) |
| 146 | 147 | { |
| 147 | deco16_2_video_init(0); | |
| 148 | deco16_2_video_init(machine, 0); | |
| 148 | 149 | |
| 149 | 150 | deco16_set_tilemap_bank_callback(1,boogwing_bank_callback); |
| 150 | 151 | deco16_set_tilemap_bank_callback(2,boogwing_bank_callback2); |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | /* kan_pand.h */ |
| 2 | 2 | |
| 3 | void pandora_start(UINT8 region, int x, int y); | |
| 3 | void pandora_start(running_machine *machine, UINT8 region, int x, int y); | |
| 4 | 4 | void pandora_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect); |
| 5 | 5 | void pandora_eof(running_machine *machine); |
| 6 | 6 | void pandora_set_clear_bitmap(int clear); |
| r2844 | r2845 | |
|---|---|---|
| 85 | 85 | memset(bitmap_base, 0, BITMAP_WIDTH * video_screen_get_height(machine->primary_screen)); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | void irobot_poly_clear( | |
| 88 | void irobot_poly_clear(running_machine *machine) | |
| 89 | 89 | { |
| 90 | 90 | UINT8 *bitmap_base = irobot_bufsel ? polybitmap2 : polybitmap1; |
| 91 | _irobot_poly_clear( | |
| 91 | _irobot_poly_clear(machine, bitmap_base); | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 |
| r2844 | r2845 | |
|---|---|---|
| 174 | 174 | |
| 175 | 175 | VIDEO_START( snookr10 ) |
| 176 | 176 | { |
| 177 | bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 4, 8, 128, 3 | |
| 177 | bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 4, 8, 128, 30); | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | VIDEO_START( apple10 ) |
| 181 | 181 | { |
| 182 | bg_tilemap = tilemap_create(apple10_get_bg_tile_info, tilemap_scan_rows, 4, 8, 128, 3 | |
| 182 | bg_tilemap = tilemap_create(apple10_get_bg_tile_info, tilemap_scan_rows, 4, 8, 128, 30); | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | VIDEO_UPDATE( snookr10 ) |
| r2844 | r2845 | |
|---|---|---|
| 345 | 345 | |
| 346 | 346 | static READ8_HANDLER( combascb_io_r ) |
| 347 | 347 | { |
| 348 | return input_port_read_indexed(machine, offset); | |
| 348 | static const char *portnames[] = { "IN0", "IN1", "DSW1", "DSW2" }; | |
| 349 | ||
| 350 | return input_port_read(machine, portnames[offset]); | |
| 349 | 351 | } |
| 350 | 352 | |
| 351 | 353 | static WRITE8_HANDLER( combascb_priority_w ) |
| r2844 | r2845 | |
|---|---|---|
| 953 | 953 | * PPU Reset |
| 954 | 954 | * |
| 955 | 955 | *************************************/ |
| 956 | void ppu2c0x_reset(int num, int scan_scale | |
| 956 | void ppu2c0x_reset(running_machine *machine, int num, int scan_scale | |
| 957 | 957 | { |
| 958 | 958 | int i; |
| 959 | 959 | |
| r2844 | r2845 | |
| 976 | 976 | timer_adjust_oneshot(chips[num].hblank_timer, ATTOTIME_IN_CYCLES(86.67, 0), num); // ??? FIXME - hardcoding NTSC, need better calculation |
| 977 | 977 | |
| 978 | 978 | // Call us back at the start of the next scanline |
| 979 | timer_adjust_oneshot(chips[num].scanline_timer, video_screen_get_time_until_pos( | |
| 979 | timer_adjust_oneshot(chips[num].scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 1, 0), num); | |
| 980 | 980 | |
| 981 | 981 | /* reset the callbacks */ |
| 982 | 982 | chips[num].scanline_callback_proc = 0; |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "profiler.h" |
| 3 | #include "includes/buggychl.h" | |
| 3 | 4 | |
| 4 | 5 | |
| 5 | 6 |
| r2844 | r2845 | |
|---|---|---|
| 101 | 101 | void ppu2c0x_init_palette(running_machine *machine, int first_entry ); |
| 102 | 102 | void ppu2c0x_init(running_machine *machine, const ppu2c0x_interface *interface ); |
| 103 | 103 | |
| 104 | void ppu2c0x_reset( int num, int scan_scale ); | |
| 104 | void ppu2c0x_reset( running_machine *machine, int num, int scan_scale ); | |
| 105 | 105 | void ppu2c0x_set_videorom_bank( int num, int start_page, int num_pages, int bank, int bank_size ); |
| 106 | 106 | void ppu2c0x_set_videoram_bank( int num, int start_page, int num_pages, int bank, int bank_size ); |
| 107 | 107 | void ppu2c0x_spriteram_dma(int num, const UINT8 page ); |
| r2844 | r2845 | |
|---|---|---|
| 11 | 11 | static FILE *rdp_exec; |
| 12 | 12 | #endif |
| 13 | 13 | |
| 14 | /* defined in systems/n64.c */ | |
| 15 | extern UINT32 *rdram; | |
| 16 | extern UINT32 *rsp_imem; | |
| 17 | extern UINT32 *rsp_dmem; | |
| 18 | extern void dp_full_sync(void); | |
| 19 | ||
| 20 | extern UINT32 n64_vi_origin; | |
| 21 | extern UINT32 n64_vi_control; | |
| 22 | ||
| 23 | extern UINT32 dp_start; | |
| 24 | extern UINT32 dp_end; | |
| 25 | extern UINT32 dp_current; | |
| 26 | extern UINT32 dp_status; | |
| 27 | ||
| 28 | 14 | static UINT32 rdp_cmd_data[0x1000]; |
| 29 | 15 | static int rdp_cmd_ptr = 0; |
| 30 | 16 | static int rdp_cmd_cur = 0; |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | #define TC0280GRD_GFX_NUM 2 |
| 8 | 8 | #define TC0430GRW_GFX_NUM 2 |
| 9 | 9 | |
| 10 | extern UINT8 TC0360PRI_regs[16]; | |
| 11 | ||
| 12 | 10 | struct tempsprite |
| 13 | 11 | { |
| 14 | 12 | int code,color; |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "includes/stfight.h" | |
| 10 | 11 | |
| 11 | 12 | // Real stuff |
| 12 | 13 | UINT8 *stfight_text_char_ram; |
| r2844 | r2845 | |
|---|---|---|
| 78 | 78 | /* Video on the orginal */ |
| 79 | 79 | VIDEO_START(pktgaldx) |
| 80 | 80 | { |
| 81 | deco16_1_video_init(); | |
| 81 | deco16_1_video_init(machine); | |
| 82 | 82 | |
| 83 | 83 | deco16_set_tilemap_bank_callback(1,pktgaldx_bank_callback); |
| 84 | 84 | } |
| r2844 | r2845 | |
|---|---|---|
| 126 | 126 | adjusted_modesc.palettebase = atarigx2_motion_object_base; |
| 127 | 127 | for (i = 0; i < 8; i++) |
| 128 | 128 | adjusted_modesc.colormask.data[i] &= atarigx2_motion_object_mask; |
| 129 | atarirle_init(0, &adjusted_modesc); | |
| 129 | atarirle_init(machine, 0, &adjusted_modesc); | |
| 130 | 130 | |
| 131 | 131 | /* initialize the alphanumerics */ |
| 132 | 132 | atarigen_alpha_tilemap = tilemap_create(get_alpha_tile_info, tilemap_scan_rows, 8,8, 64,32); |
| r2844 | r2845 | |
|---|---|---|
| 204 | 204 | ***************************************************************************/ |
| 205 | 205 | |
| 206 | 206 | #include "driver.h" |
| 207 | #include "deprecat.h" | |
| 208 | 207 | #include "taito_f3.h" |
| 209 | 208 | #include "ui.h" |
| 210 | 209 | |
| r2844 | r2845 | |
| 2590 | 2589 | dest++; \ |
| 2591 | 2590 | pri++; |
| 2592 | 2591 | |
| 2593 | INLINE void f3_drawgfx( bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 2592 | INLINE void f3_drawgfx( running_machine *machine, | |
| 2593 | bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 2594 | 2594 | UINT32 code, |
| 2595 | 2595 | UINT32 color, |
| 2596 | 2596 | int flipx,int flipy, |
| r2844 | r2845 | |
| 2621 | 2621 | |
| 2622 | 2622 | if( gfx ) |
| 2623 | 2623 | { |
| 2624 | const pen_t *pal = & | |
| 2624 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; | |
| 2625 | 2625 | int source_base = (code % gfx->total_elements) * 16; |
| 2626 | 2626 | |
| 2627 | 2627 | { |
| r2844 | r2845 | |
| 2753 | 2753 | #undef NEXT_P |
| 2754 | 2754 | |
| 2755 | 2755 | |
| 2756 | INLINE void f3_drawgfxzoom(bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 2756 | INLINE void f3_drawgfxzoom(running_machine *machine, | |
| 2757 | bitmap_t *dest_bmp,const gfx_element *gfx, | |
| 2757 | 2758 | UINT32 code, |
| 2758 | 2759 | UINT32 color, |
| 2759 | 2760 | int flipx,int flipy, |
| r2844 | r2845 | |
| 2785 | 2786 | |
| 2786 | 2787 | if( gfx ) |
| 2787 | 2788 | { |
| 2788 | const pen_t *pal = & | |
| 2789 | const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; | |
| 2789 | 2790 | int source_base = (code % gfx->total_elements) * 16; |
| 2790 | 2791 | |
| 2791 | 2792 | { |
| r2844 | r2845 | |
| 3168 | 3169 | sprite_pri_usage|=1<<pri; |
| 3169 | 3170 | |
| 3170 | 3171 | if(sprite_ptr->zoomx==16 && sprite_ptr->zoomy==16) |
| 3171 | f3_drawgfx(bitmap,sprite_gfx, | |
| 3172 | f3_drawgfx(machine, | |
| 3173 | bitmap,sprite_gfx, | |
| 3172 | 3174 | sprite_ptr->code, |
| 3173 | 3175 | sprite_ptr->color, |
| 3174 | 3176 | sprite_ptr->flipx,sprite_ptr->flipy, |
| r2844 | r2845 | |
| 3176 | 3178 | cliprect, |
| 3177 | 3179 | pri); |
| 3178 | 3180 | else |
| 3179 | f3_drawgfxzoom(bitmap,sprite_gfx, | |
| 3181 | f3_drawgfxzoom(machine, | |
| 3182 | bitmap,sprite_gfx, | |
| 3180 | 3183 | sprite_ptr->code, |
| 3181 | 3184 | sprite_ptr->color, |
| 3182 | 3185 | sprite_ptr->flipx,sprite_ptr->flipy, |
| r2844 | r2845 | |
|---|---|---|
| 77 | 77 | ***************************************************************************/ |
| 78 | 78 | |
| 79 | 79 | #include "driver.h" |
| 80 | #include "includes/gaelco2.h" | |
| 80 | 81 | |
| 81 | 82 | UINT16 *gaelco2_vregs; |
| 82 | 83 | static UINT16 *gaelco2_videoram; |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | #include "deprecat.h" | |
| 9 | 8 | #include "mcr.h" |
| 10 | 9 | |
| 11 | 10 | |
| r2844 | r2845 | |
| 128 | 127 | * |
| 129 | 128 | *************************************/ |
| 130 | 129 | |
| 131 | static void mcr_set_color(int index, int data) | |
| 130 | static void mcr_set_color(running_machine *machine, int index, int data) | |
| 132 | 131 | { |
| 133 | palette_set_color_rgb( | |
| 132 | palette_set_color_rgb(machine, index, pal3bit(data >> 6), pal3bit(data >> 0), pal3bit(data >> 3)); | |
| 134 | 133 | } |
| 135 | 134 | |
| 136 | 135 | |
| 137 | static void journey_set_color(int index, int data) | |
| 136 | static void journey_set_color(running_machine *machine, int index, int data) | |
| 138 | 137 | { |
| 139 | 138 | /* 3 bits each, RGB */ |
| 140 | 139 | int r = (data >> 6) & 7; |
| r2844 | r2845 | |
| 147 | 146 | b = (b << 5) | (b << 1); |
| 148 | 147 | |
| 149 | 148 | /* set the BG color */ |
| 150 | palette_set_color( | |
| 149 | palette_set_color(machine, index, MAKE_RGB(r, g, b)); | |
| 151 | 150 | |
| 152 | 151 | /* if this is an odd entry in the upper palette bank, the hardware */ |
| 153 | 152 | /* hard-codes a low 1 bit -- this is used for better grayscales */ |
| r2844 | r2845 | |
| 159 | 158 | } |
| 160 | 159 | |
| 161 | 160 | /* set the FG color */ |
| 162 | palette_set_color( | |
| 161 | palette_set_color(machine, index + 64, MAKE_RGB(r, g, b)); | |
| 163 | 162 | } |
| 164 | 163 | |
| 165 | 164 | |
| r2844 | r2845 | |
| 167 | 166 | { |
| 168 | 167 | paletteram[offset] = data; |
| 169 | 168 | offset &= 0x7f; |
| 170 | mcr_set_color((offset / 2) & 0x3f, data | ((offset & 1) << 8)); | |
| 169 | mcr_set_color(machine, (offset / 2) & 0x3f, data | ((offset & 1) << 8)); | |
| 171 | 170 | } |
| 172 | 171 | |
| 173 | 172 | |
| r2844 | r2845 | |
| 194 | 193 | if ((offset & 0x780) == 0x780) |
| 195 | 194 | { |
| 196 | 195 | if (mcr_cpu_board != 91475) |
| 197 | mcr_set_color((offset / 2) & 0x3f, data | ((offset & 1) << 8)); | |
| 196 | mcr_set_color(machine, (offset / 2) & 0x3f, data | ((offset & 1) << 8)); | |
| 198 | 197 | else |
| 199 | journey_set_color((offset / 2) & 0x3f, data | ((offset & 1) << 8)); | |
| 198 | journey_set_color(machine, (offset / 2) & 0x3f, data | ((offset & 1) << 8)); | |
| 200 | 199 | } |
| 201 | 200 | } |
| 202 | 201 | |
| r2844 | r2845 | |
| 218 | 217 | |
| 219 | 218 | /* palette RAM is mapped into the upper 0x80 bytes here */ |
| 220 | 219 | if ((effoffs & 0x780) == 0x780) |
| 221 | mcr_set_color(((offset & 0x400) >> 5) | ((offset >> 1) & 0x1f), data | ((offset & 1) << 8)); | |
| 220 | mcr_set_color(machine, ((offset & 0x400) >> 5) | ((offset >> 1) & 0x1f), data | ((offset & 1) << 8)); | |
| 222 | 221 | } |
| 223 | 222 | |
| 224 | 223 |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | *******************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "deprecat.h" | |
| 12 | 11 | |
| 13 | 12 | /*-- Variables --*/ |
| 14 | 13 | |
| r2844 | r2845 | |
| 43 | 42 | |
| 44 | 43 | static void draw_tiles_line(UINT8 *dest, int line, UINT8 chip, UINT8 pri); |
| 45 | 44 | static void draw_sprite_line(UINT8 *dest, UINT8 chip, UINT8 line); |
| 46 | static void segae_drawscanline(int line, int chips, int blank); | |
| 45 | static void segae_drawscanline(running_machine *machine, int line, int chips, int blank); | |
| 47 | 46 | |
| 48 | 47 | static void draw_8pix_solid16(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col); |
| 49 | 48 | static void draw_8pix(UINT8 *dest, UINT8 chip, UINT16 tile, UINT8 line, UINT8 flipx, UINT8 col); |
| r2844 | r2845 | |
| 72 | 71 | /*- Draw from cache_bitmap to screen -*/ |
| 73 | 72 | |
| 74 | 73 | for (i = miny; i <= maxy;i++) |
| 75 | segae_drawscanline(i-16,0,0); | |
| 74 | segae_drawscanline(screen->machine, i-16,0,0); | |
| 76 | 75 | |
| 77 | 76 | for (i = miny;i <= maxy;i++) |
| 78 | 77 | draw_scanline8(bitmap,32,i,256,&cache_bitmap[(i-16) * (16+256+16) +24],&screen->machine->pens[palette_base],0); |
| r2844 | r2845 | |
| 205 | 204 | } |
| 206 | 205 | } |
| 207 | 206 | |
| 208 | void segae_vdp_data_w ( UINT8 chip, UINT8 data ) | |
| 207 | void segae_vdp_data_w ( running_machine *machine, UINT8 chip, UINT8 data ) | |
| 209 | 208 | { |
| 210 | 209 | vdp_cmdpart[chip] = 0; |
| 211 | 210 | |
| r2844 | r2845 | |
| 221 | 220 | g = (vdp_cram[chip][vdp_accessaddr[chip]] & 0x0c) >> 2; |
| 222 | 221 | b = (vdp_cram[chip][vdp_accessaddr[chip]] & 0x30) >> 4; |
| 223 | 222 | |
| 224 | palette_set_color_rgb( | |
| 223 | palette_set_color_rgb(machine, vdp_accessaddr[chip] + 32*chip+palette_base, pal2bit(r), pal2bit(g), pal2bit(b)); | |
| 225 | 224 | } |
| 226 | 225 | |
| 227 | 226 | vdp_accessaddr[chip] += 1; |
| r2844 | r2845 | |
| 336 | 335 | |
| 337 | 336 | *******************************************************************************/ |
| 338 | 337 | |
| 339 | static void segae_drawscanline(int line, int chips, int blank) | |
| 338 | static void segae_drawscanline(running_machine *machine, int line, int chips, int blank) | |
| 340 | 339 | { |
| 341 | 340 | |
| 342 | 341 | UINT8* dest; |
| r2844 | r2845 | |
| 367 | 366 | /* FIX ME!! */ |
| 368 | 367 | if (blank) |
| 369 | 368 | { |
| 370 | if (strcmp( | |
| 369 | if (strcmp(machine->gamedrv->name,"tetrisse")) /* and we really don't want to do it on tetrise */ | |
| 371 | 370 | memset(dest+16, 32+16, 8); /* Clear Leftmost column, there should be a register for this like on the SMS i imagine */ |
| 372 | 371 | /* on the SMS this is bit 5 of register 0 (according to CMD's SMS docs) for system E this */ /* appears to be incorrect, most games need it blanked 99% of the time so we blank it */ |
| 373 | 372 | } |
| r2844 | r2845 | |
|---|---|---|
| 13 | 13 | ***************************************************************************/ |
| 14 | 14 | |
| 15 | 15 | #include "driver.h" |
| 16 | #include "includes/matmania.h" | |
| 16 | 17 | |
| 17 | 18 | |
| 18 | 19 |
| r2844 | r2845 | |
|---|---|---|
| 10 | 10 | #include "includes/arkanoid.h" |
| 11 | 11 | |
| 12 | 12 | static UINT8 gfxbank, palettebank; |
| 13 | extern UINT8 arkanoid_paddle_select; | |
| 14 | 13 | |
| 15 | 14 | static tilemap *bg_tilemap; |
| 16 | 15 |
| r2844 | r2845 | |
|---|---|---|
| 120 | 120 | |
| 121 | 121 | sprites_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 122 | 122 | tilemap_set_transparent_pen(fg_tilemap, 0); |
| 123 | pandora_start(1,0,0); | |
| 123 | pandora_start(machine,1,0,0); | |
| 124 | 124 | |
| 125 | 125 | tilemap_set_scrolldx(bg_tilemap, 0x094, 0x06a); |
| 126 | 126 | tilemap_set_scrolldy(bg_tilemap, 0x100, 0x1ff); |
| r2844 | r2845 | |
|---|---|---|
| 317 | 317 | { |
| 318 | 318 | /* analog inputs seem to be hooked up here -- might not actually map to blitter */ |
| 319 | 319 | if (offset == 0x02/2) |
| 320 | return input_port_read | |
| 320 | return input_port_read | |
| 321 | 321 | if (offset == 0x0e/2) |
| 322 | return input_port_read | |
| 322 | return input_port_read | |
| 323 | 323 | |
| 324 | 324 | /* early code polls on this bit, wants it to be 0 */ |
| 325 | 325 | if (offset == 0x36/2) |
| r2844 | r2845 | |
|---|---|---|
| 143 | 143 | g = ((g<<5) + (g<<2) + (g>>1)); |
| 144 | 144 | b = ((b<<5) + (b<<2) + (b>>1)); |
| 145 | 145 | |
| 146 | if ((i = input_port_read | |
| 146 | if ((i = input_port_read | |
| 147 | 147 | { |
| 148 | 148 | r = (float)r * rgb[i][0]; |
| 149 | 149 | g = (float)g * rgb[i][1]; |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | #include "includes/lsasquad.h" | |
| 2 | 3 | |
| 3 | 4 | UINT8 *lsasquad_scrollram; |
| 4 | 5 |
| r2844 | r2845 | |
|---|---|---|
| 143 | 143 | atarigen_playfield_tilemap = tilemap_create(get_playfield_tile_info, atarigt_playfield_scan, 8,8, 128,64); |
| 144 | 144 | |
| 145 | 145 | /* initialize the motion objects */ |
| 146 | atarirle_init(0, &adjusted_modesc); | |
| 146 | atarirle_init(machine, 0, &adjusted_modesc); | |
| 147 | 147 | |
| 148 | 148 | /* initialize the alphanumerics */ |
| 149 | 149 | atarigen_alpha_tilemap = tilemap_create(get_alpha_tile_info, tilemap_scan_rows, 8,8, 64,32); |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | ***********************************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | #include "deprecat.h" | |
| 12 | 11 | #include "genesis.h" |
| 13 | 12 | |
| 14 | 13 | /* in video/segasyse.c */ |
| r2844 | r2845 | |
| 50 | 49 | ******************************************************************************/ |
| 51 | 50 | |
| 52 | 51 | static int vdp_data_r(void); |
| 53 | static void vdp_data_w(int data); | |
| 54 | static int vdp_control_r(void); | |
| 55 | static void vdp_control_w(int data); | |
| 56 | static void vdp_register_w(int data, int vblank); | |
| 57 | static void vdp_control_dma(int data); | |
| 58 | static void vdp_dma_68k(void); | |
| 52 | static void vdp_data_w(running_machine *machine, int data); | |
| 53 | static int vdp_control_r(running_machine *machine); | |
| 54 | static void vdp_control_w(running_machine *machine, int data); | |
| 55 | static void vdp_register_w(running_machine *machine, int data, int vblank); | |
| 56 | static void vdp_control_dma(running_machine *machine, int data); | |
| 57 | static void vdp_dma_68k(running_machine *machine); | |
| 59 | 58 | static void vdp_dma_fill(int); |
| 60 | 59 | static void vdp_dma_copy(void); |
| 61 | 60 | |
| r2844 | r2845 | |
| 170 | 169 | |
| 171 | 170 | /* reset VDP */ |
| 172 | 171 | for (i = 0; i < 24; i++) |
| 173 | vdp_register_w(0x8000 | (i << 8) | vdp_init[i], 1); | |
| 172 | vdp_register_w(screen->machine, 0x8000 | (i << 8) | vdp_init[i], 1); | |
| 174 | 173 | vdp_cmdpart = 0; |
| 175 | 174 | vdp_code = 0; |
| 176 | 175 | vdp_address = 0; |
| r2844 | r2845 | |
| 250 | 249 | ******************************************************************************/ |
| 251 | 250 | |
| 252 | 251 | /* set the display enable bit */ |
| 253 | void segac2_enable_display(int enable) | |
| 252 | void segac2_enable_display(running_machine *machine, int enable) | |
| 254 | 253 | { |
| 255 | video_screen_update_partial( | |
| 254 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); | |
| 256 | 255 | display_enable = enable; |
| 257 | 256 | } |
| 258 | 257 | |
| r2844 | r2845 | |
| 340 | 339 | |
| 341 | 340 | case 0x02: /* Status Register */ |
| 342 | 341 | case 0x03: |
| 343 | return vdp_control_r(); | |
| 342 | return vdp_control_r(machine); | |
| 344 | 343 | |
| 345 | 344 | case 0x04: /* HV counter */ |
| 346 | 345 | case 0x05: |
| r2844 | r2845 | |
| 378 | 377 | else |
| 379 | 378 | data |= data << 8; |
| 380 | 379 | } |
| 381 | vdp_data_w(data); | |
| 380 | vdp_data_w(machine, data); | |
| 382 | 381 | break; |
| 383 | 382 | |
| 384 | 383 | case 0x02: /* Control Write */ |
| r2844 | r2845 | |
| 391 | 390 | else |
| 392 | 391 | data |= data << 8; |
| 393 | 392 | } |
| 394 | vdp_control_w(data); | |
| 393 | vdp_control_w(machine, data); | |
| 395 | 394 | break; |
| 396 | 395 | |
| 397 | 396 | case 0x08: /* SN76489 Write */ |
| r2844 | r2845 | |
| 449 | 448 | } |
| 450 | 449 | |
| 451 | 450 | |
| 452 | static void vdp_data_w(int data) | |
| 451 | static void vdp_data_w(running_machine *machine, int data) | |
| 453 | 452 | { |
| 454 | 453 | /* kill 2nd write pending flag */ |
| 455 | 454 | vdp_cmdpart = 0; |
| r2844 | r2845 | |
| 470 | 469 | /* if the hscroll RAM is changing, force an update */ |
| 471 | 470 | if (vdp_address >= vdp_hscrollbase && |
| 472 | 471 | vdp_address < vdp_hscrollbase + vdp_hscrollsize) |
| 473 | video_screen_update_partial( | |
| 472 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); | |
| 474 | 473 | |
| 475 | 474 | /* write to VRAM */ |
| 476 | 475 | if (vdp_address & 1) |
| r2844 | r2845 | |
| 482 | 481 | case 0x03: /* Palette write */ |
| 483 | 482 | { |
| 484 | 483 | int offset = (vdp_address/2) % CRAM_SIZE; |
| 485 | palette_set_color_rgb( | |
| 484 | palette_set_color_rgb(machine, offset + genesis_palette_base, pal3bit(data >> 1), pal3bit(data >> 5), pal3bit(data >> 9)); | |
| 486 | 485 | } |
| 487 | 486 | break; |
| 488 | 487 | |
| 489 | 488 | case 0x05: /* VSRAM write */ |
| 490 | 489 | |
| 491 | 490 | /* vscroll RAM is changing, force an update */ |
| 492 | video_screen_update_partial( | |
| 491 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); | |
| 493 | 492 | |
| 494 | 493 | /* write to VSRAM */ |
| 495 | 494 | if (vdp_address & 1) |
| r2844 | r2845 | |
| 543 | 542 | |
| 544 | 543 | ******************************************************************************/ |
| 545 | 544 | |
| 546 | static int vdp_control_r( | |
| 545 | static int vdp_control_r(running_machine *machine) | |
| 547 | 546 | { |
| 548 | 547 | int status = 0x3600; // wwally needs fifo empty set |
| 549 | 548 | |
| r2844 | r2845 | |
| 551 | 550 | vdp_cmdpart = 0; |
| 552 | 551 | |
| 553 | 552 | /* set the VBLANK bit */ |
| 554 | if (video_screen_get_vblank( | |
| 553 | if (video_screen_get_vblank(machine->primary_screen)) | |
| 555 | 554 | status |= 0x0008; |
| 556 | 555 | |
| 557 | 556 | /* set the HBLANK bit */ |
| 558 | if (video_screen_get_hblank( | |
| 557 | if (video_screen_get_hblank(machine->primary_screen)) | |
| 559 | 558 | status |= 0x0004; |
| 560 | 559 | |
| 561 | 560 | return (status); |
| 562 | 561 | } |
| 563 | 562 | |
| 564 | 563 | |
| 565 | static void vdp_control_w(int data) | |
| 564 | static void vdp_control_w(running_machine *machine, int data) | |
| 566 | 565 | { |
| 567 | 566 | /* case 1: we're not expecting the 2nd half of a command */ |
| 568 | 567 | if (!vdp_cmdpart) |
| 569 | 568 | { |
| 570 | 569 | /* if 10xxxxxx xxxxxxxx this is a register setting command */ |
| 571 | 570 | if ((data & 0xc000) == 0x8000) |
| 572 | vdp_register_w(data, video_screen_get_vblank( | |
| 571 | vdp_register_w(machine, data, video_screen_get_vblank(machine->primary_screen)); | |
| 573 | 572 | |
| 574 | 573 | /* otherwise this is the First part of a mode setting command */ |
| 575 | 574 | else |
| r2844 | r2845 | |
| 586 | 585 | vdp_code = (vdp_code & 0x03) | ((data >> 2) & 0x3c); |
| 587 | 586 | vdp_address = (vdp_address & 0x3fff) | ((data << 14) & 0xc000); |
| 588 | 587 | vdp_cmdpart = 0; |
| 589 | vdp_control_dma(data); | |
| 588 | vdp_control_dma(machine, data); | |
| 590 | 589 | } |
| 591 | 590 | } |
| 592 | 591 | |
| 593 | 592 | |
| 594 | static void vdp_register_w(int data, int vblank) | |
| 593 | static void vdp_register_w(running_machine *machine, int data, int vblank) | |
| 595 | 594 | { |
| 596 | 595 | int scrwidth = 0; |
| 597 | 596 | static const UINT8 is_important[32] = { 0,0,1,1,1,1,0,1,0,0,0,1,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0 }; |
| r2844 | r2845 | |
| 603 | 602 | |
| 604 | 603 | /* these are mostly important writes; force an update if they written */ |
| 605 | 604 | if (is_important[regnum]) |
| 606 | video_screen_update_partial( | |
| 605 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); | |
| 607 | 606 | |
| 608 | 607 | /* For quite a few of the registers its a good idea to set a couple of variable based |
| 609 | 608 | upon the writes here */ |
| r2844 | r2845 | |
| 701 | 700 | } |
| 702 | 701 | |
| 703 | 702 | |
| 704 | static void vdp_control_dma(int data) | |
| 703 | static void vdp_control_dma(running_machine *machine, int data) | |
| 705 | 704 | { |
| 706 | 705 | if ((vdp_code & 0x20) && (genesis_vdp_regs[1] & 0x10)) |
| 707 | 706 | { |
| r2844 | r2845 | |
| 709 | 708 | { |
| 710 | 709 | case 0x00: |
| 711 | 710 | case 0x40: /* 68k -> VRAM Tranfser */ |
| 712 | vdp_dma_68k(); | |
| 711 | vdp_dma_68k(machine); | |
| 713 | 712 | break; |
| 714 | 713 | |
| 715 | 714 | case 0x80: /* VRAM fill, can't be done here, requires data write */ |
| r2844 | r2845 | |
| 733 | 732 | |
| 734 | 733 | ******************************************************************************/ |
| 735 | 734 | |
| 736 | static void vdp_dma_68k( | |
| 735 | static void vdp_dma_68k(running_machine *machine) | |
| 737 | 736 | { |
| 738 | 737 | int length = genesis_vdp_regs[19] | (genesis_vdp_regs[20] << 8); |
| 739 | 738 | int source = (genesis_vdp_regs[21] << 1) | (genesis_vdp_regs[22] << 9) | ((genesis_vdp_regs[23] & 0x7f) << 17); |
| r2844 | r2845 | |
| 746 | 745 | /* handle the DMA */ |
| 747 | 746 | for (count = 0; count < length; count++) |
| 748 | 747 | { |
| 749 | vdp_data_w(program_read_word(source)); | |
| 748 | vdp_data_w(machine, program_read_word(source)); | |
| 750 | 749 | source += 2; |
| 751 | 750 | } |
| 752 | 751 | } |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "includes/wrally.h" | |
| 10 | 11 | |
| 11 | 12 | UINT16 *wrally_spriteram; |
| 12 | 13 | UINT16 *wrally_vregs; |
| r2844 | r2845 | |
|---|---|---|
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | #include "deprecat.h" | |
| 9 | 8 | #include "segaic16.h" |
| 9 | #include "includes/genesis.h" | |
| 10 | 10 | #include "includes/system16.h" |
| 11 | 11 | |
| 12 | 12 | |
| r2844 | r2845 | |
| 37 | 37 | |
| 38 | 38 | /************************************* |
| 39 | 39 | * |
| 40 | * Prototypes | |
| 41 | * | |
| 42 | *************************************/ | |
| 43 | ||
| 44 | void system18_vdp_start(running_machine *machine); | |
| 45 | void system18_vdp_update(bitmap_t *bitmap, const rectangle *cliprect); | |
| 46 | ||
| 47 | ||
| 48 | ||
| 49 | /************************************* | |
| 50 | * | |
| 51 | 40 | * Video startup |
| 52 | 41 | * |
| 53 | 42 | *************************************/ |
| r2844 | r2845 | |
| 56 | 45 | { |
| 57 | 46 | int width, height; |
| 58 | 47 | |
| 48 | tempbitmap = NULL; | |
| 49 | grayscale_enable = 0; | |
| 50 | vdp_enable = 0; | |
| 51 | vdp_mixing = 0; | |
| 52 | ||
| 59 | 53 | /* compute palette info */ |
| 60 | 54 | segaic16_palette_init(0x800); |
| 61 | 55 | |
| r2844 | r2845 | |
| 82 | 76 | * |
| 83 | 77 | *************************************/ |
| 84 | 78 | |
| 85 | void system18_set_grayscale(int enable) | |
| 79 | void system18_set_grayscale(running_machine *machine, int enable) | |
| 86 | 80 | { |
| 87 | 81 | enable = (enable != 0); |
| 88 | 82 | if (enable != grayscale_enable) |
| 89 | 83 | { |
| 90 | video_screen_update_partial( | |
| 84 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); | |
| 91 | 85 | grayscale_enable = enable; |
| 92 | 86 | // mame_printf_debug("Grayscale = %02X\n", enable); |
| 93 | 87 | } |
| 94 | 88 | } |
| 95 | 89 | |
| 96 | 90 | |
| 97 | void system18_set_vdp_enable(int enable) | |
| 91 | void system18_set_vdp_enable(running_machine *machine, int enable) | |
| 98 | 92 | { |
| 99 | 93 | enable = (enable != 0); |
| 100 | 94 | if (enable != vdp_enable) |
| 101 | 95 | { |
| 102 | video_screen_update_partial( | |
| 96 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); | |
| 103 | 97 | vdp_enable = enable; |
| 104 | 98 | #if DEBUG_VDP |
| 105 | 99 | mame_printf_debug("VDP enable = %02X\n", enable); |
| r2844 | r2845 | |
| 108 | 102 | } |
| 109 | 103 | |
| 110 | 104 | |
| 111 | void system18_set_vdp_mixing(int mixing) | |
| 105 | void system18_set_vdp_mixing(running_machine *machine, int mixing) | |
| 112 | 106 | { |
| 113 | 107 | if (mixing != vdp_mixing) |
| 114 | 108 | { |
| 115 | video_screen_update_partial( | |
| 109 | video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); | |
| 116 | 110 | vdp_mixing = mixing; |
| 117 | 111 | #if DEBUG_VDP |
| 118 | 112 | mame_printf_debug("VDP mixing = %02X\n", mixing); |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "video/konamiic.h" |
| 11 | #include "includes/ajax.h" | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | UINT8 ajax_priority; |
| r2844 | r2845 | |
|---|---|---|
| 11 | 11 | ***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | #include "driver.h" |
| 14 | #include "deprecat.h" | |
| 15 | 14 | #include "m10.h" |
| 16 | 15 | |
| 17 | 16 | static tilemap * tx_tilemap; |
| r2844 | r2845 | |
| 43 | 42 | |
| 44 | 43 | static UINT32 tilemap_scan(UINT32 col,UINT32 row,UINT32 num_cols,UINT32 num_rows) |
| 45 | 44 | { |
| 46 | //m10_state *state = Machine->driver_data; | |
| 47 | ||
| 48 | 45 | return (31-col)*32 + row; |
| 49 | 46 | } |
| 50 | 47 | |
| r2844 | r2845 | |
| 78 | 75 | } |
| 79 | 76 | |
| 80 | 77 | |
| 81 | INLINE void plot_pixel_m10(bitmap_t *bm, int x, int y, int col) | |
| 78 | INLINE void plot_pixel_m10(running_machine *machine, bitmap_t *bm, int x, int y, int col) | |
| 82 | 79 | { |
| 83 | m10_state *state = | |
| 80 | m10_state *state = machine->driver_data; | |
| 84 | 81 | |
| 85 | 82 | if (!state->flip) |
| 86 | 83 | *BITMAP_ADDR16(bm, y, x) = col; |
| r2844 | r2845 | |
| 152 | 149 | int y; |
| 153 | 150 | |
| 154 | 151 | for (y = IREMM10_VBEND;y < IREMM10_VBSTART;y++) |
| 155 | plot_pixel_m10(bitmap,16,y,1); | |
| 152 | plot_pixel_m10(screen->machine, bitmap,16,y,1); | |
| 156 | 153 | } |
| 157 | 154 | |
| 158 | 155 | for (offs = videoram_size - 1;offs >= 0;offs--) |
| r2844 | r2845 | |
|---|---|---|
| 1399 | 1399 | case 0: |
| 1400 | 1400 | { |
| 1401 | 1401 | int changed = mux_outputlatch ^ data; |
| 1402 | static const char *port[] = { "STROBE0", "STROBE1", "STROBE2", "STROBE3", "STROBE4", "STROBE5", "STROBE6", "STROBE7" }; | |
| 1402 | 1403 | |
| 1403 | 1404 | mux_outputlatch = data; |
| 1404 | 1405 | |
| r2844 | r2845 | |
| 1409 | 1410 | |
| 1410 | 1411 | /* Clock is low */ |
| 1411 | 1412 | if (!(data & 0x08)) |
| 1412 | mux_input = input_port_read | |
| 1413 | mux_input = input_port_read | |
| 1413 | 1414 | } |
| 1414 | 1415 | break; |
| 1415 | 1416 | } |
| r2844 | r2845 | |
|---|---|---|
| 152 | 152 | #include "cpu/m6805/m6805.h" |
| 153 | 153 | #include "sound/ay8910.h" |
| 154 | 154 | #include "sound/msm5232.h" |
| 155 | #include "includes/nycaptor.h" | |
| 155 | 156 | |
| 156 | VIDEO_START( nycaptor ); | |
| 157 | VIDEO_UPDATE( nycaptor ); | |
| 158 | ||
| 159 | ||
| 160 | extern UINT8 *nycaptor_scrlram; | |
| 161 | 157 | UINT8 *nycaptor_sharedram; |
| 162 | 158 | static int generic_control_reg = 0; |
| 163 | 159 | static int sound_nmi_enable=0,pending_nmi=0; |
| 164 | 160 | int nyc_gametype=0; |
| 165 | 161 | |
| 166 | WRITE8_HANDLER( nycaptor_videoram_w ); | |
| 167 | WRITE8_HANDLER( nycaptor_spriteram_w ); | |
| 168 | WRITE8_HANDLER( nycaptor_palette_w ); | |
| 169 | WRITE8_HANDLER( nycaptor_gfxctrl_w ); | |
| 170 | WRITE8_HANDLER( nycaptor_scrlram_w ); | |
| 171 | WRITE8_HANDLER( nycaptor_68705_portA_w ); | |
| 172 | WRITE8_HANDLER( nycaptor_68705_portB_w ); | |
| 173 | WRITE8_HANDLER( nycaptor_68705_portC_w ); | |
| 174 | WRITE8_HANDLER( nycaptor_68705_ddrA_w ); | |
| 175 | WRITE8_HANDLER( nycaptor_68705_ddrB_w ); | |
| 176 | WRITE8_HANDLER( nycaptor_68705_ddrC_w ); | |
| 177 | WRITE8_HANDLER( nycaptor_mcu_w ); | |
| 178 | ||
| 179 | READ8_HANDLER( nycaptor_mcu_r ); | |
| 180 | READ8_HANDLER( nycaptor_mcu_status_r1 ); | |
| 181 | READ8_HANDLER( nycaptor_mcu_status_r2 ); | |
| 182 | READ8_HANDLER( nycaptor_spriteram_r ); | |
| 183 | READ8_HANDLER( nycaptor_palette_r ); | |
| 184 | READ8_HANDLER( nycaptor_gfxctrl_r ); | |
| 185 | READ8_HANDLER( nycaptor_scrlram_r ); | |
| 186 | READ8_HANDLER( nycaptor_68705_portC_r ); | |
| 187 | READ8_HANDLER( nycaptor_68705_portB_r ); | |
| 188 | READ8_HANDLER( nycaptor_68705_portA_r ); | |
| 189 | READ8_HANDLER( nycaptor_videoram_r ); | |
| 190 | ||
| 191 | ||
| 192 | ||
| 193 | 162 | static WRITE8_HANDLER( sub_cpu_halt_w ) |
| 194 | 163 | { |
| 195 | 164 | cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, (data )? ASSERT_LINE : CLEAR_LINE); |
| r2844 | r2845 | |
|---|---|---|
| 242 | 242 | #include "audio/taitosnd.h" |
| 243 | 243 | #include "sound/2203intf.h" |
| 244 | 244 | #include "sound/2151intf.h" |
| 245 | #include "includes/cchip.h" | |
| 245 | 246 | |
| 246 | 247 | VIDEO_START( rainbow ); |
| 247 | 248 | VIDEO_START( jumping ); |
| r2844 | r2845 | |
| 252 | 253 | WRITE16_HANDLER( jumping_spritectrl_w ); |
| 253 | 254 | WRITE16_HANDLER( rainbow_spritectrl_w ); |
| 254 | 255 | |
| 255 | void rainbow_cchip_init(int version); | |
| 256 | READ16_HANDLER( rainbow_cchip_ctrl_r ); | |
| 257 | READ16_HANDLER( rainbow_cchip_ram_r ); | |
| 258 | WRITE16_HANDLER( rainbow_cchip_ctrl_w ); | |
| 259 | WRITE16_HANDLER( rainbow_cchip_bank_w ); | |
| 260 | WRITE16_HANDLER( rainbow_cchip_ram_w ); | |
| 261 | ||
| 262 | 256 | static UINT8 jumping_latch = 0; |
| 263 | 257 | |
| 264 | 258 |
| r2844 | r2845 | |
|---|---|---|
| 180 | 180 | |
| 181 | 181 | static READ32_HANDLER(Input_r) |
| 182 | 182 | { |
| 183 | if(offset==0) | |
| 184 | return input_port_read_indexed(machine, 0)|(input_port_read_indexed(machine, 1)<<16); | |
| 185 | else if(offset==1) | |
| 186 | return input_port_read_indexed(machine, 2)|(input_port_read_indexed(machine, 3)<<16); | |
| 187 | else if(offset==2) | |
| 183 | if(offset == 0) | |
| 184 | return input_port_read(machine, "IN0")|(input_port_read(machine, "IN1")<<16); | |
| 185 | else if(offset == 1) | |
| 186 | return input_port_read(machine, "IN2")|(input_port_read(machine, "IN3")<<16); | |
| 187 | else if(offset == 2) | |
| 188 | 188 | { |
| 189 | UINT8 Port4=input_port_read_indexed(machine, 4); | |
| 190 | if(!(Port4&0x10) && ((OldPort4^Port4)&0x10)) //coin buttons trigger IRQs | |
| 189 | UINT8 Port4 = input_port_read(machine, "IN4"); | |
| 190 | if(!(Port4 & 0x10) && ((OldPort4^Port4) & 0x10)) //coin buttons trigger IRQs | |
| 191 | 191 | IntReq(machine, 12); |
| 192 | if(!(Port4&0x20) && ((OldPort4^Port4)&0x20)) | |
| 192 | if(!(Port4 & 0x20) && ((OldPort4^Port4) & 0x20)) | |
| 193 | 193 | IntReq(machine, 19); |
| 194 | OldPort4=Port4; | |
| 195 | return /*dips*/input_port_read_indexed(machine, 5)|(Port4<<16); | |
| 194 | OldPort4 = Port4; | |
| 195 | return /*dips*/input_port_read(machine, "DSW")|(Port4<<16); | |
| 196 | 196 | } |
| 197 | 197 | return 0; |
| 198 | 198 | } |
| r2844 | r2845 | |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | static INPUT_PORTS_START(crystal) |
| 721 | PORT_START | |
| 722 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 723 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 724 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 725 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 726 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 727 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 728 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) | |
| 729 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) | |
| 721 | PORT_START_TAG("IN0") | |
| 722 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 723 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 724 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 725 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 726 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 727 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 728 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) | |
| 729 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) | |
| 730 | 730 | |
| 731 | PORT_START | |
| 732 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) | |
| 733 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) | |
| 734 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) | |
| 735 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) | |
| 736 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) | |
| 737 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) | |
| 738 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) | |
| 739 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) | |
| 731 | PORT_START_TAG("IN1") | |
| 732 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) | |
| 733 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) | |
| 734 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) | |
| 735 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) | |
| 736 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) | |
| 737 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) | |
| 738 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) | |
| 739 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) | |
| 740 | 740 | |
| 741 | PORT_START | |
| 742 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) | |
| 743 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) | |
| 744 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) | |
| 745 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) | |
| 746 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) | |
| 747 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) | |
| 748 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3) | |
| 749 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4) | |
| 741 | PORT_START_TAG("IN2") | |
| 742 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) | |
| 743 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) | |
| 744 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) | |
| 745 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) | |
| 746 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) | |
| 747 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) | |
| 748 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3) | |
| 749 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4) | |
| 750 | 750 | |
| 751 | PORT_START | |
| 752 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) | |
| 753 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) | |
| 754 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) | |
| 755 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) | |
| 756 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) | |
| 757 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) | |
| 758 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) | |
| 759 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) | |
| 751 | PORT_START_TAG("IN3") | |
| 752 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) | |
| 753 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) | |
| 754 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) | |
| 755 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) | |
| 756 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) | |
| 757 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) | |
| 758 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) | |
| 759 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) | |
| 760 | 760 | |
| 761 | PORT_START | |
| 762 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_START1 ) | |
| 763 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_START2 ) | |
| 764 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_START3 ) | |
| 765 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_START4 ) | |
| 766 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 767 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 768 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 761 | PORT_START_TAG("IN4") | |
| 762 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) | |
| 763 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) | |
| 764 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 ) | |
| 765 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 ) | |
| 766 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 767 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 768 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 769 | 769 | PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW ) |
| 770 | 770 | |
| 771 | PORT_START | |
| 771 | PORT_START_TAG("DSW") | |
| 772 | 772 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Pause ) ) |
| 773 | 773 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 774 | 774 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 931 | 931 | GAME( 2001, evosocc, crysbios, crystal, crystal, evosocc, ROT0, "Evoga", "Evolution Soccer", 0 ) |
| 932 | 932 | GAME( 2001, topbladv, crysbios, crystal, crystal, 0, ROT0, "unknown", "Top Blade V", GAME_NOT_WORKING ) // protection |
| 933 | 933 | |
| 934 | GAME( 2001, officeye, 0, crystal, crystal, 0, ROT0, "unknown", "Office Yeo | |
| 934 | GAME( 2001, officeye, 0, crystal, crystal, 0, ROT0, "unknown", "Office Yeo In Cheon Ha", GAME_NOT_WORKING ) // protection | |
| 935 | 935 | |
| 936 | 936 |
| r2844 | r2845 | |
|---|---|---|
| 273 | 273 | #include "sound/2203intf.h" |
| 274 | 274 | #include "sound/3812intf.h" |
| 275 | 275 | #include "cpu/m6805/m6805.h" |
| 276 | #include "includes/bublbobl.h" | |
| 276 | 277 | |
| 277 | /* video/bublbobl.c */ | |
| 278 | extern UINT8 *bublbobl_objectram; | |
| 279 | extern size_t bublbobl_objectram_size; | |
| 280 | VIDEO_UPDATE( bublbobl ); | |
| 281 | ||
| 282 | /* machine/bublbobl.c */ | |
| 283 | extern UINT8 *bublbobl_mcu_sharedram; | |
| 284 | WRITE8_HANDLER( bublbobl_bankswitch_w ); | |
| 285 | WRITE8_HANDLER( tokio_bankswitch_w ); | |
| 286 | WRITE8_HANDLER( tokio_videoctrl_w ); | |
| 287 | WRITE8_HANDLER( bublbobl_nmitrigger_w ); | |
| 288 | READ8_HANDLER( tokio_mcu_r ); | |
| 289 | READ8_HANDLER( tokiob_mcu_r ); | |
| 290 | WRITE8_HANDLER( bublbobl_sound_command_w ); | |
| 291 | WRITE8_HANDLER( bublbobl_sh_nmi_disable_w ); | |
| 292 | WRITE8_HANDLER( bublbobl_sh_nmi_enable_w ); | |
| 293 | READ8_HANDLER( boblbobl_ic43_a_r ); | |
| 294 | WRITE8_HANDLER( boblbobl_ic43_a_w ); | |
| 295 | READ8_HANDLER( boblbobl_ic43_b_r ); | |
| 296 | WRITE8_HANDLER( boblbobl_ic43_b_w ); | |
| 297 | ||
| 298 | READ8_HANDLER( bublbobl_mcu_ddr1_r ); | |
| 299 | WRITE8_HANDLER( bublbobl_mcu_ddr1_w ); | |
| 300 | READ8_HANDLER( bublbobl_mcu_ddr2_r ); | |
| 301 | WRITE8_HANDLER( bublbobl_mcu_ddr2_w ); | |
| 302 | READ8_HANDLER( bublbobl_mcu_ddr3_r ); | |
| 303 | WRITE8_HANDLER( bublbobl_mcu_ddr3_w ); | |
| 304 | READ8_HANDLER( bublbobl_mcu_ddr4_r ); | |
| 305 | WRITE8_HANDLER( bublbobl_mcu_ddr4_w ); | |
| 306 | READ8_HANDLER( bublbobl_mcu_port1_r ); | |
| 307 | WRITE8_HANDLER( bublbobl_mcu_port1_w ); | |
| 308 | READ8_HANDLER( bublbobl_mcu_port2_r ); | |
| 309 | WRITE8_HANDLER( bublbobl_mcu_port2_w ); | |
| 310 | READ8_HANDLER( bublbobl_mcu_port3_r ); | |
| 311 | WRITE8_HANDLER( bublbobl_mcu_port3_w ); | |
| 312 | READ8_HANDLER( bublbobl_mcu_port4_r ); | |
| 313 | WRITE8_HANDLER( bublbobl_mcu_port4_w ); | |
| 314 | ||
| 315 | // for 68705 bootleg | |
| 316 | INTERRUPT_GEN( bublbobl_m68705_interrupt ); | |
| 317 | READ8_HANDLER( bublbobl_68705_portA_r ); | |
| 318 | WRITE8_HANDLER( bublbobl_68705_portA_w ); | |
| 319 | WRITE8_HANDLER( bublbobl_68705_ddrA_w ); | |
| 320 | READ8_HANDLER( bublbobl_68705_portB_r ); | |
| 321 | WRITE8_HANDLER( bublbobl_68705_portB_w ); | |
| 322 | WRITE8_HANDLER( bublbobl_68705_ddrB_w ); | |
| 323 | ||
| 324 | ||
| 325 | 278 | #if 0 // doesn't work for some reason |
| 326 | 279 | static WRITE8_HANDLER(soundcpu_reset_w) |
| 327 | 280 | { |
| r2844 | r2845 | |
| 380 | 333 | ADDRESS_MAP_GLOBAL_MASK(0x7ff) |
| 381 | 334 | AM_RANGE(0x000, 0x000) AM_READWRITE(bublbobl_68705_portA_r, bublbobl_68705_portA_w) |
| 382 | 335 | AM_RANGE(0x001, 0x001) AM_READWRITE(bublbobl_68705_portB_r, bublbobl_68705_portB_w) |
| 383 | AM_RANGE(0x002, 0x002) AM_READ | |
| 336 | AM_RANGE(0x002, 0x002) AM_READ | |
| 384 | 337 | AM_RANGE(0x004, 0x004) AM_WRITE(bublbobl_68705_ddrA_w) |
| 385 | 338 | AM_RANGE(0x005, 0x005) AM_WRITE(bublbobl_68705_ddrB_w) |
| 386 | 339 | AM_RANGE(0x006, 0x006) AM_WRITENOP // ??? |
| r2844 | r2845 | |
| 403 | 356 | AM_RANGE(0xfd00, 0xfdff) AM_RAM |
| 404 | 357 | AM_RANGE(0xfe00, 0xfe03) AM_READWRITE(boblbobl_ic43_a_r,boblbobl_ic43_a_w) |
| 405 | 358 | AM_RANGE(0xfe80, 0xfe83) AM_READWRITE(boblbobl_ic43_b_r,boblbobl_ic43_b_w) |
| 406 | AM_RANGE(0xff00, 0xff00) AM_READ(input_port_0_r) | |
| 407 | AM_RANGE(0xff01, 0xff01) AM_READ(input_port_1_r) | |
| 408 | AM_RANGE(0xff02, 0xff02) AM_READ(input_port_2_r) | |
| 409 | AM_RANGE(0xff03, 0xff03) AM_READ(input_port_3_r) | |
| 359 | AM_RANGE(0xff00, 0xff00) AM_READ_PORT("DSW0") | |
| 360 | AM_RANGE(0xff01, 0xff01) AM_READ_PORT("DSW1") | |
| 361 | AM_RANGE(0xff02, 0xff02) AM_READ_PORT("IN0") | |
| 362 | AM_RANGE(0xff03, 0xff03) AM_READ_PORT("IN1") | |
| 410 | 363 | AM_RANGE(0xff94, 0xff94) AM_WRITENOP // ??? |
| 411 | 364 | AM_RANGE(0xff98, 0xff98) AM_WRITENOP // ??? |
| 412 | 365 | ADDRESS_MAP_END |
| r2844 | r2845 | |
| 420 | 373 | AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_SHARE(1) |
| 421 | 374 | AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_BASE(&paletteram) |
| 422 | 375 | AM_RANGE(0xfa00, 0xfa00) AM_WRITE(watchdog_reset_w) |
| 423 | AM_RANGE(0xfa03, 0xfa03) AM_READ(input_port_0_r) | |
| 424 | AM_RANGE(0xfa04, 0xfa04) AM_READ(input_port_1_r) | |
| 425 | AM_RANGE(0xfa05, 0xfa05) AM_READ(input_port_2_r) | |
| 426 | AM_RANGE(0xfa06, 0xfa06) AM_READ(input_port_3_r) | |
| 427 | AM_RANGE(0xfa07, 0xfa07) AM_READ(input_port_4_r) | |
| 376 | AM_RANGE(0xfa03, 0xfa03) AM_READ_PORT("DSW0") | |
| 377 | AM_RANGE(0xfa04, 0xfa04) AM_READ_PORT("DSW1") | |
| 378 | AM_RANGE(0xfa05, 0xfa05) AM_READ_PORT("IN0") | |
| 379 | AM_RANGE(0xfa06, 0xfa06) AM_READ_PORT("IN1") | |
| 380 | AM_RANGE(0xfa07, 0xfa07) AM_READ_PORT("IN2") | |
| 428 | 381 | AM_RANGE(0xfa80, 0xfa80) AM_WRITE(tokio_bankswitch_w) |
| 429 | 382 | AM_RANGE(0xfb00, 0xfb00) AM_WRITE(tokio_videoctrl_w) |
| 430 | 383 | AM_RANGE(0xfb80, 0xfb80) AM_WRITE(bublbobl_nmitrigger_w) |
| r2844 | r2845 | |
| 1328 | 1281 | |
| 1329 | 1282 | static DRIVER_INIT( tokio ) |
| 1330 | 1283 | { |
| 1331 | extern int bublbobl_video_enable; | |
| 1332 | ||
| 1333 | 1284 | /* preemptively enable video, the bit is not mapped for this game and */ |
| 1334 | 1285 | /* I don't know if it even has it. */ |
| 1335 | 1286 | bublbobl_video_enable = 1; |
| r2844 | r2845 | |
|---|---|---|
| 95 | 95 | |
| 96 | 96 | static void ar_coin_hack(void) |
| 97 | 97 | { |
| 98 | if(input_port_read | |
| 98 | if(input_port_read | |
| 99 | 99 | { |
| 100 | 100 | if(coin_stat==0) |
| 101 | 101 | { |
| r2844 | r2845 | |
| 221 | 221 | /* Even reads must return 0xff - Odd reads must return the contents of input port 5. |
| 222 | 222 | Code at 0x5061 is executed once during P.O.S.T. where there is one read. |
| 223 | 223 | Code at 0x50b4 is then executed each frame (not sure) where there are 2 reads. */ |
| 224 | return ( (cshooter_counter++ & 1) ? 0xff : input_port_read | |
| 224 | return ( (cshooter_counter++ & 1) ? 0xff : input_port_read | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | static WRITE8_HANDLER ( cshooter_c500_w ) |
| r2844 | r2845 | |
| 262 | 262 | AM_RANGE(0x8000, 0xafff) AM_READ(SMH_BANK1) |
| 263 | 263 | AM_RANGE(0xb000, 0xb0ff) AM_READ(SMH_RAM) // sound related ? |
| 264 | 264 | AM_RANGE(0xc000, 0xc1ff) AM_WRITE(pal_w) AM_READ(pal_r) AM_BASE(&paletteram) |
| 265 | AM_RANGE(0xc200, 0xc200) AM_READ(input_port_0_r) | |
| 266 | AM_RANGE(0xc201, 0xc201) AM_READ(input_port_1_r) | |
| 267 | AM_RANGE(0xc202, 0xc202) AM_READ(input_port_2_r) | |
| 268 | AM_RANGE(0xc203, 0xc203) AM_READ(input_port_3_r) | |
| 269 | AM_RANGE(0xc204, 0xc204) AM_READ(input_port_4_r) | |
| 265 | AM_RANGE(0xc200, 0xc200) AM_READ_PORT("IN0") | |
| 266 | AM_RANGE(0xc201, 0xc201) AM_READ_PORT("IN1") | |
| 267 | AM_RANGE(0xc202, 0xc202) AM_READ_PORT("IN2") | |
| 268 | AM_RANGE(0xc203, 0xc203) AM_READ_PORT("DSW2") | |
| 269 | AM_RANGE(0xc204, 0xc204) AM_READ_PORT("DSW1") | |
| 270 | 270 | AM_RANGE(0xc205, 0xc205) AM_READ(cshooter_coin_r) // hack until I understand |
| 271 | 271 | AM_RANGE(0xd000, 0xd7ff) AM_READ(SMH_RAM) |
| 272 | 272 | AM_RANGE(0xd800, 0xdfff) AM_READ(SMH_RAM) |
| r2844 | r2845 | |
| 290 | 290 | AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) |
| 291 | 291 | AM_RANGE(0xb000, 0xb0ff) AM_RAM // sound related ? |
| 292 | 292 | AM_RANGE(0xb100, 0xb1ff) AM_RAM//READ(SMH_BANK1) // sound related ? |
| 293 | AM_RANGE(0xc000, 0xc000) AM_READ(input_port_0_r) | |
| 294 | AM_RANGE(0xc001, 0xc001) AM_READ(input_port_1_r) | |
| 295 | AM_RANGE(0xc002, 0xc002) AM_READ(input_port_2_r) | |
| 296 | AM_RANGE(0xc003, 0xc003) AM_READ(input_port_3_r) | |
| 297 | AM_RANGE(0xc004, 0xc004) AM_READ(input_port_4_r) | |
| 293 | AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0") | |
| 294 | AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN1") | |
| 295 | AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2") | |
| 296 | AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW2") | |
| 297 | AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW1") | |
| 298 | 298 | AM_RANGE(0xd000, 0xd7ff) AM_READ(SMH_RAM) |
| 299 | 299 | AM_RANGE(0xd800, 0xdbff) AM_WRITE(pal2_w) AM_READ(pal_r) AM_BASE(&paletteram) |
| 300 | 300 | AM_RANGE(0xdc11, 0xdc11) AM_WRITE(bank_w) |
| r2844 | r2845 | |
| 370 | 370 | |
| 371 | 371 | |
| 372 | 372 | static INPUT_PORTS_START( cshooter ) |
| 373 | PORT_START /* IN0 (0xc200) */ | |
| 373 | PORT_START_TAG("IN0") /* IN0 (0xc200) */ | |
| 374 | 374 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| 375 | 375 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 376 | 376 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| r2844 | r2845 | |
| 380 | 380 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 381 | 381 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 382 | 382 | |
| 383 | PORT_START /* IN1 (0xc201) */ | |
| 383 | PORT_START_TAG("IN1") /* IN1 (0xc201) */ | |
| 384 | 384 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL |
| 385 | 385 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL |
| 386 | 386 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL |
| r2844 | r2845 | |
| 390 | 390 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 391 | 391 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 392 | 392 | |
| 393 | PORT_START /* START (0xc202) */ | |
| 393 | PORT_START_TAG("IN2") /* START (0xc202) */ | |
| 394 | 394 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 395 | 395 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 396 | 396 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r2844 | r2845 | |
| 400 | 400 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 401 | 401 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 402 | 402 | |
| 403 | PORT_START /* DSW2 (0xc203) */ | |
| 403 | PORT_START_TAG("DSW2") /* DSW2 (0xc203) */ | |
| 404 | 404 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) |
| 405 | 405 | PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) |
| 406 | 406 | PORT_DIPSETTING( 0x02, DEF_STR( Medium ) ) |
| r2844 | r2845 | |
| 419 | 419 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) |
| 420 | 420 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) |
| 421 | 421 | |
| 422 | PORT_START /* DSW1 (0xc204) */ | |
| 422 | PORT_START_TAG("DSW1") /* DSW1 (0xc204) */ | |
| 423 | 423 | PORT_DIPNAME( 0x01, 0x01, "Coin Slots" ) |
| 424 | 424 | PORT_DIPSETTING( 0x01, "1" ) |
| 425 | 425 | PORT_DIPSETTING( 0x00, "2" ) |
| r2844 | r2845 | |
| 439 | 439 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) |
| 440 | 440 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) |
| 441 | 441 | |
| 442 | PORT_START /* COIN (0xc205) */ | |
| 442 | PORT_START_TAG("COIN") /* COIN (0xc205) */ | |
| 443 | 443 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) |
| 444 | 444 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) |
| 445 | 445 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r2844 | r2845 | |
|---|---|---|
| 123 | 123 | #include "includes/kaneko16.h" |
| 124 | 124 | #include "sound/okim6295.h" |
| 125 | 125 | |
| 126 | //extern DRIVER_INIT(berlwall); | |
| 127 | extern VIDEO_START(galsnew); | |
| 128 | extern VIDEO_UPDATE(galsnew); | |
| 129 | extern PALETTE_INIT(berlwall); | |
| 130 | extern UINT16* galsnew_bg_pixram; | |
| 131 | extern UINT16* galsnew_fg_pixram; | |
| 132 | ||
| 133 | 126 | static INPUT_PORTS_START( galsnew ) |
| 134 | 127 | PORT_START_TAG("DSW1") |
| 135 | 128 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unused ) ) |
| r2844 | r2845 | |
|---|---|---|
| 12 | 12 | #include "machine/konamiic.h" |
| 13 | 13 | |
| 14 | 14 | static UINT32 *vram; |
| 15 | static UINT32 *workram; | |
| 15 | 16 | |
| 16 | 17 | static VIDEO_UPDATE( ultrsprt ) |
| 17 | 18 | { |
| r2844 | r2845 | |
| 81 | 82 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ1, CLEAR_LINE); |
| 82 | 83 | } |
| 83 | 84 | |
| 85 | static MACHINE_START( ultrsprt ) | |
| 86 | { | |
| 87 | /* set conservative DRC options */ | |
| 88 | cpunum_set_info_int(0, CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS); | |
| 89 | ||
| 90 | /* configure fast RAM regions for DRC */ | |
| 91 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_SELECT, 0); | |
| 92 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_START, 0x00000000); | |
| 93 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_END, 0x0007ffff); | |
| 94 | cpunum_set_info_ptr(0, CPUINFO_PTR_PPC_FASTRAM_BASE, vram); | |
| 95 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_READONLY, 0); | |
| 96 | ||
| 97 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_SELECT, 1); | |
| 98 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_START, 0x7f000000); | |
| 99 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_END, 0x7f01ffff); | |
| 100 | cpunum_set_info_ptr(0, CPUINFO_PTR_PPC_FASTRAM_BASE, workram); | |
| 101 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_READONLY, 0); | |
| 102 | } | |
| 103 | ||
| 84 | 104 | static ADDRESS_MAP_START( ultrsprt_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 85 | ADDRESS_MAP_GLOBAL_MASK(0x7fffffff) | |
| 86 | 105 | AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_BASE(&vram) |
| 87 | 106 | AM_RANGE(0x70000000, 0x70000003) AM_READWRITE(eeprom_r, eeprom_w) |
| 88 | 107 | AM_RANGE(0x70000020, 0x70000023) AM_READ(control1_r) |
| r2844 | r2845 | |
| 90 | 109 | AM_RANGE(0x70000080, 0x70000087) AM_WRITE(K056800_host_w) |
| 91 | 110 | AM_RANGE(0x70000088, 0x7000008f) AM_READ(K056800_host_r) |
| 92 | 111 | AM_RANGE(0x700000e0, 0x700000e3) AM_WRITE(int_ack_w) |
| 93 | AM_RANGE(0x7f000000, 0x7f01ffff) AM_RAM | |
| 112 | AM_RANGE(0x7f000000, 0x7f01ffff) AM_RAM AM_BASE(&workram) | |
| 94 | 113 | AM_RANGE(0x7f700000, 0x7f703fff) AM_RAM_WRITE(palette_w) AM_BASE(&paletteram32) |
| 95 | 114 | AM_RANGE(0x7fa00000, 0x7fbfffff) AM_ROM AM_SHARE(1) |
| 96 | 115 | AM_RANGE(0x7fc00000, 0x7fdfffff) AM_ROM AM_SHARE(1) |
| r2844 | r2845 | |
| 231 | 250 | MDRV_INTERLEAVE(200) |
| 232 | 251 | |
| 233 | 252 | MDRV_NVRAM_HANDLER(ultrsprt) |
| 253 | MDRV_MACHINE_START(ultrsprt) | |
| 234 | 254 | |
| 235 | 255 | /* video hardware */ |
| 236 | 256 | MDRV_SCREEN_ADD("main", RASTER) |
| r2844 | r2845 | |
|---|---|---|
| 74 | 74 | #include "sound/ay8910.h" |
| 75 | 75 | #include "sound/namco.h" |
| 76 | 76 | |
| 77 | WRITE8_HANDLER( snkwave_w ); | |
| 78 | ||
| 79 | 77 | extern UINT8 *mainsnk_fgram; |
| 80 | 78 | extern UINT8 *mainsnk_bgram; |
| 81 | 79 | WRITE8_HANDLER(mainsnk_c600_w); |
| r2844 | r2845 | |
|---|---|---|
| 91 | 91 | |
| 92 | 92 | static VIDEO_START( snowbros ) |
| 93 | 93 | { |
| 94 | pandora_start(0,0,0); | |
| 94 | pandora_start(machine,0,0,0); | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | static VIDEO_EOF( snowbros ) |
| r2844 | r2845 | |
|---|---|---|
| 252 | 252 | |
| 253 | 253 | static INTERRUPT_GEN( bzone_interrupt ) |
| 254 | 254 | { |
| 255 | if (input_port_read | |
| 255 | if (input_port_read | |
| 256 | 256 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 257 | 257 | } |
| 258 | 258 | |
| r2844 | r2845 | |
| 299 | 299 | |
| 300 | 300 | static READ8_HANDLER( redbaron_joy_r ) |
| 301 | 301 | { |
| 302 | return input_port_read | |
| 302 | return input_port_read | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | |
| r2844 | r2845 | |
| 806 | 806 | |
| 807 | 807 | static WRITE8_HANDLER( analog_select_w ) |
| 808 | 808 | { |
| 809 | static const char *analog_port[] = { "AN0", "AN1", "AN2" }; | |
| 810 | ||
| 809 | 811 | if (offset <= 2) |
| 810 | analog_data = input_port_read | |
| 812 | analog_data = input_port_read | |
| 811 | 813 | } |
| 812 | 814 | |
| 813 | 815 |
| r2844 | r2845 | |
|---|---|---|
| 351 | 351 | D0: Sound section reset (1= normal operation, 0= reset) |
| 352 | 352 | */ |
| 353 | 353 | if (((oldval ^ data) & 0x40) && !(data & 0x40)) watchdog_reset_w(machine,0,0); |
| 354 | segaic16_set_display_enable(data & 0x20); | |
| 354 | segaic16_set_display_enable(machine, data & 0x20); | |
| 355 | 355 | cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE); |
| 356 | 356 | return; |
| 357 | 357 |
| r2844 | r2845 | |
|---|---|---|
| 53 | 53 | |
| 54 | 54 | static READ16_HANDLER( ghunter_trackball_low_r ) |
| 55 | 55 | { |
| 56 | return (input_port_read | |
| 56 | return (input_port_read | |
| 57 | 57 | } |
| 58 | 58 | static READ16_HANDLER( ghunter_trackball_high_r ) |
| 59 | 59 | { |
| 60 | return ((input_port_read | |
| 60 | return ((input_port_read | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /* Memory Maps */ |
| r2844 | r2845 | |
| 94 | 94 | static INPUT_PORTS_START( deadang ) |
| 95 | 95 | SEIBU_COIN_INPUTS /* coin inputs read through sound cpu */ |
| 96 | 96 | |
| 97 | PORT_START /* IN0 */ | |
| 97 | PORT_START_TAG("IN0") /* IN0 */ | |
| 98 | 98 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 99 | 99 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 100 | 100 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| r2844 | r2845 | |
| 111 | 111 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START2 ) |
| 112 | 112 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 ) |
| 113 | 113 | |
| 114 | PORT_START /* Dip switch A */ | |
| 114 | PORT_START_TAG("DSW") /* Dip switch A */ | |
| 115 | 115 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) |
| 116 | 116 | PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) ) |
| 117 | 117 | PORT_DIPSETTING( 0x0004, DEF_STR( 4C_1C ) ) |
| r2844 | r2845 | |
| 160 | 160 | static INPUT_PORTS_START( ghunter ) |
| 161 | 161 | SEIBU_COIN_INPUTS /* coin inputs read through sound cpu */ |
| 162 | 162 | |
| 163 | PORT_START /* IN0 */ | |
| 163 | PORT_START_TAG("IN0") /* IN0 */ | |
| 164 | 164 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 165 | 165 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 166 | 166 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| r2844 | r2845 | |
| 177 | 177 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START2 ) |
| 178 | 178 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 ) |
| 179 | 179 | |
| 180 | PORT_START /* Dip switch A */ | |
| 180 | PORT_START_TAG("DSW") /* Dip switch A */ | |
| 181 | 181 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) |
| 182 | 182 | PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) ) |
| 183 | 183 | PORT_DIPSETTING( 0x0004, DEF_STR( 4C_1C ) ) |
| r2844 | r2845 | |
| 223 | 223 | PORT_DIPSETTING( 0x0000, DEF_STR( Japan ) ) |
| 224 | 224 | PORT_DIPSETTING( 0x8000, "Overseas" ) |
| 225 | 225 | |
| 226 | PORT_START | |
| 226 | PORT_START_TAG("TRACKX") | |
| 227 | 227 | PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(30) PORT_PLAYER(1) |
| 228 | 228 | |
| 229 | PORT_START | |
| 229 | PORT_START_TAG("TRACKY") | |
| 230 | 230 | PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(30) PORT_PLAYER(1) |
| 231 | 231 | INPUT_PORTS_END |
| 232 | 232 |
| r2844 | r2845 | |
|---|---|---|
| 162 | 162 | |
| 163 | 163 | static READ8_HANDLER( cliff_port_r ) |
| 164 | 164 | { |
| 165 | static const char *banknames[] = { "BANK0", "BANK1", "BANK2", "BANK3", "BANK4", "BANK5", "BANK6" }; | |
| 166 | ||
| 165 | 167 | if ( port_bank < 7 ) |
| 166 | 168 | { |
| 167 | return input_port_read | |
| 169 | return input_port_read | |
| 168 | 170 | } |
| 169 | 171 | |
| 170 | 172 | /* output is pulled up for non-mapped ports */ |
| r2844 | r2845 | |
|---|---|---|
| 82 | 82 | |
| 83 | 83 | static READ8_HANDLER( copsnrob_misc_r ) |
| 84 | 84 | { |
| 85 | return misc | (input_port_read | |
| 85 | return misc | (input_port_read | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | static WRITE8_HANDLER( copsnrob_misc_w ) |
| r2844 | r2845 | |
| 118 | 118 | AM_RANGE(0x0b00, 0x0bff) AM_RAM |
| 119 | 119 | AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) |
| 120 | 120 | // AM_RANGE(0x1000, 0x1003) AM_WRITENOP |
| 121 | // AM_RANGE(0x1000, 0x1000) AM_READ | |
| 121 | // AM_RANGE(0x1000, 0x1000) AM_READ | |
| 122 | 122 | AM_RANGE(0x1000, 0x1000) AM_READ(copsnrob_misc_r) |
| 123 | 123 | AM_RANGE(0x1000, 0x1000) AM_WRITE(copsnrob_misc_w) |
| 124 | 124 | AM_RANGE(0x1002, 0x100e) AM_READ(copsnrob_gun_position_r) |
| 125 | AM_RANGE(0x1012, 0x1012) AM_READ(input_port_3_r) | |
| 126 | AM_RANGE(0x1016, 0x1016) AM_READ(input_port_1_r) | |
| 127 | AM_RANGE(0x101a, 0x101a) AM_READ(input_port_2_r) | |
| 125 | AM_RANGE(0x1012, 0x1012) AM_READ_PORT("DSW") | |
| 126 | AM_RANGE(0x1016, 0x1016) AM_READ_PORT("IN1") | |
| 127 | AM_RANGE(0x101a, 0x101a) AM_READ_PORT("IN2") | |
| 128 | 128 | AM_RANGE(0x1200, 0x1fff) AM_ROM |
| 129 | 129 | ADDRESS_MAP_END |
| 130 | 130 | |
| r2844 | r2845 | |
| 137 | 137 | *************************************/ |
| 138 | 138 | |
| 139 | 139 | static INPUT_PORTS_START( copsnrob ) |
| 140 | PORT_START | |
| 140 | PORT_START_TAG("IN0") /* IN0 */ | |
| 141 | 141 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 142 | 142 | |
| 143 | PORT_START | |
| 143 | PORT_START_TAG("IN1") /* IN1 */ | |
| 144 | 144 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) |
| 145 | 145 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 146 | 146 | |
| 147 | PORT_START | |
| 147 | PORT_START_TAG("IN2") /* IN2 */ | |
| 148 | 148 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 149 | 149 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 150 | 150 | |
| 151 | PORT_START | |
| 151 | PORT_START_TAG("DSW") /* DIP1 */ | |
| 152 | 152 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) |
| 153 | 153 | PORT_DIPSETTING( 0x03, "1 Coin/1 Player" ) |
| 154 | 154 | PORT_DIPSETTING( 0x02, "1 Coin/2 Players" ) |
| r2844 | r2845 | |
| 165 | 165 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) |
| 166 | 166 | |
| 167 | 167 | /* These input ports are fake */ |
| 168 | PORT_START | |
| 168 | PORT_START_TAG("FAKE0") /* IN3 */ | |
| 169 | 169 | PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) |
| 170 | 170 | PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) |
| 171 | 171 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 172 | 172 | |
| 173 | PORT_START | |
| 173 | PORT_START_TAG("FAKE1") /* IN4 */ | |
| 174 | 174 | PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) |
| 175 | 175 | PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) |
| 176 | 176 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 177 | 177 | |
| 178 | PORT_START | |
| 178 | PORT_START_TAG("FAKE2") /* IN5 */ | |
| 179 | 179 | PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(3) |
| 180 | 180 | PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(3) |
| 181 | 181 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) |
| 182 | 182 | |
| 183 | PORT_START | |
| 183 | PORT_START_TAG("FAKE3") /* IN6 */ | |
| 184 | 184 | PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(4) |
| 185 | 185 | PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(4) |
| 186 | 186 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) |
| r2844 | r2845 | |
|---|---|---|
| 257 | 257 | ADDRESS_MAP_END |
| 258 | 258 | |
| 259 | 259 | static INPUT_PORTS_START( bking ) |
| 260 | PORT_START | |
| 260 | PORT_START_TAG("IN0") /* IN0 */ | |
| 261 | 261 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 262 | 262 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) |
| 263 | 263 | PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| r2844 | r2845 | |
| 265 | 265 | /* continue inputs are labelled in schematics. */ |
| 266 | 266 | /* They are not connected though to any button */ |
| 267 | 267 | |
| 268 | PORT_START | |
| 268 | PORT_START_TAG("IN1") /* IN1 */ | |
| 269 | 269 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 270 | 270 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) |
| 271 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* Continue 1 */ | |
| 272 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) /* Continue 2 */ | |
| 271 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* Continue 1 */ | |
| 272 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) /* Continue 2 */ | |
| 273 | 273 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 274 | 274 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT ) |
| 275 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 275 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) /* Not Connected */ | |
| 276 | 276 | |
| 277 | PORT_START_TAG("DSWA") | |
| 277 | PORT_START_TAG("DSWA") | |
| 278 | 278 | PORT_DIPNAME( 0x01, 0x00, "Holes Awarded" ) PORT_DIPLOCATION("SWA:1") |
| 279 | 279 | PORT_DIPSETTING( 0x00, "Par Play: 0 Holes/Birdie: 1 Hole/Eagle: 2 Holes/Double Eagle: 4 Holes" ) |
| 280 | 280 | PORT_DIPSETTING( 0x01, "Par Play: 1 Hole/Birdie: 2 Holes/Eagle: 3 Holes/Double Eagle: 4 Holes" ) |
| r2844 | r2845 | |
| 299 | 299 | PORT_DIPSETTING( 0x00, DEF_STR(Upright) ) |
| 300 | 300 | PORT_DIPSETTING( 0x80, DEF_STR(Cocktail) ) |
| 301 | 301 | |
| 302 | PORT_START_TAG("DSWB") | |
| 302 | PORT_START_TAG("DSWB") | |
| 303 | 303 | PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SWB:1,2,3,4") |
| 304 | 304 | PORT_DIPSETTING( 0x0f, DEF_STR( 9C_1C ) ) |
| 305 | 305 | PORT_DIPSETTING( 0x0e, DEF_STR( 8C_1C ) ) |
| r2844 | r2845 | |
| 335 | 335 | PORT_DIPSETTING( 0x60, DEF_STR( 1C_7C ) ) |
| 336 | 336 | PORT_DIPSETTING( 0x70, DEF_STR( 1C_8C ) ) |
| 337 | 337 | |
| 338 | PORT_START_TAG("DSWC") | |
| 338 | PORT_START_TAG("DSWC") | |
| 339 | 339 | PORT_DIPNAME( 0x01, 0x01, "Appearance of Crow" ) PORT_DIPLOCATION("SWC:1") |
| 340 | 340 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 341 | 341 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 358 | 358 | PORT_DIPSETTING( 0x00, "1 Way" ) |
| 359 | 359 | PORT_DIPSETTING( 0x80, "2 Way" ) |
| 360 | 360 | |
| 361 | PORT_START | |
| 361 | PORT_START_TAG("TRACK0_X") /* IN5 */ | |
| 362 | 362 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) /* Sensitivity, clip, min, max */ |
| 363 | 363 | |
| 364 | PORT_START | |
| 364 | PORT_START_TAG("TRACK0_Y") /* IN6 */ | |
| 365 | 365 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_REVERSE /* Sensitivity, clip, min, max */ |
| 366 | 366 | |
| 367 | PORT_START | |
| 367 | PORT_START_TAG("TRACK1_X") /* IN7 */ | |
| 368 | 368 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_COCKTAIL /* Sensitivity, clip, min, max */ |
| 369 | 369 | |
| 370 | PORT_START | |
| 370 | PORT_START_TAG("TRACK1_Y") /* IN8 */ | |
| 371 | 371 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_REVERSE PORT_COCKTAIL /* Sensitivity, clip, min, max */ |
| 372 | 372 | INPUT_PORTS_END |
| 373 | 373 |
| r2844 | r2845 | |
|---|---|---|
| 138 | 138 | |
| 139 | 139 | static VIDEO_START(dblewing) |
| 140 | 140 | { |
| 141 | deco16_1_video_init(); | |
| 141 | deco16_1_video_init(machine); | |
| 142 | 142 | |
| 143 | 143 | deco16_set_tilemap_bank_callback(0,dblewing_bank_callback); |
| 144 | 144 | deco16_set_tilemap_bank_callback(1,dblewing_bank_callback); |
| r2844 | r2845 | |
|---|---|---|
| 133 | 133 | /* alternate CPU's RAM space while the CPU is running. If the CPU is not */ |
| 134 | 134 | /* running (i.e., the /SRES line is low), it needs to look like RAM to pass */ |
| 135 | 135 | /* the self-tests */ |
| 136 | char | |
| 136 | static const char *comnames[ | |
| 137 | 137 | |
| 138 | 138 | /* if the CPU reset line is being held down, just return RAM */ |
| 139 | 139 | if (custom_cpu_reset) |
| r2844 | r2845 | |
| 149 | 149 | case 3: |
| 150 | 150 | case 4: |
| 151 | 151 | case 5: |
| 152 | sprintf(port, "COM%d", offset); | |
| 153 | return input_port_read(machine, port); | |
| 152 | return input_port_read(machine, comnames[offset]); | |
| 154 | 153 | |
| 155 | 154 | /* busy flag; this is polled to check the custom CPU's readiness */ |
| 156 | 155 | /* we just toggle it on and off until the main CPU gets the result */ |
| r2844 | r2845 | |
|---|---|---|
| 760 | 760 | /*****************************************************************************/ |
| 761 | 761 | |
| 762 | 762 | static ADDRESS_MAP_START( hornet_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 763 | AM_RANGE(0x00000000, 0x003fffff) AM_MIRROR(0x80000000) AM_RAM AM_BASE(&workram) /* Work RAM */ | |
| 764 | AM_RANGE(0x74000000, 0x740000ff) AM_MIRROR(0x80000000) AM_READWRITE(K037122_reg_r, K037122_reg_w) | |
| 765 | AM_RANGE(0x74020000, 0x7403ffff) AM_MIRROR(0x80000000) AM_READWRITE(K037122_sram_r, K037122_sram_w) | |
| 766 | AM_RANGE(0x74040000, 0x7407ffff) AM_MIRROR(0x80000000) AM_READWRITE(K037122_char_r, K037122_char_w) | |
| 767 | AM_RANGE(0x78000000, 0x7800ffff) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc) | |
| 768 | AM_RANGE(0x780c0000, 0x780c0003) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc) | |
| 769 | AM_RANGE(0x7d000000, 0x7d00ffff) AM_MIRROR(0x80000000) AM_READ8(sysreg_r, 0xffffffff) | |
| 770 | AM_RANGE(0x7d010000, 0x7d01ffff) AM_MIRROR(0x80000000) AM_WRITE8(sysreg_w, 0xffffffff) | |
| 771 | AM_RANGE(0x7d020000, 0x7d021fff) AM_MIRROR(0x80000000) AM_READWRITE(timekeeper_0_32be_r, timekeeper_0_32be_w) /* M48T58Y RTC/NVRAM */ | |
| 772 | AM_RANGE(0x7d030000, 0x7d030007) AM_MIRROR(0x80000000) AM_READWRITE(K056800_host_r, K056800_host_w) | |
| 773 | AM_RANGE(0x7d042000, 0x7d043fff) AM_MIRROR(0x80000000) AM_RAM /* COMM BOARD 0 */ | |
| 774 | AM_RANGE(0x7d044000, 0x7d044007) AM_MIRROR(0x80000000) AM_READ(comm0_unk_r) | |
| 775 | AM_RANGE(0x7d048000, 0x7d048003) AM_MIRROR(0x80000000) AM_WRITE(comm1_w) | |
| 776 | AM_RANGE(0x7d04a000, 0x7d04a003) AM_MIRROR(0x80000000) AM_WRITE(comm_rombank_w) | |
| 777 | AM_RANGE(0x7d050000, 0x7d05ffff) AM_MIRROR(0x80000000) AM_ROMBANK(1) /* COMM BOARD 1 */ | |
| 778 | AM_RANGE(0x7e000000, 0x7e7fffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER2, 0) /* Data ROM */ | |
| 779 | AM_RANGE(0x7f000000, 0x7f3fffff) AM_MIRROR(0x80000000) AM_ROM AM_SHARE(2) | |
| 780 | AM_RANGE(0x7fc00000, 0x7fffffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2) /* Program ROM */ | |
| 763 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE(&workram) /* Work RAM */ | |
| 764 | AM_RANGE(0x74000000, 0x740000ff) AM_READWRITE(K037122_reg_r, K037122_reg_w) | |
| 765 | AM_RANGE(0x74020000, 0x7403ffff) AM_READWRITE(K037122_sram_r, K037122_sram_w) | |
| 766 | AM_RANGE(0x74040000, 0x7407ffff) AM_READWRITE(K037122_char_r, K037122_char_w) | |
| 767 | AM_RANGE(0x78000000, 0x7800ffff) AM_READWRITE(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc) | |
| 768 | AM_RANGE(0x780c0000, 0x780c0003) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc) | |
| 769 | AM_RANGE(0x7d000000, 0x7d00ffff) AM_READ8(sysreg_r, 0xffffffff) | |
| 770 | AM_RANGE(0x7d010000, 0x7d01ffff) AM_WRITE8(sysreg_w, 0xffffffff) | |
| 771 | AM_RANGE(0x7d020000, 0x7d021fff) AM_READWRITE(timekeeper_0_32be_r, timekeeper_0_32be_w) /* M48T58Y RTC/NVRAM */ | |
| 772 | AM_RANGE(0x7d030000, 0x7d030007) AM_READWRITE(K056800_host_r, K056800_host_w) | |
| 773 | AM_RANGE(0x7d042000, 0x7d043fff) AM_RAM /* COMM BOARD 0 */ | |
| 774 | AM_RANGE(0x7d044000, 0x7d044007) AM_READ(comm0_unk_r) | |
| 775 | AM_RANGE(0x7d048000, 0x7d048003) AM_WRITE(comm1_w) | |
| 776 | AM_RANGE(0x7d04a000, 0x7d04a003) AM_WRITE(comm_rombank_w) | |
| 777 | AM_RANGE(0x7d050000, 0x7d05ffff) AM_ROMBANK(1) /* COMM BOARD 1 */ | |
| 778 | AM_RANGE(0x7e000000, 0x7e7fffff) AM_ROM AM_REGION(REGION_USER2, 0) /* Data ROM */ | |
| 779 | AM_RANGE(0x7f000000, 0x7f3fffff) AM_ROM AM_SHARE(2) | |
| 780 | AM_RANGE(0x7fc00000, 0x7fffffff) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2) /* Program ROM */ | |
| 781 | 781 | ADDRESS_MAP_END |
| 782 | 782 | |
| 783 | 783 | /*****************************************************************************/ |
| r2844 | r2845 | |
| 967 | 967 | |
| 968 | 968 | /* configure fast RAM regions for DRC */ |
| 969 | 969 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_SELECT, 0); |
| 970 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_START, 0x80000000); | |
| 971 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_END, 0x803fffff); | |
| 970 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_START, 0x00000000); | |
| 971 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_END, 0x003fffff); | |
| 972 | 972 | cpunum_set_info_ptr(0, CPUINFO_PTR_PPC_FASTRAM_BASE, workram); |
| 973 | 973 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_READONLY, 0); |
| 974 | 974 | } |
| r2844 | r2845 | |
| 1076 | 1076 | |
| 1077 | 1077 | static void jamma_jvs_cmd_exec(void); |
| 1078 | 1078 | |
| 1079 | static UINT8 jvs_rdata[1024]; | |
| 1080 | 1079 | static UINT8 jvs_sdata[1024]; |
| 1081 | 1080 | |
| 1082 | static int jvs_rdata_ptr = 0; | |
| 1083 | 1081 | static int jvs_sdata_ptr = 0; |
| 1084 | static int jvs_rdata_count = 0; | |
| 1085 | 1082 | |
| 1086 | static int jamma_jvs_r(UINT8 *data) | |
| 1087 | { | |
| 1088 | if (jvs_rdata_ptr < jvs_rdata_count) | |
| 1089 | { | |
| 1090 | *data = jvs_rdata[jvs_rdata_ptr++]; | |
| 1091 | return TRUE; | |
| 1092 | } | |
| 1093 | return FALSE; | |
| 1094 | } | |
| 1095 | ||
| 1096 | 1083 | static void jamma_jvs_w(UINT8 data) |
| 1097 | 1084 | { |
| 1098 | 1085 | if (jvs_sdata_ptr == 0 && data != 0xe0) |
| r2844 | r2845 | |
| 1104 | 1091 | jamma_jvs_cmd_exec(); |
| 1105 | 1092 | } |
| 1106 | 1093 | |
| 1107 | static int jvs_encode_data(UINT8 *in, | |
| 1094 | static int jvs_encode_data(UINT8 *in, | |
| 1108 | 1095 | { |
| 1109 | int outptr = 0; | |
| 1110 | 1096 | int inptr = 0; |
| 1097 | int sum = 0; | |
| 1111 | 1098 | |
| 1112 | 1099 | while (inptr < length) |
| 1113 | 1100 | { |
| 1114 | 1101 | UINT8 b = in[inptr++]; |
| 1115 | 1102 | if (b == 0xe0) |
| 1116 | 1103 | { |
| 1117 | out[outptr++] = 0xd0; | |
| 1118 | out[outptr++] = 0xdf; | |
| 1104 | sum += 0xd0 + 0xdf; | |
| 1105 | ppc4xx_spu_receive_byte(0, 0xd0); | |
| 1106 | ppc4xx_spu_receive_byte(0, 0xdf); | |
| 1119 | 1107 | } |
| 1120 | 1108 | else if (b == 0xd0) |
| 1121 | 1109 | { |
| 1122 | out[outptr++] = 0xd0; | |
| 1123 | out[outptr++] = 0xcf; | |
| 1110 | sum += 0xd0 + 0xcf; | |
| 1111 | ppc4xx_spu_receive_byte(0, 0xd0); | |
| 1112 | ppc4xx_spu_receive_byte(0, 0xcf); | |
| 1124 | 1113 | } |
| 1125 | 1114 | else |
| 1126 | 1115 | { |
| 1127 | out[outptr++] = b; | |
| 1116 | sum += b; | |
| 1117 | ppc4xx_spu_receive_byte(0, b); | |
| 1128 | 1118 | } |
| 1129 | }; | |
| 1130 | ||
| 1131 | return outptr; | |
| 1119 | } | |
| 1120 | return sum; | |
| 1132 | 1121 | } |
| 1133 | 1122 | |
| 1134 | 1123 | static int jvs_decode_data(UINT8 *in, UINT8 *out, int length) |
| r2844 | r2845 | |
| 1157 | 1146 | { |
| 1158 | 1147 | UINT8 sync, node, byte_num; |
| 1159 | 1148 | UINT8 data[1024], rdata[1024]; |
| 1160 | int | |
| 1149 | int | |
| 1161 | 1150 | int rdata_ptr; |
| 1162 | 1151 | int sum; |
| 1163 | 1152 | |
| r2844 | r2845 | |
| 1213 | 1202 | } |
| 1214 | 1203 | |
| 1215 | 1204 | // write jvs return data |
| 1216 | jvs_rdata[0] = 0xe0; // sync | |
| 1217 | jvs_rdata[1] = 0x00; // node | |
| 1218 | jvs_rdata[2] = rdata_ptr+1; // num of bytes | |
| 1205 | sum = 0x00 + (rdata_ptr+1); | |
| 1206 | ppc4xx_spu_receive_byte(0, 0xe0); // sync | |
| 1207 | ppc4xx_spu_receive_byte(0, 0x00); // node | |
| 1208 | ppc4xx_spu_receive_byte(0, rdata_ptr+1); // num of bytes | |
| 1209 | sum += jvs_encode_data(rdata, rdata_ptr); | |
| 1210 | ppc4xx_spu_receive_byte(0, sum - 1); // checksum | |
| 1219 | 1211 | |
| 1220 | length = jvs_encode_data(rdata, &jvs_rdata[3], rdata_ptr); | |
| 1221 | ||
| 1222 | // calculate sum | |
| 1223 | sum = 0; | |
| 1224 | for (i=0; i < length+2; i++) | |
| 1225 | { | |
| 1226 | sum += jvs_rdata[1+i]; | |
| 1227 | } | |
| 1228 | ||
| 1229 | // write sum | |
| 1230 | jvs_rdata[3+length] = (UINT8)(sum-1); | |
| 1231 | ||
| 1232 | jvs_rdata_count = length + 4; | |
| 1233 | jvs_rdata_ptr = 0; | |
| 1234 | 1212 | jvs_sdata_ptr = 0; |
| 1235 | 1213 | } |
| 1236 | 1214 | |
| r2844 | r2845 | |
| 1258 | 1236 | |
| 1259 | 1237 | timekeeper_init(0, TIMEKEEPER_M48T58, backup_ram); |
| 1260 | 1238 | |
| 1261 | cpunum_set_info_fct(0, CPUINFO_PTR_SPU_TX_HANDLER, (genf *)jamma_jvs_w); | |
| 1262 | cpunum_set_info_fct(0, CPUINFO_PTR_SPU_RX_HANDLER, (genf *)jamma_jvs_r); | |
| 1239 | ppc4xx_spu_set_tx_handler(0, jamma_jvs_w); | |
| 1263 | 1240 | } |
| 1264 | 1241 | |
| 1265 | 1242 | static void init_hornet_2board(running_machine *machine) |
| r2844 | r2845 | |
| 1276 | 1253 | |
| 1277 | 1254 | timekeeper_init(0, TIMEKEEPER_M48T58, backup_ram); |
| 1278 | 1255 | |
| 1279 | cpunum_set_info_fct(0, CPUINFO_PTR_SPU_TX_HANDLER, (genf *)jamma_jvs_w); | |
| 1280 | cpunum_set_info_fct(0, CPUINFO_PTR_SPU_RX_HANDLER, (genf *)jamma_jvs_r); | |
| 1256 | ppc4xx_spu_set_tx_handler(0, jamma_jvs_w); | |
| 1281 | 1257 | } |
| 1282 | 1258 | |
| 1283 | 1259 | static DRIVER_INIT(gradius4) |
| r2844 | r2845 | |
|---|---|---|
| 290 | 290 | |
| 291 | 291 | static READ8_HANDLER( leta_r ) |
| 292 | 292 | { |
| 293 | return input_port_read_indexed(machine, 2 + offset); | |
| 293 | static const char *letanames[] = { "LETA0", "LETA1", "LETA2", "LETA3" }; | |
| 294 | ||
| 295 | return input_port_read(machine, letanames[offset]); | |
| 294 | 296 | } |
| 295 | 297 | |
| 296 | 298 | |
| r2844 | r2845 | |
| 346 | 348 | AM_RANGE(0x8e00, 0x8fff) AM_BASE(&spriteram) |
| 347 | 349 | AM_RANGE(0x9000, 0x90ff) AM_MIRROR(0x0300) AM_RAM AM_BASE(&nvram_stage) AM_SIZE(&generic_nvram_size) |
| 348 | 350 | AM_RANGE(0x9400, 0x9403) AM_MIRROR(0x01fc) AM_READ(leta_r) |
| 349 | AM_RANGE(0x9600, 0x97ff) AM_READ | |
| 351 | AM_RANGE(0x9600, 0x97ff) AM_READ | |
| 350 | 352 | AM_RANGE(0x9800, 0x980f) AM_MIRROR(0x01f0) AM_READWRITE(pokey1_r, pokey1_w) |
| 351 | 353 | AM_RANGE(0x9a00, 0x9a0f) AM_MIRROR(0x01f0) AM_READWRITE(pokey2_r, pokey2_w) |
| 352 | 354 | AM_RANGE(0x9c00, 0x9c7f) AM_WRITE(nvram_recall_w) |
| r2844 | r2845 | |
| 373 | 375 | *************************************/ |
| 374 | 376 | |
| 375 | 377 | static INPUT_PORTS_START( ccastles ) |
| 376 | PORT_START /* IN0 */ | |
| 378 | PORT_START_TAG("IN0") /* IN0 */ | |
| 377 | 379 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 378 | 380 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 379 | 381 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r2844 | r2845 | |
| 383 | 385 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* 1p Jump, non-cocktail start1 */ |
| 384 | 386 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* 2p Jump, non-cocktail start2 */ |
| 385 | 387 | |
| 386 | PORT_START /* IN1 */ | |
| 388 | PORT_START_TAG("IN1") /* IN1 */ | |
| 387 | 389 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 388 | 390 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 389 | 391 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
|---|---|---|
| 17 | 17 | static TIMER_CALLBACK( dragrace_frame_callback ) |
| 18 | 18 | { |
| 19 | 19 | int i; |
| 20 | static const char *portnames[] = { "P1", "P2" }; | |
| 20 | 21 | |
| 21 | 22 | for (i = 0; i < 2; i++) |
| 22 | 23 | { |
| 23 | switch (input_port_read | |
| 24 | switch (input_port_read | |
| 24 | 25 | { |
| 25 | 26 | case 0x01: dragrace_gear[i] = 1; break; |
| 26 | 27 | case 0x02: dragrace_gear[i] = 2; break; |
| r2844 | r2845 | |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | 34 | /* watchdog is disabled during service mode */ |
| 34 | watchdog_enable(machine, input_port_read | |
| 35 | watchdog_enable(machine, input_port_read | |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | 38 | |
| r2844 | r2845 | |
| 116 | 117 | |
| 117 | 118 | static READ8_HANDLER( dragrace_input_r ) |
| 118 | 119 | { |
| 119 | int val = input_port_read_indexed(machine, 2); | |
| 120 | int val = input_port_read(machine, "IN2"); | |
| 121 | static const char *portnames[] = { "IN0", "IN1" }; | |
| 120 | 122 | |
| 121 | 123 | UINT8 maskA = 1 << (offset % 8); |
| 122 | 124 | UINT8 maskB = 1 << (offset / 8); |
| r2844 | r2845 | |
| 125 | 127 | |
| 126 | 128 | for (i = 0; i < 2; i++) |
| 127 | 129 | { |
| 128 | int in = input_port_read | |
| 130 | int in = input_port_read | |
| 129 | 131 | |
| 130 | 132 | if (dragrace_gear[i] != 0) |
| 131 | 133 | { |
| r2844 | r2845 | |
| 146 | 148 | { |
| 147 | 149 | int bitA[2]; |
| 148 | 150 | int bitB[2]; |
| 151 | static const char *dialnames[] = { "DIAL1", "DIAL2" }; | |
| 149 | 152 | |
| 150 | 153 | int i; |
| 151 | 154 | |
| 152 | 155 | for (i = 0; i < 2; i++) |
| 153 | 156 | { |
| 154 | int dial = input_port_read | |
| 157 | int dial = input_port_read | |
| 155 | 158 | |
| 156 | 159 | bitA[i] = ((dial + 1) / 2) & 1; |
| 157 | 160 | bitB[i] = ((dial + 0) / 2) & 1; |
| r2844 | r2845 | |
| 191 | 194 | |
| 192 | 195 | |
| 193 | 196 | static INPUT_PORTS_START( dragrace ) |
| 194 | PORT_START | |
| 197 | PORT_START_TAG("IN0") /* IN0 */ | |
| 195 | 198 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 1 Gas") PORT_PLAYER(1) |
| 196 | 199 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 1 gear 1 */ |
| 197 | 200 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 1 gear 2 */ |
| r2844 | r2845 | |
| 204 | 207 | PORT_DIPSETTING( 0x40, "4.9 seconds" ) |
| 205 | 208 | PORT_DIPSETTING( 0xc0, "Never" ) |
| 206 | 209 | |
| 207 | PORT_START | |
| 210 | PORT_START_TAG("IN1") /* IN1 */ | |
| 208 | 211 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 2 Gas") PORT_PLAYER(2) |
| 209 | 212 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 2 gear 1 */ |
| 210 | 213 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 2 gear 2 */ |
| r2844 | r2845 | |
| 216 | 219 | PORT_DIPSETTING( 0x80, "4" ) |
| 217 | 220 | PORT_DIPSETTING( 0x00, "5" ) |
| 218 | 221 | |
| 219 | PORT_START | |
| 222 | PORT_START_TAG("IN2") /* IN2 */ | |
| 220 | 223 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* IN0 connects here */ |
| 221 | 224 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* IN1 connects here */ |
| 222 | 225 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| r2844 | r2845 | |
| 229 | 232 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_2C ) ) |
| 230 | 233 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 231 | 234 | |
| 232 | PORT_START | |
| 235 | PORT_START_TAG("DIAL1") /* IN3 */ | |
| 233 | 236 | PORT_BIT( 0xff, 0x00, IPT_DIAL_V ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1) |
| 234 | 237 | |
| 235 | PORT_START | |
| 238 | PORT_START_TAG("DIAL2") /* IN4 */ | |
| 236 | 239 | PORT_BIT( 0xff, 0x00, IPT_DIAL_V ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2) |
| 237 | 240 | |
| 238 | PORT_START | |
| 241 | PORT_START_TAG("P1") /* IN5 */ | |
| 239 | 242 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Player 1 Gear 1") PORT_PLAYER(1) |
| 240 | 243 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Player 1 Gear 2") PORT_PLAYER(1) |
| 241 | 244 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Player 1 Gear 3") PORT_PLAYER(1) |
| 242 | 245 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Player 1 Gear 4") PORT_PLAYER(1) |
| 243 | 246 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Player 1 Neutral") PORT_PLAYER(1) |
| 244 | 247 | |
| 245 | PORT_START | |
| 248 | PORT_START_TAG("P2") /* IN6 */ | |
| 246 | 249 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Player 2 Gear 1") PORT_PLAYER(2) |
| 247 | 250 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Player 2 Gear 2") PORT_PLAYER(2) |
| 248 | 251 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Player 2 Gear 3") PORT_PLAYER(2) |
| r2844 | r2845 | |
|---|---|---|
| 674 | 674 | #include "machine/intelfsh.h" |
| 675 | 675 | #include "sound/okim6295.h" |
| 676 | 676 | #include "sound/ymf271.h" |
| 677 | #include "includes/seibuspi.h" | |
| 677 | 678 | |
| 678 | void seibuspi_text_decrypt(UINT8 *rom); | |
| 679 | void seibuspi_bg_decrypt(UINT8 *rom, int size); | |
| 680 | void seibuspi_sprite_decrypt(UINT8 *src, int romsize); | |
| 681 | ||
| 682 | void seibuspi_rise10_text_decrypt(UINT8 *rom); | |
| 683 | void seibuspi_rise10_bg_decrypt(UINT8 *rom, int size); | |
| 684 | void seibuspi_rise10_sprite_decrypt(UINT8 *rom, int romsize); | |
| 685 | ||
| 686 | void seibuspi_rise11_text_decrypt(UINT8 *rom); | |
| 687 | void seibuspi_rise11_bg_decrypt(UINT8 *rom, int size); | |
| 688 | void seibuspi_rise11_sprite_decrypt(UINT8 *rom, int romsize); | |
| 689 | ||
| 690 | VIDEO_START( spi ); | |
| 691 | VIDEO_UPDATE( spi ); | |
| 692 | WRITE32_HANDLER( spi_textlayer_w ); | |
| 693 | WRITE32_HANDLER( spi_back_layer_w ); | |
| 694 | WRITE32_HANDLER( spi_mid_layer_w ); | |
| 695 | WRITE32_HANDLER( spi_fore_layer_w ); | |
| 696 | WRITE32_HANDLER( spi_paletteram32_xBBBBBGGGGGRRRRR_w ); | |
| 697 | READ32_HANDLER( spi_layer_bank_r ); | |
| 698 | WRITE32_HANDLER( spi_layer_bank_w ); | |
| 699 | void rf2_set_layer_banks(int banks); | |
| 700 | READ32_HANDLER( spi_layer_enable_r ); | |
| 701 | WRITE32_HANDLER( spi_layer_enable_w ); | |
| 702 | ||
| 703 | WRITE32_HANDLER( tilemap_dma_start_w ); | |
| 704 | WRITE32_HANDLER( palette_dma_start_w ); | |
| 705 | WRITE32_HANDLER( video_dma_length_w ); | |
| 706 | WRITE32_HANDLER( video_dma_address_w ); | |
| 707 | WRITE32_HANDLER( sprite_dma_start_w ); | |
| 708 | ||
| 709 | extern UINT32 *spi_scrollram; | |
| 710 | 679 | UINT32 *spimainram; |
| 711 | 680 | |
| 712 | 681 | static UINT8 *z80_rom; |
| r2844 | r2845 | |
|---|---|---|
| 267 | 267 | break; |
| 268 | 268 | |
| 269 | 269 | case 0x500: |
| 270 | iop_answer = input_port_read | |
| 270 | iop_answer = input_port_read | |
| 271 | 271 | break; |
| 272 | 272 | } |
| 273 | 273 |
| r2844 | r2845 | |
|---|---|---|
| 153 | 153 | #include "machine/namcoio.h" |
| 154 | 154 | #include "sound/namco.h" |
| 155 | 155 | #include "sound/samples.h" |
| 156 | #include "includes/gaplus.h" | |
| 156 | 157 | |
| 157 | 158 | |
| 158 | /* custom IO chips functions */ | |
| 159 | extern UINT8 *gaplus_customio_3; | |
| 160 | WRITE8_HANDLER( gaplus_customio_3_w ); | |
| 161 | READ8_HANDLER( gaplus_customio_3_r ); | |
| 162 | ||
| 163 | /* video */ | |
| 164 | extern UINT8 *gaplus_videoram; | |
| 165 | extern UINT8 *gaplus_spriteram; | |
| 166 | READ8_HANDLER( gaplus_videoram_r ); | |
| 167 | WRITE8_HANDLER( gaplus_videoram_w ); | |
| 168 | WRITE8_HANDLER( gaplus_starfield_control_w ); | |
| 169 | VIDEO_START( gaplus ); | |
| 170 | PALETTE_INIT( gaplus ); | |
| 171 | VIDEO_UPDATE( gaplus ); | |
| 172 | VIDEO_EOF( gaplus ); /* update starfields */ | |
| 173 | ||
| 174 | ||
| 175 | ||
| 176 | 159 | /*************************************************************************** |
| 177 | 160 | |
| 178 | 161 | Custom I/O initialization |
| r2844 | r2845 | |
|---|---|---|
| 39 | 39 | AM_RANGE(0xa004, 0xa004) AM_READ(carpolo_car_border_collision_cause_r) |
| 40 | 40 | AM_RANGE(0xa005, 0xa005) AM_READ(carpolo_car_ball_collision_cause_r) |
| 41 | 41 | AM_RANGE(0xa006, 0xa006) AM_READ(carpolo_car_goal_collision_cause_r) |
| 42 | AM_RANGE(0xa007, 0xa007) AM_READ | |
| 42 | AM_RANGE(0xa007, 0xa007) AM_READ | |
| 43 | 43 | AM_RANGE(0xc000, 0xc000) AM_READ(carpolo_interrupt_cause_r) |
| 44 | 44 | AM_RANGE(0xf000, 0xffff) AM_READ(SMH_ROM) |
| 45 | 45 | ADDRESS_MAP_END |
| r2844 | r2845 | |
| 68 | 68 | *************************************/ |
| 69 | 69 | |
| 70 | 70 | static INPUT_PORTS_START( carpolo ) |
| 71 | PORT_START /* IN0 */ | |
| 71 | PORT_START_TAG("IN0") /* IN0 */ | |
| 72 | 72 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 73 | 73 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) |
| 74 | 74 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_COIN3 ) |
| r2844 | r2845 | |
| 77 | 77 | |
| 78 | 78 | /* the value read from here is used directly, |
| 79 | 79 | the result is calculated by 60/value */ |
| 80 | PORT_START /* IN1 */ | |
| 80 | PORT_START_TAG("IN1") /* IN1 */ | |
| 81 | 81 | PORT_BIT (0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) /* the lowest 2 bits of the counter */ |
| 82 | 82 | PORT_DIPNAME( 0xfc, 0x3c, "Game Sec/Real Sec" ) |
| 83 | 83 | PORT_DIPSETTING( 0x00, "0.23 (Longest)" ) |
| r2844 | r2845 | |
| 144 | 144 | PORT_DIPSETTING( 0x08, "7.50" ) |
| 145 | 145 | PORT_DIPSETTING( 0x04, "15.00 (Shortest)" ) |
| 146 | 146 | |
| 147 | PORT_START /* IN2 */ | |
| 147 | PORT_START_TAG("DIAL0") /* IN2 */ | |
| 148 | 148 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1) |
| 149 | 149 | |
| 150 | PORT_START /* IN3 */ | |
| 150 | PORT_START_TAG("DIAL1") /* IN3 */ | |
| 151 | 151 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(2) |
| 152 | 152 | |
| 153 | PORT_START /* IN4 */ | |
| 153 | PORT_START_TAG("DIAL2") /* IN4 */ | |
| 154 | 154 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(3) |
| 155 | 155 | |
| 156 | PORT_START /* IN5 */ | |
| 156 | PORT_START_TAG("DIAL3") /* IN5 */ | |
| 157 | 157 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(4) |
| 158 | 158 | |
| 159 | PORT_START /* IN6 - accelerator pedals */ | |
| 159 | PORT_START_TAG("PEDALS") /* IN6 - accelerator pedals */ | |
| 160 | 160 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 161 | 161 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 162 | 162 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 166 | 166 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(4) |
| 167 | 167 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(4) |
| 168 | 168 | |
| 169 | PORT_START /* IN7 - forward/reverse */ | |
| 169 | PORT_START_TAG("IN2") /* IN7 - forward/reverse */ | |
| 170 | 170 | PORT_BIT (0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 171 | 171 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) |
| 172 | 172 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) |
| r2844 | r2845 | |
|---|---|---|
| 647 | 647 | static READ8_HANDLER( mux_input_r ) |
| 648 | 648 | { |
| 649 | 649 | int result = 0xFF,t1,t2; |
| 650 | static const char *port[] = { "STROBE0", "STROBE1", "STROBE2", "STROBE3", "STROBE4", "STROBE5", "STROBE6", "STROBE7", "STROBE8", "STROBE9", "STROBE10", "STROBE11" }; | |
| 650 | 651 | |
| 651 | 652 | if (offset < 8) |
| 652 | 653 | { |
| r2844 | r2845 | |
| 654 | 655 | t1 = input_override[offset]; // strobe 0-7 data 0-4 |
| 655 | 656 | t2 = input_override[offset+idx]; // strobe 8-B data 0-4 |
| 656 | 657 | |
| 657 | t1 = (sc2_Inputs[offset] & t1) | ( ( input_port_read | |
| 658 | t1 = (sc2_Inputs[offset] & t1) | ( ( input_port_read | |
| 658 | 659 | if (idx == 8) |
| 659 | t2 = (sc2_Inputs[offset+8] & t2) | ( ( input_port_read | |
| 660 | t2 = (sc2_Inputs[offset+8] & t2) | ( ( input_port_read | |
| 660 | 661 | else |
| 661 | t2 = (sc2_Inputs[offset+4] & t2) | ( ( ( input_port_read | |
| 662 | t2 = (sc2_Inputs[offset+4] & t2) | ( ( ( input_port_read | |
| 662 | 663 | |
| 663 | 664 | sc2_Inputs[offset] = (sc2_Inputs[offset] & ~0x1F) | t1; |
| 664 | 665 | sc2_Inputs[offset+idx] = (sc2_Inputs[offset+idx] & ~0x60) | t2; |
| r2844 | r2845 | |
| 893 | 894 | |
| 894 | 895 | static READ8_HANDLER( coin_input_r ) |
| 895 | 896 | { |
| 896 | return input_port_read | |
| 897 | return input_port_read | |
| 897 | 898 | } |
| 898 | 899 | |
| 899 | 900 | /////////////////////////////////////////////////////////////////////////// |
| r2844 | r2845 | |
|---|---|---|
| 956 | 956 | MDRV_MACHINE_RESET(skns) |
| 957 | 957 | MDRV_NVRAM_HANDLER(generic_1fill) |
| 958 | 958 | |
| 959 | MDRV_VIDEO_ATTRIBUTES(VIDEO_ | |
| 959 | MDRV_VIDEO_ATTRIBUTES(VIDEO_ALWAY | |
| 960 | 960 | |
| 961 | 961 | MDRV_SCREEN_ADD("main", RASTER) |
| 962 | MDRV_SCREEN_REFRESH_RATE( | |
| 962 | MDRV_SCREEN_REFRESH_RATE(59.5971) // measured by Guru | |
| 963 | 963 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 964 | 964 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 965 | MDRV_SCREEN_SIZE( | |
| 965 | MDRV_SCREEN_SIZE(320 | |
| 966 | 966 | MDRV_SCREEN_VISIBLE_AREA(0,319,0,239) |
| 967 | 967 | |
| 968 | 968 | MDRV_PALETTE_LENGTH(32768) |
| r2844 | r2845 | |
|---|---|---|
| 2098 | 2098 | |
| 2099 | 2099 | ROM_START( deerhunt ) /* Deer Hunting USA V4.3 (11/1/2000) - The "E05" breaks version label conventions but is correct & verified */ |
| 2100 | 2100 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* TMP68301 Code */ |
| 2101 | ROM_LOAD16_BYTE( "as0906e05.u06", 0x000000, 0x100000, CRC(20c81f17) SHA1(d41d93d6ee88738cec55f7bf3ce6be1dbec68e09) ) /* CRC16 694E printed on label */ | |
| 2102 | ROM_LOAD16_BYTE( "as0907e05.u07", 0x000001, 0x100000, CRC(1731aa2a) SHA1(cffae7a99a7f960a62ef0c4454884df17a93c1a6) ) /* CRC16 5D89 printed on label */ | |
| 2101 | ROM_LOAD16_BYTE( "as0906e05.u06", 0x000000, 0x100000, CRC(20c81f17) SHA1(d41d93d6ee88738cec55f7bf3ce6be1dbec68e09) ) /* checksum 694E printed on label */ | |
| 2102 | ROM_LOAD16_BYTE( "as0907e05.u07", 0x000001, 0x100000, CRC(1731aa2a) SHA1(cffae7a99a7f960a62ef0c4454884df17a93c1a6) ) /* checksum 5D89 printed on label */ | |
| 2103 | 2103 | |
| 2104 | 2104 | ROM_REGION( 0x2000000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites */ |
| 2105 | 2105 | ROM_LOAD( "as0901m01.u38", 0x0000000, 0x800000, CRC(1d6acf8f) SHA1(6f61fe21bebb7c87e8e6c3ef3ba73b8cf327dde9) ) |
| r2844 | r2845 | |
| 2114 | 2114 | |
| 2115 | 2115 | ROM_START( deerhuna ) /* Deer Hunting USA V4.2 (xx/x/2000) */ |
| 2116 | 2116 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* TMP68301 Code */ |
| 2117 | ROM_LOAD16_BYTE( "as0906e04-v4_2.u06", 0x000000, 0x100000, CRC(bb3af36f) SHA1(f04071347e8ad361bf666fcb6c0136e522f19d47) ) /* CRC16 6640 printed on label */ | |
| 2118 | ROM_LOAD16_BYTE( "as0907e04-v4_2.u07", 0x000001, 0x100000, CRC(83f02117) SHA1(70fc2291bc93af3902aae88688be6a8078f7a07e) ) /* CRC16 595A printed on label */ | |
| 2117 | ROM_LOAD16_BYTE( "as0906e04-v4_2.u06", 0x000000, 0x100000, CRC(bb3af36f) SHA1(f04071347e8ad361bf666fcb6c0136e522f19d47) ) /* checksum 6640 printed on label */ | |
| 2118 | ROM_LOAD16_BYTE( "as0907e04-v4_2.u07", 0x000001, 0x100000, CRC(83f02117) SHA1(70fc2291bc93af3902aae88688be6a8078f7a07e) ) /* checksum 595A printed on label */ | |
| 2119 | 2119 | |
| 2120 | 2120 | ROM_REGION( 0x2000000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites */ |
| 2121 | 2121 | ROM_LOAD( "as0901m01.u38", 0x0000000, 0x800000, CRC(1d6acf8f) SHA1(6f61fe21bebb7c87e8e6c3ef3ba73b8cf327dde9) ) |
| r2844 | r2845 | |
| 2130 | 2130 | |
| 2131 | 2131 | ROM_START( deerhunb ) /* Deer Hunting USA V4.0 (6/15/2000) */ |
| 2132 | 2132 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* TMP68301 Code */ |
| 2133 | ROM_LOAD16_BYTE( "as0906e04.u06", 0x000000, 0x100000, CRC(07d9b64a) SHA1(f9aac644aab920bbac84b14836ee589ccd51f6db) ) /* CRC16 7BBB printed on label */ | |
| 2134 | ROM_LOAD16_BYTE( "as0907e04.u07", 0x000001, 0x100000, CRC(19973d08) SHA1(da1cc02ce480a62ccaf94d0af1246a340f054b43) ) /* CRC16 4C78 printed on label */ | |
| 2133 | ROM_LOAD16_BYTE( "as0906e04.u06", 0x000000, 0x100000, CRC(07d9b64a) SHA1(f9aac644aab920bbac84b14836ee589ccd51f6db) ) /* checksum 7BBB printed on label */ | |
| 2134 | ROM_LOAD16_BYTE( "as0907e04.u07", 0x000001, 0x100000, CRC(19973d08) SHA1(da1cc02ce480a62ccaf94d0af1246a340f054b43) ) /* checksum 4C78 printed on label */ | |
| 2135 | 2135 | |
| 2136 | 2136 | ROM_REGION( 0x2000000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites */ |
| 2137 | 2137 | ROM_LOAD( "as0901m01.u38", 0x0000000, 0x800000, CRC(1d6acf8f) SHA1(6f61fe21bebb7c87e8e6c3ef3ba73b8cf327dde9) ) |
| r2844 | r2845 | |
| 2164 | 2164 | |
| 2165 | 2165 | ROM_START( turkhunt ) /* V1.0 is currently the only known version */ |
| 2166 | 2166 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* TMP68301 Code */ |
| 2167 | ROM_LOAD16_BYTE( "asx906e01.u06", 0x000000, 0x100000, CRC(c96266e1) SHA1(0ca462b3b0f27198e36384eee6ea5c5d4e7e1293) ) /* CRC16 E510 printed on label */ | |
| 2168 | ROM_LOAD16_BYTE( "asx907e01.u07", 0x000001, 0x100000, CRC(7c67b502) SHA1(6a0e8883a115dac4095d86897e7eca2a007a1c71) ) /* CRC16 AB40 printed on label */ | |
| 2167 | ROM_LOAD16_BYTE( "asx906e01.u06", 0x000000, 0x100000, CRC(c96266e1) SHA1(0ca462b3b0f27198e36384eee6ea5c5d4e7e1293) ) /* checksum E510 printed on label */ | |
| 2168 | ROM_LOAD16_BYTE( "asx907e01.u07", 0x000001, 0x100000, CRC(7c67b502) SHA1(6a0e8883a115dac4095d86897e7eca2a007a1c71) ) /* checksum AB40 printed on label */ | |
| 2169 | 2169 | |
| 2170 | 2170 | ROM_REGION( 0x2000000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites */ |
| 2171 | 2171 | ROM_LOAD( "asx901m01.u38", 0x0000000, 0x800000, CRC(eabd3f44) SHA1(5a1ac986d11a8b019e18761cf4ea0a6f49fbdbfc) ) |
| r2844 | r2845 | |
| 2180 | 2180 | |
| 2181 | 2181 | ROM_START( wschamp ) /* V2.0 */ |
| 2182 | 2182 | ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* TMP68301 Code */ |
| 2183 | ROM_LOAD16_BYTE( "as1006e02.u06", 0x000000, 0x100000, CRC(0ad01677) SHA1(63e09b9f7cc8b781af1756f86caa0cc0962ae584) ) | |
| 2184 | ROM_LOAD16_BYTE( "as1007e02.u07", 0x000001, 0x100000, CRC(572624f0) SHA1(0c2f67daa22f4edd66a2be990dc6cd999faff0fa) ) | |
| 2183 | ROM_LOAD16_BYTE( "as1006e02.u06", 0x000000, 0x100000, CRC(0ad01677) SHA1(63e09b9f7cc8b781af1756f86caa0cc0962ae584) ) /* checksum 421E printed on label */ | |
| 2184 | ROM_LOAD16_BYTE( "as1007e02.u07", 0x000001, 0x100000, CRC(572624f0) SHA1(0c2f67daa22f4edd66a2be990dc6cd999faff0fa) ) /* checksum A48F printed on label */ | |
| 2185 | 2185 | |
| 2186 | 2186 | ROM_REGION( 0x2000000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites */ |
| 2187 | 2187 | ROM_LOAD( "as1001m01.u38", 0x0000000, 0x800000, CRC(92595579) SHA1(75a7131aedb18b7103677340c3cca7c91aaca2bf) ) |
| r2844 | r2845 | |
|---|---|---|
| 412 | 412 | psx_dma_install_write_handler |
| 413 | 413 | }; |
| 414 | 414 | |
| 415 | static void zn_machine_init( | |
| 415 | static void zn_machine_init( running_machine *machine ) | |
| 416 | 416 | { |
| 417 | 417 | m_n_dip_bit = 0; |
| 418 | 418 | m_b_lastclock = 1; |
| 419 | psx_machine_init(); | |
| 419 | psx_machine_init(machine); | |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | static MACHINE_DRIVER_START( zn1_1mb_vram ) |
| r2844 | r2845 | |
| 652 | 652 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */ |
| 653 | 653 | memory_set_bankptr( 2, memory_region( REGION_USER2 ) + 0x400000 ); /* banked game rom */ |
| 654 | 654 | memory_set_bankptr( 3, memory_region( REGION_USER3 ) ); /* country rom */ |
| 655 | zn_machine_init(); | |
| 655 | zn_machine_init(machine); | |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | static ADDRESS_MAP_START( qsound_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2844 | r2845 | |
| 875 | 875 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */ |
| 876 | 876 | memory_set_bankptr( 2, memory_region( REGION_USER2 ) + 0x400000 ); /* banked game rom */ |
| 877 | 877 | memory_set_bankptr( 3, memory_region( REGION_USER3 ) ); /* country rom */ |
| 878 | zn_machine_init(); | |
| 878 | zn_machine_init(machine); | |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | static MACHINE_DRIVER_START( coh3002c ) |
| r2844 | r2845 | |
| 1221 | 1221 | { |
| 1222 | 1222 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked game rom */ |
| 1223 | 1223 | memory_set_bankptr( 2, taitofx1_eeprom1 ); |
| 1224 | zn_machine_init(); | |
| 1224 | zn_machine_init(machine); | |
| 1225 | 1225 | |
| 1226 | 1226 | // patch to make psyforce boot |
| 1227 | 1227 | if ((!strcmp(machine->gamedrv->name, "psyforce")) || |
| r2844 | r2845 | |
| 1340 | 1340 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked game rom */ |
| 1341 | 1341 | memory_set_bankptr( 2, taitofx1_eeprom1 ); |
| 1342 | 1342 | memory_set_bankptr( 3, taitofx1_eeprom2 ); |
| 1343 | zn_machine_init(); | |
| 1343 | zn_machine_init(machine); | |
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | 1346 | static NVRAM_HANDLER( coh1000tb ) |
| r2844 | r2845 | |
| 1527 | 1527 | static MACHINE_RESET( coh3002t ) |
| 1528 | 1528 | { |
| 1529 | 1529 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* GNET boot rom */ |
| 1530 | zn_machine_init(); | |
| 1530 | zn_machine_init(machine); | |
| 1531 | 1531 | } |
| 1532 | 1532 | |
| 1533 | 1533 | static MACHINE_DRIVER_START( coh3002t ) |
| r2844 | r2845 | |
| 1705 | 1705 | static MACHINE_RESET( coh1000w ) |
| 1706 | 1706 | { |
| 1707 | 1707 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */ |
| 1708 | zn_machine_init(); | |
| 1708 | zn_machine_init(machine); | |
| 1709 | 1709 | |
| 1710 | 1710 | devtag_reset(machine, IDE_CONTROLLER, "ide"); |
| 1711 | 1711 | psx_dma_install_read_handler(5, atpsx_dma_read); |
| r2844 | r2845 | |
| 1895 | 1895 | static MACHINE_RESET( coh1002e ) |
| 1896 | 1896 | { |
| 1897 | 1897 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked game rom */ |
| 1898 | zn_machine_init(); | |
| 1898 | zn_machine_init(machine); | |
| 1899 | 1899 | } |
| 1900 | 1900 | |
| 1901 | 1901 | static READ16_HANDLER( psarc_ymf_r ) |
| r2844 | r2845 | |
| 2231 | 2231 | static MACHINE_RESET( coh1000a ) |
| 2232 | 2232 | { |
| 2233 | 2233 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */ |
| 2234 | zn_machine_init(); | |
| 2234 | zn_machine_init(machine); | |
| 2235 | 2235 | if( ( !strcmp( machine->gamedrv->name, "jdredd" ) ) || |
| 2236 | 2236 | ( !strcmp( machine->gamedrv->name, "jdreddb" ) ) ) |
| 2237 | 2237 | { |
| r2844 | r2845 | |
| 2387 | 2387 | static MACHINE_RESET( coh1001l ) |
| 2388 | 2388 | { |
| 2389 | 2389 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked rom */ |
| 2390 | zn_machine_init(); | |
| 2390 | zn_machine_init(machine); | |
| 2391 | 2391 | } |
| 2392 | 2392 | |
| 2393 | 2393 | static MACHINE_DRIVER_START( coh1001l ) |
| r2844 | r2845 | |
| 2434 | 2434 | { |
| 2435 | 2435 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */ |
| 2436 | 2436 | memory_set_bankptr( 2, memory_region( REGION_USER3 ) ); /* banked rom */ |
| 2437 | zn_machine_init(); | |
| 2437 | zn_machine_init(machine); | |
| 2438 | 2438 | } |
| 2439 | 2439 | |
| 2440 | 2440 | static INTERRUPT_GEN( coh1002v_vblank ) |
| r2844 | r2845 | |
| 2657 | 2657 | static MACHINE_RESET( coh1002m ) |
| 2658 | 2658 | { |
| 2659 | 2659 | memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); |
| 2660 | zn_machine_init(); | |
| 2660 | zn_machine_init(machine); | |
| 2661 | 2661 | } |
| 2662 | 2662 | |
| 2663 | 2663 | static READ8_HANDLER( cbaj_z80_latch_r ) |
| r2844 | r2845 | |
|---|---|---|
| 44 | 44 | #include "video/taitoic.h" |
| 45 | 45 | #include "audio/taitosnd.h" |
| 46 | 46 | #include "sound/2203intf.h" |
| 47 | #include "includes/cchip.h" | |
| 47 | 48 | |
| 48 | 49 | WRITE16_HANDLER( volfied_sprite_ctrl_w ); |
| 49 | 50 | WRITE16_HANDLER( volfied_video_ram_w ); |
| 50 | 51 | WRITE16_HANDLER( volfied_video_ctrl_w ); |
| 51 | 52 | WRITE16_HANDLER( volfied_video_mask_w ); |
| 52 | 53 | |
| 53 | void volfied_cchip_init(void); | |
| 54 | READ16_HANDLER( volfied_cchip_ctrl_r ); | |
| 55 | READ16_HANDLER( volfied_cchip_ram_r ); | |
| 56 | WRITE16_HANDLER( volfied_cchip_ctrl_w ); | |
| 57 | WRITE16_HANDLER( volfied_cchip_bank_w ); | |
| 58 | WRITE16_HANDLER( volfied_cchip_ram_w ); | |
| 59 | ||
| 60 | 54 | READ16_HANDLER( volfied_video_ram_r ); |
| 61 | 55 | READ16_HANDLER( volfied_video_ctrl_r ); |
| 62 | 56 |
| r2844 | r2845 | |
|---|---|---|
| 77 | 77 | { |
| 78 | 78 | /* low value in the given bit selects */ |
| 79 | 79 | if (!(input_mux & 0x01)) |
| 80 | return input_port_read | |
| 80 | return input_port_read | |
| 81 | 81 | else if (!(input_mux & 0x02)) |
| 82 | return input_port_read | |
| 82 | return input_port_read | |
| 83 | 83 | else if (!(input_mux & 0x04)) |
| 84 | return input_port_read | |
| 84 | return input_port_read | |
| 85 | 85 | return 0xff; |
| 86 | 86 | } |
| 87 | 87 | |
| r2844 | r2845 | |
| 250 | 250 | *************************************/ |
| 251 | 251 | |
| 252 | 252 | static INPUT_PORTS_START( dribling ) |
| 253 | PORT_START /* IN0 (mux 0) */ | |
| 253 | PORT_START_TAG("MUX0") /* IN0 (mux 0) */ | |
| 254 | 254 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) |
| 255 | 255 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) |
| 256 | 256 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) |
| r2844 | r2845 | |
| 260 | 260 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1) |
| 261 | 261 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(1) |
| 262 | 262 | |
| 263 | PORT_START /* IN0 (mux 1) */ | |
| 263 | PORT_START_TAG("MUX1") /* IN0 (mux 1) */ | |
| 264 | 264 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(2) |
| 265 | 265 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(2) |
| 266 | 266 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 270 | 270 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) |
| 271 | 271 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) |
| 272 | 272 | |
| 273 | PORT_START /* IN0 (mux 2) */ | |
| 273 | PORT_START_TAG("MUX2") /* IN0 (mux 2) */ | |
| 274 | 274 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 275 | 275 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 276 | 276 | PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r2844 | r2845 | |
| 278 | 278 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 279 | 279 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 280 | 280 | |
| 281 | PORT_START /* IN0 */ | |
| 281 | PORT_START_TAG("IN0") /* IN0 */ | |
| 282 | 282 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 283 | 283 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 284 | 284 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) |
| r2844 | r2845 | |
|---|---|---|
| 852 | 852 | PORT_CODE_DEC(KEYCODE_S) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(KEYCODE_F) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_RESET PORT_PLAYER(2) |
| 853 | 853 | |
| 854 | 854 | /* extra ports for shooters */ |
| 855 | PORT_START /* fake analog X */ | |
| 855 | PORT_START_TAG("FAKEX") /* fake analog X */ | |
| 856 | 856 | PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) |
| 857 | 857 | |
| 858 | PORT_START /* fake analog Y */ | |
| 858 | PORT_START_TAG("FAKEY") /* fake analog Y */ | |
| 859 | 859 | PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) |
| 860 | 860 | INPUT_PORTS_END |
| 861 | 861 |
| r2844 | r2845 | |
|---|---|---|
| 60 | 60 | * Video Hardware * |
| 61 | 61 | *************************/ |
| 62 | 62 | |
| 63 | VIDEO_START( itgambl2 ) | |
| 63 | static VIDEO_START( itgambl2 ) | |
| 64 | 64 | { |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | VIDEO_UPDATE( itgambl2 ) | |
| 68 | static VIDEO_UPDATE( itgambl2 ) | |
| 69 | 69 | { |
| 70 | 70 | return 0; |
| 71 | 71 | } |
| r2844 | r2845 | |
| 169 | 169 | * Machine Reset * |
| 170 | 170 | **************************/ |
| 171 | 171 | |
| 172 | MACHINE_RESET( itgambl2 ) | |
| 172 | static MACHINE_RESET( itgambl2 ) | |
| 173 | 173 | { |
| 174 | 174 | /* stop the CPU, we have no code for it anyway */ |
| 175 | 175 | cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, ASSERT_LINE); |
| r2844 | r2845 | |
| 222 | 222 | * Rom Load * |
| 223 | 223 | *************************/ |
| 224 | 224 | |
| 225 | /* | |
| 225 | /* NtCash | |
| 226 | 226 | |
| 227 | 227 | CPU: |
| 228 | 228 | |
| r2844 | r2845 | |
| 250 | 250 | |
| 251 | 251 | */ |
| 252 | 252 | |
| 253 | ROM_START( | |
| 253 | ROM_START( ntcash | |
| 254 | 254 | ROM_REGION( 0x1000000, REGION_CPU1, 0 ) /* all the program code is in here */ |
| 255 | ROM_LOAD( " | |
| 255 | ROM_LOAD( "ntcash | |
| 256 | 256 | |
| 257 | 257 | ROM_REGION( 0x200000, REGION_GFX1, 0 ) |
| 258 | ROM_LOAD( "xlep1.bin", 0x000000, 0x80000, CRC(b45c9491) SHA1(1fa0572d3efb847dcf49bb99f429322dcb72b0d1) ) | |
| 259 | ROM_LOAD( "xlep2.bin", 0x080000, 0x80000, CRC(75c82293) SHA1(e6d847a2259393ef8877e9237c7624bf2e36f197) ) | |
| 260 | ROM_LOAD( "xlep3.bin", 0x100000, 0x80000, CRC(3a45d626) SHA1(c804916b6bfe04bacd7ac6f32e5041ed65e7b91e) ) | |
| 261 | ROM_LOAD( "xlep4.bin", 0x180000, 0x80000, CRC(d0381819) SHA1(30bab7e1c68192a2e1c324ef4c8a3d3b5696eb2b) ) | |
| 258 | ROM_LOAD( "ntcashep1.bin", 0x000000, 0x80000, CRC(f1e8b74d) SHA1(b84e36ab101d6b5b1f60d9778bd8e5d89b3d437d) ) | |
| 259 | ROM_LOAD( "ntcashep2.bin", 0x080000, 0x80000, CRC(b51513c8) SHA1(27b6469daecb92d8a8ed6e9ab317d20f49dd6475) ) | |
| 260 | ROM_LOAD( "ntcashep3.bin", 0x100000, 0x80000, CRC(ba46f1b2) SHA1(61f5b2f1732bbdb2bd21835d2c6e2890c1f0fc8c) ) | |
| 261 | ROM_LOAD( "ntcashep4.bin", 0x180000, 0x80000, CRC(1e42142d) SHA1(82444584b1d61ff0a34d7767f70cab995d26e1e1) ) | |
| 262 | 262 | |
| 263 | 263 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) /* NEC D7759GC samples */ |
| 264 | ROM_LOAD( " | |
| 264 | ROM_LOAD( "ntcashmsg0.bin", 0x00000, 0x20000, CRC(e3022f30 | |
| 265 | 265 | ROM_END |
| 266 | 266 | |
| 267 | 267 | |
| 268 | /* | |
| 268 | /* W | |
| 269 | 269 | |
| 270 | 270 | CPU: |
| 271 | 271 | |
| r2844 | r2845 | |
| 278 | 278 | |
| 279 | 279 | ROMs: |
| 280 | 280 | |
| 281 | 1x 27C2000 (s) | |
| 282 | 3x M27C4001 (1, 2, 3) | |
| 281 | 1x M27C1001 (0) | |
| 282 | 4x M27C4001 (1, 2, 3, 4) | |
| 283 | 283 | |
| 284 | 284 | Note: |
| 285 | 285 | |
| r2844 | r2845 | |
| 288 | 288 | 1x 14 legs isp connector |
| 289 | 289 | 1x battery |
| 290 | 290 | 1x red led |
| 291 | 2x 8x2 switches | |
| 291 | 2x 8x2 DIP switches | |
| 292 | 292 | 2x trimmer |
| 293 | 293 | |
| 294 | 294 | */ |
| 295 | 295 | |
| 296 | ROM_START( | |
| 296 | ROM_START( w | |
| 297 | 297 | ROM_REGION( 0x1000000, REGION_CPU1, 0 ) /* all the program code is in here */ |
| 298 | ROM_LOAD( " | |
| 298 | ROM_LOAD( "w | |
| 299 | 299 | |
| 300 | ROM_REGION( 0x180000, REGION_GFX1, 0 ) /* only 3 ROMs?? */ | |
| 301 | ROM_LOAD( "mdrink-1.bin", 0x000000, 0x80000, CRC(25a7cea9) SHA1(d67a7264501699c8f7a48c3f3956903a5c95898f) ) | |
| 302 | ROM_LOAD( "mdrink-2.bin", 0x080000, 0x80000, CRC(c2a14bca) SHA1(8d0095333c34d81d103f15ee5731e2e4aa4d1fac) ) | |
| 303 | ROM_LOAD( "mdrink-3.bin", 0x100000, 0x80000, CRC(ff593676) SHA1(b21bb85df0b7b79c07ded2c4b950c94719e08302) ) | |
| 300 | ROM_REGION( 0x200000, REGION_GFX1, 0 ) | |
| 301 | ROM_LOAD( "wizardep1.bin", 0x000000, 0x80000, CRC(a99af86f) SHA1(4bf32df74e93a6b40cf8213e99ec6ef538d9802d) ) | |
| 302 | ROM_LOAD( "wizardep2.bin", 0x080000, 0x80000, CRC(bc52566d) SHA1(ecd4f3852c3ba8981316686042dfc2c0013f139f) ) | |
| 303 | ROM_LOAD( "wizardep3.bin", 0x100000, 0x80000, CRC(98e1905a) SHA1(805df94fef011b48d5eb2abbd294b7cd338d7124) ) | |
| 304 | ROM_LOAD( "wizardep4.bin", 0x180000, 0x80000, CRC(f129916a) SHA1(c1c0fcb04622dde196299c2e88a807b2aa00bf5e) ) | |
| 304 | 305 | |
| 305 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* NEC D7759GC samples */ | |
| 306 | ROM_LOAD( "mdrink-s.bin", 0x00000, 0x40000, CRC(d78b7823) SHA1(ca01e4aa3e25c3a40517b4fe07c31915e79af650) ) | |
| 306 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) /* NEC D7759GC samples */ | |
| 307 | ROM_LOAD( "wizardmsg0.bin", 0x00000, 0x20000, CRC(94b28a4b) SHA1(2c10462cd7c8dc79dba735a061841a9c8b423091) ) | |
| 307 | 308 | ROM_END |
| 308 | 309 | |
| 309 | 310 | |
| 310 | /* | |
| 311 | /* L | |
| 311 | 312 | |
| 312 | 313 | CPU: |
| 313 | 314 | |
| r2844 | r2845 | |
| 335 | 336 | |
| 336 | 337 | */ |
| 337 | 338 | |
| 338 | ROM_START( | |
| 339 | ROM_START( l | |
| 339 | 340 | ROM_REGION( 0x1000000, REGION_CPU1, 0 ) /* all the program code is in here */ |
| 340 | ROM_LOAD( " | |
| 341 | ROM_LOAD( "l | |
| 341 | 342 | |
| 342 | 343 | ROM_REGION( 0x200000, REGION_GFX1, 0 ) |
| 343 | ROM_LOAD( "ntcashep1.bin", 0x000000, 0x80000, CRC(f1e8b74d) SHA1(b84e36ab101d6b5b1f60d9778bd8e5d89b3d437d) ) | |
| 344 | ROM_LOAD( "ntcashep2.bin", 0x080000, 0x80000, CRC(b51513c8) SHA1(27b6469daecb92d8a8ed6e9ab317d20f49dd6475) ) | |
| 345 | ROM_LOAD( "ntcashep3.bin", 0x100000, 0x80000, CRC(ba46f1b2) SHA1(61f5b2f1732bbdb2bd21835d2c6e2890c1f0fc8c) ) | |
| 346 | ROM_LOAD( "ntcashep4.bin", 0x180000, 0x80000, CRC(1e42142d) SHA1(82444584b1d61ff0a34d7767f70cab995d26e1e1) ) | |
| 344 | ROM_LOAD( "xlep1.bin", 0x000000, 0x80000, CRC(b45c9491) SHA1(1fa0572d3efb847dcf49bb99f429322dcb72b0d1) ) | |
| 345 | ROM_LOAD( "xlep2.bin", 0x080000, 0x80000, CRC(75c82293) SHA1(e6d847a2259393ef8877e9237c7624bf2e36f197) ) | |
| 346 | ROM_LOAD( "xlep3.bin", 0x100000, 0x80000, CRC(3a45d626) SHA1(c804916b6bfe04bacd7ac6f32e5041ed65e7b91e) ) | |
| 347 | ROM_LOAD( "xlep4.bin", 0x180000, 0x80000, CRC(d0381819) SHA1(30bab7e1c68192a2e1c324ef4c8a3d3b5696eb2b) ) | |
| 347 | 348 | |
| 348 | 349 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) /* NEC D7759GC samples */ |
| 349 | ROM_LOAD( " | |
| 350 | ROM_LOAD( "xl | |
| 350 | 351 | ROM_END |
| 351 | 352 | |
| 352 | 353 | |
| 353 | /* | |
| 354 | /* M | |
| 354 | 355 | |
| 355 | 356 | CPU: |
| 356 | 357 | |
| r2844 | r2845 | |
| 363 | 364 | |
| 364 | 365 | ROMs: |
| 365 | 366 | |
| 366 | 1x M27C1001 (0) | |
| 367 | 4x M27C4001 (1, 2, 3, 4) | |
| 367 | 1x 27C2000 (s) | |
| 368 | 3x M27C4001 (1, 2, 3) | |
| 368 | 369 | |
| 369 | 370 | Note: |
| 370 | 371 | |
| r2844 | r2845 | |
| 373 | 374 | 1x 14 legs isp connector |
| 374 | 375 | 1x battery |
| 375 | 376 | 1x red led |
| 376 | 2x 8x2 | |
| 377 | 2x 8x2 | |
| 377 | 378 | 2x trimmer |
| 378 | 379 | |
| 379 | 380 | */ |
| 380 | 381 | |
| 381 | ROM_START( | |
| 382 | ROM_START( m | |
| 382 | 383 | ROM_REGION( 0x1000000, REGION_CPU1, 0 ) /* all the program code is in here */ |
| 383 | ROM_LOAD( " | |
| 384 | ROM_LOAD( "m | |
| 384 | 385 | |
| 385 | ROM_REGION( 0x200000, REGION_GFX1, 0 ) | |
| 386 | ROM_LOAD( "wizardep1.bin", 0x000000, 0x80000, CRC(a99af86f) SHA1(4bf32df74e93a6b40cf8213e99ec6ef538d9802d) ) | |
| 387 | ROM_LOAD( "wizardep2.bin", 0x080000, 0x80000, CRC(bc52566d) SHA1(ecd4f3852c3ba8981316686042dfc2c0013f139f) ) | |
| 388 | ROM_LOAD( "wizardep3.bin", 0x100000, 0x80000, CRC(98e1905a) SHA1(805df94fef011b48d5eb2abbd294b7cd338d7124) ) | |
| 389 | ROM_LOAD( "wizardep4.bin", 0x180000, 0x80000, CRC(f129916a) SHA1(c1c0fcb04622dde196299c2e88a807b2aa00bf5e) ) | |
| 386 | ROM_REGION( 0x180000, REGION_GFX1, 0 ) /* only 3 ROMs?? */ | |
| 387 | ROM_LOAD( "mdrink-1.bin", 0x000000, 0x80000, CRC(25a7cea9) SHA1(d67a7264501699c8f7a48c3f3956903a5c95898f) ) | |
| 388 | ROM_LOAD( "mdrink-2.bin", 0x080000, 0x80000, CRC(c2a14bca) SHA1(8d0095333c34d81d103f15ee5731e2e4aa4d1fac) ) | |
| 389 | ROM_LOAD( "mdrink-3.bin", 0x100000, 0x80000, CRC(ff593676) SHA1(b21bb85df0b7b79c07ded2c4b950c94719e08302) ) | |
| 390 | 390 | |
| 391 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) /* NEC D7759GC samples */ | |
| 392 | ROM_LOAD( "wizardmsg0.bin", 0x00000, 0x20000, CRC(94b28a4b) SHA1(2c10462cd7c8dc79dba735a061841a9c8b423091) ) | |
| 391 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* NEC D7759GC samples */ | |
| 392 | ROM_LOAD( "mdrink-s.bin", 0x00000, 0x40000, CRC(d78b7823) SHA1(ca01e4aa3e25c3a40517b4fe07c31915e79af650) ) | |
| 393 | 393 | ROM_END |
| 394 | 394 | |
| 395 | 395 | |
| r2844 | r2845 | |
| 645 | 645 | *************************/ |
| 646 | 646 | |
| 647 | 647 | /* YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS */ |
| 648 | GAME( 1999, ntcash, 0, itgambl2, itgambl2, 0, ROT0, "Unknown", "NtCash", GAME_NOT_WORKING ) | |
| 649 | GAME( 1999, wizard, 0, itgambl2, itgambl2, 0, ROT0, "A.A.", "Wizard (Ver 1.0)", GAME_NOT_WORKING ) | |
| 648 | 650 | GAME( 2001, laser2k1, 0, itgambl2, itgambl2, 0, ROT0, "Unknown", "Laser 2001 (Ver 1.2)", GAME_NOT_WORKING ) |
| 649 | 651 | GAME( 2001, mdrink, 0, itgambl2, itgambl2, 0, ROT0, "Unknown", "Magic Drink (Ver 1.2)", GAME_NOT_WORKING ) |
| 650 | GAME( 2001, ntcash, 0, itgambl2, itgambl2, 0, ROT0, "Unknown", "NtCash", GAME_NOT_WORKING ) | |
| 651 | GAME( 2001, wizard, 0, itgambl2, itgambl2, 0, ROT0, "Unknown", "Wizard (Ver 1.0)", GAME_NOT_WORKING ) | |
| 652 | 652 | GAME( 2001, te0144, 0, itgambl2, itgambl2, 0, ROT0, "Unknown", "Unknown italian gambling game", GAME_NOT_WORKING ) |
| 653 | 653 | GAME( 200?, cmagica, 0, itgambl2, itgambl2, 0, ROT0, "Unknown", "Carta Magica (Ver 1.8)", GAME_NOT_WORKING ) |
| 654 | 654 | GAME( 200?, millsun, 0, itgambl2, itgambl2, 0, ROT0, "Unknown", "Millennium Sun", GAME_NOT_WORKING ) |
| r2844 | r2845 | |
|---|---|---|
| 49 | 49 | #include "cpu/z80/z80.h" |
| 50 | 50 | #include "cpu/m6805/m6805.h" |
| 51 | 51 | #include "sound/2203intf.h" |
| 52 | #include "includes/mexico86.h" | |
| 52 | 53 | |
| 53 | /* in machine/mexico86.c */ | |
| 54 | extern UINT8 *mexico86_protection_ram; | |
| 55 | WRITE8_HANDLER( mexico86_f008_w ); | |
| 56 | INTERRUPT_GEN( kikikai_interrupt ); | |
| 57 | INTERRUPT_GEN( mexico86_m68705_interrupt ); | |
| 58 | READ8_HANDLER( mexico86_68705_portA_r ); | |
| 59 | WRITE8_HANDLER( mexico86_68705_portA_w ); | |
| 60 | WRITE8_HANDLER( mexico86_68705_ddrA_w ); | |
| 61 | READ8_HANDLER( mexico86_68705_portB_r ); | |
| 62 | WRITE8_HANDLER( mexico86_68705_portB_w ); | |
| 63 | WRITE8_HANDLER( mexico86_68705_ddrB_w ); | |
| 64 | ||
| 65 | /* in video/mexico86.c */ | |
| 66 | extern UINT8 *mexico86_videoram,*mexico86_objectram; | |
| 67 | extern size_t mexico86_objectram_size; | |
| 68 | WRITE8_HANDLER( mexico86_bankswitch_w ); | |
| 69 | VIDEO_UPDATE( mexico86 ); | |
| 70 | VIDEO_UPDATE( kikikai ); | |
| 71 | ||
| 72 | 54 | //AT |
| 73 | 55 | static READ8_HANDLER( kiki_2203_r ) |
| 74 | 56 | { |
| r2844 | r2845 | |
|---|---|---|
| 25 | 25 | extern READ8_HANDLER (megatech_sms_ioport_dc_r); |
| 26 | 26 | extern READ8_HANDLER (megatech_sms_ioport_dd_r); |
| 27 | 27 | |
| 28 | ||
| 28 | MACHINE_RESET( megadriv ); | |
| 29 | VIDEO_START( megadriv ); | |
| 30 | VIDEO_UPDATE( megadriv ); | |
| 31 | VIDEO_EOF( megadriv ); |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | |
| 8 | 8 | #include "driver.h" |
| 9 | 9 | #include "sound/ay8910.h" |
| 10 | #include "includes/chaknpop.h" | |
| 10 | 11 | |
| 11 | /* machine/chaknpop.c */ | |
| 12 | extern UINT8 *chaknpop_ram; | |
| 13 | DRIVER_INIT( chaknpop ); | |
| 14 | MACHINE_RESET( chaknpop ); | |
| 15 | READ8_HANDLER( chaknpop_mcu_portA_r ); | |
| 16 | READ8_HANDLER( chaknpop_mcu_portB_r ); | |
| 17 | READ8_HANDLER( chaknpop_mcu_portC_r ); | |
| 18 | WRITE8_HANDLER( chaknpop_mcu_portA_w ); | |
| 19 | WRITE8_HANDLER( chaknpop_mcu_portB_w ); | |
| 20 | WRITE8_HANDLER( chaknpop_mcu_portC_w ); | |
| 21 | 12 | |
| 22 | ||
| 23 | /* video/chaknpop.c */ | |
| 24 | extern UINT8 *chaknpop_txram; | |
| 25 | extern UINT8 *chaknpop_sprram; | |
| 26 | extern size_t chaknpop_sprram_size; | |
| 27 | extern UINT8 *chaknpop_attrram; | |
| 28 | ||
| 29 | ||
| 30 | PALETTE_INIT( chaknpop ); | |
| 31 | VIDEO_START( chaknpop ); | |
| 32 | VIDEO_UPDATE( chaknpop ); | |
| 33 | ||
| 34 | READ8_HANDLER( chaknpop_gfxmode_r ); | |
| 35 | WRITE8_HANDLER( chaknpop_gfxmode_w ); | |
| 36 | ||
| 37 | WRITE8_HANDLER( chaknpop_txram_w ); | |
| 38 | ||
| 39 | WRITE8_HANDLER( chaknpop_attrram_w ); | |
| 40 | ||
| 41 | ||
| 42 | 13 | /*************************************************************************** |
| 43 | 14 | |
| 44 | 15 | Memory Handler(s) |
| r2844 | r2845 | |
|---|---|---|
| 30 | 30 | #include "cpu/z80/z80.h" |
| 31 | 31 | #include "cpu/m6805/m6805.h" |
| 32 | 32 | #include "sound/2203intf.h" |
| 33 | #include "includes/lkage.h" | |
| 33 | 34 | |
| 34 | 35 | |
| 35 | extern UINT8 *lkage_scroll, *lkage_vreg; | |
| 36 | WRITE8_HANDLER( lkage_videoram_w ); | |
| 37 | VIDEO_START( lkage ); | |
| 38 | VIDEO_UPDATE( lkage ); | |
| 39 | ||
| 40 | READ8_HANDLER( lkage_68705_portA_r ); | |
| 41 | WRITE8_HANDLER( lkage_68705_portA_w ); | |
| 42 | READ8_HANDLER( lkage_68705_portB_r ); | |
| 43 | WRITE8_HANDLER( lkage_68705_portB_w ); | |
| 44 | READ8_HANDLER( lkage_68705_portC_r ); | |
| 45 | WRITE8_HANDLER( lkage_68705_portC_w ); | |
| 46 | WRITE8_HANDLER( lkage_68705_ddrA_w ); | |
| 47 | WRITE8_HANDLER( lkage_68705_ddrB_w ); | |
| 48 | WRITE8_HANDLER( lkage_68705_ddrC_w ); | |
| 49 | WRITE8_HANDLER( lkage_mcu_w ); | |
| 50 | READ8_HANDLER( lkage_mcu_r ); | |
| 51 | READ8_HANDLER( lkage_mcu_status_r ); | |
| 52 | ||
| 53 | ||
| 54 | 36 | static int sound_nmi_enable,pending_nmi; |
| 55 | 37 | |
| 56 | 38 | static TIMER_CALLBACK( nmi_callback ) |
| r2844 | r2845 | |
|---|---|---|
| 175 | 175 | { |
| 176 | 176 | if (offset == 0) |
| 177 | 177 | { |
| 178 | return (input_port_read | |
| 178 | return (input_port_read | |
| 179 | 179 | } |
| 180 | 180 | else if (offset == 1) |
| 181 | 181 | { |
| 182 | return (input_port_read | |
| 182 | return (input_port_read | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return 0; |
| r2844 | r2845 | |
| 235 | 235 | PORT_START_TAG("P1_ANALOG_Y") |
| 236 | 236 | PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0xff,0x00) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1) |
| 237 | 237 | |
| 238 | PORT_START | |
| 238 | PORT_START_TAG("IN0") | |
| 239 | 239 | PORT_DIPNAME( 0x80000000, 0x80000000, "DIPSW1 #8" ) |
| 240 | 240 | PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) |
| 241 | 241 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 286 | 286 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 287 | 287 | PORT_BIT(0x0000ffff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 288 | 288 | |
| 289 | PORT_START | |
| 289 | PORT_START_TAG("IN1") | |
| 290 | 290 | PORT_BIT( 0xff00ffff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 291 | 291 | PORT_SERVICE_NO_TOGGLE( 0x00200000, IP_ACTIVE_LOW ) |
| 292 | 292 | PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_7) |
| r2844 | r2845 | |
| 300 | 300 | PORT_START_TAG("P1_ANALOG_X") |
| 301 | 301 | PORT_START_TAG("P1_ANALOG_Y") |
| 302 | 302 | |
| 303 | PORT_START | |
| 303 | PORT_START_TAG("IN0") | |
| 304 | 304 | PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 305 | 305 | PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_START2 ) |
| 306 | 306 | PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r2844 | r2845 | |
| 319 | 319 | PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 320 | 320 | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 321 | 321 | |
| 322 | PORT_START | |
| 322 | PORT_START_TAG("IN1") | |
| 323 | 323 | PORT_BIT( 0xffcc, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 324 | 324 | PORT_SERVICE_NO_TOGGLE( 0x0020, IP_ACTIVE_LOW ) |
| 325 | 325 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_7) |
| r2844 | r2845 | |
| 352 | 352 | PORT_START_TAG("P1_ANALOG_Y") |
| 353 | 353 | PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0xff,0x00) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1) |
| 354 | 354 | |
| 355 | PORT_START | |
| 355 | PORT_START_TAG("IN0") | |
| 356 | 356 | PORT_DIPNAME( 0x80000000, 0x00000000, DEF_STR(Joystick) ) // DIPSW1 #8 |
| 357 | 357 | PORT_DIPSETTING( 0x00000000, DEF_STR(Joystick) ) |
| 358 | 358 | PORT_DIPSETTING( 0x80000000, "3D" ) |
| r2844 | r2845 | |
| 399 | 399 | PORT_DIPSETTING( 0x00000000, "Hard2" ) |
| 400 | 400 | PORT_BIT(0x0000ffff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 401 | 401 | |
| 402 | PORT_START | |
| 402 | PORT_START_TAG("IN1") | |
| 403 | 403 | PORT_BIT( 0xff00ffff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 404 | 404 | PORT_SERVICE_NO_TOGGLE( 0x00200000, IP_ACTIVE_LOW ) |
| 405 | 405 | PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_7) |
| r2844 | r2845 | |
|---|---|---|
| 857 | 857 | ROM_LOAD( "imago.97", 0x0200, 0x0100, CRC(e28a7f00) SHA1(05b4882c5ea5da332735866d858872bc5eeaca24) ) |
| 858 | 858 | ROM_END |
| 859 | 859 | |
| 860 | extern int fastfred_hardware_type; | |
| 861 | ||
| 862 | 860 | static DRIVER_INIT( flyboy ) |
| 863 | 861 | { |
| 864 | 862 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc085, 0xc099, 0, 0, flyboy_custom1_io_r); |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | Punch Out memory map (preliminary) | |
| 3 | Punch Out / Super Punch Out / Arm Wrestling | |
| 4 | ||
| 4 | 5 | Arm Wrestling runs on about the same hardware, but the video board is different. |
| 5 | The most significant changes are that Punchout has a larger bottom tilemap, | |
| 6 | with scrolling, while Arm Wrestling has an additional FG tilemap displayed on | |
| 7 | the bottom screen. | |
| 6 | The most significant changes are that Punchout has a larger bottom tilemap, | |
| 7 | with scrolling, while Arm Wrestling has an additional FG tilemap displayed on | |
| 8 | the bottom screen. | |
| 8 | 9 | |
| 9 | - money bag placement might not be 100% correct in Arm Wrestingl | |
| 10 | - money bag placement might not be 100% correct in Arm Wrestingl | |
| 10 | 11 | the more serious part of armwrest35b9yel (unplayable bonus round after rounds |
| 11 | 12 | 5 and 9) is now fixed. |
| 12 | 13 | |
| r2844 | r2845 | |
| 110 | 111 | |
| 111 | 112 | #include "rendlay.h" |
| 112 | 113 | |
| 113 | extern UINT8 *punchout_topTilemap_ram; | |
| 114 | extern UINT8 *punchout_botTilemap_ram; | |
| 115 | extern UINT8 *punchout_botTilemap_scroll_ram; | |
| 116 | extern UINT8 *armwrest_fgTilemap_ram; | |
| 117 | extern UINT8 *punchout_bigsprite1ram; | |
| 118 | extern UINT8 *punchout_bigsprite2ram; | |
| 119 | extern UINT8 *punchout_bigsprite1; | |
| 120 | extern UINT8 *punchout_bigsprite2; | |
| 114 | extern UINT8 *punchout_bg_top_videoram; | |
| 115 | extern UINT8 *punchout_bg_bot_videoram; | |
| 116 | extern UINT8 *armwrest_fg_videoram; | |
| 117 | extern UINT8 *punchout_spr1_videoram; | |
| 118 | extern UINT8 *punchout_spr2_videoram; | |
| 119 | extern UINT8 *punchout_spr1_ctrlram; | |
| 120 | extern UINT8 *punchout_spr2_ctrlram; | |
| 121 | 121 | extern UINT8 *punchout_palettebank; |
| 122 | WRITE8_HANDLER( punchout_topTilemap_ram_w ); | |
| 123 | WRITE8_HANDLER( punchout_botTilemap_ram_w ); | |
| 124 | WRITE8_HANDLER( armwrest_fgTilemap_ram_w ); | |
| 125 | WRITE8_HANDLER( punchout_bigsprite1ram_w ); | |
| 126 | WRITE8_HANDLER( punchout_bigsprite2ram_w ); | |
| 127 | WRITE8_HANDLER( punchout_palettebank_w ); | |
| 122 | WRITE8_HANDLER( punchout_bg_top_videoram_w ); | |
| 123 | WRITE8_HANDLER( punchout_bg_bot_videoram_w ); | |
| 124 | WRITE8_HANDLER( armwrest_fg_videoram_w ); | |
| 125 | WRITE8_HANDLER( punchout_spr1_videoram_w ); | |
| 126 | WRITE8_HANDLER( punchout_spr2_videoram_w ); | |
| 128 | 127 | VIDEO_START( punchout ); |
| 129 | 128 | VIDEO_START( armwrest ); |
| 130 | PALETTE_INIT( punchout ); | |
| 131 | PALETTE_INIT( armwrest ); | |
| 132 | 129 | VIDEO_UPDATE( punchout ); |
| 133 | 130 | VIDEO_UPDATE( armwrest ); |
| 134 | 131 | |
| r2844 | r2845 | |
| 402 | 399 | AM_RANGE(0x0000, 0xbfff) AM_ROM |
| 403 | 400 | AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) |
| 404 | 401 | AM_RANGE(0xd000, 0xd7ff) AM_RAM |
| 405 | AM_RANGE(0xdff0, 0xdff7) AM_RAM AM_BASE(&punchout_bigsprite1) | |
| 406 | AM_RANGE(0xdff8, 0xdffc) AM_RAM AM_BASE(&punchout_bigsprite2) | |
| 407 | AM_RANGE(0xdffd, 0xdffd) AM_RAM_WRITE(punchout_palettebank_w) AM_BASE(&punchout_palettebank) | |
| 408 | AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(punchout_topTilemap_ram_w) AM_BASE(&punchout_topTilemap_ram) | |
| 409 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(punchout_bigsprite1ram_w) AM_BASE(&punchout_bigsprite1ram) | |
| 410 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(punchout_bigsprite2ram_w) AM_BASE(&punchout_bigsprite2ram) | |
| 411 | AM_RANGE(0xf000, 0xf03f) AM_RAM AM_BASE(&punchout_botTilemap_scroll_ram) | |
| 412 | AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(punchout_botTilemap_ram_w) AM_BASE(&punchout_botTilemap_ram) | |
| 402 | AM_RANGE(0xdff0, 0xdff7) AM_RAM AM_BASE(&punchout_spr1_ctrlram) | |
| 403 | AM_RANGE(0xdff8, 0xdffc) AM_RAM AM_BASE(&punchout_spr2_ctrlram) | |
| 404 | AM_RANGE(0xdffd, 0xdffd) AM_RAM AM_BASE(&punchout_palettebank) | |
| 405 | AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(punchout_bg_top_videoram_w) AM_BASE(&punchout_bg_top_videoram) | |
| 406 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(punchout_spr1_videoram_w) AM_BASE(&punchout_spr1_videoram) | |
| 407 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(punchout_spr2_videoram_w) AM_BASE(&punchout_spr2_videoram) | |
| 408 | AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(punchout_bg_bot_videoram_w) AM_BASE(&punchout_bg_bot_videoram) // also contains scroll RAM | |
| 413 | 409 | ADDRESS_MAP_END |
| 414 | 410 | |
| 415 | 411 | |
| r2844 | r2845 | |
| 417 | 413 | AM_RANGE(0x0000, 0xbfff) AM_ROM |
| 418 | 414 | AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) |
| 419 | 415 | AM_RANGE(0xd000, 0xd7ff) AM_RAM |
| 420 | AM_RANGE(0xdff0, 0xdff7) AM_RAM AM_BASE(&punchout_bigsprite1) | |
| 421 | AM_RANGE(0xdff8, 0xdffc) AM_RAM AM_BASE(&punchout_bigsprite2) | |
| 422 | AM_RANGE(0xdffd, 0xdffd) AM_RAM_WRITE(punchout_palettebank_w) AM_BASE(&punchout_palettebank) | |
| 423 | AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(armwrest_fgTilemap_ram_w) AM_BASE(&armwrest_fgTilemap_ram) | |
| 424 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(punchout_bigsprite1ram_w) AM_BASE(&punchout_bigsprite1ram) | |
| 425 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(punchout_bigsprite2ram_w) AM_BASE(&punchout_bigsprite2ram) | |
| 426 | AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(punchout_botTilemap_ram_w) AM_BASE(&punchout_botTilemap_ram) | |
| 427 | AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(punchout_topTilemap_ram_w) AM_BASE(&punchout_topTilemap_ram) | |
| 416 | AM_RANGE(0xdff0, 0xdff7) AM_RAM AM_BASE(&punchout_spr1_ctrlram) | |
| 417 | AM_RANGE(0xdff8, 0xdffc) AM_RAM AM_BASE(&punchout_spr2_ctrlram) | |
| 418 | AM_RANGE(0xdffd, 0xdffd) AM_RAM AM_BASE(&punchout_palettebank) | |
| 419 | AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(armwrest_fg_videoram_w) AM_BASE(&armwrest_fg_videoram) | |
| 420 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(punchout_spr1_videoram_w) AM_BASE(&punchout_spr1_videoram) | |
| 421 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(punchout_spr2_videoram_w) AM_BASE(&punchout_spr2_videoram) | |
| 422 | AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(punchout_bg_bot_videoram_w) AM_BASE(&punchout_bg_bot_videoram) | |
| 423 | AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(punchout_bg_top_videoram_w) AM_BASE(&punchout_bg_top_videoram) | |
| 428 | 424 | ADDRESS_MAP_END |
| 429 | 425 | |
| 430 | 426 | |
| r2844 | r2845 | |
| 649 | 645 | INPUT_PORTS_END |
| 650 | 646 | |
| 651 | 647 | |
| 652 | static const gfx_layout charlayout = | |
| 648 | static const gfx_layout charlayout_2bpp = | |
| 653 | 649 | { |
| 654 | 8,8, /* 8*8 characters */ | |
| 655 | 1024, /* 1024 characters */ | |
| 656 | 2, /* 2 bits per pixel */ | |
| 657 | { 1024*8*8, 0 }, /* the bitplanes are separated */ | |
| 650 | 8,8, | |
| 651 | RGN_FRAC(1,2), | |
| 652 | 2, | |
| 653 | { RGN_FRAC(1,2), 0 }, | |
| 658 | 654 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 659 | 655 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 660 | 8*8 | |
| 656 | 8*8 | |
| 661 | 657 | }; |
| 662 | 658 | |
| 663 | static const gfx_layout | |
| 659 | static const gfx_layout | |
| 664 | 660 | { |
| 665 | 8,8, /* 8*8 characters */ | |
| 666 | 2048, /* 2048 characters */ | |
| 667 | 2, /* 2 bits per pixel */ | |
| 668 | { 2048*8*8, 0 }, /* the bitplanes are separated */ | |
| 661 | 8,8, | |
| 662 | RGN_FRAC(1,3), | |
| 663 | 3, | |
| 664 | { RGN_FRAC(2,3), RGN_FRAC(1,3), 0 }, | |
| 669 | 665 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 670 | 666 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 671 | 8*8 | |
| 667 | 8*8 | |
| 672 | 668 | }; |
| 673 | 669 | |
| 674 | static const gfx_layout armwrest_charlayout2 = | |
| 675 | { | |
| 676 | 8,8, /* 8*8 characters */ | |
| 677 | 2048, /* 2048 characters */ | |
| 678 | 3, /* 3 bits per pixel */ | |
| 679 | { 2*2048*8*8, 2048*8*8, 0 }, /* the bitplanes are separated */ | |
| 680 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 681 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, | |
| 682 | 8*8 /* every char takes 8 consecutive bytes */ | |
| 683 | }; | |
| 684 | ||
| 685 | static const gfx_layout charlayout1 = | |
| 686 | { | |
| 687 | 8,8, /* 8*8 characters */ | |
| 688 | 8192, /* 8192 characters */ | |
| 689 | 3, /* 3 bits per pixel */ | |
| 690 | { 2*8192*8*8, 8192*8*8, 0 }, /* the bitplanes are separated */ | |
| 691 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 692 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, | |
| 693 | 8*8 /* every char takes 8 consecutive bytes */ | |
| 694 | }; | |
| 695 | ||
| 696 | static const gfx_layout charlayout2 = | |
| 697 | { | |
| 698 | 8,8, /* 8*8 characters */ | |
| 699 | 4096, /* 4096 characters */ | |
| 700 | 2, /* 2 bits per pixel */ | |
| 701 | { 4096*8*8, 0 }, /* the bitplanes are separated */ | |
| 702 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 703 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, | |
| 704 | 8*8 /* every char takes 8 consecutive bytes */ | |
| 705 | }; | |
| 706 | ||
| 707 | 670 | static GFXDECODE_START( punchout ) |
| 708 | GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 128 ) | |
| 709 | GFXDECODE_ENTRY( REGION_GFX2, 0, charlayout, 128*4, 128 ) | |
| 710 | GFXDECODE_ENTRY( REGION_GFX3, 0, charlayout1, 128*4+128*4, 64 ) | |
| 711 | GFXDECODE_ENTRY( REGION_GFX4, 0, charlayout2, 128*4+128*4+64*8, 128 ) | |
| 671 | GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout_2bpp, 0x000, 0x100/4 ) // bg chars (top monitor only) | |
| 672 | GFXDECODE_ENTRY( REGION_GFX2, 0, charlayout_2bpp, 0x100, 0x100/4 ) // bg chars (bottom monitor only) | |
| 673 | GFXDECODE_ENTRY( REGION_GFX3, 0, charlayout_3bpp, 0x000, 0x200/8 ) // big sprite #1 (top and bottom monitor) | |
| 674 | GFXDECODE_ENTRY( REGION_GFX4, 0, charlayout_2bpp, 0x100, 0x100/4 ) // big sprite #2 (bottom monitor only) | |
| 712 | 675 | GFXDECODE_END |
| 713 | 676 | |
| 714 | 677 | static GFXDECODE_START( armwrest ) |
| 715 | GFXDECODE_ENTRY( REGION_GFX1, 0, armwrest_charlayout, 0, 256 ) | |
| 716 | GFXDECODE_ENTRY( REGION_GFX2, 0, armwrest_charlayout2, 256*4, 64 ) | |
| 717 | GFXDECODE_ENTRY( REGION_GFX3, 0, charlayout1, 256*4+64*8, 64 ) | |
| 718 | GFXDECODE_ENTRY( REGION_GFX4, 0, charlayout2, 256*4+64*8+64*8, 128 ) | |
| 678 | GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout_2bpp, 0x000, 0x200/4 ) // bg chars (top and bottom monitor) | |
| 679 | GFXDECODE_ENTRY( REGION_GFX2, 0, charlayout_3bpp, 0x100, 0x100/8 ) // fg chars (bottom monitor only) | |
| 680 | GFXDECODE_ENTRY( REGION_GFX3, 0, charlayout_3bpp, 0x000, 0x200/8 ) // big sprite #1 (top and bottom monitor) | |
| 681 | GFXDECODE_ENTRY( REGION_GFX4, 0, charlayout_2bpp, 0x100, 0x100/4 ) // big sprite #2 (bottom monitor only) | |
| 719 | 682 | GFXDECODE_END |
| 720 | 683 | |
| 721 | 684 | |
| r2844 | r2845 | |
| 751 | 714 | |
| 752 | 715 | /* video hardware */ |
| 753 | 716 | MDRV_GFXDECODE(punchout) |
| 754 | MDRV_PALETTE_LENGTH(128*4+128*4+64*8+128*4) | |
| 755 | MDRV_DEFAULT_LAYOUT(layout_dualhuov) | |
| 717 | MDRV_PALETTE_LENGTH(0x200) | |
| 718 | MDRV_DEFAULT_LAYOUT(layout_dualhovu) | |
| 756 | 719 | |
| 757 | 720 | MDRV_SCREEN_ADD("top", RASTER) |
| 758 | 721 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| r2844 | r2845 | |
| 768 | 731 | MDRV_SCREEN_SIZE(32*8, 32*8) |
| 769 | 732 | MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 770 | 733 | |
| 771 | MDRV_PALETTE_INIT(punchout) | |
| 772 | 734 | MDRV_VIDEO_START(punchout) |
| 773 | 735 | MDRV_VIDEO_UPDATE(punchout) |
| 774 | 736 | |
| r2844 | r2845 | |
| 795 | 757 | |
| 796 | 758 | /* video hardware */ |
| 797 | 759 | MDRV_GFXDECODE(armwrest) |
| 798 | MDRV_PALETTE_LENGTH(256*4+64*8+64*8+128*4) | |
| 799 | 760 | |
| 800 | MDRV_PALETTE_INIT(armwrest) | |
| 801 | 761 | MDRV_VIDEO_START(armwrest) |
| 802 | 762 | MDRV_VIDEO_UPDATE(armwrest) |
| 803 | 763 | MACHINE_DRIVER_END |
| r2844 | r2845 | |
| 821 | 781 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for the sound CPU */ |
| 822 | 782 | ROM_LOAD( "chp1-c.4k", 0xe000, 0x2000, CRC(cb6ef376) SHA1(503dbcc1b18a497311bf129689d5650860bf96c7) ) |
| 823 | 783 | |
| 824 | ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE | ROMREGION_ERASEFF ) | |
| 784 | ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE | ROMREGION_ERASEFF | ROMREGION_INVERT ) | |
| 825 | 785 | ROM_LOAD( "chp1-b.4c", 0x00000, 0x2000, CRC(e26dc8b3) SHA1(a704d39ef6f5cbad64a478e5c109b18aae427cbc) ) /* chars #1 */ |
| 826 | 786 | ROM_LOAD( "chp1-b.4d", 0x02000, 0x2000, CRC(dd1310ca) SHA1(918d2eda000244b692f1da7ac57d7a0edaef95fb) ) |
| 827 | 787 | |
| 828 | ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE | ROMREGION_ERASEFF ) | |
| 788 | ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE | ROMREGION_ERASEFF | ROMREGION_INVERT ) | |
| 829 | 789 | ROM_LOAD( "chp1-b.4a", 0x00000, 0x2000, CRC(20fb4829) SHA1(9f0ce9379eb31c19bfacdc514ac6a28aa4217cbb) ) /* chars #2 */ |
| 830 | 790 | ROM_LOAD( "chp1-b.4b", 0x02000, 0x2000, CRC(edc34594) SHA1(fbb4a8b979d60b183dc23bdbb7425100b9325287) ) |
| 831 | 791 | |
| r2844 | r2845 | |
| 848 | 808 | /* 2a000-2bfff empty (space for 16k ROM) */ |
| 849 | 809 | /* 2c000-2ffff empty (4v doesn't exist, it is seen as a 0xff fill) */ |
| 850 | 810 | |
| 851 | ROM_REGION( 0x10000, REGION_GFX4, ROMREGION_DISPOSE | ROMREGION_ERASEFF ) | |
| 811 | ROM_REGION( 0x10000, REGION_GFX4, ROMREGION_DISPOSE | ROMREGION_ERASEFF | ROMREGION_INVERT ) | |
| 852 | 812 | ROM_LOAD( "chp1-v.6p", 0x00000, 0x2000, CRC(16588f7a) SHA1(1aeaaa5cc2477c3aa4bf80df7d9474cc9ded9f15) ) /* chars #4 */ |
| 853 | 813 | ROM_LOAD( "chp1-v.6n", 0x02000, 0x2000, CRC(dc743674) SHA1(660582c76ee68a7267d5686a2f8ea0fd6c2b25fc) ) |
| 854 | 814 | /* 04000-07fff empty (space for 6l and 6k) */ |
| r2844 | r2845 | |
| 857 | 817 | /* 0c000-0ffff empty (space for 8l and 8k) */ |
| 858 | 818 | |
| 859 | 819 | ROM_REGION( 0x0d00, REGION_PROMS, 0 ) |
| 860 | ROM_LOAD( "chp1-b.6e", 0x0000, 0x0200, CRC(e9ca3ac6) SHA1(68d9739d8a0dadc6fe3b3767437526096ca5db98) ) /* red component */ | |
| 861 | ROM_LOAD( "chp1-b.7e", 0x0200, 0x0200, CRC(47adf7a2) SHA1(1d37d5207cd37a9c122251c60cc8f43dd680f484) ) /* red component */ | |
| 862 | ROM_LOAD( "chp1-b.6f", 0x0400, 0x0200, CRC(02be56ab) SHA1(a88f332cb26928350ed20ab5f4c04d5324bb516a) ) /* green component */ | |
| 863 | ROM_LOAD( "chp1-b.8e", 0x0600, 0x0200, CRC(b0fc15a8) SHA1(a1af09cfea81231240bd94f3b98de1be8235ebe7) ) /* green component */ | |
| 864 | ROM_LOAD( "chp1-b.7f", 0x0800, 0x0200, CRC(11de55f1) SHA1(269b82f4bc73fac197e0bb6d9a90a220e77ce478) ) /* blue component */ | |
| 865 | ROM_LOAD( "chp1-b.8f", 0x0a00, 0x0200, CRC(1ffd894a) SHA1(9e8c1c28b4c12acf42f814bc109d353729a25652) ) /* blue component */ | |
| 820 | ROM_LOAD( "chp1-b.6e", 0x0000, 0x0200, CRC(e9ca3ac6) SHA1(68d9739d8a0dadc6fe3b3767437526096ca5db98) ) /* R (top monitor) */ | |
| 821 | ROM_LOAD( "chp1-b.6f", 0x0200, 0x0200, CRC(02be56ab) SHA1(a88f332cb26928350ed20ab5f4c04d5324bb516a) ) /* G */ | |
| 822 | ROM_LOAD( "chp1-b.7f", 0x0400, 0x0200, CRC(11de55f1) SHA1(269b82f4bc73fac197e0bb6d9a90a220e77ce478) ) /* B */ | |
| 823 | ROM_LOAD( "chp1-b.7e", 0x0600, 0x0200, CRC(47adf7a2) SHA1(1d37d5207cd37a9c122251c60cc8f43dd680f484) ) /* R (bottom monitor) */ | |
| 824 | ROM_LOAD( "chp1-b.8e", 0x0800, 0x0200, CRC(b0fc15a8) SHA1(a1af09cfea81231240bd94f3b98de1be8235ebe7) ) /* G */ | |
| 825 | ROM_LOAD( "chp1-b.8f", 0x0a00, 0x0200, CRC(1ffd894a) SHA1(9e8c1c28b4c12acf42f814bc109d353729a25652) ) /* B */ | |
| 866 | 826 | ROM_LOAD( "chp1-v.2d", 0x0c00, 0x0100, CRC(71dc0d48) SHA1(dd6609f547d74887f520d7e71a1a00317ff181d0) ) /* timing - not used */ |
| 867 | 827 | |
| 868 | 828 | ROM_REGION( 0x4000, REGION_SOUND1, 0 ) /* 16k for the VLM5030 data */ |
| r2844 | r2845 | |
| 949 | 909 | /* 0c000-0ffff empty (space for 8l and 8k) */ |
| 950 | 910 | |
| 951 | 911 | ROM_REGION( 0x0d00, REGION_PROMS, 0 ) |
| 952 | ROM_LOAD( "chp1-b.6e", 0x0000, 0x0200, CRC(e9ca3ac6) SHA1(68d9739d8a0dadc6fe3b3767437526096ca5db98) ) /* red component */ | |
| 953 | ROM_LOAD( "chp1-b.7e", 0x0200, 0x0200, CRC(47adf7a2) SHA1(1d37d5207cd37a9c122251c60cc8f43dd680f484) ) /* red component */ | |
| 954 | ROM_LOAD( "chp1-b.6f", 0x0400, 0x0200, CRC(02be56ab) SHA1(a88f332cb26928350ed20ab5f4c04d5324bb516a) ) /* green component */ | |
| 955 | ROM_LOAD( "chp1-b.8e", 0x0600, 0x0200, CRC(b0fc15a8) SHA1(a1af09cfea81231240bd94f3b98de1be8235ebe7) ) /* green component */ | |
| 956 | ROM_LOAD( "chp1-b.7f", 0x0800, 0x0200, CRC(11de55f1) SHA1(269b82f4bc73fac197e0bb6d9a90a220e77ce478) ) /* blue component */ | |
| 957 | ROM_LOAD( "chp1-b.8f", 0x0a00, 0x0200, CRC(1ffd894a) SHA1(9e8c1c28b4c12acf42f814bc109d353729a25652) ) /* blue component */ | |
| 912 | ROM_LOAD( "chp1-b.6e", 0x0000, 0x0200, CRC(e9ca3ac6) SHA1(68d9739d8a0dadc6fe3b3767437526096ca5db98) ) /* R (top monitor) */ | |
| 913 | ROM_LOAD( "chp1-b.6f", 0x0200, 0x0200, CRC(02be56ab) SHA1(a88f332cb26928350ed20ab5f4c04d5324bb516a) ) /* G */ | |
| 914 | ROM_LOAD( "chp1-b.7f", 0x0400, 0x0200, CRC(11de55f1) SHA1(269b82f4bc73fac197e0bb6d9a90a220e77ce478) ) /* B */ | |
| 915 | ROM_LOAD( "chp1-b.7e", 0x0600, 0x0200, CRC(47adf7a2) SHA1(1d37d5207cd37a9c122251c60cc8f43dd680f484) ) /* R (bottom monitor) */ | |
| 916 | ROM_LOAD( "chp1-b.8e", 0x0800, 0x0200, CRC(b0fc15a8) SHA1(a1af09cfea81231240bd94f3b98de1be8235ebe7) ) /* G */ | |
| 917 | ROM_LOAD( "chp1-b.8f", 0x0a00, 0x0200, CRC(1ffd894a) SHA1(9e8c1c28b4c12acf42f814bc109d353729a25652) ) /* B */ | |
| 958 | 918 | ROM_LOAD( "chp1-v.2d", 0x0c00, 0x0100, CRC(71dc0d48) SHA1(dd6609f547d74887f520d7e71a1a00317ff181d0) ) /* timing - not used */ |
| 959 | 919 | |
| 960 | 920 | ROM_REGION( 0x4000, REGION_SOUND1, 0 ) /* 16k for the VLM5030 data */ |
| r2844 | r2845 | |
| 1029 | 989 | /* 0c000-0ffff empty (space for 8l and 8k) */ |
| 1030 | 990 | |
| 1031 | 991 | ROM_REGION( 0x0d00, REGION_PROMS, 0 ) |
| 1032 | ROM_LOAD( "chs1-b.6e", 0x0000, 0x0200, CRC(0ad4d727) SHA1(5fa4247d58d10b4644f0a7492efb22b7a9ce7b62) ) /* red component */ | |
| 1033 | ROM_LOAD( "chs1-b.7e", 0x0200, 0x0200, CRC(9e170f64) SHA1(9548bfec2f5b7d222e91562b5459aef8c107b3ec) ) /* red component */ | |
| 1034 | ROM_LOAD( "chs1-b.6f", 0x0400, 0x0200, CRC(86f5cfdb) SHA1(a2a3a4e9ca15826fe8c86650d50c8ce203d57eae) ) /* green component */ | |
| 1035 | ROM_LOAD( "chs1-b.8e", 0x0600, 0x0200, CRC(3a2e333b) SHA1(5cf0324cc07ac4af63598c5c6acc61d24215b233) ) /* green component */ | |
| 1036 | ROM_LOAD( "chs1-b.7f", 0x0800, 0x0200, CRC(8bd406f8) SHA1(eaf0b62eccf1f47452bf983b3ffc6cacc25d4585) ) /* blue component */ | |
| 1037 | ROM_LOAD( "chs1-b.8f", 0x0a00, 0x0200, CRC(1663eed7) SHA1(90ff876a6b885f8a80c17531cde8b91864f1a6a5) ) /* blue component */ | |
| 992 | ROM_LOAD( "chs1-b.6e", 0x0000, 0x0200, CRC(0ad4d727) SHA1(5fa4247d58d10b4644f0a7492efb22b7a9ce7b62) ) /* R (top monitor) */ | |
| 993 | ROM_LOAD( "chs1-b.6f", 0x0200, 0x0200, CRC(86f5cfdb) SHA1(a2a3a4e9ca15826fe8c86650d50c8ce203d57eae) ) /* G */ | |
| 994 | ROM_LOAD( "chs1-b.7f", 0x0400, 0x0200, CRC(8bd406f8) SHA1(eaf0b62eccf1f47452bf983b3ffc6cacc25d4585) ) /* B */ | |
| 995 | ROM_LOAD( "chs1-b.7e", 0x0600, 0x0200, CRC(9e170f64) SHA1(9548bfec2f5b7d222e91562b5459aef8c107b3ec) ) /* R (bottom monitor) */ | |
| 996 | ROM_LOAD( "chs1-b.8e", 0x0800, 0x0200, CRC(3a2e333b) SHA1(5cf0324cc07ac4af63598c5c6acc61d24215b233) ) /* G */ | |
| 997 | ROM_LOAD( "chs1-b.8f", 0x0a00, 0x0200, CRC(1663eed7) SHA1(90ff876a6b885f8a80c17531cde8b91864f1a6a5) ) /* B */ | |
| 1038 | 998 | ROM_LOAD( "chs1-v.2d", 0x0c00, 0x0100, CRC(71dc0d48) SHA1(dd6609f547d74887f520d7e71a1a00317ff181d0) ) /* timing - not used */ |
| 1039 | 999 | |
| 1040 | 1000 | ROM_REGION( 0x10000, REGION_SOUND1, 0 ) /* 64k for the VLM5030 data */ |
| r2844 | r2845 | |
| 1052 | 1012 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for the sound CPU */ |
| 1053 | 1013 | ROM_LOAD( "chp1-c.4k", 0xe000, 0x2000, CRC(cb6ef376) SHA1(503dbcc1b18a497311bf129689d5650860bf96c7) ) |
| 1054 | 1014 | |
| 1055 | ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE | ROMREGION_ERASEFF ) | |
| 1015 | ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE | ROMREGION_ERASEFF | ROMREGION_INVERT ) | |
| 1056 | 1016 | ROM_LOAD( "b_4c_01a.bin", 0x00000, 0x2000, CRC(b017e1e9) SHA1(39e98f48bff762a674a2506efa39b3619337a1e0) ) /* chars #1 */ |
| 1057 | 1017 | ROM_LOAD( "b_4d_01a.bin", 0x02000, 0x2000, CRC(e3de9d18) SHA1(f55b6f522e127e6239197dd7eb1564e6f275df74) ) |
| 1058 | 1018 | |
| r2844 | r2845 | |
| 1103 | 1063 | /* 0c000-0ffff empty (space for 8l and 8k) */ |
| 1104 | 1064 | |
| 1105 | 1065 | ROM_REGION( 0x0d00, REGION_PROMS, 0 ) |
| 1106 | ROM_LOAD( "chs1b_6e.bpr", 0x0000, 0x0200, CRC(8efd867f) SHA1(d5f2bfe750bb5d472922bdb7e915ee28a3eec9bd) ) /* red component */ | |
| 1107 | ROM_LOAD( "chs1-b.7e", 0x0200, 0x0200, CRC(9e170f64) SHA1(9548bfec2f5b7d222e91562b5459aef8c107b3ec) ) /* red component */ | |
| 1108 | ROM_LOAD( "chs1b_6f.bpr", 0x0400, 0x0200, CRC(279d6cbc) SHA1(aea56970801908b4d51be0c15043c7b315d2637f) ) /* green component */ | |
| 1109 | ROM_LOAD( "chs1-b.8e", 0x0600, 0x0200, CRC(3a2e333b) SHA1(5cf0324cc07ac4af63598c5c6acc61d24215b233) ) /* green component */ | |
| 1110 | ROM_LOAD( "chs1b_7f.bpr", 0x0800, 0x0200, CRC(cad6b7ad) SHA1(62b61d5fa47ca6e2dd15295674dff62e4e69471a) ) /* blue component */ | |
| 1111 | ROM_LOAD( "chs1-b.8f", 0x0a00, 0x0200, CRC(1663eed7) SHA1(90ff876a6b885f8a80c17531cde8b91864f1a6a5) ) /* blue component */ | |
| 1066 | ROM_LOAD( "chs1b_6e.bpr", 0x0000, 0x0200, CRC(8efd867f) SHA1(d5f2bfe750bb5d472922bdb7e915ee28a3eec9bd) ) /* R (top monitor) */ | |
| 1067 | ROM_LOAD( "chs1b_6f.bpr", 0x0200, 0x0200, CRC(279d6cbc) SHA1(aea56970801908b4d51be0c15043c7b315d2637f) ) /* G */ | |
| 1068 | ROM_LOAD( "chs1b_7f.bpr", 0x0400, 0x0200, CRC(cad6b7ad) SHA1(62b61d5fa47ca6e2dd15295674dff62e4e69471a) ) /* B */ | |
| 1069 | ROM_LOAD( "chs1-b.7e", 0x0600, 0x0200, CRC(9e170f64) SHA1(9548bfec2f5b7d222e91562b5459aef8c107b3ec) ) /* R (bottom monitor) */ | |
| 1070 | ROM_LOAD( "chs1-b.8e", 0x0800, 0x0200, CRC(3a2e333b) SHA1(5cf0324cc07ac4af63598c5c6acc61d24215b233) ) /* G */ | |
| 1071 | ROM_LOAD( "chs1-b.8f", 0x0a00, 0x0200, CRC(1663eed7) SHA1(90ff876a6b885f8a80c17531cde8b91864f1a6a5) ) /* B */ | |
| 1112 | 1072 | ROM_LOAD( "chs1-v.2d", 0x0c00, 0x0100, CRC(71dc0d48) SHA1(dd6609f547d74887f520d7e71a1a00317ff181d0) ) /* timing - not used */ |
| 1113 | 1073 | |
| 1114 | 1074 | ROM_REGION( 0x10000, REGION_SOUND1, 0 ) /* 64k for the VLM5030 data */ |
| r2844 | r2845 | |
| 1149 | 1109 | /* 28000-2bfff empty */ |
| 1150 | 1110 | /* 2c000-2ffff empty (4v doesn't exist, it is seen as a 0xff fill) */ |
| 1151 | 1111 | |
| 1152 | ROM_REGION( 0x10000, REGION_GFX4, ROMREGION_DISPOSE | ROMREGION_ERASEFF ) | |
| 1112 | ROM_REGION( 0x10000, REGION_GFX4, ROMREGION_DISPOSE | ROMREGION_ERASEFF | ROMREGION_INVERT ) | |
| 1153 | 1113 | ROM_LOAD( "chv1-v.6p", 0x00000, 0x2000, CRC(d834e142) SHA1(e7d654145b695147b744af2284173f90749fbf0e) ) /* chars #4 */ |
| 1154 | 1114 | /* 02000-03fff empty (space for 16k ROM) */ |
| 1155 | 1115 | /* 04000-07fff empty (space for 6l and 6k) */ |
| r2844 | r2845 | |
| 1158 | 1118 | /* 0c000-0ffff empty (space for 8l and 8k) */ |
| 1159 | 1119 | |
| 1160 | 1120 | ROM_REGION( 0x0e00, REGION_PROMS, 0 ) |
| 1161 | ROM_LOAD( "chpv-b.7b", 0x0000, 0x0200, CRC(df6fdeb3) SHA1(7766d420cb95377104e26d96afddc83b67553c2f) ) /* red component */ | |
| 1162 | ROM_LOAD( "chpv-b.4b", 0x0200, 0x0200, CRC(9d51416e) SHA1(ae933786c5fc19311144b2094305b4253dc8b75b) ) /* red component */ | |
| 1163 | ROM_LOAD( "chpv-b.7c", 0x0400, 0x0200, CRC(b1da5f42) SHA1(55e744da70bbaa855cb1403eef028771a97578a1) ) /* green component */ | |
| 1164 | ROM_LOAD( "chpv-b.4c", 0x0600, 0x0200, CRC(b8a25795) SHA1(8e41baa796fd8f00739a95b2e07066d68193bd76) ) /* green component */ | |
| 1165 | ROM_LOAD( "chpv-b.7d", 0x0800, 0x0200, CRC(4ede813e) SHA1(6603465dae7d869c483d66768fab16f282caaa8b) ) /* blue component */ | |
| 1166 | ROM_LOAD( "chpv-b.4d", 0x0a00, 0x0200, CRC(474fc3b1) SHA1(9cda1d1626285310524d048b60b1cf89e197a26d) ) /* blue component */ | |
| 1121 | ROM_LOAD( "chpv-b.7b", 0x0000, 0x0200, CRC(df6fdeb3) SHA1(7766d420cb95377104e26d96afddc83b67553c2f) ) /* R (top monitor) */ | |
| 1122 | ROM_LOAD( "chpv-b.7c", 0x0200, 0x0200, CRC(b1da5f42) SHA1(55e744da70bbaa855cb1403eef028771a97578a1) ) /* G */ | |
| 1123 | ROM_LOAD( "chpv-b.7d", 0x0400, 0x0200, CRC(4ede813e) SHA1(6603465dae7d869c483d66768fab16f282caaa8b) ) /* B */ | |
| 1124 | ROM_LOAD( "chpv-b.4b", 0x0600, 0x0200, CRC(9d51416e) SHA1(ae933786c5fc19311144b2094305b4253dc8b75b) ) /* R (bottom monitor) */ | |
| 1125 | ROM_LOAD( "chpv-b.4c", 0x0800, 0x0200, CRC(b8a25795) SHA1(8e41baa796fd8f00739a95b2e07066d68193bd76) ) /* G */ | |
| 1126 | ROM_LOAD( "chpv-b.4d", 0x0a00, 0x0200, CRC(474fc3b1) SHA1(9cda1d1626285310524d048b60b1cf89e197a26d) ) /* B */ | |
| 1167 | 1127 | ROM_LOAD( "chv1-b.3c", 0x0c00, 0x0100, CRC(c3f92ea2) SHA1(1a82cca1b9a8d9bd4a1d121d8c131a7d0be554bc) ) /* priority encoder - not used */ |
| 1168 | 1128 | ROM_LOAD( "chpv-v.2d", 0x0d00, 0x0100, CRC(71dc0d48) SHA1(dd6609f547d74887f520d7e71a1a00317ff181d0) ) /* timing - not used */ |
| 1169 | 1129 |
| r2844 | r2845 | |
|---|---|---|
| 312 | 312 | D2 = YRES |
| 313 | 313 | D1-D0 = ADC0-1 |
| 314 | 314 | */ |
| 315 | segaic16_set_display_enable(data & 0x80); | |
| 315 | segaic16_set_display_enable(machine, data & 0x80); | |
| 316 | 316 | if (((old ^ data) & 0x20) && !(data & 0x20)) watchdog_reset_w(machine,0,0); |
| 317 | 317 | cpunum_set_input_line(machine, 3, INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE); |
| 318 | 318 | cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, (data & 0x08) ? ASSERT_LINE : CLEAR_LINE); |
| r2844 | r2845 | |
|---|---|---|
| 343 | 343 | D1: (CONT) - affects sprite hardware |
| 344 | 344 | D0: Sound section reset (1= normal operation, 0= reset) |
| 345 | 345 | */ |
| 346 | segaic16_set_display_enable(data & 0x20); | |
| 346 | segaic16_set_display_enable(machine, data & 0x20); | |
| 347 | 347 | adc_select = (data >> 2) & 7; |
| 348 | 348 | cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE); |
| 349 | 349 | } |
| r2844 | r2845 | |
| 472 | 472 | D5: Screen display |
| 473 | 473 | */ |
| 474 | 474 | adc_select = (data >> 6) & 3; |
| 475 | segaic16_set_display_enable((data >> 5) & 1); | |
| 475 | segaic16_set_display_enable(machine, (data >> 5) & 1); | |
| 476 | 476 | return; |
| 477 | 477 | |
| 478 | 478 | case 0x0020/2: |
| r2844 | r2845 | |
|---|---|---|
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | |
| 68 | VIDEO_START( gticlub ); | |
| 69 | VIDEO_UPDATE( gticlub ); | |
| 70 | ||
| 71 | ||
| 72 | ||
| 73 | 68 | static WRITE32_HANDLER( paletteram32_w ) |
| 74 | 69 | { |
| 75 | 70 | COMBINE_DATA(&paletteram32[offset]); |
| r2844 | r2845 | |
| 278 | 273 | return adc1038_sars; |
| 279 | 274 | } |
| 280 | 275 | |
| 281 | static READ | |
| 276 | static READ8 | |
| 282 | 277 | { |
| 283 | UINT32 r = 0; | |
| 284 | if (offset == 0) | |
| 278 | switch (offset) | |
| 285 | 279 | { |
| 286 | if (ACCESSING_BITS_24_31) | |
| 280 | case 0: | |
| 281 | case 1: | |
| 282 | case 3: | |
| 283 | return input_port_read_indexed(machine, offset); | |
| 284 | ||
| 285 | case 2: | |
| 286 | return adc1038_sars_r(machine) << 7; | |
| 287 | ||
| 288 | case 4: | |
| 287 | 289 | { |
| 288 | r |= input_port_read_indexed(machine, 0) << 24; | |
| 289 | } | |
| 290 | if (ACCESSING_BITS_16_23) | |
| 291 | { | |
| 292 | r |= input_port_read_indexed(machine, 1) << 16; | |
| 293 | } | |
| 294 | if (ACCESSING_BITS_8_15) | |
| 295 | { | |
| 296 | r |= (adc1038_sars_r(machine) << 7) << 8; | |
| 297 | } | |
| 298 | if (ACCESSING_BITS_0_7) | |
| 299 | { | |
| 300 | r |= input_port_read_indexed(machine, 3) << 0; | |
| 301 | } | |
| 302 | return r; | |
| 303 | } | |
| 304 | else if (offset == 1) | |
| 305 | { | |
| 306 | if (ACCESSING_BITS_24_31 ) | |
| 307 | { | |
| 308 | 290 | // 7 0 |
| 309 | 291 | // |?????ae?| |
| 310 | 292 | // |
| r2844 | r2845 | |
| 313 | 295 | |
| 314 | 296 | UINT32 eeprom_bit = (eeprom_read_bit() << 1); |
| 315 | 297 | UINT32 adc_bit = (adc1038_do_r() << 2); |
| 316 | r | |
| 298 | return | |
| 317 | 299 | } |
| 318 | else | |
| 319 | { | |
| 320 | mame_printf_debug("sysreg_r %d, %08X\n", offset, mem_mask); | |
| 321 | } | |
| 322 | return r; | |
| 300 | ||
| 301 | default: | |
| 302 | mame_printf_debug("sysreg_r %d\n", offset); | |
| 303 | break; | |
| 323 | 304 | } |
| 324 | return | |
| 305 | return 0; | |
| 325 | 306 | } |
| 326 | 307 | |
| 327 | static WRITE | |
| 308 | static WRITE8 | |
| 328 | 309 | { |
| 329 | i | |
| 310 | switch (offset | |
| 330 | 311 | { |
| 331 | if( ACCESSING_BITS_24_31 ) | |
| 332 | { | |
| 333 | gticlub_led_reg0 = (data >> 24) & 0xff; | |
| 334 | } | |
| 335 | if( ACCESSING_BITS_16_23 ) | |
| 336 | { | |
| 337 | gticlub_led_reg1 = (data >> 16) & 0xff; | |
| 338 | } | |
| 339 | if( ACCESSING_BITS_0_7 ) | |
| 340 | { | |
| 312 | case 0: | |
| 313 | gticlub_led_reg0 = data; | |
| 314 | break; | |
| 315 | ||
| 316 | case 1: | |
| 317 | gticlub_led_reg1 = data; | |
| 318 | break; | |
| 319 | ||
| 320 | case 3: | |
| 341 | 321 | eeprom_write_bit((data & 0x01) ? 1 : 0); |
| 342 | 322 | eeprom_set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE); |
| 343 | 323 | eeprom_set_cs_line((data & 0x04) ? CLEAR_LINE : ASSERT_LINE); |
| 344 | } | |
| 345 | } | |
| 346 | if( offset == 1 ) | |
| 347 | { | |
| 348 | if (ACCESSING_BITS_24_31) | |
| 349 | { | |
| 350 | if (data & 0x80000000) /* CG Board 1 IRQ Ack */ | |
| 351 | { | |
| 324 | break; | |
| 325 | ||
| 326 | case 4: | |
| 327 | if (data & 0x80) /* CG Board 1 IRQ Ack */ | |
| 352 | 328 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ1, CLEAR_LINE); |
| 353 | } | |
| 354 | if (data & 0x40000000) /* CG Board 0 IRQ Ack */ | |
| 355 | { | |
| 329 | ||
| 330 | if (data & 0x40) /* CG Board 0 IRQ Ack */ | |
| 356 | 331 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, CLEAR_LINE); |
| 357 | } | |
| 358 | 332 | |
| 359 | adc1038_di_w((data >> 24) & 1); | |
| 360 | adc1038_clk_w(machine, (data >> 25) & 1); | |
| 333 | adc1038_di_w((data >> 0) & 1); | |
| 334 | adc1038_clk_w(machine, (data >> 1) & 1); | |
| 361 | 335 | |
| 362 | set_cgboard_id((data >> 28) & 0x3); | |
| 363 | } | |
| 364 | return; | |
| 336 | set_cgboard_id((data >> 4) & 0x3); | |
| 337 | break; | |
| 365 | 338 | } |
| 366 | 339 | } |
| 367 | 340 | |
| r2844 | r2845 | |
| 381 | 354 | return 0; |
| 382 | 355 | } |
| 383 | 356 | |
| 384 | TIMER_CALLBACK( network_irq_ | |
| 357 | TIMER_CALLBACK( network_irq_clear ) | |
| 385 | 358 | { |
| 386 | cpunum_set_input_line( | |
| 359 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ2, CL | |
| 387 | 360 | } |
| 388 | 361 | |
| 389 | 362 | WRITE8_HANDLER( K056230_w ) |
| r2844 | r2845 | |
| 401 | 374 | // Thunder Hurricane breaks otherwise... |
| 402 | 375 | if (mame_stricmp(Machine->gamedrv->name, "thunderh") != 0) |
| 403 | 376 | { |
| 404 | // timer_set(ATTOTIME_IN_MSEC(1), NULL, 0, network_irq_gen); | |
| 405 | // cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ2, ASSERT_LINE); | |
| 377 | cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ2, ASSERT_LINE); | |
| 378 | timer_set(ATTOTIME_IN_USEC(1), NULL, 0, network_irq_clear); | |
| 406 | 379 | } |
| 407 | 380 | } |
| 408 | else | |
| 409 | cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ2, CLEAR_LINE); | |
| 381 | // else | |
| 382 | // cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ2, CLEAR_LINE); | |
| 410 | 383 | break; |
| 411 | 384 | } |
| 412 | 385 | case 2: // Sub ID register |
| r2844 | r2845 | |
| 432 | 405 | |
| 433 | 406 | /******************************************************************/ |
| 434 | 407 | |
| 408 | static MACHINE_START( gticlub ) | |
| 409 | { | |
| 410 | /* set conservative DRC options */ | |
| 411 | cpunum_set_info_int(0, CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS); | |
| 412 | ||
| 413 | /* configure fast RAM regions for DRC */ | |
| 414 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_SELECT, 0); | |
| 415 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_START, 0x00000000); | |
| 416 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_END, 0x000fffff); | |
| 417 | cpunum_set_info_ptr(0, CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram); | |
| 418 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_READONLY, 0); | |
| 419 | } | |
| 420 | ||
| 435 | 421 | static ADDRESS_MAP_START( gticlub_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 436 | AM_RANGE(0x00000000, 0x000fffff) AM_MIRROR(0x80000000) AM_RAM AM_BASE(&work_ram) /* Work RAM */ | |
| 437 | AM_RANGE(0x74000000, 0x740000ff) AM_MIRROR(0x80000000) AM_READWRITE(K001604_reg_r, K001604_reg_w) | |
| 438 | AM_RANGE(0x74010000, 0x7401ffff) AM_MIRROR(0x80000000) AM_RAM_WRITE(paletteram32_w) AM_BASE(&paletteram32) | |
| 439 | AM_RANGE(0x74020000, 0x7403ffff) AM_MIRROR(0x80000000) AM_READWRITE(K001604_tile_r, K001604_tile_w) | |
| 440 | AM_RANGE(0x74040000, 0x7407ffff) AM_MIRROR(0x80000000) AM_READWRITE(K001604_char_r, K001604_char_w) | |
| 441 | AM_RANGE(0x78000000, 0x7800ffff) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc) | |
| 442 | AM_RANGE(0x78040000, 0x7804000f) AM_MIRROR(0x80000000) AM_READWRITE(K001006_0_r, K001006_0_w) | |
| 443 | AM_RANGE(0x78080000, 0x7808000f) AM_MIRROR(0x80000000) AM_READWRITE(K001006_1_r, K001006_1_w) | |
| 444 | AM_RANGE(0x780c0000, 0x780c0003) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc) | |
| 445 | AM_RANGE(0x7e000000, 0x7e003fff) AM_MIRROR(0x80000000) AM_READWRITE(sysreg_r, sysreg_w) | |
| 446 | AM_RANGE(0x7e008000, 0x7e009fff) AM_MIRROR(0x80000000) AM_READWRITE8(K056230_r, K056230_w, 0xffffffff) | |
| 447 | AM_RANGE(0x7e00a000, 0x7e00bfff) AM_MIRROR(0x80000000) AM_READWRITE(lanc_ram_r, lanc_ram_w) | |
| 448 | AM_RANGE(0x7e00c000, 0x7e00c007) AM_MIRROR(0x80000000) AM_WRITE(K056800_host_w) | |
| 449 | AM_RANGE(0x7e00c000, 0x7e00c007) AM_MIRROR(0x80000000) AM_READ(K056800_host_r) // Hang Pilot | |
| 450 | AM_RANGE(0x7e00c008, 0x7e00c00f) AM_MIRROR(0x80000000) AM_READ(K056800_host_r) | |
| 451 | AM_RANGE(0x7f000000, 0x7f3fffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER2, 0) /* Data ROM */ | |
| 452 | AM_RANGE(0x7f800000, 0x7f9fffff) AM_MIRROR(0x80000000) AM_ROM AM_SHARE(2) | |
| 453 | AM_RANGE(0x7fe00000, 0x7fffffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2) /* Program ROM */ | |
| 422 | AM_RANGE(0x00000000, 0x000fffff) AM_RAM AM_BASE(&work_ram) /* Work RAM */ | |
| 423 | AM_RANGE(0x74000000, 0x740000ff) AM_READWRITE(K001604_reg_r, K001604_reg_w) | |
| 424 | AM_RANGE(0x74010000, 0x7401ffff) AM_RAM_WRITE(paletteram32_w) AM_BASE(&paletteram32) | |
| 425 | AM_RANGE(0x74020000, 0x7403ffff) AM_READWRITE(K001604_tile_r, K001604_tile_w) | |
| 426 | AM_RANGE(0x74040000, 0x7407ffff) AM_READWRITE(K001604_char_r, K001604_char_w) | |
| 427 | AM_RANGE(0x78000000, 0x7800ffff) AM_READWRITE(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc) | |
| 428 | AM_RANGE(0x78040000, 0x7804000f) AM_READWRITE(K001006_0_r, K001006_0_w) | |
| 429 | AM_RANGE(0x78080000, 0x7808000f) AM_READWRITE(K001006_1_r, K001006_1_w) | |
| 430 | AM_RANGE(0x780c0000, 0x780c0003) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc) | |
| 431 | AM_RANGE(0x7e000000, 0x7e003fff) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff) | |
| 432 | AM_RANGE(0x7e008000, 0x7e009fff) AM_READWRITE8(K056230_r, K056230_w, 0xffffffff) | |
| 433 | AM_RANGE(0x7e00a000, 0x7e00bfff) AM_READWRITE(lanc_ram_r, lanc_ram_w) | |
| 434 | AM_RANGE(0x7e00c000, 0x7e00c007) AM_WRITE(K056800_host_w) | |
| 435 | AM_RANGE(0x7e00c000, 0x7e00c007) AM_READ(K056800_host_r) // Hang Pilot | |
| 436 | AM_RANGE(0x7e00c008, 0x7e00c00f) AM_READ(K056800_host_r) | |
| 437 | AM_RANGE(0x7f000000, 0x7f3fffff) AM_ROM AM_REGION(REGION_USER2, 0) /* Data ROM */ | |
| 438 | AM_RANGE(0x7f800000, 0x7f9fffff) AM_ROM AM_SHARE(2) | |
| 439 | AM_RANGE(0x7fe00000, 0x7fffffff) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2) /* Program ROM */ | |
| 454 | 440 | ADDRESS_MAP_END |
| 455 | 441 | |
| 456 | 442 | /**********************************************************************/ |
| r2844 | r2845 | |
| 740 | 726 | MDRV_INTERLEAVE(100) |
| 741 | 727 | |
| 742 | 728 | MDRV_NVRAM_HANDLER(gticlub) |
| 729 | MDRV_MACHINE_START(gticlub) | |
| 743 | 730 | MDRV_MACHINE_RESET(gticlub) |
| 744 | 731 | |
| 745 | 732 | /* video hardware */ |
| r2844 | r2845 | |
| 788 | 775 | MDRV_INTERLEAVE(100) |
| 789 | 776 | |
| 790 | 777 | MDRV_NVRAM_HANDLER(gticlub) |
| 778 | MDRV_MACHINE_START(gticlub) | |
| 791 | 779 | MDRV_MACHINE_RESET(hangplt) |
| 792 | 780 | |
| 793 | 781 | /* video hardware */ |
| r2844 | r2845 | |
| 995 | 983 | static DRIVER_INIT(slrasslt) |
| 996 | 984 | { |
| 997 | 985 | DRIVER_INIT_CALL(gticlub); |
| 998 | ||
| 999 | // enable self-modifying code checks | |
| 1000 | cpunum_set_info_int(0, CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_STRICT_VERIFY); | |
| 1001 | 986 | } |
| 1002 | 987 | |
| 1003 | 988 | /*************************************************************************/ |
| r2844 | r2845 | |
|---|---|---|
| 110 | 110 | #include "driver.h" |
| 111 | 111 | #include "deprecat.h" |
| 112 | 112 | #include "sound/pokey.h" |
| 113 | #include "includes/cloak.h" | |
| 113 | 114 | |
| 114 | 115 | static int cloak_nvram_enabled; |
| 115 | 116 | |
| 116 | extern WRITE8_HANDLER( cloak_videoram_w ); | |
| 117 | extern WRITE8_HANDLER( cloak_paletteram_w ); | |
| 118 | extern WRITE8_HANDLER( cloak_clearbmp_w ); | |
| 119 | extern WRITE8_HANDLER( graph_processor_w ); | |
| 120 | extern WRITE8_HANDLER( cloak_flipscreen_w ); | |
| 121 | extern READ8_HANDLER( graph_processor_r ); | |
| 122 | ||
| 123 | extern VIDEO_START( cloak ); | |
| 124 | extern VIDEO_UPDATE( cloak ); | |
| 125 | ||
| 126 | ||
| 127 | 117 | /************************************* |
| 128 | 118 | * |
| 129 | 119 | * Output ports |
| r2844 | r2845 | |
|---|---|---|
| 75 | 75 | ADDRESS_MAP_GLOBAL_MASK(0x3fff) |
| 76 | 76 | AM_RANGE(0x0000, 0x01ff) AM_RAM /* Zero Page RAM */ |
| 77 | 77 | AM_RANGE(0x0800, 0x0800) AM_READ(bsktball_in0_r) |
| 78 | AM_RANGE(0x0802, 0x0802) AM_READ(input_port_5_r) | |
| 79 | AM_RANGE(0x0803, 0x0803) AM_READ(input_port_6_r) | |
| 78 | AM_RANGE(0x0802, 0x0802) AM_READ_PORT("IN1") | |
| 79 | AM_RANGE(0x0803, 0x0803) AM_READ_PORT("DSW") | |
| 80 | 80 | AM_RANGE(0x1000, 0x1000) AM_WRITE(SMH_NOP) /* Timer Reset */ |
| 81 | 81 | AM_RANGE(0x1010, 0x1010) AM_WRITE(bsktball_bounce_w) /* Crowd Amp / Bounce */ |
| 82 | 82 | AM_RANGE(0x1022, 0x1023) AM_WRITE(SMH_NOP) /* Coin Counter */ |
| r2844 | r2845 | |
| 102 | 102 | *************************************/ |
| 103 | 103 | |
| 104 | 104 | static INPUT_PORTS_START( bsktball ) |
| 105 | PORT_START | |
| 105 | PORT_START_TAG("TRACK0_X") | |
| 106 | 106 | PORT_BIT( 0xFF, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) /* Sensitivity, clip, min, max */ |
| 107 | 107 | |
| 108 | PORT_START | |
| 108 | PORT_START_TAG("TRACK0_Y") | |
| 109 | 109 | PORT_BIT( 0xFF, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) |
| 110 | 110 | |
| 111 | PORT_START | |
| 111 | PORT_START_TAG("TRACK1_X") | |
| 112 | 112 | PORT_BIT( 0xFF, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) /* Sensitivity, clip, min, max */ |
| 113 | 113 | |
| 114 | PORT_START | |
| 114 | PORT_START_TAG("TRACK1_Y") | |
| 115 | 115 | PORT_BIT( 0xFF, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) |
| 116 | 116 | |
| 117 | PORT_START | |
| 117 | PORT_START_TAG("IN0") | |
| 118 | 118 | PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 119 | 119 | PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_START2 ) |
| 120 | 120 | PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* SPARE */ |
| r2844 | r2845 | |
| 124 | 124 | /* 0x40 - DR2 = PL1 H DIR */ |
| 125 | 125 | /* 0x80 - DR3 = PL1 V DIR */ |
| 126 | 126 | |
| 127 | PORT_START | |
| 127 | PORT_START_TAG("IN1") | |
| 128 | 128 | PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 129 | 129 | PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_TILT ) |
| 130 | 130 | PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* SPARE */ |
| r2844 | r2845 | |
| 134 | 134 | PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) /* COIN 1 */ |
| 135 | 135 | PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) /* COIN 2 */ |
| 136 | 136 | |
| 137 | PORT_START | |
| 137 | PORT_START_TAG("DSW") | |
| 138 | 138 | PORT_DIPNAME( 0x07, 0x00, "Play Time per Credit" ) |
| 139 | 139 | PORT_DIPSETTING( 0x07, DEF_STR( Free_Play ) ) |
| 140 | 140 | PORT_DIPSETTING( 0x06, "2:30" ) |
| r0 | r2845 | |
|---|---|---|
| 1 | /************************************************************************ | |
| 2 | ||
| 3 | Italian Gambling games based on Mitsubishi (Renesas) M16C MCU family. | |
| 4 | ||
| 5 | Written by Roberto Fresca. | |
| 6 | ||
| 7 | ||
| 8 | All these games use MCUs with internal ROM for their programs. | |
| 9 | ||
| 10 | They have 256KB of internal flash ROM that can't be dumped easily, | |
| 11 | and thus we can't emulate them at the moment because there is | |
| 12 | nothing to emulate. | |
| 13 | ||
| 14 | This driver is just a placeholder for the graphics/sound ROM loading | |
| 15 | ||
| 16 | ||
| 17 | ************************************************************************* | |
| 18 | ||
| 19 | --- Hardware Notes --- | |
| 20 | ||
| 21 | The hardware is normally composed by: | |
| 22 | ||
| 23 | ||
| 24 | CPU: 1x M30624FGAFP. | |
| 25 | (256KB ROM; 20KB RAM) | |
| 26 | ||
| 27 | Sound: 1x OKI M6295. | |
| 28 | 1x TDA2003 (audio amplifier). | |
| 29 | 1x LM358M (audio amplifier). | |
| 30 | ||
| 31 | PLDs: 2x ispLSI1032E-70JL. | |
| 32 | ||
| 33 | Clock: 1x Xtal 16.000 MHz. | |
| 34 | ||
| 35 | ROMs: 1x (up to) 27C4001 or similar (sound). | |
| 36 | 4x 27C4001 or similar (graphics). | |
| 37 | ||
| 38 | ||
| 39 | ************************************************************************/ | |
| 40 | ||
| 41 | #define MAIN_CLOCK XTAL_16MHz | |
| 42 | ||
| 43 | #include "driver.h" | |
| 44 | #include "cpu/h83002/h83002.h" | |
| 45 | #include "sound/okim6295.h" | |
| 46 | ||
| 47 | ||
| 48 | /************************* | |
| 49 | * Video Hardware * | |
| 50 | *************************/ | |
| 51 | ||
| 52 | VIDEO_START( itgambl3 ) | |
| 53 | { | |
| 54 | } | |
| 55 | ||
| 56 | ||
| 57 | VIDEO_UPDATE( itgambl3 ) | |
| 58 | { | |
| 59 | return 0; | |
| 60 | } | |
| 61 | ||
| 62 | ||
| 63 | /************************* | |
| 64 | * Memory map information * | |
| 65 | *************************/ | |
| 66 | ||
| 67 | static ADDRESS_MAP_START( itgambl3_map, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 68 | ADDRESS_MAP_GLOBAL_MASK(0xffffff) | |
| 69 | AM_RANGE(0x000000, 0xffffff) AM_ROM | |
| 70 | ADDRESS_MAP_END | |
| 71 | ||
| 72 | ||
| 73 | /************************* | |
| 74 | * Input ports * | |
| 75 | *************************/ | |
| 76 | ||
| 77 | static INPUT_PORTS_START( itgambl3 ) | |
| 78 | PORT_START | |
| 79 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) | |
| 80 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 81 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 82 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) | |
| 83 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 84 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 85 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) | |
| 86 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 87 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 88 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) | |
| 89 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 90 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 91 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) | |
| 92 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) | |
| 93 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 94 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) | |
| 95 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) | |
| 96 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 97 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) | |
| 98 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 99 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 100 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) | |
| 101 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 102 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 103 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) | |
| 104 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) | |
| 105 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 106 | PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) | |
| 107 | PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) | |
| 108 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 109 | PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) | |
| 110 | PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) | |
| 111 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 112 | PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) | |
| 113 | PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) | |
| 114 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 115 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) | |
| 116 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) | |
| 117 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 118 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) | |
| 119 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) | |
| 120 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 121 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) | |
| 122 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 123 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 124 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) | |
| 125 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 126 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 127 | INPUT_PORTS_END | |
| 128 | ||
| 129 | ||
| 130 | /************************* | |
| 131 | * Graphics Layouts * | |
| 132 | *************************/ | |
| 133 | ||
| 134 | static const gfx_layout gfxlayout_8x8x8 = | |
| 135 | { | |
| 136 | /* this is wrong and need to be fixed */ | |
| 137 | ||
| 138 | 8,8, | |
| 139 | RGN_FRAC(1,1), | |
| 140 | 8, | |
| 141 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 142 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, | |
| 143 | { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64 }, | |
| 144 | 8*64 | |
| 145 | }; | |
| 146 | ||
| 147 | ||
| 148 | /****************************** | |
| 149 | * Graphics Decode Information * | |
| 150 | ******************************/ | |
| 151 | ||
| 152 | static GFXDECODE_START( itgambl3 ) | |
| 153 | GFXDECODE_ENTRY( REGION_GFX1, 0, gfxlayout_8x8x8, 0, 16 ) | |
| 154 | GFXDECODE_END | |
| 155 | ||
| 156 | ||
| 157 | /************************** | |
| 158 | * Machine Reset * | |
| 159 | **************************/ | |
| 160 | ||
| 161 | MACHINE_RESET( itgambl3 ) | |
| 162 | { | |
| 163 | /* stop the CPU, we have no code for it anyway */ | |
| 164 | cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, ASSERT_LINE); | |
| 165 | } | |
| 166 | ||
| 167 | ||
| 168 | /************************** | |
| 169 | * Machine Drivers * | |
| 170 | **************************/ | |
| 171 | ||
| 172 | static MACHINE_DRIVER_START( itgambl3 ) | |
| 173 | ||
| 174 | /* basic machine hardware */ | |
| 175 | MDRV_CPU_ADD_TAG("main", H83044, MAIN_CLOCK) /* wrong CPU, but we have not a M16C core ATM */ | |
| 176 | MDRV_CPU_PROGRAM_MAP(itgambl3_map,0) | |
| 177 | ||
| 178 | /* video hardware */ | |
| 179 | MDRV_SCREEN_ADD("main", RASTER) | |
| 180 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 181 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 182 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 183 | MDRV_SCREEN_SIZE(512, 256) | |
| 184 | MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) | |
| 185 | MDRV_MACHINE_RESET( itgambl3 ) | |
| 186 | ||
| 187 | MDRV_GFXDECODE(itgambl3) | |
| 188 | MDRV_PALETTE_LENGTH(0x200) | |
| 189 | MDRV_VIDEO_START( itgambl3 ) | |
| 190 | MDRV_VIDEO_UPDATE( itgambl3 ) | |
| 191 | ||
| 192 | /* sound hardware */ | |
| 193 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 194 | MDRV_SOUND_ADD_TAG("oki", OKIM6295, MAIN_CLOCK/16) /* 1MHz */ | |
| 195 | MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) | |
| 196 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 197 | MACHINE_DRIVER_END | |
| 198 | ||
| 199 | ||
| 200 | /************************* | |
| 201 | * Rom Load * | |
| 202 | *************************/ | |
| 203 | ||
| 204 | /* Euro Jolly X5 | |
| 205 | ||
| 206 | CPU: | |
| 207 | ||
| 208 | 1x M30624FGAFP-03001A4 (u1)(main) | |
| 209 | ||
| 210 | This one is a Mitsubishi (Renesas) M16/62A 16bit microcomputer. | |
| 211 | It has 256 KB of internal flash ROM + 20 KB of RAM. | |
| 212 | ||
| 213 | 1x OKI M6295 (u22)(sound) | |
| 214 | 1x TDA2003 (u25)(sound) | |
| 215 | 1x LM358M (u23)(sound) | |
| 216 | 1x oscillator 16.000MHz (u20) | |
| 217 | ||
| 218 | ||
| 219 | ROMs: | |
| 220 | ||
| 221 | 4x M27C4001 (u21, u15, u16, u17) | |
| 222 | ||
| 223 | ||
| 224 | PLDs: | |
| 225 | ||
| 226 | 1x ST93C46 (u18) | |
| 227 | (1K 64 x 16 or 128 x 8 serial microwirw EEPROM) | |
| 228 | ||
| 229 | 2x ispLSI1032E-70LJ | |
| 230 | ||
| 231 | ||
| 232 | Note: | |
| 233 | ||
| 234 | 1x JAMMA style edge connector | |
| 235 | 1x RS232 connector (P1) (along with an ST232C controller (u12) | |
| 236 | 1x 6 legs jumper (jp1) | |
| 237 | 1x 8 legs jumper (jp_1) | |
| 238 | 1x 7 legs jumper (jp2) | |
| 239 | 1x 4 legs jumper (jp3) | |
| 240 | 1x red led (d7) | |
| 241 | 1x battery (bt1) | |
| 242 | 2x trimmer (r6,r33) (volume) | |
| 243 | 1x pushbutton (s1) | |
| 244 | ||
| 245 | */ | |
| 246 | ||
| 247 | ROM_START( ejollyx5 ) /* CPU and clock should be changed for this game */ | |
| 248 | ROM_REGION( 0x1000000, REGION_CPU1, 0 ) /* all the program code is in here */ | |
| 249 | ROM_LOAD( "ejollyx5_m30624fgafp.mcu", 0x00000, 0x4000, NO_DUMP ) | |
| 250 | ||
| 251 | ROM_REGION( 0x180000, REGION_GFX1, 0 ) /* different encoded gfx */ | |
| 252 | ROM_LOAD( "eurojolly5-ep01.u15", 0x000000, 0x80000, CRC(feb4ef88) SHA1(5a86e92326096e4e0619a8aa6b491553eb46839d) ) | |
| 253 | ROM_LOAD( "eurojolly5-ep02.u17", 0x080000, 0x80000, CRC(83b2dab0) SHA1(a65cae227a444fe7474f8f821dbb6a8b506e4ae6) ) | |
| 254 | ROM_LOAD( "eurojolly5-ep03.u16", 0x100000, 0x80000, CRC(a0599d3c) SHA1(f52928cd75b4374a45fad37b7a7c1d39ea31b5f2) ) | |
| 255 | ||
| 256 | ROM_REGION( 0x80000, REGION_SOUND1, 0 ) /* M6295 samples, identical halves */ | |
| 257 | ROM_LOAD( "eurojolly5-msg0.u21", 0x00000, 0x80000, CRC(edc157bc) SHA1(8400251ca7a74a4a0f2d443ae2c0254f1de955ac) ) | |
| 258 | ROM_END | |
| 259 | ||
| 260 | ||
| 261 | /* Grand Prix | |
| 262 | ||
| 263 | CPU: | |
| 264 | ||
| 265 | 1x M30624FGAFP-251G108 (u21)(main) | |
| 266 | ||
| 267 | This one is a Mitsubishi (Renesas) M16/62A 16bit microcomputer. | |
| 268 | It has 256 KB of internal flash ROM + 20 KB of RAM. | |
| 269 | ||
| 270 | 1x OKI M6295 (u2)(sound) | |
| 271 | 1x TDA2003 (u1)(sound) | |
| 272 | 1x LM358M (u23)(sound) | |
| 273 | 1x oscillator 16.000MHz (u9) | |
| 274 | ||
| 275 | ||
| 276 | ROMs: | |
| 277 | ||
| 278 | 1x AM27C040 (u3) | |
| 279 | 1x MX29F1610 (u22) | |
| 280 | ||
| 281 | ||
| 282 | PLDs: | |
| 283 | ||
| 284 | 2x ispLSI1032E-70LJ-E011S03 (u10, U11) | |
| 285 | ||
| 286 | ||
| 287 | Note: | |
| 288 | ||
| 289 | 1x JAMMA edge connector (jp9) | |
| 290 | 1x 4 legs connector (jp3) | |
| 291 | 1x 22x2 legs connector (jp5) | |
| 292 | 1x 7x2 legs connector (jp17) | |
| 293 | 1x 9 pins (serial?) connector (jp4) | |
| 294 | ||
| 295 | 1x battery | |
| 296 | 1x trimmer (volume) (rv1) | |
| 297 | 1x red led (d1) | |
| 298 | 1x pushbutton (test mode) (RDP2) | |
| 299 | ||
| 300 | PCB N? KGS0243-DF070283/03 made in Italy | |
| 301 | ||
| 302 | */ | |
| 303 | ||
| 304 | ROM_START( grandprx ) /* CPU and clock should be changed for this game */ | |
| 305 | ROM_REGION( 0x1000000, REGION_CPU1, 0 ) /* all the program code is in here */ | |
| 306 | ROM_LOAD( "grandprx_m30624fgafp.mcu", 0x00000, 0x4000, NO_DUMP ) | |
| 307 | ||
| 308 | ROM_REGION( 0x200000, REGION_GFX1, 0 ) /* different encoded gfx */ | |
| 309 | ROM_LOAD( "u22.bin", 0x000000, 0x200000, CRC(e8ec804f) SHA1(84e647f693e0273b9b09d7726b814516496121a9) ) | |
| 310 | ||
| 311 | ROM_REGION( 0x80000, REGION_SOUND1, 0 ) /* M6295 samples, identical halves */ | |
| 312 | ROM_LOAD( "u3.bin", 0x00000, 0x80000, CRC(c9bb5858) SHA1(c154df7c7dfe394fc1963dc0c73f1d909f5b62ee) ) | |
| 313 | ROM_END | |
| 314 | ||
| 315 | ||
| 316 | /************************* | |
| 317 | * Game Drivers * | |
| 318 | *************************/ | |
| 319 | ||
| 320 | /* YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS */ | |
| 321 | GAME( 200?, ejollyx5, 0, itgambl3, itgambl3, 0, ROT0, "Solar Games", "Euro Jolly X5", GAME_NOT_WORKING ) | |
| 322 | GAME( 200?, grandprx, 0, itgambl3, itgambl3, 0, ROT0, "4fun", "Grand Prix", GAME_NOT_WORKING ) |
| r2844 | r2845 | |
|---|---|---|
| 11 | 11 | #include "machine/6522via.h" |
| 12 | 12 | #include "cpu/m6809/m6809.h" |
| 13 | 13 | #include "sound/dac.h" |
| 14 | #include "includes/beezer.h" | |
| 14 | 15 | |
| 15 | /* from video/beezer.c */ | |
| 16 | INTERRUPT_GEN( beezer_interrupt ); | |
| 17 | VIDEO_UPDATE( beezer ); | |
| 18 | 16 | |
| 19 | /* from machine/beezer.c */ | |
| 20 | DRIVER_INIT( beezer ); | |
| 21 | WRITE8_HANDLER( beezer_bankswitch_w ); | |
| 22 | ||
| 23 | 17 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 24 | 18 | AM_RANGE(0x0000, 0xbfff) AM_READ(SMH_RAM) |
| 25 | 19 | AM_RANGE(0xc000, 0xcfff) AM_READ(SMH_BANK1) |
| r2844 | r2845 | |
| 66 | 60 | PORT_BIT( 0x0f, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_REVERSE |
| 67 | 61 | |
| 68 | 62 | /* Manual says "Dip Switch A" is not used. */ |
| 63 | PORT_START_TAG("DSWA") | |
| 64 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 69 | 65 | |
| 70 | 66 | PORT_START_TAG("DSWB") |
| 71 | 67 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWB:1,2") |
| r2844 | r2845 | |
|---|---|---|
| 78 | 78 | #include "sound/2151intf.h" |
| 79 | 79 | #include "sound/okim6295.h" |
| 80 | 80 | |
| 81 | extern void (*toybox_mcu_run)(running_machine *machine); /* one of the following */ | |
| 82 | void bloodwar_mcu_run(running_machine *machine); | |
| 83 | void bonkadv_mcu_run(running_machine *machine); | |
| 84 | void gtmr_mcu_run(running_machine *machine); | |
| 85 | ||
| 86 | 81 | /*************************************************************************** |
| 87 | 82 | |
| 88 | 83 |
| r2844 | r2845 | |
|---|---|---|
| 372 | 372 | |
| 373 | 373 | static MACHINE_RESET( namcos10 ) |
| 374 | 374 | { |
| 375 | psx_machine_init(); | |
| 375 | psx_machine_init(machine); | |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | static MACHINE_DRIVER_START( namcos10 ) |
| r2844 | r2845 | |
|---|---|---|
| 53 | 53 | switch (offset<<1) |
| 54 | 54 | { |
| 55 | 55 | case 0: /* Dip Switches */ |
| 56 | return (input_port_read | |
| 56 | return (input_port_read | |
| 57 | 57 | |
| 58 | 58 | case 2: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 59 | return (input_port_read | |
| 59 | return (input_port_read | |
| 60 | 60 | |
| 61 | 61 | case 4: /* Credits */ |
| 62 | return input_port_read | |
| 62 | return input_port_read | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | return ~0; |
| r2844 | r2845 | |
| 145 | 145 | /******************************************************************************/ |
| 146 | 146 | |
| 147 | 147 | static INPUT_PORTS_START( darkseal ) |
| 148 | PORT_START /* Player 1 controls */ | |
| 148 | PORT_START_TAG("P1") /* Player 1 controls */ | |
| 149 | 149 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| 150 | 150 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 151 | 151 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| r2844 | r2845 | |
| 155 | 155 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) /* button 3 - unused */ |
| 156 | 156 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 157 | 157 | |
| 158 | PORT_START /* Player 2 controls */ | |
| 158 | PORT_START_TAG("P2") /* Player 2 controls */ | |
| 159 | 159 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) |
| 160 | 160 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| 161 | 161 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| r2844 | r2845 | |
| 165 | 165 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) /* button 3 - unused */ |
| 166 | 166 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 167 | 167 | |
| 168 | PORT_START /* Credits */ | |
| 168 | PORT_START_TAG("IN0") /* Credits */ | |
| 169 | 169 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 170 | 170 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 171 | 171 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) |
| r2844 | r2845 | |
| 175 | 175 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 176 | 176 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 177 | 177 | |
| 178 | PORT_START /* Dip switch bank 1 */ | |
| 178 | PORT_START_TAG("DSW1") /* Dip switch bank 1 */ | |
| 179 | 179 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) |
| 180 | 180 | PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) |
| 181 | 181 | PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) |
| r2844 | r2845 | |
| 201 | 201 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 202 | 202 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 203 | 203 | |
| 204 | PORT_START /* Dip switch bank 2 */ | |
| 204 | PORT_START_TAG("DSW2") /* Dip switch bank 2 */ | |
| 205 | 205 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) |
| 206 | 206 | PORT_DIPSETTING( 0x00, "1" ) |
| 207 | 207 | PORT_DIPSETTING( 0x01, "2" ) |
| r2844 | r2845 | |
|---|---|---|
| 2848 | 2848 | GAME( 1989, tturfbl, tturf, tturfbl, tturf, tturfbl, ROT0, "bootleg", "Tough Turf (bootleg)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 2849 | 2849 | GAME( 1988, wb3bbl, wb3, wb3bbl, wb3b, wb3bbl, ROT0, "bootleg", "Wonder Boy III - Monster Lair (bootleg)", 0 ) |
| 2850 | 2850 | |
| 2851 | DRIVER_INIT( beautyb ) | |
| 2851 | static DRIVER_INIT( beautyb ) | |
| 2852 | 2852 | { |
| 2853 | 2853 | UINT16*rom = (UINT16*)memory_region( REGION_CPU1 ); |
| 2854 | 2854 | int x; |
| r2844 | r2845 | |
|---|---|---|
| 14 | 14 | #include "video/konamiic.h" |
| 15 | 15 | #include "sound/2151intf.h" |
| 16 | 16 | #include "sound/k053260.h" |
| 17 | #include "includes/simpsons.h" | |
| 17 | 18 | |
| 18 | /* from video */ | |
| 19 | VIDEO_START( simpsons ); | |
| 20 | WRITE8_HANDLER( simpsons_priority_w ); | |
| 21 | VIDEO_UPDATE( simpsons ); | |
| 22 | 19 | |
| 23 | /* from machine */ | |
| 24 | READ8_HANDLER( simpsons_eeprom_r ); | |
| 25 | WRITE8_HANDLER( simpsons_eeprom_w ); | |
| 26 | WRITE8_HANDLER( simpsons_coin_counter_w ); | |
| 27 | READ8_HANDLER( simpsons_sound_interrupt_r ); | |
| 28 | READ8_HANDLER( simpsons_sound_r ); | |
| 29 | MACHINE_RESET( simpsons ); | |
| 30 | NVRAM_HANDLER( simpsons ); | |
| 31 | extern int simpsons_firq_enabled; | |
| 32 | ||
| 33 | ||
| 34 | 20 | /*************************************************************************** |
| 35 | 21 | |
| 36 | 22 | Memory Maps |
| r2844 | r2845 | |
|---|---|---|
| 96 | 96 | ** |
| 97 | 97 | ***************************************************************************/ |
| 98 | 98 | |
| 99 | extern WRITE8_HANDLER( snkwave_w ); | |
| 100 | ||
| 101 | 99 | static int sound_cpu_busy; |
| 102 | 100 | |
| 103 | 101 | static const struct namco_interface snkwave_interface = |
| r2844 | r2845 | |
|---|---|---|
| 633 | 633 | #include "cpu/mb86233/mb86233.h" |
| 634 | 634 | #include "sound/multipcm.h" |
| 635 | 635 | #include "sound/2612intf.h" |
| 636 | #include "includes/model1.h" | |
| 636 | 637 | |
| 637 | WRITE16_HANDLER( model1_paletteram_w ); | |
| 638 | VIDEO_START(model1); | |
| 639 | VIDEO_UPDATE(model1); | |
| 640 | VIDEO_EOF(model1); | |
| 641 | extern UINT16 *model1_display_list0, *model1_display_list1; | |
| 642 | extern UINT16 *model1_color_xlat; | |
| 643 | READ16_HANDLER( model1_listctl_r ); | |
| 644 | WRITE16_HANDLER( model1_listctl_w ); | |
| 645 | ||
| 646 | READ16_HANDLER( model1_tgp_copro_r ); | |
| 647 | WRITE16_HANDLER( model1_tgp_copro_w ); | |
| 648 | READ16_HANDLER( model1_tgp_copro_adr_r ); | |
| 649 | WRITE16_HANDLER( model1_tgp_copro_adr_w ); | |
| 650 | READ16_HANDLER( model1_tgp_copro_ram_r ); | |
| 651 | WRITE16_HANDLER( model1_tgp_copro_ram_w ); | |
| 652 | ||
| 653 | /* VR */ | |
| 654 | extern READ16_HANDLER( model1_vr_tgp_r ); | |
| 655 | extern WRITE16_HANDLER( model1_vr_tgp_w ); | |
| 656 | extern READ16_HANDLER( model1_tgp_vr_adr_r ); | |
| 657 | extern WRITE16_HANDLER( model1_tgp_vr_adr_w ); | |
| 658 | extern READ16_HANDLER( model1_vr_tgp_ram_r ); | |
| 659 | extern WRITE16_HANDLER( model1_vr_tgp_ram_w ); | |
| 660 | extern void model1_vr_tgp_reset( void ); | |
| 661 | ADDRESS_MAP_EXTERN( model1_vr_tgp_map, 32 ); | |
| 662 | ||
| 663 | 638 | static int model1_sound_irq; |
| 664 | 639 | |
| 665 | 640 | #define FIFO_SIZE (8) |
| 666 | 641 | static int to_68k[FIFO_SIZE], fifo_wptr, fifo_rptr; |
| 667 | 642 | |
| 668 | void model1_tgp_reset(int swa); | |
| 669 | ||
| 670 | 643 | static READ16_HANDLER( io_r ) |
| 671 | 644 | { |
| 672 | 645 | if(offset < 0x8) |
| r2844 | r2845 | |
| 801 | 774 | |
| 802 | 775 | static WRITE16_HANDLER(md1_w) |
| 803 | 776 | { |
| 804 | extern int model1_dump; | |
| 805 | 777 | COMBINE_DATA(model1_display_list1+offset); |
| 806 | 778 | if(0 && offset) |
| 807 | 779 | return; |
| r2844 | r2845 | |
| 811 | 783 | |
| 812 | 784 | static WRITE16_HANDLER(md0_w) |
| 813 | 785 | { |
| 814 | extern int model1_dump; | |
| 815 | 786 | COMBINE_DATA(model1_display_list0+offset); |
| 816 | 787 | if(0 && offset) |
| 817 | 788 | return; |
| r2844 | r2845 | |
| 1574 | 1545 | MDRV_SOUND_ROUTE(1, "right", 1.0) |
| 1575 | 1546 | MACHINE_DRIVER_END |
| 1576 | 1547 | |
| 1577 | extern struct mb86233_config model1_vr_tgp_config; | |
| 1578 | ||
| 1579 | 1548 | static MACHINE_DRIVER_START( model1_vr ) |
| 1580 | 1549 | MDRV_CPU_ADD(V60, 16000000) |
| 1581 | 1550 | MDRV_CPU_PROGRAM_MAP(model1_vr_mem, 0) |
| r2844 | r2845 | |
|---|---|---|
| 224 | 224 | #define POLEPOS_TOGGLE PORT_TOGGLE |
| 225 | 225 | |
| 226 | 226 | |
| 227 | /* from audio */ | |
| 228 | void *polepos_sh_start(int clock, const struct CustomSound_interface *config); | |
| 229 | void polepos_sh_reset(void *token); | |
| 230 | WRITE8_HANDLER( polepos_engine_sound_lsb_w ); | |
| 231 | WRITE8_HANDLER( polepos_engine_sound_msb_w ); | |
| 232 | ||
| 233 | /* from video */ | |
| 234 | extern UINT16 *polepos_view16_memory; | |
| 235 | extern UINT16 *polepos_road16_memory; | |
| 236 | extern UINT16 *polepos_alpha16_memory; | |
| 237 | extern UINT16 *polepos_sprite16_memory; | |
| 238 | extern int polepos_gear_bit; | |
| 239 | ||
| 240 | VIDEO_START( polepos ); | |
| 241 | PALETTE_INIT( polepos ); | |
| 242 | VIDEO_UPDATE( polepos ); | |
| 243 | ||
| 244 | WRITE16_HANDLER( polepos_view16_w ); | |
| 245 | WRITE16_HANDLER( polepos_road16_w ); | |
| 246 | WRITE16_HANDLER( polepos_alpha16_w ); | |
| 247 | WRITE16_HANDLER( polepos_sprite16_w ); | |
| 248 | WRITE8_HANDLER( polepos_view_w ); | |
| 249 | WRITE8_HANDLER( polepos_road_w ); | |
| 250 | WRITE8_HANDLER( polepos_alpha_w ); | |
| 251 | WRITE8_HANDLER( polepos_sprite_w ); | |
| 252 | WRITE8_HANDLER( polepos_chacl_w ); | |
| 253 | ||
| 254 | READ16_HANDLER( polepos_view16_r ); | |
| 255 | READ16_HANDLER( polepos_road16_r ); | |
| 256 | READ16_HANDLER( polepos_alpha16_r ); | |
| 257 | READ16_HANDLER( polepos_sprite16_r ); | |
| 258 | READ8_HANDLER( polepos_view_r ); | |
| 259 | READ8_HANDLER( polepos_road_r ); | |
| 260 | READ8_HANDLER( polepos_alpha_r ); | |
| 261 | READ8_HANDLER( polepos_sprite_r ); | |
| 262 | WRITE16_HANDLER( polepos_view16_hscroll_w ); | |
| 263 | WRITE16_HANDLER( polepos_road16_vscroll_w ); | |
| 264 | ||
| 265 | ||
| 266 | 227 | /*************************************************************************************/ |
| 267 | 228 | /* Pole Position II protection */ |
| 268 | 229 | /*************************************************************************************/ |
| r2844 | r2845 | |
|---|---|---|
| 13 | 13 | necessarily mean anything. |
| 14 | 14 | |
| 15 | 15 | TODO: |
| 16 | - The high score table colors are wrong, are there proms missing? | |
| 17 | 16 | - Sprite lag |
| 18 | 17 | - Coin counters don't work correctly, because the register is overwritten by |
| 19 | 18 | other routines and the coin counter bits rapidly toggle between 0 and 1. |
| 19 | - running the sound CPU at the nominal clock rate, music stops working at the | |
| 20 | beginning of the game. This is kludged by overclocking the sound CPU. This | |
| 21 | looks like a CPU communication timing issue however fiddling with the | |
| 22 | interleave factor has no effect. | |
| 20 | 23 | |
| 24 | ||
| 25 | Memory Map | |
| 26 | ---------- | |
| 27 | ||
| 28 | MAIN CPU: | |
| 29 | ||
| 30 | Address range 00xxxxxxxxxx---- is handled by the 007343 custom so layout is | |
| 31 | inferred by program behaviour. Note that address lines A8 and A9 are ORed | |
| 32 | together and go to the single A8.9 input of the 007343. | |
| 33 | ||
| 34 | Address Dir Data Description | |
| 35 | ---------------- --- -------- ----------------------- | |
| 36 | 00000000000000xx R/W xxxxxxxx 005885 registers | |
| 37 | 0000000000000100 R/W xxxxxxxx 005885 registers | |
| 38 | 0000000000010000 R xxxxxxxx DIPSW1 | |
| 39 | 0000000000010001 R xxxxxxxx P1 inputs + DIPSW3.4 | |
| 40 | 0000000000010010 R xxxxxxxx P2 inputs | |
| 41 | 0000000000010011 R xxxxxxxx Coin inputs + DIPSW3.1-3 | |
| 42 | 00000000000101-0 R xxxxxxxx P1 extra inputs (only used by the bootleg for the rotary control) | |
| 43 | 00000000000101-1 R xxxxxxxx P2 extra inputs (only used by the bootleg for the rotary control) | |
| 44 | 00000000000110-0 R xxxxxxxx DIPSW2 | |
| 45 | 00000000000111-0 W -------x Coin Counter 1 (to 005924 OUT1 input) | |
| 46 | W ------x- Coin Counter 2 (to 005924 OUT2 input) | |
| 47 | W -----x-- unknown ("END", to connector SVCN4P pin 4) | |
| 48 | W ----x--- sprite RAM bank (to 007343 OBJB input) | |
| 49 | W ---x---- 005885 select (to 007343 GATEB input) | |
| 50 | W --x----- ROM bank | |
| 51 | 00000000000111-1 R/W -------- Watchdog reset (to 005924 AFR input) | |
| 52 | 00000000001xxxxx R/W xxxxxxxx scroll RAM (005885) | |
| 53 | 00000000010xxxxx R/W xxxxxxxx Z RAM (005885) | |
| 54 | 000xxxxxxxxxxxxx R/W xxxxxxxx RAM (shared with sound CPU--note that addresses 0000-005F are handled above so they are excluded) | |
| 55 | 0010xxxxxxxxxxxx R/W xxxxxxxx video RAM (005885) | |
| 56 | 0011xxxxxxxxxxxx R/W xxxxxxxx sprite RAM (005885) | |
| 57 | 01xxxxxxxxxxxxxx R xxxxxxxx ROM (banked) | |
| 58 | 10xxxxxxxxxxxxxx R xxxxxxxx ROM (banked) | |
| 59 | 11xxxxxxxxxxxxxx R xxxxxxxx ROM | |
| 60 | ||
| 61 | ||
| 62 | SOUND CPU: | |
| 63 | ||
| 64 | Address Dir Data Description | |
| 65 | ---------------- --- -------- ----------------------- | |
| 66 | 000------------- n.c. | |
| 67 | 001------------x R/W xxxxxxxx YM2151 | |
| 68 | 010-xxxxxxxxxxxx R/W xxxxxxxx 007327 (palette) | |
| 69 | 011xxxxxxxxxxxxx R/W xxxxxxxx RAM (shared with main CPU) | |
| 70 | 1xxxxxxxxxxxxxxx R xxxxxxxx ROM | |
| 71 | ||
| 21 | 72 | ***************************************************************************/ |
| 22 | 73 | |
| 23 | 74 | #include "driver.h" |
| 24 | 75 | #include "cpu/m6809/m6809.h" |
| 25 | 76 | #include "sound/2151intf.h" |
| 77 | #include "includes/jackal.h" | |
| 26 | 78 | |
| 27 | 79 | |
| 28 | 80 | #define MASTER_CLOCK XTAL_18_432MHz |
| 29 | 81 | #define SOUND_CLOCK XTAL_3_579545MHz |
| 30 | 82 | |
| 31 | 83 | |
| 32 | extern UINT8 *jackal_videoctrl; | |
| 33 | ||
| 34 | extern MACHINE_RESET( jackal ); | |
| 35 | ||
| 36 | extern READ8_HANDLER( jackal_zram_r ); | |
| 37 | extern READ8_HANDLER( jackal_voram_r ); | |
| 38 | extern READ8_HANDLER( jackal_spriteram_r ); | |
| 39 | ||
| 40 | extern WRITE8_HANDLER( jackal_rambank_w ); | |
| 41 | extern WRITE8_HANDLER( jackal_zram_w ); | |
| 42 | extern WRITE8_HANDLER( jackal_voram_w ); | |
| 43 | extern WRITE8_HANDLER( jackal_spriteram_w ); | |
| 44 | ||
| 45 | extern PALETTE_INIT( jackal ); | |
| 46 | extern VIDEO_START( jackal ); | |
| 47 | extern VIDEO_UPDATE( jackal ); | |
| 48 | ||
| 49 | 84 | static int irq_enable; |
| 50 | 85 | |
| 51 | 86 | /* Read/Write Handlers */ |
| r2844 | r2845 | |
| 66 | 101 | static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 67 | 102 | AM_RANGE(0x0000, 0x0003) AM_RAM AM_BASE(&jackal_videoctrl) // scroll + other things |
| 68 | 103 | AM_RANGE(0x0004, 0x0004) AM_WRITE(jackal_flipscreen_w) |
| 69 | AM_RANGE(0x0010, 0x0010) AM_READ(input_port_0_r) | |
| 70 | AM_RANGE(0x0011, 0x0011) AM_READ(input_port_1_r) | |
| 71 | AM_RANGE(0x0012, 0x0012) AM_READ(input_port_2_r) | |
| 72 | AM_RANGE(0x0013, 0x0013) AM_READ(input_port_3_r) | |
| 104 | AM_RANGE(0x0010, 0x0010) AM_READ_PORT("DSW1") | |
| 105 | AM_RANGE(0x0011, 0x0011) AM_READ_PORT("IN1") | |
| 106 | AM_RANGE(0x0012, 0x0012) AM_READ_PORT("IN2") | |
| 107 | AM_RANGE(0x0013, 0x0013) AM_READ_PORT("IN0") | |
| 73 | 108 | AM_RANGE(0x0014, 0x0015) AM_READ(topgunbl_rotary_r) |
| 74 | AM_RANGE(0x0018, 0x0018) AM_READ | |
| 109 | AM_RANGE(0x0018, 0x0018) AM_READ | |
| 75 | 110 | AM_RANGE(0x0019, 0x0019) AM_WRITE(watchdog_reset_w) |
| 76 | 111 | AM_RANGE(0x001c, 0x001c) AM_WRITE(jackal_rambank_w) |
| 77 | 112 | AM_RANGE(0x0020, 0x005f) AM_READWRITE(jackal_zram_r, jackal_zram_w) // MAIN Z RAM,SUB Z RAM |
| r2844 | r2845 | |
| 85 | 120 | static ADDRESS_MAP_START( slave_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 86 | 121 | AM_RANGE(0x2000, 0x2000) AM_WRITE(YM2151_register_port_0_w) |
| 87 | 122 | AM_RANGE(0x2001, 0x2001) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w) |
| 88 | AM_RANGE(0x4000, 0x43ff) AM_RAM_WRITE(SMH_RAM) AM_BASE(&paletteram) // self test only checks 0x4000-0x423f | |
| 123 | AM_RANGE(0x4000, 0x43ff) AM_RAM_WRITE(SMH_RAM) AM_BASE(&paletteram) // self test only checks 0x4000-0x423f, 007327 should actually go up to 4fff | |
| 89 | 124 | AM_RANGE(0x6000, 0x605f) AM_RAM // SOUND RAM (Self test check 0x6000-605f, 0x7c00-0x7fff) |
| 90 | 125 | AM_RANGE(0x6060, 0x7fff) AM_RAM AM_SHARE(1) |
| 91 | 126 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| r2844 | r2845 | |
| 95 | 130 | |
| 96 | 131 | static INPUT_PORTS_START( jackal ) |
| 97 | 132 | PORT_START_TAG("DSW1") |
| 98 | PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) | |
| 133 | PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION( "SW1:1,2,3,4" ) | |
| 99 | 134 | PORT_DIPSETTING( 0x02, DEF_STR( 4C_1C ) ) |
| 100 | 135 | PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) ) |
| 101 | 136 | PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) ) |
| r2844 | r2845 | |
| 112 | 147 | PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) ) |
| 113 | 148 | PORT_DIPSETTING( 0x09, DEF_STR( 1C_7C ) ) |
| 114 | 149 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 115 | PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) | |
| 150 | PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION( "SW1:5,6,7,8" ) | |
| 116 | 151 | PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C ) ) |
| 117 | 152 | PORT_DIPSETTING( 0x50, DEF_STR( 3C_1C ) ) |
| 118 | 153 | PORT_DIPSETTING( 0x80, DEF_STR( 2C_1C ) ) |
| r2844 | r2845 | |
| 129 | 164 | PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) ) |
| 130 | 165 | PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) ) |
| 131 | 166 | |
| 132 | PORT_START_TAG("IN1") | |
| 133 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 134 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 135 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 136 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 137 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Fire") PORT_PLAYER(1) | |
| 138 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Bomb") PORT_PLAYER(1) | |
| 139 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 167 | PORT_START_TAG("DSW2") | |
| 168 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION( "SW2:1,2" ) | |
| 169 | PORT_DIPSETTING( 0x03, "2" ) | |
| 170 | PORT_DIPSETTING( 0x02, "3" ) | |
| 171 | PORT_DIPSETTING( 0x01, "4" ) | |
| 172 | PORT_DIPSETTING( 0x00, "7" ) | |
| 173 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION( "SW2:3" ) | |
| 174 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 175 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 176 | PORT_DIPNAME( 0x18, 0x18, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION( "SW2:4,5" ) | |
| 177 | PORT_DIPSETTING( 0x18, "30K 150K" ) | |
| 178 | PORT_DIPSETTING( 0x10, "50K 200K" ) | |
| 179 | PORT_DIPSETTING( 0x08, "30K" ) | |
| 180 | PORT_DIPSETTING( 0x00, "50K" ) | |
| 181 | PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) ) PORT_DIPLOCATION( "SW2:6,7" ) | |
| 182 | PORT_DIPSETTING( 0x60, DEF_STR( Easy ) ) | |
| 183 | PORT_DIPSETTING( 0x40, DEF_STR( Normal ) ) | |
| 184 | PORT_DIPSETTING( 0x20, "Difficult" ) | |
| 185 | PORT_DIPSETTING( 0x00, "Very Difficult" ) | |
| 186 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION( "SW2:8" ) | |
| 187 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 188 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 140 | 189 | |
| 141 | PORT_START_TAG("IN2") | |
| 142 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 143 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 144 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 145 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 146 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Fire") PORT_PLAYER(2) | |
| 147 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Bomb") PORT_PLAYER(2) | |
| 148 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 149 | ||
| 150 | 190 | PORT_START_TAG("IN0") |
| 151 | 191 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 152 | 192 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 153 | 193 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 154 | 194 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) |
| 155 | 195 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) |
| 156 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) | |
| 196 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION( "SW3:1" ) | |
| 157 | 197 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 158 | 198 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 159 | PORT_DIPNAME( 0x40, 0x00, "Sound Adjustment" ) | |
| 199 | PORT_DIPNAME( 0x40, 0x00, "Sound Adjustment" ) PORT_DIPLOCATION( "SW3:2" ) | |
| 160 | 200 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 161 | 201 | PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) |
| 162 | PORT_DIPNAME( 0x80, 0x00, "Sound Mode" ) | |
| 202 | PORT_DIPNAME( 0x80, 0x00, "Sound Mode" ) PORT_DIPLOCATION( "SW3:3" ) | |
| 163 | 203 | PORT_DIPSETTING( 0x80, DEF_STR( Mono ) ) |
| 164 | 204 | PORT_DIPSETTING( 0x00, DEF_STR( Stereo ) ) |
| 165 | 205 | |
| 166 | PORT_START_TAG("DSW2") | |
| 167 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) | |
| 168 | PORT_DIPSETTING( 0x03, "2" ) | |
| 169 | PORT_DIPSETTING( 0x02, "3" ) | |
| 170 | PORT_DIPSETTING( 0x01, "4" ) | |
| 171 | PORT_DIPSETTING( 0x00, "7" ) | |
| 172 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 173 | PORT_DIPNAME( 0x18, 0x18, DEF_STR( Bonus_Life ) ) | |
| 174 | PORT_DIPSETTING( 0x18, "30K 150K" ) | |
| 175 | PORT_DIPSETTING( 0x10, "50K 200K" ) | |
| 176 | PORT_DIPSETTING( 0x08, "30K" ) | |
| 177 | PORT_DIPSETTING( 0x00, "50K" ) | |
| 178 | PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) ) | |
| 179 | PORT_DIPSETTING( 0x60, DEF_STR( Easy ) ) | |
| 180 | PORT_DIPSETTING( 0x40, DEF_STR( Normal ) ) | |
| 181 | PORT_DIPSETTING( 0x20, "Difficult" ) | |
| 182 | PORT_DIPSETTING( 0x00, "Very Difficult" ) | |
| 183 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 206 | PORT_START_TAG("IN1") | |
| 207 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 208 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 209 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 210 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 211 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Fire") PORT_PLAYER(1) | |
| 212 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Bomb") PORT_PLAYER(1) | |
| 213 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // P1 button 3 | |
| 214 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION( "SW3:4" ) | |
| 184 | 215 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 185 | 216 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 217 | ||
| 218 | PORT_START_TAG("IN2") | |
| 219 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 220 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 221 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 222 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 223 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Fire") PORT_PLAYER(2) | |
| 224 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Bomb") PORT_PLAYER(2) | |
| 225 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // P2 button 3 | |
| 226 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 186 | 227 | INPUT_PORTS_END |
| 187 | 228 | |
| 188 | 229 | static INPUT_PORTS_START( topgunbl ) |
| r2844 | r2845 | |
| 238 | 279 | /* Graphics Decode Information */ |
| 239 | 280 | |
| 240 | 281 | static GFXDECODE_START( jackal ) |
| 241 | GFXDECODE_ENTRY( REGION_GFX1, 0x00000, charlayout, 0, 16 ) // colors 256-511 with lookup | |
| 242 | GFXDECODE_ENTRY( REGION_GFX1, 0x20000, spritelayout, 256*16, 16 ) // colors 0- 15 with lookup | |
| 243 | GFXDECODE_ENTRY( REGION_GFX1, 0x20000, spritelayout8, 256*16, 16 ) // to handle 8x8 sprites | |
| 244 | GFXDECODE_ENTRY( REGION_GFX1, 0x60000, spritelayout, 256*16+16*16, 16 ) // colors 16- 31 with lookup | |
| 245 | GFXDECODE_ENTRY( REGION_GFX1, 0x60000, spritelayout8, 256*16+16*16, 16 ) // to handle 8x8 sprites | |
| 282 | GFXDECODE_ENTRY( REGION_GFX1, 0x00000, charlayout, 0, 1 ) // colors 256-511 without lookup | |
| 283 | GFXDECODE_ENTRY( REGION_GFX1, 0x20000, spritelayout, 0x100, 16 ) // colors 0- 15 with lookup | |
| 284 | GFXDECODE_ENTRY( REGION_GFX1, 0x20000, spritelayout8, 0x100, 16 ) // to handle 8x8 sprites | |
| 285 | GFXDECODE_ENTRY( REGION_GFX1, 0x60000, spritelayout, 0x200, 16 ) // colors 16- 31 with lookup | |
| 286 | GFXDECODE_ENTRY( REGION_GFX1, 0x60000, spritelayout8, 0x200, 16 ) // to handle 8x8 sprites | |
| 246 | 287 | GFXDECODE_END |
| 247 | 288 | |
| 248 | 289 | /* Interrupt Generator */ |
| r2844 | r2845 | |
| 250 | 291 | static INTERRUPT_GEN( jackal_interrupt ) |
| 251 | 292 | { |
| 252 | 293 | if (irq_enable) |
| 294 | { | |
| 253 | 295 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 296 | cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE); | |
| 297 | } | |
| 254 | 298 | } |
| 255 | 299 | |
| 256 | 300 | /* Machine Driver */ |
| r2844 | r2845 | |
| 278 | 322 | MDRV_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 2*8, 30*8-1) |
| 279 | 323 | |
| 280 | 324 | MDRV_GFXDECODE(jackal) |
| 281 | MDRV_PALETTE_LENGTH( | |
| 325 | MDRV_PALETTE_LENGTH(0x300 | |
| 282 | 326 | |
| 283 | 327 | MDRV_PALETTE_INIT(jackal) |
| 284 | 328 | MDRV_VIDEO_START(jackal) |
| r2844 | r2845 | |
| 396 | 440 | |
| 397 | 441 | /* Game Drivers */ |
| 398 | 442 | |
| 399 | GAME( 1986, jackal, 0, jackal, jackal, 0, ROT90, "Konami", "Jackal (World)", GAME_IMPERFECT_COLORS ) | |
| 400 | GAME( 1986, topgunr, jackal, jackal, jackal, 0, ROT90, "Konami", "Top Gunner (US)", GAME_IMPERFECT_COLORS ) | |
| 401 | GAME( 1986, jackalj, jackal, jackal, jackal, 0, ROT90, "Konami", "Tokushu Butai Jackal (Japan)", GAME_IMPERFECT_COLORS ) | |
| 402 | GAME( 1986, topgunbl, jackal, jackal, topgunbl, 0, ROT90, "bootleg", "Top Gunner (bootleg)", GAME_IMPERFECT_COLORS ) | |
| 443 | GAME( 1986, jackal, 0, jackal, jackal, 0, ROT90, "Konami", "Jackal (World)", 0 ) | |
| 444 | GAME( 1986, topgunr, jackal, jackal, jackal, 0, ROT90, "Konami", "Top Gunner (US)", 0 ) | |
| 445 | GAME( 1986, jackalj, jackal, jackal, jackal, 0, ROT90, "Konami", "Tokushu Butai Jackal (Japan)", 0 ) | |
| 446 | GAME( 1986, topgunbl, jackal, jackal, topgunbl, 0, ROT90, "bootleg", "Top Gunner (bootleg)", 0 ) |
| r2844 | r2845 | |
|---|---|---|
| 50 | 50 | #include "deprecat.h" |
| 51 | 51 | #include "cpu/m6502/m6502.h" |
| 52 | 52 | #include "sound/ay8910.h" |
| 53 | #include "includes/btime.h" | |
| 53 | 54 | |
| 54 | ||
| 55 | extern UINT8 *btime_videoram; | |
| 56 | extern size_t btime_videoram_size; | |
| 57 | extern UINT8 *btime_colorram; | |
| 58 | extern UINT8 *lnc_charbank; | |
| 59 | extern UINT8 *bnj_backgroundram; | |
| 60 | extern size_t bnj_backgroundram_size; | |
| 61 | extern UINT8 *zoar_scrollram; | |
| 62 | extern UINT8 *deco_charram; | |
| 63 | ||
| 64 | PALETTE_INIT( btime ); | |
| 65 | PALETTE_INIT( lnc ); | |
| 66 | ||
| 67 | MACHINE_RESET( lnc ); | |
| 68 | ||
| 69 | VIDEO_START( btime ); | |
| 70 | VIDEO_START( bnj ); | |
| 71 | ||
| 72 | ||
| 73 | VIDEO_UPDATE( btime ); | |
| 74 | VIDEO_UPDATE( cookrace ); | |
| 75 | VIDEO_UPDATE( bnj ); | |
| 76 | VIDEO_UPDATE( lnc ); | |
| 77 | VIDEO_UPDATE( zoar ); | |
| 78 | VIDEO_UPDATE( disco ); | |
| 79 | VIDEO_UPDATE( eggs ); | |
| 80 | ||
| 81 | WRITE8_HANDLER( btime_paletteram_w ); | |
| 82 | WRITE8_HANDLER( bnj_background_w ); | |
| 83 | WRITE8_HANDLER( bnj_scroll1_w ); | |
| 84 | WRITE8_HANDLER( bnj_scroll2_w ); | |
| 85 | READ8_HANDLER( btime_mirrorvideoram_r ); | |
| 86 | WRITE8_HANDLER( btime_mirrorvideoram_w ); | |
| 87 | READ8_HANDLER( btime_mirrorcolorram_r ); | |
| 88 | WRITE8_HANDLER( btime_mirrorcolorram_w ); | |
| 89 | WRITE8_HANDLER( lnc_videoram_w ); | |
| 90 | WRITE8_HANDLER( lnc_mirrorvideoram_w ); | |
| 91 | WRITE8_HANDLER( deco_charram_w ); | |
| 92 | ||
| 93 | WRITE8_HANDLER( zoar_video_control_w ); | |
| 94 | WRITE8_HANDLER( btime_video_control_w ); | |
| 95 | WRITE8_HANDLER( bnj_video_control_w ); | |
| 96 | WRITE8_HANDLER( lnc_video_control_w ); | |
| 97 | WRITE8_HANDLER( disco_video_control_w ); | |
| 98 | ||
| 99 | INTERRUPT_GEN( lnc_sound_interrupt ); | |
| 100 | ||
| 101 | 55 | static WRITE8_HANDLER( audio_command_w ); |
| 102 | 56 | |
| 103 | READ8_HANDLER( mmonkey_protection_r ); | |
| 104 | WRITE8_HANDLER( mmonkey_protection_w ); | |
| 105 | ||
| 106 | ||
| 107 | 57 | static UINT8 *decrypted; |
| 108 | 58 | static UINT8 *rambase; |
| 109 | 59 | static UINT8 *audio_rambase; |
| r2844 | r2845 | |
|---|---|---|
| 167 | 167 | return (in << 8) | 0xff; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | READ16_HANDLER( cps1_hack_dsw_r ) | |
| 170 | static READ16_HANDLER( cps1_hack_dsw_r ) | |
| 171 | 171 | { |
| 172 | 172 | static const char *const dswname[] = { "IN0", "DSWA", "DSWB", "DSWC" }; |
| 173 | 173 | int in = input_port_read(machine, dswname[offset]); |
| r2844 | r2845 | |
|---|---|---|
| 19 | 19 | Notes/Tidbits: |
| 20 | 20 | ------------- |
| 21 | 21 | |
| 22 | - Moonwar: 8255 Port C bit 4 was originally designed so when bit4=0, 1P spinner | |
| 23 | is selected, and when bit4=1, 2P spinner gets selected. But they forgot to | |
| 24 | change the 8255 initialization value and Port C was set to input, setting the | |
| 25 | spinner select bit to HI regardless what was written to it. This bug has been | |
| 26 | corrected in the newer set, but, to maintain hardware compatibility with | |
| 27 | older PCB's, they had to reverse to active status of the select bit. So in the | |
| 28 | newer set, Bit4=1 selects the 1P spinner and Bit4=0 selects the 2P spinner. | |
| 29 | ||
| 30 | 22 | - Armored Car sets Port C as well, but it's input only and the games uses other |
| 31 | 23 | bits for the 2nd player controls. Maybe the games was meant to use 2 joysticks |
| 32 | 24 | at one time. |
| 33 | 25 | |
| 34 | - Calipso was apperantly redesigned for two player simultanious play. | |
| 35 | There is code at $298a to flip the screen, but location $8669 has to be | |
| 36 | set to 2. It's set to 1 no matter how many players are playing. | |
| 37 | It's possible that there is a cocktail version of the game. | |
| 38 | ||
| 39 | 26 | - Video Hustler and its two bootlegs all have identical code, the only |
| 40 | 27 | differences are the title, copyright removed, different encryptions or |
| 41 | 28 | no encryption, plus hustlerb has a different memory map. |
| r2844 | r2845 | |
| 601 | 588 | PORT_DIPSETTING( 0x00, "A 1/99 B 1/3" ) |
| 602 | 589 | INPUT_PORTS_END |
| 603 | 590 | |
| 604 | static INPUT_PORTS_START( armorcar ) | |
| 605 | PORT_START_TAG("IN0") | |
| 606 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL | |
| 607 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 608 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 609 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 610 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 611 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 612 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY | |
| 613 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY | |
| 614 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 615 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 616 | 591 | |
| 617 | PORT_START_TAG("IN1") | |
| 618 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) ) | |
| 619 | PORT_DIPSETTING( 0x01, "3" ) | |
| 620 | PORT_DIPSETTING( 0x00, "5" ) | |
| 621 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 622 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 623 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 624 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL | |
| 625 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL | |
| 626 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL | |
| 627 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL | |
| 628 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) | |
| 629 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) | |
| 630 | 592 | |
| 631 | PORT_START_TAG("IN2") | |
| 632 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL | |
| 633 | PORT_DIPNAME( 0x06, 0x02, DEF_STR( Coinage ) ) | |
| 634 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) | |
| 635 | PORT_DIPSETTING( 0x00, "Coin A 1/2 Coin B 2/1" ) | |
| 636 | PORT_DIPSETTING( 0x04, "Coin A 1/3 Coin B 3/1" ) | |
| 637 | PORT_DIPSETTING( 0x06, "Coin A 1/4 Coin B 4/1" ) | |
| 638 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ) ) | |
| 639 | PORT_DIPSETTING( 0x08, DEF_STR( Upright ) ) | |
| 640 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) | |
| 641 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY | |
| 642 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 643 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 644 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 645 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY | |
| 646 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 647 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 648 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 649 | INPUT_PORTS_END | |
| 650 | ||
| 651 | #define MOONWAR_COMMON\ | |
| 652 | PORT_START_TAG("IN0")\ | |
| 653 | PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_SPECIAL ) /* the spinner */\ | |
| 654 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL\ | |
| 655 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )\ | |
| 656 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )\ | |
| 657 | PORT_START_TAG("IN1")\ | |
| 658 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )\ | |
| 659 | PORT_DIPSETTING( 0x00, "3" )\ | |
| 660 | PORT_DIPSETTING( 0x01, "4" )\ | |
| 661 | PORT_DIPSETTING( 0x02, "5" )\ | |
| 662 | PORT_DIPSETTING( 0x03, DEF_STR( Free_Play ) )\ | |
| 663 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )\ | |
| 664 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )\ | |
| 665 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL\ | |
| 666 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )\ | |
| 667 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )\ | |
| 668 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 669 | ||
| 670 | static INPUT_PORTS_START( moonwar ) | |
| 671 | MOONWAR_COMMON | |
| 672 | ||
| 673 | PORT_START_TAG("IN2") | |
| 674 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL | |
| 675 | PORT_DIPNAME( 0x06, 0x02, DEF_STR( Coinage ) ) | |
| 676 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) | |
| 677 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) | |
| 678 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) | |
| 679 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_4C ) ) | |
| 680 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) ) | |
| 681 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 682 | PORT_DIPSETTING( 0x08, DEF_STR( Cocktail ) ) | |
| 683 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) /* output bits */ | |
| 684 | ||
| 685 | PORT_START_TAG("IN3") /* IN3/4 - dummy ports for the dial */ | |
| 686 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_RESET | |
| 687 | ||
| 688 | PORT_START_TAG("IN4") | |
| 689 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_RESET PORT_COCKTAIL | |
| 690 | INPUT_PORTS_END | |
| 691 | ||
| 692 | /* same as above, but coinage is different */ | |
| 693 | static INPUT_PORTS_START( moonwara ) | |
| 694 | MOONWAR_COMMON | |
| 695 | ||
| 696 | PORT_START_TAG("IN2") | |
| 697 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL | |
| 698 | PORT_DIPNAME( 0x06, 0x00, DEF_STR( Coinage ) ) | |
| 699 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) | |
| 700 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) | |
| 701 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) | |
| 702 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_4C ) ) | |
| 703 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) ) | |
| 704 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 705 | PORT_DIPSETTING( 0x08, DEF_STR( Cocktail ) ) | |
| 706 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) /* output bits */ | |
| 707 | ||
| 708 | PORT_START_TAG("IN3") /* IN3/4 - dummy ports for the dial */ | |
| 709 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_RESET | |
| 710 | ||
| 711 | PORT_START_TAG("IN4") /* doesn't actually work due to bug in game code */ | |
| 712 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_RESET PORT_COCKTAIL | |
| 713 | INPUT_PORTS_END | |
| 714 | ||
| 715 | static INPUT_PORTS_START( spdcoin ) | |
| 716 | PORT_START_TAG("IN0") | |
| 717 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 718 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) | |
| 719 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 720 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) | |
| 721 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) | |
| 722 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) | |
| 723 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 724 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 725 | ||
| 726 | PORT_START_TAG("IN1") | |
| 727 | PORT_DIPNAME( 0x01, 0x00, "Freeze" ) /* Dip Sw #2 */ | |
| 728 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 729 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) | |
| 730 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Free_Play ) ) /* Dip Sw #1 */ | |
| 731 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 732 | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) | |
| 733 | PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 734 | ||
| 735 | PORT_START_TAG("IN2") | |
| 736 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 737 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) /* Dip Sw #5 - Check code at 0x0569 */ | |
| 738 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 739 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 740 | PORT_DIPNAME( 0x04, 0x00, DEF_STR( Difficulty ) ) /* Dip Sw #4 */ | |
| 741 | PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) | |
| 742 | PORT_DIPSETTING( 0x04, DEF_STR( Hard ) ) | |
| 743 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) ) /* Dip Sw #3 */ | |
| 744 | PORT_DIPSETTING( 0x08, "3" ) | |
| 745 | PORT_DIPSETTING( 0x00, "5" ) | |
| 746 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 747 | INPUT_PORTS_END | |
| 748 | ||
| 749 | 593 | /* cocktail mode is N/A */ |
| 750 | 594 | static INPUT_PORTS_START( darkplnt ) |
| 751 | 595 | PORT_START_TAG("IN0") |
| r2844 | r2845 | |
| 830 | 674 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 831 | 675 | INPUT_PORTS_END |
| 832 | 676 | |
| 833 | /* cocktail mode is N/A */ | |
| 834 | static INPUT_PORTS_START( calipso ) | |
| 835 | PORT_START_TAG("IN0") | |
| 836 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 837 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 838 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY | |
| 839 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY | |
| 840 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY | |
| 841 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY | |
| 842 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 843 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 844 | 677 | |
| 845 | PORT_START_TAG("IN1") | |
| 846 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) ) | |
| 847 | PORT_DIPSETTING( 0x01, "3" ) | |
| 848 | PORT_DIPSETTING( 0x00, "5" ) | |
| 849 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 850 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 851 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 852 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 853 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 854 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 855 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 856 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 857 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 858 | ||
| 859 | PORT_START_TAG("IN2") | |
| 860 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 861 | PORT_DIPNAME( 0x06, 0x02, DEF_STR( Coinage ) ) | |
| 862 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) | |
| 863 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) | |
| 864 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) | |
| 865 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_4C ) ) | |
| 866 | PORT_DIPNAME( 0x08, 0x08, "Cabinet (Not Supported)" ) | |
| 867 | PORT_DIPSETTING( 0x08, DEF_STR( Upright ) ) | |
| 868 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) | |
| 869 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 870 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 871 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 872 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 873 | INPUT_PORTS_END | |
| 874 | ||
| 875 | 678 | /* cocktail mode not working due to bug in game code */ |
| 876 | 679 | static INPUT_PORTS_START( anteater ) |
| 877 | 680 | PORT_START_TAG("IN0") |
| r2844 | r2845 | |
| 1183 | 986 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1184 | 987 | INPUT_PORTS_END |
| 1185 | 988 | |
| 1186 | /* cocktail mode is N/A */ | |
| 1187 | static INPUT_PORTS_START( superbon ) | |
| 1188 | PORT_START_TAG("IN0") | |
| 1189 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) | |
| 1190 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) | |
| 1191 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY | |
| 1192 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY | |
| 1193 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY | |
| 1194 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY | |
| 1195 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 1196 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 1197 | 989 | |
| 1198 | PORT_START_TAG("IN1") | |
| 1199 | PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) ) | |
| 1200 | PORT_DIPSETTING( 0x01, "3" ) | |
| 1201 | PORT_DIPSETTING( 0x02, "5" ) | |
| 1202 | PORT_DIPSETTING( 0x03, DEF_STR( Free_Play ) ) | |
| 1203 | PORT_DIPSETTING( 0x00, "Invulnerability (Cheat)") | |
| 1204 | PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) | |
| 1205 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 1206 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1207 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 1208 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) | |
| 1209 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 1210 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1211 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) | |
| 1212 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1213 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1214 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 1215 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) | |
| 1216 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1217 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1218 | ||
| 1219 | PORT_START_TAG("DSW") | |
| 1220 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) | |
| 1221 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1222 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1223 | PORT_DIPNAME( 0x06, 0x02, DEF_STR( Coinage ) ) | |
| 1224 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) | |
| 1225 | PORT_DIPSETTING( 0x00, "A 1/2 B 2/1" ) | |
| 1226 | PORT_DIPSETTING( 0x04, "A 1/3 B 3/1" ) | |
| 1227 | PORT_DIPSETTING( 0x06, "A 1/4 B 4/1" ) | |
| 1228 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) | |
| 1229 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 1230 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1231 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) | |
| 1232 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 1233 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1234 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) | |
| 1235 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1236 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1237 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) | |
| 1238 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1239 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1240 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) | |
| 1241 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1242 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1243 | INPUT_PORTS_END | |
| 1244 | ||
| 1245 | 990 | static INPUT_PORTS_START( hustler ) |
| 1246 | 991 | PORT_START_TAG("IN0") |
| 1247 | 992 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL |
| r2844 | r2845 | |
| 1411 | 1156 | MACHINE_DRIVER_END |
| 1412 | 1157 | |
| 1413 | 1158 | |
| 1414 | static MACHINE_DRIVER_START( superbon ) | |
| 1415 | /* basic machine hardware */ | |
| 1416 | MDRV_IMPORT_FROM(type1) | |
| 1417 | 1159 | |
| 1418 | /* device config overrides */ | |
| 1419 | MDRV_DEVICE_MODIFY( "ppi8255_0", PPI8255 ) | |
| 1420 | MDRV_DEVICE_CONFIG( scramble_ppi8255_intf[0] ) | |
| 1421 | ||
| 1422 | MDRV_DEVICE_MODIFY( "ppi8255_1", PPI8255 ) | |
| 1423 | MDRV_DEVICE_CONFIG( scramble_ppi8255_intf[1] ) | |
| 1424 | MACHINE_DRIVER_END | |
| 1425 | ||
| 1426 | /* same as regular type 1, the only difference that it has long bullets */ | |
| 1427 | static MACHINE_DRIVER_START( armorcar ) | |
| 1428 | ||
| 1429 | /* basic machine hardware */ | |
| 1430 | MDRV_IMPORT_FROM(type1) | |
| 1431 | ||
| 1432 | /* video hardware */ | |
| 1433 | MDRV_PALETTE_LENGTH(32+64+2) /* 32 for characters, 64 for stars, 2 for bullets */ | |
| 1434 | ||
| 1435 | MDRV_PALETTE_INIT(galaxold) | |
| 1436 | MDRV_VIDEO_START(theend) | |
| 1437 | MACHINE_DRIVER_END | |
| 1438 | ||
| 1439 | ||
| 1440 | /* same as regular type 1, the only difference is that the bullets are less yellow */ | |
| 1441 | static MACHINE_DRIVER_START( moonwar ) | |
| 1442 | ||
| 1443 | /* basic machine hardware */ | |
| 1444 | MDRV_IMPORT_FROM(type1) | |
| 1445 | ||
| 1446 | /* device config overrides */ | |
| 1447 | MDRV_DEVICE_MODIFY( "ppi8255_0", PPI8255 ) | |
| 1448 | MDRV_DEVICE_CONFIG( moonwar_ppi8255_intf[0] ) | |
| 1449 | ||
| 1450 | MDRV_DEVICE_MODIFY( "ppi8255_1", PPI8255 ) | |
| 1451 | MDRV_DEVICE_CONFIG( moonwar_ppi8255_intf[1] ) | |
| 1452 | ||
| 1453 | /* video hardware */ | |
| 1454 | MDRV_PALETTE_LENGTH(32+64+2+1) /* 32 for characters, 64 for stars, 2 for bullets, 1 for bg */ | |
| 1455 | ||
| 1456 | MDRV_PALETTE_INIT(moonwar) | |
| 1457 | MACHINE_DRIVER_END | |
| 1458 | ||
| 1459 | ||
| 1460 | 1160 | /* Rescue, Minefield and Strategy X have extra colors, and custom video initialise */ |
| 1461 | 1161 | /* routines to set up the graduated color backgound they use */ |
| 1462 | 1162 | static MACHINE_DRIVER_START( rescue ) |
| r2844 | r2845 | |
| 1489 | 1189 | MACHINE_DRIVER_END |
| 1490 | 1190 | |
| 1491 | 1191 | |
| 1492 | /* same as the others, but no sprite flipping, but instead the bits are used | |
| 1493 | as extra sprite code bits, giving 256 sprite images */ | |
| 1494 | static MACHINE_DRIVER_START( calipso ) | |
| 1495 | ||
| 1496 | /* basic machine hardware */ | |
| 1497 | MDRV_IMPORT_FROM(type1) | |
| 1498 | ||
| 1499 | /* video hardware */ | |
| 1500 | MDRV_VIDEO_START(calipso) | |
| 1501 | MACHINE_DRIVER_END | |
| 1502 | ||
| 1503 | ||
| 1504 | 1192 | static MACHINE_DRIVER_START( mimonkey ) |
| 1505 | 1193 | |
| 1506 | 1194 | /* basic machine hardware */ |
| r2844 | r2845 | |
| 1780 | 1468 | ROM_LOAD( "strategy.10k", 0x0000, 0x0020, CRC(d95c0318) SHA1(83e5355fdca7b4e1fb5a0e6eeaacfbf9561e2c36) ) |
| 1781 | 1469 | ROM_END |
| 1782 | 1470 | |
| 1783 | ROM_START( armorcar ) | |
| 1784 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1785 | ROM_LOAD( "cpu.2c", 0x0000, 0x1000, CRC(0d7bfdfb) SHA1(47791d4fc298c25d29584dfcddcd92618e3750c5) ) | |
| 1786 | ROM_LOAD( "cpu.2e", 0x1000, 0x1000, CRC(76463213) SHA1(86dbbed25325cc8855c1eb39bbb11b0473b7f4b5) ) | |
| 1787 | ROM_LOAD( "cpu.2f", 0x2000, 0x1000, CRC(2cc6d5f0) SHA1(94abb33760aed206f0f90f035fe2977c1f2e26cf) ) | |
| 1788 | ROM_LOAD( "cpu.2h", 0x3000, 0x1000, CRC(61278dbb) SHA1(e12cd6c499af75f77e549499093fe6d2e8eddb1d) ) | |
| 1789 | ROM_LOAD( "cpu.2j", 0x4000, 0x1000, CRC(fb158d8c) SHA1(efa70e92c56678d4a404a96c72cfee317b15648c) ) | |
| 1790 | 1471 | |
| 1791 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) | |
| 1792 | ROM_LOAD( "sound.5c", 0x0000, 0x0800, CRC(54ee7753) SHA1(3ebfa2cadf33acb4d24aa50cfa4713355cc780a3) ) | |
| 1793 | ROM_LOAD( "sound.5d", 0x0800, 0x0800, CRC(5218fec0) SHA1(c8f84f1e6aafc544e5acf48b245e8b1edb63211e) ) | |
| 1794 | ||
| 1795 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1796 | ROM_LOAD( "cpu.5f", 0x0000, 0x0800, CRC(8a3da4d1) SHA1(4d2ef48aeb9099fdd145e11e2485e0bf8d87290d) ) | |
| 1797 | ROM_LOAD( "cpu.5h", 0x0800, 0x0800, CRC(85bdb113) SHA1(f62da0ea0c29feb10d8d1ce8de28fd750a53b40a) ) | |
| 1798 | ||
| 1799 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 1800 | ROM_LOAD( "82s123.6e", 0x0000, 0x0020, CRC(9b87f90d) SHA1(d11ac5e4a6057301ea2a9cbb404c2b978eb4c1dc) ) | |
| 1801 | ROM_END | |
| 1802 | ||
| 1803 | ROM_START( armorca2 ) | |
| 1804 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1805 | ROM_LOAD( "2c", 0x0000, 0x1000, CRC(e393bd2f) SHA1(6a5079d1f5d724e5f643cbc5352fc43d0b652e05) ) | |
| 1806 | ROM_LOAD( "2e", 0x1000, 0x1000, CRC(b7d443af) SHA1(1ce41e11a7fcfd039fbff03c4382ae29b601ed50) ) | |
| 1807 | ROM_LOAD( "2g", 0x2000, 0x1000, CRC(e67380a4) SHA1(a9a87e769d1ef223ae26241e9211c97b3d469656) ) | |
| 1808 | ROM_LOAD( "2h", 0x3000, 0x1000, CRC(72af7b37) SHA1(c9cd0a0a3e34fc7b12822f75eb511f0850703f55) ) | |
| 1809 | ROM_LOAD( "2j", 0x4000, 0x1000, CRC(e6b0dd7f) SHA1(98292fea03bff028ba924a49f0bfa49377018860) ) | |
| 1810 | ||
| 1811 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) | |
| 1812 | ROM_LOAD( "sound.5c", 0x0000, 0x0800, CRC(54ee7753) SHA1(3ebfa2cadf33acb4d24aa50cfa4713355cc780a3) ) | |
| 1813 | ROM_LOAD( "sound.5d", 0x0800, 0x0800, CRC(5218fec0) SHA1(c8f84f1e6aafc544e5acf48b245e8b1edb63211e) ) | |
| 1814 | ||
| 1815 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1816 | ROM_LOAD( "cpu.5f", 0x0000, 0x0800, CRC(8a3da4d1) SHA1(4d2ef48aeb9099fdd145e11e2485e0bf8d87290d) ) | |
| 1817 | ROM_LOAD( "cpu.5h", 0x0800, 0x0800, CRC(85bdb113) SHA1(f62da0ea0c29feb10d8d1ce8de28fd750a53b40a) ) | |
| 1818 | ||
| 1819 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 1820 | ROM_LOAD( "82s123.6e", 0x0000, 0x0020, CRC(9b87f90d) SHA1(d11ac5e4a6057301ea2a9cbb404c2b978eb4c1dc) ) | |
| 1821 | ROM_END | |
| 1822 | ||
| 1823 | ROM_START( moonwar ) | |
| 1824 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1825 | ROM_LOAD( "mw2.2c", 0x0000, 0x1000, CRC(7c11b4d9) SHA1(a27bdff6ce728647ec811df843ac235c32c293d6) ) | |
| 1826 | ROM_LOAD( "mw2.2e", 0x1000, 0x1000, CRC(1b6362be) SHA1(2fbd95869146adcc0c8be1df653251fda8849e8e) ) | |
| 1827 | ROM_LOAD( "mw2.2f", 0x2000, 0x1000, CRC(4fd8ba4b) SHA1(3da784267a96d05f66b00626a22cb3f06211d202) ) | |
| 1828 | ROM_LOAD( "mw2.2h", 0x3000, 0x1000, CRC(56879f0d) SHA1(d1e9932863aebc5761e71fca8d24f3c400e1250d) ) | |
| 1829 | ||
| 1830 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) | |
| 1831 | ROM_LOAD( "mw2.5c", 0x0000, 0x0800, CRC(c26231eb) SHA1(5b19edfaefe1a535059311d067ea53405879d627) ) | |
| 1832 | ROM_LOAD( "mw2.5d", 0x0800, 0x0800, CRC(bb48a646) SHA1(cf51202d16b03bbed12ff24501be68683f28c992) ) | |
| 1833 | ||
| 1834 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1835 | ROM_LOAD( "mw2.5f", 0x0000, 0x0800, CRC(c5fa1aa0) SHA1(6c6b5b2ce5de278ff436d3e7252ece5b086cc41d) ) | |
| 1836 | ROM_LOAD( "mw2.5h", 0x0800, 0x0800, CRC(a6ccc652) SHA1(286b3dc1f3a7da3ac66664e774b441ef075745f1) ) | |
| 1837 | ||
| 1838 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 1839 | ROM_LOAD( "mw2.clr", 0x0000, 0x0020, CRC(99614c6c) SHA1(f068985f3c5e0cd88551a02c32f9baeabfd50241) ) | |
| 1840 | ROM_END | |
| 1841 | ||
| 1842 | ROM_START( moonwara ) | |
| 1843 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1844 | ROM_LOAD( "2c", 0x0000, 0x1000, CRC(bc20b734) SHA1(c6fe550987d0052979aad43c67aa1b9248049669) ) | |
| 1845 | ROM_LOAD( "2e", 0x1000, 0x1000, CRC(db6ffec2) SHA1(0fcd55b1e415e2e7041d10778052a235251f85fe) ) | |
| 1846 | ROM_LOAD( "2f", 0x2000, 0x1000, CRC(378931b8) SHA1(663f1eea9b0e8dc38de818df66c5211dac41c33b) ) | |
| 1847 | ROM_LOAD( "2h", 0x3000, 0x1000, CRC(031dbc2c) SHA1(5f2ca8b8763398bf161ee0c2c748a12d36cb40ec) ) | |
| 1848 | ||
| 1849 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) | |
| 1850 | ROM_LOAD( "mw2.5c", 0x0000, 0x0800, CRC(c26231eb) SHA1(5b19edfaefe1a535059311d067ea53405879d627) ) | |
| 1851 | ROM_LOAD( "mw2.5d", 0x0800, 0x0800, CRC(bb48a646) SHA1(cf51202d16b03bbed12ff24501be68683f28c992) ) | |
| 1852 | ||
| 1853 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1854 | ROM_LOAD( "mw2.5f", 0x0000, 0x0800, CRC(c5fa1aa0) SHA1(6c6b5b2ce5de278ff436d3e7252ece5b086cc41d) ) | |
| 1855 | ROM_LOAD( "mw2.5h", 0x0800, 0x0800, CRC(a6ccc652) SHA1(286b3dc1f3a7da3ac66664e774b441ef075745f1) ) | |
| 1856 | ||
| 1857 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 1858 | ROM_LOAD( "moonwara.clr", 0x0000, 0x0020, CRC(f58d4f58) SHA1(12a80d1edf3c80dafa0e1e3622d2a03224b62f14) ) /* olive, instead of white */ | |
| 1859 | ROM_END | |
| 1860 | ||
| 1861 | ROM_START( spdcoin ) | |
| 1862 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1863 | ROM_LOAD( "spdcoin.2c", 0x0000, 0x1000, CRC(65cf1e49) SHA1(a4570f0d7868fcdd378de3fd9e5346780afcf427) ) | |
| 1864 | ROM_LOAD( "spdcoin.2e", 0x1000, 0x1000, CRC(1ee59232) SHA1(b58c1de69d33cf80432012b9b6d8b1e3d8b00662) ) | |
| 1865 | ||
| 1866 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) | |
| 1867 | ROM_LOAD( "spdcoin.5c", 0x0000, 0x0800, CRC(b4cf64b7) SHA1(a95d94be2e374b78b4ba49b6931f0c214ff9d033) ) | |
| 1868 | ROM_LOAD( "spdcoin.5d", 0x0800, 0x0800, CRC(92304df0) SHA1(01471bf7cbea0090933a253b1b46f80c8f240df5) ) | |
| 1869 | ||
| 1870 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1871 | ROM_LOAD( "spdcoin.5f", 0x0000, 0x0800, CRC(dd5f1dbc) SHA1(e7c40972a7530cac19ce04de3272244959d337ab) ) | |
| 1872 | ROM_LOAD( "spdcoin.5h", 0x0800, 0x0800, CRC(ab1fe81b) SHA1(98057932cb5faad60d425b547590ab22bfc67ff6) ) | |
| 1873 | ||
| 1874 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 1875 | ROM_LOAD( "spdcoin.clr", 0x0000, 0x0020, CRC(1a2ccc56) SHA1(58bedaa8b3e21e916295603b38529084b6c0099a) ) | |
| 1876 | ROM_END | |
| 1877 | ||
| 1878 | 1472 | ROM_START( darkplnt ) |
| 1879 | 1473 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1880 | 1474 | ROM_LOAD( "drkplt2c.dat", 0x0000, 0x1000, CRC(5a0ca559) SHA1(cf77bda30bb08633d274c22734a8f186520ddf7d) ) |
| r2844 | r2845 | |
| 1937 | 1531 | ROM_LOAD( "colr6f.cpu", 0x0000, 0x0020, CRC(fce333c7) SHA1(f63a214dc47c5e7c80db000b0b6a261ca8da6629) ) |
| 1938 | 1532 | ROM_END |
| 1939 | 1533 | |
| 1940 | ROM_START( calipso ) | |
| 1941 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1942 | ROM_LOAD( "calipso.2c", 0x0000, 0x1000, CRC(0fcb703c) SHA1(2bb096f114911973afdf3088c860c9566df06f60) ) | |
| 1943 | ROM_LOAD( "calipso.2e", 0x1000, 0x1000, CRC(c6622f14) SHA1(475164aed703a97275ff285ecaec9d8fd4fe723b) ) | |
| 1944 | ROM_LOAD( "calipso.2f", 0x2000, 0x1000, CRC(7bacbaba) SHA1(d321d6d09c689123eb1e5d758d95ccecec225252) ) | |
| 1945 | ROM_LOAD( "calipso.2h", 0x3000, 0x1000, CRC(a3a8111b) SHA1(3d9500c676563ebfc27aebb07716e6a966f00c35) ) | |
| 1946 | ROM_LOAD( "calipso.2j", 0x4000, 0x1000, CRC(fcbd7b9e) SHA1(5cc1edcc8b9867bb7849c8d97d1096bb6464f562) ) | |
| 1947 | ROM_LOAD( "calipso.2l", 0x5000, 0x1000, CRC(f7630cab) SHA1(482ee91cccd8a7c5768a1d6a9772d797769fe2dc) ) | |
| 1948 | ||
| 1949 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for sound code */ | |
| 1950 | ROM_LOAD( "calipso.5c", 0x0000, 0x0800, CRC(9cbc65ab) SHA1(b4ce04d18f9536c0ddd2f9c15edda75570e750e5) ) | |
| 1951 | ROM_LOAD( "calipso.5d", 0x0800, 0x0800, CRC(a225ee3b) SHA1(dba111f89851c69fb6fce16219cb2b0cb3294c15) ) | |
| 1952 | ||
| 1953 | ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1954 | ROM_LOAD( "calipso.5f", 0x0000, 0x2000, CRC(fd4252e9) SHA1(881b988cdc9b7913f577573f8a15af7a7c7cc67f) ) | |
| 1955 | ROM_LOAD( "calipso.5h", 0x2000, 0x2000, CRC(1663a73a) SHA1(95b6ed25b656afdfb70fac35efa2e005185e4343) ) | |
| 1956 | ||
| 1957 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 1958 | ROM_LOAD( "calipso.clr", 0x0000, 0x0020, CRC(01165832) SHA1(bfef0459492dbd5febf3030916b6438eb6be71de) ) | |
| 1959 | ROM_END | |
| 1960 | ||
| 1961 | 1534 | ROM_START( anteater ) |
| 1962 | 1535 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1963 | 1536 | ROM_LOAD( "ra1-2c", 0x0000, 0x1000, CRC(58bc9393) SHA1(7122782a69ef0d2196ec16833f229b6286802668) ) |
| r2844 | r2845 | |
| 2124 | 1697 | ROM_LOAD( "ltprom", 0x0000, 0x0020, CRC(1108b816) SHA1(49fdb08f8f31fefa2f3dca3d3455318cb21847a3) ) |
| 2125 | 1698 | ROM_END |
| 2126 | 1699 | |
| 2127 | ROM_START( superbon ) | |
| 2128 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 2129 | ROM_LOAD( "2d.cpu", 0x0000, 0x1000, CRC(60c0ba18) SHA1(6ad09e01dd3c86c8d9c465916227c9b00f38e025) ) | |
| 2130 | ROM_LOAD( "2e.cpu", 0x1000, 0x1000, CRC(ddcf44bf) SHA1(b862622f4aa8af6da568b4f82ef043359ece530f) ) | |
| 2131 | ROM_LOAD( "2f.cpu", 0x2000, 0x1000, CRC(bb66c2d5) SHA1(cbb7f4279ae48460790cb8abf976b978ae6a1a25) ) | |
| 2132 | ROM_LOAD( "2h.cpu", 0x3000, 0x1000, CRC(74f4f04d) SHA1(d51c5d2c21453ee0dab60253c3124b6112d1f859) ) | |
| 2133 | ROM_LOAD( "2j.cpu", 0x4000, 0x1000, CRC(78effb08) SHA1(64f211b34c2f37c25a36200b393f145b39ae67b5) ) | |
| 2134 | ROM_LOAD( "2l.cpu", 0x5000, 0x1000, CRC(e9dcecbd) SHA1(ec61cec2b66c041872a2ca29cf724a89c73fc9a3) ) | |
| 2135 | ROM_LOAD( "2m.cpu", 0x6000, 0x1000, CRC(3ed0337e) SHA1(975b93aee851867e335614419aa6db16fbf8063f) ) | |
| 2136 | ||
| 2137 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) | |
| 2138 | ROM_LOAD( "5c", 0x0000, 0x0800, CRC(b899be2a) SHA1(9b343a682531255104db61177a43ad933c3af34e) ) | |
| 2139 | ROM_LOAD( "5d.snd", 0x0800, 0x0800, CRC(80640a04) SHA1(83f2bafcfa5737441194d3058a76b2582317cfcb) ) | |
| 2140 | ||
| 2141 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 2142 | ROM_LOAD( "5f.cpu", 0x0000, 0x0800, CRC(5b9d4686) SHA1(c7814aefaccab9c8a3a0b015447d366cd2e43c3a) ) | |
| 2143 | ROM_LOAD( "5h.cpu", 0x0800, 0x0800, CRC(58c29927) SHA1(b88515d9c3108d2ad59f30fed5d74877b1636280) ) | |
| 2144 | ||
| 2145 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 2146 | ROM_LOAD( "superbon.clr", 0x0000, 0x0020, NO_DUMP ) | |
| 2147 | ROM_END | |
| 2148 | ||
| 2149 | 1700 | ROM_START( hustler ) |
| 2150 | 1701 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 2151 | 1702 | ROM_LOAD( "hustler.1", 0x0000, 0x1000, CRC(94479a3e) SHA1(ea3a1a3f6bee3d35a6a0fb0ba689a25f6b919e5d) ) |
| r2844 | r2845 | |
| 2255 | 1806 | |
| 2256 | 1807 | GAME( 1981, stratgyx, 0, stratgyx, stratgyx, stratgyx, ROT0, "Konami", "Strategy X", GAME_SUPPORTS_SAVE ) |
| 2257 | 1808 | GAME( 1981, stratgys, stratgyx, stratgyx, stratgyx, stratgyx, ROT0, "[Konami] (Stern license)", "Strategy X (Stern)", GAME_SUPPORTS_SAVE ) |
| 2258 | GAME( 1981, moonwar, 0, moonwar, moonwar, moonwar, ROT90, "Stern", "Moonwar", GAME_SUPPORTS_SAVE ) | |
| 2259 | GAME( 1981, moonwara, moonwar, moonwar, moonwara, moonwar, ROT90, "Stern", "Moonwar (older)", GAME_SUPPORTS_SAVE ) | |
| 2260 | GAME( 1984, spdcoin, 0, type1, spdcoin, scramble_ppi, ROT90, "Stern", "Speed Coin (prototype)", GAME_SUPPORTS_SAVE ) | |
| 2261 | 1809 | GAME( 1982, darkplnt, 0, darkplnt, darkplnt, darkplnt, ROT180, "Stern", "Dark Planet", GAME_SUPPORTS_SAVE ) |
| 2262 | 1810 | GAME( 1982, tazmani2, tazmania, type2, tazmania, tazmani2, ROT90, "Stern", "Tazz-Mania (set 2)", GAME_SUPPORTS_SAVE ) |
| 2263 | GAME( 1982, calipso, 0, calipso, calipso, scobra, ROT90, "[Stern] (Tago license)", "Calipso", GAME_SUPPORTS_SAVE ) | |
| 2264 | 1811 | GAME( 1983, anteatg, anteater, anteatg, anteatg, scramble_ppi, ROT90, "TV-Tuning (F.E.G. license)", "Ameisenbaer (German)", GAME_SUPPORTS_SAVE ) |
| 2265 | 1812 | GAME( 1983, anteatgb, anteater, anteatgb, anteatgb, scramble_ppi, ROT90, "Free Enterprise Games", "The Anteater (UK)", GAME_SUPPORTS_SAVE ) |
| 2266 | 1813 | GAME( 1982, rescue, 0, rescue, rescue, rescue, ROT90, "Stern", "Rescue", GAME_SUPPORTS_SAVE ) |
| 2267 | 1814 | GAME( 1982, aponow, rescue, rescue, rescue, rescue, ROT90, "bootleg", "Apocaljpse Now", GAME_SUPPORTS_SAVE ) |
| 2268 | 1815 | GAME( 1983, minefld, 0, minefld, minefld, minefld, ROT90, "Stern", "Minefield", GAME_SUPPORTS_SAVE ) |
| 2269 | GAME( 198?, superbon, 0, type1, superbon, superbon, ROT90, "bootleg", "Super Bond", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) | |
| 2270 | 1816 | GAME( 1981, hustler, 0, hustler, hustler, hustler, ROT90, "Konami", "Video Hustler", GAME_SUPPORTS_SAVE ) |
| 2271 | 1817 | GAME( 1981, billiard, hustler, hustler, hustler, billiard, ROT90, "bootleg", "The Billiards", GAME_SUPPORTS_SAVE ) |
| 2272 | 1818 | GAME( 1981, hustlerb, hustler, hustlerb, hustler, scramble_ppi, ROT90, "bootleg", "Video Hustler (bootleg)", GAME_SUPPORTS_SAVE ) |
| r2844 | r2845 | |
|---|---|---|
| 867 | 867 | static MACHINE_RESET( namcos11 ) |
| 868 | 868 | { |
| 869 | 869 | memset( namcos11_keycus, 0, namcos11_keycus_size ); |
| 870 | psx_machine_init(); | |
| 870 | psx_machine_init(machine); | |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | NAMCO_C7X_HARDWARE |
| r2844 | r2845 | |
|---|---|---|
| 145 | 145 | bit 5 of IN1 is tested if "Cabinet" Dip Switch is set to "Cocktail". |
| 146 | 146 | |
| 147 | 147 | |
| 148 | Notes about 'calipso' : | |
| 149 | --------------------- | |
| 150 | ||
| 151 | Calipso was apperantly redesigned for two player simultanious play. | |
| 152 | There is code at $298a to flip the screen, but location $8669 has to be | |
| 153 | set to 2. It's set to 1 no matter how many players are playing. | |
| 154 | It's possible that there is a cocktail version of the game. | |
| 155 | ||
| 156 | ||
| 157 | Notes about 'moonwar' : | |
| 158 | --------------------- | |
| 159 | ||
| 160 | Moonwar: 8255 Port C bit 4 was originally designed so when bit4=0, 1P spinner | |
| 161 | is selected, and when bit4=1, 2P spinner gets selected. But they forgot to | |
| 162 | change the 8255 initialization value and Port C was set to input, setting the | |
| 163 | spinner select bit to HI regardless what was written to it. This bug has been | |
| 164 | corrected in the newer set, but, to maintain hardware compatibility with | |
| 165 | older PCB's, they had to reverse to active status of the select bit. So in the | |
| 166 | newer set, Bit4=1 selects the 1P spinner and Bit4=0 selects the 2P spinner. | |
| 167 | ||
| 168 | ||
| 169 | ||
| 148 | 170 | TO DO : |
| 149 | 171 | ------- |
| 150 | 172 | |
| r2844 | r2845 | |
| 197 | 219 | static UINT8 konami_sound_control; |
| 198 | 220 | static UINT8 sfx_sample_control; |
| 199 | 221 | |
| 222 | static UINT8 moonwar_port_select; | |
| 223 | ||
| 200 | 224 | static UINT8 irq_enabled; |
| 201 | 225 | static int irq_line; |
| 202 | 226 | |
| r2844 | r2845 | |
| 1084 | 1108 | } |
| 1085 | 1109 | |
| 1086 | 1110 | |
| 1111 | /************************************* | |
| 1112 | * | |
| 1113 | * Moon War I/O | |
| 1114 | * | |
| 1115 | *************************************/ | |
| 1087 | 1116 | |
| 1117 | static WRITE8_HANDLER( moonwar_port_select_w ) | |
| 1118 | { | |
| 1119 | moonwar_port_select = data & 0x10; | |
| 1120 | } | |
| 1121 | ||
| 1122 | ||
| 1123 | static READ8_HANDLER( moonwar_input_port_0_r ) | |
| 1124 | { | |
| 1125 | UINT8 sign; | |
| 1126 | UINT8 delta; | |
| 1127 | ||
| 1128 | delta = (moonwar_port_select ? input_port_read(machine, "IN3") : input_port_read(machine, "IN4")); | |
| 1129 | ||
| 1130 | sign = (delta & 0x80) >> 3; | |
| 1131 | delta &= 0x0f; | |
| 1132 | ||
| 1133 | return ((input_port_read(machine, "IN0") & 0xe0) | delta | sign ); | |
| 1134 | } | |
| 1135 | ||
| 1136 | ||
| 1137 | static const ppi8255_interface moonwar_ppi8255_intf[2] = | |
| 1138 | { | |
| 1139 | { | |
| 1140 | moonwar_input_port_0_r, /* Port A read */ | |
| 1141 | konami_portb_0_r, /* Port B read */ | |
| 1142 | konami_portc_0_r, /* Port C read */ | |
| 1143 | NULL, /* Port A write */ | |
| 1144 | NULL, /* Port B write */ | |
| 1145 | moonwar_port_select_w /* Port C write */ | |
| 1146 | }, | |
| 1147 | { | |
| 1148 | NULL, /* Port A read */ | |
| 1149 | NULL, /* Port B read */ | |
| 1150 | konami_portc_1_r, /* Port C read */ | |
| 1151 | soundlatch_w, /* Port A write */ | |
| 1152 | konami_sound_control_w, /* Port B write */ | |
| 1153 | konami_portc_1_w /* Port C write */ | |
| 1154 | } | |
| 1155 | }; | |
| 1156 | ||
| 1088 | 1157 | /************************************* |
| 1089 | 1158 | * |
| 1090 | 1159 | * Memory maps |
| r2844 | r2845 | |
| 1517 | 1586 | * |
| 1518 | 1587 | *************************************/ |
| 1519 | 1588 | |
| 1520 | GFXDECODE_START(galaxian) | |
| 1589 | static GFXDECODE_START(galaxian) | |
| 1521 | 1590 | GFXDECODE_SCALE(REGION_GFX1, 0x0000, galaxian_charlayout, 0, 8, GALAXIAN_XSCALE,1) |
| 1522 | 1591 | GFXDECODE_SCALE(REGION_GFX1, 0x0000, galaxian_spritelayout, 0, 8, GALAXIAN_XSCALE,1) |
| 1523 | 1592 | GFXDECODE_END |
| 1524 | 1593 | |
| 1525 | GFXDECODE_START(gmgalax) | |
| 1594 | static GFXDECODE_START(gmgalax) | |
| 1526 | 1595 | GFXDECODE_SCALE(REGION_GFX1, 0x0000, galaxian_charlayout, 0, 16, GALAXIAN_XSCALE,1) |
| 1527 | 1596 | GFXDECODE_SCALE(REGION_GFX1, 0x0000, galaxian_spritelayout, 0, 16, GALAXIAN_XSCALE,1) |
| 1528 | 1597 | GFXDECODE_END |
| 1529 | 1598 | |
| 1530 | 1599 | /* separate character and sprite ROMs */ |
| 1531 | GFXDECODE_START(pacmanbl) | |
| 1600 | static GFXDECODE_START(pacmanbl) | |
| 1532 | 1601 | GFXDECODE_SCALE(REGION_GFX1, 0x0000, galaxian_charlayout, 0, 8, GALAXIAN_XSCALE,1) |
| 1533 | 1602 | GFXDECODE_SCALE(REGION_GFX2, 0x0000, galaxian_spritelayout, 0, 8, GALAXIAN_XSCALE,1) |
| 1534 | 1603 | GFXDECODE_END |
| r2844 | r2845 | |
| 2074 | 2143 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.1) |
| 2075 | 2144 | MACHINE_DRIVER_END |
| 2076 | 2145 | |
| 2146 | static MACHINE_DRIVER_START( moonwar ) | |
| 2077 | 2147 | |
| 2148 | /* basic machine hardware */ | |
| 2149 | /* same as regular type 1, the only difference is that the bullets are less yellow */ | |
| 2150 | MDRV_IMPORT_FROM(scobra) | |
| 2078 | 2151 | |
| 2152 | /* device config overrides */ | |
| 2153 | MDRV_DEVICE_MODIFY( "ppi8255_0", PPI8255 ) | |
| 2154 | MDRV_DEVICE_CONFIG( moonwar_ppi8255_intf[0] ) | |
| 2155 | ||
| 2156 | MDRV_DEVICE_MODIFY( "ppi8255_1", PPI8255 ) | |
| 2157 | MDRV_DEVICE_CONFIG( moonwar_ppi8255_intf[1] ) | |
| 2158 | ||
| 2159 | MDRV_PALETTE_INIT(moonwar) | |
| 2160 | MACHINE_DRIVER_END | |
| 2161 | ||
| 2162 | ||
| 2079 | 2163 | /************************************* |
| 2080 | 2164 | * |
| 2081 | 2165 | * Decryption helpers |
| r2844 | r2845 | |
| 2246 | 2330 | } |
| 2247 | 2331 | |
| 2248 | 2332 | |
| 2333 | static void decode_superbon(void) | |
| 2334 | { | |
| 2335 | offs_t i; | |
| 2336 | UINT8 *RAM; | |
| 2249 | 2337 | |
| 2338 | /* Deryption worked out by hand by Chris Hardy. */ | |
| 2339 | ||
| 2340 | RAM = memory_region(REGION_CPU1); | |
| 2341 | ||
| 2342 | for (i = 0;i < 0x1000;i++) | |
| 2343 | { | |
| 2344 | /* Code is encrypted depending on bit 7 and 9 of the address */ | |
| 2345 | switch (i & 0x0280) | |
| 2346 | { | |
| 2347 | case 0x0000: | |
| 2348 | RAM[i] ^= 0x92; | |
| 2349 | break; | |
| 2350 | case 0x0080: | |
| 2351 | RAM[i] ^= 0x82; | |
| 2352 | break; | |
| 2353 | case 0x0200: | |
| 2354 | RAM[i] ^= 0x12; | |
| 2355 | break; | |
| 2356 | case 0x0280: | |
| 2357 | RAM[i] ^= 0x10; | |
| 2358 | break; | |
| 2359 | } | |
| 2360 | } | |
| 2361 | } | |
| 2362 | ||
| 2363 | ||
| 2250 | 2364 | /************************************* |
| 2251 | 2365 | * |
| 2252 | 2366 | * Driver configuration |
| r2844 | r2845 | |
| 2790 | 2904 | } |
| 2791 | 2905 | |
| 2792 | 2906 | |
| 2907 | static DRIVER_INIT( superbon ) | |
| 2908 | { | |
| 2909 | ||
| 2910 | /* video extensions */ | |
| 2911 | common_init(machine, scramble_draw_bullet, scramble_draw_background, NULL, NULL); | |
| 2912 | ||
| 2913 | /* decode code */ | |
| 2914 | decode_superbon(); | |
| 2915 | } | |
| 2916 | ||
| 2917 | ||
| 2918 | static DRIVER_INIT( calipso ) | |
| 2919 | { | |
| 2920 | ||
| 2921 | /* video extensions */ | |
| 2922 | common_init(machine, scramble_draw_bullet, scramble_draw_background, NULL, calipso_extend_sprite_info); | |
| 2923 | ||
| 2924 | } | |
| 2925 | ||
| 2926 | ||
| 2927 | static DRIVER_INIT( moonwar ) | |
| 2928 | { | |
| 2929 | /* video extensions */ | |
| 2930 | common_init(machine, scramble_draw_bullet, scramble_draw_background, NULL, NULL); | |
| 2931 | ||
| 2932 | state_save_register_global(moonwar_port_select); | |
| 2933 | } | |
| 2934 | ||
| 2935 | ||
| 2936 | ||
| 2793 | 2937 | #include "galdrvr.c" |
| r2844 | r2845 | |
|---|---|---|
| 260 | 260 | |
| 261 | 261 | static READ16_HANDLER( control_3_r ) |
| 262 | 262 | { |
| 263 | /* gun_select seems to assume only values 5,6,7... is this correct? */ | |
| 263 | 264 | return input_port_read_indexed(machine, gun_select); |
| 264 | 265 | } |
| 265 | 266 | |
| r2844 | r2845 | |
| 289 | 290 | |
| 290 | 291 | static READ16_HANDLER( mechatt_gun_r ) |
| 291 | 292 | { |
| 292 | int baseport=2,x,y; | |
| 293 | if (offset) baseport=4; /* Player 2 */ | |
| 293 | int baseport=0,x,y; | |
| 294 | static const char *port[] = { "IN2", "IN3", "IN4", "IN5" }; | |
| 294 | 295 | |
| 295 | x=input_port_read_indexed(machine, baseport); | |
| 296 | y=input_port_read_indexed(machine, baseport+1); | |
| 296 | if (offset) baseport=2; /* Player 2 */ | |
| 297 | 297 | |
| 298 | x=input_port_read(machine, port[baseport]); | |
| 299 | y=input_port_read(machine, port[baseport+1]); | |
| 300 | ||
| 298 | 301 | /* Todo - does the hardware really clamp like this? */ |
| 299 | 302 | x+=0x18; |
| 300 | 303 | if (x>0xff) x=0xff; |
| r2844 | r2845 | |
|---|---|---|
| 181 | 181 | //UINT16 *gs_videoram3; |
| 182 | 182 | static UINT16 *gs_mixer_regs; |
| 183 | 183 | |
| 184 | /* in video */ | |
| 185 | VIDEO_UPDATE( gstriker ); | |
| 186 | VIDEO_START( gstriker ); | |
| 187 | VIDEO_START( twrldc94 ); | |
| 188 | 184 | |
| 189 | ||
| 190 | 185 | /*** MISC READ / WRITE HANDLERS **********************************************/ |
| 191 | 186 | |
| 192 | 187 | static READ16_HANDLER(dmmy_8f) |
| r2844 | r2845 | |
|---|---|---|
| 19 | 19 | #include "sound/ay8910.h" |
| 20 | 20 | #include "sound/msm5232.h" |
| 21 | 21 | #include "sound/dac.h" |
| 22 | #include "includes/flstory.h" | |
| 22 | 23 | |
| 23 | VIDEO_START( flstory ); | |
| 24 | VIDEO_UPDATE( flstory ); | |
| 25 | VIDEO_START( victnine ); | |
| 26 | VIDEO_UPDATE( victnine ); | |
| 27 | ||
| 28 | extern UINT8 *flstory_scrlram; | |
| 29 | ||
| 30 | WRITE8_HANDLER( flstory_videoram_w ); | |
| 31 | READ8_HANDLER( flstory_palette_r ); | |
| 32 | WRITE8_HANDLER( flstory_palette_w ); | |
| 33 | WRITE8_HANDLER( flstory_gfxctrl_w ); | |
| 34 | READ8_HANDLER( flstory_scrlram_r ); | |
| 35 | WRITE8_HANDLER( flstory_scrlram_w ); | |
| 36 | READ8_HANDLER( victnine_gfxctrl_r ); | |
| 37 | WRITE8_HANDLER( victnine_gfxctrl_w ); | |
| 38 | ||
| 39 | READ8_HANDLER( flstory_68705_portA_r ); | |
| 40 | WRITE8_HANDLER( flstory_68705_portA_w ); | |
| 41 | READ8_HANDLER( flstory_68705_portB_r ); | |
| 42 | WRITE8_HANDLER( flstory_68705_portB_w ); | |
| 43 | READ8_HANDLER( flstory_68705_portC_r ); | |
| 44 | WRITE8_HANDLER( flstory_68705_portC_w ); | |
| 45 | WRITE8_HANDLER( flstory_68705_ddrA_w ); | |
| 46 | WRITE8_HANDLER( flstory_68705_ddrB_w ); | |
| 47 | WRITE8_HANDLER( flstory_68705_ddrC_w ); | |
| 48 | WRITE8_HANDLER( flstory_mcu_w ); | |
| 49 | READ8_HANDLER( flstory_mcu_r ); | |
| 50 | READ8_HANDLER( flstory_mcu_status_r ); | |
| 51 | WRITE8_HANDLER( onna34ro_mcu_w ); | |
| 52 | READ8_HANDLER( onna34ro_mcu_r ); | |
| 53 | READ8_HANDLER( onna34ro_mcu_status_r ); | |
| 54 | WRITE8_HANDLER( victnine_mcu_w ); | |
| 55 | READ8_HANDLER( victnine_mcu_r ); | |
| 56 | READ8_HANDLER( victnine_mcu_status_r ); | |
| 57 | ||
| 58 | 24 | UINT8 *onna34ro_workram; |
| 59 | 25 | UINT8 *victnine_workram; |
| 60 | 26 |
| r2844 | r2845 | |
|---|---|---|
| 39 | 39 | DSW = 3 banks (903/904) |
| 40 | 40 | DSW = 1 bank (905) |
| 41 | 41 | |
| 42 | Inputs use 6 lines from 6520 PIA's port, and multiplexed x4 | |
| 42 | Inputs use 6 lines from 6520 PIA's port, and each one is multiplexed x4 | |
| 43 | 43 | |
| 44 | 44 | Some games like Keno and Big Game, also have a key encoder peripheral processor |
| 45 | 45 | based on a 8035, and 1x ROM 2516/2532. |
| 46 | 46 | |
| 47 | Systems 903/904 PCBs have 3 pots to control R, G, and B independently. | |
| 48 | However, it seems to be only related to the background color. | |
| 47 | 49 | |
| 48 | 50 | |
| 49 | 51 | *********************************************************************************** |
| r2844 | r2845 | |
| 92 | 94 | 18.4 | Double Draw-Lebanon | ? | | PKCG | 6300010 | POKCLR | 6600020 | Amusement | No | | No |
| 93 | 95 | 18.5 | Pixels | 905 | AUG/83 | PXCG | 6300070 | PIXCLR | 6600050 | Amusement | Yes | OK | Yes |
| 94 | 96 | 18.6 | Pixels | 905 | AUG/83 | PXCG | 6300070 | PIXCLR | 6600050 | Amusement | Yes | OK | Yes |
| 95 | 18.7 | Amusement Poker (skill) | 905 | AUG/83 | JKRTWO | 6300100 | MULTCLR | 6600070 | Amusement | | |
| 97 | 18.7 | Amusement Poker (skill) | 905 | AUG/83 | JKRTWO | 6300100 | MULTCLR | 6600070 | Amusement | Yes | |
| 96 | 98 | 18.8 | Poker-Lebanon | ? | | PKCG | 6300010 | POKCLR | 6600020 | Amusement | No | | No |
| 97 | 99 | 18.9 | Pixels (french) | ? | | PIXCG | 6300070 | PIXCLR | 6600050 | Amusement | No | | No |
| 98 | 100 | 19.0 | Hi-Score Poker | ? | | JKRTWO | 6300100 | WLDCLR | 6600070 | Amusement | No | | No |
| r2844 | r2845 | |
| 217 | 219 | mentioned game. It was created by Cal Omega in 1981 for Casino Electronics Inc. |
| 218 | 220 | Cal Omega was bought out by CEI (Casino Electronics Inc.), and CEI was bought by UCMC. |
| 219 | 221 | |
| 220 | This | |
| 222 | This is the most famous game | |
| 221 | 223 | |
| 222 | The game use the same GFX set that Jack Potten's | |
| 224 | The game uses the same GFX set that Jack Potten's Poker for cards and has | |
| 223 | 225 | layout, but the game is different and the old discrete pitched sounds were replaced |
| 224 | with a better set of sounds through a AY8910/12 implementation. The empty socket in | |
| 225 | the pcb is maybe for future upgrades instead of sound ROM, since sounds are hardcoded. | |
| 226 | with a better set of sounds through a AY8912 implementation. The empty socket in | |
| 227 | the PCB is for future upgrades instead of sound ROM, since sounds are hardcoded. | |
| 226 | 228 | |
| 227 | 229 | Inputs are multiplexed and selected through PIA1, portB. |
| 228 | 230 | |
| 229 | In game, use "Stand" instead of "Deal/Draw" to conserve all cards without discards. | |
| 230 | To enter to TEST MODE press F2. Press "Discard 1" + "Discard 2" + "Discard 3" to exit. | |
| 231 | To enter the STATS MODE press "Show Stats". Press "Deal/Draw" to exit. | |
| 232 | To pass coin and hopper errors press "Hopper SW". Also keep it pressed to see the status. | |
| 233 | For payout, press "Manual Collect" an then "Payout" for each credit (manual mode). | |
| 234 | 231 | |
| 232 | Some instructions.... | |
| 235 | 233 | |
| 234 | - Some versions have a STAND button to conserve all cards without discards. | |
| 235 | ||
| 236 | - To enter to the Input Test Mode press TEST MODE (key 9) and then SERVICE (key 8). | |
| 237 | Press DISCARD1 (key Z) + DISCARD2 (key X) + DISCARD3 (key C) to exit. | |
| 238 | ||
| 239 | - To see the last hand played, press SHOW LAST HAND (key 0) and then SERVICE (key 8). | |
| 240 | Press DEAL/DRAW button to exit. | |
| 241 | ||
| 242 | - Depending of the game version, TEST MODE & SHOW LAST HAND buttons could work directly. | |
| 243 | ||
| 244 | - To pass coin and hopper errors press SERVICE (key 8). Also keep it pressed to see the status. | |
| 245 | ||
| 246 | - For payout, press MANUAL COLLECT an then PAYOUT for each credit (manual mode). | |
| 247 | ||
| 248 | ||
| 249 | ||
| 236 | 250 | El Grande - 5 Card Draw: |
| 237 | 251 | |
| 238 | 252 | This game was created by Tuni Electro Service and was licenced to E.T. Marketing,Inc. |
| r2844 | r2845 | |
| 247 | 261 | |
| 248 | 262 | There aren't meter and stats modes. Only for amusement, so... no payout. |
| 249 | 263 | To clear credits press F2. |
| 250 | To enter to TEST MODE press F2 twice. Press | |
| 264 | To enter to TEST MODE press F2 twice. Press | |
| 251 | 265 | |
| 252 | 266 | |
| 253 | 267 | |
| r2844 | r2845 | |
| 263 | 277 | $0841 - $0841 AY-8912 ; Write. |
| 264 | 278 | $0880 - $0880 CRTC6845 ; MC6845 adressing. |
| 265 | 279 | $0881 - $0881 CRTC6845 ; MC6845 Read/Write. |
| 266 | $08C4 - $08C7 PIA0 ; I/O Ports 0 | |
| 280 | $08C4 - $08C7 PIA0 ; I/O Ports 0 | |
| 267 | 281 | $08C8 - $08CB PIA1 ; I/O Port 4. |
| 268 | 282 | |
| 269 | 283 | $1000 - $13FF VideoRAM |
| r2844 | r2845 | |
| 277 | 291 | $0000 - $07FF NVRAM ; All registers and settings. |
| 278 | 292 | $1080 - $1080 CRTC6845 ; MC6845 adressing. |
| 279 | 293 | $1081 - $1081 CRTC6845 ; MC6845 Read/Write. |
| 280 | $10C4 - $10C7 PIA0 ; I/O Ports 0 | |
| 294 | $10C4 - $10C7 PIA0 ; I/O Ports 0 | |
| 281 | 295 | $10C8 - $10CB PIA1 ; I/O Port 4, AY-8912. |
| 282 | 296 | |
| 283 | 297 | $2000 - $23FF VideoRAM |
| r2844 | r2845 | |
| 371 | 385 | ------- |
| 372 | 386 | |
| 373 | 387 | |
| 388 | [2008-06-11] | |
| 389 | ||
| 390 | - Improved the input system for some games. | |
| 391 | - Fixed some wrong color codes. | |
| 392 | - Updated technical notes. | |
| 393 | ||
| 394 | ||
| 395 | [2008-06-09] | |
| 396 | ||
| 397 | - Cleaned up the driver following the MAME Coding Conventions. | |
| 398 | - Added support to Game 18.7 (Amusement Poker). | |
| 399 | - Updated technical notes. | |
| 400 | ||
| 401 | ||
| 374 | 402 | [2008-02-26] |
| 375 | 403 | |
| 376 | 404 | - Renamed the driver to calomega.c. |
| r2844 | r2845 | |
| 539 | 567 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Deal/Draw") PORT_CODE(KEYCODE_2) |
| 540 | 568 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Cancel Discards") PORT_CODE(KEYCODE_N) |
| 541 | 569 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_NAME("Stand") PORT_CODE(KEYCODE_E) |
| 542 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 543 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 570 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 571 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 544 | 572 | |
| 545 | 573 | PORT_START_TAG("IN0-1") |
| 546 | 574 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Payout") PORT_CODE(KEYCODE_Q) |
| 547 | 575 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 548 | 576 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service") PORT_CODE(KEYCODE_8) |
| 549 | // PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 3") PORT_CODE(KEYCODE_F) | |
| 550 | // PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 4") PORT_CODE(KEYCODE_G) | |
| 551 | // PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 5") PORT_CODE(KEYCODE_H) | |
| 552 | PORT_BIT( 0x08/*0x0c*/, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Mode") PORT_CODE(KEYCODE_F2) /* should be splitted? */ | |
| 553 | PORT_BIT( 0x10/*0x14*/, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper SW") PORT_CODE(KEYCODE_9) /* should be splitted? */ | |
| 554 | PORT_BIT( 0x20/*0x24*/, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Show Stats") PORT_CODE(KEYCODE_0) /* should be splitted? */ | |
| 555 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 556 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 577 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Mode") PORT_CODE(KEYCODE_9) /* press this one and then SERVICE to Test Mode */ | |
| 578 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 579 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Show Last Hand") PORT_CODE(KEYCODE_0) /* press this one and then SERVICE to show the last hand */ | |
| 580 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 581 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 557 | 582 | |
| 558 | 583 | PORT_START_TAG("IN0-2") |
| 559 | 584 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Discard 1") PORT_CODE(KEYCODE_Z) |
| r2844 | r2845 | |
| 562 | 587 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("Discard 4") PORT_CODE(KEYCODE_V) |
| 563 | 588 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("Discard 5") PORT_CODE(KEYCODE_B) |
| 564 | 589 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Small") PORT_CODE(KEYCODE_S) |
| 565 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 566 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 590 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 591 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 567 | 592 | |
| 568 | 593 | PORT_START_TAG("IN0-3") |
| 569 | 594 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r2844 | r2845 | |
| 572 | 597 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Big") PORT_CODE(KEYCODE_A) |
| 573 | 598 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 574 | 599 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 575 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 576 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 600 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 601 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 577 | 602 | |
| 578 | 603 | PORT_START_TAG("SW1") |
| 579 | 604 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| r2844 | r2845 | |
| 604 | 629 | static INPUT_PORTS_START( comg076 ) |
| 605 | 630 | PORT_START_TAG("IN0-0") |
| 606 | 631 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) /* credits */ |
| 607 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_ | |
| 632 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_U | |
| 608 | 633 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Double Up") PORT_CODE(KEYCODE_3) |
| 609 | 634 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Deal/Draw") PORT_CODE(KEYCODE_2) |
| 610 | 635 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Cancel Discards") PORT_CODE(KEYCODE_N) |
| 611 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_NAME("Stand") PORT_CODE(KEYCODE_E) | |
| 612 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 613 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 636 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 637 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 638 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 614 | 639 | |
| 615 | 640 | PORT_START_TAG("IN0-1") |
| 616 | 641 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) /* credits */ |
| 617 | 642 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 618 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service") PORT_CODE(KEYCODE_8) | |
| 619 | // PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 3") PORT_CODE(KEYCODE_F) | |
| 620 | // PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 4") PORT_CODE(KEYCODE_G) | |
| 621 | // PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 5") PORT_CODE(KEYCODE_H) | |
| 622 | PORT_BIT( 0x08/*0x0c*/, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Unk.") PORT_CODE(KEYCODE_8) /* should be splitted? */ | |
| 623 | PORT_BIT( 0x10/*0x14*/, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper SW") PORT_CODE(KEYCODE_9) /* should be splitted? */ | |
| 624 | PORT_BIT( 0x20/*0x24*/, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Mode") PORT_CODE(KEYCODE_F2) /* should be splitted? */ | |
| 625 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 626 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 643 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 644 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 645 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 646 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Mode") PORT_CODE(KEYCODE_9) | |
| 647 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 648 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 627 | 649 | |
| 628 | 650 | PORT_START_TAG("IN0-2") |
| 629 | 651 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Discard 1") PORT_CODE(KEYCODE_Z) |
| r2844 | r2845 | |
| 632 | 654 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("Discard 4") PORT_CODE(KEYCODE_V) |
| 633 | 655 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("Discard 5") PORT_CODE(KEYCODE_B) |
| 634 | 656 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Small") PORT_CODE(KEYCODE_S) |
| 635 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 636 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 657 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 658 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 637 | 659 | |
| 638 | 660 | PORT_START_TAG("IN0-3") |
| 639 | 661 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r2844 | r2845 | |
| 642 | 664 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Big") PORT_CODE(KEYCODE_A) |
| 643 | 665 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 644 | 666 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 645 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 646 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 667 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 668 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 647 | 669 | |
| 648 | 670 | PORT_START_TAG("SW1") |
| 649 | 671 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| r2844 | r2845 | |
| 678 | 700 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Deal/Draw") PORT_CODE(KEYCODE_2) |
| 679 | 701 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Cancel Discards") PORT_CODE(KEYCODE_N) |
| 680 | 702 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 681 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 682 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 703 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 704 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 683 | 705 | |
| 684 | 706 | PORT_START_TAG("IN0-1") |
| 685 | 707 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Payout") PORT_CODE(KEYCODE_Q) |
| r2844 | r2845 | |
| 688 | 710 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 689 | 711 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 690 | 712 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Mode") PORT_CODE(KEYCODE_F2) |
| 691 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 692 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 713 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 714 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 693 | 715 | |
| 694 | 716 | PORT_START_TAG("IN0-2") |
| 695 | 717 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Discard 1") PORT_CODE(KEYCODE_Z) |
| r2844 | r2845 | |
| 698 | 720 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("Discard 4") PORT_CODE(KEYCODE_V) |
| 699 | 721 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("Discard 5") PORT_CODE(KEYCODE_B) |
| 700 | 722 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 701 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 702 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 723 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 724 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 703 | 725 | |
| 704 | 726 | PORT_START_TAG("IN0-3") |
| 705 | 727 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r2844 | r2845 | |
| 708 | 730 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Big") PORT_CODE(KEYCODE_A) |
| 709 | 731 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Small") PORT_CODE(KEYCODE_S) |
| 710 | 732 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 711 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 712 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 733 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 734 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 713 | 735 | |
| 714 | 736 | PORT_START_TAG("SW1") |
| 715 | 737 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| r2844 | r2845 | |
| 1050 | 1072 | { |
| 1051 | 1073 | switch( mux_data&0xf0 ) /* bits 4-7 */ |
| 1052 | 1074 | { |
| 1053 | case 0x10: return input_port_read_indexed(machine, 0); | |
| 1054 | case 0x20: return input_port_read_indexed(machine, 1); | |
| 1055 | case 0x40: return input_port_read_indexed(machine, 2); | |
| 1056 | case 0x80: return input_port_read_indexed(machine, 3); | |
| 1075 | case 0x10: return input_port_read(machine, "IN0-0"); | |
| 1076 | case 0x20: return input_port_read(machine, "IN0-1"); | |
| 1077 | case 0x40: return input_port_read(machine, "IN0-2"); | |
| 1078 | case 0x80: return input_port_read(machine, "IN0-3"); | |
| 1057 | 1079 | } |
| 1058 | 1080 | return 0xff; |
| 1059 | 1081 | } |
| r2844 | r2845 | |
| 1575 | 1597 | |
| 1576 | 1598 | ROM_START( comg183 ) /* Cal Omega v18.3 (Pixels) */ |
| 1577 | 1599 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1578 | ROM_LOAD( "18.32", 0x | |
| 1600 | ROM_LOAD( "18.32", 0xc000, 0x1000, CRC(c793ffc1) SHA1(f2ef82f92a9e18128d28973bcf050d0c3e1819f3) ) | |
| 1579 | 1601 | ROM_LOAD( "18.33", 0xd000, 0x1000, CRC(415a6599) SHA1(648986310a3864652897e5d18b8be06819cce7a8) ) |
| 1580 | 1602 | ROM_LOAD( "18.34", 0xe000, 0x1000, CRC(fc5d3b89) SHA1(3601401d00d7a0621eac4254da238e9c8929cac4) ) |
| 1581 | 1603 | ROM_LOAD( "18.35", 0xf000, 0x1000, CRC(6552207f) SHA1(bd8a7546b4dad07d151dc7039028916386aee5e9) ) |
| r2844 | r2845 | |
| 1597 | 1619 | |
| 1598 | 1620 | ROM_START( comg185 ) /* Cal Omega v18.5 (Pixels) */ |
| 1599 | 1621 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1600 | ROM_LOAD( "18.52", 0x | |
| 1622 | ROM_LOAD( "18.52", 0xc000, 0x1000, CRC(19225f7d) SHA1(73d713ee86886f935d9b2c2ca670d8e00d466b7f) ) | |
| 1601 | 1623 | ROM_LOAD( "18.53", 0xd000, 0x1000, CRC(797e2b70) SHA1(83f974c6c1886eab5c90782766b72900c73045e1) ) |
| 1602 | 1624 | ROM_LOAD( "18.54", 0xe000, 0x1000, CRC(6becc802) SHA1(e72783db52bffd3fa2f7d35cd8a004415e37b004) ) |
| 1603 | 1625 | ROM_LOAD( "18.55", 0xf000, 0x1000, CRC(313db76a) SHA1(d81228bf0badc8a3cf08c77de27b3d973953175c) ) |
| r2844 | r2845 | |
| 1619 | 1641 | |
| 1620 | 1642 | ROM_START( comg186 ) /* Cal Omega v18.6 (Pixels) */ |
| 1621 | 1643 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1622 | ROM_LOAD( "18.62", 0x | |
| 1644 | ROM_LOAD( "18.62", 0xc000, 0x1000, CRC(025f4268) SHA1(750a5417fe2b077893d8252dd5eafc42fafd965e) ) | |
| 1623 | 1645 | ROM_LOAD( "18.63", 0xd000, 0x1000, CRC(948a6ef1) SHA1(6aeb244209f3376042a32d9accb38e3f09cb192a) ) |
| 1624 | 1646 | ROM_LOAD( "18.64", 0xe000, 0x1000, CRC(9fb6e82b) SHA1(db38564e8060f1c67183f3f412a24439b2253e13) ) |
| 1625 | 1647 | ROM_LOAD( "18.65", 0xf000, 0x1000, CRC(a68be5ef) SHA1(1ab2bc1b070863260fa281970f886d77e2fa7ccd) ) |
| r2844 | r2845 | |
| 1639 | 1661 | ROM_RELOAD( 0x0300, 0x0100 ) |
| 1640 | 1662 | ROM_END |
| 1641 | 1663 | |
| 1664 | ROM_START( comg187 ) /* Cal Omega v18.7 (Amusement Poker) */ | |
| 1665 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1666 | ROM_LOAD( "18.72", 0xc000, 0x1000, BAD_DUMP CRC(1a4bd46a) SHA1(76101271ff9b98c3310e1666dfba34a01a0f0bcd) ) /* 1st half seems to be the 2nd one, and 2nd half is filled of 0xff */ | |
| 1667 | ROM_LOAD( "18.73", 0xd000, 0x1000, CRC(ca374ecb) SHA1(113495afa88da97cb7239f645fabba7125ce2b4b) ) | |
| 1668 | ROM_LOAD( "18.74", 0xe000, 0x1000, CRC(5bb57ca8) SHA1(22dc6f0e2fee5408fa70e4bc60f1833534ee038f) ) | |
| 1669 | ROM_LOAD( "18.75", 0xf000, 0x1000, CRC(70a8ccb3) SHA1(b5b7d6a8262ab6e47a1400681c414fd3edd0d7a8) ) | |
| 1670 | ||
| 1671 | ROM_REGION( 0x0800, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1672 | ROM_LOAD( "jkrtwo.cgo", 0x0000, 0x0800, CRC(987b3e4d) SHA1(ae4b5dc0e4d1195bbf18b375c1a4dbf880f5f38c) ) | |
| 1673 | ||
| 1674 | ROM_REGION( 0x1800, REGION_GFX2, ROMREGION_DISPOSE ) | |
| 1675 | ROM_LOAD( "jkrtwo.cgc", 0x0000, 0x0800, CRC(5b96f5e0) SHA1(4733349798eb059998a4814331f57e7f09e02490) ) | |
| 1676 | ROM_LOAD( "jkrtwo.cgb", 0x0800, 0x0800, CRC(d77dda31) SHA1(e11b476cf0b609a8a40981b81b4d83b3c86678dc) ) | |
| 1677 | ROM_LOAD( "jkrtwo.cga", 0x1000, 0x0800, CRC(def60756) SHA1(fe71424fc638761d9ff65391261a030a2889ad5e) ) | |
| 1678 | ||
| 1679 | ROM_REGION( 0x400, REGION_PROMS, 0 ) | |
| 1680 | ROM_LOAD( "mltclr", 0x0000, 0x0100, CRC(fefb0fa8) SHA1(66d86aa19d9d37ffd2840d6653fcec667bc716d4) ) | |
| 1681 | ROM_RELOAD( 0x0100, 0x0100 ) | |
| 1682 | ROM_RELOAD( 0x0200, 0x0100 ) | |
| 1683 | ROM_RELOAD( 0x0300, 0x0100 ) | |
| 1684 | ROM_END | |
| 1685 | ||
| 1642 | 1686 | ROM_START( comg204 ) /* Cal Omega v20.4 (Super Blackjack) */ |
| 1643 | 1687 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1644 | 1688 | ROM_LOAD( "bj20.41", 0xb000, 0x1000, CRC(9c2203f7) SHA1(fd566683e887cf80cd0e6c82a413aebc378397f8) ) |
| r2844 | r2845 | |
| 2008 | 2052 | int x; |
| 2009 | 2053 | UINT8 *BPR = memory_region( REGION_PROMS ); |
| 2010 | 2054 | |
| 2011 | for (x=0x0000;x<0x0400;x++) | |
| 2055 | for (x = 0x0000; x < 0x0400; x++) | |
| 2012 | 2056 | { |
| 2013 | 2057 | if (BPR[x] == 0x07) |
| 2014 | 2058 | BPR[x] = 0x04; /* blue background */ |
| r2844 | r2845 | |
| 2025 | 2069 | UINT8 *BPR = memory_region( REGION_PROMS ); |
| 2026 | 2070 | |
| 2027 | 2071 | /* Palette transformed by PLDs? */ |
| 2028 | for (x=0x0000;x<0x0400;x++) | |
| 2072 | for (x = 0x0000; x < 0x0400; x++) | |
| 2029 | 2073 | { |
| 2030 | 2074 | if (BPR[x] == 0x07) |
| 2031 | 2075 | BPR[x] = 0x00; /* black background */ |
| r2844 | r2845 | |
| 2042 | 2086 | int x; |
| 2043 | 2087 | UINT8 *BPR = memory_region( REGION_PROMS ); |
| 2044 | 2088 | |
| 2045 | for (x=0x0000;x<0x0400;x++) | |
| 2089 | for (x = 0x0000; x < 0x0400; x++) | |
| 2046 | 2090 | { |
| 2047 | 2091 | if (BPR[x] == 0x02) |
| 2048 | 2092 | BPR[x] = 0x00; /* blue background */ |
| r2844 | r2845 | |
| 2059 | 2103 | int x; |
| 2060 | 2104 | UINT8 *BPR = memory_region( REGION_PROMS ); |
| 2061 | 2105 | |
| 2062 | for (x=0x0000;x<0x0400;x++) | |
| 2106 | for (x = 0x0000; x < 0x0400; x++) | |
| 2063 | 2107 | { |
| 2064 | 2108 | if (BPR[x] == 0x07) |
| 2065 | 2109 | BPR[x] = 0x04; /* blue background */ |
| r2844 | r2845 | |
| 2096 | 2140 | GAME( 1983, comg183, 0, sys905, standard, calomega, ROT0, "Cal Omega Inc.", "Cal Omega - Game 18.3 (Pixels)", GAME_NOT_WORKING ) |
| 2097 | 2141 | GAME( 1983, comg185, 0, sys905, standard, calomega, ROT0, "Cal Omega Inc.", "Cal Omega - Game 18.5 (Pixels)", GAME_NOT_WORKING ) |
| 2098 | 2142 | GAME( 1983, comg186, 0, sys905, standard, calomega, ROT0, "Cal Omega Inc.", "Cal Omega - Game 18.6 (Pixels)", GAME_NOT_WORKING ) |
| 2143 | GAME( 1983, comg187, 0, sys905, standard, calomega, ROT0, "Cal Omega Inc.", "Cal Omega - Game 18.7 (Amusement Poker)", GAME_NOT_WORKING ) | |
| 2099 | 2144 | GAME( 1984, comg204, 0, sys905, standard, calomega, ROT0, "Cal Omega Inc.", "Cal Omega - Game 20.4 (Super Blackjack)", GAME_NOT_WORKING ) |
| 2100 | 2145 | GAME( 1984, comg208, 0, sys905, standard, calomega, ROT0, "Cal Omega Inc.", "Cal Omega - Game 20.8 (Winner's Choice)", GAME_NOT_WORKING ) |
| 2101 | 2146 | GAME( 1984, comg227, 0, sys905, standard, calomega, ROT0, "Cal Omega Inc.", "Cal Omega - Game 22.7 (Amusement Poker, d/d)", GAME_NOT_WORKING ) |
| r2844 | r2845 | |
|---|---|---|
| 181 | 181 | { |
| 182 | 182 | /* burn a bunch of cycles because this is polled frequently during busy loops */ |
| 183 | 183 | activecpu_adjust_icount(-100); |
| 184 | return input_port_read | |
| 184 | return input_port_read | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | static ADDRESS_MAP_START( cpu_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| r2844 | r2845 | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | static INPUT_PORTS_START( dgpix ) |
| 238 | PORT_START | |
| 238 | PORT_START_TAG("IN0") | |
| 239 | 239 | PORT_BIT( 0x00000003, IP_ACTIVE_LOW, IPT_VBLANK ) //value 2 is used by fmaniac3 |
| 240 | 240 | PORT_BIT( 0xfffffffc, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 241 | 241 | |
| 242 | PORT_START | |
| 242 | PORT_START_TAG("IN1") | |
| 243 | 243 | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 244 | 244 | PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 245 | 245 | PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| r2844 | r2845 | |
|---|---|---|
| 189 | 189 | /* mostly not noticed since sound is */ |
| 190 | 190 | /* only enabled if game in progress! */ |
| 191 | 191 | |
| 192 | if ((input_port_read_indexed(machine, 3) & 0xc0) != 0xc0) | |
| 193 | panic_sound_output_w(machine,17,1); | |
| 192 | if ((input_port_read(machine, "IN0") & 0xc0) != 0xc0) | |
| 193 | panic_sound_output_w(machine, 17, 1); | |
| 194 | 194 | |
| 195 | 195 | cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xcf); /* RST 08h */ |
| 196 | 196 | } |
| r2844 | r2845 | |
| 204 | 204 | |
| 205 | 205 | if (pixel_clock == 0) |
| 206 | 206 | { |
| 207 | if (input_port_read | |
| 207 | if (input_port_read | |
| 208 | 208 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 209 | 209 | } |
| 210 | 210 | } |
| r2844 | r2845 | |
| 218 | 218 | It makes sense and works fine, but I cannot be 100% sure this is correct, |
| 219 | 219 | as I have no Cosmic Guerilla console :-) . */ |
| 220 | 220 | |
| 221 | if ((input_port_read | |
| 221 | if ((input_port_read | |
| 222 | 222 | /* on tms9980, a 6 on the interrupt bus means level 4 interrupt */ |
| 223 | 223 | cpunum_set_input_line_and_vector(machine, 0, 0, ASSERT_LINE, 6); |
| 224 | 224 | else |
| r2844 | r2845 | |
| 228 | 228 | static INTERRUPT_GEN( magspot_interrupt ) |
| 229 | 229 | { |
| 230 | 230 | /* Coin 1 causes an IRQ, Coin 2 an NMI */ |
| 231 | if (input_port_read | |
| 231 | if (input_port_read | |
| 232 | 232 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 233 | else if (input_port_read | |
| 233 | else if (input_port_read | |
| 234 | 234 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | static INTERRUPT_GEN( nomnlnd_interrupt ) |
| 238 | 238 | { |
| 239 | 239 | /* Coin causes an NMI */ |
| 240 | if (input_port_read | |
| 240 | if (input_port_read | |
| 241 | 241 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 242 | 242 | } |
| 243 | 243 | |
| r2844 | r2845 | |
| 252 | 252 | { |
| 253 | 253 | /* The top four address lines from the CRTC are bits 0-3 */ |
| 254 | 254 | |
| 255 | return (input_port_read | |
| 255 | return (input_port_read | |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | static READ8_HANDLER( magspot_coinage_dip_r ) |
| 259 | 259 | { |
| 260 | return (input_port_read | |
| 260 | return (input_port_read | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | |
| r2844 | r2845 | |
| 266 | 266 | static READ8_HANDLER( nomnlnd_port_0_1_r ) |
| 267 | 267 | { |
| 268 | 268 | int control; |
| 269 | int fire = input_port_read | |
| 269 | int fire = input_port_read | |
| 270 | 270 | |
| 271 | 271 | if (offset) |
| 272 | control = input_port_read | |
| 272 | control = input_port_read | |
| 273 | 273 | else |
| 274 | control = input_port_read | |
| 274 | control = input_port_read | |
| 275 | 275 | |
| 276 | 276 | /* If firing - stop tank */ |
| 277 | 277 | |
| r2844 | r2845 | |
| 298 | 298 | static ADDRESS_MAP_START( panic_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 299 | 299 | AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) |
| 300 | 300 | AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_RAM) |
| 301 | AM_RANGE(0x6800, 0x6800) AM_READ(input_port_0_r) /* IN1 */ | |
| 302 | AM_RANGE(0x6801, 0x6801) AM_READ(input_port_1_r) /* IN2 */ | |
| 303 | AM_RANGE(0x6802, 0x6802) AM_READ(input_port_2_r) /* DSW */ | |
| 304 | AM_RANGE(0x6803, 0x6803) AM_READ(input_port_3_r) /* IN0 */ | |
| 301 | AM_RANGE(0x6800, 0x6800) AM_READ_PORT("IN1") /* IN1 */ | |
| 302 | AM_RANGE(0x6801, 0x6801) AM_READ_PORT("IN2") /* IN2 */ | |
| 303 | AM_RANGE(0x6802, 0x6802) AM_READ_PORT("DSW") /* DSW */ | |
| 304 | AM_RANGE(0x6803, 0x6803) AM_READ_PORT("IN0") /* IN0 */ | |
| 305 | 305 | ADDRESS_MAP_END |
| 306 | 306 | |
| 307 | 307 | static ADDRESS_MAP_START( panic_writemem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2844 | r2845 | |
| 318 | 318 | static ADDRESS_MAP_START( cosmica_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 319 | 319 | AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) |
| 320 | 320 | AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_RAM) |
| 321 | AM_RANGE(0x6800, 0x6800) AM_READ(input_port_0_r) /* IN1 */ | |
| 322 | AM_RANGE(0x6801, 0x6801) AM_READ(input_port_1_r) /* IN2 */ | |
| 323 | AM_RANGE(0x6802, 0x6802) AM_READ(input_port_2_r) /* DSW */ | |
| 321 | AM_RANGE(0x6800, 0x6800) AM_READ_PORT("P1") /* IN1 */ | |
| 322 | AM_RANGE(0x6801, 0x6801) AM_READ_PORT("P2") /* IN2 */ | |
| 323 | AM_RANGE(0x6802, 0x6802) AM_READ_PORT("DSW") /* DSW */ | |
| 324 | 324 | AM_RANGE(0x6803, 0x6803) AM_READ(cosmica_pixel_clock_r) |
| 325 | 325 | ADDRESS_MAP_END |
| 326 | 326 | |
| r2844 | r2845 | |
| 345 | 345 | |
| 346 | 346 | static ADDRESS_MAP_START( cosmicg_readport, ADDRESS_SPACE_IO, 8 ) |
| 347 | 347 | AM_RANGE(0x00, 0x00) AM_READ(cosmicg_port_0_r) |
| 348 | AM_RANGE(0x01, 0x01) AM_READ | |
| 348 | AM_RANGE(0x01, 0x01) AM_READ | |
| 349 | 349 | ADDRESS_MAP_END |
| 350 | 350 | |
| 351 | 351 | static ADDRESS_MAP_START( cosmicg_writeport, ADDRESS_SPACE_IO, 8 ) |
| r2844 | r2845 | |
| 357 | 357 | static ADDRESS_MAP_START( magspot_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 358 | 358 | AM_RANGE(0x0000, 0x2fff) AM_READ(SMH_ROM) |
| 359 | 359 | AM_RANGE(0x3800, 0x3807) AM_READ(magspot_coinage_dip_r) |
| 360 | AM_RANGE(0x5000, 0x5000) AM_READ(input_port_0_r) | |
| 361 | AM_RANGE(0x5001, 0x5001) AM_READ(input_port_1_r) | |
| 362 | AM_RANGE(0x5002, 0x5002) AM_READ(input_port_2_r) | |
| 363 | AM_RANGE(0x5003, 0x5003) AM_READ(input_port_3_r) | |
| 360 | AM_RANGE(0x5000, 0x5000) AM_READ_PORT("IN0") | |
| 361 | AM_RANGE(0x5001, 0x5001) AM_READ_PORT("IN1") | |
| 362 | AM_RANGE(0x5002, 0x5002) AM_READ_PORT("IN2") | |
| 363 | AM_RANGE(0x5003, 0x5003) AM_READ_PORT("IN3") | |
| 364 | 364 | AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_RAM) |
| 365 | 365 | ADDRESS_MAP_END |
| 366 | 366 | |
| r2844 | r2845 | |
| 375 | 375 | |
| 376 | 376 | |
| 377 | 377 | static INPUT_PORTS_START( panic ) |
| 378 | PORT_START | |
| 378 | PORT_START_TAG("IN1") /* IN1 */ | |
| 379 | 379 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 380 | 380 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY |
| 381 | 381 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY |
| r2844 | r2845 | |
| 385 | 385 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 386 | 386 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 387 | 387 | |
| 388 | PORT_START | |
| 388 | PORT_START_TAG("IN2") /* IN2 */ | |
| 389 | 389 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 390 | 390 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL |
| 391 | 391 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL |
| r2844 | r2845 | |
| 395 | 395 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 396 | 396 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| 397 | 397 | |
| 398 | PORT_START | |
| 398 | PORT_START_TAG("DSW") /* DSW */ | |
| 399 | 399 | PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) ) |
| 400 | 400 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) |
| 401 | 401 | PORT_DIPSETTING( 0x05, DEF_STR( 2C_3C ) ) |
| r2844 | r2845 | |
| 403 | 403 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_3C ) ) |
| 404 | 404 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_4C ) ) |
| 405 | 405 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_5C ) ) |
| 406 | /* 0x06 and 0x07 disabled */ | |
| 406 | /* 0x06 and 0x07 disabled */ | |
| 407 | 407 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) ) |
| 408 | 408 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 409 | 409 | PORT_DIPSETTING( 0x08, DEF_STR( Cocktail ) ) |
| r2844 | r2845 | |
| 419 | 419 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_2C ) ) |
| 420 | 420 | PORT_DIPSETTING( 0xc0, DEF_STR( 1C_3C ) ) |
| 421 | 421 | |
| 422 | PORT_START | |
| 422 | PORT_START_TAG("IN0") /* IN0 */ | |
| 423 | 423 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 424 | 424 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) |
| 425 | 425 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r2844 | r2845 | |
| 432 | 432 | INPUT_PORTS_END |
| 433 | 433 | |
| 434 | 434 | static INPUT_PORTS_START( cosmica ) |
| 435 | PORT_START | |
| 435 | PORT_START_TAG("P1") /* IN0 */ | |
| 436 | 436 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 437 | 437 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY |
| 438 | 438 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY |
| r2844 | r2845 | |
| 442 | 442 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 443 | 443 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 444 | 444 | |
| 445 | PORT_START | |
| 445 | PORT_START_TAG("P2") /* IN1 */ | |
| 446 | 446 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 447 | 447 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL |
| 448 | 448 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL |
| r2844 | r2845 | |
| 452 | 452 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 453 | 453 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 454 | 454 | |
| 455 | PORT_START | |
| 455 | PORT_START_TAG("DSW") /* IN2 */ | |
| 456 | 456 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 457 | 457 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 458 | 458 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r2844 | r2845 | |
| 478 | 478 | /* trigger exactly one interrupt, without having to check when the */ |
| 479 | 479 | /* user releases the key. */ |
| 480 | 480 | |
| 481 | PORT_START /* FAKE */ | |
| 481 | PORT_START_TAG("FAKE") /* FAKE */ | |
| 482 | 482 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) |
| 483 | 483 | |
| 484 | 484 | INPUT_PORTS_END |
| r2844 | r2845 | |
| 489 | 489 | /* Offsets are in BYTES, so bits 0-7 are at offset 0 etc. */ |
| 490 | 490 | |
| 491 | 491 | static INPUT_PORTS_START( cosmicg ) |
| 492 | PORT_START | |
| 492 | PORT_START_TAG("IN0") /* 4-7 */ | |
| 493 | 493 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) /* pixel clock */ |
| 494 | 494 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) |
| 495 | 495 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) |
| 496 | 496 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 497 | 497 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY |
| 498 | 498 | |
| 499 | PORT_START | |
| 499 | PORT_START_TAG("IN1") /* 8-15 */ | |
| 500 | 500 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY |
| 501 | 501 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 502 | 502 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_2WAY PORT_COCKTAIL |
| r2844 | r2845 | |
| 513 | 513 | PORT_DIPSETTING( 0x00, "3" ) |
| 514 | 514 | PORT_DIPSETTING( 0x80, "5" ) |
| 515 | 515 | |
| 516 | PORT_START | |
| 516 | PORT_START_TAG("IN2") /* Hard wired settings */ | |
| 517 | 517 | |
| 518 | 518 | /* The coin slots are not memory mapped. Coin causes INT 4 */ |
| 519 | 519 | /* This fake input port is used by the interrupt handler */ |
| r2844 | r2845 | |
| 539 | 539 | |
| 540 | 540 | |
| 541 | 541 | static INPUT_PORTS_START( magspot ) |
| 542 | PORT_START /* IN0 */ | |
| 542 | PORT_START_TAG("IN0") /* IN0 */ | |
| 543 | 543 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 544 | 544 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY |
| 545 | 545 | PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r2844 | r2845 | |
| 550 | 550 | PORT_DIPSETTING( 0xc0, "15000" ) |
| 551 | 551 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 552 | 552 | |
| 553 | PORT_START /* IN1 */ | |
| 553 | PORT_START_TAG("IN1") /* IN1 */ | |
| 554 | 554 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 555 | 555 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL |
| 556 | 556 | PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 557 | 557 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL |
| 558 | 558 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 559 | 559 | |
| 560 | PORT_START /* IN2 */ | |
| 560 | PORT_START_TAG("IN2") /* IN2 */ | |
| 561 | 561 | PORT_DIPNAME( 0x03, 0x01, DEF_STR( Bonus_Life ) ) |
| 562 | 562 | PORT_DIPSETTING( 0x01, "2000" ) |
| 563 | 563 | PORT_DIPSETTING( 0x02, "3000" ) |
| r2844 | r2845 | |
| 577 | 577 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 578 | 578 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 579 | 579 | |
| 580 | PORT_START /* IN3 */ | |
| 580 | PORT_START_TAG("IN3") /* IN3 */ | |
| 581 | 581 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 582 | 582 | PORT_BIT( 0x1e, IP_ACTIVE_LOW, IPT_UNUSED ) /* always HI */ |
| 583 | 583 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) /* reads what was written to 4808. Probably not used?? */ |
| r2844 | r2845 | |
| 585 | 585 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 586 | 586 | |
| 587 | 587 | /* Fake port to handle coins */ |
| 588 | PORT_START /* IN4 */ | |
| 588 | PORT_START_TAG("COINS") /* IN4 */ | |
| 589 | 589 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) |
| 590 | 590 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1) |
| 591 | 591 | |
| 592 | 592 | /* Fake port to handle coinage dip switches. Each bit goes to 3800-3807 */ |
| 593 | PORT_START /* IN5 */ | |
| 593 | PORT_START_TAG("DSW") /* IN5 */ | |
| 594 | 594 | PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) ) |
| 595 | 595 | PORT_DIPSETTING( 0x0c, DEF_STR( 4C_1C ) ) |
| 596 | 596 | PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) |
| r2844 | r2845 | |
| 628 | 628 | INPUT_PORTS_END |
| 629 | 629 | |
| 630 | 630 | static INPUT_PORTS_START( devzone ) |
| 631 | PORT_START /* IN0 */ | |
| 631 | PORT_START_TAG("IN0") /* IN0 */ | |
| 632 | 632 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 633 | 633 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY |
| 634 | 634 | PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 635 | 635 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY |
| 636 | 636 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 637 | 637 | |
| 638 | PORT_START /* IN1 */ | |
| 638 | PORT_START_TAG("IN1") /* IN1 */ | |
| 639 | 639 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 640 | 640 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL |
| 641 | 641 | PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 642 | 642 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL |
| 643 | 643 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 644 | 644 | |
| 645 | PORT_START /* IN2 */ | |
| 645 | PORT_START_TAG("IN2") /* IN2 */ | |
| 646 | 646 | PORT_DIPNAME( 0x03, 0x01, DEF_STR( Bonus_Life ) ) |
| 647 | 647 | PORT_DIPSETTING( 0x01, "4000" ) |
| 648 | 648 | PORT_DIPSETTING( 0x02, "6000" ) |
| r2844 | r2845 | |
| 662 | 662 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 663 | 663 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 664 | 664 | |
| 665 | PORT_START /* IN3 */ | |
| 665 | PORT_START_TAG("IN3") /* IN3 */ | |
| 666 | 666 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 667 | 667 | PORT_BIT( 0x3e, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 668 | 668 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 669 | 669 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 670 | 670 | |
| 671 | 671 | /* Fake port to handle coins */ |
| 672 | PORT_START /* IN4 */ | |
| 672 | PORT_START_TAG("COINS") /* IN4 */ | |
| 673 | 673 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) |
| 674 | 674 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1) |
| 675 | 675 | |
| 676 | PORT_START /* IN5 */ | |
| 676 | PORT_START_TAG("DSW") /* IN5 */ | |
| 677 | 677 | PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) ) |
| 678 | 678 | PORT_DIPSETTING( 0x0c, DEF_STR( 4C_1C ) ) |
| 679 | 679 | PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) |
| r2844 | r2845 | |
| 712 | 712 | |
| 713 | 713 | |
| 714 | 714 | static INPUT_PORTS_START( devzone2 ) |
| 715 | PORT_START /* IN0 */ | |
| 715 | PORT_START_TAG("IN0") /* IN0 */ | |
| 716 | 716 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 717 | 717 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY |
| 718 | 718 | PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 719 | 719 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY |
| 720 | 720 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 721 | 721 | |
| 722 | PORT_START /* IN1 */ | |
| 722 | PORT_START_TAG("IN1") /* IN1 */ | |
| 723 | 723 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 724 | 724 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL |
| 725 | 725 | PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 726 | 726 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL |
| 727 | 727 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 728 | 728 | |
| 729 | PORT_START /* IN2 */ | |
| 729 | PORT_START_TAG("IN2") /* IN2 */ | |
| 730 | 730 | PORT_DIPNAME( 0x03, 0x01, DEF_STR( Bonus_Life ) ) |
| 731 | 731 | PORT_DIPSETTING( 0x01, "2000" ) |
| 732 | 732 | PORT_DIPSETTING( 0x02, "3000" ) |
| r2844 | r2845 | |
| 746 | 746 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 747 | 747 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 748 | 748 | |
| 749 | PORT_START /* IN3 */ | |
| 749 | PORT_START_TAG("IN3") /* IN3 */ | |
| 750 | 750 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 751 | 751 | PORT_BIT( 0x3e, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 752 | 752 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 753 | 753 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 754 | 754 | |
| 755 | 755 | /* Fake port to handle coins */ |
| 756 | PORT_START /* IN4 */ | |
| 756 | PORT_START_TAG("COINS") /* IN4 */ | |
| 757 | 757 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) |
| 758 | 758 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1) |
| 759 | 759 | |
| 760 | PORT_START /* IN5 */ | |
| 760 | PORT_START_TAG("DSW") /* IN5 */ | |
| 761 | 761 | PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) ) |
| 762 | 762 | PORT_DIPSETTING( 0x0c, DEF_STR( 4C_1C ) ) |
| 763 | 763 | PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) |
| r2844 | r2845 | |
| 796 | 796 | |
| 797 | 797 | |
| 798 | 798 | static INPUT_PORTS_START( nomnlnd ) |
| 799 | PORT_START /* Controls - Remapped for game */ | |
| 799 | PORT_START_TAG("IN0") /* Controls - Remapped for game */ | |
| 800 | 800 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| 801 | 801 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 802 | 802 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY |
| 803 | 803 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| 804 | 804 | PORT_BIT( 0x55, IP_ACTIVE_LOW, IPT_SPECIAL ) /* diagonals */ |
| 805 | 805 | |
| 806 | PORT_START /* IN1 */ | |
| 806 | PORT_START_TAG("IN1") /* IN1 */ | |
| 807 | 807 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL |
| 808 | 808 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL |
| 809 | 809 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL |
| 810 | 810 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL |
| 811 | 811 | PORT_BIT( 0x55, IP_ACTIVE_LOW, IPT_SPECIAL ) /* diagonals */ |
| 812 | 812 | |
| 813 | PORT_START /* IN2 */ | |
| 813 | PORT_START_TAG("IN2") /* IN2 */ | |
| 814 | 814 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Bonus_Life ) ) |
| 815 | 815 | PORT_DIPSETTING( 0x01, "2000" ) |
| 816 | 816 | PORT_DIPSETTING( 0x02, "3000" ) |
| r2844 | r2845 | |
| 830 | 830 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 831 | 831 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 832 | 832 | |
| 833 | PORT_START /* IN3 */ | |
| 833 | PORT_START_TAG("IN3") /* IN3 */ | |
| 834 | 834 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 835 | 835 | PORT_BIT( 0x1e, IP_ACTIVE_LOW, IPT_UNUSED ) /* always HI */ |
| 836 | 836 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) /* reads what was written to 4808. Probably not used?? */ |
| r2844 | r2845 | |
| 838 | 838 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 839 | 839 | |
| 840 | 840 | /* Fake port to handle coin */ |
| 841 | PORT_START /* IN4 */ | |
| 841 | PORT_START_TAG("COIN") /* IN4 */ | |
| 842 | 842 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) |
| 843 | 843 | INPUT_PORTS_END |
| 844 | 844 | |
| 845 | 845 | |
| 846 | 846 | static INPUT_PORTS_START( nomnlndg ) |
| 847 | PORT_START /* Controls - Remapped for game */ | |
| 847 | PORT_START_TAG("IN0") /* Controls - Remapped for game */ | |
| 848 | 848 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| 849 | 849 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 850 | 850 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY |
| 851 | 851 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| 852 | 852 | PORT_BIT( 0x55, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 853 | 853 | |
| 854 | PORT_START /* IN1 */ | |
| 854 | PORT_START_TAG("IN1") /* IN1 */ | |
| 855 | 855 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL |
| 856 | 856 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL |
| 857 | 857 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL |
| 858 | 858 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL |
| 859 | 859 | PORT_BIT( 0x55, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 860 | 860 | |
| 861 | PORT_START /* IN2 */ | |
| 861 | PORT_START_TAG("IN2") /* IN2 */ | |
| 862 | 862 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Bonus_Life ) ) |
| 863 | 863 | PORT_DIPSETTING( 0x01, "3000" ) |
| 864 | 864 | PORT_DIPSETTING( 0x02, "5000" ) |
| r2844 | r2845 | |
| 878 | 878 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 879 | 879 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 880 | 880 | |
| 881 | PORT_START /* IN3 */ | |
| 881 | PORT_START_TAG("IN3") /* IN3 */ | |
| 882 | 882 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 883 | 883 | PORT_BIT( 0x1e, IP_ACTIVE_LOW, IPT_UNUSED ) /* always HI */ |
| 884 | 884 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) /* reads what was written to 4808. Probably not used?? */ |
| r2844 | r2845 | |
| 886 | 886 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 887 | 887 | |
| 888 | 888 | /* Fake port to handle coin */ |
| 889 | PORT_START /* IN4 */ | |
| 889 | PORT_START_TAG("COIN") /* IN4 */ | |
| 890 | 890 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) |
| 891 | 891 | INPUT_PORTS_END |
| 892 | 892 |
| r2844 | r2845 | |
|---|---|---|
| 225 | 225 | |
| 226 | 226 | static READ8_HANDLER(via_b_in) |
| 227 | 227 | { |
| 228 | return input_port_read | |
| 228 | return input_port_read | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | |
| r2844 | r2845 | |
| 360 | 360 | |
| 361 | 361 | |
| 362 | 362 | static INPUT_PORTS_START( bmcbowl ) |
| 363 | PORT_START /* DSW 1 */ | |
| 363 | PORT_START_TAG("IN0") /* DSW 1 */ | |
| 364 | 364 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Note") |
| 365 | 365 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Analizer") |
| 366 | 366 | |
| r2844 | r2845 | |
| 381 | 381 | PORT_BIT(0x4000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Big") PORT_CODE(KEYCODE_G) |
| 382 | 382 | PORT_BIT(0x8000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Double") PORT_CODE(KEYCODE_H) |
| 383 | 383 | |
| 384 | PORT_START /* DSW 2 */ | |
| 384 | PORT_START_TAG("IN1") /* DSW 2 */ | |
| 385 | 385 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Coinage ) ) |
| 386 | PORT_DIPSETTING( 0x20, "1 COIN 10 CREDITS") | |
| 387 | PORT_DIPSETTING( 0x00, "2 COINS 10 CREDITS") | |
| 386 | PORT_DIPSETTING( 0x20, "1 COIN 10 CREDITS" ) | |
| 387 | PORT_DIPSETTING( 0x00, "2 COINS 10 CREDITS" ) | |
| 388 | 388 | |
| 389 | 389 | PORT_DIPNAME( 0x01, 0x00, "DSW2 8" ) |
| 390 | 390 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| r2844 | r2845 | |
| 409 | 409 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 410 | 410 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 411 | 411 | |
| 412 | PORT_START /* DSW 4 */ | |
| 412 | PORT_START_TAG("IN2") /* DSW 4 */ | |
| 413 | 413 | PORT_DIPNAME( 0x01, 0x00, "DSW4 8" ) |
| 414 | 414 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 415 | 415 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 435 | 435 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 436 | 436 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 437 | 437 | |
| 438 | PORT_START | |
| 438 | PORT_START_TAG("IN3") | |
| 439 | 439 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) |
| 440 | 440 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) |
| 441 | PORT_BIT | |
| 441 | PORT_BIT | |
| 442 | 442 | |
| 443 | 443 | INPUT_PORTS_END |
| 444 | 444 | |
| r2844 | r2845 | |
| 446 | 446 | { |
| 447 | 447 | switch(bmc_input) |
| 448 | 448 | { |
| 449 | case 0x00: return input_port_read_indexed(machine, 1); | |
| 450 | case 0x40: return input_port_read_indexed(machine, 2); | |
| 449 | case 0x00: return input_port_read(machine, "IN1"); | |
| 450 | case 0x40: return input_port_read(machine, "IN2"); | |
| 451 | 451 | } |
| 452 | 452 | logerror("unknown input - %X (PC=%X)\n",bmc_input,activecpu_get_previouspc()); |
| 453 | 453 | return 0xff; |
| r2844 | r2845 | |
|---|---|---|
| 67 | 67 | { |
| 68 | 68 | cpunum_resume(0, SUSPEND_ANY_REASON); |
| 69 | 69 | |
| 70 | if ((input_port_read | |
| 70 | if ((input_port_read | |
| 71 | 71 | { |
| 72 | 72 | just_been_reset = 1; |
| 73 | 73 | cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, PULSE_LINE); |
| r2844 | r2845 | |
| 78 | 78 | { |
| 79 | 79 | /* coin latch is bit 7 */ |
| 80 | 80 | |
| 81 | UINT8 temp = (input_port_read | |
| 81 | UINT8 temp = (input_port_read | |
| 82 | 82 | return (coin_latch<<7) | (temp); |
| 83 | 83 | } |
| 84 | 84 | |
| r2844 | r2845 | |
| 129 | 129 | |
| 130 | 130 | static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 ) |
| 131 | 131 | AM_RANGE(0x01, 0x01) AM_READ(blockade_input_port_0_r) |
| 132 | AM_RANGE(0x02, 0x02) AM_READ(input_port_1_r) | |
| 133 | AM_RANGE(0x04, 0x04) AM_READ(input_port_2_r) | |
| 132 | AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1") | |
| 133 | AM_RANGE(0x04, 0x04) AM_READ_PORT("IN2") | |
| 134 | 134 | ADDRESS_MAP_END |
| 135 | 135 | |
| 136 | 136 | static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 ) |
| r2844 | r2845 | |
| 146 | 146 | /* some pins were unused. */ |
| 147 | 147 | |
| 148 | 148 | static INPUT_PORTS_START( blockade ) |
| 149 | PORT_START /* IN0 */ | |
| 150 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 151 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 152 | PORT_DIPNAME( 0x04, 0x04, "Boom Switch" ) | |
| 153 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 154 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 155 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 156 | PORT_DIPNAME( 0x70, 0x70, DEF_STR( Lives ) ) | |
| 157 | PORT_DIPSETTING( 0x60, "3" ) | |
| 158 | PORT_DIPSETTING( 0x50, "4" ) | |
| 159 | PORT_DIPSETTING( 0x30, "5" ) | |
| 160 | PORT_DIPSETTING( 0x70, "6" ) | |
| 161 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 162 | /* this is really used for the coin latch, */ | |
| 163 | /* see blockade_interrupt() */ | |
| 149 | PORT_START_TAG("IN0") /* IN0 */ | |
| 150 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 151 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 152 | PORT_DIPNAME( 0x04, 0x04, "Boom Switch" ) | |
| 153 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 154 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 155 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 156 | PORT_DIPNAME( 0x70, 0x70, DEF_STR( Lives ) ) | |
| 157 | PORT_DIPSETTING( 0x60, "3" ) | |
| 158 | PORT_DIPSETTING( 0x50, "4" ) | |
| 159 | PORT_DIPSETTING( 0x30, "5" ) | |
| 160 | PORT_DIPSETTING( 0x70, "6" ) | |
| 161 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 162 | /* this is really used for the coin latch, */ | |
| 163 | /* see blockade_interrupt() */ | |
| 164 | 164 | |
| 165 | PORT_START /* IN1 */ | |
| 166 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 167 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 168 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 169 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 170 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 171 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 172 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 173 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 165 | PORT_START_TAG("IN1") /* IN1 */ | |
| 166 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 167 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 168 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 169 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 170 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 171 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 172 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 173 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 174 | 174 | |
| 175 | PORT_START /* IN2 */ | |
| 176 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 177 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 178 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 179 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 180 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 181 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 182 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 183 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 175 | PORT_START_TAG("IN2") /* IN2 */ | |
| 176 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 177 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 178 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 179 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 180 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 181 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 182 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 183 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 184 | 184 | |
| 185 | PORT_START /* IN3 */ | |
| 185 | PORT_START_TAG("IN3") /* IN3 */ | |
| 186 | 186 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 187 | 187 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 188 | 188 | INPUT_PORTS_END |
| 189 | 189 | |
| 190 | 190 | static INPUT_PORTS_START( comotion ) |
| 191 | PORT_START /* IN0 */ | |
| 192 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 193 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 194 | PORT_DIPNAME( 0x04, 0x04, "Boom Switch" ) | |
| 195 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 196 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 197 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Lives ) ) | |
| 198 | PORT_DIPSETTING( 0x00, "3" ) | |
| 199 | PORT_DIPSETTING( 0x08, "4" ) | |
| 200 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) | |
| 201 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 202 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 203 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 204 | /* this is really used for the coin latch, */ | |
| 205 | /* see blockade_interrupt() */ | |
| 191 | PORT_START_TAG("IN0") /* IN0 */ | |
| 192 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 193 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 194 | PORT_DIPNAME( 0x04, 0x04, "Boom Switch" ) | |
| 195 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 196 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 197 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Lives ) ) | |
| 198 | PORT_DIPSETTING( 0x00, "3" ) | |
| 199 | PORT_DIPSETTING( 0x08, "4" ) | |
| 200 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) | |
| 201 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 202 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 203 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 204 | /* this is really used for the coin latch, */ | |
| 205 | /* see blockade_interrupt() */ | |
| 206 | 206 | |
| 207 | PORT_START /* IN1 */ | |
| 208 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 209 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 210 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 211 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 212 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(3) | |
| 213 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(3) | |
| 214 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(3) | |
| 215 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(3) | |
| 207 | PORT_START_TAG("IN1") /* IN1 */ | |
| 208 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 209 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 210 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 211 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 212 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(3) | |
| 213 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(3) | |
| 214 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(3) | |
| 215 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(3) | |
| 216 | 216 | |
| 217 | PORT_START /* IN2 */ | |
| 218 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 219 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 220 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 221 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 222 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(4) | |
| 223 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(4) | |
| 224 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(4) | |
| 225 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(4) | |
| 217 | PORT_START_TAG("IN2") /* IN2 */ | |
| 218 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 219 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 220 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 221 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 222 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(4) | |
| 223 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(4) | |
| 224 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(4) | |
| 225 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(4) | |
| 226 | 226 | |
| 227 | PORT_START /* IN3 */ | |
| 227 | PORT_START_TAG("IN3") /* IN3 */ | |
| 228 | 228 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 229 | 229 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 230 | 230 | INPUT_PORTS_END |
| 231 | 231 | |
| 232 | 232 | static INPUT_PORTS_START( blasto ) |
| 233 | PORT_START /* IN0 */ | |
| 234 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) | |
| 235 | PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) | |
| 236 | PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) | |
| 237 | PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) | |
| 238 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) | |
| 239 | PORT_DIPNAME( 0x04, 0x04, "Boom Switch" ) | |
| 240 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 241 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 242 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Game_Time ) ) | |
| 243 | PORT_DIPSETTING( 0x00, "70 Secs" ) | |
| 244 | PORT_DIPSETTING( 0x08, "90 Secs" ) | |
| 245 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 246 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 247 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 248 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 249 | /* this is really used for the coin latch, */ | |
| 250 | /* see blockade_interrupt() */ | |
| 233 | PORT_START_TAG("IN0") /* IN0 */ | |
| 234 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) | |
| 235 | PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) | |
| 236 | PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) | |
| 237 | PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) | |
| 238 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) | |
| 239 | PORT_DIPNAME( 0x04, 0x04, "Boom Switch" ) | |
| 240 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 241 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 242 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Game_Time ) ) | |
| 243 | PORT_DIPSETTING( 0x00, "70 Secs" ) | |
| 244 | PORT_DIPSETTING( 0x08, "90 Secs" ) | |
| 245 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 246 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 247 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 248 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 249 | /* this is really used for the coin latch, */ | |
| 250 | /* see blockade_interrupt() */ | |
| 251 | 251 | |
| 252 | PORT_START /* IN1 */ | |
| 253 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 254 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 255 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 256 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 257 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 258 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) | |
| 259 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) | |
| 260 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 252 | PORT_START_TAG("IN1") /* IN1 */ | |
| 253 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 254 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 255 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 256 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 257 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 258 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) | |
| 259 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) | |
| 260 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 261 | 261 | |
| 262 | PORT_START /* IN2 */ | |
| 263 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 264 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 265 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 266 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 267 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 268 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 269 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 270 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 262 | PORT_START_TAG("IN2") /* IN2 */ | |
| 263 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 264 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 265 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 266 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 267 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 268 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 269 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 270 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 271 | 271 | |
| 272 | PORT_START /* IN3 */ | |
| 272 | PORT_START_TAG("IN3") /* IN3 */ | |
| 273 | 273 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 274 | 274 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 275 | 275 | INPUT_PORTS_END |
| 276 | 276 | |
| 277 | 277 | static INPUT_PORTS_START( hustle ) |
| 278 | PORT_START /* IN0 */ | |
| 279 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) | |
| 280 | PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) | |
| 281 | PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) | |
| 282 | PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) | |
| 283 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) | |
| 284 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Game_Time ) ) | |
| 285 | PORT_DIPSETTING( 0x00, "1.5 mins" ) | |
| 286 | PORT_DIPSETTING( 0x04, "2 mins" ) | |
| 287 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) | |
| 288 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) | |
| 289 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 290 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 291 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 292 | /* this is really used for the coin latch, */ | |
| 293 | /* see blockade_interrupt() */ | |
| 278 | PORT_START_TAG("IN0") /* IN0 */ | |
| 279 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) | |
| 280 | PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) | |
| 281 | PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) | |
| 282 | PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) | |
| 283 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) | |
| 284 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Game_Time ) ) | |
| 285 | PORT_DIPSETTING( 0x00, "1.5 mins" ) | |
| 286 | PORT_DIPSETTING( 0x04, "2 mins" ) | |
| 287 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) | |
| 288 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) | |
| 289 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 290 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 291 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 292 | /* this is really used for the coin latch, */ | |
| 293 | /* see blockade_interrupt() */ | |
| 294 | 294 | |
| 295 | PORT_START /* IN1 */ | |
| 296 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 297 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 298 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 299 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 300 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 301 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 302 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 303 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 295 | PORT_START_TAG("IN1") /* IN1 */ | |
| 296 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 297 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 298 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 299 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 300 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 301 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 302 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 303 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 304 | 304 | |
| 305 | ||
| 305 | | |
| 306 | 306 | PORT_DIPNAME( 0xf1, 0xf0, "Free Game" ) |
| 307 | PORT_DIPSETTING ( 0x71, "11000" ) | |
| 308 | PORT_DIPSETTING ( 0xb1, "13000" ) | |
| 309 | PORT_DIPSETTING ( 0xd1, "15000" ) | |
| 310 | PORT_DIPSETTING ( 0xe1, "17000" ) | |
| 311 | PORT_DIPSETTING ( 0xf0, "Disabled" ) | |
| 312 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 313 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 314 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 307 | PORT_DIPSETTING( 0x71, "11000" ) | |
| 308 | PORT_DIPSETTING( 0xb1, "13000" ) | |
| 309 | PORT_DIPSETTING( 0xd1, "15000" ) | |
| 310 | PORT_DIPSETTING( 0xe1, "17000" ) | |
| 311 | PORT_DIPSETTING( 0xf0, "Disabled" ) | |
| 312 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 313 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 314 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 315 | 315 | |
| 316 | PORT_START /* IN3 */ | |
| 316 | PORT_START_TAG("IN3") /* IN3 */ | |
| 317 | 317 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 318 | 318 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 319 | 319 | INPUT_PORTS_END |
| 320 | 320 | |
| 321 | 321 | static INPUT_PORTS_START( mineswpr ) |
| 322 | PORT_START /* IN0 */ | |
| 323 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 322 | PORT_START_TAG("IN0") /* IN0 */ | |
| 323 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 324 | 324 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* This wiring selects upright mode */ |
| 325 | PORT_DIPNAME( 0x04, 0x04, "Boom Switch" ) | |
| 326 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 327 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 328 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 329 | PORT_DIPNAME( 0x70, 0x70, DEF_STR( Lives ) ) | |
| 330 | PORT_DIPSETTING( 0x60, "3" ) | |
| 331 | PORT_DIPSETTING( 0x50, "4" ) | |
| 332 | PORT_DIPSETTING( 0x30, "5" ) | |
| 333 | PORT_DIPSETTING( 0x70, "6" ) | |
| 334 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 335 | /* this is really used for the coin latch, */ | |
| 336 | /* see blockade_interrupt() */ | |
| 325 | PORT_DIPNAME( 0x04, 0x04, "Boom Switch" ) | |
| 326 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 327 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 328 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 329 | PORT_DIPNAME( 0x70, 0x70, DEF_STR( Lives ) ) | |
| 330 | PORT_DIPSETTING( 0x60, "3" ) | |
| 331 | PORT_DIPSETTING( 0x50, "4" ) | |
| 332 | PORT_DIPSETTING( 0x30, "5" ) | |
| 333 | PORT_DIPSETTING( 0x70, "6" ) | |
| 334 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 335 | /* this is really used for the coin latch, */ | |
| 336 | /* see blockade_interrupt() */ | |
| 337 | 337 | |
| 338 | PORT_START /* IN1 */ | |
| 339 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 340 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 341 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 342 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 343 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 344 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 345 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 346 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 338 | PORT_START_TAG("IN1") /* IN1 */ | |
| 339 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 340 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 341 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 342 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 343 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 344 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 345 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 346 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 347 | 347 | |
| 348 | PORT_START /* IN2 */ | |
| 349 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 350 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 351 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 352 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 353 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 354 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 355 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 356 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 348 | PORT_START_TAG("IN2") /* IN2 */ | |
| 349 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 350 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 351 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 352 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 353 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 354 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 355 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 356 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 357 | 357 | |
| 358 | PORT_START /* IN3 */ | |
| 358 | PORT_START_TAG("IN3") /* IN3 */ | |
| 359 | 359 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 360 | 360 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 361 | 361 | INPUT_PORTS_END |
| 362 | 362 | |
| 363 | 363 | static INPUT_PORTS_START( minesw4p ) |
| 364 | PORT_START /* IN0 */ | |
| 365 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 364 | PORT_START_TAG("IN0") /* IN0 */ | |
| 365 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 366 | 366 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* This wiring selects cocktail mode */ |
| 367 | PORT_DIPNAME( 0x04, 0x04, "Boom Switch" ) | |
| 368 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 369 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 370 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 371 | PORT_DIPNAME( 0x70, 0x70, DEF_STR( Lives ) ) | |
| 372 | PORT_DIPSETTING( 0x60, "3" ) | |
| 373 | PORT_DIPSETTING( 0x50, "4" ) | |
| 374 | PORT_DIPSETTING( 0x30, "5" ) | |
| 375 | PORT_DIPSETTING( 0x70, "6" ) | |
| 376 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 377 | /* this is really used for the coin latch, */ | |
| 378 | /* see blockade_interrupt() */ | |
| 367 | PORT_DIPNAME( 0x04, 0x04, "Boom Switch" ) | |
| 368 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 369 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 370 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 371 | PORT_DIPNAME( 0x70, 0x70, DEF_STR( Lives ) ) | |
| 372 | PORT_DIPSETTING( 0x60, "3" ) | |
| 373 | PORT_DIPSETTING( 0x50, "4" ) | |
| 374 | PORT_DIPSETTING( 0x30, "5" ) | |
| 375 | PORT_DIPSETTING( 0x70, "6" ) | |
| 376 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) | |
| 377 | /* this is really used for the coin latch, */ | |
| 378 | /* see blockade_interrupt() */ | |
| 379 | 379 | |
| 380 | PORT_START /* IN1 */ | |
| 381 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 382 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 383 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 384 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 385 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 386 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 387 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 388 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 380 | PORT_START_TAG("IN1") /* IN1 */ | |
| 381 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1) | |
| 382 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1) | |
| 383 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1) | |
| 384 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1) | |
| 385 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 386 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 387 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 388 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 389 | 389 | |
| 390 | PORT_START /* IN2 */ | |
| 391 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(3) | |
| 392 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(3) | |
| 393 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(3) | |
| 394 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(3) | |
| 395 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(4) | |
| 396 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(4) | |
| 397 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(4) | |
| 398 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(4) | |
| 390 | PORT_START_TAG("IN2") /* IN2 */ | |
| 391 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(3) | |
| 392 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(3) | |
| 393 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(3) | |
| 394 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(3) | |
| 395 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(4) | |
| 396 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(4) | |
| 397 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(4) | |
| 398 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(4) | |
| 399 | 399 | |
| 400 | PORT_START /* IN3 */ | |
| 400 | PORT_START_TAG("IN3") /* IN3 */ | |
| 401 | 401 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 402 | 402 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 403 | 403 | INPUT_PORTS_END |
| r2844 | r2845 | |
|---|---|---|
| 1206 | 1206 | |
| 1207 | 1207 | static MACHINE_RESET( namcos12 ) |
| 1208 | 1208 | { |
| 1209 | psx_machine_init(); | |
| 1209 | psx_machine_init(machine); | |
| 1210 | 1210 | bankoffset_w(machine,0,0,0xffffffff); |
| 1211 | 1211 | |
| 1212 | 1212 | if( strcmp( machine->gamedrv->name, "tektagt" ) == 0 || |
| r2844 | r2845 | |
|---|---|---|
| 62 | 62 | #include "audio/seibu.h" |
| 63 | 63 | #include "machine/eeprom.h" |
| 64 | 64 | #include "sound/okim6295.h" |
| 65 | #include "machine/seicop.h" | |
| 66 | #include "includes/raiden2.h" | |
| 65 | 67 | |
| 66 | /* in machine/r2crypt.c */ | |
| 67 | extern void raiden2_decrypt_sprites(void); | |
| 68 | 68 | |
| 69 | 69 | static tilemap *background_layer,*midground_layer,*foreground_layer,*text_layer; |
| 70 | 70 | static UINT16 *back_data,*fore_data,*mid_data, *w1ram; |
| r2844 | r2845 | |
| 81 | 81 | COMBINE_DATA(dest); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | /* machine/seicop.c */ | |
| 85 | extern READ16_HANDLER( raiden2_cop2_r ); | |
| 86 | extern WRITE16_HANDLER( raiden2_cop2_w ); | |
| 87 | //extern void cop_init(void); | |
| 88 | 84 | |
| 89 | 85 | |
| 90 | ||
| 91 | 86 | /* SPRITE DRAWING (move to video file) */ |
| 92 | 87 | |
| 93 | 88 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ,int pri_mask ) |
| r2844 | r2845 | |
| 750 | 745 | |
| 751 | 746 | /* MEMORY MAPS */ |
| 752 | 747 | |
| 753 | extern UINT16* cop_mcu_ram; | |
| 754 | extern WRITE16_HANDLER( raiden2_mcu_w ); | |
| 755 | extern READ16_HANDLER( raiden2_mcu_r ); | |
| 756 | ||
| 757 | 748 | static ADDRESS_MAP_START( raiden2_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 758 | 749 | AM_RANGE(0x00400, 0x007ff) AM_READWRITE(raiden2_mcu_r, raiden2_mcu_w) AM_BASE(&cop_mcu_ram) |
| 759 | 750 |
| r2844 | r2845 | |
|---|---|---|
| 381 | 381 | extern WRITE32_HANDLER(taitojc_tile_w); |
| 382 | 382 | extern READ32_HANDLER(taitojc_char_r); |
| 383 | 383 | extern WRITE32_HANDLER(taitojc_char_w); |
| 384 | extern void taitojc_clear_frame(void); | |
| 385 | extern void taitojc_render_polygons(UINT16 *polygon_fifo, int length); | |
| 384 | extern void taitojc_clear_frame(running_machine *machine); | |
| 385 | extern void taitojc_render_polygons(running_machine *machine, UINT16 *polygon_fifo, int length); | |
| 386 | 386 | |
| 387 | 387 | extern VIDEO_START(taitojc); |
| 388 | 388 | extern VIDEO_UPDATE(taitojc); |
| r2844 | r2845 | |
| 1017 | 1017 | { |
| 1018 | 1018 | if (offset == 0) |
| 1019 | 1019 | { |
| 1020 | taitojc_clear_frame(); | |
| 1021 | taitojc_render_polygons(polygon_fifo, polygon_fifo_ptr); | |
| 1020 | taitojc_clear_frame(machine); | |
| 1021 | taitojc_render_polygons(machine, polygon_fifo, polygon_fifo_ptr); | |
| 1022 | 1022 | |
| 1023 | 1023 | polygon_fifo_ptr = 0; |
| 1024 | 1024 | } |
| r2844 | r2845 | |
|---|---|---|
| 17 | 17 | #include "deprecat.h" |
| 18 | 18 | #include "sound/okim6295.h" |
| 19 | 19 | #include "sound/3812intf.h" |
| 20 | #include "includes/bublbobl.h" | |
| 20 | 21 | |
| 21 | 22 | static UINT8 *bg_paletteram, *missb2_bgvram; |
| 22 | 23 | |
| 23 | /* video/bublbobl.c */ | |
| 24 | extern UINT8 *bublbobl_objectram; | |
| 25 | extern size_t bublbobl_objectram_size; | |
| 26 | ||
| 27 | /* machine/bublbobl.c */ | |
| 28 | WRITE8_HANDLER( bublbobl_bankswitch_w ); | |
| 29 | WRITE8_HANDLER( bublbobl_nmitrigger_w ); | |
| 30 | WRITE8_HANDLER( bublbobl_sound_command_w ); | |
| 31 | WRITE8_HANDLER( bublbobl_sh_nmi_disable_w ); | |
| 32 | WRITE8_HANDLER( bublbobl_sh_nmi_enable_w ); | |
| 33 | extern int bublbobl_video_enable; | |
| 34 | ||
| 35 | 24 | /* Video Hardware */ |
| 36 | 25 | |
| 37 | 26 | static VIDEO_UPDATE( missb2 ) |
| r2844 | r2845 | |
|---|---|---|
| 66 | 66 | #include "driver.h" |
| 67 | 67 | #include "cpu/m6805/m6805.h" |
| 68 | 68 | #include "sound/ay8910.h" |
| 69 | #include "includes/pitnrun.h" | |
| 69 | 70 | |
| 70 | WRITE8_HANDLER (pitnrun_68705_portA_w); | |
| 71 | WRITE8_HANDLER (pitnrun_68705_portB_w); | |
| 72 | ||
| 73 | READ8_HANDLER (pitnrun_68705_portA_r); | |
| 74 | READ8_HANDLER (pitnrun_68705_portB_r); | |
| 75 | READ8_HANDLER (pitnrun_68705_portC_r); | |
| 76 | ||
| 77 | MACHINE_RESET( pitnrun ); | |
| 78 | ||
| 79 | READ8_HANDLER( pitnrun_mcu_data_r ); | |
| 80 | READ8_HANDLER( pitnrun_mcu_status_r ); | |
| 81 | WRITE8_HANDLER( pitnrun_mcu_data_w ); | |
| 82 | ||
| 83 | extern UINT8* pitnrun_videoram2; | |
| 84 | ||
| 85 | WRITE8_HANDLER( pitnrun_videoram_w ); | |
| 86 | WRITE8_HANDLER( pitnrun_videoram2_w ); | |
| 87 | WRITE8_HANDLER(pitnrun_ha_w); | |
| 88 | WRITE8_HANDLER(pitnrun_h_heed_w); | |
| 89 | WRITE8_HANDLER(pitnrun_v_heed_w); | |
| 90 | WRITE8_HANDLER(pitnrun_color_select_w); | |
| 91 | WRITE8_HANDLER( pitnrun_char_bank_select ); | |
| 92 | WRITE8_HANDLER( pitnrun_scroll_w ); | |
| 93 | READ8_HANDLER( pitnrun_videoram_r ); | |
| 94 | READ8_HANDLER( pitnrun_videoram2_r ); | |
| 95 | ||
| 96 | PALETTE_INIT(pitnrun); | |
| 97 | VIDEO_START(pitnrun); | |
| 98 | VIDEO_UPDATE(pitnrun); | |
| 99 | ||
| 100 | 71 | static int pitnrun_nmi; |
| 101 | 72 | |
| 102 | 73 | static INTERRUPT_GEN( pitnrun_nmi_source ) |
| r2844 | r2845 | |
|---|---|---|
| 97 | 97 | |
| 98 | 98 | static WRITE16_HANDLER( bionicc_mpu_trigger_w ) |
| 99 | 99 | { |
| 100 | data = input_port_read | |
| 100 | data = input_port_read | |
| 101 | 101 | bionicc_inp[0] = data ^ 0x0f; |
| 102 | 102 | |
| 103 | data = input_port_read | |
| 103 | data = input_port_read | |
| 104 | 104 | bionicc_inp[1] = data ^ 0xff; |
| 105 | 105 | |
| 106 | data = input_port_read | |
| 106 | data = input_port_read | |
| 107 | 107 | bionicc_inp[2] = data ^ 0xff; |
| 108 | 108 | } |
| 109 | 109 | |
| r2844 | r2845 | |
| 195 | 195 | |
| 196 | 196 | |
| 197 | 197 | static INPUT_PORTS_START( bionicc ) |
| 198 | PORT_START | |
| 198 | PORT_START_TAG("IN0") | |
| 199 | 199 | PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 200 | 200 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START2 ) |
| 201 | 201 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_START1 ) |
| 202 | 202 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 203 | 203 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 204 | 204 | |
| 205 | PORT_START | |
| 205 | PORT_START_TAG("DSW") | |
| 206 | 206 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SWB:1,2,3") |
| 207 | 207 | PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) |
| 208 | 208 | PORT_DIPSETTING( 0x0001, DEF_STR( 3C_1C ) ) |
| r2844 | r2845 | |
| 247 | 247 | PORT_DIPSETTING( 0x8000, DEF_STR( Off )) |
| 248 | 248 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 249 | 249 | |
| 250 | PORT_START | |
| 250 | PORT_START_TAG("IN1") | |
| 251 | 251 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 252 | 252 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 253 | 253 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY |
| r2844 | r2845 | |
| 257 | 257 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 258 | 258 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 259 | 259 | |
| 260 | PORT_START | |
| 260 | PORT_START_TAG("IN2") | |
| 261 | 261 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| 262 | 262 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 263 | 263 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL |
| r2844 | r2845 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | static READ8_HANDLER( citycon_in_r ) |
| 23 | 23 | { |
| 24 | return input_port_read | |
| 24 | return input_port_read | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| r2844 | r2845 | |
| 29 | 29 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 30 | 30 | AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_RAM) |
| 31 | 31 | AM_RANGE(0x3000, 0x3000) AM_READ(citycon_in_r) /* player 1 & 2 inputs multiplexed */ |
| 32 | AM_RANGE(0x3001, 0x3001) AM_READ(input_port_2_r) | |
| 33 | AM_RANGE(0x3002, 0x3002) AM_READ(input_port_3_r) | |
| 32 | AM_RANGE(0x3001, 0x3001) AM_READ_PORT("IN2") | |
| 33 | AM_RANGE(0x3002, 0x3002) AM_READ_PORT("IN3") | |
| 34 | 34 | AM_RANGE(0x3007, 0x3007) AM_READ(watchdog_reset_r) /* ? */ |
| 35 | 35 | AM_RANGE(0x4000, 0xffff) AM_READ(SMH_ROM) |
| 36 | 36 | ADDRESS_MAP_END |
| r2844 | r2845 | |
|---|---|---|
| 21 | 21 | ampkr2b3 clone American Poker II (bootleg, set 3). |
| 22 | 22 | pkrdewin clone Poker De Win. |
| 23 | 23 | ampkr95 clone American Poker 95. |
| 24 | videomat clone Videomat (polish bootleg). | |
| 24 | 25 | sigmapkr parent Sigma Poker. |
| 25 | 26 | sigma2k parent Sigma Poker 2000. |
| 26 | 27 | |
| r2844 | r2845 | |
| 276 | 277 | --- DRIVER UPDATES --- |
| 277 | 278 | |
| 278 | 279 | |
| 280 | [2008-06-09] | |
| 281 | - Added Videomat (polish bootleg). | |
| 282 | ||
| 283 | ||
| 279 | 284 | [2008-06-02] |
| 280 | 285 | |
| 281 | 286 | - Reworked the input system for Sigma Poker 2000. |
| r2844 | r2845 | |
| 1127 | 1132 | ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) ) |
| 1128 | 1133 | ROM_END |
| 1129 | 1134 | |
| 1135 | ROM_START( videomat ) /* polish bootleg */ | |
| 1136 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1137 | ROM_LOAD( "rom.bin", 0x0000, 0x10000, CRC(910cd941) SHA1(350ca70370c5082901343d0c0c1424729d77b006) ) | |
| 1138 | ||
| 1139 | ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1140 | ROM_LOAD( "rom0.u47", 0x0000, 0x4000, CRC(cefed6c7) SHA1(79591339eab2712b432dfe89929dbc97000a13d2) ) | |
| 1141 | ||
| 1142 | ROM_REGION( 0x200, REGION_PROMS, 0 ) | |
| 1143 | ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) ) | |
| 1144 | ROM_END | |
| 1145 | ||
| 1130 | 1146 | ROM_START( sigmapkr ) |
| 1131 | 1147 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1132 | 1148 | ROM_LOAD( "sigmapkr.u6", 0x0000, 0x10000, CRC(aa3f429a) SHA1(8c82e86de7280590ba157860cbf9783f893f8554) ) |
| r2844 | r2845 | |
| 1161 | 1177 | GAMEL( 1994, ampkr2b3, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "American Poker II (bootleg, set 3)", 0, layout_ampoker2 ) |
| 1162 | 1178 | GAMEL( 1995, ampkr95, ampoker2, ampoker2, ampkr95, 0, ROT0, "Bootleg", "American Poker 95", 0, layout_ampoker2 ) |
| 1163 | 1179 | GAMEL( 1990, pkrdewin, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "Poker De Win", 0, layout_ampoker2 ) |
| 1180 | GAMEL( 1990, videomat, ampoker2, ampoker2, ampoker2, 0, ROT0, "Bootleg", "Videomat (polish bootleg)", 0, layout_ampoker2 ) | |
| 1164 | 1181 | GAMEL( 1995, sigmapkr, 0, ampoker2, sigmapkr, 0, ROT0, "Sigma Inc.", "Sigma Poker", 0, layout_sigmapkr ) |
| 1165 | 1182 | GAMEL( 1998, sigma2k, 0, sigma2k, sigma2k, 0, ROT0, "Sigma Inc.", "Sigma Poker 2000", 0, layout_sigmapkr ) |
| r2844 | r2845 | |
|---|---|---|
| 6 | 6 | Driver by Pierpaolo Prazzoli |
| 7 | 7 | |
| 8 | 8 | TODO: |
| 9 | - Add sound | |
| 10 | 9 | - Add colors when proms are dumped |
| 11 | 10 | |
| 11 | Mods by Tomasz Slanina (2008.06.12): | |
| 12 | ||
| 13 | - fixed sound cpu interrupts (mode 2 (two vectors)+ nmi) | |
| 14 | - added sound and music. | |
| 15 | - ay/msm clocks are arbitrary | |
| 16 | - just a guess - upper nibble of byte from port 3 _probably_ | |
| 17 | contains sound command (sound cpu writes it to port c) | |
| 18 | ||
| 12 | 19 | ******************************************************************************/ |
| 13 | 20 | |
| 14 | 21 | #include "driver.h" |
| 22 | #include "sound/dac.h" | |
| 23 | #include "sound/msm5205.h" | |
| 24 | #include "sound/ay8910.h" | |
| 15 | 25 | |
| 26 | static int msm_data = 0; | |
| 27 | static int msm_toggle=0; | |
| 28 | ||
| 16 | 29 | static UINT8 *bgvideoram,*fgvideoram; |
| 17 | 30 | static int bg_bank = 0; |
| 31 | static UINT8 snd_interrupt_enable=0; | |
| 32 | static UINT8 music_interrupt_enable=0; | |
| 33 | static UINT8 snd_ack; | |
| 18 | 34 | |
| 19 | 35 | static tilemap *bg_tilemap,*fg_tilemap; |
| 20 | 36 | |
| r2844 | r2845 | |
| 39 | 55 | } |
| 40 | 56 | |
| 41 | 57 | flip_screen_set(data & 0xc); // probably one bit for flipx and one for flipy |
| 58 | ||
| 42 | 59 | } |
| 43 | 60 | |
| 44 | 61 | static WRITE8_HANDLER( coins_w ) |
| r2844 | r2845 | |
| 50 | 67 | set_led_status(1, data & 8); |
| 51 | 68 | } |
| 52 | 69 | |
| 53 | static WRITE8_HANDLER( | |
| 70 | static WRITE8_HANDLER( | |
| 54 | 71 | { |
| 55 | if(data == 1) | |
| 56 | cpunum_set_input_line_and_vector(machine, 1, 0, ASSERT_LINE, 0x38); | |
| 57 | else | |
| 58 | cpunum_set_input_line_and_vector(machine, 1, 0, CLEAR_LINE, 0x38); | |
| 72 | soundlatch_w(machine,offset,data); | |
| 73 | cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE); | |
| 59 | 74 | } |
| 60 | 75 | |
| 76 | static READ8_HANDLER(dswa_r) | |
| 77 | { | |
| 78 | return (input_port_read(machine, "DSWA")&0x0f)|(snd_ack<<4); //guess ... | |
| 79 | } | |
| 80 | ||
| 61 | 81 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 62 | 82 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 63 | 83 | AM_RANGE(0x8800, 0x97ff) AM_RAM |
| r2844 | r2845 | |
| 71 | 91 | AM_RANGE(0x00, 0x00) AM_READ(input_port_0_r) |
| 72 | 92 | AM_RANGE(0x01, 0x01) AM_READ(input_port_1_r) |
| 73 | 93 | AM_RANGE(0x02, 0x02) AM_READ(input_port_2_r) |
| 74 | AM_RANGE(0x03, 0x03) AM_READ( | |
| 94 | AM_RANGE(0x03, 0x03) AM_READ(dswa | |
| 75 | 95 | AM_RANGE(0x04, 0x04) AM_READ(input_port_4_r) |
| 76 | 96 | AM_RANGE(0x20, 0x20) AM_WRITE(coins_w) |
| 77 | 97 | AM_RANGE(0x21, 0x21) AM_WRITE(bg_bank_w) |
| 78 | 98 | AM_RANGE(0x22, 0x22) AM_WRITENOP |
| 79 | 99 | AM_RANGE(0x23, 0x23) AM_WRITENOP |
| 80 | 100 | AM_RANGE(0x24, 0x24) AM_WRITENOP |
| 81 | AM_RANGE(0x27, 0x27) AM_WRITE(s | |
| 101 | AM_RANGE(0x27, 0x27) AM_WRITE(s | |
| 82 | 102 | ADDRESS_MAP_END |
| 83 | 103 | |
| 84 | 104 | |
| r2844 | r2845 | |
| 87 | 107 | AM_RANGE(0xd000, 0xe7ff) AM_RAM |
| 88 | 108 | ADDRESS_MAP_END |
| 89 | 109 | |
| 110 | static WRITE8_HANDLER(adpcm_w) | |
| 111 | { | |
| 112 | msm_data = data; | |
| 113 | msm_toggle=0; | |
| 114 | } | |
| 115 | ||
| 116 | static WRITE8_HANDLER(snd_ack_w) | |
| 117 | { | |
| 118 | snd_ack=data; | |
| 119 | } | |
| 120 | ||
| 121 | static WRITE8_HANDLER( snd_irq_w ) | |
| 122 | { | |
| 123 | snd_interrupt_enable=data; | |
| 124 | } | |
| 125 | ||
| 126 | static WRITE8_HANDLER( music_irq_w ) | |
| 127 | { | |
| 128 | music_interrupt_enable=data; | |
| 129 | } | |
| 130 | ||
| 90 | 131 | static ADDRESS_MAP_START( snd_io_map, ADDRESS_SPACE_IO, 8 ) |
| 91 | 132 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 92 | AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r) | |
| 93 | AM_RANGE(0x04, 0x04) AM_WRITENOP // 0 or 1 | |
| 133 | AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_r, soundlatch_clear_w ) | |
| 134 | AM_RANGE(0x04, 0x04) AM_WRITE(music_irq_w) | |
| 94 | 135 | AM_RANGE(0x08, 0x08) AM_WRITE(snd_irq_w) |
| 95 | AM_RANGE(0x0c, 0x0c) AM_WRITENOP // it writes the low nibble of the soundlatch when soundlatch & 0x80 == 0x80 | |
| 96 | AM_RANGE(0x80, 0x80) AM_WRITENOP // sound data | |
| 97 | AM_RANGE(0x86, 0x87) AM_WRITENOP | |
| 98 | AM_RANGE(0x8a, 0x8b) AM_WRITENOP | |
| 99 | AM_RANGE(0x8e, 0x8f) AM_WRITENOP | |
| 136 | AM_RANGE(0x0c, 0x0c) AM_WRITE(snd_ack_w) | |
| 137 | AM_RANGE(0x80, 0x80) AM_WRITE(adpcm_w) | |
| 138 | AM_RANGE(0x86, 0x86) AM_WRITE(AY8910_write_port_0_w) | |
| 139 | AM_RANGE(0x87, 0x87) AM_WRITE(AY8910_control_port_0_w) | |
| 140 | AM_RANGE(0x8a, 0x8a) AM_WRITE(AY8910_write_port_1_w) | |
| 141 | AM_RANGE(0x8b, 0x8b) AM_WRITE(AY8910_control_port_1_w) | |
| 142 | AM_RANGE(0x8e, 0x8e) AM_WRITE(AY8910_write_port_2_w) | |
| 143 | AM_RANGE(0x8f, 0x8f) AM_WRITE(AY8910_control_port_2_w) | |
| 100 | 144 | ADDRESS_MAP_END |
| 101 | 145 | |
| 102 | 146 | |
| 103 | 147 | static INPUT_PORTS_START( dacholer ) |
| 104 | PORT_START | |
| 148 | PORT_START_TAG("IN0") | |
| 105 | 149 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) |
| 106 | 150 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) |
| 107 | 151 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) |
| r2844 | r2845 | |
| 111 | 155 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 112 | 156 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 113 | 157 | |
| 114 | PORT_START | |
| 158 | PORT_START_TAG("IN1") | |
| 115 | 159 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL |
| 116 | 160 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL |
| 117 | 161 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL |
| r2844 | r2845 | |
| 121 | 165 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 122 | 166 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 123 | 167 | |
| 124 | PORT_START | |
| 168 | PORT_START_TAG("IN2") | |
| 125 | 169 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 126 | 170 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) |
| 127 | 171 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r2844 | r2845 | |
| 142 | 186 | PORT_DIPSETTING( 0x04, DEF_STR( 5C_1C ) ) |
| 143 | 187 | PORT_DIPSETTING( 0x08, DEF_STR( 4C_1C ) ) |
| 144 | 188 | PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) ) |
| 145 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL ) // to let play the sounds | |
| 146 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 147 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 148 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 149 | 189 | |
| 150 | 190 | PORT_START_TAG("DSWB") |
| 151 | 191 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) /* table at 0x0a9c */ |
| r2844 | r2845 | |
| 330 | 370 | GFXDECODE_END |
| 331 | 371 | |
| 332 | 372 | |
| 373 | static INTERRUPT_GEN( sound_irq ) | |
| 374 | { | |
| 375 | if(music_interrupt_enable == 1) | |
| 376 | { | |
| 377 | cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, 0x30); | |
| 378 | } | |
| 379 | } | |
| 380 | ||
| 381 | static INTERRUPT_GEN(adpcm_int) | |
| 382 | { | |
| 383 | if(snd_interrupt_enable == 1 || (snd_interrupt_enable ==0 && msm_toggle==1)) | |
| 384 | { | |
| 385 | MSM5205_data_w(0,msm_data >> 4); | |
| 386 | msm_data<<=4; | |
| 387 | msm_toggle^=1; | |
| 388 | if (msm_toggle==0) | |
| 389 | { | |
| 390 | cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, 0x38); | |
| 391 | } | |
| 392 | } | |
| 393 | } | |
| 394 | ||
| 395 | static struct MSM5205interface msm_interface = | |
| 396 | { | |
| 397 | adpcm_int, /* interrupt function */ | |
| 398 | MSM5205_S96_4B /* 1 / 96 = 3906.25Hz playback - guess */ | |
| 399 | }; | |
| 400 | ||
| 333 | 401 | static MACHINE_DRIVER_START( dacholer ) |
| 334 | 402 | |
| 335 | 403 | /* basic machine hardware */ |
| r2844 | r2845 | |
| 341 | 409 | MDRV_CPU_ADD(Z80, 4000000) /* ? */ |
| 342 | 410 | MDRV_CPU_PROGRAM_MAP(snd_map, 0) |
| 343 | 411 | MDRV_CPU_IO_MAP(snd_io_map, 0) |
| 344 | MDRV_CPU_ | |
| 412 | MDRV_CPU_VBLANK | |
| 345 | 413 | |
| 346 | 414 | /* video hardware */ |
| 347 | 415 | MDRV_SCREEN_ADD("main", RASTER) |
| r2844 | r2845 | |
| 358 | 426 | MDRV_VIDEO_UPDATE(dacholer) |
| 359 | 427 | |
| 360 | 428 | /* sound hardware */ |
| 361 | /* ? */ | |
| 429 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 430 | ||
| 431 | MDRV_SOUND_ADD(AY8910, 1500000) | |
| 432 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) | |
| 433 | ||
| 434 | MDRV_SOUND_ADD(AY8910, 1500000) | |
| 435 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) | |
| 436 | ||
| 437 | MDRV_SOUND_ADD(AY8910, 1500000) | |
| 438 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) | |
| 439 | ||
| 440 | MDRV_SOUND_ADD(MSM5205, 375000) | |
| 441 | MDRV_SOUND_CONFIG(msm_interface) | |
| 442 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) | |
| 443 | ||
| 362 | 444 | MACHINE_DRIVER_END |
| 363 | 445 | |
| 364 | 446 | ROM_START( dacholer ) |
| r2844 | r2845 | |
| 418 | 500 | ROM_LOAD( "proms", 0x0000, 0x0020, NO_DUMP ) |
| 419 | 501 | ROM_END |
| 420 | 502 | |
| 421 | GAME( 1983, dacholer, 0, dacholer, dacholer, 0, ROT0, "Nichibutsu", "Dacholer", GAME_WRONG_COLORS | GAME_NO_SOUND ) | |
| 422 | GAME( 1983, kickboy, 0, dacholer, kickboy, 0, ROT0, "Nichibutsu", "Kick Boy", GAME_WRONG_COLORS | GAME_NO_SOUND ) | |
| 503 | GAME( 1983, dacholer, 0, dacholer, dacholer, 0, ROT0, "Nichibutsu", "Dacholer", GAME_WRONG_COLORS ) | |
| 504 | GAME( 1983, kickboy, 0, dacholer, kickboy, 0, ROT0, "Nichibutsu", "Kick Boy", GAME_WRONG_COLORS ) |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | Main CPU : M68000 |
| 10 | Video Chips : 2 x ACTEL A40MX04 (84 Pin Square Socketed) | |
| 10 | Video Chips : 2 x ACTEL A40MX04 (84 Pin Square Socketed) or | |
| 11 | ESD CRTC99 (QFP240) & ACTEL A40MX04 | |
| 11 | 12 | |
| 12 | 13 | Sound CPU : Z80 |
| 13 | 14 | Sound Chips : M6295 (AD-65) + YM3812 (U6612) + YM3014 (U6614) |
| r2844 | r2845 | |
| 15 | 16 | --------------------------------------------------------------------------- |
| 16 | 17 | Year + Game PCB Notes |
| 17 | 18 | --------------------------------------------------------------------------- |
| 18 | 98 Multi Champ ESD 11-09-98 | |
| 19 | 99 Multi Champ Deluxe ESD 08-26-1999 | |
| 20 | 00 Head Panic ESD 08-26-1999 (with Fuuki) | |
| 19 | 98 Multi Champ ESD 11-09-98 (also a year 1999 revision) | |
| 20 | 99 Multi Champ Deluxe ESD 08-26-1999 (also a year 2000 revision) | |
| 21 | 00 Head Panic ESD 08-26-1999 (All English version) | |
| 22 | 00 Head Panic ESD 08-26-1999 (with Fuuki, Story in Japanese) | |
| 21 | 23 | 00 Tang Tang ESD (no date is marked on PCB) |
| 24 | 01 SWAT Police ESD (no date is marked on PCB) | |
| 22 | 25 | --------------------------------------------------------------------------- |
| 23 | 26 | |
| 27 | Other ESD games: | |
| 28 | ||
| 29 | Head Panic (c) 1999 - Undumped, original version is (c) 1999 | |
| 30 | 3 Cushion Billiards (c) 2000 - Undumped | |
| 31 | Deluxe 5 (c) 2000 - Undumped | |
| 32 | Fire Hawk (c) 2001 - see nmk16.c driver | |
| 33 | Jumping Pop (c) 2001 - see tumbleb.c driver | |
| 34 | ||
| 24 | 35 | Head Panic |
| 25 | 36 | - Maybe the sprite code can be merged again, haven't checked yet. |
| 26 | 37 | - Nude / Bikini pics don't show in-game, even when set in test mode? |
| r2844 | r2845 | |
| 255 | 266 | AM_RANGE(0x700000, 0x70ffff) AM_WRITE(SMH_RAM) |
| 256 | 267 | ADDRESS_MAP_END |
| 257 | 268 | |
| 269 | ||
| 258 | 270 | /*************************************************************************** |
| 259 | 271 | |
| 260 | 272 | |
| r2844 | r2845 | |
| 426 | 438 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 427 | 439 | INPUT_PORTS_END |
| 428 | 440 | |
| 441 | ||
| 442 | static INPUT_PORTS_START( swatpolc ) | |
| 443 | PORT_START_TAG("IN0") // $600002.w | |
| 444 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) | |
| 445 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) | |
| 446 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) | |
| 447 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) | |
| 448 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 449 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 450 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 451 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 452 | ||
| 453 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) | |
| 454 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) | |
| 455 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) | |
| 456 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) | |
| 457 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 458 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 459 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 460 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 461 | ||
| 462 | PORT_START_TAG("IN1") // $600005.b | |
| 463 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 464 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 465 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) | |
| 466 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 ) | |
| 467 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 468 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 469 | PORT_SERVICE_NO_TOGGLE( 0x0040, IP_ACTIVE_LOW) | |
| 470 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 471 | INPUT_PORTS_END | |
| 472 | ||
| 429 | 473 | /*************************************************************************** |
| 430 | 474 | |
| 431 | 475 | |
| r2844 | r2845 | |
| 598 | 642 | MDRV_GFXDECODE(tangtang) |
| 599 | 643 | MACHINE_DRIVER_END |
| 600 | 644 | |
| 645 | static MACHINE_DRIVER_START( swatpolc ) | |
| 646 | ||
| 647 | /* basic machine hardware */ | |
| 648 | MDRV_IMPORT_FROM(hedpanic) | |
| 649 | ||
| 650 | MDRV_GFXDECODE(tangtang) | |
| 651 | MACHINE_DRIVER_END | |
| 652 | ||
| 601 | 653 | /*************************************************************************** |
| 602 | 654 | |
| 603 | 655 | |
| r2844 | r2845 | |
| 670 | 722 | |
| 671 | 723 | ROM_REGION( 0x24000, REGION_CPU2, 0 ) /* Z80 Code */ |
| 672 | 724 | ROM_LOAD( "esd3.su06", 0x00000, 0x0c000, CRC(7c178bd7) SHA1(8754d3c70d9b2bf369a5ce0cce4cc0696ed22750) ) |
| 673 | ROM_CONTINUE( | |
| 725 | ROM_CONTINUE( | |
| 674 | 726 | |
| 675 | 727 | ROM_REGION( 0x140000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites, 16x16x5 */ |
| 676 | 728 | ROM_LOAD( "esd14.ju03", 0x000000, 0x040000, CRC(a6122225) SHA1(cbcf2b31c4c011daba21f0ae5fd3be63c9a87c00) ) |
| r2844 | r2845 | |
| 700 | 752 | |
| 701 | 753 | ROM_REGION( 0x24000, REGION_CPU2, 0 ) /* Z80 Code */ |
| 702 | 754 | ROM_LOAD( "esd3.su06", 0x00000, 0x0c000, CRC(7c178bd7) SHA1(8754d3c70d9b2bf369a5ce0cce4cc0696ed22750) ) |
| 703 | ROM_CONTINUE( | |
| 755 | ROM_CONTINUE( | |
| 704 | 756 | |
| 705 | 757 | ROM_REGION( 0x140000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites, 16x16x5 */ |
| 706 | 758 | ROM_LOAD( "multchmp.u36", 0x000000, 0x040000, CRC(d8f06fa8) SHA1(f76912f93f99578529612a7f01d82ac7229a8e41) ) |
| r2844 | r2845 | |
| 769 | 821 | with an EPROM. In between the unpopulated positions are 2x smt pads. These are populated |
| 770 | 822 | with 2x 16M SOP44 smt Mask ROMs. |
| 771 | 823 | |
| 824 | Note: Some versions of this PCB used larger EPROMs with the data repeated: | |
| 825 | ESD 3 @ SU06 as a 27C040 with data repeated 2x (CRC32 0x2C0C8813) | |
| 826 | ||
| 772 | 827 | */ |
| 773 | 828 | |
| 774 | 829 | |
| r2844 | r2845 | |
| 777 | 832 | ROM_LOAD16_BYTE( "ver0106_esd2.cu02", 0x000000, 0x040000, CRC(ea98b3fd) SHA1(107ee8adea246141fd6fa9209541ce0a7ed1e24c) ) |
| 778 | 833 | ROM_LOAD16_BYTE( "ver0106_esd1.cu03", 0x000001, 0x040000, CRC(c6e4546b) SHA1(af9a8edffe94d035f92b36b1cd145c2a5ee66f48) ) |
| 779 | 834 | |
| 780 | ROM_REGION( 0x84000, REGION_CPU2, 0 ) /* Z80 Code */ | |
| 781 | ROM_LOAD( "ver0106_desd3.su06", 0x00000, 0x0c000, CRC(1b22568c) SHA1(5458e1a798357a6785f8ea1fe9da37768cd4761d) ) | |
| 782 | ROM_CONTINUE( 0x10000, 0x34000 ) | |
| 835 | ROM_REGION( 0x44000, REGION_CPU2, 0 ) /* Z80 Code */ | |
| 836 | ROM_LOAD( "esd3.su06", 0x00000, 0x0c000, CRC(1b22568c) SHA1(5458e1a798357a6785f8ea1fe9da37768cd4761d) ) | |
| 837 | ROM_CONTINUE( 0x10000, 0x34000) | |
| 783 | 838 | |
| 784 | 839 | /* this has additional copyright sprites in the flash roms for the (c)2000 message.. */ |
| 785 | 840 | ROM_REGION( 0x600000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites, 16x16x5 */ |
| r2844 | r2845 | |
| 787 | 842 | ROM_LOAD( "ver0106_ju02.bin", 0x000000, 0x200000, CRC(b27a4977) SHA1(b7f94bb04d0046538b3938335e6b0cce330ad79c) ) |
| 788 | 843 | /* expand this to take up 0x200000 bytes too so we can decode it */ |
| 789 | 844 | ROM_LOAD16_BYTE( "ver0106_esd5.ju07", 0x400000, 0x040000, CRC(7a3ac887) SHA1(3c759f9bed396bbaf6bd7298a8bd2bd76df3aa6f) ) |
| 790 | ROM_FILL( 0x500000, 0x100000, 0 ) | |
| 845 | ROM_FILL( 0x500000, 0x100000, 0 ) | |
| 791 | 846 | |
| 792 | 847 | ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE ) /* Layers, 16x16x8 */ |
| 793 | 848 | ROM_LOAD16_BYTE( "rom.fu35", 0x000000, 0x200000, CRC(ba46f3dc) SHA1(4ac7695bdf4237654481f7f74f8650d70a51e691) ) |
| 794 | 849 | ROM_LOAD16_BYTE( "rom.fu34", 0x000001, 0x200000, CRC(2895cf09) SHA1(88756fcd589af1986c3881d4080f086afc11b498) ) |
| 795 | 850 | |
| 796 | ROM_REGION( 0x | |
| 851 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* Samples */ | |
| 797 | 852 | ROM_LOAD( "ver0106_esd4.su10", 0x00000, 0x40000, CRC(ac8ae009) SHA1(2c1c30cc4b3e34a5f14d7dfb6f6e18ff21f526f5) ) |
| 798 | 853 | ROM_END |
| 799 | 854 | |
| r2844 | r2845 | |
| 802 | 857 | ROM_LOAD16_BYTE( "esd2.cu02", 0x000000, 0x040000, CRC(4cca802c) SHA1(5e6e81febbb56b7c4630b530e546e7ab59c6c6c1) ) |
| 803 | 858 | ROM_LOAD16_BYTE( "esd1.cu03", 0x000001, 0x040000, CRC(0af1cd0a) SHA1(d2befcb596d83d523317d17b4c1c71f99de0d33e) ) |
| 804 | 859 | |
| 805 | ROM_REGION( 0x84000, REGION_CPU2, 0 ) /* Z80 Code */ | |
| 806 | ROM_LOAD( "esd3.su06", 0x00000, 0x0c000, CRC(2c0c8813) SHA1(ad6b881af4a629a948dcb3c99cea73c20ba1faf4) ) | |
| 807 | ROM_CONTINUE( 0x10000, 0x74000 ) | |
| 860 | ROM_REGION( 0x44000, REGION_CPU2, 0 ) /* Z80 Code */ | |
| 861 | ROM_LOAD( "esd3.su06", 0x00000, 0x0c000, CRC(1b22568c) SHA1(5458e1a798357a6785f8ea1fe9da37768cd4761d) ) | |
| 862 | ROM_CONTINUE( 0x10000, 0x34000) | |
| 808 | 863 | |
| 809 | 864 | ROM_REGION( 0x600000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites, 16x16x5 */ |
| 810 | 865 | ROM_LOAD( "rom.ju01", 0x200000, 0x200000, CRC(1a749fc2) SHA1(feff4b26ee28244b4d092798a176e33e09d5df2c) ) |
| 811 | 866 | ROM_LOAD( "rom.ju02", 0x000000, 0x200000, CRC(7e87e332) SHA1(f90aa00a64a940846d99053c7aa023e3fd5d070b) ) |
| 812 | 867 | /* expand this to take up 0x200000 bytes too so we can decode it */ |
| 813 | 868 | ROM_LOAD16_BYTE( "esd5.ju07", 0x400000, 0x080000, CRC(6cc871cc) SHA1(710b9695c864e4234686993b88d24590d60e1cb9) ) |
| 814 | ROM_FILL( 0x500000, 0x100000, 0 ) | |
| 869 | ROM_FILL( 0x500000, 0x100000, 0 ) | |
| 815 | 870 | |
| 816 | 871 | ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE ) /* Layers, 16x16x8 */ |
| 817 | 872 | ROM_LOAD16_BYTE( "rom.fu35", 0x000000, 0x200000, CRC(ba46f3dc) SHA1(4ac7695bdf4237654481f7f74f8650d70a51e691) ) |
| 818 | 873 | ROM_LOAD16_BYTE( "rom.fu34", 0x000001, 0x200000, CRC(2895cf09) SHA1(88756fcd589af1986c3881d4080f086afc11b498) ) |
| 819 | 874 | |
| 820 | ROM_REGION( 0x80000, REGION_SOUND1, 0 ) /* Samples */ | |
| 821 | ROM_LOAD( "esd4.su10", 0x00000, 0x80000, CRC(14c4a30d) SHA1(d8eb2f08d5293f729cbec1897e3b92b675cc2814) ) | |
| 875 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* Samples */ | |
| 876 | ROM_LOAD( "esd4.su10", 0x00000, 0x40000, CRC(2fbe94ab) SHA1(1bc4a33ec93a80fb598722d2b50bdf3ccaaa984a) ) | |
| 822 | 877 | ROM_END |
| 823 | 878 | |
| 879 | /*************************************************************************** | |
| 824 | 880 | |
| 881 | PCB Layout (Head Panic) | |
| 882 | ---------- | |
| 825 | 883 | |
| 884 | ESD 08-26-1999 | |
| 885 | |-----------------------------------------| | |
| 886 | | 3014 3812 6116 6295 ESD4 | | |
| 887 | |VOL ESD3 Z80 * | | |
| 888 | | PAL ESD6 | | |
| 889 | | 6116 * | | |
| 890 | | 6116 PAL 6116 ESD7 | | |
| 891 | | 6116 |-------| * | | |
| 892 | |J PAL | ESD | * | | |
| 893 | |A PAL |CRTC99 | ESD5 | | |
| 894 | |M PAL | | * | | |
| 895 | |M PAL |-------| | | |
| 896 | |A ESD1 | | |
| 897 | | 68000 ESD2 |-------| | | |
| 898 | | |ACTEL | 6116 | | |
| 899 | | |A40MX04| 6116 | | |
| 900 | | 93C46 MCM6206 | | 6116 | | |
| 901 | | MCM6206 |-------| 6116 | | |
| 902 | | 16MHz PAL MCM6206 | | |
| 903 | | 14MHz PAL MCM6206 ESD8 % ESD9 | | |
| 904 | |-----------------------------------------| | |
| 905 | ||
| 906 | Notes: | |
| 907 | HSync: 15.625kHz | |
| 908 | VSync: 60Hz | |
| 909 | MCM6206 is 32kx8 SRAM | |
| 910 | 6116 is 8kx8 SRAM | |
| 911 | * : Board has positions for 6x standard 32 pin EPROMs but only position ESD5 is populated | |
| 912 | with an EPROM. In between the unpopulated positions are 2x smt pads. These are populated | |
| 913 | with 2x 16M SOP44 smt Mask ROMs. | |
| 914 | % : ROMs ESD8 and ESD9 are also 16M SOP44 smt Mask ROMs, though these are dedicated smt | |
| 915 | locations (i.e. no option for EPROMs at this location) | |
| 916 | ||
| 917 | Note: Some versions of this PCB used larger EPROMs with the data repeated: | |
| 918 | ESD 3 @ SU06 as a 27C040 with data repeated 2x (CRC32 0xC668D443) | |
| 919 | ESD 4 @ SU10 as a 27C040 with data repeated 4x (CRC32 0x5692FE92) | |
| 920 | ||
| 921 | ***************************************************************************/ | |
| 922 | ||
| 923 | ||
| 924 | ROM_START( hedpanic ) /* Story line & game instructions in English */ | |
| 925 | ROM_REGION( 0x080000, REGION_CPU1, 0 ) /* 68000 Code */ | |
| 926 | ROM_LOAD16_BYTE( "esd2.cu03", 0x000000, 0x040000, CRC(7c7be3bb) SHA1(d43ad7a967e1ef79ee0cf50d3842cc9174fbef3a) ) | |
| 927 | ROM_LOAD16_BYTE( "esd1.cu02", 0x000001, 0x040000, CRC(42405e9d) SHA1(0fa088b8bd921e42cedcc4083dfe41bc9888dfd1) ) | |
| 928 | ||
| 929 | ROM_REGION( 0x44000, REGION_CPU2, 0 ) /* Z80 Code */ | |
| 930 | ROM_LOAD( "esd3.su06", 0x00000, 0x0c000, CRC(a88d4424) SHA1(eefb5ac79632931a36f360713c482cd079891f91) ) /* AT27C020 mask rom */ | |
| 931 | ROM_CONTINUE( 0x10000, 0x34000) | |
| 932 | ||
| 933 | ROM_REGION( 0x600000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites, 16x16x5 */ | |
| 934 | ROM_LOAD( "esd6.ju01", 0x200000, 0x200000, CRC(5858372c) SHA1(dc96112587df681d53cf7449bd39477919978325) ) | |
| 935 | ROM_LOAD( "esd7.ju02", 0x000000, 0x200000, CRC(055d525f) SHA1(85ad474691f96e47311a1904015d1c92d3b2d607) ) | |
| 936 | /* expand this to take up 0x200000 bytes too so we can decode it */ | |
| 937 | ROM_LOAD16_BYTE( "esd5.ju07", 0x400000, 0x080000, CRC(bd785921) SHA1(c8bcb38d5aa6f5a27f0dedf7efd1d6737d59b4ca) ) | |
| 938 | ROM_FILL( 0x500000, 0x100000, 0 ) | |
| 939 | ||
| 940 | ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE ) /* Layers, 16x16x8 */ | |
| 941 | ROM_LOAD16_BYTE( "esd8.fu35", 0x000000, 0x200000, CRC(23aceb4f) SHA1(35d9ebc33b9e1515e47750cfcdfc0bf8bf44b71d) ) | |
| 942 | ROM_LOAD16_BYTE( "esd9.fu34", 0x000001, 0x200000, CRC(76b46cd2) SHA1(679cbf50ae5935e8848868081ecef4ec66424f6c) ) | |
| 943 | ||
| 944 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) /* Samples */ | |
| 945 | ROM_LOAD( "esd4.su10", 0x000000, 0x020000, CRC(3c11c590) SHA1(cb33845c3dc0501fff8055c2d66f412881089df1) ) /* AT27010 mask rom */ | |
| 946 | ROM_END | |
| 947 | ||
| 948 | ||
| 949 | ROM_START( hedpanif ) /* Story line in Japanese, game instructions in English */ | |
| 950 | ROM_REGION( 0x080000, REGION_CPU1, 0 ) /* 68000 Code */ | |
| 951 | ROM_LOAD16_BYTE( "esd2", 0x000000, 0x040000, CRC(8cccc691) SHA1(d6a5dd6c21a67638b9023182f77780282b9b04e5) ) | |
| 952 | ROM_LOAD16_BYTE( "esd1", 0x000001, 0x040000, CRC(d8574925) SHA1(bd4990778b90a49aa6b10f8cf6709ce2424f546a) ) | |
| 953 | ||
| 954 | ROM_REGION( 0x44000, REGION_CPU2, 0 ) /* Z80 Code */ | |
| 955 | ROM_LOAD( "esd3.su06", 0x00000, 0x0c000, CRC(a88d4424) SHA1(eefb5ac79632931a36f360713c482cd079891f91) ) /* AT27C020 mask rom */ | |
| 956 | ROM_CONTINUE( 0x10000, 0x34000) | |
| 957 | ||
| 958 | ROM_REGION( 0x600000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites, 16x16x5 */ | |
| 959 | ROM_LOAD( "esd6.ju01", 0x200000, 0x200000, CRC(5858372c) SHA1(dc96112587df681d53cf7449bd39477919978325) ) | |
| 960 | ROM_LOAD( "esd7.ju02", 0x000000, 0x200000, CRC(055d525f) SHA1(85ad474691f96e47311a1904015d1c92d3b2d607) ) | |
| 961 | /* expand this to take up 0x200000 bytes too so we can decode it */ | |
| 962 | ROM_LOAD16_BYTE( "esd5.ju07", 0x400000, 0x080000, CRC(bd785921) SHA1(c8bcb38d5aa6f5a27f0dedf7efd1d6737d59b4ca) ) | |
| 963 | ROM_FILL( 0x500000, 0x100000, 0 ) | |
| 964 | ||
| 965 | ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE ) /* Layers, 16x16x8 */ | |
| 966 | ROM_LOAD16_BYTE( "esd8.fu35", 0x000000, 0x200000, CRC(23aceb4f) SHA1(35d9ebc33b9e1515e47750cfcdfc0bf8bf44b71d) ) | |
| 967 | ROM_LOAD16_BYTE( "esd9.fu34", 0x000001, 0x200000, CRC(76b46cd2) SHA1(679cbf50ae5935e8848868081ecef4ec66424f6c) ) | |
| 968 | ||
| 969 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) /* Samples */ | |
| 970 | ROM_LOAD( "esd4.su10", 0x000000, 0x020000, CRC(3c11c590) SHA1(cb33845c3dc0501fff8055c2d66f412881089df1) ) /* AT27010 mask rom */ | |
| 971 | ROM_END | |
| 972 | ||
| 973 | ||
| 974 | ||
| 826 | 975 | /* Tang Tang |
| 827 | 976 | |
| 828 | 977 | Tang Tang (ESD) |
| r2844 | r2845 | |
| 881 | 1030 | ROM_LOAD16_BYTE( "esd2.cu02", 0x000000, 0x040000, CRC(b6dd6e3d) SHA1(44d2663827c45267eb154c873f3bd2e9e2bf3d3f) ) |
| 882 | 1031 | ROM_LOAD16_BYTE( "esd1.cu03", 0x000001, 0x040000, CRC(b6c0f2f4) SHA1(68ad76e7e380c728dda200a852729e034d9c9f4c) ) |
| 883 | 1032 | |
| 884 | ROM_REGION( 0x | |
| 1033 | ROM_REGION( 0x44000, REGION_CPU2, 0 ) /* Z80 Code */ | |
| 885 | 1034 | ROM_LOAD( "esd3.su06", 0x00000, 0x0c000, CRC(d48ecc5c) SHA1(5015dd775980542eb29a08bffe1a09ea87d56272) ) |
| 886 | ROM_CONTINUE( | |
| 1035 | ROM_CONTINUE( | |
| 887 | 1036 | |
| 888 | 1037 | ROM_REGION( 0x140000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites, 16x16x5 */ |
| 889 | 1038 | ROM_LOAD( "xju04.bin", 0x000000, 0x040000, CRC(f999b9d7) SHA1(9e4d0e68cdc429c7563b8ad51c072d68ffed09dc) ) |
| r2844 | r2845 | |
| 896 | 1045 | ROM_LOAD16_BYTE( "fu35.bin", 0x000000, 0x200000, CRC(84f3f833) SHA1(f84e41d93dc47a58ada800b921a7e5902b7631cd) ) |
| 897 | 1046 | ROM_LOAD16_BYTE( "fu34.bin", 0x000001, 0x200000, CRC(bf91f543) SHA1(7c149fed8b8044850cd6b798622a91c45336cd47) ) |
| 898 | 1047 | |
| 899 | ROM_REGION( 0x | |
| 1048 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) /* Samples */ | |
| 900 | 1049 | ROM_LOAD( "esd4.su10", 0x00000, 0x20000, CRC(f2dfb02d) SHA1(04001488697aad3e5b2d15c9f5a81dc2b7d0952c) ) |
| 901 | 1050 | ROM_END |
| 902 | 1051 | |
| 903 | /* | |
| 1052 | /* | |
| 904 | 1053 | |
| 905 | PCB Layout (Head Panic) | |
| 1054 | SWAT Police (c) 2001 ESD | |
| 1055 | PCB Layout | |
| 906 | 1056 | ---------- |
| 907 | 1057 | |
| 908 | ESD 08-26-1999 | |
| 1058 | ESD made in Korea | |
| 1059 | |-----------------------------------------| | |
| 1060 | | 3014 3812 6116 6295 AT27C020 | | |
| 1061 | |VOL ESD3.SU06 Z80 ESD1.JU03| | |
| 1062 | | PAL | | |
| 1063 | | 6116 ESD2.JU04| | |
| 1064 | | 6116 PAL 6116 | | |
| 1065 | | 6116 PAL |-------| ESD3.JU05| | |
| 1066 | |J PAL | ESD | | | |
| 1067 | |A |CRTC99 | ESD4.JU06| | |
| 1068 | |M PAL | 0016 | | | |
| 1069 | |M PAL |-------| ESD5.JU07| | |
| 1070 | |A 68000 ESD.CU03 | | |
| 1071 | | ESD.CU02 |-------| | | |
| 1072 | | |ACTEL | | | |
| 1073 | | |A40MX04| 6116| | |
| 1074 | | MCM6206 | 0008 | 6116| | |
| 1075 | | MCM6206 |-------| | | |
| 1076 | | 16MHz PAL MCM6206 6116| | |
| 1077 | | 14MHz PAL MCM6206 FU35 FU34 6116| | |
| 1078 | |-----------------------------------------| | |
| 909 | 1079 | |
| 910 | 3014 3812 6116 6295 ESD4 | |
| 911 | ESD3 Z80 * | |
| 912 | 6116 6116 ESD6 * | |
| 913 | 6116 6116 ESD7 * | |
| 914 | ESD_CRTC99 * | |
| 915 | (LARGE QFP) ESD5 * | |
| 916 | ESD1 * | |
| 917 | ESD2 | |
| 918 | 68000 6116 | |
| 919 | MCM6206 ACTEL 6116 | |
| 920 | 93C46 MCM6206 A40MX04 6116 | |
| 921 | 16MHz MCM6206 6116 | |
| 922 | 14MHz MCM6206 ESD8 % ESD9 | |
| 1080 | Notes: | |
| 1081 | 68000 (MC68HC000FN16) | |
| 1082 | Z80 (Z84C00006FEC-Z80CPU) | |
| 1083 | OKI6295 label AD65 (sound) | |
| 1084 | YM3014 label U6614 (sound) | |
| 1085 | YM3812 label U6612 (sound) | |
| 1086 | MCM6206 - 32k x8 SRAM (SOJ28) | |
| 1087 | 6116 - 2k x8 SRAM (SOP28) | |
| 1088 | A40MX04 - Actel A40MX04-F FPGA (PLCC84) | |
| 1089 | CRTC99 - ESD CRTC99 Graphics Controller (QFP240) | |
| 1090 | JU03-8 - 27C040 | |
| 1091 | FU34,FU35 - MX29F1610MC | |
| 923 | 1092 | |
| 1093 | 1x connector JAMMA | |
| 1094 | 1x trimmer (volume) | |
| 1095 | 2x pushbutton | |
| 924 | 1096 | |
| 925 | Notes: | |
| 926 | HSync: 15.625kHz | |
| 927 | VSync: 60Hz | |
| 928 | MCM6206 is 32kx8 SRAM | |
| 929 | 6116 is 8kx8 SRAM | |
| 930 | * : Board has positions for 6x standard 32 pin EPROMs but only position ESD5 is populated | |
| 931 | with an EPROM. In between the unpopulated positions are 2x smt pads. These are populated | |
| 932 | with 2x 16M SOP44 smt Mask ROMs. | |
| 933 | % : ROMs ESD8 and ESD9 are also 16M SOP44 smt Mask ROMs, though these are dedicated smt | |
| 934 | locations (i.e. no option for EPROMs at this location) | |
| 1097 | * : Board has positions for 6x standard 32 pin EPROMs but only 5 positions are populated | |
| 1098 | with an EPROM. | |
| 935 | 1099 | |
| 936 | * | |
| 1100 | * | |
| 937 | 1101 | |
| 938 | ||
| 939 | ROM_START( hedpanic ) | |
| 1102 | ROM_START( swatpolc ) /* SWAT Police */ | |
| 940 | 1103 | ROM_REGION( 0x080000, REGION_CPU1, 0 ) /* 68000 Code */ |
| 941 | ROM_LOAD16_BYTE( "esd2", 0x000000, 0x040000, CRC(8cccc691) SHA1(d6a5dd6c21a67638b9023182f77780282b9b04e5) ) | |
| 942 | ROM_LOAD16_BYTE( "esd1", 0x000001, 0x040000, CRC(d8574925) SHA1(bd4990778b90a49aa6b10f8cf6709ce2424f546a) ) | |
| 1104 | ROM_LOAD16_BYTE( "esd.cu02", 0x000000, 0x040000, CRC(29e0c126) SHA1(7c0356eed4ffdc056b7ec5c1ac07f1c9cc6aeffa) ) /* ESD labels but not numbered */ | |
| 1105 | ROM_LOAD16_BYTE( "esd.cu03", 0x000001, 0x040000, CRC(1070208b) SHA1(1e058774c5aee1de15ffcd26d530b23592286db1) ) /* ESD labels but not numbered */ | |
| 943 | 1106 | |
| 944 | ROM_REGION( 0x84000, REGION_CPU2, 0 ) /* Z80 Code */ | |
| 945 | ROM_LOAD( "esd3", 0x00000, 0x0c000, CRC(c668d443) SHA1(fa66a5dc5cb10e6ccc3fbdd7790091d912767001) ) // 0x040000 of data repeated 2x | |
| 946 | ROM_CONTINUE( 0x10000, 0x74000 ) | |
| 1107 | ROM_REGION( 0x44000, REGION_CPU2, 0 ) /* Z80 Code */ | |
| 1108 | ROM_LOAD( "esd3.su06", 0x00000, 0x0c000, CRC(80e97dbe) SHA1(d6fae689cd3737777f36c980b9a7d9e42b06a467) ) /* 2 roms on PCB with an ESD3 label */ | |
| 1109 | ROM_CONTINUE( 0x10000, 0x34000) | |
| 947 | 1110 | |
| 948 | ROM_REGION( 0x600000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites, 16x16x5 */ | |
| 949 | ROM_LOAD( "esd6", 0x200000, 0x200000, CRC(5858372c) SHA1(dc96112587df681d53cf7449bd39477919978325) ) | |
| 950 | ROM_LOAD( "esd7", 0x000000, 0x200000, CRC(055d525f) SHA1(85ad474691f96e47311a1904015d1c92d3b2d607) ) | |
| 951 | /* expand this to take up 0x200000 bytes too so we can decode it */ | |
| 952 | ROM_LOAD16_BYTE( "esd5", 0x400000, 0x080000, CRC(bd785921) SHA1(c8bcb38d5aa6f5a27f0dedf7efd1d6737d59b4ca) ) | |
| 953 | ROM_FILL( 0x500000, 0x100000, 0 ) | |
| 1111 | ROM_REGION( 0x280000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites, 16x16x5 */ | |
| 1112 | ROM_LOAD( "esd1.ju03", 0x000000, 0x080000, CRC(17fcc5e7) SHA1(ad57d2b0c0062f6f8c7732df57e4d12ca47c1bb8) ) | |
| 1113 | ROM_LOAD( "esd2.ju04", 0x080000, 0x080000, CRC(9c1752f2) SHA1(2e8c377137258498564749413b49e156180e806a) ) | |
| 1114 | ROM_LOAD( "esd3.ju05", 0x100000, 0x080000, CRC(e8d9c092) SHA1(80e1f1d4dad48c7be3d4b72c4a82d5388fd493c7) ) | |
| 1115 | ROM_LOAD( "esd4.ju06", 0x180000, 0x080000, CRC(bde1b130) SHA1(e45a2257f8c4d107dfb7401b5ae1b79951052bc6) ) | |
| 1116 | ROM_LOAD( "esd5.ju07", 0x200000, 0x080000, CRC(d2c27f03) SHA1(7cbdf7f7ff17df16ca81823f69e82ae1cf96b714) ) | |
| 954 | 1117 | |
| 955 | 1118 | ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE ) /* Layers, 16x16x8 */ |
| 956 | ROM_LOAD16_BYTE( "esd8", 0x000000, 0x200000, CRC(23aceb4f) SHA1(35d9ebc33b9e1515e47750cfcdfc0bf8bf44b71d) ) | |
| 957 | ROM_LOAD16_BYTE( "esd9", 0x000001, 0x200000, CRC(76b46cd2) SHA1(679cbf50ae5935e8848868081ecef4ec66424f6c) ) | |
| 1119 | ROM_LOAD16_BYTE( "fu35", 0x000000, 0x200000, CRC(c55897c5) SHA1(f6e0ef1c2fcfe6a511fe787a3abeff4da16d1b54) ) /* No labels on the flash roms */ | |
| 1120 | ROM_LOAD16_BYTE( "fu34", 0x000001, 0x200000, CRC(7117a6a2) SHA1(17c0ab02698cffa0582ed2d2b7dbb7fed8cd9393) ) /* No labels on the flash roms */ | |
| 958 | 1121 | |
| 959 | ROM_REGION( 0x80000, REGION_SOUND1, 0 ) /* Samples */ | |
| 960 | ROM_LOAD( "esd4", 0x000000, 0x080000, CRC(5692fe92) SHA1(4423039cb437ab36d198b212ef394bf1704be404) ) // 0x020000 of data repeated 4x | |
| 1122 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* Samples */ | |
| 1123 | ROM_LOAD( "at27c020.su10", 0x00000, 0x40000, CRC(c43efec2) SHA1(4ef328d8703b81328de09ecc4328763aba06e883) ) /* AT27C020 mask rom with no label */ | |
| 961 | 1124 | ROM_END |
| 962 | 1125 | |
| 963 | 1126 | /*************************************************************************** |
| r2844 | r2845 | |
| 975 | 1138 | /* ESD 08-26-1999 */ |
| 976 | 1139 | GAME( 2000, mchampdx, 0, mchampdx, hedpanic, 0, ROT0, "ESD", "Multi Champ Deluxe (ver. 0106, 06/01/2000)", 0 ) // 06/01/2000 ? |
| 977 | 1140 | GAME( 1999, mchampda, mchampdx, mchampdx, hedpanic, 0, ROT0, "ESD", "Multi Champ Deluxe (ver. 1126, 26/11/1999)", 0 ) // 26/11/1999 ? |
| 978 | GAME( 2000, hedpanic, 0, hedpanic, hedpanic, 0, ROT0, "ESD / Fuuki", "Head Panic (ver. 0315, 15/03/2000)", 0 ) // 15/03/2000 ? | |
| 1141 | GAME( 2000, hedpanic, 0, hedpanic, hedpanic, 0, ROT0, "ESD", "Head Panic (ver. 0117, 17/01/2000)", 0 ) // 17/01/2000 ? | |
| 1142 | GAME( 2000, hedpanif, hedpanic, hedpanic, hedpanic, 0, ROT0, "ESD / Fuuki", "Head Panic (ver. 0315, 15/03/2000)", 0 ) // 15/03/2000 ? | |
| 979 | 1143 | |
| 980 | /* ESD */ | |
| 1144 | /* ESD - This PCB looks identicle to the ESD 08-26-1999 PCB */ | |
| 981 | 1145 | GAME( 2000, tangtang, 0, tangtang, hedpanic, 0, ROT0, "ESD", "Tang Tang (ver. 0526, 26/05/2000)", 0 ) // 26/05/2000 ? |
| 1146 | GAME( 2001, swatpolc, 0, swatpolc, swatpolc, 0, ROT0, "ESD", "SWAT Police ", 0 ) |
| r2844 | r2845 | |
|---|---|---|
| 364 | 364 | #include "machine/eeprom.h" |
| 365 | 365 | #include "machine/53c810.h" |
| 366 | 366 | #include "sound/scsp.h" |
| 367 | #include "includes/model3.h" | |
| 367 | 368 | |
| 368 | 369 | static UINT8 irq_enable; |
| 369 | 370 | static UINT8 irq_state; |
| r2844 | r2845 | |
| 378 | 379 | static int model3_controls_bank; |
| 379 | 380 | static UINT32 real3d_device_id; |
| 380 | 381 | |
| 381 | extern UINT64 *paletteram64; | |
| 382 | ||
| 383 | /* defined in machine/model3.c */ | |
| 384 | extern void model3_machine_init(int step); | |
| 385 | extern int model3_tap_read(void); | |
| 386 | extern void model3_tap_write(int tck, int tms, int tdi, int trst); | |
| 387 | extern void model3_tap_reset(void); | |
| 388 | extern READ32_HANDLER(rtc72421_r); | |
| 389 | extern WRITE32_HANDLER(rtc72421_w); | |
| 390 | ||
| 391 | ||
| 392 | /* defined in video/model3.c */ | |
| 393 | READ64_HANDLER(model3_char_r); | |
| 394 | WRITE64_HANDLER(model3_char_w); | |
| 395 | READ64_HANDLER(model3_tile_r); | |
| 396 | WRITE64_HANDLER(model3_tile_w); | |
| 397 | READ64_HANDLER(model3_vid_reg_r); | |
| 398 | WRITE64_HANDLER(model3_vid_reg_w); | |
| 399 | READ64_HANDLER(model3_palette_r); | |
| 400 | WRITE64_HANDLER(model3_palette_w); | |
| 401 | VIDEO_START(model3); | |
| 402 | VIDEO_UPDATE(model3); | |
| 403 | WRITE64_HANDLER(real3d_cmd_w); | |
| 404 | WRITE64_HANDLER(real3d_display_list_w); | |
| 405 | WRITE64_HANDLER(real3d_polygon_ram_w); | |
| 406 | void real3d_display_list_end(void); | |
| 407 | void real3d_display_list1_dma(UINT32 src, UINT32 dst, int length, int byteswap); | |
| 408 | void real3d_display_list2_dma(UINT32 src, UINT32 dst, int length, int byteswap); | |
| 409 | void real3d_vrom_texture_dma(UINT32 src, UINT32 dst, int length, int byteswap); | |
| 410 | void real3d_texture_fifo_dma(UINT32 src, int length, int byteswap); | |
| 411 | void real3d_polygon_ram_dma(UINT32 src, UINT32 dst, int length, int byteswap); | |
| 412 | ||
| 413 | 382 | static void real3d_dma_callback(UINT32 src, UINT32 dst, int length, int byteswap); |
| 414 | 383 | |
| 415 | 384 | static UINT16 *model3_soundram; |
| r2844 | r2845 | |
| 433 | 402 | } |
| 434 | 403 | |
| 435 | 404 | |
| 436 | #define BYTE_REVERSE32(x) (((x >> 24) & 0xff) | \ | |
| 437 | ((x >> 8) & 0xff00) | \ | |
| 438 | ((x << 8) & 0xff0000) | \ | |
| 439 | ((x << 24) & 0xff000000)) | |
| 440 | ||
| 441 | 405 | static UINT32 pci_device_get_reg(int device, int reg) |
| 442 | 406 | { |
| 443 | 407 | switch(device) |
| r2844 | r2845 | |
| 581 | 545 | { |
| 582 | 546 | if (ACCESSING_BITS_32_63) |
| 583 | 547 | { |
| 584 | UINT32 d = | |
| 548 | UINT32 d = FLIPENDIAN_INT | |
| 585 | 549 | mpc105_addr = data >> 32; |
| 586 | 550 | |
| 587 | 551 | pci_bus = (d >> 16) & 0xff; |
| r2844 | r2845 | |
| 594 | 558 | static READ64_HANDLER( mpc105_data_r ) |
| 595 | 559 | { |
| 596 | 560 | if(pci_device == 0) { |
| 597 | return ((UINT64)(BYTE_REVERSE32(mpc105_regs[(pci_reg/2)+1])) << 32) | | |
| 598 | ((UINT64)(BYTE_REVERSE32(mpc105_regs[(pci_reg/2)+0]))); | |
| 561 | return ((UINT64)(FLIPENDIAN_INT32(mpc105_regs[(pci_reg/2)+1])) << 32) | | |
| 562 | ((UINT64)(FLIPENDIAN_INT32(mpc105_regs[(pci_reg/2)+0]))); | |
| 599 | 563 | } |
| 600 | return | |
| 564 | return FLIPENDIAN_INT | |
| 601 | 565 | } |
| 602 | 566 | |
| 603 | 567 | static WRITE64_HANDLER( mpc105_data_w ) |
| 604 | 568 | { |
| 605 | 569 | if(pci_device == 0) { |
| 606 | mpc105_regs[(pci_reg/2)+1] = BYTE_REVERSE32((UINT32)(data >> 32)); | |
| 607 | mpc105_regs[(pci_reg/2)+0] = BYTE_REVERSE32((UINT32)(data)); | |
| 570 | mpc105_regs[(pci_reg/2)+1] = FLIPENDIAN_INT32((UINT32)(data >> 32)); | |
| 571 | mpc105_regs[(pci_reg/2)+0] = FLIPENDIAN_INT32((UINT32)(data)); | |
| 608 | 572 | return; |
| 609 | 573 | } |
| 610 | 574 | if (ACCESSING_BITS_0_31) |
| 611 | 575 | { |
| 612 | pci_device_set_reg(pci_device, pci_reg, | |
| 576 | pci_device_set_reg(pci_device, pci_reg, FLIPENDIAN_INT | |
| 613 | 577 | } |
| 614 | 578 | } |
| 615 | 579 | |
| r2844 | r2845 | |
| 659 | 623 | { |
| 660 | 624 | if (ACCESSING_BITS_32_63) |
| 661 | 625 | { |
| 662 | UINT32 d = | |
| 626 | UINT32 d = FLIPENDIAN_INT | |
| 663 | 627 | |
| 664 | 628 | if (((d >> 8) & 0xffffff) == 0x800000) |
| 665 | 629 | { |
| r2844 | r2845 | |
| 680 | 644 | static READ64_HANDLER( mpc106_data_r ) |
| 681 | 645 | { |
| 682 | 646 | if(pci_device == 0) { |
| 683 | return ((UINT64)(BYTE_REVERSE32(mpc106_regs[(pci_reg/2)+1])) << 32) | | |
| 684 | ((UINT64)(BYTE_REVERSE32(mpc106_regs[(pci_reg/2)+0]))); | |
| 647 | return ((UINT64)(FLIPENDIAN_INT32(mpc106_regs[(pci_reg/2)+1])) << 32) | | |
| 648 | ((UINT64)(FLIPENDIAN_INT32(mpc106_regs[(pci_reg/2)+0]))); | |
| 685 | 649 | } |
| 686 | 650 | if (ACCESSING_BITS_32_63) |
| 687 | 651 | { |
| 688 | return (UINT64)( | |
| 652 | return (UINT64)(FLIPENDIAN_INT | |
| 689 | 653 | } |
| 690 | 654 | else |
| 691 | 655 | { |
| 692 | return (UINT64)( | |
| 656 | return (UINT64)(FLIPENDIAN_INT | |
| 693 | 657 | } |
| 694 | 658 | } |
| 695 | 659 | |
| 696 | 660 | static WRITE64_HANDLER( mpc106_data_w ) |
| 697 | 661 | { |
| 698 | 662 | if(pci_device == 0) { |
| 699 | mpc106_regs[(pci_reg/2)+1] = BYTE_REVERSE32((UINT32)(data >> 32)); | |
| 700 | mpc106_regs[(pci_reg/2)+0] = BYTE_REVERSE32((UINT32)(data)); | |
| 663 | mpc106_regs[(pci_reg/2)+1] = FLIPENDIAN_INT32((UINT32)(data >> 32)); | |
| 664 | mpc106_regs[(pci_reg/2)+0] = FLIPENDIAN_INT32((UINT32)(data)); | |
| 701 | 665 | return; |
| 702 | 666 | } |
| 703 | 667 | if (ACCESSING_BITS_0_31) |
| 704 | 668 | { |
| 705 | pci_device_set_reg(pci_device, pci_reg, | |
| 669 | pci_device_set_reg(pci_device, pci_reg, FLIPENDIAN_INT | |
| 706 | 670 | } |
| 707 | 671 | } |
| 708 | 672 | |
| r2844 | r2845 | |
| 745 | 709 | int reg = offset*8; |
| 746 | 710 | UINT64 r = 0; |
| 747 | 711 | if (ACCESSING_BITS_56_63) { |
| 748 | r |= (UINT64)lsi53c810_reg_r(reg+0) << 56; | |
| 712 | r |= (UINT64)lsi53c810_reg_r(machine, reg+0) << 56; | |
| 749 | 713 | } |
| 750 | 714 | if (ACCESSING_BITS_48_55) { |
| 751 | r |= (UINT64)lsi53c810_reg_r(reg+1) << 48; | |
| 715 | r |= (UINT64)lsi53c810_reg_r(machine, reg+1) << 48; | |
| 752 | 716 | } |
| 753 | 717 | if (ACCESSING_BITS_40_47) { |
| 754 | r |= (UINT64)lsi53c810_reg_r(reg+2) << 40; | |
| 718 | r |= (UINT64)lsi53c810_reg_r(machine, reg+2) << 40; | |
| 755 | 719 | } |
| 756 | 720 | if (ACCESSING_BITS_32_39) { |
| 757 | r |= (UINT64)lsi53c810_reg_r(reg+3) << 32; | |
| 721 | r |= (UINT64)lsi53c810_reg_r(machine, reg+3) << 32; | |
| 758 | 722 | } |
| 759 | 723 | if (ACCESSING_BITS_24_31) { |
| 760 | r |= (UINT64)lsi53c810_reg_r(reg+4) << 24; | |
| 724 | r |= (UINT64)lsi53c810_reg_r(machine, reg+4) << 24; | |
| 761 | 725 | } |
| 762 | 726 | if (ACCESSING_BITS_16_23) { |
| 763 | r |= (UINT64)lsi53c810_reg_r(reg+5) << 16; | |
| 727 | r |= (UINT64)lsi53c810_reg_r(machine, reg+5) << 16; | |
| 764 | 728 | } |
| 765 | 729 | if (ACCESSING_BITS_8_15) { |
| 766 | r |= (UINT64)lsi53c810_reg_r(reg+6) << 8; | |
| 730 | r |= (UINT64)lsi53c810_reg_r(machine, reg+6) << 8; | |
| 767 | 731 | } |
| 768 | 732 | if (ACCESSING_BITS_0_7) { |
| 769 | r |= (UINT64)lsi53c810_reg_r(reg+7) << 0; | |
| 733 | r |= (UINT64)lsi53c810_reg_r(machine, reg+7) << 0; | |
| 770 | 734 | } |
| 771 | 735 | |
| 772 | 736 | return r; |
| r2844 | r2845 | |
| 805 | 769 | { |
| 806 | 770 | UINT32 result; |
| 807 | 771 | result = program_read_dword_64be(dsp); |
| 808 | return | |
| 772 | return FLIPENDIAN_INT | |
| 809 | 773 | } |
| 810 | 774 | |
| 811 | 775 | static void scsi_irq_callback(running_machine *machine, int state) |
| 812 | 776 | { |
| 813 | 777 | scsi_irq_state = state; |
| 814 | // model3_irq_state |= irq_enable & ~0x60; /* FIXME: enable only SCSI interrupt */ | |
| 815 | 778 | update_irq_state(machine); |
| 816 | 779 | } |
| 817 | 780 | |
| r2844 | r2845 | |
| 847 | 810 | { |
| 848 | 811 | case 0: |
| 849 | 812 | if(ACCESSING_BITS_32_63) { /* DMA source address */ |
| 850 | dma_source = | |
| 813 | dma_source = FLIPENDIAN_INT | |
| 851 | 814 | return; |
| 852 | 815 | } |
| 853 | 816 | if(ACCESSING_BITS_0_31) { /* DMA destination address */ |
| 854 | dma_dest = | |
| 817 | dma_dest = FLIPENDIAN_INT | |
| 855 | 818 | return; |
| 856 | 819 | } |
| 857 | 820 | break; |
| 858 | 821 | case 1: |
| 859 | 822 | if(ACCESSING_BITS_32_63) /* DMA length */ |
| 860 | 823 | { |
| 861 | int length = | |
| 824 | int length = FLIPENDIAN_INT | |
| 862 | 825 | if (dma_endian & 0x80) |
| 863 | 826 | { |
| 864 | 827 | real3d_dma_callback(dma_source, dma_dest, length, 0); |
| r2844 | r2845 | |
| 887 | 850 | break; |
| 888 | 851 | case 2: |
| 889 | 852 | if(ACCESSING_BITS_32_63) { /* DMA command */ |
| 890 | UINT32 cmd = | |
| 853 | UINT32 cmd = FLIPENDIAN_INT | |
| 891 | 854 | if(cmd & 0x20000000) { |
| 892 | dma_data = | |
| 855 | dma_data = FLIPENDIAN_INT | |
| 893 | 856 | } |
| 894 | 857 | else if(cmd & 0x80000000) { |
| 895 | 858 | dma_status ^= 0xffffffff; |
| r2844 | r2845 | |
| 1012 | 975 | lsi53c810_exit(&scsi_intf); |
| 1013 | 976 | } |
| 1014 | 977 | |
| 978 | static void configure_fast_ram(running_machine *machine) | |
| 979 | { | |
| 980 | /* set conservative DRC options */ | |
| 981 | cpunum_set_info_int(0, CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS - PPCDRC_ACCURATE_SINGLES); | |
| 982 | ||
| 983 | /* configure fast RAM regions for DRC */ | |
| 984 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_SELECT, 0); | |
| 985 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_START, 0x00000000); | |
| 986 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_END, 0x007fffff); | |
| 987 | cpunum_set_info_ptr(0, CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram); | |
| 988 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_READONLY, 0); | |
| 989 | } | |
| 990 | ||
| 1015 | 991 | static MACHINE_START(model3_10) |
| 1016 | 992 | { |
| 1017 | 993 | lsi53c810_init(&scsi_intf); |
| 1018 | 994 | add_exit_callback(machine, model3_exit); |
| 995 | configure_fast_ram(machine); | |
| 1019 | 996 | } |
| 1020 | 997 | static MACHINE_START(model3_15) |
| 1021 | 998 | { |
| 1022 | 999 | lsi53c810_init(&scsi_intf); |
| 1023 | 1000 | add_exit_callback(machine, model3_exit); |
| 1001 | configure_fast_ram(machine); | |
| 1024 | 1002 | } |
| 1003 | static MACHINE_START(model3_20) | |
| 1004 | { | |
| 1005 | configure_fast_ram(machine); | |
| 1006 | } | |
| 1007 | static MACHINE_START(model3_21) | |
| 1008 | { | |
| 1009 | configure_fast_ram(machine); | |
| 1010 | } | |
| 1025 | 1011 | |
| 1026 | 1012 | static void model3_init(running_machine *machine, int step) |
| 1027 | 1013 | { |
| r2844 | r2845 | |
| 1332 | 1318 | static READ64_HANDLER(real3d_status_r) |
| 1333 | 1319 | { |
| 1334 | 1320 | real3d_status ^= U64(0xffffffffffffffff); |
| 1321 | if (offset == 0) | |
| 1322 | { | |
| 1323 | /* pretty sure this is VBLANK */ | |
| 1324 | real3d_status &= ~U64(0x0000000200000000); | |
| 1325 | if (video_screen_get_vblank(machine->primary_screen)) | |
| 1326 | real3d_status |= U64(0x0000000200000000); | |
| 1327 | return real3d_status; | |
| 1328 | } | |
| 1335 | 1329 | return real3d_status; |
| 1336 | 1330 | } |
| 1337 | 1331 | |
| r2844 | r2845 | |
| 4118 | 4112 | MDRV_SCREEN_ADD("main", RASTER) |
| 4119 | 4113 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 4120 | 4114 | MDRV_SCREEN_REFRESH_RATE(60) |
| 4121 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 4122 | MDRV_SCREEN_SIZE(496, 384) | |
| 4123 | 4115 | MDRV_SCREEN_VISIBLE_AREA(0, 495, 0, 383) |
| 4116 | MDRV_SCREEN_SIZE(512, 400) | |
| 4124 | 4117 | |
| 4125 | 4118 | MDRV_PALETTE_LENGTH(32768) |
| 4126 | 4119 | MDRV_PALETTE_INIT(RRRRR_GGGGG_BBBBB) |
| r2844 | r2845 | |
| 4156 | 4149 | MDRV_SCREEN_ADD("main", RASTER) |
| 4157 | 4150 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 4158 | 4151 | MDRV_SCREEN_REFRESH_RATE(60) |
| 4159 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 4160 | MDRV_SCREEN_SIZE(496, 384) | |
| 4161 | 4152 | MDRV_SCREEN_VISIBLE_AREA(0, 495, 0, 383) |
| 4153 | MDRV_SCREEN_SIZE(496, 400) | |
| 4162 | 4154 | |
| 4163 | 4155 | MDRV_PALETTE_LENGTH(32768) |
| 4164 | 4156 | MDRV_PALETTE_INIT(RRRRR_GGGGG_BBBBB) |
| r2844 | r2845 | |
| 4186 | 4178 | MDRV_CPU_ADD(M68000, 12000000) |
| 4187 | 4179 | MDRV_CPU_PROGRAM_MAP(model3_snd, 0) |
| 4188 | 4180 | |
| 4181 | MDRV_MACHINE_START(model3_20) | |
| 4189 | 4182 | MDRV_MACHINE_RESET(model3_20) |
| 4190 | 4183 | MDRV_NVRAM_HANDLER(model3) |
| 4191 | 4184 | |
| r2844 | r2845 | |
| 4193 | 4186 | MDRV_SCREEN_ADD("main", RASTER) |
| 4194 | 4187 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 4195 | 4188 | MDRV_SCREEN_REFRESH_RATE(60) |
| 4196 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 4197 | MDRV_SCREEN_SIZE(496, 384) | |
| 4198 | 4189 | MDRV_SCREEN_VISIBLE_AREA(0, 495, 0, 383) |
| 4190 | MDRV_SCREEN_SIZE(496, 400) | |
| 4199 | 4191 | |
| 4200 | 4192 | MDRV_PALETTE_LENGTH(32768) |
| 4201 | 4193 | MDRV_PALETTE_INIT(RRRRR_GGGGG_BBBBB) |
| r2844 | r2845 | |
| 4223 | 4215 | MDRV_CPU_ADD(M68000, 12000000) |
| 4224 | 4216 | MDRV_CPU_PROGRAM_MAP(model3_snd, 0) |
| 4225 | 4217 | |
| 4218 | MDRV_MACHINE_START(model3_21) | |
| 4226 | 4219 | MDRV_MACHINE_RESET(model3_21) |
| 4227 | 4220 | MDRV_NVRAM_HANDLER(model3) |
| 4228 | 4221 | |
| r2844 | r2845 | |
| 4231 | 4224 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 4232 | 4225 | MDRV_SCREEN_REFRESH_RATE(60) |
| 4233 | 4226 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 4234 | MDRV_SCREEN_SIZE(496, 384) | |
| 4235 | 4227 | MDRV_SCREEN_VISIBLE_AREA(0, 495, 0, 383) |
| 4228 | MDRV_SCREEN_SIZE(496, 400) | |
| 4236 | 4229 | |
| 4237 | 4230 | MDRV_PALETTE_LENGTH(32768) |
| 4238 | 4231 | MDRV_PALETTE_INIT(RRRRR_GGGGG_BBBBB) |
| r2844 | r2845 | |
|---|---|---|
| 1790 | 1790 | } |
| 1791 | 1791 | |
| 1792 | 1792 | |
| 1793 | extern READ16_HANDLER( PSTARS_protram_r ); | |
| 1794 | extern READ16_HANDLER( PSTARS_r16 ); | |
| 1795 | extern WRITE16_HANDLER( PSTARS_w16 ); | |
| 1796 | ||
| 1797 | 1793 | static DRIVER_INIT( pstar ) |
| 1798 | 1794 | { |
| 1799 | 1795 | pgm_basic_init(); |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | /****************************************************************** |
| 2 | 2 | |
| 3 | 3 | Nazionale Elettronica + others (mostly Italian) Gambling games |
| 4 | based on H8/3048 + OKI 6295 or similar. | |
| 4 | mostly based on H8/3048 + OKI 6295 or similar. | |
| 5 | 5 | . |
| 6 | 6 | These all use MCUs with internal ROM for their programs, |
| 7 | 7 | they can't be dumped easily, and thus we can't emulate |
| r2844 | r2845 | |
| 48 | 48 | #define MAIN_CLOCK XTAL_30MHz |
| 49 | 49 | #define SND_CLOCK XTAL_1MHz |
| 50 | 50 | |
| 51 | #define MNUMBER_MAIN_CLOCK XTAL_24MHz | |
| 52 | #define MNUMBER_SND_CLOCK XTAL_16MHz | |
| 53 | ||
| 54 | #define EJOLLYX5_MAIN_CLOCK XTAL_16MHz | |
| 55 | ||
| 51 | 56 | #include "driver.h" |
| 52 | 57 | #include "cpu/h83002/h83002.h" |
| 53 | 58 | #include "sound/okim6295.h" |
| r2844 | r2845 | |
| 57 | 62 | * Video Hardware * |
| 58 | 63 | *************************/ |
| 59 | 64 | |
| 60 | VIDEO_START( itgamble ) | |
| 65 | static VIDEO_START( itgamble ) | |
| 61 | 66 | { |
| 62 | 67 | } |
| 63 | 68 | |
| 64 | VIDEO_UPDATE( itgamble ) | |
| 69 | static VIDEO_UPDATE( itgamble ) | |
| 65 | 70 | { |
| 66 | 71 | return 0; |
| 67 | 72 | } |
| r2844 | r2845 | |
| 163 | 168 | * Machine Reset * |
| 164 | 169 | **************************/ |
| 165 | 170 | |
| 166 | MACHINE_RESET( itgamble ) | |
| 171 | static MACHINE_RESET( itgamble ) | |
| 167 | 172 | { |
| 168 | 173 | /* stop the CPU, we have no code for it anyway */ |
| 169 | 174 | cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, ASSERT_LINE); |
| r2844 | r2845 | |
| 196 | 201 | |
| 197 | 202 | /* sound hardware */ |
| 198 | 203 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 199 | MDRV_SOUND_ADD(OKIM6295, SND_CLOCK) /* 1MHz resonator */ | |
| 204 | MDRV_SOUND_ADD_TAG("oki", OKIM6295, SND_CLOCK) /* 1MHz resonator */ | |
| 200 | 205 | MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) |
| 201 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", | |
| 206 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 202 | 207 | MACHINE_DRIVER_END |
| 203 | 208 | |
| 204 | 209 | |
| 210 | static MACHINE_DRIVER_START( mnumber ) | |
| 211 | ||
| 212 | MDRV_IMPORT_FROM(itgamble) | |
| 213 | MDRV_CPU_REPLACE("main", H83044, MNUMBER_MAIN_CLOCK/2) /* probably the wrong CPU */ | |
| 214 | ||
| 215 | MDRV_SOUND_REPLACE("oki", OKIM6295, MNUMBER_SND_CLOCK/16) | |
| 216 | MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) /* clock frequency & pin 7 not verified */ | |
| 217 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 218 | MACHINE_DRIVER_END | |
| 219 | ||
| 220 | ||
| 221 | static MACHINE_DRIVER_START( ejollyx5 ) | |
| 222 | ||
| 223 | MDRV_IMPORT_FROM(itgamble) | |
| 224 | /* wrong CPU. we need a Renesas M16/62A 16bit microcomputer core */ | |
| 225 | MDRV_CPU_REPLACE("main", H83044, EJOLLYX5_MAIN_CLOCK/2) /* up to 10MHz.*/ | |
| 226 | ||
| 227 | MDRV_SOUND_REPLACE("oki", OKIM6295, MNUMBER_SND_CLOCK/16) | |
| 228 | MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) /* clock frequency & pin 7 not verified */ | |
| 229 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 230 | MACHINE_DRIVER_END | |
| 231 | ||
| 232 | ||
| 205 | 233 | /************************* |
| 206 | 234 | * Rom Load * |
| 207 | 235 | *************************/ |
| r2844 | r2845 | |
| 469 | 497 | ROM_REGION( 0x1000000, REGION_CPU1, 0 ) /* all the program code is in here */ |
| 470 | 498 | ROM_LOAD( "euro2k2a_ver2.0_hd64f3048f16.mcu", 0x00000, 0x4000, NO_DUMP ) |
| 471 | 499 | |
| 472 | ROM_REGION( 0x1c0000, REGION_GFX1, 0 ) | |
| 500 | ROM_REGION( 0x1c0000, REGION_GFX1, 0 ) | |
| 473 | 501 | ROM_LOAD( "4a.ic18", 0x000000, 0x80000, CRC(5decae2d) SHA1(d918aad0e2a1249b18677833f743c92fb678050a) ) |
| 474 | 502 | ROM_LOAD( "5a.ic17", 0x080000, 0x80000, CRC(8f1bbbf3) SHA1(5efcf77674f8737fc1b98881acebacb26b10adc1) ) |
| 475 | 503 | ROM_LOAD( "2a.ic20", 0x100000, 0x40000, CRC(f9bffb07) SHA1(efba175189d99a4548739a72f8a1f03c2782a3d0) ) |
| 476 | 504 | ROM_LOAD( "3a.ic19", 0x140000, 0x80000, CRC(56c8a73d) SHA1(49b44e5604cd8675d8f9770e5fb68dad4394e11d) ) /* identical halves */ |
| 477 | 505 | |
| 478 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) | |
| 506 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* M6295 samples */ | |
| 479 | 507 | ROM_LOAD( "1.ic25", 0x00000, 0x40000, CRC(4fe79e43) SHA1(7c154cb00e9b64fbdcc218280f2183b816cef20b) ) |
| 480 | 508 | ROM_END |
| 481 | 509 | |
| 482 | 510 | |
| 511 | /********** DIFFERENT HARDWARE **********/ | |
| 512 | ||
| 513 | ||
| 514 | /* Mystery Number | |
| 515 | ||
| 516 | CPU: | |
| 517 | ||
| 518 | 1x HD64F3048F16 (main)(u2) | |
| 519 | 3x XC9572 (u29,u33,u34) | |
| 520 | 1x M6295 (u5)(sound) | |
| 521 | 1x oscillator 24.000 MHz. | |
| 522 | 1x oscillator 16.000 MHz. | |
| 523 | ||
| 524 | ROMs: | |
| 525 | ||
| 526 | 4x M27C4001 (1,2,3,4)(main) | |
| 527 | 1x AM27C020 (5)(sound) | |
| 528 | ||
| 529 | Note: | |
| 530 | ||
| 531 | 1x JAMMA edge connector | |
| 532 | 1x 8 legs jumper (jp1) | |
| 533 | 1x battery | |
| 534 | 1x 8x2 DIP switches | |
| 535 | 1x trimmer (volume) | |
| 536 | ||
| 537 | */ | |
| 538 | ||
| 539 | ROM_START( mnumber ) /* clocks should be changed for this game */ | |
| 540 | ROM_REGION( 0x1000000, REGION_CPU1, 0 ) /* all the program code is in here */ | |
| 541 | ROM_LOAD( "mnumber_hd64f3048f16.mcu", 0x00000, 0x4000, NO_DUMP ) | |
| 542 | ||
| 543 | ROM_REGION( 0x200000, REGION_GFX1, 0 ) /* different encoded gfx */ | |
| 544 | ROM_LOAD( "mysterynumber3.u20", 0x000000, 0x80000, CRC(251f1e11) SHA1(e8c90b289e76cea6a541b701859be6465a381668) ) | |
| 545 | ROM_LOAD( "mysterynumber4.u21", 0x080000, 0x80000, CRC(2b8744e4) SHA1(8a12c6f300818de3738e7c44c7df71c432cb9975) ) | |
| 546 | ROM_LOAD( "mysterynumber1.u22", 0x100000, 0x80000, CRC(d2ce1f61) SHA1(8f30407050fc102191747996258d4b5da3a0d994) ) | |
| 547 | ROM_LOAD( "mysterynumber2.u19", 0x180000, 0x80000, CRC(7b3a3b32) SHA1(9db46aa12077a48951056705491da1cce747c374) ) /* identical halves */ | |
| 548 | ||
| 549 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* M6295 samples */ | |
| 550 | ROM_LOAD( "mysterynumber5.u6", 0x00000, 0x40000, CRC(80aba466) SHA1(e9bf7e1c3d1c6b1b0dba43dd79a71f89e63df814) ) | |
| 551 | ROM_END | |
| 552 | ||
| 553 | ||
| 483 | 554 | /************************* |
| 484 | 555 | * Game Drivers * |
| 485 | 556 | *************************/ |
| r2844 | r2845 | |
| 491 | 562 | GAME( 2001, laperlag, 0, itgamble, itgamble, 0, ROT0, "Nazionale Elettronica", "La Perla Nera Gold (Ver 2.0)", GAME_NOT_WORKING ) |
| 492 | 563 | GAME( 2001, euro2k2, 0, itgamble, itgamble, 0, ROT0, "Nazionale Elettronica", "Europa 2002 (Ver 2.0, set 1)", GAME_NOT_WORKING ) |
| 493 | 564 | GAME( 2001, euro2k2a, euro2k2, itgamble, itgamble, 0, ROT0, "Nazionale Elettronica", "Europa 2002 (Ver 2.0, set 2)", GAME_NOT_WORKING ) |
| 565 | ||
| 566 | /* different hardware */ | |
| 567 | GAME( 200?, mnumber, 0, mnumber, itgamble, 0, ROT0, "M.M. - B.R.L.", "Mystery Number", GAME_NOT_WORKING ) |
| r2844 | r2845 | |
|---|---|---|
| 110 | 110 | |
| 111 | 111 | static INTERRUPT_GEN( capbowl_interrupt ) |
| 112 | 112 | { |
| 113 | if (input_port_read | |
| 113 | if (input_port_read | |
| 114 | 114 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); /* trigger self test */ |
| 115 | 115 | } |
| 116 | 116 | |
| r2844 | r2845 | |
| 162 | 162 | |
| 163 | 163 | static READ8_HANDLER( track_0_r ) |
| 164 | 164 | { |
| 165 | return (input_port_read | |
| 165 | return (input_port_read | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | static READ8_HANDLER( track_1_r ) |
| 170 | 170 | { |
| 171 | return (input_port_read | |
| 171 | return (input_port_read | |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
| 175 | 175 | static WRITE8_HANDLER( track_reset_w ) |
| 176 | 176 | { |
| 177 | 177 | /* reset the trackball counters */ |
| 178 | last_trackball_val[0] = input_port_read_indexed(machine, 2); | |
| 179 | last_trackball_val[1] = input_port_read_indexed(machine, 3); | |
| 178 | last_trackball_val[0] = input_port_read(machine, "TRACKY"); | |
| 179 | last_trackball_val[1] = input_port_read(machine, "TRACKX"); | |
| 180 | 180 | |
| 181 | 181 | watchdog_reset_w(machine, offset, data); |
| 182 | 182 | } |
| r2844 | r2845 | |
| 293 | 293 | *************************************/ |
| 294 | 294 | |
| 295 | 295 | static INPUT_PORTS_START( capbowl ) |
| 296 | PORT_START /* IN0 */ | |
| 296 | PORT_START_TAG("IN0") /* IN0 */ | |
| 297 | 297 | /* low 4 bits are for the trackball */ |
| 298 | 298 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 299 | 299 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| r2844 | r2845 | |
| 302 | 302 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) |
| 303 | 303 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 304 | 304 | |
| 305 | PORT_START /* IN1 */ | |
| 305 | PORT_START_TAG("IN1") /* IN1 */ | |
| 306 | 306 | /* low 4 bits are for the trackball */ |
| 307 | 307 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 308 | 308 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 309 | 309 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) |
| 310 | 310 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 311 | 311 | |
| 312 | PORT_START /* FAKE */ | |
| 312 | PORT_START_TAG("TRACKY") /* FAKE */ | |
| 313 | 313 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(40) PORT_REVERSE |
| 314 | 314 | |
| 315 | PORT_START /* FAKE */ | |
| 315 | PORT_START_TAG("TRACKX") /* FAKE */ | |
| 316 | 316 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(40) |
| 317 | 317 | |
| 318 | PORT_START /* FAKE */ | |
| 318 | PORT_START_TAG("SERVICE") /* FAKE */ | |
| 319 | 319 | /* This fake input port is used to get the status of the F2 key, */ |
| 320 | 320 | /* and activate the test mode, which is triggered by a NMI */ |
| 321 | 321 | PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH ) |
| r2844 | r2845 | |
|---|---|---|
| 267 | 267 | * |
| 268 | 268 | *************************************/ |
| 269 | 269 | |
| 270 | static READ32_HANDLER( input_0_r ) | |
| 271 | { | |
| 272 | return input_port_read_indexed(machine, 0); | |
| 273 | } | |
| 274 | ||
| 275 | ||
| 276 | static READ32_HANDLER( input_1_r ) | |
| 277 | { | |
| 278 | return input_port_read_indexed(machine, 1); | |
| 279 | } | |
| 280 | ||
| 281 | ||
| 282 | 270 | static READ32_HANDLER( input_2_r ) |
| 283 | 271 | { |
| 284 | int result = input_port_read | |
| 272 | int result = input_port_read | |
| 285 | 273 | if (atarigen_sound_to_cpu_ready) result ^= 0x10; |
| 286 | 274 | if (atarigen_cpu_to_sound_ready) result ^= 0x20; |
| 287 | 275 | return result; |
| 288 | 276 | } |
| 289 | 277 | |
| 290 | 278 | |
| 291 | static READ32_HANDLER( input_3_r ) | |
| 292 | { | |
| 293 | return input_port_read_indexed(machine, 3); | |
| 294 | } | |
| 295 | 279 | |
| 296 | ||
| 297 | ||
| 298 | 280 | /************************************* |
| 299 | 281 | * |
| 300 | 282 | * Sound communication |
| r2844 | r2845 | |
| 348 | 330 | AM_RANGE(0x41000000, 0x41000003) AM_READWRITE(sound_data_r, sound_data_w) |
| 349 | 331 | AM_RANGE(0x41000100, 0x41000103) AM_READ(interrupt_control_r) |
| 350 | 332 | AM_RANGE(0x41000100, 0x4100011f) AM_WRITE(interrupt_control_w) |
| 351 | AM_RANGE(0x41000200, 0x41000203) AM_READ(input_0_r) | |
| 352 | AM_RANGE(0x41000204, 0x41000207) AM_READ(input_1_r) | |
| 333 | AM_RANGE(0x41000200, 0x41000203) AM_READ_PORT("IN1") | |
| 334 | AM_RANGE(0x41000204, 0x41000207) AM_READ_PORT("IN0") | |
| 353 | 335 | AM_RANGE(0x41000208, 0x4100020f) AM_WRITE(sound_reset_w) |
| 354 | 336 | AM_RANGE(0x41000220, 0x41000227) AM_WRITE(coin_count_w) |
| 355 | 337 | AM_RANGE(0x41000300, 0x41000303) AM_READ(input_2_r) |
| 356 | AM_RANGE(0x41000304, 0x41000307) AM_READ | |
| 338 | AM_RANGE(0x41000304, 0x41000307) AM_READ | |
| 357 | 339 | AM_RANGE(0x41000400, 0x41000403) AM_WRITE(SMH_RAM) AM_BASE(&beathead_palette_select) |
| 358 | 340 | AM_RANGE(0x41000500, 0x41000503) AM_WRITE(eeprom_enable_w) |
| 359 | 341 | AM_RANGE(0x41000600, 0x41000603) AM_WRITE(beathead_finescroll_w) |
| r2844 | r2845 | |
| 378 | 360 | *************************************/ |
| 379 | 361 | |
| 380 | 362 | static INPUT_PORTS_START( beathead ) |
| 381 | PORT_START | |
| 382 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 383 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 384 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 385 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 386 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) | |
| 387 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) | |
| 388 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) | |
| 389 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) | |
| 390 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 391 | ||
| 392 | PORT_START | |
| 363 | PORT_START_TAG("IN0") /* Player 1 */ | |
| 393 | 364 | PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 394 | 365 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 395 | 366 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| r2844 | r2845 | |
| 400 | 371 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 401 | 372 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 402 | 373 | |
| 403 | PORT_START | |
| 374 | PORT_START_TAG("IN1") /* Player 2 */ | |
| 375 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 376 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 377 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 378 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 379 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) | |
| 380 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) | |
| 381 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) | |
| 382 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) | |
| 383 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 384 | ||
| 385 | PORT_START_TAG("IN2") | |
| 404 | 386 | PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 405 | 387 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SPECIAL ) |
| 406 | 388 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SPECIAL ) |
| 407 | 389 | PORT_SERVICE( 0x0040, IP_ACTIVE_LOW ) |
| 408 | 390 | PORT_BIT( 0xff80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 409 | 391 | |
| 410 | PORT_START | |
| 392 | PORT_START_TAG("IN3") | |
| 411 | 393 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 412 | 394 | PORT_BIT( 0x0006, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 413 | 395 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 ) |
| r2844 | r2845 | |
|---|---|---|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /* update the playfield and motion objects */ |
| 71 | skullxbo_scanline_update(scanline); | |
| 71 | skullxbo_scanline_update(screen->machine, scanline); | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 |
| r2844 | r2845 | |
|---|---|---|
| 362 | 362 | |
| 363 | 363 | static MACHINE_RESET( konamigq ) |
| 364 | 364 | { |
| 365 | psx_machine_init(); | |
| 365 | psx_machine_init(machine); | |
| 366 | 366 | tms57002_init(); |
| 367 | 367 | } |
| 368 | 368 |
| r2844 | r2845 | |
|---|---|---|
| 1773 | 1773 | |
| 1774 | 1774 | static READ32_HANDLER( cps3_io1_r ) |
| 1775 | 1775 | { |
| 1776 | return input_port_read | |
| 1776 | return input_port_read | |
| 1777 | 1777 | } |
| 1778 | 1778 | |
| 1779 | 1779 | static READ32_HANDLER( cps3_io2_r ) |
| 1780 | 1780 | { |
| 1781 | return input_port_read | |
| 1781 | return input_port_read | |
| 1782 | 1782 | } |
| 1783 | 1783 | |
| 1784 | 1784 | // this seems to be dma active flags, and maybe vblank... not if it is anything else |
| r2844 | r2845 | |
| 2364 | 2364 | |
| 2365 | 2365 | |
| 2366 | 2366 | static INPUT_PORTS_START( cps3 ) |
| 2367 | PORT_START | |
| 2367 | PORT_START_TAG("IN0") | |
| 2368 | 2368 | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 2369 | 2369 | PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 2370 | 2370 | PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) |
| r2844 | r2845 | |
| 2392 | 2392 | PORT_BIT( 0x20000000, IP_ACTIVE_LOW, IPT_START2 ) |
| 2393 | 2393 | PORT_BIT( 0xc0000000, IP_ACTIVE_LOW, IPT_UNUSED ) // nothing here? |
| 2394 | 2394 | |
| 2395 | PORT_START | |
| 2395 | PORT_START_TAG("IN1") | |
| 2396 | 2396 | PORT_BIT( 0x0001ffff, IP_ACTIVE_LOW, IPT_UNUSED ) // nothing here? |
| 2397 | 2397 | PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) |
| 2398 | 2398 | PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) |
| r2844 | r2845 | |
|---|---|---|
| 381 | 381 | void fixeight_okisnd_w(running_machine *machine, int data); |
| 382 | 382 | void batsugun_okisnd_w(running_machine *machine, int data); |
| 383 | 383 | |
| 384 | MACHINE_RESET(batsugun); | |
| 384 | static MACHINE_RESET(batsugun); | |
| 385 | 385 | #if USE_V25 |
| 386 | 386 | static READ16_HANDLER( batsugun_share_r ); |
| 387 | 387 | static READ16_HANDLER( batsugun_share2_r ); |
| r2844 | r2845 | |
| 674 | 674 | } |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | WRITE16_HANDLER( toaplan2_v25_coin_word_w ) | |
| 677 | static WRITE16_HANDLER( toaplan2_v25_coin_word_w ) | |
| 678 | 678 | { |
| 679 | 679 | // logerror("toaplan2_v25_coin_word_w %04x\n",data); |
| 680 | 680 | |
| r2844 | r2845 | |
| 3895 | 3895 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 3896 | 3896 | MACHINE_DRIVER_END |
| 3897 | 3897 | |
| 3898 | MACHINE_RESET(batsugun) | |
| 3898 | static MACHINE_RESET(batsugun) | |
| 3899 | 3899 | { |
| 3900 | 3900 | #if USE_V25 |
| 3901 | 3901 | cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, ASSERT_LINE); |
| 3902 | 3902 | #endif |
| 3903 | 3903 | } |
| 3904 | 3904 | |
| 3905 | void batsugun_ym2151_irqhandler(running_machine *machine, int linestate) | |
| 3905 | static void batsugun_ym2151_irqhandler(running_machine *machine, int linestate) | |
| 3906 | 3906 | { |
| 3907 | 3907 | logerror("batsugun_ym2151_irqhandler %02x\n",linestate); |
| 3908 | 3908 | // update_irq_lines(machine, linestate ? assert : clear); |
| 3909 | 3909 | } |
| 3910 | 3910 | |
| 3911 | const struct YM2151interface batsugun_ym2151_interface = | |
| 3911 | static const struct YM2151interface batsugun_ym2151_interface = | |
| 3912 | 3912 | { |
| 3913 | 3913 | batsugun_ym2151_irqhandler |
| 3914 | 3914 | }; |
| r0 | r2845 | |
|---|---|---|
| 1 | /*************************************************************************** | |
| 2 | ||
| 3 | -= Subsino's Gambling Games =- | |
| 4 | ||
| 5 | driver by Luca Elia (l.elia@tin.it) | |
| 6 | ||
| 7 | CPU: Z180 (in a black box) | |
| 8 | GFX: 1 Tilemap (8x8 tiles, no scrolling) | |
| 9 | CUSTOM: 2 x SUBSINO SS9100, SUBSINO SS9101 | |
| 10 | SOUND: M6295, YM2413 or YM3812 | |
| 11 | OTHER: Battery | |
| 12 | ||
| 13 | Preliminary driver, only "Super Rider" works since it has valid z180 code. | |
| 14 | Note that e.g. "Shark Party" has snippets of valid code (6f - ff). | |
| 15 | ||
| 16 | To enter test mode in smoto, keep F2 pressed during boot. | |
| 17 | ||
| 18 | ***************************************************************************/ | |
| 19 | ||
| 20 | #include "driver.h" | |
| 21 | #include "cpu/z180/z180.h" | |
| 22 | #include "machine/8255ppi.h" | |
| 23 | #include "sound/okim6295.h" | |
| 24 | #include "sound/2413intf.h" | |
| 25 | #include "sound/3812intf.h" | |
| 26 | ||
| 27 | /*************************************************************************** | |
| 28 | Video Hardware | |
| 29 | ***************************************************************************/ | |
| 30 | ||
| 31 | static tilemap *tmap; | |
| 32 | int tiles_offset; | |
| 33 | ||
| 34 | static WRITE8_HANDLER( subsino_tiles_offset_w ) | |
| 35 | { | |
| 36 | tiles_offset = (data & 1) ? 0x1000: 0; | |
| 37 | tilemap_mark_tile_dirty(tmap, offset); | |
| 38 | // popmessage("gfx %02x",data); | |
| 39 | } | |
| 40 | ||
| 41 | static WRITE8_HANDLER( subsino_videoram_w ) | |
| 42 | { | |
| 43 | videoram[offset] = data; | |
| 44 | tilemap_mark_tile_dirty(tmap, offset); | |
| 45 | } | |
| 46 | ||
| 47 | static WRITE8_HANDLER( subsino_colorram_w ) | |
| 48 | { | |
| 49 | colorram[offset] = data; | |
| 50 | tilemap_mark_tile_dirty(tmap, offset); | |
| 51 | } | |
| 52 | ||
| 53 | static TILE_GET_INFO( get_tile_info ) | |
| 54 | { | |
| 55 | UINT16 code = videoram[ tile_index ] + (colorram[ tile_index ] << 8); | |
| 56 | UINT16 color = (code >> 8) & 0x0f; | |
| 57 | code = ((code & 0xf000) >> 4) + ((code & 0xff) >> 0); | |
| 58 | code += tiles_offset; | |
| 59 | SET_TILE_INFO(0, code, color, 0); | |
| 60 | } | |
| 61 | ||
| 62 | static VIDEO_START( subsino ) | |
| 63 | { | |
| 64 | tmap = tilemap_create( get_tile_info, tilemap_scan_rows, 8,8, 0x40,0x20 ); | |
| 65 | tilemap_set_transparent_pen( tmap, 0 ); | |
| 66 | tiles_offset = 0; | |
| 67 | } | |
| 68 | ||
| 69 | static VIDEO_UPDATE( subsino ) | |
| 70 | { | |
| 71 | fillbitmap(bitmap,0,cliprect); | |
| 72 | tilemap_draw(bitmap,cliprect, tmap, 0, 0); | |
| 73 | return 0; | |
| 74 | } | |
| 75 | ||
| 76 | static PALETTE_INIT( subsino_depth3 ) | |
| 77 | { | |
| 78 | // To be done (only 2 roms?) | |
| 79 | } | |
| 80 | ||
| 81 | static PALETTE_INIT( subsino_depth4 ) | |
| 82 | { | |
| 83 | int i; | |
| 84 | for (i = 0; i < 256; i++) | |
| 85 | palette_set_color_rgb(machine,i, pal2bit(color_prom[i+0x200]), | |
| 86 | pal3bit(color_prom[i+0x100]), | |
| 87 | pal3bit(color_prom[i+0x000]) ); | |
| 88 | } | |
| 89 | ||
| 90 | /*************************************************************************** | |
| 91 | Memory Maps | |
| 92 | ***************************************************************************/ | |
| 93 | ||
| 94 | static WRITE8_HANDLER( subsino_out_a_w ) | |
| 95 | { | |
| 96 | coin_counter_w( 0, data & 0x02 ); | |
| 97 | // popmessage("Out A %02x",data); | |
| 98 | } | |
| 99 | static WRITE8_HANDLER( subsino_out_b_w ) | |
| 100 | { | |
| 101 | // leds | |
| 102 | // popmessage("Out B %02x",data); | |
| 103 | } | |
| 104 | ||
| 105 | static ADDRESS_MAP_START( srider_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 106 | AM_RANGE( 0x00000, 0x0bfff ) AM_ROM | |
| 107 | ||
| 108 | AM_RANGE( 0x0c000, 0x0cfff ) AM_RAM | |
| 109 | ||
| 110 | AM_RANGE( 0x0d000, 0x0d000 ) AM_READ_PORT( "DSW1" ) | |
| 111 | AM_RANGE( 0x0d001, 0x0d001 ) AM_READ_PORT( "DSW2" ) | |
| 112 | AM_RANGE( 0x0d002, 0x0d002 ) AM_READ_PORT( "DSW3" ) | |
| 113 | ||
| 114 | AM_RANGE( 0x0d004, 0x0d004 ) AM_READ_PORT( "DSW4" ) | |
| 115 | AM_RANGE( 0x0d005, 0x0d005 ) AM_READ_PORT( "INA" ) | |
| 116 | AM_RANGE( 0x0d006, 0x0d006 ) AM_READ_PORT( "INB" ) | |
| 117 | ||
| 118 | AM_RANGE( 0x0d009, 0x0d009 ) AM_WRITE( subsino_out_b_w ) | |
| 119 | AM_RANGE( 0x0d00a, 0x0d00a ) AM_WRITE( subsino_out_a_w ) | |
| 120 | ||
| 121 | AM_RANGE( 0x0d00c, 0x0d00c ) AM_READ_PORT( "INC" ) | |
| 122 | ||
| 123 | AM_RANGE( 0x0d016, 0x0d016 ) AM_WRITE( YM3812_control_port_0_w ) | |
| 124 | AM_RANGE( 0x0d017, 0x0d017 ) AM_WRITE( YM3812_write_port_0_w ) | |
| 125 | ||
| 126 | AM_RANGE( 0x0d018, 0x0d018 ) AM_WRITE( OKIM6295_data_0_w ) | |
| 127 | ||
| 128 | AM_RANGE( 0x0d01b, 0x0d01b ) AM_WRITE( subsino_tiles_offset_w ) | |
| 129 | ||
| 130 | AM_RANGE( 0x0e000, 0x0e7ff ) AM_RAM_WRITE( subsino_colorram_w ) AM_BASE( &colorram ) | |
| 131 | AM_RANGE( 0x0e800, 0x0efff ) AM_RAM_WRITE( subsino_videoram_w ) AM_BASE( &videoram ) | |
| 132 | ADDRESS_MAP_END | |
| 133 | ||
| 134 | ||
| 135 | static ADDRESS_MAP_START( victor5_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 136 | AM_RANGE( 0x00000, 0x0bfff ) AM_ROM | |
| 137 | AM_RANGE( 0x0c000, 0x0cfff ) AM_RAM | |
| 138 | AM_RANGE( 0x0e000, 0x0e7ff ) AM_RAM_WRITE( subsino_colorram_w ) AM_BASE( &colorram ) | |
| 139 | AM_RANGE( 0x0e800, 0x0efff ) AM_RAM_WRITE( subsino_videoram_w ) AM_BASE( &videoram ) | |
| 140 | ADDRESS_MAP_END | |
| 141 | ||
| 142 | ||
| 143 | static ADDRESS_MAP_START( subsino_iomap, ADDRESS_SPACE_IO, 8 ) | |
| 144 | AM_RANGE( 0x0000, 0x003f ) AM_RAM // internal regs | |
| 145 | ADDRESS_MAP_END | |
| 146 | ||
| 147 | /*************************************************************************** | |
| 148 | Input Ports | |
| 149 | ***************************************************************************/ | |
| 150 | ||
| 151 | INPUT_PORTS_START( smoto ) | |
| 152 | ||
| 153 | PORT_START_TAG( "DSW1" ) | |
| 154 | PORT_DIPUNKNOWN( 0x01, 0x01 ) | |
| 155 | PORT_DIPUNKNOWN( 0x02, 0x02 ) | |
| 156 | PORT_DIPUNKNOWN( 0x04, 0x04 ) | |
| 157 | PORT_DIPUNKNOWN( 0x08, 0x08 ) | |
| 158 | PORT_DIPUNKNOWN( 0x10, 0x10 ) | |
| 159 | PORT_DIPUNKNOWN( 0x20, 0x20 ) | |
| 160 | PORT_DIPUNKNOWN( 0x40, 0x40 ) | |
| 161 | PORT_DIPUNKNOWN( 0x80, 0x80 ) | |
| 162 | ||
| 163 | PORT_START_TAG( "DSW2" ) | |
| 164 | PORT_DIPUNKNOWN( 0x01, 0x01 ) | |
| 165 | PORT_DIPUNKNOWN( 0x02, 0x02 ) | |
| 166 | PORT_DIPUNKNOWN( 0x04, 0x04 ) | |
| 167 | PORT_DIPUNKNOWN( 0x08, 0x08 ) | |
| 168 | PORT_DIPUNKNOWN( 0x10, 0x10 ) | |
| 169 | PORT_DIPUNKNOWN( 0x20, 0x20 ) | |
| 170 | PORT_DIPUNKNOWN( 0x40, 0x40 ) | |
| 171 | PORT_DIPUNKNOWN( 0x80, 0x80 ) | |
| 172 | ||
| 173 | PORT_START_TAG( "DSW3" ) | |
| 174 | PORT_DIPUNKNOWN( 0x01, 0x01 ) | |
| 175 | PORT_DIPUNKNOWN( 0x02, 0x02 ) | |
| 176 | PORT_DIPUNKNOWN( 0x04, 0x04 ) | |
| 177 | PORT_DIPUNKNOWN( 0x08, 0x08 ) | |
| 178 | PORT_DIPUNKNOWN( 0x10, 0x10 ) | |
| 179 | PORT_DIPUNKNOWN( 0x20, 0x20 ) | |
| 180 | PORT_DIPUNKNOWN( 0x40, 0x40 ) | |
| 181 | PORT_DIPUNKNOWN( 0x80, 0x80 ) | |
| 182 | ||
| 183 | PORT_START_TAG( "DSW4" ) | |
| 184 | PORT_DIPUNKNOWN( 0x01, 0x01 ) | |
| 185 | PORT_DIPUNKNOWN( 0x02, 0x02 ) | |
| 186 | PORT_DIPUNKNOWN( 0x04, 0x04 ) | |
| 187 | PORT_DIPUNKNOWN( 0x08, 0x08 ) | |
| 188 | PORT_DIPUNKNOWN( 0x10, 0x10 ) | |
| 189 | PORT_DIPUNKNOWN( 0x20, 0x20 ) | |
| 190 | PORT_DIPUNKNOWN( 0x40, 0x40 ) | |
| 191 | PORT_DIPUNKNOWN( 0x80, 0x80 ) | |
| 192 | ||
| 193 | PORT_START_TAG( "INA" ) | |
| 194 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) // 1 | |
| 195 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) // 2 -> | |
| 196 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) // 3 <- | |
| 197 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) // 4 choose | |
| 198 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) // 5 | |
| 199 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) // start | |
| 200 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) // bet (power->speed) | |
| 201 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 202 | ||
| 203 | PORT_START_TAG( "INB" ) | |
| 204 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) // coin | |
| 205 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 206 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 207 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 208 | PORT_SERVICE_NO_TOGGLE( 0x10, IP_ACTIVE_LOW ) // test | |
| 209 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) // rate | |
| 210 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 211 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 212 | ||
| 213 | PORT_START_TAG( "INC" ) | |
| 214 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 215 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 216 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START4 ) // take | |
| 217 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 218 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 219 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 220 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 221 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 222 | ||
| 223 | INPUT_PORTS_END | |
| 224 | ||
| 225 | /*************************************************************************** | |
| 226 | Graphics Layout | |
| 227 | ***************************************************************************/ | |
| 228 | ||
| 229 | static const gfx_layout layout_8x8x3 = | |
| 230 | { | |
| 231 | 8, 8, | |
| 232 | RGN_FRAC(1, 3), | |
| 233 | 3, | |
| 234 | { RGN_FRAC(0,3),RGN_FRAC(1,3),RGN_FRAC(2,3) }, | |
| 235 | { STEP8(0,1) }, | |
| 236 | { STEP8(0,8) }, | |
| 237 | 8*8 | |
| 238 | }; | |
| 239 | ||
| 240 | static const gfx_layout layout_8x8x4 = | |
| 241 | { | |
| 242 | 8, 8, | |
| 243 | RGN_FRAC(1, 4), | |
| 244 | 4, | |
| 245 | { RGN_FRAC(0,4),RGN_FRAC(1,4),RGN_FRAC(2,4),RGN_FRAC(3,4) }, | |
| 246 | { STEP8(0,1) }, | |
| 247 | { STEP8(0,8) }, | |
| 248 | 8*8 | |
| 249 | }; | |
| 250 | ||
| 251 | static GFXDECODE_START( subsino_depth3 ) | |
| 252 | GFXDECODE_ENTRY( REGION_GFX1, 0, layout_8x8x3, 0, 16 ) | |
| 253 | GFXDECODE_END | |
| 254 | ||
| 255 | static GFXDECODE_START( subsino_depth4 ) | |
| 256 | GFXDECODE_ENTRY( REGION_GFX1, 0, layout_8x8x4, 0, 16 ) | |
| 257 | GFXDECODE_END | |
| 258 | ||
| 259 | ||
| 260 | /*************************************************************************** | |
| 261 | Machine Drivers | |
| 262 | ***************************************************************************/ | |
| 263 | ||
| 264 | static MACHINE_DRIVER_START( victor5 ) | |
| 265 | /* basic machine hardware */ | |
| 266 | MDRV_CPU_ADD(Z180, XTAL_12MHz / 3) // 4 MHz? | |
| 267 | MDRV_CPU_PROGRAM_MAP(victor5_map,0) | |
| 268 | MDRV_CPU_IO_MAP(subsino_iomap,0) | |
| 269 | ||
| 270 | /* video hardware */ | |
| 271 | MDRV_SCREEN_ADD("main", RASTER) | |
| 272 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 273 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 274 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 275 | MDRV_SCREEN_SIZE(512, 256) | |
| 276 | MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0+16, 256-16-1) | |
| 277 | ||
| 278 | MDRV_GFXDECODE(subsino_depth3) | |
| 279 | MDRV_PALETTE_LENGTH(0x100) | |
| 280 | ||
| 281 | // MDRV_PALETTE_INIT(subsino_depth3) // no proms? | |
| 282 | MDRV_VIDEO_START(subsino) | |
| 283 | MDRV_VIDEO_UPDATE(subsino) | |
| 284 | ||
| 285 | /* sound hardware */ | |
| 286 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 287 | ||
| 288 | MDRV_SOUND_ADD(YM2413, XTAL_3_579545MHz) | |
| 289 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 290 | ||
| 291 | MDRV_SOUND_ADD(OKIM6295, XTAL_4_433619MHz / 4) | |
| 292 | MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified | |
| 293 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 294 | MACHINE_DRIVER_END | |
| 295 | ||
| 296 | static MACHINE_DRIVER_START( victor21 ) | |
| 297 | ||
| 298 | /* basic machine hardware */ | |
| 299 | MDRV_IMPORT_FROM( victor5 ) | |
| 300 | MDRV_PALETTE_INIT(subsino_depth3) // 2 proms? | |
| 301 | MACHINE_DRIVER_END | |
| 302 | ||
| 303 | ||
| 304 | static MACHINE_DRIVER_START( srider ) | |
| 305 | /* basic machine hardware */ | |
| 306 | MDRV_CPU_ADD(Z180, XTAL_12MHz / 3) // 4 MHz? | |
| 307 | MDRV_CPU_PROGRAM_MAP(srider_map,0) | |
| 308 | MDRV_CPU_IO_MAP(subsino_iomap,0) | |
| 309 | ||
| 310 | /* video hardware */ | |
| 311 | MDRV_SCREEN_ADD("main", RASTER) | |
| 312 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 313 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 314 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 315 | MDRV_SCREEN_SIZE(512, 256) | |
| 316 | MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0+16, 256-16-1) | |
| 317 | ||
| 318 | MDRV_GFXDECODE(subsino_depth4) | |
| 319 | MDRV_PALETTE_LENGTH(0x100) | |
| 320 | ||
| 321 | MDRV_PALETTE_INIT(subsino_depth4) | |
| 322 | MDRV_VIDEO_START(subsino) | |
| 323 | MDRV_VIDEO_UPDATE(subsino) | |
| 324 | ||
| 325 | /* sound hardware */ | |
| 326 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 327 | ||
| 328 | MDRV_SOUND_ADD(YM3812, XTAL_3_579545MHz) | |
| 329 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 330 | ||
| 331 | MDRV_SOUND_ADD(OKIM6295, XTAL_4_433619MHz / 4) | |
| 332 | MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified | |
| 333 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 334 | MACHINE_DRIVER_END | |
| 335 | ||
| 336 | ||
| 337 | /*************************************************************************** | |
| 338 | ROMs Loading | |
| 339 | ***************************************************************************/ | |
| 340 | ||
| 341 | /*************************************************************************** | |
| 342 | ||
| 343 | Victor 5 | |
| 344 | (C)1991 Subsino | |
| 345 | ||
| 346 | Chips: | |
| 347 | ||
| 348 | 1x unknown big black box | |
| 349 | 1x M5L8255AP | |
| 350 | 1x UM3567 | |
| 351 | 1x M6295 | |
| 352 | 1x oscillator 12.000 | |
| 353 | 1x oscillator 4.433619 | |
| 354 | 1x oscillator 3.579545 | |
| 355 | ||
| 356 | ROMs: | |
| 357 | ||
| 358 | 1x M27C512 (1) | |
| 359 | 3x 27C256 (2,3,4) | |
| 360 | ||
| 361 | Notes: | |
| 362 | ||
| 363 | 1x 36x2 edge connector (con3) | |
| 364 | 1x 10x2 edge connector (con4) | |
| 365 | 1x RS232 9pins connector (con5) | |
| 366 | 2x batteries | |
| 367 | 3x 8x2 switches dip | |
| 368 | 1x pushbutton | |
| 369 | ||
| 370 | Sticker on PCB reads V552520 | |
| 371 | ||
| 372 | Info by f205v (26/03/2008) | |
| 373 | ||
| 374 | ***************************************************************************/ | |
| 375 | ||
| 376 | ROM_START( victor5 ) | |
| 377 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 378 | ROM_LOAD( "1.u1", 0x00000, 0x10000, CRC(e3ada2fc) SHA1(eddb460dcb80a29fbbe3ed6c4733c75b892baf52) ) | |
| 379 | ||
| 380 | ROM_REGION( 0x18000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 381 | ROM_LOAD( "2.u24", 0x00000, 0x8000, CRC(1229e951) SHA1(1e548625bb60e2d6f52a376a0dea9e5709f94135) ) | |
| 382 | ROM_LOAD( "3.u23", 0x08000, 0x8000, CRC(2d89bbf1) SHA1(d7fda0174a835e88b330dfd09bdb604bfe4c2e44) ) | |
| 383 | ROM_LOAD( "4.u22", 0x10000, 0x8000, CRC(ecf840a1) SHA1(9ecf522afb23e3557d37effc3c8568e8a14dad1a) ) | |
| 384 | ||
| 385 | ROM_REGION( 0x40000, REGION_SOUND1, ROMREGION_ERASE ) | |
| 386 | // rom socket is empty | |
| 387 | ROM_END | |
| 388 | ||
| 389 | /*************************************************************************** | |
| 390 | ||
| 391 | Victor 21 | |
| 392 | (C)1990 Subsino | |
| 393 | ||
| 394 | Chips: | |
| 395 | ||
| 396 | 1x unknown big black box | |
| 397 | 1x M5L8255AP | |
| 398 | 1x UM3567 | |
| 399 | 1x M6295 | |
| 400 | 1x oscillator 12.000 | |
| 401 | 1x oscillator 4.433619 | |
| 402 | 1x oscillator 3.579545 | |
| 403 | ||
| 404 | ROMs: | |
| 405 | ||
| 406 | 1x M27C512 (1) | |
| 407 | 3x 27C256 (2,3,4) | |
| 408 | ||
| 409 | Other: | |
| 410 | ||
| 411 | 1x 36x2 edge connector (con3) | |
| 412 | 1x 10x2 edge connector (con4) | |
| 413 | 1x RS232 9pins connector (con5) | |
| 414 | 2x batteries | |
| 415 | 3x 8 switches dips | |
| 416 | 1x pushbutton | |
| 417 | ||
| 418 | PCB layout is identical to "Victor 5" | |
| 419 | Sticker on PCB reads V12040 | |
| 420 | ||
| 421 | Info by f205v, Corrado Tomaselli (20/04/2008) | |
| 422 | ||
| 423 | ***************************************************************************/ | |
| 424 | ||
| 425 | ROM_START( victor21 ) | |
| 426 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 427 | ROM_LOAD( "1.u1", 0x00000, 0x10000, CRC(43999b2d) SHA1(7ce26fd332ffe35fd826a1a6166b228d4bc370b8) ) | |
| 428 | ||
| 429 | ROM_REGION( 0x18000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 430 | ROM_LOAD( "2.u24", 0x00000, 0x8000, CRC(f1181b93) SHA1(53cd4d2ce13973495b51d911a4745a69a9784983) ) | |
| 431 | ROM_LOAD( "3.u25", 0x08000, 0x8000, CRC(437abb27) SHA1(bd3790807d60a41d58e07f60fb990553076d6e96) ) | |
| 432 | ROM_LOAD( "4.u26", 0x10000, 0x8000, CRC(e2f66eee) SHA1(ece924fe626f21fd7d31faabf19225d80e2bcfd3) ) | |
| 433 | ||
| 434 | ROM_REGION( 0x40000, REGION_SOUND1, ROMREGION_ERASE ) | |
| 435 | // rom socket is empty | |
| 436 | ||
| 437 | ROM_REGION( 0x200, REGION_PROMS, ROMREGION_DISPOSE ) | |
| 438 | ROM_LOAD( "74s287.u35", 0x000, 0x100, CRC(40094bed) SHA1(b25d96126b3f7bd06bf76dc9958f8669f83abdb7) ) | |
| 439 | ROM_LOAD( "74s287.u36", 0x100, 0x100, CRC(9ca021c5) SHA1(6a1d8d4f958d36e4a676dc4f4aee83d637933bc3) ) | |
| 440 | ROM_END | |
| 441 | ||
| 442 | /*************************************************************************** | |
| 443 | ||
| 444 | Shark Party | |
| 445 | (C)1993 Subsino | |
| 446 | ||
| 447 | Chips: | |
| 448 | ||
| 449 | 1x unknown big black box | |
| 450 | 1x custom SUBSINO_SS9101_409235I (DIL42)(u48) | |
| 451 | 2x KD89C55 (u49,u50) | |
| 452 | 1x K-665 (u55)(equivalent to M6295) | |
| 453 | 1x K-664 (u57)(equivalent to YM3014) | |
| 454 | 1x K-666 (u52)(equivalent to YM3812) | |
| 455 | 3x 45580D (amplifier)(u58,u59,u60) | |
| 456 | 2x custom SUBSINO_SS9100_3512204V (SMT 44pins)(u10,u19) | |
| 457 | 1x oscillator 4.433619MHz | |
| 458 | 1x oscillator 12.000MHz | |
| 459 | ||
| 460 | ROMs: | |
| 461 | ||
| 462 | 1x 27C1001 (u54) | |
| 463 | 1x 27C512 (u18) | |
| 464 | 2x 27C010 (u16,u17) | |
| 465 | 3x N82S129AN (u11,u12,u13) | |
| 466 | 4x GAL16V8B (u2,u37,u45,u46)(not dumped) | |
| 467 | 2x TIBPAL16L8 (u43,u44)(not dumped) | |
| 468 | ||
| 469 | Other: | |
| 470 | ||
| 471 | 1x 36x2 edge connector (con5) | |
| 472 | 1x 10x2 edge connector (con4) | |
| 473 | 1x battery | |
| 474 | 1x trimmer (volume) | |
| 475 | 1x pushbutton (sw5) | |
| 476 | 4x 8x2 switches dip (sw1,sw2,sw3,sw4) | |
| 477 | ||
| 478 | Info by f205v (25/03/2008) | |
| 479 | ||
| 480 | ***************************************************************************/ | |
| 481 | ||
| 482 | ROM_START( sharkpy ) | |
| 483 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 484 | ROM_LOAD( "shark_n.1.u18", 0x00000, 0x10000, CRC(25aeac2f) SHA1(d94e3e5cfffd150ac48e1463493a8323f42e7a89) ) | |
| 485 | ||
| 486 | ROM_REGION( 0x40000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 487 | ROM_LOAD( "shark_n.2.u17", 0x00000, 0x08000, CRC(c27f3d0a) SHA1(77c8eb0322c5b9c89777cb080d26ecf9abe01ae7) ) | |
| 488 | ROM_CONTINUE( 0x10000, 0x08000 ) | |
| 489 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 490 | ROM_CONTINUE( 0x18000, 0x08000 ) | |
| 491 | ROM_LOAD( "shark_n.3.u16", 0x20000, 0x08000, CRC(a7a715ce) SHA1(38b93e05377d9cb816688f5070e847480f195c6b) ) | |
| 492 | ROM_CONTINUE( 0x30000, 0x08000 ) | |
| 493 | ROM_CONTINUE( 0x28000, 0x08000 ) | |
| 494 | ROM_CONTINUE( 0x38000, 0x08000 ) | |
| 495 | ||
| 496 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) | |
| 497 | ROM_LOAD( "shark(ii)-italy_4_ver1.0.u54", 0x00000, 0x20000, CRC(9f384c59) SHA1(d2b087b8370b40b6f0944de661ea6aebaebea06f) ) | |
| 498 | ||
| 499 | ROM_REGION( 0x300, REGION_PROMS, ROMREGION_DISPOSE ) | |
| 500 | ROM_LOAD( "n82s129an.u11", 0x000, 0x100, CRC(daf3657a) SHA1(93005938e2d60d54e7bbf1e234bba3802ee1af21) ) | |
| 501 | ROM_LOAD( "n82s129an.u12", 0x100, 0x100, CRC(5a7a25ed) SHA1(eebd679195e6ea50f64f3c46cd06ee21a1550491) ) | |
| 502 | ROM_LOAD( "n82s129an.u13", 0x200, 0x100, CRC(0ef5f218) SHA1(a02cf266661385aa078563bd83240d36549c1cf0) ) | |
| 503 | ROM_END | |
| 504 | ||
| 505 | /*************************************************************************** | |
| 506 | ||
| 507 | Shark Party (alt) | |
| 508 | (C)1993 Subsino | |
| 509 | ||
| 510 | Chips: | |
| 511 | ||
| 512 | 1x unknown big black box | |
| 513 | 1x custom SUBSINO_SS9101_409235I (DIL42)(u48) | |
| 514 | 2x KD89C55 (u49,u50) | |
| 515 | 1x K-665 (u55)(equivalent to M6295) | |
| 516 | 1x K-664 (u57)(equivalent to YM3014) | |
| 517 | 1x SM64JBCK (u52)(equivalent to YM3812) | |
| 518 | 3x 45580D (amplifier)(u58,u59,u60) | |
| 519 | 2x custom SUBSINO_SS9100_3512201V (SMT 44pins)(u10,u19) | |
| 520 | 1x oscillator 4.433619MHz | |
| 521 | 1x oscillator 12.000MHz | |
| 522 | ||
| 523 | ROMs: | |
| 524 | ||
| 525 | 2x 27C1001 (u54,u17) | |
| 526 | 1x 27C512 (u18) | |
| 527 | 1x 27C010 (u16) | |
| 528 | 3x N82S129AN (u11,u12,u13) | |
| 529 | 4x GAL16V8B (u2,u37,u45,u46)(not dumped) | |
| 530 | 2x TIBPAL16L8 (u43,u44)(not dumped) | |
| 531 | ||
| 532 | Other: | |
| 533 | ||
| 534 | 1x 36x2 edge connector (con5) | |
| 535 | 1x 10x2 edge connector (con4) | |
| 536 | 1x battery | |
| 537 | 1x trimmer (volume) | |
| 538 | 1x pushbutton (sw5) | |
| 539 | 4x 8x2 switches dip (sw1,sw2,sw3,sw4) | |
| 540 | ||
| 541 | Info by f205v (25/03/2008) | |
| 542 | ||
| 543 | ***************************************************************************/ | |
| 544 | ||
| 545 | ROM_START( sharkpya ) | |
| 546 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 547 | ROM_LOAD( "shark1.6.u18", 0x00000, 0x10000, CRC(365312a0) SHA1(de8370b1f35e8d071185d2e5f2fbd2fdf74c55ac) ) | |
| 548 | ||
| 549 | ROM_REGION( 0x40000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 550 | ROM_LOAD( "shark_n.2.u17", 0x00000, 0x08000, CRC(c27f3d0a) SHA1(77c8eb0322c5b9c89777cb080d26ecf9abe01ae7) ) | |
| 551 | ROM_CONTINUE( 0x10000, 0x08000 ) | |
| 552 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 553 | ROM_CONTINUE( 0x18000, 0x08000 ) | |
| 554 | ROM_LOAD( "shark_n.3.u16", 0x20000, 0x08000, CRC(a7a715ce) SHA1(38b93e05377d9cb816688f5070e847480f195c6b) ) | |
| 555 | ROM_CONTINUE( 0x30000, 0x08000 ) | |
| 556 | ROM_CONTINUE( 0x28000, 0x08000 ) | |
| 557 | ROM_CONTINUE( 0x38000, 0x08000 ) | |
| 558 | ||
| 559 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) | |
| 560 | ROM_LOAD( "shark(ii)-italy_4_ver1.0.u54", 0x00000, 0x20000, CRC(9f384c59) SHA1(d2b087b8370b40b6f0944de661ea6aebaebea06f) ) | |
| 561 | ||
| 562 | ROM_REGION( 0x300, REGION_PROMS, ROMREGION_DISPOSE ) | |
| 563 | ROM_LOAD( "sn82s129an.u11", 0x000, 0x100, CRC(daf3657a) SHA1(93005938e2d60d54e7bbf1e234bba3802ee1af21) ) | |
| 564 | ROM_LOAD( "sn82s129an.u12", 0x100, 0x100, CRC(5a7a25ed) SHA1(eebd679195e6ea50f64f3c46cd06ee21a1550491) ) | |
| 565 | ROM_LOAD( "sn82s129an.u13", 0x200, 0x100, CRC(0ef5f218) SHA1(a02cf266661385aa078563bd83240d36549c1cf0) ) | |
| 566 | ROM_END | |
| 567 | ||
| 568 | /*************************************************************************** | |
| 569 | ||
| 570 | Super Rider (Italy Ver 1.6) | |
| 571 | (C)1996 Subsino | |
| 572 | ||
| 573 | Chips: | |
| 574 | ||
| 575 | 2x custom QFP44 label SUBSINOSS9100 | |
| 576 | 1x custom DIP42 label SUBSINOSS9101 | |
| 577 | 2x FILE KD89C55A (equivalent to 8255) | |
| 578 | 1x custom QFP44 label M28 (sound)(equivalent to M6295) | |
| 579 | 1x custom DIP24 label K-666 (sound)(equivalent to YM3812) | |
| 580 | 1x custom DIP8 label K-664 (sound)(equivalent to YM3014) | |
| 581 | 1x oscillator 12.000MHz (main) | |
| 582 | 1x oscillator 4.43361MHz (sound) | |
| 583 | ||
| 584 | ROMs: | |
| 585 | ||
| 586 | 1x TMS27C512 (1) | |
| 587 | 2x TMS27C010A (2,3)(main) | |
| 588 | 1x TMS27C010A (4) (sound) | |
| 589 | 3x PROM N82S129AN | |
| 590 | ||
| 591 | Other: | |
| 592 | ||
| 593 | 1x 10x2 edge connector (looks like a coin payout) | |
| 594 | 1x 36x2 edge connector | |
| 595 | 1x battery 3.6V NiCd | |
| 596 | 1x pushbutton (sw5) | |
| 597 | 4x 8 switches dips (sw1-4) | |
| 598 | 1x trimmer (volume) | |
| 599 | 1x BIG BLACK BOX (on top of the box there is a small door closing a button-battery; for sure there is more in it, but I do not know how to open it / tore it apart) | |
| 600 | ||
| 601 | This game is the official Italian version of "Super Rider" by Subsino | |
| 602 | ||
| 603 | Info by f205v (29/12/2005) | |
| 604 | ||
| 605 | ***************************************************************************/ | |
| 606 | ||
| 607 | ROM_START( smoto16 ) | |
| 608 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 609 | ROM_LOAD( "rideritaly_1ver1.6.u18", 0x0000, 0x10000, CRC(c7c0c3e8) SHA1(5dc80bc775f370653135a7b3ea9c8d3c92263804) ) | |
| 610 | ||
| 611 | ROM_REGION( 0x40000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 612 | ROM_LOAD( "rideritaly_3ver1.6.u16", 0x00000, 0x08000, CRC(998a8feb) SHA1(27f08b23f2dd3736f4f12f489d9a3aa096c99e8a) ) | |
| 613 | ROM_CONTINUE( 0x10000, 0x08000 ) | |
| 614 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 615 | ROM_CONTINUE( 0x18000, 0x08000 ) | |
| 616 | ROM_LOAD( "rideritaly_2ver1.6.u17", 0x20000, 0x08000, CRC(bdf9bf26) SHA1(49e7c0b99fec06dca5816eb7e38aed025efcaaa7) ) | |
| 617 | ROM_CONTINUE( 0x30000, 0x08000 ) | |
| 618 | ROM_CONTINUE( 0x28000, 0x08000 ) | |
| 619 | ROM_CONTINUE( 0x38000, 0x08000 ) | |
| 620 | ||
| 621 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) | |
| 622 | ROM_LOAD( "rideritaly_4ver1.6.u54", 0x00000, 0x20000, CRC(df828563) SHA1(f39324c5c37486ed9512e0ff934394556dd182ae) ) | |
| 623 | ||
| 624 | ROM_REGION( 0x300, REGION_PROMS, ROMREGION_DISPOSE ) | |
| 625 | ROM_LOAD( "prom-n82s129an.u11", 0x000, 0x100, CRC(e17730a6) SHA1(50c730b24e1d3d205c70f9381e4136e2ba6e499a) ) | |
| 626 | ROM_LOAD( "prom-n82s129an.u12", 0x100, 0x100, CRC(df848861) SHA1(f7e382f8b56d6b9f2af6c7a48a19e3631a64bb6d) ) | |
| 627 | ROM_LOAD( "prom-n82s129an.u13", 0x200, 0x100, CRC(9cb4a5c0) SHA1(0e0a368329c6d1cb685ed655d699a4894988fdb1) ) | |
| 628 | ROM_END | |
| 629 | ||
| 630 | /*************************************************************************** | |
| 631 | ||
| 632 | Super Rider (Italy Ver 2.0) | |
| 633 | (C)1997 Subsino | |
| 634 | ||
| 635 | Chips: | |
| 636 | ||
| 637 | 2x custom QFP44 label SUBSINOSS9100 | |
| 638 | 1x custom DIP42 label SUBSINOSS9101 | |
| 639 | 2x D8255AC-2 (are they 8255 equivalent?) | |
| 640 | 1x custom QFP44 label K-665 (sound)(equivalent to OKI M6295) | |
| 641 | 1x custom DIP24 label SM64 (sound)(equivalent to YM3812) | |
| 642 | 1x custom DIP8 label K-664 (sound)(equivalent to YM3014) | |
| 643 | 1x oscillator 12.000MHz (main) | |
| 644 | 1x oscillator 4.433619MHz (sound) | |
| 645 | ||
| 646 | ROMs: | |
| 647 | ||
| 648 | 1x 27C512 (1) | |
| 649 | 2x M27C1001 (2,3)(main) | |
| 650 | 1x M27C1001 (4) (sound) | |
| 651 | 3x PROM N82S129AN | |
| 652 | 3x PALCE16V8H (not dumped) | |
| 653 | 2x TIBPAL16L8B (not dumped) | |
| 654 | 1x GAL16V8B (not dumped) | |
| 655 | ||
| 656 | Other: | |
| 657 | ||
| 658 | 1x 10x2 edge connector (looks like a coin payout) | |
| 659 | 1x 36x2 edge connector | |
| 660 | 1x battery 3.6V NiCd | |
| 661 | 4x 8 switches dips (sw1-4) | |
| 662 | 1x trimmer (volume) | |
| 663 | 1x BIG BLACK BOX (on top of the box there is a small door closing a button-battery; for sure there is more in it, but I do not know how to open it / tore it apart) | |
| 664 | ||
| 665 | This game is the official Italian version of "Super Rider" by Subsino | |
| 666 | ||
| 667 | Info by f205v, Corrado Tomaselli (20/04/2008) | |
| 668 | ||
| 669 | ***************************************************************************/ | |
| 670 | ||
| 671 | ROM_START( smoto20 ) | |
| 672 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 673 | ROM_LOAD( "italyv2.0-25.u18", 0x00000, 0x10000, CRC(91abc76e) SHA1(b0eb3afda1d94111056559017802b16b2e72a9a5) ) | |
| 674 | ||
| 675 | ROM_REGION( 0x40000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 676 | ROM_LOAD( "3.u16", 0x00000, 0x08000, CRC(44b44385) SHA1(27c2865e52ab67aa8e077e8e1202cbf2addc0dfc) ) | |
| 677 | ROM_CONTINUE( 0x10000, 0x08000 ) | |
| 678 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 679 | ROM_CONTINUE( 0x18000, 0x08000 ) | |
| 680 | ROM_LOAD( "2.u17", 0x20000, 0x08000, CRC(380fc964) SHA1(4a5076d90cb94e2ffeec7534ce64d4cdb320f374) ) | |
| 681 | ROM_CONTINUE( 0x30000, 0x08000 ) | |
| 682 | ROM_CONTINUE( 0x28000, 0x08000 ) | |
| 683 | ROM_CONTINUE( 0x38000, 0x08000 ) | |
| 684 | ||
| 685 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) | |
| 686 | ROM_LOAD( "rom4ver1.0.u54", 0x00000, 0x20000, CRC(df828563) SHA1(f39324c5c37486ed9512e0ff934394556dd182ae) ) | |
| 687 | ||
| 688 | ROM_REGION( 0x300, REGION_PROMS, ROMREGION_DISPOSE ) | |
| 689 | ROM_LOAD( "82s129.u11", 0x000, 0x100, CRC(e17730a6) SHA1(50c730b24e1d3d205c70f9381e4136e2ba6e499a) ) | |
| 690 | ROM_LOAD( "82s129.u12", 0x100, 0x100, CRC(df848861) SHA1(f7e382f8b56d6b9f2af6c7a48a19e3631a64bb6d) ) | |
| 691 | ROM_LOAD( "82s129.u13", 0x200, 0x100, CRC(9cb4a5c0) SHA1(0e0a368329c6d1cb685ed655d699a4894988fdb1) ) | |
| 692 | ROM_END | |
| 693 | ||
| 694 | static DRIVER_INIT( smoto20 ) | |
| 695 | { | |
| 696 | UINT8 *rom = memory_region( REGION_CPU1 ); | |
| 697 | rom[0x12e1] = 0x20; // "ERROR 951010" | |
| 698 | } | |
| 699 | static DRIVER_INIT( smoto16 ) | |
| 700 | { | |
| 701 | UINT8 *rom = memory_region( REGION_CPU1 ); | |
| 702 | rom[0x12d0] = 0x20; // "ERROR 951010" | |
| 703 | } | |
| 704 | ||
| 705 | GAME( 1990, victor5, 0, victor5, 0, 0, ROT0, "Subsino", "Victor 5", GAME_NOT_WORKING ) | |
| 706 | GAME( 1990, victor21, 0, victor21, 0, 0, ROT0, "Subsino", "Victor 21", GAME_NOT_WORKING ) | |
| 707 | GAME( 1993, sharkpy, 0, srider, 0, 0, ROT0, "Subsino", "Shark Party", GAME_NOT_WORKING ) | |
| 708 | GAME( 1993, sharkpya, sharkpy, srider, 0, 0, ROT0, "Subsino", "Shark Party (alt)", GAME_NOT_WORKING ) | |
| 709 | GAME( 1996, smoto20, 0, srider, smoto, smoto20, ROT0, "Subsino", "Super Rider (Italy, v2.0)", GAME_WRONG_COLORS ) | |
| 710 | GAME( 1996, smoto16, smoto20, srider, smoto, smoto16, ROT0, "Subsino", "Super Moto (Italy, v1.6)", GAME_WRONG_COLORS ) |
| r2844 | r2845 | |
|---|---|---|
| 37 | 37 | AY8910 Port A = DSW |
| 38 | 38 | |
| 39 | 39 | |
| 40 | Known issues: | |
| 41 | ||
| 42 | * skylancr fires in the same spot regardless of player position when in cocktail mode. | |
| 43 | ||
| 44 | ||
| 45 | 40 | Stephh's notes (based on the games Z80 code and some tests) : |
| 46 | 41 | |
| 47 | 42 | 1) 'funkybee' and clones |
| r2844 | r2845 | |
| 187 | 182 | PORT_DIPSETTING( 0x80, DEF_STR( Cocktail ) ) |
| 188 | 183 | INPUT_PORTS_END |
| 189 | 184 | |
| 190 | #ifdef UNUSED_DEFINITION | |
| 191 | 185 | static INPUT_PORTS_START( funkbeeb ) |
| 192 | 186 | PORT_INCLUDE(funkybee) |
| 193 | 187 | |
| r2844 | r2845 | |
| 198 | 192 | PORT_DIPSETTING( 0x10, "3" ) |
| 199 | 193 | PORT_DIPSETTING( 0x00, "4" ) |
| 200 | 194 | INPUT_PORTS_END |
| 201 | #endif | |
| 202 | 195 | |
| 203 | 196 | static INPUT_PORTS_START( skylancr ) |
| 204 | 197 | PORT_START_TAG("IN0") |
| r2844 | r2845 | |
| 321 | 314 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) |
| 322 | 315 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 323 | 316 | MDRV_SCREEN_SIZE(32*8, 32*8) |
| 324 | MDRV_SCREEN_VISIBLE_AREA(12, 32*8- | |
| 317 | MDRV_SCREEN_VISIBLE_AREA(12, 32*8-8-1 | |
| 325 | 318 | |
| 326 | 319 | MDRV_GFXDECODE(funkybee) |
| 327 | 320 | MDRV_PALETTE_LENGTH(32) |
| r2844 | r2845 | |
| 415 | 408 | ROM_END |
| 416 | 409 | |
| 417 | 410 | GAME( 1982, funkybee, 0, funkybee, funkybee, 0, ROT90, "Orca", "Funky Bee", 0 ) |
| 418 | GAME( 1982, funkbeeb, funkybee, funkybee, funk | |
| 411 | GAME( 1982, funkbeeb, funkybee, funkybee, funk | |
| 419 | 412 | GAME( 1983, skylancr, 0, funkybee, skylancr, 0, ROT90, "Orca", "Sky Lancer", 0 ) |
| 420 | 413 | GAME( 1983, skylance, skylancr, funkybee, skylance, 0, ROT90, "Orca (Esco Trading Co license)", "Sky Lancer (Esco Trading Co license)", 0 ) |
| r2844 | r2845 | |
|---|---|---|
| 83 | 83 | |
| 84 | 84 | static READ16_HANDLER( special_port_4_r ) |
| 85 | 85 | { |
| 86 | int result = input_port_read | |
| 86 | int result = input_port_read | |
| 87 | 87 | |
| 88 | 88 | if (sound_to_main_ready) |
| 89 | 89 | result |= 0x01; |
| r2844 | r2845 | |
| 274 | 274 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START3 ) |
| 275 | 275 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 276 | 276 | |
| 277 | PORT_START | |
| 277 | PORT_START_TAG("UNK") | |
| 278 | 278 | PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 279 | 279 | |
| 280 | PORT_START | |
| 280 | PORT_START_TAG("SPECIAL") | |
| 281 | 281 | PORT_SERVICE_NO_TOGGLE( 0x0002, IP_ACTIVE_LOW ) |
| 282 | 282 | PORT_BIT( 0xfffd, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 283 | 283 |
| r2844 | r2845 | |
|---|---|---|
| 44 | 44 | |
| 45 | 45 | memset(mask, 0, sizeof mask); |
| 46 | 46 | |
| 47 | mask[input_port_read_indexed(machine, 3)] |= 0x01; | |
| 48 | mask[input_port_read_indexed(machine, 4)] |= 0x02; | |
| 49 | mask[input_port_read_indexed(machine, 5)] |= 0x04; | |
| 50 | mask[input_port_read_indexed(machine, 6)] |= 0x08; | |
| 51 | mask[input_port_read_indexed(machine, 7)] |= 0x10; | |
| 52 | mask[input_port_read_indexed(machine, 8)] |= 0x20; | |
| 47 | mask[input_port_read(machine, "STICK0_X")] |= 0x01; | |
| 48 | mask[input_port_read(machine, "STICK0_Y")] |= 0x02; | |
| 49 | mask[input_port_read(machine, "PADDLE0")] |= 0x04; | |
| 50 | mask[input_port_read(machine, "STICK1_X")] |= 0x08; | |
| 51 | mask[input_port_read(machine, "STICK1_Y")] |= 0x10; | |
| 52 | mask[input_port_read(machine, "PADDLE1")] |= 0x20; | |
| 53 | 53 | |
| 54 | 54 | for (i = 1; i < 256; i++) |
| 55 | 55 | if (mask[i] != 0) |
| r2844 | r2845 | |
| 87 | 87 | |
| 88 | 88 | static READ8_HANDLER( boxer_input_r ) |
| 89 | 89 | { |
| 90 | UINT8 val = input_port_read | |
| 90 | UINT8 val = input_port_read | |
| 91 | 91 | |
| 92 | if (input_port_read | |
| 92 | if (input_port_read | |
| 93 | 93 | val |= 0x02; |
| 94 | 94 | |
| 95 | 95 | return (val << ((offset & 7) ^ 7)) & 0x80; |
| r2844 | r2845 | |
| 111 | 111 | break; |
| 112 | 112 | |
| 113 | 113 | case 2: |
| 114 | val = input_port_read | |
| 114 | val = input_port_read | |
| 115 | 115 | break; |
| 116 | 116 | |
| 117 | 117 | case 3: |
| 118 | val = input_port_read | |
| 118 | val = input_port_read | |
| 119 | 119 | break; |
| 120 | 120 | } |
| 121 | 121 | |
| r2844 | r2845 | |
| 196 | 196 | |
| 197 | 197 | static INPUT_PORTS_START( boxer ) |
| 198 | 198 | |
| 199 | PORT_START | |
| 199 | PORT_START_TAG("IN0") | |
| 200 | 200 | PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 201 | 201 | PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* TIMER */ |
| 202 | 202 | PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_TILT ) |
| r2844 | r2845 | |
| 206 | 206 | PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 207 | 207 | PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 208 | 208 | |
| 209 | PORT_START | |
| 209 | PORT_START_TAG("IN1") | |
| 210 | 210 | PORT_DIPNAME( 0x03, 0x01, "Number of Rounds" ) |
| 211 | 211 | PORT_DIPSETTING( 0x03, "1" ) |
| 212 | 212 | PORT_DIPSETTING( 0x02, "2" ) |
| 213 | 213 | PORT_DIPSETTING( 0x01, "3" ) |
| 214 | 214 | PORT_DIPSETTING( 0x00, "4" ) |
| 215 | 215 | |
| 216 | PORT_START | |
| 216 | PORT_START_TAG("IN2") | |
| 217 | 217 | PORT_DIPNAME( 0x03, 0x01, DEF_STR( Coinage ) ) |
| 218 | 218 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) |
| 219 | 219 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) ) |
| 220 | 220 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) |
| 221 | 221 | PORT_DIPSETTING( 0x03, DEF_STR( Free_Play ) ) |
| 222 | 222 | |
| 223 | PORT_START | |
| 223 | PORT_START_TAG("STICK0_X") | |
| 224 | 224 | PORT_BIT ( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(30) PORT_KEYDELTA(16) PORT_REVERSE PORT_PLAYER(1) |
| 225 | 225 | |
| 226 | PORT_START | |
| 226 | PORT_START_TAG("STICK0_Y") | |
| 227 | 227 | PORT_BIT ( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(30) PORT_KEYDELTA(16) PORT_REVERSE PORT_PLAYER(1) |
| 228 | 228 | |
| 229 | PORT_START | |
| 229 | PORT_START_TAG("PADDLE0") | |
| 230 | 230 | PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(30) PORT_KEYDELTA(16) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_CENTERDELTA(0) PORT_PLAYER(1) |
| 231 | 231 | |
| 232 | PORT_START | |
| 232 | PORT_START_TAG("STICK1_X") | |
| 233 | 233 | PORT_BIT ( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(30) PORT_KEYDELTA(16) PORT_REVERSE PORT_PLAYER(2) |
| 234 | 234 | |
| 235 | PORT_START | |
| 235 | PORT_START_TAG("STICK1_Y") | |
| 236 | 236 | PORT_BIT ( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(30) PORT_KEYDELTA(16) PORT_REVERSE PORT_PLAYER(2) |
| 237 | 237 | |
| 238 | PORT_START | |
| 238 | PORT_START_TAG("PADDLE1") | |
| 239 | 239 | PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(30) PORT_KEYDELTA(16) PORT_CODE_DEC(KEYCODE_Q) PORT_CODE_INC(KEYCODE_W) PORT_CENTERDELTA(0) PORT_PLAYER(2) |
| 240 | 240 | |
| 241 | PORT_START | |
| 241 | PORT_START_TAG("IN3") | |
| 242 | 242 | PORT_DIPNAME( 0xff, 0x5C, "Round Time" ) /* actually a potentiometer */ |
| 243 | 243 | PORT_DIPSETTING( 0x3C, "15 seconds" ) |
| 244 | 244 | PORT_DIPSETTING( 0x5C, "30 seconds" ) |
| r2844 | r2845 | |
|---|---|---|
| 108 | 108 | |
| 109 | 109 | /*************************************************************************** |
| 110 | 110 | |
| 111 | General | |
| 112 | ||
| 113 | ***************************************************************************/ | |
| 114 | ||
| 115 | static struct | |
| 116 | { | |
| 117 | const device_config *duart68681; | |
| 118 | } tmaster_devices; | |
| 119 | ||
| 120 | /*************************************************************************** | |
| 121 | ||
| 111 | 122 | Sound |
| 112 | 123 | |
| 113 | 124 | ***************************************************************************/ |
| r2844 | r2845 | |
| 134 | 145 | |
| 135 | 146 | ***************************************************************************/ |
| 136 | 147 | |
| 137 | static void duart_irq_handler( | |
| 148 | static void duart_irq_handler(const device_ | |
| 138 | 149 | { |
| 139 | cpunum_set_input_line_and_vector(machine, 0, 4, HOLD_LINE, vector); | |
| 150 | cpunum_set_input_line_and_vector(device->machine, 0, 4, HOLD_LINE, vector); | |
| 140 | 151 | }; |
| 141 | 152 | |
| 142 | static void duart_tx(int channel, UINT8 data) | |
| 153 | static void duart_tx(const device_config *device, int channel, UINT8 data) | |
| 143 | 154 | { |
| 144 | 155 | if ( channel == 0 ) |
| 145 | 156 | { |
| 146 | //logerror( "duart->microtouch: %02x %c\n", data, (char)data); | |
| 147 | 157 | microtouch_rx(1, &data); |
| 148 | 158 | } |
| 149 | 159 | }; |
| 150 | 160 | |
| 151 | 161 | static void microtouch_tx(UINT8 data) |
| 152 | 162 | { |
| 153 | //logerror( "microtouch->duart: %02x %c\n", data, (char)data); | |
| 154 | duart_68681_rx_data(Machine, 0, data); | |
| 163 | duart68681_rx_data(tmaster_devices.duart68681, 0, data); | |
| 155 | 164 | } |
| 156 | 165 | |
| 157 | 166 | |
| r2844 | r2845 | |
| 432 | 441 | |
| 433 | 442 | AM_RANGE( 0x300010, 0x300011 ) AM_READ( tmaster_coins_r ) |
| 434 | 443 | |
| 435 | AM_RANGE( 0x300020, 0x30003f ) AM_READWRITE( duart | |
| 444 | AM_RANGE( 0x300020, 0x30003f ) AM_DEVREADWRITE8( DUART68681, "duart | |
| 436 | 445 | |
| 437 | 446 | AM_RANGE( 0x300040, 0x300041 ) AM_WRITE( tmaster_oki_bank_w ) |
| 438 | 447 | |
| r2844 | r2845 | |
| 736 | 745 | |
| 737 | 746 | static MACHINE_START( tmaster ) |
| 738 | 747 | { |
| 739 | duart_68681_init(0, duart_irq_handler, duart_tx); | |
| 740 | 748 | microtouch_init(microtouch_tx, 0); |
| 741 | 749 | } |
| 742 | 750 | |
| 751 | static MACHINE_RESET( tmaster ) | |
| 752 | { | |
| 753 | tmaster_devices.duart68681 = device_list_find_by_tag( machine->config->devicelist, DUART68681, "duart68681" ); | |
| 754 | } | |
| 755 | ||
| 743 | 756 | static INTERRUPT_GEN( tm3k_interrupt ) |
| 744 | 757 | { |
| 745 | 758 | switch (cpu_getiloops()) |
| r2844 | r2845 | |
| 750 | 763 | } |
| 751 | 764 | } |
| 752 | 765 | |
| 766 | static const duart68681_config tmaster_duart68681_config = | |
| 767 | { | |
| 768 | XTAL_8_664MHz / 2, //?? | |
| 769 | duart_irq_handler, | |
| 770 | duart_tx, | |
| 771 | NULL, | |
| 772 | NULL | |
| 773 | }; | |
| 774 | ||
| 753 | 775 | static MACHINE_DRIVER_START( tm3k ) |
| 754 | 776 | MDRV_CPU_ADD_TAG("main", M68000, XTAL_24MHz / 2) /* 12MHz */ |
| 755 | 777 | MDRV_CPU_PROGRAM_MAP(tmaster_map,0) |
| 756 | 778 | MDRV_CPU_VBLANK_INT_HACK(tm3k_interrupt,2+20) // ?? |
| 757 | 779 | |
| 758 | 780 | MDRV_MACHINE_START(tmaster) |
| 781 | MDRV_MACHINE_RESET(tmaster) | |
| 782 | ||
| 783 | MDRV_DEVICE_ADD( "duart68681", DUART68681 ) | |
| 784 | MDRV_DEVICE_CONFIG( tmaster_duart68681_config ) | |
| 785 | ||
| 759 | 786 | MDRV_NVRAM_HANDLER(generic_0fill) |
| 760 | 787 | |
| 761 | 788 |
| r2844 | r2845 | |
|---|---|---|
| 532 | 532 | |
| 533 | 533 | READ16_HANDLER( scudhamm_analog_r ) |
| 534 | 534 | { |
| 535 | return input_port_read | |
| 535 | return input_port_read | |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | /* |
| r2844 | r2845 | |
| 627 | 627 | int armdelta; |
| 628 | 628 | static int armold = 0; |
| 629 | 629 | |
| 630 | armdelta = input_port_read_indexed(machine, 1) - armold; | |
| 631 | armold = input_port_read_indexed(machine, 1); | |
| 630 | armdelta = input_port_read(machine, "IN1") - armold; | |
| 631 | armold = input_port_read(machine, "IN1"); | |
| 632 | 632 | |
| 633 | 633 | return ~( scudhamm_motor_command + armdelta ); // + x : x<=0 and player loses, x>0 and player wins |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | static READ16_HANDLER( armchmp2_buttons_r ) |
| 637 | 637 | { |
| 638 | int arm_x = input_port_read | |
| 638 | int arm_x = input_port_read | |
| 639 | 639 | |
| 640 | UINT16 ret = input_port_read | |
| 640 | UINT16 ret = input_port_read | |
| 641 | 641 | |
| 642 | 642 | if (arm_x < 0x40) ret &= ~1; |
| 643 | 643 | else if (arm_x > 0xc0) ret &= ~2; |
| r2844 | r2845 | |
| 1123 | 1123 | // [4] DSW 1 & 2 [5] DSW 3 [6] Driving Wheel |
| 1124 | 1124 | |
| 1125 | 1125 | static INPUT_PORTS_START( cischeat ) |
| 1126 | PORT_START_TAG(" | |
| 1126 | PORT_START_TAG("FAKE") // Fake input port - Buttons status | |
| 1127 | 1127 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Low Gear")\ |
| 1128 | 1128 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 High Gear")\ |
| 1129 | 1129 | |
| r2844 | r2845 | |
| 1210 | 1210 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1211 | 1211 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1212 | 1212 | |
| 1213 | PORT_START // IN6 - Driving Wheel - $80010.w(0) | |
| 1213 | PORT_START_TAG("IN6") // IN6 - Driving Wheel - $80010.w(0) | |
| 1214 | 1214 | PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) |
| 1215 | 1215 | INPUT_PORTS_END |
| 1216 | 1216 | |
| r2844 | r2845 | |
| 1225 | 1225 | // [6] Coinage JP&USA [7] Coinage UK&FR |
| 1226 | 1226 | |
| 1227 | 1227 | static INPUT_PORTS_START( f1gpstar ) |
| 1228 | PORT_START_TAG(" | |
| 1228 | PORT_START_TAG("FAKE") // Fake input port - Buttons status | |
| 1229 | 1229 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Accelerator")\ |
| 1230 | 1230 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Low Gear")\ |
| 1231 | 1231 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 High Gear")\ |
| r2844 | r2845 | |
|---|---|---|
| 356 | 356 | #include "sound/dac.h" |
| 357 | 357 | #include "sound/flt_rc.h" |
| 358 | 358 | #include "includes/cclimber.h" |
| 359 | #include "includes/galaxian.h" | |
| 359 | 360 | |
| 360 | 361 | |
| 361 | 362 | /************************************* |
| r2844 | r2845 | |
| 3257 | 3258 | GAME( 1982, dkongjrm, dkongjr, dkongjrm, dkongjrm, 0, ROT90, "bootleg", "Donkey Kong Jr. (Moon Cresta hardware)", GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 3258 | 3259 | GAME( 1981, rockclim, 0, rockclim, rockclim, 0, ROT180, "Taito", "Rock Climber", GAME_SUPPORTS_SAVE ) |
| 3259 | 3260 | GAME( 1983, ozon1, 0, ozon1, ozon1, 0, ROT90, "Proma", "Ozon I", GAME_SUPPORTS_SAVE ) |
| 3260 | GAME( 1983, ladybugg, ladybug, batman2, ladybugg, ladybugg, ROT270, "bootleg", "Lady | |
| 3261 | GAME( 1983, ladybugg, ladybug, batman2, ladybugg, ladybugg, ROT270, "bootleg", "Lady Bug (bootleg on Galaxian hardware)", GAME_SUPPORTS_SAVE ) | |
| 3261 | 3262 | GAME( 1980, vpool, hustler, mooncrst, vpool, 0, ROT90, "bootleg", "Video Pool (bootleg on Moon Cresta hardware)", GAME_SUPPORTS_SAVE ) |
| 3262 | 3263 | GAME( 1984, drivfrcg, drivfrcp, drivfrcg, drivfrcg, 0, ROT90, "Shinkai Inc. (Magic Eletronics USA licence)", "Driving Force (Galaxian conversion)", GAME_SUPPORTS_SAVE ) |
| 3263 | 3264 | GAME( 1985, drivfrcb, drivfrcp, drivfrcg, drivfrcg, 0, ROT90, "bootleg", "Driving Force (Galaxian conversion bootleg)", GAME_SUPPORTS_SAVE ) |
| r2844 | r2845 | |
|---|---|---|
| 509 | 509 | INLINE int read_trackball(running_machine *machine, int idx, int switch_port) |
| 510 | 510 | { |
| 511 | 511 | UINT8 newpos; |
| 512 | static const char *portnames[] = { "IN0", "IN1", "IN2" }; | |
| 513 | static const char *tracknames[] = { "TRACK0_X", "TRACK0_Y", "TRACK1_X", "TRACK1_Y" }; | |
| 512 | 514 | |
| 513 | 515 | /* adjust idx if we're cocktail flipped */ |
| 514 | 516 | if (centiped_flipscreen) |
| r2844 | r2845 | |
| 516 | 518 | |
| 517 | 519 | /* if we're to read the dipswitches behind the trackball data, do it now */ |
| 518 | 520 | if (dsw_select) |
| 519 | return (input_port_read | |
| 521 | return (input_port_read | |
| 520 | 522 | |
| 521 | 523 | /* get the new position and adjust the result */ |
| 522 | newpos = input_port_read | |
| 524 | newpos = input_port_read | |
| 523 | 525 | if (newpos != oldpos[idx]) |
| 524 | 526 | { |
| 525 | 527 | sign[idx] = (newpos - oldpos[idx]) & 0x80; |
| r2844 | r2845 | |
| 527 | 529 | } |
| 528 | 530 | |
| 529 | 531 | /* blend with the bits from the switch port */ |
| 530 | return (input_port_read | |
| 532 | return (input_port_read | |
| 531 | 533 | } |
| 532 | 534 | |
| 533 | 535 | |
| r2844 | r2845 | |
| 550 | 552 | |
| 551 | 553 | static READ8_HANDLER( milliped_IN2_r ) |
| 552 | 554 | { |
| 553 | UINT8 data = input_port_read | |
| 555 | UINT8 data = input_port_read | |
| 554 | 556 | |
| 555 | 557 | /* MSH - 15 Feb, 2007 |
| 556 | 558 | * The P2 X Joystick inputs are not properly handled in |
| r2844 | r2845 | |
| 561 | 563 | */ |
| 562 | 564 | if (0 != control_select) { |
| 563 | 565 | /* Bottom 4 bits is our joystick inputs */ |
| 564 | UINT8 joy2data = input_port_read | |
| 566 | UINT8 joy2data = input_port_read | |
| 565 | 567 | data = data & 0xf0; /* Keep the top 4 bits */ |
| 566 | 568 | data |= (joy2data & 0x0a) >> 1; /* flip left and up */ |
| 567 | 569 | data |= (joy2data & 0x05) << 1; /* flip right and down */ |
| r2844 | r2845 | |
| 583 | 585 | |
| 584 | 586 | static READ8_HANDLER( mazeinv_input_r ) |
| 585 | 587 | { |
| 586 | return input_port_read_indexed(machine, 6 + control_select); | |
| 588 | static const char *sticknames[] = { "STICK0", "STICK1", "STICK2", "STICK3" }; | |
| 589 | ||
| 590 | return input_port_read(machine, sticknames[control_select]); | |
| 587 | 591 | } |
| 588 | 592 | |
| 589 | 593 | |
| r2844 | r2845 | |
| 669 | 673 | AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&rambase) |
| 670 | 674 | AM_RANGE(0x0400, 0x07bf) AM_RAM_WRITE(centiped_videoram_w) AM_BASE(&videoram) |
| 671 | 675 | AM_RANGE(0x07c0, 0x07ff) AM_RAM AM_BASE(&spriteram) |
| 672 | AM_RANGE(0x0800, 0x0800) AM_READ(input_port_4_r) /* DSW1 */ | |
| 673 | AM_RANGE(0x0801, 0x0801) AM_READ(input_port_5_r) /* DSW2 */ | |
| 676 | AM_RANGE(0x0800, 0x0800) AM_READ_PORT("DSW1") /* DSW1 */ | |
| 677 | AM_RANGE(0x0801, 0x0801) AM_READ_PORT("DSW2") /* DSW2 */ | |
| 674 | 678 | AM_RANGE(0x0c00, 0x0c00) AM_READ(centiped_IN0_r) /* IN0 */ |
| 675 | AM_RANGE(0x0c01, 0x0c01) AM_READ | |
| 679 | AM_RANGE(0x0c01, 0x0c01) AM_READ | |
| 676 | 680 | AM_RANGE(0x0c02, 0x0c02) AM_READ(centiped_IN2_r) /* IN2 */ |
| 677 | AM_RANGE(0x0c03, 0x0c03) AM_READ | |
| 681 | AM_RANGE(0x0c03, 0x0c03) AM_READ | |
| 678 | 682 | AM_RANGE(0x1000, 0x100f) AM_READWRITE(pokey1_r, pokey1_w) |
| 679 | 683 | AM_RANGE(0x1400, 0x140f) AM_WRITE(centiped_paletteram_w) AM_BASE(&paletteram) |
| 680 | 684 | AM_RANGE(0x1600, 0x163f) AM_WRITE(atari_vg_earom_w) |
| r2844 | r2845 | |
| 694 | 698 | AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x4000) AM_RAM |
| 695 | 699 | AM_RANGE(0x0400, 0x07bf) AM_MIRROR(0x4000) AM_RAM_WRITE(centiped_videoram_w) AM_BASE(&videoram) |
| 696 | 700 | AM_RANGE(0x07c0, 0x07ff) AM_MIRROR(0x4000) AM_RAM AM_BASE(&spriteram) |
| 697 | AM_RANGE(0x0800, 0x0800) AM_MIRROR(0x4000) AM_READ(input_port_4_r) /* DSW1 */ | |
| 698 | AM_RANGE(0x0801, 0x0801) AM_MIRROR(0x4000) AM_READ(input_port_5_r) /* DSW2 */ | |
| 701 | AM_RANGE(0x0800, 0x0800) AM_MIRROR(0x4000) AM_READ_PORT("DSW1") /* DSW1 */ | |
| 702 | AM_RANGE(0x0801, 0x0801) AM_MIRROR(0x4000) AM_READ_PORT("DSW2") /* DSW2 */ | |
| 699 | 703 | AM_RANGE(0x0c00, 0x0c00) AM_MIRROR(0x4000) AM_READ(centiped_IN0_r) /* IN0 */ |
| 700 | AM_RANGE(0x0c01, 0x0c01) AM_MIRROR(0x4000) AM_READ | |
| 704 | AM_RANGE(0x0c01, 0x0c01) AM_MIRROR(0x4000) AM_READ | |
| 701 | 705 | AM_RANGE(0x0c02, 0x0c02) AM_MIRROR(0x4000) AM_READ(centiped_IN2_r) /* IN2 */ |
| 702 | AM_RANGE(0x0c03, 0x0c03) AM_MIRROR(0x4000) AM_READ | |
| 706 | AM_RANGE(0x0c03, 0x0c03) AM_MIRROR(0x4000) AM_READ | |
| 703 | 707 | AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x4000) AM_WRITE(AY8910_write_port_0_w) |
| 704 | 708 | AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x4000) AM_READWRITE(AY8910_read_port_0_r, AY8910_control_port_0_w) |
| 705 | 709 | AM_RANGE(0x1400, 0x140f) AM_MIRROR(0x4000) AM_WRITE(centiped_paletteram_w) AM_BASE(&paletteram) |
| r2844 | r2845 | |
| 733 | 737 | AM_RANGE(0x2000, 0x2000) AM_READ(centiped_IN0_r) |
| 734 | 738 | AM_RANGE(0x2001, 0x2001) AM_READ(milliped_IN1_r) |
| 735 | 739 | AM_RANGE(0x2010, 0x2010) AM_READ(milliped_IN2_r) |
| 736 | AM_RANGE(0x2011, 0x2011) AM_READ | |
| 740 | AM_RANGE(0x2011, 0x2011) AM_READ | |
| 737 | 741 | AM_RANGE(0x2030, 0x2030) AM_READ(atari_vg_earom_r) |
| 738 | 742 | AM_RANGE(0x2480, 0x249f) AM_WRITE(milliped_paletteram_w) AM_BASE(&paletteram) |
| 739 | 743 | AM_RANGE(0x2500, 0x2502) AM_WRITE(coin_count_w) |
| r2844 | r2845 | |
| 761 | 765 | AM_RANGE(0x0000, 0x03ff) AM_RAM |
| 762 | 766 | AM_RANGE(0x0400, 0x07bf) AM_RAM_WRITE(centiped_videoram_w) AM_BASE(&videoram) |
| 763 | 767 | AM_RANGE(0x07c0, 0x07ff) AM_RAM AM_BASE(&spriteram) |
| 764 | AM_RANGE(0x0800, 0x0800) AM_READ(input_port_2_r) /* DSW1 */ | |
| 765 | AM_RANGE(0x0801, 0x0801) AM_READ(input_port_3_r) /* DSW2 */ | |
| 766 | AM_RANGE(0x0c00, 0x0c00) AM_READ(input_port_0_r) /* IN0 */ | |
| 767 | AM_RANGE(0x0c01, 0x0c01) AM_READ(input_port_1_r) /* IN1 */ | |
| 768 | AM_RANGE(0x0800, 0x0800) AM_READ_PORT("DSW1") /* DSW1 */ | |
| 769 | AM_RANGE(0x0801, 0x0801) AM_READ_PORT("DSW2") /* DSW2 */ | |
| 770 | AM_RANGE(0x0c00, 0x0c00) AM_READ_PORT("IN0") /* IN0 */ | |
| 771 | AM_RANGE(0x0c01, 0x0c01) AM_READ_PORT("IN1") /* IN1 */ | |
| 768 | 772 | AM_RANGE(0x1000, 0x100f) AM_READWRITE(pokey1_r, pokey1_w) |
| 769 | 773 | AM_RANGE(0x1800, 0x1800) AM_WRITE(irq_ack_w) |
| 770 | 774 | AM_RANGE(0x1c00, 0x1c02) AM_WRITE(coin_count_w) |
| r2844 | r2845 | |
| 788 | 792 | AM_RANGE(0x0800, 0x080f) AM_READWRITE(pokey2_r, pokey2_w) |
| 789 | 793 | AM_RANGE(0x1000, 0x13bf) AM_RAM_WRITE(centiped_videoram_w) AM_BASE(&videoram) |
| 790 | 794 | AM_RANGE(0x13c0, 0x13ff) AM_RAM AM_BASE(&spriteram) |
| 791 | AM_RANGE(0x2000, 0x2000) AM_READ(input_port_0_r) | |
| 792 | AM_RANGE(0x2001, 0x2001) AM_READ(input_port_1_r) | |
| 793 | AM_RANGE(0x2010, 0x2010) AM_READ(input_port_2_r) | |
| 794 | AM_RANGE(0x2011, 0x2011) AM_READ(input_port_3_r) | |
| 795 | AM_RANGE(0x2000, 0x2000) AM_READ_PORT("IN0") | |
| 796 | AM_RANGE(0x2001, 0x2001) AM_READ_PORT("IN1") | |
| 797 | AM_RANGE(0x2010, 0x2010) AM_READ_PORT("IN2") | |
| 798 | AM_RANGE(0x2011, 0x2011) AM_READ_PORT("IN3") | |
| 795 | 799 | AM_RANGE(0x2020, 0x2020) AM_READ(mazeinv_input_r) |
| 796 | 800 | AM_RANGE(0x2030, 0x2030) AM_READ(atari_vg_earom_r) |
| 797 | 801 | AM_RANGE(0x2480, 0x249f) AM_WRITE(mazeinv_paletteram_w) AM_BASE(&paletteram) |
| r2844 | r2845 | |
| 817 | 821 | |
| 818 | 822 | static ADDRESS_MAP_START( bullsdrt_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 819 | 823 | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 820 | AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x6000) AM_READ | |
| 824 | AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x6000) AM_READ | |
| 821 | 825 | AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x6000) AM_READ(centiped_IN0_r) |
| 822 | AM_RANGE(0x1081, 0x1081) AM_MIRROR(0x6000) AM_READ | |
| 826 | AM_RANGE(0x1081, 0x1081) AM_MIRROR(0x6000) AM_READ | |
| 823 | 827 | AM_RANGE(0x1082, 0x1082) AM_MIRROR(0x6000) AM_READ(centiped_IN2_r) |
| 824 | 828 | AM_RANGE(0x1200, 0x123f) AM_MIRROR(0x6000) AM_READWRITE(atari_vg_earom_r, atari_vg_earom_w) |
| 825 | 829 | AM_RANGE(0x1280, 0x1280) AM_MIRROR(0x6000) AM_WRITE(atari_vg_earom_ctrl_w) |
| 826 | AM_RANGE(0x1300, 0x1300) AM_MIRROR(0x6000) AM_READ | |
| 830 | AM_RANGE(0x1300, 0x1300) AM_MIRROR(0x6000) AM_READ | |
| 827 | 831 | AM_RANGE(0x1400, 0x140f) AM_MIRROR(0x6000) AM_WRITE(centiped_paletteram_w) AM_BASE(&paletteram) |
| 828 | 832 | AM_RANGE(0x1481, 0x1481) AM_MIRROR(0x6000) AM_WRITE(bullsdrt_coin_count_w) |
| 829 | 833 | AM_RANGE(0x1483, 0x1484) AM_MIRROR(0x6000) AM_WRITE(led_w) |
| r2844 | r2845 | |
| 858 | 862 | #define PORTS(GAMENAME, FOURTH_LANGUAGE) \ |
| 859 | 863 | \ |
| 860 | 864 | static INPUT_PORTS_START( GAMENAME ) \ |
| 861 | PORT_START /* IN0 */ \ | |
| 865 | PORT_START_TAG("IN0") /* IN0 */ \ | |
| 862 | 866 | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball data */ \ |
| 863 | 867 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet )) \ |
| 864 | 868 | PORT_DIPSETTING( 0x00, DEF_STR( Upright )) \ |
| r2844 | r2845 | |
| 867 | 871 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK ) \ |
| 868 | 872 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball sign bit */ \ |
| 869 | 873 | \ |
| 870 | PORT_START /* IN1 */ \ | |
| 874 | PORT_START_TAG("IN1") /* IN1 */ \ | |
| 871 | 875 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) \ |
| 872 | 876 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) \ |
| 873 | 877 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) \ |
| r2844 | r2845 | |
| 877 | 881 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) \ |
| 878 | 882 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) \ |
| 879 | 883 | \ |
| 880 | PORT_START /* IN2 */ \ | |
| 884 | PORT_START_TAG("IN2") /* IN2 */ \ | |
| 881 | 885 | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball data */ \ |
| 882 | 886 | PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_UNKNOWN ) \ |
| 883 | 887 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball sign bit */ \ |
| 884 | 888 | \ |
| 885 | PORT_START /* IN3 */ \ | |
| 889 | PORT_START_TAG("IN3") /* IN3 */ \ | |
| 886 | 890 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL \ |
| 887 | 891 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL \ |
| 888 | 892 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL \ |
| r2844 | r2845 | |
| 892 | 896 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY \ |
| 893 | 897 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY \ |
| 894 | 898 | \ |
| 895 | PORT_START /* IN4 */ \ | |
| 899 | PORT_START_TAG("DSW1") /* IN4 */ \ | |
| 896 | 900 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("N9:1,2") \ |
| 897 | 901 | PORT_DIPSETTING( 0x00, DEF_STR( English ) ) \ |
| 898 | 902 | PORT_DIPSETTING( 0x01, DEF_STR( German ) ) \ |
| r2844 | r2845 | |
| 915 | 919 | PORT_DIPSETTING( 0x00, "1" ) \ |
| 916 | 920 | PORT_DIPSETTING( 0x80, "2" ) \ |
| 917 | 921 | \ |
| 918 | PORT_START /* IN5 */ \ | |
| 922 | PORT_START_TAG("DSW2") /* IN5 */ \ | |
| 919 | 923 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage )) PORT_DIPLOCATION("N8:1,2") \ |
| 920 | 924 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C )) \ |
| 921 | 925 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C )) \ |
| r2844 | r2845 | |
| 937 | 941 | PORT_DIPSETTING( 0x80, "6 credits/5 coins" ) \ |
| 938 | 942 | PORT_DIPSETTING( 0xa0, "4 credits/3 coins" ) \ |
| 939 | 943 | \ |
| 940 | PORT_START /* IN6, fake trackball input port. */ \ | |
| 944 | PORT_START_TAG("TRACK0_X") /* IN6, fake trackball input port. */ \ | |
| 941 | 945 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE \ |
| 942 | 946 | \ |
| 943 | PORT_START /* IN7, fake trackball input port. */ \ | |
| 947 | PORT_START_TAG("TRACK0_Y") /* IN7, fake trackball input port. */ \ | |
| 944 | 948 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) \ |
| 945 | 949 | \ |
| 946 | PORT_START /* IN8, fake trackball input port. */ \ | |
| 950 | PORT_START_TAG("TRACK1_X") /* IN8, fake trackball input port. */ \ | |
| 947 | 951 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_COCKTAIL \ |
| 948 | 952 | \ |
| 949 | PORT_START /* IN9, fake trackball input port. */ \ | |
| 953 | PORT_START_TAG("TRACK1_Y") /* IN9, fake trackball input port. */ \ | |
| 950 | 954 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE PORT_COCKTAIL \ |
| 951 | 955 | INPUT_PORTS_END |
| 952 | 956 | |
| r2844 | r2845 | |
| 955 | 959 | |
| 956 | 960 | |
| 957 | 961 | static INPUT_PORTS_START( centtime ) |
| 958 | PORT_START /* IN0 */ | |
| 962 | PORT_START_TAG("IN0") /* IN0 */ | |
| 959 | 963 | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball data */ |
| 960 | 964 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 961 | 965 | PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) |
| 962 | 966 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 963 | 967 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball sign bit */ |
| 964 | 968 | |
| 965 | PORT_START /* IN1 */ | |
| 969 | PORT_START_TAG("IN1") /* IN1 */ | |
| 966 | 970 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 967 | 971 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 968 | 972 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| r2844 | r2845 | |
| 972 | 976 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 973 | 977 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 974 | 978 | |
| 975 | PORT_START /* IN2 */ | |
| 979 | PORT_START_TAG("IN2") /* IN2 */ | |
| 976 | 980 | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball data */ |
| 977 | 981 | PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 978 | 982 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball sign bit */ |
| 979 | 983 | |
| 980 | PORT_START /* IN3 */ | |
| 984 | PORT_START_TAG("IN3") /* IN3 */ | |
| 981 | 985 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 982 | 986 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| 983 | 987 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 984 | 988 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| 985 | 989 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY |
| 986 | 990 | |
| 987 | PORT_START /* IN4 */ | |
| 991 | PORT_START_TAG("DSW1") /* IN4 */ | |
| 988 | 992 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:1,2") |
| 989 | 993 | PORT_DIPSETTING( 0x00, DEF_STR( English ) ) |
| 990 | 994 | PORT_DIPSETTING( 0x01, DEF_STR( German ) ) |
| r2844 | r2845 | |
| 1007 | 1011 | PORT_DIPSETTING( 0x00, "1" ) |
| 1008 | 1012 | PORT_DIPSETTING( 0x80, "2" ) |
| 1009 | 1013 | |
| 1010 | PORT_START /* IN5 */ | |
| 1014 | PORT_START_TAG("DSW2") /* IN5 */ | |
| 1011 | 1015 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage )) PORT_DIPLOCATION("SW2:1,2") |
| 1012 | 1016 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C )) |
| 1013 | 1017 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C )) |
| r2844 | r2845 | |
| 1030 | 1034 | PORT_DIPSETTING( 0x80, "6 credits/5 coins" ) |
| 1031 | 1035 | PORT_DIPSETTING( 0xa0, "4 credits/3 coins" ) |
| 1032 | 1036 | |
| 1033 | PORT_START /* IN6, fake trackball input port. */ | |
| 1037 | PORT_START_TAG("TRACK0_X") /* IN6, fake trackball input port. */ | |
| 1034 | 1038 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE |
| 1035 | 1039 | |
| 1036 | PORT_START /* IN7, fake trackball input port. */ | |
| 1040 | PORT_START_TAG("TRACK0_Y") /* IN7, fake trackball input port. */ | |
| 1037 | 1041 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) |
| 1038 | 1042 | |
| 1039 | PORT_START /* IN8, place for cocktail trackball (not used) */ | |
| 1043 | PORT_START_TAG("TRACK1_X") /* IN8, place for cocktail trackball (not used) */ | |
| 1040 | 1044 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1041 | 1045 | |
| 1042 | PORT_START /* IN9, place for cocktail trackball (not used) */ | |
| 1046 | PORT_START_TAG("TRACK1_Y") /* IN9, place for cocktail trackball (not used) */ | |
| 1043 | 1047 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1044 | 1048 | INPUT_PORTS_END |
| 1045 | 1049 | |
| 1046 | 1050 | |
| 1047 | 1051 | static INPUT_PORTS_START( magworm ) |
| 1048 | PORT_START /* IN0 */ | |
| 1052 | PORT_START_TAG("IN0") /* IN0 */ | |
| 1049 | 1053 | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball data */ |
| 1050 | 1054 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet )) |
| 1051 | 1055 | PORT_DIPSETTING( 0x00, DEF_STR( Upright )) |
| r2844 | r2845 | |
| 1054 | 1058 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 1055 | 1059 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball sign bit */ |
| 1056 | 1060 | |
| 1057 | PORT_START /* IN1 */ | |
| 1061 | PORT_START_TAG("IN1") /* IN1 */ | |
| 1058 | 1062 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 1059 | 1063 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) |
| 1060 | 1064 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| r2844 | r2845 | |
| 1064 | 1068 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1065 | 1069 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 1066 | 1070 | |
| 1067 | PORT_START /* IN2 */ | |
| 1071 | PORT_START_TAG("IN2") /* IN2 */ | |
| 1068 | 1072 | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball data */ |
| 1069 | 1073 | PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 1070 | 1074 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball sign bit */ |
| 1071 | 1075 | |
| 1072 | PORT_START /* IN3 */ | |
| 1076 | PORT_START_TAG("IN3") /* IN3 */ | |
| 1073 | 1077 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1074 | 1078 | |
| 1075 | PORT_START /* IN4 */ | |
| 1079 | PORT_START_TAG("DSW1") /* IN4 */ | |
| 1076 | 1080 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage )) PORT_DIPLOCATION("SW1:1,2") |
| 1077 | 1081 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C )) |
| 1078 | 1082 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C )) |
| r2844 | r2845 | |
| 1094 | 1098 | PORT_DIPSETTING( 0x80, "4" ) |
| 1095 | 1099 | PORT_DIPSETTING( 0xc0, "5" ) |
| 1096 | 1100 | |
| 1097 | PORT_START /* IN5 */ | |
| 1101 | PORT_START_TAG("DSW2") /* IN5 */ | |
| 1098 | 1102 | PORT_DIPNAME( 0x01, 0x00, "Left Coin" ) PORT_DIPLOCATION("SW2:1") |
| 1099 | 1103 | PORT_DIPSETTING( 0x00, "*1" ) |
| 1100 | 1104 | PORT_DIPSETTING( 0x01, "*2" ) |
| r2844 | r2845 | |
| 1117 | 1121 | PORT_DIPSETTING( 0x00, "1" ) |
| 1118 | 1122 | PORT_DIPSETTING( 0x80, "2" ) |
| 1119 | 1123 | |
| 1120 | PORT_START /* IN6, fake trackball input port. */ | |
| 1124 | PORT_START_TAG("TRACK0_X") /* IN6, fake trackball input port. */ | |
| 1121 | 1125 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE |
| 1122 | 1126 | |
| 1123 | PORT_START /* IN7, fake trackball input port. */ | |
| 1127 | PORT_START_TAG("TRACK0_Y") /* IN7, fake trackball input port. */ | |
| 1124 | 1128 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) |
| 1125 | 1129 | |
| 1126 | PORT_START /* IN8, fake trackball input port. */ | |
| 1130 | PORT_START_TAG("TRACK1_X") /* IN8, fake trackball input port. */ | |
| 1127 | 1131 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_COCKTAIL |
| 1128 | 1132 | |
| 1129 | PORT_START /* IN9, fake trackball input port. */ | |
| 1133 | PORT_START_TAG("TRACK1_Y") /* IN9, fake trackball input port. */ | |
| 1130 | 1134 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE PORT_COCKTAIL |
| 1131 | 1135 | INPUT_PORTS_END |
| 1132 | 1136 | |
| 1133 | 1137 | |
| 1134 | 1138 | static INPUT_PORTS_START( milliped ) |
| 1135 | PORT_START /* IN0 $2000 */ /* see port 6 for x trackball */ | |
| 1139 | PORT_START_TAG("IN0") /* IN0 $2000 */ /* see port 6 for x trackball */ | |
| 1136 | 1140 | PORT_DIPNAME(0x03, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("P8:1,2") |
| 1137 | 1141 | PORT_DIPSETTING( 0x00, DEF_STR( English ) ) |
| 1138 | 1142 | PORT_DIPSETTING( 0x01, DEF_STR( German ) ) |
| r2844 | r2845 | |
| 1148 | 1152 | PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 1149 | 1153 | PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball sign bit */ |
| 1150 | 1154 | |
| 1151 | PORT_START /* IN1 $2001 */ /* see port 7 for y trackball */ | |
| 1155 | PORT_START_TAG("IN1") /* IN1 $2001 */ /* see port 7 for y trackball */ | |
| 1152 | 1156 | /* these bits are unused */ |
| 1153 | 1157 | PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1154 | 1158 | PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r2844 | r2845 | |
| 1163 | 1167 | PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1164 | 1168 | PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball sign bit */ |
| 1165 | 1169 | |
| 1166 | PORT_START /* IN2 $2010 */ | |
| 1170 | PORT_START_TAG("IN2") /* IN2 $2010 */ | |
| 1167 | 1171 | PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY |
| 1168 | 1172 | PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| 1169 | 1173 | PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| r2844 | r2845 | |
| 1173 | 1177 | PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1174 | 1178 | PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 1175 | 1179 | |
| 1176 | PORT_START /* IN3 $2011 */ | |
| 1180 | PORT_START_TAG("IN3") /* IN3 $2011 */ | |
| 1177 | 1181 | /* Note, joystick X input for player 2 are bad in software */ |
| 1178 | 1182 | PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL |
| 1179 | 1183 | PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL |
| r2844 | r2845 | |
| 1186 | 1190 | PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1187 | 1191 | PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) |
| 1188 | 1192 | |
| 1189 | PORT_START /* 4 */ /* DSW1 $0408 */ | |
| 1193 | PORT_START_TAG("DSW1") /* 4 */ /* DSW1 $0408 */ | |
| 1190 | 1194 | PORT_DIPNAME(0x01, 0x00, "Millipede Head" ) PORT_DIPLOCATION("D5:1") |
| 1191 | 1195 | PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) |
| 1192 | 1196 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| r2844 | r2845 | |
| 1210 | 1214 | PORT_DIPSETTING( 0x80, DEF_STR( Off )) |
| 1211 | 1215 | PORT_DIPSETTING( 0x00, DEF_STR( On )) |
| 1212 | 1216 | |
| 1213 | PORT_START /* 5 */ /* DSW2 $0808 */ | |
| 1217 | PORT_START_TAG("DSW2") /* 5 */ /* DSW2 $0808 */ | |
| 1214 | 1218 | PORT_DIPNAME(0x03, 0x02, DEF_STR( Coinage )) PORT_DIPLOCATION("B5:1,2") |
| 1215 | 1219 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C )) |
| 1216 | 1220 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C )) |
| r2844 | r2845 | |
| 1233 | 1237 | PORT_DIPSETTING( 0xa0, "4 credits/3 coins" ) |
| 1234 | 1238 | PORT_DIPSETTING( 0xc0, "Demo Mode" ) |
| 1235 | 1239 | |
| 1236 | PORT_START /* IN6, fake trackball input port. */ | |
| 1240 | PORT_START_TAG("TRACK0_X") /* IN6, fake trackball input port. */ | |
| 1237 | 1241 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE |
| 1238 | 1242 | |
| 1239 | PORT_START /* IN7, fake trackball input port. */ | |
| 1243 | PORT_START_TAG("TRACK0_Y") /* IN7, fake trackball input port. */ | |
| 1240 | 1244 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) |
| 1241 | 1245 | |
| 1242 | PORT_START /* IN8, fake trackball input port. */ | |
| 1246 | PORT_START_TAG("TRACK1_X") /* IN8, fake trackball input port. */ | |
| 1243 | 1247 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_COCKTAIL |
| 1244 | 1248 | |
| 1245 | PORT_START /* IN9, fake trackball input port. */ | |
| 1249 | PORT_START_TAG("TRACK1_Y") /* IN9, fake trackball input port. */ | |
| 1246 | 1250 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE PORT_COCKTAIL |
| 1247 | 1251 | INPUT_PORTS_END |
| 1248 | 1252 | |
| 1249 | 1253 | |
| 1250 | 1254 | static INPUT_PORTS_START( warlords ) |
| 1251 | PORT_START /* IN0 */ | |
| 1255 | PORT_START_TAG("IN0") /* IN0 */ | |
| 1252 | 1256 | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 1253 | 1257 | PORT_DIPNAME( 0x10, 0x00, "Diag Step" ) /* Not referenced */ |
| 1254 | 1258 | PORT_DIPSETTING( 0x00, DEF_STR( Off )) |
| r2844 | r2845 | |
| 1259 | 1263 | PORT_DIPSETTING( 0x80, "Upright (overlay)" ) |
| 1260 | 1264 | PORT_DIPSETTING( 0x00, "Cocktail (no overlay)" ) |
| 1261 | 1265 | |
| 1262 | PORT_START /* IN1 */ | |
| 1266 | PORT_START_TAG("IN1") /* IN1 */ | |
| 1263 | 1267 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 1264 | 1268 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 1265 | 1269 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) |
| r2844 | r2845 | |
| 1269 | 1273 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1270 | 1274 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 1271 | 1275 | |
| 1272 | PORT_START /* IN2 */ | |
| 1276 | PORT_START_TAG("DSW1") /* IN2 */ | |
| 1273 | 1277 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("J2:1,2") |
| 1274 | 1278 | PORT_DIPSETTING( 0x00, DEF_STR( English ) ) |
| 1275 | 1279 | PORT_DIPSETTING( 0x01, DEF_STR( French ) ) |
| r2844 | r2845 | |
| 1284 | 1288 | PORT_DIPSETTING( 0x10, "1p = 1, 2p = 2" ) |
| 1285 | 1289 | PORT_DIPSETTING( 0x20, "1p/2p = 2 credits" ) |
| 1286 | 1290 | |
| 1287 | PORT_START /* IN3 */ | |
| 1291 | PORT_START_TAG("DSW2") /* IN3 */ | |
| 1288 | 1292 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage )) PORT_DIPLOCATION("M2:1,2") |
| 1289 | 1293 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C )) |
| 1290 | 1294 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C )) |
| r2844 | r2845 | |
| 1306 | 1310 | PORT_DIPSETTING( 0x80, "6 credits/5 coins" ) |
| 1307 | 1311 | |
| 1308 | 1312 | /* IN4-7 fake to control player paddles */ |
| 1309 | PORT_START | |
| 1313 | PORT_START_TAG("PADDLE0") | |
| 1310 | 1314 | PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x1d,0xcb) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_PLAYER(1) |
| 1311 | 1315 | |
| 1312 | PORT_START | |
| 1316 | PORT_START_TAG("PADDLE1") | |
| 1313 | 1317 | PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x1d,0xcb) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_PLAYER(2) |
| 1314 | 1318 | |
| 1315 | PORT_START | |
| 1319 | PORT_START_TAG("PADDLE2") | |
| 1316 | 1320 | PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x1d,0xcb) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_PLAYER(3) |
| 1317 | 1321 | |
| 1318 | PORT_START | |
| 1322 | PORT_START_TAG("PADDLE3") | |
| 1319 | 1323 | PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x1d,0xcb) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_PLAYER(4) |
| 1320 | 1324 | INPUT_PORTS_END |
| 1321 | 1325 | |
| 1322 | 1326 | |
| 1323 | 1327 | static INPUT_PORTS_START( mazeinv ) |
| 1324 | PORT_START /* IN0 */ | |
| 1328 | PORT_START_TAG("IN0") /* IN0 */ | |
| 1325 | 1329 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Language )) |
| 1326 | 1330 | PORT_DIPSETTING( 0x00, DEF_STR( English )) |
| 1327 | 1331 | PORT_DIPSETTING( 0x01, DEF_STR( German )) |
| r2844 | r2845 | |
| 1344 | 1348 | PORT_DIPSETTING( 0x40, "2" ) |
| 1345 | 1349 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 1346 | 1350 | |
| 1347 | PORT_START /* IN1 */ | |
| 1351 | PORT_START_TAG("IN1") /* IN1 */ | |
| 1348 | 1352 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1349 | 1353 | |
| 1350 | PORT_START /* IN2 */ | |
| 1354 | PORT_START_TAG("IN2") /* IN2 */ | |
| 1351 | 1355 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1352 | 1356 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1353 | 1357 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| r2844 | r2845 | |
| 1357 | 1361 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) |
| 1358 | 1362 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1359 | 1363 | |
| 1360 | PORT_START /* IN3 */ | |
| 1364 | PORT_START_TAG("IN3") /* IN3 */ | |
| 1361 | 1365 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1362 | 1366 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1363 | 1367 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 1367 | 1371 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) |
| 1368 | 1372 | PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) |
| 1369 | 1373 | |
| 1370 | PORT_START /* IN4 */ | |
| 1374 | PORT_START_TAG("DSW1") /* IN4 */ | |
| 1371 | 1375 | PORT_DIPNAME( 0x03, 0x00, "Doors for bonus" ) |
| 1372 | 1376 | PORT_DIPSETTING( 0x00, "10" ) |
| 1373 | 1377 | PORT_DIPSETTING( 0x01, "12" ) |
| r2844 | r2845 | |
| 1389 | 1393 | PORT_DIPSETTING( 0x80, DEF_STR( Hard )) |
| 1390 | 1394 | PORT_DIPSETTING( 0xc0, DEF_STR( Harder )) |
| 1391 | 1395 | |
| 1392 | PORT_START /* IN5 */ | |
| 1396 | PORT_START_TAG("DSW2") /* IN5 */ | |
| 1393 | 1397 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage )) |
| 1394 | 1398 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C )) |
| 1395 | 1399 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C )) |
| r2844 | r2845 | |
| 1411 | 1415 | PORT_DIPSETTING( 0x80, "6 credits/5 coins" ) |
| 1412 | 1416 | |
| 1413 | 1417 | /* IN6-9 fake to control player joysticks */ |
| 1414 | PORT_START | |
| 1418 | PORT_START_TAG("STICK0") | |
| 1415 | 1419 | PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_MINMAX(0x40, 0xbf) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1) |
| 1416 | 1420 | |
| 1417 | PORT_START | |
| 1421 | PORT_START_TAG("STICK1") | |
| 1418 | 1422 | |
| 1419 | PORT_START | |
| 1423 | PORT_START_TAG("STICK2") | |
| 1420 | 1424 | PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_MINMAX(0x40, 0xbf) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) |
| 1421 | 1425 | |
| 1422 | PORT_START | |
| 1426 | PORT_START_TAG("STICK3") | |
| 1423 | 1427 | INPUT_PORTS_END |
| 1424 | 1428 | |
| 1425 | 1429 | |
| 1426 | 1430 | static INPUT_PORTS_START( bullsdrt ) |
| 1427 | PORT_START /* IN0 */ | |
| 1431 | PORT_START_TAG("IN0") /* IN0 */ | |
| 1428 | 1432 | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball data */ |
| 1429 | 1433 | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1430 | 1434 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 1431 | 1435 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball sign bit */ |
| 1432 | 1436 | |
| 1433 | PORT_START /* IN1 */ | |
| 1437 | PORT_START_TAG("IN1") /* IN1 */ | |
| 1434 | 1438 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 1435 | 1439 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) |
| 1436 | 1440 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| r2844 | r2845 | |
| 1440 | 1444 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1441 | 1445 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) |
| 1442 | 1446 | |
| 1443 | PORT_START /* IN2 */ | |
| 1447 | PORT_START_TAG("IN2") /* IN2 */ | |
| 1444 | 1448 | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball data */ |
| 1445 | 1449 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1446 | 1450 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* trackball sign bit */ |
| 1447 | 1451 | |
| 1448 | PORT_START | |
| 1452 | PORT_START_TAG("DSW1") | |
| 1449 | 1453 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1") |
| 1450 | 1454 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 1451 | 1455 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 1471 | 1475 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 1472 | 1476 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1473 | 1477 | |
| 1474 | PORT_START | |
| 1478 | PORT_START_TAG("DSW2") | |
| 1475 | 1479 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1") |
| 1476 | 1480 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 1477 | 1481 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 1497 | 1501 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 1498 | 1502 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1499 | 1503 | |
| 1500 | PORT_START | |
| 1501 | /* not used */ | |
| 1502 | ||
| 1503 | PORT_START /* IN6, fake trackball input port. */ | |
| 1504 | PORT_START_TAG("TRACK0_X") /* fake trackball input port. */ | |
| 1504 | 1505 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE |
| 1505 | 1506 | |
| 1506 | PORT_START /* | |
| 1507 | PORT_START_TAG("TRACK0_Y") /* | |
| 1507 | 1508 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) |
| 1509 | ||
| 1510 | /* 2008-06 FP: was bullsdrt available as cocktail? If not, these can be removed */ | |
| 1511 | PORT_START_TAG("TRACK1_X") | |
| 1512 | ||
| 1513 | PORT_START_TAG("TRACK1_Y") | |
| 1508 | 1514 | INPUT_PORTS_END |
| 1509 | 1515 | |
| 1510 | 1516 |
| r2844 | r2845 | |
|---|---|---|
| 211 | 211 | static READ16_HANDLER( joystick_r ) |
| 212 | 212 | { |
| 213 | 213 | int newval = 0xff; |
| 214 | char port[ | |
| 214 | static const char *portnames[ | |
| 215 | 215 | |
| 216 | 216 | /* digital joystick type */ |
| 217 | 217 | if (joystick_type == 1) |
| r2844 | r2845 | |
| 219 | 219 | |
| 220 | 220 | /* Hall-effect analog joystick */ |
| 221 | 221 | else if (joystick_type == 2) |
| 222 | { | |
| 223 | sprintf(port, "IN%d", offset & 1); | |
| 224 | newval = input_port_read(machine, port); | |
| 225 | } | |
| 222 | newval = input_port_read(machine, portnames[offset & 1]); | |
| 226 | 223 | |
| 227 | 224 | /* Road Blasters gas pedal */ |
| 228 | 225 | else if (joystick_type == 3) |
| r2844 | r2845 | |
|---|---|---|
| 93 | 93 | |
| 94 | 94 | static WRITE16_HANDLER( a2d_select_w ) |
| 95 | 95 | { |
| 96 | char port[ | |
| 96 | static const char *portnames[ | |
| 97 | 97 | |
| 98 | sprintf(port, "A2D%d", (offset != 0)); | |
| 99 | analog_data = input_port_read(machine, port); | |
| 98 | analog_data = input_port_read(machine, portnames[offset != 0]); | |
| 100 | 99 | } |
| 101 | 100 | |
| 102 | 101 | |
| r2844 | r2845 | |
| 115 | 114 | asic65_reset((~data >> 14) & 1); |
| 116 | 115 | |
| 117 | 116 | /* bits 13-11 are the MO control bits */ |
| 118 | atarirle_control_w(0, (data >> 11) & 7); | |
| 117 | atarirle_control_w(machine, 0, (data >> 11) & 7); | |
| 119 | 118 | } |
| 120 | 119 | |
| 121 | 120 | /* lower byte */ |
| r2844 | r2845 | |
|---|---|---|
| 181 | 181 | static READ8_HANDLER( angelkds_input_r ) |
| 182 | 182 | { |
| 183 | 183 | int fake; |
| 184 | char port1[4], port2[6]; | |
| 184 | static const char *portnames[] = { "I81", "I82" }; | |
| 185 | static const char *fakenames[] = { "FAKE1", "FAKE2" }; | |
| 185 | 186 | |
| 186 | sprintf(port1, "I8%d", 1 + offset); | |
| 187 | sprintf(port2, "FAKE%d", 1 + offset); | |
| 188 | fake = input_port_read(machine, port2); | |
| 187 | fake = input_port_read(machine, fakenames[offset]); | |
| 189 | 188 | |
| 190 | return ((fake & 0x01) ? fake : input_port_read(machine, port | |
| 189 | return ((fake & 0x01) ? fake : input_port_read(machine, portnames[offset])); | |
| 191 | 190 | } |
| 192 | 191 | |
| 193 | 192 | #else |
| 194 | 193 | |
| 195 | 194 | static READ8_HANDLER( angelkds_input_r ) |
| 196 | 195 | { |
| 197 | char port[ | |
| 196 | static const char *portnames[ | |
| 198 | 197 | |
| 199 | sprintf(port, "I8%d", 1 + offset); | |
| 200 | return input_port_read(machine, port); | |
| 198 | return input_port_read(machine, portnames[offset]); | |
| 201 | 199 | } |
| 202 | 200 | |
| 203 | 201 | #endif |
| r2844 | r2845 | |
|---|---|---|
| 99 | 99 | #include "audio/taitosnd.h" |
| 100 | 100 | #include "sound/2151intf.h" |
| 101 | 101 | #include "sound/msm5205.h" |
| 102 | #include "includes/cchip.h" | |
| 102 | 103 | |
| 103 | 104 | int opwolf_region; |
| 104 | 105 | |
| r2844 | r2845 | |
| 107 | 108 | static UINT8 adpcm_c[0x08]; |
| 108 | 109 | static int opwolf_gun_xoffs, opwolf_gun_yoffs; |
| 109 | 110 | |
| 110 | void opwolf_cchip_init(void); | |
| 111 | ||
| 112 | READ16_HANDLER( opwolf_cchip_status_r ); | |
| 113 | READ16_HANDLER( opwolf_cchip_data_r ); | |
| 114 | WRITE16_HANDLER( opwolf_cchip_status_w ); | |
| 115 | WRITE16_HANDLER( opwolf_cchip_data_w ); | |
| 116 | WRITE16_HANDLER( opwolf_cchip_bank_w ); | |
| 117 | 111 | WRITE16_HANDLER( rainbow_spritectrl_w ); |
| 118 | 112 | WRITE16_HANDLER( rastan_spriteflip_w ); |
| 119 | 113 | VIDEO_START( opwolf ); |
| r2844 | r2845 | |
|---|---|---|
| 563 | 563 | switch(reg) |
| 564 | 564 | { |
| 565 | 565 | case 0x78: /* GCU Status */ |
| 566 | /* ppd checks bits 0x0041 of the upper halfword on interrupt */ | |
| 566 | 567 | return 0xffff0005; |
| 567 | 568 | |
| 568 | 569 | default: |
| r2844 | r2845 | |
| 585 | 586 | switch(reg) |
| 586 | 587 | { |
| 587 | 588 | case 0x10: /* ??? */ |
| 589 | /* IRQ clear/enable; ppd writes bit off then on in response to interrupt */ | |
| 590 | /* it enables bits 0x41, but 0x01 seems to be the one it cares about */ | |
| 591 | if (ACCESSING_BITS_16_31 && (data & 0x0001) == 0) | |
| 592 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, CLEAR_LINE); | |
| 588 | 593 | break; |
| 589 | 594 | |
| 590 | 595 | case 0x30: |
| r2844 | r2845 | |
| 855 | 860 | cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ4, ASSERT_LINE); |
| 856 | 861 | } |
| 857 | 862 | |
| 863 | static void atapi_clear_irq(void) | |
| 864 | { | |
| 865 | cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ4, CLEAR_LINE); | |
| 866 | } | |
| 867 | ||
| 858 | 868 | static void atapi_exit(running_machine* machine) |
| 859 | 869 | { |
| 860 | 870 | SCSIDeleteInstance(atapi_device_data[1]); |
| r2844 | r2845 | |
| 952 | 962 | } |
| 953 | 963 | else |
| 954 | 964 | { |
| 965 | if (reg == ATAPI_REG_CMDSTATUS) | |
| 966 | atapi_clear_irq(); | |
| 955 | 967 | return atapi_regs[reg]; |
| 956 | 968 | } |
| 957 | 969 | } |
| r2844 | r2845 | |
| 1417 | 1429 | { |
| 1418 | 1430 | if (channel == 0) |
| 1419 | 1431 | { |
| 1420 | if ((extend_board_irq_enable & 0x02) == 0) | |
| 1432 | if ((extend_board_irq_enable & 0x02) == 0 && value != CLEAR_LINE) | |
| 1421 | 1433 | { |
| 1422 | 1434 | extend_board_irq_active |= 0x02; |
| 1423 | 1435 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ1, ASSERT_LINE); |
| 1424 | 1436 | } |
| 1437 | else | |
| 1438 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ1, CLEAR_LINE); | |
| 1425 | 1439 | } |
| 1426 | 1440 | else |
| 1427 | 1441 | { |
| 1428 | if ((extend_board_irq_enable & 0x01) == 0) | |
| 1442 | if ((extend_board_irq_enable & 0x01) == 0 && value != CLEAR_LINE) | |
| 1429 | 1443 | { |
| 1430 | 1444 | extend_board_irq_active |= 0x01; |
| 1431 | 1445 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ1, ASSERT_LINE); |
| 1432 | 1446 | } |
| 1447 | else | |
| 1448 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ1, CLEAR_LINE); | |
| 1433 | 1449 | } |
| 1434 | 1450 | } |
| 1435 | 1451 | |
| r2844 | r2845 | |
| 1743 | 1759 | |
| 1744 | 1760 | /*****************************************************************************/ |
| 1745 | 1761 | |
| 1762 | static UINT32 *work_ram; | |
| 1763 | static MACHINE_START( firebeat ) | |
| 1764 | { | |
| 1765 | /* set conservative DRC options */ | |
| 1766 | cpunum_set_info_int(0, CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS); | |
| 1767 | ||
| 1768 | /* configure fast RAM regions for DRC */ | |
| 1769 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_SELECT, 0); | |
| 1770 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_START, 0x00000000); | |
| 1771 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_END, 0x01ffffff); | |
| 1772 | cpunum_set_info_ptr(0, CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram); | |
| 1773 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_READONLY, 0); | |
| 1774 | } | |
| 1775 | ||
| 1746 | 1776 | static ADDRESS_MAP_START( firebeat_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 1777 | AM_RANGE(0x00000000, 0x01ffffff) AM_RAM AM_BASE(&work_ram) | |
| 1747 | 1778 | AM_RANGE(0x70000000, 0x70000fff) AM_READWRITE(midi_uart_r, midi_uart_w) |
| 1748 | 1779 | AM_RANGE(0x70006000, 0x70006003) AM_WRITE(extend_board_irq_w) |
| 1749 | 1780 | AM_RANGE(0x70008000, 0x7000800f) AM_READ(keyboard_wheel_r) |
| r2844 | r2845 | |
| 1761 | 1792 | AM_RANGE(0x7e800100, 0x7e8001ff) AM_READWRITE(gcu1_r, gcu1_w) |
| 1762 | 1793 | AM_RANGE(0x7fe00000, 0x7fe0000f) AM_READWRITE(atapi_command_r, atapi_command_w) |
| 1763 | 1794 | AM_RANGE(0x7fe80000, 0x7fe8000f) AM_READWRITE(atapi_control_r, atapi_control_w) |
| 1764 | AM_RANGE(0x80000000, 0x81ffffff) AM_RAM | |
| 1765 | AM_RANGE(0xfff80000, 0xffffffff) AM_ROM AM_REGION(REGION_USER1, 0) /* System BIOS */ | |
| 1795 | AM_RANGE(0x7ff80000, 0x7fffffff) AM_ROM AM_REGION(REGION_USER1, 0) /* System BIOS */ | |
| 1766 | 1796 | ADDRESS_MAP_END |
| 1767 | 1797 | |
| 1768 | 1798 | static ADDRESS_MAP_START( spu_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| r2844 | r2845 | |
| 1992 | 2022 | MDRV_CPU_PROGRAM_MAP(firebeat_map, 0) |
| 1993 | 2023 | MDRV_CPU_VBLANK_INT("main", firebeat_interrupt) |
| 1994 | 2024 | |
| 2025 | MDRV_MACHINE_START(firebeat) | |
| 1995 | 2026 | MDRV_MACHINE_RESET(firebeat) |
| 1996 | 2027 | MDRV_NVRAM_HANDLER(firebeat) |
| 1997 | 2028 | |
| r2844 | r2845 | |
| 2225 | 2256 | { |
| 2226 | 2257 | int r = ibutton_w(data); |
| 2227 | 2258 | if (r >= 0) |
| 2228 | cpu | |
| 2259 | ppc4xx_spu | |
| 2229 | 2260 | } |
| 2230 | 2261 | |
| 2231 | 2262 | /*****************************************************************************/ |
| r2844 | r2845 | |
| 2260 | 2291 | |
| 2261 | 2292 | cur_cab_data = cab_data; |
| 2262 | 2293 | |
| 2263 | cpu | |
| 2294 | ppc4xx_spu | |
| 2264 | 2295 | |
| 2265 | 2296 | set_ibutton(rom); |
| 2266 | 2297 |
| r2844 | r2845 | |
|---|---|---|
| 60 | 60 | #include "sound/ay8910.h" |
| 61 | 61 | #include "sound/msm5232.h" |
| 62 | 62 | #include "cpu/m6805/m6805.h" |
| 63 | #include "includes/bigevglf.h" | |
| 63 | 64 | |
| 64 | VIDEO_START( bigevglf ); | |
| 65 | VIDEO_UPDATE( bigevglf ); | |
| 66 | ||
| 67 | READ8_HANDLER( bigevglf_vidram_r ); | |
| 68 | WRITE8_HANDLER( bigevglf_vidram_w ); | |
| 69 | WRITE8_HANDLER( bigevglf_vidram_addr_w ); | |
| 70 | ||
| 71 | READ8_HANDLER( bigevglf_68705_portA_r ); | |
| 72 | WRITE8_HANDLER( bigevglf_68705_portA_w ); | |
| 73 | READ8_HANDLER( bigevglf_68705_portB_r ); | |
| 74 | WRITE8_HANDLER( bigevglf_68705_portB_w ); | |
| 75 | READ8_HANDLER( bigevglf_68705_portC_r ); | |
| 76 | WRITE8_HANDLER( bigevglf_68705_portC_w ); | |
| 77 | WRITE8_HANDLER( bigevglf_68705_ddrA_w ); | |
| 78 | WRITE8_HANDLER( bigevglf_68705_ddrB_w ); | |
| 79 | WRITE8_HANDLER( bigevglf_68705_ddrC_w ); | |
| 80 | ||
| 81 | WRITE8_HANDLER( bigevglf_mcu_w ); | |
| 82 | WRITE8_HANDLER( bigevglf_mcu_set_w ); | |
| 83 | READ8_HANDLER( bigevglf_mcu_r ); | |
| 84 | READ8_HANDLER( bigevglf_mcu_status_r ); | |
| 85 | ||
| 86 | WRITE8_HANDLER( bigevglf_gfxcontrol_w ); | |
| 87 | WRITE8_HANDLER( bigevglf_palette_w ); | |
| 88 | ||
| 89 | extern UINT8 *bigevglf_spriteram1; | |
| 90 | extern UINT8 *bigevglf_spriteram2; | |
| 91 | ||
| 92 | 65 | static UINT32 beg_bank=0; |
| 93 | 66 | static UINT8 *beg_sharedram; |
| 94 | 67 | |
| r2844 | r2845 | |
| 228 | 201 | |
| 229 | 202 | static INPUT_PORTS_START( bigevglf ) |
| 230 | 203 | |
| 231 | PORT_START /* port 00 on sub cpu */ | |
| 204 | PORT_START_TAG("PORT00") /* port 00 on sub cpu */ | |
| 232 | 205 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 ) |
| 233 | 206 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 ) |
| 234 | 207 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 238 | 211 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT ) |
| 239 | 212 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 240 | 213 | |
| 241 | PORT_START /* port 04 on sub cpu - bit 0 and bit 1 are coin inputs */ | |
| 214 | PORT_START_TAG("PORT04") /* port 04 on sub cpu - bit 0 and bit 1 are coin inputs */ | |
| 242 | 215 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 243 | 216 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) |
| 244 | 217 | |
| 245 | PORT_START_TAG("DSW1") /* port 05 on sub cpu */ | |
| 218 | PORT_START_TAG("DSW1") /* port 05 on sub cpu */ | |
| 246 | 219 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:1") |
| 247 | 220 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 248 | 221 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r2844 | r2845 | |
| 259 | 232 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) ) |
| 260 | 233 | PORT_DIPSETTING( 0xa0, DEF_STR( 1C_2C ) ) |
| 261 | 234 | |
| 262 | PORT_START_TAG("DSW2") /* port 06 on sub cpu */ | |
| 235 | PORT_START_TAG("DSW2") /* port 06 on sub cpu */ | |
| 263 | 236 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") |
| 264 | 237 | PORT_DIPSETTING( 0x01, DEF_STR( Easy ) ) |
| 265 | 238 | PORT_DIPSETTING( 0x03, DEF_STR( Normal ) ) |
| r2844 | r2845 | |
| 283 | 256 | PORT_DIPSETTING( 0x20, "9" ) |
| 284 | 257 | PORT_DIPSETTING( 0x00, "10" ) |
| 285 | 258 | |
| 286 | PORT_START | |
| 259 | PORT_START_TAG("TRACKX") /* TRACKBALL X - port 02 on sub cpu */ | |
| 287 | 260 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) |
| 288 | 261 | |
| 289 | PORT_START | |
| 262 | PORT_START_TAG("TRACKY") /* TRACKBALL Y - port 03 on sub cpu */ | |
| 290 | 263 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_REVERSE |
| 291 | 264 | INPUT_PORTS_END |
| 292 | 265 | |
| r2844 | r2845 | |
| 377 | 350 | |
| 378 | 351 | */ |
| 379 | 352 | bit5 ^= 0x20; |
| 380 | return bigevglf_mcu_status_r(machine,0) | (input_port_read | |
| 353 | return bigevglf_mcu_status_r(machine,0) | (input_port_read | |
| 381 | 354 | } |
| 382 | 355 | |
| 383 | 356 | static ADDRESS_MAP_START( bigevglf_sub_readport, ADDRESS_SPACE_IO, 8 ) |
| 384 | 357 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 385 | AM_RANGE(0x00, 0x00) AM_READ | |
| 358 | AM_RANGE(0x00, 0x00) AM_READ | |
| 386 | 359 | AM_RANGE(0x01, 0x01) AM_READ(SMH_NOP) |
| 387 | AM_RANGE(0x02, 0x02) AM_READ(input_port_4_r) | |
| 388 | AM_RANGE(0x03, 0x03) AM_READ(input_port_5_r) | |
| 360 | AM_RANGE(0x02, 0x02) AM_READ_PORT("TRACKX") | |
| 361 | AM_RANGE(0x03, 0x03) AM_READ_PORT("TRACKY") | |
| 389 | 362 | AM_RANGE(0x04, 0x04) AM_READ(sub_cpu_mcu_coin_port_r) |
| 390 | AM_RANGE(0x05, 0x05) AM_READ(input_port_2_r) | |
| 391 | AM_RANGE(0x06, 0x06) AM_READ(input_port_3_r) | |
| 363 | AM_RANGE(0x05, 0x05) AM_READ_PORT("DSW1") | |
| 364 | AM_RANGE(0x06, 0x06) AM_READ_PORT("DSW2") | |
| 392 | 365 | AM_RANGE(0x07, 0x07) AM_READ(SMH_NOP) |
| 393 | 366 | AM_RANGE(0x0b, 0x0b) AM_READ(bigevglf_mcu_r) |
| 394 | 367 | AM_RANGE(0x20, 0x20) AM_READ(beg_fromsound_r) |
| r2844 | r2845 | |
|---|---|---|
| 63 | 63 | #include "sound/ay8910.h" |
| 64 | 64 | #include "sound/5110intf.h" |
| 65 | 65 | #include "sound/tms5110.h" |
| 66 | #include "includes/bagman.h" | |
| 66 | 67 | |
| 67 | 68 | |
| 68 | extern READ8_HANDLER( bagman_pal16r6_r ); | |
| 69 | extern MACHINE_RESET( bagman ); | |
| 70 | extern WRITE8_HANDLER( bagman_pal16r6_w ); | |
| 71 | ||
| 72 | ||
| 73 | extern UINT8 *bagman_video_enable; | |
| 74 | ||
| 75 | extern WRITE8_HANDLER( bagman_videoram_w ); | |
| 76 | extern WRITE8_HANDLER( bagman_colorram_w ); | |
| 77 | extern WRITE8_HANDLER( bagman_flipscreen_w ); | |
| 78 | ||
| 79 | extern PALETTE_INIT( bagman ); | |
| 80 | extern VIDEO_START( bagman ); | |
| 81 | extern VIDEO_UPDATE( bagman ); | |
| 82 | ||
| 83 | ||
| 84 | 69 | static int speech_rom_address = 0; |
| 85 | 70 | |
| 86 | 71 | static UINT8 ls259_buf[8] = {0,0,0,0,0,0,0,0}; |
| r2844 | r2845 | |
| 220 | 205 | #endif |
| 221 | 206 | ADDRESS_MAP_END |
| 222 | 207 | |
| 208 | ||
| 209 | ||
| 223 | 210 | static ADDRESS_MAP_START( pickin_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 224 | 211 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 225 | 212 | AM_RANGE(0x7000, 0x77ff) AM_RAM |
| r2844 | r2845 | |
| 234 | 221 | AM_RANGE(0xa003, 0xa003) AM_WRITE(SMH_RAM) AM_BASE(&bagman_video_enable) |
| 235 | 222 | AM_RANGE(0xa004, 0xa004) AM_WRITE(bagman_coin_counter_w) |
| 236 | 223 | AM_RANGE(0xa800, 0xa800) AM_READ(input_port_2_r) |
| 224 | ||
| 225 | ||
| 226 | ||
| 237 | 227 | #if 0 |
| 238 | 228 | AM_RANGE(0xa007, 0xa007) AM_WRITE(SMH_NOP) /* ???? */ |
| 239 | 229 | AM_RANGE(0xb000, 0xb000) AM_WRITE(SMH_NOP) /* ???? */ |
| 240 | AM_RANGE(0xb800, 0xb800) AM_READ(SMH_NOP) | |
| 230 | AM_RANGE(0xb800, 0xb800) AM_READ(SMH_NOP) /* ???? */ | |
| 241 | 231 | AM_RANGE(0xb800, 0xb800) AM_WRITE(SMH_NOP) /* ???? */ |
| 242 | 232 | #endif |
| 243 | 233 | ADDRESS_MAP_END |
| r2844 | r2845 | |
| 785 | 775 | ROM_LOAD( "bota_3a.3a", 0x0020, 0x0020, CRC(edf88f34) SHA1(b9c342d51303d552f87df2543a34e38c30acd07c) ) |
| 786 | 776 | ROM_END |
| 787 | 777 | |
| 778 | /* | |
| 779 | ||
| 780 | Squash (Itisa) | |
| 781 | ||
| 782 | Anno 1984 | |
| 783 | Produttore Itisa-Valadon-gecas | |
| 784 | ||
| 785 | CPU | |
| 786 | ||
| 787 | 1x SGS Z8400AB1-Z80ACPU (main) | |
| 788 | 2x AY-3-8910 (sound) | |
| 789 | 1x LM380 (sound) | |
| 790 | 1x oscillator 18432 | |
| 791 | ROMs | |
| 792 | ||
| 793 | 7x 2732 | |
| 794 | 2x MMI6331 | |
| 795 | Note | |
| 796 | ||
| 797 | 1x 22x2 edge connector | |
| 798 | 1x trimmer (volume) | |
| 799 | 1x 8 switches dip | |
| 800 | ||
| 801 | This is a strange thing: the PCB is marked "Valadon Automation (C) 1983" and "Fabrique | |
| 802 | sous licence par GECAS/MILANO" (manufactured under license from GECAS/MILANO) | |
| 803 | ||
| 804 | But if you look in rom 7 with an hex editor you can see the following: "(C) 1984 ITISA" | |
| 805 | and "UN BONJOUR A JACQUES DE PEPE PETIT ET HENK" (a good morning to Jacques from Pepe | |
| 806 | Petit and Henk). These are the programmers in ITISA, Henk Spits, Josep M. Petit, Josep | |
| 807 | Morillas, the very same 3 persons working on BOTANIC (1984)(ITISA). | |
| 808 | ||
| 809 | Game writings in the eprom are in English and Spanish. | |
| 810 | ||
| 811 | So we have an English/Spanish game with a French easter egg on a French PCB manufactured | |
| 812 | under licence from an Italian company! Let's call it melting pot! | |
| 813 | ||
| 814 | */ | |
| 815 | ||
| 816 | ROM_START( squaitsa ) | |
| 817 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 818 | ROM_LOAD( "sq5.3.9e", 0x0000, 0x1000,CRC(04128d92) SHA1(ca7b7c4be5f40bcefc92b231ce3bba859c9967ee) ) | |
| 819 | ROM_LOAD( "sq6.4.9f", 0x1000, 0x1000,CRC(4ff7dd56) SHA1(1955675a9ee3ad7b9185cd027bc42284e15c7451) ) | |
| 820 | ROM_LOAD( "sq7.5.9j", 0x2000, 0x1000,CRC(e46ecda6) SHA1(25cd94b6c9602cc00fe3459b524639fd3beb72be) ) | |
| 821 | ||
| 822 | ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 823 | ROM_LOAD( "sq2.1.1e", 0x0000, 0x1000,CRC(0eb6ecad) SHA1(da2facbfa5f2fe233ea09777e9880b4f1d3c1079) ) | |
| 824 | ROM_LOAD( "sq4.2.1j", 0x1000, 0x1000,CRC(8d875b0e) SHA1(f949da71167aa81c1cfaefc6f3d88b57792b6191) ) | |
| 825 | ||
| 826 | ROM_REGION( 0x2000, REGION_GFX2, ROMREGION_DISPOSE ) | |
| 827 | ROM_LOAD( "sq1.1c", 0x0000, 0x1000,CRC(b6d563e5) SHA1(90a89fd8e892a612c74bd2c7e38acb08c22c6046) ) | |
| 828 | ROM_LOAD( "sq3.1f", 0x1000, 0x1000,CRC(0d9d87e6) SHA1(881039d3b8805bb1a546e28abda3273e79714033) ) | |
| 829 | ||
| 830 | ROM_REGION( 0x0040, REGION_PROMS, 0 ) | |
| 831 | ROM_LOAD( "mmi6331.3p", 0x0000, 0x0020,CRC(06eab7ce) SHA1(d0bafedb340bf12d81446cc672307bb01e5d3026) ) | |
| 832 | ROM_LOAD( "mmi6331.3r", 0x0020, 0x0020,CRC(86c1e7db) SHA1(5c974b51d770a555ddab5c23f03a666c6f286cbf) ) | |
| 833 | ROM_END | |
| 834 | ||
| 788 | 835 | static DRIVER_INIT( bagnarda ) |
| 789 | 836 | { |
| 790 | 837 | /* initialize video enable because it's not done in the code */ |
| r2844 | r2845 | |
| 800 | 847 | GAME( 1984, sbagmans, sbagman, bagman, sbagman, 0, ROT270, "Valadon Automation (Stern license)", "Super Bagman (Stern)", 0 ) |
| 801 | 848 | GAME( 1983, pickin, 0, pickin, pickin, 0, ROT270, "Valadon Automation", "Pickin'", 0 ) |
| 802 | 849 | GAME( 1984, botanic, 0, botanic, botanic, 0, ROT270, "Valadon Automation (Itisa license)", "Botanic", 0 ) |
| 850 | GAME( 1984, squaitsa, 0, botanic, botanic, 0, ROT0, "Itisa", "Squash (Itisa)", GAME_NOT_WORKING ) | |
| 803 | 851 |
| r2844 | r2845 | |
|---|---|---|
| 423 | 423 | |
| 424 | 424 | static READ16_HANDLER( adc_r ) |
| 425 | 425 | { |
| 426 | char | |
| 426 | static const char *adcnames[ | |
| 427 | 427 | |
| 428 | sprintf(port, "ADC%d", which_adc); | |
| 429 | 428 | if (which_adc < pedal_count) |
| 430 | return ~input_port_read(machine, | |
| 429 | return ~input_port_read(machine, adcnames[which_adc]); | |
| 431 | 430 | |
| 432 | return input_port_read(machine, | |
| 431 | return input_port_read(machine, adcnames[which_adc]) | 0xff00; | |
| 433 | 432 | } |
| 434 | 433 | |
| 435 | 434 | |
| 436 | 435 | static READ8_HANDLER( leta_r ) |
| 437 | 436 | { |
| 438 | char | |
| 437 | static const char *letanames[ | |
| 439 | 438 | |
| 440 | 439 | if (pedal_count == -1) /* 720 */ |
| 441 | 440 | { |
| r2844 | r2845 | |
| 485 | 484 | } |
| 486 | 485 | } |
| 487 | 486 | |
| 488 | sprintf(port, "LETA%d", (offset & 3)); | |
| 489 | return input_port_read(machine, port); | |
| 487 | return input_port_read(machine, letanames[offset & 3]); | |
| 490 | 488 | } |
| 491 | 489 | |
| 492 | 490 |
| r2844 | r2845 | |
|---|---|---|
| 88 | 88 | switch (offset<<1) |
| 89 | 89 | { |
| 90 | 90 | case 0: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 91 | return (input_port_read | |
| 91 | return (input_port_read | |
| 92 | 92 | |
| 93 | 93 | case 2: /* Dip Switches */ |
| 94 | return (input_port_read | |
| 94 | return (input_port_read | |
| 95 | 95 | |
| 96 | 96 | case 4: /* Protection */ |
| 97 | 97 | logerror("%04x : protection control read at 30c000 %d\n",activecpu_get_pc(),offset); |
| 98 | 98 | return prot; |
| 99 | 99 | |
| 100 | 100 | case 6: /* Credits, VBL in byte 7 */ |
| 101 | return input_port_read | |
| 101 | return input_port_read | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | return ~0; |
| r2844 | r2845 | |
| 201 | 201 | /******************************************************************************/ |
| 202 | 202 | |
| 203 | 203 | static INPUT_PORTS_START( twocrude ) |
| 204 | PORT_START /* Player 1 controls */ | |
| 204 | PORT_START_TAG("P1") /* Player 1 controls */ | |
| 205 | 205 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| 206 | 206 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 207 | 207 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| r2844 | r2845 | |
| 211 | 211 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) |
| 212 | 212 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 213 | 213 | |
| 214 | PORT_START /* Player 2 controls */ | |
| 214 | PORT_START_TAG("P2") /* Player 2 controls */ | |
| 215 | 215 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) |
| 216 | 216 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| 217 | 217 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| r2844 | r2845 | |
| 221 | 221 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 222 | 222 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 223 | 223 | |
| 224 | PORT_START /* Credits */ | |
| 224 | PORT_START_TAG("COINS") /* Credits */ | |
| 225 | 225 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 226 | 226 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 227 | 227 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) |
| r2844 | r2845 | |
| 231 | 231 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 232 | 232 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 233 | 233 | |
| 234 | PORT_START /* Dip switch bank 1 */ | |
| 234 | PORT_START_TAG("DSW1") /* Dip switch bank 1 */ | |
| 235 | 235 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) |
| 236 | 236 | PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) |
| 237 | 237 | PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) |
| r2844 | r2845 | |
| 257 | 257 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 258 | 258 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 259 | 259 | |
| 260 | PORT_START /* Dip switch bank 2 */ | |
| 260 | PORT_START_TAG("DSW2") /* Dip switch bank 2 */ | |
| 261 | 261 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) |
| 262 | 262 | PORT_DIPSETTING( 0x00, "1" ) |
| 263 | 263 | PORT_DIPSETTING( 0x01, "2" ) |
| r2844 | r2845 | |
|---|---|---|
| 344 | 344 | static WRITE8_HANDLER( dunhuang_input_w ) { dunhuang_input = data; } |
| 345 | 345 | static READ8_HANDLER( dunhuang_service_r ) |
| 346 | 346 | { |
| 347 | return input_port_read | |
| 347 | return input_port_read | |
| 348 | 348 | | ((dunhuang_hopper && !(video_screen_get_frame_number(machine->primary_screen)%10)) ? 0x00 : 0x08) // bit 3: hopper sensor |
| 349 | 349 | | 0x80 // bit 7 low -> tiles block transferrer busy |
| 350 | 350 | ; |
| r2844 | r2845 | |
| 352 | 352 | |
| 353 | 353 | static READ8_HANDLER( dunhuang_dsw_r ) |
| 354 | 354 | { |
| 355 | if (!(dunhuang_input & 0x01)) return input_port_read_indexed(machine, 0); | |
| 356 | if (!(dunhuang_input & 0x02)) return input_port_read_indexed(machine, 1); | |
| 357 | if (!(dunhuang_input & 0x04)) return input_port_read_indexed(machine, 2); | |
| 358 | if (!(dunhuang_input & 0x08)) return input_port_read_indexed(machine, 3); | |
| 359 | if (!(dunhuang_input & 0x10)) return input_port_read_indexed(machine, 4); | |
| 355 | if (!(dunhuang_input & 0x01)) return input_port_read(machine, "DSW1"); | |
| 356 | if (!(dunhuang_input & 0x02)) return input_port_read(machine, "DSW2"); | |
| 357 | if (!(dunhuang_input & 0x04)) return input_port_read(machine, "DSW3"); | |
| 358 | if (!(dunhuang_input & 0x08)) return input_port_read(machine, "DSW4"); | |
| 359 | if (!(dunhuang_input & 0x10)) return input_port_read(machine, "DSW5"); | |
| 360 | 360 | logerror("%06x: warning, unknown dsw bits read, dunhuang_input = %02x\n", activecpu_get_pc(), dunhuang_input); |
| 361 | 361 | return 0xff; |
| 362 | 362 | } |
| 363 | 363 | static READ8_HANDLER( dunhuang_input_r ) |
| 364 | 364 | { |
| 365 | if (!(dunhuang_input & 0x01)) return input_port_read_indexed(machine, 6); | |
| 366 | if (!(dunhuang_input & 0x02)) return input_port_read_indexed(machine, 7); | |
| 367 | if (!(dunhuang_input & 0x04)) return input_port_read_indexed(machine, 8); | |
| 368 | if (!(dunhuang_input & 0x08)) return input_port_read_indexed(machine, 9); | |
| 369 | if (!(dunhuang_input & 0x10)) return input_port_read_indexed(machine, 10); | |
| 365 | if (!(dunhuang_input & 0x01)) return input_port_read(machine, "IN0"); | |
| 366 | if (!(dunhuang_input & 0x02)) return input_port_read(machine, "IN1"); | |
| 367 | if (!(dunhuang_input & 0x04)) return input_port_read(machine, "IN2"); | |
| 368 | if (!(dunhuang_input & 0x08)) return input_port_read(machine, "IN3"); | |
| 369 | if (!(dunhuang_input & 0x10)) return input_port_read(machine, "IN4"); | |
| 370 | 370 | logerror("%06x: warning, unknown input bits read, dunhuang_input = %02x\n", activecpu_get_pc(), dunhuang_input); |
| 371 | 371 | return 0xff; |
| 372 | 372 | } |
| r2844 | r2845 | |
| 442 | 442 | ***************************************************************************/ |
| 443 | 443 | |
| 444 | 444 | static INPUT_PORTS_START( dunhuang ) |
| 445 | PORT_START / | |
| 445 | PORT_START_TAG("DSW1") /* IN0 - DSW1 */ | |
| 446 | 446 | PORT_DIPNAME( 0x0f, 0x0f, "Main Game Chance (%)" ) PORT_DIPLOCATION("SW1:1,2,3,4") |
| 447 | 447 | PORT_DIPSETTING( 0x00, "78" ) |
| 448 | 448 | PORT_DIPSETTING( 0x01, "80" ) |
| r2844 | r2845 | |
| 472 | 472 | PORT_DIPSETTING( 0x80, "Keys" ) |
| 473 | 473 | PORT_DIPSETTING( 0x00, "Payout" ) |
| 474 | 474 | |
| 475 | PORT_START / | |
| 475 | PORT_START_TAG("DSW2") /* IN1 - DSW2 */ | |
| 476 | 476 | PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW2:1" ) |
| 477 | 477 | PORT_DIPNAME( 0x06, 0x06, "Credits Per Coin" ) PORT_DIPLOCATION("SW2:2,3") |
| 478 | 478 | PORT_DIPSETTING( 0x06, "1" ) |
| r2844 | r2845 | |
| 493 | 493 | PORT_DIPSETTING( 0x80, "1000" ) |
| 494 | 494 | PORT_DIPSETTING( 0xc0, "3000" ) |
| 495 | 495 | |
| 496 | PORT_START / | |
| 496 | PORT_START_TAG("DSW3") /* IN2 - DSW3 */ | |
| 497 | 497 | PORT_DIPNAME( 0x03, 0x03, "Min Bet" ) PORT_DIPLOCATION("SW3:1,2") |
| 498 | 498 | PORT_DIPSETTING( 0x03, "1" ) |
| 499 | 499 | PORT_DIPSETTING( 0x02, "2" ) |
| r2844 | r2845 | |
| 515 | 515 | PORT_DIPSETTING( 0x80, "5" ) |
| 516 | 516 | PORT_DIPSETTING( 0xc0, "6" ) |
| 517 | 517 | |
| 518 | PORT_START / | |
| 518 | PORT_START_TAG("DSW4") /* IN3 - DSW4 */ | |
| 519 | 519 | PORT_DIPNAME( 0x07, 0x07, "Credits Limit" ) PORT_DIPLOCATION("SW4:1,2,3") |
| 520 | 520 | PORT_DIPSETTING( 0x07, "2k" ) |
| 521 | 521 | PORT_DIPSETTING( 0x06, "3k" ) |
| r2844 | r2845 | |
| 541 | 541 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 542 | 542 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 543 | 543 | |
| 544 | PORT_START / | |
| 544 | PORT_START_TAG("DSW5") /* IN4 - DSW5 */ | |
| 545 | 545 | PORT_DIPNAME( 0x03, 0x03, "Douple Up Chance (%)" ) PORT_DIPLOCATION("SW5:1,2") |
| 546 | 546 | PORT_DIPSETTING( 0x00, "50" ) |
| 547 | 547 | PORT_DIPSETTING( 0x01, "60" ) |
| r2844 | r2845 | |
| 565 | 565 | PORT_DIPSETTING( 0x80, "Strong" ) |
| 566 | 566 | PORT_DIPSETTING( 0x00, "Weak" ) |
| 567 | 567 | |
| 568 | PORT_START / | |
| 568 | PORT_START_TAG("SERVICE") /* IN5 - SERVICE */ | |
| 569 | 569 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3 ) // clear (during boot) |
| 570 | 570 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE2 ) // book |
| 571 | 571 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) // test (in game: dips, during boot: service mode) |
| r2844 | r2845 | |
| 575 | 575 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 576 | 576 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) // 0 = tiles block transferrer busy |
| 577 | 577 | |
| 578 | PORT_START / | |
| 578 | PORT_START_TAG("IN0") /* IN6 - P1 */ | |
| 579 | 579 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) |
| 580 | 580 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) |
| 581 | 581 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) |
| r2844 | r2845 | |
| 585 | 585 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 586 | 586 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 587 | 587 | |
| 588 | PORT_START / | |
| 588 | PORT_START_TAG("IN1") /* IN7 - P1 */ | |
| 589 | 589 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) |
| 590 | 590 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) |
| 591 | 591 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J ) |
| r2844 | r2845 | |
| 595 | 595 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 596 | 596 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 597 | 597 | |
| 598 | PORT_START / | |
| 598 | PORT_START_TAG("IN2") /* IN8 - P1 */ | |
| 599 | 599 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) |
| 600 | 600 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) |
| 601 | 601 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) |
| r2844 | r2845 | |
| 605 | 605 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 606 | 606 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 607 | 607 | |
| 608 | PORT_START / | |
| 608 | PORT_START_TAG("IN3") /* IN9 - P1 */ | |
| 609 | 609 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) |
| 610 | 610 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) |
| 611 | 611 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L ) |
| r2844 | r2845 | |
| 615 | 615 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 616 | 616 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 617 | 617 | |
| 618 | PORT_START / | |
| 618 | PORT_START_TAG("IN4") /* IN10 - P1 */ | |
| 619 | 619 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) |
| 620 | 620 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) |
| 621 | 621 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) |
| r2844 | r2845 | |
|---|---|---|
| 279 | 279 | /* the lower 4 (or 3?) bits select the port to read */ |
| 280 | 280 | switch (offset & 0x0f) /* might be 0x07 */ |
| 281 | 281 | { |
| 282 | case 0x00: ret = input_port_read_indexed(machine, 0); break; | |
| 283 | case 0x02: ret = input_port_read_indexed(machine, 1); break; | |
| 284 | case 0x03: ret = input_port_read_indexed(machine, 2); break; | |
| 285 | case 0x04: ret = input_port_read_indexed(machine, 3); break; | |
| 286 | case 0x06: ret = input_port_read_indexed(machine, 4); break; | |
| 287 | case 0x07: ret = input_port_read_indexed(machine, 5); break; | |
| 282 | case 0x00: ret = input_port_read(machine, "IN0"); break; | |
| 283 | case 0x02: ret = input_port_read(machine, "IN1"); break; | |
| 284 | case 0x03: ret = input_port_read(machine, "IN2"); break; | |
| 285 | case 0x04: ret = input_port_read(machine, "IN3"); break; | |
| 286 | case 0x06: ret = input_port_read(machine, "DSW3"); break; | |
| 287 | case 0x07: ret = input_port_read(machine, "DSW2"); break; | |
| 288 | 288 | default: logerror("%04x : CVS: Reading unmapped input port 0x%02x\n", activecpu_get_pc(), offset & 0x0f); break; |
| 289 | 289 | } |
| 290 | 290 | |
| r2844 | r2845 | |
| 539 | 539 | AM_RANGE(0x00, 0xff) AM_READWRITE(cvs_input_r, cvs_scroll_w) |
| 540 | 540 | AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE(cvs_collision_clear, cvs_video_fx_w) |
| 541 | 541 | AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_READWRITE(cvs_collision_r, audio_command_w) |
| 542 | AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ | |
| 542 | AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ | |
| 543 | 543 | ADDRESS_MAP_END |
| 544 | 544 | |
| 545 | 545 | |
| r2844 | r2845 | |
| 657 | 657 | PORT_DIPSETTING( 0x10, "5" ) |
| 658 | 658 | PORT_DIPUNUSED( 0x20, IP_ACTIVE_HIGH ) /* can't tell if it's ACTIVE_HIGH or ACTIVE_LOW */ |
| 659 | 659 | |
| 660 | PORT_START /* SENSE */ | |
| 660 | PORT_START_TAG("SENSE") /* SENSE */ | |
| 661 | 661 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 662 | 662 | INPUT_PORTS_END |
| 663 | 663 |
| r2844 | r2845 | |
|---|---|---|
| 1768 | 1768 | if (old_tiles_offset != seta_tiles_offset) tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); |
| 1769 | 1769 | old_tiles_offset = seta_tiles_offset; |
| 1770 | 1770 | |
| 1771 | seta_coin_lockout_w(data); | |
| 1771 | seta_coin_lockout_w(machine, data); | |
| 1772 | 1772 | } |
| 1773 | 1773 | } |
| 1774 | 1774 | |
| r2844 | r2845 | |
| 2817 | 2817 | static WRITE8_HANDLER( sub_bankswitch_lockout_w ) |
| 2818 | 2818 | { |
| 2819 | 2819 | sub_bankswitch_w(machine,offset,data); |
| 2820 | seta_coin_lockout_w(data); | |
| 2820 | seta_coin_lockout_w(machine, data); | |
| 2821 | 2821 | } |
| 2822 | 2822 | |
| 2823 | 2823 |
| r2844 | r2845 | |
|---|---|---|
| 544 | 544 | ADDRESS_MAP_END |
| 545 | 545 | |
| 546 | 546 | |
| 547 | WRITE8_HANDLER( jpopnics_palette_w ) | |
| 547 | static WRITE8_HANDLER( jpopnics_palette_w ) | |
| 548 | 548 | { |
| 549 | 549 | int r,g,b; |
| 550 | 550 | UINT16 paldata; |
| r2844 | r2845 | |
| 575 | 575 | AM_RANGE(0xf800, 0xffff) AM_RAM AM_WRITE(jpopnics_palette_w) AM_BASE(&paletteram) |
| 576 | 576 | ADDRESS_MAP_END |
| 577 | 577 | |
| 578 | #ifdef UNUSED_FUNCTION | |
| 578 | 579 | READ8_HANDLER( moo_r ) |
| 579 | 580 | { |
| 580 | 581 | return mame_rand(machine); |
| r2844 | r2845 | |
| 584 | 585 | { |
| 585 | 586 | return 0xff; |
| 586 | 587 | } |
| 588 | #endif | |
| 587 | 589 | |
| 588 | WRITE8_HANDLER( jpopnics_subbankswitch_w ) | |
| 590 | static WRITE8_HANDLER( jpopnics_subbankswitch_w ) | |
| 589 | 591 | { |
| 590 | 592 | UINT8 *RAM = memory_region(REGION_CPU2); |
| 591 | 593 |
| r2844 | r2845 | |
|---|---|---|
| 106 | 106 | |
| 107 | 107 | VIDEO_START( vb ); |
| 108 | 108 | VIDEO_UPDATE( vb ); |
| 109 | extern void vb_bgprombank_w(int bank); | |
| 110 | extern void vb_spprombank_w(int bank); | |
| 109 | extern void vb_bgprombank_w(running_machine *machine, int bank); | |
| 110 | extern void vb_spprombank_w(running_machine *machine, int bank); | |
| 111 | 111 | extern WRITE8_HANDLER( vb_attrib_w ); |
| 112 | 112 | extern WRITE8_HANDLER( vb_videoram_w ); |
| 113 | 113 | extern void vb_mark_all_dirty(void); |
| r2844 | r2845 | |
| 161 | 161 | { |
| 162 | 162 | flip_screen_set(~data&1); |
| 163 | 163 | vb_scrollx_hi = (data & 0x02) << 7; |
| 164 | vb_bgprombank_w((data >> 2)&0x07); | |
| 165 | vb_spprombank_w((data >> 5)&0x07); | |
| 164 | vb_bgprombank_w(machine, (data >> 2)&0x07); | |
| 165 | vb_spprombank_w(machine, (data >> 5)&0x07); | |
| 166 | 166 | //logerror("%04x: vb_scrollx_hi = %d\n",activecpu_get_previouspc(), vb_scrollx_hi); |
| 167 | 167 | } |
| 168 | 168 |
| r2844 | r2845 | |
|---|---|---|
| 97 | 97 | |
| 98 | 98 | static READ16_HANDLER( special_port2_r ) |
| 99 | 99 | { |
| 100 | int result = input_port_read | |
| 100 | int result = input_port_read | |
| 101 | 101 | if (atarigen_sound_to_cpu_ready) result ^= 0x0010; |
| 102 | 102 | if (atarigen_cpu_to_sound_ready) result ^= 0x0020; |
| 103 | 103 | return result; |
| r2844 | r2845 | |
| 170 | 170 | *************************************/ |
| 171 | 171 | |
| 172 | 172 | static INPUT_PORTS_START( batman ) |
| 173 | PORT_START /* 26000 */ | |
| 173 | PORT_START_TAG("260000") /* 260000 */ | |
| 174 | 174 | PORT_BIT( 0x01ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 175 | 175 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 176 | 176 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| r2844 | r2845 | |
| 180 | 180 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 181 | 181 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 182 | 182 | |
| 183 | PORT_START /* 26002 */ | |
| 183 | PORT_START_TAG("260002") /* 260002 */ | |
| 184 | 184 | PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 185 | 185 | |
| 186 | PORT_START /* 26010 */ | |
| 186 | PORT_START_TAG("260010") /* 260010 */ | |
| 187 | 187 | PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 188 | 188 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED ) /* Input buffer full (@260030) */ |
| 189 | 189 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED ) /* Output buffer full (@260040) */ |
| r2844 | r2845 | |
|---|---|---|
| 516 | 516 | static const struct sh4_config sh4cpu_config = { 1, 0, 1, 0, 0, 0, 1, 1, 0, CPU_CLOCK }; |
| 517 | 517 | |
| 518 | 518 | static UINT32 *dc_sound_ram; |
| 519 | extern UINT64 *dc_texture_ram; | |
| 520 | 519 | static UINT32 rom_offset, dma_count; |
| 521 | 520 | UINT32 dma_offset; |
| 522 | 521 | |
| 523 | 522 | static INTERRUPT_GEN( naomi_vblank ) |
| 524 | 523 | { |
| 525 | dc_vblank(); | |
| 524 | dc_vblank(machine); | |
| 526 | 525 | } |
| 527 | 526 | |
| 528 | 527 | static READ64_HANDLER( naomi_arm_r ) |
| r2844 | r2845 | |
|---|---|---|
| 42 | 42 | #include "driver.h" |
| 43 | 43 | #include "cpu/m6502/m6502.h" |
| 44 | 44 | #include "sound/ay8910.h" |
| 45 | #include "includes/btime.h" | |
| 45 | 46 | |
| 46 | extern UINT8 *deco_charram; | |
| 47 | ||
| 48 | PALETTE_INIT( btime ); | |
| 49 | VIDEO_START( btime ); | |
| 50 | VIDEO_UPDATE( progolf ); | |
| 51 | ||
| 52 | READ8_HANDLER( btime_mirrorvideoram_r ); | |
| 53 | WRITE8_HANDLER( btime_mirrorvideoram_w ); | |
| 54 | ||
| 55 | WRITE8_HANDLER( deco_charram_w ); | |
| 56 | ||
| 57 | ||
| 58 | 47 | static ADDRESS_MAP_START( main_cpu, ADDRESS_SPACE_PROGRAM, 8 ) |
| 59 | 48 | AM_RANGE(0x0000, 0x0fff) AM_RAM |
| 60 | 49 | AM_RANGE(0x1000, 0x1fff) AM_RAM //AM_WRITE(deco_charram_w) AM_BASE(&deco_charram) |
| r2844 | r2845 | |
|---|---|---|
| 310 | 310 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CODE(KEYCODE_RIGHT) PORT_CODE(JOYCODE_X_RIGHT_SWITCH)/* right */ |
| 311 | 311 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CODE(KEYCODE_LEFT) PORT_CODE(JOYCODE_X_LEFT_SWITCH) /* left */ |
| 312 | 312 | |
| 313 | PORT_START_TAG("DSW") | |
| 313 | PORT_START_TAG("DSW1") | |
| 314 | 314 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW:1,2") |
| 315 | 315 | PORT_DIPSETTING ( 0x00, DEF_STR( English ) ) |
| 316 | 316 | PORT_DIPSETTING ( 0x01, DEF_STR( German ) ) |
| r2844 | r2845 | |
| 356 | 356 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 357 | 357 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */ |
| 358 | 358 | |
| 359 | PORT_MODIFY("DSW") | |
| 359 | PORT_MODIFY("DSW1") | |
| 360 | 360 | PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW:4" ) |
| 361 | 361 | PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW:5" ) |
| 362 | 362 | PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW:6" ) |
| r2844 | r2845 | |
| 379 | 379 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT ) |
| 380 | 380 | PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) |
| 381 | 381 | |
| 382 | PORT_MODIFY("DSW") | |
| 382 | PORT_MODIFY("DSW1") | |
| 383 | 383 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Language ) ) PORT_DIPLOCATION("SW:1,2") |
| 384 | 384 | PORT_DIPSETTING( 0x00, DEF_STR( English ) ) |
| 385 | 385 | PORT_DIPSETTING( 0x01, DEF_STR( French ) ) |
| r2844 | r2845 | |
| 512 | 512 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CODE(KEYCODE_RIGHT) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) /* right */ |
| 513 | 513 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CODE(KEYCODE_LEFT) PORT_CODE(JOYCODE_X_LEFT_SWITCH) /* left */ |
| 514 | 514 | |
| 515 | PORT_START_TAG("DSW") | |
| 515 | PORT_START_TAG("DSW1") | |
| 516 | 516 | PORT_DIPNAME( 0x03, 0x00, "Right Coin" ) PORT_DIPLOCATION("P8:1,2") /* "Left Coin Mech always registers X 1" */ |
| 517 | 517 | PORT_DIPSETTING ( 0x00, "X 1" ) |
| 518 | 518 | PORT_DIPSETTING ( 0x01, "X 4" ) |
| r2844 | r2845 | |
| 548 | 548 | static INPUT_PORTS_START( llander1 ) |
| 549 | 549 | PORT_INCLUDE( llander ) |
| 550 | 550 | |
| 551 | PORT_MODIFY("DSW") | |
| 551 | PORT_MODIFY("DSW1") | |
| 552 | 552 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("P8:5") /* "Left Coin Mech always registers X 1" */ |
| 553 | 553 | PORT_DIPSETTING ( 0x00, DEF_STR( Normal ) ) |
| 554 | 554 | PORT_DIPSETTING ( 0x10, DEF_STR( Free_Play ) ) |
| r2844 | r2845 | |
|---|---|---|
| 173 | 173 | #include "machine/scudsp.h" |
| 174 | 174 | #include "sound/scsp.h" |
| 175 | 175 | #include "machine/stvprot.h" |
| 176 | #include "includes/stv.h" | |
| 176 | 177 | |
| 177 | extern UINT32* stv_vdp2_regs; | |
| 178 | extern UINT32* stv_vdp2_vram; | |
| 179 | extern UINT32* stv_vdp2_cram; | |
| 180 | extern UINT32* stv_vdp1_vram; | |
| 181 | ||
| 182 | 178 | #define USE_SLAVE 1 |
| 183 | 179 | /*Enable the following to play 'myfairld' without using the -nosound switch.*/ |
| 184 | 180 | #define UGLY_SOUND_HACK 0 |
| r2844 | r2845 | |
| 200 | 196 | #define MASTER_CLOCK_352 57272800 |
| 201 | 197 | #define MASTER_CLOCK_320 53748200 |
| 202 | 198 | |
| 203 | /* stvinit.c */ | |
| 204 | DRIVER_INIT( ic13 ); | |
| 205 | NVRAM_HANDLER( stv ); | |
| 206 | void install_stvbios_speedups(running_machine *machine); | |
| 207 | DRIVER_INIT(bakubaku); | |
| 208 | DRIVER_INIT(mausuke); | |
| 209 | DRIVER_INIT(puyosun); | |
| 210 | DRIVER_INIT(shienryu); | |
| 211 | DRIVER_INIT(prikura); | |
| 212 | DRIVER_INIT(hanagumi); | |
| 213 | DRIVER_INIT(cottonbm); | |
| 214 | DRIVER_INIT(cotton2); | |
| 215 | DRIVER_INIT(fhboxers); | |
| 216 | DRIVER_INIT(dnmtdeka); | |
| 217 | DRIVER_INIT(groovef); | |
| 218 | DRIVER_INIT(danchih); | |
| 219 | DRIVER_INIT(astrass); | |
| 220 | DRIVER_INIT(thunt); | |
| 221 | DRIVER_INIT(grdforce); | |
| 222 | DRIVER_INIT(batmanfr); | |
| 223 | DRIVER_INIT(winterht); | |
| 224 | DRIVER_INIT(seabass); | |
| 225 | DRIVER_INIT(vfremix); | |
| 226 | DRIVER_INIT(diehard); | |
| 227 | DRIVER_INIT(sss); | |
| 228 | DRIVER_INIT(othellos); | |
| 229 | DRIVER_INIT(sasissu); | |
| 230 | DRIVER_INIT(gaxeduel); | |
| 231 | DRIVER_INIT(suikoenb); | |
| 232 | DRIVER_INIT(sokyugrt); | |
| 233 | DRIVER_INIT(znpwfv); | |
| 234 | DRIVER_INIT(twcup98); | |
| 235 | DRIVER_INIT(smleague); | |
| 236 | DRIVER_INIT(maruchan); | |
| 237 | DRIVER_INIT(sandor); | |
| 238 | DRIVER_INIT(colmns97); | |
| 239 | DRIVER_INIT(pblbeach); | |
| 240 | DRIVER_INIT(shanhigw); | |
| 241 | DRIVER_INIT(finlarch); | |
| 242 | DRIVER_INIT(elandore); | |
| 243 | DRIVER_INIT(rsgun); | |
| 244 | DRIVER_INIT(ffreveng); | |
| 245 | DRIVER_INIT(decathlt); | |
| 246 | DRIVER_INIT(nameclv3); | |
| 247 | ||
| 248 | 199 | /**************************************************************************************/ |
| 249 | 200 | /*to be added into a stv Header file,remember to remove all the static...*/ |
| 250 | 201 | |
| r2844 | r2845 | |
| 254 | 205 | UINT32* stv_workram_l; |
| 255 | 206 | UINT32* stv_workram_h; |
| 256 | 207 | static UINT32* stv_backupram; |
| 257 | extern UINT32* stv_scu; | |
| 258 | 208 | static UINT32* ioga; |
| 259 | 209 | static UINT16* scsp_regs; |
| 260 | 210 | static UINT16* sound_ram; |
| r2844 | r2845 | |
| 2061 | 2011 | } |
| 2062 | 2012 | |
| 2063 | 2013 | |
| 2064 | extern WRITE32_HANDLER ( stv_vdp2_vram_w ); | |
| 2065 | extern READ32_HANDLER ( stv_vdp2_vram_r ); | |
| 2066 | ||
| 2067 | extern WRITE32_HANDLER ( stv_vdp2_cram_w ); | |
| 2068 | extern READ32_HANDLER ( stv_vdp2_cram_r ); | |
| 2069 | ||
| 2070 | extern WRITE32_HANDLER ( stv_vdp2_regs_w ); | |
| 2071 | extern READ32_HANDLER ( stv_vdp2_regs_r ); | |
| 2072 | ||
| 2073 | extern VIDEO_START ( stv_vdp2 ); | |
| 2074 | extern VIDEO_UPDATE( stv_vdp2 ); | |
| 2075 | ||
| 2076 | extern READ32_HANDLER( stv_vdp1_regs_r ); | |
| 2077 | extern WRITE32_HANDLER( stv_vdp1_regs_w ); | |
| 2078 | extern READ32_HANDLER ( stv_vdp1_vram_r ); | |
| 2079 | extern WRITE32_HANDLER ( stv_vdp1_vram_w ); | |
| 2080 | ||
| 2081 | extern WRITE32_HANDLER ( stv_vdp1_framebuffer0_w ); | |
| 2082 | extern READ32_HANDLER ( stv_vdp1_framebuffer0_r ); | |
| 2083 | ||
| 2084 | extern WRITE32_HANDLER ( stv_vdp1_framebuffer1_w ); | |
| 2085 | extern READ32_HANDLER ( stv_vdp1_framebuffer1_r ); | |
| 2086 | ||
| 2087 | 2014 | #ifdef UNUSED_FUNCTION |
| 2088 | 2015 | static READ32_HANDLER( stv_sh2_random_r ) |
| 2089 | 2016 | { |
| r2844 | r2845 | |
|---|---|---|
| 91 | 91 | |
| 92 | 92 | #define MASTER_CLOCK 53693100 |
| 93 | 93 | |
| 94 | /* give us access to the megadriv start and update functions so that we can call them */ | |
| 95 | VIDEO_UPDATE( megadriv ); | |
| 96 | VIDEO_START( megadriv ); | |
| 97 | VIDEO_EOF( megadriv ); | |
| 98 | MACHINE_RESET( megadriv ); | |
| 99 | ||
| 100 | /* in drivers/segae.c */ | |
| 101 | VIDEO_UPDATE( megatech_bios ); | |
| 102 | VIDEO_EOF( megatech_bios ); | |
| 103 | MACHINE_RESET( megatech_bios ); | |
| 104 | DRIVER_INIT( megatech_bios ); | |
| 105 | ||
| 106 | ||
| 107 | 94 | /* not currently used */ |
| 108 | 95 | static INPUT_PORTS_START( megatech ) /* Genesis Input Ports */ |
| 109 | 96 | PORT_INCLUDE(megadriv) |
| r2844 | r2845 | |
|---|---|---|
| 159 | 159 | static READ8_HANDLER( trackball_r ) |
| 160 | 160 | { |
| 161 | 161 | UINT8 ret; |
| 162 | UINT8 port4 = input_port_read_indexed(machine, 4); | |
| 163 | UINT8 port5 = input_port_read_indexed(machine, 5); | |
| 162 | UINT8 port4 = input_port_read(machine, "FAKEX"); | |
| 163 | UINT8 port5 = input_port_read(machine, "FAKEY"); | |
| 164 | 164 | |
| 165 | 165 | ret = (((port4 - last_trackball_val[0]) & 0x0f)<<4) | ((port5 - last_trackball_val[1]) & 0x0f); |
| 166 | 166 | |
| r2844 | r2845 | |
| 201 | 201 | AM_RANGE(0xe800, 0xe800) AM_WRITE(SMH_RAM) AM_BASE(&tnzs_bg_flag) /* enable / disable background transparency */ |
| 202 | 202 | |
| 203 | 203 | AM_RANGE(0xf000, 0xf000) AM_READ(trackball_r) |
| 204 | AM_RANGE(0xf002, 0xf002) AM_READ(input_port_0_r) | |
| 205 | AM_RANGE(0xf004, 0xf004) AM_READ(input_port_1_r) | |
| 206 | AM_RANGE(0xf006, 0xf006) AM_READ(input_port_2_r) | |
| 207 | AM_RANGE(0xf007, 0xf007) AM_READ(input_port_3_r) | |
| 204 | AM_RANGE(0xf002, 0xf002) AM_READ_PORT("IN0") | |
| 205 | AM_RANGE(0xf004, 0xf004) AM_READ_PORT("IN1") | |
| 206 | AM_RANGE(0xf006, 0xf006) AM_READ_PORT("IN2") | |
| 207 | AM_RANGE(0xf007, 0xf007) AM_READ_PORT("IN3") | |
| 208 | 208 | |
| 209 | 209 | AM_RANGE(0xf000, 0xf000) AM_WRITE(champbwl_misc_w) |
| 210 | 210 | AM_RANGE(0xf002, 0xf002) AM_WRITENOP //buttons light? |
| r2844 | r2845 | |
| 214 | 214 | ADDRESS_MAP_END |
| 215 | 215 | |
| 216 | 216 | static INPUT_PORTS_START( champbwl ) |
| 217 | PORT_START | |
| 217 | PORT_START_TAG("IN0") | |
| 218 | 218 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 219 | 219 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 220 | 220 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) |
| r2844 | r2845 | |
| 224 | 224 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) // INT( 4M) |
| 225 | 225 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) // INT(16M) |
| 226 | 226 | |
| 227 | PORT_START | |
| 227 | PORT_START_TAG("IN1") | |
| 228 | 228 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 229 | 229 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 230 | 230 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 250 | 250 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 251 | 251 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 252 | 252 | |
| 253 | PORT_START | |
| 253 | PORT_START_TAG("IN2") | |
| 254 | 254 | PORT_SERVICE_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:1" ) |
| 255 | 255 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:2") |
| 256 | 256 | PORT_DIPSETTING( 0x02, DEF_STR( Upright ) ) |
| r2844 | r2845 | |
| 274 | 274 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 275 | 275 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 276 | 276 | |
| 277 | PORT_START | |
| 277 | PORT_START_TAG("IN3") | |
| 278 | 278 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:5") |
| 279 | 279 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 280 | 280 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 299 | 299 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 300 | 300 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 301 | 301 | |
| 302 | PORT_START /* FAKE */ | |
| 302 | PORT_START_TAG("FAKEX") /* FAKE */ | |
| 303 | 303 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X )PORT_SENSITIVITY(50) PORT_KEYDELTA(50) PORT_CENTERDELTA(0) |
| 304 | 304 | |
| 305 | PORT_START /* FAKE */ | |
| 305 | PORT_START_TAG("FAKEY") /* FAKE */ | |
| 306 | 306 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(45) PORT_CENTERDELTA(0) PORT_REVERSE |
| 307 | 307 | INPUT_PORTS_END |
| 308 | 308 |
| r2844 | r2845 | |
|---|---|---|
| 159 | 159 | |
| 160 | 160 | static READ16_HANDLER( dipsw_r ) // dips |
| 161 | 161 | { |
| 162 | return input_port_read | |
| 162 | return input_port_read | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | static READ16_HANDLER( player1_r ) // players 1 and 3 |
| 166 | 166 | { |
| 167 | return 0xff | (input_port_read | |
| 167 | return 0xff | (input_port_read | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | static READ16_HANDLER( player2_r ) // players 2 and 4 |
| 171 | 171 | { |
| 172 | return input_port_read | |
| 172 | return input_port_read | |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | static READ16_HANDLER( bishi_K056832_rom_r ) |
| r2844 | r2845 | |
|---|---|---|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | static INPUT_PORTS_START( bnstars ) |
| 536 | PORT_START | |
| 536 | PORT_START_TAG("IN0") | |
| 537 | 537 | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_START1 ) |
| 538 | 538 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_A ) |
| 539 | 539 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_E ) |
| r2844 | r2845 | |
| 615 | 615 | PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) |
| 616 | 616 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 617 | 617 | |
| 618 | PORT_START | |
| 618 | PORT_START_TAG("IN1") | |
| 619 | 619 | PORT_DIPNAME( 0x00000001, 0x00000001, "MAH2" ) |
| 620 | 620 | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 621 | 621 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 703 | 703 | PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) |
| 704 | 704 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 705 | 705 | |
| 706 | PORT_START | |
| 706 | PORT_START_TAG("IN2") | |
| 707 | 707 | PORT_DIPNAME( 0x00000001, 0x00000001, "MAH4" ) |
| 708 | 708 | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 709 | 709 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 791 | 791 | PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) |
| 792 | 792 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 793 | 793 | |
| 794 | PORT_START | |
| 794 | PORT_START_TAG("IN3") | |
| 795 | 795 | PORT_DIPNAME( 0x00000001, 0x00000001, "MAH6" ) |
| 796 | 796 | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 797 | 797 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 881 | 881 | PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) |
| 882 | 882 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 883 | 883 | |
| 884 | PORT_START | |
| 884 | PORT_START_TAG("IN4") | |
| 885 | 885 | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_START2 ) |
| 886 | 886 | /* The follow 4 bits active 4 button each one for the second player */ |
| 887 | 887 | PORT_DIPNAME( 0x00000002, 0x00000002, "P2: A,B,C,D" ) |
| r2844 | r2845 | |
| 974 | 974 | PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) |
| 975 | 975 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 976 | 976 | |
| 977 | PORT_START | |
| 977 | PORT_START_TAG("IN5") | |
| 978 | 978 | PORT_DIPNAME( 0x00000001, 0x00000001, "Test Mode" ) PORT_DIPLOCATION("SW1:8") |
| 979 | 979 | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 980 | 980 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 1073 | 1073 | PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) |
| 1074 | 1074 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1075 | 1075 | |
| 1076 | PORT_START | |
| 1076 | PORT_START_TAG("IN6") | |
| 1077 | 1077 | PORT_DIPNAME( 0x00000001, 0x00000001, "4" ) |
| 1078 | 1078 | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 1079 | 1079 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 1201 | 1201 | return 0xffffffff; |
| 1202 | 1202 | |
| 1203 | 1203 | case 0x0000: |
| 1204 | return input_port_read | |
| 1204 | return input_port_read | |
| 1205 | 1205 | |
| 1206 | 1206 | case 0x0080: |
| 1207 | return input_port_read | |
| 1207 | return input_port_read | |
| 1208 | 1208 | |
| 1209 | 1209 | case 0x2000: |
| 1210 | return input_port_read | |
| 1210 | return input_port_read | |
| 1211 | 1211 | |
| 1212 | 1212 | case 0x2080: |
| 1213 | return input_port_read | |
| 1213 | return input_port_read | |
| 1214 | 1214 | |
| 1215 | 1215 | } |
| 1216 | 1216 | } |
| 1217 | 1217 | |
| 1218 | 1218 | static READ32_HANDLER( bnstars2_r ) |
| 1219 | 1219 | { |
| 1220 | return input_port_read | |
| 1220 | return input_port_read | |
| 1221 | 1221 | } |
| 1222 | 1222 | |
| 1223 | 1223 | static READ32_HANDLER( bnstars3_r ) |
| 1224 | 1224 | { |
| 1225 | return input_port_read | |
| 1225 | return input_port_read | |
| 1226 | 1226 | } |
| 1227 | 1227 | |
| 1228 | 1228 | static WRITE32_HANDLER( bnstars1_mahjong_select_w ) |
| r2844 | r2845 | |
|---|---|---|
| 44 | 44 | #include "driver.h" |
| 45 | 45 | #include "sound/okim6295.h" |
| 46 | 46 | |
| 47 | VIDEO_START( blackt96 ) | |
| 47 | static VIDEO_START( blackt96 ) | |
| 48 | 48 | { |
| 49 | 49 | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | VIDEO_UPDATE( blackt96 ) | |
| 53 | { | |
| 54 | return 0; | |
| 55 | } | |
| 52 | static UINT16* blackt96_tilemapram; | |
| 53 | static UINT16* blackt96_tilemapram2; | |
| 56 | 54 | |
| 57 | static | |
| 55 | static VI | |
| 58 | 56 | { |
| 59 | return 0x0000; | |
| 60 | } | |
| 57 | int y,x; | |
| 58 | int count = 0; | |
| 59 | int base; | |
| 60 | const gfx_element *gfx = screen->machine->gfx[2]; | |
| 61 | const gfx_element *gfxbg = screen->machine->gfx[0]; | |
| 62 | const gfx_element *gfxspr = screen->machine->gfx[1]; | |
| 61 | 63 | |
| 62 | static READ16_HANDLER( blackt96_c0000_r ) | |
| 63 | { | |
| 64 | return 0x0000; | |
| 65 | } | |
| 64 | count = 0; | |
| 65 | for (x=0;x<64;x++) | |
| 66 | { | |
| 67 | for (y=0;y<32;y++) | |
| 68 | { | |
| 69 | UINT16 tile = (blackt96_tilemapram2[count*2 + (0x2000/2)+1]); | |
| 70 | drawgfx(bitmap,gfxbg,tile,6,0,0,x*16,y*16,cliprect,TRANSPARENCY_NONE,0); | |
| 71 | count++; | |
| 72 | } | |
| 73 | } | |
| 66 | 74 | |
| 67 | static READ16_HANDLER( blackt96_e0000_r ) | |
| 68 | { | |
| 69 | return 0x0000; | |
| 70 | } | |
| 75 | /* the sprite are arranged in tilemaps.. I don't know how this works yet */ | |
| 76 | count = 0; | |
| 77 | base = 0x1000; | |
| 78 | for (x=0;x<32;x++) | |
| 79 | { | |
| 80 | for (y=0;y<32;y++) | |
| 81 | { | |
| 82 | UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff); | |
| 83 | UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000); | |
| 84 | UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10; | |
| 71 | 85 | |
| 72 | static READ16_HANDLER( blackt96_e8000_r ) | |
| 73 | { | |
| 74 | return 0x0000; | |
| 75 | } | |
| 86 | drawgfx(bitmap,gfxspr,tile,colour,flipx,0,x*16,y*16,cliprect,TRANSPARENCY_PEN,0); | |
| 87 | count++; | |
| 88 | } | |
| 89 | } | |
| 90 | count = 0; | |
| 91 | base = 0x1800; | |
| 92 | for (x=0;x<32;x++) | |
| 93 | { | |
| 94 | for (y=0;y<32;y++) | |
| 95 | { | |
| 96 | UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff); | |
| 97 | UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000); | |
| 98 | UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10; | |
| 76 | 99 | |
| 77 | static READ16_HANDLER( blackt96_f0000_r ) | |
| 78 | { | |
| 79 | return 0x0000; | |
| 80 | } | |
| 100 | drawgfx(bitmap,gfxspr,tile,colour,flipx,0,x*16,y*16,cliprect,TRANSPARENCY_PEN,0); | |
| 101 | count++; | |
| 102 | } | |
| 103 | } | |
| 104 | count = 0; | |
| 105 | base = 0x3000; | |
| 106 | for (x=0;x<32;x++) | |
| 107 | { | |
| 108 | for (y=0;y<32;y++) | |
| 109 | { | |
| 110 | UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff); | |
| 111 | UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000); | |
| 112 | UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10; | |
| 81 | 113 | |
| 82 | static READ16_HANDLER( blackt96_f0008_r ) | |
| 83 | { | |
| 84 | return 0x0000; | |
| 114 | drawgfx(bitmap,gfxspr,tile,colour,flipx,0,x*16,y*16,cliprect,TRANSPARENCY_PEN,0); | |
| 115 | count++; | |
| 116 | } | |
| 117 | } | |
| 118 | count = 0; | |
| 119 | base = 0x3800; | |
| 120 | for (x=0;x<32;x++) | |
| 121 | { | |
| 122 | for (y=0;y<32;y++) | |
| 123 | { | |
| 124 | UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff); | |
| 125 | UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000); | |
| 126 | UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10; | |
| 127 | ||
| 128 | drawgfx(bitmap,gfxspr,tile,colour,flipx,0,x*16,y*16,cliprect,TRANSPARENCY_PEN,0); | |
| 129 | count++; | |
| 130 | } | |
| 131 | } | |
| 132 | base = 0x4000; | |
| 133 | for (x=0;x<32;x++) | |
| 134 | { | |
| 135 | for (y=0;y<32;y++) | |
| 136 | { | |
| 137 | UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff); | |
| 138 | UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000); | |
| 139 | UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10; | |
| 140 | ||
| 141 | drawgfx(bitmap,gfxspr,tile,colour,flipx,0,x*16,y*16,cliprect,TRANSPARENCY_PEN,0); | |
| 142 | count++; | |
| 143 | } | |
| 144 | } | |
| 145 | base = 0x4800; | |
| 146 | for (x=0;x<32;x++) | |
| 147 | { | |
| 148 | for (y=0;y<32;y++) | |
| 149 | { | |
| 150 | UINT16 tile = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x1fff); | |
| 151 | UINT16 flipx = (blackt96_tilemapram2[count*2 + (base/2)+1]&0x4000); | |
| 152 | UINT16 colour = (blackt96_tilemapram2[count*2 + (base/2)]&0x000f)+0x10; | |
| 153 | ||
| 154 | drawgfx(bitmap,gfxspr,tile,colour,flipx,0,x*16,y*16,cliprect,TRANSPARENCY_PEN,0); | |
| 155 | count++; | |
| 156 | } | |
| 157 | } | |
| 158 | ||
| 159 | /* Text Layer */ | |
| 160 | count = 0; | |
| 161 | for (x=0;x<64;x++) | |
| 162 | { | |
| 163 | for (y=0;y<32;y++) | |
| 164 | { | |
| 165 | UINT16 tile = (blackt96_tilemapram[count*2]&0x7ff)+0x800; // +0xc00 for korean text | |
| 166 | drawgfx(bitmap,gfx,tile,0,0,0,x*8,y*8,cliprect,TRANSPARENCY_PEN,0); | |
| 167 | count++; | |
| 168 | } | |
| 169 | ||
| 170 | } | |
| 171 | ||
| 172 | ||
| 173 | ||
| 174 | ||
| 175 | return 0; | |
| 85 | 176 | } |
| 86 | 177 | |
| 178 | ||
| 87 | 179 | static WRITE16_HANDLER( blackt96_c0000_w ) |
| 88 | 180 | { |
| 89 | 181 | printf("blackt96_c0000_w %04x %04x\n",data,mem_mask); |
| 90 | 182 | } |
| 91 | 183 | |
| 184 | static WRITE16_HANDLER( blackt96_80000_w ) | |
| 185 | { | |
| 186 | // TO sound MCU? | |
| 187 | //printf("blackt96_80000_w %04x %04x\n",data,mem_mask); | |
| 188 | } | |
| 189 | ||
| 190 | ||
| 92 | 191 | static ADDRESS_MAP_START( blackt96_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 93 | 192 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 94 | AM_RANGE(0x080000, 0x080001) AM_READ(blackt96_80000_r) AM_WRITE(SMH_NOP) | |
| 95 | AM_RANGE(0x0c0000, 0x0c0001) AM_READ(blackt96_c0000_r) AM_WRITE(blackt96_c0000_w) | |
| 96 | AM_RANGE(0x0e0000, 0x0e0001) AM_READ(blackt96_e0000_r) | |
| 97 | AM_RANGE(0x0e8000, 0x0e8001) AM_READ(blackt96_e8000_r) | |
| 98 | AM_RANGE(0x0f0000, 0x0f0001) AM_READ(blackt96_f0000_r) | |
| 99 | AM_RANGE(0x0f0008, 0x0f0009) AM_READ(blackt96_f0008_r) | |
| 193 | AM_RANGE(0x080000, 0x080001) AM_READ(input_port_0_word_r) AM_WRITE(blackt96_80000_w) // PLAYER INPUT | |
| 194 | AM_RANGE(0x0c0000, 0x0c0001) AM_READ(input_port_1_word_r) AM_WRITE(blackt96_c0000_w) // COIN INPUT | |
| 195 | AM_RANGE(0x0e0000, 0x0e0001) AM_READ(input_port_2_word_r) | |
| 196 | AM_RANGE(0x0e8000, 0x0e8001) AM_READ(input_port_3_word_r) | |
| 197 | AM_RANGE(0x0f0000, 0x0f0001) AM_READ(input_port_4_word_r) // DSW1 | |
| 198 | AM_RANGE(0x0f0008, 0x0f0009) AM_READ(input_port_5_word_r) // DSW2 | |
| 100 | 199 | |
| 101 | AM_RANGE(0x100000, 0x100fff) AM_RAM | |
| 102 | AM_RANGE(0x200000, 0x207fff) AM_RAM | |
| 103 | AM_RANGE(0x400000, 0x400fff) AM_RAM | |
| 200 | AM_RANGE(0x100000, 0x100fff) AM_RAM AM_BASE(&blackt96_tilemapram) // text tilemap | |
| 201 | AM_RANGE(0x200000, 0x207fff) AM_RAM AM_BASE(&blackt96_tilemapram2)// sprite list? | |
| 202 | AM_RANGE(0x400000, 0x400fff) AM_RAM AM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_BASE(&paletteram16) | |
| 104 | 203 | AM_RANGE(0xc00000, 0xc03fff) AM_RAM // main ram |
| 105 | 204 | |
| 106 | 205 | ADDRESS_MAP_END |
| r2844 | r2845 | |
| 108 | 207 | |
| 109 | 208 | |
| 110 | 209 | static INPUT_PORTS_START( blackt96 ) |
| 111 | PORT_START | |
| 112 | PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 210 | PORT_START | |
| 211 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) | |
| 212 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) | |
| 213 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) | |
| 214 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) | |
| 215 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 216 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 217 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 218 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) | |
| 219 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) | |
| 220 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) | |
| 221 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) | |
| 222 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) | |
| 223 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 224 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 225 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 226 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) | |
| 227 | ||
| 228 | PORT_START | |
| 229 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) // Test mode lists this as Service 1, but it appears to be Coin 1 (uses Coin 1 coinage etc.) | |
| 230 | PORT_DIPNAME( 0x0002, 0x0002, "xx") | |
| 231 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 232 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 233 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) | |
| 234 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 235 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 236 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) | |
| 237 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 238 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 239 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) // Test mode lists this as Coin 1, but it doesn't work | |
| 240 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) | |
| 241 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 242 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 243 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) | |
| 244 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 245 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 246 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) | |
| 247 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 248 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 249 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) | |
| 250 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) | |
| 251 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 252 | PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) | |
| 253 | PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) | |
| 254 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 255 | PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) | |
| 256 | PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) | |
| 257 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 258 | PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) | |
| 259 | PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) | |
| 260 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 261 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) | |
| 262 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) | |
| 263 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 264 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) | |
| 265 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) | |
| 266 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 267 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) | |
| 268 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 269 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 270 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) | |
| 271 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 272 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 273 | ||
| 274 | PORT_START | |
| 275 | PORT_DIPNAME( 0x0001, 0x0001, "2" ) | |
| 276 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 277 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 278 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) | |
| 279 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 280 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 281 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) | |
| 282 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 283 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 284 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) | |
| 285 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 286 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 287 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) | |
| 288 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) | |
| 289 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 290 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) | |
| 291 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) | |
| 292 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 293 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) | |
| 294 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 295 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 296 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) | |
| 297 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 298 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 299 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) | |
| 300 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) | |
| 301 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 302 | PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) | |
| 303 | PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) | |
| 304 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 305 | PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) | |
| 306 | PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) | |
| 307 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 308 | PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) | |
| 309 | PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) | |
| 310 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 311 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) | |
| 312 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) | |
| 313 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 314 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) | |
| 315 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) | |
| 316 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 317 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) | |
| 318 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 319 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 320 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) | |
| 321 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 322 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 323 | ||
| 324 | PORT_START | |
| 325 | PORT_DIPNAME( 0x0001, 0x0001, "3" ) | |
| 326 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 327 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 328 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) | |
| 329 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) | |
| 330 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 331 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) | |
| 332 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 333 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 334 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) | |
| 335 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) | |
| 336 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 337 | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) | |
| 338 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) | |
| 339 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 340 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) | |
| 341 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) | |
| 342 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 343 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) | |
| 344 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 345 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 346 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) | |
| 347 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 348 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 349 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) | |
| 350 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) | |
| 351 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 352 | PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) | |
| 353 | PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) | |
| 354 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 355 | PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) | |
| 356 | PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) | |
| 357 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 358 | PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) | |
| 359 | PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) | |
| 360 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 361 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) | |
| 362 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) | |
| 363 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 364 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) | |
| 365 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) | |
| 366 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 367 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) | |
| 368 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 369 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 370 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) | |
| 371 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 372 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 373 | ||
| 374 | /* Dipswitch Port A */ | |
| 375 | PORT_START | |
| 376 | ||
| 377 | PORT_DIPNAME( 0x0300, 0x0100, DEF_STR( Coin_B ) ) | |
| 378 | PORT_DIPSETTING( 0x0000, DEF_STR( 1C_1C ) ) | |
| 379 | PORT_DIPSETTING( 0x0200, DEF_STR( 1C_2C ) ) | |
| 380 | PORT_DIPSETTING( 0x0100, DEF_STR( 1C_3C ) ) | |
| 381 | PORT_DIPSETTING( 0x0300, DEF_STR( 1C_4C ) ) | |
| 382 | ||
| 383 | PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Coin_A ) ) | |
| 384 | PORT_DIPSETTING( 0x0c00, DEF_STR( 4C_1C ) ) | |
| 385 | PORT_DIPSETTING( 0x0400, DEF_STR( 3C_1C ) ) | |
| 386 | PORT_DIPSETTING( 0x0800, DEF_STR( 2C_1C ) ) | |
| 387 | PORT_DIPSETTING( 0x0000, DEF_STR( 1C_1C ) ) | |
| 388 | ||
| 389 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Lives ) ) | |
| 390 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 391 | PORT_DIPSETTING( 0x1000, "3" ) | |
| 392 | ||
| 393 | PORT_DIPNAME( 0x2000, 0x2000, "Bonus Life Type" ) | |
| 394 | PORT_DIPSETTING( 0x2000, "Every" ) | |
| 395 | PORT_DIPSETTING( 0x0000, "Second Only" ) | |
| 396 | ||
| 397 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unused ) ) // ? | |
| 398 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 399 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 400 | ||
| 401 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Flip_Screen ) ) | |
| 402 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 403 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 404 | ||
| 405 | /* Dipswitch Port B */ | |
| 406 | PORT_START | |
| 407 | ||
| 408 | PORT_SERVICE( 0x0100, IP_ACTIVE_HIGH ) | |
| 409 | ||
| 410 | PORT_DIPNAME( 0x0200, 0x0200, "Continue" ) | |
| 411 | ||
| 412 | PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) | |
| 413 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 414 | PORT_DIPNAME( 0x0c00, 0x0400, DEF_STR( Bonus_Life ) ) | |
| 415 | PORT_DIPSETTING( 0x0000, "20000 / 50000" ) | |
| 416 | PORT_DIPSETTING( 0x0400, "60000 / 150000" ) | |
| 417 | PORT_DIPSETTING( 0x0800, "40000 / 100000" ) | |
| 418 | PORT_DIPSETTING( 0x0c00, "No Bonus" ) | |
| 419 | ||
| 420 | PORT_DIPNAME( 0x3000, 0x0000, "Demo Sound / Video Freeze" ) | |
| 421 | PORT_DIPSETTING( 0x0000, "Demo Sound On" ) | |
| 422 | PORT_DIPSETTING( 0x1000, "Never Finish" ) | |
| 423 | PORT_DIPSETTING( 0x2000, "Demo Sound Off" ) | |
| 424 | PORT_DIPSETTING( 0x3000, "Stop Video" ) | |
| 425 | ||
| 426 | PORT_DIPNAME( 0xc000, 0xc000, DEF_STR( Difficulty ) ) // 'Level' | |
| 427 | PORT_DIPSETTING( 0x8000, "1" ) | |
| 428 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 429 | PORT_DIPSETTING( 0x4000, "3" ) | |
| 430 | PORT_DIPSETTING( 0xc000, "4" ) | |
| 113 | 431 | INPUT_PORTS_END |
| 114 | 432 | |
| 115 | 433 | |
| r2844 | r2845 | |
| 126 | 444 | 32*64 |
| 127 | 445 | }; |
| 128 | 446 | |
| 447 | static const gfx_layout blackt962_layout = | |
| 448 | { | |
| 449 | 16,16, | |
| 450 | RGN_FRAC(1,1), | |
| 451 | 4, | |
| 452 | { 0,16,8, 24 }, | |
| 453 | { 519, 515, 518, 514, 517,513, 516,512, 7,3,6,2,5,1,4,0 }, | |
| 454 | { 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 }, | |
| 455 | 32*32 | |
| 456 | }; | |
| 129 | 457 | |
| 458 | ||
| 459 | /* wrong layout, but we can see some tiles */ | |
| 460 | static const gfx_layout blackt963_layout = | |
| 461 | { | |
| 462 | 8,8, | |
| 463 | RGN_FRAC(1,1), | |
| 464 | 4, | |
| 465 | { 0,4,8, 12 }, | |
| 466 | { 131,130,129,128,3,2,1,0 }, | |
| 467 | { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, | |
| 468 | 16*16 | |
| 469 | }; | |
| 470 | ||
| 130 | 471 | static GFXDECODE_START( blackt96 ) |
| 131 | GFXDECODE_ENTRY( REGION_GFX1, 0, blackt96_layout, 0x0, 2 ) | |
| 132 | GFXDECODE_ENTRY( REGION_GFX2, 0, blackt96_layout, 0x0, 2 ) | |
| 133 | GFXDECODE_ENTRY( REGION_GFX3, 0, blackt96_layout, 0x0, 2 ) | |
| 472 | GFXDECODE_ENTRY( REGION_GFX1, 0, blackt96_layout, 0x0, 0x10 ) | |
| 473 | GFXDECODE_ENTRY( REGION_GFX2, 0, blackt962_layout, 0x0, 0x80 ) | |
| 474 | GFXDECODE_ENTRY( REGION_GFX3, 0, blackt963_layout, 0x0, 0x80 ) | |
| 134 | 475 | GFXDECODE_END |
| 135 | 476 | |
| 477 | static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 478 | ADDRESS_MAP_END | |
| 136 | 479 | |
| 137 | 480 | static MACHINE_DRIVER_START( blackt96 ) |
| 138 | 481 | MDRV_CPU_ADD_TAG("main", M68000, 18000000 /2) |
| 139 | 482 | MDRV_CPU_PROGRAM_MAP(blackt96_map,0) |
| 140 | 483 | MDRV_CPU_VBLANK_INT("main", irq1_line_hold) |
| 141 | 484 | |
| 485 | MDRV_CPU_ADD(PIC16C57, 8000000) /* ? */ | |
| 486 | MDRV_CPU_FLAGS(CPU_DISABLE) | |
| 487 | MDRV_CPU_IO_MAP(sound_io_map, 0) | |
| 488 | ||
| 142 | 489 | MDRV_GFXDECODE(blackt96) |
| 143 | 490 | |
| 144 | 491 | MDRV_SCREEN_ADD("main", RASTER) |
| 145 | 492 | MDRV_SCREEN_REFRESH_RATE(60) |
| 146 | 493 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 147 | 494 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 148 | MDRV_SCREEN_SIZE(64*8, 32*8) | |
| 149 | MDRV_SCREEN_VISIBLE_AREA(8*8, 48*8-1, 2*8, 30*8-1) | |
| 495 | MDRV_SCREEN_SIZE(64*16, 64*8) | |
| 496 | // MDRV_SCREEN_VISIBLE_AREA(0*8, 16*32-1, 0*8, 16*32-1) | |
| 497 | MDRV_SCREEN_VISIBLE_AREA(0*8, 8*32-1, 2*8, 8*30-1) | |
| 150 | 498 | |
| 151 | MDRV_PALETTE_LENGTH(0x | |
| 499 | MDRV_PALETTE_LENGTH(0x800) | |
| 152 | 500 | |
| 153 | 501 | MDRV_VIDEO_START(blackt96) |
| 154 | 502 | MDRV_VIDEO_UPDATE(blackt96) |
| r2844 | r2845 | |
| 161 | 509 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.47) |
| 162 | 510 | |
| 163 | 511 | MDRV_SOUND_ADD(OKIM6295, 8000000/8) |
| 164 | MDRV_SOUND_CONFIG(okim6295_interface_region_ | |
| 512 | MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7high) | |
| 165 | 513 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.47) |
| 166 | 514 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.47) |
| 167 | 515 | MACHINE_DRIVER_END |
| r2844 | r2845 | |
| 172 | 520 | ROM_LOAD16_BYTE( "3", 0x00001, 0x40000, CRC(fc2c1d79) SHA1(742478237819af16d3fd66039283202b3c07eedd) ) |
| 173 | 521 | ROM_LOAD16_BYTE( "4", 0x00000, 0x40000, CRC(caff5b4a) SHA1(9a388cbb07211fa66f27082a8a5b847168c86a4f) ) |
| 174 | 522 | |
| 523 | ROM_REGION( 0x80000, REGION_CPU2, 0 ) /* PIC16c57 Code */ | |
| 524 | ROM_LOAD( "pic16c57", 0x00000, 0x1000, NO_DUMP ) | |
| 525 | ||
| 175 | 526 | ROM_REGION( 0x080000, REGION_SOUND1, 0 ) /* Samples */ |
| 176 | 527 | ROM_LOAD( "1", 0x00000, 0x80000, CRC(6a934174) SHA1(087f5fa226dc68ee217f99c64d16cdf14372d44c) ) |
| 177 | 528 | |
| 178 | 529 | ROM_REGION( 0x040000, REGION_SOUND2, 0 ) /* Samples */ |
| 179 | 530 | ROM_LOAD( "2", 0x00000, 0x40000, CRC(94009cd4) SHA1(aa36298e280c20bf86d70f3eb3fb33aca4df07e3) ) |
| 180 | 531 | |
| 181 | ROM_REGION( 0x180000, REGION_GFX1, 0 ) // tiles, 16x16x8 | |
| 182 | ROM_LOAD16_BYTE( "5", 0x00000, 0x40000, CRC(6e52c331) SHA1(31ef1d352d4ee5f7b3ef336b1f052c3a1468f22e) ) | |
| 183 | ROM_LOAD16_BYTE( "6", 0x00001, 0x40000, CRC(69637a5a) SHA1(a5731478856d8bb91d34b747838b2b47772864ef) ) | |
| 184 | ROM_LOAD16_BYTE( "7", 0x80000, 0x80000, CRC(6b04e8a8) SHA1(309ba1efd60600a30e1ae8f6e8b92939c23cd9c6) ) | |
| 185 | ROM_LOAD16_BYTE( "8", 0x80001, 0x80000, CRC(16c656be) SHA1(06c40c16080a97b01a638776d28f36594ce4fb3b) ) | |
| 532 | ROM_REGION( 0x200000, REGION_GFX1, 0 ) // bg tiles | |
| 533 | ROM_LOAD16_BYTE( "5", 0x100000, 0x40000, CRC(6e52c331) SHA1(31ef1d352d4ee5f7b3ef336b1f052c3a1468f22e) ) | |
| 534 | ROM_LOAD16_BYTE( "6", 0x100001, 0x40000, CRC(69637a5a) SHA1(a5731478856d8bb91d34b747838b2b47772864ef) ) | |
| 535 | ROM_LOAD16_BYTE( "7", 0x000000, 0x80000, CRC(6b04e8a8) SHA1(309ba1efd60600a30e1ae8f6e8b92939c23cd9c6) ) | |
| 536 | ROM_LOAD16_BYTE( "8", 0x000001, 0x80000, CRC(16c656be) SHA1(06c40c16080a97b01a638776d28f36594ce4fb3b) ) | |
| 186 | 537 | |
| 187 | ROM_REGION( 0x100000, REGION_GFX2, 0 ) // not tiles? | |
| 188 | ROM_LOAD( "11", 0x00000, 0x40000, CRC(9eb773a3) SHA1(9c91ee938438a61f5fa650ced6249e34aa5321bd) ) | |
| 189 | ROM_LOAD( "12", 0x40000, 0x40000, CRC(8894e608) SHA1(389974a0b208b7cbf7d5f83641ddc058ad5ebe87) ) | |
| 190 | ROM_LOAD( "13", 0x80000, 0x40000, CRC(0acceb9d) SHA1(e8a85c7eab45d84613ac37a9b7ffbc45b44eb2e5) ) | |
| 191 | ROM_LOAD( "14", 0xc0000, 0x40000, CRC(b5e3de25) SHA1(33ac5602ab6bcadc8b0d1aa805a3bdce0b67c215) ) | |
| 538 | ROM_REGION( 0x100000, REGION_GFX2, 0 ) // sprite tiles | |
| 539 | ROM_LOAD32_BYTE( "11", 0x00000, 0x40000, CRC(9eb773a3) SHA1(9c91ee938438a61f5fa650ced6249e34aa5321bd) ) | |
| 540 | ROM_LOAD32_BYTE( "12", 0x00001, 0x40000, CRC(8894e608) SHA1(389974a0b208b7cbf7d5f83641ddc058ad5ebe87) ) | |
| 541 | ROM_LOAD32_BYTE( "13", 0x00002, 0x40000, CRC(0acceb9d) SHA1(e8a85c7eab45d84613ac37a9b7ffbc45b44eb2e5) ) | |
| 542 | ROM_LOAD32_BYTE( "14", 0x00003, 0x40000, CRC(b5e3de25) SHA1(33ac5602ab6bcadc8b0d1aa805a3bdce0b67c215) ) | |
| 192 | 543 | |
| 193 | ROM_REGION( 0x100000, REGION_GFX3, 0 ) // not tiles? | |
| 194 | ROM_LOAD( "9", 0x00000, 0x10000, CRC(81a4cf4c) SHA1(94b2bbcbc8327d9babbc3b222bd88954c7e7b80e) ) | |
| 195 | ROM_LOAD( "10", 0x10000, 0x10000, CRC(b78232a2) SHA1(36a4f01011faf64e46b73f0082ab04843ac8b0e2) ) | |
| 544 | ROM_REGION( 0x20000, REGION_GFX3, 0 ) // txt tiles | |
| 545 | ROM_LOAD16_BYTE( "9", 0x00000, 0x10000, CRC(81a4cf4c) SHA1(94b2bbcbc8327d9babbc3b222bd88954c7e7b80e) ) | |
| 546 | ROM_LOAD16_BYTE( "10", 0x00001, 0x10000, CRC(b78232a2) SHA1(36a4f01011faf64e46b73f0082ab04843ac8b0e2) ) | |
| 196 | 547 | ROM_END |
| 197 | 548 | |
| 198 | GAME( 1996, blackt96, 0, blackt96, blackt96, 0, ROT0, "D.G.R.M.", "Black Touch '96", GAME_NOT_WORKING ) | |
| 549 | GAME( 1996, blackt96, 0, blackt96, blackt96, 0, ROT0, "D.G.R.M.", "Black Touch '96", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| r2844 | r2845 | |
|---|---|---|
| 192 | 192 | |
| 193 | 193 | static READ32_HANDLER( dreamwld_inputs_r ) |
| 194 | 194 | { |
| 195 | return input_port_read | |
| 195 | return input_port_read | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | static READ32_HANDLER( dreamwld_dips_r ) |
| 199 | 199 | { |
| 200 | 200 | int x; |
| 201 | x= input_port_read | |
| 201 | x= input_port_read | |
| 202 | 202 | return x|(x<<16); |
| 203 | 203 | } |
| 204 | 204 | |
| r2844 | r2845 | |
| 313 | 313 | |
| 314 | 314 | |
| 315 | 315 | static INPUT_PORTS_START(dreamwld) |
| 316 | PORT_START | |
| 316 | PORT_START_TAG("IN0") | |
| 317 | 317 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 ) |
| 318 | 318 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 319 | 319 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 331 | 331 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 332 | 332 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 333 | 333 | |
| 334 | PORT_START | |
| 334 | PORT_START_TAG("IN1") | |
| 335 | 335 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 336 | 336 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 337 | 337 | PORT_DIPNAME( 0x0004, 0x0004, "Not Dips?" ) // i don't think these are dips, they're probably just unused parts of the coin port input |
| r2844 | r2845 | |
| 377 | 377 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 378 | 378 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 379 | 379 | |
| 380 | PORT_START /* 16bit */ | |
| 380 | PORT_START_TAG("DSW") /* 16bit */ | |
| 381 | 381 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") |
| 382 | 382 | PORT_DIPSETTING( 0x0001, "1" ) |
| 383 | 383 | PORT_DIPSETTING( 0x0003, "2" ) |
| r2844 | r2845 | |
|---|---|---|
| 1895 | 1895 | PORT_DIPSETTING( 0x02, "5" ) |
| 1896 | 1896 | INPUT_PORTS_END |
| 1897 | 1897 | |
| 1898 | static INPUT_PORTS_START( spdcoin ) | |
| 1899 | PORT_START_TAG("IN0") | |
| 1900 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1901 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) | |
| 1902 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1903 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) | |
| 1904 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) | |
| 1905 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) | |
| 1906 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 1907 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 1898 | 1908 | |
| 1909 | PORT_START_TAG("IN1") | |
| 1910 | PORT_DIPNAME( 0x01, 0x00, "Freeze" ) /* Dip Sw #2 */ | |
| 1911 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1912 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) | |
| 1913 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Free_Play ) ) /* Dip Sw #1 */ | |
| 1914 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1915 | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) | |
| 1916 | PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1917 | ||
| 1918 | PORT_START_TAG("IN2") | |
| 1919 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1920 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) /* Dip Sw #5 - Check code at 0x0569 */ | |
| 1921 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 1922 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1923 | PORT_DIPNAME( 0x04, 0x00, DEF_STR( Difficulty ) ) /* Dip Sw #4 */ | |
| 1924 | PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) | |
| 1925 | PORT_DIPSETTING( 0x04, DEF_STR( Hard ) ) | |
| 1926 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) ) /* Dip Sw #3 */ | |
| 1927 | PORT_DIPSETTING( 0x08, "3" ) | |
| 1928 | PORT_DIPSETTING( 0x00, "5" ) | |
| 1929 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1930 | INPUT_PORTS_END | |
| 1931 | ||
| 1899 | 1932 | /* cocktail mode is N/A */ |
| 1933 | static INPUT_PORTS_START( superbon ) | |
| 1934 | PORT_START_TAG("IN0") | |
| 1935 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) | |
| 1936 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) | |
| 1937 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY | |
| 1938 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY | |
| 1939 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY | |
| 1940 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY | |
| 1941 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 1942 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 1943 | ||
| 1944 | PORT_START_TAG("IN1") | |
| 1945 | PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) ) | |
| 1946 | PORT_DIPSETTING( 0x01, "3" ) | |
| 1947 | PORT_DIPSETTING( 0x02, "5" ) | |
| 1948 | PORT_DIPSETTING( 0x03, DEF_STR( Free_Play ) ) | |
| 1949 | PORT_DIPSETTING( 0x00, "Invulnerability (Cheat)") | |
| 1950 | PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) | |
| 1951 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 1952 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1953 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 1954 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) | |
| 1955 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 1956 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1957 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) | |
| 1958 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1959 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1960 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 1961 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) | |
| 1962 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1963 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1964 | ||
| 1965 | PORT_START_TAG("IN2") | |
| 1966 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) | |
| 1967 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1968 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1969 | PORT_DIPNAME( 0x06, 0x02, DEF_STR( Coinage ) ) | |
| 1970 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) | |
| 1971 | PORT_DIPSETTING( 0x00, "A 1/2 B 2/1" ) | |
| 1972 | PORT_DIPSETTING( 0x04, "A 1/3 B 3/1" ) | |
| 1973 | PORT_DIPSETTING( 0x06, "A 1/4 B 4/1" ) | |
| 1974 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) | |
| 1975 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 1976 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1977 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) | |
| 1978 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 1979 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1980 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) | |
| 1981 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 1982 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1983 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) | |
| 1984 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1985 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1986 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) | |
| 1987 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1988 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1989 | INPUT_PORTS_END | |
| 1990 | ||
| 1991 | ||
| 1992 | /* cocktail mode is N/A */ | |
| 1900 | 1993 | INPUT_PORTS_START( losttomb ) |
| 1901 | 1994 | PORT_START_TAG("IN0") |
| 1902 | 1995 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) |
| r2844 | r2845 | |
| 2060 | 2153 | INPUT_PORTS_END |
| 2061 | 2154 | |
| 2062 | 2155 | |
| 2156 | /* cocktail mode is N/A */ | |
| 2157 | static INPUT_PORTS_START( calipso ) | |
| 2158 | PORT_START_TAG("IN0") | |
| 2159 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 2160 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2161 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY | |
| 2162 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY | |
| 2163 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY | |
| 2164 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY | |
| 2165 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 2166 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 2063 | 2167 | |
| 2168 | PORT_START_TAG("IN1") | |
| 2169 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) ) | |
| 2170 | PORT_DIPSETTING( 0x01, "3" ) | |
| 2171 | PORT_DIPSETTING( 0x00, "5" ) | |
| 2172 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) | |
| 2173 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 2174 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 2175 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 2176 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 2177 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 2178 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 2179 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2180 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2181 | ||
| 2182 | PORT_START_TAG("IN2") | |
| 2183 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 2184 | PORT_DIPNAME( 0x06, 0x02, DEF_STR( Coinage ) ) | |
| 2185 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) | |
| 2186 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) | |
| 2187 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) | |
| 2188 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_4C ) ) | |
| 2189 | PORT_DIPNAME( 0x08, 0x08, "Cabinet (Not Supported)" ) | |
| 2190 | PORT_DIPSETTING( 0x08, DEF_STR( Upright ) ) | |
| 2191 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) | |
| 2192 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2193 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2194 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2195 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 2196 | INPUT_PORTS_END | |
| 2197 | ||
| 2198 | ||
| 2199 | static INPUT_PORTS_START( moonwar_common ) | |
| 2200 | PORT_START_TAG("IN0") | |
| 2201 | PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_SPECIAL ) /* the spinner */ | |
| 2202 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL | |
| 2203 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 2204 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 2205 | ||
| 2206 | PORT_START_TAG("IN1") | |
| 2207 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) | |
| 2208 | PORT_DIPSETTING( 0x00, "3" ) | |
| 2209 | PORT_DIPSETTING( 0x01, "4" ) | |
| 2210 | PORT_DIPSETTING( 0x02, "5" ) | |
| 2211 | PORT_DIPSETTING( 0x03, DEF_STR( Free_Play ) ) | |
| 2212 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) | |
| 2213 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) | |
| 2214 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL | |
| 2215 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) | |
| 2216 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 2217 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 2218 | INPUT_PORTS_END | |
| 2219 | ||
| 2220 | ||
| 2221 | static INPUT_PORTS_START( moonwar ) | |
| 2222 | PORT_INCLUDE( moonwar_common ) | |
| 2223 | ||
| 2224 | PORT_START_TAG("IN2") | |
| 2225 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL | |
| 2226 | PORT_DIPNAME( 0x06, 0x02, DEF_STR( Coinage ) ) | |
| 2227 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) | |
| 2228 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) | |
| 2229 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) | |
| 2230 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_4C ) ) | |
| 2231 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) ) | |
| 2232 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 2233 | PORT_DIPSETTING( 0x08, DEF_STR( Cocktail ) ) | |
| 2234 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) /* output bits */ | |
| 2235 | ||
| 2236 | PORT_START_TAG("IN3") /* IN3/4 - dummy ports for the dial */ | |
| 2237 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_RESET | |
| 2238 | ||
| 2239 | PORT_START_TAG("IN4") | |
| 2240 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_RESET PORT_COCKTAIL | |
| 2241 | INPUT_PORTS_END | |
| 2242 | ||
| 2243 | /* same as above, but coinage is different */ | |
| 2244 | static INPUT_PORTS_START( moonwara ) | |
| 2245 | PORT_INCLUDE( moonwar_common ) | |
| 2246 | ||
| 2247 | PORT_START_TAG("IN2") | |
| 2248 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL | |
| 2249 | PORT_DIPNAME( 0x06, 0x00, DEF_STR( Coinage ) ) | |
| 2250 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) | |
| 2251 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) | |
| 2252 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) | |
| 2253 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_4C ) ) | |
| 2254 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) ) | |
| 2255 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 2256 | PORT_DIPSETTING( 0x08, DEF_STR( Cocktail ) ) | |
| 2257 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) /* output bits */ | |
| 2258 | ||
| 2259 | PORT_START_TAG("IN3") /* IN3/4 - dummy ports for the dial */ | |
| 2260 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_RESET | |
| 2261 | ||
| 2262 | PORT_START_TAG("IN4") /* doesn't actually work due to bug in game code */ | |
| 2263 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_RESET PORT_COCKTAIL | |
| 2264 | INPUT_PORTS_END | |
| 2265 | ||
| 2266 | ||
| 2064 | 2267 | /************************************* |
| 2065 | 2268 | * |
| 2066 | 2269 | * ROM definitions |
| r2844 | r2845 | |
| 4577 | 4780 | ROM_END |
| 4578 | 4781 | |
| 4579 | 4782 | |
| 4783 | ROM_START( spdcoin ) | |
| 4784 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 4785 | ROM_LOAD( "spdcoin.2c", 0x0000, 0x1000, CRC(65cf1e49) SHA1(a4570f0d7868fcdd378de3fd9e5346780afcf427) ) | |
| 4786 | ROM_LOAD( "spdcoin.2e", 0x1000, 0x1000, CRC(1ee59232) SHA1(b58c1de69d33cf80432012b9b6d8b1e3d8b00662) ) | |
| 4580 | 4787 | |
| 4788 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) | |
| 4789 | ROM_LOAD( "spdcoin.5c", 0x0000, 0x0800, CRC(b4cf64b7) SHA1(a95d94be2e374b78b4ba49b6931f0c214ff9d033) ) | |
| 4790 | ROM_LOAD( "spdcoin.5d", 0x0800, 0x0800, CRC(92304df0) SHA1(01471bf7cbea0090933a253b1b46f80c8f240df5) ) | |
| 4791 | ||
| 4792 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 4793 | ROM_LOAD( "spdcoin.5f", 0x0000, 0x0800, CRC(dd5f1dbc) SHA1(e7c40972a7530cac19ce04de3272244959d337ab) ) | |
| 4794 | ROM_LOAD( "spdcoin.5h", 0x0800, 0x0800, CRC(ab1fe81b) SHA1(98057932cb5faad60d425b547590ab22bfc67ff6) ) | |
| 4795 | ||
| 4796 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 4797 | ROM_LOAD( "spdcoin.clr", 0x0000, 0x0020, CRC(1a2ccc56) SHA1(58bedaa8b3e21e916295603b38529084b6c0099a) ) | |
| 4798 | ROM_END | |
| 4799 | ||
| 4800 | ||
| 4801 | ROM_START( superbon ) | |
| 4802 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 4803 | ROM_LOAD( "2d.cpu", 0x0000, 0x1000, CRC(60c0ba18) SHA1(6ad09e01dd3c86c8d9c465916227c9b00f38e025) ) | |
| 4804 | ROM_LOAD( "2e.cpu", 0x1000, 0x1000, CRC(ddcf44bf) SHA1(b862622f4aa8af6da568b4f82ef043359ece530f) ) | |
| 4805 | ROM_LOAD( "2f.cpu", 0x2000, 0x1000, CRC(bb66c2d5) SHA1(cbb7f4279ae48460790cb8abf976b978ae6a1a25) ) | |
| 4806 | ROM_LOAD( "2h.cpu", 0x3000, 0x1000, CRC(74f4f04d) SHA1(d51c5d2c21453ee0dab60253c3124b6112d1f859) ) | |
| 4807 | ROM_LOAD( "2j.cpu", 0x4000, 0x1000, CRC(78effb08) SHA1(64f211b34c2f37c25a36200b393f145b39ae67b5) ) | |
| 4808 | ROM_LOAD( "2l.cpu", 0x5000, 0x1000, CRC(e9dcecbd) SHA1(ec61cec2b66c041872a2ca29cf724a89c73fc9a3) ) | |
| 4809 | ROM_LOAD( "2m.cpu", 0x6000, 0x1000, CRC(3ed0337e) SHA1(975b93aee851867e335614419aa6db16fbf8063f) ) | |
| 4810 | ||
| 4811 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) | |
| 4812 | ROM_LOAD( "5c", 0x0000, 0x0800, CRC(b899be2a) SHA1(9b343a682531255104db61177a43ad933c3af34e) ) | |
| 4813 | ROM_LOAD( "5d.snd", 0x0800, 0x0800, CRC(80640a04) SHA1(83f2bafcfa5737441194d3058a76b2582317cfcb) ) | |
| 4814 | ||
| 4815 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 4816 | ROM_LOAD( "5f.cpu", 0x0000, 0x0800, CRC(5b9d4686) SHA1(c7814aefaccab9c8a3a0b015447d366cd2e43c3a) ) | |
| 4817 | ROM_LOAD( "5h.cpu", 0x0800, 0x0800, CRC(58c29927) SHA1(b88515d9c3108d2ad59f30fed5d74877b1636280) ) | |
| 4818 | ||
| 4819 | /* conversion instructions do not mention color proms */ | |
| 4820 | /* http://www.arcadeflyers.com/?page=flyer&db=videodb&id=5353&image=2 */ | |
| 4821 | /* however, pages may be missing. In addition, it is mentioned that the */ | |
| 4822 | /* conversion kit may be used for scramble, amidar and frogger as well. */ | |
| 4823 | /* They all have different color proms. */ | |
| 4824 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 4825 | ROM_LOAD( "superbon.clr", 0x0000, 0x0020, NO_DUMP ) | |
| 4826 | ||
| 4827 | ROM_END | |
| 4828 | ||
| 4829 | ROM_START( calipso ) | |
| 4830 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 4831 | ROM_LOAD( "calipso.2c", 0x0000, 0x1000, CRC(0fcb703c) SHA1(2bb096f114911973afdf3088c860c9566df06f60) ) | |
| 4832 | ROM_LOAD( "calipso.2e", 0x1000, 0x1000, CRC(c6622f14) SHA1(475164aed703a97275ff285ecaec9d8fd4fe723b) ) | |
| 4833 | ROM_LOAD( "calipso.2f", 0x2000, 0x1000, CRC(7bacbaba) SHA1(d321d6d09c689123eb1e5d758d95ccecec225252) ) | |
| 4834 | ROM_LOAD( "calipso.2h", 0x3000, 0x1000, CRC(a3a8111b) SHA1(3d9500c676563ebfc27aebb07716e6a966f00c35) ) | |
| 4835 | ROM_LOAD( "calipso.2j", 0x4000, 0x1000, CRC(fcbd7b9e) SHA1(5cc1edcc8b9867bb7849c8d97d1096bb6464f562) ) | |
| 4836 | ROM_LOAD( "calipso.2l", 0x5000, 0x1000, CRC(f7630cab) SHA1(482ee91cccd8a7c5768a1d6a9772d797769fe2dc) ) | |
| 4837 | ||
| 4838 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for sound code */ | |
| 4839 | ROM_LOAD( "calipso.5c", 0x0000, 0x0800, CRC(9cbc65ab) SHA1(b4ce04d18f9536c0ddd2f9c15edda75570e750e5) ) | |
| 4840 | ROM_LOAD( "calipso.5d", 0x0800, 0x0800, CRC(a225ee3b) SHA1(dba111f89851c69fb6fce16219cb2b0cb3294c15) ) | |
| 4841 | ||
| 4842 | ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 4843 | ROM_LOAD( "calipso.5f", 0x0000, 0x2000, CRC(fd4252e9) SHA1(881b988cdc9b7913f577573f8a15af7a7c7cc67f) ) | |
| 4844 | ROM_LOAD( "calipso.5h", 0x2000, 0x2000, CRC(1663a73a) SHA1(95b6ed25b656afdfb70fac35efa2e005185e4343) ) | |
| 4845 | ||
| 4846 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 4847 | ROM_LOAD( "calipso.clr", 0x0000, 0x0020, CRC(01165832) SHA1(bfef0459492dbd5febf3030916b6438eb6be71de) ) | |
| 4848 | ROM_END | |
| 4849 | ||
| 4850 | ||
| 4851 | ROM_START( moonwar ) | |
| 4852 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 4853 | ROM_LOAD( "mw2.2c", 0x0000, 0x1000, CRC(7c11b4d9) SHA1(a27bdff6ce728647ec811df843ac235c32c293d6) ) | |
| 4854 | ROM_LOAD( "mw2.2e", 0x1000, 0x1000, CRC(1b6362be) SHA1(2fbd95869146adcc0c8be1df653251fda8849e8e) ) | |
| 4855 | ROM_LOAD( "mw2.2f", 0x2000, 0x1000, CRC(4fd8ba4b) SHA1(3da784267a96d05f66b00626a22cb3f06211d202) ) | |
| 4856 | ROM_LOAD( "mw2.2h", 0x3000, 0x1000, CRC(56879f0d) SHA1(d1e9932863aebc5761e71fca8d24f3c400e1250d) ) | |
| 4857 | ||
| 4858 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) | |
| 4859 | ROM_LOAD( "mw2.5c", 0x0000, 0x0800, CRC(c26231eb) SHA1(5b19edfaefe1a535059311d067ea53405879d627) ) | |
| 4860 | ROM_LOAD( "mw2.5d", 0x0800, 0x0800, CRC(bb48a646) SHA1(cf51202d16b03bbed12ff24501be68683f28c992) ) | |
| 4861 | ||
| 4862 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 4863 | ROM_LOAD( "mw2.5f", 0x0000, 0x0800, CRC(c5fa1aa0) SHA1(6c6b5b2ce5de278ff436d3e7252ece5b086cc41d) ) | |
| 4864 | ROM_LOAD( "mw2.5h", 0x0800, 0x0800, CRC(a6ccc652) SHA1(286b3dc1f3a7da3ac66664e774b441ef075745f1) ) | |
| 4865 | ||
| 4866 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 4867 | ROM_LOAD( "mw2.clr", 0x0000, 0x0020, CRC(99614c6c) SHA1(f068985f3c5e0cd88551a02c32f9baeabfd50241) ) | |
| 4868 | ROM_END | |
| 4869 | ||
| 4870 | ROM_START( moonwara ) | |
| 4871 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 4872 | ROM_LOAD( "2c", 0x0000, 0x1000, CRC(bc20b734) SHA1(c6fe550987d0052979aad43c67aa1b9248049669) ) | |
| 4873 | ROM_LOAD( "2e", 0x1000, 0x1000, CRC(db6ffec2) SHA1(0fcd55b1e415e2e7041d10778052a235251f85fe) ) | |
| 4874 | ROM_LOAD( "2f", 0x2000, 0x1000, CRC(378931b8) SHA1(663f1eea9b0e8dc38de818df66c5211dac41c33b) ) | |
| 4875 | ROM_LOAD( "2h", 0x3000, 0x1000, CRC(031dbc2c) SHA1(5f2ca8b8763398bf161ee0c2c748a12d36cb40ec) ) | |
| 4876 | ||
| 4877 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) | |
| 4878 | ROM_LOAD( "mw2.5c", 0x0000, 0x0800, CRC(c26231eb) SHA1(5b19edfaefe1a535059311d067ea53405879d627) ) | |
| 4879 | ROM_LOAD( "mw2.5d", 0x0800, 0x0800, CRC(bb48a646) SHA1(cf51202d16b03bbed12ff24501be68683f28c992) ) | |
| 4880 | ||
| 4881 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 4882 | ROM_LOAD( "mw2.5f", 0x0000, 0x0800, CRC(c5fa1aa0) SHA1(6c6b5b2ce5de278ff436d3e7252ece5b086cc41d) ) | |
| 4883 | ROM_LOAD( "mw2.5h", 0x0800, 0x0800, CRC(a6ccc652) SHA1(286b3dc1f3a7da3ac66664e774b441ef075745f1) ) | |
| 4884 | ||
| 4885 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) | |
| 4886 | ROM_LOAD( "moonwara.clr", 0x0000, 0x0020, CRC(f58d4f58) SHA1(12a80d1edf3c80dafa0e1e3622d2a03224b62f14) ) /* olive, instead of white */ | |
| 4887 | ROM_END | |
| 4888 | ||
| 4889 | ||
| 4581 | 4890 | /************************************* |
| 4582 | 4891 | * |
| 4583 | 4892 | * Game drivers |
| r2844 | r2845 | |
| 4780 | 5089 | |
| 4781 | 5090 | GAME( 1982, anteater, 0, anteater, anteater, anteater, ROT90, "[Stern] (Tago license)", "Anteater", GAME_SUPPORTS_SAVE ) |
| 4782 | 5091 | |
| 5092 | GAME( 1984, spdcoin, 0, scobra, spdcoin, scobra, ROT90, "Stern", "Speed Coin (prototype)", GAME_SUPPORTS_SAVE ) | |
| 5093 | GAME( 1985, superbon, 0, scobra, superbon, superbon, ROT90, "Signatron USA", "Agent Super Bond (Scobra Hardware)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) | |
| 4783 | 5094 | |
| 5095 | GAME( 1982, calipso, 0, scobra, calipso, calipso, ROT90, "[Stern] (Tago license)", "Calipso", GAME_SUPPORTS_SAVE ) | |
| 4784 | 5096 | |
| 5097 | GAME( 1981, moonwar, 0, moonwar, moonwar, moonwar, ROT90, "Stern", "Moonwar", GAME_SUPPORTS_SAVE ) | |
| 5098 | GAME( 1981, moonwara, moonwar, moonwar, moonwara, moonwar, ROT90, "Stern", "Moonwar (older)", GAME_SUPPORTS_SAVE ) | |
| 4785 | 5099 | |
| 5100 | ||
| 5101 | ||
| 4786 | 5102 | /* currently in galaxold.c and should be moved here */ |
| 4787 | 5103 | //GAME( 1981, 4in1, 0, 4in1, 4in1, 4in1, ROT90, "Armenia / Food and Fun", "4 Fun in 1", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 4788 | 5104 | //GAME( 1982, bagmanmc, bagman, bagmanmc, bagmanmc, galaxian, ROT90, "bootleg", "Bagman (Moon Cresta hardware)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) |
| 4789 | 5105 | //GAME( 1982, dkongjrm, dkongjr, dkongjrm, dkongjrm, galaxian, ROT90, "bootleg", "Donkey Kong Jr. (Moon Cresta hardware)", GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 4790 | 5106 | //GAME( 1981, rockclim, 0, rockclim, rockclim, galaxian, ROT180, "Taito", "Rock Climber", GAME_SUPPORTS_SAVE ) |
| 4791 | 5107 | //GAME( 1983, ozon1, 0, ozon1, ozon1, galaxian, ROT90, "Proma", "Ozon I", GAME_SUPPORTS_SAVE ) |
| 4792 | //GAME( 1983, ladybugg, ladybug, galaxian/*batman2*/, ladybugg, ladybugg, ROT270, "bootleg", "Lady | |
| 5108 | //GAME( 1983, ladybugg, ladybug, galaxian/*batman2*/, ladybugg, ladybugg, ROT270, "bootleg", "Lady Bug (bootleg on Galaxian hardware)", GAME_SUPPORTS_SAVE ) | |
| 4793 | 5109 | //GAME( 1980, vpool, hustler, mooncrst, vpool, galaxian, ROT90, "bootleg", "Video Pool (bootleg on Moon Cresta hardware)", GAME_SUPPORTS_SAVE ) |
| 4794 | 5110 | //GAME( 1984, drivfrcg, drivfrcp, drivfrcg, drivfrcg, galaxian, ROT90, "Shinkai Inc. (Magic Eletronics USA licence)", "Driving Force (Galaxian conversion)", GAME_SUPPORTS_SAVE ) |
| 4795 | 5111 | //GAME( 1985, drivfrcb, drivfrcp, drivfrcg, drivfrcg, galaxian, ROT90, "bootleg", "Driving Force (Galaxian conversion bootleg)", GAME_SUPPORTS_SAVE ) |
| r2844 | r2845 | |
| 4830 | 5146 | /* currently in scobra.c and should be moved here */ |
| 4831 | 5147 | //GAME( 1981, stratgyx, 0, scobra/*stratgyx*/, stratgyx, stratgyx, ROT0, "Konami", "Strategy X", GAME_SUPPORTS_SAVE ) |
| 4832 | 5148 | //GAME( 1981, stratgys, stratgyx, scobra/*stratgyx*/, stratgyx, stratgyx, ROT0, "[Konami] (Stern license)", "Strategy X (Stern)", GAME_SUPPORTS_SAVE ) |
| 4833 | //GAME( 1981, moonwar, 0, scobra/*moonwar*/, moonwar, moonwar, ROT90, "Stern", "Moonwar", GAME_SUPPORTS_SAVE ) | |
| 4834 | //GAME( 1981, moonwara, moonwar, scobra/*moonwar*/, moonwara, moonwar, ROT90, "Stern", "Moonwar (older)", GAME_SUPPORTS_SAVE ) | |
| 4835 | //GAME( 1984, spdcoin, 0, scobra, spdcoin, scramble_ppi, ROT90, "Stern", "Speed Coin (prototype)", GAME_SUPPORTS_SAVE ) | |
| 4836 | 5149 | //GAME( 1982, darkplnt, 0, scobra/*darkplnt*/, darkplnt, darkplnt, ROT180, "Stern", "Dark Planet", GAME_SUPPORTS_SAVE ) |
| 4837 | 5150 | //GAME( 1982, tazmani2, tazmania, scobra/*type2*/, tazmania, tazmani2, ROT90, "Stern", "Tazz-Mania (set 2)", GAME_SUPPORTS_SAVE ) |
| 4838 | //GAME( 1982, calipso, 0, scobra/*calipso*/, calipso, scobra, ROT90, "[Stern] (Tago license)", "Calipso", GAME_SUPPORTS_SAVE ) | |
| 4839 | 5151 | //GAME( 1983, anteatg, anteater, scobra/*anteatg*/, anteatg, scramble_ppi, ROT90, "TV-Tuning (F.E.G. license)", "Ameisenbaer (German)", GAME_SUPPORTS_SAVE ) |
| 4840 | 5152 | //GAME( 1983, anteatgb, anteater, scobra/*anteatgb*/, anteatgb, scramble_ppi, ROT90, "Free Enterprise Games", "The Anteater (UK)", GAME_SUPPORTS_SAVE ) |
| 4841 | 5153 | //GAME( 1982, rescue, 0, scobra/*rescue*/, rescue, rescue, ROT90, "Stern", "Rescue", GAME_SUPPORTS_SAVE ) |
| 4842 | 5154 | //GAME( 1982, aponow, rescue, scobra/*rescue*/, rescue, rescue, ROT90, "bootleg", "Apocaljpse Now", GAME_SUPPORTS_SAVE ) |
| 4843 | 5155 | //GAME( 1983, minefld, 0, scobra/*minefld*/, minefld, minefld, ROT90, "Stern", "Minefield", GAME_SUPPORTS_SAVE ) |
| 4844 | //GAME( 198?, superbon, 0, scobra, superbon, superbon, ROT90, "bootleg", "Super Bond", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) | |
| 4845 | 5156 | //GAME( 1981, hustler, 0, scobra/*hustler*/, hustler, hustler, ROT90, "Konami", "Video Hustler", GAME_SUPPORTS_SAVE ) |
| 4846 | 5157 | //GAME( 1981, billiard, hustler, scobra/*hustler*/, hustler, billiard, ROT90, "bootleg", "The Billiards", GAME_SUPPORTS_SAVE ) |
| 4847 | 5158 | //GAME( 1981, hustlerb, hustler, scobra/*hustlerb*/, hustler, scramble_ppi, ROT90, "bootleg", "Video Hustler (bootleg)", GAME_SUPPORTS_SAVE ) |
| r2844 | r2845 | |
|---|---|---|
| 344 | 344 | #include "sound/2151intf.h" |
| 345 | 345 | #include "sound/namco.h" |
| 346 | 346 | #include "sound/dac.h" |
| 347 | #include "includes/namcos1.h" | |
| 347 | 348 | |
| 348 | 349 | static int dac0_value, dac1_value, dac0_gain, dac1_gain; |
| 349 | 350 | |
| 350 | 351 | |
| 351 | /* from video */ | |
| 352 | VIDEO_START( namcos1 ); | |
| 353 | VIDEO_UPDATE( namcos1 ); | |
| 354 | VIDEO_EOF( namcos1 ); | |
| 355 | ||
| 356 | /* from machine */ | |
| 357 | WRITE8_HANDLER( namcos1_bankswitch_w ); | |
| 358 | WRITE8_HANDLER( namcos1_subcpu_bank_w ); | |
| 359 | ||
| 360 | WRITE8_HANDLER( namcos1_cpu_control_w ); | |
| 361 | WRITE8_HANDLER( namcos1_watchdog_w ); | |
| 362 | WRITE8_HANDLER( namcos1_sound_bankswitch_w ); | |
| 363 | ||
| 364 | WRITE8_HANDLER( namcos1_mcu_bankswitch_w ); | |
| 365 | WRITE8_HANDLER( namcos1_mcu_patch_w ); | |
| 366 | ||
| 367 | MACHINE_RESET( namcos1 ); | |
| 368 | ||
| 369 | DRIVER_INIT( shadowld ); | |
| 370 | DRIVER_INIT( dspirit ); | |
| 371 | DRIVER_INIT( quester ); | |
| 372 | DRIVER_INIT( blazer ); | |
| 373 | DRIVER_INIT( pacmania ); | |
| 374 | DRIVER_INIT( galaga88 ); | |
| 375 | DRIVER_INIT( ws ); | |
| 376 | DRIVER_INIT( berabohm ); | |
| 377 | DRIVER_INIT( alice ); | |
| 378 | DRIVER_INIT( bakutotu ); | |
| 379 | DRIVER_INIT( wldcourt ); | |
| 380 | DRIVER_INIT( splatter ); | |
| 381 | DRIVER_INIT( faceoff ); | |
| 382 | DRIVER_INIT( rompers ); | |
| 383 | DRIVER_INIT( blastoff ); | |
| 384 | DRIVER_INIT( ws89 ); | |
| 385 | DRIVER_INIT( dangseed ); | |
| 386 | DRIVER_INIT( ws90 ); | |
| 387 | DRIVER_INIT( pistoldm ); | |
| 388 | DRIVER_INIT( soukobdx ); | |
| 389 | DRIVER_INIT( puzlclub ); | |
| 390 | DRIVER_INIT( tankfrce ); | |
| 391 | ||
| 392 | ||
| 393 | 352 | /**********************************************************************/ |
| 394 | 353 | |
| 395 | 354 | static WRITE8_HANDLER( namcos1_sub_firq_w ) |
| r2844 | r2845 | |
| 663 | 622 | INPUT_PORTS_END |
| 664 | 623 | |
| 665 | 624 | |
| 625 | static INPUT_PORTS_START( tankfrc4 ) | |
| 626 | ||
| 627 | /* How are the controls mapped? Coins 3 & 4 are right as shown below. Hit F2 for test screen, then "9" for the controls test screen */ | |
| 628 | /* Start buttons are not used by the game & manual shows P1 buttons 2 & 3 (plus unused JAMMA pins 25 & 26) are P3 UP, DOWN, LEFT & RIGHT */ | |
| 629 | /* Manual shows P2 buttons 2 & 3 (plus unused JAMMA pins c & d) are P4 UP, DOWN, LEFT & RIGHT. J23 & J24 are P3 button1 & P4 button1 */ | |
| 630 | ||
| 631 | PORT_INCLUDE( ns1 ) | |
| 632 | ||
| 633 | PORT_MODIFY( "CONTROL0" ) | |
| 634 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 635 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) | |
| 636 | ||
| 637 | PORT_MODIFY( "CONTROL1" ) | |
| 638 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 639 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4 ) | |
| 640 | INPUT_PORTS_END | |
| 641 | ||
| 642 | ||
| 643 | ||
| 666 | 644 | static INPUT_PORTS_START( pacmania ) |
| 667 | 645 | PORT_INCLUDE( ns1 ) |
| 668 | 646 | |
| r2844 | r2845 | |
| 2351 | 2329 | ROM_LOAD( "tf1_obj1.bin", 0x20000, 0x20000, CRC(df674d6d) SHA1(65935c2d6072228fcb2fbca8808fc921db9e0ddd) ) |
| 2352 | 2330 | ROM_END |
| 2353 | 2331 | |
| 2332 | /* Tank Force US 4 Player version*/ | |
| 2333 | ROM_START( tankfrc4 ) | |
| 2334 | ROM_REGION( 0x2c000, REGION_CPU3, 0 ) /* 176k for the sound cpu */ | |
| 2335 | ROM_LOAD( "tf1_snd0.bin", 0x0c000, 0x20000, CRC(4d9cf7aa) SHA1(de51b9b36e9a530a7f3c35672ec72c19b607af04) ) | |
| 2336 | ||
| 2337 | ROM_REGION( 0x400000, REGION_USER1, 0 ) /* 4M for ROMs */ | |
| 2338 | ROM_LOAD_1024( "tf1_prg0.bin", 0x000000, CRC(2ae4b9eb) SHA1(569d2754398b4276cf78a3dd038b5884778dc82e) ) | |
| 2339 | ROM_LOAD_1024( "tf1_prg1.bin", 0x080000, CRC(4a8bb251) SHA1(1df46ccf0ad7260398b7965e3825e936ba357062) ) | |
| 2340 | /* 100000-17ffff empty */ | |
| 2341 | /* 180000-1fffff empty */ | |
| 2342 | /* 200000-27ffff empty */ | |
| 2343 | /* 280000-2fffff empty */ | |
| 2344 | /* 300000-37ffff empty */ | |
| 2345 | ROM_LOAD_1024( "tfu4prg7.bin", 0x380000, CRC(162adea0) SHA1(9758433ae97b463253af455c80eefee4243f6c9e) ) | |
| 2346 | ||
| 2347 | ROM_REGION( 0xd0000, REGION_CPU4, 0 ) /* the MCU & voice */ | |
| 2348 | ROM_LOAD( "cus64-64a1.mcu", 0x0f000, 0x01000, CRC(ffb5c0bd) SHA1(7a38c0cc2553c627f4ec507fb6e807cf7d537c02) ) /* internal 63701 MCU code */ | |
| 2349 | ROM_LOAD( "tf1_voi0.bin", 0x10000, 0x20000, CRC(f542676a) SHA1(38d54db0807c58152bd120c393bf63b68754e8ff) ) | |
| 2350 | ROM_LOAD( "tf1_voi1.bin", 0x30000, 0x20000, CRC(615d09cd) SHA1(0aecf7ca6b65ddfcdcf74f8d412169ec800ba3a3) ) | |
| 2351 | ||
| 2352 | ROM_REGION( 0x20000, REGION_GFX1, 0 ) /* character mask */ | |
| 2353 | ROM_LOAD( "tf1_chr8.bin", 0x00000, 0x20000, CRC(7d53b31e) SHA1(7e4b5fc92f7956477392f1e14c6edfc0cada2be0) ) | |
| 2354 | ||
| 2355 | ROM_REGION( 0x100000, REGION_GFX2, ROMREGION_DISPOSE ) /* characters */ | |
| 2356 | ROM_LOAD( "tf1_chr0.bin", 0x00000, 0x20000, CRC(9e91794e) SHA1(e873ed31fafae02a3c3d9127801a13f67cbdb5f4) ) | |
| 2357 | ROM_LOAD( "tf1_chr1.bin", 0x20000, 0x20000, CRC(76e1bc56) SHA1(f95e4100cad29a8972e4f435b4f9ee3cdc4f4504) ) | |
| 2358 | ROM_LOAD( "tf1_chr2.bin", 0x40000, 0x20000, CRC(fcb645d9) SHA1(afedb4c6c1b02444ddb1757ac9808df1b94de2d8) ) | |
| 2359 | ROM_LOAD( "tf1_chr3.bin", 0x60000, 0x20000, CRC(a8dbf080) SHA1(115f3b21e0546000076c3c4d588e5bdcc4cf50d5) ) | |
| 2360 | ROM_LOAD( "tf1_chr4.bin", 0x80000, 0x20000, CRC(51fedc8c) SHA1(4a0c337fe614ebf66ee0fc3cfb05cad51a048fcf) ) | |
| 2361 | ROM_LOAD( "tf1_chr5.bin", 0xa0000, 0x20000, CRC(e6c6609a) SHA1(0c05cdd6b1dc4f082b9ac0e4de252c3d72392bb0) ) | |
| 2362 | ||
| 2363 | ROM_REGION( 0x100000, REGION_GFX3, ROMREGION_DISPOSE ) /* sprites */ | |
| 2364 | ROM_LOAD( "tf1_obj0.bin", 0x00000, 0x20000, CRC(4bedd51a) SHA1(fedb972986efe5ff3bd6c75fa16f22f8267ee0b7) ) | |
| 2365 | ROM_LOAD( "tf1_obj1.bin", 0x20000, 0x20000, CRC(df674d6d) SHA1(65935c2d6072228fcb2fbca8808fc921db9e0ddd) ) | |
| 2366 | ROM_END | |
| 2367 | ||
| 2354 | 2368 | /* Tank Force (Japan) */ |
| 2355 | 2369 | ROM_START( tankfrcj ) |
| 2356 | 2370 | ROM_REGION( 0x2c000, REGION_CPU3, 0 ) /* 176k for the sound cpu */ |
| r2844 | r2845 | |
| 2420 | 2434 | GAME( 1990, boxyboy, 0, ns1, boxyboy, soukobdx, ROT0, "Namco", "Boxy Boy (US)", 0 ) |
| 2421 | 2435 | GAME( 1990, soukobdx, boxyboy, ns1, boxyboy, soukobdx, ROT0, "Namco", "Souko Ban Deluxe (Japan)", 0 ) |
| 2422 | 2436 | GAME( 1990, puzlclub, 0, ns1, puzlclub, puzlclub, ROT90, "Namco", "Puzzle Club (Japan prototype)", 0 ) |
| 2423 | GAME( 1991, tankfrce, 0, ns1, ns1, tankfrce, ROT0, "Namco", "Tank Force (US)", 0 ) | |
| 2437 | GAME( 1991, tankfrce, 0, ns1, ns1, tankfrce, ROT0, "Namco", "Tank Force (US, 2 Player)", 0 ) | |
| 2438 | GAME( 1991, tankfrc4, tankfrce, ns1, tankfrc4, tankfrce, ROT0, "Namco", "Tank Force (US, 4 Player)", GAME_NOT_WORKING ) /* No controls */ | |
| 2424 | 2439 | GAME( 1991, tankfrcj, tankfrce, ns1, ns1, tankfrce, ROT0, "Namco", "Tank Force (Japan)", 0 ) |
| 2425 | 2440 |
| r2844 | r2845 | |
|---|---|---|
| 49 | 49 | state_save_register_global_pointer(deco16_pf12_control, 0x10/2); |
| 50 | 50 | state_save_register_global_pointer(paletteram16, 0x1000/2); |
| 51 | 51 | |
| 52 | deco16_1_video_init(); | |
| 52 | deco16_1_video_init(machine); | |
| 53 | 53 | |
| 54 | 54 | deco16_set_tilemap_bank_callback(0, simpl156_bank_callback); |
| 55 | 55 | deco16_set_tilemap_bank_callback(1, simpl156_bank_callback); |
| r2844 | r2845 | |
|---|---|---|
| 223 | 223 | #include "sound/ay8910.h" |
| 224 | 224 | #include "sound/dac.h" |
| 225 | 225 | #include "sound/msm5232.h" |
| 226 | #include "includes/buggychl.h" | |
| 226 | 227 | |
| 227 | /* in machine/buggychl.c */ | |
| 228 | READ8_HANDLER( buggychl_68705_portA_r ); | |
| 229 | WRITE8_HANDLER( buggychl_68705_portA_w ); | |
| 230 | WRITE8_HANDLER( buggychl_68705_ddrA_w ); | |
| 231 | READ8_HANDLER( buggychl_68705_portB_r ); | |
| 232 | WRITE8_HANDLER( buggychl_68705_portB_w ); | |
| 233 | WRITE8_HANDLER( buggychl_68705_ddrB_w ); | |
| 234 | READ8_HANDLER( buggychl_68705_portC_r ); | |
| 235 | WRITE8_HANDLER( buggychl_68705_portC_w ); | |
| 236 | WRITE8_HANDLER( buggychl_68705_ddrC_w ); | |
| 237 | WRITE8_HANDLER( buggychl_mcu_w ); | |
| 238 | READ8_HANDLER( buggychl_mcu_r ); | |
| 239 | READ8_HANDLER( buggychl_mcu_status_r ); | |
| 240 | ||
| 241 | ||
| 242 | 228 | extern VIDEO_START( fortyl ); |
| 243 | 229 | extern VIDEO_UPDATE( fortyl ); |
| 244 | 230 | extern PALETTE_INIT( fortyl ); |
| r2844 | r2845 | |
|---|---|---|
| 135 | 135 | #include "machine/rp5h01.h" |
| 136 | 136 | #include "sound/dac.h" |
| 137 | 137 | #include "sound/nes_apu.h" |
| 138 | #include "includes/vsnes.h" | |
| 138 | 139 | |
| 139 | 140 | /* clock frequency */ |
| 140 | 141 | #define N2A03_DEFAULTCLOCK ( 21477272.724 / 12 ) |
| 141 | 142 | |
| 142 | 143 | #define DUAL_RBI 1 |
| 143 | 144 | |
| 144 | /* from video */ | |
| 145 | extern VIDEO_START( vsnes ); | |
| 146 | extern PALETTE_INIT( vsnes ); | |
| 147 | extern VIDEO_UPDATE( vsnes ); | |
| 148 | extern VIDEO_START( vsdual ); | |
| 149 | extern VIDEO_UPDATE( vsdual ); | |
| 150 | extern PALETTE_INIT( vsdual ); | |
| 151 | ||
| 152 | /* from machine */ | |
| 153 | extern MACHINE_RESET( vsnes ); | |
| 154 | extern MACHINE_RESET( vsdual ); | |
| 155 | extern DRIVER_INIT( vsnes ); | |
| 156 | extern DRIVER_INIT( suprmrio ); | |
| 157 | extern DRIVER_INIT( excitebk ); | |
| 158 | extern DRIVER_INIT( excitbkj ); | |
| 159 | extern DRIVER_INIT( vsnormal ); | |
| 160 | extern DRIVER_INIT( duckhunt ); | |
| 161 | extern DRIVER_INIT( hogalley ); | |
| 162 | extern DRIVER_INIT( goonies ); | |
| 163 | extern DRIVER_INIT( machridr ); | |
| 164 | extern DRIVER_INIT( vsslalom ); | |
| 165 | extern DRIVER_INIT( cstlevna ); | |
| 166 | extern DRIVER_INIT( drmario ); | |
| 167 | extern DRIVER_INIT( rbibb ); | |
| 168 | extern DRIVER_INIT( tkoboxng ); | |
| 169 | extern DRIVER_INIT( topgun ); | |
| 170 | extern DRIVER_INIT( vsgradus ); | |
| 171 | extern DRIVER_INIT( vspinbal ); | |
| 172 | extern DRIVER_INIT( MMC3 ); | |
| 173 | extern DRIVER_INIT( platoon ); | |
| 174 | extern DRIVER_INIT( vstennis ); | |
| 175 | extern DRIVER_INIT( wrecking ); | |
| 176 | extern DRIVER_INIT( balonfgt ); | |
| 177 | extern DRIVER_INIT( vsbball ); | |
| 178 | extern DRIVER_INIT( iceclmrj ); | |
| 179 | extern DRIVER_INIT( supxevs ); | |
| 180 | extern DRIVER_INIT( btlecity ); | |
| 181 | extern DRIVER_INIT( vstetris ); | |
| 182 | extern DRIVER_INIT( bnglngby ); | |
| 183 | extern DRIVER_INIT( jajamaru); | |
| 184 | extern DRIVER_INIT( vsgshoe ); | |
| 185 | extern DRIVER_INIT( vsfdf ); | |
| 186 | extern DRIVER_INIT( mightybj); | |
| 187 | ||
| 188 | extern READ8_HANDLER( vsnes_in0_r ); | |
| 189 | extern READ8_HANDLER( vsnes_in1_r ); | |
| 190 | extern READ8_HANDLER( vsnes_in0_1_r ); | |
| 191 | extern READ8_HANDLER( vsnes_in1_1_r ); | |
| 192 | extern WRITE8_HANDLER( vsnes_in0_w ); | |
| 193 | extern WRITE8_HANDLER( vsnes_in0_1_w ); | |
| 194 | ||
| 195 | 145 | /******************************************************************************/ |
| 196 | 146 | |
| 197 | 147 | /* local stuff */ |
| r2844 | r2845 | |
|---|---|---|
| 132 | 132 | logerror("%08x: Unmapped IRQ write %d %04x\n",activecpu_get_pc(),offset,data); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | static READ16_HANDLER( robocop2_dip3_r ) { return input_port_read_indexed(machine, 3); } | |
| 136 | ||
| 137 | 135 | static READ16_HANDLER( robocop2_prot_r ) |
| 138 | 136 | { |
| 139 | 137 | switch (offset<<1) { |
| 140 | 138 | case 0x41a: /* Player 1 & 2 input ports */ |
| 141 | return input_port_read | |
| 139 | return input_port_read | |
| 142 | 140 | case 0x320: /* Coins */ |
| 143 | return input_port_read | |
| 141 | return input_port_read | |
| 144 | 142 | case 0x4e6: /* Dip switches */ |
| 145 | return input_port_read | |
| 143 | return input_port_read | |
| 146 | 144 | case 0x504: /* PC: 6b6. b4, 2c, 36 written before read */ |
| 147 | 145 | logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",activecpu_get_pc(),offset); |
| 148 | 146 | return 0x84; |
| r2844 | r2845 | |
| 253 | 251 | AM_RANGE(0x156000, 0x156fff) AM_READ(SMH_RAM) |
| 254 | 252 | AM_RANGE(0x15c000, 0x15c7ff) AM_READ(SMH_RAM) |
| 255 | 253 | AM_RANGE(0x15e000, 0x15e7ff) AM_READ(SMH_RAM) |
| 256 | AM_RANGE(0x1f8000, 0x1f8001) AM_READ | |
| 254 | AM_RANGE(0x1f8000, 0x1f8001) AM_READ | |
| 257 | 255 | ADDRESS_MAP_END |
| 258 | 256 | |
| 259 | 257 | static ADDRESS_MAP_START( robocop2_writemem, ADDRESS_SPACE_PROGRAM, 16 ) |
| r2844 | r2845 | |
| 431 | 429 | |
| 432 | 430 | static INPUT_PORTS_START( edrandy ) |
| 433 | 431 | |
| 434 | PORT_START | |
| 432 | PORT_START_TAG("IN0") | |
| 435 | 433 | DATAEAST_2BUTTON |
| 436 | 434 | |
| 437 | PORT_START | |
| 435 | PORT_START_TAG("IN1") | |
| 438 | 436 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 439 | 437 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 440 | 438 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 441 | 439 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 442 | 440 | |
| 443 | 441 | PORT_START_TAG("DSW") |
| 444 | ||
| 445 | 442 | DATAEAST_COINAGE |
| 446 | 443 | |
| 447 | 444 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7") |
| r2844 | r2845 | |
| 486 | 483 | |
| 487 | 484 | static INPUT_PORTS_START( cninja ) |
| 488 | 485 | |
| 489 | PORT_START | |
| 486 | PORT_START_TAG("IN0") | |
| 490 | 487 | DATAEAST_2BUTTON |
| 491 | 488 | |
| 492 | PORT_START | |
| 489 | PORT_START_TAG("IN1") | |
| 493 | 490 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 494 | 491 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 495 | 492 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r2844 | r2845 | |
| 540 | 537 | INPUT_PORTS_END |
| 541 | 538 | |
| 542 | 539 | static INPUT_PORTS_START( robocop2 ) |
| 543 | PORT_START | |
| 540 | PORT_START_TAG("IN0") | |
| 544 | 541 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 545 | 542 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 546 | 543 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| r2844 | r2845 | |
| 558 | 555 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 559 | 556 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) |
| 560 | 557 | |
| 561 | PORT_START | |
| 558 | PORT_START_TAG("IN1") | |
| 562 | 559 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 563 | 560 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 564 | 561 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r2844 | r2845 | |
| 597 | 594 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 598 | 595 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 599 | 596 | |
| 600 | PORT_START | |
| 597 | PORT_START_TAG("DSW3") | |
| 601 | 598 | PORT_DIPNAME( 0x0003, 0x0003, "Bullets" ) PORT_DIPLOCATION("SW3:1,2") /* Dip switch bank 3 */ |
| 602 | 599 | PORT_DIPSETTING( 0x0000, "Least" ) |
| 603 | 600 | PORT_DIPSETTING( 0x0001, "Less" ) |
| r2844 | r2845 | |
| 623 | 620 | |
| 624 | 621 | static INPUT_PORTS_START( mutantf ) |
| 625 | 622 | |
| 626 | PORT_START | |
| 623 | PORT_START_TAG("IN0") | |
| 627 | 624 | DATAEAST_2BUTTON |
| 628 | 625 | |
| 629 | PORT_START | |
| 626 | PORT_START_TAG("IN1") | |
| 630 | 627 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 631 | 628 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 632 | 629 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r2844 | r2845 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | UINT8 *jcr_textram; |
| 26 | 26 | |
| 27 | WRITE8_HANDLER( snkwave_w ); | |
| 28 | ||
| 29 | 27 | READ8_HANDLER( jcross_background_ram_r ); |
| 30 | 28 | WRITE8_HANDLER( jcross_background_ram_w ); |
| 31 | 29 |
| r2844 | r2845 | |
|---|---|---|
| 295 | 295 | #include "driver.h" |
| 296 | 296 | #include "includes/snes.h" |
| 297 | 297 | |
| 298 | extern DRIVER_INIT( snes ); | |
| 299 | ||
| 300 | 298 | static ADDRESS_MAP_START( snes_map, ADDRESS_SPACE_PROGRAM, 8) |
| 301 | 299 | AM_RANGE(0x000000, 0x2fffff) AM_READWRITE(snes_r_bank1, snes_w_bank1) /* I/O and ROM (repeats for each bank) */ |
| 302 | 300 | AM_RANGE(0x300000, 0x3fffff) AM_READWRITE(snes_r_bank2, snes_w_bank2) /* I/O and ROM (repeats for each bank) */ |
| r2844 | r2845 | |
|---|---|---|
| 109 | 109 | |
| 110 | 110 | static VIDEO_START(mirage) |
| 111 | 111 | { |
| 112 | deco16_1_video_init(); | |
| 112 | deco16_1_video_init(machine); | |
| 113 | 113 | |
| 114 | 114 | deco16_set_tilemap_bank_callback(0, mirage_bank_callback); |
| 115 | 115 | deco16_set_tilemap_bank_callback(1, mirage_bank_callback); |
| r2844 | r2845 | |
|---|---|---|
| 227 | 227 | static int |
| 228 | 228 | GetLives( running_machine *machine ) |
| 229 | 229 | { |
| 230 | int dsw = input_port_read | |
| 230 | int dsw = input_port_read | |
| 231 | 231 | switch( dsw&0x30 ) |
| 232 | 232 | { |
| 233 | 233 | case 0x10: return 3; |
| r2844 | r2845 | |
| 240 | 240 | |
| 241 | 241 | static WRITE8_HANDLER( coinplus_w ) |
| 242 | 242 | { |
| 243 | int dsw = input_port_read | |
| 243 | int dsw = input_port_read | |
| 244 | 244 | coin_counter_w( 0, data&1 ); |
| 245 | 245 | coin_counter_w( 1, data&2 ); |
| 246 | 246 | if( data&1 ) |
| r2844 | r2845 | |
| 270 | 270 | static void |
| 271 | 271 | OutputProtectionState( running_machine *machine, int i, int type ) |
| 272 | 272 | { |
| 273 | int io = ~input_port_read | |
| 273 | int io = ~input_port_read | |
| 274 | 274 | int dat = 0x00; |
| 275 | 275 | |
| 276 | 276 | switch( mDjBoyState ) |
| r2844 | r2845 | |
| 393 | 393 | displayedCredits = 9; |
| 394 | 394 | } |
| 395 | 395 | ProtectionOut( i++, displayedCredits ); |
| 396 | ProtectionOut( i++, input_port_read | |
| 396 | ProtectionOut( i++, input_port_read | |
| 397 | 397 | OutputProtectionState( machine, i, type ); |
| 398 | 398 | } /* CommonProt */ |
| 399 | 399 | |
| r2844 | r2845 | |
| 408 | 408 | if( prot_mode == ePROT_WAIT_DSW1_WRITEBACK ) |
| 409 | 409 | { |
| 410 | 410 | logerror( "[DSW1_WRITEBACK]\n" ); |
| 411 | ProtectionOut( 0, input_port_read | |
| 411 | ProtectionOut( 0, input_port_read | |
| 412 | 412 | prot_mode = ePROT_WAIT_DSW2_WRITEBACK; |
| 413 | 413 | } |
| 414 | 414 | else if( prot_mode == ePROT_WAIT_DSW2_WRITEBACK ) |
| r2844 | r2845 | |
| 476 | 476 | break; |
| 477 | 477 | |
| 478 | 478 | case 0x05: /* 0x71f4 */ |
| 479 | ProtectionOut( 0,input_port_read | |
| 479 | ProtectionOut( 0,input_port_read | |
| 480 | 480 | ProtectionOut( 1,0 ); // ? |
| 481 | ProtectionOut( 2,input_port_read | |
| 481 | ProtectionOut( 2,input_port_read | |
| 482 | 482 | ProtectionOut( 3,0 ); // ? |
| 483 | 483 | ProtectionOut( 4,0 ); // ? |
| 484 | 484 | CommonProt( machine, 5,0x05 ); |
| r2844 | r2845 | |
| 489 | 489 | break; |
| 490 | 490 | |
| 491 | 491 | case 0x08: /* pc == 0x727a */ |
| 492 | ProtectionOut( 0,input_port_read_indexed(machine, 0) ); /* COIN/START */ | |
| 493 | ProtectionOut( 1,input_port_read_indexed(machine, 1) ); /* JOY1 */ | |
| 494 | ProtectionOut( 2,input_port_read_indexed(machine, 2) ); /* JOY2 */ | |
| 495 | ProtectionOut( 3,input_port_read_indexed(machine, 3) ); /* DSW1 */ | |
| 496 | ProtectionOut( 4,input_port_read_indexed(machine, 4) ); /* DSW2 */ | |
| 492 | ProtectionOut( 0,input_port_read(machine, "IN0") ); /* COIN/START */ | |
| 493 | ProtectionOut( 1,input_port_read(machine, "IN1") ); /* JOY1 */ | |
| 494 | ProtectionOut( 2,input_port_read(machine, "IN2") ); /* JOY2 */ | |
| 495 | ProtectionOut( 3,input_port_read(machine, "DSW1") ); /* DSW1 */ | |
| 496 | ProtectionOut( 4,input_port_read(machine, "DSW2") ); /* DSW2 */ | |
| 497 | 497 | CommonProt( machine, 5, 0x08 ); |
| 498 | 498 | break; |
| 499 | 499 | |
| r2844 | r2845 | |
| 531 | 531 | break; |
| 532 | 532 | |
| 533 | 533 | case 0xff: /* read DSW (pc == 0x714d) */ |
| 534 | ProtectionOut( 0,input_port_read | |
| 534 | ProtectionOut( 0,input_port_read | |
| 535 | 535 | prot_mode = ePROT_WAIT_DSW1_WRITEBACK; |
| 536 | 536 | break; |
| 537 | 537 | |
| r2844 | r2845 | |
| 962 | 962 | ROM_END |
| 963 | 963 | |
| 964 | 964 | static INPUT_PORTS_START( djboy ) |
| 965 | PORT_START | |
| 965 | PORT_START_TAG("IN0") | |
| 966 | 966 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 967 | 967 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) |
| 968 | 968 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) |
| r2844 | r2845 | |
| 972 | 972 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) |
| 973 | 973 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 974 | 974 | |
| 975 | PORT_START | |
| 975 | PORT_START_TAG("IN1") | |
| 976 | 976 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| 977 | 977 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 978 | 978 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| r2844 | r2845 | |
| 982 | 982 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) /* jump */ |
| 983 | 983 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 984 | 984 | |
| 985 | PORT_START | |
| 985 | PORT_START_TAG("IN2") | |
| 986 | 986 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) |
| 987 | 987 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| 988 | 988 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| r2844 | r2845 | |
| 992 | 992 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 993 | 993 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 994 | 994 | |
| 995 | PORT_START | |
| 995 | PORT_START_TAG("DSW1") | |
| 996 | 996 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) |
| 997 | 997 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 998 | 998 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 1016 | 1016 | PORT_DIPSETTING( 0xc0, DEF_STR( 2C_3C ) ) |
| 1017 | 1017 | PORT_DIPSETTING( 0x40, DEF_STR( 1C_2C ) ) |
| 1018 | 1018 | |
| 1019 | PORT_START | |
| 1019 | PORT_START_TAG("DSW2") | |
| 1020 | 1020 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Difficulty ) ) |
| 1021 | 1021 | PORT_DIPSETTING( 0x01, DEF_STR( Easy ) ) |
| 1022 | 1022 | PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) |
| r2844 | r2845 | |
|---|---|---|
| 316 | 316 | #include "seta.h" |
| 317 | 317 | #include "sound/2610intf.h" |
| 318 | 318 | #include "sound/2151intf.h" |
| 319 | #include "includes/cchip.h" | |
| 319 | 320 | |
| 320 | MACHINE_RESET( cchip1 ); | |
| 321 | READ16_HANDLER( cchip1_ctrl_r ); | |
| 322 | READ16_HANDLER( cchip1_ram_r ); | |
| 323 | WRITE16_HANDLER( cchip1_ctrl_w ); | |
| 324 | WRITE16_HANDLER( cchip1_bank_w ); | |
| 325 | WRITE16_HANDLER( cchip1_ram_w ); | |
| 326 | 321 | |
| 327 | 322 | |
| 328 | ||
| 329 | 323 | static READ16_HANDLER( superman_dsw_input_r ) |
| 330 | 324 | { |
| 331 | 325 | switch (offset) |
| r2844 | r2845 | |
|---|---|---|
| 9 | 9 | #include "sound/2151intf.h" |
| 10 | 10 | #include "sound/okim6295.h" |
| 11 | 11 | #include "decocrpt.h" |
| 12 | #include "decoprot.h" | |
| 12 | 13 | #include "deco16ic.h" |
| 13 | 14 | |
| 14 | 15 | VIDEO_UPDATE( dietgo ); |
| 15 | 16 | VIDEO_START( dietgo ); |
| 16 | READ16_HANDLER( dietgo_104_prot_r ); | |
| 17 | WRITE16_HANDLER( dietgo_104_prot_w ); | |
| 18 | 17 | |
| 19 | 18 | |
| 20 | 19 | static ADDRESS_MAP_START( dietgo_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| r2844 | r2845 | |
|---|---|---|
| 168 | 168 | #include "cpu/m6805/m6805.h" |
| 169 | 169 | #include "sound/ay8910.h" |
| 170 | 170 | #include "sound/dac.h" |
| 171 | #include "includes/taitosj.h" | |
| 171 | 172 | |
| 172 | 173 | |
| 173 | MACHINE_START( taitosj ); | |
| 174 | MACHINE_RESET( taitosj ); | |
| 175 | WRITE8_HANDLER( taitosj_bankswitch_w ); | |
| 176 | READ8_HANDLER( taitosj_fake_data_r ); | |
| 177 | READ8_HANDLER( taitosj_fake_status_r ); | |
| 178 | WRITE8_HANDLER( taitosj_fake_data_w ); | |
| 179 | READ8_HANDLER( taitosj_mcu_data_r ); | |
| 180 | READ8_HANDLER( taitosj_mcu_status_r ); | |
| 181 | WRITE8_HANDLER( taitosj_mcu_data_w ); | |
| 182 | READ8_HANDLER( taitosj_68705_portA_r ); | |
| 183 | READ8_HANDLER( taitosj_68705_portB_r ); | |
| 184 | READ8_HANDLER( taitosj_68705_portC_r ); | |
| 185 | WRITE8_HANDLER( taitosj_68705_portA_w ); | |
| 186 | WRITE8_HANDLER( taitosj_68705_portB_w ); | |
| 187 | ||
| 188 | READ8_HANDLER( spacecr_prot_r ); | |
| 189 | WRITE8_HANDLER( alpine_protection_w ); | |
| 190 | WRITE8_HANDLER( alpinea_bankswitch_w ); | |
| 191 | READ8_HANDLER( alpine_port_2_r ); | |
| 192 | ||
| 193 | extern UINT8 *taitosj_videoram_1; | |
| 194 | extern UINT8 *taitosj_videoram_2; | |
| 195 | extern UINT8 *taitosj_videoram_3; | |
| 196 | extern UINT8 *taitosj_spriteram; | |
| 197 | extern UINT8 *taitosj_paletteram; | |
| 198 | extern UINT8 *taitosj_characterram; | |
| 199 | extern UINT8 *taitosj_scroll; | |
| 200 | extern UINT8 *taitosj_colscrolly; | |
| 201 | extern UINT8 *taitosj_gfxpointer; | |
| 202 | extern UINT8 *taitosj_colorbank; | |
| 203 | extern UINT8 *taitosj_video_mode; | |
| 204 | extern UINT8 *taitosj_video_priority; | |
| 205 | extern UINT8 *taitosj_collision_reg; | |
| 206 | extern UINT8 *kikstart_scrollram; | |
| 207 | ||
| 208 | READ8_HANDLER( taitosj_gfxrom_r ); | |
| 209 | WRITE8_HANDLER( taitosj_videoe_w ); | |
| 210 | WRITE8_HANDLER( taitosj_characterram_w ); | |
| 211 | WRITE8_HANDLER( junglhbr_characterram_w ); | |
| 212 | WRITE8_HANDLER( taitosj_collision_reg_clear_w ); | |
| 213 | VIDEO_START( taitosj ); | |
| 214 | VIDEO_UPDATE( taitosj ); | |
| 215 | VIDEO_UPDATE( kikstart ); | |
| 216 | ||
| 217 | ||
| 218 | 174 | static UINT8 sndnmi_disable = 1; |
| 219 | 175 | |
| 220 | 176 | static WRITE8_HANDLER( taitosj_sndnmi_msk_w ) |
| r2844 | r2845 | |
|---|---|---|
| 64 | 64 | { |
| 65 | 65 | UINT8 val = 0; |
| 66 | 66 | |
| 67 | if ((input_port_read | |
| 67 | if ((input_port_read | |
| 68 | 68 | { |
| 69 | 69 | val |= 0x80; |
| 70 | 70 | } |
| 71 | if ((input_port_read | |
| 71 | if ((input_port_read | |
| 72 | 72 | { |
| 73 | 73 | val |= 0x01; |
| 74 | 74 | } |
| r2844 | r2845 | |
| 79 | 79 | |
| 80 | 80 | static READ8_HANDLER( canyon_options_r ) |
| 81 | 81 | { |
| 82 | return (input_port_read | |
| 82 | return (input_port_read | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
| r2844 | r2845 | |
| 129 | 129 | *************************************/ |
| 130 | 130 | |
| 131 | 131 | static INPUT_PORTS_START( canyon ) |
| 132 | PORT_START | |
| 132 | PORT_START_TAG("DSW") /* DSW */ | |
| 133 | 133 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Language ) ) |
| 134 | 134 | PORT_DIPSETTING( 0x00, DEF_STR( English ) ) |
| 135 | 135 | PORT_DIPSETTING( 0x01, DEF_STR( Spanish ) ) |
| r2844 | r2845 | |
| 146 | 146 | PORT_DIPSETTING( 0x40, DEF_STR( 1C_2C )) |
| 147 | 147 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 148 | 148 | |
| 149 | PORT_START | |
| 149 | PORT_START_TAG("IN1") /* IN1 */ | |
| 150 | 150 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 151 | 151 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 152 | 152 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 153 | 153 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 154 | 154 | |
| 155 | PORT_START | |
| 155 | PORT_START_TAG("IN2") /* IN2 */ | |
| 156 | 156 | PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 157 | 157 | PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) |
| 158 | 158 | PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_START1 ) |
| r2844 | r2845 | |
|---|---|---|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | |
| 408 | WRITE16_HANDLER( tilemap_paletteram16_xGGGGGRRRRRBBBBB_word_w ) | |
| 408 | static WRITE16_HANDLER( tilemap_paletteram16_xGGGGGRRRRRBBBBB_word_w ) | |
| 409 | 409 | { |
| 410 | 410 | COMBINE_DATA(&tilemap_paletteram16[offset]); |
| 411 | 411 | set_color_555(offset+0x4000, 5, 10, 0, tilemap_paletteram16[offset]); |
| r2844 | r2845 | |
| 714 | 714 | } |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | void tecmosys_tilemap_copy_to_compose(UINT16 pri) | |
| 717 | static void tecmosys_tilemap_copy_to_compose(UINT16 pri) | |
| 718 | 718 | { |
| 719 | 719 | int y,x; |
| 720 | 720 | UINT16 *srcptr; |
| r2844 | r2845 | |
| 731 | 731 | } |
| 732 | 732 | } |
| 733 | 733 | |
| 734 | void tecmosys_do_final_mix(bitmap_t* bitmap) | |
| 734 | static void tecmosys_do_final_mix(bitmap_t* bitmap) | |
| 735 | 735 | { |
| 736 | 736 | const pen_t *paldata = Machine->pens; |
| 737 | 737 | int y,x; |
| r2844 | r2845 | |
| 1106 | 1106 | device_status = DS_IDLE; |
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | void tecmosys_decramble(void) | |
| 1109 | static void tecmosys_decramble(void) | |
| 1110 | 1110 | { |
| 1111 | 1111 | UINT8 *gfxsrc = memory_region ( REGION_GFX1 ); |
| 1112 | 1112 | size_t srcsize = memory_region_length( REGION_GFX1 ); |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | RDI Video Systems Thayer's Quest laserdisc hardware | |
| 3 | Driver by Andrew Gardner from schematics with help from Daphne Source | |
| 4 | 2 | |
| 5 | Notes: | |
| 6 | How odd. The schematics say there's a COP421L hooked up, but they also make mention of | |
| 7 | a COP404L - A ROMless COP420 with 1k of RAM. I wonder which one is correct? | |
| 3 | TODO: | |
| 8 | 4 | |
| 9 | Todo: | |
| 10 | Fix up my poor interpretation of the hard-to-read schematics. | |
| 11 | Write a real SC-01 (SSI-263) emulator for MAME. | |
| 12 | Convert to tilemaps. | |
| 5 | - LDV1000 mode | |
| 6 | - PR7820 INT/_EXT line | |
| 7 | - coin counter | |
| 8 | - convert SSI-263 to a sound device | |
| 9 | - dump laserdisc | |
| 10 | ||
| 13 | 11 | */ |
| 14 | 12 | |
| 15 | 13 | #include "driver.h" |
| 16 | 14 | #include "render.h" |
| 17 | 15 | #include "machine/laserdsc.h" |
| 18 | 16 | #include "cpu/cop400/cop400.h" |
| 17 | //#include "dlair.lh" | |
| 19 | 18 | |
| 20 | ||
| 19 | ||
| 21 | 20 | |
| 22 | /* | |
| 23 | * Z80 IRQ Status bit | |
| 24 | * ------------------ | |
| 25 | * | |
| 26 | * Bit | Use | |
| 27 | * 76543210-+---------------- | |
| 28 | * -------x | Unused | |
| 29 | * ------x- | Unused | |
| 30 | * -----x-- | SSI-263 Request Data. | |
| 31 | * ----x--- | always high. (? but it's checked at 0x1bb ?) | |
| 32 | * ---x---- | /TIMER INT. | |
| 33 | * --x----- | /DATA RDY INT. | |
| 34 | * -x------ | /CART PRES. | |
| 35 | * x------- | Unused | |
| 36 | */ | |
| 37 | static UINT8 z80_irq_status; | |
| 21 | static laserdisc_info *discinfo; | |
| 22 | static UINT8 laserdisc_type; | |
| 23 | static UINT8 laserdisc_data; | |
| 38 | 24 | |
| 39 | #define Z80_IRQ_STATUS_SET() (z80_irq_status = 0x00) | |
| 40 | #define Z80_IRQ_STATUS_CLEAR() (z80_irq_status = 0xff) | |
| 25 | static int rx_bit; | |
| 26 | static int keylatch; | |
| 41 | 27 | |
| 42 | #define Z80_SSI_REQUEST() ((z80_irq_status & 0x04) >> 2) | |
| 43 | #define Z80_TIMER_INT() ((z80_irq_status & 0x10) >> 4) | |
| 44 | #define Z80_DATA_RDY_INT() ((z80_irq_status & 0x20) >> 5) | |
| 45 | #define Z80_CART_PRES() ((z80_irq_status & 0x40) >> 6) | |
| 28 | static UINT8 cop_data_latch; | |
| 29 | static int cop_data_latch_enable; | |
| 30 | static UINT8 cop_l; | |
| 31 | static UINT8 cop_cmd_latch; | |
| 46 | 32 | |
| 47 | #define SET_Z80_SSI_REQUEST() (z80_irq_status &= ~0x04) | |
| 48 | #define SET_Z80_TIMER_INT() (z80_irq_status &= ~0x10) | |
| 49 | #define SET_Z80_DATA_RDY_INT() (z80_irq_status &= ~0x20) | |
| 50 | #define SET_Z80_CART_PRES() (z80_irq_status &= ~0x40) | |
| 33 | static int timer_int = 1; | |
| 34 | static int data_rdy_int = 1; | |
| 35 | static int ssi_data_request = 1; | |
| 51 | 36 | |
| 52 | #define CLEAR_Z80_SSI_REQUEST() (z80_irq_status |= 0x04) | |
| 53 | #define CLEAR_Z80_TIMER_INT() (z80_irq_status |= 0x10) | |
| 54 | #define CLEAR_Z80_DATA_RDY_INT() (z80_irq_status |= 0x20) | |
| 55 | #define CLEAR_Z80_CART_PRES() (z80_irq_status |= 0x40) | |
| 37 | static int cart_present; | |
| 38 | static int pr7820_enter; | |
| 56 | 39 | |
| 40 | static const UINT8 led_map[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x00 }; | |
| 57 | 41 | |
| 58 | /* Misc variables */ | |
| 59 | static UINT8* ram_ic; | |
| 60 | static laserdisc_info *discinfo; | |
| 42 | /* Video */ | |
| 61 | 43 | |
| 62 | static UINT8 m_ssi_control; | |
| 63 | static UINT8 cop_g_latch; | |
| 64 | static UINT8 cop_l_latch; | |
| 65 | ||
| 66 | ||
| 67 | ||
| 68 | /* VIDEO GOODS */ | |
| 69 | 44 | static VIDEO_UPDATE( thayers ) |
| 70 | 45 | { |
| 71 | 46 | /* display disc information */ |
| r2844 | r2845 | |
| 75 | 50 | return 0; |
| 76 | 51 | } |
| 77 | 52 | |
| 53 | /* Interrupts */ | |
| 78 | 54 | |
| 55 | static void check_interrupt(running_machine *machine) | |
| 56 | { | |
| 57 | if (!timer_int || !data_rdy_int || !ssi_data_request) | |
| 58 | { | |
| 59 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, HOLD_LINE); | |
| 60 | } | |
| 61 | else | |
| 62 | { | |
| 63 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, CLEAR_LINE); | |
| 64 | } | |
| 65 | } | |
| 79 | 66 | |
| 80 | /* MEMORY HANDLERS */ | |
| 81 | /* Z80 R/W */ | |
| 82 | static READ8_HANDLER(z80_irq_status_r) | |
| 67 | static TIMER_CALLBACK( intrq_tick ) | |
| 83 | 68 | { |
| 84 | | |
| 69 | cpunum_set_input_line(machine, | |
| 85 | 70 | } |
| 86 | 71 | |
| 87 | static RE | |
| 72 | static WRITE | |
| 88 | 73 | { |
| 89 | /* Daphne patches. | |
| 90 | if (offset == 0xbe07-0x8000) | |
| 91 | return 0x02; | |
| 74 | // T = 1.1 * R30 * C53 = 1.1 * 750K * 0.01uF = 8.25 ms | |
| 92 | 75 | |
| 93 | if (offset == 0xbe17-0x8000) | |
| 94 | return 0x01; | |
| 76 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, HOLD_LINE); | |
| 77 | ||
| 78 | timer_set(ATTOTIME_IN_USEC(8250), NULL, 0, intrq_tick); | |
| 79 | } | |
| 80 | ||
| 81 | static READ8_HANDLER( irqstate_r ) | |
| 82 | { | |
| 83 | /* | |
| 84 | ||
| 85 | bit description | |
| 86 | ||
| 87 | 0 | |
| 88 | 1 | |
| 89 | 2 SSI263 A/_R | |
| 90 | 3 tied to +5V | |
| 91 | 4 _TIMER INT | |
| 92 | 5 _DATA RDY INT | |
| 93 | 6 _CART PRES | |
| 94 | 7 | |
| 95 | ||
| 95 | 96 | */ |
| 96 | 97 | |
| 97 | return | |
| 98 | return (data_rdy_int << 5) | (timer_int << 4) | 0x08 | (ssi_data_request << 2); | |
| 98 | 99 | } |
| 99 | 100 | |
| 100 | static | |
| 101 | static WRITE8_HANDLER( timer | |
| 101 | 102 | { |
| 102 | if (discinfo == NULL) | |
| 103 | return 0; | |
| 103 | timer_int = 1; | |
| 104 | 104 | |
| 105 | /* Someday handle multiple LD players */ | |
| 106 | return (laserdisc_line_r(discinfo, LASERDISC_LINE_STATUS) == ASSERT_LINE) ? 0 : 1; | |
| 105 | check_interrupt(machine); | |
| 107 | 106 | } |
| 108 | 107 | |
| 109 | static | |
| 108 | static WRITE8_HANDLER( data_rdy_int_ | |
| 110 | 109 | { |
| 111 | if (discinfo == NULL) | |
| 112 | return 0; | |
| 110 | data_rdy_int = 1; | |
| 113 | 111 | |
| 114 | /* Someday handle multiple LD players */ | |
| 115 | return (laserdisc_line_r(discinfo, LASERDISC_LINE_COMMAND) == ASSERT_LINE) ? 0 : 1; | |
| 112 | check_interrupt(machine); | |
| 116 | 113 | } |
| 117 | 114 | |
| 118 | static WRITE8_HANDLER( | |
| 115 | static WRITE8_HANDLER( | |
| 119 | 116 | { |
| 120 | ram_ic[offset] = data; | |
| 117 | /* | |
| 118 | ||
| 119 | bit description | |
| 120 | ||
| 121 | D0 _TIMER INT | |
| 122 | D1 _DATA RDY INT | |
| 123 | D2 | |
| 124 | D3 | |
| 125 | ||
| 126 | */ | |
| 127 | ||
| 128 | if (!BIT(data, 0)) | |
| 129 | { | |
| 130 | timer_int = 0; | |
| 131 | } | |
| 132 | ||
| 133 | if (!BIT(data, 1)) | |
| 134 | { | |
| 135 | data_rdy_int = 0; | |
| 136 | } | |
| 137 | ||
| 138 | check_interrupt(machine); | |
| 121 | 139 | } |
| 122 | 140 | |
| 123 | static WRITE8_HANDLER(data_ready_int_w) | |
| 141 | /* COP Communication */ | |
| 142 | ||
| 143 | static READ8_HANDLER( cop_data_r ) | |
| 124 | 144 | { |
| 125 | CLEAR_Z80_DATA_RDY_INT(); | |
| 126 | /* Hackaroo? */ | |
| 127 | /* cop_l_latch = 0x00; */ | |
| 145 | if (!cop_data_latch_enable) | |
| 146 | { | |
| 147 | return cop_data_latch; | |
| 148 | } | |
| 149 | else | |
| 150 | { | |
| 151 | return cop_l; | |
| 152 | } | |
| 128 | 153 | } |
| 129 | 154 | |
| 130 | static WRITE8_HANDLER( | |
| 155 | static WRITE8_HANDLER( cop | |
| 131 | 156 | { |
| 132 | | |
| 157 | cop | |
| 133 | 158 | } |
| 134 | 159 | |
| 135 | static | |
| 160 | static | |
| 136 | 161 | { |
| 137 | logerror("Writing 0x%x to COP port G\n", data); | |
| 162 | if (!cop_data_latch_enable) | |
| 163 | { | |
| 164 | return cop_data_latch; | |
| 165 | } | |
| 166 | else | |
| 167 | { | |
| 168 | return 0; | |
| 169 | } | |
| 170 | } | |
| 138 | 171 | |
| 139 | /* Bits 5-7 write to COP421 ports G0-G2 */ | |
| 140 | cop_g_latch = (data >> 5) & 0x07; | |
| 172 | static WRITE8_HANDLER( cop_l_w ) | |
| 173 | { | |
| 174 | cop_l = data; | |
| 175 | } | |
| 141 | 176 | |
| 142 | /* Bit 2 goes to BANKSELT */ | |
| 143 | /* bankselect = (data & 0x04) >> 2; */ | |
| 177 | static READ8_HANDLER( cop_g_r ) | |
| 178 | { | |
| 179 | /* | |
| 144 | 180 | |
| 145 | /* Bit 1 goes to CS128x? (illegible schems) */ | |
| 181 | bit description | |
| 182 | ||
| 183 | G0 U16 Q0 | |
| 184 | G1 U16 Q1 | |
| 185 | G2 U16 Q2 | |
| 186 | G3 | |
| 187 | ||
| 188 | */ | |
| 189 | ||
| 190 | return cop_cmd_latch; | |
| 146 | 191 | } |
| 147 | 192 | |
| 148 | #ifdef UNUSED_FUNCTION | |
| 149 | static WRITE8_HANDLER(data_write_cop) | |
| 193 | static WRITE8_HANDLER( control_w ) | |
| 150 | 194 | { |
| 151 | cop_l_latch = data; | |
| 195 | /* | |
| 196 | ||
| 197 | bit description | |
| 198 | ||
| 199 | 0 | |
| 200 | 1 _CS128A | |
| 201 | 2 _BANKSEL1 | |
| 202 | 3 | |
| 203 | 4 | |
| 204 | 5 COP G0 | |
| 205 | 6 COP G1 | |
| 206 | 7 COP G2 | |
| 207 | ||
| 208 | */ | |
| 209 | ||
| 210 | cop_cmd_latch = (data >> 5) & 0x07; | |
| 152 | 211 | } |
| 153 | #endif | |
| 154 | 212 | |
| 155 | static WRITE8_HANDLER( | |
| 213 | static WRITE8_HANDLER( cop | |
| 156 | 214 | { |
| 157 | cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); | |
| 215 | /* | |
| 216 | ||
| 217 | bit description | |
| 218 | ||
| 219 | G0 | |
| 220 | G1 | |
| 221 | G2 | |
| 222 | G3 U17 enable | |
| 223 | ||
| 224 | */ | |
| 225 | ||
| 226 | cop_data_latch_enable = BIT(data, 3); | |
| 158 | 227 | } |
| 159 | 228 | |
| 160 | static WRITE8_HANDLER(sc01_register_w) | |
| 229 | /* Keyboard */ | |
| 230 | ||
| 231 | static READ8_HANDLER(cop_si_r) | |
| 161 | 232 | { |
| 162 | /* (Thank you Daphne) */ | |
| 163 | switch (offset) | |
| 233 | /* keyboard data */ | |
| 234 | ||
| 235 | /* | |
| 236 | ||
| 237 | Serial communications format | |
| 238 | ||
| 239 | 1, 1, 0, 1, Q8, P0, P1, P2, P3, 0 | |
| 240 | ||
| 241 | */ | |
| 242 | ||
| 243 | switch (rx_bit) | |
| 164 | 244 | { |
| 165 | case 0x00: | |
| 166 | if (m_ssi_control) | |
| 167 | { | |
| 168 | logerror("SC-01 control mode : 0x%x\n", data); | |
| 245 | case 0: | |
| 246 | case 1: | |
| 247 | case 3: | |
| 248 | return 1; | |
| 169 | 249 | |
| 170 | switch(data) | |
| 171 | { | |
| 172 | /* Stop requesting phonemes */ | |
| 173 | case 0x00: | |
| 174 | CLEAR_Z80_SSI_REQUEST(); | |
| 175 | break; | |
| 250 | case 4: | |
| 251 | return (keylatch == 9); | |
| 176 | 252 | |
| 177 | /* Start adding phonemes */ | |
| 178 | case 0xc0: | |
| 179 | SET_Z80_SSI_REQUEST(); | |
| 180 | if (!(Z80_SSI_REQUEST())) | |
| 181 | logerror("SETTING IRQ LINE sc01\n"); | |
| 182 | cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); | |
| 183 | break; | |
| 253 | case 5: | |
| 254 | case 6: | |
| 255 | case 7: | |
| 256 | case 8: | |
| 257 | { | |
| 258 | UINT8 data; | |
| 259 | char port[4]; | |
| 184 | 260 | |
| 185 | default: | |
| 186 | logerror("SC-01 control mode invalid code 0x%x\n", data); | |
| 187 | break; | |
| 188 | } | |
| 189 | } | |
| 190 | else | |
| 191 | { | |
| 192 | logerror("SC-01 receiving phonemes 0x%x\n", data & 0x3f); | |
| 193 | } | |
| 194 | break; | |
| 261 | sprintf(port, "R%d", keylatch); | |
| 195 | 262 | |
| 196 | case 0x01: | |
| 197 | logerror("SC-01 inflection changed to 0x%x\n", data); | |
| 198 | break; | |
| 263 | data = BIT(input_port_read(machine, port), rx_bit - 5); | |
| 199 | 264 | |
| 200 | case 0x02: | |
| 201 | logerror("SC-01 speech rate changed to 0x%x\n", data); | |
| 202 | break; | |
| 265 | return data; | |
| 266 | } | |
| 203 | 267 | |
| 204 | case 0x03: | |
| 205 | if (data & 0x80) | |
| 268 | default: | |
| 269 | return 0; | |
| 270 | } | |
| 271 | } | |
| 272 | ||
| 273 | static WRITE8_HANDLER( cop_so_w ) | |
| 274 | { | |
| 275 | /* keyboard clock */ | |
| 276 | ||
| 277 | if (data) | |
| 278 | { | |
| 279 | rx_bit++; | |
| 280 | ||
| 281 | if (rx_bit == 10) | |
| 282 | { | |
| 283 | rx_bit = 0; | |
| 284 | ||
| 285 | keylatch++; | |
| 286 | ||
| 287 | if (keylatch == 10) | |
| 206 | 288 | { |
| 207 | m_ssi_control = 1; | |
| 208 | logerror("SC-01 now in control mode.\n"); | |
| 289 | keylatch = 0; | |
| 209 | 290 | } |
| 210 | else if (data & 0x70) | |
| 211 | { | |
| 212 | m_ssi_control = 0; | |
| 213 | logerror("SC-01 control mode cleared.\n"); | |
| 214 | } | |
| 215 | else | |
| 216 | { | |
| 217 | logerror("SC-01 amplitude manipulated 0x%x.\n", data); | |
| 218 | } | |
| 219 | break; | |
| 220 | ||
| 221 | case 0x04: | |
| 222 | logerror("SC-01 filter frequency changed to 0x%x.\n", data); | |
| 223 | break; | |
| 291 | } | |
| 224 | 292 | } |
| 225 | 293 | } |
| 226 | 294 | |
| 295 | /* I/O Board */ | |
| 227 | 296 | |
| 228 | /* COP R/W */ | |
| 229 | /* All 8 l pins are hooked up here */ | |
| 230 | static READ8_HANDLER(cop_l_read) | |
| 297 | static WRITE8_HANDLER( control2_w ) | |
| 231 | 298 | { |
| 232 | logerror("COP - Reading from L @ (0x%x)\n", activecpu_get_pc()); | |
| 233 | return cop_l_latch; | |
| 299 | /* | |
| 300 | ||
| 301 | bit description | |
| 302 | ||
| 303 | 0 | |
| 304 | 1 _RESOI (?) | |
| 305 | 2 _ENCARTDET | |
| 306 | 3 | |
| 307 | 4 | |
| 308 | 5 | |
| 309 | 6 | |
| 310 | 7 | |
| 311 | ||
| 312 | */ | |
| 313 | ||
| 314 | if (!BIT(data, 2) & cart_present) | |
| 315 | { | |
| 316 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, HOLD_LINE); | |
| 317 | } | |
| 234 | 318 | } |
| 235 | 319 | |
| 236 | /* Pins g0, g1, g2, and g3 are all hooked up */ | |
| 237 | static READ8_HANDLER(cop_g_read) | |
| 320 | static READ8_HANDLER( dsw_b_r ) | |
| 238 | 321 | { |
| 239 | logerror("COP - Reading from G @ (0x%x)\n", activecpu_get_pc()); | |
| 240 | return cop_g_latch; | |
| 322 | return (input_port_read(machine, "COIN") & 0xf0) | (input_port_read(machine, "DSWB") & 0x0f); | |
| 241 | 323 | } |
| 242 | 324 | |
| 243 | static | |
| 325 | static | |
| 244 | 326 | { |
| 245 | logerror("COP - WRITING TO L 0x%x @ (0x%x)\n", data, activecpu_get_pc()); | |
| 246 | cop_l_latch = data; | |
| 327 | return laserdisc_data_r(discinfo); | |
| 247 | 328 | } |
| 248 | 329 | |
| 249 | static WRITE8_HANDLER(c | |
| 330 | static WRITE8_HANDLER( laserdsc | |
| 250 | 331 | { |
| 251 | logerror("COP - WRITING TO G 0x%x @ (0x%x)\n", data, activecpu_get_pc()); | |
| 252 | ||
| 253 | /* Bit 3 goes to an enable pin on the data latch? */ | |
| 254 | /* Bits 0-2 seem to go into the wrong side of a logic IC? */ | |
| 332 | laserdisc_data = data; | |
| 255 | 333 | } |
| 256 | 334 | |
| 257 | /* Schematics say pins d0 and d1 are the only two that are hooked up */ | |
| 258 | static WRITE8_HANDLER(cop_d_write) | |
| 335 | static WRITE8_HANDLER( laserdsc_control_w ) | |
| 259 | 336 | { |
| 260 | | |
| 337 | /* | |
| 261 | 338 | |
| 262 | ||
| 339 | ||
| 263 | 340 | |
| 264 | /* Pin d0 - TIMER INT */ | |
| 265 | if (!(data & 0x01)) | |
| 341 | 0 | |
| 342 | 1 | |
| 343 | 2 | |
| 344 | 3 | |
| 345 | 4 coin counter | |
| 346 | 5 U16 output enable | |
| 347 | 6 ENTER if switch B5 closed | |
| 348 | 7 INT/_EXT | |
| 349 | ||
| 350 | */ | |
| 351 | ||
| 352 | coin_counter_w(0, BIT(data, 4)); | |
| 353 | ||
| 354 | if (BIT(data, 5)) | |
| 266 | 355 | { |
| 267 | SET_Z80_TIMER_INT(); | |
| 268 | irq_flag = 1; | |
| 269 | logerror("THE COP IS TRIPPING THE TIMER INTERRUPT\n"); | |
| 356 | laserdisc_data_w(discinfo, laserdisc_data); | |
| 270 | 357 | } |
| 271 | else | |
| 272 | { | |
| 273 | CLEAR_Z80_TIMER_INT(); | |
| 274 | } | |
| 275 | 358 | |
| 276 | /* Pin d1 - DATA READY INT */ | |
| 277 | if (!(data & 0x02)) | |
| 359 | switch (laserdisc_type) | |
| 278 | 360 | { |
| 279 | SET_Z80_DATA_RDY_INT(); | |
| 280 | irq_flag = 1; | |
| 281 | logerror("THE COP IS TRIPPING THE DATA READY INTERRUPT\n"); | |
| 282 | } | |
| 283 | else | |
| 284 | { | |
| 285 | CLEAR_Z80_DATA_RDY_INT(); | |
| 286 | } | |
| 361 | case LASERDISC_TYPE_PR7820: | |
| 362 | pr7820_enter = BIT(data, 6) ? CLEAR_LINE : ASSERT_LINE; | |
| 287 | 363 | |
| 288 | /* Assert the Z80's interrupt line if necessary */ | |
| 289 | if (irq_flag) | |
| 290 | { | |
| 291 | cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); | |
| 364 | laserdisc_line_w(discinfo, LASERDISC_LINE_ENTER, pr7820_enter); | |
| 365 | ||
| 366 | // BIT(data, 7) is INT/_EXT, but there is no such input line in laserdsc.h | |
| 367 | break; | |
| 368 | ||
| 369 | case LASERDISC_TYPE_LDV1000: | |
| 370 | laserdisc_line_w(discinfo, LASERDISC_LINE_ENTER, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE); | |
| 371 | break; | |
| 292 | 372 | } |
| 293 | 373 | } |
| 294 | 374 | |
| 295 | static int kb_bit; | |
| 375 | static WRITE8_HANDLER( den1_w ) | |
| 376 | { | |
| 377 | /* | |
| 296 | 378 | |
| 297 | static READ8_HANDLER(cop_si_r) | |
| 379 | bit description | |
| 380 | ||
| 381 | 0 DD0 | |
| 382 | 1 DD1 | |
| 383 | 2 DD2 | |
| 384 | 3 DD3 | |
| 385 | 4 DA0 | |
| 386 | 5 DA1 | |
| 387 | 6 DA2 | |
| 388 | 7 DA3 | |
| 389 | ||
| 390 | */ | |
| 391 | ||
| 392 | output_set_digit_value(data >> 4, led_map[data & 0x0f]); | |
| 393 | } | |
| 394 | ||
| 395 | static WRITE8_HANDLER( den2_w ) | |
| 298 | 396 | { |
| 299 | UINT8 data; | |
| 300 | char port[4]; | |
| 301 | int row = kb_bit / 8; | |
| 302 | int col = kb_bit % 8; | |
| 397 | /* | |
| 303 | 398 | |
| 304 | ||
| 399 | bi | |
| 305 | 400 | |
| 306 | switch (col) | |
| 401 | 0 DD0 | |
| 402 | 1 DD1 | |
| 403 | 2 DD2 | |
| 404 | 3 DD3 | |
| 405 | 4 DA0 | |
| 406 | 5 DA1 | |
| 407 | 6 DA2 | |
| 408 | 7 DA3 | |
| 409 | ||
| 410 | */ | |
| 411 | ||
| 412 | output_set_digit_value(8 + (data >> 4), led_map[data & 0x0f]); | |
| 413 | } | |
| 414 | ||
| 415 | /* SSI-263 */ | |
| 416 | ||
| 417 | /* | |
| 418 | ||
| 419 | The following information is from the SSI-263A data sheet. | |
| 420 | ||
| 421 | Thayer's Quest uses an SSI-263, so this might be inaccurate, but it works for now | |
| 422 | ||
| 423 | */ | |
| 424 | ||
| 425 | #define SSI263_CLOCK (XTAL_4MHz/2) | |
| 426 | ||
| 427 | static const char SSI263_PHONEMES[0x40][5] = | |
| 428 | { | |
| 429 | "PA", "E", "E1", "Y", "YI", "AY", "IE", "I", "A", "AI", "EH", "EH1", "AE", "AE1", "AH", "AH1", "W", "O", "OU", "OO", "IU", "IU1", "U", "U1", "UH", "UH1", "UH2", "UH3", "ER", "R", "R1", "R2", | |
| 430 | "L", "L1", "LF", "W", "B", "D", "KV", "P", "T", "K", "HV", "HVC", "HF", "HFC", "HN", "Z", "S", "J", "SCH", "V", "F", "THV", "TH", "M", "N", "NG", ":A", ":OH", ":U", ":UH", "E2", "LB" | |
| 431 | }; | |
| 432 | ||
| 433 | static struct SSI263 | |
| 434 | { | |
| 435 | UINT8 dr; | |
| 436 | UINT8 p; | |
| 437 | UINT16 i; | |
| 438 | UINT8 r; | |
| 439 | UINT8 t; | |
| 440 | UINT8 c; | |
| 441 | UINT8 a; | |
| 442 | UINT8 f; | |
| 443 | UINT8 mode; | |
| 444 | } ssi263; | |
| 445 | ||
| 446 | static TIMER_CALLBACK( ssi263_phoneme_tick ) | |
| 447 | { | |
| 448 | ssi_data_request = 0; | |
| 449 | check_interrupt(machine); | |
| 450 | } | |
| 451 | ||
| 452 | static WRITE8_HANDLER( ssi263_register_w ) | |
| 453 | { | |
| 454 | switch (offset) | |
| 307 | 455 | { |
| 308 | 456 | case 0: |
| 457 | { | |
| 458 | int frame_time = ((4096 * (16 - ssi263.r)) / 2); // us, /2 should actually be /SSI263_CLOCK, but this way we get microseconds directly | |
| 459 | int phoneme_time = frame_time * (4 - ssi263.dr); // us | |
| 460 | ||
| 461 | // duration/phoneme register | |
| 462 | ssi263.dr = (data >> 5) & 0x03; | |
| 463 | ssi263.p = data & 0x3f; | |
| 464 | ||
| 465 | ssi_data_request = 1; | |
| 466 | check_interrupt(machine); | |
| 467 | ||
| 468 | switch (ssi263.mode) | |
| 469 | { | |
| 470 | case 0: | |
| 471 | case 1: | |
| 472 | // phoneme timing response | |
| 473 | timer_set(ATTOTIME_IN_USEC(phoneme_time), NULL, 0, ssi263_phoneme_tick); | |
| 474 | break; | |
| 475 | case 2: | |
| 476 | // frame timing response | |
| 477 | timer_set(ATTOTIME_IN_USEC(frame_time), NULL, 0, ssi263_phoneme_tick); | |
| 478 | break; | |
| 479 | case 3: | |
| 480 | // disable A/_R output | |
| 481 | break; | |
| 482 | } | |
| 483 | ||
| 484 | //logerror("SSI263 Phoneme Duration: %u\n", ssi263.dr); | |
| 485 | //logerror("SSI263 Phoneme: %02x %s\n", ssi263.p, SSI263_PHONEMES[ssi263.p]); | |
| 486 | } | |
| 487 | break; | |
| 488 | ||
| 309 | 489 | case 1: |
| 490 | // inflection register | |
| 491 | ssi263.i = (data << 3) | (ssi263.i & 0x403); | |
| 492 | ||
| 493 | //logerror("SSI263 Inflection: %u\n", ssi263.i); | |
| 494 | break; | |
| 495 | ||
| 310 | 496 | case 2: |
| 497 | // rate/inflection register | |
| 498 | ssi263.i = (BIT(data, 4) << 11) | (ssi263.i & 0x7f8) | (data & 0x07); | |
| 499 | ssi263.r = data >> 4; | |
| 500 | ||
| 501 | //logerror("SSI263 Inflection: %u\n", ssi263.i); | |
| 502 | //logerror("SSI263 Rate: %u\n", ssi263.r); | |
| 503 | break; | |
| 504 | ||
| 311 | 505 | case 3: |
| 312 | data = input_port_read(machine, port); | |
| 313 | return BIT(data, col); | |
| 506 | // control/articulation/amplitude register | |
| 507 | if (ssi263.c && !BIT(data, 7)) | |
| 508 | { | |
| 509 | ssi263.mode = ssi263.dr; | |
| 314 | 510 | |
| 511 | switch (ssi263.mode) | |
| 512 | { | |
| 513 | case 0: | |
| 514 | //logerror("SSI263 Phoneme Timing Response, Transitioned Inflection\n"); | |
| 515 | break; | |
| 516 | ||
| 517 | case 1: | |
| 518 | //logerror("SSI263 Phoneme Timing Response, Immediate Inflection\n"); | |
| 519 | break; | |
| 520 | ||
| 521 | case 2: | |
| 522 | // activate A/_R | |
| 523 | //logerror("SSI263 Frame Timing Response, Immediate Inflection\n"); | |
| 524 | break; | |
| 525 | ||
| 526 | case 3: | |
| 527 | // disable A/_R output | |
| 528 | //logerror("SSI263 A/R Output Disabled\n"); | |
| 529 | break; | |
| 530 | } | |
| 531 | } | |
| 532 | ||
| 533 | ssi263.c = BIT(data, 7); | |
| 534 | ssi263.t = (data >> 4) & 0x07; | |
| 535 | ssi263.a = data & 0x0f; | |
| 536 | ||
| 537 | //logerror("SSI263 Control: %u\n", ssi263.c); | |
| 538 | //logerror("SSI263 Articulation: %u\n", ssi263.t); | |
| 539 | //logerror("SSI263 Amplitude: %u\n", ssi263.a); | |
| 540 | break; | |
| 541 | ||
| 315 | 542 | case 4: |
| 316 | return (row == 9); | |
| 317 | ||
| 318 | default: | |
| 319 | return 1; | |
| 543 | case 5: | |
| 544 | case 6: | |
| 545 | case 7: | |
| 546 | // filter frequency register | |
| 547 | ssi263.f = data; | |
| 548 | //logerror("SSI263 Filter Frequency: %u\n", ssi263.f); | |
| 549 | break; | |
| 320 | 550 | } |
| 321 | 551 | } |
| 322 | 552 | |
| 323 | static | |
| 553 | static | |
| 324 | 554 | { |
| 325 | if (data) | |
| 326 | { | |
| 327 | kb_bit++; | |
| 555 | // D7 becomes an output, as the inverted state of A/_R. The register address bits are ignored. | |
| 328 | 556 | |
| 329 | if (kb_bit == 80) | |
| 330 | { | |
| 331 | kb_bit = 0; | |
| 332 | } | |
| 333 | } | |
| 557 | return !ssi_data_request << 7; | |
| 334 | 558 | } |
| 335 | 559 | |
| 336 | /* PROGRAM MAPS */ | |
| 337 | static ADDRESS_MAP_START( mainmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 560 | /* Memory Maps */ | |
| 561 | ||
| 562 | static ADDRESS_MAP_START( thayers_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 338 | 563 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 339 | AM_RANGE(0x8000, 0xbfff) AM_READWRITE(ram_ic_read,ram_ic_write) AM_BASE(&ram_ic) /* Not quite sure how big the RAM IC is. */ | |
| 340 | AM_RANGE(0xc000, 0xdfff) AM_ROM /* This is what Daphne says - we'll soon see. */ | |
| 564 | AM_RANGE(0x8000, 0xbfff) AM_RAM | |
| 565 | AM_RANGE(0xc000, 0xdfff) AM_ROM | |
| 341 | 566 | ADDRESS_MAP_END |
| 342 | 567 | |
| 343 | static ADDRESS_MAP_START( copmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 344 | AM_RANGE(0x000, 0x3ff) AM_ROM /* The schematics seem to claim this is a 2716 (0x800 bytes) - is the dump too small? */ | |
| 568 | static ADDRESS_MAP_START( thayers_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 569 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 570 | AM_RANGE(0x00, 0x07) AM_READWRITE(ssi263_register_r, ssi263_register_w) | |
| 571 | AM_RANGE(0x20, 0x20) AM_WRITE(control_w) | |
| 572 | AM_RANGE(0x40, 0x40) AM_READWRITE(irqstate_r, control2_w) | |
| 573 | AM_RANGE(0x80, 0x80) AM_READWRITE(cop_data_r, cop_data_w) | |
| 574 | AM_RANGE(0xa0, 0xa0) AM_WRITE(timer_int_ack_w) | |
| 575 | AM_RANGE(0xc0, 0xc0) AM_WRITE(data_rdy_int_ack_w) | |
| 576 | AM_RANGE(0xf0, 0xf0) AM_READ(laserdsc_data_r) | |
| 577 | AM_RANGE(0xf1, 0xf1) AM_READ(dsw_b_r) | |
| 578 | AM_RANGE(0xf2, 0xf2) AM_READ_PORT("DSWA") | |
| 579 | AM_RANGE(0xf3, 0xf3) AM_WRITE(intrq_w) | |
| 580 | AM_RANGE(0xf4, 0xf4) AM_WRITE(laserdsc_data_w) | |
| 581 | AM_RANGE(0xf5, 0xf5) AM_WRITE(laserdsc_control_w) | |
| 582 | AM_RANGE(0xf6, 0xf6) AM_WRITE(den1_w) | |
| 583 | AM_RANGE(0xf7, 0xf7) AM_WRITE(den2_w) | |
| 345 | 584 | ADDRESS_MAP_END |
| 346 | 585 | |
| 347 | ||
| 348 | /* IO MAPS */ | |
| 349 | static ADDRESS_MAP_START( mainio, ADDRESS_SPACE_IO, 8 ) | |
| 350 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 351 | AM_RANGE(0x00,0x04) AM_WRITE(sc01_register_w) | |
| 352 | AM_RANGE(0x20,0x20) AM_WRITE(write_cop) | |
| 353 | AM_RANGE(0x40,0x40) AM_READ(z80_irq_status_r) | |
| 354 | /* AM_RANGE(0x80,0x80) AM_WRITE(data_write_cop) */ | |
| 355 | AM_RANGE(0xa0,0xa0) AM_WRITE(timer_int_w) | |
| 356 | AM_RANGE(0xc0,0xc0) AM_WRITE(data_ready_int_w) | |
| 357 | ||
| 358 | /* AM_RANGE(0xf0,0xf0) */ /* Laserdisc data read */ | |
| 359 | AM_RANGE(0xf1,0xf1) AM_READ_PORT("DSWB") /* 4 dips, 2 coins, Laserdisc 'ready' and 'enter' pins */ | |
| 360 | AM_RANGE(0xf2,0xf2) AM_READ_PORT("DSWA") /* 8 dips */ | |
| 361 | AM_RANGE(0xf3,0xf3) AM_WRITE(intrq_w) /* goes to /INTRQ */ | |
| 362 | /* AM_RANGE(0xf4,0xf4) */ /* Laserdisc data write */ | |
| 363 | /* AM_RANGE(0xf5,0xf5) */ /* Coin counter, 0xf4 write enable, DIP-controlled (SWB-6) LDV1000 'enter' line, and LDV1000 INT/!EXT line */ | |
| 364 | /* AM_RANGE(0xf6,0xf6) */ /* Scoreboard DEN1 */ | |
| 365 | /* AM_RANGE(0xf7,0xf7) */ /* Scoreboard DEN2 */ | |
| 586 | static ADDRESS_MAP_START( thayers_cop_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 587 | AM_RANGE(0x000, 0x3ff) AM_ROM | |
| 366 | 588 | ADDRESS_MAP_END |
| 367 | 589 | |
| 368 | static ADDRESS_MAP_START( copio, ADDRESS_SPACE_IO, 8 ) | |
| 369 | AM_RANGE(COP400_PORT_L, COP400_PORT_L) AM_READWRITE(cop_l_read,cop_l_write) | |
| 370 | AM_RANGE(COP400_PORT_G, COP400_PORT_G) AM_READWRITE(cop_g_read,cop_g_write) | |
| 371 | AM_RANGE(COP400_PORT_D, COP400_PORT_D) AM_WRITE(cop_d_write) | |
| 372 | AM_RANGE(COP400_PORT_SK, COP400_PORT_SK) AM_WRITENOP | |
| 373 | AM_RANGE(COP400_PORT_SIO,COP400_PORT_SIO) AM_READ(cop_si_r) AM_WRITE(cop_so_w) | |
| 590 | static ADDRESS_MAP_START( thayers_cop_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 591 | AM_RANGE(COP400_PORT_L, COP400_PORT_L) AM_READWRITE(cop_l_r, cop_l_w) | |
| 592 | AM_RANGE(COP400_PORT_G, COP400_PORT_G) AM_READWRITE(cop_g_r, cop_g_w) | |
| 593 | AM_RANGE(COP400_PORT_D, COP400_PORT_D) AM_WRITE(cop_d_w) | |
| 594 | AM_RANGE(COP400_PORT_SK, COP400_PORT_SK) AM_WRITENOP | |
| 595 | AM_RANGE(COP400_PORT_SIO, COP400_PORT_SIO) AM_READ(cop_si_r) AM_WRITE(cop_so_w) | |
| 374 | 596 | ADDRESS_MAP_END |
| 375 | 597 | |
| 376 | /* PORTS */ | |
| 598 | /* Input Ports */ | |
| 599 | ||
| 600 | static CUSTOM_INPUT( laserdisc_enter_r ) | |
| 601 | { | |
| 602 | if (discinfo == NULL) | |
| 603 | return 0; | |
| 604 | ||
| 605 | switch (laserdisc_type) | |
| 606 | { | |
| 607 | case LASERDISC_TYPE_PR7820: | |
| 608 | return pr7820_enter; | |
| 609 | ||
| 610 | case LASERDISC_TYPE_LDV1000: | |
| 611 | return (laserdisc_line_r(discinfo, LASERDISC_LINE_STATUS) == ASSERT_LINE) ? 0 : 1; | |
| 612 | } | |
| 613 | ||
| 614 | return 0; | |
| 615 | } | |
| 616 | ||
| 617 | static CUSTOM_INPUT( laserdisc_ready_r ) | |
| 618 | { | |
| 619 | if (discinfo == NULL) | |
| 620 | return 0; | |
| 621 | ||
| 622 | switch (laserdisc_type) | |
| 623 | { | |
| 624 | case LASERDISC_TYPE_PR7820: | |
| 625 | return (laserdisc_line_r(discinfo, LASERDISC_LINE_READY) == ASSERT_LINE) ? 0 : 1; | |
| 626 | ||
| 627 | case LASERDISC_TYPE_LDV1000: | |
| 628 | return (laserdisc_line_r(discinfo, LASERDISC_LINE_COMMAND) == ASSERT_LINE) ? 0 : 1; | |
| 629 | } | |
| 630 | ||
| 631 | return 0; | |
| 632 | } | |
| 633 | ||
| 377 | 634 | static INPUT_PORTS_START( thayers ) |
| 378 | 635 | PORT_START_TAG("DSWA") |
| 379 | 636 | PORT_DIPNAME( 0x07, 0x07, "Time Per Coin" ) PORT_DIPLOCATION( "A:3,2,1" ) |
| r2844 | r2845 | |
| 400 | 657 | PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "A:8" ) |
| 401 | 658 | |
| 402 | 659 | PORT_START_TAG("DSWB") |
| 403 | PORT_DIPNAME( 0x01, 0x01, "Gameplay Mode" ) PORT_DIPLOCATION( "B:1" ) | |
| 404 | PORT_DIPSETTING( 0x01, "Normal Play" ) | |
| 405 | PORT_DIPSETTING( 0x00, "Self-Diagnostics Mode" ) | |
| 660 | PORT_SERVICE_DIPLOC( 0x01, 0x01, "B:1" ) | |
| 406 | 661 | PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "B:2" ) |
| 407 | 662 | PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "B:3" ) |
| 408 | PORT_DIPNAME( 0x08, 0x08, "LD Player" ) PORT_DIPLOCATION( "B:4" ) | |
| 409 | PORT_DIPSETTING( 0x08, "LDV-1000" ) | |
| 663 | PORT_DIPNAME( 0x18, 0x00, "LD Player" ) PORT_DIPLOCATION( "B:5,4" ) | |
| 664 | PORT_DIPSETTING( 0x18, "LDV-1000" ) | |
| 410 | 665 | PORT_DIPSETTING( 0x00, "PR-7820" ) |
| 411 | /* DIP SWITCH 5 isn't read here, but it also controls LD player selection - I wonder how to add it properly? */ | |
| 666 | PORT_DIPUNUSED_DIPLOC( 0xe0, IP_ACTIVE_LOW, "B:8,7,6" ) | |
| 667 | ||
| 668 | PORT_START_TAG("COIN") | |
| 412 | 669 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 413 | 670 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 414 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(laserdisc_command_r, 0 ) /* Enter pin on LD player */ | |
| 415 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(laserdisc_status_r, 0 ) /* Ready pin on LD player */ | |
| 671 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(laserdisc_enter_r, 0 ) | |
| 672 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(laserdisc_ready_r, 0 ) | |
| 416 | 673 | |
| 417 | /* "Scan codes" heisted from Daphne - need to be tested! */ | |
| 418 | /* | |
| 419 | PORT_START_TAG("THAYERS_ACTIONS") | |
| 420 | PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( DEF_STR( No ) ) PORT_CODE( KEYCODE_DEL_PAD ) | |
| 421 | PORT_BIT( 0x31, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( DEF_STR( Yes ) ) PORT_CODE( KEYCODE_0_PAD ) | |
| 422 | PORT_BIT( 0x32, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Items" ) PORT_CODE( KEYCODE_1_PAD ) | |
| 423 | PORT_BIT( 0x33, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Drop Item" ) PORT_CODE( KEYCODE_2_PAD ) | |
| 424 | PORT_BIT( 0x34, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Give Score" ) PORT_CODE( KEYCODE_3_PAD ) | |
| 425 | PORT_BIT( 0x35, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Replay" ) PORT_CODE( KEYCODE_4_PAD ) | |
| 426 | PORT_BIT( 0x36, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Combine Action" ) PORT_CODE( KEYCODE_6_PAD ) | |
| 427 | PORT_BIT( 0x37, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Save Game" ) PORT_CODE( KEYCODE_7_PAD ) | |
| 428 | PORT_BIT( 0x38, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Update" ) PORT_CODE( KEYCODE_8_PAD ) | |
| 429 | PORT_BIT( 0x39, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Hint" ) PORT_CODE( KEYCODE_9_PAD ) | |
| 430 | ||
| 431 | PORT_START_TAG("THAYERS_LETTERS") | |
| 432 | PORT_BIT( 0x41, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "A" ) PORT_CODE( KEYCODE_A ) | |
| 433 | PORT_BIT( 0x42, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "B - Silver Wheat" ) PORT_CODE( KEYCODE_B ) | |
| 434 | PORT_BIT( 0x43, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "C - Spell of Seeing" ) PORT_CODE( KEYCODE_C ) | |
| 435 | PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "D - Great Circlet" ) PORT_CODE( KEYCODE_D ) | |
| 436 | PORT_BIT( 0x45, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "E - Black Mace" ) PORT_CODE( KEYCODE_E ) | |
| 437 | PORT_BIT( 0x46, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "F - Hunting Horn" ) PORT_CODE( KEYCODE_F ) | |
| 438 | PORT_BIT( 0x47, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "G - Long Bow" ) PORT_CODE( KEYCODE_G ) | |
| 439 | PORT_BIT( 0x48, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "H - Medallion" ) PORT_CODE( KEYCODE_H ) | |
| 440 | PORT_BIT( 0x49, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "I - Crown" ) PORT_CODE( KEYCODE_I ) | |
| 441 | PORT_BIT( 0x4a, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "J - Onyx Seal" ) PORT_CODE( KEYCODE_J ) | |
| 442 | PORT_BIT( 0x4b, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "K - Orb of Quoid" ) PORT_CODE( KEYCODE_K ) | |
| 443 | PORT_BIT( 0x4c, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "L" ) PORT_CODE( KEYCODE_L ) | |
| 444 | PORT_BIT( 0x4d, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "M - Spell of Understanding" ) PORT_CODE( KEYCODE_M ) | |
| 445 | PORT_BIT( 0x4e, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "N - Staff" ) PORT_CODE( KEYCODE_N ) | |
| 446 | PORT_BIT( 0x4f, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "O - Crystal" ) PORT_CODE( KEYCODE_O ) | |
| 447 | PORT_BIT( 0x50, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "P" ) PORT_CODE( KEYCODE_P ) | |
| 448 | PORT_BIT( 0x51, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Q" ) PORT_CODE( KEYCODE_Q ) | |
| 449 | PORT_BIT( 0x52, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "R - Blood Sword" ) PORT_CODE( KEYCODE_R ) | |
| 450 | PORT_BIT( 0x53, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "S - Dagger" ) PORT_CODE( KEYCODE_S ) | |
| 451 | PORT_BIT( 0x54, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "T - Chalice" ) PORT_CODE( KEYCODE_T ) | |
| 452 | PORT_BIT( 0x55, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "U - Cold Fire" ) PORT_CODE( KEYCODE_U ) | |
| 453 | PORT_BIT( 0x56, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "V - Shield" ) PORT_CODE( KEYCODE_V ) | |
| 454 | PORT_BIT( 0x57, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "W - Amulet" ) PORT_CODE( KEYCODE_W ) | |
| 455 | PORT_BIT( 0x58, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "X - Scepter" ) PORT_CODE( KEYCODE_X ) | |
| 456 | PORT_BIT( 0x59, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Y - Coins" ) PORT_CODE( KEYCODE_Y ) | |
| 457 | PORT_BIT( 0x5a, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Z - Spell of Release" ) PORT_CODE( KEYCODE_Z ) | |
| 458 | ||
| 459 | PORT_START_TAG("THAYERS_NUMBERS") | |
| 460 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "1 - Clear" ) PORT_CODE( KEYCODE_LCONTROL ) | |
| 461 | PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "2" ) PORT_CODE( KEYCODE_RCONTROL ) | |
| 462 | PORT_BIT( 0x82, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "3 - Enter" ) PORT_CODE( KEYCODE_ENTER ) | |
| 463 | PORT_BIT( 0x83, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "4 - Space" ) PORT_CODE( KEYCODE_SPACE ) | |
| 464 | */ | |
| 465 | 674 | PORT_START_TAG("R0") |
| 466 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 467 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 468 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 469 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 675 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "2" ) PORT_CODE( KEYCODE_F2 ) | |
| 676 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "1 - Clear" ) PORT_CODE( KEYCODE_BACKSPACE ) | |
| 677 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Q" ) PORT_CODE( KEYCODE_Q ) | |
| 678 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( DEF_STR( Yes ) ) PORT_CODE( KEYCODE_0_PAD ) | |
| 470 | 679 | |
| 471 | 680 | PORT_START_TAG("R1") |
| 472 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 473 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 474 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 475 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 681 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Z - Spell of Release" ) PORT_CODE( KEYCODE_Z ) | |
| 682 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "A" ) PORT_CODE( KEYCODE_A ) | |
| 683 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "W - Amulet" ) PORT_CODE( KEYCODE_W ) | |
| 684 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Items" ) PORT_CODE( KEYCODE_1_PAD ) | |
| 476 | 685 | |
| 477 | 686 | PORT_START_TAG("R2") |
| 478 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 479 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 480 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 481 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 687 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "X - Scepter" ) PORT_CODE( KEYCODE_X ) | |
| 688 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "S - Dagger" ) PORT_CODE( KEYCODE_S ) | |
| 689 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "E - Black Mace" ) PORT_CODE( KEYCODE_E ) | |
| 690 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Drop Item" ) PORT_CODE( KEYCODE_2_PAD ) | |
| 482 | 691 | |
| 483 | 692 | PORT_START_TAG("R3") |
| 484 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 485 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 486 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 487 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 693 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "C - Spell of Seeing" ) PORT_CODE( KEYCODE_C ) | |
| 694 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "D - Great Circlet" ) PORT_CODE( KEYCODE_D ) | |
| 695 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "R - Blood Sword" ) PORT_CODE( KEYCODE_R ) | |
| 696 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Give Score" ) PORT_CODE( KEYCODE_3_PAD ) | |
| 488 | 697 | |
| 489 | 698 | PORT_START_TAG("R4") |
| 490 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 491 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 492 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 493 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 699 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "V - Shield" ) PORT_CODE( KEYCODE_V ) | |
| 700 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "F - Hunting Horn" ) PORT_CODE( KEYCODE_F ) | |
| 701 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "T - Chalice" ) PORT_CODE( KEYCODE_T ) | |
| 702 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Replay" ) PORT_CODE( KEYCODE_4_PAD ) | |
| 494 | 703 | |
| 495 | 704 | PORT_START_TAG("R5") |
| 496 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 497 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 498 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 499 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 705 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "B - Silver Wheat" ) PORT_CODE( KEYCODE_B ) | |
| 706 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "G - Long Bow" ) PORT_CODE( KEYCODE_G ) | |
| 707 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Y - Coins" ) PORT_CODE( KEYCODE_Y ) | |
| 708 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Combine Action" ) PORT_CODE( KEYCODE_6_PAD ) | |
| 500 | 709 | |
| 501 | 710 | PORT_START_TAG("R6") |
| 502 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 503 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 504 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 505 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 711 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "N - Staff" ) PORT_CODE( KEYCODE_N ) | |
| 712 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "H - Medallion" ) PORT_CODE( KEYCODE_H ) | |
| 713 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "U - Cold Fire" ) PORT_CODE( KEYCODE_U ) | |
| 714 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Save Game" ) PORT_CODE( KEYCODE_7_PAD ) | |
| 506 | 715 | |
| 507 | 716 | PORT_START_TAG("R7") |
| 508 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 509 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 510 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 511 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 717 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "M - Spell of Understanding" ) PORT_CODE( KEYCODE_M ) | |
| 718 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "J - Onyx Seal" ) PORT_CODE( KEYCODE_J ) | |
| 719 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "I - Crown" ) PORT_CODE( KEYCODE_I ) | |
| 720 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Update" ) PORT_CODE( KEYCODE_8_PAD ) | |
| 512 | 721 | |
| 513 | 722 | PORT_START_TAG("R8") |
| 514 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 515 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 516 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 517 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 723 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "3 - Enter" ) PORT_CODE( KEYCODE_ENTER ) | |
| 724 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "K - Orb of Quoid" ) PORT_CODE( KEYCODE_K ) | |
| 725 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "O - Crystal" ) PORT_CODE( KEYCODE_O ) | |
| 726 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Hint" ) PORT_CODE( KEYCODE_9_PAD ) | |
| 518 | 727 | |
| 519 | 728 | PORT_START_TAG("R9") |
| 520 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 521 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 522 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 523 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) | |
| 729 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "4 - Space" ) PORT_CODE( KEYCODE_SPACE ) | |
| 730 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "L" ) PORT_CODE( KEYCODE_L ) | |
| 731 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "P" ) PORT_CODE( KEYCODE_P ) | |
| 732 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( DEF_STR( No ) ) PORT_CODE( KEYCODE_0_PAD ) | |
| 524 | 733 | INPUT_PORTS_END |
| 525 | 734 | |
| 735 | /* Machine Initialization */ | |
| 736 | ||
| 526 | 737 | static MACHINE_START( thayers ) |
| 527 | 738 | { |
| 528 | discinfo = laserdisc_init(LASERDISC_TYPE_LDV1000, get_disk_handle(0), 0); | |
| 739 | laserdisc_type = LASERDISC_TYPE_LDV1000; | |
| 740 | ||
| 741 | discinfo = laserdisc_init(laserdisc_type, get_disk_handle(0), 0); | |
| 742 | ||
| 743 | memset(&ssi263, 0, sizeof(ssi263)); | |
| 529 | 744 | } |
| 530 | 745 | |
| 746 | static MACHINE_RESET( thayers ) | |
| 747 | { | |
| 748 | laserdisc_type = (input_port_read(machine, "DSWB") & 0x18) ? LASERDISC_TYPE_LDV1000 : LASERDISC_TYPE_PR7820; | |
| 749 | ||
| 750 | laserdisc_reset(discinfo, laserdisc_type); | |
| 751 | } | |
| 752 | ||
| 531 | 753 | static INTERRUPT_GEN( vblank_callback_thayers ) |
| 532 | 754 | { |
| 533 | 755 | laserdisc_vsync(discinfo); |
| 534 | 756 | } |
| 535 | 757 | |
| 758 | /* COP400 Interface */ | |
| 759 | ||
| 536 | 760 | static COP400_INTERFACE( thayers_cop_intf ) |
| 537 | 761 | { |
| 538 | 762 | COP400_CKI_DIVISOR_16, // ??? |
| r2844 | r2845 | |
| 540 | 764 | COP400_MICROBUS_DISABLED |
| 541 | 765 | }; |
| 542 | 766 | |
| 543 | /* DRIVER */ | |
| 767 | /* Machine Driver */ | |
| 768 | ||
| 544 | 769 | static MACHINE_DRIVER_START( thayers ) |
| 545 | /* main cpu */ | |
| 546 | MDRV_CPU_ADD(Z80, SCHEMATIC_CLOCK) | |
| 547 | MDRV_CPU_PROGRAM_MAP(mainmem,0) | |
| 548 | MDRV_CPU_IO_MAP(mainio,0) | |
| 770 | /* basic machine hardware */ | |
| 771 | MDRV_CPU_ADD(Z80, XTAL_4MHz) | |
| 772 | MDRV_CPU_PROGRAM_MAP(thayers_map, 0) | |
| 773 | MDRV_CPU_IO_MAP(thayers_io_map, 0) | |
| 549 | 774 | MDRV_CPU_VBLANK_INT("main", vblank_callback_thayers) |
| 550 | 775 | |
| 551 | 776 | MDRV_MACHINE_START(thayers) |
| 777 | MDRV_MACHINE_RESET(thayers) | |
| 552 | 778 | |
| 553 | /* io device cpu */ | |
| 554 | MDRV_CPU_ADD(COP420, SCHEMATIC_CLOCK/2/8) /* Can't read the schematics, but this is what daphne says */ | |
| 555 | MDRV_CPU_PROGRAM_MAP(copmem,0) | |
| 556 | MDRV_CPU_IO_MAP(copio,0) | |
| 779 | MDRV_CPU_ADD(COP421, XTAL_4MHz/2) // COP421L-PCA/N | |
| 780 | MDRV_CPU_PROGRAM_MAP(thayers_cop_map, 0) | |
| 781 | MDRV_CPU_IO_MAP(thayers_cop_io_map, 0) | |
| 557 | 782 | MDRV_CPU_CONFIG(thayers_cop_intf) |
| 558 | 783 | |
| 559 | /* video */ | |
| 560 | ||
| 784 | /* video hardware */ | |
| 561 | 785 | MDRV_SCREEN_ADD("main", RASTER) |
| 562 | 786 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 563 | 787 | MDRV_SCREEN_REFRESH_RATE(60) |
| 564 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 788 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // inaccurate | |
| 565 | 789 | MDRV_SCREEN_SIZE(32*10, 32*8) |
| 566 | 790 | MDRV_SCREEN_VISIBLE_AREA(0*10, 32*10-1, 0*8, 32*8-1) |
| 567 | 791 | |
| 568 | 792 | MDRV_PALETTE_LENGTH(256) |
| 569 | 793 | MDRV_VIDEO_UPDATE(thayers) |
| 570 | 794 | |
| 571 | /* sound */ | |
| 795 | /* sound hardware */ | |
| 796 | // SSI 263 @ 2MHz | |
| 572 | 797 | MACHINE_DRIVER_END |
| 573 | 798 | |
| 799 | /* ROMs */ | |
| 574 | 800 | |
| 575 | 801 | ROM_START( thayers ) |
| 576 | 802 | ROM_REGION( 0xe000, REGION_CPU1, 0 ) |
| r2844 | r2845 | |
| 579 | 805 | |
| 580 | 806 | ROM_REGION( 0x400, REGION_CPU2, 0 ) |
| 581 | 807 | ROM_LOAD( "tq_cop.bin", 0x000, 0x400, CRC(6748e6b3) SHA1(5d7d1ecb57c1501ef6a2d9691eecc9970586606b) ) |
| 808 | ||
| 809 | DISK_REGION( REGION_DISKS ) | |
| 810 | DISK_IMAGE_READONLY( "thayers", 0, NO_DUMP ) | |
| 582 | 811 | ROM_END |
| 583 | 812 | |
| 584 | 813 | ROM_START( thayersa ) |
| r2844 | r2845 | |
| 588 | 817 | |
| 589 | 818 | ROM_REGION( 0x400, REGION_CPU2, 0 ) |
| 590 | 819 | ROM_LOAD( "tq_cop.bin", 0x000, 0x400, CRC(6748e6b3) SHA1(5d7d1ecb57c1501ef6a2d9691eecc9970586606b) ) |
| 820 | ||
| 821 | DISK_REGION( REGION_DISKS ) | |
| 822 | DISK_IMAGE_READONLY( "thayers", 0, NO_DUMP ) | |
| 591 | 823 | ROM_END |
| 592 | 824 | |
| 593 | static DRIVER_INIT( thayers ) | |
| 594 | { | |
| 595 | Z80_IRQ_STATUS_CLEAR(); | |
| 596 | m_ssi_control = 0; | |
| 825 | /* Game Drivers */ | |
| 597 | 826 | |
| 598 | cop_g_latch = 0xff; | |
| 599 | } | |
| 600 | ||
| 601 | /* YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME FLAGS) */ | |
| 602 | GAME( 1983, thayers, 0, thayers, thayers, thayers, ROT0, "RDI Video Systems", "Thayer's Quest", GAME_NOT_WORKING|GAME_NO_SOUND) | |
| 603 | GAME( 1983, thayersa, thayers, thayers, thayers, thayers, ROT0, "RDI Video Systems", "Thayer's Quest (Alternate Set)", GAME_NOT_WORKING|GAME_NO_SOUND) | |
| 827 | /* YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME FLAGS LAYOUT */ | |
| 828 | GAMEL( 1984, thayers, 0, thayers, thayers, 0, ROT0, "RDI Video Systems", "Thayer's Quest", GAME_NOT_WORKING | GAME_NO_SOUND, layout_dlair) | |
| 829 | GAMEL( 1984, thayersa, thayers, thayers, thayers, 0, ROT0, "RDI Video Systems", "Thayer's Quest (Alternate Set)", GAME_NOT_WORKING | GAME_NO_SOUND, layout_dlair) |
| r2844 | r2845 | |
|---|---|---|
| 137 | 137 | switch (offset<<1) |
| 138 | 138 | { |
| 139 | 139 | case 0: /* Player 1 & Player 2 joysticks & fire buttons */ |
| 140 | return (input_port_read | |
| 140 | return (input_port_read | |
| 141 | 141 | |
| 142 | 142 | case 2: /* Player 3 & Player 4 joysticks & fire buttons */ |
| 143 | return (input_port_read | |
| 143 | return (input_port_read | |
| 144 | 144 | |
| 145 | 145 | case 4: /* Dip 1 (stored at 0x3f8035) */ |
| 146 | return input_port_read | |
| 146 | return input_port_read | |
| 147 | 147 | |
| 148 | 148 | case 6: /* Dip 2 (stored at 0x3f8034) */ |
| 149 | return input_port_read | |
| 149 | return input_port_read | |
| 150 | 150 | |
| 151 | 151 | case 8: /* VBL, Credits */ |
| 152 | return input_port_read | |
| 152 | return input_port_read | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | return 0xffff; |
| r2844 | r2845 | |
| 164 | 164 | |
| 165 | 165 | static READ16_HANDLER( dassault_sub_control_r ) |
| 166 | 166 | { |
| 167 | return input_port_read | |
| 167 | return input_port_read | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | static WRITE16_HANDLER( dassault_sound_w ) |
| r2844 | r2845 | |
| 300 | 300 | |
| 301 | 301 | |
| 302 | 302 | static INPUT_PORTS_START( thndzone ) |
| 303 | PORT_START | |
| 303 | PORT_START_TAG("P1") | |
| 304 | 304 | DASSAULT_PLAYER_INPUT( 1, IPT_START1 ) |
| 305 | 305 | |
| 306 | PORT_START | |
| 306 | PORT_START_TAG("P2") | |
| 307 | 307 | DASSAULT_PLAYER_INPUT( 2, IPT_START2 ) |
| 308 | 308 | |
| 309 | PORT_START | |
| 309 | PORT_START_TAG("IN0") | |
| 310 | 310 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 311 | 311 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 312 | 312 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) // Adds 4 credits/coins ! |
| r2844 | r2845 | |
| 316 | 316 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 317 | 317 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 318 | 318 | |
| 319 | PORT_START /* Dip switch bank 1 */ | |
| 319 | PORT_START_TAG("DSW1") /* Dip switch bank 1 */ | |
| 320 | 320 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) |
| 321 | 321 | PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) |
| 322 | 322 | PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) |
| r2844 | r2845 | |
| 342 | 342 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 343 | 343 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 344 | 344 | |
| 345 | PORT_START /* Dip switch bank 2 */ | |
| 345 | PORT_START_TAG("DSW2") /* Dip switch bank 2 */ | |
| 346 | 346 | PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW ) |
| 347 | 347 | PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW ) |
| 348 | 348 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) |
| r2844 | r2845 | |
| 359 | 359 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 360 | 360 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 361 | 361 | |
| 362 | PORT_START /* Cpu 1 vblank */ | |
| 362 | PORT_START_TAG("VBLANK1") /* Cpu 1 vblank */ | |
| 363 | 363 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 364 | 364 | |
| 365 | PORT_START | |
| 365 | PORT_START_TAG("P3") | |
| 366 | 366 | DASSAULT_PLAYER_INPUT( 3, IPT_COIN3 ) |
| 367 | 367 | |
| 368 | PORT_START | |
| 368 | PORT_START_TAG("P4") | |
| 369 | 369 | DASSAULT_PLAYER_INPUT( 4, IPT_COIN4 ) |
| 370 | 370 | INPUT_PORTS_END |
| 371 | 371 | |
| 372 | 372 | static INPUT_PORTS_START( dassault ) |
| 373 | PORT_START | |
| 373 | PORT_START_TAG("P1") | |
| 374 | 374 | DASSAULT_PLAYER_INPUT( 1, IPT_START1 ) |
| 375 | 375 | |
| 376 | PORT_START | |
| 376 | PORT_START_TAG("P2") | |
| 377 | 377 | DASSAULT_PLAYER_INPUT( 2, IPT_START2 ) |
| 378 | 378 | |
| 379 | PORT_START | |
| 379 | PORT_START_TAG("IN0") | |
| 380 | 380 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 381 | 381 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 382 | 382 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 383 | 383 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 384 | 384 | |
| 385 | PORT_START /* Dip switch bank 1 */ | |
| 385 | PORT_START_TAG("DSW1") /* Dip switch bank 1 */ | |
| 386 | 386 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) |
| 387 | 387 | PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) |
| 388 | 388 | PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) |
| r2844 | r2845 | |
| 408 | 408 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 409 | 409 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 410 | 410 | |
| 411 | PORT_START /* Dip switch bank 2 */ | |
| 411 | PORT_START_TAG("DSW2") /* Dip switch bank 2 */ | |
| 412 | 412 | PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW ) |
| 413 | 413 | PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW ) |
| 414 | 414 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) |
| r2844 | r2845 | |
| 426 | 426 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 427 | 427 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 428 | 428 | |
| 429 | PORT_START /* Cpu 1 vblank */ | |
| 429 | PORT_START_TAG("VBLANK1") /* Cpu 1 vblank */ | |
| 430 | 430 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 431 | 431 | |
| 432 | PORT_START | |
| 432 | PORT_START_TAG("P3") | |
| 433 | 433 | DASSAULT_PLAYER_INPUT( 3, IPT_COIN3 ) |
| 434 | 434 | |
| 435 | PORT_START | |
| 435 | PORT_START_TAG("P4") | |
| 436 | 436 | DASSAULT_PLAYER_INPUT( 4, IPT_COIN4 ) |
| 437 | 437 | INPUT_PORTS_END |
| 438 | 438 | |
| 439 | 439 | static INPUT_PORTS_START( dassaul4 ) |
| 440 | PORT_START | |
| 440 | PORT_START_TAG("P1") | |
| 441 | 441 | DASSAULT_PLAYER_INPUT( 1, IPT_UNUSED ) |
| 442 | 442 | |
| 443 | PORT_START | |
| 443 | PORT_START_TAG("P2") | |
| 444 | 444 | DASSAULT_PLAYER_INPUT( 2, IPT_UNUSED ) |
| 445 | 445 | |
| 446 | PORT_START | |
| 446 | PORT_START_TAG("IN0") | |
| 447 | 447 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 448 | 448 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 449 | 449 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 450 | 450 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 451 | 451 | |
| 452 | PORT_START /* Dip switch bank 1 */ | |
| 452 | PORT_START_TAG("DSW1") /* Dip switch bank 1 */ | |
| 453 | 453 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) |
| 454 | 454 | PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) |
| 455 | 455 | PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) |
| r2844 | r2845 | |
| 469 | 469 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 470 | 470 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 471 | 471 | |
| 472 | PORT_START /* Dip switch bank 2 */ | |
| 472 | PORT_START_TAG("DSW2") /* Dip switch bank 2 */ | |
| 473 | 473 | PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW ) |
| 474 | 474 | PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW ) |
| 475 | 475 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) |
| r2844 | r2845 | |
| 484 | 484 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 485 | 485 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 486 | 486 | |
| 487 | PORT_START /* Cpu 1 vblank */ | |
| 487 | PORT_START_TAG("VBLANK1") /* Cpu 1 vblank */ | |
| 488 | 488 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 489 | 489 | |
| 490 | PORT_START | |
| 490 | PORT_START_TAG("P3") | |
| 491 | 491 | DASSAULT_PLAYER_INPUT( 3, IPT_COIN3 ) |
| 492 | 492 | |
| 493 | PORT_START | |
| 493 | PORT_START_TAG("P4") | |
| 494 | 494 | DASSAULT_PLAYER_INPUT( 4, IPT_COIN4 ) |
| 495 | 495 | INPUT_PORTS_END |
| 496 | 496 |
| r2844 | r2845 | |
|---|---|---|
| 11 | 11 | #include "driver.h" |
| 12 | 12 | |
| 13 | 13 | #include "cpu/z80/z80.h" |
| 14 | #include "includes/galaxian.h" | |
| 14 | 15 | #include "galaxold.h" |
| 15 | 16 | |
| 16 | 17 | |
| 17 | PALETTE_INIT( dambustr ); | |
| 18 | WRITE8_HANDLER( dambustr_bg_split_line_w ); | |
| 19 | WRITE8_HANDLER( dambustr_bg_color_w ); | |
| 20 | VIDEO_START( dambustr ); | |
| 21 | VIDEO_UPDATE( dambustr ); | |
| 22 | ||
| 23 | 18 | static int noise_data = 0; |
| 24 | 19 | |
| 25 | 20 |
| r2844 | r2845 | |
|---|---|---|
| 72 | 72 | |
| 73 | 73 | static READ16_HANDLER( inputs_r ) |
| 74 | 74 | { |
| 75 | int temp = input_port_read_indexed(machine, 2 + (offset & 1)); | |
| 75 | static const char *iptnames[] = { "IN0", "IN1" }; | |
| 76 | int temp = input_port_read(machine, iptnames[offset & 1]); | |
| 77 | ||
| 76 | 78 | if (atarigen_cpu_to_sound_ready) temp ^= 0x0040; |
| 77 | 79 | if (atarigen_get_hblank(machine->primary_screen)) temp ^= 0x0010; |
| 78 | 80 | return temp; |
| r2844 | r2845 | |
| 118 | 120 | *************************************/ |
| 119 | 121 | |
| 120 | 122 | static INPUT_PORTS_START( blstroid ) |
| 121 | PORT_START | |
| 123 | PORT_START_TAG("DIAL0") /* ff9800 */ | |
| 122 | 124 | PORT_BIT( 0x00ff, 0, IPT_DIAL ) PORT_SENSITIVITY(60) PORT_KEYDELTA(10) PORT_PLAYER(1) |
| 123 | 125 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 124 | 126 | |
| 125 | PORT_START | |
| 127 | PORT_START_TAG("DIAL1") /* ff9804 */ | |
| 126 | 128 | PORT_BIT( 0x00ff, 0, IPT_DIAL ) PORT_SENSITIVITY(60) PORT_KEYDELTA(10) PORT_PLAYER(2) |
| 127 | 129 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 128 | 130 | |
| 129 | PORT_START /* ff9c00 */ | |
| 131 | PORT_START_TAG("IN0") /* ff9c00 */ | |
| 130 | 132 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 131 | 133 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 132 | 134 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) |
| r2844 | r2845 | |
| 137 | 139 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) |
| 138 | 140 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 139 | 141 | |
| 140 | PORT_START /* ff9c02 */ | |
| 142 | PORT_START_TAG("IN1") /* ff9c02 */ | |
| 141 | 143 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 142 | 144 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 143 | 145 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| r2844 | r2845 | |
|---|---|---|
| 76 | 76 | static WRITE16_HANDLER( blmbycar_pot_wheel_reset_w ) |
| 77 | 77 | { |
| 78 | 78 | if (ACCESSING_BITS_0_7) |
| 79 | pot_wheel = ~input_port_read | |
| 79 | pot_wheel = ~input_port_read | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | static WRITE16_HANDLER( blmbycar_pot_wheel_shift_w ) |
| r2844 | r2845 | |
| 101 | 101 | |
| 102 | 102 | static READ16_HANDLER( blmbycar_opt_wheel_r ) |
| 103 | 103 | { |
| 104 | return (~input_port_read | |
| 104 | return (~input_port_read | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| r2844 | r2845 | |
| 211 | 211 | |
| 212 | 212 | static INPUT_PORTS_START( blmbycar ) |
| 213 | 213 | |
| 214 | PORT_START // IN0 - $700000.w | |
| 214 | PORT_START_TAG("DSW") // IN0 - $700000.w | |
| 215 | 215 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:8,7") |
| 216 | 216 | PORT_DIPSETTING( 0x0002, DEF_STR( Easy ) ) |
| 217 | 217 | PORT_DIPSETTING( 0x0003, DEF_STR( Normal ) ) |
| r2844 | r2845 | |
| 258 | 258 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 259 | 259 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 260 | 260 | |
| 261 | PORT_START // IN1 - $700002.w | |
| 261 | PORT_START_TAG("IN0") // IN1 - $700002.w | |
| 262 | 262 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 263 | 263 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 264 | 264 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) |
| r2844 | r2845 | |
| 277 | 277 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START1 ) |
| 278 | 278 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) |
| 279 | 279 | |
| 280 | PORT_START // IN2 - $700004.w | |
| 280 | PORT_START_TAG("IN1") // IN2 - $700004.w | |
| 281 | 281 | PORT_BIT ( 0x00ff, 0x0080, IPT_AD_STICK_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(1) |
| 282 | 282 | |
| 283 | PORT_START // IN3 - $700006.w | |
| 283 | PORT_START_TAG("IN2") // IN3 - $700006.w | |
| 284 | 284 | PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 285 | 285 | |
| 286 | 286 | INPUT_PORTS_END |
| 287 | 287 | |
| 288 | 288 | |
| 289 | 289 | static INPUT_PORTS_START( watrball ) |
| 290 | PORT_START /* dips */ | |
| 290 | PORT_START_TAG("DSW") /* dips */ | |
| 291 | 291 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:8,7") /* Affects timer */ |
| 292 | 292 | PORT_DIPSETTING( 0x0002, DEF_STR( Easy ) ) /* 180 Seconds */ |
| 293 | 293 | PORT_DIPSETTING( 0x0003, DEF_STR( Normal ) ) /* 150 Seconds */ |
| r2844 | r2845 | |
| 325 | 325 | PORT_DIPUNUSED_DIPLOC( 0x4000, 0x4000, "SW2:2" ) |
| 326 | 326 | PORT_DIPUNUSED_DIPLOC( 0x8000, 0x8000, "SW2:1" ) |
| 327 | 327 | |
| 328 | PORT_START /* 16bit */ | |
| 328 | PORT_START_TAG("IN0") /* 16bit */ | |
| 329 | 329 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 330 | 330 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 331 | 331 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) |
| r2844 | r2845 | |
|---|---|---|
| 32 | 32 | #include "deprecat.h" |
| 33 | 33 | #include "cpu/m6805/m6805.h" |
| 34 | 34 | #include "sound/sn76496.h" |
| 35 | #include "includes/retofinv.h" | |
| 35 | 36 | |
| 36 | /* in machine */ | |
| 37 | READ8_HANDLER( retofinv_68705_portA_r ); | |
| 38 | WRITE8_HANDLER( retofinv_68705_portA_w ); | |
| 39 | WRITE8_HANDLER( retofinv_68705_ddrA_w ); | |
| 40 | READ8_HANDLER( retofinv_68705_portB_r ); | |
| 41 | WRITE8_HANDLER( retofinv_68705_portB_w ); | |
| 42 | WRITE8_HANDLER( retofinv_68705_ddrB_w ); | |
| 43 | READ8_HANDLER( retofinv_68705_portC_r ); | |
| 44 | WRITE8_HANDLER( retofinv_68705_portC_w ); | |
| 45 | WRITE8_HANDLER( retofinv_68705_ddrC_w ); | |
| 46 | WRITE8_HANDLER( retofinv_mcu_w ); | |
| 47 | READ8_HANDLER( retofinv_mcu_r ); | |
| 48 | READ8_HANDLER( retofinv_mcu_status_r ); | |
| 49 | ||
| 50 | /* in video */ | |
| 51 | VIDEO_START( retofinv ); | |
| 52 | PALETTE_INIT( retofinv ); | |
| 53 | VIDEO_UPDATE( retofinv ); | |
| 54 | READ8_HANDLER( retofinv_bg_videoram_r ); | |
| 55 | READ8_HANDLER( retofinv_fg_videoram_r ); | |
| 56 | WRITE8_HANDLER( retofinv_bg_videoram_w ); | |
| 57 | WRITE8_HANDLER( retofinv_fg_videoram_w ); | |
| 58 | WRITE8_HANDLER( retofinv_gfx_ctrl_w ); | |
| 59 | ||
| 60 | extern UINT8 *retofinv_fg_videoram; | |
| 61 | extern UINT8 *retofinv_bg_videoram; | |
| 62 | extern UINT8 *retofinv_sharedram; | |
| 63 | ||
| 64 | 37 | static UINT8 cpu2_m6000=0; |
| 65 | 38 | |
| 66 | 39 |
| r2844 | r2845 | |
|---|---|---|
| 603 | 603 | UINT8 segae_vdp_ctrl_r ( UINT8 chip ); |
| 604 | 604 | UINT8 segae_vdp_data_r ( UINT8 chip ); |
| 605 | 605 | void segae_vdp_ctrl_w ( UINT8 chip, UINT8 data ); |
| 606 | void segae_vdp_data_w ( UINT8 chip, UINT8 data ); | |
| 606 | void segae_vdp_data_w ( running_machine *machine, UINT8 chip, UINT8 data ); | |
| 607 | 607 | |
| 608 | 608 | static READ8_HANDLER (megaplay_bios_port_be_bf_r) |
| 609 | 609 | { |
| r2844 | r2845 | |
| 624 | 624 | switch (offset) |
| 625 | 625 | { |
| 626 | 626 | case 0: /* port 0xbe, VDP 1 DATA Write */ |
| 627 | segae_vdp_data_w(0, data); break; | |
| 627 | segae_vdp_data_w(machine, 0, data); break; | |
| 628 | 628 | case 1: /* port 0xbf, VDP 1 CTRL Write */ |
| 629 | 629 | segae_vdp_ctrl_w(0, data); break; |
| 630 | 630 | } |
| r2844 | r2845 | |
| 649 | 649 | VIDEO_START( megaplay_normal ); |
| 650 | 650 | VIDEO_UPDATE( megaplay_normal ); |
| 651 | 651 | |
| 652 | /* give us access to the megadriv start and update functions so that we can call them */ | |
| 653 | VIDEO_START( megadriv ); | |
| 654 | VIDEO_UPDATE( megadriv ); | |
| 655 | ||
| 656 | 652 | static VIDEO_START(megplay) |
| 657 | 653 | { |
| 658 | 654 | //printf("megplay vs\n"); |
| r2844 | r2845 | |
|---|---|---|
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | static UINT8 *sprites_gfx; |
| 76 | int sprites_gfx_size; | |
| 76 | static int sprites_gfx_size; | |
| 77 | 77 | |
| 78 | 78 | // Eeach 16 bit word in the sprites gfx roms contains three 5 bit pens: x-22222-11111-00000. |
| 79 | 79 | // This routine expands each word into three bytes. |
| r2844 | r2845 | |
|---|---|---|
| 319 | 319 | |
| 320 | 320 | static MACHINE_RESET( konamigv ) |
| 321 | 321 | { |
| 322 | psx_machine_init(); | |
| 322 | psx_machine_init(machine); | |
| 323 | 323 | |
| 324 | 324 | /* also hook up CDDA audio to the CD-ROM drive */ |
| 325 | 325 | cdda_set_cdrom(0, am53cf96_get_device(SCSI_ID_4)); |
| r2844 | r2845 | |
|---|---|---|
| 80 | 80 | |
| 81 | 81 | static READ8_HANDLER( switch_input_r ) |
| 82 | 82 | { |
| 83 | return input_port_read_indexed(machine, port_select); | |
| 83 | static const char *portnames[] = { "IN0", "IN1", "P1", "P2", "DSW", "UNUSED0", "UNUSED1" }; | |
| 84 | ||
| 85 | return input_port_read(machine, portnames[port_select]); | |
| 84 | 86 | } |
| 85 | 87 | |
| 86 | 88 | |
| 87 | 89 | static READ8_HANDLER( analog_input_r ) |
| 88 | 90 | { |
| 89 | return ((input_port_read | |
| 91 | return ((input_port_read | |
| 90 | 92 | } |
| 91 | 93 | |
| 92 | 94 | |
| r2844 | r2845 | |
| 269 | 271 | *************************************/ |
| 270 | 272 | |
| 271 | 273 | static INPUT_PORTS_START( crgolf ) |
| 272 | PORT_START /* CREDIT */ | |
| 274 | PORT_START_TAG("IN0") /* CREDIT */ | |
| 273 | 275 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 274 | 276 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 ) |
| 275 | 277 | PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 276 | 278 | |
| 277 | PORT_START /* SELECT */ | |
| 279 | PORT_START_TAG("IN1") /* SELECT */ | |
| 278 | 280 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 279 | 281 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 ) |
| 280 | 282 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START2 ) |
| r2844 | r2845 | |
| 282 | 284 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START4 ) |
| 283 | 285 | PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 284 | 286 | |
| 285 | PORT_START /* PLAY1 */ | |
| 287 | PORT_START_TAG("P1") /* PLAY1 */ | |
| 286 | 288 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) /* club select */ |
| 287 | 289 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) /* backward address */ |
| 288 | 290 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) /* forward address */ |
| r2844 | r2845 | |
| 292 | 294 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) /* direction right */ |
| 293 | 295 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) /* shot switch */ |
| 294 | 296 | |
| 295 | PORT_START /* PLAY2 */ | |
| 297 | PORT_START_TAG("P2") /* PLAY2 */ | |
| 296 | 298 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_COCKTAIL /* club select */ |
| 297 | 299 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL /* backward address */ |
| 298 | 300 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_COCKTAIL /* forward address */ |
| r2844 | r2845 | |
| 302 | 304 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL /* direction right */ |
| 303 | 305 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL /* shot switch */ |
| 304 | 306 | |
| 305 | PORT_START /* DIPSW */ | |
| 307 | PORT_START_TAG("DSW") /* DIPSW */ | |
| 306 | 308 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Difficulty )) |
| 307 | 309 | PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) |
| 308 | 310 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| r2844 | r2845 | |
| 323 | 325 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 324 | 326 | PORT_SERVICE( 0x80, IP_ACTIVE_HIGH ) |
| 325 | 327 | |
| 326 | PORT_START | |
| 328 | PORT_START_TAG("UNUSED0") | |
| 327 | 329 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 328 | 330 | |
| 329 | PORT_START | |
| 331 | PORT_START_TAG("UNUSED1") | |
| 330 | 332 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 331 | 333 | |
| 332 | PORT_START | |
| 334 | PORT_START_TAG("STICK0") | |
| 333 | 335 | PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(16) PORT_REVERSE |
| 334 | 336 | |
| 335 | PORT_START | |
| 337 | PORT_START_TAG("STICK1") | |
| 336 | 338 | PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(16) PORT_REVERSE PORT_COCKTAIL |
| 337 | 339 | INPUT_PORTS_END |
| 338 | 340 |
| r2844 | r2845 | |
|---|---|---|
| 300 | 300 | |
| 301 | 301 | /******************************************************************/ |
| 302 | 302 | |
| 303 | static UINT32 *workram; | |
| 304 | static MACHINE_START( zr107 ) | |
| 305 | { | |
| 306 | /* set conservative DRC options */ | |
| 307 | cpunum_set_info_int(0, CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS); | |
| 308 | ||
| 309 | /* configure fast RAM regions for DRC */ | |
| 310 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_SELECT, 0); | |
| 311 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_START, 0x00000000); | |
| 312 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_END, 0x000fffff); | |
| 313 | cpunum_set_info_ptr(0, CPUINFO_PTR_PPC_FASTRAM_BASE, workram); | |
| 314 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_READONLY, 0); | |
| 315 | } | |
| 316 | ||
| 303 | 317 | static ADDRESS_MAP_START( zr107_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 304 | AM_RANGE(0x00000000, 0x000fffff) AM_MIRROR(0x80000000) AM_RAM /* Work RAM */ | |
| 305 | AM_RANGE(0x74000000, 0x74003fff) AM_MIRROR(0x80000000) AM_READWRITE(K056832_ram_long_r, K056832_ram_long_w) | |
| 306 | AM_RANGE(0x74020000, 0x7402003f) AM_MIRROR(0x80000000) AM_READWRITE(K056832_long_r, K056832_long_w) | |
| 307 | AM_RANGE(0x74060000, 0x7406003f) AM_MIRROR(0x80000000) AM_READWRITE(ccu_r, ccu_w) | |
| 308 | AM_RANGE(0x74080000, 0x74081fff) AM_MIRROR(0x80000000) AM_RAM_WRITE(paletteram32_w) AM_BASE(&paletteram32) | |
| 309 | AM_RANGE(0x740a0000, 0x740a3fff) AM_MIRROR(0x80000000) AM_READ(K056832_rom_long_r) | |
| 310 | AM_RANGE(0x78000000, 0x7800ffff) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc) /* 21N 21K 23N 23K */ | |
| 311 | AM_RANGE(0x78010000, 0x7801ffff) AM_MIRROR(0x80000000) AM_WRITE(cgboard_dsp_shared_w_ppc) | |
| 312 | AM_RANGE(0x78040000, 0x7804000f) AM_MIRROR(0x80000000) AM_READWRITE(K001006_0_r, K001006_0_w) | |
| 313 | AM_RANGE(0x780c0000, 0x780c0007) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc) | |
| 314 | AM_RANGE(0x7e000000, 0x7e003fff) AM_MIRROR(0x80000000) AM_READWRITE(sysreg_r, sysreg_w) | |
| 315 | AM_RANGE(0x7e008000, 0x7e009fff) AM_MIRROR(0x80000000) AM_READWRITE8(K056230_r, K056230_w, 0xffffffff) /* LANC registers */ | |
| 316 | AM_RANGE(0x7e00a000, 0x7e00bfff) AM_MIRROR(0x80000000) AM_READWRITE(lanc_ram_r, lanc_ram_w) /* LANC Buffer RAM (27E) */ | |
| 317 | AM_RANGE(0x7e00c000, 0x7e00c007) AM_MIRROR(0x80000000) AM_WRITE(K056800_host_w) | |
| 318 | AM_RANGE(0x7e00c008, 0x7e00c00f) AM_MIRROR(0x80000000) AM_READ(K056800_host_r) | |
| 319 | AM_RANGE(0x7f800000, 0x7f9fffff) AM_MIRROR(0x80000000) AM_ROM AM_SHARE(2) | |
| 320 | AM_RANGE(0x7fe00000, 0x7fffffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2) /* Program ROM */ | |
| 318 | AM_RANGE(0x00000000, 0x000fffff) AM_RAM AM_BASE(&workram) /* Work RAM */ | |
| 319 | AM_RANGE(0x74000000, 0x74003fff) AM_READWRITE(K056832_ram_long_r, K056832_ram_long_w) | |
| 320 | AM_RANGE(0x74020000, 0x7402003f) AM_READWRITE(K056832_long_r, K056832_long_w) | |
| 321 | AM_RANGE(0x74060000, 0x7406003f) AM_READWRITE(ccu_r, ccu_w) | |
| 322 | AM_RANGE(0x74080000, 0x74081fff) AM_RAM_WRITE(paletteram32_w) AM_BASE(&paletteram32) | |
| 323 | AM_RANGE(0x740a0000, 0x740a3fff) AM_READ(K056832_rom_long_r) | |
| 324 | AM_RANGE(0x78000000, 0x7800ffff) AM_READWRITE(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc) /* 21N 21K 23N 23K */ | |
| 325 | AM_RANGE(0x78010000, 0x7801ffff) AM_WRITE(cgboard_dsp_shared_w_ppc) | |
| 326 | AM_RANGE(0x78040000, 0x7804000f) AM_READWRITE(K001006_0_r, K001006_0_w) | |
| 327 | AM_RANGE(0x780c0000, 0x780c0007) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc) | |
| 328 | AM_RANGE(0x7e000000, 0x7e003fff) AM_READWRITE(sysreg_r, sysreg_w) | |
| 329 | AM_RANGE(0x7e008000, 0x7e009fff) AM_READWRITE8(K056230_r, K056230_w, 0xffffffff) /* LANC registers */ | |
| 330 | AM_RANGE(0x7e00a000, 0x7e00bfff) AM_READWRITE(lanc_ram_r, lanc_ram_w) /* LANC Buffer RAM (27E) */ | |
| 331 | AM_RANGE(0x7e00c000, 0x7e00c007) AM_WRITE(K056800_host_w) | |
| 332 | AM_RANGE(0x7e00c008, 0x7e00c00f) AM_READ(K056800_host_r) | |
| 333 | AM_RANGE(0x7f800000, 0x7f9fffff) AM_ROM AM_SHARE(2) | |
| 334 | AM_RANGE(0x7fe00000, 0x7fffffff) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2) /* Program ROM */ | |
| 321 | 335 | ADDRESS_MAP_END |
| 322 | 336 | |
| 323 | 337 | |
| r2844 | r2845 | |
| 579 | 593 | MDRV_INTERLEAVE(500) |
| 580 | 594 | |
| 581 | 595 | MDRV_NVRAM_HANDLER(93C46) |
| 596 | MDRV_MACHINE_START(zr107) | |
| 582 | 597 | MDRV_MACHINE_RESET(zr107) |
| 583 | 598 | |
| 584 | 599 | /* video hardware */ |
| r2844 | r2845 | |
| 623 | 638 | MDRV_INTERLEAVE(500) |
| 624 | 639 | |
| 625 | 640 | MDRV_NVRAM_HANDLER(93C46) |
| 641 | MDRV_MACHINE_START(zr107) | |
| 626 | 642 | MDRV_MACHINE_RESET(zr107) |
| 627 | 643 | |
| 628 | 644 | /* video hardware */ |
| r2844 | r2845 | |
|---|---|---|
| 46 | 46 | static READ8_HANDLER( amspdwy_wheel_##_n_##_r ) \ |
| 47 | 47 | { \ |
| 48 | 48 | static UINT8 wheel_old, ret; \ |
| 49 | char port | |
| 49 | static const char *portnames[ | |
| 50 | 50 | UINT8 wheel; \ |
| 51 | sprintf(port1, "IN%d", 5 + _n_); \ | |
| 52 | wheel = input_port_read(machine, port1); \ | |
| 51 | wheel = input_port_read(machine, portnames[2 + _n_]); \ | |
| 53 | 52 | if (wheel != wheel_old) \ |
| 54 | 53 | { \ |
| 55 | 54 | wheel = (wheel & 0x7fff) - (wheel & 0x8000); \ |
| r2844 | r2845 | |
| 57 | 56 | else ret = ((-wheel) & 0xf) | 0x10; \ |
| 58 | 57 | wheel_old = wheel; \ |
| 59 | 58 | } \ |
| 60 | sprintf(port2, "IN%d", 2 + _n_); \ | |
| 61 | return ret | input_port_read(machine, port2); \ | |
| 59 | return ret | input_port_read(machine, portnames[_n_]); \ | |
| 62 | 60 | } |
| 63 | 61 | AMSPDWY_WHEEL_R( 0 ) |
| 64 | 62 | AMSPDWY_WHEEL_R( 1 ) |
| r2844 | r2845 | |
| 66 | 64 | |
| 67 | 65 | static READ8_HANDLER( amspdwy_sound_r ) |
| 68 | 66 | { |
| 69 | return (YM2151_status_port_0_r(machine,0) & ~ 0x30) | input_port_read(machine, "IN | |
| 67 | return (YM2151_status_port_0_r(machine,0) & ~ 0x30) | input_port_read(machine, "IN0"); | |
| 70 | 68 | } |
| 71 | 69 | |
| 72 | 70 | static WRITE8_HANDLER( amspdwy_sound_w ) |
| r2844 | r2845 | |
| 173 | 171 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x00, "SW2:2" ) /* Listed as "Unused" */ |
| 174 | 172 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "SW2:1" ) /* Listed as "Unused" */ |
| 175 | 173 | |
| 176 | PORT_START_TAG(" | |
| 174 | PORT_START_TAG("WHEEL1") // Player 1 Wheel + Coins | |
| 177 | 175 | PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) // wheel |
| 178 | 176 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2) // 2-3f |
| 179 | 177 | |
| 180 | PORT_START_TAG(" | |
| 178 | PORT_START_TAG("WHEEL2") // Player 2 Wheel + Coins | |
| 181 | 179 | PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) |
| 182 | 180 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(2) |
| 183 | 181 | |
| 184 | PORT_START_TAG("IN | |
| 182 | PORT_START_TAG("IN0") // Player 1&2 Pedals + YM2151 Sound Status | |
| 185 | 183 | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) |
| 186 | 184 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 187 | 185 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 188 | 186 | PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) |
| 189 | 187 | |
| 190 | PORT_START_TAG(" | |
| 188 | PORT_START_TAG("AN1") // Player 1 Analog Fake Port | |
| 191 | 189 | PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(15) PORT_KEYDELTA(20) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_PLAYER(1) |
| 192 | 190 | |
| 193 | PORT_START_TAG(" | |
| 191 | PORT_START_TAG("AN2") // Player 2 Analog Fake Port | |
| 194 | 192 | PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(15) PORT_KEYDELTA(20) PORT_CODE_DEC(KEYCODE_D) PORT_CODE_INC(KEYCODE_G) PORT_PLAYER(2) |
| 195 | 193 | |
| 196 | 194 | INPUT_PORTS_END |
| r2844 | r2845 | |
|---|---|---|
| 124 | 124 | |
| 125 | 125 | static READ8_HANDLER( dominob_input_2_r ) |
| 126 | 126 | { |
| 127 | return input_port_read | |
| 127 | return input_port_read | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 |
| r2844 | r2845 | |
|---|---|---|
| 1519 | 1519 | |
| 1520 | 1520 | static MACHINE_RESET( konami573 ) |
| 1521 | 1521 | { |
| 1522 | psx_machine_init(); | |
| 1522 | psx_machine_init(machine); | |
| 1523 | 1523 | |
| 1524 | 1524 | if( chiptype[ 0 ] != 0 ) |
| 1525 | 1525 | { |
| r2844 | r2845 | |
|---|---|---|
| 90 | 90 | static WRITE16_HANDLER( mo_control_w ) |
| 91 | 91 | { |
| 92 | 92 | if (ACCESSING_BITS_0_7) |
| 93 | atarirle_control_w(0, data & 7); | |
| 93 | atarirle_control_w(machine, 0, data & 7); | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | |
| r2844 | r2845 | |
| 125 | 125 | |
| 126 | 126 | static READ16_HANDLER( a2d_data_r ) |
| 127 | 127 | { |
| 128 | char | |
| 128 | static const char *adcnames[ | |
| 129 | 129 | |
| 130 | 130 | /* Pit Fighter has no A2D, just another input port */ |
| 131 | 131 | if (atarig1_pitfight) |
| r2844 | r2845 | |
| 133 | 133 | |
| 134 | 134 | /* otherwise, assume it's hydra */ |
| 135 | 135 | if (which_input < 3) |
| 136 | { | |
| 137 | sprintf(port, "ADC%d", which_input); | |
| 138 | return input_port_read(machine, port) << 8; | |
| 139 | } | |
| 136 | return input_port_read(machine, adcnames[which_input]) << 8; | |
| 140 | 137 | |
| 141 | 138 | return 0; |
| 142 | 139 | } |
| r2844 | r2845 | |
|---|---|---|
| 55 | 55 | { |
| 56 | 56 | static int last[4]; |
| 57 | 57 | int curr,delta; |
| 58 | static const char *port[] = { "TRACKBALL_P1_1", "TRACKBALL_P1_2", "TRACKBALL_P2_1", "TRACKBALL_P1_2" }; | |
| 58 | 59 | |
| 59 | ||
| 60 | curr = input_port_read_indexed(machine, 5 + offset); | |
| 60 | curr = input_port_read(machine, port[offset]); | |
| 61 | 61 | delta = (curr - last[offset]) & 0xff; |
| 62 | 62 | last[offset] = curr; |
| 63 | 63 | return (delta & 0x80) | (curr >> 1); |
| r2844 | r2845 | |
| 109 | 109 | AM_RANGE(0x2000, 0x21ff) AM_READ(K007420_r) /* Sprite RAM */ |
| 110 | 110 | AM_RANGE(0x2200, 0x23ff) AM_READ(K007342_scroll_r) /* Scroll RAM */ |
| 111 | 111 | AM_RANGE(0x2400, 0x245f) AM_READ(SMH_RAM) /* Palette */ |
| 112 | AM_RANGE(0x2e01, 0x2e01) AM_READ(input_port_3_r) /* 1P controls */ | |
| 113 | AM_RANGE(0x2e02, 0x2e02) AM_READ(input_port_4_r) /* 2P controls */ | |
| 114 | AM_RANGE(0x2e03, 0x2e03) AM_READ(input_port_1_r) /* DISPW #2 */ | |
| 115 | AM_RANGE(0x2e40, 0x2e40) AM_READ(input_port_0_r) /* DIPSW #1 */ | |
| 116 | AM_RANGE(0x2e00, 0x2e00) AM_READ(input_port_2_r) /* DIPSW #3, coinsw, startsw */ | |
| 112 | AM_RANGE(0x2e01, 0x2e01) AM_READ_PORT("P1") /* 1P controls */ | |
| 113 | AM_RANGE(0x2e02, 0x2e02) AM_READ_PORT("P2") /* 2P controls */ | |
| 114 | AM_RANGE(0x2e03, 0x2e03) AM_READ_PORT("DSW2") /* DISPW #2 */ | |
| 115 | AM_RANGE(0x2e40, 0x2e40) AM_READ_PORT("DSW1") /* DIPSW #1 */ | |
| 116 | AM_RANGE(0x2e00, 0x2e00) AM_READ_PORT("COINSW") /* DIPSW #3, coinsw, startsw */ | |
| 117 | 117 | AM_RANGE(0x2f00, 0x2f03) AM_READ(trackball_r) /* Trackballs */ |
| 118 | 118 | AM_RANGE(0x2f80, 0x2f9f) AM_READ(K051733_r) /* Protection: 051733 */ |
| 119 | 119 | AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_RAM) /* Work RAM */ |
| r2844 | r2845 | |
|---|---|---|
| 77 | 77 | #include "audio/seibu.h" |
| 78 | 78 | #include "sound/3812intf.h" |
| 79 | 79 | #include "cpu/m68000/m68000.h" |
| 80 | #include "machine/seicop.h" | |
| 81 | #include "includes/legionna.h" | |
| 80 | 82 | |
| 81 | /* machine/seicop.c */ | |
| 82 | extern UINT16* cop_mcu_ram; | |
| 83 | extern READ16_HANDLER( legionna_mcu_r ); | |
| 84 | extern WRITE16_HANDLER( legionna_mcu_w ); | |
| 85 | extern READ16_HANDLER( heatbrl_mcu_r ); | |
| 86 | extern WRITE16_HANDLER( heatbrl_mcu_w ); | |
| 87 | extern READ16_HANDLER( godzilla_mcu_r ); | |
| 88 | extern WRITE16_HANDLER( godzilla_mcu_w ); | |
| 89 | extern READ16_HANDLER( denjinmk_mcu_r ); | |
| 90 | extern WRITE16_HANDLER( denjinmk_mcu_w ); | |
| 91 | extern READ16_HANDLER( sdgndmrb_mcu_r ); | |
| 92 | extern WRITE16_HANDLER( sdgndmrb_mcu_w ); | |
| 93 | extern READ16_HANDLER( cupsoc_mcu_r ); | |
| 94 | extern WRITE16_HANDLER( cupsoc_mcu_w ); | |
| 95 | extern READ16_HANDLER( copdxbl_0_r ); | |
| 96 | extern WRITE16_HANDLER( copdxbl_0_w ); | |
| 97 | ||
| 98 | ||
| 99 | ||
| 100 | ||
| 101 | ||
| 102 | extern WRITE16_HANDLER( legionna_background_w ); | |
| 103 | extern WRITE16_HANDLER( legionna_foreground_w ); | |
| 104 | extern WRITE16_HANDLER( legionna_midground_w ); | |
| 105 | extern WRITE16_HANDLER( legionna_text_w ); | |
| 106 | extern WRITE16_HANDLER( legionna_control_w ); | |
| 107 | ||
| 108 | extern VIDEO_START( legionna ); | |
| 109 | extern VIDEO_START( cupsoc ); | |
| 110 | extern VIDEO_START( denjinmk ); | |
| 111 | extern VIDEO_UPDATE( legionna ); | |
| 112 | extern VIDEO_UPDATE( godzilla ); | |
| 113 | extern VIDEO_UPDATE( sdgndmrb ); | |
| 114 | ||
| 115 | ||
| 116 | extern UINT16 *legionna_back_data,*legionna_fore_data,*legionna_mid_data,*legionna_scrollram16,*legionna_textram; | |
| 117 | ||
| 118 | ||
| 119 | 83 | /*****************************************************************************/ |
| 120 | 84 | |
| 121 | 85 | |
| r2844 | r2845 | |
| 166 | 130 | ADDRESS_MAP_END |
| 167 | 131 | |
| 168 | 132 | /* did they swap the lines, or does the protection device swap the words during the DMA?? */ |
| 169 | WRITE16_HANDLER( denjin_paletteram16_xBBBBBGGGGGRRRRR_word_w ) | |
| 133 | static WRITE16_HANDLER( denjin_paletteram16_xBBBBBGGGGGRRRRR_word_w ) | |
| 170 | 134 | { |
| 171 | 135 | offset^=1; |
| 172 | 136 | COMBINE_DATA(&paletteram16[offset]); |
| r2844 | r2845 | |
| 990 | 954 | }; |
| 991 | 955 | |
| 992 | 956 | |
| 993 | void descramble_legionnaire_gfx(UINT8* src) | |
| 957 | static void descramble_legionnaire_gfx(UINT8* src) | |
| 994 | 958 | { |
| 995 | 959 | UINT8 *buffer; |
| 996 | 960 | int len = 0x10000; |
| r2844 | r2845 | |
| 2089 | 2053 | ROM[0x5fe4/2] = 0x4e71; |
| 2090 | 2054 | } |
| 2091 | 2055 | |
| 2092 | DRIVER_INIT( legiongfx ) | |
| 2056 | static DRIVER_INIT( legiongfx ) | |
| 2093 | 2057 | { |
| 2094 | 2058 | descramble_legionnaire_gfx( memory_region(REGION_GFX5) ); |
| 2095 | 2059 | } |
| r2844 | r2845 | |
|---|---|---|
| 161 | 161 | { |
| 162 | 162 | switch (data) |
| 163 | 163 | { |
| 164 | case 0x00: protection_res = input_port_read | |
| 164 | case 0x00: protection_res = input_port_read | |
| 165 | 165 | case 0x20: protection_res = 0x49; break; |
| 166 | 166 | case 0x21: protection_res = 0x47; break; |
| 167 | 167 | case 0x22: protection_res = 0x53; break; |
| r2844 | r2845 | |
| 194 | 194 | static ADDRESS_MAP_START( cpoker_map, ADDRESS_SPACE_IO, 8 ) |
| 195 | 195 | AM_RANGE(0x2000, 0x27ff) AM_WRITE(cpk_palette_w) |
| 196 | 196 | AM_RANGE(0x2800, 0x2fff) AM_WRITE(cpk_palette2_w) |
| 197 | AM_RANGE(0x4000, 0x4000) AM_READ(input_port_0_r) /* DSW1 */ | |
| 198 | AM_RANGE(0x4001, 0x4001) AM_READ(input_port_1_r) /* DSW2 */ | |
| 199 | AM_RANGE(0x4002, 0x4002) AM_READ(input_port_2_r) /* DSW3 */ | |
| 200 | AM_RANGE(0x4003, 0x4003) AM_READ(input_port_3_r) /* DSW4 */ | |
| 201 | AM_RANGE(0x4004, 0x4004) AM_READ(input_port_4_r) /* DSW5 */ | |
| 202 | AM_RANGE(0x5081, 0x5081) AM_READ(input_port_5_r) /* Services */ | |
| 203 | AM_RANGE(0x5082, 0x5082) AM_READ(input_port_6_r) /* Coing & Kbd */ | |
| 197 | AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSW1") /* DSW1 */ | |
| 198 | AM_RANGE(0x4001, 0x4001) AM_READ_PORT("DSW2") /* DSW2 */ | |
| 199 | AM_RANGE(0x4002, 0x4002) AM_READ_PORT("DSW3") /* DSW3 */ | |
| 200 | AM_RANGE(0x4003, 0x4003) AM_READ_PORT("DSW4") /* DSW4 */ | |
| 201 | AM_RANGE(0x4004, 0x4004) AM_READ_PORT("DSW5") /* DSW5 */ | |
| 202 | AM_RANGE(0x5081, 0x5081) AM_READ_PORT("5081") /* Services */ | |
| 203 | AM_RANGE(0x5082, 0x5082) AM_READ_PORT("5082") /* Coing & Kbd */ | |
| 204 | 204 | AM_RANGE(0x5090, 0x5090) AM_WRITE(custom_io_w) |
| 205 | AM_RANGE(0x5091, 0x5091) AM_READ(custom_io_r) /* Keyboard */ | |
| 206 | AM_RANGE(0x50a0, 0x50a0) AM_READ(input_port_8_r) /* Not connected */ | |
| 205 | AM_RANGE(0x5091, 0x5091) AM_READ(custom_io_r) /* Keyboard */ | |
| 206 | AM_RANGE(0x50a0, 0x50a0) AM_READ_PORT("50A0") /* Not connected */ | |
| 207 | 207 | AM_RANGE(0x50b0, 0x50b0) AM_WRITE(YM2413_register_port_0_w) |
| 208 | 208 | AM_RANGE(0x50b1, 0x50b1) AM_WRITE(YM2413_data_port_0_w) |
| 209 | 209 | AM_RANGE(0x6800, 0x6fff) AM_WRITE(SMH_RAM) AM_BASE(&cpk_expram) |
| r2844 | r2845 | |
| 215 | 215 | static ADDRESS_MAP_START( csk227_map, ADDRESS_SPACE_IO, 8 ) |
| 216 | 216 | AM_RANGE(0x2000, 0x27ff) AM_WRITE(cpk_palette_w) |
| 217 | 217 | AM_RANGE(0x2800, 0x2fff) AM_WRITE(cpk_palette2_w) |
| 218 | AM_RANGE(0x4000, 0x4000) AM_READ(input_port_0_r) /* DSW1 */ | |
| 219 | AM_RANGE(0x4001, 0x4001) AM_READ(input_port_1_r) /* DSW2 */ | |
| 220 | AM_RANGE(0x4002, 0x4002) AM_READ(input_port_2_r) /* DSW3 */ | |
| 221 | AM_RANGE(0x4003, 0x4003) AM_READ(input_port_3_r) /* DSW4 */ | |
| 222 | AM_RANGE(0x4004, 0x4004) AM_READ(input_port_4_r) /* DSW5 */ | |
| 223 | AM_RANGE(0x5081, 0x5081) AM_READ(input_port_5_r) /* Services */ | |
| 224 | AM_RANGE(0x5082, 0x5082) AM_READ(input_port_6_r) /* Coing & Kbd */ | |
| 225 | AM_RANGE(0x5091, 0x5091) AM_READ(input_port_7_r) /* Keyboard */ | |
| 226 | AM_RANGE(0x50a0, 0x50a0) AM_READ(input_port_8_r) /* Not connected */ | |
| 218 | AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSW1") /* DSW1 */ | |
| 219 | AM_RANGE(0x4001, 0x4001) AM_READ_PORT("DSW2") /* DSW2 */ | |
| 220 | AM_RANGE(0x4002, 0x4002) AM_READ_PORT("DSW3") /* DSW3 */ | |
| 221 | AM_RANGE(0x4003, 0x4003) AM_READ_PORT("DSW4") /* DSW4 */ | |
| 222 | AM_RANGE(0x4004, 0x4004) AM_READ_PORT("DSW5") /* DSW5 */ | |
| 223 | AM_RANGE(0x5081, 0x5081) AM_READ_PORT("5081") /* Services */ | |
| 224 | AM_RANGE(0x5082, 0x5082) AM_READ_PORT("5082") /* Coing & Kbd */ | |
| 225 | AM_RANGE(0x5091, 0x5091) AM_READ_PORT("5091") /* Keyboard */ | |
| 226 | AM_RANGE(0x50a0, 0x50a0) AM_READ_PORT("50A0") /* Not connected */ | |
| 227 | 227 | AM_RANGE(0x50b0, 0x50b0) AM_WRITE(YM2413_register_port_0_w) |
| 228 | 228 | AM_RANGE(0x50b1, 0x50b1) AM_WRITE(YM2413_data_port_0_w) |
| 229 | 229 | AM_RANGE(0x6800, 0x6fff) AM_WRITE(SMH_RAM) AM_BASE(&cpk_expram) |
| r2844 | r2845 | |
| 235 | 235 | static ADDRESS_MAP_START( csk234_map, ADDRESS_SPACE_IO, 8 ) |
| 236 | 236 | AM_RANGE(0x2000, 0x27ff) AM_WRITE(cpk_palette_w) |
| 237 | 237 | AM_RANGE(0x2800, 0x2fff) AM_WRITE(cpk_palette2_w) |
| 238 | AM_RANGE(0x4000, 0x4000) AM_READ(input_port_0_r) /* DSW1 */ | |
| 239 | AM_RANGE(0x4001, 0x4001) AM_READ(input_port_1_r) /* DSW2 */ | |
| 240 | AM_RANGE(0x4002, 0x4002) AM_READ(input_port_2_r) /* DSW3 */ | |
| 241 | AM_RANGE(0x4003, 0x4003) AM_READ(input_port_3_r) /* DSW4 */ | |
| 242 | AM_RANGE(0x4004, 0x4004) AM_READ(input_port_4_r) /* DSW5 */ | |
| 243 | AM_RANGE(0x5081, 0x5081) AM_READ(input_port_5_r) /* Services */ | |
| 244 | AM_RANGE(0x5082, 0x5082) AM_READ(input_port_6_r) /* Coing & Kbd */ | |
| 238 | AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSW1") /* DSW1 */ | |
| 239 | AM_RANGE(0x4001, 0x4001) AM_READ_PORT("DSW2") /* DSW2 */ | |
| 240 | AM_RANGE(0x4002, 0x4002) AM_READ_PORT("DSW3") /* DSW3 */ | |
| 241 | AM_RANGE(0x4003, 0x4003) AM_READ_PORT("DSW4") /* DSW4 */ | |
| 242 | AM_RANGE(0x4004, 0x4004) AM_READ_PORT("DSW5") /* DSW5 */ | |
| 243 | AM_RANGE(0x5081, 0x5081) AM_READ_PORT("5081") /* Services */ | |
| 244 | AM_RANGE(0x5082, 0x5082) AM_READ_PORT("5082") /* Coing & Kbd */ | |
| 245 | 245 | AM_RANGE(0x5090, 0x5090) AM_WRITE(custom_io_w) |
| 246 | 246 | AM_RANGE(0x5091, 0x5091) AM_READ(custom_io_r) /* used for protection and other */ |
| 247 | AM_RANGE(0x50a0, 0x50a0) AM_READ | |
| 247 | AM_RANGE(0x50a0, 0x50a0) AM_READ | |
| 248 | 248 | AM_RANGE(0x50b0, 0x50b0) AM_WRITE(YM2413_register_port_0_w) |
| 249 | 249 | AM_RANGE(0x50b1, 0x50b1) AM_WRITE(YM2413_data_port_0_w) |
| 250 | 250 | AM_RANGE(0x6800, 0x6fff) AM_WRITE(SMH_RAM) AM_BASE(&cpk_expram) |
| r2844 | r2845 | |
| 410 | 410 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START1) |
| 411 | 411 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Hold1/High/Low") |
| 412 | 412 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Hold2/Red/Black") |
| 413 | ||
| 413 | 414 | PORT_START_TAG("50A0") |
| 414 | 415 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 415 | 416 |
| r2844 | r2845 | |
|---|---|---|
| 39 | 39 | |
| 40 | 40 | static UINT32 bankaddress; |
| 41 | 41 | |
| 42 | extern UINT16 *m90_video_data; | |
| 42 | extern UINT16 *m90_video_data,*dynablsb_video_control_data; | |
| 43 | 43 | |
| 44 | VIDEO_START( m90 ); | |
| 45 | VIDEO_START( dynablsb ); | |
| 46 | VIDEO_START( bomblord ); | |
| 44 | 47 | VIDEO_UPDATE( m90 ); |
| 45 | VIDEO_UPDATE( m90_bootleg ); | |
| 48 | VIDEO_UPDATE( dynablsb ); | |
| 49 | VIDEO_UPDATE( bomblord ); | |
| 50 | WRITE16_HANDLER( m90_video_w ); | |
| 46 | 51 | WRITE16_HANDLER( m90_video_control_w ); |
| 47 | WRITE16_HANDLER( m90_video_w ); | |
| 48 | VIDEO_START( m90 ); | |
| 49 | 52 | |
| 50 | 53 | /***************************************************************************/ |
| 51 | 54 | |
| r2844 | r2845 | |
| 81 | 84 | } |
| 82 | 85 | } |
| 83 | 86 | |
| 87 | /* | |
| 88 | static WRITE16_HANDLER( unknown_w ) | |
| 89 | { | |
| 90 | printf("%04x ",data); | |
| 91 | } | |
| 92 | */ | |
| 93 | ||
| 84 | 94 | /***************************************************************************/ |
| 85 | 95 | |
| 86 | 96 | static ADDRESS_MAP_START( main_cpu, ADDRESS_SPACE_PROGRAM, 16 ) |
| r2844 | r2845 | |
| 92 | 102 | AM_RANGE(0xffff0, 0xfffff) AM_ROM |
| 93 | 103 | ADDRESS_MAP_END |
| 94 | 104 | |
| 95 | static ADDRESS_MAP_START( b | |
| 105 | static ADDRESS_MAP_START( dynab | |
| 96 | 106 | AM_RANGE(0x00000, 0x3ffff) AM_ROM |
| 97 | AM_RANGE(0x6000e, 0x60fff) AM_RAM AM_BASE(&spriteram16) | |
| 107 | AM_RANGE(0x6000e, 0x60fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 98 | 108 | AM_RANGE(0xa0000, 0xa3fff) AM_RAM |
| 99 | 109 | AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE(&m90_video_data) |
| 100 | 110 | AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) |
| 101 | 111 | AM_RANGE(0xffff0, 0xfffff) AM_ROM |
| 102 | 112 | ADDRESS_MAP_END |
| 103 | 113 | |
| 114 | static ADDRESS_MAP_START( bomblord_main_cpu, ADDRESS_SPACE_PROGRAM, 16 ) | |
| 115 | AM_RANGE(0x00000, 0x7ffff) AM_ROM | |
| 116 | AM_RANGE(0xa0000, 0xa3fff) AM_RAM | |
| 117 | AM_RANGE(0xc000e, 0xc0fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) | |
| 118 | AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE(&m90_video_data) | |
| 119 | AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) | |
| 120 | AM_RANGE(0xffff0, 0xfffff) AM_ROM | |
| 121 | ADDRESS_MAP_END | |
| 122 | ||
| 104 | 123 | static ADDRESS_MAP_START( main_cpu_io, ADDRESS_SPACE_IO, 16 ) |
| 105 | 124 | AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w) |
| 106 | 125 | AM_RANGE(0x00, 0x01) AM_READ(input_port_0_word_r) /* Player 1 & Player 2 */ |
| r2844 | r2845 | |
| 112 | 131 | AM_RANGE(0x80, 0x8f) AM_WRITE(m90_video_control_w) |
| 113 | 132 | ADDRESS_MAP_END |
| 114 | 133 | |
| 134 | static ADDRESS_MAP_START( dynablsb_cpu_io, ADDRESS_SPACE_IO, 16 ) | |
| 135 | AM_RANGE(0x00, 0x01) AM_WRITE(m72_sound_command_w) | |
| 136 | AM_RANGE(0x00, 0x01) AM_READ(input_port_0_word_r) /* Player 1 & Player 2 */ | |
| 137 | AM_RANGE(0x02, 0x03) AM_WRITE(m90_coincounter_w) | |
| 138 | AM_RANGE(0x02, 0x03) AM_READ(input_port_1_word_r) /* Coins */ | |
| 139 | // AM_RANGE(0x04, 0x05) AM_WRITE(unknown_w) /* dynablsb: write continuosly 0x6000 */ | |
| 140 | AM_RANGE(0x04, 0x05) AM_READ(input_port_2_word_r) /* Dip 1 & Dip 2 */ | |
| 141 | AM_RANGE(0x06, 0x07) AM_READ(input_port_3_word_r) /* Player 3 & Player 4 */ | |
| 142 | AM_RANGE(0x80, 0x8f) AM_WRITE(m90_video_control_w) | |
| 143 | // AM_RANGE(0x90, 0x91) AM_WRITE(unknown_w) | |
| 144 | ADDRESS_MAP_END | |
| 145 | ||
| 115 | 146 | /*****************************************************************************/ |
| 116 | 147 | |
| 117 | 148 | static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2844 | r2845 | |
| 252 | 283 | IREM_JOYSTICKS_3_4 |
| 253 | 284 | INPUT_PORTS_END |
| 254 | 285 | |
| 286 | static INPUT_PORTS_START( dynablsb ) | |
| 287 | PORT_START | |
| 288 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 289 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 290 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 291 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 292 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) | |
| 293 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 294 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 295 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 296 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 297 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 298 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 299 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 300 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) | |
| 301 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) | |
| 302 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 303 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 304 | ||
| 305 | IREM_COINS | |
| 306 | ||
| 307 | PORT_START_TAG("DSW") /* Dip switch bank 1 */ | |
| 308 | PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2") | |
| 309 | PORT_DIPSETTING( 0x0002, "2" ) | |
| 310 | PORT_DIPSETTING( 0x0003, "3" ) | |
| 311 | PORT_DIPSETTING( 0x0001, "4" ) | |
| 312 | PORT_DIPSETTING( 0x0000, "5" ) | |
| 313 | PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4") | |
| 314 | PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) ) | |
| 315 | PORT_DIPSETTING( 0x000c, DEF_STR( Medium ) ) | |
| 316 | PORT_DIPSETTING( 0x0004, DEF_STR( Hard ) ) | |
| 317 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 318 | PORT_DIPNAME( 0x0010, 0x0010, "Game Title" ) PORT_DIPLOCATION("SW1:5") /* Manual says "NOT USE" */ | |
| 319 | PORT_DIPSETTING( 0x0010, "Dynablaster" ) | |
| 320 | PORT_DIPSETTING( 0x0000, "Bomber Man" ) | |
| 321 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:6") | |
| 322 | PORT_DIPSETTING( 0x0000, DEF_STR( No ) ) | |
| 323 | PORT_DIPSETTING( 0x0020, DEF_STR( Yes ) ) | |
| 324 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7") | |
| 325 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 326 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 327 | PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "SW1:8" ) | |
| 328 | /* Dip switch bank 2 */ | |
| 329 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1") | |
| 330 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) | |
| 331 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 332 | PORT_DIPNAME( 0x0600, 0x0600, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2,3") | |
| 333 | PORT_DIPSETTING( 0x0400, "2 Player Upright" ) | |
| 334 | PORT_DIPSETTING( 0x0600, "4 Player Upright A" ) /* Seperate Coin Slots */ | |
| 335 | PORT_DIPSETTING( 0x0200, "4 Player Upright B" ) /* Shared Coin Slots */ | |
| 336 | PORT_DIPSETTING( 0x0000, DEF_STR( Cocktail ) ) /* This setting shows screen with offset, no cocktail support :-( */ | |
| 337 | PORT_DIPNAME( 0x0800, 0x0800, "Coin Mode" ) PORT_DIPLOCATION("SW2:4") | |
| 338 | PORT_DIPSETTING( 0x0800, "1" ) | |
| 339 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 340 | /* Coin Mode 1 */ | |
| 341 | IREM_COIN_MODE_1_NEW_HIGH | |
| 342 | /* Coin Mode 2, not supported yet */ | |
| 343 | // IREM_COIN_MODE_2 | |
| 344 | ||
| 345 | IREM_JOYSTICKS_3_4 | |
| 346 | INPUT_PORTS_END | |
| 347 | ||
| 348 | ||
| 255 | 349 | static INPUT_PORTS_START( atompunk ) |
| 256 | 350 | PORT_INCLUDE(dynablst) |
| 257 | 351 | |
| r2844 | r2845 | |
| 833 | 927 | MDRV_IMPORT_FROM( bbmanw ) |
| 834 | 928 | MDRV_CPU_MODIFY("main") |
| 835 | 929 | MDRV_CPU_CONFIG(no_table) |
| 930 | MDRV_CPU_PROGRAM_MAP(bomblord_main_cpu,0) | |
| 931 | MDRV_CPU_IO_MAP(dynablsb_cpu_io,0) | |
| 836 | 932 | |
| 933 | MDRV_VIDEO_START(bomblord) | |
| 934 | MDRV_VIDEO_UPDATE(bomblord) | |
| 935 | ||
| 837 | 936 | MDRV_CPU_VBLANK_INT("main", bomblord_interrupt) |
| 838 | 937 | |
| 839 | 938 | MACHINE_DRIVER_END |
| 840 | 939 | |
| 841 | 940 | |
| 842 | 941 | |
| 843 | static MACHINE_DRIVER_START( b | |
| 942 | static MACHINE_DRIVER_START( dynab | |
| 844 | 943 | |
| 845 | 944 | /* basic machine hardware */ |
| 846 | 945 | MDRV_CPU_ADD_TAG("main", V30,32000000/4) |
| 847 | MDRV_CPU_PROGRAM_MAP(bootleg_main_cpu,0) | |
| 848 | MDRV_CPU_IO_MAP(main_cpu_io,0) | |
| 946 | MDRV_CPU_PROGRAM_MAP(dynablsb_main_cpu,0) | |
| 947 | MDRV_CPU_IO_MAP(dynablsb_cpu_io,0) | |
| 849 | 948 | MDRV_CPU_VBLANK_INT("main", m90_interrupt) |
| 850 | 949 | |
| 851 | 950 | MDRV_CPU_ADD(Z80, XTAL_3_579545MHz) |
| r2844 | r2845 | |
| 867 | 966 | MDRV_GFXDECODE(m90) |
| 868 | 967 | MDRV_PALETTE_LENGTH(512) |
| 869 | 968 | |
| 870 | MDRV_VIDEO_START(m90) | |
| 871 | MDRV_VIDEO_UPDATE(m90) | |
| 969 | MDRV_VIDEO_START(dynablsb) | |
| 970 | MDRV_VIDEO_UPDATE(dynablsb) | |
| 872 | 971 | |
| 873 | 972 | /* sound hardware */ |
| 874 | 973 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| r2844 | r2845 | |
| 1199 | 1298 | GAME( 1991, dynablst, 0, bombrman, dynablst, 0, ROT0, "Irem (licensed from Hudson Soft)", "Dynablaster / Bomber Man", GAME_NO_COCKTAIL ) |
| 1200 | 1299 | GAME( 1991, bombrman, dynablst, bombrman, bombrman, 0, ROT0, "Irem (licensed from Hudson Soft)", "Bomber Man (Japan)", GAME_NO_COCKTAIL ) |
| 1201 | 1300 | GAME( 1991, atompunk, dynablst, bombrman, atompunk, 0, ROT0, "Irem America (licensed from Hudson Soft)", "Atomic Punk (US)", GAME_NO_COCKTAIL ) |
| 1202 | GAME( 1991, dynablsb, dynablst, b | |
| 1301 | GAME( 1991, dynablsb, dynablst, dynab | |
| 1203 | 1302 | GAME( 1992, bbmanw, 0, bbmanw, bbmanw, 0, ROT0, "Irem", "Bomber Man World / New Dyna Blaster - Global Quest", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL ) |
| 1204 | 1303 | GAME( 1992, bbmanwj, bbmanw, bbmanw, bbmanwj, 0, ROT0, "Irem", "Bomber Man World (Japan)", GAME_NO_COCKTAIL ) |
| 1205 | 1304 | GAME( 1992, newapunk, bbmanw, bbmanw, bbmanwj, 0, ROT0, "Irem America", "New Atomic Punk - Global Quest (US)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL ) |
| 1206 | GAME( 1992, bomblord, bbmanw, bomblord, bbmanw, bomblord, ROT0, "bootleg", "Bomber Lord (bootleg)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL | |
| 1305 | GAME( 1992, bomblord, bbmanw, bomblord, bbmanw, bomblord, ROT0, "bootleg", "Bomber Lord (bootleg)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL | |
| 1207 | 1306 | GAME( 1992, quizf1, 0, quizf1, quizf1, quizf1, ROT0, "Irem", "Quiz F-1 1,2finish", GAME_NO_COCKTAIL ) |
| 1208 | 1307 | GAME( 1993, riskchal, 0, riskchal, riskchal, 0, ROT0, "Irem", "Risky Challenge", GAME_IMPERFECT_GRAPHICS ) |
| 1209 | 1308 | GAME( 1993, gussun, riskchal, riskchal, riskchal, 0, ROT0, "Irem", "Gussun Oyoyo (Japan)", GAME_IMPERFECT_GRAPHICS ) |
| r2844 | r2845 | |
|---|---|---|
| 11 | 11 | #include "cpu/m6805/m6805.h" |
| 12 | 12 | #include "sound/ay8910.h" |
| 13 | 13 | #include "sound/msm5232.h" |
| 14 | #include "includes/buggychl.h" | |
| 14 | 15 | |
| 15 | 16 | /* |
| 16 | 17 | TO DO: |
| r2844 | r2845 | |
| 19 | 20 | - TA7630 volume table is hand tuned to match the sample, but still slighty off. |
| 20 | 21 | */ |
| 21 | 22 | |
| 22 | /* in machine/buggychl.c */ | |
| 23 | READ8_HANDLER( buggychl_68705_portA_r ); | |
| 24 | WRITE8_HANDLER( buggychl_68705_portA_w ); | |
| 25 | WRITE8_HANDLER( buggychl_68705_ddrA_w ); | |
| 26 | READ8_HANDLER( buggychl_68705_portB_r ); | |
| 27 | WRITE8_HANDLER( buggychl_68705_portB_w ); | |
| 28 | WRITE8_HANDLER( buggychl_68705_ddrB_w ); | |
| 29 | READ8_HANDLER( buggychl_68705_portC_r ); | |
| 30 | WRITE8_HANDLER( buggychl_68705_portC_w ); | |
| 31 | WRITE8_HANDLER( buggychl_68705_ddrC_w ); | |
| 32 | WRITE8_HANDLER( buggychl_mcu_w ); | |
| 33 | READ8_HANDLER( buggychl_mcu_r ); | |
| 34 | READ8_HANDLER( buggychl_mcu_status_r ); | |
| 35 | ||
| 36 | ||
| 37 | 23 | //not used |
| 38 | 24 | //WRITE8_HANDLER( msisaac_textbank1_w ); |
| 39 | 25 |
| r2844 | r2845 | |
|---|---|---|
| 297 | 297 | #include "sound/nes_apu.h" |
| 298 | 298 | |
| 299 | 299 | #include "rendlay.h" |
| 300 | #include "includes/playch10.h" | |
| 300 | 301 | |
| 301 | 302 | /* clock frequency */ |
| 302 | 303 | #define N2A03_DEFAULTCLOCK (21477272.724 / 12) |
| 303 | 304 | |
| 304 | /* from video */ | |
| 305 | extern WRITE8_HANDLER( playch10_videoram_w ); | |
| 306 | extern PALETTE_INIT( playch10 ); | |
| 307 | extern VIDEO_START( playch10 ); | |
| 308 | extern VIDEO_START( playch10_hboard ); | |
| 309 | extern VIDEO_UPDATE( playch10 ); | |
| 310 | ||
| 311 | /* from machine */ | |
| 312 | extern MACHINE_RESET( pc10 ); | |
| 313 | extern DRIVER_INIT( playch10 ); /* standard games */ | |
| 314 | extern DRIVER_INIT( pc_gun ); /* gun games */ | |
| 315 | extern DRIVER_INIT( pc_hrz ); /* horizontal games */ | |
| 316 | extern DRIVER_INIT( pcaboard ); /* a-board games */ | |
| 317 | extern DRIVER_INIT( pcbboard ); /* b-board games */ | |
| 318 | extern DRIVER_INIT( pccboard ); /* c-board games */ | |
| 319 | extern DRIVER_INIT( pcdboard ); /* d-board games */ | |
| 320 | extern DRIVER_INIT( pcdboard_2 ); /* d-board games with extra ram */ | |
| 321 | extern DRIVER_INIT( pceboard ); /* e-board games */ | |
| 322 | extern DRIVER_INIT( pcfboard ); /* f-board games */ | |
| 323 | extern DRIVER_INIT( pcfboard_2 ); /* f-board games with extra ram */ | |
| 324 | extern DRIVER_INIT( pcgboard ); /* g-board games */ | |
| 325 | extern DRIVER_INIT( pcgboard_type2 ); /* g-board games with 4 screen mirror */ | |
| 326 | extern DRIVER_INIT( pchboard ); /* h-board games */ | |
| 327 | extern DRIVER_INIT( pciboard ); /* i-board games */ | |
| 328 | extern DRIVER_INIT( pckboard ); /* k-board games */ | |
| 329 | extern READ8_HANDLER( pc10_port_0_r ); | |
| 330 | extern READ8_HANDLER( pc10_instrom_r ); | |
| 331 | extern READ8_HANDLER( pc10_prot_r ); | |
| 332 | extern READ8_HANDLER( pc10_detectclr_r ); | |
| 333 | extern READ8_HANDLER( pc10_in0_r ); | |
| 334 | extern READ8_HANDLER( pc10_in1_r ); | |
| 335 | extern WRITE8_HANDLER( pc10_SDCS_w ); | |
| 336 | extern WRITE8_HANDLER( pc10_CNTRLMASK_w ); | |
| 337 | extern WRITE8_HANDLER( pc10_DISPMASK_w ); | |
| 338 | extern WRITE8_HANDLER( pc10_SOUNDMASK_w ); | |
| 339 | extern WRITE8_HANDLER( pc10_NMIENABLE_w ); | |
| 340 | extern WRITE8_HANDLER( pc10_DOGDI_w ); | |
| 341 | extern WRITE8_HANDLER( pc10_GAMERES_w ); | |
| 342 | extern WRITE8_HANDLER( pc10_GAMESTOP_w ); | |
| 343 | extern WRITE8_HANDLER( pc10_PPURES_w ); | |
| 344 | extern WRITE8_HANDLER( pc10_prot_w ); | |
| 345 | extern WRITE8_HANDLER( pc10_CARTSEL_w ); | |
| 346 | extern WRITE8_HANDLER( pc10_in0_w ); | |
| 347 | ||
| 348 | extern int pc10_sdcs; | |
| 349 | extern int pc10_nmi_enable; | |
| 350 | extern int pc10_dog_di; | |
| 351 | ||
| 352 | 305 | /******************************************************************************/ |
| 353 | 306 | |
| 354 | 307 | /* local stuff */ |
| r2844 | r2845 | |
|---|---|---|
| 367 | 367 | |
| 368 | 368 | static READ32_HANDLER( jamma_r ) |
| 369 | 369 | { |
| 370 | return input_port_read | |
| 370 | return input_port_read | |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | |
| r2844 | r2845 | |
| 380 | 380 | // D5 = /VOLUMEUP |
| 381 | 381 | // D4 = /VOLUMEDOWN |
| 382 | 382 | // D3-D0 = ACTC4-1 |
| 383 | return input_port_read | |
| 383 | return input_port_read | |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | |
| r2844 | r2845 | |
| 790 | 790 | *************************************/ |
| 791 | 791 | |
| 792 | 792 | static INPUT_PORTS_START( area51 ) |
| 793 | PORT_START | |
| 793 | PORT_START_TAG("IN0") | |
| 794 | 794 | PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 795 | 795 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START2 ) |
| 796 | 796 | PORT_BIT( 0xfe00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 797 | 797 | |
| 798 | PORT_START | |
| 798 | PORT_START_TAG("IN1") | |
| 799 | 799 | PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 800 | 800 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 ) |
| 801 | 801 | PORT_BIT( 0xfe00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 802 | 802 | |
| 803 | PORT_START | |
| 803 | PORT_START_TAG("IN2") | |
| 804 | 804 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 805 | 805 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 806 | 806 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) |
| r2844 | r2845 | |
| 811 | 811 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) // vsyncneq |
| 812 | 812 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 813 | 813 | |
| 814 | PORT_START /* fake analog X */ | |
| 814 | PORT_START_TAG("FAKE1_X") /* fake analog X */ | |
| 815 | 815 | PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 320.0/(320.0 - 7 -7), 0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) |
| 816 | 816 | |
| 817 | PORT_START /* fake analog Y */ | |
| 817 | PORT_START_TAG("FAKE1_Y") /* fake analog Y */ | |
| 818 | 818 | PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, (240.0 - 1)/240, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) |
| 819 | 819 | |
| 820 | PORT_START /* fake analog X */ | |
| 820 | PORT_START_TAG("FAKE2_X") /* fake analog X */ | |
| 821 | 821 | PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 320.0/(320.0 - 7 -7), 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2) |
| 822 | 822 | |
| 823 | PORT_START /* fake analog Y */ | |
| 823 | PORT_START_TAG("FAKE2_Y") /* fake analog Y */ | |
| 824 | 824 | PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, (240.0 - 1)/240, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(2) |
| 825 | 825 | |
| 826 | PORT_START | |
| 826 | PORT_START_TAG("IN3") /* gun triggers */ | |
| 827 | 827 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SPECIAL ) // gun data valid |
| 828 | 828 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SPECIAL ) // gun data valid |
| 829 | 829 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 833 | 833 | |
| 834 | 834 | |
| 835 | 835 | static INPUT_PORTS_START( freezeat ) |
| 836 | PORT_START | |
| 836 | PORT_START_TAG("IN0") | |
| 837 | 837 | PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 838 | 838 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START2 ) |
| 839 | 839 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 844 | 844 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 845 | 845 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 846 | 846 | |
| 847 | PORT_START | |
| 847 | PORT_START_TAG("IN1") | |
| 848 | 848 | PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 849 | 849 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 ) |
| 850 | 850 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| r2844 | r2845 | |
| 855 | 855 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 856 | 856 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 857 | 857 | |
| 858 | PORT_START | |
| 858 | PORT_START_TAG("IN2") | |
| 859 | 859 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 860 | 860 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 861 | 861 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) |
| r2844 | r2845 | |
| 866 | 866 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) // vsyncneq |
| 867 | 867 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 868 | 868 | |
| 869 | PORT_START | |
| 869 | PORT_START_TAG("IN3") | |
| 870 | 870 | PORT_BIT( 0x000f, IP_ACTIVE_HIGH, IPT_SPECIAL ) // coin returns |
| 871 | 871 | PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 872 | 872 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r2844 | r2845 | |
| 874 | 874 | |
| 875 | 875 | |
| 876 | 876 | static INPUT_PORTS_START( fishfren ) |
| 877 | PORT_START | |
| 877 | PORT_START_TAG("IN0") | |
| 878 | 878 | PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 879 | 879 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START2 ) |
| 880 | 880 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 885 | 885 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 886 | 886 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 887 | 887 | |
| 888 | PORT_START | |
| 888 | PORT_START_TAG("IN1") | |
| 889 | 889 | PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 890 | 890 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 ) |
| 891 | 891 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| r2844 | r2845 | |
| 896 | 896 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 897 | 897 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 898 | 898 | |
| 899 | PORT_START | |
| 899 | PORT_START_TAG("IN2") | |
| 900 | 900 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 901 | 901 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 902 | 902 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) |
| r2844 | r2845 | |
| 907 | 907 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) // vsyncneq |
| 908 | 908 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 909 | 909 | |
| 910 | PORT_START | |
| 910 | PORT_START_TAG("IN3") | |
| 911 | 911 | PORT_BIT( 0x000f, IP_ACTIVE_HIGH, IPT_SPECIAL ) // coin returns |
| 912 | 912 | PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 913 | 913 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r2844 | r2845 | |
| 915 | 915 | |
| 916 | 916 | |
| 917 | 917 | static INPUT_PORTS_START( vcircle ) |
| 918 | PORT_START | |
| 918 | PORT_START_TAG("IN0") | |
| 919 | 919 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) |
| 920 | 920 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) |
| 921 | 921 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 929 | 929 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 930 | 930 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 931 | 931 | |
| 932 | PORT_START | |
| 932 | PORT_START_TAG("IN1") | |
| 933 | 933 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) |
| 934 | 934 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) |
| 935 | 935 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) |
| r2844 | r2845 | |
| 943 | 943 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 944 | 944 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 945 | 945 | |
| 946 | PORT_START | |
| 946 | PORT_START_TAG("IN2") | |
| 947 | 947 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 948 | 948 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 949 | 949 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) |
| r2844 | r2845 | |
| 954 | 954 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) // vsyncneq |
| 955 | 955 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 956 | 956 | |
| 957 | PORT_START | |
| 957 | PORT_START_TAG("IN3") | |
| 958 | 958 | PORT_BIT( 0x000f, IP_ACTIVE_HIGH, IPT_SPECIAL ) // coin returns |
| 959 | 959 | PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 960 | 960 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r2844 | r2845 | |
|---|---|---|
| 105 | 105 | |
| 106 | 106 | static READ16_HANDLER( special_port0_r ) |
| 107 | 107 | { |
| 108 | int temp = input_port_read | |
| 108 | int temp = input_port_read | |
| 109 | 109 | if (atarigen_cpu_to_sound_ready) temp ^= 0x0080; |
| 110 | 110 | return temp; |
| 111 | 111 | } |
| r2844 | r2845 | |
| 113 | 113 | |
| 114 | 114 | static READ16_HANDLER( special_port2_r ) |
| 115 | 115 | { |
| 116 | int temp = input_port_read | |
| 116 | int temp = input_port_read | |
| 117 | 117 | if (atarigen_cpu_to_sound_ready) temp ^= 0x2000; |
| 118 | 118 | return temp; |
| 119 | 119 | } |
| r2844 | r2845 | |
| 277 | 277 | *************************************/ |
| 278 | 278 | |
| 279 | 279 | static INPUT_PORTS_START( cyberbal ) |
| 280 | PORT_START | |
| 280 | PORT_START_TAG("IN0") /* fe0000 */ | |
| 281 | 281 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) |
| 282 | 282 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) |
| 283 | 283 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) |
| r2844 | r2845 | |
| 294 | 294 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 295 | 295 | PORT_SERVICE( 0x8000, IP_ACTIVE_LOW ) |
| 296 | 296 | |
| 297 | PORT_START | |
| 297 | PORT_START_TAG("IN1") /* fe1000 */ | |
| 298 | 298 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 299 | 299 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 300 | 300 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 311 | 311 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 312 | 312 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_VBLANK ) |
| 313 | 313 | |
| 314 | PORT_START /* fake port for screen switching */ | |
| 314 | PORT_START_TAG("IN2") /* fake port for screen switching */ | |
| 315 | 315 | PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 316 | 316 | |
| 317 | PORT_START /* audio board port */ | |
| 317 | /* 2008-06 FP: I tag this as JSAII (even if it's not) to simplify cyberbal_special_port3_r */ | |
| 318 | PORT_START_TAG("JSAII") /* audio board port */ | |
| 318 | 319 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN2 ) |
| 319 | 320 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 320 | 321 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN4 ) |
| r2844 | r2845 | |
| 327 | 328 | |
| 328 | 329 | |
| 329 | 330 | static INPUT_PORTS_START( cyberb2p ) |
| 330 | PORT_START | |
| 331 | PORT_START_TAG("IN0") /* fc0000 */ | |
| 331 | 332 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 332 | 333 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 333 | 334 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) |
| r2844 | r2845 | |
| 336 | 337 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 337 | 338 | PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 338 | 339 | |
| 339 | PORT_START | |
| 340 | PORT_START_TAG("IN1") /* fc2000 */ | |
| 340 | 341 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 341 | 342 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 342 | 343 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 345 | 346 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 346 | 347 | PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 347 | 348 | |
| 348 | PORT_START /* fc4000 */ | |
| 349 | PORT_START_TAG("IN2") /* fc4000 */ | |
| 349 | 350 | PORT_BIT( 0x1fff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 350 | 351 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 351 | 352 | PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| r2844 | r2845 | |
|---|---|---|
| 139 | 139 | /* sound IRQ is on 32V */ |
| 140 | 140 | if (scanline & 32) |
| 141 | 141 | atarigen_6502_irq_ack_r(screen->machine, 0); |
| 142 | else if (!(input_port_read | |
| 142 | else if (!(input_port_read | |
| 143 | 143 | atarigen_6502_irq_gen(screen->machine, 0); |
| 144 | 144 | } |
| 145 | 145 | |
| r2844 | r2845 | |
| 166 | 166 | |
| 167 | 167 | static INTERRUPT_GEN( vblank_int ) |
| 168 | 168 | { |
| 169 | int pedal_state = input_port_read | |
| 169 | int pedal_state = input_port_read | |
| 170 | 170 | int i; |
| 171 | 171 | |
| 172 | 172 | /* update the pedals once per frame */ |
| r2844 | r2845 | |
| 240 | 240 | 0x02 = coin 2 |
| 241 | 241 | 0x01 = coin 1 |
| 242 | 242 | */ |
| 243 | result = input_port_read_indexed(machine, 3); | |
| 244 | if (!(input_port_read_indexed(machine, 0) & 0x0080)) result ^= 0x90; | |
| 243 | result = input_port_read(machine, "AUDIO"); | |
| 244 | if (!(input_port_read(machine, "FE4000") & 0x0080)) result ^= 0x90; | |
| 245 | 245 | if (atarigen_cpu_to_sound_ready) result ^= 0x40; |
| 246 | 246 | if (atarigen_sound_to_cpu_ready) result ^= 0x20; |
| 247 | 247 | result ^= 0x10; |
| r2844 | r2845 | |
| 356 | 356 | *************************************/ |
| 357 | 357 | |
| 358 | 358 | static INPUT_PORTS_START( badlands ) |
| 359 | PORT_START | |
| 359 | PORT_START_TAG("FE4000") /* fe4000 */ | |
| 360 | 360 | PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 361 | 361 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 362 | 362 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| r2844 | r2845 | |
| 364 | 364 | PORT_SERVICE( 0x0080, IP_ACTIVE_LOW ) |
| 365 | 365 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 366 | 366 | |
| 367 | PORT_START | |
| 367 | PORT_START_TAG("FE6000") /* fe6000 */ | |
| 368 | 368 | PORT_BIT( 0x00ff, 0, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) |
| 369 | 369 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 370 | 370 | |
| 371 | PORT_START | |
| 371 | PORT_START_TAG("FE6002") /* fe6002 */ | |
| 372 | 372 | PORT_BIT( 0x00ff, 0, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2) |
| 373 | 373 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 374 | 374 | |
| 375 | PORT_START /* audio port */ | |
| 375 | PORT_START_TAG("AUDIO") /* audio port */ | |
| 376 | 376 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 377 | 377 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) |
| 378 | 378 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 ) |
| r2844 | r2845 | |
| 382 | 382 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) /* command buffer full */ |
| 383 | 383 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* self test */ |
| 384 | 384 | |
| 385 | PORT_START | |
| 385 | PORT_START_TAG("PEDALS") /* fake for pedals */ | |
| 386 | 386 | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 387 | 387 | PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 388 | 388 | PORT_BIT( 0xfffc, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| r2844 | r2845 | |
| 631 | 631 | /* sound IRQ is on 32V */ |
| 632 | 632 | // if (scanline & 32) |
| 633 | 633 | // atarigen_6502_irq_ack_r(screen->machine, 0); |
| 634 | // else if (!(input_port_read | |
| 634 | // else if (!(input_port_read | |
| 635 | 635 | // atarigen_6502_irq_gen(screen->machine, 0); |
| 636 | 636 | } |
| 637 | 637 |
| r2844 | r2845 | |
|---|---|---|
| 189 | 189 | #include "deprecat.h" |
| 190 | 190 | #include "cpu/m6805/m6805.h" |
| 191 | 191 | #include "sound/ay8910.h" |
| 192 | #include "includes/slapfght.h" | |
| 192 | 193 | |
| 193 | /* video */ | |
| 194 | extern UINT8 *slapfight_videoram; | |
| 195 | extern UINT8 *slapfight_colorram; | |
| 196 | extern size_t slapfight_videoram_size; | |
| 197 | extern UINT8 *slapfight_scrollx_lo,*slapfight_scrollx_hi,*slapfight_scrolly; | |
| 198 | VIDEO_UPDATE( slapfight ); | |
| 199 | VIDEO_UPDATE( perfrman ); | |
| 200 | VIDEO_START( slapfight ); | |
| 201 | VIDEO_START( perfrman ); | |
| 202 | WRITE8_HANDLER( slapfight_flipscreen_w ); | |
| 203 | WRITE8_HANDLER( slapfight_fixram_w ); | |
| 204 | WRITE8_HANDLER( slapfight_fixcol_w ); | |
| 205 | WRITE8_HANDLER( slapfight_videoram_w ); | |
| 206 | WRITE8_HANDLER( slapfight_colorram_w ); | |
| 207 | WRITE8_HANDLER( slapfight_palette_bank_w ); | |
| 208 | ||
| 209 | /* MACHINE */ | |
| 210 | MACHINE_RESET( slapfight ); | |
| 211 | extern UINT8 *slapfight_dpram; | |
| 212 | extern size_t slapfight_dpram_size; | |
| 213 | WRITE8_HANDLER( slapfight_dpram_w ); | |
| 214 | READ8_HANDLER( slapfight_dpram_r ); | |
| 215 | ||
| 216 | READ8_HANDLER( slapfight_port_00_r ); | |
| 217 | WRITE8_HANDLER( slapfight_port_00_w ); | |
| 218 | WRITE8_HANDLER( slapfight_port_01_w ); | |
| 219 | WRITE8_HANDLER( getstar_port_04_w ); | |
| 220 | WRITE8_HANDLER( slapfight_port_06_w ); | |
| 221 | WRITE8_HANDLER( slapfight_port_07_w ); | |
| 222 | WRITE8_HANDLER( slapfight_port_08_w ); | |
| 223 | WRITE8_HANDLER( slapfight_port_09_w ); | |
| 224 | ||
| 225 | /* MCU */ | |
| 226 | READ8_HANDLER( getstar_e803_r ); | |
| 227 | ||
| 228 | READ8_HANDLER ( tigerh_68705_portA_r ); | |
| 229 | WRITE8_HANDLER( tigerh_68705_portA_w ); | |
| 230 | READ8_HANDLER ( tigerh_68705_portB_r ); | |
| 231 | WRITE8_HANDLER( tigerh_68705_portB_w ); | |
| 232 | READ8_HANDLER ( tigerh_68705_portC_r ); | |
| 233 | WRITE8_HANDLER( tigerh_68705_portC_w ); | |
| 234 | WRITE8_HANDLER( tigerh_68705_ddrA_w ); | |
| 235 | WRITE8_HANDLER( tigerh_68705_ddrB_w ); | |
| 236 | WRITE8_HANDLER( tigerh_68705_ddrC_w ); | |
| 237 | WRITE8_HANDLER( tigerh_mcu_w ); | |
| 238 | READ8_HANDLER ( tigerh_mcu_r ); | |
| 239 | READ8_HANDLER ( tigerh_mcu_status_r ); | |
| 240 | ||
| 241 | WRITE8_HANDLER( getstar_sh_intenable_w ); | |
| 242 | INTERRUPT_GEN( getstar_interrupt ); | |
| 243 | ||
| 244 | ||
| 245 | ||
| 246 | 194 | static ADDRESS_MAP_START( perfrman_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 247 | 195 | AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) |
| 248 | 196 | AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM) |
| r2844 | r2845 | |
|---|---|---|
| 221 | 221 | { |
| 222 | 222 | int i; |
| 223 | 223 | UINT16 res = 0xff; |
| 224 | static const char *port[] = { "KEYB_0", "KEYB_1", "KEYB_2", "KEYB_3", "KEYB_4" }; | |
| 224 | 225 | |
| 225 | 226 | for (i = 0; i < 5; i++) |
| 226 | 227 | if (bishjan_input & (1 << i)) |
| 227 | res = input_port_read | |
| 228 | res = input_port_read | |
| 228 | 229 | |
| 229 | 230 | return (res << 8) | |
| 230 | input_port_read | |
| 231 | input_port_read | |
| 231 | 232 | ((bishjan_hopper && !(video_screen_get_frame_number(machine->primary_screen)%10)) ? 0x00 : 0x04) // bit 2: hopper sensor |
| 232 | 233 | ; |
| 233 | 234 | } |
| r2844 | r2845 | |
| 321 | 322 | ***************************************************************************/ |
| 322 | 323 | |
| 323 | 324 | static INPUT_PORTS_START( bishjan ) |
| 324 | PORT_START / | |
| 325 | PORT_START_TAG("RESET") /* IN0 - Reset */ | |
| 325 | 326 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F1) |
| 326 | 327 | |
| 327 | PORT_START / | |
| 328 | PORT_START_TAG("DSW") /* IN1 - DSW(SW1) */ | |
| 328 | 329 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Controls ) ) |
| 329 | 330 | PORT_DIPSETTING( 0x0001, "Keyboard" ) |
| 330 | 331 | PORT_DIPSETTING( 0x0000, DEF_STR( Joystick ) ) |
| r2844 | r2845 | |
| 350 | 351 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) |
| 351 | 352 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 352 | 353 | |
| 353 | PORT_START / | |
| 354 | PORT_START_TAG("JOY") /* IN2 - C */ | |
| 354 | 355 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 ) // start (joy) |
| 355 | 356 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) // down (joy) |
| 356 | 357 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r2844 | r2845 | |
| 360 | 361 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) // bet (joy) |
| 361 | 362 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON2 ) // select (joy) |
| 362 | 363 | |
| 363 | PORT_START / | |
| 364 | PORT_START_TAG("IN0") /* IN3 - A */ | |
| 364 | 365 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 365 | 366 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE ) // test |
| 366 | 367 | PORT_BIT( 0x0004, IP_ACTIVE_HIGH,IPT_SPECIAL ) // hopper sensor |
| r2844 | r2845 | |
| 370 | 371 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE3 ) // pay out? "hopper empty" |
| 371 | 372 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) // coin |
| 372 | 373 | |
| 373 | PORT_START / | |
| 374 | PORT_START_TAG("KEYB_0") /* IN4 - B(1) */ | |
| 374 | 375 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_A ) // a |
| 375 | 376 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_E ) // e |
| 376 | 377 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_I ) // i |
| r2844 | r2845 | |
| 380 | 381 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 381 | 382 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 382 | 383 | |
| 383 | PORT_START / | |
| 384 | PORT_START_TAG("KEYB_1") /* IN5 - B(2) */ | |
| 384 | 385 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_B ) // b |
| 385 | 386 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_F ) // f |
| 386 | 387 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_J ) // j |
| r2844 | r2845 | |
| 390 | 391 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 391 | 392 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 392 | 393 | |
| 393 | PORT_START / | |
| 394 | PORT_START_TAG("KEYB_2") /* IN6 - B(3) */ | |
| 394 | 395 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_C ) // c |
| 395 | 396 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_G ) // g |
| 396 | 397 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_K ) // k |
| r2844 | r2845 | |
| 400 | 401 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 401 | 402 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 402 | 403 | |
| 403 | PORT_START / | |
| 404 | PORT_START_TAG("KEYB_3") /* IN7 - B(4) */ | |
| 404 | 405 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_D ) // d |
| 405 | 406 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_H ) // h |
| 406 | 407 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_L ) // l |
| r2844 | r2845 | |
| 410 | 411 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 411 | 412 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 412 | 413 | |
| 413 | PORT_START / | |
| 414 | PORT_START_TAG("KEYB_4") /* IN8 - B(5) */ | |
| 414 | 415 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 415 | 416 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN ) // g2 |
| 416 | 417 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) // e2 |
| r2844 | r2845 | |
|---|---|---|
| 441 | 441 | |
| 442 | 442 | MVS CHA: |
| 443 | 443 | -- SNK -- |
| 444 | . NEO-MVS CHA-32 | |
| 444 | 445 | . NEO-MVS CHA-8M |
| 445 | 446 | . NEO-MVS CHA42G |
| 446 | 447 | . NEO-MVS CHA42G-1 |
| r2844 | r2845 | |
| 452 | 453 | . NEO-MVS PSTM CHA136 |
| 453 | 454 | . NEO-MVS CHA512Y |
| 454 | 455 | . NEO-MVS CHAFIO (1999.6.14) |
| 456 | . MVS CHAFIO REV1.0 (KOF-2001) | |
| 455 | 457 | . NEO-MVS CHAFIO (SNK 2002) - MADE IN KOREA |
| 456 | 458 | -- SNKPLAYMORE -- |
| 457 | 459 | . NEO-MVS CHAFIO (2003.7.24) |
| 458 | 460 | |
| 459 | 461 | MVS PROG: |
| 460 | 462 | -- SNK -- |
| 463 | . NEO-MVS PROG-HERO | |
| 461 | 464 | . NEO-MVS PROG-EP |
| 462 | 465 | . NEO-MVS PROG8M42 |
| 463 | 466 | . NEO-MVS PROG16 |
| r2844 | r2845 | |
| 467 | 470 | . NEO-MVS PROG 4096 |
| 468 | 471 | . NEO-MVS PROG 4096 B |
| 469 | 472 | . NEO-MVS PROGGSC |
| 473 | . NEO-MVS PROGGS3 | |
| 470 | 474 | . NEO-MVS PROGTOP |
| 471 | 475 | . NEO-MVS PROGSF1 (1998.6.17) |
| 472 | 476 | . NEO-MVS PROGEOP (1999.2.2) |
| 473 | 477 | . NEO-MVS PROGLBA (1999.4.12) - LBA-SUB (2000.2.24) |
| 474 | 478 | . NEO-MVS PROGBK1 |
| 475 | 479 | . NEO-MVS PROGBK2 (2000.3.21) |
| 480 | . MVS PROGBK2 REV1.0 (KOF-2001) | |
| 476 | 481 | . NEO-MVS PROGBK2 (SNK 2002) - MADE IN KOREA |
| 477 | 482 | -- SNKPLAYMORE -- |
| 478 | 483 | . NEO-MVS PROGBK2R (2003.8.26) - NEO-HYCS (2003.9.29) |
| r2844 | r2845 | |
| 518 | 523 | . NEO-AEG PROGRK |
| 519 | 524 | . NEO-AEG PROGRKB |
| 520 | 525 | . NEO-AEG PROGBK1Y |
| 526 | . NEO-AEG PROGBK1F | |
| 521 | 527 | -- PLAYMORE -- |
| 522 | 528 | . NEO-AEG PROGBK2 (2002.4.1) |
| 523 | 529 | -- SNKPLAYMORE -- |
| r2844 | r2845 | |
| 546 | 552 | |
| 547 | 553 | ****************************************************************************/ |
| 548 | 554 | |
| 555 | /**************************************************************************** | |
| 556 | ||
| 557 | General set notes: | |
| 558 | ================== | |
| 559 | ||
| 560 | NOTES BELOW APPLY TO OEM SETS ONLY! | |
| 561 | ||
| 562 | Many 'M1' roms contain mirrored data (64k mirrored or 128k mirrored). | |
| 563 | Found on several early sets (ID 0001 ~ 0045) and on the last sets (ID 0267 ~ 0272). | |
| 564 | This caused some confusion and incorrect rom sizes. | |
| 565 | Minimum 'M1' size is 1mbit, maximum size 4mbit. | |
| 566 | The remaining 64k 'M1' are marked BAD_DUMP. | |
| 567 | ||
| 568 | All 'S1' roms found on prom are 1mbit. | |
| 569 | The remainig 64k 'S1' are marked BAD_DUMP. | |
| 570 | ||
| 571 | ****************************************************************************/ | |
| 572 | ||
| 549 | 573 | ROM_START( nam1975 ) /* MVS AND AES VERSION */ |
| 550 | 574 | ROM_REGION( 0x100000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 551 | 575 | ROM_LOAD16_WORD_SWAP( "001-p1.bin", 0x000000, 0x080000, CRC(cc9fc951) SHA1(92f4e6ddeeb825077d92dbb70b50afea985f15c0) ) |
| r2844 | r2845 | |
| 883 | 907 | |
| 884 | 908 | NEO_SFIX_128K( "014-s1.bin", CRC(99419733) SHA1(b2524af8704941acc72282aa1d62fd4c93e3e822) ) |
| 885 | 909 | |
| 886 | NEO_BIOS_AUDIO_128K( "014-m1.bin", CRC(2a97e84d) SHA1(3c3f0236ec261b48637ddff3d1dcd11ede4af300) ) | |
| 910 | /* CXK381003A */ | |
| 911 | NEO_BIOS_AUDIO_128K( "014-m1.bin", CRC(b6683092) SHA1(623ec7ec2915fb077bf65b4a16c815e071c25259) ) | |
| 887 | 912 | |
| 888 | 913 | ROM_REGION( 0x200000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 889 | 914 | ROM_LOAD( "014-v1.bin", 0x000000, 0x100000, CRC(25419296) SHA1(c9fc04987c4e0875d276e1a0fb671740b6f548ad) ) |
| r2844 | r2845 | |
| 901 | 926 | ROM_START( kotm ) |
| 902 | 927 | ROM_REGION( 0x100000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 903 | 928 | ROM_LOAD16_WORD_SWAP( "016-p1.bin", 0x000000, 0x080000, CRC(1b818731) SHA1(b98b1b33c0301fd79aac908f6b635dd00d1cb08d) ) |
| 904 | ROM_LOAD16_WORD_SWAP( "016-p2.bin", 0x080000, 0x020000, | |
| 929 | ROM_LOAD16_WORD_SWAP( "016-p2.bin", 0x080000, 0x020000, | |
| 905 | 930 | |
| 906 | 931 | NEO_SFIX_128K( "016-s1.bin", CRC(1a2eeeb3) SHA1(8d2b96d395020197bc59294b6b0c8d62b1d8d4dd) ) |
| 907 | 932 | |
| 908 | NEO_BIOS_AUDIO_128K( "016-m1.bin", CRC(0296abcb) SHA1(560046f256cd339fa685d0d38d55317cb6adfa99) ) | |
| 933 | /* TC531001 */ | |
| 934 | NEO_BIOS_AUDIO_128K( "016-m1.bin", CRC(9da9ca10) SHA1(88b915827d529f39c365d3e41197d5461e07a085) ) | |
| 909 | 935 | |
| 910 | 936 | ROM_REGION( 0x200000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 911 | 937 | ROM_LOAD( "016-v1.bin", 0x000000, 0x100000, CRC(86c0a502) SHA1(7fe2db0c64aefdd14d6c36f7fcd6442591e9a014) ) |
| r2844 | r2845 | |
| 923 | 949 | ROM_START( kotmh ) /* AES VERSION */ |
| 924 | 950 | ROM_REGION( 0x100000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 925 | 951 | ROM_LOAD16_WORD_SWAP( "016-hp1.bin",0x000000, 0x080000, CRC(b774621e) SHA1(7684b2e07163aec68cd083ef1d8900f855f6cb42) ) |
| 926 | ROM_LOAD16_WORD_SWAP( "016-p2.bin", 0x080000, 0x020000, | |
| 952 | ROM_LOAD16_WORD_SWAP( "016-p2.bin", 0x080000, 0x020000, | |
| 927 | 953 | |
| 928 | 954 | NEO_SFIX_128K( "016-s1.bin", CRC(1a2eeeb3) SHA1(8d2b96d395020197bc59294b6b0c8d62b1d8d4dd) ) |
| 929 | 955 | |
| 930 | NEO_BIOS_AUDIO_128K( "016-m1.bin", CRC(0296abcb) SHA1(560046f256cd339fa685d0d38d55317cb6adfa99) ) | |
| 956 | /* TC531001 */ | |
| 957 | NEO_BIOS_AUDIO_128K( "016-m1.bin", CRC(9da9ca10) SHA1(88b915827d529f39c365d3e41197d5461e07a085) ) | |
| 931 | 958 | |
| 932 | 959 | ROM_REGION( 0x200000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 933 | 960 | ROM_LOAD( "016-v1.bin", 0x000000, 0x100000, CRC(86c0a502) SHA1(7fe2db0c64aefdd14d6c36f7fcd6442591e9a014) ) |
| r2844 | r2845 | |
| 992 | 1019 | |
| 993 | 1020 | NEO_SFIX_128K( "018-s1.bin", CRC(6799ea0d) SHA1(ec75ef9dfdcb0b123574fc6d81ebaaadfba32fb5) ) |
| 994 | 1021 | |
| 995 | NEO_BIOS_AUDIO_128K( "018-m1.bin", BAD_DUMP CRC(0c939ee2) SHA1(57d580d3279e66b9fe66bbcc68529d3384a926ff) ) | |
| 1022 | /* HN62321A */ | |
| 1023 | NEO_BIOS_AUDIO_128K( "018-m1.bin", CRC(0c939ee2) SHA1(57d580d3279e66b9fe66bbcc68529d3384a926ff) ) | |
| 996 | 1024 | |
| 997 | 1025 | ROM_REGION( 0x200000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 998 | 1026 | ROM_LOAD( "018-v1.bin", 0x000000, 0x100000, CRC(508c9ffc) SHA1(cd3a97a233a4585f8507116aba85884623cccdc4) ) |
| r2844 | r2845 | |
| 1013 | 1041 | |
| 1014 | 1042 | NEO_SFIX_128K( "018-s1.bin", CRC(6799ea0d) SHA1(ec75ef9dfdcb0b123574fc6d81ebaaadfba32fb5) ) |
| 1015 | 1043 | |
| 1016 | NEO_BIOS_AUDIO_128K( "018-m1.bin", BAD_DUMP CRC(0c939ee2) SHA1(57d580d3279e66b9fe66bbcc68529d3384a926ff) ) | |
| 1044 | /* HN62321A */ | |
| 1045 | NEO_BIOS_AUDIO_128K( "018-m1.bin", CRC(0c939ee2) SHA1(57d580d3279e66b9fe66bbcc68529d3384a926ff) ) | |
| 1017 | 1046 | |
| 1018 | 1047 | ROM_REGION( 0x200000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 1019 | 1048 | ROM_LOAD( "018-v1.bin", 0x000000, 0x100000, CRC(508c9ffc) SHA1(cd3a97a233a4585f8507116aba85884623cccdc4) ) |
| r2844 | r2845 | |
| 1034 | 1063 | |
| 1035 | 1064 | NEO_SFIX_128K( "019-s1.bin", CRC(5fcdc0ed) SHA1(86415077e7adc3ba6153eeb4fb0c62cf36e903fa) ) |
| 1036 | 1065 | |
| 1037 | NEO_BIOS_AUDIO_128K( "019-m1.bin", CRC(589d7f25) SHA1(9cffbf0a607a7c7f5bc21cf6d33c5b21c3354913) ) | |
| 1066 | /* TC531001 */ | |
| 1067 | NEO_BIOS_AUDIO_128K( "019-m1.bin", CRC(d568c17d) SHA1(a2e318ed6ad1809c79f3f0853d75e0dd1a2f275c) ) | |
| 1038 | 1068 | |
| 1039 | 1069 | ROM_REGION( 0x100000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 1040 | 1070 | ROM_LOAD( "019-v11.bin", 0x000000, 0x080000, CRC(0fb74872) SHA1(38c555926c77576d63472bc075210c42e9ce13a3) ) |
| r2844 | r2845 | |
| 1102 | 1132 | |
| 1103 | 1133 | NEO_SFIX_128K( "021-s1.bin", CRC(6956d778) SHA1(e3757776d60dc07d8e07c9ca61b223b14732f860) ) |
| 1104 | 1134 | |
| 1105 | NEO_BIOS_AUDIO_128K( "021-m1.bin", CRC(ba5e0946) SHA1(247ab832de9054e6a7a381a15f1eae44e41250b9) ) | |
| 1135 | /* MB832000 */ | |
| 1136 | NEO_BIOS_AUDIO_256K( "021-m1.bin", CRC(5a4be5e8) SHA1(552f025ce0d51c25f42e1a81cf0d08376ca5475d) ) | |
| 1106 | 1137 | |
| 1107 | 1138 | ROM_REGION( 0x080000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 1108 | 1139 | ROM_LOAD( "021-v11.bin", 0x000000, 0x080000, CRC(66c1e5c4) SHA1(7e85420021d4c39c36ed75a1cec567c5610ffce0) ) |
| r2844 | r2845 | |
| 1258 | 1289 | ROM_LOAD16_BYTE( "030-c4.bin", 0x200001, 0x100000, CRC(780d1c4e) SHA1(2e2cf9de828e3b48642dd2203637103438c62142) ) /* Plane 2,3 */ |
| 1259 | 1290 | ROM_END |
| 1260 | 1291 | |
| 1261 | ROM_START( 2020bba ) | |
| 1292 | ROM_START( 2020bba ) /* AES VERSION */ | |
| 1262 | 1293 | ROM_REGION( 0x100000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 1263 | ROM_LOAD16_WORD_SWAP( "030-p1.rom", 0x000000, 0x080000, CRC(c59be3dd) SHA1(4fbd462c1c18e85a252c58b04b54fd3b82b46cb0) ) | |
| 1294 | ROM_LOAD16_WORD_SWAP( "030-epr.p1", 0x000000, 0x080000, CRC(c59be3dd) SHA1(4fbd462c1c18e85a252c58b04b54fd3b82b46cb0) ) | |
| 1295 | /* P1 on eprom, correct chip label unknown */ | |
| 1264 | 1296 | |
| 1265 | 1297 | NEO_SFIX_128K( "030-s1.bin", CRC(7015b8fc) SHA1(8c09bc3e6c62e0f7c9557c1e10c901be325bae7f) ) |
| 1266 | 1298 | |
| r2844 | r2845 | |
| 1306 | 1338 | |
| 1307 | 1339 | NEO_SFIX_128K( "031-s1.bin", CRC(4c117174) SHA1(26e52c4f628338a9aa1c159517cdf873f738fb98) ) |
| 1308 | 1340 | |
| 1309 | NEO_BIOS_AUDIO_128K( "031-m1.bin", CRC(3aa4e9e1) SHA1(65e53d799a0cb55b5bc55d57773e4682a72d7c2d) ) | |
| 1341 | /* TC531001 */ | |
| 1342 | NEO_BIOS_AUDIO_128K( "031-m1.bin", CRC(cb37427c) SHA1(99efe9600ebeda48331f396e3203c7588bdb7d24) ) | |
| 1310 | 1343 | |
| 1311 | 1344 | ROM_REGION( 0x200000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 1312 | 1345 | ROM_LOAD( "031-v1.bin", 0x000000, 0x100000, CRC(cc78497e) SHA1(895bd647150fae9b2259ef043ed681f4c4de66ea) ) |
| r2844 | r2845 | |
| 1327 | 1360 | |
| 1328 | 1361 | NEO_SFIX_128K( "031-s1.bin", CRC(4c117174) SHA1(26e52c4f628338a9aa1c159517cdf873f738fb98) ) |
| 1329 | 1362 | |
| 1330 | NEO_BIOS_AUDIO_128K( "031-m1.bin", CRC(3aa4e9e1) SHA1(65e53d799a0cb55b5bc55d57773e4682a72d7c2d) ) | |
| 1363 | /* TC531001 */ | |
| 1364 | NEO_BIOS_AUDIO_128K( "031-m1.bin", CRC(cb37427c) SHA1(99efe9600ebeda48331f396e3203c7588bdb7d24) ) | |
| 1331 | 1365 | |
| 1332 | 1366 | ROM_REGION( 0x200000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 1333 | 1367 | ROM_LOAD( "031-v1.bin", 0x000000, 0x100000, CRC(cc78497e) SHA1(895bd647150fae9b2259ef043ed681f4c4de66ea) ) |
| r2844 | r2845 | |
| 1884 | 1918 | |
| 1885 | 1919 | ROM_START( wh1 ) /* MVS VERSION */ |
| 1886 | 1920 | ROM_REGION( 0x100000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 1887 | ROM_LOAD16_WORD_SWAP( "053-p1.bin", 0x000000, 0x080000, CRC(d42e1e9a) SHA1(9d1911fe4bf6202466ec45557dd008cbf01ca9c6) ) | |
| 1888 | ROM_LOAD16_WORD_SWAP( "053-p2.bin", 0x080000, 0x080000, CRC(0e33e8a3) SHA1(4b7086edb504f3c30529d51ba8f453d48eba5164) ) | |
| 1921 | ROM_LOAD16_WORD_SWAP( "053-epr.p1", 0x000000, 0x080000, CRC(d42e1e9a) SHA1(9d1911fe4bf6202466ec45557dd008cbf01ca9c6) ) | |
| 1922 | ROM_LOAD16_WORD_SWAP( "053-epr.p2", 0x080000, 0x080000, CRC(0e33e8a3) SHA1(4b7086edb504f3c30529d51ba8f453d48eba5164) ) | |
| 1923 | /* P's on eprom, correct chip label unknown */ | |
| 1889 | 1924 | |
| 1890 | 1925 | NEO_SFIX_128K( "053-s1.bin", CRC(8c2c2d6b) SHA1(87fa79611c6f8886dcc8766814829c669c65b40f) ) |
| 1891 | 1926 | |
| r2844 | r2845 | |
| 1908 | 1943 | |
| 1909 | 1944 | ROM_START( wh1h ) /* AES VERSION */ |
| 1910 | 1945 | ROM_REGION( 0x100000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 1911 | ROM_LOAD16_WORD_SWAP( "053-p1.rom", 0x000000, 0x080000, CRC(95b574cb) SHA1(b7b7af6a04c3d902e7f8852897741ecaf0b1062c) ) | |
| 1912 | ROM_LOAD16_WORD_SWAP( "053-p2.rom", 0x080000, 0x080000, CRC(f198ed45) SHA1(24ccc091e97f63796562bb5b30df51f39bd504ef) ) | |
| 1946 | ROM_LOAD16_WORD_SWAP( "053-p1.bin", 0x000000, 0x080000, CRC(95b574cb) SHA1(b7b7af6a04c3d902e7f8852897741ecaf0b1062c) ) | |
| 1947 | ROM_LOAD16_WORD_SWAP( "053-p2.bin", 0x080000, 0x080000, CRC(f198ed45) SHA1(24ccc091e97f63796562bb5b30df51f39bd504ef) ) | |
| 1913 | 1948 | |
| 1914 | 1949 | NEO_SFIX_128K( "053-s1.bin", CRC(8c2c2d6b) SHA1(87fa79611c6f8886dcc8766814829c669c65b40f) ) |
| 1915 | 1950 | |
| r2844 | r2845 | |
| 2356 | 2391 | |
| 2357 | 2392 | NEO_SFIX_128K( "067-s1.bin", CRC(4f0cbd58) SHA1(509bad8416a057d5239439e775640b71ccf09ef7) ) |
| 2358 | 2393 | |
| 2359 | NEO_BIOS_AUDIO_64K( "067-m1.bin", CRC(833cdf1b) SHA1(3a92c79adbe0d37956ea46a4746d6f1cbf7d2c14) ) | |
| 2394 | NEO_BIOS_AUDIO_64K( "067-m1.bin", BAD_DUMP CRC(833cdf1b) SHA1(3a92c79adbe0d37956ea46a4746d6f1cbf7d2c14) ) | |
| 2360 | 2395 | |
| 2361 | 2396 | ROM_REGION( 0x80000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 2362 | 2397 | ROM_LOAD( "067-v1.bin", 0x000000, 0x80000, CRC(cf23afd0) SHA1(10f87014ee10613f92b04f482f449721a6379db7) ) |
| r2844 | r2845 | |
| 2652 | 2687 | ROM_LOAD16_BYTE( "082-c8.bin", 0xc00001, 0x100000, CRC(69a5fa37) SHA1(020e70e0e8b3c5d00a40fe97e418115a3187e50a) ) /* Plane 2,3 */ |
| 2653 | 2688 | ROM_END |
| 2654 | 2689 | |
| 2655 | ROM_START( pbobblen ) | |
| 2690 | ROM_START( pbobblen ) /* MVS VERSION */ | |
| 2691 | /* This set uses CHA and PROG board from Power Spikes II. Six Power Spikes II prom's are replaced with | |
| 2692 | Puzzle Bobble prom's. Confirmed on two original carts. Do other layouts also exist? Later production run set? */ | |
| 2693 | ||
| 2656 | 2694 | ROM_REGION( 0x100000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 2657 | ROM_LOAD16_WORD_SWAP( " | |
| 2695 | ROM_LOAD16_WORD_SWAP( "d96-07.ep1 | |
| 2658 | 2696 | |
| 2659 | NEO_SFIX_128K( " | |
| 2697 | NEO_SFIX_128K( "d96-04.s1 | |
| 2660 | 2698 | |
| 2661 | NEO_BIOS_AUDIO_128K( " | |
| 2699 | NEO_BIOS_AUDIO_128K( "d96-06.m1 | |
| 2662 | 2700 | |
| 2663 | 2701 | ROM_REGION( 0x380000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 2664 | /* 0x000000-0x1fffff empty */ | |
| 2665 | ROM_LOAD( "083-v3.bin", 0x200000, 0x100000, CRC(0840cbc4) SHA1(1adbd7aef44fa80832f63dfb8efdf69fd7256a57) ) | |
| 2666 | ROM_LOAD( "083-v4.bin", 0x300000, 0x080000, CRC(0a548948) SHA1(e1e4afd17811cb60401c14fbcf0465035165f4fb) ) | |
| 2702 | ROM_LOAD( "068-v1.bin", 0x000000, 0x100000, CRC(2ced86df) SHA1(d6b73d1f31efbd74fb745200d4dade5f80b71541) ) /* unused */ | |
| 2703 | ROM_LOAD( "068-v2.bin", 0x100000, 0x100000, CRC(970851ab) SHA1(6c9b04e9cc6b92133f1154e5bdd9d38d8ef050a7) ) /* unused */ | |
| 2704 | ROM_LOAD( "d96-01.v3", 0x200000, 0x100000, CRC(0840cbc4) SHA1 (1adbd7aef44fa80832f63dfb8efdf69fd7256a57) ) | |
| 2705 | ROM_LOAD( "d96-05.v4", 0x300000, 0x080000, CRC(0a548948) SHA1 (e1e4afd17811cb60401c14fbcf0465035165f4fb) ) | |
| 2667 | 2706 | |
| 2668 | 2707 | NO_DELTAT_REGION |
| 2669 | 2708 | |
| 2670 | ROM_REGION( 0x100000, NEOGEO_REGION_SPRITES, ROMREGION_DISPOSE ) | |
| 2671 | ROM_LOAD16_BYTE( "083-c5.bin", 0x000000, 0x080000, CRC(e89ad494) SHA1(69c9ea415773af94ac44c48af05d55ada222b138) ) /* Plane 0,1 */ | |
| 2672 | ROM_LOAD16_BYTE( "083-c6.bin", 0x000001, 0x080000, CRC(4b42d7eb) SHA1(042ae50a528cea21cf07771d3915c57aa16fd5af) ) /* Plane 2,3 */ | |
| 2709 | ROM_REGION( 0x500000, NEOGEO_REGION_SPRITES, ROMREGION_DISPOSE ) | |
| 2710 | ROM_LOAD16_BYTE( "068-c1.bin", 0x000000, 0x100000, CRC(7f250f76) SHA1(5109a41adcb7859e24dc43d88842d4cc18cd3305) ) /* unused */ | |
| 2711 | ROM_LOAD16_BYTE( "068-c2.bin", 0x000001, 0x100000, CRC(20912873) SHA1(2df8766b531e47ffc30457e41c63b83557b4f468) ) /* unused */ | |
| 2712 | ROM_LOAD16_BYTE( "068-c3.bin", 0x200000, 0x100000, CRC(4b641ba1) SHA1(7a9c42a30163eda455f7bde2302402b1a5de7178) ) /* unused */ | |
| 2713 | ROM_LOAD16_BYTE( "068-c4.bin", 0x200001, 0x100000, CRC(35072596) SHA1(4150a21041f06514c97592bd8af686504b06e187) ) /* unused */ | |
| 2714 | ROM_LOAD16_BYTE( "d96-02.c5", 0x400000, 0x80000, CRC(e89ad494) SHA1 (69c9ea415773af94ac44c48af05d55ada222b138) ) /* Plane 0,1 */ | |
| 2715 | ROM_LOAD16_BYTE( "d96-03.c6", 0x400001, 0x80000, CRC(4b42d7eb) SHA1 (042ae50a528cea21cf07771d3915c57aa16fd5af) ) /* Plane 2,3 */ | |
| 2673 | 2716 | ROM_END |
| 2674 | 2717 | |
| 2675 | 2718 | ROM_START( pbobblna ) |
| 2719 | /* Does this set exist? Layout correct? */ | |
| 2676 | 2720 | ROM_REGION( 0x100000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 2677 | ROM_LOAD16_WORD_SWAP( "083-p1. | |
| 2721 | ROM_LOAD16_WORD_SWAP( "083-p1.bin", 0x000000, 0x080000, CRC(ac1e9ef3) SHA1(a2b125ee70869667431ab125bc29e768500802ad) ) | |
| 2678 | 2722 | |
| 2679 | NEO_SFIX_128K( " | |
| 2723 | NEO_SFIX_128K( "d96-04.s1 | |
| 2680 | 2724 | |
| 2681 | NEO_BIOS_AUDIO_128K( " | |
| 2725 | NEO_BIOS_AUDIO_128K( "d96-06.m1 | |
| 2682 | 2726 | |
| 2683 | 2727 | ROM_REGION( 0x380000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 2684 | 2728 | /* 0x000000-0x1fffff empty */ |
| 2685 | ROM_LOAD( "083-v3.bin", 0x200000, 0x100000, CRC(0840cbc4) SHA1(1adbd7aef44fa80832f63dfb8efdf69fd7256a57) ) | |
| 2686 | ROM_LOAD( "083-v4.bin", 0x300000, 0x080000, CRC(0a548948) SHA1(e1e4afd17811cb60401c14fbcf0465035165f4fb) ) | |
| 2729 | ROM_LOAD( "d96-01.v3", 0x200000, 0x100000, CRC(0840cbc4) SHA1 (1adbd7aef44fa80832f63dfb8efdf69fd7256a57) ) | |
| 2730 | ROM_LOAD( "d96-05.v4", 0x300000, 0x080000, CRC(0a548948) SHA1 (e1e4afd17811cb60401c14fbcf0465035165f4fb) ) | |
| 2687 | 2731 | |
| 2688 | 2732 | NO_DELTAT_REGION |
| 2689 | 2733 | |
| 2690 | 2734 | ROM_REGION( 0x100000, NEOGEO_REGION_SPRITES, ROMREGION_DISPOSE ) |
| 2691 | ROM_LOAD16_BYTE( "083-c5.bin", 0x000000, 0x080000, CRC(e89ad494) SHA1(69c9ea415773af94ac44c48af05d55ada222b138) ) /* Plane 0,1 */ | |
| 2692 | ROM_LOAD16_BYTE( "083-c6.bin", 0x000001, 0x080000, CRC(4b42d7eb) SHA1(042ae50a528cea21cf07771d3915c57aa16fd5af) ) /* Plane 2,3 */ | |
| 2735 | ROM_LOAD16_BYTE( "d96-02.c5", 0x000000, 0x80000, CRC(e89ad494) SHA1 (69c9ea415773af94ac44c48af05d55ada222b138) ) /* Plane 0,1 */ | |
| 2736 | ROM_LOAD16_BYTE( "d96-03.c6", 0x000001, 0x80000, CRC(4b42d7eb) SHA1 (042ae50a528cea21cf07771d3915c57aa16fd5af) ) /* Plane 2,3 */ | |
| 2693 | 2737 | ROM_END |
| 2694 | 2738 | |
| 2695 | 2739 | ROM_START( kof95 ) |
| r2844 | r2845 | |
| 2702 | 2746 | NEO_BIOS_AUDIO_128K( "084-m1.bin", CRC(6f2d7429) SHA1(6f8462e4f07af82a5ca3197895d5dcbb67bdaa61) ) |
| 2703 | 2747 | |
| 2704 | 2748 | ROM_REGION( 0x900000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 2705 | // | |
| 2749 | // | |
| 2706 | 2750 | ROM_LOAD( "084-v1.bin", 0x000000, 0x400000, CRC(84861b56) SHA1(1b6c91ddaed01f45eb9b7e49d9c2b9b479d50da6) ) |
| 2707 | 2751 | ROM_LOAD( "084-v2.bin", 0x400000, 0x200000, CRC(b38a2803) SHA1(dbc2c8606ca09ed7ff20906b022da3cf053b2f09) ) |
| 2708 | 2752 | /* 600000-7fffff empty */ |
| r2844 | r2845 | |
| 2810 | 2854 | ROM_LOAD16_BYTE( "087-c8.bin", 0x1800001, 0x100000, CRC(a9e82717) SHA1(e39ee15d5140dbe7f06eea945cce9984a5e8b06a) ) /* Plane 2,3 */ |
| 2811 | 2855 | ROM_END |
| 2812 | 2856 | |
| 2813 | ROM_START( samsho3a ) | |
| 2857 | ROM_START( samsho3a ) /* MVS VERSION */ | |
| 2814 | 2858 | ROM_REGION( 0x300000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 2815 | 2859 | ROM_LOAD16_WORD_SWAP( "087-ep1.bin", 0x000000, 0x080000, CRC(23e09bb8) SHA1(79da99fa50a639fce9d1266699b5e53c9ac55642) ) |
| 2816 | 2860 | ROM_LOAD16_WORD_SWAP( "087-ep2.bin", 0x080000, 0x080000, CRC(256f5302) SHA1(e2d21b413a6059194a994b7902b2a7df98a15151) ) |
| r2844 | r2845 | |
| 2841 | 2885 | |
| 2842 | 2886 | ROM_START( fswords ) |
| 2843 | 2887 | ROM_REGION( 0x300000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 2844 | ROM_LOAD16_WORD_SWAP( " | |
| 2888 | ROM_LOAD16_WORD_SWAP( "187-p1k.bin", 0x000000, 0x100000, CRC(c8e7c075) SHA1(7b74f2917114460d79d8f46ee24829a4c08cbf2a) ) | |
| 2845 | 2889 | ROM_LOAD16_WORD_SWAP( "087-p2.bin", 0x100000, 0x200000, CRC(9bbe27e0) SHA1(b18117102159903c8e8f4e4226e1cc91a400e816) ) |
| 2846 | 2890 | |
| 2847 | 2891 | NEO_SFIX_128K( "087-s1.bin", CRC(74ec7d9f) SHA1(d79c479838a7ca51735a44f91f1968ec5b3c6b91) ) |
| r2844 | r2845 | |
| 3101 | 3145 | |
| 3102 | 3146 | ROM_START( aof3k ) |
| 3103 | 3147 | ROM_REGION( 0x300000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 3104 | ROM_LOAD16_WORD_SWAP( " | |
| 3148 | ROM_LOAD16_WORD_SWAP( "196-p1k.bin", 0x000000, 0x100000, CRC(a0780789) SHA1(83657922a9a3502653ef8cda45b15d9f935aa96a) ) | |
| 3105 | 3149 | ROM_LOAD16_WORD_SWAP( "096-p2.bin", 0x100000, 0x200000, CRC(4d5a2602) SHA1(4c26d6135d2877d9c38169662033e9d0cc24d943) ) |
| 3106 | 3150 | |
| 3107 | 3151 | NEO_SFIX_128K( "096-s1.bin", CRC(cc7fd344) SHA1(2c6846cf8ea61fb192ba181dbccb63594d572c0e) ) |
| r2844 | r2845 | |
| 3232 | 3276 | ROM_REGION( 0x100000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 3233 | 3277 | ROM_LOAD16_WORD_SWAP( "206-p1.bin", 0x000000, 0x100000, CRC(c33ed21e) SHA1(bffff0d17e587e67672227e60c0ebd3f3a7193e6) ) |
| 3234 | 3278 | |
| 3235 | NEO_SFIX_ | |
| 3279 | NEO_SFIX_128K( "206-s1.bin", CRC(f0b68780 | |
| 3236 | 3280 | |
| 3237 | 3281 | NEO_BIOS_AUDIO_128K( "206-m1.bin", CRC(0e22902e) SHA1(fb8466c342d4abd8bb4cad01c6ceab03f96cdad8) ) |
| 3238 | 3282 | |
| r2844 | r2845 | |
| 3243 | 3287 | NO_DELTAT_REGION |
| 3244 | 3288 | |
| 3245 | 3289 | ROM_REGION( 0xa00000, NEOGEO_REGION_SPRITES, ROMREGION_DISPOSE ) |
| 3246 | ROM_LOAD16_BYTE( "206-c1.bin", 0x000000, 0x400000, CRC(4bd5e70f) SHA1(2cd546aafb73e0523655f53b134955ebc273aacd) ) /* Plane 0,1 */ | |
| 3247 | ROM_LOAD16_BYTE( "206-c2.bin", 0x000001, 0x400000, CRC(67dbe24d) SHA1(37047c4e52525ff6d39a462222ec3e4cfc63e31c) ) /* Plane 2,3 */ | |
| 3290 | ROM_LOAD16_BYTE( "206-c1.bin", 0x000000, 0x400000, CRC(846e4e8e) SHA1(ba9b96340aca7fadaff0e6d484391ddb5c5e7bd4) ) /* Plane 0,1 */ | |
| 3291 | ROM_LOAD16_BYTE( "206-c2.bin", 0x000001, 0x400000, CRC(1cba876d) SHA1(3254ceb5a2f76c172930d9889d5d81e093e87628) ) /* Plane 2,3 */ | |
| 3248 | 3292 | ROM_LOAD16_BYTE( "206-c3.bin", 0x800000, 0x100000, CRC(79aa2b48) SHA1(31f94217cd35f48845c74a55256314c16fd26ed7) ) /* Plane 0,1 */ |
| 3249 | 3293 | ROM_LOAD16_BYTE( "206-c4.bin", 0x800001, 0x100000, CRC(55e1314d) SHA1(fffbc9eb9000ff5b1063af1817de7ea4a267fedd) ) /* Plane 2,3 */ |
| 3250 | 3294 | ROM_END |
| r2844 | r2845 | |
| 3912 | 3956 | |
| 3913 | 3957 | ROM_START( lastsold ) |
| 3914 | 3958 | ROM_REGION( 0x500000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 3915 | ROM_LOAD16_WORD_SWAP( " | |
| 3959 | ROM_LOAD16_WORD_SWAP( "134-p1k.bin", 0x000000, 0x100000, CRC(906f3065) SHA1(25167665f1b8e82e13f7fcf4d0e3c54a925c2a58) ) | |
| 3916 | 3960 | ROM_LOAD16_WORD_SWAP( "234-p2.bin", 0x100000, 0x400000, CRC(0fdc289e) SHA1(1ff31c0b0f4f9ddbedaf4bcf927faaae81892ec7) ) |
| 3917 | 3961 | |
| 3918 | 3962 | NEO_SFIX_128K( "234-s1.bin", CRC(95561412) SHA1(995de272f572fd08d909d3d0af4251b9957b3640) ) |
| r2844 | r2845 | |
| 4134 | 4178 | |
| 4135 | 4179 | ROM_START( rbff2k ) |
| 4136 | 4180 | ROM_REGION( 0x500000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 4137 | ROM_LOAD16_WORD_SWAP( " | |
| 4181 | ROM_LOAD16_WORD_SWAP( "140-p1k.bin", 0x000000, 0x100000, CRC(965edee1) SHA1(7f4b947b19ccfee32fc73e4fd89645eb313b5c77) ) | |
| 4138 | 4182 | ROM_LOAD16_WORD_SWAP( "240-p2.bin", 0x100000, 0x400000, CRC(960aa88d) SHA1(3d9e785891871af90313f178dca2724633406674) ) |
| 4139 | 4183 | |
| 4140 | 4184 | NEO_SFIX_128K( "240-s1.bin", CRC(da3b40de) SHA1(e6bf74e057ac6fe1f249a7547f13ba7fbc694561) ) |
| r2844 | r2845 | |
| 4581 | 4625 | ROM_END |
| 4582 | 4626 | |
| 4583 | 4627 | ROM_START( kof99n ) /* Original Version - Encrypted GFX */ |
| 4628 | /* If chip label / ID correct: Korean Version ? */ | |
| 4584 | 4629 | ROM_REGION( 0x500000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 4585 | 4630 | ROM_LOAD16_WORD_SWAP( "152-p1.bin", 0x000000, 0x100000, CRC(f2c7ddfa) SHA1(d592eecc53d442c55c2f26a6a721fdf2924d2a5b) ) |
| 4586 | 4631 | ROM_LOAD16_WORD_SWAP( "152-p2.bin", 0x100000, 0x400000, CRC(274ef47a) SHA1(98654b68cc85c19d4a90b46f3110f551fa2e5357) ) |
| r2844 | r2845 | |
| 4900 | 4945 | ROM_LOAD16_BYTE( "256-c8.bin", 0x3000001, 0x800000, CRC(4d9be34c) SHA1(a737bdfa2b815aea7067e7af2636e83a9409c414) ) /* Plane 2,3 */ |
| 4901 | 4946 | ROM_END |
| 4902 | 4947 | |
| 4903 | ROM_START( mslug3 | |
| 4948 | ROM_START( mslug3h ) /* Original Version - Encrypted GFX */ /* AES VERSION */ | |
| 4904 | 4949 | ROM_REGION( 0x500000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 4905 | 4950 | ROM_LOAD16_WORD_SWAP( "256-ph1.bin", 0x000000, 0x100000, CRC(9c42ca85) SHA1(7a8f77a89867b889295ae9b9dfd4ba28f02d234d) ) |
| 4906 | 4951 | ROM_LOAD16_WORD_SWAP( "256-ph2.bin", 0x100000, 0x400000, CRC(1f3d8ce8) SHA1(08b05a8abfb86ec09a5e758d6273acf1489961f9) ) |
| r2844 | r2845 | |
| 5157 | 5202 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5158 | 5203 | |
| 5159 | 5204 | /* The M1 ROM is encrypted, we load it here for reference and replace it with a decrypted version */ |
| 5160 | ROM_REGION( 0x20000, NEOGEO_REGION_AUDIO_CPU_ENCRYPTED, 0 ) | |
| 5161 | ROM_LOAD( "265-262-m1.bin", 0x00000, 0x20000, CRC(1d5aab51) SHA1(52327c5bcad87770419057097cca20a3b187bec3) ) /* yes it really does have a strange name */ | |
| 5205 | ROM_REGION( 0x40000, NEOGEO_REGION_AUDIO_CPU_ENCRYPTED, 0 ) | |
| 5206 | ROM_LOAD( "265-262-m1.bin", 0x00000, 0x40000, CRC(a7f8119f) SHA1(71805b39b8b09c32425cf39f9de59b2f755976c2) ) /* yes it really does have a strange name */ | |
| 5162 | 5207 | /* Decrypted */ |
| 5163 | NEO_BIOS_AUDIO_ | |
| 5208 | NEO_BIOS_AUDIO_ | |
| 5164 | 5209 | |
| 5165 | 5210 | ROM_REGION( 0x1000000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 5166 | ROM_LOAD( "262-v1.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) | |
| 5167 | ROM_LOAD( "262-v2.bin", 0x400000, 0x400000, CRC(003f1843) SHA1(bdd58837ad542548bd4053c262f558af88e3b989) ) | |
| 5168 | ROM_LOAD( "262-v3.bin", 0x800000, 0x400000, CRC(2ae38dbe) SHA1(4e82b7dd3b899d61907620517a5a27bdaba0725d) ) | |
| 5169 | ROM_LOAD( "262-v4.bin", 0xc00000, 0x400000, CRC(26ec4dd9) SHA1(8bd68d95a2d913be41a51f51e48dbe3bff5924fb) ) | |
| 5211 | ROM_LOAD( "262-v1-08-e0.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) | |
| 5212 | ROM_LOAD( "262-v2-08-e0.bin", 0x400000, 0x400000, CRC(003f1843) SHA1(bdd58837ad542548bd4053c262f558af88e3b989) ) | |
| 5213 | ROM_LOAD( "262-v3-08-e0.bin", 0x800000, 0x400000, CRC(2ae38dbe) SHA1(4e82b7dd3b899d61907620517a5a27bdaba0725d) ) | |
| 5214 | ROM_LOAD( "262-v4-08-e0.bin", 0xc00000, 0x400000, CRC(26ec4dd9) SHA1(8bd68d95a2d913be41a51f51e48dbe3bff5924fb) ) | |
| 5170 | 5215 | |
| 5171 | 5216 | NO_DELTAT_REGION |
| 5172 | 5217 | |
| 5173 | 5218 | ROM_REGION( 0x4000000, NEOGEO_REGION_SPRITES, ROMREGION_DISPOSE ) |
| 5174 | 5219 | /* Encrypted */ |
| 5175 | ROM_LOAD16_BYTE( "262-c1.bin", 0x0000000, 0x800000, CRC(99cc785a) SHA1(374f0674871d0196fa274aa6c5956d7b3848d5da) ) /* Plane 0,1 */ | |
| 5176 | ROM_LOAD16_BYTE( "262-c2.bin", 0x0000001, 0x800000, CRC(50368cbf) SHA1(5d9e206e98e0b0c7735b72ea46b45058fdec2352) ) /* Plane 2,3 */ | |
| 5177 | ROM_LOAD16_BYTE( "262-c3.bin", 0x1000000, 0x800000, CRC(fb14ff87) SHA1(445a8db2fc69eff54a252700f2d3a89244c58e75) ) /* Plane 0,1 */ | |
| 5178 | ROM_LOAD16_BYTE( "262-c4.bin", 0x1000001, 0x800000, CRC(4397faf8) SHA1(6752b394f6647502a649a3e62bd3442f936b733e) ) /* Plane 2,3 */ | |
| 5179 | ROM_LOAD16_BYTE( "262-c5.bin", 0x2000000, 0x800000, CRC(91f24be4) SHA1(88190c41f7d4a0f4b1982149fc9acfc640af498d) ) /* Plane 0,1 */ | |
| 5180 | ROM_LOAD16_BYTE( "262-c6.bin", 0x2000001, 0x800000, CRC(a31e4403) SHA1(5cd1a14703aa58810e2377dfb7353c61e9dc9c1f) ) /* Plane 2,3 */ | |
| 5181 | ROM_LOAD16_BYTE( "262-c7.bin", 0x3000000, 0x800000, CRC(54d9d1ec) SHA1(80c3a8ec39130dd5d3da561f287709da6b8abcf4) ) /* Plane 0,1 */ | |
| 5182 | ROM_LOAD16_BYTE( "262-c8.bin", 0x3000001, 0x800000, CRC(59289a6b) SHA1(ddfce7c85b2a144975db5bb14b4b51aaf881880e) ) /* Plane 2,3 */ | |
| 5220 | ROM_LOAD16_BYTE( "262-c1-08-e0.bin", 0x0000000, 0x800000, CRC(99cc785a) SHA1(374f0674871d0196fa274aa6c5956d7b3848d5da) ) /* Plane 0,1 */ | |
| 5221 | ROM_LOAD16_BYTE( "262-c2-08-e0.bin", 0x0000001, 0x800000, CRC(50368cbf) SHA1(5d9e206e98e0b0c7735b72ea46b45058fdec2352) ) /* Plane 2,3 */ | |
| 5222 | ROM_LOAD16_BYTE( "262-c3-08-e0.bin", 0x1000000, 0x800000, CRC(fb14ff87) SHA1(445a8db2fc69eff54a252700f2d3a89244c58e75) ) /* Plane 0,1 */ | |
| 5223 | ROM_LOAD16_BYTE( "262-c4-08-e0.bin", 0x1000001, 0x800000, CRC(4397faf8) SHA1(6752b394f6647502a649a3e62bd3442f936b733e) ) /* Plane 2,3 */ | |
| 5224 | ROM_LOAD16_BYTE( "262-c5-08-e0.bin", 0x2000000, 0x800000, CRC(91f24be4) SHA1(88190c41f7d4a0f4b1982149fc9acfc640af498d) ) /* Plane 0,1 */ | |
| 5225 | ROM_LOAD16_BYTE( "262-c6-08-e0.bin", 0x2000001, 0x800000, CRC(a31e4403) SHA1(5cd1a14703aa58810e2377dfb7353c61e9dc9c1f) ) /* Plane 2,3 */ | |
| 5226 | ROM_LOAD16_BYTE( "262-c7-08-e0.bin", 0x3000000, 0x800000, CRC(54d9d1ec) SHA1(80c3a8ec39130dd5d3da561f287709da6b8abcf4) ) /* Plane 0,1 */ | |
| 5227 | ROM_LOAD16_BYTE( "262-c8-08-e0.bin", 0x3000001, 0x800000, CRC(59289a6b) SHA1(ddfce7c85b2a144975db5bb14b4b51aaf881880e) ) /* Plane 2,3 */ | |
| 5183 | 5228 | ROM_END |
| 5184 | 5229 | |
| 5185 | ROM_START( kof2001h ) | |
| 5230 | ROM_START( kof2001h ) /* AES VERSION */ | |
| 5186 | 5231 | ROM_REGION( 0x500000, NEOGEO_REGION_MAIN_CPU_CARTRIDGE, 0 ) |
| 5187 | 5232 | ROM_LOAD16_WORD_SWAP( "262-pg1.bin", 0x000000, 0x100000, CRC(2af7e741) SHA1(e41282d73ed6d521da056f1a16573bb61bfa3826) ) |
| 5188 | 5233 | ROM_LOAD16_WORD_SWAP( "262-pg2.bin", 0x100000, 0x400000, CRC(91eea062) SHA1(82bae42bbeedb9f3aa0c7c0b0a7a69be499cf98f) ) |
| r2844 | r2845 | |
| 5196 | 5241 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5197 | 5242 | |
| 5198 | 5243 | /* The M1 ROM is encrypted, we load it here for reference and replace it with a decrypted version */ |
| 5199 | ROM_REGION( 0x20000, NEOGEO_REGION_AUDIO_CPU_ENCRYPTED, 0 ) | |
| 5200 | ROM_LOAD( "265-262-m1.bin", 0x00000, 0x20000, CRC(1d5aab51) SHA1(52327c5bcad87770419057097cca20a3b187bec3) ) /* yes it really does have a strange name */ | |
| 5244 | ROM_REGION( 0x40000, NEOGEO_REGION_AUDIO_CPU_ENCRYPTED, 0 ) | |
| 5245 | ROM_LOAD( "265-262-m1.bin", 0x00000, 0x40000, CRC(a7f8119f) SHA1(71805b39b8b09c32425cf39f9de59b2f755976c2) ) /* yes it really does have a strange name */ | |
| 5201 | 5246 | /* Decrypted */ |
| 5202 | NEO_BIOS_AUDIO_ | |
| 5247 | NEO_BIOS_AUDIO_ | |
| 5203 | 5248 | |
| 5204 | 5249 | ROM_REGION( 0x1000000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 5205 | ROM_LOAD( "262-v1.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) | |
| 5206 | ROM_LOAD( "262-v2.bin", 0x400000, 0x400000, CRC(003f1843) SHA1(bdd58837ad542548bd4053c262f558af88e3b989) ) | |
| 5207 | ROM_LOAD( "262-v3.bin", 0x800000, 0x400000, CRC(2ae38dbe) SHA1(4e82b7dd3b899d61907620517a5a27bdaba0725d) ) | |
| 5208 | ROM_LOAD( "262-v4.bin", 0xc00000, 0x400000, CRC(26ec4dd9) SHA1(8bd68d95a2d913be41a51f51e48dbe3bff5924fb) ) | |
| 5250 | ROM_LOAD( "262-v1-08-e0.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) | |
| 5251 | ROM_LOAD( "262-v2-08-e0.bin", 0x400000, 0x400000, CRC(003f1843) SHA1(bdd58837ad542548bd4053c262f558af88e3b989) ) | |
| 5252 | ROM_LOAD( "262-v3-08-e0.bin", 0x800000, 0x400000, CRC(2ae38dbe) SHA1(4e82b7dd3b899d61907620517a5a27bdaba0725d) ) | |
| 5253 | ROM_LOAD( "262-v4-08-e0.bin", 0xc00000, 0x400000, CRC(26ec4dd9) SHA1(8bd68d95a2d913be41a51f51e48dbe3bff5924fb) ) | |
| 5209 | 5254 | |
| 5210 | 5255 | NO_DELTAT_REGION |
| 5211 | 5256 | |
| 5212 | 5257 | ROM_REGION( 0x4000000, NEOGEO_REGION_SPRITES, ROMREGION_DISPOSE ) |
| 5213 | 5258 | /* Encrypted */ |
| 5214 | ROM_LOAD16_BYTE( "262-c1.bin", 0x0000000, 0x800000, CRC(99cc785a) SHA1(374f0674871d0196fa274aa6c5956d7b3848d5da) ) /* Plane 0,1 */ | |
| 5215 | ROM_LOAD16_BYTE( "262-c2.bin", 0x0000001, 0x800000, CRC(50368cbf) SHA1(5d9e206e98e0b0c7735b72ea46b45058fdec2352) ) /* Plane 2,3 */ | |
| 5216 | ROM_LOAD16_BYTE( "262-c3.bin", 0x1000000, 0x800000, CRC(fb14ff87) SHA1(445a8db2fc69eff54a252700f2d3a89244c58e75) ) /* Plane 0,1 */ | |
| 5217 | ROM_LOAD16_BYTE( "262-c4.bin", 0x1000001, 0x800000, CRC(4397faf8) SHA1(6752b394f6647502a649a3e62bd3442f936b733e) ) /* Plane 2,3 */ | |
| 5218 | ROM_LOAD16_BYTE( "262-c5.bin", 0x2000000, 0x800000, CRC(91f24be4) SHA1(88190c41f7d4a0f4b1982149fc9acfc640af498d) ) /* Plane 0,1 */ | |
| 5219 | ROM_LOAD16_BYTE( "262-c6.bin", 0x2000001, 0x800000, CRC(a31e4403) SHA1(5cd1a14703aa58810e2377dfb7353c61e9dc9c1f) ) /* Plane 2,3 */ | |
| 5220 | ROM_LOAD16_BYTE( "262-c7.bin", 0x3000000, 0x800000, CRC(54d9d1ec) SHA1(80c3a8ec39130dd5d3da561f287709da6b8abcf4) ) /* Plane 0,1 */ | |
| 5221 | ROM_LOAD16_BYTE( "262-c8.bin", 0x3000001, 0x800000, CRC(59289a6b) SHA1(ddfce7c85b2a144975db5bb14b4b51aaf881880e) ) /* Plane 2,3 */ | |
| 5259 | ROM_LOAD16_BYTE( "262-c1-08-e0.bin", 0x0000000, 0x800000, CRC(99cc785a) SHA1(374f0674871d0196fa274aa6c5956d7b3848d5da) ) /* Plane 0,1 */ | |
| 5260 | ROM_LOAD16_BYTE( "262-c2-08-e0.bin", 0x0000001, 0x800000, CRC(50368cbf) SHA1(5d9e206e98e0b0c7735b72ea46b45058fdec2352) ) /* Plane 2,3 */ | |
| 5261 | ROM_LOAD16_BYTE( "262-c3-08-e0.bin", 0x1000000, 0x800000, CRC(fb14ff87) SHA1(445a8db2fc69eff54a252700f2d3a89244c58e75) ) /* Plane 0,1 */ | |
| 5262 | ROM_LOAD16_BYTE( "262-c4-08-e0.bin", 0x1000001, 0x800000, CRC(4397faf8) SHA1(6752b394f6647502a649a3e62bd3442f936b733e) ) /* Plane 2,3 */ | |
| 5263 | ROM_LOAD16_BYTE( "262-c5-08-e0.bin", 0x2000000, 0x800000, CRC(91f24be4) SHA1(88190c41f7d4a0f4b1982149fc9acfc640af498d) ) /* Plane 0,1 */ | |
| 5264 | ROM_LOAD16_BYTE( "262-c6-08-e0.bin", 0x2000001, 0x800000, CRC(a31e4403) SHA1(5cd1a14703aa58810e2377dfb7353c61e9dc9c1f) ) /* Plane 2,3 */ | |
| 5265 | ROM_LOAD16_BYTE( "262-c7-08-e0.bin", 0x3000000, 0x800000, CRC(54d9d1ec) SHA1(80c3a8ec39130dd5d3da561f287709da6b8abcf4) ) /* Plane 0,1 */ | |
| 5266 | ROM_LOAD16_BYTE( "262-c8-08-e0.bin", 0x3000001, 0x800000, CRC(59289a6b) SHA1(ddfce7c85b2a144975db5bb14b4b51aaf881880e) ) /* Plane 2,3 */ | |
| 5222 | 5267 | ROM_END |
| 5223 | 5268 | |
| 5224 | 5269 | ROM_START( mslug4 ) /* Original Version - Encrypted GFX */ /* MVS VERSION */ |
| r2844 | r2845 | |
| 6276 | 6321 | ROM_Y_ZOOM |
| 6277 | 6322 | |
| 6278 | 6323 | /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ |
| 6279 | ROM_REGION( 0x80000, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE, 0 ) /* larger char set */ | |
| 6280 | ROM_FILL( 0x000000, 0x80000, 0 ) | |
| 6324 | ROM_REGION( 0x20000, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE, 0 ) | |
| 6325 | ROM_FILL( 0x000000, 0x20000, 0 ) | |
| 6281 | 6326 | ROM_REGION( 0x20000, NEOGEO_REGION_FIXED_LAYER_BIOS, 0 ) |
| 6282 | 6327 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 6283 | 6328 | |
| r2844 | r2845 | |
| 6314 | 6359 | ROM_Y_ZOOM |
| 6315 | 6360 | |
| 6316 | 6361 | /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ |
| 6317 | ROM_REGION( 0x80000, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE, 0 ) /* larger char set */ | |
| 6318 | ROM_FILL( 0x000000, 0x80000, 0 ) | |
| 6362 | ROM_REGION( 0x20000, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE, 0 ) | |
| 6363 | ROM_FILL( 0x000000, 0x20000, 0 ) | |
| 6319 | 6364 | ROM_REGION( 0x20000, NEOGEO_REGION_FIXED_LAYER_BIOS, 0 ) |
| 6320 | 6365 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 6321 | 6366 | |
| r2844 | r2845 | |
| 6352 | 6397 | ROM_Y_ZOOM |
| 6353 | 6398 | |
| 6354 | 6399 | /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ |
| 6355 | ROM_REGION( 0x80000, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE, 0 ) /* larger char set */ | |
| 6356 | ROM_FILL( 0x000000, 0x80000, 0 ) | |
| 6400 | ROM_REGION( 0x20000, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE, 0 ) | |
| 6401 | ROM_FILL( 0x000000, 0x20000, 0 ) | |
| 6357 | 6402 | ROM_REGION( 0x20000, NEOGEO_REGION_FIXED_LAYER_BIOS, 0 ) |
| 6358 | 6403 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 6359 | 6404 | |
| r2844 | r2845 | |
| 6482 | 6527 | |
| 6483 | 6528 | /* sound roms are identical to kof2001 */ |
| 6484 | 6529 | ROM_REGION( 0x1000000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 6485 | ROM_LOAD( "262-v1.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) | |
| 6486 | ROM_LOAD( "262-v2.bin", 0x400000, 0x400000, CRC(003f1843) SHA1(bdd58837ad542548bd4053c262f558af88e3b989) ) | |
| 6487 | ROM_LOAD( "262-v3.bin", 0x800000, 0x400000, CRC(2ae38dbe) SHA1(4e82b7dd3b899d61907620517a5a27bdaba0725d) ) | |
| 6488 | ROM_LOAD( "262-v4.bin", 0xc00000, 0x400000, CRC(26ec4dd9) SHA1(8bd68d95a2d913be41a51f51e48dbe3bff5924fb) ) | |
| 6530 | ROM_LOAD( "262-v1-08-e0.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) | |
| 6531 | ROM_LOAD( "262-v2-08-e0.bin", 0x400000, 0x400000, CRC(003f1843) SHA1(bdd58837ad542548bd4053c262f558af88e3b989) ) | |
| 6532 | ROM_LOAD( "262-v3-08-e0.bin", 0x800000, 0x400000, CRC(2ae38dbe) SHA1(4e82b7dd3b899d61907620517a5a27bdaba0725d) ) | |
| 6533 | ROM_LOAD( "262-v4-08-e0.bin", 0xc00000, 0x400000, CRC(26ec4dd9) SHA1(8bd68d95a2d913be41a51f51e48dbe3bff5924fb) ) | |
| 6489 | 6534 | |
| 6490 | 6535 | NO_DELTAT_REGION |
| 6491 | 6536 | |
| r2844 | r2845 | |
| 6517 | 6562 | |
| 6518 | 6563 | /* sound roms are identical to kof2001 */ |
| 6519 | 6564 | ROM_REGION( 0x1000000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 6520 | ROM_LOAD( "262-v1.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) | |
| 6521 | ROM_LOAD( "262-v2.bin", 0x400000, 0x400000, CRC(003f1843) SHA1(bdd58837ad542548bd4053c262f558af88e3b989) ) | |
| 6522 | ROM_LOAD( "262-v3.bin", 0x800000, 0x400000, CRC(2ae38dbe) SHA1(4e82b7dd3b899d61907620517a5a27bdaba0725d) ) | |
| 6523 | ROM_LOAD( "262-v4.bin", 0xc00000, 0x400000, CRC(26ec4dd9) SHA1(8bd68d95a2d913be41a51f51e48dbe3bff5924fb) ) | |
| 6565 | ROM_LOAD( "262-v1-08-e0.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) | |
| 6566 | ROM_LOAD( "262-v2-08-e0.bin", 0x400000, 0x400000, CRC(003f1843) SHA1(bdd58837ad542548bd4053c262f558af88e3b989) ) | |
| 6567 | ROM_LOAD( "262-v3-08-e0.bin", 0x800000, 0x400000, CRC(2ae38dbe) SHA1(4e82b7dd3b899d61907620517a5a27bdaba0725d) ) | |
| 6568 | ROM_LOAD( "262-v4-08-e0.bin", 0xc00000, 0x400000, CRC(26ec4dd9) SHA1(8bd68d95a2d913be41a51f51e48dbe3bff5924fb) ) | |
| 6524 | 6569 | |
| 6525 | 6570 | NO_DELTAT_REGION |
| 6526 | 6571 | |
| r2844 | r2845 | |
| 6553 | 6598 | |
| 6554 | 6599 | /* Original set has 2x64 mbit sound roms */ |
| 6555 | 6600 | ROM_REGION( 0x1000000, NEOGEO_REGION_AUDIO_DATA_1, 0 ) |
| 6556 | ROM_LOAD( "262-v1.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) | |
| 6557 | ROM_LOAD( "262-v2.bin", 0x400000, 0x400000, CRC(003f1843) SHA1(bdd58837ad542548bd4053c262f558af88e3b989) ) | |
| 6558 | ROM_LOAD( "262-v3.bin", 0x800000, 0x400000, CRC(2ae38dbe) SHA1(4e82b7dd3b899d61907620517a5a27bdaba0725d) ) | |
| 6559 | ROM_LOAD( "262-v4.bin", 0xc00000, 0x400000, CRC(26ec4dd9) SHA1(8bd68d95a2d913be41a51f51e48dbe3bff5924fb) ) | |
| 6601 | ROM_LOAD( "262-v1-08-e0.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) | |
| 6602 | ROM_LOAD( "262-v2-08-e0.bin", 0x400000, 0x400000, CRC(003f1843) SHA1(bdd58837ad542548bd4053c262f558af88e3b989) ) | |
| 6603 | ROM_LOAD( "262-v3-08-e0.bin", 0x800000, 0x400000, CRC(2ae38dbe) SHA1(4e82b7dd3b899d61907620517a5a27bdaba0725d) ) | |
| 6604 | ROM_LOAD( "262-v4-08-e0.bin", 0xc00000, 0x400000, CRC(26ec4dd9) SHA1(8bd68d95a2d913be41a51f51e48dbe3bff5924fb) ) | |
| 6560 | 6605 | |
| 6561 | 6606 | NO_DELTAT_REGION |
| 6562 | 6607 | |
| r2844 | r2845 | |
| 6893 | 6938 | DRIVER_INIT_CALL(neogeo); |
| 6894 | 6939 | } |
| 6895 | 6940 | |
| 6896 | static DRIVER_INIT( mslug3 | |
| 6941 | static DRIVER_INIT( mslug3h ) | |
| 6897 | 6942 | { |
| 6898 | 6943 | neogeo_fixed_layer_bank_type = 1; |
| 6899 | 6944 | kof99_neogeo_gfx_decrypt(0xad); |
| r2844 | r2845 | |
| 7407 | 7452 | GAME( 1999, garoup, garou, neogeo, neogeo, neogeo, ROT0, "SNK", "Garou - Mark of the Wolves (prototype)", 0 ) |
| 7408 | 7453 | GAME( 1999, garoubl, garou, neogeo, neogeo, garoubl, ROT0, "bootleg", "Garou - Mark of the Wolves (bootleg)", 0 ) /* Bootleg of garoup */ |
| 7409 | 7454 | GAME( 2000, mslug3, neogeo, neogeo, neogeo, mslug3, ROT0, "SNK", "Metal Slug 3" , 0 ) /* Encrypted Code & GFX */ |
| 7410 | GAME( 2000, mslug3 | |
| 7455 | GAME( 2000, mslug3h, mslug3, neogeo, neogeo, mslug3h, ROT0, "SNK", "Metal Slug 3 (not encrypted)" , 0 ) /* Encrypted GFX */ | |
| 7411 | 7456 | GAME( 2000, mslug3b6, mslug3, neogeo, neogeo, mslug3b6, ROT0, "bootleg", "Metal Slug 6 (Metal Slug 3 bootleg)", 0 ) /* real Metal Slug 6 is an Atomiswave HW game, see atomswav.c ;-) */ |
| 7412 | 7457 | GAME( 2000, kof2000, neogeo, neogeo, neogeo, kof2000, ROT0, "SNK", "The King of Fighters 2000" , 0 ) /* Encrypted Code & GFX */ |
| 7413 | 7458 | GAME( 2000, kof2000n, kof2000, neogeo, neogeo, kof2000n, ROT0, "SNK", "The King of Fighters 2000 (not encrypted)" , 0 ) /* Encrypted GFX */ |
| r2844 | r2845 | |
|---|---|---|
| 260 | 260 | |
| 261 | 261 | static READ32_HANDLER( inp1_r ) |
| 262 | 262 | { |
| 263 | UINT32 result = (input_port_read | |
| 263 | UINT32 result = (input_port_read | |
| 264 | 264 | |
| 265 | 265 | return result; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | static READ32_HANDLER( inp2_r ) |
| 269 | 269 | { |
| 270 | return (input_port_read | |
| 270 | return (input_port_read | |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | static READ32_HANDLER( turntable_r ) |
| 274 | 274 | { |
| 275 | 275 | UINT32 result = 0; |
| 276 | static const char *ttnames[] = { "TT1", "TT2" }; | |
| 276 | 277 | |
| 277 | 278 | if (ACCESSING_BITS_8_15) |
| 278 | 279 | { |
| 279 | 280 | UINT8 pos; |
| 280 | 281 | int delta; |
| 281 | 282 | |
| 282 | pos = input_port_read | |
| 283 | pos = input_port_read | |
| 283 | 284 | delta = pos - turntable_last_pos[turntable_select]; |
| 284 | 285 | if (delta < -128) |
| 285 | 286 | delta += 256; |
| r2844 | r2845 | |
| 501 | 502 | *************************************/ |
| 502 | 503 | |
| 503 | 504 | #define BEATMANIA_INPUT \ |
| 504 | PORT_START | |
| 505 | PORT_START_TAG("IN0") /* IN 0 */ \ | |
| 505 | 506 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) \ |
| 506 | 507 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) \ |
| 507 | 508 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) \ |
| r2844 | r2845 | |
| 511 | 512 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) \ |
| 512 | 513 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) \ |
| 513 | 514 | \ |
| 514 | PORT_START | |
| 515 | PORT_START_TAG("IN1") /* IN 1 */ \ | |
| 515 | 516 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) \ |
| 516 | 517 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) \ |
| 517 | 518 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) \ |
| r2844 | r2845 | |
| 521 | 522 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_START3 ) PORT_NAME("Effect") /* EFFECT */ \ |
| 522 | 523 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) \ |
| 523 | 524 | \ |
| 524 | PORT_START | |
| 525 | PORT_START_TAG("IN2") /* IN 2 */ \ | |
| 525 | 526 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F2) /* TEST SW */ \ |
| 526 | 527 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service") /* SERVICE */ \ |
| 527 | 528 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Reset") /* RESET SW */ \ |
| 528 | 529 | PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 529 | 530 | |
| 530 | 531 | #define BEATMANIA_TURNTABLE \ |
| 531 | PORT_START | |
| 532 | PORT_START_TAG("TT1") /* IN 6: turn table 1P */ \ | |
| 532 | 533 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_PLAYER(1) \ |
| 533 | 534 | \ |
| 534 | PORT_START | |
| 535 | PORT_START_TAG("TT2") /* IN 7: turn table 2P */ \ | |
| 535 | 536 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_PLAYER(2) |
| 536 | 537 | |
| 537 | 538 | #define BEATMANIA_DSW1(base,mask) \ |
| 538 | PORT_START | |
| 539 | PORT_START_TAG("DSW1") /* IN 3 */ \ | |
| 539 | 540 | PORT_DIPNAME( 0xff, (0xff & mask) | base, DEF_STR( Coinage ) ) \ |
| 540 | 541 | PORT_DIPSETTING( (0xe0 & mask) | base, "1P 8C / 2P 16C / Continue 8C" ) \ |
| 541 | 542 | PORT_DIPSETTING( (0xe1 & mask) | base, "1P 8C / 2P 16C / Continue 7C" ) \ |
| r2844 | r2845 | |
| 572 | 573 | PORT_DIPSETTING( (0x00 & mask) | base, DEF_STR( Free_Play ) ) |
| 573 | 574 | |
| 574 | 575 | #define BM1STMIX_DSW1 \ |
| 575 | PORT_START | |
| 576 | PORT_START_TAG("DSW1") /* IN 3 */ \ | |
| 576 | 577 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 577 | 578 | PORT_DIPNAME( 0x1f, 0x1f, DEF_STR( Coinage ) ) \ |
| 578 | 579 | PORT_DIPSETTING( 0x1e, "1P 3C / 2P 6C / Continue 3C" ) \ |
| r2844 | r2845 | |
| 595 | 596 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 596 | 597 | |
| 597 | 598 | #define BEATMANIA_DSW2 \ |
| 598 | PORT_START | |
| 599 | PORT_START_TAG("DSW2") /* IN 4 */ \ | |
| 599 | 600 | PORT_DIPNAME( 0x80, 0x80, "Score Display" ) \ |
| 600 | 601 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ |
| 601 | 602 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) \ |
| r2844 | r2845 | |
| 619 | 620 | PORT_DIPSETTING( 0x00, "Level 3" ) |
| 620 | 621 | |
| 621 | 622 | #define BEATMANIA_DSW2_OLD_LEVEL \ |
| 622 | PORT_START | |
| 623 | PORT_START_TAG("DSW2") /* IN 4 */ \ | |
| 623 | 624 | PORT_DIPNAME( 0x80, 0x80, "Score Display" ) \ |
| 624 | 625 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ |
| 625 | 626 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) \ |
| r2844 | r2845 | |
| 648 | 649 | PORT_DIPSETTING( 0x00, "Level 15" ) |
| 649 | 650 | |
| 650 | 651 | #define BM1STMIX_DSW2 \ |
| 651 | PORT_START | |
| 652 | PORT_START_TAG("DSW2") /* IN 4 */ \ | |
| 652 | 653 | PORT_DIPNAME( 0x80, 0x80, "Enable Expert Mode" ) \ |
| 653 | 654 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) \ |
| 654 | 655 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) \ |
| r2844 | r2845 | |
| 660 | 661 | PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 661 | 662 | |
| 662 | 663 | #define BMCOMPMX_DSW2 \ |
| 663 | PORT_START | |
| 664 | PORT_START_TAG("DSW2") /* IN 4 */ \ | |
| 664 | 665 | PORT_DIPNAME( 0x80, 0x80, "Score Display" ) \ |
| 665 | 666 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ |
| 666 | 667 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) \ |
| r2844 | r2845 | |
| 689 | 690 | PORT_DIPSETTING( 0x00, "Level 15" ) |
| 690 | 691 | |
| 691 | 692 | #define BEATMANIA_DSW3 \ |
| 692 | PORT_START | |
| 693 | PORT_START_TAG("DSW3") /* IN 5 */ \ | |
| 693 | 694 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 694 | 695 | PORT_DIPNAME( 0x20, 0x20, "Event Mode" ) \ |
| 695 | 696 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) \ |
| r2844 | r2845 | |
| 704 | 705 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* DSW 3-6 */ |
| 705 | 706 | |
| 706 | 707 | #define BM1STMIX_DSW3 \ |
| 707 | PORT_START | |
| 708 | PORT_START_TAG("DSW3") /* IN 5 */ \ | |
| 708 | 709 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 709 | 710 | |
| 710 | 711 | #define BM2NDMIX_DSW3 \ |
| 711 | PORT_START | |
| 712 | PORT_START_TAG("DSW3") /* IN 5 */ \ | |
| 712 | 713 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 713 | 714 | PORT_DIPNAME( 0x39, 0x39, "Event Mode / Free Hidden Songs" ) \ |
| 714 | 715 | PORT_DIPSETTING( 0x39, "Off / Off" ) \ |
| r2844 | r2845 | |
| 721 | 722 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* DSW 3-5 */ \ |
| 722 | 723 | |
| 723 | 724 | #define BMCOMPMX_DSW3 \ |
| 724 | PORT_START | |
| 725 | PORT_START_TAG("DSW3") /* IN 5 */ \ | |
| 725 | 726 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 726 | 727 | PORT_DIPNAME( 0x20, 0x20, "Event Mode" ) \ |
| 727 | 728 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) \ |
| r2844 | r2845 | |
| 738 | 739 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 739 | 740 | |
| 740 | 741 | #define BM4THMIX_DSW3 \ |
| 741 | PORT_START | |
| 742 | PORT_START_TAG("DSW3") /* IN 5 */ \ | |
| 742 | 743 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 743 | 744 | PORT_DIPNAME( 0x20, 0x20, "Event Mode" ) \ |
| 744 | 745 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) \ |
| r2844 | r2845 | |
| 755 | 756 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* DSW 3-6 */ |
| 756 | 757 | |
| 757 | 758 | #define HMCOMPM2_DSW3 \ |
| 758 | PORT_START | |
| 759 | PORT_START_TAG("DSW3") /* IN 5 */ \ | |
| 759 | 760 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 760 | 761 | PORT_DIPNAME( 0x20, 0x20, "Event Mode" ) \ |
| 761 | 762 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) \ |
| r2844 | r2845 | |
| 772 | 773 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* DSW 3-6 */ |
| 773 | 774 | |
| 774 | 775 | #define BMDCT_DSW3 \ |
| 775 | PORT_START | |
| 776 | PORT_START_TAG("DSW3") /* IN 5 */ \ | |
| 776 | 777 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 777 | 778 | PORT_DIPNAME( 0x20, 0x20, "Event Mode" ) \ |
| 778 | 779 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) \ |
| r2844 | r2845 | |
| 853 | 854 | |
| 854 | 855 | |
| 855 | 856 | #define POPN_INPUT \ |
| 856 | PORT_START | |
| 857 | PORT_START_TAG("IN0") /* IN 0 */ \ | |
| 857 | 858 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) \ |
| 858 | 859 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) \ |
| 859 | 860 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) \ |
| r2844 | r2845 | |
| 863 | 864 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) \ |
| 864 | 865 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(1) \ |
| 865 | 866 | \ |
| 866 | PORT_START | |
| 867 | PORT_START_TAG("IN1") /* IN 1 */ \ | |
| 867 | 868 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_PLAYER(1) \ |
| 868 | 869 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_PLAYER(1) \ |
| 869 | 870 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| r2844 | r2845 | |
| 873 | 874 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 874 | 875 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) \ |
| 875 | 876 | \ |
| 876 | PORT_START | |
| 877 | PORT_START_TAG("IN2") /* IN 2 */ \ | |
| 877 | 878 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F2) /* TEST SW */ \ |
| 878 | 879 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) /* SERVICE */ \ |
| 879 | 880 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE2 ) /* RESET SW */ \ |
| 880 | 881 | PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 881 | 882 | |
| 882 | 883 | #define POPN_DSW1 \ |
| 883 | PORT_START | |
| 884 | PORT_START_TAG("DSW1") /* IN 3 */ \ | |
| 884 | 885 | PORT_DIPNAME( 0xc0, 0xc0, "Jamming Gauge Blocks" ) \ |
| 885 | 886 | PORT_DIPSETTING( 0x80, "5" ) \ |
| 886 | 887 | PORT_DIPSETTING( 0xc0, "6" ) \ |
| r2844 | r2845 | |
| 924 | 925 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 925 | 926 | |
| 926 | 927 | #define POPN1_DSW1 \ |
| 927 | PORT_START | |
| 928 | PORT_START_TAG("DSW1") /* IN 3 */ \ | |
| 928 | 929 | PORT_DIPNAME( 0xc0, 0xc0, "Jamming Gauge Blocks" ) \ |
| 929 | 930 | PORT_DIPSETTING( 0x80, "5" ) \ |
| 930 | 931 | PORT_DIPSETTING( 0xc0, "6" ) \ |
| r2844 | r2845 | |
| 950 | 951 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 951 | 952 | |
| 952 | 953 | #define POPN_DSW2 \ |
| 953 | PORT_START | |
| 954 | PORT_START_TAG("DSW2") /* IN 4 */ \ | |
| 954 | 955 | PORT_DIPNAME( 0x80, 0x80, "Score Display" ) \ |
| 955 | 956 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ |
| 956 | 957 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) \ |
| r2844 | r2845 | |
| 972 | 973 | PORT_DIPSETTING( 0x00, "3" ) |
| 973 | 974 | |
| 974 | 975 | #define POPN1_DSW2 \ |
| 975 | PORT_START | |
| 976 | PORT_START_TAG("DSW2") /* IN 4 */ \ | |
| 976 | 977 | PORT_DIPNAME( 0x80, 0x80, "Score Display" ) \ |
| 977 | 978 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ |
| 978 | 979 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) \ |
| r2844 | r2845 | |
| 996 | 997 | PORT_DIPSETTING( 0x00, "3" ) |
| 997 | 998 | |
| 998 | 999 | #define POPN_DSW3 \ |
| 999 | PORT_START | |
| 1000 | PORT_START_TAG("DSW3") /* IN 5 */ \ | |
| 1000 | 1001 | PORT_BIT( 0xf7, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 1001 | 1002 | PORT_DIPNAME( 0x08, 0x08, "All Song Mode" ) /* DSW 3-3 */ \ |
| 1002 | 1003 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) \ |
| 1003 | 1004 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1004 | 1005 | |
| 1005 | 1006 | #define POPN1_DSW3 \ |
| 1006 | PORT_START | |
| 1007 | PORT_START_TAG("DSW3") /* IN 5 */ \ | |
| 1007 | 1008 | PORT_BIT( 0xec, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 1008 | 1009 | PORT_DIPNAME( 0x10, 0x10, "All Song Mode" ) /* DSW 3-2 */ \ |
| 1009 | 1010 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) \ |
| r2844 | r2845 | |
| 1035 | 1036 | #endif |
| 1036 | 1037 | |
| 1037 | 1038 | #define POPNST_INPUT \ |
| 1038 | PORT_START | |
| 1039 | PORT_START_TAG("IN0") /* IN 0 */ \ | |
| 1039 | 1040 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) \ |
| 1040 | 1041 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) \ |
| 1041 | 1042 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) \ |
| r2844 | r2845 | |
| 1045 | 1046 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) \ |
| 1046 | 1047 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(1) \ |
| 1047 | 1048 | \ |
| 1048 | PORT_START | |
| 1049 | PORT_START_TAG("IN1") /* IN 1 */ \ | |
| 1049 | 1050 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_PLAYER(1) \ |
| 1050 | 1051 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_PLAYER(1) \ |
| 1051 | 1052 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_PLAYER(1) \ |
| r2844 | r2845 | |
| 1055 | 1056 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 ) /* RIGHT SELECTION */ \ |
| 1056 | 1057 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) \ |
| 1057 | 1058 | \ |
| 1058 | PORT_START | |
| 1059 | PORT_START_TAG("IN2") /* IN 2 */ \ | |
| 1059 | 1060 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F2) /* TEST SW */ \ |
| 1060 | 1061 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) /* SERVICE */ \ |
| 1061 | 1062 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 1062 | 1063 | PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1063 | 1064 | |
| 1064 | 1065 | #define POPNST_DSW1 \ |
| 1065 | PORT_START | |
| 1066 | PORT_START_TAG("DSW1") /* IN 3 */ \ | |
| 1066 | 1067 | PORT_DIPNAME( 0xe0, 0xe0, "Coinage (6 Buttons)" ) \ |
| 1067 | 1068 | PORT_DIPSETTING( 0x20, "1P 4C / Continue 2C" ) \ |
| 1068 | 1069 | PORT_DIPSETTING( 0x40, "1P 3C / Continue 3C" ) \ |
| r2844 | r2845 | |
| 1092 | 1093 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1093 | 1094 | |
| 1094 | 1095 | #define POPNST_DSW2 \ |
| 1095 | PORT_START | |
| 1096 | PORT_START_TAG("DSW2") /* IN 4 */ \ | |
| 1096 | 1097 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Demo_Sounds ) ) \ |
| 1097 | 1098 | PORT_DIPSETTING( 0xc0, "Loud" ) \ |
| 1098 | 1099 | PORT_DIPSETTING( 0x80, DEF_STR ( Medium ) ) \ |
| r2844 | r2845 | |
| 1114 | 1115 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1115 | 1116 | |
| 1116 | 1117 | #define POPNST_DSW3 \ |
| 1117 | PORT_START | |
| 1118 | PORT_START_TAG("DSW3") /* IN 5 */ \ | |
| 1118 | 1119 | PORT_BIT( 0xd5, IP_ACTIVE_LOW, IPT_UNKNOWN ) \ |
| 1119 | 1120 | PORT_DIPNAME( 0x2a, 0x2a, "Enable Secret Mode" ) \ |
| 1120 | 1121 | PORT_DIPSETTING( 0x2a, DEF_STR( Off ) ) \ |
| r2844 | r2845 | |
| 1122 | 1123 | |
| 1123 | 1124 | #ifdef UNUSED_DEFINITION |
| 1124 | 1125 | static INPUT_PORTS_START( popnstage ) |
| 1125 | POPNST_INPUT | |
| 1126 | POPNST_INPUT | |
| 1126 | 1127 | POPNST_DSW1 /* IN 3 */ |
| 1127 | 1128 | POPNST_DSW2 /* IN 4 */ |
| 1128 | 1129 | POPNST_DSW3 /* IN 5 */ |
| r2844 | r2845 | |
|---|---|---|
| 1208 | 1208 | ROM_LOAD( "cap1267.u50", 0x0000, 0x0100, CRC(7051db57) SHA1(76751a3cc47d506983205decb07e99ca0c178a42) ) |
| 1209 | 1209 | ROM_END |
| 1210 | 1210 | |
| 1211 | ROM_START( peps0014 ) /* Normal board : Super Joker Slots (PS0014) */ | |
| 1212 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1213 | ROM_LOAD( "ps0014.u68", 0x00000, 0x10000, CRC(368c3f58) SHA1(ebefcefbb5386659680719936bff72ad61087343) ) | |
| 1214 | ||
| 1215 | ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1216 | ROM_LOAD( "mro-cg0916.u72", 0x00000, 0x8000, CRC(d97049d9) SHA1(78f7bb33866ca92922a8b83d5f9ac459edd39176) ) | |
| 1217 | ROM_LOAD( "mgo-cg0916.u73", 0x08000, 0x8000, CRC(6e075788) SHA1(e8e9d8b7943d62e31d1d58f870bc765cba65c203) ) | |
| 1218 | ROM_LOAD( "mbo-cg0916.u74", 0x10000, 0x8000, CRC(a5cdf0f3) SHA1(23b2749fd2cb5b8462ce7c912005779b611f32f9) ) | |
| 1219 | ROM_LOAD( "mxo-cg0916.u75", 0x18000, 0x8000, CRC(1f3a2d72) SHA1(8e07324d436980b628e007d30a835757c1f70f6d) ) | |
| 1220 | ||
| 1221 | ROM_REGION( 0x100, REGION_PROMS, 0 ) | |
| 1222 | ROM_LOAD( "cap0916.u50", 0x0000, 0x0100, CRC(b9a5ee21) SHA1(d3c952f594baca9dc234602d90c506dd537c4dcc) ) | |
| 1223 | ROM_END | |
| 1224 | ||
| 1225 | ROM_START( peps0022 ) /* Normal board : Red White & Blue Slots (PS0022) */ | |
| 1226 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1227 | ROM_LOAD( "ps0022.u68", 0x00000, 0x10000, CRC(d65c0939) SHA1(d91f472a43f77f9df8845e97561540f988e522e3) ) | |
| 1228 | ||
| 1229 | ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1230 | ROM_LOAD( "mro-cg0960.u72", 0x00000, 0x8000, CRC(8c38c6fd) SHA1(5d6e9ac18b9b3f1253bba080bef1c067b2fdd7a8) ) | |
| 1231 | ROM_LOAD( "mgo-cg0960.u73", 0x08000, 0x8000, CRC(b4f44163) SHA1(1bc635a5160fdff2882c8362644aebf983a1a427) ) | |
| 1232 | ROM_LOAD( "mbo-cg0960.u74", 0x10000, 0x8000, CRC(8057e3a8) SHA1(5510872b1607daaf890603e76a8a47680e639e8e) ) | |
| 1233 | ROM_LOAD( "mxo-cg0960.u75", 0x18000, 0x8000, CRC(d57b4c25) SHA1(6ddfbaae87f9958642ddb95e581ac31e1dd55608) ) | |
| 1234 | ||
| 1235 | ROM_REGION( 0x100, REGION_PROMS, 0 ) | |
| 1236 | ROM_LOAD( "cap0960.u50", 0x0000, 0x0100, CRC(00dd8d0a) SHA1(542763b12aeb0aec2b410f7c075c52907f45d171) ) | |
| 1237 | ROM_END | |
| 1238 | ||
| 1239 | ROM_START( peps0043 ) /* Normal board : Double Diamond Slots (PS0043) */ | |
| 1240 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1241 | ROM_LOAD( "ps0043.u68", 0x00000, 0x10000, CRC(d612429c) SHA1(95eb4774482a930066456d517fb2e4f67d4df4cb) ) | |
| 1242 | ||
| 1243 | ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1244 | ROM_LOAD( "mro-cg1003.u72", 0x00000, 0x8000, CRC(41ce0395) SHA1(ae90dbae30e4efed33f83ee7038fb2e5171c1945) ) | |
| 1245 | ROM_LOAD( "mgo-cg1003.u73", 0x08000, 0x8000, CRC(5a383fa1) SHA1(27b1febbdda7332e8d474fc0cca683f451a07090) ) | |
| 1246 | ROM_LOAD( "mbo-cg1003.u74", 0x10000, 0x8000, CRC(5ec00224) SHA1(bb70a4326cd1810b200e193a449061df62085f37) ) | |
| 1247 | ROM_LOAD( "mxo-cg1003.u75", 0x18000, 0x8000, CRC(2ffacd52) SHA1(38126ac4998806a1ddd55e6aa1942044240d41d0) ) | |
| 1248 | ||
| 1249 | ROM_REGION( 0x100, REGION_PROMS, 0 ) | |
| 1250 | ROM_LOAD( "cap1003.u50", 0x0000, 0x0100, CRC(cc400805) SHA1(f5ac48ad2a5df64da150f09f2ea5d910230bde56) ) | |
| 1251 | ROM_END | |
| 1252 | ||
| 1253 | ROM_START( peps0045 ) /* Normal board : Red White & Blue Slots (PS0045) */ | |
| 1254 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1255 | ROM_LOAD( "ps0045.u68", 0x00000, 0x10000, CRC(de180b84) SHA1(0d592d7d535b0aacbd62c18ac222da770fab7b85) ) | |
| 1256 | ||
| 1257 | ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1258 | ROM_LOAD( "mro-cg0960.u72", 0x00000, 0x8000, CRC(8c38c6fd) SHA1(5d6e9ac18b9b3f1253bba080bef1c067b2fdd7a8) ) | |
| 1259 | ROM_LOAD( "mgo-cg0960.u73", 0x08000, 0x8000, CRC(b4f44163) SHA1(1bc635a5160fdff2882c8362644aebf983a1a427) ) | |
| 1260 | ROM_LOAD( "mbo-cg0960.u74", 0x10000, 0x8000, CRC(8057e3a8) SHA1(5510872b1607daaf890603e76a8a47680e639e8e) ) | |
| 1261 | ROM_LOAD( "mxo-cg0960.u75", 0x18000, 0x8000, CRC(d57b4c25) SHA1(6ddfbaae87f9958642ddb95e581ac31e1dd55608) ) | |
| 1262 | ||
| 1263 | ROM_REGION( 0x100, REGION_PROMS, 0 ) | |
| 1264 | ROM_LOAD( "cap0960.u50", 0x0000, 0x0100, CRC(00dd8d0a) SHA1(542763b12aeb0aec2b410f7c075c52907f45d171) ) | |
| 1265 | ROM_END | |
| 1266 | ||
| 1267 | ROM_START( peps0308 ) /* Normal board : Double Jackpot Slots (PS0308) */ | |
| 1268 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) | |
| 1269 | ROM_LOAD( "ps0308.u68", 0x00000, 0x10000, CRC(fe30e081) SHA1(d216cbc6336727caf359e6b178c856ab2659cabd) ) | |
| 1270 | ||
| 1271 | ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE ) | |
| 1272 | ROM_LOAD( "mro-cg0911.u72", 0x00000, 0x8000, CRC(48491b50) SHA1(9ec6d3ff34a08d40082a1347a46635838fd31afc) ) | |
| 1273 | ROM_LOAD( "mgo-cg0911.u73", 0x08000, 0x8000, CRC(c1ff7d97) SHA1(78ab138ae9c7f9b3352f9b1ef5fbc473993bb8c8) ) | |
| 1274 | ROM_LOAD( "mbo-cg0911.u74", 0x10000, 0x8000, CRC(202e0f9e) SHA1(51421dfd1b00a9e3b1e938d5bffaa3b7cd4c2b5e) ) | |
| 1275 | ROM_LOAD( "mxo-cg0911.u75", 0x18000, 0x8000, CRC(d97740a2) SHA1(d76926d7fbbc24d2384a1079cb97e654600b134b) ) | |
| 1276 | ||
| 1277 | ROM_REGION( 0x100, REGION_PROMS, 0 ) | |
| 1278 | ROM_LOAD( "cap0911.u50", 0x0000, 0x0100, CRC(f117e781) SHA1(ba9d850c93e5f3abc26b0ba51f67fa7c07e05f59) ) | |
| 1279 | ROM_END | |
| 1280 | ||
| 1211 | 1281 | ROM_START( peps0615 ) /* Normal board : Chaos Slots (PS0615) */ |
| 1212 | 1282 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1213 | 1283 | ROM_LOAD( "ps0615.u68", 0x00000, 0x10000, CRC(d27dd6ab) SHA1(b3f065f507191682edbd93b07b72ed87bf6ae9b1) ) |
| r2844 | r2845 | |
| 1219 | 1289 | ROM_LOAD( "mxo-cg2246.u75", 0x18000, 0x8000, CRC(f0f4a27d) SHA1(3a10ab196aeaa5b50d47b9d3c5b378cfadd6fe96) ) |
| 1220 | 1290 | |
| 1221 | 1291 | ROM_REGION( 0x100, REGION_PROMS, 0 ) // WRONG CAP |
| 1222 | ||
| 1292 | ROM_LOAD( "cap0960.u50", 0x0000, 0x0100, CRC( | |
| 1223 | 1293 | ROM_END |
| 1224 | 1294 | |
| 1225 | ROM_START( peps0716 ) /* Normal board : | |
| 1295 | ROM_START( peps0716 ) /* Normal board : Riv | |
| 1226 | 1296 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1227 | 1297 | ROM_LOAD( "ps0716.u68", 0x00000, 0x10000, CRC(7615d7b6) SHA1(91fe62eec720a0dc2ebf48835065148f19499d16) ) |
| 1228 | 1298 | |
| r2844 | r2845 | |
| 1232 | 1302 | ROM_LOAD( "mbo-cg2266.u74", 0x10000, 0x8000, CRC(e3df30e1) SHA1(c7d2ae9a7c7e53bfb6197b635efcb5dc231e4fe0) ) |
| 1233 | 1303 | ROM_LOAD( "mxo-cg2266.u75", 0x18000, 0x8000, CRC(56271442) SHA1(61ad0756b9f6412516e46ef6625a4c3899104d4e) ) |
| 1234 | 1304 | |
| 1235 | ROM_REGION( 0x100, REGION_PROMS, 0 ) // WRONG CAP | |
| 1236 | ROM_LOAD( "cap2265.u50", 0x0000, 0x0100, CRC(dfb82a2f) SHA1(c96947bb475bf4497ff2e44053941625a3a7bf62) ) | |
| 1305 | ROM_REGION( 0x100, REGION_PROMS, 0 ) | |
| 1306 | ROM_LOAD( "cap2266.u50", 0x0000, 0x0100, CRC(5aaff103) SHA1(9cfda9c095cb77a8bb761c131a0f358e79b97abc) ) | |
| 1237 | 1307 | ROM_END |
| 1238 | 1308 | |
| 1239 | 1309 | ROM_START( pexp0019 ) /* Superboard : Deuces Wild Poker (XP000019) */ |
| r2844 | r2845 | |
| 1328 | 1398 | GAMEL(1994, peke1012, 0, peplus, peplus_keno, peplus, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (KE1012) Keno", 0, layout_pe_keno ) |
| 1329 | 1399 | |
| 1330 | 1400 | /* Normal board : slots machine */ |
| 1401 | GAMEL(1996, peps0014, 0, peplus, peplus_slots, peplus, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (PS0014) Super Joker Slots", 0, layout_pe_slots ) | |
| 1402 | GAMEL(1996, peps0022, 0, peplus, peplus_slots, peplus, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (PS0022) Red White & Blue Slots", 0, layout_pe_slots ) | |
| 1403 | GAMEL(1996, peps0043, 0, peplus, peplus_slots, peplus, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (PS0043) Double Diamond Slots", 0, layout_pe_slots ) | |
| 1404 | GAMEL(1996, peps0045, 0, peplus, peplus_slots, peplus, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (PS0045) Red White & Blue Slots", 0, layout_pe_slots ) | |
| 1405 | GAMEL(1996, peps0308, 0, peplus, peplus_slots, peplus, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (PS0308) Double Jackpot Slots", 0, layout_pe_slots ) | |
| 1331 | 1406 | GAMEL(1996, peps0615, 0, peplus, peplus_slots, peplus, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (PS0615) Chaos Slots", 0, layout_pe_slots ) |
| 1332 | GAMEL(1996, peps0716, 0, peplus, peplus_slots, peplus, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (PS0716) | |
| 1407 | GAMEL(1996, peps0716, 0, peplus, peplus_slots, peplus, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (PS0716) Riv | |
| 1333 | 1408 | |
| 1334 | 1409 | /* Superboard : poker */ |
| 1335 | 1410 | GAMEL(1995, pexp0019, 0, peplus, peplus_poker, peplussb, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (XP000019) Deuces Wild Poker", 0, layout_pe_poker ) |
| r2844 | r2845 | |
|---|---|---|
| 113 | 113 | |
| 114 | 114 | static READ8_HANDLER(prot_r) |
| 115 | 115 | { |
| 116 | return (input_port_read | |
| 116 | return (input_port_read | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | static WRITE8_HANDLER(prot_w) |
| r2844 | r2845 | |
| 222 | 222 | AM_RANGE(0xf086, 0xf086) AM_WRITE(bg2_w) |
| 223 | 223 | AM_RANGE(0xf101, 0xf101) AM_WRITE(main_nmi_w) |
| 224 | 224 | AM_RANGE(0xf102, 0xf105) AM_WRITE(prot_w) |
| 225 | AM_RANGE(0xf000, 0xf000) AM_READ | |
| 225 | AM_RANGE(0xf000, 0xf000) AM_READ | |
| 226 | 226 | AM_RANGE(0xf100, 0xf100) AM_READ(prot_r) |
| 227 | AM_RANGE(0xf180, 0xf180) AM_READ(input_port_2_r) | |
| 228 | AM_RANGE(0xf200, 0xf200) AM_READ(input_port_3_r) | |
| 227 | AM_RANGE(0xf180, 0xf180) AM_READ_PORT("DSW1") | |
| 228 | AM_RANGE(0xf200, 0xf200) AM_READ_PORT("DSW2") | |
| 229 | 229 | ADDRESS_MAP_END |
| 230 | 230 | |
| 231 | 231 | |
| r2844 | r2845 | |
| 242 | 242 | ADDRESS_MAP_END |
| 243 | 243 | |
| 244 | 244 | static INPUT_PORTS_START( ddayjlc ) |
| 245 | PORT_START | |
| 245 | PORT_START_TAG("IN0") | |
| 246 | 246 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 247 | 247 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 248 | 248 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| r2844 | r2845 | |
| 252 | 252 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) |
| 253 | 253 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) |
| 254 | 254 | |
| 255 | PORT_START | |
| 255 | PORT_START_TAG("IN1") | |
| 256 | 256 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) |
| 257 | 257 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 ) |
| 258 | 258 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| r2844 | r2845 | |
| 262 | 262 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 263 | 263 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 264 | 264 | |
| 265 | PORT_START /* DIPSW-1 */ | |
| 265 | PORT_START_TAG("DSW1") /* DIPSW-1 */ | |
| 266 | 266 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) |
| 267 | 267 | PORT_DIPSETTING( 0x00, "3" ) |
| 268 | 268 | PORT_DIPSETTING( 0x01, "4" ) |
| r2844 | r2845 | |
| 287 | 287 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 288 | 288 | PORT_DIPSETTING( 0x80, DEF_STR( Cocktail ) ) |
| 289 | 289 | |
| 290 | PORT_START /* DIPSW-2 */ | |
| 290 | PORT_START_TAG("DSW2") /* DIPSW-2 */ | |
| 291 | 291 | PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_B ) ) |
| 292 | 292 | PORT_DIPSETTING( 0x03, DEF_STR( 4C_1C ) ) |
| 293 | 293 | PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) |
| r2844 | r2845 | |
|---|---|---|
| 345 | 345 | video_control = data; |
| 346 | 346 | segaic16_tilemap_set_flip(0, data & 0x80); |
| 347 | 347 | segaic16_sprites_set_flip(0, data & 0x80); |
| 348 | segaic16_set_display_enable(data & 0x10); | |
| 348 | segaic16_set_display_enable(machine, data & 0x10); | |
| 349 | 349 | set_led_status(1, data & 0x08); |
| 350 | 350 | set_led_status(0, data & 0x04); |
| 351 | 351 | coin_counter_w(1, data & 0x02); |
| r2844 | r2845 | |
|---|---|---|
| 296 | 296 | *** Driver Updates *** |
| 297 | 297 | |
| 298 | 298 | |
| 299 | [2008/06/01] | |
| 299 | [2008/06/09] | |
| 300 | - Fixed the tilemap size. | |
| 301 | - Fixed the screen size. | |
| 302 | - Updated technical notes. | |
| 303 | ||
| 304 | [2008/05/29] | |
| 300 | 305 | - Switched the color system to RESNET calculations. |
| 301 | 306 | - Hooked the infamous bit7 of Input Port 0x3004 in parallel to DIP switch 1. |
| 302 | 307 | This allow to use the PAYOUT button to trigger the Super Game instead of STOP 5. |
| r2844 | r2845 | |
| 728 | 733 | MDRV_SCREEN_REFRESH_RATE(60) |
| 729 | 734 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 730 | 735 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 731 | MDRV_SCREEN_SIZE( | |
| 736 | MDRV_SCREEN_SIZE(96 | |
| 732 | 737 | MDRV_SCREEN_VISIBLE_AREA(0*4, 96*4-1, 0*8, 30*8-1) |
| 733 | 738 | |
| 734 | 739 | MDRV_GFXDECODE(snookr10) |
| r2844 | r2845 | |
|---|---|---|
| 260 | 260 | segaic16_tilemap_set_flip(0, data & 0x80); |
| 261 | 261 | segaic16_sprites_set_flip(0, data & 0x80); |
| 262 | 262 | segaic16_sprites_set_shadow(0, ~data & 0x40); |
| 263 | segaic16_set_display_enable(data & 0x10); | |
| 263 | segaic16_set_display_enable(machine, data & 0x10); | |
| 264 | 264 | set_led_status(1, data & 0x08); |
| 265 | 265 | set_led_status(0, data & 0x04); |
| 266 | 266 | coin_counter_w(1, data & 0x02); |
| r2844 | r2845 | |
|---|---|---|
| 163 | 163 | if (offset == 0) |
| 164 | 164 | { |
| 165 | 165 | int i,dir[4]; |
| 166 | static const char *tracknames[] = { "TRACK0_Y", "TRACK0_X", "TRACK1_Y", "TRACK1_X" }; | |
| 166 | 167 | |
| 167 | for (i = 0;i < 4;i++) | |
| 168 | for (i = 0; i < 4; i++) | |
| 168 | 169 | { |
| 169 | 170 | UINT8 curr; |
| 170 | 171 | |
| 171 | curr = input_port_read | |
| 172 | curr = input_port_read | |
| 172 | 173 | |
| 173 | 174 | dir[i] = curr - pos[i]; |
| 174 | 175 | sign[i] = dir[i] & 0x80; |
| r2844 | r2845 | |
| 260 | 261 | static ADDRESS_MAP_START( combasc_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 261 | 262 | AM_RANGE(0x0020, 0x005f) AM_READ(combasc_scrollram_r) |
| 262 | 263 | AM_RANGE(0x0200, 0x0201) AM_READ(protection_r) |
| 263 | AM_RANGE(0x0400, 0x0400) AM_READ(input_port_0_r) | |
| 264 | AM_RANGE(0x0401, 0x0401) AM_READ(input_port_1_r) /* DSW #3 */ | |
| 265 | AM_RANGE(0x0402, 0x0402) AM_READ(input_port_2_r) /* DSW #1 */ | |
| 266 | AM_RANGE(0x0403, 0x0403) AM_READ(input_port_3_r) /* DSW #2 */ | |
| 264 | AM_RANGE(0x0400, 0x0400) AM_READ_PORT("IN0") | |
| 265 | AM_RANGE(0x0401, 0x0401) AM_READ_PORT("DSW3") /* DSW #3 */ | |
| 266 | AM_RANGE(0x0402, 0x0402) AM_READ_PORT("DSW1") /* DSW #1 */ | |
| 267 | AM_RANGE(0x0403, 0x0403) AM_READ_PORT("DSW2") /* DSW #2 */ | |
| 267 | 268 | AM_RANGE(0x0404, 0x0407) AM_READ(trackball_r) /* 1P & 2P controls / trackball */ |
| 268 | 269 | AM_RANGE(0x0600, 0x06ff) AM_READ(SMH_RAM) /* palette */ |
| 269 | 270 | AM_RANGE(0x0800, 0x1fff) AM_READ(SMH_RAM) |
| r2844 | r2845 | |
| 391 | 392 | PORT_DIPSETTING( 0x00, "coin 2 invalidity" ) |
| 392 | 393 | |
| 393 | 394 | static INPUT_PORTS_START( combasc ) |
| 394 | PORT_START | |
| 395 | PORT_START_TAG("IN0") | |
| 395 | 396 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 396 | 397 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 397 | 398 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) |
| r2844 | r2845 | |
| 401 | 402 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 402 | 403 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 403 | 404 | |
| 404 | PORT_START /* DSW #3 */ | |
| 405 | PORT_START_TAG("DSW3") /* DSW #3 */ | |
| 405 | 406 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 406 | 407 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 407 | 408 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) |
| r2844 | r2845 | |
| 417 | 418 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 418 | 419 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 419 | 420 | |
| 420 | PORT_START /* DSW # 1 */ | |
| 421 | PORT_START_TAG("DSW1") /* DSW # 1 */ | |
| 421 | 422 | COINAGE |
| 422 | 423 | |
| 423 | PORT_START /* DSW #2 */ | |
| 424 | PORT_START_TAG("DSW2") /* DSW #2 */ | |
| 424 | 425 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 425 | 426 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 426 | 427 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 445 | 446 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 446 | 447 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 447 | 448 | |
| 448 | PORT_START | |
| 449 | PORT_START_TAG("IN2") | |
| 449 | 450 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) |
| 450 | 451 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| 451 | 452 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| r2844 | r2845 | |
| 455 | 456 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 456 | 457 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 457 | 458 | |
| 458 | PORT_START /* only used in trackball version */ | |
| 459 | PORT_START_TAG("TRACK0_Y") /* only used in trackball version */ | |
| 459 | 460 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 460 | 461 | |
| 461 | PORT_START /* only used in trackball version */ | |
| 462 | PORT_START_TAG("TRACK0_X") /* only used in trackball version */ | |
| 462 | 463 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 463 | 464 | |
| 464 | PORT_START /* only used in trackball version */ | |
| 465 | PORT_START_TAG("TRACK1_Y") /* only used in trackball version */ | |
| 465 | 466 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 467 | ||
| 468 | PORT_START_TAG("TRACK1_X") /* only used in trackball version */ | |
| 469 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 466 | 470 | INPUT_PORTS_END |
| 467 | 471 | |
| 468 | 472 | static INPUT_PORTS_START( combasct ) |
| 469 | PORT_START | |
| 473 | PORT_START_TAG("IN0") | |
| 470 | 474 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 471 | 475 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 472 | 476 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) |
| r2844 | r2845 | |
| 476 | 480 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 477 | 481 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 478 | 482 | |
| 479 | PORT_START /* DSW #3 */ | |
| 483 | PORT_START_TAG("DSW3") /* DSW #3 */ | |
| 480 | 484 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 481 | 485 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 482 | 486 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) |
| r2844 | r2845 | |
| 492 | 496 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 493 | 497 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 494 | 498 | |
| 495 | PORT_START /* DSW # 1 */ | |
| 499 | PORT_START_TAG("DSW1") /* DSW # 1 */ | |
| 496 | 500 | COINAGE |
| 497 | 501 | |
| 498 | PORT_START /* DSW #2 */ | |
| 502 | PORT_START_TAG("DSW2") /* DSW #2 */ | |
| 499 | 503 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 500 | 504 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 501 | 505 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 521 | 525 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 522 | 526 | |
| 523 | 527 | /* trackball 1P */ |
| 524 | PORT_START | |
| 528 | PORT_START_TAG("TRACK0_Y") | |
| 525 | 529 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(10) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1) |
| 526 | 530 | |
| 527 | PORT_START | |
| 531 | PORT_START_TAG("TRACK0_X") | |
| 528 | 532 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(10) PORT_PLAYER(1) |
| 529 | 533 | |
| 530 | 534 | /* trackball 2P (not implemented yet) */ |
| 531 | PORT_START | |
| 535 | PORT_START_TAG("TRACK1_Y") | |
| 532 | 536 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(10) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(2) |
| 533 | 537 | |
| 534 | PORT_START | |
| 538 | PORT_START_TAG("TRACK1_X") | |
| 535 | 539 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(10) PORT_PLAYER(2) |
| 536 | 540 | INPUT_PORTS_END |
| 537 | 541 | |
| 538 | 542 | static INPUT_PORTS_START( combascb ) |
| 539 | PORT_START | |
| 543 | PORT_START_TAG("IN0") | |
| 540 | 544 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 541 | 545 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 542 | 546 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) |
| r2844 | r2845 | |
| 546 | 550 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 547 | 551 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 548 | 552 | |
| 549 | PORT_START | |
| 553 | PORT_START_TAG("IN1") | |
| 550 | 554 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) |
| 551 | 555 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| 552 | 556 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| r2844 | r2845 | |
| 556 | 560 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 557 | 561 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 558 | 562 | |
| 559 | PORT_START | |
| 563 | PORT_START_TAG("DSW1") | |
| 560 | 564 | COINAGE |
| 561 | 565 | |
| 562 | PORT_START | |
| 566 | PORT_START_TAG("DSW2") | |
| 563 | 567 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) |
| 564 | 568 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 565 | 569 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
|---|---|---|
| 9 | 9 | #include "machine/eeprom.h" |
| 10 | 10 | #include "cpu/sh2/sh2.h" |
| 11 | 11 | #include "machine/stvprot.h" |
| 12 | #include "includes/stv.h" | |
| 12 | 13 | |
| 13 | extern UINT32 *stv_workram_h; | |
| 14 | extern UINT32 *stv_workram_l; | |
| 15 | extern UINT32 *stv_backupram; | |
| 16 | extern int stv_enable_slave_sh2; | |
| 17 | ||
| 18 | extern int minit_boost,sinit_boost; | |
| 19 | extern attotime minit_boost_timeslice, sinit_boost_timeslice; | |
| 20 | ||
| 21 | DRIVER_INIT ( stv ); | |
| 22 | ||
| 23 | 14 | /* |
| 24 | 15 | IC-13 rom shifter routine,on 2000000-21fffff the game maps the rom bytes on the |
| 25 | 16 | ODD (in every sense) bytes.This gets the IC-13 rom status to good and ends a emulation |
| r2844 | r2845 | |
|---|---|---|
| 83 | 83 | #include "cpu/m6805/m6805.h" |
| 84 | 84 | #include "sound/ay8910.h" |
| 85 | 85 | #include "sound/msm5232.h" |
| 86 | #include "includes/buggychl.h" | |
| 86 | 87 | |
| 87 | 88 | |
| 88 | /* in machine */ | |
| 89 | MACHINE_RESET( buggychl ); | |
| 90 | READ8_HANDLER( buggychl_68705_portA_r ); | |
| 91 | WRITE8_HANDLER( buggychl_68705_portA_w ); | |
| 92 | WRITE8_HANDLER( buggychl_68705_ddrA_w ); | |
| 93 | READ8_HANDLER( buggychl_68705_portB_r ); | |
| 94 | WRITE8_HANDLER( buggychl_68705_portB_w ); | |
| 95 | WRITE8_HANDLER( buggychl_68705_ddrB_w ); | |
| 96 | READ8_HANDLER( buggychl_68705_portC_r ); | |
| 97 | WRITE8_HANDLER( buggychl_68705_portC_w ); | |
| 98 | WRITE8_HANDLER( buggychl_68705_ddrC_w ); | |
| 99 | WRITE8_HANDLER( buggychl_mcu_w ); | |
| 100 | READ8_HANDLER( buggychl_mcu_r ); | |
| 101 | READ8_HANDLER( buggychl_mcu_status_r ); | |
| 102 | ||
| 103 | /* in video */ | |
| 104 | extern UINT8 *buggychl_scrollv,*buggychl_scrollh; | |
| 105 | extern UINT8 buggychl_sprite_lookup[0x2000]; | |
| 106 | extern UINT8 *buggychl_character_ram; | |
| 107 | ||
| 108 | PALETTE_INIT( buggychl ); | |
| 109 | VIDEO_START( buggychl ); | |
| 110 | WRITE8_HANDLER( buggychl_chargen_w ); | |
| 111 | WRITE8_HANDLER( buggychl_sprite_lookup_bank_w ); | |
| 112 | WRITE8_HANDLER( buggychl_sprite_lookup_w ); | |
| 113 | WRITE8_HANDLER( buggychl_ctrl_w ); | |
| 114 | WRITE8_HANDLER( buggychl_bg_scrollx_w ); | |
| 115 | VIDEO_UPDATE( buggychl ); | |
| 116 | ||
| 117 | ||
| 118 | ||
| 119 | ||
| 120 | 89 | static WRITE8_HANDLER( bankswitch_w ) |
| 121 | 90 | { |
| 122 | 91 | memory_set_bankptr(1,&memory_region(REGION_CPU1)[0x10000 + (data & 7) * 0x2000]); |
| r2844 | r2845 | |
|---|---|---|
| 491 | 491 | data &= 0x0f; |
| 492 | 492 | |
| 493 | 493 | /* bit 0 controls display enable */ |
| 494 | segac2_enable_display(~data & 1); | |
| 494 | segac2_enable_display(machine, ~data & 1); | |
| 495 | 495 | |
| 496 | 496 | /* bit 1 resets the protection */ |
| 497 | 497 | if (!(data & 2)) |
| r2844 | r2845 | |
|---|---|---|
| 296 | 296 | #include "sound/2203intf.h" |
| 297 | 297 | #include "sound/2610intf.h" |
| 298 | 298 | #include "sound/okim6295.h" |
| 299 | #include "includes/cchip.h" | |
| 299 | 300 | |
| 300 | 301 | |
| 301 | 302 | static INT32 banknum = 0; |
| r2844 | r2845 | |
|---|---|---|
| 231 | 231 | #include "driver.h" |
| 232 | 232 | #include "sound/2203intf.h" |
| 233 | 233 | #include "sound/msm5205.h" |
| 234 | #include "includes/stfight.h" | |
| 234 | 235 | |
| 235 | // machine | |
| 236 | DRIVER_INIT( empcity ); | |
| 237 | DRIVER_INIT( stfight ); | |
| 238 | MACHINE_RESET( stfight ); | |
| 239 | INTERRUPT_GEN( stfight_vb_interrupt ); | |
| 240 | INTERRUPT_GEN( stfight_interrupt_1 ); | |
| 241 | READ8_HANDLER( stfight_dsw_r ); | |
| 242 | WRITE8_HANDLER( stfight_fm_w ); | |
| 243 | WRITE8_HANDLER( stfight_voice_w ); | |
| 244 | READ8_HANDLER( stfight_coin_r ); | |
| 245 | WRITE8_HANDLER( stfight_coin_w ); | |
| 246 | WRITE8_HANDLER( stfight_e800_w ); | |
| 247 | READ8_HANDLER( stfight_fm_r ); | |
| 248 | void stfight_adpcm_int( running_machine *machine, int data ); | |
| 249 | WRITE8_HANDLER( stfight_adpcm_control_w ); | |
| 250 | ||
| 251 | // video | |
| 252 | PALETTE_INIT( stfight ); | |
| 253 | WRITE8_HANDLER( stfight_text_char_w ); | |
| 254 | WRITE8_HANDLER( stfight_text_attr_w ); | |
| 255 | WRITE8_HANDLER( stfight_vh_latch_w ); | |
| 256 | WRITE8_HANDLER( stfight_sprite_bank_w ); | |
| 257 | VIDEO_START( stfight ); | |
| 258 | VIDEO_UPDATE( stfight ); | |
| 259 | ||
| 260 | // video | |
| 261 | extern UINT8 *stfight_text_char_ram; | |
| 262 | extern UINT8 *stfight_text_attr_ram; | |
| 263 | extern UINT8 *stfight_vh_latch_ram; | |
| 264 | extern UINT8 *stfight_sprite_ram; | |
| 265 | ||
| 266 | 236 | static ADDRESS_MAP_START( readmem_cpu1, ADDRESS_SPACE_PROGRAM, 8 ) |
| 267 | 237 | AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) |
| 268 | 238 | AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) /* sf02.bin */ |
| r2844 | r2845 | |
|---|---|---|
| 1932 | 1932 | /* should the sound rom be bitswapped too? */ |
| 1933 | 1933 | } |
| 1934 | 1934 | |
| 1935 | DRIVER_INIT( ddgn6809 ) | |
| 1935 | static DRIVER_INIT( ddgn6809 ) | |
| 1936 | 1936 | { |
| 1937 | 1937 | /* Descramble GFX here */ |
| 1938 | 1938 |
| r2844 | r2845 | |
|---|---|---|
| 36 | 36 | #include "driver.h" |
| 37 | 37 | #include "includes/snes.h" |
| 38 | 38 | |
| 39 | extern DRIVER_INIT( snes_hirom ); | |
| 40 | ||
| 41 | 39 | static INT8 shared_ram[0x100]; |
| 42 | 40 | |
| 43 | 41 | static READ8_HANDLER(sharedram_r) |
| r2844 | r2845 | |
|---|---|---|
| 84 | 84 | static WRITE16_HANDLER( track_reset_w ) |
| 85 | 85 | { |
| 86 | 86 | int i; |
| 87 | static const char *track_names[] = { "IN2", "IN3", "IN4", "IN5" }; | |
| 87 | 88 | |
| 88 | for (i = 0;i < 4;i++) | |
| 89 | last[i] = input_port_read_indexed(machine, 3+i); | |
| 89 | for (i = 0; i < 4; i++) | |
| 90 | last[i] = input_port_read(machine, track_names[i]); | |
| 90 | 91 | } |
| 91 | 92 | |
| 92 | 93 | static READ16_HANDLER( track_r ) |
| r2844 | r2845 | |
| 94 | 95 | switch (offset) |
| 95 | 96 | { |
| 96 | 97 | default: |
| 97 | case 0: return (( input_port_read_indexed(machine, 3) - last[0]) & 0x00ff) | (((input_port_read_indexed(machine, 5) - last[2]) & 0x00ff) << 8); /* X lo */ | |
| 98 | case 1: return (((input_port_read_indexed(machine, 3) - last[0]) & 0xff00) >> 8) | (( input_port_read_indexed(machine, 5) - last[2]) & 0xff00); /* X hi */ | |
| 99 | case 2: return (( input_port_read_indexed(machine, 4) - last[1]) & 0x00ff) | (((input_port_read_indexed(machine, 6) - last[3]) & 0x00ff) << 8); /* Y lo */ | |
| 100 | case 3: return (((input_port_read_indexed(machine, 4) - last[1]) & 0xff00) >> 8) | (( input_port_read_indexed(machine, 6) - last[3]) & 0xff00); /* Y hi */ | |
| 98 | case 0: return (( input_port_read(machine, "IN2") - last[0]) & 0x00ff) | (((input_port_read(machine, "IN4") - last[2]) & 0x00ff) << 8); /* X lo */ | |
| 99 | case 1: return (((input_port_read(machine, "IN2") - last[0]) & 0xff00) >> 8) | (( input_port_read(machine, "IN4") - last[2]) & 0xff00); /* X hi */ | |
| 100 | case 2: return (( input_port_read(machine, "IN3") - last[1]) & 0x00ff) | (((input_port_read(machine, "IN5") - last[3]) & 0x00ff) << 8); /* Y lo */ | |
| 101 | case 3: return (((input_port_read(machine, "IN3") - last[1]) & 0xff00) >> 8) | (( input_port_read(machine, "IN5") - last[3]) & 0xff00); /* Y hi */ | |
| 101 | 102 | } |
| 102 | 103 | } |
| 103 | 104 |
| r2844 | r2845 | |
|---|---|---|
| 161 | 161 | |
| 162 | 162 | static const struct AY8910interface ay8910_interface = |
| 163 | 163 | { |
| 164 | AY8910_LE | |
| 164 | AY8910_SINGLE | |
| 165 | 165 | AY8910_DEFAULT_LOADS, |
| 166 | 166 | NULL, |
| 167 | 167 | NULL, |
| r2844 | r2845 | |
|---|---|---|
| 50 | 50 | |
| 51 | 51 | /* PCB supports two dials, but cab has only got one */ |
| 52 | 52 | |
| 53 | timer_set(video_screen_get_time_until_pos(machine->primary_screen, input_port_read | |
| 53 | timer_set(video_screen_get_time_until_pos(machine->primary_screen, input_port_read | |
| 54 | 54 | timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, destroyr_frame_callback); |
| 55 | 55 | } |
| 56 | 56 | |
| r2844 | r2845 | |
| 137 | 137 | |
| 138 | 138 | if (offset == 0) |
| 139 | 139 | { |
| 140 | UINT8 ret = input_port_read | |
| 140 | UINT8 ret = input_port_read | |
| 141 | 141 | |
| 142 | 142 | if (destroyr_potsense[0] && destroyr_potmask[0]) |
| 143 | 143 | ret |= 4; |
| r2844 | r2845 | |
| 149 | 149 | |
| 150 | 150 | if (offset == 1) |
| 151 | 151 | { |
| 152 | return input_port_read | |
| 152 | return input_port_read | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | logerror("unmapped input port %d\n", offset); |
| r2844 | r2845 | |
| 168 | 168 | ADDRESS_MAP_GLOBAL_MASK(0x7fff) |
| 169 | 169 | AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0xf00) AM_RAM |
| 170 | 170 | AM_RANGE(0x1000, 0x1fff) AM_READWRITE(destroyr_input_r, destroyr_output_w) |
| 171 | AM_RANGE(0x2000, 0x2fff) AM_READ | |
| 171 | AM_RANGE(0x2000, 0x2fff) AM_READ | |
| 172 | 172 | AM_RANGE(0x3000, 0x30ff) AM_WRITE(SMH_RAM) AM_BASE(&destroyr_alpha_num_ram) |
| 173 | 173 | AM_RANGE(0x4000, 0x401f) AM_WRITE(SMH_RAM) AM_BASE(&destroyr_major_obj_ram) |
| 174 | 174 | AM_RANGE(0x5000, 0x5000) AM_WRITE(destroyr_cursor_load_w) |
| r2844 | r2845 | |
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | static INPUT_PORTS_START( destroyr ) |
| 184 | PORT_START | |
| 184 | PORT_START_TAG("IN0") /* IN0 */ | |
| 185 | 185 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) /* call 7400 */ |
| 186 | 186 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 187 | 187 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) /* potsense1 */ |
| r2844 | r2845 | |
| 194 | 194 | PORT_DIPSETTING( 0xc0, "3500 points" ) |
| 195 | 195 | PORT_DIPSETTING( 0x00, "never" ) |
| 196 | 196 | |
| 197 | PORT_START | |
| 197 | PORT_START_TAG("IN1") /* IN1 */ | |
| 198 | 198 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT ) |
| 199 | 199 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) /* actually a lever */ |
| 200 | 200 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) |
| r2844 | r2845 | |
| 204 | 204 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 205 | 205 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 206 | 206 | |
| 207 | PORT_START | |
| 207 | PORT_START_TAG("IN2") /* IN2 */ | |
| 208 | 208 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage ) ) |
| 209 | 209 | PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) |
| 210 | 210 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) |
| r2844 | r2845 | |
| 223 | 223 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 224 | 224 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 225 | 225 | |
| 226 | PORT_START | |
| 226 | PORT_START_TAG("PADDLE") /* IN3 */ | |
| 227 | 227 | PORT_BIT( 0xff, 0x00, IPT_PADDLE_V ) PORT_MINMAX(0,160) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_REVERSE |
| 228 | 228 | INPUT_PORTS_END |
| 229 | 229 |
| r2844 | r2845 | |
|---|---|---|
| 1167 | 1167 | segaic16_tilemap_set_flip(0, data & 0x40); |
| 1168 | 1168 | segaic16_sprites_set_flip(0, data & 0x40); |
| 1169 | 1169 | if (!disable_screen_blanking) |
| 1170 | segaic16_set_display_enable(data & 0x20); | |
| 1170 | segaic16_set_display_enable(machine, data & 0x20); | |
| 1171 | 1171 | set_led_status(1, data & 0x08); |
| 1172 | 1172 | set_led_status(0, data & 0x04); |
| 1173 | 1173 | coin_counter_w(1, data & 0x02); |
| r2844 | r2845 | |
|---|---|---|
| 555 | 555 | static MACHINE_RESET( multigam ) |
| 556 | 556 | { |
| 557 | 557 | /* reset the ppu */ |
| 558 | ppu2c0x_reset( 0, 1 ); | |
| 558 | ppu2c0x_reset( machine, 0, 1 ); | |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | static MACHINE_RESET( multigm3 ) |
| 562 | 562 | { |
| 563 | 563 | /* reset the ppu */ |
| 564 | ppu2c0x_reset( 0, 1 ); | |
| 564 | ppu2c0x_reset( machine, 0, 1 ); | |
| 565 | 565 | multigm3_switch_prg_rom(machine, 0, 0x01 ); |
| 566 | 566 | }; |
| 567 | 567 |
| r2844 | r2845 | |
|---|---|---|
| 139 | 139 | if (ACCESSING_BITS_24_31) |
| 140 | 140 | { |
| 141 | 141 | /* bits 13-11 are the MO control bits */ |
| 142 | atarirle_control_w(0, (data >> 27) & 7); | |
| 142 | atarirle_control_w(machine,0, (data >> 27) & 7); | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /* lower byte */ |
| r2844 | r2845 | |
|---|---|---|
| 755 | 755 | |
| 756 | 756 | /*****************************************************************************/ |
| 757 | 757 | |
| 758 | static MACHINE_START( nwktr ) | |
| 759 | { | |
| 760 | /* set conservative DRC options */ | |
| 761 | cpunum_set_info_int(0, CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS); | |
| 762 | ||
| 763 | /* configure fast RAM regions for DRC */ | |
| 764 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_SELECT, 0); | |
| 765 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_START, 0x00000000); | |
| 766 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_END, 0x003fffff); | |
| 767 | cpunum_set_info_ptr(0, CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram); | |
| 768 | cpunum_set_info_int(0, CPUINFO_INT_PPC_FASTRAM_READONLY, 0); | |
| 769 | } | |
| 770 | ||
| 758 | 771 | static ADDRESS_MAP_START( nwktr_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 759 | AM_RANGE(0x00000000, 0x003fffff) AM_MIRROR(0x80000000) AM_RAM AM_BASE(&work_ram) /* Work RAM */ | |
| 760 | AM_RANGE(0x74000000, 0x740000ff) AM_MIRROR(0x80000000) AM_READWRITE(K001604_reg_r, K001604_reg_w) | |
| 761 | AM_RANGE(0x74010000, 0x74017fff) AM_MIRROR(0x80000000) AM_RAM_WRITE(paletteram32_w) AM_BASE(&paletteram32) | |
| 762 | AM_RANGE(0x74020000, 0x7403ffff) AM_MIRROR(0x80000000) AM_READWRITE(K001604_tile_r, K001604_tile_w) | |
| 763 | AM_RANGE(0x74040000, 0x7407ffff) AM_MIRROR(0x80000000) AM_READWRITE(K001604_char_r, K001604_char_w) | |
| 764 | AM_RANGE(0x78000000, 0x7800ffff) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc) | |
| 765 | AM_RANGE(0x780c0000, 0x780c0003) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc) | |
| 766 | AM_RANGE(0x7d000000, 0x7d00ffff) AM_MIRROR(0x80000000) AM_READ(sysreg_r) | |
| 767 | AM_RANGE(0x7d010000, 0x7d01ffff) AM_MIRROR(0x80000000) AM_WRITE(sysreg_w) | |
| 768 | AM_RANGE(0x7d020000, 0x7d021fff) AM_MIRROR(0x80000000) AM_READWRITE(timekeeper_0_32be_r, timekeeper_0_32be_w) /* M48T58Y RTC/NVRAM */ | |
| 769 | AM_RANGE(0x7d030000, 0x7d030007) AM_MIRROR(0x80000000) AM_READ(K056800_host_r) | |
| 770 | AM_RANGE(0x7d030000, 0x7d030007) AM_MIRROR(0x80000000) AM_WRITE(K056800_host_w) | |
| 771 | AM_RANGE(0x7d030008, 0x7d03000f) AM_MIRROR(0x80000000) AM_WRITE(K056800_host_w) | |
| 772 | AM_RANGE(0x7d040000, 0x7d04ffff) AM_MIRROR(0x80000000) AM_READWRITE(lanc1_r, lanc1_w) | |
| 773 | AM_RANGE(0x7d050000, 0x7d05ffff) AM_MIRROR(0x80000000) AM_READWRITE(lanc2_r, lanc2_w) | |
| 774 | AM_RANGE(0x7e000000, 0x7e7fffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER2, 0) /* Data ROM */ | |
| 775 | AM_RANGE(0x7f000000, 0x7f1fffff) AM_MIRROR(0x80000000) AM_ROM AM_SHARE(2) | |
| 776 | AM_RANGE(0x7fe00000, 0x7fffffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2) /* Program ROM */ | |
| 772 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE(&work_ram) /* Work RAM */ | |
| 773 | AM_RANGE(0x74000000, 0x740000ff) AM_READWRITE(K001604_reg_r, K001604_reg_w) | |
| 774 | AM_RANGE(0x74010000, 0x74017fff) AM_RAM_WRITE(paletteram32_w) AM_BASE(&paletteram32) | |
| 775 | AM_RANGE(0x74020000, 0x7403ffff) AM_READWRITE(K001604_tile_r, K001604_tile_w) | |
| 776 | AM_RANGE(0x74040000, 0x7407ffff) AM_READWRITE(K001604_char_r, K001604_char_w) | |
| 777 | AM_RANGE(0x78000000, 0x7800ffff) AM_READWRITE(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc) | |
| 778 | AM_RANGE(0x780c0000, 0x780c0003) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc) | |
| 779 | AM_RANGE(0x7d000000, 0x7d00ffff) AM_READ(sysreg_r) | |
| 780 | AM_RANGE(0x7d010000, 0x7d01ffff) AM_WRITE(sysreg_w) | |
| 781 | AM_RANGE(0x7d020000, 0x7d021fff) AM_READWRITE(timekeeper_0_32be_r, timekeeper_0_32be_w) /* M48T58Y RTC/NVRAM */ | |
| 782 | AM_RANGE(0x7d030000, 0x7d030007) AM_READ(K056800_host_r) | |
| 783 | AM_RANGE(0x7d030000, 0x7d030007) AM_WRITE(K056800_host_w) | |
| 784 | AM_RANGE(0x7d030008, 0x7d03000f) AM_WRITE(K056800_host_w) | |
| 785 | AM_RANGE(0x7d040000, 0x7d04ffff) AM_READWRITE(lanc1_r, lanc1_w) | |
| 786 | AM_RANGE(0x7d050000, 0x7d05ffff) AM_READWRITE(lanc2_r, lanc2_w) | |
| 787 | AM_RANGE(0x7e000000, 0x7e7fffff) AM_ROM AM_REGION(REGION_USER2, 0) /* Data ROM */ | |
| 788 | AM_RANGE(0x7f000000, 0x7f1fffff) AM_ROM AM_SHARE(2) | |
| 789 | AM_RANGE(0x7fe00000, 0x7fffffff) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2) /* Program ROM */ | |
| 777 | 790 | ADDRESS_MAP_END |
| 778 | 791 | |
| 779 | 792 | /*****************************************************************************/ |
| r2844 | r2845 | |
| 906 | 919 | |
| 907 | 920 | MDRV_INTERLEAVE(100) |
| 908 | 921 | |
| 922 | MDRV_MACHINE_START(nwktr) | |
| 909 | 923 | MDRV_MACHINE_RESET(nwktr) |
| 910 | 924 | MDRV_NVRAM_HANDLER( timekeeper_0 ) |
| 911 | 925 |
| r2844 | r2845 | |
|---|---|---|
| 10 | 10 | ---------------+------+-----------+----------+-------------------- |
| 11 | 11 | Alligator Hunt | 1994 | GAE1 449 | 940411 | DS5002FP, but unprotected version available |
| 12 | 12 | World Rally 2 | 1995 | GAE1 449 | 950510 | DS5002FP |
| 13 | World Rally 2 | 1995 | GAE1 506 | 950510-1 | DS5002FP | |
| 13 | 14 | Touch & Go | 1995 | GAE1 501 | 950906 | DS5002FP |
| 14 | 15 | Touch & Go | 1995 | GAE1 501 | 950510-1 | DS5002FP |
| 15 | 16 | Maniac Square | 1996 | Unknown | ??? | DS5002FP, but unprotected version available |
| r2844 | r2845 | |
| 23 | 24 | #include "cpu/m68000/m68000.h" |
| 24 | 25 | #include "sound/gaelco.h" |
| 25 | 26 | #include "rendlay.h" |
| 27 | #include "includes/gaelco2.h" | |
| 26 | 28 | |
| 27 | extern UINT16 *gaelco_sndregs; | |
| 28 | extern UINT16 *gaelco2_vregs; | |
| 29 | extern UINT16 *snowboar_protection; | |
| 30 | ||
| 31 | /* from machine/gaelco2.c */ | |
| 32 | DRIVER_INIT( alighunt ); | |
| 33 | DRIVER_INIT( touchgo ); | |
| 34 | DRIVER_INIT( snowboar ); | |
| 35 | WRITE16_HANDLER( gaelco2_coin_w ); | |
| 36 | WRITE16_HANDLER( gaelco2_coin2_w ); | |
| 37 | WRITE16_HANDLER( wrally2_coin_w ); | |
| 38 | NVRAM_HANDLER( gaelco2 ); | |
| 39 | READ16_HANDLER( gaelco2_eeprom_r ); | |
| 40 | WRITE16_HANDLER( gaelco2_eeprom_cs_w ); | |
| 41 | WRITE16_HANDLER( gaelco2_eeprom_sk_w ); | |
| 42 | WRITE16_HANDLER( gaelco2_eeprom_data_w ); | |
| 43 | READ16_HANDLER( snowboar_protection_r ); | |
| 44 | WRITE16_HANDLER( snowboar_protection_w ); | |
| 45 | ||
| 46 | /* from video/gaelco2.c */ | |
| 47 | WRITE16_HANDLER( gaelco2_vram_w ); | |
| 48 | WRITE16_HANDLER( gaelco2_palette_w ); | |
| 49 | VIDEO_UPDATE( gaelco2 ); | |
| 50 | VIDEO_EOF( gaelco2 ); | |
| 51 | VIDEO_START( gaelco2 ); | |
| 52 | VIDEO_UPDATE( gaelco2_dual ); | |
| 53 | VIDEO_START( gaelco2_dual ); | |
| 54 | ||
| 55 | ||
| 56 | 29 | #define TILELAYOUT16(NUM) static const gfx_layout tilelayout16_##NUM = \ |
| 57 | 30 | { \ |
| 58 | 31 | 16,16, /* 16x16 tiles */ \ |
| r2844 | r2845 | |
| 1351 | 1324 | CONN2: Right speaker sound OUT (for second cabinat) |
| 1352 | 1325 | CONN3: For connection of wheel etc |
| 1353 | 1326 | POT1/2: Volume adjust of left/right channel |
| 1327 | ||
| 1328 | PCB Layout: | |
| 1329 | ||
| 1330 | REF: 950510-1 | |
| 1331 | ||
| 1332 | ------------------------------------------------------------------------------ | |
| 1333 | | POT1 TI F20LB KM428C256J-6 (x4) | | |
| 1334 | | POT2 | | |
| 1335 | | | | |
| 1336 | | | | |
| 1337 | | PROM IC68 | | |
| 1338 | |--- PROM IC69 | | |
| 1339 | | PROM IC70 | | |
| 1340 | | | | |
| 1341 | |--- | | |
| 1342 | | | | |
| 1343 | | | | |
| 1344 | | | | |
| 1345 | | |----------| | | |
| 1346 | | J | | | | |
| 1347 | | | GAE1 506 | | | |
| 1348 | | A 65764 | (QFP160) | | | |
| 1349 | | 65764 | | | | |
| 1350 | | M |----------| | | |
| 1351 | | | | |
| 1352 | | M |-------------------------| | | |
| 1353 | | | | 34.000MHz 62256 | | |
| 1354 | | A | 62256 DS5002 BATT_3V | 62256 | | |
| 1355 | | | | | | |
| 1356 | | |-------------------------| | | |
| 1357 | | TLC569 TLC569 | | |
| 1358 | |--- 62256 | | |
| 1359 | | 62256 | | |
| 1360 | | DSW1 | | |
| 1361 | |--- DSW2 | | |
| 1362 | | | | |
| 1363 | | 26.000MHz MC68000P12 WR2.63 | | |
| 1364 | | CONN1 WR2.64 | | |
| 1365 | | | | |
| 1366 | | CONN2 CONN3 | | |
| 1367 | -----------------------------------------------------------------------------| | |
| 1368 | ||
| 1369 | ||
| 1370 | Notes | |
| 1371 | ----- | |
| 1372 | Gaelco's PROMs IC70 and IC69 has DIP42 package (many wires are routed to GAE1 506, so I guess that they are a gfx rom) | |
| 1373 | Gaelco's PROM IC68 has DIP32 package (may be a sound rom) | |
| 1374 | TI F20L8 is a Texas Ins. DIP24 (may be a PAL). Is marked as F 406 XF 21869 F20L8-25CNT | |
| 1375 | TLC569 (IC2 and IC7) is a 8-bit serial ADC | |
| 1376 | ||
| 1354 | 1377 | */ |
| 1355 | 1378 | |
| 1356 | 1379 | ROM_START( wrally2 ) |
| r2844 | r2845 | |
|---|---|---|
| 255 | 255 | * |
| 256 | 256 | *************************************/ |
| 257 | 257 | |
| 258 | struct wd1770 | |
| 258 | static struct wd1770 | |
| 259 | 259 | { |
| 260 | 260 | UINT32 status; |
| 261 | 261 | UINT8 cmd; |
| r2844 | r2845 | |
|---|---|---|
| 143 | 143 | switch (inputport_selected) |
| 144 | 144 | { |
| 145 | 145 | case 0x00: /* DSW A (bits 0-4) */ |
| 146 | return (input_port_read | |
| 146 | return (input_port_read | |
| 147 | 147 | case 0x01: /* DSW A (bits 5-7), DSW B (bits 0-1) */ |
| 148 | return ((input_port_read | |
| 148 | return ((input_port_read | |
| 149 | 149 | case 0x02: /* DSW B (bits 2-6) */ |
| 150 | return (input_port_read | |
| 150 | return (input_port_read | |
| 151 | 151 | case 0x03: /* DSW B (bit 7), DSW C (bits 0-3) */ |
| 152 | return ((input_port_read | |
| 152 | return ((input_port_read | |
| 153 | 153 | case 0x04: /* coins, start */ |
| 154 | return input_port_read | |
| 154 | return input_port_read | |
| 155 | 155 | case 0x05: /* 2P controls */ |
| 156 | return input_port_read | |
| 156 | return input_port_read | |
| 157 | 157 | case 0x06: /* 1P controls */ |
| 158 | return input_port_read | |
| 158 | return input_port_read | |
| 159 | 159 | default: |
| 160 | 160 | return 0xff; |
| 161 | 161 | } |
| r2844 | r2845 | |
|---|---|---|
| 37 | 37 | #include "sound/ay8910.h" |
| 38 | 38 | #include "sound/dac.h" |
| 39 | 39 | #include "sound/3812intf.h" |
| 40 | #include "includes/matmania.h" | |
| 40 | 41 | |
| 41 | extern UINT8 *matmania_videoram2,*matmania_colorram2; | |
| 42 | extern size_t matmania_videoram2_size; | |
| 43 | extern UINT8 *matmania_videoram3,*matmania_colorram3; | |
| 44 | extern size_t matmania_videoram3_size; | |
| 45 | extern UINT8 *matmania_scroll; | |
| 46 | extern UINT8 *matmania_pageselect; | |
| 47 | ||
| 48 | WRITE8_HANDLER( matmania_paletteram_w ); | |
| 49 | PALETTE_INIT( matmania ); | |
| 50 | VIDEO_UPDATE( matmania ); | |
| 51 | VIDEO_UPDATE( maniach ); | |
| 52 | VIDEO_START( matmania ); | |
| 53 | VIDEO_UPDATE( matmania ); | |
| 54 | ||
| 55 | READ8_HANDLER( maniach_68705_portA_r ); | |
| 56 | WRITE8_HANDLER( maniach_68705_portA_w ); | |
| 57 | READ8_HANDLER( maniach_68705_portB_r ); | |
| 58 | WRITE8_HANDLER( maniach_68705_portB_w ); | |
| 59 | READ8_HANDLER( maniach_68705_portC_r ); | |
| 60 | WRITE8_HANDLER( maniach_68705_portC_w ); | |
| 61 | WRITE8_HANDLER( maniach_68705_ddrA_w ); | |
| 62 | WRITE8_HANDLER( maniach_68705_ddrB_w ); | |
| 63 | WRITE8_HANDLER( maniach_68705_ddrC_w ); | |
| 64 | WRITE8_HANDLER( maniach_mcu_w ); | |
| 65 | READ8_HANDLER( maniach_mcu_r ); | |
| 66 | READ8_HANDLER( maniach_mcu_status_r ); | |
| 67 | ||
| 68 | ||
| 69 | ||
| 70 | 42 | static WRITE8_HANDLER( matmania_sh_command_w ) |
| 71 | 43 | { |
| 72 | 44 | soundlatch_w(machine,offset,data); |
| r2844 | r2845 | |
|---|---|---|
| 130 | 130 | static UINT16 ip_select, ip_select_values[5]; |
| 131 | 131 | static UINT8 megasys1_ignore_oki_status = 0; /* used in MACHINE_RESET */ |
| 132 | 132 | |
| 133 | /* Variables defined in video: */ | |
| 134 | 133 | |
| 135 | ||
| 136 | ||
| 137 | /* Functions defined in video: */ | |
| 138 | ||
| 139 | PALETTE_INIT( megasys1 ); | |
| 140 | VIDEO_START( megasys1 ); | |
| 141 | VIDEO_UPDATE( megasys1 ); | |
| 142 | ||
| 143 | READ16_HANDLER( megasys1_vregs_C_r ); | |
| 144 | ||
| 145 | WRITE16_HANDLER( megasys1_vregs_A_w ); | |
| 146 | WRITE16_HANDLER( megasys1_vregs_C_w ); | |
| 147 | WRITE16_HANDLER( megasys1_vregs_D_w ); | |
| 148 | ||
| 149 | ||
| 150 | ||
| 151 | ||
| 152 | 134 | static MACHINE_RESET( megasys1 ) |
| 153 | 135 | { |
| 154 | 136 | megasys1_ignore_oki_status = 1; /* ignore oki status due 'protection' */ |
| r2844 | r2845 | |
|---|---|---|
| 172 | 172 | |
| 173 | 173 | static READ16_HANDLER( country_sndpending_r ) |
| 174 | 174 | { |
| 175 | return input_port_read | |
| 175 | return input_port_read | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | static WRITE8_HANDLER( pending_command_clear_w ) |
| r2844 | r2845 | |
| 248 | 248 | |
| 249 | 249 | |
| 250 | 250 | static INPUT_PORTS_START( crshrace ) |
| 251 | PORT_START | |
| 251 | PORT_START_TAG("IN0") | |
| 252 | 252 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 253 | 253 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 254 | 254 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| r2844 | r2845 | |
| 266 | 266 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_TILT ) |
| 267 | 267 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 268 | 268 | |
| 269 | PORT_START | |
| 269 | PORT_START_TAG("IN1") | |
| 270 | 270 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) |
| 271 | 271 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| 272 | 272 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| r2844 | r2845 | |
| 276 | 276 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 277 | 277 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 278 | 278 | |
| 279 | PORT_START | |
| 279 | PORT_START_TAG("DSW0") | |
| 280 | 280 | /* DSW1 : 0xfe1c83 = !(0xfff004) */ |
| 281 | 281 | PORT_DIPNAME( 0x0100, 0x0100, "Coin Slot" ) |
| 282 | 282 | PORT_DIPSETTING( 0x0100, "Same" ) |
| r2844 | r2845 | |
| 325 | 325 | PORT_DIPSETTING( 0x0040, DEF_STR( Hard ) ) |
| 326 | 326 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) |
| 327 | 327 | |
| 328 | PORT_START | |
| 328 | PORT_START_TAG("DSW1") | |
| 329 | 329 | /* DSW3 : 0xfe1c85 = !(0xfff00b) */ |
| 330 | 330 | #if CRSHRACE_3P_HACK |
| 331 | 331 | PORT_DIPNAME( 0x0001, 0x0001, "Maximum Players" ) |
| r2844 | r2845 | |
| 367 | 367 | PORT_DIPSETTING( 0x0000, DEF_STR( No ) ) |
| 368 | 368 | PORT_DIPSETTING( 0x0080, DEF_STR( Yes ) ) |
| 369 | 369 | |
| 370 | PORT_START | |
| 370 | PORT_START_TAG("IN2") | |
| 371 | 371 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) |
| 372 | 372 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) |
| 373 | 373 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) |
| r2844 | r2845 | |
| 377 | 377 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) |
| 378 | 378 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START3 ) |
| 379 | 379 | |
| 380 | PORT_START | |
| 380 | PORT_START_TAG("DSW2") | |
| 381 | 381 | PORT_DIPNAME( 0x0f00, 0x0100, "Country" ) |
| 382 | 382 | PORT_DIPSETTING( 0x0100, DEF_STR( World ) ) |
| 383 | 383 | PORT_DIPSETTING( 0x0800, "USA & Canada" ) |
| r2844 | r2845 | |
| 404 | 404 | |
| 405 | 405 | /* Same as 'crshrace', but additional "unknown" Dip Switch (see notes) */ |
| 406 | 406 | static INPUT_PORTS_START( crshrac2 ) |
| 407 | PORT_START | |
| 407 | PORT_START_TAG("IN0") | |
| 408 | 408 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 409 | 409 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 410 | 410 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| r2844 | r2845 | |
| 422 | 422 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_TILT ) |
| 423 | 423 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 424 | 424 | |
| 425 | PORT_START | |
| 425 | PORT_START_TAG("IN1") | |
| 426 | 426 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) |
| 427 | 427 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| 428 | 428 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| r2844 | r2845 | |
| 432 | 432 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 433 | 433 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 434 | 434 | |
| 435 | PORT_START | |
| 435 | PORT_START_TAG("DSW0") | |
| 436 | 436 | /* DSW2 : 0xfe1c84 = !(0xfff005) */ |
| 437 | 437 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) |
| 438 | 438 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) |
| r2844 | r2845 | |
| 481 | 481 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 482 | 482 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 483 | 483 | |
| 484 | PORT_START | |
| 484 | PORT_START_TAG("DSW1") | |
| 485 | 485 | /* DSW3 : 0xfe1c85 = !(0xfff00b) */ |
| 486 | 486 | #if CRSHRACE_3P_HACK |
| 487 | 487 | PORT_DIPNAME( 0x0001, 0x0001, "Maximum Players" ) |
| r2844 | r2845 | |
| 523 | 523 | PORT_DIPSETTING( 0x0000, DEF_STR( No ) ) |
| 524 | 524 | PORT_DIPSETTING( 0x0080, DEF_STR( Yes ) ) |
| 525 | 525 | |
| 526 | PORT_START | |
| 526 | PORT_START_TAG("IN2") | |
| 527 | 527 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) |
| 528 | 528 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) |
| 529 | 529 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) |
| r2844 | r2845 | |
| 533 | 533 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) |
| 534 | 534 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START3 ) |
| 535 | 535 | |
| 536 | PORT_START | |
| 536 | PORT_START_TAG("DSW2") | |
| 537 | 537 | PORT_DIPNAME( 0x0f00, 0x0100, "Country" ) |
| 538 | 538 | PORT_DIPSETTING( 0x0100, DEF_STR( World ) ) |
| 539 | 539 | PORT_DIPSETTING( 0x0800, "USA & Canada" ) |
| r2844 | r2845 | |
|---|---|---|
| 253 | 253 | *************************************/ |
| 254 | 254 | |
| 255 | 255 | static INPUT_PORTS_START( dcheese ) |
| 256 | PORT_START /* 200000 */ | |
| 256 | PORT_START_TAG("200000") /* 200000 */ | |
| 257 | 257 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 258 | 258 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 259 | 259 | PORT_BIT( 0x000c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r2844 | r2845 | |
| 269 | 269 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* brake left */ |
| 270 | 270 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 271 | 271 | |
| 272 | PORT_START /* 220000 */ | |
| 272 | PORT_START_TAG("220000") /* 220000 */ | |
| 273 | 273 | PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 274 | 274 | |
| 275 | PORT_START /* 240000 */ | |
| 275 | PORT_START_TAG("240000") /* 240000 */ | |
| 276 | 276 | PORT_BIT( 0x001f, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* low 5 bits read as a unit */ |
| 277 | 277 | PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ticket_dispenser_0_port_r, NULL) |
| 278 | 278 | PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* sound->main buffer status (0=empty) */ |
| r2844 | r2845 | |
| 283 | 283 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_VOLUME_UP ) |
| 284 | 284 | PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 285 | 285 | |
| 286 | PORT_START /* 2a0002 */ | |
| 286 | PORT_START_TAG("2a0002") /* 2a0002 */ | |
| 287 | 287 | PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNKNOWN ) // read as a unit |
| 288 | 288 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON7 ) |
| 289 | 289 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON8 ) |
| r2844 | r2845 | |
| 293 | 293 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) |
| 294 | 294 | PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 295 | 295 | |
| 296 | PORT_START /* 2a000e */ | |
| 296 | PORT_START_TAG("2a000e") /* 2a000e */ | |
| 297 | 297 | PORT_BIT( 0x00ff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(30) PORT_REVERSE |
| 298 | 298 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 299 | 299 | INPUT_PORTS_END |
| 300 | 300 | |
| 301 | 301 | |
| 302 | 302 | static INPUT_PORTS_START( lottof2 ) |
| 303 | PORT_START /* 200000 */ | |
| 303 | PORT_START_TAG("200000") /* 200000 */ | |
| 304 | 304 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 305 | 305 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 306 | 306 | PORT_BIT( 0x000c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r2844 | r2845 | |
| 313 | 313 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* ticket */ |
| 314 | 314 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 315 | 315 | |
| 316 | PORT_START /* 220000 */ | |
| 316 | PORT_START_TAG("220000") /* 220000 */ | |
| 317 | 317 | PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 318 | 318 | |
| 319 | PORT_START /* 240000 */ | |
| 319 | PORT_START_TAG("240000") /* 240000 */ | |
| 320 | 320 | PORT_BIT( 0x001f, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* low 5 bits read as a unit */ |
| 321 | 321 | PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ticket_dispenser_0_port_r, NULL) |
| 322 | 322 | PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* sound->main buffer status (0=empty) */ |
| r2844 | r2845 | |
| 327 | 327 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_VOLUME_UP ) |
| 328 | 328 | PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 329 | 329 | |
| 330 | PORT_START /* 2a0002 */ | |
| 330 | PORT_START_TAG("2a0002") /* 2a0002 */ | |
| 331 | 331 | PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 332 | 332 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) |
| 333 | 333 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) |
| r2844 | r2845 | |
| 337 | 337 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) |
| 338 | 338 | PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 339 | 339 | |
| 340 | PORT_START /* 2a000e */ | |
| 340 | PORT_START_TAG("2a000e") /* 2a000e */ | |
| 341 | 341 | PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 342 | 342 | INPUT_PORTS_END |
| 343 | 343 | |
| 344 | 344 | |
| 345 | 345 | static INPUT_PORTS_START( fredmem ) |
| 346 | PORT_START /* 200000 */ | |
| 346 | PORT_START_TAG("200000") /* 200000 */ | |
| 347 | 347 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 348 | 348 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 349 | 349 | PORT_BIT( 0x000c, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r2844 | r2845 | |
| 355 | 355 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_5_PAD) |
| 356 | 356 | PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 357 | 357 | |
| 358 | PORT_START /* 220000 */ | |
| 358 | PORT_START_TAG("220000") /* 220000 */ | |
| 359 | 359 | PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 360 | 360 | |
| 361 | PORT_START /* 240000 */ | |
| 361 | PORT_START_TAG("240000") /* 240000 */ | |
| 362 | 362 | PORT_BIT( 0x001f, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* low 5 bits read as a unit */ |
| 363 | 363 | PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ticket_dispenser_0_port_r, NULL) |
| 364 | 364 | PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* sound->main buffer status (0=empty) */ |
| r2844 | r2845 | |
| 369 | 369 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_VOLUME_UP ) |
| 370 | 370 | PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 371 | 371 | |
| 372 | PORT_START /* 2a0002 */ | |
| 372 | PORT_START_TAG("2a0002") /* 2a0002 */ | |
| 373 | 373 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_6_PAD) |
| 374 | 374 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_CODE(KEYCODE_1_PAD) |
| 375 | 375 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_CODE(KEYCODE_2_PAD) |
| r2844 | r2845 | |
| 382 | 382 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) |
| 383 | 383 | PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 384 | 384 | |
| 385 | PORT_START /* 2a000e */ | |
| 385 | PORT_START_TAG("2a000e") /* 2a000e */ | |
| 386 | 386 | PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 387 | 387 | INPUT_PORTS_END |
| 388 | 388 |
| r2844 | r2845 | |
|---|---|---|
| 124 | 124 | static int accel, wheel; |
| 125 | 125 | |
| 126 | 126 | switch (analog_ctrl & 0x03){ |
| 127 | case 0x00: return (accel = input_port_read_indexed(machine, 5)); /* accelerator */ | |
| 128 | case 0x01: return (wheel = input_port_read_indexed(machine, 6)); /* steering */ | |
| 127 | case 0x00: return (accel = input_port_read(machine, "IN3")); /* accelerator */ | |
| 128 | case 0x01: return (wheel = input_port_read(machine, "IN4")); /* steering */ | |
| 129 | 129 | case 0x02: return accel; /* accelerator (previous?) */ |
| 130 | 130 | case 0x03: return wheel; /* steering (previous?) */ |
| 131 | 131 | } |
| r2844 | r2845 | |
| 148 | 148 | AM_RANGE(0x2000, 0x2007) AM_READ(K051937_r) /* Sprite control registers */ |
| 149 | 149 | AM_RANGE(0x2400, 0x27ff) AM_READ(K051960_r) /* Sprite RAM */ |
| 150 | 150 | AM_RANGE(0x2800, 0x2fff) AM_READ(SMH_BANK3) /* 051316 zoom/rotation (chip 2) */ |
| 151 | AM_RANGE(0x3100, 0x3100) AM_READ(input_port_0_r) /* DIPSW #1 */ | |
| 152 | AM_RANGE(0x3200, 0x3200) AM_READ(input_port_3_r) /* COINSW, STARTSW, test mode */ | |
| 153 | AM_RANGE(0x3201, 0x3201) AM_READ(input_port_2_r) /* DIPSW #3, SW 4 */ | |
| 154 | AM_RANGE(0x3203, 0x3203) AM_READ(input_port_1_r) /* DIPSW #2 */ | |
| 151 | AM_RANGE(0x3100, 0x3100) AM_READ_PORT("DSW1") /* DIPSW #1 */ | |
| 152 | AM_RANGE(0x3200, 0x3200) AM_READ_PORT("IN1") /* COINSW, STARTSW, test mode */ | |
| 153 | AM_RANGE(0x3201, 0x3201) AM_READ_PORT("IN0") /* DIPSW #3, SW 4 */ | |
| 154 | AM_RANGE(0x3203, 0x3203) AM_READ_PORT("DSW2") /* DIPSW #2 */ | |
| 155 | 155 | AM_RANGE(0x3400, 0x341f) AM_READ(K051733_r) /* 051733 (protection) */ |
| 156 | AM_RANGE(0x3701, 0x3701) AM_READ | |
| 156 | AM_RANGE(0x3701, 0x3701) AM_READ | |
| 157 | 157 | AM_RANGE(0x3702, 0x3702) AM_READ(analog_read_r) /* accelerator/wheel */ |
| 158 | 158 | AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK4) /* banked ROM */ |
| 159 | 159 | AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) /* ROM */ |
| r2844 | r2845 | |
| 220 | 220 | |
| 221 | 221 | |
| 222 | 222 | static INPUT_PORTS_START( chqflag ) |
| 223 | PORT_START /* DSW #1 */ | |
| 223 | PORT_START_TAG("DSW1") /* DSW #1 */ | |
| 224 | 224 | PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) |
| 225 | 225 | PORT_DIPSETTING( 0x02, DEF_STR( 4C_1C ) ) |
| 226 | 226 | PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) ) |
| r2844 | r2845 | |
| 256 | 256 | PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) ) |
| 257 | 257 | // PORT_DIPSETTING( 0x00, "Coin Slot 2 Invalidity" ) |
| 258 | 258 | |
| 259 | PORT_START /* DSW #2 (according to the manual SW1 thru SW5 are not used) */ | |
| 259 | PORT_START_TAG("DSW2") /* DSW #2 (according to the manual SW1 thru SW5 are not used) */ | |
| 260 | 260 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) |
| 261 | 261 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 262 | 262 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 281 | 281 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 282 | 282 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 283 | 283 | |
| 284 | PORT_START | |
| 284 | PORT_START_TAG("IN0") | |
| 285 | 285 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 286 | 286 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) /* DIPSW #3 - SW4 */ |
| 287 | 287 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 288 | 288 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 289 | 289 | |
| 290 | PORT_START | |
| 290 | PORT_START_TAG("IN1") | |
| 291 | 291 | /* COINSW + STARTSW */ |
| 292 | 292 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 293 | 293 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| r2844 | r2845 | |
| 303 | 303 | PORT_DIPSETTING( 0x00, "Checkered Flag" ) |
| 304 | 304 | PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) |
| 305 | 305 | |
| 306 | PORT_START /* Brake, Shift + ??? */ | |
| 306 | PORT_START_TAG("IN2") /* Brake, Shift + ??? */ | |
| 307 | 307 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_TOGGLE |
| 308 | 308 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 309 | 309 | PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* if this is set, it goes directly to test mode */ |
| 310 | 310 | PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* if bit 7 == 0, the game resets */ |
| 311 | 311 | |
| 312 | PORT_START /* Accelerator */ | |
| 312 | PORT_START_TAG("IN3") /* Accelerator */ | |
| 313 | 313 | PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) |
| 314 | 314 | |
| 315 | PORT_START /* Driving wheel */ | |
| 315 | PORT_START_TAG("IN4") /* Driving wheel */ | |
| 316 | 316 | PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xef) PORT_SENSITIVITY(80) PORT_KEYDELTA(8) |
| 317 | 317 | INPUT_PORTS_END |
| 318 | 318 |
| r2844 | r2845 | |
|---|---|---|
| 78 | 78 | break; |
| 79 | 79 | |
| 80 | 80 | case 1: |
| 81 | if (~input_port_read | |
| 81 | if (~input_port_read | |
| 82 | 82 | { if (!coin) { coin = 1; cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE); } } |
| 83 | 83 | else |
| 84 | 84 | coin = 0; |
| 85 | 85 | break; |
| 86 | 86 | |
| 87 | 87 | case 2: |
| 88 | if (input_port_read | |
| 88 | if (input_port_read | |
| 89 | 89 | break; |
| 90 | 90 | } |
| 91 | 91 | } |
| r2844 | r2845 | |
| 104 | 104 | |
| 105 | 105 | static READ8_HANDLER( bwp1_io_r ) |
| 106 | 106 | { |
| 107 | if (offset == 0) return(input_port_read_indexed(machine, 0)); | |
| 108 | if (offset == 1) return(input_port_read_indexed(machine, 1)); | |
| 109 | if (offset == 2) return(input_port_read_indexed(machine, 2)); | |
| 110 | if (offset == 3) return(input_port_read_indexed(machine, 3)); | |
| 111 | if (offset == 4) return(input_port_read_indexed(machine, 4)); | |
| 107 | if (offset == 0) return(input_port_read(machine, "DSW0")); | |
| 108 | if (offset == 1) return(input_port_read(machine, "DSW1")); | |
| 109 | if (offset == 2) return(input_port_read(machine, "IN0")); | |
| 110 | if (offset == 3) return(input_port_read(machine, "IN1")); | |
| 111 | if (offset == 4) return(input_port_read(machine, "IN2")); | |
| 112 | 112 | |
| 113 | 113 | return((bwp123_membase[0])[0x1b00 + offset]); |
| 114 | 114 | } |
| r2844 | r2845 | |
| 236 | 236 | ADDRESS_MAP_END |
| 237 | 237 | |
| 238 | 238 | static ADDRESS_MAP_START( bwp3_readport, ADDRESS_SPACE_IO, 8 ) |
| 239 | AM_RANGE(0x00, 0x00) AM_READ | |
| 239 | AM_RANGE(0x00, 0x00) AM_READ | |
| 240 | 240 | ADDRESS_MAP_END |
| 241 | 241 | |
| 242 | 242 | static ADDRESS_MAP_START( bwp3_writeport, ADDRESS_SPACE_IO, 8 ) |
| r2844 | r2845 | |
| 247 | 247 | // I/O Port Maps |
| 248 | 248 | |
| 249 | 249 | static INPUT_PORTS_START( bwing ) |
| 250 | PORT_START | |
| 250 | PORT_START_TAG("DSW0") | |
| 251 | 251 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) ) |
| 252 | 252 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) |
| 253 | 253 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) |
| r2844 | r2845 | |
| 271 | 271 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 272 | 272 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 273 | 273 | |
| 274 | ||
| 275 | PORT_START | |
| 274 | PORT_START_TAG("DSW1") | |
| 276 | 275 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) ) |
| 277 | 276 | PORT_DIPSETTING( 0x00, "5" ) |
| 278 | 277 | PORT_DIPSETTING( 0x01, "3" ) |
| r2844 | r2845 | |
| 297 | 296 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 298 | 297 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 299 | 298 | |
| 300 | PORT_START | |
| 299 | PORT_START_TAG("IN0") | |
| 301 | 300 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY |
| 302 | 301 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| 303 | 302 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| r2844 | r2845 | |
| 307 | 306 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 308 | 307 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 309 | 308 | |
| 310 | PORT_START | |
| 309 | PORT_START_TAG("IN1") | |
| 311 | 310 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL |
| 312 | 311 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL |
| 313 | 312 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL |
| r2844 | r2845 | |
| 317 | 316 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 318 | 317 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 319 | 318 | |
| 320 | PORT_START | |
| 319 | PORT_START_TAG("IN2") | |
| 321 | 320 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 322 | 321 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 323 | 322 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) |
| r2844 | r2845 | |
| 327 | 326 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 328 | 327 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 329 | 328 | |
| 330 | PORT_START | |
| 329 | PORT_START_TAG("IN3") | |
| 331 | 330 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_TILT ) |
| 332 | 331 | |
| 333 | PORT_START | |
| 332 | PORT_START_TAG("VBLANK") | |
| 334 | 333 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 335 | 334 | |
| 336 | PORT_START // a matter of taste | |
| 335 | PORT_START_TAG("EXTRA") // a matter of taste | |
| 337 | 336 | PORT_DIPNAME( 0x07, 0x00, "RGB" ) |
| 338 | 337 | PORT_DIPSETTING( 0x00, "Default" ) |
| 339 | 338 | PORT_DIPSETTING( 0x01, "More Red" ) |
| r2844 | r2845 | |
|---|---|---|
| 150 | 150 | #include "cpu/m6805/m6805.h" |
| 151 | 151 | #include "sound/ay8910.h" |
| 152 | 152 | #include "sound/2203intf.h" |
| 153 | #include "includes/lsasquad.h" | |
| 153 | 154 | |
| 154 | /* in video/lsasquad.c */ | |
| 155 | extern UINT8 *lsasquad_scrollram; | |
| 156 | VIDEO_UPDATE( lsasquad ); | |
| 157 | VIDEO_UPDATE( daikaiju ); | |
| 158 | ||
| 159 | /* in machine/lsasquad.c */ | |
| 160 | extern int lsasquad_invertcoin; | |
| 161 | WRITE8_HANDLER( lsasquad_sh_nmi_disable_w ); | |
| 162 | WRITE8_HANDLER( lsasquad_sh_nmi_enable_w ); | |
| 163 | WRITE8_HANDLER( lsasquad_sound_command_w ); | |
| 164 | READ8_HANDLER( lsasquad_sh_sound_command_r ); | |
| 165 | WRITE8_HANDLER( lsasquad_sh_result_w ); | |
| 166 | READ8_HANDLER( lsasquad_sound_result_r ); | |
| 167 | READ8_HANDLER( lsasquad_sound_status_r ); | |
| 168 | ||
| 169 | READ8_HANDLER( lsasquad_68705_portA_r ); | |
| 170 | WRITE8_HANDLER( lsasquad_68705_portA_w ); | |
| 171 | WRITE8_HANDLER( lsasquad_68705_ddrA_w ); | |
| 172 | READ8_HANDLER( lsasquad_68705_portB_r ); | |
| 173 | WRITE8_HANDLER( lsasquad_68705_portB_w ); | |
| 174 | WRITE8_HANDLER( lsasquad_68705_ddrB_w ); | |
| 175 | WRITE8_HANDLER( lsasquad_mcu_w ); | |
| 176 | READ8_HANDLER( lsasquad_mcu_r ); | |
| 177 | READ8_HANDLER( lsasquad_mcu_status_r ); | |
| 178 | ||
| 179 | READ8_HANDLER( daikaiju_mcu_r); | |
| 180 | WRITE8_HANDLER( daikaiju_mcu_w); | |
| 181 | READ8_HANDLER( daikaiju_mcu_status_r); | |
| 182 | ||
| 183 | READ8_HANDLER( daikaiju_sound_status_r ); | |
| 184 | READ8_HANDLER( daikaiju_sh_sound_command_r ); | |
| 185 | ||
| 186 | MACHINE_RESET(daikaiju); | |
| 187 | ||
| 188 | 155 | static WRITE8_HANDLER( lsasquad_bankswitch_w ) |
| 189 | 156 | { |
| 190 | 157 | UINT8 *ROM = memory_region(REGION_CPU1); |
| r2844 | r2845 | |
|---|---|---|
| 106 | 106 | in_0_shift = 0; |
| 107 | 107 | in_1_shift = 0; |
| 108 | 108 | |
| 109 | in_0 = input_port_read_indexed(machine, 0); | |
| 110 | in_1 = input_port_read_indexed(machine, 1); | |
| 109 | in_0 = input_port_read(machine, "P1"); | |
| 110 | in_1 = input_port_read(machine, "P2"); | |
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | |
| r2844 | r2845 | |
| 168 | 168 | ADDRESS_MAP_END |
| 169 | 169 | |
| 170 | 170 | static INPUT_PORTS_START( cham24 ) |
| 171 | PORT_START /* IN0 */ | |
| 171 | PORT_START_TAG("P1") /* IN0 */ | |
| 172 | 172 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 173 | 173 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 174 | 174 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) /* Select */ |
| r2844 | r2845 | |
| 178 | 178 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) |
| 179 | 179 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) |
| 180 | 180 | |
| 181 | PORT_START /* IN1 */ | |
| 181 | PORT_START_TAG("P2") /* IN1 */ | |
| 182 | 182 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 183 | 183 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 184 | 184 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) /* Select */ |
| r2844 | r2845 | |
| 205 | 205 | memcpy( &dst[0xc000], &src[0x0f8000], 0x4000 ); |
| 206 | 206 | |
| 207 | 207 | /* reset the ppu */ |
| 208 | ppu2c0x_reset( 0, 1 ); | |
| 208 | ppu2c0x_reset( machine, 0, 1 ); | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | static PALETTE_INIT( cham24 ) |
| r2844 | r2845 | |
|---|---|---|
| 310 | 310 | |
| 311 | 311 | static READ16_HANDLER( gaia_dsw_r ) |
| 312 | 312 | { |
| 313 | return input_port_read | |
| 313 | return input_port_read | |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | static WRITE16_HANDLER( cave_eeprom_msb_w ) |
| r2844 | r2845 | |
| 1061 | 1061 | static READ16_HANDLER( sailormn_input0_r ) |
| 1062 | 1062 | { |
| 1063 | 1063 | // watchdog_reset16_r(0,0); // written too rarely for mame. |
| 1064 | return input_port_read | |
| 1064 | return input_port_read | |
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | 1067 | static READ16_HANDLER( agallet_irq_cause_r ) |
| r2844 | r2845 | |
| 1960 | 1960 | /* modify the eeprom on a reset with the desired region for the games that have the |
| 1961 | 1961 | region factory set in eeprom */ |
| 1962 | 1962 | if (cave_region_byte >= 0) |
| 1963 | eeprom_get_data_pointer(0)[cave_region_byte] = input_port_read | |
| 1963 | eeprom_get_data_pointer(0)[cave_region_byte] = input_port_read | |
| 1964 | 1964 | } |
| 1965 | 1965 | |
| 1966 | 1966 | static const struct YMZ280Binterface ymz280b_intf = |
| r2844 | r2845 | |
|---|---|---|
| 208 | 208 | if (ACCESSING_BITS_24_31) |
| 209 | 209 | { |
| 210 | 210 | /* bits 13-11 are the MO control bits */ |
| 211 | atarirle_control_w(0, (data >> 27) & 7); | |
| 211 | atarirle_control_w(machine, 0, (data >> 27) & 7); | |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | if (ACCESSING_BITS_16_23) |
| r2844 | r2845 | |
|---|---|---|
| 317 | 317 | break; |
| 318 | 318 | |
| 319 | 319 | case 0x46/2: |
| 320 | return (input_port_read | |
| 320 | return (input_port_read | |
| 321 | 321 | |
| 322 | 322 | |
| 323 | 323 | } |
| r2844 | r2845 | |
| 494 | 494 | PORT_DIPSETTING( 0x02, "4" ) |
| 495 | 495 | PORT_DIPSETTING( 0x01, "5" ) |
| 496 | 496 | PORT_DIPSETTING( 0x00, "6" ) |
| 497 | ||
| 498 | ||
| 499 | 497 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) |
| 500 | 498 | PORT_DIPSETTING( 0x0c, "20k then every 60k" ) |
| 501 | 499 | PORT_DIPSETTING( 0x04, "20k then every 80k" ) |
| r2844 | r2845 | |
|---|---|---|
| 124 | 124 | r6532_reset(0); |
| 125 | 125 | r6532_reset(1); |
| 126 | 126 | |
| 127 | tia_init( &tourtabl_tia_interface ); | |
| 127 | tia_init( machine, &tourtabl_tia_interface ); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 |
| r2844 | r2845 | |
|---|---|---|
| 247 | 247 | |
| 248 | 248 | static READ8_HANDLER( leta_r ) |
| 249 | 249 | { |
| 250 | return input_port_read | |
| 250 | return input_port_read | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
| r2844 | r2845 | |
| 312 | 312 | AM_RANGE(0x5602, 0x5603) AM_MIRROR(0x0078) AM_WRITE(cloud9_led_w) |
| 313 | 313 | AM_RANGE(0x5680, 0x56ff) AM_WRITE(nvram_store_w) |
| 314 | 314 | AM_RANGE(0x5700, 0x577f) AM_WRITE(nvram_recall_w) |
| 315 | AM_RANGE(0x5800, 0x5800) AM_MIRROR(0x007e) AM_READ(input_port_0_r) | |
| 316 | AM_RANGE(0x5801, 0x5801) AM_MIRROR(0x007e) AM_READ(input_port_1_r) | |
| 315 | AM_RANGE(0x5800, 0x5800) AM_MIRROR(0x007e) AM_READ_PORT("IN0") | |
| 316 | AM_RANGE(0x5801, 0x5801) AM_MIRROR(0x007e) AM_READ_PORT("IN1") | |
| 317 | 317 | AM_RANGE(0x5900, 0x5903) AM_MIRROR(0x007c) AM_READ(leta_r) |
| 318 | 318 | AM_RANGE(0x5a00, 0x5a0f) AM_MIRROR(0x00f0) AM_READWRITE(pokey1_r, pokey1_w) |
| 319 | 319 | AM_RANGE(0x5b00, 0x5b0f) AM_MIRROR(0x00f0) AM_READWRITE(pokey2_r, pokey2_w) |
| r2844 | r2845 | |
| 330 | 330 | *************************************/ |
| 331 | 331 | |
| 332 | 332 | static INPUT_PORTS_START( cloud9 ) |
| 333 | PORT_START | |
| 333 | PORT_START_TAG("IN0") | |
| 334 | 334 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 335 | 335 | PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) |
| 336 | 336 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r2844 | r2845 | |
| 338 | 338 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 339 | 339 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(get_vblank, 0) |
| 340 | 340 | |
| 341 | PORT_START | |
| 341 | PORT_START_TAG("IN1") | |
| 342 | 342 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 343 | 343 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 344 | 344 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 345 | 345 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 346 | 346 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 347 | 347 | |
| 348 | PORT_START | |
| 348 | PORT_START_TAG("DSW") | |
| 349 | 349 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 350 | 350 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 351 | 351 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 362 | 362 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) |
| 363 | 363 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 364 | 364 | |
| 365 | PORT_START | |
| 365 | PORT_START_TAG("TRACKY") | |
| 366 | 366 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_REVERSE |
| 367 | 367 | |
| 368 | PORT_START | |
| 368 | PORT_START_TAG("TRACKX") | |
| 369 | 369 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) |
| 370 | 370 | INPUT_PORTS_END |
| 371 | 371 | |
| 372 | 372 | |
| 373 | 373 | static INPUT_PORTS_START( firebeas ) |
| 374 | PORT_START | |
| 374 | PORT_START_TAG("IN0") | |
| 375 | 375 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 376 | 376 | PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) |
| 377 | 377 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r2844 | r2845 | |
| 379 | 379 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 380 | 380 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(get_vblank, 0) |
| 381 | 381 | |
| 382 | PORT_START | |
| 382 | PORT_START_TAG("IN1") | |
| 383 | 383 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 384 | 384 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 385 | 385 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r2844 | r2845 | |
| 387 | 387 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 388 | 388 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 389 | 389 | |
| 390 | PORT_START | |
| 390 | PORT_START_TAG("DSW") | |
| 391 | 391 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 392 | 392 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 393 | 393 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 413 | 413 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 414 | 414 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 415 | 415 | |
| 416 | PORT_START | |
| 416 | PORT_START_TAG("TRACKY") | |
| 417 | 417 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_REVERSE |
| 418 | 418 | |
| 419 | PORT_START | |
| 419 | PORT_START_TAG("TRACKX") | |
| 420 | 420 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_REVERSE |
| 421 | 421 | INPUT_PORTS_END |
| 422 | 422 |
| r2844 | r2845 | |
|---|---|---|
| 95 | 95 | |
| 96 | 96 | static READ8_HANDLER( changela_68705_portB_r ) |
| 97 | 97 | { |
| 98 | return (portB_out & ddrB) | (input_port_read | |
| 98 | return (portB_out & ddrB) | (input_port_read | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | static WRITE8_HANDLER( changela_68705_portB_w ) |
| r2844 | r2845 | |
| 177 | 177 | |
| 178 | 178 | static READ8_HANDLER( changela_30_r ) |
| 179 | 179 | { |
| 180 | return input_port_read | |
| 180 | return input_port_read | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | static READ8_HANDLER( changela_31_r ) |
| r2844 | r2845 | |
| 186 | 186 | or if the new value is greater than the old value, and it did wrap around, |
| 187 | 187 | then we are moving LEFT. */ |
| 188 | 188 | static UINT8 prev_value = 0; |
| 189 | UINT8 curr_value = input_port_read | |
| 189 | UINT8 curr_value = input_port_read | |
| 190 | 190 | static int dir = 0; |
| 191 | 191 | |
| 192 | 192 | if( (curr_value < prev_value && (prev_value - curr_value) < 0x80) |
| r2844 | r2845 | |
| 204 | 204 | |
| 205 | 205 | static READ8_HANDLER( changela_2c_r ) |
| 206 | 206 | { |
| 207 | int val = input_port_read | |
| 207 | int val = input_port_read | |
| 208 | 208 | |
| 209 | 209 | val = (val&0x30) | ((val&1)<<7) | (((val&1)^1)<<6); |
| 210 | 210 | |
| r2844 | r2845 | |
| 221 | 221 | v8 = 1; |
| 222 | 222 | |
| 223 | 223 | /* Gas pedal is made up of 2 switches, 1 active low, 1 active high */ |
| 224 | switch(input_port_read | |
| 224 | switch(input_port_read | |
| 225 | 225 | { |
| 226 | 226 | case 0x02: |
| 227 | 227 | gas = 0x80; |
| r2844 | r2845 | |
| 234 | 234 | break; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | return (input_port_read | |
| 237 | return (input_port_read | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | static WRITE8_HANDLER( mcu_PC0_w ) |
| r2844 | r2845 | |
| 318 | 318 | |
| 319 | 319 | |
| 320 | 320 | static INPUT_PORTS_START( changela ) |
| 321 | PORT_START | |
| 321 | PORT_START_TAG("DSWA") /* DSWA */ | |
| 322 | 322 | PORT_DIPNAME( 0x07, 0x01, "Steering Wheel Ratio" ) |
| 323 | 323 | PORT_DIPSETTING( 0x01, "Recommended" ) |
| 324 | 324 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) ) |
| r2844 | r2845 | |
| 337 | 337 | PORT_DIPSETTING( 0x80, "1" ) |
| 338 | 338 | PORT_DIPSETTING( 0x00, "2" ) |
| 339 | 339 | |
| 340 | PORT_START | |
| 340 | PORT_START_TAG("DSWB") /* DSWB */ | |
| 341 | 341 | PORT_DIPNAME( 0x03, 0x00, "Max Bonus Fuels" ) |
| 342 | 342 | PORT_DIPSETTING( 0x01, "1" ) |
| 343 | 343 | PORT_DIPSETTING( 0x02, "2" ) |
| r2844 | r2845 | |
| 360 | 360 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 361 | 361 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 362 | 362 | |
| 363 | PORT_START | |
| 363 | PORT_START_TAG("DSWC") /* DSWC - coinage */ | |
| 364 | 364 | PORT_DIPNAME( 0xf0, 0x10, DEF_STR( Coin_A ) ) |
| 365 | 365 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 366 | 366 | PORT_DIPSETTING( 0x90, DEF_STR( 2C_1C ) ) |
| r2844 | r2845 | |
| 394 | 394 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_6C ) ) |
| 395 | 395 | PORT_DIPSETTING( 0x07, DEF_STR( 1C_7C ) ) |
| 396 | 396 | |
| 397 | PORT_START | |
| 397 | PORT_START_TAG("DSWD") /* DSWD - bonus */ | |
| 398 | 398 | PORT_DIPNAME( 0x01, 0x01, "Right Coin Counter" ) |
| 399 | 399 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 400 | 400 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r2844 | r2845 | |
| 416 | 416 | PORT_DIPSETTING( 0x40, "Short Name" ) |
| 417 | 417 | PORT_DIPSETTING( 0x00, "Long Name" ) |
| 418 | 418 | |
| 419 | PORT_START | |
| 419 | PORT_START_TAG("MCU") | |
| 420 | 420 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 421 | 421 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) |
| 422 | 422 | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| r2844 | r2845 | |
| 428 | 428 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 429 | 429 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 430 | 430 | |
| 431 | PORT_START | |
| 431 | PORT_START_TAG("IN0") /* 0xDx2C */ | |
| 432 | 432 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gear Shift") PORT_CODE(KEYCODE_SPACE) PORT_TOGGLE /* Gear shift */ |
| 433 | 433 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 434 | 434 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 435 | 435 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* FWD - negated bit 7 */ |
| 436 | 436 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* REV - gear position */ |
| 437 | 437 | |
| 438 | PORT_START | |
| 438 | PORT_START_TAG("IN1") /* 0xDx2D */ | |
| 439 | 439 | PORT_BIT( 0x03, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0x02) PORT_SENSITIVITY(10) PORT_KEYDELTA(1) //gas pedal |
| 440 | 440 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 441 | 441 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT ) |
| 442 | 442 | //PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) //gas1 |
| 443 | 443 | //PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) //gas2 |
| 444 | 444 | |
| 445 | PORT_START | |
| 445 | PORT_START_TAG("WHEEL") /* 0xDx30 DRIVING_WHEEL */ | |
| 446 | 446 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(50) PORT_KEYDELTA(8) |
| 447 | 447 | |
| 448 | 448 |
| r2844 | r2845 | |
|---|---|---|
| 219 | 219 | #include "sound/2610intf.h" |
| 220 | 220 | #include "sound/2151intf.h" |
| 221 | 221 | #include "sound/msm5205.h" |
| 222 | #include "includes/cchip.h" | |
| 222 | 223 | |
| 223 | 224 | WRITE16_HANDLER( asuka_spritectrl_w ); |
| 224 | 225 | |
| r2844 | r2845 | |
| 230 | 231 | VIDEO_UPDATE( asuka ); |
| 231 | 232 | VIDEO_UPDATE( bonzeadv ); |
| 232 | 233 | |
| 233 | READ16_HANDLER( bonzeadv_cchip_r ); | |
| 234 | READ16_HANDLER( bonzeadv_cchip_ctrl_r ); | |
| 235 | READ16_HANDLER( bonzeadv_cchip_ram_r ); | |
| 236 | WRITE16_HANDLER( bonzeadv_cchip_ctrl_w ); | |
| 237 | WRITE16_HANDLER( bonzeadv_cchip_bank_w ); | |
| 238 | WRITE16_HANDLER( bonzeadv_cchip_ram_w ); | |
| 239 | ||
| 240 | ||
| 241 | 234 | /*********************************************************** |
| 242 | 235 | INTERRUPTS |
| 243 | 236 | ***********************************************************/ |
| r2844 | r2845 | |
|---|---|---|
| 71 | 71 | state_save_register_global_pointer(deco16_pf12_control, 0x10/2); |
| 72 | 72 | state_save_register_global_pointer(deco16_pf34_control, 0x10/2); |
| 73 | 73 | |
| 74 | deco16_2_video_init(0); | |
| 74 | deco16_2_video_init(machine, 0); | |
| 75 | 75 | |
| 76 | 76 | deco16_pf1_colour_bank = 0x00; |
| 77 | 77 | deco16_pf2_colour_bank = 0x40; |
| r2844 | r2845 | |
| 228 | 228 | { |
| 229 | 229 | /* some kind of screen indicator? checked by backfira set before it will boot */ |
| 230 | 230 | int backfire_screen = mame_rand(machine)&1; |
| 231 | return ((eeprom_read_bit()<<24) | input_port_read | |
| 231 | return ((eeprom_read_bit()<<24) | input_port_read | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | static READ32_HANDLER(backfire_control2_r) |
| 235 | 235 | { |
| 236 | 236 | // logerror("%08x:Read eprom %08x (%08x)\n",activecpu_get_pc(),offset<<1,mem_mask); |
| 237 | return (eeprom_read_bit()<<24) | input_port_read | |
| 237 | return (eeprom_read_bit()<<24) | input_port_read | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | #ifdef UNUSED_FUNCTION |
| 241 | 241 | static READ32_HANDLER(backfire_control3_r) |
| 242 | 242 | { |
| 243 | 243 | // logerror("%08x:Read eprom %08x (%08x)\n",activecpu_get_pc(),offset<<1,mem_mask); |
| 244 | return (eeprom_read_bit()<<24) | input_port_read | |
| 244 | return (eeprom_read_bit()<<24) | input_port_read | |
| 245 | 245 | } |
| 246 | 246 | #endif |
| 247 | 247 | |
| r2844 | r2845 | |
| 303 | 303 | #ifdef UNUSED_FUNCTION |
| 304 | 304 | READ32_HANDLER( backfire_unknown_wheel_r ) |
| 305 | 305 | { |
| 306 | return input_port_read | |
| 306 | return input_port_read | |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | READ32_HANDLER( backfire_wheel1_r ) |
| r2844 | r2845 | |
| 356 | 356 | |
| 357 | 357 | |
| 358 | 358 | static INPUT_PORTS_START( backfire ) |
| 359 | PORT_START | |
| 359 | PORT_START_TAG("IN0") | |
| 360 | 360 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 361 | 361 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 362 | 362 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| r2844 | r2845 | |
| 366 | 366 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) |
| 367 | 367 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) |
| 368 | 368 | |
| 369 | PORT_START | |
| 369 | PORT_START_TAG("IN1") | |
| 370 | 370 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) |
| 371 | 371 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| 372 | 372 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| r2844 | r2845 | |
| 376 | 376 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 377 | 377 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 378 | 378 | |
| 379 | PORT_START | |
| 379 | PORT_START_TAG("IN2") | |
| 380 | 380 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 381 | 381 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 382 | 382 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r2844 | r2845 | |
| 394 | 394 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) |
| 395 | 395 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 396 | 396 | |
| 397 | PORT_START | |
| 397 | PORT_START_TAG("IN3") | |
| 398 | 398 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 399 | 399 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 400 | 400 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r2844 | r2845 | |
| 404 | 404 | PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 405 | 405 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 406 | 406 | |
| 407 | PORT_START | |
| 407 | PORT_START_TAG("PADDLE0") | |
| 408 | 408 | PORT_BIT ( 0x00ff, 0x0080, IPT_PADDLE ) PORT_SENSITIVITY(30) PORT_KEYDELTA(1) |
| 409 | 409 | |
| 410 | PORT_START | |
| 410 | PORT_START_TAG("PADDLE1") | |
| 411 | 411 | PORT_BIT ( 0x00ff, 0x0080, IPT_PADDLE ) PORT_SENSITIVITY(30) PORT_KEYDELTA(1) |
| 412 | 412 | |
| 413 | PORT_START | |
| 413 | PORT_START_TAG("UNK") | |
| 414 | 414 | /* ?? */ |
| 415 | 415 | INPUT_PORTS_END |
| 416 | 416 |
| r2844 | r2845 | |
|---|---|---|
| 98 | 98 | #include "cpu/m68000/m68000.h" |
| 99 | 99 | #include "cpu/ds5002fp/ds5002fp.h" |
| 100 | 100 | #include "sound/okim6295.h" |
| 101 | #include "includes/wrally.h" | |
| 101 | 102 | |
| 102 | /* from video/wrally.c */ | |
| 103 | extern UINT16 *wrally_vregs; | |
| 104 | extern UINT16 *wrally_videoram; | |
| 105 | extern UINT16 *wrally_spriteram; | |
| 106 | 103 | static UINT16 *wrally_shareram; |
| 107 | 104 | |
| 108 | VIDEO_START( wrally ); | |
| 109 | VIDEO_UPDATE( wrally ); | |
| 110 | ||
| 111 | /* from machine/wrally.c */ | |
| 112 | DRIVER_INIT( wrally ); | |
| 113 | MACHINE_RESET( wrally ); | |
| 114 | READ32_HANDLER( wrally_external_ram_iaddr ); | |
| 115 | WRITE16_HANDLER( wrally_vram_w ); | |
| 116 | WRITE16_HANDLER( wrally_flipscreen_w ); | |
| 117 | WRITE16_HANDLER( OKIM6295_bankswitch_w ); | |
| 118 | WRITE16_HANDLER( wrally_coin_counter_w ); | |
| 119 | WRITE16_HANDLER( wrally_coin_lockout_w ); | |
| 120 | ||
| 121 | 105 | static ADDRESS_MAP_START( wrally_readmem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 122 | 106 | AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ |
| 123 | 107 | AM_RANGE(0x100000, 0x103fff) AM_READWRITE(SMH_RAM, wrally_vram_w) AM_BASE(&wrally_videoram) /* encrypted Video RAM */ |
| r2844 | r2845 | |
|---|---|---|
| 284 | 284 | |
| 285 | 285 | /* miscellaneous output */ |
| 286 | 286 | case 0x06/2: |
| 287 | system18_set_grayscale(~data & 0x40); | |
| 287 | system18_set_grayscale(machine, ~data & 0x40); | |
| 288 | 288 | segaic16_tilemap_set_flip(0, data & 0x20); |
| 289 | 289 | segaic16_sprites_set_flip(0, data & 0x20); |
| 290 | 290 | /* These are correct according to cgfm's docs, but mwalker and ddcrew both |
| r2844 | r2845 | |
| 310 | 310 | |
| 311 | 311 | /* CNT register */ |
| 312 | 312 | case 0x1c/2: |
| 313 | segaic16_set_display_enable(data & 2); | |
| 313 | segaic16_set_display_enable(machine, data & 2); | |
| 314 | 314 | if ((old ^ data) & 4) |
| 315 | system18_set_vdp_enable(data & 4); | |
| 315 | system18_set_vdp_enable(machine, data & 4); | |
| 316 | 316 | break; |
| 317 | 317 | } |
| 318 | 318 | } |
| r2844 | r2845 | |
| 358 | 358 | case 0x2000/2: |
| 359 | 359 | if (ACCESSING_BITS_0_7) |
| 360 | 360 | { |
| 361 | system18_set_vdp_mixing(data & 0xff); | |
| 361 | system18_set_vdp_mixing(machine, data & 0xff); | |
| 362 | 362 | return; |
| 363 | 363 | } |
| 364 | 364 | break; |
| r2844 | r2845 | |
|---|---|---|
| 186 | 186 | Input Ports |
| 187 | 187 | ***************************************************************************/ |
| 188 | 188 | |
| 189 | INPUT_PORTS_START( showhand ) | |
| 189 | static INPUT_PORTS_START( showhand ) | |
| 190 | 190 | PORT_START_TAG("INPUTS") // 54000 |
| 191 | 191 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) // coin |
| 192 | 192 | PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_F1) // payout (must be 0 on startup) |
| r2844 | r2845 | |
|---|---|---|
| 14 | 14 | #include "video/konamiic.h" |
| 15 | 15 | #include "sound/2151intf.h" |
| 16 | 16 | #include "sound/k007232.h" |
| 17 | #include "includes/ajax.h" | |
| 17 | 18 | |
| 18 | 19 | static WRITE8_HANDLER( k007232_extvol_w ); |
| 19 | 20 | static WRITE8_HANDLER( sound_bank_w ); |
| 20 | 21 | |
| 21 | /* from machine/ajax.c */ | |
| 22 | WRITE8_HANDLER( ajax_bankswitch_2_w ); | |
| 23 | READ8_HANDLER( ajax_ls138_f10_r ); | |
| 24 | WRITE8_HANDLER( ajax_ls138_f10_w ); | |
| 25 | MACHINE_RESET( ajax ); | |
| 26 | INTERRUPT_GEN( ajax_interrupt ); | |
| 27 | ||
| 28 | /* from video/ajax.c */ | |
| 29 | VIDEO_START( ajax ); | |
| 30 | VIDEO_UPDATE( ajax ); | |
| 31 | ||
| 32 | 22 | /****************************************************************************/ |
| 33 | 23 | |
| 34 | 24 | static ADDRESS_MAP_START( ajax_main_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2844 | r2845 | |
|---|---|---|
| 39 | 39 | #include "sound/discrete.h" |
| 40 | 40 | #include "nitedrvr.h" |
| 41 | 41 | |
| 42 | READ8_HANDLER( nitedrvr_in0_r ); | |
| 43 | READ8_HANDLER( nitedrvr_in1_r ); | |
| 44 | READ8_HANDLER( nitedrvr_steering_reset_r ); | |
| 45 | WRITE8_HANDLER( nitedrvr_steering_reset_w ); | |
| 46 | WRITE8_HANDLER( nitedrvr_out0_w ); | |
| 47 | WRITE8_HANDLER( nitedrvr_out1_w ); | |
| 48 | void nitedrvr_register_machine_vars(void); | |
| 49 | ||
| 50 | extern UINT8 *nitedrvr_hvc; | |
| 51 | ||
| 52 | WRITE8_HANDLER( nitedrvr_videoram_w ); | |
| 53 | WRITE8_HANDLER( nitedrvr_hvc_w ); | |
| 54 | ||
| 55 | VIDEO_START( nitedrvr ); | |
| 56 | VIDEO_UPDATE( nitedrvr ); | |
| 57 | ||
| 58 | 42 | /* Memory Map */ |
| 59 | 43 | |
| 60 | 44 | static ADDRESS_MAP_START( nitedrvr_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r2844 | r2845 | |
|---|---|---|
| 2055 | 2055 | const debug_cpu_info *info; |
| 2056 | 2056 | int spacenum = ref; |
| 2057 | 2057 | offs_t taddress; |
| 2058 | int intention; | |
| 2058 | 2059 | |
| 2059 | 2060 | /* validate parameters */ |
| 2060 | 2061 | if (!debug_command_parameter_number(param[0], &address)) |
| r2844 | r2845 | |
| 2062 | 2063 | info = debug_get_cpu_info(cpunum); |
| 2063 | 2064 | |
| 2064 | 2065 | /* do the translation first */ |
| 2065 | taddress = ADDR2BYTE_MASKED(address, info, spacenum); | |
| 2066 | if (info->translate != NULL) | |
| 2066 | for (intention = TRANSLATE_READ_DEBUG; intention <= TRANSLATE_FETCH_DEBUG; intention++) | |
| 2067 | 2067 | { |
| 2068 | if ((*info->translate)(spacenum, TRANSLATE_READ_DEBUG, &taddress)) | |
| 2069 | debug_console_printf("%08X logical -> %08X physical\n", (UINT32)address, BYTE2ADDR(taddress, info, spacenum)); | |
| 2068 | static const char *intnames[] = { "Read", "Write", "Fetch" }; | |
| 2069 | taddress = ADDR2BYTE_MASKED(address, info, spacenum); | |
| 2070 | if (info->translate != NULL) | |
| 2071 | { | |
| 2072 | if ((*info->translate)(spacenum, intention, &taddress)) | |
| 2073 | { | |
| 2074 | const char *mapname = memory_get_handler_string(intention == TRANSLATE_WRITE_DEBUG, cpunum, spacenum, taddress); | |
| 2075 | debug_console_printf("%7s: %08X logical == %08X physical -> %s\n", intnames[intention & 3], (UINT32)address, BYTE2ADDR(taddress, info, spacenum), mapname); | |
| 2076 | } | |
| 2077 | else | |
| 2078 | debug_console_printf("%7s: %08X logical is unmapped\n", intnames[intention & 3], (UINT32)address); | |
| 2079 | } | |
| 2070 | 2080 | else |
| 2071 | 2081 | { |
| 2072 | debug_console_printf("%08X logical -> unmapped\n", (UINT32)address); | |
| 2073 | return; | |
| 2082 | const char *mapname = memory_get_handler_string(intention == TRANSLATE_WRITE_DEBUG, cpunum, spacenum, taddress); | |
| 2083 | debug_console_printf("%7s: %08X -> %s\n", intnames[intention & 3], BYTE2ADDR(taddress, info, spacenum), mapname); | |
| 2074 | 2084 | } |
| 2075 | 2085 | } |
| 2076 | else | |
| 2077 | debug_console_printf("%08X physical\n", BYTE2ADDR(taddress, info, spacenum)); | |
| 2078 | ||
| 2079 | /* now do the mapping */ | |
| 2080 | debug_console_printf(" -> read: %s\n", memory_get_handler_string(0, cpunum, spacenum, taddress)); | |
| 2081 | debug_console_printf(" -> write: %s\n", memory_get_handler_string(1, cpunum, spacenum, taddress)); | |
| 2082 | 2086 | } |
| 2083 | 2087 | |
| 2084 | 2088 |
| r2844 | r2845 | |
|---|---|---|
| 24 | 24 | $(CPUOBJ)/drccache.o \ |
| 25 | 25 | $(CPUOBJ)/drcfe.o \ |
| 26 | 26 | $(CPUOBJ)/drcuml.o \ |
| 27 | $(CPUOBJ)/drcumld.o \ | |
| 28 | 27 | |
| 29 | 28 | DRCDEPS = \ |
| 30 | 29 | $(CPUSRC)/drcbeut.h \ |
| 31 | 30 | $(CPUSRC)/drccache.h \ |
| 32 | 31 | $(CPUSRC)/drcfe.h \ |
| 33 | 32 | $(CPUSRC)/drcuml.h \ |
| 34 | $(CPUSRC)/drcumld.h \ | |
| 35 | 33 | $(CPUSRC)/drcumlsh.h \ |
| 36 | 34 | |
| 37 | 35 | # fixme - need to make this work for other target architectures (PPC) |
| r2844 | r2845 | |
| 270 | 268 | CPUDEFS += -DHAS_COP410=$(if $(filter COP410,$(CPUS)),1,0) |
| 271 | 269 | CPUDEFS += -DHAS_COP411=$(if $(filter COP411,$(CPUS)),1,0) |
| 272 | 270 | CPUDEFS += -DHAS_COP420=$(if $(filter COP420,$(CPUS)),1,0) |
| 271 | CPUDEFS += -DHAS_COP421=$(if $(filter COP421,$(CPUS)),1,0) | |
| 273 | 272 | |
| 274 | 273 | ifneq ($(filter COP410 COP411,$(CPUS)),) |
| 275 | 274 | OBJDIRS += $(CPUOBJ)/cop400 |
| r2844 | r2845 | |
| 277 | 276 | DBGOBJS += $(CPUOBJ)/cop400/cop410ds.o |
| 278 | 277 | endif |
| 279 | 278 | |
| 280 | ifneq ($(filter COP420,$(CPUS)),) | |
| 279 | ifneq ($(filter COP420 COP421,$(CPUS)),) | |
| 281 | 280 | OBJDIRS += $(CPUOBJ)/cop400 |
| 282 | 281 | CPUOBJS += $(CPUOBJ)/cop400/cop420.o |
| 283 | 282 | DBGOBJS += $(CPUOBJ)/cop400/cop420ds.o |
| r2844 | r2845 | |
| 837 | 836 | DBGOBJS += $(CPUOBJ)/mips/mips3dsm.o |
| 838 | 837 | endif |
| 839 | 838 | |
| 840 | $(CPUOBJ)/mips/mips3drc.o: $(CPUSRC)/mips/mips3drc.c \ | |
| 841 | $(CPUSRC)/mips/mips3.h \ | |
| 842 | $(CPUSRC)/mips/mips3com.h \ | |
| 843 | $(CPUSRC)/mips/mips3fe.h \ | |
| 844 | $(DRCDEPS) | |
| 839 | $(CPUOBJ)/powerpc/mips3com.o: $(CPUSRC)/powerpc/mips3.h \ | |
| 840 | $(CPUSRC)/powerpc/mips3com.h | |
| 845 | 841 | |
| 842 | $(CPUOBJ)/powerpc/mips3fe.o: $(CPUSRC)/powerpc/mips3.h \ | |
| 843 | $(CPUSRC)/powerpc/mips3com.h \ | |
| 844 | $(CPUSRC)/powerpc/mips3fe.h | |
| 846 | 845 | |
| 846 | $(CPUOBJ)/mips/mips3drc.o: $(CPUSRC)/mips/mips3drc.c \ | |
| 847 | $(CPUSRC)/mips/mips3.h \ | |
| 848 | $(CPUSRC)/mips/mips3com.h \ | |
| 849 | $(CPUSRC)/mips/mips3fe.h \ | |
| 850 | $(DRCDEPS) | |
| 847 | 851 | |
| 852 | ||
| 853 | ||
| 848 | 854 | #------------------------------------------------- |
| 849 | 855 | # Mitsubishi M37702 and M37710 (based on 65C816) |
| 850 | 856 | #------------------------------------------------- |
| r2844 | r2845 | |
| 1135 | 1141 | DBGOBJS += $(CPUOBJ)/powerpc/ppc_dasm.o |
| 1136 | 1142 | endif |
| 1137 | 1143 | |
| 1144 | $(CPUOBJ)/powerpc/ppccom.o: $(CPUSRC)/powerpc/ppc.h \ | |
| 1145 | $(CPUSRC)/powerpc/ppccom.h | |
| 1146 | ||
| 1147 | $(CPUOBJ)/powerpc/ppcfe.o: $(CPUSRC)/powerpc/ppc.h \ | |
| 1148 | $(CPUSRC)/powerpc/ppccom.h \ | |
| 1149 | $(CPUSRC)/powerpc/ppcfe.h | |
| 1150 | ||
| 1138 | 1151 | $(CPUOBJ)/powerpc/ppcdrc.o: $(CPUSRC)/powerpc/ppcdrc.c \ |
| 1139 | 1152 | $(CPUSRC)/powerpc/ppc.h \ |
| 1140 | 1153 | $(CPUSRC)/powerpc/ppccom.h \ |
| r2844 | r2845 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | Future improvements/changes: |
| 14 | 14 | |
| 15 | * change from detecting live to detecting unnecessary | |
| 16 | - at the end of sequence: mustupdate.all = TRUE; | |
| 17 | - scan backwards: | |
| 18 | inst.mustupdate = inst.update & mustupdate; | |
| 19 | if (inst.modified.reg) mustupdate.reg = FALSE; | |
| 20 | if (inst.used.reg) mustupdate.reg = TRUE; | |
| 15 | * more aggressive handling of needed registers for conditional | |
| 16 | intrablock branches | |
| 21 | 17 | |
| 22 | * rename UINT64 gpr, fpr to UINT32 reg[4] | |
| 23 | ||
| 24 | 18 | ***************************************************************************/ |
| 25 | 19 | |
| 26 | 20 | #include <stddef.h> |
| r2844 | r2845 | |
| 80 | 74 | |
| 81 | 75 | static opcode_desc *describe_one(drcfe_state *drcfe, offs_t curpc); |
| 82 | 76 | static opcode_desc **build_sequence(drcfe_state *drcfe, opcode_desc **tailptr, int start, int end, UINT32 endflag); |
| 83 | static void accumulate_live_info_forwards(opcode_desc *desc, UINT64 *gprread, UINT64 *gprwrite, UINT64 *fprread, UINT64 *fprwrite); | |
| 84 | static void accumulate_live_info_backwards(opcode_desc *desc, UINT64 *gprread, UINT64 *gprwrite, UINT64 *fprread, UINT64 *fprwrite); | |
| 77 | static void accumulate_required_backwards(opcode_desc *desc, UINT32 *reqmask); | |
| 85 | 78 | static void release_descriptions(drcfe_state *drcfe, opcode_desc *desc); |
| 86 | 79 | |
| 87 | 80 | |
| r2844 | r2845 | |
| 332 | 325 | { |
| 333 | 326 | opcode_desc **tailptr = &desc->delay; |
| 334 | 327 | offs_t delaypc = curpc + desc->length; |
| 328 | opcode_desc *prev = desc; | |
| 335 | 329 | UINT8 slotnum; |
| 336 | 330 | |
| 337 | 331 | /* iterate over slots and describe them */ |
| r2844 | r2845 | |
| 345 | 339 | /* set the delay slot flag and a pointer back to the original branch */ |
| 346 | 340 | (*tailptr)->flags |= OPFLAG_IN_DELAY_SLOT; |
| 347 | 341 | (*tailptr)->branch = desc; |
| 342 | (*tailptr)->prev = prev; | |
| 343 | prev = *tailptr; | |
| 348 | 344 | |
| 349 | 345 | /* stop if we hit a page fault */ |
| 350 | 346 | if ((*tailptr)->flags & OPFLAG_COMPILER_PAGE_FAULT) |
| r2844 | r2845 | |
| 367 | 363 | |
| 368 | 364 | static opcode_desc **build_sequence(drcfe_state *drcfe, opcode_desc **tailptr, int start, int end, UINT32 endflag) |
| 369 | 365 | { |
| 370 | UINT64 gprread = 0, gprwrite = 0; | |
| 371 | UINT64 fprread = 0, fprwrite = 0; | |
| 366 | opcode_desc *prev = NULL; | |
| 372 | 367 | int consecutive = 0; |
| 373 | 368 | int seqstart = -1; |
| 374 | 369 | int skipsleft = 0; |
| r2844 | r2845 | |
| 431 | 426 | if (curdesc->flags & OPFLAG_END_SEQUENCE) |
| 432 | 427 | consecutive = 0; |
| 433 | 428 | |
| 434 | /* update register accumulators */ | |
| 435 | accumulate_live_info_forwards(curdesc, &gprread, &gprwrite, &fprread, &fprwrite); | |
| 436 | ||
| 437 | 429 | /* if this is the end of a sequence, work backwards */ |
| 438 | 430 | if (curdesc->flags & OPFLAG_END_SEQUENCE) |
| 439 | 431 | { |
| 432 | UINT32 reqmask[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; | |
| 440 | 433 | int backdesc; |
| 441 | 434 | |
| 442 | /* loop until all the registers have been accounted for */ | |
| 443 | gprread = gprwrite = 0; | |
| 444 | fprread = fprwrite = 0; | |
| 435 | /* figure out which registers we *must* generate, assuming at the end all must be */ | |
| 445 | 436 | if (seqstart != -1) |
| 446 | 437 | for (backdesc = descnum; backdesc != seqstart - 1; backdesc--) |
| 447 | 438 | if (drcfe->desc_array[backdesc] != NULL) |
| 448 | accumulate_ | |
| 439 | accumulate_required_ | |
| 449 | 440 | |
| 450 | 441 | /* reset the register states */ |
| 451 | 442 | seqstart = -1; |
| 452 | gprread = gprwrite = 0; | |
| 453 | fprread = fprwrite = 0; | |
| 454 | 443 | } |
| 455 | 444 | |
| 456 | 445 | /* if we have instructions remaining to be skipped, and this instruction is a branch target */ |
| r2844 | r2845 | |
| 463 | 452 | { |
| 464 | 453 | *tailptr = curdesc; |
| 465 | 454 | tailptr = &curdesc->next; |
| 455 | curdesc->prev = prev; | |
| 456 | prev = curdesc; | |
| 466 | 457 | } |
| 467 | 458 | else |
| 468 | 459 | desc_free(drcfe, curdesc); |
| r2844 | r2845 | |
| 484 | 475 | |
| 485 | 476 | |
| 486 | 477 | /*------------------------------------------------- |
| 487 | accumulate_ | |
| 478 | accumulate_r | |
| 488 | 479 | accumulate live register liveness information |
| 489 | walking in a | |
| 480 | walking in a backwards direction | |
| 490 | 481 | -------------------------------------------------*/ |
| 491 | 482 | |
| 492 | static void accumulate_ | |
| 483 | static void accumulate_r | |
| 493 | 484 | { |
| 494 | /* set the initial information */ | |
| 495 | desc->gpr.liveread = (*gprread |= desc->gpr.used); | |
| 496 | desc->gpr.livewrite = (*gprwrite |= desc->gpr.modified); | |
| 497 | desc->fpr.liveread = (*fprread |= desc->fpr.used); | |
| 498 | desc->fpr.livewrite = (*fprwrite |= desc->fpr.modified); | |
| 499 | ||
| 500 | 485 | /* recursively handle delay slots */ |
| 501 | 486 | if (desc->delay != NULL) |
| 502 | accumulate_live_info_forwards(desc->delay, gprread, gprwrite, fprread, fprwrite); | |
| 503 | } | |
| 487 | accumulate_required_backwards(desc->delay, reqmask); | |
| 504 | 488 | |
| 489 | /* if this is a branch, we have to reset our requests */ | |
| 490 | if (desc->flags & OPFLAG_IS_BRANCH) | |
| 491 | reqmask[0] = reqmask[1] = reqmask[2] = reqmask[3] = 0xffffffff; | |
| 505 | 492 | |
| 506 | /*------------------------------------------------- | |
| 507 | accumulate_live_info_backwards - recursively | |
| 508 | accumulate live register liveness information | |
| 509 | walking in a backwards direction | |
| 510 | -------------------------------------------------*/ | |
| 493 | /* determine the required registers */ | |
| 494 | desc->regreq[0] = desc->regout[0] & reqmask[0]; | |
| 495 | desc->regreq[1] = desc->regout[1] & reqmask[1]; | |
| 496 | desc->regreq[2] = desc->regout[2] & reqmask[2]; | |
| 497 | desc->regreq[3] = desc->regout[3] & reqmask[3]; | |
| 511 | 498 | |
| 512 | static void accumulate_live_info_backwards(opcode_desc *desc, UINT64 *gprread, UINT64 *gprwrite, UINT64 *fprread, UINT64 *fprwrite) | |
| 513 | { | |
| 514 | /* recursively handle delay slots */ | |
| 515 | if (desc->delay != NULL) | |
| 516 | accumulate_live_info_backwards(desc->delay, gprread, gprwrite, fprread, fprwrite); | |
| 499 | /* any registers modified by this instruction aren't required upstream until referenced */ | |
| 500 | reqmask[0] &= ~desc->regout[0]; | |
| 501 | reqmask[1] &= ~desc->regout[1]; | |
| 502 | reqmask[2] &= ~desc->regout[2]; | |
| 503 | reqmask[3] &= ~desc->regout[3]; | |
| 517 | 504 | |
| 518 | /* accumulate the info from this instruction */ | |
| 519 | desc->gpr.liveread &= (*gprread |= desc->gpr.used); | |
| 520 | desc->gpr.livewrite &= (*gprwrite |= desc->gpr.modified); | |
| 521 | desc->fpr.liveread &= (*fprread |= desc->fpr.used); | |
| 522 | desc->fpr.livewrite &= (*fprwrite |= desc->fpr.modified); | |
| 505 | /* any registers required by this instruction now get marked required */ | |
| 506 | reqmask[0] |= desc->regin[0]; | |
| 507 | reqmask[1] |= desc->regin[1]; | |
| 508 | reqmask[2] |= desc->regin[2]; | |
| 509 | reqmask[3] |= desc->regin[3]; | |
| 523 | 510 | } |
| 524 | 511 | |
| 525 | 512 |
| r2844 | r2845 | |
|---|---|---|
| 13 | 13 | Future improvements/changes: |
| 14 | 14 | |
| 15 | 15 | * UML optimizer: |
| 16 | - detects constant operations, converts to MOV | |
| 17 | - eliminates no-ops (add i0,i0,0) | |
| 18 | - determines flags automatically | |
| 19 | 16 | - constant folding |
| 20 | 17 | |
| 21 | 18 | * Write a back-end validator: |
| r2844 | r2845 | |
| 41 | 38 | |
| 42 | 39 | #include "drcuml.h" |
| 43 | 40 | #include "drcumlsh.h" |
| 44 | #include "drcumld.h" | |
| 45 | 41 | #include "deprecat.h" |
| 42 | #include "eminline.h" | |
| 46 | 43 | #include "mame.h" |
| 47 | 44 | #include <stdarg.h> |
| 48 | 45 | #include <setjmp.h> |
| r2844 | r2845 | |
| 53 | 50 | ***************************************************************************/ |
| 54 | 51 | |
| 55 | 52 | #define VALIDATE_BACKEND (0) |
| 53 | #define LOG_SIMPLIFICATIONS (0) | |
| 56 | 54 | |
| 57 | 55 | |
| 58 | 56 | |
| r2844 | r2845 | |
| 61 | 59 | ***************************************************************************/ |
| 62 | 60 | |
| 63 | 61 | /* opcode validation condition/flag valid bitmasks */ |
| 64 | #define OV_CONDFLAG_NONE 0x00 | |
| 65 | #define OV_CONDFLAG_COND 0x80 | |
| 66 | #define OV_CONDFLAG_SZ (DRCUML_FLAG_S | DRCUML_FLAG_Z) | |
| 67 | #define OV_CONDFLAG_SZC (DRCUML_FLAG_S | DRCUML_FLAG_Z | DRCUML_FLAG_C) | |
| 68 | #define OV_CONDFLAG_SZVC (DRCUML_FLAG_S | DRCUML_FLAG_Z | DRCUML_FLAG_V | DRCUML_FLAG_C) | |
| 69 | #define OV_CONDFLAG_UZC (DRCUML_FLAG_U | DRCUML_FLAG_Z | DRCUML_FLAG_C) | |
| 70 | #define OV_CONDFLAG_FLAGS 0x1f | |
| 62 | #define OPFLAGS_NONE 0x00 | |
| 63 | #define OPFLAGS_C DRCUML_FLAG_C | |
| 64 | #define OPFLAGS_SZ (DRCUML_FLAG_S | DRCUML_FLAG_Z) | |
| 65 | #define OPFLAGS_SZC (DRCUML_FLAG_S | DRCUML_FLAG_Z | DRCUML_FLAG_C) | |
| 66 | #define OPFLAGS_SZV (DRCUML_FLAG_S | DRCUML_FLAG_Z | DRCUML_FLAG_V) | |
| 67 | #define OPFLAGS_SZVC (DRCUML_FLAG_S | DRCUML_FLAG_Z | DRCUML_FLAG_V | DRCUML_FLAG_C) | |
| 68 | #define OPFLAGS_UZC (DRCUML_FLAG_U | DRCUML_FLAG_Z | DRCUML_FLAG_C) | |
| 69 | #define OPFLAGS_ALL 0x1f | |
| 70 | #define OPFLAGS_P1 0x81 | |
| 71 | #define OPFLAGS_P2 0x82 | |
| 72 | #define OPFLAGS_P3 0x83 | |
| 73 | #define OPFLAGS_P4 0x84 | |
| 71 | 74 | |
| 72 | /* bitmasks of valid parameter types and flags */ | |
| 73 | #define OV_PARAM_ALLOWED_NONE (1 << DRCUML_PTYPE_NONE) | |
| 74 | #define OV_PARAM_ALLOWED_IMM (1 << DRCUML_PTYPE_IMMEDIATE) | |
| 75 | #define OV_PARAM_ALLOWED_IREG (1 << DRCUML_PTYPE_INT_REGISTER) | |
| 76 | #define OV_PARAM_ALLOWED_FREG (1 << DRCUML_PTYPE_FLOAT_REGISTER) | |
| 77 | #define OV_PARAM_ALLOWED_MVAR (1 << DRCUML_PTYPE_MAPVAR) | |
| 78 | #define OV_PARAM_ALLOWED_MEM (1 << DRCUML_PTYPE_MEMORY) | |
| 79 | #define OV_PARAM_FLAG_ANYMEM 0x100 | |
| 80 | #define OV_PARAM_FLAG_FIXED4 0x200 | |
| 81 | #define OV_PARAM_FLAG_FIXED8 0x400 | |
| 75 | /* parameter input/output states */ | |
| 76 | #define PIO_IN 0x01 | |
| 77 | #define PIO_OUT 0x02 | |
| 78 | #define PIO_INOUT (PIO_IN | PIO_OUT) | |
| 82 | 79 | |
| 83 | /* opcode validation parameter valid bitmasks */ | |
| 84 | #define OV_PARAM_ALLOWED_ANYMEM (OV_PARAM_ALLOWED_MEM | OV_PARAM_FLAG_ANYMEM) | |
| 85 | #define OV_PARAM_ALLOWED_IMV (OV_PARAM_ALLOWED_IMM | OV_PARAM_ALLOWED_MVAR) | |
| 86 | #define OV_PARAM_ALLOWED_IMV4 (OV_PARAM_ALLOWED_IMM | OV_PARAM_ALLOWED_MVAR | OV_PARAM_FLAG_FIXED4) | |
| 87 | #define OV_PARAM_ALLOWED_IMV8 (OV_PARAM_ALLOWED_IMM | OV_PARAM_ALLOWED_MVAR | OV_PARAM_FLAG_FIXED8) | |
| 88 | #define OV_PARAM_ALLOWED_IRM (OV_PARAM_ALLOWED_IREG | OV_PARAM_ALLOWED_MEM) | |
| 89 | #define OV_PARAM_ALLOWED_IRM4 (OV_PARAM_ALLOWED_IREG | OV_PARAM_ALLOWED_MEM | OV_PARAM_FLAG_FIXED4) | |
| 90 | #define OV_PARAM_ALLOWED_IRM8 (OV_PARAM_ALLOWED_IREG | OV_PARAM_ALLOWED_MEM | OV_PARAM_FLAG_FIXED8) | |
| 91 | #define OV_PARAM_ALLOWED_FRM (OV_PARAM_ALLOWED_FREG | OV_PARAM_ALLOWED_MEM) | |
| 92 | #define OV_PARAM_ALLOWED_FRM4 (OV_PARAM_ALLOWED_FREG | OV_PARAM_ALLOWED_MEM | OV_PARAM_FLAG_FIXED4) | |
| 93 | #define OV_PARAM_ALLOWED_FRM8 (OV_PARAM_ALLOWED_FREG | OV_PARAM_ALLOWED_MEM | OV_PARAM_FLAG_FIXED8) | |
| 94 | #define OV_PARAM_ALLOWED_IANY (OV_PARAM_ALLOWED_IRM | OV_PARAM_ALLOWED_IMV) | |
| 95 | #define OV_PARAM_ALLOWED_IANY4 (OV_PARAM_ALLOWED_IRM | OV_PARAM_ALLOWED_IMV | OV_PARAM_FLAG_FIXED4) | |
| 96 | #define OV_PARAM_ALLOWED_IANY8 (OV_PARAM_ALLOWED_IRM | OV_PARAM_ALLOWED_IMV | OV_PARAM_FLAG_FIXED8) | |
| 97 | #define OV_PARAM_ALLOWED_FANY (OV_PARAM_ALLOWED_FRM) | |
| 98 | #define OV_PARAM_ALLOWED_FANY4 (OV_PARAM_ALLOWED_FRM | OV_PARAM_FLAG_FIXED4) | |
| 99 | #define OV_PARAM_ALLOWED_FANY8 (OV_PARAM_ALLOWED_FRM | OV_PARAM_FLAG_FIXED8) | |
| 80 | /* parameter sizes */ | |
| 81 | #define PSIZE_4 DRCUML_SIZE_DWORD | |
| 82 | #define PSIZE_8 DRCUML_SIZE_QWORD | |
| 83 | #define PSIZE_OP 0x80 | |
| 84 | #define PSIZE_P1 0x81 | |
| 85 | #define PSIZE_P2 0x82 | |
| 86 | #define PSIZE_P3 0x83 | |
| 87 | #define PSIZE_P4 0x84 | |
| 100 | 88 | |
| 89 | /* basic parameter types */ | |
| 90 | #define PTYPES_NONE 0 | |
| 91 | #define PTYPES_IMM (1 << DRCUML_PTYPE_IMMEDIATE) | |
| 92 | #define PTYPES_IREG (1 << DRCUML_PTYPE_INT_REGISTER) | |
| 93 | #define PTYPES_FREG (1 << DRCUML_PTYPE_FLOAT_REGISTER) | |
| 94 | #define PTYPES_MVAR (1 << DRCUML_PTYPE_MAPVAR) | |
| 95 | #define PTYPES_MEM (1 << DRCUML_PTYPE_MEMORY) | |
| 101 | 96 | |
| 97 | /* special parameter types */ | |
| 98 | #define PTYPES_PTR (PTYPES_MEM | 0x1000) | |
| 99 | #define PTYPES_STATE (PTYPES_MEM | 0x2000) | |
| 100 | #define PTYPES_STR (PTYPES_MEM | 0x3000) | |
| 101 | #define PTYPES_CFUNC (PTYPES_MEM | 0x4000) | |
| 102 | #define PTYPES_HAND (PTYPES_MEM | 0x5000) | |
| 103 | #define PTYPES_SIZE (PTYPES_IMM | 0x8000) | |
| 104 | #define PTYPES_SPACE (PTYPES_IMM | 0x9000) | |
| 105 | #define PTYPES_SPSZ (PTYPES_IMM | 0xa000) | |
| 106 | #define PTYPES_FMOD (PTYPES_IMM | 0xb000) | |
| 107 | #define PTYPES_LAB (PTYPES_IMM | 0xc000) | |
| 102 | 108 | |
| 109 | /* combinations of types */ | |
| 110 | #define PTYPES_IRM (PTYPES_IREG | PTYPES_MEM) | |
| 111 | #define PTYPES_FRM (PTYPES_FREG | PTYPES_MEM) | |
| 112 | #define PTYPES_IMV (PTYPES_IMM | PTYPES_MVAR) | |
| 113 | #define PTYPES_IANY (PTYPES_IRM | PTYPES_IMV) | |
| 114 | #define PTYPES_FANY (PTYPES_FRM) | |
| 115 | ||
| 116 | ||
| 117 | ||
| 103 | 118 | /*************************************************************************** |
| 104 | 119 | TYPE DEFINITIONS |
| 105 | 120 | ***************************************************************************/ |
| 106 | 121 | |
| 122 | /* structure describing a UML symbol */ | |
| 123 | typedef struct _drcuml_symbol drcuml_symbol; | |
| 124 | struct _drcuml_symbol | |
| 125 | { | |
| 126 | drcuml_symbol * next; /* link to the next symbol */ | |
| 127 | drccodeptr base; /* base of the symbol */ | |
| 128 | UINT32 length; /* length of the symbol */ | |
| 129 | char symname[1]; /* name of the symbol */ | |
| 130 | }; | |
| 131 | ||
| 132 | ||
| 107 | 133 | /* structure describing UML generation state */ |
| 108 | 134 | struct _drcuml_state |
| 109 | 135 | { |
| 110 | 136 | drccache * cache; /* pointer to the codegen cache */ |
| 111 | 137 | drcuml_block * blocklist; /* list of active blocks */ |
| 112 | ||
| 113 | 138 | const drcbe_interface * beintf; /* backend interface pointer */ |
| 114 | 139 | drcbe_state * bestate; /* pointer to the back-end state */ |
| 115 | ||
| 116 | 140 | drcuml_codehandle * handlelist; /* head of linked list of handles */ |
| 117 | ||
| 118 | 141 | FILE * umllog; /* handle to the UML logfile */ |
| 142 | drcuml_symbol * symlist; /* head of linked list of symbols */ | |
| 143 | drcuml_symbol ** symtailptr; /* pointer to tail of linked list of symbols */ | |
| 119 | 144 | }; |
| 120 | 145 | |
| 121 | 146 | |
| r2844 | r2845 | |
| 142 | 167 | }; |
| 143 | 168 | |
| 144 | 169 | |
| 145 | /* structure describing an opcode for validation */ | |
| 146 | typedef struct _drcuml_opcode_valid drcuml_opcode_valid; | |
| 147 | struct _drcuml_opcode_valid | |
| 148 | { | |
| 149 | drcuml_opcode opcode; /* the opcode itself */ | |
| 150 | UINT8 sizes; /* allowed sizes */ | |
| 151 | UINT8 condflags; /* allowed conditions/flags */ | |
| 152 | UINT16 ptypes[4]; /* allowed types for parameters */ | |
| 153 | }; | |
| 154 | ||
| 155 | ||
| 156 | 170 | /* structure describing back-end validation test */ |
| 157 | 171 | typedef struct _bevalidate_test bevalidate_test; |
| 158 | 172 | struct _bevalidate_test |
| 159 | 173 | { |
| 160 | drcuml_opcode opcode; | |
| 161 | UINT8 size; | |
| 162 | UINT8 destmask; | |
| 163 | UINT8 iflags; | |
| 164 | UINT8 flags; | |
| 165 | UINT64 param[4]; | |
| 174 | drcuml_opcode opcode; | |
| 175 | UINT8 size; | |
| 176 | UINT8 destmask; | |
| 177 | UINT8 iflags; | |
| 178 | UINT8 flags; | |
| 179 | UINT64 param[4]; | |
| 166 | 180 | }; |
| 167 | 181 | |
| 168 | 182 | |
| r2844 | r2845 | |
| 172 | 186 | ***************************************************************************/ |
| 173 | 187 | |
| 174 | 188 | /* macro to simplify the table */ |
| 175 | #define OPVALID_ENTRY_0(op,sizes,condflag) { DRCUML_OP_##op, sizes, OV_CONDFLAG_##condflag, { OV_PARAM_ALLOWED_NONE, OV_PARAM_ALLOWED_NONE, OV_PARAM_ALLOWED_NONE, OV_PARAM_ALLOWED_NONE } }, | |
| 176 | #define OPVALID_ENTRY_1(op,sizes,condflag,p0) { DRCUML_OP_##op, sizes, OV_CONDFLAG_##condflag, { OV_PARAM_ALLOWED_##p0, OV_PARAM_ALLOWED_NONE, OV_PARAM_ALLOWED_NONE, OV_PARAM_ALLOWED_NONE } }, | |
| 177 | #define OPVALID_ENTRY_2(op,sizes,condflag,p0,p1) { DRCUML_OP_##op, sizes, OV_CONDFLAG_##condflag, { OV_PARAM_ALLOWED_##p0, OV_PARAM_ALLOWED_##p1, OV_PARAM_ALLOWED_NONE, OV_PARAM_ALLOWED_NONE } }, | |
| 178 | #define OPVALID_ENTRY_3(op,sizes,condflag,p0,p1,p2) { DRCUML_OP_##op, sizes, OV_CONDFLAG_##condflag, { OV_PARAM_ALLOWED_##p0, OV_PARAM_ALLOWED_##p1, OV_PARAM_ALLOWED_##p2, OV_PARAM_ALLOWED_NONE } }, | |
| 179 | #define OPVALID_ENTRY_4(op,sizes,condflag,p0,p1,p2,p3) { DRCUML_OP_##op, sizes, OV_CONDFLAG_##condflag, { OV_PARAM_ALLOWED_##p0, OV_PARAM_ALLOWED_##p1, OV_PARAM_ALLOWED_##p2, OV_PARAM_ALLOWED_##p3 } }, | |
| 189 | #define PINFO(inout, size, types) { PIO_##inout, PSIZE_##size, PTYPES_##types } | |
| 190 | #define OPINFO0(op,str,sizes,cond,iflag,oflag,mflag) { DRCUML_OP_##op, str, sizes, cond, OPFLAGS_##iflag, OPFLAGS_##oflag, OPFLAGS_##mflag, { { 0 } } }, | |
| 191 | #define OPINFO1(op,str,sizes,cond,iflag,oflag,mflag,p0) { DRCUML_OP_##op, str, sizes, cond, OPFLAGS_##iflag, OPFLAGS_##oflag, OPFLAGS_##mflag, { p0 } }, | |
| 192 | #define OPINFO2(op,str,sizes,cond,iflag,oflag,mflag,p0,p1) { DRCUML_OP_##op, str, sizes, cond, OPFLAGS_##iflag, OPFLAGS_##oflag, OPFLAGS_##mflag, { p0, p1 } }, | |
| 193 | #define OPINFO3(op,str,sizes,cond,iflag,oflag,mflag,p0,p1,p2) { DRCUML_OP_##op, str, sizes, cond, OPFLAGS_##iflag, OPFLAGS_##oflag, OPFLAGS_##mflag, { p0, p1, p2 } }, | |
| 194 | #define OPINFO4(op,str,sizes,cond,iflag,oflag,mflag,p0,p1,p2,p3) { DRCUML_OP_##op, str, sizes, cond, OPFLAGS_##iflag, OPFLAGS_##oflag, OPFLAGS_##mflag, { p0, p1, p2, p3 } }, | |
| 180 | 195 | |
| 181 | 196 | /* opcode validation table */ |
| 182 | static const drcuml_opcode_ | |
| 197 | static const drcuml_opcode_ | |
| 183 | 198 | { |
| 184 | 199 | /* Compile-time opcodes */ |
| 185 | OPVALID_ENTRY_1(HANDLE, 4, NONE, MEM) | |
| 186 | OPVALID_ENTRY_2(HASH, 4, NONE, IMV, IMV) | |
| 187 | OPVALID_ENTRY_1(LABEL, 4, NONE, IMV) | |
| 188 | OPVALID_ENTRY_1(COMMENT, 4, NONE, ANYMEM) | |
| 189 | OPVALID_ENTRY_2(MAPVAR, 4, NONE, MVAR, IMV) | |
| 200 | OPINFO1(HANDLE, "handle", 4, FALSE, NONE, NONE, NONE, PINFO(IN, OP, HAND)) | |
| 201 | OPINFO2(HASH, "hash", 4, FALSE, NONE, NONE, NONE, PINFO(IN, OP, IMV), PINFO(IN, OP, IMV)) | |
| 202 | OPINFO1(LABEL, "label", 4, FALSE, NONE, NONE, NONE, PINFO(IN, OP, LAB)) | |
| 203 | OPINFO1(COMMENT, "comment", 4, FALSE, NONE, NONE, NONE, PINFO(IN, OP, STR)) | |
| 204 | OPINFO2(MAPVAR, "mapvar", 4, FALSE, NONE, NONE, NONE, PINFO(OUT, OP, MVAR), PINFO(IN, OP, IMV)) | |
| 190 | 205 | |
| 191 | 206 | /* Control Flow Operations */ |
| 192 | OPVALID_ENTRY_1(DEBUG, 4, NONE, IANY) | |
| 193 | OPVALID_ENTRY_1(EXIT, 4, COND, IANY) | |
| 194 | OPVALID_ENTRY_3(HASHJMP, 4, NONE, IANY, IANY, MEM) | |
| 195 | OPVALID_ENTRY_1(LABEL, 4, NONE, IMV) | |
| 196 | OPVALID_ENTRY_1(JMP, 4, COND, IMV) | |
| 197 | OPVALID_ENTRY_2(EXH, 4, COND, MEM, IANY) | |
| 198 | OPVALID_ENTRY_1(CALLH, 4, COND, MEM) | |
| 199 | OPVALID_ENTRY_0(RET, 4, COND) | |
| 200 | OPVALID_ENTRY_2(CALLC, 4, COND, ANYMEM,ANYMEM) | |
| 201 | OPVALID_ENTRY_2(RECOVER, 4, NONE, IRM, MVAR) | |
| 207 | OPINFO0(NOP, "nop", 4, FALSE, NONE, NONE, NONE) | |
| 208 | OPINFO1(DEBUG, "debug", 4, FALSE, NONE, NONE, ALL, PINFO(IN, OP, IANY)) | |
| 209 | OPINFO1(EXIT, "exit", 4, TRUE, NONE, NONE, ALL, PINFO(IN, OP, IANY)) | |
| 210 | OPINFO3(HASHJMP, "hashjmp", 4, FALSE, NONE, NONE, ALL, PINFO(IN, OP, IANY), PINFO(IN, OP, IANY), PINFO(IN, OP, HAND)) | |
| 211 | OPINFO1(JMP, "jmp", 4, TRUE, NONE, NONE, NONE, PINFO(IN, OP, LAB)) | |
| 212 | OPINFO2(EXH, "exh", 4, TRUE, NONE, NONE, ALL, PINFO(IN, OP, HAND), PINFO(IN, OP, IANY)) | |
| 213 | OPINFO1(CALLH, "callh", 4, TRUE, NONE, NONE, ALL, PINFO(IN, OP, HAND)) | |
| 214 | OPINFO0(RET, "ret", 4, TRUE, NONE, NONE, ALL) | |
| 215 | OPINFO2(CALLC, "callc", 4, TRUE, NONE, NONE, ALL, PINFO(IN, OP, CFUNC), PINFO(IN, OP, PTR)) | |
| 216 | OPINFO2(RECOVER, "recover", 4, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, MVAR)) | |
| 202 | 217 | |
| 203 | 218 | /* Internal Register Operations */ |
| 204 | OPVALID_ENTRY_1(SETFMOD, 4, NONE, IANY) | |
| 205 | OPVALID_ENTRY_1(GETFMOD, 4, NONE, IRM) | |
| 206 | OPVALID_ENTRY_1(GETEXP, 4, NONE, IRM) | |
| 207 | OPVALID_ENTRY_1(GETFLGS, 4, NONE, IRM) | |
| 208 | OPVALID_ENTRY_1(SAVE, 4, NONE, ANYMEM) | |
| 209 | OPVALID_ENTRY_1(RESTORE, 4, NONE, ANYMEM) | |
| 219 | OPINFO1(SETFMOD, "setfmod", 4, FALSE, NONE, NONE, ALL, PINFO(IN, OP, IANY)) | |
| 220 | OPINFO1(GETFMOD, "getfmod", 4, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, IRM)) | |
| 221 | OPINFO1(GETEXP, "getexp", 4, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, IRM)) | |
| 222 | OPINFO2(GETFLGS, "getflgs", 4, FALSE, P2, NONE, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IMV)) | |
| 223 | OPINFO1(SAVE, "save", 4, FALSE, ALL, NONE, ALL, PINFO(OUT, OP, STATE)) | |
| 224 | OPINFO1(RESTORE, "restore", 4, FALSE, NONE, ALL, ALL, PINFO(IN, OP, STATE)) | |
| 210 | 225 | |
| 211 | 226 | /* Integer Operations */ |
| 212 | OPVALID_ENTRY_4(LOAD, 4|8, NONE, IRM, ANYMEM,IANY4, IMV) | |
| 213 | OPVALID_ENTRY_4(LOADS, 4|8, NONE, IRM, ANYMEM,IANY4, IMV) | |
| 214 | OPVALID_ENTRY_4(STORE, 4|8, NONE, ANYMEM,IANY4, IANY, IMV) | |
| 215 | OPVALID_ENTRY_3(READ, 4|8, NONE, IRM, IANY4, IMV) | |
| 216 | OPVALID_ENTRY_4(READM, 4|8, NONE, IRM, IANY4, IANY, IMV) | |
| 217 | OPVALID_ENTRY_3(WRITE, 4|8, NONE, IANY4, IANY, IMV) | |
| 218 | OPVALID_ENTRY_4(WRITEM, 4|8, NONE, IANY4, IANY, IANY, IMV) | |
| 219 | OPVALID_ENTRY_2(CARRY, 4|8, NONE, IANY, IANY) | |
| 220 | OPVALID_ENTRY_2(MOV, 4|8, COND, IRM, IANY) | |
| 221 | OPVALID_ENTRY_1(SET, 4|8, COND, IRM) | |
| 222 | OPVALID_ENTRY_3(SEXT, 4|8, NONE, IRM, IANY4, IMV) | |
| 223 | OPVALID_ENTRY_4(ROLAND, 4|8, NONE, IRM, IANY, IANY, IANY) | |
| 224 | OPVALID_ENTRY_4(ROLINS, 4|8, NONE, IRM, IANY, IANY, IANY) | |
| 225 | OPVALID_ENTRY_3(ADD, 4|8, SZVC, IRM, IANY, IANY) | |
| 226 | OPVALID_ENTRY_3(ADDC, 4|8, SZVC, IRM, IANY, IANY) | |
| 227 | OPVALID_ENTRY_3(SUB, 4|8, SZVC, IRM, IANY, IANY) | |
| 228 | OPVALID_ENTRY_3(SUBB, 4|8, SZVC, IRM, IANY, IANY) | |
| 229 | OPVALID_ENTRY_2(CMP, 4|8, SZVC, IANY, IANY) | |
| 230 | OPVALID_ENTRY_4(MULU, 4|8, SZ, IRM, IRM, IANY, IANY) | |
| 231 | OPVALID_ENTRY_4(MULS, 4|8, SZ, IRM, IRM, IANY, IANY) | |
| 232 | OPVALID_ENTRY_4(DIVU, 4|8, SZ, IRM, IRM, IANY, IANY) | |
| 233 | OPVALID_ENTRY_4(DIVS, 4|8, SZ, IRM, IRM, IANY, IANY) | |
| 234 | OPVALID_ENTRY_3(AND, 4|8, SZ, IRM, IANY, IANY) | |
| 235 | OPVALID_ENTRY_2(TEST, 4|8, SZ, IANY, IANY) | |
| 236 | OPVALID_ENTRY_3(OR, 4|8, SZ, IRM, IANY, IANY) | |
| 237 | OPVALID_ENTRY_3(XOR, 4|8, SZ, IRM, IANY, IANY) | |
| 238 | OPVALID_ENTRY_2(LZCNT, 4|8, NONE, IRM, IANY) | |
| 239 | OPVALID_ENTRY_2(BSWAP, 4|8, NONE, IRM, IANY) | |
| 240 | OPVALID_ENTRY_3(SHL, 4|8, SZC, IRM, IANY, IANY) | |
| 241 | OPVALID_ENTRY_3(SHR, 4|8, SZC, IRM, IANY, IANY) | |
| 242 | OPVALID_ENTRY_3(SAR, 4|8, SZC, IRM, IANY, IANY) | |
| 243 | OPVALID_ENTRY_3(ROL, 4|8, SZC, IRM, IANY, IANY) | |
| 244 | OPVALID_ENTRY_3(ROLC, 4|8, SZC, IRM, IANY, IANY) | |
| 245 | OPVALID_ENTRY_3(ROR, 4|8, SZC, IRM, IANY, IANY) | |
| 246 | OPVALID_ENTRY_3(RORC, 4|8, SZC, IRM, IANY, IANY) | |
| 227 | OPINFO4(LOAD, "!load", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, PTR), PINFO(IN, 4, IANY), PINFO(IN, OP, SIZE)) | |
| 228 | OPINFO4(LOADS, "!loads", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, PTR), PINFO(IN, 4, IANY), PINFO(IN, OP, SIZE)) | |
| 229 | OPINFO4(STORE, "!store", 4|8, FALSE, NONE, NONE, ALL, PINFO(IN, OP, PTR), PINFO(IN, 4, IANY), PINFO(IN, OP, IANY), PINFO(IN, OP, SIZE)) | |
| 230 | OPINFO3(READ, "!read", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, IRM), PINFO(IN, 4, IANY), PINFO(IN, OP, SPSZ)) | |
| 231 | OPINFO4(READM, "!readm", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, IRM), PINFO(IN, 4, IANY), PINFO(IN, OP, IANY), PINFO(IN, OP, SPSZ)) | |
| 232 | OPINFO3(WRITE, "!write", 4|8, FALSE, NONE, NONE, ALL, PINFO(IN, 4, IANY), PINFO(IN, OP, IANY), PINFO(IN, OP, SPSZ)) | |
| 233 | OPINFO4(WRITEM, "!writem", 4|8, FALSE, NONE, NONE, ALL, PINFO(IN, 4, IANY), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY), PINFO(IN, OP, SPSZ)) | |
| 234 | OPINFO2(CARRY, "!carry", 4|8, FALSE, NONE, C, ALL, PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 235 | OPINFO2(MOV, "!mov", 4|8, TRUE, NONE, NONE, NONE, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY)) | |
| 236 | OPINFO1(SET, "!set", 4|8, TRUE, NONE, NONE, ALL, PINFO(OUT, OP, IRM)) | |
| 237 | OPINFO3(SEXT, "!sext", 4|8, FALSE, NONE, SZ, ALL, PINFO(OUT, OP, IRM), PINFO(IN, P3, IANY), PINFO(IN, OP, SIZE)) | |
| 238 | OPINFO4(ROLAND, "!roland", 4|8, FALSE, NONE, SZ, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 239 | OPINFO4(ROLINS, "!rolins", 4|8, FALSE, NONE, SZ, ALL, PINFO(INOUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 240 | OPINFO3(ADD, "!add", 4|8, FALSE, NONE, SZVC, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 241 | OPINFO3(ADDC, "!addc", 4|8, FALSE, C, SZVC, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 242 | OPINFO3(SUB, "!sub", 4|8, FALSE, NONE, SZVC, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 243 | OPINFO3(SUBB, "!subb", 4|8, FALSE, C, SZVC, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 244 | OPINFO2(CMP, "!cmp", 4|8, FALSE, NONE, SZVC, ALL, PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 245 | OPINFO4(MULU, "!mulu", 4|8, FALSE, NONE, SZV, ALL, PINFO(OUT, OP, IRM), PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 246 | OPINFO4(MULS, "!muls", 4|8, FALSE, NONE, SZV, ALL, PINFO(OUT, OP, IRM), PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 247 | OPINFO4(DIVU, "!divu", 4|8, FALSE, NONE, SZV, ALL, PINFO(OUT, OP, IRM), PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 248 | OPINFO4(DIVS, "!divs", 4|8, FALSE, NONE, SZV, ALL, PINFO(OUT, OP, IRM), PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 249 | OPINFO3(AND, "!and", 4|8, FALSE, NONE, SZ, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 250 | OPINFO2(TEST, "!test", 4|8, FALSE, NONE, SZ, ALL, PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 251 | OPINFO3(OR, "!or", 4|8, FALSE, NONE, SZ, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 252 | OPINFO3(XOR, "!xor", 4|8, FALSE, NONE, SZ, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 253 | OPINFO2(LZCNT, "!lzcnt", 4|8, FALSE, NONE, SZ, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY)) | |
| 254 | OPINFO2(BSWAP, "!bswap", 4|8, FALSE, NONE, SZ, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY)) | |
| 255 | OPINFO3(SHL, "!shl", 4|8, FALSE, NONE, SZC, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 256 | OPINFO3(SHR, "!shr", 4|8, FALSE, NONE, SZC, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 257 | OPINFO3(SAR, "!sar", 4|8, FALSE, NONE, SZC, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 258 | OPINFO3(ROL, "!rol", 4|8, FALSE, NONE, SZC, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 259 | OPINFO3(ROLC, "!rolc", 4|8, FALSE, C, SZC, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 260 | OPINFO3(ROR, "!ror", 4|8, FALSE, NONE, SZC, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 261 | OPINFO3(RORC, "!rorc", 4|8, FALSE, C, SZC, ALL, PINFO(OUT, OP, IRM), PINFO(IN, OP, IANY), PINFO(IN, OP, IANY)) | |
| 247 | 262 | |
| 248 | 263 | /* Floating Point Operations */ |
| 249 | OPVALID_ENTRY_3(FLOAD, 4|8, NONE, FRM, ANYMEM,IANY4) | |
| 250 | OPVALID_ENTRY_3(FSTORE, 4|8, NONE, ANYMEM,IANY4, FANY) | |
| 251 | OPVALID_ENTRY_3(FREAD, 4|8, NONE, FRM, IANY4, IMV4) | |
| 252 | OPVALID_ENTRY_3(FWRITE, 4|8, NONE, IANY4, FANY, IMV4) | |
| 253 | OPVALID_ENTRY_2(FMOV, 4|8, COND, FRM, FANY) | |
| 254 | OPVALID_ENTRY_4(FTOINT, 4|8, NONE, IRM, FANY, IMM, IMM) | |
| 255 | OPVALID_ENTRY_3(FFRINT, 4|8, NONE, FRM, IANY, IMM) | |
| 256 | OPVALID_ENTRY_3(FFRFLT, 4|8, NONE, FRM, FANY, IMM) | |
| 257 | OPVALID_ENTRY_2(FRNDS, 8, NONE, FRM, FANY) | |
| 258 | OPVALID_ENTRY_3(FADD, 4|8, NONE, FRM, FANY, FANY) | |
| 259 | OPVALID_ENTRY_3(FSUB, 4|8, NONE, FRM, FANY, FANY) | |
| 260 | OPVALID_ENTRY_2(FCMP, 4|8, UZC, FANY, FANY) | |
| 261 | OPVALID_ENTRY_3(FMUL, 4|8, NONE, FRM, FANY, FANY) | |
| 262 | OPVALID_ENTRY_3(FDIV, 4|8, NONE, FRM, FANY, FANY) | |
| 263 | OPVALID_ENTRY_2(FNEG, 4|8, NONE, FRM, FANY) | |
| 264 | OPVALID_ENTRY_2(FABS, 4|8, NONE, FRM, FANY) | |
| 265 | OPVALID_ENTRY_2(FSQRT, 4|8, NONE, FRM, FANY) | |
| 266 | OPVALID_ENTRY_2(FRECIP, 4|8, NONE, FRM, FANY) | |
| 267 | OPVALID_ENTRY_2(FRSQRT, 4|8, NONE, FRM, FANY) | |
| 264 | OPINFO3(FLOAD, "f#load", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, PTR), PINFO(IN, 4, IANY)) | |
| 265 | OPINFO3(FSTORE, "f#store", 4|8, FALSE, NONE, NONE, ALL, PINFO(IN, OP, PTR), PINFO(IN, 4, IANY), PINFO(IN, OP, FRM)) | |
| 266 | OPINFO3(FREAD, "f#read", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, 4, IANY), PINFO(IN, OP, SPACE)) | |
| 267 | OPINFO3(FWRITE, "f#write", 4|8, FALSE, NONE, NONE, ALL, PINFO(IN, 4, IANY), PINFO(IN, OP, FANY), PINFO(IN, OP, SPACE)) | |
| 268 | OPINFO2(FMOV, "f#mov", 4|8, TRUE, NONE, NONE, NONE, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY)) | |
| 269 | OPINFO4(FTOINT, "f#toint", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, P3, IRM), PINFO(IN, OP, FANY), PINFO(IN, OP, SIZE), PINFO(IN, OP, FMOD)) | |
| 270 | OPINFO3(FFRINT, "f#frint", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, P3, IANY), PINFO(IN, OP, SIZE)) | |
| 271 | OPINFO3(FFRFLT, "f#frflt", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, P3, FANY), PINFO(IN, OP, SIZE)) | |
| 272 | OPINFO2(FRNDS, "f#rnds", 8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, P3, FANY)) | |
| 273 | OPINFO3(FADD, "f#add", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY), PINFO(IN, OP, FANY)) | |
| 274 | OPINFO3(FSUB, "f#sub", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY), PINFO(IN, OP, FANY)) | |
| 275 | OPINFO2(FCMP, "f#cmp", 4|8, FALSE, NONE, UZC, ALL, PINFO(IN, OP, FANY), PINFO(IN, OP, FANY)) | |
| 276 | OPINFO3(FMUL, "f#mul", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY), PINFO(IN, OP, FANY)) | |
| 277 | OPINFO3(FDIV, "f#div", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY), PINFO(IN, OP, FANY)) | |
| 278 | OPINFO2(FNEG, "f#neg", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY)) | |
| 279 | OPINFO2(FABS, "f#abs", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY)) | |
| 280 | OPINFO2(FSQRT, "f#sqrt", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY)) | |
| 281 | OPINFO2(FRECIP, "f#recip", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY)) | |
| 282 | OPINFO2(FRSQRT, "f#rsqrt", 4|8, FALSE, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY)) | |
| 268 | 283 | }; |
| 269 | 284 | |
| 270 | 285 | |
| r2844 | r2845 | |
| 284 | 299 | #endif |
| 285 | 300 | |
| 286 | 301 | /* table that is built up on first alloc which looks up via opcode */ |
| 287 | static drcuml_opcode_ | |
| 302 | static const drcuml_opcode_ | |
| 288 | 303 | |
| 289 | 304 | |
| 290 | 305 | |
| r2844 | r2845 | |
| 292 | 307 | FUNCTION PROTOTYPES |
| 293 | 308 | ***************************************************************************/ |
| 294 | 309 | |
| 310 | static void optimize_block(drcuml_block *block); | |
| 311 | static void simplify_instruction_with_no_flags(drcuml_block *block, drcuml_instruction *inst); | |
| 312 | ||
| 313 | static void disassemble_block(drcuml_block *block); | |
| 314 | static const char *get_comment_text(const drcuml_instruction *inst); | |
| 315 | ||
| 295 | 316 | static void validate_instruction(drcuml_block *block, const drcuml_instruction *inst); |
| 317 | ||
| 318 | #if 0 | |
| 296 | 319 | static void validate_backend(drcuml_state *drcuml); |
| 297 | 320 | static void bevalidate_iterate_over_params(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, drcuml_parameter *paramlist, int pnum); |
| 298 | 321 | static void bevalidate_iterate_over_flags(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, drcuml_parameter *paramlist); |
| r2844 | r2845 | |
| 300 | 323 | static void bevalidate_initialize_random_state(drcuml_block *block, drcuml_machine_state *state); |
| 301 | 324 | static int bevalidate_populate_state(drcuml_block *block, drcuml_machine_state *state, const bevalidate_test *test, const drcuml_parameter *paramlist, drcuml_parameter *params, UINT64 *parammem); |
| 302 | 325 | static int bevalidate_verify_state(drcuml_state *drcuml, const drcuml_machine_state *istate, drcuml_machine_state *state, const bevalidate_test *test, const drcuml_parameter *params, const drcuml_instruction *testinst, drccodeptr codestart, drccodeptr codeend, UINT8 flagmask); |
| 326 | #endif | |
| 303 | 327 | |
| 304 | 328 | |
| 305 | 329 | |
| r2844 | r2845 | |
| 308 | 332 | ***************************************************************************/ |
| 309 | 333 | |
| 310 | 334 | /*------------------------------------------------- |
| 311 | size_for_param - given a set of parameter | |
| 312 | flags and the instruction size, return the | |
| 313 | size of the parameter | |
| 335 | rol32 - perform a 32-bit left rotate | |
| 314 | 336 | -------------------------------------------------*/ |
| 315 | 337 | |
| 316 | INLINE | |
| 338 | INLINE UINT32 | |
| 317 | 339 | { |
| 318 | if (flags & OV_PARAM_FLAG_FIXED4) | |
| 319 | return 4; | |
| 320 | else if (flags & OV_PARAM_FLAG_FIXED8) | |
| 321 | return 8; | |
| 322 | else | |
| 323 | return instsize; | |
| 340 | count &= 31; | |
| 341 | return (source << count) | (source >> (32 - count)); | |
| 324 | 342 | } |
| 325 | 343 | |
| 326 | 344 | |
| 327 | 345 | /*------------------------------------------------- |
| 328 | mask_for_param - given a set of parameter | |
| 329 | flags and the instruction size, return a | |
| 330 | mask of valid bits for that parameter | |
| 346 | rol64 - perform a 64-bit left rotate | |
| 331 | 347 | -------------------------------------------------*/ |
| 332 | 348 | |
| 333 | INLINE UINT64 | |
| 349 | INLINE UINT64 | |
| 334 | 350 | { |
| 335 | switch (size_for_param(instsize, flags)) | |
| 351 | count &= 63; | |
| 352 | return (source << count) | (source >> (64 - count)); | |
| 353 | } | |
| 354 | ||
| 355 | ||
| 356 | /*------------------------------------------------- | |
| 357 | effective_inflags - return the effective | |
| 358 | input flags based on any conditions encoded | |
| 359 | in an instruction | |
| 360 | -------------------------------------------------*/ | |
| 361 | ||
| 362 | INLINE UINT8 effective_inflags(const drcuml_instruction *inst, const drcuml_opcode_info *opinfo) | |
| 363 | { | |
| 364 | static const UINT8 flags_for_condition[] = | |
| 336 | 365 | { |
| 337 | case 4: return U64(0x00000000ffffffff); | |
| 338 | case 8: return U64(0xffffffffffffffff); | |
| 366 | /* DRCUML_COND_Z */ DRCUML_FLAG_Z, | |
| 367 | /* DRCUML_COND_NZ */ DRCUML_FLAG_Z, | |
| 368 | /* DRCUML_COND_S */ DRCUML_FLAG_S, | |
| 369 | /* DRCUML_COND_NS */ DRCUML_FLAG_S, | |
| 370 | /* DRCUML_COND_C */ DRCUML_FLAG_C, | |
| 371 | /* DRCUML_COND_NC */ DRCUML_FLAG_C, | |
| 372 | /* DRCUML_COND_V */ DRCUML_FLAG_V, | |
| 373 | /* DRCUML_COND_NV */ DRCUML_FLAG_V, | |
| 374 | /* DRCUML_COND_U */ DRCUML_FLAG_U, | |
| 375 | /* DRCUML_COND_NU */ DRCUML_FLAG_U, | |
| 376 | /* DRCUML_COND_A */ DRCUML_FLAG_C | DRCUML_FLAG_Z, | |
| 377 | /* DRCUML_COND_BE */ DRCUML_FLAG_C | DRCUML_FLAG_Z, | |
| 378 | /* DRCUML_COND_G */ DRCUML_FLAG_S | DRCUML_FLAG_V | DRCUML_FLAG_Z, | |
| 379 | /* DRCUML_COND_LE */ DRCUML_FLAG_S | DRCUML_FLAG_V | DRCUML_FLAG_Z, | |
| 380 | /* DRCUML_COND_L */ DRCUML_FLAG_S | DRCUML_FLAG_V, | |
| 381 | /* DRCUML_COND_GE */ DRCUML_FLAG_S | DRCUML_FLAG_V | |
| 382 | }; | |
| 383 | UINT8 flags = opinfo->inflags; | |
| 384 | if (flags & 0x80) | |
| 385 | flags = inst->param[flags - OPFLAGS_P1].value & OPFLAGS_ALL; | |
| 386 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 387 | flags |= flags_for_condition[inst->condition & 0x0f]; | |
| 388 | return flags; | |
| 389 | } | |
| 390 | ||
| 391 | ||
| 392 | /*------------------------------------------------- | |
| 393 | effective_outflags - return the effective | |
| 394 | output flags based on any conditions encoded | |
| 395 | in an instruction | |
| 396 | -------------------------------------------------*/ | |
| 397 | ||
| 398 | INLINE UINT8 effective_outflags(const drcuml_instruction *inst, const drcuml_opcode_info *opinfo) | |
| 399 | { | |
| 400 | UINT8 flags = opinfo->outflags; | |
| 401 | if (flags & 0x80) | |
| 402 | flags = inst->param[flags - OPFLAGS_P1].value & OPFLAGS_ALL; | |
| 403 | return flags; | |
| 404 | } | |
| 405 | ||
| 406 | ||
| 407 | /*------------------------------------------------- | |
| 408 | effective_psize - return the effective | |
| 409 | parameter size based on the instruction and | |
| 410 | parameters passed | |
| 411 | -------------------------------------------------*/ | |
| 412 | ||
| 413 | INLINE UINT8 effective_psize(const drcuml_instruction *inst, const drcuml_opcode_info *opinfo, int pnum) | |
| 414 | { | |
| 415 | switch (opinfo->param[pnum].size) | |
| 416 | { | |
| 417 | case PSIZE_4: return 4; | |
| 418 | case PSIZE_8: return 8; | |
| 419 | case PSIZE_OP: return inst->size; | |
| 420 | case PSIZE_P1: assert(inst->param[0].type == DRCUML_PTYPE_IMMEDIATE); return 1 << (inst->param[0].value & 3); | |
| 421 | case PSIZE_P2: assert(inst->param[1].type == DRCUML_PTYPE_IMMEDIATE); return 1 << (inst->param[1].value & 3); | |
| 422 | case PSIZE_P3: assert(inst->param[2].type == DRCUML_PTYPE_IMMEDIATE); return 1 << (inst->param[2].value & 3); | |
| 423 | case PSIZE_P4: assert(inst->param[3].type == DRCUML_PTYPE_IMMEDIATE); return 1 << (inst->param[3].value & 3); | |
| 339 | 424 | } |
| 340 | return | |
| 425 | return inst->size; | |
| 341 | 426 | } |
| 342 | 427 | |
| 343 | 428 | |
| 429 | /*------------------------------------------------- | |
| 430 | param_is_immediate - return TRUE if the | |
| 431 | given instruction parameter is an immediate | |
| 432 | -------------------------------------------------*/ | |
| 344 | 433 | |
| 434 | INLINE int param_is_immediate(const drcuml_instruction *inst, int pnum) | |
| 435 | { | |
| 436 | return (inst->param[pnum].type == DRCUML_PTYPE_IMMEDIATE); | |
| 437 | } | |
| 438 | ||
| 439 | ||
| 440 | /*------------------------------------------------- | |
| 441 | param_is_immediate_value - return TRUE if the | |
| 442 | given instruction parameter is an immediate | |
| 443 | with the provided value | |
| 444 | -------------------------------------------------*/ | |
| 445 | ||
| 446 | INLINE int param_is_immediate_value(const drcuml_instruction *inst, int pnum, UINT64 value) | |
| 447 | { | |
| 448 | return (inst->param[pnum].type == DRCUML_PTYPE_IMMEDIATE && inst->param[pnum].value == value); | |
| 449 | } | |
| 450 | ||
| 451 | ||
| 452 | /*------------------------------------------------- | |
| 453 | param_equal - return TRUE if the two provided | |
| 454 | parameters are equal | |
| 455 | -------------------------------------------------*/ | |
| 456 | ||
| 457 | INLINE int param_equal(const drcuml_instruction *inst, int pnum1, int pnum2) | |
| 458 | { | |
| 459 | return (inst->param[pnum1].type == inst->param[pnum2].type && inst->param[pnum1].value == inst->param[pnum2].value); | |
| 460 | } | |
| 461 | ||
| 462 | ||
| 463 | /*------------------------------------------------- | |
| 464 | convert_to_nop - convert an instruction | |
| 465 | inline to a NOP | |
| 466 | -------------------------------------------------*/ | |
| 467 | ||
| 468 | INLINE void convert_to_nop(drcuml_instruction *inst) | |
| 469 | { | |
| 470 | inst->opcode = DRCUML_OP_NOP; | |
| 471 | inst->size = 4; | |
| 472 | inst->condition = DRCUML_COND_ALWAYS; | |
| 473 | inst->numparams = 0; | |
| 474 | } | |
| 475 | ||
| 476 | ||
| 477 | /*------------------------------------------------- | |
| 478 | convert_to_mov_immediate - convert an | |
| 479 | instruction inline to a MOV immediate | |
| 480 | -------------------------------------------------*/ | |
| 481 | ||
| 482 | INLINE void convert_to_mov_immediate(drcuml_instruction *inst, UINT64 immediate) | |
| 483 | { | |
| 484 | inst->opcode = DRCUML_OP_MOV; | |
| 485 | inst->condition = DRCUML_COND_ALWAYS; | |
| 486 | inst->numparams = 2; | |
| 487 | inst->param[1].type = DRCUML_PTYPE_IMMEDIATE; | |
| 488 | inst->param[1].value = immediate; | |
| 489 | } | |
| 490 | ||
| 491 | ||
| 492 | /*------------------------------------------------- | |
| 493 | convert_to_mov_param - convert an | |
| 494 | instruction inline to a MOV with a source | |
| 495 | parameter given by the existing parameter | |
| 496 | index pnum | |
| 497 | -------------------------------------------------*/ | |
| 498 | ||
| 499 | INLINE void convert_to_mov_param(drcuml_instruction *inst, int pnum) | |
| 500 | { | |
| 501 | inst->opcode = DRCUML_OP_MOV; | |
| 502 | inst->condition = DRCUML_COND_ALWAYS; | |
| 503 | inst->numparams = 2; | |
| 504 | if (pnum != 1) | |
| 505 | inst->param[1] = inst->param[pnum]; | |
| 506 | } | |
| 507 | ||
| 508 | ||
| 509 | ||
| 345 | 510 | /*************************************************************************** |
| 346 | 511 | INITIALIZATION/TEARDOWN |
| 347 | 512 | ***************************************************************************/ |
| r2844 | r2845 | |
| 365 | 530 | /* initialize the state */ |
| 366 | 531 | drcuml->cache = cache; |
| 367 | 532 | drcuml->beintf = (flags & DRCUML_OPTION_USE_C) ? &drcbe_c_be_interface : &NATIVE_DRC; |
| 533 | drcuml->symtailptr = &drcuml->symlist; | |
| 368 | 534 | |
| 369 | 535 | /* if we're to log, create the logfile */ |
| 370 | 536 | if (flags & DRCUML_OPTION_LOG_UML) |
| r2844 | r2845 | |
| 379 | 545 | } |
| 380 | 546 | |
| 381 | 547 | /* update the valid opcode table */ |
| 382 | for (opnum = 0; opnum < ARRAY_LENGTH(opcode_valid_list); opnum++) | |
| 383 | opcode_valid_table[opcode_valid_list[opnum].opcode] = opcode_valid_list[opnum]; | |
| 548 | for (opnum = 0; opnum < ARRAY_LENGTH(opcode_info_source); opnum++) | |
| 549 | opcode_info_table[opcode_info_source[opnum].opcode] = &opcode_info_source[opnum]; | |
| 384 | 550 | |
| 385 | 551 | return drcuml; |
| 386 | 552 | } |
| r2844 | r2845 | |
| 422 | 588 | (*drcuml->beintf->be_reset)(drcuml->bestate); |
| 423 | 589 | |
| 424 | 590 | /* do a one-time validation if requested */ |
| 425 | if (VALIDATE_BACKEND) | |
| 426 | { | |
| 427 | static int validated = FALSE; | |
| 428 | if (!validated) | |
| 429 | { | |
| 430 | validated = TRUE; | |
| 431 | validate_backend(drcuml); | |
| 432 | } | |
| 433 | } | |
| 591 | /* if (VALIDATE_BACKEND) | |
| 592 | { | |
| 593 | static int validated = FALSE; | |
| 594 | if (!validated) | |
| 595 | { | |
| 596 | validated = TRUE; | |
| 597 | validate_backend(drcuml); | |
| 598 | } | |
| 599 | }*/ | |
| 434 | 600 | } |
| 435 | 601 | |
| 436 | 602 | |
| r2844 | r2845 | |
| 459 | 625 | free(block); |
| 460 | 626 | } |
| 461 | 627 | |
| 628 | /* free all the symbols */ | |
| 629 | while (drcuml->symlist != NULL) | |
| 630 | { | |
| 631 | drcuml_symbol *sym = drcuml->symlist; | |
| 632 | drcuml->symlist = sym->next; | |
| 633 | free(sym); | |
| 634 | } | |
| 635 | ||
| 462 | 636 | /* close any files */ |
| 463 | 637 | if (drcuml->umllog != NULL) |
| 464 | 638 | fclose(drcuml->umllog); |
| r2844 | r2845 | |
| 519 | 693 | 0 parameters to the block |
| 520 | 694 | -------------------------------------------------*/ |
| 521 | 695 | |
| 522 | void drcuml_block_append_0(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 cond | |
| 696 | void drcuml_block_append_0(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condition) | |
| 523 | 697 | { |
| 524 | 698 | drcuml_instruction *inst = &block->inst[block->nextinst++]; |
| 525 | 699 | |
| r2844 | r2845 | |
| 532 | 706 | /* fill in the instruction */ |
| 533 | 707 | inst->opcode = (UINT8)op; |
| 534 | 708 | inst->size = size; |
| 535 | inst->condflags = condflags; | |
| 709 | inst->condition = condition; | |
| 710 | inst->flags = 0; | |
| 536 | 711 | inst->numparams = 0; |
| 537 | 712 | |
| 538 | 713 | /* validation */ |
| r2844 | r2845 | |
| 545 | 720 | 1 parameter to the block |
| 546 | 721 | -------------------------------------------------*/ |
| 547 | 722 | |
| 548 | void drcuml_block_append_1(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 cond | |
| 723 | void drcuml_block_append_1(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condition, drcuml_ptype p0type, drcuml_pvalue p0value) | |
| 549 | 724 | { |
| 550 | 725 | drcuml_instruction *inst = &block->inst[block->nextinst++]; |
| 551 | 726 | |
| r2844 | r2845 | |
| 558 | 733 | /* fill in the instruction */ |
| 559 | 734 | inst->opcode = (UINT8)op; |
| 560 | 735 | inst->size = size; |
| 561 | inst->condflags = condflags; | |
| 736 | inst->condition = condition; | |
| 737 | inst->flags = 0; | |
| 562 | 738 | inst->numparams = 1; |
| 563 | 739 | inst->param[0].type = p0type; |
| 564 | 740 | inst->param[0].value = p0value; |
| r2844 | r2845 | |
| 573 | 749 | 2 parameters to the block |
| 574 | 750 | -------------------------------------------------*/ |
| 575 | 751 | |
| 576 | void drcuml_block_append_2(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 cond | |
| 752 | void drcuml_block_append_2(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condition, drcuml_ptype p0type, drcuml_pvalue p0value, drcuml_ptype p1type, drcuml_pvalue p1value) | |
| 577 | 753 | { |
| 578 | 754 | drcuml_instruction *inst = &block->inst[block->nextinst++]; |
| 579 | 755 | |
| r2844 | r2845 | |
| 586 | 762 | /* fill in the instruction */ |
| 587 | 763 | inst->opcode = (UINT8)op; |
| 588 | 764 | inst->size = size; |
| 589 | inst->condflags = condflags; | |
| 765 | inst->condition = condition; | |
| 766 | inst->flags = 0; | |
| 590 | 767 | inst->numparams = 2; |
| 591 | 768 | inst->param[0].type = p0type; |
| 592 | 769 | inst->param[0].value = p0value; |
| r2844 | r2845 | |
| 603 | 780 | 3 parameters to the block |
| 604 | 781 | -------------------------------------------------*/ |
| 605 | 782 | |
| 606 | void drcuml_block_append_3(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 cond | |
| 783 | void drcuml_block_append_3(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condition, drcuml_ptype p0type, drcuml_pvalue p0value, drcuml_ptype p1type, drcuml_pvalue p1value, drcuml_ptype p2type, drcuml_pvalue p2value) | |
| 607 | 784 | { |
| 608 | 785 | drcuml_instruction *inst = &block->inst[block->nextinst++]; |
| 609 | 786 | |
| r2844 | r2845 | |
| 616 | 793 | /* fill in the instruction */ |
| 617 | 794 | inst->opcode = (UINT8)op; |
| 618 | 795 | inst->size = size; |
| 619 | inst->condflags = condflags; | |
| 796 | inst->condition = condition; | |
| 797 | inst->flags = 0; | |
| 620 | 798 | inst->numparams = 3; |
| 621 | 799 | inst->param[0].type = p0type; |
| 622 | 800 | inst->param[0].value = p0value; |
| r2844 | r2845 | |
| 635 | 813 | 4 parameters to the block |
| 636 | 814 | -------------------------------------------------*/ |
| 637 | 815 | |
| 638 | void drcuml_block_append_4(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 cond | |
| 816 | void drcuml_block_append_4(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condition, drcuml_ptype p0type, drcuml_pvalue p0value, drcuml_ptype p1type, drcuml_pvalue p1value, drcuml_ptype p2type, drcuml_pvalue p2value, drcuml_ptype p3type, drcuml_pvalue p3value) | |
| 639 | 817 | { |
| 640 | 818 | drcuml_instruction *inst = &block->inst[block->nextinst++]; |
| 641 | 819 | |
| r2844 | r2845 | |
| 648 | 826 | /* fill in the instruction */ |
| 649 | 827 | inst->opcode = (UINT8)op; |
| 650 | 828 | inst->size = size; |
| 651 | inst->condflags = condflags; | |
| 829 | inst->condition = condition; | |
| 830 | inst->flags = 0; | |
| 652 | 831 | inst->numparams = 4; |
| 653 | 832 | inst->param[0].type = p0type; |
| 654 | 833 | inst->param[0].value = p0value; |
| r2844 | r2845 | |
| 675 | 854 | |
| 676 | 855 | assert(block->inuse); |
| 677 | 856 | |
| 857 | /* optimize the resulting code first */ | |
| 858 | optimize_block(block); | |
| 859 | ||
| 678 | 860 | /* if we have a logfile, generate a disassembly of the block */ |
| 679 | 861 | if (drcuml->umllog != NULL) |
| 680 | { | |
| 681 | int instnum; | |
| 862 | disassemble_block(block); | |
| 682 | 863 | |
| 683 | /* iterate over instructions and output */ | |
| 684 | for (instnum = 0; instnum < block->nextinst; instnum++) | |
| 685 | { | |
| 686 | char dasm[512]; | |
| 687 | drcuml_disasm(&block->inst[instnum], dasm); | |
| 688 | drcuml_log_printf(drcuml, "%4d: %s\n", instnum, dasm); | |
| 689 | } | |
| 690 | drcuml_log_printf(drcuml, "\n\n"); | |
| 691 | fflush(drcuml->umllog); | |
| 692 | } | |
| 693 | ||
| 694 | 864 | /* generate the code via the back-end */ |
| 695 | 865 | (*drcuml->beintf->be_generate)(drcuml->bestate, block, block->inst, block->nextinst); |
| 696 | 866 | |
| r2844 | r2845 | |
| 833 | 1003 | ***************************************************************************/ |
| 834 | 1004 | |
| 835 | 1005 | /*------------------------------------------------- |
| 1006 | drcuml_symbol_add - add a symbol to the | |
| 1007 | internal symbol table | |
| 1008 | -------------------------------------------------*/ | |
| 1009 | ||
| 1010 | void drcuml_symbol_add(drcuml_state *drcuml, void *base, UINT32 length, const char *name) | |
| 1011 | { | |
| 1012 | drcuml_symbol *symbol; | |
| 1013 | ||
| 1014 | /* allocate memory to hold the symbol */ | |
| 1015 | symbol = malloc(sizeof(*symbol) + strlen(name)); | |
| 1016 | if (symbol == NULL) | |
| 1017 | fatalerror("Out of memory allocating symbol in drcuml_symbol_add"); | |
| 1018 | ||
| 1019 | /* fill in the structure */ | |
| 1020 | symbol->next = NULL; | |
| 1021 | symbol->base = (drccodeptr)base; | |
| 1022 | symbol->length = length; | |
| 1023 | strcpy(symbol->symname, name); | |
| 1024 | ||
| 1025 | /* add to the tail of the list */ | |
| 1026 | *drcuml->symtailptr = symbol; | |
| 1027 | drcuml->symtailptr = &symbol->next; | |
| 1028 | } | |
| 1029 | ||
| 1030 | ||
| 1031 | /*------------------------------------------------- | |
| 1032 | drcuml_symbol_find - look up a symbol from the | |
| 1033 | internal symbol table or return NULL if not | |
| 1034 | found | |
| 1035 | -------------------------------------------------*/ | |
| 1036 | ||
| 1037 | const char *drcuml_symbol_find(drcuml_state *drcuml, void *base, UINT32 *offset) | |
| 1038 | { | |
| 1039 | drccodeptr search = base; | |
| 1040 | drcuml_symbol *symbol; | |
| 1041 | ||
| 1042 | /* simple linear search */ | |
| 1043 | for (symbol = drcuml->symlist; symbol != NULL; symbol = symbol->next) | |
| 1044 | if (search >= symbol->base && search < symbol->base + symbol->length) | |
| 1045 | { | |
| 1046 | /* if no offset pointer, only match perfectly */ | |
| 1047 | if (offset == NULL && search != symbol->base) | |
| 1048 | continue; | |
| 1049 | ||
| 1050 | /* return the offset and name */ | |
| 1051 | if (offset != NULL) | |
| 1052 | *offset = search - symbol->base; | |
| 1053 | return symbol->symname; | |
| 1054 | } | |
| 1055 | ||
| 1056 | /* not found; return NULL */ | |
| 1057 | return NULL; | |
| 1058 | } | |
| 1059 | ||
| 1060 | ||
| 1061 | /*------------------------------------------------- | |
| 836 | 1062 | drcuml_log_printf - directly printf to the UML |
| 837 | 1063 | log if generated |
| 838 | 1064 | -------------------------------------------------*/ |
| r2844 | r2845 | |
| 881 | 1107 | } |
| 882 | 1108 | |
| 883 | 1109 | |
| 1110 | /*------------------------------------------------- | |
| 1111 | drcuml_disasm - disassemble an | |
| 1112 | instruction to the given buffer | |
| 1113 | -------------------------------------------------*/ | |
| 884 | 1114 | |
| 1115 | void drcuml_disasm(const drcuml_instruction *inst, char *buffer, drcuml_state *drcuml) | |
| 1116 | { | |
| 1117 | static const char *conditions[] = { "z", "nz", "s", "ns", "c", "nc", "v", "nv", "u", "nu", "a", "be", "g", "le", "l", "ge" }; | |
| 1118 | static const char *pound_size[] = { "?", "?", "?", "?", "s", "?", "?", "?", "d" }; | |
| 1119 | static const char *bang_size[] = { "?", "b", "h", "?", "", "?", "?", "?", "d" }; | |
| 1120 | static const char *fmods[] = { "trunc", "round", "ceil", "floor", "default" }; | |
| 1121 | static const char *sizes[] = { "byte", "word", "dword", "qword" }; | |
| 1122 | const drcuml_opcode_info *opinfo = opcode_info_table[inst->opcode]; | |
| 1123 | char *dest = buffer; | |
| 1124 | const char *opsrc; | |
| 1125 | int pnum; | |
| 1126 | ||
| 1127 | assert(inst->opcode != DRCUML_OP_INVALID && inst->opcode < DRCUML_OP_MAX); | |
| 1128 | ||
| 1129 | /* start with the raw mnemonic and substitute sizes */ | |
| 1130 | for (opsrc = opinfo->mnemonic; *opsrc != 0; opsrc++) | |
| 1131 | if (*opsrc == '!') | |
| 1132 | dest += sprintf(dest, "%s", bang_size[inst->size]); | |
| 1133 | else if (*opsrc == '#') | |
| 1134 | dest += sprintf(dest, "%s", pound_size[inst->size]); | |
| 1135 | else | |
| 1136 | *dest++ = *opsrc; | |
| 1137 | ||
| 1138 | /* pad to 8 spaces */ | |
| 1139 | while (dest < &buffer[8]) | |
| 1140 | *dest++ = ' '; | |
| 1141 | ||
| 1142 | /* iterate through parameters */ | |
| 1143 | for (pnum = 0; pnum < inst->numparams; pnum++) | |
| 1144 | { | |
| 1145 | const drcuml_parameter *param = &inst->param[pnum]; | |
| 1146 | UINT16 typemask = opinfo->param[pnum].typemask; | |
| 1147 | const char *symbol; | |
| 1148 | UINT32 symoffset; | |
| 1149 | ||
| 1150 | /* start with a comma for all except the first parameter */ | |
| 1151 | if (pnum != 0) | |
| 1152 | *dest++ = ','; | |
| 1153 | ||
| 1154 | /* ouput based on type */ | |
| 1155 | switch (param->type) | |
| 1156 | { | |
| 1157 | /* immediates have several special cases */ | |
| 1158 | case DRCUML_PTYPE_IMMEDIATE: | |
| 1159 | ||
| 1160 | /* size immediate */ | |
| 1161 | if (typemask == PTYPES_SIZE) | |
| 1162 | dest += sprintf(dest, "%s", sizes[param->value]); | |
| 1163 | ||
| 1164 | /* address space immediate */ | |
| 1165 | else if (typemask == PTYPES_SPACE) | |
| 1166 | dest += sprintf(dest, "%s", address_space_names[param->value]); | |
| 1167 | ||
| 1168 | /* size + address space immediate */ | |
| 1169 | else if (typemask == PTYPES_SPSZ) | |
| 1170 | dest += sprintf(dest, "%s_%s", address_space_names[param->value / 16], sizes[param->value % 16]); | |
| 1171 | ||
| 1172 | /* fmod immediate */ | |
| 1173 | else if (typemask == PTYPES_FMOD) | |
| 1174 | dest += sprintf(dest, "%s", fmods[param->value]); | |
| 1175 | ||
| 1176 | /* general immediate */ | |
| 1177 | else | |
| 1178 | { | |
| 1179 | int size = effective_psize(inst, opinfo, pnum); | |
| 1180 | UINT64 value = param->value; | |
| 1181 | ||
| 1182 | /* truncate to size */ | |
| 1183 | if (size == 1) value = (UINT8)value; | |
| 1184 | if (size == 2) value = (UINT16)value; | |
| 1185 | if (size == 4) value = (UINT32)value; | |
| 1186 | if ((UINT32)value == value) | |
| 1187 | dest += sprintf(dest, "$%X", (UINT32)value); | |
| 1188 | else | |
| 1189 | dest += sprintf(dest, "$%X%08X", (UINT32)(value >> 32), (UINT32)value); | |
| 1190 | } | |
| 1191 | break; | |
| 1192 | ||
| 1193 | /* integer registers */ | |
| 1194 | case DRCUML_PTYPE_INT_REGISTER: | |
| 1195 | if (param->value >= DRCUML_REG_I0 && param->value < DRCUML_REG_I_END) | |
| 1196 | dest += sprintf(dest, "i%d", (UINT32)(param->value - DRCUML_REG_I0)); | |
| 1197 | else | |
| 1198 | dest += sprintf(dest, "i(%X?)", (UINT32)param->value); | |
| 1199 | break; | |
| 1200 | ||
| 1201 | /* floating point registers */ | |
| 1202 | case DRCUML_PTYPE_FLOAT_REGISTER: | |
| 1203 | if (param->value >= DRCUML_REG_F0 && param->value < DRCUML_REG_F_END) | |
| 1204 | dest += sprintf(dest, "f%d", (UINT32)(param->value - DRCUML_REG_F0)); | |
| 1205 | else | |
| 1206 | dest += sprintf(dest, "f(%X?)", (UINT32)param->value); | |
| 1207 | break; | |
| 1208 | ||
| 1209 | /* map variables */ | |
| 1210 | case DRCUML_PTYPE_MAPVAR: | |
| 1211 | if (param->value >= DRCUML_MAPVAR_M0 && param->value < DRCUML_MAPVAR_END) | |
| 1212 | dest += sprintf(dest, "m%d", (UINT32)(param->value - DRCUML_MAPVAR_M0)); | |
| 1213 | else | |
| 1214 | dest += sprintf(dest, "m(%X?)", (UINT32)param->value); | |
| 1215 | break; | |
| 1216 | ||
| 1217 | /* memory */ | |
| 1218 | case DRCUML_PTYPE_MEMORY: | |
| 1219 | ||
| 1220 | /* handle pointer */ | |
| 1221 | if (typemask == PTYPES_HAND) | |
| 1222 | dest += sprintf(dest, "%s", drcuml_handle_name((const drcuml_codehandle *)(FPTR)param->value)); | |
| 1223 | ||
| 1224 | /* string pointer */ | |
| 1225 | else if (typemask == PTYPES_STR) | |
| 1226 | dest += sprintf(dest, "%s", (const char *)(FPTR)param->value); | |
| 1227 | ||
| 1228 | /* symbol */ | |
| 1229 | else if (drcuml != NULL && (symbol = drcuml_symbol_find(drcuml, (drccodeptr)(FPTR)param->value, &symoffset)) != NULL) | |
| 1230 | { | |
| 1231 | if (symoffset == 0) | |
| 1232 | dest += sprintf(dest, "[%s]", symbol); | |
| 1233 | else | |
| 1234 | dest += sprintf(dest, "[%s+$%X]", symbol, symoffset); | |
| 1235 | } | |
| 1236 | ||
| 1237 | /* cache memory */ | |
| 1238 | else if (drcuml != NULL && drccache_contains_pointer(drcuml->cache, (void *)(FPTR)param->value)) | |
| 1239 | dest += sprintf(dest, "[+$%X]", (UINT32)(FPTR)((drccodeptr)(FPTR)param->value - drccache_near(drcuml->cache))); | |
| 1240 | ||
| 1241 | /* general memory */ | |
| 1242 | else | |
| 1243 | dest += sprintf(dest, "[[$%p]]", (void *)(FPTR)param->value); | |
| 1244 | break; | |
| 1245 | ||
| 1246 | default: | |
| 1247 | dest += sprintf(dest, "???"); | |
| 1248 | break; | |
| 1249 | } | |
| 1250 | } | |
| 1251 | ||
| 1252 | /* if there's a condition, append it */ | |
| 1253 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 1254 | dest += sprintf(dest, ",%s", conditions[inst->condition & 0x0f]); | |
| 1255 | ||
| 1256 | /* if there are flags, append them */ | |
| 1257 | if (inst->flags != 0) | |
| 1258 | { | |
| 1259 | *dest++ = ','; | |
| 1260 | if (inst->flags & DRCUML_FLAG_U) | |
| 1261 | *dest++ = 'U'; | |
| 1262 | if (inst->flags & DRCUML_FLAG_S) | |
| 1263 | *dest++ = 'S'; | |
| 1264 | if (inst->flags & DRCUML_FLAG_Z) | |
| 1265 | *dest++ = 'Z'; | |
| 1266 | if (inst->flags & DRCUML_FLAG_V) | |
| 1267 | *dest++ = 'V'; | |
| 1268 | if (inst->flags & DRCUML_FLAG_C) | |
| 1269 | *dest++ = 'C'; | |
| 1270 | } | |
| 1271 | ||
| 1272 | /* ensure we are NULL-terminated */ | |
| 1273 | *dest = 0; | |
| 1274 | } | |
| 1275 | ||
| 1276 | ||
| 1277 | ||
| 885 | 1278 | /*************************************************************************** |
| 886 | | |
| 1279 | | |
| 887 | 1280 | ***************************************************************************/ |
| 888 | 1281 | |
| 889 | 1282 | /*------------------------------------------------- |
| 890 | validate_instruction - verify that the | |
| 891 | instruction created meets all requirements | |
| 1283 | optimize_block - apply various optimizations | |
| 1284 | to a block of code | |
| 892 | 1285 | -------------------------------------------------*/ |
| 893 | 1286 | |
| 894 | static void | |
| 1287 | static void op | |
| 895 | 1288 | { |
| 896 | const drcuml_opcode_valid *opvalid = &opcode_valid_table[inst->opcode]; | |
| 1289 | UINT32 mapvar[DRCUML_MAPVAR_END - DRCUML_MAPVAR_M0] = { 0 }; | |
| 1290 | int instnum; | |
| 897 | 1291 | |
| 898 | /* validate information */ | |
| 899 | assert(inst->opcode != DRCUML_OP_INVALID && inst->opcode < DRCUML_OP_MAX); | |
| 900 | assert(inst->size == 1 || inst->size == 2 || inst->size == 4 || inst->size == 8); | |
| 901 | assert((opvalid->sizes & inst->size) != 0); | |
| 902 | if (inst->numparams > 0) | |
| 1292 | /* iterate over instructions */ | |
| 1293 | for (instnum = 0; instnum < block->nextinst; instnum++) | |
| 903 | 1294 | { |
| 904 | assert(inst->param[0].type > DRCUML_PTYPE_NONE && inst->param[0].type < DRCUML_PTYPE_MAX); | |
| 905 | assert(((opvalid->ptypes[0] >> inst->param[0].type) & 1) != 0); | |
| 906 | if (inst->param[0].type == DRCUML_PTYPE_MEMORY && !(opvalid->ptypes[0] & OV_PARAM_FLAG_ANYMEM)) | |
| 907 | assert_in_near_cache(block->drcuml->cache, (void *)(FPTR)inst->param[0].value); | |
| 1295 | drcuml_instruction *inst = &block->inst[instnum]; | |
| 1296 | const drcuml_opcode_info *opinfo = opcode_info_table[inst->opcode]; | |
| 1297 | UINT8 remainingflags; | |
| 1298 | int scannum, pnum; | |
| 1299 | ||
| 1300 | /* first compute what flags we need */ | |
| 1301 | inst->flags = 0; | |
| 1302 | remainingflags = effective_outflags(inst, opinfo); | |
| 1303 | ||
| 1304 | /* scan ahead until we run out of possible remaining flags */ | |
| 1305 | for (scannum = instnum + 1; remainingflags != 0 && scannum < block->nextinst; scannum++) | |
| 1306 | { | |
| 1307 | const drcuml_instruction *scan = &block->inst[scannum]; | |
| 1308 | const drcuml_opcode_info *scaninfo = opcode_info_table[scan->opcode]; | |
| 1309 | ||
| 1310 | /* any input flags are required */ | |
| 1311 | inst->flags |= effective_inflags(scan, scaninfo); | |
| 1312 | ||
| 1313 | /* if the scanahead instruction is unconditional, assume his flags are modified */ | |
| 1314 | if (scan->condition == DRCUML_COND_ALWAYS) | |
| 1315 | remainingflags &= ~scaninfo->modflags; | |
| 1316 | } | |
| 1317 | ||
| 1318 | /* track mapvars */ | |
| 1319 | if (inst->opcode == DRCUML_OP_MAPVAR) | |
| 1320 | mapvar[inst->param[0].value - DRCUML_MAPVAR_M0] = inst->param[1].value; | |
| 1321 | ||
| 1322 | /* convert all mapvar parameters to immediates */ | |
| 1323 | else if (inst->opcode != DRCUML_OP_RECOVER) | |
| 1324 | for (pnum = 0; pnum < inst->numparams; pnum++) | |
| 1325 | if (inst->param[pnum].type == DRCUML_PTYPE_MAPVAR) | |
| 1326 | { | |
| 1327 | inst->param[pnum].type = DRCUML_PTYPE_IMMEDIATE; | |
| 1328 | inst->param[pnum].value = mapvar[inst->param[pnum].value - DRCUML_MAPVAR_M0]; | |
| 1329 | } | |
| 1330 | ||
| 1331 | /* if we don't need any flags, then we can eliminate a lot of dumb operations */ | |
| 1332 | if (inst->flags == 0) | |
| 1333 | simplify_instruction_with_no_flags(block, inst); | |
| 908 | 1334 | } |
| 909 | if (inst->numparams > 1) | |
| 1335 | } | |
| 1336 | ||
| 1337 | ||
| 1338 | /*------------------------------------------------- | |
| 1339 | simplify_instruction_with_no_flags - simplify | |
| 1340 | instructions that have immediate values we | |
| 1341 | can evaluate at compile time | |
| 1342 | -------------------------------------------------*/ | |
| 1343 | ||
| 1344 | static void simplify_instruction_with_no_flags(drcuml_block *block, drcuml_instruction *inst) | |
| 1345 | { | |
| 1346 | static const UINT64 instsizemask[] = { 0, 0, 0, 0, 0xffffffff, 0, 0, 0, U64(0xffffffffffffffff) }; | |
| 1347 | static const UINT64 paramsizemask[] = { 0xff, 0xffff, 0xffffffff, U64(0xffffffffffffffff) }; | |
| 1348 | drcuml_opcode origop = inst->opcode; | |
| 1349 | #if LOG_SIMPLIFICATIONS | |
| 1350 | drcuml_instruction orig = *inst; | |
| 1351 | #endif | |
| 1352 | ||
| 1353 | switch (inst->opcode) | |
| 910 | 1354 | { |
| 911 | assert(inst->param[1].type > DRCUML_PTYPE_NONE && inst->param[1].type < DRCUML_PTYPE_MAX); | |
| 912 | assert(((opvalid->ptypes[1] >> inst->param[1].type) & 1) != 0); | |
| 913 | if (inst->param[1].type == DRCUML_PTYPE_MEMORY && !(opvalid->ptypes[1] & OV_PARAM_FLAG_ANYMEM)) | |
| 914 | assert_in_near_cache(block->drcuml->cache, (void *)(FPTR)inst->param[1].value); | |
| 1355 | /* READM: convert to READ if the mask is wide open */ | |
| 1356 | case DRCUML_OP_READM: | |
| 1357 | if (param_is_immediate_value(inst, 2, paramsizemask[inst->param[3].value] & 3)) | |
| 1358 | { | |
| 1359 | inst->opcode = DRCUML_OP_READ; | |
| 1360 | inst->numparams = 3; | |
| 1361 | inst->param[2] = inst->param[3]; | |
| 1362 | } | |
| 1363 | break; | |
| 1364 | ||
| 1365 | /* WRITEM: convert to WRITE if the mask is wide open */ | |
| 1366 | case DRCUML_OP_WRITEM: | |
| 1367 | if (param_is_immediate_value(inst, 2, paramsizemask[inst->param[3].value] & 3)) | |
| 1368 | { | |
| 1369 | inst->opcode = DRCUML_OP_WRITE; | |
| 1370 | inst->numparams = 3; | |
| 1371 | inst->param[2] = inst->param[3]; | |
| 1372 | } | |
| 1373 | break; | |
| 1374 | ||
| 1375 | /* SET: convert to MOV if constant condition */ | |
| 1376 | case DRCUML_OP_SET: | |
| 1377 | if (inst->condition == DRCUML_COND_ALWAYS) | |
| 1378 | convert_to_mov_immediate(inst, 1); | |
| 1379 | break; | |
| 1380 | ||
| 1381 | /* MOV: convert to NOP if move-to-self */ | |
| 1382 | case DRCUML_OP_MOV: | |
| 1383 | if (param_equal(inst, 0, 1)) | |
| 1384 | convert_to_nop(inst); | |
| 1385 | break; | |
| 1386 | ||
| 1387 | /* SEXT: convert immediates to MOV */ | |
| 1388 | case DRCUML_OP_SEXT: | |
| 1389 | if (param_is_immediate(inst, 1)) | |
| 1390 | switch (inst->param[2].value) | |
| 1391 | { | |
| 1392 | case DRCUML_SIZE_BYTE: convert_to_mov_immediate(inst, (INT8)inst->param[1].value); break; | |
| 1393 | case DRCUML_SIZE_WORD: convert_to_mov_immediate(inst, (INT16)inst->param[1].value); break; | |
| 1394 | case DRCUML_SIZE_DWORD: convert_to_mov_immediate(inst, (INT32)inst->param[1].value); break; | |
| 1395 | case DRCUML_SIZE_QWORD: convert_to_mov_immediate(inst, (INT64)inst->param[1].value); break; | |
| 1396 | } | |
| 1397 | break; | |
| 1398 | ||
| 1399 | /* ROLAND: convert to MOV if all immediate, or to ROL or AND if one is not needed, or to SHL/SHR if the mask is right */ | |
| 1400 | case DRCUML_OP_ROLAND: | |
| 1401 | if (param_is_immediate(inst, 1) && param_is_immediate(inst, 2) && param_is_immediate(inst, 3)) | |
| 1402 | { | |
| 1403 | if (inst->size == 4) | |
| 1404 | convert_to_mov_immediate(inst, rol32(inst->param[1].value, inst->param[2].value) & inst->param[3].value); | |
| 1405 | else | |
| 1406 | convert_to_mov_immediate(inst, rol64(inst->param[1].value, inst->param[2].value) & inst->param[3].value); | |
| 1407 | } | |
| 1408 | else if (param_is_immediate_value(inst, 2, 0)) | |
| 1409 | { | |
| 1410 | inst->opcode = DRCUML_OP_AND; | |
| 1411 | inst->numparams = 3; | |
| 1412 | inst->param[2] = inst->param[3]; | |
| 1413 | } | |
| 1414 | else if (param_is_immediate_value(inst, 3, instsizemask[inst->size])) | |
| 1415 | { | |
| 1416 | inst->opcode = DRCUML_OP_ROL; | |
| 1417 | inst->numparams = 3; | |
| 1418 | } | |
| 1419 | else if (param_is_immediate(inst, 2) && param_is_immediate_value(inst, 3, ((U64(0xffffffffffffffff) << inst->param[2].value) & instsizemask[inst->size]))) | |
| 1420 | { | |
| 1421 | inst->opcode = DRCUML_OP_SHL; | |
| 1422 | inst->numparams = 3; | |
| 1423 | } | |
| 1424 | else if (param_is_immediate(inst, 2) && param_is_immediate_value(inst, 3, instsizemask[inst->size] >> (8 * inst->size - inst->param[2].value))) | |
| 1425 | { | |
| 1426 | inst->opcode = DRCUML_OP_SHR; | |
| 1427 | inst->numparams = 3; | |
| 1428 | inst->param[2].value = 8 * inst->size - inst->param[2].value; | |
| 1429 | } | |
| 1430 | break; | |
| 1431 | ||
| 1432 | /* ROLINS: convert to ROLAND if the mask is full */ | |
| 1433 | case DRCUML_OP_ROLINS: | |
| 1434 | if (param_is_immediate_value(inst, 3, instsizemask[inst->size])) | |
| 1435 | inst->opcode = DRCUML_OP_ROLAND; | |
| 1436 | break; | |
| 1437 | ||
| 1438 | /* ADD: convert to MOV if immediate, or if adding 0 */ | |
| 1439 | case DRCUML_OP_ADD: | |
| 1440 | if (param_is_immediate(inst, 1) && param_is_immediate(inst, 2)) | |
| 1441 | convert_to_mov_immediate(inst, inst->param[1].value + inst->param[2].value); | |
| 1442 | else if (param_is_immediate_value(inst, 1, 0)) | |
| 1443 | convert_to_mov_param(inst, 2); | |
| 1444 | else if (param_is_immediate_value(inst, 2, 0)) | |
| 1445 | convert_to_mov_param(inst, 1); | |
| 1446 | break; | |
| 1447 | ||
| 1448 | /* SUB: convert to MOV if immediate, or if subtracting 0 */ | |
| 1449 | case DRCUML_OP_SUB: | |
| 1450 | if (param_is_immediate(inst, 1) && param_is_immediate(inst, 2)) | |
| 1451 | convert_to_mov_immediate(inst, inst->param[1].value - inst->param[2].value); | |
| 1452 | else if (param_is_immediate_value(inst, 2, 0)) | |
| 1453 | convert_to_mov_param(inst, 1); | |
| 1454 | break; | |
| 1455 | ||
| 1456 | /* CMP: no-op if no flags needed, compare i0 to i0 if the parameters are equal */ | |
| 1457 | case DRCUML_OP_CMP: | |
| 1458 | if (inst->flags == 0) | |
| 1459 | convert_to_nop(inst); | |
| 1460 | else if (param_equal(inst, 1, 2)) | |
| 1461 | { | |
| 1462 | inst->param[1].type = inst->param[2].type = DRCUML_PTYPE_INT_REGISTER; | |
| 1463 | inst->param[1].value = inst->param[2].value = DRCUML_REG_I0; | |
| 1464 | } | |
| 1465 | break; | |
| 1466 | ||
| 1467 | /* MULU: convert simple form to MOV if immediate, or if multiplying by 0 */ | |
| 1468 | case DRCUML_OP_MULU: | |
| 1469 | if (param_equal(inst, 0, 1)) | |
| 1470 | { | |
| 1471 | if (param_is_immediate_value(inst, 2, 0) || param_is_immediate_value(inst, 3, 0)) | |
| 1472 | convert_to_mov_immediate(inst, 0); | |
| 1473 | else if (param_is_immediate(inst, 2) && param_is_immediate(inst, 3)) | |
| 1474 | { | |
| 1475 | if (inst->size == 4) | |
| 1476 | convert_to_mov_immediate(inst, (UINT32)((UINT32)inst->param[1].value * (UINT32)inst->param[2].value)); | |
| 1477 | else if (inst->size == 8) | |
| 1478 | convert_to_mov_immediate(inst, (UINT64)((UINT64)inst->param[1].value * (UINT64)inst->param[2].value)); | |
| 1479 | } | |
| 1480 | } | |
| 1481 | break; | |
| 1482 | ||
| 1483 | /* MULS: convert simple form to MOV if immediate, or if multiplying by 0 */ | |
| 1484 | case DRCUML_OP_MULS: | |
| 1485 | if (param_equal(inst, 0, 1)) | |
| 1486 | { | |
| 1487 | if (param_is_immediate_value(inst, 2, 0) || param_is_immediate_value(inst, 3, 0)) | |
| 1488 | convert_to_mov_immediate(inst, 0); | |
| 1489 | else if (param_is_immediate(inst, 2) && param_is_immediate(inst, 3)) | |
| 1490 | { | |
| 1491 | if (inst->size == 4) | |
| 1492 | convert_to_mov_immediate(inst, (INT32)((INT32)inst->param[1].value * (INT32)inst->param[2].value)); | |
| 1493 | else if (inst->size == 8) | |
| 1494 | convert_to_mov_immediate(inst, (INT64)((INT64)inst->param[1].value * (INT64)inst->param[2].value)); | |
| 1495 | } | |
| 1496 | } | |
| 1497 | break; | |
| 1498 | ||
| 1499 | /* DIVU: convert simple form to MOV if immediate, or if dividing with 0 */ | |
| 1500 | case DRCUML_OP_DIVU: | |
| 1501 | if (param_equal(inst, 0, 1) && !param_is_immediate_value(inst, 3, 0)) | |
| 1502 | { | |
| 1503 | if (param_is_immediate_value(inst, 2, 0)) | |
| 1504 | convert_to_mov_immediate(inst, 0); | |
| 1505 | else if (param_is_immediate(inst, 2) && param_is_immediate(inst, 3)) | |
| 1506 | { | |
| 1507 | if (inst->size == 4) | |
| 1508 | convert_to_mov_immediate(inst, (UINT32)((UINT32)inst->param[1].value / (UINT32)inst->param[2].value)); | |
| 1509 | else if (inst->size == 8) | |
| 1510 | convert_to_mov_immediate(inst, (UINT64)((UINT64)inst->param[1].value / (UINT64)inst->param[2].value)); | |
| 1511 | } | |
| 1512 | } | |
| 1513 | break; | |
| 1514 | ||
| 1515 | /* DIVS: convert simple form to MOV if immediate, or if dividing with 0 */ | |
| 1516 | case DRCUML_OP_DIVS: | |
| 1517 | if (param_equal(inst, 0, 1) && !param_is_immediate_value(inst, 3, 0)) | |
| 1518 | { | |
| 1519 | if (param_is_immediate_value(inst, 2, 0)) | |
| 1520 | convert_to_mov_immediate(inst, 0); | |
| 1521 | else if (param_is_immediate(inst, 2) && param_is_immediate(inst, 3)) | |
| 1522 | { | |
| 1523 | if (inst->size == 4) | |
| 1524 | convert_to_mov_immediate(inst, (INT32)((INT32)inst->param[1].value / (INT32)inst->param[2].value)); | |
| 1525 | else if (inst->size == 8) | |
| 1526 | convert_to_mov_immediate(inst, (INT64)((INT64)inst->param[1].value / (INT64)inst->param[2].value)); | |
| 1527 | } | |
| 1528 | } | |
| 1529 | break; | |
| 1530 | ||
| 1531 | /* AND: convert to MOV if immediate, or if anding against 0 or 0xffffffff */ | |
| 1532 | case DRCUML_OP_AND: | |
| 1533 | if (param_is_immediate_value(inst, 1, 0) || param_is_immediate_value(inst, 2, 0)) | |
| 1534 | convert_to_mov_immediate(inst, 0); | |
| 1535 | else if (param_is_immediate(inst, 1) && param_is_immediate(inst, 2)) | |
| 1536 | convert_to_mov_immediate(inst, inst->param[1].value & inst->param[2].value); | |
| 1537 | else if (param_is_immediate_value(inst, 1, instsizemask[inst->size])) | |
| 1538 | convert_to_mov_param(inst, 2); | |
| 1539 | else if (param_is_immediate_value(inst, 2, instsizemask[inst->size])) | |
| 1540 | convert_to_mov_param(inst, 1); | |
| 1541 | break; | |
| 1542 | ||
| 1543 | /* TEST: no-op if no flags needed */ | |
| 1544 | case DRCUML_OP_TEST: | |
| 1545 | if (inst->flags == 0) | |
| 1546 | convert_to_nop(inst); | |
| 1547 | break; | |
| 1548 | ||
| 1549 | /* OR: convert to MOV if immediate, or if oring against 0 or 0xffffffff */ | |
| 1550 | case DRCUML_OP_OR: | |
| 1551 | if (param_is_immediate_value(inst, 1, instsizemask[inst->size]) || param_is_immediate_value(inst, 2, instsizemask[inst->size])) | |
| 1552 | convert_to_mov_immediate(inst, instsizemask[inst->size]); | |
| 1553 | else if (param_is_immediate(inst, 1) && param_is_immediate(inst, 2)) | |
| 1554 | convert_to_mov_immediate(inst, inst->param[1].value | inst->param[2].value); | |
| 1555 | else if (param_is_immediate_value(inst, 1, 0)) | |
| 1556 | convert_to_mov_param(inst, 2); | |
| 1557 | else if (param_is_immediate_value(inst, 2, 0)) | |
| 1558 | convert_to_mov_param(inst, 1); | |
| 1559 | break; | |
| 1560 | ||
| 1561 | /* XOR: convert to MOV if immediate, or if xoring against 0 */ | |
| 1562 | case DRCUML_OP_XOR: | |
| 1563 | if (param_is_immediate(inst, 1) && param_is_immediate(inst, 2)) | |
| 1564 | convert_to_mov_immediate(inst, inst->param[1].value ^ inst->param[2].value); | |
| 1565 | else if (param_is_immediate_value(inst, 1, 0)) | |
| 1566 | convert_to_mov_param(inst, 2); | |
| 1567 | else if (param_is_immediate_value(inst, 2, 0)) | |
| 1568 | convert_to_mov_param(inst, 1); | |
| 1569 | break; | |
| 1570 | ||
| 1571 | /* LZCNT: convert to MOV if immediate */ | |
| 1572 | case DRCUML_OP_LZCNT: | |
| 1573 | if (param_is_immediate(inst, 1)) | |
| 1574 | { | |
| 1575 | if (inst->size == 4) | |
| 1576 | convert_to_mov_immediate(inst, count_leading_zeros(inst->param[1].value)); | |
| 1577 | else if (inst->size == 8) | |
| 1578 | { | |
| 1579 | if ((inst->param[1].value >> 32) == 0) | |
| 1580 | convert_to_mov_immediate(inst, 32 + count_leading_zeros(inst->param[1].value)); | |
| 1581 | else | |
| 1582 | convert_to_mov_immediate(inst, count_leading_zeros(inst->param[1].value >> 32)); | |
| 1583 | } | |
| 1584 | } | |
| 1585 | break; | |
| 1586 | ||
| 1587 | /* BSWAP: convert to MOV if immediate */ | |
| 1588 | case DRCUML_OP_BSWAP: | |
| 1589 | if (param_is_immediate(inst, 1)) | |
| 1590 | { | |
| 1591 | if (inst->size == 4) | |
| 1592 | convert_to_mov_immediate(inst, FLIPENDIAN_INT32(inst->param[1].value)); | |
| 1593 | else if (inst->size == 8) | |
| 1594 | convert_to_mov_immediate(inst, FLIPENDIAN_INT64(inst->param[1].value)); | |
| 1595 | } | |
| 1596 | break; | |
| 1597 | ||
| 1598 | /* SHL: convert to MOV if immediate or shifting by 0 */ | |
| 1599 | case DRCUML_OP_SHL: | |
| 1600 | if (param_is_immediate(inst, 1) && param_is_immediate(inst, 2)) | |
| 1601 | convert_to_mov_immediate(inst, inst->param[1].value << inst->param[2].value); | |
| 1602 | else if (param_is_immediate_value(inst, 2, 0)) | |
| 1603 | convert_to_mov_param(inst, 1); | |
| 1604 | break; | |
| 1605 | ||
| 1606 | /* SHR: convert to MOV if immediate or shifting by 0 */ | |
| 1607 | case DRCUML_OP_SHR: | |
| 1608 | if (param_is_immediate(inst, 1) && param_is_immediate(inst, 2)) | |
| 1609 | { | |
| 1610 | if (inst->size == 4) | |
| 1611 | convert_to_mov_immediate(inst, (UINT32)inst->param[1].value >> inst->param[2].value); | |
| 1612 | else if (inst->size == 8) | |
| 1613 | convert_to_mov_immediate(inst, (UINT64)inst->param[1].value >> inst->param[2].value); | |
| 1614 | } | |
| 1615 | else if (param_is_immediate_value(inst, 2, 0)) | |
| 1616 | convert_to_mov_param(inst, 1); | |
| 1617 | break; | |
| 1618 | ||
| 1619 | /* SAR: convert to MOV if immediate or shifting by 0 */ | |
| 1620 | case DRCUML_OP_SAR: | |
| 1621 | if (param_is_immediate(inst, 1) && param_is_immediate(inst, 2)) | |
| 1622 | { | |
| 1623 | if (inst->size == 4) | |
| 1624 | convert_to_mov_immediate(inst, (INT32)inst->param[1].value >> inst->param[2].value); | |
| 1625 | else if (inst->size == 8) | |
| 1626 | convert_to_mov_immediate(inst, (INT64)inst->param[1].value >> inst->param[2].value); | |
| 1627 | } | |
| 1628 | else if (param_is_immediate_value(inst, 2, 0)) | |
| 1629 | convert_to_mov_param(inst, 1); | |
| 1630 | break; | |
| 1631 | ||
| 1632 | /* ROL: convert to NOP if immediate or rotating by 0 */ | |
| 1633 | case DRCUML_OP_ROL: | |
| 1634 | if (param_is_immediate(inst, 1) && param_is_immediate(inst, 2)) | |
| 1635 | { | |
| 1636 | if (inst->size == 4) | |
| 1637 | convert_to_mov_immediate(inst, rol32(inst->param[1].value, inst->param[2].value)); | |
| 1638 | else if (inst->size == 8) | |
| 1639 | convert_to_mov_immediate(inst, rol64(inst->param[1].value, inst->param[2].value)); | |
| 1640 | } | |
| 1641 | else if (param_is_immediate_value(inst, 2, 0)) | |
| 1642 | convert_to_mov_param(inst, 1); | |
| 1643 | break; | |
| 1644 | ||
| 1645 | /* ROR: convert to NOP if immediate or rotating by 0 */ | |
| 1646 | case DRCUML_OP_ROR: | |
| 1647 | if (param_is_immediate(inst, 1) && param_is_immediate(inst, 2)) | |
| 1648 | { | |
| 1649 | if (inst->size == 4) | |
| 1650 | convert_to_mov_immediate(inst, rol32(inst->param[1].value, 32 - inst->param[2].value)); | |
| 1651 | else if (inst->size == 8) | |
| 1652 | convert_to_mov_immediate(inst, rol64(inst->param[1].value, 64 - inst->param[2].value)); | |
| 1653 | } | |
| 1654 | else if (param_is_immediate_value(inst, 2, 0)) | |
| 1655 | convert_to_mov_param(inst, 1); | |
| 1656 | break; | |
| 1657 | ||
| 1658 | /* FMOV: convert to NOP if move-to-self */ | |
| 1659 | case DRCUML_OP_FMOV: | |
| 1660 | if (param_equal(inst, 0, 1)) | |
| 1661 | convert_to_nop(inst); | |
| 1662 | break; | |
| 1663 | ||
| 1664 | default: | |
| 1665 | break; | |
| 915 | 1666 | } |
| 916 | if (inst->numparams > 2) | |
| 1667 | ||
| 1668 | #if LOG_SIMPLIFICATIONS | |
| 1669 | if (memcmp(&orig, inst, sizeof(orig)) != 0) | |
| 917 | 1670 | { |
| 918 | assert(inst->param[2].type > DRCUML_PTYPE_NONE && inst->param[2].type < DRCUML_PTYPE_MAX); | |
| 919 | assert(((opvalid->ptypes[2] >> inst->param[2].type) & 1) != 0); | |
| 920 | if (inst->param[2].type == DRCUML_PTYPE_MEMORY && !(opvalid->ptypes[2] & OV_PARAM_FLAG_ANYMEM)) | |
| 921 | assert_in_near_cache(block->drcuml->cache, (void *)(FPTR)inst->param[2].value); | |
| 1671 | char disasm1[256], disasm2[256]; | |
| 1672 | drcuml_disasm(&orig, disasm1, block->drcuml); | |
| 1673 | drcuml_disasm(inst, disasm2, block->drcuml); | |
| 1674 | mame_printf_debug("Simplified: %-50.50s -> %s\n", disasm1, disasm2); | |
| 922 | 1675 | } |
| 923 | if (inst->numparams > 3) | |
| 1676 | #endif | |
| 1677 | ||
| 1678 | /* if the opcode changed, validate and reoptimize */ | |
| 1679 | if (inst->opcode != origop) | |
| 924 | 1680 | { |
| 925 | assert(inst->param[3].type > DRCUML_PTYPE_NONE && inst->param[3].type < DRCUML_PTYPE_MAX); | |
| 926 | assert(((opvalid->ptypes[3] >> inst->param[3].type) & 1) != 0); | |
| 927 | if (inst->param[3].type == DRCUML_PTYPE_MEMORY && !(opvalid->ptypes[3] & OV_PARAM_FLAG_ANYMEM)) | |
| 928 | assert_in_near_cache(block->drcuml->cache, (void *)(FPTR)inst->param[3].value); | |
| 1681 | validate_instruction(block, inst); | |
| 1682 | simplify_instruction_with_no_flags(block, inst); | |
| 929 | 1683 | } |
| 930 | 1684 | } |
| 931 | 1685 | |
| 932 | 1686 | |
| 933 | 1687 | |
| 934 | 1688 | /*************************************************************************** |
| 1689 | LOGGING HELPERS | |
| 1690 | ***************************************************************************/ | |
| 1691 | ||
| 1692 | /*------------------------------------------------- | |
| 1693 | disassemble_block - disassemble a block of | |
| 1694 | instructions to the log | |
| 1695 | -------------------------------------------------*/ | |
| 1696 | ||
| 1697 | static void disassemble_block(drcuml_block *block) | |
| 1698 | { | |
| 1699 | int firstcomment = -1; | |
| 1700 | int instnum; | |
| 1701 | ||
| 1702 | /* iterate over instructions and output */ | |
| 1703 | for (instnum = 0; instnum < block->nextinst; instnum++) | |
| 1704 | { | |
| 1705 | const drcuml_instruction *inst = &block->inst[instnum]; | |
| 1706 | int flushcomments = FALSE; | |
| 1707 | ||
| 1708 | /* remember comments and mapvars for later */ | |
| 1709 | if (inst->opcode == DRCUML_OP_COMMENT || inst->opcode == DRCUML_OP_MAPVAR) | |
| 1710 | { | |
| 1711 | if (firstcomment == -1) | |
| 1712 | firstcomment = instnum; | |
| 1713 | } | |
| 1714 | ||
| 1715 | /* print labels, handles, and hashes left justified */ | |
| 1716 | else if (inst->opcode == DRCUML_OP_LABEL) | |
| 1717 | drcuml_log_printf(block->drcuml, "$%X:\n", (UINT32)inst->param[0].value); | |
| 1718 | else if (inst->opcode == DRCUML_OP_HANDLE) | |
| 1719 | drcuml_log_printf(block->drcuml, "%s:\n", drcuml_handle_name((const drcuml_codehandle *)(FPTR)inst->param[0].value)); | |
| 1720 | else if (inst->opcode == DRCUML_OP_HASH) | |
| 1721 | drcuml_log_printf(block->drcuml, "(%X,%X):\n", (UINT32)inst->param[0].value, (UINT32)inst->param[1].value); | |
| 1722 | ||
| 1723 | /* indent everything else with a tab */ | |
| 1724 | else | |
| 1725 | { | |
| 1726 | char dasm[256]; | |
| 1727 | drcuml_disasm(&block->inst[instnum], dasm, block->drcuml); | |
| 1728 | ||
| 1729 | /* include the first accumulated comment with this line */ | |
| 1730 | if (firstcomment != -1) | |
| 1731 | { | |
| 1732 | drcuml_log_printf(block->drcuml, "\t%-50.50s; %s\n", dasm, get_comment_text(&block->inst[firstcomment])); | |
| 1733 | firstcomment++; | |
| 1734 | flushcomments = TRUE; | |
| 1735 | } | |
| 1736 | else | |
| 1737 | drcuml_log_printf(block->drcuml, "\t%s\n", dasm); | |
| 1738 | } | |
| 1739 | ||
| 1740 | /* flush any comments pending */ | |
| 1741 | if (firstcomment != -1 && (flushcomments || instnum == block->nextinst - 1)) | |
| 1742 | { | |
| 1743 | while (firstcomment <= instnum) | |
| 1744 | { | |
| 1745 | const char *text = get_comment_text(&block->inst[firstcomment++]); | |
| 1746 | if (text != NULL) | |
| 1747 | drcuml_log_printf(block->drcuml, "\t%50s; %s\n", "", text); | |
| 1748 | } | |
| 1749 | firstcomment = -1; | |
| 1750 | } | |
| 1751 | } | |
| 1752 | drcuml_log_printf(block->drcuml, "\n\n"); | |
| 1753 | fflush(block->drcuml->umllog); | |
| 1754 | } | |
| 1755 | ||
| 1756 | ||
| 1757 | /*------------------------------------------------- | |
| 1758 | get_comment_text - determine the text | |
| 1759 | associated with a comment or mapvar | |
| 1760 | -------------------------------------------------*/ | |
| 1761 | ||
| 1762 | static const char *get_comment_text(const drcuml_instruction *inst) | |
| 1763 | { | |
| 1764 | static char tempbuf[100]; | |
| 1765 | ||
| 1766 | /* comments return their strings */ | |
| 1767 | if (inst->opcode == DRCUML_OP_COMMENT) | |
| 1768 | return (char *)(FPTR)inst->param[0].value; | |
| 1769 | ||
| 1770 | /* mapvars comment about their values */ | |
| 1771 | else if (inst->opcode == DRCUML_OP_MAPVAR) | |
| 1772 | { | |
| 1773 | sprintf(tempbuf, "m%d = $%X", (int)inst->param[0].value - DRCUML_MAPVAR_M0, (UINT32)inst->param[1].value); | |
| 1774 | return tempbuf; | |
| 1775 | } | |
| 1776 | ||
| 1777 | /* everything else is NULL */ | |
| 1778 | return NULL; | |
| 1779 | } | |
| 1780 | ||
| 1781 | ||
| 1782 | ||
| 1783 | /*************************************************************************** | |
| 1784 | OPCODE VALIDATION | |
| 1785 | ***************************************************************************/ | |
| 1786 | ||
| 1787 | /*------------------------------------------------- | |
| 1788 | validate_instruction - verify that the | |
| 1789 | instruction created meets all requirements | |
| 1790 | -------------------------------------------------*/ | |
| 1791 | ||
| 1792 | static void validate_instruction(drcuml_block *block, const drcuml_instruction *inst) | |
| 1793 | { | |
| 1794 | const drcuml_opcode_info *opinfo = opcode_info_table[inst->opcode]; | |
| 1795 | int pnum; | |
| 1796 | ||
| 1797 | /* validate raw information */ | |
| 1798 | assert(inst->opcode != DRCUML_OP_INVALID && inst->opcode < DRCUML_OP_MAX); | |
| 1799 | assert(inst->size == 1 || inst->size == 2 || inst->size == 4 || inst->size == 8); | |
| 1800 | ||
| 1801 | /* validate against opcode limits */ | |
| 1802 | assert((opinfo->sizes & inst->size) != 0); | |
| 1803 | assert(inst->condition == DRCUML_COND_ALWAYS || opinfo->condition); | |
| 1804 | ||
| 1805 | /* validate each parameter */ | |
| 1806 | for (pnum = 0; pnum < inst->numparams; pnum++) | |
| 1807 | { | |
| 1808 | const drcuml_parameter *param = &inst->param[pnum]; | |
| 1809 | UINT16 typemask = opinfo->param[pnum].typemask; | |
| 1810 | ||
| 1811 | /* ensure the type is correct */ | |
| 1812 | assert(param->type > DRCUML_PTYPE_NONE && param->type < DRCUML_PTYPE_MAX); | |
| 1813 | assert((typemask >> param->type) & 1); | |
| 1814 | ||
| 1815 | /* validate various parameter types */ | |
| 1816 | switch (param->type) | |
| 1817 | { | |
| 1818 | case DRCUML_PTYPE_MEMORY: | |
| 1819 | /* most memory parameters must be in the near cache */ | |
| 1820 | if (typemask != PTYPES_PTR && typemask != PTYPES_STATE && typemask != PTYPES_STR && typemask != PTYPES_CFUNC) | |
| 1821 | assert_in_near_cache(block->drcuml->cache, (void *)(FPTR)param->value); | |
| 1822 | break; | |
| 1823 | ||
| 1824 | case DRCUML_PTYPE_IMMEDIATE: | |
| 1825 | /* many special parameter types are encoded as immediately; ensure they are in range */ | |
| 1826 | if (typemask == PTYPES_SIZE) | |
| 1827 | assert(param->value >= DRCUML_SIZE_BYTE && param->value <= DRCUML_SIZE_QWORD); | |
| 1828 | else if (typemask == PTYPES_SPACE) | |
| 1829 | assert(param->value >= ADDRESS_SPACE_PROGRAM && param->value <= ADDRESS_SPACE_IO); | |
| 1830 | else if (typemask == PTYPES_SPSZ) | |
| 1831 | { | |
| 1832 | assert(param->value % 16 >= DRCUML_SIZE_BYTE && param->value % 16 <= DRCUML_SIZE_QWORD); | |
| 1833 | assert(param->value / 16 >= ADDRESS_SPACE_PROGRAM && param->value / 16 <= ADDRESS_SPACE_IO); | |
| 1834 | } | |
| 1835 | else if (typemask == PTYPES_FMOD) | |
| 1836 | assert(param->value >= DRCUML_FMOD_TRUNC && param->value <= DRCUML_FMOD_DEFAULT); | |
| 1837 | break; | |
| 1838 | ||
| 1839 | case DRCUML_PTYPE_MAPVAR: | |
| 1840 | assert(param->value >= DRCUML_MAPVAR_M0 && param->value < DRCUML_MAPVAR_END); | |
| 1841 | break; | |
| 1842 | ||
| 1843 | case DRCUML_PTYPE_INT_REGISTER: | |
| 1844 | assert(param->value >= DRCUML_REG_I0 && param->value < DRCUML_REG_I_END); | |
| 1845 | break; | |
| 1846 | ||
| 1847 | case DRCUML_PTYPE_FLOAT_REGISTER: | |
| 1848 | assert(param->value >= DRCUML_REG_F0 && param->value < DRCUML_REG_F_END); | |
| 1849 | break; | |
| 1850 | ||
| 1851 | default: | |
| 1852 | assert(FALSE); | |
| 1853 | break; | |
| 1854 | } | |
| 1855 | } | |
| 1856 | ||
| 1857 | /* make sure we aren't missing any parameters */ | |
| 1858 | if (inst->numparams < ARRAY_LENGTH(opinfo->param)) | |
| 1859 | assert(opinfo->param[inst->numparams].typemask == 0); | |
| 1860 | } | |
| 1861 | ||
| 1862 | ||
| 1863 | ||
| 1864 | #if 0 | |
| 1865 | ||
| 1866 | /*************************************************************************** | |
| 935 | 1867 | BACK-END VALIDATION |
| 936 | 1868 | ***************************************************************************/ |
| 937 | 1869 | |
| r2844 | r2845 | |
| 1013 | 1945 | |
| 1014 | 1946 | static void bevalidate_iterate_over_params(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, drcuml_parameter *paramlist, int pnum) |
| 1015 | 1947 | { |
| 1016 | const drcuml_opcode_ | |
| 1948 | const drcuml_opcode_ | |
| 1017 | 1949 | |
| 1018 | 1950 | /* if no parameters, execute now */ |
| 1019 | if (pnum >= ARRAY_LENGTH(op | |
| 1951 | if (pnum >= ARRAY_LENGTH(op | |
| 1020 | 1952 | { |
| 1021 | 1953 | bevalidate_iterate_over_flags(drcuml, handles, test, paramlist); |
| 1022 | 1954 | return; |
| r2844 | r2845 | |
| 1024 | 1956 | |
| 1025 | 1957 | /* iterate over valid parameter types */ |
| 1026 | 1958 | for (paramlist[pnum].type = DRCUML_PTYPE_IMMEDIATE; paramlist[pnum].type < DRCUML_PTYPE_MAX; paramlist[pnum].type++) |
| 1027 | if (op | |
| 1959 | if (op | |
| 1028 | 1960 | { |
| 1029 | 1961 | int pindex, pcount; |
| 1030 | 1962 | |
| 1031 | 1963 | /* mapvars can only do 32-bit tests */ |
| 1032 | if (paramlist[pnum].type == DRCUML_PTYPE_MAPVAR && size_for_param(test->size, op | |
| 1964 | if (paramlist[pnum].type == DRCUML_PTYPE_MAPVAR && size_for_param(test->size, op | |
| 1033 | 1965 | continue; |
| 1034 | 1966 | |
| 1035 | 1967 | /* for some parameter types, we wish to iterate over all possibilities */ |
| r2844 | r2845 | |
| 1077 | 2009 | |
| 1078 | 2010 | static void bevalidate_iterate_over_flags(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, drcuml_parameter *paramlist) |
| 1079 | 2011 | { |
| 1080 | const drcuml_opcode_valid *opvalid = &opcode_valid_table[test->opcode]; | |
| 1081 | UINT8 flagmask = opvalid->condflags & 0x1f; | |
| 2012 | const drcuml_opcode_info *opinfo = opcode_info_table[test->opcode]; | |
| 2013 | UINT8 flagmask = opinfo->flags & 0x1f; | |
| 1082 | 2014 | UINT8 curmask; |
| 1083 | 2015 | |
| 1084 | 2016 | /* iterate over all possible flag combinations */ |
| r2844 | r2845 | |
| 1125 | 2057 | switch (numparams) |
| 1126 | 2058 | { |
| 1127 | 2059 | case 0: |
| 1128 | drcuml_block_append_0(block, test->opcode, test->size, flagmask); | |
| 2060 | drcuml_block_append_0(block, test->opcode, test->size, DRCUML_COND_ALWAYS, flagmask); | |
| 1129 | 2061 | break; |
| 1130 | 2062 | |
| 1131 | 2063 | case 1: |
| 1132 | drcuml_block_append_1(block, test->opcode, test->size, flagmask, params[0].type, params[0].value); | |
| 2064 | drcuml_block_append_1(block, test->opcode, test->size, DRCUML_COND_ALWAYS, flagmask, params[0].type, params[0].value); | |
| 1133 | 2065 | break; |
| 1134 | 2066 | |
| 1135 | 2067 | case 2: |
| 1136 | drcuml_block_append_2(block, test->opcode, test->size, flagmask, params[0].type, params[0].value, params[1].type, params[1].value); | |
| 2068 | drcuml_block_append_2(block, test->opcode, test->size, DRCUML_COND_ALWAYS, flagmask, params[0].type, params[0].value, params[1].type, params[1].value); | |
| 1137 | 2069 | break; |
| 1138 | 2070 | |
| 1139 | 2071 | case 3: |
| 1140 | drcuml_block_append_3(block, test->opcode, test->size, flagmask, params[0].type, params[0].value, params[1].type, params[1].value, params[2].type, params[2].value); | |
| 2072 | drcuml_block_append_3(block, test->opcode, test->size, DRCUML_COND_ALWAYS, flagmask, params[0].type, params[0].value, params[1].type, params[1].value, params[2].type, params[2].value); | |
| 1141 | 2073 | break; |
| 1142 | 2074 | |
| 1143 | 2075 | case 4: |
| 1144 | drcuml_block_append_4(block, test->opcode, test->size, flagmask, params[0].type, params[0].value, params[1].type, params[1].value, params[2].type, params[2].value, params[3].type, params[3].value); | |
| 2076 | drcuml_block_append_4(block, test->opcode, test->size, DRCUML_COND_ALWAYS, flagmask, params[0].type, params[0].value, params[1].type, params[1].value, params[2].type, params[2].value, params[3].type, params[3].value); | |
| 1145 | 2077 | break; |
| 1146 | 2078 | } |
| 1147 | 2079 | testinst = block->inst[block->nextinst - 1]; |
| r2844 | r2845 | |
| 1205 | 2137 | |
| 1206 | 2138 | static int bevalidate_populate_state(drcuml_block *block, drcuml_machine_state *state, const bevalidate_test *test, const drcuml_parameter *paramlist, drcuml_parameter *params, UINT64 *parammem) |
| 1207 | 2139 | { |
| 1208 | const drcuml_opcode_ | |
| 2140 | const drcuml_opcode_ | |
| 1209 | 2141 | int numparams = ARRAY_LENGTH(test->param); |
| 1210 | 2142 | int pnum; |
| 1211 | 2143 | |
| r2844 | r2845 | |
| 1215 | 2147 | /* iterate over parameters */ |
| 1216 | 2148 | for (pnum = 0; pnum < ARRAY_LENGTH(test->param); pnum++) |
| 1217 | 2149 | { |
| 1218 | int psize = size_for_param(test->size, op | |
| 2150 | int psize = size_for_param(test->size, op | |
| 1219 | 2151 | drcuml_parameter *curparam = ¶ms[pnum]; |
| 1220 | 2152 | |
| 1221 | 2153 | /* start with a copy of the parameter from the list */ |
| r2844 | r2845 | |
| 1276 | 2208 | |
| 1277 | 2209 | static int bevalidate_verify_state(drcuml_state *drcuml, const drcuml_machine_state *istate, drcuml_machine_state *state, const bevalidate_test *test, const drcuml_parameter *params, const drcuml_instruction *testinst, drccodeptr codestart, drccodeptr codeend, UINT8 flagmask) |
| 1278 | 2210 | { |
| 1279 | const drcuml_opcode_ | |
| 2211 | const drcuml_opcode_ | |
| 1280 | 2212 | UINT8 ireg[DRCUML_REG_I_END - DRCUML_REG_I0] = { 0 }; |
| 1281 | 2213 | UINT8 freg[DRCUML_REG_F_END - DRCUML_REG_F0] = { 0 }; |
| 1282 | 2214 | char errorbuf[1024]; |
| r2844 | r2845 | |
| 1305 | 2237 | for (pnum = 0; pnum < ARRAY_LENGTH(test->param); pnum++) |
| 1306 | 2238 | if (test->destmask & (1 << pnum)) |
| 1307 | 2239 | { |
| 1308 | UINT64 mask = mask_for_param(test->size, opvalid->ptypes[pnum]); | |
| 1309 | int psize = size_for_param(test->size, opvalid->ptypes[pnum]); | |
| 2240 | UINT64 mask = mask_for_param(test->size, opinfo->ptypes[pnum]); | |
| 2241 | int psize = size_for_param(test->size, opinfo->ptypes[pnum]); | |
| 1310 | 2242 | UINT64 result = 0; |
| 1311 | 2243 | |
| 1312 | 2244 | /* fetch the result from the parameters */ |
| r2844 | r2845 | |
| 1366 | 2298 | /* output the error if we have one */ |
| 1367 | 2299 | if (errend != errorbuf) |
| 1368 | 2300 | { |
| 1369 | char disasm[ | |
| 2301 | char disasm[256]; | |
| 1370 | 2302 | |
| 1371 | 2303 | /* disassemble the test instruction */ |
| 1372 | drcuml_disasm(testinst, disasm); | |
| 2304 | drcuml_disasm(testinst, disasm, drcuml); | |
| 1373 | 2305 | |
| 1374 | 2306 | /* output a description of what went wrong */ |
| 1375 | 2307 | printf("\n"); |
| r2844 | r2845 | |
| 1383 | 2315 | } |
| 1384 | 2316 | return errend != errorbuf; |
| 1385 | 2317 | } |
| 2318 | ||
| 2319 | #endif |
| r2844 | r2845 | |
|---|---|---|
| 75 | 75 | #define OPFLAG_CAN_CHANGE_MODES 0x00080000 /* instruction can change modes */ |
| 76 | 76 | |
| 77 | 77 | /* execution semantics */ |
| 78 | #define OPFLAG_READS_MEMORY 0x00080000 /* instruction reads memory */ | |
| 79 | #define OPFLAG_WRITES_MEMORY 0x00100000 /* instruction writes memory */ | |
| 78 | #define OPFLAG_READS_MEMORY 0x00100000 /* instruction reads memory */ | |
| 79 | #define OPFLAG_WRITES_MEMORY 0x00200000 /* instruction writes memory */ | |
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | |
| r2844 | r2845 | |
| 88 | 88 | typedef struct _drcfe_state drcfe_state; |
| 89 | 89 | |
| 90 | 90 | |
| 91 | /* register information as bitmasks */ | |
| 92 | typedef struct _drc_reginfo drc_reginfo; | |
| 93 | struct _drc_reginfo | |
| 94 | { | |
| 95 | UINT64 used; /* bitmask of used registers */ | |
| 96 | UINT64 modified; /* bitmask of modified registers */ | |
| 97 | UINT64 constant; /* bitmask of constant registers */ | |
| 98 | UINT64 liveread; /* bitmask of registers that are live for reading */ | |
| 99 | UINT64 livewrite; /* bitmask of registers that are live for writing */ | |
| 100 | }; | |
| 101 | ||
| 102 | ||
| 103 | 91 | /* description of a given opcode */ |
| 104 | 92 | typedef struct _opcode_desc opcode_desc; |
| 105 | 93 | struct _opcode_desc |
| 106 | 94 | { |
| 107 | 95 | /* links to other descriptions */ |
| 108 | 96 | opcode_desc * next; /* pointer to next description */ |
| 97 | opcode_desc * prev; /* pointer to previous description */ | |
| 109 | 98 | opcode_desc * branch; /* pointer back to branch description for delay slots */ |
| 110 | 99 | opcode_desc * delay; /* pointer to delay slot description */ |
| 111 | 100 | |
| r2844 | r2845 | |
| 132 | 121 | UINT32 cycles; /* number of cycles needed to execute */ |
| 133 | 122 | |
| 134 | 123 | /* register usage information */ |
| 135 | drc_reginfo gpr; /* register info for GPRs */ | |
| 136 | drc_reginfo fpr; /* register info for FPRs */ | |
| 124 | UINT32 regin[4]; /* input registers */ | |
| 125 | UINT32 regout[4]; /* output registers */ | |
| 126 | UINT32 regreq[4]; /* required output registers */ | |
| 137 | 127 | }; |
| 138 | 128 | |
| 139 | 129 |
| r2844 | r2845 | |
|---|---|---|
| 314 | 314 | 8, 8, 8, 8, 12, 16, 8, 8, 8, 8, 8, 8, 12, 16, 8, 8, |
| 315 | 315 | 8, 8, 8, 8, 12, 16, 8, 8, 8, 8, 8, 8, 12, 16, 8, 8, |
| 316 | 316 | 8, 8, 8, 8, 12, 16, 8, 8, 8, 8, 8, 8, 12, 16, 8, 8, |
| 317 | ||
| 317 | ||
| 318 | 318 | 4, 4, 4, 4, 12, 8, 8, 8, 4, 4, 4, 4, 12, 8, 8, 8, |
| 319 | 319 | 4, 4, 4, 4, 12, 8, 8, 8, 4, 4, 4, 4, 12, 8, 8, 8, |
| 320 | 320 | 8, 8, 8, 8, 16, 12, 12, 12, 8, 8, 8, 8, 16, 12, 12, 12, |
| r2844 | r2845 | |
|---|---|---|
| 193 | 193 | DRCUML_OP_MAPVAR, /* MAPVAR mapvar,value */ |
| 194 | 194 | |
| 195 | 195 | /* Control Flow Operations */ |
| 196 | DRCUML_OP_NOP, /* NOP */ | |
| 196 | 197 | DRCUML_OP_DEBUG, /* DEBUG pc */ |
| 197 | 198 | DRCUML_OP_EXIT, /* EXIT src1[,c] */ |
| 198 | 199 | DRCUML_OP_HASHJMP, /* HASHJMP mode,pc,handle */ |
| r2844 | r2845 | |
| 303 | 304 | typedef struct _drcuml_parameter drcuml_parameter; |
| 304 | 305 | struct _drcuml_parameter |
| 305 | 306 | { |
| 306 | drcuml_ptype type; /* parameter type */ | |
| 307 | drcuml_pvalue value; /* parameter value */ | |
| 307 | drcuml_ptype type; /* parameter type */ | |
| 308 | drcuml_pvalue value; /* parameter value */ | |
| 308 | 309 | }; |
| 309 | 310 | |
| 310 | 311 | |
| r2844 | r2845 | |
| 312 | 313 | typedef struct _drcuml_instruction drcuml_instruction; |
| 313 | 314 | struct _drcuml_instruction |
| 314 | 315 | { |
| 315 | drcuml_opcode opcode; /* opcode */ | |
| 316 | UINT8 condflags; /* condition or flags */ | |
| 317 | UINT8 size; /* operation size */ | |
| 318 | UINT8 numparams; /* number of parameters */ | |
| 319 | drcuml_parameter param[4]; /* up to 4 parameters */ | |
| 316 | drcuml_opcode opcode; /* opcode */ | |
| 317 | UINT8 condition; /* condition */ | |
| 318 | UINT8 flags; /* flags */ | |
| 319 | UINT8 size; /* operation size */ | |
| 320 | UINT8 numparams; /* number of parameters */ | |
| 321 | drcuml_parameter param[4]; /* up to 4 parameters */ | |
| 320 | 322 | }; |
| 321 | 323 | |
| 322 | 324 | |
| 325 | /* structure describing rules for parameter encoding */ | |
| 326 | typedef struct _drcuml_parameter_info drcuml_parameter_info; | |
| 327 | struct _drcuml_parameter_info | |
| 328 | { | |
| 329 | UINT8 output; /* input or output? */ | |
| 330 | UINT8 size; /* size of the parameter */ | |
| 331 | UINT16 typemask; /* types allowed */ | |
| 332 | }; | |
| 333 | ||
| 334 | ||
| 335 | /* structure describing rules for opcode encoding */ | |
| 336 | typedef struct _drcuml_opcode_info drcuml_opcode_info; | |
| 337 | struct _drcuml_opcode_info | |
| 338 | { | |
| 339 | drcuml_opcode opcode; /* the opcode itself */ | |
| 340 | const char * mnemonic; /* mnemonic string */ | |
| 341 | UINT8 sizes; /* allowed sizes */ | |
| 342 | UINT8 condition; /* conditions allowed? */ | |
| 343 | UINT8 inflags; /* input flags */ | |
| 344 | UINT8 outflags; /* output flags */ | |
| 345 | UINT8 modflags; /* modified flags */ | |
| 346 | drcuml_parameter_info param[4]; /* information about parameters */ | |
| 347 | }; | |
| 348 | ||
| 349 | ||
| 323 | 350 | /* an integer register, with low/high parts */ |
| 324 | 351 | typedef union _drcuml_ireg drcuml_ireg; |
| 325 | 352 | union _drcuml_ireg |
| 326 | 353 | { |
| 327 | 354 | #ifdef LSB_FIRST |
| 328 | struct { UINT32 l,h; } w; /* 32-bit low, high parts of the register */ | |
| 355 | struct { UINT32 l,h; } w; /* 32-bit low, high parts of the register */ | |
| 329 | 356 | #else |
| 330 | struct { UINT32 h,l; } w; /* 32-bit low, high parts of the register */ | |
| 357 | struct { UINT32 h,l; } w; /* 32-bit low, high parts of the register */ | |
| 331 | 358 | #endif |
| 332 | UINT64 d; /* 64-bit full register */ | |
| 359 | UINT64 d; /* 64-bit full register */ | |
| 333 | 360 | }; |
| 334 | 361 | |
| 335 | 362 | |
| r2844 | r2845 | |
| 338 | 365 | union _drcuml_freg |
| 339 | 366 | { |
| 340 | 367 | #ifdef LSB_FIRST |
| 341 | struct { float l,h; } s; /* 32-bit low, high parts of the register */ | |
| 368 | struct { float l,h; } s; /* 32-bit low, high parts of the register */ | |
| 342 | 369 | #else |
| 343 | struct { float h,l; } s; /* 32-bit low, high parts of the register */ | |
| 370 | struct { float h,l; } s; /* 32-bit low, high parts of the register */ | |
| 344 | 371 | #endif |
| 345 | double d; /* 64-bit full register */ | |
| 372 | double d; /* 64-bit full register */ | |
| 346 | 373 | }; |
| 347 | 374 | |
| 348 | 375 | |
| r2844 | r2845 | |
| 350 | 377 | typedef struct _drcuml_machine_state drcuml_machine_state; |
| 351 | 378 | struct _drcuml_machine_state |
| 352 | 379 | { |
| 353 | drcuml_ireg r[DRCUML_REG_I_END - DRCUML_REG_I0]; /* integer registers */ | |
| 354 | drcuml_freg f[DRCUML_REG_F_END - DRCUML_REG_F0]; /* floating-point registers */ | |
| 355 | UINT32 exp; /* exception parameter register */ | |
| 356 | UINT8 fmod; /* fmod (floating-point mode) register */ | |
| 357 | UINT8 flags; /* flags state */ | |
| 380 | drcuml_ireg r[DRCUML_REG_I_END - DRCUML_REG_I0]; /* integer registers */ | |
| 381 | drcuml_freg f[DRCUML_REG_F_END - DRCUML_REG_F0]; /* floating-point registers */ | |
| 382 | UINT32 exp; /* exception parameter register */ | |
| 383 | UINT8 fmod; /* fmod (floating-point mode) register */ | |
| 384 | UINT8 flags; /* flags state */ | |
| 358 | 385 | }; |
| 359 | 386 | |
| 360 | 387 | |
| r2844 | r2845 | |
| 362 | 389 | typedef struct _drcbe_info drcbe_info; |
| 363 | 390 | struct _drcbe_info |
| 364 | 391 | { |
| 365 | UINT8 direct_iregs; /* number of direct-mapped integer registers */ | |
| 366 | UINT8 direct_fregs; /* number of direct-mapped floating point registers */ | |
| 392 | UINT8 direct_iregs; /* number of direct-mapped integer registers */ | |
| 393 | UINT8 direct_fregs; /* number of direct-mapped floating point registers */ | |
| 367 | 394 | }; |
| 368 | 395 | |
| 369 | 396 | |
| r2844 | r2845 | |
| 418 | 445 | drcuml_block *drcuml_block_begin(drcuml_state *drcuml, UINT32 maxinst, jmp_buf *errorbuf); |
| 419 | 446 | |
| 420 | 447 | /* append an opcode to the block, with 0-4 parameters */ |
| 421 | void drcuml_block_append_0(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condflags); | |
| 422 | void drcuml_block_append_1(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condflags, drcuml_ptype p0type, drcuml_pvalue p0value); | |
| 423 | void drcuml_block_append_2(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condflags, drcuml_ptype p0type, drcuml_pvalue p0value, drcuml_ptype p1type, drcuml_pvalue p1value); | |
| 424 | void drcuml_block_append_3(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condflags, drcuml_ptype p0type, drcuml_pvalue p0value, drcuml_ptype p1type, drcuml_pvalue p1value, drcuml_ptype p2type, drcuml_pvalue p2value); | |
| 425 | void drcuml_block_append_4(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condflags, drcuml_ptype p0type, drcuml_pvalue p0value, drcuml_ptype p1type, drcuml_pvalue p1value, drcuml_ptype p2type, drcuml_pvalue p2value, drcuml_ptype p3type, drcuml_pvalue p3value); | |
| 448 | void drcuml_block_append_0(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condition); | |
| 449 | void drcuml_block_append_1(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condition, drcuml_ptype p0type, drcuml_pvalue p0value); | |
| 450 | void drcuml_block_append_2(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condition, drcuml_ptype p0type, drcuml_pvalue p0value, drcuml_ptype p1type, drcuml_pvalue p1value); | |
| 451 | void drcuml_block_append_3(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condition, drcuml_ptype p0type, drcuml_pvalue p0value, drcuml_ptype p1type, drcuml_pvalue p1value, drcuml_ptype p2type, drcuml_pvalue p2value); | |
| 452 | void drcuml_block_append_4(drcuml_block *block, drcuml_opcode op, UINT8 size, UINT8 condition, drcuml_ptype p0type, drcuml_pvalue p0value, drcuml_ptype p1type, drcuml_pvalue p1value, drcuml_ptype p2type, drcuml_pvalue p2value, drcuml_ptype p3type, drcuml_pvalue p3value); | |
| 426 | 453 | |
| 427 | 454 | /* complete a code block and commit it to the cache via the back-end */ |
| 428 | 455 | void drcuml_block_end(drcuml_block *block); |
| r2844 | r2845 | |
| 464 | 491 | /* ----- code logging ----- */ |
| 465 | 492 | |
| 466 | 493 | /* directly printf to the UML log if generated */ |
| 467 | void drcuml_log_printf(drcuml_state * | |
| 494 | void drcuml_log_printf(drcuml_state *drcuml, const char *format, ...) ATTR_PRINTF(2,3); | |
| 468 | 495 | |
| 496 | /* add a symbol to the internal symbol table */ | |
| 497 | void drcuml_symbol_add(drcuml_state *drcuml, void *base, UINT32 length, const char *name); | |
| 498 | ||
| 499 | /* look up a symbol from the internal symbol table or return NULL if not found */ | |
| 500 | const char *drcuml_symbol_find(drcuml_state *drcuml, void *base, UINT32 *offset); | |
| 501 | ||
| 469 | 502 | /* attach a comment to the current output location in the specified block */ |
| 470 | 503 | void drcuml_add_comment(drcuml_block *block, const char *format, ...) ATTR_PRINTF(2,3); |
| 471 | 504 | |
| 505 | /* disassemble a UML instruction to the given buffer */ | |
| 506 | void drcuml_disasm(const drcuml_instruction *inst, char *buffer, drcuml_state *state); | |
| 472 | 507 | |
| 508 | ||
| 473 | 509 | #endif |
| r2844 | r2845 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | * Convert AND 0xff/0xffff to movzx |
| 22 | 22 | |
| 23 | * Convert SUB a,0,b to NEG | |
| 24 | ||
| 25 | * Optimize, e.g., and [r5],i0,$FF to use rbx as temporary register | |
| 26 | (avoid initial move) if i0 is not needed going forward | |
| 27 | ||
| 23 | 28 | **************************************************************************** |
| 24 | 29 | |
| 25 | 30 | ------------------------- |
| r2844 | r2845 | |
| 166 | 171 | ***************************************************************************/ |
| 167 | 172 | |
| 168 | 173 | #include "drcuml.h" |
| 169 | #include "drcumld.h" | |
| 170 | 174 | #include "drcbeut.h" |
| 171 | 175 | #include "debugger.h" |
| 172 | 176 | #include "x86emit.h" |
| r2844 | r2845 | |
| 222 | 226 | MACROS |
| 223 | 227 | ***************************************************************************/ |
| 224 | 228 | |
| 225 | #define X86_CONDITION(condflags) (condition_map[condflags - DRCUML_COND_Z]) | |
| 226 | #define X86_NOT_CONDITION(condflags) (condition_map[condflags - DRCUML_COND_Z] ^ 1) | |
| 229 | #define X86_CONDITION(condition) (condition_map[condition - DRCUML_COND_Z]) | |
| 230 | #define X86_NOT_CONDITION(condition) (condition_map[condition - DRCUML_COND_Z] ^ 1) | |
| 227 | 231 | |
| 228 | 232 | #undef MABS |
| 229 | 233 | #define MABS(drcbe, ptr) MBD(REG_RBP, offset_from_rbp(drcbe, (FPTR)(ptr))) |
| 230 | 234 | |
| 235 | #define assert_no_condition(inst) assert((inst)->condition == DRCUML_COND_ALWAYS) | |
| 236 | #define assert_any_condition(inst) assert((inst)->condition == DRCUML_COND_ALWAYS || ((inst)->condition >= DRCUML_COND_Z && (inst)->condition < DRCUML_COND_MAX)) | |
| 237 | #define assert_no_flags(inst) assert((inst)->flags == 0) | |
| 238 | #define assert_flags(inst, valid) assert(((inst)->flags & ~(valid)) == 0) | |
| 231 | 239 | |
| 232 | 240 | |
| 241 | ||
| 233 | 242 | /*************************************************************************** |
| 234 | 243 | TYPE DEFINITIONS |
| 235 | 244 | ***************************************************************************/ |
| r2844 | r2845 | |
| 385 | 394 | static x86code *op_comment(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); |
| 386 | 395 | static x86code *op_mapvar(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); |
| 387 | 396 | |
| 397 | static x86code *op_nop(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); | |
| 388 | 398 | static x86code *op_debug(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); |
| 389 | 399 | static x86code *op_exit(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); |
| 390 | 400 | static x86code *op_hashjmp(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); |
| r2844 | r2845 | |
| 468 | 478 | { DRCUML_OP_MAPVAR, op_mapvar }, /* MAPVAR mapvar,value */ |
| 469 | 479 | |
| 470 | 480 | /* Control Flow Operations */ |
| 481 | { DRCUML_OP_NOP, op_nop }, /* NOP */ | |
| 471 | 482 | { DRCUML_OP_DEBUG, op_debug }, /* DEBUG pc */ |
| 472 | 483 | { DRCUML_OP_EXIT, op_exit }, /* EXIT src1[,c] */ |
| 473 | 484 | { DRCUML_OP_HASHJMP, op_hashjmp }, /* HASHJMP mode,pc,handle */ |
| r2844 | r2845 | |
| 907 | 918 | /* add a comment */ |
| 908 | 919 | if (drcbe->log != NULL) |
| 909 | 920 | { |
| 910 | char dasm[100]; | |
| 911 | drcuml_disasm(inst, dasm); | |
| 921 | char dasm[256]; | |
| 922 | drcuml_disasm(inst, dasm, drcbe->drcuml); | |
| 912 | 923 | x86log_add_comment(drcbe->log, dst, "%s", dasm); |
| 913 | 924 | } |
| 914 | 925 | |
| r2844 | r2845 | |
| 993 | 1004 | dest->value = src->value; |
| 994 | 1005 | break; |
| 995 | 1006 | |
| 996 | /* mapvars are converted to immediates with their current value */ | |
| 997 | case DRCUML_PTYPE_MAPVAR: | |
| 998 | assert(allowed & PTYPE_I); | |
| 999 | dest->type = DRCUML_PTYPE_IMMEDIATE; | |
| 1000 | dest->value = drcmap_get_last_value(drcbe->map, src->value); | |
| 1001 | break; | |
| 1002 | ||
| 1003 | 1007 | /* memory passes through */ |
| 1004 | 1008 | case DRCUML_PTYPE_MEMORY: |
| 1005 | 1009 | assert(allowed & PTYPE_M); |
| r2844 | r2845 | |
| 1236 | 1240 | |
| 1237 | 1241 | |
| 1238 | 1242 | /*------------------------------------------------- |
| 1243 | emit_mov_r32_p32_keepflags - move a 32-bit | |
| 1244 | parameter into a register without affecting | |
| 1245 | any flags | |
| 1246 | -------------------------------------------------*/ | |
| 1247 | ||
| 1248 | static void emit_mov_r32_p32_keepflags(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param) | |
| 1249 | { | |
| 1250 | if (param->type == DRCUML_PTYPE_IMMEDIATE) | |
| 1251 | emit_mov_r32_imm(dst, reg, param->value); // mov reg,param | |
| 1252 | else if (param->type == DRCUML_PTYPE_MEMORY) | |
| 1253 | emit_mov_r32_m32(dst, reg, MABS(drcbe, param->value)); // mov reg,[param] | |
| 1254 | else if (param->type == DRCUML_PTYPE_INT_REGISTER) | |
| 1255 | { | |
| 1256 | if (reg != param->value) | |
| 1257 | emit_mov_r32_r32(dst, reg, param->value); // mov reg,param | |
| 1258 | } | |
| 1259 | } | |
| 1260 | ||
| 1261 | ||
| 1262 | /*------------------------------------------------- | |
| 1239 | 1263 | emit_mov_m32_p32 - move a 32-bit parameter |
| 1240 | 1264 | into a memory location |
| 1241 | 1265 | -------------------------------------------------*/ |
| r2844 | r2845 | |
| 1281 | 1305 | { |
| 1282 | 1306 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1283 | 1307 | { |
| 1284 | if (inst-> | |
| 1308 | if (inst-> | |
| 1285 | 1309 | emit_add_r32_imm(dst, reg, param->value); // add reg,param |
| 1286 | 1310 | } |
| 1287 | 1311 | else if (param->type == DRCUML_PTYPE_MEMORY) |
| r2844 | r2845 | |
| 1300 | 1324 | { |
| 1301 | 1325 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1302 | 1326 | { |
| 1303 | if (inst-> | |
| 1327 | if (inst-> | |
| 1304 | 1328 | emit_add_m32_imm(dst, MEMPARAMS, param->value); // add [dest],param |
| 1305 | 1329 | } |
| 1306 | 1330 | else |
| r2844 | r2845 | |
| 1320 | 1344 | static void emit_adc_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1321 | 1345 | { |
| 1322 | 1346 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1323 | { | |
| 1324 | if (inst->condflags != 0 || param->value != 0) | |
| 1325 | emit_adc_r32_imm(dst, reg, param->value); // adc reg,param | |
| 1326 | } | |
| 1347 | emit_adc_r32_imm(dst, reg, param->value); // adc reg,param | |
| 1327 | 1348 | else if (param->type == DRCUML_PTYPE_MEMORY) |
| 1328 | 1349 | emit_adc_r32_m32(dst, reg, MABS(drcbe, param->value)); // adc reg,[param] |
| 1329 | 1350 | else if (param->type == DRCUML_PTYPE_INT_REGISTER) |
| r2844 | r2845 | |
| 1339 | 1360 | static void emit_adc_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1340 | 1361 | { |
| 1341 | 1362 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1342 | { | |
| 1343 | if (inst->condflags != 0 || param->value != 0) | |
| 1344 | emit_adc_m32_imm(dst, MEMPARAMS, param->value); // adc [dest],param | |
| 1345 | } | |
| 1363 | emit_adc_m32_imm(dst, MEMPARAMS, param->value); // adc [dest],param | |
| 1346 | 1364 | else |
| 1347 | 1365 | { |
| 1348 | 1366 | int reg = param_select_register(REG_EAX, param, NULL); |
| 1349 | emit_mov_r32_p32(drcbe, dst, reg, param); | |
| 1367 | emit_mov_r32_p32_keepflags(drcbe, dst, reg, param); | |
| 1350 | 1368 | emit_adc_m32_r32(dst, MEMPARAMS, reg); // adc [dest],reg |
| 1351 | 1369 | } |
| 1352 | 1370 | } |
| r2844 | r2845 | |
| 1361 | 1379 | { |
| 1362 | 1380 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1363 | 1381 | { |
| 1364 | if (inst-> | |
| 1382 | if (inst-> | |
| 1365 | 1383 | emit_sub_r32_imm(dst, reg, param->value); // sub reg,param |
| 1366 | 1384 | } |
| 1367 | 1385 | else if (param->type == DRCUML_PTYPE_MEMORY) |
| r2844 | r2845 | |
| 1380 | 1398 | { |
| 1381 | 1399 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1382 | 1400 | { |
| 1383 | if (inst-> | |
| 1401 | if (inst-> | |
| 1384 | 1402 | emit_sub_m32_imm(dst, MEMPARAMS, param->value); // sub [dest],param |
| 1385 | 1403 | } |
| 1386 | 1404 | else |
| r2844 | r2845 | |
| 1400 | 1418 | static void emit_sbb_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1401 | 1419 | { |
| 1402 | 1420 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1403 | { | |
| 1404 | if (inst->condflags != 0 || param->value != 0) | |
| 1405 | emit_sbb_r32_imm(dst, reg, param->value); // sbb reg,param | |
| 1406 | } | |
| 1421 | emit_sbb_r32_imm(dst, reg, param->value); // sbb reg,param | |
| 1407 | 1422 | else if (param->type == DRCUML_PTYPE_MEMORY) |
| 1408 | 1423 | emit_sbb_r32_m32(dst, reg, MABS(drcbe, param->value)); // sbb reg,[param] |
| 1409 | 1424 | else if (param->type == DRCUML_PTYPE_INT_REGISTER) |
| r2844 | r2845 | |
| 1419 | 1434 | static void emit_sbb_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1420 | 1435 | { |
| 1421 | 1436 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1422 | { | |
| 1423 | if (inst->condflags != 0 || param->value != 0) | |
| 1424 | emit_sbb_m32_imm(dst, MEMPARAMS, param->value); // sbb [dest],param | |
| 1425 | } | |
| 1437 | emit_sbb_m32_imm(dst, MEMPARAMS, param->value); // sbb [dest],param | |
| 1426 | 1438 | else |
| 1427 | 1439 | { |
| 1428 | 1440 | int reg = param_select_register(REG_EAX, param, NULL); |
| 1429 | emit_mov_r32_p32(drcbe, dst, reg, param); | |
| 1441 | emit_mov_r32_p32_keepflags(drcbe, dst, reg, param); | |
| 1430 | 1442 | emit_sbb_m32_r32(dst, MEMPARAMS, reg); // sbb [dest],reg |
| 1431 | 1443 | } |
| 1432 | 1444 | } |
| r2844 | r2845 | |
| 1475 | 1487 | { |
| 1476 | 1488 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1477 | 1489 | { |
| 1478 | if (inst-> | |
| 1490 | if (inst-> | |
| 1479 | 1491 | /* skip */; |
| 1480 | else if (inst-> | |
| 1492 | else if (inst-> | |
| 1481 | 1493 | emit_xor_r32_r32(dst, reg, reg); // xor reg,reg |
| 1482 | 1494 | else |
| 1483 | 1495 | emit_and_r32_imm(dst, reg, param->value); // and reg,param |
| r2844 | r2845 | |
| 1498 | 1510 | { |
| 1499 | 1511 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1500 | 1512 | { |
| 1501 | if (inst-> | |
| 1513 | if (inst-> | |
| 1502 | 1514 | /* skip */; |
| 1503 | else if (inst-> | |
| 1515 | else if (inst-> | |
| 1504 | 1516 | emit_mov_m32_imm(dst, MEMPARAMS, 0); // mov [dest],0 |
| 1505 | 1517 | else |
| 1506 | 1518 | emit_and_m32_imm(dst, MEMPARAMS, param->value); // and [dest],param |
| r2844 | r2845 | |
| 1558 | 1570 | { |
| 1559 | 1571 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1560 | 1572 | { |
| 1561 | if (inst-> | |
| 1573 | if (inst-> | |
| 1562 | 1574 | /* skip */; |
| 1563 | else if (inst-> | |
| 1575 | else if (inst-> | |
| 1564 | 1576 | emit_mov_r32_imm(dst, reg, -1); // mov reg,-1 |
| 1565 | 1577 | else |
| 1566 | 1578 | emit_or_r32_imm(dst, reg, param->value); // or reg,param |
| r2844 | r2845 | |
| 1581 | 1593 | { |
| 1582 | 1594 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1583 | 1595 | { |
| 1584 | if (inst-> | |
| 1596 | if (inst-> | |
| 1585 | 1597 | /* skip */; |
| 1586 | else if (inst-> | |
| 1598 | else if (inst-> | |
| 1587 | 1599 | emit_mov_m32_imm(dst, MEMPARAMS, -1); // mov [dest],-1 |
| 1588 | 1600 | else |
| 1589 | 1601 | emit_or_m32_imm(dst, MEMPARAMS, param->value); // or [dest],param |
| r2844 | r2845 | |
| 1606 | 1618 | { |
| 1607 | 1619 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1608 | 1620 | { |
| 1609 | if (inst-> | |
| 1621 | if (inst-> | |
| 1610 | 1622 | /* skip */; |
| 1611 | else if (inst-> | |
| 1623 | else if (inst-> | |
| 1612 | 1624 | emit_not_r32(dst, reg); // not reg |
| 1613 | 1625 | else |
| 1614 | 1626 | emit_xor_r32_imm(dst, reg, param->value); // xor reg,param |
| r2844 | r2845 | |
| 1629 | 1641 | { |
| 1630 | 1642 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1631 | 1643 | { |
| 1632 | if (inst-> | |
| 1644 | if (inst-> | |
| 1633 | 1645 | /* skip */; |
| 1634 | else if (inst-> | |
| 1646 | else if (inst-> | |
| 1635 | 1647 | emit_not_m32(dst, MEMPARAMS); // not [dest] |
| 1636 | 1648 | else |
| 1637 | 1649 | emit_xor_m32_imm(dst, MEMPARAMS, param->value); // xor [dest],param |
| r2844 | r2845 | |
| 1654 | 1666 | { |
| 1655 | 1667 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1656 | 1668 | { |
| 1657 | if (inst-> | |
| 1669 | if (inst-> | |
| 1658 | 1670 | /* skip */; |
| 1659 | 1671 | else |
| 1660 | 1672 | emit_shl_r32_imm(dst, reg, param->value); // shl reg,param |
| r2844 | r2845 | |
| 1676 | 1688 | { |
| 1677 | 1689 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1678 | 1690 | { |
| 1679 | if (inst-> | |
| 1691 | if (inst-> | |
| 1680 | 1692 | /* skip */; |
| 1681 | 1693 | else |
| 1682 | 1694 | emit_shl_m32_imm(dst, MEMPARAMS, param->value); // shl [dest],param |
| r2844 | r2845 | |
| 1698 | 1710 | { |
| 1699 | 1711 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1700 | 1712 | { |
| 1701 | if (inst-> | |
| 1713 | if (inst-> | |
| 1702 | 1714 | /* skip */; |
| 1703 | 1715 | else |
| 1704 | 1716 | emit_shr_r32_imm(dst, reg, param->value); // shr reg,param |
| r2844 | r2845 | |
| 1720 | 1732 | { |
| 1721 | 1733 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1722 | 1734 | { |
| 1723 | if (inst-> | |
| 1735 | if (inst-> | |
| 1724 | 1736 | /* skip */; |
| 1725 | 1737 | else |
| 1726 | 1738 | emit_shr_m32_imm(dst, MEMPARAMS, param->value); // shr [dest],param |
| r2844 | r2845 | |
| 1742 | 1754 | { |
| 1743 | 1755 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1744 | 1756 | { |
| 1745 | if (inst-> | |
| 1757 | if (inst-> | |
| 1746 | 1758 | /* skip */; |
| 1747 | 1759 | else |
| 1748 | 1760 | emit_sar_r32_imm(dst, reg, param->value); // sar reg,param |
| r2844 | r2845 | |
| 1764 | 1776 | { |
| 1765 | 1777 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1766 | 1778 | { |
| 1767 | if (inst-> | |
| 1779 | if (inst-> | |
| 1768 | 1780 | /* skip */; |
| 1769 | 1781 | else |
| 1770 | 1782 | emit_sar_m32_imm(dst, MEMPARAMS, param->value); // sar [dest],param |
| r2844 | r2845 | |
| 1786 | 1798 | { |
| 1787 | 1799 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1788 | 1800 | { |
| 1789 | if (inst-> | |
| 1801 | if (inst-> | |
| 1790 | 1802 | /* skip */; |
| 1791 | 1803 | else |
| 1792 | 1804 | emit_rol_r32_imm(dst, reg, param->value); // rol reg,param |
| r2844 | r2845 | |
| 1808 | 1820 | { |
| 1809 | 1821 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1810 | 1822 | { |
| 1811 | if (inst-> | |
| 1823 | if (inst-> | |
| 1812 | 1824 | /* skip */; |
| 1813 | 1825 | else |
| 1814 | 1826 | emit_rol_m32_imm(dst, MEMPARAMS, param->value); // rol [dest],param |
| r2844 | r2845 | |
| 1830 | 1842 | { |
| 1831 | 1843 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1832 | 1844 | { |
| 1833 | if (inst-> | |
| 1845 | if (inst-> | |
| 1834 | 1846 | /* skip */; |
| 1835 | 1847 | else |
| 1836 | 1848 | emit_ror_r32_imm(dst, reg, param->value); // ror reg,param |
| r2844 | r2845 | |
| 1852 | 1864 | { |
| 1853 | 1865 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1854 | 1866 | { |
| 1855 | if (inst-> | |
| 1867 | if (inst-> | |
| 1856 | 1868 | /* skip */; |
| 1857 | 1869 | else |
| 1858 | 1870 | emit_ror_m32_imm(dst, MEMPARAMS, param->value); // ror [dest],param |
| r2844 | r2845 | |
| 1874 | 1886 | { |
| 1875 | 1887 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1876 | 1888 | { |
| 1877 | if (inst-> | |
| 1889 | if (inst-> | |
| 1878 | 1890 | /* skip */; |
| 1879 | 1891 | else |
| 1880 | 1892 | emit_rcl_r32_imm(dst, reg, param->value); // rcl reg,param |
| 1881 | 1893 | } |
| 1882 | 1894 | else |
| 1883 | 1895 | { |
| 1884 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); | |
| 1896 | emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); | |
| 1885 | 1897 | emit_rcl_r32_cl(dst, reg); // rcl reg,cl |
| 1886 | 1898 | } |
| 1887 | 1899 | } |
| r2844 | r2845 | |
| 1896 | 1908 | { |
| 1897 | 1909 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1898 | 1910 | { |
| 1899 | if (inst-> | |
| 1911 | if (inst-> | |
| 1900 | 1912 | /* skip */; |
| 1901 | 1913 | else |
| 1902 | 1914 | emit_rcl_m32_imm(dst, MEMPARAMS, param->value); // rcl [dest],param |
| 1903 | 1915 | } |
| 1904 | 1916 | else |
| 1905 | 1917 | { |
| 1906 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); | |
| 1918 | emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); | |
| 1907 | 1919 | emit_rcl_m32_cl(dst, MEMPARAMS); // rcl [dest],cl |
| 1908 | 1920 | } |
| 1909 | 1921 | } |
| r2844 | r2845 | |
| 1918 | 1930 | { |
| 1919 | 1931 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1920 | 1932 | { |
| 1921 | if (inst-> | |
| 1933 | if (inst-> | |
| 1922 | 1934 | /* skip */; |
| 1923 | 1935 | else |
| 1924 | 1936 | emit_rcr_r32_imm(dst, reg, param->value); // rcr reg,param |
| 1925 | 1937 | } |
| 1926 | 1938 | else |
| 1927 | 1939 | { |
| 1928 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); | |
| 1940 | emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); | |
| 1929 | 1941 | emit_rcr_r32_cl(dst, reg); // rcr reg,cl |
| 1930 | 1942 | } |
| 1931 | 1943 | } |
| r2844 | r2845 | |
| 1940 | 1952 | { |
| 1941 | 1953 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1942 | 1954 | { |
| 1943 | if (inst-> | |
| 1955 | if (inst-> | |
| 1944 | 1956 | /* skip */; |
| 1945 | 1957 | else |
| 1946 | 1958 | emit_rcr_m32_imm(dst, MEMPARAMS, param->value); // rcr [dest],param |
| 1947 | 1959 | } |
| 1948 | 1960 | else |
| 1949 | 1961 | { |
| 1950 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); | |
| 1962 | emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); | |
| 1951 | 1963 | emit_rcr_m32_cl(dst, MEMPARAMS); // rcr [dest],cl |
| 1952 | 1964 | } |
| 1953 | 1965 | } |
| r2844 | r2845 | |
| 1983 | 1995 | |
| 1984 | 1996 | |
| 1985 | 1997 | /*------------------------------------------------- |
| 1998 | emit_mov_r64_p64_keepflags - move a 64-bit | |
| 1999 | parameter into a register without affecting | |
| 2000 | any flags | |
| 2001 | -------------------------------------------------*/ | |
| 2002 | ||
| 2003 | static void emit_mov_r64_p64_keepflags(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param) | |
| 2004 | { | |
| 2005 | if (param->type == DRCUML_PTYPE_IMMEDIATE) | |
| 2006 | emit_mov_r64_imm(dst, reg, param->value); // mov reg,param | |
| 2007 | else if (param->type == DRCUML_PTYPE_MEMORY) | |
| 2008 | emit_mov_r64_m64(dst, reg, MABS(drcbe, param->value)); // mov reg,[param] | |
| 2009 | else if (param->type == DRCUML_PTYPE_INT_REGISTER) | |
| 2010 | { | |
| 2011 | if (reg != param->value) | |
| 2012 | emit_mov_r64_r64(dst, reg, param->value); // mov reg,param | |
| 2013 | } | |
| 2014 | } | |
| 2015 | ||
| 2016 | ||
| 2017 | /*------------------------------------------------- | |
| 1986 | 2018 | emit_mov_p64_r64 - move a registers into a |
| 1987 | 2019 | 64-bit parameter |
| 1988 | 2020 | -------------------------------------------------*/ |
| r2844 | r2845 | |
| 2009 | 2041 | { |
| 2010 | 2042 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2011 | 2043 | { |
| 2012 | if (inst-> | |
| 2044 | if (inst-> | |
| 2013 | 2045 | { |
| 2014 | 2046 | if (short_immediate(param->value)) |
| 2015 | 2047 | emit_add_r64_imm(dst, reg, param->value); // add reg,param |
| r2844 | r2845 | |
| 2036 | 2068 | { |
| 2037 | 2069 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2038 | 2070 | { |
| 2039 | if (inst-> | |
| 2071 | if (inst-> | |
| 2040 | 2072 | { |
| 2041 | 2073 | if (short_immediate(param->value)) |
| 2042 | 2074 | emit_add_m64_imm(dst, MEMPARAMS, param->value); // add [mem],param |
| r2844 | r2845 | |
| 2092 | 2124 | else |
| 2093 | 2125 | { |
| 2094 | 2126 | int reg = param_select_register(REG_EAX, param, NULL); |
| 2095 | emit_mov_r64_p64(drcbe, dst, reg, param); | |
| 2127 | emit_mov_r64_p64_keepflags(drcbe, dst, reg, param); | |
| 2096 | 2128 | emit_adc_m64_r64(dst, MEMPARAMS, reg); // adc [dest],reg |
| 2097 | 2129 | } |
| 2098 | 2130 | } |
| r2844 | r2845 | |
| 2107 | 2139 | { |
| 2108 | 2140 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2109 | 2141 | { |
| 2110 | if (inst-> | |
| 2142 | if (inst-> | |
| 2111 | 2143 | { |
| 2112 | 2144 | if (short_immediate(param->value)) |
| 2113 | 2145 | emit_sub_r64_imm(dst, reg, param->value); // sub reg,param |
| r2844 | r2845 | |
| 2134 | 2166 | { |
| 2135 | 2167 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2136 | 2168 | { |
| 2137 | if (inst-> | |
| 2169 | if (inst-> | |
| 2138 | 2170 | { |
| 2139 | 2171 | if (short_immediate(param->value)) |
| 2140 | 2172 | emit_sub_m64_imm(dst, MEMPARAMS, param->value); // sub [mem],param |
| r2844 | r2845 | |
| 2190 | 2222 | else |
| 2191 | 2223 | { |
| 2192 | 2224 | int reg = param_select_register(REG_EAX, param, NULL); |
| 2193 | emit_mov_r64_p64(drcbe, dst, reg, param); | |
| 2225 | emit_mov_r64_p64_keepflags(drcbe, dst, reg, param); | |
| 2194 | 2226 | emit_sbb_m64_r64(dst, MEMPARAMS, reg); // sbb [dest],reg |
| 2195 | 2227 | } |
| 2196 | 2228 | } |
| r2844 | r2845 | |
| 2247 | 2279 | { |
| 2248 | 2280 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2249 | 2281 | { |
| 2250 | if (inst-> | |
| 2282 | if (inst-> | |
| 2251 | 2283 | { |
| 2252 | 2284 | if (short_immediate(param->value)) |
| 2253 | 2285 | emit_and_r64_imm(dst, reg, param->value); // and reg,param |
| r2844 | r2845 | |
| 2274 | 2306 | { |
| 2275 | 2307 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2276 | 2308 | { |
| 2277 | if (inst-> | |
| 2309 | if (inst-> | |
| 2278 | 2310 | { |
| 2279 | 2311 | if (short_immediate(param->value)) |
| 2280 | 2312 | emit_and_m64_imm(dst, MEMPARAMS, param->value); // and [mem],param |
| r2844 | r2845 | |
| 2346 | 2378 | { |
| 2347 | 2379 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2348 | 2380 | { |
| 2349 | if (inst-> | |
| 2381 | if (inst-> | |
| 2350 | 2382 | { |
| 2351 | 2383 | if (short_immediate(param->value)) |
| 2352 | 2384 | emit_or_r64_imm(dst, reg, param->value); // or reg,param |
| r2844 | r2845 | |
| 2373 | 2405 | { |
| 2374 | 2406 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2375 | 2407 | { |
| 2376 | if (inst-> | |
| 2408 | if (inst-> | |
| 2377 | 2409 | { |
| 2378 | 2410 | if (short_immediate(param->value)) |
| 2379 | 2411 | emit_or_m64_imm(dst, MEMPARAMS, param->value); // or [mem],param |
| r2844 | r2845 | |
| 2402 | 2434 | { |
| 2403 | 2435 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2404 | 2436 | { |
| 2405 | if (inst-> | |
| 2437 | if (inst-> | |
| 2406 | 2438 | { |
| 2407 | 2439 | if (param->value == U64(0xffffffffffffffff)) |
| 2408 | 2440 | emit_not_r64(dst, reg); // not reg |
| r2844 | r2845 | |
| 2431 | 2463 | { |
| 2432 | 2464 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2433 | 2465 | { |
| 2434 | if (inst-> | |
| 2466 | if (inst-> | |
| 2435 | 2467 | { |
| 2436 | 2468 | if (param->value == U64(0xffffffffffffffff)) |
| 2437 | 2469 | emit_not_m64(dst, MEMPARAMS); // not [mem] |
| r2844 | r2845 | |
| 2462 | 2494 | { |
| 2463 | 2495 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2464 | 2496 | { |
| 2465 | if (inst-> | |
| 2497 | if (inst-> | |
| 2466 | 2498 | /* skip */; |
| 2467 | 2499 | else |
| 2468 | 2500 | emit_shl_r64_imm(dst, reg, param->value); // shl reg,param |
| r2844 | r2845 | |
| 2484 | 2516 | { |
| 2485 | 2517 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2486 | 2518 | { |
| 2487 | if (inst-> | |
| 2519 | if (inst-> | |
| 2488 | 2520 | /* skip */; |
| 2489 | 2521 | else |
| 2490 | 2522 | emit_shl_m64_imm(dst, MEMPARAMS, param->value); // shl [dest],param |
| r2844 | r2845 | |
| 2506 | 2538 | { |
| 2507 | 2539 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2508 | 2540 | { |
| 2509 | if (inst-> | |
| 2541 | if (inst-> | |
| 2510 | 2542 | /* skip */; |
| 2511 | 2543 | else |
| 2512 | 2544 | emit_shr_r64_imm(dst, reg, param->value); // shr reg,param |
| r2844 | r2845 | |
| 2528 | 2560 | { |
| 2529 | 2561 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2530 | 2562 | { |
| 2531 | if (inst-> | |
| 2563 | if (inst-> | |
| 2532 | 2564 | /* skip */; |
| 2533 | 2565 | else |
| 2534 | 2566 | emit_shr_m64_imm(dst, MEMPARAMS, param->value); // shr [dest],param |
| r2844 | r2845 | |
| 2550 | 2582 | { |
| 2551 | 2583 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2552 | 2584 | { |
| 2553 | if (inst-> | |
| 2585 | if (inst-> | |
| 2554 | 2586 | /* skip */; |
| 2555 | 2587 | else |
| 2556 | 2588 | emit_sar_r64_imm(dst, reg, param->value); // sar reg,param |
| r2844 | r2845 | |
| 2572 | 2604 | { |
| 2573 | 2605 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2574 | 2606 | { |
| 2575 | if (inst-> | |
| 2607 | if (inst-> | |
| 2576 | 2608 | /* skip */; |
| 2577 | 2609 | else |
| 2578 | 2610 | emit_sar_m64_imm(dst, MEMPARAMS, param->value); // sar [dest],param |
| r2844 | r2845 | |
| 2594 | 2626 | { |
| 2595 | 2627 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2596 | 2628 | { |
| 2597 | if (inst-> | |
| 2629 | if (inst-> | |
| 2598 | 2630 | /* skip */; |
| 2599 | 2631 | else |
| 2600 | 2632 | emit_rol_r64_imm(dst, reg, param->value); // rol reg,param |
| r2844 | r2845 | |
| 2616 | 2648 | { |
| 2617 | 2649 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2618 | 2650 | { |
| 2619 | if (inst-> | |
| 2651 | if (inst-> | |
| 2620 | 2652 | /* skip */; |
| 2621 | 2653 | else |
| 2622 | 2654 | emit_rol_m64_imm(dst, MEMPARAMS, param->value); // rol [dest],param |
| r2844 | r2845 | |
| 2638 | 2670 | { |
| 2639 | 2671 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2640 | 2672 | { |
| 2641 | if (inst-> | |
| 2673 | if (inst-> | |
| 2642 | 2674 | /* skip */; |
| 2643 | 2675 | else |
| 2644 | 2676 | emit_ror_r64_imm(dst, reg, param->value); // ror reg,param |
| r2844 | r2845 | |
| 2660 | 2692 | { |
| 2661 | 2693 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2662 | 2694 | { |
| 2663 | if (inst-> | |
| 2695 | if (inst-> | |
| 2664 | 2696 | /* skip */; |
| 2665 | 2697 | else |
| 2666 | 2698 | emit_ror_m64_imm(dst, MEMPARAMS, param->value); // ror [dest],param |
| r2844 | r2845 | |
| 2682 | 2714 | { |
| 2683 | 2715 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2684 | 2716 | { |
| 2685 | if (inst-> | |
| 2717 | if (inst-> | |
| 2686 | 2718 | /* skip */; |
| 2687 | 2719 | else |
| 2688 | 2720 | emit_rcl_r64_imm(dst, reg, param->value); // rcl reg,param |
| 2689 | 2721 | } |
| 2690 | 2722 | else |
| 2691 | 2723 | { |
| 2692 | emit_mov_r64_p64(drcbe, dst, REG_RCX, param); | |
| 2724 | emit_mov_r64_p64_keepflags(drcbe, dst, REG_RCX, param); | |
| 2693 | 2725 | emit_rcl_r64_cl(dst, reg); // rcl reg,cl |
| 2694 | 2726 | } |
| 2695 | 2727 | } |
| r2844 | r2845 | |
| 2704 | 2736 | { |
| 2705 | 2737 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2706 | 2738 | { |
| 2707 | if (inst-> | |
| 2739 | if (inst-> | |
| 2708 | 2740 | /* skip */; |
| 2709 | 2741 | else |
| 2710 | 2742 | emit_rcl_m64_imm(dst, MEMPARAMS, param->value); // rcl [dest],param |
| 2711 | 2743 | } |
| 2712 | 2744 | else |
| 2713 | 2745 | { |
| 2714 | emit_mov_r64_p64(drcbe, dst, REG_RCX, param); | |
| 2746 | emit_mov_r64_p64_keepflags(drcbe, dst, REG_RCX, param); | |
| 2715 | 2747 | emit_rcl_m64_cl(dst, MEMPARAMS); // rcl [dest],cl |
| 2716 | 2748 | } |
| 2717 | 2749 | } |
| r2844 | r2845 | |
| 2726 | 2758 | { |
| 2727 | 2759 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2728 | 2760 | { |
| 2729 | if (inst-> | |
| 2761 | if (inst-> | |
| 2730 | 2762 | /* skip */; |
| 2731 | 2763 | else |
| 2732 | 2764 | emit_rcr_r64_imm(dst, reg, param->value); // rcr reg,param |
| 2733 | 2765 | } |
| 2734 | 2766 | else |
| 2735 | 2767 | { |
| 2736 | emit_mov_r64_p64(drcbe, dst, REG_RCX, param); | |
| 2768 | emit_mov_r64_p64_keepflags(drcbe, dst, REG_RCX, param); | |
| 2737 | 2769 | emit_rcr_r64_cl(dst, reg); // rcr reg,cl |
| 2738 | 2770 | } |
| 2739 | 2771 | } |
| r2844 | r2845 | |
| 2748 | 2780 | { |
| 2749 | 2781 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2750 | 2782 | { |
| 2751 | if (inst-> | |
| 2783 | if (inst-> | |
| 2752 | 2784 | /* skip */; |
| 2753 | 2785 | else |
| 2754 | 2786 | emit_rcr_m64_imm(dst, MEMPARAMS, param->value); // rcr [dest],param |
| 2755 | 2787 | } |
| 2756 | 2788 | else |
| 2757 | 2789 | { |
| 2758 | emit_mov_r64_p64(drcbe, dst, REG_RCX, param); | |
| 2790 | emit_mov_r64_p64_keepflags(drcbe, dst, REG_RCX, param); | |
| 2759 | 2791 | emit_rcr_m64_cl(dst, MEMPARAMS); // rcr [dest],cl |
| 2760 | 2792 | } |
| 2761 | 2793 | } |
| r2844 | r2845 | |
| 2840 | 2872 | |
| 2841 | 2873 | |
| 2842 | 2874 | /*************************************************************************** |
| 2843 | HELPERS TO CONVERT OTHER OPERATIONS TO MOVES | |
| 2844 | ***************************************************************************/ | |
| 2845 | ||
| 2846 | /*------------------------------------------------- | |
| 2847 | convert_to_mov_imm - convert an instruction | |
| 2848 | into a mov immediate | |
| 2849 | -------------------------------------------------*/ | |
| 2850 | ||
| 2851 | static x86code *convert_to_mov_imm(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst, const drcuml_parameter *dstp, UINT64 imm) | |
| 2852 | { | |
| 2853 | drcuml_instruction temp = *inst; | |
| 2854 | temp.numparams = 2; | |
| 2855 | temp.param[0] = *dstp; | |
| 2856 | temp.param[1].type = DRCUML_PTYPE_IMMEDIATE; | |
| 2857 | temp.param[1].value = imm; | |
| 2858 | return op_mov(drcbe, dst, &temp); | |
| 2859 | } | |
| 2860 | ||
| 2861 | ||
| 2862 | /*------------------------------------------------- | |
| 2863 | convert_to_mov_src1 - convert an instruction | |
| 2864 | into a mov src1 | |
| 2865 | -------------------------------------------------*/ | |
| 2866 | ||
| 2867 | static x86code *convert_to_mov_src1(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst, const drcuml_parameter *dstp, const drcuml_parameter *srcp) | |
| 2868 | { | |
| 2869 | drcuml_instruction temp = *inst; | |
| 2870 | temp.numparams = 2; | |
| 2871 | temp.param[0] = *dstp; | |
| 2872 | temp.param[1] = *srcp; | |
| 2873 | return op_mov(drcbe, dst, &temp); | |
| 2874 | } | |
| 2875 | ||
| 2876 | ||
| 2877 | ||
| 2878 | /*************************************************************************** | |
| 2879 | 2875 | OUT-OF-BAND CODE FIXUP CALLBACKS |
| 2880 | 2876 | ***************************************************************************/ |
| 2881 | 2877 | |
| r2844 | r2845 | |
| 2976 | 2972 | |
| 2977 | 2973 | static x86code *op_handle(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 2978 | 2974 | { |
| 2975 | emit_link skip; | |
| 2976 | ||
| 2977 | assert_no_condition(inst); | |
| 2978 | assert_no_flags(inst); | |
| 2979 | 2979 | assert(inst->numparams == 1); |
| 2980 | 2980 | assert(inst->param[0].type == DRCUML_PTYPE_MEMORY); |
| 2981 | 2981 | |
| 2982 | /* emit a jump around the stack adjust in case code falls through here */ | |
| 2983 | emit_jmp_short_link(&dst, &skip); // jmp skip | |
| 2984 | ||
| 2982 | 2985 | /* register the current pointer for the handle */ |
| 2983 | 2986 | drcuml_handle_set_codeptr((drcuml_codehandle *)(FPTR)inst->param[0].value, dst); |
| 2984 | 2987 | |
| 2985 | 2988 | /* by default, the handle points to prolog code that moves the stack pointer */ |
| 2986 | 2989 | emit_lea_r64_m64(&dst, REG_RSP, MBD(REG_RSP, -40)); // lea rsp,[rsp-40] |
| 2990 | resolve_link(&dst, &skip); // skip: | |
| 2987 | 2991 | return dst; |
| 2988 | 2992 | } |
| 2989 | 2993 | |
| r2844 | r2845 | |
| 2994 | 2998 | |
| 2995 | 2999 | static x86code *op_hash(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 2996 | 3000 | { |
| 3001 | assert_no_condition(inst); | |
| 3002 | assert_no_flags(inst); | |
| 2997 | 3003 | assert(inst->numparams == 2); |
| 2998 | 3004 | assert(inst->param[0].type == DRCUML_PTYPE_IMMEDIATE); |
| 2999 | 3005 | assert(inst->param[1].type == DRCUML_PTYPE_IMMEDIATE); |
| r2844 | r2845 | |
| 3010 | 3016 | |
| 3011 | 3017 | static x86code *op_label(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3012 | 3018 | { |
| 3019 | assert_no_condition(inst); | |
| 3020 | assert_no_flags(inst); | |
| 3013 | 3021 | assert(inst->numparams == 1); |
| 3014 | 3022 | assert(inst->param[0].type == DRCUML_PTYPE_IMMEDIATE); |
| 3015 | 3023 | |
| r2844 | r2845 | |
| 3025 | 3033 | |
| 3026 | 3034 | static x86code *op_comment(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3027 | 3035 | { |
| 3036 | assert_no_condition(inst); | |
| 3037 | assert_no_flags(inst); | |
| 3028 | 3038 | assert(inst->numparams == 1); |
| 3029 | 3039 | assert(inst->param[0].type == DRCUML_PTYPE_MEMORY); |
| 3030 | 3040 | |
| r2844 | r2845 | |
| 3039 | 3049 | |
| 3040 | 3050 | static x86code *op_mapvar(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3041 | 3051 | { |
| 3052 | assert_no_condition(inst); | |
| 3053 | assert_no_flags(inst); | |
| 3042 | 3054 | assert(inst->numparams == 2); |
| 3043 | 3055 | assert(inst->param[0].type == DRCUML_PTYPE_MAPVAR); |
| 3044 | 3056 | assert(inst->param[1].type == DRCUML_PTYPE_IMMEDIATE); |
| r2844 | r2845 | |
| 3055 | 3067 | ***************************************************************************/ |
| 3056 | 3068 | |
| 3057 | 3069 | /*------------------------------------------------- |
| 3070 | op_nop - process a NOP opcode | |
| 3071 | -------------------------------------------------*/ | |
| 3072 | ||
| 3073 | static x86code *op_nop(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) | |
| 3074 | { | |
| 3075 | /* nothing */ | |
| 3076 | return dst; | |
| 3077 | } | |
| 3078 | ||
| 3079 | ||
| 3080 | /*------------------------------------------------- | |
| 3058 | 3081 | op_debug - process a DEBUG opcode |
| 3059 | 3082 | -------------------------------------------------*/ |
| 3060 | 3083 | |
| 3061 | 3084 | static x86code *op_debug(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3062 | 3085 | { |
| 3086 | /* validate instruction */ | |
| 3087 | assert(inst->size == 4); | |
| 3088 | assert_no_condition(inst); | |
| 3089 | assert_no_flags(inst); | |
| 3090 | ||
| 3063 | 3091 | #ifdef ENABLE_DEBUGGER |
| 3064 | 3092 | if (Machine->debug_mode) |
| 3065 | 3093 | { |
| 3066 | 3094 | drcuml_parameter pcp; |
| 3067 | 3095 | |
| 3068 | /* validate instruction */ | |
| 3069 | assert(inst->size == 4); | |
| 3070 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3071 | ||
| 3072 | 3096 | /* normalize parameters */ |
| 3073 | 3097 | param_normalize_1(drcbe, inst, &pcp, PTYPE_MRI); |
| 3074 | 3098 | |
| r2844 | r2845 | |
| 3092 | 3116 | |
| 3093 | 3117 | /* validate instruction */ |
| 3094 | 3118 | assert(inst->size == 4); |
| 3095 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3119 | assert_any_condition(inst); | |
| 3120 | assert_no_flags(inst); | |
| 3096 | 3121 | |
| 3097 | 3122 | /* normalize parameters */ |
| 3098 | 3123 | param_normalize_1(drcbe, inst, &retp, PTYPE_MRI); |
| 3099 | 3124 | |
| 3100 | 3125 | /* load the parameter into EAX */ |
| 3101 | 3126 | emit_mov_r32_p32(drcbe, &dst, REG_EAX, &retp); // mov eax,retp |
| 3102 | if (inst->cond | |
| 3127 | if (inst->condition == DRCUML_COND_ALWAYS) | |
| 3103 | 3128 | emit_jmp(&dst, drcbe->exit); // jmp exit |
| 3104 | 3129 | else |
| 3105 | emit_jcc(&dst, X86_CONDITION(inst->cond | |
| 3130 | emit_jcc(&dst, X86_CONDITION(inst->condition), drcbe->exit); // jcc exit | |
| 3106 | 3131 | |
| 3107 | 3132 | return dst; |
| 3108 | 3133 | } |
| r2844 | r2845 | |
| 3118 | 3143 | |
| 3119 | 3144 | /* validate instruction */ |
| 3120 | 3145 | assert(inst->size == 4); |
| 3121 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3146 | assert_no_condition(inst); | |
| 3147 | assert_no_flags(inst); | |
| 3122 | 3148 | |
| 3123 | 3149 | /* normalize parameters */ |
| 3124 | 3150 | param_normalize_3(drcbe, inst, &modep, PTYPE_MRI, &pcp, PTYPE_MRI, &exp, PTYPE_M); |
| r2844 | r2845 | |
| 3205 | 3231 | |
| 3206 | 3232 | /* validate instruction */ |
| 3207 | 3233 | assert(inst->size == 4); |
| 3208 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3234 | assert_any_condition(inst); | |
| 3235 | assert_no_flags(inst); | |
| 3209 | 3236 | |
| 3210 | 3237 | /* normalize parameters */ |
| 3211 | 3238 | param_normalize_1(drcbe, inst, &labelp, PTYPE_I); |
| r2844 | r2845 | |
| 3214 | 3241 | jmptarget = (x86code *)drclabel_get_codeptr(drcbe->labels, labelp.value, fixup_label, dst); |
| 3215 | 3242 | if (jmptarget == NULL) |
| 3216 | 3243 | jmptarget = dst + 0x7ffffff0; |
| 3217 | if (inst->cond | |
| 3244 | if (inst->condition == DRCUML_COND_ALWAYS) | |
| 3218 | 3245 | emit_jmp(&dst, jmptarget); // jmp target |
| 3219 | 3246 | else |
| 3220 | emit_jcc(&dst, X86_CONDITION(inst->cond | |
| 3247 | emit_jcc(&dst, X86_CONDITION(inst->condition), jmptarget); // jcc target | |
| 3221 | 3248 | |
| 3222 | 3249 | return dst; |
| 3223 | 3250 | } |
| r2844 | r2845 | |
| 3234 | 3261 | |
| 3235 | 3262 | /* validate instruction */ |
| 3236 | 3263 | assert(inst->size == 4); |
| 3237 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3264 | assert_any_condition(inst); | |
| 3265 | assert_no_flags(inst); | |
| 3238 | 3266 | |
| 3239 | 3267 | /* normalize parameters */ |
| 3240 | 3268 | param_normalize_2(drcbe, inst, &handp, PTYPE_M, &exp, PTYPE_MRI); |
| r2844 | r2845 | |
| 3243 | 3271 | targetptr = drcuml_handle_codeptr_addr((drcuml_codehandle *)handp.value); |
| 3244 | 3272 | |
| 3245 | 3273 | /* perform the exception processing inline if unconditional */ |
| 3246 | if (inst->cond | |
| 3274 | if (inst->condition == DRCUML_COND_ALWAYS) | |
| 3247 | 3275 | { |
| 3248 | 3276 | emit_mov_m32_p32(drcbe, &dst, MABS(drcbe, &drcbe->state.exp), &exp); // mov [exp],exp |
| 3249 | 3277 | if (*targetptr != NULL) |
| r2844 | r2845 | |
| 3255 | 3283 | /* otherwise, jump to an out-of-band handler */ |
| 3256 | 3284 | else |
| 3257 | 3285 | { |
| 3258 | emit_jcc(&dst, X86_CONDITION(inst->cond | |
| 3286 | emit_jcc(&dst, X86_CONDITION(inst->condition), dst + 0x7ffffff0); // jcc exception | |
| 3259 | 3287 | drccache_request_oob_codegen(drcbe->cache, fixup_exception, drcbe, dst, (void *)inst); |
| 3260 | 3288 | } |
| 3261 | 3289 | return dst; |
| r2844 | r2845 | |
| 3274 | 3302 | |
| 3275 | 3303 | /* validate instruction */ |
| 3276 | 3304 | assert(inst->size == 4); |
| 3277 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3305 | assert_any_condition(inst); | |
| 3306 | assert_no_flags(inst); | |
| 3278 | 3307 | |
| 3279 | 3308 | /* normalize parameters */ |
| 3280 | 3309 | param_normalize_1(drcbe, inst, &handp, PTYPE_M); |
| r2844 | r2845 | |
| 3283 | 3312 | targetptr = drcuml_handle_codeptr_addr((drcuml_codehandle *)handp.value); |
| 3284 | 3313 | |
| 3285 | 3314 | /* skip if conditional */ |
| 3286 | if (inst->condflags != DRCUML_COND_ALWAYS) | |
| 3287 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condflags), &skip); // jcc skip | |
| 3315 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3316 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condition), &skip); // jcc skip | |
| 3288 | 3317 | |
| 3289 | 3318 | /* jump through the handle; directly if a normal jump */ |
| 3290 | 3319 | if (*targetptr != NULL) |
| r2844 | r2845 | |
| 3293 | 3322 | emit_call_m64(&dst, MABS(drcbe, targetptr)); // call [targetptr] |
| 3294 | 3323 | |
| 3295 | 3324 | /* resolve the conditional link */ |
| 3296 | if (inst->cond | |
| 3325 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3297 | 3326 | resolve_link(&dst, &skip); // skip: |
| 3298 | 3327 | return dst; |
| 3299 | 3328 | } |
| r2844 | r2845 | |
| 3309 | 3338 | |
| 3310 | 3339 | /* validate instruction */ |
| 3311 | 3340 | assert(inst->size == 4); |
| 3312 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3341 | assert_any_condition(inst); | |
| 3342 | assert_no_flags(inst); | |
| 3313 | 3343 | assert(inst->numparams == 0); |
| 3314 | 3344 | |
| 3315 | 3345 | /* skip if conditional */ |
| 3316 | if (inst->condflags != DRCUML_COND_ALWAYS) | |
| 3317 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condflags), &skip); // jcc skip | |
| 3346 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3347 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condition), &skip); // jcc skip | |
| 3318 | 3348 | |
| 3319 | 3349 | /* return */ |
| 3320 | 3350 | emit_lea_r64_m64(&dst, REG_RSP, MBD(REG_RSP, 40)); // lea rsp,[rsp+40] |
| 3321 | 3351 | emit_ret(&dst); // ret |
| 3322 | 3352 | |
| 3323 | 3353 | /* resolve the conditional link */ |
| 3324 | if (inst->cond | |
| 3354 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3325 | 3355 | resolve_link(&dst, &skip); // skip: |
| 3326 | 3356 | return dst; |
| 3327 | 3357 | } |
| r2844 | r2845 | |
| 3338 | 3368 | |
| 3339 | 3369 | /* validate instruction */ |
| 3340 | 3370 | assert(inst->size == 4); |
| 3341 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3371 | assert_any_condition(inst); | |
| 3372 | assert_no_flags(inst); | |
| 3342 | 3373 | |
| 3343 | 3374 | /* normalize parameters */ |
| 3344 | 3375 | param_normalize_2(drcbe, inst, &funcp, PTYPE_M, ¶mp, PTYPE_M); |
| 3345 | 3376 | |
| 3346 | 3377 | /* skip if conditional */ |
| 3347 | if (inst->condflags != DRCUML_COND_ALWAYS) | |
| 3348 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condflags), &skip); // jcc skip | |
| 3378 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3379 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condition), &skip); // jcc skip | |
| 3349 | 3380 | |
| 3350 | 3381 | /* perform the call */ |
| 3351 | 3382 | emit_mov_r64_imm(&dst, REG_PARAM1, paramp.value); // mov param1,paramp |
| 3352 | 3383 | emit_smart_call_r64(drcbe, &dst, (x86code *)(FPTR)funcp.value, REG_RAX); // call funcp |
| 3353 | 3384 | |
| 3354 | 3385 | /* resolve the conditional link */ |
| 3355 | if (inst->cond | |
| 3386 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3356 | 3387 | resolve_link(&dst, &skip); // skip: |
| 3357 | 3388 | return dst; |
| 3358 | 3389 | } |
| r2844 | r2845 | |
| 3364 | 3395 | |
| 3365 | 3396 | static x86code *op_recover(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3366 | 3397 | { |
| 3367 | drcuml_parameter dstp | |
| 3398 | drcuml_parameter dstp | |
| 3368 | 3399 | |
| 3369 | 3400 | /* validate instruction */ |
| 3370 | 3401 | assert(inst->size == 4); |
| 3371 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3402 | assert_no_condition(inst); | |
| 3403 | assert_no_flags(inst); | |
| 3372 | 3404 | |
| 3373 | 3405 | /* normalize parameters */ |
| 3374 | param_normalize | |
| 3406 | param_normalize | |
| 3375 | 3407 | |
| 3376 | 3408 | /* call the recovery code */ |
| 3377 | 3409 | emit_mov_r64_m64(&dst, REG_RAX, MABS(drcbe, &drcbe->stacksave)); // mov rax,stacksave |
| r2844 | r2845 | |
| 3401 | 3433 | |
| 3402 | 3434 | /* validate instruction */ |
| 3403 | 3435 | assert(inst->size == 4); |
| 3404 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3436 | assert_no_condition(inst); | |
| 3437 | assert_no_flags(inst); | |
| 3405 | 3438 | |
| 3406 | 3439 | /* normalize parameters */ |
| 3407 | 3440 | param_normalize_1(drcbe, inst, &srcp, PTYPE_MRI); |
| r2844 | r2845 | |
| 3438 | 3471 | |
| 3439 | 3472 | /* validate instruction */ |
| 3440 | 3473 | assert(inst->size == 4); |
| 3441 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3474 | assert_no_condition(inst); | |
| 3475 | assert_no_flags(inst); | |
| 3442 | 3476 | |
| 3443 | 3477 | /* normalize parameters */ |
| 3444 | 3478 | param_normalize_1(drcbe, inst, &dstp, PTYPE_MR); |
| r2844 | r2845 | |
| 3466 | 3500 | |
| 3467 | 3501 | /* validate instruction */ |
| 3468 | 3502 | assert(inst->size == 4); |
| 3469 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3503 | assert_no_condition(inst); | |
| 3504 | assert_no_flags(inst); | |
| 3470 | 3505 | |
| 3471 | 3506 | /* normalize parameters */ |
| 3472 | 3507 | param_normalize_1(drcbe, inst, &dstp, PTYPE_MR); |
| r2844 | r2845 | |
| 3490 | 3525 | |
| 3491 | 3526 | static x86code *op_getflgs(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3492 | 3527 | { |
| 3493 | drcuml_parameter dstp; | |
| 3528 | drcuml_parameter dstp, maskp; | |
| 3529 | UINT32 flagmask = 0; | |
| 3494 | 3530 | int dstreg; |
| 3495 | 3531 | |
| 3496 | 3532 | /* validate instruction */ |
| 3497 | 3533 | assert(inst->size == 4); |
| 3498 | assert(inst->condflags != DRCUML_COND_ALWAYS); | |
| 3534 | assert_no_condition(inst); | |
| 3535 | assert_no_flags(inst); | |
| 3499 | 3536 | |
| 3500 | 3537 | /* normalize parameters */ |
| 3501 | param_normalize_ | |
| 3538 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MR, &maskp, PTYPE_I); | |
| 3502 | 3539 | |
| 3503 | 3540 | /* pick a target register for the general case */ |
| 3504 | 3541 | dstreg = param_select_register(REG_EAX, &dstp, NULL); |
| 3505 | 3542 | |
| 3506 | switch (inst->condflags) | |
| 3543 | /* compute mask for flags */ | |
| 3544 | if (maskp.value & DRCUML_FLAG_C) flagmask |= 0x001; | |
| 3545 | if (maskp.value & DRCUML_FLAG_V) flagmask |= 0x800; | |
| 3546 | if (maskp.value & DRCUML_FLAG_Z) flagmask |= 0x040; | |
| 3547 | if (maskp.value & DRCUML_FLAG_S) flagmask |= 0x080; | |
| 3548 | if (maskp.value & DRCUML_FLAG_U) flagmask |= 0x004; | |
| 3549 | ||
| 3550 | switch (maskp.value) | |
| 3507 | 3551 | { |
| 3508 | 3552 | /* single flags only */ |
| 3509 | 3553 | case DRCUML_FLAG_C: |
| r2844 | r2845 | |
| 3593 | 3637 | default: |
| 3594 | 3638 | emit_pushf(&dst); // pushf |
| 3595 | 3639 | emit_pop_r64(&dst, REG_EAX); // pop eax |
| 3596 | emit_and_r32_imm(&dst, REG_EAX, | |
| 3640 | emit_and_r32_imm(&dst, REG_EAX, flagmask); | |
| 3597 | 3641 | emit_movzx_r32_m8(&dst, dstreg, MBISD(REG_RBP, REG_RAX, 1, offset_from_rbp(drcbe, (FPTR)&drcbe->flagsmap[0]))); |
| 3598 | 3642 | // movzx dstreg,[flags_map] |
| 3599 | 3643 | break; |
| r2844 | r2845 | |
| 3622 | 3666 | |
| 3623 | 3667 | /* validate instruction */ |
| 3624 | 3668 | assert(inst->size == 4); |
| 3625 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3669 | assert_no_condition(inst); | |
| 3670 | assert_no_flags(inst); | |
| 3626 | 3671 | |
| 3627 | 3672 | /* normalize parameters */ |
| 3628 | 3673 | param_normalize_1(drcbe, inst, &dstp, PTYPE_M); |
| r2844 | r2845 | |
| 3683 | 3728 | |
| 3684 | 3729 | /* validate instruction */ |
| 3685 | 3730 | assert(inst->size == 4); |
| 3686 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3731 | assert_no_condition(inst); | |
| 3732 | assert_no_flags(inst); | |
| 3687 | 3733 | |
| 3688 | 3734 | /* normalize parameters */ |
| 3689 | 3735 | param_normalize_1(drcbe, inst, &dstp, PTYPE_M); |
| r2844 | r2845 | |
| 3750 | 3796 | |
| 3751 | 3797 | /* validate instruction */ |
| 3752 | 3798 | assert(inst->size == 4 || inst->size == 8); |
| 3753 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3799 | assert_no_condition(inst); | |
| 3800 | assert_no_flags(inst); | |
| 3754 | 3801 | |
| 3755 | 3802 | /* normalize parameters */ |
| 3756 | 3803 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &basep, PTYPE_M, &indp, PTYPE_MRI, &sizep, PTYPE_I); |
| r2844 | r2845 | |
| 3811 | 3858 | |
| 3812 | 3859 | /* validate instruction */ |
| 3813 | 3860 | assert(inst->size == 4 || inst->size == 8); |
| 3814 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3861 | assert_no_condition(inst); | |
| 3862 | assert_no_flags(inst); | |
| 3815 | 3863 | |
| 3816 | 3864 | /* normalize parameters */ |
| 3817 | 3865 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &basep, PTYPE_M, &indp, PTYPE_MRI, &sizep, PTYPE_I); |
| r2844 | r2845 | |
| 3896 | 3944 | |
| 3897 | 3945 | /* validate instruction */ |
| 3898 | 3946 | assert(inst->size == 4 || inst->size == 8); |
| 3899 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3947 | assert_no_condition(inst); | |
| 3948 | assert_no_flags(inst); | |
| 3900 | 3949 | |
| 3901 | 3950 | /* normalize parameters */ |
| 3902 | 3951 | param_normalize_4(drcbe, inst, &basep, PTYPE_M, &indp, PTYPE_MRI, &srcp, PTYPE_MRI, &sizep, PTYPE_I); |
| r2844 | r2845 | |
| 4010 | 4059 | |
| 4011 | 4060 | /* validate instruction */ |
| 4012 | 4061 | assert(inst->size == 4 || inst->size == 8); |
| 4013 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4062 | assert_no_condition(inst); | |
| 4063 | assert_no_flags(inst); | |
| 4014 | 4064 | |
| 4015 | 4065 | /* normalize parameters */ |
| 4016 | 4066 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &addrp, PTYPE_MRI, &spacesizep, PTYPE_I); |
| r2844 | r2845 | |
| 4068 | 4118 | |
| 4069 | 4119 | /* validate instruction */ |
| 4070 | 4120 | assert(inst->size == 4 || inst->size == 8); |
| 4071 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4121 | assert_no_condition(inst); | |
| 4122 | assert_no_flags(inst); | |
| 4072 | 4123 | |
| 4073 | 4124 | /* normalize parameters */ |
| 4074 | 4125 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &addrp, PTYPE_MRI, &maskp, PTYPE_MRI, &spacesizep, PTYPE_I); |
| r2844 | r2845 | |
| 4123 | 4174 | |
| 4124 | 4175 | /* validate instruction */ |
| 4125 | 4176 | assert(inst->size == 4 || inst->size == 8); |
| 4126 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4177 | assert_no_condition(inst); | |
| 4178 | assert_no_flags(inst); | |
| 4127 | 4179 | |
| 4128 | 4180 | /* normalize parameters */ |
| 4129 | 4181 | param_normalize_3(drcbe, inst, &addrp, PTYPE_MRI, &srcp, PTYPE_MRI, &spacesizep, PTYPE_I); |
| r2844 | r2845 | |
| 4160 | 4212 | |
| 4161 | 4213 | /* validate instruction */ |
| 4162 | 4214 | assert(inst->size == 4 || inst->size == 8); |
| 4163 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4215 | assert_no_condition(inst); | |
| 4216 | assert_no_flags(inst); | |
| 4164 | 4217 | |
| 4165 | 4218 | /* normalize parameters */ |
| 4166 | 4219 | param_normalize_4(drcbe, inst, &addrp, PTYPE_MRI, &srcp, PTYPE_MRI, &maskp, PTYPE_MRI, &spacesizep, PTYPE_I); |
| r2844 | r2845 | |
| 4200 | 4253 | |
| 4201 | 4254 | /* validate instruction */ |
| 4202 | 4255 | assert(inst->size == 4 || inst->size == 8); |
| 4203 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4256 | assert_no_condition(inst); | |
| 4257 | assert_flags(inst, DRCUML_FLAG_C); | |
| 4204 | 4258 | |
| 4205 | 4259 | /* normalize parameters */ |
| 4206 | 4260 | param_normalize_2(drcbe, inst, &srcp, PTYPE_MRI, &bitp, PTYPE_MRI); |
| r2844 | r2845 | |
| 4274 | 4328 | |
| 4275 | 4329 | /* validate instruction */ |
| 4276 | 4330 | assert(inst->size == 4 || inst->size == 8); |
| 4277 | assert(inst->condflags >= DRCUML_COND_Z && inst->condflags < DRCUML_COND_MAX); | |
| 4331 | assert_any_condition(inst); | |
| 4332 | assert_no_flags(inst); | |
| 4278 | 4333 | |
| 4279 | 4334 | /* normalize parameters */ |
| 4280 | 4335 | param_normalize_1(drcbe, inst, &dstp, PTYPE_MR); |
| r2844 | r2845 | |
| 4283 | 4338 | dstreg = param_select_register(REG_EAX, &dstp, NULL); |
| 4284 | 4339 | |
| 4285 | 4340 | /* set to AL */ |
| 4286 | emit_setcc_r8(&dst, X86_CONDITION(inst->cond | |
| 4341 | emit_setcc_r8(&dst, X86_CONDITION(inst->condition), REG_AL); // setcc al | |
| 4287 | 4342 | emit_movzx_r32_r8(&dst, dstreg, REG_AL); // movzx dstreg,al |
| 4288 | 4343 | |
| 4289 | 4344 | /* 32-bit form */ |
| r2844 | r2845 | |
| 4311 | 4366 | |
| 4312 | 4367 | /* validate instruction */ |
| 4313 | 4368 | assert(inst->size == 4 || inst->size == 8); |
| 4314 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 4369 | assert_any_condition(inst); | |
| 4370 | assert_no_flags(inst); | |
| 4315 | 4371 | |
| 4316 | 4372 | /* normalize parameters, but only if we got here directly */ |
| 4317 | 4373 | /* other opcodes call through here with pre-normalized parameters */ |
| r2844 | r2845 | |
| 4323 | 4379 | srcp = inst->param[1]; |
| 4324 | 4380 | } |
| 4325 | 4381 | |
| 4326 | /* degenerate case: dest and source are equal */ | |
| 4327 | if (dstp.type == srcp.type && dstp.value == srcp.value) | |
| 4328 | return dst; | |
| 4329 | ||
| 4330 | 4382 | /* pick a target register for the general case */ |
| 4331 | 4383 | dstreg = param_select_register(REG_EAX, &dstp, NULL); |
| 4332 | 4384 | |
| 4333 | 4385 | /* always start with a jmp */ |
| 4334 | if (inst->condflags != DRCUML_COND_ALWAYS) | |
| 4335 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condflags), &skip); // jcc skip | |
| 4386 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 4387 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condition), &skip); // jcc skip | |
| 4336 | 4388 | |
| 4337 | 4389 | /* 32-bit form */ |
| 4338 | 4390 | if (inst->size == 4) |
| r2844 | r2845 | |
| 4346 | 4398 | emit_mov_m32_imm(&dst, MABS(drcbe, dstp.value), srcp.value); // mov [dstp],srcp |
| 4347 | 4399 | |
| 4348 | 4400 | /* conditional memory to register */ |
| 4349 | else if (inst->cond | |
| 4401 | else if (inst->condition != 0 && dstp.type == DRCUML_PTYPE_INT_REGISTER && srcp.type == DRCUML_PTYPE_MEMORY) | |
| 4350 | 4402 | { |
| 4351 | 4403 | dst = savedst; |
| 4352 | 4404 | skip.target = NULL; |
| 4353 | emit_cmovcc_r32_m32(&dst, X86_CONDITION(inst->cond | |
| 4405 | emit_cmovcc_r32_m32(&dst, X86_CONDITION(inst->condition), dstp.value, MABS(drcbe, srcp.value)); | |
| 4354 | 4406 | // cmovcc dstp,[srcp] |
| 4355 | 4407 | } |
| 4356 | 4408 | |
| 4357 | 4409 | /* conditional register to register */ |
| 4358 | else if (inst->cond | |
| 4410 | else if (inst->condition != 0 && dstp.type == DRCUML_PTYPE_INT_REGISTER && srcp.type == DRCUML_PTYPE_INT_REGISTER) | |
| 4359 | 4411 | { |
| 4360 | 4412 | dst = savedst; |
| 4361 | 4413 | skip.target = NULL; |
| 4362 | emit_cmovcc_r32_r32(&dst, X86_CONDITION(inst->cond | |
| 4414 | emit_cmovcc_r32_r32(&dst, X86_CONDITION(inst->condition), dstp.value, srcp.value); | |
| 4363 | 4415 | // cmovcc dstp,srcp |
| 4364 | 4416 | } |
| 4365 | 4417 | |
| 4366 | 4418 | /* general case */ |
| 4367 | 4419 | else |
| 4368 | 4420 | { |
| 4369 | emit_mov_r32_p32(drcbe, &dst, dstreg, &srcp); | |
| 4421 | emit_mov_r32_p32_keepflags(drcbe, &dst, dstreg, &srcp); | |
| 4370 | 4422 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4371 | 4423 | } |
| 4372 | 4424 | } |
| r2844 | r2845 | |
| 4383 | 4435 | emit_mov_m64_imm(&dst, MABS(drcbe, dstp.value), srcp.value); // mov [dstp],srcp |
| 4384 | 4436 | |
| 4385 | 4437 | /* conditional memory to register */ |
| 4386 | else if (inst->cond | |
| 4438 | else if (inst->condition != 0 && dstp.type == DRCUML_PTYPE_INT_REGISTER && srcp.type == DRCUML_PTYPE_MEMORY) | |
| 4387 | 4439 | { |
| 4388 | 4440 | dst = savedst; |
| 4389 | 4441 | skip.target = NULL; |
| 4390 | emit_cmovcc_r64_m64(&dst, X86_CONDITION(inst->cond | |
| 4442 | emit_cmovcc_r64_m64(&dst, X86_CONDITION(inst->condition), dstp.value, MABS(drcbe, srcp.value)); | |
| 4391 | 4443 | // cmovcc dstp,[srcp] |
| 4392 | 4444 | } |
| 4393 | 4445 | |
| 4394 | 4446 | /* conditional register to register */ |
| 4395 | else if (inst->cond | |
| 4447 | else if (inst->condition != 0 && dstp.type == DRCUML_PTYPE_INT_REGISTER && srcp.type == DRCUML_PTYPE_INT_REGISTER) | |
| 4396 | 4448 | { |
| 4397 | 4449 | dst = savedst; |
| 4398 | 4450 | skip.target = NULL; |
| 4399 | emit_cmovcc_r64_r64(&dst, X86_CONDITION(inst->cond | |
| 4451 | emit_cmovcc_r64_r64(&dst, X86_CONDITION(inst->condition), dstp.value, srcp.value); | |
| 4400 | 4452 | // cmovcc dstp,srcp |
| 4401 | 4453 | } |
| 4402 | 4454 | |
| 4403 | 4455 | /* general case */ |
| 4404 | 4456 | else |
| 4405 | 4457 | { |
| 4406 | emit_mov_r64_p64(drcbe, &dst, dstreg, &srcp); | |
| 4458 | emit_mov_r64_p64_keepflags(drcbe, &dst, dstreg, &srcp); | |
| 4407 | 4459 | emit_mov_p64_r64(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4408 | 4460 | } |
| 4409 | 4461 | } |
| r2844 | r2845 | |
| 4426 | 4478 | |
| 4427 | 4479 | /* validate instruction */ |
| 4428 | 4480 | assert(inst->size == 4 || inst->size == 8); |
| 4429 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4481 | assert_no_condition(inst); | |
| 4482 | assert_flags(inst, DRCUML_FLAG_S | DRCUML_FLAG_Z); | |
| 4430 | 4483 | |
| 4431 | 4484 | /* normalize parameters */ |
| 4432 | 4485 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI, &sizep, PTYPE_I); |
| 4486 | assert(srcp.type != DRCUML_PTYPE_IMMEDIATE); | |
| 4433 | 4487 | |
| 4434 | /* degenerate cases -- convert to a move */ | |
| 4435 | if (srcp.type == DRCUML_PTYPE_IMMEDIATE) | |
| 4436 | { | |
| 4437 | if (sizep.value == DRCUML_SIZE_BYTE) | |
| 4438 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT8)srcp.value); | |
| 4439 | else if (sizep.value == DRCUML_SIZE_WORD) | |
| 4440 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT16)srcp.value); | |
| 4441 | else if (sizep.value == DRCUML_SIZE_DWORD) | |
| 4442 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)srcp.value); | |
| 4443 | } | |
| 4444 | ||
| 4445 | 4488 | /* pick a target register for the general case */ |
| 4446 | 4489 | dstreg = param_select_register(REG_EAX, &dstp, NULL); |
| 4447 | 4490 | |
| r2844 | r2845 | |
| 4468 | 4511 | emit_mov_r32_r32(&dst, dstreg, srcp.value); // mov dstreg,srcp |
| 4469 | 4512 | } |
| 4470 | 4513 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4514 | if (inst->flags != 0) | |
| 4515 | emit_test_r32_r32(&dst, dstreg, dstreg); // test dstreg,dstreg | |
| 4471 | 4516 | } |
| 4472 | 4517 | |
| 4473 | 4518 | /* 64-bit form */ |
| r2844 | r2845 | |
| 4497 | 4542 | emit_mov_r64_r64(&dst, dstreg, srcp.value); // mov dstreg,srcp |
| 4498 | 4543 | } |
| 4499 | 4544 | emit_mov_p64_r64(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4545 | if (inst->flags != 0) | |
| 4546 | emit_test_r64_r64(&dst, dstreg, dstreg); // test dstreg,dstreg | |
| 4500 | 4547 | } |
| 4501 | 4548 | return dst; |
| 4502 | 4549 | } |
| r2844 | r2845 | |
| 4513 | 4560 | |
| 4514 | 4561 | /* validate instruction */ |
| 4515 | 4562 | assert(inst->size == 4 || inst->size == 8); |
| 4516 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4563 | assert_no_condition(inst); | |
| 4564 | assert_flags(inst, DRCUML_FLAG_S | DRCUML_FLAG_Z); | |
| 4517 | 4565 | |
| 4518 | 4566 | /* normalize parameters */ |
| 4519 | 4567 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI, &shiftp, PTYPE_MRI, &maskp, PTYPE_MRI); |
| 4520 | 4568 | |
| 4521 | /* degenerate cases -- convert to a move or simple shift */ | |
| 4522 | if (srcp.type == DRCUML_PTYPE_IMMEDIATE && shiftp.type == DRCUML_PTYPE_IMMEDIATE && maskp.type == DRCUML_PTYPE_IMMEDIATE) | |
| 4523 | { | |
| 4524 | if (inst->size == 4) | |
| 4525 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, ((srcp.value << shiftp.value) | (srcp.value >> (32 - shiftp.value))) & maskp.value); | |
| 4526 | else if (inst->size == 8) | |
| 4527 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, ((srcp.value << shiftp.value) | (srcp.value >> (64 - shiftp.value))) & maskp.value); | |
| 4528 | } | |
| 4529 | if (shiftp.type == DRCUML_PTYPE_IMMEDIATE && maskp.type == DRCUML_PTYPE_IMMEDIATE) | |
| 4530 | { | |
| 4531 | if ((inst->size == 4 && maskp.value == (UINT32)(0xffffffffUL << shiftp.value)) || (inst->size == 8 && maskp.value == U64(0xffffffffffffffff) << shiftp.value)) | |
| 4532 | { | |
| 4533 | drcuml_instruction temp = *inst; | |
| 4534 | temp.numparams = 3; | |
| 4535 | return op_shl(drcbe, dst, &temp); | |
| 4536 | } | |
| 4537 | if ((inst->size == 4 && maskp.value == (UINT32)(0xffffffffUL >> (32 - shiftp.value))) || (inst->size == 8 && maskp.value == U64(0xffffffffffffffff) >> (64 - shiftp.value))) | |
| 4538 | { | |
| 4539 | drcuml_instruction temp = *inst; | |
| 4540 | temp.numparams = 3; | |
| 4541 | temp.param[2].value = inst->size * 8 - temp.param[2].value; | |
| 4542 | return op_shr(drcbe, dst, &temp); | |
| 4543 | } | |
| 4544 | } | |
| 4545 | ||
| 4546 | 4569 | /* pick a target register for the general case */ |
| 4547 | 4570 | dstreg = param_select_register2(REG_EAX, &dstp, &shiftp, &maskp); |
| 4548 | 4571 | |
| r2844 | r2845 | |
| 4578 | 4601 | |
| 4579 | 4602 | /* validate instruction */ |
| 4580 | 4603 | assert(inst->size == 4 || inst->size == 8); |
| 4581 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4604 | assert_no_condition(inst); | |
| 4605 | assert_flags(inst, DRCUML_FLAG_S | DRCUML_FLAG_Z); | |
| 4582 | 4606 | |
| 4583 | 4607 | /* normalize parameters */ |
| 4584 | 4608 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI, &shiftp, PTYPE_MRI, &maskp, PTYPE_MRI); |
| r2844 | r2845 | |
| 4636 | 4660 | |
| 4637 | 4661 | /* validate instruction */ |
| 4638 | 4662 | assert(inst->size == 4 || inst->size == 8); |
| 4639 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 4663 | assert_no_condition(inst); | |
| 4664 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 4640 | 4665 | |
| 4641 | 4666 | /* normalize parameters */ |
| 4642 | 4667 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 4668 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 4643 | 4669 | |
| 4644 | /* degenerate cases -- convert to a move */ | |
| 4645 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 4646 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value + src2p.value); | |
| 4647 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 4648 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 4649 | ||
| 4650 | 4670 | /* pick a target register for the general case */ |
| 4651 | 4671 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 4652 | 4672 | |
| r2844 | r2845 | |
| 4658 | 4678 | emit_add_m32_p32(drcbe, &dst, MABS(drcbe, dstp.value), &src2p, inst); // add [dstp],src2p |
| 4659 | 4679 | |
| 4660 | 4680 | /* reg = reg + imm */ |
| 4661 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst-> | |
| 4681 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst-> | |
| 4662 | 4682 | emit_lea_r32_m32(&dst, dstp.value, MBD(src1p.value, src2p.value)); // lea dstp,[src1p+src2p] |
| 4663 | 4683 | |
| 4664 | 4684 | /* reg = reg + reg */ |
| 4665 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_INT_REGISTER && inst-> | |
| 4685 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_INT_REGISTER && inst-> | |
| 4666 | 4686 | emit_lea_r32_m32(&dst, dstp.value, MBISD(src1p.value, src2p.value, 1, 0)); // lea dstp,[src1p+src2p] |
| 4667 | 4687 | |
| 4668 | 4688 | /* general case */ |
| r2844 | r2845 | |
| 4682 | 4702 | emit_add_m64_p64(drcbe, &dst, MABS(drcbe, dstp.value), &src2p, inst); // add [dstp],src2p |
| 4683 | 4703 | |
| 4684 | 4704 | /* reg = reg + imm */ |
| 4685 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && short_immediate(src2p.value) && inst-> | |
| 4705 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && short_immediate(src2p.value) && inst-> | |
| 4686 | 4706 | emit_lea_r64_m64(&dst, dstp.value, MBD(src1p.value, src2p.value)); // lea dstp,[src1p+src2p] |
| 4687 | 4707 | |
| 4688 | 4708 | /* reg = reg + reg */ |
| 4689 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_INT_REGISTER && inst-> | |
| 4709 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_INT_REGISTER && inst-> | |
| 4690 | 4710 | emit_lea_r64_m64(&dst, dstp.value, MBISD(src1p.value, src2p.value, 1, 0)); // lea dstp,[src1p+src2p] |
| 4691 | 4711 | |
| 4692 | 4712 | /* general case */ |
| r2844 | r2845 | |
| 4712 | 4732 | |
| 4713 | 4733 | /* validate instruction */ |
| 4714 | 4734 | assert(inst->size == 4 || inst->size == 8); |
| 4715 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 4735 | assert_no_condition(inst); | |
| 4736 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 4716 | 4737 | |
| 4717 | 4738 | /* normalize parameters */ |
| 4718 | 4739 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| r2844 | r2845 | |
| 4730 | 4751 | /* general case */ |
| 4731 | 4752 | else |
| 4732 | 4753 | { |
| 4733 | emit_mov_r32_p32(drcbe, &dst, dstreg, &src1p); | |
| 4754 | emit_mov_r32_p32_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 4734 | 4755 | emit_adc_r32_p32(drcbe, &dst, dstreg, &src2p, inst); // adc dstreg,src2p |
| 4735 | 4756 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4736 | 4757 | } |
| r2844 | r2845 | |
| 4746 | 4767 | /* general case */ |
| 4747 | 4768 | else |
| 4748 | 4769 | { |
| 4749 | emit_mov_r64_p64(drcbe, &dst, dstreg, &src1p); | |
| 4770 | emit_mov_r64_p64_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 4750 | 4771 | emit_adc_r64_p64(drcbe, &dst, dstreg, &src2p, inst); // adc dstreg,src2p |
| 4751 | 4772 | emit_mov_p64_r64(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4752 | 4773 | } |
| r2844 | r2845 | |
| 4766 | 4787 | |
| 4767 | 4788 | /* validate instruction */ |
| 4768 | 4789 | assert(inst->size == 4 || inst->size == 8); |
| 4769 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 4790 | assert_no_condition(inst); | |
| 4791 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 4770 | 4792 | |
| 4771 | 4793 | /* normalize parameters */ |
| 4772 | 4794 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 4795 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 4773 | 4796 | |
| 4774 | /* degenerate cases -- convert to a move */ | |
| 4775 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 4776 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value - src2p.value); | |
| 4777 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 4778 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 4779 | ||
| 4780 | 4797 | /* pick a target register for the general case */ |
| 4781 | 4798 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 4782 | 4799 | |
| r2844 | r2845 | |
| 4788 | 4805 | emit_sub_m32_p32(drcbe, &dst, MABS(drcbe, dstp.value), &src2p, inst); // sub [dstp],src2p |
| 4789 | 4806 | |
| 4790 | 4807 | /* reg = reg - imm */ |
| 4791 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst-> | |
| 4808 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst-> | |
| 4792 | 4809 | emit_lea_r32_m32(&dst, dstp.value, MBD(src1p.value, -src2p.value)); // lea dstp,[src1p-src2p] |
| 4793 | 4810 | |
| 4794 | 4811 | /* general case */ |
| r2844 | r2845 | |
| 4808 | 4825 | emit_sub_m64_p64(drcbe, &dst, MABS(drcbe, dstp.value), &src2p, inst); // sub [dstp],src2p |
| 4809 | 4826 | |
| 4810 | 4827 | /* reg = reg - imm */ |
| 4811 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && short_immediate(src2p.type) && inst-> | |
| 4828 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && short_immediate(src2p.type) && inst-> | |
| 4812 | 4829 | emit_lea_r64_m64(&dst, dstp.value, MBD(src1p.value, -src2p.value)); // lea dstp,[src1p-src2p] |
| 4813 | 4830 | |
| 4814 | 4831 | /* general case */ |
| r2844 | r2845 | |
| 4834 | 4851 | |
| 4835 | 4852 | /* validate instruction */ |
| 4836 | 4853 | assert(inst->size == 4 || inst->size == 8); |
| 4837 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 4854 | assert_no_condition(inst); | |
| 4855 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 4838 | 4856 | |
| 4839 | 4857 | /* normalize parameters */ |
| 4840 | 4858 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| r2844 | r2845 | |
| 4852 | 4870 | /* general case */ |
| 4853 | 4871 | else |
| 4854 | 4872 | { |
| 4855 | emit_mov_r32_p32(drcbe, &dst, dstreg, &src1p); | |
| 4873 | emit_mov_r32_p32_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 4856 | 4874 | emit_sbb_r32_p32(drcbe, &dst, dstreg, &src2p, inst); // sbb dstreg,src2p |
| 4857 | 4875 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4858 | 4876 | } |
| r2844 | r2845 | |
| 4868 | 4886 | /* general case */ |
| 4869 | 4887 | else |
| 4870 | 4888 | { |
| 4871 | emit_mov_r64_p64(drcbe, &dst, dstreg, &src1p); | |
| 4889 | emit_mov_r64_p64_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 4872 | 4890 | emit_sbb_r64_p64(drcbe, &dst, dstreg, &src2p, inst); // sbb dstreg,src2p |
| 4873 | 4891 | emit_mov_p64_r64(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4874 | 4892 | } |
| r2844 | r2845 | |
| 4888 | 4906 | |
| 4889 | 4907 | /* validate instruction */ |
| 4890 | 4908 | assert(inst->size == 4 || inst->size == 8); |
| 4891 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 4909 | assert_no_condition(inst); | |
| 4910 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 4892 | 4911 | |
| 4893 | 4912 | /* normalize parameters */ |
| 4894 | 4913 | param_normalize_2(drcbe, inst, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 4895 | 4914 | |
| 4896 | /* degenerate cases */ | |
| 4897 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && src1p.value == src2p.value) | |
| 4898 | { | |
| 4899 | emit_cmp_r32_r32(&dst, REG_EAX, REG_EAX); // cmp eax,eax | |
| 4900 | return dst; | |
| 4901 | } | |
| 4902 | ||
| 4903 | 4915 | /* pick a target register for the general case */ |
| 4904 | 4916 | src1reg = param_select_register(REG_EAX, &src1p, NULL); |
| 4905 | 4917 | |
| r2844 | r2845 | |
| 4949 | 4961 | |
| 4950 | 4962 | /* validate instruction */ |
| 4951 | 4963 | assert(inst->size == 4 || inst->size == 8); |
| 4952 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 4964 | assert_no_condition(inst); | |
| 4965 | assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 4953 | 4966 | |
| 4954 | 4967 | /* normalize parameters */ |
| 4955 | 4968 | param_normalize_4_commutative(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 4956 | 4969 | compute_hi = (dstp.type != edstp.type || dstp.value != edstp.value); |
| 4957 | 4970 | |
| 4958 | /* degenerate cases -- convert to a move */ | |
| 4959 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 4960 | { | |
| 4961 | if (inst->size == 4) | |
| 4962 | { | |
| 4963 | if (!compute_hi) | |
| 4964 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT32)src1p.value * (UINT32)src2p.value); | |
| 4965 | else | |
| 4966 | { | |
| 4967 | UINT64 result = (UINT64)(UINT32)src1p.value * (UINT64)(UINT32)src2p.value; | |
| 4968 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, result & 0xffffffff); | |
| 4969 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, result >> 32); | |
| 4970 | } | |
| 4971 | } | |
| 4972 | } | |
| 4973 | ||
| 4974 | 4971 | /* 32-bit form */ |
| 4975 | 4972 | if (inst->size == 4) |
| 4976 | 4973 | { |
| r2844 | r2845 | |
| 4990 | 4987 | emit_mov_p32_r32(drcbe, &dst, &edstp, REG_EDX); // mov edstp,edx |
| 4991 | 4988 | |
| 4992 | 4989 | /* compute flags */ |
| 4993 | if (inst-> | |
| 4990 | if (inst-> | |
| 4994 | 4991 | { |
| 4995 | 4992 | if (compute_hi) |
| 4996 | 4993 | { |
| 4997 | if (inst-> | |
| 4994 | if (inst-> | |
| 4998 | 4995 | emit_or_r32_r32(&dst, REG_EDX, REG_EAX); // or edx,eax |
| 4999 | else if (inst-> | |
| 4996 | else if (inst-> | |
| 5000 | 4997 | emit_test_r32_r32(&dst, REG_EDX, REG_EDX); // test edx,edx |
| 5001 | 4998 | else |
| 5002 | 4999 | { |
| r2844 | r2845 | |
| 5030 | 5027 | emit_mov_p64_r64(drcbe, &dst, &edstp, REG_RDX); // mov edstp,rdx |
| 5031 | 5028 | |
| 5032 | 5029 | /* compute flags */ |
| 5033 | if (inst-> | |
| 5030 | if (inst-> | |
| 5034 | 5031 | { |
| 5035 | 5032 | if (compute_hi) |
| 5036 | 5033 | { |
| 5037 | if (inst-> | |
| 5034 | if (inst-> | |
| 5038 | 5035 | emit_or_r64_r64(&dst, REG_RDX, REG_RAX); // or rdx,rax |
| 5039 | else if (inst-> | |
| 5036 | else if (inst-> | |
| 5040 | 5037 | emit_test_r64_r64(&dst, REG_RDX, REG_RDX); // test rdx,rdx |
| 5041 | 5038 | else |
| 5042 | 5039 | { |
| r2844 | r2845 | |
| 5065 | 5062 | |
| 5066 | 5063 | /* validate instruction */ |
| 5067 | 5064 | assert(inst->size == 4 || inst->size == 8); |
| 5068 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5065 | assert_no_condition(inst); | |
| 5066 | assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5069 | 5067 | |
| 5070 | 5068 | /* normalize parameters */ |
| 5071 | 5069 | param_normalize_4_commutative(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5072 | 5070 | compute_hi = (dstp.type != edstp.type || dstp.value != edstp.value); |
| 5073 | 5071 | |
| 5074 | /* degenerate cases -- convert to a move */ | |
| 5075 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5076 | { | |
| 5077 | if (inst->size == 4) | |
| 5078 | { | |
| 5079 | if (!compute_hi) | |
| 5080 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)src1p.value * (INT32)src2p.value); | |
| 5081 | else | |
| 5082 | { | |
| 5083 | UINT64 result = (INT64)(INT32)src1p.value * (INT64)(INT32)src2p.value; | |
| 5084 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, result & 0xffffffff); | |
| 5085 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, result >> 32); | |
| 5086 | } | |
| 5087 | } | |
| 5088 | } | |
| 5089 | ||
| 5090 | 5072 | /* 32-bit form */ |
| 5091 | 5073 | if (inst->size == 4) |
| 5092 | 5074 | { |
| r2844 | r2845 | |
| 5129 | 5111 | } |
| 5130 | 5112 | |
| 5131 | 5113 | /* compute flags */ |
| 5132 | if (inst-> | |
| 5114 | if (inst-> | |
| 5133 | 5115 | { |
| 5134 | 5116 | if (compute_hi) |
| 5135 | 5117 | { |
| 5136 | if (inst-> | |
| 5118 | if (inst-> | |
| 5137 | 5119 | emit_or_r32_r32(&dst, REG_EDX, REG_EAX); // or edx,eax |
| 5138 | else if (inst-> | |
| 5120 | else if (inst-> | |
| 5139 | 5121 | emit_test_r32_r32(&dst, REG_EDX, REG_EDX); // test edx,edx |
| 5140 | 5122 | else |
| 5141 | 5123 | { |
| r2844 | r2845 | |
| 5192 | 5174 | } |
| 5193 | 5175 | |
| 5194 | 5176 | /* compute flags */ |
| 5195 | if (inst-> | |
| 5177 | if (inst-> | |
| 5196 | 5178 | { |
| 5197 | 5179 | if (compute_hi) |
| 5198 | 5180 | { |
| 5199 | if (inst-> | |
| 5181 | if (inst-> | |
| 5200 | 5182 | emit_or_r64_r64(&dst, REG_RDX, REG_RAX); // or rdx,rax |
| 5201 | else if (inst-> | |
| 5183 | else if (inst-> | |
| 5202 | 5184 | emit_test_r64_r64(&dst, REG_RDX, REG_RDX); // test rdx,rdx |
| 5203 | 5185 | else |
| 5204 | 5186 | { |
| r2844 | r2845 | |
| 5228 | 5210 | |
| 5229 | 5211 | /* validate instruction */ |
| 5230 | 5212 | assert(inst->size == 4 || inst->size == 8); |
| 5231 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5213 | assert_no_condition(inst); | |
| 5214 | assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5232 | 5215 | |
| 5233 | 5216 | /* normalize parameters */ |
| 5234 | 5217 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5235 | 5218 | compute_rem = (dstp.type != edstp.type || dstp.value != edstp.value); |
| 5236 | 5219 | |
| 5237 | /* degenerate cases -- convert to a move */ | |
| 5238 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5239 | { | |
| 5240 | if (inst->size == 4) | |
| 5241 | { | |
| 5242 | if ((UINT32)src2p.value == 0) | |
| 5243 | return dst; | |
| 5244 | if (!compute_rem) | |
| 5245 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT32)src1p.value / (UINT32)src2p.value); | |
| 5246 | else | |
| 5247 | { | |
| 5248 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT32)src1p.value / (UINT32)src2p.value); | |
| 5249 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT32)src1p.value % (UINT32)src2p.value); | |
| 5250 | } | |
| 5251 | } | |
| 5252 | else if (inst->size == 8) | |
| 5253 | { | |
| 5254 | UINT64 reslo, reshi; | |
| 5255 | if (src2p.value == 0) | |
| 5256 | return dst; | |
| 5257 | if (!compute_rem) | |
| 5258 | { | |
| 5259 | reslo = (UINT64)src1p.value / (UINT64)src2p.value; | |
| 5260 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5261 | } | |
| 5262 | else | |
| 5263 | { | |
| 5264 | reslo = (UINT64)src1p.value / (UINT64)src2p.value; | |
| 5265 | reshi = (UINT64)src1p.value % (UINT64)src2p.value; | |
| 5266 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5267 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reshi); | |
| 5268 | } | |
| 5269 | } | |
| 5270 | } | |
| 5271 | ||
| 5272 | 5220 | /* 32-bit form */ |
| 5273 | 5221 | if (inst->size == 4) |
| 5274 | 5222 | { |
| r2844 | r2845 | |
| 5281 | 5229 | emit_mov_p32_r32(drcbe, &dst, &dstp, REG_EAX); // mov dstp,eax |
| 5282 | 5230 | if (compute_rem) |
| 5283 | 5231 | emit_mov_p32_r32(drcbe, &dst, &edstp, REG_EDX); // mov edstp,edx |
| 5232 | if (inst->flags != 0) | |
| 5233 | emit_test_r32_r32(&dst, REG_EAX, REG_EAX); // test eax,eax | |
| 5284 | 5234 | resolve_link(&dst, &skip); // skip: |
| 5285 | 5235 | } |
| 5286 | 5236 | |
| r2844 | r2845 | |
| 5296 | 5246 | emit_mov_p64_r64(drcbe, &dst, &dstp, REG_RAX); // mov dstp,rax |
| 5297 | 5247 | if (compute_rem) |
| 5298 | 5248 | emit_mov_p64_r64(drcbe, &dst, &edstp, REG_RDX); // mov edstp,rdx |
| 5249 | if (inst->flags != 0) | |
| 5250 | emit_test_r64_r64(&dst, REG_RAX, REG_RAX); // test eax,eax | |
| 5299 | 5251 | resolve_link(&dst, &skip); // skip: |
| 5300 | 5252 | } |
| 5301 | 5253 | return dst; |
| r2844 | r2845 | |
| 5314 | 5266 | |
| 5315 | 5267 | /* validate instruction */ |
| 5316 | 5268 | assert(inst->size == 4 || inst->size == 8); |
| 5317 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5269 | assert_no_condition(inst); | |
| 5270 | assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5318 | 5271 | |
| 5319 | 5272 | /* normalize parameters */ |
| 5320 | 5273 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5321 | 5274 | compute_rem = (dstp.type != edstp.type || dstp.value != edstp.value); |
| 5322 | 5275 | |
| 5323 | /* degenerate cases -- convert to a move */ | |
| 5324 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5325 | { | |
| 5326 | if (inst->size == 4) | |
| 5327 | { | |
| 5328 | if ((INT32)src2p.value == 0) | |
| 5329 | return dst; | |
| 5330 | if (!compute_rem) | |
| 5331 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)src1p.value / (INT32)src2p.value); | |
| 5332 | else | |
| 5333 | { | |
| 5334 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)src1p.value / (INT32)src2p.value); | |
| 5335 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)src1p.value % (INT32)src2p.value); | |
| 5336 | } | |
| 5337 | } | |
| 5338 | else if (inst->size == 8) | |
| 5339 | { | |
| 5340 | UINT64 reslo, reshi; | |
| 5341 | if (src2p.value == 0) | |
| 5342 | return dst; | |
| 5343 | if (!compute_rem) | |
| 5344 | { | |
| 5345 | reslo = (INT64)src1p.value / (INT64)src2p.value; | |
| 5346 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5347 | } | |
| 5348 | else | |
| 5349 | { | |
| 5350 | reslo = (INT64)src1p.value / (INT64)src2p.value; | |
| 5351 | reshi = (INT64)src1p.value % (INT64)src2p.value; | |
| 5352 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5353 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reshi); | |
| 5354 | } | |
| 5355 | } | |
| 5356 | } | |
| 5357 | ||
| 5358 | 5276 | /* 32-bit form */ |
| 5359 | 5277 | if (inst->size == 4) |
| 5360 | 5278 | { |
| r2844 | r2845 | |
| 5367 | 5285 | emit_mov_p32_r32(drcbe, &dst, &dstp, REG_EAX); // mov dstp,eax |
| 5368 | 5286 | if (compute_rem) |
| 5369 | 5287 | emit_mov_p32_r32(drcbe, &dst, &edstp, REG_EDX); // mov edstp,edx |
| 5288 | if (inst->flags != 0) | |
| 5289 | emit_test_r32_r32(&dst, REG_EAX, REG_EAX); // test eax,eax | |
| 5370 | 5290 | resolve_link(&dst, &skip); // skip: |
| 5371 | 5291 | } |
| 5372 | 5292 | |
| r2844 | r2845 | |
| 5382 | 5302 | emit_mov_p64_r64(drcbe, &dst, &dstp, REG_RAX); // mov dstp,rax |
| 5383 | 5303 | if (compute_rem) |
| 5384 | 5304 | emit_mov_p64_r64(drcbe, &dst, &edstp, REG_RDX); // mov edstp,rdx |
| 5305 | if (inst->flags != 0) | |
| 5306 | emit_test_r64_r64(&dst, REG_RAX, REG_RAX); // test eax,eax | |
| 5385 | 5307 | resolve_link(&dst, &skip); // skip: |
| 5386 | 5308 | } |
| 5387 | 5309 | return dst; |
| r2844 | r2845 | |
| 5399 | 5321 | |
| 5400 | 5322 | /* validate instruction */ |
| 5401 | 5323 | assert(inst->size == 4 || inst->size == 8); |
| 5402 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5324 | assert_no_condition(inst); | |
| 5325 | assert_flags(inst, DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5403 | 5326 | |
| 5404 | 5327 | /* normalize parameters */ |
| 5405 | 5328 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5329 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5406 | 5330 | |
| 5407 | /* degenerate cases -- convert to a move */ | |
| 5408 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5409 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value & src2p.value); | |
| 5410 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && (src2p.value & size_to_mask[inst->size]) == size_to_mask[inst->size] && inst->condflags == 0) | |
| 5411 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5412 | ||
| 5413 | 5331 | /* pick a target register for the general case */ |
| 5414 | 5332 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5415 | 5333 | |
| r2844 | r2845 | |
| 5459 | 5377 | |
| 5460 | 5378 | /* validate instruction */ |
| 5461 | 5379 | assert(inst->size == 4 || inst->size == 8); |
| 5462 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5380 | assert_no_condition(inst); | |
| 5381 | assert_flags(inst, DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5463 | 5382 | |
| 5464 | 5383 | /* normalize parameters */ |
| 5465 | 5384 | param_normalize_2_commutative(drcbe, inst, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| r2844 | r2845 | |
| 5511 | 5430 | |
| 5512 | 5431 | /* validate instruction */ |
| 5513 | 5432 | assert(inst->size == 4 || inst->size == 8); |
| 5514 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5433 | assert_no_condition(inst); | |
| 5434 | assert_flags(inst, DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5515 | 5435 | |
| 5516 | 5436 | /* normalize parameters */ |
| 5517 | 5437 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5438 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5518 | 5439 | |
| 5519 | /* degenerate cases -- convert to a move */ | |
| 5520 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5521 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value | src2p.value); | |
| 5522 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 5523 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5524 | ||
| 5525 | 5440 | /* pick a target register for the general case */ |
| 5526 | 5441 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5527 | 5442 | |
| r2844 | r2845 | |
| 5571 | 5486 | |
| 5572 | 5487 | /* validate instruction */ |
| 5573 | 5488 | assert(inst->size == 4 || inst->size == 8); |
| 5574 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5489 | assert_no_condition(inst); | |
| 5490 | assert_flags(inst, DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5575 | 5491 | |
| 5576 | 5492 | /* normalize parameters */ |
| 5577 | 5493 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5494 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5578 | 5495 | |
| 5579 | /* degenerate cases -- convert to a move */ | |
| 5580 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5581 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value & src2p.value); | |
| 5582 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 5583 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5584 | ||
| 5585 | 5496 | /* pick a target register for the general case */ |
| 5586 | 5497 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5587 | 5498 | |
| r2844 | r2845 | |
| 5631 | 5542 | |
| 5632 | 5543 | /* validate instruction */ |
| 5633 | 5544 | assert(inst->size == 4 || inst->size == 8); |
| 5634 | assert(inst->condflags == 0); | |
| 5545 | assert_no_condition(inst); | |
| 5546 | assert_flags(inst, /*DRCUML_FLAG_Z | DRCUML_FLAG_S*/0); | |
| 5635 | 5547 | |
| 5636 | 5548 | /* normalize parameters */ |
| 5637 | 5549 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI); |
| 5550 | assert(srcp.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5638 | 5551 | |
| 5639 | /* degenerate cases -- convert to a move */ | |
| 5640 | if (srcp.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5641 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, count_leading_zeros(srcp.value)); | |
| 5642 | ||
| 5643 | 5552 | /* pick a target register for the general case */ |
| 5644 | dstreg = param_select_register(REG_EAX, &dstp, | |
| 5553 | dstreg = param_select_register(REG_EAX, &dstp, NULL | |
| 5645 | 5554 | |
| 5646 | 5555 | /* 32-bit form */ |
| 5647 | 5556 | if (inst->size == 4) |
| r2844 | r2845 | |
| 5677 | 5586 | |
| 5678 | 5587 | /* validate instruction */ |
| 5679 | 5588 | assert(inst->size == 4 || inst->size == 8); |
| 5680 | assert(inst->condflags == 0); | |
| 5589 | assert_no_condition(inst); | |
| 5590 | assert_flags(inst, /*DRCUML_FLAG_Z | DRCUML_FLAG_S*/0); | |
| 5681 | 5591 | |
| 5682 | 5592 | /* normalize parameters */ |
| 5683 | 5593 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI); |
| 5594 | assert(srcp.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5684 | 5595 | |
| 5685 | /* degenerate cases -- convert to a move */ | |
| 5686 | if (srcp.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5687 | { | |
| 5688 | if (inst->size == 4) | |
| 5689 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, FLIPENDIAN_INT32(srcp.value)); | |
| 5690 | else if (inst->size == 8) | |
| 5691 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, FLIPENDIAN_INT64(srcp.value)); | |
| 5692 | } | |
| 5693 | ||
| 5694 | 5596 | /* pick a target register for the general case */ |
| 5695 | dstreg = param_select_register(REG_RAX, &dstp, | |
| 5597 | dstreg = param_select_register(REG_RAX, &dstp, NULL | |
| 5696 | 5598 | |
| 5697 | 5599 | /* 32-bit form */ |
| 5698 | 5600 | if (inst->size == 4) |
| r2844 | r2845 | |
| 5724 | 5626 | |
| 5725 | 5627 | /* validate instruction */ |
| 5726 | 5628 | assert(inst->size == 4 || inst->size == 8); |
| 5727 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5629 | assert_no_condition(inst); | |
| 5630 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5728 | 5631 | |
| 5729 | 5632 | /* normalize parameters */ |
| 5730 | 5633 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5634 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5731 | 5635 | |
| 5732 | /* degenerate cases -- convert to a move */ | |
| 5733 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5734 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value << src2p.value); | |
| 5735 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 5736 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5737 | ||
| 5738 | 5636 | /* pick a target register for the general case */ |
| 5739 | 5637 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5740 | 5638 | |
| r2844 | r2845 | |
| 5784 | 5682 | |
| 5785 | 5683 | /* validate instruction */ |
| 5786 | 5684 | assert(inst->size == 4 || inst->size == 8); |
| 5787 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5685 | assert_no_condition(inst); | |
| 5686 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5788 | 5687 | |
| 5789 | 5688 | /* normalize parameters */ |
| 5790 | 5689 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5690 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5791 | 5691 | |
| 5792 | /* degenerate cases -- convert to a move */ | |
| 5793 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5794 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT64)src1p.value >> src2p.value); | |
| 5795 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 5796 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5797 | ||
| 5798 | 5692 | /* pick a target register for the general case */ |
| 5799 | 5693 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5800 | 5694 | |
| r2844 | r2845 | |
| 5844 | 5738 | |
| 5845 | 5739 | /* validate instruction */ |
| 5846 | 5740 | assert(inst->size == 4 || inst->size == 8); |
| 5847 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5741 | assert_no_condition(inst); | |
| 5742 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5848 | 5743 | |
| 5849 | 5744 | /* normalize parameters */ |
| 5850 | 5745 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5746 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5851 | 5747 | |
| 5852 | /* degenerate cases -- convert to a move */ | |
| 5853 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5854 | { | |
| 5855 | if (inst->size == 4) | |
| 5856 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)src1p.value >> src2p.value); | |
| 5857 | else if (inst->size == 8) | |
| 5858 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT64)src1p.value >> src2p.value); | |
| 5859 | } | |
| 5860 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 5861 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5862 | ||
| 5863 | 5748 | /* pick a target register for the general case */ |
| 5864 | 5749 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5865 | 5750 | |
| r2844 | r2845 | |
| 5909 | 5794 | |
| 5910 | 5795 | /* validate instruction */ |
| 5911 | 5796 | assert(inst->size == 4 || inst->size == 8); |
| 5912 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5797 | assert_no_condition(inst); | |
| 5798 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5913 | 5799 | |
| 5914 | 5800 | /* normalize parameters */ |
| 5915 | 5801 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5802 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5916 | 5803 | |
| 5917 | /* degenerate cases -- convert to a move */ | |
| 5918 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5919 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT64)src1p.value >> src2p.value); | |
| 5920 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 5921 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5922 | ||
| 5923 | 5804 | /* pick a target register for the general case */ |
| 5924 | 5805 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5925 | 5806 | |
| r2844 | r2845 | |
| 5969 | 5850 | |
| 5970 | 5851 | /* validate instruction */ |
| 5971 | 5852 | assert(inst->size == 4 || inst->size == 8); |
| 5972 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5853 | assert_no_condition(inst); | |
| 5854 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5973 | 5855 | |
| 5974 | 5856 | /* normalize parameters */ |
| 5975 | 5857 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5858 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5976 | 5859 | |
| 5977 | /* degenerate cases -- convert to a move */ | |
| 5978 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5979 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT64)src1p.value >> src2p.value); | |
| 5980 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 5981 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5982 | ||
| 5983 | 5860 | /* pick a target register for the general case */ |
| 5984 | 5861 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5985 | 5862 | |
| r2844 | r2845 | |
| 6029 | 5906 | |
| 6030 | 5907 | /* validate instruction */ |
| 6031 | 5908 | assert(inst->size == 4 || inst->size == 8); |
| 6032 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5909 | assert_no_condition(inst); | |
| 5910 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 6033 | 5911 | |
| 6034 | 5912 | /* normalize parameters */ |
| 6035 | 5913 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 6036 | 5914 | |
| 6037 | /* degenerate cases -- convert to a move */ | |
| 6038 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 6039 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT64)src1p.value >> src2p.value); | |
| 6040 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 6041 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 6042 | ||
| 6043 | 5915 | /* pick a target register for the general case */ |
| 6044 | 5916 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 6045 | 5917 | |
| r2844 | r2845 | |
| 6053 | 5925 | /* general case */ |
| 6054 | 5926 | else |
| 6055 | 5927 | { |
| 6056 | emit_mov_r32_p32(drcbe, &dst, dstreg, &src1p); | |
| 5928 | emit_mov_r32_p32_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 6057 | 5929 | emit_rcl_r32_p32(drcbe, &dst, dstreg, &src2p, inst); // rcl dstreg,src2p |
| 6058 | 5930 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 6059 | 5931 | } |
| r2844 | r2845 | |
| 6069 | 5941 | /* general case */ |
| 6070 | 5942 | else |
| 6071 | 5943 | { |
| 6072 | emit_mov_r64_p64(drcbe, &dst, dstreg, &src1p); | |
| 5944 | emit_mov_r64_p64_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 6073 | 5945 | emit_rcl_r64_p64(drcbe, &dst, dstreg, &src2p, inst); // rcl dstreg,src2p |
| 6074 | 5946 | emit_mov_p64_r64(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 6075 | 5947 | } |
| r2844 | r2845 | |
| 6089 | 5961 | |
| 6090 | 5962 | /* validate instruction */ |
| 6091 | 5963 | assert(inst->size == 4 || inst->size == 8); |
| 6092 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5964 | assert_no_condition(inst); | |
| 5965 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 6093 | 5966 | |
| 6094 | 5967 | /* normalize parameters */ |
| 6095 | 5968 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 6096 | 5969 | |
| 6097 | /* degenerate cases -- convert to a move */ | |
| 6098 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 6099 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT64)src1p.value >> src2p.value); | |
| 6100 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 6101 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 6102 | ||
| 6103 | 5970 | /* pick a target register for the general case */ |
| 6104 | 5971 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 6105 | 5972 | |
| r2844 | r2845 | |
| 6113 | 5980 | /* general case */ |
| 6114 | 5981 | else |
| 6115 | 5982 | { |
| 6116 | emit_mov_r32_p32(drcbe, &dst, dstreg, &src1p); | |
| 5983 | emit_mov_r32_p32_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 6117 | 5984 | emit_rcr_r32_p32(drcbe, &dst, dstreg, &src2p, inst); // rcr dstreg,src2p |
| 6118 | 5985 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 6119 | 5986 | } |
| r2844 | r2845 | |
| 6129 | 5996 | /* general case */ |
| 6130 | 5997 | else |
| 6131 | 5998 | { |
| 6132 | emit_mov_r64_p64(drcbe, &dst, dstreg, &src1p); | |
| 5999 | emit_mov_r64_p64_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 6133 | 6000 | emit_rcr_r64_p64(drcbe, &dst, dstreg, &src2p, inst); // rcr dstreg,src2p |
| 6134 | 6001 | emit_mov_p64_r64(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 6135 | 6002 | } |
| r2844 | r2845 | |
| 6155 | 6022 | |
| 6156 | 6023 | /* validate instruction */ |
| 6157 | 6024 | assert(inst->size == 4 || inst->size == 8); |
| 6158 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6025 | assert_no_condition(inst); | |
| 6026 | assert_no_flags(inst); | |
| 6159 | 6027 | |
| 6160 | 6028 | /* normalize parameters */ |
| 6161 | 6029 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &basep, PTYPE_M, &indp, PTYPE_MRI); |
| r2844 | r2845 | |
| 6209 | 6077 | |
| 6210 | 6078 | /* validate instruction */ |
| 6211 | 6079 | assert(inst->size == 4 || inst->size == 8); |
| 6212 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6080 | assert_no_condition(inst); | |
| 6081 | assert_no_flags(inst); | |
| 6213 | 6082 | |
| 6214 | 6083 | /* normalize parameters */ |
| 6215 | 6084 | param_normalize_3(drcbe, inst, &basep, PTYPE_M, &indp, PTYPE_MRI, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 6261 | 6130 | |
| 6262 | 6131 | /* validate instruction */ |
| 6263 | 6132 | assert(inst->size == 4 || inst->size == 8); |
| 6264 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6133 | assert_no_condition(inst); | |
| 6134 | assert_no_flags(inst); | |
| 6265 | 6135 | |
| 6266 | 6136 | /* normalize parameters */ |
| 6267 | 6137 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &addrp, PTYPE_MRI, &spacep, PTYPE_I); |
| r2844 | r2845 | |
| 6302 | 6172 | |
| 6303 | 6173 | /* validate instruction */ |
| 6304 | 6174 | assert(inst->size == 4 || inst->size == 8); |
| 6305 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6175 | assert_no_condition(inst); | |
| 6176 | assert_no_flags(inst); | |
| 6306 | 6177 | |
| 6307 | 6178 | /* normalize parameters */ |
| 6308 | 6179 | param_normalize_3(drcbe, inst, &addrp, PTYPE_MRI, &srcp, PTYPE_MF, &spacep, PTYPE_I); |
| r2844 | r2845 | |
| 6346 | 6217 | |
| 6347 | 6218 | /* validate instruction */ |
| 6348 | 6219 | assert(inst->size == 4 || inst->size == 8); |
| 6349 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 6220 | assert_any_condition(inst); | |
| 6221 | assert_no_flags(inst); | |
| 6350 | 6222 | |
| 6351 | 6223 | /* normalize parameters */ |
| 6352 | 6224 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 6355 | 6227 | dstreg = param_select_register(REG_XMM0, &dstp, NULL); |
| 6356 | 6228 | |
| 6357 | 6229 | /* always start with a jmp */ |
| 6358 | if (inst->condflags != DRCUML_COND_ALWAYS) | |
| 6359 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condflags), &skip); // jcc skip | |
| 6230 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 6231 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condition), &skip); // jcc skip | |
| 6360 | 6232 | |
| 6361 | 6233 | /* 32-bit form */ |
| 6362 | 6234 | if (inst->size == 4) |
| r2844 | r2845 | |
| 6373 | 6245 | } |
| 6374 | 6246 | |
| 6375 | 6247 | /* resolve the jump */ |
| 6376 | if (inst->cond | |
| 6248 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 6377 | 6249 | resolve_link(&dst, &skip); // skip: |
| 6378 | 6250 | return dst; |
| 6379 | 6251 | } |
| r2844 | r2845 | |
| 6390 | 6262 | |
| 6391 | 6263 | /* validate instruction */ |
| 6392 | 6264 | assert(inst->size == 4 || inst->size == 8); |
| 6393 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6265 | assert_no_condition(inst); | |
| 6266 | assert_no_flags(inst); | |
| 6394 | 6267 | |
| 6395 | 6268 | /* normalize parameters */ |
| 6396 | 6269 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MF, &sizep, PTYPE_I, &roundp, PTYPE_I); |
| r2844 | r2845 | |
| 6514 | 6387 | |
| 6515 | 6388 | /* validate instruction */ |
| 6516 | 6389 | assert(inst->size == 4 || inst->size == 8); |
| 6517 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6390 | assert_no_condition(inst); | |
| 6391 | assert_no_flags(inst); | |
| 6518 | 6392 | |
| 6519 | 6393 | /* normalize parameters */ |
| 6520 | 6394 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MRI, &sizep, PTYPE_I); |
| r2844 | r2845 | |
| 6598 | 6472 | |
| 6599 | 6473 | /* validate instruction */ |
| 6600 | 6474 | assert(inst->size == 4 || inst->size == 8); |
| 6601 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6475 | assert_no_condition(inst); | |
| 6476 | assert_no_flags(inst); | |
| 6602 | 6477 | |
| 6603 | 6478 | /* normalize parameters */ |
| 6604 | 6479 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF, &sizep, PTYPE_I); |
| r2844 | r2845 | |
| 6640 | 6515 | |
| 6641 | 6516 | /* validate instruction */ |
| 6642 | 6517 | assert(inst->size == 8); |
| 6643 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6518 | assert_no_condition(inst); | |
| 6519 | assert_no_flags(inst); | |
| 6644 | 6520 | |
| 6645 | 6521 | /* normalize parameters */ |
| 6646 | 6522 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 6670 | 6546 | |
| 6671 | 6547 | /* validate instruction */ |
| 6672 | 6548 | assert(inst->size == 4 || inst->size == 8); |
| 6673 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6549 | assert_no_condition(inst); | |
| 6550 | assert_no_flags(inst); | |
| 6674 | 6551 | |
| 6675 | 6552 | /* normalize parameters */ |
| 6676 | 6553 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MF, &src1p, PTYPE_MF, &src2p, PTYPE_MF); |
| r2844 | r2845 | |
| 6714 | 6591 | |
| 6715 | 6592 | /* validate instruction */ |
| 6716 | 6593 | assert(inst->size == 4 || inst->size == 8); |
| 6717 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6594 | assert_no_condition(inst); | |
| 6595 | assert_no_flags(inst); | |
| 6718 | 6596 | |
| 6719 | 6597 | /* normalize parameters */ |
| 6720 | 6598 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &src1p, PTYPE_MF, &src2p, PTYPE_MF); |
| r2844 | r2845 | |
| 6758 | 6636 | |
| 6759 | 6637 | /* validate instruction */ |
| 6760 | 6638 | assert(inst->size == 4 || inst->size == 8); |
| 6761 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_U)) == 0); | |
| 6639 | assert_no_condition(inst); | |
| 6640 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_U); | |
| 6762 | 6641 | |
| 6763 | 6642 | /* normalize parameters */ |
| 6764 | 6643 | param_normalize_2(drcbe, inst, &src1p, PTYPE_MF, &src2p, PTYPE_MF); |
| r2844 | r2845 | |
| 6800 | 6679 | |
| 6801 | 6680 | /* validate instruction */ |
| 6802 | 6681 | assert(inst->size == 4 || inst->size == 8); |
| 6803 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6682 | assert_no_condition(inst); | |
| 6683 | assert_no_flags(inst); | |
| 6804 | 6684 | |
| 6805 | 6685 | /* normalize parameters */ |
| 6806 | 6686 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MF, &src1p, PTYPE_MF, &src2p, PTYPE_MF); |
| r2844 | r2845 | |
| 6844 | 6724 | |
| 6845 | 6725 | /* validate instruction */ |
| 6846 | 6726 | assert(inst->size == 4 || inst->size == 8); |
| 6847 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6727 | assert_no_condition(inst); | |
| 6728 | assert_no_flags(inst); | |
| 6848 | 6729 | |
| 6849 | 6730 | /* normalize parameters */ |
| 6850 | 6731 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &src1p, PTYPE_MF, &src2p, PTYPE_MF); |
| r2844 | r2845 | |
| 6888 | 6769 | |
| 6889 | 6770 | /* validate instruction */ |
| 6890 | 6771 | assert(inst->size == 4 || inst->size == 8); |
| 6891 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6772 | assert_no_condition(inst); | |
| 6773 | assert_no_flags(inst); | |
| 6892 | 6774 | |
| 6893 | 6775 | /* normalize parameters */ |
| 6894 | 6776 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 6932 | 6814 | |
| 6933 | 6815 | /* validate instruction */ |
| 6934 | 6816 | assert(inst->size == 4 || inst->size == 8); |
| 6935 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6817 | assert_no_condition(inst); | |
| 6818 | assert_no_flags(inst); | |
| 6936 | 6819 | |
| 6937 | 6820 | /* normalize parameters */ |
| 6938 | 6821 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 6970 | 6853 | |
| 6971 | 6854 | /* validate instruction */ |
| 6972 | 6855 | assert(inst->size == 4 || inst->size == 8); |
| 6973 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6856 | assert_no_condition(inst); | |
| 6857 | assert_no_flags(inst); | |
| 6974 | 6858 | |
| 6975 | 6859 | /* normalize parameters */ |
| 6976 | 6860 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 7012 | 6896 | |
| 7013 | 6897 | /* validate instruction */ |
| 7014 | 6898 | assert(inst->size == 4 || inst->size == 8); |
| 7015 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6899 | assert_no_condition(inst); | |
| 6900 | assert_no_flags(inst); | |
| 7016 | 6901 | |
| 7017 | 6902 | /* normalize parameters */ |
| 7018 | 6903 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 7056 | 6941 | |
| 7057 | 6942 | /* validate instruction */ |
| 7058 | 6943 | assert(inst->size == 4 || inst->size == 8); |
| 7059 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6944 | assert_no_condition(inst); | |
| 6945 | assert_no_flags(inst); | |
| 7060 | 6946 | |
| 7061 | 6947 | /* normalize parameters */ |
| 7062 | 6948 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
|---|---|---|
| 114 | 114 | */ |
| 115 | 115 | |
| 116 | 116 | /* build a short opcode from the raw opcode and size */ |
| 117 | #define MAKE_OPCODE_SHORT(op, size, condflags) \ | |
| 118 | ((((size) == 8) << 0) | (((condflags) != 0) << 1) | ((op) << 2)) | |
| 117 | #define MAKE_OPCODE_SHORT(op, size, conditionorflags) \ | |
| 118 | ((((size) == 8) << 0) | (((conditionorflags) != 0) << 1) | ((op) << 2)) | |
| 119 | 119 | |
| 120 | 120 | /* build a full opcode from the raw opcode, size, condition/flags, and immediate count */ |
| 121 | #define MAKE_OPCODE_FULL(op, size, condflags, pwords) \ | |
| 122 | (MAKE_OPCODE_SHORT(op, size, condflags) | ((condflags & 0x80) ? (0x1000 << ((condflags) & 15)) : 0) | ((pwords) << 28)) | |
| 121 | #define MAKE_OPCODE_FULL(op, size, condition, flags, pwords) \ | |
| 122 | (MAKE_OPCODE_SHORT(op, size, (condition | flags)) | ((condition != DRCUML_COND_ALWAYS) ? (0x1000 << ((condition) & 15)) : 0) | ((pwords) << 28)) | |
| 123 | 123 | |
| 124 | 124 | /* extract various parts of the opcode */ |
| 125 | 125 | #define OPCODE_GET_SHORT(op) ((op) & 0xfff) |
| r2844 | r2845 | |
| 415 | 415 | drclabel_set_codeptr(drcbe->labels, inst->param[0].value, (drccodeptr)dst); |
| 416 | 416 | break; |
| 417 | 417 | |
| 418 | /* ignore COMMENT opcodes */ | |
| 418 | /* ignore COMMENT and NOP opcodes */ | |
| 419 | 419 | case DRCUML_OP_COMMENT: |
| 420 | case DRCUML_OP_NOP: | |
| 420 | 421 | break; |
| 421 | 422 | |
| 422 | 423 | /* when we hit a MAPVAR opcode, log the change for the current PC */ |
| r2844 | r2845 | |
| 431 | 432 | case DRCUML_OP_JMP: |
| 432 | 433 | assert(inst->numparams == 1); |
| 433 | 434 | assert(inst->param[0].type == DRCUML_PTYPE_IMMEDIATE); |
| 434 | (dst++)->i = MAKE_OPCODE_FULL(opcode, inst->size, inst->condflags, 1); | |
| 435 | (dst++)->i = MAKE_OPCODE_FULL(opcode, inst->size, inst->condition, inst->flags, 1); | |
| 435 | 436 | dst->inst = (drcbec_instruction *)drclabel_get_codeptr(drcbe->labels, inst->param[0].value, fixup_label, dst); |
| 436 | 437 | dst++; |
| 437 | 438 | break; |
| r2844 | r2845 | |
| 501 | 502 | immedwords = (immedbytes + sizeof(drcbec_instruction) - 1) / sizeof(drcbec_instruction); |
| 502 | 503 | |
| 503 | 504 | /* first item is the opcode, size, condition flags and length */ |
| 504 | (dst++)->i = MAKE_OPCODE_FULL(opcode, inst->size, inst->condflags, inst->numparams + immedwords); | |
| 505 | (dst++)->i = MAKE_OPCODE_FULL(opcode, inst->size, inst->condition, inst->flags, inst->numparams + immedwords); | |
| 505 | 506 | |
| 506 | 507 | /* immediates start after parameters */ |
| 507 | 508 | immed = dst + inst->numparams; |
| r2844 | r2845 | |
| 700 | 701 | break; |
| 701 | 702 | |
| 702 | 703 | case MAKE_OPCODE_SHORT(DRCUML_OP_GETFLGS, 4, 0): /* GETFLGS dst[,f] */ |
| 703 | case MAKE_OPCODE_SHORT(DRCUML_OP_GETFLGS, 4, 1): /* GETFLGS dst[,f] */ | |
| 704 | PARAM0 = flags; | |
| 704 | PARAM0 = flags & PARAM1; | |
| 705 | 705 | break; |
| 706 | 706 | |
| 707 | 707 | case MAKE_OPCODE_SHORT(DRCUML_OP_SAVE, 4, 0): /* SAVE dst */ |
| r2844 | r2845 | |
| 793 | 793 | (*active_address_space[PARAM3 / 16].accessors->write_dword_masked)(PARAM0, PARAM1, PARAM2); |
| 794 | 794 | break; |
| 795 | 795 | |
| 796 | case MAKE_OPCODE_SHORT(DRCUML_OP_CARRY, 4, | |
| 796 | case MAKE_OPCODE_SHORT(DRCUML_OP_CARRY, 4, 1): /* CARRY src,bitnum */ | |
| 797 | 797 | flags = (flags & ~DRCUML_FLAG_C) | ((PARAM0 >> (PARAM1 & 31)) & DRCUML_FLAG_C); |
| 798 | 798 | break; |
| 799 | 799 | |
| r2844 | r2845 | |
| 814 | 814 | PARAM0 = (INT8)PARAM1; |
| 815 | 815 | break; |
| 816 | 816 | |
| 817 | case MAKE_OPCODE_SHORT(DRCUML_OP_SEXT1, 4, 1): | |
| 818 | temp32 = (INT8)PARAM1; | |
| 819 | flags = FLAGS32_NZ(temp32); | |
| 820 | PARAM0 = temp32; | |
| 821 | break; | |
| 822 | ||
| 817 | 823 | case MAKE_OPCODE_SHORT(DRCUML_OP_SEXT2, 4, 0): /* SEXT2 dst,src */ |
| 818 | 824 | PARAM0 = (INT16)PARAM1; |
| 819 | 825 | break; |
| 820 | 826 | |
| 827 | case MAKE_OPCODE_SHORT(DRCUML_OP_SEXT2, 4, 1): | |
| 828 | temp32 = (INT16)PARAM1; | |
| 829 | flags = FLAGS32_NZ(temp32); | |
| 830 | PARAM0 = temp32; | |
| 831 | break; | |
| 832 | ||
| 821 | 833 | case MAKE_OPCODE_SHORT(DRCUML_OP_ROLAND, 4, 0): /* ROLAND dst,src,count,mask[,f] */ |
| 822 | 834 | shift = PARAM2 & 31; |
| 823 | 835 | PARAM0 = ((PARAM1 << shift) | (PARAM1 >> (32 - shift))) & PARAM3; |
| 824 | 836 | break; |
| 825 | 837 | |
| 838 | case MAKE_OPCODE_SHORT(DRCUML_OP_ROLAND, 4, 1): | |
| 839 | shift = PARAM2 & 31; | |
| 840 | temp32 = ((PARAM1 << shift) | (PARAM1 >> (32 - shift))) & PARAM3; | |
| 841 | flags = FLAGS32_NZ(temp32); | |
| 842 | PARAM0 = temp32; | |
| 843 | break; | |
| 844 | ||
| 826 | 845 | case MAKE_OPCODE_SHORT(DRCUML_OP_ROLINS, 4, 0): /* ROLINS dst,src,count,mask[,f] */ |
| 827 | 846 | shift = PARAM2 & 31; |
| 828 | 847 | PARAM0 = (PARAM0 & ~PARAM3) | (((PARAM1 << shift) | (PARAM1 >> (32 - shift))) & PARAM3); |
| 829 | 848 | break; |
| 830 | 849 | |
| 850 | case MAKE_OPCODE_SHORT(DRCUML_OP_ROLINS, 4, 1): | |
| 851 | shift = PARAM2 & 31; | |
| 852 | temp32 = (PARAM0 & ~PARAM3) | (((PARAM1 << shift) | (PARAM1 >> (32 - shift))) & PARAM3); | |
| 853 | flags = FLAGS32_NZ(temp32); | |
| 854 | PARAM0 = temp32; | |
| 855 | break; | |
| 856 | ||
| 831 | 857 | case MAKE_OPCODE_SHORT(DRCUML_OP_ADD, 4, 0): /* ADD dst,src1,src2[,f] */ |
| 832 | 858 | PARAM0 = PARAM1 + PARAM2; |
| 833 | 859 | break; |
| r2844 | r2845 | |
| 982 | 1008 | PARAM0 = count_leading_zeros(PARAM1); |
| 983 | 1009 | break; |
| 984 | 1010 | |
| 1011 | case MAKE_OPCODE_SHORT(DRCUML_OP_LZCNT, 4, 1): | |
| 1012 | temp32 = count_leading_zeros(PARAM1); | |
| 1013 | flags = FLAGS32_NZ(temp32); | |
| 1014 | PARAM0 = temp32; | |
| 1015 | break; | |
| 1016 | ||
| 985 | 1017 | case MAKE_OPCODE_SHORT(DRCUML_OP_BSWAP, 4, 0): /* BSWAP dst,src */ |
| 986 | 1018 | temp32 = PARAM1; |
| 987 | 1019 | PARAM0 = FLIPENDIAN_INT32(temp32); |
| 988 | 1020 | break; |
| 989 | 1021 | |
| 1022 | case MAKE_OPCODE_SHORT(DRCUML_OP_BSWAP, 4, 1): | |
| 1023 | temp32 = PARAM1; | |
| 1024 | flags = FLAGS32_NZ(temp32); | |
| 1025 | PARAM0 = FLIPENDIAN_INT32(temp32); | |
| 1026 | break; | |
| 1027 | ||
| 990 | 1028 | case MAKE_OPCODE_SHORT(DRCUML_OP_SHL, 4, 0): /* SHL dst,src,count[,f] */ |
| 991 | 1029 | PARAM0 = PARAM1 << (PARAM2 & 31); |
| 992 | 1030 | break; |
| r2844 | r2845 | |
| 1215 | 1253 | DPARAM0 = (INT8)PARAM1; |
| 1216 | 1254 | break; |
| 1217 | 1255 | |
| 1256 | case MAKE_OPCODE_SHORT(DRCUML_OP_SEXT1, 8, 1): | |
| 1257 | temp64 = (INT8)PARAM1; | |
| 1258 | flags = FLAGS64_NZ(temp64); | |
| 1259 | DPARAM0 = temp64; | |
| 1260 | break; | |
| 1261 | ||
| 1218 | 1262 | case MAKE_OPCODE_SHORT(DRCUML_OP_SEXT2, 8, 0): /* DSEXT dst,src,WORD */ |
| 1219 | 1263 | DPARAM0 = (INT16)PARAM1; |
| 1220 | 1264 | break; |
| 1221 | 1265 | |
| 1266 | case MAKE_OPCODE_SHORT(DRCUML_OP_SEXT2, 8, 1): | |
| 1267 | temp64 = (INT16)PARAM1; | |
| 1268 | flags = FLAGS64_NZ(temp64); | |
| 1269 | DPARAM0 = temp64; | |
| 1270 | break; | |
| 1271 | ||
| 1222 | 1272 | case MAKE_OPCODE_SHORT(DRCUML_OP_SEXT4, 8, 0): /* DSEXT dst,src,DWORD */ |
| 1223 | 1273 | DPARAM0 = (INT32)PARAM1; |
| 1224 | 1274 | break; |
| 1225 | 1275 | |
| 1276 | case MAKE_OPCODE_SHORT(DRCUML_OP_SEXT4, 8, 1): | |
| 1277 | temp64 = (INT32)PARAM1; | |
| 1278 | flags = FLAGS64_NZ(temp64); | |
| 1279 | DPARAM0 = temp64; | |
| 1280 | break; | |
| 1281 | ||
| 1226 | 1282 | case MAKE_OPCODE_SHORT(DRCUML_OP_ROLAND, 8, 0): /* DROLAND dst,src,count,mask[,f] */ |
| 1227 | 1283 | shift = DPARAM2 & 63; |
| 1228 | 1284 | DPARAM0 = ((DPARAM1 << shift) | (DPARAM1 >> (64 - shift))) & DPARAM3; |
| 1229 | 1285 | break; |
| 1230 | 1286 | |
| 1287 | case MAKE_OPCODE_SHORT(DRCUML_OP_ROLAND, 8, 1): | |
| 1288 | shift = DPARAM2 & 63; | |
| 1289 | temp64 = ((DPARAM1 << shift) | (DPARAM1 >> (64 - shift))) & DPARAM3; | |
| 1290 | flags = FLAGS64_NZ(temp64); | |
| 1291 | DPARAM0 = temp64; | |
| 1292 | break; | |
| 1293 | ||
| 1231 | 1294 | case MAKE_OPCODE_SHORT(DRCUML_OP_ROLINS, 8, 0): /* DROLINS dst,src,count,mask[,f] */ |
| 1232 | 1295 | shift = DPARAM2 & 63; |
| 1233 | 1296 | DPARAM0 = (DPARAM0 & ~DPARAM3) | (((DPARAM1 << shift) | (DPARAM1 >> (64 - shift))) & DPARAM3); |
| 1234 | 1297 | break; |
| 1235 | 1298 | |
| 1299 | case MAKE_OPCODE_SHORT(DRCUML_OP_ROLINS, 8, 1): | |
| 1300 | shift = DPARAM2 & 63; | |
| 1301 | temp64 = (DPARAM0 & ~DPARAM3) | (((DPARAM1 << shift) | (DPARAM1 >> (64 - shift))) & DPARAM3); | |
| 1302 | flags = FLAGS64_NZ(temp64); | |
| 1303 | DPARAM0 = temp64; | |
| 1304 | break; | |
| 1305 | ||
| 1236 | 1306 | case MAKE_OPCODE_SHORT(DRCUML_OP_ADD, 8, 0): /* DADD dst,src1,src2[,f] */ |
| 1237 | 1307 | DPARAM0 = DPARAM1 + DPARAM2; |
| 1238 | 1308 | break; |
| r2844 | r2845 | |
| 1380 | 1450 | DPARAM0 = 32 + count_leading_zeros(DPARAM1); |
| 1381 | 1451 | break; |
| 1382 | 1452 | |
| 1453 | case MAKE_OPCODE_SHORT(DRCUML_OP_LZCNT, 8, 1): | |
| 1454 | if ((UINT32)(DPARAM1 >> 32) != 0) | |
| 1455 | temp64 = count_leading_zeros(DPARAM1 >> 32); | |
| 1456 | else | |
| 1457 | temp64 = 32 + count_leading_zeros(DPARAM1); | |
| 1458 | flags = FLAGS64_NZ(temp64); | |
| 1459 | DPARAM0 = temp64; | |
| 1460 | break; | |
| 1461 | ||
| 1383 | 1462 | case MAKE_OPCODE_SHORT(DRCUML_OP_BSWAP, 8, 0): /* DBSWAP dst,src */ |
| 1384 | 1463 | temp64 = DPARAM1; |
| 1385 | 1464 | DPARAM0 = FLIPENDIAN_INT64(temp64); |
| 1386 | 1465 | break; |
| 1387 | 1466 | |
| 1467 | case MAKE_OPCODE_SHORT(DRCUML_OP_BSWAP, 8, 1): | |
| 1468 | temp64 = DPARAM1; | |
| 1469 | flags = FLAGS64_NZ(temp64); | |
| 1470 | DPARAM0 = FLIPENDIAN_INT64(temp64); | |
| 1471 | break; | |
| 1472 | ||
| 1388 | 1473 | case MAKE_OPCODE_SHORT(DRCUML_OP_SHL, 8, 0): /* DSHL dst,src,count[,f] */ |
| 1389 | 1474 | DPARAM0 = DPARAM1 << (DPARAM2 & 63); |
| 1390 | 1475 | break; |
| r2844 | r2845 | |
|---|---|---|
| 915 | 915 | |
| 916 | 916 | EN = y; |
| 917 | 917 | |
| 918 | if ( | |
| 918 | if ( | |
| 919 | 919 | { |
| 920 | OUT_L( | |
| 920 | OUT_L(Q); | |
| 921 | 921 | } |
| 922 | 922 | } |
| 923 | 923 |
| r2844 | r2845 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | #include "410ops.c" |
| 19 | 19 | |
| 20 | #define IN_IN() IN(COP400_PORT_IN) | |
| 20 | #define IN_IN() (R.IN_mask ? IN(COP400_PORT_IN) : 0) | |
| 21 | 21 | |
| 22 | 22 | /* Arithmetic Instructions */ |
| 23 | 23 | |
| r2844 | r2845 | |
| 245 | 245 | |
| 246 | 246 | /* |
| 247 | 247 | |
| 248 | Processor: COP421 | |
| 249 | ||
| 250 | Mnemonic: INIL | |
| 251 | ||
| 252 | Hex Code: 33 29 | |
| 253 | Binary: | |
| 254 | ||
| 255 | Data Flow: "0",CKO,"0","0" -> A | |
| 256 | ||
| 257 | Description: Input CKO to A | |
| 258 | ||
| 259 | */ | |
| 260 | ||
| 261 | INSTRUCTION(cop421_inil) | |
| 262 | { | |
| 263 | A = IN_CKO() << 2; | |
| 264 | } | |
| 265 | ||
| 266 | /* | |
| 267 | ||
| 268 | 248 | Mnemonic: OGI |
| 269 | 249 | |
| 270 | 250 | Operand: y |
| r2844 | r2845 | |
|---|---|---|
| 14 | 14 | TODO: |
| 15 | 15 | |
| 16 | 16 | - when is the microbus int cleared? |
| 17 | - CKO sync input | |
| 18 | - save internal RAM when CKO is RAM power supply pin | |
| 17 | 19 | - run interrupt test suite |
| 18 | 20 | - run production test suite |
| 19 | 21 | - run microbus test suite |
| r2844 | r2845 | |
| 57 | 59 | UINT16 counter; |
| 58 | 60 | UINT8 G_mask; |
| 59 | 61 | UINT8 D_mask; |
| 62 | UINT8 IN_mask; | |
| 60 | 63 | UINT4 IL; |
| 61 | 64 | UINT4 in[4]; |
| 62 | 65 | UINT8 si; |
| r2844 | r2845 | |
| 227 | 230 | static TIMER_CALLBACK(cop420_counter_tick) |
| 228 | 231 | { |
| 229 | 232 | cpuintrf_push_context(param); |
| 233 | ||
| 230 | 234 | R.counter++; |
| 231 | 235 | |
| 232 | 236 | if (R.counter == 1024) |
| r2844 | r2845 | |
| 234 | 238 | R.counter = 0; |
| 235 | 239 | R.timerlatch = 1; |
| 236 | 240 | } |
| 241 | ||
| 237 | 242 | cpuintrf_pop_context(); |
| 238 | 243 | } |
| 239 | 244 | |
| r2844 | r2845 | |
| 245 | 250 | int i; |
| 246 | 251 | |
| 247 | 252 | cpuintrf_push_context(param); |
| 253 | ||
| 248 | 254 | in = IN_IN(); |
| 249 | 255 | for (i = 0; i < 4; i++) |
| 250 | 256 | { |
| r2844 | r2845 | |
| 255 | 261 | IL |= (1 << i); |
| 256 | 262 | } |
| 257 | 263 | } |
| 264 | ||
| 258 | 265 | cpuintrf_pop_context(); |
| 259 | 266 | } |
| 260 | 267 | |
| r2844 | r2845 | |
| 265 | 272 | UINT8 in; |
| 266 | 273 | |
| 267 | 274 | cpuintrf_push_context(param); |
| 275 | ||
| 268 | 276 | in = IN_IN(); |
| 277 | ||
| 269 | 278 | if (!BIT(in, 2)) |
| 270 | 279 | { |
| 271 | 280 | // chip select |
| r2844 | r2845 | |
| 287 | 296 | R.microbus_int = 0; |
| 288 | 297 | } |
| 289 | 298 | } |
| 299 | ||
| 290 | 300 | cpuintrf_pop_context(); |
| 291 | 301 | } |
| 292 | 302 | |
| r2844 | r2845 | |
| 305 | 315 | |
| 306 | 316 | /* set output pin masks */ |
| 307 | 317 | |
| 308 | R.G_mask = 0x0f; | |
| 309 | R.D_mask = 0x0f; | |
| 318 | R.G_mask = 0x0f; // G0-G3 available | |
| 319 | R.D_mask = 0x0f; // D0-D3 available | |
| 320 | R.IN_mask = 0x0f; // IN0-IN3 available | |
| 310 | 321 | |
| 311 | 322 | /* set clock divider */ |
| 312 | 323 | |
| r2844 | r2845 | |
| 375 | 386 | state_save_register_item("cop420", index, R.counter); |
| 376 | 387 | state_save_register_item("cop420", index, R.G_mask); |
| 377 | 388 | state_save_register_item("cop420", index, R.D_mask); |
| 389 | state_save_register_item("cop420", index, R.IN_mask); | |
| 378 | 390 | state_save_register_item("cop420", index, R.si); |
| 379 | 391 | state_save_register_item("cop420", index, R.last_skip); |
| 380 | 392 | state_save_register_item_array("cop420", index, R.in); |
| r2844 | r2845 | |
| 382 | 394 | state_save_register_item("cop420", index, R.halt); |
| 383 | 395 | } |
| 384 | 396 | |
| 397 | static void cop421_init(int index, int clock, const void *config, int (*irqcallback)(int)) | |
| 398 | { | |
| 399 | cop420_init(index, clock, config, irqcallback); | |
| 400 | ||
| 401 | /* microbus option is not available */ | |
| 402 | ||
| 403 | assert(R.intf->microbus != COP400_MICROBUS_ENABLED); | |
| 404 | ||
| 405 | /* set output pin masks */ | |
| 406 | ||
| 407 | R.IN_mask = 0; // IN lines not available | |
| 408 | } | |
| 409 | ||
| 385 | 410 | static void cop422_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 386 | 411 | { |
| 387 | 412 | cop420_init(index, clock, config, irqcallback); |
| 388 | 413 | |
| 414 | /* microbus option is not available */ | |
| 415 | ||
| 416 | assert(R.intf->microbus != COP400_MICROBUS_ENABLED); | |
| 417 | ||
| 418 | /* set output pin masks */ | |
| 419 | ||
| 389 | 420 | R.G_mask = 0x0e; // only G2, G3 available |
| 390 | 421 | R.D_mask = 0x0e; // only D2, D3 available |
| 422 | R.IN_mask = 0; // IN lines not available | |
| 391 | 423 | } |
| 392 | 424 | |
| 393 | 425 | /**************************************************************************** |
| r2844 | r2845 | |
| 652 | 684 | |
| 653 | 685 | switch (state) |
| 654 | 686 | { |
| 687 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 688 | case CPUINFO_PTR_INIT: info->init = cop421_init; break; | |
| 689 | ||
| 655 | 690 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 656 | 691 | case CPUINFO_STR_NAME: strcpy(info->s, "COP421"); break; |
| 657 | 692 | case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "National Semiconductor COPS"); break; |
| 658 | 693 | |
| 659 | default: cop4 | |
| 694 | default: cop420_get_info(state, info); break; | |
| 660 | 695 | } |
| 661 | 696 | } |
| 662 | 697 | |
| 663 | 698 | void cop422_get_info(UINT32 state, cpuinfo *info) |
| 664 | 699 | { |
| 665 | // COP422 is a 20-pin package version of the COP420, lacking the IN ports | |
| 700 | // COP422 is a 20-pin package version of the COP420, lacking G0/G1, D0/D1, and the IN ports | |
| 666 | 701 | |
| 667 | 702 | switch (state) |
| 668 | 703 | { |
| r2844 | r2845 | |
| 673 | 708 | case CPUINFO_STR_NAME: strcpy(info->s, "COP422"); break; |
| 674 | 709 | case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "National Semiconductor COPS"); break; |
| 675 | 710 | |
| 676 | default: cop4 | |
| 711 | default: cop420_get_info(state, info); break; | |
| 677 | 712 | } |
| 678 | 713 | } |
| 679 | 714 |
| r2844 | r2845 | |
|---|---|---|
| 39 | 39 | enum _cop400_cki_bond { |
| 40 | 40 | COP400_CKI_DIVISOR_4 = 4, |
| 41 | 41 | COP400_CKI_DIVISOR_8 = 8, |
| 42 | COP400_CKI_DIVISOR_16 = 16 | |
| 42 | COP400_CKI_DIVISOR_16 = 16, | |
| 43 | COP400_CKI_DIVISOR_32 = 32 | |
| 43 | 44 | }; |
| 44 | 45 | |
| 45 | 46 | typedef enum _cop400_cko_bond cop400_cko_bond; |
| 46 | 47 | enum _cop400_cko_bond { |
| 47 | 48 | COP400_CKO_OSCILLATOR_OUTPUT = 0, |
| 49 | COP400_CKO_RAM_POWER_SUPPLY, | |
| 48 | 50 | COP400_CKO_HALT_IO_PORT, |
| 51 | COP400_CKO_SYNC_INPUT, | |
| 49 | 52 | COP400_CKO_GENERAL_PURPOSE_INPUT |
| 50 | 53 | }; |
| 51 | 54 |
| r2844 | r2845 | |
|---|---|---|
| 36 | 36 | #define ADDR_RST75 0x003c |
| 37 | 37 | #define ADDR_INTR 0x0038 |
| 38 | 38 | |
| 39 | #define M_INR(R) ++R; I.AF.b.l=(I.AF.b.l&CF)|ZS[R]|((R==0x80)?VF:0)|((R&0x0F)?0:HF) | |
| 40 | #define M_DCR(R) I.AF.b.l=(I.AF.b.l&CF)|NF|((R==0x80)?VF:0)|((R&0x0F)?0:HF); I.AF.b.l|=ZS[--R] | |
| 39 | #define M_INR(R) {UINT8 hc = ((R & 0x0f) == 0x0f) ? HF : 0; ++R; I.AF.b.l= (I.AF.b.l & CF ) | ZSP[R] | hc; } | |
| 40 | #define M_DCR(R) {UINT8 hc = ((R & 0x0f) == 0x00) ? HF : 0; --R; I.AF.b.l= (I.AF.b.l & CF ) | ZSP[R] | hc | NF; } | |
| 41 | 41 | #define M_MVI(R) R=ARG() |
| 42 | 42 | |
| 43 | #define M_ANA(R) I.AF.b.h&=R; I.AF.b.l=ZSP[I.AF.b.h]|HF | |
| 43 | #define M_ANA(R) { int i = ((I.AF.b.h | R)>>3)&1 * HF; I.AF.b.h&=R; I.AF.b.l=ZSP[I.AF.b.h]; if( I.cputype ) { I.AF.b.l |= HF; } else {I.AF.b.l |= i; } } | |
| 44 | 44 | #define M_ORA(R) I.AF.b.h|=R; I.AF.b.l=ZSP[I.AF.b.h] |
| 45 | 45 | #define M_XRA(R) I.AF.b.h^=R; I.AF.b.l=ZSP[I.AF.b.h] |
| 46 | 46 | |
| 47 | 47 | #define M_RLC { \ |
| 48 | 48 | I.AF.b.h = (I.AF.b.h << 1) | (I.AF.b.h >> 7); \ |
| 49 | I.AF.b.l = (I.AF.b.l & | |
| 49 | I.AF.b.l = (I.AF.b.l & 0xfe | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | #define M_RRC { \ |
| 53 | I.AF.b.l = (I.AF.b.l & | |
| 53 | I.AF.b.l = (I.AF.b.l & 0xfe | |
| 54 | 54 | I.AF.b.h = (I.AF.b.h >> 1) | (I.AF.b.h << 7); \ |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | #define M_RAL { \ |
| 58 | 58 | int c = I.AF.b.l&CF; \ |
| 59 | I.AF.b.l = (I.AF.b.l & | |
| 59 | I.AF.b.l = (I.AF.b.l & 0xfe | |
| 60 | 60 | I.AF.b.h = (I.AF.b.h << 1) | c; \ |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | #define M_RAR { \ |
| 64 | 64 | int c = (I.AF.b.l&CF) << 7; \ |
| 65 | I.AF.b.l = (I.AF.b.l & | |
| 65 | I.AF.b.l = (I.AF.b.l & 0xfe | |
| 66 | 66 | I.AF.b.h = (I.AF.b.h >> 1) | c; \ |
| 67 | 67 | } |
| 68 | 68 | |
| r2844 | r2845 | |
| 141 | 141 | } \ |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | // On 8085 jump if condition is not satisfied is shorter | |
| 144 | 145 | #define M_JMP(cc) { \ |
| 145 | 146 | if (cc) { \ |
| 146 | i8085_ICount -= 3; \ | |
| 147 | 147 | I.PC.w.l = ARG16(); \ |
| 148 | change_pc(I.PC.d); \ | |
| 149 | } else I.PC.w.l += 2; \ | |
| 148 | change_pc(I.PC.d); \ | |
| 149 | } else { \ | |
| 150 | I.PC.w.l += 2; \ | |
| 151 | i8085_ICount += (I.cputype) ? 3 : 0; \ | |
| 152 | } \ | |
| 150 | 153 | } |
| 151 | 154 | |
| 155 | // On 8085 call if condition is not satisfied is 9 ticks | |
| 152 | 156 | #define M_CALL(cc) \ |
| 153 | 157 | { \ |
| 154 | 158 | if (cc) \ |
| 155 | 159 | { \ |
| 156 | 160 | UINT16 a = ARG16(); \ |
| 157 | i8085_ICount -= 6; | |
| 161 | i8085_ICount -= (I.cputype) ? 7 : 6 ; | |
| 158 | 162 | M_PUSH(PC); \ |
| 159 | 163 | I.PC.d = a; \ |
| 160 | change_pc(I.PC.d); \ | |
| 161 | } else I.PC.w.l += 2; \ | |
| 164 | change_pc(I.PC.d); \ | |
| 165 | } else { \ | |
| 166 | I.PC.w.l += 2; \ | |
| 167 | i8085_ICount += (I.cputype) ? 2 : 0; \ | |
| 168 | } \ | |
| 162 | 169 | } |
| 163 | 170 | |
| 164 | 171 | #define M_RST(nn) { \ |
| r2844 | r2845 | |
|---|---|---|
| 116 | 116 | * |
| 117 | 117 | * - Removed archaic i8080_EXACT flag. |
| 118 | 118 | * |
| 119 | * 08-June-2008 Miodrag Milanovic | |
| 120 | * | |
| 121 | * - Flag setting fix for some instructions and cycle count update | |
| 122 | * | |
| 119 | 123 | *****************************************************************************/ |
| 120 | 124 | |
| 121 | 125 | /*int survival_prot = 0; */ |
| r2844 | r2845 | |
| 196 | 200 | case 0x02: i8085_ICount -= 7; /* STAX B */ |
| 197 | 201 | WM(I.BC.d, I.AF.b.h); |
| 198 | 202 | break; |
| 199 | case 0x03: i8085_ICount -= 5; /* INX B */ | |
| 203 | case 0x03: i8085_ICount -= (I.cputype) ? 6 : 5; /* INX B */ | |
| 200 | 204 | I.BC.w.l++; |
| 201 | if (I.BC.b.l == 0x00) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 205 | if( I.cputype ) | |
| 206 | { | |
| 207 | if (I.BC.b.l == 0x00) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 208 | } | |
| 202 | 209 | break; |
| 203 | case 0x04: i8085_ICount -= 5; /* INR B */ | |
| 210 | case 0x04: i8085_ICount -= (I.cputype) ? 4 : 5; /* INR B */ | |
| 204 | 211 | M_INR(I.BC.b.h); |
| 205 | 212 | break; |
| 206 | case 0x05: i8085_ICount -= 5; /* DCR B */ | |
| 213 | case 0x05: i8085_ICount -= (I.cputype) ? 4 : 5; /* DCR B */ | |
| 207 | 214 | M_DCR(I.BC.b.h); |
| 208 | 215 | break; |
| 209 | 216 | case 0x06: i8085_ICount -= 7; /* MVI B,nn */ |
| r2844 | r2845 | |
| 227 | 234 | case 0x0a: i8085_ICount -= 7; /* LDAX B */ |
| 228 | 235 | I.AF.b.h = RM(I.BC.d); |
| 229 | 236 | break; |
| 230 | case 0x0b: i8085_ICount -= 5; /* DCX B */ | |
| 237 | case 0x0b: i8085_ICount -= (I.cputype) ? 6 : 5; /* DCX B */ | |
| 231 | 238 | I.BC.w.l--; |
| 232 | if (I.BC.b.l == 0xff) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 239 | if( I.cputype ) | |
| 240 | { | |
| 241 | if (I.BC.b.l == 0xff) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 242 | } | |
| 233 | 243 | break; |
| 234 | case 0x0c: i8085_ICount -= 5; /* INR C */ | |
| 244 | case 0x0c: i8085_ICount -= (I.cputype) ? 4 : 5; /* INR C */ | |
| 235 | 245 | M_INR(I.BC.b.l); |
| 236 | 246 | break; |
| 237 | case 0x0d: i8085_ICount -= 5; /* DCR C */ | |
| 247 | case 0x0d: i8085_ICount -= (I.cputype) ? 4 : 5; /* DCR C */ | |
| 238 | 248 | M_DCR(I.BC.b.l); |
| 239 | 249 | break; |
| 240 | 250 | case 0x0e: i8085_ICount -= 7; /* MVI C,nn */ |
| r2844 | r2845 | |
| 259 | 269 | case 0x12: i8085_ICount -= 7; /* STAX D */ |
| 260 | 270 | WM(I.DE.d, I.AF.b.h); |
| 261 | 271 | break; |
| 262 | case 0x13: i8085_ICount -= 5; /* INX D */ | |
| 272 | case 0x13: i8085_ICount -= (I.cputype) ? 6 : 5; /* INX D */ | |
| 263 | 273 | I.DE.w.l++; |
| 264 | if (I.DE.b.l == 0x00) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 274 | if( I.cputype ) | |
| 275 | { | |
| 276 | if (I.DE.b.l == 0x00) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 277 | } | |
| 265 | 278 | break; |
| 266 | case 0x14: i8085_ICount -= 5; /* INR D */ | |
| 279 | case 0x14: i8085_ICount -= (I.cputype) ? 4 : 5; /* INR D */ | |
| 267 | 280 | M_INR(I.DE.b.h); |
| 268 | 281 | break; |
| 269 | case 0x15: i8085_ICount -= 5; /* DCR D */ | |
| 282 | case 0x15: i8085_ICount -= (I.cputype) ? 4 : 5; /* DCR D */ | |
| 270 | 283 | M_DCR(I.DE.b.h); |
| 271 | 284 | break; |
| 272 | 285 | case 0x16: i8085_ICount -= 7; /* MVI D,nn */ |
| r2844 | r2845 | |
| 293 | 306 | case 0x1a: i8085_ICount -= 7; /* LDAX D */ |
| 294 | 307 | I.AF.b.h = RM(I.DE.d); |
| 295 | 308 | break; |
| 296 | case 0x1b: i8085_ICount -= 5; /* DCX D */ | |
| 309 | case 0x1b: i8085_ICount -= (I.cputype) ? 6 : 5; /* DCX D */ | |
| 297 | 310 | I.DE.w.l--; |
| 298 | if (I.DE.b.l == 0xff) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 311 | if( I.cputype ) | |
| 312 | { | |
| 313 | if (I.DE.b.l == 0xff) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 314 | } | |
| 299 | 315 | break; |
| 300 | case 0x1c: i8085_ICount -= 5; /* INR E */ | |
| 316 | case 0x1c: i8085_ICount -= (I.cputype) ? 4 : 5; /* INR E */ | |
| 301 | 317 | M_INR(I.DE.b.l); |
| 302 | 318 | break; |
| 303 | case 0x1d: i8085_ICount -= 5; /* DCR E */ | |
| 319 | case 0x1d: i8085_ICount -= (I.cputype) ? 4 : 5; /* DCR E */ | |
| 304 | 320 | M_DCR(I.DE.b.l); |
| 305 | 321 | break; |
| 306 | 322 | case 0x1e: i8085_ICount -= 7; /* MVI E,nn */ |
| r2844 | r2845 | |
| 330 | 346 | I.XX.w.l++; |
| 331 | 347 | WM(I.XX.d, I.HL.b.h); |
| 332 | 348 | break; |
| 333 | case 0x23: i8085_ICount -= 5; /* INX H */ | |
| 349 | case 0x23: i8085_ICount -= (I.cputype) ? 6 : 5; /* INX H */ | |
| 334 | 350 | I.HL.w.l++; |
| 335 | if (I.HL.b.l == 0x00) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 351 | if( I.cputype ) | |
| 352 | { | |
| 353 | if (I.HL.b.l == 0x00) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 354 | } | |
| 336 | 355 | break; |
| 337 | case 0x24: i8085_ICount -= 5; /* INR H */ | |
| 356 | case 0x24: i8085_ICount -= (I.cputype) ? 4 : 5; /* INR H */ | |
| 338 | 357 | M_INR(I.HL.b.h); |
| 339 | 358 | break; |
| 340 | case 0x25: i8085_ICount -= 5; /* DCR H */ | |
| 359 | case 0x25: i8085_ICount -= (I.cputype) ? 4 : 5; /* DCR H */ | |
| 341 | 360 | M_DCR(I.HL.b.h); |
| 342 | 361 | break; |
| 343 | 362 | case 0x26: i8085_ICount -= 7; /* MVI H,nn */ |
| r2844 | r2845 | |
| 349 | 368 | if (I.AF.b.l & HF) I.XX.d |= 0x200; |
| 350 | 369 | if (I.AF.b.l & NF) I.XX.d |= 0x400; |
| 351 | 370 | I.AF.w.l = DAA[I.XX.d]; |
| 371 | if( I.cputype==0 ) | |
| 372 | { | |
| 373 | I.AF.b.l &= 0xd5; // Ignore not used flags | |
| 374 | } | |
| 352 | 375 | break; |
| 353 | 376 | |
| 354 | 377 | case 0x28: |
| r2844 | r2845 | |
| 369 | 392 | I.XX.w.l++; |
| 370 | 393 | I.HL.b.h = RM(I.XX.d); |
| 371 | 394 | break; |
| 372 | case 0x2b: i8085_ICount -= 5; /* DCX H */ | |
| 395 | case 0x2b: i8085_ICount -= (I.cputype) ? 6 : 5; /* DCX H */ | |
| 373 | 396 | I.HL.w.l--; |
| 374 | if (I.HL.b.l == 0xff) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 397 | if( I.cputype ) | |
| 398 | { | |
| 399 | if (I.HL.b.l == 0xff) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 400 | } | |
| 375 | 401 | break; |
| 376 | case 0x2c: i8085_ICount -= 5; /* INR L */ | |
| 402 | case 0x2c: i8085_ICount -= (I.cputype) ? 4 : 5; /* INR L */ | |
| 377 | 403 | M_INR(I.HL.b.l); |
| 378 | 404 | break; |
| 379 | case 0x2d: i8085_ICount -= 5; /* DCR L */ | |
| 405 | case 0x2d: i8085_ICount -= (I.cputype) ? 4 : 5; /* DCR L */ | |
| 380 | 406 | M_DCR(I.HL.b.l); |
| 381 | 407 | break; |
| 382 | 408 | case 0x2e: i8085_ICount -= 7; /* MVI L,nn */ |
| r2844 | r2845 | |
| 425 | 451 | I.XX.d = ARG16(); |
| 426 | 452 | WM(I.XX.d, I.AF.b.h); |
| 427 | 453 | break; |
| 428 | case 0x33: i8085_ICount -= 5; /* INX SP */ | |
| 454 | case 0x33: i8085_ICount -= (I.cputype) ? 6 : 5; /* INX SP */ | |
| 429 | 455 | I.SP.w.l++; |
| 430 | if (I.SP.b.l == 0x00) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 456 | if( I.cputype ) | |
| 457 | { | |
| 458 | if (I.SP.b.l == 0x00) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 459 | } | |
| 431 | 460 | break; |
| 432 | 461 | case 0x34: i8085_ICount -= 10; /* INR M */ |
| 433 | 462 | I.XX.b.l = RM(I.HL.d); |
| r2844 | r2845 | |
| 444 | 473 | WM(I.HL.d, I.XX.b.l); |
| 445 | 474 | break; |
| 446 | 475 | case 0x37: i8085_ICount -= 4; /* STC */ |
| 447 | I.AF.b.l = (I.AF.b.l & | |
| 476 | I.AF.b.l = (I.AF.b.l & 0xfe | |
| 448 | 477 | break; |
| 449 | 478 | |
| 450 | 479 | case 0x38: |
| r2844 | r2845 | |
| 463 | 492 | I.XX.d = ARG16(); |
| 464 | 493 | I.AF.b.h = RM(I.XX.d); |
| 465 | 494 | break; |
| 466 | case 0x3b: i8085_ICount -= 5; /* DCX SP */ | |
| 495 | case 0x3b: i8085_ICount -= (I.cputype) ? 6 : 5; /* DCX SP */ | |
| 467 | 496 | I.SP.w.l--; |
| 468 | if (I.SP.b.l == 0xff) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 497 | if( I.cputype ) | |
| 498 | { | |
| 499 | if (I.SP.b.l == 0xff) I.AF.b.l |= XF; else I.AF.b.l &= ~XF; | |
| 500 | } | |
| 469 | 501 | break; |
| 470 | case 0x3c: i8085_ICount -= 5; /* INR A */ | |
| 502 | case 0x3c: i8085_ICount -= (I.cputype) ? 4 : 5; /* INR A */ | |
| 471 | 503 | M_INR(I.AF.b.h); |
| 472 | 504 | break; |
| 473 | case 0x3d: i8085_ICount -= 5; /* DCR A */ | |
| 505 | case 0x3d: i8085_ICount -= (I.cputype) ? 4 : 5; /* DCR A */ | |
| 474 | 506 | M_DCR(I.AF.b.h); |
| 475 | 507 | break; |
| 476 | 508 | case 0x3e: i8085_ICount -= 7; /* MVI A,nn */ |
| 477 | 509 | M_MVI(I.AF.b.h); |
| 478 | 510 | break; |
| 479 | case 0x3f: i8085_ICount -= 4; /* CMF */ | |
| 480 | I.AF.b.l = ((I.AF.b.l & ~(HF + NF)) | | |
| 481 | ((I.AF.b.l & CF) << 4)) ^ CF; | |
| 511 | case 0x3f: i8085_ICount -= 4; /* CMC */ | |
| 512 | I.AF.b.l = (I.AF.b.l & 0xfe) | ((I.AF.b.l & CF)==1 ? 0 : 1); | |
| 482 | 513 | break; |
| 483 | 514 | |
| 484 | case 0x40: i8085_ICount -= 5; /* MOV B,B */ | |
| 515 | case 0x40: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV B,B */ | |
| 485 | 516 | /* no op */ |
| 486 | 517 | break; |
| 487 | case 0x41: i8085_ICount -= 5; /* MOV B,C */ | |
| 518 | case 0x41: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV B,C */ | |
| 488 | 519 | I.BC.b.h = I.BC.b.l; |
| 489 | 520 | break; |
| 490 | case 0x42: i8085_ICount -= 5; /* MOV B,D */ | |
| 521 | case 0x42: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV B,D */ | |
| 491 | 522 | I.BC.b.h = I.DE.b.h; |
| 492 | 523 | break; |
| 493 | case 0x43: i8085_ICount -= 5; /* MOV B,E */ | |
| 524 | case 0x43: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV B,E */ | |
| 494 | 525 | I.BC.b.h = I.DE.b.l; |
| 495 | 526 | break; |
| 496 | case 0x44: i8085_ICount -= 5; /* MOV B,H */ | |
| 527 | case 0x44: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV B,H */ | |
| 497 | 528 | I.BC.b.h = I.HL.b.h; |
| 498 | 529 | break; |
| 499 | case 0x45: i8085_ICount -= 5; /* MOV B,L */ | |
| 530 | case 0x45: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV B,L */ | |
| 500 | 531 | I.BC.b.h = I.HL.b.l; |
| 501 | 532 | break; |
| 502 | 533 | case 0x46: i8085_ICount -= 7; /* MOV B,M */ |
| 503 | 534 | I.BC.b.h = RM(I.HL.d); |
| 504 | 535 | break; |
| 505 | case 0x47: i8085_ICount -= 5; /* MOV B,A */ | |
| 536 | case 0x47: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV B,A */ | |
| 506 | 537 | I.BC.b.h = I.AF.b.h; |
| 507 | 538 | break; |
| 508 | 539 | |
| 509 | case 0x48: i8085_ICount -= 5; /* MOV C,B */ | |
| 540 | case 0x48: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV C,B */ | |
| 510 | 541 | I.BC.b.l = I.BC.b.h; |
| 511 | 542 | break; |
| 512 | case 0x49: i8085_ICount -= 5; /* MOV C,C */ | |
| 543 | case 0x49: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV C,C */ | |
| 513 | 544 | /* no op */ |
| 514 | 545 | break; |
| 515 | case 0x4a: i8085_ICount -= 5; /* MOV C,D */ | |
| 546 | case 0x4a: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV C,D */ | |
| 516 | 547 | I.BC.b.l = I.DE.b.h; |
| 517 | 548 | break; |
| 518 | case 0x4b: i8085_ICount -= 5; /* MOV C,E */ | |
| 549 | case 0x4b: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV C,E */ | |
| 519 | 550 | I.BC.b.l = I.DE.b.l; |
| 520 | 551 | break; |
| 521 | case 0x4c: i8085_ICount -= 5; /* MOV C,H */ | |
| 552 | case 0x4c: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV C,H */ | |
| 522 | 553 | I.BC.b.l = I.HL.b.h; |
| 523 | 554 | break; |
| 524 | case 0x4d: i8085_ICount -= 5; /* MOV C,L */ | |
| 555 | case 0x4d: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV C,L */ | |
| 525 | 556 | I.BC.b.l = I.HL.b.l; |
| 526 | 557 | break; |
| 527 | 558 | case 0x4e: i8085_ICount -= 7; /* MOV C,M */ |
| 528 | 559 | I.BC.b.l = RM(I.HL.d); |
| 529 | 560 | break; |
| 530 | case 0x4f: i8085_ICount -= 5; /* MOV C,A */ | |
| 561 | case 0x4f: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV C,A */ | |
| 531 | 562 | I.BC.b.l = I.AF.b.h; |
| 532 | 563 | break; |
| 533 | 564 | |
| 534 | case 0x50: i8085_ICount -= 5; /* MOV D,B */ | |
| 565 | case 0x50: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV D,B */ | |
| 535 | 566 | I.DE.b.h = I.BC.b.h; |
| 536 | 567 | break; |
| 537 | case 0x51: i8085_ICount -= 5; /* MOV D,C */ | |
| 568 | case 0x51: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV D,C */ | |
| 538 | 569 | I.DE.b.h = I.BC.b.l; |
| 539 | 570 | break; |
| 540 | case 0x52: i8085_ICount -= 5; /* MOV D,D */ | |
| 571 | case 0x52: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV D,D */ | |
| 541 | 572 | /* no op */ |
| 542 | 573 | break; |
| 543 | case 0x53: i8085_ICount -= 5; /* MOV D,E */ | |
| 574 | case 0x53: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV D,E */ | |
| 544 | 575 | I.DE.b.h = I.DE.b.l; |
| 545 | 576 | break; |
| 546 | case 0x54: i8085_ICount -= 5; /* MOV D,H */ | |
| 577 | case 0x54: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV D,H */ | |
| 547 | 578 | I.DE.b.h = I.HL.b.h; |
| 548 | 579 | break; |
| 549 | case 0x55: i8085_ICount -= 5; /* MOV D,L */ | |
| 580 | case 0x55: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV D,L */ | |
| 550 | 581 | I.DE.b.h = I.HL.b.l; |
| 551 | 582 | break; |
| 552 | 583 | case 0x56: i8085_ICount -= 7; /* MOV D,M */ |
| 553 | 584 | I.DE.b.h = RM(I.HL.d); |
| 554 | 585 | break; |
| 555 | case 0x57: i8085_ICount -= 5; /* MOV D,A */ | |
| 586 | case 0x57: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV D,A */ | |
| 556 | 587 | I.DE.b.h = I.AF.b.h; |
| 557 | 588 | break; |
| 558 | 589 | |
| 559 | case 0x58: i8085_ICount -= 5; /* MOV E,B */ | |
| 590 | case 0x58: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV E,B */ | |
| 560 | 591 | I.DE.b.l = I.BC.b.h; |
| 561 | 592 | break; |
| 562 | case 0x59: i8085_ICount -= 5; /* MOV E,C */ | |
| 593 | case 0x59: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV E,C */ | |
| 563 | 594 | I.DE.b.l = I.BC.b.l; |
| 564 | 595 | break; |
| 565 | case 0x5a: i8085_ICount -= 5; /* MOV E,D */ | |
| 596 | case 0x5a: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV E,D */ | |
| 566 | 597 | I.DE.b.l = I.DE.b.h; |
| 567 | 598 | break; |
| 568 | case 0x5b: i8085_ICount -= 5; /* MOV E,E */ | |
| 599 | case 0x5b: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV E,E */ | |
| 569 | 600 | /* no op */ |
| 570 | 601 | break; |
| 571 | case 0x5c: i8085_ICount -= 5; /* MOV E,H */ | |
| 602 | case 0x5c: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV E,H */ | |
| 572 | 603 | I.DE.b.l = I.HL.b.h; |
| 573 | 604 | break; |
| 574 | case 0x5d: i8085_ICount -= 5; /* MOV E,L */ | |
| 605 | case 0x5d: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV E,L */ | |
| 575 | 606 | I.DE.b.l = I.HL.b.l; |
| 576 | 607 | break; |
| 577 | 608 | case 0x5e: i8085_ICount -= 7; /* MOV E,M */ |
| 578 | 609 | I.DE.b.l = RM(I.HL.d); |
| 579 | 610 | break; |
| 580 | case 0x5f: i8085_ICount -= 5; /* MOV E,A */ | |
| 611 | case 0x5f: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV E,A */ | |
| 581 | 612 | I.DE.b.l = I.AF.b.h; |
| 582 | 613 | break; |
| 583 | 614 | |
| 584 | case 0x60: i8085_ICount -= 5; /* MOV H,B */ | |
| 615 | case 0x60: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV H,B */ | |
| 585 | 616 | I.HL.b.h = I.BC.b.h; |
| 586 | 617 | break; |
| 587 | case 0x61: i8085_ICount -= 5; /* MOV H,C */ | |
| 618 | case 0x61: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV H,C */ | |
| 588 | 619 | I.HL.b.h = I.BC.b.l; |
| 589 | 620 | break; |
| 590 | case 0x62: i8085_ICount -= 5; /* MOV H,D */ | |
| 621 | case 0x62: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV H,D */ | |
| 591 | 622 | I.HL.b.h = I.DE.b.h; |
| 592 | 623 | break; |
| 593 | case 0x63: i8085_ICount -= 5; /* MOV H,E */ | |
| 624 | case 0x63: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV H,E */ | |
| 594 | 625 | I.HL.b.h = I.DE.b.l; |
| 595 | 626 | break; |
| 596 | case 0x64: i8085_ICount -= 5; /* MOV H,H */ | |
| 627 | case 0x64: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV H,H */ | |
| 597 | 628 | /* no op */ |
| 598 | 629 | break; |
| 599 | case 0x65: i8085_ICount -= 5; /* MOV H,L */ | |
| 630 | case 0x65: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV H,L */ | |
| 600 | 631 | I.HL.b.h = I.HL.b.l; |
| 601 | 632 | break; |
| 602 | 633 | case 0x66: i8085_ICount -= 7; /* MOV H,M */ |
| 603 | 634 | I.HL.b.h = RM(I.HL.d); |
| 604 | 635 | break; |
| 605 | case 0x67: i8085_ICount -= 5; /* MOV H,A */ | |
| 636 | case 0x67: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV H,A */ | |
| 606 | 637 | I.HL.b.h = I.AF.b.h; |
| 607 | 638 | break; |
| 608 | 639 | |
| 609 | case 0x68: i8085_ICount -= 5; /* MOV L,B */ | |
| 640 | case 0x68: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV L,B */ | |
| 610 | 641 | I.HL.b.l = I.BC.b.h; |
| 611 | 642 | break; |
| 612 | case 0x69: i8085_ICount -= 5; /* MOV L,C */ | |
| 643 | case 0x69: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV L,C */ | |
| 613 | 644 | I.HL.b.l = I.BC.b.l; |
| 614 | 645 | break; |
| 615 | case 0x6a: i8085_ICount -= 5; /* MOV L,D */ | |
| 646 | case 0x6a: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV L,D */ | |
| 616 | 647 | I.HL.b.l = I.DE.b.h; |
| 617 | 648 | break; |
| 618 | case 0x6b: i8085_ICount -= 5; /* MOV L,E */ | |
| 649 | case 0x6b: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV L,E */ | |
| 619 | 650 | I.HL.b.l = I.DE.b.l; |
| 620 | 651 | break; |
| 621 | case 0x6c: i8085_ICount -= 5; /* MOV L,H */ | |
| 652 | case 0x6c: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV L,H */ | |
| 622 | 653 | I.HL.b.l = I.HL.b.h; |
| 623 | 654 | break; |
| 624 | case 0x6d: i8085_ICount -= 5; /* MOV L,L */ | |
| 655 | case 0x6d: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV L,L */ | |
| 625 | 656 | /* no op */ |
| 626 | 657 | break; |
| 627 | 658 | case 0x6e: i8085_ICount -= 7; /* MOV L,M */ |
| 628 | 659 | I.HL.b.l = RM(I.HL.d); |
| 629 | 660 | break; |
| 630 | case 0x6f: i8085_ICount -= 5; /* MOV L,A */ | |
| 661 | case 0x6f: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV L,A */ | |
| 631 | 662 | I.HL.b.l = I.AF.b.h; |
| 632 | 663 | break; |
| 633 | 664 | |
| r2844 | r2845 | |
| 649 | 680 | case 0x75: i8085_ICount -= 7; /* MOV M,L */ |
| 650 | 681 | WM(I.HL.d, I.HL.b.l); |
| 651 | 682 | break; |
| 652 | case 0x76: i8085_ICount -= | |
| 683 | case 0x76: i8085_ICount -= (I.cputype) ? 5 : 7; /* H | |
| 653 | 684 | I.PC.w.l--; |
| 654 | 685 | I.HALT = 1; |
| 655 | 686 | if (i8085_ICount > 0) i8085_ICount = 0; |
| r2844 | r2845 | |
| 658 | 689 | WM(I.HL.d, I.AF.b.h); |
| 659 | 690 | break; |
| 660 | 691 | |
| 661 | case 0x78: i8085_ICount -= 5; /* MOV A,B */ | |
| 692 | case 0x78: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV A,B */ | |
| 662 | 693 | I.AF.b.h = I.BC.b.h; |
| 663 | 694 | break; |
| 664 | case 0x79: i8085_ICount -= 5; /* MOV A,C */ | |
| 695 | case 0x79: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV A,C */ | |
| 665 | 696 | I.AF.b.h = I.BC.b.l; |
| 666 | 697 | break; |
| 667 | case 0x7a: i8085_ICount -= 5; /* MOV A,D */ | |
| 698 | case 0x7a: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV A,D */ | |
| 668 | 699 | I.AF.b.h = I.DE.b.h; |
| 669 | 700 | break; |
| 670 | case 0x7b: i8085_ICount -= 5; /* MOV A,E */ | |
| 701 | case 0x7b: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV A,E */ | |
| 671 | 702 | I.AF.b.h = I.DE.b.l; |
| 672 | 703 | break; |
| 673 | case 0x7c: i8085_ICount -= 5; /* MOV A,H */ | |
| 704 | case 0x7c: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV A,H */ | |
| 674 | 705 | I.AF.b.h = I.HL.b.h; |
| 675 | 706 | break; |
| 676 | case 0x7d: i8085_ICount -= 5; /* MOV A,L */ | |
| 707 | case 0x7d: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV A,L */ | |
| 677 | 708 | I.AF.b.h = I.HL.b.l; |
| 678 | 709 | break; |
| 679 | 710 | case 0x7e: i8085_ICount -= 7; /* MOV A,M */ |
| 680 | 711 | I.AF.b.h = RM(I.HL.d); |
| 681 | 712 | break; |
| 682 | case 0x7f: i8085_ICount -= 5; /* MOV A,A */ | |
| 713 | case 0x7f: i8085_ICount -= (I.cputype) ? 4 : 5; /* MOV A,A */ | |
| 683 | 714 | /* no op */ |
| 684 | 715 | break; |
| 685 | 716 | |
| r2844 | r2845 | |
| 883 | 914 | M_CMP(I.AF.b.h); |
| 884 | 915 | break; |
| 885 | 916 | |
| 886 | case 0xc0: i8085_ICount -= 5; /* RNZ */ | |
| 917 | case 0xc0: i8085_ICount -= (I.cputype) ? 6 : 5; /* RNZ */ | |
| 887 | 918 | M_RET( !(I.AF.b.l & ZF) ); |
| 888 | 919 | break; |
| 889 | 920 | case 0xc1: i8085_ICount -= 10; /* POP B */ |
| 890 | 921 | M_POP(BC); |
| 891 | 922 | break; |
| 892 | case 0xc2: i8085_ICount -= | |
| 923 | case 0xc2: i8085_ICount -= 10; /* JNZ nnnn */ | |
| 893 | 924 | M_JMP( !(I.AF.b.l & ZF) ); |
| 894 | 925 | break; |
| 895 | case 0xc3: i8085_ICount -= | |
| 926 | case 0xc3: i8085_ICount -= 10; /* JMP nnnn */ | |
| 896 | 927 | M_JMP(1); |
| 897 | 928 | break; |
| 898 | 929 | case 0xc4: i8085_ICount -= 11; /* CNZ nnnn */ |
| 899 | 930 | M_CALL( !(I.AF.b.l & ZF) ); |
| 900 | 931 | break; |
| 901 | case 0xc5: i8085_ICount -= 11; /* PUSH B */ | |
| 932 | case 0xc5: i8085_ICount -= (I.cputype) ? 12 : 11; /* PUSH B */ | |
| 902 | 933 | M_PUSH(BC); |
| 903 | 934 | break; |
| 904 | 935 | case 0xc6: i8085_ICount -= 7; /* ADI nn */ |
| 905 | 936 | I.XX.b.l = ARG(); |
| 906 | 937 | M_ADD(I.XX.b.l); |
| 907 | 938 | break; |
| 908 | case 0xc7: i8085_ICount -= 11; /* RST 0 */ | |
| 939 | case 0xc7: i8085_ICount -= (I.cputype) ? 12 : 11; /* RST 0 */ | |
| 909 | 940 | M_RST(0); |
| 910 | 941 | break; |
| 911 | 942 | |
| 912 | case 0xc8: i8085_ICount -= 5; /* RZ */ | |
| 943 | case 0xc8: i8085_ICount -= (I.cputype) ? 6 : 5; /* RZ */ | |
| 913 | 944 | M_RET( I.AF.b.l & ZF ); |
| 914 | 945 | break; |
| 915 | case 0xc9: i8085_ICount -= | |
| 946 | case 0xc9: i8085_ICount -= 10; /* RET */ | |
| 916 | 947 | M_RET(1); |
| 917 | 948 | break; |
| 918 | case 0xca: i8085_ICount -= | |
| 949 | case 0xca: i8085_ICount -= 10; /* JZ nnnn */ | |
| 919 | 950 | M_JMP( I.AF.b.l & ZF ); |
| 920 | 951 | break; |
| 921 | 952 | case 0xcb: |
| r2844 | r2845 | |
| 927 | 958 | i8085_ICount -= 6; /* RST V */ |
| 928 | 959 | } |
| 929 | 960 | } else { |
| 930 | i8085_ICount -= | |
| 961 | i8085_ICount -= 10; /* JMP nnnn undocumented*/ | |
| 931 | 962 | M_JMP(1); |
| 932 | 963 | } |
| 933 | 964 | break; |
| 934 | 965 | case 0xcc: i8085_ICount -= 11; /* CZ nnnn */ |
| 935 | 966 | M_CALL( I.AF.b.l & ZF ); |
| 936 | 967 | break; |
| 937 | case 0xcd: i8085_ICount -= 1 | |
| 968 | case 0xcd: i8085_ICount -= 17; /* CALL nnnn */ | |
| 938 | 969 | M_CALL(1); |
| 939 | 970 | break; |
| 940 | 971 | case 0xce: i8085_ICount -= 7; /* ACI nn */ |
| 941 | 972 | I.XX.b.l = ARG(); |
| 942 | 973 | M_ADC(I.XX.b.l); |
| 943 | 974 | break; |
| 944 | case 0xcf: i8085_ICount -= 11; /* RST 1 */ | |
| 975 | case 0xcf: i8085_ICount -= (I.cputype) ? 12 : 11; /* RST 1 */ | |
| 945 | 976 | M_RST(1); |
| 946 | 977 | break; |
| 947 | 978 | |
| 948 | case 0xd0: i8085_ICount -= 5; /* RNC */ | |
| 979 | case 0xd0: i8085_ICount -= (I.cputype) ? 6 : 5; /* RNC */ | |
| 949 | 980 | M_RET( !(I.AF.b.l & CF) ); |
| 950 | 981 | break; |
| 951 | 982 | case 0xd1: i8085_ICount -= 10; /* POP D */ |
| 952 | 983 | M_POP(DE); |
| 953 | 984 | break; |
| 954 | case 0xd2: i8085_ICount -= | |
| 985 | case 0xd2: i8085_ICount -= 10; /* JNC nnnn */ | |
| 955 | 986 | M_JMP( !(I.AF.b.l & CF) ); |
| 956 | 987 | break; |
| 957 | 988 | case 0xd3: i8085_ICount -= 10; /* OUT nn */ |
| r2844 | r2845 | |
| 960 | 991 | case 0xd4: i8085_ICount -= 11; /* CNC nnnn */ |
| 961 | 992 | M_CALL( !(I.AF.b.l & CF) ); |
| 962 | 993 | break; |
| 963 | case 0xd5: i8085_ICount -= 11; /* PUSH D */ | |
| 994 | case 0xd5: i8085_ICount -= (I.cputype) ? 12 : 11; /* PUSH D */ | |
| 964 | 995 | M_PUSH(DE); |
| 965 | 996 | break; |
| 966 | 997 | case 0xd6: i8085_ICount -= 7; /* SUI nn */ |
| 967 | 998 | I.XX.b.l = ARG(); |
| 968 | 999 | M_SUB(I.XX.b.l); |
| 969 | 1000 | break; |
| 970 | case 0xd7: i8085_ICount -= 11; /* RST 2 */ | |
| 1001 | case 0xd7: i8085_ICount -= (I.cputype) ? 12 : 11; /* RST 2 */ | |
| 971 | 1002 | M_RST(2); |
| 972 | 1003 | break; |
| 973 | 1004 | |
| 974 | case 0xd8: i8085_ICount -= 5; /* RC */ | |
| 1005 | case 0xd8: i8085_ICount -= (I.cputype) ? 6 : 5; /* RC */ | |
| 975 | 1006 | M_RET( I.AF.b.l & CF ); |
| 976 | 1007 | break; |
| 977 | 1008 | case 0xd9: |
| r2844 | r2845 | |
| 982 | 1013 | I.XX.w.l++; |
| 983 | 1014 | WM(I.XX.d, I.HL.b.h); |
| 984 | 1015 | } else { |
| 985 | i8085_ICount -= | |
| 1016 | i8085_ICount -= 10; /* RET undocumented */ | |
| 986 | 1017 | M_RET(1); |
| 987 | 1018 | } |
| 988 | 1019 | break; |
| 989 | case 0xda: i8085_ICount -= | |
| 1020 | case 0xda: i8085_ICount -= 10; /* JC nnnn */ | |
| 990 | 1021 | M_JMP( I.AF.b.l & CF ); |
| 991 | 1022 | break; |
| 992 | 1023 | case 0xdb: i8085_ICount -= 10; /* IN nn */ |
| r2844 | r2845 | |
| 1000 | 1031 | i8085_ICount -= 7; /* JNX nnnn */ |
| 1001 | 1032 | M_JMP( !(I.AF.b.l & XF) ); |
| 1002 | 1033 | } else { |
| 1003 | i8085_ICount -= 1 | |
| 1034 | i8085_ICount -= 17; /* CALL nnnn undocumented */ | |
| 1004 | 1035 | M_CALL(1); |
| 1005 | 1036 | } |
| 1006 | 1037 | break; |
| r2844 | r2845 | |
| 1008 | 1039 | I.XX.b.l = ARG(); |
| 1009 | 1040 | M_SBB(I.XX.b.l); |
| 1010 | 1041 | break; |
| 1011 | case 0xdf: i8085_ICount -= 11; /* RST 3 */ | |
| 1042 | case 0xdf: i8085_ICount -= (I.cputype) ? 12 : 11; /* RST 3 */ | |
| 1012 | 1043 | M_RST(3); |
| 1013 | 1044 | break; |
| 1014 | 1045 | |
| 1015 | case 0xe0: i8085_ICount -= 5; /* RPO */ | |
| 1046 | case 0xe0: i8085_ICount -= (I.cputype) ? 6 : 5; /* RPO */ | |
| 1016 | 1047 | M_RET( !(I.AF.b.l & VF) ); |
| 1017 | 1048 | break; |
| 1018 | 1049 | case 0xe1: i8085_ICount -= 10; /* POP H */ |
| 1019 | 1050 | M_POP(HL); |
| 1020 | 1051 | break; |
| 1021 | case 0xe2: i8085_ICount -= | |
| 1052 | case 0xe2: i8085_ICount -= 10; /* JPO nnnn */ | |
| 1022 | 1053 | M_JMP( !(I.AF.b.l & VF) ); |
| 1023 | 1054 | break; |
| 1024 | case 0xe3: i8085_ICount -= 18; /* XTHL */ | |
| 1055 | case 0xe3: i8085_ICount -= (I.cputype) ? 16 : 18; /* XTHL */ | |
| 1025 | 1056 | M_POP(XX); |
| 1026 | 1057 | M_PUSH(HL); |
| 1027 | 1058 | I.HL.d = I.XX.d; |
| r2844 | r2845 | |
| 1029 | 1060 | case 0xe4: i8085_ICount -= 11; /* CPO nnnn */ |
| 1030 | 1061 | M_CALL( !(I.AF.b.l & VF) ); |
| 1031 | 1062 | break; |
| 1032 | case 0xe5: i8085_ICount -= 11; /* PUSH H */ | |
| 1063 | case 0xe5: i8085_ICount -= (I.cputype) ? 12 : 11; /* PUSH H */ | |
| 1033 | 1064 | M_PUSH(HL); |
| 1034 | 1065 | break; |
| 1035 | 1066 | case 0xe6: i8085_ICount -= 7; /* ANI nn */ |
| 1036 | 1067 | I.XX.b.l = ARG(); |
| 1037 | 1068 | M_ANA(I.XX.b.l); |
| 1038 | 1069 | break; |
| 1039 | case 0xe7: i8085_ICount -= 11; /* RST 4 */ | |
| 1070 | case 0xe7: i8085_ICount -= (I.cputype) ? 12 : 11; /* RST 4 */ | |
| 1040 | 1071 | M_RST(4); |
| 1041 | 1072 | break; |
| 1042 | 1073 | |
| 1043 | case 0xe8: i8085_ICount -= 5; /* RPE */ | |
| 1074 | case 0xe8: i8085_ICount -= (I.cputype) ? 6 : 5; /* RPE */ | |
| 1044 | 1075 | M_RET( I.AF.b.l & VF ); |
| 1045 | 1076 | break; |
| 1046 | case 0xe9: i8085_ICount -= 5; /* PCHL */ | |
| 1077 | case 0xe9: i8085_ICount -= (I.cputype) ? 6 : 5; /* PCHL */ | |
| 1047 | 1078 | I.PC.d = I.HL.w.l; |
| 1048 | 1079 | change_pc(I.PC.d); |
| 1049 | 1080 | break; |
| 1050 | case 0xea: i8085_ICount -= | |
| 1081 | case 0xea: i8085_ICount -= 10; /* JPE nnnn */ | |
| 1051 | 1082 | M_JMP( I.AF.b.l & VF ); |
| 1052 | 1083 | break; |
| 1053 | case 0xeb: i8085_ICount -= | |
| 1084 | case 0xeb: i8085_ICount -= 5; /* XCHG */ | |
| 1054 | 1085 | I.XX.d = I.DE.d; |
| 1055 | 1086 | I.DE.d = I.HL.d; |
| 1056 | 1087 | I.HL.d = I.XX.d; |
| r2844 | r2845 | |
| 1066 | 1097 | I.XX.w.l++; |
| 1067 | 1098 | I.HL.b.h = RM(I.XX.d); |
| 1068 | 1099 | } else { |
| 1069 | i8085_ICount -= 1 | |
| 1100 | i8085_ICount -= 17; /* CALL nnnn undocumented */ | |
| 1070 | 1101 | M_CALL(1); |
| 1071 | 1102 | } |
| 1072 | 1103 | break; |
| r2844 | r2845 | |
| 1074 | 1105 | I.XX.b.l = ARG(); |
| 1075 | 1106 | M_XRA(I.XX.b.l); |
| 1076 | 1107 | break; |
| 1077 | case 0xef: i8085_ICount -= 11; /* RST 5 */ | |
| 1108 | case 0xef: i8085_ICount -= (I.cputype) ? 12 : 11; /* RST 5 */ | |
| 1078 | 1109 | M_RST(5); |
| 1079 | 1110 | break; |
| 1080 | 1111 | |
| 1081 | case 0xf0: i8085_ICount -= 5; /* RP */ | |
| 1112 | case 0xf0: i8085_ICount -= (I.cputype) ? 6 : 5; /* RP */ | |
| 1082 | 1113 | M_RET( !(I.AF.b.l&SF) ); |
| 1083 | 1114 | break; |
| 1084 | 1115 | case 0xf1: i8085_ICount -= 10; /* POP A */ |
| 1085 | 1116 | M_POP(AF); |
| 1086 | 1117 | break; |
| 1087 | case 0xf2: i8085_ICount -= | |
| 1118 | case 0xf2: i8085_ICount -= 10; /* JP nnnn */ | |
| 1088 | 1119 | M_JMP( !(I.AF.b.l & SF) ); |
| 1089 | 1120 | break; |
| 1090 | 1121 | case 0xf3: i8085_ICount -= 4; /* DI */ |
| r2844 | r2845 | |
| 1094 | 1125 | case 0xf4: i8085_ICount -= 11; /* CP nnnn */ |
| 1095 | 1126 | M_CALL( !(I.AF.b.l & SF) ); |
| 1096 | 1127 | break; |
| 1097 | case 0xf5: i8085_ICount -= 11; /* PUSH A */ | |
| 1128 | case 0xf5: i8085_ICount -= (I.cputype) ? 12 : 11; /* PUSH A */ | |
| 1098 | 1129 | M_PUSH(AF); |
| 1099 | 1130 | break; |
| 1100 | 1131 | case 0xf6: i8085_ICount -= 7; /* ORI nn */ |
| 1101 | 1132 | I.XX.b.l = ARG(); |
| 1102 | 1133 | M_ORA(I.XX.b.l); |
| 1103 | 1134 | break; |
| 1104 | case 0xf7: i8085_ICount -= 11; /* RST 6 */ | |
| 1135 | case 0xf7: i8085_ICount -= (I.cputype) ? 12 : 11; /* RST 6 */ | |
| 1105 | 1136 | M_RST(6); |
| 1106 | 1137 | break; |
| 1107 | 1138 | |
| 1108 | case 0xf8: i8085_ICount -= 5; /* RM */ | |
| 1139 | case 0xf8: i8085_ICount -= (I.cputype) ? 6 : 5; /* RM */ | |
| 1109 | 1140 | M_RET( I.AF.b.l & SF ); |
| 1110 | 1141 | break; |
| 1111 | case 0xf9: i8085_ICount -= 5; /* SPHL */ | |
| 1142 | case 0xf9: i8085_ICount -= (I.cputype) ? 6 : 5; /* SPHL */ | |
| 1112 | 1143 | I.SP.d = I.HL.d; |
| 1113 | 1144 | break; |
| 1114 | case 0xfa: i8085_ICount -= | |
| 1145 | case 0xfa: i8085_ICount -= 10; /* JM nnnn */ | |
| 1115 | 1146 | M_JMP( I.AF.b.l & SF ); |
| 1116 | 1147 | break; |
| 1117 | 1148 | case 0xfb: i8085_ICount -= 4; /* EI */ |
| r2844 | r2845 | |
| 1172 | 1203 | i8085_ICount -= 7; /* JX nnnn */ |
| 1173 | 1204 | M_JMP( I.AF.b.l & XF ); |
| 1174 | 1205 | } else { |
| 1175 | i8085_ICount -= 1 | |
| 1206 | i8085_ICount -= 17; /* CALL nnnn undocumented */ | |
| 1176 | 1207 | M_CALL(1); |
| 1177 | 1208 | } |
| 1178 | 1209 | break; |
| r2844 | r2845 | |
| 1180 | 1211 | I.XX.b.l = ARG(); |
| 1181 | 1212 | M_CMP(I.XX.b.l); |
| 1182 | 1213 | break; |
| 1183 | case 0xff: i8085_ICount -= 11; /* RST 7 */ | |
| 1214 | case 0xff: i8085_ICount -= (I.cputype) ? 12 : 11; /* RST 7 */ | |
| 1184 | 1215 | M_RST(7); |
| 1185 | 1216 | break; |
| 1186 | 1217 | } |
| r2844 | r2845 | |
|---|---|---|
| 1 | /*************************************************************************** | |
| 2 | ||
| 3 | ppcfe.h | |
| 4 | ||
| 5 | Front-end for PowerPC recompiler | |
| 6 | ||
| 7 | Copyright Aaron Giles | |
| 8 | Released for general non-commercial use under the MAME license | |
| 9 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 10 | ||
| 11 | ***************************************************************************/ | |
| 12 | ||
| 13 | #ifndef __PPCFE_H__ | |
| 14 | #define __PPCFE_H__ | |
| 15 | ||
| 16 | #include "cpu/drcfe.h" | |
| 17 | ||
| 18 | ||
| 19 | /*************************************************************************** | |
| 20 | CONSTANTS | |
| 21 | ***************************************************************************/ | |
| 22 | ||
| 23 | /* register flags */ | |
| 24 | #define REGFLAG_R(n) ((UINT64)1 << (n)) | |
| 25 | #define REGFLAG_RZ(n) (((n) == 0) ? 0 : REGFLAG_R(n)) | |
| 26 | #define REGFLAG_CR(n) REGFLAG_R(32 + (n)) | |
| 27 | #define REGFLAG_XER REGFLAG_R(40) | |
| 28 | #define REGFLAG_CTR REGFLAG_R(41) | |
| 29 | #define REGFLAG_LR REGFLAG_R(42) | |
| 30 | #define REGFLAG_FPSCR REGFLAG_R(32) | |
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | /*************************************************************************** | |
| 35 | FUNCTION PROTOTYPES | |
| 36 | ***************************************************************************/ | |
| 37 | ||
| 38 | int ppcfe_describe(void *param, opcode_desc *desc); | |
| 39 | ||
| 40 | #endif | |
| 1 | /*************************************************************************** | |
| 2 | ||
| 3 | ppcfe.h | |
| 4 | ||
| 5 | Front-end for PowerPC recompiler | |
| 6 | ||
| 7 | Copyright Aaron Giles | |
| 8 | Released for general non-commercial use under the MAME license | |
| 9 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 10 | ||
| 11 | ***************************************************************************/ | |
| 12 | ||
| 13 | #ifndef __PPCFE_H__ | |
| 14 | #define __PPCFE_H__ | |
| 15 | ||
| 16 | #include "cpu/drcfe.h" | |
| 17 | ||
| 18 | ||
| 19 | /*************************************************************************** | |
| 20 | CONSTANTS | |
| 21 | ***************************************************************************/ | |
| 22 | ||
| 23 | /* register flags 0 */ | |
| 24 | #define REGFLAG_R(n) (1 << (n)) | |
| 25 | #define REGFLAG_RZ(n) (((n) == 0) ? 0 : REGFLAG_R(n)) | |
| 26 | ||
| 27 | /* register flags 1 */ | |
| 28 | #define REGFLAG_FR(n) (1 << (n)) | |
| 29 | ||
| 30 | /* register flags 2 */ | |
| 31 | #define REGFLAG_CR(n) (0xf0000000 >> (4 * (n))) | |
| 32 | #define REGFLAG_CR_BIT(n) (0x80000000 >> (n)) | |
| 33 | ||
| 34 | /* register flags 3 */ | |
| 35 | #define REGFLAG_XER_CA (1 << 0) | |
| 36 | #define REGFLAG_XER_OV (1 << 1) | |
| 37 | #define REGFLAG_XER_SO (1 << 2) | |
| 38 | #define REGFLAG_XER_COUNT (1 << 3) | |
| 39 | #define REGFLAG_CTR (1 << 4) | |
| 40 | #define REGFLAG_LR (1 << 5) | |
| 41 | #define REGFLAG_FPSCR(n) (1 << (6 + (n))) | |
| 42 | ||
| 43 | ||
| 44 | ||
| 45 | /*************************************************************************** | |
| 46 | FUNCTION PROTOTYPES | |
| 47 | ***************************************************************************/ | |
| 48 | ||
| 49 | int ppcfe_describe(void *param, opcode_desc *desc); | |
| 50 | ||
| 51 | #endif |
| r2844 | r2845 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | Future improvements/changes: |
| 14 | 14 | |
| 15 | * | |
| 15 | * crx | |
| 16 | 16 | |
| 17 | * Eliminate unnecessary flag calculations using information from the | |
| 18 | frontend | |
| 19 | ||
| 20 | 17 | ***************************************************************************/ |
| 21 | 18 | |
| 22 | 19 | #include <stddef.h> |
| r2844 | r2845 | |
| 41 | 38 | #define LOG_UML (0) |
| 42 | 39 | #define LOG_NATIVE (0) |
| 43 | 40 | |
| 41 | #define DISABLE_FLAG_OPTIMIZATIONS (0) | |
| 44 | 42 | #define DISABLE_FAST_REGISTERS (0) |
| 45 | 43 | #define SINGLE_INSTRUCTION_MODE (0) |
| 46 | 44 | |
| r2844 | r2845 | |
| 62 | 60 | |
| 63 | 61 | /* mode bits */ |
| 64 | 62 | #define MODE_LITTLE_ENDIAN 0x01 |
| 65 | #define MODE_DATA_TRANSLATION 0x02 | |
| 63 | #define MODE_DATA_TRANSLATION 0x02 /* OEA */ | |
| 64 | #define MODE_PROTECTION 0x02 /* 4XX */ | |
| 66 | 65 | #define MODE_USER 0x04 |
| 67 | 66 | |
| 68 | 67 | /* size of the execution code cache */ |
| r2844 | r2845 | |
| 89 | 88 | #define R32(reg) ppc->impstate->regmap[reg].type, ppc->impstate->regmap[reg].value |
| 90 | 89 | #define R32Z(reg) (((reg) == 0) ? DRCUML_PTYPE_IMMEDIATE : ppc->impstate->regmap[reg].type), (((reg) == 0) ? 0 : ppc->impstate->regmap[reg].value) |
| 91 | 90 | #define F64(reg) ppc->impstate->fdregmap[reg].type, ppc->impstate->fdregmap[reg].value |
| 92 | #define CR32 | |
| 91 | #define CR32(reg) | |
| 93 | 92 | #define FPSCR32 MEM(&ppc->fpscr) |
| 94 | 93 | #define MSR32 MEM(&ppc->msr) |
| 94 | #define XERSO32 MEM(&ppc->xerso) | |
| 95 | 95 | #define SR32(reg) MEM(&ppc->sr[reg]) |
| 96 | 96 | #define SPR32(reg) MEM(&ppc->spr[reg]) |
| 97 | 97 | |
| 98 | 98 | #define CRMASK(reg) (0xf0000000 >> ((reg) * 4)) |
| 99 | 99 | |
| 100 | #define FLAGS_RC(op) ((op & M_RC) ? (DRCUML_FLAG_S | DRCUML_FLAG_Z) : 0) | |
| 101 | #define FLAGS_OE(op) ((op & M_OE) ? DRCUML_FLAG_V : 0) | |
| 102 | #define FLAGS_RCOE(op) (FLAGS_RC(op) | FLAGS_OE(op)) | |
| 103 | #define FLAGS_RCOECA(op) (FLAGS_RCOE(op) | DRCUML_FLAG_C) | |
| 104 | ||
| 105 | 100 | /* DSISR values for various addressing types */ |
| 106 | 101 | #define DSISR_IMM(op) ((0) | /* bits 15-16: cleared */ \ |
| 107 | 102 | ((((op) >> (31- 5)) & 0x01) << (31-17)) | /* bit 17: opcode bit 5 */ \ |
| r2844 | r2845 | |
| 175 | 170 | UINT32 drcoptions; /* configurable DRC options */ |
| 176 | 171 | |
| 177 | 172 | /* parameters for subroutines */ |
| 178 | UINT64 numcycles; /* return value from gettotalcycles */ | |
| 179 | 173 | UINT32 mode; /* current global mode */ |
| 180 | 174 | UINT32 arg0; /* print_debug argument 1 */ |
| 181 | 175 | UINT32 arg1; /* print_debug argument 2 */ |
| 182 | 176 | UINT32 updateaddr; /* update address storage */ |
| 183 | 177 | UINT32 swcount; /* counter for sw instructions */ |
| 184 | UINT32 swreg; /* reg index for sw instructions */ | |
| 185 | 178 | UINT32 tempaddr; /* temporary address storage */ |
| 186 | | |
| 179 | drcuml_ireg tempdata; /* temporary data storage */ | |
| 187 | 180 | double fp0; /* floating point 0 */ |
| 188 | 181 | |
| 189 | 182 | /* tables */ |
| 190 | 183 | UINT8 fpmode[4]; /* FPU mode table */ |
| 191 | UINT32 sz_cr_table[32]; /* SZ CR table */ | |
| 192 | UINT32 cmp_cr_table[32]; /* CMP CR table */ | |
| 193 | UINT32 cmpl_cr_table[32]; /* CMPL CR table */ | |
| 194 | UINT32 fcmp_cr_table[32]; /* FCMP CR table */ | |
| 184 | UINT8 sz_cr_table[32]; /* SZ CR table */ | |
| 185 | UINT8 cmp_cr_table[32]; /* CMP CR table */ | |
| 186 | UINT8 cmpl_cr_table[32]; /* CMPL CR table */ | |
| 187 | UINT8 fcmp_cr_table[32]; /* FCMP CR table */ | |
| 195 | 188 | |
| 196 | 189 | /* internal stuff */ |
| 197 | 190 | UINT8 cache_dirty; /* true if we need to flush the cache */ |
| 198 | 191 | |
| 199 | 192 | /* register mappings */ |
| 200 | 193 | drcuml_parameter regmap[32]; /* parameter to register mappings for all 32 integer registers */ |
| 201 | drcuml_parameter fsregmap[32]; /* parameter to register mappings for all 32 floating point registers */ | |
| 202 | 194 | drcuml_parameter fdregmap[32]; /* parameter to register mappings for all 32 floating point registers */ |
| 203 | 195 | |
| 204 | 196 | /* subroutines */ |
| r2844 | r2845 | |
| 207 | 199 | drcuml_codehandle * out_of_cycles; /* out of cycles exception handler */ |
| 208 | 200 | drcuml_codehandle * tlb_mismatch; /* tlb mismatch handler */ |
| 209 | 201 | drcuml_codehandle * swap_tgpr; /* swap TGPR handler */ |
| 202 | drcuml_codehandle * lsw[4][32]; /* lsw entries */ | |
| 203 | drcuml_codehandle * stsw[4][32]; /* stsw entries */ | |
| 210 | 204 | drcuml_codehandle * read8[4]; /* read byte */ |
| 211 | 205 | drcuml_codehandle * write8[4]; /* write byte */ |
| 212 | 206 | drcuml_codehandle * read16[4]; /* read half */ |
| r2844 | r2845 | |
| 254 | 248 | static void static_generate_exception(drcuml_state *drcuml, UINT8 exception, int recover, const char *name); |
| 255 | 249 | static void static_generate_memory_accessor(drcuml_state *drcuml, int mode, int size, int iswrite, int ismasked, const char *name, drcuml_codehandle **handleptr, drcuml_codehandle *masked); |
| 256 | 250 | static void static_generate_swap_tgpr(drcuml_state *drcuml); |
| 251 | static void static_generate_lsw_entries(drcuml_state *drcuml, int mode); | |
| 252 | static void static_generate_stsw_entries(drcuml_state *drcuml, int mode); | |
| 257 | 253 | |
| 258 | 254 | static void generate_update_mode(drcuml_block *block); |
| 259 | 255 | static void generate_update_cycles(drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception); |
| r2844 | r2845 | |
| 267 | 263 | |
| 268 | 264 | static void log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op); |
| 269 | 265 | static const char *log_desc_flags_to_string(UINT32 flags); |
| 270 | static void log_register_list(drcuml_state *drcuml, const char *string, UINT | |
| 266 | static void log_register_list(drcuml_state *drcuml, const char *string, const UINT32 * | |
| 271 | 267 | static void log_opcode_desc(drcuml_state *drcuml, const opcode_desc *desclist, int indent); |
| 272 | 268 | |
| 273 | 269 | |
| r2844 | r2845 | |
| 289 | 285 | }; |
| 290 | 286 | |
| 291 | 287 | /* flag lookup table for SZ */ |
| 292 | static const UINT | |
| 288 | static const UINT8 | |
| 293 | 289 | { |
| 294 | /* ..... */ 0x40000000, | |
| 295 | /* ....C */ 0x42000000, | |
| 296 | /* ...V. */ 0x4c000000, | |
| 297 | /* ...VC */ 0x4e000000, | |
| 298 | /* ..Z.. */ 0x20000000, | |
| 299 | /* ..Z.C */ 0x22000000, | |
| 300 | /* ..ZV. */ 0x2c000000, | |
| 301 | /* ..ZVC */ 0x2e000000, | |
| 302 | /* .S... */ 0x80000000, | |
| 303 | /* .S..C */ 0x82000000, | |
| 304 | /* .S.V. */ 0x8c000000, | |
| 305 | /* .S.VC */ 0x8e000000, | |
| 306 | /* .SZ.. */ 0x20000000, | |
| 307 | /* .SZ.C */ 0x22000000, | |
| 308 | /* .SZV. */ 0x2c000000, | |
| 309 | /* .SZVC */ 0x2e000000, | |
| 310 | /* U.... */ 0x40000000, | |
| 311 | /* U...C */ 0x42000000, | |
| 312 | /* U..V. */ 0x4c000000, | |
| 313 | /* U..VC */ 0x4e000000, | |
| 314 | /* U.Z.. */ 0x20000000, | |
| 315 | /* U.Z.C */ 0x22000000, | |
| 316 | /* U.ZV. */ 0x2c000000, | |
| 317 | /* U.ZVC */ 0x2e000000, | |
| 318 | /* US... */ 0x80000000, | |
| 319 | /* US..C */ 0x82000000, | |
| 320 | /* US.V. */ 0x8c000000, | |
| 321 | /* US.VC */ 0x8e000000, | |
| 322 | /* USZ.. */ 0x20000000, | |
| 323 | /* USZ.C */ 0x22000000, | |
| 324 | /* USZV. */ 0x2c000000, | |
| 325 | /* USZVC */ 0x2e000000 | |
| 290 | /* ..... */ 0x4, | |
| 291 | /* ....C */ 0x4, | |
| 292 | /* ...V. */ 0x4, | |
| 293 | /* ...VC */ 0x4, | |
| 294 | /* ..Z.. */ 0x2, | |
| 295 | /* ..Z.C */ 0x2, | |
| 296 | /* ..ZV. */ 0x2, | |
| 297 | /* ..ZVC */ 0x2, | |
| 298 | /* .S... */ 0x8, | |
| 299 | /* .S..C */ 0x8, | |
| 300 | /* .S.V. */ 0x8, | |
| 301 | /* .S.VC */ 0x8, | |
| 302 | /* .SZ.. */ 0x2, | |
| 303 | /* .SZ.C */ 0x2, | |
| 304 | /* .SZV. */ 0x2, | |
| 305 | /* .SZVC */ 0x2, | |
| 306 | /* U.... */ 0x4, | |
| 307 | /* U...C */ 0x4, | |
| 308 | /* U..V. */ 0x4, | |
| 309 | /* U..VC */ 0x4, | |
| 310 | /* U.Z.. */ 0x2, | |
| 311 | /* U.Z.C */ 0x2, | |
| 312 | /* U.ZV. */ 0x2, | |
| 313 | /* U.ZVC */ 0x2, | |
| 314 | /* US... */ 0x8, | |
| 315 | /* US..C */ 0x8, | |
| 316 | /* US.V. */ 0x8, | |
| 317 | /* US.VC */ 0x8, | |
| 318 | /* USZ.. */ 0x2, | |
| 319 | /* USZ.C */ 0x2, | |
| 320 | /* USZV. */ 0x2, | |
| 321 | /* USZVC */ 0x2 | |
| 326 | 322 | }; |
| 327 | 323 | |
| 328 | 324 | /* flag lookup table for CMP */ |
| 329 | static const UINT | |
| 325 | static const UINT8 | |
| 330 | 326 | { |
| 331 | /* ..... */ 0x44444444, | |
| 332 | /* ....C */ 0x44444444, | |
| 333 | /* ...V. */ 0x88888888, | |
| 334 | /* ...VC */ 0x88888888, | |
| 335 | /* ..Z.. */ 0x22222222, | |
| 336 | /* ..Z.C */ 0x22222222, | |
| 337 | /* ..ZV. */ 0x22222222, | |
| 338 | /* ..ZVC */ 0x22222222, | |
| 339 | /* .S... */ 0x88888888, | |
| 340 | /* .S..C */ 0x88888888, | |
| 341 | /* .S.V. */ 0x44444444, | |
| 342 | /* .S.VC */ 0x44444444, | |
| 343 | /* .SZ.. */ 0x22222222, | |
| 344 | /* .SZ.C */ 0x22222222, | |
| 345 | /* .SZV. */ 0x22222222, | |
| 346 | /* .SZVC */ 0x22222222, | |
| 347 | /* U.... */ 0x44444444, | |
| 348 | /* U...C */ 0x44444444, | |
| 349 | /* U..V. */ 0x88888888, | |
| 350 | /* U..VC */ 0x88888888, | |
| 351 | /* U.Z.. */ 0x22222222, | |
| 352 | /* U.Z.C */ 0x22222222, | |
| 353 | /* U.ZV. */ 0x22222222, | |
| 354 | /* U.ZVC */ 0x22222222, | |
| 355 | /* US... */ 0x88888888, | |
| 356 | /* US..C */ 0x88888888, | |
| 357 | /* US.V. */ 0x44444444, | |
| 358 | /* US.VC */ 0x44444444, | |
| 359 | /* USZ.. */ 0x22222222, | |
| 360 | /* USZ.C */ 0x22222222, | |
| 361 | /* USZV. */ 0x22222222, | |
| 362 | /* USZVC */ 0x22222222 | |
| 327 | /* ..... */ 0x4, | |
| 328 | /* ....C */ 0x4, | |
| 329 | /* ...V. */ 0x8, | |
| 330 | /* ...VC */ 0x8, | |
| 331 | /* ..Z.. */ 0x2, | |
| 332 | /* ..Z.C */ 0x2, | |
| 333 | /* ..ZV. */ 0x2, | |
| 334 | /* ..ZVC */ 0x2, | |
| 335 | /* .S... */ 0x8, | |
| 336 | /* .S..C */ 0x8, | |
| 337 | /* .S.V. */ 0x4, | |
| 338 | /* .S.VC */ 0x4, | |
| 339 | /* .SZ.. */ 0x2, | |
| 340 | /* .SZ.C */ 0x2, | |
| 341 | /* .SZV. */ 0x2, | |
| 342 | /* .SZVC */ 0x2, | |
| 343 | /* U.... */ 0x4, | |
| 344 | /* U...C */ 0x4, | |
| 345 | /* U..V. */ 0x8, | |
| 346 | /* U..VC */ 0x8, | |
| 347 | /* U.Z.. */ 0x2, | |
| 348 | /* U.Z.C */ 0x2, | |
| 349 | /* U.ZV. */ 0x2, | |
| 350 | /* U.ZVC */ 0x2, | |
| 351 | /* US... */ 0x8, | |
| 352 | /* US..C */ 0x8, | |
| 353 | /* US.V. */ 0x4, | |
| 354 | /* US.VC */ 0x4, | |
| 355 | /* USZ.. */ 0x2, | |
| 356 | /* USZ.C */ 0x2, | |
| 357 | /* USZV. */ 0x2, | |
| 358 | /* USZVC */ 0x2 | |
| 363 | 359 | }; |
| 364 | 360 | |
| 365 | 361 | /* flag lookup table for CMPL */ |
| 366 | static const UINT | |
| 362 | static const UINT8 | |
| 367 | 363 | { |
| 368 | /* ..... */ 0x44444444, | |
| 369 | /* ....C */ 0x88888888, | |
| 370 | /* ...V. */ 0x44444444, | |
| 371 | /* ...VC */ 0x88888888, | |
| 372 | /* ..Z.. */ 0x22222222, | |
| 373 | /* ..Z.C */ 0x22222222, | |
| 374 | /* ..ZV. */ 0x22222222, | |
| 375 | /* ..ZVC */ 0x22222222, | |
| 376 | /* .S... */ 0x44444444, | |
| 377 | /* .S..C */ 0x88888888, | |
| 378 | /* .S.V. */ 0x44444444, | |
| 379 | /* .S.VC */ 0x88888888, | |
| 380 | /* .SZ.. */ 0x22222222, | |
| 381 | /* .SZ.C */ 0x22222222, | |
| 382 | /* .SZV. */ 0x22222222, | |
| 383 | /* .SZVC */ 0x22222222, | |
| 384 | /* U.... */ 0x44444444, | |
| 385 | /* U...C */ 0x88888888, | |
| 386 | /* U..V. */ 0x44444444, | |
| 387 | /* U..VC */ 0x88888888, | |
| 388 | /* U.Z.. */ 0x22222222, | |
| 389 | /* U.Z.C */ 0x22222222, | |
| 390 | /* U.ZV. */ 0x22222222, | |
| 391 | /* U.ZVC */ 0x22222222, | |
| 392 | /* US... */ 0x44444444, | |
| 393 | /* US..C */ 0x88888888, | |
| 394 | /* US.V. */ 0x44444444, | |
| 395 | /* US.VC */ 0x88888888, | |
| 396 | /* USZ.. */ 0x22222222, | |
| 397 | /* USZ.C */ 0x22222222, | |
| 398 | /* USZV. */ 0x22222222, | |
| 399 | /* USZVC */ 0x22222222 | |
| 364 | /* ..... */ 0x4, | |
| 365 | /* ....C */ 0x8, | |
| 366 | /* ...V. */ 0x4, | |
| 367 | /* ...VC */ 0x8, | |
| 368 | /* ..Z.. */ 0x2, | |
| 369 | /* ..Z.C */ 0x2, | |
| 370 | /* ..ZV. */ 0x2, | |
| 371 | /* ..ZVC */ 0x2, | |
| 372 | /* .S... */ 0x4, | |
| 373 | /* .S..C */ 0x8, | |
| 374 | /* .S.V. */ 0x4, | |
| 375 | /* .S.VC */ 0x8, | |
| 376 | /* .SZ.. */ 0x2, | |
| 377 | /* .SZ.C */ 0x2, | |
| 378 | /* .SZV. */ 0x2, | |
| 379 | /* .SZVC */ 0x2, | |
| 380 | /* U.... */ 0x4, | |
| 381 | /* U...C */ 0x8, | |
| 382 | /* U..V. */ 0x4, | |
| 383 | /* U..VC */ 0x8, | |
| 384 | /* U.Z.. */ 0x2, | |
| 385 | /* U.Z.C */ 0x2, | |
| 386 | /* U.ZV. */ 0x2, | |
| 387 | /* U.ZVC */ 0x2, | |
| 388 | /* US... */ 0x4, | |
| 389 | /* US..C */ 0x8, | |
| 390 | /* US.V. */ 0x4, | |
| 391 | /* US.VC */ 0x8, | |
| 392 | /* USZ.. */ 0x2, | |
| 393 | /* USZ.C */ 0x2, | |
| 394 | /* USZV. */ 0x2, | |
| 395 | /* USZVC */ 0x2 | |
| 400 | 396 | }; |
| 401 | 397 | |
| 402 | 398 | /* flag lookup table for FCMP */ |
| 403 | static const UINT | |
| 399 | static const UINT8 | |
| 404 | 400 | { |
| 405 | /* ..... */ 0x44444444, | |
| 406 | /* ....C */ 0x88888888, | |
| 407 | /* ...V. */ 0x44444444, | |
| 408 | /* ...VC */ 0x88888888, | |
| 409 | /* ..Z.. */ 0x22222222, | |
| 410 | /* ..Z.C */ 0xaaaaaaaa, | |
| 411 | /* ..ZV. */ 0x22222222, | |
| 412 | /* ..ZVC */ 0xaaaaaaaa, | |
| 413 | /* .S... */ 0x44444444, | |
| 414 | /* .S..C */ 0x88888888, | |
| 415 | /* .S.V. */ 0x44444444, | |
| 416 | /* .S.VC */ 0x88888888, | |
| 417 | /* .SZ.. */ 0x22222222, | |
| 418 | /* .SZ.C */ 0xaaaaaaaa, | |
| 419 | /* .SZV. */ 0x22222222, | |
| 420 | /* .SZVC */ 0xaaaaaaaa, | |
| 421 | /* U.... */ 0x55555555, | |
| 422 | /* U...C */ 0x99999999, | |
| 423 | /* U..V. */ 0x55555555, | |
| 424 | /* U..VC */ 0x99999999, | |
| 425 | /* U.Z.. */ 0x33333333, | |
| 426 | /* U.Z.C */ 0xbbbbbbbb, | |
| 427 | /* U.ZV. */ 0x33333333, | |
| 428 | /* U.ZVC */ 0xbbbbbbbb, | |
| 429 | /* US... */ 0x55555555, | |
| 430 | /* US..C */ 0x99999999, | |
| 431 | /* US.V. */ 0x55555555, | |
| 432 | /* US.VC */ 0x99999999, | |
| 433 | /* USZ.. */ 0x33333333, | |
| 434 | /* USZ.C */ 0xbbbbbbbb, | |
| 435 | /* USZV. */ 0x33333333, | |
| 436 | /* USZVC */ 0xbbbbbbbb | |
| 401 | /* ..... */ 0x4, | |
| 402 | /* ....C */ 0x8, | |
| 403 | /* ...V. */ 0x4, | |
| 404 | /* ...VC */ 0x8, | |
| 405 | /* ..Z.. */ 0x2, | |
| 406 | /* ..Z.C */ 0xa, | |
| 407 | /* ..ZV. */ 0x2, | |
| 408 | /* ..ZVC */ 0xa, | |
| 409 | /* .S... */ 0x4, | |
| 410 | /* .S..C */ 0x8, | |
| 411 | /* .S.V. */ 0x4, | |
| 412 | /* .S.VC */ 0x8, | |
| 413 | /* .SZ.. */ 0x2, | |
| 414 | /* .SZ.C */ 0xa, | |
| 415 | /* .SZV. */ 0x2, | |
| 416 | /* .SZVC */ 0xa, | |
| 417 | /* U.... */ 0x5, | |
| 418 | /* U...C */ 0x9, | |
| 419 | /* U..V. */ 0x5, | |
| 420 | /* U..VC */ 0x9, | |
| 421 | /* U.Z.. */ 0x3, | |
| 422 | /* U.Z.C */ 0xb, | |
| 423 | /* U.ZV. */ 0x3, | |
| 424 | /* U.ZVC */ 0xb, | |
| 425 | /* US... */ 0x5, | |
| 426 | /* US..C */ 0x9, | |
| 427 | /* US.V. */ 0x5, | |
| 428 | /* US.VC */ 0x9, | |
| 429 | /* USZ.. */ 0x3, | |
| 430 | /* USZ.C */ 0xb, | |
| 431 | /* USZV. */ 0x3, | |
| 432 | /* USZVC */ 0xb | |
| 437 | 433 | }; |
| 438 | 434 | |
| 439 | 435 | |
| r2844 | r2845 | |
| 587 | 583 | if (ppc->impstate->drcuml == NULL) |
| 588 | 584 | fatalerror("Error initializing the UML"); |
| 589 | 585 | |
| 586 | /* add symbols for our stuff */ | |
| 587 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->pc, sizeof(ppc->pc), "pc"); | |
| 588 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->icount, sizeof(ppc->icount), "icount"); | |
| 589 | for (regnum = 0; regnum < 32; regnum++) | |
| 590 | { | |
| 591 | char buf[10]; | |
| 592 | sprintf(buf, "r%d", regnum); | |
| 593 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->r[regnum], sizeof(ppc->r[regnum]), buf); | |
| 594 | sprintf(buf, "fpr%d", regnum); | |
| 595 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->f[regnum], sizeof(ppc->r[regnum]), buf); | |
| 596 | } | |
| 597 | for (regnum = 0; regnum < 8; regnum++) | |
| 598 | { | |
| 599 | char buf[10]; | |
| 600 | sprintf(buf, "cr%d", regnum); | |
| 601 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->cr[regnum], sizeof(ppc->cr[regnum]), buf); | |
| 602 | } | |
| 603 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->xerso, sizeof(ppc->xerso), "xerso"); | |
| 604 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->fpscr, sizeof(ppc->fpscr), "fpscr"); | |
| 605 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->msr, sizeof(ppc->msr), "msr"); | |
| 606 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->sr, sizeof(ppc->sr), "sr"); | |
| 607 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->spr[SPR_XER], sizeof(ppc->spr[SPR_XER]), "xer"); | |
| 608 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->spr[SPR_LR], sizeof(ppc->spr[SPR_LR]), "lr"); | |
| 609 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->spr[SPR_CTR], sizeof(ppc->spr[SPR_CTR]), "ctr"); | |
| 610 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->spr, sizeof(ppc->spr), "spr"); | |
| 611 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->dcr, sizeof(ppc->dcr), "dcr"); | |
| 612 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->param0, sizeof(ppc->param0), "param0"); | |
| 613 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->param1, sizeof(ppc->param1), "param1"); | |
| 614 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->irq_pending, sizeof(ppc->irq_pending), "irq_pending"); | |
| 615 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->mode, sizeof(ppc->impstate->mode), "mode"); | |
| 616 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->arg0, sizeof(ppc->impstate->arg0), "arg0"); | |
| 617 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->arg1, sizeof(ppc->impstate->arg1), "arg1"); | |
| 618 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->updateaddr, sizeof(ppc->impstate->updateaddr), "updateaddr"); | |
| 619 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->swcount, sizeof(ppc->impstate->swcount), "swcount"); | |
| 620 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->tempaddr, sizeof(ppc->impstate->tempaddr), "tempaddr"); | |
| 621 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->tempdata, sizeof(ppc->impstate->tempdata), "tempdata"); | |
| 622 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->fp0, sizeof(ppc->impstate->fp0), "fp0"); | |
| 623 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->fpmode, sizeof(ppc->impstate->fpmode), "fpmode"); | |
| 624 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->sz_cr_table, sizeof(ppc->impstate->sz_cr_table), "sz_cr_table"); | |
| 625 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->cmp_cr_table, sizeof(ppc->impstate->cmp_cr_table), "cmp_cr_table"); | |
| 626 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->cmpl_cr_table, sizeof(ppc->impstate->cmpl_cr_table), "cmpl_cr_table"); | |
| 627 | drcuml_symbol_add(ppc->impstate->drcuml, &ppc->impstate->fcmp_cr_table, sizeof(ppc->impstate->fcmp_cr_table), "fcmp_cr_table"); | |
| 628 | ||
| 590 | 629 | /* initialize the front-end helper */ |
| 591 | 630 | if (SINGLE_INSTRUCTION_MODE) |
| 592 | 631 | feconfig.max_sequence = 1; |
| r2844 | r2845 | |
| 604 | 643 | { |
| 605 | 644 | ppc->impstate->regmap[regnum].type = DRCUML_PTYPE_MEMORY; |
| 606 | 645 | ppc->impstate->regmap[regnum].value = (FPTR)&ppc->r[regnum]; |
| 607 | ppc->impstate->fsregmap[regnum].type = DRCUML_PTYPE_MEMORY; | |
| 608 | ppc->impstate->fsregmap[regnum].value = (FPTR)((UINT32 *)&ppc->f[regnum] + BYTE_XOR_LE(0)); | |
| 609 | 646 | ppc->impstate->fdregmap[regnum].type = DRCUML_PTYPE_MEMORY; |
| 610 | 647 | ppc->impstate->fdregmap[regnum].value = (FPTR)&ppc->f[regnum]; |
| 611 | 648 | } |
| r2844 | r2845 | |
| 878 | 915 | static_generate_memory_accessor(drcuml, mode, 8, FALSE, FALSE, "read64", &ppc->impstate->read64[mode], ppc->impstate->read64mask[mode]); |
| 879 | 916 | static_generate_memory_accessor(drcuml, mode, 8, TRUE, TRUE, "write64mask", &ppc->impstate->write64mask[mode], NULL); |
| 880 | 917 | static_generate_memory_accessor(drcuml, mode, 8, TRUE, FALSE, "write64", &ppc->impstate->write64[mode], ppc->impstate->write64mask[mode]); |
| 918 | static_generate_lsw_entries(drcuml, mode); | |
| 919 | static_generate_stsw_entries(drcuml, mode); | |
| 881 | 920 | } |
| 882 | 921 | } |
| 883 | 922 | |
| r2844 | r2845 | |
| 1195 | 1234 | UML_CALLC(block, ppccom_tlb_fill, ppc); // callc tlbfill,ppc |
| 1196 | 1235 | UML_CMP(block, MEM(&ppc->param0), IMM(1)); // cmp [param0],1 |
| 1197 | 1236 | UML_JMPc(block, IF_A, isi = label++); // jmp isi,A |
| 1237 | UML_MOV(block, MEM(&ppc->pc), IREG(0)); // mov <pc>,i0 | |
| 1198 | 1238 | save_fast_iregs(block); // <save fastregs> |
| 1199 | 1239 | UML_EXIT(block, IMM(EXECUTE_MISSING_CODE)); // exit EXECUTE_MISSING_CODE |
| 1200 | 1240 | UML_LABEL(block, isi); // isi: |
| r2844 | r2845 | |
| 1290 | 1330 | else if (exception == EXCEPTION_DTLBMISSL) |
| 1291 | 1331 | UML_OR(block, SPR32(SPROEA_SRR1), SPR32(SPROEA_SRR1), IMM(0x00010000)); // or [srr1],0x00010000 |
| 1292 | 1332 | if (exception == EXCEPTION_ITLBMISS || exception == EXCEPTION_DTLBMISSL || exception == EXCEPTION_DTLBMISSS) |
| 1293 | UML_ROLINS(block, SPR32(SPROEA_SRR1), CR32, IMM( | |
| 1333 | UML_ROLINS(block, SPR32(SPROEA_SRR1), CR32(0), IMM(28), IMM(CRMASK(0))); | |
| 1294 | 1334 | } |
| 1295 | 1335 | |
| 1296 | 1336 | /* update MSR */ |
| r2844 | r2845 | |
| 1455 | 1495 | } |
| 1456 | 1496 | |
| 1457 | 1497 | /* general case: assume paging and perform a translation */ |
| 1458 | if ((ppc->cap & PPCCAP_OEA) && (mode & MODE_DATA_TRANSLATION)) | |
| 1498 | if (((ppc->cap & PPCCAP_OEA) && (mode & MODE_DATA_TRANSLATION)) || (iswrite && (ppc->cap & PPCCAP_4XX) && (mode & MODE_PROTECTION))) | |
| 1459 | 1499 | { |
| 1460 | 1500 | UML_SHR(block, IREG(3), IREG(0), IMM(12)); // shr i3,i0,12 |
| 1461 | 1501 | UML_LOAD(block, IREG(3), ppc->tlb_table, IREG(3), DWORD); // load i3,[tlb_table],i3,dword |
| r2844 | r2845 | |
| 1464 | 1504 | UML_LABEL(block, tlbreturn = label++); // tlbreturn: |
| 1465 | 1505 | UML_ROLINS(block, IREG(0), IREG(3), IMM(0), IMM(0xfffff000)); // rolins i0,i3,0,0xfffff000 |
| 1466 | 1506 | } |
| 1507 | else if (ppc->cap & PPCCAP_4XX) | |
| 1508 | UML_AND(block, IREG(0), IREG(0), IMM(0x7fffffff)); // and i0,i0,0x7fffffff | |
| 1467 | 1509 | UML_XOR(block, IREG(0), IREG(0), IMM((mode & MODE_LITTLE_ENDIAN) ? (8 - size) : 0)); // xor i0,i0,8-size |
| 1468 | 1510 | |
| 1469 | 1511 | for (ramnum = 0; ramnum < PPC_MAX_FASTRAM; ramnum++) |
| r2844 | r2845 | |
| 1570 | 1612 | if (!ismasked) |
| 1571 | 1613 | UML_WRITE(block, IREG(0), IREG(1), PROGRAM_WORD); // write i0,i1,program_word |
| 1572 | 1614 | else |
| 1573 | UML_WRITEM(block, IREG(0), IREG( | |
| 1615 | UML_WRITEM(block, IREG(0), IREG(1), IREG(2), PROGRAM_WORD); // writem i0,i2,i1,program_word | |
| 1574 | 1616 | } |
| 1575 | 1617 | else |
| 1576 | 1618 | { |
| r2844 | r2845 | |
| 1587 | 1629 | if (!ismasked) |
| 1588 | 1630 | UML_WRITE(block, IREG(0), IREG(1), PROGRAM_DWORD); // write i0,i1,program_dword |
| 1589 | 1631 | else |
| 1590 | UML_WRITEM(block, IREG(0), IREG( | |
| 1632 | UML_WRITEM(block, IREG(0), IREG(1), IREG(2), PROGRAM_DWORD); // writem i0,i2,i1,program_dword | |
| 1591 | 1633 | } |
| 1592 | 1634 | else |
| 1593 | 1635 | { |
| r2844 | r2845 | |
| 1604 | 1646 | if (!ismasked) |
| 1605 | 1647 | UML_DWRITE(block, IREG(0), IREG(1), PROGRAM_QWORD); // dwrite i0,i1,program_qword |
| 1606 | 1648 | else |
| 1607 | UML_DWRITEM(block, IREG(0), IREG( | |
| 1649 | UML_DWRITEM(block, IREG(0), IREG(1), IREG(2), PROGRAM_QWORD); // dwritem i0,i2,i1,program_qword | |
| 1608 | 1650 | } |
| 1609 | 1651 | else |
| 1610 | 1652 | { |
| r2844 | r2845 | |
| 1626 | 1668 | if (iswrite) |
| 1627 | 1669 | { |
| 1628 | 1670 | UML_MOV(block, MEM(&ppc->impstate->tempaddr), IREG(0)); // mov [tempaddr],i0 |
| 1629 | UML_MOV(block, MEM(&ppc->impstate->tempdata), IREG(1)); | |
| 1671 | UML_MOV(block, MEM(&ppc->impstate->tempdata.w.l), IREG(1)); | |
| 1630 | 1672 | UML_SUB(block, IREG(0), IREG(0), IMM(1)); // sub i0,i0,1 |
| 1631 | 1673 | UML_SHR(block, IREG(1), IREG(1), IMM(8)); // shr i1,i1,8 |
| 1632 | 1674 | UML_MOV(block, IREG(2), IMM(0x00ff)); // mov i2,0x00ff |
| 1633 | 1675 | UML_CALLH(block, masked); // callh masked |
| 1634 | 1676 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM(1)); // add i0,[tempaddr],1 |
| 1635 | UML_SHL(block, IREG(1), MEM(&ppc->impstate->tempdata), IMM(8)); | |
| 1677 | UML_SHL(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l), IMM(8)); | |
| 1636 | 1678 | UML_MOV(block, IREG(2), IMM(0xff00)); // mov i2,0xff00 |
| 1637 | 1679 | UML_CALLH(block, masked); // callh masked |
| 1638 | 1680 | } |
| r2844 | r2845 | |
| 1642 | 1684 | UML_SUB(block, IREG(0), IREG(0), IMM(1)); // sub i0,i0,1 |
| 1643 | 1685 | UML_MOV(block, IREG(2), IMM(0x00ff)); // mov i2,0x00ff |
| 1644 | 1686 | UML_CALLH(block, masked); // callh masked |
| 1645 | UML_SHL(block, MEM(&ppc->impstate->tempdata), IREG(0), IMM(8)); | |
| 1687 | UML_SHL(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0), IMM(8)); | |
| 1646 | 1688 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM(1)); // add i0,[tempaddr],1 |
| 1647 | 1689 | UML_MOV(block, IREG(2), IMM(0xff00)); // mov i2,0xff00 |
| 1648 | 1690 | UML_CALLH(block, masked); // callh masked |
| 1649 | 1691 | UML_SHR(block, IREG(0), IREG(0), IMM(8)); // shr i0,i0,8 |
| 1650 | UML_OR(block, IREG(0), IREG(0), MEM(&ppc->impstate->tempdata)); | |
| 1692 | UML_OR(block, IREG(0), IREG(0), MEM(&ppc->impstate->tempdata.w.l)); | |
| 1651 | 1693 | } |
| 1652 | 1694 | } |
| 1653 | 1695 | else if (size == 4) |
| r2844 | r2845 | |
| 1656 | 1698 | if (iswrite) |
| 1657 | 1699 | { |
| 1658 | 1700 | UML_MOV(block, MEM(&ppc->impstate->tempaddr), IREG(0)); // mov [tempaddr],i0 |
| 1659 | UML_MOV(block, MEM(&ppc->impstate->tempdata), IREG(1)); | |
| 1701 | UML_MOV(block, MEM(&ppc->impstate->tempdata.w.l), IREG(1)); | |
| 1660 | 1702 | UML_TEST(block, IREG(0), IMM(2)); // test i0,i0,2 |
| 1661 | 1703 | UML_JMPc(block, IF_NZ, offs2 = label++); // jnz offs2 |
| 1662 | 1704 | UML_SUB(block, IREG(0), IREG(0), IMM(1)); // sub i0,i0,1 |
| r2844 | r2845 | |
| 1664 | 1706 | UML_MOV(block, IREG(2), IMM(0x00ffffff)); // mov i2,0x00ffffff |
| 1665 | 1707 | UML_CALLH(block, masked); // callh masked |
| 1666 | 1708 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM(3)); // add i0,[tempaddr],3 |
| 1667 | UML_SHL(block, IREG(1), MEM(&ppc->impstate->tempdata), IMM(24)); | |
| 1709 | UML_SHL(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l), IMM(24)); | |
| 1668 | 1710 | UML_MOV(block, IREG(2), IMM(0xff000000)); // mov i2,0xff000000 |
| 1669 | 1711 | UML_CALLH(block, masked); // callh masked |
| 1670 | 1712 | UML_RET(block); // ret |
| r2844 | r2845 | |
| 1676 | 1718 | UML_MOV(block, IREG(2), IMM(0x0000ffff)); // mov i2,0x0000ffff |
| 1677 | 1719 | UML_CALLH(block, masked); // callh masked |
| 1678 | 1720 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM(2)); // add i0,[tempaddr],2 |
| 1679 | UML_SHL(block, IREG(1), MEM(&ppc->impstate->tempdata), IMM(16)); | |
| 1721 | UML_SHL(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l), IMM(16)); | |
| 1680 | 1722 | UML_MOV(block, IREG(2), IMM(0xffff0000)); // mov i2,0xffff0000 |
| 1681 | 1723 | UML_CALLH(block, masked); // callh masked |
| 1682 | 1724 | UML_RET(block); // ret |
| r2844 | r2845 | |
| 1686 | 1728 | UML_MOV(block, IREG(2), IMM(0x000000ff)); // mov i2,0x000000ff |
| 1687 | 1729 | UML_CALLH(block, masked); // callh masked |
| 1688 | 1730 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM(1)); // add i0,[tempaddr],1 |
| 1689 | UML_SHL(block, IREG(1), MEM(&ppc->impstate->tempdata), IMM(8)); | |
| 1731 | UML_SHL(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l), IMM(8)); | |
| 1690 | 1732 | UML_MOV(block, IREG(2), IMM(0xffffff00)); // mov i2,0xffffff00 |
| 1691 | 1733 | UML_CALLH(block, masked); // callh masked |
| 1692 | 1734 | } |
| r2844 | r2845 | |
| 1698 | 1740 | UML_SUB(block, IREG(0), IREG(0), IMM(1)); // sub i0,i0,1 |
| 1699 | 1741 | UML_MOV(block, IREG(2), IMM(0x00ffffff)); // mov i2,0x00ffffff |
| 1700 | 1742 | UML_CALLH(block, masked); // callh masked |
| 1701 | UML_SHL(block, MEM(&ppc->impstate->tempdata), IREG(0), IMM(8)); | |
| 1743 | UML_SHL(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0), IMM(8)); | |
| 1702 | 1744 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM(3)); // add i0,[tempaddr],3 |
| 1703 | 1745 | UML_MOV(block, IREG(2), IMM(0xff000000)); // mov i2,0xff000000 |
| 1704 | 1746 | UML_CALLH(block, masked); // callh masked |
| 1705 | 1747 | UML_SHR(block, IREG(0), IREG(0), IMM(24)); // shr i0,i0,24 |
| 1706 | UML_OR(block, IREG(0), IREG(0), MEM(&ppc->impstate->tempdata)); | |
| 1748 | UML_OR(block, IREG(0), IREG(0), MEM(&ppc->impstate->tempdata.w.l)); | |
| 1707 | 1749 | UML_RET(block); // ret |
| 1708 | 1750 | UML_LABEL(block, offs2); // offs2: |
| 1709 | 1751 | UML_TEST(block, IREG(0), IMM(1)); // test i0,i0,1 |
| r2844 | r2845 | |
| 1711 | 1753 | UML_SUB(block, IREG(0), IREG(0), IMM(2)); // sub i0,i0,2 |
| 1712 | 1754 | UML_MOV(block, IREG(2), IMM(0x0000ffff)); // mov i2,0x0000ffff |
| 1713 | 1755 | UML_CALLH(block, masked); // callh masked |
| 1714 | UML_SHL(block, MEM(&ppc->impstate->tempdata), IREG(0), IMM(16)); | |
| 1756 | UML_SHL(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0), IMM(16)); | |
| 1715 | 1757 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM(2)); // add i0,[tempaddr],2 |
| 1716 | 1758 | UML_MOV(block, IREG(2), IMM(0xffff0000)); // mov i2,0xffff0000 |
| 1717 | 1759 | UML_CALLH(block, masked); // callh masked |
| 1718 | 1760 | UML_SHR(block, IREG(0), IREG(0), IMM(16)); // shr i0,i0,16 |
| 1719 | UML_OR(block, IREG(0), IREG(0), MEM(&ppc->impstate->tempdata)); | |
| 1761 | UML_OR(block, IREG(0), IREG(0), MEM(&ppc->impstate->tempdata.w.l)); | |
| 1720 | 1762 | UML_RET(block); // ret |
| 1721 | 1763 | UML_LABEL(block, offs3); // offs3: |
| 1722 | 1764 | UML_SUB(block, IREG(0), IREG(0), IMM(3)); // sub i0,i0,3 |
| 1723 | 1765 | UML_MOV(block, IREG(2), IMM(0x000000ff)); // mov i2,0x000000ff |
| 1724 | 1766 | UML_CALLH(block, masked); // callh masked |
| 1725 | UML_SHL(block, MEM(&ppc->impstate->tempdata), IREG(0), IMM(24)); | |
| 1767 | UML_SHL(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0), IMM(24)); | |
| 1726 | 1768 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM(1)); // add i0,[tempaddr],1 |
| 1727 | 1769 | UML_MOV(block, IREG(2), IMM(0xffffff00)); // mov i2,0xffffff00 |
| 1728 | 1770 | UML_CALLH(block, masked); // callh masked |
| 1729 | 1771 | UML_SHR(block, IREG(0), IREG(0), IMM(8)); // shr i0,i0,8 |
| 1730 | UML_OR(block, IREG(0), IREG(0), MEM(&ppc->impstate->tempdata)); | |
| 1772 | UML_OR(block, IREG(0), IREG(0), MEM(&ppc->impstate->tempdata.w.l)); | |
| 1731 | 1773 | } |
| 1732 | 1774 | } |
| 1733 | 1775 | UML_RET(block); // ret |
| r2844 | r2845 | |
| 1756 | 1798 | UML_LOAD(block, IREG(3), ppc->tlb_table, IREG(3), DWORD); // load i3,[tlb_table],i3,dword |
| 1757 | 1799 | UML_JMP(block, tlbreturn); // jmp tlbreturn |
| 1758 | 1800 | UML_LABEL(block, dsi); // dsi: |
| 1759 | if (!(ppc->cap & PPCCAP_603_MMU)) | |
| 1801 | ||
| 1802 | /* 4XX case: protection exception */ | |
| 1803 | if (ppc->cap & PPCCAP_4XX) | |
| 1760 | 1804 | { |
| 1761 | UML_MOV(block, SPR32(SPR | |
| 1805 | UML_MOV(block, SPR32(SPR4XX_DEA | |
| 1762 | 1806 | UML_EXH(block, ppc->impstate->exception[EXCEPTION_DSI], IREG(0)); // exh dsi,i0 |
| 1763 | 1807 | } |
| 1764 | else | |
| 1808 | ||
| 1809 | /* 603 case: TLBMISS exception */ | |
| 1810 | else if (ppc->cap & PPCCAP_603_MMU) | |
| 1765 | 1811 | { |
| 1766 | 1812 | UML_MOV(block, SPR32(SPR603_DMISS), IREG(0)); // mov [dmiss],i0 |
| 1767 | 1813 | UML_MOV(block, SPR32(SPR603_DCMP), MEM(&ppc->mmu603_cmp)); // mov [dcmp],[mmu603_cmp] |
| r2844 | r2845 | |
| 1772 | 1818 | else |
| 1773 | 1819 | UML_EXH(block, ppc->impstate->exception[EXCEPTION_DTLBMISSL], IREG(0)); // exh dtlbmissl,i0 |
| 1774 | 1820 | } |
| 1821 | ||
| 1822 | /* general case: DSI exception */ | |
| 1823 | else | |
| 1824 | { | |
| 1825 | UML_MOV(block, SPR32(SPROEA_DSISR), MEM(&ppc->param0)); // mov [dsisr],[param0] | |
| 1826 | UML_EXH(block, ppc->impstate->exception[EXCEPTION_DSI], IREG(0)); // exh dsi,i0 | |
| 1827 | } | |
| 1775 | 1828 | } |
| 1776 | 1829 | |
| 1777 | 1830 | drcuml_block_end(block); |
| r2844 | r2845 | |
| 1811 | 1864 | } |
| 1812 | 1865 | |
| 1813 | 1866 | |
| 1867 | /*------------------------------------------------- | |
| 1868 | static_generate_lsw_entries - generate a | |
| 1869 | subroutine to perform LSWI/LSWX; one handle | |
| 1870 | for each possible register | |
| 1871 | -------------------------------------------------*/ | |
| 1814 | 1872 | |
| 1873 | static void static_generate_lsw_entries(drcuml_state *drcuml, int mode) | |
| 1874 | { | |
| 1875 | drcuml_block *block; | |
| 1876 | jmp_buf errorbuf; | |
| 1877 | int regnum; | |
| 1878 | ||
| 1879 | /* if we get an error back, we're screwed */ | |
| 1880 | if (setjmp(errorbuf) != 0) | |
| 1881 | fatalerror("Unrecoverable error in static_generate_lsw_entries"); | |
| 1882 | ||
| 1883 | /* begin generating */ | |
| 1884 | block = drcuml_block_begin(drcuml, 32 * 30, &errorbuf); | |
| 1885 | ||
| 1886 | /* iterate over all possible registers */ | |
| 1887 | for (regnum = 0; regnum < 32; regnum++) | |
| 1888 | { | |
| 1889 | char temp[20]; | |
| 1890 | ||
| 1891 | /* allocate a handle */ | |
| 1892 | sprintf(temp, "lsw%d", regnum); | |
| 1893 | alloc_handle(drcuml, &ppc->impstate->lsw[mode][regnum], temp); | |
| 1894 | UML_HANDLE(block, ppc->impstate->lsw[mode][regnum]); // handle lsw<regnum> | |
| 1895 | UML_LABEL(block, regnum); // regnum: | |
| 1896 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(0)); // add i0,[updateaddr],0 | |
| 1897 | UML_CALLH(block, ppc->impstate->read8[mode]); // callh read8 | |
| 1898 | UML_ROLAND(block, R32(regnum), IREG(0), IMM(24), IMM(0xff000000)); // roland reg,i0,24,0xff000000 | |
| 1899 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1 | |
| 1900 | UML_RETc(block, IF_Z); // ret z | |
| 1901 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(1)); // add i0,[updateaddr],1 | |
| 1902 | UML_CALLH(block, ppc->impstate->read8[mode]); // callh read8 | |
| 1903 | UML_ROLAND(block, IREG(0), IREG(0), IMM(16), IMM(0x00ff0000)); // roland i0,i0,16,0x00ff0000 | |
| 1904 | UML_OR(block, R32(regnum), R32(regnum), IREG(0)); // or reg,i0 | |
| 1905 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1 | |
| 1906 | UML_RETc(block, IF_Z); // ret z | |
| 1907 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(2)); // add i0,[updateaddr],2 | |
| 1908 | UML_CALLH(block, ppc->impstate->read8[mode]); // callh read8 | |
| 1909 | UML_ROLAND(block, IREG(0), IREG(0), IMM(8), IMM(0x0000ff00)); // roland i0,i0,8,0x0000ff00 | |
| 1910 | UML_OR(block, R32(regnum), R32(regnum), IREG(0)); // or reg,i0 | |
| 1911 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1 | |
| 1912 | UML_RETc(block, IF_Z); // ret z | |
| 1913 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(3)); // add i0,[updateaddr],3 | |
| 1914 | UML_ADD(block, MEM(&ppc->impstate->updateaddr), IREG(0), IMM(1)); // add [updateaddr],i0,1 | |
| 1915 | UML_CALLH(block, ppc->impstate->read8[mode]); // callh read8 | |
| 1916 | UML_ROLAND(block, IREG(0), IREG(0), IMM(0), IMM(0x000000ff)); // roland i0,i0,0,0x000000ff | |
| 1917 | UML_OR(block, R32(regnum), R32(regnum), IREG(0)); // or reg,i0 | |
| 1918 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1 | |
| 1919 | UML_RETc(block, IF_Z); // ret z | |
| 1920 | UML_JMP(block, (regnum + 1) % 32); // jmp nextreg | |
| 1921 | } | |
| 1922 | ||
| 1923 | drcuml_block_end(block); | |
| 1924 | } | |
| 1925 | ||
| 1926 | ||
| 1927 | /*------------------------------------------------- | |
| 1928 | static_generate_stsw_entries - generate a | |
| 1929 | subroutine to perform LSWI/LSWX; one handle | |
| 1930 | for each possible register | |
| 1931 | -------------------------------------------------*/ | |
| 1932 | ||
| 1933 | static void static_generate_stsw_entries(drcuml_state *drcuml, int mode) | |
| 1934 | { | |
| 1935 | drcuml_block *block; | |
| 1936 | jmp_buf errorbuf; | |
| 1937 | int regnum; | |
| 1938 | ||
| 1939 | /* if we get an error back, we're screwed */ | |
| 1940 | if (setjmp(errorbuf) != 0) | |
| 1941 | fatalerror("Unrecoverable error in static_generate_stsw_entries"); | |
| 1942 | ||
| 1943 | /* begin generating */ | |
| 1944 | block = drcuml_block_begin(drcuml, 32 * 30, &errorbuf); | |
| 1945 | ||
| 1946 | /* iterate over all possible registers */ | |
| 1947 | for (regnum = 0; regnum < 32; regnum++) | |
| 1948 | { | |
| 1949 | char temp[20]; | |
| 1950 | ||
| 1951 | /* allocate a handle */ | |
| 1952 | sprintf(temp, "stsw%d", regnum); | |
| 1953 | alloc_handle(drcuml, &ppc->impstate->stsw[mode][regnum], temp); | |
| 1954 | UML_HANDLE(block, ppc->impstate->stsw[mode][regnum]); // handle stsw<regnum> | |
| 1955 | UML_LABEL(block, regnum); // regnum: | |
| 1956 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(0)); // add i0,[updateaddr],0 | |
| 1957 | UML_ROLAND(block, IREG(1), R32(regnum), IMM(8), IMM(0xff)); // roland i1,regnum,8,0xff | |
| 1958 | UML_CALLH(block, ppc->impstate->write8[mode]); // callh write8 | |
| 1959 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1 | |
| 1960 | UML_RETc(block, IF_Z); // ret z | |
| 1961 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(1)); // add i0,[updateaddr],1 | |
| 1962 | UML_ROLAND(block, IREG(1), R32(regnum), IMM(16), IMM(0xff)); // roland i1,regnum,16,0xff | |
| 1963 | UML_CALLH(block, ppc->impstate->write8[mode]); // callh write8 | |
| 1964 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1 | |
| 1965 | UML_RETc(block, IF_Z); // ret z | |
| 1966 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(2)); // add i0,[updateaddr],2 | |
| 1967 | UML_ROLAND(block, IREG(1), R32(regnum), IMM(24), IMM(0xff)); // roland i1,regnum,24,0xff | |
| 1968 | UML_CALLH(block, ppc->impstate->write8[mode]); // callh write8 | |
| 1969 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1 | |
| 1970 | UML_RETc(block, IF_Z); // ret z | |
| 1971 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(3)); // add i0,[updateaddr],3 | |
| 1972 | UML_ADD(block, MEM(&ppc->impstate->updateaddr), IREG(0), IMM(1)); // add [updateaddr],i0,1 | |
| 1973 | UML_ROLAND(block, IREG(1), R32(regnum), IMM(0), IMM(0xff)); // roland i1,regnum,0,0xff | |
| 1974 | UML_CALLH(block, ppc->impstate->write8[mode]); // callh write8 | |
| 1975 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1 | |
| 1976 | UML_RETc(block, IF_Z); // ret z | |
| 1977 | UML_JMP(block, (regnum + 1) % 32); // jmp nextreg | |
| 1978 | } | |
| 1979 | ||
| 1980 | drcuml_block_end(block); | |
| 1981 | } | |
| 1982 | ||
| 1983 | ||
| 1815 | 1984 | /*************************************************************************** |
| 1816 | 1985 | CODE GENERATION |
| 1817 | 1986 | ***************************************************************************/ |
| r2844 | r2845 | |
| 1823 | 1992 | |
| 1824 | 1993 | static void generate_update_mode(drcuml_block *block) |
| 1825 | 1994 | { |
| 1995 | /* LE in bit 0 of mode */ | |
| 1826 | 1996 | UML_AND(block, IREG(0), MSR32, IMM(MSR_LE)); // and i0,msr,MSR_LE |
| 1827 | UML_AND(block, IREG(1), MSR32, IMM(MSROEA_DR)); // and i1,msr,MSR_DR | |
| 1828 | UML_SHR(block, IREG(1), IREG(1), IMM(3)); // shr i1,i1,3 | |
| 1829 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1 | |
| 1830 | UML_AND(block, IREG(1), MSR32, IMM(MSR_PR)); // and i1,msr,MSR_PR | |
| 1831 | UML_SHR(block, IREG(1), IREG(1), IMM(12)); // shr i1,i1,12 | |
| 1997 | ||
| 1998 | /* DR (OEA and 403GCX) in bit 1 of mode */ | |
| 1999 | if ((ppc->cap & PPCCAP_OEA) || ppc->flavor == PPC_MODEL_403GCX) | |
| 2000 | { | |
| 2001 | UML_ROLAND(block, IREG(1), MSR32, IMM(29), IMM(0x02)); // roland i1,[msr],29,0x02 | |
| 2002 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1 | |
| 2003 | } | |
| 2004 | ||
| 2005 | /* (4XX) in bit 1 of mode */ | |
| 2006 | if (ppc->cap & PPCCAP_4XX) | |
| 2007 | { | |
| 2008 | UML_ROLAND(block, IREG(1), MSR32, IMM(30), IMM(0x02)); // roland i1,[msr],30,0x02 | |
| 2009 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1 | |
| 2010 | } | |
| 2011 | ||
| 2012 | /* PR in bit 2 of mode */ | |
| 2013 | UML_ROLAND(block, IREG(1), MSR32, IMM(20), IMM(0x04)); // roland i1,[msr],20,0x04 | |
| 1832 | 2014 | UML_OR(block, MEM(&ppc->impstate->mode), IREG(0), IREG(1)); // or [mode],i0,i1 |
| 1833 | 2015 | } |
| 1834 | 2016 | |
| r2844 | r2845 | |
| 2034 | 2216 | generate_compute_flags - compute CR0 and/or XER flags |
| 2035 | 2217 | ------------------------------------------------------------------*/ |
| 2036 | 2218 | |
| 2037 | static void generate_compute_flags(drcuml_block *block, int updatecr, UINT32 xermask, int invertcarry) | |
| 2219 | static void generate_compute_flags(drcuml_block *block, const opcode_desc *desc, int updatecr, UINT32 xermask, int invertcarry) | |
| 2038 | 2220 | { |
| 2039 | int xerflags = ((xermask & XER_OV) ? DRCUML_FLAG_V : 0) | ((xermask & XER_CA) ? DRCUML_FLAG_C : 0); | |
| 2040 | UINT32 xermask_so = xermask | ((xermask & XER_OV) ? XER_SO : 0); | |
| 2221 | UINT32 xerflags; | |
| 2041 | 2222 | |
| 2223 | /* modify inputs based on required flags */ | |
| 2224 | if (!DISABLE_FLAG_OPTIMIZATIONS) | |
| 2225 | { | |
| 2226 | if (!(desc->regreq[3] & REGFLAG_XER_CA)) | |
| 2227 | xermask &= ~XER_CA; | |
| 2228 | if (!(desc->regreq[2] & REGFLAG_CR(0))) | |
| 2229 | updatecr = 0; | |
| 2230 | } | |
| 2231 | xerflags = ((xermask & XER_OV) ? DRCUML_FLAG_V : 0) | ((xermask & XER_CA) ? DRCUML_FLAG_C : 0); | |
| 2232 | ||
| 2042 | 2233 | /* easy case: nothing to do */ |
| 2043 | 2234 | if (!updatecr && xermask == 0) |
| 2044 | 2235 | return; |
| r2844 | r2845 | |
| 2046 | 2237 | /* semi-easy case: crfield only */ |
| 2047 | 2238 | if (xermask == 0) |
| 2048 | 2239 | { |
| 2049 | UML_MOV(block, IREG(0), CR32); // mov i0,cr32 | |
| 2050 | UML_GETFLGS(block, IREG(1), DRCUML_FLAG_S | DRCUML_FLAG_Z); // getflgs i1,sz | |
| 2051 | UML_LOAD(block, IREG(1), ppc->impstate->sz_cr_table, IREG(1), DWORD); // load i1,sz_cr_table,i1,dword | |
| 2052 | UML_ROLINS(block, IREG(0), IREG(1), IMM(0), IMM(CRMASK(0))); // rolins i0,i1,0,crmask(field) | |
| 2053 | UML_AND(block, IREG(1), SPR32(SPR_XER), IMM(XER_SO)); // and i1,[xer],XER_SO | |
| 2054 | UML_SHR(block, IREG(1), IREG(1), IMM(3)); // shr i1,i1,3 | |
| 2055 | UML_OR(block, CR32, IREG(0), IREG(1)); // or [cr],i0,i1 | |
| 2240 | UML_GETFLGS(block, IREG(0), DRCUML_FLAG_S | DRCUML_FLAG_Z); // getflgs i0,sz | |
| 2241 | UML_LOAD(block, IREG(0), ppc->impstate->sz_cr_table, IREG(0), BYTE); // load i0,sz_cr_table,i0,byte | |
| 2242 | UML_OR(block, CR32(0), IREG(0), XERSO32); // or [cr0],i0,[xerso] | |
| 2056 | 2243 | return; |
| 2057 | 2244 | } |
| 2058 | 2245 | |
| r2844 | r2845 | |
| 2061 | 2248 | { |
| 2062 | 2249 | if (xermask & XER_OV) |
| 2063 | 2250 | { |
| 2064 | UML_MOV(block, IREG(0), SPR32(SPR_XER)); // mov i0,[xer] | |
| 2065 | UML_GETFLGS(block, IREG(1), xerflags); // getflgs i1,xerflags | |
| 2251 | UML_GETFLGS(block, IREG(0), xerflags); // getflgs i0,xerflags | |
| 2066 | 2252 | if (invertcarry && (xermask & XER_CA)) |
| 2067 | UML_XOR(block, IREG(1), IREG(1), IMM(DRCUML_FLAG_C)); // xor i1,i1,FLAG_C | |
| 2068 | UML_ROLINS(block, IREG(0), IREG(1), IMM(29), IMM(xermask)); // rolins i0,i1,29,crmask(xermask) | |
| 2069 | UML_AND(block, IREG(1), SPR32(SPR_XER), IMM(XER_OV)); // and i1,[xer],XER_OV | |
| 2070 | UML_SHL(block, IREG(1), IREG(1), IMM(1)); // shl i1,i1,1 | |
| 2071 | UML_OR(block, SPR32(SPR_XER), IREG(0), IREG(1)); // or [xer],i0,i1 | |
| 2253 | UML_XOR(block, IREG(0), IREG(0), IMM(DRCUML_FLAG_C)); // xor i0,i0,FLAG_C | |
| 2254 | UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(xermask)); // rolins [xer],i0,29,xermask | |
| 2255 | UML_SHR(block, IREG(0), IREG(0), IMM(1)); // shr i0,i0,1 | |
| 2256 | UML_OR(block, XERSO32, XERSO32, IREG(0)); // or [xerso],i0 | |
| 2072 | 2257 | } |
| 2073 | 2258 | else |
| 2074 | 2259 | { |
| r2844 | r2845 | |
| 2079 | 2264 | } |
| 2080 | 2265 | |
| 2081 | 2266 | /* tricky case: both */ |
| 2082 | UML_GETFLGS(block, IREG(0), DRCUML_FLAG_S | DRCUML_FLAG_Z | xerflags); // getflgs i0,sz|xerflags | |
| 2083 | if (invertcarry) | |
| 2084 | UML_XOR(block, IREG(2), IREG(2), IMM(DRCUML_FLAG_C)); // xor i2,i2,FLAG_C | |
| 2085 | UML_LOAD(block, IREG(0), ppc->impstate->sz_cr_table, IREG(0), DWORD); // load i0,sz_cr_table,i0,dword | |
| 2086 | UML_AND(block, IREG(1), SPR32(SPR_XER), IMM(~xermask)); // and i1,[xer],~xermask | |
| 2087 | UML_SHL(block, IREG(2), IREG(0), IMM(4)); // shl i2,i0,4 | |
| 2088 | if (xermask_so != (XER_CA | XER_OV | XER_SO)) | |
| 2089 | UML_AND(block, IREG(2), IREG(2), IMM(xermask_so)); // and i2,i2,xermask | |
| 2090 | UML_OR(block, IREG(1), IREG(1), IREG(2)); // or i1,i1,i2 | |
| 2091 | UML_MOV(block, SPR32(SPR_XER), IREG(1)); // mov [xer],i1 | |
| 2092 | UML_SHR(block, IREG(1), IREG(1), IMM(3)); // shr i1,i1,3 | |
| 2093 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1 | |
| 2094 | UML_AND(block, IREG(1), CR32, IMM(~CRMASK(0))); // and i1,[cr],~crmask(0) | |
| 2095 | UML_AND(block, IREG(0), IREG(0), IMM(CRMASK(0))); // and i0,i0,crmask(0) | |
| 2096 | UML_OR(block, CR32, IREG(0), IREG(1)); // or cr32,i0,i1 | |
| 2267 | UML_GETFLGS(block, IREG(0), DRCUML_FLAG_S | DRCUML_FLAG_Z | xerflags); // getflgs i0,SZ | xerflags | |
| 2268 | UML_LOAD(block, IREG(1), ppc->impstate->sz_cr_table, IREG(0), BYTE); // load i1,sz_cr_table,i0,byte | |
| 2269 | if (invertcarry && (xermask & XER_CA)) | |
| 2270 | UML_XOR(block, IREG(0), IREG(0), IMM(DRCUML_FLAG_C)); // xor i0,i0,FLAG_C | |
| 2271 | UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(xermask)); // rolins [xer],i0,29,xermask | |
| 2272 | if (xermask & XER_OV) | |
| 2273 | { | |
| 2274 | UML_ROLAND(block, IREG(0), IREG(0), IMM(31), IMM(1)); // roland i0,i0,31,0x0001 | |
| 2275 | UML_OR(block, XERSO32, XERSO32, IREG(0)); // or [xerso],i0 | |
| 2276 | UML_OR(block, CR32(0), IREG(1), IREG(0)); // or [cr0],i1,i0 | |
| 2277 | } | |
| 2278 | else | |
| 2279 | UML_OR(block, CR32(0), IREG(1), XERSO32); // or [cr0],i1,[xerso] | |
| 2097 | 2280 | } |
| 2098 | 2281 | |
| 2099 | 2282 | |
| r2844 | r2845 | |
| 2158 | 2341 | } |
| 2159 | 2342 | if (!(bo & 0x10)) |
| 2160 | 2343 | { |
| 2161 | UML_TEST(block, CR32, IMM( | |
| 2344 | UML_TEST(block, CR32(bi / 4), IMM( | |
| 2162 | 2345 | UML_JMPc(block, (bo & 0x08) ? IF_Z : IF_NZ, skip); // jmp skip,z/nz |
| 2163 | 2346 | } |
| 2164 | 2347 | generate_branch(block, compiler, desc, source, link); // <branch> |
| r2844 | r2845 | |
| 2215 | 2398 | case 0x0a: /* CMPLI */ |
| 2216 | 2399 | UML_CMP(block, R32(G_RA(op)), IMM(G_UIMM(op))); // cmp ra,uimm |
| 2217 | 2400 | UML_GETFLGS(block, IREG(0), DRCUML_FLAG_Z | DRCUML_FLAG_C); // getflgs i0,zc |
| 2218 | UML_LOAD(block, IREG(0), ppc->impstate->cmpl_cr_table, IREG(0), DWORD); // load i0,cmpl_cr_table,i0,dword | |
| 2219 | UML_ROLINS(block, CR32, IREG(0), IMM(0), IMM(CRMASK(G_CRFD(op)))); // rolins cr,i0,0,crmask[cr] | |
| 2401 | UML_LOAD(block, IREG(0), ppc->impstate->cmpl_cr_table, IREG(0), BYTE); // load i0,cmpl_cr_table,i0,byte | |
| 2402 | UML_OR(block, CR32(G_CRFD(op)), IREG(0), XERSO32); // or [crn],i0,[xerso] | |
| 2220 | 2403 | return TRUE; |
| 2221 | 2404 | |
| 2222 | 2405 | case 0x0b: /* CMPI */ |
| 2223 | 2406 | UML_CMP(block, R32(G_RA(op)), IMM((INT16)G_SIMM(op))); // cmp ra,uimm |
| 2224 | 2407 | UML_GETFLGS(block, IREG(0), DRCUML_FLAG_Z | DRCUML_FLAG_C | DRCUML_FLAG_S); // getflgs i0,zcs |
| 2225 | UML_LOAD(block, IREG(0), ppc->impstate->cmp_cr_table, IREG(0), DWORD); // load i0,cmp_cr_table,i0,dword | |
| 2226 | UML_ROLINS(block, CR32, IREG(0), IMM(0), IMM(CRMASK(G_CRFD(op)))); // rolins cr,i0,0,crmask[cr] | |
| 2408 | UML_LOAD(block, IREG(0), ppc->impstate->cmp_cr_table, IREG(0), BYTE); // load i0,cmp_cr_table,i0,byte | |
| 2409 | UML_OR(block, CR32(G_CRFD(op)), IREG(0), XERSO32); // or [crn],i0,[xerso] | |
| 2227 | 2410 | return TRUE; |
| 2228 | 2411 | |
| 2229 | 2412 | case 0x08: /* SUBFIC */ |
| 2230 | 2413 | UML_SUB(block, R32(G_RD(op)), IMM((INT16)G_SIMM(op)), R32(G_RA(op))); // sub rd,simm,ra |
| 2231 | generate_compute_flags(block, FALSE, XER_CA, TRUE); | |
| 2414 | generate_compute_flags(block, desc, FALSE, XER_CA, TRUE); | |
| 2232 | 2415 | return TRUE; |
| 2233 | 2416 | |
| 2234 | 2417 | case 0x0c: /* ADDIC */ |
| 2235 | 2418 | UML_ADD(block, R32(G_RD(op)), R32(G_RA(op)), IMM((INT16)G_SIMM(op))); // add rd,ra,simm |
| 2236 | generate_compute_flags(block, FALSE, XER_CA, FALSE); | |
| 2419 | generate_compute_flags(block, desc, FALSE, XER_CA, FALSE); | |
| 2237 | 2420 | return TRUE; |
| 2238 | 2421 | |
| 2239 | 2422 | case 0x0d: /* ADDIC. */ |
| 2240 | 2423 | UML_ADD(block, R32(G_RD(op)), R32(G_RA(op)), IMM((INT16)G_SIMM(op))); // add rd,ra,simm |
| 2241 | generate_compute_flags(block, TRUE, XER_CA, FALSE); | |
| 2424 | generate_compute_flags(block, desc, TRUE, XER_CA, FALSE); | |
| 2242 | 2425 | return TRUE; |
| 2243 | 2426 | |
| 2244 | 2427 | case 0x10: /* BCx */ |
| r2844 | r2845 | |
| 2246 | 2429 | return TRUE; |
| 2247 | 2430 | |
| 2248 | 2431 | case 0x11: /* SC */ |
| 2432 | UML_MAPVAR(block, MAPVAR_PC, desc->pc + 4); // mapvar PC,desc->pc+4 | |
| 2249 | 2433 | UML_EXH(block, ppc->impstate->exception[EXCEPTION_SYSCALL], IMM(0)); // exh syscall,0 |
| 2250 | 2434 | return TRUE; |
| 2251 | 2435 | |
| r2844 | r2845 | |
| 2260 | 2444 | UML_ROLINS(block, R32(G_RA(op)), R32(G_RS(op)), IMM(G_SH(op)), IMM(compute_rlw_mask(G_MB(op), G_ME(op)))); |
| 2261 | 2445 | // rolins ra,rs,sh,mask |
| 2262 | 2446 | if (op & M_RC) |
| 2263 | { | |
| 2264 | UML_TEST(block, R32(G_RA(op)), IMM(~0)); // test ra,~0 | |
| 2265 | generate_compute_flags(block, TRUE, 0, FALSE); // <update flags> | |
| 2266 | } | |
| 2447 | generate_compute_flags(block, desc, TRUE, 0, FALSE); // <update flags> | |
| 2267 | 2448 | return TRUE; |
| 2268 | 2449 | |
| 2269 | 2450 | case 0x15: /* RLWINMx */ |
| 2270 | 2451 | UML_ROLAND(block, R32(G_RA(op)), R32(G_RS(op)), IMM(G_SH(op)), IMM(compute_rlw_mask(G_MB(op), G_ME(op)))); |
| 2271 | 2452 | // roland ra,rs,sh,mask |
| 2272 | 2453 | if (op & M_RC) |
| 2273 | { | |
| 2274 | UML_TEST(block, R32(G_RA(op)), IMM(~0)); // test ra,~0 | |
| 2275 | generate_compute_flags(block, TRUE, 0, FALSE); // <update flags> | |
| 2276 | } | |
| 2454 | generate_compute_flags(block, desc, TRUE, 0, FALSE); // <update flags> | |
| 2277 | 2455 | return TRUE; |
| 2278 | 2456 | |
| 2279 | 2457 | case 0x17: /* RLWNMx */ |
| 2280 | 2458 | UML_ROLAND(block, R32(G_RA(op)), R32(G_RS(op)), R32(G_RB(op)), IMM(compute_rlw_mask(G_MB(op), G_ME(op)))); |
| 2281 | 2459 | // roland ra,rs,rb,mask |
| 2282 | 2460 | if (op & M_RC) |
| 2283 | { | |
| 2284 | UML_TEST(block, R32(G_RA(op)), IMM(~0)); // test ra,~0 | |
| 2285 | generate_compute_flags(block, TRUE, 0, FALSE); // <update flags> | |
| 2286 | } | |
| 2461 | generate_compute_flags(block, desc, TRUE, 0, FALSE); // <update flags> | |
| 2287 | 2462 | return TRUE; |
| 2288 | 2463 | |
| 2289 | 2464 | case 0x18: /* ORI */ |
| r2844 | r2845 | |
| 2304 | 2479 | |
| 2305 | 2480 | case 0x1c: /* ANDI. */ |
| 2306 | 2481 | UML_AND(block, R32(G_RA(op)), R32(G_RS(op)), IMM(G_UIMM(op))); // and ra,rs,uimm |
| 2307 | generate_compute_flags(block, TRUE, 0, FALSE); | |
| 2482 | generate_compute_flags(block, desc, TRUE, 0, FALSE); | |
| 2308 | 2483 | return TRUE; |
| 2309 | 2484 | |
| 2310 | 2485 | case 0x1d: /* ANDIS. */ |
| 2311 | 2486 | UML_AND(block, R32(G_RA(op)), R32(G_RS(op)), IMM(G_UIMM(op) << 16)); // and ra,rs,uimm << 16 |
| 2312 | generate_compute_flags(block, TRUE, 0, FALSE); | |
| 2487 | generate_compute_flags(block, desc, TRUE, 0, FALSE); | |
| 2313 | 2488 | return TRUE; |
| 2314 | 2489 | |
| 2315 | 2490 | case 0x1f: /* 0x1f group */ |
| r2844 | r2845 | |
| 2443 | 2618 | |
| 2444 | 2619 | case 0x2e: /* LMW */ |
| 2445 | 2620 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op)); // mapvar dsisr,DSISR_IMMU(op) |
| 2621 | UML_MOV(block, MEM(&ppc->impstate->tempaddr), R32Z(G_RA(op))); // mov [tempaddr],ra | |
| 2446 | 2622 | for (regnum = G_RD(op); regnum < 32; regnum++) |
| 2447 | 2623 | { |
| 2448 | UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op) + 4 * (regnum - G_RD(op)))); | |
| 2449 | // add i0,ra,simm + 4*(regnum-rd) | |
| 2624 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM((INT16)G_SIMM(op) + 4 * (regnum - G_RD(op)))); | |
| 2625 | // add i0,[tempaddr],simm + 4*(regnum-rd) | |
| 2450 | 2626 | UML_CALLH(block, ppc->impstate->read32align[ppc->impstate->mode & 3]); // callh read32align |
| 2451 | 2627 | UML_MOV(block, R32(regnum), IREG(0)); // mov regnum,i0 |
| 2452 | 2628 | } |
| r2844 | r2845 | |
| 2455 | 2631 | |
| 2456 | 2632 | case 0x2f: /* STMW */ |
| 2457 | 2633 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op)); // mapvar dsisr,DSISR_IMMU(op) |
| 2634 | UML_MOV(block, MEM(&ppc->impstate->tempaddr), R32Z(G_RA(op))); // mov [tempaddr],ra | |
| 2458 | 2635 | for (regnum = G_RS(op); regnum < 32; regnum++) |
| 2459 | 2636 | { |
| 2460 | UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op) + 4 * (regnum - G_RS(op)))); | |
| 2461 | // add i0,ra,simm + 4*(regnum-rs) | |
| 2637 | UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM((INT16)G_SIMM(op) + 4 * (regnum - G_RS(op)))); | |
| 2638 | // add i0,[tempaddr],simm + 4*(regnum-rs) | |
| 2462 | 2639 | UML_MOV(block, IREG(1), R32(regnum)); // mov i1,regnum |
| 2463 | 2640 | UML_CALLH(block, ppc->impstate->write32align[ppc->impstate->mode & 3]); // callh write32align |
| 2464 | 2641 | } |
| r2844 | r2845 | |
| 2469 | 2646 | UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op))); // add i0,ra,simm |
| 2470 | 2647 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op)); // mapvar dsisr,DSISR_IMM(op) |
| 2471 | 2648 | UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]); // callh read32 |
| 2472 | UML_MOV(block, MEM(&ppc->impstate->tempdata), IREG(0)); // mov [tempdata],i0 | |
| 2473 | UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata), DWORD); // fdfrflt fd,[tempdata],dword | |
| 2649 | UML_MOV(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0)); // mov [tempdata],i0 | |
| 2650 | UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.w.l), DWORD); // fdfrflt fd,[tempdata],dword | |
| 2474 | 2651 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 2475 | 2652 | return TRUE; |
| 2476 | 2653 | |
| r2844 | r2845 | |
| 2478 | 2655 | UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op))); // add i0,ra,simm |
| 2479 | 2656 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op)); // mapvar dsisr,DSISR_IMM(op) |
| 2480 | 2657 | UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode & 3]); // callh read64 |
| 2481 | UML_DMOV(block, MEM(&ppc->impstate->tempdata), IREG(0)); // dmov [tempdata],i0 | |
| 2482 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata)); // fdmov fd,[tempdata] | |
| 2658 | UML_DMOV(block, MEM(&ppc->impstate->tempdata.d), IREG(0)); // dmov [tempdata],i0 | |
| 2659 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.d)); // fdmov fd,[tempdata] | |
| 2483 | 2660 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 2484 | 2661 | return TRUE; |
| 2485 | 2662 | |
| r2844 | r2845 | |
| 2488 | 2665 | UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0)); // mov [updateaddr],i0 |
| 2489 | 2666 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op)); // mapvar dsisr,DSISR_IMMU(op) |
| 2490 | 2667 | UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]); // callh read32 |
| 2491 | UML_MOV(block, MEM(&ppc->impstate->tempdata), IREG(0)); // mov [tempdata],i0 | |
| 2492 | UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata), DWORD); // fdfrflt fd,[tempdata],dword | |
| 2668 | UML_MOV(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0)); // mov [tempdata],i0 | |
| 2669 | UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.w.l), DWORD); // fdfrflt fd,[tempdata],dword | |
| 2493 | 2670 | UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr)); // mov ra,[updateaddr] |
| 2494 | 2671 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 2495 | 2672 | return TRUE; |
| r2844 | r2845 | |
| 2499 | 2676 | UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0)); // mov [updateaddr],i0 |
| 2500 | 2677 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op)); // mapvar dsisr,DSISR_IMMU(op) |
| 2501 | 2678 | UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode & 3]); // callh read64 |
| 2502 | UML_DMOV(block, MEM(&ppc->impstate->tempdata), IREG(0)); // dmov [tempdata],i0 | |
| 2503 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata)); // fdmov fd,[tempdata] | |
| 2679 | UML_DMOV(block, MEM(&ppc->impstate->tempdata.d), IREG(0)); // dmov [tempdata],i0 | |
| 2680 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.d)); // fdmov fd,[tempdata] | |
| 2504 | 2681 | UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr)); // mov ra,[updateaddr] |
| 2505 | 2682 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 2506 | 2683 | return TRUE; |
| 2507 | 2684 | |
| 2508 | 2685 | case 0x34: /* STFS */ |
| 2509 | 2686 | UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op))); // add i0,ra,simm |
| 2510 | UML_FSFRFLT(block, MEM(&ppc->impstate->tempdata), F64(G_RS(op)), QWORD); // fsfrflt [tempdata],rs,qword | |
| 2511 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata)); // mov i1,[tempdata] | |
| 2687 | UML_FSFRFLT(block, MEM(&ppc->impstate->tempdata.w.l), F64(G_RS(op)), QWORD); // fsfrflt [tempdata],rs,qword | |
| 2688 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l)); // mov i1,[tempdata] | |
| 2512 | 2689 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op)); // mapvar dsisr,DSISR_IMM(op) |
| 2513 | 2690 | UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]); // callh write32 |
| 2514 | 2691 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| r2844 | r2845 | |
| 2516 | 2693 | |
| 2517 | 2694 | case 0x36: /* STFD */ |
| 2518 | 2695 | UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op))); // add i0,ra,simm |
| 2519 | UML_FDMOV(block, MEM(&ppc->impstate->tempdata), F64(G_RS(op))); // fdmov [tempdata],rs | |
| 2520 | UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata)); // dmov i1,[tempdata] | |
| 2696 | UML_FDMOV(block, MEM(&ppc->impstate->tempdata.d), F64(G_RS(op))); // fdmov [tempdata],rs | |
| 2697 | UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata.d)); // dmov i1,[tempdata] | |
| 2521 | 2698 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op)); // mapvar dsisr,DSISR_IMM(op) |
| 2522 | 2699 | UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode & 3]); // callh write64 |
| 2523 | 2700 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| r2844 | r2845 | |
| 2525 | 2702 | |
| 2526 | 2703 | case 0x35: /* STFSU */ |
| 2527 | 2704 | UML_ADD(block, IREG(0), R32(G_RA(op)), IMM((INT16)G_SIMM(op))); // add i0,ra,simm |
| 2528 | UML_FSFRFLT(block, MEM(&ppc->impstate->tempdata), F64(G_RS(op)), QWORD); // fsfrflt [tempdata],rs,qword | |
| 2529 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata)); // mov i1,[tempdata] | |
| 2705 | UML_FSFRFLT(block, MEM(&ppc->impstate->tempdata.w.l), F64(G_RS(op)), QWORD); // fsfrflt [tempdata],rs,qword | |
| 2706 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l)); // mov i1,[tempdata] | |
| 2530 | 2707 | UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0)); // mov [updateaddr],i0 |
| 2531 | 2708 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op)); // mapvar dsisr,DSISR_IMMU(op) |
| 2532 | 2709 | UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]); // callh write32 |
| r2844 | r2845 | |
| 2536 | 2713 | |
| 2537 | 2714 | case 0x37: /* STFDU */ |
| 2538 | 2715 | UML_ADD(block, IREG(0), R32(G_RA(op)), IMM((INT16)G_SIMM(op))); // add i0,ra,simm |
| 2539 | UML_FDMOV(block, MEM(&ppc->impstate->tempdata), F64(G_RS(op))); // fdmov [tempdata],rs | |
| 2540 | UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata)); // dmov i1,[tempdata] | |
| 2716 | UML_FDMOV(block, MEM(&ppc->impstate->tempdata.d), F64(G_RS(op))); // fdmov [tempdata],rs | |
| 2717 | UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata.d)); // dmov i1,[tempdata] | |
| 2541 | 2718 | UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0)); // mov [updateaddr],i0 |
| 2542 | 2719 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op)); // mapvar dsisr,DSISR_IMMU(op) |
| 2543 | 2720 | UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode & 3]); // callh write64 |
| r2844 | r2845 | |
| 2578 | 2755 | return TRUE; |
| 2579 | 2756 | |
| 2580 | 2757 | case 0x000: /* MCRF */ |
| 2581 | UML_ROLINS(block, CR32, CR32, IMM(((G_CRFS(op) - G_CRFD(op)) & 7) * 4), IMM(CRMASK(G_CRFD(op)))); | |
| 2582 | // rolins cr,cr,4*(crfs-crfd),crmask[crfd] | |
| 2758 | UML_MOV(block, CR32(G_CRFD(op)), CR32(G_CRFS(op))); // mov [crd],[crs] | |
| 2583 | 2759 | return TRUE; |
| 2584 | 2760 | |
| 2585 | 2761 | case 0x101: /* CRAND */ |
| 2586 | UML_SHL(block, IREG(0), CR32, IMM(G_CRBA(op))); // shl i0,cr,crba(op) | |
| 2587 | UML_SHL(block, IREG(1), CR32, IMM(G_CRBB(op))); // shl i1,cr,crbb(op) | |
| 2762 | UML_SHL(block, IREG(0), CR32(G_CRBA(op) / 4), IMM(G_CRBA(op) % 4)); // shl i0,cr(a / 4),a % 4 | |
| 2763 | UML_SHL(block, IREG(1), CR32(G_CRBB(op) / 4), IMM(G_CRBB(op) % 4)); // shl i1,cr(b / 4),b % 4 | |
| 2588 | 2764 | UML_AND(block, IREG(0), IREG(0), IREG(1)); // and i0,i1 |
| 2589 | UML_ROLINS(block, CR32, IREG(0), IMM(32 - G_CRBD(op)), IMM(0x80000000 >> G_CRBD(op))); | |
| 2590 | // rolins cr,i0,32-crbd,1<<crbd | |
| 2765 | UML_ROLINS(block, CR32(G_CRBD(op) / 4), IREG(0), IMM(32 - G_CRBD(op) % 4), IMM(8 >> (G_CRBD(op) % 4))); | |
| 2766 | // rolins cr(d / 4),i0,32-(d % 4),8 >> (d % 4) | |
| 2591 | 2767 | return TRUE; |
| 2592 | 2768 | |
| 2593 | 2769 | case 0x081: /* CRANDC */ |
| 2594 | UML_SHL(block, IREG(0), CR32, IMM(G_CRBA(op))); // shl i0,cr,crba(op) | |
| 2595 | UML_SHL(block, IREG(1), CR32, IMM(G_CRBB(op))); // shl i1,cr,crbb(op) | |
| 2770 | UML_SHL(block, IREG(0), CR32(G_CRBA(op) / 4), IMM(G_CRBA(op) % 4)); // shl i0,cr(a / 4),a % 4 | |
| 2771 | UML_SHL(block, IREG(1), CR32(G_CRBB(op) / 4), IMM(G_CRBB(op) % 4)); // shl i1,cr(b / 4),b % 4 | |
| 2596 | 2772 | UML_XOR(block, IREG(1), IREG(1), IMM(~0)); // xor i1,~0 |
| 2597 | 2773 | UML_AND(block, IREG(0), IREG(0), IREG(1)); // and i0,i1 |
| 2598 | UML_ROLINS(block, CR32, IREG(0), IMM(32 - G_CRBD(op)), IMM(0x80000000 >> G_CRBD(op))); | |
| 2599 | // rolins cr,i0,32-crbd,1<<crbd | |
| 2774 | UML_ROLINS(block, CR32(G_CRBD(op) / 4), IREG(0), IMM(32 - G_CRBD(op) % 4), IMM(8 >> (G_CRBD(op) % 4))); | |
| 2775 | // rolins cr(d / 4),i0,32-(d % 4),8 >> (d % 4) | |
| 2600 | 2776 | return TRUE; |
| 2601 | 2777 | |
| 2602 | 2778 | case 0x0e1: /* CRNAND */ |
| 2603 | UML_SHL(block, IREG(0), CR32, IMM(G_CRBA(op))); // shl i0,cr,crba(op) | |
| 2604 | UML_SHL(block, IREG(1), CR32, IMM(G_CRBB(op))); // shl i1,cr,crbb(op) | |
| 2779 | UML_SHL(block, IREG(0), CR32(G_CRBA(op) / 4), IMM(G_CRBA(op) % 4)); // shl i0,cr(a / 4),a % 4 | |
| 2780 | UML_SHL(block, IREG(1), CR32(G_CRBB(op) / 4), IMM(G_CRBB(op) % 4)); // shl i1,cr(b / 4),b % 4 | |
| 2605 | 2781 | UML_AND(block, IREG(0), IREG(0), IREG(1)); // and i0,i1 |
| 2606 | 2782 | UML_XOR(block, IREG(0), IREG(0), IMM(~0)); // xor i0,~0 |
| 2607 | UML_ROLINS(block, CR32, IREG(0), IMM(32 - G_CRBD(op)), IMM(0x80000000 >> G_CRBD(op))); | |
| 2608 | // rolins cr,i0,32-crbd,1<<crbd | |
| 2783 | UML_ROLINS(block, CR32(G_CRBD(op) / 4), IREG(0), IMM(32 - G_CRBD(op) % 4), IMM(8 >> (G_CRBD(op) % 4))); | |
| 2784 | // rolins cr(d / 4),i0,32-(d % 4),8 >> (d % 4) | |
| 2609 | 2785 | return TRUE; |
| 2610 | 2786 | |
| 2611 | 2787 | case 0x1c1: /* CROR */ |
| 2612 | UML_SHL(block, IREG(0), CR32, IMM(G_CRBA(op))); // shl i0,cr,crba(op) | |
| 2613 | UML_SHL(block, IREG(1), CR32, IMM(G_CRBB(op))); // shl i1,cr,crbb(op) | |
| 2788 | UML_SHL(block, IREG(0), CR32(G_CRBA(op) / 4), IMM(G_CRBA(op) % 4)); // shl i0,cr(a / 4),a % 4 | |
| 2789 | UML_SHL(block, IREG(1), CR32(G_CRBB(op) / 4), IMM(G_CRBB(op) % 4)); // shl i1,cr(b / 4),b % 4 | |
| 2614 | 2790 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i1 |
| 2615 | UML_ROLINS(block, CR32, IREG(0), IMM(32 - G_CRBD(op)), IMM(0x80000000 >> G_CRBD(op))); | |
| 2616 | // rolins cr,i0,32-crbd,1<<crbd | |
| 2791 | UML_ROLINS(block, CR32(G_CRBD(op) / 4), IREG(0), IMM(32 - G_CRBD(op) % 4), IMM(8 >> (G_CRBD(op) % 4))); | |
| 2792 | // rolins cr(d / 4),i0,32-(d % 4),8 >> (d % 4) | |
| 2617 | 2793 | return TRUE; |
| 2618 | 2794 | |
| 2619 | 2795 | case 0x1a1: /* CRORC */ |
| 2620 | UML_SHL(block, IREG(0), CR32, IMM(G_CRBA(op))); // shl i0,cr,crba(op) | |
| 2621 | UML_SHL(block, IREG(1), CR32, IMM(G_CRBB(op))); // shl i1,cr,crbb(op) | |
| 2796 | UML_SHL(block, IREG(0), CR32(G_CRBA(op) / 4), IMM(G_CRBA(op) % 4)); // shl i0,cr(a / 4),a % 4 | |
| 2797 | UML_SHL(block, IREG(1), CR32(G_CRBB(op) / 4), IMM(G_CRBB(op) % 4)); // shl i1,cr(b / 4),b % 4 | |
| 2622 | 2798 | UML_XOR(block, IREG(1), IREG(1), IMM(~0)); // xor i1,~0 |
| 2623 | 2799 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i1 |
| 2624 | UML_ROLINS(block, CR32, IREG(0), IMM(32 - G_CRBD(op)), IMM(0x80000000 >> G_CRBD(op))); | |
| 2625 | // rolins cr,i0,32-crbd,1<<crbd | |
| 2800 | UML_ROLINS(block, CR32(G_CRBD(op) / 4), IREG(0), IMM(32 - G_CRBD(op) % 4), IMM(8 >> (G_CRBD(op) % 4))); | |
| 2801 | // rolins cr(d / 4),i0,32-(d % 4),8 >> (d % 4) | |
| 2626 | 2802 | return TRUE; |
| 2627 | 2803 | |
| 2628 | 2804 | case 0x021: /* CRNOR */ |
| 2629 | UML_SHL(block, IREG(0), CR32, IMM(G_CRBA(op))); // shl i0,cr,crba(op) | |
| 2630 | UML_SHL(block, IREG(1), CR32, IMM(G_CRBB(op))); // shl i1,cr,crbb(op) | |
| 2805 | UML_SHL(block, IREG(0), CR32(G_CRBA(op) / 4), IMM(G_CRBA(op) % 4)); // shl i0,cr(a / 4),a % 4 | |
| 2806 | UML_SHL(block, IREG(1), CR32(G_CRBB(op) / 4), IMM(G_CRBB(op) % 4)); // shl i1,cr(b / 4),b % 4 | |
| 2631 | 2807 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i1 |
| 2632 | 2808 | UML_XOR(block, IREG(0), IREG(0), IMM(~0)); // xor i0,~0 |
| 2633 | UML_ROLINS(block, CR32, IREG(0), IMM(32 - G_CRBD(op)), IMM(0x80000000 >> G_CRBD(op))); | |
| 2634 | // rolins cr,i0,32-crbd,1<<crbd | |
| 2809 | UML_ROLINS(block, CR32(G_CRBD(op) / 4), IREG(0), IMM(32 - G_CRBD(op) % 4), IMM(8 >> (G_CRBD(op) % 4))); | |
| 2810 | // rolins cr(d / 4),i0,32-(d % 4),8 >> (d % 4) | |
| 2635 | 2811 | return TRUE; |
| 2636 | 2812 | |
| 2637 | 2813 | case 0x0c1: /* CRXOR */ |
| 2638 | UML_SHL(block, IREG(0), CR32, IMM(G_CRBA(op))); // shl i0,cr,crba(op) | |
| 2639 | UML_SHL(block, IREG(1), CR32, IMM(G_CRBB(op))); // shl i1,cr,crbb(op) | |
| 2814 | UML_SHL(block, IREG(0), CR32(G_CRBA(op) / 4), IMM(G_CRBA(op) % 4)); // shl i0,cr(a / 4),a % 4 | |
| 2815 | UML_SHL(block, IREG(1), CR32(G_CRBB(op) / 4), IMM(G_CRBB(op) % 4)); // shl i1,cr(b / 4),b % 4 | |
| 2640 | 2816 | UML_XOR(block, IREG(0), IREG(0), IREG(1)); // xor i0,i1 |
| 2641 | UML_ROLINS(block, CR32, IREG(0), IMM(32 - G_CRBD(op)), IMM(0x80000000 >> G_CRBD(op))); | |
| 2642 | // rolins cr,i0,32-crbd,1<<crbd | |
| 2817 | UML_ROLINS(block, CR32(G_CRBD(op) / 4), IREG(0), IMM(32 - G_CRBD(op) % 4), IMM(8 >> (G_CRBD(op) % 4))); | |
| 2818 | // rolins cr(d / 4),i0,32-(d % 4),8 >> (d % 4) | |
| 2643 | 2819 | return TRUE; |
| 2644 | 2820 | |
| 2645 | 2821 | case 0x121: /* CREQV */ |
| 2646 | UML_SHL(block, IREG(0), CR32, IMM(G_CRBA(op))); // shl i0,cr,crba(op) | |
| 2647 | UML_SHL(block, IREG(1), CR32, IMM(G_CRBB(op))); // shl i1,cr,crbb(op) | |
| 2822 | UML_SHL(block, IREG(0), CR32(G_CRBA(op) / 4), IMM(G_CRBA(op) % 4)); // shl i0,cr(a / 4),a % 4 | |
| 2823 | UML_SHL(block, IREG(1), CR32(G_CRBB(op) / 4), IMM(G_CRBB(op) % 4)); // shl i1,cr(b / 4),b % 4 | |
| 2648 | 2824 | UML_XOR(block, IREG(0), IREG(0), IREG(1)); // xor i0,i1 |
| 2649 | 2825 | UML_XOR(block, IREG(0), IREG(0), IMM(~0)); // xor i0,~0 |
| 2650 | UML_ROLINS(block, CR32, IREG(0), IMM(32 - G_CRBD(op)), IMM(0x80000000 >> G_CRBD(op))); | |
| 2651 | // rolins cr,i0,32-crbd,1<<crbd | |
| 2826 | UML_ROLINS(block, CR32(G_CRBD(op) / 4), IREG(0), IMM(32 - G_CRBD(op) % 4), IMM(8 >> (G_CRBD(op) % 4))); | |
| 2827 | // rolins cr(d / 4),i0,32-(d % 4),8 >> (d % 4) | |
| 2652 | 2828 | return TRUE; |
| 2653 | 2829 | |
| 2654 | 2830 | case 0x032: /* RFI */ |
| r2844 | r2845 | |
| 2703 | 2879 | { |
| 2704 | 2880 | UINT32 op = *desc->opptr.l; |
| 2705 | 2881 | UINT32 opswitch = (op >> 1) & 0x3ff; |
| 2706 | drcuml_codelabel swloop, swloopend; | |
| 2707 | 2882 | int item; |
| 2708 | 2883 | |
| 2709 | 2884 | switch (opswitch) |
| r2844 | r2845 | |
| 2753 | 2928 | case 0x10a: /* ADDx */ |
| 2754 | 2929 | case 0x30a: /* ADDOx */ |
| 2755 | 2930 | UML_ADD(block, R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op))); // add rd,ra,rb |
| 2756 | generate_compute_flags(block, op & M_RC, ((op & M_OE) ? XER_OV : 0), FALSE); // <update flags> | |
| 2931 | generate_compute_flags(block, desc, op & M_RC, ((op & M_OE) ? XER_OV : 0), FALSE); | |
| 2932 | // <update flags> | |
| 2757 | 2933 | return TRUE; |
| 2758 | 2934 | |
| 2759 | 2935 | case 0x00a: /* ADDCx */ |
| 2760 | 2936 | case 0x20a: /* ADDCOx */ |
| 2761 | 2937 | UML_ADD(block, R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op))); // add rd,ra,rb |
| 2762 | generate_compute_flags(block, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), FALSE);// <update flags> | |
| 2938 | generate_compute_flags(block, desc, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), FALSE); | |
| 2939 | // <update flags> | |
| 2763 | 2940 | return TRUE; |
| 2764 | 2941 | |
| 2765 | 2942 | case 0x08a: /* ADDEx */ |
| 2766 | 2943 | case 0x28a: /* ADDEOx */ |
| 2767 | 2944 | UML_CARRY(block, SPR32(SPR_XER), IMM(29)); // carry [xer],XER_CA |
| 2768 | 2945 | UML_ADDC(block, R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op))); // addc rd,ra,rb |
| 2769 | generate_compute_flags(block, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), FALSE);// <update flags> | |
| 2946 | generate_compute_flags(block, desc, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), FALSE); | |
| 2947 | // <update flags> | |
| 2770 | 2948 | return TRUE; |
| 2771 | 2949 | |
| 2772 | 2950 | case 0x0ca: /* ADDZEx */ |
| 2773 | 2951 | case 0x2ca: /* ADDZEOx */ |
| 2774 | 2952 | UML_CARRY(block, SPR32(SPR_XER), IMM(29)); // carry [xer],XER_CA |
| 2775 | 2953 | UML_ADDC(block, R32(G_RD(op)), R32(G_RA(op)), IMM(0)); // addc rd,ra,0 |
| 2776 | generate_compute_flags(block, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), FALSE);// <update flags> | |
| 2954 | generate_compute_flags(block, desc, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), FALSE); | |
| 2955 | // <update flags> | |
| 2777 | 2956 | return TRUE; |
| 2778 | 2957 | |
| 2779 | 2958 | case 0x0ea: /* ADDMEx */ |
| 2780 | 2959 | case 0x2ea: /* ADDMEOx */ |
| 2781 | 2960 | UML_CARRY(block, SPR32(SPR_XER), IMM(29)); // carry [xer],XER_CA |
| 2782 | 2961 | UML_ADDC(block, R32(G_RD(op)), R32(G_RA(op)), IMM(-1)); // addc rd,ra,-1 |
| 2783 | generate_compute_flags(block, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), FALSE);// <update flags> | |
| 2962 | generate_compute_flags(block, desc, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), FALSE); | |
| 2963 | // <update flags> | |
| 2784 | 2964 | return TRUE; |
| 2785 | 2965 | |
| 2786 | 2966 | case 0x028: /* SUBFx */ |
| 2787 | 2967 | case 0x228: /* SUBFOx */ |
| 2788 | 2968 | UML_SUB(block, R32(G_RD(op)), R32(G_RB(op)), R32(G_RA(op))); // sub rd,rb,ra |
| 2789 | generate_compute_flags(block, op & M_RC, (op & M_OE) ? XER_OV : 0, TRUE); | |
| 2969 | generate_compute_flags(block, desc, op & M_RC, (op & M_OE) ? XER_OV : 0, TRUE); | |
| 2790 | 2970 | return TRUE; |
| 2791 | 2971 | |
| 2792 | 2972 | case 0x008: /* SUBFCx */ |
| 2793 | 2973 | case 0x208: /* SUBFCOx */ |
| 2794 | 2974 | UML_SUB(block, R32(G_RD(op)), R32(G_RB(op)), R32(G_RA(op))); // sub rd,rb,ra |
| 2795 | generate_compute_flags(block, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), TRUE);// <update flags> | |
| 2975 | generate_compute_flags(block, desc, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), TRUE); | |
| 2976 | // <update flags> | |
| 2796 | 2977 | return TRUE; |
| 2797 | 2978 | |
| 2798 | 2979 | case 0x088: /* SUBFEx */ |
| r2844 | r2845 | |
| 2800 | 2981 | UML_XOR(block, IREG(0), SPR32(SPR_XER), IMM(XER_CA)); // xor i0,[xer],XER_CA |
| 2801 | 2982 | UML_CARRY(block, IREG(0), IMM(29)); // carry i0,XER_CA |
| 2802 | 2983 | UML_SUBB(block, R32(G_RD(op)), R32(G_RB(op)), R32(G_RA(op))); // subc rd,rb,ra |
| 2803 | generate_compute_flags(block, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), TRUE);// <update flags> | |
| 2984 | generate_compute_flags(block, desc, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), TRUE); | |
| 2985 | // <update flags> | |
| 2804 | 2986 | return TRUE; |
| 2805 | 2987 | |
| 2806 | 2988 | case 0x0c8: /* SUBFZEx */ |
| r2844 | r2845 | |
| 2808 | 2990 | UML_XOR(block, IREG(0), SPR32(SPR_XER), IMM(XER_CA)); // xor i0,[xer],XER_CA |
| 2809 | 2991 | UML_CARRY(block, IREG(0), IMM(29)); // carry i0,XER_CA |
| 2810 | 2992 | UML_SUBB(block, R32(G_RD(op)), IMM(0), R32(G_RA(op))); // subc rd,0,ra |
| 2811 | generate_compute_flags(block, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), TRUE);// <update flags> | |
| 2993 | generate_compute_flags(block, desc, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), TRUE); | |
| 2994 | // <update flags> | |
| 2812 | 2995 | return TRUE; |
| 2813 | 2996 | |
| 2814 | 2997 | case 0x0e8: /* SUBFMEx */ |
| r2844 | r2845 | |
| 2816 | 2999 | UML_XOR(block, IREG(0), SPR32(SPR_XER), IMM(XER_CA)); // xor i0,[xer],XER_CA |
| 2817 | 3000 | UML_CARRY(block, IREG(0), IMM(29)); // carry i0,XER_CA |
| 2818 | 3001 | UML_SUBB(block, R32(G_RD(op)), IMM(-1), R32(G_RA(op))); // subc rd,-1,ra |
| 2819 | generate_compute_flags(block, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), TRUE);// <update flags> | |
| 3002 | generate_compute_flags(block, desc, op & M_RC, XER_CA | ((op & M_OE) ? XER_OV : 0), TRUE); | |
| 3003 | // <update flags> | |
| 2820 | 3004 | return TRUE; |
| 2821 | 3005 | |
| 2822 | 3006 | case 0x068: /* NEGx */ |
| 2823 | 3007 | case 0x268: /* NEGOx */ |
| 2824 | 3008 | UML_SUB(block, R32(G_RD(op)), IMM(0), R32(G_RA(op))); // sub rd,0,ra |
| 2825 | generate_compute_flags(block, op & M_RC, (op & M_OE) ? XER_OV : 0, TRUE); | |
| 3009 | generate_compute_flags(block, desc, op & M_RC, (op & M_OE) ? XER_OV : 0, TRUE); | |
| 2826 | 3010 | return TRUE; |
| 2827 | 3011 | |
| 2828 | 3012 | case 0x000: /* CMP */ |
| 2829 | 3013 | UML_CMP(block, R32(G_RA(op)), R32(G_RB(op))); // cmp ra,rb |
| 2830 | 3014 | UML_GETFLGS(block, IREG(0), DRCUML_FLAG_Z | DRCUML_FLAG_C | DRCUML_FLAG_S); // getflgs i0,zcs |
| 2831 | UML_LOAD(block, IREG(0), ppc->impstate->cmp_cr_table, IREG(0), DWORD); // load i0,cmp_cr_table,i0,dword | |
| 2832 | UML_ROLINS(block, CR32, IREG(0), IMM(0), IMM(CRMASK(G_CRFD(op)))); // rolins cr,i0,0,crmask[cr] | |
| 3015 | UML_LOAD(block, IREG(0), ppc->impstate->cmp_cr_table, IREG(0), BYTE); // load i0,cmp_cr_table,i0,byte | |
| 3016 | UML_OR(block, CR32(G_CRFD(op)), IREG(0), XERSO32); // or [crn],i0,[xerso] | |
| 2833 | 3017 | return TRUE; |
| 2834 | 3018 | |
| 2835 | 3019 | case 0x020: /* CMPL */ |
| 2836 | 3020 | UML_CMP(block, R32(G_RA(op)), R32(G_RB(op))); // cmp ra,rb |
| 2837 | 3021 | UML_GETFLGS(block, IREG(0), DRCUML_FLAG_Z | DRCUML_FLAG_C); // getflgs i0,zc |
| 2838 | UML_LOAD(block, IREG(0), ppc->impstate->cmpl_cr_table, IREG(0), DWORD); // load i0,cmpl_cr_table,i0,dword | |
| 2839 | UML_ROLINS(block, CR32, IREG(0), IMM(0), IMM(CRMASK(G_CRFD(op)))); // rolins cr,i0,0,crmask[cr] | |
| 3022 | UML_LOAD(block, IREG(0), ppc->impstate->cmpl_cr_table, IREG(0), BYTE); // load i0,cmpl_cr_table,i0,byte | |
| 3023 | UML_OR(block, CR32(G_CRFD(op)), IREG(0), XERSO32); // or [crn],i0,[xerso] | |
| 2840 | 3024 | return TRUE; |
| 2841 | 3025 | |
| 2842 | 3026 | case 0x00b: /* MULHWUx */ |
| 2843 | UML_MULU(block, IREG(0), R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op))); // mulu i0,rd,ra,rb,FLAGS_RC(op) | |
| 2844 | generate_compute_flags(block, op & M_RC, 0, FALSE); // <update flags> | |
| 3027 | UML_MULU(block, IREG(0), R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op))); // mulu i0,rd,ra,rb | |
| 3028 | if (op & M_RC) | |
| 3029 | { | |
| 3030 | UML_TEST(block, R32(G_RD(op)), IMM(~0)); // test rd,~0 | |
| 3031 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); // <update flags> | |
| 3032 | } | |
| 2845 | 3033 | return TRUE; |
| 2846 | 3034 | |
| 2847 | 3035 | case 0x04b: /* MULHWx */ |
| 2848 | UML_MULS(block, IREG(0), R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op))); // muls i0,rd,ra,rb,,FLAGS_RC(op) | |
| 2849 | generate_compute_flags(block, op & M_RC, 0, FALSE); // <update flags> | |
| 3036 | UML_MULS(block, IREG(0), R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op))); // muls i0,rd,ra,rb | |
| 3037 | if (op & M_RC) | |
| 3038 | { | |
| 3039 | UML_TEST(block, R32(G_RD(op)), IMM(~0)); // test rd,~0 | |
| 3040 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); // <update flags> | |
| 3041 | } | |
| 2850 | 3042 | return TRUE; |
| 2851 | 3043 | |
| 2852 | 3044 | case 0x0eb: /* MULLWx */ |
| 2853 | 3045 | case 0x2eb: /* MULLWOx */ |
| 2854 | if (!(op & M_OE)) | |
| 2855 | { | |
| 2856 | UML_MULS(block, R32(G_RD(op)), R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op)));// muls rd,rd,ra,rb,FLAGS_RC(op) | |
| 2857 | generate_compute_flags(block, op & M_RC, 0, FALSE); // <update flags> | |
| 2858 | } | |
| 2859 | else | |
| 2860 | { | |
| 2861 | UML_MULS(block, IREG(0), IREG(1), R32(G_RA(op)), R32(G_RB(op))); // muls i0,i1,ra,rb | |
| 2862 | generate_compute_flags(block, op & M_RC, 0, FALSE); // <update flags> | |
| 2863 | UML_MOV(block, R32(G_RD(op)), IREG(0)); // mov rd,i0 | |
| 2864 | UML_SAR(block, IREG(0), IREG(0), IMM(31)); // sar i0,i0,31 | |
| 2865 | UML_AND(block, SPR32(SPR_XER), SPR32(SPR_XER), IMM(XER_OV)); // and [xer],[xer],XER_OV | |
| 2866 | UML_XOR(block, IREG(0), IREG(0), IREG(1)); // xor i0,i0,i1 | |
| 2867 | UML_MOVc(block, IF_NZ, IREG(0), IMM(XER_OV | XER_SO)); // mov i0,XER_OV | XER_SO,NZ | |
| 2868 | UML_OR(block, SPR32(SPR_XER), SPR32(SPR_XER), IREG(0)); // or [xer],[xer],i0 | |
| 2869 | } | |
| 3046 | UML_MULS(block, R32(G_RD(op)), R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op))); // muls rd,rd,ra,rb | |
| 3047 | generate_compute_flags(block, desc, op & M_RC, ((op & M_OE) ? XER_OV : 0), FALSE);// <update flags> | |
| 2870 | 3048 | return TRUE; |
| 2871 | 3049 | |
| 2872 | 3050 | case 0x1cb: /* DIVWUx */ |
| 2873 | 3051 | case 0x3cb: /* DIVWUOx */ |
| 2874 | 3052 | UML_DIVU(block, R32(G_RD(op)), R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op))); // divu rd,rd,ra,rb |
| 2875 | generate_compute_flags(block, op & M_RC, ((op & M_OE) ? XER_OV : 0), FALSE); | |
| 3053 | generate_compute_flags(block, desc, op & M_RC, ((op & M_OE) ? XER_OV : 0), FALSE); | |
| 2876 | 3054 | return TRUE; |
| 2877 | 3055 | |
| 2878 | 3056 | case 0x1eb: /* DIVWx */ |
| 2879 | 3057 | case 0x3eb: /* DIVWOx */ |
| 2880 | 3058 | UML_DIVS(block, R32(G_RD(op)), R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op))); // divs rd,rd,ra,rb |
| 2881 | generate_compute_flags(block, op & M_RC, ((op & M_OE) ? XER_OV : 0), FALSE); | |
| 3059 | generate_compute_flags(block, desc, op & M_RC, ((op & M_OE) ? XER_OV : 0), FALSE); | |
| 2882 | 3060 | return TRUE; |
| 2883 | 3061 | |
| 2884 | 3062 | case 0x01c: /* ANDx */ |
| 2885 | 3063 | UML_AND(block, R32(G_RA(op)), R32(G_RS(op)), R32(G_RB(op))); // and ra,rs,rb |
| 2886 | generate_compute_flags(block, op & M_RC, 0, FALSE); | |
| 3064 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); | |
| 2887 | 3065 | return TRUE; |
| 2888 | 3066 | |
| 2889 | 3067 | case 0x03c: /* ANDCx */ |
| 2890 | 3068 | UML_XOR(block, IREG(0), R32(G_RB(op)), IMM(~0)); // xor i0,rb,~0 |
| 2891 | 3069 | UML_AND(block, R32(G_RA(op)), R32(G_RS(op)), IREG(0)); // and ra,rs,i0 |
| 2892 | generate_compute_flags(block, op & M_RC, 0, FALSE); | |
| 3070 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); | |
| 2893 | 3071 | return TRUE; |
| 2894 | 3072 | |
| 2895 | 3073 | case 0x1dc: /* NANDx */ |
| 2896 | 3074 | UML_AND(block, IREG(0), R32(G_RS(op)), R32(G_RB(op))); // and i0,rs,rb |
| 2897 | 3075 | UML_XOR(block, R32(G_RA(op)), IREG(0), IMM(~0)); // xor ra,i0,~0 |
| 2898 | generate_compute_flags(block, op & M_RC, 0, FALSE); | |
| 3076 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); | |
| 2899 | 3077 | return TRUE; |
| 2900 | 3078 | |
| 2901 | 3079 | case 0x1bc: /* ORx */ |
| 2902 | 3080 | UML_OR(block, R32(G_RA(op)), R32(G_RS(op)), R32(G_RB(op))); // or ra,rs,rb |
| 2903 | generate_compute_flags(block, op & M_RC, 0, FALSE); | |
| 3081 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); | |
| 2904 | 3082 | return TRUE; |
| 2905 | 3083 | |
| 2906 | 3084 | case 0x19c: /* ORCx */ |
| 2907 | 3085 | UML_XOR(block, IREG(0), R32(G_RB(op)), IMM(~0)); // xor i0,rb,~0 |
| 2908 | 3086 | UML_OR(block, R32(G_RA(op)), R32(G_RS(op)), IREG(0)); // or ra,rs,i0 |
| 2909 | generate_compute_flags(block, op & M_RC, 0, FALSE); | |
| 3087 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); | |
| 2910 | 3088 | return TRUE; |
| 2911 | 3089 | |
| 2912 | 3090 | case 0x07c: /* NORx */ |
| 2913 | 3091 | UML_OR(block, IREG(0), R32(G_RS(op)), R32(G_RB(op))); // or i0,rs,rb |
| 2914 | 3092 | UML_XOR(block, R32(G_RA(op)), IREG(0), IMM(~0)); // xor ra,i0,~0 |
| 2915 | generate_compute_flags(block, op & M_RC, 0, FALSE); | |
| 3093 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); | |
| 2916 | 3094 | return TRUE; |
| 2917 | 3095 | |
| 2918 | 3096 | case 0x13c: /* XORx */ |
| 2919 | 3097 | UML_XOR(block, R32(G_RA(op)), R32(G_RS(op)), R32(G_RB(op))); // xor ra,rs,rb |
| 2920 | generate_compute_flags(block, op & M_RC, 0, FALSE); | |
| 3098 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); | |
| 2921 | 3099 | return TRUE; |
| 2922 | 3100 | |
| 2923 | 3101 | case 0x11c: /* EQVx */ |
| 2924 | 3102 | UML_XOR(block, IREG(0), R32(G_RS(op)), R32(G_RB(op))); // xor i0,rs,rb |
| 2925 | 3103 | UML_XOR(block, R32(G_RA(op)), IREG(0), IMM(~0)); // xor ra,i0,~0 |
| 2926 | generate_compute_flags(block, op & M_RC, 0, FALSE); | |
| 3104 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); | |
| 2927 | 3105 | return TRUE; |
| 2928 | 3106 | |
| 2929 | 3107 | case 0x018: /* SLWx */ |
| 2930 | 3108 | UML_SHL(block, R32(G_RA(op)), R32(G_RS(op)), R32(G_RB(op))); // shl ra,rs,rb |
| 2931 | generate_compute_flags(block, op & M_RC, 0, FALSE); | |
| 3109 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); | |
| 2932 | 3110 | return TRUE; |
| 2933 | 3111 | |
| 2934 | 3112 | case 0x218: /* SRWx */ |
| 2935 | UML_SHR(block, R32(G_RA(op)), R32(G_RS(op)), R32(G_RB(op))); // shr ra,rs,rb | |
| 2936 | generate_compute_flags(block, op & M_RC, 0, FALSE); // <update flags> | |
| 3113 | UML_MOV(block, IREG(0), R32(G_RS(op))); // mov i0,rs | |
| 3114 | UML_TEST(block, R32(G_RB(op)), IMM(0x20)); // test rb,0x20 | |
| 3115 | UML_MOVc(block, IF_NZ, IREG(0), IMM(0)); // mov i0,0,nz | |
| 3116 | UML_SHR(block, R32(G_RA(op)), IREG(0), R32(G_RB(op))); // shr ra,i0,rb | |
| 3117 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); // <update flags> | |
| 2937 | 3118 | return TRUE; |
| 2938 | 3119 | |
| 2939 | 3120 | case 0x318: /* SRAWx */ |
| 2940 | UML_SHL(block, IREG(1), IMM(0xffffffff), R32(G_RB(op))); // shl i1,0xffffffff,rb | |
| 2941 | UML_XOR(block, IREG(1), IREG(1), IMM(~0)); // xor i1,i1,~0 | |
| 2942 | UML_AND(block, IREG(0), R32(G_RS(op)), IREG(1)); // and i0,rs,i1 | |
| 2943 | UML_SAR(block, IREG(1), R32(G_RS(op)), IMM(31)); // sar i1,rs,31 | |
| 2944 | UML_AND(block, IREG(0), IREG(0), IREG(1)); // and i0,i0,i1 | |
| 2945 | UML_SETc(block, IF_NZ, IREG(0)); // set i0,nz | |
| 2946 | UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(XER_CA)); // rolins [xer],i0,29,XER_CA | |
| 2947 | UML_SAR(block, R32(G_RA(op)), R32(G_RS(op)), R32(G_RB(op))); // sar ra,rs,rb | |
| 2948 | generate_compute_flags(block, op & M_RC, 0, FALSE); // <update flags> | |
| 3121 | UML_MOV(block, IREG(2), R32(G_RB(op))); // mov i2,rb | |
| 3122 | UML_TEST(block, IREG(2), IMM(0x20)); // test i2,0x20 | |
| 3123 | UML_MOVc(block, IF_NZ, IREG(2), IMM(31)); // mov i2,31,nz | |
| 3124 | if (DISABLE_FLAG_OPTIMIZATIONS || (desc->regreq[3] & REGFLAG_XER_CA)) | |
| 3125 | { | |
| 3126 | UML_SHL(block, IREG(1), IMM(0xffffffff), IREG(2)); // shl i1,0xffffffff,i2 | |
| 3127 | UML_XOR(block, IREG(1), IREG(1), IMM(~0)); // xor i1,i1,~0 | |
| 3128 | UML_AND(block, IREG(0), R32(G_RS(op)), IREG(1)); // and i0,rs,i1 | |
| 3129 | UML_SAR(block, IREG(1), R32(G_RS(op)), IMM(31)); // sar i1,rs,31 | |
| 3130 | UML_TEST(block, IREG(0), IREG(1)); // test i0,i1 | |
| 3131 | UML_SETc(block, IF_NZ, IREG(0)); // set i0,nz | |
| 3132 | UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(XER_CA)); // rolins [xer],i0,29,XER_CA | |
| 3133 | } | |
| 3134 | UML_SAR(block, R32(G_RA(op)), R32(G_RS(op)), IREG(2)); // sar ra,rs,i2 | |
| 3135 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); // <update flags> | |
| 2949 | 3136 | return TRUE; |
| 2950 | 3137 | |
| 2951 | 3138 | case 0x338: /* SRAWIx */ |
| 2952 | UML_AND(block, IREG(0), R32(G_RS(op)), IMM(~(0xffffffff << (G_SH(op) & 31)))); // and i0,rs,~(0xffffffff << (sh & 31)) | |
| 2953 | UML_SAR(block, IREG(1), R32(G_RS(op)), IMM(31)); // sar i1,rs,31 | |
| 2954 | UML_AND(block, IREG(0), IREG(0), IREG(1)); // and i0,i0,i1 | |
| 2955 | UML_SETc(block, IF_NZ, IREG(0)); // set i0,nz | |
| 2956 | UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(XER_CA)); // rolins [xer],i0,29,XER_CA | |
| 3139 | if (DISABLE_FLAG_OPTIMIZATIONS || (desc->regreq[3] & REGFLAG_XER_CA)) | |
| 3140 | { | |
| 3141 | UML_AND(block, IREG(0), R32(G_RS(op)), IMM(~(0xffffffff << (G_SH(op) & 31))));// and i0,rs,~(0xffffffff << (sh & 31)) | |
| 3142 | UML_SAR(block, IREG(1), R32(G_RS(op)), IMM(31)); // sar i1,rs,31 | |
| 3143 | UML_TEST(block, IREG(0), IREG(1)); // test i0,i1 | |
| 3144 | UML_SETc(block, IF_NZ, IREG(0)); // set i0,nz | |
| 3145 | UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(XER_CA)); // rolins [xer],i0,29,XER_CA | |
| 3146 | } | |
| 2957 | 3147 | UML_SAR(block, R32(G_RA(op)), R32(G_RS(op)), IMM(G_SH(op))); // sar ra,rs,sh |
| 2958 | generate_compute_flags(block, op & M_RC, 0, FALSE); | |
| 3148 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); | |
| 2959 | 3149 | return TRUE; |
| 2960 | 3150 | |
| 2961 | 3151 | case 0x01a: /* CNTLZWx */ |
| 2962 | UML_LZCNT(block, R32(G_RA(op)), R32(G_RS(op))); // lzcnt ra,rs | |
| 3152 | UML_LZCNT(block, R32(G_RA(op)), R32(G_RS(op))); // lzcnt ra,rs | |
| 2963 | 3153 | if (op & M_RC) |
| 2964 | { | |
| 2965 | UML_TEST(block, R32(G_RA(op)), IMM(~0)); // test ra,~0 | |
| 2966 | generate_compute_flags(block, op & M_RC, 0, FALSE); // <update flags> | |
| 2967 | } | |
| 3154 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); // <update flags> | |
| 2968 | 3155 | return TRUE; |
| 2969 | 3156 | |
| 2970 | 3157 | case 0x3ba: /* EXTSBx */ |
| 2971 | 3158 | UML_SEXT(block, R32(G_RA(op)), R32(G_RS(op)), BYTE); // sext ra,rs,byte |
| 2972 | 3159 | if (op & M_RC) |
| 2973 | { | |
| 2974 | UML_TEST(block, R32(G_RA(op)), IMM(~0)); // test ra,~0 | |
| 2975 | generate_compute_flags(block, op & M_RC, 0, FALSE); // <update flags> | |
| 2976 | } | |
| 3160 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); // <update flags> | |
| 2977 | 3161 | return TRUE; |
| 2978 | 3162 | |
| 2979 | 3163 | case 0x39a: /* EXTSHx */ |
| 2980 | 3164 | UML_SEXT(block, R32(G_RA(op)), R32(G_RS(op)), WORD); // sext ra,rs,word |
| 2981 | 3165 | if (op & M_RC) |
| 2982 | { | |
| 2983 | UML_TEST(block, R32(G_RA(op)), IMM(~0)); // test ra,~0 | |
| 2984 | generate_compute_flags(block, op & M_RC, 0, FALSE); // <update flags> | |
| 2985 | } | |
| 3166 | generate_compute_flags(block, desc, op & M_RC, 0, FALSE); // <update flags> | |
| 2986 | 3167 | return TRUE; |
| 2987 | 3168 | |
| 2988 | 3169 | case 0x057: /* LBZX */ |
| r2844 | r2845 | |
| 3021 | 3202 | UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb |
| 3022 | 3203 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) |
| 3023 | 3204 | UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]); // callh read32 |
| 3024 | UML_MOV(block, MEM(&ppc->impstate->tempdata), IREG(0)); // mov [tempdata],i0 | |
| 3025 | UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata), DWORD); // fdfrflt fd,[tempdata],dword | |
| 3205 | UML_MOV(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0)); // mov [tempdata],i0 | |
| 3206 | UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.w.l), DWORD); // fdfrflt fd,[tempdata],dword | |
| 3026 | 3207 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 3027 | 3208 | return TRUE; |
| 3028 | 3209 | |
| r2844 | r2845 | |
| 3030 | 3211 | UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb |
| 3031 | 3212 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) |
| 3032 | 3213 | UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode & 3]); // callh read64 |
| 3033 | UML_DMOV(block, MEM(&ppc->impstate->tempdata), IREG(0)); // dmov [tempdata],i0 | |
| 3034 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata)); // fdmov fd,[tempdata] | |
| 3214 | UML_DMOV(block, MEM(&ppc->impstate->tempdata.d), IREG(0)); // dmov [tempdata],i0 | |
| 3215 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.d)); // fdmov fd,[tempdata] | |
| 3035 | 3216 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 3036 | 3217 | return TRUE; |
| 3037 | 3218 | |
| r2844 | r2845 | |
| 3097 | 3278 | UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0)); // mov [updateaddr],i0 |
| 3098 | 3279 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) |
| 3099 | 3280 | UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]); // callh read32 |
| 3100 | UML_MOV(block, MEM(&ppc->impstate->tempdata), IREG(0)); // mov [tempdata],i0 | |
| 3101 | UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata), DWORD); // fdfrflt fd,[tempdata],dword | |
| 3281 | UML_MOV(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0)); // mov [tempdata],i0 | |
| 3282 | UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.w.l), DWORD); // fdfrflt fd,[tempdata],dword | |
| 3102 | 3283 | UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr)); // mov ra,[updateaddr] |
| 3103 | 3284 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 3104 | 3285 | return TRUE; |
| r2844 | r2845 | |
| 3108 | 3289 | UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0)); // mov [updateaddr],i0 |
| 3109 | 3290 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) |
| 3110 | 3291 | UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode & 3]); // callh read64 |
| 3111 | UML_DMOV(block, MEM(&ppc->impstate->tempdata), IREG(0)); // dmov [tempdata],i0 | |
| 3112 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata)); // fdmov fd,[tempdata] | |
| 3292 | UML_DMOV(block, MEM(&ppc->impstate->tempdata.d), IREG(0)); // dmov [tempdata],i0 | |
| 3293 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.d)); // fdmov fd,[tempdata] | |
| 3113 | 3294 | UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr)); // mov ra,[updateaddr] |
| 3114 | 3295 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 3115 | 3296 | return TRUE; |
| r2844 | r2845 | |
| 3123 | 3304 | return TRUE; |
| 3124 | 3305 | |
| 3125 | 3306 | case 0x255: /* LSWI */ |
| 3126 | UML_MOV(block, MEM(&ppc->impstate->swcount), IMM(((G_NB(op) - 1) & 0x1f) + 1)); // mov [swcount],[xer],G_NB | |
| 3127 | 3307 | UML_MOV(block, MEM(&ppc->impstate->updateaddr), R32Z(G_RA(op))); // mov [updateaddr],ra |
| 3128 | UML_MOV(block, MEM(&ppc->impstate->swreg), IMM(4 * G_RD(op))); // mov [swreg],4*G_RD(op) | |
| 3129 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) | |
| 3130 | save_fast_iregs(block); // <save fastregs> | |
| 3131 | UML_LABEL(block, swloop = compiler->labelnum++); // swloop: | |
| 3132 | UML_MOV(block, IREG(0), MEM(&ppc->impstate->updateaddr)); // mov i0,[updateaddr] | |
| 3133 | UML_ADD(block, MEM(&ppc->impstate->updateaddr), IREG(0), IMM(1)); // add [updateaddr],i0,1 | |
| 3134 | UML_CALLH(block, ppc->impstate->read8[ppc->impstate->mode & 3]); // callh read8 | |
| 3135 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->swreg)); // mov i1,[swreg] | |
| 3136 | UML_ADD(block, IREG(2), IREG(1), IMM(1)); // add i2,i1,1 | |
| 3137 | UML_AND(block, MEM(&ppc->impstate->swreg), IREG(2), IMM(0x7f)); // and [swreg],i2,0x7f | |
| 3138 | UML_XOR(block, IREG(1), IREG(1), IMM(BYTE4_XOR_BE(0))); // xor i1,i1,be_xor(0) | |
| 3139 | UML_STORE(block, &ppc->r[0], IREG(1), IREG(0), BYTE); // store &r0,i1,i0,byte | |
| 3140 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); | |
| 3141 | // sub [swcount],[swcount],1 | |
| 3142 | UML_JMPc(block, IF_NZ, swloop); // jmp swloop,NZ | |
| 3143 | load_fast_iregs(block); // <load fastregs> | |
| 3308 | UML_MOV(block, MEM(&ppc->impstate->swcount), IMM(((G_NB(op) - 1) & 0x1f) + 1)); // mov [swcount],G_NB | |
| 3309 | UML_CALLH(block, ppc->impstate->lsw[ppc->impstate->mode & 3][G_RD(op)]); // call lsw[rd] | |
| 3144 | 3310 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 3145 | 3311 | return TRUE; |
| 3146 | 3312 | |
| 3147 | 3313 | case 0x215: /* LSWX */ |
| 3314 | UML_ADD(block, MEM(&ppc->impstate->updateaddr), R32Z(G_RA(op)), R32(G_RB(op))); // add [updateaddr],ra,rb | |
| 3148 | 3315 | UML_AND(block, MEM(&ppc->impstate->swcount), SPR32(SPR_XER), IMM(0x7f)); // and [swcount],[xer],0x7f |
| 3149 | UML_JMPc(block, IF_Z, swloopend = compiler->labelnum++); // jmp swloopend,Z | |
| 3150 | UML_ADD(block, MEM(&ppc->impstate->updateaddr), R32Z(G_RA(op)), R32(G_RB(op))); // add [updateaddr],ra,rb | |
| 3151 | UML_MOV(block, MEM(&ppc->impstate->swreg), IMM(4 * G_RD(op))); // mov [swreg],4*G_RD(op) | |
| 3152 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) | |
| 3153 | save_fast_iregs(block); // <save fastregs> | |
| 3154 | UML_LABEL(block, swloop = compiler->labelnum++); // swloop: | |
| 3155 | UML_MOV(block, IREG(0), MEM(&ppc->impstate->updateaddr)); // mov i0,[updateaddr] | |
| 3156 | UML_ADD(block, MEM(&ppc->impstate->updateaddr), IREG(0), IMM(1)); // add [updateaddr],i0,1 | |
| 3157 | UML_CALLH(block, ppc->impstate->read8[ppc->impstate->mode & 3]); // callh read8 | |
| 3158 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->swreg)); // mov i1,[swreg] | |
| 3159 | UML_ADD(block, IREG(2), IREG(1), IMM(1)); // add i2,i1,1 | |
| 3160 | UML_AND(block, MEM(&ppc->impstate->swreg), IREG(2), IMM(0x7f)); // and [swreg],i2,0x7f | |
| 3161 | UML_XOR(block, IREG(1), IREG(1), IMM(BYTE4_XOR_BE(0))); // xor i1,i1,be_xor(0) | |
| 3162 | UML_STORE(block, &ppc->r[0], IREG(1), IREG(0), BYTE); // store &r0,i1,i0,byte | |
| 3163 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); | |
| 3164 | // sub [swcount],[swcount],1 | |
| 3165 | UML_JMPc(block, IF_NZ, swloop); // jmp swloop,NZ | |
| 3166 | UML_LABEL(block, swloopend); // swloopend: | |
| 3167 | load_fast_iregs(block); // <load fastregs> | |
| 3316 | UML_SUB(block, MEM(&ppc->icount), MEM(&ppc->icount), MEM(&ppc->impstate->swcount));// sub icount,icount,[swcount] | |
| 3317 | UML_CALLHc(block, IF_NZ, ppc->impstate->lsw[ppc->impstate->mode & 3][G_RD(op)]);// call lsw[rd],nz | |
| 3168 | 3318 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 3169 | 3319 | return TRUE; |
| 3170 | 3320 | |
| r2844 | r2845 | |
| 3198 | 3348 | |
| 3199 | 3349 | case 0x297: /* STFSX */ |
| 3200 | 3350 | UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb |
| 3201 | UML_FSFRFLT(block, MEM(&ppc->impstate->tempdata), F64(G_RS(op)), QWORD); // fsfrflt [tempdata],rs,qword | |
| 3202 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata)); // mov i1,[tempdata] | |
| 3351 | UML_FSFRFLT(block, MEM(&ppc->impstate->tempdata.w.l), F64(G_RS(op)), QWORD); // fsfrflt [tempdata],rs,qword | |
| 3352 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l)); // mov i1,[tempdata] | |
| 3203 | 3353 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) |
| 3204 | 3354 | UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]); // callh write32 |
| 3205 | 3355 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| r2844 | r2845 | |
| 3207 | 3357 | |
| 3208 | 3358 | case 0x3d7: /* STFIWX */ |
| 3209 | 3359 | UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb |
| 3210 | UML_FDMOV(block, MEM(&ppc->impstate->tempdata), F64(G_RS(op))); // fdmov [tempdata],rs | |
| 3211 | UML_MOV(block, IREG(1), MEM((UINT32 *)&ppc->impstate->tempdata + BYTE_XOR_LE(0)));// mov i1,[tempdata.lo] | |
| 3360 | UML_FDMOV(block, MEM(&ppc->impstate->tempdata.d), F64(G_RS(op))); // fdmov [tempdata],rs | |
| 3361 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l)); // mov i1,[tempdata.lo] | |
| 3212 | 3362 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) |
| 3213 | 3363 | UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]); // callh write32 |
| 3214 | 3364 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| r2844 | r2845 | |
| 3216 | 3366 | |
| 3217 | 3367 | case 0x2d7: /* STFDX */ |
| 3218 | 3368 | UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb |
| 3219 | UML_FDMOV(block, MEM(&ppc->impstate->tempdata), F64(G_RS(op))); // fdmov [tempdata],rs | |
| 3220 | UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata)); // dmov i1,[tempdata] | |
| 3369 | UML_FDMOV(block, MEM(&ppc->impstate->tempdata.d), F64(G_RS(op))); // fdmov [tempdata],rs | |
| 3370 | UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata.d)); // dmov i1,[tempdata] | |
| 3221 | 3371 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) |
| 3222 | 3372 | UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode & 3]); // callh write64 |
| 3223 | 3373 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| r2844 | r2845 | |
| 3272 | 3422 | |
| 3273 | 3423 | case 0x2b7: /* STFSUX */ |
| 3274 | 3424 | UML_ADD(block, IREG(0), R32(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb |
| 3275 | UML_FSFRFLT(block, MEM(&ppc->impstate->tempdata), F64(G_RS(op)), QWORD); // fsfrflt [tempdata],rs,qword | |
| 3276 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata)); // mov i1,[tempdata] | |
| 3425 | UML_FSFRFLT(block, MEM(&ppc->impstate->tempdata.w.l), F64(G_RS(op)), QWORD); // fsfrflt [tempdata],rs,qword | |
| 3426 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l)); // mov i1,[tempdata] | |
| 3277 | 3427 | UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0)); // mov [updateaddr],i0 |
| 3278 | 3428 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) |
| 3279 | 3429 | UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]); // callh write32 |
| r2844 | r2845 | |
| 3283 | 3433 | |
| 3284 | 3434 | case 0x2f7: /* STFDUX */ |
| 3285 | 3435 | UML_ADD(block, IREG(0), R32(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb |
| 3286 | UML_FDMOV(block, MEM(&ppc->impstate->tempdata), F64(G_RS(op))); // fdmov [tempdata],rs | |
| 3287 | UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata)); // dmov i1,[tempdata] | |
| 3436 | UML_FDMOV(block, MEM(&ppc->impstate->tempdata.d), F64(G_RS(op))); // fdmov [tempdata],rs | |
| 3437 | UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata.d)); // dmov i1,[tempdata] | |
| 3288 | 3438 | UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0)); // mov [updateaddr],i0 |
| 3289 | 3439 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) |
| 3290 | 3440 | UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode & 3]); // callh write64 |
| r2844 | r2845 | |
| 3297 | 3447 | UML_MOV(block, IREG(1), R32(G_RS(op))); // mov i1,rs |
| 3298 | 3448 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) |
| 3299 | 3449 | UML_CALLH(block, ppc->impstate->write32align[ppc->impstate->mode & 3]); // callh write32align |
| 3300 | UML_AND(block, IREG(0), CR32, IMM(~CRMASK(0))); // and i0,cr,~crmask(0) | |
| 3301 | UML_ROLINS(block, IREG(0), SPR32(SPR_XER), IMM(29), IMM(0x10000000)); // rolins i0,[xer],29,0x10000000 | |
| 3302 | 3450 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 3451 | UML_CMP(block, IREG(0), IREG(0)); // cmp i0,i0 | |
| 3452 | generate_compute_flags(block, desc, TRUE, 0, FALSE); // <update flags> | |
| 3303 | 3453 | return TRUE; |
| 3304 | 3454 | |
| 3305 | 3455 | case 0x2d5: /* STSWI */ |
| 3306 | UML_MOV(block, MEM(&ppc->impstate->swcount), IMM(((G_NB(op) - 1) & 0x1f) + 1)); // mov [swcount],[xer],G_NB | |
| 3307 | 3456 | UML_MOV(block, MEM(&ppc->impstate->updateaddr), R32Z(G_RA(op))); // mov [updateaddr],ra |
| 3308 | UML_MOV(block, MEM(&ppc->impstate->swreg), IMM(4 * G_RS(op))); // mov [swreg],4*G_RS(op) | |
| 3309 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) | |
| 3310 | save_fast_iregs(block); // <save fastregs> | |
| 3311 | UML_LABEL(block, swloop = compiler->labelnum++); // swloop: | |
| 3312 | UML_MOV(block, IREG(0), MEM(&ppc->impstate->updateaddr)); // mov i0,[updateaddr] | |
| 3313 | UML_ADD(block, MEM(&ppc->impstate->updateaddr), IREG(0), IMM(1)); // add [updateaddr],i0,1 | |
| 3314 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->swreg)); // mov i1,[swreg] | |
| 3315 | UML_ADD(block, IREG(2), IREG(1), IMM(1)); // add i2,i1,1 | |
| 3316 | UML_AND(block, MEM(&ppc->impstate->swreg), IREG(2), IMM(0x7f)); // and [swreg],i2,0x7f | |
| 3317 | UML_XOR(block, IREG(1), IREG(1), IMM(BYTE4_XOR_BE(0))); // xor i1,i1,be_xor(0) | |
| 3318 | UML_LOAD(block, IREG(1), &ppc->r[0], IREG(1), BYTE); // load i1,&r0,i1,byte | |
| 3319 | UML_CALLH(block, ppc->impstate->write8[ppc->impstate->mode & 3]); // callh write8 | |
| 3320 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); | |
| 3321 | // sub [swcount],[swcount],1 | |
| 3322 | UML_JMPc(block, IF_NZ, swloop); // jmp swloop,NZ | |
| 3457 | UML_MOV(block, MEM(&ppc->impstate->swcount), IMM(((G_NB(op) - 1) & 0x1f) + 1)); // mov [swcount],G_NB | |
| 3458 | UML_CALLH(block, ppc->impstate->stsw[ppc->impstate->mode & 3][G_RD(op)]); // call stsw[rd] | |
| 3323 | 3459 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 3324 | 3460 | return TRUE; |
| 3325 | 3461 | |
| 3326 | 3462 | case 0x295: /* STSWX */ |
| 3327 | UML_AND(block, MEM(&ppc->impstate->swcount), SPR32(SPR_XER), IMM(0x7f)); // and [swcount],[xer],0x7f | |
| 3328 | UML_JMPc(block, IF_Z, swloopend = compiler->labelnum++); // jmp swloopend,Z | |
| 3329 | 3463 | UML_ADD(block, MEM(&ppc->impstate->updateaddr), R32Z(G_RA(op)), R32(G_RB(op))); // add [updateaddr],ra,rb |
| 3330 | UML_MOV(block, MEM(&ppc->impstate->swreg), IMM(4 * G_RS(op))); // mov [swreg],4*G_RS(op) | |
| 3331 | UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op) | |
| 3332 | save_fast_iregs(block); // <save fastregs> | |
| 3333 | UML_LABEL(block, swloop = compiler->labelnum++); // swloop: | |
| 3334 | UML_MOV(block, IREG(0), MEM(&ppc->impstate->updateaddr)); // mov i0,[updateaddr] | |
| 3335 | UML_ADD(block, MEM(&ppc->impstate->updateaddr), IREG(0), IMM(1)); // add [updateaddr],i0,1 | |
| 3336 | UML_MOV(block, IREG(1), MEM(&ppc->impstate->swreg)); // mov i1,[swreg] | |
| 3337 | UML_ADD(block, IREG(2), IREG(1), IMM(1)); // add i2,i1,1 | |
| 3338 | UML_AND(block, MEM(&ppc->impstate->swreg), IREG(2), IMM(0x7f)); // and [swreg],i2,0x7f | |
| 3339 | UML_XOR(block, IREG(1), IREG(1), IMM(BYTE4_XOR_BE(0))); // xor i1,i1,be_xor(0) | |
| 3340 | UML_LOAD(block, IREG(1), &ppc->r[0], IREG(1), BYTE); // load i1,&r0,i1,byte | |
| 3341 | UML_CALLH(block, ppc->impstate->write8[ppc->impstate->mode & 3]); // callh write8 | |
| 3342 | UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); | |
| 3343 | // sub [swcount],[swcount],1 | |
| 3344 | UML_JMPc(block, IF_NZ, swloop); // jmp swloop,NZ | |
| 3345 | UML_LABEL(block, swloopend); // swloopend: | |
| 3464 | UML_AND(block, MEM(&ppc->impstate->swcount), SPR32(SPR_XER), IMM(0x7f)); // and [swcount],[xer],0x7f | |
| 3465 | UML_SUB(block, MEM(&ppc->icount), MEM(&ppc->icount), MEM(&ppc->impstate->swcount));// sub icount,icount,[swcount] | |
| 3466 | UML_CALLHc(block, IF_NZ, ppc->impstate->stsw[ppc->impstate->mode & 3][G_RD(op)]);// call stsw[rd] | |
| 3346 | 3467 | generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE); // <update cycles> |
| 3347 | 3468 | return TRUE; |
| 3348 | 3469 | |
| r2844 | r2845 | |
| 3398 | 3519 | return TRUE; |
| 3399 | 3520 | |
| 3400 | 3521 | case 0x013: /* MFCR */ |
| 3401 | UML_MOV(block, R32(G_RD(op)), CR32); // mov rd,cr | |
| 3522 | UML_SHL(block, IREG(0), CR32(0), IMM(28)); // shl i0,cr(0),28 | |
| 3523 | UML_ROLAND(block, IREG(1), CR32(1), IMM(24), IMM(0x0f000000)); // roland i1,cr(1),24,0x0f000000 | |
| 3524 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1 | |
| 3525 | UML_ROLAND(block, IREG(1), CR32(2), IMM(20), IMM(0x00f00000)); // roland i1,cr(2),20,0x00f00000 | |
| 3526 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1 | |
| 3527 | UML_ROLAND(block, IREG(1), CR32(3), IMM(16), IMM(0x000f0000)); // roland i1,cr(3),16,0x000f0000 | |
| 3528 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1 | |
| 3529 | UML_ROLAND(block, IREG(1), CR32(4), IMM(12), IMM(0x0000f000)); // roland i1,cr(4),12,0x0000f000 | |
| 3530 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1 | |
| 3531 | UML_ROLAND(block, IREG(1), CR32(5), IMM(8), IMM(0x00000f00)); // roland i1,cr(5),8,0x00000f00 | |
| 3532 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1 | |
| 3533 | UML_ROLAND(block, IREG(1), CR32(6), IMM(4), IMM(0x000000f0)); // roland i1,cr(6),4,0x000000f0 | |
| 3534 | UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1 | |
| 3535 | UML_ROLAND(block, IREG(1), CR32(7), IMM(0), IMM(0x0000000f)); // roland i1,cr(7),0,0x0000000f | |
| 3536 | UML_OR(block, R32(G_RD(op)), IREG(0), IREG(1)); // or rd,i0,i1 | |
| 3402 | 3537 | return TRUE; |
| 3403 | 3538 | |
| 3404 | 3539 | case 0x053: /* MFMSR */ |
| r2844 | r2845 | |
| 3408 | 3543 | case 0x153: /* MFSPR */ |
| 3409 | 3544 | { |
| 3410 | 3545 | UINT32 spr = compute_spr(G_SPR(op)); |
| 3411 | if (spr == SPR_LR || spr == SPR_CTR || | |
| 3546 | if (spr == SPR_LR || spr == SPR_CTR || | |
| 3412 | 3547 | UML_MOV(block, R32(G_RD(op)), SPR32(spr)); // mov rd,spr |
| 3548 | else if (spr == SPR_XER) | |
| 3549 | { | |
| 3550 | UML_SHL(block, IREG(0), XERSO32, IMM(31)); // shl i0,[xerso],31 | |
| 3551 | UML_OR(block, R32(G_RD(op)), SPR32(spr), IREG(0)); // or [rd],[xer],i0 | |
| 3552 | } | |
| 3413 | 3553 | else if (spr == SPROEA_PVR) |
| 3414 | 3554 | UML_MOV(block, R32(G_RD(op)), IMM(ppc->flavor)); // mov rd,flavor |
| 3415 | 3555 | else |
| r2844 | r2845 | |
| 3444 | 3584 | } |
| 3445 | 3585 | |
| 3446 | 3586 | case 0x090: /* MTCRF */ |
| 3447 | UML_ROLINS(block, CR32, R32(G_RS(op)), IMM(0), IMM(compute_crf_mask(G_CRM(op))));// rolins cr,rs,0,G_CRM | |
| 3587 | UML_MOV(block, IREG(0), R32(G_RS(op))); // mov i0,rs | |
| 3588 | if (G_CRM(op) & 0x80) UML_ROLAND(block, CR32(0), IREG(0), IMM(4), IMM(0xf)); // roland cr(0),i0,4,0x0f | |
| 3589 | if (G_CRM(op) & 0x40) UML_ROLAND(block, CR32(1), IREG(0), IMM(8), IMM(0xf)); // roland cr(1),i0,8,0x0f | |
| 3590 | if (G_CRM(op) & 0x20) UML_ROLAND(block, CR32(2), IREG(0), IMM(12), IMM(0xf)); // roland cr(2),i0,12,0x0f | |
| 3591 | if (G_CRM(op) & 0x10) UML_ROLAND(block, CR32(3), IREG(0), IMM(16), IMM(0xf)); // roland cr(3),i0,16,0x0f | |
| 3592 | if (G_CRM(op) & 0x08) UML_ROLAND(block, CR32(4), IREG(0), IMM(20), IMM(0xf)); // roland cr(4),i0,20,0x0f | |
| 3593 | if (G_CRM(op) & 0x04) UML_ROLAND(block, CR32(5), IREG(0), IMM(24), IMM(0xf)); // roland cr(5),i0,24,0x0f | |
| 3594 | if (G_CRM(op) & 0x02) UML_ROLAND(block, CR32(6), IREG(0), IMM(28), IMM(0xf)); // roland cr(6),i0,28,0x0f | |
| 3595 | if (G_CRM(op) & 0x01) UML_ROLAND(block, CR32(7), IREG(0), IMM(0), IMM(0xf)); // roland cr(7),i0,0,0x0f | |
| 3448 | 3596 | return TRUE; |
| 3449 | 3597 | |
| 3450 | 3598 | case 0x092: /* MTMSR */ |
| r2844 | r2845 | |
| 3462 | 3610 | case 0x1d3: /* MTSPR */ |
| 3463 | 3611 | { |
| 3464 | 3612 | UINT32 spr = compute_spr(G_SPR(op)); |
| 3465 | if (spr == SPR_LR || spr == SPR_CTR || | |
| 3613 | if (spr == SPR_LR || spr == SPR_CTR || | |
| 3466 | 3614 | UML_MOV(block, SPR32(spr), R32(G_RS(op))); // mov spr,rs |
| 3615 | else if (spr == SPR_XER) | |
| 3616 | { | |
| 3617 | UML_AND(block, SPR32(spr), R32(G_RS(op)), IMM(~XER_SO)); // and spr,rs,~XER_SO | |
| 3618 | UML_SHR(block, XERSO32, R32(G_RS(op)), IMM(31)); // shr [xerso],rs,31 | |
| 3619 | } | |
| 3467 | 3620 | else if (spr == SPROEA_PVR) |
| 3468 | 3621 | ; // read only |
| 3469 | 3622 | else |
| r2844 | r2845 | |
| 3490 | 3643 | return TRUE; |
| 3491 | 3644 | |
| 3492 | 3645 | case 0x200: /* MCRXR */ |
| 3493 | UML_ROLINS(block, CR32, SPR32(SPR_XER), IMM(32 - 4 * G_CRFD(op)), IMM(CRMASK(G_CRFD(op)))); | |
| 3494 | // rolins cr,[xer],32-4*crfd,crmask(crfd) | |
| 3646 | UML_ROLAND(block, IREG(0), SPR32(SPR_XER), IMM(28), IMM(0x0f)); // roland i0,[xer],28,0x0f | |
| 3647 | UML_SHL(block, IREG(1), XERSO32, IMM(3)); // shl i1,[xerso],3 | |
| 3648 | UML_OR(block, CR32(G_CRFD(op)), IREG(0), IREG(1)); // or [crd],i0,i1 | |
| 3495 | 3649 | UML_AND(block, SPR32(SPR_XER), SPR32(SPR_XER), IMM(~0xf0000000)); // and [xer],[xer],~0xf0000000 |
| 3650 | UML_MOV(block, XERSO32, IMM(0)); // mov [xerso],0 | |
| 3496 | 3651 | return TRUE; |
| 3497 | 3652 | |
| 3498 | 3653 | case 0x106: /* ICBT */ |
| r2844 | r2845 | |
| 3569 | 3724 | switch (opswitch) |
| 3570 | 3725 | { |
| 3571 | 3726 | case 0x15: /* FADDSx */ |
| 3727 | if (!(ppc->impstate->drcoptions & PPCDRC_ACCURATE_SINGLES)) | |
| 3728 | return generate_instruction_3f(block, compiler, desc); | |
| 3572 | 3729 | UML_FDADD(block, FREG(0), F64(G_RA(op)), F64(G_RB(op))); // fdadd f0,ra,rb |
| 3573 | 3730 | UML_FDRNDS(block, F64(G_RD(op)), FREG(0)); // fdrnds rd,f0 |
| 3574 | 3731 | return TRUE; |
| 3575 | 3732 | |
| 3576 | 3733 | case 0x14: /* FSUBSx */ |
| 3734 | if (!(ppc->impstate->drcoptions & PPCDRC_ACCURATE_SINGLES)) | |
| 3735 | return generate_instruction_3f(block, compiler, desc); | |
| 3577 | 3736 | UML_FDSUB(block, FREG(0), F64(G_RA(op)), F64(G_RB(op))); // fdsub f0,ra,rb |
| 3578 | 3737 | UML_FDRNDS(block, F64(G_RD(op)), FREG(0)); // fdrnds rd,f0 |
| 3579 | 3738 | return TRUE; |
| 3580 | 3739 | |
| 3581 | 3740 | case 0x19: /* FMULSx */ |
| 3741 | if (!(ppc->impstate->drcoptions & PPCDRC_ACCURATE_SINGLES)) | |
| 3742 | return generate_instruction_3f(block, compiler, desc); | |
| 3582 | 3743 | UML_FDMUL(block, FREG(0), F64(G_RA(op)), F64(G_RB(op))); // fdmul f0,ra,rb |
| 3583 | 3744 | UML_FDRNDS(block, F64(G_RD(op)), FREG(0)); // fdrnds rd,f0 |
| 3584 | 3745 | return TRUE; |
| 3585 | 3746 | |
| 3586 | 3747 | case 0x12: /* FDIVSx */ |
| 3748 | if (!(ppc->impstate->drcoptions & PPCDRC_ACCURATE_SINGLES)) | |
| 3749 | return generate_instruction_3f(block, compiler, desc); | |
| 3587 | 3750 | UML_FDDIV(block, FREG(0), F64(G_RA(op)), F64(G_RB(op))); // fddiv f0,ra,rb |
| 3588 | 3751 | UML_FDRNDS(block, F64(G_RD(op)), FREG(0)); // fdrnds rd,f0 |
| 3589 | 3752 | return TRUE; |
| 3590 | 3753 | |
| 3591 | 3754 | case 0x16: /* FSQRTSx */ |
| 3755 | if (!(ppc->impstate->drcoptions & PPCDRC_ACCURATE_SINGLES)) | |
| 3756 | return generate_instruction_3f(block, compiler, desc); | |
| 3592 | 3757 | UML_FDSQRT(block, FREG(0), F64(G_RB(op))); // fdsqrt f0,rb |
| 3593 | 3758 | UML_FDRNDS(block, F64(G_RD(op)), FREG(0)); // fdrnds rd,f0 |
| 3594 | 3759 | return TRUE; |
| r2844 | r2845 | |
| 3600 | 3765 | return TRUE; |
| 3601 | 3766 | |
| 3602 | 3767 | case 0x1d: /* FMADDSx */ |
| 3768 | if (!(ppc->impstate->drcoptions & PPCDRC_ACCURATE_SINGLES)) | |
| 3769 | return generate_instruction_3f(block, compiler, desc); | |
| 3603 | 3770 | UML_FDMUL(block, FREG(0), F64(G_RA(op)), F64(G_REGC(op))); // fdmul f0,ra,rc |
| 3604 | 3771 | UML_FDADD(block, FREG(0), FREG(0), F64(G_RB(op))); // fdadd f0,f0,rb |
| 3605 | 3772 | UML_FDRNDS(block, F64(G_RD(op)), FREG(0)); // fdrnds rd,f0 |
| 3606 | 3773 | return TRUE; |
| 3607 | 3774 | |
| 3608 | 3775 | case 0x1c: /* FMSUBSx */ |
| 3776 | if (!(ppc->impstate->drcoptions & PPCDRC_ACCURATE_SINGLES)) | |
| 3777 | return generate_instruction_3f(block, compiler, desc); | |
| 3609 | 3778 | UML_FDMUL(block, FREG(0), F64(G_RA(op)), F64(G_REGC(op))); // fdmul f0,ra,rc |
| 3610 | 3779 | UML_FDSUB(block, FREG(0), FREG(0), F64(G_RB(op))); // fdsub f0,f0,rb |
| 3611 | 3780 | UML_FDRNDS(block, F64(G_RD(op)), FREG(0)); // fdrnds rd,f0 |
| 3612 | 3781 | return TRUE; |
| 3613 | 3782 | |
| 3614 | 3783 | case 0x1f: /* FNMADDSx */ |
| 3784 | if (!(ppc->impstate->drcoptions & PPCDRC_ACCURATE_SINGLES)) | |
| 3785 | return generate_instruction_3f(block, compiler, desc); | |
| 3615 | 3786 | UML_FDMUL(block, FREG(0), F64(G_RA(op)), F64(G_REGC(op))); // fdmul f0,ra,rc |
| 3616 | 3787 | UML_FDADD(block, FREG(0), FREG(0), F64(G_RB(op))); // fdadd f0,f0,rb |
| 3617 | 3788 | UML_FDNEG(block, FREG(0), FREG(0)); // fdneg f0,f0 |
| r2844 | r2845 | |
| 3619 | 3790 | return TRUE; |
| 3620 | 3791 | |
| 3621 | 3792 | case 0x1e: /* FNMSUBSx */ |
| 3793 | if (!(ppc->impstate->drcoptions & PPCDRC_ACCURATE_SINGLES)) | |
| 3794 | return generate_instruction_3f(block, compiler, desc); | |
| 3622 | 3795 | UML_FDMUL(block, FREG(0), F64(G_RA(op)), F64(G_REGC(op))); // fdmul f0,ra,rc |
| 3623 | 3796 | UML_FDSUB(block, FREG(0), F64(G_RB(op)), FREG(0)); // fdsub f0,rb,f0 |
| 3624 | 3797 | UML_FDRNDS(block, F64(G_RD(op)), FREG(0)); // fdrnds rd,f0 |
| r2844 | r2845 | |
| 3710 | 3883 | case 0x020: /* FCMPO */ |
| 3711 | 3884 | UML_FDCMP(block, F64(G_RA(op)), F64(G_RB(op))); // fdcmp ra,rb |
| 3712 | 3885 | UML_GETFLGS(block, IREG(0), DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_U); // getflgs i0,czu |
| 3713 | UML_LOAD(block, IREG(0), ppc->impstate->fcmp_cr_table, IREG(0), DWORD); // load i0,fcmp_cr_table,i0,dword | |
| 3714 | UML_ROLINS(block, CR32, IREG(0), IMM(0), IMM(CRMASK(G_CRFD(op)))); // rolins cr,i0,0,crmask[cr] | |
| 3886 | UML_LOAD(block, IREG(0), ppc->impstate->fcmp_cr_table, IREG(0), BYTE); // load i0,fcmp_cr_table,i0,byte | |
| 3887 | UML_OR(block, CR32(G_CRFD(op)), IREG(0), XERSO32); // or [crn],i0,[xerso] | |
| 3715 | 3888 | return TRUE; |
| 3716 | 3889 | |
| 3717 | 3890 | case 0x00c: /* FRSPx */ |
| r2844 | r2845 | |
| 3720 | 3893 | |
| 3721 | 3894 | case 0x00e: /* FCTIWx */ |
| 3722 | 3895 | UML_FDTOINT(block, IREG(0), F64(G_RB(op)), DWORD, DEFAULT); // fdtoint i0,rb,dword,default |
| 3723 | UML_DAND(block, MEM(&ppc->impstate->tempdata), IREG(0), IMM(0xffffffff)); // dand i0,i0,0xffffffff | |
| 3724 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata)); // fdmovr rd,i0 | |
| 3896 | UML_DAND(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0), IMM(0xffffffff));// dand i0,i0,0xffffffff | |
| 3897 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.w.l)); // fdmovr rd,i0 | |
| 3725 | 3898 | return TRUE; |
| 3726 | 3899 | |
| 3727 | 3900 | case 0x00f: /* FCTIWZx */ |
| 3728 | 3901 | UML_FDTOINT(block, IREG(0), F64(G_RB(op)), DWORD, TRUNC); // fdtoint i0,rb,dword,default |
| 3729 | UML_DAND(block, MEM(&ppc->impstate->tempdata), IREG(0), IMM(0xffffffff)); // dand i0,i0,0xffffffff | |
| 3730 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata)); // fdmovr rd,i0 | |
| 3902 | UML_DAND(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0), IMM(0xffffffff));// dand i0,i0,0xffffffff | |
| 3903 | UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.w.l)); // fdmovr rd,i0 | |
| 3731 | 3904 | return TRUE; |
| 3732 | 3905 | |
| 3733 | 3906 | case 0x028: /* FNEGx */ |
| r2844 | r2845 | |
| 3756 | 3929 | return TRUE; |
| 3757 | 3930 | |
| 3758 | 3931 | case 0x040: /* MCRFS */ |
| 3759 | UML_ROLINS(block, CR32, FPSCR32, IMM(((G_CRFS(op) - G_CRFD(op)) & 7) * 4), IMM(CRMASK(G_CRFD(op)))); | |
| 3760 | // rolins cr,fpscr,shift,crmask[crfd] | |
| 3932 | UML_ROLAND(block, CR32(G_CRFD(op)), FPSCR32, IMM(((G_CRFS(op) - 7) & 7) * 4), IMM(0x0f)); | |
| 3933 | // roland [crd],[fpscr],shift,0x0f | |
| 3761 | 3934 | UML_AND(block, FPSCR32, FPSCR32, IMM(~CRMASK(G_CRFS(op)))); // and fpscr,fpscr,~crmask[crfs] |
| 3762 | 3935 | return TRUE; |
| 3763 | 3936 | |
| 3764 | 3937 | case 0x247: /* MFFSx */ |
| 3765 | UML_MOV(block, R32(G_RD(op)), FPSCR32); // mov rd,fpscr | |
| 3938 | UML_MOV(block, MEM(&ppc->impstate->tempdata.w.l), FPSCR32); // mov [tempdata],fpscr | |
| 3939 | UML_FSMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.d)); // fsmov rd,fpscr | |
| 3766 | 3940 | return TRUE; |
| 3767 | 3941 | |
| 3768 | 3942 | case 0x2c7: /* MTFSFx */ |
| 3769 | UML_ROLINS(block, FPSCR32, R32(G_RB(op)), IMM(0), IMM(compute_crf_mask(G_FM(op)))); | |
| 3943 | UML_FDMOV(block, MEM(&ppc->impstate->tempdata.d), F64(G_RB(op))); // fdmov [tempdata],fb | |
| 3944 | UML_ROLINS(block, FPSCR32, MEM(&ppc->impstate->tempdata.w.l), IMM(0), IMM(compute_crf_mask(G_FM(op)))); | |
| 3770 | 3945 | // rolins fpscr,rb,0,crf_mask |
| 3771 | 3946 | return TRUE; |
| 3772 | 3947 | |
| 3773 | 3948 | case 0x086: /* MTFSFIx */ |
| 3774 | UML_ROLINS(block, FPSCR32, | |
| 3949 | UML_ROLINS(block, FPSCR32, IMM(G_IMM(op)), IMM(28 - 4 * G_CRFD(op)), IMM(CRMASK(G_CRFD(op)))); | |
| 3775 | 3950 | // rolins fpscr,rb,0,crf_mask |
| 3776 | 3951 | return TRUE; |
| 3777 | 3952 | } |
| r2844 | r2845 | |
| 3861 | 4036 | log_register_list - log a list of GPR registers |
| 3862 | 4037 | -------------------------------------------------*/ |
| 3863 | 4038 | |
| 3864 | static void log_register_list(drcuml_state *drcuml, const char *string, UINT | |
| 4039 | static void log_register_list(drcuml_state *drcuml, const char *string, const UINT32 * | |
| 3865 | 4040 | { |
| 4041 | static const char *crtext[4] = { "lt", "gt", "eq", "so" }; | |
| 3866 | 4042 | int count = 0; |
| 3867 | 4043 | int regnum; |
| 4044 | int crnum; | |
| 3868 | 4045 | |
| 3869 | 4046 | /* skip if nothing */ |
| 3870 | if ( | |
| 4047 | if ( | |
| 3871 | 4048 | return; |
| 3872 | 4049 | |
| 3873 | 4050 | drcuml_log_printf(drcuml, "[%s:", string); |
| 3874 | 4051 | |
| 3875 | 4052 | for (regnum = 0; regnum < 32; regnum++) |
| 3876 | if (gprmask & ((UINT64)1 << regnum)) | |
| 4053 | if (reglist[0] & REGFLAG_R(regnum)) | |
| 4054 | { | |
| 3877 | 4055 | drcuml_log_printf(drcuml, "%sr%d", (count++ == 0) ? "" : ",", regnum); |
| 4056 | if (regnostarlist != NULL && !(regnostarlist[0] & REGFLAG_R(regnum))) | |
| 4057 | drcuml_log_printf(drcuml, "*"); | |
| 4058 | } | |
| 4059 | ||
| 4060 | for (regnum = 0; regnum < 32; regnum++) | |
| 4061 | if (reglist[1] & REGFLAG_FR(regnum)) | |
| 4062 | { | |
| 4063 | drcuml_log_printf(drcuml, "%sfr%d", (count++ == 0) ? "" : ",", regnum); | |
| 4064 | if (regnostarlist != NULL && !(regnostarlist[1] & REGFLAG_FR(regnum))) | |
| 4065 | drcuml_log_printf(drcuml, "*"); | |
| 4066 | } | |
| 4067 | ||
| 3878 | 4068 | for (regnum = 0; regnum < 8; regnum++) |
| 3879 | if (gprmask & ((UINT64)1 << (32 + regnum))) | |
| 3880 | drcuml_log_printf(drcuml, "%scr%d", (count++ == 0) ? "" : ",", regnum); | |
| 3881 | if (gprmask & ((UINT64)1 << 40)) | |
| 3882 | drcuml_log_printf(drcuml, "%sxer", (count++ == 0) ? "" : ","); | |
| 3883 | if (gprmask & ((UINT64)1 << 41)) | |
| 4069 | if (reglist[2] & REGFLAG_CR(regnum)) | |
| 4070 | { | |
| 4071 | if ((reglist[2] & REGFLAG_CR(regnum)) == REGFLAG_CR(regnum) && (regnostarlist == NULL || (regnostarlist[2] & REGFLAG_CR(regnum)) == REGFLAG_CR(regnum))) | |
| 4072 | { | |
| 4073 | drcuml_log_printf(drcuml, "%scr%d", (count++ == 0) ? "" : ",", regnum); | |
| 4074 | if (regnostarlist != NULL && !(regnostarlist[2] & REGFLAG_CR(regnum))) | |
| 4075 | drcuml_log_printf(drcuml, "*"); | |
| 4076 | } | |
| 4077 | else | |
| 4078 | { | |
| 4079 | for (crnum = 0; crnum < 4; crnum++) | |
| 4080 | if (reglist[2] & REGFLAG_CR_BIT(regnum * 4 + crnum)) | |
| 4081 | { | |
| 4082 | drcuml_log_printf(drcuml, "%scr%d[%s]", (count++ == 0) ? "" : ",", regnum, crtext[crnum]); | |
| 4083 | if (regnostarlist != NULL && !(regnostarlist[2] & REGFLAG_CR_BIT(regnum * 4 + crnum))) | |
| 4084 | drcuml_log_printf(drcuml, "*"); | |
| 4085 | } | |
| 4086 | } | |
| 4087 | } | |
| 4088 | ||
| 4089 | if (reglist[3] & REGFLAG_XER_CA) | |
| 4090 | { | |
| 4091 | drcuml_log_printf(drcuml, "%sxer_ca", (count++ == 0) ? "" : ","); | |
| 4092 | if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_CA)) | |
| 4093 | drcuml_log_printf(drcuml, "*"); | |
| 4094 | } | |
| 4095 | if (reglist[3] & REGFLAG_XER_OV) | |
| 4096 | { | |
| 4097 | drcuml_log_printf(drcuml, "%sxer_ov", (count++ == 0) ? "" : ","); | |
| 4098 | if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_OV)) | |
| 4099 | drcuml_log_printf(drcuml, "*"); | |
| 4100 | } | |
| 4101 | if (reglist[3] & REGFLAG_XER_SO) | |
| 4102 | { | |
| 4103 | drcuml_log_printf(drcuml, "%sxer_so", (count++ == 0) ? "" : ","); | |
| 4104 | if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_SO)) | |
| 4105 | drcuml_log_printf(drcuml, "*"); | |
| 4106 | } | |
| 4107 | if (reglist[3] & REGFLAG_XER_COUNT) | |
| 4108 | { | |
| 4109 | drcuml_log_printf(drcuml, "%sxer_count", (count++ == 0) ? "" : ","); | |
| 4110 | if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_COUNT)) | |
| 4111 | drcuml_log_printf(drcuml, "*"); | |
| 4112 | } | |
| 4113 | if (reglist[3] & REGFLAG_CTR) | |
| 4114 | { | |
| 3884 | 4115 | drcuml_log_printf(drcuml, "%sctr", (count++ == 0) ? "" : ","); |
| 3885 | if (gprmask & ((UINT64)1 << 42)) | |
| 4116 | if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_CTR)) | |
| 4117 | drcuml_log_printf(drcuml, "*"); | |
| 4118 | } | |
| 4119 | if (reglist[3] & REGFLAG_LR) | |
| 4120 | { | |
| 3886 | 4121 | drcuml_log_printf(drcuml, "%slr", (count++ == 0) ? "" : ","); |
| 4122 | if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_LR)) | |
| 4123 | drcuml_log_printf(drcuml, "*"); | |
| 4124 | } | |
| 3887 | 4125 | |
| 3888 | for (regnum = 0; regnum < 32; regnum++) | |
| 3889 | if (fprmask & ((UINT64)1 << regnum)) | |
| 3890 | drcuml_log_printf(drcuml, "%sfpr%d", (count++ == 0) ? "" : ",", regnum); | |
| 3891 | if (fprmask & ((UINT64)1 << 32)) | |
| 3892 | drcuml_log_printf(drcuml, "%sfpscr", (count++ == 0) ? "" : ","); | |
| 4126 | for (regnum = 0; regnum < 8; regnum++) | |
| 4127 | if (reglist[3] & REGFLAG_FPSCR(regnum)) | |
| 4128 | { | |
| 4129 | drcuml_log_printf(drcuml, "%sfpscr%d", (count++ == 0) ? "" : ",", regnum); | |
| 4130 | if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_FPSCR(regnum))) | |
| 4131 | drcuml_log_printf(drcuml, "*"); | |
| 4132 | } | |
| 4133 | ||
| 3893 | 4134 | drcuml_log_printf(drcuml, "] "); |
| 3894 | 4135 | } |
| 3895 | 4136 | |
| r2844 | r2845 | |
| 3921 | 4162 | drcuml_log_printf(drcuml, "%08X [%08X] t:%08X f:%s: %-30s", desclist->pc, desclist->physpc, desclist->targetpc, log_desc_flags_to_string(desclist->flags), buffer); |
| 3922 | 4163 | |
| 3923 | 4164 | /* output register states */ |
| 3924 | log_register_list(drcuml, "use", desclist->gpr.used, desclist->fpr.used); | |
| 3925 | log_register_list(drcuml, "mod", desclist->gpr.modified, desclist->fpr.modified); | |
| 3926 | log_register_list(drcuml, "lrd", desclist->gpr.liveread, desclist->fpr.liveread); | |
| 3927 | log_register_list(drcuml, "lwr", desclist->gpr.livewrite, desclist->fpr.livewrite); | |
| 4165 | log_register_list(drcuml, "use", desclist->regin, NULL); | |
| 4166 | log_register_list(drcuml, "mod", desclist->regout, desclist->regreq); | |
| 3928 | 4167 | drcuml_log_printf(drcuml, "\n"); |
| 3929 | 4168 | |
| 3930 | 4169 | /* if we have a delay slot, output it recursively */ |
| r2844 | r2845 | |
|---|---|---|
| 14 | 14 | DEBUGGING |
| 15 | 15 | ***************************************************************************/ |
| 16 | 16 | |
| 17 | #define PRINTF_TLB_FILL ( | |
| 17 | #define PRINTF_TLB_FILL (1) | |
| 18 | 18 | #define PRINTF_SPU (0) |
| 19 | 19 | #define PRINTF_DECREMENTER (0) |
| 20 | 20 | |
| r2844 | r2845 | |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | /*------------------------------------------------- |
| 109 | get_cr - return the current CR value | |
| 110 | -------------------------------------------------*/ | |
| 111 | ||
| 112 | INLINE UINT32 get_cr(powerpc_state *ppc) | |
| 113 | { | |
| 114 | return ((ppc->cr[0] & 0x0f) << 28) | | |
| 115 | ((ppc->cr[1] & 0x0f) << 24) | | |
| 116 | ((ppc->cr[2] & 0x0f) << 20) | | |
| 117 | ((ppc->cr[3] & 0x0f) << 16) | | |
| 118 | ((ppc->cr[4] & 0x0f) << 12) | | |
| 119 | ((ppc->cr[5] & 0x0f) << 8) | | |
| 120 | ((ppc->cr[6] & 0x0f) << 4) | | |
| 121 | ((ppc->cr[7] & 0x0f) << 0); | |
| 122 | } | |
| 123 | ||
| 124 | ||
| 125 | /*------------------------------------------------- | |
| 126 | set_cr - set the current CR value | |
| 127 | -------------------------------------------------*/ | |
| 128 | ||
| 129 | INLINE void set_cr(powerpc_state *ppc, UINT32 value) | |
| 130 | { | |
| 131 | ppc->cr[0] = value >> 28; | |
| 132 | ppc->cr[1] = value >> 24; | |
| 133 | ppc->cr[2] = value >> 20; | |
| 134 | ppc->cr[3] = value >> 16; | |
| 135 | ppc->cr[4] = value >> 12; | |
| 136 | ppc->cr[5] = value >> 8; | |
| 137 | ppc->cr[6] = value >> 4; | |
| 138 | ppc->cr[7] = value >> 0; | |
| 139 | } | |
| 140 | ||
| 141 | ||
| 142 | /*------------------------------------------------- | |
| 143 | get_xer - return the current XER value | |
| 144 | -------------------------------------------------*/ | |
| 145 | ||
| 146 | INLINE UINT32 get_xer(powerpc_state *ppc) | |
| 147 | { | |
| 148 | return ppc->spr[SPR_XER] | (ppc->xerso << 31); | |
| 149 | } | |
| 150 | ||
| 151 | ||
| 152 | /*------------------------------------------------- | |
| 153 | set_xer - set the current XER value | |
| 154 | -------------------------------------------------*/ | |
| 155 | ||
| 156 | INLINE void set_xer(powerpc_state *ppc, UINT32 value) | |
| 157 | { | |
| 158 | ppc->spr[SPR_XER] = value & ~XER_SO; | |
| 159 | ppc->xerso = value >> 31; | |
| 160 | } | |
| 161 | ||
| 162 | ||
| 163 | /*------------------------------------------------- | |
| 109 | 164 | get_timebase - return the current timebase |
| 110 | 165 | value |
| 111 | 166 | -------------------------------------------------*/ |
| r2844 | r2845 | |
| 422 | 477 | offs_t transaddr = address; |
| 423 | 478 | UINT32 entryval; |
| 424 | 479 | |
| 425 | /* allow for an implementation-specific override */ | |
| 426 | if (ppc->tlb_fill != NULL && (*ppc->tlb_fill)(ppc)) | |
| 427 | return; | |
| 480 | /* 4xx case: "TLB" really just caches writes and checks compare registers */ | |
| 481 | if (ppc->cap & PPCCAP_4XX) | |
| 482 | { | |
| 483 | /* assume success and direct translation */ | |
| 484 | ppc->param0 = 1; | |
| 485 | transaddr = address & 0x7fffffff; | |
| 428 | 486 | |
| 429 | /* if we can't translate the address, just return (and fail) */ | |
| 430 | ppc->param0 = ppccom_translate_address_internal(ppc, transtype | transuser, &transaddr); | |
| 487 | /* we don't support the MMU of the 403GCX */ | |
| 488 | if (ppc->flavor == PPC_MODEL_403GCX && (ppc->msr & MSROEA_DR)) | |
| 489 | fatalerror("MMU enabled but not supported!"); | |
| 490 | ||
| 491 | /* only check if PE is enabled */ | |
| 492 | if (transtype == TRANSLATE_WRITE && (ppc->msr & MSR4XX_PE)) | |
| 493 | { | |
| 494 | /* are we within one of the protection ranges? */ | |
| 495 | int inrange1 = ((address >> 12) >= (ppc->spr[SPR4XX_PBL1] >> 12) && (address >> 12) < (ppc->spr[SPR4XX_PBU1] >> 12)); | |
| 496 | int inrange2 = ((address >> 12) >= (ppc->spr[SPR4XX_PBL2] >> 12) && (address >> 12) < (ppc->spr[SPR4XX_PBU2] >> 12)); | |
| 497 | ||
| 498 | /* if PX == 1, writes are only allowed OUTSIDE of the bounds */ | |
| 499 | if (((ppc->msr & MSR4XX_PX) && (inrange1 || inrange2)) || (!(ppc->msr & MSR4XX_PX) && (!inrange1 && !inrange2))) | |
| 500 | ppc->param0 = 2; | |
| 501 | } | |
| 502 | } | |
| 503 | ||
| 504 | /* OEA case: perform an address translation */ | |
| 505 | else | |
| 506 | ppc->param0 = ppccom_translate_address_internal(ppc, transtype | transuser, &transaddr); | |
| 507 | ||
| 508 | /* log information and return upon failure */ | |
| 431 | 509 | if (PRINTF_TLB_FILL) |
| 432 | printf("tlb_fill: %08X (%s%s) -> ", address, (transtype == TRANSLATE_READ) ? "R" : (transtype == TRANSLATE_WRITE) ? "W" : "F", transuser ? " | |
| 510 | printf("tlb_fill: %08X (%s%s) -> ", address, (transtype == TRANSLATE_READ) ? "R" : (transtype == TRANSLATE_WRITE) ? "W" : "F", transuser ? " | |
| 433 | 511 | if (ppc->param0 > 1) |
| 434 | 512 | { |
| 435 | 513 | if (PRINTF_TLB_FILL) |
| r2844 | r2845 | |
| 620 | 698 | /* read-through no-ops */ |
| 621 | 699 | case SPR4XX_EVPR: |
| 622 | 700 | case SPR4XX_ESR: |
| 623 | case SPR4XX_DCCR: | |
| 624 | case SPR4XX_ICCR: | |
| 625 | 701 | case SPR4XX_SRR0: |
| 626 | 702 | case SPR4XX_SRR1: |
| 627 | 703 | case SPR4XX_SRR2: |
| 628 | 704 | case SPR4XX_SRR3: |
| 629 | 705 | case SPR4XX_TCR: |
| 630 | 706 | case SPR4XX_TSR: |
| 707 | case SPR4XX_IAC1: | |
| 708 | case SPR4XX_IAC2: | |
| 709 | case SPR4XX_DAC1: | |
| 710 | case SPR4XX_DAC2: | |
| 711 | case SPR4XX_DCCR: | |
| 712 | case SPR4XX_ICCR: | |
| 713 | case SPR4XX_PBL1: | |
| 714 | case SPR4XX_PBU1: | |
| 715 | case SPR4XX_PBL2: | |
| 716 | case SPR4XX_PBU2: | |
| 631 | 717 | ppc->param1 = ppc->spr[ppc->param0]; |
| 632 | 718 | return; |
| 633 | 719 | |
| r2844 | r2845 | |
| 751 | 837 | ppc->spr[ppc->param0] = ppc->param1; |
| 752 | 838 | return; |
| 753 | 839 | |
| 840 | /* registers that affect the memory map */ | |
| 841 | case SPR4XX_PBL1: | |
| 842 | case SPR4XX_PBU1: | |
| 843 | case SPR4XX_PBL2: | |
| 844 | case SPR4XX_PBU2: | |
| 845 | ppc->spr[ppc->param0] = ppc->param1; | |
| 846 | ppccom_tlb_flush(ppc); | |
| 847 | return; | |
| 848 | ||
| 754 | 849 | /* timer control register */ |
| 755 | 850 | case SPR4XX_TCR: |
| 756 | 851 | ppc->spr[SPR4XX_TCR] = ppc->param1 | (oldval & PPC4XX_TCR_WRC_MASK); |
| r2844 | r2845 | |
| 814 | 909 | case DCR4XX_DMADA0: |
| 815 | 910 | case DCR4XX_DMASA0: |
| 816 | 911 | case DCR4XX_DMACC0: |
| 912 | case DCR4XX_DMACR0: | |
| 817 | 913 | case DCR4XX_DMACT1: |
| 818 | 914 | case DCR4XX_DMADA1: |
| 819 | 915 | case DCR4XX_DMASA1: |
| 820 | 916 | case DCR4XX_DMACC1: |
| 917 | case DCR4XX_DMACR1: | |
| 821 | 918 | case DCR4XX_DMACT2: |
| 822 | 919 | case DCR4XX_DMADA2: |
| 823 | 920 | case DCR4XX_DMASA2: |
| 824 | 921 | case DCR4XX_DMACC2: |
| 922 | case DCR4XX_DMACR2: | |
| 825 | 923 | case DCR4XX_DMACT3: |
| 826 | 924 | case DCR4XX_DMADA3: |
| 827 | 925 | case DCR4XX_DMASA3: |
| 828 | 926 | case DCR4XX_DMACC3: |
| 927 | case DCR4XX_DMACR3: | |
| 829 | 928 | case DCR4XX_EXIER: |
| 830 | 929 | case DCR4XX_EXISR: |
| 831 | 930 | case DCR4XX_IOCR: |
| r2844 | r2845 | |
| 948 | 1047 | case CPUINFO_INT_PC: |
| 949 | 1048 | case CPUINFO_INT_REGISTER + PPC_PC: ppc->pc = info->i; break; |
| 950 | 1049 | case CPUINFO_INT_REGISTER + PPC_MSR: ppc->msr = info->i; break; |
| 951 | case CPUINFO_INT_REGISTER + PPC_CR: ppc | |
| 1050 | case CPUINFO_INT_REGISTER + PPC_CR: set_cr(ppc, | |
| 952 | 1051 | case CPUINFO_INT_REGISTER + PPC_LR: ppc->spr[SPR_LR] = info->i; break; |
| 953 | 1052 | case CPUINFO_INT_REGISTER + PPC_CTR: ppc->spr[SPR_CTR] = info->i; break; |
| 954 | case CPUINFO_INT_REGISTER + PPC_XER: ppc | |
| 1053 | case CPUINFO_INT_REGISTER + PPC_XER: set_xer(ppc, | |
| 955 | 1054 | case CPUINFO_INT_REGISTER + PPC_SRR0: ppc->spr[SPROEA_SRR0] = info->i; break; |
| 956 | 1055 | case CPUINFO_INT_REGISTER + PPC_SRR1: ppc->spr[SPROEA_SRR1] = info->i; break; |
| 957 | 1056 | case CPUINFO_INT_REGISTER + PPC_SPRG0: ppc->spr[SPROEA_SPRG0] = info->i; break; |
| r2844 | r2845 | |
| 963 | 1062 | case CPUINFO_INT_REGISTER + PPC_EXISR: ppc->dcr[DCR4XX_EXISR] = info->i; break; |
| 964 | 1063 | case CPUINFO_INT_REGISTER + PPC_EVPR: ppc->spr[SPR4XX_EVPR] = info->i; break; |
| 965 | 1064 | case CPUINFO_INT_REGISTER + PPC_IOCR: ppc->dcr[DCR4XX_IOCR] = info->i; break; |
| 1065 | case CPUINFO_INT_REGISTER + PPC_TBL: set_timebase(ppc, (get_timebase(ppc) & ~U64(0x00ffffff00000000)) | info->i); break; | |
| 1066 | case CPUINFO_INT_REGISTER + PPC_TBH: set_timebase(ppc, (get_timebase(ppc) & ~U64(0x00000000ffffffff)) | ((UINT64)(ppc->param1 & 0x00ffffff) << 32)); break; | |
| 1067 | case CPUINFO_INT_REGISTER + PPC_DEC: set_decrementer(ppc, info->i); break; | |
| 966 | 1068 | |
| 967 | 1069 | case CPUINFO_INT_REGISTER + PPC_R0: ppc->r[0] = info->i; break; |
| 968 | 1070 | case CPUINFO_INT_REGISTER + PPC_R1: ppc->r[1] = info->i; break; |
| r2844 | r2845 | |
| 1035 | 1137 | case CPUINFO_INT_PC: |
| 1036 | 1138 | case CPUINFO_INT_REGISTER + PPC_PC: info->i = ppc->pc; break; |
| 1037 | 1139 | case CPUINFO_INT_REGISTER + PPC_MSR: info->i = ppc->msr; break; |
| 1038 | case CPUINFO_INT_REGISTER + PPC_CR: info->i = ppc | |
| 1140 | case CPUINFO_INT_REGISTER + PPC_CR: info->i = get_cr(ppc) | |
| 1039 | 1141 | case CPUINFO_INT_REGISTER + PPC_LR: info->i = ppc->spr[SPR_LR]; break; |
| 1040 | 1142 | case CPUINFO_INT_REGISTER + PPC_CTR: info->i = ppc->spr[SPR_CTR]; break; |
| 1041 | case CPUINFO_INT_REGISTER + PPC_XER: info->i = ppc | |
| 1143 | case CPUINFO_INT_REGISTER + PPC_XER: info->i = get_xer(ppc) | |
| 1042 | 1144 | case CPUINFO_INT_REGISTER + PPC_SRR0: info->i = ppc->spr[SPROEA_SRR0]; break; |
| 1043 | 1145 | case CPUINFO_INT_REGISTER + PPC_SRR1: info->i = ppc->spr[SPROEA_SRR1]; break; |
| 1044 | 1146 | case CPUINFO_INT_REGISTER + PPC_SPRG0: info->i = ppc->spr[SPROEA_SPRG0]; break; |
| r2844 | r2845 | |
| 1050 | 1152 | case CPUINFO_INT_REGISTER + PPC_EXISR: info->i = ppc->dcr[DCR4XX_EXISR]; break; |
| 1051 | 1153 | case CPUINFO_INT_REGISTER + PPC_EVPR: info->i = ppc->spr[SPR4XX_EVPR]; break; |
| 1052 | 1154 | case CPUINFO_INT_REGISTER + PPC_IOCR: info->i = ppc->dcr[DCR4XX_IOCR]; break; |
| 1155 | case CPUINFO_INT_REGISTER + PPC_TBH: info->i = get_timebase(ppc) >> 32; break; | |
| 1156 | case CPUINFO_INT_REGISTER + PPC_TBL: info->i = (UINT32)get_timebase(ppc); break; | |
| 1157 | case CPUINFO_INT_REGISTER + PPC_DEC: info->i = get_decrementer(ppc); break; | |
| 1053 | 1158 | |
| 1054 | 1159 | case CPUINFO_INT_REGISTER + PPC_R0: info->i = ppc->r[0]; break; |
| 1055 | 1160 | case CPUINFO_INT_REGISTER + PPC_R1: info->i = ppc->r[1]; break; |
| r2844 | r2845 | |
| 1108 | 1213 | |
| 1109 | 1214 | case CPUINFO_STR_REGISTER + PPC_PC: sprintf(info->s, "PC: %08X", ppc->pc); break; |
| 1110 | 1215 | case CPUINFO_STR_REGISTER + PPC_MSR: sprintf(info->s, "MSR:%08X", ppc->msr); break; |
| 1111 | case CPUINFO_STR_REGISTER + PPC_CR: sprintf(info->s, "CR: %08X", ppc | |
| 1216 | case CPUINFO_STR_REGISTER + PPC_CR: sprintf(info->s, "CR: %08X", get_cr(ppc | |
| 1112 | 1217 | case CPUINFO_STR_REGISTER + PPC_LR: sprintf(info->s, "LR: %08X", ppc->spr[SPR_LR]); break; |
| 1113 | 1218 | case CPUINFO_STR_REGISTER + PPC_CTR: sprintf(info->s, "CTR:%08X", ppc->spr[SPR_CTR]); break; |
| 1114 | case CPUINFO_STR_REGISTER + PPC_XER: sprintf(info->s, "XER:%08X", ppc | |
| 1219 | case CPUINFO_STR_REGISTER + PPC_XER: sprintf(info->s, "XER:%08X", get_xer(ppc | |
| 1115 | 1220 | case CPUINFO_STR_REGISTER + PPC_SRR0: sprintf(info->s, "SRR0: %08X", ppc->spr[SPROEA_SRR0]); break; |
| 1116 | 1221 | case CPUINFO_STR_REGISTER + PPC_SRR1: sprintf(info->s, "SRR1: %08X", ppc->spr[SPROEA_SRR1]); break; |
| 1117 | 1222 | case CPUINFO_STR_REGISTER + PPC_SPRG0: sprintf(info->s, "SPRG0: %08X", ppc->spr[SPROEA_SPRG0]); break; |
| r2844 | r2845 | |
| 1123 | 1228 | case CPUINFO_STR_REGISTER + PPC_EXISR: sprintf(info->s, "EXISR: %08X", ppc->dcr[DCR4XX_EXISR]); break; |
| 1124 | 1229 | case CPUINFO_STR_REGISTER + PPC_EVPR: sprintf(info->s, "EVPR: %08X", ppc->spr[SPR4XX_EVPR]); break; |
| 1125 | 1230 | case CPUINFO_STR_REGISTER + PPC_IOCR: sprintf(info->s, "IOCR: %08X", ppc->dcr[DCR4XX_EXISR]); break; |
| 1231 | case CPUINFO_STR_REGISTER + PPC_TBH: sprintf(info->s, "TBH: %08X", (UINT32)(get_timebase(ppc) >> 32)); break; | |
| 1232 | case CPUINFO_STR_REGISTER + PPC_TBL: sprintf(info->s, "TBL: %08X", (UINT32)get_timebase(ppc)); break; | |
| 1233 | case CPUINFO_STR_REGISTER + PPC_DEC: sprintf(info->s, "DEC: %08X", get_decrementer(ppc)); break; | |
| 1126 | 1234 | |
| 1127 | 1235 | case CPUINFO_STR_REGISTER + PPC_R0: sprintf(info->s, "R0: %08X", ppc->r[0]); break; |
| 1128 | 1236 | case CPUINFO_STR_REGISTER + PPC_R1: sprintf(info->s, "R1: %08X", ppc->r[1]); break; |
| r2844 | r2845 | |
| 1252 | 1360 | |
| 1253 | 1361 | /* update the IRQ state for each DMA channel */ |
| 1254 | 1362 | for (dmachan = 0; dmachan < 4; dmachan++) |
| 1255 | if ((ppc->dcr[DCR4XX_DMACR0 + 8 * dmachan] & PPC4XX_DMACR_CIE) && (ppc->dcr[DCR4XX_DMASR] & (1 << (27 - dmachan)))) | |
| 1363 | if ((ppc->dcr[DCR4XX_DMACR0 + 8 * dmachan] & PPC4XX_DMACR_CIE) && (ppc->dcr[DCR4XX_DMASR] & (0x11 << (27 - dmachan)))) | |
| 1256 | 1364 | ppc4xx_set_irq_line(ppc, PPC4XX_IRQ_BIT_DMA(dmachan), ASSERT_LINE); |
| 1257 | 1365 | else |
| 1258 | 1366 | ppc4xx_set_irq_line(ppc, PPC4XX_IRQ_BIT_DMA(dmachan), CLEAR_LINE); |
| r2844 | r2845 | |
| 1277 | 1385 | return FALSE; |
| 1278 | 1386 | |
| 1279 | 1387 | /* set the complete bit and handle interrupts */ |
| 1280 | ppc->dcr[DCR4XX_DMASR] |= 1 << (27 - dmachan); | |
| 1388 | ppc->dcr[DCR4XX_DMASR] |= 1 << (31 - dmachan); | |
| 1389 | // ppc->dcr[DCR4XX_DMASR] |= 1 << (27 - dmachan); | |
| 1281 | 1390 | ppc4xx_dma_update_irq_states(ppc); |
| 1282 | 1391 | return TRUE; |
| 1283 | 1392 | } |
| r2844 | r2845 | |
| 1372 | 1481 | |
| 1373 | 1482 | /* software initiated memory-to-memory mode DMA */ |
| 1374 | 1483 | case 2: |
| 1375 | width = dma_transfer_width[(dmaregs[DCR4XX_DMACR0] >> 26 | |
| 1484 | width = dma_transfer_width[(dmaregs[DCR4XX_DMACR0] & PPC4XX_DMACR_PW_MASK) >> 26 | |
| 1376 | 1485 | srcinc = (dmaregs[DCR4XX_DMACR0] & PPC4XX_DMACR_SAI) ? width : 0; |
| 1377 | 1486 | destinc = (dmaregs[DCR4XX_DMACR0] & PPC4XX_DMACR_DAI) ? width : 0; |
| 1378 | 1487 | |
| r2844 | r2845 | |
| 1529 | 1638 | |
| 1530 | 1639 | static void ppc4xx_spu_rx_data(powerpc_state *ppc, UINT8 data) |
| 1531 | 1640 | { |
| 1532 | fatalerror("ppc4xx_spu_rx_data unimplemented\n"); | |
| 1641 | UINT32 new_rxin; | |
| 1642 | ||
| 1643 | /* fail if we are going to overflow */ | |
| 1644 | new_rxin = (ppc->spu.rxin + 1) % ARRAY_LENGTH(ppc->spu.rxbuffer); | |
| 1645 | if (new_rxin == ppc->spu.rxout) | |
| 1646 | fatalerror("ppc4xx_spu_rx_data: buffer overrun!"); | |
| 1647 | ||
| 1648 | /* store the data and accept the new in index */ | |
| 1649 | ppc->spu.rxbuffer[ppc->spu.rxin] = data; | |
| 1650 | ppc->spu.rxin = new_rxin; | |
| 1533 | 1651 | } |
| 1534 | 1652 | |
| 1535 | 1653 | |
| r2844 | r2845 | |
| 1551 | 1669 | attotime charperiod = attotime_mul(clockperiod, divisor * 16 * bpc); |
| 1552 | 1670 | timer_adjust_periodic(ppc->spu.timer, charperiod, 0, charperiod); |
| 1553 | 1671 | if (PRINTF_SPU) |
| 1554 | | |
| 1672 | | |
| 1555 | 1673 | } |
| 1556 | 1674 | |
| 1557 | 1675 | /* otherwise, disable the timer */ |
| r2844 | r2845 | |
| 1568 | 1686 | static TIMER_CALLBACK( ppc4xx_spu_callback ) |
| 1569 | 1687 | { |
| 1570 | 1688 | powerpc_state *ppc = ptr; |
| 1571 | UINT8 rxbyte; | |
| 1572 | 1689 | |
| 1573 | 1690 | /* transmit enabled? */ |
| 1574 | 1691 | if (ppc->spu.regs[SPU4XX_TX_COMMAND] & 0x80) |
| r2844 | r2845 | |
| 1598 | 1715 | |
| 1599 | 1716 | /* receive enabled? */ |
| 1600 | 1717 | if (ppc->spu.regs[SPU4XX_RX_COMMAND] & 0x80) |
| 1601 | if (ppc->spu.rx | |
| 1718 | if (ppc->spu.rxout | |
| 1602 | 1719 | { |
| 1603 | 1720 | int operation = (ppc->spu.regs[SPU4XX_RX_COMMAND] >> 5) & 3; |
| 1721 | UINT8 rxbyte; | |
| 1604 | 1722 | |
| 1723 | /* consume the byte and advance the out pointer */ | |
| 1724 | rxbyte = ppc->spu.rxbuffer[ppc->spu.rxout]; | |
| 1725 | ppc->spu.rxout = (ppc->spu.rxout + 1) % ARRAY_LENGTH(ppc->spu.rxbuffer); | |
| 1726 | ||
| 1605 | 1727 | /* if we're not full, copy data to the buffer and update the line status */ |
| 1606 | 1728 | if (!(ppc->spu.regs[SPU4XX_LINE_STATUS] & 0x80)) |
| 1607 | 1729 | { |
| r2844 | r2845 | |
| 1649 | 1771 | break; |
| 1650 | 1772 | } |
| 1651 | 1773 | if (PRINTF_SPU) |
| 1652 | | |
| 1774 | | |
| 1653 | 1775 | return result; |
| 1654 | 1776 | } |
| 1655 | 1777 | |
| r2844 | r2845 | |
| 1664 | 1786 | UINT8 oldstate, newstate; |
| 1665 | 1787 | |
| 1666 | 1788 | if (PRINTF_SPU) |
| 1667 | | |
| 1789 | | |
| 1668 | 1790 | switch (offset) |
| 1669 | 1791 | { |
| 1670 | 1792 | /* clear error bits */ |
| r2844 | r2845 | |
| 1748 | 1870 | case CPUINFO_INT_PPC_RX_DATA: ppc4xx_spu_rx_data(ppc, info->i); break; |
| 1749 | 1871 | |
| 1750 | 1872 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 1751 | case CPUINFO_PTR_SPU_RX_HANDLER: ppc->spu.rx_handler = (ppc4xx_spu_rx_handler)info->f; break; | |
| 1752 | 1873 | case CPUINFO_PTR_SPU_TX_HANDLER: ppc->spu.tx_handler = (ppc4xx_spu_tx_handler)info->f; break; |
| 1753 | 1874 | |
| 1754 | 1875 | /* --- everything else is handled generically --- */ |
| r2844 | r2845 | |
| 1775 | 1896 | case CPUINFO_INT_INPUT_STATE + PPC_IRQ_LINE_4: info->i = ppc4xx_get_irq_line(ppc, PPC4XX_IRQ_BIT_EXT4); break; |
| 1776 | 1897 | |
| 1777 | 1898 | case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32; break; |
| 1899 | case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 31; break; | |
| 1778 | 1900 | case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 0; break; |
| 1779 | 1901 | case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0; break; |
| 1780 | 1902 |
| r2844 | r2845 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | /*************************************************************************** |
| 17 | WIDE-SCALE CONTROLS | |
| 18 | ***************************************************************************/ | |
| 19 | ||
| 20 | #define SIMULATE_603_TLB (0) | |
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | /*************************************************************************** | |
| 25 | 17 | CONSTANTS |
| 26 | 18 | ***************************************************************************/ |
| 27 | 19 | |
| r2844 | r2845 | |
| 33 | 25 | #define PPC603_FIXED_TLB_ENTRIES 128 |
| 34 | 26 | |
| 35 | 27 | |
| 28 | /* cycle parameters */ | |
| 29 | #define POWERPC_COUNT_READ_TBL 100 | |
| 30 | #define POWERPC_COUNT_READ_DEC 100 | |
| 31 | ||
| 32 | ||
| 36 | 33 | /* internal capabilities flags */ |
| 37 | 34 | #define PPCCAP_OEA 0x01 /* TRUE if we conform to the OEA */ |
| 38 | 35 | #define PPCCAP_VEA 0x02 /* TRUE if we conform to the VEA */ |
| r2844 | r2845 | |
| 87 | 84 | { |
| 88 | 85 | EXCEPTION_RESET = 1, |
| 89 | 86 | EXCEPTION_MACHCHECK = 2, |
| 90 | EXCEPTION_DSI = 3, | |
| 87 | EXCEPTION_DSI = 3, /* PPCCAP_OEA */ | |
| 88 | EXCEPTION_PROTECTION= 3, /* PPCCAP_4XX */ | |
| 91 | 89 | EXCEPTION_ISI = 4, |
| 92 | 90 | EXCEPTION_EI = 5, |
| 93 | 91 | EXCEPTION_ALIGN = 6, |
| r2844 | r2845 | |
| 156 | 154 | SPR4XX_SPRG2 = 0x112, /* R/W 403GA SPR General 2 */ |
| 157 | 155 | SPR4XX_SPRG3 = 0x113, /* R/W 403GA SPR General 3 */ |
| 158 | 156 | SPR4XX_PVR = 0x11f, /* R 403GA Processor Version Number */ |
| 157 | SPR4XX_PID = 0x3b1, /* R/W 403GCX Process ID */ | |
| 159 | 158 | SPR4XX_SGR = 0x3b9, /* R/W 403GCX Storage Guarded Register */ |
| 160 | 159 | SPR4XX_DCWR = 0x3ba, /* R/W 403GCX Data Cache Write Through */ |
| 161 | SPR4XX_PID = 0x3b1, /* R/W 403GCX Process ID */ | |
| 162 | 160 | SPR4XX_TBHU = 0x3cc, /* R/W 403GCX Time Base High User-mode */ |
| 163 | 161 | SPR4XX_TBLU = 0x3cd, /* R/W 403GCX Time Base Low User-mode */ |
| 164 | 162 | SPR4XX_ICDBDR = 0x3d3, /* R 403GA 406GA Instruction Cache Debug Data Register */ |
| r2844 | r2845 | |
| 493 | 491 | STRUCTURES & TYPEDEFS |
| 494 | 492 | ***************************************************************************/ |
| 495 | 493 | |
| 496 | typedef int (*ppc4xx_spu_rx_handler)(UINT8 *data); | |
| 497 | typedef void (*ppc4xx_spu_tx_handler)(UINT8 data); | |
| 498 | ||
| 499 | ||
| 500 | 494 | /* PowerPC 4XX-specific serial port state */ |
| 501 | 495 | typedef struct _ppc4xx_spu_state ppc4xx_spu_state; |
| 502 | 496 | struct _ppc4xx_spu_state |
| r2844 | r2845 | |
| 505 | 499 | UINT8 txbuf; |
| 506 | 500 | UINT8 rxbuf; |
| 507 | 501 | emu_timer * timer; |
| 508 | ppc4xx_spu_rx_handler rx_handler; | |
| 502 | UINT8 rxbuffer[256]; | |
| 503 | UINT32 rxin, rxout; | |
| 509 | 504 | ppc4xx_spu_tx_handler tx_handler; |
| 510 | 505 | }; |
| 511 | 506 | |
| r2844 | r2845 | |
| 523 | 518 | int icount; |
| 524 | 519 | UINT32 r[32]; |
| 525 | 520 | double f[32]; |
| 526 | UINT32 cr; | |
| 521 | UINT32 cr[8]; | |
| 522 | UINT32 xerso; | |
| 527 | 523 | UINT32 fpscr; |
| 528 | 524 | UINT32 msr; |
| 529 | 525 | UINT32 sr[16]; |
| r2844 | r2845 | |
| 544 | 540 | UINT8 cap; |
| 545 | 541 | UINT8 cache_line_size; |
| 546 | 542 | UINT32 tb_divisor; |
| 547 | int (*spr_read)(powerpc_state *ppc); | |
| 548 | int (*spr_write)(powerpc_state *ppc); | |
| 549 | int (*tlb_fill)(powerpc_state *ppc); | |
| 550 | 543 | |
| 551 | 544 | /* PowerPC 4xx-specific state */ |
| 552 | 545 | ppc4xx_spu_state spu; |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | 3 | ppc.h |
| 4 | Interface file for the portable MIPS III/IV emulator. | |
| 5 | Written by Aaron Giles | |
| 6 | 4 | |
| 5 | Interface file for the universal machine language-based | |
| 6 | PowerPC emulator. | |
| 7 | ||
| 8 | Copyright Aaron Giles | |
| 9 | Released for general non-commercial use under the MAME license | |
| 10 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 11 | ||
| 7 | 12 | ***************************************************************************/ |
| 8 | 13 | |
| 9 | 14 | #ifndef __PPC_H__ |
| r2844 | r2845 | |
| 13 | 18 | |
| 14 | 19 | |
| 15 | 20 | /*************************************************************************** |
| 16 | | |
| 21 | CON | |
| 17 | 22 | ***************************************************************************/ |
| 18 | 23 | |
| 24 | /* general constants */ | |
| 25 | #define PPC_MAX_FASTRAM 4 | |
| 26 | #define PPC_MAX_HOTSPOTS 16 | |
| 27 | ||
| 28 | ||
| 29 | /* interrupt types */ | |
| 30 | #define PPC_IRQ 0 /* external IRQ */ | |
| 31 | #define PPC_IRQ_LINE_0 0 /* (4XX) external IRQ0 */ | |
| 32 | #define PPC_IRQ_LINE_1 1 /* (4XX) external IRQ1 */ | |
| 33 | #define PPC_IRQ_LINE_2 2 /* (4XX) external IRQ2 */ | |
| 34 | #define PPC_IRQ_LINE_3 3 /* (4XX) external IRQ3 */ | |
| 35 | #define PPC_IRQ_LINE_4 4 /* (4XX) external IRQ4 */ | |
| 36 | ||
| 37 | ||
| 38 | /* register enumeration */ | |
| 19 | 39 | enum |
| 20 | 40 | { |
| 21 | 41 | PPC_PC = 1, |
| r2844 | r2845 | |
| 66 | 86 | PPC_EXIER, |
| 67 | 87 | PPC_EXISR, |
| 68 | 88 | PPC_EVPR, |
| 69 | PPC_IOCR | |
| 89 | PPC_IOCR, | |
| 90 | PPC_TBL, | |
| 91 | PPC_TBH, | |
| 92 | PPC_DEC | |
| 70 | 93 | }; |
| 71 | 94 | |
| 72 | 95 | |
| 73 | #define PPC_MAX_FASTRAM 4 | |
| 74 | #define PPC_MAX_HOTSPOTS 16 | |
| 75 | ||
| 76 | ||
| 96 | /* interface extensions */ | |
| 77 | 97 | enum |
| 78 | 98 | { |
| 79 | 99 | CPUINFO_INT_PPC_DRC_OPTIONS = CPUINFO_INT_CPU_SPECIFIC, |
| r2844 | r2845 | |
| 92 | 112 | |
| 93 | 113 | CPUINFO_PTR_PPC_FASTRAM_BASE = CPUINFO_PTR_CPU_SPECIFIC, |
| 94 | 114 | |
| 95 | CPUINFO_PTR_SPU_RX_HANDLER, | |
| 96 | 115 | CPUINFO_PTR_SPU_TX_HANDLER, |
| 97 | 116 | |
| 98 | 117 | CPUINFO_PTR_CONTEXT /* temporary */ |
| 99 | 118 | }; |
| 100 | 119 | |
| 101 | 120 | |
| 121 | /* compiler-specific options */ | |
| 122 | #define PPCDRC_STRICT_VERIFY 0x0001 /* verify all instructions */ | |
| 123 | #define PPCDRC_FLUSH_PC 0x0002 /* flush the PC value before each memory access */ | |
| 124 | #define PPCDRC_ACCURATE_SINGLES 0x0004 /* do excessive rounding to make single-precision results "accurate" */ | |
| 102 | 125 | |
| 103 | /*************************************************************************** | |
| 104 | INTERRUPT CONSTANTS | |
| 105 | ***************************************************************************/ | |
| 106 | 126 | |
| 107 | #define PPC_IRQ 0 /* external IRQ */ | |
| 108 | #define PPC_IRQ_LINE_0 0 /* (4XX) external IRQ0 */ | |
| 109 | #define PPC_IRQ_LINE_1 1 /* (4XX) external IRQ1 */ | |
| 110 | #define PPC_IRQ_LINE_2 2 /* (4XX) external IRQ2 */ | |
| 111 | #define PPC_IRQ_LINE_3 3 /* (4XX) external IRQ3 */ | |
| 112 | #define PPC_IRQ_LINE_4 4 /* (4XX) external IRQ4 */ | |
| 127 | /* common sets of options */ | |
| 128 | #define PPCDRC_COMPATIBLE_OPTIONS (PPCDRC_STRICT_VERIFY | PPCDRC_FLUSH_PC | PPCDRC_ACCURATE_SINGLES) | |
| 129 | #define PPCDRC_FASTEST_OPTIONS (0) | |
| 113 | 130 | |
| 114 | 131 | |
| 115 | 132 | |
| 116 | 133 | /*************************************************************************** |
| 117 | STRUCTURES | |
| 134 | STRUCTURES AND TYPEDEFS | |
| 118 | 135 | ***************************************************************************/ |
| 119 | 136 | |
| 137 | typedef void (*ppc4xx_spu_tx_handler)(UINT8 data); | |
| 138 | ||
| 120 | 139 | typedef struct _powerpc_config powerpc_config; |
| 121 | 140 | struct _powerpc_config |
| 122 | 141 | { |
| r2844 | r2845 | |
| 168 | 187 | |
| 169 | 188 | |
| 170 | 189 | /*************************************************************************** |
| 171 | | |
| 190 | | |
| 172 | 191 | ***************************************************************************/ |
| 173 | 192 | |
| 174 | #define PPCDRC_STRICT_VERIFY 0x0001 /* verify all instructions */ | |
| 175 | #define PPCDRC_FLUSH_PC 0x0002 /* flush the PC value before each memory access */ | |
| 193 | INLINE void ppc4xx_spu_set_tx_handler(int cpunum, ppc4xx_spu_tx_handler handler) | |
| 194 | { | |
| 195 | cpunum_set_info_fct(cpunum, CPUINFO_PTR_SPU_TX_HANDLER, (genf *)handler); | |
| 196 | } | |
| 176 | 197 | |
| 177 | #define PPCDRC_COMPATIBLE_OPTIONS (PPCDRC_STRICT_VERIFY | PPCDRC_FLUSH_PC) | |
| 178 | #define PPCDRC_FASTEST_OPTIONS (0) | |
| 179 | 198 | |
| 199 | INLINE void ppc4xx_spu_receive_byte(int cpunum, UINT8 byteval) | |
| 200 | { | |
| 201 | cpunum_set_info_int(cpunum, CPUINFO_INT_PPC_RX_DATA, byteval); | |
| 202 | } | |
| 203 | ||
| 204 | ||
| 205 | ||
| 180 | 206 | #endif /* __PPC_H__ */ |
| r2844 | r2845 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /*************************************************************************** |
| 20 | MACROS | |
| 21 | ***************************************************************************/ | |
| 22 | ||
| 23 | #define GPR_USED(desc, x) do { (desc)->regin[0] |= REGFLAG_R(x); } while (0) | |
| 24 | #define GPR_USED_OR_ZERO(desc, x) do { (desc)->regin[0] |= ((x) == 0 ? 0 : REGFLAG_R(x)); } while (0) | |
| 25 | #define GPR_MODIFIED(desc, x) do { (desc)->regout[0] |= REGFLAG_R(x); } while (0) | |
| 26 | ||
| 27 | #define FPR_USED(desc, x) do { (desc)->regin[1] |= REGFLAG_FR(x); } while (0) | |
| 28 | #define FPR_MODIFIED(desc, x) do { (desc)->regout[1] |= REGFLAG_FR(x); } while (0) | |
| 29 | ||
| 30 | #define CR_USED(desc, x) do { (desc)->regin[2] |= REGFLAG_CR(x); } while (0) | |
| 31 | #define CR_BIT_USED(desc, x) do { (desc)->regin[2] |= REGFLAG_CR_BIT(x); } while (0) | |
| 32 | #define CR_MODIFIED(desc, x) do { (desc)->regout[2] |= REGFLAG_CR(x); } while (0) | |
| 33 | #define CR_BIT_MODIFIED(desc, x) do { (desc)->regout[2] |= REGFLAG_CR_BIT(x); } while (0) | |
| 34 | ||
| 35 | #define XER_CA_USED(desc) do { (desc)->regin[3] |= REGFLAG_XER_CA; } while (0) | |
| 36 | #define XER_OV_USED(desc) do { (desc)->regin[3] |= REGFLAG_XER_OV; } while (0) | |
| 37 | #define XER_SO_USED(desc) do { (desc)->regin[3] |= REGFLAG_XER_SO; } while (0) | |
| 38 | #define XER_COUNT_USED(desc) do { (desc)->regin[3] |= REGFLAG_XER_COUNT; } while (0) | |
| 39 | #define XER_CA_MODIFIED(desc) do { (desc)->regout[3] |= REGFLAG_XER_CA; } while (0) | |
| 40 | #define XER_OV_MODIFIED(desc) do { (desc)->regout[3] |= REGFLAG_XER_OV; } while (0) | |
| 41 | #define XER_SO_MODIFIED(desc) do { (desc)->regout[3] |= REGFLAG_XER_SO; } while (0) | |
| 42 | #define XER_COUNT_MODIFIED(desc) do { (desc)->regout[3] |= REGFLAG_XER_COUNT; } while (0) | |
| 43 | ||
| 44 | #define CTR_USED(desc) do { (desc)->regin[3] |= REGFLAG_CTR; } while (0) | |
| 45 | #define CTR_MODIFIED(desc) do { (desc)->regout[3] |= REGFLAG_CTR; } while (0) | |
| 46 | #define LR_USED(desc) do { (desc)->regin[3] |= REGFLAG_LR; } while (0) | |
| 47 | #define LR_MODIFIED(desc) do { (desc)->regout[3] |= REGFLAG_LR; } while (0) | |
| 48 | ||
| 49 | #define FPSCR_USED(desc, x) do { (desc)->regin[3] |= REGFLAG_FPSCR(x); } while (0) | |
| 50 | #define FPSCR_MODIFIED(desc, x) do { (desc)->regout[3] |= REGFLAG_FPSCR(x); } while (0) | |
| 51 | ||
| 52 | ||
| 53 | ||
| 54 | /*************************************************************************** | |
| 20 | 55 | FUNCTION PROTOTYPES |
| 21 | 56 | ***************************************************************************/ |
| 22 | 57 | |
| r2844 | r2845 | |
| 28 | 63 | |
| 29 | 64 | |
| 30 | 65 | /*************************************************************************** |
| 66 | INLINE FUNCTIONS | |
| 67 | ***************************************************************************/ | |
| 68 | ||
| 69 | /*------------------------------------------------- | |
| 70 | compute_spr - compute the SPR index from the | |
| 71 | SPR field of an opcode | |
| 72 | -------------------------------------------------*/ | |
| 73 | ||
| 74 | INLINE UINT32 compute_spr(UINT32 spr) | |
| 75 | { | |
| 76 | return ((spr >> 5) | (spr << 5)) & 0x3ff; | |
| 77 | } | |
| 78 | ||
| 79 | ||
| 80 | /*------------------------------------------------- | |
| 81 | is_403_class - are we one of the 403 variants? | |
| 82 | -------------------------------------------------*/ | |
| 83 | ||
| 84 | INLINE int is_403_class(const powerpc_state *ppc) | |
| 85 | { | |
| 86 | return (ppc->flavor == PPC_MODEL_403GA || ppc->flavor == PPC_MODEL_403GB || ppc->flavor == PPC_MODEL_403GC || ppc->flavor == PPC_MODEL_403GCX || ppc->flavor == PPC_MODEL_405GP); | |
| 87 | } | |
| 88 | ||
| 89 | ||
| 90 | /*------------------------------------------------- | |
| 91 | is_601_class - are we one of the 601 variants? | |
| 92 | -------------------------------------------------*/ | |
| 93 | ||
| 94 | INLINE int is_601_class(const powerpc_state *ppc) | |
| 95 | { | |
| 96 | return (ppc->flavor == PPC_MODEL_601); | |
| 97 | } | |
| 98 | ||
| 99 | ||
| 100 | /*------------------------------------------------- | |
| 101 | is_603_class - are we one of the 603 variants? | |
| 102 | -------------------------------------------------*/ | |
| 103 | ||
| 104 | INLINE int is_603_class(const powerpc_state *ppc) | |
| 105 | { | |
| 106 | return (ppc->flavor == PPC_MODEL_603 || ppc->flavor == PPC_MODEL_603E || ppc->flavor == PPC_MODEL_603EV || ppc->flavor == PPC_MODEL_603R); | |
| 107 | } | |
| 108 | ||
| 109 | ||
| 110 | ||
| 111 | /*************************************************************************** | |
| 31 | 112 | INSTRUCTION PARSERS |
| 32 | 113 | ***************************************************************************/ |
| 33 | 114 | |
| r2844 | r2845 | |
| 41 | 122 | powerpc_state *ppc = param; |
| 42 | 123 | UINT32 op = *desc->opptr.l; |
| 43 | 124 | UINT32 opswitch = op >> 26; |
| 125 | int regnum; | |
| 44 | 126 | |
| 45 | 127 | /* all instructions are 4 bytes and default to a single cycle each */ |
| 46 | 128 | desc->length = 4; |
| r2844 | r2845 | |
| 56 | 138 | return FALSE; |
| 57 | 139 | |
| 58 | 140 | case 0x03: /* TWI */ |
| 59 | desc | |
| 141 | GPR_USED(desc, | |
| 60 | 142 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 143 | if (is_603_class(ppc)) | |
| 144 | desc->cycles = 2; /* 603 */ | |
| 61 | 145 | return TRUE; |
| 62 | 146 | |
| 63 | 147 | case 0x07: /* MULLI */ |
| 64 | desc->gpr.used |= REGFLAG_R(G_RA(op)); | |
| 65 | desc->gpr.modified |= REGFLAG_R(G_RD(op)); | |
| 148 | GPR_USED(desc, G_RA(op)); | |
| 149 | GPR_MODIFIED(desc, G_RD(op)); | |
| 150 | if (is_403_class(ppc)) | |
| 151 | desc->cycles = 4; /* 4XX */ | |
| 152 | else if (is_601_class(ppc)) | |
| 153 | desc->cycles = 5; /* 601 */ | |
| 154 | else if (is_603_class(ppc)) | |
| 155 | desc->cycles = 2; /* 603: 2-3 */ | |
| 156 | else | |
| 157 | desc->cycles = 2; /* ??? */ | |
| 66 | 158 | return TRUE; |
| 67 | 159 | |
| 68 | 160 | case 0x0e: /* ADDI */ |
| 69 | 161 | case 0x0f: /* ADDIS */ |
| 70 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)); | |
| 71 | desc->gpr.modified |= REGFLAG_R(G_RD(op)); | |
| 162 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 163 | GPR_MODIFIED(desc, G_RD(op)); | |
| 72 | 164 | return TRUE; |
| 73 | 165 | |
| 74 | 166 | case 0x0a: /* CMPLI */ |
| 75 | 167 | case 0x0b: /* CMPI */ |
| 76 | desc->gpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_XER; | |
| 77 | desc->gpr.modified |= REGFLAG_CR(G_CRFD(op)); | |
| 168 | GPR_USED(desc, G_RA(op)); | |
| 169 | XER_SO_USED(desc); | |
| 170 | CR_MODIFIED(desc, G_CRFD(op)); | |
| 78 | 171 | return TRUE; |
| 79 | 172 | |
| 80 | 173 | case 0x08: /* SUBFIC */ |
| 81 | 174 | case 0x0c: /* ADDIC */ |
| 82 | desc->gpr.used |= REGFLAG_R(G_RA(op)); | |
| 83 | desc->gpr.modified |= REGFLAG_R(G_RD(op)) | REGFLAG_XER; | |
| 175 | GPR_USED(desc, G_RA(op)); | |
| 176 | GPR_MODIFIED(desc, G_RD(op)); | |
| 177 | XER_CA_MODIFIED(desc); | |
| 84 | 178 | return TRUE; |
| 85 | 179 | |
| 86 | 180 | case 0x0d: /* ADDIC. */ |
| 87 | desc->gpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_XER; | |
| 88 | desc->gpr.modified |= REGFLAG_R(G_RT(op)) | REGFLAG_CR(0) | REGFLAG_XER; | |
| 181 | GPR_USED(desc, G_RA(op)); | |
| 182 | XER_SO_USED(desc); | |
| 183 | GPR_MODIFIED(desc, G_RT(op)); | |
| 184 | XER_CA_MODIFIED(desc); | |
| 185 | CR_MODIFIED(desc, 0); | |
| 89 | 186 | return TRUE; |
| 90 | 187 | |
| 91 | 188 | case 0x10: /* BCx */ |
| 92 | desc->gpr.used |= REGFLAG_CR(G_BI(op) / 4); | |
| 93 | if (op & M_LK) desc->gpr.modified |= REGFLAG_LR; | |
| 94 | if (!(G_BO(op) & 4)) | |
| 189 | if (!(G_BO(op) & 0x10)) | |
| 190 | CR_BIT_USED(desc, G_BI(op)); | |
| 191 | if (!(G_BO(op) & 0x04)) | |
| 95 | 192 | { |
| 96 | desc->gpr.used |= REGFLAG_CTR; | |
| 97 | desc->gpr.modified |= REGFLAG_CTR; | |
| 193 | CTR_USED(desc); | |
| 194 | CTR_MODIFIED(desc); | |
| 98 | 195 | } |
| 196 | if (op & M_LK) | |
| 197 | LR_MODIFIED(desc); | |
| 99 | 198 | if ((G_BO(op) & 0x14) == 0x14) |
| 100 | 199 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 101 | 200 | else |
| r2844 | r2845 | |
| 107 | 206 | if (!(ppc->cap & (PPCCAP_OEA | PPCCAP_4XX))) |
| 108 | 207 | return FALSE; |
| 109 | 208 | desc->flags |= OPFLAG_WILL_CAUSE_EXCEPTION; |
| 209 | if (is_601_class(ppc)) | |
| 210 | desc->cycles = 16; /* 601 */ | |
| 211 | else if (is_603_class(ppc)) | |
| 212 | desc->cycles = 3; /* 603 */ | |
| 213 | else | |
| 214 | desc->cycles = 3; /* ??? */ | |
| 110 | 215 | return TRUE; |
| 111 | 216 | |
| 112 | 217 | case 0x12: /* Bx */ |
| 113 | if (op & M_LK) desc->gpr.modified |= REGFLAG_LR; | |
| 218 | if (op & M_LK) | |
| 219 | LR_MODIFIED(desc); | |
| 114 | 220 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 115 | 221 | desc->targetpc = ((INT32)(G_LI(op) << 8) >> 6) + ((op & M_AA) ? 0 : desc->pc); |
| 116 | 222 | return TRUE; |
| r2844 | r2845 | |
| 119 | 225 | return describe_instruction_13(ppc, op, desc); |
| 120 | 226 | |
| 121 | 227 | case 0x14: /* RLWIMIx */ |
| 122 | desc->gpr.used |= REGFLAG_R(G_RS(op)) | REGFLAG_R(G_RA(op)); | |
| 123 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 228 | GPR_USED(desc, G_RS(op)); | |
| 229 | GPR_USED(desc, G_RA(op)); | |
| 230 | GPR_MODIFIED(desc, G_RA(op)); | |
| 124 | 231 | if (op & M_RC) |
| 125 | 232 | { |
| 126 | desc->gpr.used |= REGFLAG_XER; | |
| 127 | desc->gpr.modified |= REGFLAG_CR(0); | |
| 233 | XER_SO_USED(desc); | |
| 234 | CR_MODIFIED(desc, 0); | |
| 128 | 235 | } |
| 129 | 236 | return TRUE; |
| 130 | 237 | |
| 131 | 238 | case 0x15: /* RLWINMx */ |
| 132 | desc->gpr.used |= REGFLAG_R(G_RS(op)); | |
| 133 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 239 | GPR_USED(desc, G_RS(op)); | |
| 240 | GPR_MODIFIED(desc, G_RA(op)); | |
| 134 | 241 | if (op & M_RC) |
| 135 | 242 | { |
| 136 | desc->gpr.used |= REGFLAG_XER; | |
| 137 | desc->gpr.modified |= REGFLAG_CR(0); | |
| 243 | XER_SO_USED(desc); | |
| 244 | CR_MODIFIED(desc, 0); | |
| 138 | 245 | } |
| 139 | 246 | return TRUE; |
| 140 | 247 | |
| 141 | 248 | case 0x17: /* RLWNMx */ |
| 142 | desc->gpr.used |= REGFLAG_R(G_RS(op)) | REGFLAG_R(G_RB(op)); | |
| 143 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 249 | GPR_USED(desc, G_RS(op)); | |
| 250 | GPR_USED(desc, G_RB(op)); | |
| 251 | GPR_MODIFIED(desc, G_RA(op)); | |
| 144 | 252 | if (op & M_RC) |
| 145 | 253 | { |
| 146 | desc->gpr.used |= REGFLAG_XER; | |
| 147 | desc->gpr.modified |= REGFLAG_CR(0); | |
| 254 | XER_SO_USED(desc); | |
| 255 | CR_MODIFIED(desc, 0); | |
| 148 | 256 | } |
| 149 | 257 | return TRUE; |
| 150 | 258 | |
| r2844 | r2845 | |
| 152 | 260 | case 0x19: /* ORIS */ |
| 153 | 261 | case 0x1a: /* XORI */ |
| 154 | 262 | case 0x1b: /* XORIS */ |
| 155 | desc->gpr.used |= REGFLAG_R(G_RS(op)); | |
| 156 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 263 | GPR_USED(desc, G_RS(op)); | |
| 264 | GPR_MODIFIED(desc, G_RA(op)); | |
| 157 | 265 | return TRUE; |
| 158 | 266 | |
| 159 | 267 | case 0x1c: /* ANDI. */ |
| 160 | 268 | case 0x1d: /* ANDIS. */ |
| 161 | desc->gpr.used |= REGFLAG_R(G_RS(op)) | REGFLAG_XER; | |
| 162 | desc->gpr.modified |= REGFLAG_R(G_RA(op)) | REGFLAG_CR(0); | |
| 269 | GPR_USED(desc, G_RS(op)); | |
| 270 | XER_SO_USED(desc); | |
| 271 | GPR_MODIFIED(desc, G_RA(op)); | |
| 272 | CR_MODIFIED(desc, 0); | |
| 163 | 273 | return TRUE; |
| 164 | 274 | |
| 165 | 275 | case 0x1f: /* 0x1f group */ |
| r2844 | r2845 | |
| 169 | 279 | case 0x22: /* LBZ */ |
| 170 | 280 | case 0x28: /* LHZ */ |
| 171 | 281 | case 0x2a: /* LHA */ |
| 172 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)); | |
| 173 | desc->gpr.modified |= REGFLAG_R(G_RD(op)); | |
| 282 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 283 | GPR_MODIFIED(desc, G_RD(op)); | |
| 174 | 284 | desc->flags |= OPFLAG_READS_MEMORY; |
| 175 | 285 | return TRUE; |
| 176 | 286 | |
| r2844 | r2845 | |
| 178 | 288 | case 0x23: /* LBZU */ |
| 179 | 289 | case 0x29: /* LHZU */ |
| 180 | 290 | case 0x2b: /* LHAU */ |
| 181 | if (G_RA(op) == 0) | |
| 291 | if (G_RA(op) == 0 || G_RA(op) == G_RD(op)) | |
| 182 | 292 | return FALSE; |
| 183 | desc->gpr.used |= REGFLAG_R(G_RA(op)); | |
| 184 | desc->gpr.modified |= REGFLAG_R(G_RD(op)) | REGFLAG_R(G_RA(op)); | |
| 293 | GPR_USED(desc, G_RA(op)); | |
| 294 | GPR_MODIFIED(desc, G_RD(op)); | |
| 295 | GPR_MODIFIED(desc, G_RA(op)); | |
| 185 | 296 | desc->flags |= OPFLAG_READS_MEMORY; |
| 186 | 297 | return TRUE; |
| 187 | 298 | |
| 188 | 299 | case 0x24: /* STW */ |
| 189 | 300 | case 0x26: /* STB */ |
| 190 | 301 | case 0x2c: /* STH */ |
| 191 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RS(op)); | |
| 302 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 303 | GPR_USED(desc, G_RS(op)); | |
| 192 | 304 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 193 | 305 | return TRUE; |
| 194 | 306 | |
| r2844 | r2845 | |
| 197 | 309 | case 0x2d: /* STHU */ |
| 198 | 310 | if (G_RA(op) == 0) |
| 199 | 311 | return FALSE; |
| 200 | desc->gpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RS(op)); | |
| 201 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 312 | GPR_USED(desc, G_RA(op)); | |
| 313 | GPR_USED(desc, G_RS(op)); | |
| 314 | GPR_MODIFIED(desc, G_RA(op)); | |
| 202 | 315 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 203 | 316 | return TRUE; |
| 204 | 317 | |
| 205 | 318 | case 0x2e: /* LMW */ |
| 206 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)); | |
| 207 | desc->gpr.modified |= ((REGFLAG_R(31) << 1) - 1) & ~(REGFLAG_R(G_RD(op)) - 1); | |
| 319 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 320 | for (regnum = G_RD(op); regnum < 32; regnum++) | |
| 321 | GPR_MODIFIED(desc, regnum); | |
| 208 | 322 | desc->flags |= OPFLAG_READS_MEMORY; |
| 323 | desc->cycles = 32 - G_RD(op); | |
| 209 | 324 | return TRUE; |
| 210 | 325 | |
| 211 | 326 | case 0x2f: /* STMW */ |
| 212 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | (((REGFLAG_R(31) << 1) - 1) & ~(REGFLAG_R(G_RS(op)) - 1)); | |
| 327 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 328 | for (regnum = G_RS(op); regnum < 32; regnum++) | |
| 329 | GPR_USED(desc, regnum); | |
| 213 | 330 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 331 | desc->cycles = 32 - G_RS(op); | |
| 214 | 332 | return TRUE; |
| 215 | 333 | |
| 216 | 334 | case 0x30: /* LFS */ |
| 217 | 335 | case 0x32: /* LFD */ |
| 218 | 336 | if (!(ppc->cap & PPCCAP_FPU)) |
| 219 | 337 | return FALSE; |
| 220 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)); | |
| 221 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 338 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 339 | FPR_MODIFIED(desc, G_RD(op)); | |
| 222 | 340 | desc->flags |= OPFLAG_READS_MEMORY; |
| 223 | 341 | return TRUE; |
| 224 | 342 | |
| r2844 | r2845 | |
| 226 | 344 | case 0x33: /* LFDU */ |
| 227 | 345 | if (!(ppc->cap & PPCCAP_FPU)) |
| 228 | 346 | return FALSE; |
| 229 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)); | |
| 230 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 231 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 347 | if (G_RA(op) == 0) | |
| 348 | return FALSE; | |
| 349 | GPR_USED(desc, G_RA(op)); | |
| 350 | GPR_MODIFIED(desc, G_RA(op)); | |
| 351 | FPR_MODIFIED(desc, G_RD(op)); | |
| 232 | 352 | desc->flags |= OPFLAG_READS_MEMORY; |
| 233 | 353 | return TRUE; |
| 234 | 354 | |
| r2844 | r2845 | |
| 236 | 356 | case 0x36: /* STFD */ |
| 237 | 357 | if (!(ppc->cap & PPCCAP_FPU)) |
| 238 | 358 | return FALSE; |
| 239 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)); | |
| 240 | desc->fpr.used |= REGFLAG_R(G_RS(op)); | |
| 359 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 360 | FPR_USED(desc, G_RS(op)); | |
| 241 | 361 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 242 | 362 | return TRUE; |
| 243 | 363 | |
| r2844 | r2845 | |
| 245 | 365 | case 0x37: /* STFDU */ |
| 246 | 366 | if (!(ppc->cap & PPCCAP_FPU)) |
| 247 | 367 | return FALSE; |
| 248 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)); | |
| 249 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 250 | desc->fpr.used |= REGFLAG_R(G_RS(op)); | |
| 368 | if (G_RA(op) == 0) | |
| 369 | return FALSE; | |
| 370 | GPR_USED(desc, G_RA(op)); | |
| 371 | GPR_MODIFIED(desc, G_RA(op)); | |
| 372 | FPR_USED(desc, G_RS(op)); | |
| 251 | 373 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 252 | 374 | return TRUE; |
| 253 | 375 | |
| r2844 | r2845 | |
| 275 | 397 | switch (opswitch) |
| 276 | 398 | { |
| 277 | 399 | case 0x000: /* MTCRF */ |
| 278 | desc->gpr.used |= REGFLAG_CR(G_CRFS(op)); | |
| 279 | desc->gpr.modified |= REGFLAG_CR(G_CRFD(op)); | |
| 400 | CR_USED(desc, G_CRFS(op)); | |
| 401 | CR_MODIFIED(desc, G_CRFD(op)); | |
| 280 | 402 | return TRUE; |
| 281 | 403 | |
| 282 | 404 | case 0x010: /* BCLRx */ |
| 283 | desc->gpr.used |= REGFLAG_CR(G_BI(op) / 4) | REGFLAG_LR; | |
| 284 | if (op & M_LK) desc->gpr.modified |= REGFLAG_LR; | |
| 285 | if (!(G_BO(op) & 4)) | |
| 405 | LR_USED(desc); | |
| 406 | if (!(G_BO(op) & 0x10)) | |
| 407 | CR_BIT_USED(desc, G_BI(op)); | |
| 408 | if (!(G_BO(op) & 0x04)) | |
| 286 | 409 | { |
| 287 | desc->gpr.used |= REGFLAG_CTR; | |
| 288 | desc->gpr.modified |= REGFLAG_CTR; | |
| 410 | CTR_USED(desc); | |
| 411 | CTR_MODIFIED(desc); | |
| 289 | 412 | } |
| 413 | if (op & M_LK) | |
| 414 | LR_MODIFIED(desc); | |
| 290 | 415 | if ((G_BO(op) & 0x14) == 0x14) |
| 291 | 416 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 292 | 417 | else |
| r2844 | r2845 | |
| 302 | 427 | case 0x121: /* CREQV */ |
| 303 | 428 | case 0x1a1: /* CRORC */ |
| 304 | 429 | case 0x1c1: /* CROR */ |
| 305 | desc->gpr.used |= REGFLAG_CR(G_CRBA(op) / 4) | REGFLAG_CR(G_CRBB(op) / 4); | |
| 306 | desc->gpr.modified |= REGFLAG_CR(G_CRBD(op) / 4); | |
| 430 | CR_BIT_USED(desc, G_CRBA(op)); | |
| 431 | CR_BIT_USED(desc, G_CRBB(op)); | |
| 432 | CR_BIT_MODIFIED(desc, G_CRBD(op)); | |
| 307 | 433 | return TRUE; |
| 308 | 434 | |
| 309 | 435 | case 0x032: /* RFI */ |
| r2844 | r2845 | |
| 311 | 437 | return FALSE; |
| 312 | 438 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CHANGE_MODES | OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 313 | 439 | desc->targetpc = BRANCH_TARGET_DYNAMIC; |
| 440 | if (is_601_class(ppc)) | |
| 441 | desc->cycles = 13; /* 601 */ | |
| 442 | else if (is_603_class(ppc)) | |
| 443 | desc->cycles = 3; /* 603 */ | |
| 444 | else | |
| 445 | desc->cycles = 3; /* ??? */ | |
| 314 | 446 | return TRUE; |
| 315 | 447 | |
| 316 | 448 | case 0x033: /* RFCI */ |
| r2844 | r2845 | |
| 323 | 455 | case 0x096: /* ISYNC */ |
| 324 | 456 | if (!(ppc->cap & (PPCCAP_VEA | PPCCAP_4XX))) |
| 325 | 457 | return FALSE; |
| 458 | if (is_601_class(ppc)) | |
| 459 | desc->cycles = 6; /* 601 */ | |
| 326 | 460 | return TRUE; |
| 327 | 461 | |
| 328 | 462 | case 0x210: /* BCCTRx */ |
| 329 | desc->gpr.used |= REGFLAG_CR(G_BI(op) / 4) | REGFLAG_CTR; | |
| 330 | if (op & M_LK) desc->gpr.modified |= REGFLAG_LR; | |
| 463 | CTR_USED(desc); | |
| 464 | if (!(G_BO(op) & 0x10)) | |
| 465 | CR_BIT_USED(desc, G_BI(op)); | |
| 466 | if (!(G_BO(op) & 0x04)) | |
| 467 | return FALSE; | |
| 468 | if (op & M_LK) | |
| 469 | LR_MODIFIED(desc); | |
| 331 | 470 | if ((G_BO(op) & 0x14) == 0x14) |
| 332 | 471 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 333 | 472 | else |
| r2844 | r2845 | |
| 349 | 488 | static int describe_instruction_1f(powerpc_state *ppc, UINT32 op, opcode_desc *desc) |
| 350 | 489 | { |
| 351 | 490 | UINT32 opswitch = (op >> 1) & 0x3ff; |
| 491 | int spr, regnum; | |
| 352 | 492 | |
| 353 | 493 | switch (opswitch) |
| 354 | 494 | { |
| r2844 | r2845 | |
| 382 | 522 | |
| 383 | 523 | case 0x000: /* CMP */ |
| 384 | 524 | case 0x020: /* CMPL */ |
| 385 | desc->gpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)) | REGFLAG_XER; | |
| 386 | desc->gpr.modified |= REGFLAG_CR(G_CRFD(op)); | |
| 525 | GPR_USED(desc, G_RA(op)); | |
| 526 | GPR_USED(desc, G_RB(op)); | |
| 527 | XER_SO_USED(desc); | |
| 528 | CR_MODIFIED(desc, G_CRFD(op)); | |
| 387 | 529 | return TRUE; |
| 388 | 530 | |
| 389 | 531 | case 0x004: /* TW */ |
| 390 | desc->gpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 532 | GPR_USED(desc, G_RA(op)); | |
| 533 | GPR_USED(desc, G_RB(op)); | |
| 391 | 534 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 535 | if (is_603_class(ppc)) | |
| 536 | desc->cycles = 2; /* 603 */ | |
| 392 | 537 | return TRUE; |
| 393 | 538 | |
| 394 | 539 | case 0x008: /* SUBFCx */ |
| 395 | 540 | case 0x00a: /* ADDCx */ |
| 396 | case 0x00b: /* MULHWUx */ | |
| 397 | case 0x028: /* SUBFx */ | |
| 398 | case 0x04b: /* MULHWx */ | |
| 541 | GPR_USED(desc, G_RA(op)); | |
| 542 | GPR_USED(desc, G_RB(op)); | |
| 543 | GPR_MODIFIED(desc, G_RD(op)); | |
| 544 | XER_CA_MODIFIED(desc); | |
| 545 | if (op & M_RC) | |
| 546 | { | |
| 547 | XER_SO_USED(desc); | |
| 548 | CR_MODIFIED(desc, 0); | |
| 549 | } | |
| 550 | return TRUE; | |
| 551 | ||
| 399 | 552 | case 0x088: /* SUBFEx */ |
| 400 | 553 | case 0x08a: /* ADDEx */ |
| 554 | GPR_USED(desc, G_RA(op)); | |
| 555 | GPR_USED(desc, G_RB(op)); | |
| 556 | XER_CA_USED(desc); | |
| 557 | GPR_MODIFIED(desc, G_RD(op)); | |
| 558 | XER_CA_MODIFIED(desc); | |
| 559 | if (op & M_RC) | |
| 560 | { | |
| 561 | XER_SO_USED(desc); | |
| 562 | CR_MODIFIED(desc, 0); | |
| 563 | } | |
| 564 | return TRUE; | |
| 565 | ||
| 401 | 566 | case 0x0c8: /* SUBFZEx */ |
| 402 | 567 | case 0x0ca: /* ADDZEx */ |
| 403 | 568 | case 0x0e8: /* SUBFMEx */ |
| 404 | 569 | case 0x0ea: /* ADDMEx */ |
| 570 | GPR_USED(desc, G_RA(op)); | |
| 571 | XER_CA_USED(desc); | |
| 572 | GPR_MODIFIED(desc, G_RD(op)); | |
| 573 | XER_CA_MODIFIED(desc); | |
| 574 | if (op & M_RC) | |
| 575 | { | |
| 576 | XER_SO_USED(desc); | |
| 577 | CR_MODIFIED(desc, 0); | |
| 578 | } | |
| 579 | return TRUE; | |
| 580 | ||
| 581 | case 0x00b: /* MULHWUx */ | |
| 582 | case 0x04b: /* MULHWx */ | |
| 405 | 583 | case 0x0eb: /* MULLWx */ |
| 406 | case 0x10a: /* ADDx */ | |
| 584 | GPR_USED(desc, G_RA(op)); | |
| 585 | GPR_USED(desc, G_RB(op)); | |
| 586 | GPR_MODIFIED(desc, G_RD(op)); | |
| 587 | if (op & M_RC) | |
| 588 | { | |
| 589 | XER_SO_USED(desc); | |
| 590 | CR_MODIFIED(desc, 0); | |
| 591 | } | |
| 592 | if (is_403_class(ppc)) | |
| 593 | desc->cycles = 4; /* 4XX */ | |
| 594 | else if (is_601_class(ppc)) | |
| 595 | desc->cycles = 5; /* 601: 5/9/10 */ | |
| 596 | else if (is_603_class(ppc)) | |
| 597 | desc->cycles = 2; /* 603: 2,3,4,5,6 */ | |
| 598 | else | |
| 599 | desc->cycles = 2; /* ??? */ | |
| 600 | return TRUE; | |
| 601 | ||
| 407 | 602 | case 0x1cb: /* DIVWUx */ |
| 408 | 603 | case 0x1eb: /* DIVWx */ |
| 409 | desc->gpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 410 | desc->gpr.modified |= REGFLAG_R(G_RD(op)); | |
| 604 | GPR_USED(desc, G_RA(op)); | |
| 605 | GPR_USED(desc, G_RB(op)); | |
| 606 | GPR_MODIFIED(desc, G_RD(op)); | |
| 411 | 607 | if (op & M_RC) |
| 412 | 608 | { |
| 413 | desc->gpr.used |= REGFLAG_XER; | |
| 414 | desc->gpr.modified |= REGFLAG_CR(0); | |
| 609 | XER_SO_USED(desc); | |
| 610 | CR_MODIFIED(desc, 0); | |
| 415 | 611 | } |
| 612 | if (is_403_class(ppc)) | |
| 613 | desc->cycles = 33; /* 4XX */ | |
| 614 | else if (is_601_class(ppc)) | |
| 615 | desc->cycles = 36; /* 601 */ | |
| 616 | else if (is_603_class(ppc)) | |
| 617 | desc->cycles = 37; /* 603 */ | |
| 618 | else | |
| 619 | desc->cycles = 33; /* ??? */ | |
| 416 | 620 | return TRUE; |
| 417 | 621 | |
| 622 | case 0x028: /* SUBFx */ | |
| 623 | case 0x10a: /* ADDx */ | |
| 624 | GPR_USED(desc, G_RA(op)); | |
| 625 | GPR_USED(desc, G_RB(op)); | |
| 626 | GPR_MODIFIED(desc, G_RD(op)); | |
| 627 | if (op & M_RC) | |
| 628 | { | |
| 629 | XER_SO_USED(desc); | |
| 630 | CR_MODIFIED(desc, 0); | |
| 631 | } | |
| 632 | return TRUE; | |
| 633 | ||
| 418 | 634 | case 0x208: /* SUBFCOx */ |
| 419 | 635 | case 0x20a: /* ADDCOx */ |
| 420 | case 0x228: /* SUBFOx */ | |
| 636 | GPR_USED(desc, G_RA(op)); | |
| 637 | GPR_USED(desc, G_RB(op)); | |
| 638 | GPR_MODIFIED(desc, G_RD(op)); | |
| 639 | XER_OV_MODIFIED(desc); | |
| 640 | XER_SO_MODIFIED(desc); | |
| 641 | XER_CA_MODIFIED(desc); | |
| 642 | if (op & M_RC) | |
| 643 | CR_MODIFIED(desc, 0); | |
| 644 | return TRUE; | |
| 645 | ||
| 421 | 646 | case 0x288: /* SUBFEOx */ |
| 422 | 647 | case 0x28a: /* ADDEOx */ |
| 648 | GPR_USED(desc, G_RA(op)); | |
| 649 | GPR_USED(desc, G_RB(op)); | |
| 650 | XER_CA_USED(desc); | |
| 651 | GPR_MODIFIED(desc, G_RD(op)); | |
| 652 | XER_OV_MODIFIED(desc); | |
| 653 | XER_SO_MODIFIED(desc); | |
| 654 | XER_CA_MODIFIED(desc); | |
| 655 | if (op & M_RC) | |
| 656 | CR_MODIFIED(desc, 0); | |
| 657 | return TRUE; | |
| 658 | ||
| 423 | 659 | case 0x2c8: /* SUBFZEOx */ |
| 424 | 660 | case 0x2ca: /* ADDZEOx */ |
| 425 | 661 | case 0x2e8: /* SUBFMEOx */ |
| 426 | 662 | case 0x2ea: /* ADDMEOx */ |
| 663 | GPR_USED(desc, G_RA(op)); | |
| 664 | XER_CA_USED(desc); | |
| 665 | GPR_MODIFIED(desc, G_RD(op)); | |
| 666 | XER_OV_MODIFIED(desc); | |
| 667 | XER_SO_MODIFIED(desc); | |
| 668 | XER_CA_MODIFIED(desc); | |
| 669 | if (op & M_RC) | |
| 670 | CR_MODIFIED(desc, 0); | |
| 671 | return TRUE; | |
| 672 | ||
| 427 | 673 | case 0x2eb: /* MULLWOx */ |
| 428 | case 0x30a: /* ADDOx */ | |
| 674 | GPR_USED(desc, G_RA(op)); | |
| 675 | GPR_USED(desc, G_RB(op)); | |
| 676 | GPR_MODIFIED(desc, G_RD(op)); | |
| 677 | XER_OV_MODIFIED(desc); | |
| 678 | XER_SO_MODIFIED(desc); | |
| 679 | if (op & M_RC) | |
| 680 | CR_MODIFIED(desc, 0); | |
| 681 | if (is_403_class(ppc)) | |
| 682 | desc->cycles = 4; /* 4XX */ | |
| 683 | else if (is_601_class(ppc)) | |
| 684 | desc->cycles = 5; /* 601: 5/9/10 */ | |
| 685 | else if (is_603_class(ppc)) | |
| 686 | desc->cycles = 2; /* 603: 2,3,4,5,6 */ | |
| 687 | else | |
| 688 | desc->cycles = 2; /* ??? */ | |
| 689 | return TRUE; | |
| 690 | ||
| 429 | 691 | case 0x3cb: /* DIVWUOx */ |
| 430 | 692 | case 0x3eb: /* DIVWOx */ |
| 431 | desc->gpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 432 | desc->gpr.modified |= REGFLAG_R(G_RD(op)) | REGFLAG_XER; | |
| 693 | GPR_USED(desc, G_RA(op)); | |
| 694 | GPR_USED(desc, G_RB(op)); | |
| 695 | GPR_MODIFIED(desc, G_RD(op)); | |
| 696 | XER_OV_MODIFIED(desc); | |
| 697 | XER_SO_MODIFIED(desc); | |
| 433 | 698 | if (op & M_RC) |
| 434 | { | |
| 435 | desc->gpr.used |= REGFLAG_XER; | |
| 436 | desc->gpr.modified |= REGFLAG_CR(0); | |
| 437 | } | |
| 699 | CR_MODIFIED(desc, 0); | |
| 700 | if (is_403_class(ppc)) | |
| 701 | desc->cycles = 33; /* 4XX */ | |
| 702 | else if (is_601_class(ppc)) | |
| 703 | desc->cycles = 36; /* 601 */ | |
| 704 | else if (is_603_class(ppc)) | |
| 705 | desc->cycles = 37; /* 603 */ | |
| 706 | else | |
| 707 | desc->cycles = 33; /* ??? */ | |
| 438 | 708 | return TRUE; |
| 439 | 709 | |
| 710 | case 0x228: /* SUBFOx */ | |
| 711 | case 0x30a: /* ADDOx */ | |
| 712 | GPR_USED(desc, G_RA(op)); | |
| 713 | GPR_USED(desc, G_RB(op)); | |
| 714 | GPR_MODIFIED(desc, G_RD(op)); | |
| 715 | XER_OV_MODIFIED(desc); | |
| 716 | XER_SO_MODIFIED(desc); | |
| 717 | if (op & M_RC) | |
| 718 | CR_MODIFIED(desc, 0); | |
| 719 | return TRUE; | |
| 720 | ||
| 440 | 721 | case 0x013: /* MFCR */ |
| 441 | desc->gpr.used |= ((REGFLAG_CR(7) << 1) - 1) & ~(REGFLAG_CR(0) - 1); | |
| 442 | desc->gpr.modified |= REGFLAG_R(G_RD(op)); | |
| 722 | CR_USED(desc, 0); | |
| 723 | CR_USED(desc, 1); | |
| 724 | CR_USED(desc, 2); | |
| 725 | CR_USED(desc, 3); | |
| 726 | CR_USED(desc, 4); | |
| 727 | CR_USED(desc, 5); | |
| 728 | CR_USED(desc, 6); | |
| 729 | CR_USED(desc, 7); | |
| 730 | GPR_MODIFIED(desc, G_RD(op)); | |
| 443 | 731 | return TRUE; |
| 444 | 732 | |
| 445 | 733 | case 0x136: /* ECIWX */ |
| r2844 | r2845 | |
| 452 | 740 | case 0x157: /* LHAX */ |
| 453 | 741 | case 0x216: /* LWBRX */ |
| 454 | 742 | case 0x316: /* LHBRX */ |
| 455 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 456 | desc->gpr.modified |= REGFLAG_R(G_RD(op)); | |
| 743 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 744 | GPR_USED(desc, G_RB(op)); | |
| 745 | GPR_MODIFIED(desc, G_RD(op)); | |
| 457 | 746 | desc->flags |= OPFLAG_READS_MEMORY; |
| 458 | 747 | return TRUE; |
| 459 | 748 | |
| r2844 | r2845 | |
| 466 | 755 | case 0x19c: /* ORCx */ |
| 467 | 756 | case 0x1bc: /* ORx */ |
| 468 | 757 | case 0x1dc: /* NANDx */ |
| 758 | GPR_USED(desc, G_RS(op)); | |
| 759 | GPR_USED(desc, G_RB(op)); | |
| 760 | GPR_MODIFIED(desc, G_RA(op)); | |
| 761 | if (op & M_RC) | |
| 762 | { | |
| 763 | XER_SO_USED(desc); | |
| 764 | CR_MODIFIED(desc, 0); | |
| 765 | } | |
| 766 | return TRUE; | |
| 767 | ||
| 469 | 768 | case 0x218: /* SRWx */ |
| 470 | 769 | case 0x318: /* SRAWx */ |
| 471 | desc->gpr.used |= REGFLAG_RZ(G_RS(op)) | REGFLAG_R(G_RB(op)); | |
| 472 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 770 | GPR_USED(desc, G_RS(op)); | |
| 771 | GPR_USED(desc, G_RB(op)); | |
| 772 | GPR_MODIFIED(desc, G_RA(op)); | |
| 773 | XER_CA_MODIFIED(desc); | |
| 774 | if (op & M_RC) | |
| 775 | { | |
| 776 | XER_SO_USED(desc); | |
| 777 | CR_MODIFIED(desc, 0); | |
| 778 | } | |
| 473 | 779 | return TRUE; |
| 474 | 780 | |
| 475 | 781 | case 0x01a: /* CNTLZWx */ |
| 476 | 782 | case 0x39a: /* EXTSHx */ |
| 477 | 783 | case 0x3ba: /* EXTSBx */ |
| 478 | desc->gpr.used |= REGFLAG_RZ(G_RS(op)); | |
| 479 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 784 | GPR_USED(desc, G_RS(op)); | |
| 785 | GPR_MODIFIED(desc, G_RA(op)); | |
| 786 | if (op & M_RC) | |
| 787 | { | |
| 788 | XER_SO_USED(desc); | |
| 789 | CR_MODIFIED(desc, 0); | |
| 790 | } | |
| 480 | 791 | return TRUE; |
| 481 | 792 | |
| 482 | 793 | case 0x036: /* DCBST */ |
| r2844 | r2845 | |
| 487 | 798 | case 0x3d6: /* ICBI */ |
| 488 | 799 | if (!(ppc->cap & (PPCCAP_VEA | PPCCAP_4XX))) |
| 489 | 800 | return FALSE; |
| 490 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 801 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 802 | GPR_USED(desc, G_RB(op)); | |
| 491 | 803 | return TRUE; |
| 492 | 804 | |
| 493 | 805 | case 0x1d6: /* DCBI */ |
| 494 | 806 | if (!(ppc->cap & (PPCCAP_OEA | PPCCAP_4XX))) |
| 495 | 807 | return FALSE; |
| 496 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 808 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 809 | GPR_USED(desc, G_RB(op)); | |
| 497 | 810 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 498 | 811 | return TRUE; |
| 499 | 812 | |
| r2844 | r2845 | |
| 501 | 814 | case 0x077: /* LBZUX */ |
| 502 | 815 | case 0x137: /* LHZUX */ |
| 503 | 816 | case 0x177: /* LHAUX */ |
| 504 | desc->gpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 505 | desc->gpr.modified |= REGFLAG_R(G_RD(op)) | REGFLAG_R(G_RA(op)); | |
| 817 | if (G_RA(op) == 0 || G_RA(op) == G_RD(op)) | |
| 818 | return FALSE; | |
| 819 | GPR_USED(desc, G_RA(op)); | |
| 820 | GPR_USED(desc, G_RB(op)); | |
| 821 | GPR_MODIFIED(desc, G_RD(op)); | |
| 822 | GPR_MODIFIED(desc, G_RA(op)); | |
| 506 | 823 | desc->flags |= OPFLAG_READS_MEMORY; |
| 507 | 824 | return TRUE; |
| 508 | 825 | |
| 509 | 826 | case 0x153: /* MFSPR */ |
| 510 | desc->gpr.modified |= REGFLAG_R(G_RD(op)); | |
| 511 | if (G_SPR(op) & 0x200) | |
| 827 | GPR_MODIFIED(desc, G_RD(op)); | |
| 828 | spr = compute_spr(G_SPR(op)); | |
| 829 | if (spr == SPR_LR) | |
| 830 | LR_USED(desc); | |
| 831 | if (spr == SPR_CTR) | |
| 832 | CTR_USED(desc); | |
| 833 | if (spr == SPR_XER) | |
| 834 | { | |
| 835 | XER_COUNT_USED(desc); | |
| 836 | XER_CA_USED(desc); | |
| 837 | XER_OV_USED(desc); | |
| 838 | XER_SO_USED(desc); | |
| 839 | } | |
| 840 | if (spr & 0x010) | |
| 512 | 841 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 842 | if ((ppc->cap & PPCCAP_4XX) && spr == SPR4XX_TBLU) | |
| 843 | desc->cycles = POWERPC_COUNT_READ_TBL; | |
| 844 | else if ((ppc->cap & PPCCAP_VEA) && spr == SPRVEA_TBL_R) | |
| 845 | desc->cycles = POWERPC_COUNT_READ_TBL; | |
| 846 | else if ((ppc->cap & PPCCAP_OEA) && spr == SPROEA_DEC) | |
| 847 | desc->cycles = POWERPC_COUNT_READ_DEC; | |
| 513 | 848 | return TRUE; |
| 514 | 849 | |
| 515 | 850 | case 0x053: /* MFMSR */ |
| 516 | desc | |
| 851 | GPR_MODIFIED(desc, | |
| 517 | 852 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION | OPFLAG_CAN_EXPOSE_EXTERNAL_INT; |
| 853 | if (is_601_class(ppc)) | |
| 854 | desc->cycles = 2; /* 601 */ | |
| 518 | 855 | return TRUE; |
| 519 | 856 | |
| 520 | 857 | case 0x253: /* MFSR */ |
| 858 | GPR_MODIFIED(desc, G_RD(op)); | |
| 859 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION; | |
| 860 | return TRUE; | |
| 861 | ||
| 521 | 862 | case 0x293: /* MFSRIN */ |
| 522 | desc->gpr.modified |= REGFLAG_R(G_RD(op)); | |
| 863 | GPR_USED(desc, G_RB(op)); | |
| 864 | GPR_MODIFIED(desc, G_RD(op)); | |
| 523 | 865 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 524 | 866 | return TRUE; |
| 525 | 867 | |
| 526 | 868 | case 0x173: /* MFTB */ |
| 527 | 869 | if (!(ppc->cap & PPCCAP_VEA)) |
| 528 | 870 | return FALSE; |
| 529 | desc->gpr.modified |= REGFLAG_R(G_RD(op)); | |
| 871 | GPR_MODIFIED(desc, G_RD(op)); | |
| 872 | spr = compute_spr(G_SPR(op)); | |
| 873 | if (spr == SPRVEA_TBL_R) | |
| 874 | desc->cycles = POWERPC_COUNT_READ_TBL; | |
| 530 | 875 | return TRUE; |
| 531 | 876 | |
| 532 | 877 | case 0x068: /* NEGx */ |
| 533 | desc->gpr.used |= REGFLAG_R(G_RA(op)); | |
| 534 | desc->gpr.modified |= REGFLAG_R(G_RD(op)); | |
| 878 | GPR_USED(desc, G_RA(op)); | |
| 879 | GPR_MODIFIED(desc, G_RD(op)); | |
| 535 | 880 | if (op & M_RC) |
| 536 | 881 | { |
| 537 | desc->gpr.used |= REGFLAG_XER; | |
| 538 | desc->gpr.modified |= REGFLAG_CR(0); | |
| 882 | XER_SO_USED(desc); | |
| 883 | CR_MODIFIED(desc, 0); | |
| 539 | 884 | } |
| 540 | 885 | return TRUE; |
| 541 | 886 | |
| 542 | 887 | case 0x268: /* NEGOx */ |
| 543 | desc->gpr.used |= REGFLAG_R(G_RA(op)); | |
| 544 | desc->gpr.modified |= REGFLAG_R(G_RD(op)) | REGFLAG_XER; | |
| 888 | GPR_USED(desc, G_RA(op)); | |
| 889 | GPR_MODIFIED(desc, G_RD(op)); | |
| 890 | XER_OV_MODIFIED(desc); | |
| 891 | XER_SO_MODIFIED(desc); | |
| 545 | 892 | if (op & M_RC) |
| 546 | { | |
| 547 | desc->gpr.used |= REGFLAG_XER; | |
| 548 | desc->gpr.modified |= REGFLAG_CR(0); | |
| 549 | } | |
| 893 | CR_MODIFIED(desc, 0); | |
| 550 | 894 | return TRUE; |
| 551 | 895 | |
| 552 | 896 | case 0x090: /* MTCRF */ |
| 553 | desc->gpr.used |= REGFLAG_R(G_RS(op)); | |
| 554 | if (G_CRM(op) & 0x01) desc->gpr.modified |= REGFLAG_CR(0); | |
| 555 | if (G_CRM(op) & 0x02) desc->gpr.modified |= REGFLAG_CR(1); | |
| 556 | if (G_CRM(op) & 0x04) desc->gpr.modified |= REGFLAG_CR(2); | |
| 557 | if (G_CRM(op) & 0x08) desc->gpr.modified |= REGFLAG_CR(3); | |
| 558 | if (G_CRM(op) & 0x10) desc->gpr.modified |= REGFLAG_CR(4); | |
| 559 | if (G_CRM(op) & 0x20) desc->gpr.modified |= REGFLAG_CR(5); | |
| 560 | if (G_CRM(op) & 0x40) desc->gpr.modified |= REGFLAG_CR(6); | |
| 561 | if (G_CRM(op) & 0x80) desc->gpr.modified |= REGFLAG_CR(7); | |
| 897 | GPR_USED(desc, G_RS(op)); | |
| 898 | if (G_CRM(op) & 0x80) CR_MODIFIED(desc, 0); | |
| 899 | if (G_CRM(op) & 0x40) CR_MODIFIED(desc, 1); | |
| 900 | if (G_CRM(op) & 0x20) CR_MODIFIED(desc, 2); | |
| 901 | if (G_CRM(op) & 0x10) CR_MODIFIED(desc, 3); | |
| 902 | if (G_CRM(op) & 0x08) CR_MODIFIED(desc, 4); | |
| 903 | if (G_CRM(op) & 0x04) CR_MODIFIED(desc, 5); | |
| 904 | if (G_CRM(op) & 0x02) CR_MODIFIED(desc, 6); | |
| 905 | if (G_CRM(op) & 0x01) CR_MODIFIED(desc, 7); | |
| 562 | 906 | return TRUE; |
| 563 | 907 | |
| 564 | 908 | case 0x092: /* MTMSR */ |
| 565 | desc | |
| 909 | GPR_USED(desc, | |
| 566 | 910 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION | OPFLAG_CAN_CHANGE_MODES | OPFLAG_END_SEQUENCE; |
| 911 | if (is_601_class(ppc)) | |
| 912 | desc->cycles = 17; /* 601 */ | |
| 913 | else if (is_603_class(ppc)) | |
| 914 | desc->cycles = 2; /* 603 */ | |
| 567 | 915 | return TRUE; |
| 568 | 916 | |
| 569 | 917 | case 0x0d2: /* MTSR */ |
| 570 | 918 | if (!(ppc->cap & PPCCAP_OEA)) |
| 571 | 919 | return FALSE; |
| 572 | desc | |
| 920 | GPR_USED(desc, | |
| 573 | 921 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 574 | 922 | return TRUE; |
| 575 | 923 | |
| 576 | 924 | case 0x1d3: /* MTSPR */ |
| 577 | desc->gpr.used |= REGFLAG_R(G_RS(op)); | |
| 578 | if (G_SPR(op) & 0x200) | |
| 925 | GPR_USED(desc, G_RS(op)); | |
| 926 | spr = compute_spr(G_SPR(op)); | |
| 927 | if (spr == SPR_LR) | |
| 928 | LR_MODIFIED(desc); | |
| 929 | if (spr == SPR_CTR) | |
| 930 | CTR_MODIFIED(desc); | |
| 931 | if (spr == SPR_XER) | |
| 932 | { | |
| 933 | XER_COUNT_MODIFIED(desc); | |
| 934 | XER_CA_MODIFIED(desc); | |
| 935 | XER_OV_MODIFIED(desc); | |
| 936 | XER_SO_MODIFIED(desc); | |
| 937 | } | |
| 938 | if (spr & 0x010) | |
| 579 | 939 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 580 | 940 | return TRUE; |
| 581 | 941 | |
| r2844 | r2845 | |
| 588 | 948 | case 0x197: /* STHX */ |
| 589 | 949 | case 0x296: /* STWBRX */ |
| 590 | 950 | case 0x396: /* STHBRX */ |
| 591 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)) | REGFLAG_R(G_RS(op)); | |
| 951 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 952 | GPR_USED(desc, G_RB(op)); | |
| 953 | GPR_USED(desc, G_RS(op)); | |
| 592 | 954 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 593 | 955 | return TRUE; |
| 594 | 956 | |
| 595 | 957 | case 0x0b7: /* STWUX */ |
| 596 | 958 | case 0x0f7: /* STBUX */ |
| 597 | 959 | case 0x1b7: /* STHUX */ |
| 598 | desc->gpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)) | REGFLAG_R(G_RS(op)); | |
| 599 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 960 | if (G_RA(op) == 0) | |
| 961 | return FALSE; | |
| 962 | GPR_USED(desc, G_RA(op)); | |
| 963 | GPR_USED(desc, G_RB(op)); | |
| 964 | GPR_USED(desc, G_RS(op)); | |
| 965 | GPR_MODIFIED(desc, G_RA(op)); | |
| 600 | 966 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 601 | 967 | return TRUE; |
| 602 | 968 | |
| 603 | 969 | case 0x0f2: /* MTSRIN */ |
| 604 | 970 | if (!(ppc->cap & PPCCAP_OEA)) |
| 605 | 971 | return FALSE; |
| 606 | desc->gpr.used |= REGFLAG_R(G_RS(op)) | REGFLAG_R(G_RB(op)); | |
| 972 | GPR_USED(desc, G_RS(op)); | |
| 973 | GPR_USED(desc, G_RB(op)); | |
| 607 | 974 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 608 | 975 | return TRUE; |
| 609 | 976 | |
| 610 | 977 | case 0x132: /* TLBIE */ |
| 611 | 978 | if (!(ppc->cap & PPCCAP_OEA)) |
| 612 | 979 | return FALSE; |
| 613 | desc | |
| 980 | GPR_USED(desc, | |
| 614 | 981 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 615 | 982 | return TRUE; |
| 616 | 983 | |
| r2844 | r2845 | |
| 628 | 995 | return TRUE; |
| 629 | 996 | |
| 630 | 997 | case 0x200: /* MCRXR */ |
| 631 | desc->gpr.used |= REGFLAG_XER; | |
| 632 | desc->gpr.modified |= REGFLAG_CR(G_CRFD(op)); | |
| 998 | XER_CA_USED(desc); | |
| 999 | XER_OV_USED(desc); | |
| 1000 | XER_SO_USED(desc); | |
| 1001 | CR_MODIFIED(desc, G_CRFD(op)); | |
| 1002 | XER_CA_MODIFIED(desc); | |
| 1003 | XER_OV_MODIFIED(desc); | |
| 1004 | XER_SO_MODIFIED(desc); | |
| 633 | 1005 | return TRUE; |
| 634 | 1006 | |
| 635 | 1007 | case 0x215: /* LSWX */ |
| 636 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)) | REGFLAG_XER; | |
| 637 | desc->gpr.modified |= ((REGFLAG_R(31) << 1) - 1) & ~(REGFLAG_R(0) - 1); | |
| 1008 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 1009 | GPR_USED(desc, G_RB(op)); | |
| 1010 | XER_COUNT_USED(desc); | |
| 1011 | for (regnum = 0; regnum < 32; regnum++) | |
| 1012 | GPR_MODIFIED(desc, regnum); | |
| 638 | 1013 | desc->flags |= OPFLAG_READS_MEMORY; |
| 639 | 1014 | return TRUE; |
| 640 | 1015 | |
| r2844 | r2845 | |
| 642 | 1017 | case 0x257: /* LFDX */ |
| 643 | 1018 | if (!(ppc->cap & PPCCAP_FPU)) |
| 644 | 1019 | return FALSE; |
| 645 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 646 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 1020 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 1021 | GPR_USED(desc, G_RB(op)); | |
| 1022 | FPR_MODIFIED(desc, G_RD(op)); | |
| 647 | 1023 | desc->flags |= OPFLAG_READS_MEMORY; |
| 648 | 1024 | return TRUE; |
| 649 | 1025 | |
| r2844 | r2845 | |
| 665 | 1041 | case 0x277: /* LFDUX */ |
| 666 | 1042 | if (!(ppc->cap & PPCCAP_FPU)) |
| 667 | 1043 | return FALSE; |
| 668 | desc->gpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 669 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 670 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 1044 | if (G_RA(op) == 0) | |
| 1045 | return FALSE; | |
| 1046 | GPR_USED(desc, G_RA(op)); | |
| 1047 | GPR_USED(desc, G_RB(op)); | |
| 1048 | GPR_MODIFIED(desc, G_RA(op)); | |
| 1049 | FPR_MODIFIED(desc, G_RD(op)); | |
| 671 | 1050 | desc->flags |= OPFLAG_READS_MEMORY; |
| 672 | 1051 | return TRUE; |
| 673 | 1052 | |
| 674 | 1053 | case 0x255: /* LSWI */ |
| 675 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 676 | desc->gpr.modified |= ((REGFLAG_R(31) << 1) - 1) & ~(REGFLAG_R(0) - 1); | |
| 1054 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 1055 | for (regnum = 0; regnum < ((G_NB(op) - 1) & 0x1f) + 1; regnum += 4) | |
| 1056 | GPR_MODIFIED(desc, (G_RD(op) + regnum / 4) % 32); | |
| 677 | 1057 | desc->flags |= OPFLAG_READS_MEMORY; |
| 1058 | desc->cycles = (((G_NB(op) - 1) & 0x1f) + 1 + 3) / 4; | |
| 678 | 1059 | return TRUE; |
| 679 | 1060 | |
| 680 | 1061 | case 0x295: /* STSWX */ |
| 1062 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 1063 | GPR_USED(desc, G_RB(op)); | |
| 1064 | XER_COUNT_USED(desc); | |
| 1065 | for (regnum = 0; regnum < 32; regnum++) | |
| 1066 | GPR_USED(desc, regnum); | |
| 1067 | desc->flags |= OPFLAG_WRITES_MEMORY; | |
| 1068 | return TRUE; | |
| 1069 | ||
| 681 | 1070 | case 0x2d5: /* STSWI */ |
| 682 | desc->gpr.used |= (((REGFLAG_R(31) << 1) - 1) & ~(REGFLAG_R(0) - 1)) | REGFLAG_XER; | |
| 1071 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 1072 | for (regnum = 0; regnum < ((G_NB(op) - 1) & 0x1f) + 1; regnum += 4) | |
| 1073 | GPR_USED(desc, (G_RD(op) + regnum / 4) % 32); | |
| 683 | 1074 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 1075 | desc->cycles = (((G_NB(op) - 1) & 0x1f) + 1 + 3) / 4; | |
| 684 | 1076 | return TRUE; |
| 685 | 1077 | |
| 686 | 1078 | case 0x297: /* STFSX */ |
| r2844 | r2845 | |
| 688 | 1080 | case 0x3d7: /* STFIWX */ |
| 689 | 1081 | if (!(ppc->cap & PPCCAP_FPU)) |
| 690 | 1082 | return FALSE; |
| 691 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 692 | desc->fpr.used |= REGFLAG_R(G_RS(op)); | |
| 1083 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 1084 | GPR_USED(desc, G_RB(op)); | |
| 1085 | FPR_USED(desc, G_RS(op)); | |
| 693 | 1086 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 694 | 1087 | return TRUE; |
| 695 | 1088 | |
| r2844 | r2845 | |
| 697 | 1090 | case 0x2f7: /* STFDUX */ |
| 698 | 1091 | if (!(ppc->cap & PPCCAP_FPU)) |
| 699 | 1092 | return FALSE; |
| 700 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 701 | desc->gpr.modified |= REGFLAG_RZ(G_RA(op)); | |
| 702 | desc->fpr.used |= REGFLAG_R(G_RS(op)); | |
| 1093 | if (G_RA(op) == 0) | |
| 1094 | return FALSE; | |
| 1095 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 1096 | GPR_USED(desc, G_RB(op)); | |
| 1097 | GPR_MODIFIED(desc, G_RA(op)); | |
| 1098 | FPR_USED(desc, G_RS(op)); | |
| 703 | 1099 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 704 | 1100 | return TRUE; |
| 705 | 1101 | |
| 706 | 1102 | case 0x338: /* SRAWIx */ |
| 707 | desc->gpr.used |= REGFLAG_RZ(G_RS(op)); | |
| 708 | desc->gpr.modified |= REGFLAG_R(G_RA(op)); | |
| 1103 | GPR_USED(desc, G_RS(op)); | |
| 1104 | GPR_MODIFIED(desc, G_RA(op)); | |
| 1105 | XER_CA_MODIFIED(desc); | |
| 1106 | if (op & M_RC) | |
| 1107 | { | |
| 1108 | XER_SO_USED(desc); | |
| 1109 | CR_MODIFIED(desc, 0); | |
| 1110 | } | |
| 709 | 1111 | return TRUE; |
| 710 | 1112 | |
| 711 | 1113 | case 0x3f6: /* DCBZ */ |
| 712 | 1114 | if (!(ppc->cap & (PPCCAP_VEA | PPCCAP_4XX))) |
| 713 | 1115 | return FALSE; |
| 714 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 1116 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 1117 | GPR_USED(desc, G_RB(op)); | |
| 715 | 1118 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 716 | 1119 | return TRUE; |
| 717 | 1120 | |
| r2844 | r2845 | |
| 720 | 1123 | case 0x3c6: /* ICCCI */ |
| 721 | 1124 | if (!(ppc->cap & PPCCAP_4XX)) |
| 722 | 1125 | return FALSE; |
| 723 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 1126 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 1127 | GPR_USED(desc, G_RB(op)); | |
| 724 | 1128 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 725 | 1129 | return TRUE; |
| 726 | 1130 | |
| r2844 | r2845 | |
| 728 | 1132 | case 0x3e6: /* ICREAD */ |
| 729 | 1133 | if (!(ppc->cap & PPCCAP_4XX)) |
| 730 | 1134 | return FALSE; |
| 731 | desc->gpr.used |= REGFLAG_RZ(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 732 | desc->gpr.modified |= REGFLAG_R(G_RT(op)); | |
| 1135 | GPR_USED_OR_ZERO(desc, G_RA(op)); | |
| 1136 | GPR_USED(desc, G_RB(op)); | |
| 1137 | GPR_MODIFIED(desc, G_RT(op)); | |
| 733 | 1138 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 734 | 1139 | return TRUE; |
| 735 | 1140 | |
| 736 | 1141 | case 0x143: /* MFDCR */ |
| 737 | 1142 | if (!(ppc->cap & PPCCAP_4XX)) |
| 738 | 1143 | return FALSE; |
| 739 | desc | |
| 1144 | GPR_MODIFIED(desc, | |
| 740 | 1145 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 741 | 1146 | return TRUE; |
| 742 | 1147 | |
| 743 | 1148 | case 0x1c3: /* MTDCR */ |
| 744 | 1149 | if (!(ppc->cap & PPCCAP_4XX)) |
| 745 | 1150 | return FALSE; |
| 746 | desc | |
| 1151 | GPR_USED(desc, | |
| 747 | 1152 | desc->flags |= OPFLAG_PRIVILEGED | OPFLAG_CAN_CAUSE_EXCEPTION | OPFLAG_CAN_EXPOSE_EXTERNAL_INT; |
| 748 | 1153 | return TRUE; |
| 749 | 1154 | |
| 750 | 1155 | case 0x083: /* WRTEE */ |
| 751 | 1156 | if (!(ppc->cap & PPCCAP_4XX)) |
| 752 | 1157 | return FALSE; |
| 753 | desc | |
| 1158 | GPR_USED(desc, | |
| 754 | 1159 | desc->flags |= OPFLAG_CAN_EXPOSE_EXTERNAL_INT; |
| 755 | 1160 | return TRUE; |
| 756 | 1161 | |
| r2844 | r2845 | |
| 782 | 1187 | switch (opswitch) |
| 783 | 1188 | { |
| 784 | 1189 | case 0x12: /* FDIVSx */ |
| 1190 | FPR_USED(desc, G_RA(op)); | |
| 1191 | FPR_USED(desc, G_RB(op)); | |
| 1192 | FPR_MODIFIED(desc, G_RD(op)); | |
| 1193 | if (op & M_RC) | |
| 1194 | CR_MODIFIED(desc, 1); | |
| 1195 | if (is_601_class(ppc)) | |
| 1196 | desc->cycles = 17; /* 601 */ | |
| 1197 | else if (is_603_class(ppc)) | |
| 1198 | desc->cycles = 18; /* 603 */ | |
| 1199 | else | |
| 1200 | desc->cycles = 17; /* ??? */ | |
| 1201 | return TRUE; | |
| 1202 | ||
| 785 | 1203 | case 0x14: /* FSUBSx */ |
| 786 | 1204 | case 0x15: /* FADDSx */ |
| 787 | 1205 | case 0x19: /* FMULSx */ |
| 788 | desc->fpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 789 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 1206 | FPR_USED(desc, G_RA(op)); | |
| 1207 | FPR_USED(desc, G_RB(op)); | |
| 1208 | FPR_MODIFIED(desc, G_RD(op)); | |
| 790 | 1209 | if (op & M_RC) |
| 791 | { | |
| 792 | desc->gpr.used |= REGFLAG_XER; | |
| 793 | desc->gpr.modified |= REGFLAG_CR(1); | |
| 794 | } | |
| 1210 | CR_MODIFIED(desc, 1); | |
| 795 | 1211 | return TRUE; |
| 796 | 1212 | |
| 797 | 1213 | case 0x16: /* FSQRTSx */ |
| 798 | 1214 | case 0x18: /* FRESx */ |
| 799 | desc->fpr.used |= REGFLAG_R(G_RB(op)); | |
| 800 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 1215 | FPR_USED(desc, G_RB(op)); | |
| 1216 | FPR_MODIFIED(desc, G_RD(op)); | |
| 801 | 1217 | if (op & M_RC) |
| 802 | { | |
| 803 | desc->gpr.used |= REGFLAG_XER; | |
| 804 | desc->gpr.modified |= REGFLAG_CR(1); | |
| 805 | } | |
| 1218 | CR_MODIFIED(desc, 1); | |
| 806 | 1219 | return TRUE; |
| 807 | 1220 | |
| 808 | 1221 | case 0x1c: /* FMSUBSx */ |
| 809 | 1222 | case 0x1d: /* FMADDSx */ |
| 810 | 1223 | case 0x1e: /* FNMSUBSx */ |
| 811 | 1224 | case 0x1f: /* FNMADDSx */ |
| 812 | desc->fpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)) | REGFLAG_R(G_REGC(op)); | |
| 813 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 1225 | FPR_USED(desc, G_RA(op)); | |
| 1226 | FPR_USED(desc, G_RB(op)); | |
| 1227 | FPR_USED(desc, G_REGC(op)); | |
| 1228 | FPR_MODIFIED(desc, G_RD(op)); | |
| 814 | 1229 | if (op & M_RC) |
| 815 | { | |
| 816 | desc->gpr.used |= REGFLAG_XER; | |
| 817 | desc->gpr.modified |= REGFLAG_CR(1); | |
| 818 | } | |
| 1230 | CR_MODIFIED(desc, 1); | |
| 819 | 1231 | return TRUE; |
| 820 | 1232 | } |
| 821 | 1233 | |
| r2844 | r2845 | |
| 842 | 1254 | switch (opswitch) |
| 843 | 1255 | { |
| 844 | 1256 | case 0x12: /* FDIVx */ |
| 1257 | FPR_USED(desc, G_RA(op)); | |
| 1258 | FPR_USED(desc, G_RB(op)); | |
| 1259 | FPR_MODIFIED(desc, G_RD(op)); | |
| 1260 | if (op & M_RC) | |
| 1261 | CR_MODIFIED(desc, 1); | |
| 1262 | if (is_601_class(ppc)) | |
| 1263 | desc->cycles = 31; /* 601 */ | |
| 1264 | else if (is_603_class(ppc)) | |
| 1265 | desc->cycles = 33; /* 603 */ | |
| 1266 | else | |
| 1267 | desc->cycles = 31; /* ??? */ | |
| 1268 | return TRUE; | |
| 1269 | ||
| 1270 | case 0x19: /* FMULx */ | |
| 1271 | FPR_USED(desc, G_RA(op)); | |
| 1272 | FPR_USED(desc, G_RB(op)); | |
| 1273 | FPR_MODIFIED(desc, G_RD(op)); | |
| 1274 | if (op & M_RC) | |
| 1275 | CR_MODIFIED(desc, 1); | |
| 1276 | desc->cycles = 2; /* 601/603 */ | |
| 1277 | return TRUE; | |
| 1278 | ||
| 845 | 1279 | case 0x14: /* FSUBx */ |
| 846 | 1280 | case 0x15: /* FADDx */ |
| 847 | case 0x19: /* FMULx */ | |
| 848 | desc->fpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 849 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 1281 | FPR_USED(desc, G_RA(op)); | |
| 1282 | FPR_USED(desc, G_RB(op)); | |
| 1283 | FPR_MODIFIED(desc, G_RD(op)); | |
| 850 | 1284 | if (op & M_RC) |
| 851 | { | |
| 852 | desc->gpr.used |= REGFLAG_XER; | |
| 853 | desc->gpr.modified |= REGFLAG_CR(1); | |
| 854 | } | |
| 1285 | CR_MODIFIED(desc, 1); | |
| 855 | 1286 | return TRUE; |
| 856 | 1287 | |
| 857 | 1288 | case 0x16: /* FSQRTx */ |
| 858 | 1289 | case 0x1a: /* FSQRTEx */ |
| 859 | desc->fpr.used |= REGFLAG_R(G_RB(op)); | |
| 860 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 1290 | FPR_USED(desc, G_RB(op)); | |
| 1291 | FPR_MODIFIED(desc, G_RD(op)); | |
| 861 | 1292 | if (op & M_RC) |
| 862 | { | |
| 863 | desc->gpr.used |= REGFLAG_XER; | |
| 864 | desc->gpr.modified |= REGFLAG_CR(1); | |
| 865 | } | |
| 1293 | CR_MODIFIED(desc, 1); | |
| 866 | 1294 | return TRUE; |
| 867 | 1295 | |
| 868 | 1296 | case 0x17: /* FSELx */ |
| r2844 | r2845 | |
| 870 | 1298 | case 0x1d: /* FMADDx */ |
| 871 | 1299 | case 0x1e: /* FNMSUBx */ |
| 872 | 1300 | case 0x1f: /* FNMADDx */ |
| 873 | desc->fpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)) | REGFLAG_R(G_REGC(op)); | |
| 874 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 1301 | FPR_USED(desc, G_RA(op)); | |
| 1302 | FPR_USED(desc, G_RB(op)); | |
| 1303 | FPR_USED(desc, G_REGC(op)); | |
| 1304 | FPR_MODIFIED(desc, G_RD(op)); | |
| 875 | 1305 | if (op & M_RC) |
| 876 | { | |
| 877 | desc->gpr.used |= REGFLAG_XER; | |
| 878 | desc->gpr.modified |= REGFLAG_CR(1); | |
| 879 | } | |
| 1306 | CR_MODIFIED(desc, 1); | |
| 1307 | desc->cycles = 2; /* 601/603 */ | |
| 880 | 1308 | return TRUE; |
| 881 | 1309 | } |
| 882 | 1310 | } |
| r2844 | r2845 | |
| 891 | 1319 | |
| 892 | 1320 | case 0x000: /* FCMPU */ |
| 893 | 1321 | case 0x020: /* FCMPO */ |
| 894 | desc->gpr.used |= REGFLAG_XER; | |
| 895 | desc->fpr.used |= REGFLAG_R(G_RA(op)) | REGFLAG_R(G_RB(op)); | |
| 896 | desc->gpr.modified |= REGFLAG_CR(G_CRFD(op)); | |
| 1322 | FPR_USED(desc, G_RA(op)); | |
| 1323 | FPR_USED(desc, G_RB(op)); | |
| 1324 | CR_MODIFIED(desc, G_CRFD(op)); | |
| 897 | 1325 | return TRUE; |
| 898 | 1326 | |
| 899 | 1327 | case 0x00c: /* FRSPx */ |
| r2844 | r2845 | |
| 903 | 1331 | case 0x048: /* FMRx */ |
| 904 | 1332 | case 0x088: /* FNABSx */ |
| 905 | 1333 | case 0x108: /* FABSx */ |
| 906 | desc->fpr.used |= REGFLAG_R(G_RB(op)); | |
| 907 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 1334 | FPR_USED(desc, G_RB(op)); | |
| 1335 | FPR_MODIFIED(desc, G_RD(op)); | |
| 908 | 1336 | if (op & M_RC) |
| 909 | { | |
| 910 | desc->gpr.used |= REGFLAG_XER; | |
| 911 | desc->gpr.modified |= REGFLAG_CR(1); | |
| 912 | } | |
| 1337 | CR_MODIFIED(desc, 1); | |
| 913 | 1338 | return TRUE; |
| 914 | 1339 | |
| 915 | 1340 | case 0x026: /* MTFSB1x */ |
| 916 | 1341 | case 0x046: /* MTFSB0x */ |
| 917 | desc | |
| 1342 | FPSCR_MODIFIED(desc, | |
| 918 | 1343 | return TRUE; |
| 919 | 1344 | |
| 920 | 1345 | case 0x040: /* MCRFS */ |
| 921 | desc->fpr.used |= REGFLAG_FPSCR; | |
| 922 | desc->gpr.modified |= REGFLAG_CR(G_CRFD(op)); | |
| 1346 | FPSCR_USED(desc, G_CRFS(op)); | |
| 1347 | CR_MODIFIED(desc, G_CRFD(op)); | |
| 923 | 1348 | return TRUE; |
| 924 | 1349 | |
| 925 | 1350 | case 0x086: /* MTFSFIx */ |
| 926 | desc | |
| 1351 | FPSCR_MODIFIED(desc, | |
| 927 | 1352 | return TRUE; |
| 928 | 1353 | |
| 929 | 1354 | case 0x247: /* MFFSx */ |
| 930 | desc->fpr.used |= REGFLAG_FPSCR; | |
| 931 | desc->fpr.modified |= REGFLAG_R(G_RD(op)); | |
| 1355 | FPSCR_USED(desc, 0); | |
| 1356 | FPSCR_USED(desc, 1); | |
| 1357 | FPSCR_USED(desc, 2); | |
| 1358 | FPSCR_USED(desc, 3); | |
| 1359 | FPSCR_USED(desc, 4); | |
| 1360 | FPSCR_USED(desc, 5); | |
| 1361 | FPSCR_USED(desc, 6); | |
| 1362 | FPSCR_USED(desc, 7); | |
| 1363 | FPR_MODIFIED(desc, G_RD(op)); | |
| 932 | 1364 | return TRUE; |
| 933 | 1365 | |
| 934 | 1366 | case 0x2c7: /* MTFSFx */ |
| 935 | desc->fpr.used |= REGFLAG_R(G_RB(op)); | |
| 936 | desc->fpr.modified |= REGFLAG_FPSCR; | |
| 1367 | FPR_USED(desc, G_RB(op)); | |
| 1368 | if (G_CRM(op) & 0x80) FPSCR_MODIFIED(desc, 0); | |
| 1369 | if (G_CRM(op) & 0x40) FPSCR_MODIFIED(desc, 1); | |
| 1370 | if (G_CRM(op) & 0x20) FPSCR_MODIFIED(desc, 2); | |
| 1371 | if (G_CRM(op) & 0x10) FPSCR_MODIFIED(desc, 3); | |
| 1372 | if (G_CRM(op) & 0x08) FPSCR_MODIFIED(desc, 4); | |
| 1373 | if (G_CRM(op) & 0x04) FPSCR_MODIFIED(desc, 5); | |
| 1374 | if (G_CRM(op) & 0x02) FPSCR_MODIFIED(desc, 6); | |
| 1375 | if (G_CRM(op) & 0x01) FPSCR_MODIFIED(desc, 7); | |
| 937 | 1376 | return TRUE; |
| 938 | 1377 | } |
| 939 | 1378 | } |
| r2844 | r2845 | |
|---|---|---|
| 2049 | 2049 | R_TL0 = count & 0xff; |
| 2050 | 2050 | |
| 2051 | 2051 | //Split Timer 2 |
| 2052 | if(GET_TR1) { | |
| 2053 | overflow = 0xff; | |
| 2054 | count = R_TH0; | |
| 2055 | //Check for overflow | |
| 2056 | if(count+(cyc/12)>overflow) { | |
| 2057 | count = overflow-count; | |
| 2058 | SET_TF1(1); | |
| 2059 | } | |
| 2060 | else | |
| 2061 | count+=(cyc/12); | |
| 2062 | //Update new values of the counter | |
| 2063 | R_TH0 = count & 0xff; | |
| 2052 | overflow = 0xff; | |
| 2053 | count = R_TH0; | |
| 2054 | //Check for overflow | |
| 2055 | if(count+(cyc/12)>overflow) { | |
| 2056 | count = overflow-count; | |
| 2057 | SET_TF1(1); | |
| 2064 | 2058 | } |
| 2059 | else | |
| 2060 | count+=(cyc/12); | |
| 2061 | //Update new values of the counter | |
| 2062 | R_TH0 = count & 0xff; | |
| 2065 | 2063 | break; |
| 2066 | 2064 | } |
| 2067 | 2065 | } |
| r2844 | r2845 | |
|---|---|---|
| 46 | 46 | #define IF_LE DRCUML_COND_LE |
| 47 | 47 | #define IF_ALWAYS DRCUML_COND_ALWAYS |
| 48 | 48 | |
| 49 | /* shorthand for flags */ | |
| 50 | #define FLAGS_ALLI (DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S) | |
| 51 | #define FLAGS_ALLF (DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_U) | |
| 52 | #define FLAGS_NONE (0) | |
| 53 | 49 | |
| 54 | /* flags needed for condition codes */ | |
| 55 | #define FLAGS_Z (DRCUML_FLAG_Z) | |
| 56 | #define FLAGS_NZ (DRCUML_FLAG_Z) | |
| 57 | #define FLAGS_E (DRCUML_FLAG_Z) | |
| 58 | #define FLAGS_NE (DRCUML_FLAG_Z) | |
| 59 | #define FLAGS_S (DRCUML_FLAG_S) | |
| 60 | #define FLAGS_NS (DRCUML_FLAG_S) | |
| 61 | #define FLAGS_C (DRCUML_FLAG_C) | |
| 62 | #define FLAGS_NC (DRCUML_FLAG_C) | |
| 63 | #define FLAGS_V (DRCUML_FLAG_V) | |
| 64 | #define FLAGS_NV (DRCUML_FLAG_V) | |
| 65 | #define FLAGS_U (DRCUML_FLAG_U) | |
| 66 | #define FLAGS_NU (DRCUML_FLAG_U) | |
| 67 | #define FLAGS_A (DRCUML_FLAG_C | DRCUML_FLAG_Z) | |
| 68 | #define FLAGS_BE (DRCUML_FLAG_C | DRCUML_FLAG_Z) | |
| 69 | #define FLAGS_B (DRCUML_FLAG_C) | |
| 70 | #define FLAGS_AE (DRCUML_FLAG_C) | |
| 71 | #define FLAGS_G (DRCUML_FLAG_S | DRCUML_FLAG_V | DRCUML_FLAG_Z) | |
| 72 | #define FLAGS_LE (DRCUML_FLAG_S | DRCUML_FLAG_V | DRCUML_FLAG_Z) | |
| 73 | #define FLAGS_L (DRCUML_FLAG_S | DRCUML_FLAG_V) | |
| 74 | #define FLAGS_GE (DRCUML_FLAG_S | DRCUML_FLAG_V) | |
| 75 | 50 | |
| 76 | ||
| 77 | ||
| 78 | 51 | /*************************************************************************** |
| 79 | 52 | MACROS |
| 80 | 53 | ***************************************************************************/ |
| r2844 | r2845 | |
| 103 | 76 | |
| 104 | 77 | |
| 105 | 78 | /* ----- Control Flow Operations ----- */ |
| 79 | #define UML_NOP(block) do { drcuml_block_append_0(block, DRCUML_OP_NOP, 4, IF_ALWAYS); } while (0) | |
| 106 | 80 | #define UML_DEBUG(block, pc) do { drcuml_block_append_1(block, DRCUML_OP_DEBUG, 4, IF_ALWAYS, pc); } while (0) |
| 107 | ||
| 108 | 81 | #define UML_EXIT(block, param) do { drcuml_block_append_1(block, DRCUML_OP_EXIT, 4, IF_ALWAYS, param); } while (0) |
| 109 | 82 | #define UML_EXITc(block, cond, param) do { drcuml_block_append_1(block, DRCUML_OP_EXIT, 4, cond, param); } while (0) |
| 110 | ||
| 111 | 83 | #define UML_HASHJMP(block, mode, pc, handle) do { drcuml_block_append_3(block, DRCUML_OP_HASHJMP, 4, IF_ALWAYS, mode, pc, MEM(handle)); } while (0) |
| 112 | ||
| 113 | 84 | #define UML_JMP(block, label) do { drcuml_block_append_1(block, DRCUML_OP_JMP, 4, IF_ALWAYS, IMM(label)); } while (0) |
| 114 | 85 | #define UML_JMPc(block, cond, label) do { drcuml_block_append_1(block, DRCUML_OP_JMP, 4, cond, IMM(label)); } while (0) |
| 115 | ||
| 116 | 86 | #define UML_JMPH(block, handle) do { drcuml_block_append_1(block, DRCUML_OP_JMPH, 4, IF_ALWAYS, MEM(handle)); } while (0) |
| 117 | 87 | #define UML_JMPHc(block, cond, handle) do { drcuml_block_append_1(block, DRCUML_OP_JMPH, 4, cond, MEM(handle)); } while (0) |
| 118 | 88 | #define UML_EXH(block, handle, param) do { drcuml_block_append_2(block, DRCUML_OP_EXH, 4, IF_ALWAYS, MEM(handle), param); } while (0) |
| r2844 | r2845 | |
| 121 | 91 | #define UML_CALLHc(block, cond, handle) do { drcuml_block_append_1(block, DRCUML_OP_CALLH, 4, cond, MEM(handle)); } while (0) |
| 122 | 92 | #define UML_RET(block) do { drcuml_block_append_0(block, DRCUML_OP_RET, 4, IF_ALWAYS); } while (0) |
| 123 | 93 | #define UML_RETc(block, cond) do { drcuml_block_append_0(block, DRCUML_OP_RET, 4, cond); } while (0) |
| 124 | ||
| 125 | 94 | #define UML_CALLC(block, func, ptr) do { drcuml_block_append_2(block, DRCUML_OP_CALLC, 4, IF_ALWAYS, MEM(func), MEM(ptr)); } while (0) |
| 126 | 95 | #define UML_CALLCc(block, cond, func, ptr) do { drcuml_block_append_2(block, DRCUML_OP_CALLC, 4, cond, MEM(func), MEM(ptr)); } while (0) |
| 127 | ||
| 128 | 96 | #define UML_RECOVER(block, dst, mapvar) do { drcuml_block_append_2(block, DRCUML_OP_RECOVER, 4, IF_ALWAYS, dst, mapvar); } while (0) |
| 129 | 97 | |
| 130 | 98 | |
| r2844 | r2845 | |
| 132 | 100 | #define UML_SETFMOD(block, mode) do { drcuml_block_append_1(block, DRCUML_OP_SETFMOD, 4, IF_ALWAYS, mode); } while (0) |
| 133 | 101 | #define UML_GETFMOD(block, dst) do { drcuml_block_append_1(block, DRCUML_OP_GETFMOD, 4, IF_ALWAYS, dst); } while (0) |
| 134 | 102 | #define UML_GETEXP(block, dst) do { drcuml_block_append_1(block, DRCUML_OP_GETEXP, 4, IF_ALWAYS, dst); } while (0) |
| 135 | #define UML_GETFLGS(block, dst, flags) do { drcuml_block_append_ | |
| 103 | #define UML_GETFLGS(block, dst, flags) do { drcuml_block_append_2(block, DRCUML_OP_GETFLGS, 4, IF_ALWAYS, | |
| 136 | 104 | #define UML_SAVE(block, dst) do { drcuml_block_append_1(block, DRCUML_OP_SAVE, 4, IF_ALWAYS, MEM(dst)); } while (0) |
| 137 | 105 | #define UML_RESTORE(block, src) do { drcuml_block_append_1(block, DRCUML_OP_RESTORE, 4, IF_ALWAYS, MEM(src)); } while (0) |
| 138 | 106 | |
| r2844 | r2845 | |
| 145 | 113 | #define UML_READM(block, dst, src1, mask, spsize) do { drcuml_block_append_4(block, DRCUML_OP_READM, 4, IF_ALWAYS, dst, src1, mask, IMM(DRCUML_SPSIZE_##spsize)); } while (0) |
| 146 | 114 | #define UML_WRITE(block, dst, src1, spsize) do { drcuml_block_append_3(block, DRCUML_OP_WRITE, 4, IF_ALWAYS, dst, src1, IMM(DRCUML_SPSIZE_##spsize)); } while (0) |
| 147 | 115 | #define UML_WRITEM(block, dst, src1, mask, spsize) do { drcuml_block_append_4(block, DRCUML_OP_WRITEM, 4, IF_ALWAYS, dst, src1, mask, IMM(DRCUML_SPSIZE_##spsize)); } while (0) |
| 148 | ||
| 149 | 116 | #define UML_CARRY(block, src, bitnum) do { drcuml_block_append_2(block, DRCUML_OP_CARRY, 4, IF_ALWAYS, src, bitnum); } while (0) |
| 150 | 117 | #define UML_SETc(block, cond, dst) do { drcuml_block_append_1(block, DRCUML_OP_SET, 4, cond, dst); } while (0) |
| 151 | ||
| 152 | 118 | #define UML_MOV(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_MOV, 4, IF_ALWAYS, dst, src1); } while (0) |
| 153 | 119 | #define UML_MOVc(block, cond, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_MOV, 4, cond, dst, src1); } while (0) |
| 154 | 120 | #define UML_SEXT(block, dst, src1, size) do { drcuml_block_append_3(block, DRCUML_OP_SEXT, 4, IF_ALWAYS, dst, src1, IMM(DRCUML_SIZE_##size)); } while (0) |
| 155 | ||
| 156 | 121 | #define UML_ROLAND(block, dst, src, shift, mask) do { drcuml_block_append_4(block, DRCUML_OP_ROLAND, 4, IF_ALWAYS, dst, src, shift, mask); } while (0) |
| 157 | 122 | #define UML_ROLINS(block, dst, src, shift, mask) do { drcuml_block_append_4(block, DRCUML_OP_ROLINS, 4, IF_ALWAYS, dst, src, shift, mask); } while (0) |
| 123 | #define UML_ADD(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_ADD, 4, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 124 | #define UML_ADDC(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_ADDC, 4, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 125 | #define UML_SUB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_SUB, 4, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 126 | #define UML_SUBB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_SUBB, 4, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 127 | #define UML_CMP(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_CMP, 4, IF_ALWAYS, src1, src2); } while (0) | |
| 128 | #define UML_MULU(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_MULU, 4, IF_ALWAYS, dst, edst, src1, src2); } while (0) | |
| 129 | #define UML_MULS(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_MULS, 4, IF_ALWAYS, dst, edst, src1, src2); } while (0) | |
| 130 | #define UML_DIVU(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_DIVU, 4, IF_ALWAYS, dst, edst, src1, src2); } while (0) | |
| 131 | #define UML_DIVS(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_DIVS, 4, IF_ALWAYS, dst, edst, src1, src2); } while (0) | |
| 132 | #define UML_AND(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_AND, 4, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 133 | #define UML_TEST(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_TEST, 4, IF_ALWAYS, src1, src2); } while (0) | |
| 134 | #define UML_OR(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_OR, 4, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 135 | #define UML_XOR(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_XOR, 4, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 136 | #define UML_LZCNT(block, dst, src) do { drcuml_block_append_2(block, DRCUML_OP_LZCNT, 4, IF_ALWAYS, dst, src); } while (0) | |
| 137 | #define UML_BSWAP(block, dst, src) do { drcuml_block_append_2(block, DRCUML_OP_BSWAP, 4, IF_ALWAYS, dst, src); } while (0) | |
| 138 | #define UML_SHL(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SHL, 4, IF_ALWAYS, dst, src, count); } while (0) | |
| 139 | #define UML_SHR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SHR, 4, IF_ALWAYS, dst, src, count); } while (0) | |
| 140 | #define UML_SAR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SAR, 4, IF_ALWAYS, dst, src, count); } while (0) | |
| 141 | #define UML_ROL(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROL, 4, IF_ALWAYS, dst, src, count); } while (0) | |
| 142 | #define UML_ROLC(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROLC, 4, IF_ALWAYS, dst, src, count); } while (0) | |
| 143 | #define UML_ROR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROR, 4, IF_ALWAYS, dst, src, count); } while (0) | |
| 144 | #define UML_RORC(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_RORC, 4, IF_ALWAYS, dst, src, count); } while (0) | |
| 158 | 145 | |
| 159 | #define UML_NEG(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_NEG, 4, FLAGS_NONE, dst, src1); } while (0) | |
| 160 | #define UML_NEGf(block, dst, src1, flags) do { drcuml_block_append_2(block, DRCUML_OP_NEG, 4, flags, dst, src1); } while (0) | |
| 161 | 146 | |
| 162 | #define UML_ADD(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_ADD, 4, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 163 | #define UML_ADDf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_ADD, 4, flags, dst, src1, src2); } while (0) | |
| 164 | #define UML_ADDC(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_ADDC, 4, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 165 | #define UML_ADDCf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_ADDC, 4, flags, dst, src1, src2); } while (0) | |
| 166 | ||
| 167 | #define UML_SUB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_SUB, 4, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 168 | #define UML_SUBf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_SUB, 4, flags, dst, src1, src2); } while (0) | |
| 169 | #define UML_SUBB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_SUBB, 4, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 170 | #define UML_SUBBf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_SUBB, 4, flags, dst, src1, src2); } while (0) | |
| 171 | ||
| 172 | #define UML_CMP(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_CMP, 4, FLAGS_ALLI, src1, src2); } while (0) | |
| 173 | #define UML_CMPf(block, src1, src2, flags) do { drcuml_block_append_2(block, DRCUML_OP_CMP, 4, flags, src1, src2); } while (0) | |
| 174 | ||
| 175 | #define UML_MULU(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_MULU, 4, FLAGS_NONE, dst, edst, src1, src2); } while (0) | |
| 176 | #define UML_MULUf(block, dst, edst, src1, src2, flags) do { drcuml_block_append_4(block, DRCUML_OP_MULU, 4, flags, dst, edst, src1, src2); } while (0) | |
| 177 | #define UML_MULS(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_MULS, 4, FLAGS_NONE, dst, edst, src1, src2); } while (0) | |
| 178 | #define UML_MULSf(block, dst, edst, src1, src2, flags) do { drcuml_block_append_4(block, DRCUML_OP_MULS, 4, flags, dst, edst, src1, src2); } while (0) | |
| 179 | ||
| 180 | #define UML_DIVU(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_DIVU, 4, FLAGS_NONE, dst, edst, src1, src2); } while (0) | |
| 181 | #define UML_DIVUf(block, dst, edst, src1, src2, flags) do { drcuml_block_append_4(block, DRCUML_OP_DIVU, 4, flags, dst, edst, src1, src2); } while (0) | |
| 182 | #define UML_DIVS(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_DIVS, 4, FLAGS_NONE, dst, edst, src1, src2); } while (0) | |
| 183 | #define UML_DIVSf(block, dst, edst, src1, src2, flags) do { drcuml_block_append_4(block, DRCUML_OP_DIVS, 4, flags, dst, edst, src1, src2); } while (0) | |
| 184 | ||
| 185 | #define UML_AND(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_AND, 4, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 186 | #define UML_ANDf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_AND, 4, flags, dst, src1, src2); } while (0) | |
| 187 | ||
| 188 | #define UML_TEST(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_TEST, 4, FLAGS_S|FLAGS_Z,src1, src2); } while (0) | |
| 189 | #define UML_TESTf(block, src1, src2, flags) do { drcuml_block_append_2(block, DRCUML_OP_TEST, 4, flags, src1, src2); } while (0) | |
| 190 | ||
| 191 | #define UML_OR(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_OR, 4, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 192 | #define UML_ORf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_OR, 4, flags, dst, src1, src2); } while (0) | |
| 193 | ||
| 194 | #define UML_XOR(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_XOR, 4, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 195 | #define UML_XORf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_XOR, 4, flags, dst, src1, src2); } while (0) | |
| 196 | ||
| 197 | #define UML_LZCNT(block, dst, src) do { drcuml_block_append_2(block, DRCUML_OP_LZCNT, 4, FLAGS_NONE, dst, src); } while (0) | |
| 198 | #define UML_BSWAP(block, dst, src) do { drcuml_block_append_2(block, DRCUML_OP_BSWAP, 4, FLAGS_NONE, dst, src); } while (0) | |
| 199 | ||
| 200 | #define UML_SHL(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SHL, 4, FLAGS_NONE, dst, src, count); } while (0) | |
| 201 | #define UML_SHLf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_SHL, 4, flags, dst, src, count); } while (0) | |
| 202 | ||
| 203 | #define UML_SHR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SHR, 4, FLAGS_NONE, dst, src, count); } while (0) | |
| 204 | #define UML_SHRf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_SHR, 4, flags, dst, src, count); } while (0) | |
| 205 | ||
| 206 | #define UML_SAR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SAR, 4, FLAGS_NONE, dst, src, count); } while (0) | |
| 207 | #define UML_SARf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_SAR, 4, flags, dst, src, count); } while (0) | |
| 208 | ||
| 209 | #define UML_ROL(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROL, 4, FLAGS_NONE, dst, src, count); } while (0) | |
| 210 | #define UML_ROLf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_ROL, 4, flags, dst, src, count); } while (0) | |
| 211 | #define UML_ROLC(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROLC, 4, FLAGS_NONE, dst, src, count); } while (0) | |
| 212 | #define UML_ROLCf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_ROLC, 4, flags, dst, src, count); } while (0) | |
| 213 | ||
| 214 | #define UML_ROR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROR, 4, FLAGS_NONE, dst, src, count); } while (0) | |
| 215 | #define UML_RORf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_ROR, 4, flags, dst, src, count); } while (0) | |
| 216 | #define UML_RORC(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_RORC, 4, FLAGS_NONE, dst, src, count); } while (0) | |
| 217 | #define UML_RORCf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_RORC, 4, flags, dst, src, count); } while (0) | |
| 218 | ||
| 219 | ||
| 220 | 147 | /* ----- 64-Bit Integer Operations ----- */ |
| 221 | 148 | #define UML_DLOAD(block, dst, base, index, size) do { drcuml_block_append_4(block, DRCUML_OP_LOAD, 8, IF_ALWAYS, dst, MEM(base), index, IMM(DRCUML_SIZE_##size)); } while (0) |
| 222 | 149 | #define UML_DLOADS(block, dst, base, index, size) do { drcuml_block_append_4(block, DRCUML_OP_LOADS, 8, IF_ALWAYS, dst, MEM(base), index, IMM(DRCUML_SIZE_##size)); } while (0) |
| r2844 | r2845 | |
| 225 | 152 | #define UML_DREADM(block, dst, src1, mask, spsize) do { drcuml_block_append_4(block, DRCUML_OP_READM, 8, IF_ALWAYS, dst, src1, mask, IMM(DRCUML_SPSIZE_##spsize)); } while (0) |
| 226 | 153 | #define UML_DWRITE(block, dst, src1, spsize) do { drcuml_block_append_3(block, DRCUML_OP_WRITE, 8, IF_ALWAYS, dst, src1, IMM(DRCUML_SPSIZE_##spsize)); } while (0) |
| 227 | 154 | #define UML_DWRITEM(block, dst, src1, mask, spsize) do { drcuml_block_append_4(block, DRCUML_OP_WRITEM, 8, IF_ALWAYS, dst, src1, mask, IMM(DRCUML_SPSIZE_##spsize)); } while (0) |
| 228 | ||
| 229 | 155 | #define UML_DCARRY(block, src, bitnum) do { drcuml_block_append_2(block, DRCUML_OP_CARRY, 8, IF_ALWAYS, src, bitnum); } while (0) |
| 230 | 156 | #define UML_DSETc(block, cond, dst) do { drcuml_block_append_1(block, DRCUML_OP_SET, 8, cond, dst); } while (0) |
| 231 | ||
| 232 | 157 | #define UML_DMOV(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_MOV, 8, IF_ALWAYS, dst, src1); } while (0) |
| 233 | 158 | #define UML_DMOVc(block, cond, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_MOV, 8, cond, dst, src1); } while (0) |
| 234 | 159 | #define UML_DSEXT(block, dst, src1, size) do { drcuml_block_append_3(block, DRCUML_OP_SEXT, 8, IF_ALWAYS, dst, src1, IMM(DRCUML_SIZE_##size)); } while (0) |
| 235 | ||
| 236 | 160 | #define UML_DROLAND(block, dst, src, shift, mask) do { drcuml_block_append_4(block, DRCUML_OP_ROLAND, 8, IF_ALWAYS, dst, src, shift, mask); } while (0) |
| 237 | 161 | #define UML_DROLINS(block, dst, src, shift, mask) do { drcuml_block_append_4(block, DRCUML_OP_ROLINS, 8, IF_ALWAYS, dst, src, shift, mask); } while (0) |
| 162 | #define UML_DADD(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_ADD, 8, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 163 | #define UML_DADDC(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_ADDC, 8, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 164 | #define UML_DSUB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_SUB, 8, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 165 | #define UML_DSUBB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_SUBB, 8, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 166 | #define UML_DCMP(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_CMP, 8, IF_ALWAYS, src1, src2); } while (0) | |
| 167 | #define UML_DMULU(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_MULU, 8, IF_ALWAYS, dst, edst, src1, src2); } while (0) | |
| 168 | #define UML_DMULS(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_MULS, 8, IF_ALWAYS, dst, edst, src1, src2); } while (0) | |
| 169 | #define UML_DDIVU(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_DIVU, 8, IF_ALWAYS, dst, edst, src1, src2); } while (0) | |
| 170 | #define UML_DDIVS(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_DIVS, 8, IF_ALWAYS, dst, edst, src1, src2); } while (0) | |
| 171 | #define UML_DAND(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_AND, 8, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 172 | #define UML_DTEST(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_TEST, 8, IF_ALWAYS, src1, src2); } while (0) | |
| 173 | #define UML_DOR(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_OR, 8, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 174 | #define UML_DXOR(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_XOR, 8, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 175 | #define UML_DSHL(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SHL, 8, IF_ALWAYS, dst, src, count); } while (0) | |
| 176 | #define UML_DSHR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SHR, 8, IF_ALWAYS, dst, src, count); } while (0) | |
| 177 | #define UML_DSAR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SAR, 8, IF_ALWAYS, dst, src, count); } while (0) | |
| 178 | #define UML_DROL(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROL, 8, IF_ALWAYS, dst, src, count); } while (0) | |
| 179 | #define UML_DROLC(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROLC, 8, IF_ALWAYS, dst, src, count); } while (0) | |
| 180 | #define UML_DROR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROR, 8, IF_ALWAYS, dst, src, count); } while (0) | |
| 181 | #define UML_DRORC(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_RORC, 8, IF_ALWAYS, dst, src, count); } while (0) | |
| 238 | 182 | |
| 239 | #define UML_DNEG(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_NEG, 8, FLAGS_NONE, dst, src1); } while (0) | |
| 240 | #define UML_DNEGf(block, dst, src1, flags) do { drcuml_block_append_2(block, DRCUML_OP_NEG, 8, flags, dst, src1); } while (0) | |
| 241 | 183 | |
| 242 | #define UML_DADD(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_ADD, 8, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 243 | #define UML_DADDf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_ADD, 8, flags, dst, src1, src2); } while (0) | |
| 244 | #define UML_DADDC(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_ADDC, 8, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 245 | #define UML_DADDCf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_ADDC, 8, flags, dst, src1, src2); } while (0) | |
| 246 | ||
| 247 | #define UML_DSUB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_SUB, 8, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 248 | #define UML_DSUBf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_SUB, 8, flags, dst, src1, src2); } while (0) | |
| 249 | #define UML_DSUBB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_SUBB, 8, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 250 | #define UML_DSUBBf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_SUBB, 8, flags, dst, src1, src2); } while (0) | |
| 251 | ||
| 252 | #define UML_DCMP(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_CMP, 8, FLAGS_ALLI, src1, src2); } while (0) | |
| 253 | #define UML_DCMPf(block, src1, src2, flags) do { drcuml_block_append_2(block, DRCUML_OP_CMP, 8, flags, src1, src2); } while (0) | |
| 254 | ||
| 255 | #define UML_DMULU(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_MULU, 8, FLAGS_NONE, dst, edst, src1, src2); } while (0) | |
| 256 | #define UML_DMULUf(block, dst, edst, src1, src2, flags) do { drcuml_block_append_4(block, DRCUML_OP_MULU, 8, flags, dst, edst, src1, src2); } while (0) | |
| 257 | #define UML_DMULS(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_MULS, 8, FLAGS_NONE, dst, edst, src1, src2); } while (0) | |
| 258 | #define UML_DMULSf(block, dst, edst, src1, src2, flags) do { drcuml_block_append_4(block, DRCUML_OP_MULS, 8, flags, dst, edst, src1, src2); } while (0) | |
| 259 | ||
| 260 | #define UML_DDIVU(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_DIVU, 8, FLAGS_NONE, dst, edst, src1, src2); } while (0) | |
| 261 | #define UML_DDIVUf(block, dst, edst, src1, src2, flags) do { drcuml_block_append_4(block, DRCUML_OP_DIVU, 8, flags, dst, edst, src1, src2); } while (0) | |
| 262 | #define UML_DDIVS(block, dst, edst, src1, src2) do { drcuml_block_append_4(block, DRCUML_OP_DIVS, 8, FLAGS_NONE, dst, edst, src1, src2); } while (0) | |
| 263 | #define UML_DDIVSf(block, dst, edst, src1, src2, flags) do { drcuml_block_append_4(block, DRCUML_OP_DIVS, 8, flags, dst, edst, src1, src2); } while (0) | |
| 264 | ||
| 265 | #define UML_DAND(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_AND, 8, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 266 | #define UML_DANDf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_AND, 8, flags, dst, src1, src2); } while (0) | |
| 267 | ||
| 268 | #define UML_DTEST(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_TEST, 8, FLAGS_S|FLAGS_Z,src1, src2); } while (0) | |
| 269 | #define UML_DTESTf(block, src1, src2, flags) do { drcuml_block_append_2(block, DRCUML_OP_TEST, 8, flags, src1, src2); } while (0) | |
| 270 | ||
| 271 | #define UML_DOR(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_OR, 8, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 272 | #define UML_DORf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_OR, 8, flags, dst, src1, src2); } while (0) | |
| 273 | ||
| 274 | #define UML_DXOR(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_XOR, 8, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 275 | #define UML_DXORf(block, dst, src1, src2, flags) do { drcuml_block_append_3(block, DRCUML_OP_XOR, 8, flags, dst, src1, src2); } while (0) | |
| 276 | ||
| 277 | #define UML_DSHL(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SHL, 8, FLAGS_NONE, dst, src, count); } while (0) | |
| 278 | #define UML_DSHLf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_SHL, 8, flags, dst, src, count); } while (0) | |
| 279 | ||
| 280 | #define UML_DSHR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SHR, 8, FLAGS_NONE, dst, src, count); } while (0) | |
| 281 | #define UML_DSHRf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_SHR, 8, flags, dst, src, count); } while (0) | |
| 282 | ||
| 283 | #define UML_DSAR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_SAR, 8, FLAGS_NONE, dst, src, count); } while (0) | |
| 284 | #define UML_DSARf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_SAR, 8, flags, dst, src, count); } while (0) | |
| 285 | ||
| 286 | #define UML_DROL(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROL, 8, FLAGS_NONE, dst, src, count); } while (0) | |
| 287 | #define UML_DROLf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_ROL, 8, flags, dst, src, count); } while (0) | |
| 288 | #define UML_DROLC(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROLC, 8, FLAGS_NONE, dst, src, count); } while (0) | |
| 289 | #define UML_DROLCf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_ROLC, 8, flags, dst, src, count); } while (0) | |
| 290 | ||
| 291 | #define UML_DROR(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_ROR, 8, FLAGS_NONE, dst, src, count); } while (0) | |
| 292 | #define UML_DRORf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_ROR, 8, flags, dst, src, count); } while (0) | |
| 293 | #define UML_DRORC(block, dst, src, count) do { drcuml_block_append_3(block, DRCUML_OP_RORC, 8, FLAGS_NONE, dst, src, count); } while (0) | |
| 294 | #define UML_DRORCf(block, dst, src, count, flags) do { drcuml_block_append_3(block, DRCUML_OP_RORC, 8, flags, dst, src, count); } while (0) | |
| 295 | ||
| 296 | ||
| 297 | 184 | /* ----- 32-bit Floating Point Arithmetic Operations ----- */ |
| 298 | 185 | #define UML_FSLOAD(block, dst, base, index) do { drcuml_block_append_3(block, DRCUML_OP_FLOAD, 4, IF_ALWAYS, dst, MEM(base), index); } while (0) |
| 299 | 186 | #define UML_FSSTORE(block, base, index, src1) do { drcuml_block_append_3(block, DRCUML_OP_FSTORE, 4, IF_ALWAYS, MEM(base), index, src1); } while (0) |
| 300 | ||
| 301 | 187 | #define UML_FSREAD(block, dst, src1, space) do { drcuml_block_append_3(block, DRCUML_OP_FREAD, 4, IF_ALWAYS, dst, src1, IMM(ADDRESS_SPACE_##space)); } while (0) |
| 302 | 188 | #define UML_FSWRITE(block, dst, src1, space) do { drcuml_block_append_3(block, DRCUML_OP_FWRITE, 4, IF_ALWAYS, dst, src1, IMM(ADDRESS_SPACE_##space)); } while (0) |
| 303 | ||
| 304 | 189 | #define UML_FSMOV(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FMOV, 4, IF_ALWAYS, dst, src1); } while (0) |
| 305 | 190 | #define UML_FSMOVc(block, cond, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FMOV, 4, cond, dst, src1); } while (0) |
| 306 | ||
| 307 | 191 | #define UML_FSTOINT(block, dst, src1, size, round) do { drcuml_block_append_4(block, DRCUML_OP_FTOINT, 4, IF_ALWAYS, dst, src1, IMM(DRCUML_SIZE_##size), IMM(DRCUML_FMOD_##round)); } while (0) |
| 308 | 192 | #define UML_FSFRINT(block, dst, src1, size) do { drcuml_block_append_3(block, DRCUML_OP_FFRINT, 4, IF_ALWAYS, dst, src1, IMM(DRCUML_SIZE_##size)); } while (0) |
| 309 | 193 | #define UML_FSFRFLT(block, dst, src1, size) do { drcuml_block_append_3(block, DRCUML_OP_FFRFLT, 4, IF_ALWAYS, dst, src1, IMM(DRCUML_SIZE_##size)); } while (0) |
| 194 | #define UML_FSADD(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FADD, 4, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 195 | #define UML_FSSUB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FSUB, 4, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 196 | #define UML_FSCMP(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_FCMP, 4, IF_ALWAYS, src1, src2); } while (0) | |
| 197 | #define UML_FSMUL(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FMUL, 4, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 198 | #define UML_FSDIV(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FDIV, 4, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 199 | #define UML_FSNEG(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FNEG, 4, IF_ALWAYS, dst, src1); } while (0) | |
| 200 | #define UML_FSABS(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FABS, 4, IF_ALWAYS, dst, src1); } while (0) | |
| 201 | #define UML_FSSQRT(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FSQRT, 4, IF_ALWAYS, dst, src1); } while (0) | |
| 202 | #define UML_FSRECIP(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FRECIP, 4, IF_ALWAYS, dst, src1); } while (0) | |
| 203 | #define UML_FSRSQRT(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FRSQRT, 4, IF_ALWAYS, dst, src1); } while (0) | |
| 310 | 204 | |
| 311 | #define UML_FSADD(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FADD, 4, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 312 | #define UML_FSSUB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FSUB, 4, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 313 | #define UML_FSCMP(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_FCMP, 4, FLAGS_ALLF, src1, src2); } while (0) | |
| 314 | #define UML_FSMUL(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FMUL, 4, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 315 | #define UML_FSDIV(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FDIV, 4, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 316 | #define UML_FSNEG(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FNEG, 4, FLAGS_NONE, dst, src1); } while (0) | |
| 317 | #define UML_FSABS(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FABS, 4, FLAGS_NONE, dst, src1); } while (0) | |
| 318 | #define UML_FSSQRT(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FSQRT, 4, FLAGS_NONE, dst, src1); } while (0) | |
| 319 | #define UML_FSRECIP(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FRECIP, 4, FLAGS_NONE, dst, src1); } while (0) | |
| 320 | #define UML_FSRSQRT(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FRSQRT, 4, FLAGS_NONE, dst, src1); } while (0) | |
| 321 | 205 | |
| 322 | ||
| 323 | 206 | /* ----- 64-bit Floating Point Arithmetic Operations ----- */ |
| 324 | 207 | #define UML_FDLOAD(block, dst, base, index) do { drcuml_block_append_3(block, DRCUML_OP_FLOAD, 8, IF_ALWAYS, dst, MEM(base), index); } while (0) |
| 325 | 208 | #define UML_FDSTORE(block, base, index, src1) do { drcuml_block_append_3(block, DRCUML_OP_FSTORE, 8, IF_ALWAYS, MEM(base), index, src1); } while (0) |
| 326 | ||
| 327 | 209 | #define UML_FDREAD(block, dst, src1, space) do { drcuml_block_append_3(block, DRCUML_OP_FREAD, 8, IF_ALWAYS, dst, src1, IMM(ADDRESS_SPACE_##space)); } while (0) |
| 328 | 210 | #define UML_FDWRITE(block, dst, src1, space) do { drcuml_block_append_3(block, DRCUML_OP_FWRITE, 8, IF_ALWAYS, dst, src1, IMM(ADDRESS_SPACE_##space)); } while (0) |
| 329 | ||
| 330 | 211 | #define UML_FDMOV(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FMOV, 8, IF_ALWAYS, dst, src1); } while (0) |
| 331 | 212 | #define UML_FDMOVc(block, cond, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FMOV, 8, cond, dst, src1); } while (0) |
| 332 | ||
| 333 | 213 | #define UML_FDTOINT(block, dst, src1, size, round) do { drcuml_block_append_4(block, DRCUML_OP_FTOINT, 8, IF_ALWAYS, dst, src1, IMM(DRCUML_SIZE_##size), IMM(DRCUML_FMOD_##round)); } while (0) |
| 334 | 214 | #define UML_FDFRINT(block, dst, src1, size) do { drcuml_block_append_3(block, DRCUML_OP_FFRINT, 8, IF_ALWAYS, dst, src1, IMM(DRCUML_SIZE_##size)); } while (0) |
| 335 | 215 | #define UML_FDFRFLT(block, dst, src1, size) do { drcuml_block_append_3(block, DRCUML_OP_FFRFLT, 8, IF_ALWAYS, dst, src1, IMM(DRCUML_SIZE_##size)); } while (0) |
| 216 | #define UML_FDRNDS(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FRNDS, 8, IF_ALWAYS, dst, src1); } while (0) | |
| 217 | #define UML_FDADD(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FADD, 8, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 218 | #define UML_FDSUB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FSUB, 8, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 219 | #define UML_FDCMP(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_FCMP, 8, IF_ALWAYS, src1, src2); } while (0) | |
| 220 | #define UML_FDMUL(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FMUL, 8, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 221 | #define UML_FDDIV(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FDIV, 8, IF_ALWAYS, dst, src1, src2); } while (0) | |
| 222 | #define UML_FDNEG(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FNEG, 8, IF_ALWAYS, dst, src1); } while (0) | |
| 223 | #define UML_FDABS(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FABS, 8, IF_ALWAYS, dst, src1); } while (0) | |
| 224 | #define UML_FDSQRT(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FSQRT, 8, IF_ALWAYS, dst, src1); } while (0) | |
| 225 | #define UML_FDRECIP(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FRECIP, 8, IF_ALWAYS, dst, src1); } while (0) | |
| 226 | #define UML_FDRSQRT(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FRSQRT, 8, IF_ALWAYS, dst, src1); } while (0) | |
| 336 | 227 | |
| 337 | #define UML_FDRNDS(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FRNDS, 8, FLAGS_NONE, dst, src1); } while (0) | |
| 338 | 228 | |
| 339 | #define UML_FDADD(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FADD, 8, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 340 | #define UML_FDSUB(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FSUB, 8, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 341 | #define UML_FDCMP(block, src1, src2) do { drcuml_block_append_2(block, DRCUML_OP_FCMP, 8, FLAGS_ALLF, src1, src2); } while (0) | |
| 342 | #define UML_FDMUL(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FMUL, 8, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 343 | #define UML_FDDIV(block, dst, src1, src2) do { drcuml_block_append_3(block, DRCUML_OP_FDIV, 8, FLAGS_NONE, dst, src1, src2); } while (0) | |
| 344 | #define UML_FDNEG(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FNEG, 8, FLAGS_NONE, dst, src1); } while (0) | |
| 345 | #define UML_FDABS(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FABS, 8, FLAGS_NONE, dst, src1); } while (0) | |
| 346 | #define UML_FDSQRT(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FSQRT, 8, FLAGS_NONE, dst, src1); } while (0) | |
| 347 | #define UML_FDRECIP(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FRECIP, 8, FLAGS_NONE, dst, src1); } while (0) | |
| 348 | #define UML_FDRSQRT(block, dst, src1) do { drcuml_block_append_2(block, DRCUML_OP_FRSQRT, 8, FLAGS_NONE, dst, src1); } while (0) | |
| 349 | ||
| 350 | ||
| 351 | 229 | #endif |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | 3 | mips3.h |
| 4 | Interface file for the portable MIPS III/IV emulator. | |
| 5 | Written by Aaron Giles | |
| 6 | 4 | |
| 5 | Interface file for the universal machine language-based | |
| 6 | MIPS III/IV emulator. | |
| 7 | ||
| 8 | Copyright Aaron Giles | |
| 9 | Released for general non-commercial use under the MAME license | |
| 10 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 11 | ||
| 7 | 12 | ***************************************************************************/ |
| 8 | 13 | |
| 9 | 14 | #ifndef __MIPS3_H__ |
| r2844 | r2845 | |
|---|---|---|
| 82 | 82 | return TRUE; |
| 83 | 83 | |
| 84 | 84 | case 0x03: /* JAL */ |
| 85 | desc-> | |
| 85 | desc-> | |
| 86 | 86 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 87 | 87 | desc->targetpc = (desc->pc & 0xf0000000) | (LIMMVAL << 2); |
| 88 | 88 | desc->delayslots = 1; |
| r2844 | r2845 | |
| 96 | 96 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 97 | 97 | else |
| 98 | 98 | { |
| 99 | desc-> | |
| 99 | desc-> | |
| 100 | 100 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 101 | 101 | } |
| 102 | 102 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| r2844 | r2845 | |
| 112 | 112 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 113 | 113 | else |
| 114 | 114 | { |
| 115 | desc-> | |
| 115 | desc-> | |
| 116 | 116 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 117 | 117 | } |
| 118 | 118 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| r2844 | r2845 | |
| 122 | 122 | |
| 123 | 123 | case 0x08: /* ADDI */ |
| 124 | 124 | case 0x18: /* DADDI */ |
| 125 | desc->gpr.used |= REGFLAG_R(RSREG); | |
| 126 | desc->gpr.modified |= REGFLAG_R(RTREG); | |
| 125 | desc->regin[0] |= REGFLAG_R(RSREG); | |
| 126 | desc->regout[0] |= REGFLAG_R(RTREG); | |
| 127 | 127 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 128 | 128 | return TRUE; |
| 129 | 129 | |
| r2844 | r2845 | |
| 134 | 134 | case 0x0d: /* ORI */ |
| 135 | 135 | case 0x0e: /* XORI */ |
| 136 | 136 | case 0x19: /* DADDIU */ |
| 137 | desc->gpr.used |= REGFLAG_R(RSREG); | |
| 138 | desc->gpr.modified |= REGFLAG_R(RTREG); | |
| 137 | desc->regin[0] |= REGFLAG_R(RSREG); | |
| 138 | desc->regout[0] |= REGFLAG_R(RTREG); | |
| 139 | 139 | return TRUE; |
| 140 | 140 | |
| 141 | 141 | case 0x0f: /* LUI */ |
| 142 | desc-> | |
| 142 | desc-> | |
| 143 | 143 | return TRUE; |
| 144 | 144 | |
| 145 | 145 | case 0x1a: /* LDL */ |
| 146 | 146 | case 0x1b: /* LDR */ |
| 147 | 147 | case 0x22: /* LWL */ |
| 148 | 148 | case 0x26: /* LWR */ |
| 149 | desc-> | |
| 149 | desc-> | |
| 150 | 150 | case 0x20: /* LB */ |
| 151 | 151 | case 0x21: /* LH */ |
| 152 | 152 | case 0x23: /* LW */ |
| r2844 | r2845 | |
| 156 | 156 | case 0x30: /* LL */ |
| 157 | 157 | case 0x34: /* LLD */ |
| 158 | 158 | case 0x37: /* LD */ |
| 159 | desc->gpr.used |= REGFLAG_R(RSREG); | |
| 160 | desc->gpr.modified |= REGFLAG_R(RTREG); | |
| 159 | desc->regin[0] |= REGFLAG_R(RSREG); | |
| 160 | desc->regout[0] |= REGFLAG_R(RTREG); | |
| 161 | 161 | desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 162 | 162 | return TRUE; |
| 163 | 163 | |
| r2844 | r2845 | |
| 171 | 171 | case 0x38: /* SC */ |
| 172 | 172 | case 0x3c: /* SCD */ |
| 173 | 173 | case 0x3f: /* SD */ |
| 174 | desc-> | |
| 174 | desc-> | |
| 175 | 175 | desc->flags |= OPFLAG_WRITES_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 176 | 176 | return TRUE; |
| 177 | 177 | |
| 178 | 178 | case 0x31: /* LWC1 */ |
| 179 | 179 | case 0x35: /* LDC1 */ |
| 180 | desc->gpr.used |= REGFLAG_R(RSREG); | |
| 181 | desc->fpr.modified |= REGFLAG_CPR1(RTREG); | |
| 180 | desc->regin[0] |= REGFLAG_R(RSREG); | |
| 181 | desc->regout[1] |= REGFLAG_CPR1(RTREG); | |
| 182 | 182 | desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 183 | 183 | return TRUE; |
| 184 | 184 | |
| 185 | 185 | case 0x39: /* SWC1 */ |
| 186 | 186 | case 0x3d: /* SDC1 */ |
| 187 | desc->gpr.used |= REGFLAG_R(RSREG); | |
| 188 | desc->fpr.used |= REGFLAG_CPR1(RTREG); | |
| 187 | desc->regin[0] |= REGFLAG_R(RSREG); | |
| 188 | desc->regin[1] |= REGFLAG_CPR1(RTREG); | |
| 189 | 189 | desc->flags |= OPFLAG_WRITES_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 190 | 190 | return TRUE; |
| 191 | 191 | |
| 192 | 192 | case 0x32: /* LWC2 */ |
| 193 | 193 | case 0x36: /* LDC2 */ |
| 194 | desc-> | |
| 194 | desc-> | |
| 195 | 195 | desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 196 | 196 | return TRUE; |
| 197 | 197 | |
| 198 | 198 | case 0x3a: /* SWC2 */ |
| 199 | 199 | case 0x3e: /* SDC2 */ |
| 200 | desc-> | |
| 200 | desc-> | |
| 201 | 201 | desc->flags |= OPFLAG_WRITES_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 202 | 202 | return TRUE; |
| 203 | 203 | |
| r2844 | r2845 | |
| 232 | 232 | case 0x3c: /* DSLL32 */ |
| 233 | 233 | case 0x3e: /* DSRL32 */ |
| 234 | 234 | case 0x3f: /* DSRA32 */ |
| 235 | desc->gpr.used |= REGFLAG_R(RTREG); | |
| 236 | desc->gpr.modified |= REGFLAG_R(RDREG); | |
| 235 | desc->regin[0] |= REGFLAG_R(RTREG); | |
| 236 | desc->regout[0] |= REGFLAG_R(RDREG); | |
| 237 | 237 | return TRUE; |
| 238 | 238 | |
| 239 | 239 | case 0x0a: /* MOVZ - MIPS IV */ |
| 240 | 240 | case 0x0b: /* MOVN - MIPS IV */ |
| 241 | 241 | if (mips->flavor < MIPS3_TYPE_MIPS_IV) |
| 242 | 242 | return FALSE; |
| 243 | desc-> | |
| 243 | desc-> | |
| 244 | 244 | case 0x04: /* SLLV */ |
| 245 | 245 | case 0x06: /* SRLV */ |
| 246 | 246 | case 0x07: /* SRAV */ |
| r2844 | r2845 | |
| 257 | 257 | case 0x2b: /* SLTU */ |
| 258 | 258 | case 0x2d: /* DADDU */ |
| 259 | 259 | case 0x2f: /* DSUBU */ |
| 260 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 261 | desc->gpr.modified |= REGFLAG_R(RDREG); | |
| 260 | desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 261 | desc->regout[0] |= REGFLAG_R(RDREG); | |
| 262 | 262 | return TRUE; |
| 263 | 263 | |
| 264 | 264 | case 0x20: /* ADD */ |
| 265 | 265 | case 0x22: /* SUB */ |
| 266 | 266 | case 0x2c: /* DADD */ |
| 267 | 267 | case 0x2e: /* DSUB */ |
| 268 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 269 | desc->gpr.modified |= REGFLAG_R(RDREG); | |
| 268 | desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 269 | desc->regout[0] |= REGFLAG_R(RDREG); | |
| 270 | 270 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 271 | 271 | return TRUE; |
| 272 | 272 | |
| r2844 | r2845 | |
| 276 | 276 | case 0x33: /* TLTU */ |
| 277 | 277 | case 0x34: /* TEQ */ |
| 278 | 278 | case 0x36: /* TNE */ |
| 279 | desc-> | |
| 279 | desc-> | |
| 280 | 280 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 281 | 281 | return TRUE; |
| 282 | 282 | |
| 283 | 283 | case 0x01: /* MOVF - MIPS IV */ |
| 284 | 284 | if (mips->flavor < MIPS3_TYPE_MIPS_IV) |
| 285 | 285 | return FALSE; |
| 286 | desc->gpr.used |= REGFLAG_R(RSREG); | |
| 287 | desc->fpr.used |= REGFLAG_FCC; | |
| 288 | desc->gpr.modified |= REGFLAG_R(RDREG); | |
| 286 | desc->regin[0] |= REGFLAG_R(RSREG); | |
| 287 | desc->regin[2] |= REGFLAG_FCC; | |
| 288 | desc->regout[0] |= REGFLAG_R(RDREG); | |
| 289 | 289 | return TRUE; |
| 290 | 290 | |
| 291 | 291 | case 0x08: /* JR */ |
| 292 | desc-> | |
| 292 | desc-> | |
| 293 | 293 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 294 | 294 | desc->targetpc = BRANCH_TARGET_DYNAMIC; |
| 295 | 295 | desc->delayslots = 1; |
| 296 | 296 | return TRUE; |
| 297 | 297 | |
| 298 | 298 | case 0x09: /* JALR */ |
| 299 | desc->gpr.used |= REGFLAG_R(RSREG); | |
| 300 | desc->gpr.modified |= REGFLAG_R(RDREG); | |
| 299 | desc->regin[0] |= REGFLAG_R(RSREG); | |
| 300 | desc->regout[0] |= REGFLAG_R(RDREG); | |
| 301 | 301 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 302 | 302 | desc->targetpc = BRANCH_TARGET_DYNAMIC; |
| 303 | 303 | desc->delayslots = 1; |
| 304 | 304 | return TRUE; |
| 305 | 305 | |
| 306 | 306 | case 0x10: /* MFHI */ |
| 307 | desc->gpr.used |= REGFLAG_HI; | |
| 308 | desc->gpr.modified |= REGFLAG_R(RDREG); | |
| 307 | desc->regin[0] |= REGFLAG_HI; | |
| 308 | desc->regout[0] |= REGFLAG_R(RDREG); | |
| 309 | 309 | return TRUE; |
| 310 | 310 | |
| 311 | 311 | case 0x11: /* MTHI */ |
| 312 | desc->gpr.used |= REGFLAG_R(RSREG); | |
| 313 | desc->gpr.modified |= REGFLAG_HI; | |
| 312 | desc->regin[0] |= REGFLAG_R(RSREG); | |
| 313 | desc->regout[0] |= REGFLAG_HI; | |
| 314 | 314 | return TRUE; |
| 315 | 315 | |
| 316 | 316 | case 0x12: /* MFLO */ |
| 317 | desc->gpr.used |= REGFLAG_LO; | |
| 318 | desc->gpr.modified |= REGFLAG_R(RDREG); | |
| 317 | desc->regin[2] |= REGFLAG_LO; | |
| 318 | desc->regout[0] |= REGFLAG_R(RDREG); | |
| 319 | 319 | return TRUE; |
| 320 | 320 | |
| 321 | 321 | case 0x13: /* MTLO */ |
| 322 | desc->gpr.used |= REGFLAG_R(RSREG); | |
| 323 | desc->gpr.modified |= REGFLAG_LO; | |
| 322 | desc->regin[0] |= REGFLAG_R(RSREG); | |
| 323 | desc->regout[2] |= REGFLAG_LO; | |
| 324 | 324 | return TRUE; |
| 325 | 325 | |
| 326 | 326 | case 0x18: /* MULT */ |
| 327 | 327 | case 0x19: /* MULTU */ |
| 328 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 329 | desc->gpr.modified |= REGFLAG_LO | REGFLAG_HI; | |
| 328 | desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 329 | desc->regout[2] |= REGFLAG_LO | REGFLAG_HI; | |
| 330 | 330 | desc->cycles = 3; |
| 331 | 331 | return TRUE; |
| 332 | 332 | |
| 333 | 333 | case 0x1a: /* DIV */ |
| 334 | 334 | case 0x1b: /* DIVU */ |
| 335 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 336 | desc->gpr.modified |= REGFLAG_LO | REGFLAG_HI; | |
| 335 | desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 336 | desc->regout[2] |= REGFLAG_LO | REGFLAG_HI; | |
| 337 | 337 | desc->cycles = 35; |
| 338 | 338 | return TRUE; |
| 339 | 339 | |
| 340 | 340 | case 0x1c: /* DMULT */ |
| 341 | 341 | case 0x1d: /* DMULTU */ |
| 342 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 343 | desc->gpr.modified |= REGFLAG_LO | REGFLAG_HI; | |
| 342 | desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 343 | desc->regout[2] |= REGFLAG_LO | REGFLAG_HI; | |
| 344 | 344 | desc->cycles = 7; |
| 345 | 345 | return TRUE; |
| 346 | 346 | |
| 347 | 347 | case 0x1e: /* DDIV */ |
| 348 | 348 | case 0x1f: /* DDIVU */ |
| 349 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 350 | desc->gpr.modified |= REGFLAG_LO | REGFLAG_HI; | |
| 349 | desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 350 | desc->regout[2] |= REGFLAG_LO | REGFLAG_HI; | |
| 351 | 351 | desc->cycles = 67; |
| 352 | 352 | return TRUE; |
| 353 | 353 | |
| r2844 | r2845 | |
| 383 | 383 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 384 | 384 | else |
| 385 | 385 | { |
| 386 | desc-> | |
| 386 | desc-> | |
| 387 | 387 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 388 | 388 | } |
| 389 | 389 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| r2844 | r2845 | |
| 397 | 397 | case 0x0b: /* TLTIU */ |
| 398 | 398 | case 0x0c: /* TEQI */ |
| 399 | 399 | case 0x0e: /* TNEI */ |
| 400 | desc-> | |
| 400 | desc-> | |
| 401 | 401 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 402 | 402 | return TRUE; |
| 403 | 403 | |
| r2844 | r2845 | |
| 409 | 409 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 410 | 410 | else |
| 411 | 411 | { |
| 412 | desc-> | |
| 412 | desc-> | |
| 413 | 413 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 414 | 414 | } |
| 415 | desc-> | |
| 415 | desc-> | |
| 416 | 416 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| 417 | 417 | desc->delayslots = 1; |
| 418 | 418 | desc->skipslots = (RTREG & 0x02) ? 1 : 0; |
| r2844 | r2845 | |
| 435 | 435 | { |
| 436 | 436 | case 0: /* MAD */ |
| 437 | 437 | case 1: /* MADU */ |
| 438 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG) | REGFLAG_LO | REGFLAG_HI; | |
| 439 | desc->gpr.modified |= REGFLAG_LO | REGFLAG_HI; | |
| 438 | desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 439 | desc->regin[2] |= REGFLAG_LO | REGFLAG_HI; | |
| 440 | desc->regout[2] |= REGFLAG_LO | REGFLAG_HI; | |
| 440 | 441 | return TRUE; |
| 441 | 442 | |
| 442 | 443 | case 2: /* MUL */ |
| 443 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 444 | desc->gpr.modified |= REGFLAG_R(RDREG); | |
| 444 | desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 445 | desc->regout[0] |= REGFLAG_R(RDREG); | |
| 445 | 446 | desc->cycles = 3; |
| 446 | 447 | return TRUE; |
| 447 | 448 | } |
| r2844 | r2845 | |
| 469 | 470 | desc->cycles += MIPS3_COUNT_READ_CYCLES; |
| 470 | 471 | if (RDREG == COP0_Cause) |
| 471 | 472 | desc->cycles += MIPS3_CAUSE_READ_CYCLES; |
| 472 | desc-> | |
| 473 | desc-> | |
| 473 | 474 | return TRUE; |
| 474 | 475 | |
| 475 | 476 | case 0x02: /* CFCz */ |
| 476 | desc-> | |
| 477 | desc-> | |
| 477 | 478 | return TRUE; |
| 478 | 479 | |
| 479 | 480 | case 0x04: /* MTCz */ |
| 480 | 481 | case 0x05: /* DMTCz */ |
| 481 | 482 | case 0x06: /* CTCz */ |
| 482 | desc-> | |
| 483 | desc-> | |
| 483 | 484 | if (RSREG == 0x04 || RSREG == 0x05) |
| 484 | 485 | { |
| 485 | 486 | if (RDREG == COP0_Cause) |
| r2844 | r2845 | |
| 541 | 542 | { |
| 542 | 543 | case 0x00: /* MFCz */ |
| 543 | 544 | case 0x01: /* DMFCz */ |
| 544 | desc->fpr.used |= REGFLAG_CPR1(RDREG); | |
| 545 | desc->gpr.modified |= REGFLAG_R(RTREG); | |
| 545 | desc->regin[1] |= REGFLAG_CPR1(RDREG); | |
| 546 | desc->regout[0] |= REGFLAG_R(RTREG); | |
| 546 | 547 | return TRUE; |
| 547 | 548 | |
| 548 | 549 | case 0x02: /* CFCz */ |
| 549 | desc-> | |
| 550 | desc-> | |
| 550 | 551 | return TRUE; |
| 551 | 552 | |
| 552 | 553 | case 0x04: /* MTCz */ |
| 553 | 554 | case 0x05: /* DMTCz */ |
| 554 | desc->gpr.used |= REGFLAG_R(RTREG); | |
| 555 | desc->fpr.modified |= REGFLAG_CPR1(RDREG); | |
| 555 | desc->regin[0] |= REGFLAG_R(RTREG); | |
| 556 | desc->regout[1] |= REGFLAG_CPR1(RDREG); | |
| 556 | 557 | return TRUE; |
| 557 | 558 | |
| 558 | 559 | case 0x06: /* CTCz */ |
| 559 | desc-> | |
| 560 | desc-> | |
| 560 | 561 | return TRUE; |
| 561 | 562 | |
| 562 | 563 | case 0x08: /* BC */ |
| r2844 | r2845 | |
| 566 | 567 | case 0x01: /* BCzT */ |
| 567 | 568 | case 0x02: /* BCzFL */ |
| 568 | 569 | case 0x03: /* BCzTL */ |
| 569 | desc-> | |
| 570 | desc-> | |
| 570 | 571 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 571 | 572 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| 572 | 573 | desc->delayslots = 1; |
| r2844 | r2845 | |
| 587 | 588 | case 0x01: /* SUB */ |
| 588 | 589 | case 0x02: /* MUL */ |
| 589 | 590 | case 0x03: /* DIV */ |
| 590 | desc->fpr.used |= REGFLAG_CPR1(FSREG) | REGFLAG_CPR1(FTREG); | |
| 591 | desc->fpr.modified |= REGFLAG_CPR1(FDREG); | |
| 591 | desc->regin[1] |= REGFLAG_CPR1(FSREG) | REGFLAG_CPR1(FTREG); | |
| 592 | desc->regout[1] |= REGFLAG_CPR1(FDREG); | |
| 592 | 593 | return TRUE; |
| 593 | 594 | |
| 594 | 595 | case 0x15: /* RECIP - MIPS IV */ |
| r2844 | r2845 | |
| 611 | 612 | case 0x21: /* CVT.D */ |
| 612 | 613 | case 0x24: /* CVT.W */ |
| 613 | 614 | case 0x25: /* CVT.L */ |
| 614 | desc->fpr.used |= REGFLAG_CPR1(FSREG); | |
| 615 | desc->fpr.modified |= REGFLAG_CPR1(FDREG); | |
| 615 | desc->regin[1] |= REGFLAG_CPR1(FSREG); | |
| 616 | desc->regout[1] |= REGFLAG_CPR1(FDREG); | |
| 616 | 617 | return TRUE; |
| 617 | 618 | |
| 618 | 619 | case 0x11: /* MOVT/F - MIPS IV */ |
| 619 | 620 | if (mips->flavor < MIPS3_TYPE_MIPS_IV) |
| 620 | 621 | return FALSE; |
| 621 | desc->fpr.used |= REGFLAG_CPR1(FSREG) | REGFLAG_FCC; | |
| 622 | desc->fpr.modified |= REGFLAG_CPR1(FDREG); | |
| 622 | desc->regin[1] |= REGFLAG_CPR1(FSREG); | |
| 623 | desc->regin[2] |= REGFLAG_FCC; | |
| 624 | desc->regout[1] |= REGFLAG_CPR1(FDREG); | |
| 623 | 625 | return TRUE; |
| 624 | 626 | |
| 625 | 627 | case 0x30: case 0x38: /* C.F */ |
| 626 | 628 | case 0x31: case 0x39: /* C.UN */ |
| 627 | desc-> | |
| 629 | desc-> | |
| 628 | 630 | return TRUE; |
| 629 | 631 | |
| 630 | 632 | case 0x32: case 0x3a: /* C.EQ */ |
| r2844 | r2845 | |
| 633 | 635 | case 0x35: case 0x3d: /* C.ULT */ |
| 634 | 636 | case 0x36: case 0x3e: /* C.OLE */ |
| 635 | 637 | case 0x37: case 0x3f: /* C.ULE */ |
| 636 | desc->fpr.used |= REGFLAG_CPR1(FSREG) | REGFLAG_CPR1(FTREG); | |
| 637 | desc->fpr.modified |= REGFLAG_FCC; | |
| 638 | desc->regin[1] |= REGFLAG_CPR1(FSREG) | REGFLAG_CPR1(FTREG); | |
| 639 | desc->regout[2] |= REGFLAG_FCC; | |
| 638 | 640 | return TRUE; |
| 639 | 641 | } |
| 640 | 642 | return FALSE; |
| r2844 | r2845 | |
| 659 | 661 | { |
| 660 | 662 | case 0x00: /* LWXC1 */ |
| 661 | 663 | case 0x01: /* LDXC1 */ |
| 662 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 663 | desc->fpr.modified |= REGFLAG_CPR1(FDREG); | |
| 664 | desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 665 | desc->regout[1] |= REGFLAG_CPR1(FDREG); | |
| 664 | 666 | desc->flags |= OPFLAG_READS_MEMORY; |
| 665 | 667 | return TRUE; |
| 666 | 668 | |
| 667 | 669 | case 0x08: /* SWXC1 */ |
| 668 | 670 | case 0x09: /* SDXC1 */ |
| 669 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 670 | desc->fpr.used |= REGFLAG_CPR1(FDREG); | |
| 671 | desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); | |
| 672 | desc->regin[1] |= REGFLAG_CPR1(FDREG); | |
| 671 | 673 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 672 | 674 | return TRUE; |
| 673 | 675 | |
| r2844 | r2845 | |
| 679 | 681 | case 0x28: case 0x29: /* MSUB */ |
| 680 | 682 | case 0x30: case 0x31: /* NMADD */ |
| 681 | 683 | case 0x38: case 0x39: /* NMSUB */ |
| 682 | desc->fpr.used |= REGFLAG_CPR1(FSREG) | REGFLAG_CPR1(FTREG) | REGFLAG_CPR1(FRREG); | |
| 683 | desc->fpr.modified |= REGFLAG_CPR1(FDREG); | |
| 684 | desc->regin[1] |= REGFLAG_CPR1(FSREG) | REGFLAG_CPR1(FTREG) | REGFLAG_CPR1(FRREG); | |
| 685 | desc->regout[1] |= REGFLAG_CPR1(FDREG); | |
| 684 | 686 | return TRUE; |
| 685 | 687 | } |
| 686 | 688 | |
| r2844 | r2845 | |
| 704 | 706 | case 0x00: /* MFCz */ |
| 705 | 707 | case 0x01: /* DMFCz */ |
| 706 | 708 | case 0x02: /* CFCz */ |
| 707 | desc-> | |
| 709 | desc-> | |
| 708 | 710 | return TRUE; |
| 709 | 711 | |
| 710 | 712 | case 0x04: /* MTCz */ |
| 711 | 713 | case 0x05: /* DMTCz */ |
| 712 | 714 | case 0x06: /* CTCz */ |
| 713 | desc-> | |
| 715 | desc-> | |
| 714 | 716 | return TRUE; |
| 715 | 717 | |
| 716 | 718 | case 0x08: /* BC */ |
| r2844 | r2845 | |
|---|---|---|
| 20 | 20 | CONSTANTS |
| 21 | 21 | ***************************************************************************/ |
| 22 | 22 | |
| 23 | /* register flags */ | |
| 24 | #define REGFLAG_R(n) (((n) == 0) ? 0 : ((UINT64)1 << (n))) | |
| 25 | #define REGFLAG_LO (REGFLAG_R(REG_LO)) | |
| 26 | #define REGFLAG_HI (REGFLAG_R(REG_HI)) | |
| 27 | #define REGFLAG_CPR1(n) ((UINT64)1 << (n)) | |
| 28 | #define REGFLAG_FCC (REGFLAG_CPR1(32)) | |
| 23 | /* register flags 0 */ | |
| 24 | #define REGFLAG_R(n) (((n) == 0) ? 0 : (1 << (n))) | |
| 29 | 25 | |
| 26 | /* register flags 1 */ | |
| 27 | #define REGFLAG_CPR1(n) (1 << (n)) | |
| 30 | 28 | |
| 29 | /* register flags 2 */ | |
| 30 | #define REGFLAG_LO (1 << 0) | |
| 31 | #define REGFLAG_HI (1 << 1) | |
| 32 | #define REGFLAG_FCC (1 << 2) | |
| 31 | 33 | |
| 34 | ||
| 35 | ||
| 32 | 36 | /*************************************************************************** |
| 33 | 37 | FUNCTION PROTOTYPES |
| 34 | 38 | ***************************************************************************/ |
| r2844 | r2845 | |
|---|---|---|
| 44 | 44 | ***************************************************************************/ |
| 45 | 45 | |
| 46 | 46 | #define FORCE_C_BACKEND (0) |
| 47 | #define LOG_UML (0) | |
| 48 | #define LOG_NATIVE (0) | |
| 47 | #define LOG_UML (1) | |
| 48 | #define LOG_NATIVE (1) | |
| 49 | 49 | |
| 50 | 50 | #define DISABLE_FAST_REGISTERS (0) |
| 51 | 51 | #define SINGLE_INSTRUCTION_MODE (0) |
| r2844 | r2845 | |
| 249 | 249 | |
| 250 | 250 | static void log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op); |
| 251 | 251 | static const char *log_desc_flags_to_string(UINT32 flags); |
| 252 | static void log_register_list(drcuml_state *drcuml, const char *string, UINT | |
| 252 | static void log_register_list(drcuml_state *drcuml, const char *string, const UINT32 * | |
| 253 | 253 | static void log_opcode_desc(drcuml_state *drcuml, const opcode_desc *desclist, int indent); |
| 254 | 254 | |
| 255 | 255 | |
| r2844 | r2845 | |
| 917 | 917 | |
| 918 | 918 | /* check for interrupts */ |
| 919 | 919 | UML_AND(block, IREG(0), CPR032(COP0_Cause), CPR032(COP0_Status)); // and i0,[Cause],[Status] |
| 920 | UML_AND | |
| 920 | UML_AND | |
| 921 | 921 | UML_JMPc(block, IF_Z, skip); // jmp skip,Z |
| 922 | 922 | UML_TEST(block, CPR032(COP0_Status), IMM(SR_IE)); // test [Status],SR_IE |
| 923 | 923 | UML_JMPc(block, IF_Z, skip); // jmp skip,Z |
| r2844 | r2845 | |
| 1127 | 1127 | UML_MOVc(block, IF_Z, IREG(0), IMM(0x80000000 + offset)); // mov i0,0x80000000 + offset,z |
| 1128 | 1128 | |
| 1129 | 1129 | /* adjust cycles */ |
| 1130 | UML_SUB | |
| 1130 | UML_SUB | |
| 1131 | 1131 | UML_EXHc(block, IF_S, mips3->impstate->out_of_cycles, IREG(0)); // exh out_of_cycles,i0 |
| 1132 | 1132 | |
| 1133 | 1133 | UML_HASHJMP(block, MEM(&mips3->impstate->mode), IREG(0), mips3->impstate->nocode);// hashjmp <mode>,i0,nocode |
| r2844 | r2845 | |
| 1307 | 1307 | if (!ismasked) |
| 1308 | 1308 | UML_WRITE(block, IREG(0), IREG(1), PROGRAM_DWORD); // write i0,i1,program_dword |
| 1309 | 1309 | else |
| 1310 | UML_WRITEM(block, IREG(0), IREG( | |
| 1310 | UML_WRITEM(block, IREG(0), IREG(1), IREG(2), PROGRAM_DWORD); // writem i0,i1,i2,program_dword | |
| 1311 | 1311 | } |
| 1312 | 1312 | else |
| 1313 | 1313 | { |
| r2844 | r2845 | |
| 1324 | 1324 | if (!ismasked) |
| 1325 | 1325 | UML_DWRITE(block, IREG(0), IREG(1), PROGRAM_QWORD); // dwrite i0,i1,program_qword |
| 1326 | 1326 | else |
| 1327 | UML_DWRITEM(block, IREG(0), IREG( | |
| 1327 | UML_DWRITEM(block, IREG(0), IREG(1), IREG(2), PROGRAM_QWORD); // dwritem i0,i1,i2,program_qword | |
| 1328 | 1328 | } |
| 1329 | 1329 | else |
| 1330 | 1330 | { |
| r2844 | r2845 | |
| 1390 | 1390 | |
| 1391 | 1391 | compiler->checksoftints = FALSE; |
| 1392 | 1392 | UML_AND(block, IREG(0), CPR032(COP0_Cause), CPR032(COP0_Status)); // and i0,[Cause],[Status] |
| 1393 | UML_AND | |
| 1393 | UML_AND | |
| 1394 | 1394 | UML_JMPc(block, IF_Z, skip = compiler->labelnum++); // jmp skip,Z |
| 1395 | 1395 | UML_MOV(block, IREG(0), PARAM(ptype, pvalue)); // mov i0,nextpc |
| 1396 | 1396 | UML_MOV(block, IREG(1), IMM(compiler->cycles)); // mov i1,cycles |
| r2844 | r2845 | |
| 1405 | 1405 | |
| 1406 | 1406 | compiler->checkints = FALSE; |
| 1407 | 1407 | UML_AND(block, IREG(0), CPR032(COP0_Cause), CPR032(COP0_Status)); // and i0,[Cause],[Status] |
| 1408 | UML_AND | |
| 1408 | UML_AND | |
| 1409 | 1409 | UML_JMPc(block, IF_Z, skip = compiler->labelnum++); // jmp skip,Z |
| 1410 | 1410 | UML_TEST(block, CPR032(COP0_Status), IMM(SR_IE)); // test [Status],SR_IE |
| 1411 | 1411 | UML_JMPc(block, IF_Z, skip); // jmp skip,Z |
| r2844 | r2845 | |
| 1420 | 1420 | /* account for cycles */ |
| 1421 | 1421 | if (compiler->cycles > 0) |
| 1422 | 1422 | { |
| 1423 | UML_SUBf(block, MEM(&mips3->icount), MEM(&mips3->icount), MAPVAR_CYCLES, allow_exception ? FLAGS_S : 0); | |
| 1424 | // sub icount,icount,cycles,S | |
| 1423 | UML_SUB(block, MEM(&mips3->icount), MEM(&mips3->icount), MAPVAR_CYCLES); // sub icount,icount,cycles | |
| 1425 | 1424 | UML_MAPVAR(block, MAPVAR_CYCLES, 0); // mapvar cycles,0 |
| 1426 | 1425 | if (allow_exception) |
| 1427 | 1426 | UML_EXHc(block, IF_S, mips3->impstate->out_of_cycles, PARAM(ptype, pvalue)); |
| r2844 | r2845 | |
| 1715 | 1714 | return TRUE; |
| 1716 | 1715 | |
| 1717 | 1716 | case 0x08: /* ADDI - MIPS I */ |
| 1717 | UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL | |
| 1718 | 1718 | if (mips3->impstate->drcoptions & MIPS3DRC_CHECK_OVERFLOWS) |
| 1719 | { | |
| 1720 | UML_ADDf(block, IREG(0), R32(RSREG), IMM(SIMMVAL), FLAGS_V); // add i0,<rsreg>,SIMMVAL,V | |
| 1721 | 1719 | UML_EXHc(block, IF_V, mips3->impstate->exception[EXCEPTION_OVERFLOW], IMM(0)); |
| 1722 | 1720 | // exh overflow,0 |
| 1723 | } | |
| 1724 | else | |
| 1725 | UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL | |
| 1726 | 1721 | if (RTREG != 0) |
| 1727 | 1722 | UML_DSEXT(block, R64(RTREG), IREG(0), DWORD); // dsext <rtreg>,i0,dword |
| 1728 | 1723 | return TRUE; |
| r2844 | r2845 | |
| 1736 | 1731 | return TRUE; |
| 1737 | 1732 | |
| 1738 | 1733 | case 0x18: /* DADDI - MIPS III */ |
| 1734 | UML_DADD(block, IREG(0), R64(RSREG), IMM(SIMMVAL)); // dadd i0,<rsreg>,SIMMVAL | |
| 1739 | 1735 | if (mips3->impstate->drcoptions & MIPS3DRC_CHECK_OVERFLOWS) |
| 1740 | { | |
| 1741 | UML_DADDf(block, IREG(0), R64(RSREG), IMM(SIMMVAL), FLAGS_V); // dadd i0,<rsreg>,SIMMVAL,V | |
| 1742 | 1736 | UML_EXHc(block, IF_V, mips3->impstate->exception[EXCEPTION_OVERFLOW], IMM(0)); |
| 1743 | 1737 | // exh overflow,0 |
| 1744 | } | |
| 1745 | else | |
| 1746 | UML_DADD(block, IREG(0), R64(RSREG), IMM(SIMMVAL)); // dadd i0,<rsreg>,SIMMVAL | |
| 1747 | 1738 | if (RTREG != 0) |
| 1748 | 1739 | UML_DMOV(block, R64(RTREG), IREG(0)); // dmov <rtreg>,i0 |
| 1749 | 1740 | return TRUE; |
| r2844 | r2845 | |
| 1853 | 1844 | case 0x22: /* LWL - MIPS I */ |
| 1854 | 1845 | UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL |
| 1855 | 1846 | UML_SHL(block, IREG(1), IREG(0), IMM(3)); // shl i1,i0,3 |
| 1847 | UML_AND(block, IREG(0), IREG(0), IMM(~3)); // and i0,i0,~3 | |
| 1856 | 1848 | if (!mips3->bigendian) |
| 1857 | 1849 | UML_XOR(block, IREG(1), IREG(1), IMM(0x18)); // xor i1,i1,0x18 |
| 1858 | 1850 | UML_SHR(block, IREG(2), IMM(~0), IREG(1)); // shr i2,~0,i1 |
| r2844 | r2845 | |
| 1872 | 1864 | case 0x26: /* LWR - MIPS I */ |
| 1873 | 1865 | UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL |
| 1874 | 1866 | UML_SHL(block, IREG(1), IREG(0), IMM(3)); // shl i1,i0,3 |
| 1867 | UML_AND(block, IREG(0), IREG(0), IMM(~3)); // and i0,i0,~3 | |
| 1875 | 1868 | if (mips3->bigendian) |
| 1876 | 1869 | UML_XOR(block, IREG(1), IREG(1), IMM(0x18)); // xor i1,i1,0x18 |
| 1877 | 1870 | UML_SHL(block, IREG(2), IMM(~0), IREG(1)); // shl i2,~0,i1 |
| r2844 | r2845 | |
| 1892 | 1885 | case 0x1a: /* LDL - MIPS III */ |
| 1893 | 1886 | UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL |
| 1894 | 1887 | UML_SHL(block, IREG(1), IREG(0), IMM(3)); // shl i1,i0,3 |
| 1888 | UML_AND(block, IREG(0), IREG(0), IMM(~7)); // and i0,i0,~7 | |
| 1895 | 1889 | if (!mips3->bigendian) |
| 1896 | 1890 | UML_XOR(block, IREG(1), IREG(1), IMM(0x38)); // xor i1,i1,0x38 |
| 1897 | 1891 | UML_DSHR(block, IREG(2), IMM((UINT64)~0), IREG(1)); // dshr i2,~0,i1 |
| r2844 | r2845 | |
| 1909 | 1903 | case 0x1b: /* LDR - MIPS III */ |
| 1910 | 1904 | UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL |
| 1911 | 1905 | UML_SHL(block, IREG(1), IREG(0), IMM(3)); // shl i1,i0,3 |
| 1906 | UML_AND(block, IREG(0), IREG(0), IMM(~7)); // and i0,i0,~7 | |
| 1912 | 1907 | if (mips3->bigendian) |
| 1913 | 1908 | UML_XOR(block, IREG(1), IREG(1), IMM(0x38)); // xor i1,i1,0x38 |
| 1914 | 1909 | UML_DSHL(block, IREG(2), IMM((UINT64)~0), IREG(1)); // dshl i2,~0,i1 |
| r2844 | r2845 | |
| 1994 | 1989 | case 0x2a: /* SWL - MIPS I */ |
| 1995 | 1990 | UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL |
| 1996 | 1991 | UML_SHL(block, IREG(3), IREG(0), IMM(3)); // shl i3,i0,3 |
| 1992 | UML_AND(block, IREG(0), IREG(0), IMM(~3)); // and i0,i0,~3 | |
| 1997 | 1993 | UML_MOV(block, IREG(1), R32(RTREG)); // mov i1,<rtreg> |
| 1998 | 1994 | if (!mips3->bigendian) |
| 1999 | 1995 | UML_XOR(block, IREG(3), IREG(3), IMM(0x18)); // xor i3,i3,0x18 |
| r2844 | r2845 | |
| 2008 | 2004 | case 0x2e: /* SWR - MIPS I */ |
| 2009 | 2005 | UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL |
| 2010 | 2006 | UML_SHL(block, IREG(3), IREG(0), IMM(3)); // shl i3,i0,3 |
| 2007 | UML_AND(block, IREG(0), IREG(0), IMM(~3)); // and i0,i0,~3 | |
| 2011 | 2008 | UML_MOV(block, IREG(1), R32(RTREG)); // mov i1,<rtreg> |
| 2012 | 2009 | if (mips3->bigendian) |
| 2013 | 2010 | UML_XOR(block, IREG(3), IREG(3), IMM(0x18)); // xor i3,i3,0x18 |
| r2844 | r2845 | |
| 2022 | 2019 | case 0x2c: /* SDL - MIPS III */ |
| 2023 | 2020 | UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL |
| 2024 | 2021 | UML_SHL(block, IREG(3), IREG(0), IMM(3)); // shl i3,i0,3 |
| 2022 | UML_AND(block, IREG(0), IREG(0), IMM(~7)); // and i0,i0,~7 | |
| 2025 | 2023 | UML_DMOV(block, IREG(1), R64(RTREG)); // dmov i1,<rtreg> |
| 2026 | 2024 | if (!mips3->bigendian) |
| 2027 | 2025 | UML_XOR(block, IREG(3), IREG(3), IMM(0x38)); // xor i3,i3,0x38 |
| r2844 | r2845 | |
| 2036 | 2034 | case 0x2d: /* SDR - MIPS III */ |
| 2037 | 2035 | UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL |
| 2038 | 2036 | UML_SHL(block, IREG(3), IREG(0), IMM(3)); // shl i3,i0,3 |
| 2037 | UML_AND(block, IREG(0), IREG(0), IMM(~7)); // and i0,i0,~7 | |
| 2039 | 2038 | UML_DMOV(block, IREG(1), R64(RTREG)); // dmov i1,<rtreg> |
| 2040 | 2039 | if (mips3->bigendian) |
| 2041 | 2040 | UML_XOR(block, IREG(3), IREG(3), IMM(0x38)); // xor i3,i3,0x38 |
| r2844 | r2845 | |
| 2229 | 2228 | case 0x20: /* ADD - MIPS I */ |
| 2230 | 2229 | if (mips3->impstate->drcoptions & MIPS3DRC_CHECK_OVERFLOWS) |
| 2231 | 2230 | { |
| 2232 | UML_ADD | |
| 2231 | UML_ADD | |
| 2233 | 2232 | UML_EXHc(block, IF_V, mips3->impstate->exception[EXCEPTION_OVERFLOW], IMM(0)); |
| 2234 | 2233 | // exh overflow,0,V |
| 2235 | 2234 | if (RDREG != 0) |
| r2844 | r2845 | |
| 2253 | 2252 | case 0x2c: /* DADD - MIPS III */ |
| 2254 | 2253 | if (mips3->impstate->drcoptions & MIPS3DRC_CHECK_OVERFLOWS) |
| 2255 | 2254 | { |
| 2256 | UML_DADD | |
| 2255 | UML_DADD | |
| 2257 | 2256 | UML_EXHc(block, IF_V, mips3->impstate->exception[EXCEPTION_OVERFLOW], IMM(0)); |
| 2258 | 2257 | // exh overflow,0,V |
| 2259 | 2258 | if (RDREG != 0) |
| r2844 | r2845 | |
| 2271 | 2270 | case 0x22: /* SUB - MIPS I */ |
| 2272 | 2271 | if (mips3->impstate->drcoptions & MIPS3DRC_CHECK_OVERFLOWS) |
| 2273 | 2272 | { |
| 2274 | UML_SUB | |
| 2273 | UML_SUB | |
| 2275 | 2274 | UML_EXHc(block, IF_V, mips3->impstate->exception[EXCEPTION_OVERFLOW], IMM(0)); |
| 2276 | 2275 | // exh overflow,0,V |
| 2277 | 2276 | if (RDREG != 0) |
| r2844 | r2845 | |
| 2295 | 2294 | case 0x2e: /* DSUB - MIPS III */ |
| 2296 | 2295 | if (mips3->impstate->drcoptions & MIPS3DRC_CHECK_OVERFLOWS) |
| 2297 | 2296 | { |
| 2298 | UML_DSUB | |
| 2297 | UML_DSUB | |
| 2299 | 2298 | UML_EXHc(block, IF_V, mips3->impstate->exception[EXCEPTION_OVERFLOW], IMM(0)); |
| 2300 | 2299 | // exh overflow,0,V |
| 2301 | 2300 | if (RDREG != 0) |
| r2844 | r2845 | |
| 2607 | 2606 | if (RSREG != 0 && RTREG != 0) |
| 2608 | 2607 | { |
| 2609 | 2608 | UML_MULS(block, IREG(0), IREG(1), R32(RSREG), R32(RTREG)); // muls i0,i1,rsreg,rtreg |
| 2610 | UML_ADD | |
| 2609 | UML_ADD | |
| 2611 | 2610 | UML_ADDC(block, IREG(1), IREG(1), HI32); // addc i1,i1,hi |
| 2612 | 2611 | UML_DSEXT(block, LO64, IREG(0), DWORD); // dsext lo,i0,dword |
| 2613 | 2612 | UML_DSEXT(block, HI64, IREG(1), DWORD); // dsext hi,i1,dword |
| r2844 | r2845 | |
| 2618 | 2617 | if (RSREG != 0 && RTREG != 0) |
| 2619 | 2618 | { |
| 2620 | 2619 | UML_MULU(block, IREG(0), IREG(1), R32(RSREG), R32(RTREG)); // mulu i0,i1,rsreg,rtreg |
| 2621 | UML_ADD | |
| 2620 | UML_ADD | |
| 2622 | 2621 | UML_ADDC(block, IREG(1), IREG(1), HI32); // addc i1,i1,hi |
| 2623 | 2622 | UML_DSEXT(block, LO64, IREG(0), DWORD); // dsext lo,i0,dword |
| 2624 | 2623 | UML_DSEXT(block, HI64, IREG(1), DWORD); // dsext hi,i1,dword |
| r2844 | r2845 | |
| 2737 | 2736 | UML_DSUB(block, IREG(0), MEM(&mips3->impstate->numcycles), MEM(&mips3->count_zero_time)); |
| 2738 | 2737 | // dsub i0,[numcycles],[count_zero_time] |
| 2739 | 2738 | UML_AND(block, IREG(1), CPR032(COP0_Wired), IMM(0x3f)); // and i1,[Wired],0x3f |
| 2740 | UML_SUB | |
| 2739 | UML_SUB | |
| 2741 | 2740 | UML_JMPc(block, IF_BE, link1 = compiler->labelnum++); // jmp link1,BE |
| 2742 | 2741 | UML_DAND(block, IREG(2), IREG(2), IMM(0xffffffff)); // dand i2,i2,0xffffffff |
| 2743 | 2742 | UML_DDIVU(block, IREG(0), IREG(2), IREG(0), IREG(2)); // ddivu i0,i2,i0,i2 |
| r2844 | r2845 | |
| 3433 | 3432 | log_register_list - log a list of GPR registers |
| 3434 | 3433 | -------------------------------------------------*/ |
| 3435 | 3434 | |
| 3436 | static void log_register_list(drcuml_state *drcuml, const char *string, UINT | |
| 3435 | static void log_register_list(drcuml_state *drcuml, const char *string, const UINT32 * | |
| 3437 | 3436 | { |
| 3438 | 3437 | int count = 0; |
| 3439 | 3438 | int regnum; |
| 3440 | 3439 | |
| 3441 | 3440 | /* skip if nothing */ |
| 3442 | if ( | |
| 3441 | if ( | |
| 3443 | 3442 | return; |
| 3444 | 3443 | |
| 3445 | 3444 | drcuml_log_printf(drcuml, "[%s:", string); |
| 3446 | 3445 | |
| 3447 | 3446 | for (regnum = 1; regnum < 32; regnum++) |
| 3448 | if (gprmask & ((UINT64)1 << regnum)) | |
| 3447 | if (reglist[0] & REGFLAG_R(regnum)) | |
| 3448 | { | |
| 3449 | 3449 | drcuml_log_printf(drcuml, "%sr%d", (count++ == 0) ? "" : ",", regnum); |
| 3450 | if (gprmask & ((UINT64)1 << REG_LO)) | |
| 3450 | if (regnostarlist != NULL && !(regnostarlist[0] & REGFLAG_R(regnum))) | |
| 3451 | drcuml_log_printf(drcuml, "*"); | |
| 3452 | } | |
| 3453 | ||
| 3454 | for (regnum = 0; regnum < 32; regnum++) | |
| 3455 | if (reglist[1] & REGFLAG_CPR1(regnum)) | |
| 3456 | { | |
| 3457 | drcuml_log_printf(drcuml, "%sfr%d", (count++ == 0) ? "" : ",", regnum); | |
| 3458 | if (regnostarlist != NULL && !(regnostarlist[1] & REGFLAG_CPR1(regnum))) | |
| 3459 | drcuml_log_printf(drcuml, "*"); | |
| 3460 | } | |
| 3461 | ||
| 3462 | if (reglist[2] & REGFLAG_LO) | |
| 3463 | { | |
| 3451 | 3464 | drcuml_log_printf(drcuml, "%slo", (count++ == 0) ? "" : ","); |
| 3452 | if (gprmask & ((UINT64)1 << REG_HI)) | |
| 3465 | if (regnostarlist != NULL && !(regnostarlist[2] & REGFLAG_LO)) | |
| 3466 | drcuml_log_printf(drcuml, "*"); | |
| 3467 | } | |
| 3468 | if (reglist[2] & REGFLAG_HI) | |
| 3469 | { | |
| 3453 | 3470 | drcuml_log_printf(drcuml, "%shi", (count++ == 0) ? "" : ","); |
| 3471 | if (regnostarlist != NULL && !(regnostarlist[2] & REGFLAG_HI)) | |
| 3472 | drcuml_log_printf(drcuml, "*"); | |
| 3473 | } | |
| 3474 | if (reglist[2] & REGFLAG_FCC) | |
| 3475 | { | |
| 3476 | drcuml_log_printf(drcuml, "%sfcc", (count++ == 0) ? "" : ","); | |
| 3477 | if (regnostarlist != NULL && !(regnostarlist[2] & REGFLAG_FCC)) | |
| 3478 | drcuml_log_printf(drcuml, "*"); | |
| 3479 | } | |
| 3454 | 3480 | |
| 3455 | for (regnum = 0; regnum < 32; regnum++) | |
| 3456 | if (fprmask & ((UINT64)1 << regnum)) | |
| 3457 | drcuml_log_printf(drcuml, "%sfpr%d", (count++ == 0) ? "" : ",", regnum); | |
| 3458 | if (fprmask & REGFLAG_FCC) | |
| 3459 | drcuml_log_printf(drcuml, "%sfcc", (count++ == 0) ? "" : ","); | |
| 3460 | 3481 | drcuml_log_printf(drcuml, "] "); |
| 3461 | 3482 | } |
| 3462 | 3483 | |
| r2844 | r2845 | |
| 3488 | 3509 | drcuml_log_printf(drcuml, "%08X [%08X] t:%08X f:%s: %-30s", desclist->pc, desclist->physpc, desclist->targetpc, log_desc_flags_to_string(desclist->flags), buffer); |
| 3489 | 3510 | |
| 3490 | 3511 | /* output register states */ |
| 3491 | log_register_list(drcuml, "use", desclist->gpr.used, desclist->fpr.used); | |
| 3492 | log_register_list(drcuml, "mod", desclist->gpr.modified, desclist->fpr.modified); | |
| 3493 | log_register_list(drcuml, "lrd", desclist->gpr.liveread, desclist->fpr.liveread); | |
| 3494 | log_register_list(drcuml, "lwr", desclist->gpr.livewrite, desclist->fpr.livewrite); | |
| 3512 | log_register_list(drcuml, "use", desclist->regin, NULL); | |
| 3513 | log_register_list(drcuml, "mod", desclist->regout, desclist->regreq); | |
| 3495 | 3514 | drcuml_log_printf(drcuml, "\n"); |
| 3496 | 3515 | |
| 3497 | 3516 | /* if we have a delay slot, output it recursively */ |
| r2844 | r2845 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | * Convert AND 0xff/0xffff to movzx |
| 22 | 22 | |
| 23 | * Convert SUB a,0,b to NEG | |
| 24 | ||
| 25 | * Optimize, e.g., and [r5],i0,$FF to use ebx as temporary register | |
| 26 | (avoid initial move) if i0 is not needed going forward | |
| 27 | ||
| 23 | 28 | **************************************************************************** |
| 24 | 29 | |
| 25 | 30 | --------------- |
| r2844 | r2845 | |
| 65 | 70 | [esp+4] - input parameter (entry handle) |
| 66 | 71 | |
| 67 | 72 | Runtime stack: |
| 68 | [esp] - temporary space for hash jump | |
| 69 | [esp+4] - saved ebp | |
| 70 | [esp+8] - saved edi | |
| 71 | [esp+12] - saved esi | |
| 72 | [esp+16] - saved ebx | |
| 73 | [esp+20] - ret | |
| 74 | [esp+24] - input parameter (entry handle) | |
| 73 | [esp] - param 0 | |
| 74 | [esp+4] - param 1 | |
| 75 | [esp+8] - param 2 | |
| 76 | [esp+12] - param 3 | |
| 77 | [esp+16] - param 4 | |
| 78 | [esp+20] - alignment | |
| 79 | [esp+24] - alignment | |
| 80 | [esp+28] - saved ebp | |
| 81 | [esp+32] - saved edi | |
| 82 | [esp+36] - saved esi | |
| 83 | [esp+40] - saved ebx | |
| 84 | [esp+44] - ret | |
| 85 | [esp+48] - input parameter (entry handle) | |
| 75 | 86 | |
| 76 | 87 | ***************************************************************************/ |
| 77 | 88 | |
| 78 | 89 | #include "drcuml.h" |
| 79 | #include "drcumld.h" | |
| 80 | 90 | #include "drcbeut.h" |
| 81 | 91 | #include "debugger.h" |
| 82 | 92 | #include "x86emit.h" |
| r2844 | r2845 | |
| 116 | 126 | MACROS |
| 117 | 127 | ***************************************************************************/ |
| 118 | 128 | |
| 119 | #define X86_CONDITION(condflags) (condition_map[condflags - DRCUML_COND_Z]) | |
| 120 | #define X86_NOT_CONDITION(condflags) (condition_map[condflags - DRCUML_COND_Z] ^ 1) | |
| 129 | #define X86_CONDITION(condition) (condition_map[condition - DRCUML_COND_Z]) | |
| 130 | #define X86_NOT_CONDITION(condition) (condition_map[condition - DRCUML_COND_Z] ^ 1) | |
| 121 | 131 | |
| 132 | #define assert_no_condition(inst) assert((inst)->condition == DRCUML_COND_ALWAYS) | |
| 133 | #define assert_any_condition(inst) assert((inst)->condition == DRCUML_COND_ALWAYS || ((inst)->condition >= DRCUML_COND_Z && (inst)->condition < DRCUML_COND_MAX)) | |
| 134 | #define assert_no_flags(inst) assert((inst)->flags == 0) | |
| 135 | #define assert_flags(inst, valid) assert(((inst)->flags & ~(valid)) == 0) | |
| 122 | 136 | |
| 123 | 137 | |
| 138 | ||
| 124 | 139 | /*************************************************************************** |
| 125 | 140 | TYPE DEFINITIONS |
| 126 | 141 | ***************************************************************************/ |
| r2844 | r2845 | |
| 271 | 286 | static x86code *op_comment(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); |
| 272 | 287 | static x86code *op_mapvar(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); |
| 273 | 288 | |
| 289 | static x86code *op_nop(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); | |
| 274 | 290 | static x86code *op_debug(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); |
| 275 | 291 | static x86code *op_exit(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); |
| 276 | 292 | static x86code *op_hashjmp(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst); |
| r2844 | r2845 | |
| 354 | 370 | { DRCUML_OP_MAPVAR, op_mapvar }, /* MAPVAR mapvar,value */ |
| 355 | 371 | |
| 356 | 372 | /* Control Flow Operations */ |
| 373 | { DRCUML_OP_NOP, op_nop }, /* NOP */ | |
| 357 | 374 | { DRCUML_OP_DEBUG, op_debug }, /* DEBUG pc */ |
| 358 | 375 | { DRCUML_OP_EXIT, op_exit }, /* EXIT src1[,c] */ |
| 359 | 376 | { DRCUML_OP_HASHJMP, op_hashjmp }, /* HASHJMP mode,pc,handle */ |
| r2844 | r2845 | |
| 368 | 385 | { DRCUML_OP_SETFMOD, op_setfmod }, /* SETFMOD src */ |
| 369 | 386 | { DRCUML_OP_GETFMOD, op_getfmod }, /* GETFMOD dst */ |
| 370 | 387 | { DRCUML_OP_GETEXP, op_getexp }, /* GETEXP dst */ |
| 371 | { DRCUML_OP_GETFLGS, op_getflgs }, /* GETFLGS dst | |
| 388 | { DRCUML_OP_GETFLGS, op_getflgs }, /* GETFLGS dst | |
| 372 | 389 | { DRCUML_OP_SAVE, op_save }, /* SAVE dst */ |
| 373 | 390 | { DRCUML_OP_RESTORE, op_restore }, /* RESTORE dst */ |
| 374 | 391 | |
| r2844 | r2845 | |
| 631 | 648 | emit_push_r32(dst, REG_ESI); // push esi |
| 632 | 649 | emit_push_r32(dst, REG_EDI); // push edi |
| 633 | 650 | emit_push_r32(dst, REG_EBP); // push ebp |
| 651 | emit_sub_r32_imm(dst, REG_ESP, 24); // sub esp,24 | |
| 634 | 652 | emit_mov_m32_r32(dst, MABS(&drcbe->hashstacksave), REG_ESP); // mov [hashstacksave],esp |
| 635 | 653 | emit_sub_r32_imm(dst, REG_ESP, 4); // sub esp,4 |
| 636 | 654 | emit_mov_m32_r32(dst, MABS(&drcbe->stacksave), REG_ESP); // mov [stacksave],esp |
| r2844 | r2845 | |
| 643 | 661 | drcbe->exit = *dst; |
| 644 | 662 | emit_fldcw_m16(dst, MABS(&drcbe->fpumode)); // fldcw [fpumode] |
| 645 | 663 | emit_mov_r32_m32(dst, REG_ESP, MABS(&drcbe->hashstacksave)); // mov esp,[hashstacksave] |
| 664 | emit_add_r32_imm(dst, REG_ESP, 24); // add esp,24 | |
| 646 | 665 | emit_pop_r32(dst, REG_EBP); // pop ebp |
| 647 | 666 | emit_pop_r32(dst, REG_EDI); // pop edi |
| 648 | 667 | emit_pop_r32(dst, REG_ESI); // pop esi |
| r2844 | r2845 | |
| 714 | 733 | /* add a comment */ |
| 715 | 734 | if (drcbe->log != NULL) |
| 716 | 735 | { |
| 717 | char dasm[100]; | |
| 718 | drcuml_disasm(inst, dasm); | |
| 736 | char dasm[256]; | |
| 737 | drcuml_disasm(inst, dasm, drcbe->drcuml); | |
| 719 | 738 | x86log_add_comment(drcbe->log, dst, "%s", dasm); |
| 720 | 739 | } |
| 721 | 740 | |
| r2844 | r2845 | |
| 798 | 817 | dest->value = src->value; |
| 799 | 818 | break; |
| 800 | 819 | |
| 801 | /* mapvars are converted to immediates with their current value */ | |
| 802 | case DRCUML_PTYPE_MAPVAR: | |
| 803 | assert(allowed & PTYPE_I); | |
| 804 | dest->type = DRCUML_PTYPE_IMMEDIATE; | |
| 805 | dest->value = drcmap_get_last_value(drcbe->map, src->value); | |
| 806 | break; | |
| 807 | ||
| 808 | 820 | /* memory passes through */ |
| 809 | 821 | case DRCUML_PTYPE_MEMORY: |
| 810 | 822 | assert(allowed & PTYPE_M); |
| r2844 | r2845 | |
| 1032 | 1044 | |
| 1033 | 1045 | |
| 1034 | 1046 | /*------------------------------------------------- |
| 1047 | emit_mov_r32_p32_keepflags - move a 32-bit | |
| 1048 | parameter into a register without affecting | |
| 1049 | any flags | |
| 1050 | -------------------------------------------------*/ | |
| 1051 | ||
| 1052 | static void emit_mov_r32_p32_keepflags(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param) | |
| 1053 | { | |
| 1054 | if (param->type == DRCUML_PTYPE_IMMEDIATE) | |
| 1055 | emit_mov_r32_imm(dst, reg, param->value); // mov reg,param | |
| 1056 | else if (param->type == DRCUML_PTYPE_MEMORY) | |
| 1057 | emit_mov_r32_m32(dst, reg, MABS(param->value)); // mov reg,[param] | |
| 1058 | else if (param->type == DRCUML_PTYPE_INT_REGISTER) | |
| 1059 | { | |
| 1060 | if (reg != param->value) | |
| 1061 | emit_mov_r32_r32(dst, reg, param->value); // mov reg,param | |
| 1062 | } | |
| 1063 | } | |
| 1064 | ||
| 1065 | ||
| 1066 | /*------------------------------------------------- | |
| 1035 | 1067 | emit_mov_m32_p32 - move a 32-bit parameter |
| 1036 | 1068 | into a memory location |
| 1037 | 1069 | -------------------------------------------------*/ |
| r2844 | r2845 | |
| 1069 | 1101 | |
| 1070 | 1102 | |
| 1071 | 1103 | /*------------------------------------------------- |
| 1072 | emit_push_p32 - push a 32-bit parameter onto | |
| 1073 | the stack | |
| 1074 | -------------------------------------------------*/ | |
| 1075 | ||
| 1076 | static void emit_push_p32(drcbe_state *drcbe, x86code **dst, const drcuml_parameter *src) | |
| 1077 | { | |
| 1078 | if (src->type == DRCUML_PTYPE_IMMEDIATE) | |
| 1079 | emit_push_imm(dst, src->value); // push src | |
| 1080 | else if (src->type == DRCUML_PTYPE_MEMORY) | |
| 1081 | emit_push_m32(dst, MABS(src->value)); // push [src] | |
| 1082 | else if (src->type == DRCUML_PTYPE_INT_REGISTER) | |
| 1083 | emit_push_r32(dst, src->value); // push src | |
| 1084 | } | |
| 1085 | ||
| 1086 | ||
| 1087 | /*------------------------------------------------- | |
| 1088 | 1104 | emit_add_r32_p32 - add operation to a 32-bit |
| 1089 | 1105 | register from a 32-bit parameter |
| 1090 | 1106 | -------------------------------------------------*/ |
| r2844 | r2845 | |
| 1093 | 1109 | { |
| 1094 | 1110 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1095 | 1111 | { |
| 1096 | if (inst-> | |
| 1112 | if (inst-> | |
| 1097 | 1113 | emit_add_r32_imm(dst, reg, param->value); // add reg,param |
| 1098 | 1114 | } |
| 1099 | 1115 | else if (param->type == DRCUML_PTYPE_MEMORY) |
| r2844 | r2845 | |
| 1112 | 1128 | { |
| 1113 | 1129 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1114 | 1130 | { |
| 1115 | if (inst-> | |
| 1131 | if (inst-> | |
| 1116 | 1132 | emit_add_m32_imm(dst, MEMPARAMS, param->value); // add [dest],param |
| 1117 | 1133 | } |
| 1118 | 1134 | else |
| r2844 | r2845 | |
| 1132 | 1148 | static void emit_adc_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1133 | 1149 | { |
| 1134 | 1150 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1135 | { | |
| 1136 | if (inst->condflags != 0 || param->value != 0) | |
| 1137 | emit_adc_r32_imm(dst, reg, param->value); // adc reg,param | |
| 1138 | } | |
| 1151 | emit_adc_r32_imm(dst, reg, param->value); // adc reg,param | |
| 1139 | 1152 | else if (param->type == DRCUML_PTYPE_MEMORY) |
| 1140 | 1153 | emit_adc_r32_m32(dst, reg, MABS(param->value)); // adc reg,[param] |
| 1141 | 1154 | else if (param->type == DRCUML_PTYPE_INT_REGISTER) |
| r2844 | r2845 | |
| 1151 | 1164 | static void emit_adc_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1152 | 1165 | { |
| 1153 | 1166 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1154 | { | |
| 1155 | if (inst->condflags != 0 || param->value != 0) | |
| 1156 | emit_adc_m32_imm(dst, MEMPARAMS, param->value); // adc [dest],param | |
| 1157 | } | |
| 1167 | emit_adc_m32_imm(dst, MEMPARAMS, param->value); // adc [dest],param | |
| 1158 | 1168 | else |
| 1159 | 1169 | { |
| 1160 | 1170 | int reg = param_select_register(REG_EAX, param, NULL); |
| 1161 | emit_mov_r32_p32(drcbe, dst, reg, param); | |
| 1171 | emit_mov_r32_p32_keepflags(drcbe, dst, reg, param); | |
| 1162 | 1172 | emit_adc_m32_r32(dst, MEMPARAMS, reg); // adc [dest],reg |
| 1163 | 1173 | } |
| 1164 | 1174 | } |
| r2844 | r2845 | |
| 1173 | 1183 | { |
| 1174 | 1184 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1175 | 1185 | { |
| 1176 | if (inst-> | |
| 1186 | if (inst-> | |
| 1177 | 1187 | emit_sub_r32_imm(dst, reg, param->value); // sub reg,param |
| 1178 | 1188 | } |
| 1179 | 1189 | else if (param->type == DRCUML_PTYPE_MEMORY) |
| r2844 | r2845 | |
| 1192 | 1202 | { |
| 1193 | 1203 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1194 | 1204 | { |
| 1195 | if (inst-> | |
| 1205 | if (inst-> | |
| 1196 | 1206 | emit_sub_m32_imm(dst, MEMPARAMS, param->value); // sub [dest],param |
| 1197 | 1207 | } |
| 1198 | 1208 | else |
| r2844 | r2845 | |
| 1212 | 1222 | static void emit_sbb_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1213 | 1223 | { |
| 1214 | 1224 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1215 | { | |
| 1216 | if (inst->condflags != 0 || param->value != 0) | |
| 1217 | emit_sbb_r32_imm(dst, reg, param->value); // sbb reg,param | |
| 1218 | } | |
| 1225 | emit_sbb_r32_imm(dst, reg, param->value); // sbb reg,param | |
| 1219 | 1226 | else if (param->type == DRCUML_PTYPE_MEMORY) |
| 1220 | 1227 | emit_sbb_r32_m32(dst, reg, MABS(param->value)); // sbb reg,[param] |
| 1221 | 1228 | else if (param->type == DRCUML_PTYPE_INT_REGISTER) |
| r2844 | r2845 | |
| 1231 | 1238 | static void emit_sbb_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1232 | 1239 | { |
| 1233 | 1240 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1234 | { | |
| 1235 | if (inst->condflags != 0 || param->value != 0) | |
| 1236 | emit_sbb_m32_imm(dst, MEMPARAMS, param->value); // sbb [dest],param | |
| 1237 | } | |
| 1241 | emit_sbb_m32_imm(dst, MEMPARAMS, param->value); // sbb [dest],param | |
| 1238 | 1242 | else |
| 1239 | 1243 | { |
| 1240 | 1244 | int reg = param_select_register(REG_EAX, param, NULL); |
| 1241 | emit_mov_r32_p32(drcbe, dst, reg, param); | |
| 1245 | emit_mov_r32_p32_keepflags(drcbe, dst, reg, param); | |
| 1242 | 1246 | emit_sbb_m32_r32(dst, MEMPARAMS, reg); // sbb [dest],reg |
| 1243 | 1247 | } |
| 1244 | 1248 | } |
| r2844 | r2845 | |
| 1325 | 1329 | { |
| 1326 | 1330 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1327 | 1331 | { |
| 1328 | if (inst-> | |
| 1332 | if (inst-> | |
| 1329 | 1333 | /* skip */; |
| 1330 | else if (inst-> | |
| 1334 | else if (inst-> | |
| 1331 | 1335 | emit_xor_r32_r32(dst, reg, reg); // xor reg,reg |
| 1332 | 1336 | else |
| 1333 | 1337 | emit_and_r32_imm(dst, reg, param->value); // and reg,param |
| r2844 | r2845 | |
| 1348 | 1352 | { |
| 1349 | 1353 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1350 | 1354 | { |
| 1351 | if (inst-> | |
| 1355 | if (inst-> | |
| 1352 | 1356 | /* skip */; |
| 1353 | else if (inst-> | |
| 1357 | else if (inst-> | |
| 1354 | 1358 | emit_mov_m32_imm(dst, MEMPARAMS, 0); // mov [dest],0 |
| 1355 | 1359 | else |
| 1356 | 1360 | emit_and_m32_imm(dst, MEMPARAMS, param->value); // and [dest],param |
| r2844 | r2845 | |
| 1408 | 1412 | { |
| 1409 | 1413 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1410 | 1414 | { |
| 1411 | if (inst-> | |
| 1415 | if (inst-> | |
| 1412 | 1416 | /* skip */; |
| 1413 | else if (inst-> | |
| 1417 | else if (inst-> | |
| 1414 | 1418 | emit_mov_r32_imm(dst, reg, -1); // mov reg,-1 |
| 1415 | 1419 | else |
| 1416 | 1420 | emit_or_r32_imm(dst, reg, param->value); // or reg,param |
| r2844 | r2845 | |
| 1431 | 1435 | { |
| 1432 | 1436 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1433 | 1437 | { |
| 1434 | if (inst-> | |
| 1438 | if (inst-> | |
| 1435 | 1439 | /* skip */; |
| 1436 | else if (inst-> | |
| 1440 | else if (inst-> | |
| 1437 | 1441 | emit_mov_m32_imm(dst, MEMPARAMS, -1); // mov [dest],-1 |
| 1438 | 1442 | else |
| 1439 | 1443 | emit_or_m32_imm(dst, MEMPARAMS, param->value); // or [dest],param |
| r2844 | r2845 | |
| 1456 | 1460 | { |
| 1457 | 1461 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1458 | 1462 | { |
| 1459 | if (inst-> | |
| 1463 | if (inst-> | |
| 1460 | 1464 | /* skip */; |
| 1461 | else if (inst-> | |
| 1465 | else if (inst-> | |
| 1462 | 1466 | emit_not_r32(dst, reg); // not reg |
| 1463 | 1467 | else |
| 1464 | 1468 | emit_xor_r32_imm(dst, reg, param->value); // xor reg,param |
| r2844 | r2845 | |
| 1479 | 1483 | { |
| 1480 | 1484 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1481 | 1485 | { |
| 1482 | if (inst-> | |
| 1486 | if (inst-> | |
| 1483 | 1487 | /* skip */; |
| 1484 | else if (inst-> | |
| 1488 | else if (inst-> | |
| 1485 | 1489 | emit_not_m32(dst, MEMPARAMS); // not [dest] |
| 1486 | 1490 | else |
| 1487 | 1491 | emit_xor_m32_imm(dst, MEMPARAMS, param->value); // xor [dest],param |
| r2844 | r2845 | |
| 1504 | 1508 | { |
| 1505 | 1509 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1506 | 1510 | { |
| 1507 | if (inst-> | |
| 1511 | if (inst-> | |
| 1508 | 1512 | /* skip */; |
| 1509 | 1513 | else |
| 1510 | 1514 | emit_shl_r32_imm(dst, reg, param->value); // shl reg,param |
| r2844 | r2845 | |
| 1526 | 1530 | { |
| 1527 | 1531 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1528 | 1532 | { |
| 1529 | if (inst-> | |
| 1533 | if (inst-> | |
| 1530 | 1534 | /* skip */; |
| 1531 | 1535 | else |
| 1532 | 1536 | emit_shl_m32_imm(dst, MEMPARAMS, param->value); // shl [dest],param |
| r2844 | r2845 | |
| 1548 | 1552 | { |
| 1549 | 1553 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1550 | 1554 | { |
| 1551 | if (inst-> | |
| 1555 | if (inst-> | |
| 1552 | 1556 | /* skip */; |
| 1553 | 1557 | else |
| 1554 | 1558 | emit_shr_r32_imm(dst, reg, param->value); // shr reg,param |
| r2844 | r2845 | |
| 1570 | 1574 | { |
| 1571 | 1575 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1572 | 1576 | { |
| 1573 | if (inst-> | |
| 1577 | if (inst-> | |
| 1574 | 1578 | /* skip */; |
| 1575 | 1579 | else |
| 1576 | 1580 | emit_shr_m32_imm(dst, MEMPARAMS, param->value); // shr [dest],param |
| r2844 | r2845 | |
| 1592 | 1596 | { |
| 1593 | 1597 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1594 | 1598 | { |
| 1595 | if (inst-> | |
| 1599 | if (inst-> | |
| 1596 | 1600 | /* skip */; |
| 1597 | 1601 | else |
| 1598 | 1602 | emit_sar_r32_imm(dst, reg, param->value); // sar reg,param |
| r2844 | r2845 | |
| 1614 | 1618 | { |
| 1615 | 1619 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1616 | 1620 | { |
| 1617 | if (inst-> | |
| 1621 | if (inst-> | |
| 1618 | 1622 | /* skip */; |
| 1619 | 1623 | else |
| 1620 | 1624 | emit_sar_m32_imm(dst, MEMPARAMS, param->value); // sar [dest],param |
| r2844 | r2845 | |
| 1636 | 1640 | { |
| 1637 | 1641 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1638 | 1642 | { |
| 1639 | if (inst-> | |
| 1643 | if (inst-> | |
| 1640 | 1644 | /* skip */; |
| 1641 | 1645 | else |
| 1642 | 1646 | emit_rol_r32_imm(dst, reg, param->value); // rol reg,param |
| r2844 | r2845 | |
| 1658 | 1662 | { |
| 1659 | 1663 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1660 | 1664 | { |
| 1661 | if (inst-> | |
| 1665 | if (inst-> | |
| 1662 | 1666 | /* skip */; |
| 1663 | 1667 | else |
| 1664 | 1668 | emit_rol_m32_imm(dst, MEMPARAMS, param->value); // rol [dest],param |
| r2844 | r2845 | |
| 1680 | 1684 | { |
| 1681 | 1685 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1682 | 1686 | { |
| 1683 | if (inst-> | |
| 1687 | if (inst-> | |
| 1684 | 1688 | /* skip */; |
| 1685 | 1689 | else |
| 1686 | 1690 | emit_ror_r32_imm(dst, reg, param->value); // ror reg,param |
| r2844 | r2845 | |
| 1702 | 1706 | { |
| 1703 | 1707 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1704 | 1708 | { |
| 1705 | if (inst-> | |
| 1709 | if (inst-> | |
| 1706 | 1710 | /* skip */; |
| 1707 | 1711 | else |
| 1708 | 1712 | emit_ror_m32_imm(dst, MEMPARAMS, param->value); // ror [dest],param |
| r2844 | r2845 | |
| 1724 | 1728 | { |
| 1725 | 1729 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1726 | 1730 | { |
| 1727 | if (inst-> | |
| 1731 | if (inst-> | |
| 1728 | 1732 | /* skip */; |
| 1729 | 1733 | else |
| 1730 | 1734 | emit_rcl_r32_imm(dst, reg, param->value); // rcl reg,param |
| 1731 | 1735 | } |
| 1732 | 1736 | else |
| 1733 | 1737 | { |
| 1734 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); | |
| 1738 | emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); | |
| 1735 | 1739 | emit_rcl_r32_cl(dst, reg); // rcl reg,cl |
| 1736 | 1740 | } |
| 1737 | 1741 | } |
| r2844 | r2845 | |
| 1746 | 1750 | { |
| 1747 | 1751 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1748 | 1752 | { |
| 1749 | if (inst-> | |
| 1753 | if (inst-> | |
| 1750 | 1754 | /* skip */; |
| 1751 | 1755 | else |
| 1752 | 1756 | emit_rcl_m32_imm(dst, MEMPARAMS, param->value); // rcl [dest],param |
| 1753 | 1757 | } |
| 1754 | 1758 | else |
| 1755 | 1759 | { |
| 1756 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); | |
| 1760 | emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); | |
| 1757 | 1761 | emit_rcl_m32_cl(dst, MEMPARAMS); // rcl [dest],cl |
| 1758 | 1762 | } |
| 1759 | 1763 | } |
| r2844 | r2845 | |
| 1768 | 1772 | { |
| 1769 | 1773 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1770 | 1774 | { |
| 1771 | if (inst-> | |
| 1775 | if (inst-> | |
| 1772 | 1776 | /* skip */; |
| 1773 | 1777 | else |
| 1774 | 1778 | emit_rcr_r32_imm(dst, reg, param->value); // rcr reg,param |
| 1775 | 1779 | } |
| 1776 | 1780 | else |
| 1777 | 1781 | { |
| 1778 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); | |
| 1782 | emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); | |
| 1779 | 1783 | emit_rcr_r32_cl(dst, reg); // rcr reg,cl |
| 1780 | 1784 | } |
| 1781 | 1785 | } |
| r2844 | r2845 | |
| 1790 | 1794 | { |
| 1791 | 1795 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1792 | 1796 | { |
| 1793 | if (inst-> | |
| 1797 | if (inst-> | |
| 1794 | 1798 | /* skip */; |
| 1795 | 1799 | else |
| 1796 | 1800 | emit_rcr_m32_imm(dst, MEMPARAMS, param->value); // rcr [dest],param |
| 1797 | 1801 | } |
| 1798 | 1802 | else |
| 1799 | 1803 | { |
| 1800 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); | |
| 1804 | emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); | |
| 1801 | 1805 | emit_rcr_m32_cl(dst, MEMPARAMS); // rcr [dest],cl |
| 1802 | 1806 | } |
| 1803 | 1807 | } |
| r2844 | r2845 | |
| 1841 | 1845 | |
| 1842 | 1846 | |
| 1843 | 1847 | /*------------------------------------------------- |
| 1844 | emit_mov_p64_r64 - move a pair of registers | |
| 1845 | into a 64-bit parameter | |
| 1848 | emit_mov_r64_p64_keepflags - move a 64-bit | |
| 1849 | parameter into a pair of registers without | |
| 1850 | affecting any flags | |
| 1846 | 1851 | -------------------------------------------------*/ |
| 1847 | 1852 | |
| 1848 | static void emit_mov_ | |
| 1853 | static void emit_mov_r64_p64_keepflags(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param | |
| 1849 | 1854 | { |
| 1850 | assert(param->type != DRCUML_PTYPE_IMMEDIATE); | |
| 1851 | if (param->type == DRCUML_PTYPE_MEMORY) | |
| 1855 | if (param->type == DRCUML_PTYPE_IMMEDIATE) | |
| 1852 | 1856 | { |
| 1853 | emit_mov_m32_r32(dst, MABS(param->value), reglo); // mov [param],reglo | |
| 1854 | emit_mov_m32_r32(dst, MABS(param->value + 4), reghi); // mov [param+4],reghi | |
| 1857 | emit_mov_r32_imm(dst, reglo, param->value); // mov reglo,param | |
| 1858 | emit_mov_r32_imm(dst, reghi, param->value >> 32); // mov reghi,param >> 32 | |
| 1855 | 1859 | } |
| 1860 | else if (param->type == DRCUML_PTYPE_MEMORY) | |
| 1861 | { | |
| 1862 | emit_mov_r32_m32(dst, reglo, MABS(param->value)); // mov reglo,[param] | |
| 1863 | emit_mov_r32_m32(dst, reghi, MABS(param->value + 4)); // mov reghi,[param+4] | |
| 1864 | } | |
| 1856 | 1865 | else if (param->type == DRCUML_PTYPE_INT_REGISTER) |
| 1857 | 1866 | { |
| 1858 | 1867 | if (reglo != param->value) |
| 1859 | emit_mov_r32_r32(dst, param->value, reglo); // mov param,reglo | |
| 1860 | emit_mov_m32_r32(dst, MABS(drcbe->reghi[param->value]), reghi); // mov reghi[param],reghi | |
| 1868 | emit_mov_r32_r32(dst, reglo, param->value); // mov reglo,param | |
| 1869 | emit_mov_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value])); // mov reghi,reghi[param] | |
| 1861 | 1870 | } |
| 1862 | 1871 | } |
| 1863 | 1872 | |
| 1864 | 1873 | |
| 1865 | 1874 | /*------------------------------------------------- |
| 1866 | emit_push_p64 - push a 64-bit parameter onto | |
| 1867 | the stack | |
| 1875 | emit_mov_m64_p64 - move a 64-bit parameter | |
| 1876 | into a memory location | |
| 1868 | 1877 | -------------------------------------------------*/ |
| 1869 | 1878 | |
| 1870 | static void emit_ | |
| 1879 | static void emit_mov | |
| 1871 | 1880 | { |
| 1872 | if ( | |
| 1881 | if (param->type == DRCUML_PTYPE_IMMEDIATE) | |
| 1873 | 1882 | { |
| 1874 | emit_push_imm(dst, src->value >> 32); // push src >> 32 | |
| 1875 | emit_push_imm(dst, src->value); // push src | |
| 1883 | emit_mov_m32_imm(dst, MEMPARAMS + 0, param->value); // mov [mem],param | |
| 1884 | emit_mov_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // mov [mem],param >> 32 | |
| 1876 | 1885 | } |
| 1877 | else if ( | |
| 1886 | else if (param->type == DRCUML_PTYPE_MEMORY) | |
| 1878 | 1887 | { |
| 1879 | emit_push_m32(dst, MABS(src->value + 4)); // push [src+4] | |
| 1880 | emit_push_m32(dst, MABS(src->value)); // push [src] | |
| 1888 | emit_mov_r32_m32(dst, REG_EAX, MABS(param->value)); // mov eax,[param] | |
| 1889 | emit_mov_m32_r32(dst, MEMPARAMS + 0, REG_EAX); // mov [mem],eax | |
| 1890 | emit_mov_r32_m32(dst, REG_EAX, MABS(param->value + 4)); // mov eax,[param+4] | |
| 1891 | emit_mov_m32_r32(dst, MEMPARAMS + 4, REG_EAX); // mov [mem+4],eax | |
| 1881 | 1892 | } |
| 1882 | else if ( | |
| 1893 | else if (param->type == DRCUML_PTYPE_INT_REGISTER) | |
| 1883 | 1894 | { |
| 1884 | emit_push_m32(dst, MABS(drcbe->reghi[src->value])); // push reghi[src] | |
| 1885 | emit_push_r32(dst, src->value); // push src | |
| 1895 | emit_mov_m32_r32(dst, MEMPARAMS + 0, param->value); // mov [mem],param | |
| 1896 | emit_mov_r32_m32(dst, REG_EAX, MABS(drcbe->reghi[param->value])); // mov eax,[param.hi] | |
| 1897 | emit_mov_m32_r32(dst, MEMPARAMS + 4, REG_EAX); // mov [mem+4],eax | |
| 1886 | 1898 | } |
| 1887 | 1899 | } |
| 1888 | 1900 | |
| 1889 | 1901 | |
| 1890 | 1902 | /*------------------------------------------------- |
| 1903 | emit_mov_p64_r64 - move a pair of registers | |
| 1904 | into a 64-bit parameter | |
| 1905 | -------------------------------------------------*/ | |
| 1906 | ||
| 1907 | static void emit_mov_p64_r64(drcbe_state *drcbe, x86code **dst, const drcuml_parameter *param, UINT8 reglo, UINT8 reghi) | |
| 1908 | { | |
| 1909 | assert(param->type != DRCUML_PTYPE_IMMEDIATE); | |
| 1910 | if (param->type == DRCUML_PTYPE_MEMORY) | |
| 1911 | { | |
| 1912 | emit_mov_m32_r32(dst, MABS(param->value), reglo); // mov [param],reglo | |
| 1913 | emit_mov_m32_r32(dst, MABS(param->value + 4), reghi); // mov [param+4],reghi | |
| 1914 | } | |
| 1915 | else if (param->type == DRCUML_PTYPE_INT_REGISTER) | |
| 1916 | { | |
| 1917 | if (reglo != param->value) | |
| 1918 | emit_mov_r32_r32(dst, param->value, reglo); // mov param,reglo | |
| 1919 | emit_mov_m32_r32(dst, MABS(drcbe->reghi[param->value]), reghi); // mov reghi[param],reghi | |
| 1920 | } | |
| 1921 | } | |
| 1922 | ||
| 1923 | ||
| 1924 | /*------------------------------------------------- | |
| 1891 | 1925 | emit_add_r64_p64 - add operation to a 64-bit |
| 1892 | 1926 | pair of registers from a 64-bit parameter |
| 1893 | 1927 | -------------------------------------------------*/ |
| 1894 | 1928 | |
| 1895 | 1929 | static void emit_add_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1896 | 1930 | { |
| 1897 | int saveflags = ((inst-> | |
| 1931 | int saveflags = ((inst-> | |
| 1898 | 1932 | if (param->type == DRCUML_PTYPE_MEMORY) |
| 1899 | 1933 | { |
| 1900 | 1934 | emit_add_r32_m32(dst, reglo, MABS(param->value)); // add reglo,[param] |
| r2844 | r2845 | |
| 1925 | 1959 | |
| 1926 | 1960 | static void emit_add_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1927 | 1961 | { |
| 1928 | int saveflags = ((inst-> | |
| 1962 | int saveflags = ((inst-> | |
| 1929 | 1963 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1930 | 1964 | { |
| 1931 | 1965 | emit_add_m32_imm(dst, MEMPARAMS, param->value); // add [dest],param |
| r2844 | r2845 | |
| 1952 | 1986 | |
| 1953 | 1987 | static void emit_adc_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1954 | 1988 | { |
| 1955 | int saveflags = ((inst-> | |
| 1989 | int saveflags = ((inst-> | |
| 1956 | 1990 | if (param->type == DRCUML_PTYPE_MEMORY) |
| 1957 | 1991 | { |
| 1958 | 1992 | emit_adc_r32_m32(dst, reglo, MABS(param->value)); // adc reglo,[param] |
| r2844 | r2845 | |
| 1983 | 2017 | |
| 1984 | 2018 | static void emit_adc_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 1985 | 2019 | { |
| 1986 | int saveflags = ((inst-> | |
| 2020 | int saveflags = ((inst-> | |
| 1987 | 2021 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 1988 | 2022 | { |
| 1989 | 2023 | emit_adc_m32_imm(dst, MEMPARAMS, param->value); // adc [dest],param |
| r2844 | r2845 | |
| 1993 | 2027 | else |
| 1994 | 2028 | { |
| 1995 | 2029 | int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX; |
| 1996 | emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param); | |
| 2030 | emit_mov_r64_p64_keepflags(drcbe, dst, reglo, REG_EDX, param); | |
| 1997 | 2031 | emit_adc_m32_r32(dst, MEMPARAMS, reglo); // adc [dest],reglo |
| 1998 | 2032 | if (saveflags) emit_pushf(dst); // pushf |
| 1999 | 2033 | emit_adc_m32_r32(dst, MEMPARAMS + 4, REG_EDX); // adc [dest+4],edx |
| r2844 | r2845 | |
| 2010 | 2044 | |
| 2011 | 2045 | static void emit_sub_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2012 | 2046 | { |
| 2013 | int saveflags = ((inst-> | |
| 2047 | int saveflags = ((inst-> | |
| 2014 | 2048 | if (param->type == DRCUML_PTYPE_MEMORY) |
| 2015 | 2049 | { |
| 2016 | 2050 | emit_sub_r32_m32(dst, reglo, MABS(param->value)); // sub reglo,[param] |
| r2844 | r2845 | |
| 2041 | 2075 | |
| 2042 | 2076 | static void emit_sub_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2043 | 2077 | { |
| 2044 | int saveflags = ((inst-> | |
| 2078 | int saveflags = ((inst-> | |
| 2045 | 2079 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2046 | 2080 | { |
| 2047 | 2081 | emit_sub_m32_imm(dst, MEMPARAMS, param->value); // sub [dest],param |
| r2844 | r2845 | |
| 2068 | 2102 | |
| 2069 | 2103 | static void emit_sbb_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2070 | 2104 | { |
| 2071 | int saveflags = ((inst-> | |
| 2105 | int saveflags = ((inst-> | |
| 2072 | 2106 | if (param->type == DRCUML_PTYPE_MEMORY) |
| 2073 | 2107 | { |
| 2074 | 2108 | emit_sbb_r32_m32(dst, reglo, MABS(param->value)); // sbb reglo,[param] |
| r2844 | r2845 | |
| 2099 | 2133 | |
| 2100 | 2134 | static void emit_sbb_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2101 | 2135 | { |
| 2102 | int saveflags = ((inst-> | |
| 2136 | int saveflags = ((inst-> | |
| 2103 | 2137 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2104 | 2138 | { |
| 2105 | 2139 | emit_sbb_m32_imm(dst, MEMPARAMS, param->value); // sbb [dest],param |
| r2844 | r2845 | |
| 2109 | 2143 | else |
| 2110 | 2144 | { |
| 2111 | 2145 | int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX; |
| 2112 | emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param); | |
| 2146 | emit_mov_r64_p64_keepflags(drcbe, dst, reglo, REG_EDX, param); | |
| 2113 | 2147 | emit_sbb_m32_r32(dst, MEMPARAMS, reglo); // sbb [dest],reglo |
| 2114 | 2148 | if (saveflags) emit_pushf(dst); // pushf |
| 2115 | 2149 | emit_sbb_m32_r32(dst, MEMPARAMS + 4, REG_EDX); // sbb [dest+4],edx |
| r2844 | r2845 | |
| 2126 | 2160 | |
| 2127 | 2161 | static void emit_and_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2128 | 2162 | { |
| 2129 | int saveflags = ((inst-> | |
| 2163 | int saveflags = ((inst-> | |
| 2130 | 2164 | if (param->type == DRCUML_PTYPE_MEMORY) |
| 2131 | 2165 | { |
| 2132 | 2166 | emit_and_r32_m32(dst, reglo, MABS(param->value)); // and reglo,[param] |
| r2844 | r2845 | |
| 2135 | 2169 | } |
| 2136 | 2170 | else if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2137 | 2171 | { |
| 2138 | if (inst-> | |
| 2172 | if (inst-> | |
| 2139 | 2173 | /* skip */; |
| 2140 | else if (inst-> | |
| 2174 | else if (inst-> | |
| 2141 | 2175 | emit_xor_r32_r32(dst, reglo, reglo); // xor reglo,reglo |
| 2142 | 2176 | else |
| 2143 | 2177 | emit_and_r32_imm(dst, reglo, param->value); // and reglo,param |
| 2144 | 2178 | if (saveflags) emit_pushf(dst); // pushf |
| 2145 | if (inst-> | |
| 2179 | if (inst-> | |
| 2146 | 2180 | /* skip */; |
| 2147 | else if (inst-> | |
| 2181 | else if (inst-> | |
| 2148 | 2182 | emit_xor_r32_r32(dst, reghi, reghi); // xor reghi,reghi |
| 2149 | 2183 | else |
| 2150 | 2184 | emit_and_r32_imm(dst, reghi, param->value >> 32); // and reghi,param >> 32 |
| r2844 | r2845 | |
| 2167 | 2201 | |
| 2168 | 2202 | static void emit_and_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2169 | 2203 | { |
| 2170 | int saveflags = ((inst-> | |
| 2204 | int saveflags = ((inst-> | |
| 2171 | 2205 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2172 | 2206 | { |
| 2173 | if (inst-> | |
| 2207 | if (inst-> | |
| 2174 | 2208 | /* skip */; |
| 2175 | else if (inst-> | |
| 2209 | else if (inst-> | |
| 2176 | 2210 | emit_mov_m32_imm(dst, MEMPARAMS, 0); // mov [dest],0 |
| 2177 | 2211 | else |
| 2178 | 2212 | emit_and_m32_imm(dst, MEMPARAMS, param->value); // and [dest],param |
| 2179 | 2213 | if (saveflags) emit_pushf(dst); // pushf |
| 2180 | if (inst-> | |
| 2214 | if (inst-> | |
| 2181 | 2215 | /* skip */; |
| 2182 | else if (inst-> | |
| 2216 | else if (inst-> | |
| 2183 | 2217 | emit_mov_m32_imm(dst, MEMPARAMS + 4, 0); // mov [dest+4],0 |
| 2184 | 2218 | else |
| 2185 | 2219 | emit_and_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // and [dest+4],param >> 32 |
| r2844 | r2845 | |
| 2204 | 2238 | |
| 2205 | 2239 | static void emit_test_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2206 | 2240 | { |
| 2207 | int saveflags = ((inst-> | |
| 2241 | int saveflags = ((inst-> | |
| 2208 | 2242 | if (param->type == DRCUML_PTYPE_MEMORY) |
| 2209 | 2243 | { |
| 2210 | 2244 | emit_test_m32_r32(dst, MABS(param->value), reglo); // test [param],reglo |
| r2844 | r2845 | |
| 2235 | 2269 | |
| 2236 | 2270 | static void emit_test_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2237 | 2271 | { |
| 2238 | int saveflags = ((inst-> | |
| 2272 | int saveflags = ((inst-> | |
| 2239 | 2273 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2240 | 2274 | { |
| 2241 | 2275 | emit_test_m32_imm(dst, MEMPARAMS, param->value); // test [dest],param |
| r2844 | r2845 | |
| 2262 | 2296 | |
| 2263 | 2297 | static void emit_or_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2264 | 2298 | { |
| 2265 | int saveflags = ((inst-> | |
| 2299 | int saveflags = ((inst-> | |
| 2266 | 2300 | if (param->type == DRCUML_PTYPE_MEMORY) |
| 2267 | 2301 | { |
| 2268 | 2302 | emit_or_r32_m32(dst, reglo, MABS(param->value)); // or reglo,[param] |
| r2844 | r2845 | |
| 2271 | 2305 | } |
| 2272 | 2306 | else if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2273 | 2307 | { |
| 2274 | if (inst-> | |
| 2308 | if (inst-> | |
| 2275 | 2309 | /* skip */; |
| 2276 | else if (inst-> | |
| 2310 | else if (inst-> | |
| 2277 | 2311 | emit_mov_r32_imm(dst, reglo, -1); // mov reglo,-1 |
| 2278 | 2312 | else |
| 2279 | 2313 | emit_or_r32_imm(dst, reglo, param->value); // or reglo,param |
| 2280 | 2314 | if (saveflags) emit_pushf(dst); // pushf |
| 2281 | if (inst-> | |
| 2315 | if (inst-> | |
| 2282 | 2316 | /* skip */; |
| 2283 | else if (inst-> | |
| 2317 | else if (inst-> | |
| 2284 | 2318 | emit_mov_r32_imm(dst, reghi, -1); // mov reghi,-1 |
| 2285 | 2319 | else |
| 2286 | 2320 | emit_or_r32_imm(dst, reghi, param->value >> 32); // or reghi,param >> 32 |
| r2844 | r2845 | |
| 2303 | 2337 | |
| 2304 | 2338 | static void emit_or_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2305 | 2339 | { |
| 2306 | int saveflags = ((inst-> | |
| 2340 | int saveflags = ((inst-> | |
| 2307 | 2341 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2308 | 2342 | { |
| 2309 | if (inst-> | |
| 2343 | if (inst-> | |
| 2310 | 2344 | /* skip */; |
| 2311 | else if (inst-> | |
| 2345 | else if (inst-> | |
| 2312 | 2346 | emit_mov_m32_imm(dst, MEMPARAMS, -1); // mov [dest],-1 |
| 2313 | 2347 | else |
| 2314 | 2348 | emit_or_m32_imm(dst, MEMPARAMS, param->value); // or [dest],param |
| 2315 | 2349 | if (saveflags) emit_pushf(dst); // pushf |
| 2316 | if (inst-> | |
| 2350 | if (inst-> | |
| 2317 | 2351 | /* skip */; |
| 2318 | else if (inst-> | |
| 2352 | else if (inst-> | |
| 2319 | 2353 | emit_mov_m32_imm(dst, MEMPARAMS + 4, -1); // mov [dest+4],-1 |
| 2320 | 2354 | else |
| 2321 | 2355 | emit_or_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // or [dest+4],param >> 32 |
| r2844 | r2845 | |
| 2340 | 2374 | |
| 2341 | 2375 | static void emit_xor_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2342 | 2376 | { |
| 2343 | int saveflags = ((inst-> | |
| 2377 | int saveflags = ((inst-> | |
| 2344 | 2378 | if (param->type == DRCUML_PTYPE_MEMORY) |
| 2345 | 2379 | { |
| 2346 | 2380 | emit_xor_r32_m32(dst, reglo, MABS(param->value)); // xor reglo,[param] |
| r2844 | r2845 | |
| 2349 | 2383 | } |
| 2350 | 2384 | else if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2351 | 2385 | { |
| 2352 | if (inst-> | |
| 2386 | if (inst-> | |
| 2353 | 2387 | /* skip */; |
| 2354 | else if (inst-> | |
| 2388 | else if (inst-> | |
| 2355 | 2389 | emit_not_r32(dst, reglo); // not reglo |
| 2356 | 2390 | else |
| 2357 | 2391 | emit_xor_r32_imm(dst, reglo, param->value); // xor reglo,param |
| 2358 | 2392 | if (saveflags) emit_pushf(dst); // pushf |
| 2359 | if (inst-> | |
| 2393 | if (inst-> | |
| 2360 | 2394 | /* skip */; |
| 2361 | else if (inst-> | |
| 2395 | else if (inst-> | |
| 2362 | 2396 | emit_not_r32(dst, reghi); // not reghi |
| 2363 | 2397 | else |
| 2364 | 2398 | emit_xor_r32_imm(dst, reghi, param->value >> 32); // xor reghi,param >> 32 |
| r2844 | r2845 | |
| 2381 | 2415 | |
| 2382 | 2416 | static void emit_xor_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2383 | 2417 | { |
| 2384 | int saveflags = ((inst-> | |
| 2418 | int saveflags = ((inst-> | |
| 2385 | 2419 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2386 | 2420 | { |
| 2387 | if (inst-> | |
| 2421 | if (inst-> | |
| 2388 | 2422 | /* skip */; |
| 2389 | else if (inst-> | |
| 2423 | else if (inst-> | |
| 2390 | 2424 | emit_not_m32(dst, MEMPARAMS); // not [dest] |
| 2391 | 2425 | else |
| 2392 | 2426 | emit_xor_m32_imm(dst, MEMPARAMS, param->value); // xor [dest],param |
| 2393 | 2427 | if (saveflags) emit_pushf(dst); // pushf |
| 2394 | if (inst-> | |
| 2428 | if (inst-> | |
| 2395 | 2429 | /* skip */; |
| 2396 | else if (inst-> | |
| 2430 | else if (inst-> | |
| 2397 | 2431 | emit_not_m32(dst, MEMPARAMS + 4); // not [dest+4] |
| 2398 | 2432 | else |
| 2399 | 2433 | emit_xor_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // xor [dest+4],param >> 32 |
| r2844 | r2845 | |
| 2418 | 2452 | |
| 2419 | 2453 | static void emit_shl_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2420 | 2454 | { |
| 2421 | int saveflags = (inst-> | |
| 2455 | int saveflags = (inst-> | |
| 2422 | 2456 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2423 | 2457 | { |
| 2424 | 2458 | int count = param->value & 63; |
| 2425 | if (inst-> | |
| 2459 | if (inst-> | |
| 2426 | 2460 | /* skip */; |
| 2427 | 2461 | else |
| 2428 | 2462 | { |
| 2429 | 2463 | while (count >= 32) |
| 2430 | 2464 | { |
| 2431 | if (inst-> | |
| 2465 | if (inst-> | |
| 2432 | 2466 | { |
| 2433 | 2467 | emit_shld_r32_r32_imm(dst, reghi, reglo, 31); // shld reghi,reglo,31 |
| 2434 | 2468 | emit_shl_r32_imm(dst, reglo, 31); // shl reglo,31 |
| r2844 | r2845 | |
| 2441 | 2475 | count -= 32; |
| 2442 | 2476 | } |
| 2443 | 2477 | } |
| 2444 | if (inst-> | |
| 2478 | if (inst-> | |
| 2445 | 2479 | { |
| 2446 | 2480 | emit_shld_r32_r32_imm(dst, reghi, reglo, count); // shld reghi,reglo,count |
| 2447 | 2481 | if (saveflags) emit_pushf(dst); // pushf |
| r2844 | r2845 | |
| 2455 | 2489 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); // mov ecx,param |
| 2456 | 2490 | emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20 |
| 2457 | 2491 | emit_jcc_short_link(dst, COND_Z, &skip1); // jz skip1 |
| 2458 | if (inst-> | |
| 2492 | if (inst-> | |
| 2459 | 2493 | { |
| 2460 | 2494 | emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31 |
| 2461 | 2495 | emit_shld_r32_r32_imm(dst, reghi, reglo, 31); // shld reghi,reglo,31 |
| r2844 | r2845 | |
| 2489 | 2523 | |
| 2490 | 2524 | static void emit_shr_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2491 | 2525 | { |
| 2492 | int saveflags = ((inst-> | |
| 2526 | int saveflags = ((inst-> | |
| 2493 | 2527 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2494 | 2528 | { |
| 2495 | 2529 | int count = param->value & 63; |
| 2496 | if (inst-> | |
| 2530 | if (inst-> | |
| 2497 | 2531 | /* skip */; |
| 2498 | 2532 | else |
| 2499 | 2533 | { |
| 2500 | 2534 | while (count >= 32) |
| 2501 | 2535 | { |
| 2502 | if (inst-> | |
| 2536 | if (inst-> | |
| 2503 | 2537 | { |
| 2504 | 2538 | emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31 |
| 2505 | 2539 | emit_shr_r32_imm(dst, reghi, 31); // shr reghi,31 |
| r2844 | r2845 | |
| 2512 | 2546 | count -= 32; |
| 2513 | 2547 | } |
| 2514 | 2548 | } |
| 2515 | if (inst-> | |
| 2549 | if (inst-> | |
| 2516 | 2550 | { |
| 2517 | 2551 | emit_shrd_r32_r32_imm(dst, reglo, reghi, count); // shrd reglo,reghi,count |
| 2518 | 2552 | if (saveflags) emit_pushf(dst); // pushf |
| r2844 | r2845 | |
| 2526 | 2560 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); // mov ecx,param |
| 2527 | 2561 | emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20 |
| 2528 | 2562 | emit_jcc_short_link(dst, COND_Z, &skip1); // jz skip1 |
| 2529 | if (inst-> | |
| 2563 | if (inst-> | |
| 2530 | 2564 | { |
| 2531 | 2565 | emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31 |
| 2532 | 2566 | emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31 |
| r2844 | r2845 | |
| 2560 | 2594 | |
| 2561 | 2595 | static void emit_sar_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2562 | 2596 | { |
| 2563 | int saveflags = ((inst-> | |
| 2597 | int saveflags = ((inst-> | |
| 2564 | 2598 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2565 | 2599 | { |
| 2566 | 2600 | int count = param->value & 63; |
| 2567 | if (inst-> | |
| 2601 | if (inst-> | |
| 2568 | 2602 | /* skip */; |
| 2569 | 2603 | else |
| 2570 | 2604 | { |
| 2571 | 2605 | while (count >= 32) |
| 2572 | 2606 | { |
| 2573 | if (inst-> | |
| 2607 | if (inst-> | |
| 2574 | 2608 | { |
| 2575 | 2609 | emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31 |
| 2576 | 2610 | emit_sar_r32_imm(dst, reghi, 31); // sar reghi,31 |
| r2844 | r2845 | |
| 2583 | 2617 | count -= 32; |
| 2584 | 2618 | } |
| 2585 | 2619 | } |
| 2586 | if (inst-> | |
| 2620 | if (inst-> | |
| 2587 | 2621 | { |
| 2588 | 2622 | emit_shrd_r32_r32_imm(dst, reglo, reghi, count); // shrd reglo,reghi,count |
| 2589 | 2623 | if (saveflags) emit_pushf(dst); // pushf |
| r2844 | r2845 | |
| 2597 | 2631 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); // mov ecx,param |
| 2598 | 2632 | emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20 |
| 2599 | 2633 | emit_jcc_short_link(dst, COND_Z, &skip1); // jz skip1 |
| 2600 | if (inst-> | |
| 2634 | if (inst-> | |
| 2601 | 2635 | { |
| 2602 | 2636 | emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31 |
| 2603 | 2637 | emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31 |
| r2844 | r2845 | |
| 2631 | 2665 | |
| 2632 | 2666 | static void emit_rol_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2633 | 2667 | { |
| 2634 | int saveflags = ((inst-> | |
| 2668 | int saveflags = ((inst-> | |
| 2635 | 2669 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2636 | 2670 | { |
| 2637 | 2671 | int count = param->value & 63; |
| 2638 | if (inst-> | |
| 2672 | if (inst-> | |
| 2639 | 2673 | /* skip */; |
| 2640 | 2674 | else |
| 2641 | 2675 | { |
| 2642 | 2676 | while (count >= 32) |
| 2643 | 2677 | { |
| 2644 | if (inst-> | |
| 2678 | if (inst-> | |
| 2645 | 2679 | { |
| 2646 | 2680 | emit_mov_r32_r32(dst, REG_ECX, reglo); // mov ecx,reglo |
| 2647 | 2681 | emit_shld_r32_r32_imm(dst, reglo, reghi, 31); // shld reglo,reghi,31 |
| r2844 | r2845 | |
| 2654 | 2688 | count -= 32; |
| 2655 | 2689 | } |
| 2656 | 2690 | } |
| 2657 | if (inst-> | |
| 2691 | if (inst-> | |
| 2658 | 2692 | { |
| 2659 | 2693 | emit_mov_r32_r32(dst, REG_ECX, reglo); // mov ecx,reglo |
| 2660 | 2694 | emit_shld_r32_r32_imm(dst, reglo, reghi, count); // shld reglo,reghi,count |
| r2844 | r2845 | |
| 2670 | 2704 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); // mov ecx,param |
| 2671 | 2705 | emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20 |
| 2672 | 2706 | emit_jcc_short_link(dst, COND_Z, &skip1); // jz skip1 |
| 2673 | if (inst-> | |
| 2707 | if (inst-> | |
| 2674 | 2708 | { |
| 2675 | 2709 | emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31 |
| 2676 | 2710 | emit_mov_r32_r32(dst, REG_EBX, reglo); // mov ebx,reglo |
| r2844 | r2845 | |
| 2705 | 2739 | |
| 2706 | 2740 | static void emit_ror_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2707 | 2741 | { |
| 2708 | int saveflags = ((inst-> | |
| 2742 | int saveflags = ((inst-> | |
| 2709 | 2743 | if (param->type == DRCUML_PTYPE_IMMEDIATE) |
| 2710 | 2744 | { |
| 2711 | 2745 | int count = param->value & 63; |
| 2712 | if (inst-> | |
| 2746 | if (inst-> | |
| 2713 | 2747 | /* skip */; |
| 2714 | 2748 | else |
| 2715 | 2749 | { |
| 2716 | 2750 | while (count >= 32) |
| 2717 | 2751 | { |
| 2718 | if (inst-> | |
| 2752 | if (inst-> | |
| 2719 | 2753 | { |
| 2720 | 2754 | emit_mov_r32_r32(dst, REG_ECX, reglo); // mov ecx,reglo |
| 2721 | 2755 | emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31 |
| r2844 | r2845 | |
| 2728 | 2762 | count -= 32; |
| 2729 | 2763 | } |
| 2730 | 2764 | } |
| 2731 | if (inst-> | |
| 2765 | if (inst-> | |
| 2732 | 2766 | { |
| 2733 | 2767 | emit_mov_r32_r32(dst, REG_ECX, reglo); // mov ecx,reglo |
| 2734 | 2768 | emit_shrd_r32_r32_imm(dst, reglo, reghi, count); // shrd reglo,reghi,count |
| r2844 | r2845 | |
| 2744 | 2778 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); // mov ecx,param |
| 2745 | 2779 | emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20 |
| 2746 | 2780 | emit_jcc_short_link(dst, COND_Z, &skip1); // jz skip1 |
| 2747 | if (inst-> | |
| 2781 | if (inst-> | |
| 2748 | 2782 | { |
| 2749 | 2783 | emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31 |
| 2750 | 2784 | emit_mov_r32_r32(dst, REG_EBX, reglo); // mov ebx,reglo |
| r2844 | r2845 | |
| 2779 | 2813 | |
| 2780 | 2814 | static void emit_rcl_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2781 | 2815 | { |
| 2782 | int saveflags = ((inst-> | |
| 2816 | int saveflags = ((inst-> | |
| 2783 | 2817 | emit_link skipall, skiploop; |
| 2784 | 2818 | x86code *loop; |
| 2785 | 2819 | |
| 2786 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); | |
| 2820 | emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); | |
| 2787 | 2821 | if (!saveflags) |
| 2788 | 2822 | { |
| 2789 | 2823 | loop = *dst; // loop: |
| r2844 | r2845 | |
| 2821 | 2855 | |
| 2822 | 2856 | static void emit_rcr_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst) |
| 2823 | 2857 | { |
| 2824 | int saveflags = (inst-> | |
| 2858 | int saveflags = (inst-> | |
| 2825 | 2859 | emit_link skipall, skiploop; |
| 2826 | 2860 | x86code *loop; |
| 2827 | 2861 | |
| 2828 | emit_mov_r32_p32(drcbe, dst, REG_ECX, param); | |
| 2862 | emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); | |
| 2829 | 2863 | if (!saveflags) |
| 2830 | 2864 | { |
| 2831 | 2865 | loop = *dst; // loop: |
| r2844 | r2845 | |
| 2895 | 2929 | |
| 2896 | 2930 | |
| 2897 | 2931 | /*************************************************************************** |
| 2898 | HELPERS TO CONVERT OTHER OPERATIONS TO MOVES | |
| 2899 | ***************************************************************************/ | |
| 2900 | ||
| 2901 | /*------------------------------------------------- | |
| 2902 | convert_to_mov_imm - convert an instruction | |
| 2903 | into a mov immediate | |
| 2904 | -------------------------------------------------*/ | |
| 2905 | ||
| 2906 | static x86code *convert_to_mov_imm(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst, const drcuml_parameter *dstp, UINT64 imm) | |
| 2907 | { | |
| 2908 | drcuml_instruction temp = *inst; | |
| 2909 | temp.numparams = 2; | |
| 2910 | temp.param[0] = *dstp; | |
| 2911 | temp.param[1].type = DRCUML_PTYPE_IMMEDIATE; | |
| 2912 | temp.param[1].value = imm; | |
| 2913 | return op_mov(drcbe, dst, &temp); | |
| 2914 | } | |
| 2915 | ||
| 2916 | ||
| 2917 | /*------------------------------------------------- | |
| 2918 | convert_to_mov_src1 - convert an instruction | |
| 2919 | into a mov src1 | |
| 2920 | -------------------------------------------------*/ | |
| 2921 | ||
| 2922 | static x86code *convert_to_mov_src1(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst, const drcuml_parameter *dstp, const drcuml_parameter *srcp) | |
| 2923 | { | |
| 2924 | drcuml_instruction temp = *inst; | |
| 2925 | temp.numparams = 2; | |
| 2926 | temp.param[0] = *dstp; | |
| 2927 | temp.param[1] = *srcp; | |
| 2928 | return op_mov(drcbe, dst, &temp); | |
| 2929 | } | |
| 2930 | ||
| 2931 | ||
| 2932 | ||
| 2933 | /*************************************************************************** | |
| 2934 | 2932 | OUT-OF-BAND CODE FIXUP CALLBACKS |
| 2935 | 2933 | ***************************************************************************/ |
| 2936 | 2934 | |
| r2844 | r2845 | |
| 3030 | 3028 | |
| 3031 | 3029 | static x86code *op_handle(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3032 | 3030 | { |
| 3031 | emit_link skip; | |
| 3032 | ||
| 3033 | assert_no_condition(inst); | |
| 3034 | assert_no_flags(inst); | |
| 3033 | 3035 | assert(inst->numparams == 1); |
| 3034 | 3036 | assert(inst->param[0].type == DRCUML_PTYPE_MEMORY); |
| 3035 | 3037 | |
| 3038 | /* emit a jump around the stack adjust in case code falls through here */ | |
| 3039 | emit_jmp_short_link(&dst, &skip); // jmp skip | |
| 3040 | ||
| 3036 | 3041 | /* register the current pointer for the handle */ |
| 3037 | 3042 | drcuml_handle_set_codeptr((drcuml_codehandle *)(FPTR)inst->param[0].value, dst); |
| 3043 | ||
| 3044 | /* by default, the handle points to prolog code that moves the stack pointer */ | |
| 3045 | emit_lea_r32_m32(&dst, REG_ESP, MBD(REG_ESP, -28)); // lea rsp,[rsp-28] | |
| 3046 | resolve_link(&dst, &skip); // skip: | |
| 3038 | 3047 | return dst; |
| 3039 | 3048 | } |
| 3040 | 3049 | |
| r2844 | r2845 | |
| 3045 | 3054 | |
| 3046 | 3055 | static x86code *op_hash(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3047 | 3056 | { |
| 3057 | assert_no_condition(inst); | |
| 3058 | assert_no_flags(inst); | |
| 3048 | 3059 | assert(inst->numparams == 2); |
| 3049 | 3060 | assert(inst->param[0].type == DRCUML_PTYPE_IMMEDIATE); |
| 3050 | 3061 | assert(inst->param[1].type == DRCUML_PTYPE_IMMEDIATE); |
| r2844 | r2845 | |
| 3061 | 3072 | |
| 3062 | 3073 | static x86code *op_label(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3063 | 3074 | { |
| 3075 | assert_no_condition(inst); | |
| 3076 | assert_no_flags(inst); | |
| 3064 | 3077 | assert(inst->numparams == 1); |
| 3065 | 3078 | assert(inst->param[0].type == DRCUML_PTYPE_IMMEDIATE); |
| 3066 | 3079 | |
| r2844 | r2845 | |
| 3076 | 3089 | |
| 3077 | 3090 | static x86code *op_comment(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3078 | 3091 | { |
| 3092 | assert_no_condition(inst); | |
| 3093 | assert_no_flags(inst); | |
| 3079 | 3094 | assert(inst->numparams == 1); |
| 3080 | 3095 | assert(inst->param[0].type == DRCUML_PTYPE_MEMORY); |
| 3081 | 3096 | |
| r2844 | r2845 | |
| 3090 | 3105 | |
| 3091 | 3106 | static x86code *op_mapvar(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3092 | 3107 | { |
| 3108 | assert_no_condition(inst); | |
| 3109 | assert_no_flags(inst); | |
| 3093 | 3110 | assert(inst->numparams == 2); |
| 3094 | 3111 | assert(inst->param[0].type == DRCUML_PTYPE_MAPVAR); |
| 3095 | 3112 | assert(inst->param[1].type == DRCUML_PTYPE_IMMEDIATE); |
| r2844 | r2845 | |
| 3106 | 3123 | ***************************************************************************/ |
| 3107 | 3124 | |
| 3108 | 3125 | /*------------------------------------------------- |
| 3126 | op_nop - process a NOP opcode | |
| 3127 | -------------------------------------------------*/ | |
| 3128 | ||
| 3129 | static x86code *op_nop(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) | |
| 3130 | { | |
| 3131 | /* nothing */ | |
| 3132 | return dst; | |
| 3133 | } | |
| 3134 | ||
| 3135 | ||
| 3136 | /*------------------------------------------------- | |
| 3109 | 3137 | op_debug - process a DEBUG opcode |
| 3110 | 3138 | -------------------------------------------------*/ |
| 3111 | 3139 | |
| 3112 | 3140 | static x86code *op_debug(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3113 | 3141 | { |
| 3142 | /* validate instruction */ | |
| 3143 | assert(inst->size == 4); | |
| 3144 | assert_no_condition(inst); | |
| 3145 | assert_no_flags(inst); | |
| 3146 | ||
| 3114 | 3147 | #ifdef ENABLE_DEBUGGER |
| 3115 | 3148 | if (Machine->debug_mode) |
| 3116 | 3149 | { |
| 3117 | 3150 | drcuml_parameter pcp; |
| 3118 | 3151 | |
| 3119 | /* validate instruction */ | |
| 3120 | assert(inst->size == 4); | |
| 3121 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3122 | ||
| 3123 | 3152 | /* normalize parameters */ |
| 3124 | 3153 | param_normalize_1(drcbe, inst, &pcp, PTYPE_MRI); |
| 3125 | 3154 | |
| 3126 | 3155 | /* push the parameter */ |
| 3127 | emit_ | |
| 3156 | emit_mov | |
| 3128 | 3157 | emit_call(&dst, (x86code *)mame_debug_hook); // call mame_debug_hook |
| 3129 | emit_add_r32_imm(&dst, REG_ESP, 4); // add esp,4 | |
| 3130 | 3158 | } |
| 3131 | 3159 | #endif |
| 3132 | 3160 | |
| r2844 | r2845 | |
| 3144 | 3172 | |
| 3145 | 3173 | /* validate instruction */ |
| 3146 | 3174 | assert(inst->size == 4); |
| 3147 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= DRCUML_COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3175 | assert_any_condition(inst); | |
| 3176 | assert_no_flags(inst); | |
| 3148 | 3177 | |
| 3149 | 3178 | /* normalize parameters */ |
| 3150 | 3179 | param_normalize_1(drcbe, inst, &retp, PTYPE_MRI); |
| 3151 | 3180 | |
| 3152 | 3181 | /* load the parameter into EAX */ |
| 3153 | 3182 | emit_mov_r32_p32(drcbe, &dst, REG_EAX, &retp); // mov eax,retp |
| 3154 | if (inst->cond | |
| 3183 | if (inst->condition == DRCUML_COND_ALWAYS) | |
| 3155 | 3184 | emit_jmp(&dst, drcbe->exit); // jmp exit |
| 3156 | 3185 | else |
| 3157 | emit_jcc(&dst, X86_CONDITION(inst->cond | |
| 3186 | emit_jcc(&dst, X86_CONDITION(inst->condition), drcbe->exit); // jcc exit | |
| 3158 | 3187 | |
| 3159 | 3188 | return dst; |
| 3160 | 3189 | } |
| r2844 | r2845 | |
| 3170 | 3199 | |
| 3171 | 3200 | /* validate instruction */ |
| 3172 | 3201 | assert(inst->size == 4); |
| 3173 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3202 | assert_no_condition(inst); | |
| 3203 | assert_no_flags(inst); | |
| 3174 | 3204 | |
| 3175 | 3205 | /* normalize parameters */ |
| 3176 | 3206 | param_normalize_3(drcbe, inst, &modep, PTYPE_MRI, &pcp, PTYPE_MRI, &exp, PTYPE_M); |
| 3177 | 3207 | |
| 3178 | 3208 | #if LOG_HASHJMPS |
| 3179 | emit_push_p32(drcbe, &dst, &pcp); | |
| 3180 | emit_push_p32(drcbe, &dst, &modep); | |
| 3209 | emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &pcp); | |
| 3210 | emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &modep); | |
| 3181 | 3211 | emit_call(&dst, (x86code *)debug_log_hashjmp); |
| 3182 | emit_add_r32_imm(&dst, REG_ESP, 8); | |
| 3183 | 3212 | #endif |
| 3184 | 3213 | |
| 3185 | 3214 | /* load the stack base one word early so we end up at the right spot after our call below */ |
| r2844 | r2845 | |
| 3256 | 3285 | |
| 3257 | 3286 | /* validate instruction */ |
| 3258 | 3287 | assert(inst->size == 4); |
| 3259 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= DRCUML_COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3288 | assert_any_condition(inst); | |
| 3289 | assert_no_flags(inst); | |
| 3260 | 3290 | |
| 3261 | 3291 | /* normalize parameters */ |
| 3262 | 3292 | param_normalize_1(drcbe, inst, &labelp, PTYPE_I); |
| 3263 | 3293 | |
| 3264 | 3294 | /* look up the jump target and jump there */ |
| 3265 | 3295 | jmptarget = (x86code *)drclabel_get_codeptr(drcbe->labels, labelp.value, fixup_label, dst); |
| 3266 | if (inst->cond | |
| 3296 | if (inst->condition == DRCUML_COND_ALWAYS) | |
| 3267 | 3297 | emit_jmp(&dst, jmptarget); // jmp target |
| 3268 | 3298 | else |
| 3269 | emit_jcc(&dst, X86_CONDITION(inst->cond | |
| 3299 | emit_jcc(&dst, X86_CONDITION(inst->condition), jmptarget); // jcc target | |
| 3270 | 3300 | |
| 3271 | 3301 | return dst; |
| 3272 | 3302 | } |
| r2844 | r2845 | |
| 3283 | 3313 | |
| 3284 | 3314 | /* validate instruction */ |
| 3285 | 3315 | assert(inst->size == 4); |
| 3286 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= DRCUML_COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3316 | assert_any_condition(inst); | |
| 3317 | assert_no_flags(inst); | |
| 3287 | 3318 | |
| 3288 | 3319 | /* normalize parameters */ |
| 3289 | 3320 | param_normalize_2(drcbe, inst, &handp, PTYPE_M, &exp, PTYPE_MRI); |
| r2844 | r2845 | |
| 3292 | 3323 | targetptr = drcuml_handle_codeptr_addr((drcuml_codehandle *)(FPTR)handp.value); |
| 3293 | 3324 | |
| 3294 | 3325 | /* perform the exception processing inline if unconditional */ |
| 3295 | if (inst->cond | |
| 3326 | if (inst->condition == DRCUML_COND_ALWAYS) | |
| 3296 | 3327 | { |
| 3297 | 3328 | emit_mov_m32_p32(drcbe, &dst, MABS(&drcbe->state.exp), &exp); // mov [exp],exp |
| 3298 | 3329 | if (*targetptr != NULL) |
| r2844 | r2845 | |
| 3304 | 3335 | /* otherwise, jump to an out-of-band handler */ |
| 3305 | 3336 | else |
| 3306 | 3337 | { |
| 3307 | emit_jcc(&dst, X86_CONDITION(inst->cond | |
| 3338 | emit_jcc(&dst, X86_CONDITION(inst->condition), 0); // jcc exception | |
| 3308 | 3339 | drccache_request_oob_codegen(drcbe->cache, fixup_exception, drcbe, dst, (void *)inst); |
| 3309 | 3340 | } |
| 3310 | 3341 | return dst; |
| r2844 | r2845 | |
| 3323 | 3354 | |
| 3324 | 3355 | /* validate instruction */ |
| 3325 | 3356 | assert(inst->size == 4); |
| 3326 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= DRCUML_COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3357 | assert_any_condition(inst); | |
| 3358 | assert_no_flags(inst); | |
| 3327 | 3359 | |
| 3328 | 3360 | /* normalize parameters */ |
| 3329 | 3361 | param_normalize_1(drcbe, inst, &handp, PTYPE_M); |
| r2844 | r2845 | |
| 3332 | 3364 | targetptr = drcuml_handle_codeptr_addr((drcuml_codehandle *)(FPTR)handp.value); |
| 3333 | 3365 | |
| 3334 | 3366 | /* skip if conditional */ |
| 3335 | if (inst->condflags != DRCUML_COND_ALWAYS) | |
| 3336 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condflags), &skip); // jcc skip | |
| 3367 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3368 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condition), &skip); // jcc skip | |
| 3337 | 3369 | |
| 3338 | 3370 | /* jump through the handle; directly if a normal jump */ |
| 3339 | 3371 | if (*targetptr != NULL) |
| r2844 | r2845 | |
| 3342 | 3374 | emit_call_m32(&dst, MABS(targetptr)); // call [targetptr] |
| 3343 | 3375 | |
| 3344 | 3376 | /* resolve the conditional link */ |
| 3345 | if (inst->cond | |
| 3377 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3346 | 3378 | resolve_link(&dst, &skip); // skip: |
| 3347 | 3379 | return dst; |
| 3348 | 3380 | } |
| r2844 | r2845 | |
| 3358 | 3390 | |
| 3359 | 3391 | /* validate instruction */ |
| 3360 | 3392 | assert(inst->size == 4); |
| 3361 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= DRCUML_COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3393 | assert_any_condition(inst); | |
| 3394 | assert_no_flags(inst); | |
| 3362 | 3395 | assert(inst->numparams == 0); |
| 3363 | 3396 | |
| 3364 | 3397 | /* skip if conditional */ |
| 3365 | if (inst->condflags != DRCUML_COND_ALWAYS) | |
| 3366 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condflags), &skip); // jcc skip | |
| 3398 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3399 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condition), &skip); // jcc skip | |
| 3367 | 3400 | |
| 3368 | 3401 | /* return */ |
| 3402 | emit_lea_r32_m32(&dst, REG_ESP, MBD(REG_ESP, 28)); // lea rsp,[rsp+28] | |
| 3369 | 3403 | emit_ret(&dst); // ret |
| 3370 | 3404 | |
| 3371 | 3405 | /* resolve the conditional link */ |
| 3372 | if (inst->cond | |
| 3406 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3373 | 3407 | resolve_link(&dst, &skip); // skip: |
| 3374 | 3408 | return dst; |
| 3375 | 3409 | } |
| r2844 | r2845 | |
| 3386 | 3420 | |
| 3387 | 3421 | /* validate instruction */ |
| 3388 | 3422 | assert(inst->size == 4); |
| 3389 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= DRCUML_COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 3423 | assert_any_condition(inst); | |
| 3424 | assert_no_flags(inst); | |
| 3390 | 3425 | |
| 3391 | 3426 | /* normalize parameters */ |
| 3392 | 3427 | param_normalize_2(drcbe, inst, &funcp, PTYPE_M, ¶mp, PTYPE_M); |
| 3393 | 3428 | |
| 3394 | 3429 | /* skip if conditional */ |
| 3395 | if (inst->condflags != DRCUML_COND_ALWAYS) | |
| 3396 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condflags), &skip); // jcc skip | |
| 3430 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3431 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condition), &skip); // jcc skip | |
| 3397 | 3432 | |
| 3398 | 3433 | /* perform the call */ |
| 3399 | emit_ | |
| 3434 | emit_mov | |
| 3400 | 3435 | emit_call(&dst, (x86code *)(FPTR)funcp.value); // call funcp |
| 3401 | emit_add_r32_imm(&dst, REG_ESP, 4); // add esp,4 | |
| 3402 | 3436 | |
| 3403 | 3437 | /* resolve the conditional link */ |
| 3404 | if (inst->cond | |
| 3438 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 3405 | 3439 | resolve_link(&dst, &skip); // skip: |
| 3406 | 3440 | return dst; |
| 3407 | 3441 | } |
| r2844 | r2845 | |
| 3413 | 3447 | |
| 3414 | 3448 | static x86code *op_recover(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3415 | 3449 | { |
| 3416 | drcuml_parameter dstp | |
| 3450 | drcuml_parameter dstp | |
| 3417 | 3451 | |
| 3418 | 3452 | /* validate instruction */ |
| 3419 | 3453 | assert(inst->size == 4); |
| 3420 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3454 | assert_no_condition(inst); | |
| 3455 | assert_no_flags(inst); | |
| 3421 | 3456 | |
| 3422 | 3457 | /* normalize parameters */ |
| 3423 | param_normalize | |
| 3458 | param_normalize | |
| 3424 | 3459 | |
| 3425 | 3460 | /* call the recovery code */ |
| 3426 | 3461 | emit_mov_r32_m32(&dst, REG_EAX, MABS(&drcbe->stacksave)); // mov eax,stacksave |
| 3427 | 3462 | emit_mov_r32_m32(&dst, REG_EAX, MBD(REG_EAX, -4)); // mov eax,[eax-4] |
| 3428 | 3463 | emit_sub_r32_imm(&dst, REG_EAX, 1); // sub eax,1 |
| 3429 | emit_push_imm(&dst, inst->param[1].value); // push param1 | |
| 3430 | emit_push_r32(&dst, REG_EAX); // push eax | |
| 3431 | emit_push_imm(&dst, (FPTR)drcbe->map); // push drcbe->map | |
| 3464 | emit_mov_m32_imm(&dst, MBD(REG_ESP, 8), inst->param[1].value); // mov [esp+8],param1 | |
| 3465 | emit_mov_m32_r32(&dst, MBD(REG_ESP, 4), REG_EAX); // mov [esp+4],eax | |
| 3466 | emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (FPTR)drcbe->map); // mov [esp],drcbe->map | |
| 3432 | 3467 | emit_call(&dst, (x86code *)drcmap_get_value); // call drcmap_get_value |
| 3433 | emit_add_r32_imm(&dst, REG_ESP, 12); // add esp,12 | |
| 3434 | 3468 | emit_mov_p32_r32(drcbe, &dst, &dstp, REG_EAX); // mov dstp,eax |
| 3435 | 3469 | |
| 3436 | 3470 | return dst; |
| r2844 | r2845 | |
| 3452 | 3486 | |
| 3453 | 3487 | /* validate instruction */ |
| 3454 | 3488 | assert(inst->size == 4); |
| 3455 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3489 | assert_no_condition(inst); | |
| 3490 | assert_no_flags(inst); | |
| 3456 | 3491 | |
| 3457 | 3492 | /* normalize parameters */ |
| 3458 | 3493 | param_normalize_1(drcbe, inst, &srcp, PTYPE_MRI); |
| r2844 | r2845 | |
| 3488 | 3523 | |
| 3489 | 3524 | /* validate instruction */ |
| 3490 | 3525 | assert(inst->size == 4); |
| 3491 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3526 | assert_no_condition(inst); | |
| 3527 | assert_no_flags(inst); | |
| 3492 | 3528 | |
| 3493 | 3529 | /* normalize parameters */ |
| 3494 | 3530 | param_normalize_1(drcbe, inst, &dstp, PTYPE_MR); |
| r2844 | r2845 | |
| 3516 | 3552 | |
| 3517 | 3553 | /* validate instruction */ |
| 3518 | 3554 | assert(inst->size == 4); |
| 3519 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3555 | assert_no_condition(inst); | |
| 3556 | assert_no_flags(inst); | |
| 3520 | 3557 | |
| 3521 | 3558 | /* normalize parameters */ |
| 3522 | 3559 | param_normalize_1(drcbe, inst, &dstp, PTYPE_MR); |
| r2844 | r2845 | |
| 3540 | 3577 | |
| 3541 | 3578 | static x86code *op_getflgs(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) |
| 3542 | 3579 | { |
| 3543 | drcuml_parameter dstp; | |
| 3580 | drcuml_parameter dstp, maskp; | |
| 3581 | UINT32 flagmask = 0; | |
| 3544 | 3582 | int dstreg; |
| 3545 | 3583 | |
| 3546 | 3584 | /* validate instruction */ |
| 3547 | 3585 | assert(inst->size == 4); |
| 3548 | assert(inst->condflags != DRCUML_COND_ALWAYS); | |
| 3586 | assert_no_condition(inst); | |
| 3587 | assert_no_flags(inst); | |
| 3549 | 3588 | |
| 3550 | 3589 | /* normalize parameters */ |
| 3551 | param_normalize_ | |
| 3590 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MR, &maskp, PTYPE_I); | |
| 3552 | 3591 | |
| 3553 | 3592 | /* pick a target register for the general case */ |
| 3554 | 3593 | dstreg = param_select_register(REG_EAX, &dstp, NULL); |
| 3555 | 3594 | |
| 3556 | switch (inst->condflags) | |
| 3595 | /* compute mask for flags */ | |
| 3596 | if (maskp.value & DRCUML_FLAG_C) flagmask |= 0x001; | |
| 3597 | if (maskp.value & DRCUML_FLAG_V) flagmask |= 0x800; | |
| 3598 | if (maskp.value & DRCUML_FLAG_Z) flagmask |= 0x040; | |
| 3599 | if (maskp.value & DRCUML_FLAG_S) flagmask |= 0x080; | |
| 3600 | if (maskp.value & DRCUML_FLAG_U) flagmask |= 0x004; | |
| 3601 | ||
| 3602 | switch (maskp.value) | |
| 3557 | 3603 | { |
| 3558 | 3604 | /* single flags only */ |
| 3559 | 3605 | case DRCUML_FLAG_C: |
| r2844 | r2845 | |
| 3643 | 3689 | default: |
| 3644 | 3690 | emit_pushf(&dst); // pushf |
| 3645 | 3691 | emit_pop_r32(&dst, REG_EAX); // pop eax |
| 3646 | emit_and_r32_imm(&dst, REG_EAX, | |
| 3692 | emit_and_r32_imm(&dst, REG_EAX, flagmask); | |
| 3647 | 3693 | emit_movzx_r32_m8(&dst, dstreg, MBD(REG_EAX, flags_map)); // movzx dstreg,[flags_map] |
| 3648 | 3694 | break; |
| 3649 | 3695 | } |
| r2844 | r2845 | |
| 3675 | 3721 | |
| 3676 | 3722 | /* validate instruction */ |
| 3677 | 3723 | assert(inst->size == 4); |
| 3678 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3724 | assert_no_condition(inst); | |
| 3725 | assert_no_flags(inst); | |
| 3679 | 3726 | |
| 3680 | 3727 | /* normalize parameters */ |
| 3681 | 3728 | param_normalize_1(drcbe, inst, &dstp, PTYPE_M); |
| r2844 | r2845 | |
| 3734 | 3781 | |
| 3735 | 3782 | /* validate instruction */ |
| 3736 | 3783 | assert(inst->size == 4); |
| 3737 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3784 | assert_no_condition(inst); | |
| 3785 | assert_no_flags(inst); | |
| 3738 | 3786 | |
| 3739 | 3787 | /* normalize parameters */ |
| 3740 | 3788 | param_normalize_1(drcbe, inst, &dstp, PTYPE_M); |
| r2844 | r2845 | |
| 3798 | 3846 | |
| 3799 | 3847 | /* validate instruction */ |
| 3800 | 3848 | assert(inst->size == 4 || inst->size == 8); |
| 3801 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3849 | assert_no_condition(inst); | |
| 3850 | assert_no_flags(inst); | |
| 3802 | 3851 | |
| 3803 | 3852 | /* normalize parameters */ |
| 3804 | 3853 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &basep, PTYPE_M, &indp, PTYPE_MRI, &sizep, PTYPE_I); |
| r2844 | r2845 | |
| 3879 | 3928 | |
| 3880 | 3929 | /* validate instruction */ |
| 3881 | 3930 | assert(inst->size == 4 || inst->size == 8); |
| 3882 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 3931 | assert_no_condition(inst); | |
| 3932 | assert_no_flags(inst); | |
| 3883 | 3933 | |
| 3884 | 3934 | /* normalize parameters */ |
| 3885 | 3935 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &basep, PTYPE_M, &indp, PTYPE_MRI, &sizep, PTYPE_I); |
| r2844 | r2845 | |
| 3948 | 3998 | |
| 3949 | 3999 | /* validate instruction */ |
| 3950 | 4000 | assert(inst->size == 4 || inst->size == 8); |
| 3951 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4001 | assert_no_condition(inst); | |
| 4002 | assert_no_flags(inst); | |
| 3952 | 4003 | |
| 3953 | 4004 | /* normalize parameters */ |
| 3954 | 4005 | param_normalize_4(drcbe, inst, &basep, PTYPE_M, &indp, PTYPE_MRI, &srcp, PTYPE_MRI, &sizep, PTYPE_I); |
| r2844 | r2845 | |
| 4057 | 4108 | |
| 4058 | 4109 | /* validate instruction */ |
| 4059 | 4110 | assert(inst->size == 4 || inst->size == 8); |
| 4060 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4111 | assert_no_condition(inst); | |
| 4112 | assert_no_flags(inst); | |
| 4061 | 4113 | |
| 4062 | 4114 | /* normalize parameters */ |
| 4063 | 4115 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &addrp, PTYPE_MRI, &spacesizep, PTYPE_I); |
| r2844 | r2845 | |
| 4066 | 4118 | dstreg = param_select_register(REG_EAX, &dstp, NULL); |
| 4067 | 4119 | |
| 4068 | 4120 | /* set up a call to the read byte handler */ |
| 4069 | emit_ | |
| 4121 | emit_mov | |
| 4070 | 4122 | if ((spacesizep.value & 3) == DRCUML_SIZE_BYTE) |
| 4071 | 4123 | { |
| 4072 | 4124 | emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16].accessors->read_byte); |
| r2844 | r2845 | |
| 4091 | 4143 | // call read_qword |
| 4092 | 4144 | emit_mov_r32_r32(&dst, dstreg, REG_EAX); // mov dstreg,eax |
| 4093 | 4145 | } |
| 4094 | emit_add_r32_imm(&dst, REG_ESP, 4); // add esp,4 | |
| 4095 | 4146 | |
| 4096 | 4147 | /* store low 32 bits */ |
| 4097 | 4148 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| r2844 | r2845 | |
| 4132 | 4183 | |
| 4133 | 4184 | /* validate instruction */ |
| 4134 | 4185 | assert(inst->size == 4 || inst->size == 8); |
| 4135 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4186 | assert_no_condition(inst); | |
| 4187 | assert_no_flags(inst); | |
| 4136 | 4188 | |
| 4137 | 4189 | /* normalize parameters */ |
| 4138 | 4190 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &addrp, PTYPE_MRI, &maskp, PTYPE_MRI, &spacesizep, PTYPE_I); |
| r2844 | r2845 | |
| 4142 | 4194 | |
| 4143 | 4195 | /* set up a call to the read byte handler */ |
| 4144 | 4196 | if ((spacesizep.value & 3) != DRCUML_SIZE_QWORD) |
| 4145 | emit_ | |
| 4197 | emit_mov | |
| 4146 | 4198 | else |
| 4147 | emit_push_p64(drcbe, &dst, &maskp); // push maskp | |
| 4148 | emit_push_p32(drcbe, &dst, &addrp); // push addrp | |
| 4199 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 4), &maskp); // mov [esp+4],maskp | |
| 4200 | emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &addrp); // mov [esp],addrp | |
| 4149 | 4201 | if ((spacesizep.value & 3) == DRCUML_SIZE_WORD) |
| 4150 | 4202 | { |
| 4151 | 4203 | emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16].accessors->read_word_masked); |
| r2844 | r2845 | |
| 4164 | 4216 | // call read_qword_masked |
| 4165 | 4217 | emit_mov_r32_r32(&dst, dstreg, REG_EAX); // mov dstreg,eax |
| 4166 | 4218 | } |
| 4167 | emit_add_r32_imm(&dst, REG_ESP, ((spacesizep.value & 3) != DRCUML_SIZE_QWORD) ? 8 : 12); | |
| 4168 | // add esp,8/12 | |
| 4219 | ||
| 4169 | 4220 | /* store low 32 bits */ |
| 4170 | 4221 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4171 | 4222 | |
| r2844 | r2845 | |
| 4204 | 4255 | |
| 4205 | 4256 | /* validate instruction */ |
| 4206 | 4257 | assert(inst->size == 4 || inst->size == 8); |
| 4207 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4258 | assert_no_condition(inst); | |
| 4259 | assert_no_flags(inst); | |
| 4208 | 4260 | |
| 4209 | 4261 | /* normalize parameters */ |
| 4210 | 4262 | param_normalize_3(drcbe, inst, &addrp, PTYPE_MRI, &srcp, PTYPE_MRI, &spacesizep, PTYPE_I); |
| 4211 | 4263 | |
| 4212 | 4264 | /* set up a call to the write byte handler */ |
| 4213 | 4265 | if ((spacesizep.value & 3) != DRCUML_SIZE_QWORD) |
| 4214 | emit_ | |
| 4266 | emit_mov | |
| 4215 | 4267 | else |
| 4216 | emit_push_p64(drcbe, &dst, &srcp); // push srcp | |
| 4217 | emit_push_p32(drcbe, &dst, &addrp); // push addrp | |
| 4268 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 4), &srcp); // mov [esp+4],srcp | |
| 4269 | emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &addrp); // mov [esp],addrp | |
| 4218 | 4270 | if ((spacesizep.value & 3) == DRCUML_SIZE_BYTE) |
| 4219 | 4271 | emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16].accessors->write_byte); |
| 4220 | 4272 | // call write_byte |
| r2844 | r2845 | |
| 4227 | 4279 | else if ((spacesizep.value & 3) == DRCUML_SIZE_QWORD) |
| 4228 | 4280 | emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16].accessors->write_qword); |
| 4229 | 4281 | // call write_qword |
| 4230 | emit_add_r32_imm(&dst, REG_ESP, ((spacesizep.value & 3) != DRCUML_SIZE_QWORD) ? 8 : 12); | |
| 4231 | // add esp,8/12 | |
| 4232 | 4282 | return dst; |
| 4233 | 4283 | } |
| 4234 | 4284 | |
| r2844 | r2845 | |
| 4243 | 4293 | |
| 4244 | 4294 | /* validate instruction */ |
| 4245 | 4295 | assert(inst->size == 4 || inst->size == 8); |
| 4246 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4296 | assert_no_condition(inst); | |
| 4297 | assert_no_flags(inst); | |
| 4247 | 4298 | |
| 4248 | 4299 | /* normalize parameters */ |
| 4249 | 4300 | param_normalize_4(drcbe, inst, &addrp, PTYPE_MRI, &srcp, PTYPE_MRI, &maskp, PTYPE_MRI, &spacesizep, PTYPE_I); |
| r2844 | r2845 | |
| 4251 | 4302 | /* set up a call to the write byte handler */ |
| 4252 | 4303 | if ((spacesizep.value & 3) != DRCUML_SIZE_QWORD) |
| 4253 | 4304 | { |
| 4254 | emit_push_p32(drcbe, &dst, &maskp); // push maskp | |
| 4255 | emit_push_p32(drcbe, &dst, &srcp); // push srcp | |
| 4305 | emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 8), &maskp); // mov [esp+8],maskp | |
| 4306 | emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &srcp); // mov [esp+4],srcp | |
| 4256 | 4307 | } |
| 4257 | 4308 | else |
| 4258 | 4309 | { |
| 4259 | emit_push_p64(drcbe, &dst, &maskp); // push maskp | |
| 4260 | emit_push_p64(drcbe, &dst, &srcp); // push srcp | |
| 4310 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 12), &maskp); // mov [esp+12],maskp | |
| 4311 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 4), &srcp); // mov [esp+4],srcp | |
| 4261 | 4312 | } |
| 4262 | emit_ | |
| 4313 | emit_mov | |
| 4263 | 4314 | if ((spacesizep.value & 3) == DRCUML_SIZE_WORD) |
| 4264 | 4315 | emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16].accessors->write_word_masked); |
| 4265 | 4316 | // call write_word_masked |
| r2844 | r2845 | |
| 4269 | 4320 | else if ((spacesizep.value & 3) == DRCUML_SIZE_QWORD) |
| 4270 | 4321 | emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16].accessors->write_qword_masked); |
| 4271 | 4322 | // call write_qword_masked |
| 4272 | emit_add_r32_imm(&dst, REG_ESP, ((spacesizep.value & 3) != DRCUML_SIZE_QWORD) ? 12 : 20); | |
| 4273 | // add esp,12/20 | |
| 4274 | 4323 | return dst; |
| 4275 | 4324 | } |
| 4276 | 4325 | |
| r2844 | r2845 | |
| 4285 | 4334 | |
| 4286 | 4335 | /* validate instruction */ |
| 4287 | 4336 | assert(inst->size == 4 || inst->size == 8); |
| 4288 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4337 | assert_no_condition(inst); | |
| 4338 | assert_flags(inst, DRCUML_FLAG_C); | |
| 4289 | 4339 | |
| 4290 | 4340 | /* normalize parameters */ |
| 4291 | 4341 | param_normalize_2(drcbe, inst, &srcp, PTYPE_MRI, &bitp, PTYPE_MRI); |
| r2844 | r2845 | |
| 4364 | 4414 | |
| 4365 | 4415 | /* validate instruction */ |
| 4366 | 4416 | assert(inst->size == 4 || inst->size == 8); |
| 4367 | assert(inst->condflags >= DRCUML_COND_Z && inst->condflags < DRCUML_COND_MAX); | |
| 4417 | assert_any_condition(inst); | |
| 4418 | assert_no_flags(inst); | |
| 4368 | 4419 | |
| 4369 | 4420 | /* normalize parameters */ |
| 4370 | 4421 | param_normalize_1(drcbe, inst, &dstp, PTYPE_MR); |
| r2844 | r2845 | |
| 4373 | 4424 | dstreg = param_select_register(REG_EAX, &dstp, NULL); |
| 4374 | 4425 | |
| 4375 | 4426 | /* set to AL */ |
| 4376 | emit_setcc_r8(&dst, X86_CONDITION(inst->cond | |
| 4427 | emit_setcc_r8(&dst, X86_CONDITION(inst->condition), REG_AL); // setcc al | |
| 4377 | 4428 | emit_movzx_r32_r8(&dst, dstreg, REG_AL); // movzx dstreg,al |
| 4378 | 4429 | |
| 4379 | 4430 | /* store low 32 bits */ |
| r2844 | r2845 | |
| 4405 | 4456 | |
| 4406 | 4457 | /* validate instruction */ |
| 4407 | 4458 | assert(inst->size == 4 || inst->size == 8); |
| 4408 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= DRCUML_COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 4459 | assert_any_condition(inst); | |
| 4460 | assert_no_flags(inst); | |
| 4409 | 4461 | |
| 4410 | 4462 | /* normalize parameters, but only if we got here directly */ |
| 4411 | 4463 | /* other opcodes call through here with pre-normalized parameters */ |
| r2844 | r2845 | |
| 4417 | 4469 | srcp = inst->param[1]; |
| 4418 | 4470 | } |
| 4419 | 4471 | |
| 4420 | /* degenerate case: dest and source are equal */ | |
| 4421 | if (dstp.type == srcp.type && dstp.value == srcp.value) | |
| 4422 | return dst; | |
| 4423 | ||
| 4424 | 4472 | /* pick a target register for the general case */ |
| 4425 | 4473 | dstreg = param_select_register(REG_EAX, &dstp, NULL); |
| 4426 | 4474 | |
| 4427 | 4475 | /* always start with a jmp */ |
| 4428 | if (inst->condflags != DRCUML_COND_ALWAYS) | |
| 4429 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condflags), &skip); // jcc skip | |
| 4476 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 4477 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condition), &skip); // jcc skip | |
| 4430 | 4478 | |
| 4431 | 4479 | /* 32-bit form */ |
| 4432 | 4480 | if (inst->size == 4) |
| r2844 | r2845 | |
| 4440 | 4488 | emit_mov_m32_imm(&dst, MABS(dstp.value), srcp.value); // mov [dstp],srcp |
| 4441 | 4489 | |
| 4442 | 4490 | /* conditional memory to register */ |
| 4443 | else if (inst->cond | |
| 4491 | else if (inst->condition != DRCUML_COND_ALWAYS && dstp.type == DRCUML_PTYPE_INT_REGISTER && srcp.type == DRCUML_PTYPE_MEMORY) | |
| 4444 | 4492 | { |
| 4445 | 4493 | dst = savedst; |
| 4446 | 4494 | skip.target = NULL; |
| 4447 | emit_cmovcc_r32_m32(&dst, X86_CONDITION(inst->cond | |
| 4495 | emit_cmovcc_r32_m32(&dst, X86_CONDITION(inst->condition), dstp.value, MABS(srcp.value)); | |
| 4448 | 4496 | // cmovcc dstp,[srcp] |
| 4449 | 4497 | } |
| 4450 | 4498 | |
| 4451 | 4499 | /* conditional register to register */ |
| 4452 | else if (inst->cond | |
| 4500 | else if (inst->condition != DRCUML_COND_ALWAYS && dstp.type == DRCUML_PTYPE_INT_REGISTER && srcp.type == DRCUML_PTYPE_INT_REGISTER) | |
| 4453 | 4501 | { |
| 4454 | 4502 | dst = savedst; |
| 4455 | 4503 | skip.target = NULL; |
| 4456 | emit_cmovcc_r32_r32(&dst, X86_CONDITION(inst->cond | |
| 4504 | emit_cmovcc_r32_r32(&dst, X86_CONDITION(inst->condition), dstp.value, srcp.value); | |
| 4457 | 4505 | // cmovcc dstp,srcp |
| 4458 | 4506 | } |
| 4459 | 4507 | |
| 4460 | 4508 | /* general case */ |
| 4461 | 4509 | else |
| 4462 | 4510 | { |
| 4463 | emit_mov_r32_p32(drcbe, &dst, dstreg, &srcp); | |
| 4511 | emit_mov_r32_p32_keepflags(drcbe, &dst, dstreg, &srcp); | |
| 4464 | 4512 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4465 | 4513 | } |
| 4466 | 4514 | } |
| r2844 | r2845 | |
| 4509 | 4557 | |
| 4510 | 4558 | /* validate instruction */ |
| 4511 | 4559 | assert(inst->size == 4 || inst->size == 8); |
| 4512 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4560 | assert_no_condition(inst); | |
| 4561 | assert_flags(inst, DRCUML_FLAG_S | DRCUML_FLAG_Z); | |
| 4513 | 4562 | |
| 4514 | 4563 | /* normalize parameters */ |
| 4515 | 4564 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI, &sizep, PTYPE_I); |
| 4565 | assert(srcp.type != DRCUML_PTYPE_IMMEDIATE); | |
| 4516 | 4566 | |
| 4517 | /* degenerate cases -- convert to a move */ | |
| 4518 | if (srcp.type == DRCUML_PTYPE_IMMEDIATE) | |
| 4519 | { | |
| 4520 | if (sizep.value == DRCUML_SIZE_BYTE) | |
| 4521 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT8)srcp.value); | |
| 4522 | else if (sizep.value == DRCUML_SIZE_WORD) | |
| 4523 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT16)srcp.value); | |
| 4524 | else if (sizep.value == DRCUML_SIZE_DWORD) | |
| 4525 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)srcp.value); | |
| 4526 | } | |
| 4527 | ||
| 4528 | 4567 | /* pick a target register for the general case */ |
| 4529 | 4568 | dstreg = (inst->size == 8) ? REG_EAX : param_select_register(REG_EAX, &dstp, NULL); |
| 4530 | 4569 | |
| r2844 | r2845 | |
| 4554 | 4593 | else if (sizep.value == DRCUML_SIZE_DWORD && dstreg != srcp.value) |
| 4555 | 4594 | emit_mov_r32_r32(&dst, dstreg, srcp.value); // mov dstreg,srcp |
| 4556 | 4595 | } |
| 4596 | if (inst->flags != 0) | |
| 4597 | emit_test_r32_r32(&dst, dstreg, dstreg); // test dstreg,dstreg | |
| 4557 | 4598 | |
| 4558 | 4599 | /* 32-bit form: store the low 32 bits */ |
| 4559 | 4600 | if (inst->size == 4) |
| r2844 | r2845 | |
| 4580 | 4621 | |
| 4581 | 4622 | /* validate instruction */ |
| 4582 | 4623 | assert(inst->size == 4 || inst->size == 8); |
| 4583 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4624 | assert_no_condition(inst); | |
| 4625 | assert_flags(inst, DRCUML_FLAG_S | DRCUML_FLAG_Z); | |
| 4584 | 4626 | |
| 4585 | 4627 | /* normalize parameters */ |
| 4586 | 4628 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI, &shiftp, PTYPE_MRI, &maskp, PTYPE_MRI); |
| 4587 | 4629 | |
| 4588 | /* degenerate cases -- convert to a move or simple shift */ | |
| 4589 | if (srcp.type == DRCUML_PTYPE_IMMEDIATE && shiftp.type == DRCUML_PTYPE_IMMEDIATE && maskp.type == DRCUML_PTYPE_IMMEDIATE) | |
| 4590 | { | |
| 4591 | if (inst->size == 4) | |
| 4592 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, ((srcp.value << shiftp.value) | (srcp.value >> (32 - shiftp.value))) & maskp.value); | |
| 4593 | else if (inst->size == 8) | |
| 4594 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, ((srcp.value << shiftp.value) | (srcp.value >> (64 - shiftp.value))) & maskp.value); | |
| 4595 | } | |
| 4596 | if (shiftp.type == DRCUML_PTYPE_IMMEDIATE && maskp.type == DRCUML_PTYPE_IMMEDIATE) | |
| 4597 | { | |
| 4598 | if ((inst->size == 4 && maskp.value == (UINT32)(0xffffffffUL << shiftp.value)) || (inst->size == 8 && maskp.value == U64(0xffffffffffffffff) << shiftp.value)) | |
| 4599 | { | |
| 4600 | drcuml_instruction temp = *inst; | |
| 4601 | temp.numparams = 3; | |
| 4602 | return op_shl(drcbe, dst, &temp); | |
| 4603 | } | |
| 4604 | if ((inst->size == 4 && maskp.value == (UINT32)(0xffffffffUL >> (32 - shiftp.value))) || (inst->size == 8 && maskp.value == U64(0xffffffffffffffff) >> (64 - shiftp.value))) | |
| 4605 | { | |
| 4606 | drcuml_instruction temp = *inst; | |
| 4607 | temp.numparams = 3; | |
| 4608 | temp.param[2].value = inst->size * 8 - temp.param[2].value; | |
| 4609 | return op_shr(drcbe, dst, &temp); | |
| 4610 | } | |
| 4611 | } | |
| 4612 | ||
| 4613 | 4630 | /* pick a target register for the general case */ |
| 4614 | 4631 | dstreg = param_select_register2(REG_EAX, &dstp, &shiftp, &maskp); |
| 4615 | 4632 | |
| r2844 | r2845 | |
| 4645 | 4662 | |
| 4646 | 4663 | /* validate instruction */ |
| 4647 | 4664 | assert(inst->size == 4 || inst->size == 8); |
| 4648 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 4665 | assert_no_condition(inst); | |
| 4666 | assert_flags(inst, DRCUML_FLAG_S | DRCUML_FLAG_Z); | |
| 4649 | 4667 | |
| 4650 | 4668 | /* normalize parameters */ |
| 4651 | 4669 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI, &shiftp, PTYPE_MRI, &maskp, PTYPE_MRI); |
| r2844 | r2845 | |
| 4723 | 4741 | } |
| 4724 | 4742 | emit_mov_r32_m32(&dst, REG_EBX, MBD(REG_ESP, -8)); // mov ebx,[esp-8] |
| 4725 | 4743 | } |
| 4744 | if (inst->flags == DRCUML_FLAG_Z) | |
| 4745 | emit_or_r32_r32(&dst, REG_EAX, REG_EDX); // or eax,edx | |
| 4746 | else if (inst->flags == DRCUML_FLAG_S) | |
| 4747 | ;// do nothing -- final OR will have the right result | |
| 4748 | else if (inst->flags == (DRCUML_FLAG_Z | DRCUML_FLAG_S)) | |
| 4749 | { | |
| 4750 | emit_movzx_r32_r16(&dst, REG_ECX, REG_AX); // movzx ecx,ax | |
| 4751 | emit_shr_r32_imm(&dst, REG_EAX, 16); // shr eax,16 | |
| 4752 | emit_or_r32_r32(&dst, REG_EDX, REG_ECX); // or edx,ecx | |
| 4753 | emit_or_r32_r32(&dst, REG_EDX, REG_EAX); // or edx,eax | |
| 4754 | } | |
| 4726 | 4755 | } |
| 4727 | 4756 | return dst; |
| 4728 | 4757 | } |
| r2844 | r2845 | |
| 4739 | 4768 | |
| 4740 | 4769 | /* validate instruction */ |
| 4741 | 4770 | assert(inst->size == 4 || inst->size == 8); |
| 4742 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 4771 | assert_no_condition(inst); | |
| 4772 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 4743 | 4773 | |
| 4744 | 4774 | /* normalize parameters */ |
| 4745 | 4775 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 4776 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 4746 | 4777 | |
| 4747 | /* degenerate cases -- convert to a move */ | |
| 4748 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 4749 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value + src2p.value); | |
| 4750 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 4751 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 4752 | ||
| 4753 | 4778 | /* pick a target register for the general case */ |
| 4754 | 4779 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 4755 | 4780 | |
| r2844 | r2845 | |
| 4761 | 4786 | emit_add_m32_p32(drcbe, &dst, MABS(dstp.value), &src2p, inst); // add [dstp],src2p |
| 4762 | 4787 | |
| 4763 | 4788 | /* reg = reg + imm */ |
| 4764 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst-> | |
| 4789 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst-> | |
| 4765 | 4790 | emit_lea_r32_m32(&dst, dstp.value, MBD(src1p.value, src2p.value)); // lea dstp,[src1p+src2p] |
| 4766 | 4791 | |
| 4767 | 4792 | /* reg = reg + reg */ |
| 4768 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_INT_REGISTER && inst-> | |
| 4793 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_INT_REGISTER && inst-> | |
| 4769 | 4794 | emit_lea_r32_m32(&dst, dstp.value, MBISD(src1p.value, src2p.value, 1, 0)); // lea dstp,[src1p+src2p] |
| 4770 | 4795 | |
| 4771 | 4796 | /* general case */ |
| r2844 | r2845 | |
| 4807 | 4832 | |
| 4808 | 4833 | /* validate instruction */ |
| 4809 | 4834 | assert(inst->size == 4 || inst->size == 8); |
| 4810 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 4835 | assert_no_condition(inst); | |
| 4836 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 4811 | 4837 | |
| 4812 | 4838 | /* normalize parameters */ |
| 4813 | 4839 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| r2844 | r2845 | |
| 4825 | 4851 | /* general case */ |
| 4826 | 4852 | else |
| 4827 | 4853 | { |
| 4828 | emit_mov_r32_p32(drcbe, &dst, dstreg, &src1p); | |
| 4854 | emit_mov_r32_p32_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 4829 | 4855 | emit_adc_r32_p32(drcbe, &dst, dstreg, &src2p, inst); // adc dstreg,src2p |
| 4830 | 4856 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4831 | 4857 | } |
| r2844 | r2845 | |
| 4841 | 4867 | /* general case */ |
| 4842 | 4868 | else |
| 4843 | 4869 | { |
| 4844 | emit_mov_r64_p64(drcbe, &dst, dstreg, REG_EDX, &src1p); | |
| 4870 | emit_mov_r64_p64_keepflags(drcbe, &dst, dstreg, REG_EDX, &src1p); | |
| 4845 | 4871 | emit_adc_r64_p64(drcbe, &dst, dstreg, REG_EDX, &src2p, inst); // adc dstreg:dstp,src2p |
| 4846 | 4872 | emit_mov_p64_r64(drcbe, &dst, &dstp, dstreg, REG_EDX); // mov dstp,dstreg:eax |
| 4847 | 4873 | } |
| r2844 | r2845 | |
| 4861 | 4887 | |
| 4862 | 4888 | /* validate instruction */ |
| 4863 | 4889 | assert(inst->size == 4 || inst->size == 8); |
| 4864 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 4890 | assert_no_condition(inst); | |
| 4891 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 4865 | 4892 | |
| 4866 | 4893 | /* normalize parameters */ |
| 4867 | 4894 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 4895 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 4868 | 4896 | |
| 4869 | /* degenerate cases -- convert to a move */ | |
| 4870 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 4871 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value - src2p.value); | |
| 4872 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 4873 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 4874 | ||
| 4875 | 4897 | /* pick a target register for the general case */ |
| 4876 | 4898 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 4877 | 4899 | |
| r2844 | r2845 | |
| 4883 | 4905 | emit_sub_m32_p32(drcbe, &dst, MABS(dstp.value), &src2p, inst); // sub [dstp],src2p |
| 4884 | 4906 | |
| 4885 | 4907 | /* reg = reg - imm */ |
| 4886 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst-> | |
| 4908 | else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst-> | |
| 4887 | 4909 | emit_lea_r32_m32(&dst, dstp.value, MBD(src1p.value, -src2p.value)); // lea dstp,[src1p-src2p] |
| 4888 | 4910 | |
| 4889 | 4911 | /* general case */ |
| r2844 | r2845 | |
| 4925 | 4947 | |
| 4926 | 4948 | /* validate instruction */ |
| 4927 | 4949 | assert(inst->size == 4 || inst->size == 8); |
| 4928 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 4950 | assert_no_condition(inst); | |
| 4951 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 4929 | 4952 | |
| 4930 | 4953 | /* normalize parameters */ |
| 4931 | 4954 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| r2844 | r2845 | |
| 4943 | 4966 | /* general case */ |
| 4944 | 4967 | else |
| 4945 | 4968 | { |
| 4946 | emit_mov_r32_p32(drcbe, &dst, dstreg, &src1p); | |
| 4969 | emit_mov_r32_p32_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 4947 | 4970 | emit_sbb_r32_p32(drcbe, &dst, dstreg, &src2p, inst); // sbb dstreg,src2p |
| 4948 | 4971 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 4949 | 4972 | } |
| r2844 | r2845 | |
| 4959 | 4982 | /* general case */ |
| 4960 | 4983 | else |
| 4961 | 4984 | { |
| 4962 | emit_mov_r64_p64(drcbe, &dst, dstreg, REG_EDX, &src1p); | |
| 4985 | emit_mov_r64_p64_keepflags(drcbe, &dst, dstreg, REG_EDX, &src1p); | |
| 4963 | 4986 | emit_sbb_r64_p64(drcbe, &dst, dstreg, REG_EDX, &src2p, inst); // sbb dstreg:dstp,src2p |
| 4964 | 4987 | emit_mov_p64_r64(drcbe, &dst, &dstp, dstreg, REG_EDX); // mov dstp,dstreg:eax |
| 4965 | 4988 | } |
| r2844 | r2845 | |
| 4980 | 5003 | |
| 4981 | 5004 | /* validate instruction */ |
| 4982 | 5005 | assert(inst->size == 4 || inst->size == 8); |
| 4983 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5006 | assert_no_condition(inst); | |
| 5007 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 4984 | 5008 | |
| 4985 | 5009 | /* normalize parameters */ |
| 4986 | 5010 | param_normalize_2(drcbe, inst, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 4987 | 5011 | |
| 4988 | /* degenerate cases */ | |
| 4989 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && src1p.value == src2p.value) | |
| 4990 | { | |
| 4991 | emit_cmp_r32_r32(&dst, REG_EAX, REG_EAX); // cmp eax,eax | |
| 4992 | return dst; | |
| 4993 | } | |
| 4994 | ||
| 4995 | 5012 | /* pick a target register for the general case */ |
| 4996 | 5013 | src1reg = param_select_register(REG_EAX, &src1p, NULL); |
| 4997 | 5014 | |
| r2844 | r2845 | |
| 5053 | 5070 | |
| 5054 | 5071 | /* validate instruction */ |
| 5055 | 5072 | assert(inst->size == 4 || inst->size == 8); |
| 5056 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5073 | assert_no_condition(inst); | |
| 5074 | assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5057 | 5075 | |
| 5058 | 5076 | /* normalize parameters */ |
| 5059 | 5077 | param_normalize_4_commutative(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5060 | 5078 | compute_hi = (dstp.type != edstp.type || dstp.value != edstp.value); |
| 5061 | 5079 | |
| 5062 | /* degenerate cases -- convert to a move */ | |
| 5063 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5064 | { | |
| 5065 | if (inst->size == 4) | |
| 5066 | { | |
| 5067 | if (!compute_hi) | |
| 5068 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT32)src1p.value * (UINT32)src2p.value); | |
| 5069 | else | |
| 5070 | { | |
| 5071 | UINT64 result = (UINT64)(UINT32)src1p.value * (UINT64)(UINT32)src2p.value; | |
| 5072 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, result & 0xffffffff); | |
| 5073 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, result >> 32); | |
| 5074 | } | |
| 5075 | } | |
| 5076 | else if (inst->size == 8) | |
| 5077 | { | |
| 5078 | UINT64 reslo, reshi; | |
| 5079 | if (!compute_hi) | |
| 5080 | { | |
| 5081 | dmulu(&reslo, &reslo, src1p.value, src2p.value); | |
| 5082 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5083 | } | |
| 5084 | else | |
| 5085 | { | |
| 5086 | dmulu(&reslo, &reshi, src1p.value, src2p.value); | |
| 5087 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5088 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reshi); | |
| 5089 | } | |
| 5090 | } | |
| 5091 | } | |
| 5092 | ||
| 5093 | 5080 | /* 32-bit form */ |
| 5094 | 5081 | if (inst->size == 4) |
| 5095 | 5082 | { |
| r2844 | r2845 | |
| 5109 | 5096 | emit_mov_p32_r32(drcbe, &dst, &edstp, REG_EDX); // mov edstp,edx |
| 5110 | 5097 | |
| 5111 | 5098 | /* compute flags */ |
| 5112 | if (inst-> | |
| 5099 | if (inst-> | |
| 5113 | 5100 | { |
| 5114 | 5101 | if (compute_hi) |
| 5115 | 5102 | { |
| 5116 | if (inst-> | |
| 5103 | if (inst-> | |
| 5117 | 5104 | emit_or_r32_r32(&dst, REG_EDX, REG_EAX); // or edx,eax |
| 5118 | else if (inst-> | |
| 5105 | else if (inst-> | |
| 5119 | 5106 | emit_test_r32_r32(&dst, REG_EDX, REG_EDX); // test edx,edx |
| 5120 | 5107 | else |
| 5121 | 5108 | { |
| r2844 | r2845 | |
| 5134 | 5121 | else if (inst->size == 8) |
| 5135 | 5122 | { |
| 5136 | 5123 | /* general case */ |
| 5137 | emit_push_p64(drcbe, &dst, &src2p); // push src2p | |
| 5138 | emit_push_p64(drcbe, &dst, &src1p); // push src1p | |
| 5124 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 16), &src2p); // mov [esp+16],src2p | |
| 5125 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 8), &src1p); // mov [esp+8],src1p | |
| 5139 | 5126 | if (!compute_hi) |
| 5140 | emit_ | |
| 5127 | emit_mov | |
| 5141 | 5128 | else |
| 5142 | emit_push_imm(&dst, (FPTR)&drcbe->reshi); // push &reshi | |
| 5143 | emit_push_imm(&dst, (FPTR)&drcbe->reslo); // push &reslo | |
| 5129 | emit_mov_m32_imm(&dst, MBD(REG_ESP, 4), (FPTR)&drcbe->reshi); // push [esp+4],&reshi | |
| 5130 | emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (FPTR)&drcbe->reslo); // mov [esp],&reslo | |
| 5144 | 5131 | emit_call(&dst, (x86code *)dmulu); // call dmulu |
| 5145 | emit_add_r32_imm(&dst, REG_ESP, 24); // add esp,24 | |
| 5146 | 5132 | emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reslo + 0)); // mov eax,reslo.lo |
| 5147 | 5133 | emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reslo + 1)); // mov edx,reslo.hi |
| 5148 | 5134 | emit_mov_p64_r64(drcbe, &dst, &dstp, REG_EAX, REG_EDX); // mov dstp,edx:eax |
| 5149 | if (inst-> | |
| 5135 | if (inst-> | |
| 5150 | 5136 | { |
| 5151 | if (inst-> | |
| 5137 | if (inst-> | |
| 5152 | 5138 | emit_or_r32_r32(&dst, REG_EDX, REG_EAX); // or edx,eax |
| 5153 | else if (inst-> | |
| 5139 | else if (inst-> | |
| 5154 | 5140 | emit_test_r32_r32(&dst, REG_EDX, REG_EDX); // test edx,edx |
| 5155 | 5141 | else |
| 5156 | 5142 | { |
| r2844 | r2845 | |
| 5162 | 5148 | } |
| 5163 | 5149 | if (compute_hi) |
| 5164 | 5150 | { |
| 5165 | if (inst-> | |
| 5151 | if (inst-> | |
| 5166 | 5152 | emit_or_r32_r32(&dst, REG_EDX, REG_EAX); // or edx,eax |
| 5167 | 5153 | emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reshi + 0)); // mov eax,reshi.lo |
| 5168 | 5154 | emit_mov_r32_m32(&dst, REG_ECX, MABS((UINT32 *)&drcbe->reshi + 1)); // mov ecx,reshi.hi |
| 5169 | 5155 | emit_mov_p64_r64(drcbe, &dst, &edstp, REG_EAX, REG_ECX); // mov edstp,ecx:eax |
| 5170 | if (inst-> | |
| 5156 | if (inst-> | |
| 5171 | 5157 | { |
| 5172 | if (inst-> | |
| 5158 | if (inst-> | |
| 5173 | 5159 | { |
| 5174 | 5160 | emit_or_r32_r32(&dst, REG_EDX, REG_EAX); // or edx,eax |
| 5175 | 5161 | emit_or_r32_r32(&dst, REG_EDX, REG_ECX); // or edx,ecx |
| 5176 | 5162 | } |
| 5177 | else if (inst-> | |
| 5163 | else if (inst-> | |
| 5178 | 5164 | emit_test_r32_r32(&dst, REG_ECX, REG_ECX); // test ecx,ecx |
| 5179 | 5165 | else |
| 5180 | 5166 | { |
| r2844 | r2845 | |
| 5202 | 5188 | |
| 5203 | 5189 | /* validate instruction */ |
| 5204 | 5190 | assert(inst->size == 4 || inst->size == 8); |
| 5205 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5191 | assert_no_condition(inst); | |
| 5192 | assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5206 | 5193 | |
| 5207 | 5194 | /* normalize parameters */ |
| 5208 | 5195 | param_normalize_4_commutative(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5209 | 5196 | compute_hi = (dstp.type != edstp.type || dstp.value != edstp.value); |
| 5210 | 5197 | |
| 5211 | /* degenerate cases -- convert to a move */ | |
| 5212 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5213 | { | |
| 5214 | if (inst->size == 4) | |
| 5215 | { | |
| 5216 | if (!compute_hi) | |
| 5217 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)src1p.value * (INT32)src2p.value); | |
| 5218 | else | |
| 5219 | { | |
| 5220 | UINT64 result = (INT64)(INT32)src1p.value * (INT64)(INT32)src2p.value; | |
| 5221 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, result & 0xffffffff); | |
| 5222 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, result >> 32); | |
| 5223 | } | |
| 5224 | } | |
| 5225 | else if (inst->size == 8) | |
| 5226 | { | |
| 5227 | UINT64 reslo, reshi; | |
| 5228 | if (!compute_hi) | |
| 5229 | { | |
| 5230 | dmuls(&reslo, &reslo, src1p.value, src2p.value); | |
| 5231 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5232 | } | |
| 5233 | else | |
| 5234 | { | |
| 5235 | dmuls(&reslo, &reshi, src1p.value, src2p.value); | |
| 5236 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5237 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reshi); | |
| 5238 | } | |
| 5239 | } | |
| 5240 | } | |
| 5241 | ||
| 5242 | 5198 | /* 32-bit form */ |
| 5243 | 5199 | if (inst->size == 4) |
| 5244 | 5200 | { |
| r2844 | r2845 | |
| 5281 | 5237 | } |
| 5282 | 5238 | |
| 5283 | 5239 | /* compute flags */ |
| 5284 | if (inst-> | |
| 5240 | if (inst-> | |
| 5285 | 5241 | { |
| 5286 | 5242 | if (compute_hi) |
| 5287 | 5243 | { |
| 5288 | if (inst-> | |
| 5244 | if (inst-> | |
| 5289 | 5245 | emit_or_r32_r32(&dst, REG_EDX, REG_EAX); // or edx,eax |
| 5290 | else if (inst-> | |
| 5246 | else if (inst-> | |
| 5291 | 5247 | emit_test_r32_r32(&dst, REG_EDX, REG_EDX); // test edx,edx |
| 5292 | 5248 | else |
| 5293 | 5249 | { |
| r2844 | r2845 | |
| 5306 | 5262 | else if (inst->size == 8) |
| 5307 | 5263 | { |
| 5308 | 5264 | /* general case */ |
| 5309 | emit_push_p64(drcbe, &dst, &src2p); // push src2p | |
| 5310 | emit_push_p64(drcbe, &dst, &src1p); // push src1p | |
| 5265 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 16), &src2p); // mov [esp+16],src2p | |
| 5266 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 8), &src1p); // mov [esp+8],src1p | |
| 5311 | 5267 | if (!compute_hi) |
| 5312 | emit_ | |
| 5268 | emit_mov | |
| 5313 | 5269 | else |
| 5314 | emit_push_imm(&dst, (FPTR)&drcbe->reshi); // push &reshi | |
| 5315 | emit_push_imm(&dst, (FPTR)&drcbe->reslo); // push &reslo | |
| 5270 | emit_mov_m32_imm(&dst, MBD(REG_ESP, 4), (FPTR)&drcbe->reshi); // push [esp+4],&reshi | |
| 5271 | emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (FPTR)&drcbe->reslo); // mov [esp],&reslo | |
| 5316 | 5272 | emit_call(&dst, (x86code *)dmuls); // call dmuls |
| 5317 | emit_add_r32_imm(&dst, REG_ESP, 24); // add esp,24 | |
| 5318 | 5273 | emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reslo + 0)); // mov eax,reslo.lo |
| 5319 | 5274 | emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reslo + 1)); // mov edx,reslo.hi |
| 5320 | 5275 | emit_mov_p64_r64(drcbe, &dst, &dstp, REG_EAX, REG_EDX); // mov dstp,edx:eax |
| 5321 | if (inst-> | |
| 5276 | if (inst-> | |
| 5322 | 5277 | { |
| 5323 | if (inst-> | |
| 5278 | if (inst-> | |
| 5324 | 5279 | emit_or_r32_r32(&dst, REG_EDX, REG_EAX); // or edx,eax |
| 5325 | else if (inst-> | |
| 5280 | else if (inst-> | |
| 5326 | 5281 | emit_test_r32_r32(&dst, REG_EDX, REG_EDX); // test edx,edx |
| 5327 | 5282 | else |
| 5328 | 5283 | { |
| r2844 | r2845 | |
| 5337 | 5292 | emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reshi + 0)); // mov eax,reshi.lo |
| 5338 | 5293 | emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reshi + 1)); // mov edx,reshi.hi |
| 5339 | 5294 | emit_mov_p64_r64(drcbe, &dst, &edstp, REG_EAX, REG_EDX); // mov edstp,edx:eax |
| 5340 | if (inst-> | |
| 5295 | if (inst-> | |
| 5341 | 5296 | { |
| 5342 | if (inst-> | |
| 5297 | if (inst-> | |
| 5343 | 5298 | { |
| 5344 | 5299 | emit_or_r32_r32(&dst, REG_EDX, REG_EAX); // or edx,eax |
| 5345 | 5300 | emit_or_r32_r32(&dst, REG_EDX, REG_ECX); // or edx,ecx |
| 5346 | 5301 | } |
| 5347 | else if (inst-> | |
| 5302 | else if (inst-> | |
| 5348 | 5303 | emit_test_r32_r32(&dst, REG_ECX, REG_ECX); // test ecx,ecx |
| 5349 | 5304 | else |
| 5350 | 5305 | { |
| r2844 | r2845 | |
| 5373 | 5328 | |
| 5374 | 5329 | /* validate instruction */ |
| 5375 | 5330 | assert(inst->size == 4 || inst->size == 8); |
| 5376 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5331 | assert_no_condition(inst); | |
| 5332 | assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5377 | 5333 | |
| 5378 | 5334 | /* normalize parameters */ |
| 5379 | 5335 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5380 | 5336 | compute_rem = (dstp.type != edstp.type || dstp.value != edstp.value); |
| 5381 | 5337 | |
| 5382 | /* degenerate cases -- convert to a move */ | |
| 5383 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5384 | { | |
| 5385 | if (inst->size == 4) | |
| 5386 | { | |
| 5387 | if ((UINT32)src2p.value == 0) | |
| 5388 | return dst; | |
| 5389 | if (!compute_rem) | |
| 5390 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT32)src1p.value / (UINT32)src2p.value); | |
| 5391 | else | |
| 5392 | { | |
| 5393 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT32)src1p.value / (UINT32)src2p.value); | |
| 5394 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT32)src1p.value % (UINT32)src2p.value); | |
| 5395 | } | |
| 5396 | } | |
| 5397 | else if (inst->size == 8) | |
| 5398 | { | |
| 5399 | UINT64 reslo, reshi; | |
| 5400 | if (src2p.value == 0) | |
| 5401 | return dst; | |
| 5402 | if (!compute_rem) | |
| 5403 | { | |
| 5404 | ddivu(&reslo, &reslo, src1p.value, src2p.value); | |
| 5405 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5406 | } | |
| 5407 | else | |
| 5408 | { | |
| 5409 | ddivu(&reslo, &reshi, src1p.value, src2p.value); | |
| 5410 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5411 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reshi); | |
| 5412 | } | |
| 5413 | } | |
| 5414 | } | |
| 5415 | ||
| 5416 | 5338 | /* 32-bit form */ |
| 5417 | 5339 | if (inst->size == 4) |
| 5418 | 5340 | { |
| r2844 | r2845 | |
| 5425 | 5347 | emit_mov_p32_r32(drcbe, &dst, &dstp, REG_EAX); // mov dstp,eax |
| 5426 | 5348 | if (compute_rem) |
| 5427 | 5349 | emit_mov_p32_r32(drcbe, &dst, &edstp, REG_EDX); // mov edstp,edx |
| 5350 | if (inst->flags != 0) | |
| 5351 | emit_test_r32_r32(&dst, REG_EAX, REG_EAX); // test eax,eax | |
| 5428 | 5352 | resolve_link(&dst, &skip); // skip: |
| 5429 | 5353 | } |
| 5430 | 5354 | |
| r2844 | r2845 | |
| 5432 | 5356 | else if (inst->size == 8) |
| 5433 | 5357 | { |
| 5434 | 5358 | /* general case */ |
| 5435 | emit_push_p64(drcbe, &dst, &src2p); // push src2p | |
| 5436 | emit_push_p64(drcbe, &dst, &src1p); // push src1p | |
| 5359 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 16), &src2p); // mov [esp+16],src2p | |
| 5360 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 8), &src1p); // mov [esp+8],src1p | |
| 5437 | 5361 | if (!compute_rem) |
| 5438 | emit_ | |
| 5362 | emit_mov | |
| 5439 | 5363 | else |
| 5440 | emit_push_imm(&dst, (FPTR)&drcbe->reshi); // push &reshi | |
| 5441 | emit_push_imm(&dst, (FPTR)&drcbe->reslo); // push &reslo | |
| 5364 | emit_mov_m32_imm(&dst, MBD(REG_ESP, 4), (FPTR)&drcbe->reshi); // push [esp+4],&reshi | |
| 5365 | emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (FPTR)&drcbe->reslo); // mov [esp],&reslo | |
| 5442 | 5366 | emit_call(&dst, (x86code *)ddivu); // call ddivu |
| 5443 | emit_add_r32_imm(&dst, REG_ESP, 24); // add esp,24 | |
| 5444 | 5367 | emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reslo + 0)); // mov eax,reslo.lo |
| 5445 | 5368 | emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reslo + 1)); // mov edx,reslo.hi |
| 5446 | 5369 | emit_mov_p64_r64(drcbe, &dst, &dstp, REG_EAX, REG_EDX); // mov dstp,edx:eax |
| 5447 | if (inst-> | |
| 5370 | if (inst-> | |
| 5448 | 5371 | emit_or_r32_r32(&dst, REG_EAX, REG_EDX); // or eax,edx |
| 5449 | 5372 | if (compute_rem) |
| 5450 | 5373 | { |
| r2844 | r2845 | |
| 5469 | 5392 | |
| 5470 | 5393 | /* validate instruction */ |
| 5471 | 5394 | assert(inst->size == 4 || inst->size == 8); |
| 5472 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5395 | assert_no_condition(inst); | |
| 5396 | assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5473 | 5397 | |
| 5474 | 5398 | /* normalize parameters */ |
| 5475 | 5399 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5476 | 5400 | compute_rem = (dstp.type != edstp.type || dstp.value != edstp.value); |
| 5477 | 5401 | |
| 5478 | /* degenerate cases -- convert to a move */ | |
| 5479 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5480 | { | |
| 5481 | if (inst->size == 4) | |
| 5482 | { | |
| 5483 | if ((INT32)src2p.value == 0) | |
| 5484 | return dst; | |
| 5485 | if (!compute_rem) | |
| 5486 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)src1p.value / (INT32)src2p.value); | |
| 5487 | else | |
| 5488 | { | |
| 5489 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)src1p.value / (INT32)src2p.value); | |
| 5490 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)src1p.value % (INT32)src2p.value); | |
| 5491 | } | |
| 5492 | } | |
| 5493 | else if (inst->size == 8) | |
| 5494 | { | |
| 5495 | UINT64 reslo, reshi; | |
| 5496 | if (src2p.value == 0) | |
| 5497 | return dst; | |
| 5498 | if (!compute_rem) | |
| 5499 | { | |
| 5500 | ddivs(&reslo, &reslo, src1p.value, src2p.value); | |
| 5501 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5502 | } | |
| 5503 | else | |
| 5504 | { | |
| 5505 | ddivs(&reslo, &reshi, src1p.value, src2p.value); | |
| 5506 | dst = convert_to_mov_imm(drcbe, dst, inst, &dstp, reslo); | |
| 5507 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, reshi); | |
| 5508 | } | |
| 5509 | } | |
| 5510 | } | |
| 5511 | ||
| 5512 | 5402 | /* 32-bit form */ |
| 5513 | 5403 | if (inst->size == 4) |
| 5514 | 5404 | { |
| r2844 | r2845 | |
| 5521 | 5411 | emit_mov_p32_r32(drcbe, &dst, &dstp, REG_EAX); // mov dstp,eax |
| 5522 | 5412 | if (compute_rem) |
| 5523 | 5413 | emit_mov_p32_r32(drcbe, &dst, &edstp, REG_EDX); // mov edstp,edx |
| 5414 | if (inst->flags != 0) | |
| 5415 | emit_test_r32_r32(&dst, REG_EAX, REG_EAX); // test eax,eax | |
| 5524 | 5416 | resolve_link(&dst, &skip); // skip: |
| 5525 | 5417 | } |
| 5526 | 5418 | |
| r2844 | r2845 | |
| 5528 | 5420 | else if (inst->size == 8) |
| 5529 | 5421 | { |
| 5530 | 5422 | /* general case */ |
| 5531 | emit_push_p64(drcbe, &dst, &src2p); // push src2p | |
| 5532 | emit_push_p64(drcbe, &dst, &src1p); // push src1p | |
| 5423 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 16), &src2p); // mov [esp+16],src2p | |
| 5424 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 8), &src1p); // mov [esp+8],src1p | |
| 5533 | 5425 | if (!compute_rem) |
| 5534 | emit_ | |
| 5426 | emit_mov | |
| 5535 | 5427 | else |
| 5536 | emit_push_imm(&dst, (FPTR)&drcbe->reshi); // push &reshi | |
| 5537 | emit_push_imm(&dst, (FPTR)&drcbe->reslo); // push &reslo | |
| 5428 | emit_mov_m32_imm(&dst, MBD(REG_ESP, 4), (FPTR)&drcbe->reshi); // push [esp+4],&reshi | |
| 5429 | emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (FPTR)&drcbe->reslo); // mov [esp],&reslo | |
| 5538 | 5430 | emit_call(&dst, (x86code *)ddivs); // call ddivs |
| 5539 | emit_add_r32_imm(&dst, REG_ESP, 24); // add esp,24 | |
| 5540 | 5431 | emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reslo + 0)); // mov eax,reslo.lo |
| 5541 | 5432 | emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reslo + 1)); // mov edx,reslo.hi |
| 5542 | 5433 | emit_mov_p64_r64(drcbe, &dst, &dstp, REG_EAX, REG_EDX); // mov dstp,edx:eax |
| 5543 | if (inst-> | |
| 5434 | if (inst-> | |
| 5544 | 5435 | emit_or_r32_r32(&dst, REG_EAX, REG_EDX); // or eax,edx |
| 5545 | 5436 | if (compute_rem) |
| 5546 | 5437 | { |
| r2844 | r2845 | |
| 5564 | 5455 | |
| 5565 | 5456 | /* validate instruction */ |
| 5566 | 5457 | assert(inst->size == 4 || inst->size == 8); |
| 5567 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5458 | assert_no_condition(inst); | |
| 5459 | assert_flags(inst, DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5568 | 5460 | |
| 5569 | 5461 | /* normalize parameters */ |
| 5570 | 5462 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5463 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5571 | 5464 | |
| 5572 | /* degenerate cases -- convert to a move */ | |
| 5573 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5574 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value & src2p.value); | |
| 5575 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && (src2p.value & size_to_mask[inst->size]) == size_to_mask[inst->size] && inst->condflags == 0) | |
| 5576 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5577 | ||
| 5578 | 5465 | /* pick a target register for the general case */ |
| 5579 | 5466 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5580 | 5467 | |
| r2844 | r2845 | |
| 5624 | 5511 | |
| 5625 | 5512 | /* validate instruction */ |
| 5626 | 5513 | assert(inst->size == 4 || inst->size == 8); |
| 5627 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5514 | assert_no_condition(inst); | |
| 5515 | assert_flags(inst, DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5628 | 5516 | |
| 5629 | 5517 | /* normalize parameters */ |
| 5630 | 5518 | param_normalize_2_commutative(drcbe, inst, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| r2844 | r2845 | |
| 5676 | 5564 | |
| 5677 | 5565 | /* validate instruction */ |
| 5678 | 5566 | assert(inst->size == 4 || inst->size == 8); |
| 5679 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5567 | assert_no_condition(inst); | |
| 5568 | assert_flags(inst, DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5680 | 5569 | |
| 5681 | 5570 | /* normalize parameters */ |
| 5682 | 5571 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5572 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5683 | 5573 | |
| 5684 | /* degenerate cases -- convert to a move */ | |
| 5685 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5686 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value | src2p.value); | |
| 5687 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 5688 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5689 | ||
| 5690 | 5574 | /* pick a target register for the general case */ |
| 5691 | 5575 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5692 | 5576 | |
| r2844 | r2845 | |
| 5736 | 5620 | |
| 5737 | 5621 | /* validate instruction */ |
| 5738 | 5622 | assert(inst->size == 4 || inst->size == 8); |
| 5739 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5623 | assert_no_condition(inst); | |
| 5624 | assert_flags(inst, DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5740 | 5625 | |
| 5741 | 5626 | /* normalize parameters */ |
| 5742 | 5627 | param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5628 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5743 | 5629 | |
| 5744 | /* degenerate cases -- convert to a move */ | |
| 5745 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5746 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value & src2p.value); | |
| 5747 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 5748 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5749 | ||
| 5750 | 5630 | /* pick a target register for the general case */ |
| 5751 | 5631 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5752 | 5632 | |
| r2844 | r2845 | |
| 5796 | 5676 | |
| 5797 | 5677 | /* validate instruction */ |
| 5798 | 5678 | assert(inst->size == 4 || inst->size == 8); |
| 5799 | assert(inst->condflags == 0); | |
| 5679 | assert_no_condition(inst); | |
| 5680 | assert_flags(inst, /*DRCUML_FLAG_Z | DRCUML_FLAG_S*/0); | |
| 5800 | 5681 | |
| 5801 | 5682 | /* normalize parameters */ |
| 5802 | 5683 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI); |
| 5684 | assert(srcp.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5803 | 5685 | |
| 5804 | /* degenerate cases -- convert to a move */ | |
| 5805 | if (srcp.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0 && inst->size == 4) | |
| 5806 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, count_leading_zeros(srcp.value)); | |
| 5807 | ||
| 5808 | 5686 | /* pick a target register for the general case */ |
| 5809 | dstreg = param_select_register(REG_EAX, &dstp, | |
| 5687 | dstreg = param_select_register(REG_EAX, &dstp, NULL | |
| 5810 | 5688 | |
| 5811 | 5689 | /* 32-bit form */ |
| 5812 | 5690 | if (inst->size == 4) |
| r2844 | r2845 | |
| 5849 | 5727 | |
| 5850 | 5728 | /* validate instruction */ |
| 5851 | 5729 | assert(inst->size == 4 || inst->size == 8); |
| 5852 | assert(inst->condflags == 0); | |
| 5730 | assert_no_condition(inst); | |
| 5731 | assert_flags(inst, /*DRCUML_FLAG_Z | DRCUML_FLAG_S*/0); | |
| 5853 | 5732 | |
| 5854 | 5733 | /* normalize parameters */ |
| 5855 | 5734 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI); |
| 5735 | assert(srcp.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5856 | 5736 | |
| 5857 | /* degenerate cases -- convert to a move */ | |
| 5858 | if (srcp.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5859 | { | |
| 5860 | if (inst->size == 4) | |
| 5861 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, FLIPENDIAN_INT32(srcp.value)); | |
| 5862 | else if (inst->size == 8) | |
| 5863 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, FLIPENDIAN_INT64(srcp.value)); | |
| 5864 | } | |
| 5865 | ||
| 5866 | 5737 | /* pick a target register for the general case */ |
| 5867 | dstreg = param_select_register(REG_EAX, &dstp, | |
| 5738 | dstreg = param_select_register(REG_EAX, &dstp, NULL | |
| 5868 | 5739 | |
| 5869 | 5740 | /* 32-bit form */ |
| 5870 | 5741 | if (inst->size == 4) |
| r2844 | r2845 | |
| 5897 | 5768 | |
| 5898 | 5769 | /* validate instruction */ |
| 5899 | 5770 | assert(inst->size == 4 || inst->size == 8); |
| 5900 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5771 | assert_no_condition(inst); | |
| 5772 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5901 | 5773 | |
| 5902 | 5774 | /* normalize parameters */ |
| 5903 | 5775 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5776 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5904 | 5777 | |
| 5905 | /* degenerate cases -- convert to a move */ | |
| 5906 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5907 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, src1p.value << src2p.value); | |
| 5908 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 5909 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5910 | ||
| 5911 | 5778 | /* pick a target register for the general case */ |
| 5912 | 5779 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5913 | 5780 | |
| r2844 | r2845 | |
| 5950 | 5817 | |
| 5951 | 5818 | /* validate instruction */ |
| 5952 | 5819 | assert(inst->size == 4 || inst->size == 8); |
| 5953 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5820 | assert_no_condition(inst); | |
| 5821 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 5954 | 5822 | |
| 5955 | 5823 | /* normalize parameters */ |
| 5956 | 5824 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5825 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 5957 | 5826 | |
| 5958 | /* degenerate cases -- convert to a move */ | |
| 5959 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 5960 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT64)src1p.value >> src2p.value); | |
| 5961 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 5962 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 5963 | ||
| 5964 | 5827 | /* pick a target register for the general case */ |
| 5965 | 5828 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 5966 | 5829 | |
| r2844 | r2845 | |
| 6003 | 5866 | |
| 6004 | 5867 | /* validate instruction */ |
| 6005 | 5868 | assert(inst->size == 4 || inst->size == 8); |
| 6006 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5869 | assert_no_condition(inst); | |
| 5870 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 6007 | 5871 | |
| 6008 | 5872 | /* normalize parameters */ |
| 6009 | 5873 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5874 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 6010 | 5875 | |
| 6011 | /* degenerate cases -- convert to a move */ | |
| 6012 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 6013 | { | |
| 6014 | if (inst->size == 4) | |
| 6015 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT32)src1p.value >> src2p.value); | |
| 6016 | else if (inst->size == 8) | |
| 6017 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (INT64)src1p.value >> src2p.value); | |
| 6018 | } | |
| 6019 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 6020 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 6021 | ||
| 6022 | 5876 | /* pick a target register for the general case */ |
| 6023 | 5877 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 6024 | 5878 | |
| r2844 | r2845 | |
| 6061 | 5915 | |
| 6062 | 5916 | /* validate instruction */ |
| 6063 | 5917 | assert(inst->size == 4 || inst->size == 8); |
| 6064 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5918 | assert_no_condition(inst); | |
| 5919 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 6065 | 5920 | |
| 6066 | 5921 | /* normalize parameters */ |
| 6067 | 5922 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5923 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 6068 | 5924 | |
| 6069 | /* degenerate cases -- convert to a move */ | |
| 6070 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 6071 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT64)src1p.value >> src2p.value); | |
| 6072 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 6073 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 6074 | ||
| 6075 | 5925 | /* pick a target register for the general case */ |
| 6076 | 5926 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 6077 | 5927 | |
| r2844 | r2845 | |
| 6114 | 5964 | |
| 6115 | 5965 | /* validate instruction */ |
| 6116 | 5966 | assert(inst->size == 4 || inst->size == 8); |
| 6117 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 5967 | assert_no_condition(inst); | |
| 5968 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 6118 | 5969 | |
| 6119 | 5970 | /* normalize parameters */ |
| 6120 | 5971 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 5972 | assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE); | |
| 6121 | 5973 | |
| 6122 | /* degenerate cases -- convert to a move */ | |
| 6123 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 6124 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT64)src1p.value >> src2p.value); | |
| 6125 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 6126 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 6127 | ||
| 6128 | 5974 | /* pick a target register for the general case */ |
| 6129 | 5975 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 6130 | 5976 | |
| r2844 | r2845 | |
| 6167 | 6013 | |
| 6168 | 6014 | /* validate instruction */ |
| 6169 | 6015 | assert(inst->size == 4 || inst->size == 8); |
| 6170 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 6016 | assert_no_condition(inst); | |
| 6017 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 6171 | 6018 | |
| 6172 | 6019 | /* normalize parameters */ |
| 6173 | 6020 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 6174 | 6021 | |
| 6175 | /* degenerate cases -- convert to a move */ | |
| 6176 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 6177 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT64)src1p.value >> src2p.value); | |
| 6178 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 6179 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 6180 | ||
| 6181 | 6022 | /* pick a target register for the general case */ |
| 6182 | 6023 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 6183 | 6024 | |
| r2844 | r2845 | |
| 6191 | 6032 | /* general case */ |
| 6192 | 6033 | else |
| 6193 | 6034 | { |
| 6194 | emit_mov_r32_p32(drcbe, &dst, dstreg, &src1p); | |
| 6035 | emit_mov_r32_p32_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 6195 | 6036 | emit_rcl_r32_p32(drcbe, &dst, dstreg, &src2p, inst); // rcl dstreg,src2p |
| 6196 | 6037 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 6197 | 6038 | } |
| r2844 | r2845 | |
| 6201 | 6042 | else if (inst->size == 8) |
| 6202 | 6043 | { |
| 6203 | 6044 | /* general case */ |
| 6204 | emit_mov_r64_p64(drcbe, &dst, dstreg, REG_EDX, &src1p); | |
| 6045 | emit_mov_r64_p64_keepflags(drcbe, &dst, dstreg, REG_EDX, &src1p); | |
| 6205 | 6046 | emit_rcl_r64_p64(drcbe, &dst, dstreg, REG_EDX, &src2p, inst); // rcl dstreg:dstp,src2p |
| 6206 | 6047 | emit_mov_p64_r64(drcbe, &dst, &dstp, dstreg, REG_EDX); // mov dstp,dstreg:eax |
| 6207 | 6048 | } |
| r2844 | r2845 | |
| 6220 | 6061 | |
| 6221 | 6062 | /* validate instruction */ |
| 6222 | 6063 | assert(inst->size == 4 || inst->size == 8); |
| 6223 | assert((inst->condflags & ~(DRCUML_FLAG_Z | DRCUML_FLAG_S)) == 0); | |
| 6064 | assert_no_condition(inst); | |
| 6065 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_S); | |
| 6224 | 6066 | |
| 6225 | 6067 | /* normalize parameters */ |
| 6226 | 6068 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI); |
| 6227 | 6069 | |
| 6228 | /* degenerate cases -- convert to a move */ | |
| 6229 | if (src1p.type == DRCUML_PTYPE_IMMEDIATE && src2p.type == DRCUML_PTYPE_IMMEDIATE && inst->condflags == 0) | |
| 6230 | return convert_to_mov_imm(drcbe, dst, inst, &dstp, (UINT64)src1p.value >> src2p.value); | |
| 6231 | if (src2p.type == DRCUML_PTYPE_IMMEDIATE && src2p.value == 0 && inst->condflags == 0) | |
| 6232 | return convert_to_mov_src1(drcbe, dst, inst, &dstp, &src1p); | |
| 6233 | ||
| 6234 | 6070 | /* pick a target register for the general case */ |
| 6235 | 6071 | dstreg = param_select_register(REG_EAX, &dstp, &src2p); |
| 6236 | 6072 | |
| r2844 | r2845 | |
| 6244 | 6080 | /* general case */ |
| 6245 | 6081 | else |
| 6246 | 6082 | { |
| 6247 | emit_mov_r32_p32(drcbe, &dst, dstreg, &src1p); | |
| 6083 | emit_mov_r32_p32_keepflags(drcbe, &dst, dstreg, &src1p); | |
| 6248 | 6084 | emit_rcr_r32_p32(drcbe, &dst, dstreg, &src2p, inst); // rcr dstreg,src2p |
| 6249 | 6085 | emit_mov_p32_r32(drcbe, &dst, &dstp, dstreg); // mov dstp,dstreg |
| 6250 | 6086 | } |
| r2844 | r2845 | |
| 6254 | 6090 | else if (inst->size == 8) |
| 6255 | 6091 | { |
| 6256 | 6092 | /* general case */ |
| 6257 | emit_mov_r64_p64(drcbe, &dst, dstreg, REG_EDX, &src1p); | |
| 6093 | emit_mov_r64_p64_keepflags(drcbe, &dst, dstreg, REG_EDX, &src1p); | |
| 6258 | 6094 | emit_rcr_r64_p64(drcbe, &dst, dstreg, REG_EDX, &src2p, inst); // rcr dstreg:dstp,src2p |
| 6259 | 6095 | emit_mov_p64_r64(drcbe, &dst, &dstp, dstreg, REG_EDX); // mov dstp,dstreg:eax |
| 6260 | 6096 | } |
| r2844 | r2845 | |
| 6277 | 6113 | |
| 6278 | 6114 | /* validate instruction */ |
| 6279 | 6115 | assert(inst->size == 4 || inst->size == 8); |
| 6280 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6116 | assert_no_condition(inst); | |
| 6117 | assert_no_flags(inst); | |
| 6281 | 6118 | |
| 6282 | 6119 | /* normalize parameters */ |
| 6283 | 6120 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &basep, PTYPE_M, &indp, PTYPE_MRI); |
| r2844 | r2845 | |
| 6318 | 6155 | |
| 6319 | 6156 | /* validate instruction */ |
| 6320 | 6157 | assert(inst->size == 4 || inst->size == 8); |
| 6321 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6158 | assert_no_condition(inst); | |
| 6159 | assert_no_flags(inst); | |
| 6322 | 6160 | |
| 6323 | 6161 | /* normalize parameters */ |
| 6324 | 6162 | param_normalize_3(drcbe, inst, &basep, PTYPE_M, &indp, PTYPE_MRI, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 6359 | 6197 | |
| 6360 | 6198 | /* validate instruction */ |
| 6361 | 6199 | assert(inst->size == 4 || inst->size == 8); |
| 6362 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6200 | assert_no_condition(inst); | |
| 6201 | assert_no_flags(inst); | |
| 6363 | 6202 | |
| 6364 | 6203 | /* normalize parameters */ |
| 6365 | 6204 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &addrp, PTYPE_MRI, &spacep, PTYPE_I); |
| 6366 | 6205 | |
| 6367 | 6206 | /* set up a call to the read dword/qword handler */ |
| 6368 | emit_ | |
| 6207 | emit_mov | |
| 6369 | 6208 | if (inst->size == 4) |
| 6370 | 6209 | emit_call(&dst, (x86code *)active_address_space[spacep.value].accessors->read_dword);// call read_dword |
| 6371 | 6210 | else if (inst->size == 8) |
| 6372 | 6211 | emit_call(&dst, (x86code *)active_address_space[spacep.value].accessors->read_qword);// call read_qword |
| 6373 | emit_add_r32_imm(&dst, REG_ESP, 4); // add esp,4 | |
| 6374 | 6212 | |
| 6375 | 6213 | /* store result */ |
| 6376 | 6214 | if (inst->size == 4) |
| r2844 | r2845 | |
| 6392 | 6230 | |
| 6393 | 6231 | /* validate instruction */ |
| 6394 | 6232 | assert(inst->size == 4 || inst->size == 8); |
| 6395 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6233 | assert_no_condition(inst); | |
| 6234 | assert_no_flags(inst); | |
| 6396 | 6235 | |
| 6397 | 6236 | /* normalize parameters */ |
| 6398 | 6237 | param_normalize_3(drcbe, inst, &addrp, PTYPE_MRI, &srcp, PTYPE_MF, &spacep, PTYPE_I); |
| 6399 | 6238 | |
| 6400 | 6239 | /* set up a call to the write dword/qword handler */ |
| 6401 | 6240 | if (inst->size == 4) |
| 6402 | emit_ | |
| 6241 | emit_mov | |
| 6403 | 6242 | else if (inst->size == 8) |
| 6404 | emit_push_p64(drcbe, &dst, &srcp); // push srcp | |
| 6405 | emit_push_p32(drcbe, &dst, &addrp); // push addrp | |
| 6243 | emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 4), &srcp); // mov [esp+4],srcp | |
| 6244 | emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &addrp); // mov [esp],addrp | |
| 6406 | 6245 | if (inst->size == 4) |
| 6407 | 6246 | emit_call(&dst, (x86code *)active_address_space[spacep.value].accessors->write_dword);// call write_dword |
| 6408 | 6247 | else if (inst->size == 8) |
| 6409 | 6248 | emit_call(&dst, (x86code *)active_address_space[spacep.value].accessors->write_qword);// call write_qword |
| 6410 | emit_add_r32_imm(&dst, REG_ESP, 4 + inst->size); // add esp,8 | |
| 6411 | 6249 | |
| 6412 | 6250 | return dst; |
| 6413 | 6251 | } |
| r2844 | r2845 | |
| 6424 | 6262 | |
| 6425 | 6263 | /* validate instruction */ |
| 6426 | 6264 | assert(inst->size == 4 || inst->size == 8); |
| 6427 | assert(inst->condflags == DRCUML_COND_ALWAYS || (inst->condflags >= DRCUML_COND_Z && inst->condflags < DRCUML_COND_MAX)); | |
| 6265 | assert_any_condition(inst); | |
| 6266 | assert_no_flags(inst); | |
| 6428 | 6267 | |
| 6429 | 6268 | /* normalize parameters */ |
| 6430 | 6269 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| 6431 | 6270 | |
| 6432 | 6271 | /* always start with a jmp */ |
| 6433 | if (inst->condflags != DRCUML_COND_ALWAYS) | |
| 6434 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condflags), &skip); // jcc skip | |
| 6272 | if (inst->condition != DRCUML_COND_ALWAYS) | |
| 6273 | emit_jcc_short_link(&dst, X86_NOT_CONDITION(inst->condition), &skip); // jcc skip | |
| 6435 | 6274 | |
| 6436 | 6275 | /* general case */ |
| 6437 | 6276 | emit_mov_r32_m32(&dst, REG_EAX, MABS(srcp.value)); // mov eax,[srcp] |
| r2844 | r2845 | |
| 6458 | 6297 | |
| 6459 | 6298 | /* validate instruction */ |
| 6460 | 6299 | assert(inst->size == 4 || inst->size == 8); |
| 6461 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6300 | assert_no_condition(inst); | |
| 6301 | assert_no_flags(inst); | |
| 6462 | 6302 | |
| 6463 | 6303 | /* normalize parameters */ |
| 6464 | 6304 | param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MF, &sizep, PTYPE_I, &roundp, PTYPE_I); |
| r2844 | r2845 | |
| 6531 | 6371 | |
| 6532 | 6372 | /* validate instruction */ |
| 6533 | 6373 | assert(inst->size == 4 || inst->size == 8); |
| 6534 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6374 | assert_no_condition(inst); | |
| 6375 | assert_no_flags(inst); | |
| 6535 | 6376 | |
| 6536 | 6377 | /* normalize parameters */ |
| 6537 | 6378 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MRI, &sizep, PTYPE_I); |
| r2844 | r2845 | |
| 6587 | 6428 | |
| 6588 | 6429 | /* validate instruction */ |
| 6589 | 6430 | assert(inst->size == 4 || inst->size == 8); |
| 6590 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6431 | assert_no_condition(inst); | |
| 6432 | assert_no_flags(inst); | |
| 6591 | 6433 | |
| 6592 | 6434 | /* normalize parameters */ |
| 6593 | 6435 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF, &sizep, PTYPE_I); |
| r2844 | r2845 | |
| 6613 | 6455 | |
| 6614 | 6456 | /* validate instruction */ |
| 6615 | 6457 | assert(inst->size == 8); |
| 6616 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6458 | assert_no_condition(inst); | |
| 6459 | assert_no_flags(inst); | |
| 6617 | 6460 | |
| 6618 | 6461 | /* normalize parameters */ |
| 6619 | 6462 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 6637 | 6480 | |
| 6638 | 6481 | /* validate instruction */ |
| 6639 | 6482 | assert(inst->size == 4 || inst->size == 8); |
| 6640 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6483 | assert_no_condition(inst); | |
| 6484 | assert_no_flags(inst); | |
| 6641 | 6485 | |
| 6642 | 6486 | /* normalize parameters */ |
| 6643 | 6487 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &src1p, PTYPE_MF, &src2p, PTYPE_MF); |
| r2844 | r2845 | |
| 6662 | 6506 | |
| 6663 | 6507 | /* validate instruction */ |
| 6664 | 6508 | assert(inst->size == 4 || inst->size == 8); |
| 6665 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6509 | assert_no_condition(inst); | |
| 6510 | assert_no_flags(inst); | |
| 6666 | 6511 | |
| 6667 | 6512 | /* normalize parameters */ |
| 6668 | 6513 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &src1p, PTYPE_MF, &src2p, PTYPE_MF); |
| r2844 | r2845 | |
| 6687 | 6532 | |
| 6688 | 6533 | /* validate instruction */ |
| 6689 | 6534 | assert(inst->size == 4 || inst->size == 8); |
| 6690 | assert((inst->condflags & ~(DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_U)) == 0); | |
| 6535 | assert_no_condition(inst); | |
| 6536 | assert_flags(inst, DRCUML_FLAG_C | DRCUML_FLAG_Z | DRCUML_FLAG_U); | |
| 6691 | 6537 | |
| 6692 | 6538 | /* normalize parameters */ |
| 6693 | 6539 | param_normalize_2(drcbe, inst, &src1p, PTYPE_MF, &src2p, PTYPE_MF); |
| r2844 | r2845 | |
| 6713 | 6559 | |
| 6714 | 6560 | /* validate instruction */ |
| 6715 | 6561 | assert(inst->size == 4 || inst->size == 8); |
| 6716 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6562 | assert_no_condition(inst); | |
| 6563 | assert_no_flags(inst); | |
| 6717 | 6564 | |
| 6718 | 6565 | /* normalize parameters */ |
| 6719 | 6566 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &src1p, PTYPE_MF, &src2p, PTYPE_MF); |
| r2844 | r2845 | |
| 6738 | 6585 | |
| 6739 | 6586 | /* validate instruction */ |
| 6740 | 6587 | assert(inst->size == 4 || inst->size == 8); |
| 6741 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6588 | assert_no_condition(inst); | |
| 6589 | assert_no_flags(inst); | |
| 6742 | 6590 | |
| 6743 | 6591 | /* normalize parameters */ |
| 6744 | 6592 | param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &src1p, PTYPE_MF, &src2p, PTYPE_MF); |
| r2844 | r2845 | |
| 6763 | 6611 | |
| 6764 | 6612 | /* validate instruction */ |
| 6765 | 6613 | assert(inst->size == 4 || inst->size == 8); |
| 6766 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6614 | assert_no_condition(inst); | |
| 6615 | assert_no_flags(inst); | |
| 6767 | 6616 | |
| 6768 | 6617 | /* normalize parameters */ |
| 6769 | 6618 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 6787 | 6636 | |
| 6788 | 6637 | /* validate instruction */ |
| 6789 | 6638 | assert(inst->size == 4 || inst->size == 8); |
| 6790 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6639 | assert_no_condition(inst); | |
| 6640 | assert_no_flags(inst); | |
| 6791 | 6641 | |
| 6792 | 6642 | /* normalize parameters */ |
| 6793 | 6643 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 6811 | 6661 | |
| 6812 | 6662 | /* validate instruction */ |
| 6813 | 6663 | assert(inst->size == 4 || inst->size == 8); |
| 6814 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6664 | assert_no_condition(inst); | |
| 6665 | assert_no_flags(inst); | |
| 6815 | 6666 | |
| 6816 | 6667 | /* normalize parameters */ |
| 6817 | 6668 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 6835 | 6686 | |
| 6836 | 6687 | /* validate instruction */ |
| 6837 | 6688 | assert(inst->size == 4 || inst->size == 8); |
| 6838 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6689 | assert_no_condition(inst); | |
| 6690 | assert_no_flags(inst); | |
| 6839 | 6691 | |
| 6840 | 6692 | /* normalize parameters */ |
| 6841 | 6693 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
| 6860 | 6712 | |
| 6861 | 6713 | /* validate instruction */ |
| 6862 | 6714 | assert(inst->size == 4 || inst->size == 8); |
| 6863 | assert(inst->condflags == DRCUML_COND_ALWAYS); | |
| 6715 | assert_no_condition(inst); | |
| 6716 | assert_no_flags(inst); | |
| 6864 | 6717 | |
| 6865 | 6718 | /* normalize parameters */ |
| 6866 | 6719 | param_normalize_2(drcbe, inst, &dstp, PTYPE_MF, &srcp, PTYPE_MF); |
| r2844 | r2845 | |
|---|---|---|
| 35 | 35 | static const int sub_left[] ={A,B,C,D, I,I,I,I, B,C,A,C, A,B,C,D}; |
| 36 | 36 | static const int sub_right[]={B,C,A,C, I,I,I,I, A,B,C,D, B,C,A,C}; |
| 37 | 37 | |
| 38 | void saturn_invalid3( int op1, int op2, int op3 ) | |
| 38 | static void saturn_invalid3( int op1, int op2, int op3 ) | |
| 39 | 39 | { |
| 40 | 40 | logerror( "SATURN#%d invalid opcode %x%x%x at %05x\n", |
| 41 | 41 | cpu_getactivecpu(), op1, op2, op3, saturn.pc-3 ); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | void saturn_invalid4( int op1, int op2, int op3, int op4 ) | |
| 44 | static void saturn_invalid4( int op1, int op2, int op3, int op4 ) | |
| 45 | 45 | { |
| 46 | 46 | logerror( "SATURN#%d invalid opcode %x%x%x%x at %05x\n", |
| 47 | 47 | cpu_getactivecpu(), op1, op2, op3, op4, saturn.pc-4 ); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | void saturn_invalid5( int op1, int op2, int op3, int op4, int op5 ) | |
| 50 | static void saturn_invalid5( int op1, int op2, int op3, int op4, int op5 ) | |
| 51 | 51 | { |
| 52 | 52 | logerror( "SATURN#%d invalid opcode %x%x%x%x%x at %05x\n", |
| 53 | 53 | cpu_getactivecpu(), op1, op2, op3, op4, op5, saturn.pc-5 ); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | void saturn_invalid6( int op1, int op2, int op3, int op4, int op5, int op6 ) | |
| 56 | static void saturn_invalid6( int op1, int op2, int op3, int op4, int op5, int op6 ) | |
| 57 | 57 | { |
| 58 | 58 | logerror( "SATURN#%d invalid opcode %x%x%x%x%x%x at %05x\n", |
| 59 | 59 | cpu_getactivecpu(), op1, op2, op3, op4, op5, op6, saturn.pc-6 ); |
| r2844 | r2845 | |
|---|---|---|
| 222 | 222 | if (saturn.config&&saturn.config->unconfig) saturn.config->unconfig(Machine, S64_READ_A(C)); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | int monitor_id; | |
| 225 | static int monitor_id; | |
| 226 | 226 | |
| 227 | 227 | INLINE void saturn_mem_id(void) |
| 228 | 228 | { |
| r2844 | r2845 | |
| 271 | 271 | if (saturn.config&&saturn.config->out) saturn.config->out(Machine, saturn.out); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | int monitor_in; | |
| 274 | static int monitor_in; | |
| 275 | 275 | |
| 276 | 276 | INLINE void saturn_in(int reg) |
| 277 | 277 | { |
| r2844 | r2845 | |
|---|---|---|
| 751 | 751 | vdp->contReg[reg] = data; |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | static UINT8 v9938_status_r( | |
| 754 | static UINT8 v9938_status_r(running_machine *machine) | |
| 755 | 755 | { |
| 756 | 756 | int reg; |
| 757 | 757 | UINT8 ret; |
| r2844 | r2845 | |
| 785 | 785 | if ( (n < 28) || (n > 199) ) vdp.statReg[2] |= 0x20; |
| 786 | 786 | else vdp.statReg[2] &= ~0x20; |
| 787 | 787 | */ |
| 788 | if (mame_rand( | |
| 788 | if (mame_rand(machine) & 1) vdp->statReg[2] |= 0x20; | |
| 789 | 789 | else vdp->statReg[2] &= ~0x20; |
| 790 | 790 | ret = vdp->statReg[2]; |
| 791 | 791 | break; |
| r2844 | r2845 | |
| 825 | 825 | READ8_HANDLER( v9938_0_status_r ) |
| 826 | 826 | { |
| 827 | 827 | vdp = &vdps[0]; |
| 828 | return v9938_status_r(); | |
| 828 | return v9938_status_r(machine); | |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | READ8_HANDLER( v9938_1_status_r ) |
| 832 | 832 | { |
| 833 | 833 | vdp = &vdps[1]; |
| 834 | return v9938_status_r(); | |
| 834 | return v9938_status_r(machine); | |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | 837 | /*************************************************************************** |
| r2844 | r2845 | |
|---|---|---|
| 205 | 205 | shift values |
| 206 | 206 | -------------------------------------------------*/ |
| 207 | 207 | |
| 208 | INLINE void set_color_444(pen_t color, int rshift, int gshift, int bshift, UINT16 data) | |
| 208 | INLINE void set_color_444(running_machine *machine, pen_t color, int rshift, int gshift, int bshift, UINT16 data) | |
| 209 | 209 | { |
| 210 | palette_set_color_rgb( | |
| 210 | palette_set_color_rgb(machine, color, pal4bit(data >> rshift), pal4bit(data >> gshift), pal4bit(data >> bshift)); | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
| r2844 | r2845 | |
| 217 | 217 | shift values |
| 218 | 218 | -------------------------------------------------*/ |
| 219 | 219 | |
| 220 | INLINE void set_color_4444(pen_t color, int ishift, int rshift, int gshift, int bshift, UINT16 data) | |
| 220 | INLINE void set_color_4444(running_machine *machine, pen_t color, int ishift, int rshift, int gshift, int bshift, UINT16 data) | |
| 221 | 221 | { |
| 222 | 222 | static const UINT8 ztable[16] = |
| 223 | 223 | { 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11 }; |
| r2844 | r2845 | |
| 228 | 228 | g = ((data >> gshift) & 15) * i; |
| 229 | 229 | b = ((data >> bshift) & 15) * i; |
| 230 | 230 | |
| 231 | palette_set_color_rgb( | |
| 231 | palette_set_color_rgb(machine, color, r, g, b); | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | |
| r2844 | r2845 | |
| 238 | 238 | shift values |
| 239 | 239 | -------------------------------------------------*/ |
| 240 | 240 | |
| 241 | INLINE void set_color_555(pen_t color, int rshift, int gshift, int bshift, UINT16 data) | |
| 241 | INLINE void set_color_555(running_machine *machine, pen_t color, int rshift, int gshift, int bshift, UINT16 data) | |
| 242 | 242 | { |
| 243 | palette_set_color_rgb( | |
| 243 | palette_set_color_rgb(machine, color, pal5bit(data >> rshift), pal5bit(data >> gshift), pal5bit(data >> bshift)); | |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
| r2844 | r2845 | |
| 250 | 250 | shift values |
| 251 | 251 | -------------------------------------------------*/ |
| 252 | 252 | |
| 253 | INLINE void set_color_888(pen_t color, int rshift, int gshift, int bshift, UINT32 data) | |
| 253 | INLINE void set_color_888(running_machine *machine, pen_t color, int rshift, int gshift, int bshift, UINT32 data) | |
| 254 | 254 | { |
| 255 | palette_set_color_rgb( | |
| 255 | palette_set_color_rgb(machine, color, (data >> rshift) & 0xff, (data >> gshift) & 0xff, (data >> bshift) & 0xff); | |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
| r2844 | r2845 | |
| 448 | 448 | updateflip - handle global flipping |
| 449 | 449 | -------------------------------------------------*/ |
| 450 | 450 | |
| 451 | static void updateflip( | |
| 451 | static void updateflip(running_machine *machine) | |
| 452 | 452 | { |
| 453 | int width = video_screen_get_width(Machine->primary_screen); | |
| 454 | int height = video_screen_get_height(Machine->primary_screen); | |
| 455 | attoseconds_t period = video_screen_get_frame_period(Machine->primary_screen).attoseconds; | |
| 456 | rectangle visarea = *video_screen_get_visible_area(Machine->primary_screen); | |
| 453 | int width = video_screen_get_width(machine->primary_screen); | |
| 454 | int height = video_screen_get_height(machine->primary_screen); | |
| 455 | attoseconds_t period = video_screen_get_frame_period(machine->primary_screen).attoseconds; | |
| 456 | rectangle visarea = *video_screen_get_visible_area(machine->primary_screen); | |
| 457 | 457 | |
| 458 | 458 | tilemap_set_flip(ALL_TILEMAPS,(TILEMAP_FLIPX & flip_screen_x) | (TILEMAP_FLIPY & flip_screen_y)); |
| 459 | 459 | |
| r2844 | r2845 | |
| 474 | 474 | visarea.max_y = temp; |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | video_screen_configure( | |
| 477 | video_screen_configure(machine->primary_screen, width, height, &visarea, period); | |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | |
| r2844 | r2845 | |
| 515 | 515 | if (flip_screen_x != on) |
| 516 | 516 | { |
| 517 | 517 | flip_screen_x = on; |
| 518 | updateflip(); | |
| 518 | updateflip(Machine); | |
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | |
| r2844 | r2845 | |
| 530 | 530 | if (flip_screen_y != on) |
| 531 | 531 | { |
| 532 | 532 | flip_screen_y = on; |
| 533 | updateflip(); | |
| 533 | updateflip(Machine); | |
| 534 | 534 | } |
| 535 | 535 | } |
| 536 | 536 | |
| r2844 | r2845 | |
| 719 | 719 | WRITE8_HANDLER( paletteram_xxxxBBBBGGGGRRRR_le_w ) |
| 720 | 720 | { |
| 721 | 721 | paletteram[offset] = data; |
| 722 | set_color_444(offset / 2, 0, 4, 8, paletteram16_le(offset)); | |
| 722 | set_color_444(machine, offset / 2, 0, 4, 8, paletteram16_le(offset)); | |
| 723 | 723 | } |
| 724 | 724 | |
| 725 | 725 | WRITE8_HANDLER( paletteram_xxxxBBBBGGGGRRRR_be_w ) |
| 726 | 726 | { |
| 727 | 727 | paletteram[offset] = data; |
| 728 | set_color_444(offset / 2, 0, 4, 8, paletteram16_be(offset)); | |
| 728 | set_color_444(machine, offset / 2, 0, 4, 8, paletteram16_be(offset)); | |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | WRITE8_HANDLER( paletteram_xxxxBBBBGGGGRRRR_split1_w ) |
| 732 | 732 | { |
| 733 | 733 | paletteram[offset] = data; |
| 734 | set_color_444(offset, 0, 4, 8, paletteram16_split(offset)); | |
| 734 | set_color_444(machine, offset, 0, 4, 8, paletteram16_split(offset)); | |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | WRITE8_HANDLER( paletteram_xxxxBBBBGGGGRRRR_split2_w ) |
| 738 | 738 | { |
| 739 | 739 | paletteram_2[offset] = data; |
| 740 | set_color_444(offset, 0, 4, 8, paletteram16_split(offset)); | |
| 740 | set_color_444(machine, offset, 0, 4, 8, paletteram16_split(offset)); | |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | WRITE16_HANDLER( paletteram16_xxxxBBBBGGGGRRRR_word_w ) |
| 744 | 744 | { |
| 745 | 745 | COMBINE_DATA(&paletteram16[offset]); |
| 746 | set_color_444(offset, 0, 4, 8, paletteram16[offset]); | |
| 746 | set_color_444(machine, offset, 0, 4, 8, paletteram16[offset]); | |
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | |
| r2844 | r2845 | |
| 754 | 754 | WRITE8_HANDLER( paletteram_xxxxBBBBRRRRGGGG_le_w ) |
| 755 | 755 | { |
| 756 | 756 | paletteram[offset] = data; |
| 757 | set_color_444(offset / 2, 4, 0, 8, paletteram16_le(offset)); | |
| 757 | set_color_444(machine, offset / 2, 4, 0, 8, paletteram16_le(offset)); | |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | WRITE8_HANDLER( paletteram_xxxxBBBBRRRRGGGG_be_w ) |
| 761 | 761 | { |
| 762 | 762 | paletteram[offset] = data; |
| 763 | set_color_444(offset / 2, 4, 0, 8, paletteram16_be(offset)); | |
| 763 | set_color_444(machine, offset / 2, 4, 0, 8, paletteram16_be(offset)); | |
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | WRITE8_HANDLER( paletteram_xxxxBBBBRRRRGGGG_split1_w ) |
| 767 | 767 | { |
| 768 | 768 | paletteram[offset] = data; |
| 769 | set_color_444(offset, 4, 0, 8, paletteram16_split(offset)); | |
| 769 | set_color_444(machine, offset, 4, 0, 8, paletteram16_split(offset)); | |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | WRITE8_HANDLER( paletteram_xxxxBBBBRRRRGGGG_split2_w ) |
| 773 | 773 | { |
| 774 | 774 | paletteram_2[offset] = data; |
| 775 | set_color_444(offset, 4, 0, 8, paletteram16_split(offset)); | |
| 775 | set_color_444(machine, offset, 4, 0, 8, paletteram16_split(offset)); | |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | WRITE16_HANDLER( paletteram16_xxxxBBBBRRRRGGGG_word_w ) |
| 779 | 779 | { |
| 780 | 780 | COMBINE_DATA(&paletteram16[offset]); |
| 781 | set_color_444(offset, 4, 0, 8, paletteram16[offset]); | |
| 781 | set_color_444(machine, offset, 4, 0, 8, paletteram16[offset]); | |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | |
| r2844 | r2845 | |
| 789 | 789 | WRITE8_HANDLER( paletteram_xxxxRRRRBBBBGGGG_split1_w ) |
| 790 | 790 | { |
| 791 | 791 | paletteram[offset] = data; |
| 792 | set_color_444(offset, 8, 0, 4, paletteram16_split(offset)); | |
| 792 | set_color_444(machine, offset, 8, 0, 4, paletteram16_split(offset)); | |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | WRITE8_HANDLER( paletteram_xxxxRRRRBBBBGGGG_split2_w ) |
| 796 | 796 | { |
| 797 | 797 | paletteram_2[offset] = data; |
| 798 | set_color_444(offset, 8, 0, 4, paletteram16_split(offset)); | |
| 798 | set_color_444(machine, offset, 8, 0, 4, paletteram16_split(offset)); | |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | |
| r2844 | r2845 | |
| 806 | 806 | WRITE8_HANDLER( paletteram_xxxxRRRRGGGGBBBB_le_w ) |
| 807 | 807 | { |
| 808 | 808 | paletteram[offset] = data; |
| 809 | set_color_444(offset / 2, 8, 4, 0, paletteram16_le(offset)); | |
| 809 | set_color_444(machine, offset / 2, 8, 4, 0, paletteram16_le(offset)); | |
| 810 | 810 | } |
| 811 | 811 | |
| 812 | 812 | WRITE8_HANDLER( paletteram_xxxxRRRRGGGGBBBB_be_w ) |
| 813 | 813 | { |
| 814 | 814 | paletteram[offset] = data; |
| 815 | set_color_444(offset / 2, 8, 4, 0, paletteram16_be(offset)); | |
| 815 | set_color_444(machine, offset / 2, 8, 4, 0, paletteram16_be(offset)); | |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | WRITE16_HANDLER( paletteram16_xxxxRRRRGGGGBBBB_word_w ) |
| 819 | 819 | { |
| 820 | 820 | COMBINE_DATA(&paletteram16[offset]); |
| 821 | set_color_444(offset, 8, 4, 0, paletteram16[offset]); | |
| 821 | set_color_444(machine, offset, 8, 4, 0, paletteram16[offset]); | |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | |
| r2844 | r2845 | |
| 829 | 829 | WRITE8_HANDLER( paletteram_RRRRGGGGBBBBxxxx_be_w ) |
| 830 | 830 | { |
| 831 | 831 | paletteram[offset] = data; |
| 832 | set_color_444(offset / 2, 12, 8, 4, paletteram16_be(offset)); | |
| 832 | set_color_444(machine, offset / 2, 12, 8, 4, paletteram16_be(offset)); | |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | WRITE8_HANDLER( paletteram_RRRRGGGGBBBBxxxx_split1_w ) |
| 836 | 836 | { |
| 837 | 837 | paletteram[offset] = data; |
| 838 | set_color_444(offset, 12, 8, 4, paletteram16_split(offset)); | |
| 838 | set_color_444(machine, offset, 12, 8, 4, paletteram16_split(offset)); | |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | WRITE8_HANDLER( paletteram_RRRRGGGGBBBBxxxx_split2_w ) |
| 842 | 842 | { |
| 843 | 843 | paletteram_2[offset] = data; |
| 844 | set_color_444(offset, 12, 8, 4, paletteram16_split(offset)); | |
| 844 | set_color_444(machine, offset, 12, 8, 4, paletteram16_split(offset)); | |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | WRITE16_HANDLER( paletteram16_RRRRGGGGBBBBxxxx_word_w ) |
| 848 | 848 | { |
| 849 | 849 | COMBINE_DATA(&paletteram16[offset]); |
| 850 | set_color_444(offset, 12, 8, 4, paletteram16[offset]); | |
| 850 | set_color_444(machine, offset, 12, 8, 4, paletteram16[offset]); | |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | |
| r2844 | r2845 | |
| 863 | 863 | WRITE8_HANDLER( paletteram_xBBBBBGGGGGRRRRR_le_w ) |
| 864 | 864 | { |
| 865 | 865 | paletteram[offset] = data; |
| 866 | set_color_555(offset / 2, 0, 5, 10, paletteram16_le(offset)); | |
| 866 | set_color_555(machine, offset / 2, 0, 5, 10, paletteram16_le(offset)); | |
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | WRITE8_HANDLER( paletteram_xBBBBBGGGGGRRRRR_be_w ) |
| 870 | 870 | { |
| 871 | 871 | paletteram[offset] = data; |
| 872 | set_color_555(offset / 2, 0, 5, 10, paletteram16_be(offset)); | |
| 872 | set_color_555(machine, offset / 2, 0, 5, 10, paletteram16_be(offset)); | |
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | WRITE8_HANDLER( paletteram_xBBBBBGGGGGRRRRR_split1_w ) |
| 876 | 876 | { |
| 877 | 877 | paletteram[offset] = data; |
| 878 | set_color_555(offset, 0, 5, 10, paletteram16_split(offset)); | |
| 878 | set_color_555(machine, offset, 0, 5, 10, paletteram16_split(offset)); | |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | WRITE8_HANDLER( paletteram_xBBBBBGGGGGRRRRR_split2_w ) |
| 882 | 882 | { |
| 883 | 883 | paletteram_2[offset] = data; |
| 884 | set_color_555(offset, 0, 5, 10, paletteram16_split(offset)); | |
| 884 | set_color_555(machine, offset, 0, 5, 10, paletteram16_split(offset)); | |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | WRITE16_HANDLER( paletteram16_xBBBBBGGGGGRRRRR_word_w ) |
| 888 | 888 | { |
| 889 | 889 | COMBINE_DATA(&paletteram16[offset]); |
| 890 | set_color_555(offset, 0, 5, 10, paletteram16[offset]); | |
| 890 | set_color_555(machine, offset, 0, 5, 10, paletteram16[offset]); | |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | |
| r2844 | r2845 | |
| 898 | 898 | WRITE8_HANDLER( paletteram_xBBBBBRRRRRGGGGG_split1_w ) |
| 899 | 899 | { |
| 900 | 900 | paletteram[offset] = data; |
| 901 | set_color_555(offset, 5, 0, 10, paletteram16_split(offset)); | |
| 901 | set_color_555(machine, offset, 5, 0, 10, paletteram16_split(offset)); | |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | WRITE8_HANDLER( paletteram_xBBBBBRRRRRGGGGG_split2_w ) |
| 905 | 905 | { |
| 906 | 906 | paletteram_2[offset] = data; |
| 907 | set_color_555(offset, 5, 0, 10, paletteram16_split(offset)); | |
| 907 | set_color_555(machine, offset, 5, 0, 10, paletteram16_split(offset)); | |
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | |
| r2844 | r2845 | |
| 915 | 915 | WRITE8_HANDLER( paletteram_xRRRRRGGGGGBBBBB_le_w ) |
| 916 | 916 | { |
| 917 | 917 | paletteram[offset] = data; |
| 918 | set_color_555(offset / 2, 10, 5, 0, paletteram16_le(offset)); | |
| 918 | set_color_555(machine, offset / 2, 10, 5, 0, paletteram16_le(offset)); | |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | WRITE16_HANDLER( paletteram16_xRRRRRGGGGGBBBBB_word_w ) |
| 922 | 922 | { |
| 923 | 923 | COMBINE_DATA(&paletteram16[offset]); |
| 924 | set_color_555(offset, 10, 5, 0, paletteram16[offset]); | |
| 924 | set_color_555(machine, offset, 10, 5, 0, paletteram16[offset]); | |
| 925 | 925 | } |
| 926 | 926 | |
| 927 | 927 | |
| r2844 | r2845 | |
| 932 | 932 | WRITE16_HANDLER( paletteram16_xGGGGGRRRRRBBBBB_word_w ) |
| 933 | 933 | { |
| 934 | 934 | COMBINE_DATA(&paletteram16[offset]); |
| 935 | set_color_555(offset, 5, 10, 0, paletteram16[offset]); | |
| 935 | set_color_555(machine, offset, 5, 10, 0, paletteram16[offset]); | |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | |
| r2844 | r2845 | |
| 943 | 943 | WRITE16_HANDLER( paletteram16_xGGGGGBBBBBRRRRR_word_w ) |
| 944 | 944 | { |
| 945 | 945 | COMBINE_DATA(&paletteram16[offset]); |
| 946 | set_color_555(offset, 0, 10, 5, paletteram16[offset]); | |
| 946 | set_color_555(machine, offset, 0, 10, 5, paletteram16[offset]); | |
| 947 | 947 | } |
| 948 | 948 | |
| 949 | 949 | |
| r2844 | r2845 | |
| 954 | 954 | WRITE16_HANDLER( paletteram16_GGGGGRRRRRBBBBBx_word_w ) |
| 955 | 955 | { |
| 956 | 956 | COMBINE_DATA(&paletteram16[offset]); |
| 957 | set_color_555(offset, 6, 11, 1, paletteram16[offset]); | |
| 957 | set_color_555(machine, offset, 6, 11, 1, paletteram16[offset]); | |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | /*------------------------------------------------- |
| r2844 | r2845 | |
| 964 | 964 | WRITE16_HANDLER( paletteram16_RRRRRGGGGGBBBBBx_word_w ) |
| 965 | 965 | { |
| 966 | 966 | COMBINE_DATA(&paletteram16[offset]); |
| 967 | set_color_555(offset, 11, 6, 1, paletteram16[offset]); | |
| 967 | set_color_555(machine, offset, 11, 6, 1, paletteram16[offset]); | |
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | |
| r2844 | r2845 | |
| 994 | 994 | WRITE16_HANDLER( paletteram16_IIIIRRRRGGGGBBBB_word_w ) |
| 995 | 995 | { |
| 996 | 996 | COMBINE_DATA(&paletteram16[offset]); |
| 997 | set_color_4444(offset, 12, 8, 4, 0, paletteram16[offset]); | |
| 997 | set_color_4444(machine, offset, 12, 8, 4, 0, paletteram16[offset]); | |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | |
| r2844 | r2845 | |
| 1005 | 1005 | WRITE16_HANDLER( paletteram16_RRRRGGGGBBBBIIII_word_w ) |
| 1006 | 1006 | { |
| 1007 | 1007 | COMBINE_DATA(&paletteram16[offset]); |
| 1008 | set_color_4444(offset, 0, 12, 8, 4, paletteram16[offset]); | |
| 1008 | set_color_4444(machine, offset, 0, 12, 8, 4, paletteram16[offset]); | |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | |
| r2844 | r2845 | |
| 1021 | 1021 | WRITE16_HANDLER( paletteram16_xrgb_word_be_w ) |
| 1022 | 1022 | { |
| 1023 | 1023 | COMBINE_DATA(&paletteram16[offset]); |
| 1024 | set_color_888(offset / 2, 16, 8, 0, paletteram32_be(offset)); | |
| 1024 | set_color_888(machine, offset / 2, 16, 8, 0, paletteram32_be(offset)); | |
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | 1027 | |
| r2844 | r2845 | |
| 1032 | 1032 | WRITE16_HANDLER( paletteram16_xbgr_word_be_w ) |
| 1033 | 1033 | { |
| 1034 | 1034 | COMBINE_DATA(&paletteram16[offset]); |
| 1035 | set_color_888(offset / 2, 0, 8, 16, paletteram32_be(offset)); | |
| 1035 | set_color_888(machine, offset / 2, 0, 8, 16, paletteram32_be(offset)); | |
| 1036 | 1036 | } |
| r2844 | r2845 | |
|---|---|---|
| 118 | 118 | |
| 119 | 119 | /* input options */ |
| 120 | 120 | { NULL, NULL, OPTION_HEADER, "CORE INPUT OPTIONS" }, |
| 121 | { "coin_lockout;coinlock", "1", OPTION_BOOLEAN, "enable coin lockouts to actually lock out coins" }, | |
| 121 | 122 | { "ctrlr", NULL, 0, "preconfigure for specified controller" }, |
| 122 | 123 | { "mouse", "0", OPTION_BOOLEAN, "enable mouse input" }, |
| 123 | 124 | { "joystick;joy", "1", OPTION_BOOLEAN, "enable joystick input" }, |
| r2844 | r2845 | |
|---|---|---|
| 110 | 110 | #define OPTION_VOLUME "volume" |
| 111 | 111 | |
| 112 | 112 | /* core input options */ |
| 113 | #define OPTION_COIN_LOCKOUT "coin_lockout" | |
| 113 | 114 | #define OPTION_CTRLR "ctrlr" |
| 114 | 115 | #define OPTION_MOUSE "mouse" |
| 115 | 116 | #define OPTION_JOYSTICK "joystick" |
| r2844 | r2845 | |
|---|---|---|
| 267 | 267 | void video_mng_begin_recording(const device_config *screen, const char *name); |
| 268 | 268 | void video_mng_end_recording(const device_config *screen); |
| 269 | 269 | |
| 270 | int video_avi_is_movie_active(const device_config *screen); | |
| 271 | 270 | void video_avi_begin_recording(const device_config *screen, const char *name); |
| 272 | 271 | void video_avi_end_recording(const device_config *screen); |
| 273 | 272 | void video_avi_add_sound(running_machine *machine, const INT16 *sound, int numsamples); |
| r2844 | r2845 | |
|---|---|---|
| 2348 | 2348 | } |
| 2349 | 2349 | |
| 2350 | 2350 | /* skip locked-out coin inputs */ |
| 2351 | if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN8 && coinlockedout[field->type - IPT_COIN1]) | |
| 2351 | if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN8 && coinlockedout[field->type - IPT_COIN1] && options_get_bool(mame_options(), OPTION_COIN_LOCKOUT)) | |
| 2352 | 2352 | { |
| 2353 | 2353 | ui_popup_time(3, "Coinlock disabled %s.", input_field_name(field)); |
| 2354 | 2354 | return FALSE; |
| r2844 | r2845 | |
| 3543 | 3543 | const char *tag; |
| 3544 | 3544 | |
| 3545 | 3545 | /* read the mask, index, and defvalue attributes */ |
| 3546 | tag = xml_get_attribute_string(portnode, " | |
| 3546 | tag = xml_get_attribute_string(portnode, " | |
| 3547 | 3547 | mask = xml_get_attribute_int(portnode, "mask", 0); |
| 3548 | 3548 | defvalue = xml_get_attribute_int(portnode, "defvalue", 0); |
| 3549 | 3549 |
| r2844 | r2845 | |
|---|---|---|
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | ||
| 447 | READ8_HANDLER( lsi53c810_reg_r | |
| 448 | 448 | { |
| 449 | logerror("53c810: read reg %d:0x%x (PC=%x)\n", reg, reg, activecpu_get_pc()); | |
| 450 | switch(reg) | |
| 449 | logerror("53c810: read reg %d:0x%x (PC=%x)\n", offset, offset, activecpu_get_pc()); | |
| 450 | switch(offset) | |
| 451 | 451 | { |
| 452 | 452 | case 0x00: /* SCNTL0 */ |
| 453 | 453 | return lsi810.scntl0; |
| r2844 | r2845 | |
| 497 | 497 | case 0x35: |
| 498 | 498 | case 0x36: |
| 499 | 499 | case 0x37: |
| 500 | return lsi810.scratch_a[ | |
| 500 | return lsi810.scratch_a[offset % 4]; | |
| 501 | 501 | case 0x39: /* DIEN */ |
| 502 | 502 | return lsi810.dien; |
| 503 | 503 | case 0x3b: /* DCNTL */ |
| r2844 | r2845 | |
| 516 | 516 | case 0x5d: |
| 517 | 517 | case 0x5e: |
| 518 | 518 | case 0x5f: |
| 519 | return lsi810.scratch_b[ | |
| 519 | return lsi810.scratch_b[offset % 4]; | |
| 520 | 520 | |
| 521 | 521 | default: |
| 522 | fatalerror("LSI53C810: reg_r: Unknown reg %02X", | |
| 522 | fatalerror("LSI53C810: reg_r: Unknown reg %02X", offset); | |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | return 0; |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | ||
| 528 | WRITE8_HANDLER( lsi53c810_reg_w | |
| 529 | 529 | { |
| 530 | logerror("53c810: %02x to reg %d:0x%x (PC=%x)\n", value, reg, reg, activecpu_get_pc()); | |
| 531 | switch(reg) | |
| 530 | logerror("53c810: %02x to reg %d:0x%x (PC=%x)\n", data, offset, offset, activecpu_get_pc()); | |
| 531 | switch(offset) | |
| 532 | 532 | { |
| 533 | 533 | case 0x00: /* SCNTL0 */ |
| 534 | lsi810.scntl0 = | |
| 534 | lsi810.scntl0 = data | |
| 535 | 535 | break; |
| 536 | 536 | case 0x01: /* SCNTL1 */ |
| 537 | lsi810.scntl1 = | |
| 537 | lsi810.scntl1 = data | |
| 538 | 538 | break; |
| 539 | 539 | case 0x02: /* SCNTL2 */ |
| 540 | lsi810.scntl2 = | |
| 540 | lsi810.scntl2 = data | |
| 541 | 541 | break; |
| 542 | 542 | case 0x03: /* SCNTL3 */ |
| 543 | lsi810.scntl3 = | |
| 543 | lsi810.scntl3 = data | |
| 544 | 544 | break; |
| 545 | 545 | case 0x04: /* SCID */ |
| 546 | lsi810.scid = | |
| 546 | lsi810.scid = data | |
| 547 | 547 | break; |
| 548 | 548 | case 0x09: /* SOCL */ |
| 549 | lsi810.socl = | |
| 549 | lsi810.socl = data | |
| 550 | 550 | break; |
| 551 | 551 | case 0x0d: /* SSTAT0 */ |
| 552 | lsi810.sstat0 = | |
| 552 | lsi810.sstat0 = data | |
| 553 | 553 | break; |
| 554 | 554 | case 0x0e: /* SSTAT1 */ |
| 555 | lsi810.sstat1 = | |
| 555 | lsi810.sstat1 = data | |
| 556 | 556 | break; |
| 557 | 557 | case 0x0f: /* SSTAT2 */ |
| 558 | lsi810.sstat2 = | |
| 558 | lsi810.sstat2 = data | |
| 559 | 559 | break; |
| 560 | 560 | case 0x10: /* DSA [7-0] */ |
| 561 | 561 | lsi810.dsa &= 0xffffff00; |
| 562 | lsi810.dsa |= | |
| 562 | lsi810.dsa |= data | |
| 563 | 563 | break; |
| 564 | 564 | case 0x11: /* DSA [15-8] */ |
| 565 | 565 | lsi810.dsa &= 0xffff00ff; |
| 566 | lsi810.dsa |= | |
| 566 | lsi810.dsa |= data | |
| 567 | 567 | break; |
| 568 | 568 | case 0x12: /* DSA [23-16] */ |
| 569 | 569 | lsi810.dsa &= 0xff00ffff; |
| 570 | lsi810.dsa |= | |
| 570 | lsi810.dsa |= data | |
| 571 | 571 | break; |
| 572 | 572 | case 0x13: /* DSA [31-24] */ |
| 573 | 573 | lsi810.dsa &= 0x00ffffff; |
| 574 | lsi810.dsa |= | |
| 574 | lsi810.dsa |= data | |
| 575 | 575 | break; |
| 576 | 576 | case 0x14: /* ISTAT */ |
| 577 | lsi810.istat = | |
| 577 | lsi810.istat = data | |
| 578 | 578 | break; |
| 579 | 579 | case 0x2c: /* DSP [7-0] */ |
| 580 | 580 | lsi810.dsp &= 0xffffff00; |
| 581 | lsi810.dsp |= | |
| 581 | lsi810.dsp |= data | |
| 582 | 582 | break; |
| 583 | 583 | case 0x2d: /* DSP [15-8] */ |
| 584 | 584 | lsi810.dsp &= 0xffff00ff; |
| 585 | lsi810.dsp |= | |
| 585 | lsi810.dsp |= data | |
| 586 | 586 | break; |
| 587 | 587 | case 0x2e: /* DSP [23-16] */ |
| 588 | 588 | lsi810.dsp &= 0xff00ffff; |
| 589 | lsi810.dsp |= | |
| 589 | lsi810.dsp |= data | |
| 590 | 590 | break; |
| 591 | 591 | case 0x2f: /* DSP [31-24] */ |
| 592 | 592 | lsi810.dsp &= 0x00ffffff; |
| 593 | lsi810.dsp |= | |
| 593 | lsi810.dsp |= data | |
| 594 | 594 | lsi810.halted = 0; |
| 595 | 595 | if((lsi810.dmode & 0x1) == 0 && !lsi810.halted) { |
| 596 | 596 | dma_exec(); |
| r2844 | r2845 | |
| 600 | 600 | case 0x35: |
| 601 | 601 | case 0x36: |
| 602 | 602 | case 0x37: |
| 603 | lsi810.scratch_a[ | |
| 603 | lsi810.scratch_a[offset % 4] = data | |
| 604 | 604 | break; |
| 605 | 605 | case 0x38: /* DMODE */ |
| 606 | lsi810.dmode = | |
| 606 | lsi810.dmode = data | |
| 607 | 607 | break; |
| 608 | 608 | case 0x39: /* DIEN */ |
| 609 | lsi810.dien = | |
| 609 | lsi810.dien = data | |
| 610 | 610 | break; |
| 611 | 611 | case 0x3b: /* DCNTL */ |
| 612 | lsi810.dcntl = | |
| 612 | lsi810.dcntl = data | |
| 613 | 613 | |
| 614 | 614 | if(lsi810.dcntl & 0x14 && !lsi810.halted) /* single-step & start DMA */ |
| 615 | 615 | { |
| r2844 | r2845 | |
| 630 | 630 | } |
| 631 | 631 | break; |
| 632 | 632 | case 0x40: /* SIEN0 */ |
| 633 | lsi810.sien0 = | |
| 633 | lsi810.sien0 = data | |
| 634 | 634 | break; |
| 635 | 635 | case 0x41: /* SIEN1 */ |
| 636 | lsi810.sien1 = | |
| 636 | lsi810.sien1 = data | |
| 637 | 637 | break; |
| 638 | 638 | case 0x48: /* STIME0 */ |
| 639 | lsi810.stime0 = | |
| 639 | lsi810.stime0 = data | |
| 640 | 640 | break; |
| 641 | 641 | case 0x4a: /* RESPID */ |
| 642 | lsi810.respid = | |
| 642 | lsi810.respid = data | |
| 643 | 643 | break; |
| 644 | 644 | case 0x4d: /* STEST1 */ |
| 645 | lsi810.stest1 = | |
| 645 | lsi810.stest1 = data | |
| 646 | 646 | break; |
| 647 | 647 | case 0x5c: /* SCRATCH B */ |
| 648 | 648 | case 0x5d: |
| 649 | 649 | case 0x5e: |
| 650 | 650 | case 0x5f: |
| 651 | lsi810.scratch_b[ | |
| 651 | lsi810.scratch_b[offset % 4] = data | |
| 652 | 652 | break; |
| 653 | 653 | |
| 654 | 654 | default: |
| 655 | fatalerror("LSI53C810: reg_w: Unknown reg %02X, %02X", | |
| 655 | fatalerror("LSI53C810: reg_w: Unknown reg %02X, %02X", offset, data | |
| 656 | 656 | } |
| 657 | 657 | } |
| 658 | 658 |
| r2844 | r2845 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | extern void *lsi53c810_get_device(int id); |
| 21 | 21 | |
| 22 | UINT8 lsi53c810_reg_r(int reg); | |
| 23 | void lsi53c810_reg_w(running_machine *machine, int reg, UINT8 value); | |
| 22 | READ8_HANDLER( lsi53c810_reg_r ); | |
| 23 | WRITE8_HANDLER( lsi53c810_reg_w ); | |
| 24 | 24 | |
| 25 | 25 | unsigned lsi53c810_dasm(char *buf, UINT32 pc); |
| 26 | 26 |
| r2844 | r2845 | |
|---|---|---|
| 2 | 2 | 68681 DUART |
| 3 | 3 | |
| 4 | 4 | Written by Mariusz Wojcieszek |
| 5 | ||
| 6 | Emulation is preliminary, only features required by Touch Master games are implemented | |
| 7 | ||
| 8 | ToDo: | |
| 9 | - interrupts other than RXRDY | |
| 10 | - timer/counter | |
| 11 | - input port | |
| 12 | - input port change | |
| 13 | - output port | |
| 14 | - output port when used as control signals | |
| 15 | - MAME device interface | |
| 16 | - multiple instances | |
| 17 | 5 | */ |
| 18 | 6 | |
| 19 | 7 | #include "driver.h" |
| 8 | #include "68681.h" | |
| 20 | 9 | |
| 10 | #define VERBOSE 0 | |
| 11 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) | |
| 12 | ||
| 13 | const char* duart68681_reg_read_names[0x10] = | |
| 14 | { | |
| 15 | "MRA", "SRA", "BRG Test", "RHRA", "IPCR", "ISR", "CTU", "CTL", "MRB", "SRB", "1X/16X Test", "RHRB", "IVR", "Input Ports", "Start Counter", "Stop Counter" | |
| 16 | }; | |
| 17 | ||
| 18 | const char* duart68681_reg_write_names[0x10] = | |
| 19 | { | |
| 20 | "MRA", "CSRA", "CRA", "THRA", "ACR", "IMR", "CRUR", "CTLR", "MRB", "CSRB", "CRB", "THRB", "IVR", "OPCR", "Set OP Bits", "Reset OP Bits" | |
| 21 | }; | |
| 22 | ||
| 21 | 23 | #define INT_INPUT_PORT_CHANGE 0x80 |
| 22 | 24 | #define INT_DELTA_BREAK_B 0x40 |
| 23 | 25 | #define INT_RXRDY_FFULLB 0x20 |
| r2844 | r2845 | |
| 66 | 68 | UINT8 tx_ready; |
| 67 | 69 | emu_timer *tx_timer; |
| 68 | 70 | |
| 69 | } DUART | |
| 71 | } DUART | |
| 70 | 72 | |
| 71 | 73 | typedef struct |
| 72 | 74 | { |
| 73 | int frequency; | |
| 75 | /* device */ | |
| 76 | const device_config *device; | |
| 74 | 77 | |
| 75 | // registers | |
| 78 | /* config */ | |
| 79 | const duart68681_config *duart_config; | |
| 80 | ||
| 81 | /* registers */ | |
| 76 | 82 | UINT8 ACR; /* Auxiliary Control Register */ |
| 77 | 83 | UINT8 IMR; /* Interrupt Mask Register */ |
| 78 | 84 | UINT8 ISR; /* Interrupt Status Register */ |
| 79 | 85 | UINT8 IVR; /* Interrupt Vector Register */ |
| 80 | 86 | UINT8 OPCR; /* Output Port Conf. Register */ |
| 87 | UINT8 OPR; /* Output Port Register */ | |
| 88 | PAIR CTR; /* Counter/Timer Preset Value */ | |
| 81 | 89 | |
| 82 | / | |
| 90 | /* state */ | |
| 83 | 91 | UINT8 IP_last_state; /* last state of IP bits */ |
| 84 | 92 | |
| 85 | // callbacks | |
| 86 | UINT8 (*input_port_read)(void); | |
| 87 | void (*tx_callback)(int channel, UINT8 data); | |
| 88 | void (*irq_handler)(running_machine *machine, int vector); | |
| 93 | /* timer */ | |
| 94 | emu_timer *duart_timer; | |
| 89 | 95 | |
| 90 | DUART_68681_CHANNEL channel[2]; | |
| 91 | } DUART_68681; | |
| 96 | /* UART channels */ | |
| 97 | DUART68681_CHANNEL channel[2]; | |
| 92 | 98 | |
| 93 | ||
| 99 | } | |
| 94 | 100 | |
| 95 | ||
| 101 | INLINE | |
| 96 | 102 | { |
| 97 | if ( (duart_68681.ISR & duart_68681.IMR) != 0 ) | |
| 103 | assert(device != NULL); | |
| 104 | assert(device->token != NULL); | |
| 105 | assert(device->type == DUART68681); | |
| 106 | ||
| 107 | return (duart68681_state *)device->token; | |
| 108 | } | |
| 109 | ||
| 110 | static void duart68681_update_interrupts(duart68681_state *duart68681) | |
| 111 | { | |
| 112 | if ( (duart68681->ISR & duart68681->IMR) != 0 ) | |
| 98 | 113 | { |
| 99 | if ( duart | |
| 114 | if ( duart | |
| 100 | 115 | { |
| 101 | duart | |
| 116 | duart | |
| 102 | 117 | } |
| 103 | 118 | } |
| 104 | 119 | }; |
| 105 | 120 | |
| 106 | static | |
| 121 | static TIMER_CALLBACK( duart_ | |
| 107 | 122 | { |
| 108 | if ( duart_68681.channel[ch].MR_ptr == 0 ) | |
| 123 | const device_config *device = ptr; | |
| 124 | duart68681_state *duart68681 = get_safe_token(device); | |
| 125 | ||
| 126 | duart68681->ISR |= INT_COUNTER_READY; | |
| 127 | duart68681_update_interrupts(duart68681); | |
| 128 | }; | |
| 129 | ||
| 130 | static void duart68681_write_MR(duart68681_state *duart68681, int ch, UINT8 data) | |
| 131 | { | |
| 132 | if ( duart68681->channel[ch].MR_ptr == 0 ) | |
| 109 | 133 | { |
| 110 | duart_68681.channel[ch].MR1 = data; | |
| 111 | // TODO: | |
| 112 | duart_68681.channel[ch].MR_ptr = 1; | |
| 134 | duart68681->channel[ch].MR1 = data; | |
| 135 | duart68681->channel[ch].MR_ptr = 1; | |
| 113 | 136 | } |
| 114 | 137 | else |
| 115 | 138 | { |
| 116 | duart_68681.channel[ch].MR2 = data; | |
| 117 | // TODO: | |
| 139 | duart68681->channel[ch].MR2 = data; | |
| 118 | 140 | } |
| 119 | 141 | }; |
| 120 | 142 | |
| 121 | static void duart | |
| 143 | static void duart | |
| 122 | 144 | { |
| 123 | 145 | const int baud_rate_ACR_0[] = { 50, 110, 134, 200, 300, 600, 1200, 1050, 2400, 4800, 7200, 9600, 38400, 0, 0, 0 }; |
| 124 | 146 | const int baud_rate_ACR_1[] = { 75, 110, 134, 150, 300, 600, 1200, 2000, 2400, 4800, 1800, 9600, 19200, 0, 0, 0 }; |
| 125 | 147 | |
| 126 | duart | |
| 148 | duart | |
| 127 | 149 | |
| 128 | 150 | if ( BIT(ACR,7) == 0 ) |
| 129 | 151 | { |
| 130 | duart | |
| 152 | duart | |
| 131 | 153 | } |
| 132 | 154 | else |
| 133 | 155 | { |
| 134 | duart | |
| 156 | duart | |
| 135 | 157 | } |
| 136 | if ( duart | |
| 158 | if ( duart | |
| 137 | 159 | { |
| 138 | | |
| 160 | LOG | |
| 139 | 161 | } |
| 140 | 162 | }; |
| 141 | 163 | |
| 142 | static void duart | |
| 164 | static void duart | |
| 143 | 165 | { |
| 144 | duart | |
| 166 | duart | |
| 145 | 167 | if ( BIT(data,0) ) |
| 146 | 168 | { |
| 147 | duart | |
| 169 | duart | |
| 148 | 170 | } |
| 149 | 171 | if ( BIT(data,1) ) |
| 150 | 172 | { |
| 151 | duart_68681.channel[ch].rx_enabled = 0; | |
| 152 | duart_68681.channel[ch].SR &= ~STATUS_RECEIVER_READY; | |
| 173 | duart68681->channel[ch].rx_enabled = 0; | |
| 174 | duart68681->channel[ch].SR &= ~STATUS_RECEIVER_READY; | |
| 153 | 175 | } |
| 154 | 176 | |
| 155 | 177 | if ( BIT(data,2) ) |
| 156 | 178 | { |
| 157 | duart_68681.channel[ch].tx_enabled = 1; | |
| 158 | duart_68681.channel[ch].tx_ready = 1; | |
| 159 | duart_68681.channel[ch].SR |= STATUS_TRANSMITTER_READY; | |
| 179 | duart68681->channel[ch].tx_enabled = 1; | |
| 180 | duart68681->channel[ch].tx_ready = 1; | |
| 181 | duart68681->channel[ch].SR |= STATUS_TRANSMITTER_READY; | |
| 160 | 182 | } |
| 161 | 183 | if ( BIT(data,3) ) |
| 162 | 184 | { |
| 163 | duart_68681.channel[ch].tx_enabled = 0; | |
| 164 | duart_68681.channel[ch].tx_ready = 0; | |
| 165 | duart_68681.channel[ch].SR &= ~STATUS_TRANSMITTER_READY; | |
| 185 | duart68681->channel[ch].tx_enabled = 0; | |
| 186 | duart68681->channel[ch].tx_ready = 0; | |
| 187 | duart68681->channel[ch].SR &= ~STATUS_TRANSMITTER_READY; | |
| 166 | 188 | } |
| 167 | 189 | |
| 168 | 190 | switch( (data >> 4) & 0x07 ) |
| r2844 | r2845 | |
| 170 | 192 | case 0: /* No command */ |
| 171 | 193 | break; |
| 172 | 194 | case 1: /* Reset MR pointer. Causes the Channel A MR pointer to point to MR1 */ |
| 173 | duart | |
| 195 | duart | |
| 174 | 196 | break; |
| 175 | 197 | case 2: /* Reset channel A receiver (disable receiver and flush fifo) */ |
| 176 | duart_68681.channel[ch].rx_enabled = 0; | |
| 177 | duart_68681.channel[ch].SR &= ~STATUS_RECEIVER_READY; | |
| 178 | duart_68681.channel[ch].rx_fifo_read_ptr = 0; | |
| 179 | duart_68681.channel[ch].rx_fifo_write_ptr = 0; | |
| 180 | duart_68681.channel[ch].rx_fifo_num = 0; | |
| 198 | duart68681->channel[ch].rx_enabled = 0; | |
| 199 | duart68681->channel[ch].SR &= ~STATUS_RECEIVER_READY; | |
| 200 | duart68681->channel[ch].rx_fifo_read_ptr = 0; | |
| 201 | duart68681->channel[ch].rx_fifo_write_ptr = 0; | |
| 202 | duart68681->channel[ch].rx_fifo_num = 0; | |
| 181 | 203 | break; |
| 182 | 204 | case 3: /* Reset channel A transmitter */ |
| 183 | //TODO: | |
| 205 | duart68681->channel[ch].tx_enabled = 0; | |
| 206 | duart68681->channel[ch].SR &= ~STATUS_TRANSMITTER_READY; | |
| 207 | timer_adjust_oneshot(duart68681->channel[ch].tx_timer, attotime_never, ch); | |
| 184 | 208 | break; |
| 185 | 209 | case 4: /* Reset Error Status */ |
| 186 | // TODO: | |
| 187 | duart_68681.channel[ch].SR &= ~(STATUS_RECEIVED_BREAK | STATUS_FRAMING_ERROR | STATUS_PARITY_ERROR | STATUS_OVERRUN_ERROR); | |
| 210 | duart68681->channel[ch].SR &= ~(STATUS_RECEIVED_BREAK | STATUS_FRAMING_ERROR | STATUS_PARITY_ERROR | STATUS_OVERRUN_ERROR); | |
| 188 | 211 | break; |
| 212 | case 5: /* Reset Channel break change interrupt */ | |
| 213 | if ( ch == 0 ) | |
| 214 | { | |
| 215 | duart68681->ISR &= ~INT_DELTA_BREAK_A; | |
| 216 | } | |
| 217 | else | |
| 218 | { | |
| 219 | duart68681->ISR &= ~INT_DELTA_BREAK_B; | |
| 220 | } | |
| 221 | duart68681_update_interrupts(duart68681); | |
| 222 | break; | |
| 189 | 223 | default: |
| 190 | | |
| 224 | LOG | |
| 191 | 225 | break; |
| 192 | 226 | } |
| 193 | 227 | }; |
| 194 | 228 | |
| 195 | static UINT8 duart | |
| 229 | static UINT8 duart | |
| 196 | 230 | { |
| 197 | 231 | UINT8 r; |
| 198 | 232 | |
| 199 | if ( duart | |
| 233 | if ( duart | |
| 200 | 234 | { |
| 201 | logerror( "68681: rx fifo underflow\n" ); | |
| 202 | return 0; | |
| 235 | LOG(( "68681: rx fifo underflow\n" )); | |
| 236 | return 0x0; | |
| 203 | 237 | } |
| 204 | 238 | |
| 205 | r = duart_68681.channel[ch].rx_fifo[duart_68681.channel[ch].rx_fifo_read_ptr++]; | |
| 206 | if ( duart_68681.channel[ch].rx_fifo_read_ptr == RX_FIFO_SIZE ) | |
| 239 | r = duart68681->channel[ch].rx_fifo[duart68681->channel[ch].rx_fifo_read_ptr++]; | |
| 240 | if ( duart68681->channel[ch].rx_fifo_read_ptr == RX_FIFO_SIZE ) | |
| 207 | 241 | { |
| 208 | duart | |
| 242 | duart | |
| 209 | 243 | } |
| 210 | 244 | |
| 211 | duart | |
| 245 | duart | |
| 212 | 246 | |
| 213 | if ( duart | |
| 247 | if ( duart | |
| 214 | 248 | { |
| 215 | duart | |
| 249 | duart | |
| 216 | 250 | if ( ch == 0 ) |
| 217 | 251 | { |
| 218 | duart | |
| 252 | duart | |
| 219 | 253 | } |
| 220 | 254 | else |
| 221 | 255 | { |
| 222 | duart | |
| 256 | duart | |
| 223 | 257 | } |
| 224 | 258 | } |
| 225 | 259 | else |
| 226 | 260 | { |
| 227 | duart | |
| 261 | duart | |
| 228 | 262 | if ( ch == 0 ) |
| 229 | 263 | { |
| 230 | duart | |
| 264 | duart | |
| 231 | 265 | } |
| 232 | 266 | else |
| 233 | 267 | { |
| 234 | duart | |
| 268 | duart | |
| 235 | 269 | } |
| 236 | 270 | } |
| 237 | duart | |
| 271 | duart | |
| 238 | 272 | return r; |
| 239 | 273 | }; |
| 240 | 274 | |
| 241 | 275 | static TIMER_CALLBACK( tx_timer_callback ) |
| 242 | 276 | { |
| 277 | const device_config *device = ptr; | |
| 278 | duart68681_state *duart68681 = get_safe_token(device); | |
| 243 | 279 | int ch = param & 1; |
| 244 | 280 | |
| 245 | if (duart_68681.tx_callback) | |
| 246 | duart_68681.tx_callback(ch, duart_68681.channel[ch].tx_data); | |
| 281 | if (duart68681->duart_config->tx_callback) | |
| 282 | duart68681->duart_config->tx_callback(device, ch, duart68681->channel[ch].tx_data); | |
| 247 | 283 | |
| 248 | duart_68681.channel[ch].tx_ready = 1; | |
| 249 | duart_68681.channel[ch].SR |= STATUS_TRANSMITTER_READY; | |
| 284 | duart68681->channel[ch].tx_ready = 1; | |
| 285 | duart68681->channel[ch].SR |= STATUS_TRANSMITTER_READY; | |
| 250 | 286 | |
| 251 | 287 | if (ch == 0) |
| 252 | duart | |
| 288 | duart | |
| 253 | 289 | else |
| 254 | duart | |
| 290 | duart | |
| 255 | 291 | |
| 256 | duart_68681_update_interrupts(machine); | |
| 257 | timer_adjust_oneshot(duart_68681.channel[ch].tx_timer, attotime_never, ch); | |
| 292 | duart68681_update_interrupts(duart68681); | |
| 293 | timer_adjust_oneshot(duart68681->channel[ch].tx_timer, attotime_never, ch); | |
| 258 | 294 | }; |
| 259 | 295 | |
| 260 | static void duart | |
| 296 | static void duart | |
| 261 | 297 | { |
| 262 | 298 | attotime period; |
| 263 | 299 | |
| 264 | duart | |
| 300 | duart | |
| 265 | 301 | |
| 266 | duart_68681.channel[ch].tx_ready = 0; | |
| 267 | duart_68681.channel[ch].SR &= ~STATUS_TRANSMITTER_READY; | |
| 302 | duart68681->channel[ch].tx_ready = 0; | |
| 303 | duart68681->channel[ch].SR &= ~STATUS_TRANSMITTER_READY; | |
| 268 | 304 | |
| 269 | 305 | if (ch == 0) |
| 270 | duart | |
| 306 | duart | |
| 271 | 307 | else |
| 272 | duart | |
| 308 | duart | |
| 273 | 309 | |
| 274 | duart | |
| 310 | duart | |
| 275 | 311 | |
| 276 | period = ATTOTIME_IN_HZ(duart_68681.channel[ch].baud_rate / 10 ); | |
| 277 | timer_adjust_oneshot(duart_68681.channel[ch].tx_timer, period, ch); | |
| 312 | period = ATTOTIME_IN_HZ(duart68681->channel[ch].baud_rate / 10 ); | |
| 313 | timer_adjust_oneshot(duart68681->channel[ch].tx_timer, period, ch); | |
| 278 | 314 | }; |
| 279 | 315 | |
| 280 | READ | |
| 316 | READ8 | |
| 281 | 317 | { |
| 282 | UINT16 r = 0x0; | |
| 318 | duart68681_state* duart68681 = get_safe_token(device); | |
| 319 | UINT8 r = 0xff; | |
| 283 | 320 | |
| 284 | //logerror( "Reading 68681 reg %x\n", offset ); | |
| 321 | offset &= 0xf; | |
| 322 | ||
| 323 | LOG(( "Reading 68681 (%s) reg %x (%s) ", device->tag, offset, duart68681_reg_read_names[offset] )); | |
| 285 | 324 | switch (offset) |
| 286 | 325 | { |
| 287 | 326 | case 0x01: /* SRA */ |
| 288 | r = duart | |
| 327 | r = duart | |
| 289 | 328 | break; |
| 290 | 329 | case 0x03: /* Rx Holding Register A */ |
| 291 | r = duart | |
| 330 | r = duart | |
| 292 | 331 | break; |
| 293 | 332 | case 0x04: /* IPCR */ |
| 294 | 333 | { |
| 295 | 334 | UINT8 IP; |
| 296 | if ( duart_68681.input_port_read != NULL ) | |
| 297 | IP = duart_68681.input_port_read(); | |
| 335 | if ( duart68681->duart_config->input_port_read != NULL ) | |
| 336 | IP = duart68681->duart_config->input_port_read(duart68681->device); | |
| 298 | 337 | else |
| 299 | 338 | IP = 0x0; |
| 300 | 339 | |
| 301 | r = (((duart_68681.IP_last_state ^ IP) & 0x0f) << 4) | (IP & 0x0f); | |
| 302 | duart_68681.IP_last_state = IP; | |
| 303 | duart_68681.ISR &= ~INT_INPUT_PORT_CHANGE; | |
| 304 | duart_68681_update_interrupts(machine); | |
| 340 | r = (((duart68681->IP_last_state ^ IP) & 0x0f) << 4) | (IP & 0x0f); | |
| 341 | duart68681->IP_last_state = IP; | |
| 342 | duart68681->ISR &= ~INT_INPUT_PORT_CHANGE; | |
| 343 | duart68681_update_interrupts(duart68681); | |
| 305 | 344 | } |
| 306 | 345 | break; |
| 346 | case 0x05: /* ISR */ | |
| 347 | r = duart68681->ISR; | |
| 348 | break; | |
| 307 | 349 | case 0x09: /* SRB */ |
| 308 | r = duart | |
| 350 | r = duart | |
| 309 | 351 | break; |
| 310 | 352 | case 0x0b: /* RHRB */ |
| 311 | r = duart | |
| 353 | r = duart | |
| 312 | 354 | break; |
| 355 | case 0x0d: /* IP */ | |
| 356 | if ( duart68681->duart_config->input_port_read != NULL ) | |
| 357 | r = duart68681->duart_config->input_port_read(duart68681->device); | |
| 358 | else | |
| 359 | r = 0x0; | |
| 360 | break; | |
| 361 | case 0x0e: /* Start counter command */ | |
| 362 | switch( (duart68681->ACR >> 4) & 0x07 ) | |
| 363 | { | |
| 364 | case 0x07: /* Timer, CLK/16 */ | |
| 365 | { | |
| 366 | double hz; | |
| 367 | //attotime rate = attotime_mul(ATTOTIME_IN_HZ(duart68681->duart_config->frequency), 16*duart68681->CTR.w.l); | |
| 368 | attotime rate = ATTOTIME_IN_HZ(2*duart68681->duart_config->frequency/(2*16*16*duart68681->CTR.w.l)); | |
| 369 | hz = ATTOSECONDS_TO_HZ(rate.attoseconds); | |
| 370 | timer_adjust_periodic(duart68681->duart_timer, rate, 0, rate); | |
| 371 | } | |
| 372 | break; | |
| 373 | } | |
| 374 | break; | |
| 375 | case 0x0f: /* Stop counter command */ | |
| 376 | duart68681->ISR &= ~INT_COUNTER_READY; | |
| 377 | duart68681_update_interrupts(duart68681); | |
| 378 | break; | |
| 313 | 379 | default: |
| 314 | | |
| 380 | LOG | |
| 315 | 381 | break; |
| 316 | 382 | } |
| 383 | LOG(("returned %02x\n", r)); | |
| 317 | 384 | return r; |
| 318 | 385 | } |
| 319 | 386 | |
| 320 | WRITE | |
| 387 | WRITE8 | |
| 321 | 388 | { |
| 322 | //logerror( "Writing 68681 reg %x with %04x\n", offset, data ); | |
| 389 | duart68681_state* duart68681 = get_safe_token(device); | |
| 390 | ||
| 391 | offset &= 0x0f; | |
| 392 | LOG(( "Writing 68681 (%s) reg %x (%s) with %04x\n", device->tag, offset, duart68681_reg_write_names[offset], data )); | |
| 323 | 393 | switch(offset) |
| 324 | 394 | { |
| 325 | 395 | case 0x00: /* MRA */ |
| 326 | duart | |
| 396 | duart | |
| 327 | 397 | break; |
| 328 | 398 | case 0x01: /* CSRA */ |
| 329 | duart | |
| 399 | duart | |
| 330 | 400 | break; |
| 331 | 401 | case 0x02: /* CRA */ |
| 332 | duart | |
| 402 | duart | |
| 333 | 403 | break; |
| 334 | 404 | case 0x03: /* THRA */ |
| 335 | duart | |
| 405 | duart | |
| 336 | 406 | break; |
| 337 | 407 | case 0x04: /* ACR */ |
| 338 | duart_68681.ACR = data; | |
| 339 | // TODO: | |
| 408 | duart68681->ACR = data; | |
| 340 | 409 | // bits 6-4: Counter/Timer Mode And Clock Source Select |
| 341 | 410 | // bits 3-0: IP3-0 Change-Of-State Interrupt Enable |
| 342 | duart_68681_write_CSR(0, duart_68681.channel[0].CSR, data); | |
| 343 | duart_68681_write_CSR(1, duart_68681.channel[1].CSR, data); | |
| 411 | if (((data >> 4) & 0x07) != 0x07) | |
| 412 | logerror( "68681 (%s): Unhandled timer/counter mode %d\n", device->tag, (data >> 4) & 0x07); | |
| 413 | ||
| 414 | duart68681_write_CSR(duart68681, 0, duart68681->channel[0].CSR, data); | |
| 415 | duart68681_write_CSR(duart68681, 1, duart68681->channel[1].CSR, data); | |
| 344 | 416 | break; |
| 345 | 417 | case 0x05: /* IMR */ |
| 346 | duart_68681.IMR = data; | |
| 347 | // TODO: handle update interrupts? | |
| 418 | duart68681->IMR = data; | |
| 419 | duart68681_update_interrupts(duart68681); | |
| 348 | 420 | break; |
| 421 | case 0x06: /* CTUR */ | |
| 422 | duart68681->CTR.b.h = data; | |
| 423 | break; | |
| 424 | case 0x07: /* CTLR */ | |
| 425 | duart68681->CTR.b.l = data; | |
| 426 | break; | |
| 349 | 427 | case 0x08: /* MRB */ |
| 350 | duart | |
| 428 | duart | |
| 351 | 429 | break; |
| 352 | 430 | case 0x09: /* CSRB */ |
| 353 | duart | |
| 431 | duart | |
| 354 | 432 | break; |
| 355 | 433 | case 0x0a: /* CRB */ |
| 356 | duart | |
| 434 | duart | |
| 357 | 435 | break; |
| 358 | 436 | case 0x0b: /* THRB */ |
| 359 | duart | |
| 437 | duart | |
| 360 | 438 | break; |
| 361 | 439 | case 0x0c: /* IVR */ |
| 362 | duart | |
| 440 | duart | |
| 363 | 441 | break; |
| 364 | 442 | case 0x0d: /* OPCR */ |
| 365 | duart_68681.OPCR = data; | |
| 443 | if (data != 0x00) | |
| 444 | logerror( "68681 (%s): Unhandled OPCR value: %02x\n", device->tag, data); | |
| 445 | duart68681->OPCR = data; | |
| 366 | 446 | break; |
| 367 | 447 | case 0x0e: /* Set Output Port Bits */ |
| 368 | // TODO: bits set to 1 causes corresponding output port bit to be set to 0 | |
| 448 | duart68681->OPR |= data; | |
| 449 | if (duart68681->duart_config->output_port_write) | |
| 450 | duart68681->duart_config->output_port_write(duart68681->device, duart68681->OPR ^ 0xff); | |
| 369 | 451 | break; |
| 370 | 452 | case 0x0f: /* Reset Output Port Bits */ |
| 371 | // TODO: bits set to 1 causes corresponding output port bit to be set to 1 | |
| 453 | duart68681->OPR &= ~data; | |
| 454 | if (duart68681->duart_config->output_port_write) | |
| 455 | duart68681->duart_config->output_port_write(duart68681->device, duart68681->OPR ^ 0xff); | |
| 372 | 456 | break; |
| 373 | default: | |
| 374 | logerror( "Writing 68681 reg %x with %04x\n", offset, data ); | |
| 375 | break; | |
| 376 | 457 | } |
| 377 | 458 | } |
| 378 | 459 | |
| 379 | void duart | |
| 460 | void duart | |
| 380 | 461 | { |
| 381 | if ( duart_68681.channel[ch].rx_enabled ) | |
| 462 | duart68681_state *duart68681 = get_safe_token(device); | |
| 463 | ||
| 464 | if ( duart68681->channel[ch].rx_enabled ) | |
| 382 | 465 | { |
| 383 | if ( duart | |
| 466 | if ( duart | |
| 384 | 467 | { |
| 385 | | |
| 468 | LOG | |
| 386 | 469 | return; |
| 387 | 470 | } |
| 388 | duart_68681.channel[ch].rx_fifo[duart_68681.channel[ch].rx_fifo_write_ptr++] = data; | |
| 389 | if ( duart_68681.channel[ch].rx_fifo_write_ptr == RX_FIFO_SIZE ) | |
| 471 | duart68681->channel[ch].rx_fifo[duart68681->channel[ch].rx_fifo_write_ptr++] = data; | |
| 472 | if ( duart68681->channel[ch].rx_fifo_write_ptr == RX_FIFO_SIZE ) | |
| 390 | 473 | { |
| 391 | duart | |
| 474 | duart | |
| 392 | 475 | } |
| 393 | duart | |
| 476 | duart | |
| 394 | 477 | |
| 395 | duart_68681.channel[ch].SR |= STATUS_RECEIVER_READY; | |
| 396 | if ( BIT(duart_68681.channel[ch].MR1,MODE_RX_INT_SELECT_BIT) == 0 ) | |
| 478 | duart68681->channel[ch].SR |= STATUS_RECEIVER_READY; | |
| 479 | if ( BIT(duart68681->channel[ch].MR1,MODE_RX_INT_SELECT_BIT) == 0 ) | |
| 397 | 480 | { |
| 398 | duart | |
| 481 | duart | |
| 399 | 482 | } |
| 400 | if ( duart | |
| 483 | if ( duart | |
| 401 | 484 | { |
| 402 | duart_68681.channel[ch].SR |= STATUS_FIFO_FULL; | |
| 403 | if ( BIT(duart_68681.channel[ch].MR1,MODE_RX_INT_SELECT_BIT) == 1 ) | |
| 485 | duart68681->channel[ch].SR |= STATUS_FIFO_FULL; | |
| 486 | if ( BIT(duart68681->channel[ch].MR1,MODE_RX_INT_SELECT_BIT) == 1 ) | |
| 404 | 487 | { |
| 405 | duart | |
| 488 | duart | |
| 406 | 489 | } |
| 407 | 490 | } |
| 408 | duart | |
| 491 | duart | |
| 409 | 492 | } |
| 410 | 493 | }; |
| 411 | 494 | |
| 412 | void duart_68681_init(int frequency, void (*irq_handler)(running_machine *machine, int vector), void (*tx_callback)(int channel, UINT8 data)) | |
| 495 | /*------------------------------------------------- | |
| 496 | device start callback | |
| 497 | -------------------------------------------------*/ | |
| 498 | ||
| 499 | static DEVICE_START(duart68681) | |
| 413 | 500 | { |
| 414 | memset(&duart_68681, 0, sizeof(duart_68681)); | |
| 501 | duart68681_state *duart68681 = get_safe_token(device); | |
| 502 | char unique_tag[30]; | |
| 415 | 503 | |
| 416 | duart_68681.frequency = frequency; | |
| 417 | duart_68681.tx_callback = tx_callback; | |
| 418 | duart_68681.irq_handler = irq_handler; | |
| 504 | /* validate arguments */ | |
| 505 | assert(device != NULL); | |
| 506 | assert(device->tag != NULL); | |
| 507 | assert(strlen(device->tag) < 20); | |
| 419 | 508 | |
| 509 | state_save_combine_module_and_tag(unique_tag, "DUART 68681", device->tag); | |
| 510 | ||
| 511 | state_save_register_item(unique_tag, 0, duart68681->ACR); | |
| 512 | state_save_register_item(unique_tag, 0, duart68681->IMR); | |
| 513 | state_save_register_item(unique_tag, 0, duart68681->ISR); | |
| 514 | state_save_register_item(unique_tag, 0, duart68681->IVR); | |
| 515 | state_save_register_item(unique_tag, 0, duart68681->OPCR); | |
| 516 | state_save_register_item(unique_tag, 0, duart68681->CTR); | |
| 517 | state_save_register_item(unique_tag, 0, duart68681->IP_last_state); | |
| 518 | ||
| 519 | state_save_register_item(unique_tag, 0, duart68681->channel[0].CR); | |
| 520 | state_save_register_item(unique_tag, 0, duart68681->channel[0].CSR); | |
| 521 | state_save_register_item(unique_tag, 0, duart68681->channel[0].MR1); | |
| 522 | state_save_register_item(unique_tag, 0, duart68681->channel[0].MR2); | |
| 523 | state_save_register_item(unique_tag, 0, duart68681->channel[0].MR_ptr); | |
| 524 | state_save_register_item(unique_tag, 0, duart68681->channel[0].SR); | |
| 525 | state_save_register_item(unique_tag, 0, duart68681->channel[0].baud_rate); | |
| 526 | state_save_register_item(unique_tag, 0, duart68681->channel[0].rx_enabled); | |
| 527 | state_save_register_item_array(unique_tag, 0, duart68681->channel[0].rx_fifo); | |
| 528 | state_save_register_item(unique_tag, 0, duart68681->channel[0].rx_fifo_read_ptr); | |
| 529 | state_save_register_item(unique_tag, 0, duart68681->channel[0].rx_fifo_write_ptr); | |
| 530 | state_save_register_item(unique_tag, 0, duart68681->channel[0].rx_fifo_num); | |
| 531 | state_save_register_item(unique_tag, 0, duart68681->channel[0].tx_enabled); | |
| 532 | state_save_register_item(unique_tag, 0, duart68681->channel[0].tx_data); | |
| 533 | state_save_register_item(unique_tag, 0, duart68681->channel[0].tx_ready); | |
| 534 | ||
| 535 | state_save_register_item(unique_tag, 0, duart68681->channel[1].CR); | |
| 536 | state_save_register_item(unique_tag, 0, duart68681->channel[1].CSR); | |
| 537 | state_save_register_item(unique_tag, 0, duart68681->channel[1].MR1); | |
| 538 | state_save_register_item(unique_tag, 0, duart68681->channel[1].MR2); | |
| 539 | state_save_register_item(unique_tag, 0, duart68681->channel[1].MR_ptr); | |
| 540 | state_save_register_item(unique_tag, 0, duart68681->channel[1].SR); | |
| 541 | state_save_register_item(unique_tag, 0, duart68681->channel[1].baud_rate); | |
| 542 | state_save_register_item(unique_tag, 0, duart68681->channel[1].rx_enabled); | |
| 543 | state_save_register_item_array(unique_tag, 0, duart68681->channel[1].rx_fifo); | |
| 544 | state_save_register_item(unique_tag, 0, duart68681->channel[1].rx_fifo_read_ptr); | |
| 545 | state_save_register_item(unique_tag, 0, duart68681->channel[1].rx_fifo_write_ptr); | |
| 546 | state_save_register_item(unique_tag, 0, duart68681->channel[1].rx_fifo_num); | |
| 547 | state_save_register_item(unique_tag, 0, duart68681->channel[1].tx_enabled); | |
| 548 | state_save_register_item(unique_tag, 0, duart68681->channel[1].tx_data); | |
| 549 | state_save_register_item(unique_tag, 0, duart68681->channel[1].tx_ready); | |
| 550 | ||
| 551 | } | |
| 552 | ||
| 553 | /*------------------------------------------------- | |
| 554 | device reset callback | |
| 555 | -------------------------------------------------*/ | |
| 556 | ||
| 557 | static DEVICE_RESET(duart68681) | |
| 558 | { | |
| 559 | duart68681_state *duart68681 = get_safe_token(device); | |
| 560 | ||
| 561 | memset(duart68681, 0, sizeof(duart68681_state)); | |
| 562 | duart68681->duart_config = device->static_config; | |
| 563 | duart68681->device = device; | |
| 564 | duart68681->IVR = 0x0f; | |
| 565 | ||
| 420 | 566 | // allocate timers |
| 421 | duart_68681.channel[0].tx_timer = timer_alloc(tx_timer_callback, NULL); | |
| 422 | timer_adjust_oneshot(duart_68681.channel[0].tx_timer, attotime_never, 0); | |
| 567 | duart68681->channel[0].tx_timer = timer_alloc(tx_timer_callback, (void*)device); | |
| 568 | timer_adjust_oneshot(duart68681->channel[0].tx_timer, attotime_never, 0); | |
| 423 | 569 | |
| 424 | duart_68681.channel[1].tx_timer = timer_alloc(tx_timer_callback, NULL); | |
| 425 | timer_adjust_oneshot(duart_68681.channel[1].tx_timer, attotime_never, 1); | |
| 426 | }; | |
| 570 | duart68681->channel[1].tx_timer = timer_alloc(tx_timer_callback, (void*)device); | |
| 571 | timer_adjust_oneshot(duart68681->channel[1].tx_timer, attotime_never, 1); | |
| 572 | ||
| 573 | duart68681->duart_timer = timer_alloc(duart_timer_callback, (void*)device); | |
| 574 | } | |
| 575 | ||
| 576 | /*------------------------------------------------- | |
| 577 | device set info callback | |
| 578 | -------------------------------------------------*/ | |
| 579 | ||
| 580 | static DEVICE_SET_INFO(duart68681) | |
| 581 | { | |
| 582 | switch (state) | |
| 583 | { | |
| 584 | /* no parameters to set */ | |
| 585 | } | |
| 586 | } | |
| 587 | ||
| 588 | /*------------------------------------------------- | |
| 589 | device get info callback | |
| 590 | -------------------------------------------------*/ | |
| 591 | ||
| 592 | DEVICE_GET_INFO(duart68681) | |
| 593 | { | |
| 594 | switch (state) | |
| 595 | { | |
| 596 | /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 597 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(duart68681_state); break; | |
| 598 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = sizeof(duart68681_config); break; | |
| 599 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; | |
| 600 | ||
| 601 | /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 602 | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(duart68681); break; | |
| 603 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(duart68681); break; | |
| 604 | case DEVINFO_FCT_STOP: /* nothing */ break; | |
| 605 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(duart68681);break; | |
| 606 | ||
| 607 | /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 608 | case DEVINFO_STR_NAME: info->s = "DUART 68681"; break; | |
| 609 | case DEVINFO_STR_FAMILY: info->s = "DUART"; break; | |
| 610 | case DEVINFO_STR_VERSION: info->s = "1.0"; break; | |
| 611 | case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break; | |
| 612 | case DEVINFO_STR_CREDITS: info->s = "Copyright Nicola Salmoria and the MAME Team"; break; | |
| 613 | } | |
| 614 | } |
| r2844 | r2845 | |
|---|---|---|
| 1 | 1 | #ifndef _68681_H |
| 2 | 2 | #define _68681_H |
| 3 | 3 | |
| 4 | void duart_68681_init(int frequency, void (*irq_handler)(running_machine *machine, int vector), void (*tx_callback)(int channel, UINT8 data)); | |
| 5 | void duart_68681_rx_data( running_machine *machine, int ch, UINT8 data ); | |
| 4 | typedef struct _duart68681_config duart68681_config; | |
| 5 | struct _duart68681_config | |
| 6 | { | |
| 7 | int frequency; | |
| 8 | void (*irq_handler)(const device_config *device, UINT8 vector); | |
| 9 | void (*tx_callback)(const device_config *device, int channel, UINT8 data); | |
| 10 | UINT8 (*input_port_read)(const device_config *device); | |
| 11 | void (*output_port_write)(const device_config *device, UINT8 data); | |
| 12 | }; | |
| 6 | 13 | |
| 7 | READ16_HANDLER(duart_68681_r); | |
| 8 | WRITE16_HANDLER(duart_68681_w); | |
| 14 | #define DUART68681 DEVICE_GET_INFO_NAME(duart68681) | |
| 15 | DEVICE_GET_INFO(duart68681); | |
| 9 | 16 | |
| 17 | READ8_DEVICE_HANDLER(duart68681_r); | |
| 18 | WRITE8_DEVICE_HANDLER(duart68681_w); | |
| 19 | ||
| 20 | void duart68681_rx_data( const device_config* device, int ch, UINT8 data ); | |
| 21 | ||
| 10 | 22 | #endif //_68681_H |
| r2844 | r2845 | |
|---|---|---|
| 70 | 70 | static void check_interrupts(running_machine *machine, int chip, int channel) |
| 71 | 71 | { |
| 72 | 72 | PC16552D_CHANNEL *ch = &duart[chip].ch[channel]; |
| 73 | int signal = 0; | |
| 73 | 74 | |
| 74 | 75 | if (ch->pending_interrupt != 0) |
| 75 | 76 | { |
| r2844 | r2845 | |
| 78 | 79 | ((ch->reg[REG_INT_ENABLE] & INT_ENABLE_RX_LINE_STATUS) && (ch->pending_interrupt & IRQ_RX_LINE_STATUS)) || |
| 79 | 80 | ((ch->reg[REG_INT_ENABLE] & INT_ENABLE_MODEM_STATUS) && (ch->pending_interrupt & IRQ_MODEM_STATUS))) |
| 80 | 81 | { |
| 81 | if (duart[chip].irq_handler != NULL) | |
| 82 | { | |
| 83 | duart[chip].irq_handler(machine, channel, 0); | |
| 84 | } | |
| 82 | signal = 1; | |
| 85 | 83 | } |
| 86 | 84 | } |
| 85 | ||
| 86 | if (duart[chip].irq_handler != NULL) | |
| 87 | { | |
| 88 | duart[chip].irq_handler(machine, channel, signal ? ASSERT_LINE : CLEAR_LINE); | |
| 89 | } | |
| 87 | 90 | } |
| 88 | 91 | |
| 89 | 92 | static void duart_push_rx_fifo(running_machine *machine, int chip, int channel, UINT8 data) |
| r2844 | r2845 | |
|---|---|---|
| 42 | 42 | #define NO_DEST_READ 0 |
| 43 | 43 | #endif |
| 44 | 44 | |
| 45 | #if !defined(BILINEAR_FILTER) | |
| 46 | #define BILINEAR_FILTER 0 | |
| 47 | #endif | |
| 45 | 48 | |
| 46 | 49 | |
| 50 | ||
| 47 | 51 | /*************************************************************************** |
| 48 | 52 | ONE-TIME-ONLY DEFINITIONS |
| 49 | 53 | ***************************************************************************/ |
| r2844 | r2845 | |
| 53 | 57 | |
| 54 | 58 | #include "mamecore.h" |
| 55 | 59 | #include "eminline.h" |
| 60 | #include "video/rgbutil.h" | |
| 56 | 61 | #include "render.h" |
| 57 | 62 | #include <math.h> |
| 58 | 63 | |
| r2844 | r2845 | |
| 99 | 104 | INLINE FUNCTIONS |
| 100 | 105 | ***************************************************************************/ |
| 101 | 106 | |
| 107 | /*------------------------------------------------- | |
| 108 | round_nearest - round to nearest in a | |
| 109 | predictable way | |
| 110 | -------------------------------------------------*/ | |
| 111 | ||
| 102 | 112 | INLINE float round_nearest(float f) |
| 103 | 113 | { |
| 104 | 114 | return floor(f + 0.5f); |
| 105 | 115 | } |
| 106 | 116 | |
| 107 | 117 | |
| 108 | INLINE UINT32 ycc_to_rgb(UINT8 y, UINT8 cb, UINT8 cr) | |
| 118 | /*------------------------------------------------- | |
| 119 | ycc_to_rgb - convert YCC to RGB; the YCC pixel | |
| 120 | contains Y in the LSB, Cb << 8, and Cr << 16 | |
| 121 | -------------------------------------------------*/ | |
| 122 | ||
| 123 | INLINE UINT32 ycc_to_rgb(UINT32 ycc) | |
| 109 | 124 | { |
| 110 | 125 | /* original equations: |
| 111 | 126 | |
| r2844 | r2845 | |
| 129 | 144 | G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8) |
| 130 | 145 | B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8) |
| 131 | 146 | */ |
| 147 | UINT8 y = ycc; | |
| 148 | UINT8 cb = ycc >> 8; | |
| 149 | UINT8 cr = ycc >> 16; | |
| 132 | 150 | int r, g, b, common; |
| 133 | 151 | |
| 134 | 152 | common = 298 * y - 298 * 16; |
| r2844 | r2845 | |
| 146 | 164 | return MAKE_RGB(r, g, b); |
| 147 | 165 | } |
| 148 | 166 | |
| 167 | ||
| 168 | /*------------------------------------------------- | |
| 169 | get_texel_palette16_nearest - return the | |
| 170 | nearest neighbor texel from a palettized | |
| 171 | 16bpp source | |
| 172 | -------------------------------------------------*/ | |
| 173 | ||
| 174 | INLINE UINT32 get_texel_palette16_nearest(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv, const rgb_t *palbase) | |
| 175 | { | |
| 176 | return palbase[texbase[(curv >> 16) * texrp + (curu >> 16)]]; | |
| 177 | } | |
| 178 | ||
| 179 | ||
| 180 | /*------------------------------------------------- | |
| 181 | get_texel_palette16_bilinear - return a | |
| 182 | bilinear filtered texel from a palettized | |
| 183 | 16bpp source | |
| 184 | -------------------------------------------------*/ | |
| 185 | ||
| 186 | INLINE UINT32 get_texel_palette16_bilinear(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv, const rgb_t *palbase) | |
| 187 | { | |
| 188 | rgb_t pix00, pix01, pix10, pix11; | |
| 189 | texbase += (curv >> 16) * texrp + (curu >> 16); | |
| 190 | pix00 = palbase[texbase[0]]; | |
| 191 | pix01 = palbase[texbase[1]]; | |
| 192 | pix10 = palbase[texbase[texrp + 0]]; | |
| 193 | pix11 = palbase[texbase[texrp + 1]]; | |
| 194 | return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); | |
| 195 | } | |
| 196 | ||
| 197 | ||
| 198 | /*------------------------------------------------- | |
| 199 | get_texel_rgb15_nearest - return the | |
| 200 | nearest neighbor texel from a 15bpp RGB source | |
| 201 | -------------------------------------------------*/ | |
| 202 | ||
| 203 | INLINE UINT32 get_texel_rgb15_nearest(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv) | |
| 204 | { | |
| 205 | return texbase[(curv >> 16) * texrp + (curu >> 16)]; | |
| 206 | } | |
| 207 | ||
| 208 | ||
| 209 | /*------------------------------------------------- | |
| 210 | get_texel_rgb15_bilinear - return the | |
| 211 | bilinear filtered texel from a 15bpp RGB | |
| 212 | source | |
| 213 | -------------------------------------------------*/ | |
| 214 | ||
| 215 | INLINE UINT32 get_texel_rgb15_bilinear(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv) | |
| 216 | { | |
| 217 | rgb_t pix00, pix01, pix10, pix11, filtered; | |
| 218 | texbase += (curv >> 16) * texrp + (curu >> 16); | |
| 219 | pix00 = texbase[0]; | |
| 220 | pix01 = texbase[1]; | |
| 221 | pix10 = texbase[texrp + 0]; | |
| 222 | pix11 = texbase[texrp + 1]; | |
| 223 | pix00 = ((pix00 & 0x7fe0) << 6) | (pix00 & 0x1f); | |
| 224 | pix01 = ((pix01 & 0x7fe0) << 6) | (pix01 & 0x1f); | |
| 225 | pix10 = ((pix10 & 0x7fe0) << 6) | (pix10 & 0x1f); | |
| 226 | pix11 = ((pix11 & 0x7fe0) << 6) | (pix11 & 0x1f); | |
| 227 | filtered = rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); | |
| 228 | return (filtered & 0x1f) | ((filtered & 0x1ff800) >> 6); | |
| 229 | } | |
| 230 | ||
| 231 | ||
| 232 | /*------------------------------------------------- | |
| 233 | get_texel_yuy16_nearest - return the | |
| 234 | nearest neighbor texel from a 16bpp YCbCr | |
| 235 | source (pixel is returned as Cr-Cb-Y | |
| 236 | -------------------------------------------------*/ | |
| 237 | ||
| 238 | INLINE UINT32 get_texel_yuy16_nearest(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv) | |
| 239 | { | |
| 240 | const UINT16 *spix = &texbase[(curv >> 16) * texrp + (curu >> 17) * 2]; | |
| 241 | return (spix[(curu >> 16) & 1] >> 8) | ((spix[0] & 0xff) << 8) | ((spix[1] & 0xff) << 16); | |
| 242 | } | |
| 243 | ||
| 244 | ||
| 245 | /*------------------------------------------------- | |
| 246 | get_texel_yuy16_bilinear - return the | |
| 247 | nearest neighbor texel from a 16bpp YCbCr | |
| 248 | source (pixel is returned as Cr-Cb-Y | |
| 249 | -------------------------------------------------*/ | |
| 250 | ||
| 251 | INLINE UINT32 get_texel_yuy16_bilinear(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv) | |
| 252 | { | |
| 253 | rgb_t pix00, pix01, pix10, pix11; | |
| 254 | texbase += (curv >> 16) * texrp + (curu >> 17) * 2; | |
| 255 | if ((curu & 0x10000) == 0) | |
| 256 | { | |
| 257 | rgb_t cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16); | |
| 258 | pix00 = (texbase[0] >> 8) | cbcr; | |
| 259 | pix01 = (texbase[1] >> 8) | cbcr; | |
| 260 | cbcr = ((texbase[texrp + 0] & 0xff) << 8) | ((texbase[texrp + 1] & 0xff) << 16); | |
| 261 | pix10 = (texbase[texrp + 0] >> 8) | cbcr; | |
| 262 | pix11 = (texbase[texrp + 1] >> 8) | cbcr; | |
| 263 | } | |
| 264 | else | |
| 265 | { | |
| 266 | rgb_t cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16); | |
| 267 | pix00 = (texbase[1] >> 8) | cbcr; | |
| 268 | cbcr = ((texbase[2] & 0xff) << 8) | ((texbase[3] & 0xff) << 16); | |
| 269 | pix01 = (texbase[2] >> 8) | cbcr; | |
| 270 | cbcr = ((texbase[texrp + 0] & 0xff) << 8) | ((texbase[texrp + 1] & 0xff) << 16); | |
| 271 | pix10 = (texbase[texrp + 1] >> 8) | cbcr; | |
| 272 | cbcr = ((texbase[texrp + 2] & 0xff) << 8) | ((texbase[texrp + 3] & 0xff) << 16); | |
| 273 | pix11 = (texbase[texrp + 2] >> 8) | cbcr; | |
| 274 | } | |
| 275 | return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); | |
| 276 | } | |
| 277 | ||
| 278 | ||
| 279 | /*------------------------------------------------- | |
| 280 | get_texel_rgb32_nearest - return the | |
| 281 | nearest neighbor texel from a 32bpp RGB source | |
| 282 | -------------------------------------------------*/ | |
| 283 | ||
| 284 | INLINE UINT32 get_texel_rgb32_nearest(const UINT32 *texbase, INT32 texrp, INT32 curu, INT32 curv) | |
| 285 | { | |
| 286 | return texbase[(curv >> 16) * texrp + (curu >> 16)]; | |
| 287 | } | |
| 288 | ||
| 289 | ||
| 290 | /*------------------------------------------------- | |
| 291 | get_texel_rgb32_bilinear - return the | |
| 292 | bilinear filtered texel from a 32bpp RGB | |
| 293 | source | |
| 294 | -------------------------------------------------*/ | |
| 295 | ||
| 296 | INLINE UINT32 get_texel_rgb32_bilinear(const UINT32 *texbase, INT32 texrp, INT32 curu, INT32 curv) | |
| 297 | { | |
| 298 | rgb_t pix00, pix01, pix10, pix11; | |
| 299 | texbase += (curv >> 16) * texrp + (curu >> 16); | |
| 300 | pix00 = texbase[0]; | |
| 301 | pix01 = texbase[1]; | |
| 302 | pix10 = texbase[texrp + 0]; | |
| 303 | pix11 = texbase[texrp + 1]; | |
| 304 | return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); | |
| 305 | } | |
| 306 | ||
| 307 | ||
| 308 | /*------------------------------------------------- | |
| 309 | get_texel_argb32_nearest - return the | |
| 310 | nearest neighbor texel from a 32bpp ARGB | |
| 311 | source | |
| 312 | -------------------------------------------------*/ | |
| 313 | ||
| 314 | INLINE UINT32 get_texel_argb32_nearest(const UINT32 *texbase, INT32 texrp, INT32 curu, INT32 curv) | |
| 315 | { | |
| 316 | return texbase[(curv >> 16) * texrp + (curu >> 16)]; | |
| 317 | } | |
| 318 | ||
| 319 | ||
| 320 | /*------------------------------------------------- | |
| 321 | get_texel_argb32_bilinear - return the | |
| 322 | bilinear filtered texel from a 32bpp ARGB | |
| 323 | source | |
| 324 | -------------------------------------------------*/ | |
| 325 | ||
| 326 | INLINE UINT32 get_texel_argb32_bilinear(const UINT32 *texbase, INT32 texrp, INT32 curu, INT32 curv) | |
| 327 | { | |
| 328 | rgb_t pix00, pix01, pix10, pix11; | |
| 329 | texbase += (curv >> 16) * texrp + (curu >> 16); | |
| 330 | pix00 = texbase[0]; | |
| 331 | pix01 = texbase[1]; | |
| 332 | pix10 = texbase[texrp + 0]; | |
| 333 | pix11 = texbase[texrp + 1]; | |
| 334 | return rgba_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); | |
| 335 | } | |
| 336 | ||
| 337 | ||
| 149 | 338 | #endif |
| 150 | 339 | |
| 151 | 340 | |
| r2844 | r2845 | |
| 194 | 383 | #endif |
| 195 | 384 | #endif |
| 196 | 385 | |
| 386 | /* texel functions */ | |
| 387 | #undef GET_TEXEL | |
| 388 | #if BILINEAR_FILTER | |
| 389 | #define GET_TEXEL(type) get_texel_##type##_##bilinear | |
| 390 | #else | |
| 391 | #define GET_TEXEL(type) get_texel_##type##_##nearest | |
| 392 | #endif | |
| 197 | 393 | |
| 198 | 394 | |
| 395 | ||
| 199 | 396 | /*************************************************************************** |
| 200 | 397 | LINE RASTERIZERS |
| 201 | 398 | ***************************************************************************/ |
| r2844 | r2845 | |
| 528 | 725 | /* loop over cols */ |
| 529 | 726 | for (x = setup->startx; x < endx; x++) |
| 530 | 727 | { |
| 531 | UINT32 pix = pal | |
| 728 | UINT32 pix = GET_TEXEL(pal | |
| 532 | 729 | *dest++ = SOURCE32_TO_DEST(pix); |
| 533 | 730 | curu += dudx; |
| 534 | 731 | curv += dvdx; |
| r2844 | r2845 | |
| 558 | 755 | /* loop over cols */ |
| 559 | 756 | for (x = setup->startx; x < endx; x++) |
| 560 | 757 | { |
| 561 | UINT32 pix = pal | |
| 758 | UINT32 pix = GET_TEXEL(pal | |
| 562 | 759 | UINT32 r = (SOURCE32_R(pix) * sr) >> 8; |
| 563 | 760 | UINT32 g = (SOURCE32_G(pix) * sg) >> 8; |
| 564 | 761 | UINT32 b = (SOURCE32_B(pix) * sb) >> 8; |
| r2844 | r2845 | |
| 594 | 791 | /* loop over cols */ |
| 595 | 792 | for (x = setup->startx; x < endx; x++) |
| 596 | 793 | { |
| 597 | UINT32 pix = pal | |
| 794 | UINT32 pix = GET_TEXEL(pal | |
| 598 | 795 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| 599 | 796 | UINT32 r = (SOURCE32_R(pix) * sr + DEST_R(dpix) * invsa) >> 8; |
| 600 | 797 | UINT32 g = (SOURCE32_G(pix) * sg + DEST_G(dpix) * invsa) >> 8; |
| r2844 | r2845 | |
| 640 | 837 | /* loop over cols */ |
| 641 | 838 | for (x = setup->startx; x < endx; x++) |
| 642 | 839 | { |
| 643 | UINT32 pix = pal | |
| 840 | UINT32 pix = GET_TEXEL(pal | |
| 644 | 841 | if ((pix & 0xffffff) != 0) |
| 645 | 842 | { |
| 646 | 843 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| r2844 | r2845 | |
| 681 | 878 | /* loop over cols */ |
| 682 | 879 | for (x = setup->startx; x < endx; x++) |
| 683 | 880 | { |
| 684 | UINT32 pix = pal | |
| 881 | UINT32 pix = GET_TEXEL(pal | |
| 685 | 882 | if ((pix & 0xffffff) != 0) |
| 686 | 883 | { |
| 687 | 884 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| r2844 | r2845 | |
| 737 | 934 | /* loop over cols */ |
| 738 | 935 | for (x = setup->startx; x < endx; x++) |
| 739 | 936 | { |
| 740 | UINT32 pix = pal | |
| 937 | UINT32 pix = GET_TEXEL(pal | |
| 741 | 938 | UINT32 ta = pix >> 24; |
| 742 | 939 | if (ta != 0) |
| 743 | 940 | { |
| r2844 | r2845 | |
| 780 | 977 | /* loop over cols */ |
| 781 | 978 | for (x = setup->startx; x < endx; x++) |
| 782 | 979 | { |
| 783 | UINT32 pix = pal | |
| 980 | UINT32 pix = GET_TEXEL(pal | |
| 784 | 981 | UINT32 ta = (pix >> 24) * sa; |
| 785 | 982 | if (ta != 0) |
| 786 | 983 | { |
| r2844 | r2845 | |
| 837 | 1034 | /* loop over cols */ |
| 838 | 1035 | for (x = setup->startx; x < endx; x++) |
| 839 | 1036 | { |
| 840 | const UINT16 *spix = &texbase[(curv >> 16) * texrp + (curu >> 17) * 2]; | |
| 841 | UINT32 pix = ycc_to_rgb(spix[(curu >> 16) & 1] >> 8, spix[0], spix[1]); | |
| 1037 | UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv)); | |
| 842 | 1038 | *dest++ = SOURCE32_TO_DEST(pix); |
| 843 | 1039 | curu += dudx; |
| 844 | 1040 | curv += dvdx; |
| r2844 | r2845 | |
| 851 | 1047 | /* loop over cols */ |
| 852 | 1048 | for (x = setup->startx; x < endx; x++) |
| 853 | 1049 | { |
| 854 | const UINT16 *spix = &texbase[(curv >> 16) * texrp + (curu >> 17) * 2]; | |
| 855 | UINT32 pix = ycc_to_rgb(palbase[spix[(curu >> 16) & 1] >> 8], spix[0], spix[1]); | |
| 1050 | UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv)); | |
| 856 | 1051 | *dest++ = SOURCE32_TO_DEST(pix); |
| 857 | 1052 | curu += dudx; |
| 858 | 1053 | curv += dvdx; |
| r2844 | r2845 | |
| 886 | 1081 | /* loop over cols */ |
| 887 | 1082 | for (x = setup->startx; x < endx; x++) |
| 888 | 1083 | { |
| 889 | const UINT16 *spix = &texbase[(curv >> 16) * texrp + (curu >> 17) * 2]; | |
| 890 | UINT32 pix = ycc_to_rgb(spix[(curu >> 16) & 1] >> 8, spix[0], spix[1]); | |
| 1084 | UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv)); | |
| 891 | 1085 | UINT32 r = (SOURCE32_R(pix) * sr) >> 8; |
| 892 | 1086 | UINT32 g = (SOURCE32_G(pix) * sg) >> 8; |
| 893 | 1087 | UINT32 b = (SOURCE32_B(pix) * sb) >> 8; |
| r2844 | r2845 | |
| 904 | 1098 | /* loop over cols */ |
| 905 | 1099 | for (x = setup->startx; x < endx; x++) |
| 906 | 1100 | { |
| 907 | const UINT16 *spix = &texbase[(curv >> 16) * texrp + (curu >> 17) * 2]; | |
| 908 | UINT32 pix = ycc_to_rgb(palbase[spix[(curu >> 16) & 1] >> 8], spix[0], spix[1]); | |
| 1101 | UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv)); | |
| 909 | 1102 | UINT32 r = (SOURCE32_R(pix) * sr) >> 8; |
| 910 | 1103 | UINT32 g = (SOURCE32_G(pix) * sg) >> 8; |
| 911 | 1104 | UINT32 b = (SOURCE32_B(pix) * sb) >> 8; |
| r2844 | r2845 | |
| 945 | 1138 | /* loop over cols */ |
| 946 | 1139 | for (x = setup->startx; x < endx; x++) |
| 947 | 1140 | { |
| 948 | const UINT16 *spix = &texbase[(curv >> 16) * texrp + (curu >> 17) * 2]; | |
| 949 | UINT32 pix = ycc_to_rgb(spix[(curu >> 16) & 1] >> 8, spix[0], spix[1]); | |
| 1141 | UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv)); | |
| 950 | 1142 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| 951 | 1143 | UINT32 r = (SOURCE32_R(pix) * sr + DEST_R(dpix) * invsa) >> 8; |
| 952 | 1144 | UINT32 g = (SOURCE32_G(pix) * sg + DEST_G(dpix) * invsa) >> 8; |
| r2844 | r2845 | |
| 964 | 1156 | /* loop over cols */ |
| 965 | 1157 | for (x = setup->startx; x < endx; x++) |
| 966 | 1158 | { |
| 967 | const UINT16 *spix = &texbase[(curv >> 16) * texrp + (curu >> 17) * 2]; | |
| 968 | UINT32 pix = ycc_to_rgb(palbase[spix[(curu >> 16) & 1] >> 8], spix[0], spix[1]); | |
| 1159 | UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv)); | |
| 969 | 1160 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| 970 | 1161 | UINT32 r = (SOURCE32_R(pix) * sr + DEST_R(dpix) * invsa) >> 8; |
| 971 | 1162 | UINT32 g = (SOURCE32_G(pix) * sg + DEST_G(dpix) * invsa) >> 8; |
| r2844 | r2845 | |
| 1016 | 1207 | /* loop over cols */ |
| 1017 | 1208 | for (x = setup->startx; x < endx; x++) |
| 1018 | 1209 | { |
| 1019 | UINT32 pix = texbase | |
| 1210 | UINT32 pix = GET_TEXEL(rgb15)(texbase, | |
| 1020 | 1211 | *dest++ = SOURCE15_TO_DEST(pix); |
| 1021 | 1212 | curu += dudx; |
| 1022 | 1213 | curv += dvdx; |
| r2844 | r2845 | |
| 1029 | 1220 | /* loop over cols */ |
| 1030 | 1221 | for (x = setup->startx; x < endx; x++) |
| 1031 | 1222 | { |
| 1032 | UINT32 pix = texbase | |
| 1223 | UINT32 pix = GET_TEXEL(rgb15)(texbase, | |
| 1033 | 1224 | UINT32 r = palbase[(pix >> 10) & 0x1f] >> SRCSHIFT_R; |
| 1034 | 1225 | UINT32 g = palbase[(pix >> 5) & 0x1f] >> SRCSHIFT_G; |
| 1035 | 1226 | UINT32 b = palbase[(pix >> 0) & 0x1f] >> SRCSHIFT_B; |
| r2844 | r2845 | |
| 1067 | 1258 | /* loop over cols */ |
| 1068 | 1259 | for (x = setup->startx; x < endx; x++) |
| 1069 | 1260 | { |
| 1070 | UINT32 pix = texbase | |
| 1261 | UINT32 pix = GET_TEXEL(rgb15)(texbase, | |
| 1071 | 1262 | UINT32 r = (SOURCE15_R(pix) * sr) >> 8; |
| 1072 | 1263 | UINT32 g = (SOURCE15_G(pix) * sg) >> 8; |
| 1073 | 1264 | UINT32 b = (SOURCE15_B(pix) * sb) >> 8; |
| r2844 | r2845 | |
| 1084 | 1275 | /* loop over cols */ |
| 1085 | 1276 | for (x = setup->startx; x < endx; x++) |
| 1086 | 1277 | { |
| 1087 | UINT32 pix = texbase | |
| 1278 | UINT32 pix = GET_TEXEL(rgb15)(texbase, | |
| 1088 | 1279 | UINT32 r = (palbase[(pix >> 10) & 0x1f] * sr) >> (8 + SRCSHIFT_R); |
| 1089 | 1280 | UINT32 g = (palbase[(pix >> 5) & 0x1f] * sg) >> (8 + SRCSHIFT_G); |
| 1090 | 1281 | UINT32 b = (palbase[(pix >> 0) & 0x1f] * sb) >> (8 + SRCSHIFT_B); |
| r2844 | r2845 | |
| 1124 | 1315 | /* loop over cols */ |
| 1125 | 1316 | for (x = setup->startx; x < endx; x++) |
| 1126 | 1317 | { |
| 1127 | UINT32 pix = texbase | |
| 1318 | UINT32 pix = GET_TEXEL(rgb15)(texbase, | |
| 1128 | 1319 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| 1129 | 1320 | UINT32 r = (SOURCE15_R(pix) * sr + DEST_R(dpix) * invsa) >> 8; |
| 1130 | 1321 | UINT32 g = (SOURCE15_G(pix) * sg + DEST_G(dpix) * invsa) >> 8; |
| r2844 | r2845 | |
| 1142 | 1333 | /* loop over cols */ |
| 1143 | 1334 | for (x = setup->startx; x < endx; x++) |
| 1144 | 1335 | { |
| 1145 | UINT32 pix = texbase | |
| 1336 | UINT32 pix = GET_TEXEL(rgb15)(texbase, | |
| 1146 | 1337 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| 1147 | 1338 | UINT32 r = ((palbase[(pix >> 10) & 0x1f] >> SRCSHIFT_R) * sr + DEST_R(dpix) * invsa) >> 8; |
| 1148 | 1339 | UINT32 g = ((palbase[(pix >> 5) & 0x1f] >> SRCSHIFT_G) * sg + DEST_G(dpix) * invsa) >> 8; |
| r2844 | r2845 | |
| 1194 | 1385 | /* loop over cols */ |
| 1195 | 1386 | for (x = setup->startx; x < endx; x++) |
| 1196 | 1387 | { |
| 1197 | UINT32 pix = texbase | |
| 1388 | UINT32 pix = GET_TEXEL(rgb32)(texbase, | |
| 1198 | 1389 | *dest++ = SOURCE32_TO_DEST(pix); |
| 1199 | 1390 | curu += dudx; |
| 1200 | 1391 | curv += dvdx; |
| r2844 | r2845 | |
| 1207 | 1398 | /* loop over cols */ |
| 1208 | 1399 | for (x = setup->startx; x < endx; x++) |
| 1209 | 1400 | { |
| 1210 | UINT32 pix = texbase | |
| 1401 | UINT32 pix = GET_TEXEL(rgb32)(texbase, | |
| 1211 | 1402 | UINT32 r = palbase[(pix >> 16) & 0xff] >> SRCSHIFT_R; |
| 1212 | 1403 | UINT32 g = palbase[(pix >> 8) & 0xff] >> SRCSHIFT_G; |
| 1213 | 1404 | UINT32 b = palbase[(pix >> 0) & 0xff] >> SRCSHIFT_B; |
| r2844 | r2845 | |
| 1245 | 1436 | /* loop over cols */ |
| 1246 | 1437 | for (x = setup->startx; x < endx; x++) |
| 1247 | 1438 | { |
| 1248 | UINT32 pix = texbase | |
| 1439 | UINT32 pix = GET_TEXEL(rgb32)(texbase, | |
| 1249 | 1440 | UINT32 r = (SOURCE32_R(pix) * sr) >> 8; |
| 1250 | 1441 | UINT32 g = (SOURCE32_G(pix) * sg) >> 8; |
| 1251 | 1442 | UINT32 b = (SOURCE32_B(pix) * sb) >> 8; |
| r2844 | r2845 | |
| 1262 | 1453 | /* loop over cols */ |
| 1263 | 1454 | for (x = setup->startx; x < endx; x++) |
| 1264 | 1455 | { |
| 1265 | UINT32 pix = texbase | |
| 1456 | UINT32 pix = GET_TEXEL(rgb32)(texbase, | |
| 1266 | 1457 | UINT32 r = (palbase[(pix >> 16) & 0xff] * sr) >> (8 + SRCSHIFT_R); |
| 1267 | 1458 | UINT32 g = (palbase[(pix >> 8) & 0xff] * sg) >> (8 + SRCSHIFT_G); |
| 1268 | 1459 | UINT32 b = (palbase[(pix >> 0) & 0xff] * sb) >> (8 + SRCSHIFT_B); |
| r2844 | r2845 | |
| 1302 | 1493 | /* loop over cols */ |
| 1303 | 1494 | for (x = setup->startx; x < endx; x++) |
| 1304 | 1495 | { |
| 1305 | UINT32 pix = texbase | |
| 1496 | UINT32 pix = GET_TEXEL(rgb32)(texbase, | |
| 1306 | 1497 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| 1307 | 1498 | UINT32 r = (SOURCE32_R(pix) * sr + DEST_R(dpix) * invsa) >> 8; |
| 1308 | 1499 | UINT32 g = (SOURCE32_G(pix) * sg + DEST_G(dpix) * invsa) >> 8; |
| r2844 | r2845 | |
| 1320 | 1511 | /* loop over cols */ |
| 1321 | 1512 | for (x = setup->startx; x < endx; x++) |
| 1322 | 1513 | { |
| 1323 | UINT32 pix = texbase | |
| 1514 | UINT32 pix = GET_TEXEL(rgb32)(texbase, | |
| 1324 | 1515 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| 1325 | 1516 | UINT32 r = ((palbase[(pix >> 16) & 0xff] >> SRCSHIFT_R) * sr + DEST_R(dpix) * invsa) >> 8; |
| 1326 | 1517 | UINT32 g = ((palbase[(pix >> 8) & 0xff] >> SRCSHIFT_G) * sg + DEST_G(dpix) * invsa) >> 8; |
| r2844 | r2845 | |
| 1372 | 1563 | /* loop over cols */ |
| 1373 | 1564 | for (x = setup->startx; x < endx; x++) |
| 1374 | 1565 | { |
| 1375 | UINT32 pix = texbase | |
| 1566 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1376 | 1567 | UINT32 ta = pix >> 24; |
| 1377 | 1568 | if (ta != 0) |
| 1378 | 1569 | { |
| r2844 | r2845 | |
| 1396 | 1587 | /* loop over cols */ |
| 1397 | 1588 | for (x = setup->startx; x < endx; x++) |
| 1398 | 1589 | { |
| 1399 | UINT32 pix = texbase | |
| 1590 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1400 | 1591 | UINT32 ta = pix >> 24; |
| 1401 | 1592 | if (ta != 0) |
| 1402 | 1593 | { |
| r2844 | r2845 | |
| 1443 | 1634 | /* loop over cols */ |
| 1444 | 1635 | for (x = setup->startx; x < endx; x++) |
| 1445 | 1636 | { |
| 1446 | UINT32 pix = texbase | |
| 1637 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1447 | 1638 | UINT32 ta = (pix >> 24) * sa; |
| 1448 | 1639 | if (ta != 0) |
| 1449 | 1640 | { |
| r2844 | r2845 | |
| 1468 | 1659 | /* loop over cols */ |
| 1469 | 1660 | for (x = setup->startx; x < endx; x++) |
| 1470 | 1661 | { |
| 1471 | UINT32 pix = texbase | |
| 1662 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1472 | 1663 | UINT32 ta = (pix >> 24) * sa; |
| 1473 | 1664 | if (ta != 0) |
| 1474 | 1665 | { |
| r2844 | r2845 | |
| 1525 | 1716 | /* loop over cols */ |
| 1526 | 1717 | for (x = setup->startx; x < endx; x++) |
| 1527 | 1718 | { |
| 1528 | UINT32 pix = texbase | |
| 1719 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1529 | 1720 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| 1530 | 1721 | UINT32 r = (SOURCE32_R(pix) * DEST_R(dpix)) >> (8 - SRCSHIFT_R); |
| 1531 | 1722 | UINT32 g = (SOURCE32_G(pix) * DEST_G(dpix)) >> (8 - SRCSHIFT_G); |
| r2844 | r2845 | |
| 1541 | 1732 | /* loop over cols */ |
| 1542 | 1733 | for (x = setup->startx; x < endx; x++) |
| 1543 | 1734 | { |
| 1544 | UINT32 pix = texbase | |
| 1735 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1545 | 1736 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| 1546 | 1737 | UINT32 r = (palbase[(pix >> 16) & 0xff] * DEST_R(dpix)) >> 8; |
| 1547 | 1738 | UINT32 g = (palbase[(pix >> 8) & 0xff] * DEST_G(dpix)) >> 8; |
| r2844 | r2845 | |
| 1580 | 1771 | /* loop over cols */ |
| 1581 | 1772 | for (x = setup->startx; x < endx; x++) |
| 1582 | 1773 | { |
| 1583 | UINT32 pix = texbase | |
| 1774 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1584 | 1775 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| 1585 | 1776 | UINT32 r = (SOURCE32_R(pix) * sr * DEST_R(dpix)) >> (16 - SRCSHIFT_R); |
| 1586 | 1777 | UINT32 g = (SOURCE32_G(pix) * sg * DEST_G(dpix)) >> (16 - SRCSHIFT_G); |
| r2844 | r2845 | |
| 1596 | 1787 | /* loop over cols */ |
| 1597 | 1788 | for (x = setup->startx; x < endx; x++) |
| 1598 | 1789 | { |
| 1599 | UINT32 pix = texbase | |
| 1790 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1600 | 1791 | UINT32 dpix = NO_DEST_READ ? 0 : *dest; |
| 1601 | 1792 | UINT32 r = (palbase[(pix >> 16) & 0xff] * sr * DEST_R(dpix)) >> 16; |
| 1602 | 1793 | UINT32 g = (palbase[(pix >> 8) & 0xff] * sg * DEST_G(dpix)) >> 16; |
| r2844 | r2845 | |
| 1647 | 1838 | /* loop over cols */ |
| 1648 | 1839 | for (x = setup->startx; x < endx; x++) |
| 1649 | 1840 | { |
| 1650 | UINT32 pix = texbase | |
| 1841 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1651 | 1842 | UINT32 ta = pix >> 24; |
| 1652 | 1843 | if (ta != 0) |
| 1653 | 1844 | { |
| r2844 | r2845 | |
| 1672 | 1863 | /* loop over cols */ |
| 1673 | 1864 | for (x = setup->startx; x < endx; x++) |
| 1674 | 1865 | { |
| 1675 | UINT32 pix = texbase | |
| 1866 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1676 | 1867 | UINT32 ta = pix >> 24; |
| 1677 | 1868 | if (ta != 0) |
| 1678 | 1869 | { |
| r2844 | r2845 | |
| 1720 | 1911 | /* loop over cols */ |
| 1721 | 1912 | for (x = setup->startx; x < endx; x++) |
| 1722 | 1913 | { |
| 1723 | UINT32 pix = texbase | |
| 1914 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1724 | 1915 | UINT32 ta = (pix >> 24) * sa; |
| 1725 | 1916 | if (ta != 0) |
| 1726 | 1917 | { |
| r2844 | r2845 | |
| 1745 | 1936 | /* loop over cols */ |
| 1746 | 1937 | for (x = setup->startx; x < endx; x++) |
| 1747 | 1938 | { |
| 1748 | UINT32 pix = texbase | |
| 1939 | UINT32 pix = GET_TEXEL(argb32)(texbase, | |
| 1749 | 1940 | UINT32 ta = (pix >> 24) * sa; |
| 1750 | 1941 | if (ta != 0) |
| 1751 | 1942 | { |
| r2844 | r2845 | |
| 1817 | 2008 | setup.startu = round_nearest(65536.0f * (float)prim->texture.width * prim->texcoords.tl.u); |
| 1818 | 2009 | setup.startv = round_nearest(65536.0f * (float)prim->texture.height * prim->texcoords.tl.v); |
| 1819 | 2010 | |
| 1820 | /* advance U/V to the middle of the first pixel */ | |
| 1821 | setup.startu += (setup.dudx + setup.dudy) / 2; | |
| 1822 | setup.startv += (setup.dvdx + setup.dvdy) / 2; | |
| 2011 | /* advance U/V to the middle of the first texel */ | |
| 2012 | if (!BILINEAR_FILTER) | |
| 2013 | { | |
| 2014 | setup.startu += (setup.dudx + setup.dudy) / 2; | |
| 2015 | setup.startv += (setup.dvdx + setup.dvdy) / 2; | |
| 2016 | } | |
| 1823 | 2017 | |
| 1824 | 2018 | /* render based on the texture coordinates */ |
| 1825 | 2019 | switch (prim->flags & (PRIMFLAG_TEXFORMAT_MASK | PRIMFLAG_BLENDMODE_MASK)) |
| r2844 | r2845 | |
|---|---|---|
| 190 | 190 | void alpha8301_get_info(UINT32 state, cpuinfo *info); |
| 191 | 191 | void cdp1802_get_info(UINT32 state, cpuinfo *info); |
| 192 | 192 | void cop420_get_info(UINT32 state, cpuinfo *info); |
| 193 | void cop421_get_info(UINT32 state, cpuinfo *info); | |
| 193 | 194 | void cop410_get_info(UINT32 state, cpuinfo *info); |
| 194 | 195 | void cop411_get_info(UINT32 state, cpuinfo *info); |
| 195 | 196 | void tmp90840_get_info(UINT32 state, cpuinfo *info); |
| r2844 | r2845 | |
| 766 | 767 | #if (HAS_COP420) |
| 767 | 768 | { CPU_COP420, cop420_get_info }, |
| 768 | 769 | #endif |
| 770 | #if (HAS_COP421) | |
| 771 | { CPU_COP421, cop421_get_info }, | |
| 772 | #endif | |
| 769 | 773 | #if (HAS_COP410) |
| 770 | 774 | { CPU_COP410, cop410_get_info }, |
| 771 | 775 | #endif |
| r2844 | r2845 | |
|---|---|---|
| 218 | 218 | CPU_ALPHA8301, |
| 219 | 219 | CPU_CDP1802, |
| 220 | 220 | CPU_COP420, |
| 221 | CPU_COP421, | |
| 221 | 222 | CPU_COP410, |
| 222 | 223 | CPU_COP411, |
| 223 | 224 | CPU_TMP90840, |
| r2844 | r2845 | |
|---|---|---|
| 30 | 30 | the function is similar than update with 0x80 set to 1 |
| 31 | 31 | |
| 32 | 32 | 23/04/2007 : Lord Nightmare |
| 33 | Major update, implement all three different noise generation algorithms plus | |
| 34 | the game gear stereo output, and a set_variant call to discern among them. | |
| 33 | Major update, implement all three different noise generation algorithms and a | |
| 34 | set_variant call to discern among them. | |
| 35 | ||
| 36 | TODO: Implement a function for setting stereo regs for the game gear. | |
| 37 | Requires either making the entire core stereo and forcing mono out for all | |
| 38 | chips except gamegear, or somehow making the core support both output typesf. | |
| 35 | 39 | ***************************************************************************/ |
| 36 | 40 | |
| 37 | 41 | #include "sndintrf.h" |
| r2844 | r2845 | |
|---|---|---|
| 25 | 25 | WRITE16_HANDLER( SCSP_MidiIn ); |
| 26 | 26 | READ16_HANDLER( SCSP_MidiOutR ); |
| 27 | 27 | |
| 28 | extern UINT32* stv_scu; | |
| 29 | ||
| 28 | 30 | #endif |
| r2844 | r2845 | |
|---|---|---|
| 7 | 7 | int banks[4]; /* start of each ROM bank */ |
| 8 | 8 | }; |
| 9 | 9 | |
| 10 | extern UINT16 *gaelco_sndregs; | |
| 11 | ||
| 10 | 12 | WRITE16_HANDLER( gaelcosnd_w ); |
| 11 | 13 | READ16_HANDLER( gaelcosnd_r ); |
| 12 | 14 |
| r2844 | r2845 | |
|---|---|---|
| 8 | 8 | int stereo; /* set to 1 to indicate stereo (e.g., System 1) */ |
| 9 | 9 | }; |
| 10 | 10 | |
| 11 | WRITE8_HANDLER( snkwave_w ); | |
| 12 | ||
| 11 | 13 | WRITE8_HANDLER( pacman_sound_enable_w ); |
| 12 | 14 | WRITE8_HANDLER( pacman_sound_w ); |
| 13 | 15 |
| r2844 | r2845 | |
|---|---|---|
| 17 | 17 | US patent 4,335,277 describes the complete 52xx chip |
| 18 | 18 | Special Thanks to Larry Brantingham for answering questions regarding the chip details |
| 19 | 19 | |
| 20 | TMS5200/TMS5220/TMS5220C: | |
| 21 | ||
| 22 | +-----------------+ | |
| 23 | D7(d0) | 1 28 | /RS | |
| 24 | ADD1 | 2 27 | /WS | |
| 25 | ROMCLK | 3 26 | D6(d1) | |
| 26 | VDD(-5) | 4 25 | ADD2 | |
| 27 | VSS(+5) | 5 24 | D5(d2) | |
| 28 | OSC | 6 23 | ADD4 | |
| 29 | T11 | 7 22 | D4(d3) | |
| 30 | SPKR | 8 21 | ADD8/DATA | |
| 31 | I/O | 9 20 | TEST | |
| 32 | PROMOUT | 10 19 | D3(d4) | |
| 33 | VREF(GND)| 11 18 | /READY | |
| 34 | D2(d5) | 12 17 | /INT | |
| 35 | D1(d6) | 13 16 | M1 | |
| 36 | D0(d7) | 14 15 | M0 | |
| 37 | +-----------------+ | |
| 38 | Note the standard naming for d* data bits with 7 as MSB and 0 as LSB is in lowercase. | |
| 39 | TI's naming has D7 as LSB and D0 as MSB and is in uppercase | |
| 40 | ||
| 20 | 41 | ***********************************************************************************************/ |
| 21 | 42 | |
| 22 | 43 | #include "sndintrf.h" |
| r2844 | r2845 | |
|---|---|---|
| 68 | 68 | #define DEFAULT_MESSAGE_TIME (50) |
| 69 | 69 | #define VARIABLE_MAX_ARRAY (0x0F) /* NOTE : Destination in Move code can only accept variable[0]-[3] only */ |
| 70 | 70 | #define CHEAT_RETURN_VALUE (0xFF) |
| 71 | #define DEFAULT_ADDRESS_LENGTH (8) | |
| 72 | 71 | #define SAFE_SEARCH_REGION_RANGE (0xFFFF) |
| 73 | 72 | |
| 74 | 73 | /********** BIT FIELD **********/ |
| r2844 | r2845 | |
| 228 | 227 | CUSTOM_CODE_UNUSED_1, |
| 229 | 228 | CUSTOM_CODE_UNUSED_2, |
| 230 | 229 | CUSTOM_CODE_UNUSED_3, |
| 231 | CUSTOM_CODE_ACTIVATION_KEY_1, | |
| 232 | CUSTOM_CODE_ACTIVATION_KEY_2, | |
| 230 | CUSTOM_CODE_ACTIVATION_KEY, | |
| 233 | 231 | CUSTOM_CODE_PRE_ENABLE, |
| 234 | 232 | CUSTOM_CODE_OVER_CLOCK, |
| 235 | 233 | CUSTOM_CODE_REFRESH_RATE }; |
| r2844 | r2845 | |
| 317 | 315 | /* set for one shot cheats after the operation is performed */ |
| 318 | 316 | kActionFlag_OperationDone = 1 << 3, |
| 319 | 317 | |
| 318 | /* set if the code is memory writing type (Write, IWrite, RWrite, CWrite, CBit, PDWWrite) */ | |
| 319 | kActionFlag_MemoryWrite = 1 << 4, | |
| 320 | ||
| 320 | 321 | /* set if the extend data field is being used by index adress reading (IWrite, Move) */ |
| 321 | kActionFlag_IndexAddress = 1 << | |
| 322 | kActionFlag_IndexAddress = 1 << 5, | |
| 322 | 323 | |
| 323 | 324 | /* set if the code uses limited mask which divids data field to 16-bit data and 16-bit mask (IWrite, CBit) */ |
| 324 | kActionFlag_LimitedMask = 1 << | |
| 325 | kActionFlag_LimitedMask = 1 << 6, | |
| 325 | 326 | |
| 326 | 327 | /* set if the code needs to check the condition (CWrite, CBit, Branch, Popup) */ |
| 327 | kActionFlag_CheckCondition = 1 << | |
| 328 | kActionFlag_CheckCondition = 1 << 7, | |
| 328 | 329 | |
| 329 | 330 | /* set if the code needs to repeat writing (RWrite) */ |
| 330 | kActionFlag_Repeat = 1 << | |
| 331 | kActionFlag_Repeat = 1 << 8, | |
| 331 | 332 | |
| 332 | 333 | /* set if the extendData field is being used by 2nd data (PDWWrite) */ |
| 333 | kActionFlag_PDWWrite = 1 << | |
| 334 | kActionFlag_PDWWrite = 1 << 9, | |
| 334 | 335 | |
| 335 | 336 | /* set if the lastValue field contains valid data and can be restored if needed */ |
| 336 | kActionFlag_LastValueGood = 1 << | |
| 337 | kActionFlag_LastValueGood = 1 << 10, | |
| 337 | 338 | |
| 338 | 339 | /* set after value changes from prefill value */ |
| 339 | kActionFlag_PrefillDone = 1 << 1 | |
| 340 | kActionFlag_PrefillDone = 1 << 11, | |
| 340 | 341 | |
| 341 | 342 | /* set after prefill value written */ |
| 342 | kActionFlag_PrefillWritten = 1 << 1 | |
| 343 | kActionFlag_PrefillWritten = 1 << 12, | |
| 343 | 344 | |
| 344 | 345 | /* set if the code is a label for label-selection code */ |
| 345 | kActionFlag_IsLabel = 1 << 1 | |
| 346 | kActionFlag_IsLabel = 1 << 13, | |
| 346 | 347 | |
| 347 | 348 | /* set when read/write a data after 1st read/write and clear after 2nd read/write (PDWWrite) */ |
| 348 | kActionFlag_IsFirst = 1 << 1 | |
| 349 | kActionFlag_IsFirst = 1 << 14, | |
| 349 | 350 | |
| 350 | 351 | /* masks */ |
| 351 | kActionFlag_StateMask = kActionFlag_OperationDone | /* used in | |
| 352 | kActionFlag_StateMask = kActionFlag_OperationDone | /* used in reset_action() to clear specified flags */ | |
| 352 | 353 | kActionFlag_LastValueGood | |
| 353 | 354 | kActionFlag_PrefillDone | |
| 354 | 355 | kActionFlag_PrefillWritten, |
| r2844 | r2845 | |
| 403 | 404 | |
| 404 | 405 | /* true if the cheat has been edited or is a new cheat |
| 405 | 406 | checked at auto-save then save the code if true */ |
| 407 | ||
| 406 | 408 | kCheatFlag_Dirty = 1 << 14, |
| 407 | 409 | |
| 408 | 410 | /* masks */ |
| 409 | kCheatFlag_StateMask = kCheatFlag_Active, // used in | |
| 411 | kCheatFlag_StateMask = kCheatFlag_Active, // used in reset_action() and deactivate_cheat() to clear specified flag | |
| 410 | 412 | kCheatFlag_InfoMask = kCheatFlag_OneShot | // used in update_cheat_info() to detect specified flags |
| 411 | 413 | kCheatFlag_Null | |
| 412 | 414 | kCheatFlag_ExtendComment | |
| r2844 | r2845 | |
| 537 | 539 | enum /* disposition for resizing a list */ |
| 538 | 540 | { |
| 539 | 541 | REQUEST_DISPOSE = 0, |
| 540 | NO_DISPOSE | |
| 542 | NO_DISPOSE | |
| 541 | 543 | }; |
| 542 | 544 | |
| 543 | enum / | |
| 545 | enum /* | |
| 544 | 546 | { |
| 545 | kLoadFlag_CheatOption = 1, | |
| 546 | kLoadFlag_CheatCode = 1 << 1, | |
| 547 | kLoadFlag_UserRegion = 1 << 2 | |
| 547 | DATABASE_LOAD = 0, | |
| 548 | DATABASE_SAVE | |
| 548 | 549 | }; |
| 549 | 550 | |
| 550 | enum / | |
| 551 | enum /* d | |
| 551 | 552 | { |
| 552 | kCheatMessage_None = 0, | |
| 553 | kCheatMessage_ReloadCheatOption, | |
| 554 | kCheatMessage_ReloadCheatCode, | |
| 555 | kCheatMessage_ReloadUserRegion, | |
| 556 | kCheatMessage_FailedToLoadDatabase, | |
| 557 | kCheatMessage_CheatFound, | |
| 558 | kCheatMessage_1CheatFound, | |
| 559 | kCheatMessage_SucceededToSave, | |
| 560 | kCheatMessage_FailedToSave, | |
| 561 | kCheatMessage_AllCheatSaved, | |
| 562 | kCheatMessage_ActivationKeySaved, | |
| 563 | kCheatMessage_NoActivationKey, | |
| 564 | kCheatMessage_PreEnableSaved, | |
| 565 | kCheatMessage_SucceededToAdd, | |
| 566 | kCheatMessage_FailedToAdd, | |
| 567 | kCheatMessage_SucceededToDelete, | |
| 568 | kCheatMessage_FailedToDelete, | |
| 569 | kCheatMessage_NoSearchRegion, | |
| 570 | kCheatMessage_RestoreValue, | |
| 571 | kCheatMessage_NoOldValue, | |
| 572 | kCheatMessage_InitializeMemory, | |
| 573 | kCheatMessage_InvalidatedRegion, | |
| 574 | kCheatMessage_FailedToAllocate, | |
| 575 | kCheatMessage_WrongCode, | |
| 553 | LOAD_CHEAT_OPTION = 1, | |
| 554 | LOAD_CHEAT_CODE = 1 << 1, | |
| 555 | LOAD_USER_REGION = 1 << 2 | |
| 556 | }; | |
| 576 | 557 | |
| 577 | kCheatMessage_Max | |
| 558 | enum /* message type */ | |
| 559 | { | |
| 560 | CHEAT_MESSAGE_NONE = 0, /* this message should be unused */ | |
| 561 | CHEAT_MESSAGE_RELOAD_CHEAT_OPTION, | |
| 562 | CHEAT_MESSAGE_RELOAD_CHEAT_CODE, | |
| 563 | CHEAT_MESSAGE_RELOAD_USER_REGION, | |
| 564 | CHEAT_MESSAGE_FAILED_TO_LOAD_DATABASE, | |
| 565 | CHEAT_MESSAGE_CHEAT_FOUND, | |
| 566 | CHEAT_MESSAGE_ONE_CHEAT_FOUND, | |
| 567 | CHEAT_MESSAGE_SUCCEEDED_TO_SAVE, | |
| 568 | CHEAT_MESSAGE_FAILED_TO_SAVE, | |
| 569 | CHEAT_MESSAGE_NO_SUPPORTED_OLD_FORMAT, | |
| 570 | CHEAT_MESSAGE_ALL_CHEATS_SAVED, | |
| 571 | CHEAT_MESSAGE_ACTIVATION_KEY_SAVED, | |
| 572 | CHEAT_MESSAGE_NO_ACTIVATION_KEY, | |
| 573 | CHEAT_MESSAGE_PRE_ENABLE_SAVED, | |
| 574 | CHEAT_MESSAGE_SUCCEEDED_TO_ADD, | |
| 575 | CHEAT_MESSAGE_FAILED_TO_ADD, | |
| 576 | CHEAT_MESSAGE_SUCCEEDED_TO_DELETE, | |
| 577 | CHEAT_MESSAGE_FAILED_TO_DELETE, | |
| 578 | CHEAT_MESSAGE_NO_SEARCH_REGION, | |
| 579 | CHEAT_MESSAGE_RESTORE_VALUE, | |
| 580 | CHEAT_MESSAGE_NO_OLD_VALUE, | |
| 581 | CHEAT_MESSAGE_INITIALIZE_MEMORY, | |
| 582 | CHEAT_MESSAGE_INVALIDATE_REGION, | |
| 583 | CHEAT_MESSAGE_FAILED_TO_ALLOCATE, | |
| 584 | CHEAT_MESSAGE_WRONG_CODE, | |
| 585 | ||
| 586 | CHEAT_MESSAGE_MAX | |
| 578 | 587 | }; |
| 579 | 588 | |
| 580 | 589 | enum{ // error flags |
| r2844 | r2845 | |
| 644 | 653 | INT32 action_list_length; /* total codes of cheat action. NOTE : minimum length is 1 and 0 is ERROR */ |
| 645 | 654 | cheat_action *action_list; /* pointer to cheat action */ |
| 646 | 655 | |
| 647 | int activation_key1; /* activation key index for 1st key */ | |
| 648 | int activation_key2; /* activation key index for 2nd key */ | |
| 656 | int activation_key_1; /* activation key index for 1st key */ | |
| 657 | int activation_key_2; /* activation key index for 2nd key */ | |
| 649 | 658 | |
| 650 | 659 | int selection; /* for label-select to set selected label number */ |
| 651 | 660 | int label_index_length; /* total tables of index table. NOTE : minimum length is 1 and 0 is ERROR */ |
| r2844 | r2845 | |
| 693 | 702 | |
| 694 | 703 | UINT8 flags; /* internal flags */ |
| 695 | 704 | |
| 696 | UINT8 **cached_pointer; /* pointer to e | |
| 705 | UINT8 **cached_pointer; /* pointer to re | |
| 697 | 706 | const address_map_entry |
| 698 | *write_handler; /* pointer | |
| 707 | *write_handler; /* pointer | |
| 699 | 708 | |
| 700 | 709 | UINT8 *first; /* first value in searching */ |
| 701 | 710 | UINT8 *last; /* current value in searching */ |
| r2844 | r2845 | |
| 705 | 714 | UINT8 *backup_last; /* previous value in searching */ |
| 706 | 715 | UINT8 *backup_status; /* flag of backup */ |
| 707 | 716 | |
| 708 | char name[64]; /* name of this region | |
| 717 | char name[64]; /* name of this region | |
| 709 | 718 | |
| 710 | 719 | UINT32 num_results; /* total results */ |
| 711 | 720 | UINT32 old_num_results; /* previous total results */ |
| r2844 | r2845 | |
| 874 | 883 | static cpu_region_info cpu_info_list[MAX_CPU]; |
| 875 | 884 | static cpu_region_info region_info_list[REGION_LIST_LENGTH]; |
| 876 | 885 | |
| 877 | static int found_database = 0; | |
| 878 | static int cheatsDisabled = 0; | |
| 879 | static int watchesDisabled = 0; | |
| 886 | static int found_database; | |
| 887 | static int cheats_disabled; | |
| 888 | static int watches_disabled; | |
| 880 | 889 | |
| 881 | 890 | static int fullMenuPageHeight; |
| 882 | 891 | static int visible_items; |
| r2844 | r2845 | |
| 894 | 903 | static INT8 stack_index; |
| 895 | 904 | static cheat_menu_stack menu_stack[CHEAT_MENU_DEPTH]; |
| 896 | 905 | |
| 897 | static int cheat | |
| 906 | static int cheat_variable[VARIABLE_MAX_ARRAY] = { 0 }; | |
| 898 | 907 | |
| 899 | 908 | static UINT32 cheat_options; |
| 900 | 909 | static UINT32 driverSpecifiedFlag; |
| r2844 | r2845 | |
| 1062 | 1071 | |
| 1063 | 1072 | static const char *const kRegionNames[] = { |
| 1064 | 1073 | "INVALID", |
| 1065 | "CPU1", "CPU2", "CPU3", "CPU4", "CPU5", "CPU6", "CPU7", "CPU8", // 01-08 [01-08] : CPU | |
| 1066 | "GFX1", "GFX2", "GFX3", "GFX4", "GFX5", "GFX6", "GFX7", "GFX8", // 09-16 [08-10] : GFX | |
| 1067 | "PROMS", // 17 [11] : PROMS | |
| 1068 | "SOUND1", "SOUND2", "SOUND3", "SOUND4", "SOUND5", "SOUND6", "SOUND7", "SOUND8", // 18-25 [12-19] : SOUND | |
| 1069 | "USER1", "USER2", "USER3", "USER4", "USER5", "USER6", "USER7", "USER8", // 26-45 [1A-2D] : USER | |
| 1074 | "CPU1", "CPU2", "CPU3", "CPU4", "CPU5", "CPU6", "CPU7", "CPU8", /* 01-08 [01-08] : CPU */ | |
| 1075 | "GFX1", "GFX2", "GFX3", "GFX4", "GFX5", "GFX6", "GFX7", "GFX8", /* 09-16 [08-10] : GFX */ | |
| 1076 | "PROMS", /* 17 [11] : PROMS */ | |
| 1077 | "SOUND1", "SOUND2", "SOUND3", "SOUND4", "SOUND5", "SOUND6", "SOUND7", "SOUND8", /* 18-25 [12-19] : SOUND */ | |
| 1078 | "USER1", "USER2", "USER3", "USER4", "USER5", "USER6", "USER7", "USER8", /* 26-45 [1A-2D] : USER */ | |
| 1070 | 1079 | /* USER9 - PLDS are undefined in old format */ |
| 1071 | 1080 | "USER9", "USER10", "USER11", "USER12", "USER13", "USER14", "USER15", "USER16", |
| 1072 | 1081 | "USER17", "USER18", "USER19", "USER20", |
| 1073 | "DISKS", // 46 [2E] : DISKS | |
| 1074 | "PLDS" }; // 47 [2F] : PLDS | |
| 1082 | "DISKS", /* 46 [2E] : DISKS */ | |
| 1083 | "PLDS" }; /* 47 [2F] : PLDS */ | |
| 1075 | 1084 | |
| 1076 | 1085 | static const char *const kNumbersTable[] = { |
| 1077 | 1086 | "0", "1", "2", "3", "4", "5", "6", "7", |
| r2844 | r2845 | |
| 1102 | 1111 | "ASCII" |
| 1103 | 1112 | }; |
| 1104 | 1113 | |
| 1114 | static const char *const CHEAT_MESSAGE_TABLE[] = | |
| 1115 | { | |
| 1116 | "INVALID MESSAGE!", /* this message should be unused */ | |
| 1117 | "cheat option reloaded", /* RELOAD_CHEAT_OPTION */ | |
| 1118 | "cheat code reloaded", /* RELOAD_CHEAT_CODE */ | |
| 1119 | "user defined search region reloaded", /* RELOAD_USER_REGION */ | |
| 1120 | "failed to load database!", /* FAILED_TO_LOAD_DATABASE */ | |
| 1121 | "cheats found", /* CHEAT_FOUND */ | |
| 1122 | "1 result found, added to list", /* ONE_CHEAT_FOUND */ | |
| 1123 | "succeeded to save", /* SUCCEEDED_TO_SAVE */ | |
| 1124 | "failed to save!", /* FAILED_TO_SAVE */ | |
| 1125 | "unsupported old/older format!", /* NO_SUPPORTED_OLD_FORMAT */ | |
| 1126 | "cheats saved", /* ALL_CHEATS_SAVED */ | |
| 1127 | "activation key saved", /* ACTIVATION_KEY_SAVED */ | |
| 1128 | "no activation key!", /* NO_ACTIVATION_KEY */ | |
| 1129 | "pre-enable saved", /* PRE_ENABLE_SAVED */ | |
| 1130 | "succeeded to add", /* SUCCEEDED_TO_ADD */ | |
| 1131 | "failed to add!", /* FAILED_TO_ADD */ | |
| 1132 | "succeeded to delete", /* SUCCEEDED_TO_DELETE */ | |
| 1133 | "failed to delete!", /* FAILED_TO_DELETE */ | |
| 1134 | "no search region!", /* NO_SEARCH_REGION */ | |
| 1135 | "values restored", /* RESTORE_VALUE */ | |
| 1136 | "there are no old values!", /* NO_OLD_VALUE */ | |
| 1137 | "saved all memory regions", /* INITIALIZE_MEMOY */ | |
| 1138 | "region invalidated remains results are", /* INVALIDATE_REGION */ | |
| 1139 | "failed to allocate memory!", /* FAILED_TO_ALLOCATE */ | |
| 1140 | "found wrong code!" /* WRONG_CODE */ | |
| 1141 | }; | |
| 1142 | ||
| 1105 | 1143 | /*************************************************************************** |
| 1106 | 1144 | FUNCTION PROTOTYPES |
| 1107 | 1145 | ***************************************************************************/ |
| r2844 | r2845 | |
| 1181 | 1219 | static int select_option_menu(running_machine *machine, cheat_menu_stack *menu); |
| 1182 | 1220 | static int select_search_menu(running_machine *machine, cheat_menu_stack *menu); |
| 1183 | 1221 | |
| 1222 | static int command_cheat_menu(running_machine *machine, cheat_menu_stack *menu); | |
| 1223 | ||
| 1184 | 1224 | #ifdef MAME_DEBUG |
| 1185 | 1225 | static int check_activation_key_code_menu(running_machine *machine, cheat_menu_stack *menu); |
| 1186 | 1226 | static int view_cpu_region_info_list_menu(running_machine *machine, cheat_menu_stack *menu); |
| r2844 | r2845 | |
| 1249 | 1289 | static void build_search_regions(running_machine *machine, search_info *info); |
| 1250 | 1290 | |
| 1251 | 1291 | /********** LOADER **********/ |
| 1252 | static int | |
| 1292 | static int convert_older_code(int code, int cpu, int * | |
| 1253 | 1293 | static int convert_to_new_code(cheat_action *action); |
| 1254 | static void handle_local_command_cheat(running_machine *machine, int cpu, int type, int address, int data, UINT8 format); | |
| 1294 | static void handle_local_command_cheat(running_machine *machine, int cpu, int type, int address, int data, int extend_data, UINT8 format); | |
| 1255 | 1295 | |
| 1296 | static UINT8 open_cheat_database(mame_file **the_file, char *file_name, UINT8 flag); | |
| 1297 | ||
| 1256 | 1298 | static void load_cheat_option(char *file_name); |
| 1257 | 1299 | static void load_cheat_code(running_machine *machine, char *file_name); |
| 1258 | 1300 | static void load_user_defined_search_region(running_machine *machine, char *file_name); |
| r2844 | r2845 | |
| 1262 | 1304 | static void dispose_cheat_database(void); |
| 1263 | 1305 | |
| 1264 | 1306 | /********** SAVER **********/ |
| 1265 | static void SaveCheatCode(running_machine *machine, cheat_entry *entry); | |
| 1266 | static void SaveActivationKey(running_machine *machine, cheat_entry *entry, int entryIndex); | |
| 1267 | static void SavePreEnable(running_machine *machine, cheat_entry *entry, int entryIndex); | |
| 1268 | static void Savecheat_options(void); | |
| 1269 | static void SaveDescription(running_machine *machine); | |
| 1270 | static void DoAutoSaveCheats(running_machine *machine); | |
| 1307 | static void save_cheat_code(running_machine *machine, cheat_entry *entry); | |
| 1308 | static void save_activation_key(running_machine *machine, cheat_entry *entry, int entryIndex); | |
| 1309 | static void save_pre_enable(running_machine *machine, cheat_entry *entry, int entry_index); | |
| 1310 | static void save_cheat_options(void); | |
| 1311 | static void save_description(running_machine *machine); | |
| 1312 | static void save_raw_code(running_machine *machine); | |
| 1313 | static void do_auto_save_cheats(running_machine *machine); | |
| 1271 | 1314 | |
| 1272 | 1315 | /********** CODE ADDITION **********/ |
| 1273 | static void AddCheatFromResult(search_info *search, search_region *region, UINT32 address); | |
| 1274 | static void AddCheatFromFirstResult(search_info *search); | |
| 1275 | static void AddWatchFromResult(search_info *search, search_region *region, UINT32 address); | |
| 1316 | static void add_cheat_from_result(search_info *search, search_region *region, UINT32 address); | |
| 1317 | static void add_cheat_from_first_result(search_info *search); | |
| 1318 | static void add_watch_from_result(search_info *search, search_region *region, UINT32 address); | |
| 1276 | 1319 | |
| 1277 | 1320 | /********** SEARCH **********/ |
| 1278 | 1321 | static UINT32 search_sign_extend(search_info *search, UINT32 value); |
| r2844 | r2845 | |
| 1296 | 1339 | static void do_search(search_info *search); |
| 1297 | 1340 | |
| 1298 | 1341 | /********** MEMORY ACCESSOR **********/ |
| 1299 | static UINT8 ** LookupHandlerMemory(UINT8 cpu, UINT32 address, UINT32 * outRelativeAddress); | |
| 1300 | static UINT8 ** GetMemoryRegionBasePointer(UINT8 cpu, UINT8 space, UINT32 address); | |
| 1342 | static UINT8 **look_up_handler_memory(UINT8 cpu, UINT32 address, UINT32 *out_relative_address); | |
| 1343 | static UINT8 **get_memory_region_base_pointer(UINT8 cpu, UINT8 space, UINT32 address); | |
| 1301 | 1344 | |
| 1302 | static UINT32 DoCPURead(UINT8 cpu, UINT32 address, UINT8 bytes, UINT8 swap); | |
| 1303 | static UINT32 DoMemoryRead(UINT8 * buf, UINT32 address, UINT8 bytes, UINT8 swap, cpu_region_info *info); | |
| 1304 | static void DoCPUWrite(UINT32 data, UINT8 cpu, UINT32 address, UINT8 bytes, UINT8 swap); | |
| 1305 | static void DoMemoryWrite(UINT32 data, UINT8 * buf, UINT32 address, UINT8 bytes, UINT8 swap, cpu_region_info *info); | |
| 1345 | static UINT32 do_cpu_read(UINT8 cpu, UINT32 address, UINT8 bytes, UINT8 swap); | |
| 1346 | static UINT32 do_memory_read(UINT8 *buf, UINT32 address, UINT8 bytes, UINT8 swap, cpu_region_info *info); | |
| 1347 | static void do_cpu_write(UINT32 data, UINT8 cpu, UINT32 address, UINT8 bytes, UINT8 swap); | |
| 1348 | static void do_memory_write(UINT32 data, UINT8 *buf, UINT32 address, UINT8 bytes, UINT8 swap, cpu_region_info *info); | |
| 1306 | 1349 | |
| 1307 | static UINT32 ReadData(cheat_action *action); | |
| 1308 | static void WriteData(cheat_action *action, UINT32 data); | |
| 1350 | static UINT32 read_data(cheat_action *action); | |
| 1351 | static void write_data(cheat_action *action, UINT32 data); | |
| 1309 | 1352 | |
| 1310 | 1353 | /********** WATCH **********/ |
| 1311 | static void WatchCheatEntry(cheat_entry *entry, UINT8 associate); | |
| 1312 | static void AddActionWatch(cheat_action *action, cheat_entry *entry); | |
| 1313 | static void RemoveAssociatedWatches(cheat_entry *entry); | |
| 1354 | static void watch_cheat_entry(cheat_entry *entry, UINT8 associate); | |
| 1355 | static void add_action_watch(cheat_action *action, cheat_entry *entry); | |
| 1356 | static void remove_associated_watches(cheat_entry *entry); | |
| 1314 | 1357 | |
| 1315 | 1358 | /********** ACTIVE/DEACTIVE ENTRY **********/ |
| 1316 | static void ResetAction(cheat_action *action); | |
| 1317 | static void ActivateCheat(cheat_entry *entry); | |
| 1318 | static void DeactivateCheat(cheat_entry *entry); | |
| 1319 | static void TempDeactivateCheat(cheat_entry *entry); | |
| 1359 | static void reset_action(cheat_action *action); | |
| 1360 | static void activate_cheat(cheat_entry *entry); | |
| 1361 | static void restore_last_value(cheat_action *action); | |
| 1362 | static void deactivate_cheat(cheat_entry *entry); | |
| 1363 | static void temp_deactivate_cheat(cheat_entry *entry); | |
| 1320 | 1364 | |
| 1321 | 1365 | /********** OPERATION CORE **********/ |
| 1322 | 1366 | static void cheat_periodicOperation(cheat_action *action); |
| r2844 | r2845 | |
| 1327 | 1371 | /********** CONFIGURE ENTRY **********/ |
| 1328 | 1372 | static void update_all_cheat_info(void); |
| 1329 | 1373 | static void update_cheat_info(cheat_entry *entry, UINT8 is_load_time); |
| 1330 | static UINT32 | |
| 1374 | static UINT32 analyse_code_format(cheat_entry *entry, cheat_action *action); | |
| 1331 | 1375 | static void check_code_format(cheat_entry *entry); |
| 1332 | static void BuildLabelIndexTable(cheat_entry *entry); | |
| 1333 | static void SetLayerIndex(void); | |
| 1376 | static void build_label_index_table(cheat_entry *entry); | |
| 1377 | static void set_layer_index(void); | |
| 1334 | 1378 | |
| 1335 | 1379 | /********** OTHER STUFF **********/ |
| 1336 | static void | |
| 1380 | static void display_cheat_message(void); | |
| 1337 | 1381 | static UINT8 get_address_length(UINT8 region); |
| 1338 | 1382 | static char *get_region_name(UINT8 region); |
| 1339 | 1383 | static void build_cpu_region_info_list(running_machine *machine); |
| r2844 | r2845 | |
| 1342 | 1386 | INLINE FUNCTIONS |
| 1343 | 1387 | ***************************************************************************/ |
| 1344 | 1388 | |
| 1345 | /*------------- | |
| 1346 | GetCPUInfo | |
| 1347 | -------------*/ | |
| 1389 | /*--------------- | |
| 1390 | get_cpu_info | |
| 1391 | ---------------*/ | |
| 1348 | 1392 | |
| 1349 | 1393 | INLINE cpu_region_info *get_cpu_info(UINT8 cpu) |
| 1350 | 1394 | { |
| r2844 | r2845 | |
| 1354 | 1398 | return NULL; |
| 1355 | 1399 | } |
| 1356 | 1400 | |
| 1357 | /*------------------- | |
| 1358 | GetRegionCPUInfo | |
| 1359 | -------------------*/ | |
| 1401 | /*------------------ | |
| 1402 | get_region_info | |
| 1403 | ------------------*/ | |
| 1360 | 1404 | |
| 1361 | 1405 | INLINE cpu_region_info *get_region_info(UINT8 region) |
| 1362 | 1406 | { |
| r2844 | r2845 | |
| 2005 | 2049 | InitMessCheats(machine); |
| 2006 | 2050 | #endif |
| 2007 | 2051 | |
| 2008 | /* initialize flags */ | |
| 2052 | /* initialize flags/parameters */ | |
| 2009 | 2053 | current_search_idx = 0; |
| 2010 | found_database = 0; | |
| 2011 | cheatsDisabled = 0; | |
| 2012 | watchesDisabled = 0; | |
| 2054 | found_database = 0; | |
| 2055 | cheats_disabled = 0; | |
| 2056 | watches_disabled = 0; | |
| 2013 | 2057 | editActive = 0; |
| 2014 | 2058 | editCursor = 0; |
| 2015 | 2059 | cheat_options = DEFAULT_CHEAT_OPTIONS; |
| r2844 | r2845 | |
| 2021 | 2065 | build_cpu_region_info_list(machine); |
| 2022 | 2066 | |
| 2023 | 2067 | /* set cheat list from database */ |
| 2024 | load_cheat_database(machine, | |
| 2068 | load_cheat_database(machine, | |
| 2025 | 2069 | |
| 2026 | 2070 | /* set default search and watch lists */ |
| 2027 | 2071 | resize_search_list(1); |
| r2844 | r2845 | |
| 2032 | 2076 | search_info *info = get_current_search(); |
| 2033 | 2077 | |
| 2034 | 2078 | /* attemp to load user region */ |
| 2035 | load_cheat_database(machine, | |
| 2079 | load_cheat_database(machine, | |
| 2036 | 2080 | |
| 2037 | 2081 | /* if no user region or fail to load the database, attempt to build default region */ |
| 2038 | 2082 | if(info->region_list_length) |
| r2844 | r2845 | |
| 2087 | 2131 | |
| 2088 | 2132 | /* save all cheats automatically if needed */ |
| 2089 | 2133 | if(TEST_FIELD(cheat_options, AutoSaveEnabled)) |
| 2090 | | |
| 2134 | do_auto_save_cheats(machine); | |
| 2091 | 2135 | |
| 2092 | 2136 | /* free cheat list */ |
| 2093 | 2137 | dispose_cheat_database(); |
| r2844 | r2845 | |
| 2133 | 2177 | search_list_length = 0; |
| 2134 | 2178 | current_search_idx = 0; |
| 2135 | 2179 | found_database = 0; |
| 2136 | cheatsDisabled = 0; | |
| 2137 | watchesDisabled = 0; | |
| 2180 | cheats_disabled = 0; | |
| 2181 | watches_disabled = 0; | |
| 2138 | 2182 | main_database_name[0] = 0; |
| 2139 | 2183 | menuItemInfoLength = 0; |
| 2140 | cheat | |
| 2184 | cheat_variable[0] = 0; | |
| 2141 | 2185 | cheat_options = 0; |
| 2142 | 2186 | driverSpecifiedFlag = 0; |
| 2143 | 2187 | SET_MESSAGE(0); |
| r2844 | r2845 | |
| 2152 | 2196 | cheat_menu_stack *menu = &menu_stack[stack_index]; |
| 2153 | 2197 | |
| 2154 | 2198 | /* handle cheat message */ |
| 2155 | DisplayCheatMessage(); | |
| 2199 | if(message_type) | |
| 2200 | display_cheat_message(); | |
| 2156 | 2201 | |
| 2157 | 2202 | /* handle cheat menu */ |
| 2158 | 2203 | selection = (*menu->handler)(machine, menu); |
| r2844 | r2845 | |
| 2513 | 2558 | /* first setting 2 : save the value */ |
| 2514 | 2559 | if(menu->first_time) |
| 2515 | 2560 | { |
| 2516 | display_value = is_bcd ? DecimalToBCD(BCDToDecimal( | |
| 2561 | display_value = is_bcd ? DecimalToBCD(BCDToDecimal(read_data(action))) : read_data(action); | |
| 2517 | 2562 | |
| 2518 | 2563 | if(display_value < min) |
| 2519 | 2564 | display_value = min; |
| r2844 | r2845 | |
| 2670 | 2715 | } |
| 2671 | 2716 | } |
| 2672 | 2717 | |
| 2673 | | |
| 2718 | activate_cheat(entry); | |
| 2674 | 2719 | |
| 2675 | 2720 | menu->sel = -1; |
| 2676 | 2721 | } |
| r2844 | r2845 | |
| 2795 | 2840 | |
| 2796 | 2841 | /* set new label index */ |
| 2797 | 2842 | if(entry->selection) |
| 2798 | | |
| 2843 | activate_cheat(entry); | |
| 2799 | 2844 | else |
| 2800 | | |
| 2845 | deactivate_cheat(entry); | |
| 2801 | 2846 | |
| 2802 | 2847 | /* NOTE : the index number of master code should be stored into 1st table */ |
| 2803 | 2848 | if(TEST_FIELD(entry->action_list[entry->label_index[0]].type, LabelSelectQuickClose)) |
| r2844 | r2845 | |
| 2918 | 2963 | { |
| 2919 | 2964 | enum |
| 2920 | 2965 | { |
| 2921 | kMenu_EnableDisable = 0, | |
| 2922 | kMenu_AddEdit, | |
| 2923 | kMenu_Search, | |
| 2924 | kMenu_ViewResult, | |
| 2925 | kMenu_ChooseWatch, | |
| 2926 | kMenu_Options, | |
| 2966 | MENU_ENABLE_DISABLE = 0, | |
| 2967 | MENU_ADD_EDIT, | |
| 2968 | MENU_SEARCH, | |
| 2969 | MENU_VIEW_RESULT, | |
| 2970 | MENU_CHOOSE_WATCH, | |
| 2971 | MENU_OPTIONS, | |
| 2972 | MENU_COMMANDS, | |
| 2927 | 2973 | #ifdef MAME_DEBUG |
| 2928 | | |
| 2974 | | |
| 2929 | 2975 | #endif |
| 2930 | kMenu_Return, | |
| 2931 | kMenu_Max | |
| 2976 | MENU_RETURN, | |
| 2977 | MENU_MAX | |
| 2932 | 2978 | }; |
| 2933 | 2979 | |
| 2934 | UINT8 total = 0; | |
| 2935 | ui_menu_item menu_item[kMenu_Max + 1]; | |
| 2980 | int total = 0; | |
| 2981 | ui_menu_item menu_item[MENU_MAX + 1]; | |
| 2936 | 2982 | |
| 2937 | /* allocate memory for item list */ | |
| 2938 | 2983 | memset(menu_item, 0, sizeof(menu_item)); |
| 2939 | 2984 | |
| 2940 | 2985 | /* first setting : NONE */ |
| r2844 | r2845 | |
| 2942 | 2987 | menu->first_time = 0; |
| 2943 | 2988 | |
| 2944 | 2989 | /********** MENU CONSTRUCION **********/ |
| 2945 | /* ##### Enable/Disable a Cheat ##### */ | |
| 2946 | 2990 | menu_item[total++].text = "Enable/Disable a Cheat"; |
| 2947 | ||
| 2948 | /* ##### Add/Edit a Cheat ##### */ | |
| 2949 | 2991 | menu_item[total++].text = "Add/Edit a Cheat"; |
| 2950 | ||
| 2951 | /* ##### Search a Cheat ##### */ | |
| 2952 | 2992 | switch(EXTRACT_FIELD(cheat_options, SearchBox)) |
| 2953 | 2993 | { |
| 2954 | 2994 | case kSearchBox_Minimum: |
| r2844 | r2845 | |
| 2967 | 3007 | menu_item[total++].text = "Unknown Search Menu"; |
| 2968 | 3008 | } |
| 2969 | 3009 | |
| 2970 | /* ##### View Last Result ##### */ | |
| 2971 | 3010 | menu_item[total++].text = "View Last Results"; |
| 2972 | ||
| 2973 | /* ##### Configure Watchpoints ##### */ | |
| 2974 | 3011 | menu_item[total++].text = "Configure Watchpoints"; |
| 2975 | ||
| 2976 | /* ##### Options ##### */ | |
| 2977 | menu_item[total++].text = "Options"; | |
| 2978 | ||
| 3012 | menu_item[total++].text = "Cheat Options"; | |
| 3013 | menu_item[total++].text = "Cheat Commands"; | |
| 2979 | 3014 | #ifdef MAME_DEBUG |
| 2980 | /* ##### Debug ##### */ | |
| 2981 | 3015 | menu_item[total++].text = "Debug Viewer"; |
| 2982 | 3016 | #endif |
| 2983 | ||
| 2984 | /* ##### Return to the MAME general menu ##### */ | |
| 2985 | 3017 | menu_item[total++].text = "Return to Main Menu"; |
| 2986 | ||
| 2987 | /* ##### Terminate Array ##### */ | |
| 2988 | 3018 | menu_item[total].text = NULL; |
| 2989 | 3019 | |
| 3020 | /* adjust current cursor position */ | |
| 2990 | 3021 | ADJUST_CURSOR(menu->sel, total); |
| 2991 | 3022 | |
| 2992 | 3023 | /* print it */ |
| r2844 | r2845 | |
| 3013 | 3044 | { |
| 3014 | 3045 | switch(menu->sel) |
| 3015 | 3046 | { |
| 3016 | case | |
| 3047 | case | |
| 3017 | 3048 | cheat_menu_stack_push(enable_disable_cheat_menu, cheat_main_menu, menu->sel); |
| 3018 | 3049 | break; |
| 3019 | 3050 | |
| 3020 | case | |
| 3051 | case | |
| 3021 | 3052 | cheat_menu_stack_push(add_edit_cheat_menu, cheat_main_menu, 0); |
| 3022 | 3053 | break; |
| 3023 | 3054 | |
| 3024 | case | |
| 3055 | case | |
| 3025 | 3056 | switch(EXTRACT_FIELD(cheat_options, SearchBox)) |
| 3026 | 3057 | { |
| 3027 | 3058 | case kSearchBox_Minimum: |
| r2844 | r2845 | |
| 3037 | 3068 | } |
| 3038 | 3069 | break; |
| 3039 | 3070 | |
| 3040 | case | |
| 3071 | case | |
| 3041 | 3072 | cheat_menu_stack_push(view_search_result_menu, menu->handler, menu->sel); |
| 3042 | 3073 | break; |
| 3043 | 3074 | |
| 3044 | case | |
| 3075 | case | |
| 3045 | 3076 | cheat_menu_stack_push(choose_watch_menu, menu->handler, menu->sel); |
| 3046 | 3077 | break; |
| 3047 | 3078 | |
| 3048 | case | |
| 3079 | case | |
| 3049 | 3080 | cheat_menu_stack_push(select_option_menu, menu->handler, menu->sel); |
| 3050 | 3081 | break; |
| 3051 | 3082 | |
| 3083 | case MENU_COMMANDS: | |
| 3084 | cheat_menu_stack_push(command_cheat_menu, menu->handler, menu->sel); | |
| 3085 | break; | |
| 3086 | ||
| 3052 | 3087 | #ifdef MAME_DEBUG |
| 3053 | case | |
| 3088 | case | |
| 3054 | 3089 | cheat_menu_stack_push(debug_cheat_menu, menu->handler, menu->sel); |
| 3055 | 3090 | break; |
| 3056 | 3091 | #endif |
| 3057 | case | |
| 3092 | case | |
| 3058 | 3093 | menu->sel = -1; |
| 3059 | 3094 | } |
| 3060 | 3095 | } |
| r2844 | r2845 | |
| 3186 | 3221 | } |
| 3187 | 3222 | } |
| 3188 | 3223 | |
| 3224 | if(traverse->flags & kCheatFlag_OldFormat) | |
| 3225 | traverse->flags &= ~kCheatFlag_RequestArrow; | |
| 3226 | ||
| 3189 | 3227 | /* set highlight flag if comment is set */ |
| 3190 | 3228 | if(traverse->comment && traverse->comment[0]) |
| 3191 | 3229 | flag_buf[total] = 1; |
| 3192 | 3230 | else |
| 3193 | 3231 | flag_buf[total] = 0; |
| 3232 | ||
| 3194 | 3233 | menu_index[total++] = i; |
| 3195 | 3234 | } |
| 3196 | 3235 | } |
| r2844 | r2845 | |
| 3387 | 3426 | |
| 3388 | 3427 | /* NOTE : one shot cheat should not be activated by changing label */ |
| 3389 | 3428 | if(entry->label_index[entry->selection] == 0) |
| 3390 | | |
| 3429 | deactivate_cheat(entry); | |
| 3391 | 3430 | else if((entry->flags & kCheatFlag_OneShot) == 0 && (entry->flags & kCheatFlag_Active) == 0) |
| 3392 | | |
| 3431 | activate_cheat(entry); | |
| 3393 | 3432 | } |
| 3394 | 3433 | } |
| 3395 | 3434 | else if(entry->flags & kCheatFlag_LayerIndex) |
| r2844 | r2845 | |
| 3421 | 3460 | |
| 3422 | 3461 | /* NOTE : one shot cheat should not be activated by changing label */ |
| 3423 | 3462 | if(entry->label_index[entry->selection] == 0) |
| 3424 | | |
| 3463 | deactivate_cheat(entry); | |
| 3425 | 3464 | else if((entry->flags & kCheatFlag_OneShot) == 0 && (entry->flags & kCheatFlag_Active) == 0) |
| 3426 | | |
| 3465 | activate_cheat(entry); | |
| 3427 | 3466 | } |
| 3428 | 3467 | } |
| 3429 | 3468 | else if(entry->flags & kCheatFlag_LayerIndex) |
| r2844 | r2845 | |
| 3452 | 3491 | else |
| 3453 | 3492 | { |
| 3454 | 3493 | if(active) |
| 3455 | | |
| 3494 | activate_cheat(entry); | |
| 3456 | 3495 | else |
| 3457 | | |
| 3496 | deactivate_cheat(entry); | |
| 3458 | 3497 | } |
| 3459 | 3498 | } |
| 3460 | 3499 | break; |
| r2844 | r2845 | |
| 3525 | 3564 | else |
| 3526 | 3565 | { |
| 3527 | 3566 | /* activate selected code */ |
| 3528 | | |
| 3567 | activate_cheat(entry); | |
| 3529 | 3568 | } |
| 3530 | 3569 | } |
| 3531 | 3570 | } |
| r2844 | r2845 | |
| 3535 | 3574 | { |
| 3536 | 3575 | /* shift + save : save all codes */ |
| 3537 | 3576 | for(i = 0; i < cheat_list_length; i++) |
| 3538 | | |
| 3577 | save_cheat_code(machine, &cheat_list[i]); | |
| 3539 | 3578 | |
| 3540 | SET_MESSAGE( | |
| 3579 | SET_MESSAGE( | |
| 3541 | 3580 | } |
| 3542 | 3581 | else if(ControlKeyPressed()) |
| 3543 | 3582 | { |
| 3544 | 3583 | /* ctrl + save : save activation key */ |
| 3545 | | |
| 3584 | save_activation_key(machine, entry, menu_index[menu->sel]); | |
| 3546 | 3585 | } |
| 3547 | 3586 | else if(AltKeyPressed()) |
| 3548 | 3587 | { |
| 3549 | 3588 | /* alt + save : save pre-enable */ |
| 3550 | | |
| 3589 | save_pre_enable(machine, entry, menu_index[menu->sel]); | |
| 3551 | 3590 | } |
| 3552 | 3591 | } |
| 3553 | 3592 | else if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT)) |
| r2844 | r2845 | |
| 3559 | 3598 | if(entry) |
| 3560 | 3599 | delete_cheat_at(menu_index[menu->sel]); |
| 3561 | 3600 | else |
| 3562 | SET_MESSAGE( | |
| 3601 | SET_MESSAGE( | |
| 3563 | 3602 | } |
| 3564 | 3603 | else if(input_ui_pressed(machine, IPT_UI_EDIT_CHEAT)) |
| 3565 | 3604 | { |
| r2844 | r2845 | |
| 3570 | 3609 | } |
| 3571 | 3610 | else if(input_ui_pressed(machine, IPT_UI_WATCH_VALUE)) |
| 3572 | 3611 | { |
| 3573 | | |
| 3612 | watch_cheat_entry(entry, 0); | |
| 3574 | 3613 | } |
| 3575 | 3614 | else if(input_ui_pressed(machine, IPT_UI_RELOAD_CHEAT)) |
| 3576 | 3615 | { |
| r2844 | r2845 | |
| 3697 | 3736 | { |
| 3698 | 3737 | /* shift + save = save all codes */ |
| 3699 | 3738 | for(i = 0; i < cheat_list_length; i++) |
| 3700 | | |
| 3739 | save_cheat_code(machine, &cheat_list[i]); | |
| 3701 | 3740 | |
| 3702 | SET_MESSAGE( | |
| 3741 | SET_MESSAGE( | |
| 3703 | 3742 | } |
| 3704 | 3743 | else if(ControlKeyPressed()) |
| 3705 | 3744 | { |
| 3706 | 3745 | if((entry->flags & kCheatFlag_HasActivationKey1) || (entry->flags & kCheatFlag_HasActivationKey2)) |
| 3707 | 3746 | /* ctrl + save = save activation key */ |
| 3708 | | |
| 3747 | save_activation_key(machine, entry, menu->sel); | |
| 3709 | 3748 | } |
| 3710 | 3749 | else if(AltKeyPressed()) |
| 3711 | 3750 | { |
| 3712 | 3751 | /* alt + save = save pre-enable code */ |
| 3713 | | |
| 3752 | save_pre_enable(machine, entry, menu->sel); | |
| 3714 | 3753 | } |
| 3715 | 3754 | else |
| 3716 | 3755 | { |
| 3717 | | |
| 3756 | save_cheat_code(machine, entry); | |
| 3718 | 3757 | } |
| 3719 | 3758 | } |
| 3720 | 3759 | else if(input_ui_pressed(machine, IPT_UI_WATCH_VALUE)) |
| 3721 | 3760 | { |
| 3722 | | |
| 3761 | watch_cheat_entry(entry, 0); | |
| 3723 | 3762 | } |
| 3724 | 3763 | else if(input_ui_pressed(machine, IPT_UI_CANCEL)) |
| 3725 | 3764 | { |
| r2844 | r2845 | |
| 3740 | 3779 | kMenu_ReloadDatabase, |
| 3741 | 3780 | kMenu_WatchCheat, |
| 3742 | 3781 | kMenu_SaveCheat, |
| 3743 | kMenu_SaveActivationKey, | |
| 3744 | kMenu_SavePreEnable, | |
| 3782 | kMenu_save_activation_key, | |
| 3783 | kMenu_save_pre_enable, | |
| 3745 | 3784 | kMenu_SaveAllCodes, |
| 3746 | 3785 | kMenu_AddCode, |
| 3747 | 3786 | kMenu_DeleteCode, |
| r2844 | r2845 | |
| 3826 | 3865 | break; |
| 3827 | 3866 | |
| 3828 | 3867 | case kMenu_WatchCheat: |
| 3829 | | |
| 3868 | watch_cheat_entry(entry, 0); | |
| 3830 | 3869 | break; |
| 3831 | 3870 | |
| 3832 | 3871 | case kMenu_SaveCheat: |
| 3833 | | |
| 3872 | save_cheat_code(machine, entry); | |
| 3834 | 3873 | break; |
| 3835 | 3874 | |
| 3836 | case kMenu_SaveActivationKey: | |
| 3837 | SaveActivationKey(machine, entry, menu->pre_sel); | |
| 3875 | case kMenu_save_activation_key: | |
| 3876 | save_activation_key(machine, entry, menu->pre_sel); | |
| 3838 | 3877 | break; |
| 3839 | 3878 | |
| 3840 | case kMenu_SavePreEnable: | |
| 3841 | SavePreEnable(machine, entry, menu->pre_sel); | |
| 3879 | case kMenu_save_pre_enable: | |
| 3880 | save_pre_enable(machine, entry, menu->pre_sel); | |
| 3842 | 3881 | break; |
| 3843 | 3882 | |
| 3844 | 3883 | case kMenu_SaveAllCodes: |
| 3845 | 3884 | { |
| 3846 | 3885 | for(i = 0; i < cheat_list_length; i++) |
| 3847 | | |
| 3886 | save_cheat_code(machine, &cheat_list[i]); | |
| 3848 | 3887 | |
| 3849 | SET_MESSAGE( | |
| 3888 | SET_MESSAGE( | |
| 3850 | 3889 | } |
| 3851 | 3890 | break; |
| 3852 | 3891 | |
| r2844 | r2845 | |
| 5562 | 5601 | { |
| 5563 | 5602 | if(input_ui_pressed(machine, IPT_UI_SAVE_CHEAT)) |
| 5564 | 5603 | { |
| 5565 | | |
| 5604 | save_cheat_code(machine, entry); | |
| 5566 | 5605 | } |
| 5567 | 5606 | else if(input_ui_pressed(machine, IPT_UI_WATCH_VALUE)) |
| 5568 | 5607 | { |
| 5569 | | |
| 5608 | watch_cheat_entry(entry, 0); | |
| 5570 | 5609 | } |
| 5571 | 5610 | else if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT)) |
| 5572 | 5611 | { |
| r2844 | r2845 | |
| 5589 | 5628 | if(!info->sub_cheat) |
| 5590 | 5629 | { |
| 5591 | 5630 | /* don't delete MASTER Action due to crash */ |
| 5592 | SET_MESSAGE( | |
| 5631 | SET_MESSAGE( | |
| 5593 | 5632 | } |
| 5594 | 5633 | else |
| 5595 | 5634 | DeleteActionAt(entry, info->sub_cheat); |
| r2844 | r2845 | |
| 5607 | 5646 | { |
| 5608 | 5647 | /* NOTE : building label index table should be done when exit the edit menu */ |
| 5609 | 5648 | if(entry->flags & kCheatFlag_Select) |
| 5610 | | |
| 5649 | build_label_index_table(entry); | |
| 5611 | 5650 | |
| 5612 | 5651 | check_code_format(entry); |
| 5613 | 5652 | |
| r2844 | r2845 | |
| 5794 | 5833 | if(entry->flags & kCheatFlag_HasActivationKey1) |
| 5795 | 5834 | { |
| 5796 | 5835 | activation_key_string1 = astring_alloc(); |
| 5797 | ADD_MENU_3_ITEMS("Activation Key - Prev", astring_c(input_code_name(activation_key_string1, entry->activation_key1)), kViewMenu_ActivationKey1); | |
| 5836 | ADD_MENU_3_ITEMS("Activation Key - Prev", astring_c(input_code_name(activation_key_string1, entry->activation_key_1)), kViewMenu_ActivationKey1); | |
| 5798 | 5837 | } |
| 5799 | 5838 | |
| 5800 | 5839 | if(entry->flags & kCheatFlag_HasActivationKey2) |
| 5801 | 5840 | { |
| 5802 | 5841 | activation_key_string2 = astring_alloc(); |
| 5803 | ADD_MENU_3_ITEMS("Activation Key - Next", astring_c(input_code_name(activation_key_string2, entry->activation_key2)), kViewMenu_ActivationKey2); | |
| 5842 | ADD_MENU_3_ITEMS("Activation Key - Next", astring_c(input_code_name(activation_key_string2, entry->activation_key_2)), kViewMenu_ActivationKey2); | |
| 5804 | 5843 | } |
| 5805 | 5844 | } |
| 5806 | 5845 | else |
| r2844 | r2845 | |
| 5808 | 5847 | if(entry->flags & kCheatFlag_HasActivationKey1) |
| 5809 | 5848 | { |
| 5810 | 5849 | activation_key_string1 = astring_alloc(); |
| 5811 | ADD_MENU_3_ITEMS("Activation Key", astring_c(input_code_name(activation_key_string1, entry->activation_key1)), kViewMenu_ActivationKey1); | |
| 5850 | ADD_MENU_3_ITEMS("Activation Key", astring_c(input_code_name(activation_key_string1, entry->activation_key_1)), kViewMenu_ActivationKey1); | |
| 5812 | 5851 | } |
| 5813 | 5852 | } |
| 5814 | 5853 | |
| r2844 | r2845 | |
| 5829 | 5868 | /* ##### CODE TYPE ##### */ |
| 5830 | 5869 | if(action->flags & kActionFlag_Custom) |
| 5831 | 5870 | { |
| 5832 | ADD_MENU_3_ITEMS("Custom Type", kCustomCodeTypeNames[ | |
| 5871 | ADD_MENU_3_ITEMS("Custom Type", kCustomCodeTypeNames[ | |
| 5833 | 5872 | } |
| 5834 | 5873 | else |
| 5835 | 5874 | { |
| r2844 | r2845 | |
| 5871 | 5910 | ADD_MENU_3_ITEMS("Condition", kConditionNames[EXTRACT_FIELD(action->type, CodeParameter)], kViewMenu_Condition); |
| 5872 | 5911 | } |
| 5873 | 5912 | |
| 5874 | sprintf(buf_extend, "%*.*X", kCheatSizeDigitsTable[address_size], kCheatSizeDigitsTable[address_size], action->extend_data); | |
| 5875 | ||
| 5876 | ADD_MENU_3_ITEMS("Comparison", buf_extend, kViewMenu_Extend); | |
| 5913 | if(EXTRACT_FIELD(action->type, CodeParameter) != kCondition_PreviousValue) | |
| 5914 | { | |
| 5915 | sprintf(buf_extend, "%*.*X", kCheatSizeDigitsTable[address_size], kCheatSizeDigitsTable[address_size], action->extend_data); | |
| 5916 | ADD_MENU_3_ITEMS("Comparison", buf_extend, kViewMenu_Extend); | |
| 5917 | } | |
| 5877 | 5918 | } |
| 5878 | 5919 | |
| 5879 | 5920 | if(code_type == kCodeType_Popup) |
| r2844 | r2845 | |
| 5923 | 5964 | } |
| 5924 | 5965 | |
| 5925 | 5966 | /* ##### DATA ##### */ |
| 5926 | if(c | |
| 5967 | if(ac | |
| 5927 | 5968 | { |
| 5928 | 5969 | if(action->flags & kActionFlag_LimitedMask) |
| 5929 | 5970 | { |
| 5930 | /* NOTE : data is upper 2 bytes from data field in case of limite mask */ | |
| 5971 | /* NOTE : data is upper 2 bytes from data field in case of limited mask */ | |
| 5931 | 5972 | if(TEST_FIELD(action->type, DataRead)) |
| 5932 | 5973 | sprintf(buf_data, "V%s", kNumbersTable[EXTRACT_FIELD(action->original_data, MSB16)]); |
| 5933 | 5974 | else |
| r2844 | r2845 | |
| 5976 | 6017 | if(code_type == kCodeType_Branch) |
| 5977 | 6018 | { |
| 5978 | 6019 | /* jump index for branch */ |
| 5979 | sprintf(buf_extend, "%2.2d", action-> | |
| 6020 | sprintf(buf_extend, "%2.2d", action->original_data + 1); | |
| 5980 | 6021 | ADD_MENU_3_ITEMS("Jump Index", buf_extend, kViewMenu_Extend); |
| 5981 | 6022 | } |
| 5982 | 6023 | |
| r2844 | r2845 | |
| 6003 | 6044 | else |
| 6004 | 6045 | { |
| 6005 | 6046 | /* ##### CUSTOM CODE PARAMETER ##### */ |
| 6006 | if( | |
| 6047 | if( | |
| 6007 | 6048 | { |
| 6008 | 6049 | /* ##### LAYER TAG ##### */ |
| 6009 | 6050 | sprintf(buf_address, "%2.2X", action->original_address); |
| r2844 | r2845 | |
| 6068 | 6109 | } |
| 6069 | 6110 | else if(input_ui_pressed(machine, IPT_UI_SAVE_CHEAT)) |
| 6070 | 6111 | { |
| 6071 | | |
| 6112 | save_cheat_code(machine, entry); | |
| 6072 | 6113 | } |
| 6073 | 6114 | |
| 6074 | 6115 | if(activation_key_string1) |
| r2844 | r2845 | |
| 6085 | 6126 | |
| 6086 | 6127 | static int analyse_cheat_menu(running_machine *machine, cheat_menu_stack *menu) |
| 6087 | 6128 | { |
| 6088 | static const char *const | |
| 6129 | static const char *const FORMAT_ERROR_MESSAGE_TABLE[] = { | |
| 6089 | 6130 | "Invalid Location Type", |
| 6090 | 6131 | "Invalid Operation", |
| 6091 | 6132 | "Invalid Code Type", |
| r2844 | r2845 | |
| 6130 | 6171 | { |
| 6131 | 6172 | cheat_action *action = &entry->action_list[i]; |
| 6132 | 6173 | |
| 6133 | UINT32 flags = | |
| 6174 | UINT32 flags = analyse_code_format(entry, action); | |
| 6134 | 6175 | |
| 6135 | 6176 | menu_item[total++] = action->optional_name ? action->optional_name : "(Null)"; |
| 6136 | 6177 | menu_item[total++] = MENU_SEPARATOR_ITEM; |
| r2844 | r2845 | |
| 6140 | 6181 | for(j = 0; j < kErrorFlag_Max; j++) |
| 6141 | 6182 | { |
| 6142 | 6183 | if((flags >> j) & 1) |
| 6143 | menu_item[total++] = | |
| 6184 | menu_item[total++] = FORMAT_ERROR_MESSAGE_TABLE[j]; | |
| 6144 | 6185 | } |
| 6145 | 6186 | } |
| 6146 | 6187 | else |
| r2844 | r2845 | |
| 6232 | 6273 | const char * menuSubItem[kMenu_Max + 1] = { 0 }; |
| 6233 | 6274 | char flagBuf[kMenu_Max + 1] = { 0 }; |
| 6234 | 6275 | char cpuBuf[4]; |
| 6235 | char valueBuf[32]; // "FFFFFFF[F] (4294967295)" 23 chars | |
| 6236 | char timerBuf[32]; // "-FFFFFFF[F] (4294967295)" 24 chars | |
| 6276 | char valueBuf[32]; /* "FFFFFFF[F] (4294967295)" 23 chars */ | |
| 6277 | char timerBuf[32]; /* "-FFFFFFF[F] (4294967295)" 24 chars */ | |
| 6237 | 6278 | char numResultsBuf[16]; |
| 6238 | 6279 | char * stringsBuf; |
| 6239 | 6280 | search_info *search = get_current_search(); |
| r2844 | r2845 | |
| 6693 | 6734 | else |
| 6694 | 6735 | { |
| 6695 | 6736 | /* if no search region (eg, sms.c in HazeMD), don't open result viewer to avoid the crash */ |
| 6696 | SET_MESSAGE( | |
| 6737 | SET_MESSAGE( | |
| 6697 | 6738 | } |
| 6698 | 6739 | break; |
| 6699 | 6740 | |
| r2844 | r2845 | |
| 6747 | 6788 | update_search(search); |
| 6748 | 6789 | |
| 6749 | 6790 | if(doneSaveMemory || menu->sel == kMenu_Value) |
| 6750 | SET_MESSAGE( | |
| 6791 | SET_MESSAGE( | |
| 6751 | 6792 | else |
| 6752 | SET_MESSAGE( | |
| 6793 | SET_MESSAGE( | |
| 6753 | 6794 | |
| 6754 | 6795 | doneSaveMemory = 1; |
| 6755 | 6796 | |
| 6756 | 6797 | if(search->num_results == 1) |
| 6757 | 6798 | { |
| 6758 | | |
| 6799 | add_cheat_from_first_result(search); | |
| 6759 | 6800 | |
| 6760 | SET_MESSAGE( | |
| 6801 | SET_MESSAGE( | |
| 6761 | 6802 | } |
| 6762 | 6803 | } |
| 6763 | 6804 | |
| r2844 | r2845 | |
| 7266 | 7307 | doneSaveMemory = 1; |
| 7267 | 7308 | |
| 7268 | 7309 | if(search->num_results == 1) |
| 7269 | | |
| 7310 | add_cheat_from_first_result(search); | |
| 7270 | 7311 | } |
| 7271 | 7312 | |
| 7272 | 7313 | /********** EDIT **********/ |
| r2844 | r2845 | |
| 7706 | 7747 | |
| 7707 | 7748 | if(search->num_results == 1) |
| 7708 | 7749 | { |
| 7709 | | |
| 7750 | add_cheat_from_first_result(search); | |
| 7710 | 7751 | |
| 7711 | 7752 | popmessage("1 result found, added to list"); |
| 7712 | 7753 | } |
| r2844 | r2845 | |
| 7960 | 8001 | build_search_regions(machine, search); |
| 7961 | 8002 | else |
| 7962 | 8003 | /* rebuild search region from user-defined map */ |
| 7963 | load_cheat_database(machine, | |
| 8004 | load_cheat_database(machine, | |
| 7964 | 8005 | } |
| 7965 | 8006 | |
| 7966 | 8007 | if(do_reallocate) |
| r2844 | r2845 | |
| 8246 | 8287 | else if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT)) |
| 8247 | 8288 | { |
| 8248 | 8289 | if(selectedAddressGood) |
| 8249 | | |
| 8290 | add_cheat_from_result(search, region, selectedAddress); | |
| 8250 | 8291 | } |
| 8251 | 8292 | else if(input_ui_pressed(machine, IPT_UI_DELETE_CHEAT)) |
| 8252 | 8293 | { |
| r2844 | r2845 | |
| 8263 | 8304 | search->num_results--; |
| 8264 | 8305 | region->num_results--; |
| 8265 | 8306 | |
| 8266 | SET_MESSAGE( | |
| 8307 | SET_MESSAGE( | |
| 8267 | 8308 | } |
| 8268 | 8309 | } |
| 8269 | 8310 | else if(input_ui_pressed(machine, IPT_UI_WATCH_VALUE)) |
| 8270 | 8311 | { |
| 8271 | 8312 | if(selectedAddressGood) |
| 8272 | | |
| 8313 | add_watch_from_result(search, region, selectedAddress); | |
| 8273 | 8314 | } |
| 8274 | 8315 | else if(input_ui_pressed(machine, IPT_UI_SELECT) || input_ui_pressed(machine, IPT_UI_CANCEL)) |
| 8275 | 8316 | menu->sel = -1; |
| r2844 | r2845 | |
| 8356 | 8397 | UINT8 total = 0; |
| 8357 | 8398 | const char ** menuItem; |
| 8358 | 8399 | char ** buf; |
| 8359 | char * | |
| 8400 | char * | |
| 8360 | 8401 | watch_info *watch; |
| 8361 | 8402 | |
| 8362 | 8403 | /* first setting : NONE */ |
| r2844 | r2845 | |
| 8558 | 8599 | add_cheat_from_watch_as_watch(entry, watch); |
| 8559 | 8600 | |
| 8560 | 8601 | /* when fails to add, delete this entry because it causes the crash */ |
| 8561 | if(message_type == | |
| 8602 | if(message_type == | |
| 8562 | 8603 | { |
| 8563 | 8604 | delete_cheat_at(cheat_list_length - 1); |
| 8564 | SET_MESSAGE( | |
| 8605 | SET_MESSAGE( | |
| 8565 | 8606 | } |
| 8566 | 8607 | } |
| 8567 | 8608 | else |
| r2844 | r2845 | |
| 8613 | 8654 | memset(&entry, 0, sizeof(cheat_entry)); |
| 8614 | 8655 | |
| 8615 | 8656 | add_cheat_from_watch_as_watch(&entry, watch); |
| 8616 | | |
| 8657 | save_cheat_code(machine, &entry); | |
| 8617 | 8658 | dispose_cheat(&entry); |
| 8618 | 8659 | } |
| 8619 | 8660 | } |
| r2844 | r2845 | |
| 8764 | 8805 | add_cheat_from_watch_as_watch(new_entry, entry); |
| 8765 | 8806 | |
| 8766 | 8807 | /* when fails to add, delete this entry because it causes the crash */ |
| 8767 | if(message_type == | |
| 8808 | if(message_type == | |
| 8768 | 8809 | { |
| 8769 | 8810 | delete_cheat_at(cheat_list_length - 1); |
| 8770 | SET_MESSAGE( | |
| 8811 | SET_MESSAGE( | |
| 8771 | 8812 | } |
| 8772 | 8813 | } |
| 8773 | 8814 | break; |
| r2844 | r2845 | |
| 8783 | 8824 | memset(&temp_entry, 0, sizeof(cheat_entry)); |
| 8784 | 8825 | |
| 8785 | 8826 | add_cheat_from_watch_as_watch(&temp_entry, entry); |
| 8786 | | |
| 8827 | save_cheat_code(machine, &temp_entry); | |
| 8787 | 8828 | dispose_cheat(&temp_entry); |
| 8788 | 8829 | } |
| 8789 | 8830 | break; |
| r2844 | r2845 | |
| 9280 | 9321 | memset(&temp_entry, 0, sizeof(cheat_entry)); |
| 9281 | 9322 | |
| 9282 | 9323 | add_cheat_from_watch_as_watch(&temp_entry, entry); |
| 9283 | | |
| 9324 | save_cheat_code(machine, &temp_entry); | |
| 9284 | 9325 | dispose_cheat(&temp_entry); |
| 9285 | 9326 | } |
| 9286 | 9327 | } |
| r2844 | r2845 | |
| 9297 | 9338 | enum{ |
| 9298 | 9339 | kMenu_SelectSearch = 0, |
| 9299 | 9340 | kMenu_Loadcheat_options, |
| 9300 | kMenu_ | |
| 9341 | kMenu_save_cheat_options, | |
| 9301 | 9342 | kMenu_Resetcheat_options, |
| 9302 | 9343 | kMenu_Separator, |
| 9303 | 9344 | kMenu_SearchDialogStyle, |
| r2844 | r2845 | |
| 9487 | 9528 | break; |
| 9488 | 9529 | |
| 9489 | 9530 | case kMenu_Loadcheat_options: |
| 9490 | load_cheat_database(machine, | |
| 9531 | load_cheat_database(machine, | |
| 9491 | 9532 | break; |
| 9492 | 9533 | |
| 9493 | case kMenu_Savecheat_options: | |
| 9494 | Savecheat_options(); | |
| 9534 | case kMenu_save_cheat_options: | |
| 9535 | save_cheat_options(); | |
| 9495 | 9536 | break; |
| 9496 | 9537 | |
| 9497 | 9538 | case kMenu_Resetcheat_options: |
| r2844 | r2845 | |
| 9504 | 9545 | } |
| 9505 | 9546 | else if(input_ui_pressed(machine, IPT_UI_SAVE_CHEAT)) |
| 9506 | 9547 | { |
| 9507 | | |
| 9548 | save_cheat_options(); | |
| 9508 | 9549 | } |
| 9509 | 9550 | else if(input_ui_pressed(machine, IPT_UI_RELOAD_CHEAT)) |
| 9510 | 9551 | { |
| 9511 | load_cheat_database(machine, | |
| 9552 | load_cheat_database(machine, | |
| 9512 | 9553 | } |
| 9513 | 9554 | else if(input_ui_pressed(machine, IPT_UI_CANCEL)) |
| 9514 | 9555 | { |
| r2844 | r2845 | |
| 9642 | 9683 | return menu->sel; |
| 9643 | 9684 | } |
| 9644 | 9685 | |
| 9686 | /*----------------------------------------------------------------- | |
| 9687 | command_cheat_menu - management for cheat general command menu | |
| 9688 | -----------------------------------------------------------------*/ | |
| 9689 | ||
| 9690 | static int command_cheat_menu(running_machine *machine, cheat_menu_stack *menu) | |
| 9691 | { | |
| 9692 | enum{ | |
| 9693 | MENU_RELOAD_CHEAT_CODE = 0, | |
| 9694 | MENU_SEPARATOR_1, | |
| 9695 | MENU_TOGGLE_CHEAT, | |
| 9696 | MENU_TOGGLE_WATCHPOINT, | |
| 9697 | MENU_SEPARATOR_2, | |
| 9698 | MENU_SAVE_DESCRIPTION, | |
| 9699 | MENU_SAVE_RAW_CODE, | |
| 9700 | MENU_SEPARATOR_3, | |
| 9701 | MENU_RETURN, | |
| 9702 | MENU_MAX }; | |
| 9703 | ||
| 9704 | int total = 0; | |
| 9705 | int toggle = 0; | |
| 9706 | ui_menu_item menu_item[MENU_MAX + 1]; | |
| 9707 | ||
| 9708 | memset(menu_item, 0 , sizeof(menu_item)); | |
| 9709 | ||
| 9710 | /* first setting : NONE */ | |
| 9711 | if(menu->first_time) | |
| 9712 | menu->first_time = 0; | |
| 9713 | ||
| 9714 | /********** MENU CONSTRUCION **********/ | |
| 9715 | menu_item[total++].text = "Reload Cheat Codes"; | |
| 9716 | menu_item[total++].text = MENU_SEPARATOR_ITEM; | |
| 9717 | if(cheats_disabled) menu_item[total++].text = "Cheat OFF"; | |
| 9718 | else menu_item[total++].text = "Cheat ON"; | |
| 9719 | if(watches_disabled) menu_item[total++].text = "Watchpoints OFF"; | |
| 9720 | else menu_item[total++].text = "Watchpoints ON"; | |
| 9721 | menu_item[total++].text = MENU_SEPARATOR_ITEM; | |
| 9722 | menu_item[total++].text = "Save Description"; | |
| 9723 | menu_item[total++].text = "Save Raw Code"; | |
| 9724 | menu_item[total++].text = MENU_SEPARATOR_ITEM; | |
| 9725 | menu_item[total++].text = "Return to Prior Menu"; | |
| 9726 | menu_item[total].text = NULL; | |
| 9727 | ||
| 9728 | /* adjust current cursor position */ | |
| 9729 | ADJUST_CURSOR(menu->sel, total); | |
| 9730 | ||
| 9731 | /* print it */ | |
| 9732 | ui_menu_draw(menu_item, total, menu->sel, NULL); | |
| 9733 | ||
| 9734 | /********** KEY HANDLING **********/ | |
| 9735 | if(ui_pressed_repeat_throttle(machine, IPT_UI_UP, kVerticalKeyRepeatRate)) | |
| 9736 | { | |
| 9737 | CURSOR_TO_PREVIOUS(menu->sel, total); | |
| 9738 | ||
| 9739 | if(menu->sel == MENU_SEPARATOR_1 || menu->sel == MENU_SEPARATOR_2 || menu->sel == MENU_SEPARATOR_3) | |
| 9740 | menu->sel--; | |
| 9741 | } | |
| 9742 | else if(ui_pressed_repeat_throttle(machine, IPT_UI_DOWN, kVerticalKeyRepeatRate)) | |
| 9743 | { | |
| 9744 | CURSOR_TO_NEXT(menu->sel, total); | |
| 9745 | ||
| 9746 | if(menu->sel == MENU_SEPARATOR_1 || menu->sel == MENU_SEPARATOR_2 || menu->sel == MENU_SEPARATOR_3) | |
| 9747 | menu->sel++; | |
| 9748 | } | |
| 9749 | else if(ui_pressed_repeat_throttle(machine, IPT_UI_PAGE_UP, kVerticalKeyRepeatRate)) | |
| 9750 | { | |
| 9751 | CURSOR_PAGE_UP(menu->sel); | |
| 9752 | } | |
| 9753 | else if(ui_pressed_repeat_throttle(machine, IPT_UI_PAGE_DOWN, kVerticalKeyRepeatRate)) | |
| 9754 | { | |
| 9755 | CURSOR_PAGE_DOWN(menu->sel, total); | |
| 9756 | } | |
| 9757 | else if(ui_pressed_repeat_throttle(machine, IPT_UI_LEFT, kHorizontalSlowKeyRepeatRate)) | |
| 9758 | { | |
| 9759 | toggle = 1; | |
| 9760 | } | |
| 9761 | else if(ui_pressed_repeat_throttle(machine, IPT_UI_RIGHT, kHorizontalSlowKeyRepeatRate)) | |
| 9762 | { | |
| 9763 | toggle = 1; | |
| 9764 | } | |
| 9765 | else if(input_ui_pressed(machine, IPT_UI_SELECT)) | |
| 9766 | { | |
| 9767 | switch(menu->sel) | |
| 9768 | { | |
| 9769 | case MENU_RELOAD_CHEAT_CODE: | |
| 9770 | reload_cheat_database(machine); | |
| 9771 | break; | |
| 9772 | ||
| 9773 | case MENU_TOGGLE_CHEAT: | |
| 9774 | case MENU_TOGGLE_WATCHPOINT: | |
| 9775 | toggle = 1; | |
| 9776 | break; | |
| 9777 | ||
| 9778 | case MENU_SAVE_DESCRIPTION: | |
| 9779 | save_description(machine); | |
| 9780 | break; | |
| 9781 | ||
| 9782 | case MENU_SAVE_RAW_CODE: | |
| 9783 | save_raw_code(machine); | |
| 9784 | break; | |
| 9785 | ||
| 9786 | case MENU_RETURN: | |
| 9787 | menu->sel = -1; | |
| 9788 | break; | |
| 9789 | } | |
| 9790 | } | |
| 9791 | else if(input_ui_pressed(machine, IPT_UI_CANCEL)) | |
| 9792 | { | |
| 9793 | menu->sel = -1; | |
| 9794 | } | |
| 9795 | ||
| 9796 | if(toggle) | |
| 9797 | { | |
| 9798 | if(menu->sel == MENU_TOGGLE_CHEAT) cheats_disabled ^= 1; | |
| 9799 | else if(menu->sel == MENU_TOGGLE_WATCHPOINT) watches_disabled ^= 1; | |
| 9800 | } | |
| 9801 | ||
| 9802 | return menu->sel + 1; | |
| 9803 | } | |
| 9804 | ||
| 9645 | 9805 | #ifdef MAME_DEBUG |
| 9646 | 9806 | /*----------------------------------------------------------------------- |
| 9647 | 9807 | check_activation_key_code_menu - key code checker for activation key |
| r2844 | r2845 | |
| 10034 | 10194 | if(ShiftKeyPressed()) |
| 10035 | 10195 | { |
| 10036 | 10196 | /* ##### WATCHPOINT ##### */ |
| 10037 | watches | |
| 10197 | watches_disabled ^= 1; | |
| 10038 | 10198 | |
| 10039 | ui_popup_time(1, "Watchpoints %s", watches | |
| 10199 | ui_popup_time(1, "Watchpoints %s", watches_disabled ? "Off" : "On"); | |
| 10040 | 10200 | } |
| 10041 | 10201 | else |
| 10042 | 10202 | { |
| 10043 | 10203 | /* ##### CHEAT ##### */ |
| 10044 | cheats | |
| 10204 | cheats_disabled ^= 1; | |
| 10045 | 10205 | |
| 10046 | ui_popup_time(1, "Cheats %s", cheats | |
| 10206 | ui_popup_time(1, "Cheats %s", cheats_disabled ? "Off" : "On"); | |
| 10047 | 10207 | |
| 10048 | if(cheats | |
| 10208 | if(cheats_disabled) | |
| 10049 | 10209 | { |
| 10050 | 10210 | for(i = 0; i < cheat_list_length; i++) |
| 10051 | | |
| 10211 | temp_deactivate_cheat(&cheat_list[i]); | |
| 10052 | 10212 | } |
| 10053 | 10213 | } |
| 10054 | 10214 | } |
| 10055 | 10215 | |
| 10056 | if(cheats | |
| 10216 | if(cheats_disabled) | |
| 10057 | 10217 | return; |
| 10058 | 10218 | |
| 10059 | 10219 | for(i = 0; i < cheat_list_length; i++) |
| r2844 | r2845 | |
| 10138 | 10298 | { |
| 10139 | 10299 | int i; |
| 10140 | 10300 | |
| 10141 | if(watches | |
| 10301 | if(watches_disabled) | |
| 10142 | 10302 | return; |
| 10143 | 10303 | |
| 10144 | 10304 | for(i = 0; i < watch_list_length; i++) |
| r2844 | r2845 | |
| 10186 | 10346 | switch(EXTRACT_FIELD(info->cpu, AddressSpace)) |
| 10187 | 10347 | { |
| 10188 | 10348 | case kAddressSpace_Program: |
| 10189 | data = ( | |
| 10349 | data = (do_cpu_read(cpu, address, kSearchByteIncrementTable[info->element_bytes], cpu_needs_swap(cpu)) + info->add_value) & kSearchByteMaskTable[info->element_bytes]; | |
| 10190 | 10350 | break; |
| 10191 | 10351 | |
| 10192 | 10352 | case kAddressSpace_DataSpace: |
| 10193 | 10353 | case kAddressSpace_IOSpace: |
| 10194 | 10354 | case kAddressSpace_OpcodeRAM: |
| 10195 | 10355 | { |
| 10196 | UINT8 * | |
| 10356 | UINT8 * | |
| 10197 | 10357 | |
| 10198 | 10358 | if(buf) |
| 10199 | data = | |
| 10359 | data = do_memory_read(buf, address, kSearchByteIncrementTable[info->element_bytes], cpu_needs_swap(cpu) + info->add_value, get_cpu_info(cpu)) & | |
| 10200 | 10360 | kSearchByteMaskTable[info->element_bytes]; |
| 10201 | 10361 | } |
| 10202 | 10362 | break; |
| r2844 | r2845 | |
| 10210 | 10370 | UINT8 * buf = memory_region(info->cpu); |
| 10211 | 10371 | |
| 10212 | 10372 | if(buf) |
| 10213 | data = | |
| 10373 | data = do_memory_read(buf, address, kSearchByteIncrementTable[info->element_bytes], | |
| 10214 | 10374 | region_needs_swap(info->cpu) + info->add_value, |
| 10215 | 10375 | get_region_info(info->cpu)) & kSearchByteMaskTable[info->element_bytes]; |
| 10216 | 10376 | } |
| r2844 | r2845 | |
| 10343 | 10503 | cheat_list[idx].action_list[0].extend_data = ~0; |
| 10344 | 10504 | cheat_list[idx].action_list[0].last_value = NULL; |
| 10345 | 10505 | |
| 10346 | SET_MESSAGE( | |
| 10506 | SET_MESSAGE( | |
| 10347 | 10507 | } |
| 10348 | 10508 | |
| 10349 | 10509 | /*------------------------------------------------ |
| r2844 | r2845 | |
| 10355 | 10515 | /* if selected point is not cheat entry, no action */ |
| 10356 | 10516 | if(idx >= cheat_list_length) |
| 10357 | 10517 | { |
| 10358 | SET_MESSAGE( | |
| 10518 | SET_MESSAGE( | |
| 10359 | 10519 | return; |
| 10360 | 10520 | } |
| 10361 | 10521 | |
| r2844 | r2845 | |
| 10371 | 10531 | /* realloc cheat entry */ |
| 10372 | 10532 | resize_cheat_list(cheat_list_length - 1, NO_DISPOSE); |
| 10373 | 10533 | |
| 10374 | SET_MESSAGE( | |
| 10534 | SET_MESSAGE( | |
| 10375 | 10535 | } |
| 10376 | 10536 | |
| 10377 | 10537 | /*-------------------------------------------------------------------------------- |
| r2844 | r2845 | |
| 10482 | 10642 | { |
| 10483 | 10643 | if(idx >= entry->actionListLength) |
| 10484 | 10644 | { |
| 10485 | SET_MESSAGE( | |
| 10645 | SET_MESSAGE( | |
| 10486 | 10646 | return; |
| 10487 | 10647 | } |
| 10488 | 10648 | |
| r2844 | r2845 | |
| 10493 | 10653 | |
| 10494 | 10654 | ResizeCheatActionListNoDispose(entry, entry->actionListLength - 1); |
| 10495 | 10655 | |
| 10496 | SET_MESSAGE( | |
| 10656 | SET_MESSAGE( | |
| 10497 | 10657 | } |
| 10498 | 10658 | #endif |
| 10499 | 10659 | /*---------------------------------------------- |
| r2844 | r2845 | |
| 10605 | 10765 | /* if selected item is not watchpoint, no delete */ |
| 10606 | 10766 | if(idx >= watch_list_length) |
| 10607 | 10767 | { |
| 10608 | SET_MESSAGE( | |
| 10768 | SET_MESSAGE( | |
| 10609 | 10769 | return; |
| 10610 | 10770 | } |
| 10611 | 10771 | |
| r2844 | r2845 | |
| 10681 | 10841 | action->original_address = watch->address; |
| 10682 | 10842 | action->extend_data = ~0; |
| 10683 | 10843 | action->last_value = NULL; |
| 10684 | action->data = | |
| 10844 | action->data = read_data(action); | |
| 10685 | 10845 | SET_FIELD(action->type, AddressSize, watch->element_bytes); |
| 10686 | 10846 | |
| 10687 | 10847 | /* set name */ |
| r2844 | r2845 | |
| 10690 | 10850 | |
| 10691 | 10851 | update_cheat_info(entry, 0); |
| 10692 | 10852 | |
| 10693 | SET_MESSAGE( | |
| 10853 | SET_MESSAGE( | |
| 10694 | 10854 | } |
| 10695 | 10855 | else |
| 10696 | SET_MESSAGE( | |
| 10856 | SET_MESSAGE( | |
| 10697 | 10857 | } |
| 10698 | 10858 | |
| 10699 | 10859 | /*--------------------------------------------------------------------------- |
| r2844 | r2845 | |
| 10735 | 10895 | |
| 10736 | 10896 | update_cheat_info(entry, 0); |
| 10737 | 10897 | |
| 10738 | SET_MESSAGE( | |
| 10898 | SET_MESSAGE( | |
| 10739 | 10899 | } |
| 10740 | 10900 | else |
| 10741 | SET_MESSAGE( | |
| 10901 | SET_MESSAGE( | |
| 10742 | 10902 | } |
| 10743 | 10903 | |
| 10744 | 10904 | /*---------------------------------------------------------------------- |
| r2844 | r2845 | |
| 10765 | 10925 | watch->label[0] = 0; |
| 10766 | 10926 | } |
| 10767 | 10927 | else |
| 10768 | SET_MESSAGE( | |
| 10928 | SET_MESSAGE( | |
| 10769 | 10929 | } |
| 10770 | 10930 | |
| 10771 | 10931 | /*------------------------------------------------------------------ |
| r2844 | r2845 | |
| 10963 | 11123 | { |
| 10964 | 11124 | UINT32 address = region->address + offset; |
| 10965 | 11125 | |
| 10966 | | |
| 11126 | | |
| 10967 | 11127 | { |
| 10968 | case kRegionType_CPU: | |
| 10969 | return DoCPURead(region->target_idx, address, size, cpu_needs_swap(region->target_idx) ^ swap); | |
| 11128 | UINT8 *buf = (UINT8 *)region->cached_pointer; | |
| 10970 | 11129 | |
| 10971 | case kRegionType_Memory: | |
| 10972 | { | |
| 10973 | UINT8 * buf = (UINT8 *)region->cached_pointer; | |
| 11130 | if(buf) | |
| 11131 | // return do_memory_read(region->cached_pointer, address, size, swap, &raw_cpu_info); | |
| 11132 | return do_memory_read(buf, address, size, cpu_needs_swap(region->target_idx) ^ swap, get_cpu_info(region->target_idx)); | |
| 11133 | else | |
| 11134 | return 0; | |
| 11135 | } | |
| 10974 | 11136 | |
| 10975 | if(buf) | |
| 10976 | /* return DoMemoryRead(region->cached_pointer, address, size, swap, &raw_cpu_info); */ | |
| 10977 | return DoMemoryRead(buf, address, size, cpu_needs_swap(region->target_idx) ^ swap, get_cpu_info(region->target_idx)); | |
| 10978 | else | |
| 10979 | return 0; | |
| 10980 | } | |
| 11137 | if(region->target_type == kRegionType_CPU) | |
| 11138 | { | |
| 11139 | /* NOTE : it conflicts cpu_spinutil() and causes the crash... */ | |
| 11140 | return do_cpu_read(region->target_idx, address, size, cpu_needs_swap(region->target_idx) ^ swap); | |
| 10981 | 11141 | } |
| 10982 | 11142 | |
| 10983 | 11143 | return 0; |
| r2844 | r2845 | |
| 11014 | 11174 | info->backup_valid = 0; |
| 11015 | 11175 | |
| 11016 | 11176 | #if 1 |
| 11017 | SET_MESSAGE( | |
| 11177 | SET_MESSAGE( | |
| 11018 | 11178 | #else |
| 11019 | 11179 | ui_popup_time(1, "values restored"); /* not displayed when ui is opend */ |
| 11020 | 11180 | #endif |
| r2844 | r2845 | |
| 11022 | 11182 | else |
| 11023 | 11183 | { |
| 11024 | 11184 | #if 1 |
| 11025 | SET_MESSAGE( | |
| 11185 | SET_MESSAGE( | |
| 11026 | 11186 | #else |
| 11027 | 11187 | ui_popup_time(1, "there are no old values"); /* not displayed when ui is opend */ |
| 11028 | 11188 | #endif |
| r2844 | r2845 | |
| 11220 | 11380 | region->flags &= ~kRegionFlag_Enabled; |
| 11221 | 11381 | region->flags |= kRegionFlag_HasError; |
| 11222 | 11382 | |
| 11223 | SET_MESSAGE( | |
| 11383 | SET_MESSAGE( | |
| 11224 | 11384 | } |
| 11225 | 11385 | } |
| 11226 | 11386 | else |
| r2844 | r2845 | |
| 11252 | 11412 | { |
| 11253 | 11413 | if(info->search_speed == SEARCH_SPEED_ALL_MEMORY) |
| 11254 | 11414 | { |
| 11415 | /* All Memory = 1 search region */ | |
| 11255 | 11416 | UINT32 length = cpu_info_list[info->target_idx].address_mask + 1; |
| 11256 | 11417 | search_region *region; |
| 11257 | 11418 | |
| r2844 | r2845 | |
| 11291 | 11452 | |
| 11292 | 11453 | map = memory_get_address_map(info->target_idx, ADDRESS_SPACE_PROGRAM); |
| 11293 | 11454 | |
| 11455 | /* calculate total search entries */ | |
| 11294 | 11456 | for(entry = map->entrylist; entry != NULL; entry = entry->next) |
| 11295 | 11457 | if(entry->write.generic) |
| 11296 | 11458 | count++; |
| r2844 | r2845 | |
| 11301 | 11463 | |
| 11302 | 11464 | for(entry = map->entrylist; entry != NULL; entry = entry->next) |
| 11303 | 11465 | { |
| 11304 | if | |
| 11466 | if | |
| 11305 | 11467 | { |
| 11306 | 11468 | UINT32 length = (entry->addrend - entry->addrstart) + 1; |
| 11307 | 11469 | |
| 11308 | traverse->address = entry->addrstart; | |
| 11309 | traverse->length = length; | |
| 11310 | traverse->target_idx = info->target_idx; | |
| 11311 | traverse->target_type = info->target_type; | |
| 11312 | traverse->write_handler = entry; | |
| 11313 | traverse->first = NULL; | |
| 11314 | traverse->last = NULL; | |
| 11315 | traverse->status = NULL; | |
| 11316 | traverse->backup_last = NULL; | |
| 11317 | traverse->backup_status = NULL; | |
| 11470 | traverse->address = entry->addrstart; | |
| 11471 | traverse->length = length; | |
| 11472 | traverse->target_idx = info->target_idx; | |
| 11473 | traverse->target_type = info->target_type; | |
| 11474 | traverse->cached_pointer = get_memory_region_base_pointer(info->target_idx, kAddressSpace_DirectMemory, entry->addrstart); | |
| 11475 | traverse->write_handler = entry; | |
| 11476 | traverse->first = NULL; | |
| 11477 | traverse->last = NULL; | |
| 11478 | traverse->status = NULL; | |
| 11479 | traverse->backup_last = NULL; | |
| 11480 | traverse->backup_status = NULL; | |
| 11318 | 11481 | |
| 11319 | 11482 | if(is_search_region_in_range(info->target_idx, length) == 0) |
| 11320 | 11483 | { |
| r2844 | r2845 | |
| 11339 | 11502 | } |
| 11340 | 11503 | } |
| 11341 | 11504 | |
| 11342 | /*--------------------------------------------------------------------- | |
| 11343 | ConvertOldCode - convert old format code to new when load database | |
| 11344 | ---------------------------------------------------------------------*/ | |
| 11505 | /*------------------------------------------------------------------------- | |
| 11506 | convert_older_code - convert old format code to new when load database | |
| 11507 | -------------------------------------------------------------------------*/ | |
| 11345 | 11508 | |
| 11346 | static int | |
| 11509 | static int convert_older_code(int code, int cpu, int * | |
| 11347 | 11510 | { |
| 11348 | 11511 | enum |
| 11349 | 11512 | { |
| 11350 | kCustomField_None = 0, | |
| 11351 | kCustomField_DontApplyCPUField = 1 << 0, | |
| 11352 | kCustomField_SetBit = 1 << 1, | |
| 11353 | kCustomField_ClearBit = 1 << 2, | |
| 11354 | kCustomField_SubtractOne = 1 << 3, | |
| 11513 | CUSTOM_FIELD_NONE = 0, | |
| 11514 | CUSTOM_FIELD_DONT_APPLY_CPU_FIELD = 1 << 0, | |
| 11515 | CUSTOM_FIELD_SET_BIT = 1 << 1, | |
| 11516 | CUSTOM_FIELD_CLEAR_BIT = 1 << 2, | |
| 11517 | CUSTOM_FIELD_SUBTRACT_ONE = 1 << 3, | |
| 11518 | CUSTOM_FIELD_BIT_MASK = CUSTOM_FIELD_SET_BIT | CUSTOM_FIELD_CLEAR_BIT, | |
| 11355 | 11519 | |
| 11356 | kCustomField_BitMask = kCustomField_SetBit | | |
| 11357 | kCustomField_ClearBit, | |
| 11358 | kCustomField_End = 0xFF | |
| 11520 | CUSTOM_FIELD_END = 0xFF | |
| 11359 | 11521 | }; |
| 11360 | 11522 | |
| 11361 | struct | |
| 11523 | struct _conversion_table | |
| 11362 | 11524 | { |
| 11363 | int oldCode; | |
| 11364 | UINT32 newCode; | |
| 11365 | UINT8 customField; | |
| 11525 | int old_code; | |
| 11526 | UINT32 new_code; | |
| 11527 | UINT8 custom_field; | |
| 11366 | 11528 | }; |
| 11367 | 11529 | |
| 11368 | static const struct | |
| 11530 | static const struct _conversion_table c | |
| 11369 | 11531 | { |
| 11370 | { 0, 0x00000000, kCustomField_None }, | |
| 11371 | { 1, 0x00000001, kCustomField_None }, | |
| 11372 | { 2, 0x00000020, kCustomField_None }, | |
| 11373 | { 3, 0x00000040, kCustomField_None }, | |
| 11374 | { 4, 0x000000A0, kCustomField_None }, | |
| 11375 | { 5, 0x00000022, kCustomField_None }, | |
| 11376 | { 6, 0x00000042, kCustomField_None }, | |
| 11377 | { 7, 0x000000A2, kCustomField_None }, | |
| 11378 | { 8, 0x00000024, kCustomField_None }, | |
| 11379 | { 9, 0x00000044, kCustomField_None }, | |
| 11380 | { 10, 0x00000064, kCustomField_None }, | |
| 11381 | { 11, 0x00000084, kCustomField_None }, | |
| 11382 | { 15, 0x00000023, kCustomField_None }, | |
| 11383 | { 16, 0x00000043, kCustomField_None }, | |
| 11384 | { 17, 0x000000A3, kCustomField_None }, | |
| 11385 | { 20, 0x00000000, kCustomField_SetBit }, | |
| 11386 | { 21, 0x00000001, kCustomField_SetBit }, | |
| 11387 | { 22, 0x00000020, kCustomField_SetBit }, | |
| 11388 | { 23, 0x00000040, kCustomField_SetBit }, | |
| 11389 | { 24, 0x000000A0, kCustomField_SetBit }, | |
| 11390 | { 40, 0x00000000, kCustomField_ClearBit }, | |
| 11391 | { 41, 0x00000001, kCustomField_ClearBit }, | |
| 11392 | { 42, 0x00000020, kCustomField_ClearBit }, | |
| 11393 | { 43, 0x00000040, kCustomField_ClearBit }, | |
| 11394 | { 44, 0x000000A0, kCustomField_ClearBit }, | |
| 11395 | { 60, 0x00000103, kCustomField_None }, | |
| 11396 | { 61, 0x00000303, kCustomField_None }, | |
| 11397 | { 62, 0x00000503, kCustomField_SubtractOne }, | |
| 11398 | { 63, 0x00000903, kCustomField_None }, | |
| 11399 | { 64, 0x00000B03, kCustomField_None }, | |
| 11400 | { 65, 0x00000D03, kCustomField_SubtractOne }, | |
| 11401 | { 70, 0x00000101, kCustomField_None }, | |
| 11402 | { 71, 0x00000301, kCustomField_None }, | |
| 11403 | { 72, 0x00000501, kCustomField_SubtractOne }, | |
| 11404 | { 73, 0x00000901, kCustomField_None }, | |
| 11405 | { 74, 0x00000B01, kCustomField_None }, | |
| 11406 | { 75, 0x00000D01, kCustomField_SubtractOne }, | |
| 11407 | { 80, 0x00000102, kCustomField_None }, | |
| 11408 | { 81, 0x00000302, kCustomField_None }, | |
| 11409 | { 82, 0x00000502, kCustomField_SubtractOne }, | |
| 11410 | { 83, 0x00000902, kCustomField_None }, | |
| 11411 | { 84, 0x00000B02, kCustomField_None }, | |
| 11412 | { 85, 0x00000D02, kCustomField_SubtractOne }, | |
| 11413 | { 90, 0x00000100, kCustomField_None }, | |
| 11414 | { 91, 0x00000300, kCustomField_None }, | |
| 11415 | { 92, 0x00000500, kCustomField_SubtractOne }, | |
| 11416 | { 93, 0x00000900, kCustomField_None }, | |
| 11417 | { 94, 0x00000B00, kCustomField_None }, | |
| 11418 | { 95, 0x00000D00, kCustomField_SubtractOne }, | |
| 11419 | { 100, 0x20800000, kCustomField_None }, | |
| 11420 | { 101, 0x20800001, kCustomField_None }, | |
| 11421 | { 102, 0x20800000, kCustomField_None }, | |
| 11422 | { 103, 0x20800001, kCustomField_None }, | |
| 11423 | { 110, 0x40800000, kCustomField_None }, | |
| 11424 | { 111, 0x40800001, kCustomField_None }, | |
| 11425 | { 112, 0x40800000, kCustomField_None }, | |
| 11426 | { 113, 0x40800001, kCustomField_None }, | |
| 11427 | { 120, 0x63000001, kCustomField_None }, | |
| 11428 | { 121, 0x63000001, kCustomField_DontApplyCPUField | kCustomField_SetBit }, | |
| 11429 | { 122, 0x63000001, kCustomField_DontApplyCPUField | kCustomField_ClearBit }, | |
| 11430 | { 998, 0x00000006, kCustomField_None }, | |
| 11431 | { 999, 0x60000000, kCustomField_DontApplyCPUField }, | |
| 11432 | { -1, 0x00000000, kCustomField_End } | |
| 11532 | { 0, 0x00000000, CUSTOM_FIELD_NONE }, | |
| 11533 | { 1, 0x00000001, CUSTOM_FIELD_NONE }, | |
| 11534 | { 2, 0x00000020, CUSTOM_FIELD_NONE }, | |
| 11535 | { 3, 0x00000040, CUSTOM_FIELD_NONE }, | |
| 11536 | { 4, 0x000000A0, CUSTOM_FIELD_NONE }, | |
| 11537 | { 5, 0x00000022, CUSTOM_FIELD_NONE }, | |
| 11538 | { 6, 0x00000042, CUSTOM_FIELD_NONE }, | |
| 11539 | { 7, 0x000000A2, CUSTOM_FIELD_NONE }, | |
| 11540 | { 8, 0x00000024, CUSTOM_FIELD_NONE }, | |
| 11541 | { 9, 0x00000044, CUSTOM_FIELD_NONE }, | |
| 11542 | { 10, 0x00000064, CUSTOM_FIELD_NONE }, | |
| 11543 | { 11, 0x00000084, CUSTOM_FIELD_NONE }, | |
| 11544 | { 15, 0x00000023, CUSTOM_FIELD_NONE }, | |
| 11545 | { 16, 0x00000043, CUSTOM_FIELD_NONE }, | |
| 11546 | { 17, 0x000000A3, CUSTOM_FIELD_NONE }, | |
| 11547 | { 20, 0x00000000, CUSTOM_FIELD_SET_BIT }, | |
| 11548 | { 21, 0x00000001, CUSTOM_FIELD_SET_BIT }, | |
| 11549 | { 22, 0x00000020, CUSTOM_FIELD_SET_BIT }, | |
| 11550 | { 23, 0x00000040, CUSTOM_FIELD_SET_BIT }, | |
| 11551 | { 24, 0x000000A0, CUSTOM_FIELD_SET_BIT }, | |
| 11552 | { 40, 0x00000000, CUSTOM_FIELD_CLEAR_BIT }, | |
| 11553 | { 41, 0x00000001, CUSTOM_FIELD_CLEAR_BIT }, | |
| 11554 | { 42, 0x00000020, CUSTOM_FIELD_CLEAR_BIT }, | |
| 11555 | { 43, 0x00000040, CUSTOM_FIELD_CLEAR_BIT }, | |
| 11556 | { 44, 0x000000A0, CUSTOM_FIELD_CLEAR_BIT }, | |
| 11557 | { 60, 0x00000103, CUSTOM_FIELD_NONE }, | |
| 11558 | { 61, 0x00000303, CUSTOM_FIELD_NONE }, | |
| 11559 | { 62, 0x00000503, CUSTOM_FIELD_SUBTRACT_ONE }, | |
| 11560 | { 63, 0x00000903, CUSTOM_FIELD_NONE }, | |
| 11561 | { 64, 0x00000B03, CUSTOM_FIELD_NONE }, | |
| 11562 | { 65, 0x00000D03, CUSTOM_FIELD_SUBTRACT_ONE }, | |
| 11563 | { 70, 0x00000101, CUSTOM_FIELD_NONE }, | |
| 11564 | { 71, 0x00000301, CUSTOM_FIELD_NONE }, | |
| 11565 | { 72, 0x00000501, CUSTOM_FIELD_SUBTRACT_ONE }, | |
| 11566 | { 73, 0x00000901, CUSTOM_FIELD_NONE }, | |
| 11567 | { 74, 0x00000B01, CUSTOM_FIELD_NONE }, | |
| 11568 | { 75, 0x00000D01, CUSTOM_FIELD_SUBTRACT_ONE }, | |
| 11569 | { 80, 0x00000102, CUSTOM_FIELD_NONE }, | |
| 11570 | { 81, 0x00000302, CUSTOM_FIELD_NONE }, | |
| 11571 | { 82, 0x00000502, CUSTOM_FIELD_SUBTRACT_ONE }, | |
| 11572 | { 83, 0x00000902, CUSTOM_FIELD_NONE }, | |
| 11573 | { 84, 0x00000B02, CUSTOM_FIELD_NONE }, | |
| 11574 | { 85, 0x00000D02, CUSTOM_FIELD_SUBTRACT_ONE }, | |
| 11575 | { 90, 0x00000100, CUSTOM_FIELD_NONE }, | |
| 11576 | { 91, 0x00000300, CUSTOM_FIELD_NONE }, | |
| 11577 | { 92, 0x00000500, CUSTOM_FIELD_SUBTRACT_ONE }, | |
| 11578 | { 93, 0x00000900, CUSTOM_FIELD_NONE }, | |
| 11579 | { 94, 0x00000B00, CUSTOM_FIELD_NONE }, | |
| 11580 | { 95, 0x00000D00, CUSTOM_FIELD_SUBTRACT_ONE }, | |
| 11581 | { 100, 0x20800000, CUSTOM_FIELD_NONE }, | |
| 11582 | { 101, 0x20800001, CUSTOM_FIELD_NONE }, | |
| 11583 | { 102, 0x20800000, CUSTOM_FIELD_NONE }, | |
| 11584 | { 103, 0x20800001, CUSTOM_FIELD_NONE }, | |
| 11585 | { 110, 0x40800000, CUSTOM_FIELD_NONE }, | |
| 11586 | { 111, 0x40800001, CUSTOM_FIELD_NONE }, | |
| 11587 | { 112, 0x40800000, CUSTOM_FIELD_NONE }, | |
| 11588 | { 113, 0x40800001, CUSTOM_FIELD_NONE }, | |
| 11589 | { 120, 0x63000001, CUSTOM_FIELD_NONE }, | |
| 11590 | { 121, 0x63000001, CUSTOM_FIELD_DONT_APPLY_CPU_FIELD | CUSTOM_FIELD_SET_BIT }, | |
| 11591 | { 122, 0x63000001, CUSTOM_FIELD_DONT_APPLY_CPU_FIELD | CUSTOM_FIELD_CLEAR_BIT }, | |
| 11592 | { 998, 0x00000006, CUSTOM_FIELD_NONE }, | |
| 11593 | { 999, 0x60000000, CUSTOM_FIELD_DONT_APPLY_CPU_FIELD }, | |
| 11594 | { -1, 0x00000000, CUSTOM_FIELD_END } | |
| 11433 | 11595 | }; |
| 11434 | 11596 | |
| 11435 | const struct | |
| 11597 | const struct _conversion_table * | |
| 11436 | 11598 | |
| 11437 | UINT8 linkCheat = 0; | |
| 11438 | UINT32 newCode; | |
| 11599 | UINT8 link_cheat = 0; | |
| 11600 | UINT32 new_code; | |
| 11439 | 11601 | |
| 11440 | 11602 | /* convert link cheats */ |
| 11441 | 11603 | if((code >= 500) && (code <= 699)) |
| 11442 | 11604 | { |
| 11443 | link | |
| 11605 | link_cheat = 1; | |
| 11444 | 11606 | code -= 500; |
| 11445 | 11607 | } |
| 11446 | 11608 | |
| 11447 | 11609 | /* look up code */ |
| 11448 | while(traverse->old | |
| 11610 | while(traverse->old_code >= 0) | |
| 11449 | 11611 | { |
| 11450 | if(code == traverse->oldCode) | |
| 11451 | goto foundCode; | |
| 11612 | if(code == traverse->old_code) | |
| 11613 | goto found_code; | |
| 11452 | 11614 | traverse++; |
| 11453 | 11615 | } |
| 11454 | 11616 | |
| 11455 | logerror(" | |
| 11617 | logerror("ch | |
| 11456 | 11618 | |
| 11457 | 11619 | /* not found */ |
| 11458 | *extend | |
| 11620 | *extend_data = 0; | |
| 11459 | 11621 | return 0; |
| 11460 | 11622 | |
| 11461 | 11623 | /* found */ |
| 11462 | found | |
| 11624 | found_code: | |
| 11463 | 11625 | |
| 11464 | new | |
| 11626 | new_code = traverse->new_code; | |
| 11465 | 11627 | |
| 11466 | 11628 | /* add in the CPU field */ |
| 11467 | if(!(traverse->customField & kCustomField_DontApplyCPUField)) | |
| 11468 | newCode = (newCode & ~0x1F000000) | ((cpu << 24) & 0x1F000000); | |
| 11629 | if((traverse->custom_field & CUSTOM_FIELD_DONT_APPLY_CPU_FIELD) == 0) | |
| 11630 | new_code = (new_code & ~0x1F000000) | ((cpu << 24) & 0x1F000000); | |
| 11469 | 11631 | |
| 11470 | 11632 | /* hack-ish, subtract one from data field for x5 user select */ |
| 11471 | if(traverse->customField & kCustomField_SubtractOne) | |
| 11472 | (*data)--; // yaay for C operator precedence | |
| 11633 | if(traverse->custom_field & CUSTOM_FIELD_SUBTRACT_ONE) | |
| 11634 | /* yaay for C operator precedence */ | |
| 11635 | (*data)--; | |
| 11473 | 11636 | |
| 11474 | 11637 | /* set up the extend data */ |
| 11475 | if(traverse->customField & kCustomField_BitMask) | |
| 11476 | *extendData = *data; | |
| 11638 | if(traverse->custom_field & CUSTOM_FIELD_BIT_MASK) | |
| 11639 | *extend_data = *data; | |
| 11477 | 11640 | else |
| 11478 | *extend | |
| 11641 | *extend_data = 0xFFFFFFFF; | |
| 11479 | 11642 | |
| 11480 | if(traverse->custom | |
| 11643 | if(traverse->custom_field & | |
| 11481 | 11644 | *data = 0; |
| 11482 | 11645 | |
| 11483 | if(linkCheat) | |
| 11484 | SET_MASK_FIELD(newCode, LinkEnable); | |
| 11646 | if(link_cheat) | |
| 11647 | SET_MASK_FIELD(new_code, LinkEnable); | |
| 11485 | 11648 | |
| 11486 | return new | |
| 11649 | return new_code; | |
| 11487 | 11650 | } |
| 11488 | 11651 | |
| 11489 | 11652 | /*---------------------- |
| r2844 | r2845 | |
| 11497 | 11660 | if(EXTRACT_FIELD(action->type, LocationType) == kLocation_IndirectIndexed) { |
| 11498 | 11661 | SET_FIELD(new_type, CodeType, kCodeType_IWrite); |
| 11499 | 11662 | SET_FIELD(new_type, CodeParameter, EXTRACT_FIELD(action->type, LocationParameterOption)); } |
| 11500 | SET_FIELD(new_type, AddressSize, | |
| 11663 | SET_FIELD(new_type, AddressSize, EXTRACT_FIELD(a | |
| 11501 | 11664 | SET_MASK_FIELD(new_type, Endianness); |
| 11502 | 11665 | if(TEST_FIELD(action->type, RestorePreviousValue)) |
| 11503 | 11666 | SET_MASK_FIELD(new_type, RestoreValue); |
| r2844 | r2845 | |
| 11513 | 11676 | handle_local_command_cheat - handle specified cheat command code |
| 11514 | 11677 | -------------------------------------------------------------------*/ |
| 11515 | 11678 | |
| 11516 | static void handle_local_command_cheat(running_machine *machine, int cpu, int type, int address, int data, UINT8 format) | |
| 11679 | static void handle_local_command_cheat(running_machine *machine, int cpu, int type, int address, int data, int extend_data, UINT8 format) | |
| 11517 | 11680 | { |
| 11518 | 11681 | int command = 0; |
| 11519 | 11682 | |
| r2844 | r2845 | |
| 11522 | 11685 | switch(EXTRACT_FIELD(type, LocationParameter)) |
| 11523 | 11686 | { |
| 11524 | 11687 | case kCustomLocation_AssignActivationKey: |
| 11525 | command = CUSTOM_CODE_ACTIVATION_KEY_1; | |
| 11526 | ||
| 11527 | if(TEST_FIELD(type, OneShot)) | |
| 11528 | command = CUSTOM_CODE_ACTIVATION_KEY_2; | |
| 11688 | command = CUSTOM_CODE_ACTIVATION_KEY; | |
| 11529 | 11689 | break; |
| 11530 | 11690 | |
| 11531 | 11691 | case kCustomLocation_Enable: |
| r2844 | r2845 | |
| 11549 | 11709 | |
| 11550 | 11710 | switch(command) |
| 11551 | 11711 | { |
| 11552 | case CUSTOM_CODE_ACTIVATION_KEY_1: | |
| 11553 | case CUSTOM_CODE_ACTIVATION_KEY_2: | |
| 11712 | case CUSTOM_CODE_ACTIVATION_KEY: | |
| 11554 | 11713 | if(address < cheat_list_length) |
| 11555 | 11714 | { |
| 11556 | 11715 | cheat_entry *entry = &cheat_list[address]; |
| 11557 | 11716 | |
| 11558 | if( | |
| 11717 | if(e | |
| 11559 | 11718 | { |
| 11560 | entry->activation_key2 = data; | |
| 11561 | entry->flags |= kCheatFlag_HasActivationKey2; | |
| 11719 | if(data) | |
| 11720 | { | |
| 11721 | entry->activation_key_1 = data; | |
| 11722 | entry->flags |= kCheatFlag_HasActivationKey1; | |
| 11723 | } | |
| 11724 | else if(extend_data) | |
| 11725 | { | |
| 11726 | entry->activation_key_2 = extend_data; | |
| 11727 | entry->flags |= kCheatFlag_HasActivationKey2; | |
| 11728 | } | |
| 11562 | 11729 | } |
| 11563 | 11730 | else |
| 11564 | 11731 | { |
| 11565 | entry->activation_key1 = data; | |
| 11732 | entry->activation_key_1 = data; | |
| 11566 | 11733 | entry->flags |= kCheatFlag_HasActivationKey1; |
| 11567 | 11734 | } |
| 11568 | 11735 | } |
| r2844 | r2845 | |
| 11573 | 11740 | { |
| 11574 | 11741 | cheat_entry *entry = &cheat_list[address]; |
| 11575 | 11742 | |
| 11576 | | |
| 11743 | activate_cheat(entry); | |
| 11577 | 11744 | |
| 11578 | 11745 | if(data && data < entry->action_list_length) |
| 11579 | 11746 | entry->selection = data; |
| r2844 | r2845 | |
| 11603 | 11770 | } |
| 11604 | 11771 | } |
| 11605 | 11772 | |
| 11773 | /*------------------------------------------------------------------- | |
| 11774 | open_cheat_database - open the cheat database in loading/saveing | |
| 11775 | -------------------------------------------------------------------*/ | |
| 11776 | ||
| 11777 | static UINT8 open_cheat_database(mame_file **the_file, char *file_name, UINT8 flag) | |
| 11778 | { | |
| 11779 | file_error filerr; | |
| 11780 | ||
| 11781 | if(flag == DATABASE_LOAD) | |
| 11782 | { | |
| 11783 | /* load */ | |
| 11784 | filerr = mame_fopen(SEARCHPATH_CHEAT, file_name, OPEN_FLAG_READ, the_file); | |
| 11785 | ||
| 11786 | if(filerr != FILERR_NONE) | |
| 11787 | return 0; | |
| 11788 | } | |
| 11789 | else | |
| 11790 | { | |
| 11791 | /* save */ | |
| 11792 | filerr = mame_fopen(SEARCHPATH_CHEAT, file_name, OPEN_FLAG_WRITE, the_file); | |
| 11793 | ||
| 11794 | if(the_file == NULL) | |
| 11795 | { | |
| 11796 | return 0; | |
| 11797 | } | |
| 11798 | else if(filerr != FILERR_NONE) | |
| 11799 | { | |
| 11800 | /* if the database is not found, create new database */ | |
| 11801 | filerr = mame_fopen(SEARCHPATH_CHEAT, file_name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, the_file); | |
| 11802 | ||
| 11803 | if(filerr != FILERR_NONE) | |
| 11804 | return 0; | |
| 11805 | } | |
| 11806 | } | |
| 11807 | ||
| 11808 | return 1; | |
| 11809 | } | |
| 11810 | ||
| 11606 | 11811 | /*------------------------------------------------------ |
| 11607 | 11812 | load_cheat_option - load cheat option from database |
| 11608 | 11813 | ------------------------------------------------------*/ |
| r2844 | r2845 | |
| 11611 | 11816 | { |
| 11612 | 11817 | static char buf[2048]; |
| 11613 | 11818 | mame_file *the_file; |
| 11614 | file_error filerr; | |
| 11615 | 11819 | cheat_format *format = &cheat_format_table[0]; |
| 11616 | 11820 | |
| 11617 | 11821 | /* open the database */ |
| 11618 | filerr = mame_fopen(SEARCHPATH_CHEAT, file_name, OPEN_FLAG_READ, &the_file); | |
| 11619 | ||
| 11620 | if(filerr != FILERR_NONE) | |
| 11822 | if(open_cheat_database(&the_file, file_name, DATABASE_LOAD) == 0) | |
| 11621 | 11823 | { |
| 11622 | SET_MESSAGE( | |
| 11824 | SET_MESSAGE( | |
| 11623 | 11825 | return; |
| 11624 | 11826 | } |
| 11625 | 11827 | |
| r2844 | r2845 | |
| 11632 | 11834 | if(strlen(pre_command) == format->type_matched) |
| 11633 | 11835 | { |
| 11634 | 11836 | sscanf(pre_command, "%X", &cheat_options); |
| 11635 | SET_MESSAGE( | |
| 11837 | SET_MESSAGE( | |
| 11636 | 11838 | } |
| 11637 | 11839 | } |
| 11638 | 11840 | } |
| r2844 | r2845 | |
| 11648 | 11850 | { |
| 11649 | 11851 | char buf[2048]; |
| 11650 | 11852 | mame_file *the_file; |
| 11651 | file_error filerr; | |
| 11652 | 11853 | |
| 11653 | 11854 | /* open the database */ |
| 11654 | filerr = mame_fopen(SEARCHPATH_CHEAT, file_name, OPEN_FLAG_READ, &the_file); | |
| 11655 | ||
| 11656 | if(filerr != FILERR_NONE) | |
| 11855 | if(open_cheat_database(&the_file, file_name, DATABASE_LOAD) == 0) | |
| 11657 | 11856 | return; |
| 11658 | 11857 | |
| 11659 | 11858 | found_database = 1; |
| r2844 | r2845 | |
| 11663 | 11862 | { |
| 11664 | 11863 | int i; |
| 11665 | 11864 | #ifdef MESS |
| 11666 | int crc; | |
| 11865 | int crc = 0; | |
| 11667 | 11866 | #endif |
| 11668 | int type = 0; | |
| 11669 | int address = 0; | |
| 11670 | int data = 0; | |
| 11671 | int extend_data = 0; | |
| 11672 | int arguments_matched = 0; | |
| 11673 | int format_level = 0; | |
| 11674 | int cpu = 0; | |
| 11675 | int code = 0; | |
| 11676 | char name[16] = { 0 }; | |
| 11677 | char pre_type[16] = { 0 }; | |
| 11678 | char pre_data[16] = { 0 }; | |
| 11679 | char pre_extend_data[16] = { 0 }; | |
| 11680 | char description[256] = { 0 }; | |
| 11681 | char comment[256] = { 0 }; | |
| 11682 | ||
| 11867 | int type = 0; | |
| 11868 | int address = 0; | |
| 11869 | int data = 0; | |
| 11870 | int extend_data = 0; | |
| 11871 | int arguments_matched = 0; | |
| 11872 | int format_level = 0; | |
| 11873 | int cpu = 0; | |
| 11874 | int code = 0; | |
| 11875 | char name[16] = { 0 }; | |
| 11876 | char pre_type[16] = { 0 }; | |
| 11877 | char pre_data[16] = { 0 }; | |
| 11878 | char pre_extend_data[16] = { 0 }; | |
| 11879 | char description[256] = { 0 }; | |
| 11880 | char comment[256] = { 0 }; | |
| 11683 | 11881 | cheat_entry *entry; |
| 11684 | 11882 | cheat_action *action; |
| 11685 | 11883 | |
| r2844 | r2845 | |
| 11759 | 11957 | |
| 11760 | 11958 | if(is_error) |
| 11761 | 11959 | { |
| 11762 | SET_MESSAGE( | |
| 11960 | SET_MESSAGE( | |
| 11763 | 11961 | continue; |
| 11764 | 11962 | } |
| 11765 | 11963 | else |
| r2844 | r2845 | |
| 11777 | 11975 | } |
| 11778 | 11976 | } |
| 11779 | 11977 | else |
| 11780 | type = | |
| 11978 | type = convert_older_code(code, cpu, &data, &extend_data); | |
| 11781 | 11979 | |
| 11782 | 11980 | /* matched! */ |
| 11783 | 11981 | format_level = i; |
| r2844 | r2845 | |
| 11791 | 11989 | /* logerror("cheat: processing %s\n", buf); */ |
| 11792 | 11990 | |
| 11793 | 11991 | /* handle command code */ |
| 11794 | if(cpu >= CUSTOM_CODE_ACTIVATION_KEY | |
| 11992 | if(cpu >= CUSTOM_CODE_ACTIVATION_KEY | |
| 11795 | 11993 | { |
| 11796 | 11994 | /* logerror("cheat: cheat line removed\n", buf); */ |
| 11797 | handle_local_command_cheat(machine, cpu, type, address, data, format_level); | |
| 11995 | handle_local_command_cheat(machine, cpu, type, address, data, extend_data, format_level); | |
| 11798 | 11996 | continue; |
| 11799 | 11997 | } |
| 11800 | 11998 | |
| r2844 | r2845 | |
| 11870 | 12068 | |
| 11871 | 12069 | search_info *info = get_current_search(); |
| 11872 | 12070 | mame_file *the_file; |
| 11873 | file_error filerr; | |
| 11874 | 12071 | cheat_format *format = &cheat_format_table[4]; |
| 11875 | 12072 | |
| 11876 | 12073 | /* 1st, free all search regions in current search_info */ |
| 11877 | 12074 | dispose_search_reigons(info); |
| 11878 | 12075 | |
| 11879 | 12076 | /* 2nd, attempt to open the memorymap file */ |
| 11880 | filerr = mame_fopen(SEARCHPATH_CHEAT, file_name, OPEN_FLAG_READ, &the_file); | |
| 11881 | ||
| 11882 | if(filerr != FILERR_NONE) | |
| 12077 | if(open_cheat_database(&the_file, file_name, DATABASE_LOAD) == 0) | |
| 11883 | 12078 | { |
| 11884 | 12079 | info->region_list_length = 0; |
| 11885 | SET_MESSAGE( | |
| 12080 | SET_MESSAGE( | |
| 11886 | 12081 | return; |
| 11887 | 12082 | } |
| 11888 | 12083 | |
| r2844 | r2845 | |
| 11890 | 12085 | while(mame_fgets(buf, 2048, the_file)) |
| 11891 | 12086 | { |
| 11892 | 12087 | #ifdef MESS |
| 11893 | int crc; | |
| 12088 | int crc; | |
| 11894 | 12089 | #endif |
| 11895 | int cpu; | |
| 11896 | int space; | |
| 11897 | int start; | |
| 11898 | int end; | |
| 11899 | int status; | |
| 11900 | char name[16] = { 0 }; | |
| 11901 | char description[64] = { 0 }; | |
| 11902 | ||
| 11903 | cpu_region_info *cpu_info; | |
| 12090 | int cpu; | |
| 12091 | int space; | |
| 12092 | int start; | |
| 12093 | int end; | |
| 12094 | int status; | |
| 12095 | char name[16] = { 0 }; | |
| 12096 | char description[64] = { 0 }; | |
| 12097 | cpu_region_info *cpu_info; | |
| 11904 | 12098 | search_region *region; |
| 11905 | 12099 | |
| 11906 | 12100 | #ifdef MESS |
| r2844 | r2845 | |
| 11977 | 12171 | region->length = end - start + 1; |
| 11978 | 12172 | region->target_idx = cpu; |
| 11979 | 12173 | |
| 11980 | if( | |
| 12174 | if( | |
| 11981 | 12175 | { |
| 11982 | 12176 | region->target_type = kRegionType_CPU; |
| 11983 | 12177 | region->cached_pointer = NULL; |
| r2844 | r2845 | |
| 11985 | 12179 | else |
| 11986 | 12180 | { |
| 11987 | 12181 | region->target_type = kRegionType_Memory; |
| 11988 | region->cached_pointer | |
| 12182 | region->cached_pointer = get_memory_region_base_pointer(cpu, | |
| 11989 | 12183 | |
| 11990 | 12184 | //logerror("pointer for %s : %p\n", description, region->cachedPointer); |
| 11991 | 12185 | } |
| r2844 | r2845 | |
| 12017 | 12211 | info->region_list_length = count; |
| 12018 | 12212 | |
| 12019 | 12213 | if(info->region_list_length) |
| 12020 | SET_MESSAGE( | |
| 12214 | SET_MESSAGE( | |
| 12021 | 12215 | |
| 12022 | 12216 | mame_fclose(the_file); |
| 12023 | 12217 | } |
| r2844 | r2845 | |
| 12059 | 12253 | if(buf[0]) |
| 12060 | 12254 | { |
| 12061 | 12255 | /* load database based on the name we gotten */ |
| 12062 | if(flags & | |
| 12256 | if(flags & | |
| 12063 | 12257 | load_cheat_option(buf); |
| 12064 | if(flags & | |
| 12258 | if(flags & | |
| 12065 | 12259 | load_cheat_code(machine, buf); |
| 12066 | if(flags & | |
| 12260 | if(flags & | |
| 12067 | 12261 | load_user_defined_search_region(machine, buf); |
| 12068 | 12262 | |
| 12069 | 12263 | out_traverse = buf; |
| r2844 | r2845 | |
| 12084 | 12278 | } |
| 12085 | 12279 | while(data); |
| 12086 | 12280 | |
| 12087 | update_all_cheat_info(); | |
| 12281 | if(flags & LOAD_CHEAT_CODE) | |
| 12282 | update_all_cheat_info(); | |
| 12088 | 12283 | } |
| 12089 | 12284 | |
| 12090 | 12285 | /*--------------------------------------------------------------------------- |
| r2844 | r2845 | |
| 12094 | 12289 | static void reload_cheat_database(running_machine *machine) |
| 12095 | 12290 | { |
| 12096 | 12291 | dispose_cheat_database(); |
| 12097 | load_cheat_database(machine, | |
| 12292 | load_cheat_database(machine, | |
| 12098 | 12293 | |
| 12099 | SET_MESSAGE(found_database ? | |
| 12294 | SET_MESSAGE(found_database ? | |
| 12100 | 12295 | } |
| 12101 | 12296 | |
| 12102 | /*------------------------------------------------- | |
| 12297 | /*-------------------------------------------------- | |
| 12103 | 12298 | dispose_cheat_database - free all cheat entries |
| 12104 | -------------------------------------------------*/ | |
| 12299 | --------------------------------------------------*/ | |
| 12105 | 12300 | |
| 12106 | 12301 | static void dispose_cheat_database(void) |
| 12107 | 12302 | { |
| r2844 | r2845 | |
| 12109 | 12304 | |
| 12110 | 12305 | /* first, turn all cheats "OFF" */ |
| 12111 | 12306 | for(i = 0; i < cheat_list_length; i++) |
| 12112 | | |
| 12307 | temp_deactivate_cheat(&cheat_list[i]); | |
| 12113 | 12308 | |
| 12114 | 12309 | /* next, free memory for all cheat entries */ |
| 12115 | 12310 | if(cheat_list) |
| r2844 | r2845 | |
| 12124 | 12319 | } |
| 12125 | 12320 | } |
| 12126 | 12321 | |
| 12127 | /*------------------------------------------------------ | |
| 12128 | SaveCheatCode - save a cheat code into the database | |
| 12129 | ------------------------------------------------------*/ | |
| 12322 | /*-------------------------------------------------------- | |
| 12323 | save_cheat_code - save a cheat code into the database | |
| 12324 | --------------------------------------------------------*/ | |
| 12130 | 12325 | |
| 12131 | static void | |
| 12326 | static void save_cheat_code(running_machine *machine, cheat_entry *entry) | |
| 12132 | 12327 | { |
| 12133 | #if 0 | |
| 12134 | INT8 i; | |
| 12135 | INT8 error = 0; | |
| 12136 | char buf[4096]; | |
| 12328 | int i; | |
| 12329 | char buf[4096]; | |
| 12330 | mame_file *the_file; | |
| 12137 | 12331 | |
| 12138 | mame_file * theFile; | |
| 12139 | file_error filerr; | |
| 12332 | /* check entry */ | |
| 12333 | if(entry == NULL || entry->action_list == NULL) | |
| 12334 | { | |
| 12335 | SET_MESSAGE(CHEAT_MESSAGE_FAILED_TO_SAVE); | |
| 12336 | return; | |
| 12337 | } | |
| 12140 | 12338 | |
| 12141 | if(entry == NULL || entry->action_list == NULL || ((entry->flags & kCheatFlag_Select) && entry->action_list_length == 1)) | |
| 12142 | error = 1; | |
| 12143 | ||
| 12144 | /* open the database */ | |
| 12145 | if(!error) | |
| 12339 | /* ##### fix me... ##### */ | |
| 12340 | if(entry->flags & kCheatFlag_OldFormat) | |
| 12146 | 12341 | { |
| 12147 | filerr = mame_fopen(SEARCHPATH_CHEAT, main_database_name, OPEN_FLAG_WRITE, &theFile); | |
| 12148 | ||
| 12149 | if(!theFile) | |
| 12150 | error = 1; | |
| 12151 | else if(filerr != FILERR_NONE) | |
| 12152 | { | |
| 12153 | filerr = mame_fopen(SEARCHPATH_CHEAT, main_database_name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &theFile); | |
| 12154 | ||
| 12155 | if(filerr != FILERR_NONE) | |
| 12156 | error = 1; | |
| 12157 | } | |
| 12342 | SET_MESSAGE(CHEAT_MESSAGE_NO_SUPPORTED_OLD_FORMAT); | |
| 12343 | return; | |
| 12158 | 12344 | } |
| 12159 | 12345 | |
| 12160 | if(error) | |
| 12346 | /* open the database */ | |
| 12347 | if(open_cheat_database(&the_file, main_database_name, DATABASE_SAVE) == 0) | |
| 12161 | 12348 | { |
| 12162 | SET_MESSAGE( | |
| 12349 | SET_MESSAGE( | |
| 12163 | 12350 | return; |
| 12164 | 12351 | } |
| 12165 | 12352 | |
| 12166 | mame_fseek(the | |
| 12353 | mame_fseek(the_file, 0, SEEK_END); | |
| 12167 | 12354 | |
| 12168 | /* write the c | |
| 12355 | /* write the c | |
| 12169 | 12356 | for(i = 0; i < entry->action_list_length; i++) |
| 12170 | 12357 | { |
| 12171 | UINT8 addressLength = 8; | |
| 12172 | char * name; | |
| 12173 | char * bufTraverse = buf; | |
| 12358 | UINT8 address_length = 8; | |
| 12359 | char *name; | |
| 12360 | char *buf_strings = buf; | |
| 12361 | cheat_action *action = &entry->action_list[i]; | |
| 12174 | 12362 | |
| 12175 | cheat_action *action = &entry->action_list[i]; | |
| 12176 | ||
| 12177 | 12363 | /* get name */ |
| 12178 | if(!i) | |
| 12179 | name = entry->name; | |
| 12180 | else | |
| 12181 | name = action->optional_name; | |
| 12364 | name = action->optional_name; | |
| 12182 | 12365 | |
| 12183 | 12366 | /* get address length of CPU/Region */ |
| 12184 | address | |
| 12367 | address_length = get_address_length( | |
| 12185 | 12368 | |
| 12186 | 12369 | /* print format */ |
| 12187 | 12370 | #ifdef MESS |
| 12188 | bufTraverse += sprintf(bufTraverse, ">%s:%.8X:%.8X:%.*X:%.8X:%.8X", | |
| 12189 | machine->gamedrv->name, | |
| 12190 | thisGameCRC, | |
| 12191 | action->type, | |
| 12192 | addressLength, | |
| 12193 | action->original_address, | |
| 12194 | action->original_data, | |
| 12195 | action->extend_data); | |
| 12196 | #else | |
| 12197 | bufTraverse += sprintf(bufTraverse, ">%s:%.8X:%.*X:%.8X:%.8X", | |
| 12198 | machine->gamedrv->name, | |
| 12199 | action->type, | |
| 12200 | addressLength, | |
| 12201 | action->original_address, | |
| 12202 | action->original_data, | |
| 12203 | action->extend_data); | |
| 12371 | buf_strings += sprintf(buf_strings,":%s::%.8X::%.2X%.8X::%.*X::%.8X::%.8X", | |
| 12372 | machine->gamedrv->name, /* name */ | |
| 12373 | thisGameCRC, /* CRC */ | |
| 12374 | action->region, action->type, /* type */ | |
| 12375 | address_length, action->original_address, /* address */ | |
| 12376 | action->original_data, /* data */ | |
| 12377 | action->extend_data); /* extend data */ | |
| 12378 | #else /* MAME */ | |
| 12379 | buf_strings += sprintf(buf_strings, ":%s::%.2X%.8X::%.*X::%.8X::%.8X", | |
| 12380 | machine->gamedrv->name, /* name */ | |
| 12381 | action->region, action->type, /* type */ | |
| 12382 | address_length, action->original_address, /* address */ | |
| 12383 | action->original_data, /* data */ | |
| 12384 | action->extend_data); /* extend data */ | |
| 12204 | 12385 | #endif |
| 12205 | /* set name */ | |
| 12386 | ||
| 12387 | /* set description */ | |
| 12206 | 12388 | if(name) |
| 12207 | { | |
| 12208 | bufTraverse += sprintf(bufTraverse, ":%s", name); | |
| 12209 | ||
| 12210 | if(!i && entry->comment) | |
| 12211 | bufTraverse += sprintf(bufTraverse, ":%s", entry->comment); | |
| 12212 | } | |
| 12389 | buf_strings += sprintf(buf_strings, ":%s", name); | |
| 12213 | 12390 | else |
| 12214 | { | |
| 12215 | bufTraverse += sprintf(bufTraverse, ":(none)"); | |
| 12391 | buf_strings += sprintf(buf_strings, ":(none)"); | |
| 12216 | 12392 | |
| 12217 | if(!i && entry->comment) | |
| 12218 | bufTraverse += sprintf(bufTraverse, ":%s", entry->comment); | |
| 12219 | } | |
| 12220 | ||
| 12221 | 12393 | /* set comment */ |
| 12222 | if(!i && entry->comment) | |
| 12223 | bufTraverse += sprintf(bufTraverse, ":%s", entry->comment); | |
| 12394 | if(i == 0 && entry->comment) | |
| 12395 | buf_strings += sprintf(buf_strings, ":%s", entry->comment); | |
| 12224 | 12396 | |
| 12225 | buf | |
| 12397 | buf_string | |
| 12226 | 12398 | |
| 12227 | mame_fwrite(theFile, buf, (UINT32)strlen(buf)); | |
| 12399 | /* write the cheat code */ | |
| 12400 | mame_fwrite(the_file, buf, (UINT32)strlen(buf)); | |
| 12228 | 12401 | } |
| 12229 | 12402 | |
| 12230 | 12403 | /* close the database */ |
| 12231 | mame_fclose(the | |
| 12404 | mame_fclose(the_file); | |
| 12232 | 12405 | |
| 12233 | /* clear dirty flag as "this entry | |
| 12406 | /* clear dirty flag as "this entry has b | |
| 12234 | 12407 | entry->flags &= ~kCheatFlag_Dirty; |
| 12235 | 12408 | |
| 12236 | SET_MESSAGE(kCheatMessage_SucceededToSave); | |
| 12237 | #else | |
| 12238 | SaveDescription(machine); | |
| 12239 | #endif | |
| 12409 | SET_MESSAGE(CHEAT_MESSAGE_SUCCEEDED_TO_SAVE); | |
| 12240 | 12410 | } |
| 12241 | 12411 | |
| 12242 | 12412 | /*----------------------------------------------------------------- |
| 12243 | | |
| 12413 | save_activation_key - save activation key code into the database | |
| 12244 | 12414 | -----------------------------------------------------------------*/ |
| 12245 | 12415 | |
| 12246 | static void | |
| 12416 | static void save_activation_key(running_machine *machine, cheat_entry *entry, int entry_index) | |
| 12247 | 12417 | { |
| 12248 | #if 0 | |
| 12249 | INT8 i; | |
| 12250 | INT8 error = 0; | |
| 12251 | char buf[4096]; | |
| 12418 | int type = 0; | |
| 12419 | int key_1 = 0; | |
| 12420 | int key_2 = 0; | |
| 12421 | UINT8 region = CUSTOM_CODE_ACTIVATION_KEY; | |
| 12422 | INT8 address_length = 8; | |
| 12423 | char buf[256]; | |
| 12424 | char *buf_strings = buf; | |
| 12425 | mame_file *the_file; | |
| 12426 | astring *name_1 = NULL; | |
| 12427 | astring *name_2 = NULL; | |
| 12252 | 12428 | |
| 12253 | mame_file * theFile; | |
| 12254 | file_error filerr; | |
| 12429 | /* check activation keys */ | |
| 12430 | if((entry->flags & kCheatFlag_HasActivationKey1) == 0 && (entry->flags & kCheatFlag_HasActivationKey2) == 0) | |
| 12431 | { | |
| 12432 | SET_MESSAGE(CHEAT_MESSAGE_NO_ACTIVATION_KEY); | |
| 12433 | return; | |
| 12434 | } | |
| 12255 | 12435 | |
| 12256 | if(!(entry->flags & kCheatFlag_HasActivationKey1) && !(entry->flags & kCheatFlag_HasActivationKey2)) | |
| 12257 | error = 1; | |
| 12436 | /* check entry */ | |
| 12437 | if(entry == NULL || entry->action_list == NULL) | |
| 12438 | { | |
| 12439 | SET_MESSAGE(CHEAT_MESSAGE_FAILED_TO_SAVE); | |
| 12440 | return; | |
| 12441 | } | |
| 12258 | 12442 | |
| 12259 | if(error == 0 && (entry == NULL || entry->action_list == NULL || ((entry->flags & kCheatFlag_Select) && entry->action_list_length == 1))) | |
| 12260 | error = 2; | |
| 12261 | ||
| 12262 | 12443 | /* open the database */ |
| 12263 | if( | |
| 12444 | if( | |
| 12264 | 12445 | { |
| 12265 | filerr = mame_fopen(SEARCHPATH_CHEAT, main_database_name, OPEN_FLAG_WRITE, &theFile); | |
| 12446 | SET_MESSAGE(CHEAT_MESSAGE_FAILED_TO_SAVE); | |
| 12447 | return; | |
| 12448 | } | |
| 12266 | 12449 | |
| 12267 | if(!theFile) | |
| 12268 | error = 2; | |
| 12269 | else if(filerr != FILERR_NONE) | |
| 12270 | { | |
| 12271 | filerr = mame_fopen(SEARCHPATH_CHEAT, main_database_name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &theFile); | |
| 12450 | mame_fseek(the_file, 0, SEEK_END); | |
| 12272 | 12451 | |
| 12273 | if(filerr != FILERR_NONE) | |
| 12274 | error = 2; | |
| 12275 | } | |
| 12276 | } | |
| 12452 | /* get address length of CPU/Region */ | |
| 12453 | address_length = get_address_length(entry->action_list[0].region); | |
| 12277 | 12454 | |
| 12278 | switch(error) | |
| 12279 | { | |
| 12280 | case 1: | |
| 12281 | SET_MESSAGE(kCheatMessage_NoActivationKey); | |
| 12282 | return; | |
| 12455 | /* detect activation key */ | |
| 12456 | key_1 = entry->activation_key_1; | |
| 12457 | key_2 = entry->activation_key_2; | |
| 12283 | 12458 | |
| 12284 | case 2: | |
| 12285 | SET_MESSAGE(kCheatMessage_FailedToSave); | |
| 12286 | return; | |
| 12287 | } | |
| 12459 | /* set code */ | |
| 12460 | #ifdef MESS | |
| 12461 | buf_strings += sprintf( buf_strings, ":%s::%.8X::%.2X%.8X::%.*X::%.8X::%.8X::Activation Key", | |
| 12462 | machine->gamedrv->name, /* name */ | |
| 12463 | thisGameCRC, /* CRC */ | |
| 12464 | region, type, /* type */ | |
| 12465 | address_length, entry_index, /* address */ | |
| 12466 | key_1, /* data */ | |
| 12467 | key_2); /* extend data */ | |
| 12468 | #else /* MAME */ | |
| 12469 | buf_strings += sprintf( buf_strings, ":%s::%.2X%.8X::%.*X::%.8X::%.8X:Activation Key", | |
| 12470 | machine->gamedrv->name, /* name */ | |
| 12471 | region, type, /* type */ | |
| 12472 | address_length, entry_index, /* address */ | |
| 12473 | key_1, /* data */ | |
| 12474 | key_2); /* extend data */ | |
| 12475 | #endif | |
| 12288 | 12476 | |
| 12289 | mame_fseek(theFile, 0, SEEK_END); | |
| 12477 | /* set description */ | |
| 12478 | if(entry->name && entry->name[0] != 0) | |
| 12479 | buf_strings += sprintf(buf_strings, " for %s", entry->name); | |
| 12290 | 12480 | |
| 12291 | /* write the code to the database */ | |
| 12292 | for(i = 0; i < 2; i++) | |
| 12481 | /* set label of key */ | |
| 12482 | if(entry->flags & kCheatFlag_Select) | |
| 12293 | 12483 | { |
| 12294 | int addressLength = 8; | |
| 12295 | int activationKey = !i ? entry->activation_key1 : entry->activation_key2; | |
| 12296 | int type = 0; | |
| 12297 | char * bufTraverse = buf; | |
| 12484 | if(entry->flags & kCheatFlag_HasActivationKey1) | |
| 12485 | name_1 = input_code_name(astring_alloc(), entry->activation_key_1); | |
| 12298 | 12486 | |
| 12299 | cheat_action *action = &entry->action_list[0]; | |
| 12300 | astring *name = input_code_name(astring_alloc(), activationKey); | |
| 12487 | if(entry->flags & kCheatFlag_HasActivationKey2) | |
| 12488 | name_2 = input_code_name(astring_alloc(), entry->activation_key_2); | |
| 12301 | 12489 | |
| 12302 | if(activationKey) | |
| 12303 | SET_FIELD(type, CodeType, CUSTOM_CODE_ACTIVATION_KEY_1); | |
| 12304 | else | |
| 12305 | SET_FIELD(type, CodeType, CUSTOM_CODE_ACTIVATION_KEY_2); | |
| 12490 | buf_strings += sprintf(buf_strings, " (prev = %s / next = %s)\n", astring_c(name_1), astring_c(name_2)); | |
| 12491 | } | |
| 12492 | else | |
| 12493 | { | |
| 12494 | name_1 = input_code_name(astring_alloc(), entry->activation_key_1); | |
| 12306 | 12495 | |
| 12307 | /* get address length of CPU/Region */ | |
| 12308 | addressLength = get_address_length(action->region); | |
| 12496 | buf_strings += sprintf(buf_strings, " (%s)\n", astring_c(name_1)); | |
| 12497 | } | |
| 12309 | 12498 | |
| 12310 | /* if not find 1st activation key at saving 1st key, try to save 2nd key */ | |
| 12311 | if(!i && !(entry->flags & kCheatFlag_HasActivationKey1)) | |
| 12312 | { | |
| 12313 | astring_free(name); | |
| 12314 | continue; | |
| 12315 | } | |
| 12316 | 12499 | |
| 12317 | /* if not find 2nd key after 1st key saved, finish */ | |
| 12318 | if(i && !(entry->flags & kCheatFlag_HasActivationKey2)) | |
| 12319 | { | |
| 12320 | astring_free(name); | |
| 12321 | break; | |
| 12322 | } | |
| 12500 | /* write the activation key code */ | |
| 12501 | mame_fwrite(the_file, buf, (UINT32)strlen(buf)); | |
| 12323 | 12502 | |
| 12324 | #ifdef MESS | |
| 12325 | bufTraverse += sprintf(bufTraverse, | |
| 12326 | ">%s:%.8X:%.8X:%.*X:%.8X:00000000", | |
| 12327 | machine->gamedrv->name, | |
| 12328 | thisGameCRC, | |
| 12329 | type, | |
| 12330 | addressLength, | |
| 12331 | entryIndex, | |
| 12332 | activationKey); | |
| 12333 | #else | |
| 12334 | bufTraverse += sprintf(bufTraverse, ">%s:%.8X:%.*X:%.8X:00000000", | |
| 12335 | machine->gamedrv->name, | |
| 12336 | type, | |
| 12337 | addressLength, | |
| 12338 | entryIndex, | |
| 12339 | activationKey); | |
| 12340 | #endif | |
| 12341 | /* set description */ | |
| 12342 | if(!i) | |
| 12343 | { | |
| 12344 | if(!(entry->flags & kCheatFlag_Select)) | |
| 12345 | bufTraverse += sprintf(bufTraverse, ":Pre-selection Key "); | |
| 12346 | else | |
| 12347 | bufTraverse += sprintf(bufTraverse, ":1st Activation Key "); | |
| 12348 | } | |
| 12349 | else | |
| 12350 | { | |
| 12351 | if(!(entry->flags & kCheatFlag_Select)) | |
| 12352 | bufTraverse += sprintf(bufTraverse, ":Next-selection Key "); | |
| 12353 | else | |
| 12354 | bufTraverse += sprintf(bufTraverse, ":2nd Activation Key "); | |
| 12355 | } | |
| 12503 | if(name_1) astring_free(name_1); | |
| 12504 | if(name_2) astring_free(name_2); | |
| 12356 | 12505 | |
| 12357 | /* set code name and button index */ | |
| 12358 | if(entry->name) | |
| 12359 | bufTraverse += sprintf(bufTraverse, "for %s (%s)\n", entry->name, astring_c(name)); | |
| 12360 | else | |
| 12361 | bufTraverse += sprintf(bufTraverse, "(%s)\n", astring_c(name)); | |
| 12362 | ||
| 12363 | /* write the activation key code */ | |
| 12364 | mame_fwrite(theFile, buf, (UINT32)strlen(buf)); | |
| 12365 | ||
| 12366 | astring_free(name); | |
| 12367 | } | |
| 12368 | ||
| 12369 | 12506 | /* close the database */ |
| 12370 | mame_fclose(the | |
| 12507 | mame_fclose(the_file); | |
| 12371 | 12508 | |
| 12372 | SET_MESSAGE(kCheatMessage_ActivationKeySaved); | |
| 12373 | #endif | |
| 12509 | SET_MESSAGE(CHEAT_MESSAGE_ACTIVATION_KEY_SAVED); | |
| 12374 | 12510 | } |
| 12375 | 12511 | |
| 12376 | 12512 | /*----------------------------------------------------------- |
| 12377 | | |
| 12513 | save_pre_enable - save a pre-enable code into the database | |
| 12378 | 12514 | -----------------------------------------------------------*/ |
| 12379 | 12515 | |
| 12380 | static void | |
| 12516 | static void save_pre_enable(running_machine *machine, cheat_entry *entry, int entry_index) | |
| 12381 | 12517 | { |
| 12382 | #if 0 | |
| 12383 | int type = 0; | |
| 12384 | INT8 error = 0; | |
| 12385 | INT8 addressLength = 8; | |
| 12386 | char buf[4096]; | |
| 12387 | char * bufTraverse = buf; | |
| 12518 | int type = 0; | |
| 12519 | UINT8 region = CUSTOM_CODE_PRE_ENABLE; | |
| 12520 | INT8 address_length = 8; | |
| 12521 | char buf[256]; | |
| 12522 | char *buf_strings = buf; | |
| 12523 | mame_file *the_file; | |
| 12388 | 12524 | |
| 12389 | cheat_action *action = &entry->action_list[0]; | |
| 12390 | mame_file *theFile; | |
| 12391 | file_error filerr; | |
| 12392 | ||
| 12393 | if(entry == NULL || entry->action_list == NULL || ((entry->flags & kCheatFlag_Select) && entry->action_list_length == 1)) | |
| 12394 | error = 1; | |
| 12395 | ||
| 12396 | /* open the database */ | |
| 12397 | if(!error) | |
| 12525 | /* if invalid cheat code, no action */ | |
| 12526 | if(entry == NULL || entry->action_list == NULL) | |
| 12398 | 12527 | { |
| 12399 | filerr = mame_fopen(SEARCHPATH_CHEAT, main_database_name, OPEN_FLAG_WRITE, &theFile); | |
| 12400 | ||
| 12401 | if(!theFile) | |
| 12402 | error = 1; | |
| 12403 | else if(filerr != FILERR_NONE) | |
| 12404 | { | |
| 12405 | filerr = mame_fopen(SEARCHPATH_CHEAT, main_database_name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &theFile); | |
| 12406 | ||
| 12407 | if(filerr != FILERR_NONE) | |
| 12408 | error = 1; | |
| 12409 | } | |
| 12528 | SET_MESSAGE(CHEAT_MESSAGE_FAILED_TO_SAVE); | |
| 12529 | return; | |
| 12410 | 12530 | } |
| 12411 | 12531 | |
| 12412 | if(error) | |
| 12532 | /* open the database */ | |
| 12533 | if(open_cheat_database(&the_file, main_database_name, DATABASE_SAVE) == 0) | |
| 12413 | 12534 | { |
| 12414 | SET_MESSAGE( | |
| 12535 | SET_MESSAGE( | |
| 12415 | 12536 | return; |
| 12416 | 12537 | } |
| 12417 | else | |
| 12418 | { | |
| 12419 | SET_FIELD(type, CodeType, CUSTOM_CODE_PRE_ENABLE); | |
| 12420 | } | |
| 12421 | 12538 | |
| 12422 | mame_fseek(the | |
| 12539 | mame_fseek(the_file, 0, SEEK_END); | |
| 12423 | 12540 | |
| 12424 | 12541 | /* get address length of CPU/Region */ |
| 12425 | address | |
| 12542 | address_length = get_address_length(entry-> | |
| 12426 | 12543 | |
| 12427 | 12544 | #ifdef MESS |
| 12428 | bufTraverse += sprintf(bufTraverse, ">%s:%.8X:%8.8X:%.*X:%.8X:00000000", | |
| 12429 | machine->gamedrv->name, | |
| 12430 | thisGameCRC, | |
| 12431 | type, | |
| 12432 | addressLength, | |
| 12433 | entryIndex, | |
| 12434 | entry->selection); | |
| 12435 | #else | |
| 12436 | bufTraverse += sprintf(bufTraverse, ">%s:%8.8X:%.*X:%.8X:00000000", | |
| 12437 | machine->gamedrv->name, | |
| 12438 | type, | |
| 12439 | addressLength, | |
| 12440 | entryIndex, | |
| 12441 | entry->selection); | |
| 12545 | buf_strings += sprintf( buf_strings, ":%s::%.8X::%.2X%.8X::%.*X::%.8X:00000000", | |
| 12546 | machine->gamedrv->name, /* name */ | |
| 12547 | thisGameCRC, /* CRC */ | |
| 12548 | region, type, /* type */ | |
| 12549 | address_length, entry_index, /* address */ | |
| 12550 | entry->selection); /* data */ | |
| 12551 | #else /* MAME */ | |
| 12552 | buf_strings += sprintf( buf_strings, ":%s::%.2X%.8X::%.*X::%.8X::00000000", | |
| 12553 | machine->gamedrv->name, /* name */ | |
| 12554 | region ,type, /* type */ | |
| 12555 | address_length, entry_index, /* address */ | |
| 12556 | entry->selection); /* data */ | |
| 12442 | 12557 | #endif |
| 12443 | 12558 | |
| 12444 | /* set name */ | |
| 12445 | bufTraverse += sprintf(bufTraverse, ":Pre-enable"); | |
| 12559 | /* set description */ | |
| 12560 | buf_strings += sprintf(buf_strings, ":Pre-enable"); | |
| 12446 | 12561 | |
| 12447 | 12562 | if(entry->name) |
| 12448 | buf | |
| 12563 | buf_string | |
| 12449 | 12564 | |
| 12450 | 12565 | /* set label name */ |
| 12451 | 12566 | if(entry->selection) |
| 12452 | buf | |
| 12567 | buf_string | |
| 12453 | 12568 | |
| 12454 | buf | |
| 12569 | buf_string | |
| 12455 | 12570 | |
| 12456 | 12571 | /* write the pre-enable code */ |
| 12457 | mame_fwrite(the | |
| 12572 | mame_fwrite(the_file, buf, (UINT32)strlen(buf)); | |
| 12458 | 12573 | |
| 12459 | 12574 | /* close the database */ |
| 12460 | mame_fclose(the | |
| 12575 | mame_fclose(the_file); | |
| 12461 | 12576 | |
| 12462 | SET_MESSAGE(kCheatMessage_PreEnableSaved); | |
| 12463 | #endif | |
| 12577 | SET_MESSAGE(CHEAT_MESSAGE_PRE_ENABLE_SAVED); | |
| 12464 | 12578 | } |
| 12465 | 12579 | |
| 12466 | 12580 | /*-------------------------------------------------------------- |
| 12467 | | |
| 12581 | save_cheat_options - save cheat option code into the database | |
| 12468 | 12582 | --------------------------------------------------------------*/ |
| 12469 | 12583 | |
| 12470 | static void | |
| 12584 | static void save_cheat_options(void) | |
| 12471 | 12585 | { |
| 12472 | UINT8 error = 0; | |
| 12473 | 12586 | char buf[32]; |
| 12587 | mame_file *the_file; | |
| 12474 | 12588 | |
| 12475 | mame_file * theFile; | |
| 12476 | file_error filerr; | |
| 12477 | ||
| 12478 | 12589 | /* open the database */ |
| 12479 | filerr = mame_fopen(SEARCHPATH_CHEAT, main_database_name, OPEN_FLAG_WRITE, &theFile); | |
| 12480 | ||
| 12481 | if(!theFile) | |
| 12482 | error = 1; | |
| 12483 | else if(filerr != FILERR_NONE) | |
| 12590 | if(open_cheat_database(&the_file, main_database_name, DATABASE_SAVE) == 0) | |
| 12484 | 12591 | { |
| 12485 | filerr = mame_fopen(SEARCHPATH_CHEAT, main_database_name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &theFile); | |
| 12486 | ||
| 12487 | if(filerr != FILERR_NONE) | |
| 12488 | error = 1; | |
| 12489 | } | |
| 12490 | ||
| 12491 | if(error) | |
| 12492 | { | |
| 12493 | SET_MESSAGE(kCheatMessage_FailedToSave); | |
| 12592 | SET_MESSAGE(CHEAT_MESSAGE_FAILED_TO_SAVE); | |
| 12494 | 12593 | return; |
| 12495 | 12594 | } |
| 12496 | 12595 | |
| 12497 | mame_fseek(the | |
| 12596 | mame_fseek(the_file, 0, SEEK_END); | |
| 12498 | 12597 | |
| 12499 | 12598 | sprintf(buf, ":_command:%.8X\n", cheat_options); |
| 12500 | 12599 | |
| 12501 | /* write the command code */ | |
| 12502 | mame_fwrite(theFile, buf, (UINT32)strlen(buf)); | |
| 12600 | /* write the cheat option */ | |
| 12601 | mame_fwrite(the_file, buf, (UINT32)strlen(buf)); | |
| 12503 | 12602 | |
| 12504 | 12603 | /* close the database */ |
| 12505 | mame_fclose(the | |
| 12604 | mame_fclose(the_file); | |
| 12506 | 12605 | |
| 12507 | SET_MESSAGE( | |
| 12606 | SET_MESSAGE( | |
| 12508 | 12607 | } |
| 12509 | 12608 | |
| 12510 | 12609 | /*------------------ |
| 12511 | | |
| 12610 | save_description | |
| 12512 | 12611 | ------------------*/ |
| 12513 | 12612 | |
| 12514 | static void | |
| 12613 | static void save_description(running_machine *machine) | |
| 12515 | 12614 | { |
| 12516 | UINT8 error = 0; | |
| 12517 | char buf[256]; | |
| 12615 | char buf[256]; | |
| 12616 | mame_file *the_file; | |
| 12518 | 12617 | |
| 12519 | mame_file * theFile; | |
| 12520 | file_error filerr; | |
| 12618 | /* open the database */ | |
| 12619 | if(open_cheat_database(&the_file, main_database_name, DATABASE_SAVE) == 0) | |
| 12620 | { | |
| 12621 | SET_MESSAGE(CHEAT_MESSAGE_FAILED_TO_SAVE); | |
| 12622 | return; | |
| 12623 | } | |
| 12521 | 12624 | |
| 12522 | | |
| 12625 | | |
| 12523 | 12626 | |
| 12524 | if(!theFile) | |
| 12525 | error = 1; | |
| 12526 | else if(filerr != FILERR_NONE) | |
| 12527 | { | |
| 12528 | filerr = mame_fopen(SEARCHPATH_CHEAT, main_database_name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &theFile); | |
| 12627 | sprintf(buf, "; [ %s ]\n", machine->gamedrv->description); | |
| 12529 | 12628 | |
| 12530 | if(filerr != FILERR_NONE) | |
| 12531 | error = 1; | |
| 12532 | } | |
| 12629 | /* write the description of game/machine */ | |
| 12630 | mame_fwrite(the_file, buf, (UINT32)strlen(buf)); | |
| 12533 | 12631 | |
| 12534 | if(error) | |
| 12632 | /* close the database */ | |
| 12633 | mame_fclose(the_file); | |
| 12634 | ||
| 12635 | SET_MESSAGE(CHEAT_MESSAGE_SUCCEEDED_TO_SAVE); | |
| 12636 | } | |
| 12637 | ||
| 12638 | /*---------------- | |
| 12639 | save_raw_code | |
| 12640 | ----------------*/ | |
| 12641 | ||
| 12642 | static void save_raw_code(running_machine *machine) | |
| 12643 | { | |
| 12644 | int address_length = 8; | |
| 12645 | int address = 0; | |
| 12646 | char buf[256]; | |
| 12647 | mame_file *the_file; | |
| 12648 | ||
| 12649 | /* open the database */ | |
| 12650 | if(open_cheat_database(&the_file, main_database_name, DATABASE_SAVE) == 0) | |
| 12535 | 12651 | { |
| 12536 | SET_MESSAGE( | |
| 12652 | SET_MESSAGE( | |
| 12537 | 12653 | return; |
| 12538 | 12654 | } |
| 12539 | 12655 | |
| 12540 | mame_fseek(theFile, 0, SEEK_END); | |
| 12541 | sprintf(buf, "; [ %s ]\n", machine->gamedrv->description); | |
| 12656 | mame_fseek(the_file, 0, SEEK_END); | |
| 12542 | 12657 | |
| 12543 | /* write the command code */ | |
| 12544 | mame_fwrite(theFile, buf, (UINT32)strlen(buf)); | |
| 12658 | address_length = get_address_length(0); | |
| 12545 | 12659 | |
| 12660 | #ifdef MESS | |
| 12661 | sprintf(buf, ":%s::%.8X::0000000000::%.*X::00000000::FFFFFFFF:Raw Code\n", machine->gamedrv->name, thisGameCRC, address_length, address); | |
| 12662 | #else /* MAME */ | |
| 12663 | sprintf(buf, ":%s::0000000000::%.*X::00000000::FFFFFFFF:Raw Code\n", machine->gamedrv->name, address_length, address); | |
| 12664 | #endif | |
| 12665 | ||
| 12666 | /* write the raw code */ | |
| 12667 | mame_fwrite(the_file, buf, (UINT32)strlen(buf)); | |
| 12668 | ||
| 12546 | 12669 | /* close the database */ |
| 12547 | mame_fclose(the | |
| 12670 | mame_fclose(the_file); | |
| 12548 | 12671 | |
| 12549 | SET_MESSAGE( | |
| 12672 | SET_MESSAGE( | |
| 12550 | 12673 | } |
| 12551 | 12674 | |
| 12552 | /*-------------------------------------------------------------------------- | |
| 12553 | DoAutoSaveCheat - save normal code automatically when exit cheat system | |
| 12554 | --------------------------------------------------------------------------*/ | |
| 12675 | /*------------------------------------------------------------------------------ | |
| 12676 | do_auto_save_cheats - save normal code automatically when exit cheat system | |
| 12677 | ------------------------------------------------------------------------------*/ | |
| 12555 | 12678 | |
| 12556 | static void | |
| 12679 | static void do_auto_save_cheats(running_machine *machine) | |
| 12557 | 12680 | { |
| 12558 | 12681 | int i; |
| 12559 | 12682 | |
| 12683 | save_description(machine); | |
| 12684 | ||
| 12560 | 12685 | for(i = 0; i < cheat_list_length; i++) |
| 12561 | 12686 | { |
| 12562 | 12687 | cheat_entry *entry = &cheat_list[i]; |
| 12563 | 12688 | |
| 12564 | 12689 | /* if the entry is not edited/added newly or has not been already saved, save it */ |
| 12565 | 12690 | if(entry->flags & kCheatFlag_Dirty) |
| 12566 | | |
| 12691 | save_cheat_code(machine, entry); | |
| 12567 | 12692 | } |
| 12568 | 12693 | } |
| 12569 | 12694 | |
| 12570 | /*------------------------------------------------------------------- | |
| 12571 | AddCheatFromResult - add a code from result viewer to cheat list | |
| 12572 | -------------------------------------------------------------------*/ | |
| 12695 | /*---------------------------------------------------------------------- | |
| 12696 | add_cheat_from_result - add a code from result viewer to cheat list | |
| 12697 | ----------------------------------------------------------------------*/ | |
| 12573 | 12698 | |
| 12574 | static void | |
| 12699 | static void add_cheat_from_result(search_info *search, search_region *region, UINT32 address) | |
| 12575 | 12700 | { |
| 12576 | if( | |
| 12701 | if( | |
| 12577 | 12702 | { |
| 12703 | int temp_string_length; | |
| 12704 | UINT32 data = read_search_operand(kSearchOperand_First, search, region, address); | |
| 12705 | char temp_string[1024]; | |
| 12578 | 12706 | cheat_entry *entry = get_new_cheat(); |
| 12579 | 12707 | cheat_action *action = &entry->action_list[0]; |
| 12580 | char tempString[1024]; | |
| 12581 | int tempStringLength; | |
| 12582 | UINT32 data = read_search_operand(kSearchOperand_First, search, region, address); | |
| 12583 | 12708 | |
| 12584 | temp | |
| 12709 | temp_string_length = sprintf(temp_string, "%.8X (%d) = %.*X", address, region->target_idx, kSearchByteDigitsTable[search->bytes], data); | |
| 12585 | 12710 | |
| 12586 | entry->name = realloc(entry->name, tempStringLength + 1); | |
| 12587 | memcpy(entry->name, tempString, tempStringLength + 1); | |
| 12711 | entry->name = realloc(entry->name, temp_string_length + 1); | |
| 12712 | if(entry->name == NULL) | |
| 12713 | fatalerror( "cheat: [cheat entry] memory allocation error" | |
| 12714 | " temp_length = %.8X" | |
| 12715 | " entry->name = %p", | |
| 12716 | temp_string_length, entry->name); | |
| 12588 | 12717 | |
| 12718 | memcpy(entry->name, temp_string, temp_string_length + 1); | |
| 12589 | 12719 | action->region = region->target_idx; |
| 12590 | 12720 | action->address = address; |
| 12591 | 12721 | action->data = data; |
| 12592 | 12722 | action->original_data = data; |
| 12593 | action->extend_data = 0 | |
| 12723 | action->extend_data = ~0 | |
| 12594 | 12724 | action->last_value = NULL; |
| 12595 | ||
| 12596 | 12725 | SET_FIELD(action->type, AddressSize, kSearchByteIncrementTable[search->bytes] - 1); |
| 12597 | 12726 | |
| 12598 | 12727 | update_cheat_info(entry, 0); |
| 12599 | 12728 | } |
| 12600 | 12729 | } |
| 12601 | 12730 | |
| 12602 | /*-------------------------------------------------------------------------------------------- | |
| 12603 | AddCheatFromFirstResult - add a code from search box to cheat list if found result is one | |
| 12604 | --------------------------------------------------------------------------------------------*/ | |
| 12731 | /*------------------------------------------------------------------------------------------------ | |
| 12732 | add_cheat_from_first_result - add a code from search box to cheat list if found result is one | |
| 12733 | ------------------------------------------------------------------------------------------------*/ | |
| 12605 | 12734 | |
| 12606 | static void | |
| 12735 | static void add_cheat_from_first_result(search_info *search) | |
| 12607 | 12736 | { |
| 12608 | int | |
| 12737 | int i; | |
| 12609 | 12738 | |
| 12610 | 12739 | for(i = 0; i < search->region_list_length; i++) |
| 12611 | 12740 | { |
| r2844 | r2845 | |
| 12613 | 12742 | |
| 12614 | 12743 | if(region->num_results) |
| 12615 | 12744 | { |
| 12616 | UINT32 | |
| 12745 | UINT32 traverse; | |
| 12617 | 12746 | |
| 12618 | 12747 | for(traverse = 0; traverse < region->length; traverse++) |
| 12619 | 12748 | { |
| 12620 | UINT32 | |
| 12749 | UINT32 address = region->address + traverse; | |
| 12621 | 12750 | |
| 12622 | 12751 | if(is_region_offset_valid(search, region, traverse)) |
| 12623 | 12752 | { |
| 12624 | | |
| 12753 | add_cheat_from_result(search, region, address); | |
| 12625 | 12754 | return; |
| 12626 | 12755 | } |
| 12627 | 12756 | } |
| r2844 | r2845 | |
| 12629 | 12758 | } |
| 12630 | 12759 | } |
| 12631 | 12760 | |
| 12632 | /*------------------------------------------------------------------------- | |
| 12633 | AddWatchFromResult - add a watch code from result viewer to cheat list | |
| 12634 | -------------------------------------------------------------------------*/ | |
| 12761 | /*---------------------------------------------------------------------------- | |
| 12762 | add_watch_from_result - add a watchpoint from result viewer to cheat list | |
| 12763 | ----------------------------------------------------------------------------*/ | |
| 12635 | 12764 | |
| 12636 | static void | |
| 12765 | static void add_watch_from_result(search_info *search, search_region *region, UINT32 address) | |
| 12637 | 12766 | { |
| 12638 | 12767 | if(region->target_type == kRegionType_CPU || region->target_type == kRegionType_Memory) |
| 12639 | 12768 | { |
| r2844 | r2845 | |
| 12651 | 12780 | info->linked_cheat = NULL; |
| 12652 | 12781 | info->label[0] = 0; |
| 12653 | 12782 | |
| 12654 | SET_MESSAGE( | |
| 12783 | SET_MESSAGE( | |
| 12655 | 12784 | } |
| 12656 | 12785 | else |
| 12657 | SET_MESSAGE( | |
| 12786 | SET_MESSAGE( | |
| 12658 | 12787 | } |
| 12659 | 12788 | |
| 12660 | 12789 | /*--------------------- |
| r2844 | r2845 | |
| 12685 | 12814 | break; |
| 12686 | 12815 | |
| 12687 | 12816 | case kSearchOperand_Previous: |
| 12688 | value = | |
| 12817 | value = do_memory_read(region->last, address - region->address, kSearchByteIncrementTable[search->bytes], search->swap, NULL); | |
| 12689 | 12818 | break; |
| 12690 | 12819 | |
| 12691 | 12820 | case kSearchOperand_First: |
| 12692 | value = | |
| 12821 | value = do_memory_read(region->first, address - region->address, kSearchByteIncrementTable[search->bytes], search->swap, NULL); | |
| 12693 | 12822 | break; |
| 12694 | 12823 | |
| 12695 | 12824 | case kSearchOperand_Value: |
| r2844 | r2845 | |
| 12716 | 12845 | break; |
| 12717 | 12846 | |
| 12718 | 12847 | case kSearchOperand_Previous: |
| 12719 | value = | |
| 12848 | value = do_memory_read(region->last, address - region->address, kSearchByteIncrementTable[search->bytes], search->swap, NULL); | |
| 12720 | 12849 | break; |
| 12721 | 12850 | |
| 12722 | 12851 | case kSearchOperand_First: |
| 12723 | value = | |
| 12852 | value = do_memory_read(region->first, address - region->address, kSearchByteIncrementTable[search->bytes], search->swap, NULL); | |
| 12724 | 12853 | break; |
| 12725 | 12854 | |
| 12726 | 12855 | case kSearchOperand_Value: |
| r2844 | r2845 | |
| 13104 | 13233 | } |
| 13105 | 13234 | } |
| 13106 | 13235 | |
| 13107 | /*----------------------------------------------------------- | |
| 13108 | LookupHandlerMemory - search specified write handler | |
| 13109 | -----------------------------------------------------------*/ | |
| 13236 | /*---------------------------------------------------------- | |
| 13237 | look_up_handler_memory - search specified write handler | |
| 13238 | ----------------------------------------------------------*/ | |
| 13110 | 13239 | |
| 13111 | static UINT8 ** | |
| 13240 | static UINT8 **l | |
| 13112 | 13241 | { |
| 13113 | const address_map * | |
| 13242 | const address_map * | |
| 13114 | 13243 | const address_map_entry *entry; |
| 13115 | 13244 | |
| 13116 | 13245 | for(entry = map->entrylist; entry != NULL; entry = entry->next) |
| 13117 | 13246 | { |
| 13118 | 13247 | if(entry->write.generic != NULL && address >= entry->addrstart && address <= entry->addrend) |
| 13119 | 13248 | { |
| 13120 | if(out | |
| 13249 | if(out_relative_address) | |
| 13121 | 13250 | { |
| 13122 | *out | |
| 13251 | *out_relative_address = address - entry->addrstart; | |
| 13123 | 13252 | return (UINT8 **)entry->baseptr; |
| 13124 | 13253 | } |
| 13125 | 13254 | } |
| r2844 | r2845 | |
| 13128 | 13257 | return NULL; |
| 13129 | 13258 | } |
| 13130 | 13259 | |
| 13131 | /*------------------------------------------------------------------------------------------------------------- | |
| 13132 | GetMemoryRegionBasePointer - return base pointer to the base of RAM associated with given CPU and address | |
| 13133 | -------------------------------------------------------------------------------------------------------------*/ | |
| 13260 | /*---------------------------------------------------------------------------------------------------------------- | |
| 13261 | get_memory_region_base_pointer - return base pointer to the base of RAM associated with given CPU and address | |
| 13262 | ----------------------------------------------------------------------------------------------------------------*/ | |
| 13134 | 13263 | |
| 13135 | static UINT8 ** | |
| 13264 | static UINT8 **g | |
| 13136 | 13265 | { |
| 13137 | UINT8 | |
| 13266 | UINT8 | |
| 13138 | 13267 | |
| 13139 | 13268 | switch(space) |
| 13140 | 13269 | { |
| r2844 | r2845 | |
| 13158 | 13287 | logerror("invalid address space (%x)\n", space); |
| 13159 | 13288 | } |
| 13160 | 13289 | |
| 13161 | if(buf) buf -= address; | |
| 13290 | if(buf) | |
| 13291 | buf -= address; | |
| 13162 | 13292 | |
| 13163 | 13293 | //logerror("pointer (return) : %p\n", buf); |
| 13164 | 13294 | |
| 13165 | 13295 | return (UINT8 **)buf; |
| 13166 | 13296 | } |
| 13167 | 13297 | |
| 13168 | /*-------------------------------------------------------------------------------------------------------------- | |
| 13169 | DoCPURead - read a data from standard CPU region | |
| 13170 | NOTE : if a driver has cpu_spinutil(), reading a data via cpunum_read_byte may conflict with it | |
| 13171 | --------------------------------------------------------------------------------------------------------------*/ | |
| 13298 | /*---------------------------------------------------------------------------------------------------------------- | |
| 13299 | do_cpu_read - read a data from standard CPU region | |
| 13300 | NOTE : if a driver has cpu_spinutil(), reading a data via cpunum_read_byte may conflict with it | |
| 13301 | ----------------------------------------------------------------------------------------------------------------*/ | |
| 13172 | 13302 | |
| 13173 | static UINT32 | |
| 13303 | static UINT32 do_cpu_read(UINT8 cpu, UINT32 address, UINT8 bytes, UINT8 swap) | |
| 13174 | 13304 | { |
| 13175 | 13305 | cpu_region_info *info = get_cpu_info(cpu); |
| 13176 | 13306 | |
| r2844 | r2845 | |
| 13210 | 13340 | return 0; |
| 13211 | 13341 | } |
| 13212 | 13342 | |
| 13213 | /*-------------------------------------------------- | |
| 13214 | DoMemoryRead - read a data from memory directly | |
| 13215 | --------------------------------------------------*/ | |
| 13343 | /*---------------------------------------------------- | |
| 13344 | do_memory_read - read a data from memory directly | |
| 13345 | ----------------------------------------------------*/ | |
| 13216 | 13346 | |
| 13217 | static UINT32 | |
| 13347 | static UINT32 do_memory_read(UINT8 * | |
| 13218 | 13348 | { |
| 13219 | 13349 | int i; |
| 13220 | 13350 | int data = 0; |
| r2844 | r2845 | |
| 13222 | 13352 | if(info) |
| 13223 | 13353 | address = DoShift(address, info->address_shift); |
| 13224 | 13354 | |
| 13225 | if( | |
| 13355 | if( | |
| 13226 | 13356 | { |
| 13227 | 13357 | switch(bytes) |
| 13228 | 13358 | { |
| r2844 | r2845 | |
| 13253 | 13383 | return data; |
| 13254 | 13384 | } |
| 13255 | 13385 | |
| 13256 | generic: | |
| 13386 | generic: | |
| 13387 | ||
| 13257 | 13388 | for(i = 0; i < bytes; i++) |
| 13258 | 13389 | data |= swap ? buf[SwapAddress(address + i, bytes, info)] << (i * 8) : |
| 13259 | 13390 | buf[SwapAddress(address + i, bytes, info)] << ((bytes - i - 1) * 8); |
| r2844 | r2845 | |
| 13261 | 13392 | return data; |
| 13262 | 13393 | } |
| 13263 | 13394 | |
| 13264 | /*----------------------------------------------------- | |
| 13265 | DoCPUWrite - write a data into standard CPU region | |
| 13266 | -----------------------------------------------------*/ | |
| 13395 | /*------------------------------------------------------- | |
| 13396 | do_cpu_write - write a data into standard CPU region | |
| 13397 | -------------------------------------------------------*/ | |
| 13267 | 13398 | |
| 13268 | static void | |
| 13399 | static void do_cpu_write(UINT32 data, UINT8 cpu, UINT32 address, UINT8 bytes, UINT8 swap) | |
| 13269 | 13400 | { |
| 13270 | 13401 | cpu_region_info *info = get_cpu_info(cpu); |
| 13271 | 13402 | |
| r2844 | r2845 | |
| 13323 | 13454 | break; |
| 13324 | 13455 | |
| 13325 | 13456 | default: |
| 13326 | logerror(" | |
| 13457 | logerror("do_cpu_write: bad size (%d)\n", bytes); | |
| 13327 | 13458 | break; |
| 13328 | 13459 | } |
| 13329 | 13460 | } |
| 13330 | 13461 | |
| 13331 | /*---------------------------------------------------- | |
| 13332 | DoMemoryWrite - write a data into memory directly | |
| 13333 | ----------------------------------------------------*/ | |
| 13462 | /*------------------------------------------------------ | |
| 13463 | do_memory_write - write a data into memory directly | |
| 13464 | ------------------------------------------------------*/ | |
| 13334 | 13465 | |
| 13335 | static void | |
| 13466 | static void do_memory_write(UINT32 data, UINT8 * | |
| 13336 | 13467 | { |
| 13337 | 13468 | UINT32 i; |
| 13338 | 13469 | |
| 13339 | 13470 | if(info) |
| 13340 | 13471 | address = DoShift(address, info->address_shift); |
| 13341 | 13472 | |
| 13342 | if( | |
| 13473 | if( | |
| 13343 | 13474 | { |
| 13344 | 13475 | switch(bytes) |
| 13345 | 13476 | { |
| r2844 | r2845 | |
| 13370 | 13501 | return; |
| 13371 | 13502 | } |
| 13372 | 13503 | |
| 13373 | generic: | |
| 13504 | generic: | |
| 13505 | ||
| 13374 | 13506 | for(i = 0; i < bytes; i++) |
| 13375 | 13507 | { |
| 13376 | 13508 | if(swap) buf[SwapAddress(address + i, bytes, info)] = data >> (i * 8); |
| r2844 | r2845 | |
| 13378 | 13510 | } |
| 13379 | 13511 | } |
| 13380 | 13512 | |
| 13381 | /*----------- | |
| 13382 | ReadData | |
| 13383 | -----------*/ | |
| 13513 | /*------------ | |
| 13514 | read_data | |
| 13515 | ------------*/ | |
| 13384 | 13516 | |
| 13385 | static UINT32 | |
| 13517 | static UINT32 read_data(cheat_action *action) | |
| 13386 | 13518 | { |
| 13387 | UINT8 addressRead = EXTRACT_FIELD(action->type, AddressRead); | |
| 13388 | UINT8 bytes = EXTRACT_FIELD(action->type, AddressSize) + 1; | |
| 13519 | UINT8 read_from = EXTRACT_FIELD(action->type, AddressRead); | |
| 13520 | UINT8 bytes = EXTRACT_FIELD(action->type, AddressSize); | |
| 13389 | 13521 | |
| 13390 | if( | |
| 13522 | if( | |
| 13391 | 13523 | { |
| 13392 | 13524 | /* read a data from memory */ |
| 13393 | int address = ~0; | |
| 13525 | int address = ~0; | |
| 13526 | UINT8 region = action->region < REGION_INVALID ? EXTRACT_FIELD(action->region, CPUIndex) : action->region; | |
| 13394 | 13527 | |
| 13395 | if(addressRead == kReadFrom_Address) address = action->address; | |
| 13396 | else if(addressRead == kReadFrom_Index) address = cheatVariable[action->address]; | |
| 13528 | /* set address */ | |
| 13529 | if(read_from == kReadFrom_Address) address = action->address; | |
| 13530 | else if(read_from == kReadFrom_Index) address = cheat_variable[action->address]; | |
| 13397 | 13531 | |
| 13532 | /* NOTE : data size "+1" */ | |
| 13533 | bytes++; | |
| 13534 | ||
| 13535 | /* 1st, adjust address */ | |
| 13536 | if(action->flags & kActionFlag_IndexAddress) | |
| 13537 | { | |
| 13538 | int index_address = 0; | |
| 13539 | cpu_region_info *info = get_cpu_info(region); | |
| 13540 | ||
| 13541 | index_address = do_cpu_read(region, address, EXTRACT_FIELD(action->type, CodeParameterLower) + 1, | |
| 13542 | cpu_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13543 | ||
| 13544 | if(info) | |
| 13545 | index_address = DoShift(index_address, info->address_shift); | |
| 13546 | ||
| 13547 | if(index_address) | |
| 13548 | address = index_address + action->extend_data; | |
| 13549 | } | |
| 13550 | else if(action->flags & kActionFlag_PDWWrite) | |
| 13551 | { | |
| 13552 | if(action->flags & kActionFlag_IsFirst) | |
| 13553 | { | |
| 13554 | address += bytes; | |
| 13555 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13556 | action->flags &= ~kActionFlag_IsFirst; | |
| 13557 | } | |
| 13558 | else | |
| 13559 | action->flags |= kActionFlag_IsFirst; | |
| 13560 | } | |
| 13561 | ||
| 13562 | /* 2nd, read a data from specified region */ | |
| 13398 | 13563 | if(action->region < REGION_INVALID) |
| 13399 | 13564 | { |
| 13400 | /* read a data from CPU */ | |
| 13401 | UINT8 cpu = EXTRACT_FIELD(action->region, CPUIndex); | |
| 13402 | ||
| 13565 | /* CPU region */ | |
| 13403 | 13566 | switch(EXTRACT_FIELD(action->region, AddressSpace)) |
| 13404 | 13567 | { |
| 13405 | 13568 | case kAddressSpace_Program: |
| 13406 | if(action->flags & kActionFlag_IndexAddress) | |
| 13407 | { | |
| 13408 | int indexAddress; | |
| 13569 | return do_cpu_read(region, address, bytes, cpu_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13409 | 13570 | |
| 13410 | cpu_region_info *info = get_cpu_info(cpu); | |
| 13411 | ||
| 13412 | indexAddress = DoCPURead(cpu, address, EXTRACT_FIELD(action->type, CodeParameterLower) + 1, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13413 | ||
| 13414 | if(info && info->address_shift) | |
| 13415 | indexAddress = DoShift(indexAddress, info->address_shift); | |
| 13416 | ||
| 13417 | if(indexAddress) | |
| 13418 | { | |
| 13419 | indexAddress += action->extend_data; | |
| 13420 | return DoCPURead(cpu, indexAddress, bytes, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13421 | } | |
| 13422 | } | |
| 13423 | else if(action->flags & kActionFlag_PDWWrite) | |
| 13424 | { | |
| 13425 | if(action->flags & kActionFlag_IsFirst) | |
| 13426 | { | |
| 13427 | address += bytes; | |
| 13428 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13429 | action->flags &= ~kActionFlag_IsFirst; | |
| 13430 | } | |
| 13431 | else | |
| 13432 | action->flags |= kActionFlag_IsFirst; | |
| 13433 | ||
| 13434 | return DoCPURead(cpu, address, bytes, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13435 | } | |
| 13436 | else | |
| 13437 | { | |
| 13438 | return DoCPURead(cpu, address, bytes, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13439 | } | |
| 13440 | break; | |
| 13441 | ||
| 13442 | 13571 | case kAddressSpace_DataSpace: |
| 13443 | 13572 | case kAddressSpace_IOSpace: |
| 13444 | 13573 | case kAddressSpace_OpcodeRAM: |
| 13445 | 13574 | case kAddressSpace_DirectMemory: |
| 13446 | 13575 | { |
| 13447 | UINT8 * | |
| 13576 | UINT8 * | |
| 13448 | 13577 | |
| 13449 | action->cached_pointer = GetMemoryRegionBasePointer(cpu, EXTRACT_FIELD(action->type, AddressSpace), address); | |
| 13450 | buf = (UINT8 *) action->cached_pointer; | |
| 13578 | action->cached_pointer = get_memory_region_base_pointer(region, EXTRACT_FIELD(action->type, AddressSpace), address); | |
| 13579 | buf = (UINT8 *)action->cached_pointer; | |
| 13451 | 13580 | |
| 13452 | 13581 | if(buf) |
| 13453 | { | |
| 13454 | if(action->flags && kActionFlag_PDWWrite) | |
| 13455 | { | |
| 13456 | if(action->flags & kActionFlag_IsFirst) | |
| 13457 | { | |
| 13458 | address += bytes; | |
| 13459 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13460 | action->flags &= ~kActionFlag_IsFirst; | |
| 13461 | } | |
| 13462 | else | |
| 13463 | action->flags |= kActionFlag_IsFirst; | |
| 13464 | } | |
| 13465 | ||
| 13466 | return DoMemoryRead(buf, address, bytes, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness), get_cpu_info(cpu)); | |
| 13467 | } | |
| 13582 | return do_memory_read( buf, address, bytes, | |
| 13583 | cpu_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness), | |
| 13584 | get_cpu_info(region)); | |
| 13468 | 13585 | } |
| 13469 | 13586 | break; |
| 13470 | 13587 | |
| 13471 | 13588 | case kAddressSpace_MappedMemory: |
| 13472 | 13589 | { |
| 13473 | int relative | |
| 13590 | int relative_address; | |
| 13474 | 13591 | UINT8 **buf; |
| 13475 | 13592 | |
| 13476 | action->cached_pointer = | |
| 13593 | action->cached_pointer = look_up_handler_memory(region, address, &action->cached_offset); | |
| 13477 | 13594 | buf = action->cached_pointer; |
| 13478 | relative | |
| 13595 | relative_address = action->cached_offset; | |
| 13479 | 13596 | |
| 13480 | 13597 | if(buf && *buf) |
| 13481 | { | |
| 13482 | if(action->flags & kActionFlag_PDWWrite) | |
| 13483 | { | |
| 13484 | if(action->flags & kActionFlag_IsFirst) | |
| 13485 | { | |
| 13486 | relativeAddress += bytes; | |
| 13487 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13488 | action->flags &= ~kActionFlag_IsFirst; | |
| 13489 | } | |
| 13490 | else | |
| 13491 | action->flags |= kActionFlag_IsFirst; | |
| 13492 | } | |
| 13493 | ||
| 13494 | return DoMemoryRead(*buf, relativeAddress, bytes, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness), get_cpu_info(cpu)); | |
| 13495 | } | |
| 13598 | return do_memory_read( *buf, relative_address, bytes, | |
| 13599 | cpu_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness), | |
| 13600 | get_cpu_info(region)); | |
| 13496 | 13601 | } |
| 13497 | 13602 | break; |
| 13498 | 13603 | |
| r2844 | r2845 | |
| 13504 | 13609 | buf = eeprom_get_data_pointer(&length); |
| 13505 | 13610 | |
| 13506 | 13611 | if(is_address_in_range(action, length)) |
| 13507 | { | |
| 13508 | if(action->flags & kActionFlag_PDWWrite) | |
| 13509 | { | |
| 13510 | if(action->flags & kActionFlag_IsFirst) | |
| 13511 | { | |
| 13512 | address += bytes; | |
| 13513 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13514 | action->flags &= ~kActionFlag_IsFirst; | |
| 13515 | } | |
| 13516 | else | |
| 13517 | action->flags |= kActionFlag_IsFirst; | |
| 13518 | } | |
| 13519 | ||
| 13520 | return DoMemoryRead(buf, address, bytes, 0, &raw_cpu_info); | |
| 13521 | } | |
| 13612 | return do_memory_read(buf, address, bytes, 0, &raw_cpu_info); | |
| 13522 | 13613 | } |
| 13523 | 13614 | break; |
| 13524 | 13615 | } |
| 13525 | 13616 | } |
| 13526 | 13617 | else |
| 13527 | 13618 | { |
| 13528 | /* read a data from region */ | |
| 13529 | UINT8 * buf = memory_region(action->region); | |
| 13619 | /* non-CPU region */ | |
| 13620 | UINT8 * buf = memory_region(region); | |
| 13530 | 13621 | |
| 13531 | if(buf | |
| 13622 | if(buf | |
| 13532 | 13623 | { |
| 13533 | if(action->flags & kActionFlag_PDWWrite) | |
| 13534 | { | |
| 13535 | if(action->flags & kActionFlag_IsFirst) | |
| 13536 | { | |
| 13537 | address += bytes; | |
| 13538 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13539 | action->flags &= ~kActionFlag_IsFirst; | |
| 13540 | } | |
| 13541 | else | |
| 13542 | action->flags |= kActionFlag_IsFirst; | |
| 13543 | ||
| 13544 | return DoMemoryRead(buf, address, bytes, region_needs_swap(action->region) ^ EXTRACT_FIELD(action->type, Endianness), get_region_info(action->region)); | |
| 13545 | } | |
| 13546 | else | |
| 13547 | return DoMemoryRead(buf, address, bytes, region_needs_swap(action->region) ^ EXTRACT_FIELD(action->type, Endianness), get_region_info(action->region)); | |
| 13624 | if(is_address_in_range(action, memory_region_length(region))) | |
| 13625 | return do_memory_read( buf, address, bytes, | |
| 13626 | region_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness), | |
| 13627 | get_region_info(region)); | |
| 13548 | 13628 | } |
| 13549 | 13629 | } |
| 13550 | 13630 | } |
| 13551 | 13631 | else |
| 13632 | { | |
| 13552 | 13633 | /* read a data from variable */ |
| 13553 | return (cheatVariable[action->address] & kCheatSizeMaskTable[EXTRACT_FIELD(action->type, AddressSize)]); | |
| 13634 | return (cheat_variable[action->address] & kCheatSizeMaskTable[bytes]); | |
| 13635 | } | |
| 13554 | 13636 | |
| 13555 | 13637 | return 0; |
| 13556 | 13638 | } |
| 13557 | 13639 | |
| 13558 | /*------------------------------------- | |
| 13559 | WriteData - write a data to memory | |
| 13560 | -------------------------------------*/ | |
| 13640 | /*-------------------------------------- | |
| 13641 | write_data - write a data to memory | |
| 13642 | --------------------------------------*/ | |
| 13561 | 13643 | |
| 13562 | static void | |
| 13644 | static void write_data(cheat_action *action, UINT32 data) | |
| 13563 | 13645 | { |
| 13564 | UINT8 addressRead = EXTRACT_FIELD(action->type, AddressRead); | |
| 13565 | UINT8 bytes = EXTRACT_FIELD(action->type, AddressSize) + 1; | |
| 13646 | UINT8 read_from = EXTRACT_FIELD(action->type, AddressRead); | |
| 13647 | UINT8 bytes = EXTRACT_FIELD(action->type, AddressSize); | |
| 13566 | 13648 | |
| 13567 | if( | |
| 13649 | if( | |
| 13568 | 13650 | { |
| 13569 | 13651 | /* write a data to memory */ |
| 13570 | int address = ~0; | |
| 13652 | int address = ~0; | |
| 13653 | UINT8 region = action->region < REGION_INVALID ? EXTRACT_FIELD(action->region, CPUIndex) : action->region; | |
| 13571 | 13654 | |
| 13572 | if(addressRead == kReadFrom_Address) address = action->address; | |
| 13573 | else if(addressRead == kReadFrom_Index) address = cheatVariable[action->address]; | |
| 13655 | /* set address */ | |
| 13656 | if(read_from == kReadFrom_Address) address = action->address; | |
| 13657 | else if(read_from == kReadFrom_Index) address = cheat_variable[action->address]; | |
| 13574 | 13658 | |
| 13659 | /* NOTE : data size "+1" */ | |
| 13660 | bytes++; | |
| 13661 | ||
| 13662 | /* 1st, adjust address */ | |
| 13663 | if(action->flags & kActionFlag_IndexAddress) | |
| 13664 | { | |
| 13665 | int index_address = 0; | |
| 13666 | cpu_region_info *info = get_cpu_info(region); | |
| 13667 | ||
| 13668 | index_address = do_cpu_read(region, address, EXTRACT_FIELD(action->type, CodeParameterLower) + 1, | |
| 13669 | cpu_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13670 | ||
| 13671 | if(info) | |
| 13672 | index_address = DoShift(index_address, info->address_shift); | |
| 13673 | ||
| 13674 | if(index_address) | |
| 13675 | address = index_address + action->extend_data; | |
| 13676 | } | |
| 13677 | else if(action->flags & kActionFlag_PDWWrite) | |
| 13678 | { | |
| 13679 | if(action->flags & kActionFlag_IsFirst) | |
| 13680 | { | |
| 13681 | address += bytes; | |
| 13682 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13683 | action->flags &= ~kActionFlag_IsFirst; | |
| 13684 | } | |
| 13685 | else | |
| 13686 | action->flags |= kActionFlag_IsFirst; | |
| 13687 | } | |
| 13688 | ||
| 13689 | /* 2nd, write a data to specified region */ | |
| 13575 | 13690 | if(action->region < REGION_INVALID) |
| 13576 | 13691 | { |
| 13577 | UINT8 cpu = EXTRACT_FIELD(action->region, CPUIndex); | |
| 13578 | ||
| 13692 | /* CPU region */ | |
| 13579 | 13693 | switch(EXTRACT_FIELD(action->region, AddressSpace)) |
| 13580 | 13694 | { |
| 13581 | 13695 | case kAddressSpace_Program: |
| 13582 | if(action->flags & kActionFlag_IndexAddress) | |
| 13583 | { | |
| 13584 | int indexAddress; | |
| 13585 | ||
| 13586 | cpu_region_info *info = get_cpu_info(cpu); | |
| 13587 | ||
| 13588 | indexAddress = DoCPURead(cpu, address, EXTRACT_FIELD(action->type, CodeParameterLower) + 1, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13589 | ||
| 13590 | if(info && info->address_shift) | |
| 13591 | indexAddress = DoShift(indexAddress, info->address_shift); | |
| 13592 | ||
| 13593 | if(indexAddress) | |
| 13594 | { | |
| 13595 | indexAddress += action->extend_data; | |
| 13596 | DoCPUWrite(data, cpu, indexAddress, bytes, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13597 | } | |
| 13598 | } | |
| 13599 | else if(action->flags & kActionFlag_PDWWrite) | |
| 13600 | { | |
| 13601 | if(action->flags & kActionFlag_IsFirst) | |
| 13602 | { | |
| 13603 | address += bytes; | |
| 13604 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13605 | action->flags &= ~kActionFlag_IsFirst; | |
| 13606 | } | |
| 13607 | else | |
| 13608 | action->flags |= kActionFlag_IsFirst; | |
| 13609 | ||
| 13610 | DoCPUWrite(data, cpu, address, bytes, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13611 | } | |
| 13612 | else | |
| 13613 | { | |
| 13614 | DoCPUWrite(data, cpu, address, bytes, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13615 | } | |
| 13696 | do_cpu_write(data, region, address, bytes, cpu_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness)); | |
| 13616 | 13697 | break; |
| 13617 | 13698 | |
| 13618 | 13699 | case kAddressSpace_DataSpace: |
| r2844 | r2845 | |
| 13620 | 13701 | case kAddressSpace_OpcodeRAM: |
| 13621 | 13702 | case kAddressSpace_DirectMemory: |
| 13622 | 13703 | { |
| 13623 | UINT8 * | |
| 13704 | UINT8 * | |
| 13624 | 13705 | |
| 13625 | action->cached_pointer = GetMemoryRegionBasePointer(cpu, EXTRACT_FIELD(action->type, AddressSpace), address); | |
| 13626 | buf = (UINT8 *) action->cached_pointer; | |
| 13706 | action->cached_pointer = get_memory_region_base_pointer(region, EXTRACT_FIELD(action->type, AddressSpace), address); | |
| 13707 | buf = (UINT8 *)action->cached_pointer; | |
| 13627 | 13708 | |
| 13628 | 13709 | if(buf) |
| 13629 | { | |
| 13630 | if(action->flags & kActionFlag_PDWWrite) | |
| 13631 | { | |
| 13632 | if(action->flags & kActionFlag_IsFirst) | |
| 13633 | { | |
| 13634 | address += bytes; | |
| 13635 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13636 | action->flags &= ~kActionFlag_IsFirst; | |
| 13637 | } | |
| 13638 | else | |
| 13639 | action->flags |= kActionFlag_IsFirst; | |
| 13640 | } | |
| 13641 | ||
| 13642 | DoMemoryWrite(data, buf, address, bytes, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness), get_cpu_info(cpu)); | |
| 13643 | } | |
| 13710 | do_memory_write(data, buf, address, bytes, | |
| 13711 | cpu_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness), | |
| 13712 | get_cpu_info(region)); | |
| 13644 | 13713 | } |
| 13645 | 13714 | break; |
| 13646 | 13715 | |
| 13647 | 13716 | case kAddressSpace_MappedMemory: |
| 13648 | 13717 | { |
| 13649 | int relativeAddress; | |
| 13650 | UINT8 ** buf; | |
| 13718 | int relative_address; | |
| 13719 | UINT8 **buf; | |
| 13651 | 13720 | |
| 13652 | action->cached_pointer = | |
| 13721 | action->cached_pointer = look_up_handler_memory(region, address, &action->cached_offset); | |
| 13653 | 13722 | buf = action->cached_pointer; |
| 13654 | relative | |
| 13723 | relative_address = action->cached_offset; | |
| 13655 | 13724 | |
| 13656 | 13725 | if(buf && *buf) |
| 13657 | { | |
| 13658 | if(action->flags & kActionFlag_PDWWrite) | |
| 13659 | { | |
| 13660 | if(action->flags & kActionFlag_IsFirst) | |
| 13661 | { | |
| 13662 | relativeAddress += bytes; | |
| 13663 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13664 | action->flags &= ~kActionFlag_IsFirst; | |
| 13665 | } | |
| 13666 | else | |
| 13667 | action->flags |= kActionFlag_IsFirst; | |
| 13668 | } | |
| 13669 | ||
| 13670 | DoMemoryWrite(data, *buf, relativeAddress, bytes, cpu_needs_swap(cpu) ^ EXTRACT_FIELD(action->type, Endianness), get_cpu_info(cpu)); | |
| 13671 | } | |
| 13726 | do_memory_write(data, *buf, relative_address, bytes, | |
| 13727 | cpu_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness), | |
| 13728 | get_cpu_info(region)); | |
| 13672 | 13729 | } |
| 13673 | 13730 | break; |
| 13674 | 13731 | |
| 13675 | 13732 | case kAddressSpace_EEPROM: |
| 13676 | 13733 | { |
| 13677 | 13734 | int length; |
| 13678 | UINT8 | |
| 13735 | UINT8 | |
| 13679 | 13736 | |
| 13680 | 13737 | buf = eeprom_get_data_pointer(&length); |
| 13681 | 13738 | |
| 13682 | 13739 | if(is_address_in_range(action, length)) |
| 13683 | { | |
| 13684 | if(action->flags & kActionFlag_PDWWrite) | |
| 13685 | { | |
| 13686 | if(action->flags & kActionFlag_IsFirst) | |
| 13687 | { | |
| 13688 | address += bytes; | |
| 13689 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13690 | action->flags &= ~kActionFlag_IsFirst; | |
| 13691 | } | |
| 13692 | else | |
| 13693 | action->flags |= kActionFlag_IsFirst; | |
| 13694 | } | |
| 13695 | ||
| 13696 | DoMemoryWrite(data, buf, address, bytes, 0, &raw_cpu_info); | |
| 13697 | } | |
| 13740 | do_memory_write(data, buf, address, bytes, 0, &raw_cpu_info); | |
| 13698 | 13741 | } |
| 13699 | 13742 | break; |
| 13700 | 13743 | } |
| 13701 | 13744 | } |
| 13702 | 13745 | else |
| 13703 | 13746 | { |
| 13704 | /* write a data into region */ | |
| 13705 | UINT8 * buf = memory_region(action->region); | |
| 13747 | /* non-CPU region */ | |
| 13748 | UINT8 * buf = memory_region(region); | |
| 13706 | 13749 | |
| 13707 | if(buf | |
| 13750 | if(buf | |
| 13708 | 13751 | { |
| 13709 | if(action->flags & kActionFlag_PDWWrite) | |
| 13710 | { | |
| 13711 | if(action->flags & kActionFlag_IsFirst) | |
| 13712 | { | |
| 13713 | address += bytes; | |
| 13714 | bytes = EXTRACT_FIELD(action->type, CodeParameterLower) + 1; | |
| 13715 | action->flags &= ~kActionFlag_IsFirst; | |
| 13716 | } | |
| 13717 | else | |
| 13718 | action->flags |= kActionFlag_IsFirst; | |
| 13719 | } | |
| 13720 | ||
| 13721 | DoMemoryWrite(data, buf, address, bytes, region_needs_swap(action->region) ^ EXTRACT_FIELD(action->type, Endianness), get_region_info(action->region)); | |
| 13752 | if(is_address_in_range(action, memory_region_length(region))) | |
| 13753 | do_memory_write(data, buf, address, bytes, | |
| 13754 | region_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness), | |
| 13755 | get_region_info(action->region)); | |
| 13722 | 13756 | } |
| 13723 | 13757 | } |
| 13724 | 13758 | } |
| 13725 | 13759 | else |
| 13726 | cheatVariable[action->address] = data & kCheatSizeMaskTable[EXTRACT_FIELD(action->type, AddressSize)]; | |
| 13760 | { | |
| 13761 | /* write a data to variable */ | |
| 13762 | cheat_variable[action->address] = data & kCheatSizeMaskTable[bytes]; | |
| 13763 | } | |
| 13727 | 13764 | } |
| 13728 | 13765 | |
| 13729 | /*------------------------------------------------------------------------------------ | |
| 13730 | WatchCheatEntry - set watchpoint when watch value key is pressed in several menus | |
| 13731 | ------------------------------------------------------------------------------------*/ | |
| 13766 | /*-------------------------------------------------------------------------------------- | |
| 13767 | watch_cheat_entry - set watchpoint when watch value key is pressed in several menus | |
| 13768 | --------------------------------------------------------------------------------------*/ | |
| 13732 | 13769 | |
| 13733 | static void | |
| 13770 | static void watch_cheat_entry(cheat_entry *entry, UINT8 associate) | |
| 13734 | 13771 | { |
| 13735 | 13772 | int i, j; |
| 13736 | cheat_entry *associate | |
| 13773 | cheat_entry *associate_entry = NULL; | |
| 13737 | 13774 | |
| 13738 | 13775 | /* NOTE : calling with associate = 1 doesn't exist right now */ |
| 13739 | 13776 | if(associate) |
| 13740 | associate | |
| 13777 | associate_entry = entry; | |
| 13741 | 13778 | |
| 13742 | if( | |
| 13779 | if( | |
| 13743 | 13780 | { |
| 13744 | SET_MESSAGE( | |
| 13781 | SET_MESSAGE( | |
| 13745 | 13782 | return; |
| 13746 | 13783 | } |
| 13747 | 13784 | |
| r2844 | r2845 | |
| 13749 | 13786 | { |
| 13750 | 13787 | cheat_action *action = &entry->action_list[i]; |
| 13751 | 13788 | |
| 13752 | if( | |
| 13789 | if( | |
| 13753 | 13790 | { |
| 13754 | 13791 | /* NOTE : unsupported the watchpoint for indirect index right now */ |
| 13755 | if( | |
| 13792 | if( | |
| 13756 | 13793 | continue; |
| 13757 | 13794 | |
| 13758 | if( | |
| 13795 | if( | |
| 13759 | 13796 | { |
| 13760 | 13797 | /* first cheat action */ |
| 13761 | | |
| 13798 | add_action_watch(&entry->action_list[i], associate_entry); | |
| 13762 | 13799 | } |
| 13763 | 13800 | else |
| 13764 | 13801 | { |
| 13765 | 13802 | /* 2nd or later cheat action */ |
| 13766 | UINT8 different | |
| 13803 | UINT8 different_address = 1; | |
| 13767 | 13804 | |
| 13768 | 13805 | for(j = 0; j < i; j++) |
| 13769 | 13806 | { |
| 13770 | 13807 | /* if we find the same address cheat action, skip it */ |
| 13771 | 13808 | if(entry->action_list[j].address == entry->action_list[i].address) |
| 13772 | different | |
| 13809 | different_address = 0; | |
| 13773 | 13810 | } |
| 13774 | 13811 | |
| 13775 | if(differentAddress) | |
| 13776 | AddActionWatch(&entry->action_list[i], associateEntry); | |
| 13812 | if(different_address) | |
| 13813 | add_action_watch(&entry->action_list[i], associate_entry); | |
| 13777 | 13814 | } |
| 13778 | 13815 | } |
| 13779 | 13816 | } |
| 13780 | 13817 | |
| 13781 | SET_MESSAGE( | |
| 13818 | SET_MESSAGE( | |
| 13782 | 13819 | } |
| 13783 | 13820 | |
| 13784 | /*----------------------------------------------------------------------- | |
| 13785 | AddActionWatch - set watchpoint parameters into WatchInfo. | |
| 13786 | called from WatchCheatEntry() when watch value key | |
| 13787 | or ActivateCheat() via watchpoint code. | |
| 13788 | -----------------------------------------------------------------------*/ | |
| 13821 | /*-------------------------------------------------------------------------- | |
| 13822 | add_action_watch - set watchpoint parameters into watch info | |
| 13823 | called from watch_cheat_entry() when watch value key | |
| 13824 | or activate_cheat() via watchpoint code | |
| 13825 | --------------------------------------------------------------------------*/ | |
| 13789 | 13826 | |
| 13790 | static void | |
| 13827 | static void add_action_watch(cheat_action *action, cheat_entry *entry) | |
| 13791 | 13828 | { |
| 13792 | 13829 | switch(EXTRACT_FIELD(action->type, CodeType)) |
| 13793 | 13830 | { |
| r2844 | r2845 | |
| 13863 | 13900 | } |
| 13864 | 13901 | } |
| 13865 | 13902 | |
| 13866 | /*------------------------------------------------------------------------------ | |
| 13867 | RemoveAssociatedWatches - delete watchpoints when watchpoint code is "OFF". | |
| 13868 | called from DeactivateCheat(). | |
| 13869 | ------------------------------------------------------------------------------*/ | |
| 13903 | /*------------------------------------------------------------------------------- | |
| 13904 | remove_associated_watches - delete watchpoints when watchpoint CODE is "OFF" | |
| 13905 | called from deactivate_cheat(). | |
| 13906 | -------------------------------------------------------------------------------*/ | |
| 13870 | 13907 | |
| 13871 | static void | |
| 13908 | static void remove_associated_watches(cheat_entry *entry) | |
| 13872 | 13909 | { |
| 13873 | 13910 | int i; |
| 13874 | 13911 | |
| r2844 | r2845 | |
| 13881 | 13918 | } |
| 13882 | 13919 | } |
| 13883 | 13920 | |
| 13884 | /*-------------------------------------------------- | |
| 13885 | ResetAction - back up data and set action flags | |
| 13886 | --------------------------------------------------*/ | |
| 13921 | /*--------------------------------------------------- | |
| 13922 | reset_action - back up data and set action flags | |
| 13923 | ---------------------------------------------------*/ | |
| 13887 | 13924 | |
| 13888 | static void | |
| 13925 | static void reset_action(cheat_action *action) | |
| 13889 | 13926 | { |
| 13890 | if(action->flags & kActionFlag_NoAction) | |
| 13891 | return; | |
| 13892 | ||
| 13893 | 13927 | /* back up a value */ |
| 13894 | 13928 | if(action->flags & kActionFlag_OldFormat) |
| 13895 | 13929 | { |
| 13896 | 13930 | UINT32 type = action->type; |
| 13897 | 13931 | |
| 13898 | action->last_value = malloc_or_die(sizeof(action->last_value)); | |
| 13932 | action->last_value = malloc(sizeof(action->last_value)); | |
| 13933 | if(action->last_value == NULL) goto reset_action_error; | |
| 13899 | 13934 | action->type = convert_to_new_code(action); |
| 13900 | action->last_value[0] = | |
| 13935 | action->last_value[0] = read_data(action); | |
| 13901 | 13936 | action->type = type; |
| 13902 | 13937 | } |
| 13903 | 13938 | else |
| 13904 | 13939 | { |
| 13905 | if( | |
| 13940 | if( | |
| 13906 | 13941 | { |
| 13907 | | |
| 13942 | | |
| 13908 | 13943 | { |
| 13909 | default: | |
| 13910 | action->last_value = malloc_or_die(sizeof(action->last_value)); | |
| 13911 | action->last_value[0] = ReadData(action); | |
| 13912 | break; | |
| 13944 | switch(EXTRACT_FIELD(action->type, CodeType)) | |
| 13945 | { | |
| 13946 | default: | |
| 13947 | /* Write, IWrite, CWrite, CBit */ | |
| 13948 | action->last_value = malloc(sizeof(action->last_value)); | |
| 13949 | if(action->last_value == NULL) goto reset_action_error; | |
| 13950 | action->last_value[0] = read_data(action); | |
| 13951 | break; | |
| 13913 | 13952 | |
| 13914 | case kCodeType_PDWWrite: | |
| 13915 | action->last_value = malloc_or_die(sizeof(action->last_value) * 2); | |
| 13916 | action->last_value[0] = ReadData(action); | |
| 13917 | action->last_value[1] = ReadData(action); | |
| 13918 | break; | |
| 13953 | case kCodeType_PDWWrite: | |
| 13954 | action->last_value = malloc(sizeof(action->last_value) * 2); | |
| 13955 | if(action->last_value == NULL) goto reset_action_error; | |
| 13956 | action->flags &= ~kActionFlag_IsFirst; | |
| 13957 | action->last_value[0] = read_data(action); | |
| 13958 | action->last_value[1] = read_data(action); | |
| 13959 | break; | |
| 13919 | 13960 | |
| 13920 | case kCodeType_RWrite: | |
| 13921 | { | |
| 13922 | int i; | |
| 13961 | case kCodeType_RWrite: | |
| 13962 | { | |
| 13963 | int i; | |
| 13923 | 13964 | |
| 13924 | for(i = 0; i < EXTRACT_FIELD(action->extend_data, LSB16); i++) | |
| 13925 | { | |
| 13926 | action->last_value = realloc(action->last_value, sizeof(action->last_value) * EXTRACT_FIELD(action->extend_data, LSB16)); | |
| 13927 | action->last_value[i] = ReadData(action); | |
| 13928 | action->address += EXTRACT_FIELD(action->extend_data, MSB16) ? | |
| 13929 | EXTRACT_FIELD(action->extend_data, MSB16) : | |
| 13930 | kSearchByteIncrementTable[EXTRACT_FIELD(action->type, AddressSize)]; | |
| 13965 | for(i = 0; i < EXTRACT_FIELD(action->extend_data, LSB16); i++) | |
| 13966 | { | |
| 13967 | action->last_value = realloc(action->last_value, sizeof(action->last_value) * EXTRACT_FIELD(action->extend_data, LSB16)); | |
| 13968 | if(action->last_value == NULL) goto reset_action_error; | |
| 13969 | action->last_value[i] = read_data(action); | |
| 13970 | action->address += EXTRACT_FIELD(action->extend_data, MSB16) ? | |
| 13971 | EXTRACT_FIELD(action->extend_data, MSB16) : | |
| 13972 | kSearchByteIncrementTable[EXTRACT_FIELD(action->type, AddressSize)]; | |
| 13973 | } | |
| 13974 | ||
| 13975 | action->address = action->original_address; | |
| 13931 | 13976 | } |
| 13932 | action->address = action->original_address; | |
| 13933 | } | |
| 13934 | break; | |
| 13977 | break; | |
| 13978 | } | |
| 13935 | 13979 | } |
| 13936 | 13980 | } |
| 13981 | else | |
| 13982 | action->last_value = NULL; | |
| 13937 | 13983 | } |
| 13938 | 13984 | |
| 13939 | 13985 | action->frame_timer = 0; |
| r2844 | r2845 | |
| 13943 | 13989 | if(action->flags & kActionFlag_CheckCondition) |
| 13944 | 13990 | { |
| 13945 | 13991 | if(EXTRACT_FIELD(action->type, CodeParameter) == kCondition_PreviousValue) |
| 13946 | { | |
| 13947 | if(EXTRACT_FIELD(action->type, CodeType) == kCodeType_CWrite) | |
| 13948 | action->extend_data = ReadData(action); | |
| 13949 | else | |
| 13950 | action->data = ReadData(action); | |
| 13951 | } | |
| 13992 | action->extend_data = read_data(action); | |
| 13952 | 13993 | } |
| 13994 | ||
| 13995 | return; | |
| 13996 | ||
| 13997 | reset_action_error: | |
| 13998 | ||
| 13999 | fatalerror("cheat:[last value] memory allocation error\n" | |
| 14000 | " ----- %s -----\n" | |
| 14001 | " type = %.8X\n" | |
| 14002 | " last_value = %p\n", | |
| 14003 | action->optional_name, action->type, action->last_value); | |
| 13953 | 14004 | } |
| 13954 | 14005 | |
| 13955 | /*------------------------------------------------------------------------------------- | |
| 13956 | ActivateCheat - reset action entry and set activate entry flag when turn CODE "ON" | |
| 13957 | -------------------------------------------------------------------------------------*/ | |
| 14006 | /*-------------------------------------------------------------------------------------- | |
| 14007 | activate_cheat - reset action entry and set activate entry flag when turn CODE "ON" | |
| 14008 | --------------------------------------------------------------------------------------*/ | |
| 13958 | 14009 | |
| 13959 | static void | |
| 14010 | static void activate_cheat(cheat_entry *entry) | |
| 13960 | 14011 | { |
| 13961 | int | |
| 14012 | int i; | |
| 13962 | 14013 | |
| 13963 | 14014 | for(i = 0; i < entry->action_list_length; i++) |
| 13964 | 14015 | { |
| 13965 | 14016 | cheat_action *action = &entry->action_list[i]; |
| 13966 | 14017 | |
| 13967 | | |
| 14018 | reset_action(action); | |
| 13968 | 14019 | |
| 13969 | 14020 | /* if watchpoint code, add watchpoint */ |
| 13970 | 14021 | if(EXTRACT_FIELD(action->type, CodeType) == kCodeType_Watch) |
| 13971 | | |
| 14022 | add_action_watch(action, entry); | |
| 13972 | 14023 | } |
| 13973 | 14024 | |
| 13974 | 14025 | /* set activate flag */ |
| 13975 | 14026 | entry->flags |= kCheatFlag_Active; |
| 13976 | 14027 | } |
| 13977 | 14028 | |
| 13978 | /*-------------------------------------------------------------------------------------- | |
| 13979 | DeactivateCheat - restore previous value and remove watchpoint when turn CODE "OFF" | |
| 13980 | --------------------------------------------------------------------------------------*/ | |
| 14029 | /*-------------------------------------------------------- | |
| 14030 | restore_last_value - restore previous value if needed | |
| 14031 | --------------------------------------------------------*/ | |
| 13981 | 14032 | |
| 13982 | static void | |
| 14033 | static void restore_last_value | |
| 13983 | 14034 | { |
| 13984 | int i; | |
| 13985 | ||
| 13986 | for(i = 0; i < entry->action_list_length; i++) | |
| 14035 | if(action->flags & kActionFlag_MemoryWrite) | |
| 13987 | 14036 | { |
| 13988 | cheat_action *action = &entry->action_list[i]; | |
| 13989 | ||
| 13990 | /* restore previous value and clear backup flag if needed */ | |
| 13991 | if(TEST_FIELD(action->type, RestoreValue) && (action->flags & kActionFlag_LastValueGood)) | |
| 14037 | if(TEST_FIELD(action->type, RestoreValue)) | |
| 13992 | 14038 | { |
| 13993 | 14039 | switch(EXTRACT_FIELD(action->type, CodeType)) |
| 13994 | 14040 | { |
| 13995 | 14041 | default: |
| 13996 | WriteData(action, (UINT32)action->last_value[0]); | |
| 14042 | /* Write, IWrite, CWrite, CBit */ | |
| 14043 | write_data(action, (UINT32)action->last_value[0]); | |
| 13997 | 14044 | break; |
| 13998 | 14045 | |
| 13999 | 14046 | case kCodeType_PDWWrite: |
| 14000 | WriteData(action, (UINT32)action->last_value[0]); | |
| 14001 | WriteData(action, (UINT32)action->last_value[1]); | |
| 14047 | action->flags &= ~kActionFlag_IsFirst; | |
| 14048 | write_data(action, (UINT32)action->last_value[0]); | |
| 14049 | write_data(action, (UINT32)action->last_value[1]); | |
| 14002 | 14050 | break; |
| 14003 | 14051 | |
| 14004 | 14052 | case kCodeType_RWrite: |
| r2844 | r2845 | |
| 14007 | 14055 | |
| 14008 | 14056 | for(j = 0; j < EXTRACT_FIELD(action->extend_data, LSB16); j++) |
| 14009 | 14057 | { |
| 14010 | | |
| 14058 | write_data(action, (UINT32)action->last_value[j]); | |
| 14011 | 14059 | action->address += EXTRACT_FIELD(action->extend_data, MSB16) ? |
| 14012 | 14060 | EXTRACT_FIELD(action->extend_data, MSB16) : |
| 14013 | 14061 | kSearchByteIncrementTable[EXTRACT_FIELD(action->type, AddressSize)]; |
| r2844 | r2845 | |
| 14016 | 14064 | } |
| 14017 | 14065 | break; |
| 14018 | 14066 | } |
| 14067 | } | |
| 14068 | } | |
| 14069 | } | |
| 14070 | ||
| 14071 | /*------------------------------------------------------------------------- | |
| 14072 | deactivate_cheat - deactivate selecte cheat entry when turn CODE "OFF" | |
| 14073 | -------------------------------------------------------------------------*/ | |
| 14074 | ||
| 14075 | static void deactivate_cheat(cheat_entry *entry) | |
| 14076 | { | |
| 14077 | int i; | |
| 14078 | ||
| 14079 | for(i = 0; i < entry->action_list_length; i++) | |
| 14080 | { | |
| 14081 | cheat_action *action = &entry->action_list[i]; | |
| 14082 | ||
| 14083 | action->frame_timer = 0; | |
| 14084 | action->flags &= ~kActionFlag_OperationDone; | |
| 14085 | ||
| 14086 | /* restore previous value if needed */ | |
| 14087 | if(action->last_value) | |
| 14088 | { | |
| 14089 | restore_last_value(action); | |
| 14019 | 14090 | action->flags &= ~kActionFlag_LastValueGood; |
| 14091 | free(action->last_value); | |
| 14020 | 14092 | } |
| 14021 | ||
| 14093 | ||
| 14022 | 14094 | action->last_value = NULL; |
| 14023 | 14095 | } |
| 14024 | 14096 | |
| 14025 | 14097 | /* remove watchpoint */ |
| 14026 | | |
| 14098 | remove_associated_watches(entry); | |
| 14027 | 14099 | |
| 14028 | 14100 | /* clear active flag */ |
| 14029 | 14101 | entry->flags &= ~kCheatFlag_StateMask; |
| 14030 | 14102 | } |
| 14031 | 14103 | |
| 14032 | /*-------------------------------------------------------------------- | |
| 14033 | TempDeactivateCheat - restore previous value when turn CHEAT "OFF" | |
| 14034 | --------------------------------------------------------------------*/ | |
| 14104 | /*----------------------------------------------------------------- | |
| 14105 | temp_deactivate_cheat - deactivate cheat when turn CHEAT "OFF" | |
| 14106 | -----------------------------------------------------------------*/ | |
| 14035 | 14107 | |
| 14036 | static void | |
| 14108 | static void temp_deactivate_cheat(cheat_entry *entry) | |
| 14037 | 14109 | { |
| 14038 | 14110 | if(entry->flags & kCheatFlag_Active) |
| 14039 | 14111 | { |
| r2844 | r2845 | |
| 14047 | 14119 | action->flags &= ~kActionFlag_OperationDone; |
| 14048 | 14120 | |
| 14049 | 14121 | /* restore previous value if needed */ |
| 14050 | switch(EXTRACT_FIELD(action->type, CodeType)) | |
| 14051 | { | |
| 14052 | default: | |
| 14053 | WriteData(action, (UINT32)action->last_value[0]); | |
| 14054 | break; | |
| 14055 | ||
| 14056 | case kCodeType_PDWWrite: | |
| 14057 | WriteData(action, (UINT32)action->last_value[0]); | |
| 14058 | WriteData(action, (UINT32)action->last_value[1]); | |
| 14059 | break; | |
| 14060 | ||
| 14061 | case kCodeType_RWrite: | |
| 14062 | { | |
| 14063 | int j; | |
| 14064 | ||
| 14065 | for(j = 0; j < EXTRACT_FIELD(action->extend_data, LSB16); j++) | |
| 14066 | { | |
| 14067 | WriteData(action, (UINT32)action->last_value[j]); | |
| 14068 | action->address += EXTRACT_FIELD(action->extend_data, MSB16) ? | |
| 14069 | EXTRACT_FIELD(action->extend_data, MSB16) : | |
| 14070 | kSearchByteIncrementTable[EXTRACT_FIELD(action->type, AddressSize)]; | |
| 14071 | } | |
| 14072 | action->address = action->original_address; | |
| 14073 | } | |
| 14074 | break; | |
| 14075 | } | |
| 14122 | if(action->last_value) | |
| 14123 | restore_last_value(action); | |
| 14076 | 14124 | } |
| 14077 | 14125 | } |
| 14078 | 14126 | } |
| 14079 | 14127 | |
| 14080 | ||
| 14081 | 14128 | /*------------------------------------------------------------ |
| 14082 | 14129 | cheat_periodicOperation - management for cheat operations |
| 14083 | 14130 | ------------------------------------------------------------*/ |
| 14084 | 14131 | |
| 14085 | 14132 | static void cheat_periodicOperation(cheat_action *action) |
| 14086 | 14133 | { |
| 14087 | int data = TEST_FIELD(action->type, DataRead) ? cheat | |
| 14134 | int data = TEST_FIELD(action->type, DataRead) ? cheat_variable[action->data] : action->data; | |
| 14088 | 14135 | |
| 14089 | 14136 | if(action->flags & kActionFlag_PDWWrite) |
| 14090 | 14137 | { |
| 14091 | 14138 | action->flags &= ~kActionFlag_IsFirst; |
| 14092 | WriteData(action, data); | |
| 14093 | WriteData(action, action->extend_data); | |
| 14139 | write_data(action, data); | |
| 14140 | write_data(action, action->extend_data); | |
| 14094 | 14141 | } |
| 14095 | 14142 | else if(action->flags & kActionFlag_Repeat) |
| 14096 | 14143 | { |
| r2844 | r2845 | |
| 14098 | 14145 | |
| 14099 | 14146 | for(i = 0; i < EXTRACT_FIELD(action->extend_data, LSB16); i++) |
| 14100 | 14147 | { |
| 14101 | | |
| 14148 | write_data(action, data); | |
| 14102 | 14149 | action->address += EXTRACT_FIELD(action->extend_data, MSB16) ? |
| 14103 | 14150 | EXTRACT_FIELD(action->extend_data, MSB16) : |
| 14104 | 14151 | kSearchByteIncrementTable[EXTRACT_FIELD(action->type, AddressSize)]; |
| r2844 | r2845 | |
| 14110 | 14157 | switch(EXTRACT_FIELD(action->type, CodeType)) |
| 14111 | 14158 | { |
| 14112 | 14159 | case kCodeType_Write: |
| 14113 | | |
| 14160 | write_data(action, (data & action->extend_data) | (read_data(action) & ~action->extend_data)); | |
| 14114 | 14161 | break; |
| 14115 | 14162 | |
| 14116 | 14163 | case kCodeType_IWrite: |
| 14117 | 14164 | switch(EXTRACT_FIELD(action->type, CodeParameter)) |
| 14118 | 14165 | { |
| 14119 | 14166 | case IWRITE_WRITE: |
| 14120 | | |
| 14167 | write_data(action, data); | |
| 14121 | 14168 | break; |
| 14122 | 14169 | |
| 14123 | 14170 | case IWRITE_BIT_SET: |
| 14124 | | |
| 14171 | write_data(action, read_data(action) | data); | |
| 14125 | 14172 | break; |
| 14126 | 14173 | |
| 14127 | 14174 | case IWRITE_BIT_CLEAR: |
| 14128 | | |
| 14175 | write_data(action, read_data(action) & ~data); | |
| 14129 | 14176 | break; |
| 14130 | 14177 | |
| 14131 | 14178 | case IWRITE_LIMITED_MASK: |
| 14132 | | |
| 14179 | write_data(action, (EXTRACT_FIELD(data, MSB16) & EXTRACT_FIELD(data, LSB16)) | (read_data(action) & ~EXTRACT_FIELD(data, LSB16))); | |
| 14133 | 14180 | break; |
| 14134 | 14181 | } |
| 14135 | 14182 | break; |
| 14136 | 14183 | |
| 14137 | 14184 | case kCodeType_CWrite: |
| 14138 | | |
| 14185 | write_data(action, data); | |
| 14139 | 14186 | break; |
| 14140 | 14187 | |
| 14141 | 14188 | case kCodeType_CBit: |
| 14142 | 14189 | switch(EXTRACT_FIELD(action->type, CodeParameterUpper)) |
| 14143 | 14190 | { |
| 14144 | 14191 | case CBIT_BIT_SET: |
| 14145 | | |
| 14192 | write_data(action, read_data(action) | data); | |
| 14146 | 14193 | break; |
| 14147 | 14194 | |
| 14148 | 14195 | case CBIT_BIT_CLEAR: |
| 14149 | | |
| 14196 | write_data(action, read_data(action) & ~data); | |
| 14150 | 14197 | break; |
| 14151 | 14198 | |
| 14152 | 14199 | case CBIT_LIMITED_MASK: |
| 14153 | | |
| 14200 | write_data(action, (EXTRACT_FIELD(data, MSB16) & EXTRACT_FIELD(data, LSB16)) | (read_data(action) & ~EXTRACT_FIELD(data, LSB16))); | |
| 14154 | 14201 | break; |
| 14155 | 14202 | } |
| 14156 | 14203 | break; |
| 14157 | 14204 | |
| 14158 | 14205 | case kCodeType_Move: |
| 14159 | cheat | |
| 14206 | cheat_variable[EXTRACT_FIELD(action->type, CodeParameter)] = read_data(action) + data; | |
| 14160 | 14207 | break; |
| 14161 | 14208 | |
| 14162 | 14209 | case kCodeType_Popup: |
| r2844 | r2845 | |
| 14170 | 14217 | ui_popup_time(1, "%*.*X", |
| 14171 | 14218 | kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)], |
| 14172 | 14219 | kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)], |
| 14173 | | |
| 14220 | read_data(action)); | |
| 14174 | 14221 | break; |
| 14175 | 14222 | |
| 14176 | 14223 | case kPopup_LabelValue: |
| r2844 | r2845 | |
| 14178 | 14225 | action->optional_name, |
| 14179 | 14226 | kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)], |
| 14180 | 14227 | kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)], |
| 14181 | | |
| 14228 | read_data(action)); | |
| 14182 | 14229 | break; |
| 14183 | 14230 | |
| 14184 | 14231 | case kPopup_ValueLabel: |
| 14185 | 14232 | ui_popup_time(1, "%*.*X %s", |
| 14186 | 14233 | kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)], |
| 14187 | 14234 | kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)], |
| 14188 | | |
| 14235 | read_data(action), | |
| 14189 | 14236 | action->optional_name); |
| 14190 | 14237 | break; |
| 14191 | 14238 | } |
| r2844 | r2845 | |
| 14204 | 14251 | |
| 14205 | 14252 | static UINT8 cheat_periodicCondition(cheat_action *action) |
| 14206 | 14253 | { |
| 14207 | int data = | |
| 14254 | int data = read_data(action); | |
| 14208 | 14255 | int value = action->extend_data; |
| 14209 | 14256 | |
| 14210 | 14257 | if(EXTRACT_FIELD(action->type, CodeType) != kCodeType_CBit) |
| r2844 | r2845 | |
| 14239 | 14286 | case kCondition_PreviousValue: |
| 14240 | 14287 | if(data != value) |
| 14241 | 14288 | { |
| 14242 | if(EXTRACT_FIELD(action->type, CodeType) == kCodeType_CWrite) | |
| 14243 | action->extend_data = data; | |
| 14244 | else | |
| 14245 | action->data = data; | |
| 14246 | ||
| 14289 | action->extend_data = data; | |
| 14247 | 14290 | return 1; |
| 14248 | 14291 | } |
| 14249 | 14292 | break; |
| r2844 | r2845 | |
| 14280 | 14323 | |
| 14281 | 14324 | static int cheat_periodicAction(running_machine *machine, cheat_action *action, int selection) |
| 14282 | 14325 | { |
| 14283 | UINT8 execute | |
| 14326 | UINT8 execute_operation = 0; | |
| 14284 | 14327 | |
| 14285 | 14328 | if(TEST_FIELD(action->type, PrefillEnable)) |
| 14286 | 14329 | { |
| r2844 | r2845 | |
| 14291 | 14334 | if((action->flags & kActionFlag_PrefillWritten) == 0) |
| 14292 | 14335 | { |
| 14293 | 14336 | /* set prefill */ |
| 14294 | | |
| 14337 | write_data(action, prefillValue); | |
| 14295 | 14338 | action->flags |= kActionFlag_PrefillWritten; |
| 14296 | 14339 | return (TEST_FIELD(action->type, Return) ? CHEAT_RETURN_VALUE : selection + 1); |
| 14297 | 14340 | } |
| 14298 | 14341 | else |
| 14299 | 14342 | { |
| 14300 | 14343 | /* do re-write */ |
| 14301 | if( | |
| 14344 | if(read_data(action) == prefillValue) | |
| 14302 | 14345 | return (TEST_FIELD(action->type, Return) ? CHEAT_RETURN_VALUE : selection + 1); |
| 14303 | 14346 | |
| 14304 | 14347 | action->flags |= kActionFlag_PrefillDone; |
| r2844 | r2845 | |
| 14311 | 14354 | if(TEST_FIELD(action->type, OneShot) && TEST_FIELD(action->type, RestoreValue)) |
| 14312 | 14355 | { |
| 14313 | 14356 | /* Keep */ |
| 14314 | execute | |
| 14357 | execute_operation = 1; | |
| 14315 | 14358 | |
| 14316 | 14359 | if(action->frame_timer++ >= EXTRACT_FIELD(action->type, DelayEnable) * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds)) |
| 14317 | 14360 | action->flags |= kActionFlag_OperationDone; |
| r2844 | r2845 | |
| 14321 | 14364 | if(action->frame_timer++ >= EXTRACT_FIELD(action->type, DelayEnable) * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds)) |
| 14322 | 14365 | { |
| 14323 | 14366 | /* Delay */ |
| 14324 | execute | |
| 14367 | execute_operation = 1; | |
| 14325 | 14368 | action->frame_timer = 0; |
| 14326 | 14369 | |
| 14327 | 14370 | if(TEST_FIELD(action->type, OneShot)) |
| r2844 | r2845 | |
| 14333 | 14376 | { |
| 14334 | 14377 | if(action->frame_timer++) |
| 14335 | 14378 | { |
| 14336 | if(action->frame_timer >= EXTRACT_FIELD(action->type, DelayEnable) | |
| 14379 | if(action->frame_timer >= EXTRACT_FIELD(action->type, DelayEnable) + ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds)) | |
| 14337 | 14380 | action->frame_timer = 0; |
| 14338 | 14381 | |
| 14339 | 14382 | return (TEST_FIELD(action->type, Return) ? CHEAT_RETURN_VALUE : selection + 1); |
| 14340 | 14383 | } |
| 14341 | 14384 | else |
| 14342 | { | |
| 14343 | executeOperation = 1; | |
| 14344 | ||
| 14345 | action->flags |= kActionFlag_OperationDone; | |
| 14346 | } | |
| 14385 | execute_operation = 1; | |
| 14347 | 14386 | } |
| 14348 | 14387 | |
| 14349 | 14388 | if(action->flags & kActionFlag_CheckCondition) |
| 14350 | 14389 | { |
| 14351 | 14390 | if(cheat_periodicCondition(action)) |
| 14352 | execute | |
| 14391 | execute_operation = 1; | |
| 14353 | 14392 | else |
| 14354 | execute | |
| 14393 | execute_operation = 0; | |
| 14355 | 14394 | } |
| 14356 | 14395 | |
| 14357 | if(execute | |
| 14396 | if(execute_operation) | |
| 14358 | 14397 | { |
| 14359 | 14398 | /* do cheat operation */ |
| 14360 | 14399 | switch(EXTRACT_FIELD(action->type, CodeType)) |
| r2844 | r2845 | |
| 14375 | 14414 | |
| 14376 | 14415 | case kCodeType_Loop: |
| 14377 | 14416 | { |
| 14378 | int counter = | |
| 14417 | int counter = read_data(action); | |
| 14379 | 14418 | |
| 14380 | 14419 | if(counter != 0) |
| 14381 | 14420 | { |
| 14382 | | |
| 14421 | write_data(action, counter - 1); | |
| 14383 | 14422 | |
| 14384 | return (TEST_FIELD(action->type, DataRead) ? cheat | |
| 14423 | return (TEST_FIELD(action->type, DataRead) ? cheat_variable[action->data] : action->data); | |
| 14385 | 14424 | } |
| 14386 | 14425 | } |
| 14387 | 14426 | } |
| r2844 | r2845 | |
| 14405 | 14444 | if(!ui_is_menu_active()) |
| 14406 | 14445 | { |
| 14407 | 14446 | /* NOTE : activation key should be not checked in activating UI menu because it conflicts activation key checker */ |
| 14408 | if((entry->flags & kCheatFlag_HasActivationKey1) && input_code_pressed_once(entry->activation_key1)) | |
| 14447 | if((entry->flags & kCheatFlag_HasActivationKey1) && input_code_pressed_once(entry->activation_key_1)) | |
| 14409 | 14448 | pressedKey = 1; |
| 14410 | else if((entry->flags & kCheatFlag_HasActivationKey2) && input_code_pressed_once(entry->activation_key2)) | |
| 14449 | else if((entry->flags & kCheatFlag_HasActivationKey2) && input_code_pressed_once(entry->activation_key_2)) | |
| 14411 | 14450 | pressedKey = 2; |
| 14412 | 14451 | } |
| 14413 | 14452 | |
| r2844 | r2845 | |
| 14428 | 14467 | |
| 14429 | 14468 | /* NOTE : in handling activatio key, forced to activate a cheat even if one shot */ |
| 14430 | 14469 | if(!(entry->flags & kCheatFlag_OneShot) && !(entry->label_index[entry->selection])) |
| 14431 | | |
| 14470 | deactivate_cheat(entry); | |
| 14432 | 14471 | else |
| 14433 | | |
| 14472 | activate_cheat(entry); | |
| 14434 | 14473 | |
| 14435 | 14474 | if(TEST_FIELD(cheat_options, ActivationKeyMessage)) |
| 14436 | 14475 | { |
| r2844 | r2845 | |
| 14448 | 14487 | { |
| 14449 | 14488 | if(entry->flags & kCheatFlag_OneShot) |
| 14450 | 14489 | { |
| 14451 | | |
| 14490 | activate_cheat(entry); | |
| 14452 | 14491 | |
| 14453 | 14492 | if(TEST_FIELD(cheat_options, ActivationKeyMessage)) |
| 14454 | 14493 | ui_popup_time(1,"set %s", entry->name); |
| 14455 | 14494 | } |
| 14456 | 14495 | else if(entry->flags & kCheatFlag_Active) |
| 14457 | 14496 | { |
| 14458 | | |
| 14497 | deactivate_cheat(entry); | |
| 14459 | 14498 | |
| 14460 | 14499 | if(TEST_FIELD(cheat_options, ActivationKeyMessage)) |
| 14461 | 14500 | ui_popup_time(1,"%s disabled", entry->name); |
| 14462 | 14501 | } |
| 14463 | 14502 | else |
| 14464 | 14503 | { |
| 14465 | | |
| 14504 | activate_cheat(entry); | |
| 14466 | 14505 | |
| 14467 | 14506 | if(TEST_FIELD(cheat_options, ActivationKeyMessage)) |
| 14468 | 14507 | ui_popup_time(1,"%s enabled", entry->name); |
| r2844 | r2845 | |
| 14480 | 14519 | { |
| 14481 | 14520 | if(entry->action_list[i].flags & kActionFlag_Custom) |
| 14482 | 14521 | { |
| 14483 | if( | |
| 14522 | if( | |
| 14484 | 14523 | { |
| 14485 | 14524 | i = entry->label_index[entry->selection]; |
| 14486 | 14525 | isSelect = 1; |
| r2844 | r2845 | |
| 14525 | 14564 | { |
| 14526 | 14565 | if(entry->action_list[i].flags & kActionFlag_Custom) |
| 14527 | 14566 | { |
| 14528 | if( | |
| 14567 | if( | |
| 14529 | 14568 | { |
| 14530 | 14569 | i = entry->label_index[entry->selection]; |
| 14531 | 14570 | isSelect = 1; |
| 14532 | 14571 | continue; |
| 14533 | 14572 | } |
| 14534 | 14573 | } |
| 14535 | else if(entry->action_list[i].flags & kActionFlag_ | |
| 14574 | else if((entry->action_list[i].flags & kActionFlag_OperationDone) == 0) | |
| 14536 | 14575 | { |
| 14537 | i++; | |
| 14538 | } | |
| 14539 | else if(!(entry->action_list[i].flags & kActionFlag_OperationDone)) | |
| 14540 | { | |
| 14541 | 14576 | done = 0; |
| 14542 | 14577 | i++; |
| 14543 | 14578 | } |
| r2844 | r2845 | |
| 14552 | 14587 | } |
| 14553 | 14588 | |
| 14554 | 14589 | if(done) |
| 14555 | | |
| 14590 | deactivate_cheat(entry); | |
| 14556 | 14591 | } |
| 14557 | 14592 | } |
| 14558 | 14593 | |
| r2844 | r2845 | |
| 14570 | 14605 | update_cheat_info(&cheat_list[i], 1); |
| 14571 | 14606 | |
| 14572 | 14607 | if(cheat_list[i].flags & kCheatFlag_Select) |
| 14573 | | |
| 14608 | build_label_index_table(&cheat_list[i]); | |
| 14574 | 14609 | } |
| 14575 | 14610 | |
| 14576 | | |
| 14611 | set_layer_index(); | |
| 14577 | 14612 | } |
| 14578 | 14613 | |
| 14579 | /*-------------------------------------------------------------------------------------------------- | |
| 14614 | /*---------------------------------------------------------------------------------------------------- | |
| 14580 | 14615 | update_cheat_info - check several fields on cheat entry and cheat action then set flags |
| 14581 | "isLoadTime" parameter is set when called update_all_cheat_info() right now | |
| 14582 | --------------------------------------------------------------------------------------------------*/ | |
| 14616 | "is_load_time" parameter is set when called update_all_cheat_info() right now | |
| 14617 | ----------------------------------------------------------------------------------------------------*/ | |
| 14583 | 14618 | |
| 14584 | 14619 | static void update_cheat_info(cheat_entry *entry, UINT8 is_load_time) |
| 14585 | 14620 | { |
| r2844 | r2845 | |
| 14607 | 14642 | (EXTRACT_FIELD(action->type, LocationParameter) == kCustomLocation_Select)) |
| 14608 | 14643 | flags |= kCheatFlag_Select; |
| 14609 | 14644 | |
| 14610 | if(EXTRACT_FIELD(action->type, LocationType) != kLocation_Custom) | |
| 14645 | if(is_null && EXTRACT_FIELD(action->type, LocationType) != kLocation_Custom) | |
| 14611 | 14646 | is_null = 0; |
| 14612 | 14647 | |
| 14613 | 14648 | if(TEST_FIELD(action->type, UserSelectEnable)) |
| r2844 | r2845 | |
| 14630 | 14665 | } |
| 14631 | 14666 | |
| 14632 | 14667 | is_new_format = 0; |
| 14633 | is_one_shot = 0; | |
| 14634 | 14668 | } |
| 14635 | 14669 | else |
| 14636 | 14670 | { |
| r2844 | r2845 | |
| 14638 | 14672 | { |
| 14639 | 14673 | switch(EXTRACT_FIELD(action->type, CodeType)) |
| 14640 | 14674 | { |
| 14641 | case kCodeType_PDWWrite: | |
| 14642 | action_flags |= kActionFlag_PDWWrite; | |
| 14675 | case kCodeType_Write: | |
| 14676 | action_flags |= kActionFlag_MemoryWrite; | |
| 14643 | 14677 | break; |
| 14644 | 14678 | |
| 14645 | 14679 | case kCodeType_IWrite: |
| 14680 | action_flags |= kActionFlag_MemoryWrite; | |
| 14646 | 14681 | if(action->extend_data != ~0) |
| 14682 | { | |
| 14647 | 14683 | action_flags |= kActionFlag_IndexAddress; |
| 14648 | if(EXTRACT_FIELD(action->type, CodeParameterUpper) == IWRITE_LIMITED_MASK) | |
| 14649 | action_flags |= kActionFlag_LimitedMask; | |
| 14684 | if(EXTRACT_FIELD(action->type, CodeParameterUpper) == IWRITE_LIMITED_MASK) | |
| 14685 | action_flags |= kActionFlag_LimitedMask; | |
| 14686 | } | |
| 14650 | 14687 | break; |
| 14651 | 14688 | |
| 14689 | case kCodeType_RWrite: | |
| 14690 | action_flags |= kActionFlag_MemoryWrite; | |
| 14691 | action_flags |= kActionFlag_Repeat; | |
| 14692 | break; | |
| 14693 | ||
| 14694 | case kCodeType_CWrite: | |
| 14695 | action_flags |= kActionFlag_MemoryWrite; | |
| 14696 | action_flags |= kActionFlag_CheckCondition; | |
| 14697 | break; | |
| 14698 | ||
| 14652 | 14699 | case kCodeType_CBit: |
| 14653 | action->flags |= kActionFlag_CheckCondition; | |
| 14700 | action_flags |= kActionFlag_MemoryWrite; | |
| 14701 | action_flags |= kActionFlag_CheckCondition; | |
| 14654 | 14702 | if(EXTRACT_FIELD(action->type, CodeParameterUpper) == CBIT_LIMITED_MASK) |
| 14655 | 14703 | action_flags |= kActionFlag_LimitedMask; |
| 14656 | 14704 | break; |
| 14657 | 14705 | |
| 14658 | case kCodeType_RWrite: | |
| 14659 | action_flags |= kActionFlag_Repeat; | |
| 14706 | case kCodeType_PDWWrite: | |
| 14707 | action_flags |= kActionFlag_MemoryWrite; | |
| 14708 | action_flags |= kActionFlag_PDWWrite; | |
| 14660 | 14709 | break; |
| 14661 | 14710 | |
| 14662 | 14711 | case kCodeType_Move: |
| r2844 | r2845 | |
| 14664 | 14713 | action_flags |= kActionFlag_IndexAddress; |
| 14665 | 14714 | break; |
| 14666 | 14715 | |
| 14667 | case kCodeType_CWrite: | |
| 14668 | 14716 | case kCodeType_Branch: |
| 14669 | 14717 | action_flags |= kActionFlag_CheckCondition; |
| 14670 | 14718 | break; |
| r2844 | r2845 | |
| 14673 | 14721 | action_flags |= kActionFlag_CheckCondition; |
| 14674 | 14722 | break; |
| 14675 | 14723 | |
| 14676 | if(action->extend_data != ~0) | |
| 14677 | action_flags |= kActionFlag_IndexAddress; | |
| 14678 | break; | |
| 14679 | ||
| 14680 | 14724 | case kCodeType_Watch: |
| 14681 | 14725 | action_flags |= kActionFlag_NoAction; |
| 14682 | 14726 | break; |
| r2844 | r2845 | |
| 14695 | 14739 | flags |= kCheatFlag_Select; |
| 14696 | 14740 | |
| 14697 | 14741 | /* is comment? */ |
| 14698 | if(action->region != CUSTOM_CODE_COMMENT) | |
| 14742 | if(is_null && action->region != CUSTOM_CODE_COMMENT) | |
| 14699 | 14743 | is_null = 0; |
| 14700 | 14744 | |
| 14701 | 14745 | /* is separator? */ |
| 14702 | if(action->region != CUSTOM_CODE_SEPARATOR) | |
| 14746 | if(is_separator && action->region != CUSTOM_CODE_SEPARATOR) | |
| 14703 | 14747 | is_separator = 0; |
| 14704 | 14748 | |
| 14705 | 14749 | /* is layer index? */ |
| r2844 | r2845 | |
| 14714 | 14758 | action->flags = action_flags; |
| 14715 | 14759 | } |
| 14716 | 14760 | |
| 14717 | if(is_new_format == 0) | |
| 14718 | flags |= kCheatFlag_OldFormat; | |
| 14719 | ||
| 14720 | 14761 | if(is_one_shot) |
| 14721 | 14762 | flags |= kCheatFlag_OneShot; |
| 14722 | 14763 | |
| 14723 | if(is_n | |
| 14764 | if(is_new_format == 0) | |
| 14724 | 14765 | { |
| 14725 | if(entry->action_list_length > 1) | |
| 14726 | flags |= kCheatFlag_ExtendComment; | |
| 14727 | else | |
| 14766 | flags |= kCheatFlag_OldFormat; | |
| 14767 | ||
| 14768 | if(is_null) | |
| 14728 | 14769 | flags |= kCheatFlag_Null; |
| 14729 | 14770 | } |
| 14771 | else | |
| 14772 | { | |
| 14773 | if(is_null) | |
| 14774 | { | |
| 14775 | /* NOTE : auto detection if multi-comment code */ | |
| 14776 | if(entry->action_list_length > 1) | |
| 14777 | flags |= kCheatFlag_ExtendComment; | |
| 14778 | else | |
| 14779 | flags |= kCheatFlag_Null; | |
| 14780 | } | |
| 14730 | 14781 | |
| 14731 | if(is_new_format) | |
| 14732 | { | |
| 14733 | 14782 | if(is_separator) |
| 14734 | 14783 | { |
| 14735 | 14784 | flags |= kCheatFlag_Null; |
| r2844 | r2845 | |
| 14746 | 14795 | check_code_format(entry); |
| 14747 | 14796 | } |
| 14748 | 14797 | |
| 14749 | /*-------------------- | |
| 14750 | AnalyseCodeFormat | |
| 14751 | --------------------*/ | |
| 14798 | /*---------------------- | |
| 14799 | analyse_code_format | |
| 14800 | ----------------------*/ | |
| 14752 | 14801 | |
| 14753 | static UINT32 | |
| 14802 | static UINT32 analyse_code_format(cheat_entry *entry, cheat_action *action) | |
| 14754 | 14803 | { |
| 14755 | 14804 | UINT32 errorFlag = 0; |
| 14756 | 14805 | |
| r2844 | r2845 | |
| 14908 | 14957 | } |
| 14909 | 14958 | else |
| 14910 | 14959 | { |
| 14911 | if( | |
| 14960 | if( | |
| 14912 | 14961 | errorFlag |= kErrorFlag_InvalidCustomCode; |
| 14913 | 14962 | } |
| 14914 | 14963 | } |
| r2844 | r2845 | |
| 14929 | 14978 | { |
| 14930 | 14979 | cheat_action *action = &entry->action_list[i]; |
| 14931 | 14980 | |
| 14932 | if( | |
| 14981 | if(analyse_code_format(entry, action)) | |
| 14933 | 14982 | is_error = 1; |
| 14934 | 14983 | } |
| 14935 | 14984 | |
| 14936 | 14985 | if(is_error) |
| 14937 | 14986 | { |
| 14938 | 14987 | entry->flags |= kCheatFlag_HasWrongCode; |
| 14939 | SET_MESSAGE( | |
| 14988 | SET_MESSAGE( | |
| 14940 | 14989 | } |
| 14941 | 14990 | } |
| 14942 | 14991 | |
| 14943 | /*------------------------------------------------------------------------------------------------- | |
| 14944 | BuildLabelIndexTable - create index table for label-selection and calculate index table length | |
| 14945 | -------------------------------------------------------------------------------------------------*/ | |
| 14992 | /*---------------------------------------------------------------------------------------------------- | |
| 14993 | build_label_index_table - create index table for label-selection and calculate index table length | |
| 14994 | ----------------------------------------------------------------------------------------------------*/ | |
| 14946 | 14995 | |
| 14947 | static void | |
| 14996 | static void build_label_index_table(cheat_entry *entry) | |
| 14948 | 14997 | { |
| 14949 | 14998 | int i, j, length = 0; |
| 14950 | 14999 | |
| r2844 | r2845 | |
| 14954 | 15003 | { |
| 14955 | 15004 | cheat_action *action = &entry->action_list[i]; |
| 14956 | 15005 | |
| 14957 | if((action->flags & | |
| 15006 | if((action->flags & | |
| 14958 | 15007 | { |
| 14959 | entry->label_index = malloc_or_die(sizeof(entry->label_index) * (++entry->label_index_length + 1)); | |
| 15008 | /* label selection master code */ | |
| 15009 | entry->label_index = malloc(sizeof(entry->label_index) * (++entry->label_index_length + 1)); | |
| 15010 | ||
| 15011 | if(entry->label_index == NULL) | |
| 15012 | goto label_index_error; | |
| 15013 | ||
| 14960 | 15014 | entry->label_index[j++] = i; |
| 14961 | ||
| 14962 | 15015 | length = action->data ? action->data + i : entry->action_list_length; |
| 14963 | 15016 | } |
| 14964 | 15017 | else if(EXTRACT_FIELD(action->type, Link) == kLink_Link) |
| 14965 | 15018 | { |
| 15019 | /* link or sub-link code */ | |
| 14966 | 15020 | if(length) |
| 14967 | 15021 | { |
| 14968 | 15022 | entry->label_index = realloc(entry->label_index, sizeof(entry->label_index) * (++entry->label_index_length + 1)); |
| 15023 | ||
| 15024 | if(entry->label_index == NULL) | |
| 15025 | goto label_index_error; | |
| 15026 | ||
| 14969 | 15027 | entry->label_index[j++] = i; |
| 14970 | 15028 | } |
| 14971 | 15029 | } |
| r2844 | r2845 | |
| 14973 | 15031 | |
| 14974 | 15032 | if(entry->label_index_length <= 1) |
| 14975 | 15033 | { |
| 14976 | logerror("cheat | |
| 15034 | logerror("cheat: [ | |
| 14977 | 15035 | return; |
| 14978 | 15036 | } |
| 15037 | else | |
| 15038 | /* set terminator */ | |
| 15039 | entry->label_index[entry->label_index_length] = ~0; | |
| 14979 | 15040 | |
| 14980 | 15041 | if(entry->flags & kCheatFlag_OneShot) |
| 14981 | 15042 | entry->selection = 1; |
| 14982 | 15043 | |
| 14983 | //logerror("Cheat - Finish building index table for %s (length = %x)\n", entry->name, entry->label_index_length); | |
| 14984 | //for(i = 0; i < entry->label_index_length; i++) | |
| 14985 | // logerror("IndexTable[%x] = %x\n",i,entry->label_index[i]); | |
| 15044 | /* logerror("Cheat - Finish building index table for %s (length = %x)\n", entry->name, entry->label_index_length); */ | |
| 15045 | /* for(i = 0; i < entry->label_index_length; i++) */ | |
| 15046 | /* logerror("IndexTable[%x] = %x\n",i,entry->label_index[i]); */ | |
| 14986 | 15047 | |
| 15048 | return; | |
| 15049 | ||
| 15050 | label_index_error: | |
| 15051 | ||
| 15052 | fatalerror("cheat:[label index table] memory allocation error\n" | |
| 15053 | " name = %s\n" | |
| 15054 | " label_index_length = %.8X\n" | |
| 15055 | " label_index_length = %p\n", | |
| 15056 | entry->name, entry->label_index_length, entry->label_index); | |
| 14987 | 15057 | } |
| 14988 | 15058 | |
| 14989 | /*---------------- | |
| 14990 | SetLayerIndex | |
| 14991 | ----------------*/ | |
| 15059 | /*------------------ | |
| 15060 | set_layer_index | |
| 15061 | ------------------*/ | |
| 14992 | 15062 | |
| 14993 | static void | |
| 15063 | static void set_layer_index(void) | |
| 14994 | 15064 | { |
| 14995 | 15065 | int i, j; |
| 14996 | 15066 | |
| r2844 | r2845 | |
| 15010 | 15080 | { |
| 15011 | 15081 | cheat_entry *traverse = &cheat_list[j]; |
| 15012 | 15082 | |
| 15013 | if( | |
| 15083 | if( | |
| 15014 | 15084 | traverse->layer_index = entry->action_list[0].data; |
| 15015 | 15085 | } |
| 15016 | 15086 | } |
| r2844 | r2845 | |
| 15018 | 15088 | } |
| 15019 | 15089 | } |
| 15020 | 15090 | |
| 15021 | /*----------------------------------------------------------------------------------------- | |
| 15022 | DisplayCheatMessage - display cheat message via ui_draw_text_box instead of popup menu | |
| 15023 | warning message is displayed with red back color | |
| 15024 | -----------------------------------------------------------------------------------------*/ | |
| 15091 | /*------------------------------------------------------------------------------------------- | |
| 15092 | display_cheat_message - display cheat message via ui_draw_text_box instead of popup menu | |
| 15093 | -------------------------------------------------------------------------------------------*/ | |
| 15025 | 15094 | |
| 15026 | static void | |
| 15095 | static void display_cheat_message(void) | |
| 15027 | 15096 | { |
| 15028 | static const char *const kCheatMessageTable[] = { | |
| 15029 | "INVALID MESSAGE!", // this message is unused | |
| 15030 | "cheat option reloaded", | |
| 15031 | "cheat code reloaded", | |
| 15032 | "user defined search region reloaded", | |
| 15033 | "failed to load database!", | |
| 15034 | "cheats found", | |
| 15035 | "1 result found, added to list", | |
| 15036 | "succeeded to save", | |
| 15037 | "failed to save!", | |
| 15038 | "cheats saved", | |
| 15039 | "activation key saved", | |
| 15040 | "no activation key!", | |
| 15041 | "pre-enable saved", | |
| 15042 | "succeeded to add", | |
| 15043 | "failed to add!", | |
| 15044 | "succeeded to delete", | |
| 15045 | "failed to delete!", | |
| 15046 | "no search region!", | |
| 15047 | "values restored", | |
| 15048 | "there are no old values!", | |
| 15049 | "saved all memory regions", | |
| 15050 | "region invalidated remains results are", | |
| 15051 | "failed to allocate memory!", | |
| 15052 | "found wrong code!" }; | |
| 15053 | ||
| 15054 | 15097 | char buf[64]; |
| 15055 | 15098 | |
| 15056 | if(message_type == 0) | |
| 15057 | return; | |
| 15058 | ||
| 15059 | 15099 | switch(message_type) |
| 15060 | 15100 | { |
| 15061 | 15101 | /* simple message */ |
| 15062 | 15102 | default: |
| 15063 | sprintf(buf, "%s", | |
| 15103 | sprintf(buf, "%s", | |
| 15064 | 15104 | break; |
| 15065 | 15105 | |
| 15066 | 15106 | /* message with data */ |
| 15067 | case kCheatMessage_CheatFound: | |
| 15068 | case kCheatMessage_InvalidatedRegion: | |
| 15069 | { | |
| 15070 | search_info *search = get_current_search(); | |
| 15107 | case CHEAT_MESSAGE_CHEAT_FOUND: | |
| 15108 | case CHEAT_MESSAGE_INVALIDATE_REGION: | |
| 15109 | { | |
| 15110 | search_info *search = get_current_search(); | |
| 15071 | 15111 | |
| 15072 | sprintf(buf, "%d %s", search->num_results, kCheatMessageTable[message_type]); | |
| 15073 | } | |
| 15074 | break; | |
| 15112 | sprintf(buf, "%d %s", search->num_results, CHEAT_MESSAGE_TABLE[message_type]); | |
| 15113 | } | |
| 15114 | break; | |
| 15075 | 15115 | |
| 15076 | case kCheatMessage_AllCheatSaved: | |
| 15077 | sprintf(buf, "%d %s", cheat_list_length, kCheatMessageTable[message_type]); | |
| 15116 | case CHEAT_MESSAGE_ALL_CHEATS_SAVED: | |
| 15117 | sprintf(buf, "%d %s", cheat_list_length, CHEAT_MESSAGE_TABLE[message_type]); | |
| 15078 | 15118 | break; |
| 15079 | 15119 | } |
| 15080 | 15120 | |
| r2844 | r2845 | |
| 15085 | 15125 | ui_draw_text_box(buf, JUSTIFY_CENTER, 0.5f, 0.9f, UI_FILLCOLOR); |
| 15086 | 15126 | break; |
| 15087 | 15127 | |
| 15088 | case kCheatMessage_None: | |
| 15089 | case kCheatMessage_FailedToLoadDatabase: | |
| 15090 | case kCheatMessage_FailedToSave: | |
| 15091 | case kCheatMessage_NoActivationKey: | |
| 15092 | case kCheatMessage_FailedToAdd: | |
| 15093 | case kCheatMessage_FailedToDelete: | |
| 15094 | case kCheatMessage_NoSearchRegion: | |
| 15095 | case kCheatMessage_NoOldValue: | |
| 15096 | case kCheatMessage_Max: | |
| 15097 | case kCheatMessage_FailedToAllocate: | |
| 15098 | case kCheatMessage_WrongCode: | |
| 15128 | case CHEAT_MESSAGE_NONE: | |
| 15129 | case CHEAT_MESSAGE_FAILED_TO_LOAD_DATABASE: | |
| 15130 | case CHEAT_MESSAGE_FAILED_TO_SAVE: | |
| 15131 | case CHEAT_MESSAGE_NO_SUPPORTED_OLD_FORMAT: | |
| 15132 | case CHEAT_MESSAGE_NO_ACTIVATION_KEY: | |
| 15133 | case CHEAT_MESSAGE_FAILED_TO_ADD: | |
| 15134 | case CHEAT_MESSAGE_FAILED_TO_DELETE: | |
| 15135 | case CHEAT_MESSAGE_NO_SEARCH_REGION: | |
| 15136 | case CHEAT_MESSAGE_NO_OLD_VALUE: | |
| 15137 | case CHEAT_MESSAGE_FAILED_TO_ALLOCATE: | |
| 15138 | case CHEAT_MESSAGE_WRONG_CODE: | |
| 15139 | case CHEAT_MESSAGE_MAX: | |
| 15099 | 15140 | /* warning message has red background color */ |
| 15100 | 15141 | ui_draw_text_box(buf, JUSTIFY_CENTER, 0.5f, 0.9f, UI_REDCOLOR); |
| 15101 | 15142 | break; |
| r2844 | r2845 | |
| 15112 | 15153 | |
| 15113 | 15154 | static UINT8 get_address_length(UINT8 region) |
| 15114 | 15155 | { |
| 15115 | if(region | |
| 15156 | if(region < | |
| 15116 | 15157 | { |
| 15117 | 15158 | cpu_region_info *info = get_cpu_or_region_info(region); |
| 15118 | 15159 | |
| r2844 | r2845 | |
| 15120 | 15161 | return info->address_chars_needed; |
| 15121 | 15162 | } |
| 15122 | 15163 | |
| 15123 | return | |
| 15164 | return cpu | |
| 15124 | 15165 | } |
| 15125 | 15166 | |
| 15126 | 15167 | /*------------------ |
| r2844 | r2845 | |
|---|---|---|
| 64 | 64 | XTAL_7_15909MHz = 7159090, /* Blood Bros */ |
| 65 | 65 | XTAL_7_3728MHz = 7372800, |
| 66 | 66 | XTAL_8MHz = 8000000, /* Extremely common, used on 100's of PCBs */ |
| 67 | XTAL_8_664MHz = 8664000, /* Touchmaster */ | |
| 67 | 68 | XTAL_9_987MHz = 9987000, /* Crazy Balloon */ |
| 68 | 69 | XTAL_10MHz = 10000000, |
| 69 | 70 | XTAL_10_595MHz = 10595000, /* Mad Alien */ |
| r2844 | r2845 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | static void nes_vh_reset(running_machine *machine) |
| 27 | 27 | { |
| 28 | ppu2c0x_reset( 0, 1 ); | |
| 28 | ppu2c0x_reset( machine, 0, 1 ); | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 |
| r2844 | r2845 | |
|---|---|---|
| 878 | 878 | int reg = offset*8; |
| 879 | 879 | UINT64 r = 0; |
| 880 | 880 | if (!(mem_mask & U64(0xff00000000000000))) { |
| 881 | r |= (UINT64)lsi53c810_reg_r(reg+0) << 56; | |
| 881 | r |= (UINT64)lsi53c810_reg_r(machine, reg+0) << 56; | |
| 882 | 882 | } |
| 883 | 883 | if (!(mem_mask & U64(0x00ff000000000000))) { |
| 884 | r |= (UINT64)lsi53c810_reg_r(reg+1) << 48; | |
| 884 | r |= (UINT64)lsi53c810_reg_r(machine, reg+1) << 48; | |
| 885 | 885 | } |
| 886 | 886 | if (!(mem_mask & U64(0x0000ff0000000000))) { |
| 887 | r |= (UINT64)lsi53c810_reg_r(reg+2) << 40; | |
| 887 | r |= (UINT64)lsi53c810_reg_r(machine, reg+2) << 40; | |
| 888 | 888 | } |
| 889 | 889 | if (!(mem_mask & U64(0x000000ff00000000))) { |
| 890 | r |= (UINT64)lsi53c810_reg_r(reg+3) << 32; | |
| 890 | r |= (UINT64)lsi53c810_reg_r(machine, reg+3) << 32; | |
| 891 | 891 | } |
| 892 | 892 | if (!(mem_mask & U64(0x00000000ff000000))) { |
| 893 | r |= (UINT64)lsi53c810_reg_r(reg+4) << 24; | |
| 893 | r |= (UINT64)lsi53c810_reg_r(machine, reg+4) << 24; | |
| 894 | 894 | } |
| 895 | 895 | if (!(mem_mask & U64(0x0000000000ff0000))) { |
| 896 | r |= (UINT64)lsi53c810_reg_r(reg+5) << 16; | |
| 896 | r |= (UINT64)lsi53c810_reg_r(machine, reg+5) << 16; | |
| 897 | 897 | } |
| 898 | 898 | if (!(mem_mask & U64(0x000000000000ff00))) { |
| 899 | r |= (UINT64)lsi53c810_reg_r(reg+6) << 8; | |
| 899 | r |= (UINT64)lsi53c810_reg_r(machine, reg+6) << 8; | |
| 900 | 900 | } |
| 901 | 901 | if (!(mem_mask & U64(0x00000000000000ff))) { |
| 902 | r |= (UINT64)lsi53c810_reg_r(reg+7) << 0; | |
| 902 | r |= (UINT64)lsi53c810_reg_r(machine, reg+7) << 0; | |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | return r; |
| r2844 | r2845 | |
|---|---|---|
| 192 | 192 | #CPUS += ALPHA8301 |
| 193 | 193 | CPUS += CDP1802 |
| 194 | 194 | CPUS += COP420 |
| 195 | #CPUS += COP421 | |
| 195 | 196 | #CPUS += COP410 |
| 196 | 197 | #CPUS += TLCS90 |
| 197 | 198 | #CPUS += MB8841 |
| r2844 | r2845 | |
|---|---|---|
| 38 | 38 | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x800048, 0x800049, 0, 0, forgottn_dial_1_reset_w); |
| 39 | 39 | memory_install_read16_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x800052, 0x800055, 0, 0, forgottn_dial_0_r); |
| 40 | 40 | memory_install_read16_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x80005a, 0x80005d, 0, 0, forgottn_dial_1_r); |
| 41 | cps1_hack_dsw_r(machine, 0, 0); | |
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | /*************************************************************************** |
| r2844 | r2845 | |
|---|---|---|
| 131 | 131 | |
| 132 | 132 | static INTERRUPT_GEN( dc_dispatch_vblank ) |
| 133 | 133 | { |
| 134 | dc_vblank(); | |
| 134 | dc_vblank(machine); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | static const struct sh4_config sh4cpu_config = { 1, 0, 1, 0, 0, 0, 1, 1, 0, CPU_CLOCK }; |
| r2844 | r2845 | |
|---|---|---|
| 1409 | 1409 | const device_config *screen = video_screen_first(machine->config); |
| 1410 | 1410 | current_screen_height = video_screen_get_height(screen); |
| 1411 | 1411 | extra_RAM = new_memory_region( machine, REGION_USER2, 0x8600, ROM_REQUIRED ); |
| 1412 | tia_init( &tia_interface ); | |
| 1412 | tia_init( machine, &tia_interface ); | |
| 1413 | 1413 | r6532_config( 0, &r6532_interface ); |
| 1414 | 1414 | r6532_set_clock( 0, MASTER_CLOCK_NTSC / 3 ); |
| 1415 | 1415 | r6532_reset(0); |
| r2844 | r2845 | |
| 1422 | 1422 | const device_config *screen = video_screen_first(machine->config); |
| 1423 | 1423 | current_screen_height = video_screen_get_height(screen); |
| 1424 | 1424 | extra_RAM = new_memory_region( machine, REGION_USER2, 0x8600, ROM_REQUIRED ); |
| 1425 | tia_init( &tia_interface_pal ); | |
| 1425 | tia_init( machine, &tia_interface_pal ); | |
| 1426 | 1426 | r6532_config( 0, &r6532_interface ); |
| 1427 | 1427 | r6532_set_clock( 0, MASTER_CLOCK_PAL / 3 ); |
| 1428 | 1428 | r6532_reset(0); |
| r2844 | r2845 | |
|---|---|---|
| 715 | 715 | |
| 716 | 716 | static MACHINE_RESET( psx ) |
| 717 | 717 | { |
| 718 | psx_machine_init(); | |
| 718 | psx_machine_init(machine); | |
| 719 | 719 | psx_sio_install_handler( 0, psx_sio0 ); |
| 720 | 720 | } |
| 721 | 721 |
| r2844 | r2845 | |
|---|---|---|
| 128 | 128 | |
| 129 | 129 | Source Changes: |
| 130 | 130 | ---------------- |
| 131 | - The core is based on MAME 0.125u | |
| 131 | - The core is based on MAME 0.125u5. This incorporates all features of the | |
| 132 | 132 | update to this core. [MAME team] |
| 133 | 133 | |
| 134 | 134 | - Fixed performance problems with -triplebuffer. (bug #1539) [Justin Kerk] |
| Previous | 15994 Revisions | Next |